From a5bbaf62069a79fa7f9d26d4d9327618b0b59bec Mon Sep 17 00:00:00 2001 From: Michael Puehringer Date: Tue, 9 Jan 2024 09:08:33 +0100 Subject: [PATCH 1/8] Update to latest master --- .github/workflows/ci.yml | 21 +- .github/workflows/deploy-editor.yml | 50 +- .github/workflows/release.yml | 7 +- .github/workflows/semantic-pull-request.yml | 1 + CHANGELOG.md | 29 + CONTRIBUTING.md | 28 +- README.md | 2 +- editor/Editor.tsx | 4 +- editor/EditorPanel.tsx | 2 +- editor/example/index.ts | 11 + editor/example/json-spec/index.ts | 2 + editor/example/json-spec/perf-alignment.ts | 30 + editor/example/thumbnails.ts | 2 + editor/example/thumbnails/PERF_ALIGNMENT.png | Bin 0 -> 114031 bytes package.json | 20 +- playwright.config.ts | 2 +- pnpm-lock.yaml | 7546 ++++++++++++++++++ src/exported-utils.ts | 4 + src/gosling-schema/gosling.schema.json | 144 + src/gosling-schema/gosling.schema.ts | 19 + src/higlass-schema/higlass.schema.ts | 2 +- src/tracks/gosling-track/gosling-track.ts | 100 +- yarn.lock | 7061 ---------------- 23 files changed, 7970 insertions(+), 7117 deletions(-) create mode 100644 editor/example/json-spec/perf-alignment.ts create mode 100644 editor/example/thumbnails/PERF_ALIGNMENT.png create mode 100644 pnpm-lock.yaml delete mode 100644 yarn.lock diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84a2fbc0..40308274 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI on: push: branches: - - master + - main pull_request: env: @@ -20,8 +20,9 @@ jobs: uses: actions/setup-node@v3 with: node-version: 20 - - run: yarn install - - run: yarn build-editor + - uses: pnpm/action-setup@v2 + - run: pnpm install + - run: pnpm build-editor env: NODE_OPTIONS: '--max_old_space_size=4096' @@ -37,10 +38,11 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - run: yarn install + - uses: pnpm/action-setup@v2 + - run: pnpm install - run: | - yarn build-types # typecheck - yarn coverage + pnpm build-types # typecheck + pnpm coverage env: NODE_OPTIONS: '--max_old_space_size=4096' - uses: codecov/codecov-action@v3 @@ -55,10 +57,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 20 - - run: yarn install + - uses: pnpm/action-setup@v2 + - run: pnpm install - name: ESLint - run: yarn eslint src/ editor/ + run: pnpm eslint src/ editor/ - name: Assert schemas are all up to date run: | - yarn schema + pnpm schema git diff --exit-code diff --git a/.github/workflows/deploy-editor.yml b/.github/workflows/deploy-editor.yml index ca4f4cc7..16e5c135 100644 --- a/.github/workflows/deploy-editor.yml +++ b/.github/workflows/deploy-editor.yml @@ -2,29 +2,47 @@ name: Deploy Editor on: push: - branches: - - master + branches: [main] + workflow_dispatch: -jobs: +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: 'pages' + cancel-in-progress: false - deploy: +jobs: + Build: runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 20 - - run: yarn install - - run: yarn build-editor + - uses: pnpm/action-setup@v2 + - run: | + pnpm install + pnpm build-editor + echo "gosling.js.org" >> build/CNAME env: NODE_OPTIONS: '--max_old_space_size=8192' - - name: Deploy editor - run: | - git config --global user.name "action@github.com" - git config --global user.email "GitHub Action" - git remote set-url origin https://${ACCESS_TOKEN}@github.com/${REPO}.git - yarn deploy - env: - ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} - REPO: ${{ github.repository }} + - uses: actions/upload-pages-artifact@v2 + with: + path: build + + Deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: Build + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 165a8557..3f1b7a0f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,9 +15,10 @@ jobs: with: node-version: 20 registry-url: https://registry.npmjs.org/ - - run: yarn - - run: yarn build - - run: yarn publish + - uses: pnpm/action-setup@v2 + - run: pnpm install + - run: pnpm build + - run: pnpm publish --no-git-checks env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/semantic-pull-request.yml b/.github/workflows/semantic-pull-request.yml index d22ad0ad..a0041c2b 100644 --- a/.github/workflows/semantic-pull-request.yml +++ b/.github/workflows/semantic-pull-request.yml @@ -25,6 +25,7 @@ jobs: docs refactor test + perf # Configure which scopes are allowed. scopes: | core diff --git a/CHANGELOG.md b/CHANGELOG.md index 27382ee5..011a385e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,32 @@ +# [0.14.0](https://github.com/gosling-lang/gosling.js/compare/v0.13.2...v0.14.0) (2024-01-08) + + +### Performance Improvements + +* **core:** stretch certain marks instead of redraw ([#1018](https://github.com/gosling-lang/gosling.js/issues/1018)) ([0b405ba](https://github.com/gosling-lang/gosling.js/commit/0b405ba4d912e988768a467668730b877a0b7a61)), closes [#1023](https://github.com/gosling-lang/gosling.js/issues/1023) + + + +## [0.13.2](https://github.com/gosling-lang/gosling.js/compare/v0.13.1...v0.13.2) (2023-12-19) + + +### Features + +* **core:** export util functions for conversion to flat tracks ([#1016](https://github.com/gosling-lang/gosling.js/issues/1016)) ([85f0be1](https://github.com/gosling-lang/gosling.js/commit/85f0be1efcac6db4e2e3e95cb6665e544b1e91f1)), closes [#1017](https://github.com/gosling-lang/gosling.js/issues/1017) + + + +## [0.13.1](https://github.com/gosling-lang/gosling.js/compare/v0.13.0...v0.13.1) (2023-12-12) + + +### Bug Fixes + +* **core:** editor deployment ([#1010](https://github.com/gosling-lang/gosling.js/issues/1010)) ([afb8ae4](https://github.com/gosling-lang/gosling.js/commit/afb8ae46fff8d13b1cc6e5a8971dbcf8ea654504)) +* **core:** pnpm deploy ([#1009](https://github.com/gosling-lang/gosling.js/issues/1009)) ([8e51fbe](https://github.com/gosling-lang/gosling.js/commit/8e51fbe2f1cb37fb6de630aa41699e961ec2e8da)) +* **track:** Allows for tracks in stacked circular tracks to receive click events ([#1005](https://github.com/gosling-lang/gosling.js/issues/1005)) ([aea3a5d](https://github.com/gosling-lang/gosling.js/commit/aea3a5d8a5b700e9316cf6206cf5eaf4d1d9858d)) + + + # [0.13.0](https://github.com/gosling-lang/gosling.js/compare/v0.12.0...v0.13.0) (2023-12-04) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b6b56c30..43f2b79f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,15 +5,15 @@ While contribution guidelines are loosely defined, we recommend to read the foll ## Getting Started -We use Yarn (and not NPM) to manage dependencies in stable and consistent ways. +We use pnpm (and not NPM) to manage dependencies in stable and consistent ways. -After installing [Yarn](https://yarnpkg.com/getting-started/install), clone this repository and run the following commands to install all dependencies and run the Gosling.js editor locally. We recommend you use Node 20. +After installing [pnpm](https://pnpm.io/installation), clone this repository and run the following commands to install all dependencies and run the Gosling.js editor locally. We recommend you use Node 20. ```sh git clone https://github.com/gosling-lang/gosling.js.git # Clone the repository to your current directory cd gosling.js # Navigate to gosling repository -yarn # Install dependencies -yarn start # Start a local server running the Gosling online editor +pnpm install # Install dependencies +pnpm start # Start a local server running the Gosling online editor ``` Then, you can open http://localhost:3000/ in a web browser to test the online editor. @@ -49,11 +49,11 @@ git commit -m 'docs: add details about commitlint in README.md' To learn more about the commitlint, please visit [conventional-changelog/commitlint](https://github.com/conventional-changelog/commitlint#what-is-commitlint). ## Opening Pull Requests -We use the [commitlint](#commitlint) for the title of PR. So, if the title of PR is not following the commitlint conventions, [Semantic Pull Request](https://github.com/zeke/semantic-pull-requests) will complain about it, disallowing your PR to be merged. When your PR is accepted and merged into the master branch, the title of the PR will be recorded as a single commit message which will then added as a single item in [CHANGELOG.md](/CHANGELOG.md). +We use the [commitlint](#commitlint) for the title of PR. So, if the title of PR is not following the commitlint conventions, [Semantic Pull Request](https://github.com/zeke/semantic-pull-requests) will complain about it, disallowing your PR to be merged. When your PR is accepted and merged into the main branch, the title of the PR will be recorded as a single commit message which will then added as a single item in [CHANGELOG.md](/CHANGELOG.md). ## Testing -Gosling.js uses [Vitest](https://vitest.dev/) for running tests. To run all of the tests, you can use the command `yarn test`. +Gosling.js uses [Vitest](https://vitest.dev/) for running tests. To run all of the tests, you can use the command `pnpm test`. ## Testing Production Build Using Editor @@ -62,9 +62,9 @@ It is sometimes necessary to test the production build of Gosling.js. This frequ To test this, you need to build the project first and then preview the production build. ```sh -yarn build -yarn build-editor -yarn preview +pnpm build +pnpm build-editor +pnpm preview ``` ## Editing `gosling.js/embed` @@ -74,7 +74,7 @@ used in [Observable notebooks](https://observablehq.com). You can start the deve via: ```sh -yarn start-embed +pnpm start-embed ``` and open a new Observable notebook with a cell containing, @@ -95,12 +95,12 @@ to get started. You may want to edit the grammar (e.g., rename properties) and test the updated grammar in the Online Editor. The Gosling's grammar is defined using TypeScript in a single file, [/src/core/gosling.schema.ts](/src/core/gosling.schema.ts). You can update this file to edit grammar. However, to test with Online Editor, you need to update [/src/core/gosling.schema.json](/src/core/gosling.schema.json) by running the following command: ```sh -yarn schema +pnpm schema ``` This will create the `gosling.schema.json` file based on the `gosling.schema.ts`. The reason for updating the `*.json` file is that the Online Editor only compiles the gosling spec only if the specification is valid depending of the `gosling.schema.json`. Therefore, if you edit the grammar and do not update the `gosling.schema.json` file, the Online Editor will not compile the spec, showing an empty view. -`gosling.schema.json` is updated everytime when you `commit` changes, so you do not have to run `yarn schema` by yourselves before the `commit`. +`gosling.schema.json` is updated everytime when you `commit` changes, so you do not have to run `pnpm schema` by yourselves before the `commit`. ### Editing Grammar for Documentation Since `gosling.schema.json` is used to semi-automatically generate property tables in [Gosling Documentation](http://gosling-lang.org/docs), we highly recommend you to **provide comments** for added/modified grammar properties in `gosling.schema.ts`. These comments will be used to explain properties in the documentation (e.g., [BigWig Data](http://gosling-lang.org/docs/data#bigwig-no-higlass-server)). @@ -141,8 +141,8 @@ If there is an example you would like to add to the editor example library, plea GitHub Action handles bumping the version of Gosling.js. The pattern looks like the following: ``` -yarn version --patch -git push origin master --tags +pnpm version patch # or minor or major +git push origin main --tags ``` # Internal Explanations diff --git a/README.md b/README.md index 16585d56..a534009d 100644 --- a/README.md +++ b/README.md @@ -60,4 +60,4 @@ We welcome and greatly appreciate your contribution to this project! Please read ## License -This project is licensed under the terms of the [MIT license](https://github.com/gosling-lang/gosling.js/blob/master/LICENSE.md). +This project is licensed under the terms of the [MIT license](https://github.com/gosling-lang/gosling.js/blob/main/LICENSE.md). diff --git a/editor/Editor.tsx b/editor/Editor.tsx index 5de59423..8ce1de99 100644 --- a/editor/Editor.tsx +++ b/editor/Editor.tsx @@ -1389,7 +1389,7 @@ function Editor(props: RouteComponentProps) {

@@ -1398,7 +1398,7 @@ function Editor(props: RouteComponentProps) {

diff --git a/editor/EditorPanel.tsx b/editor/EditorPanel.tsx index c40fbce1..fbebafc3 100644 --- a/editor/EditorPanel.tsx +++ b/editor/EditorPanel.tsx @@ -111,7 +111,7 @@ function EditorPanel(props: { validate: true, schemas: [ { - uri: 'https://raw.githubusercontent.com/gosling-lang/gosling.js/master/schema/gosling.schema.json', + uri: 'https://raw.githubusercontent.com/gosling-lang/gosling.js/main/schema/gosling.schema.json', fileMatch: ['*'], schema: GoslingSchema } diff --git a/editor/example/index.ts b/editor/example/index.ts index 742e128b..dd914725 100644 --- a/editor/example/index.ts +++ b/editor/example/index.ts @@ -36,6 +36,7 @@ export type ExampleGroup = | 'Coordinated Multiple Views' | 'Applications' | 'Track Templates' + | 'Experimental' | 'Doc' | 'Unassigned'; @@ -75,6 +76,10 @@ export const ExampleGroups: { name: 'Track Templates', description: 'Built-in track templates that allow creating common tracks, like ideograms and gene annotations.' }, + { + name: 'Experimental', + description: 'Examples that include experimental features, such as performance improvements.' + }, { name: 'Doc', description: 'Examples used in the official documentation.' @@ -412,6 +417,12 @@ export const editorExampleObj: { spec: JsonExampleSpecs.EX_SPEC_ALIGNMENT_CHART, image: THUMBNAILS.ALIGNMENT }, + PERF_ALIGNMENT: { + group: 'Experimental', + name: 'Performance Comparison: Stretching Tiles', + spec: JsonExampleSpecs.EX_SPEC_PERF_ALIGNMENT, + image: THUMBNAILS.PERF_ALIGNMENT + }, CORCES_ET_AL: { group: 'Coordinated Multiple Views', name: 'Corces et al. 2020', diff --git a/editor/example/json-spec/index.ts b/editor/example/json-spec/index.ts index 835c69e0..3fd03232 100644 --- a/editor/example/json-spec/index.ts +++ b/editor/example/json-spec/index.ts @@ -24,6 +24,7 @@ import { EX_SPEC_CYTOBANDS } from './ideograms'; import { EX_SPEC_PILEUP } from './pileup'; import { EX_SPEC_TEMPLATE } from './track-template'; import { EX_SPEC_MOUSE_EVENT } from './mouse-event'; +import { EX_SPEC_PERF_ALIGNMENT } from './perf-alignment' import { EX_SPEC_DEBUG } from './debug'; export const JsonExampleSpecs = { @@ -42,6 +43,7 @@ export const JsonExampleSpecs = { EX_SPEC_RESPONSIVE_TRACK_WISE_COMPARISON, EX_SPEC_ALIGNMENT_CHART, EX_SPEC_RESPONSIVE_ALIGNMENT_CHART, + EX_SPEC_PERF_ALIGNMENT, EX_SPEC_MARK_DISPLACEMENT, EX_SPEC_CIRCULAR_OVERVIEW_LINEAR_DETAIL, EX_SPEC_SARS_COV_2, diff --git a/editor/example/json-spec/perf-alignment.ts b/editor/example/json-spec/perf-alignment.ts new file mode 100644 index 00000000..a689a3c0 --- /dev/null +++ b/editor/example/json-spec/perf-alignment.ts @@ -0,0 +1,30 @@ +import type { GoslingSpec } from '@gosling-lang/gosling-schema'; +import { alignmentWithText } from './responsive-alignment'; + +const commonProps = { width: 800, height: 400, xAxis: false, rowLegend: false, colorLegend: false }; +export const EX_SPEC_PERF_ALIGNMENT: GoslingSpec = { + zoomLimits: [1, 396], + xDomain: { interval: [350, 396] }, + assembly: 'unknown', + title: 'Smoother Zoom', + subtitle: 'Rather than redrawing every element at every frame, we can scale existing elements', + views: [ + { + tracks: [ + { + ...alignmentWithText(commonProps), + title: 'New Approach: Stretching Tiles', + experimental: { stretchGraphics: true } + } + ] + }, + { + tracks: [ + { + ...alignmentWithText(commonProps), + title: 'Original Approach' + } + ] + } + ] +}; diff --git a/editor/example/thumbnails.ts b/editor/example/thumbnails.ts index 29e6e3bc..05d499d3 100644 --- a/editor/example/thumbnails.ts +++ b/editor/example/thumbnails.ts @@ -15,6 +15,7 @@ import MARK_DISPLACEMENT from './thumbnails/MARK_DISPLACEMENT.png'; import MATRIX_HFFC6 from './thumbnails/MATRIX_HFFC6.gif'; import MATRIX from './thumbnails/MATRIX.png'; import MOUSE_EVENT from './thumbnails/MOUSE_EVENT.png'; +import PERF_ALIGNMENT from './thumbnails/PERF_ALIGNMENT.png'; import RESPONSIVE_COMPARATIVE_MATRICES from './thumbnails/RESPONSIVE_COMPARATIVE_MATRICES.gif'; import RESPONSIVE_IDEOGRAM from './thumbnails/RESPONSIVE_IDEOGRAM.gif'; import RESPONSIVE_MULTIVEC from './thumbnails/RESPONSIVE_MULTIVEC.gif'; @@ -48,6 +49,7 @@ export const THUMBNAILS = { MATRIX_HFFC6, MATRIX, MOUSE_EVENT, + PERF_ALIGNMENT, RESPONSIVE_COMPARATIVE_MATRICES, RESPONSIVE_IDEOGRAM, RESPONSIVE_MULTIVEC, diff --git a/editor/example/thumbnails/PERF_ALIGNMENT.png b/editor/example/thumbnails/PERF_ALIGNMENT.png new file mode 100644 index 0000000000000000000000000000000000000000..4403b62ad31b4c9e703e71a8259a8a2d4d7bd94c GIT binary patch literal 114031 zcmY(o19&Duw=Mj}_GB`#^TxJq+qP}nwr$(C&53PHl8JNYJLlYU|G)aFu2s9%Ub}Wb z-Tib|MaavFA;4n60ssI632|XX004ylA3lPH{C7UL{5<*BfSU=(2mk;Lad0075dZoF zM&gPx0DvbM0N@`C0KEM(`JVv*F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dyQ_shY-G5c zkT>u0DX+2fHBYBg1hP66M2Vpt^TDb>CIe)<9UDK>0G+SG=dou&-Sn1_# zwudNM(iN|LT^H$N3S3-q<`_kulUSTzU_y7iwWl5Cy3ev)Faaw;KTG_V`j&Y5OagJZ|lwxk}g!__qMxeC@2JpdnI@;7t3+kS!koD}`N2xql^kPgxOn#GBYwcYxmYo&Wh^|OuF zO}K90TA(cZ+jzR-DQ&pa0huChYdYCKZ_;~_j!PHloiE?5MuUm=+G^2fN-$QOzU!hi)Y!3K+tajq7=n)Qzj&ceF=;}p66+G z!`T`{l9pB2Y2%t?0wt>XsGLiqNjSZk3cP>iJSM_e{)GTn)WPn<8BfpcfI(hJ56Kz2 z-qgvuft&MlN~aVg$U!Y*#bRb%7UN(FLMXiiEPl%|Bg%?D?OfrCz;!;B+Mq+6fVv5K zd+_Qxc{#?iglO5Xcq?Z4;`@a@o$1$dEsKFwQC936w}lp)A8pjtiwtn>$8`)Xt7E>41AU#_dUShwTJYHr)iowTx?9RTf=qcXH^ zSodugcQps@8pvr$9B6>*OmiIX`-7(k&BZwS;0*_+5sud2as~obA1D9Ji4=xGw z15|ol3F0*~KAg@yvBSNYs{rNXa{Yv>i>3VW$-Z=$UzPV5gl0z+cdxfh45vYiBD5}9qYlu@5mw=d7Bg$F z=Z4$Bzy<~`8wOgJz@>9%&o;JV|bNf+gVxAv!+Qe*8yNUuVxS^Bs4Jd7Okg(3-oU^H1~xEoxiL^IfqimZFDp1z zLh15y7rl}H1_m}Tuz`UeE(Wv)t&{dujvYG|A9Hi;0{;+~zyZX@pA8IbU|<6Sml*?c eeiA=v-~R(jc6`h%pOk3;0000> build/CNAME", - "deploy": "gh-pages -d build", "version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md", "prepare": "echo 'dummy prepare since prepack has no dev dependencies'", "prepack": "npm run build", "knip": "knip --config knip.config.json", - "e2e": "playwright test" + "e2e": "playwright test", + "preinstall": "npx only-allow pnpm" }, "peerDependencies": { "pixi.js": "^6.3.0", @@ -66,6 +66,7 @@ "d3-array": "^2.5.1", "d3-color": "^2.0.0", "d3-dsv": "^2.0.0", + "d3-format": "^3.1.0", "d3-scale": "^3.2.1", "d3-scale-chromatic": "^2.0.0", "d3-shape": "^2.0.0", @@ -78,6 +79,7 @@ "json-stringify-pretty-compact": "^2.0.0", "jspdf": "^2.3.1", "lodash-es": "^4.17.21", + "monaco-editor": "^0.27.0", "nanoevents": "^7.0.1", "pubsub-js": "^1.9.3", "quick-lru": "^6.1.1", @@ -88,10 +90,16 @@ "devDependencies": { "@playwright/test": "^1.39.0", "@types/bezier-js": "^4.1.0", - "@types/d3": "^7.0.0", + "@types/d3": "^7.4.3", + "@types/d3-array": "^3.2.1", + "@types/d3-color": "^3.1.3", "@types/d3-drag": "^2.0.0", "@types/d3-dsv": "^3.0.1", + "@types/d3-format": "^3.0.4", + "@types/d3-scale": "^4.0.8", + "@types/d3-scale-chromatic": "^3.0.3", "@types/d3-selection": "^2.0.0", + "@types/d3-shape": "^3.1.6", "@types/lodash-es": "^4.17.5", "@types/node": "^18.6.2", "@types/pixelmatch": "^5.2.5", @@ -118,7 +126,6 @@ "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-react": "^7.30.1", "fetch-jsonp": "^1.1.3", - "gh-pages": "^3.1.0", "jsdom": "^19.0.0", "jsoncrush": "^1.1.6", "npm-run-all": "^4.1.5", @@ -134,6 +141,7 @@ "react-router-dom": "^5.2.0", "remark-gfm": "^1.0.0", "rimraf": "~5.0.5", + "safe-stable-stringify": "^2.4.3", "strip-json-comments": "^3.1.1", "ts-json-schema-generator": "^1.0.0", "typescript": "^5.0.2", diff --git a/playwright.config.ts b/playwright.config.ts index 8a02c48a..7f920fd6 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -70,7 +70,7 @@ export default defineConfig({ /* Run your local dev server before starting the tests */ webServer: { - command: 'yarn start', + command: 'pnpm start', url: 'http://localhost:5173/', reuseExistingServer: !process.env.CI, }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 00000000..04ae65c3 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,7546 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +overrides: + slugid: ^3.0.0 + +dependencies: + '@gmod/bam': + specifier: ^1.1.18 + version: 1.1.18 + '@gmod/bbi': + specifier: ^3.0.1 + version: 3.0.1 + '@gmod/bed': + specifier: ^2.1.2 + version: 2.1.2 + '@gmod/gff': + specifier: ^1.3.0 + version: 1.3.0 + '@gmod/tabix': + specifier: ^1.5.6 + version: 1.5.11 + '@gmod/vcf': + specifier: ^5.0.10 + version: 5.0.10 + allotment: + specifier: ^1.19.0 + version: 1.19.3(react-dom@18.2.0)(react@18.2.0) + bezier-js: + specifier: 4.0.3 + version: 4.0.3 + buffer: + specifier: ^6.0.3 + version: 6.0.3 + css-element-queries: + specifier: ^1.2.3 + version: 1.2.3 + d3-array: + specifier: ^2.5.1 + version: 2.12.1 + d3-color: + specifier: ^2.0.0 + version: 2.0.0 + d3-dsv: + specifier: ^2.0.0 + version: 2.0.0 + d3-format: + specifier: ^3.1.0 + version: 3.1.0 + d3-scale: + specifier: ^3.2.1 + version: 3.2.1 + d3-scale-chromatic: + specifier: ^2.0.0 + version: 2.0.0 + d3-shape: + specifier: ^2.0.0 + version: 2.1.0 + events: + specifier: ^3.3.0 + version: 3.3.0 + fflate: + specifier: ^0.7.1 + version: 0.7.4 + generic-filehandle: + specifier: ^3.0.1 + version: 3.1.1 + higlass: + specifier: ^1.13.3 + version: 1.13.3(pixi.js@6.5.10)(react-dom@18.2.0)(react@18.2.0) + higlass-register: + specifier: ^0.3.0 + version: 0.3.0 + higlass-text: + specifier: ^0.1.1 + version: 0.1.6 + json-stringify-pretty-compact: + specifier: ^2.0.0 + version: 2.0.0 + jspdf: + specifier: ^2.3.1 + version: 2.5.1 + lodash-es: + specifier: ^4.17.21 + version: 4.17.21 + monaco-editor: + specifier: ^0.27.0 + version: 0.27.0 + nanoevents: + specifier: ^7.0.1 + version: 7.0.1 + pubsub-js: + specifier: ^1.9.3 + version: 1.9.4 + quick-lru: + specifier: ^6.1.1 + version: 6.1.2 + rbush: + specifier: ^3.0.1 + version: 3.0.1 + stream-browserify: + specifier: ^3.0.0 + version: 3.0.0 + threads: + specifier: ^1.6.4 + version: 1.7.0 + +devDependencies: + '@playwright/test': + specifier: ^1.39.0 + version: 1.40.1 + '@types/bezier-js': + specifier: ^4.1.0 + version: 4.1.0 + '@types/d3': + specifier: ^7.4.3 + version: 7.4.3 + '@types/d3-array': + specifier: ^3.2.1 + version: 3.2.1 + '@types/d3-color': + specifier: ^3.1.3 + version: 3.1.3 + '@types/d3-drag': + specifier: ^2.0.0 + version: 2.0.0 + '@types/d3-dsv': + specifier: ^3.0.1 + version: 3.0.1 + '@types/d3-format': + specifier: ^3.0.4 + version: 3.0.4 + '@types/d3-scale': + specifier: ^4.0.8 + version: 4.0.8 + '@types/d3-scale-chromatic': + specifier: ^3.0.3 + version: 3.0.3 + '@types/d3-selection': + specifier: ^2.0.0 + version: 2.0.0 + '@types/d3-shape': + specifier: ^3.1.6 + version: 3.1.6 + '@types/lodash-es': + specifier: ^4.17.5 + version: 4.17.5 + '@types/node': + specifier: ^18.6.2 + version: 18.6.2 + '@types/pixelmatch': + specifier: ^5.2.5 + version: 5.2.6 + '@types/pngjs': + specifier: ^6.0.3 + version: 6.0.4 + '@types/pubsub-js': + specifier: ^1.8.2 + version: 1.8.2 + '@types/rbush': + specifier: ^3.0.0 + version: 3.0.0 + '@types/react': + specifier: ^18.2.0 + version: 18.2.0 + '@types/react-dom': + specifier: ^18.2.0 + version: 18.2.0 + '@types/react-resize-detector': + specifier: ^4.2.0 + version: 4.2.0 + '@types/react-router-dom': + specifier: ^5.1.6 + version: 5.3.3 + '@typescript-eslint/eslint-plugin': + specifier: ^5.56.0 + version: 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.19.0)(typescript@5.0.2) + '@typescript-eslint/parser': + specifier: ^5.56.0 + version: 5.62.0(eslint@8.19.0)(typescript@5.0.2) + '@vitejs/plugin-react': + specifier: ^4.1.0 + version: 4.1.0(vite@4.4.11) + '@vitest/coverage-v8': + specifier: ^0.34.6 + version: 0.34.6(vitest@0.34.6) + ajv: + specifier: ^6.12.2 + version: 6.12.6 + c8: + specifier: ^7.11.2 + version: 7.14.0 + conventional-changelog-cli: + specifier: ^2.1.1 + version: 2.2.2 + d3-drag: + specifier: ^2.0.0 + version: 2.0.0 + d3-selection: + specifier: ^2.0.0 + version: 2.0.0 + esbuild: + specifier: ^0.12.25 + version: 0.12.29 + eslint: + specifier: ^8.19.0 + version: 8.19.0 + eslint-config-prettier: + specifier: ^8.5.0 + version: 8.10.0(eslint@8.19.0) + eslint-plugin-jsx-a11y: + specifier: ^6.7.1 + version: 6.7.1(eslint@8.19.0) + eslint-plugin-prettier: + specifier: ^4.2.1 + version: 4.2.1(eslint-config-prettier@8.10.0)(eslint@8.19.0)(prettier@2.8.8) + eslint-plugin-react: + specifier: ^7.30.1 + version: 7.33.2(eslint@8.19.0) + fetch-jsonp: + specifier: ^1.1.3 + version: 1.3.0 + jsdom: + specifier: ^19.0.0 + version: 19.0.0 + jsoncrush: + specifier: ^1.1.6 + version: 1.1.8 + knip: + specifier: ^2.30.0 + version: 2.30.0 + npm-run-all: + specifier: ^4.1.5 + version: 4.1.5 + pixelmatch: + specifier: ^5.3.0 + version: 5.3.0 + pixi.js: + specifier: ^6.3.0 + version: 6.5.10 + pngjs: + specifier: ^7.0.0 + version: 7.0.0 + prettier: + specifier: ^2.0.5 + version: 2.8.8 + react: + specifier: ^18.2.0 + version: 18.2.0 + react-dom: + specifier: ^18.2.0 + version: 18.2.0(react@18.2.0) + react-markdown: + specifier: ^5.0.3 + version: 5.0.3(@types/react@18.2.0)(react@18.2.0) + react-monaco-editor: + specifier: ^0.45.0 + version: 0.45.0(@types/react@18.2.0)(react@18.2.0) + react-resize-detector: + specifier: ^4.2.3 + version: 4.2.3(react-dom@18.2.0)(react@18.2.0) + react-router-dom: + specifier: ^5.2.0 + version: 5.3.4(react@18.2.0) + remark-gfm: + specifier: ^1.0.0 + version: 1.0.0 + safe-stable-stringify: + specifier: ^2.4.3 + version: 2.4.3 + strip-json-comments: + specifier: ^3.1.1 + version: 3.1.1 + ts-json-schema-generator: + specifier: ^1.0.0 + version: 1.0.0 + typescript: + specifier: ^5.0.2 + version: 5.0.2 + vite: + specifier: ^4.4.11 + version: 4.4.11(@types/node@18.6.2) + vitest: + specifier: ^0.34.6 + version: 0.34.6(jsdom@19.0.0) + vitest-canvas-mock: + specifier: ^0.3.3 + version: 0.3.3(vitest@0.34.6) + +packages: + + /@aashutoshrathi/word-wrap@1.2.6: + resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==} + engines: {node: '>=0.10.0'} + dev: true + + /@ampproject/remapping@2.2.1: + resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/gen-mapping': 0.3.3 + '@jridgewell/trace-mapping': 0.3.20 + dev: true + + /@babel/code-frame@7.23.5: + resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/highlight': 7.23.4 + chalk: 2.4.2 + dev: true + + /@babel/compat-data@7.23.5: + resolution: {integrity: sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/core@7.23.5: + resolution: {integrity: sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g==} + engines: {node: '>=6.9.0'} + dependencies: + '@ampproject/remapping': 2.2.1 + '@babel/code-frame': 7.23.5 + '@babel/generator': 7.23.5 + '@babel/helper-compilation-targets': 7.22.15 + '@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.5) + '@babel/helpers': 7.23.5 + '@babel/parser': 7.23.5 + '@babel/template': 7.22.15 + '@babel/traverse': 7.23.5 + '@babel/types': 7.23.5 + convert-source-map: 2.0.0 + debug: 4.3.4 + gensync: 1.0.0-beta.2 + json5: 2.2.3 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + dev: true + + /@babel/generator@7.23.5: + resolution: {integrity: sha512-BPssCHrBD+0YrxviOa3QzpqwhNIXKEtOa2jQrm4FlmkC2apYgRnQcmPWiGZDlGxiNtltnUFolMe8497Esry+jA==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.23.5 + '@jridgewell/gen-mapping': 0.3.3 + '@jridgewell/trace-mapping': 0.3.20 + jsesc: 2.5.2 + dev: true + + /@babel/helper-compilation-targets@7.22.15: + resolution: {integrity: sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/compat-data': 7.23.5 + '@babel/helper-validator-option': 7.23.5 + browserslist: 4.22.2 + lru-cache: 5.1.1 + semver: 6.3.1 + dev: true + + /@babel/helper-environment-visitor@7.22.20: + resolution: {integrity: sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-function-name@7.23.0: + resolution: {integrity: sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/template': 7.22.15 + '@babel/types': 7.23.5 + dev: true + + /@babel/helper-hoist-variables@7.22.5: + resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.23.5 + dev: true + + /@babel/helper-module-imports@7.22.15: + resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.23.5 + dev: true + + /@babel/helper-module-transforms@7.23.3(@babel/core@7.23.5): + resolution: {integrity: sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/core': 7.23.5 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-module-imports': 7.22.15 + '@babel/helper-simple-access': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + '@babel/helper-validator-identifier': 7.22.20 + dev: true + + /@babel/helper-plugin-utils@7.22.5: + resolution: {integrity: sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-simple-access@7.22.5: + resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.23.5 + dev: true + + /@babel/helper-split-export-declaration@7.22.6: + resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.23.5 + dev: true + + /@babel/helper-string-parser@7.23.4: + resolution: {integrity: sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-validator-identifier@7.22.20: + resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-validator-option@7.23.5: + resolution: {integrity: sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helpers@7.23.5: + resolution: {integrity: sha512-oO7us8FzTEsG3U6ag9MfdF1iA/7Z6dz+MtFhifZk8C8o453rGJFFWUP1t+ULM9TUIAzC9uxXEiXjOiVMyd7QPg==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/template': 7.22.15 + '@babel/traverse': 7.23.5 + '@babel/types': 7.23.5 + transitivePeerDependencies: + - supports-color + dev: true + + /@babel/highlight@7.23.4: + resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-validator-identifier': 7.22.20 + chalk: 2.4.2 + js-tokens: 4.0.0 + dev: true + + /@babel/parser@7.23.5: + resolution: {integrity: sha512-hOOqoiNXrmGdFbhgCzu6GiURxUgM27Xwd/aPuu8RfHEZPBzL1Z54okAHAQjXfcQNwvrlkAmAp4SlRTZ45vlthQ==} + engines: {node: '>=6.0.0'} + hasBin: true + dependencies: + '@babel/types': 7.23.5 + dev: true + + /@babel/plugin-transform-react-jsx-self@7.23.3(@babel/core@7.23.5): + resolution: {integrity: sha512-qXRvbeKDSfwnlJnanVRp0SfuWE5DQhwQr5xtLBzp56Wabyo+4CMosF6Kfp+eOD/4FYpql64XVJ2W0pVLlJZxOQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.23.5 + '@babel/helper-plugin-utils': 7.22.5 + dev: true + + /@babel/plugin-transform-react-jsx-source@7.23.3(@babel/core@7.23.5): + resolution: {integrity: sha512-91RS0MDnAWDNvGC6Wio5XYkyWI39FMFO+JK9+4AlgaTH+yWwVTsw7/sn6LK0lH7c5F+TFkpv/3LfCJ1Ydwof/g==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.23.5 + '@babel/helper-plugin-utils': 7.22.5 + dev: true + + /@babel/runtime@7.23.5: + resolution: {integrity: sha512-NdUTHcPe4C99WxPub+K9l9tK5/lV4UXIoaHSYgzco9BCyjKAAwzdBI+wWtYqHt7LJdbo74ZjRPJgzVweq1sz0w==} + engines: {node: '>=6.9.0'} + dependencies: + regenerator-runtime: 0.14.0 + + /@babel/template@7.22.15: + resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.23.5 + '@babel/parser': 7.23.5 + '@babel/types': 7.23.5 + dev: true + + /@babel/traverse@7.23.5: + resolution: {integrity: sha512-czx7Xy5a6sapWWRx61m1Ke1Ra4vczu1mCTtJam5zRTBOonfdJ+S/B6HYmGYu3fJtr8GGET3si6IhgWVBhJ/m8w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.23.5 + '@babel/generator': 7.23.5 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-function-name': 7.23.0 + '@babel/helper-hoist-variables': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + '@babel/parser': 7.23.5 + '@babel/types': 7.23.5 + debug: 4.3.4 + globals: 11.12.0 + transitivePeerDependencies: + - supports-color + dev: true + + /@babel/types@7.23.5: + resolution: {integrity: sha512-ON5kSOJwVO6xXVRTvOI0eOnWe7VdUcIpsovGo9U/Br4Ie4UVFQTboO2cYnDhAGU6Fp+UxSiT+pMft0SMHfuq6w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-string-parser': 7.23.4 + '@babel/helper-validator-identifier': 7.22.20 + to-fast-properties: 2.0.0 + dev: true + + /@bcoe/v8-coverage@0.2.3: + resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} + dev: true + + /@ericcornelissen/bash-parser@0.5.2: + resolution: {integrity: sha512-4pIMTa1nEFfMXitv7oaNEWOdM+zpOZavesa5GaiWTgda6Zk32CFGxjUp/iIaN0PwgUW1yTq/fztSjbpE8SLGZQ==} + engines: {node: '>=4'} + dependencies: + array-last: 1.3.0 + babylon: 6.18.0 + compose-function: 3.0.3 + deep-freeze: 0.0.1 + filter-iterator: 0.0.1 + filter-obj: 1.1.0 + has-own-property: 0.1.0 + identity-function: 1.0.0 + is-iterable: 1.1.1 + iterable-lookahead: 1.0.0 + lodash.curry: 4.1.1 + magic-string: 0.16.0 + map-obj: 2.0.0 + object-pairs: 0.1.0 + object-values: 1.0.0 + reverse-arguments: 1.0.0 + shell-quote-word: 1.0.1 + to-pascal-case: 1.0.0 + unescape-js: 1.1.4 + dev: true + + /@esbuild/android-arm64@0.18.20: + resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm@0.18.20: + resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64@0.18.20: + resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64@0.18.20: + resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64@0.18.20: + resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64@0.18.20: + resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64@0.18.20: + resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64@0.18.20: + resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm@0.18.20: + resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32@0.18.20: + resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-loong64@0.18.20: + resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el@0.18.20: + resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64@0.18.20: + resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64@0.18.20: + resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x@0.18.20: + resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64@0.18.20: + resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64@0.18.20: + resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-x64@0.18.20: + resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/sunos-x64@0.18.20: + resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64@0.18.20: + resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32@0.18.20: + resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64@0.18.20: + resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@eslint-community/eslint-utils@4.4.0(eslint@8.19.0): + resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + dependencies: + eslint: 8.19.0 + eslint-visitor-keys: 3.4.3 + dev: true + + /@eslint-community/regexpp@4.10.0: + resolution: {integrity: sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + dev: true + + /@eslint/eslintrc@1.4.1: + resolution: {integrity: sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + ajv: 6.12.6 + debug: 4.3.4 + espree: 9.6.1 + globals: 13.23.0 + ignore: 5.3.0 + import-fresh: 3.3.0 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + dev: true + + /@gmod/bam@1.1.18: + resolution: {integrity: sha512-2Sn4zLV7DKYyrmYbNJRMchKGfhfIVm6LZEl2h7MSuGmAEtGfa1RBVOfG8Cu6VDC+lIFrgS4ys4vUFFxaWaxgSQ==} + engines: {node: '>=6'} + dependencies: + '@gmod/bgzf-filehandle': 1.4.7 + abortable-promise-cache: 1.5.0 + buffer-crc32: 0.2.13 + cross-fetch: 3.1.8 + generic-filehandle: 3.1.1 + long: 4.0.0 + object.entries-ponyfill: 1.0.1 + quick-lru: 2.0.0 + transitivePeerDependencies: + - encoding + dev: false + + /@gmod/bbi@3.0.1: + resolution: {integrity: sha512-DjvRj/qPPWBSjEjgVsadQmmWBK+EmtYr9xLZ4y7IsnuuHiE+sDgbnSA51OKiKNGLM3srydq22pynNLqswB1XjQ==} + engines: {node: '>=6'} + dependencies: + abortable-promise-cache: 1.5.0 + binary-parser: 2.2.1 + generic-filehandle: 3.1.1 + pako: 2.1.0 + quick-lru: 4.0.1 + rxjs: 7.8.1 + dev: false + + /@gmod/bed@2.1.2: + resolution: {integrity: sha512-LnCmA+jb0xfbSWO7isi1dVvqbQi8Icqaj8FeUcnCc8t4jiNe1eFoe1YU8Chn7a8EDGFqS06kMNpO1vodO+q4IA==} + engines: {node: '>=6'} + dev: false + + /@gmod/bgzf-filehandle@1.4.7: + resolution: {integrity: sha512-f/oXwWwsBe4nYN82mQ+Sz++/zH6EOyBCRqxFdv04SBkreQvilf3cql6F8ZAMMBq1f/abzBc0U0zJIMF9CLM7QQ==} + engines: {node: '>=6'} + dependencies: + es6-promisify: 7.0.0 + generic-filehandle: 3.1.1 + long: 4.0.0 + pako: 1.0.11 + dev: false + + /@gmod/gff@1.3.0: + resolution: {integrity: sha512-OjEnQLR6iIcrau603blFfUkmnWGDVfOu/LQoJNa7TsvKnjWlHYPlvqb5h2IV7wI+zElDY648mQ9zrElt2uR80A==} + hasBin: true + dependencies: + stream-browserify: 3.0.0 + dev: false + + /@gmod/tabix@1.5.11: + resolution: {integrity: sha512-zYgivq8r9pSwNKbzAqHSSfRQ3KEe+oiTNhABJIW9kBqjiKW4m7ncqKhhcmxjG4afhJNUzBJ9Gt/w3grbG+Q5bA==} + engines: {node: '>=6'} + dependencies: + '@gmod/bgzf-filehandle': 1.4.7 + abortable-promise-cache: 1.5.0 + generic-filehandle: 3.1.1 + long: 4.0.0 + quick-lru: 4.0.1 + dev: false + + /@gmod/vcf@5.0.10: + resolution: {integrity: sha512-o7QuPcOeXlJpzwQaFmgojhNvJE4yB9fhrfVEDKpkDjV27pAqwMy89367vtXu4JfBFE9t4zZ6sQRkqYaJ+cIheg==} + engines: {node: '>=6'} + dev: false + + /@humanwhocodes/config-array@0.9.5: + resolution: {integrity: sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==} + engines: {node: '>=10.10.0'} + dependencies: + '@humanwhocodes/object-schema': 1.2.1 + debug: 4.3.4 + minimatch: 3.1.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@humanwhocodes/object-schema@1.2.1: + resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} + dev: true + + /@hutson/parse-repository-url@3.0.2: + resolution: {integrity: sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==} + engines: {node: '>=6.9.0'} + dev: true + + /@icons/material@0.2.4(react@18.2.0): + resolution: {integrity: sha512-QPcGmICAPbGLGb6F/yNf/KzKqvFx8z5qx3D1yFqVAjoFmXK35EgyW+cJ57Te3CNsmzblwtzakLGFqHPqrfb4Tw==} + peerDependencies: + react: '*' + dependencies: + react: 18.2.0 + dev: false + + /@isaacs/cliui@8.0.2: + resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} + engines: {node: '>=12'} + dependencies: + string-width: 5.1.2 + string-width-cjs: /string-width@4.2.3 + strip-ansi: 7.1.0 + strip-ansi-cjs: /strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: /wrap-ansi@7.0.0 + dev: true + + /@istanbuljs/schema@0.1.3: + resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} + engines: {node: '>=8'} + dev: true + + /@jest/schemas@29.6.3: + resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@sinclair/typebox': 0.27.8 + dev: true + + /@jridgewell/gen-mapping@0.3.3: + resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/set-array': 1.1.2 + '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/trace-mapping': 0.3.20 + dev: true + + /@jridgewell/resolve-uri@3.1.1: + resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} + engines: {node: '>=6.0.0'} + dev: true + + /@jridgewell/set-array@1.1.2: + resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} + engines: {node: '>=6.0.0'} + dev: true + + /@jridgewell/sourcemap-codec@1.4.15: + resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + dev: true + + /@jridgewell/trace-mapping@0.3.20: + resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} + dependencies: + '@jridgewell/resolve-uri': 3.1.1 + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + + /@juggle/resize-observer@3.4.0: + resolution: {integrity: sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==} + dev: false + + /@nodelib/fs.scandir@2.1.5: + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + dev: true + + /@nodelib/fs.stat@2.0.5: + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + dev: true + + /@nodelib/fs.walk@1.2.8: + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.15.0 + dev: true + + /@npmcli/map-workspaces@3.0.4: + resolution: {integrity: sha512-Z0TbvXkRbacjFFLpVpV0e2mheCh+WzQpcqL+4xp49uNJOxOnIAPZyXtUxZ5Qn3QBTGKA11Exjd9a5411rBrhDg==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + dependencies: + '@npmcli/name-from-folder': 2.0.0 + glob: 10.3.10 + minimatch: 9.0.3 + read-package-json-fast: 3.0.2 + dev: true + + /@npmcli/name-from-folder@2.0.0: + resolution: {integrity: sha512-pwK+BfEBZJbKdNYpHHRTNBwBoqrN/iIMO0AiGvYsp3Hoaq0WbgGSWQR6SCldZovoDpY3yje5lkFUe6gsDgJ2vg==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + dev: true + + /@pixi/accessibility@6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-URrI1H+1kjjHSyhY1QXcUZ8S3omdVTrXg5y0gndtpOhIelErBTC9NWjJfw6s0Rlmv5+x5VAitQTgw9mRiatDgw==} + peerDependencies: + '@pixi/core': 6.5.10 + '@pixi/display': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/app@6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-VsNHLajZ5Dbc/Zrj7iWmIl3eu6Fec+afjW/NXXezD8Sp3nTDF0bv5F+GDgN/zSc2gqIvPHyundImT7hQGBDghg==} + peerDependencies: + '@pixi/core': 6.5.10 + '@pixi/display': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/compressed-textures@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/loaders@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-41NT5mkfam47DrkB8xMp3HUZDt7139JMB6rVNOmb3u2vm+2mdy9tzi5s9nN7bG9xgXlchxcFzytTURk+jwXVJA==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/loaders': 6.5.10 + '@pixi/settings': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/loaders': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/utils@6.5.10) + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/constants@6.5.10: + resolution: {integrity: sha512-PUF2Y9YISRu5eVrVVHhHCWpc/KmxQTg3UH8rIUs8UI9dCK41/wsPd3pEahzf7H47v7x1HCohVZcFO3XQc1bUDw==} + + /@pixi/core@6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-Gdzp5ENypyglvsh5Gv3teUZnZnmizo4xOsL+QqmWALdFlJXJwLJMVhKVThV/q/095XR6i4Ou54oshn+m4EkuFw==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/extensions': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/runner': 6.5.10 + '@pixi/settings': 6.5.10 + '@pixi/ticker': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/extensions': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/runner': 6.5.10 + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + '@pixi/ticker': 6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + '@types/offscreencanvas': 2019.7.3 + + /@pixi/display@6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-NxFdDDxlbH5fQkzGHraLGoTMucW9pVgXqQm13TSmkA3NWIi/SItHL4qT2SI8nmclT9Vid1VDEBCJFAbdeuQw1Q==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/settings': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/extensions@6.5.10: + resolution: {integrity: sha512-EIUGza+E+sCy3dupuIjvRK/WyVyfSzHb5XsxRaxNrPwvG1iIUIqNqZ3owLYCo4h17fJWrj/yXVufNNtUKQccWQ==} + + /@pixi/extract@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-hXFIc4EGs14GFfXAjT1+6mzopzCMWeXeai38/Yod3vuBXkkp8+ksen6kE09vTnB9l1IpcIaCM+XZEokuqoGX2A==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/filter-alpha@6.5.10(@pixi/core@6.5.10): + resolution: {integrity: sha512-GWHLJvY0QOIDRjVx0hdUff6nl/PePQg84i8XXPmANrvA+gJ/eSRTQRmQcdgInQfawENADB/oRqpcCct6IAcKpQ==} + peerDependencies: + '@pixi/core': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + + /@pixi/filter-blur@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/settings@6.5.10): + resolution: {integrity: sha512-LJsRocVOdM9hTzZKjP+jmkfoL1nrJi5XpR0ItgRN8fflOC7A7Ln4iPe7nukbbq3H7QhZSunbygMubbO6xhThZw==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/settings': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + + /@pixi/filter-color-matrix@6.5.10(@pixi/core@6.5.10): + resolution: {integrity: sha512-C2S44/EoWTrhqedLWOZTq9GZV5loEq1+MhyK9AUzEubWGMHhou1Juhn2mRZ7R6flKPCRQNKrXpStUwCAouud3Q==} + peerDependencies: + '@pixi/core': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + + /@pixi/filter-displacement@6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10): + resolution: {integrity: sha512-fbblMYyPX/hO3Tpoaa4tOBYxqp4TxjNrz6xyt15tKSVxWQElk+Tx98GJ+aaBoiHOKt8ezzHplStWoHG++JIv/w==} + peerDependencies: + '@pixi/core': 6.5.10 + '@pixi/math': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + + /@pixi/filter-fxaa@6.5.10(@pixi/core@6.5.10): + resolution: {integrity: sha512-wbHL9UtY3g7jTyvO8JaZks6DqV8AO5c96Hfu0zfndWBPs79Ul6/sq3LD2eE+yq5vK5T2R9Sr4s54ls1JT3Sppg==} + peerDependencies: + '@pixi/core': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + + /@pixi/filter-noise@6.5.10(@pixi/core@6.5.10): + resolution: {integrity: sha512-CX+/06NVaw3HsjipZVb7aemkca0TC8I6qfKI4lx2ugxS/6G6zkY5zqd8+nVSXW4DpUXB6eT0emwfRv6N00NvuA==} + peerDependencies: + '@pixi/core': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + + /@pixi/graphics@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-KPHGJ910fi8bRQQ+VcTIgrK+bKIm8yAQaZKPqMtm14HzHPGcES6HkgeNY1sd7m8J4aS9btm5wOSyFu0p5IzTpA==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/display': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/sprite': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/interaction@6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-v809pJmXA2B9dV/vdrDMUqJT+fBB/ARZli2YRmI2dPbEbkaYr8FNmxCAJnwT8o+ymTx044Ie820hn9tVrtMtfA==} + peerDependencies: + '@pixi/core': 6.5.10 + '@pixi/display': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/ticker': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/ticker': 6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/loaders@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-AuK7mXBmyVsDFL9DDFPB8sqP8fwQ2NOktvu98bQuJl0/p/UeK/0OAQnF3wcf3FeBv5YGXfNHL21c2DCisjKfTg==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/math@6.5.10: + resolution: {integrity: sha512-fxeu7ykVbMGxGV2S3qRTupHToeo1hdWBm8ihyURn3BMqJZe2SkZEECPd5RyvIuuNUtjRnmhkZRnF3Jsz2S+L0g==} + + /@pixi/mesh-extras@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/mesh@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-UCG7OOPPFeikrX09haCibCMR0jPQ4UJ+4HiYiAv/3dahq5eEzBx+yAwVtxcVCjonkTf/lu5SzmHdzpsbHLx5aw==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/mesh': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/mesh': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/mesh@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-tUNPsdp5/t/yRsCmfxIcufIfbQVzgAlMNgQ1igWOkSxzhB7vlEbZ8ZLLW5tQcNyM/r7Nhjz+RoB+RD+/BCtvlA==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/display': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/settings': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/mixin-cache-as-bitmap@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-HV4qPZt8R7uuPZf1XE5S0e3jbN4+/EqgAIkueIyK3Em+0IO1rCmIbzzYxFPxkElMUu5VvN1r4hXK846z9ITnhw==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/display': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/settings': 6.5.10 + '@pixi/sprite': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/mixin-get-child-by-name@6.5.10(@pixi/display@6.5.10): + resolution: {integrity: sha512-YYd9wjnI/4aKY0H5Ij413UppVZn3YE1No2CZrNevV6WbhylsJucowY3hJihtl9mxkpwtaUIyWMjmphkbOinbzA==} + peerDependencies: + '@pixi/display': 6.5.10 + dependencies: + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + + /@pixi/mixin-get-global-position@6.5.10(@pixi/display@6.5.10)(@pixi/math@6.5.10): + resolution: {integrity: sha512-A83gTZP9CdQAyrAvOZl1P707Q0QvIC0V8UnBAMd4GxuhMOXJtXVPCdmfPVXUrfoywgnH+/Bgimq5xhsXTf8Hzg==} + peerDependencies: + '@pixi/display': 6.5.10 + '@pixi/math': 6.5.10 + dependencies: + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + + /@pixi/particle-container@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-CCNAdYGzKoOc3FtK2kyWCNjygdHppeOEqqK189yhg3yRSsvby+HMms/cM6bLK/4Vf6mFoAy1na3w/oXpqTR2Ag==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/display': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/sprite': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/polyfill@6.5.10: + resolution: {integrity: sha512-KDTWyr285VvPM8GGTVIZAhmxGrOlTznUGK/9kWS3GtrogwLWn41S/86Yej1gYvotVyUomCcOok33Jzahb+vX1w==} + dependencies: + object-assign: 4.1.1 + promise-polyfill: 8.3.0 + + /@pixi/prepare@6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/graphics@6.5.10)(@pixi/settings@6.5.10)(@pixi/text@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-PHMApz/GPg7IX/7+2S98criN2+Mp+fgiKpojV9cnl0SlW2zMxfAHBBi8zik9rHBgjx8X6d6bR0MG1rPtb6vSxQ==} + peerDependencies: + '@pixi/core': 6.5.10 + '@pixi/display': 6.5.10 + '@pixi/graphics': 6.5.10 + '@pixi/settings': 6.5.10 + '@pixi/text': 6.5.10 + '@pixi/ticker': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/graphics': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + '@pixi/text': 6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) + '@pixi/ticker': 6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/runner@6.5.10: + resolution: {integrity: sha512-4HiHp6diCmigJT/DSbnqQP62OfWKmZB7zPWMdV1AEdr4YT1QxzXAW1wHg7dkoEfyTHqZKl0tm/zcqKq/iH7tMA==} + + /@pixi/settings@6.5.10(@pixi/constants@6.5.10): + resolution: {integrity: sha512-ypAS5L7pQ2Qb88yQK72bXtc7sD8OrtLWNXdZ/gnw5kwSWCFaOSoqhKqJCXrR5DQtN98+RQefwbEAmMvqobhFyw==} + peerDependencies: + '@pixi/constants': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + + /@pixi/sprite-animated@6.5.10(@pixi/core@6.5.10)(@pixi/sprite@6.5.10)(@pixi/ticker@6.5.10): + resolution: {integrity: sha512-x1kayucAqpVbNk+j+diC/7sQGQsAl6NCH1J2/EEaiQjlV3GOx1MXS9Tft1N1Y1y7otbg1XsnBd60/Yzcp05pxA==} + peerDependencies: + '@pixi/core': 6.5.10 + '@pixi/sprite': 6.5.10 + '@pixi/ticker': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/ticker': 6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/sprite-tiling@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-lDFcPuwExrdJhli+WmjPivChjeCG6NiRl36iQ8n2zVi/MYVv9qfKCA6IdU7HBWk1AZdsg6KUTpwfmVLUI+qz3w==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/display': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/sprite': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/sprite@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-UiK+8LgM9XQ/SBDKjRgZ8WggdOSlFRXqiWjEZVmNkiyU8HvXeFzWPRhpc8RR1zDwAUhZWKtMhF8X/ba9m+z2lg==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/display': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/settings': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/spritesheet@6.5.10(@pixi/core@6.5.10)(@pixi/loaders@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-7uOZ1cYyYtPb0ZEgXV1SZ8ujtluZNY0TL5z3+Qc8cgGGZK/MaWG7N6Wf+uR4BR2x8FLNwcyN5IjbQDKCpblrmg==} + peerDependencies: + '@pixi/core': 6.5.10 + '@pixi/loaders': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/loaders': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/text-bitmap@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/loaders@6.5.10)(@pixi/math@6.5.10)(@pixi/mesh@6.5.10)(@pixi/settings@6.5.10)(@pixi/text@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-g/iFIMGp6Pfi0BvX6Ykp48Z6JXVgKOrc7UCIR9CM21wYcCiQGqtdFwstV236xk6/D8NToUtSOcifhtQ28dVTdQ==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10 + '@pixi/display': 6.5.10 + '@pixi/loaders': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/mesh': 6.5.10 + '@pixi/settings': 6.5.10 + '@pixi/text': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/loaders': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/mesh': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + '@pixi/text': 6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/text@6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10): + resolution: {integrity: sha512-ikwkonLJ+6QmEVW8Ji9fS5CjrKNbU4mHzYuwRQas/VJQuSWgd0myCcaw6ZbF1oSfQe70HgbNOR0sH8Q3Com0qg==} + peerDependencies: + '@pixi/core': 6.5.10 + '@pixi/math': 6.5.10 + '@pixi/settings': 6.5.10 + '@pixi/sprite': 6.5.10 + '@pixi/utils': 6.5.10 + dependencies: + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /@pixi/ticker@6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10): + resolution: {integrity: sha512-UqX1XYtzqFSirmTOy8QAK4Ccg4KkIZztrBdRPKwFSOEiKAJoGDCSBmyQBo/9aYQKGObbNnrJ7Hxv3/ucg3/1GA==} + peerDependencies: + '@pixi/extensions': 6.5.10 + '@pixi/settings': 6.5.10 + dependencies: + '@pixi/extensions': 6.5.10 + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + + /@pixi/utils@6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10): + resolution: {integrity: sha512-4f4qDMmAz9IoSAe08G2LAxUcEtG9jSdudfsMQT2MG+OpfToirboE6cNoO0KnLCvLzDVE/mfisiQ9uJbVA9Ssdw==} + peerDependencies: + '@pixi/constants': 6.5.10 + '@pixi/settings': 6.5.10 + dependencies: + '@pixi/constants': 6.5.10 + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + '@types/earcut': 2.1.4 + earcut: 2.2.4 + eventemitter3: 3.1.2 + url: 0.11.3 + + /@pkgjs/parseargs@0.11.0: + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + requiresBuild: true + dev: true + optional: true + + /@playwright/test@1.40.1: + resolution: {integrity: sha512-EaaawMTOeEItCRvfmkI9v6rBkF1svM8wjl/YPRrg2N2Wmp+4qJYkWtJsbew1szfKKDm6fPLy4YAanBhIlf9dWw==} + engines: {node: '>=16'} + hasBin: true + dependencies: + playwright: 1.40.1 + dev: true + + /@sinclair/typebox@0.27.8: + resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + dev: true + + /@snyk/github-codeowners@1.1.0: + resolution: {integrity: sha512-lGFf08pbkEac0NYgVf4hdANpAgApRjNByLXB+WBip3qj1iendOIyAwP2GKkKbQMNVy2r1xxDf0ssfWscoiC+Vw==} + engines: {node: '>=8.10'} + hasBin: true + dependencies: + commander: 4.1.1 + ignore: 5.3.0 + p-map: 4.0.0 + dev: true + + /@tootallnate/once@2.0.0: + resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} + engines: {node: '>= 10'} + dev: true + + /@types/babel__core@7.20.5: + resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} + dependencies: + '@babel/parser': 7.23.5 + '@babel/types': 7.23.5 + '@types/babel__generator': 7.6.7 + '@types/babel__template': 7.4.4 + '@types/babel__traverse': 7.20.4 + dev: true + + /@types/babel__generator@7.6.7: + resolution: {integrity: sha512-6Sfsq+EaaLrw4RmdFWE9Onp63TOUue71AWb4Gpa6JxzgTYtimbM086WnYTy2U67AofR++QKCo08ZP6pwx8YFHQ==} + dependencies: + '@babel/types': 7.23.5 + dev: true + + /@types/babel__template@7.4.4: + resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} + dependencies: + '@babel/parser': 7.23.5 + '@babel/types': 7.23.5 + dev: true + + /@types/babel__traverse@7.20.4: + resolution: {integrity: sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==} + dependencies: + '@babel/types': 7.23.5 + dev: true + + /@types/bezier-js@4.1.0: + resolution: {integrity: sha512-ElU16s8E6Pr6magp8ihwH1O8pbUJASbMND/qgUc9RsLmP3lMLHiDMRXdjtaObwW5GPtOVYOsXDUIhTIluT+yaw==} + dev: true + + /@types/chai-subset@1.3.5: + resolution: {integrity: sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==} + dependencies: + '@types/chai': 4.3.11 + dev: true + + /@types/chai@4.3.11: + resolution: {integrity: sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==} + dev: true + + /@types/d3-array@3.2.1: + resolution: {integrity: sha512-Y2Jn2idRrLzUfAKV2LyRImR+y4oa2AntrgID95SHJxuMUrkNXmanDSed71sRNZysveJVt1hLLemQZIady0FpEg==} + dev: true + + /@types/d3-axis@3.0.6: + resolution: {integrity: sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw==} + dependencies: + '@types/d3-selection': 2.0.0 + dev: true + + /@types/d3-brush@3.0.6: + resolution: {integrity: sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A==} + dependencies: + '@types/d3-selection': 2.0.0 + dev: true + + /@types/d3-chord@3.0.6: + resolution: {integrity: sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg==} + dev: true + + /@types/d3-color@3.1.3: + resolution: {integrity: sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==} + dev: true + + /@types/d3-contour@3.0.6: + resolution: {integrity: sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg==} + dependencies: + '@types/d3-array': 3.2.1 + '@types/geojson': 7946.0.13 + dev: true + + /@types/d3-delaunay@6.0.4: + resolution: {integrity: sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==} + dev: true + + /@types/d3-dispatch@3.0.6: + resolution: {integrity: sha512-4fvZhzMeeuBJYZXRXrRIQnvUYfyXwYmLsdiN7XXmVNQKKw1cM8a5WdID0g1hVFZDqT9ZqZEY5pD44p24VS7iZQ==} + dev: true + + /@types/d3-drag@2.0.0: + resolution: {integrity: sha512-VaUJPjbMnDn02tcRqsHLRAX5VjcRIzCjBfeXTLGe6QjMn5JccB5Cz4ztMRXMJfkbC45ovgJFWuj6DHvWMX1thA==} + dependencies: + '@types/d3-selection': 2.0.0 + dev: true + + /@types/d3-dsv@3.0.1: + resolution: {integrity: sha512-76pBHCMTvPLt44wFOieouXcGXWOF0AJCceUvaFkxSZEu4VDUdv93JfpMa6VGNFs01FHfuP4a5Ou68eRG1KBfTw==} + dev: true + + /@types/d3-ease@3.0.2: + resolution: {integrity: sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==} + dev: true + + /@types/d3-fetch@3.0.7: + resolution: {integrity: sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA==} + dependencies: + '@types/d3-dsv': 3.0.1 + dev: true + + /@types/d3-force@3.0.9: + resolution: {integrity: sha512-IKtvyFdb4Q0LWna6ymywQsEYjK/94SGhPrMfEr1TIc5OBeziTi+1jcCvttts8e0UWZIxpasjnQk9MNk/3iS+kA==} + dev: true + + /@types/d3-format@3.0.4: + resolution: {integrity: sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g==} + dev: true + + /@types/d3-geo@3.1.0: + resolution: {integrity: sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ==} + dependencies: + '@types/geojson': 7946.0.13 + dev: true + + /@types/d3-hierarchy@3.1.6: + resolution: {integrity: sha512-qlmD/8aMk5xGorUvTUWHCiumvgaUXYldYjNVOWtYoTYY/L+WwIEAmJxUmTgr9LoGNG0PPAOmqMDJVDPc7DOpPw==} + dev: true + + /@types/d3-interpolate@3.0.4: + resolution: {integrity: sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==} + dependencies: + '@types/d3-color': 3.1.3 + dev: true + + /@types/d3-path@3.0.2: + resolution: {integrity: sha512-WAIEVlOCdd/NKRYTsqCpOMHQHemKBEINf8YXMYOtXH0GA7SY0dqMB78P3Uhgfy+4X+/Mlw2wDtlETkN6kQUCMA==} + dev: true + + /@types/d3-polygon@3.0.2: + resolution: {integrity: sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA==} + dev: true + + /@types/d3-quadtree@3.0.6: + resolution: {integrity: sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg==} + dev: true + + /@types/d3-random@3.0.3: + resolution: {integrity: sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ==} + dev: true + + /@types/d3-scale-chromatic@3.0.3: + resolution: {integrity: sha512-laXM4+1o5ImZv3RpFAsTRn3TEkzqkytiOY0Dz0sq5cnd1dtNlk6sHLon4OvqaiJb28T0S/TdsBI3Sjsy+keJrw==} + dev: true + + /@types/d3-scale@4.0.8: + resolution: {integrity: sha512-gkK1VVTr5iNiYJ7vWDI+yUFFlszhNMtVeneJ6lUTKPjprsvLLI9/tgEGiXJOnlINJA8FyA88gfnQsHbybVZrYQ==} + dependencies: + '@types/d3-time': 3.0.3 + dev: true + + /@types/d3-selection@2.0.0: + resolution: {integrity: sha512-EF0lWZ4tg7oDFg4YQFlbOU3936e3a9UmoQ2IXlBy1+cv2c2Pv7knhKUzGlH5Hq2sF/KeDTH1amiRPey2rrLMQA==} + dev: true + + /@types/d3-shape@3.1.6: + resolution: {integrity: sha512-5KKk5aKGu2I+O6SONMYSNflgiP0WfZIQvVUMan50wHsLG1G94JlxEVnCpQARfTtzytuY0p/9PXXZb3I7giofIA==} + dependencies: + '@types/d3-path': 3.0.2 + dev: true + + /@types/d3-time-format@4.0.3: + resolution: {integrity: sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg==} + dev: true + + /@types/d3-time@3.0.3: + resolution: {integrity: sha512-2p6olUZ4w3s+07q3Tm2dbiMZy5pCDfYwtLXXHUnVzXgQlZ/OyPtUz6OL382BkOuGlLXqfT+wqv8Fw2v8/0geBw==} + dev: true + + /@types/d3-timer@3.0.2: + resolution: {integrity: sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==} + dev: true + + /@types/d3-transition@3.0.8: + resolution: {integrity: sha512-ew63aJfQ/ms7QQ4X7pk5NxQ9fZH/z+i24ZfJ6tJSfqxJMrYLiK01EAs2/Rtw/JreGUsS3pLPNV644qXFGnoZNQ==} + dependencies: + '@types/d3-selection': 2.0.0 + dev: true + + /@types/d3-zoom@3.0.8: + resolution: {integrity: sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw==} + dependencies: + '@types/d3-interpolate': 3.0.4 + '@types/d3-selection': 2.0.0 + dev: true + + /@types/d3@7.4.3: + resolution: {integrity: sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==} + dependencies: + '@types/d3-array': 3.2.1 + '@types/d3-axis': 3.0.6 + '@types/d3-brush': 3.0.6 + '@types/d3-chord': 3.0.6 + '@types/d3-color': 3.1.3 + '@types/d3-contour': 3.0.6 + '@types/d3-delaunay': 6.0.4 + '@types/d3-dispatch': 3.0.6 + '@types/d3-drag': 2.0.0 + '@types/d3-dsv': 3.0.1 + '@types/d3-ease': 3.0.2 + '@types/d3-fetch': 3.0.7 + '@types/d3-force': 3.0.9 + '@types/d3-format': 3.0.4 + '@types/d3-geo': 3.1.0 + '@types/d3-hierarchy': 3.1.6 + '@types/d3-interpolate': 3.0.4 + '@types/d3-path': 3.0.2 + '@types/d3-polygon': 3.0.2 + '@types/d3-quadtree': 3.0.6 + '@types/d3-random': 3.0.3 + '@types/d3-scale': 4.0.8 + '@types/d3-scale-chromatic': 3.0.3 + '@types/d3-selection': 2.0.0 + '@types/d3-shape': 3.1.6 + '@types/d3-time': 3.0.3 + '@types/d3-time-format': 4.0.3 + '@types/d3-timer': 3.0.2 + '@types/d3-transition': 3.0.8 + '@types/d3-zoom': 3.0.8 + dev: true + + /@types/earcut@2.1.4: + resolution: {integrity: sha512-qp3m9PPz4gULB9MhjGID7wpo3gJ4bTGXm7ltNDsmOvsPduTeHp8wSW9YckBj3mljeOh4F0m2z/0JKAALRKbmLQ==} + + /@types/geojson@7946.0.13: + resolution: {integrity: sha512-bmrNrgKMOhM3WsafmbGmC+6dsF2Z308vLFsQ3a/bT8X8Sv5clVYpPars/UPq+sAaJP+5OoLAYgwbkS5QEJdLUQ==} + dev: true + + /@types/history@4.7.11: + resolution: {integrity: sha512-qjDJRrmvBMiTx+jyLxvLfJU7UznFuokDv4f3WRuriHKERccVpFU+8XMQUAbDzoiJCsmexxRExQeMwwCdamSKDA==} + dev: true + + /@types/istanbul-lib-coverage@2.0.6: + resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} + dev: true + + /@types/json-schema@7.0.15: + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + dev: true + + /@types/lodash-es@4.17.5: + resolution: {integrity: sha512-SHBoI8/0aoMQWAgUHMQ599VM6ZiSKg8sh/0cFqqlQQMyY9uEplc0ULU5yQNzcvdR4ZKa0ey8+vFmahuRbOCT1A==} + dependencies: + '@types/lodash': 4.14.202 + dev: true + + /@types/lodash@4.14.202: + resolution: {integrity: sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==} + dev: true + + /@types/mdast@3.0.15: + resolution: {integrity: sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==} + dependencies: + '@types/unist': 2.0.10 + dev: true + + /@types/minimist@1.2.5: + resolution: {integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==} + dev: true + + /@types/node@18.6.2: + resolution: {integrity: sha512-KcfkBq9H4PI6Vpu5B/KoPeuVDAbmi+2mDBqGPGUgoL7yXQtcWGu2vJWmmRkneWK3Rh0nIAX192Aa87AqKHYChQ==} + dev: true + + /@types/normalize-package-data@2.4.4: + resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} + dev: true + + /@types/offscreencanvas@2019.7.3: + resolution: {integrity: sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==} + + /@types/pixelmatch@5.2.6: + resolution: {integrity: sha512-wC83uexE5KGuUODn6zkm9gMzTwdY5L0chiK+VrKcDfEjzxh1uadlWTvOmAbCpnM9zx/Ww3f8uKlYQVnO/TrqVg==} + dependencies: + '@types/node': 18.6.2 + dev: true + + /@types/pngjs@6.0.4: + resolution: {integrity: sha512-atAK9xLKOnxiuArxcHovmnOUUGBZOQ3f0vCf43FnoKs6XnqiambT1kkJWmdo71IR+BoXSh+CueeFR0GfH3dTlQ==} + dependencies: + '@types/node': 18.6.2 + dev: true + + /@types/prop-types@15.7.11: + resolution: {integrity: sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==} + dev: true + + /@types/pubsub-js@1.8.2: + resolution: {integrity: sha512-cj3ZoAopr2ZmUYwRuXUiq48PlfNj5sBcUIkBnSJunfXlmf6y8o2kx4l70h1X1j0fR3IBorPrPM3B9SoyWwoqLg==} + dev: true + + /@types/raf@3.4.3: + resolution: {integrity: sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==} + requiresBuild: true + dev: false + optional: true + + /@types/rbush@3.0.0: + resolution: {integrity: sha512-W3ue/GYWXBOpkRm0VSoifrP3HV0Ni47aVJWvXyWMcbtpBy/l/K/smBRiJ+fI8f7shXRjZBiux+iJzYbh7VmcZg==} + dev: true + + /@types/react-dom@18.2.0: + resolution: {integrity: sha512-8yQrvS6sMpSwIovhPOwfyNf2Wz6v/B62LFSVYQ85+Rq3tLsBIG7rP5geMxaijTUxSkrO6RzN/IRuIAADYQsleA==} + dependencies: + '@types/react': 18.2.0 + dev: true + + /@types/react-resize-detector@4.2.0: + resolution: {integrity: sha512-y5PPThHUrBGxMhLDNn0BRWglKr84y+gQHvzkyKxF8aW3pox4IySC33V8AOu7ReS0JR1X1dKQgWeF8IOkGrbeBg==} + dependencies: + '@types/react': 18.2.0 + dev: true + + /@types/react-router-dom@5.3.3: + resolution: {integrity: sha512-kpqnYK4wcdm5UaWI3fLcELopqLrHgLqNsdpHauzlQktfkHL3npOSwtj1Uz9oKBAzs7lFtVkV8j83voAz2D8fhw==} + dependencies: + '@types/history': 4.7.11 + '@types/react': 18.2.0 + '@types/react-router': 5.1.20 + dev: true + + /@types/react-router@5.1.20: + resolution: {integrity: sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q==} + dependencies: + '@types/history': 4.7.11 + '@types/react': 18.2.0 + dev: true + + /@types/react@18.2.0: + resolution: {integrity: sha512-0FLj93y5USLHdnhIhABk83rm8XEGA7kH3cr+YUlvxoUGp1xNt/DINUMvqPxLyOQMzLmZe8i4RTHbvb8MC7NmrA==} + dependencies: + '@types/prop-types': 15.7.11 + '@types/scheduler': 0.16.8 + csstype: 3.1.2 + dev: true + + /@types/scheduler@0.16.8: + resolution: {integrity: sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==} + dev: true + + /@types/semver@7.5.6: + resolution: {integrity: sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==} + dev: true + + /@types/unist@2.0.10: + resolution: {integrity: sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==} + dev: true + + /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.19.0)(typescript@5.0.2): + resolution: {integrity: sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + '@typescript-eslint/parser': ^5.0.0 + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@eslint-community/regexpp': 4.10.0 + '@typescript-eslint/parser': 5.62.0(eslint@8.19.0)(typescript@5.0.2) + '@typescript-eslint/scope-manager': 5.62.0 + '@typescript-eslint/type-utils': 5.62.0(eslint@8.19.0)(typescript@5.0.2) + '@typescript-eslint/utils': 5.62.0(eslint@8.19.0)(typescript@5.0.2) + debug: 4.3.4 + eslint: 8.19.0 + graphemer: 1.4.0 + ignore: 5.3.0 + natural-compare-lite: 1.4.0 + semver: 7.5.4 + tsutils: 3.21.0(typescript@5.0.2) + typescript: 5.0.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/parser@5.62.0(eslint@8.19.0)(typescript@5.0.2): + resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/scope-manager': 5.62.0 + '@typescript-eslint/types': 5.62.0 + '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.0.2) + debug: 4.3.4 + eslint: 8.19.0 + typescript: 5.0.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/scope-manager@5.62.0: + resolution: {integrity: sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + '@typescript-eslint/types': 5.62.0 + '@typescript-eslint/visitor-keys': 5.62.0 + dev: true + + /@typescript-eslint/type-utils@5.62.0(eslint@8.19.0)(typescript@5.0.2): + resolution: {integrity: sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: '*' + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.0.2) + '@typescript-eslint/utils': 5.62.0(eslint@8.19.0)(typescript@5.0.2) + debug: 4.3.4 + eslint: 8.19.0 + tsutils: 3.21.0(typescript@5.0.2) + typescript: 5.0.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/types@5.62.0: + resolution: {integrity: sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + + /@typescript-eslint/typescript-estree@5.62.0(typescript@5.0.2): + resolution: {integrity: sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 5.62.0 + '@typescript-eslint/visitor-keys': 5.62.0 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + semver: 7.5.4 + tsutils: 3.21.0(typescript@5.0.2) + typescript: 5.0.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/utils@5.62.0(eslint@8.19.0)(typescript@5.0.2): + resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.19.0) + '@types/json-schema': 7.0.15 + '@types/semver': 7.5.6 + '@typescript-eslint/scope-manager': 5.62.0 + '@typescript-eslint/types': 5.62.0 + '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.0.2) + eslint: 8.19.0 + eslint-scope: 5.1.1 + semver: 7.5.4 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + + /@typescript-eslint/visitor-keys@5.62.0: + resolution: {integrity: sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + '@typescript-eslint/types': 5.62.0 + eslint-visitor-keys: 3.4.3 + dev: true + + /@vitejs/plugin-react@4.1.0(vite@4.4.11): + resolution: {integrity: sha512-rM0SqazU9iqPUraQ2JlIvReeaxOoRj6n+PzB1C0cBzIbd8qP336nC39/R9yPi3wVcah7E7j/kdU1uCUqMEU4OQ==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + vite: ^4.2.0 + dependencies: + '@babel/core': 7.23.5 + '@babel/plugin-transform-react-jsx-self': 7.23.3(@babel/core@7.23.5) + '@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.23.5) + '@types/babel__core': 7.20.5 + react-refresh: 0.14.0 + vite: 4.4.11(@types/node@18.6.2) + transitivePeerDependencies: + - supports-color + dev: true + + /@vitest/coverage-v8@0.34.6(vitest@0.34.6): + resolution: {integrity: sha512-fivy/OK2d/EsJFoEoxHFEnNGTg+MmdZBAVK9Ka4qhXR2K3J0DS08vcGVwzDtXSuUMabLv4KtPcpSKkcMXFDViw==} + peerDependencies: + vitest: '>=0.32.0 <1' + dependencies: + '@ampproject/remapping': 2.2.1 + '@bcoe/v8-coverage': 0.2.3 + istanbul-lib-coverage: 3.2.2 + istanbul-lib-report: 3.0.1 + istanbul-lib-source-maps: 4.0.1 + istanbul-reports: 3.1.6 + magic-string: 0.30.5 + picocolors: 1.0.0 + std-env: 3.6.0 + test-exclude: 6.0.0 + v8-to-istanbul: 9.2.0 + vitest: 0.34.6(jsdom@19.0.0) + transitivePeerDependencies: + - supports-color + dev: true + + /@vitest/expect@0.34.6: + resolution: {integrity: sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==} + dependencies: + '@vitest/spy': 0.34.6 + '@vitest/utils': 0.34.6 + chai: 4.3.10 + dev: true + + /@vitest/runner@0.34.6: + resolution: {integrity: sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==} + dependencies: + '@vitest/utils': 0.34.6 + p-limit: 4.0.0 + pathe: 1.1.1 + dev: true + + /@vitest/snapshot@0.34.6: + resolution: {integrity: sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==} + dependencies: + magic-string: 0.30.5 + pathe: 1.1.1 + pretty-format: 29.7.0 + dev: true + + /@vitest/spy@0.34.6: + resolution: {integrity: sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==} + dependencies: + tinyspy: 2.2.0 + dev: true + + /@vitest/utils@0.34.6: + resolution: {integrity: sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==} + dependencies: + diff-sequences: 29.6.3 + loupe: 2.3.7 + pretty-format: 29.7.0 + dev: true + + /JSONStream@1.3.5: + resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} + hasBin: true + dependencies: + jsonparse: 1.3.1 + through: 2.3.8 + dev: true + + /abab@2.0.6: + resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} + deprecated: Use your platform's native atob() and btoa() methods instead + dev: true + + /abortable-promise-cache@1.5.0: + resolution: {integrity: sha512-S2FfvU1As7Fve6ObCEsuOiE22UR7k91ytM+m4bzG6eAf+fb4TOAVEGZGAzlRfCo7/bZamL9d3ZeXc08MPm3azA==} + engines: {node: '>=6'} + dependencies: + abortcontroller-polyfill: 1.7.5 + dev: false + + /abortcontroller-polyfill@1.7.5: + resolution: {integrity: sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==} + dev: false + + /acorn-globals@6.0.0: + resolution: {integrity: sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==} + dependencies: + acorn: 7.4.1 + acorn-walk: 7.2.0 + dev: true + + /acorn-jsx@5.3.2(acorn@8.11.2): + resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + acorn: 8.11.2 + dev: true + + /acorn-walk@7.2.0: + resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==} + engines: {node: '>=0.4.0'} + dev: true + + /acorn-walk@8.3.0: + resolution: {integrity: sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==} + engines: {node: '>=0.4.0'} + dev: true + + /acorn@7.4.1: + resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true + + /acorn@8.11.2: + resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true + + /add-stream@1.0.0: + resolution: {integrity: sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ==} + dev: true + + /agent-base@6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + dependencies: + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + + /aggregate-error@3.1.0: + resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} + engines: {node: '>=8'} + dependencies: + clean-stack: 2.2.0 + indent-string: 4.0.0 + dev: true + + /ajv@6.12.6: + resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + /allotment@1.19.3(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-StPCZLGPNG9KhXeNCrqTkIK09s7D6+8n0w754SRY8PUvDXFLLovrFFo4ubd82fytRWS5bFntsWA5SX4sODxuiw==} + peerDependencies: + react: ^17.0.0 || ^18.0.0 + react-dom: ^17.0.0 || ^18.0.0 + dependencies: + classnames: 2.3.2 + eventemitter3: 5.0.1 + lodash.clamp: 4.0.3 + lodash.debounce: 4.0.8 + lodash.isequal: 4.5.0 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + use-resize-observer: 9.1.0(react-dom@18.2.0)(react@18.2.0) + dev: false + + /ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + dev: true + + /ansi-regex@6.0.1: + resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} + engines: {node: '>=12'} + dev: true + + /ansi-styles@3.2.1: + resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} + engines: {node: '>=4'} + dependencies: + color-convert: 1.9.3 + dev: true + + /ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + dependencies: + color-convert: 2.0.1 + dev: true + + /ansi-styles@5.2.0: + resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} + engines: {node: '>=10'} + dev: true + + /ansi-styles@6.2.1: + resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} + engines: {node: '>=12'} + dev: true + + /argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + dev: true + + /aria-query@5.3.0: + resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==} + dependencies: + dequal: 2.0.3 + dev: true + + /arity-n@1.0.4: + resolution: {integrity: sha512-fExL2kFDC1Q2DUOx3whE/9KoN66IzkY4b4zUHUBFM1ojEYjZZYDcUW3bek/ufGionX9giIKDC5redH2IlGqcQQ==} + dev: true + + /array-buffer-byte-length@1.0.0: + resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} + dependencies: + call-bind: 1.0.5 + is-array-buffer: 3.0.2 + dev: true + + /array-ify@1.0.0: + resolution: {integrity: sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==} + dev: true + + /array-includes@3.1.7: + resolution: {integrity: sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + get-intrinsic: 1.2.2 + is-string: 1.0.7 + dev: true + + /array-last@1.3.0: + resolution: {integrity: sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg==} + engines: {node: '>=0.10.0'} + dependencies: + is-number: 4.0.0 + dev: true + + /array-union@2.1.0: + resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} + engines: {node: '>=8'} + dev: true + + /array.prototype.flat@1.3.2: + resolution: {integrity: sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + es-shim-unscopables: 1.0.2 + dev: true + + /array.prototype.flatmap@1.3.2: + resolution: {integrity: sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + es-shim-unscopables: 1.0.2 + dev: true + + /array.prototype.tosorted@1.1.2: + resolution: {integrity: sha512-HuQCHOlk1Weat5jzStICBCd83NxiIMwqDg/dHEsoefabn/hJRj5pVdWcPUSpRrwhwxZOsQassMpgN/xRYFBMIg==} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + es-shim-unscopables: 1.0.2 + get-intrinsic: 1.2.2 + dev: true + + /arraybuffer.prototype.slice@1.0.2: + resolution: {integrity: sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.0 + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + get-intrinsic: 1.2.2 + is-array-buffer: 3.0.2 + is-shared-array-buffer: 1.0.2 + dev: true + + /arrify@1.0.1: + resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} + engines: {node: '>=0.10.0'} + dev: true + + /assertion-error@1.1.0: + resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + dev: true + + /ast-types-flow@0.0.7: + resolution: {integrity: sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==} + dev: true + + /asynciterator.prototype@1.0.0: + resolution: {integrity: sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg==} + dependencies: + has-symbols: 1.0.3 + dev: true + + /asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + dev: true + + /atob@2.1.2: + resolution: {integrity: sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==} + engines: {node: '>= 4.5.0'} + hasBin: true + dev: false + + /available-typed-arrays@1.0.5: + resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} + engines: {node: '>= 0.4'} + dev: true + + /axe-core@4.7.0: + resolution: {integrity: sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==} + engines: {node: '>=4'} + dev: true + + /axobject-query@3.2.1: + resolution: {integrity: sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==} + dependencies: + dequal: 2.0.3 + dev: true + + /babylon@6.18.0: + resolution: {integrity: sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==} + hasBin: true + dev: true + + /bail@1.0.5: + resolution: {integrity: sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==} + dev: true + + /balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + dev: true + + /base64-arraybuffer@1.0.2: + resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==} + engines: {node: '>= 0.6.0'} + requiresBuild: true + dev: false + optional: true + + /base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + dev: false + + /bezier-js@4.0.3: + resolution: {integrity: sha512-w85AFcZ7EkszFgxuHYQ2/BI2G7H5bEotZD9vcg8+Hx4S8zF2odJBoFSFvGbcFDH5ScSxG27/IhW03SigVmkXNQ==} + dev: false + + /binary-parser@2.2.1: + resolution: {integrity: sha512-5ATpz/uPDgq5GgEDxTB4ouXCde7q2lqAQlSdBRQVl/AJnxmQmhIfyxJx+0MGu//D5rHQifkfGbWWlaysG0o9NA==} + engines: {node: '>=12'} + dev: false + + /bit-twiddle@1.0.2: + resolution: {integrity: sha512-B9UhK0DKFZhoTFcfvAzhqsjStvGJp9vYWf3+6SNTtdSQnvIgfkHbgHrg/e4+TH71N2GDu8tpmCVoyfrL1d7ntA==} + dev: false + + /box-intersect@1.0.2: + resolution: {integrity: sha512-yJeMwlmFPG1gIa7Rs/cGXeI6iOj6Qz5MG5PE61xLKpElUGzmJ4abm+qsLpzxKJFpsSDq742BQEocr8dI2t8Nxw==} + dependencies: + bit-twiddle: 1.0.2 + typedarray-pool: 1.2.0 + dev: false + + /brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + dev: true + + /brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + dependencies: + balanced-match: 1.0.2 + dev: true + + /braces@3.0.2: + resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} + engines: {node: '>=8'} + dependencies: + fill-range: 7.0.1 + dev: true + + /browser-process-hrtime@1.0.0: + resolution: {integrity: sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==} + dev: true + + /browserslist@4.22.2: + resolution: {integrity: sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + dependencies: + caniuse-lite: 1.0.30001566 + electron-to-chromium: 1.4.601 + node-releases: 2.0.14 + update-browserslist-db: 1.0.13(browserslist@4.22.2) + dev: true + + /btoa@1.2.1: + resolution: {integrity: sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==} + engines: {node: '>= 0.4.0'} + hasBin: true + dev: false + + /buffer-crc32@0.2.13: + resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} + dev: false + + /buffer@6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + dev: false + + /c8@7.14.0: + resolution: {integrity: sha512-i04rtkkcNcCf7zsQcSv/T9EbUn4RXQ6mropeMcjFOsQXQ0iGLAr/xT6TImQg4+U9hmNpN9XdvPkjUL1IzbgxJw==} + engines: {node: '>=10.12.0'} + hasBin: true + dependencies: + '@bcoe/v8-coverage': 0.2.3 + '@istanbuljs/schema': 0.1.3 + find-up: 5.0.0 + foreground-child: 2.0.0 + istanbul-lib-coverage: 3.2.2 + istanbul-lib-report: 3.0.1 + istanbul-reports: 3.1.6 + rimraf: 3.0.2 + test-exclude: 6.0.0 + v8-to-istanbul: 9.2.0 + yargs: 16.2.0 + yargs-parser: 20.2.9 + dev: true + + /cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + dev: true + + /call-bind@1.0.5: + resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} + dependencies: + function-bind: 1.1.2 + get-intrinsic: 1.2.2 + set-function-length: 1.1.1 + + /callsites@3.1.0: + resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} + engines: {node: '>=6'} + + /camelcase-keys@6.2.2: + resolution: {integrity: sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==} + engines: {node: '>=8'} + dependencies: + camelcase: 5.3.1 + map-obj: 4.3.0 + quick-lru: 4.0.1 + dev: true + + /camelcase@5.3.1: + resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} + engines: {node: '>=6'} + dev: true + + /caniuse-lite@1.0.30001566: + resolution: {integrity: sha512-ggIhCsTxmITBAMmK8yZjEhCO5/47jKXPu6Dha/wuCS4JePVL+3uiDEBuhu2aIoT+bqTOR8L76Ip1ARL9xYsEJA==} + dev: true + + /canvg@3.0.10: + resolution: {integrity: sha512-qwR2FRNO9NlzTeKIPIKpnTY6fqwuYSequ8Ru8c0YkYU7U0oW+hLUvWadLvAu1Rl72OMNiFhoLu4f8eUjQ7l/+Q==} + engines: {node: '>=10.0.0'} + requiresBuild: true + dependencies: + '@babel/runtime': 7.23.5 + '@types/raf': 3.4.3 + core-js: 3.33.3 + raf: 3.4.1 + regenerator-runtime: 0.13.11 + rgbcolor: 1.0.1 + stackblur-canvas: 2.6.0 + svg-pathdata: 6.0.3 + dev: false + optional: true + + /ccount@1.1.0: + resolution: {integrity: sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg==} + dev: true + + /chai@4.3.10: + resolution: {integrity: sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==} + engines: {node: '>=4'} + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.3 + deep-eql: 4.1.3 + get-func-name: 2.0.2 + loupe: 2.3.7 + pathval: 1.1.1 + type-detect: 4.0.8 + dev: true + + /chalk@2.4.2: + resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} + engines: {node: '>=4'} + dependencies: + ansi-styles: 3.2.1 + escape-string-regexp: 1.0.5 + supports-color: 5.5.0 + dev: true + + /chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + dev: true + + /chalk@5.3.0: + resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + dev: true + + /character-entities-legacy@1.1.4: + resolution: {integrity: sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==} + dev: true + + /character-entities@1.2.4: + resolution: {integrity: sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==} + dev: true + + /character-reference-invalid@1.1.4: + resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==} + dev: true + + /check-error@1.0.3: + resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + dependencies: + get-func-name: 2.0.2 + dev: true + + /classnames@2.3.2: + resolution: {integrity: sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==} + dev: false + + /clean-stack@2.2.0: + resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} + engines: {node: '>=6'} + dev: true + + /cliui@7.0.4: + resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + dev: true + + /clone@1.0.4: + resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} + engines: {node: '>=0.8'} + requiresBuild: true + dev: true + optional: true + + /clsx@1.2.1: + resolution: {integrity: sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==} + engines: {node: '>=6'} + dev: false + + /color-convert@1.9.3: + resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} + dependencies: + color-name: 1.1.3 + dev: true + + /color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + dependencies: + color-name: 1.1.4 + dev: true + + /color-name@1.1.3: + resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} + dev: true + + /color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + dev: true + + /combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + dependencies: + delayed-stream: 1.0.0 + dev: true + + /commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + dev: false + + /commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + dev: true + + /commander@9.5.0: + resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} + engines: {node: ^12.20.0 || >=14} + dev: true + + /compare-func@2.0.0: + resolution: {integrity: sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==} + dependencies: + array-ify: 1.0.0 + dot-prop: 5.3.0 + dev: true + + /compose-function@3.0.3: + resolution: {integrity: sha512-xzhzTJ5eC+gmIzvZq+C3kCJHsp9os6tJkrigDRZclyGtOKINbZtE8n1Tzmeh32jW+BUDPbvZpibwvJHBLGMVwg==} + dependencies: + arity-n: 1.0.4 + dev: true + + /concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + dev: true + + /conventional-changelog-angular@5.0.13: + resolution: {integrity: sha512-i/gipMxs7s8L/QeuavPF2hLnJgH6pEZAttySB6aiQLWcX3puWDL3ACVmvBhJGxnAy52Qc15ua26BufY6KpmrVA==} + engines: {node: '>=10'} + dependencies: + compare-func: 2.0.0 + q: 1.5.1 + dev: true + + /conventional-changelog-atom@2.0.8: + resolution: {integrity: sha512-xo6v46icsFTK3bb7dY/8m2qvc8sZemRgdqLb/bjpBsH2UyOS8rKNTgcb5025Hri6IpANPApbXMg15QLb1LJpBw==} + engines: {node: '>=10'} + dependencies: + q: 1.5.1 + dev: true + + /conventional-changelog-cli@2.2.2: + resolution: {integrity: sha512-8grMV5Jo8S0kP3yoMeJxV2P5R6VJOqK72IiSV9t/4H5r/HiRqEBQ83bYGuz4Yzfdj4bjaAEhZN/FFbsFXr5bOA==} + engines: {node: '>=10'} + hasBin: true + dependencies: + add-stream: 1.0.0 + conventional-changelog: 3.1.25 + lodash: 4.17.21 + meow: 8.1.2 + tempfile: 3.0.0 + dev: true + + /conventional-changelog-codemirror@2.0.8: + resolution: {integrity: sha512-z5DAsn3uj1Vfp7po3gpt2Boc+Bdwmw2++ZHa5Ak9k0UKsYAO5mH1UBTN0qSCuJZREIhX6WU4E1p3IW2oRCNzQw==} + engines: {node: '>=10'} + dependencies: + q: 1.5.1 + dev: true + + /conventional-changelog-conventionalcommits@4.6.3: + resolution: {integrity: sha512-LTTQV4fwOM4oLPad317V/QNQ1FY4Hju5qeBIM1uTHbrnCE+Eg4CdRZ3gO2pUeR+tzWdp80M2j3qFFEDWVqOV4g==} + engines: {node: '>=10'} + dependencies: + compare-func: 2.0.0 + lodash: 4.17.21 + q: 1.5.1 + dev: true + + /conventional-changelog-core@4.2.4: + resolution: {integrity: sha512-gDVS+zVJHE2v4SLc6B0sLsPiloR0ygU7HaDW14aNJE1v4SlqJPILPl/aJC7YdtRE4CybBf8gDwObBvKha8Xlyg==} + engines: {node: '>=10'} + dependencies: + add-stream: 1.0.0 + conventional-changelog-writer: 5.0.1 + conventional-commits-parser: 3.2.4 + dateformat: 3.0.3 + get-pkg-repo: 4.2.1 + git-raw-commits: 2.0.11 + git-remote-origin-url: 2.0.0 + git-semver-tags: 4.1.1 + lodash: 4.17.21 + normalize-package-data: 3.0.3 + q: 1.5.1 + read-pkg: 3.0.0 + read-pkg-up: 3.0.0 + through2: 4.0.2 + dev: true + + /conventional-changelog-ember@2.0.9: + resolution: {integrity: sha512-ulzIReoZEvZCBDhcNYfDIsLTHzYHc7awh+eI44ZtV5cx6LVxLlVtEmcO+2/kGIHGtw+qVabJYjdI5cJOQgXh1A==} + engines: {node: '>=10'} + dependencies: + q: 1.5.1 + dev: true + + /conventional-changelog-eslint@3.0.9: + resolution: {integrity: sha512-6NpUCMgU8qmWmyAMSZO5NrRd7rTgErjrm4VASam2u5jrZS0n38V7Y9CzTtLT2qwz5xEChDR4BduoWIr8TfwvXA==} + engines: {node: '>=10'} + dependencies: + q: 1.5.1 + dev: true + + /conventional-changelog-express@2.0.6: + resolution: {integrity: sha512-SDez2f3iVJw6V563O3pRtNwXtQaSmEfTCaTBPCqn0oG0mfkq0rX4hHBq5P7De2MncoRixrALj3u3oQsNK+Q0pQ==} + engines: {node: '>=10'} + dependencies: + q: 1.5.1 + dev: true + + /conventional-changelog-jquery@3.0.11: + resolution: {integrity: sha512-x8AWz5/Td55F7+o/9LQ6cQIPwrCjfJQ5Zmfqi8thwUEKHstEn4kTIofXub7plf1xvFA2TqhZlq7fy5OmV6BOMw==} + engines: {node: '>=10'} + dependencies: + q: 1.5.1 + dev: true + + /conventional-changelog-jshint@2.0.9: + resolution: {integrity: sha512-wMLdaIzq6TNnMHMy31hql02OEQ8nCQfExw1SE0hYL5KvU+JCTuPaDO+7JiogGT2gJAxiUGATdtYYfh+nT+6riA==} + engines: {node: '>=10'} + dependencies: + compare-func: 2.0.0 + q: 1.5.1 + dev: true + + /conventional-changelog-preset-loader@2.3.4: + resolution: {integrity: sha512-GEKRWkrSAZeTq5+YjUZOYxdHq+ci4dNwHvpaBC3+ENalzFWuCWa9EZXSuZBpkr72sMdKB+1fyDV4takK1Lf58g==} + engines: {node: '>=10'} + dev: true + + /conventional-changelog-writer@5.0.1: + resolution: {integrity: sha512-5WsuKUfxW7suLblAbFnxAcrvf6r+0b7GvNaWUwUIk0bXMnENP/PEieGKVUQrjPqwPT4o3EPAASBXiY6iHooLOQ==} + engines: {node: '>=10'} + hasBin: true + dependencies: + conventional-commits-filter: 2.0.7 + dateformat: 3.0.3 + handlebars: 4.7.8 + json-stringify-safe: 5.0.1 + lodash: 4.17.21 + meow: 8.1.2 + semver: 6.3.1 + split: 1.0.1 + through2: 4.0.2 + dev: true + + /conventional-changelog@3.1.25: + resolution: {integrity: sha512-ryhi3fd1mKf3fSjbLXOfK2D06YwKNic1nC9mWqybBHdObPd8KJ2vjaXZfYj1U23t+V8T8n0d7gwnc9XbIdFbyQ==} + engines: {node: '>=10'} + dependencies: + conventional-changelog-angular: 5.0.13 + conventional-changelog-atom: 2.0.8 + conventional-changelog-codemirror: 2.0.8 + conventional-changelog-conventionalcommits: 4.6.3 + conventional-changelog-core: 4.2.4 + conventional-changelog-ember: 2.0.9 + conventional-changelog-eslint: 3.0.9 + conventional-changelog-express: 2.0.6 + conventional-changelog-jquery: 3.0.11 + conventional-changelog-jshint: 2.0.9 + conventional-changelog-preset-loader: 2.3.4 + dev: true + + /conventional-commits-filter@2.0.7: + resolution: {integrity: sha512-ASS9SamOP4TbCClsRHxIHXRfcGCnIoQqkvAzCSbZzTFLfcTqJVugB0agRgsEELsqaeWgsXv513eS116wnlSSPA==} + engines: {node: '>=10'} + dependencies: + lodash.ismatch: 4.4.0 + modify-values: 1.0.1 + dev: true + + /conventional-commits-parser@3.2.4: + resolution: {integrity: sha512-nK7sAtfi+QXbxHCYfhpZsfRtaitZLIA6889kFIouLvz6repszQDgxBu7wf2WbU+Dco7sAnNCJYERCwt54WPC2Q==} + engines: {node: '>=10'} + hasBin: true + dependencies: + JSONStream: 1.3.5 + is-text-path: 1.0.1 + lodash: 4.17.21 + meow: 8.1.2 + split2: 3.2.2 + through2: 4.0.2 + dev: true + + /convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + dev: true + + /core-js@3.33.3: + resolution: {integrity: sha512-lo0kOocUlLKmm6kv/FswQL8zbkH7mVsLJ/FULClOhv8WRVmKLVcs6XPNQAzstfeJTCHMyButEwG+z1kHxHoDZw==} + requiresBuild: true + dev: false + optional: true + + /core-util-is@1.0.3: + resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} + dev: true + + /cross-fetch@3.1.8: + resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==} + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + dev: false + + /cross-spawn@6.0.5: + resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==} + engines: {node: '>=4.8'} + dependencies: + nice-try: 1.0.5 + path-key: 2.0.1 + semver: 5.7.2 + shebang-command: 1.2.0 + which: 1.3.1 + dev: true + + /cross-spawn@7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + dev: true + + /css-element-queries@1.2.3: + resolution: {integrity: sha512-QK9uovYmKTsV2GXWQiMOByVNrLn2qz6m3P7vWpOR4IdD6I3iXoDw5qtgJEN3Xq7gIbdHVKvzHjdAtcl+4Arc4Q==} + dev: false + + /css-line-break@2.1.0: + resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==} + requiresBuild: true + dependencies: + utrie: 1.0.2 + dev: false + optional: true + + /cssfontparser@1.2.1: + resolution: {integrity: sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg==} + dev: true + + /cssom@0.3.8: + resolution: {integrity: sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==} + dev: true + + /cssom@0.5.0: + resolution: {integrity: sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==} + dev: true + + /cssstyle@2.3.0: + resolution: {integrity: sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==} + engines: {node: '>=8'} + dependencies: + cssom: 0.3.8 + dev: true + + /csstype@3.1.2: + resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} + dev: true + + /d3-array@2.12.1: + resolution: {integrity: sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==} + dependencies: + internmap: 1.0.1 + dev: false + + /d3-axis@2.1.0: + resolution: {integrity: sha512-z/G2TQMyuf0X3qP+Mh+2PimoJD41VOCjViJzT0BHeL/+JQAofkiWZbWxlwFGb1N8EN+Cl/CW+MUKbVzr1689Cw==} + dev: false + + /d3-brush@2.1.0: + resolution: {integrity: sha512-cHLLAFatBATyIKqZOkk/mDHUbzne2B3ZwxkzMHvFTCZCmLaXDpZRihQSn8UNXTkGD/3lb/W2sQz0etAftmHMJQ==} + dependencies: + d3-dispatch: 2.0.0 + d3-drag: 2.0.0 + d3-interpolate: 2.0.1 + d3-selection: 2.0.0 + d3-transition: 2.0.0(d3-selection@2.0.0) + dev: false + + /d3-collection@1.0.7: + resolution: {integrity: sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A==} + dev: false + + /d3-color@1.4.1: + resolution: {integrity: sha512-p2sTHSLCJI2QKunbGb7ocOh7DgTAn8IrLx21QRc/BSnodXM4sv6aLQlnfpvehFMLZEfBc6g9pH9SWQccFYfJ9Q==} + dev: false + + /d3-color@2.0.0: + resolution: {integrity: sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ==} + dev: false + + /d3-color@3.1.0: + resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==} + engines: {node: '>=12'} + dev: false + + /d3-dispatch@1.0.6: + resolution: {integrity: sha512-fVjoElzjhCEy+Hbn8KygnmMS7Or0a9sI2UzGwoB7cCtvI1XpVN9GpoYlnb3xt2YV66oXYb1fLJ8GMvP4hdU1RA==} + dev: false + + /d3-dispatch@2.0.0: + resolution: {integrity: sha512-S/m2VsXI7gAti2pBoLClFFTMOO1HTtT0j99AuXLoGFKO6deHDdnv6ZGTxSTTUTgO1zVcv82fCOtDjYK4EECmWA==} + + /d3-dispatch@3.0.1: + resolution: {integrity: sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==} + engines: {node: '>=12'} + dev: false + + /d3-drag@2.0.0: + resolution: {integrity: sha512-g9y9WbMnF5uqB9qKqwIIa/921RYWzlUDv9Jl1/yONQwxbOfszAWTCm8u7HOTgJgRDXiRZN56cHT9pd24dmXs8w==} + dependencies: + d3-dispatch: 2.0.0 + d3-selection: 2.0.0 + + /d3-drag@3.0.0: + resolution: {integrity: sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==} + engines: {node: '>=12'} + dependencies: + d3-dispatch: 3.0.1 + d3-selection: 3.0.0 + dev: false + + /d3-dsv@1.2.0: + resolution: {integrity: sha512-9yVlqvZcSOMhCYzniHE7EVUws7Fa1zgw+/EAV2BxJoG3ME19V6BQFBwI855XQDsxyOuG7NibqRMTtiF/Qup46g==} + hasBin: true + dependencies: + commander: 2.20.3 + iconv-lite: 0.4.24 + rw: 1.3.3 + dev: false + + /d3-dsv@2.0.0: + resolution: {integrity: sha512-E+Pn8UJYx9mViuIUkoc93gJGGYut6mSDKy2+XaPwccwkRGlR+LO97L2VCCRjQivTwLHkSnAJG7yo00BWY6QM+w==} + hasBin: true + dependencies: + commander: 2.20.3 + iconv-lite: 0.4.24 + rw: 1.3.3 + dev: false + + /d3-ease@2.0.0: + resolution: {integrity: sha512-68/n9JWarxXkOWMshcT5IcjbB+agblQUaIsbnXmrzejn2O82n3p2A9R2zEB9HIEFWKFwPAEDDN8gR0VdSAyyAQ==} + dev: false + + /d3-ease@3.0.1: + resolution: {integrity: sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==} + engines: {node: '>=12'} + dev: false + + /d3-format@1.4.5: + resolution: {integrity: sha512-J0piedu6Z8iB6TbIGfZgDzfXxUFN3qQRMofy2oPdXzQibYGqPB/9iMcxr/TGalU+2RsyDO+U4f33id8tbnSRMQ==} + dev: false + + /d3-format@2.0.0: + resolution: {integrity: sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA==} + dev: false + + /d3-format@3.1.0: + resolution: {integrity: sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==} + engines: {node: '>=12'} + dev: false + + /d3-geo@2.0.2: + resolution: {integrity: sha512-8pM1WGMLGFuhq9S+FpPURxic+gKzjluCD/CHTuUF3mXMeiCo0i6R0tO1s4+GArRFde96SLcW/kOFRjoAosPsFA==} + dependencies: + d3-array: 2.12.1 + dev: false + + /d3-interpolate@1.4.0: + resolution: {integrity: sha512-V9znK0zc3jOPV4VD2zZn0sDhZU3WAE2bmlxdIwwQPPzPjvyLkd8B3JUVdS1IDUFDkWZ72c9qnv1GK2ZagTZ8EA==} + dependencies: + d3-color: 1.4.1 + dev: false + + /d3-interpolate@2.0.1: + resolution: {integrity: sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ==} + dependencies: + d3-color: 2.0.0 + dev: false + + /d3-interpolate@3.0.1: + resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==} + engines: {node: '>=12'} + dependencies: + d3-color: 2.0.0 + dev: false + + /d3-path@2.0.0: + resolution: {integrity: sha512-ZwZQxKhBnv9yHaiWd6ZU4x5BtCQ7pXszEV9CU6kRgwIQVQGLMv1oiL4M+MK/n79sYzsj+gcgpPQSctJUsLN7fA==} + dev: false + + /d3-queue@3.0.7: + resolution: {integrity: sha512-2rs+6pNFKkrJhqe1rg5znw7dKJ7KZr62j9aLZfhondkrnz6U7VRmJj1UGcbD8MRc46c7H8m4SWhab8EalBQrkw==} + dev: false + + /d3-request@1.0.6: + resolution: {integrity: sha512-FJj8ySY6GYuAJHZMaCQ83xEYE4KbkPkmxZ3Hu6zA1xxG2GD+z6P+Lyp+zjdsHf0xEbp2xcluDI50rCS855EQ6w==} + dependencies: + d3-collection: 1.0.7 + d3-dispatch: 1.0.6 + d3-dsv: 1.2.0 + xmlhttprequest: 1.8.0 + dev: false + + /d3-scale-chromatic@2.0.0: + resolution: {integrity: sha512-LLqy7dJSL8yDy7NRmf6xSlsFZ6zYvJ4BcWFE4zBrOPnQERv9zj24ohnXKRbyi9YHnYV+HN1oEO3iFK971/gkzA==} + dependencies: + d3-color: 2.0.0 + d3-interpolate: 2.0.1 + dev: false + + /d3-scale@3.2.1: + resolution: {integrity: sha512-huz5byJO/6MPpz6Q8d4lg7GgSpTjIZW/l+1MQkzKfu2u8P6hjaXaStOpmyrD6ymKoW87d2QVFCKvSjLwjzx/rA==} + dependencies: + d3-array: 2.12.1 + d3-format: 1.4.5 + d3-interpolate: 1.4.0 + d3-time: 1.1.0 + d3-time-format: 2.3.0 + dev: false + + /d3-scale@4.0.2: + resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==} + engines: {node: '>=12'} + dependencies: + d3-array: 2.12.1 + d3-format: 3.1.0 + d3-interpolate: 3.0.1 + d3-time: 3.1.0 + d3-time-format: 4.1.0 + dev: false + + /d3-selection@2.0.0: + resolution: {integrity: sha512-XoGGqhLUN/W14NmaqcO/bb1nqjDAw5WtSYb2X8wiuQWvSZUsUVYsOSkOybUrNvcBjaywBdYPy03eXHMXjk9nZA==} + + /d3-selection@3.0.0: + resolution: {integrity: sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==} + engines: {node: '>=12'} + dev: false + + /d3-shape@2.1.0: + resolution: {integrity: sha512-PnjUqfM2PpskbSLTJvAzp2Wv4CZsnAgTfcVRTwW03QR3MkXF8Uo7B1y/lWkAsmbKwuecto++4NlsYcvYpXpTHA==} + dependencies: + d3-path: 2.0.0 + dev: false + + /d3-time-format@2.3.0: + resolution: {integrity: sha512-guv6b2H37s2Uq/GefleCDtbe0XZAuy7Wa49VGkPVPMfLL9qObgBST3lEHJBMUp8S7NdLQAGIvr2KXk8Hc98iKQ==} + dependencies: + d3-time: 1.1.0 + dev: false + + /d3-time-format@4.1.0: + resolution: {integrity: sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==} + engines: {node: '>=12'} + dependencies: + d3-time: 3.1.0 + dev: false + + /d3-time@1.1.0: + resolution: {integrity: sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA==} + dev: false + + /d3-time@3.1.0: + resolution: {integrity: sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==} + engines: {node: '>=12'} + dependencies: + d3-array: 2.12.1 + dev: false + + /d3-timer@2.0.0: + resolution: {integrity: sha512-TO4VLh0/420Y/9dO3+f9abDEFYeCUr2WZRlxJvbp4HPTQcSylXNiL6yZa9FIUvV1yRiFufl1bszTCLDqv9PWNA==} + dev: false + + /d3-timer@3.0.1: + resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==} + engines: {node: '>=12'} + dev: false + + /d3-transition@2.0.0(d3-selection@2.0.0): + resolution: {integrity: sha512-42ltAGgJesfQE3u9LuuBHNbGrI/AJjNL2OAUdclE70UE6Vy239GCBEYD38uBPoLeNsOhFStGpPI0BAOV+HMxog==} + peerDependencies: + d3-selection: '2' + dependencies: + d3-color: 2.0.0 + d3-dispatch: 2.0.0 + d3-ease: 2.0.0 + d3-interpolate: 2.0.1 + d3-selection: 2.0.0 + d3-timer: 2.0.0 + dev: false + + /d3-transition@3.0.1(d3-selection@2.0.0): + resolution: {integrity: sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==} + engines: {node: '>=12'} + peerDependencies: + d3-selection: 2 - 3 + dependencies: + d3-color: 3.1.0 + d3-dispatch: 3.0.1 + d3-ease: 3.0.1 + d3-interpolate: 3.0.1 + d3-selection: 2.0.0 + d3-timer: 3.0.1 + dev: false + + /d3-transition@3.0.1(d3-selection@3.0.0): + resolution: {integrity: sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==} + engines: {node: '>=12'} + peerDependencies: + d3-selection: 2 - 3 + dependencies: + d3-color: 3.1.0 + d3-dispatch: 3.0.1 + d3-ease: 3.0.1 + d3-interpolate: 3.0.1 + d3-selection: 3.0.0 + d3-timer: 3.0.1 + dev: false + + /d3-zoom@3.0.0: + resolution: {integrity: sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==} + engines: {node: '>=12'} + dependencies: + d3-dispatch: 3.0.1 + d3-drag: 3.0.0 + d3-interpolate: 3.0.1 + d3-selection: 3.0.0 + d3-transition: 3.0.1(d3-selection@3.0.0) + dev: false + + /damerau-levenshtein@1.0.8: + resolution: {integrity: sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==} + dev: true + + /dargs@7.0.0: + resolution: {integrity: sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==} + engines: {node: '>=8'} + dev: true + + /data-urls@3.0.2: + resolution: {integrity: sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==} + engines: {node: '>=12'} + dependencies: + abab: 2.0.6 + whatwg-mimetype: 3.0.0 + whatwg-url: 11.0.0 + dev: true + + /dateformat@3.0.3: + resolution: {integrity: sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==} + dev: true + + /debug@4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + + /decamelize-keys@1.1.1: + resolution: {integrity: sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==} + engines: {node: '>=0.10.0'} + dependencies: + decamelize: 1.2.0 + map-obj: 1.0.1 + dev: true + + /decamelize@1.2.0: + resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} + engines: {node: '>=0.10.0'} + dev: true + + /decimal.js@10.4.3: + resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} + dev: true + + /deep-eql@4.1.3: + resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} + engines: {node: '>=6'} + dependencies: + type-detect: 4.0.8 + dev: true + + /deep-freeze@0.0.1: + resolution: {integrity: sha512-Z+z8HiAvsGwmjqlphnHW5oz6yWlOwu6EQfFTjmeTWlDeda3FS2yv3jhq35TX/ewmsnqB+RX2IdsIOyjJCQN5tg==} + dev: true + + /deep-is@0.1.4: + resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + dev: true + + /defaults@1.0.4: + resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} + requiresBuild: true + dependencies: + clone: 1.0.4 + dev: true + optional: true + + /define-data-property@1.1.1: + resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.2 + gopd: 1.0.1 + has-property-descriptors: 1.0.1 + + /define-properties@1.2.1: + resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 + has-property-descriptors: 1.0.1 + object-keys: 1.1.1 + dev: true + + /delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + dev: true + + /dequal@2.0.3: + resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} + engines: {node: '>=6'} + dev: true + + /diff-sequences@29.6.3: + resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dev: true + + /dir-glob@3.0.1: + resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} + engines: {node: '>=8'} + dependencies: + path-type: 4.0.0 + dev: true + + /doctrine@2.1.0: + resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} + engines: {node: '>=0.10.0'} + dependencies: + esutils: 2.0.3 + dev: true + + /doctrine@3.0.0: + resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} + engines: {node: '>=6.0.0'} + dependencies: + esutils: 2.0.3 + dev: true + + /dom-scroll-into-view@1.2.1: + resolution: {integrity: sha512-LwNVg3GJOprWDO+QhLL1Z9MMgWe/KAFLxVWKzjRTxNSPn8/LLDIfmuG71YHznXCqaqTjvHJDYO1MEAgX6XCNbQ==} + dev: false + + /dom-serializer@2.0.0: + resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==} + dependencies: + domelementtype: 2.3.0 + domhandler: 5.0.3 + entities: 4.5.0 + dev: true + + /domelementtype@2.3.0: + resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} + dev: true + + /domexception@4.0.0: + resolution: {integrity: sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==} + engines: {node: '>=12'} + deprecated: Use your platform's native DOMException instead + dependencies: + webidl-conversions: 7.0.0 + dev: true + + /domhandler@5.0.3: + resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} + engines: {node: '>= 4'} + dependencies: + domelementtype: 2.3.0 + dev: true + + /dompurify@2.4.7: + resolution: {integrity: sha512-kxxKlPEDa6Nc5WJi+qRgPbOAbgTpSULL+vI3NUXsZMlkJxTqYI9wg5ZTay2sFrdZRWHPWNi+EdAhcJf81WtoMQ==} + requiresBuild: true + dev: false + optional: true + + /domutils@3.1.0: + resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==} + dependencies: + dom-serializer: 2.0.0 + domelementtype: 2.3.0 + domhandler: 5.0.3 + dev: true + + /dot-prop@5.3.0: + resolution: {integrity: sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==} + engines: {node: '>=8'} + dependencies: + is-obj: 2.0.0 + dev: true + + /dup@1.0.0: + resolution: {integrity: sha512-Bz5jxMMC0wgp23Zm15ip1x8IhYRqJvF3nFC0UInJUDkN1z4uNPk9jTnfCUJXbOGiQ1JbXLQsiV41Fb+HXcj5BA==} + dev: false + + /earcut@2.2.4: + resolution: {integrity: sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==} + + /eastasianwidth@0.2.0: + resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + dev: true + + /easy-table@1.2.0: + resolution: {integrity: sha512-OFzVOv03YpvtcWGe5AayU5G2hgybsg3iqA6drU8UaoZyB9jLGMTrz9+asnLp/E+6qPh88yEI1gvyZFZ41dmgww==} + dependencies: + ansi-regex: 5.0.1 + optionalDependencies: + wcwidth: 1.0.1 + dev: true + + /electron-to-chromium@1.4.601: + resolution: {integrity: sha512-SpwUMDWe9tQu8JX5QCO1+p/hChAi9AE9UpoC3rcHVc+gdCGlbT3SGb5I1klgb952HRIyvt9wZhSz9bNBYz9swA==} + dev: true + + /emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + dev: true + + /emoji-regex@9.2.2: + resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + dev: true + + /entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + dev: true + + /error-ex@1.3.2: + resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} + dependencies: + is-arrayish: 0.2.1 + dev: true + + /es-abstract@1.22.3: + resolution: {integrity: sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.0 + arraybuffer.prototype.slice: 1.0.2 + available-typed-arrays: 1.0.5 + call-bind: 1.0.5 + es-set-tostringtag: 2.0.2 + es-to-primitive: 1.2.1 + function.prototype.name: 1.1.6 + get-intrinsic: 1.2.2 + get-symbol-description: 1.0.0 + globalthis: 1.0.3 + gopd: 1.0.1 + has-property-descriptors: 1.0.1 + has-proto: 1.0.1 + has-symbols: 1.0.3 + hasown: 2.0.0 + internal-slot: 1.0.6 + is-array-buffer: 3.0.2 + is-callable: 1.2.7 + is-negative-zero: 2.0.2 + is-regex: 1.1.4 + is-shared-array-buffer: 1.0.2 + is-string: 1.0.7 + is-typed-array: 1.1.12 + is-weakref: 1.0.2 + object-inspect: 1.13.1 + object-keys: 1.1.1 + object.assign: 4.1.5 + regexp.prototype.flags: 1.5.1 + safe-array-concat: 1.0.1 + safe-regex-test: 1.0.0 + string.prototype.trim: 1.2.8 + string.prototype.trimend: 1.0.7 + string.prototype.trimstart: 1.0.7 + typed-array-buffer: 1.0.0 + typed-array-byte-length: 1.0.0 + typed-array-byte-offset: 1.0.0 + typed-array-length: 1.0.4 + unbox-primitive: 1.0.2 + which-typed-array: 1.1.13 + dev: true + + /es-iterator-helpers@1.0.15: + resolution: {integrity: sha512-GhoY8uYqd6iwUl2kgjTm4CZAf6oo5mHK7BPqx3rKgx893YSsy0LGHV6gfqqQvZt/8xM8xeOnfXBCfqclMKkJ5g==} + dependencies: + asynciterator.prototype: 1.0.0 + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + es-set-tostringtag: 2.0.2 + function-bind: 1.1.2 + get-intrinsic: 1.2.2 + globalthis: 1.0.3 + has-property-descriptors: 1.0.1 + has-proto: 1.0.1 + has-symbols: 1.0.3 + internal-slot: 1.0.6 + iterator.prototype: 1.1.2 + safe-array-concat: 1.0.1 + dev: true + + /es-set-tostringtag@2.0.2: + resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.2 + has-tostringtag: 1.0.0 + hasown: 2.0.0 + dev: true + + /es-shim-unscopables@1.0.2: + resolution: {integrity: sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==} + dependencies: + hasown: 2.0.0 + dev: true + + /es-to-primitive@1.2.1: + resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} + engines: {node: '>= 0.4'} + dependencies: + is-callable: 1.2.7 + is-date-object: 1.0.5 + is-symbol: 1.0.4 + dev: true + + /es6-promisify@6.1.1: + resolution: {integrity: sha512-HBL8I3mIki5C1Cc9QjKUenHtnG0A5/xA8Q/AllRcfiwl2CZFXGK7ddBiCoRwAix4i2KxcQfjtIVcrVbB3vbmwg==} + dev: false + + /es6-promisify@7.0.0: + resolution: {integrity: sha512-ginqzK3J90Rd4/Yz7qRrqUeIpe3TwSXTPPZtPne7tGBPeAaQiU8qt4fpKApnxHcq1AwtUdHVg5P77x/yrggG8Q==} + engines: {node: '>=6'} + dev: false + + /esbuild@0.12.29: + resolution: {integrity: sha512-w/XuoBCSwepyiZtIRsKsetiLDUVGPVw1E/R3VTFSecIy8UR7Cq3SOtwKHJMFoVqqVG36aGkzh4e8BvpO1Fdc7g==} + hasBin: true + requiresBuild: true + dev: true + + /esbuild@0.18.20: + resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/android-arm': 0.18.20 + '@esbuild/android-arm64': 0.18.20 + '@esbuild/android-x64': 0.18.20 + '@esbuild/darwin-arm64': 0.18.20 + '@esbuild/darwin-x64': 0.18.20 + '@esbuild/freebsd-arm64': 0.18.20 + '@esbuild/freebsd-x64': 0.18.20 + '@esbuild/linux-arm': 0.18.20 + '@esbuild/linux-arm64': 0.18.20 + '@esbuild/linux-ia32': 0.18.20 + '@esbuild/linux-loong64': 0.18.20 + '@esbuild/linux-mips64el': 0.18.20 + '@esbuild/linux-ppc64': 0.18.20 + '@esbuild/linux-riscv64': 0.18.20 + '@esbuild/linux-s390x': 0.18.20 + '@esbuild/linux-x64': 0.18.20 + '@esbuild/netbsd-x64': 0.18.20 + '@esbuild/openbsd-x64': 0.18.20 + '@esbuild/sunos-x64': 0.18.20 + '@esbuild/win32-arm64': 0.18.20 + '@esbuild/win32-ia32': 0.18.20 + '@esbuild/win32-x64': 0.18.20 + dev: true + + /escalade@3.1.1: + resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} + engines: {node: '>=6'} + dev: true + + /escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + dev: true + + /escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + dev: true + + /escodegen@2.1.0: + resolution: {integrity: sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==} + engines: {node: '>=6.0'} + hasBin: true + dependencies: + esprima: 4.0.1 + estraverse: 5.3.0 + esutils: 2.0.3 + optionalDependencies: + source-map: 0.6.1 + dev: true + + /eslint-config-prettier@8.10.0(eslint@8.19.0): + resolution: {integrity: sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + dependencies: + eslint: 8.19.0 + dev: true + + /eslint-plugin-jsx-a11y@6.7.1(eslint@8.19.0): + resolution: {integrity: sha512-63Bog4iIethyo8smBklORknVjB0T2dwB8Mr/hIC+fBS0uyHdYYpzM/Ed+YC8VxTjlXHEWFOdmgwcDn1U2L9VCA==} + engines: {node: '>=4.0'} + peerDependencies: + eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 + dependencies: + '@babel/runtime': 7.23.5 + aria-query: 5.3.0 + array-includes: 3.1.7 + array.prototype.flatmap: 1.3.2 + ast-types-flow: 0.0.7 + axe-core: 4.7.0 + axobject-query: 3.2.1 + damerau-levenshtein: 1.0.8 + emoji-regex: 9.2.2 + eslint: 8.19.0 + has: 1.0.4 + jsx-ast-utils: 3.3.5 + language-tags: 1.0.5 + minimatch: 3.1.2 + object.entries: 1.1.7 + object.fromentries: 2.0.7 + semver: 6.3.1 + dev: true + + /eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0)(eslint@8.19.0)(prettier@2.8.8): + resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} + engines: {node: '>=12.0.0'} + peerDependencies: + eslint: '>=7.28.0' + eslint-config-prettier: '*' + prettier: '>=2.0.0' + peerDependenciesMeta: + eslint-config-prettier: + optional: true + dependencies: + eslint: 8.19.0 + eslint-config-prettier: 8.10.0(eslint@8.19.0) + prettier: 2.8.8 + prettier-linter-helpers: 1.0.0 + dev: true + + /eslint-plugin-react@7.33.2(eslint@8.19.0): + resolution: {integrity: sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw==} + engines: {node: '>=4'} + peerDependencies: + eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 + dependencies: + array-includes: 3.1.7 + array.prototype.flatmap: 1.3.2 + array.prototype.tosorted: 1.1.2 + doctrine: 2.1.0 + es-iterator-helpers: 1.0.15 + eslint: 8.19.0 + estraverse: 5.3.0 + jsx-ast-utils: 3.3.5 + minimatch: 3.1.2 + object.entries: 1.1.7 + object.fromentries: 2.0.7 + object.hasown: 1.1.3 + object.values: 1.1.7 + prop-types: 15.8.1 + resolve: 2.0.0-next.5 + semver: 6.3.1 + string.prototype.matchall: 4.0.10 + dev: true + + /eslint-scope@5.1.1: + resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} + engines: {node: '>=8.0.0'} + dependencies: + esrecurse: 4.3.0 + estraverse: 4.3.0 + dev: true + + /eslint-scope@7.2.2: + resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + esrecurse: 4.3.0 + estraverse: 5.3.0 + dev: true + + /eslint-utils@3.0.0(eslint@8.19.0): + resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} + engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} + peerDependencies: + eslint: '>=5' + dependencies: + eslint: 8.19.0 + eslint-visitor-keys: 2.1.0 + dev: true + + /eslint-visitor-keys@2.1.0: + resolution: {integrity: sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==} + engines: {node: '>=10'} + dev: true + + /eslint-visitor-keys@3.4.3: + resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + + /eslint@8.19.0: + resolution: {integrity: sha512-SXOPj3x9VKvPe81TjjUJCYlV4oJjQw68Uek+AM0X4p+33dj2HY5bpTZOgnQHcG2eAm1mtCU9uNMnJi7exU/kYw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + hasBin: true + dependencies: + '@eslint/eslintrc': 1.4.1 + '@humanwhocodes/config-array': 0.9.5 + ajv: 6.12.6 + chalk: 4.1.2 + cross-spawn: 7.0.3 + debug: 4.3.4 + doctrine: 3.0.0 + escape-string-regexp: 4.0.0 + eslint-scope: 7.2.2 + eslint-utils: 3.0.0(eslint@8.19.0) + eslint-visitor-keys: 3.4.3 + espree: 9.6.1 + esquery: 1.5.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 6.0.1 + functional-red-black-tree: 1.0.1 + glob-parent: 6.0.2 + globals: 13.23.0 + ignore: 5.3.0 + import-fresh: 3.3.0 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + js-yaml: 4.1.0 + json-stable-stringify-without-jsonify: 1.0.1 + levn: 0.4.1 + lodash.merge: 4.6.2 + minimatch: 3.1.2 + natural-compare: 1.4.0 + optionator: 0.9.3 + regexpp: 3.2.0 + strip-ansi: 6.0.1 + strip-json-comments: 3.1.1 + text-table: 0.2.0 + v8-compile-cache: 2.4.0 + transitivePeerDependencies: + - supports-color + dev: true + + /esm@3.2.25: + resolution: {integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==} + engines: {node: '>=6'} + requiresBuild: true + dev: false + optional: true + + /espree@9.6.1: + resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + acorn: 8.11.2 + acorn-jsx: 5.3.2(acorn@8.11.2) + eslint-visitor-keys: 3.4.3 + dev: true + + /esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + dev: true + + /esquery@1.5.0: + resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==} + engines: {node: '>=0.10'} + dependencies: + estraverse: 5.3.0 + dev: true + + /esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + dependencies: + estraverse: 5.3.0 + dev: true + + /estraverse@4.3.0: + resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} + engines: {node: '>=4.0'} + dev: true + + /estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + dev: true + + /esutils@2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + dev: true + + /eventemitter3@3.1.2: + resolution: {integrity: sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==} + + /eventemitter3@5.0.1: + resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + dev: false + + /events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + dev: false + + /extend@3.0.2: + resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} + dev: true + + /fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + /fast-diff@1.3.0: + resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} + dev: true + + /fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} + engines: {node: '>=8.6.0'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.5 + dev: true + + /fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + + /fast-levenshtein@2.0.6: + resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + dev: true + + /fastq@1.15.0: + resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} + dependencies: + reusify: 1.0.4 + dev: true + + /fetch-jsonp@1.3.0: + resolution: {integrity: sha512-hxCYGvmANEmpkHpeWY8Kawfa5Z1t2csTpIClIDG/0S92eALWHRU1RnGaj86Tf5Cc0QF+afSa4SQ4pFB2rFM5QA==} + dev: true + + /fflate@0.4.8: + resolution: {integrity: sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==} + dev: false + + /fflate@0.7.4: + resolution: {integrity: sha512-5u2V/CDW15QM1XbbgS+0DfPxVB+jUKhWEKuuFuHncbk3tEEqzmoXL+2KyOFuKGqOnmdIy0/davWF1CkuwtibCw==} + dev: false + + /file-entry-cache@6.0.1: + resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} + engines: {node: ^10.12.0 || >=12.0.0} + dependencies: + flat-cache: 3.2.0 + dev: true + + /fill-range@7.0.1: + resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} + engines: {node: '>=8'} + dependencies: + to-regex-range: 5.0.1 + dev: true + + /filter-iterator@0.0.1: + resolution: {integrity: sha512-v4lhL7Qa8XpbW3LN46CEnmhGk3eHZwxfNl5at20aEkreesht4YKb/Ba3BUIbnPhAC/r3dmu7ABaGk6MAvh2alA==} + dev: true + + /filter-obj@1.1.0: + resolution: {integrity: sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ==} + engines: {node: '>=0.10.0'} + dev: true + + /find-up@2.1.0: + resolution: {integrity: sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==} + engines: {node: '>=4'} + dependencies: + locate-path: 2.0.0 + dev: true + + /find-up@4.1.0: + resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} + engines: {node: '>=8'} + dependencies: + locate-path: 5.0.0 + path-exists: 4.0.0 + dev: true + + /find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} + dependencies: + locate-path: 6.0.0 + path-exists: 4.0.0 + dev: true + + /flat-cache@3.2.0: + resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} + engines: {node: ^10.12.0 || >=12.0.0} + dependencies: + flatted: 3.2.9 + keyv: 4.5.4 + rimraf: 3.0.2 + dev: true + + /flatted@3.2.9: + resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==} + dev: true + + /for-each@0.3.3: + resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + dependencies: + is-callable: 1.2.7 + dev: true + + /foreground-child@2.0.0: + resolution: {integrity: sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==} + engines: {node: '>=8.0.0'} + dependencies: + cross-spawn: 7.0.3 + signal-exit: 3.0.7 + dev: true + + /foreground-child@3.1.1: + resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} + engines: {node: '>=14'} + dependencies: + cross-spawn: 7.0.3 + signal-exit: 4.1.0 + dev: true + + /form-data@4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + engines: {node: '>= 6'} + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.35 + dev: true + + /fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + dev: true + + /fsevents@2.3.2: + resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + /function.prototype.name@1.1.6: + resolution: {integrity: sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + functions-have-names: 1.2.3 + dev: true + + /functional-red-black-tree@1.0.1: + resolution: {integrity: sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==} + dev: true + + /functions-have-names@1.2.3: + resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} + dev: true + + /genbank-parser@1.2.4: + resolution: {integrity: sha512-r3pTgKHZx/rol90v2cezrNhfMhq3yHWCnBYyETNIJkvnJk+cwx/D/ZVgAy1SX8zwtnfvYQmFbqlpbh2f4t0h2w==} + dev: false + + /generic-filehandle@3.1.1: + resolution: {integrity: sha512-8fLkHgbnKlOWhJgPmvGm+0HclUkyCPM0WGZQOAWdebNsWbHZJi7pW/RAPp26fhqlVpgT5tHqVKWunf/r+HRoEw==} + engines: {node: '>=12'} + dependencies: + es6-promisify: 6.1.1 + dev: false + + /gensync@1.0.0-beta.2: + resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} + engines: {node: '>=6.9.0'} + dev: true + + /get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + dev: true + + /get-func-name@2.0.2: + resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} + dev: true + + /get-intrinsic@1.2.2: + resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} + dependencies: + function-bind: 1.1.2 + has-proto: 1.0.1 + has-symbols: 1.0.3 + hasown: 2.0.0 + + /get-pkg-repo@4.2.1: + resolution: {integrity: sha512-2+QbHjFRfGB74v/pYWjd5OhU3TDIC2Gv/YKUTk/tCvAz0pkn/Mz6P3uByuBimLOcPvN2jYdScl3xGFSrx0jEcA==} + engines: {node: '>=6.9.0'} + hasBin: true + dependencies: + '@hutson/parse-repository-url': 3.0.2 + hosted-git-info: 4.1.0 + through2: 2.0.5 + yargs: 16.2.0 + dev: true + + /get-symbol-description@1.0.0: + resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + dev: true + + /git-raw-commits@2.0.11: + resolution: {integrity: sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A==} + engines: {node: '>=10'} + hasBin: true + dependencies: + dargs: 7.0.0 + lodash: 4.17.21 + meow: 8.1.2 + split2: 3.2.2 + through2: 4.0.2 + dev: true + + /git-remote-origin-url@2.0.0: + resolution: {integrity: sha512-eU+GGrZgccNJcsDH5LkXR3PB9M958hxc7sbA8DFJjrv9j4L2P/eZfKhM+QD6wyzpiv+b1BpK0XrYCxkovtjSLw==} + engines: {node: '>=4'} + dependencies: + gitconfiglocal: 1.0.0 + pify: 2.3.0 + dev: true + + /git-semver-tags@4.1.1: + resolution: {integrity: sha512-OWyMt5zBe7xFs8vglMmhM9lRQzCWL3WjHtxNNfJTMngGym7pC1kh8sP6jevfydJ6LP3ZvGxfb6ABYgPUM0mtsA==} + engines: {node: '>=10'} + hasBin: true + dependencies: + meow: 8.1.2 + semver: 6.3.1 + dev: true + + /gitconfiglocal@1.0.0: + resolution: {integrity: sha512-spLUXeTAVHxDtKsJc8FkFVgFtMdEN9qPGpL23VfSHx4fP4+Ds097IXLvymbnDH8FnmxX5Nr9bPw3A+AQ6mWEaQ==} + dependencies: + ini: 1.3.8 + dev: true + + /glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + dependencies: + is-glob: 4.0.3 + dev: true + + /glob-parent@6.0.2: + resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} + engines: {node: '>=10.13.0'} + dependencies: + is-glob: 4.0.3 + dev: true + + /glob@10.3.10: + resolution: {integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==} + engines: {node: '>=16 || 14 >=14.17'} + hasBin: true + dependencies: + foreground-child: 3.1.1 + jackspeak: 2.3.6 + minimatch: 9.0.3 + minipass: 7.0.4 + path-scurry: 1.10.1 + dev: true + + /glob@7.2.3: + resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: true + + /globals@11.12.0: + resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} + engines: {node: '>=4'} + dev: true + + /globals@13.23.0: + resolution: {integrity: sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==} + engines: {node: '>=8'} + dependencies: + type-fest: 0.20.2 + dev: true + + /globalthis@1.0.3: + resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==} + engines: {node: '>= 0.4'} + dependencies: + define-properties: 1.2.1 + dev: true + + /globby@11.1.0: + resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} + engines: {node: '>=10'} + dependencies: + array-union: 2.1.0 + dir-glob: 3.0.1 + fast-glob: 3.3.2 + ignore: 5.3.0 + merge2: 1.4.1 + slash: 3.0.0 + dev: true + + /globby@13.2.2: + resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + dir-glob: 3.0.1 + fast-glob: 3.3.2 + ignore: 5.3.0 + merge2: 1.4.1 + slash: 4.0.0 + dev: true + + /gopd@1.0.1: + resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} + dependencies: + get-intrinsic: 1.2.2 + + /graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + dev: true + + /graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + dev: true + + /handlebars@4.7.8: + resolution: {integrity: sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==} + engines: {node: '>=0.4.7'} + hasBin: true + dependencies: + minimist: 1.2.8 + neo-async: 2.6.2 + source-map: 0.6.1 + wordwrap: 1.0.0 + optionalDependencies: + uglify-js: 3.17.4 + dev: true + + /hard-rejection@2.1.0: + resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==} + engines: {node: '>=6'} + dev: true + + /has-bigints@1.0.2: + resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} + dev: true + + /has-flag@3.0.0: + resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} + engines: {node: '>=4'} + dev: true + + /has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + dev: true + + /has-own-property@0.1.0: + resolution: {integrity: sha512-14qdBKoonU99XDhWcFKZTShK+QV47qU97u8zzoVo9cL5TZ3BmBHXogItSt9qJjR0KUMFRhcCW8uGIGl8nkl7Aw==} + dev: true + + /has-property-descriptors@1.0.1: + resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} + dependencies: + get-intrinsic: 1.2.2 + + /has-proto@1.0.1: + resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} + engines: {node: '>= 0.4'} + + /has-symbols@1.0.3: + resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} + engines: {node: '>= 0.4'} + + /has-tostringtag@1.0.0: + resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} + engines: {node: '>= 0.4'} + dependencies: + has-symbols: 1.0.3 + dev: true + + /has@1.0.4: + resolution: {integrity: sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==} + engines: {node: '>= 0.4.0'} + dev: true + + /hasown@2.0.0: + resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} + engines: {node: '>= 0.4'} + dependencies: + function-bind: 1.1.2 + + /higlass-register@0.3.0: + resolution: {integrity: sha512-D4I+ATxFuTn+Q6p8Y9rUa+X3b3cqMqhu9Tya6uHtvgV5cs39Mk7i6Z+7PMA8YuwQd5gLMSxCm2lCyWmxRVBQsQ==} + dev: false + + /higlass-text@0.1.6: + resolution: {integrity: sha512-sjAROJfE38bSP72XncPTBV4AeYRs50N85OqRXooEwXF5zKVssBv1EKrvls0ralnSQ1aZX74cB/hTskbI91iRng==} + dependencies: + d3-color: 3.1.0 + d3-scale: 4.0.2 + higlass-register: 0.3.0 + slugid: 3.2.0 + dev: false + + /higlass@1.13.3(pixi.js@6.5.10)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-aZ+Q+ClF1TTeV81ChuGSd5CHiVJf8+1c6w6/sXGAOonkGVQ54yuZpSYafMatKAjytM6/fwSaHs3uQT2xUEE2MA==} + engines: {node: '>=0.12.0'} + peerDependencies: + pixi.js: ^5.0.3 || ^6.5.2 + react: ^16.6.3 || ^17.0.0 || ^18.0.0 + react-dom: ^16.6.3 || ^17.0.0 || ^18.0.0 + dependencies: + ajv: 6.12.6 + box-intersect: 1.0.2 + buffer: 6.0.3 + clsx: 1.2.1 + css-element-queries: 1.2.3 + d3-array: 2.12.1 + d3-axis: 2.1.0 + d3-brush: 2.1.0 + d3-color: 2.0.0 + d3-drag: 2.0.0 + d3-dsv: 2.0.0 + d3-format: 2.0.0 + d3-geo: 2.0.2 + d3-queue: 3.0.7 + d3-request: 1.0.6 + d3-scale: 4.0.2 + d3-selection: 2.0.0 + d3-transition: 3.0.1(d3-selection@2.0.0) + d3-zoom: 3.0.0 + dom-scroll-into-view: 1.2.1 + genbank-parser: 1.2.4 + ndarray: 1.0.19 + pako: 1.0.11 + pixi.js: 6.5.10 + prismjs: 1.29.0 + prop-types: 15.8.1 + pub-sub-es: 2.1.1 + react: 18.2.0 + react-checkbox-tree: 1.8.0(react@18.2.0) + react-color: 2.19.3(react@18.2.0) + react-dom: 18.2.0(react@18.2.0) + react-grid-layout: 0.16.6(react-dom@18.2.0)(react@18.2.0) + react-simple-code-editor: 0.9.15(react-dom@18.2.0)(react@18.2.0) + react-sortable-hoc: 1.11.0(prop-types@15.8.1)(react-dom@18.2.0)(react@18.2.0) + reactcss: 1.2.3(react@18.2.0) + robust-point-in-polygon: 1.0.3 + slugid: 3.2.0 + url-parse: 1.5.10 + vkbeautify: 0.99.3 + dev: false + + /history@4.10.1: + resolution: {integrity: sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==} + dependencies: + '@babel/runtime': 7.23.5 + loose-envify: 1.4.0 + resolve-pathname: 3.0.0 + tiny-invariant: 1.3.1 + tiny-warning: 1.0.3 + value-equal: 1.0.1 + dev: true + + /hoist-non-react-statics@3.3.2: + resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==} + dependencies: + react-is: 16.13.1 + dev: true + + /hosted-git-info@2.8.9: + resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} + dev: true + + /hosted-git-info@4.1.0: + resolution: {integrity: sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==} + engines: {node: '>=10'} + dependencies: + lru-cache: 6.0.0 + dev: true + + /html-encoding-sniffer@3.0.0: + resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==} + engines: {node: '>=12'} + dependencies: + whatwg-encoding: 2.0.0 + dev: true + + /html-escaper@2.0.2: + resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} + dev: true + + /html-to-react@1.7.0(react@18.2.0): + resolution: {integrity: sha512-b5HTNaTGyOj5GGIMiWVr1k57egAZ/vGy0GGefnCQ1VW5hu9+eku8AXHtf2/DeD95cj/FKBKYa1J7SWBOX41yUQ==} + peerDependencies: + react: ^0.13.0 || ^0.14.0 || >=15 + dependencies: + domhandler: 5.0.3 + htmlparser2: 9.0.0 + lodash.camelcase: 4.3.0 + react: 18.2.0 + dev: true + + /html2canvas@1.4.1: + resolution: {integrity: sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==} + engines: {node: '>=8.0.0'} + requiresBuild: true + dependencies: + css-line-break: 2.1.0 + text-segmentation: 1.0.3 + dev: false + optional: true + + /htmlparser2@9.0.0: + resolution: {integrity: sha512-uxbSI98wmFT/G4P2zXx4OVx04qWUmyFPrD2/CNepa2Zo3GPNaCaaxElDgwUrwYWkK1nr9fft0Ya8dws8coDLLQ==} + dependencies: + domelementtype: 2.3.0 + domhandler: 5.0.3 + domutils: 3.1.0 + entities: 4.5.0 + dev: true + + /http-proxy-agent@5.0.0: + resolution: {integrity: sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==} + engines: {node: '>= 6'} + dependencies: + '@tootallnate/once': 2.0.0 + agent-base: 6.0.2 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + + /https-proxy-agent@5.0.1: + resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} + engines: {node: '>= 6'} + dependencies: + agent-base: 6.0.2 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + + /iconv-lite@0.4.24: + resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} + engines: {node: '>=0.10.0'} + dependencies: + safer-buffer: 2.1.2 + dev: false + + /iconv-lite@0.6.3: + resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} + engines: {node: '>=0.10.0'} + dependencies: + safer-buffer: 2.1.2 + dev: true + + /identity-function@1.0.0: + resolution: {integrity: sha512-kNrgUK0qI+9qLTBidsH85HjDLpZfrrS0ElquKKe/fJFdB3D7VeKdXXEvOPDUHSHOzdZKCAAaQIWWyp0l2yq6pw==} + dev: true + + /ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + dev: false + + /ignore@5.3.0: + resolution: {integrity: sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==} + engines: {node: '>= 4'} + dev: true + + /import-fresh@3.3.0: + resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} + engines: {node: '>=6'} + dependencies: + parent-module: 1.0.1 + resolve-from: 4.0.0 + dev: true + + /imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + dev: true + + /indent-string@4.0.0: + resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} + engines: {node: '>=8'} + dev: true + + /inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + dev: true + + /inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + /ini@1.3.8: + resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} + dev: true + + /internal-slot@1.0.6: + resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.2 + hasown: 2.0.0 + side-channel: 1.0.4 + dev: true + + /internmap@1.0.1: + resolution: {integrity: sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==} + dev: false + + /invariant@2.2.4: + resolution: {integrity: sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==} + dependencies: + loose-envify: 1.4.0 + dev: false + + /iota-array@1.0.0: + resolution: {integrity: sha512-pZ2xT+LOHckCatGQ3DcG/a+QuEqvoxqkiL7tvE8nn3uuu+f6i1TtpB5/FtWFbxUuVr5PZCx8KskuGatbJDXOWA==} + dev: false + + /is-alphabetical@1.0.4: + resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==} + dev: true + + /is-alphanumerical@1.0.4: + resolution: {integrity: sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==} + dependencies: + is-alphabetical: 1.0.4 + is-decimal: 1.0.4 + dev: true + + /is-array-buffer@3.0.2: + resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + is-typed-array: 1.1.12 + dev: true + + /is-arrayish@0.2.1: + resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} + dev: true + + /is-async-function@2.0.0: + resolution: {integrity: sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==} + engines: {node: '>= 0.4'} + dependencies: + has-tostringtag: 1.0.0 + dev: true + + /is-bigint@1.0.4: + resolution: {integrity: sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==} + dependencies: + has-bigints: 1.0.2 + dev: true + + /is-boolean-object@1.1.2: + resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + has-tostringtag: 1.0.0 + dev: true + + /is-buffer@1.1.6: + resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==} + dev: false + + /is-buffer@2.0.5: + resolution: {integrity: sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==} + engines: {node: '>=4'} + dev: true + + /is-callable@1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + dev: true + + /is-core-module@2.13.1: + resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} + dependencies: + hasown: 2.0.0 + dev: true + + /is-date-object@1.0.5: + resolution: {integrity: sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==} + engines: {node: '>= 0.4'} + dependencies: + has-tostringtag: 1.0.0 + dev: true + + /is-decimal@1.0.4: + resolution: {integrity: sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==} + dev: true + + /is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + dev: true + + /is-finalizationregistry@1.0.2: + resolution: {integrity: sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==} + dependencies: + call-bind: 1.0.5 + dev: true + + /is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + dev: true + + /is-generator-function@1.0.10: + resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} + engines: {node: '>= 0.4'} + dependencies: + has-tostringtag: 1.0.0 + dev: true + + /is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + dependencies: + is-extglob: 2.1.1 + dev: true + + /is-hexadecimal@1.0.4: + resolution: {integrity: sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==} + dev: true + + /is-iterable@1.1.1: + resolution: {integrity: sha512-EdOZCr0NsGE00Pot+x1ZFx9MJK3C6wy91geZpXwvwexDLJvA4nzYyZf7r+EIwSeVsOLDdBz7ATg9NqKTzuNYuQ==} + engines: {node: '>= 4'} + dev: true + + /is-map@2.0.2: + resolution: {integrity: sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==} + dev: true + + /is-negative-zero@2.0.2: + resolution: {integrity: sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==} + engines: {node: '>= 0.4'} + dev: true + + /is-number-object@1.0.7: + resolution: {integrity: sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==} + engines: {node: '>= 0.4'} + dependencies: + has-tostringtag: 1.0.0 + dev: true + + /is-number@4.0.0: + resolution: {integrity: sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==} + engines: {node: '>=0.10.0'} + dev: true + + /is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + dev: true + + /is-obj@2.0.0: + resolution: {integrity: sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==} + engines: {node: '>=8'} + dev: true + + /is-observable@2.1.0: + resolution: {integrity: sha512-DailKdLb0WU+xX8K5w7VsJhapwHLZ9jjmazqCJq4X12CTgqq73TKnbRcnSLuXYPOoLQgV5IrD7ePiX/h1vnkBw==} + engines: {node: '>=8'} + dev: false + + /is-plain-obj@1.1.0: + resolution: {integrity: sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==} + engines: {node: '>=0.10.0'} + dev: true + + /is-plain-obj@2.1.0: + resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} + engines: {node: '>=8'} + dev: true + + /is-potential-custom-element-name@1.0.1: + resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + dev: true + + /is-regex@1.1.4: + resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + has-tostringtag: 1.0.0 + dev: true + + /is-set@2.0.2: + resolution: {integrity: sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==} + dev: true + + /is-shared-array-buffer@1.0.2: + resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} + dependencies: + call-bind: 1.0.5 + dev: true + + /is-string@1.0.7: + resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} + engines: {node: '>= 0.4'} + dependencies: + has-tostringtag: 1.0.0 + dev: true + + /is-symbol@1.0.4: + resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} + engines: {node: '>= 0.4'} + dependencies: + has-symbols: 1.0.3 + dev: true + + /is-text-path@1.0.1: + resolution: {integrity: sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w==} + engines: {node: '>=0.10.0'} + dependencies: + text-extensions: 1.9.0 + dev: true + + /is-typed-array@1.1.12: + resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} + engines: {node: '>= 0.4'} + dependencies: + which-typed-array: 1.1.13 + dev: true + + /is-weakmap@2.0.1: + resolution: {integrity: sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==} + dev: true + + /is-weakref@1.0.2: + resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} + dependencies: + call-bind: 1.0.5 + dev: true + + /is-weakset@2.0.2: + resolution: {integrity: sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + dev: true + + /isarray@0.0.1: + resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==} + dev: true + + /isarray@1.0.0: + resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} + dev: true + + /isarray@2.0.5: + resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} + dev: true + + /isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + dev: true + + /istanbul-lib-coverage@3.2.2: + resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} + engines: {node: '>=8'} + dev: true + + /istanbul-lib-report@3.0.1: + resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} + engines: {node: '>=10'} + dependencies: + istanbul-lib-coverage: 3.2.2 + make-dir: 4.0.0 + supports-color: 7.2.0 + dev: true + + /istanbul-lib-source-maps@4.0.1: + resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} + engines: {node: '>=10'} + dependencies: + debug: 4.3.4 + istanbul-lib-coverage: 3.2.2 + source-map: 0.6.1 + transitivePeerDependencies: + - supports-color + dev: true + + /istanbul-reports@3.1.6: + resolution: {integrity: sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==} + engines: {node: '>=8'} + dependencies: + html-escaper: 2.0.2 + istanbul-lib-report: 3.0.1 + dev: true + + /iterable-lookahead@1.0.0: + resolution: {integrity: sha512-hJnEP2Xk4+44DDwJqUQGdXal5VbyeWLaPyDl2AQc242Zr7iqz4DgpQOrEzglWVMGHMDCkguLHEKxd1+rOsmgSQ==} + engines: {node: '>=4'} + dev: true + + /iterator.prototype@1.1.2: + resolution: {integrity: sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==} + dependencies: + define-properties: 1.2.1 + get-intrinsic: 1.2.2 + has-symbols: 1.0.3 + reflect.getprototypeof: 1.0.4 + set-function-name: 2.0.1 + dev: true + + /jackspeak@2.3.6: + resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} + engines: {node: '>=14'} + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + dev: true + + /jest-canvas-mock@2.5.2: + resolution: {integrity: sha512-vgnpPupjOL6+L5oJXzxTxFrlGEIbHdZqFU+LFNdtLxZ3lRDCl17FlTMM7IatoRQkrcyOTMlDinjUguqmQ6bR2A==} + dependencies: + cssfontparser: 1.2.1 + moo-color: 1.0.3 + dev: true + + /jiti@1.21.0: + resolution: {integrity: sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==} + hasBin: true + dev: true + + /js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + + /js-yaml@4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true + dependencies: + argparse: 2.0.1 + dev: true + + /jsdom@19.0.0: + resolution: {integrity: sha512-RYAyjCbxy/vri/CfnjUWJQQtZ3LKlLnDqj+9XLNnJPgEGeirZs3hllKR20re8LUZ6o1b1X4Jat+Qd26zmP41+A==} + engines: {node: '>=12'} + peerDependencies: + canvas: ^2.5.0 + peerDependenciesMeta: + canvas: + optional: true + dependencies: + abab: 2.0.6 + acorn: 8.11.2 + acorn-globals: 6.0.0 + cssom: 0.5.0 + cssstyle: 2.3.0 + data-urls: 3.0.2 + decimal.js: 10.4.3 + domexception: 4.0.0 + escodegen: 2.1.0 + form-data: 4.0.0 + html-encoding-sniffer: 3.0.0 + http-proxy-agent: 5.0.0 + https-proxy-agent: 5.0.1 + is-potential-custom-element-name: 1.0.1 + nwsapi: 2.2.7 + parse5: 6.0.1 + saxes: 5.0.1 + symbol-tree: 3.2.4 + tough-cookie: 4.1.3 + w3c-hr-time: 1.0.2 + w3c-xmlserializer: 3.0.0 + webidl-conversions: 7.0.0 + whatwg-encoding: 2.0.0 + whatwg-mimetype: 3.0.0 + whatwg-url: 10.0.0 + ws: 8.14.2 + xml-name-validator: 4.0.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + dev: true + + /jsesc@2.5.2: + resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} + engines: {node: '>=4'} + hasBin: true + dev: true + + /json-buffer@3.0.1: + resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} + dev: true + + /json-parse-better-errors@1.0.2: + resolution: {integrity: sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==} + dev: true + + /json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + dev: true + + /json-parse-even-better-errors@3.0.1: + resolution: {integrity: sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + dev: true + + /json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + + /json-stable-stringify-without-jsonify@1.0.1: + resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + dev: true + + /json-stringify-pretty-compact@2.0.0: + resolution: {integrity: sha512-WRitRfs6BGq4q8gTgOy4ek7iPFXjbra0H3PmDLKm2xnZ+Gh1HUhiKGgCZkSPNULlP7mvfu6FV/mOLhCarspADQ==} + dev: false + + /json-stringify-safe@5.0.1: + resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} + dev: true + + /json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + dev: true + + /jsonc-parser@3.2.0: + resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==} + dev: true + + /jsoncrush@1.1.8: + resolution: {integrity: sha512-lvIMGzMUA0fjuqwNcxlTNRq2bibPZ9auqT/LyGdlR5hvydJtA/BasSgkx4qclqTKVeTidrJvsS/oVjlTCPQ4Nw==} + dev: true + + /jsonparse@1.3.1: + resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} + engines: {'0': node >= 0.2.0} + dev: true + + /jspdf@2.5.1: + resolution: {integrity: sha512-hXObxz7ZqoyhxET78+XR34Xu2qFGrJJ2I2bE5w4SM8eFaFEkW2xcGRVUss360fYelwRSid/jT078kbNvmoW0QA==} + dependencies: + '@babel/runtime': 7.23.5 + atob: 2.1.2 + btoa: 1.2.1 + fflate: 0.4.8 + optionalDependencies: + canvg: 3.0.10 + core-js: 3.33.3 + dompurify: 2.4.7 + html2canvas: 1.4.1 + dev: false + + /jsx-ast-utils@3.3.5: + resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==} + engines: {node: '>=4.0'} + dependencies: + array-includes: 3.1.7 + array.prototype.flat: 1.3.2 + object.assign: 4.1.5 + object.values: 1.1.7 + dev: true + + /keyv@4.5.4: + resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + dependencies: + json-buffer: 3.0.1 + dev: true + + /kind-of@6.0.3: + resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} + engines: {node: '>=0.10.0'} + dev: true + + /knip@2.30.0: + resolution: {integrity: sha512-tMdBoe7pLMXDSZtQ/wlxbsNG6m4jWu5JmNBvuecJJtnEk+sIp3FNeonZgx6hnPHpORwMGEqEDtSNT2r92MH8Bw==} + engines: {node: '>=16.17.0 <17 || >=18.6.0'} + hasBin: true + dependencies: + '@ericcornelissen/bash-parser': 0.5.2 + '@npmcli/map-workspaces': 3.0.4 + '@snyk/github-codeowners': 1.1.0 + chalk: 5.3.0 + easy-table: 1.2.0 + fast-glob: 3.3.2 + globby: 13.2.2 + jiti: 1.21.0 + js-yaml: 4.1.0 + micromatch: 4.0.5 + minimist: 1.2.8 + pretty-ms: 8.0.0 + strip-json-comments: 5.0.1 + summary: 2.1.0 + typescript: 5.0.2 + zod: 3.22.4 + zod-validation-error: 1.5.0(zod@3.22.4) + dev: true + + /language-subtag-registry@0.3.22: + resolution: {integrity: sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w==} + dev: true + + /language-tags@1.0.5: + resolution: {integrity: sha512-qJhlO9cGXi6hBGKoxEG/sKZDAHD5Hnu9Hs4WbOY3pCWXDhw0N8x1NenNzm2EnNLkLkk7J2SdxAkDSbb6ftT+UQ==} + dependencies: + language-subtag-registry: 0.3.22 + dev: true + + /levn@0.4.1: + resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} + engines: {node: '>= 0.8.0'} + dependencies: + prelude-ls: 1.2.1 + type-check: 0.4.0 + dev: true + + /lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + dev: true + + /load-json-file@4.0.0: + resolution: {integrity: sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==} + engines: {node: '>=4'} + dependencies: + graceful-fs: 4.2.11 + parse-json: 4.0.0 + pify: 3.0.0 + strip-bom: 3.0.0 + dev: true + + /local-pkg@0.4.3: + resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} + engines: {node: '>=14'} + dev: true + + /locate-path@2.0.0: + resolution: {integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==} + engines: {node: '>=4'} + dependencies: + p-locate: 2.0.0 + path-exists: 3.0.0 + dev: true + + /locate-path@5.0.0: + resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} + engines: {node: '>=8'} + dependencies: + p-locate: 4.1.0 + dev: true + + /locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} + dependencies: + p-locate: 5.0.0 + dev: true + + /lodash-es@4.17.21: + resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} + + /lodash.camelcase@4.3.0: + resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} + dev: true + + /lodash.clamp@4.0.3: + resolution: {integrity: sha512-HvzRFWjtcguTW7yd8NJBshuNaCa8aqNFtnswdT7f/cMd/1YKy5Zzoq4W/Oxvnx9l7aeY258uSdDfM793+eLsVg==} + dev: false + + /lodash.curry@4.1.1: + resolution: {integrity: sha512-/u14pXGviLaweY5JI0IUzgzF2J6Ne8INyzAZjImcryjgkZ+ebruBxy2/JaOOkTqScddcYtakjhSaeemV8lR0tA==} + dev: true + + /lodash.debounce@4.0.8: + resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} + dev: false + + /lodash.isequal@4.5.0: + resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} + dev: false + + /lodash.ismatch@4.4.0: + resolution: {integrity: sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==} + dev: true + + /lodash.merge@4.6.2: + resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} + dev: true + + /lodash@4.17.21: + resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + + /long@4.0.0: + resolution: {integrity: sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==} + dev: false + + /longest-streak@2.0.4: + resolution: {integrity: sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==} + dev: true + + /loose-envify@1.4.0: + resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} + hasBin: true + dependencies: + js-tokens: 4.0.0 + + /loupe@2.3.7: + resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + dependencies: + get-func-name: 2.0.2 + dev: true + + /lru-cache@10.1.0: + resolution: {integrity: sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==} + engines: {node: 14 || >=16.14} + dev: true + + /lru-cache@5.1.1: + resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + dependencies: + yallist: 3.1.1 + dev: true + + /lru-cache@6.0.0: + resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} + engines: {node: '>=10'} + dependencies: + yallist: 4.0.0 + dev: true + + /magic-string@0.16.0: + resolution: {integrity: sha512-c4BEos3y6G2qO0B9X7K0FVLOPT9uGrjYwYRLFmDqyl5YMboUviyecnXWp94fJTSMwPw2/sf+CEYt5AGpmklkkQ==} + dependencies: + vlq: 0.2.3 + dev: true + + /magic-string@0.30.5: + resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + + /make-dir@4.0.0: + resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} + engines: {node: '>=10'} + dependencies: + semver: 7.5.4 + dev: true + + /map-obj@1.0.1: + resolution: {integrity: sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==} + engines: {node: '>=0.10.0'} + dev: true + + /map-obj@2.0.0: + resolution: {integrity: sha512-TzQSV2DiMYgoF5RycneKVUzIa9bQsj/B3tTgsE3dOGqlzHnGIDaC7XBE7grnA+8kZPnfqSGFe95VHc2oc0VFUQ==} + engines: {node: '>=4'} + dev: true + + /map-obj@4.3.0: + resolution: {integrity: sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==} + engines: {node: '>=8'} + dev: true + + /markdown-table@2.0.0: + resolution: {integrity: sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==} + dependencies: + repeat-string: 1.6.1 + dev: true + + /material-colors@1.2.6: + resolution: {integrity: sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg==} + dev: false + + /mdast-add-list-metadata@1.0.1: + resolution: {integrity: sha512-fB/VP4MJ0LaRsog7hGPxgOrSL3gE/2uEdZyDuSEnKCv/8IkYHiDkIQSbChiJoHyxZZXZ9bzckyRk+vNxFzh8rA==} + dependencies: + unist-util-visit-parents: 1.1.2 + dev: true + + /mdast-util-find-and-replace@1.1.1: + resolution: {integrity: sha512-9cKl33Y21lyckGzpSmEQnIDjEfeeWelN5s1kUW1LwdB0Fkuq2u+4GdqcGEygYxJE8GVqCl0741bYXHgamfWAZA==} + dependencies: + escape-string-regexp: 4.0.0 + unist-util-is: 4.1.0 + unist-util-visit-parents: 3.1.1 + dev: true + + /mdast-util-from-markdown@0.8.5: + resolution: {integrity: sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==} + dependencies: + '@types/mdast': 3.0.15 + mdast-util-to-string: 2.0.0 + micromark: 2.11.4 + parse-entities: 2.0.0 + unist-util-stringify-position: 2.0.3 + transitivePeerDependencies: + - supports-color + dev: true + + /mdast-util-gfm-autolink-literal@0.1.3: + resolution: {integrity: sha512-GjmLjWrXg1wqMIO9+ZsRik/s7PLwTaeCHVB7vRxUwLntZc8mzmTsLVr6HW1yLokcnhfURsn5zmSVdi3/xWWu1A==} + dependencies: + ccount: 1.1.0 + mdast-util-find-and-replace: 1.1.1 + micromark: 2.11.4 + transitivePeerDependencies: + - supports-color + dev: true + + /mdast-util-gfm-strikethrough@0.2.3: + resolution: {integrity: sha512-5OQLXpt6qdbttcDG/UxYY7Yjj3e8P7X16LzvpX8pIQPYJ/C2Z1qFGMmcw+1PZMUM3Z8wt8NRfYTvCni93mgsgA==} + dependencies: + mdast-util-to-markdown: 0.6.5 + dev: true + + /mdast-util-gfm-table@0.1.6: + resolution: {integrity: sha512-j4yDxQ66AJSBwGkbpFEp9uG/LS1tZV3P33fN1gkyRB2LoRL+RR3f76m0HPHaby6F4Z5xr9Fv1URmATlRRUIpRQ==} + dependencies: + markdown-table: 2.0.0 + mdast-util-to-markdown: 0.6.5 + dev: true + + /mdast-util-gfm-task-list-item@0.1.6: + resolution: {integrity: sha512-/d51FFIfPsSmCIRNp7E6pozM9z1GYPIkSy1urQ8s/o4TC22BZ7DqfHFWiqBD23bc7J3vV1Fc9O4QIHBlfuit8A==} + dependencies: + mdast-util-to-markdown: 0.6.5 + dev: true + + /mdast-util-gfm@0.1.2: + resolution: {integrity: sha512-NNkhDx/qYcuOWB7xHUGWZYVXvjPFFd6afg6/e2g+SV4r9q5XUcCbV4Wfa3DLYIiD+xAEZc6K4MGaE/m0KDcPwQ==} + dependencies: + mdast-util-gfm-autolink-literal: 0.1.3 + mdast-util-gfm-strikethrough: 0.2.3 + mdast-util-gfm-table: 0.1.6 + mdast-util-gfm-task-list-item: 0.1.6 + mdast-util-to-markdown: 0.6.5 + transitivePeerDependencies: + - supports-color + dev: true + + /mdast-util-to-markdown@0.6.5: + resolution: {integrity: sha512-XeV9sDE7ZlOQvs45C9UKMtfTcctcaj/pGwH8YLbMHoMOXNNCn2LsqVQOqrF1+/NU8lKDAqozme9SCXWyo9oAcQ==} + dependencies: + '@types/unist': 2.0.10 + longest-streak: 2.0.4 + mdast-util-to-string: 2.0.0 + parse-entities: 2.0.0 + repeat-string: 1.6.1 + zwitch: 1.0.5 + dev: true + + /mdast-util-to-string@2.0.0: + resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==} + dev: true + + /memorystream@0.3.1: + resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==} + engines: {node: '>= 0.10.0'} + dev: true + + /meow@8.1.2: + resolution: {integrity: sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==} + engines: {node: '>=10'} + dependencies: + '@types/minimist': 1.2.5 + camelcase-keys: 6.2.2 + decamelize-keys: 1.1.1 + hard-rejection: 2.1.0 + minimist-options: 4.1.0 + normalize-package-data: 3.0.3 + read-pkg-up: 7.0.1 + redent: 3.0.0 + trim-newlines: 3.0.1 + type-fest: 0.18.1 + yargs-parser: 20.2.9 + dev: true + + /merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + dev: true + + /micromark-extension-gfm-autolink-literal@0.5.7: + resolution: {integrity: sha512-ePiDGH0/lhcngCe8FtH4ARFoxKTUelMp4L7Gg2pujYD5CSMb9PbblnyL+AAMud/SNMyusbS2XDSiPIRcQoNFAw==} + dependencies: + micromark: 2.11.4 + transitivePeerDependencies: + - supports-color + dev: true + + /micromark-extension-gfm-strikethrough@0.6.5: + resolution: {integrity: sha512-PpOKlgokpQRwUesRwWEp+fHjGGkZEejj83k9gU5iXCbDG+XBA92BqnRKYJdfqfkrRcZRgGuPuXb7DaK/DmxOhw==} + dependencies: + micromark: 2.11.4 + transitivePeerDependencies: + - supports-color + dev: true + + /micromark-extension-gfm-table@0.4.3: + resolution: {integrity: sha512-hVGvESPq0fk6ALWtomcwmgLvH8ZSVpcPjzi0AjPclB9FsVRgMtGZkUcpE0zgjOCFAznKepF4z3hX8z6e3HODdA==} + dependencies: + micromark: 2.11.4 + transitivePeerDependencies: + - supports-color + dev: true + + /micromark-extension-gfm-tagfilter@0.3.0: + resolution: {integrity: sha512-9GU0xBatryXifL//FJH+tAZ6i240xQuFrSL7mYi8f4oZSbc+NvXjkrHemeYP0+L4ZUT+Ptz3b95zhUZnMtoi/Q==} + dev: true + + /micromark-extension-gfm-task-list-item@0.3.3: + resolution: {integrity: sha512-0zvM5iSLKrc/NQl84pZSjGo66aTGd57C1idmlWmE87lkMcXrTxg1uXa/nXomxJytoje9trP0NDLvw4bZ/Z/XCQ==} + dependencies: + micromark: 2.11.4 + transitivePeerDependencies: + - supports-color + dev: true + + /micromark-extension-gfm@0.3.3: + resolution: {integrity: sha512-oVN4zv5/tAIA+l3GbMi7lWeYpJ14oQyJ3uEim20ktYFAcfX1x3LNlFGGlmrZHt7u9YlKExmyJdDGaTt6cMSR/A==} + dependencies: + micromark: 2.11.4 + micromark-extension-gfm-autolink-literal: 0.5.7 + micromark-extension-gfm-strikethrough: 0.6.5 + micromark-extension-gfm-table: 0.4.3 + micromark-extension-gfm-tagfilter: 0.3.0 + micromark-extension-gfm-task-list-item: 0.3.3 + transitivePeerDependencies: + - supports-color + dev: true + + /micromark@2.11.4: + resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==} + dependencies: + debug: 4.3.4 + parse-entities: 2.0.0 + transitivePeerDependencies: + - supports-color + dev: true + + /micromatch@4.0.5: + resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} + engines: {node: '>=8.6'} + dependencies: + braces: 3.0.2 + picomatch: 2.3.1 + dev: true + + /mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + dev: true + + /mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + dependencies: + mime-db: 1.52.0 + dev: true + + /min-indent@1.0.1: + resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} + engines: {node: '>=4'} + dev: true + + /minimatch@3.1.2: + resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + dependencies: + brace-expansion: 1.1.11 + dev: true + + /minimatch@9.0.3: + resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + brace-expansion: 2.0.1 + dev: true + + /minimist-options@4.1.0: + resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==} + engines: {node: '>= 6'} + dependencies: + arrify: 1.0.1 + is-plain-obj: 1.1.0 + kind-of: 6.0.3 + dev: true + + /minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + dev: true + + /minipass@7.0.4: + resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} + engines: {node: '>=16 || 14 >=14.17'} + dev: true + + /mlly@1.4.2: + resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} + dependencies: + acorn: 8.11.2 + pathe: 1.1.1 + pkg-types: 1.0.3 + ufo: 1.3.2 + dev: true + + /modify-values@1.0.1: + resolution: {integrity: sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==} + engines: {node: '>=0.10.0'} + dev: true + + /monaco-editor@0.27.0: + resolution: {integrity: sha512-UhwP78Wb8w0ZSYoKXQNTV/0CHObp6NS3nCt51QfKE6sKyBo5PBsvuDOHoI2ooBakc6uIwByRLHVeT7+yXQe2fQ==} + + /moo-color@1.0.3: + resolution: {integrity: sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ==} + dependencies: + color-name: 1.1.4 + dev: true + + /ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + + /nanoevents@7.0.1: + resolution: {integrity: sha512-o6lpKiCxLeijK4hgsqfR6CNToPyRU3keKyyI6uwuHRvpRTbZ0wXw51WRgyldVugZqoJfkGFrjrIenYH3bfEO3Q==} + engines: {node: ^14.0.0 || ^16.0.0 || >=18.0.0} + dev: false + + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + /natural-compare-lite@1.4.0: + resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} + dev: true + + /natural-compare@1.4.0: + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + dev: true + + /ndarray@1.0.19: + resolution: {integrity: sha512-B4JHA4vdyZU30ELBw3g7/p9bZupyew5a7tX1Y/gGeF2hafrPaQZhgrGQfsvgfYbgdFZjYwuEcnaobeM/WMW+HQ==} + dependencies: + iota-array: 1.0.0 + is-buffer: 1.1.6 + dev: false + + /neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + dev: true + + /nice-try@1.0.5: + resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==} + dev: true + + /node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + dependencies: + whatwg-url: 5.0.0 + dev: false + + /node-releases@2.0.14: + resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} + dev: true + + /normalize-package-data@2.5.0: + resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} + dependencies: + hosted-git-info: 2.8.9 + resolve: 1.22.8 + semver: 5.7.2 + validate-npm-package-license: 3.0.4 + dev: true + + /normalize-package-data@3.0.3: + resolution: {integrity: sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==} + engines: {node: '>=10'} + dependencies: + hosted-git-info: 4.1.0 + is-core-module: 2.13.1 + semver: 7.5.4 + validate-npm-package-license: 3.0.4 + dev: true + + /npm-normalize-package-bin@3.0.1: + resolution: {integrity: sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + dev: true + + /npm-run-all@4.1.5: + resolution: {integrity: sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==} + engines: {node: '>= 4'} + hasBin: true + dependencies: + ansi-styles: 3.2.1 + chalk: 2.4.2 + cross-spawn: 6.0.5 + memorystream: 0.3.1 + minimatch: 3.1.2 + pidtree: 0.3.1 + read-pkg: 3.0.0 + shell-quote: 1.8.1 + string.prototype.padend: 3.1.5 + dev: true + + /nwsapi@2.2.7: + resolution: {integrity: sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==} + dev: true + + /object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + + /object-inspect@1.13.1: + resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} + + /object-keys@1.1.1: + resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} + engines: {node: '>= 0.4'} + dev: true + + /object-pairs@0.1.0: + resolution: {integrity: sha512-3ECr6K831I4xX/Mduxr9UC+HPOz/d6WKKYj9p4cmC8Lg8p7g8gitzsxNX5IWlSIgFWN/a4JgrJaoAMKn20oKwA==} + dev: true + + /object-values@1.0.0: + resolution: {integrity: sha512-+8hwcz/JnQ9EpLIXzN0Rs7DLsBpJNT/xYehtB/jU93tHYr5BFEO8E+JGQNOSqE7opVzz5cGksKFHt7uUJVLSjQ==} + engines: {node: '>=0.10.0'} + dev: true + + /object.assign@4.1.5: + resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + has-symbols: 1.0.3 + object-keys: 1.1.1 + dev: true + + /object.entries-ponyfill@1.0.1: + resolution: {integrity: sha512-j0ixssXc5GirDWhB2cLVPsOs9jx61G/iRndyMdToTsjMYY8BQmG1Ke6mwqXmpDiP8icye1YCR94NswNaa/yyzA==} + dev: false + + /object.entries@1.1.7: + resolution: {integrity: sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + dev: true + + /object.fromentries@2.0.7: + resolution: {integrity: sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + dev: true + + /object.hasown@1.1.3: + resolution: {integrity: sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA==} + dependencies: + define-properties: 1.2.1 + es-abstract: 1.22.3 + dev: true + + /object.values@1.1.7: + resolution: {integrity: sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + dev: true + + /observable-fns@0.6.1: + resolution: {integrity: sha512-9gRK4+sRWzeN6AOewNBTLXir7Zl/i3GB6Yl26gK4flxz8BXVpD3kt8amREmWNb0mxYOGDotvE5a4N+PtGGKdkg==} + dev: false + + /once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + dependencies: + wrappy: 1.0.2 + dev: true + + /optionator@0.9.3: + resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} + engines: {node: '>= 0.8.0'} + dependencies: + '@aashutoshrathi/word-wrap': 1.2.6 + deep-is: 0.1.4 + fast-levenshtein: 2.0.6 + levn: 0.4.1 + prelude-ls: 1.2.1 + type-check: 0.4.0 + dev: true + + /p-limit@1.3.0: + resolution: {integrity: sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==} + engines: {node: '>=4'} + dependencies: + p-try: 1.0.0 + dev: true + + /p-limit@2.3.0: + resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} + engines: {node: '>=6'} + dependencies: + p-try: 2.2.0 + dev: true + + /p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + dependencies: + yocto-queue: 0.1.0 + dev: true + + /p-limit@4.0.0: + resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + yocto-queue: 1.0.0 + dev: true + + /p-locate@2.0.0: + resolution: {integrity: sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==} + engines: {node: '>=4'} + dependencies: + p-limit: 1.3.0 + dev: true + + /p-locate@4.1.0: + resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} + engines: {node: '>=8'} + dependencies: + p-limit: 2.3.0 + dev: true + + /p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} + dependencies: + p-limit: 3.1.0 + dev: true + + /p-map@4.0.0: + resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==} + engines: {node: '>=10'} + dependencies: + aggregate-error: 3.1.0 + dev: true + + /p-try@1.0.0: + resolution: {integrity: sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==} + engines: {node: '>=4'} + dev: true + + /p-try@2.2.0: + resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} + engines: {node: '>=6'} + dev: true + + /pako@1.0.11: + resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==} + dev: false + + /pako@2.1.0: + resolution: {integrity: sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==} + dev: false + + /parent-module@1.0.1: + resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} + engines: {node: '>=6'} + dependencies: + callsites: 3.1.0 + dev: true + + /parse-entities@2.0.0: + resolution: {integrity: sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==} + dependencies: + character-entities: 1.2.4 + character-entities-legacy: 1.1.4 + character-reference-invalid: 1.1.4 + is-alphanumerical: 1.0.4 + is-decimal: 1.0.4 + is-hexadecimal: 1.0.4 + dev: true + + /parse-json@4.0.0: + resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==} + engines: {node: '>=4'} + dependencies: + error-ex: 1.3.2 + json-parse-better-errors: 1.0.2 + dev: true + + /parse-json@5.2.0: + resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} + engines: {node: '>=8'} + dependencies: + '@babel/code-frame': 7.23.5 + error-ex: 1.3.2 + json-parse-even-better-errors: 2.3.1 + lines-and-columns: 1.2.4 + dev: true + + /parse-ms@3.0.0: + resolution: {integrity: sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==} + engines: {node: '>=12'} + dev: true + + /parse5@6.0.1: + resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} + dev: true + + /path-exists@3.0.0: + resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} + engines: {node: '>=4'} + dev: true + + /path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + dev: true + + /path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + dev: true + + /path-key@2.0.1: + resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==} + engines: {node: '>=4'} + dev: true + + /path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + dev: true + + /path-parse@1.0.7: + resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + dev: true + + /path-scurry@1.10.1: + resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + lru-cache: 10.1.0 + minipass: 7.0.4 + dev: true + + /path-to-regexp@1.8.0: + resolution: {integrity: sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==} + dependencies: + isarray: 0.0.1 + dev: true + + /path-type@3.0.0: + resolution: {integrity: sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==} + engines: {node: '>=4'} + dependencies: + pify: 3.0.0 + dev: true + + /path-type@4.0.0: + resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} + engines: {node: '>=8'} + dev: true + + /pathe@1.1.1: + resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} + dev: true + + /pathval@1.1.1: + resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + dev: true + + /performance-now@2.1.0: + resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} + requiresBuild: true + dev: false + optional: true + + /picocolors@1.0.0: + resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + dev: true + + /picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + dev: true + + /pidtree@0.3.1: + resolution: {integrity: sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==} + engines: {node: '>=0.10'} + hasBin: true + dev: true + + /pify@2.3.0: + resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==} + engines: {node: '>=0.10.0'} + dev: true + + /pify@3.0.0: + resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==} + engines: {node: '>=4'} + dev: true + + /pixelmatch@5.3.0: + resolution: {integrity: sha512-o8mkY4E/+LNUf6LzX96ht6k6CEDi65k9G2rjMtBe9Oo+VPKSvl+0GKHuH/AlG+GA5LPG/i5hrekkxUc3s2HU+Q==} + hasBin: true + dependencies: + pngjs: 6.0.0 + dev: true + + /pixi.js@6.5.10: + resolution: {integrity: sha512-Z2mjeoISml2iuVwT1e/BQwERYM2yKoiR08ZdGrg8y5JjeuVptfTrve4DbPMRN/kEDodesgQZGV/pFv0fE9Q2SA==} + dependencies: + '@pixi/accessibility': 6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/utils@6.5.10) + '@pixi/app': 6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10) + '@pixi/compressed-textures': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/loaders@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/constants': 6.5.10 + '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/extensions': 6.5.10 + '@pixi/extract': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10) + '@pixi/filter-alpha': 6.5.10(@pixi/core@6.5.10) + '@pixi/filter-blur': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/settings@6.5.10) + '@pixi/filter-color-matrix': 6.5.10(@pixi/core@6.5.10) + '@pixi/filter-displacement': 6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10) + '@pixi/filter-fxaa': 6.5.10(@pixi/core@6.5.10) + '@pixi/filter-noise': 6.5.10(@pixi/core@6.5.10) + '@pixi/graphics': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) + '@pixi/interaction': 6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/loaders': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/utils@6.5.10) + '@pixi/math': 6.5.10 + '@pixi/mesh': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/mesh-extras': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/mesh@6.5.10)(@pixi/utils@6.5.10) + '@pixi/mixin-cache-as-bitmap': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) + '@pixi/mixin-get-child-by-name': 6.5.10(@pixi/display@6.5.10) + '@pixi/mixin-get-global-position': 6.5.10(@pixi/display@6.5.10)(@pixi/math@6.5.10) + '@pixi/particle-container': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) + '@pixi/polyfill': 6.5.10 + '@pixi/prepare': 6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/graphics@6.5.10)(@pixi/settings@6.5.10)(@pixi/text@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) + '@pixi/runner': 6.5.10 + '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) + '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) + '@pixi/sprite-animated': 6.5.10(@pixi/core@6.5.10)(@pixi/sprite@6.5.10)(@pixi/ticker@6.5.10) + '@pixi/sprite-tiling': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) + '@pixi/spritesheet': 6.5.10(@pixi/core@6.5.10)(@pixi/loaders@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10) + '@pixi/text': 6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) + '@pixi/text-bitmap': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/loaders@6.5.10)(@pixi/math@6.5.10)(@pixi/mesh@6.5.10)(@pixi/settings@6.5.10)(@pixi/text@6.5.10)(@pixi/utils@6.5.10) + '@pixi/ticker': 6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10) + '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) + + /pkg-types@1.0.3: + resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} + dependencies: + jsonc-parser: 3.2.0 + mlly: 1.4.2 + pathe: 1.1.1 + dev: true + + /playwright-core@1.40.1: + resolution: {integrity: sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ==} + engines: {node: '>=16'} + hasBin: true + dev: true + + /playwright@1.40.1: + resolution: {integrity: sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==} + engines: {node: '>=16'} + hasBin: true + dependencies: + playwright-core: 1.40.1 + optionalDependencies: + fsevents: 2.3.2 + dev: true + + /pngjs@6.0.0: + resolution: {integrity: sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==} + engines: {node: '>=12.13.0'} + dev: true + + /pngjs@7.0.0: + resolution: {integrity: sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==} + engines: {node: '>=14.19.0'} + dev: true + + /postcss@8.4.32: + resolution: {integrity: sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.0 + source-map-js: 1.0.2 + dev: true + + /prelude-ls@1.2.1: + resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} + engines: {node: '>= 0.8.0'} + dev: true + + /prettier-linter-helpers@1.0.0: + resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} + engines: {node: '>=6.0.0'} + dependencies: + fast-diff: 1.3.0 + dev: true + + /prettier@2.8.8: + resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} + engines: {node: '>=10.13.0'} + hasBin: true + dev: true + + /pretty-format@29.7.0: + resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/schemas': 29.6.3 + ansi-styles: 5.2.0 + react-is: 18.2.0 + dev: true + + /pretty-ms@8.0.0: + resolution: {integrity: sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==} + engines: {node: '>=14.16'} + dependencies: + parse-ms: 3.0.0 + dev: true + + /prismjs@1.29.0: + resolution: {integrity: sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==} + engines: {node: '>=6'} + dev: false + + /process-nextick-args@2.0.1: + resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} + dev: true + + /promise-polyfill@8.3.0: + resolution: {integrity: sha512-H5oELycFml5yto/atYqmjyigJoAo3+OXwolYiH7OfQuYlAqhxNvTfiNMbV9hsC6Yp83yE5r2KTVmtrG6R9i6Pg==} + + /prop-types@15.8.1: + resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} + dependencies: + loose-envify: 1.4.0 + object-assign: 4.1.1 + react-is: 16.13.1 + + /psl@1.9.0: + resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} + dev: true + + /pub-sub-es@2.1.1: + resolution: {integrity: sha512-qOnqlAvQ26hTK0GdieSGC991oDrN0x6W2XacvU5zbarVAWGvKt+esEl3UOXxBY23vE5Vgs1InmmVH3HDanjrPQ==} + dev: false + + /pubsub-js@1.9.4: + resolution: {integrity: sha512-hJYpaDvPH4w8ZX/0Fdf9ma1AwRgU353GfbaVfPjfJQf1KxZ2iHaHl3fAUw1qlJIR5dr4F3RzjGaWohYUEyoh7A==} + dev: false + + /punycode@1.4.1: + resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==} + + /punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + + /q@1.5.1: + resolution: {integrity: sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==} + engines: {node: '>=0.6.0', teleport: '>=0.2.0'} + dev: true + + /qs@6.11.2: + resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} + engines: {node: '>=0.6'} + dependencies: + side-channel: 1.0.4 + + /querystringify@2.2.0: + resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} + + /queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + dev: true + + /quick-lru@2.0.0: + resolution: {integrity: sha512-DqOtZziv7lDjEyuqyVQacRciAwMCEjTNrLYCHYEIIgjcE/tLEpBF82hiDIwCjRnEL9/hY2GJxA0T8ZvYvVVSSA==} + engines: {node: '>=6'} + dev: false + + /quick-lru@4.0.1: + resolution: {integrity: sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==} + engines: {node: '>=8'} + + /quick-lru@6.1.2: + resolution: {integrity: sha512-AAFUA5O1d83pIHEhJwWCq/RQcRukCkn/NSm2QsTEMle5f2hP0ChI2+3Xb051PZCkLryI/Ir1MVKviT2FIloaTQ==} + engines: {node: '>=12'} + dev: false + + /quickselect@2.0.0: + resolution: {integrity: sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==} + dev: false + + /raf-schd@4.0.3: + resolution: {integrity: sha512-tQkJl2GRWh83ui2DiPTJz9wEiMN20syf+5oKfB03yYP7ioZcJwsIK8FjrtLwH1m7C7e+Tt2yYBlrOpdT+dyeIQ==} + dev: true + + /raf@3.4.1: + resolution: {integrity: sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==} + requiresBuild: true + dependencies: + performance-now: 2.1.0 + dev: false + optional: true + + /rbush@3.0.1: + resolution: {integrity: sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==} + dependencies: + quickselect: 2.0.0 + dev: false + + /react-checkbox-tree@1.8.0(react@18.2.0): + resolution: {integrity: sha512-ufC4aorihOvjLpvY1beab2hjVLGZbDTFRzw62foG0+th+KX7e/sdmWu/nD1ZS/U5Yr0rWGwedGH5GOtR0IkUXw==} + peerDependencies: + react: ^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 + dependencies: + classnames: 2.3.2 + lodash: 4.17.21 + nanoid: 3.3.7 + prop-types: 15.8.1 + react: 18.2.0 + dev: false + + /react-color@2.19.3(react@18.2.0): + resolution: {integrity: sha512-LEeGE/ZzNLIsFWa1TMe8y5VYqr7bibneWmvJwm1pCn/eNmrabWDh659JSPn9BuaMpEfU83WTOJfnCcjDZwNQTA==} + peerDependencies: + react: '*' + dependencies: + '@icons/material': 0.2.4(react@18.2.0) + lodash: 4.17.21 + lodash-es: 4.17.21 + material-colors: 1.2.6 + prop-types: 15.8.1 + react: 18.2.0 + reactcss: 1.2.3(react@18.2.0) + tinycolor2: 1.6.0 + dev: false + + /react-dom@18.2.0(react@18.2.0): + resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} + peerDependencies: + react: ^18.2.0 + dependencies: + loose-envify: 1.4.0 + react: 18.2.0 + scheduler: 0.23.0 + + /react-draggable@3.3.2(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-oaz8a6enjbPtx5qb0oDWxtDNuybOylvto1QLydsXgKmwT7e3GXC2eMVDwEMIUYJIFqVG72XpOv673UuuAq6LhA==} + peerDependencies: + react: '>= 16.3.0' + react-dom: '>= 16.3.0' + dependencies: + classnames: 2.3.2 + prop-types: 15.8.1 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + + /react-draggable@4.4.6(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-LtY5Xw1zTPqHkVmtM3X8MUOxNDOUhv/khTgBgrUvwaS064bwVvxT+q5El0uUFNx5IEPKXuRejr7UqLwBIg5pdw==} + peerDependencies: + react: '>= 16.3.0' + react-dom: '>= 16.3.0' + dependencies: + clsx: 1.2.1 + prop-types: 15.8.1 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + + /react-grid-layout@0.16.6(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-h2EsYgsqcESLJeevQSJsEKp8hhh+phOlXDJoMhlV2e7T3VWQL+S6iCF3iD/LK19r4oyRyOMDEir0KV+eLXrAyw==} + dependencies: + classnames: 2.3.2 + lodash.isequal: 4.5.0 + prop-types: 15.8.1 + react-draggable: 3.3.2(react-dom@18.2.0)(react@18.2.0) + react-resizable: 1.11.1(react-dom@18.2.0)(react@18.2.0) + transitivePeerDependencies: + - react + - react-dom + dev: false + + /react-is@16.13.1: + resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} + + /react-is@18.2.0: + resolution: {integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==} + dev: true + + /react-markdown@5.0.3(@types/react@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-jDWOc1AvWn0WahpjW6NK64mtx6cwjM4iSsLHJPNBqoAgGOVoIdJMqaKX4++plhOtdd4JksdqzlDibgPx6B/M2w==} + peerDependencies: + '@types/react': '>=16' + react: '>=16' + dependencies: + '@types/mdast': 3.0.15 + '@types/react': 18.2.0 + '@types/unist': 2.0.10 + html-to-react: 1.7.0(react@18.2.0) + mdast-add-list-metadata: 1.0.1 + prop-types: 15.8.1 + react: 18.2.0 + react-is: 16.13.1 + remark-parse: 9.0.0 + unified: 9.2.2 + unist-util-visit: 2.0.3 + xtend: 4.0.2 + transitivePeerDependencies: + - supports-color + dev: true + + /react-monaco-editor@0.45.0(@types/react@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-QgAFXdXm5e9QRCnjFBt5fHqmUWL2qIMHZuZSLR6rU9E3Bbo2pQO7FSqgVmB5trc5U+hs7KdIWVoWIOzQvZMu3w==} + peerDependencies: + '@types/react': ^17.x + react: ^17.x + dependencies: + '@types/react': 18.2.0 + monaco-editor: 0.27.0 + prop-types: 15.8.1 + react: 18.2.0 + dev: true + + /react-refresh@0.14.0: + resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==} + engines: {node: '>=0.10.0'} + dev: true + + /react-resizable@1.11.1(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-S70gbLaAYqjuAd49utRHibtHLrHXInh7GuOR+6OO6RO6uleQfuBnWmZjRABfqNEx3C3Z6VPLg0/0uOYFrkfu9Q==} + peerDependencies: + react: 0.14.x || 15.x || 16.x || 17.x + react-dom: 0.14.x || 15.x || 16.x || 17.x + dependencies: + prop-types: 15.8.1 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + react-draggable: 4.4.6(react-dom@18.2.0)(react@18.2.0) + dev: false + + /react-resize-detector@4.2.3(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-4AeS6lxdz2KOgDZaOVt1duoDHrbYwSrUX32KeM9j6t9ISyRphoJbTRCMS1aPFxZHFqcCGLT1gMl3lEcSWZNW0A==} + peerDependencies: + react: ^16.0.0 + react-dom: ^16.0.0 + dependencies: + lodash: 4.17.21 + lodash-es: 4.17.21 + prop-types: 15.8.1 + raf-schd: 4.0.3 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + resize-observer-polyfill: 1.5.1 + dev: true + + /react-router-dom@5.3.4(react@18.2.0): + resolution: {integrity: sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ==} + peerDependencies: + react: '>=15' + dependencies: + '@babel/runtime': 7.23.5 + history: 4.10.1 + loose-envify: 1.4.0 + prop-types: 15.8.1 + react: 18.2.0 + react-router: 5.3.4(react@18.2.0) + tiny-invariant: 1.3.1 + tiny-warning: 1.0.3 + dev: true + + /react-router@5.3.4(react@18.2.0): + resolution: {integrity: sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA==} + peerDependencies: + react: '>=15' + dependencies: + '@babel/runtime': 7.23.5 + history: 4.10.1 + hoist-non-react-statics: 3.3.2 + loose-envify: 1.4.0 + path-to-regexp: 1.8.0 + prop-types: 15.8.1 + react: 18.2.0 + react-is: 16.13.1 + tiny-invariant: 1.3.1 + tiny-warning: 1.0.3 + dev: true + + /react-simple-code-editor@0.9.15(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-M8iKgjBTBZK92tZYgOEfMuR7c3zZ0q0v3QYllSxIPx3SU+w003VofH50txXQSBTu92pSOm2tidON1HbQ1l8BDA==} + peerDependencies: + react: ^16.0.0 + react-dom: ^16.0.0 + dependencies: + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + + /react-sortable-hoc@1.11.0(prop-types@15.8.1)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-v1CDCvdfoR3zLGNp6qsBa4J1BWMEVH25+UKxF/RvQRh+mrB+emqtVHMgZ+WreUiKJoEaiwYoScaueIKhMVBHUg==} + peerDependencies: + prop-types: ^15.5.7 + react: ^0.14.0 || ^15.0.0 || ^16.0.0 + react-dom: ^0.14.0 || ^15.0.0 || ^16.0.0 + dependencies: + '@babel/runtime': 7.23.5 + invariant: 2.2.4 + prop-types: 15.8.1 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + + /react@18.2.0: + resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} + engines: {node: '>=0.10.0'} + dependencies: + loose-envify: 1.4.0 + + /reactcss@1.2.3(react@18.2.0): + resolution: {integrity: sha512-KiwVUcFu1RErkI97ywr8nvx8dNOpT03rbnma0SSalTYjkrPYaEajR4a/MRt6DZ46K6arDRbWMNHF+xH7G7n/8A==} + peerDependencies: + react: '*' + dependencies: + lodash: 4.17.21 + react: 18.2.0 + dev: false + + /read-package-json-fast@3.0.2: + resolution: {integrity: sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + dependencies: + json-parse-even-better-errors: 3.0.1 + npm-normalize-package-bin: 3.0.1 + dev: true + + /read-pkg-up@3.0.0: + resolution: {integrity: sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw==} + engines: {node: '>=4'} + dependencies: + find-up: 2.1.0 + read-pkg: 3.0.0 + dev: true + + /read-pkg-up@7.0.1: + resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==} + engines: {node: '>=8'} + dependencies: + find-up: 4.1.0 + read-pkg: 5.2.0 + type-fest: 0.8.1 + dev: true + + /read-pkg@3.0.0: + resolution: {integrity: sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==} + engines: {node: '>=4'} + dependencies: + load-json-file: 4.0.0 + normalize-package-data: 2.5.0 + path-type: 3.0.0 + dev: true + + /read-pkg@5.2.0: + resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==} + engines: {node: '>=8'} + dependencies: + '@types/normalize-package-data': 2.4.4 + normalize-package-data: 2.5.0 + parse-json: 5.2.0 + type-fest: 0.6.0 + dev: true + + /readable-stream@2.3.8: + resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} + dependencies: + core-util-is: 1.0.3 + inherits: 2.0.4 + isarray: 1.0.0 + process-nextick-args: 2.0.1 + safe-buffer: 5.1.2 + string_decoder: 1.1.1 + util-deprecate: 1.0.2 + dev: true + + /readable-stream@3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + dependencies: + inherits: 2.0.4 + string_decoder: 1.3.0 + util-deprecate: 1.0.2 + + /redent@3.0.0: + resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} + engines: {node: '>=8'} + dependencies: + indent-string: 4.0.0 + strip-indent: 3.0.0 + dev: true + + /reflect.getprototypeof@1.0.4: + resolution: {integrity: sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + get-intrinsic: 1.2.2 + globalthis: 1.0.3 + which-builtin-type: 1.1.3 + dev: true + + /regenerator-runtime@0.13.11: + resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==} + requiresBuild: true + dev: false + optional: true + + /regenerator-runtime@0.14.0: + resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==} + + /regexp.prototype.flags@1.5.1: + resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + set-function-name: 2.0.1 + dev: true + + /regexpp@3.2.0: + resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==} + engines: {node: '>=8'} + dev: true + + /remark-gfm@1.0.0: + resolution: {integrity: sha512-KfexHJCiqvrdBZVbQ6RopMZGwaXz6wFJEfByIuEwGf0arvITHjiKKZ1dpXujjH9KZdm1//XJQwgfnJ3lmXaDPA==} + dependencies: + mdast-util-gfm: 0.1.2 + micromark-extension-gfm: 0.3.3 + transitivePeerDependencies: + - supports-color + dev: true + + /remark-parse@9.0.0: + resolution: {integrity: sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==} + dependencies: + mdast-util-from-markdown: 0.8.5 + transitivePeerDependencies: + - supports-color + dev: true + + /repeat-string@1.6.1: + resolution: {integrity: sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==} + engines: {node: '>=0.10'} + dev: true + + /require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + dev: true + + /requires-port@1.0.0: + resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} + + /resize-observer-polyfill@1.5.1: + resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==} + dev: true + + /resolve-from@4.0.0: + resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} + engines: {node: '>=4'} + dev: true + + /resolve-pathname@3.0.0: + resolution: {integrity: sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==} + dev: true + + /resolve@1.22.8: + resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} + hasBin: true + dependencies: + is-core-module: 2.13.1 + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + dev: true + + /resolve@2.0.0-next.5: + resolution: {integrity: sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==} + hasBin: true + dependencies: + is-core-module: 2.13.1 + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + dev: true + + /reusify@1.0.4: + resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + dev: true + + /reverse-arguments@1.0.0: + resolution: {integrity: sha512-/x8uIPdTafBqakK0TmPNJzgkLP+3H+yxpUJhCQHsLBg1rYEVNR2D8BRYNWQhVBjyOd7oo1dZRVzIkwMY2oqfYQ==} + dev: true + + /rgbcolor@1.0.1: + resolution: {integrity: sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==} + engines: {node: '>= 0.8.15'} + requiresBuild: true + dev: false + optional: true + + /rimraf@3.0.2: + resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + hasBin: true + dependencies: + glob: 7.2.3 + dev: true + + /robust-orientation@1.2.1: + resolution: {integrity: sha512-FuTptgKwY6iNuU15nrIJDLjXzCChWB+T4AvksRtwPS/WZ3HuP1CElCm1t+OBfgQKfWbtZIawip+61k7+buRKAg==} + dependencies: + robust-scale: 1.0.2 + robust-subtract: 1.0.0 + robust-sum: 1.0.0 + two-product: 1.0.2 + dev: false + + /robust-point-in-polygon@1.0.3: + resolution: {integrity: sha512-pPzz7AevOOcPYnFv4Vs5L0C7BKOq6C/TfAw5EUE58CylbjGiPyMjAnPLzzSuPZ2zftUGwWbmLWPOjPOz61tAcA==} + dependencies: + robust-orientation: 1.2.1 + dev: false + + /robust-scale@1.0.2: + resolution: {integrity: sha512-jBR91a/vomMAzazwpsPTPeuTPPmWBacwA+WYGNKcRGSh6xweuQ2ZbjRZ4v792/bZOhRKXRiQH0F48AvuajY0tQ==} + dependencies: + two-product: 1.0.2 + two-sum: 1.0.0 + dev: false + + /robust-subtract@1.0.0: + resolution: {integrity: sha512-xhKUno+Rl+trmxAIVwjQMiVdpF5llxytozXJOdoT4eTIqmqsndQqFb1A0oiW3sZGlhMRhOi6pAD4MF1YYW6o/A==} + dev: false + + /robust-sum@1.0.0: + resolution: {integrity: sha512-AvLExwpaqUqD1uwLU6MwzzfRdaI6VEZsyvQ3IAQ0ZJ08v1H+DTyqskrf2ZJyh0BDduFVLN7H04Zmc+qTiahhAw==} + dev: false + + /rollup@3.29.4: + resolution: {integrity: sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==} + engines: {node: '>=14.18.0', npm: '>=8.0.0'} + hasBin: true + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + dependencies: + queue-microtask: 1.2.3 + dev: true + + /rw@1.3.3: + resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==} + dev: false + + /rxjs@7.8.1: + resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} + dependencies: + tslib: 2.6.2 + dev: false + + /safe-array-concat@1.0.1: + resolution: {integrity: sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==} + engines: {node: '>=0.4'} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + has-symbols: 1.0.3 + isarray: 2.0.5 + dev: true + + /safe-buffer@5.1.2: + resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} + dev: true + + /safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + /safe-regex-test@1.0.0: + resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + is-regex: 1.1.4 + dev: true + + /safe-stable-stringify@2.4.3: + resolution: {integrity: sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==} + engines: {node: '>=10'} + dev: true + + /safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + + /saxes@5.0.1: + resolution: {integrity: sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==} + engines: {node: '>=10'} + dependencies: + xmlchars: 2.2.0 + dev: true + + /scheduler@0.23.0: + resolution: {integrity: sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==} + dependencies: + loose-envify: 1.4.0 + + /semver@5.7.2: + resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==} + hasBin: true + dev: true + + /semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} + hasBin: true + dev: true + + /semver@7.5.4: + resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: true + + /set-function-length@1.1.1: + resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 + get-intrinsic: 1.2.2 + gopd: 1.0.1 + has-property-descriptors: 1.0.1 + + /set-function-name@2.0.1: + resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 + functions-have-names: 1.2.3 + has-property-descriptors: 1.0.1 + dev: true + + /shebang-command@1.2.0: + resolution: {integrity: sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==} + engines: {node: '>=0.10.0'} + dependencies: + shebang-regex: 1.0.0 + dev: true + + /shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + dependencies: + shebang-regex: 3.0.0 + dev: true + + /shebang-regex@1.0.0: + resolution: {integrity: sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==} + engines: {node: '>=0.10.0'} + dev: true + + /shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + dev: true + + /shell-quote-word@1.0.1: + resolution: {integrity: sha512-lT297f1WLAdq0A4O+AknIFRP6kkiI3s8C913eJ0XqBxJbZPGWUNkRQk2u8zk4bEAjUJ5i+fSLwB6z1HzeT+DEg==} + dev: true + + /shell-quote@1.8.1: + resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} + dev: true + + /side-channel@1.0.4: + resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + object-inspect: 1.13.1 + + /siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + dev: true + + /signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + dev: true + + /signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + dev: true + + /slash@3.0.0: + resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} + engines: {node: '>=8'} + dev: true + + /slash@4.0.0: + resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} + engines: {node: '>=12'} + dev: true + + /slugid@3.2.0: + resolution: {integrity: sha512-f0vZb6VyjUdZG5kaxd9CNpfhy+eUUTC8RnbDolC3ZLjYa7n5AdPkQnqnIjmoZYoPS9dWMOXQdoBREAGQqdZb9A==} + engines: {node: '>=6.0'} + dependencies: + uuid: 8.3.2 + dev: false + + /source-map-js@1.0.2: + resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} + engines: {node: '>=0.10.0'} + dev: true + + /source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + dev: true + + /spdx-correct@3.2.0: + resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==} + dependencies: + spdx-expression-parse: 3.0.1 + spdx-license-ids: 3.0.16 + dev: true + + /spdx-exceptions@2.3.0: + resolution: {integrity: sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==} + dev: true + + /spdx-expression-parse@3.0.1: + resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==} + dependencies: + spdx-exceptions: 2.3.0 + spdx-license-ids: 3.0.16 + dev: true + + /spdx-license-ids@3.0.16: + resolution: {integrity: sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==} + dev: true + + /split2@3.2.2: + resolution: {integrity: sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==} + dependencies: + readable-stream: 3.6.2 + dev: true + + /split@1.0.1: + resolution: {integrity: sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==} + dependencies: + through: 2.3.8 + dev: true + + /stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + dev: true + + /stackblur-canvas@2.6.0: + resolution: {integrity: sha512-8S1aIA+UoF6erJYnglGPug6MaHYGo1Ot7h5fuXx4fUPvcvQfcdw2o/ppCse63+eZf8PPidSu4v1JnmEVtEDnpg==} + engines: {node: '>=0.1.14'} + requiresBuild: true + dev: false + optional: true + + /std-env@3.6.0: + resolution: {integrity: sha512-aFZ19IgVmhdB2uX599ve2kE6BIE3YMnQ6Gp6BURhW/oIzpXGKr878TQfAQZn1+i0Flcc/UKUy1gOlcfaUBCryg==} + dev: true + + /stream-browserify@3.0.0: + resolution: {integrity: sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==} + dependencies: + inherits: 2.0.4 + readable-stream: 3.6.2 + dev: false + + /string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + dev: true + + /string-width@5.1.2: + resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} + engines: {node: '>=12'} + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 9.2.2 + strip-ansi: 7.1.0 + dev: true + + /string.fromcodepoint@0.2.1: + resolution: {integrity: sha512-n69H31OnxSGSZyZbgBlvYIXlrMhJQ0dQAX1js1QDhpaUH6zmU3QYlj07bCwCNlPOu3oRXIubGPl2gDGnHsiCqg==} + dev: true + + /string.prototype.matchall@4.0.10: + resolution: {integrity: sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ==} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + get-intrinsic: 1.2.2 + has-symbols: 1.0.3 + internal-slot: 1.0.6 + regexp.prototype.flags: 1.5.1 + set-function-name: 2.0.1 + side-channel: 1.0.4 + dev: true + + /string.prototype.padend@3.1.5: + resolution: {integrity: sha512-DOB27b/2UTTD+4myKUFh+/fXWcu/UDyASIXfg+7VzoCNNGOfWvoyU/x5pvVHr++ztyt/oSYI1BcWBBG/hmlNjA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + dev: true + + /string.prototype.trim@1.2.8: + resolution: {integrity: sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + dev: true + + /string.prototype.trimend@1.0.7: + resolution: {integrity: sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + dev: true + + /string.prototype.trimstart@1.0.7: + resolution: {integrity: sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + dev: true + + /string_decoder@1.1.1: + resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} + dependencies: + safe-buffer: 5.1.2 + dev: true + + /string_decoder@1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + dependencies: + safe-buffer: 5.2.1 + + /strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + dependencies: + ansi-regex: 5.0.1 + dev: true + + /strip-ansi@7.1.0: + resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} + engines: {node: '>=12'} + dependencies: + ansi-regex: 6.0.1 + dev: true + + /strip-bom@3.0.0: + resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} + engines: {node: '>=4'} + dev: true + + /strip-indent@3.0.0: + resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==} + engines: {node: '>=8'} + dependencies: + min-indent: 1.0.1 + dev: true + + /strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + dev: true + + /strip-json-comments@5.0.1: + resolution: {integrity: sha512-0fk9zBqO67Nq5M/m45qHCJxylV/DhBlIOVExqgOMiCCrzrhU6tCibRXNqE3jwJLftzE9SNuZtYbpzcO+i9FiKw==} + engines: {node: '>=14.16'} + dev: true + + /strip-literal@1.3.0: + resolution: {integrity: sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==} + dependencies: + acorn: 8.11.2 + dev: true + + /summary@2.1.0: + resolution: {integrity: sha512-nMIjMrd5Z2nuB2RZCKJfFMjgS3fygbeyGk9PxPPaJR1RIcyN9yn4A63Isovzm3ZtQuEkLBVgMdPup8UeLH7aQw==} + dev: true + + /supports-color@5.5.0: + resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} + engines: {node: '>=4'} + dependencies: + has-flag: 3.0.0 + dev: true + + /supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + dependencies: + has-flag: 4.0.0 + dev: true + + /supports-preserve-symlinks-flag@1.0.0: + resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} + engines: {node: '>= 0.4'} + dev: true + + /svg-pathdata@6.0.3: + resolution: {integrity: sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==} + engines: {node: '>=12.0.0'} + requiresBuild: true + dev: false + optional: true + + /symbol-tree@3.2.4: + resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + dev: true + + /temp-dir@2.0.0: + resolution: {integrity: sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==} + engines: {node: '>=8'} + dev: true + + /tempfile@3.0.0: + resolution: {integrity: sha512-uNFCg478XovRi85iD42egu+eSFUmmka750Jy7L5tfHI5hQKKtbPnxaSaXAbBqCDYrw3wx4tXjKwci4/QmsZJxw==} + engines: {node: '>=8'} + dependencies: + temp-dir: 2.0.0 + uuid: 3.4.0 + dev: true + + /test-exclude@6.0.0: + resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} + engines: {node: '>=8'} + dependencies: + '@istanbuljs/schema': 0.1.3 + glob: 7.2.3 + minimatch: 3.1.2 + dev: true + + /text-extensions@1.9.0: + resolution: {integrity: sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==} + engines: {node: '>=0.10'} + dev: true + + /text-segmentation@1.0.3: + resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==} + requiresBuild: true + dependencies: + utrie: 1.0.2 + dev: false + optional: true + + /text-table@0.2.0: + resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + dev: true + + /threads@1.7.0: + resolution: {integrity: sha512-Mx5NBSHX3sQYR6iI9VYbgHKBLisyB+xROCBGjjWm1O9wb9vfLxdaGtmT/KCjUqMsSNW6nERzCW3T6H43LqjDZQ==} + dependencies: + callsites: 3.1.0 + debug: 4.3.4 + is-observable: 2.1.0 + observable-fns: 0.6.1 + optionalDependencies: + tiny-worker: 2.3.0 + transitivePeerDependencies: + - supports-color + dev: false + + /through2@2.0.5: + resolution: {integrity: sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==} + dependencies: + readable-stream: 2.3.8 + xtend: 4.0.2 + dev: true + + /through2@4.0.2: + resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==} + dependencies: + readable-stream: 3.6.2 + dev: true + + /through@2.3.8: + resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} + dev: true + + /tiny-invariant@1.3.1: + resolution: {integrity: sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw==} + dev: true + + /tiny-warning@1.0.3: + resolution: {integrity: sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==} + dev: true + + /tiny-worker@2.3.0: + resolution: {integrity: sha512-pJ70wq5EAqTAEl9IkGzA+fN0836rycEuz2Cn6yeZ6FRzlVS5IDOkFHpIoEsksPRQV34GDqXm65+OlnZqUSyK2g==} + requiresBuild: true + dependencies: + esm: 3.2.25 + dev: false + optional: true + + /tinybench@2.5.1: + resolution: {integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==} + dev: true + + /tinycolor2@1.6.0: + resolution: {integrity: sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==} + dev: false + + /tinypool@0.7.0: + resolution: {integrity: sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==} + engines: {node: '>=14.0.0'} + dev: true + + /tinyspy@2.2.0: + resolution: {integrity: sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==} + engines: {node: '>=14.0.0'} + dev: true + + /to-fast-properties@2.0.0: + resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} + engines: {node: '>=4'} + dev: true + + /to-no-case@1.0.2: + resolution: {integrity: sha512-Z3g735FxuZY8rodxV4gH7LxClE4H0hTIyHNIHdk+vpQxjLm0cwnKXq/OFVZ76SOQmto7txVcwSCwkU5kqp+FKg==} + dev: true + + /to-pascal-case@1.0.0: + resolution: {integrity: sha512-QGMWHqM6xPrcQW57S23c5/3BbYb0Tbe9p+ur98ckRnGDwD4wbbtDiYI38CfmMKNB5Iv0REjs5SNDntTwvDxzZA==} + dependencies: + to-space-case: 1.0.0 + dev: true + + /to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + dependencies: + is-number: 7.0.0 + dev: true + + /to-space-case@1.0.0: + resolution: {integrity: sha512-rLdvwXZ39VOn1IxGL3V6ZstoTbwLRckQmn/U8ZDLuWwIXNpuZDhQ3AiRUlhTbOXFVE9C+dR51wM0CBDhk31VcA==} + dependencies: + to-no-case: 1.0.2 + dev: true + + /tough-cookie@4.1.3: + resolution: {integrity: sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==} + engines: {node: '>=6'} + dependencies: + psl: 1.9.0 + punycode: 2.3.1 + universalify: 0.2.0 + url-parse: 1.5.10 + dev: true + + /tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + dev: false + + /tr46@3.0.0: + resolution: {integrity: sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==} + engines: {node: '>=12'} + dependencies: + punycode: 2.3.1 + dev: true + + /trim-newlines@3.0.1: + resolution: {integrity: sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==} + engines: {node: '>=8'} + dev: true + + /trough@1.0.5: + resolution: {integrity: sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==} + dev: true + + /ts-json-schema-generator@1.0.0: + resolution: {integrity: sha512-F5VofsyMhNSXKII32NDS8/Ur8o2K3Sh5i/U2ke3UgCKf26ybgm2cZeT2x7VJPl1trML/9QLzz/82l0mvzmb3Vw==} + engines: {node: '>=10.0.0'} + hasBin: true + dependencies: + '@types/json-schema': 7.0.15 + commander: 9.5.0 + glob: 7.2.3 + json5: 2.2.3 + safe-stable-stringify: 2.4.3 + typescript: 4.6.4 + dev: true + + /tslib@1.14.1: + resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} + dev: true + + /tslib@2.6.2: + resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + dev: false + + /tsutils@3.21.0(typescript@5.0.2): + resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} + engines: {node: '>= 6'} + peerDependencies: + typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' + dependencies: + tslib: 1.14.1 + typescript: 5.0.2 + dev: true + + /two-product@1.0.2: + resolution: {integrity: sha512-vOyrqmeYvzjToVM08iU52OFocWT6eB/I5LUWYnxeAPGXAhAxXYU/Yr/R2uY5/5n4bvJQL9AQulIuxpIsMoT8XQ==} + dev: false + + /two-sum@1.0.0: + resolution: {integrity: sha512-phP48e8AawgsNUjEY2WvoIWqdie8PoiDZGxTDv70LDr01uX5wLEQbOgSP7Z/B6+SW5oLtbe8qaYX2fKJs3CGTw==} + dev: false + + /type-check@0.4.0: + resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} + engines: {node: '>= 0.8.0'} + dependencies: + prelude-ls: 1.2.1 + dev: true + + /type-detect@4.0.8: + resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} + engines: {node: '>=4'} + dev: true + + /type-fest@0.18.1: + resolution: {integrity: sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==} + engines: {node: '>=10'} + dev: true + + /type-fest@0.20.2: + resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} + engines: {node: '>=10'} + dev: true + + /type-fest@0.6.0: + resolution: {integrity: sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==} + engines: {node: '>=8'} + dev: true + + /type-fest@0.8.1: + resolution: {integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==} + engines: {node: '>=8'} + dev: true + + /typed-array-buffer@1.0.0: + resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + is-typed-array: 1.1.12 + dev: true + + /typed-array-byte-length@1.0.0: + resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + for-each: 0.3.3 + has-proto: 1.0.1 + is-typed-array: 1.1.12 + dev: true + + /typed-array-byte-offset@1.0.0: + resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.5 + call-bind: 1.0.5 + for-each: 0.3.3 + has-proto: 1.0.1 + is-typed-array: 1.1.12 + dev: true + + /typed-array-length@1.0.4: + resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==} + dependencies: + call-bind: 1.0.5 + for-each: 0.3.3 + is-typed-array: 1.1.12 + dev: true + + /typedarray-pool@1.2.0: + resolution: {integrity: sha512-YTSQbzX43yvtpfRtIDAYygoYtgT+Rpjuxy9iOpczrjpXLgGoyG7aS5USJXV2d3nn8uHTeb9rXDvzS27zUg5KYQ==} + dependencies: + bit-twiddle: 1.0.2 + dup: 1.0.0 + dev: false + + /typescript@4.6.4: + resolution: {integrity: sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==} + engines: {node: '>=4.2.0'} + hasBin: true + dev: true + + /typescript@5.0.2: + resolution: {integrity: sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==} + engines: {node: '>=12.20'} + hasBin: true + dev: true + + /ufo@1.3.2: + resolution: {integrity: sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==} + dev: true + + /uglify-js@3.17.4: + resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==} + engines: {node: '>=0.8.0'} + hasBin: true + requiresBuild: true + dev: true + optional: true + + /unbox-primitive@1.0.2: + resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} + dependencies: + call-bind: 1.0.5 + has-bigints: 1.0.2 + has-symbols: 1.0.3 + which-boxed-primitive: 1.0.2 + dev: true + + /unescape-js@1.1.4: + resolution: {integrity: sha512-42SD8NOQEhdYntEiUQdYq/1V/YHwr1HLwlHuTJB5InVVdOSbgI6xu8jK5q65yIzuFCfczzyDF/7hbGzVbyCw0g==} + dependencies: + string.fromcodepoint: 0.2.1 + dev: true + + /unified@9.2.2: + resolution: {integrity: sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==} + dependencies: + '@types/unist': 2.0.10 + bail: 1.0.5 + extend: 3.0.2 + is-buffer: 2.0.5 + is-plain-obj: 2.1.0 + trough: 1.0.5 + vfile: 4.2.1 + dev: true + + /unist-util-is@4.1.0: + resolution: {integrity: sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg==} + dev: true + + /unist-util-stringify-position@2.0.3: + resolution: {integrity: sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==} + dependencies: + '@types/unist': 2.0.10 + dev: true + + /unist-util-visit-parents@1.1.2: + resolution: {integrity: sha512-yvo+MMLjEwdc3RhhPYSximset7rwjMrdt9E41Smmvg25UQIenzrN83cRnF1JMzoMi9zZOQeYXHSDf7p+IQkW3Q==} + dev: true + + /unist-util-visit-parents@3.1.1: + resolution: {integrity: sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==} + dependencies: + '@types/unist': 2.0.10 + unist-util-is: 4.1.0 + dev: true + + /unist-util-visit@2.0.3: + resolution: {integrity: sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==} + dependencies: + '@types/unist': 2.0.10 + unist-util-is: 4.1.0 + unist-util-visit-parents: 3.1.1 + dev: true + + /universalify@0.2.0: + resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} + engines: {node: '>= 4.0.0'} + dev: true + + /update-browserslist-db@1.0.13(browserslist@4.22.2): + resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + dependencies: + browserslist: 4.22.2 + escalade: 3.1.1 + picocolors: 1.0.0 + dev: true + + /uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + dependencies: + punycode: 2.3.1 + + /url-parse@1.5.10: + resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} + dependencies: + querystringify: 2.2.0 + requires-port: 1.0.0 + + /url@0.11.3: + resolution: {integrity: sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==} + dependencies: + punycode: 1.4.1 + qs: 6.11.2 + + /use-resize-observer@9.1.0(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-R25VqO9Wb3asSD4eqtcxk8sJalvIOYBqS8MNZlpDSQ4l4xMQxC/J7Id9HoTqPq8FwULIn0PVW+OAqF2dyYbjow==} + peerDependencies: + react: 16.8.0 - 18 + react-dom: 16.8.0 - 18 + dependencies: + '@juggle/resize-observer': 3.4.0 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + + /util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + + /utrie@1.0.2: + resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==} + requiresBuild: true + dependencies: + base64-arraybuffer: 1.0.2 + dev: false + optional: true + + /uuid@3.4.0: + resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==} + deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. + hasBin: true + dev: true + + /uuid@8.3.2: + resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} + hasBin: true + dev: false + + /v8-compile-cache@2.4.0: + resolution: {integrity: sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==} + dev: true + + /v8-to-istanbul@9.2.0: + resolution: {integrity: sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==} + engines: {node: '>=10.12.0'} + dependencies: + '@jridgewell/trace-mapping': 0.3.20 + '@types/istanbul-lib-coverage': 2.0.6 + convert-source-map: 2.0.0 + dev: true + + /validate-npm-package-license@3.0.4: + resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} + dependencies: + spdx-correct: 3.2.0 + spdx-expression-parse: 3.0.1 + dev: true + + /value-equal@1.0.1: + resolution: {integrity: sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==} + dev: true + + /vfile-message@2.0.4: + resolution: {integrity: sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==} + dependencies: + '@types/unist': 2.0.10 + unist-util-stringify-position: 2.0.3 + dev: true + + /vfile@4.2.1: + resolution: {integrity: sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==} + dependencies: + '@types/unist': 2.0.10 + is-buffer: 2.0.5 + unist-util-stringify-position: 2.0.3 + vfile-message: 2.0.4 + dev: true + + /vite-node@0.34.6(@types/node@18.6.2): + resolution: {integrity: sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==} + engines: {node: '>=v14.18.0'} + hasBin: true + dependencies: + cac: 6.7.14 + debug: 4.3.4 + mlly: 1.4.2 + pathe: 1.1.1 + picocolors: 1.0.0 + vite: 4.4.11(@types/node@18.6.2) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: true + + /vite@4.4.11(@types/node@18.6.2): + resolution: {integrity: sha512-ksNZJlkcU9b0lBwAGZGGaZHCMqHsc8OpgtoYhsQ4/I2v5cnpmmmqe5pM4nv/4Hn6G/2GhTdj0DhZh2e+Er1q5A==} + engines: {node: ^14.18.0 || >=16.0.0} + hasBin: true + peerDependencies: + '@types/node': '>= 14' + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + dependencies: + '@types/node': 18.6.2 + esbuild: 0.18.20 + postcss: 8.4.32 + rollup: 3.29.4 + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /vitest-canvas-mock@0.3.3(vitest@0.34.6): + resolution: {integrity: sha512-3P968tYBpqYyzzOaVtqnmYjqbe13576/fkjbDEJSfQAkHtC5/UjuRHOhFEN/ZV5HVZIkaROBUWgazDKJ+Ibw+Q==} + peerDependencies: + vitest: '*' + dependencies: + jest-canvas-mock: 2.5.2 + vitest: 0.34.6(jsdom@19.0.0) + dev: true + + /vitest@0.34.6(jsdom@19.0.0): + resolution: {integrity: sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==} + engines: {node: '>=v14.18.0'} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@vitest/browser': '*' + '@vitest/ui': '*' + happy-dom: '*' + jsdom: '*' + playwright: '*' + safaridriver: '*' + webdriverio: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + playwright: + optional: true + safaridriver: + optional: true + webdriverio: + optional: true + dependencies: + '@types/chai': 4.3.11 + '@types/chai-subset': 1.3.5 + '@types/node': 18.6.2 + '@vitest/expect': 0.34.6 + '@vitest/runner': 0.34.6 + '@vitest/snapshot': 0.34.6 + '@vitest/spy': 0.34.6 + '@vitest/utils': 0.34.6 + acorn: 8.11.2 + acorn-walk: 8.3.0 + cac: 6.7.14 + chai: 4.3.10 + debug: 4.3.4 + jsdom: 19.0.0 + local-pkg: 0.4.3 + magic-string: 0.30.5 + pathe: 1.1.1 + picocolors: 1.0.0 + std-env: 3.6.0 + strip-literal: 1.3.0 + tinybench: 2.5.1 + tinypool: 0.7.0 + vite: 4.4.11(@types/node@18.6.2) + vite-node: 0.34.6(@types/node@18.6.2) + why-is-node-running: 2.2.2 + transitivePeerDependencies: + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: true + + /vkbeautify@0.99.3: + resolution: {integrity: sha512-2ozZEFfmVvQcHWoHLNuiKlUfDKlhh4KGsy54U0UrlLMR1SO+XKAIDqBxtBwHgNrekurlJwE8A9K6L49T78ZQ9Q==} + dev: false + + /vlq@0.2.3: + resolution: {integrity: sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==} + dev: true + + /w3c-hr-time@1.0.2: + resolution: {integrity: sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==} + deprecated: Use your platform's native performance.now() and performance.timeOrigin. + dependencies: + browser-process-hrtime: 1.0.0 + dev: true + + /w3c-xmlserializer@3.0.0: + resolution: {integrity: sha512-3WFqGEgSXIyGhOmAFtlicJNMjEps8b1MG31NCA0/vOF9+nKMUW1ckhi9cnNHmf88Rzw5V+dwIwsm2C7X8k9aQg==} + engines: {node: '>=12'} + dependencies: + xml-name-validator: 4.0.0 + dev: true + + /wcwidth@1.0.1: + resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} + requiresBuild: true + dependencies: + defaults: 1.0.4 + dev: true + optional: true + + /webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + dev: false + + /webidl-conversions@7.0.0: + resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} + engines: {node: '>=12'} + dev: true + + /whatwg-encoding@2.0.0: + resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} + engines: {node: '>=12'} + dependencies: + iconv-lite: 0.6.3 + dev: true + + /whatwg-mimetype@3.0.0: + resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} + engines: {node: '>=12'} + dev: true + + /whatwg-url@10.0.0: + resolution: {integrity: sha512-CLxxCmdUby142H5FZzn4D8ikO1cmypvXVQktsgosNy4a4BHrDHeciBBGZhb0bNoR5/MltoCatso+vFjjGx8t0w==} + engines: {node: '>=12'} + dependencies: + tr46: 3.0.0 + webidl-conversions: 7.0.0 + dev: true + + /whatwg-url@11.0.0: + resolution: {integrity: sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==} + engines: {node: '>=12'} + dependencies: + tr46: 3.0.0 + webidl-conversions: 7.0.0 + dev: true + + /whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + dev: false + + /which-boxed-primitive@1.0.2: + resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} + dependencies: + is-bigint: 1.0.4 + is-boolean-object: 1.1.2 + is-number-object: 1.0.7 + is-string: 1.0.7 + is-symbol: 1.0.4 + dev: true + + /which-builtin-type@1.1.3: + resolution: {integrity: sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw==} + engines: {node: '>= 0.4'} + dependencies: + function.prototype.name: 1.1.6 + has-tostringtag: 1.0.0 + is-async-function: 2.0.0 + is-date-object: 1.0.5 + is-finalizationregistry: 1.0.2 + is-generator-function: 1.0.10 + is-regex: 1.1.4 + is-weakref: 1.0.2 + isarray: 2.0.5 + which-boxed-primitive: 1.0.2 + which-collection: 1.0.1 + which-typed-array: 1.1.13 + dev: true + + /which-collection@1.0.1: + resolution: {integrity: sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==} + dependencies: + is-map: 2.0.2 + is-set: 2.0.2 + is-weakmap: 2.0.1 + is-weakset: 2.0.2 + dev: true + + /which-typed-array@1.1.13: + resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.5 + call-bind: 1.0.5 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.0 + dev: true + + /which@1.3.1: + resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} + hasBin: true + dependencies: + isexe: 2.0.0 + dev: true + + /which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + dependencies: + isexe: 2.0.0 + dev: true + + /why-is-node-running@2.2.2: + resolution: {integrity: sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==} + engines: {node: '>=8'} + hasBin: true + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + dev: true + + /wordwrap@1.0.0: + resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} + dev: true + + /wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + dev: true + + /wrap-ansi@8.1.0: + resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} + engines: {node: '>=12'} + dependencies: + ansi-styles: 6.2.1 + string-width: 5.1.2 + strip-ansi: 7.1.0 + dev: true + + /wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + dev: true + + /ws@8.14.2: + resolution: {integrity: sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: true + + /xml-name-validator@4.0.0: + resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==} + engines: {node: '>=12'} + dev: true + + /xmlchars@2.2.0: + resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + dev: true + + /xmlhttprequest@1.8.0: + resolution: {integrity: sha512-58Im/U0mlVBLM38NdZjHyhuMtCqa61469k2YP/AaPbvCoV9aQGUpbJBj1QRm2ytRiVQBD/fsw7L2bJGDVQswBA==} + engines: {node: '>=0.4.0'} + dev: false + + /xtend@4.0.2: + resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} + engines: {node: '>=0.4'} + dev: true + + /y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + dev: true + + /yallist@3.1.1: + resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + dev: true + + /yallist@4.0.0: + resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + dev: true + + /yargs-parser@20.2.9: + resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} + engines: {node: '>=10'} + dev: true + + /yargs@16.2.0: + resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} + engines: {node: '>=10'} + dependencies: + cliui: 7.0.4 + escalade: 3.1.1 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 20.2.9 + dev: true + + /yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + dev: true + + /yocto-queue@1.0.0: + resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} + engines: {node: '>=12.20'} + dev: true + + /zod-validation-error@1.5.0(zod@3.22.4): + resolution: {integrity: sha512-/7eFkAI4qV0tcxMBB/3+d2c1P6jzzZYdYSlBuAklzMuCrJu5bzJfHS0yVAS87dRHVlhftd6RFJDIvv03JgkSbw==} + engines: {node: '>=16.0.0'} + peerDependencies: + zod: ^3.18.0 + dependencies: + zod: 3.22.4 + dev: true + + /zod@3.22.4: + resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} + dev: true + + /zwitch@1.0.5: + resolution: {integrity: sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==} + dev: true diff --git a/src/exported-utils.ts b/src/exported-utils.ts index 996af136..bb69da46 100644 --- a/src/exported-utils.ts +++ b/src/exported-utils.ts @@ -6,3 +6,7 @@ export { parseGenomicPosition } from './core/utils/assembly'; export { sanitizeChrName } from './data-fetchers/utils'; + +// These are experimental and may be removed in the future +export { convertToFlatTracks as _convertToFlatTracks } from './compiler/spec-preprocess'; +export { spreadTracksByData as _spreadTracksByData } from './core/utils/overlay'; diff --git a/src/gosling-schema/gosling.schema.json b/src/gosling-schema/gosling.schema.json index 42eab0eb..19114179 100644 --- a/src/gosling-schema/gosling.schema.json +++ b/src/gosling-schema/gosling.schema.json @@ -1272,6 +1272,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -1424,6 +1433,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -2040,6 +2058,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -2192,6 +2219,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -2865,6 +2901,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -4114,6 +4159,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -4432,6 +4486,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -4788,6 +4851,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -5162,6 +5234,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -5496,6 +5577,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -6041,6 +6131,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -6400,6 +6499,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -6548,6 +6656,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -7161,6 +7278,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -7309,6 +7435,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" @@ -7975,6 +8110,15 @@ "default": false, "description": "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", "type": "boolean" + }, + "stretchGraphics": { + "description": "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + "type": "boolean" + }, + "stretchGraphicsThreshold": { + "default": 1.5, + "description": "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + "type": "number" } }, "type": "object" diff --git a/src/gosling-schema/gosling.schema.ts b/src/gosling-schema/gosling.schema.ts index a18f48a0..e37f5a19 100644 --- a/src/gosling-schema/gosling.schema.ts +++ b/src/gosling-schema/gosling.schema.ts @@ -431,6 +431,25 @@ interface SingleTrackBase extends CommonTrackDef { * @default false */ performanceMode?: boolean; + + /** + * Performance rendering option. + * By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve + * rendering performance. No marks will be stretched in circular layouts. + * + * When this option is set to true, all marks will be stretched when zooming in/out. + * When this option is set to false, all marks will be rerendered when zooming in/out. + * + */ + stretchGraphics?: boolean; + + /** + * Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic + * will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will + * be rerendered. This is to prevent the graphics from being stretched too much. + * @default 1.5 + */ + stretchGraphicsThreshold?: number; }; // Mark diff --git a/src/higlass-schema/higlass.schema.ts b/src/higlass-schema/higlass.schema.ts index 2ac62e95..d97f3256 100644 --- a/src/higlass-schema/higlass.schema.ts +++ b/src/higlass-schema/higlass.schema.ts @@ -119,7 +119,7 @@ export interface Data { filter?: FilterTransform[]; } -// When using the built-in RequestInit type, `yarn schema` doesn't work. So we are using our own RequestInit. +// When using the built-in RequestInit type, `pnpm schema` doesn't work. So we are using our own RequestInit. // Currently, we only forsee using the headers option. export interface RequestInit { headers?: Record; diff --git a/src/tracks/gosling-track/gosling-track.ts b/src/tracks/gosling-track/gosling-track.ts index 74272970..e3eb323f 100644 --- a/src/tracks/gosling-track/gosling-track.ts +++ b/src/tracks/gosling-track/gosling-track.ts @@ -333,14 +333,44 @@ const factory: PluginTrackFactory = (HGC, context, op override drawTile(tile: Tile) { if (PRINT_RENDERING_CYCLE) console.warn('drawTile(tile)'); - tile.drawnAtScale = this._xScale.copy(); // being used in `super.draw()` - + /** + * If we don't have info about the tile, we can't draw anything. + */ const tileInfo = this.#processedTileInfo[tile.tileId]; if (!tileInfo) { // We do not have a track model prepared to visualize return; } + /** + * Add a copy of the track scale to the tile. The tile needs its own scale because we will use it to + * determine how much the tile has been stretched (if we are stretching the graphics) + */ + if (!tile.drawnAtScale) { + // This is the first time this tile is being drawn + tile.drawnAtScale = this._xScale.copy(); + } + + /** + * For certain types of marks and layouts (linear), we can stretch the graphics to avoid redrawing + * This is much more performant than redrawing everything at every frame + */ + const [graphicsXScale, graphicsXPos] = this.getXScaleAndOffset(tile.drawnAtScale); + const isFirstRender = graphicsXScale === 1; // The graphicsXScale is 1 if first time the tile is being drawn + if (!this.#isTooStretched(graphicsXScale) && this.#hasStretchableGraphics() && !isFirstRender) { + // Stretch the graphics + tile.graphics.scale.x = graphicsXScale; + tile.graphics.position.x = graphicsXPos; + return; + } + + /** + * If we can't stretch the graphics, we need to redraw everything! + */ + + // We need the tile scale to match the scale of the track + tile.drawnAtScale = this._xScale.copy(); + // Clear the graphics and redraw everything tile.graphics?.clear(); tile.graphics?.removeChildren(); @@ -482,6 +512,35 @@ const factory: PluginTrackFactory = (HGC, context, op }); } + /** + * This is how the mask gets drawn. Overrides method in PixiTrack. + * Compared to the method in PixiTrack, this method draws a circular mask when the layout is circular. + * @param position + * @param dimensions + */ + override setMask(position: [number, number], dimensions: [number, number]) { + this.pMask.clear(); + this.pMask.beginFill(); + + if (this.options.spec.layout === 'circular') { + /** + * If the layout is circular, we want the mask to be circular as well. + * Circular layout have multiple tracks on top of each other so if the mask is not circular, click + * events will be triggered only on the top track. + */ + const [x, y] = this.position; + const [width, height] = this.dimensions; + const cx = x + width / 2.0; + const cy = y + height / 2.0; + const outerRadius = this.options.spec.outerRadius!; + this.pMask.drawCircle(cx, cy, outerRadius); + } else { + // Normal rectangular mask. This is what is done in PixiTrack + this.pMask.drawRect(position[0], position[1], dimensions[0], dimensions[1]); + } + this.pMask.endFill(); + } + /* * * * Tile and data processing methods @@ -1443,6 +1502,43 @@ const factory: PluginTrackFactory = (HGC, context, op } }); } + + /** + * Used in drawTile() + * Checks if the track has marks which are stretchable. Stretching + * is not supported for circular layouts or 2D tracks + */ + #hasStretchableGraphics() { + const hasStretchOption = this.options.spec.experimental?.stretchGraphics; + if (hasStretchOption === true) { + return true; + } else if (hasStretchOption === false) { + return false; + } + // The default behavior is that we stretch when stretching looks acceptable + const isFirstTrack1D = !Is2DTrack(this.getResolvedTracks()[0]); + const isNotCircularLayout = this.options.spec.layout !== 'circular'; + const stretchableMarks = ['bar', 'line', 'rect', 'area']; + const hasStretchableMark = this.getResolvedTracks().reduce( + (acc, spec) => acc && stretchableMarks.includes(spec.mark), + true + ); + const noMouseInteractions = !this.options.spec.experimental?.mouseEvents; + + return isFirstTrack1D && isNotCircularLayout && hasStretchableMark && noMouseInteractions; + } + + /** + * Used in drawTile() + * Checks if the tile Graphic is too stretched. If so, it returns true. + * @param stretchFactor The factor by which the tile is stretched + * @returns True if the tile is too stretched, false otherwise + */ + #isTooStretched(stretchFactor: number) { + const defaultThreshold = 1.5; + const threshold = this.options.spec.experimental?.stretchGraphicsThreshold ?? defaultThreshold; + return stretchFactor > threshold || stretchFactor < 1 / threshold; + } } return new GoslingTrackClass(); }; diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index a6b60924..00000000 --- a/yarn.lock +++ /dev/null @@ -1,7061 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@aashutoshrathi/word-wrap@^1.2.3": - version "1.2.6" - resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" - integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== - -"@ampproject/remapping@^2.2.0", "@ampproject/remapping@^2.2.1": - version "2.2.1" - resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" - integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg== - dependencies: - "@jridgewell/gen-mapping" "^0.3.0" - "@jridgewell/trace-mapping" "^0.3.9" - -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.22.13", "@babel/code-frame@^7.23.5": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" - integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA== - dependencies: - "@babel/highlight" "^7.23.4" - chalk "^2.4.2" - -"@babel/compat-data@^7.22.9": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.23.5.tgz#ffb878728bb6bdcb6f4510aa51b1be9afb8cfd98" - integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== - -"@babel/core@^7.23.3": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.5.tgz#6e23f2acbcb77ad283c5ed141f824fd9f70101c7" - integrity sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g== - dependencies: - "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.23.5" - "@babel/generator" "^7.23.5" - "@babel/helper-compilation-targets" "^7.22.15" - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helpers" "^7.23.5" - "@babel/parser" "^7.23.5" - "@babel/template" "^7.22.15" - "@babel/traverse" "^7.23.5" - "@babel/types" "^7.23.5" - convert-source-map "^2.0.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.2.3" - semver "^6.3.1" - -"@babel/generator@^7.23.5": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.5.tgz#17d0a1ea6b62f351d281350a5f80b87a810c4755" - integrity sha512-BPssCHrBD+0YrxviOa3QzpqwhNIXKEtOa2jQrm4FlmkC2apYgRnQcmPWiGZDlGxiNtltnUFolMe8497Esry+jA== - dependencies: - "@babel/types" "^7.23.5" - "@jridgewell/gen-mapping" "^0.3.2" - "@jridgewell/trace-mapping" "^0.3.17" - jsesc "^2.5.1" - -"@babel/helper-compilation-targets@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz#0698fc44551a26cf29f18d4662d5bf545a6cfc52" - integrity sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw== - dependencies: - "@babel/compat-data" "^7.22.9" - "@babel/helper-validator-option" "^7.22.15" - browserslist "^4.21.9" - lru-cache "^5.1.1" - semver "^6.3.1" - -"@babel/helper-environment-visitor@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" - integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== - -"@babel/helper-function-name@^7.23.0": - version "7.23.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" - integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== - dependencies: - "@babel/template" "^7.22.15" - "@babel/types" "^7.23.0" - -"@babel/helper-hoist-variables@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" - integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-module-imports@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0" - integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w== - dependencies: - "@babel/types" "^7.22.15" - -"@babel/helper-module-transforms@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz#d7d12c3c5d30af5b3c0fcab2a6d5217773e2d0f1" - integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== - dependencies: - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-module-imports" "^7.22.15" - "@babel/helper-simple-access" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/helper-validator-identifier" "^7.22.20" - -"@babel/helper-plugin-utils@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz#dd7ee3735e8a313b9f7b05a773d892e88e6d7295" - integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg== - -"@babel/helper-simple-access@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz#4938357dc7d782b80ed6dbb03a0fba3d22b1d5de" - integrity sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-split-export-declaration@^7.22.6": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" - integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== - dependencies: - "@babel/types" "^7.22.5" - -"@babel/helper-string-parser@^7.23.4": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz#9478c707febcbbe1ddb38a3d91a2e054ae622d83" - integrity sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ== - -"@babel/helper-validator-identifier@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" - integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== - -"@babel/helper-validator-option@^7.22.15": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" - integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== - -"@babel/helpers@^7.23.5": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.23.5.tgz#52f522840df8f1a848d06ea6a79b79eefa72401e" - integrity sha512-oO7us8FzTEsG3U6ag9MfdF1iA/7Z6dz+MtFhifZk8C8o453rGJFFWUP1t+ULM9TUIAzC9uxXEiXjOiVMyd7QPg== - dependencies: - "@babel/template" "^7.22.15" - "@babel/traverse" "^7.23.5" - "@babel/types" "^7.23.5" - -"@babel/highlight@^7.23.4": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.23.4.tgz#edaadf4d8232e1a961432db785091207ead0621b" - integrity sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A== - dependencies: - "@babel/helper-validator-identifier" "^7.22.20" - chalk "^2.4.2" - js-tokens "^4.0.0" - -"@babel/parser@^7.1.0", "@babel/parser@^7.20.7", "@babel/parser@^7.22.15", "@babel/parser@^7.23.5": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.5.tgz#37dee97c4752af148e1d38c34b856b2507660563" - integrity sha512-hOOqoiNXrmGdFbhgCzu6GiURxUgM27Xwd/aPuu8RfHEZPBzL1Z54okAHAQjXfcQNwvrlkAmAp4SlRTZ45vlthQ== - -"@babel/plugin-transform-react-jsx-self@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.23.3.tgz#ed3e7dadde046cce761a8e3cf003a13d1a7972d9" - integrity sha512-qXRvbeKDSfwnlJnanVRp0SfuWE5DQhwQr5xtLBzp56Wabyo+4CMosF6Kfp+eOD/4FYpql64XVJ2W0pVLlJZxOQ== - dependencies: - "@babel/helper-plugin-utils" "^7.22.5" - -"@babel/plugin-transform-react-jsx-source@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.23.3.tgz#03527006bdc8775247a78643c51d4e715fe39a3e" - integrity sha512-91RS0MDnAWDNvGC6Wio5XYkyWI39FMFO+JK9+4AlgaTH+yWwVTsw7/sn6LK0lH7c5F+TFkpv/3LfCJ1Ydwof/g== - dependencies: - "@babel/helper-plugin-utils" "^7.22.5" - -"@babel/runtime@^7.1.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.0", "@babel/runtime@^7.2.0", "@babel/runtime@^7.23.2": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.5.tgz#11edb98f8aeec529b82b211028177679144242db" - integrity sha512-NdUTHcPe4C99WxPub+K9l9tK5/lV4UXIoaHSYgzco9BCyjKAAwzdBI+wWtYqHt7LJdbo74ZjRPJgzVweq1sz0w== - dependencies: - regenerator-runtime "^0.14.0" - -"@babel/template@^7.22.15": - version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" - integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== - dependencies: - "@babel/code-frame" "^7.22.13" - "@babel/parser" "^7.22.15" - "@babel/types" "^7.22.15" - -"@babel/traverse@^7.23.5": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.5.tgz#f546bf9aba9ef2b042c0e00d245990c15508e7ec" - integrity sha512-czx7Xy5a6sapWWRx61m1Ke1Ra4vczu1mCTtJam5zRTBOonfdJ+S/B6HYmGYu3fJtr8GGET3si6IhgWVBhJ/m8w== - dependencies: - "@babel/code-frame" "^7.23.5" - "@babel/generator" "^7.23.5" - "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-function-name" "^7.23.0" - "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.23.5" - "@babel/types" "^7.23.5" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.5": - version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.5.tgz#48d730a00c95109fa4393352705954d74fb5b602" - integrity sha512-ON5kSOJwVO6xXVRTvOI0eOnWe7VdUcIpsovGo9U/Br4Ie4UVFQTboO2cYnDhAGU6Fp+UxSiT+pMft0SMHfuq6w== - dependencies: - "@babel/helper-string-parser" "^7.23.4" - "@babel/helper-validator-identifier" "^7.22.20" - to-fast-properties "^2.0.0" - -"@bcoe/v8-coverage@^0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" - integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== - -"@esbuild/android-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz#984b4f9c8d0377443cc2dfcef266d02244593622" - integrity sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ== - -"@esbuild/android-arm64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.8.tgz#fb7130103835b6d43ea499c3f30cfb2b2ed58456" - integrity sha512-B8JbS61bEunhfx8kasogFENgQfr/dIp+ggYXwTqdbMAgGDhRa3AaPpQMuQU0rNxDLECj6FhDzk1cF9WHMVwrtA== - -"@esbuild/android-arm@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.18.20.tgz#fedb265bc3a589c84cc11f810804f234947c3682" - integrity sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw== - -"@esbuild/android-arm@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.8.tgz#b46e4d9e984e6d6db6c4224d72c86b7757e35bcb" - integrity sha512-31E2lxlGM1KEfivQl8Yf5aYU/mflz9g06H6S15ITUFQueMFtFjESRMoDSkvMo8thYvLBax+VKTPlpnx+sPicOA== - -"@esbuild/android-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.18.20.tgz#35cf419c4cfc8babe8893d296cd990e9e9f756f2" - integrity sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg== - -"@esbuild/android-x64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.8.tgz#a13db9441b5a4f4e4fec4a6f8ffacfea07888db7" - integrity sha512-rdqqYfRIn4jWOp+lzQttYMa2Xar3OK9Yt2fhOhzFXqg0rVWEfSclJvZq5fZslnz6ypHvVf3CT7qyf0A5pM682A== - -"@esbuild/darwin-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz#08172cbeccf95fbc383399a7f39cfbddaeb0d7c1" - integrity sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA== - -"@esbuild/darwin-arm64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.8.tgz#49f5718d36541f40dd62bfdf84da9c65168a0fc2" - integrity sha512-RQw9DemMbIq35Bprbboyf8SmOr4UXsRVxJ97LgB55VKKeJOOdvsIPy0nFyF2l8U+h4PtBx/1kRf0BelOYCiQcw== - -"@esbuild/darwin-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz#d70d5790d8bf475556b67d0f8b7c5bdff053d85d" - integrity sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ== - -"@esbuild/darwin-x64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.8.tgz#75c5c88371eea4bfc1f9ecfd0e75104c74a481ac" - integrity sha512-3sur80OT9YdeZwIVgERAysAbwncom7b4bCI2XKLjMfPymTud7e/oY4y+ci1XVp5TfQp/bppn7xLw1n/oSQY3/Q== - -"@esbuild/freebsd-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz#98755cd12707f93f210e2494d6a4b51b96977f54" - integrity sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw== - -"@esbuild/freebsd-arm64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.8.tgz#9d7259fea4fd2b5f7437b52b542816e89d7c8575" - integrity sha512-WAnPJSDattvS/XtPCTj1tPoTxERjcTpH6HsMr6ujTT+X6rylVe8ggxk8pVxzf5U1wh5sPODpawNicF5ta/9Tmw== - -"@esbuild/freebsd-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz#c1eb2bff03915f87c29cece4c1a7fa1f423b066e" - integrity sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ== - -"@esbuild/freebsd-x64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.8.tgz#abac03e1c4c7c75ee8add6d76ec592f46dbb39e3" - integrity sha512-ICvZyOplIjmmhjd6mxi+zxSdpPTKFfyPPQMQTK/w+8eNK6WV01AjIztJALDtwNNfFhfZLux0tZLC+U9nSyA5Zg== - -"@esbuild/linux-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz#bad4238bd8f4fc25b5a021280c770ab5fc3a02a0" - integrity sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA== - -"@esbuild/linux-arm64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.8.tgz#c577932cf4feeaa43cb9cec27b89cbe0df7d9098" - integrity sha512-z1zMZivxDLHWnyGOctT9JP70h0beY54xDDDJt4VpTX+iwA77IFsE1vCXWmprajJGa+ZYSqkSbRQ4eyLCpCmiCQ== - -"@esbuild/linux-arm@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz#3e617c61f33508a27150ee417543c8ab5acc73b0" - integrity sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg== - -"@esbuild/linux-arm@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.8.tgz#d6014d8b98b5cbc96b95dad3d14d75bb364fdc0f" - integrity sha512-H4vmI5PYqSvosPaTJuEppU9oz1dq2A7Mr2vyg5TF9Ga+3+MGgBdGzcyBP7qK9MrwFQZlvNyJrvz6GuCaj3OukQ== - -"@esbuild/linux-ia32@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz#699391cccba9aee6019b7f9892eb99219f1570a7" - integrity sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA== - -"@esbuild/linux-ia32@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.8.tgz#2379a0554307d19ac4a6cdc15b08f0ea28e7a40d" - integrity sha512-1a8suQiFJmZz1khm/rDglOc8lavtzEMRo0v6WhPgxkrjcU0LkHj+TwBrALwoz/OtMExvsqbbMI0ChyelKabSvQ== - -"@esbuild/linux-loong64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz#e6fccb7aac178dd2ffb9860465ac89d7f23b977d" - integrity sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg== - -"@esbuild/linux-loong64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.8.tgz#e2a5bbffe15748b49356a6cd7b2d5bf60c5a7123" - integrity sha512-fHZWS2JJxnXt1uYJsDv9+b60WCc2RlvVAy1F76qOLtXRO+H4mjt3Tr6MJ5l7Q78X8KgCFudnTuiQRBhULUyBKQ== - -"@esbuild/linux-mips64el@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz#eeff3a937de9c2310de30622a957ad1bd9183231" - integrity sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ== - -"@esbuild/linux-mips64el@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.8.tgz#1359331e6f6214f26f4b08db9b9df661c57cfa24" - integrity sha512-Wy/z0EL5qZYLX66dVnEg9riiwls5IYnziwuju2oUiuxVc+/edvqXa04qNtbrs0Ukatg5HEzqT94Zs7J207dN5Q== - -"@esbuild/linux-ppc64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz#2f7156bde20b01527993e6881435ad79ba9599fb" - integrity sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA== - -"@esbuild/linux-ppc64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.8.tgz#9ba436addc1646dc89dae48c62d3e951ffe70951" - integrity sha512-ETaW6245wK23YIEufhMQ3HSeHO7NgsLx8gygBVldRHKhOlD1oNeNy/P67mIh1zPn2Hr2HLieQrt6tWrVwuqrxg== - -"@esbuild/linux-riscv64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz#6628389f210123d8b4743045af8caa7d4ddfc7a6" - integrity sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A== - -"@esbuild/linux-riscv64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.8.tgz#fbcf0c3a0b20f40b5fc31c3b7695f0769f9de66b" - integrity sha512-T2DRQk55SgoleTP+DtPlMrxi/5r9AeFgkhkZ/B0ap99zmxtxdOixOMI570VjdRCs9pE4Wdkz7JYrsPvsl7eESg== - -"@esbuild/linux-s390x@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz#255e81fb289b101026131858ab99fba63dcf0071" - integrity sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ== - -"@esbuild/linux-s390x@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.8.tgz#989e8a05f7792d139d5564ffa7ff898ac6f20a4a" - integrity sha512-NPxbdmmo3Bk7mbNeHmcCd7R7fptJaczPYBaELk6NcXxy7HLNyWwCyDJ/Xx+/YcNH7Im5dHdx9gZ5xIwyliQCbg== - -"@esbuild/linux-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz#c7690b3417af318a9b6f96df3031a8865176d338" - integrity sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w== - -"@esbuild/linux-x64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.8.tgz#b187295393a59323397fe5ff51e769ec4e72212b" - integrity sha512-lytMAVOM3b1gPypL2TRmZ5rnXl7+6IIk8uB3eLsV1JwcizuolblXRrc5ShPrO9ls/b+RTp+E6gbsuLWHWi2zGg== - -"@esbuild/netbsd-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz#30e8cd8a3dded63975e2df2438ca109601ebe0d1" - integrity sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A== - -"@esbuild/netbsd-x64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.8.tgz#c1ec0e24ea82313cb1c7bae176bd5acd5bde7137" - integrity sha512-hvWVo2VsXz/8NVt1UhLzxwAfo5sioj92uo0bCfLibB0xlOmimU/DeAEsQILlBQvkhrGjamP0/el5HU76HAitGw== - -"@esbuild/openbsd-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz#7812af31b205055874c8082ea9cf9ab0da6217ae" - integrity sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg== - -"@esbuild/openbsd-x64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.8.tgz#0c5b696ac66c6d70cf9ee17073a581a28af9e18d" - integrity sha512-/7Y7u77rdvmGTxR83PgaSvSBJCC2L3Kb1M/+dmSIvRvQPXXCuC97QAwMugBNG0yGcbEGfFBH7ojPzAOxfGNkwQ== - -"@esbuild/sunos-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz#d5c275c3b4e73c9b0ecd38d1ca62c020f887ab9d" - integrity sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ== - -"@esbuild/sunos-x64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.8.tgz#2a697e1f77926ff09fcc457d8f29916d6cd48fb1" - integrity sha512-9Lc4s7Oi98GqFA4HzA/W2JHIYfnXbUYgekUP/Sm4BG9sfLjyv6GKKHKKVs83SMicBF2JwAX6A1PuOLMqpD001w== - -"@esbuild/win32-arm64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz#73bc7f5a9f8a77805f357fab97f290d0e4820ac9" - integrity sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg== - -"@esbuild/win32-arm64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.8.tgz#ec029e62a2fca8c071842ecb1bc5c2dd20b066f1" - integrity sha512-rq6WzBGjSzihI9deW3fC2Gqiak68+b7qo5/3kmB6Gvbh/NYPA0sJhrnp7wgV4bNwjqM+R2AApXGxMO7ZoGhIJg== - -"@esbuild/win32-ia32@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz#ec93cbf0ef1085cc12e71e0d661d20569ff42102" - integrity sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g== - -"@esbuild/win32-ia32@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.8.tgz#cbb9a3146bde64dc15543e48afe418c7a3214851" - integrity sha512-AIAbverbg5jMvJznYiGhrd3sumfwWs8572mIJL5NQjJa06P8KfCPWZQ0NwZbPQnbQi9OWSZhFVSUWjjIrn4hSw== - -"@esbuild/win32-x64@0.18.20": - version "0.18.20" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz#786c5f41f043b07afb1af37683d7c33668858f6d" - integrity sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ== - -"@esbuild/win32-x64@0.19.8": - version "0.19.8" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.8.tgz#c8285183dbdb17008578dbacb6e22748709b4822" - integrity sha512-bfZ0cQ1uZs2PqpulNL5j/3w+GDhP36k1K5c38QdQg+Swy51jFZWWeIkteNsufkQxp986wnqRRsb/bHbY1WQ7TA== - -"@eslint-community/eslint-utils@^4.2.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" - integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== - dependencies: - eslint-visitor-keys "^3.3.0" - -"@eslint-community/regexpp@^4.4.0", "@eslint-community/regexpp@^4.6.1": - version "4.10.0" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" - integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== - -"@eslint/eslintrc@^2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" - integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== - dependencies: - ajv "^6.12.4" - debug "^4.3.2" - espree "^9.6.0" - globals "^13.19.0" - ignore "^5.2.0" - import-fresh "^3.2.1" - js-yaml "^4.1.0" - minimatch "^3.1.2" - strip-json-comments "^3.1.1" - -"@eslint/js@8.55.0": - version "8.55.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.55.0.tgz#b721d52060f369aa259cf97392403cb9ce892ec6" - integrity sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA== - -"@gmod/bam@^1.1.18": - version "1.1.18" - resolved "https://registry.yarnpkg.com/@gmod/bam/-/bam-1.1.18.tgz#de28533289f0f659f962a59226d9c342590a0d50" - integrity sha512-2Sn4zLV7DKYyrmYbNJRMchKGfhfIVm6LZEl2h7MSuGmAEtGfa1RBVOfG8Cu6VDC+lIFrgS4ys4vUFFxaWaxgSQ== - dependencies: - "@gmod/bgzf-filehandle" "^1.4.4" - abortable-promise-cache "^1.5.0" - buffer-crc32 "^0.2.13" - cross-fetch "^3.0.2" - generic-filehandle "^3.0.0" - long "^4.0.0" - object.entries-ponyfill "^1.0.1" - quick-lru "^2.0.0" - -"@gmod/bbi@^3.0.1": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@gmod/bbi/-/bbi-3.0.1.tgz#ce4e2988043bf036e0a148f69a3f235e094d0e6b" - integrity sha512-DjvRj/qPPWBSjEjgVsadQmmWBK+EmtYr9xLZ4y7IsnuuHiE+sDgbnSA51OKiKNGLM3srydq22pynNLqswB1XjQ== - dependencies: - abortable-promise-cache "^1.4.1" - binary-parser "^2.1.0" - generic-filehandle "^3.0.0" - pako "^2.0.0" - quick-lru "^4.0.0" - rxjs "^7.8.0" - -"@gmod/bed@^2.1.2": - version "2.1.2" - resolved "https://registry.yarnpkg.com/@gmod/bed/-/bed-2.1.2.tgz#02e27a3a75269dec06ecc22f0ff7eb10b8affc42" - integrity sha512-LnCmA+jb0xfbSWO7isi1dVvqbQi8Icqaj8FeUcnCc8t4jiNe1eFoe1YU8Chn7a8EDGFqS06kMNpO1vodO+q4IA== - -"@gmod/bgzf-filehandle@^1.3.3", "@gmod/bgzf-filehandle@^1.4.4": - version "1.4.7" - resolved "https://registry.yarnpkg.com/@gmod/bgzf-filehandle/-/bgzf-filehandle-1.4.7.tgz#de2b1fbf2f56e15c31179bd42cd8bce7a8d1ada8" - integrity sha512-f/oXwWwsBe4nYN82mQ+Sz++/zH6EOyBCRqxFdv04SBkreQvilf3cql6F8ZAMMBq1f/abzBc0U0zJIMF9CLM7QQ== - dependencies: - es6-promisify "^7.0.0" - generic-filehandle "^3.0.0" - long "^4.0.0" - pako "^1.0.11" - -"@gmod/gff@^1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@gmod/gff/-/gff-1.3.0.tgz#d231a6f807cfb8f191c26c6410021c17155e4093" - integrity sha512-OjEnQLR6iIcrau603blFfUkmnWGDVfOu/LQoJNa7TsvKnjWlHYPlvqb5h2IV7wI+zElDY648mQ9zrElt2uR80A== - dependencies: - stream-browserify "^3.0.0" - -"@gmod/tabix@^1.5.6": - version "1.5.11" - resolved "https://registry.yarnpkg.com/@gmod/tabix/-/tabix-1.5.11.tgz#c7fb06a20d2048a487d2cf65d0d360cc2111ac96" - integrity sha512-zYgivq8r9pSwNKbzAqHSSfRQ3KEe+oiTNhABJIW9kBqjiKW4m7ncqKhhcmxjG4afhJNUzBJ9Gt/w3grbG+Q5bA== - dependencies: - "@gmod/bgzf-filehandle" "^1.3.3" - abortable-promise-cache "^1.4.1" - generic-filehandle "^3.0.0" - long "^4.0.0" - quick-lru "^4.0.0" - -"@gmod/vcf@^5.0.10": - version "5.0.10" - resolved "https://registry.yarnpkg.com/@gmod/vcf/-/vcf-5.0.10.tgz#6c2d7952b15f61642454be90119ea89fd3c227de" - integrity sha512-o7QuPcOeXlJpzwQaFmgojhNvJE4yB9fhrfVEDKpkDjV27pAqwMy89367vtXu4JfBFE9t4zZ6sQRkqYaJ+cIheg== - -"@humanwhocodes/config-array@^0.11.13": - version "0.11.13" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.13.tgz#075dc9684f40a531d9b26b0822153c1e832ee297" - integrity sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ== - dependencies: - "@humanwhocodes/object-schema" "^2.0.1" - debug "^4.1.1" - minimatch "^3.0.5" - -"@humanwhocodes/module-importer@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" - integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== - -"@humanwhocodes/object-schema@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz#e5211452df060fa8522b55c7b3c0c4d1981cb044" - integrity sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw== - -"@hutson/parse-repository-url@^3.0.0": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" - integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== - -"@icons/material@^0.2.4": - version "0.2.4" - resolved "https://registry.yarnpkg.com/@icons/material/-/material-0.2.4.tgz#e90c9f71768b3736e76d7dd6783fc6c2afa88bc8" - integrity sha512-QPcGmICAPbGLGb6F/yNf/KzKqvFx8z5qx3D1yFqVAjoFmXK35EgyW+cJ57Te3CNsmzblwtzakLGFqHPqrfb4Tw== - -"@isaacs/cliui@^8.0.2": - version "8.0.2" - resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" - integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== - dependencies: - string-width "^5.1.2" - string-width-cjs "npm:string-width@^4.2.0" - strip-ansi "^7.0.1" - strip-ansi-cjs "npm:strip-ansi@^6.0.1" - wrap-ansi "^8.1.0" - wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" - -"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" - integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== - -"@jest/schemas@^29.6.3": - version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" - integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== - dependencies: - "@sinclair/typebox" "^0.27.8" - -"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" - integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== - dependencies: - "@jridgewell/set-array" "^1.0.1" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping" "^0.3.9" - -"@jridgewell/resolve-uri@^3.1.0": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" - integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== - -"@jridgewell/set-array@^1.0.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" - integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== - -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15": - version "1.4.15" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" - integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== - -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": - version "0.3.20" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f" - integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== - dependencies: - "@jridgewell/resolve-uri" "^3.1.0" - "@jridgewell/sourcemap-codec" "^1.4.14" - -"@juggle/resize-observer@^3.3.1": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60" - integrity sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA== - -"@nodelib/fs.scandir@2.1.5": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" - integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== - dependencies: - "@nodelib/fs.stat" "2.0.5" - run-parallel "^1.1.9" - -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" - integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== - -"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": - version "1.2.8" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" - integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== - dependencies: - "@nodelib/fs.scandir" "2.1.5" - fastq "^1.6.0" - -"@pixi/accessibility@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/accessibility/-/accessibility-6.5.10.tgz#53727df881251ad0db545de93f8b273c5b34ff67" - integrity sha512-URrI1H+1kjjHSyhY1QXcUZ8S3omdVTrXg5y0gndtpOhIelErBTC9NWjJfw6s0Rlmv5+x5VAitQTgw9mRiatDgw== - -"@pixi/app@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/app/-/app-6.5.10.tgz#4877929bd53595484c1d334e4cda43bb9d27eca1" - integrity sha512-VsNHLajZ5Dbc/Zrj7iWmIl3eu6Fec+afjW/NXXezD8Sp3nTDF0bv5F+GDgN/zSc2gqIvPHyundImT7hQGBDghg== - -"@pixi/compressed-textures@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/compressed-textures/-/compressed-textures-6.5.10.tgz#3d2f8973f504af1f8db5c2a1338028d9b9f84ece" - integrity sha512-41NT5mkfam47DrkB8xMp3HUZDt7139JMB6rVNOmb3u2vm+2mdy9tzi5s9nN7bG9xgXlchxcFzytTURk+jwXVJA== - -"@pixi/constants@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/constants/-/constants-6.5.10.tgz#ac0a9c55db0d3dadcd85aa31a251db493c3bd80b" - integrity sha512-PUF2Y9YISRu5eVrVVHhHCWpc/KmxQTg3UH8rIUs8UI9dCK41/wsPd3pEahzf7H47v7x1HCohVZcFO3XQc1bUDw== - -"@pixi/core@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/core/-/core-6.5.10.tgz#b92207164526fa4a6d285ccd13cb62bdee50b493" - integrity sha512-Gdzp5ENypyglvsh5Gv3teUZnZnmizo4xOsL+QqmWALdFlJXJwLJMVhKVThV/q/095XR6i4Ou54oshn+m4EkuFw== - dependencies: - "@types/offscreencanvas" "^2019.6.4" - -"@pixi/display@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/display/-/display-6.5.10.tgz#3ebe4c56556086160087946d5437808b6fadae08" - integrity sha512-NxFdDDxlbH5fQkzGHraLGoTMucW9pVgXqQm13TSmkA3NWIi/SItHL4qT2SI8nmclT9Vid1VDEBCJFAbdeuQw1Q== - -"@pixi/extensions@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/extensions/-/extensions-6.5.10.tgz#5909d0b3f3c5ecfdc74efe5db2869a64a9cecb8c" - integrity sha512-EIUGza+E+sCy3dupuIjvRK/WyVyfSzHb5XsxRaxNrPwvG1iIUIqNqZ3owLYCo4h17fJWrj/yXVufNNtUKQccWQ== - -"@pixi/extract@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/extract/-/extract-6.5.10.tgz#0d198b437aecb1bc358b59a70a268c816e6ca810" - integrity sha512-hXFIc4EGs14GFfXAjT1+6mzopzCMWeXeai38/Yod3vuBXkkp8+ksen6kE09vTnB9l1IpcIaCM+XZEokuqoGX2A== - -"@pixi/filter-alpha@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/filter-alpha/-/filter-alpha-6.5.10.tgz#0eada7e25bc896e89e173ac318a617d09e280bea" - integrity sha512-GWHLJvY0QOIDRjVx0hdUff6nl/PePQg84i8XXPmANrvA+gJ/eSRTQRmQcdgInQfawENADB/oRqpcCct6IAcKpQ== - -"@pixi/filter-blur@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/filter-blur/-/filter-blur-6.5.10.tgz#255cfde383218ddc40b2d0aa8dc6a864435723d1" - integrity sha512-LJsRocVOdM9hTzZKjP+jmkfoL1nrJi5XpR0ItgRN8fflOC7A7Ln4iPe7nukbbq3H7QhZSunbygMubbO6xhThZw== - -"@pixi/filter-color-matrix@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/filter-color-matrix/-/filter-color-matrix-6.5.10.tgz#5410e85b194631096725ba256d54ec5d7de4e5f0" - integrity sha512-C2S44/EoWTrhqedLWOZTq9GZV5loEq1+MhyK9AUzEubWGMHhou1Juhn2mRZ7R6flKPCRQNKrXpStUwCAouud3Q== - -"@pixi/filter-displacement@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/filter-displacement/-/filter-displacement-6.5.10.tgz#4888a20c3680f4535dd72f92bd140211f3422176" - integrity sha512-fbblMYyPX/hO3Tpoaa4tOBYxqp4TxjNrz6xyt15tKSVxWQElk+Tx98GJ+aaBoiHOKt8ezzHplStWoHG++JIv/w== - -"@pixi/filter-fxaa@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/filter-fxaa/-/filter-fxaa-6.5.10.tgz#838699992e5a77ff0bd54232f8d0ac3561405189" - integrity sha512-wbHL9UtY3g7jTyvO8JaZks6DqV8AO5c96Hfu0zfndWBPs79Ul6/sq3LD2eE+yq5vK5T2R9Sr4s54ls1JT3Sppg== - -"@pixi/filter-noise@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/filter-noise/-/filter-noise-6.5.10.tgz#b32c0761d8489657b07eae6af7837a518cc50586" - integrity sha512-CX+/06NVaw3HsjipZVb7aemkca0TC8I6qfKI4lx2ugxS/6G6zkY5zqd8+nVSXW4DpUXB6eT0emwfRv6N00NvuA== - -"@pixi/graphics@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/graphics/-/graphics-6.5.10.tgz#7a5a5d263a612629b8df59479b99ce938353ced2" - integrity sha512-KPHGJ910fi8bRQQ+VcTIgrK+bKIm8yAQaZKPqMtm14HzHPGcES6HkgeNY1sd7m8J4aS9btm5wOSyFu0p5IzTpA== - -"@pixi/interaction@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/interaction/-/interaction-6.5.10.tgz#c477d42206f3a2ed11bf06f3147bcd3906a872fa" - integrity sha512-v809pJmXA2B9dV/vdrDMUqJT+fBB/ARZli2YRmI2dPbEbkaYr8FNmxCAJnwT8o+ymTx044Ie820hn9tVrtMtfA== - -"@pixi/loaders@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/loaders/-/loaders-6.5.10.tgz#7d7bdc1686eae2842e4d701abd4b480f9fcd5930" - integrity sha512-AuK7mXBmyVsDFL9DDFPB8sqP8fwQ2NOktvu98bQuJl0/p/UeK/0OAQnF3wcf3FeBv5YGXfNHL21c2DCisjKfTg== - -"@pixi/math@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/math/-/math-6.5.10.tgz#0d9b9e12a7e9a920306e1425901348b9c7f054ad" - integrity sha512-fxeu7ykVbMGxGV2S3qRTupHToeo1hdWBm8ihyURn3BMqJZe2SkZEECPd5RyvIuuNUtjRnmhkZRnF3Jsz2S+L0g== - -"@pixi/mesh-extras@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/mesh-extras/-/mesh-extras-6.5.10.tgz#2cfe5ee4bff233bbe71fd9731e493b3abb4e1fdb" - integrity sha512-UCG7OOPPFeikrX09haCibCMR0jPQ4UJ+4HiYiAv/3dahq5eEzBx+yAwVtxcVCjonkTf/lu5SzmHdzpsbHLx5aw== - -"@pixi/mesh@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/mesh/-/mesh-6.5.10.tgz#8a08326e60e191d9058cdf18468be2007284b376" - integrity sha512-tUNPsdp5/t/yRsCmfxIcufIfbQVzgAlMNgQ1igWOkSxzhB7vlEbZ8ZLLW5tQcNyM/r7Nhjz+RoB+RD+/BCtvlA== - -"@pixi/mixin-cache-as-bitmap@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/mixin-cache-as-bitmap/-/mixin-cache-as-bitmap-6.5.10.tgz#5f8a7ee6620c9734bcce091508004a4a818f13e9" - integrity sha512-HV4qPZt8R7uuPZf1XE5S0e3jbN4+/EqgAIkueIyK3Em+0IO1rCmIbzzYxFPxkElMUu5VvN1r4hXK846z9ITnhw== - -"@pixi/mixin-get-child-by-name@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/mixin-get-child-by-name/-/mixin-get-child-by-name-6.5.10.tgz#2fa1002998381be562ec0aa35b44d866d2d435e3" - integrity sha512-YYd9wjnI/4aKY0H5Ij413UppVZn3YE1No2CZrNevV6WbhylsJucowY3hJihtl9mxkpwtaUIyWMjmphkbOinbzA== - -"@pixi/mixin-get-global-position@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/mixin-get-global-position/-/mixin-get-global-position-6.5.10.tgz#963395e60c58bc2631f7eb4c4fd479dedbf7a1ec" - integrity sha512-A83gTZP9CdQAyrAvOZl1P707Q0QvIC0V8UnBAMd4GxuhMOXJtXVPCdmfPVXUrfoywgnH+/Bgimq5xhsXTf8Hzg== - -"@pixi/particle-container@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/particle-container/-/particle-container-6.5.10.tgz#863bc03fa45f30090ad90890be0ad74031aa3ed3" - integrity sha512-CCNAdYGzKoOc3FtK2kyWCNjygdHppeOEqqK189yhg3yRSsvby+HMms/cM6bLK/4Vf6mFoAy1na3w/oXpqTR2Ag== - -"@pixi/polyfill@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/polyfill/-/polyfill-6.5.10.tgz#4a74cf5c709e429f2220b840944ce3215a871aa5" - integrity sha512-KDTWyr285VvPM8GGTVIZAhmxGrOlTznUGK/9kWS3GtrogwLWn41S/86Yej1gYvotVyUomCcOok33Jzahb+vX1w== - dependencies: - object-assign "^4.1.1" - promise-polyfill "^8.2.0" - -"@pixi/prepare@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/prepare/-/prepare-6.5.10.tgz#25b57593005f4ebf14abbb381139b5d6191336b9" - integrity sha512-PHMApz/GPg7IX/7+2S98criN2+Mp+fgiKpojV9cnl0SlW2zMxfAHBBi8zik9rHBgjx8X6d6bR0MG1rPtb6vSxQ== - -"@pixi/runner@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/runner/-/runner-6.5.10.tgz#a103dcb70025f13523995b80728077c8071f5ba7" - integrity sha512-4HiHp6diCmigJT/DSbnqQP62OfWKmZB7zPWMdV1AEdr4YT1QxzXAW1wHg7dkoEfyTHqZKl0tm/zcqKq/iH7tMA== - -"@pixi/settings@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/settings/-/settings-6.5.10.tgz#11de6bd63b8a1182cd3bd7ea3df698de92d18e9a" - integrity sha512-ypAS5L7pQ2Qb88yQK72bXtc7sD8OrtLWNXdZ/gnw5kwSWCFaOSoqhKqJCXrR5DQtN98+RQefwbEAmMvqobhFyw== - -"@pixi/sprite-animated@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/sprite-animated/-/sprite-animated-6.5.10.tgz#8966d88e536919d7f6380d2853555b038b997136" - integrity sha512-x1kayucAqpVbNk+j+diC/7sQGQsAl6NCH1J2/EEaiQjlV3GOx1MXS9Tft1N1Y1y7otbg1XsnBd60/Yzcp05pxA== - -"@pixi/sprite-tiling@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/sprite-tiling/-/sprite-tiling-6.5.10.tgz#b4d692a49145f174e399dc2c7ed6b290f5f73a9a" - integrity sha512-lDFcPuwExrdJhli+WmjPivChjeCG6NiRl36iQ8n2zVi/MYVv9qfKCA6IdU7HBWk1AZdsg6KUTpwfmVLUI+qz3w== - -"@pixi/sprite@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/sprite/-/sprite-6.5.10.tgz#2acdf87f8f12e5bf6077117b5e383c07d6803e52" - integrity sha512-UiK+8LgM9XQ/SBDKjRgZ8WggdOSlFRXqiWjEZVmNkiyU8HvXeFzWPRhpc8RR1zDwAUhZWKtMhF8X/ba9m+z2lg== - -"@pixi/spritesheet@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/spritesheet/-/spritesheet-6.5.10.tgz#c725d85206eec0ea36d60ff3ff138c01a9201bb0" - integrity sha512-7uOZ1cYyYtPb0ZEgXV1SZ8ujtluZNY0TL5z3+Qc8cgGGZK/MaWG7N6Wf+uR4BR2x8FLNwcyN5IjbQDKCpblrmg== - -"@pixi/text-bitmap@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/text-bitmap/-/text-bitmap-6.5.10.tgz#bd9ca59f091dbb24c60b8eb463c24cfab93d142b" - integrity sha512-g/iFIMGp6Pfi0BvX6Ykp48Z6JXVgKOrc7UCIR9CM21wYcCiQGqtdFwstV236xk6/D8NToUtSOcifhtQ28dVTdQ== - -"@pixi/text@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/text/-/text-6.5.10.tgz#5e6f62343d9148d29a861836ac81c8f5fe7b36d0" - integrity sha512-ikwkonLJ+6QmEVW8Ji9fS5CjrKNbU4mHzYuwRQas/VJQuSWgd0myCcaw6ZbF1oSfQe70HgbNOR0sH8Q3Com0qg== - -"@pixi/ticker@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/ticker/-/ticker-6.5.10.tgz#e9d47bb7fe32600d7febe0487c2afb8a3c7abc70" - integrity sha512-UqX1XYtzqFSirmTOy8QAK4Ccg4KkIZztrBdRPKwFSOEiKAJoGDCSBmyQBo/9aYQKGObbNnrJ7Hxv3/ucg3/1GA== - -"@pixi/utils@6.5.10": - version "6.5.10" - resolved "https://registry.yarnpkg.com/@pixi/utils/-/utils-6.5.10.tgz#05969e4e86ebfdf023de25d53b8270f04ba0c5a6" - integrity sha512-4f4qDMmAz9IoSAe08G2LAxUcEtG9jSdudfsMQT2MG+OpfToirboE6cNoO0KnLCvLzDVE/mfisiQ9uJbVA9Ssdw== - dependencies: - "@types/earcut" "^2.1.0" - earcut "^2.2.4" - eventemitter3 "^3.1.0" - url "^0.11.0" - -"@pkgjs/parseargs@^0.11.0": - version "0.11.0" - resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" - integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== - -"@playwright/test@^1.39.0": - version "1.40.1" - resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.40.1.tgz#9e66322d97b1d74b9f8718bacab15080f24cde65" - integrity sha512-EaaawMTOeEItCRvfmkI9v6rBkF1svM8wjl/YPRrg2N2Wmp+4qJYkWtJsbew1szfKKDm6fPLy4YAanBhIlf9dWw== - dependencies: - playwright "1.40.1" - -"@rollup/rollup-android-arm-eabi@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.6.1.tgz#0ea289f68ff248b50fea5716ca9f65f7d4dba3ae" - integrity sha512-0WQ0ouLejaUCRsL93GD4uft3rOmB8qoQMU05Kb8CmMtMBe7XUDLAltxVZI1q6byNqEtU7N1ZX1Vw5lIpgulLQA== - -"@rollup/rollup-android-arm64@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.6.1.tgz#27c8c67fc5de574874085a1b480ac65b3e18378e" - integrity sha512-1TKm25Rn20vr5aTGGZqo6E4mzPicCUD79k17EgTLAsXc1zysyi4xXKACfUbwyANEPAEIxkzwue6JZ+stYzWUTA== - -"@rollup/rollup-darwin-arm64@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.6.1.tgz#c5735c042980c85495411af7183dd20294763bd8" - integrity sha512-cEXJQY/ZqMACb+nxzDeX9IPLAg7S94xouJJCNVE5BJM8JUEP4HeTF+ti3cmxWeSJo+5D+o8Tc0UAWUkfENdeyw== - -"@rollup/rollup-darwin-x64@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.6.1.tgz#af844bd54abb73ca3c9cf89a31eec17861d1375d" - integrity sha512-LoSU9Xu56isrkV2jLldcKspJ7sSXmZWkAxg7sW/RfF7GS4F5/v4EiqKSMCFbZtDu2Nc1gxxFdQdKwkKS4rwxNg== - -"@rollup/rollup-linux-arm-gnueabihf@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.6.1.tgz#5e972f63c441eaf859551039b3f18db9b035977d" - integrity sha512-EfI3hzYAy5vFNDqpXsNxXcgRDcFHUWSx5nnRSCKwXuQlI5J9dD84g2Usw81n3FLBNsGCegKGwwTVsSKK9cooSQ== - -"@rollup/rollup-linux-arm64-gnu@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.6.1.tgz#f4cfbc71e3b6fdb395b28b1472414e181515c72d" - integrity sha512-9lhc4UZstsegbNLhH0Zu6TqvDfmhGzuCWtcTFXY10VjLLUe4Mr0Ye2L3rrtHaDd/J5+tFMEuo5LTCSCMXWfUKw== - -"@rollup/rollup-linux-arm64-musl@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.6.1.tgz#6a94c691830dc29bf708de7c640f494996130893" - integrity sha512-FfoOK1yP5ksX3wwZ4Zk1NgyGHZyuRhf99j64I5oEmirV8EFT7+OhUZEnP+x17lcP/QHJNWGsoJwrz4PJ9fBEXw== - -"@rollup/rollup-linux-x64-gnu@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.6.1.tgz#f07bae3f7dc532d9ea5ab36c9071db329f9a1efb" - integrity sha512-DNGZvZDO5YF7jN5fX8ZqmGLjZEXIJRdJEdTFMhiyXqyXubBa0WVLDWSNlQ5JR2PNgDbEV1VQowhVRUh+74D+RA== - -"@rollup/rollup-linux-x64-musl@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.6.1.tgz#357a34fdbf410af88ce48bd802bea6462bb9a8bc" - integrity sha512-RkJVNVRM+piYy87HrKmhbexCHg3A6Z6MU0W9GHnJwBQNBeyhCJG9KDce4SAMdicQnpURggSvtbGo9xAWOfSvIQ== - -"@rollup/rollup-win32-arm64-msvc@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.6.1.tgz#b6e97fd38281667e35297033393cd1101f4a31be" - integrity sha512-v2FVT6xfnnmTe3W9bJXl6r5KwJglMK/iRlkKiIFfO6ysKs0rDgz7Cwwf3tjldxQUrHL9INT/1r4VA0n9L/F1vQ== - -"@rollup/rollup-win32-ia32-msvc@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.6.1.tgz#a95db026c640c8128bfd38546d85342f2329beaf" - integrity sha512-YEeOjxRyEjqcWphH9dyLbzgkF8wZSKAKUkldRY6dgNR5oKs2LZazqGB41cWJ4Iqqcy9/zqYgmzBkRoVz3Q9MLw== - -"@rollup/rollup-win32-x64-msvc@4.6.1": - version "4.6.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.6.1.tgz#45785b5caf83200a34a9867ba50d69560880c120" - integrity sha512-0zfTlFAIhgz8V2G8STq8toAjsYYA6eci1hnXuyOTUFnymrtJwnS6uGKiv3v5UrPZkBlamLvrLV2iiaeqCKzb0A== - -"@sinclair/typebox@^0.27.8": - version "0.27.8" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" - integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== - -"@tootallnate/once@2": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" - integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== - -"@types/babel__core@^7.20.4": - version "7.20.5" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" - integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== - dependencies: - "@babel/parser" "^7.20.7" - "@babel/types" "^7.20.7" - "@types/babel__generator" "*" - "@types/babel__template" "*" - "@types/babel__traverse" "*" - -"@types/babel__generator@*": - version "7.6.7" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.7.tgz#a7aebf15c7bc0eb9abd638bdb5c0b8700399c9d0" - integrity sha512-6Sfsq+EaaLrw4RmdFWE9Onp63TOUue71AWb4Gpa6JxzgTYtimbM086WnYTy2U67AofR++QKCo08ZP6pwx8YFHQ== - dependencies: - "@babel/types" "^7.0.0" - -"@types/babel__template@*": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" - integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - -"@types/babel__traverse@*": - version "7.20.4" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.4.tgz#ec2c06fed6549df8bc0eb4615b683749a4a92e1b" - integrity sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA== - dependencies: - "@babel/types" "^7.20.7" - -"@types/bezier-js@^4.1.0": - version "4.1.3" - resolved "https://registry.yarnpkg.com/@types/bezier-js/-/bezier-js-4.1.3.tgz#237d4fe7e9aae7edd0c27a71f9f236f4ddc1c562" - integrity sha512-FNVVCu5mx/rJCWBxLTcL7oOajmGtWtBTDjq6DSUWUI12GeePivrZZXz+UgE0D6VYsLEjvExRO03z4hVtu3pTEQ== - -"@types/chai-subset@^1.3.3": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@types/chai-subset/-/chai-subset-1.3.5.tgz#3fc044451f26985f45625230a7f22284808b0a9a" - integrity sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A== - dependencies: - "@types/chai" "*" - -"@types/chai@*", "@types/chai@^4.3.5": - version "4.3.11" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.11.tgz#e95050bf79a932cb7305dd130254ccdf9bde671c" - integrity sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ== - -"@types/d3-array@*": - version "3.2.1" - resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-3.2.1.tgz#1f6658e3d2006c4fceac53fde464166859f8b8c5" - integrity sha512-Y2Jn2idRrLzUfAKV2LyRImR+y4oa2AntrgID95SHJxuMUrkNXmanDSed71sRNZysveJVt1hLLemQZIady0FpEg== - -"@types/d3-axis@*": - version "3.0.6" - resolved "https://registry.yarnpkg.com/@types/d3-axis/-/d3-axis-3.0.6.tgz#e760e5765b8188b1defa32bc8bb6062f81e4c795" - integrity sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw== - dependencies: - "@types/d3-selection" "*" - -"@types/d3-brush@*": - version "3.0.6" - resolved "https://registry.yarnpkg.com/@types/d3-brush/-/d3-brush-3.0.6.tgz#c2f4362b045d472e1b186cdbec329ba52bdaee6c" - integrity sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A== - dependencies: - "@types/d3-selection" "*" - -"@types/d3-chord@*": - version "3.0.6" - resolved "https://registry.yarnpkg.com/@types/d3-chord/-/d3-chord-3.0.6.tgz#1706ca40cf7ea59a0add8f4456efff8f8775793d" - integrity sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg== - -"@types/d3-color@*": - version "3.1.3" - resolved "https://registry.yarnpkg.com/@types/d3-color/-/d3-color-3.1.3.tgz#368c961a18de721da8200e80bf3943fb53136af2" - integrity sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A== - -"@types/d3-contour@*": - version "3.0.6" - resolved "https://registry.yarnpkg.com/@types/d3-contour/-/d3-contour-3.0.6.tgz#9ada3fa9c4d00e3a5093fed0356c7ab929604231" - integrity sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg== - dependencies: - "@types/d3-array" "*" - "@types/geojson" "*" - -"@types/d3-delaunay@*": - version "6.0.4" - resolved "https://registry.yarnpkg.com/@types/d3-delaunay/-/d3-delaunay-6.0.4.tgz#185c1a80cc807fdda2a3fe960f7c11c4a27952e1" - integrity sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw== - -"@types/d3-dispatch@*": - version "3.0.6" - resolved "https://registry.yarnpkg.com/@types/d3-dispatch/-/d3-dispatch-3.0.6.tgz#096efdf55eb97480e3f5621ff9a8da552f0961e7" - integrity sha512-4fvZhzMeeuBJYZXRXrRIQnvUYfyXwYmLsdiN7XXmVNQKKw1cM8a5WdID0g1hVFZDqT9ZqZEY5pD44p24VS7iZQ== - -"@types/d3-drag@*": - version "3.0.7" - resolved "https://registry.yarnpkg.com/@types/d3-drag/-/d3-drag-3.0.7.tgz#b13aba8b2442b4068c9a9e6d1d82f8bcea77fc02" - integrity sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ== - dependencies: - "@types/d3-selection" "*" - -"@types/d3-drag@^2.0.0": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@types/d3-drag/-/d3-drag-2.0.5.tgz#4ea4896e1a196e869eabec396f4c1fdb98cf54f5" - integrity sha512-VbvN7t3TelH6R0cKVXkOXmDiC7pRhtoodiPZ94p0n9TayGqg0Z/5vSxsPelVsZyVzloEo2kdZ7BO1n9ezWux+w== - dependencies: - "@types/d3-selection" "^2" - -"@types/d3-dsv@*", "@types/d3-dsv@^3.0.1": - version "3.0.7" - resolved "https://registry.yarnpkg.com/@types/d3-dsv/-/d3-dsv-3.0.7.tgz#0a351f996dc99b37f4fa58b492c2d1c04e3dac17" - integrity sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g== - -"@types/d3-ease@*": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/d3-ease/-/d3-ease-3.0.2.tgz#e28db1bfbfa617076f7770dd1d9a48eaa3b6c51b" - integrity sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA== - -"@types/d3-fetch@*": - version "3.0.7" - resolved "https://registry.yarnpkg.com/@types/d3-fetch/-/d3-fetch-3.0.7.tgz#c04a2b4f23181aa376f30af0283dbc7b3b569980" - integrity sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA== - dependencies: - "@types/d3-dsv" "*" - -"@types/d3-force@*": - version "3.0.9" - resolved "https://registry.yarnpkg.com/@types/d3-force/-/d3-force-3.0.9.tgz#dd96ccefba4386fe4ff36b8e4ee4e120c21fcf29" - integrity sha512-IKtvyFdb4Q0LWna6ymywQsEYjK/94SGhPrMfEr1TIc5OBeziTi+1jcCvttts8e0UWZIxpasjnQk9MNk/3iS+kA== - -"@types/d3-format@*": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@types/d3-format/-/d3-format-3.0.4.tgz#b1e4465644ddb3fdf3a263febb240a6cd616de90" - integrity sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g== - -"@types/d3-geo@*": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@types/d3-geo/-/d3-geo-3.1.0.tgz#b9e56a079449174f0a2c8684a9a4df3f60522440" - integrity sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ== - dependencies: - "@types/geojson" "*" - -"@types/d3-hierarchy@*": - version "3.1.6" - resolved "https://registry.yarnpkg.com/@types/d3-hierarchy/-/d3-hierarchy-3.1.6.tgz#8d3638df273ec90da34b3ac89d8784c59708cb0d" - integrity sha512-qlmD/8aMk5xGorUvTUWHCiumvgaUXYldYjNVOWtYoTYY/L+WwIEAmJxUmTgr9LoGNG0PPAOmqMDJVDPc7DOpPw== - -"@types/d3-interpolate@*": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz#412b90e84870285f2ff8a846c6eb60344f12a41c" - integrity sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA== - dependencies: - "@types/d3-color" "*" - -"@types/d3-path@*": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/d3-path/-/d3-path-3.0.2.tgz#4327f4a05d475cf9be46a93fc2e0f8d23380805a" - integrity sha512-WAIEVlOCdd/NKRYTsqCpOMHQHemKBEINf8YXMYOtXH0GA7SY0dqMB78P3Uhgfy+4X+/Mlw2wDtlETkN6kQUCMA== - -"@types/d3-polygon@*": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/d3-polygon/-/d3-polygon-3.0.2.tgz#dfae54a6d35d19e76ac9565bcb32a8e54693189c" - integrity sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA== - -"@types/d3-quadtree@*": - version "3.0.6" - resolved "https://registry.yarnpkg.com/@types/d3-quadtree/-/d3-quadtree-3.0.6.tgz#d4740b0fe35b1c58b66e1488f4e7ed02952f570f" - integrity sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg== - -"@types/d3-random@*": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/d3-random/-/d3-random-3.0.3.tgz#ed995c71ecb15e0cd31e22d9d5d23942e3300cfb" - integrity sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ== - -"@types/d3-scale-chromatic@*": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.0.3.tgz#fc0db9c10e789c351f4c42d96f31f2e4df8f5644" - integrity sha512-laXM4+1o5ImZv3RpFAsTRn3TEkzqkytiOY0Dz0sq5cnd1dtNlk6sHLon4OvqaiJb28T0S/TdsBI3Sjsy+keJrw== - -"@types/d3-scale@*": - version "4.0.8" - resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-4.0.8.tgz#d409b5f9dcf63074464bf8ddfb8ee5a1f95945bb" - integrity sha512-gkK1VVTr5iNiYJ7vWDI+yUFFlszhNMtVeneJ6lUTKPjprsvLLI9/tgEGiXJOnlINJA8FyA88gfnQsHbybVZrYQ== - dependencies: - "@types/d3-time" "*" - -"@types/d3-selection@*": - version "3.0.10" - resolved "https://registry.yarnpkg.com/@types/d3-selection/-/d3-selection-3.0.10.tgz#98cdcf986d0986de6912b5892e7c015a95ca27fe" - integrity sha512-cuHoUgS/V3hLdjJOLTT691+G2QoqAjCVLmr4kJXR4ha56w1Zdu8UUQ5TxLRqudgNjwXeQxKMq4j+lyf9sWuslg== - -"@types/d3-selection@^2", "@types/d3-selection@^2.0.0": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@types/d3-selection/-/d3-selection-2.0.4.tgz#54c33dda732cc745fd2e597e773428b491c1f79a" - integrity sha512-5a21DF7avVPmiUau8KTsv5r76yGqbMgq4QtByoCBPXUrVFWFkd3Ob4OOhmePNRbQqfUCNFjgB4sO7sUURnKcBg== - -"@types/d3-shape@*": - version "3.1.6" - resolved "https://registry.yarnpkg.com/@types/d3-shape/-/d3-shape-3.1.6.tgz#65d40d5a548f0a023821773e39012805e6e31a72" - integrity sha512-5KKk5aKGu2I+O6SONMYSNflgiP0WfZIQvVUMan50wHsLG1G94JlxEVnCpQARfTtzytuY0p/9PXXZb3I7giofIA== - dependencies: - "@types/d3-path" "*" - -"@types/d3-time-format@*": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/d3-time-format/-/d3-time-format-4.0.3.tgz#d6bc1e6b6a7db69cccfbbdd4c34b70632d9e9db2" - integrity sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg== - -"@types/d3-time@*": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/d3-time/-/d3-time-3.0.3.tgz#3c186bbd9d12b9d84253b6be6487ca56b54f88be" - integrity sha512-2p6olUZ4w3s+07q3Tm2dbiMZy5pCDfYwtLXXHUnVzXgQlZ/OyPtUz6OL382BkOuGlLXqfT+wqv8Fw2v8/0geBw== - -"@types/d3-timer@*": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/d3-timer/-/d3-timer-3.0.2.tgz#70bbda77dc23aa727413e22e214afa3f0e852f70" - integrity sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw== - -"@types/d3-transition@*": - version "3.0.8" - resolved "https://registry.yarnpkg.com/@types/d3-transition/-/d3-transition-3.0.8.tgz#677707f5eed5b24c66a1918cde05963021351a8f" - integrity sha512-ew63aJfQ/ms7QQ4X7pk5NxQ9fZH/z+i24ZfJ6tJSfqxJMrYLiK01EAs2/Rtw/JreGUsS3pLPNV644qXFGnoZNQ== - dependencies: - "@types/d3-selection" "*" - -"@types/d3-zoom@*": - version "3.0.8" - resolved "https://registry.yarnpkg.com/@types/d3-zoom/-/d3-zoom-3.0.8.tgz#dccb32d1c56b1e1c6e0f1180d994896f038bc40b" - integrity sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw== - dependencies: - "@types/d3-interpolate" "*" - "@types/d3-selection" "*" - -"@types/d3@^7.0.0": - version "7.4.3" - resolved "https://registry.yarnpkg.com/@types/d3/-/d3-7.4.3.tgz#d4550a85d08f4978faf0a4c36b848c61eaac07e2" - integrity sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww== - dependencies: - "@types/d3-array" "*" - "@types/d3-axis" "*" - "@types/d3-brush" "*" - "@types/d3-chord" "*" - "@types/d3-color" "*" - "@types/d3-contour" "*" - "@types/d3-delaunay" "*" - "@types/d3-dispatch" "*" - "@types/d3-drag" "*" - "@types/d3-dsv" "*" - "@types/d3-ease" "*" - "@types/d3-fetch" "*" - "@types/d3-force" "*" - "@types/d3-format" "*" - "@types/d3-geo" "*" - "@types/d3-hierarchy" "*" - "@types/d3-interpolate" "*" - "@types/d3-path" "*" - "@types/d3-polygon" "*" - "@types/d3-quadtree" "*" - "@types/d3-random" "*" - "@types/d3-scale" "*" - "@types/d3-scale-chromatic" "*" - "@types/d3-selection" "*" - "@types/d3-shape" "*" - "@types/d3-time" "*" - "@types/d3-time-format" "*" - "@types/d3-timer" "*" - "@types/d3-transition" "*" - "@types/d3-zoom" "*" - -"@types/earcut@^2.1.0": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@types/earcut/-/earcut-2.1.4.tgz#5811d7d333048f5a7573b22ddc84923e69596da6" - integrity sha512-qp3m9PPz4gULB9MhjGID7wpo3gJ4bTGXm7ltNDsmOvsPduTeHp8wSW9YckBj3mljeOh4F0m2z/0JKAALRKbmLQ== - -"@types/geojson@*": - version "7946.0.13" - resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.13.tgz#e6e77ea9ecf36564980a861e24e62a095988775e" - integrity sha512-bmrNrgKMOhM3WsafmbGmC+6dsF2Z308vLFsQ3a/bT8X8Sv5clVYpPars/UPq+sAaJP+5OoLAYgwbkS5QEJdLUQ== - -"@types/history@^4.7.11": - version "4.7.11" - resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.11.tgz#56588b17ae8f50c53983a524fc3cc47437969d64" - integrity sha512-qjDJRrmvBMiTx+jyLxvLfJU7UznFuokDv4f3WRuriHKERccVpFU+8XMQUAbDzoiJCsmexxRExQeMwwCdamSKDA== - -"@types/istanbul-lib-coverage@^2.0.1": - version "2.0.6" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" - integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== - -"@types/json-schema@^7.0.12", "@types/json-schema@^7.0.9": - version "7.0.15" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" - integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== - -"@types/lodash-es@^4.17.5": - version "4.17.12" - resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.12.tgz#65f6d1e5f80539aa7cfbfc962de5def0cf4f341b" - integrity sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ== - dependencies: - "@types/lodash" "*" - -"@types/lodash@*": - version "4.14.202" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.202.tgz#f09dbd2fb082d507178b2f2a5c7e74bd72ff98f8" - integrity sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ== - -"@types/mdast@^3.0.0", "@types/mdast@^3.0.3": - version "3.0.15" - resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.15.tgz#49c524a263f30ffa28b71ae282f813ed000ab9f5" - integrity sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ== - dependencies: - "@types/unist" "^2" - -"@types/minimist@^1.2.0": - version "1.2.5" - resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e" - integrity sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag== - -"@types/node@*": - version "20.10.3" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.3.tgz#4900adcc7fc189d5af5bb41da8f543cea6962030" - integrity sha512-XJavIpZqiXID5Yxnxv3RUDKTN5b81ddNC3ecsA0SoFXz/QU8OGBwZGMomiq0zw+uuqbL/krztv/DINAQ/EV4gg== - dependencies: - undici-types "~5.26.4" - -"@types/node@^18.6.2": - version "18.19.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.2.tgz#865107157bda220eef9fa8c2173152d6559a41ae" - integrity sha512-6wzfBdbWpe8QykUkXBjtmO3zITA0A3FIjoy+in0Y2K4KrCiRhNYJIdwAPDffZ3G6GnaKaSLSEa9ZuORLfEoiwg== - dependencies: - undici-types "~5.26.4" - -"@types/normalize-package-data@^2.4.0": - version "2.4.4" - resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901" - integrity sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA== - -"@types/offscreencanvas@^2019.6.4": - version "2019.7.3" - resolved "https://registry.yarnpkg.com/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz#90267db13f64d6e9ccb5ae3eac92786a7c77a516" - integrity sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A== - -"@types/pixelmatch@^5.2.5": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@types/pixelmatch/-/pixelmatch-5.2.6.tgz#fba6de304ac958495f27d85989f5c6bb7499a686" - integrity sha512-wC83uexE5KGuUODn6zkm9gMzTwdY5L0chiK+VrKcDfEjzxh1uadlWTvOmAbCpnM9zx/Ww3f8uKlYQVnO/TrqVg== - dependencies: - "@types/node" "*" - -"@types/pngjs@^6.0.3": - version "6.0.4" - resolved "https://registry.yarnpkg.com/@types/pngjs/-/pngjs-6.0.4.tgz#9a457aebabd944efde1a773a0fa1d74933e8021b" - integrity sha512-atAK9xLKOnxiuArxcHovmnOUUGBZOQ3f0vCf43FnoKs6XnqiambT1kkJWmdo71IR+BoXSh+CueeFR0GfH3dTlQ== - dependencies: - "@types/node" "*" - -"@types/prop-types@*": - version "15.7.11" - resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.11.tgz#2596fb352ee96a1379c657734d4b913a613ad563" - integrity sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng== - -"@types/pubsub-js@^1.8.2": - version "1.8.6" - resolved "https://registry.yarnpkg.com/@types/pubsub-js/-/pubsub-js-1.8.6.tgz#2492cca3a25431d29df8235f57ef5090e1b501b1" - integrity sha512-Kwug5cwV0paUDm/NfwDx1sp9xI0bGIvmWJjJWCU8NngkCCMt3EIC7oPDvb6fV7BR8kPpFyyBu4D11bda/2MdPA== - -"@types/raf@^3.4.0": - version "3.4.3" - resolved "https://registry.yarnpkg.com/@types/raf/-/raf-3.4.3.tgz#85f1d1d17569b28b8db45e16e996407a56b0ab04" - integrity sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw== - -"@types/rbush@^3.0.0": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/rbush/-/rbush-3.0.3.tgz#f7ba6bc940e0913678f5df119e7a7803f1842ece" - integrity sha512-lX55lR0iYCgapxD3IrgujpQA1zDxwZI5qMRelKvmKAsSMplFVr7wmMpG7/6+Op2tjrgEex8o3vjg8CRDrRNYxg== - -"@types/react-dom@^18.2.0": - version "18.2.17" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.17.tgz#375c55fab4ae671bd98448dcfa153268d01d6f64" - integrity sha512-rvrT/M7Df5eykWFxn6MYt5Pem/Dbyc1N8Y0S9Mrkw2WFCRiqUgw9P7ul2NpwsXCSM1DVdENzdG9J5SreqfAIWg== - dependencies: - "@types/react" "*" - -"@types/react-resize-detector@^4.2.0": - version "4.2.0" - resolved "https://registry.yarnpkg.com/@types/react-resize-detector/-/react-resize-detector-4.2.0.tgz#ee8802e25cfb34439aa7f52626932ea62dc5792e" - integrity sha512-y5PPThHUrBGxMhLDNn0BRWglKr84y+gQHvzkyKxF8aW3pox4IySC33V8AOu7ReS0JR1X1dKQgWeF8IOkGrbeBg== - dependencies: - "@types/react" "*" - -"@types/react-router-dom@^5.1.6": - version "5.3.3" - resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-5.3.3.tgz#e9d6b4a66fcdbd651a5f106c2656a30088cc1e83" - integrity sha512-kpqnYK4wcdm5UaWI3fLcELopqLrHgLqNsdpHauzlQktfkHL3npOSwtj1Uz9oKBAzs7lFtVkV8j83voAz2D8fhw== - dependencies: - "@types/history" "^4.7.11" - "@types/react" "*" - "@types/react-router" "*" - -"@types/react-router@*": - version "5.1.20" - resolved "https://registry.yarnpkg.com/@types/react-router/-/react-router-5.1.20.tgz#88eccaa122a82405ef3efbcaaa5dcdd9f021387c" - integrity sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q== - dependencies: - "@types/history" "^4.7.11" - "@types/react" "*" - -"@types/react@*", "@types/react@^18.2.0": - version "18.2.41" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.41.tgz#9eea044246bdb10510df89ef7f8422a8b6ad8fb9" - integrity sha512-CwOGr/PiLiNBxEBqpJ7fO3kocP/2SSuC9fpH5K7tusrg4xPSRT/193rzolYwQnTN02We/ATXKnb6GqA5w4fRxw== - dependencies: - "@types/prop-types" "*" - "@types/scheduler" "*" - csstype "^3.0.2" - -"@types/scheduler@*": - version "0.16.8" - resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.8.tgz#ce5ace04cfeabe7ef87c0091e50752e36707deff" - integrity sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A== - -"@types/semver@^7.3.12": - version "7.5.6" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.6.tgz#c65b2bfce1bec346582c07724e3f8c1017a20339" - integrity sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A== - -"@types/unist@^2", "@types/unist@^2.0.0", "@types/unist@^2.0.2", "@types/unist@^2.0.3": - version "2.0.10" - resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.10.tgz#04ffa7f406ab628f7f7e97ca23e290cd8ab15efc" - integrity sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA== - -"@typescript-eslint/eslint-plugin@^5.56.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz#aeef0328d172b9e37d9bab6dbc13b87ed88977db" - integrity sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag== - dependencies: - "@eslint-community/regexpp" "^4.4.0" - "@typescript-eslint/scope-manager" "5.62.0" - "@typescript-eslint/type-utils" "5.62.0" - "@typescript-eslint/utils" "5.62.0" - debug "^4.3.4" - graphemer "^1.4.0" - ignore "^5.2.0" - natural-compare-lite "^1.4.0" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/parser@^5.56.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.62.0.tgz#1b63d082d849a2fcae8a569248fbe2ee1b8a56c7" - integrity sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA== - dependencies: - "@typescript-eslint/scope-manager" "5.62.0" - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/typescript-estree" "5.62.0" - debug "^4.3.4" - -"@typescript-eslint/scope-manager@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c" - integrity sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w== - dependencies: - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/visitor-keys" "5.62.0" - -"@typescript-eslint/type-utils@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz#286f0389c41681376cdad96b309cedd17d70346a" - integrity sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew== - dependencies: - "@typescript-eslint/typescript-estree" "5.62.0" - "@typescript-eslint/utils" "5.62.0" - debug "^4.3.4" - tsutils "^3.21.0" - -"@typescript-eslint/types@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" - integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== - -"@typescript-eslint/typescript-estree@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" - integrity sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA== - dependencies: - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/visitor-keys" "5.62.0" - debug "^4.3.4" - globby "^11.1.0" - is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/utils@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" - integrity sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ== - dependencies: - "@eslint-community/eslint-utils" "^4.2.0" - "@types/json-schema" "^7.0.9" - "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.62.0" - "@typescript-eslint/types" "5.62.0" - "@typescript-eslint/typescript-estree" "5.62.0" - eslint-scope "^5.1.1" - semver "^7.3.7" - -"@typescript-eslint/visitor-keys@5.62.0": - version "5.62.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e" - integrity sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw== - dependencies: - "@typescript-eslint/types" "5.62.0" - eslint-visitor-keys "^3.3.0" - -"@ungap/structured-clone@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" - integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== - -"@vitejs/plugin-react@^4.1.0": - version "4.2.0" - resolved "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-4.2.0.tgz#d71352b1a443c09c7aae8f278dd071ab3d9d8490" - integrity sha512-+MHTH/e6H12kRp5HUkzOGqPMksezRMmW+TNzlh/QXfI8rRf6l2Z2yH/v12no1UvTwhZgEDMuQ7g7rrfMseU6FQ== - dependencies: - "@babel/core" "^7.23.3" - "@babel/plugin-transform-react-jsx-self" "^7.23.3" - "@babel/plugin-transform-react-jsx-source" "^7.23.3" - "@types/babel__core" "^7.20.4" - react-refresh "^0.14.0" - -"@vitest/coverage-v8@^0.34.6": - version "0.34.6" - resolved "https://registry.yarnpkg.com/@vitest/coverage-v8/-/coverage-v8-0.34.6.tgz#931d9223fa738474e00c08f52b84e0f39cedb6d1" - integrity sha512-fivy/OK2d/EsJFoEoxHFEnNGTg+MmdZBAVK9Ka4qhXR2K3J0DS08vcGVwzDtXSuUMabLv4KtPcpSKkcMXFDViw== - dependencies: - "@ampproject/remapping" "^2.2.1" - "@bcoe/v8-coverage" "^0.2.3" - istanbul-lib-coverage "^3.2.0" - istanbul-lib-report "^3.0.1" - istanbul-lib-source-maps "^4.0.1" - istanbul-reports "^3.1.5" - magic-string "^0.30.1" - picocolors "^1.0.0" - std-env "^3.3.3" - test-exclude "^6.0.0" - v8-to-istanbul "^9.1.0" - -"@vitest/expect@0.34.6": - version "0.34.6" - resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-0.34.6.tgz#608a7b7a9aa3de0919db99b4cc087340a03ea77e" - integrity sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw== - dependencies: - "@vitest/spy" "0.34.6" - "@vitest/utils" "0.34.6" - chai "^4.3.10" - -"@vitest/runner@0.34.6": - version "0.34.6" - resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-0.34.6.tgz#6f43ca241fc96b2edf230db58bcde5b974b8dcaf" - integrity sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ== - dependencies: - "@vitest/utils" "0.34.6" - p-limit "^4.0.0" - pathe "^1.1.1" - -"@vitest/snapshot@0.34.6": - version "0.34.6" - resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-0.34.6.tgz#b4528cf683b60a3e8071cacbcb97d18b9d5e1d8b" - integrity sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w== - dependencies: - magic-string "^0.30.1" - pathe "^1.1.1" - pretty-format "^29.5.0" - -"@vitest/spy@0.34.6": - version "0.34.6" - resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-0.34.6.tgz#b5e8642a84aad12896c915bce9b3cc8cdaf821df" - integrity sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ== - dependencies: - tinyspy "^2.1.1" - -"@vitest/utils@0.34.6": - version "0.34.6" - resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-0.34.6.tgz#38a0a7eedddb8e7291af09a2409cb8a189516968" - integrity sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A== - dependencies: - diff-sequences "^29.4.3" - loupe "^2.3.6" - pretty-format "^29.5.0" - -JSONStream@^1.0.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" - integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== - dependencies: - jsonparse "^1.2.0" - through ">=2.2.7 <3" - -abab@^2.0.5, abab@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" - integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== - -abortable-promise-cache@^1.4.1, abortable-promise-cache@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/abortable-promise-cache/-/abortable-promise-cache-1.5.0.tgz#33b6716a26bb0ef3b8104724d6ee828bd94a78c4" - integrity sha512-S2FfvU1As7Fve6ObCEsuOiE22UR7k91ytM+m4bzG6eAf+fb4TOAVEGZGAzlRfCo7/bZamL9d3ZeXc08MPm3azA== - dependencies: - abortcontroller-polyfill "^1.2.9" - -abortcontroller-polyfill@^1.2.9: - version "1.7.5" - resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz#6738495f4e901fbb57b6c0611d0c75f76c485bed" - integrity sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ== - -acorn-globals@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-6.0.0.tgz#46cdd39f0f8ff08a876619b55f5ac8a6dc770b45" - integrity sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg== - dependencies: - acorn "^7.1.1" - acorn-walk "^7.1.1" - -acorn-jsx@^5.3.2: - version "5.3.2" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" - integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== - -acorn-walk@^7.1.1: - version "7.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" - integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== - -acorn-walk@^8.2.0: - version "8.3.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.0.tgz#2097665af50fd0cf7a2dfccd2b9368964e66540f" - integrity sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA== - -acorn@^7.1.1: - version "7.4.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" - integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== - -acorn@^8.10.0, acorn@^8.5.0, acorn@^8.9.0: - version "8.11.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b" - integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== - -add-stream@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa" - integrity sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ== - -agent-base@6: - version "6.0.2" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" - integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== - dependencies: - debug "4" - -ajv@^6.10.0, ajv@^6.12.2, ajv@^6.12.4: - version "6.12.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" - integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== - dependencies: - fast-deep-equal "^3.1.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -allotment@^1.19.0: - version "1.19.3" - resolved "https://registry.yarnpkg.com/allotment/-/allotment-1.19.3.tgz#c71575f53cef97a7e532af0eb5ef06e4615e8232" - integrity sha512-StPCZLGPNG9KhXeNCrqTkIK09s7D6+8n0w754SRY8PUvDXFLLovrFFo4ubd82fytRWS5bFntsWA5SX4sODxuiw== - dependencies: - classnames "^2.3.0" - eventemitter3 "^5.0.0" - lodash.clamp "^4.0.0" - lodash.debounce "^4.0.0" - lodash.isequal "^4.5.0" - use-resize-observer "^9.0.0" - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-regex@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a" - integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA== - -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -ansi-styles@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" - integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== - -ansi-styles@^6.1.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" - integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== - -argparse@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" - integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== - -aria-query@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.0.tgz#650c569e41ad90b51b3d7df5e5eed1c7549c103e" - integrity sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A== - dependencies: - dequal "^2.0.3" - -array-buffer-byte-length@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz#fabe8bc193fea865f317fe7807085ee0dee5aead" - integrity sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A== - dependencies: - call-bind "^1.0.2" - is-array-buffer "^3.0.1" - -array-ify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" - integrity sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng== - -array-includes@^3.1.6, array-includes@^3.1.7: - version "3.1.7" - resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.7.tgz#8cd2e01b26f7a3086cbc87271593fe921c62abda" - integrity sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - get-intrinsic "^1.2.1" - is-string "^1.0.7" - -array-union@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" - integrity sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng== - dependencies: - array-uniq "^1.0.1" - -array-union@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" - integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== - -array-uniq@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" - integrity sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q== - -array.prototype.flat@^1.3.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz#1476217df8cff17d72ee8f3ba06738db5b387d18" - integrity sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - es-shim-unscopables "^1.0.0" - -array.prototype.flatmap@^1.3.1, array.prototype.flatmap@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz#c9a7c6831db8e719d6ce639190146c24bbd3e527" - integrity sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - es-shim-unscopables "^1.0.0" - -array.prototype.tosorted@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/array.prototype.tosorted/-/array.prototype.tosorted-1.1.2.tgz#620eff7442503d66c799d95503f82b475745cefd" - integrity sha512-HuQCHOlk1Weat5jzStICBCd83NxiIMwqDg/dHEsoefabn/hJRj5pVdWcPUSpRrwhwxZOsQassMpgN/xRYFBMIg== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - es-shim-unscopables "^1.0.0" - get-intrinsic "^1.2.1" - -arraybuffer.prototype.slice@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz#98bd561953e3e74bb34938e77647179dfe6e9f12" - integrity sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw== - dependencies: - array-buffer-byte-length "^1.0.0" - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - get-intrinsic "^1.2.1" - is-array-buffer "^3.0.2" - is-shared-array-buffer "^1.0.2" - -arrify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" - integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== - -assertion-error@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" - integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== - -ast-types-flow@^0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.8.tgz#0a85e1c92695769ac13a428bb653e7538bea27d6" - integrity sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ== - -async@^2.6.1: - version "2.6.4" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" - integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== - dependencies: - lodash "^4.17.14" - -asynciterator.prototype@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz#8c5df0514936cdd133604dfcc9d3fb93f09b2b62" - integrity sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg== - dependencies: - has-symbols "^1.0.3" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== - -atob@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" - integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== - -available-typed-arrays@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" - integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== - -axe-core@=4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.7.0.tgz#34ba5a48a8b564f67e103f0aa5768d76e15bbbbf" - integrity sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ== - -axobject-query@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-3.2.1.tgz#39c378a6e3b06ca679f29138151e45b2b32da62a" - integrity sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg== - dependencies: - dequal "^2.0.3" - -bail@^1.0.0: - version "1.0.5" - resolved "https://registry.yarnpkg.com/bail/-/bail-1.0.5.tgz#b6fa133404a392cbc1f8c4bf63f5953351e7a776" - integrity sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ== - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -base64-arraybuffer@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz#1c37589a7c4b0746e34bd1feb951da2df01c1bdc" - integrity sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ== - -base64-js@^1.3.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -bezier-js@4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/bezier-js/-/bezier-js-4.0.3.tgz#9e076d66f609bca9fc08dd22201596d52d3cc49d" - integrity sha512-w85AFcZ7EkszFgxuHYQ2/BI2G7H5bEotZD9vcg8+Hx4S8zF2odJBoFSFvGbcFDH5ScSxG27/IhW03SigVmkXNQ== - -binary-parser@^2.1.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/binary-parser/-/binary-parser-2.2.1.tgz#4edc6da2dc56db73fa5ba450dfe6382ede8294ce" - integrity sha512-5ATpz/uPDgq5GgEDxTB4ouXCde7q2lqAQlSdBRQVl/AJnxmQmhIfyxJx+0MGu//D5rHQifkfGbWWlaysG0o9NA== - -bit-twiddle@^1.0.0, bit-twiddle@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bit-twiddle/-/bit-twiddle-1.0.2.tgz#0c6c1fabe2b23d17173d9a61b7b7093eb9e1769e" - integrity sha512-B9UhK0DKFZhoTFcfvAzhqsjStvGJp9vYWf3+6SNTtdSQnvIgfkHbgHrg/e4+TH71N2GDu8tpmCVoyfrL1d7ntA== - -box-intersect@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/box-intersect/-/box-intersect-1.0.2.tgz#4693ad63e828868d0654b114e09364d6281f3fbd" - integrity sha512-yJeMwlmFPG1gIa7Rs/cGXeI6iOj6Qz5MG5PE61xLKpElUGzmJ4abm+qsLpzxKJFpsSDq742BQEocr8dI2t8Nxw== - dependencies: - bit-twiddle "^1.0.2" - typedarray-pool "^1.1.0" - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -brace-expansion@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" - integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== - dependencies: - balanced-match "^1.0.0" - -braces@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== - dependencies: - fill-range "^7.0.1" - -browser-process-hrtime@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" - integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== - -browserslist@^4.21.9: - version "4.22.2" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.2.tgz#704c4943072bd81ea18997f3bd2180e89c77874b" - integrity sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A== - dependencies: - caniuse-lite "^1.0.30001565" - electron-to-chromium "^1.4.601" - node-releases "^2.0.14" - update-browserslist-db "^1.0.13" - -btoa@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/btoa/-/btoa-1.2.1.tgz#01a9909f8b2c93f6bf680ba26131eb30f7fa3d73" - integrity sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g== - -buffer-crc32@^0.2.13: - version "0.2.13" - resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" - integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ== - -buffer@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" - integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.2.1" - -c8@^7.11.2: - version "7.14.0" - resolved "https://registry.yarnpkg.com/c8/-/c8-7.14.0.tgz#f368184c73b125a80565e9ab2396ff0be4d732f3" - integrity sha512-i04rtkkcNcCf7zsQcSv/T9EbUn4RXQ6mropeMcjFOsQXQ0iGLAr/xT6TImQg4+U9hmNpN9XdvPkjUL1IzbgxJw== - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@istanbuljs/schema" "^0.1.3" - find-up "^5.0.0" - foreground-child "^2.0.0" - istanbul-lib-coverage "^3.2.0" - istanbul-lib-report "^3.0.0" - istanbul-reports "^3.1.4" - rimraf "^3.0.2" - test-exclude "^6.0.0" - v8-to-istanbul "^9.0.0" - yargs "^16.2.0" - yargs-parser "^20.2.9" - -cac@^6.7.14: - version "6.7.14" - resolved "https://registry.yarnpkg.com/cac/-/cac-6.7.14.tgz#804e1e6f506ee363cb0e3ccbb09cad5dd9870959" - integrity sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ== - -call-bind@^1.0.0, call-bind@^1.0.2, call-bind@^1.0.4, call-bind@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.5.tgz#6fa2b7845ce0ea49bf4d8b9ef64727a2c2e2e513" - integrity sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ== - dependencies: - function-bind "^1.1.2" - get-intrinsic "^1.2.1" - set-function-length "^1.1.1" - -callsites@^3.0.0, callsites@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" - integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== - -camelcase-keys@^6.2.2: - version "6.2.2" - resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.2.tgz#5e755d6ba51aa223ec7d3d52f25778210f9dc3c0" - integrity sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg== - dependencies: - camelcase "^5.3.1" - map-obj "^4.0.0" - quick-lru "^4.0.1" - -camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== - -caniuse-lite@^1.0.30001565: - version "1.0.30001566" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001566.tgz#61a8e17caf3752e3e426d4239c549ebbb37fef0d" - integrity sha512-ggIhCsTxmITBAMmK8yZjEhCO5/47jKXPu6Dha/wuCS4JePVL+3uiDEBuhu2aIoT+bqTOR8L76Ip1ARL9xYsEJA== - -canvg@^3.0.6: - version "3.0.10" - resolved "https://registry.yarnpkg.com/canvg/-/canvg-3.0.10.tgz#8e52a2d088b6ffa23ac78970b2a9eebfae0ef4b3" - integrity sha512-qwR2FRNO9NlzTeKIPIKpnTY6fqwuYSequ8Ru8c0YkYU7U0oW+hLUvWadLvAu1Rl72OMNiFhoLu4f8eUjQ7l/+Q== - dependencies: - "@babel/runtime" "^7.12.5" - "@types/raf" "^3.4.0" - core-js "^3.8.3" - raf "^3.4.1" - regenerator-runtime "^0.13.7" - rgbcolor "^1.0.1" - stackblur-canvas "^2.0.0" - svg-pathdata "^6.0.3" - -ccount@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/ccount/-/ccount-1.1.0.tgz#246687debb6014735131be8abab2d93898f8d043" - integrity sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg== - -chai@^4.3.10: - version "4.3.10" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.10.tgz#d784cec635e3b7e2ffb66446a63b4e33bd390384" - integrity sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g== - dependencies: - assertion-error "^1.1.0" - check-error "^1.0.3" - deep-eql "^4.1.3" - get-func-name "^2.0.2" - loupe "^2.3.6" - pathval "^1.1.1" - type-detect "^4.0.8" - -chalk@^2.4.1, chalk@^2.4.2: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chalk@^4.0.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -character-entities-legacy@^1.0.0: - version "1.1.4" - resolved "https://registry.yarnpkg.com/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz#94bc1845dce70a5bb9d2ecc748725661293d8fc1" - integrity sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA== - -character-entities@^1.0.0: - version "1.2.4" - resolved "https://registry.yarnpkg.com/character-entities/-/character-entities-1.2.4.tgz#e12c3939b7eaf4e5b15e7ad4c5e28e1d48c5b16b" - integrity sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw== - -character-reference-invalid@^1.0.0: - version "1.1.4" - resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz#083329cda0eae272ab3dbbf37e9a382c13af1560" - integrity sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg== - -check-error@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694" - integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg== - dependencies: - get-func-name "^2.0.2" - -classnames@2.x, classnames@^2.2.5, classnames@^2.3.0: - version "2.3.2" - resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924" - integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw== - -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^7.0.0" - -clsx@^1.1.1, clsx@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" - integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - -color-name@^1.1.4, color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -commander@2, commander@^2.18.0: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - -commander@^11.0.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-11.1.0.tgz#62fdce76006a68e5c1ab3314dc92e800eb83d906" - integrity sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ== - -commondir@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" - integrity sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg== - -compare-func@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-2.0.0.tgz#fb65e75edbddfd2e568554e8b5b05fff7a51fcb3" - integrity sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA== - dependencies: - array-ify "^1.0.0" - dot-prop "^5.1.0" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -conventional-changelog-angular@^5.0.12: - version "5.0.13" - resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.13.tgz#896885d63b914a70d4934b59d2fe7bde1832b28c" - integrity sha512-i/gipMxs7s8L/QeuavPF2hLnJgH6pEZAttySB6aiQLWcX3puWDL3ACVmvBhJGxnAy52Qc15ua26BufY6KpmrVA== - dependencies: - compare-func "^2.0.0" - q "^1.5.1" - -conventional-changelog-atom@^2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/conventional-changelog-atom/-/conventional-changelog-atom-2.0.8.tgz#a759ec61c22d1c1196925fca88fe3ae89fd7d8de" - integrity sha512-xo6v46icsFTK3bb7dY/8m2qvc8sZemRgdqLb/bjpBsH2UyOS8rKNTgcb5025Hri6IpANPApbXMg15QLb1LJpBw== - dependencies: - q "^1.5.1" - -conventional-changelog-cli@^2.1.1: - version "2.2.2" - resolved "https://registry.yarnpkg.com/conventional-changelog-cli/-/conventional-changelog-cli-2.2.2.tgz#9a7746cede92c6a8f27dc46692efaadfbed60daa" - integrity sha512-8grMV5Jo8S0kP3yoMeJxV2P5R6VJOqK72IiSV9t/4H5r/HiRqEBQ83bYGuz4Yzfdj4bjaAEhZN/FFbsFXr5bOA== - dependencies: - add-stream "^1.0.0" - conventional-changelog "^3.1.24" - lodash "^4.17.15" - meow "^8.0.0" - tempfile "^3.0.0" - -conventional-changelog-codemirror@^2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/conventional-changelog-codemirror/-/conventional-changelog-codemirror-2.0.8.tgz#398e9530f08ce34ec4640af98eeaf3022eb1f7dc" - integrity sha512-z5DAsn3uj1Vfp7po3gpt2Boc+Bdwmw2++ZHa5Ak9k0UKsYAO5mH1UBTN0qSCuJZREIhX6WU4E1p3IW2oRCNzQw== - dependencies: - q "^1.5.1" - -conventional-changelog-conventionalcommits@^4.5.0: - version "4.6.3" - resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.6.3.tgz#0765490f56424b46f6cb4db9135902d6e5a36dc2" - integrity sha512-LTTQV4fwOM4oLPad317V/QNQ1FY4Hju5qeBIM1uTHbrnCE+Eg4CdRZ3gO2pUeR+tzWdp80M2j3qFFEDWVqOV4g== - dependencies: - compare-func "^2.0.0" - lodash "^4.17.15" - q "^1.5.1" - -conventional-changelog-core@^4.2.1: - version "4.2.4" - resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-4.2.4.tgz#e50d047e8ebacf63fac3dc67bf918177001e1e9f" - integrity sha512-gDVS+zVJHE2v4SLc6B0sLsPiloR0ygU7HaDW14aNJE1v4SlqJPILPl/aJC7YdtRE4CybBf8gDwObBvKha8Xlyg== - dependencies: - add-stream "^1.0.0" - conventional-changelog-writer "^5.0.0" - conventional-commits-parser "^3.2.0" - dateformat "^3.0.0" - get-pkg-repo "^4.0.0" - git-raw-commits "^2.0.8" - git-remote-origin-url "^2.0.0" - git-semver-tags "^4.1.1" - lodash "^4.17.15" - normalize-package-data "^3.0.0" - q "^1.5.1" - read-pkg "^3.0.0" - read-pkg-up "^3.0.0" - through2 "^4.0.0" - -conventional-changelog-ember@^2.0.9: - version "2.0.9" - resolved "https://registry.yarnpkg.com/conventional-changelog-ember/-/conventional-changelog-ember-2.0.9.tgz#619b37ec708be9e74a220f4dcf79212ae1c92962" - integrity sha512-ulzIReoZEvZCBDhcNYfDIsLTHzYHc7awh+eI44ZtV5cx6LVxLlVtEmcO+2/kGIHGtw+qVabJYjdI5cJOQgXh1A== - dependencies: - q "^1.5.1" - -conventional-changelog-eslint@^3.0.9: - version "3.0.9" - resolved "https://registry.yarnpkg.com/conventional-changelog-eslint/-/conventional-changelog-eslint-3.0.9.tgz#689bd0a470e02f7baafe21a495880deea18b7cdb" - integrity sha512-6NpUCMgU8qmWmyAMSZO5NrRd7rTgErjrm4VASam2u5jrZS0n38V7Y9CzTtLT2qwz5xEChDR4BduoWIr8TfwvXA== - dependencies: - q "^1.5.1" - -conventional-changelog-express@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/conventional-changelog-express/-/conventional-changelog-express-2.0.6.tgz#420c9d92a347b72a91544750bffa9387665a6ee8" - integrity sha512-SDez2f3iVJw6V563O3pRtNwXtQaSmEfTCaTBPCqn0oG0mfkq0rX4hHBq5P7De2MncoRixrALj3u3oQsNK+Q0pQ== - dependencies: - q "^1.5.1" - -conventional-changelog-jquery@^3.0.11: - version "3.0.11" - resolved "https://registry.yarnpkg.com/conventional-changelog-jquery/-/conventional-changelog-jquery-3.0.11.tgz#d142207400f51c9e5bb588596598e24bba8994bf" - integrity sha512-x8AWz5/Td55F7+o/9LQ6cQIPwrCjfJQ5Zmfqi8thwUEKHstEn4kTIofXub7plf1xvFA2TqhZlq7fy5OmV6BOMw== - dependencies: - q "^1.5.1" - -conventional-changelog-jshint@^2.0.9: - version "2.0.9" - resolved "https://registry.yarnpkg.com/conventional-changelog-jshint/-/conventional-changelog-jshint-2.0.9.tgz#f2d7f23e6acd4927a238555d92c09b50fe3852ff" - integrity sha512-wMLdaIzq6TNnMHMy31hql02OEQ8nCQfExw1SE0hYL5KvU+JCTuPaDO+7JiogGT2gJAxiUGATdtYYfh+nT+6riA== - dependencies: - compare-func "^2.0.0" - q "^1.5.1" - -conventional-changelog-preset-loader@^2.3.4: - version "2.3.4" - resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.3.4.tgz#14a855abbffd59027fd602581f1f34d9862ea44c" - integrity sha512-GEKRWkrSAZeTq5+YjUZOYxdHq+ci4dNwHvpaBC3+ENalzFWuCWa9EZXSuZBpkr72sMdKB+1fyDV4takK1Lf58g== - -conventional-changelog-writer@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-5.0.1.tgz#e0757072f045fe03d91da6343c843029e702f359" - integrity sha512-5WsuKUfxW7suLblAbFnxAcrvf6r+0b7GvNaWUwUIk0bXMnENP/PEieGKVUQrjPqwPT4o3EPAASBXiY6iHooLOQ== - dependencies: - conventional-commits-filter "^2.0.7" - dateformat "^3.0.0" - handlebars "^4.7.7" - json-stringify-safe "^5.0.1" - lodash "^4.17.15" - meow "^8.0.0" - semver "^6.0.0" - split "^1.0.0" - through2 "^4.0.0" - -conventional-changelog@^3.1.24: - version "3.1.25" - resolved "https://registry.yarnpkg.com/conventional-changelog/-/conventional-changelog-3.1.25.tgz#3e227a37d15684f5aa1fb52222a6e9e2536ccaff" - integrity sha512-ryhi3fd1mKf3fSjbLXOfK2D06YwKNic1nC9mWqybBHdObPd8KJ2vjaXZfYj1U23t+V8T8n0d7gwnc9XbIdFbyQ== - dependencies: - conventional-changelog-angular "^5.0.12" - conventional-changelog-atom "^2.0.8" - conventional-changelog-codemirror "^2.0.8" - conventional-changelog-conventionalcommits "^4.5.0" - conventional-changelog-core "^4.2.1" - conventional-changelog-ember "^2.0.9" - conventional-changelog-eslint "^3.0.9" - conventional-changelog-express "^2.0.6" - conventional-changelog-jquery "^3.0.11" - conventional-changelog-jshint "^2.0.9" - conventional-changelog-preset-loader "^2.3.4" - -conventional-commits-filter@^2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-2.0.7.tgz#f8d9b4f182fce00c9af7139da49365b136c8a0b3" - integrity sha512-ASS9SamOP4TbCClsRHxIHXRfcGCnIoQqkvAzCSbZzTFLfcTqJVugB0agRgsEELsqaeWgsXv513eS116wnlSSPA== - dependencies: - lodash.ismatch "^4.4.0" - modify-values "^1.0.0" - -conventional-commits-parser@^3.2.0: - version "3.2.4" - resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.2.4.tgz#a7d3b77758a202a9b2293d2112a8d8052c740972" - integrity sha512-nK7sAtfi+QXbxHCYfhpZsfRtaitZLIA6889kFIouLvz6repszQDgxBu7wf2WbU+Dco7sAnNCJYERCwt54WPC2Q== - dependencies: - JSONStream "^1.0.4" - is-text-path "^1.0.1" - lodash "^4.17.15" - meow "^8.0.0" - split2 "^3.0.0" - through2 "^4.0.0" - -convert-source-map@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" - integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== - -core-js@^3.6.0, core-js@^3.8.3: - version "3.33.3" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.33.3.tgz#3c644a323f0f533a0d360e9191e37f7fc059088d" - integrity sha512-lo0kOocUlLKmm6kv/FswQL8zbkH7mVsLJ/FULClOhv8WRVmKLVcs6XPNQAzstfeJTCHMyButEwG+z1kHxHoDZw== - -core-util-is@~1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" - integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== - -cross-fetch@^3.0.2: - version "3.1.8" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82" - integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg== - dependencies: - node-fetch "^2.6.12" - -cross-spawn@^6.0.5: - version "6.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== - dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - -cross-spawn@^7.0.0, cross-spawn@^7.0.2: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" - integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -css-element-queries@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/css-element-queries/-/css-element-queries-1.2.3.tgz#e14940b1fcd4bf0da60ea4145d05742d7172e516" - integrity sha512-QK9uovYmKTsV2GXWQiMOByVNrLn2qz6m3P7vWpOR4IdD6I3iXoDw5qtgJEN3Xq7gIbdHVKvzHjdAtcl+4Arc4Q== - -css-line-break@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/css-line-break/-/css-line-break-2.1.0.tgz#bfef660dfa6f5397ea54116bb3cb4873edbc4fa0" - integrity sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w== - dependencies: - utrie "^1.0.2" - -cssfontparser@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/cssfontparser/-/cssfontparser-1.2.1.tgz#f4022fc8f9700c68029d542084afbaf425a3f3e3" - integrity sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg== - -cssom@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36" - integrity sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw== - -cssom@~0.3.6: - version "0.3.8" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" - integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== - -cssstyle@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" - integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== - dependencies: - cssom "~0.3.6" - -csstype@^3.0.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b" - integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ== - -d3-array@2, d3-array@^2.3.0, d3-array@^2.5.0, d3-array@^2.5.1, d3-array@^2.7.1: - version "2.12.1" - resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-2.12.1.tgz#e20b41aafcdffdf5d50928004ececf815a465e81" - integrity sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ== - dependencies: - internmap "^1.0.0" - -"d3-array@2 - 3", "d3-array@2.10.0 - 3": - version "3.2.4" - resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.2.4.tgz#15fec33b237f97ac5d7c986dc77da273a8ed0bb5" - integrity sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg== - dependencies: - internmap "1 - 2" - -d3-axis@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/d3-axis/-/d3-axis-2.1.0.tgz#978db534092711117d032fad5d733d206307f6a0" - integrity sha512-z/G2TQMyuf0X3qP+Mh+2PimoJD41VOCjViJzT0BHeL/+JQAofkiWZbWxlwFGb1N8EN+Cl/CW+MUKbVzr1689Cw== - -d3-brush@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/d3-brush/-/d3-brush-2.1.0.tgz#adadfbb104e8937af142e9a6e2028326f0471065" - integrity sha512-cHLLAFatBATyIKqZOkk/mDHUbzne2B3ZwxkzMHvFTCZCmLaXDpZRihQSn8UNXTkGD/3lb/W2sQz0etAftmHMJQ== - dependencies: - d3-dispatch "1 - 2" - d3-drag "2" - d3-interpolate "1 - 2" - d3-selection "2" - d3-transition "2" - -d3-collection@1: - version "1.0.7" - resolved "https://registry.yarnpkg.com/d3-collection/-/d3-collection-1.0.7.tgz#349bd2aa9977db071091c13144d5e4f16b5b310e" - integrity sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A== - -"d3-color@1 - 2", d3-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-2.0.0.tgz#8d625cab42ed9b8f601a1760a389f7ea9189d62e" - integrity sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ== - -"d3-color@1 - 3", d3-color@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-3.1.0.tgz#395b2833dfac71507f12ac2f7af23bf819de24e2" - integrity sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA== - -d3-dispatch@1: - version "1.0.6" - resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-1.0.6.tgz#00d37bcee4dd8cd97729dd893a0ac29caaba5d58" - integrity sha512-fVjoElzjhCEy+Hbn8KygnmMS7Or0a9sI2UzGwoB7cCtvI1XpVN9GpoYlnb3xt2YV66oXYb1fLJ8GMvP4hdU1RA== - -"d3-dispatch@1 - 2": - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-2.0.0.tgz#8a18e16f76dd3fcaef42163c97b926aa9b55e7cf" - integrity sha512-S/m2VsXI7gAti2pBoLClFFTMOO1HTtT0j99AuXLoGFKO6deHDdnv6ZGTxSTTUTgO1zVcv82fCOtDjYK4EECmWA== - -"d3-dispatch@1 - 3": - version "3.0.1" - resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-3.0.1.tgz#5fc75284e9c2375c36c839411a0cf550cbfc4d5e" - integrity sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg== - -d3-drag@2, d3-drag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-drag/-/d3-drag-2.0.0.tgz#9eaf046ce9ed1c25c88661911c1d5a4d8eb7ea6d" - integrity sha512-g9y9WbMnF5uqB9qKqwIIa/921RYWzlUDv9Jl1/yONQwxbOfszAWTCm8u7HOTgJgRDXiRZN56cHT9pd24dmXs8w== - dependencies: - d3-dispatch "1 - 2" - d3-selection "2" - -"d3-drag@2 - 3": - version "3.0.0" - resolved "https://registry.yarnpkg.com/d3-drag/-/d3-drag-3.0.0.tgz#994aae9cd23c719f53b5e10e3a0a6108c69607ba" - integrity sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg== - dependencies: - d3-dispatch "1 - 3" - d3-selection "3" - -d3-dsv@1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-1.2.0.tgz#9d5f75c3a5f8abd611f74d3f5847b0d4338b885c" - integrity sha512-9yVlqvZcSOMhCYzniHE7EVUws7Fa1zgw+/EAV2BxJoG3ME19V6BQFBwI855XQDsxyOuG7NibqRMTtiF/Qup46g== - dependencies: - commander "2" - iconv-lite "0.4" - rw "1" - -d3-dsv@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-2.0.0.tgz#b37b194b6df42da513a120d913ad1be22b5fe7c5" - integrity sha512-E+Pn8UJYx9mViuIUkoc93gJGGYut6mSDKy2+XaPwccwkRGlR+LO97L2VCCRjQivTwLHkSnAJG7yo00BWY6QM+w== - dependencies: - commander "2" - iconv-lite "0.4" - rw "1" - -"d3-ease@1 - 2": - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-ease/-/d3-ease-2.0.0.tgz#fd1762bfca00dae4bacea504b1d628ff290ac563" - integrity sha512-68/n9JWarxXkOWMshcT5IcjbB+agblQUaIsbnXmrzejn2O82n3p2A9R2zEB9HIEFWKFwPAEDDN8gR0VdSAyyAQ== - -"d3-ease@1 - 3": - version "3.0.1" - resolved "https://registry.yarnpkg.com/d3-ease/-/d3-ease-3.0.1.tgz#9658ac38a2140d59d346160f1f6c30fda0bd12f4" - integrity sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w== - -"d3-format@1 - 2", d3-format@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-2.0.0.tgz#a10bcc0f986c372b729ba447382413aabf5b0767" - integrity sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA== - -"d3-format@1 - 3": - version "3.1.0" - resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-3.1.0.tgz#9260e23a28ea5cb109e93b21a06e24e2ebd55641" - integrity sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA== - -d3-geo@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-2.0.2.tgz#c065c1b71fe8c5f1be657e5f43d9bdd010383c40" - integrity sha512-8pM1WGMLGFuhq9S+FpPURxic+gKzjluCD/CHTuUF3mXMeiCo0i6R0tO1s4+GArRFde96SLcW/kOFRjoAosPsFA== - dependencies: - d3-array "^2.5.0" - -"d3-interpolate@1 - 2", "d3-interpolate@1.2.0 - 2": - version "2.0.1" - resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-2.0.1.tgz#98be499cfb8a3b94d4ff616900501a64abc91163" - integrity sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ== - dependencies: - d3-color "1 - 2" - -"d3-interpolate@1 - 3", "d3-interpolate@1.2.0 - 3": - version "3.0.1" - resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-3.0.1.tgz#3c47aa5b32c5b3dfb56ef3fd4342078a632b400d" - integrity sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g== - dependencies: - d3-color "1 - 3" - -"d3-path@1 - 2": - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-2.0.0.tgz#55d86ac131a0548adae241eebfb56b4582dd09d8" - integrity sha512-ZwZQxKhBnv9yHaiWd6ZU4x5BtCQ7pXszEV9CU6kRgwIQVQGLMv1oiL4M+MK/n79sYzsj+gcgpPQSctJUsLN7fA== - -d3-queue@^3.0.7: - version "3.0.7" - resolved "https://registry.yarnpkg.com/d3-queue/-/d3-queue-3.0.7.tgz#c93a2e54b417c0959129d7d73f6cf7d4292e7618" - integrity sha512-2rs+6pNFKkrJhqe1rg5znw7dKJ7KZr62j9aLZfhondkrnz6U7VRmJj1UGcbD8MRc46c7H8m4SWhab8EalBQrkw== - -d3-request@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/d3-request/-/d3-request-1.0.6.tgz#a1044a9ef4ec28c824171c9379fae6d79474b19f" - integrity sha512-FJj8ySY6GYuAJHZMaCQ83xEYE4KbkPkmxZ3Hu6zA1xxG2GD+z6P+Lyp+zjdsHf0xEbp2xcluDI50rCS855EQ6w== - dependencies: - d3-collection "1" - d3-dispatch "1" - d3-dsv "1" - xmlhttprequest "1" - -d3-scale-chromatic@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-scale-chromatic/-/d3-scale-chromatic-2.0.0.tgz#c13f3af86685ff91323dc2f0ebd2dabbd72d8bab" - integrity sha512-LLqy7dJSL8yDy7NRmf6xSlsFZ6zYvJ4BcWFE4zBrOPnQERv9zj24ohnXKRbyi9YHnYV+HN1oEO3iFK971/gkzA== - dependencies: - d3-color "1 - 2" - d3-interpolate "1 - 2" - -d3-scale@^3.2.1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-3.3.0.tgz#28c600b29f47e5b9cd2df9749c206727966203f3" - integrity sha512-1JGp44NQCt5d1g+Yy+GeOnZP7xHo0ii8zsQp6PGzd+C1/dl0KGsp9A7Mxwp+1D1o4unbTTxVdU/ZOIEBoeZPbQ== - dependencies: - d3-array "^2.3.0" - d3-format "1 - 2" - d3-interpolate "1.2.0 - 2" - d3-time "^2.1.1" - d3-time-format "2 - 3" - -d3-scale@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-4.0.2.tgz#82b38e8e8ff7080764f8dcec77bd4be393689396" - integrity sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ== - dependencies: - d3-array "2.10.0 - 3" - d3-format "1 - 3" - d3-interpolate "1.2.0 - 3" - d3-time "2.1.1 - 3" - d3-time-format "2 - 4" - -d3-selection@2, d3-selection@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-2.0.0.tgz#94a11638ea2141b7565f883780dabc7ef6a61066" - integrity sha512-XoGGqhLUN/W14NmaqcO/bb1nqjDAw5WtSYb2X8wiuQWvSZUsUVYsOSkOybUrNvcBjaywBdYPy03eXHMXjk9nZA== - -"d3-selection@2 - 3", d3-selection@3: - version "3.0.0" - resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-3.0.0.tgz#c25338207efa72cc5b9bd1458a1a41901f1e1b31" - integrity sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ== - -d3-shape@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-2.1.0.tgz#3b6a82ccafbc45de55b57fcf956c584ded3b666f" - integrity sha512-PnjUqfM2PpskbSLTJvAzp2Wv4CZsnAgTfcVRTwW03QR3MkXF8Uo7B1y/lWkAsmbKwuecto++4NlsYcvYpXpTHA== - dependencies: - d3-path "1 - 2" - -"d3-time-format@2 - 3": - version "3.0.0" - resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-3.0.0.tgz#df8056c83659e01f20ac5da5fdeae7c08d5f1bb6" - integrity sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag== - dependencies: - d3-time "1 - 2" - -"d3-time-format@2 - 4": - version "4.1.0" - resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-4.1.0.tgz#7ab5257a5041d11ecb4fe70a5c7d16a195bb408a" - integrity sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg== - dependencies: - d3-time "1 - 3" - -"d3-time@1 - 2", d3-time@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-2.1.1.tgz#e9d8a8a88691f4548e68ca085e5ff956724a6682" - integrity sha512-/eIQe/eR4kCQwq7yxi7z4c6qEXf2IYGcjoWB5OOQy4Tq9Uv39/947qlDcN2TLkiTzQWzvnsuYPB9TrWaNfipKQ== - dependencies: - d3-array "2" - -"d3-time@1 - 3", "d3-time@2.1.1 - 3": - version "3.1.0" - resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-3.1.0.tgz#9310db56e992e3c0175e1ef385e545e48a9bb5c7" - integrity sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q== - dependencies: - d3-array "2 - 3" - -"d3-timer@1 - 2": - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-2.0.0.tgz#055edb1d170cfe31ab2da8968deee940b56623e6" - integrity sha512-TO4VLh0/420Y/9dO3+f9abDEFYeCUr2WZRlxJvbp4HPTQcSylXNiL6yZa9FIUvV1yRiFufl1bszTCLDqv9PWNA== - -"d3-timer@1 - 3": - version "3.0.1" - resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-3.0.1.tgz#6284d2a2708285b1abb7e201eda4380af35e63b0" - integrity sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA== - -d3-transition@2: - version "2.0.0" - resolved "https://registry.yarnpkg.com/d3-transition/-/d3-transition-2.0.0.tgz#366ef70c22ef88d1e34105f507516991a291c94c" - integrity sha512-42ltAGgJesfQE3u9LuuBHNbGrI/AJjNL2OAUdclE70UE6Vy239GCBEYD38uBPoLeNsOhFStGpPI0BAOV+HMxog== - dependencies: - d3-color "1 - 2" - d3-dispatch "1 - 2" - d3-ease "1 - 2" - d3-interpolate "1 - 2" - d3-timer "1 - 2" - -"d3-transition@2 - 3", d3-transition@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/d3-transition/-/d3-transition-3.0.1.tgz#6869fdde1448868077fdd5989200cb61b2a1645f" - integrity sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w== - dependencies: - d3-color "1 - 3" - d3-dispatch "1 - 3" - d3-ease "1 - 3" - d3-interpolate "1 - 3" - d3-timer "1 - 3" - -d3-zoom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/d3-zoom/-/d3-zoom-3.0.0.tgz#d13f4165c73217ffeaa54295cd6969b3e7aee8f3" - integrity sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw== - dependencies: - d3-dispatch "1 - 3" - d3-drag "2 - 3" - d3-interpolate "1 - 3" - d3-selection "2 - 3" - d3-transition "2 - 3" - -damerau-levenshtein@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7" - integrity sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA== - -dargs@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" - integrity sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg== - -data-urls@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-3.0.2.tgz#9cf24a477ae22bcef5cd5f6f0bfbc1d2d3be9143" - integrity sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ== - dependencies: - abab "^2.0.6" - whatwg-mimetype "^3.0.0" - whatwg-url "^11.0.0" - -dateformat@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" - integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== - -debug@4, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0, debug@^4.3.2, debug@^4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -decamelize-keys@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.1.tgz#04a2d523b2f18d80d0158a43b895d56dff8d19d8" - integrity sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg== - dependencies: - decamelize "^1.1.0" - map-obj "^1.0.0" - -decamelize@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== - -decimal.js@^10.3.1: - version "10.4.3" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" - integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== - -deep-eql@^4.1.3: - version "4.1.3" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" - integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== - dependencies: - type-detect "^4.0.0" - -deep-is@^0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" - integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== - -define-data-property@^1.0.1, define-data-property@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" - integrity sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ== - dependencies: - get-intrinsic "^1.2.1" - gopd "^1.0.1" - has-property-descriptors "^1.0.0" - -define-properties@^1.1.3, define-properties@^1.2.0, define-properties@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" - integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== - dependencies: - define-data-property "^1.0.1" - has-property-descriptors "^1.0.0" - object-keys "^1.1.1" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== - -dequal@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" - integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== - -diff-sequences@^29.4.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" - integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== - -dir-glob@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" - integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - dependencies: - path-type "^4.0.0" - -doctrine@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" - integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== - dependencies: - esutils "^2.0.2" - -doctrine@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" - integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== - dependencies: - esutils "^2.0.2" - -dom-scroll-into-view@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/dom-scroll-into-view/-/dom-scroll-into-view-1.2.1.tgz#e8f36732dd089b0201a88d7815dc3f88e6d66c7e" - integrity sha512-LwNVg3GJOprWDO+QhLL1Z9MMgWe/KAFLxVWKzjRTxNSPn8/LLDIfmuG71YHznXCqaqTjvHJDYO1MEAgX6XCNbQ== - -dom-serializer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-2.0.0.tgz#e41b802e1eedf9f6cae183ce5e622d789d7d8e53" - integrity sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg== - dependencies: - domelementtype "^2.3.0" - domhandler "^5.0.2" - entities "^4.2.0" - -domelementtype@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d" - integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw== - -domexception@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/domexception/-/domexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" - integrity sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw== - dependencies: - webidl-conversions "^7.0.0" - -domhandler@^5.0, domhandler@^5.0.2, domhandler@^5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-5.0.3.tgz#cc385f7f751f1d1fc650c21374804254538c7d31" - integrity sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w== - dependencies: - domelementtype "^2.3.0" - -dompurify@^2.2.0: - version "2.4.7" - resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.4.7.tgz#277adeb40a2c84be2d42a8bcd45f582bfa4d0cfc" - integrity sha512-kxxKlPEDa6Nc5WJi+qRgPbOAbgTpSULL+vI3NUXsZMlkJxTqYI9wg5ZTay2sFrdZRWHPWNi+EdAhcJf81WtoMQ== - -domutils@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-3.1.0.tgz#c47f551278d3dc4b0b1ab8cbb42d751a6f0d824e" - integrity sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA== - dependencies: - dom-serializer "^2.0.0" - domelementtype "^2.3.0" - domhandler "^5.0.3" - -dot-prop@^5.1.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88" - integrity sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q== - dependencies: - is-obj "^2.0.0" - -dup@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/dup/-/dup-1.0.0.tgz#51fc5ac685f8196469df0b905e934b20af5b4029" - integrity sha512-Bz5jxMMC0wgp23Zm15ip1x8IhYRqJvF3nFC0UInJUDkN1z4uNPk9jTnfCUJXbOGiQ1JbXLQsiV41Fb+HXcj5BA== - -earcut@^2.2.4: - version "2.2.4" - resolved "https://registry.yarnpkg.com/earcut/-/earcut-2.2.4.tgz#6d02fd4d68160c114825d06890a92ecaae60343a" - integrity sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ== - -eastasianwidth@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" - integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== - -electron-to-chromium@^1.4.601: - version "1.4.601" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.601.tgz#cac69868548aee89961ffe63ff5a7716f0685b75" - integrity sha512-SpwUMDWe9tQu8JX5QCO1+p/hChAi9AE9UpoC3rcHVc+gdCGlbT3SGb5I1klgb952HRIyvt9wZhSz9bNBYz9swA== - -email-addresses@^3.0.1: - version "3.1.0" - resolved "https://registry.yarnpkg.com/email-addresses/-/email-addresses-3.1.0.tgz#cabf7e085cbdb63008a70319a74e6136188812fb" - integrity sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg== - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -emoji-regex@^9.2.2: - version "9.2.2" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" - integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== - -entities@^4.2.0, entities@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" - integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== - -error-ex@^1.3.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" - integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== - dependencies: - is-arrayish "^0.2.1" - -es-abstract@^1.22.1: - version "1.22.3" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.3.tgz#48e79f5573198de6dee3589195727f4f74bc4f32" - integrity sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA== - dependencies: - array-buffer-byte-length "^1.0.0" - arraybuffer.prototype.slice "^1.0.2" - available-typed-arrays "^1.0.5" - call-bind "^1.0.5" - es-set-tostringtag "^2.0.1" - es-to-primitive "^1.2.1" - function.prototype.name "^1.1.6" - get-intrinsic "^1.2.2" - get-symbol-description "^1.0.0" - globalthis "^1.0.3" - gopd "^1.0.1" - has-property-descriptors "^1.0.0" - has-proto "^1.0.1" - has-symbols "^1.0.3" - hasown "^2.0.0" - internal-slot "^1.0.5" - is-array-buffer "^3.0.2" - is-callable "^1.2.7" - is-negative-zero "^2.0.2" - is-regex "^1.1.4" - is-shared-array-buffer "^1.0.2" - is-string "^1.0.7" - is-typed-array "^1.1.12" - is-weakref "^1.0.2" - object-inspect "^1.13.1" - object-keys "^1.1.1" - object.assign "^4.1.4" - regexp.prototype.flags "^1.5.1" - safe-array-concat "^1.0.1" - safe-regex-test "^1.0.0" - string.prototype.trim "^1.2.8" - string.prototype.trimend "^1.0.7" - string.prototype.trimstart "^1.0.7" - typed-array-buffer "^1.0.0" - typed-array-byte-length "^1.0.0" - typed-array-byte-offset "^1.0.0" - typed-array-length "^1.0.4" - unbox-primitive "^1.0.2" - which-typed-array "^1.1.13" - -es-iterator-helpers@^1.0.12, es-iterator-helpers@^1.0.15: - version "1.0.15" - resolved "https://registry.yarnpkg.com/es-iterator-helpers/-/es-iterator-helpers-1.0.15.tgz#bd81d275ac766431d19305923707c3efd9f1ae40" - integrity sha512-GhoY8uYqd6iwUl2kgjTm4CZAf6oo5mHK7BPqx3rKgx893YSsy0LGHV6gfqqQvZt/8xM8xeOnfXBCfqclMKkJ5g== - dependencies: - asynciterator.prototype "^1.0.0" - call-bind "^1.0.2" - define-properties "^1.2.1" - es-abstract "^1.22.1" - es-set-tostringtag "^2.0.1" - function-bind "^1.1.1" - get-intrinsic "^1.2.1" - globalthis "^1.0.3" - has-property-descriptors "^1.0.0" - has-proto "^1.0.1" - has-symbols "^1.0.3" - internal-slot "^1.0.5" - iterator.prototype "^1.1.2" - safe-array-concat "^1.0.1" - -es-set-tostringtag@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz#11f7cc9f63376930a5f20be4915834f4bc74f9c9" - integrity sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q== - dependencies: - get-intrinsic "^1.2.2" - has-tostringtag "^1.0.0" - hasown "^2.0.0" - -es-shim-unscopables@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz#1f6942e71ecc7835ed1c8a83006d8771a63a3763" - integrity sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw== - dependencies: - hasown "^2.0.0" - -es-to-primitive@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" - integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== - dependencies: - is-callable "^1.1.4" - is-date-object "^1.0.1" - is-symbol "^1.0.2" - -es6-promisify@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-6.1.1.tgz#46837651b7b06bf6fff893d03f29393668d01621" - integrity sha512-HBL8I3mIki5C1Cc9QjKUenHtnG0A5/xA8Q/AllRcfiwl2CZFXGK7ddBiCoRwAix4i2KxcQfjtIVcrVbB3vbmwg== - -es6-promisify@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-7.0.0.tgz#9a710008dd6a4ab75a89e280bad787bfb749927b" - integrity sha512-ginqzK3J90Rd4/Yz7qRrqUeIpe3TwSXTPPZtPne7tGBPeAaQiU8qt4fpKApnxHcq1AwtUdHVg5P77x/yrggG8Q== - -esbuild@^0.12.25: - version "0.12.29" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.29.tgz#be602db7c4dc78944a9dbde0d1ea19d36c1f882d" - integrity sha512-w/XuoBCSwepyiZtIRsKsetiLDUVGPVw1E/R3VTFSecIy8UR7Cq3SOtwKHJMFoVqqVG36aGkzh4e8BvpO1Fdc7g== - -esbuild@^0.18.10: - version "0.18.20" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.18.20.tgz#4709f5a34801b43b799ab7d6d82f7284a9b7a7a6" - integrity sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA== - optionalDependencies: - "@esbuild/android-arm" "0.18.20" - "@esbuild/android-arm64" "0.18.20" - "@esbuild/android-x64" "0.18.20" - "@esbuild/darwin-arm64" "0.18.20" - "@esbuild/darwin-x64" "0.18.20" - "@esbuild/freebsd-arm64" "0.18.20" - "@esbuild/freebsd-x64" "0.18.20" - "@esbuild/linux-arm" "0.18.20" - "@esbuild/linux-arm64" "0.18.20" - "@esbuild/linux-ia32" "0.18.20" - "@esbuild/linux-loong64" "0.18.20" - "@esbuild/linux-mips64el" "0.18.20" - "@esbuild/linux-ppc64" "0.18.20" - "@esbuild/linux-riscv64" "0.18.20" - "@esbuild/linux-s390x" "0.18.20" - "@esbuild/linux-x64" "0.18.20" - "@esbuild/netbsd-x64" "0.18.20" - "@esbuild/openbsd-x64" "0.18.20" - "@esbuild/sunos-x64" "0.18.20" - "@esbuild/win32-arm64" "0.18.20" - "@esbuild/win32-ia32" "0.18.20" - "@esbuild/win32-x64" "0.18.20" - -esbuild@^0.19.3: - version "0.19.8" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.8.tgz#ad05b72281d84483fa6b5345bd246c27a207b8f1" - integrity sha512-l7iffQpT2OrZfH2rXIp7/FkmaeZM0vxbxN9KfiCwGYuZqzMg/JdvX26R31Zxn/Pxvsrg3Y9N6XTcnknqDyyv4w== - optionalDependencies: - "@esbuild/android-arm" "0.19.8" - "@esbuild/android-arm64" "0.19.8" - "@esbuild/android-x64" "0.19.8" - "@esbuild/darwin-arm64" "0.19.8" - "@esbuild/darwin-x64" "0.19.8" - "@esbuild/freebsd-arm64" "0.19.8" - "@esbuild/freebsd-x64" "0.19.8" - "@esbuild/linux-arm" "0.19.8" - "@esbuild/linux-arm64" "0.19.8" - "@esbuild/linux-ia32" "0.19.8" - "@esbuild/linux-loong64" "0.19.8" - "@esbuild/linux-mips64el" "0.19.8" - "@esbuild/linux-ppc64" "0.19.8" - "@esbuild/linux-riscv64" "0.19.8" - "@esbuild/linux-s390x" "0.19.8" - "@esbuild/linux-x64" "0.19.8" - "@esbuild/netbsd-x64" "0.19.8" - "@esbuild/openbsd-x64" "0.19.8" - "@esbuild/sunos-x64" "0.19.8" - "@esbuild/win32-arm64" "0.19.8" - "@esbuild/win32-ia32" "0.19.8" - "@esbuild/win32-x64" "0.19.8" - -escalade@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" - integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== - -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== - -escape-string-regexp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - -escodegen@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" - integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== - dependencies: - esprima "^4.0.1" - estraverse "^5.2.0" - esutils "^2.0.2" - optionalDependencies: - source-map "~0.6.1" - -eslint-config-prettier@^8.5.0: - version "8.10.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz#3a06a662130807e2502fc3ff8b4143d8a0658e11" - integrity sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg== - -eslint-plugin-jsx-a11y@^6.7.1: - version "6.8.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.8.0.tgz#2fa9c701d44fcd722b7c771ec322432857fcbad2" - integrity sha512-Hdh937BS3KdwwbBaKd5+PLCOmYY6U4f2h9Z2ktwtNKvIdIEu137rjYbcb9ApSbVJfWxANNuiKTD/9tOKjK9qOA== - dependencies: - "@babel/runtime" "^7.23.2" - aria-query "^5.3.0" - array-includes "^3.1.7" - array.prototype.flatmap "^1.3.2" - ast-types-flow "^0.0.8" - axe-core "=4.7.0" - axobject-query "^3.2.1" - damerau-levenshtein "^1.0.8" - emoji-regex "^9.2.2" - es-iterator-helpers "^1.0.15" - hasown "^2.0.0" - jsx-ast-utils "^3.3.5" - language-tags "^1.0.9" - minimatch "^3.1.2" - object.entries "^1.1.7" - object.fromentries "^2.0.7" - -eslint-plugin-prettier@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b" - integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ== - dependencies: - prettier-linter-helpers "^1.0.0" - -eslint-plugin-react@^7.30.1: - version "7.33.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz#69ee09443ffc583927eafe86ffebb470ee737608" - integrity sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw== - dependencies: - array-includes "^3.1.6" - array.prototype.flatmap "^1.3.1" - array.prototype.tosorted "^1.1.1" - doctrine "^2.1.0" - es-iterator-helpers "^1.0.12" - estraverse "^5.3.0" - jsx-ast-utils "^2.4.1 || ^3.0.0" - minimatch "^3.1.2" - object.entries "^1.1.6" - object.fromentries "^2.0.6" - object.hasown "^1.1.2" - object.values "^1.1.6" - prop-types "^15.8.1" - resolve "^2.0.0-next.4" - semver "^6.3.1" - string.prototype.matchall "^4.0.8" - -eslint-scope@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" - integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== - dependencies: - esrecurse "^4.3.0" - estraverse "^4.1.1" - -eslint-scope@^7.2.2: - version "7.2.2" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" - integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== - dependencies: - esrecurse "^4.3.0" - estraverse "^5.2.0" - -eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: - version "3.4.3" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" - integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== - -eslint@^8.19.0: - version "8.55.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.55.0.tgz#078cb7b847d66f2c254ea1794fa395bf8e7e03f8" - integrity sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA== - dependencies: - "@eslint-community/eslint-utils" "^4.2.0" - "@eslint-community/regexpp" "^4.6.1" - "@eslint/eslintrc" "^2.1.4" - "@eslint/js" "8.55.0" - "@humanwhocodes/config-array" "^0.11.13" - "@humanwhocodes/module-importer" "^1.0.1" - "@nodelib/fs.walk" "^1.2.8" - "@ungap/structured-clone" "^1.2.0" - ajv "^6.12.4" - chalk "^4.0.0" - cross-spawn "^7.0.2" - debug "^4.3.2" - doctrine "^3.0.0" - escape-string-regexp "^4.0.0" - eslint-scope "^7.2.2" - eslint-visitor-keys "^3.4.3" - espree "^9.6.1" - esquery "^1.4.2" - esutils "^2.0.2" - fast-deep-equal "^3.1.3" - file-entry-cache "^6.0.1" - find-up "^5.0.0" - glob-parent "^6.0.2" - globals "^13.19.0" - graphemer "^1.4.0" - ignore "^5.2.0" - imurmurhash "^0.1.4" - is-glob "^4.0.0" - is-path-inside "^3.0.3" - js-yaml "^4.1.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.4.1" - lodash.merge "^4.6.2" - minimatch "^3.1.2" - natural-compare "^1.4.0" - optionator "^0.9.3" - strip-ansi "^6.0.1" - text-table "^0.2.0" - -esm@^3.2.25: - version "3.2.25" - resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10" - integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA== - -espree@^9.6.0, espree@^9.6.1: - version "9.6.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" - integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== - dependencies: - acorn "^8.9.0" - acorn-jsx "^5.3.2" - eslint-visitor-keys "^3.4.1" - -esprima@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -esquery@^1.4.2: - version "1.5.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" - integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== - dependencies: - estraverse "^5.1.0" - -esrecurse@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" - integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== - dependencies: - estraverse "^5.2.0" - -estraverse@^4.1.1: - version "4.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" - integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== - -estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" - integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -eventemitter3@^3.1.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" - integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== - -eventemitter3@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" - integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== - -events@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" - integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== - -extend@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== - -fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== - -fast-diff@^1.1.2: - version "1.3.0" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" - integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== - -fast-glob@^3.2.9: - version "3.3.2" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" - integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fast-json-stable-stringify@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" - integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== - -fast-levenshtein@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== - -fastq@^1.6.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" - integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== - dependencies: - reusify "^1.0.4" - -fetch-jsonp@^1.1.3: - version "1.3.0" - resolved "https://registry.yarnpkg.com/fetch-jsonp/-/fetch-jsonp-1.3.0.tgz#99b8c25bd100938d7a7a6b5db9d6b81f32a10809" - integrity sha512-hxCYGvmANEmpkHpeWY8Kawfa5Z1t2csTpIClIDG/0S92eALWHRU1RnGaj86Tf5Cc0QF+afSa4SQ4pFB2rFM5QA== - -fflate@^0.4.8: - version "0.4.8" - resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.4.8.tgz#f90b82aefbd8ac174213abb338bd7ef848f0f5ae" - integrity sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA== - -fflate@^0.7.1: - version "0.7.4" - resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.7.4.tgz#61587e5d958fdabb5a9368a302c25363f4f69f50" - integrity sha512-5u2V/CDW15QM1XbbgS+0DfPxVB+jUKhWEKuuFuHncbk3tEEqzmoXL+2KyOFuKGqOnmdIy0/davWF1CkuwtibCw== - -file-entry-cache@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" - integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== - dependencies: - flat-cache "^3.0.4" - -filename-reserved-regex@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz#abf73dfab735d045440abfea2d91f389ebbfa229" - integrity sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ== - -filenamify@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/filenamify/-/filenamify-4.3.0.tgz#62391cb58f02b09971c9d4f9d63b3cf9aba03106" - integrity sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg== - dependencies: - filename-reserved-regex "^2.0.0" - strip-outer "^1.0.1" - trim-repeated "^1.0.0" - -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== - dependencies: - to-regex-range "^5.0.1" - -find-cache-dir@^3.3.1: - version "3.3.2" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.2.tgz#b30c5b6eff0730731aea9bbd9dbecbd80256d64b" - integrity sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig== - dependencies: - commondir "^1.0.1" - make-dir "^3.0.2" - pkg-dir "^4.1.0" - -find-up@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" - integrity sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ== - dependencies: - locate-path "^2.0.0" - -find-up@^4.0.0, find-up@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" - integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== - dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" - -find-up@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" - integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== - dependencies: - locate-path "^6.0.0" - path-exists "^4.0.0" - -flat-cache@^3.0.4: - version "3.2.0" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee" - integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw== - dependencies: - flatted "^3.2.9" - keyv "^4.5.3" - rimraf "^3.0.2" - -flatted@^3.2.9: - version "3.2.9" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" - integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== - -for-each@^0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" - integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== - dependencies: - is-callable "^1.1.3" - -foreground-child@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-2.0.0.tgz#71b32800c9f15aa8f2f83f4a6bd9bff35d861a53" - integrity sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA== - dependencies: - cross-spawn "^7.0.0" - signal-exit "^3.0.2" - -foreground-child@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.1.1.tgz#1d173e776d75d2772fed08efe4a0de1ea1b12d0d" - integrity sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg== - dependencies: - cross-spawn "^7.0.0" - signal-exit "^4.0.1" - -form-data@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" - integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - -fs-extra@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" - integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== - dependencies: - graceful-fs "^4.2.0" - jsonfile "^4.0.0" - universalify "^0.1.0" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - -fsevents@2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - -fsevents@~2.3.2, fsevents@~2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - -function-bind@^1.1.1, function-bind@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" - integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== - -function.prototype.name@^1.1.5, function.prototype.name@^1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" - integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - functions-have-names "^1.2.3" - -functions-have-names@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" - integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== - -genbank-parser@^1.0.0: - version "1.2.4" - resolved "https://registry.yarnpkg.com/genbank-parser/-/genbank-parser-1.2.4.tgz#ee2f9c32f66875024af0c09ee0ec5e10fb231802" - integrity sha512-r3pTgKHZx/rol90v2cezrNhfMhq3yHWCnBYyETNIJkvnJk+cwx/D/ZVgAy1SX8zwtnfvYQmFbqlpbh2f4t0h2w== - -generic-filehandle@^3.0.0, generic-filehandle@^3.0.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/generic-filehandle/-/generic-filehandle-3.1.1.tgz#7328c1f2e490c4d90b2fd8db4c8a8c87d5e3cf66" - integrity sha512-8fLkHgbnKlOWhJgPmvGm+0HclUkyCPM0WGZQOAWdebNsWbHZJi7pW/RAPp26fhqlVpgT5tHqVKWunf/r+HRoEw== - dependencies: - es6-promisify "^6.1.1" - -gensync@^1.0.0-beta.2: - version "1.0.0-beta.2" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" - integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== - -get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-func-name@^2.0.1, get-func-name@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41" - integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ== - -get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.2.tgz#281b7622971123e1ef4b3c90fd7539306da93f3b" - integrity sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA== - dependencies: - function-bind "^1.1.2" - has-proto "^1.0.1" - has-symbols "^1.0.3" - hasown "^2.0.0" - -get-pkg-repo@^4.0.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/get-pkg-repo/-/get-pkg-repo-4.2.1.tgz#75973e1c8050c73f48190c52047c4cee3acbf385" - integrity sha512-2+QbHjFRfGB74v/pYWjd5OhU3TDIC2Gv/YKUTk/tCvAz0pkn/Mz6P3uByuBimLOcPvN2jYdScl3xGFSrx0jEcA== - dependencies: - "@hutson/parse-repository-url" "^3.0.0" - hosted-git-info "^4.0.0" - through2 "^2.0.0" - yargs "^16.2.0" - -get-symbol-description@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" - integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.1.1" - -gh-pages@^3.1.0: - version "3.2.3" - resolved "https://registry.yarnpkg.com/gh-pages/-/gh-pages-3.2.3.tgz#897e5f15e111f42af57d21d430b83e5cdf29472c" - integrity sha512-jA1PbapQ1jqzacECfjUaO9gV8uBgU6XNMV0oXLtfCX3haGLe5Atq8BxlrADhbD6/UdG9j6tZLWAkAybndOXTJg== - dependencies: - async "^2.6.1" - commander "^2.18.0" - email-addresses "^3.0.1" - filenamify "^4.3.0" - find-cache-dir "^3.3.1" - fs-extra "^8.1.0" - globby "^6.1.0" - -git-raw-commits@^2.0.8: - version "2.0.11" - resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.11.tgz#bc3576638071d18655e1cc60d7f524920008d723" - integrity sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A== - dependencies: - dargs "^7.0.0" - lodash "^4.17.15" - meow "^8.0.0" - split2 "^3.0.0" - through2 "^4.0.0" - -git-remote-origin-url@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz#5282659dae2107145a11126112ad3216ec5fa65f" - integrity sha512-eU+GGrZgccNJcsDH5LkXR3PB9M958hxc7sbA8DFJjrv9j4L2P/eZfKhM+QD6wyzpiv+b1BpK0XrYCxkovtjSLw== - dependencies: - gitconfiglocal "^1.0.0" - pify "^2.3.0" - -git-semver-tags@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-4.1.1.tgz#63191bcd809b0ec3e151ba4751c16c444e5b5780" - integrity sha512-OWyMt5zBe7xFs8vglMmhM9lRQzCWL3WjHtxNNfJTMngGym7pC1kh8sP6jevfydJ6LP3ZvGxfb6ABYgPUM0mtsA== - dependencies: - meow "^8.0.0" - semver "^6.0.0" - -gitconfiglocal@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz#41d045f3851a5ea88f03f24ca1c6178114464b9b" - integrity sha512-spLUXeTAVHxDtKsJc8FkFVgFtMdEN9qPGpL23VfSHx4fP4+Ds097IXLvymbnDH8FnmxX5Nr9bPw3A+AQ6mWEaQ== - dependencies: - ini "^1.3.2" - -glob-parent@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - -glob-parent@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" - integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== - dependencies: - is-glob "^4.0.3" - -glob@^10.3.7: - version "10.3.10" - resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.10.tgz#0351ebb809fd187fe421ab96af83d3a70715df4b" - integrity sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g== - dependencies: - foreground-child "^3.1.0" - jackspeak "^2.3.5" - minimatch "^9.0.1" - minipass "^5.0.0 || ^6.0.2 || ^7.0.0" - path-scurry "^1.10.1" - -glob@^7.0.3, glob@^7.1.3, glob@^7.1.4: - version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^8.0.3: - version "8.1.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" - integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^5.0.1" - once "^1.3.0" - -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== - -globals@^13.19.0: - version "13.23.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.23.0.tgz#ef31673c926a0976e1f61dab4dca57e0c0a8af02" - integrity sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA== - dependencies: - type-fest "^0.20.2" - -globalthis@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" - integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== - dependencies: - define-properties "^1.1.3" - -globby@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== - dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.2.9" - ignore "^5.2.0" - merge2 "^1.4.1" - slash "^3.0.0" - -globby@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" - integrity sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw== - dependencies: - array-union "^1.0.1" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -gopd@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" - integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== - dependencies: - get-intrinsic "^1.1.3" - -graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0: - version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" - integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== - -graphemer@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" - integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== - -handlebars@^4.7.7: - version "4.7.8" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.8.tgz#41c42c18b1be2365439188c77c6afae71c0cd9e9" - integrity sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ== - dependencies: - minimist "^1.2.5" - neo-async "^2.6.2" - source-map "^0.6.1" - wordwrap "^1.0.0" - optionalDependencies: - uglify-js "^3.1.4" - -hard-rejection@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" - integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== - -has-bigints@^1.0.1, has-bigints@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" - integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -has-property-descriptors@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340" - integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg== - dependencies: - get-intrinsic "^1.2.2" - -has-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" - integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== - -has-symbols@^1.0.2, has-symbols@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" - integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== - -has-tostringtag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" - integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== - dependencies: - has-symbols "^1.0.2" - -hasown@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" - integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== - dependencies: - function-bind "^1.1.2" - -higlass-register@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/higlass-register/-/higlass-register-0.3.0.tgz#6c728ad911359bd7e88749aceaffd8812415c52a" - integrity sha512-D4I+ATxFuTn+Q6p8Y9rUa+X3b3cqMqhu9Tya6uHtvgV5cs39Mk7i6Z+7PMA8YuwQd5gLMSxCm2lCyWmxRVBQsQ== - -higlass-text@^0.1.1: - version "0.1.6" - resolved "https://registry.yarnpkg.com/higlass-text/-/higlass-text-0.1.6.tgz#662352a7981ee9c0671a2b31eef5415e7ceee78b" - integrity sha512-sjAROJfE38bSP72XncPTBV4AeYRs50N85OqRXooEwXF5zKVssBv1EKrvls0ralnSQ1aZX74cB/hTskbI91iRng== - dependencies: - d3-color "^3.1.0" - d3-scale "^4.0.2" - higlass-register "^0.3.0" - slugid "^2.0.0" - -higlass@^1.13.3: - version "1.13.3" - resolved "https://registry.yarnpkg.com/higlass/-/higlass-1.13.3.tgz#8bf01bce70f64fa333cb589433c2bca808542334" - integrity sha512-aZ+Q+ClF1TTeV81ChuGSd5CHiVJf8+1c6w6/sXGAOonkGVQ54yuZpSYafMatKAjytM6/fwSaHs3uQT2xUEE2MA== - dependencies: - ajv "^6.10.0" - box-intersect "^1.0.1" - buffer "^6.0.3" - clsx "^1.2.1" - css-element-queries "^1.2.3" - d3-array "^2.7.1" - d3-axis "^2.0.0" - d3-brush "^2.1.0" - d3-color "^2.0.0" - d3-drag "^2.0.0" - d3-dsv "^2.0.0" - d3-format "^2.0.0" - d3-geo "^2.0.1" - d3-queue "^3.0.7" - d3-request "^1.0.6" - d3-scale "^4.0.2" - d3-selection "^2.0.0" - d3-transition "^3.0.1" - d3-zoom "^3.0.0" - dom-scroll-into-view "^1.2.1" - genbank-parser "^1.0.0" - ndarray "^1.0.18" - pako "^1.0.10" - prismjs "^1.16.0" - prop-types "^15.6.0" - pub-sub-es "^2.0.1" - react-checkbox-tree "^1.7.3" - react-color "^2.13.8" - react-grid-layout "^0.16.6" - react-simple-code-editor "^0.9.10" - react-sortable-hoc "^1.10.1" - reactcss "^1.2.3" - robust-point-in-polygon "^1.0.3" - slugid "^3.2.0" - url-parse "^1.4.3" - vkbeautify "^0.99.3" - -history@^4.9.0: - version "4.10.1" - resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3" - integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew== - dependencies: - "@babel/runtime" "^7.1.2" - loose-envify "^1.2.0" - resolve-pathname "^3.0.0" - tiny-invariant "^1.0.2" - tiny-warning "^1.0.0" - value-equal "^1.0.1" - -hoist-non-react-statics@^3.1.0: - version "3.3.2" - resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" - integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== - dependencies: - react-is "^16.7.0" - -hosted-git-info@^2.1.4: - version "2.8.9" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" - integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== - -hosted-git-info@^4.0.0, hosted-git-info@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-4.1.0.tgz#827b82867e9ff1c8d0c4d9d53880397d2c86d224" - integrity sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA== - dependencies: - lru-cache "^6.0.0" - -html-encoding-sniffer@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz#2cb1a8cf0db52414776e5b2a7a04d5dd98158de9" - integrity sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA== - dependencies: - whatwg-encoding "^2.0.0" - -html-escaper@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" - integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== - -html-to-react@^1.3.4: - version "1.7.0" - resolved "https://registry.yarnpkg.com/html-to-react/-/html-to-react-1.7.0.tgz#1664a0233a930ab1b12c442ddef0f1b72e7459f4" - integrity sha512-b5HTNaTGyOj5GGIMiWVr1k57egAZ/vGy0GGefnCQ1VW5hu9+eku8AXHtf2/DeD95cj/FKBKYa1J7SWBOX41yUQ== - dependencies: - domhandler "^5.0" - htmlparser2 "^9.0" - lodash.camelcase "^4.3.0" - -html2canvas@^1.0.0-rc.5: - version "1.4.1" - resolved "https://registry.yarnpkg.com/html2canvas/-/html2canvas-1.4.1.tgz#7cef1888311b5011d507794a066041b14669a543" - integrity sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA== - dependencies: - css-line-break "^2.1.0" - text-segmentation "^1.0.3" - -htmlparser2@^9.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-9.0.0.tgz#e431142b7eeb1d91672742dea48af8ac7140cddb" - integrity sha512-uxbSI98wmFT/G4P2zXx4OVx04qWUmyFPrD2/CNepa2Zo3GPNaCaaxElDgwUrwYWkK1nr9fft0Ya8dws8coDLLQ== - dependencies: - domelementtype "^2.3.0" - domhandler "^5.0.3" - domutils "^3.1.0" - entities "^4.5.0" - -http-proxy-agent@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" - integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== - dependencies: - "@tootallnate/once" "2" - agent-base "6" - debug "4" - -https-proxy-agent@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" - integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== - dependencies: - agent-base "6" - debug "4" - -iconv-lite@0.4: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - -iconv-lite@0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" - integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== - dependencies: - safer-buffer ">= 2.1.2 < 3.0.0" - -ieee754@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - -ignore@^5.2.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.0.tgz#67418ae40d34d6999c95ff56016759c718c82f78" - integrity sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg== - -import-fresh@^3.2.1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" - integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== - dependencies: - parent-module "^1.0.0" - resolve-from "^4.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== - -indent-string@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" - integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.3, inherits@~2.0.3, inherits@~2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -ini@^1.3.2: - version "1.3.8" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" - integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== - -internal-slot@^1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.6.tgz#37e756098c4911c5e912b8edbf71ed3aa116f930" - integrity sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg== - dependencies: - get-intrinsic "^1.2.2" - hasown "^2.0.0" - side-channel "^1.0.4" - -"internmap@1 - 2": - version "2.0.3" - resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.3.tgz#6685f23755e43c524e251d29cbc97248e3061009" - integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg== - -internmap@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/internmap/-/internmap-1.0.1.tgz#0017cc8a3b99605f0302f2b198d272e015e5df95" - integrity sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw== - -invariant@^2.2.4: - version "2.2.4" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" - integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== - dependencies: - loose-envify "^1.0.0" - -iota-array@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/iota-array/-/iota-array-1.0.0.tgz#81ef57fe5d05814cd58c2483632a99c30a0e8087" - integrity sha512-pZ2xT+LOHckCatGQ3DcG/a+QuEqvoxqkiL7tvE8nn3uuu+f6i1TtpB5/FtWFbxUuVr5PZCx8KskuGatbJDXOWA== - -is-alphabetical@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-alphabetical/-/is-alphabetical-1.0.4.tgz#9e7d6b94916be22153745d184c298cbf986a686d" - integrity sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg== - -is-alphanumerical@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-alphanumerical/-/is-alphanumerical-1.0.4.tgz#7eb9a2431f855f6b1ef1a78e326df515696c4dbf" - integrity sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A== - dependencies: - is-alphabetical "^1.0.0" - is-decimal "^1.0.0" - -is-array-buffer@^3.0.1, is-array-buffer@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz#f2653ced8412081638ecb0ebbd0c41c6e0aecbbe" - integrity sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.2.0" - is-typed-array "^1.1.10" - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== - -is-async-function@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-async-function/-/is-async-function-2.0.0.tgz#8e4418efd3e5d3a6ebb0164c05ef5afb69aa9646" - integrity sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA== - dependencies: - has-tostringtag "^1.0.0" - -is-bigint@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" - integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== - dependencies: - has-bigints "^1.0.1" - -is-boolean-object@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" - integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== - dependencies: - call-bind "^1.0.2" - has-tostringtag "^1.0.0" - -is-buffer@^1.0.2: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== - -is-buffer@^2.0.0: - version "2.0.5" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" - integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== - -is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: - version "1.2.7" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" - integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== - -is-core-module@^2.13.0, is-core-module@^2.5.0: - version "2.13.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" - integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== - dependencies: - hasown "^2.0.0" - -is-date-object@^1.0.1, is-date-object@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" - integrity sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ== - dependencies: - has-tostringtag "^1.0.0" - -is-decimal@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-decimal/-/is-decimal-1.0.4.tgz#65a3a5958a1c5b63a706e1b333d7cd9f630d3fa5" - integrity sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw== - -is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== - -is-finalizationregistry@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-finalizationregistry/-/is-finalizationregistry-1.0.2.tgz#c8749b65f17c133313e661b1289b95ad3dbd62e6" - integrity sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw== - dependencies: - call-bind "^1.0.2" - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-generator-function@^1.0.10: - version "1.0.10" - resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72" - integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A== - dependencies: - has-tostringtag "^1.0.0" - -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - -is-hexadecimal@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz#cc35c97588da4bd49a8eedd6bc4082d44dcb23a7" - integrity sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw== - -is-map@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127" - integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg== - -is-negative-zero@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" - integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== - -is-number-object@^1.0.4: - version "1.0.7" - resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.7.tgz#59d50ada4c45251784e9904f5246c742f07a42fc" - integrity sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ== - dependencies: - has-tostringtag "^1.0.0" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-obj@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" - integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== - -is-observable@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-2.1.0.tgz#5c8d733a0b201c80dff7bb7c0df58c6a255c7c69" - integrity sha512-DailKdLb0WU+xX8K5w7VsJhapwHLZ9jjmazqCJq4X12CTgqq73TKnbRcnSLuXYPOoLQgV5IrD7ePiX/h1vnkBw== - -is-path-inside@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" - integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== - -is-plain-obj@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" - integrity sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg== - -is-plain-obj@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" - integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== - -is-potential-custom-element-name@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" - integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== - -is-regex@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" - integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== - dependencies: - call-bind "^1.0.2" - has-tostringtag "^1.0.0" - -is-set@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.2.tgz#90755fa4c2562dc1c5d4024760d6119b94ca18ec" - integrity sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g== - -is-shared-array-buffer@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79" - integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== - dependencies: - call-bind "^1.0.2" - -is-string@^1.0.5, is-string@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" - integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== - dependencies: - has-tostringtag "^1.0.0" - -is-symbol@^1.0.2, is-symbol@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" - integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== - dependencies: - has-symbols "^1.0.2" - -is-text-path@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-text-path/-/is-text-path-1.0.1.tgz#4e1aa0fb51bfbcb3e92688001397202c1775b66e" - integrity sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w== - dependencies: - text-extensions "^1.0.0" - -is-typed-array@^1.1.10, is-typed-array@^1.1.12, is-typed-array@^1.1.9: - version "1.1.12" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a" - integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg== - dependencies: - which-typed-array "^1.1.11" - -is-weakmap@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.1.tgz#5008b59bdc43b698201d18f62b37b2ca243e8cf2" - integrity sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA== - -is-weakref@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2" - integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== - dependencies: - call-bind "^1.0.2" - -is-weakset@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/is-weakset/-/is-weakset-2.0.2.tgz#4569d67a747a1ce5a994dfd4ef6dcea76e7c0a1d" - integrity sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.1.1" - -isarray@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" - integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== - -isarray@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" - integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== - -istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" - integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== - -istanbul-lib-report@^3.0.0, istanbul-lib-report@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" - integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== - dependencies: - istanbul-lib-coverage "^3.0.0" - make-dir "^4.0.0" - supports-color "^7.1.0" - -istanbul-lib-source-maps@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" - integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" - -istanbul-reports@^3.1.4, istanbul-reports@^3.1.5: - version "3.1.6" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.6.tgz#2544bcab4768154281a2f0870471902704ccaa1a" - integrity sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg== - dependencies: - html-escaper "^2.0.0" - istanbul-lib-report "^3.0.0" - -iterator.prototype@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/iterator.prototype/-/iterator.prototype-1.1.2.tgz#5e29c8924f01916cb9335f1ff80619dcff22b0c0" - integrity sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w== - dependencies: - define-properties "^1.2.1" - get-intrinsic "^1.2.1" - has-symbols "^1.0.3" - reflect.getprototypeof "^1.0.4" - set-function-name "^2.0.1" - -jackspeak@^2.3.5: - version "2.3.6" - resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-2.3.6.tgz#647ecc472238aee4b06ac0e461acc21a8c505ca8" - integrity sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ== - dependencies: - "@isaacs/cliui" "^8.0.2" - optionalDependencies: - "@pkgjs/parseargs" "^0.11.0" - -jest-canvas-mock@~2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jest-canvas-mock/-/jest-canvas-mock-2.5.2.tgz#7e21ebd75e05ab41c890497f6ba8a77f915d2ad6" - integrity sha512-vgnpPupjOL6+L5oJXzxTxFrlGEIbHdZqFU+LFNdtLxZ3lRDCl17FlTMM7IatoRQkrcyOTMlDinjUguqmQ6bR2A== - dependencies: - cssfontparser "^1.2.1" - moo-color "^1.0.2" - -"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== - dependencies: - argparse "^2.0.1" - -jsdom@^19.0.0: - version "19.0.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-19.0.0.tgz#93e67c149fe26816d38a849ea30ac93677e16b6a" - integrity sha512-RYAyjCbxy/vri/CfnjUWJQQtZ3LKlLnDqj+9XLNnJPgEGeirZs3hllKR20re8LUZ6o1b1X4Jat+Qd26zmP41+A== - dependencies: - abab "^2.0.5" - acorn "^8.5.0" - acorn-globals "^6.0.0" - cssom "^0.5.0" - cssstyle "^2.3.0" - data-urls "^3.0.1" - decimal.js "^10.3.1" - domexception "^4.0.0" - escodegen "^2.0.0" - form-data "^4.0.0" - html-encoding-sniffer "^3.0.0" - http-proxy-agent "^5.0.0" - https-proxy-agent "^5.0.0" - is-potential-custom-element-name "^1.0.1" - nwsapi "^2.2.0" - parse5 "6.0.1" - saxes "^5.0.1" - symbol-tree "^3.2.4" - tough-cookie "^4.0.0" - w3c-hr-time "^1.0.2" - w3c-xmlserializer "^3.0.0" - webidl-conversions "^7.0.0" - whatwg-encoding "^2.0.0" - whatwg-mimetype "^3.0.0" - whatwg-url "^10.0.0" - ws "^8.2.3" - xml-name-validator "^4.0.0" - -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== - -json-buffer@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" - integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== - -json-parse-better-errors@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" - integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== - -json-parse-even-better-errors@^2.3.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" - integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== - -json-stable-stringify-without-jsonify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" - integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== - -json-stringify-pretty-compact@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/json-stringify-pretty-compact/-/json-stringify-pretty-compact-2.0.0.tgz#e77c419f52ff00c45a31f07f4c820c2433143885" - integrity sha512-WRitRfs6BGq4q8gTgOy4ek7iPFXjbra0H3PmDLKm2xnZ+Gh1HUhiKGgCZkSPNULlP7mvfu6FV/mOLhCarspADQ== - -json-stringify-safe@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== - -json5@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" - integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== - -jsonc-parser@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76" - integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== - -jsoncrush@^1.1.6: - version "1.1.8" - resolved "https://registry.yarnpkg.com/jsoncrush/-/jsoncrush-1.1.8.tgz#5dd9389df1979592df8c89ab99ba69b029a030be" - integrity sha512-lvIMGzMUA0fjuqwNcxlTNRq2bibPZ9auqT/LyGdlR5hvydJtA/BasSgkx4qclqTKVeTidrJvsS/oVjlTCPQ4Nw== - -jsonfile@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" - integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg== - optionalDependencies: - graceful-fs "^4.1.6" - -jsonparse@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" - integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== - -jspdf@^2.3.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/jspdf/-/jspdf-2.5.1.tgz#00c85250abf5447a05f3b32ab9935ab4a56592cc" - integrity sha512-hXObxz7ZqoyhxET78+XR34Xu2qFGrJJ2I2bE5w4SM8eFaFEkW2xcGRVUss360fYelwRSid/jT078kbNvmoW0QA== - dependencies: - "@babel/runtime" "^7.14.0" - atob "^2.1.2" - btoa "^1.2.1" - fflate "^0.4.8" - optionalDependencies: - canvg "^3.0.6" - core-js "^3.6.0" - dompurify "^2.2.0" - html2canvas "^1.0.0-rc.5" - -"jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.3.5: - version "3.3.5" - resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz#4766bd05a8e2a11af222becd19e15575e52a853a" - integrity sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ== - dependencies: - array-includes "^3.1.6" - array.prototype.flat "^1.3.1" - object.assign "^4.1.4" - object.values "^1.1.6" - -keyv@^4.5.3: - version "4.5.4" - resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" - integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== - dependencies: - json-buffer "3.0.1" - -kind-of@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" - integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== - -language-subtag-registry@^0.3.20: - version "0.3.22" - resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz#2e1500861b2e457eba7e7ae86877cbd08fa1fd1d" - integrity sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w== - -language-tags@^1.0.9: - version "1.0.9" - resolved "https://registry.yarnpkg.com/language-tags/-/language-tags-1.0.9.tgz#1ffdcd0ec0fafb4b1be7f8b11f306ad0f9c08777" - integrity sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA== - dependencies: - language-subtag-registry "^0.3.20" - -levn@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" - integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== - dependencies: - prelude-ls "^1.2.1" - type-check "~0.4.0" - -lines-and-columns@^1.1.6: - version "1.2.4" - resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" - integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== - -load-json-file@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" - integrity sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw== - dependencies: - graceful-fs "^4.1.2" - parse-json "^4.0.0" - pify "^3.0.0" - strip-bom "^3.0.0" - -local-pkg@^0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/local-pkg/-/local-pkg-0.4.3.tgz#0ff361ab3ae7f1c19113d9bb97b98b905dbc4963" - integrity sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g== - -locate-path@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" - integrity sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA== - dependencies: - p-locate "^2.0.0" - path-exists "^3.0.0" - -locate-path@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" - integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== - dependencies: - p-locate "^4.1.0" - -locate-path@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" - integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== - dependencies: - p-locate "^5.0.0" - -lodash-es@^4.17.15, lodash-es@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" - integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== - -lodash.camelcase@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" - integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA== - -lodash.clamp@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/lodash.clamp/-/lodash.clamp-4.0.3.tgz#5c24bedeeeef0753560dc2b4cb4671f90a6ddfaa" - integrity sha512-HvzRFWjtcguTW7yd8NJBshuNaCa8aqNFtnswdT7f/cMd/1YKy5Zzoq4W/Oxvnx9l7aeY258uSdDfM793+eLsVg== - -lodash.debounce@^4.0.0: - version "4.0.8" - resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" - integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== - -lodash.isequal@^4.0.0, lodash.isequal@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" - integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== - -lodash.ismatch@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" - integrity sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g== - -lodash.merge@^4.6.2: - version "4.6.2" - resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" - integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== - -lodash@^4.0.1, lodash@^4.17.10, lodash@^4.17.14, lodash@^4.17.15: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -long@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" - integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== - -longest-streak@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-2.0.4.tgz#b8599957da5b5dab64dee3fe316fa774597d90e4" - integrity sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg== - -loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" - integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== - dependencies: - js-tokens "^3.0.0 || ^4.0.0" - -loupe@^2.3.6: - version "2.3.7" - resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.7.tgz#6e69b7d4db7d3ab436328013d37d1c8c3540c697" - integrity sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA== - dependencies: - get-func-name "^2.0.1" - -lru-cache@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" - integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== - dependencies: - yallist "^3.0.2" - -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - -"lru-cache@^9.1.1 || ^10.0.0": - version "10.1.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.1.0.tgz#2098d41c2dc56500e6c88584aa656c84de7d0484" - integrity sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag== - -magic-string@^0.30.1: - version "0.30.5" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.5.tgz#1994d980bd1c8835dc6e78db7cbd4ae4f24746f9" - integrity sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA== - dependencies: - "@jridgewell/sourcemap-codec" "^1.4.15" - -make-dir@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" - integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== - dependencies: - semver "^6.0.0" - -make-dir@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" - integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== - dependencies: - semver "^7.5.3" - -map-obj@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" - integrity sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg== - -map-obj@^4.0.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" - integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== - -markdown-table@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-2.0.0.tgz#194a90ced26d31fe753d8b9434430214c011865b" - integrity sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A== - dependencies: - repeat-string "^1.0.0" - -material-colors@^1.2.1: - version "1.2.6" - resolved "https://registry.yarnpkg.com/material-colors/-/material-colors-1.2.6.tgz#6d1958871126992ceecc72f4bcc4d8f010865f46" - integrity sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg== - -mdast-add-list-metadata@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/mdast-add-list-metadata/-/mdast-add-list-metadata-1.0.1.tgz#95e73640ce2fc1fa2dcb7ec443d09e2bfe7db4cf" - integrity sha512-fB/VP4MJ0LaRsog7hGPxgOrSL3gE/2uEdZyDuSEnKCv/8IkYHiDkIQSbChiJoHyxZZXZ9bzckyRk+vNxFzh8rA== - dependencies: - unist-util-visit-parents "1.1.2" - -mdast-util-find-and-replace@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/mdast-util-find-and-replace/-/mdast-util-find-and-replace-1.1.1.tgz#b7db1e873f96f66588c321f1363069abf607d1b5" - integrity sha512-9cKl33Y21lyckGzpSmEQnIDjEfeeWelN5s1kUW1LwdB0Fkuq2u+4GdqcGEygYxJE8GVqCl0741bYXHgamfWAZA== - dependencies: - escape-string-regexp "^4.0.0" - unist-util-is "^4.0.0" - unist-util-visit-parents "^3.0.0" - -mdast-util-from-markdown@^0.8.0: - version "0.8.5" - resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz#d1ef2ca42bc377ecb0463a987910dae89bd9a28c" - integrity sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ== - dependencies: - "@types/mdast" "^3.0.0" - mdast-util-to-string "^2.0.0" - micromark "~2.11.0" - parse-entities "^2.0.0" - unist-util-stringify-position "^2.0.0" - -mdast-util-gfm-autolink-literal@^0.1.0: - version "0.1.3" - resolved "https://registry.yarnpkg.com/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-0.1.3.tgz#9c4ff399c5ddd2ece40bd3b13e5447d84e385fb7" - integrity sha512-GjmLjWrXg1wqMIO9+ZsRik/s7PLwTaeCHVB7vRxUwLntZc8mzmTsLVr6HW1yLokcnhfURsn5zmSVdi3/xWWu1A== - dependencies: - ccount "^1.0.0" - mdast-util-find-and-replace "^1.1.0" - micromark "^2.11.3" - -mdast-util-gfm-strikethrough@^0.2.0: - version "0.2.3" - resolved "https://registry.yarnpkg.com/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-0.2.3.tgz#45eea337b7fff0755a291844fbea79996c322890" - integrity sha512-5OQLXpt6qdbttcDG/UxYY7Yjj3e8P7X16LzvpX8pIQPYJ/C2Z1qFGMmcw+1PZMUM3Z8wt8NRfYTvCni93mgsgA== - dependencies: - mdast-util-to-markdown "^0.6.0" - -mdast-util-gfm-table@^0.1.0: - version "0.1.6" - resolved "https://registry.yarnpkg.com/mdast-util-gfm-table/-/mdast-util-gfm-table-0.1.6.tgz#af05aeadc8e5ee004eeddfb324b2ad8c029b6ecf" - integrity sha512-j4yDxQ66AJSBwGkbpFEp9uG/LS1tZV3P33fN1gkyRB2LoRL+RR3f76m0HPHaby6F4Z5xr9Fv1URmATlRRUIpRQ== - dependencies: - markdown-table "^2.0.0" - mdast-util-to-markdown "~0.6.0" - -mdast-util-gfm-task-list-item@^0.1.0: - version "0.1.6" - resolved "https://registry.yarnpkg.com/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-0.1.6.tgz#70c885e6b9f543ddd7e6b41f9703ee55b084af10" - integrity sha512-/d51FFIfPsSmCIRNp7E6pozM9z1GYPIkSy1urQ8s/o4TC22BZ7DqfHFWiqBD23bc7J3vV1Fc9O4QIHBlfuit8A== - dependencies: - mdast-util-to-markdown "~0.6.0" - -mdast-util-gfm@^0.1.0: - version "0.1.2" - resolved "https://registry.yarnpkg.com/mdast-util-gfm/-/mdast-util-gfm-0.1.2.tgz#8ecddafe57d266540f6881f5c57ff19725bd351c" - integrity sha512-NNkhDx/qYcuOWB7xHUGWZYVXvjPFFd6afg6/e2g+SV4r9q5XUcCbV4Wfa3DLYIiD+xAEZc6K4MGaE/m0KDcPwQ== - dependencies: - mdast-util-gfm-autolink-literal "^0.1.0" - mdast-util-gfm-strikethrough "^0.2.0" - mdast-util-gfm-table "^0.1.0" - mdast-util-gfm-task-list-item "^0.1.0" - mdast-util-to-markdown "^0.6.1" - -mdast-util-to-markdown@^0.6.0, mdast-util-to-markdown@^0.6.1, mdast-util-to-markdown@~0.6.0: - version "0.6.5" - resolved "https://registry.yarnpkg.com/mdast-util-to-markdown/-/mdast-util-to-markdown-0.6.5.tgz#b33f67ca820d69e6cc527a93d4039249b504bebe" - integrity sha512-XeV9sDE7ZlOQvs45C9UKMtfTcctcaj/pGwH8YLbMHoMOXNNCn2LsqVQOqrF1+/NU8lKDAqozme9SCXWyo9oAcQ== - dependencies: - "@types/unist" "^2.0.0" - longest-streak "^2.0.0" - mdast-util-to-string "^2.0.0" - parse-entities "^2.0.0" - repeat-string "^1.0.0" - zwitch "^1.0.0" - -mdast-util-to-string@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-2.0.0.tgz#b8cfe6a713e1091cb5b728fc48885a4767f8b97b" - integrity sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w== - -memorystream@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" - integrity sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw== - -meow@^8.0.0: - version "8.1.2" - resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.2.tgz#bcbe45bda0ee1729d350c03cffc8395a36c4e897" - integrity sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q== - dependencies: - "@types/minimist" "^1.2.0" - camelcase-keys "^6.2.2" - decamelize-keys "^1.1.0" - hard-rejection "^2.1.0" - minimist-options "4.1.0" - normalize-package-data "^3.0.0" - read-pkg-up "^7.0.1" - redent "^3.0.0" - trim-newlines "^3.0.0" - type-fest "^0.18.0" - yargs-parser "^20.2.3" - -merge2@^1.3.0, merge2@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" - integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== - -micromark-extension-gfm-autolink-literal@~0.5.0: - version "0.5.7" - resolved "https://registry.yarnpkg.com/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-0.5.7.tgz#53866c1f0c7ef940ae7ca1f72c6faef8fed9f204" - integrity sha512-ePiDGH0/lhcngCe8FtH4ARFoxKTUelMp4L7Gg2pujYD5CSMb9PbblnyL+AAMud/SNMyusbS2XDSiPIRcQoNFAw== - dependencies: - micromark "~2.11.3" - -micromark-extension-gfm-strikethrough@~0.6.5: - version "0.6.5" - resolved "https://registry.yarnpkg.com/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-0.6.5.tgz#96cb83356ff87bf31670eefb7ad7bba73e6514d1" - integrity sha512-PpOKlgokpQRwUesRwWEp+fHjGGkZEejj83k9gU5iXCbDG+XBA92BqnRKYJdfqfkrRcZRgGuPuXb7DaK/DmxOhw== - dependencies: - micromark "~2.11.0" - -micromark-extension-gfm-table@~0.4.0: - version "0.4.3" - resolved "https://registry.yarnpkg.com/micromark-extension-gfm-table/-/micromark-extension-gfm-table-0.4.3.tgz#4d49f1ce0ca84996c853880b9446698947f1802b" - integrity sha512-hVGvESPq0fk6ALWtomcwmgLvH8ZSVpcPjzi0AjPclB9FsVRgMtGZkUcpE0zgjOCFAznKepF4z3hX8z6e3HODdA== - dependencies: - micromark "~2.11.0" - -micromark-extension-gfm-tagfilter@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-0.3.0.tgz#d9f26a65adee984c9ccdd7e182220493562841ad" - integrity sha512-9GU0xBatryXifL//FJH+tAZ6i240xQuFrSL7mYi8f4oZSbc+NvXjkrHemeYP0+L4ZUT+Ptz3b95zhUZnMtoi/Q== - -micromark-extension-gfm-task-list-item@~0.3.0: - version "0.3.3" - resolved "https://registry.yarnpkg.com/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-0.3.3.tgz#d90c755f2533ed55a718129cee11257f136283b8" - integrity sha512-0zvM5iSLKrc/NQl84pZSjGo66aTGd57C1idmlWmE87lkMcXrTxg1uXa/nXomxJytoje9trP0NDLvw4bZ/Z/XCQ== - dependencies: - micromark "~2.11.0" - -micromark-extension-gfm@^0.3.0: - version "0.3.3" - resolved "https://registry.yarnpkg.com/micromark-extension-gfm/-/micromark-extension-gfm-0.3.3.tgz#36d1a4c089ca8bdfd978c9bd2bf1a0cb24e2acfe" - integrity sha512-oVN4zv5/tAIA+l3GbMi7lWeYpJ14oQyJ3uEim20ktYFAcfX1x3LNlFGGlmrZHt7u9YlKExmyJdDGaTt6cMSR/A== - dependencies: - micromark "~2.11.0" - micromark-extension-gfm-autolink-literal "~0.5.0" - micromark-extension-gfm-strikethrough "~0.6.5" - micromark-extension-gfm-table "~0.4.0" - micromark-extension-gfm-tagfilter "~0.3.0" - micromark-extension-gfm-task-list-item "~0.3.0" - -micromark@^2.11.3, micromark@~2.11.0, micromark@~2.11.3: - version "2.11.4" - resolved "https://registry.yarnpkg.com/micromark/-/micromark-2.11.4.tgz#d13436138eea826383e822449c9a5c50ee44665a" - integrity sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA== - dependencies: - debug "^4.0.0" - parse-entities "^2.0.0" - -micromatch@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== - dependencies: - braces "^3.0.2" - picomatch "^2.3.1" - -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-types@^2.1.12: - version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - -min-indent@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" - integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== - -minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - -minimatch@^5.0.1: - version "5.1.6" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" - integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== - dependencies: - brace-expansion "^2.0.1" - -minimatch@^9.0.1: - version "9.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" - integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== - dependencies: - brace-expansion "^2.0.1" - -minimist-options@4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" - integrity sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A== - dependencies: - arrify "^1.0.1" - is-plain-obj "^1.1.0" - kind-of "^6.0.3" - -minimist@^1.2.5: - version "1.2.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" - integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== - -"minipass@^5.0.0 || ^6.0.2 || ^7.0.0": - version "7.0.4" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" - integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== - -mlly@^1.2.0, mlly@^1.4.0: - version "1.4.2" - resolved "https://registry.yarnpkg.com/mlly/-/mlly-1.4.2.tgz#7cf406aa319ff6563d25da6b36610a93f2a8007e" - integrity sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg== - dependencies: - acorn "^8.10.0" - pathe "^1.1.1" - pkg-types "^1.0.3" - ufo "^1.3.0" - -modify-values@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" - integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== - -monaco-editor@^0.27.0: - version "0.27.0" - resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.27.0.tgz#4b69108bb1dc1f60174c5dcdf51bc5306ab5ba26" - integrity sha512-UhwP78Wb8w0ZSYoKXQNTV/0CHObp6NS3nCt51QfKE6sKyBo5PBsvuDOHoI2ooBakc6uIwByRLHVeT7+yXQe2fQ== - -moo-color@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/moo-color/-/moo-color-1.0.3.tgz#d56435f8359c8284d83ac58016df7427febece74" - integrity sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ== - dependencies: - color-name "^1.1.4" - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -nanoevents@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/nanoevents/-/nanoevents-7.0.1.tgz#181580b47787688d8cac775b977b1cf24e26e570" - integrity sha512-o6lpKiCxLeijK4hgsqfR6CNToPyRU3keKyyI6uwuHRvpRTbZ0wXw51WRgyldVugZqoJfkGFrjrIenYH3bfEO3Q== - -nanoid@^3.0.0, nanoid@^3.3.7: - version "3.3.7" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" - integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== - -natural-compare-lite@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" - integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== - -ndarray@^1.0.18: - version "1.0.19" - resolved "https://registry.yarnpkg.com/ndarray/-/ndarray-1.0.19.tgz#6785b5f5dfa58b83e31ae5b2a058cfd1ab3f694e" - integrity sha512-B4JHA4vdyZU30ELBw3g7/p9bZupyew5a7tX1Y/gGeF2hafrPaQZhgrGQfsvgfYbgdFZjYwuEcnaobeM/WMW+HQ== - dependencies: - iota-array "^1.0.0" - is-buffer "^1.0.2" - -neo-async@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" - integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== - -nice-try@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" - integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== - -node-fetch@^2.6.12: - version "2.7.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" - integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== - dependencies: - whatwg-url "^5.0.0" - -node-releases@^2.0.14: - version "2.0.14" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" - integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== - -normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" - integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== - dependencies: - hosted-git-info "^2.1.4" - resolve "^1.10.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" - -normalize-package-data@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.3.tgz#dbcc3e2da59509a0983422884cd172eefdfa525e" - integrity sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA== - dependencies: - hosted-git-info "^4.0.1" - is-core-module "^2.5.0" - semver "^7.3.4" - validate-npm-package-license "^3.0.1" - -normalize-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -npm-run-all@^4.1.5: - version "4.1.5" - resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.5.tgz#04476202a15ee0e2e214080861bff12a51d98fba" - integrity sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ== - dependencies: - ansi-styles "^3.2.1" - chalk "^2.4.1" - cross-spawn "^6.0.5" - memorystream "^0.3.1" - minimatch "^3.0.4" - pidtree "^0.3.0" - read-pkg "^3.0.0" - shell-quote "^1.6.1" - string.prototype.padend "^3.0.0" - -nwsapi@^2.2.0: - version "2.2.7" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.7.tgz#738e0707d3128cb750dddcfe90e4610482df0f30" - integrity sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ== - -object-assign@^4.0.1, object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - -object-inspect@^1.13.1, object-inspect@^1.9.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" - integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== - -object-keys@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" - integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== - -object.assign@^4.1.4: - version "4.1.5" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.5.tgz#3a833f9ab7fdb80fc9e8d2300c803d216d8fdbb0" - integrity sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ== - dependencies: - call-bind "^1.0.5" - define-properties "^1.2.1" - has-symbols "^1.0.3" - object-keys "^1.1.1" - -object.entries-ponyfill@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/object.entries-ponyfill/-/object.entries-ponyfill-1.0.1.tgz#29abdf77cbfbd26566dd1aa24e9d88f65433d256" - integrity sha512-j0ixssXc5GirDWhB2cLVPsOs9jx61G/iRndyMdToTsjMYY8BQmG1Ke6mwqXmpDiP8icye1YCR94NswNaa/yyzA== - -object.entries@^1.1.6, object.entries@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.7.tgz#2b47760e2a2e3a752f39dd874655c61a7f03c131" - integrity sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - -object.fromentries@^2.0.6, object.fromentries@^2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.7.tgz#71e95f441e9a0ea6baf682ecaaf37fa2a8d7e616" - integrity sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - -object.hasown@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/object.hasown/-/object.hasown-1.1.3.tgz#6a5f2897bb4d3668b8e79364f98ccf971bda55ae" - integrity sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA== - dependencies: - define-properties "^1.2.0" - es-abstract "^1.22.1" - -object.values@^1.1.6: - version "1.1.7" - resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.7.tgz#617ed13272e7e1071b43973aa1655d9291b8442a" - integrity sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - -observable-fns@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/observable-fns/-/observable-fns-0.6.1.tgz#636eae4fdd1132e88c0faf38d33658cc79d87e37" - integrity sha512-9gRK4+sRWzeN6AOewNBTLXir7Zl/i3GB6Yl26gK4flxz8BXVpD3kt8amREmWNb0mxYOGDotvE5a4N+PtGGKdkg== - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -optionator@^0.9.3: - version "0.9.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" - integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== - dependencies: - "@aashutoshrathi/word-wrap" "^1.2.3" - deep-is "^0.1.3" - fast-levenshtein "^2.0.6" - levn "^0.4.1" - prelude-ls "^1.2.1" - type-check "^0.4.0" - -p-limit@^1.1.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" - integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== - dependencies: - p-try "^1.0.0" - -p-limit@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" - integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== - dependencies: - p-try "^2.0.0" - -p-limit@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" - integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== - dependencies: - yocto-queue "^0.1.0" - -p-limit@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-4.0.0.tgz#914af6544ed32bfa54670b061cafcbd04984b644" - integrity sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ== - dependencies: - yocto-queue "^1.0.0" - -p-locate@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" - integrity sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg== - dependencies: - p-limit "^1.1.0" - -p-locate@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" - integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== - dependencies: - p-limit "^2.2.0" - -p-locate@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" - integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== - dependencies: - p-limit "^3.0.2" - -p-try@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" - integrity sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww== - -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== - -pako@^1.0.10, pako@^1.0.11: - version "1.0.11" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" - integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== - -pako@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86" - integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug== - -parent-module@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" - integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== - dependencies: - callsites "^3.0.0" - -parse-entities@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-2.0.0.tgz#53c6eb5b9314a1f4ec99fa0fdf7ce01ecda0cbe8" - integrity sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ== - dependencies: - character-entities "^1.0.0" - character-entities-legacy "^1.0.0" - character-reference-invalid "^1.0.0" - is-alphanumerical "^1.0.0" - is-decimal "^1.0.0" - is-hexadecimal "^1.0.0" - -parse-json@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" - integrity sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw== - dependencies: - error-ex "^1.3.1" - json-parse-better-errors "^1.0.1" - -parse-json@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" - integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== - dependencies: - "@babel/code-frame" "^7.0.0" - error-ex "^1.3.1" - json-parse-even-better-errors "^2.3.0" - lines-and-columns "^1.1.6" - -parse5@6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" - integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== - -path-exists@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" - integrity sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ== - -path-exists@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" - integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - -path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw== - -path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -path-parse@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -path-scurry@^1.10.1: - version "1.10.1" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.10.1.tgz#9ba6bf5aa8500fe9fd67df4f0d9483b2b0bfc698" - integrity sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ== - dependencies: - lru-cache "^9.1.1 || ^10.0.0" - minipass "^5.0.0 || ^6.0.2 || ^7.0.0" - -path-to-regexp@^1.7.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a" - integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== - dependencies: - isarray "0.0.1" - -path-type@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" - integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== - dependencies: - pify "^3.0.0" - -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - -pathe@^1.1.0, pathe@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.1.tgz#1dd31d382b974ba69809adc9a7a347e65d84829a" - integrity sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q== - -pathval@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" - integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== - -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== - -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== - -picomatch@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -pidtree@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.3.1.tgz#ef09ac2cc0533df1f3250ccf2c4d366b0d12114a" - integrity sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA== - -pify@^2.0.0, pify@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== - -pify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" - integrity sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg== - -pinkie-promise@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - integrity sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw== - dependencies: - pinkie "^2.0.0" - -pinkie@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" - integrity sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg== - -pixelmatch@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/pixelmatch/-/pixelmatch-5.3.0.tgz#5e5321a7abedfb7962d60dbf345deda87cb9560a" - integrity sha512-o8mkY4E/+LNUf6LzX96ht6k6CEDi65k9G2rjMtBe9Oo+VPKSvl+0GKHuH/AlG+GA5LPG/i5hrekkxUc3s2HU+Q== - dependencies: - pngjs "^6.0.0" - -pixi.js@^6.3.0: - version "6.5.10" - resolved "https://registry.yarnpkg.com/pixi.js/-/pixi.js-6.5.10.tgz#a82638e0b7afc5bf7f3ab70d960521477276e866" - integrity sha512-Z2mjeoISml2iuVwT1e/BQwERYM2yKoiR08ZdGrg8y5JjeuVptfTrve4DbPMRN/kEDodesgQZGV/pFv0fE9Q2SA== - dependencies: - "@pixi/accessibility" "6.5.10" - "@pixi/app" "6.5.10" - "@pixi/compressed-textures" "6.5.10" - "@pixi/constants" "6.5.10" - "@pixi/core" "6.5.10" - "@pixi/display" "6.5.10" - "@pixi/extensions" "6.5.10" - "@pixi/extract" "6.5.10" - "@pixi/filter-alpha" "6.5.10" - "@pixi/filter-blur" "6.5.10" - "@pixi/filter-color-matrix" "6.5.10" - "@pixi/filter-displacement" "6.5.10" - "@pixi/filter-fxaa" "6.5.10" - "@pixi/filter-noise" "6.5.10" - "@pixi/graphics" "6.5.10" - "@pixi/interaction" "6.5.10" - "@pixi/loaders" "6.5.10" - "@pixi/math" "6.5.10" - "@pixi/mesh" "6.5.10" - "@pixi/mesh-extras" "6.5.10" - "@pixi/mixin-cache-as-bitmap" "6.5.10" - "@pixi/mixin-get-child-by-name" "6.5.10" - "@pixi/mixin-get-global-position" "6.5.10" - "@pixi/particle-container" "6.5.10" - "@pixi/polyfill" "6.5.10" - "@pixi/prepare" "6.5.10" - "@pixi/runner" "6.5.10" - "@pixi/settings" "6.5.10" - "@pixi/sprite" "6.5.10" - "@pixi/sprite-animated" "6.5.10" - "@pixi/sprite-tiling" "6.5.10" - "@pixi/spritesheet" "6.5.10" - "@pixi/text" "6.5.10" - "@pixi/text-bitmap" "6.5.10" - "@pixi/ticker" "6.5.10" - "@pixi/utils" "6.5.10" - -pkg-dir@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" - integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== - dependencies: - find-up "^4.0.0" - -pkg-types@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/pkg-types/-/pkg-types-1.0.3.tgz#988b42ab19254c01614d13f4f65a2cfc7880f868" - integrity sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A== - dependencies: - jsonc-parser "^3.2.0" - mlly "^1.2.0" - pathe "^1.1.0" - -playwright-core@1.40.1: - version "1.40.1" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.40.1.tgz#442d15e86866a87d90d07af528e0afabe4c75c05" - integrity sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ== - -playwright@1.40.1: - version "1.40.1" - resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.40.1.tgz#a11bf8dca15be5a194851dbbf3df235b9f53d7ae" - integrity sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw== - dependencies: - playwright-core "1.40.1" - optionalDependencies: - fsevents "2.3.2" - -pngjs@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-6.0.0.tgz#ca9e5d2aa48db0228a52c419c3308e87720da821" - integrity sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg== - -pngjs@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-7.0.0.tgz#a8b7446020ebbc6ac739db6c5415a65d17090e26" - integrity sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow== - -postcss@^8.4.27, postcss@^8.4.32: - version "8.4.32" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.32.tgz#1dac6ac51ab19adb21b8b34fd2d93a86440ef6c9" - integrity sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw== - dependencies: - nanoid "^3.3.7" - picocolors "^1.0.0" - source-map-js "^1.0.2" - -prelude-ls@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" - integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== - -prettier-linter-helpers@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" - integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== - dependencies: - fast-diff "^1.1.2" - -prettier@^2.0.5: - version "2.8.8" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" - integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== - -pretty-format@^29.5.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" - integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== - dependencies: - "@jest/schemas" "^29.6.3" - ansi-styles "^5.0.0" - react-is "^18.0.0" - -prismjs@^1.16.0: - version "1.29.0" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.29.0.tgz#f113555a8fa9b57c35e637bba27509dcf802dd12" - integrity sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q== - -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - -promise-polyfill@^8.2.0: - version "8.3.0" - resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-8.3.0.tgz#9284810268138d103807b11f4e23d5e945a4db63" - integrity sha512-H5oELycFml5yto/atYqmjyigJoAo3+OXwolYiH7OfQuYlAqhxNvTfiNMbV9hsC6Yp83yE5r2KTVmtrG6R9i6Pg== - -prop-types@15.x, prop-types@^15.5.10, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1: - version "15.8.1" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" - integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== - dependencies: - loose-envify "^1.4.0" - object-assign "^4.1.1" - react-is "^16.13.1" - -psl@^1.1.33: - version "1.9.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" - integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== - -pub-sub-es@^2.0.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/pub-sub-es/-/pub-sub-es-2.1.1.tgz#0595a721a8c96868eba91407140550848c4102de" - integrity sha512-qOnqlAvQ26hTK0GdieSGC991oDrN0x6W2XacvU5zbarVAWGvKt+esEl3UOXxBY23vE5Vgs1InmmVH3HDanjrPQ== - -pubsub-js@^1.9.3: - version "1.9.4" - resolved "https://registry.yarnpkg.com/pubsub-js/-/pubsub-js-1.9.4.tgz#5c8678600e34e95b1269e96c17e1b51dab3ecb5a" - integrity sha512-hJYpaDvPH4w8ZX/0Fdf9ma1AwRgU353GfbaVfPjfJQf1KxZ2iHaHl3fAUw1qlJIR5dr4F3RzjGaWohYUEyoh7A== - -punycode@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== - -punycode@^2.1.0, punycode@^2.1.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" - integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== - -q@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" - integrity sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw== - -qs@^6.11.2: - version "6.11.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" - integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== - dependencies: - side-channel "^1.0.4" - -querystringify@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" - integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== - -queue-microtask@^1.2.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" - integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== - -quick-lru@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-2.0.0.tgz#32b017b28d1784631c8ab0a1ed2978e094dbe181" - integrity sha512-DqOtZziv7lDjEyuqyVQacRciAwMCEjTNrLYCHYEIIgjcE/tLEpBF82hiDIwCjRnEL9/hY2GJxA0T8ZvYvVVSSA== - -quick-lru@^4.0.0, quick-lru@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" - integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== - -quick-lru@^6.1.1: - version "6.1.2" - resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-6.1.2.tgz#e9a90524108629be35287d0b864e7ad6ceb3659e" - integrity sha512-AAFUA5O1d83pIHEhJwWCq/RQcRukCkn/NSm2QsTEMle5f2hP0ChI2+3Xb051PZCkLryI/Ir1MVKviT2FIloaTQ== - -quickselect@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/quickselect/-/quickselect-2.0.0.tgz#f19680a486a5eefb581303e023e98faaf25dd018" - integrity sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw== - -raf-schd@^4.0.2: - version "4.0.3" - resolved "https://registry.yarnpkg.com/raf-schd/-/raf-schd-4.0.3.tgz#5d6c34ef46f8b2a0e880a8fcdb743efc5bfdbc1a" - integrity sha512-tQkJl2GRWh83ui2DiPTJz9wEiMN20syf+5oKfB03yYP7ioZcJwsIK8FjrtLwH1m7C7e+Tt2yYBlrOpdT+dyeIQ== - -raf@^3.4.1: - version "3.4.1" - resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39" - integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA== - dependencies: - performance-now "^2.1.0" - -rbush@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/rbush/-/rbush-3.0.1.tgz#5fafa8a79b3b9afdfe5008403a720cc1de882ecf" - integrity sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w== - dependencies: - quickselect "^2.0.0" - -react-checkbox-tree@^1.7.3: - version "1.8.0" - resolved "https://registry.yarnpkg.com/react-checkbox-tree/-/react-checkbox-tree-1.8.0.tgz#10dc3e86df25d92559ab6857c7ada4fe285abc03" - integrity sha512-ufC4aorihOvjLpvY1beab2hjVLGZbDTFRzw62foG0+th+KX7e/sdmWu/nD1ZS/U5Yr0rWGwedGH5GOtR0IkUXw== - dependencies: - classnames "^2.2.5" - lodash "^4.17.10" - nanoid "^3.0.0" - prop-types "^15.5.8" - -react-color@^2.13.8: - version "2.19.3" - resolved "https://registry.yarnpkg.com/react-color/-/react-color-2.19.3.tgz#ec6c6b4568312a3c6a18420ab0472e146aa5683d" - integrity sha512-LEeGE/ZzNLIsFWa1TMe8y5VYqr7bibneWmvJwm1pCn/eNmrabWDh659JSPn9BuaMpEfU83WTOJfnCcjDZwNQTA== - dependencies: - "@icons/material" "^0.2.4" - lodash "^4.17.15" - lodash-es "^4.17.15" - material-colors "^1.2.1" - prop-types "^15.5.10" - reactcss "^1.2.0" - tinycolor2 "^1.4.1" - -react-dom@^18.2.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" - integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== - dependencies: - loose-envify "^1.1.0" - scheduler "^0.23.0" - -react-draggable@3.x: - version "3.3.2" - resolved "https://registry.yarnpkg.com/react-draggable/-/react-draggable-3.3.2.tgz#966ef1d90f2387af3c2d8bd3516f601ea42ca359" - integrity sha512-oaz8a6enjbPtx5qb0oDWxtDNuybOylvto1QLydsXgKmwT7e3GXC2eMVDwEMIUYJIFqVG72XpOv673UuuAq6LhA== - dependencies: - classnames "^2.2.5" - prop-types "^15.6.0" - -react-draggable@^4.0.3: - version "4.4.6" - resolved "https://registry.yarnpkg.com/react-draggable/-/react-draggable-4.4.6.tgz#63343ee945770881ca1256a5b6fa5c9f5983fe1e" - integrity sha512-LtY5Xw1zTPqHkVmtM3X8MUOxNDOUhv/khTgBgrUvwaS064bwVvxT+q5El0uUFNx5IEPKXuRejr7UqLwBIg5pdw== - dependencies: - clsx "^1.1.1" - prop-types "^15.8.1" - -react-grid-layout@^0.16.6: - version "0.16.6" - resolved "https://registry.yarnpkg.com/react-grid-layout/-/react-grid-layout-0.16.6.tgz#9b2407a2b946c2260ebaf66f13b556e1da4efeb2" - integrity sha512-h2EsYgsqcESLJeevQSJsEKp8hhh+phOlXDJoMhlV2e7T3VWQL+S6iCF3iD/LK19r4oyRyOMDEir0KV+eLXrAyw== - dependencies: - classnames "2.x" - lodash.isequal "^4.0.0" - prop-types "15.x" - react-draggable "3.x" - react-resizable "1.x" - -react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.6: - version "16.13.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" - integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== - -react-is@^18.0.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" - integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== - -react-markdown@^5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/react-markdown/-/react-markdown-5.0.3.tgz#41040ea7a9324b564b328fb81dd6c04f2a5373ac" - integrity sha512-jDWOc1AvWn0WahpjW6NK64mtx6cwjM4iSsLHJPNBqoAgGOVoIdJMqaKX4++plhOtdd4JksdqzlDibgPx6B/M2w== - dependencies: - "@types/mdast" "^3.0.3" - "@types/unist" "^2.0.3" - html-to-react "^1.3.4" - mdast-add-list-metadata "1.0.1" - prop-types "^15.7.2" - react-is "^16.8.6" - remark-parse "^9.0.0" - unified "^9.0.0" - unist-util-visit "^2.0.0" - xtend "^4.0.1" - -react-monaco-editor@^0.45.0: - version "0.45.0" - resolved "https://registry.yarnpkg.com/react-monaco-editor/-/react-monaco-editor-0.45.0.tgz#fa7eeaddc61c44865508d63c40930b4d67d49e98" - integrity sha512-QgAFXdXm5e9QRCnjFBt5fHqmUWL2qIMHZuZSLR6rU9E3Bbo2pQO7FSqgVmB5trc5U+hs7KdIWVoWIOzQvZMu3w== - dependencies: - monaco-editor "^0.27.0" - prop-types "^15.7.2" - -react-refresh@^0.14.0: - version "0.14.0" - resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.0.tgz#4e02825378a5f227079554d4284889354e5f553e" - integrity sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ== - -react-resizable@1.x: - version "1.11.1" - resolved "https://registry.yarnpkg.com/react-resizable/-/react-resizable-1.11.1.tgz#02ca6850afa7a22c1b3e623e64aef71ee252af69" - integrity sha512-S70gbLaAYqjuAd49utRHibtHLrHXInh7GuOR+6OO6RO6uleQfuBnWmZjRABfqNEx3C3Z6VPLg0/0uOYFrkfu9Q== - dependencies: - prop-types "15.x" - react-draggable "^4.0.3" - -react-resize-detector@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/react-resize-detector/-/react-resize-detector-4.2.3.tgz#7df258668a30bdfd88e655bbdb27db7fd7b23127" - integrity sha512-4AeS6lxdz2KOgDZaOVt1duoDHrbYwSrUX32KeM9j6t9ISyRphoJbTRCMS1aPFxZHFqcCGLT1gMl3lEcSWZNW0A== - dependencies: - lodash "^4.17.15" - lodash-es "^4.17.15" - prop-types "^15.7.2" - raf-schd "^4.0.2" - resize-observer-polyfill "^1.5.1" - -react-router-dom@^5.2.0: - version "5.3.4" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.3.4.tgz#2ed62ffd88cae6db134445f4a0c0ae8b91d2e5e6" - integrity sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ== - dependencies: - "@babel/runtime" "^7.12.13" - history "^4.9.0" - loose-envify "^1.3.1" - prop-types "^15.6.2" - react-router "5.3.4" - tiny-invariant "^1.0.2" - tiny-warning "^1.0.0" - -react-router@5.3.4: - version "5.3.4" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.3.4.tgz#8ca252d70fcc37841e31473c7a151cf777887bb5" - integrity sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA== - dependencies: - "@babel/runtime" "^7.12.13" - history "^4.9.0" - hoist-non-react-statics "^3.1.0" - loose-envify "^1.3.1" - path-to-regexp "^1.7.0" - prop-types "^15.6.2" - react-is "^16.6.0" - tiny-invariant "^1.0.2" - tiny-warning "^1.0.0" - -react-simple-code-editor@^0.9.10: - version "0.9.15" - resolved "https://registry.yarnpkg.com/react-simple-code-editor/-/react-simple-code-editor-0.9.15.tgz#59e3583832e9e98992d3674b2d7673b4cd1c5709" - integrity sha512-M8iKgjBTBZK92tZYgOEfMuR7c3zZ0q0v3QYllSxIPx3SU+w003VofH50txXQSBTu92pSOm2tidON1HbQ1l8BDA== - -react-sortable-hoc@^1.10.1: - version "1.11.0" - resolved "https://registry.yarnpkg.com/react-sortable-hoc/-/react-sortable-hoc-1.11.0.tgz#fe4022362bbafc4b836f5104b9676608a40a278f" - integrity sha512-v1CDCvdfoR3zLGNp6qsBa4J1BWMEVH25+UKxF/RvQRh+mrB+emqtVHMgZ+WreUiKJoEaiwYoScaueIKhMVBHUg== - dependencies: - "@babel/runtime" "^7.2.0" - invariant "^2.2.4" - prop-types "^15.5.7" - -react@^18.2.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" - integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== - dependencies: - loose-envify "^1.1.0" - -reactcss@^1.2.0, reactcss@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/reactcss/-/reactcss-1.2.3.tgz#c00013875e557b1cf0dfd9a368a1c3dab3b548dd" - integrity sha512-KiwVUcFu1RErkI97ywr8nvx8dNOpT03rbnma0SSalTYjkrPYaEajR4a/MRt6DZ46K6arDRbWMNHF+xH7G7n/8A== - dependencies: - lodash "^4.0.1" - -read-pkg-up@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07" - integrity sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw== - dependencies: - find-up "^2.0.0" - read-pkg "^3.0.0" - -read-pkg-up@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" - integrity sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg== - dependencies: - find-up "^4.1.0" - read-pkg "^5.2.0" - type-fest "^0.8.1" - -read-pkg@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" - integrity sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA== - dependencies: - load-json-file "^4.0.0" - normalize-package-data "^2.3.2" - path-type "^3.0.0" - -read-pkg@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" - integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== - dependencies: - "@types/normalize-package-data" "^2.4.0" - normalize-package-data "^2.5.0" - parse-json "^5.0.0" - type-fest "^0.6.0" - -readable-stream@3, readable-stream@^3.0.0, readable-stream@^3.5.0: - version "3.6.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" - integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -readable-stream@~2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" - integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -redent@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f" - integrity sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg== - dependencies: - indent-string "^4.0.0" - strip-indent "^3.0.0" - -reflect.getprototypeof@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/reflect.getprototypeof/-/reflect.getprototypeof-1.0.4.tgz#aaccbf41aca3821b87bb71d9dcbc7ad0ba50a3f3" - integrity sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - get-intrinsic "^1.2.1" - globalthis "^1.0.3" - which-builtin-type "^1.1.3" - -regenerator-runtime@^0.13.7: - version "0.13.11" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" - integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== - -regenerator-runtime@^0.14.0: - version "0.14.0" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" - integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== - -regexp.prototype.flags@^1.5.0, regexp.prototype.flags@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz#90ce989138db209f81492edd734183ce99f9677e" - integrity sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - set-function-name "^2.0.0" - -remark-gfm@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/remark-gfm/-/remark-gfm-1.0.0.tgz#9213643001be3f277da6256464d56fd28c3b3c0d" - integrity sha512-KfexHJCiqvrdBZVbQ6RopMZGwaXz6wFJEfByIuEwGf0arvITHjiKKZ1dpXujjH9KZdm1//XJQwgfnJ3lmXaDPA== - dependencies: - mdast-util-gfm "^0.1.0" - micromark-extension-gfm "^0.3.0" - -remark-parse@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-9.0.0.tgz#4d20a299665880e4f4af5d90b7c7b8a935853640" - integrity sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw== - dependencies: - mdast-util-from-markdown "^0.8.0" - -repeat-string@^1.0.0: - version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - integrity sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w== - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== - -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== - -resize-observer-polyfill@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464" - integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== - -resolve-from@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" - integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== - -resolve-pathname@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd" - integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng== - -resolve@^1.10.0: - version "1.22.8" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" - integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== - dependencies: - is-core-module "^2.13.0" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - -resolve@^2.0.0-next.4: - version "2.0.0-next.5" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-2.0.0-next.5.tgz#6b0ec3107e671e52b68cd068ef327173b90dc03c" - integrity sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA== - dependencies: - is-core-module "^2.13.0" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - -reusify@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" - integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== - -rgbcolor@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/rgbcolor/-/rgbcolor-1.0.1.tgz#d6505ecdb304a6595da26fa4b43307306775945d" - integrity sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw== - -rimraf@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" - integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== - dependencies: - glob "^7.1.3" - -rimraf@~5.0.5: - version "5.0.5" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-5.0.5.tgz#9be65d2d6e683447d2e9013da2bf451139a61ccf" - integrity sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A== - dependencies: - glob "^10.3.7" - -robust-orientation@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/robust-orientation/-/robust-orientation-1.2.1.tgz#f6c2b00a5df5f1cb9597be63a45190f273899361" - integrity sha512-FuTptgKwY6iNuU15nrIJDLjXzCChWB+T4AvksRtwPS/WZ3HuP1CElCm1t+OBfgQKfWbtZIawip+61k7+buRKAg== - dependencies: - robust-scale "^1.0.2" - robust-subtract "^1.0.0" - robust-sum "^1.0.0" - two-product "^1.0.2" - -robust-point-in-polygon@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/robust-point-in-polygon/-/robust-point-in-polygon-1.0.3.tgz#ea68f025a44dfe6aede80f0863788705cf547ec4" - integrity sha512-pPzz7AevOOcPYnFv4Vs5L0C7BKOq6C/TfAw5EUE58CylbjGiPyMjAnPLzzSuPZ2zftUGwWbmLWPOjPOz61tAcA== - dependencies: - robust-orientation "^1.0.2" - -robust-scale@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/robust-scale/-/robust-scale-1.0.2.tgz#775132ed09542d028e58b2cc79c06290bcf78c32" - integrity sha512-jBR91a/vomMAzazwpsPTPeuTPPmWBacwA+WYGNKcRGSh6xweuQ2ZbjRZ4v792/bZOhRKXRiQH0F48AvuajY0tQ== - dependencies: - two-product "^1.0.2" - two-sum "^1.0.0" - -robust-subtract@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/robust-subtract/-/robust-subtract-1.0.0.tgz#e0b164e1ed8ba4e3a5dda45a12038348dbed3e9a" - integrity sha512-xhKUno+Rl+trmxAIVwjQMiVdpF5llxytozXJOdoT4eTIqmqsndQqFb1A0oiW3sZGlhMRhOi6pAD4MF1YYW6o/A== - -robust-sum@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/robust-sum/-/robust-sum-1.0.0.tgz#16646e525292b4d25d82757a286955e0bbfa53d9" - integrity sha512-AvLExwpaqUqD1uwLU6MwzzfRdaI6VEZsyvQ3IAQ0ZJ08v1H+DTyqskrf2ZJyh0BDduFVLN7H04Zmc+qTiahhAw== - -rollup@^3.27.1: - version "3.29.4" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.4.tgz#4d70c0f9834146df8705bfb69a9a19c9e1109981" - integrity sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw== - optionalDependencies: - fsevents "~2.3.2" - -rollup@^4.2.0: - version "4.6.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.6.1.tgz#351501c86b5b4f976dde8c5837516452b59921f8" - integrity sha512-jZHaZotEHQaHLgKr8JnQiDT1rmatjgKlMekyksz+yk9jt/8z9quNjnKNRoaM0wd9DC2QKXjmWWuDYtM3jfF8pQ== - optionalDependencies: - "@rollup/rollup-android-arm-eabi" "4.6.1" - "@rollup/rollup-android-arm64" "4.6.1" - "@rollup/rollup-darwin-arm64" "4.6.1" - "@rollup/rollup-darwin-x64" "4.6.1" - "@rollup/rollup-linux-arm-gnueabihf" "4.6.1" - "@rollup/rollup-linux-arm64-gnu" "4.6.1" - "@rollup/rollup-linux-arm64-musl" "4.6.1" - "@rollup/rollup-linux-x64-gnu" "4.6.1" - "@rollup/rollup-linux-x64-musl" "4.6.1" - "@rollup/rollup-win32-arm64-msvc" "4.6.1" - "@rollup/rollup-win32-ia32-msvc" "4.6.1" - "@rollup/rollup-win32-x64-msvc" "4.6.1" - fsevents "~2.3.2" - -run-parallel@^1.1.9: - version "1.2.0" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" - integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== - dependencies: - queue-microtask "^1.2.2" - -rw@1: - version "1.3.3" - resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4" - integrity sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ== - -rxjs@^7.8.0: - version "7.8.1" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" - integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== - dependencies: - tslib "^2.1.0" - -safe-array-concat@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.0.1.tgz#91686a63ce3adbea14d61b14c99572a8ff84754c" - integrity sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.2.1" - has-symbols "^1.0.3" - isarray "^2.0.5" - -safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -safe-regex-test@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295" - integrity sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.1.3" - is-regex "^1.1.4" - -safe-stable-stringify@^2.4.3: - version "2.4.3" - resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886" - integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== - -"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -saxes@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" - integrity sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw== - dependencies: - xmlchars "^2.2.0" - -scheduler@^0.23.0: - version "0.23.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe" - integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw== - dependencies: - loose-envify "^1.1.0" - -"semver@2 || 3 || 4 || 5", semver@^5.5.0: - version "5.7.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" - integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== - -semver@^6.0.0, semver@^6.3.1: - version "6.3.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== - -semver@^7.3.4, semver@^7.3.7, semver@^7.5.3: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== - dependencies: - lru-cache "^6.0.0" - -set-function-length@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.1.1.tgz#4bc39fafb0307224a33e106a7d35ca1218d659ed" - integrity sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ== - dependencies: - define-data-property "^1.1.1" - get-intrinsic "^1.2.1" - gopd "^1.0.1" - has-property-descriptors "^1.0.0" - -set-function-name@^2.0.0, set-function-name@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.1.tgz#12ce38b7954310b9f61faa12701620a0c882793a" - integrity sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA== - dependencies: - define-data-property "^1.0.1" - functions-have-names "^1.2.3" - has-property-descriptors "^1.0.0" - -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - integrity sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg== - dependencies: - shebang-regex "^1.0.0" - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ== - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -shell-quote@^1.6.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.1.tgz#6dbf4db75515ad5bac63b4f1894c3a154c766680" - integrity sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA== - -side-channel@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" - integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== - dependencies: - call-bind "^1.0.0" - get-intrinsic "^1.0.2" - object-inspect "^1.9.0" - -siginfo@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/siginfo/-/siginfo-2.0.0.tgz#32e76c70b79724e3bb567cb9d543eb858ccfaf30" - integrity sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g== - -signal-exit@^3.0.2: - version "3.0.7" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" - integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== - -signal-exit@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" - integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== - -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - -slugid@^2.0.0, slugid@^3.0.0, slugid@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/slugid/-/slugid-3.2.0.tgz#3731f4debe46b319f6fbbefda58de30316af957d" - integrity sha512-f0vZb6VyjUdZG5kaxd9CNpfhy+eUUTC8RnbDolC3ZLjYa7n5AdPkQnqnIjmoZYoPS9dWMOXQdoBREAGQqdZb9A== - dependencies: - uuid "^8.3.2" - -source-map-js@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" - integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== - -source-map@^0.6.1, source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -spdx-correct@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c" - integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA== - dependencies: - spdx-expression-parse "^3.0.0" - spdx-license-ids "^3.0.0" - -spdx-exceptions@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" - integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== - -spdx-expression-parse@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" - integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== - dependencies: - spdx-exceptions "^2.1.0" - spdx-license-ids "^3.0.0" - -spdx-license-ids@^3.0.0: - version "3.0.16" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.16.tgz#a14f64e0954f6e25cc6587bd4f392522db0d998f" - integrity sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw== - -split2@^3.0.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" - integrity sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg== - dependencies: - readable-stream "^3.0.0" - -split@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9" - integrity sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg== - dependencies: - through "2" - -stackback@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/stackback/-/stackback-0.0.2.tgz#1ac8a0d9483848d1695e418b6d031a3c3ce68e3b" - integrity sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw== - -stackblur-canvas@^2.0.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/stackblur-canvas/-/stackblur-canvas-2.6.0.tgz#7876bab4ea99bfc97b69ce662614d7a1afb2d71b" - integrity sha512-8S1aIA+UoF6erJYnglGPug6MaHYGo1Ot7h5fuXx4fUPvcvQfcdw2o/ppCse63+eZf8PPidSu4v1JnmEVtEDnpg== - -std-env@^3.3.3: - version "3.6.0" - resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.6.0.tgz#94807562bddc68fa90f2e02c5fd5b6865bb4e98e" - integrity sha512-aFZ19IgVmhdB2uX599ve2kE6BIE3YMnQ6Gp6BURhW/oIzpXGKr878TQfAQZn1+i0Flcc/UKUy1gOlcfaUBCryg== - -stream-browserify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-3.0.0.tgz#22b0a2850cdf6503e73085da1fc7b7d0c2122f2f" - integrity sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA== - dependencies: - inherits "~2.0.4" - readable-stream "^3.5.0" - -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^5.0.1, string-width@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" - integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== - dependencies: - eastasianwidth "^0.2.0" - emoji-regex "^9.2.2" - strip-ansi "^7.0.1" - -string.prototype.matchall@^4.0.8: - version "4.0.10" - resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.10.tgz#a1553eb532221d4180c51581d6072cd65d1ee100" - integrity sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - get-intrinsic "^1.2.1" - has-symbols "^1.0.3" - internal-slot "^1.0.5" - regexp.prototype.flags "^1.5.0" - set-function-name "^2.0.0" - side-channel "^1.0.4" - -string.prototype.padend@^3.0.0: - version "3.1.5" - resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.1.5.tgz#311ef3a4e3c557dd999cdf88fbdde223f2ac0f95" - integrity sha512-DOB27b/2UTTD+4myKUFh+/fXWcu/UDyASIXfg+7VzoCNNGOfWvoyU/x5pvVHr++ztyt/oSYI1BcWBBG/hmlNjA== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - -string.prototype.trim@^1.2.8: - version "1.2.8" - resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz#f9ac6f8af4bd55ddfa8895e6aea92a96395393bd" - integrity sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - -string.prototype.trimend@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz#1bb3afc5008661d73e2dc015cd4853732d6c471e" - integrity sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - -string.prototype.trimstart@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz#d4cdb44b83a4737ffbac2d406e405d43d0184298" - integrity sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg== - dependencies: - call-bind "^1.0.2" - define-properties "^1.2.0" - es-abstract "^1.22.1" - -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^7.0.1: - version "7.1.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" - integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== - dependencies: - ansi-regex "^6.0.1" - -strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== - -strip-indent@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001" - integrity sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ== - dependencies: - min-indent "^1.0.0" - -strip-json-comments@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" - integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== - -strip-literal@^1.0.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/strip-literal/-/strip-literal-1.3.0.tgz#db3942c2ec1699e6836ad230090b84bb458e3a07" - integrity sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg== - dependencies: - acorn "^8.10.0" - -strip-outer@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/strip-outer/-/strip-outer-1.0.1.tgz#b2fd2abf6604b9d1e6013057195df836b8a9d631" - integrity sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg== - dependencies: - escape-string-regexp "^1.0.2" - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -supports-preserve-symlinks-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" - integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== - -svg-pathdata@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/svg-pathdata/-/svg-pathdata-6.0.3.tgz#80b0e0283b652ccbafb69ad4f8f73e8d3fbf2cac" - integrity sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw== - -symbol-tree@^3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== - -temp-dir@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-2.0.0.tgz#bde92b05bdfeb1516e804c9c00ad45177f31321e" - integrity sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg== - -tempfile@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/tempfile/-/tempfile-3.0.0.tgz#5376a3492de7c54150d0cc0612c3f00e2cdaf76c" - integrity sha512-uNFCg478XovRi85iD42egu+eSFUmmka750Jy7L5tfHI5hQKKtbPnxaSaXAbBqCDYrw3wx4tXjKwci4/QmsZJxw== - dependencies: - temp-dir "^2.0.0" - uuid "^3.3.2" - -test-exclude@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" - integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== - dependencies: - "@istanbuljs/schema" "^0.1.2" - glob "^7.1.4" - minimatch "^3.0.4" - -text-extensions@^1.0.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" - integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== - -text-segmentation@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/text-segmentation/-/text-segmentation-1.0.3.tgz#52a388159efffe746b24a63ba311b6ac9f2d7943" - integrity sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw== - dependencies: - utrie "^1.0.2" - -text-table@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" - integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== - -threads@^1.6.4: - version "1.7.0" - resolved "https://registry.yarnpkg.com/threads/-/threads-1.7.0.tgz#d9e9627bfc1ef22ada3b733c2e7558bbe78e589c" - integrity sha512-Mx5NBSHX3sQYR6iI9VYbgHKBLisyB+xROCBGjjWm1O9wb9vfLxdaGtmT/KCjUqMsSNW6nERzCW3T6H43LqjDZQ== - dependencies: - callsites "^3.1.0" - debug "^4.2.0" - is-observable "^2.1.0" - observable-fns "^0.6.1" - optionalDependencies: - tiny-worker ">= 2" - -through2@^2.0.0: - version "2.0.5" - resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" - integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== - dependencies: - readable-stream "~2.3.6" - xtend "~4.0.1" - -through2@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/through2/-/through2-4.0.2.tgz#a7ce3ac2a7a8b0b966c80e7c49f0484c3b239764" - integrity sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw== - dependencies: - readable-stream "3" - -through@2, "through@>=2.2.7 <3": - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== - -tiny-invariant@^1.0.2: - version "1.3.1" - resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.3.1.tgz#8560808c916ef02ecfd55e66090df23a4b7aa642" - integrity sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw== - -tiny-warning@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" - integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== - -"tiny-worker@>= 2": - version "2.3.0" - resolved "https://registry.yarnpkg.com/tiny-worker/-/tiny-worker-2.3.0.tgz#715ae34304c757a9af573ae9a8e3967177e6011e" - integrity sha512-pJ70wq5EAqTAEl9IkGzA+fN0836rycEuz2Cn6yeZ6FRzlVS5IDOkFHpIoEsksPRQV34GDqXm65+OlnZqUSyK2g== - dependencies: - esm "^3.2.25" - -tinybench@^2.5.0: - version "2.5.1" - resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-2.5.1.tgz#3408f6552125e53a5a48adee31261686fd71587e" - integrity sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg== - -tinycolor2@^1.4.1: - version "1.6.0" - resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.6.0.tgz#f98007460169b0263b97072c5ae92484ce02d09e" - integrity sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw== - -tinypool@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-0.7.0.tgz#88053cc99b4a594382af23190c609d93fddf8021" - integrity sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww== - -tinyspy@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/tinyspy/-/tinyspy-2.2.0.tgz#9dc04b072746520b432f77ea2c2d17933de5d6ce" - integrity sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg== - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -tough-cookie@^4.0.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.3.tgz#97b9adb0728b42280aa3d814b6b999b2ff0318bf" - integrity sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw== - dependencies: - psl "^1.1.33" - punycode "^2.1.1" - universalify "^0.2.0" - url-parse "^1.5.3" - -tr46@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-3.0.0.tgz#555c4e297a950617e8eeddef633c87d4d9d6cbf9" - integrity sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA== - dependencies: - punycode "^2.1.1" - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== - -trim-newlines@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" - integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== - -trim-repeated@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/trim-repeated/-/trim-repeated-1.0.0.tgz#e3646a2ea4e891312bf7eace6cfb05380bc01c21" - integrity sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg== - dependencies: - escape-string-regexp "^1.0.2" - -trough@^1.0.0: - version "1.0.5" - resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406" - integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA== - -ts-json-schema-generator@^1.0.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/ts-json-schema-generator/-/ts-json-schema-generator-1.4.1.tgz#83a72dace79c8684b6d0fcad1c7d49c656e985d2" - integrity sha512-wnhPMtskk9KvsTuU8AYx0TNdm1YrLVUEontT22+jL12JIPqPXdaoxPgsYBhlqDXsR9R9Nm2bJgH5r4IrTMbTSg== - dependencies: - "@types/json-schema" "^7.0.12" - commander "^11.0.0" - glob "^8.0.3" - json5 "^2.2.3" - normalize-path "^3.0.0" - safe-stable-stringify "^2.4.3" - typescript "~5.3.2" - -tslib@^1.8.1: - version "1.14.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" - integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== - -tslib@^2.1.0: - version "2.6.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" - integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== - -tsutils@^3.21.0: - version "3.21.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" - integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== - dependencies: - tslib "^1.8.1" - -two-product@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/two-product/-/two-product-1.0.2.tgz#67d95d4b257a921e2cb4bd7af9511f9088522eaa" - integrity sha512-vOyrqmeYvzjToVM08iU52OFocWT6eB/I5LUWYnxeAPGXAhAxXYU/Yr/R2uY5/5n4bvJQL9AQulIuxpIsMoT8XQ== - -two-sum@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/two-sum/-/two-sum-1.0.0.tgz#31d3f32239e4f731eca9df9155e2b297f008ab64" - integrity sha512-phP48e8AawgsNUjEY2WvoIWqdie8PoiDZGxTDv70LDr01uX5wLEQbOgSP7Z/B6+SW5oLtbe8qaYX2fKJs3CGTw== - -type-check@^0.4.0, type-check@~0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" - integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== - dependencies: - prelude-ls "^1.2.1" - -type-detect@^4.0.0, type-detect@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== - -type-fest@^0.18.0: - version "0.18.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f" - integrity sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw== - -type-fest@^0.20.2: - version "0.20.2" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" - integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== - -type-fest@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" - integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== - -type-fest@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" - integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== - -typed-array-buffer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz#18de3e7ed7974b0a729d3feecb94338d1472cd60" - integrity sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw== - dependencies: - call-bind "^1.0.2" - get-intrinsic "^1.2.1" - is-typed-array "^1.1.10" - -typed-array-byte-length@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz#d787a24a995711611fb2b87a4052799517b230d0" - integrity sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA== - dependencies: - call-bind "^1.0.2" - for-each "^0.3.3" - has-proto "^1.0.1" - is-typed-array "^1.1.10" - -typed-array-byte-offset@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz#cbbe89b51fdef9cd6aaf07ad4707340abbc4ea0b" - integrity sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg== - dependencies: - available-typed-arrays "^1.0.5" - call-bind "^1.0.2" - for-each "^0.3.3" - has-proto "^1.0.1" - is-typed-array "^1.1.10" - -typed-array-length@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb" - integrity sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng== - dependencies: - call-bind "^1.0.2" - for-each "^0.3.3" - is-typed-array "^1.1.9" - -typedarray-pool@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/typedarray-pool/-/typedarray-pool-1.2.0.tgz#e7e90720144ba02b9ed660438af6f3aacfe33ac3" - integrity sha512-YTSQbzX43yvtpfRtIDAYygoYtgT+Rpjuxy9iOpczrjpXLgGoyG7aS5USJXV2d3nn8uHTeb9rXDvzS27zUg5KYQ== - dependencies: - bit-twiddle "^1.0.0" - dup "^1.0.0" - -typescript@^5.0.2, typescript@~5.3.2: - version "5.3.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.2.tgz#00d1c7c1c46928c5845c1ee8d0cc2791031d4c43" - integrity sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ== - -ufo@^1.3.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.3.2.tgz#c7d719d0628a1c80c006d2240e0d169f6e3c0496" - integrity sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA== - -uglify-js@^3.1.4: - version "3.17.4" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c" - integrity sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g== - -unbox-primitive@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" - integrity sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw== - dependencies: - call-bind "^1.0.2" - has-bigints "^1.0.2" - has-symbols "^1.0.3" - which-boxed-primitive "^1.0.2" - -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== - -unified@^9.0.0: - version "9.2.2" - resolved "https://registry.yarnpkg.com/unified/-/unified-9.2.2.tgz#67649a1abfc3ab85d2969502902775eb03146975" - integrity sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ== - dependencies: - bail "^1.0.0" - extend "^3.0.0" - is-buffer "^2.0.0" - is-plain-obj "^2.0.0" - trough "^1.0.0" - vfile "^4.0.0" - -unist-util-is@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-4.1.0.tgz#976e5f462a7a5de73d94b706bac1b90671b57797" - integrity sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg== - -unist-util-stringify-position@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz#cce3bfa1cdf85ba7375d1d5b17bdc4cada9bd9da" - integrity sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g== - dependencies: - "@types/unist" "^2.0.2" - -unist-util-visit-parents@1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-1.1.2.tgz#f6e3afee8bdbf961c0e6f028ea3c0480028c3d06" - integrity sha512-yvo+MMLjEwdc3RhhPYSximset7rwjMrdt9E41Smmvg25UQIenzrN83cRnF1JMzoMi9zZOQeYXHSDf7p+IQkW3Q== - -unist-util-visit-parents@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-3.1.1.tgz#65a6ce698f78a6b0f56aa0e88f13801886cdaef6" - integrity sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg== - dependencies: - "@types/unist" "^2.0.0" - unist-util-is "^4.0.0" - -unist-util-visit@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-2.0.3.tgz#c3703893146df47203bb8a9795af47d7b971208c" - integrity sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q== - dependencies: - "@types/unist" "^2.0.0" - unist-util-is "^4.0.0" - unist-util-visit-parents "^3.0.0" - -universalify@^0.1.0: - version "0.1.2" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" - integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== - -universalify@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" - integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== - -update-browserslist-db@^1.0.13: - version "1.0.13" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" - integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== - dependencies: - escalade "^3.1.1" - picocolors "^1.0.0" - -uri-js@^4.2.2: - version "4.4.1" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" - integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== - dependencies: - punycode "^2.1.0" - -url-parse@^1.4.3, url-parse@^1.5.3: - version "1.5.10" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" - integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== - dependencies: - querystringify "^2.1.1" - requires-port "^1.0.0" - -url@^0.11.0: - version "0.11.3" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.3.tgz#6f495f4b935de40ce4a0a52faee8954244f3d3ad" - integrity sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw== - dependencies: - punycode "^1.4.1" - qs "^6.11.2" - -use-resize-observer@^9.0.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/use-resize-observer/-/use-resize-observer-9.1.0.tgz#14735235cf3268569c1ea468f8a90c5789fc5c6c" - integrity sha512-R25VqO9Wb3asSD4eqtcxk8sJalvIOYBqS8MNZlpDSQ4l4xMQxC/J7Id9HoTqPq8FwULIn0PVW+OAqF2dyYbjow== - dependencies: - "@juggle/resize-observer" "^3.3.1" - -util-deprecate@^1.0.1, util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== - -utrie@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/utrie/-/utrie-1.0.2.tgz#d42fe44de9bc0119c25de7f564a6ed1b2c87a645" - integrity sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw== - dependencies: - base64-arraybuffer "^1.0.2" - -uuid@^3.3.2: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - -uuid@^8.3.2: - version "8.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" - integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== - -v8-to-istanbul@^9.0.0, v8-to-istanbul@^9.1.0: - version "9.2.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz#2ed7644a245cddd83d4e087b9b33b3e62dfd10ad" - integrity sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA== - dependencies: - "@jridgewell/trace-mapping" "^0.3.12" - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^2.0.0" - -validate-npm-package-license@^3.0.1: - version "3.0.4" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" - integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== - dependencies: - spdx-correct "^3.0.0" - spdx-expression-parse "^3.0.0" - -value-equal@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c" - integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw== - -vfile-message@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-2.0.4.tgz#5b43b88171d409eae58477d13f23dd41d52c371a" - integrity sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ== - dependencies: - "@types/unist" "^2.0.0" - unist-util-stringify-position "^2.0.0" - -vfile@^4.0.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/vfile/-/vfile-4.2.1.tgz#03f1dce28fc625c625bc6514350fbdb00fa9e624" - integrity sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA== - dependencies: - "@types/unist" "^2.0.0" - is-buffer "^2.0.0" - unist-util-stringify-position "^2.0.0" - vfile-message "^2.0.0" - -vite-node@0.34.6: - version "0.34.6" - resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-0.34.6.tgz#34d19795de1498562bf21541a58edcd106328a17" - integrity sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA== - dependencies: - cac "^6.7.14" - debug "^4.3.4" - mlly "^1.4.0" - pathe "^1.1.1" - picocolors "^1.0.0" - vite "^3.0.0 || ^4.0.0 || ^5.0.0-0" - -"vite@^3.0.0 || ^4.0.0 || ^5.0.0-0", "vite@^3.1.0 || ^4.0.0 || ^5.0.0-0": - version "5.0.5" - resolved "https://registry.yarnpkg.com/vite/-/vite-5.0.5.tgz#3eebe3698e3b32cea36350f58879258fec858a3c" - integrity sha512-OekeWqR9Ls56f3zd4CaxzbbS11gqYkEiBtnWFFgYR2WV8oPJRRKq0mpskYy/XaoCL3L7VINDhqqOMNDiYdGvGg== - dependencies: - esbuild "^0.19.3" - postcss "^8.4.32" - rollup "^4.2.0" - optionalDependencies: - fsevents "~2.3.3" - -vite@^4.4.11: - version "4.5.1" - resolved "https://registry.yarnpkg.com/vite/-/vite-4.5.1.tgz#3370986e1ed5dbabbf35a6c2e1fb1e18555b968a" - integrity sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA== - dependencies: - esbuild "^0.18.10" - postcss "^8.4.27" - rollup "^3.27.1" - optionalDependencies: - fsevents "~2.3.2" - -vitest-canvas-mock@^0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/vitest-canvas-mock/-/vitest-canvas-mock-0.3.3.tgz#97e3b5f53003c5cbb9540204ff3122cd25be4dcd" - integrity sha512-3P968tYBpqYyzzOaVtqnmYjqbe13576/fkjbDEJSfQAkHtC5/UjuRHOhFEN/ZV5HVZIkaROBUWgazDKJ+Ibw+Q== - dependencies: - jest-canvas-mock "~2.5.2" - -vitest@^0.34.6: - version "0.34.6" - resolved "https://registry.yarnpkg.com/vitest/-/vitest-0.34.6.tgz#44880feeeef493c04b7f795ed268f24a543250d7" - integrity sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q== - dependencies: - "@types/chai" "^4.3.5" - "@types/chai-subset" "^1.3.3" - "@types/node" "*" - "@vitest/expect" "0.34.6" - "@vitest/runner" "0.34.6" - "@vitest/snapshot" "0.34.6" - "@vitest/spy" "0.34.6" - "@vitest/utils" "0.34.6" - acorn "^8.9.0" - acorn-walk "^8.2.0" - cac "^6.7.14" - chai "^4.3.10" - debug "^4.3.4" - local-pkg "^0.4.3" - magic-string "^0.30.1" - pathe "^1.1.1" - picocolors "^1.0.0" - std-env "^3.3.3" - strip-literal "^1.0.1" - tinybench "^2.5.0" - tinypool "^0.7.0" - vite "^3.1.0 || ^4.0.0 || ^5.0.0-0" - vite-node "0.34.6" - why-is-node-running "^2.2.2" - -vkbeautify@^0.99.3: - version "0.99.3" - resolved "https://registry.yarnpkg.com/vkbeautify/-/vkbeautify-0.99.3.tgz#4769b3238c5d772c6ea967545dd1df5582f23297" - integrity sha512-2ozZEFfmVvQcHWoHLNuiKlUfDKlhh4KGsy54U0UrlLMR1SO+XKAIDqBxtBwHgNrekurlJwE8A9K6L49T78ZQ9Q== - -w3c-hr-time@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" - integrity sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ== - dependencies: - browser-process-hrtime "^1.0.0" - -w3c-xmlserializer@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-3.0.0.tgz#06cdc3eefb7e4d0b20a560a5a3aeb0d2d9a65923" - integrity sha512-3WFqGEgSXIyGhOmAFtlicJNMjEps8b1MG31NCA0/vOF9+nKMUW1ckhi9cnNHmf88Rzw5V+dwIwsm2C7X8k9aQg== - dependencies: - xml-name-validator "^4.0.0" - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== - -webidl-conversions@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" - integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== - -whatwg-encoding@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" - integrity sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg== - dependencies: - iconv-lite "0.6.3" - -whatwg-mimetype@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7" - integrity sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q== - -whatwg-url@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-10.0.0.tgz#37264f720b575b4a311bd4094ed8c760caaa05da" - integrity sha512-CLxxCmdUby142H5FZzn4D8ikO1cmypvXVQktsgosNy4a4BHrDHeciBBGZhb0bNoR5/MltoCatso+vFjjGx8t0w== - dependencies: - tr46 "^3.0.0" - webidl-conversions "^7.0.0" - -whatwg-url@^11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-11.0.0.tgz#0a849eebb5faf2119b901bb76fd795c2848d4018" - integrity sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ== - dependencies: - tr46 "^3.0.0" - webidl-conversions "^7.0.0" - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - -which-boxed-primitive@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" - integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== - dependencies: - is-bigint "^1.0.1" - is-boolean-object "^1.1.0" - is-number-object "^1.0.4" - is-string "^1.0.5" - is-symbol "^1.0.3" - -which-builtin-type@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/which-builtin-type/-/which-builtin-type-1.1.3.tgz#b1b8443707cc58b6e9bf98d32110ff0c2cbd029b" - integrity sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw== - dependencies: - function.prototype.name "^1.1.5" - has-tostringtag "^1.0.0" - is-async-function "^2.0.0" - is-date-object "^1.0.5" - is-finalizationregistry "^1.0.2" - is-generator-function "^1.0.10" - is-regex "^1.1.4" - is-weakref "^1.0.2" - isarray "^2.0.5" - which-boxed-primitive "^1.0.2" - which-collection "^1.0.1" - which-typed-array "^1.1.9" - -which-collection@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.1.tgz#70eab71ebbbd2aefaf32f917082fc62cdcb70906" - integrity sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A== - dependencies: - is-map "^2.0.1" - is-set "^2.0.1" - is-weakmap "^2.0.1" - is-weakset "^2.0.1" - -which-typed-array@^1.1.11, which-typed-array@^1.1.13, which-typed-array@^1.1.9: - version "1.1.13" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.13.tgz#870cd5be06ddb616f504e7b039c4c24898184d36" - integrity sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow== - dependencies: - available-typed-arrays "^1.0.5" - call-bind "^1.0.4" - for-each "^0.3.3" - gopd "^1.0.1" - has-tostringtag "^1.0.0" - -which@^1.2.9: - version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== - dependencies: - isexe "^2.0.0" - -which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -why-is-node-running@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/why-is-node-running/-/why-is-node-running-2.2.2.tgz#4185b2b4699117819e7154594271e7e344c9973e" - integrity sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA== - dependencies: - siginfo "^2.0.0" - stackback "0.0.2" - -wordwrap@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== - -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" - integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== - dependencies: - ansi-styles "^6.1.0" - string-width "^5.0.1" - strip-ansi "^7.0.1" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - -ws@^8.2.3: - version "8.14.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f" - integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g== - -xml-name-validator@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" - integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== - -xmlchars@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" - integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== - -xmlhttprequest@1: - version "1.8.0" - resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" - integrity sha512-58Im/U0mlVBLM38NdZjHyhuMtCqa61469k2YP/AaPbvCoV9aQGUpbJBj1QRm2ytRiVQBD/fsw7L2bJGDVQswBA== - -xtend@^4.0.1, xtend@~4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" - integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== - -y18n@^5.0.5: - version "5.0.8" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" - integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== - -yallist@^3.0.2: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" - integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== - -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - -yargs-parser@^20.2.2, yargs-parser@^20.2.3, yargs-parser@^20.2.9: - version "20.2.9" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" - integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== - -yargs@^16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== - dependencies: - cliui "^7.0.2" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.0" - y18n "^5.0.5" - yargs-parser "^20.2.2" - -yocto-queue@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" - integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== - -yocto-queue@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" - integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== - -zwitch@^1.0.0: - version "1.0.5" - resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-1.0.5.tgz#d11d7381ffed16b742f6af7b3f223d5cd9fe9920" - integrity sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw== From a226429c8feb5441b5353d7d3386b9aea54bc81e Mon Sep 17 00:00:00 2001 From: Michael Puehringer Date: Tue, 9 Jan 2024 09:11:33 +0100 Subject: [PATCH 2/8] Add dist folder --- .gitignore | 2 +- dist/assets/bam-worker-fec5d05b.js.map | 1 + dist/assets/bed-worker-cb58a7c2.js.map | 1 + dist/assets/gff-worker-71adf8b0.js.map | 1 + dist/assets/vcf-worker-0bc0fe81.js.map | 1 + dist/exported-utils-c80467e4.js | 10042 ++++++ dist/exported-utils-c80467e4.js.map | 1 + dist/favicon.ico | Bin 0 -> 2055 bytes dist/gosling.js | 26774 ++++++++++++++++ dist/gosling.js.map | 1 + dist/src/alias/buffer-shim.d.ts | 2 + dist/src/alias/buffer-shim.d.ts.map | 1 + dist/src/alias/zlib.d.ts | 8 + dist/src/alias/zlib.d.ts.map | 1 + dist/src/api/api-data.d.ts | 21 + dist/src/api/api-data.d.ts.map | 1 + dist/src/api/api.d.ts | 48 + dist/src/api/api.d.ts.map | 1 + dist/src/api/pubsub.d.ts | 7 + dist/src/api/pubsub.d.ts.map | 1 + dist/src/api/track-and-view-ids.d.ts | 44 + dist/src/api/track-and-view-ids.d.ts.map | 1 + dist/src/compiler/bounding-box.d.ts | 52 + dist/src/compiler/bounding-box.d.ts.map | 1 + dist/src/compiler/compile.d.ts | 19 + dist/src/compiler/compile.d.ts.map | 1 + dist/src/compiler/create-higlass-models.d.ts | 7 + .../compiler/create-higlass-models.d.ts.map | 1 + dist/src/compiler/defaults.d.ts | 14 + dist/src/compiler/defaults.d.ts.map | 1 + dist/src/compiler/gosling-to-higlass.d.ts | 11 + dist/src/compiler/gosling-to-higlass.d.ts.map | 1 + dist/src/compiler/higlass-model.d.ts | 82 + dist/src/compiler/higlass-model.d.ts.map | 1 + dist/src/compiler/responsive.d.ts | 3 + dist/src/compiler/responsive.d.ts.map | 1 + dist/src/compiler/spec-preprocess.d.ts | 43 + dist/src/compiler/spec-preprocess.d.ts.map | 1 + dist/src/core/channel/index.d.ts | 8 + dist/src/core/channel/index.d.ts.map | 1 + dist/src/core/example/hg-view-config-1.d.ts | 736 + .../core/example/hg-view-config-1.d.ts.map | 1 + dist/src/core/gosling-component.d.ts | 36 + dist/src/core/gosling-component.d.ts.map | 1 + dist/src/core/gosling-embed.d.ts | 18 + dist/src/core/gosling-embed.d.ts.map | 1 + dist/src/core/higlass-component-wrapper.d.ts | 28 + .../core/higlass-component-wrapper.d.ts.map | 1 + dist/src/core/init.d.ts | 5 + dist/src/core/init.d.ts.map | 1 + dist/src/core/mark/area.d.ts | 7 + dist/src/core/mark/area.d.ts.map | 1 + dist/src/core/mark/axis.d.ts | 16 + dist/src/core/mark/axis.d.ts.map | 1 + dist/src/core/mark/background.d.ts | 4 + dist/src/core/mark/background.d.ts.map | 1 + dist/src/core/mark/bar.d.ts | 11 + dist/src/core/mark/bar.d.ts.map | 1 + dist/src/core/mark/betweenLink.d.ts | 4 + dist/src/core/mark/betweenLink.d.ts.map | 1 + dist/src/core/mark/grid.d.ts | 6 + dist/src/core/mark/grid.d.ts.map | 1 + dist/src/core/mark/index.d.ts | 22 + dist/src/core/mark/index.d.ts.map | 1 + dist/src/core/mark/legend.d.ts | 20 + dist/src/core/mark/legend.d.ts.map | 1 + dist/src/core/mark/line.d.ts | 4 + dist/src/core/mark/line.d.ts.map | 1 + dist/src/core/mark/outline-circular.d.ts | 4 + dist/src/core/mark/outline-circular.d.ts.map | 1 + dist/src/core/mark/outline.d.ts | 12 + dist/src/core/mark/outline.d.ts.map | 1 + dist/src/core/mark/point.d.ts | 8 + dist/src/core/mark/point.d.ts.map | 1 + dist/src/core/mark/rect.d.ts | 11 + dist/src/core/mark/rect.d.ts.map | 1 + dist/src/core/mark/rule.d.ts | 4 + dist/src/core/mark/rule.d.ts.map | 1 + dist/src/core/mark/text.d.ts | 14 + dist/src/core/mark/text.d.ts.map | 1 + dist/src/core/mark/title.d.ts | 5 + dist/src/core/mark/title.d.ts.map | 1 + dist/src/core/mark/triangle.d.ts | 4 + dist/src/core/mark/triangle.d.ts.map | 1 + dist/src/core/mark/withinLink.d.ts | 4 + dist/src/core/mark/withinLink.d.ts.map | 1 + dist/src/core/utils/array.d.ts | 44 + dist/src/core/utils/array.d.ts.map | 1 + dist/src/core/utils/assembly.d.ts | 61 + dist/src/core/utils/assembly.d.ts.map | 1 + dist/src/core/utils/chrom-size.d.ts | 184 + dist/src/core/utils/chrom-size.d.ts.map | 1 + dist/src/core/utils/color-to-hex.d.ts | 6 + dist/src/core/utils/color-to-hex.d.ts.map | 1 + dist/src/core/utils/data-transform.d.ts | 39 + dist/src/core/utils/data-transform.d.ts.map | 1 + dist/src/core/utils/define-plugin-track.d.ts | 11 + .../core/utils/define-plugin-track.d.ts.map | 1 + dist/src/core/utils/higlass-zoom-config.d.ts | 6 + .../core/utils/higlass-zoom-config.d.ts.map | 1 + dist/src/core/utils/index.d.ts | 9 + dist/src/core/utils/index.d.ts.map | 1 + dist/src/core/utils/linking.d.ts | 12 + dist/src/core/utils/linking.d.ts.map | 1 + dist/src/core/utils/omit-deep.d.ts | 3 + dist/src/core/utils/omit-deep.d.ts.map | 1 + dist/src/core/utils/overlay.d.ts | 13 + dist/src/core/utils/overlay.d.ts.map | 1 + dist/src/core/utils/polar.d.ts | 19 + dist/src/core/utils/polar.d.ts.map | 1 + dist/src/core/utils/position.d.ts | 19 + dist/src/core/utils/position.d.ts.map | 1 + dist/src/core/utils/scales.d.ts | 12 + dist/src/core/utils/scales.d.ts.map | 1 + dist/src/core/utils/semantic-zoom.d.ts | 8 + dist/src/core/utils/semantic-zoom.d.ts.map | 1 + dist/src/core/utils/style.d.ts | 3 + dist/src/core/utils/style.d.ts.map | 1 + dist/src/core/utils/template.d.ts | 11 + dist/src/core/utils/template.d.ts.map | 1 + dist/src/core/utils/text-style.d.ts | 19 + dist/src/core/utils/text-style.d.ts.map | 1 + dist/src/core/utils/theme.d.ts | 115 + dist/src/core/utils/theme.d.ts.map | 1 + dist/src/core/utils/uuid.d.ts | 2 + dist/src/core/utils/uuid.d.ts.map | 1 + dist/src/core/visual-property.schema.d.ts | 2 + dist/src/core/visual-property.schema.d.ts.map | 1 + .../data-fetchers/bam/bam-data-fetcher.d.ts | 29 + .../bam/bam-data-fetcher.d.ts.map | 1 + dist/src/data-fetchers/bam/bam-worker.d.ts | 82 + .../src/data-fetchers/bam/bam-worker.d.ts.map | 1 + .../data-fetchers/bed/bed-data-fetcher.d.ts | 31 + .../bed/bed-data-fetcher.d.ts.map | 1 + dist/src/data-fetchers/bed/bed-parser.d.ts | 28 + .../src/data-fetchers/bed/bed-parser.d.ts.map | 1 + dist/src/data-fetchers/bed/bed-worker.d.ts | 50 + .../src/data-fetchers/bed/bed-worker.d.ts.map | 1 + .../bigwig/bigwig-data-fetcher.d.ts | 56 + .../bigwig/bigwig-data-fetcher.d.ts.map | 1 + .../data-fetchers/csv/csv-data-fetcher.d.ts | 58 + .../csv/csv-data-fetcher.d.ts.map | 1 + .../data-fetchers/gff/gff-data-fetcher.d.ts | 25 + .../gff/gff-data-fetcher.d.ts.map | 1 + dist/src/data-fetchers/gff/gff-worker.d.ts | 39 + .../src/data-fetchers/gff/gff-worker.d.ts.map | 1 + dist/src/data-fetchers/gff/utils.d.ts | 10 + dist/src/data-fetchers/gff/utils.d.ts.map | 1 + dist/src/data-fetchers/index.d.ts | 9 + dist/src/data-fetchers/index.d.ts.map | 1 + .../data-fetchers/json/json-data-fetcher.d.ts | 11 + .../json/json-data-fetcher.d.ts.map | 1 + dist/src/data-fetchers/utils.d.ts | 54 + dist/src/data-fetchers/utils.d.ts.map | 1 + dist/src/data-fetchers/vcf/utils.d.ts | 11 + dist/src/data-fetchers/vcf/utils.d.ts.map | 1 + .../data-fetchers/vcf/vcf-data-fetcher.d.ts | 48 + .../vcf/vcf-data-fetcher.d.ts.map | 1 + dist/src/data-fetchers/vcf/vcf-worker.d.ts | 29 + .../src/data-fetchers/vcf/vcf-worker.d.ts.map | 1 + dist/src/exported-utils.d.ts | 5 + dist/src/exported-utils.d.ts.map | 1 + dist/src/gosling-schema/gosling.schema.d.ts | 1229 + .../gosling-schema/gosling.schema.d.ts.map | 1 + .../gosling-schema/gosling.schema.guards.d.ts | 81 + .../gosling.schema.guards.d.ts.map | 1 + dist/src/gosling-schema/index.d.ts | 6 + dist/src/gosling-schema/index.d.ts.map | 1 + dist/src/gosling-schema/validate.d.ts | 26 + dist/src/gosling-schema/validate.d.ts.map | 1 + dist/src/gosling-theme/dark.d.ts | 3 + dist/src/gosling-theme/dark.d.ts.map | 1 + dist/src/gosling-theme/ensembl.d.ts | 3 + dist/src/gosling-theme/ensembl.d.ts.map | 1 + dist/src/gosling-theme/excel.d.ts | 3 + dist/src/gosling-theme/excel.d.ts.map | 1 + dist/src/gosling-theme/ggplot.d.ts | 3 + dist/src/gosling-theme/ggplot.d.ts.map | 1 + dist/src/gosling-theme/google.d.ts | 3 + dist/src/gosling-theme/google.d.ts.map | 1 + dist/src/gosling-theme/igv.d.ts | 3 + dist/src/gosling-theme/igv.d.ts.map | 1 + dist/src/gosling-theme/index.d.ts | 16 + dist/src/gosling-theme/index.d.ts.map | 1 + dist/src/gosling-theme/jbrowse.d.ts | 3 + dist/src/gosling-theme/jbrowse.d.ts.map | 1 + dist/src/gosling-theme/light.d.ts | 3 + dist/src/gosling-theme/light.d.ts.map | 1 + dist/src/gosling-theme/test.d.ts | 16 + dist/src/gosling-theme/test.d.ts.map | 1 + dist/src/gosling-theme/ucsc.d.ts | 3 + dist/src/gosling-theme/ucsc.d.ts.map | 1 + dist/src/gosling-theme/warm.d.ts | 3 + dist/src/gosling-theme/warm.d.ts.map | 1 + dist/src/gosling-theme/washu.d.ts | 3 + dist/src/gosling-theme/washu.d.ts.map | 1 + dist/src/higlass-schema/higlass.schema.d.ts | 148 + .../higlass-schema/higlass.schema.d.ts.map | 1 + dist/src/higlass-schema/index.d.ts | 3 + dist/src/higlass-schema/index.d.ts.map | 1 + dist/src/index.d.ts | 15 + dist/src/index.d.ts.map | 1 + dist/src/tracks/dummy-track/dummy-track.d.ts | 16 + .../tracks/dummy-track/dummy-track.d.ts.map | 1 + dist/src/tracks/dummy-track/index.d.ts | 2 + dist/src/tracks/dummy-track/index.d.ts.map | 1 + .../src/tracks/gosling-brush/brush-track.d.ts | 26 + .../tracks/gosling-brush/brush-track.d.ts.map | 1 + dist/src/tracks/gosling-brush/index.d.ts | 3 + dist/src/tracks/gosling-brush/index.d.ts.map | 1 + .../gosling-brush/linear-brush-model.d.ts | 50 + .../gosling-brush/linear-brush-model.d.ts.map | 1 + .../gosling-genomic-axis/axis-track.d.ts | 40 + .../gosling-genomic-axis/axis-track.d.ts.map | 1 + .../tracks/gosling-genomic-axis/index.d.ts | 3 + .../gosling-genomic-axis/index.d.ts.map | 1 + .../gosling-track/data-abstraction.d.ts | 16 + .../gosling-track/data-abstraction.d.ts.map | 1 + .../gosling-mouse-event/index.d.ts | 3 + .../gosling-mouse-event/index.d.ts.map | 1 + .../mouse-event-model.d.ts | 71 + .../mouse-event-model.d.ts.map | 1 + .../gosling-mouse-event/polygon.d.ts | 52 + .../gosling-mouse-event/polygon.d.ts.map | 1 + .../gosling-track/gosling-track-model.d.ts | 118 + .../gosling-track-model.d.ts.map | 1 + .../tracks/gosling-track/gosling-track.d.ts | 40 + .../gosling-track/gosling-track.d.ts.map | 1 + dist/src/tracks/gosling-track/index.d.ts | 2 + dist/src/tracks/gosling-track/index.d.ts.map | 1 + dist/utils.js | 20 + dist/utils.js.map | 1 + package.json | 2 - 233 files changed, 41494 insertions(+), 3 deletions(-) create mode 100644 dist/assets/bam-worker-fec5d05b.js.map create mode 100644 dist/assets/bed-worker-cb58a7c2.js.map create mode 100644 dist/assets/gff-worker-71adf8b0.js.map create mode 100644 dist/assets/vcf-worker-0bc0fe81.js.map create mode 100644 dist/exported-utils-c80467e4.js create mode 100644 dist/exported-utils-c80467e4.js.map create mode 100644 dist/favicon.ico create mode 100644 dist/gosling.js create mode 100644 dist/gosling.js.map create mode 100644 dist/src/alias/buffer-shim.d.ts create mode 100644 dist/src/alias/buffer-shim.d.ts.map create mode 100644 dist/src/alias/zlib.d.ts create mode 100644 dist/src/alias/zlib.d.ts.map create mode 100644 dist/src/api/api-data.d.ts create mode 100644 dist/src/api/api-data.d.ts.map create mode 100644 dist/src/api/api.d.ts create mode 100644 dist/src/api/api.d.ts.map create mode 100644 dist/src/api/pubsub.d.ts create mode 100644 dist/src/api/pubsub.d.ts.map create mode 100644 dist/src/api/track-and-view-ids.d.ts create mode 100644 dist/src/api/track-and-view-ids.d.ts.map create mode 100644 dist/src/compiler/bounding-box.d.ts create mode 100644 dist/src/compiler/bounding-box.d.ts.map create mode 100644 dist/src/compiler/compile.d.ts create mode 100644 dist/src/compiler/compile.d.ts.map create mode 100644 dist/src/compiler/create-higlass-models.d.ts create mode 100644 dist/src/compiler/create-higlass-models.d.ts.map create mode 100644 dist/src/compiler/defaults.d.ts create mode 100644 dist/src/compiler/defaults.d.ts.map create mode 100644 dist/src/compiler/gosling-to-higlass.d.ts create mode 100644 dist/src/compiler/gosling-to-higlass.d.ts.map create mode 100644 dist/src/compiler/higlass-model.d.ts create mode 100644 dist/src/compiler/higlass-model.d.ts.map create mode 100644 dist/src/compiler/responsive.d.ts create mode 100644 dist/src/compiler/responsive.d.ts.map create mode 100644 dist/src/compiler/spec-preprocess.d.ts create mode 100644 dist/src/compiler/spec-preprocess.d.ts.map create mode 100644 dist/src/core/channel/index.d.ts create mode 100644 dist/src/core/channel/index.d.ts.map create mode 100644 dist/src/core/example/hg-view-config-1.d.ts create mode 100644 dist/src/core/example/hg-view-config-1.d.ts.map create mode 100644 dist/src/core/gosling-component.d.ts create mode 100644 dist/src/core/gosling-component.d.ts.map create mode 100644 dist/src/core/gosling-embed.d.ts create mode 100644 dist/src/core/gosling-embed.d.ts.map create mode 100644 dist/src/core/higlass-component-wrapper.d.ts create mode 100644 dist/src/core/higlass-component-wrapper.d.ts.map create mode 100644 dist/src/core/init.d.ts create mode 100644 dist/src/core/init.d.ts.map create mode 100644 dist/src/core/mark/area.d.ts create mode 100644 dist/src/core/mark/area.d.ts.map create mode 100644 dist/src/core/mark/axis.d.ts create mode 100644 dist/src/core/mark/axis.d.ts.map create mode 100644 dist/src/core/mark/background.d.ts create mode 100644 dist/src/core/mark/background.d.ts.map create mode 100644 dist/src/core/mark/bar.d.ts create mode 100644 dist/src/core/mark/bar.d.ts.map create mode 100644 dist/src/core/mark/betweenLink.d.ts create mode 100644 dist/src/core/mark/betweenLink.d.ts.map create mode 100644 dist/src/core/mark/grid.d.ts create mode 100644 dist/src/core/mark/grid.d.ts.map create mode 100644 dist/src/core/mark/index.d.ts create mode 100644 dist/src/core/mark/index.d.ts.map create mode 100644 dist/src/core/mark/legend.d.ts create mode 100644 dist/src/core/mark/legend.d.ts.map create mode 100644 dist/src/core/mark/line.d.ts create mode 100644 dist/src/core/mark/line.d.ts.map create mode 100644 dist/src/core/mark/outline-circular.d.ts create mode 100644 dist/src/core/mark/outline-circular.d.ts.map create mode 100644 dist/src/core/mark/outline.d.ts create mode 100644 dist/src/core/mark/outline.d.ts.map create mode 100644 dist/src/core/mark/point.d.ts create mode 100644 dist/src/core/mark/point.d.ts.map create mode 100644 dist/src/core/mark/rect.d.ts create mode 100644 dist/src/core/mark/rect.d.ts.map create mode 100644 dist/src/core/mark/rule.d.ts create mode 100644 dist/src/core/mark/rule.d.ts.map create mode 100644 dist/src/core/mark/text.d.ts create mode 100644 dist/src/core/mark/text.d.ts.map create mode 100644 dist/src/core/mark/title.d.ts create mode 100644 dist/src/core/mark/title.d.ts.map create mode 100644 dist/src/core/mark/triangle.d.ts create mode 100644 dist/src/core/mark/triangle.d.ts.map create mode 100644 dist/src/core/mark/withinLink.d.ts create mode 100644 dist/src/core/mark/withinLink.d.ts.map create mode 100644 dist/src/core/utils/array.d.ts create mode 100644 dist/src/core/utils/array.d.ts.map create mode 100644 dist/src/core/utils/assembly.d.ts create mode 100644 dist/src/core/utils/assembly.d.ts.map create mode 100644 dist/src/core/utils/chrom-size.d.ts create mode 100644 dist/src/core/utils/chrom-size.d.ts.map create mode 100644 dist/src/core/utils/color-to-hex.d.ts create mode 100644 dist/src/core/utils/color-to-hex.d.ts.map create mode 100644 dist/src/core/utils/data-transform.d.ts create mode 100644 dist/src/core/utils/data-transform.d.ts.map create mode 100644 dist/src/core/utils/define-plugin-track.d.ts create mode 100644 dist/src/core/utils/define-plugin-track.d.ts.map create mode 100644 dist/src/core/utils/higlass-zoom-config.d.ts create mode 100644 dist/src/core/utils/higlass-zoom-config.d.ts.map create mode 100644 dist/src/core/utils/index.d.ts create mode 100644 dist/src/core/utils/index.d.ts.map create mode 100644 dist/src/core/utils/linking.d.ts create mode 100644 dist/src/core/utils/linking.d.ts.map create mode 100644 dist/src/core/utils/omit-deep.d.ts create mode 100644 dist/src/core/utils/omit-deep.d.ts.map create mode 100644 dist/src/core/utils/overlay.d.ts create mode 100644 dist/src/core/utils/overlay.d.ts.map create mode 100644 dist/src/core/utils/polar.d.ts create mode 100644 dist/src/core/utils/polar.d.ts.map create mode 100644 dist/src/core/utils/position.d.ts create mode 100644 dist/src/core/utils/position.d.ts.map create mode 100644 dist/src/core/utils/scales.d.ts create mode 100644 dist/src/core/utils/scales.d.ts.map create mode 100644 dist/src/core/utils/semantic-zoom.d.ts create mode 100644 dist/src/core/utils/semantic-zoom.d.ts.map create mode 100644 dist/src/core/utils/style.d.ts create mode 100644 dist/src/core/utils/style.d.ts.map create mode 100644 dist/src/core/utils/template.d.ts create mode 100644 dist/src/core/utils/template.d.ts.map create mode 100644 dist/src/core/utils/text-style.d.ts create mode 100644 dist/src/core/utils/text-style.d.ts.map create mode 100644 dist/src/core/utils/theme.d.ts create mode 100644 dist/src/core/utils/theme.d.ts.map create mode 100644 dist/src/core/utils/uuid.d.ts create mode 100644 dist/src/core/utils/uuid.d.ts.map create mode 100644 dist/src/core/visual-property.schema.d.ts create mode 100644 dist/src/core/visual-property.schema.d.ts.map create mode 100644 dist/src/data-fetchers/bam/bam-data-fetcher.d.ts create mode 100644 dist/src/data-fetchers/bam/bam-data-fetcher.d.ts.map create mode 100644 dist/src/data-fetchers/bam/bam-worker.d.ts create mode 100644 dist/src/data-fetchers/bam/bam-worker.d.ts.map create mode 100644 dist/src/data-fetchers/bed/bed-data-fetcher.d.ts create mode 100644 dist/src/data-fetchers/bed/bed-data-fetcher.d.ts.map create mode 100644 dist/src/data-fetchers/bed/bed-parser.d.ts create mode 100644 dist/src/data-fetchers/bed/bed-parser.d.ts.map create mode 100644 dist/src/data-fetchers/bed/bed-worker.d.ts create mode 100644 dist/src/data-fetchers/bed/bed-worker.d.ts.map create mode 100644 dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts create mode 100644 dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts.map create mode 100644 dist/src/data-fetchers/csv/csv-data-fetcher.d.ts create mode 100644 dist/src/data-fetchers/csv/csv-data-fetcher.d.ts.map create mode 100644 dist/src/data-fetchers/gff/gff-data-fetcher.d.ts create mode 100644 dist/src/data-fetchers/gff/gff-data-fetcher.d.ts.map create mode 100644 dist/src/data-fetchers/gff/gff-worker.d.ts create mode 100644 dist/src/data-fetchers/gff/gff-worker.d.ts.map create mode 100644 dist/src/data-fetchers/gff/utils.d.ts create mode 100644 dist/src/data-fetchers/gff/utils.d.ts.map create mode 100644 dist/src/data-fetchers/index.d.ts create mode 100644 dist/src/data-fetchers/index.d.ts.map create mode 100644 dist/src/data-fetchers/json/json-data-fetcher.d.ts create mode 100644 dist/src/data-fetchers/json/json-data-fetcher.d.ts.map create mode 100644 dist/src/data-fetchers/utils.d.ts create mode 100644 dist/src/data-fetchers/utils.d.ts.map create mode 100644 dist/src/data-fetchers/vcf/utils.d.ts create mode 100644 dist/src/data-fetchers/vcf/utils.d.ts.map create mode 100644 dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts create mode 100644 dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts.map create mode 100644 dist/src/data-fetchers/vcf/vcf-worker.d.ts create mode 100644 dist/src/data-fetchers/vcf/vcf-worker.d.ts.map create mode 100644 dist/src/exported-utils.d.ts create mode 100644 dist/src/exported-utils.d.ts.map create mode 100644 dist/src/gosling-schema/gosling.schema.d.ts create mode 100644 dist/src/gosling-schema/gosling.schema.d.ts.map create mode 100644 dist/src/gosling-schema/gosling.schema.guards.d.ts create mode 100644 dist/src/gosling-schema/gosling.schema.guards.d.ts.map create mode 100644 dist/src/gosling-schema/index.d.ts create mode 100644 dist/src/gosling-schema/index.d.ts.map create mode 100644 dist/src/gosling-schema/validate.d.ts create mode 100644 dist/src/gosling-schema/validate.d.ts.map create mode 100644 dist/src/gosling-theme/dark.d.ts create mode 100644 dist/src/gosling-theme/dark.d.ts.map create mode 100644 dist/src/gosling-theme/ensembl.d.ts create mode 100644 dist/src/gosling-theme/ensembl.d.ts.map create mode 100644 dist/src/gosling-theme/excel.d.ts create mode 100644 dist/src/gosling-theme/excel.d.ts.map create mode 100644 dist/src/gosling-theme/ggplot.d.ts create mode 100644 dist/src/gosling-theme/ggplot.d.ts.map create mode 100644 dist/src/gosling-theme/google.d.ts create mode 100644 dist/src/gosling-theme/google.d.ts.map create mode 100644 dist/src/gosling-theme/igv.d.ts create mode 100644 dist/src/gosling-theme/igv.d.ts.map create mode 100644 dist/src/gosling-theme/index.d.ts create mode 100644 dist/src/gosling-theme/index.d.ts.map create mode 100644 dist/src/gosling-theme/jbrowse.d.ts create mode 100644 dist/src/gosling-theme/jbrowse.d.ts.map create mode 100644 dist/src/gosling-theme/light.d.ts create mode 100644 dist/src/gosling-theme/light.d.ts.map create mode 100644 dist/src/gosling-theme/test.d.ts create mode 100644 dist/src/gosling-theme/test.d.ts.map create mode 100644 dist/src/gosling-theme/ucsc.d.ts create mode 100644 dist/src/gosling-theme/ucsc.d.ts.map create mode 100644 dist/src/gosling-theme/warm.d.ts create mode 100644 dist/src/gosling-theme/warm.d.ts.map create mode 100644 dist/src/gosling-theme/washu.d.ts create mode 100644 dist/src/gosling-theme/washu.d.ts.map create mode 100644 dist/src/higlass-schema/higlass.schema.d.ts create mode 100644 dist/src/higlass-schema/higlass.schema.d.ts.map create mode 100644 dist/src/higlass-schema/index.d.ts create mode 100644 dist/src/higlass-schema/index.d.ts.map create mode 100644 dist/src/index.d.ts create mode 100644 dist/src/index.d.ts.map create mode 100644 dist/src/tracks/dummy-track/dummy-track.d.ts create mode 100644 dist/src/tracks/dummy-track/dummy-track.d.ts.map create mode 100644 dist/src/tracks/dummy-track/index.d.ts create mode 100644 dist/src/tracks/dummy-track/index.d.ts.map create mode 100644 dist/src/tracks/gosling-brush/brush-track.d.ts create mode 100644 dist/src/tracks/gosling-brush/brush-track.d.ts.map create mode 100644 dist/src/tracks/gosling-brush/index.d.ts create mode 100644 dist/src/tracks/gosling-brush/index.d.ts.map create mode 100644 dist/src/tracks/gosling-brush/linear-brush-model.d.ts create mode 100644 dist/src/tracks/gosling-brush/linear-brush-model.d.ts.map create mode 100644 dist/src/tracks/gosling-genomic-axis/axis-track.d.ts create mode 100644 dist/src/tracks/gosling-genomic-axis/axis-track.d.ts.map create mode 100644 dist/src/tracks/gosling-genomic-axis/index.d.ts create mode 100644 dist/src/tracks/gosling-genomic-axis/index.d.ts.map create mode 100644 dist/src/tracks/gosling-track/data-abstraction.d.ts create mode 100644 dist/src/tracks/gosling-track/data-abstraction.d.ts.map create mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts create mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts.map create mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts create mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts.map create mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts create mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts.map create mode 100644 dist/src/tracks/gosling-track/gosling-track-model.d.ts create mode 100644 dist/src/tracks/gosling-track/gosling-track-model.d.ts.map create mode 100644 dist/src/tracks/gosling-track/gosling-track.d.ts create mode 100644 dist/src/tracks/gosling-track/gosling-track.d.ts.map create mode 100644 dist/src/tracks/gosling-track/index.d.ts create mode 100644 dist/src/tracks/gosling-track/index.d.ts.map create mode 100644 dist/utils.js create mode 100644 dist/utils.js.map diff --git a/.gitignore b/.gitignore index e8a96926..d385dbcf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /node_modules /coverage /build -/dist +# /dist Check in dist to allow installing from here /.pnp /lib /bin diff --git a/dist/assets/bam-worker-fec5d05b.js.map b/dist/assets/bam-worker-fec5d05b.js.map new file mode 100644 index 00000000..99d93395 --- /dev/null +++ b/dist/assets/bam-worker-fec5d05b.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bam-worker-fec5d05b.js","sources":["../node_modules/.pnpm/is-observable@2.1.0/node_modules/is-observable/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/serializers.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/common.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/symbols.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/transferable.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/types/messages.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/implementation.browser.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/worker.mjs","../node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/virtualOffset.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/chunk.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/indexFile.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/util.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/bai.js","../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js","../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js","../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js","../__vite-browser-external","../node_modules/.pnpm/generic-filehandle@3.1.1/node_modules/generic-filehandle/esm/remoteFile.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js","../node_modules/.pnpm/@gmod+bgzf-filehandle@1.4.7/node_modules/@gmod/bgzf-filehandle/esm/unzip-pako.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/csi.js","../node_modules/.pnpm/buffer-crc32@0.2.13/node_modules/buffer-crc32/index.js","../node_modules/.pnpm/object.entries-ponyfill@1.0.1/node_modules/object.entries-ponyfill/entries.js","../node_modules/.pnpm/object.entries-ponyfill@1.0.1/node_modules/object.entries-ponyfill/index.js","../node_modules/.pnpm/abortcontroller-polyfill@1.7.5/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/abortcontroller-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateAbortController.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateStatusReporter.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AbortablePromiseCache.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/index.js","../node_modules/.pnpm/quick-lru@2.0.0/node_modules/quick-lru/index.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/constants.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/record.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/sam.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/bamFile.js","../node_modules/.pnpm/cross-fetch@3.1.8/node_modules/cross-fetch/dist/browser-polyfill.js","../node_modules/.pnpm/quick-lru@6.1.2/node_modules/quick-lru/index.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/ascending.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/bisector.js","../src/data-fetchers/utils.ts","../src/data-fetchers/bam/bam-worker.ts"],"sourcesContent":["'use strict';\n\nmodule.exports = value => {\n\tif (!value) {\n\t\treturn false;\n\t}\n\n\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\tif (typeof Symbol.observable === 'symbol' && typeof value[Symbol.observable] === 'function') {\n\t\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\t\treturn value === value[Symbol.observable]();\n\t}\n\n\tif (typeof value['@@observable'] === 'function') {\n\t\treturn value === value['@@observable']();\n\t}\n\n\treturn false;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultSerializer = exports.extendSerializer = void 0;\nfunction extendSerializer(extend, implementation) {\n const fallbackDeserializer = extend.deserialize.bind(extend);\n const fallbackSerializer = extend.serialize.bind(extend);\n return {\n deserialize(message) {\n return implementation.deserialize(message, fallbackDeserializer);\n },\n serialize(input) {\n return implementation.serialize(input, fallbackSerializer);\n }\n };\n}\nexports.extendSerializer = extendSerializer;\nconst DefaultErrorSerializer = {\n deserialize(message) {\n return Object.assign(Error(message.message), {\n name: message.name,\n stack: message.stack\n });\n },\n serialize(error) {\n return {\n __error_marker: \"$$error\",\n message: error.message,\n name: error.name,\n stack: error.stack\n };\n }\n};\nconst isSerializedError = (thing) => thing && typeof thing === \"object\" && \"__error_marker\" in thing && thing.__error_marker === \"$$error\";\nexports.DefaultSerializer = {\n deserialize(message) {\n if (isSerializedError(message)) {\n return DefaultErrorSerializer.deserialize(message);\n }\n else {\n return message;\n }\n },\n serialize(input) {\n if (input instanceof Error) {\n return DefaultErrorSerializer.serialize(input);\n }\n else {\n return input;\n }\n }\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.serialize = exports.deserialize = exports.registerSerializer = void 0;\nconst serializers_1 = require(\"./serializers\");\nlet registeredSerializer = serializers_1.DefaultSerializer;\nfunction registerSerializer(serializer) {\n registeredSerializer = serializers_1.extendSerializer(registeredSerializer, serializer);\n}\nexports.registerSerializer = registerSerializer;\nfunction deserialize(message) {\n return registeredSerializer.deserialize(message);\n}\nexports.deserialize = deserialize;\nfunction serialize(input) {\n return registeredSerializer.serialize(input);\n}\nexports.serialize = serialize;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.$worker = exports.$transferable = exports.$terminate = exports.$events = exports.$errors = void 0;\nexports.$errors = Symbol(\"thread.errors\");\nexports.$events = Symbol(\"thread.events\");\nexports.$terminate = Symbol(\"thread.terminate\");\nexports.$transferable = Symbol(\"thread.transferable\");\nexports.$worker = Symbol(\"thread.worker\");\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Transfer = exports.isTransferDescriptor = void 0;\nconst symbols_1 = require(\"./symbols\");\nfunction isTransferable(thing) {\n if (!thing || typeof thing !== \"object\")\n return false;\n // Don't check too thoroughly, since the list of transferable things in JS might grow over time\n return true;\n}\nfunction isTransferDescriptor(thing) {\n return thing && typeof thing === \"object\" && thing[symbols_1.$transferable];\n}\nexports.isTransferDescriptor = isTransferDescriptor;\nfunction Transfer(payload, transferables) {\n if (!transferables) {\n if (!isTransferable(payload))\n throw Error();\n transferables = [payload];\n }\n return {\n [symbols_1.$transferable]: true,\n send: payload,\n transferables\n };\n}\nexports.Transfer = Transfer;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WorkerMessageType = exports.MasterMessageType = void 0;\n/////////////////////////////\n// Messages sent by master:\nvar MasterMessageType;\n(function (MasterMessageType) {\n MasterMessageType[\"cancel\"] = \"cancel\";\n MasterMessageType[\"run\"] = \"run\";\n})(MasterMessageType = exports.MasterMessageType || (exports.MasterMessageType = {}));\n////////////////////////////\n// Messages sent by worker:\nvar WorkerMessageType;\n(function (WorkerMessageType) {\n WorkerMessageType[\"error\"] = \"error\";\n WorkerMessageType[\"init\"] = \"init\";\n WorkerMessageType[\"result\"] = \"result\";\n WorkerMessageType[\"running\"] = \"running\";\n WorkerMessageType[\"uncaughtError\"] = \"uncaughtError\";\n})(WorkerMessageType = exports.WorkerMessageType || (exports.WorkerMessageType = {}));\n","\"use strict\";\n/// \n// tslint:disable no-shadowed-variable\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst isWorkerRuntime = function isWorkerRuntime() {\n const isWindowContext = typeof self !== \"undefined\" && typeof Window !== \"undefined\" && self instanceof Window;\n return typeof self !== \"undefined\" && self.postMessage && !isWindowContext ? true : false;\n};\nconst postMessageToMaster = function postMessageToMaster(data, transferList) {\n self.postMessage(data, transferList);\n};\nconst subscribeToMasterMessages = function subscribeToMasterMessages(onMessage) {\n const messageHandler = (messageEvent) => {\n onMessage(messageEvent.data);\n };\n const unsubscribe = () => {\n self.removeEventListener(\"message\", messageHandler);\n };\n self.addEventListener(\"message\", messageHandler);\n return unsubscribe;\n};\nexports.default = {\n isWorkerRuntime,\n postMessageToMaster,\n subscribeToMasterMessages\n};\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.expose = exports.isWorkerRuntime = exports.Transfer = exports.registerSerializer = void 0;\nconst is_observable_1 = __importDefault(require(\"is-observable\"));\nconst common_1 = require(\"../common\");\nconst transferable_1 = require(\"../transferable\");\nconst messages_1 = require(\"../types/messages\");\nconst implementation_1 = __importDefault(require(\"./implementation\"));\nvar common_2 = require(\"../common\");\nObject.defineProperty(exports, \"registerSerializer\", { enumerable: true, get: function () { return common_2.registerSerializer; } });\nvar transferable_2 = require(\"../transferable\");\nObject.defineProperty(exports, \"Transfer\", { enumerable: true, get: function () { return transferable_2.Transfer; } });\n/** Returns `true` if this code is currently running in a worker. */\nexports.isWorkerRuntime = implementation_1.default.isWorkerRuntime;\nlet exposeCalled = false;\nconst activeSubscriptions = new Map();\nconst isMasterJobCancelMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.cancel;\nconst isMasterJobRunMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.run;\n/**\n * There are issues with `is-observable` not recognizing zen-observable's instances.\n * We are using `observable-fns`, but it's based on zen-observable, too.\n */\nconst isObservable = (thing) => is_observable_1.default(thing) || isZenObservable(thing);\nfunction isZenObservable(thing) {\n return thing && typeof thing === \"object\" && typeof thing.subscribe === \"function\";\n}\nfunction deconstructTransfer(thing) {\n return transferable_1.isTransferDescriptor(thing)\n ? { payload: thing.send, transferables: thing.transferables }\n : { payload: thing, transferables: undefined };\n}\nfunction postFunctionInitMessage() {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"function\"\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postModuleInitMessage(methodNames) {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"module\",\n methods: methodNames\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postJobErrorMessage(uid, rawError) {\n const { payload: error, transferables } = deconstructTransfer(rawError);\n const errorMessage = {\n type: messages_1.WorkerMessageType.error,\n uid,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage, transferables);\n}\nfunction postJobResultMessage(uid, completed, resultValue) {\n const { payload, transferables } = deconstructTransfer(resultValue);\n const resultMessage = {\n type: messages_1.WorkerMessageType.result,\n uid,\n complete: completed ? true : undefined,\n payload\n };\n implementation_1.default.postMessageToMaster(resultMessage, transferables);\n}\nfunction postJobStartMessage(uid, resultType) {\n const startMessage = {\n type: messages_1.WorkerMessageType.running,\n uid,\n resultType\n };\n implementation_1.default.postMessageToMaster(startMessage);\n}\nfunction postUncaughtErrorMessage(error) {\n try {\n const errorMessage = {\n type: messages_1.WorkerMessageType.uncaughtError,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage);\n }\n catch (subError) {\n // tslint:disable-next-line no-console\n console.error(\"Not reporting uncaught error back to master thread as it \" +\n \"occured while reporting an uncaught error already.\" +\n \"\\nLatest error:\", subError, \"\\nOriginal error:\", error);\n }\n}\nfunction runFunction(jobUID, fn, args) {\n return __awaiter(this, void 0, void 0, function* () {\n let syncResult;\n try {\n syncResult = fn(...args);\n }\n catch (error) {\n return postJobErrorMessage(jobUID, error);\n }\n const resultType = isObservable(syncResult) ? \"observable\" : \"promise\";\n postJobStartMessage(jobUID, resultType);\n if (isObservable(syncResult)) {\n const subscription = syncResult.subscribe(value => postJobResultMessage(jobUID, false, common_1.serialize(value)), error => {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n activeSubscriptions.delete(jobUID);\n }, () => {\n postJobResultMessage(jobUID, true);\n activeSubscriptions.delete(jobUID);\n });\n activeSubscriptions.set(jobUID, subscription);\n }\n else {\n try {\n const result = yield syncResult;\n postJobResultMessage(jobUID, true, common_1.serialize(result));\n }\n catch (error) {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n }\n }\n });\n}\n/**\n * Expose a function or a module (an object whose values are functions)\n * to the main thread. Must be called exactly once in every worker thread\n * to signal its API to the main thread.\n *\n * @param exposed Function or object whose values are functions\n */\nfunction expose(exposed) {\n if (!implementation_1.default.isWorkerRuntime()) {\n throw Error(\"expose() called in the master thread.\");\n }\n if (exposeCalled) {\n throw Error(\"expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.\");\n }\n exposeCalled = true;\n if (typeof exposed === \"function\") {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && !messageData.method) {\n runFunction(messageData.uid, exposed, messageData.args.map(common_1.deserialize));\n }\n });\n postFunctionInitMessage();\n }\n else if (typeof exposed === \"object\" && exposed) {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && messageData.method) {\n runFunction(messageData.uid, exposed[messageData.method], messageData.args.map(common_1.deserialize));\n }\n });\n const methodNames = Object.keys(exposed).filter(key => typeof exposed[key] === \"function\");\n postModuleInitMessage(methodNames);\n }\n else {\n throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${exposed}`);\n }\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobCancelMessage(messageData)) {\n const jobUID = messageData.uid;\n const subscription = activeSubscriptions.get(jobUID);\n if (subscription) {\n subscription.unsubscribe();\n activeSubscriptions.delete(jobUID);\n }\n }\n });\n}\nexports.expose = expose;\nif (typeof self !== \"undefined\" && typeof self.addEventListener === \"function\" && implementation_1.default.isWorkerRuntime()) {\n self.addEventListener(\"error\", event => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(event.error || event), 250);\n });\n self.addEventListener(\"unhandledrejection\", event => {\n const error = event.reason;\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\nif (typeof process !== \"undefined\" && typeof process.on === \"function\" && implementation_1.default.isWorkerRuntime()) {\n process.on(\"uncaughtException\", (error) => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n });\n process.on(\"unhandledRejection\", (error) => {\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\n","import WorkerContext from \"./dist/worker/index.js\"\n\nexport const expose = WorkerContext.expose\nexport const registerSerializer = WorkerContext.registerSerializer\nexport const Transfer = WorkerContext.Transfer\n","module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n","export default class VirtualOffset {\n constructor(blockPosition, dataPosition) {\n this.blockPosition = blockPosition; // < offset of the compressed data block\n this.dataPosition = dataPosition; // < offset into the uncompressed data\n }\n toString() {\n return `${this.blockPosition}:${this.dataPosition}`;\n }\n compareTo(b) {\n return (this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition);\n }\n static min(...args) {\n let min;\n let i = 0;\n for (; !min; i += 1) {\n min = args[i];\n }\n for (; i < args.length; i += 1) {\n if (min.compareTo(args[i]) > 0) {\n min = args[i];\n }\n }\n return min;\n }\n}\nexport function fromBytes(bytes, offset = 0, bigendian = false) {\n if (bigendian) {\n throw new Error('big-endian virtual file offsets not implemented');\n }\n return new VirtualOffset(bytes[offset + 7] * 0x10000000000 +\n bytes[offset + 6] * 0x100000000 +\n bytes[offset + 5] * 0x1000000 +\n bytes[offset + 4] * 0x10000 +\n bytes[offset + 3] * 0x100 +\n bytes[offset + 2], (bytes[offset + 1] << 8) | bytes[offset]);\n}\n//# sourceMappingURL=virtualOffset.js.map","// little class representing a chunk in the index\nexport default class Chunk {\n /**\n * @param {VirtualOffset} minv\n * @param {VirtualOffset} maxv\n * @param {number} bin\n * @param {number} [fetchedSize]\n */\n constructor(minv, maxv, bin, fetchedSize = undefined) {\n this.minv = minv;\n this.maxv = maxv;\n this.bin = bin;\n this._fetchedSize = fetchedSize;\n }\n toUniqueString() {\n return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`;\n }\n toString() {\n return this.toUniqueString();\n }\n compareTo(b) {\n return (this.minv.compareTo(b.minv) ||\n this.maxv.compareTo(b.maxv) ||\n this.bin - b.bin);\n }\n fetchedSize() {\n if (this._fetchedSize !== undefined) {\n return this._fetchedSize;\n }\n return this.maxv.blockPosition + (1 << 16) - this.minv.blockPosition;\n }\n}\n//# sourceMappingURL=chunk.js.map","export default class IndexFile {\n /**\n * @param {filehandle} filehandle\n * @param {function} [renameRefSeqs]\n */\n constructor({ filehandle, renameRefSeq = (n) => n, }) {\n this.filehandle = filehandle;\n this.renameRefSeq = renameRefSeq;\n }\n _findFirstData(data, virtualOffset) {\n const currentFdl = data.firstDataLine;\n if (currentFdl) {\n data.firstDataLine =\n currentFdl.compareTo(virtualOffset) > 0 ? virtualOffset : currentFdl;\n }\n else {\n data.firstDataLine = virtualOffset;\n }\n }\n async parse(opts = {}) {\n if (!this.setupP) {\n this.setupP = this._parse(opts).catch(e => {\n this.setupP = undefined;\n throw e;\n });\n }\n return this.setupP;\n }\n async hasRefSeq(seqId, opts = {}) {\n return !!((await this.parse(opts)).indices[seqId] || {}).binIndex;\n }\n}\n//# sourceMappingURL=indexFile.js.map","export function timeout(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\nexport function longToNumber(long) {\n if (long.greaterThan(Number.MAX_SAFE_INTEGER) ||\n long.lessThan(Number.MIN_SAFE_INTEGER)) {\n throw new Error('integer overflow');\n }\n return long.toNumber();\n}\n/**\n * Properly check if the given AbortSignal is aborted.\n * Per the standard, if the signal reads as aborted,\n * this function throws either a DOMException AbortError, or a regular error\n * with a `code` attribute set to `ERR_ABORTED`.\n *\n * For convenience, passing `undefined` is a no-op\n *\n * @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute\n * @returns nothing\n */\nexport function checkAbortSignal(signal) {\n if (!signal) {\n return;\n }\n if (signal.aborted) {\n // console.log('bam aborted!')\n if (typeof DOMException !== 'undefined') {\n throw new DOMException('aborted', 'AbortError');\n }\n else {\n const e = new Error('aborted');\n //@ts-ignore\n e.code = 'ERR_ABORTED';\n throw e;\n }\n }\n}\n/**\n * Skips to the next tick, then runs `checkAbortSignal`.\n * Await this to inside an otherwise synchronous loop to\n * provide a place to break when an abort signal is received.\n * @param {AbortSignal} signal\n */\nexport async function abortBreakPoint(signal) {\n await Promise.resolve();\n checkAbortSignal(signal);\n}\nexport function canMergeBlocks(chunk1, chunk2) {\n return (chunk2.minv.blockPosition - chunk1.maxv.blockPosition < 65000 &&\n chunk2.maxv.blockPosition - chunk1.minv.blockPosition < 5000000);\n}\nexport function makeOpts(obj = {}) {\n return 'aborted' in obj ? { signal: obj } : obj;\n}\nexport function optimizeChunks(chunks, lowest) {\n const mergedChunks = [];\n let lastChunk = null;\n if (chunks.length === 0) {\n return chunks;\n }\n chunks.sort((c0, c1) => {\n const dif = c0.minv.blockPosition - c1.minv.blockPosition;\n if (dif !== 0) {\n return dif;\n }\n else {\n return c0.minv.dataPosition - c1.minv.dataPosition;\n }\n });\n chunks.forEach(chunk => {\n if (!lowest || chunk.maxv.compareTo(lowest) > 0) {\n if (lastChunk === null) {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n else {\n if (canMergeBlocks(lastChunk, chunk)) {\n if (chunk.maxv.compareTo(lastChunk.maxv) > 0) {\n lastChunk.maxv = chunk.maxv;\n }\n }\n else {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n }\n }\n });\n return mergedChunks;\n}\n//# sourceMappingURL=util.js.map","import Long from 'long';\nimport { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport IndexFile from './indexFile';\nimport { longToNumber, optimizeChunks } from './util';\nconst BAI_MAGIC = 21578050; // BAI\\1\nfunction roundDown(n, multiple) {\n return n - (n % multiple);\n}\nfunction roundUp(n, multiple) {\n return n - (n % multiple) + multiple;\n}\nexport default class BAI extends IndexFile {\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(Array.prototype.slice.call(bytes, offset + 16, offset + 24), true));\n return { lineCount };\n }\n async lineCount(refId, opts = {}) {\n const prom = await this.parse(opts);\n const index = prom.indices[refId];\n if (!index) {\n return -1;\n }\n const ret = index.stats || {};\n return ret.lineCount === undefined ? -1 : ret.lineCount;\n }\n fetchBai(opts = {}) {\n if (!this.baiP) {\n this.baiP = this.filehandle.readFile(opts).catch(e => {\n this.baiP = undefined;\n throw e;\n });\n }\n return this.baiP;\n }\n // fetch and parse the index\n async _parse() {\n const data = { bai: true, maxBlockSize: 1 << 16 };\n const bytes = await this.fetchBai();\n // check BAI magic numbers\n if (bytes.readUInt32LE(0) !== BAI_MAGIC) {\n throw new Error('Not a BAI file');\n }\n data.refCount = bytes.readInt32LE(4);\n const depth = 5;\n const binLimit = ((1 << ((depth + 1) * 3)) - 1) / 7;\n // read the indexes for each reference sequence\n data.indices = new Array(data.refCount);\n let currOffset = 8;\n for (let i = 0; i < data.refCount; i += 1) {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n let stats;\n currOffset += 4;\n const binIndex = {};\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n currOffset += 4;\n if (bin === binLimit + 1) {\n currOffset += 4;\n stats = this.parsePseudoBin(bytes, currOffset);\n currOffset += 32;\n }\n else if (bin > binLimit + 1) {\n throw new Error('bai index contains too many bins, please use CSI');\n }\n else {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n this._findFirstData(data, u);\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n const linearCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n // as we're going through the linear index, figure out\n // the smallest virtual offset in the indexes, which\n // tells us where the BAM header ends\n const linearIndex = new Array(linearCount);\n for (let k = 0; k < linearCount; k += 1) {\n linearIndex[k] = fromBytes(bytes, currOffset);\n currOffset += 8;\n this._findFirstData(data, linearIndex[k]);\n }\n data.indices[i] = { binIndex, linearIndex, stats };\n }\n return data;\n }\n async indexCov(seqId, start, end, opts = {}) {\n const v = 16384;\n const range = start !== undefined;\n const indexData = await this.parse(opts);\n const seqIdx = indexData.indices[seqId];\n if (!seqIdx) {\n return [];\n }\n const { linearIndex = [], stats } = seqIdx;\n if (!linearIndex.length) {\n return [];\n }\n const e = end !== undefined ? roundUp(end, v) : (linearIndex.length - 1) * v;\n const s = start !== undefined ? roundDown(start, v) : 0;\n let depths;\n if (range) {\n depths = new Array((e - s) / v);\n }\n else {\n depths = new Array(linearIndex.length - 1);\n }\n const totalSize = linearIndex[linearIndex.length - 1].blockPosition;\n if (e > (linearIndex.length - 1) * v) {\n throw new Error('query outside of range of linear index');\n }\n let currentPos = linearIndex[s / v].blockPosition;\n for (let i = s / v, j = 0; i < e / v; i++, j++) {\n depths[j] = {\n score: linearIndex[i + 1].blockPosition - currentPos,\n start: i * v,\n end: i * v + v,\n };\n currentPos = linearIndex[i + 1].blockPosition;\n }\n return depths.map(d => {\n return { ...d, score: (d.score * stats.lineCount) / totalSize };\n });\n }\n /**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n * @returns {Array[number]}\n */\n reg2bins(beg, end) {\n end -= 1;\n return [\n [0, 0],\n [1 + (beg >> 26), 1 + (end >> 26)],\n [9 + (beg >> 23), 9 + (end >> 23)],\n [73 + (beg >> 20), 73 + (end >> 20)],\n [585 + (beg >> 17), 585 + (end >> 17)],\n [4681 + (beg >> 14), 4681 + (end >> 14)],\n ];\n }\n async blocksForRange(refId, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n // List of bin #s that overlap min, max\n const overlappingBins = this.reg2bins(min, max);\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n // Use the linear index to find minimum file position of chunks that could\n // contain alignments in the region\n const nintv = ba.linearIndex.length;\n let lowest = null;\n const minLin = Math.min(min >> 14, nintv - 1);\n const maxLin = Math.min(max >> 14, nintv - 1);\n for (let i = minLin; i <= maxLin; ++i) {\n const vp = ba.linearIndex[i];\n if (vp) {\n if (!lowest || vp.compareTo(lowest) < 0) {\n lowest = vp;\n }\n }\n }\n return optimizeChunks(chunks, lowest);\n }\n}\n//# sourceMappingURL=bai.js.map","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","export default {}","import { Buffer } from 'buffer';\nexport default class RemoteFile {\n async getBufferFromResponse(response) {\n if (typeof response.buffer === 'function') {\n return response.buffer();\n }\n else if (typeof response.arrayBuffer === 'function') {\n const resp = await response.arrayBuffer();\n return Buffer.from(resp);\n }\n else {\n throw new TypeError('invalid HTTP response object, has no buffer method, and no arrayBuffer method');\n }\n }\n constructor(source, opts = {}) {\n this.baseOverrides = {};\n this.url = source;\n const fetch = opts.fetch || globalThis.fetch.bind(globalThis);\n if (!fetch) {\n throw new TypeError(`no fetch function supplied, and none found in global environment`);\n }\n if (opts.overrides) {\n this.baseOverrides = opts.overrides;\n }\n this.fetchImplementation = fetch;\n }\n async fetch(input, init) {\n let response;\n try {\n response = await this.fetchImplementation(input, init);\n }\n catch (e) {\n if (`${e}`.includes('Failed to fetch')) {\n // refetch to to help work around a chrome bug (discussed in\n // generic-filehandle issue #72) in which the chrome cache returns a\n // CORS error for content in its cache. see also\n // https://github.com/GMOD/jbrowse-components/pull/1511\n console.warn(`generic-filehandle: refetching ${input} to attempt to work around chrome CORS header caching bug`);\n response = await this.fetchImplementation(input, {\n ...init,\n cache: 'reload',\n });\n }\n else {\n throw e;\n }\n }\n return response;\n }\n async read(buffer, offset = 0, length, position = 0, opts = {}) {\n const { headers = {}, signal, overrides = {} } = opts;\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n }\n else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n ...this.baseOverrides.headers,\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n };\n const response = await this.fetch(this.url, args);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n if ((response.status === 200 && position === 0) ||\n response.status === 206) {\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n return { bytesRead: bytesCopied, buffer };\n }\n if (response.status === 200) {\n throw new Error('${this.url} fetch returned status 200, expected 206');\n }\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n }\n async readFile(options = {}) {\n let encoding;\n let opts;\n if (typeof options === 'string') {\n encoding = options;\n opts = {};\n }\n else {\n encoding = options.encoding;\n opts = options;\n delete opts.encoding;\n }\n const { headers = {}, signal, overrides = {} } = opts;\n const args = {\n headers,\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n ...this.baseOverrides,\n ...overrides,\n };\n const response = await this.fetch(this.url, args);\n if (!response) {\n throw new Error('generic-filehandle failed to fetch');\n }\n if (response.status !== 200) {\n throw Object.assign(new Error(`HTTP ${response.status} fetching ${this.url}`), {\n status: response.status,\n });\n }\n if (encoding === 'utf8') {\n return response.text();\n }\n if (encoding) {\n throw new Error(`unsupported encoding: ${encoding}`);\n }\n return this.getBufferFromResponse(response);\n }\n async stat() {\n if (!this._stat) {\n const buf = Buffer.allocUnsafe(10);\n await this.read(buf, 0, 10, 0);\n if (!this._stat) {\n throw new Error(`unable to determine size of file at ${this.url}`);\n }\n }\n return this._stat;\n }\n async close() {\n return;\n }\n}\n//# sourceMappingURL=remoteFile.js.map","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","import { Buffer } from 'buffer';\n//@ts-ignore\nimport { Z_SYNC_FLUSH, Inflate } from 'pako';\n// browserify-zlib, which is the zlib shim used by default in webpacked code,\n// does not properly uncompress bgzf chunks that contain more than\n// one bgzf block, so export an unzip function that uses pako directly\n// if we are running in a browser.\nasync function unzip(inputData) {\n try {\n let strm;\n let pos = 0;\n let i = 0;\n const chunks = [];\n let totalSize = 0;\n let inflator;\n do {\n const remainingInput = inputData.subarray(pos);\n inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n pos += strm.next_in;\n chunks[i] = inflator.result;\n totalSize += chunks[i].length;\n i += 1;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n return Buffer.from(result);\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to pakounzip, except it does extra counting\n// to return the positions of compressed and decompressed\n// data offsets\nasync function unzipChunk(inputData) {\n try {\n let strm;\n let cpos = 0;\n let dpos = 0;\n const blocks = [];\n const cpositions = [];\n const dpositions = [];\n do {\n const remainingInput = inputData.slice(cpos);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = Buffer.from(inflator.result);\n blocks.push(buffer);\n cpositions.push(cpos);\n dpositions.push(dpos);\n cpos += strm.next_in;\n dpos += buffer.length;\n } while (strm.avail_in);\n const buffer = Buffer.concat(blocks);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to unzipChunk above but slices (0,minv.dataPosition) and\n// (maxv.dataPosition,end) off\nasync function unzipChunkSlice(inputData, chunk) {\n try {\n let strm;\n const { minv, maxv } = chunk;\n let cpos = minv.blockPosition;\n let dpos = minv.dataPosition;\n const chunks = [];\n const cpositions = [];\n const dpositions = [];\n let totalSize = 0;\n let i = 0;\n do {\n const remainingInput = inputData.subarray(cpos - minv.blockPosition);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = inflator.result;\n chunks.push(buffer);\n let len = buffer.length;\n cpositions.push(cpos);\n dpositions.push(dpos);\n if (chunks.length === 1 && minv.dataPosition) {\n // this is the first chunk, trim it\n chunks[0] = chunks[0].subarray(minv.dataPosition);\n len = chunks[0].length;\n }\n const origCpos = cpos;\n cpos += strm.next_in;\n dpos += len;\n if (origCpos >= maxv.blockPosition) {\n // this is the last chunk, trim it and stop decompressing\n // note if it is the same block is minv it subtracts that already\n // trimmed part of the slice length\n chunks[i] = chunks[i].subarray(0, maxv.blockPosition === minv.blockPosition\n ? maxv.dataPosition - minv.dataPosition + 1\n : maxv.dataPosition + 1);\n cpositions.push(cpos);\n dpositions.push(dpos);\n totalSize += chunks[i].length;\n break;\n }\n totalSize += chunks[i].length;\n i++;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n const buffer = Buffer.from(result);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\nfunction nodeUnzip() {\n throw new Error('nodeUnzip not implemented.');\n}\nexport { unzip, unzipChunk, unzipChunkSlice, unzip as pakoUnzip, nodeUnzip };\n//# sourceMappingURL=unzip-pako.js.map","import Long from 'long';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { longToNumber, abortBreakPoint, optimizeChunks } from './util';\nimport IndexFile from './indexFile';\nconst CSI1_MAGIC = 21582659; // CSI\\1\nconst CSI2_MAGIC = 38359875; // CSI\\2\nfunction lshift(num, bits) {\n return num * 2 ** bits;\n}\nfunction rshift(num, bits) {\n return Math.floor(num / 2 ** bits);\n}\nexport default class CSI extends IndexFile {\n constructor(args) {\n super(args);\n this.maxBinNumber = 0;\n this.depth = 0;\n this.minShift = 0;\n }\n async lineCount(refId) {\n const indexData = await this.parse();\n if (!indexData) {\n return -1;\n }\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n async indexCov() {\n return [];\n }\n parseAuxData(bytes, offset, auxLength) {\n if (auxLength < 30) {\n return {};\n }\n const data = {};\n data.formatFlags = bytes.readInt32LE(offset);\n data.coordinateType =\n data.formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n data.format = { 0: 'generic', 1: 'SAM', 2: 'VCF' }[data.formatFlags & 0xf];\n if (!data.format) {\n throw new Error(`invalid Tabix preset format flags ${data.formatFlags}`);\n }\n data.columnNumbers = {\n ref: bytes.readInt32LE(offset + 4),\n start: bytes.readInt32LE(offset + 8),\n end: bytes.readInt32LE(offset + 12),\n };\n data.metaValue = bytes.readInt32LE(offset + 16);\n data.metaChar = data.metaValue ? String.fromCharCode(data.metaValue) : '';\n data.skipLines = bytes.readInt32LE(offset + 20);\n const nameSectionLength = bytes.readInt32LE(offset + 24);\n Object.assign(data, this._parseNameBytes(bytes.subarray(offset + 28, offset + 28 + nameSectionLength)));\n return data;\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n // fetch and parse the index\n async _parse(opts) {\n const data = { csi: true, maxBlockSize: 1 << 16 };\n const buffer = (await this.filehandle.readFile(opts));\n const bytes = await unzip(buffer);\n // check TBI magic numbers\n if (bytes.readUInt32LE(0) === CSI1_MAGIC) {\n data.csiVersion = 1;\n }\n else if (bytes.readUInt32LE(0) === CSI2_MAGIC) {\n data.csiVersion = 2;\n }\n else {\n throw new Error('Not a CSI file');\n // TODO: do we need to support big-endian CSI files?\n }\n this.minShift = bytes.readInt32LE(4);\n this.depth = bytes.readInt32LE(8);\n this.maxBinNumber = ((1 << ((this.depth + 1) * 3)) - 1) / 7;\n const auxLength = bytes.readInt32LE(12);\n if (auxLength) {\n Object.assign(data, this.parseAuxData(bytes, 16, auxLength));\n }\n data.refCount = bytes.readInt32LE(16 + auxLength);\n // read the indexes for each reference sequence\n data.indices = new Array(data.refCount);\n let currOffset = 16 + auxLength + 4;\n for (let i = 0; i < data.refCount; i += 1) {\n await abortBreakPoint(opts.signal);\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats; // < provided by parsing a pseudo-bin, if present\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n if (bin > this.maxBinNumber) {\n // this is a fake bin that actually has stats information\n // about the reference sequence in it\n stats = this.parsePseudoBin(bytes, currOffset + 4);\n currOffset += 4 + 8 + 4 + 16 + 16;\n }\n else {\n const loffset = fromBytes(bytes, currOffset + 4);\n this._findFirstData(data, loffset);\n const chunkCount = bytes.readInt32LE(currOffset + 12);\n currOffset += 16;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n // this._findFirstData(data, u)\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n data.indices[i] = { binIndex, stats };\n }\n return data;\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(Array.prototype.slice.call(bytes, offset + 28, offset + 36), true));\n return { lineCount };\n }\n async blocksForRange(refId, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n const ba = indexData === null || indexData === void 0 ? void 0 : indexData.indices[refId];\n if (!ba) {\n return [];\n }\n const overlappingBins = this.reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n return optimizeChunks(chunks, new VirtualOffset(0, 0));\n }\n /**\n * calculate the list of bins that may overlap with region [beg,end)\n * (zero-based half-open)\n */\n reg2bins(beg, end) {\n beg -= 1; // < convert to 1-based closed\n if (beg < 1) {\n beg = 1;\n }\n if (end > 2 ** 50) {\n end = 2 ** 34;\n } // 17 GiB ought to be enough for anybody\n end -= 1;\n let l = 0;\n let t = 0;\n let s = this.minShift + this.depth * 3;\n const bins = [];\n for (; l <= this.depth; s -= 3, t += lshift(1, l * 3), l += 1) {\n const b = t + rshift(beg, s);\n const e = t + rshift(end, s);\n if (e - b + bins.length > this.maxBinNumber) {\n throw new Error(`query ${beg}-${end} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);\n }\n bins.push([b, e]);\n }\n return bins;\n }\n}\n//# sourceMappingURL=csi.js.map","var Buffer = require('buffer').Buffer;\n\nvar CRC_TABLE = [\n 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,\n 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,\n 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,\n 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,\n 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,\n 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,\n 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,\n 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,\n 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,\n 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,\n 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,\n 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,\n 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,\n 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,\n 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,\n 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,\n 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,\n 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,\n 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,\n 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,\n 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,\n 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,\n 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,\n 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,\n 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,\n 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,\n 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,\n 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,\n 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,\n 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,\n 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,\n 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,\n 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,\n 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,\n 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,\n 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,\n 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,\n 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,\n 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,\n 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,\n 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,\n 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,\n 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,\n 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,\n 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,\n 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,\n 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,\n 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,\n 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,\n 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,\n 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,\n 0x2d02ef8d\n];\n\nif (typeof Int32Array !== 'undefined') {\n CRC_TABLE = new Int32Array(CRC_TABLE);\n}\n\nfunction ensureBuffer(input) {\n if (Buffer.isBuffer(input)) {\n return input;\n }\n\n var hasNewBufferAPI =\n typeof Buffer.alloc === \"function\" &&\n typeof Buffer.from === \"function\";\n\n if (typeof input === \"number\") {\n return hasNewBufferAPI ? Buffer.alloc(input) : new Buffer(input);\n }\n else if (typeof input === \"string\") {\n return hasNewBufferAPI ? Buffer.from(input) : new Buffer(input);\n }\n else {\n throw new Error(\"input must be buffer, number, or string, received \" +\n typeof input);\n }\n}\n\nfunction bufferizeInt(num) {\n var tmp = ensureBuffer(4);\n tmp.writeInt32BE(num, 0);\n return tmp;\n}\n\nfunction _crc32(buf, previous) {\n buf = ensureBuffer(buf);\n if (Buffer.isBuffer(previous)) {\n previous = previous.readUInt32BE(0);\n }\n var crc = ~~previous ^ -1;\n for (var n = 0; n < buf.length; n++) {\n crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8);\n }\n return (crc ^ -1);\n}\n\nfunction crc32() {\n return bufferizeInt(_crc32.apply(null, arguments));\n}\ncrc32.signed = function () {\n return _crc32.apply(null, arguments);\n};\ncrc32.unsigned = function () {\n return _crc32.apply(null, arguments) >>> 0;\n};\n\nmodule.exports = crc32;\n","'use strict'\n\nvar has = function (obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop) }\nvar isEnumerable = function (obj, prop) {\n return Object.prototype.propertyIsEnumerable.call(obj, prop)\n}\n\nfunction entries (obj) {\n if (obj == null) {\n throw new TypeError('Cannot convert undefined or null to object')\n }\n var pairs = []\n for (var key in obj) {\n if (has(obj, key) && isEnumerable(obj, key)) {\n pairs.push([key, obj[key]])\n }\n }\n return pairs\n}\n\nmodule.exports = entries\n","module.exports = typeof Object.entries === 'function' ? Object.entries : require('./entries')\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get.apply(this, arguments);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'reason', {\n value: undefined,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort(reason) {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n var signalReason = reason;\n\n if (signalReason === undefined) {\n if (typeof document === 'undefined') {\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n } else {\n try {\n signalReason = new DOMException('signal is aborted without reason');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n }\n }\n }\n\n this.signal.reason = signalReason;\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","\"use strict\";\n/* eslint-disable */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbortSignal = exports.AbortController = void 0;\nconst cjs_ponyfill_1 = require(\"abortcontroller-polyfill/dist/cjs-ponyfill\");\nvar getGlobal = function () {\n // the only reliable means to get the global object is\n // `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n};\n//@ts-ignore\nlet AbortController = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortController : getGlobal().AbortController;\nexports.AbortController = AbortController;\n//@ts-ignore\nlet AbortSignal = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal;\nexports.AbortSignal = AbortSignal;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nclass NullSignal {\n}\n/**\n * aggregates a number of abort signals, will only fire the aggregated\n * abort if all of the input signals have been aborted\n */\nclass AggregateAbortController {\n constructor() {\n this.signals = new Set();\n this.abortController = new abortcontroller_ponyfill_1.AbortController();\n }\n /**\n * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy,\n * will be treated as a null-signal, and this abortcontroller will no\n * longer be abortable.\n */\n //@ts-ignore\n addSignal(signal = new NullSignal()) {\n if (this.signal.aborted) {\n throw new Error('cannot add a signal, already aborted!');\n }\n // note that a NullSignal will never fire, so if we\n // have one this thing will never actually abort\n this.signals.add(signal);\n if (signal.aborted) {\n // handle the abort immediately if it is already aborted\n // for some reason\n this.handleAborted(signal);\n }\n else if (typeof signal.addEventListener === 'function') {\n signal.addEventListener('abort', () => {\n this.handleAborted(signal);\n });\n }\n }\n handleAborted(signal) {\n this.signals.delete(signal);\n if (this.signals.size === 0) {\n this.abortController.abort();\n }\n }\n get signal() {\n return this.abortController.signal;\n }\n abort() {\n this.abortController.abort();\n }\n}\nexports.default = AggregateAbortController;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass AggregateStatusReporter {\n constructor() {\n this.callbacks = new Set();\n }\n addCallback(callback = () => { }) {\n this.callbacks.add(callback);\n callback(this.currentMessage);\n }\n callback(message) {\n this.currentMessage = message;\n this.callbacks.forEach(elt => {\n elt(message);\n });\n }\n}\nexports.default = AggregateStatusReporter;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nconst AggregateAbortController_1 = __importDefault(require(\"./AggregateAbortController\"));\nconst AggregateStatusReporter_1 = __importDefault(require(\"./AggregateStatusReporter\"));\nclass AbortablePromiseCache {\n constructor({ fill, cache, }) {\n if (typeof fill !== 'function') {\n throw new TypeError('must pass a fill function');\n }\n if (typeof cache !== 'object') {\n throw new TypeError('must pass a cache object');\n }\n if (typeof cache.get !== 'function' ||\n typeof cache.set !== 'function' ||\n typeof cache.delete !== 'function') {\n throw new TypeError('cache must implement get(key), set(key, val), and and delete(key)');\n }\n this.cache = cache;\n this.fillCallback = fill;\n }\n static isAbortException(exception) {\n return (\n // DOMException\n exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n //@ts-ignore\n exception.code === 'ERR_ABORTED' ||\n // stringified DOMException\n exception.message === 'AbortError: aborted' ||\n // stringified standard-ish exception\n exception.message === 'Error: aborted');\n }\n evict(key, entry) {\n if (this.cache.get(key) === entry) {\n this.cache.delete(key);\n }\n }\n fill(key, data, signal, statusCallback) {\n const aborter = new AggregateAbortController_1.default();\n const statusReporter = new AggregateStatusReporter_1.default();\n statusReporter.addCallback(statusCallback);\n const newEntry = {\n aborter: aborter,\n promise: this.fillCallback(data, aborter.signal, (message) => {\n statusReporter.callback(message);\n }),\n settled: false,\n statusReporter,\n get aborted() {\n return this.aborter.signal.aborted;\n },\n };\n newEntry.aborter.addSignal(signal);\n // remove the fill from the cache when its abortcontroller fires, if still in there\n newEntry.aborter.signal.addEventListener('abort', () => {\n if (!newEntry.settled) {\n this.evict(key, newEntry);\n }\n });\n // chain off the cached promise to record when it settles\n newEntry.promise\n .then(() => {\n newEntry.settled = true;\n }, () => {\n newEntry.settled = true;\n // if the fill throws an error (including abort) and is still in the cache, remove it\n this.evict(key, newEntry);\n })\n .catch(e => {\n // this will only be reached if there is some kind of\n // bad bug in this library\n console.error(e);\n throw e;\n });\n this.cache.set(key, newEntry);\n }\n static checkSinglePromise(promise, signal) {\n // check just this signal for having been aborted, and abort the\n // promise if it was, regardless of what happened with the cached\n // response\n function checkForSingleAbort() {\n if (signal && signal.aborted) {\n throw Object.assign(new Error('aborted'), { code: 'ERR_ABORTED' });\n }\n }\n return promise.then(result => {\n checkForSingleAbort();\n return result;\n }, error => {\n checkForSingleAbort();\n throw error;\n });\n }\n has(key) {\n return this.cache.has(key);\n }\n /**\n * Callback for getting status of the pending async\n *\n * @callback statusCallback\n * @param {any} status, current status string or message object\n */\n /**\n * @param {any} key cache key to use for this request\n * @param {any} data data passed as the first argument to the fill callback\n * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request\n * @param {statusCallback} a callback to get the current status of a pending async operation\n */\n get(key, data, signal, statusCallback) {\n if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) {\n throw new TypeError('second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?');\n }\n const cacheEntry = this.cache.get(key);\n if (cacheEntry) {\n if (cacheEntry.aborted && !cacheEntry.settled) {\n // if it's aborted but has not realized it yet, evict it and redispatch\n this.evict(key, cacheEntry);\n return this.get(key, data, signal, statusCallback);\n }\n if (cacheEntry.settled) {\n // too late to abort, just return it\n return cacheEntry.promise;\n }\n // request is in-flight, add this signal to its list of signals,\n // or if there is no signal, the aborter will become non-abortable\n cacheEntry.aborter.addSignal(signal);\n cacheEntry.statusReporter.addCallback(statusCallback);\n return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal);\n }\n // if we got here, it is not in the cache. fill.\n this.fill(key, data, signal, statusCallback);\n return AbortablePromiseCache.checkSinglePromise(\n //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-\n //eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.cache.get(key).promise, signal);\n }\n /**\n * delete the given entry from the cache. if it exists and its fill request has\n * not yet settled, the fill will be signaled to abort.\n *\n * @param {any} key\n */\n delete(key) {\n const cachedEntry = this.cache.get(key);\n if (cachedEntry) {\n if (!cachedEntry.settled) {\n cachedEntry.aborter.abort();\n }\n this.cache.delete(key);\n }\n }\n /**\n * Clear all requests from the cache. Aborts any that have not settled.\n * @returns {number} count of entries deleted\n */\n clear() {\n // iterate without needing regenerator-runtime\n const keyIter = this.cache.keys();\n let deleteCount = 0;\n for (let result = keyIter.next(); !result.done; result = keyIter.next()) {\n this.delete(result.value);\n deleteCount += 1;\n }\n return deleteCount;\n }\n}\nexports.default = AbortablePromiseCache;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst AbortablePromiseCache_1 = __importDefault(require(\"./AbortablePromiseCache\"));\nexports.default = AbortablePromiseCache_1.default;\n","'use strict';\n\nclass QuickLRU {\n\tconstructor(options = {}) {\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst value = this.oldCache.get(key);\n\t\t\tthis._set(key, value);\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tset(key, value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, value);\n\t\t} else {\n\t\t\tthis._set(key, value);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\thas(key) {\n\t\treturn this.cache.has(key) || this.oldCache.has(key);\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this.oldCache.get(key);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tyield item;\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget size() {\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn this._size + oldCacheSize;\n\t}\n}\n\nmodule.exports = QuickLRU;\n","export default {\n // the read is paired in sequencing, no matter whether it is mapped in a pair\n BAM_FPAIRED: 1,\n // the read is mapped in a proper pair\n BAM_FPROPER_PAIR: 2,\n // the read itself is unmapped; conflictive with BAM_FPROPER_PAIR\n BAM_FUNMAP: 4,\n // the mate is unmapped\n BAM_FMUNMAP: 8,\n // the read is mapped to the reverse strand\n BAM_FREVERSE: 16,\n // the mate is mapped to the reverse strand\n BAM_FMREVERSE: 32,\n // this is read1\n BAM_FREAD1: 64,\n // this is read2\n BAM_FREAD2: 128,\n // not primary alignment\n BAM_FSECONDARY: 256,\n // QC failure\n BAM_FQCFAIL: 512,\n // optical or PCR duplicate\n BAM_FDUP: 1024,\n // supplementary alignment\n BAM_FSUPPLEMENTARY: 2048,\n};\n//# sourceMappingURL=constants.js.map","/* eslint-disable @typescript-eslint/no-empty-function */\nimport Constants from './constants';\nconst SEQRET_DECODER = '=ACMGRSVTWYHKDBN'.split('');\nconst CIGAR_DECODER = 'MIDNSHP=X???????'.split('');\n/**\n * Class of each BAM record returned by this API.\n */\nexport default class BamRecord {\n constructor(args) {\n this.data = {};\n this._tagList = [];\n this._allTagsParsed = false;\n const { bytes, fileOffset } = args;\n const { byteArray, start } = bytes;\n this.data = {};\n this.bytes = bytes;\n this._id = fileOffset;\n this._refID = byteArray.readInt32LE(start + 4);\n this.data.start = byteArray.readInt32LE(start + 8);\n this.flags = (byteArray.readInt32LE(start + 16) & 0xffff0000) >> 16;\n }\n get(field) {\n //@ts-ignore\n if (this[field]) {\n //@ts-ignore\n if (this.data[field]) {\n return this.data[field];\n }\n //@ts-ignore\n this.data[field] = this[field]();\n return this.data[field];\n }\n return this._get(field.toLowerCase());\n }\n end() {\n return this.get('start') + this.get('length_on_ref');\n }\n seq_id() {\n return this._refID;\n }\n // same as get(), except requires lower-case arguments. used\n // internally to save lots of calls to field.toLowerCase()\n _get(field) {\n if (field in this.data) {\n return this.data[field];\n }\n this.data[field] = this._parseTag(field);\n return this.data[field];\n }\n _tags() {\n this._parseAllTags();\n let tags = ['seq'];\n if (!this.isSegmentUnmapped()) {\n tags.push('start', 'end', 'strand', 'score', 'qual', 'MQ', 'CIGAR', 'length_on_ref', 'template_length');\n }\n if (this.isPaired()) {\n tags.push('next_segment_position', 'pair_orientation');\n }\n tags = tags.concat(this._tagList || []);\n Object.keys(this.data).forEach(k => {\n if (k[0] !== '_' && k !== 'next_seq_id') {\n tags.push(k);\n }\n });\n const seen = {};\n return tags.filter(t => {\n if ((t in this.data && this.data[t] === undefined) ||\n t === 'CG' ||\n t === 'cg') {\n return false;\n }\n const lt = t.toLowerCase();\n const s = seen[lt];\n seen[lt] = true;\n return !s;\n });\n }\n parent() {\n return undefined;\n }\n children() {\n return this.get('subfeatures');\n }\n id() {\n return this._id;\n }\n // special parsers\n /**\n * Mapping quality score.\n */\n mq() {\n const mq = (this.get('_bin_mq_nl') & 0xff00) >> 8;\n return mq === 255 ? undefined : mq;\n }\n score() {\n return this.get('mq');\n }\n qual() {\n var _a;\n return (_a = this.qualRaw()) === null || _a === void 0 ? void 0 : _a.join(' ');\n }\n qualRaw() {\n if (this.isSegmentUnmapped()) {\n return undefined;\n }\n const { start, byteArray } = this.bytes;\n const p = start +\n 36 +\n this.get('_l_read_name') +\n this.get('_n_cigar_op') * 4 +\n this.get('_seq_bytes');\n const lseq = this.get('seq_length');\n return byteArray.subarray(p, p + lseq);\n }\n strand() {\n return this.isReverseComplemented() ? -1 : 1;\n }\n multi_segment_next_segment_strand() {\n if (this.isMateUnmapped()) {\n return undefined;\n }\n return this.isMateReverseComplemented() ? -1 : 1;\n }\n name() {\n return this.get('_read_name');\n }\n _read_name() {\n const nl = this.get('_l_read_name');\n const { byteArray, start } = this.bytes;\n return byteArray.toString('ascii', start + 36, start + 36 + nl - 1);\n }\n /**\n * Get the value of a tag, parsing the tags as far as necessary.\n * Only called if we have not already parsed that field.\n */\n _parseTag(tagName) {\n // if all of the tags have been parsed and we're still being\n // called, we already know that we have no such tag, because\n // it would already have been cached.\n if (this._allTagsParsed) {\n return undefined;\n }\n const { byteArray, start } = this.bytes;\n let p = this._tagOffset ||\n start +\n 36 +\n this.get('_l_read_name') +\n this.get('_n_cigar_op') * 4 +\n this.get('_seq_bytes') +\n this.get('seq_length');\n const blockEnd = this.bytes.end;\n let lcTag;\n while (p < blockEnd && lcTag !== tagName) {\n const tag = String.fromCharCode(byteArray[p], byteArray[p + 1]);\n lcTag = tag.toLowerCase();\n const type = String.fromCharCode(byteArray[p + 2]);\n p += 3;\n let value;\n switch (type) {\n case 'A':\n value = String.fromCharCode(byteArray[p]);\n p += 1;\n break;\n case 'i':\n value = byteArray.readInt32LE(p);\n p += 4;\n break;\n case 'I':\n value = byteArray.readUInt32LE(p);\n p += 4;\n break;\n case 'c':\n value = byteArray.readInt8(p);\n p += 1;\n break;\n case 'C':\n value = byteArray.readUInt8(p);\n p += 1;\n break;\n case 's':\n value = byteArray.readInt16LE(p);\n p += 2;\n break;\n case 'S':\n value = byteArray.readUInt16LE(p);\n p += 2;\n break;\n case 'f':\n value = byteArray.readFloatLE(p);\n p += 4;\n break;\n case 'Z':\n case 'H':\n value = '';\n while (p <= blockEnd) {\n const cc = byteArray[p++];\n if (cc === 0) {\n break;\n }\n else {\n value += String.fromCharCode(cc);\n }\n }\n break;\n case 'B': {\n value = '';\n const cc = byteArray[p++];\n const Btype = String.fromCharCode(cc);\n const limit = byteArray.readInt32LE(p);\n p += 4;\n if (Btype === 'i') {\n if (tag === 'CG') {\n for (let k = 0; k < limit; k++) {\n const cigop = byteArray.readInt32LE(p);\n const lop = cigop >> 4;\n const op = CIGAR_DECODER[cigop & 0xf];\n value += lop + op;\n p += 4;\n }\n }\n else {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readInt32LE(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 4;\n }\n }\n }\n if (Btype === 'I') {\n if (tag === 'CG') {\n for (let k = 0; k < limit; k++) {\n const cigop = byteArray.readUInt32LE(p);\n const lop = cigop >> 4;\n const op = CIGAR_DECODER[cigop & 0xf];\n value += lop + op;\n p += 4;\n }\n }\n else {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readUInt32LE(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 4;\n }\n }\n }\n if (Btype === 's') {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readInt16LE(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 2;\n }\n }\n if (Btype === 'S') {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readUInt16LE(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 2;\n }\n }\n if (Btype === 'c') {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readInt8(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 1;\n }\n }\n if (Btype === 'C') {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readUInt8(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 1;\n }\n }\n if (Btype === 'f') {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readFloatLE(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 4;\n }\n }\n break;\n }\n default:\n console.warn(`Unknown BAM tag type '${type}', tags may be incomplete`);\n value = undefined;\n p = blockEnd; // stop parsing tags\n }\n this._tagOffset = p;\n this._tagList.push(tag);\n if (lcTag === tagName) {\n return value;\n }\n this.data[lcTag] = value;\n }\n this._allTagsParsed = true;\n return undefined;\n }\n _parseAllTags() {\n this._parseTag('');\n }\n _parseCigar(cigar) {\n return (\n //@ts-ignore\n cigar\n .match(/\\d+\\D/g)\n //@ts-ignore\n .map(op => [op.match(/\\D/)[0].toUpperCase(), parseInt(op, 10)]));\n }\n /**\n * @returns {boolean} true if the read is paired, regardless of whether both segments are mapped\n */\n isPaired() {\n return !!(this.flags & Constants.BAM_FPAIRED);\n }\n /** @returns {boolean} true if the read is paired, and both segments are mapped */\n isProperlyPaired() {\n return !!(this.flags & Constants.BAM_FPROPER_PAIR);\n }\n /** @returns {boolean} true if the read itself is unmapped; conflictive with isProperlyPaired */\n isSegmentUnmapped() {\n return !!(this.flags & Constants.BAM_FUNMAP);\n }\n /** @returns {boolean} true if the read itself is unmapped; conflictive with isProperlyPaired */\n isMateUnmapped() {\n return !!(this.flags & Constants.BAM_FMUNMAP);\n }\n /** @returns {boolean} true if the read is mapped to the reverse strand */\n isReverseComplemented() {\n return !!(this.flags & Constants.BAM_FREVERSE);\n }\n /** @returns {boolean} true if the mate is mapped to the reverse strand */\n isMateReverseComplemented() {\n return !!(this.flags & Constants.BAM_FMREVERSE);\n }\n /** @returns {boolean} true if this is read number 1 in a pair */\n isRead1() {\n return !!(this.flags & Constants.BAM_FREAD1);\n }\n /** @returns {boolean} true if this is read number 2 in a pair */\n isRead2() {\n return !!(this.flags & Constants.BAM_FREAD2);\n }\n /** @returns {boolean} true if this is a secondary alignment */\n isSecondary() {\n return !!(this.flags & Constants.BAM_FSECONDARY);\n }\n /** @returns {boolean} true if this read has failed QC checks */\n isFailedQc() {\n return !!(this.flags & Constants.BAM_FQCFAIL);\n }\n /** @returns {boolean} true if the read is an optical or PCR duplicate */\n isDuplicate() {\n return !!(this.flags & Constants.BAM_FDUP);\n }\n /** @returns {boolean} true if this is a supplementary alignment */\n isSupplementary() {\n return !!(this.flags & Constants.BAM_FSUPPLEMENTARY);\n }\n cigar() {\n if (this.isSegmentUnmapped()) {\n return undefined;\n }\n const { byteArray, start } = this.bytes;\n const numCigarOps = this.get('_n_cigar_op');\n let p = start + 36 + this.get('_l_read_name');\n const seqLen = this.get('seq_length');\n let cigar = '';\n let lref = 0;\n // check for CG tag by inspecting whether the CIGAR field\n // contains a clip that consumes entire seqLen\n let cigop = byteArray.readInt32LE(p);\n let lop = cigop >> 4;\n let op = CIGAR_DECODER[cigop & 0xf];\n if (op === 'S' && lop === seqLen) {\n // if there is a CG the second CIGAR field will\n // be a N tag the represents the length on ref\n p += 4;\n cigop = byteArray.readInt32LE(p);\n lop = cigop >> 4;\n op = CIGAR_DECODER[cigop & 0xf];\n if (op !== 'N') {\n console.warn('CG tag with no N tag');\n }\n this.data.length_on_ref = lop;\n return this.get('CG');\n }\n else {\n for (let c = 0; c < numCigarOps; ++c) {\n cigop = byteArray.readInt32LE(p);\n lop = cigop >> 4;\n op = CIGAR_DECODER[cigop & 0xf];\n cigar += lop + op;\n // soft clip, hard clip, and insertion don't count toward\n // the length on the reference\n if (op !== 'H' && op !== 'S' && op !== 'I') {\n lref += lop;\n }\n p += 4;\n }\n this.data.length_on_ref = lref;\n return cigar;\n }\n }\n _flags() { }\n length_on_ref() {\n if (this.data.length_on_ref) {\n return this.data.length_on_ref;\n }\n else {\n this.get('cigar'); // the length_on_ref is set as a side effect\n return this.data.length_on_ref;\n }\n }\n _n_cigar_op() {\n return this.get('_flag_nc') & 0xffff;\n }\n _l_read_name() {\n return this.get('_bin_mq_nl') & 0xff;\n }\n /**\n * number of bytes in the sequence field\n */\n _seq_bytes() {\n return (this.get('seq_length') + 1) >> 1;\n }\n getReadBases() {\n return this.seq();\n }\n seq() {\n const { byteArray, start } = this.bytes;\n const p = start + 36 + this.get('_l_read_name') + this.get('_n_cigar_op') * 4;\n const seqBytes = this.get('_seq_bytes');\n const len = this.get('seq_length');\n let buf = '';\n let i = 0;\n for (let j = 0; j < seqBytes; ++j) {\n const sb = byteArray[p + j];\n buf += SEQRET_DECODER[(sb & 0xf0) >> 4];\n i++;\n if (i < len) {\n buf += SEQRET_DECODER[sb & 0x0f];\n i++;\n }\n }\n return buf;\n }\n // adapted from igv.js\n getPairOrientation() {\n if (!this.isSegmentUnmapped() &&\n !this.isMateUnmapped() &&\n this._refID === this._next_refid()) {\n const s1 = this.isReverseComplemented() ? 'R' : 'F';\n const s2 = this.isMateReverseComplemented() ? 'R' : 'F';\n let o1 = ' ';\n let o2 = ' ';\n if (this.isRead1()) {\n o1 = '1';\n o2 = '2';\n }\n else if (this.isRead2()) {\n o1 = '2';\n o2 = '1';\n }\n const tmp = [];\n const isize = this.template_length();\n if (isize > 0) {\n tmp[0] = s1;\n tmp[1] = o1;\n tmp[2] = s2;\n tmp[3] = o2;\n }\n else {\n tmp[2] = s1;\n tmp[3] = o1;\n tmp[0] = s2;\n tmp[1] = o2;\n }\n return tmp.join('');\n }\n return null;\n }\n _bin_mq_nl() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 12);\n }\n _flag_nc() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 16);\n }\n seq_length() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 20);\n }\n _next_refid() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 24);\n }\n _next_pos() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 28);\n }\n template_length() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 32);\n }\n toJSON() {\n const data = {};\n Object.keys(this).forEach(k => {\n if (k.charAt(0) === '_' || k === 'bytes') {\n return;\n }\n //@ts-ignore\n data[k] = this[k];\n });\n return data;\n }\n}\n//# sourceMappingURL=record.js.map","export function parseHeaderText(text) {\n const lines = text.split(/\\r?\\n/);\n const data = [];\n lines.forEach(line => {\n const [tag, ...fields] = line.split(/\\t/);\n const parsedFields = fields.map(f => {\n const [fieldTag, value] = f.split(':', 2);\n return { tag: fieldTag, value };\n });\n if (tag) {\n data.push({ tag: tag.substr(1), data: parsedFields });\n }\n });\n return data;\n}\n//# sourceMappingURL=sam.js.map","import crc32 from 'buffer-crc32';\nimport { unzip, unzipChunkSlice } from '@gmod/bgzf-filehandle';\nimport entries from 'object.entries-ponyfill';\nimport { LocalFile, RemoteFile } from 'generic-filehandle';\nimport AbortablePromiseCache from 'abortable-promise-cache';\nimport QuickLRU from 'quick-lru';\n//locals\nimport BAI from './bai';\nimport CSI from './csi';\nimport BAMFeature from './record';\nimport { parseHeaderText } from './sam';\nimport { abortBreakPoint, checkAbortSignal, timeout, makeOpts, } from './util';\nexport const BAM_MAGIC = 21840194;\nconst blockLen = 1 << 16;\nfunction flat(arr) {\n return [].concat(...arr);\n}\nasync function gen2array(gen) {\n const out = [];\n for await (const x of gen) {\n out.push(x);\n }\n return out;\n}\nexport default class BamFile {\n /**\n * @param {object} args\n * @param {string} [args.bamPath]\n * @param {FileHandle} [args.bamFilehandle]\n * @param {string} [args.baiPath]\n * @param {FileHandle} [args.baiFilehandle]\n */\n constructor({ bamFilehandle, bamPath, bamUrl, baiPath, baiFilehandle, baiUrl, csiPath, csiFilehandle, csiUrl, fetchSizeLimit, chunkSizeLimit, yieldThreadTime = 100, renameRefSeqs = n => n, }) {\n this.featureCache = new AbortablePromiseCache({\n //@ts-ignore\n cache: new QuickLRU({\n maxSize: 50,\n }),\n //@ts-ignore\n fill: async ({ chunk, opts }, signal) => {\n const { data, cpositions, dpositions } = await this._readChunk({\n chunk,\n opts: { ...opts, signal },\n });\n const feats = await this.readBamFeatures(data, cpositions, dpositions, chunk);\n return feats;\n },\n });\n this.renameRefSeq = renameRefSeqs;\n if (bamFilehandle) {\n this.bam = bamFilehandle;\n }\n else if (bamPath) {\n this.bam = new LocalFile(bamPath);\n }\n else if (bamUrl) {\n this.bam = new RemoteFile(bamUrl);\n }\n else {\n throw new Error('unable to initialize bam');\n }\n if (csiFilehandle) {\n this.index = new CSI({ filehandle: csiFilehandle });\n }\n else if (csiPath) {\n this.index = new CSI({ filehandle: new LocalFile(csiPath) });\n }\n else if (csiUrl) {\n this.index = new CSI({ filehandle: new RemoteFile(csiUrl) });\n }\n else if (baiFilehandle) {\n this.index = new BAI({ filehandle: baiFilehandle });\n }\n else if (baiPath) {\n this.index = new BAI({ filehandle: new LocalFile(baiPath) });\n }\n else if (baiUrl) {\n this.index = new BAI({ filehandle: new RemoteFile(baiUrl) });\n }\n else if (bamPath) {\n this.index = new BAI({ filehandle: new LocalFile(`${bamPath}.bai`) });\n }\n else if (bamUrl) {\n this.index = new BAI({ filehandle: new RemoteFile(`${bamUrl}.bai`) });\n }\n else {\n throw new Error('unable to infer index format');\n }\n this.fetchSizeLimit = fetchSizeLimit || 500000000; // 500MB\n this.chunkSizeLimit = chunkSizeLimit || 300000000; // 300MB\n this.yieldThreadTime = yieldThreadTime;\n }\n async getHeader(origOpts = {}) {\n const opts = makeOpts(origOpts);\n const indexData = await this.index.parse(opts);\n const ret = indexData.firstDataLine\n ? indexData.firstDataLine.blockPosition + 65535\n : undefined;\n let buffer;\n if (ret) {\n const res = await this.bam.read(Buffer.alloc(ret + blockLen), 0, ret + blockLen, 0, opts);\n const { bytesRead } = res;\n ({ buffer } = res);\n if (!bytesRead) {\n throw new Error('Error reading header');\n }\n if (bytesRead < ret) {\n buffer = buffer.subarray(0, bytesRead);\n }\n else {\n buffer = buffer.subarray(0, ret);\n }\n }\n else {\n buffer = (await this.bam.readFile(opts));\n }\n const uncba = await unzip(buffer);\n if (uncba.readInt32LE(0) !== BAM_MAGIC) {\n throw new Error('Not a BAM file');\n }\n const headLen = uncba.readInt32LE(4);\n this.header = uncba.toString('utf8', 8, 8 + headLen);\n const { chrToIndex, indexToChr } = await this._readRefSeqs(headLen + 8, 65535, opts);\n this.chrToIndex = chrToIndex;\n this.indexToChr = indexToChr;\n return parseHeaderText(this.header);\n }\n async getHeaderText(opts = {}) {\n await this.getHeader(opts);\n return this.header;\n }\n // the full length of the refseq block is not given in advance so this grabs\n // a chunk and doubles it if all refseqs haven't been processed\n async _readRefSeqs(start, refSeqBytes, opts = {}) {\n if (start > refSeqBytes) {\n return this._readRefSeqs(start, refSeqBytes * 2, opts);\n }\n const size = refSeqBytes + blockLen;\n const { bytesRead, buffer } = await this.bam.read(Buffer.alloc(size), 0, refSeqBytes, 0, opts);\n if (!bytesRead) {\n throw new Error('Error reading refseqs from header');\n }\n const uncba = await unzip(buffer.subarray(0, Math.min(bytesRead, refSeqBytes)));\n const nRef = uncba.readInt32LE(start);\n let p = start + 4;\n const chrToIndex = {};\n const indexToChr = [];\n for (let i = 0; i < nRef; i += 1) {\n const lName = uncba.readInt32LE(p);\n const refName = this.renameRefSeq(uncba.toString('utf8', p + 4, p + 4 + lName - 1));\n const lRef = uncba.readInt32LE(p + lName + 4);\n chrToIndex[refName] = i;\n indexToChr.push({ refName, length: lRef });\n p = p + 8 + lName;\n if (p > uncba.length) {\n console.warn(`BAM header is very big. Re-fetching ${refSeqBytes} bytes.`);\n return this._readRefSeqs(start, refSeqBytes * 2, opts);\n }\n }\n return { chrToIndex, indexToChr };\n }\n async getRecordsForRange(chr, min, max, opts = {\n viewAsPairs: false,\n pairAcrossChr: false,\n maxInsertSize: 200000,\n }) {\n return flat(await gen2array(this.streamRecordsForRange(chr, min, max, opts)));\n }\n async *streamRecordsForRange(chr, min, max, opts = {}) {\n const { signal } = opts;\n const chrId = this.chrToIndex && this.chrToIndex[chr];\n let chunks;\n if (!(chrId >= 0)) {\n chunks = [];\n }\n else {\n chunks = await this.index.blocksForRange(chrId, min - 1, max, opts);\n if (!chunks) {\n throw new Error('Error in index fetch');\n }\n }\n for (let i = 0; i < chunks.length; i += 1) {\n await abortBreakPoint(signal);\n const size = chunks[i].fetchedSize();\n if (size > this.chunkSizeLimit) {\n throw new Error(`Too many BAM features. BAM chunk size ${size} bytes exceeds chunkSizeLimit of ${this.chunkSizeLimit}`);\n }\n }\n const totalSize = chunks\n .map(s => s.fetchedSize())\n .reduce((a, b) => a + b, 0);\n if (totalSize > this.fetchSizeLimit) {\n throw new Error(`data size of ${totalSize.toLocaleString()} bytes exceeded fetch size limit of ${this.fetchSizeLimit.toLocaleString()} bytes`);\n }\n yield* this._fetchChunkFeatures(chunks, chrId, min, max, opts);\n }\n async *_fetchChunkFeatures(chunks, chrId, min, max, opts) {\n const { viewAsPairs = false } = opts;\n const feats = [];\n let done = false;\n for (let i = 0; i < chunks.length; i++) {\n const c = chunks[i];\n const records = (await this.featureCache.get(c.toString(), {\n chunk: c,\n opts,\n }, opts.signal));\n const recs = [];\n for (let i = 0; i < records.length; i += 1) {\n const feature = records[i];\n if (feature.seq_id() === chrId) {\n if (feature.get('start') >= max) {\n // past end of range, can stop iterating\n done = true;\n break;\n }\n else if (feature.get('end') >= min) {\n // must be in range\n recs.push(feature);\n }\n }\n }\n feats.push(recs);\n yield recs;\n if (done) {\n break;\n }\n }\n checkAbortSignal(opts.signal);\n if (viewAsPairs) {\n yield this.fetchPairs(chrId, feats, opts);\n }\n }\n async fetchPairs(chrId, feats, opts) {\n const { pairAcrossChr = false, maxInsertSize = 200000 } = opts;\n const unmatedPairs = {};\n const readIds = {};\n feats.map(ret => {\n const readNames = {};\n for (let i = 0; i < ret.length; i++) {\n const name = ret[i].name();\n const id = ret[i].id();\n if (!readNames[name]) {\n readNames[name] = 0;\n }\n readNames[name]++;\n readIds[id] = 1;\n }\n entries(readNames).forEach(([k, v]) => {\n if (v === 1) {\n unmatedPairs[k] = true;\n }\n });\n });\n const matePromises = [];\n feats.map(ret => {\n for (let i = 0; i < ret.length; i++) {\n const f = ret[i];\n const name = f.name();\n const start = f.get('start');\n const pnext = f._next_pos();\n const rnext = f._next_refid();\n if (unmatedPairs[name] &&\n (pairAcrossChr ||\n (rnext === chrId && Math.abs(start - pnext) < maxInsertSize))) {\n matePromises.push(this.index.blocksForRange(rnext, pnext, pnext + 1, opts));\n }\n }\n });\n // filter out duplicate chunks (the blocks are lists of chunks, blocks are\n // concatenated, then filter dup chunks)\n const mateChunks = flat(await Promise.all(matePromises))\n .sort()\n .filter((item, pos, ary) => !pos || item.toString() !== ary[pos - 1].toString());\n const mateTotalSize = mateChunks\n .map(s => s.fetchedSize())\n .reduce((a, b) => a + b, 0);\n if (mateTotalSize > this.fetchSizeLimit) {\n throw new Error(`data size of ${mateTotalSize.toLocaleString()} bytes exceeded fetch size limit of ${this.fetchSizeLimit.toLocaleString()} bytes`);\n }\n const mateFeatPromises = mateChunks.map(async (c) => {\n const { data, cpositions, dpositions, chunk } = await this._readChunk({\n chunk: c,\n opts,\n });\n const feats = await this.readBamFeatures(data, cpositions, dpositions, chunk);\n const mateRecs = [];\n for (let i = 0; i < feats.length; i += 1) {\n const feature = feats[i];\n if (unmatedPairs[feature.get('name')] && !readIds[feature.id()]) {\n mateRecs.push(feature);\n }\n }\n return mateRecs;\n });\n return flat(await Promise.all(mateFeatPromises));\n }\n async _readChunk({ chunk, opts }) {\n const size = chunk.fetchedSize();\n const { buffer, bytesRead } = await this.bam.read(Buffer.alloc(size), 0, size, chunk.minv.blockPosition, opts);\n const { buffer: data, cpositions, dpositions, } = await unzipChunkSlice(buffer.subarray(0, Math.min(bytesRead, size)), chunk);\n return { data, cpositions, dpositions, chunk };\n }\n async readBamFeatures(ba, cpositions, dpositions, chunk) {\n let blockStart = 0;\n const sink = [];\n let pos = 0;\n let last = +Date.now();\n while (blockStart + 4 < ba.length) {\n const blockSize = ba.readInt32LE(blockStart);\n const blockEnd = blockStart + 4 + blockSize - 1;\n // increment position to the current decompressed status\n if (dpositions) {\n while (blockStart + chunk.minv.dataPosition >= dpositions[pos++]) { }\n pos--;\n }\n // only try to read the feature if we have all the bytes for it\n if (blockEnd < ba.length) {\n const feature = new BAMFeature({\n bytes: {\n byteArray: ba,\n start: blockStart,\n end: blockEnd,\n },\n // the below results in an automatically calculated file-offset based ID\n // if the info for that is available, otherwise crc32 of the features\n //\n // cpositions[pos] refers to actual file offset of a bgzip block boundaries\n //\n // we multiply by (1 <<8) in order to make sure each block has a \"unique\"\n // address space so that data in that block could never overlap\n //\n // then the blockStart-dpositions is an uncompressed file offset from\n // that bgzip block boundary, and since the cpositions are multiplied by\n // (1 << 8) these uncompressed offsets get a unique space\n //\n // this has an extra chunk.minv.dataPosition added on because it blockStart\n // starts at 0 instead of chunk.minv.dataPosition\n //\n // the +1 is just to avoid any possible uniqueId 0 but this does not realistically happen\n fileOffset: cpositions\n ? cpositions[pos] * (1 << 8) +\n (blockStart - dpositions[pos]) +\n chunk.minv.dataPosition +\n 1\n : // must be slice, not subarray for buffer polyfill on web\n crc32.signed(ba.slice(blockStart, blockEnd)),\n });\n sink.push(feature);\n if (this.yieldThreadTime && +Date.now() - last > this.yieldThreadTime) {\n await timeout(1);\n last = +Date.now();\n }\n }\n blockStart = blockEnd + 1;\n }\n return sink;\n }\n async hasRefSeq(seqName) {\n const refId = this.chrToIndex && this.chrToIndex[seqName];\n return this.index.hasRefSeq(refId);\n }\n async lineCount(seqName) {\n const refId = this.chrToIndex && this.chrToIndex[seqName];\n return this.index.lineCount(refId);\n }\n async indexCov(seqName, start, end) {\n await this.index.parse();\n const seqId = this.chrToIndex && this.chrToIndex[seqName];\n return this.index.indexCov(seqId, start, end);\n }\n async blocksForRange(seqName, start, end, opts) {\n await this.index.parse();\n const seqId = this.chrToIndex && this.chrToIndex[seqName];\n return this.index.blocksForRange(seqId, start, end, opts);\n }\n}\n//# sourceMappingURL=bamFile.js.map","(function(self) {\n\nvar irrelevant = (function (exports) {\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n})({});\n})(typeof self !== 'undefined' ? self : this);\n","export default class QuickLRU extends Map {\n\tconstructor(options = {}) {\n\t\tsuper();\n\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tif (typeof options.maxAge === 'number' && options.maxAge === 0) {\n\t\t\tthrow new TypeError('`maxAge` must be a number greater than 0');\n\t\t}\n\n\t\t// TODO: Use private class fields when ESLint supports them.\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.maxAge = options.maxAge || Number.POSITIVE_INFINITY;\n\t\tthis.onEviction = options.onEviction;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t// TODO: Use private class methods when targeting Node.js 16.\n\t_emitEvictions(cache) {\n\t\tif (typeof this.onEviction !== 'function') {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const [key, item] of cache) {\n\t\t\tthis.onEviction(key, item.value);\n\t\t}\n\t}\n\n\t_deleteIfExpired(key, item) {\n\t\tif (typeof item.expiry === 'number' && item.expiry <= Date.now()) {\n\t\t\tif (typeof this.onEviction === 'function') {\n\t\t\t\tthis.onEviction(key, item.value);\n\t\t\t}\n\n\t\t\treturn this.delete(key);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t_getOrDeleteIfExpired(key, item) {\n\t\tconst deleted = this._deleteIfExpired(key, item);\n\t\tif (deleted === false) {\n\t\t\treturn item.value;\n\t\t}\n\t}\n\n\t_getItemValue(key, item) {\n\t\treturn item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;\n\t}\n\n\t_peek(key, cache) {\n\t\tconst item = cache.get(key);\n\n\t\treturn this._getItemValue(key, item);\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis._emitEvictions(this.oldCache);\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\t_moveToRecent(key, item) {\n\t\tthis.oldCache.delete(key);\n\t\tthis._set(key, item);\n\t}\n\n\t* _entriesAscending() {\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield item;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const item of this.cache) {\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\tconst item = this.cache.get(key);\n\n\t\t\treturn this._getItemValue(key, item);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst item = this.oldCache.get(key);\n\t\t\tif (this._deleteIfExpired(key, item) === false) {\n\t\t\t\tthis._moveToRecent(key, item);\n\t\t\t\treturn item.value;\n\t\t\t}\n\t\t}\n\t}\n\n\tset(key, value, {maxAge = this.maxAge} = {}) {\n\t\tconst expiry =\n\t\t\ttypeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY ?\n\t\t\t\tDate.now() + maxAge :\n\t\t\t\tundefined;\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, {\n\t\t\t\tvalue,\n\t\t\t\texpiry\n\t\t\t});\n\t\t} else {\n\t\t\tthis._set(key, {value, expiry});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\thas(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn !this._deleteIfExpired(key, this.cache.get(key));\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn !this._deleteIfExpired(key, this.oldCache.get(key));\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this._peek(key, this.cache);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this._peek(key, this.oldCache);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\tresize(newSize) {\n\t\tif (!(newSize && newSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tconst items = [...this._entriesAscending()];\n\t\tconst removeCount = items.length - newSize;\n\t\tif (removeCount < 0) {\n\t\t\tthis.cache = new Map(items);\n\t\t\tthis.oldCache = new Map();\n\t\t\tthis._size = items.length;\n\t\t} else {\n\t\t\tif (removeCount > 0) {\n\t\t\t\tthis._emitEvictions(items.slice(0, removeCount));\n\t\t\t}\n\n\t\t\tthis.oldCache = new Map(items.slice(removeCount));\n\t\t\tthis.cache = new Map();\n\t\t\tthis._size = 0;\n\t\t}\n\n\t\tthis.maxSize = newSize;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield [key, value.value];\n\t\t\t}\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield [key, value.value];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t* entriesDescending() {\n\t\tlet items = [...this.cache];\n\t\tfor (let i = items.length - 1; i >= 0; --i) {\n\t\t\tconst item = items[i];\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield [key, value.value];\n\t\t\t}\n\t\t}\n\n\t\titems = [...this.oldCache];\n\t\tfor (let i = items.length - 1; i >= 0; --i) {\n\t\t\tconst item = items[i];\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield [key, value.value];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t* entriesAscending() {\n\t\tfor (const [key, value] of this._entriesAscending()) {\n\t\t\tyield [key, value.value];\n\t\t}\n\t}\n\n\tget size() {\n\t\tif (!this._size) {\n\t\t\treturn this.oldCache.size;\n\t\t}\n\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn Math.min(this._size + oldCacheSize, this.maxSize);\n\t}\n\n\tentries() {\n\t\treturn this.entriesAscending();\n\t}\n\n\tforEach(callbackFunction, thisArgument = this) {\n\t\tfor (const [key, value] of this.entriesAscending()) {\n\t\t\tcallbackFunction.call(thisArgument, value, key, this);\n\t\t}\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn JSON.stringify([...this.entriesAscending()]);\n\t}\n}\n","export default function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import ascending from \"./ascending.js\";\n\nexport default function(f) {\n let delta = f;\n let compare = f;\n\n if (f.length === 1) {\n delta = (d, x) => f(d) - x;\n compare = ascendingComparator(f);\n }\n\n function left(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function right(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n\n function center(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction ascendingComparator(f) {\n return (d, x) => ascending(f(d), x);\n}\n","import { bisector } from 'd3-array';\nimport { RemoteFile as _RemoteFile } from 'generic-filehandle';\n\nimport type * as HiGlass from '@higlass/types';\nimport type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema';\n\nexport type CommonDataConfig = {\n assembly: Assembly;\n x?: string;\n xe?: string;\n x1?: string;\n x1e?: string;\n urlFetchOptions?: RequestInit;\n};\n\nexport class DataSource {\n chromInfo: ExtendedChromInfo;\n tilesetInfo: ReturnType;\n\n constructor(public file: File, chromSizes: ChromSizes, public options: Options) {\n this.chromInfo = sizesToChromInfo(chromSizes);\n this.tilesetInfo = tilesetInfoFromChromInfo(this.chromInfo);\n }\n}\n\n/**\n * Filter data before sending to a track considering the visible genomic area in the track.\n * TODO(2022-Jul-13): Consider genomic `y` channels as well.\n */\nexport function filterUsingGenoPos(\n data: Datum[],\n [minX, maxX]: [number, number],\n config: Omit\n) {\n const { x, xe, x1, x1e } = config;\n const definedXFields = [x, xe, x1, x1e].filter(f => f) as string[];\n return data.filter((d: Datum) => {\n if (definedXFields.length === 0) {\n // no filter applies\n return true;\n } else if (definedXFields.length === 1) {\n // filter based on one genomic position\n const value = +d[definedXFields[0]];\n return typeof value === 'number' && minX < value && value <= maxX;\n } else {\n // filter based on two genomic positions, i.e., check overlaps\n const values = definedXFields.map(f => +d[f]).filter(v => !isNaN(v));\n const minValue = Math.min(...values);\n const maxValue = Math.max(...values);\n return minX <= maxValue && minValue <= maxX;\n }\n });\n}\n\nconst chromInfoBisector = bisector((d: { pos: number }) => d.pos).left;\n\nconst chrToAbs = (chrom: string, chromPos: number, chromInfo: HiGlass.ChromInfo) =>\n chromInfo.chrPositions[chrom].pos + chromPos;\n\nconst absToChr = (absPosition: number, chromInfo: HiGlass.ChromInfo) => {\n if (!chromInfo || !chromInfo.cumPositions || !chromInfo.cumPositions.length) {\n return null;\n }\n\n let insertPoint = chromInfoBisector(chromInfo.cumPositions, absPosition);\n const lastChr = chromInfo.cumPositions[chromInfo.cumPositions.length - 1].chr;\n const lastLength = chromInfo.chromLengths[lastChr];\n\n // @ts-expect-error\n insertPoint -= insertPoint > 0 && 1;\n\n let chrPosition = Math.floor(absPosition - chromInfo.cumPositions[insertPoint].pos);\n let offset = 0;\n\n if (chrPosition < 0) {\n // before the start of the genome\n offset = chrPosition - 1;\n chrPosition = 1;\n }\n\n if (insertPoint === chromInfo.cumPositions.length - 1 && chrPosition > lastLength) {\n // beyond the last chromosome\n offset = chrPosition - lastLength;\n chrPosition = lastLength;\n }\n\n return [chromInfo.cumPositions[insertPoint].chr, chrPosition, offset, insertPoint] as const;\n};\n\n/**\n * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`.\n * @param chrName A chromosome name to be sanitized\n * @param assembly A genome assembly of the data\n * @param chromosomePrefix A prefix string that can be replaced to 'chr'\n * @returns\n */\nexport function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string) {\n if (Array.isArray(assembly)) {\n // this is a custom assembly, so use this as is\n return chrName;\n }\n\n // For assemblies in Gosling, we use the `chr` prefix consistently\n if (chromosomePrefix) {\n // `hs1` --> `chr1`\n chrName = chrName.replace(chromosomePrefix, 'chr');\n } else if (!chrName.includes('chr')) {\n // `1` --> `chr1`\n chrName = `chr${chrName}`;\n }\n return chrName;\n}\n\nexport type ExtendedChromInfo = HiGlass.ChromInfo & {\n absToChr(absPos: number): ReturnType | null;\n chrToAbs(chr: [name: string, pos: number]): number | null;\n};\n\nexport function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize = 1024) {\n return {\n tile_size: tileSize,\n bins_per_dimension: tileSize,\n max_zoom: Math.ceil(Math.log(chromInfo.totalLength / tileSize) / Math.log(2)),\n max_width: chromInfo.totalLength,\n min_pos: [0],\n max_pos: [chromInfo.totalLength]\n };\n}\n\nexport function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo {\n const info: HiGlass.ChromInfo = {\n cumPositions: [],\n chromLengths: {},\n chrPositions: {},\n totalLength: 0\n };\n\n sizes.forEach(([chr, length], i) => {\n const chrPosition = { id: i, chr, pos: info.totalLength };\n info.chrPositions[chr] = chrPosition;\n info.chromLengths[chr] = length;\n info.cumPositions.push(chrPosition);\n info.totalLength += length;\n });\n\n return {\n ...info,\n absToChr: absPos => (info.chrPositions ? absToChr(absPos, info) : null),\n chrToAbs: ([chrName, chrPos]) => (info.chrPositions ? chrToAbs(chrName, chrPos, info) : null)\n };\n}\n\nexport class RemoteFile extends _RemoteFile {\n // Overrides `read` to eagerly read 200 or 206 response\n // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162\n public read: _RemoteFile['read'] = async (\n buffer,\n offset = 0,\n length,\n position = 0,\n opts = {}\n ): Promise<{ bytesRead: number; buffer: Buffer }> => {\n const { headers = {}, signal, overrides = {} } = opts;\n\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n } else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n // @ts-expect-error private property\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n // @ts-expect-error private property\n ...this.baseOverrides.headers\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal\n };\n const response = await this.fetch(this.url, args);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n\n // Just read the response if it was successful.\n if (response.status === 200 || response.status === 206) {\n // @ts-expect-error private method\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n // @ts-expect-error private property\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n\n return { bytesRead: bytesCopied, buffer };\n }\n\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n };\n}\n\nexport interface TabularDataFetcher {\n getTabularData(tileIds: string[]): Promise;\n MAX_TILE_WIDTH?: number;\n}\n","// Adopted from https://github.com/higlass/higlass-pileup/blob/master/src/bam-fetcher-worker.js\nimport { expose, Transfer } from 'threads/worker';\nimport { BamFile as _BamFile } from '@gmod/bam';\nimport type { BamRecord } from '@gmod/bam';\nimport QuickLRU from 'quick-lru';\nimport type { TilesetInfo } from '@higlass/types';\n\nimport type { ChromSizes } from '@gosling-lang/gosling-schema';\n\nimport { DataSource, RemoteFile } from '../utils';\n\ninterface BamFileOptions {\n loadMates: boolean;\n maxInsertSize: number;\n extractJunction: boolean;\n junctionMinCoverage: number;\n urlFetchOptions?: RequestInit;\n indexUrlFetchOptions?: RequestInit;\n}\n\nfunction parseMD(mdString: string, useCounts: true): { type: string; length: number }[];\nfunction parseMD(mdString: string, useCounts: false): { pos: number; base: string; length: 1; bamSeqShift: number }[];\nfunction parseMD(mdString: string, useCounts: boolean) {\n let currPos = 0;\n let currNum = 0;\n let deletionEncountered = false;\n let bamSeqShift = 0;\n const substitutions = [];\n\n /* eslint-disable-next-line @typescript-eslint/prefer-for-of */\n for (let i = 0; i < mdString.length; i++) {\n if (mdString[i].match(/[0-9]/g)) {\n // a number, keep on going\n currNum = currNum * 10 + +mdString[i];\n deletionEncountered = false;\n } else if (mdString[i] === '^') {\n deletionEncountered = true;\n } else {\n currPos += currNum;\n\n if (useCounts) {\n substitutions.push({\n length: currNum,\n type: mdString[i]\n });\n } else if (deletionEncountered) {\n // Do nothing if there is a deletion and keep on going.\n // Note that there can be multiple deletions \"^ATC\"\n // Deletions are visualized using the CIGAR string\n // However, keep track of where in the bam seq we need to pull the variant.\n bamSeqShift -= 1;\n } else {\n substitutions.push({\n pos: currPos,\n base: mdString[i],\n length: 1,\n bamSeqShift\n });\n }\n\n currNum = 0;\n currPos += 1;\n }\n }\n\n return substitutions;\n}\n\ntype Substitution = {\n pos: number;\n length: number;\n type: 'X' | 'I' | 'D' | 'N' | '=' | 'M' | 'S' | 'H';\n variant?: string;\n};\n\nexport type Segment = {\n // if two segments have the same name but different id, they are paired reads.\n // https://github.com/GMOD/bam-js/blob/7a57d24b6aef08a1366cca86ba5092254c7a7f56/src/bamFile.ts#L386\n id: string;\n name: string;\n start: number;\n end: number;\n md: string;\n chrName: string;\n chrOffset: number;\n cigar: string;\n mapq: string;\n strand: '+' | '-';\n};\n\n/**\n * Gets an array of all substitutions in the segment\n * @param segment Current segment\n * @param seq Read sequence from bam file.\n */\nfunction getSubstitutions(segment: Segment, seq: string) {\n let substitutions: Substitution[] = [];\n let softClippingAtReadStart: null | { type: string; length: number } = null;\n\n if (segment.cigar) {\n const cigarSubs = parseMD(segment.cigar, true);\n let currPos = 0;\n\n for (const sub of cigarSubs) {\n if (sub.type === 'X') {\n // sequence mismatch, no need to do anything\n substitutions.push({\n pos: currPos,\n length: sub.length,\n type: 'X'\n });\n\n currPos += sub.length;\n } else if (sub.type === 'I') {\n substitutions.push({\n pos: currPos,\n length: sub.length,\n type: 'I'\n });\n } else if (sub.type === 'D') {\n substitutions.push({\n pos: currPos,\n length: sub.length,\n type: 'D'\n });\n currPos += sub.length;\n } else if (sub.type === 'N') {\n substitutions.push({\n pos: currPos,\n length: sub.length,\n type: 'N'\n });\n currPos += sub.length;\n } else if (sub.type === '=' || sub.type === 'M') {\n currPos += sub.length;\n } else {\n // console.log('skipping:', sub.type);\n }\n }\n\n const firstSub = cigarSubs[0];\n const lastSub = cigarSubs[cigarSubs.length - 1];\n\n // Soft clipping can happen at the beginning, at the end or both\n // positions are from the beginning of the read\n if (firstSub.type === 'S') {\n softClippingAtReadStart = firstSub;\n // soft clipping at the beginning\n substitutions.push({\n pos: -firstSub.length,\n type: 'S',\n length: firstSub.length\n });\n }\n // soft clipping at the end\n if (lastSub.type === 'S') {\n substitutions.push({\n pos: segment.end - segment.start,\n length: lastSub.length,\n type: 'S'\n });\n }\n\n // Hard clipping can happen at the beginning, at the end or both\n // positions are from the beginning of the read\n if (firstSub.type === 'H') {\n substitutions.push({\n pos: -firstSub.length,\n type: 'H',\n length: firstSub.length\n });\n }\n if (lastSub.type === 'H') {\n substitutions.push({\n pos: segment.end - segment.start,\n length: lastSub.length,\n type: 'H'\n });\n }\n }\n\n if (segment.md) {\n const mdSubstitutions = parseMD(segment.md, false);\n mdSubstitutions.forEach(function (substitution: (typeof mdSubstitutions)[number] & { variant?: string }) {\n let posStart = substitution['pos'] + substitution['bamSeqShift']!;\n let posEnd = posStart + substitution['length'];\n // When there is soft clipping at the beginning,\n // we need to shift the position where we read the variant from the sequence\n // not necessary when there is hard clipping\n if (softClippingAtReadStart !== null) {\n posStart += softClippingAtReadStart.length;\n posEnd += softClippingAtReadStart.length;\n }\n substitution['variant'] = seq.substring(posStart, posEnd);\n // @ts-expect-error\n delete substitution['bamSeqShift'];\n });\n // @ts-expect-error\n substitutions = mdSubstitutions.concat(substitutions);\n }\n\n return substitutions;\n}\n\n/////////////////////////////////////////////////////\n/// End Chrominfo\n/////////////////////////////////////////////////////\n\nconst bamRecordToJson = (bamRecord: BamRecord, chrName: string, chrOffset: number) => {\n const seq = bamRecord.get('seq');\n const segment: Segment = {\n // if two segments have the same name but different id, they are paired reads.\n // https://github.com/GMOD/bam-js/blob/7a57d24b6aef08a1366cca86ba5092254c7a7f56/src/bamFile.ts#L386\n // @ts-expect-error private field!!\n id: bamRecord._id,\n name: bamRecord.get('name'),\n // @ts-expect-error private field!!\n start: +bamRecord.data.start + 1 + chrOffset,\n // @ts-expect-error private field!!\n end: +bamRecord.data.end + 1 + chrOffset,\n md: bamRecord.get('MD'),\n chrName,\n chrOffset,\n cigar: bamRecord.get('cigar'),\n mapq: bamRecord.get('mq'),\n strand: bamRecord.get('strand') === 1 ? '+' : '-'\n };\n return Object.assign(segment, { substitutions: getSubstitutions(segment, seq) });\n};\n\ntype JsonBamRecord = ReturnType;\n\nclass BamFile extends _BamFile {\n headerPromise: ReturnType;\n constructor(...args: ConstructorParameters) {\n super(...args);\n this.headerPromise = this.getHeader();\n }\n static fromUrl(url: string, indexUrl: string, urlFetchOptions?: RequestInit, indexUrlFetchOptions?: RequestInit) {\n return new BamFile({\n bamFilehandle: new RemoteFile(url, { overrides: urlFetchOptions }),\n baiFilehandle: new RemoteFile(indexUrl, { overrides: indexUrlFetchOptions })\n });\n }\n getChromNames() {\n return this.indexToChr.map((v: { refName: string; length: number }) => v.refName);\n }\n}\n\n// indexed by dataset uuid\nconst dataSources: Map> = new Map();\n// indexed by bam url\nconst bamFileCache: Map = new Map();\nconst MAX_TILES = 20;\nconst tileValues = new QuickLRU({ maxSize: MAX_TILES });\n\nconst init = async (\n uid: string,\n bam: { url: string; indexUrl: string },\n chromSizes: ChromSizes,\n options: Partial = {}\n) => {\n if (!bamFileCache.has(bam.url)) {\n const bamFile = BamFile.fromUrl(bam.url, bam.indexUrl, options.urlFetchOptions, options.indexUrlFetchOptions);\n await bamFile.getHeader(); // reads bam/bai headers\n\n // Infer the correct chromosome names between 'chr1' and '1'\n const firstChromNameInHeader = bamFile.getChromNames()[0];\n if (firstChromNameInHeader) {\n const headerHasPrefix = firstChromNameInHeader.includes('chr');\n const specHasPrefix = chromSizes[0]?.[0].includes('chr');\n if (headerHasPrefix && !specHasPrefix) {\n chromSizes = chromSizes.map(([s, n]) => [`chr${s}`, n]);\n } else if (!headerHasPrefix && specHasPrefix) {\n chromSizes = chromSizes.map(([s, n]) => [s.replace('chr', ''), n]);\n }\n }\n bamFileCache.set(bam.url, bamFile);\n }\n const bamFile = bamFileCache.get(bam.url)!;\n const dataSource = new DataSource(bamFile, chromSizes, {\n loadMates: false,\n maxInsertSize: 5000,\n extractJunction: false,\n junctionMinCoverage: 1,\n ...options\n });\n dataSources.set(uid, dataSource);\n};\n\nconst tilesetInfo = (uid: string) => {\n return dataSources.get(uid)!.tilesetInfo;\n};\n\nconst tile = async (uid: string, z: number, x: number): Promise => {\n const MAX_TILE_WIDTH = 200000;\n const bam = dataSources.get(uid)!;\n\n const info = tilesetInfo(uid);\n\n if (!('max_width' in info)) {\n throw new Error('tilesetInfo does not include `max_width`, which is required for the Gosling BamDataFetcher.');\n }\n\n const tileWidth = +info.max_width / 2 ** +z;\n\n const recordPromises: Promise[] = [];\n\n if (tileWidth > MAX_TILE_WIDTH) {\n // this.errorTextText('Zoomed out too far for this track. Zoomin further to see reads');\n return new Promise(resolve => resolve([]));\n }\n\n // get the bounds of the tile\n let minX = info.min_pos[0] + x * tileWidth;\n const maxX = info.min_pos[0] + (x + 1) * tileWidth;\n\n const { chromLengths, cumPositions } = bam.chromInfo;\n\n const opt = {\n viewAsPairs: bam.options.loadMates\n // TODO: Turning this on results in \"too many requests error\"\n // https://github.com/gosling-lang/gosling.js/pull/556\n // pairAcrossChr: typeof loadMates === 'undefined' ? false : loadMates,\n };\n\n tileValues.set(`${uid}.${z}.${x}`, []);\n\n /* eslint-disable-next-line @typescript-eslint/prefer-for-of */\n for (let i = 0; i < cumPositions.length; i++) {\n const chromName = cumPositions[i].chr;\n const chromStart = cumPositions[i].pos;\n const chromEnd = cumPositions[i].pos + chromLengths[chromName];\n\n if (chromStart <= minX && minX < chromEnd) {\n // start of the visible region is within this chromosome\n\n if (maxX > chromEnd) {\n // the visible region extends beyond the end of this chromosome\n // fetch from the start until the end of the chromosome\n recordPromises.push(\n bam.file\n .getRecordsForRange(chromName, minX - chromStart, chromEnd - chromStart, opt)\n .then(records => {\n const mappedRecords = records.map(rec =>\n bamRecordToJson(rec, chromName, cumPositions[i].pos)\n );\n tileValues.set(\n `${uid}.${z}.${x}`,\n (tileValues.get(`${uid}.${z}.${x}`) as JsonBamRecord[]).concat(mappedRecords)\n );\n return [];\n // return mappedRecords;\n })\n );\n\n // continue onto the next chromosome\n minX = chromEnd;\n } else {\n const startPos = Math.floor(minX - chromStart);\n const endPos = Math.ceil(maxX - chromStart);\n // the end of the region is within this chromosome\n recordPromises.push(\n bam.file.getRecordsForRange(chromName, startPos, endPos, opt).then(records => {\n const mappedRecords = records.map(rec => bamRecordToJson(rec, chromName, cumPositions[i].pos));\n tileValues.set(\n `${uid}.${z}.${x}`,\n (tileValues.get(`${uid}.${z}.${x}`) as JsonBamRecord[]).concat(mappedRecords)\n );\n return [];\n })\n );\n // end the loop because we've retrieved the last chromosome\n break;\n }\n }\n }\n\n // flatten the array of promises so that it looks like we're getting one long list of value\n return Promise.all(recordPromises).then(values => {\n return values.flat();\n });\n};\n\n/**\n * Not like other data fetchers, the Bam Data Fetcher fetches all the tiles at once.\n * @param uid\n * @param tileIds\n * @returns\n */\nconst fetchTilesDebounced = async (uid: string, tileIds: string[]) => {\n const tiles: Record = {};\n const validTileIds: string[] = [];\n const tilePromises: Promise[] = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('Invalid tile zoom or position:', z, x);\n continue;\n }\n\n validTileIds.push(tileId);\n tilePromises.push(tile(uid, z, x));\n }\n\n return Promise.all(tilePromises).then(values => {\n values.forEach((d, i) => {\n const validTileId = validTileIds[i];\n tiles[validTileId] = Object.assign(d, { tilePositionId: validTileId });\n });\n return tiles;\n });\n};\n\nconst getTabularData = (uid: string, tileIds: string[]) => {\n const { options } = dataSources.get(uid)!;\n const allSegments: Record = {};\n\n for (const tileId of tileIds) {\n const tileValue = tileValues.get(`${uid}.${tileId}`);\n\n if (!tileValue) {\n continue;\n }\n\n if ('error' in tileValue) {\n throw new Error(tileValue.error);\n }\n\n for (const segment of tileValue) {\n allSegments[segment.id] = {\n ...segment,\n substitutions: JSON.stringify(segment.substitutions)\n };\n }\n }\n\n const segments = Object.values(allSegments);\n\n // find and set mate info when the `data.loadMates` flag is on.\n if (options.loadMates) {\n // TODO: avoid mutation?\n findMates(segments, options.maxInsertSize);\n }\n\n let output: Junction[] | SegmentWithMate[] | Segment[];\n if (options.extractJunction) {\n // Reference(ggsashimi): https://github.com/guigolab/ggsashimi/blob/d686d59b4e342b8f9dcd484f0af4831cc092e5de/ggsashimi.py#L136\n output = findJunctions(segments, options.junctionMinCoverage);\n } else {\n output = segments;\n }\n\n const buffer = new TextEncoder().encode(JSON.stringify(output)).buffer;\n return Transfer(buffer, [buffer]);\n};\n\nconst groupBy = (xs: readonly T[], key: K): Record =>\n xs.reduce((rv, x) => {\n // @ts-expect-error\n (rv[x[key]] = rv[x[key]] || []).push(x);\n return rv;\n }, {});\n\nexport type SegmentWithMate = Segment & {\n mateIds: string[];\n foundMate: boolean;\n insertSize: number;\n largeInsertSize: boolean;\n svType: string;\n numMates: number;\n};\n\nconst findMates = (segments: Segment[], maxInsertSize = 0) => {\n // @ts-expect-error This methods mutates this above aob\n const segmentsByReadName: Record = groupBy(segments, 'name');\n\n // Iterate entries and set information about mates\n Object.values(segmentsByReadName).forEach(segmentGroup => {\n if (segmentGroup.length === 2) {\n const read = segmentGroup[0];\n const mate = segmentGroup[1];\n read.mateIds = [mate.id];\n mate.mateIds = [read.id];\n // Additional info we want\n const [l, r] = [read, mate].sort((a, b) => +a.start - +b.start);\n const insertSize = Math.max(0, +r.start - +l.end);\n const largeInsertSize = insertSize >= maxInsertSize;\n\n let svType: string;\n if (!largeInsertSize) {\n svType = 'normal read';\n } else if (l.strand === '+' && r.strand === '-') {\n svType = 'deletion (+-)';\n } else if (l.strand === '+' && r.strand === '+') {\n svType = 'inversion (++)';\n } else if (l.strand === '-' && r.strand === '-') {\n svType = 'inversion (--)';\n } else if (l.strand === '-' && r.strand === '+') {\n svType = 'duplication (-+)';\n } else {\n svType = `(${l.strand}${r.strand})`;\n }\n\n // if(largeInsertSize) console.log(svType);\n [read, mate].forEach(d => {\n d.foundMate = true;\n d.insertSize = insertSize;\n d.largeInsertSize = largeInsertSize;\n d.svType = svType;\n d.numMates = 2;\n });\n } else {\n // We do not handle such cases for now\n segmentGroup.forEach(d => {\n d.mateIds = segmentGroup.filter(mate => mate.id !== d.id).map(mate => mate.id);\n d.foundMate = false;\n d.insertSize = -1;\n d.largeInsertSize = false;\n d.svType = segmentGroup.length === 1 ? 'mates not found within chromosome' : 'more than two mates';\n d.numMates = segmentGroup.length;\n });\n }\n });\n return segmentsByReadName;\n};\n\nexport type Junction = { start: number; end: number; score: number };\n\nconst findJunctions = (segments: { start: number; end: number; substitutions: string }[], minCoverage = 0) => {\n const junctions: Junction[] = [];\n segments.forEach(segment => {\n const substitutions: { pos: number; length: number }[] = JSON.parse(segment.substitutions);\n substitutions.forEach(sub => {\n const don = segment.start + sub.pos;\n const acc = segment.start + sub.pos + sub.length;\n if (segment.start < don && acc < segment.end) {\n const j = junctions.find(d => d.start === don && d.end === acc);\n if (j) {\n j.score += 1;\n } else {\n junctions.push({ start: don, end: acc, score: 1 });\n }\n }\n });\n });\n return junctions.filter(d => d.score >= minCoverage);\n};\n\nconst tileFunctions = {\n init,\n tilesetInfo,\n fetchTilesDebounced,\n tile,\n getTabularData\n};\n\nexpose(tileFunctions);\n\nexport type WorkerApi = typeof tileFunctions;\nexport type { TilesetInfo };\nexport type Tiles = Awaited>;\n"],"names":["common","require$$0","Transfer","isWorkerRuntime","postMessageToMaster","subscribeToMasterMessages","this","__importDefault","require$$1","require$$2","require$$3","require$$4","isObservable","expose","i","toString","fromBytes","long","Long","c","len","len2","buffer","ieee754","Buffer","fromString","byteLength","code","msg","init","utils","Z_FIXED","Z_UNKNOWN","zero","MIN_MATCH","MAX_MATCH","LENGTH_CODES","LITERALS","L_CODES","D_CODES","BL_CODES","HEAP_SIZE","MAX_BITS","rank","adler32","crc32","Z_NO_FLUSH","Z_FINISH","Z_BLOCK","Z_OK","Z_STREAM_END","Z_STREAM_ERROR","Z_DATA_ERROR","Z_BUF_ERROR","Z_DEFAULT_COMPRESSION","Z_DEFAULT_STRATEGY","Z_DEFLATED","MAX_WBITS","deflate","strings","c2","ZStream","BAD","TYPE","inflate_fast","ENOUGH_LENS","ENOUGH_DISTS","CODES","LENS","DISTS","inflate_table","q","inflate","constants","GZheader","require$$5","require$$6","Inflate","Z_SYNC_FLUSH","entries","_getPrototypeOf","o","_setPrototypeOf","p","self","_get","Emitter","AbortSignal","AbortController","err","Request","abortableFetch","global","AggregateAbortController_1","abortcontroller_ponyfill_1","AggregateStatusReporter_1","AbortablePromiseCache_1","QuickLRU","AbortablePromiseCache","RemoteFile","feats","BAMFeature","_RemoteFile","_BamFile","bamFile"],"mappings":";;;;;;;;;;;;;MAEA,eAAiB,WAAS;AACzB,QAAI,CAAC,OAAO;AACX,aAAO;AAAA,IACP;AAGD,QAAI,OAAO,OAAO,eAAe,YAAY,OAAO,MAAM,OAAO,UAAU,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,SAAA,KAAK,EAAE;AAC7E,YAAE,YAAY;AACd,YAAE,aAAa;AACf,YAAE,kBAAkB;AACpB,YAAE,SAAS,aAAa,WAAW,IAAI,sCAAsC;AAC7E,YAAE,WAAW,aAAa;AAAA,QAAA,CAC7B;AAAA,MACL;AAAA,IAAA,CACH;AACM,WAAA;AAAA,EACX;AAIA,QAAM,gBAAgB,CAAC,UAAmE,cAAc,MAAM;AAC1G,UAAM,YAAwB,CAAA;AAC9B,aAAS,QAAQ,CAAW,YAAA;AACxB,YAAM,gBAAmD,KAAK,MAAM,QAAQ,aAAa;AACzF,oBAAc,QAAQ,CAAO,QAAA;AACnB,cAAA,MAAM,QAAQ,QAAQ,IAAI;AAChC,cAAM,MAAM,QAAQ,QAAQ,IAAI,MAAM,IAAI;AAC1C,YAAI,QAAQ,QAAQ,OAAO,MAAM,QAAQ,KAAK;AACpC,gBAAA,IAAI,UAAU,KAAK,CAAA,MAAK,EAAE,UAAU,OAAO,EAAE,QAAQ,GAAG;AAC9D,cAAI,GAAG;AACH,cAAE,SAAS;AAAA,UAAA,OACR;AACO,sBAAA,KAAK,EAAE,OAAO,KAAK,KAAK,KAAK,OAAO,GAAG;AAAA,UACrD;AAAA,QACJ;AAAA,MAAA,CACH;AAAA,IAAA,CACJ;AACD,WAAO,UAAU,OAAO,CAAK,MAAA,EAAE,SAAS,WAAW;AAAA,EACvD;AAEA,QAAM,gBAAgB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAEA,SAAO,aAAa;;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55]} \ No newline at end of file diff --git a/dist/assets/bed-worker-cb58a7c2.js.map b/dist/assets/bed-worker-cb58a7c2.js.map new file mode 100644 index 00000000..c58dd21c --- /dev/null +++ b/dist/assets/bed-worker-cb58a7c2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bed-worker-cb58a7c2.js","sources":["../node_modules/.pnpm/abortcontroller-polyfill@1.7.5/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/abortcontroller-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateAbortController.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateStatusReporter.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AbortablePromiseCache.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/index.js","../node_modules/.pnpm/quick-lru@4.0.1/node_modules/quick-lru/index.js","../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js","../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js","../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js","../__vite-browser-external","../node_modules/.pnpm/generic-filehandle@3.1.1/node_modules/generic-filehandle/esm/remoteFile.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js","../node_modules/.pnpm/@gmod+bgzf-filehandle@1.4.7/node_modules/@gmod/bgzf-filehandle/esm/unzip-pako.js","../node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/util.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/virtualOffset.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/chunk.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/indexFile.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tbi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/csi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tabixIndexedFile.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayMap.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toFinite.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toInteger.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copyArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIterateeCall.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseClamp.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseValues.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/values.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseRandom.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_shuffleSelf.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/sampleSize.js","../node_modules/.pnpm/is-observable@2.1.0/node_modules/is-observable/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/serializers.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/common.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/symbols.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/transferable.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/types/messages.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/implementation.browser.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/worker.mjs","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/ascending.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/bisector.js","../src/data-fetchers/utils.ts","../node_modules/.pnpm/@gmod+bed@2.1.2/node_modules/@gmod/bed/esm/autoSql.js","../node_modules/.pnpm/@gmod+bed@2.1.2/node_modules/@gmod/bed/esm/as/autoSqlSchemas.js","../node_modules/.pnpm/@gmod+bed@2.1.2/node_modules/@gmod/bed/esm/defaultTypes.js","../node_modules/.pnpm/@gmod+bed@2.1.2/node_modules/@gmod/bed/esm/util.js","../node_modules/.pnpm/@gmod+bed@2.1.2/node_modules/@gmod/bed/esm/parser.js","../src/data-fetchers/bed/bed-parser.ts","../src/data-fetchers/bed/bed-worker.ts"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get.apply(this, arguments);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'reason', {\n value: undefined,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort(reason) {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n var signalReason = reason;\n\n if (signalReason === undefined) {\n if (typeof document === 'undefined') {\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n } else {\n try {\n signalReason = new DOMException('signal is aborted without reason');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n }\n }\n }\n\n this.signal.reason = signalReason;\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","\"use strict\";\n/* eslint-disable */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbortSignal = exports.AbortController = void 0;\nconst cjs_ponyfill_1 = require(\"abortcontroller-polyfill/dist/cjs-ponyfill\");\nvar getGlobal = function () {\n // the only reliable means to get the global object is\n // `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n};\n//@ts-ignore\nlet AbortController = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortController : getGlobal().AbortController;\nexports.AbortController = AbortController;\n//@ts-ignore\nlet AbortSignal = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal;\nexports.AbortSignal = AbortSignal;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nclass NullSignal {\n}\n/**\n * aggregates a number of abort signals, will only fire the aggregated\n * abort if all of the input signals have been aborted\n */\nclass AggregateAbortController {\n constructor() {\n this.signals = new Set();\n this.abortController = new abortcontroller_ponyfill_1.AbortController();\n }\n /**\n * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy,\n * will be treated as a null-signal, and this abortcontroller will no\n * longer be abortable.\n */\n //@ts-ignore\n addSignal(signal = new NullSignal()) {\n if (this.signal.aborted) {\n throw new Error('cannot add a signal, already aborted!');\n }\n // note that a NullSignal will never fire, so if we\n // have one this thing will never actually abort\n this.signals.add(signal);\n if (signal.aborted) {\n // handle the abort immediately if it is already aborted\n // for some reason\n this.handleAborted(signal);\n }\n else if (typeof signal.addEventListener === 'function') {\n signal.addEventListener('abort', () => {\n this.handleAborted(signal);\n });\n }\n }\n handleAborted(signal) {\n this.signals.delete(signal);\n if (this.signals.size === 0) {\n this.abortController.abort();\n }\n }\n get signal() {\n return this.abortController.signal;\n }\n abort() {\n this.abortController.abort();\n }\n}\nexports.default = AggregateAbortController;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass AggregateStatusReporter {\n constructor() {\n this.callbacks = new Set();\n }\n addCallback(callback = () => { }) {\n this.callbacks.add(callback);\n callback(this.currentMessage);\n }\n callback(message) {\n this.currentMessage = message;\n this.callbacks.forEach(elt => {\n elt(message);\n });\n }\n}\nexports.default = AggregateStatusReporter;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nconst AggregateAbortController_1 = __importDefault(require(\"./AggregateAbortController\"));\nconst AggregateStatusReporter_1 = __importDefault(require(\"./AggregateStatusReporter\"));\nclass AbortablePromiseCache {\n constructor({ fill, cache, }) {\n if (typeof fill !== 'function') {\n throw new TypeError('must pass a fill function');\n }\n if (typeof cache !== 'object') {\n throw new TypeError('must pass a cache object');\n }\n if (typeof cache.get !== 'function' ||\n typeof cache.set !== 'function' ||\n typeof cache.delete !== 'function') {\n throw new TypeError('cache must implement get(key), set(key, val), and and delete(key)');\n }\n this.cache = cache;\n this.fillCallback = fill;\n }\n static isAbortException(exception) {\n return (\n // DOMException\n exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n //@ts-ignore\n exception.code === 'ERR_ABORTED' ||\n // stringified DOMException\n exception.message === 'AbortError: aborted' ||\n // stringified standard-ish exception\n exception.message === 'Error: aborted');\n }\n evict(key, entry) {\n if (this.cache.get(key) === entry) {\n this.cache.delete(key);\n }\n }\n fill(key, data, signal, statusCallback) {\n const aborter = new AggregateAbortController_1.default();\n const statusReporter = new AggregateStatusReporter_1.default();\n statusReporter.addCallback(statusCallback);\n const newEntry = {\n aborter: aborter,\n promise: this.fillCallback(data, aborter.signal, (message) => {\n statusReporter.callback(message);\n }),\n settled: false,\n statusReporter,\n get aborted() {\n return this.aborter.signal.aborted;\n },\n };\n newEntry.aborter.addSignal(signal);\n // remove the fill from the cache when its abortcontroller fires, if still in there\n newEntry.aborter.signal.addEventListener('abort', () => {\n if (!newEntry.settled) {\n this.evict(key, newEntry);\n }\n });\n // chain off the cached promise to record when it settles\n newEntry.promise\n .then(() => {\n newEntry.settled = true;\n }, () => {\n newEntry.settled = true;\n // if the fill throws an error (including abort) and is still in the cache, remove it\n this.evict(key, newEntry);\n })\n .catch(e => {\n // this will only be reached if there is some kind of\n // bad bug in this library\n console.error(e);\n throw e;\n });\n this.cache.set(key, newEntry);\n }\n static checkSinglePromise(promise, signal) {\n // check just this signal for having been aborted, and abort the\n // promise if it was, regardless of what happened with the cached\n // response\n function checkForSingleAbort() {\n if (signal && signal.aborted) {\n throw Object.assign(new Error('aborted'), { code: 'ERR_ABORTED' });\n }\n }\n return promise.then(result => {\n checkForSingleAbort();\n return result;\n }, error => {\n checkForSingleAbort();\n throw error;\n });\n }\n has(key) {\n return this.cache.has(key);\n }\n /**\n * Callback for getting status of the pending async\n *\n * @callback statusCallback\n * @param {any} status, current status string or message object\n */\n /**\n * @param {any} key cache key to use for this request\n * @param {any} data data passed as the first argument to the fill callback\n * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request\n * @param {statusCallback} a callback to get the current status of a pending async operation\n */\n get(key, data, signal, statusCallback) {\n if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) {\n throw new TypeError('second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?');\n }\n const cacheEntry = this.cache.get(key);\n if (cacheEntry) {\n if (cacheEntry.aborted && !cacheEntry.settled) {\n // if it's aborted but has not realized it yet, evict it and redispatch\n this.evict(key, cacheEntry);\n return this.get(key, data, signal, statusCallback);\n }\n if (cacheEntry.settled) {\n // too late to abort, just return it\n return cacheEntry.promise;\n }\n // request is in-flight, add this signal to its list of signals,\n // or if there is no signal, the aborter will become non-abortable\n cacheEntry.aborter.addSignal(signal);\n cacheEntry.statusReporter.addCallback(statusCallback);\n return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal);\n }\n // if we got here, it is not in the cache. fill.\n this.fill(key, data, signal, statusCallback);\n return AbortablePromiseCache.checkSinglePromise(\n //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-\n //eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.cache.get(key).promise, signal);\n }\n /**\n * delete the given entry from the cache. if it exists and its fill request has\n * not yet settled, the fill will be signaled to abort.\n *\n * @param {any} key\n */\n delete(key) {\n const cachedEntry = this.cache.get(key);\n if (cachedEntry) {\n if (!cachedEntry.settled) {\n cachedEntry.aborter.abort();\n }\n this.cache.delete(key);\n }\n }\n /**\n * Clear all requests from the cache. Aborts any that have not settled.\n * @returns {number} count of entries deleted\n */\n clear() {\n // iterate without needing regenerator-runtime\n const keyIter = this.cache.keys();\n let deleteCount = 0;\n for (let result = keyIter.next(); !result.done; result = keyIter.next()) {\n this.delete(result.value);\n deleteCount += 1;\n }\n return deleteCount;\n }\n}\nexports.default = AbortablePromiseCache;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst AbortablePromiseCache_1 = __importDefault(require(\"./AbortablePromiseCache\"));\nexports.default = AbortablePromiseCache_1.default;\n","'use strict';\n\nclass QuickLRU {\n\tconstructor(options = {}) {\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst value = this.oldCache.get(key);\n\t\t\tthis.oldCache.delete(key);\n\t\t\tthis._set(key, value);\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tset(key, value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, value);\n\t\t} else {\n\t\t\tthis._set(key, value);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\thas(key) {\n\t\treturn this.cache.has(key) || this.oldCache.has(key);\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this.oldCache.get(key);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tyield item;\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget size() {\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn this._size + oldCacheSize;\n\t}\n}\n\nmodule.exports = QuickLRU;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","export default {}","import { Buffer } from 'buffer';\nexport default class RemoteFile {\n async getBufferFromResponse(response) {\n if (typeof response.buffer === 'function') {\n return response.buffer();\n }\n else if (typeof response.arrayBuffer === 'function') {\n const resp = await response.arrayBuffer();\n return Buffer.from(resp);\n }\n else {\n throw new TypeError('invalid HTTP response object, has no buffer method, and no arrayBuffer method');\n }\n }\n constructor(source, opts = {}) {\n this.baseOverrides = {};\n this.url = source;\n const fetch = opts.fetch || globalThis.fetch.bind(globalThis);\n if (!fetch) {\n throw new TypeError(`no fetch function supplied, and none found in global environment`);\n }\n if (opts.overrides) {\n this.baseOverrides = opts.overrides;\n }\n this.fetchImplementation = fetch;\n }\n async fetch(input, init) {\n let response;\n try {\n response = await this.fetchImplementation(input, init);\n }\n catch (e) {\n if (`${e}`.includes('Failed to fetch')) {\n // refetch to to help work around a chrome bug (discussed in\n // generic-filehandle issue #72) in which the chrome cache returns a\n // CORS error for content in its cache. see also\n // https://github.com/GMOD/jbrowse-components/pull/1511\n console.warn(`generic-filehandle: refetching ${input} to attempt to work around chrome CORS header caching bug`);\n response = await this.fetchImplementation(input, {\n ...init,\n cache: 'reload',\n });\n }\n else {\n throw e;\n }\n }\n return response;\n }\n async read(buffer, offset = 0, length, position = 0, opts = {}) {\n const { headers = {}, signal, overrides = {} } = opts;\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n }\n else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n ...this.baseOverrides.headers,\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n };\n const response = await this.fetch(this.url, args);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n if ((response.status === 200 && position === 0) ||\n response.status === 206) {\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n return { bytesRead: bytesCopied, buffer };\n }\n if (response.status === 200) {\n throw new Error('${this.url} fetch returned status 200, expected 206');\n }\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n }\n async readFile(options = {}) {\n let encoding;\n let opts;\n if (typeof options === 'string') {\n encoding = options;\n opts = {};\n }\n else {\n encoding = options.encoding;\n opts = options;\n delete opts.encoding;\n }\n const { headers = {}, signal, overrides = {} } = opts;\n const args = {\n headers,\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n ...this.baseOverrides,\n ...overrides,\n };\n const response = await this.fetch(this.url, args);\n if (!response) {\n throw new Error('generic-filehandle failed to fetch');\n }\n if (response.status !== 200) {\n throw Object.assign(new Error(`HTTP ${response.status} fetching ${this.url}`), {\n status: response.status,\n });\n }\n if (encoding === 'utf8') {\n return response.text();\n }\n if (encoding) {\n throw new Error(`unsupported encoding: ${encoding}`);\n }\n return this.getBufferFromResponse(response);\n }\n async stat() {\n if (!this._stat) {\n const buf = Buffer.allocUnsafe(10);\n await this.read(buf, 0, 10, 0);\n if (!this._stat) {\n throw new Error(`unable to determine size of file at ${this.url}`);\n }\n }\n return this._stat;\n }\n async close() {\n return;\n }\n}\n//# sourceMappingURL=remoteFile.js.map","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","import { Buffer } from 'buffer';\n//@ts-ignore\nimport { Z_SYNC_FLUSH, Inflate } from 'pako';\n// browserify-zlib, which is the zlib shim used by default in webpacked code,\n// does not properly uncompress bgzf chunks that contain more than\n// one bgzf block, so export an unzip function that uses pako directly\n// if we are running in a browser.\nasync function unzip(inputData) {\n try {\n let strm;\n let pos = 0;\n let i = 0;\n const chunks = [];\n let totalSize = 0;\n let inflator;\n do {\n const remainingInput = inputData.subarray(pos);\n inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n pos += strm.next_in;\n chunks[i] = inflator.result;\n totalSize += chunks[i].length;\n i += 1;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n return Buffer.from(result);\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to pakounzip, except it does extra counting\n// to return the positions of compressed and decompressed\n// data offsets\nasync function unzipChunk(inputData) {\n try {\n let strm;\n let cpos = 0;\n let dpos = 0;\n const blocks = [];\n const cpositions = [];\n const dpositions = [];\n do {\n const remainingInput = inputData.slice(cpos);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = Buffer.from(inflator.result);\n blocks.push(buffer);\n cpositions.push(cpos);\n dpositions.push(dpos);\n cpos += strm.next_in;\n dpos += buffer.length;\n } while (strm.avail_in);\n const buffer = Buffer.concat(blocks);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to unzipChunk above but slices (0,minv.dataPosition) and\n// (maxv.dataPosition,end) off\nasync function unzipChunkSlice(inputData, chunk) {\n try {\n let strm;\n const { minv, maxv } = chunk;\n let cpos = minv.blockPosition;\n let dpos = minv.dataPosition;\n const chunks = [];\n const cpositions = [];\n const dpositions = [];\n let totalSize = 0;\n let i = 0;\n do {\n const remainingInput = inputData.subarray(cpos - minv.blockPosition);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = inflator.result;\n chunks.push(buffer);\n let len = buffer.length;\n cpositions.push(cpos);\n dpositions.push(dpos);\n if (chunks.length === 1 && minv.dataPosition) {\n // this is the first chunk, trim it\n chunks[0] = chunks[0].subarray(minv.dataPosition);\n len = chunks[0].length;\n }\n const origCpos = cpos;\n cpos += strm.next_in;\n dpos += len;\n if (origCpos >= maxv.blockPosition) {\n // this is the last chunk, trim it and stop decompressing\n // note if it is the same block is minv it subtracts that already\n // trimmed part of the slice length\n chunks[i] = chunks[i].subarray(0, maxv.blockPosition === minv.blockPosition\n ? maxv.dataPosition - minv.dataPosition + 1\n : maxv.dataPosition + 1);\n cpositions.push(cpos);\n dpositions.push(dpos);\n totalSize += chunks[i].length;\n break;\n }\n totalSize += chunks[i].length;\n i++;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n const buffer = Buffer.from(result);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\nfunction nodeUnzip() {\n throw new Error('nodeUnzip not implemented.');\n}\nexport { unzip, unzipChunk, unzipChunkSlice, unzip as pakoUnzip, nodeUnzip };\n//# sourceMappingURL=unzip-pako.js.map","module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n","export function longToNumber(long) {\n if (long.greaterThan(Number.MAX_SAFE_INTEGER) ||\n long.lessThan(Number.MIN_SAFE_INTEGER)) {\n throw new Error('integer overflow');\n }\n return long.toNumber();\n}\nclass AbortError extends Error {\n}\n/**\n * Properly check if the given AbortSignal is aborted.\n * Per the standard, if the signal reads as aborted,\n * this function throws either a DOMException AbortError, or a regular error\n * with a `code` attribute set to `ERR_ABORTED`.\n *\n * For convenience, passing `undefined` is a no-op\n *\n * @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute\n * @returns nothing\n */\nexport function checkAbortSignal(signal) {\n if (!signal) {\n return;\n }\n if (signal.aborted) {\n if (typeof DOMException !== 'undefined') {\n // eslint-disable-next-line no-undef\n throw new DOMException('aborted', 'AbortError');\n }\n else {\n const e = new AbortError('aborted');\n e.code = 'ERR_ABORTED';\n throw e;\n }\n }\n}\n/**\n * Skips to the next tick, then runs `checkAbortSignal`.\n * Await this to inside an otherwise synchronous loop to\n * provide a place to break when an abort signal is received.\n * @param {AbortSignal} signal\n */\nexport async function abortBreakPoint(signal) {\n await Promise.resolve();\n checkAbortSignal(signal);\n}\nexport function canMergeBlocks(chunk1, chunk2) {\n return (chunk2.minv.blockPosition - chunk1.maxv.blockPosition < 65000 &&\n chunk2.maxv.blockPosition - chunk1.minv.blockPosition < 5000000);\n}\nexport function optimizeChunks(chunks, lowest) {\n const mergedChunks = [];\n let lastChunk = null;\n if (chunks.length === 0) {\n return chunks;\n }\n chunks.sort(function (c0, c1) {\n const dif = c0.minv.blockPosition - c1.minv.blockPosition;\n if (dif !== 0) {\n return dif;\n }\n else {\n return c0.minv.dataPosition - c1.minv.dataPosition;\n }\n });\n chunks.forEach(chunk => {\n if (!lowest || chunk.maxv.compareTo(lowest) > 0) {\n if (lastChunk === null) {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n else {\n if (canMergeBlocks(lastChunk, chunk)) {\n if (chunk.maxv.compareTo(lastChunk.maxv) > 0) {\n lastChunk.maxv = chunk.maxv;\n }\n }\n else {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n }\n }\n });\n return mergedChunks;\n}\n//# sourceMappingURL=util.js.map","export default class VirtualOffset {\n constructor(blockPosition, dataPosition) {\n this.blockPosition = blockPosition; // < offset of the compressed data block\n this.dataPosition = dataPosition; // < offset into the uncompressed data\n }\n toString() {\n return `${this.blockPosition}:${this.dataPosition}`;\n }\n compareTo(b) {\n return (this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition);\n }\n static min(...args) {\n let min;\n let i = 0;\n for (; !min; i += 1) {\n min = args[i];\n }\n for (; i < args.length; i += 1) {\n if (min.compareTo(args[i]) > 0) {\n min = args[i];\n }\n }\n return min;\n }\n}\nexport function fromBytes(bytes, offset = 0, bigendian = false) {\n if (bigendian) {\n throw new Error('big-endian virtual file offsets not implemented');\n }\n return new VirtualOffset(bytes[offset + 7] * 0x10000000000 +\n bytes[offset + 6] * 0x100000000 +\n bytes[offset + 5] * 0x1000000 +\n bytes[offset + 4] * 0x10000 +\n bytes[offset + 3] * 0x100 +\n bytes[offset + 2], (bytes[offset + 1] << 8) | bytes[offset]);\n}\n//# sourceMappingURL=virtualOffset.js.map","// little class representing a chunk in the index\nexport default class Chunk {\n /**\n * @param {VirtualOffset} minv\n * @param {VirtualOffset} maxv\n * @param {number} bin\n * @param {number} [fetchedSize]\n */\n constructor(minv, maxv, bin, fetchedSize = undefined) {\n this.minv = minv;\n this.maxv = maxv;\n this.bin = bin;\n this._fetchedSize = fetchedSize;\n }\n toUniqueString() {\n return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`;\n }\n toString() {\n return this.toUniqueString();\n }\n compareTo(b) {\n return (this.minv.compareTo(b.minv) ||\n this.maxv.compareTo(b.maxv) ||\n this.bin - b.bin);\n }\n fetchedSize() {\n if (this._fetchedSize !== undefined) {\n return this._fetchedSize;\n }\n return this.maxv.blockPosition + (1 << 16) - this.minv.blockPosition;\n }\n}\n//# sourceMappingURL=chunk.js.map","export default class IndexFile {\n constructor({ filehandle, renameRefSeqs = (n) => n, }) {\n this.filehandle = filehandle;\n this.renameRefSeq = renameRefSeqs;\n }\n async getMetadata(opts = {}) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { indices, ...rest } = await this.parse(opts);\n return rest;\n }\n _findFirstData(currentFdl, virtualOffset) {\n if (currentFdl) {\n return currentFdl.compareTo(virtualOffset) > 0\n ? virtualOffset\n : currentFdl;\n }\n else {\n return virtualOffset;\n }\n }\n async parse(opts = {}) {\n if (!this.parseP) {\n this.parseP = this._parse(opts).catch(e => {\n this.parseP = undefined;\n throw e;\n });\n }\n return this.parseP;\n }\n async hasRefSeq(seqId, opts = {}) {\n return !!((await this.parse(opts)).indices[seqId] || {}).binIndex;\n }\n}\n//# sourceMappingURL=indexFile.js.map","import Long from 'long';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport { longToNumber, optimizeChunks, checkAbortSignal } from './util';\nimport IndexFile from './indexFile';\nconst TBI_MAGIC = 21578324; // TBI\\1\nconst TAD_LIDX_SHIFT = 14;\n/**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\nfunction reg2bins(beg, end) {\n beg += 1; // < convert to 1-based closed\n end -= 1;\n return [\n [0, 0],\n [1 + (beg >> 26), 1 + (end >> 26)],\n [9 + (beg >> 23), 9 + (end >> 23)],\n [73 + (beg >> 20), 73 + (end >> 20)],\n [585 + (beg >> 17), 585 + (end >> 17)],\n [4681 + (beg >> 14), 4681 + (end >> 14)],\n ];\n}\nexport default class TabixIndex extends IndexFile {\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const buf = await this.filehandle.readFile(opts);\n const bytes = await unzip(buf);\n checkAbortSignal(opts.signal);\n // check TBI magic numbers\n if (bytes.readUInt32LE(0) !== TBI_MAGIC /* \"TBI\\1\" */) {\n throw new Error('Not a TBI file');\n // TODO: do we need to support big-endian TBI files?\n }\n // number of reference sequences in the index\n const refCount = bytes.readInt32LE(4);\n const formatFlags = bytes.readInt32LE(8);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const formatOpts = {\n 0: 'generic',\n 1: 'SAM',\n 2: 'VCF',\n };\n const format = formatOpts[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(12),\n start: bytes.readInt32LE(16),\n end: bytes.readInt32LE(20),\n };\n const metaValue = bytes.readInt32LE(24);\n const depth = 5;\n const maxBinNumber = ((1 << ((depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (14 + depth * 3);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(28);\n // read sequence dictionary\n const nameSectionLength = bytes.readInt32LE(32);\n const { refNameToId, refIdToName } = this._parseNameBytes(bytes.slice(36, 36 + nameSectionLength));\n // read the indexes for each reference sequence\n let currOffset = 36 + nameSectionLength;\n let firstDataLine;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats;\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n currOffset += 4;\n if (bin > maxBinNumber + 1) {\n throw new Error('tabix index contains too many bins, please use a CSI index');\n }\n else if (bin === maxBinNumber + 1) {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n if (chunkCount === 2) {\n stats = this.parsePseudoBin(bytes, currOffset);\n }\n currOffset += 16 * chunkCount;\n }\n else {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n firstDataLine = this._findFirstData(firstDataLine, u);\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n // the linear index\n const linearCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const linearIndex = new Array(linearCount);\n for (let k = 0; k < linearCount; k += 1) {\n linearIndex[k] = fromBytes(bytes, currOffset);\n currOffset += 8;\n firstDataLine = this._findFirstData(firstDataLine, linearIndex[k]);\n }\n return { binIndex, linearIndex, stats };\n });\n return {\n indices,\n metaChar,\n maxBinNumber,\n maxRefLength,\n skipLines,\n firstDataLine,\n columnNumbers,\n coordinateType,\n format,\n refIdToName,\n refNameToId,\n maxBlockSize: 1 << 16,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 16, offset + 24), true));\n return { lineCount };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n const minOffset = ba.linearIndex.length\n ? ba.linearIndex[min >> TAD_LIDX_SHIFT >= ba.linearIndex.length\n ? ba.linearIndex.length - 1\n : min >> TAD_LIDX_SHIFT]\n : new VirtualOffset(0, 0);\n if (!minOffset) {\n console.warn('querying outside of possible tabix range');\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n // Use the linear index to find minimum file position of chunks that could\n // contain alignments in the region\n const nintv = ba.linearIndex.length;\n let lowest = null;\n const minLin = Math.min(min >> 14, nintv - 1);\n const maxLin = Math.min(max >> 14, nintv - 1);\n for (let i = minLin; i <= maxLin; ++i) {\n const vp = ba.linearIndex[i];\n if (vp) {\n if (!lowest || vp.compareTo(lowest) < 0) {\n lowest = vp;\n }\n }\n }\n return optimizeChunks(chunks, lowest);\n }\n}\n//# sourceMappingURL=tbi.js.map","import Long from 'long';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { longToNumber, optimizeChunks } from './util';\nimport IndexFile from './indexFile';\nconst CSI1_MAGIC = 21582659; // CSI\\1\nconst CSI2_MAGIC = 38359875; // CSI\\2\nfunction lshift(num, bits) {\n return num * 2 ** bits;\n}\nfunction rshift(num, bits) {\n return Math.floor(num / 2 ** bits);\n}\nexport default class CSI extends IndexFile {\n constructor(args) {\n super(args);\n this.maxBinNumber = 0;\n this.depth = 0;\n this.minShift = 0;\n }\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n async indexCov() {\n throw new Error('CSI indexes do not support indexcov');\n }\n parseAuxData(bytes, offset) {\n const formatFlags = bytes.readInt32LE(offset);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const format = { 0: 'generic', 1: 'SAM', 2: 'VCF' }[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(offset + 4),\n start: bytes.readInt32LE(offset + 8),\n end: bytes.readInt32LE(offset + 12),\n };\n const metaValue = bytes.readInt32LE(offset + 16);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(offset + 20);\n const nameSectionLength = bytes.readInt32LE(offset + 24);\n const { refIdToName, refNameToId } = this._parseNameBytes(bytes.slice(offset + 28, offset + 28 + nameSectionLength));\n return {\n refIdToName,\n refNameToId,\n skipLines,\n metaChar,\n columnNumbers,\n format,\n coordinateType,\n };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const bytes = await unzip((await this.filehandle.readFile(opts)));\n // check TBI magic numbers\n let csiVersion;\n if (bytes.readUInt32LE(0) === CSI1_MAGIC) {\n csiVersion = 1;\n }\n else if (bytes.readUInt32LE(0) === CSI2_MAGIC) {\n csiVersion = 2;\n }\n else {\n throw new Error('Not a CSI file');\n // TODO: do we need to support big-endian CSI files?\n }\n this.minShift = bytes.readInt32LE(4);\n this.depth = bytes.readInt32LE(8);\n this.maxBinNumber = ((1 << ((this.depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (this.minShift + this.depth * 3);\n const auxLength = bytes.readInt32LE(12);\n const aux = auxLength && auxLength >= 30\n ? this.parseAuxData(bytes, 16)\n : {\n refIdToName: [],\n refNameToId: {},\n metaChar: null,\n columnNumbers: { ref: 0, start: 1, end: 2 },\n coordinateType: 'zero-based-half-open',\n format: 'generic',\n };\n const refCount = bytes.readInt32LE(16 + auxLength);\n // read the indexes for each reference sequence\n let firstDataLine;\n let currOffset = 16 + auxLength + 4;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats; // < provided by parsing a pseudo-bin, if present\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n if (bin > this.maxBinNumber) {\n // this is a fake bin that actually has stats information\n // about the reference sequence in it\n stats = this.parsePseudoBin(bytes, currOffset + 4);\n currOffset += 4 + 8 + 4 + 16 + 16;\n }\n else {\n const loffset = fromBytes(bytes, currOffset + 4);\n firstDataLine = this._findFirstData(firstDataLine, loffset);\n const chunkCount = bytes.readInt32LE(currOffset + 12);\n currOffset += 16;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n // this._findFirstData(data, u)\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n return { binIndex, stats };\n });\n return {\n ...aux,\n csi: true,\n refCount,\n maxBlockSize: 1 << 16,\n firstDataLine,\n csiVersion,\n indices,\n depth: this.depth,\n maxBinNumber: this.maxBinNumber,\n maxRefLength,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 28, offset + 36), true));\n return { lineCount };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = this.reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n return optimizeChunks(chunks, new VirtualOffset(0, 0));\n }\n /**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\n reg2bins(beg, end) {\n beg -= 1; // < convert to 1-based closed\n if (beg < 1) {\n beg = 1;\n }\n if (end > 2 ** 50) {\n end = 2 ** 34;\n } // 17 GiB ought to be enough for anybody\n end -= 1;\n let l = 0;\n let t = 0;\n let s = this.minShift + this.depth * 3;\n const bins = [];\n for (; l <= this.depth; s -= 3, t += lshift(1, l * 3), l += 1) {\n const b = t + rshift(beg, s);\n const e = t + rshift(end, s);\n if (e - b + bins.length > this.maxBinNumber) {\n throw new Error(`query ${beg}-${end} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);\n }\n bins.push([b, e]);\n }\n return bins;\n }\n}\n//# sourceMappingURL=csi.js.map","import AbortablePromiseCache from 'abortable-promise-cache';\nimport LRU from 'quick-lru';\nimport { Buffer } from 'buffer';\nimport { LocalFile } from 'generic-filehandle';\nimport { unzip, unzipChunkSlice } from '@gmod/bgzf-filehandle';\nimport { checkAbortSignal } from './util';\nimport TBI from './tbi';\nimport CSI from './csi';\nconst decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8') : undefined;\nfunction timeout(time) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\nexport default class TabixIndexedFile {\n /**\n * @param {object} args\n * @param {string} [args.path]\n * @param {filehandle} [args.filehandle]\n * @param {string} [args.tbiPath]\n * @param {filehandle} [args.tbiFilehandle]\n * @param {string} [args.csiPath]\n * @param {filehandle} [args.csiFilehandle]\n * @param {number} [args.yieldTime] yield to main thread after N milliseconds if reading features is taking a long time to avoid hanging main thread\n * @param {function} [args.renameRefSeqs] optional function with sig `string => string` to transform\n * reference sequence names for the purpose of indexing and querying. note that the data that is returned is\n * not altered, just the names of the reference sequences that are used for querying.\n */\n constructor({ path, filehandle, tbiPath, tbiFilehandle, csiPath, csiFilehandle, yieldTime = 500, chunkSizeLimit = 50000000, renameRefSeqs = n => n, chunkCacheSize = 5 * 2 ** 20, }) {\n if (filehandle) {\n this.filehandle = filehandle;\n }\n else if (path) {\n this.filehandle = new LocalFile(path);\n }\n else {\n throw new TypeError('must provide either filehandle or path');\n }\n if (tbiFilehandle) {\n this.index = new TBI({\n filehandle: tbiFilehandle,\n renameRefSeqs,\n });\n }\n else if (csiFilehandle) {\n this.index = new CSI({\n filehandle: csiFilehandle,\n renameRefSeqs,\n });\n }\n else if (tbiPath) {\n this.index = new TBI({\n filehandle: new LocalFile(tbiPath),\n renameRefSeqs,\n });\n }\n else if (csiPath) {\n this.index = new CSI({\n filehandle: new LocalFile(csiPath),\n renameRefSeqs,\n });\n }\n else if (path) {\n this.index = new TBI({\n filehandle: new LocalFile(`${path}.tbi`),\n renameRefSeqs,\n });\n }\n else {\n throw new TypeError('must provide one of tbiFilehandle, tbiPath, csiFilehandle, or csiPath');\n }\n this.chunkSizeLimit = chunkSizeLimit;\n this.renameRefSeq = renameRefSeqs;\n this.yieldTime = yieldTime;\n this.chunkCache = new AbortablePromiseCache({\n cache: new LRU({ maxSize: Math.floor(chunkCacheSize / (1 << 16)) }),\n fill: (args, signal) => this.readChunk(args, { signal }),\n });\n }\n /**\n * @param refName name of the reference sequence\n * @param start start of the region (in 0-based half-open coordinates)\n * @param end end of the region (in 0-based half-open coordinates)\n * @param opts callback called for each line in the region. can also pass a object param containing obj.lineCallback, obj.signal, etc\n * @returns promise that is resolved when the whole read is finished, rejected on error\n */\n async getLines(refName, start, end, opts) {\n let signal;\n let options = {};\n let callback;\n if (typeof opts === 'undefined') {\n throw new TypeError('line callback must be provided');\n }\n if (typeof opts === 'function') {\n callback = opts;\n }\n else {\n options = opts;\n callback = opts.lineCallback;\n }\n if (refName === undefined) {\n throw new TypeError('must provide a reference sequence name');\n }\n if (!callback) {\n throw new TypeError('line callback must be provided');\n }\n const metadata = await this.index.getMetadata(options);\n checkAbortSignal(signal);\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = metadata.maxRefLength;\n }\n if (!(start <= end)) {\n throw new TypeError('invalid start and end coordinates. start must be less than or equal to end');\n }\n if (start === end) {\n return;\n }\n const chunks = await this.index.blocksForRange(refName, start, end, options);\n checkAbortSignal(signal);\n // check the chunks for any that are over the size limit. if\n // any are, don't fetch any of them\n for (let i = 0; i < chunks.length; i += 1) {\n const size = chunks[i].fetchedSize();\n if (size > this.chunkSizeLimit) {\n throw new Error(`Too much data. Chunk size ${size.toLocaleString()} bytes exceeds chunkSizeLimit of ${this.chunkSizeLimit.toLocaleString()}.`);\n }\n }\n // now go through each chunk and parse and filter the lines out of it\n let last = Date.now();\n for (let chunkNum = 0; chunkNum < chunks.length; chunkNum += 1) {\n let previousStartCoordinate;\n const c = chunks[chunkNum];\n const { buffer, cpositions, dpositions } = await this.chunkCache.get(c.toString(), c);\n checkAbortSignal(signal);\n let blockStart = 0;\n let pos = 0;\n while (blockStart < buffer.length) {\n const n = buffer.indexOf('\\n', blockStart);\n if (n === -1) {\n break;\n }\n const b = buffer.slice(blockStart, n);\n const line = (decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString();\n if (dpositions) {\n while (blockStart + c.minv.dataPosition >= dpositions[pos++]) { }\n pos--;\n }\n // filter the line for whether it is within the requested range\n const { startCoordinate, overlaps } = this.checkLine(metadata, refName, start, end, line);\n // do a small check just to make sure that the lines are really sorted\n // by start coordinate\n if (previousStartCoordinate !== undefined &&\n startCoordinate !== undefined &&\n previousStartCoordinate > startCoordinate) {\n throw new Error(`Lines not sorted by start coordinate (${previousStartCoordinate} > ${startCoordinate}), this file is not usable with Tabix.`);\n }\n previousStartCoordinate = startCoordinate;\n if (overlaps) {\n callback(line.trim(), \n // cpositions[pos] refers to actual file offset of a bgzip block boundaries\n //\n // we multiply by (1 <<8) in order to make sure each block has a \"unique\"\n // address space so that data in that block could never overlap\n //\n // then the blockStart-dpositions is an uncompressed file offset from\n // that bgzip block boundary, and since the cpositions are multiplied by\n // (1 << 8) these uncompressed offsets get a unique space\n cpositions[pos] * (1 << 8) +\n (blockStart - dpositions[pos]) +\n c.minv.dataPosition +\n 1);\n }\n else if (startCoordinate !== undefined && startCoordinate >= end) {\n // the lines were overlapping the region, but now have stopped, so\n // we must be at the end of the relevant data and we can stop\n // processing data now\n return;\n }\n // yield if we have emitted beyond the yield limit\n if (this.yieldTime && last - Date.now() > this.yieldTime) {\n last = Date.now();\n checkAbortSignal(signal);\n await timeout(1);\n }\n blockStart = n + 1;\n }\n }\n }\n async getMetadata(opts = {}) {\n return this.index.getMetadata(opts);\n }\n /**\n * get a buffer containing the \"header\" region of\n * the file, which are the bytes up to the first\n * non-meta line\n */\n async getHeaderBuffer(opts = {}) {\n const { firstDataLine, metaChar, maxBlockSize } = await this.getMetadata(opts);\n checkAbortSignal(opts.signal);\n const maxFetch = ((firstDataLine === null || firstDataLine === void 0 ? void 0 : firstDataLine.blockPosition) || 0) + maxBlockSize;\n // TODO: what if we don't have a firstDataLine, and the header\n // actually takes up more than one block? this case is not covered here\n let bytes = await this._readRegion(0, maxFetch, opts);\n checkAbortSignal(opts.signal);\n try {\n bytes = await unzip(bytes);\n }\n catch (e) {\n console.error(e);\n throw new Error(\n //@ts-ignore\n `error decompressing block ${e.code} at 0 (length ${maxFetch}) ${e}`);\n }\n // trim off lines after the last non-meta line\n if (metaChar) {\n // trim backward from the end\n let lastNewline = -1;\n const newlineByte = '\\n'.charCodeAt(0);\n const metaByte = metaChar.charCodeAt(0);\n for (let i = 0; i < bytes.length; i += 1) {\n if (i === lastNewline + 1 && bytes[i] !== metaByte) {\n break;\n }\n if (bytes[i] === newlineByte) {\n lastNewline = i;\n }\n }\n bytes = bytes.slice(0, lastNewline + 1);\n }\n return bytes;\n }\n /**\n * get a string containing the \"header\" region of the\n * file, is the portion up to the first non-meta line\n *\n * @returns {Promise} for a string\n */\n async getHeader(opts = {}) {\n const bytes = await this.getHeaderBuffer(opts);\n return bytes.toString('utf8');\n }\n /**\n * get an array of reference sequence names, in the order in which\n * they occur in the file. reference sequence renaming is not applied\n * to these names.\n */\n async getReferenceSequenceNames(opts = {}) {\n const metadata = await this.getMetadata(opts);\n return metadata.refIdToName;\n }\n /**\n * @param {object} metadata metadata object from the parsed index,\n * containing columnNumbers, metaChar, and format\n * @param {string} regionRefName\n * @param {number} regionStart region start coordinate (0-based-half-open)\n * @param {number} regionEnd region end coordinate (0-based-half-open)\n * @param {array[string]} line\n * @returns {object} like `{startCoordinate, overlaps}`. overlaps is boolean,\n * true if line is a data line that overlaps the given region\n */\n checkLine(metadata, regionRefName, regionStart, regionEnd, line) {\n const { columnNumbers, metaChar, coordinateType, format } = metadata;\n // skip meta lines\n if (line.charAt(0) === metaChar) {\n return { overlaps: false };\n }\n // check ref/start/end using column metadata from index\n let { ref, start, end } = columnNumbers;\n if (!ref) {\n ref = 0;\n }\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = 0;\n }\n if (format === 'VCF') {\n end = 8;\n }\n const maxColumn = Math.max(ref, start, end);\n // this code is kind of complex, but it is fairly fast.\n // basically, we want to avoid doing a split, because if the lines are really long\n // that could lead to us allocating a bunch of extra memory, which is slow\n let currentColumnNumber = 1; // cols are numbered starting at 1 in the index metadata\n let currentColumnStart = 0;\n let refSeq = '';\n let startCoordinate = -Infinity;\n for (let i = 0; i < line.length + 1; i += 1) {\n if (line[i] === '\\t' || i === line.length) {\n if (currentColumnNumber === ref) {\n if (this.renameRefSeq(line.slice(currentColumnStart, i)) !==\n regionRefName) {\n return { overlaps: false };\n }\n }\n else if (currentColumnNumber === start) {\n startCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n // we convert to 0-based-half-open\n if (coordinateType === '1-based-closed') {\n startCoordinate -= 1;\n }\n if (startCoordinate >= regionEnd) {\n return { startCoordinate, overlaps: false };\n }\n if (end === 0 || end === start) {\n // if we have no end, we assume the feature is 1 bp long\n if (startCoordinate + 1 <= regionStart) {\n return { startCoordinate, overlaps: false };\n }\n }\n }\n else if (format === 'VCF' && currentColumnNumber === 4) {\n refSeq = line.slice(currentColumnStart, i);\n }\n else if (currentColumnNumber === end) {\n let endCoordinate;\n // this will never match if there is no end column\n if (format === 'VCF') {\n endCoordinate = this._getVcfEnd(startCoordinate, refSeq, line.slice(currentColumnStart, i));\n }\n else {\n endCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n }\n if (endCoordinate <= regionStart) {\n return { overlaps: false };\n }\n }\n currentColumnStart = i + 1;\n currentColumnNumber += 1;\n if (currentColumnNumber > maxColumn) {\n break;\n }\n }\n }\n return { startCoordinate, overlaps: true };\n }\n _getVcfEnd(startCoordinate, refSeq, info) {\n let endCoordinate = startCoordinate + refSeq.length;\n // ignore TRA features as they specify CHR2 and END\n // as being on a different chromosome\n // if CHR2 is on the same chromosome, still ignore it\n // because there should be another pairwise feature\n // at the end of this one\n const isTRA = info.indexOf('SVTYPE=TRA') !== -1;\n if (info[0] !== '.' && !isTRA) {\n let prevChar = ';';\n for (let j = 0; j < info.length; j += 1) {\n if (prevChar === ';' && info.slice(j, j + 4) === 'END=') {\n let valueEnd = info.indexOf(';', j);\n if (valueEnd === -1) {\n valueEnd = info.length;\n }\n endCoordinate = parseInt(info.slice(j + 4, valueEnd), 10);\n break;\n }\n prevChar = info[j];\n }\n }\n else if (isTRA) {\n return startCoordinate + 1;\n }\n return endCoordinate;\n }\n /**\n * return the approximate number of data lines in the given reference sequence\n * @param refSeq reference sequence name\n * @returns number of data lines present on that reference sequence\n */\n async lineCount(refName, opts = {}) {\n return this.index.lineCount(refName, opts);\n }\n async _readRegion(pos, size, opts = {}) {\n const b = Buffer.alloc(size);\n const { bytesRead, buffer } = await this.filehandle.read(b, 0, size, pos, opts);\n return buffer.slice(0, bytesRead);\n }\n /**\n * read and uncompress the data in a chunk (composed of one or more\n * contiguous bgzip blocks) of the file\n */\n async readChunk(c, opts = {}) {\n // fetch the uncompressed data, uncompress carefully a block at a time,\n // and stop when done\n const data = await this._readRegion(c.minv.blockPosition, c.fetchedSize(), opts);\n try {\n return unzipChunkSlice(data, c);\n }\n catch (e) {\n throw new Error(`error decompressing c ${c.toString()} ${e}`);\n }\n }\n}\n//# sourceMappingURL=tabixIndexedFile.js.map","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import toNumber from './toNumber.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nexport default toFinite;\n","import toFinite from './toFinite.js';\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nexport default toInteger;\n","import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nexport default copyArray;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n","import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n","import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nexport default isIterateeCall;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n","import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n","import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n","import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n","import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n","import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n","import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n","import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n","import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n","/**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\nfunction baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n}\n\nexport default baseClamp;\n","import arrayMap from './_arrayMap.js';\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nexport default baseValues;\n","import baseValues from './_baseValues.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n}\n\nexport default values;\n","/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeFloor = Math.floor,\n nativeRandom = Math.random;\n\n/**\n * The base implementation of `_.random` without support for returning\n * floating-point numbers.\n *\n * @private\n * @param {number} lower The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the random number.\n */\nfunction baseRandom(lower, upper) {\n return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n}\n\nexport default baseRandom;\n","import baseRandom from './_baseRandom.js';\n\n/**\n * A specialized version of `_.shuffle` which mutates and sets the size of `array`.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @param {number} [size=array.length] The size of `array`.\n * @returns {Array} Returns `array`.\n */\nfunction shuffleSelf(array, size) {\n var index = -1,\n length = array.length,\n lastIndex = length - 1;\n\n size = size === undefined ? length : size;\n while (++index < size) {\n var rand = baseRandom(index, lastIndex),\n value = array[rand];\n\n array[rand] = array[index];\n array[index] = value;\n }\n array.length = size;\n return array;\n}\n\nexport default shuffleSelf;\n","import baseClamp from './_baseClamp.js';\nimport copyArray from './_copyArray.js';\nimport shuffleSelf from './_shuffleSelf.js';\n\n/**\n * A specialized version of `_.sampleSize` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction arraySampleSize(array, n) {\n return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));\n}\n\nexport default arraySampleSize;\n","import baseClamp from './_baseClamp.js';\nimport shuffleSelf from './_shuffleSelf.js';\nimport values from './values.js';\n\n/**\n * The base implementation of `_.sampleSize` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction baseSampleSize(collection, n) {\n var array = values(collection);\n return shuffleSelf(array, baseClamp(n, 0, array.length));\n}\n\nexport default baseSampleSize;\n","import arraySampleSize from './_arraySampleSize.js';\nimport baseSampleSize from './_baseSampleSize.js';\nimport isArray from './isArray.js';\nimport isIterateeCall from './_isIterateeCall.js';\nimport toInteger from './toInteger.js';\n\n/**\n * Gets `n` random elements at unique keys from `collection` up to the\n * size of `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @param {number} [n=1] The number of elements to sample.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the random elements.\n * @example\n *\n * _.sampleSize([1, 2, 3], 2);\n * // => [3, 1]\n *\n * _.sampleSize([1, 2, 3], 4);\n * // => [2, 3, 1]\n */\nfunction sampleSize(collection, n, guard) {\n if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n var func = isArray(collection) ? arraySampleSize : baseSampleSize;\n return func(collection, n);\n}\n\nexport default sampleSize;\n","'use strict';\n\nmodule.exports = value => {\n\tif (!value) {\n\t\treturn false;\n\t}\n\n\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\tif (typeof Symbol.observable === 'symbol' && typeof value[Symbol.observable] === 'function') {\n\t\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\t\treturn value === value[Symbol.observable]();\n\t}\n\n\tif (typeof value['@@observable'] === 'function') {\n\t\treturn value === value['@@observable']();\n\t}\n\n\treturn false;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultSerializer = exports.extendSerializer = void 0;\nfunction extendSerializer(extend, implementation) {\n const fallbackDeserializer = extend.deserialize.bind(extend);\n const fallbackSerializer = extend.serialize.bind(extend);\n return {\n deserialize(message) {\n return implementation.deserialize(message, fallbackDeserializer);\n },\n serialize(input) {\n return implementation.serialize(input, fallbackSerializer);\n }\n };\n}\nexports.extendSerializer = extendSerializer;\nconst DefaultErrorSerializer = {\n deserialize(message) {\n return Object.assign(Error(message.message), {\n name: message.name,\n stack: message.stack\n });\n },\n serialize(error) {\n return {\n __error_marker: \"$$error\",\n message: error.message,\n name: error.name,\n stack: error.stack\n };\n }\n};\nconst isSerializedError = (thing) => thing && typeof thing === \"object\" && \"__error_marker\" in thing && thing.__error_marker === \"$$error\";\nexports.DefaultSerializer = {\n deserialize(message) {\n if (isSerializedError(message)) {\n return DefaultErrorSerializer.deserialize(message);\n }\n else {\n return message;\n }\n },\n serialize(input) {\n if (input instanceof Error) {\n return DefaultErrorSerializer.serialize(input);\n }\n else {\n return input;\n }\n }\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.serialize = exports.deserialize = exports.registerSerializer = void 0;\nconst serializers_1 = require(\"./serializers\");\nlet registeredSerializer = serializers_1.DefaultSerializer;\nfunction registerSerializer(serializer) {\n registeredSerializer = serializers_1.extendSerializer(registeredSerializer, serializer);\n}\nexports.registerSerializer = registerSerializer;\nfunction deserialize(message) {\n return registeredSerializer.deserialize(message);\n}\nexports.deserialize = deserialize;\nfunction serialize(input) {\n return registeredSerializer.serialize(input);\n}\nexports.serialize = serialize;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.$worker = exports.$transferable = exports.$terminate = exports.$events = exports.$errors = void 0;\nexports.$errors = Symbol(\"thread.errors\");\nexports.$events = Symbol(\"thread.events\");\nexports.$terminate = Symbol(\"thread.terminate\");\nexports.$transferable = Symbol(\"thread.transferable\");\nexports.$worker = Symbol(\"thread.worker\");\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Transfer = exports.isTransferDescriptor = void 0;\nconst symbols_1 = require(\"./symbols\");\nfunction isTransferable(thing) {\n if (!thing || typeof thing !== \"object\")\n return false;\n // Don't check too thoroughly, since the list of transferable things in JS might grow over time\n return true;\n}\nfunction isTransferDescriptor(thing) {\n return thing && typeof thing === \"object\" && thing[symbols_1.$transferable];\n}\nexports.isTransferDescriptor = isTransferDescriptor;\nfunction Transfer(payload, transferables) {\n if (!transferables) {\n if (!isTransferable(payload))\n throw Error();\n transferables = [payload];\n }\n return {\n [symbols_1.$transferable]: true,\n send: payload,\n transferables\n };\n}\nexports.Transfer = Transfer;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WorkerMessageType = exports.MasterMessageType = void 0;\n/////////////////////////////\n// Messages sent by master:\nvar MasterMessageType;\n(function (MasterMessageType) {\n MasterMessageType[\"cancel\"] = \"cancel\";\n MasterMessageType[\"run\"] = \"run\";\n})(MasterMessageType = exports.MasterMessageType || (exports.MasterMessageType = {}));\n////////////////////////////\n// Messages sent by worker:\nvar WorkerMessageType;\n(function (WorkerMessageType) {\n WorkerMessageType[\"error\"] = \"error\";\n WorkerMessageType[\"init\"] = \"init\";\n WorkerMessageType[\"result\"] = \"result\";\n WorkerMessageType[\"running\"] = \"running\";\n WorkerMessageType[\"uncaughtError\"] = \"uncaughtError\";\n})(WorkerMessageType = exports.WorkerMessageType || (exports.WorkerMessageType = {}));\n","\"use strict\";\n/// \n// tslint:disable no-shadowed-variable\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst isWorkerRuntime = function isWorkerRuntime() {\n const isWindowContext = typeof self !== \"undefined\" && typeof Window !== \"undefined\" && self instanceof Window;\n return typeof self !== \"undefined\" && self.postMessage && !isWindowContext ? true : false;\n};\nconst postMessageToMaster = function postMessageToMaster(data, transferList) {\n self.postMessage(data, transferList);\n};\nconst subscribeToMasterMessages = function subscribeToMasterMessages(onMessage) {\n const messageHandler = (messageEvent) => {\n onMessage(messageEvent.data);\n };\n const unsubscribe = () => {\n self.removeEventListener(\"message\", messageHandler);\n };\n self.addEventListener(\"message\", messageHandler);\n return unsubscribe;\n};\nexports.default = {\n isWorkerRuntime,\n postMessageToMaster,\n subscribeToMasterMessages\n};\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.expose = exports.isWorkerRuntime = exports.Transfer = exports.registerSerializer = void 0;\nconst is_observable_1 = __importDefault(require(\"is-observable\"));\nconst common_1 = require(\"../common\");\nconst transferable_1 = require(\"../transferable\");\nconst messages_1 = require(\"../types/messages\");\nconst implementation_1 = __importDefault(require(\"./implementation\"));\nvar common_2 = require(\"../common\");\nObject.defineProperty(exports, \"registerSerializer\", { enumerable: true, get: function () { return common_2.registerSerializer; } });\nvar transferable_2 = require(\"../transferable\");\nObject.defineProperty(exports, \"Transfer\", { enumerable: true, get: function () { return transferable_2.Transfer; } });\n/** Returns `true` if this code is currently running in a worker. */\nexports.isWorkerRuntime = implementation_1.default.isWorkerRuntime;\nlet exposeCalled = false;\nconst activeSubscriptions = new Map();\nconst isMasterJobCancelMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.cancel;\nconst isMasterJobRunMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.run;\n/**\n * There are issues with `is-observable` not recognizing zen-observable's instances.\n * We are using `observable-fns`, but it's based on zen-observable, too.\n */\nconst isObservable = (thing) => is_observable_1.default(thing) || isZenObservable(thing);\nfunction isZenObservable(thing) {\n return thing && typeof thing === \"object\" && typeof thing.subscribe === \"function\";\n}\nfunction deconstructTransfer(thing) {\n return transferable_1.isTransferDescriptor(thing)\n ? { payload: thing.send, transferables: thing.transferables }\n : { payload: thing, transferables: undefined };\n}\nfunction postFunctionInitMessage() {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"function\"\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postModuleInitMessage(methodNames) {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"module\",\n methods: methodNames\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postJobErrorMessage(uid, rawError) {\n const { payload: error, transferables } = deconstructTransfer(rawError);\n const errorMessage = {\n type: messages_1.WorkerMessageType.error,\n uid,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage, transferables);\n}\nfunction postJobResultMessage(uid, completed, resultValue) {\n const { payload, transferables } = deconstructTransfer(resultValue);\n const resultMessage = {\n type: messages_1.WorkerMessageType.result,\n uid,\n complete: completed ? true : undefined,\n payload\n };\n implementation_1.default.postMessageToMaster(resultMessage, transferables);\n}\nfunction postJobStartMessage(uid, resultType) {\n const startMessage = {\n type: messages_1.WorkerMessageType.running,\n uid,\n resultType\n };\n implementation_1.default.postMessageToMaster(startMessage);\n}\nfunction postUncaughtErrorMessage(error) {\n try {\n const errorMessage = {\n type: messages_1.WorkerMessageType.uncaughtError,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage);\n }\n catch (subError) {\n // tslint:disable-next-line no-console\n console.error(\"Not reporting uncaught error back to master thread as it \" +\n \"occured while reporting an uncaught error already.\" +\n \"\\nLatest error:\", subError, \"\\nOriginal error:\", error);\n }\n}\nfunction runFunction(jobUID, fn, args) {\n return __awaiter(this, void 0, void 0, function* () {\n let syncResult;\n try {\n syncResult = fn(...args);\n }\n catch (error) {\n return postJobErrorMessage(jobUID, error);\n }\n const resultType = isObservable(syncResult) ? \"observable\" : \"promise\";\n postJobStartMessage(jobUID, resultType);\n if (isObservable(syncResult)) {\n const subscription = syncResult.subscribe(value => postJobResultMessage(jobUID, false, common_1.serialize(value)), error => {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n activeSubscriptions.delete(jobUID);\n }, () => {\n postJobResultMessage(jobUID, true);\n activeSubscriptions.delete(jobUID);\n });\n activeSubscriptions.set(jobUID, subscription);\n }\n else {\n try {\n const result = yield syncResult;\n postJobResultMessage(jobUID, true, common_1.serialize(result));\n }\n catch (error) {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n }\n }\n });\n}\n/**\n * Expose a function or a module (an object whose values are functions)\n * to the main thread. Must be called exactly once in every worker thread\n * to signal its API to the main thread.\n *\n * @param exposed Function or object whose values are functions\n */\nfunction expose(exposed) {\n if (!implementation_1.default.isWorkerRuntime()) {\n throw Error(\"expose() called in the master thread.\");\n }\n if (exposeCalled) {\n throw Error(\"expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.\");\n }\n exposeCalled = true;\n if (typeof exposed === \"function\") {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && !messageData.method) {\n runFunction(messageData.uid, exposed, messageData.args.map(common_1.deserialize));\n }\n });\n postFunctionInitMessage();\n }\n else if (typeof exposed === \"object\" && exposed) {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && messageData.method) {\n runFunction(messageData.uid, exposed[messageData.method], messageData.args.map(common_1.deserialize));\n }\n });\n const methodNames = Object.keys(exposed).filter(key => typeof exposed[key] === \"function\");\n postModuleInitMessage(methodNames);\n }\n else {\n throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${exposed}`);\n }\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobCancelMessage(messageData)) {\n const jobUID = messageData.uid;\n const subscription = activeSubscriptions.get(jobUID);\n if (subscription) {\n subscription.unsubscribe();\n activeSubscriptions.delete(jobUID);\n }\n }\n });\n}\nexports.expose = expose;\nif (typeof self !== \"undefined\" && typeof self.addEventListener === \"function\" && implementation_1.default.isWorkerRuntime()) {\n self.addEventListener(\"error\", event => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(event.error || event), 250);\n });\n self.addEventListener(\"unhandledrejection\", event => {\n const error = event.reason;\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\nif (typeof process !== \"undefined\" && typeof process.on === \"function\" && implementation_1.default.isWorkerRuntime()) {\n process.on(\"uncaughtException\", (error) => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n });\n process.on(\"unhandledRejection\", (error) => {\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\n","import WorkerContext from \"./dist/worker/index.js\"\n\nexport const expose = WorkerContext.expose\nexport const registerSerializer = WorkerContext.registerSerializer\nexport const Transfer = WorkerContext.Transfer\n","export default function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import ascending from \"./ascending.js\";\n\nexport default function(f) {\n let delta = f;\n let compare = f;\n\n if (f.length === 1) {\n delta = (d, x) => f(d) - x;\n compare = ascendingComparator(f);\n }\n\n function left(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function right(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n\n function center(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction ascendingComparator(f) {\n return (d, x) => ascending(f(d), x);\n}\n","import { bisector } from 'd3-array';\nimport { RemoteFile as _RemoteFile } from 'generic-filehandle';\n\nimport type * as HiGlass from '@higlass/types';\nimport type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema';\n\nexport type CommonDataConfig = {\n assembly: Assembly;\n x?: string;\n xe?: string;\n x1?: string;\n x1e?: string;\n urlFetchOptions?: RequestInit;\n};\n\nexport class DataSource {\n chromInfo: ExtendedChromInfo;\n tilesetInfo: ReturnType;\n\n constructor(public file: File, chromSizes: ChromSizes, public options: Options) {\n this.chromInfo = sizesToChromInfo(chromSizes);\n this.tilesetInfo = tilesetInfoFromChromInfo(this.chromInfo);\n }\n}\n\n/**\n * Filter data before sending to a track considering the visible genomic area in the track.\n * TODO(2022-Jul-13): Consider genomic `y` channels as well.\n */\nexport function filterUsingGenoPos(\n data: Datum[],\n [minX, maxX]: [number, number],\n config: Omit\n) {\n const { x, xe, x1, x1e } = config;\n const definedXFields = [x, xe, x1, x1e].filter(f => f) as string[];\n return data.filter((d: Datum) => {\n if (definedXFields.length === 0) {\n // no filter applies\n return true;\n } else if (definedXFields.length === 1) {\n // filter based on one genomic position\n const value = +d[definedXFields[0]];\n return typeof value === 'number' && minX < value && value <= maxX;\n } else {\n // filter based on two genomic positions, i.e., check overlaps\n const values = definedXFields.map(f => +d[f]).filter(v => !isNaN(v));\n const minValue = Math.min(...values);\n const maxValue = Math.max(...values);\n return minX <= maxValue && minValue <= maxX;\n }\n });\n}\n\nconst chromInfoBisector = bisector((d: { pos: number }) => d.pos).left;\n\nconst chrToAbs = (chrom: string, chromPos: number, chromInfo: HiGlass.ChromInfo) =>\n chromInfo.chrPositions[chrom].pos + chromPos;\n\nconst absToChr = (absPosition: number, chromInfo: HiGlass.ChromInfo) => {\n if (!chromInfo || !chromInfo.cumPositions || !chromInfo.cumPositions.length) {\n return null;\n }\n\n let insertPoint = chromInfoBisector(chromInfo.cumPositions, absPosition);\n const lastChr = chromInfo.cumPositions[chromInfo.cumPositions.length - 1].chr;\n const lastLength = chromInfo.chromLengths[lastChr];\n\n // @ts-expect-error\n insertPoint -= insertPoint > 0 && 1;\n\n let chrPosition = Math.floor(absPosition - chromInfo.cumPositions[insertPoint].pos);\n let offset = 0;\n\n if (chrPosition < 0) {\n // before the start of the genome\n offset = chrPosition - 1;\n chrPosition = 1;\n }\n\n if (insertPoint === chromInfo.cumPositions.length - 1 && chrPosition > lastLength) {\n // beyond the last chromosome\n offset = chrPosition - lastLength;\n chrPosition = lastLength;\n }\n\n return [chromInfo.cumPositions[insertPoint].chr, chrPosition, offset, insertPoint] as const;\n};\n\n/**\n * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`.\n * @param chrName A chromosome name to be sanitized\n * @param assembly A genome assembly of the data\n * @param chromosomePrefix A prefix string that can be replaced to 'chr'\n * @returns\n */\nexport function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string) {\n if (Array.isArray(assembly)) {\n // this is a custom assembly, so use this as is\n return chrName;\n }\n\n // For assemblies in Gosling, we use the `chr` prefix consistently\n if (chromosomePrefix) {\n // `hs1` --> `chr1`\n chrName = chrName.replace(chromosomePrefix, 'chr');\n } else if (!chrName.includes('chr')) {\n // `1` --> `chr1`\n chrName = `chr${chrName}`;\n }\n return chrName;\n}\n\nexport type ExtendedChromInfo = HiGlass.ChromInfo & {\n absToChr(absPos: number): ReturnType | null;\n chrToAbs(chr: [name: string, pos: number]): number | null;\n};\n\nexport function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize = 1024) {\n return {\n tile_size: tileSize,\n bins_per_dimension: tileSize,\n max_zoom: Math.ceil(Math.log(chromInfo.totalLength / tileSize) / Math.log(2)),\n max_width: chromInfo.totalLength,\n min_pos: [0],\n max_pos: [chromInfo.totalLength]\n };\n}\n\nexport function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo {\n const info: HiGlass.ChromInfo = {\n cumPositions: [],\n chromLengths: {},\n chrPositions: {},\n totalLength: 0\n };\n\n sizes.forEach(([chr, length], i) => {\n const chrPosition = { id: i, chr, pos: info.totalLength };\n info.chrPositions[chr] = chrPosition;\n info.chromLengths[chr] = length;\n info.cumPositions.push(chrPosition);\n info.totalLength += length;\n });\n\n return {\n ...info,\n absToChr: absPos => (info.chrPositions ? absToChr(absPos, info) : null),\n chrToAbs: ([chrName, chrPos]) => (info.chrPositions ? chrToAbs(chrName, chrPos, info) : null)\n };\n}\n\nexport class RemoteFile extends _RemoteFile {\n // Overrides `read` to eagerly read 200 or 206 response\n // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162\n public read: _RemoteFile['read'] = async (\n buffer,\n offset = 0,\n length,\n position = 0,\n opts = {}\n ): Promise<{ bytesRead: number; buffer: Buffer }> => {\n const { headers = {}, signal, overrides = {} } = opts;\n\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n } else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n // @ts-expect-error private property\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n // @ts-expect-error private property\n ...this.baseOverrides.headers\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal\n };\n const response = await this.fetch(this.url, args);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n\n // Just read the response if it was successful.\n if (response.status === 200 || response.status === 206) {\n // @ts-expect-error private method\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n // @ts-expect-error private property\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n\n return { bytesRead: bytesCopied, buffer };\n }\n\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n };\n}\n\nexport interface TabularDataFetcher {\n getTabularData(tileIds: string[]): Promise;\n MAX_TILE_WIDTH?: number;\n}\n","/*\n * Generated by PEG.js 0.10.0.\n *\n * http://pegjs.org/\n */\n\"use strict\";\nfunction peg$subclass(child, parent) {\n function ctor() { this.constructor = child; }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n}\nfunction peg$SyntaxError(message, expected, found, location) {\n this.message = message;\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, peg$SyntaxError);\n }\n}\npeg$subclass(peg$SyntaxError, Error);\npeg$SyntaxError.buildMessage = function (expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function (expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n \"class\": function (expectation) {\n var escapedParts = \"\", i;\n for (i = 0; i < expectation.parts.length; i++) {\n escapedParts += expectation.parts[i] instanceof Array\n ? classEscape(expectation.parts[i][0]) + \"-\" + classEscape(expectation.parts[i][1])\n : classEscape(expectation.parts[i]);\n }\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n },\n any: function (expectation) {\n return \"any character\";\n },\n end: function (expectation) {\n return \"end of input\";\n },\n other: function (expectation) {\n return expectation.description;\n }\n };\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function (ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function (ch) { return '\\\\x' + hex(ch); });\n }\n function classEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\^/g, '\\\\^')\n .replace(/-/g, '\\\\-')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function (ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function (ch) { return '\\\\x' + hex(ch); });\n }\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n function describeExpected(expected) {\n var descriptions = new Array(expected.length), i, j;\n for (i = 0; i < expected.length; i++) {\n descriptions[i] = describeExpectation(expected[i]);\n }\n descriptions.sort();\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n};\nfunction peg$parse(input, options) {\n options = options !== void 0 ? options : {};\n var peg$FAILED = {}, peg$startRuleFunctions = { declaration: peg$parsedeclaration }, peg$startRuleFunction = peg$parsedeclaration, peg$c0 = \"(\", peg$c1 = peg$literalExpectation(\"(\", false), peg$c2 = \")\", peg$c3 = peg$literalExpectation(\")\", false), peg$c4 = function (type, name, comment, fields) { return { type, name, comment, fields }; }, peg$c5 = \"simple\", peg$c6 = peg$literalExpectation(\"simple\", false), peg$c7 = \"object\", peg$c8 = peg$literalExpectation(\"object\", false), peg$c9 = \"table\", peg$c10 = peg$literalExpectation(\"table\", false), peg$c11 = \"auto\", peg$c12 = peg$literalExpectation(\"auto\", false), peg$c13 = \"primary\", peg$c14 = peg$literalExpectation(\"primary\", false), peg$c15 = \"index\", peg$c16 = peg$literalExpectation(\"index\", false), peg$c17 = \"unique\", peg$c18 = peg$literalExpectation(\"unique\", false), peg$c19 = function (f1, w) { return w; }, peg$c20 = function (f1, fds) {\n if (f1.name) {\n fds.unshift(f1);\n }\n return fds;\n }, peg$c21 = \"#\", peg$c22 = peg$literalExpectation(\"#\", false), peg$c23 = \";\", peg$c24 = peg$literalExpectation(\";\", false), peg$c25 = function (type, name, comment) { return { type, name, comment }; }, peg$c26 = \"[\", peg$c27 = peg$literalExpectation(\"[\", false), peg$c28 = \"]\", peg$c29 = peg$literalExpectation(\"]\", false), peg$c30 = function (type, size, name, comment) { return { type, size, name, comment }; }, peg$c31 = function (type, vals, name, comment) { return { type, vals, name, comment }; }, peg$c32 = \",\", peg$c33 = peg$literalExpectation(\",\", false), peg$c34 = function (f1, fds) {\n fds.unshift(f1);\n return fds;\n }, peg$c35 = \"int\", peg$c36 = peg$literalExpectation(\"int\", false), peg$c37 = \"uint\", peg$c38 = peg$literalExpectation(\"uint\", false), peg$c39 = \"short\", peg$c40 = peg$literalExpectation(\"short\", false), peg$c41 = \"ushort\", peg$c42 = peg$literalExpectation(\"ushort\", false), peg$c43 = \"byte\", peg$c44 = peg$literalExpectation(\"byte\", false), peg$c45 = \"ubyte\", peg$c46 = peg$literalExpectation(\"ubyte\", false), peg$c47 = \"float\", peg$c48 = peg$literalExpectation(\"float\", false), peg$c49 = \"char\", peg$c50 = peg$literalExpectation(\"char\", false), peg$c51 = \"string\", peg$c52 = peg$literalExpectation(\"string\", false), peg$c53 = \"lstring\", peg$c54 = peg$literalExpectation(\"lstring\", false), peg$c55 = \"enum\", peg$c56 = peg$literalExpectation(\"enum\", false), peg$c57 = \"double\", peg$c58 = peg$literalExpectation(\"double\", false), peg$c59 = \"bigint\", peg$c60 = peg$literalExpectation(\"bigint\", false), peg$c61 = \"set\", peg$c62 = peg$literalExpectation(\"set\", false), peg$c63 = function (t, n) { return t + ' ' + n; }, peg$c64 = /^[a-zA-Z_]/, peg$c65 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"], \"_\"], false, false), peg$c66 = /^[a-zA-Z0-9_]/, peg$c67 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"], [\"0\", \"9\"], \"_\"], false, false), peg$c68 = function (t) { return text(); }, peg$c69 = \"\\\"\", peg$c70 = peg$literalExpectation(\"\\\"\", false), peg$c71 = /^[^\"]/, peg$c72 = peg$classExpectation([\"\\\"\"], true, false), peg$c73 = function (t) { return t.join(''); }, peg$c74 = /^[^\\n\\r]/, peg$c75 = peg$classExpectation([\"\\n\", \"\\r\"], true, false), peg$c76 = function (t) { return t.join('').replace(/^\"/, '').replace(/\"$/, ''); }, peg$c77 = peg$otherExpectation(\"integer\"), peg$c78 = /^[0-9]/, peg$c79 = peg$classExpectation([[\"0\", \"9\"]], false, false), peg$c80 = function () { return parseInt(text(), 10); }, peg$c81 = peg$otherExpectation(\"whitespace\"), peg$c82 = /^[ \\t\\n\\r]/, peg$c83 = peg$classExpectation([\" \", \"\\t\", \"\\n\", \"\\r\"], false, false), peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result;\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n function expected(description, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);\n throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);\n }\n function error(message, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);\n throw peg$buildSimpleError(message, location);\n }\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos], p;\n if (details) {\n return details;\n }\n else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n }\n else {\n details.column++;\n }\n p++;\n }\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos);\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) {\n return;\n }\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n peg$maxFailExpected.push(expected);\n }\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);\n }\n function peg$parsedeclaration() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsedeclareType();\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n s4 = peg$parsedeclareName();\n if (s4 !== peg$FAILED) {\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsecomment();\n if (s6 !== peg$FAILED) {\n s7 = peg$parse_();\n if (s7 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 40) {\n s8 = peg$c0;\n peg$currPos++;\n }\n else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c1);\n }\n }\n if (s8 !== peg$FAILED) {\n s9 = peg$parse_();\n if (s9 !== peg$FAILED) {\n s10 = peg$parsefieldList();\n if (s10 !== peg$FAILED) {\n s11 = peg$parse_();\n if (s11 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s12 = peg$c2;\n peg$currPos++;\n }\n else {\n s12 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c3);\n }\n }\n if (s12 !== peg$FAILED) {\n s13 = peg$parse_();\n if (s13 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c4(s2, s4, s6, s10);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsedeclareType() {\n var s0;\n if (input.substr(peg$currPos, 6) === peg$c5) {\n s0 = peg$c5;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c6);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c7) {\n s0 = peg$c7;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c8);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c9) {\n s0 = peg$c9;\n peg$currPos += 5;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c10);\n }\n }\n }\n }\n return s0;\n }\n function peg$parsedeclareName() {\n var s0, s1, s2, s3;\n s0 = peg$parsename();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsename();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseindexType();\n if (s2 !== peg$FAILED) {\n s1 = [s1, s2];\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsename();\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c11) {\n s2 = peg$c11;\n peg$currPos += 4;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c12);\n }\n }\n if (s2 !== peg$FAILED) {\n s1 = [s1, s2];\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsename();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseindexType();\n if (s2 !== peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c11) {\n s3 = peg$c11;\n peg$currPos += 4;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c12);\n }\n }\n if (s3 !== peg$FAILED) {\n s1 = [s1, s2, s3];\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n }\n return s0;\n }\n function peg$parseindexType() {\n var s0;\n if (input.substr(peg$currPos, 7) === peg$c13) {\n s0 = peg$c13;\n peg$currPos += 7;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c14);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c15) {\n s0 = peg$c15;\n peg$currPos += 5;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c16);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c17) {\n s0 = peg$c17;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c18);\n }\n }\n }\n }\n return s0;\n }\n function peg$parsecomment() {\n var s0;\n s0 = peg$parsenonQuotedString();\n if (s0 === peg$FAILED) {\n s0 = peg$parse_();\n }\n return s0;\n }\n function peg$parsefieldList() {\n var s0, s1, s2, s3, s4, s5, s6;\n s0 = peg$currPos;\n s1 = peg$parsefield();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsefield();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c19(s1, s6);\n s4 = s5;\n }\n else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsefield();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c19(s1, s6);\n s4 = s5;\n }\n else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c20(s1, s3);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsecommentStart() {\n var s0;\n if (input.charCodeAt(peg$currPos) === 35) {\n s0 = peg$c21;\n peg$currPos++;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c22);\n }\n }\n return s0;\n }\n function peg$parseinternalComment() {\n var s0, s1, s2, s3, s4;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsecommentStart();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsenonQuotedString();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s1 = [s1, s2, s3, s4];\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsefield() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;\n s0 = peg$currPos;\n s1 = peg$parsefieldType();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsename();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s5 = peg$c23;\n peg$currPos++;\n }\n else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c24);\n }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n s7 = peg$parsecomment();\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c25(s1, s3, s7);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsefieldType();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 91) {\n s3 = peg$c26;\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c27);\n }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsefieldSize();\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s7 = peg$c28;\n peg$currPos++;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c29);\n }\n }\n if (s7 !== peg$FAILED) {\n s8 = peg$parse_();\n if (s8 !== peg$FAILED) {\n s9 = peg$parsename();\n if (s9 !== peg$FAILED) {\n s10 = peg$parse_();\n if (s10 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s11 = peg$c23;\n peg$currPos++;\n }\n else {\n s11 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c24);\n }\n }\n if (s11 !== peg$FAILED) {\n s12 = peg$parse_();\n if (s12 !== peg$FAILED) {\n s13 = peg$parsecomment();\n if (s13 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c30(s1, s5, s9, s13);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsefieldType();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 40) {\n s3 = peg$c0;\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c1);\n }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsefieldValues();\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s7 = peg$c2;\n peg$currPos++;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c3);\n }\n }\n if (s7 !== peg$FAILED) {\n s8 = peg$parse_();\n if (s8 !== peg$FAILED) {\n s9 = peg$parsename();\n if (s9 !== peg$FAILED) {\n s10 = peg$parse_();\n if (s10 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s11 = peg$c23;\n peg$currPos++;\n }\n else {\n s11 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c24);\n }\n }\n if (s11 !== peg$FAILED) {\n s12 = peg$parse_();\n if (s12 !== peg$FAILED) {\n s13 = peg$parsecomment();\n if (s13 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c31(s1, s5, s9, s13);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$parseinternalComment();\n }\n }\n }\n return s0;\n }\n function peg$parsefieldValues() {\n var s0, s1, s2, s3, s4, s5, s6;\n s0 = peg$currPos;\n s1 = peg$parsename();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 44) {\n s4 = peg$c32;\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c33);\n }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsename();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c19(s1, s6);\n s3 = s4;\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 44) {\n s4 = peg$c32;\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c33);\n }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsename();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c19(s1, s6);\n s3 = s4;\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c34(s1, s2);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsefieldType() {\n var s0, s1, s2, s3;\n if (input.substr(peg$currPos, 3) === peg$c35) {\n s0 = peg$c35;\n peg$currPos += 3;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c36);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c37) {\n s0 = peg$c37;\n peg$currPos += 4;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c38);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c39) {\n s0 = peg$c39;\n peg$currPos += 5;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c40);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c41) {\n s0 = peg$c41;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c42);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c43) {\n s0 = peg$c43;\n peg$currPos += 4;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c44);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c45) {\n s0 = peg$c45;\n peg$currPos += 5;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c46);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c47) {\n s0 = peg$c47;\n peg$currPos += 5;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c48);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c49) {\n s0 = peg$c49;\n peg$currPos += 4;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c50);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c51) {\n s0 = peg$c51;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c52);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 7) === peg$c53) {\n s0 = peg$c53;\n peg$currPos += 7;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c54);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c55) {\n s0 = peg$c55;\n peg$currPos += 4;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c56);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c57) {\n s0 = peg$c57;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c58);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c59) {\n s0 = peg$c59;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c60);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c61) {\n s0 = peg$c61;\n peg$currPos += 3;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c62);\n }\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsedeclareType();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsedeclareName();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c63(s1, s3);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return s0;\n }\n function peg$parsefieldSize() {\n var s0;\n s0 = peg$parsenumber();\n if (s0 === peg$FAILED) {\n s0 = peg$parsename();\n }\n return s0;\n }\n function peg$parsename() {\n var s0, s1, s2, s3, s4;\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (peg$c64.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c65);\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c66.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c67);\n }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c66.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c67);\n }\n }\n }\n if (s3 !== peg$FAILED) {\n s2 = [s2, s3];\n s1 = s2;\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c68(s1);\n }\n s0 = s1;\n return s0;\n }\n function peg$parsequotedString() {\n var s0, s1, s2, s3;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c69;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c70);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c71.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c72);\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c71.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c72);\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c69;\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c70);\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c73(s2);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsenonQuotedString() {\n var s0, s1, s2;\n s0 = peg$currPos;\n s1 = [];\n if (peg$c74.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c75);\n }\n }\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (peg$c74.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c75);\n }\n }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c76(s1);\n }\n s0 = s1;\n return s0;\n }\n function peg$parsenumber() {\n var s0, s1, s2, s3;\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c78.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c79);\n }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c78.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c79);\n }\n }\n }\n }\n else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c80();\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c77);\n }\n }\n return s0;\n }\n function peg$parse_() {\n var s0, s1;\n peg$silentFails++;\n s0 = [];\n if (peg$c82.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c83);\n }\n }\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (peg$c82.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c83);\n }\n }\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c81);\n }\n }\n return s0;\n }\n peg$result = peg$startRuleFunction();\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n }\n else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));\n }\n}\nmodule.exports = {\n SyntaxError: peg$SyntaxError,\n parse: peg$parse\n};\n//# sourceMappingURL=autoSql.js.map","export const bigChain = `table bigChain\n\"bigChain pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - for strand\"\n uint tSize; \"size of target sequence\"\n string qName; \"name of query sequence\"\n uint qSize; \"size of query sequence\"\n uint qStart; \"start of alignment on query sequence\"\n uint qEnd; \"end of alignment on query sequence\"\n uint chainScore; \"score from chain\"\n )`;\nexport const bigGenePred = `table bigGenePred\n\"bigGenePred gene models\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - for strand\"\n uint thickStart; \"Start of where display should be thick (start codon)\"\n uint thickEnd; \"End of where display should be thick (stop codon)\"\n uint reserved; \"RGB value (use R,G,B string in input file)\"\n int blockCount; \"Number of blocks\"\n int[blockCount] blockSizes; \"Comma separated list of block sizes\"\n int[blockCount] chromStarts; \"Start positions relative to chromStart\"\n string name2; \"Alternative/human readable name\"\n string cdsStartStat; \"Status of CDS start annotation (none, unknown, incomplete, or complete)\"\n string cdsEndStat; \"Status of CDS end annotation (none, unknown, incomplete, or complete)\"\n int[blockCount] exonFrames; \"Exon frame {0,1,2}, or -1 if no frame for exon\"\n string type; \"Transcript type\"\n string geneName; \"Primary identifier for gene\"\n string geneName2; \"Alternative/human readable gene name\"\n string geneType; \"Gene type\"\n )`;\nexport const bigInteract = `table interact\n\"interaction between two regions\"\n (\n string chrom; \"Chromosome (or contig, scaffold, etc.). For interchromosomal, use 2 records\"\n uint chromStart; \"Start position of lower region. For interchromosomal, set to chromStart of this region\"\n uint chromEnd; \"End position of upper region. For interchromosomal, set to chromEnd of this region\"\n string name; \"Name of item, for display. Usually 'sourceName/targetName/exp' or empty\"\n uint score; \"Score (0-1000)\"\n double value; \"Strength of interaction or other data value. Typically basis for score\"\n string exp; \"Experiment name (metadata for filtering). Use . if not applicable\"\n string color; \"Item color. Specified as r,g,b or hexadecimal #RRGGBB or html color name, as in //www.w3.org/TR/css3-color/#html4. Use 0 and spectrum setting to shade by score\"\n string sourceChrom; \"Chromosome of source region (directional) or lower region. For non-directional interchromosomal, chrom of this region.\"\n uint sourceStart; \"Start position in chromosome of source/lower/this region\"\n uint sourceEnd; \"End position in chromosome of source/lower/this region\"\n string sourceName; \"Identifier of source/lower/this region\"\n string sourceStrand; \"Orientation of source/lower/this region: + or -. Use . if not applicable\"\n string targetChrom; \"Chromosome of target region (directional) or upper region. For non-directional interchromosomal, chrom of other region\"\n uint targetStart; \"Start position in chromosome of target/upper/this region\"\n uint targetEnd; \"End position in chromosome of target/upper/this region\"\n string targetName; \"Identifier of target/upper/this region\"\n string targetStrand; \"Orientation of target/upper/this region: + or -. Use . if not applicable\"\n\n )`;\nexport const bigLink = `table bigLink\n\"bigLink pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint qStart; \"start of alignment on query sequence\"\n )`;\nexport const bigMaf = `table bedMaf\n\"Bed3 with MAF block\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n lstring mafBlock; \"MAF block\"\n )`;\nexport const bigNarrowPeak = `table bigNarrowPeak\n\"BED6+4 Peaks of signal enrichment based on pooled, normalized (interpreted) data.\"\n(\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name;\t \"Name given to a region (preferably unique). Use . if no name is assigned\"\n uint score; \"Indicates how dark the peak will be displayed in the browser (0-1000) \"\n char[1] strand; \"+ or - or . for unknown\"\n float signalValue; \"Measurement of average enrichment for the region\"\n float pValue; \"Statistical significance of signal value (-log10). Set to -1 if not used.\"\n float qValue; \"Statistical significance with multiple-test correction applied (FDR -log10). Set to -1 if not used.\"\n int peak; \"Point-source called for this peak; 0-based offset from chromStart. Set to -1 if no point-source called.\"\n)`;\nexport const bigPsl = `table bigPsl\n\"bigPsl pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - indicates whether the query aligns to the + or - strand on the reference\"\n uint thickStart; \"Start of where display should be thick (start codon)\"\n uint thickEnd; \"End of where display should be thick (stop codon)\"\n uint reserved; \"RGB value (use R,G,B string in input file)\"\n int blockCount; \"Number of blocks\"\n int[blockCount] blockSizes; \"Comma separated list of block sizes\"\n int[blockCount] chromStarts; \"Start positions relative to chromStart\"\n\n uint oChromStart;\"Start position in other chromosome\"\n uint oChromEnd; \"End position in other chromosome\"\n char[1] oStrand; \"+ or -, - means that psl was reversed into BED-compatible coordinates\"\n uint oChromSize; \"Size of other chromosome.\"\n int[blockCount] oChromStarts; \"Start positions relative to oChromStart or from oChromStart+oChromSize depending on strand\"\n\n lstring oSequence; \"Sequence on other chrom (or empty)\"\n string oCDS; \"CDS in NCBI format\"\n\n uint chromSize;\"Size of target chromosome\"\n\n uint match; \"Number of bases matched.\"\n uint misMatch; \" Number of bases that don't match \"\n uint repMatch; \" Number of bases that match but are part of repeats \"\n uint nCount; \" Number of 'N' bases \"\n uint seqType; \"0=empty, 1=nucleotide, 2=amino_acid\"\n )`;\nexport const defaultBedSchema = `table defaultBedSchema\n\"BED12\"\n (\n string chrom; \"The name of the chromosome (e.g. chr3, chrY, chr2_random) or scaffold (e.g. scaffold10671).\"\n uint chromStart; \"The starting position of the feature in the chromosome or scaffold. The first base in a chromosome is numbered 0.\"\n uint chromEnd; \"The ending position of the feature in the chromosome or scaffold. The chromEnd base is not included in the display of the feature. For example, the first 100 bases of a chromosome are defined as chromStart=0, chromEnd=100, and span the bases numbered 0-99.\"\n string name; \"Defines the name of the BED line.\"\n float score; \"Feature score, doesn't care about the 0-1000 limit as in bed\"\n char strand; \"Defines the strand. Either '.' (=no strand) or '+' or '-'\"\n uint thickStart; \"The starting position at which the feature is drawn thickly (for example, the start codon in gene displays). When there is no thick part, thickStart and thickEnd are usually set to the chromStart position.\"\n uint thickEnd; \"The ending position at which the feature is drawn thickly (for example the stop codon in gene displays).\"\n string itemRgb; \"An RGB value of the form R,G,B (e.g. 255,0,0). \"\n uint blockCount; \" The number of blocks (exons) in the BED line.\"\n uint[blockCount] blockSizes; \" A comma-separated list of the block sizes. The number of items in this list should correspond to blockCount.\"\n uint[blockCount] blockStarts; \"A comma-separated list of block starts. All of the blockStart positions should be calculated relative to chromStart. The number of items in this list should correspond to blockCount.\"\n )`;\nexport const mafFrames = `table mafFrames\n\"codon frame assignment for MAF components\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start range in chromosome\"\n uint chromEnd; \"End range in chromosome\"\n string src; \"Name of sequence source in MAF\"\n ubyte frame; \"frame (0,1,2) for first base(+) or last bast(-)\"\n char[1] strand; \"+ or -\"\n string name; \"Name of gene used to define frame\"\n int prevFramePos; \"target position of the previous base (in transcription direction) that continues this frame, or -1 if none, or frame not contiguous\"\n int nextFramePos; \"target position of the next base (in transcription direction) that continues this frame, or -1 if none, or frame not contiguous\"\n ubyte isExonStart; \"does this start the CDS portion of an exon?\"\n ubyte isExonEnd; \"does this end the CDS portion of an exon?\"\n )`;\nexport const mafSummary = `table mafSummary\n\"Positions and scores for alignment blocks\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string src; \"Sequence name or database of alignment\"\n float score; \"Floating point score.\"\n char[1] leftStatus; \"Gap/break annotation for preceding block\"\n char[1] rightStatus; \"Gap/break annotation for following block\"\n )`;\n//# sourceMappingURL=autoSqlSchemas.js.map","import { parse } from './autoSql';\nimport * as types from './as/autoSqlSchemas';\nexport default Object.fromEntries(Object.entries(types).map(([key, val]) => [\n key,\n parse(val.trim()),\n]));\n//# sourceMappingURL=defaultTypes.js.map","/*\n * adds some type annotations to the autoSql schema\n * for numeric fields ['uint', 'int', 'float', 'long'] \"isNumeric\" is added\n * for array types \"isArray\" is added\n * for numeric array types \"isArray\" and \"arrayIsNumeric\" is set\n *\n * @param autoSql - an autoSql schema from the peg parser\n * @return autoSql with type annotations added\n */\nexport function detectTypes(autoSql) {\n const numericTypes = ['uint', 'int', 'float', 'long'];\n return {\n ...autoSql,\n fields: autoSql.fields.map(autoField => ({\n ...autoField,\n isArray: autoField.size && autoField.type !== 'char',\n arrayIsNumeric: autoField.size && numericTypes.includes(autoField.type),\n isNumeric: !autoField.size && numericTypes.includes(autoField.type),\n })),\n };\n}\n//# sourceMappingURL=util.js.map","import parser from './autoSql';\nimport types from './defaultTypes';\nimport { detectTypes } from './util';\nconst strandMap = { '.': 0, '-': -1, '+': 1 };\n// heuristic that a BED file is BED12 like...the number in col 10 is blockCount-like\nfunction isBed12Like(fields) {\n var _a;\n return (fields.length >= 12 &&\n !Number.isNaN(parseInt(fields[9], 10)) &&\n ((_a = fields[10]) === null || _a === void 0 ? void 0 : _a.split(',').filter(f => !!f).length) === parseInt(fields[9], 10));\n}\nexport default class BED {\n constructor(args = {}) {\n if (args.autoSql) {\n this.autoSql = detectTypes(parser.parse(args.autoSql));\n }\n else if (args.type) {\n if (!types[args.type]) {\n throw new Error('Type not found');\n }\n this.autoSql = detectTypes(types[args.type]);\n }\n else {\n this.autoSql = detectTypes(types.defaultBedSchema);\n this.attemptDefaultBed = true;\n }\n }\n /*\n * parses a line of text as a BED line with the loaded autoSql schema\n *\n * @param line - a BED line as tab delimited text or array\n * @param opts - supply opts.uniqueId\n * @return a object representing a feature\n */\n parseLine(line, opts = {}) {\n const { autoSql } = this;\n const { uniqueId } = opts;\n const fields = Array.isArray(line) ? line : line.split('\\t');\n let feature = {};\n if (!this.attemptDefaultBed ||\n (this.attemptDefaultBed && isBed12Like(fields))) {\n for (let i = 0; i < autoSql.fields.length; i++) {\n const autoField = autoSql.fields[i];\n let columnVal = fields[i];\n const { isNumeric, isArray, arrayIsNumeric, name } = autoField;\n if (columnVal === null || columnVal === undefined) {\n break;\n }\n if (columnVal !== '.') {\n if (isNumeric) {\n const num = Number(columnVal);\n columnVal = Number.isNaN(num) ? columnVal : num;\n }\n else if (isArray) {\n columnVal = columnVal.split(',');\n if (columnVal[columnVal.length - 1] === '') {\n columnVal.pop();\n }\n if (arrayIsNumeric) {\n columnVal = columnVal.map((str) => Number(str));\n }\n }\n feature[name] = columnVal;\n }\n }\n }\n else {\n const fieldNames = ['chrom', 'chromStart', 'chromEnd', 'name'];\n feature = Object.fromEntries(fields.map((f, i) => [fieldNames[i] || 'field' + i, f]));\n feature.chromStart = +feature.chromStart;\n feature.chromEnd = +feature.chromEnd;\n if (!Number.isNaN(Number.parseFloat(feature.field4))) {\n feature.score = +feature.field4;\n delete feature.field4;\n }\n if (feature.field5 === '+' || feature.field5 === '-') {\n feature.strand = feature.field5;\n delete feature.field5;\n }\n }\n if (uniqueId) {\n feature.uniqueId = uniqueId;\n }\n feature.strand = strandMap[feature.strand] || 0;\n feature.chrom = decodeURIComponent(feature.chrom);\n return feature;\n }\n}\n//# sourceMappingURL=parser.js.map","import BED from '@gmod/bed';\nimport type { BedTile } from './bed-worker';\n\n/**\n * Used in BedParser to associate column names with data types\n */\ntype FieldInfo = [type: string, fieldName: string];\n\n/**\n * From gmod/bed-js\n */\nconst DEFAULT_BED_SCHEMA = `table defaultBedSchema\n\"BED12\"\n (\n string chrom; \"The name of the chromosome (e.g. chr3, chrY, chr2_random) or scaffold (e.g. scaffold10671).\"\n uint chromStart; \"The starting position of the feature in the chromosome or scaffold. The first base in a chromosome is numbered 0.\"\n uint chromEnd; \"The ending position of the feature in the chromosome or scaffold. The chromEnd base is not included in the display of the feature. For example, the first 100 bases of a chromosome are defined as chromStart=0, chromEnd=100, and span the bases numbered 0-99.\"\n string name; \"Defines the name of the BED line.\"\n float score; \"Feature score, doesn't care about the 0-1000 limit as in bed\"\n char strand; \"Defines the strand. Either '.' (=no strand) or '+' or '-'\"\n uint thickStart; \"The starting position at which the feature is drawn thickly (for example, the start codon in gene displays). When there is no thick part, thickStart and thickEnd are usually set to the chromStart position.\"\n uint thickEnd; \"The ending position at which the feature is drawn thickly (for example the stop codon in gene displays).\"\n string itemRgb; \"An RGB value of the form R,G,B (e.g. 255,0,0). \"\n uint blockCount; \" The number of blocks (exons) in the BED line.\"\n uint[blockCount] blockSizes; \" A comma-separated list of the block sizes. The number of items in this list should correspond to blockCount.\"\n uint[blockCount] blockStarts; \"A comma-separated list of block starts. All of the blockStart positions should be calculated relative to chromStart. The number of items in this list should correspond to blockCount.\"\n )`;\n\n/**\n * A class to create a BED file parser\n */\nclass BedParser {\n #customFields?: string[];\n #n_columns?: number;\n #parser: BED;\n\n /**\n * Constructor for BedParser\n * @param customFields An array of strings, where each string is the name of a custom column\n * @param n_columns A number which is the number of columns in the Bed File\n */\n constructor(opt?: { customFields: string[]; n_columns: number }) {\n this.#customFields = opt?.customFields;\n this.#n_columns = opt?.n_columns;\n if (this.#customFields) {\n const customAutoSqlSchema = this.constructBedAutoSql();\n this.#parser = new BED({ autoSql: customAutoSqlSchema });\n } else {\n this.#parser = new BED({ autoSql: DEFAULT_BED_SCHEMA });\n }\n }\n /**\n * Parses a single BED file line\n * @returns An object which contains the parsed data from the line\n */\n parseLine(line: string, chromStart: number) {\n /** Helper function to calculate cumulative chromosome positions */\n function relativeToCumulative(pos: number, chromStart: number) {\n return chromStart + pos + 1;\n }\n const bedRecord: BedTile = this.#parser.parseLine(line) as BedTile;\n const fieldsToConvert = ['chromStart', 'chromEnd', 'thickEnd', 'thickStart'];\n fieldsToConvert.forEach(field => {\n if (bedRecord[field]) bedRecord[field] = relativeToCumulative(bedRecord[field] as number, chromStart);\n });\n return bedRecord;\n }\n /**\n * Generates an autoSql schema for a BED file that has custom columns\n * @returns A string which is the autoSql spec\n */\n constructBedAutoSql() {\n const AUTO_SQL_HEADER = `table customBedSchema\\n\"BED12\"\\n (\\n`;\n const AUTO_SQL_FOOTER = '\\n )';\n\n const autoSqlFields = this.#generateAutoSQLFields();\n return String.prototype.concat(AUTO_SQL_HEADER, autoSqlFields, AUTO_SQL_FOOTER);\n }\n /**\n * Generates the fields used in the autoSql schema. For custom column names.\n * @returns A string which is are the fields in the autoSql schema\n */\n #generateAutoSQLFields() {\n const BED12Fields: FieldInfo[] = [\n ['string', 'chrom'],\n ['uint', 'chromStart'],\n ['uint', 'chromEnd'],\n ['string', 'name'],\n ['float', 'score'],\n ['char', 'strand'],\n ['uint', 'thickStart'],\n ['uint', 'thickEnd'],\n ['string', 'itemRgb'],\n ['uint', 'blockCount'],\n ['uint[blockCount]', 'blockSizes'],\n ['uint[blockCount]', 'blockStarts']\n ];\n if (!this.#n_columns) throw new Error('Number of columns was not able to be determined');\n if (!this.#customFields) return ''; // This function should never be called if there are no custom fields\n const customFieldType = 'string';\n const customFieldsWithTypes = this.#customFields.map(column => [customFieldType, column] as FieldInfo);\n\n let allFields: FieldInfo[];\n const REQUIRED_COLS = 3;\n if (this.#n_columns > BED12Fields.length) {\n // BED12+m so we just want to concat on the extra fields.\n // But first we make sure that we have the expected number of columns.\n if (this.#n_columns !== BED12Fields.length + this.#customFields.length) {\n throw new Error(`BED file error: unexpected number of custom fields. Found ${this.#n_columns} columns \n which is different from the expected ${BED12Fields.length + this.#customFields.length}`);\n }\n allFields = BED12Fields.concat(customFieldsWithTypes);\n } else if (this.#n_columns >= REQUIRED_COLS + this.#customFields.length) {\n // BEDn or BEDn+. We make sure that the required columns are not removed when we do the slice.\n allFields = BED12Fields.slice(0, this.#n_columns - this.#customFields.length).concat(customFieldsWithTypes);\n } else {\n throw new Error(\n `Expected ${REQUIRED_COLS + this.#customFields.length} columns (${REQUIRED_COLS} required columns and ${\n this.#customFields.length\n } custom columns) but found ${this.#n_columns} columns`\n );\n }\n\n const fieldDescription = 'custom input'; // A genetic description to satisfy the autoSQL parser\n const autoSqlFields = allFields\n .map(fieldInfo => ` ${fieldInfo[0]} ${fieldInfo[1]}; \"${fieldDescription}\"`)\n .join('\\n');\n\n return autoSqlFields;\n }\n}\n\nexport default BedParser;\n","/*\n * This document is heavily based on the following repo by @alexander-veit:\n * https://github.com/dbmi-bgm/higlass-sv/blob/main/src/sv-fetcher-worker.js\n */\n\nimport { TabixIndexedFile } from '@gmod/tabix';\nimport { sampleSize } from 'lodash-es';\nimport { expose, Transfer } from 'threads/worker';\nimport type { TilesetInfo } from '@higlass/types';\n\nimport type { ChromSizes } from '@gosling-lang/gosling-schema';\n\nimport { DataSource, RemoteFile } from '../utils';\nimport BedParser from './bed-parser';\n\nexport type BedFileOptions = {\n sampleLength: number;\n customFields?: string[];\n urlFetchOptions?: RequestInit;\n indexUrlFetchOptions?: RequestInit;\n};\n\n/**\n * All data stored in each BED file eventually transformed and put into this\n */\nexport interface BedTile {\n chrom: string;\n chromStart: number;\n chromEnd: number;\n name?: string;\n score?: number;\n strand?: string;\n thickStart?: number;\n thickEnd?: number;\n itemRgb?: string;\n blockCount?: number;\n blockSizes?: number[];\n blockStarts?: number[];\n [customField: string]: string | number | number[] | undefined;\n}\n\nexport interface EmptyTile {\n tilePositionId: string;\n}\n\n/**\n * A class to represent a BED file. It takes care of setting up gmod/tabix.\n */\nclass BedFile {\n #parser?: BedParser;\n #customFields?: string[];\n #uid: string;\n\n constructor(public tbi: TabixIndexedFile, uid: string) {\n this.#uid = uid;\n }\n /**\n * Function to create an instance of BedFile\n * @param url A string which is the URL of the bed file\n * @param indexUrl A string which is the URL of the bed index file\n * @param uid A unique identifier for the worker\n * @param urlFetchOptions When the url is fetched, these options will be used\n * @param indexUrlFetchOptions When the index URL is fetched, these options will be used\n * @returns an instance of BedFile\n */\n static fromUrl(\n url: string,\n indexUrl: string,\n uid: string,\n urlFetchOptions?: RequestInit,\n indexUrlFetchOptions?: RequestInit\n ) {\n const tbi = new TabixIndexedFile({\n filehandle: new RemoteFile(url, { overrides: urlFetchOptions }),\n tbiFilehandle: new RemoteFile(indexUrl, { overrides: indexUrlFetchOptions })\n });\n return new BedFile(tbi, uid);\n }\n set customFields(custom: string[]) {\n this.#customFields = custom;\n }\n /**\n * Creates a parser. Parser cannot be created in the constructor because it relies on chromosome information\n * which gets created by DataSource\n * @returns A BED parser\n */\n async getParser() {\n if (!this.#parser) {\n const opt = this.#customFields\n ? { customFields: this.#customFields, n_columns: await this.#calcNColumns() }\n : undefined;\n this.#parser = new BedParser(opt);\n }\n return this.#parser;\n }\n /**\n * Function to calculate the number of columns in the BED file. Needed when custom column names are supplied\n * Relatively inefficient because the gmod/tabix API only has a way to retrieve lines based on genomic coordinates,\n * but I believe this is better than fetching the BED file itself because then it only has to be fetched and\n * unzipped once.\n * @returns\n */\n async #calcNColumns() {\n const source = dataSources.get(this.#uid)!;\n const { chromLengths, cumPositions } = source.chromInfo;\n let n_cols = 0;\n for (const cumPos of cumPositions) {\n const chromName = cumPos.chr;\n const chromStart = cumPos.pos;\n const chromEnd = cumPos.pos + chromLengths[chromName];\n n_cols = await new Promise(resolve => {\n source.file.tbi.getLines(chromName, chromStart, chromEnd, line => {\n resolve(line.split('\\t').length);\n });\n });\n if (n_cols > 0) break;\n }\n return n_cols;\n }\n /**\n * Retrieves data within a certain coordinate range\n * @param minX A number which is the minimum X boundary of the tile\n * @param maxX A number which is the maximum X boundary of the tile\n * @param callback A callback function which takes in parsed BED file data record\n * @returns A promise of array of promises which resolve when the data has been successfully retrieved\n */\n async getTileData(minX: number, maxX: number): Promise {\n const source = dataSources.get(this.#uid)!;\n const parser = await this.getParser();\n let curMinX = minX;\n const { chromLengths, cumPositions } = source.chromInfo;\n const allTiles: Promise[] = [];\n\n for (const cumPos of cumPositions) {\n const chromName = cumPos.chr;\n const chromStart = cumPos.pos;\n const chromEnd = cumPos.pos + chromLengths[chromName];\n let startPos, endPos;\n\n // Early break, rather than creating an nested if\n if (chromStart > curMinX || curMinX >= chromEnd) {\n continue;\n }\n\n const tilesPromise = new Promise(resolve => {\n const tiles: BedTile[] = [];\n const lineCallback = (line: string) => {\n const bedTile = parser.parseLine(line, chromStart);\n tiles.push(bedTile);\n };\n\n if (maxX > chromEnd) {\n startPos = curMinX - chromStart;\n endPos = chromEnd - chromStart;\n } else {\n startPos = Math.floor(curMinX - chromStart);\n endPos = Math.ceil(maxX - chromStart);\n }\n\n source.file.tbi.getLines(chromName, startPos, endPos, lineCallback).then(() => {\n resolve(tiles);\n });\n });\n\n allTiles.push(tilesPromise);\n\n if (maxX <= chromEnd) {\n continue;\n }\n\n curMinX = chromEnd;\n }\n\n const tileArrays = await Promise.all(allTiles);\n return tileArrays.flat();\n }\n}\n\n// promises indexed by urls\nconst bedFiles: Map = new Map();\n\n/**\n * Object to store tile data. Each key a string which contains the coordinates of the tile\n */\nconst tileValues: Record = {};\n/**\n * Maps from UID to Bed File info\n */\nconst dataSources: Map> = new Map();\n\nfunction init(\n uid: string,\n bed: { url: string; indexUrl: string },\n chromSizes: ChromSizes,\n options: Partial = {}\n) {\n let bedFile = bedFiles.get(bed.url);\n if (!bedFile) {\n bedFile = BedFile.fromUrl(bed.url, bed.indexUrl, uid, options.urlFetchOptions, options.indexUrlFetchOptions);\n if (options.customFields) bedFile.customFields = options.customFields;\n }\n const dataSource = new DataSource(bedFile, chromSizes, {\n sampleLength: 1000,\n ...options\n });\n dataSources.set(uid, dataSource);\n}\n\nconst tilesetInfo = (uid: string) => {\n return dataSources.get(uid)!.tilesetInfo;\n};\n\n/**\n * Updates `tileValues` with the data for a specific tile.\n * @param uid A string which is the unique identifier of the worker\n * @param z A number which is the z coordinate of the tile\n * @param x A number which is the x coordinate of the tile\n */\nconst tile = async (uid: string, z: number, x: number): Promise => {\n const source = dataSources.get(uid)!;\n // const parseLine = await source.file.getParser();\n\n const CACHE_KEY = `${uid}.${z}.${x}`;\n\n // TODO: Caching is needed\n // if (!tileValues[CACHE_KEY]) {\n tileValues[CACHE_KEY] = [];\n // }\n\n const tileWidth = +source.tilesetInfo.max_width / 2 ** +z;\n\n // get bounds of this tile\n const minX = source.tilesetInfo.min_pos[0] + x * tileWidth;\n const maxX = source.tilesetInfo.min_pos[0] + (x + 1) * tileWidth;\n\n tileValues[CACHE_KEY] = await source.file.getTileData(minX, maxX);\n\n return tileValues[CACHE_KEY];\n};\n\nconst fetchTilesDebounced = async (uid: string, tileIds: string[]) => {\n const tiles: Record = {};\n const validTileIds: string[] = [];\n const tilePromises: Promise[] = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('Invalid tile zoom or position:', z, x);\n continue;\n }\n validTileIds.push(tileId);\n tilePromises.push(tile(uid, z, x));\n }\n return Promise.all(tilePromises).then(values => {\n for (let i = 0; i < values.length; i++) {\n const validTileId = validTileIds[i];\n tiles[validTileId] = { tilePositionId: validTileId };\n }\n return tiles;\n });\n};\n\n/**\n * Sends the data fetcher data from `tileValues`\n * @param uid A string which is the unique identifier of the worker\n * @param tileIds An array of strings where each string identifies a tile with a particular coordinate\n * @returns A transferable buffer\n */\nconst getTabularData = (uid: string, tileIds: string[]) => {\n const data: BedTile[][] = [];\n\n tileIds.forEach(tileId => {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n const tileValue = tileValues[`${uid}.${z}.${x}`];\n\n if (!tileValue) {\n console.warn(`No tile data constructed (${tileId})`);\n }\n\n data.push(tileValue);\n });\n\n let output = Object.values(data).flat();\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const sampleLength = dataSources.get(uid)!.options.sampleLength;\n if (output.length >= sampleLength) {\n // TODO: we can make this more generic\n // priotize that mutations with closer each other are selected when sampling.\n output = sampleSize(output, sampleLength / 2.0);\n }\n\n const buffer = new TextEncoder().encode(JSON.stringify(output)).buffer;\n return Transfer(buffer, [buffer]);\n};\n\nconst tileFunctions = {\n init,\n tilesetInfo,\n fetchTilesDebounced,\n tile,\n getTabularData\n};\n\nexport type WorkerApi = typeof tileFunctions;\nexport type { TilesetInfo };\n\nexpose(tileFunctions);\n"],"names":["i","_getPrototypeOf","o","_setPrototypeOf","p","self","_get","Emitter","AbortSignal","toString","AbortController","err","Request","init","abortableFetch","require$$0","global","AggregateAbortController_1","abortcontroller_ponyfill_1","AggregateStatusReporter_1","__importDefault","this","AbortablePromiseCache_1","require$$1","require$$2","len","len2","buffer","c","ieee754","exports","Buffer","fromString","byteLength","isBuffer","code","msg","utils","Z_FIXED","Z_UNKNOWN","zero","MIN_MATCH","MAX_MATCH","LENGTH_CODES","LITERALS","L_CODES","D_CODES","BL_CODES","HEAP_SIZE","MAX_BITS","rank","adler32","crc32","messages","require$$3","require$$4","Z_NO_FLUSH","Z_FINISH","Z_BLOCK","Z_OK","Z_STREAM_END","Z_STREAM_ERROR","Z_DATA_ERROR","Z_BUF_ERROR","Z_DEFAULT_COMPRESSION","Z_DEFAULT_STRATEGY","Z_DEFLATED","MAX_WBITS","deflate","strings","c2","ZStream","BAD","TYPE","inflate_fast","ENOUGH_LENS","ENOUGH_DISTS","CODES","LENS","DISTS","inflate_table","root","q","inflate","constants","GZheader","require$$5","require$$6","Inflate","Z_SYNC_FLUSH","toNumber","fromBytes","long","Long","TBI","AbortablePromiseCache","freeGlobal","Symbol","objectProto","hasOwnProperty","nativeObjectToString","symToStringTag","funcTag","MAX_SAFE_INTEGER","argsTag","freeExports","freeModule","moduleExports","types","nodeUtil","isArray","isArguments","isTypedArray","nativeKeys","Transfer","isWorkerRuntime","postMessageToMaster","subscribeToMasterMessages","isObservable","expose","_RemoteFile","expected","found","text","parse","autoSql","chromStart","_parser","_customFields","parser","values"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAO,eAAe,aAAS,cAAc,EAAE,OAAO,KAAI,CAAE;AAE5D,WAAS,gBAAgB,UAAU,aAAa;AAC9C,QAAI,EAAE,oBAAoB,cAAc;AACtC,YAAM,IAAI,UAAU,mCAAmC;AAAA,IACxD;AAAA,EACH;AAEA,WAAS,kBAAkB,QAAQ,OAAO;AACxC,aAASA,KAAI,GAAGA,KAAI,MAAM,QAAQA,MAAK;AACrC,UAAI,aAAa,MAAMA,EAAC;AACxB,iBAAW,aAAa,WAAW,cAAc;AACjD,iBAAW,eAAe;AAC1B,UAAI,WAAW;AAAY,mBAAW,WAAW;AACjD,aAAO,eAAe,QAAQ,WAAW,KAAK,UAAU;AAAA,IACzD;AAAA,EACH;AAEA,WAAS,aAAa,aAAa,YAAY,aAAa;AAC1D,QAAI;AAAY,wBAAkB,YAAY,WAAW,UAAU;AACnE,QAAI;AAAa,wBAAkB,aAAa,WAAW;AAC3D,WAAO,eAAe,aAAa,aAAa;AAAA,MAC9C,UAAU;AAAA,IACd,CAAG;AACD,WAAO;AAAA,EACT;AAEA,WAAS,UAAU,UAAU,YAAY;AACvC,QAAI,OAAO,eAAe,cAAc,eAAe,MAAM;AAC3D,YAAM,IAAI,UAAU,oDAAoD;AAAA,IACzE;AAED,aAAS,YAAY,OAAO,OAAO,cAAc,WAAW,WAAW;AAAA,MACrE,a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AY,IAAI,GAAG,EAAG,QAAQ;AAC/C,QAAA,OAAO,UAAU,cAAc;AAGtB,eAAA,WAAW,QAAQ,eAAe,CAAG;AAAA,IAClD;AAEM,UAAA2B,UAAS,IAAI,YAAY,EAAE,OAAO,KAAK,UAAU,MAAM,CAAC,EAAE;AAChE,WAAO,SAASA,SAAQ,CAACA,OAAM,CAAC;AAAA,EACpC;AAEA,QAAM,gBAAgB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAKA,SAAO,aAAa;;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,95,96,97,98,99]} \ No newline at end of file diff --git a/dist/assets/gff-worker-71adf8b0.js.map b/dist/assets/gff-worker-71adf8b0.js.map new file mode 100644 index 00000000..c4de6209 --- /dev/null +++ b/dist/assets/gff-worker-71adf8b0.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gff-worker-71adf8b0.js","sources":["../node_modules/.pnpm/abortcontroller-polyfill@1.7.5/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/abortcontroller-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateAbortController.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateStatusReporter.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AbortablePromiseCache.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/index.js","../node_modules/.pnpm/quick-lru@4.0.1/node_modules/quick-lru/index.js","../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js","../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js","../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js","../__vite-browser-external","../node_modules/.pnpm/generic-filehandle@3.1.1/node_modules/generic-filehandle/esm/remoteFile.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js","../node_modules/.pnpm/@gmod+bgzf-filehandle@1.4.7/node_modules/@gmod/bgzf-filehandle/esm/unzip-pako.js","../node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/util.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/virtualOffset.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/chunk.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/indexFile.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tbi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/csi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tabixIndexedFile.js","../node_modules/.pnpm/events@3.3.0/node_modules/events/events.js","../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/stream-browser.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/buffer_list.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/destroy.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/errors-browser.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/state.js","../node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_writable.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_duplex.js","../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js","../node_modules/.pnpm/string_decoder@1.3.0/node_modules/string_decoder/lib/string_decoder.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/end-of-stream.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/async_iterator.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from-browser.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_readable.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_transform.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_passthrough.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/pipeline.js","../node_modules/.pnpm/stream-browserify@3.0.0/node_modules/stream-browserify/index.js","../node_modules/.pnpm/@gmod+gff@1.3.0/node_modules/@gmod/gff/esm/util.js","../node_modules/.pnpm/@gmod+gff@1.3.0/node_modules/@gmod/gff/esm/parse.js","../node_modules/.pnpm/@gmod+gff@1.3.0/node_modules/@gmod/gff/esm/api.js","../node_modules/.pnpm/@gmod+gff@1.3.0/node_modules/@gmod/gff/esm/index.js","../node_modules/.pnpm/is-observable@2.1.0/node_modules/is-observable/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/serializers.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/common.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/symbols.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/transferable.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/types/messages.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/implementation.browser.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/worker.mjs","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayMap.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toFinite.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toInteger.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copyArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIterateeCall.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseClamp.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseValues.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/values.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseRandom.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_shuffleSelf.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/sampleSize.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/ascending.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/bisector.js","../src/data-fetchers/utils.ts","../src/data-fetchers/gff/utils.ts","../src/data-fetchers/gff/gff-worker.ts"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get.apply(this, arguments);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'reason', {\n value: undefined,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort(reason) {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n var signalReason = reason;\n\n if (signalReason === undefined) {\n if (typeof document === 'undefined') {\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n } else {\n try {\n signalReason = new DOMException('signal is aborted without reason');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n }\n }\n }\n\n this.signal.reason = signalReason;\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","\"use strict\";\n/* eslint-disable */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbortSignal = exports.AbortController = void 0;\nconst cjs_ponyfill_1 = require(\"abortcontroller-polyfill/dist/cjs-ponyfill\");\nvar getGlobal = function () {\n // the only reliable means to get the global object is\n // `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n};\n//@ts-ignore\nlet AbortController = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortController : getGlobal().AbortController;\nexports.AbortController = AbortController;\n//@ts-ignore\nlet AbortSignal = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal;\nexports.AbortSignal = AbortSignal;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nclass NullSignal {\n}\n/**\n * aggregates a number of abort signals, will only fire the aggregated\n * abort if all of the input signals have been aborted\n */\nclass AggregateAbortController {\n constructor() {\n this.signals = new Set();\n this.abortController = new abortcontroller_ponyfill_1.AbortController();\n }\n /**\n * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy,\n * will be treated as a null-signal, and this abortcontroller will no\n * longer be abortable.\n */\n //@ts-ignore\n addSignal(signal = new NullSignal()) {\n if (this.signal.aborted) {\n throw new Error('cannot add a signal, already aborted!');\n }\n // note that a NullSignal will never fire, so if we\n // have one this thing will never actually abort\n this.signals.add(signal);\n if (signal.aborted) {\n // handle the abort immediately if it is already aborted\n // for some reason\n this.handleAborted(signal);\n }\n else if (typeof signal.addEventListener === 'function') {\n signal.addEventListener('abort', () => {\n this.handleAborted(signal);\n });\n }\n }\n handleAborted(signal) {\n this.signals.delete(signal);\n if (this.signals.size === 0) {\n this.abortController.abort();\n }\n }\n get signal() {\n return this.abortController.signal;\n }\n abort() {\n this.abortController.abort();\n }\n}\nexports.default = AggregateAbortController;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass AggregateStatusReporter {\n constructor() {\n this.callbacks = new Set();\n }\n addCallback(callback = () => { }) {\n this.callbacks.add(callback);\n callback(this.currentMessage);\n }\n callback(message) {\n this.currentMessage = message;\n this.callbacks.forEach(elt => {\n elt(message);\n });\n }\n}\nexports.default = AggregateStatusReporter;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nconst AggregateAbortController_1 = __importDefault(require(\"./AggregateAbortController\"));\nconst AggregateStatusReporter_1 = __importDefault(require(\"./AggregateStatusReporter\"));\nclass AbortablePromiseCache {\n constructor({ fill, cache, }) {\n if (typeof fill !== 'function') {\n throw new TypeError('must pass a fill function');\n }\n if (typeof cache !== 'object') {\n throw new TypeError('must pass a cache object');\n }\n if (typeof cache.get !== 'function' ||\n typeof cache.set !== 'function' ||\n typeof cache.delete !== 'function') {\n throw new TypeError('cache must implement get(key), set(key, val), and and delete(key)');\n }\n this.cache = cache;\n this.fillCallback = fill;\n }\n static isAbortException(exception) {\n return (\n // DOMException\n exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n //@ts-ignore\n exception.code === 'ERR_ABORTED' ||\n // stringified DOMException\n exception.message === 'AbortError: aborted' ||\n // stringified standard-ish exception\n exception.message === 'Error: aborted');\n }\n evict(key, entry) {\n if (this.cache.get(key) === entry) {\n this.cache.delete(key);\n }\n }\n fill(key, data, signal, statusCallback) {\n const aborter = new AggregateAbortController_1.default();\n const statusReporter = new AggregateStatusReporter_1.default();\n statusReporter.addCallback(statusCallback);\n const newEntry = {\n aborter: aborter,\n promise: this.fillCallback(data, aborter.signal, (message) => {\n statusReporter.callback(message);\n }),\n settled: false,\n statusReporter,\n get aborted() {\n return this.aborter.signal.aborted;\n },\n };\n newEntry.aborter.addSignal(signal);\n // remove the fill from the cache when its abortcontroller fires, if still in there\n newEntry.aborter.signal.addEventListener('abort', () => {\n if (!newEntry.settled) {\n this.evict(key, newEntry);\n }\n });\n // chain off the cached promise to record when it settles\n newEntry.promise\n .then(() => {\n newEntry.settled = true;\n }, () => {\n newEntry.settled = true;\n // if the fill throws an error (including abort) and is still in the cache, remove it\n this.evict(key, newEntry);\n })\n .catch(e => {\n // this will only be reached if there is some kind of\n // bad bug in this library\n console.error(e);\n throw e;\n });\n this.cache.set(key, newEntry);\n }\n static checkSinglePromise(promise, signal) {\n // check just this signal for having been aborted, and abort the\n // promise if it was, regardless of what happened with the cached\n // response\n function checkForSingleAbort() {\n if (signal && signal.aborted) {\n throw Object.assign(new Error('aborted'), { code: 'ERR_ABORTED' });\n }\n }\n return promise.then(result => {\n checkForSingleAbort();\n return result;\n }, error => {\n checkForSingleAbort();\n throw error;\n });\n }\n has(key) {\n return this.cache.has(key);\n }\n /**\n * Callback for getting status of the pending async\n *\n * @callback statusCallback\n * @param {any} status, current status string or message object\n */\n /**\n * @param {any} key cache key to use for this request\n * @param {any} data data passed as the first argument to the fill callback\n * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request\n * @param {statusCallback} a callback to get the current status of a pending async operation\n */\n get(key, data, signal, statusCallback) {\n if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) {\n throw new TypeError('second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?');\n }\n const cacheEntry = this.cache.get(key);\n if (cacheEntry) {\n if (cacheEntry.aborted && !cacheEntry.settled) {\n // if it's aborted but has not realized it yet, evict it and redispatch\n this.evict(key, cacheEntry);\n return this.get(key, data, signal, statusCallback);\n }\n if (cacheEntry.settled) {\n // too late to abort, just return it\n return cacheEntry.promise;\n }\n // request is in-flight, add this signal to its list of signals,\n // or if there is no signal, the aborter will become non-abortable\n cacheEntry.aborter.addSignal(signal);\n cacheEntry.statusReporter.addCallback(statusCallback);\n return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal);\n }\n // if we got here, it is not in the cache. fill.\n this.fill(key, data, signal, statusCallback);\n return AbortablePromiseCache.checkSinglePromise(\n //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-\n //eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.cache.get(key).promise, signal);\n }\n /**\n * delete the given entry from the cache. if it exists and its fill request has\n * not yet settled, the fill will be signaled to abort.\n *\n * @param {any} key\n */\n delete(key) {\n const cachedEntry = this.cache.get(key);\n if (cachedEntry) {\n if (!cachedEntry.settled) {\n cachedEntry.aborter.abort();\n }\n this.cache.delete(key);\n }\n }\n /**\n * Clear all requests from the cache. Aborts any that have not settled.\n * @returns {number} count of entries deleted\n */\n clear() {\n // iterate without needing regenerator-runtime\n const keyIter = this.cache.keys();\n let deleteCount = 0;\n for (let result = keyIter.next(); !result.done; result = keyIter.next()) {\n this.delete(result.value);\n deleteCount += 1;\n }\n return deleteCount;\n }\n}\nexports.default = AbortablePromiseCache;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst AbortablePromiseCache_1 = __importDefault(require(\"./AbortablePromiseCache\"));\nexports.default = AbortablePromiseCache_1.default;\n","'use strict';\n\nclass QuickLRU {\n\tconstructor(options = {}) {\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst value = this.oldCache.get(key);\n\t\t\tthis.oldCache.delete(key);\n\t\t\tthis._set(key, value);\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tset(key, value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, value);\n\t\t} else {\n\t\t\tthis._set(key, value);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\thas(key) {\n\t\treturn this.cache.has(key) || this.oldCache.has(key);\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this.oldCache.get(key);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tyield item;\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget size() {\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn this._size + oldCacheSize;\n\t}\n}\n\nmodule.exports = QuickLRU;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","export default {}","import { Buffer } from 'buffer';\nexport default class RemoteFile {\n async getBufferFromResponse(response) {\n if (typeof response.buffer === 'function') {\n return response.buffer();\n }\n else if (typeof response.arrayBuffer === 'function') {\n const resp = await response.arrayBuffer();\n return Buffer.from(resp);\n }\n else {\n throw new TypeError('invalid HTTP response object, has no buffer method, and no arrayBuffer method');\n }\n }\n constructor(source, opts = {}) {\n this.baseOverrides = {};\n this.url = source;\n const fetch = opts.fetch || globalThis.fetch.bind(globalThis);\n if (!fetch) {\n throw new TypeError(`no fetch function supplied, and none found in global environment`);\n }\n if (opts.overrides) {\n this.baseOverrides = opts.overrides;\n }\n this.fetchImplementation = fetch;\n }\n async fetch(input, init) {\n let response;\n try {\n response = await this.fetchImplementation(input, init);\n }\n catch (e) {\n if (`${e}`.includes('Failed to fetch')) {\n // refetch to to help work around a chrome bug (discussed in\n // generic-filehandle issue #72) in which the chrome cache returns a\n // CORS error for content in its cache. see also\n // https://github.com/GMOD/jbrowse-components/pull/1511\n console.warn(`generic-filehandle: refetching ${input} to attempt to work around chrome CORS header caching bug`);\n response = await this.fetchImplementation(input, {\n ...init,\n cache: 'reload',\n });\n }\n else {\n throw e;\n }\n }\n return response;\n }\n async read(buffer, offset = 0, length, position = 0, opts = {}) {\n const { headers = {}, signal, overrides = {} } = opts;\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n }\n else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n ...this.baseOverrides.headers,\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n };\n const response = await this.fetch(this.url, args);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n if ((response.status === 200 && position === 0) ||\n response.status === 206) {\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n return { bytesRead: bytesCopied, buffer };\n }\n if (response.status === 200) {\n throw new Error('${this.url} fetch returned status 200, expected 206');\n }\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n }\n async readFile(options = {}) {\n let encoding;\n let opts;\n if (typeof options === 'string') {\n encoding = options;\n opts = {};\n }\n else {\n encoding = options.encoding;\n opts = options;\n delete opts.encoding;\n }\n const { headers = {}, signal, overrides = {} } = opts;\n const args = {\n headers,\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n ...this.baseOverrides,\n ...overrides,\n };\n const response = await this.fetch(this.url, args);\n if (!response) {\n throw new Error('generic-filehandle failed to fetch');\n }\n if (response.status !== 200) {\n throw Object.assign(new Error(`HTTP ${response.status} fetching ${this.url}`), {\n status: response.status,\n });\n }\n if (encoding === 'utf8') {\n return response.text();\n }\n if (encoding) {\n throw new Error(`unsupported encoding: ${encoding}`);\n }\n return this.getBufferFromResponse(response);\n }\n async stat() {\n if (!this._stat) {\n const buf = Buffer.allocUnsafe(10);\n await this.read(buf, 0, 10, 0);\n if (!this._stat) {\n throw new Error(`unable to determine size of file at ${this.url}`);\n }\n }\n return this._stat;\n }\n async close() {\n return;\n }\n}\n//# sourceMappingURL=remoteFile.js.map","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","import { Buffer } from 'buffer';\n//@ts-ignore\nimport { Z_SYNC_FLUSH, Inflate } from 'pako';\n// browserify-zlib, which is the zlib shim used by default in webpacked code,\n// does not properly uncompress bgzf chunks that contain more than\n// one bgzf block, so export an unzip function that uses pako directly\n// if we are running in a browser.\nasync function unzip(inputData) {\n try {\n let strm;\n let pos = 0;\n let i = 0;\n const chunks = [];\n let totalSize = 0;\n let inflator;\n do {\n const remainingInput = inputData.subarray(pos);\n inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n pos += strm.next_in;\n chunks[i] = inflator.result;\n totalSize += chunks[i].length;\n i += 1;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n return Buffer.from(result);\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to pakounzip, except it does extra counting\n// to return the positions of compressed and decompressed\n// data offsets\nasync function unzipChunk(inputData) {\n try {\n let strm;\n let cpos = 0;\n let dpos = 0;\n const blocks = [];\n const cpositions = [];\n const dpositions = [];\n do {\n const remainingInput = inputData.slice(cpos);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = Buffer.from(inflator.result);\n blocks.push(buffer);\n cpositions.push(cpos);\n dpositions.push(dpos);\n cpos += strm.next_in;\n dpos += buffer.length;\n } while (strm.avail_in);\n const buffer = Buffer.concat(blocks);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to unzipChunk above but slices (0,minv.dataPosition) and\n// (maxv.dataPosition,end) off\nasync function unzipChunkSlice(inputData, chunk) {\n try {\n let strm;\n const { minv, maxv } = chunk;\n let cpos = minv.blockPosition;\n let dpos = minv.dataPosition;\n const chunks = [];\n const cpositions = [];\n const dpositions = [];\n let totalSize = 0;\n let i = 0;\n do {\n const remainingInput = inputData.subarray(cpos - minv.blockPosition);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = inflator.result;\n chunks.push(buffer);\n let len = buffer.length;\n cpositions.push(cpos);\n dpositions.push(dpos);\n if (chunks.length === 1 && minv.dataPosition) {\n // this is the first chunk, trim it\n chunks[0] = chunks[0].subarray(minv.dataPosition);\n len = chunks[0].length;\n }\n const origCpos = cpos;\n cpos += strm.next_in;\n dpos += len;\n if (origCpos >= maxv.blockPosition) {\n // this is the last chunk, trim it and stop decompressing\n // note if it is the same block is minv it subtracts that already\n // trimmed part of the slice length\n chunks[i] = chunks[i].subarray(0, maxv.blockPosition === minv.blockPosition\n ? maxv.dataPosition - minv.dataPosition + 1\n : maxv.dataPosition + 1);\n cpositions.push(cpos);\n dpositions.push(dpos);\n totalSize += chunks[i].length;\n break;\n }\n totalSize += chunks[i].length;\n i++;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n const buffer = Buffer.from(result);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\nfunction nodeUnzip() {\n throw new Error('nodeUnzip not implemented.');\n}\nexport { unzip, unzipChunk, unzipChunkSlice, unzip as pakoUnzip, nodeUnzip };\n//# sourceMappingURL=unzip-pako.js.map","module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n","export function longToNumber(long) {\n if (long.greaterThan(Number.MAX_SAFE_INTEGER) ||\n long.lessThan(Number.MIN_SAFE_INTEGER)) {\n throw new Error('integer overflow');\n }\n return long.toNumber();\n}\nclass AbortError extends Error {\n}\n/**\n * Properly check if the given AbortSignal is aborted.\n * Per the standard, if the signal reads as aborted,\n * this function throws either a DOMException AbortError, or a regular error\n * with a `code` attribute set to `ERR_ABORTED`.\n *\n * For convenience, passing `undefined` is a no-op\n *\n * @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute\n * @returns nothing\n */\nexport function checkAbortSignal(signal) {\n if (!signal) {\n return;\n }\n if (signal.aborted) {\n if (typeof DOMException !== 'undefined') {\n // eslint-disable-next-line no-undef\n throw new DOMException('aborted', 'AbortError');\n }\n else {\n const e = new AbortError('aborted');\n e.code = 'ERR_ABORTED';\n throw e;\n }\n }\n}\n/**\n * Skips to the next tick, then runs `checkAbortSignal`.\n * Await this to inside an otherwise synchronous loop to\n * provide a place to break when an abort signal is received.\n * @param {AbortSignal} signal\n */\nexport async function abortBreakPoint(signal) {\n await Promise.resolve();\n checkAbortSignal(signal);\n}\nexport function canMergeBlocks(chunk1, chunk2) {\n return (chunk2.minv.blockPosition - chunk1.maxv.blockPosition < 65000 &&\n chunk2.maxv.blockPosition - chunk1.minv.blockPosition < 5000000);\n}\nexport function optimizeChunks(chunks, lowest) {\n const mergedChunks = [];\n let lastChunk = null;\n if (chunks.length === 0) {\n return chunks;\n }\n chunks.sort(function (c0, c1) {\n const dif = c0.minv.blockPosition - c1.minv.blockPosition;\n if (dif !== 0) {\n return dif;\n }\n else {\n return c0.minv.dataPosition - c1.minv.dataPosition;\n }\n });\n chunks.forEach(chunk => {\n if (!lowest || chunk.maxv.compareTo(lowest) > 0) {\n if (lastChunk === null) {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n else {\n if (canMergeBlocks(lastChunk, chunk)) {\n if (chunk.maxv.compareTo(lastChunk.maxv) > 0) {\n lastChunk.maxv = chunk.maxv;\n }\n }\n else {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n }\n }\n });\n return mergedChunks;\n}\n//# sourceMappingURL=util.js.map","export default class VirtualOffset {\n constructor(blockPosition, dataPosition) {\n this.blockPosition = blockPosition; // < offset of the compressed data block\n this.dataPosition = dataPosition; // < offset into the uncompressed data\n }\n toString() {\n return `${this.blockPosition}:${this.dataPosition}`;\n }\n compareTo(b) {\n return (this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition);\n }\n static min(...args) {\n let min;\n let i = 0;\n for (; !min; i += 1) {\n min = args[i];\n }\n for (; i < args.length; i += 1) {\n if (min.compareTo(args[i]) > 0) {\n min = args[i];\n }\n }\n return min;\n }\n}\nexport function fromBytes(bytes, offset = 0, bigendian = false) {\n if (bigendian) {\n throw new Error('big-endian virtual file offsets not implemented');\n }\n return new VirtualOffset(bytes[offset + 7] * 0x10000000000 +\n bytes[offset + 6] * 0x100000000 +\n bytes[offset + 5] * 0x1000000 +\n bytes[offset + 4] * 0x10000 +\n bytes[offset + 3] * 0x100 +\n bytes[offset + 2], (bytes[offset + 1] << 8) | bytes[offset]);\n}\n//# sourceMappingURL=virtualOffset.js.map","// little class representing a chunk in the index\nexport default class Chunk {\n /**\n * @param {VirtualOffset} minv\n * @param {VirtualOffset} maxv\n * @param {number} bin\n * @param {number} [fetchedSize]\n */\n constructor(minv, maxv, bin, fetchedSize = undefined) {\n this.minv = minv;\n this.maxv = maxv;\n this.bin = bin;\n this._fetchedSize = fetchedSize;\n }\n toUniqueString() {\n return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`;\n }\n toString() {\n return this.toUniqueString();\n }\n compareTo(b) {\n return (this.minv.compareTo(b.minv) ||\n this.maxv.compareTo(b.maxv) ||\n this.bin - b.bin);\n }\n fetchedSize() {\n if (this._fetchedSize !== undefined) {\n return this._fetchedSize;\n }\n return this.maxv.blockPosition + (1 << 16) - this.minv.blockPosition;\n }\n}\n//# sourceMappingURL=chunk.js.map","export default class IndexFile {\n constructor({ filehandle, renameRefSeqs = (n) => n, }) {\n this.filehandle = filehandle;\n this.renameRefSeq = renameRefSeqs;\n }\n async getMetadata(opts = {}) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { indices, ...rest } = await this.parse(opts);\n return rest;\n }\n _findFirstData(currentFdl, virtualOffset) {\n if (currentFdl) {\n return currentFdl.compareTo(virtualOffset) > 0\n ? virtualOffset\n : currentFdl;\n }\n else {\n return virtualOffset;\n }\n }\n async parse(opts = {}) {\n if (!this.parseP) {\n this.parseP = this._parse(opts).catch(e => {\n this.parseP = undefined;\n throw e;\n });\n }\n return this.parseP;\n }\n async hasRefSeq(seqId, opts = {}) {\n return !!((await this.parse(opts)).indices[seqId] || {}).binIndex;\n }\n}\n//# sourceMappingURL=indexFile.js.map","import Long from 'long';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport { longToNumber, optimizeChunks, checkAbortSignal } from './util';\nimport IndexFile from './indexFile';\nconst TBI_MAGIC = 21578324; // TBI\\1\nconst TAD_LIDX_SHIFT = 14;\n/**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\nfunction reg2bins(beg, end) {\n beg += 1; // < convert to 1-based closed\n end -= 1;\n return [\n [0, 0],\n [1 + (beg >> 26), 1 + (end >> 26)],\n [9 + (beg >> 23), 9 + (end >> 23)],\n [73 + (beg >> 20), 73 + (end >> 20)],\n [585 + (beg >> 17), 585 + (end >> 17)],\n [4681 + (beg >> 14), 4681 + (end >> 14)],\n ];\n}\nexport default class TabixIndex extends IndexFile {\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const buf = await this.filehandle.readFile(opts);\n const bytes = await unzip(buf);\n checkAbortSignal(opts.signal);\n // check TBI magic numbers\n if (bytes.readUInt32LE(0) !== TBI_MAGIC /* \"TBI\\1\" */) {\n throw new Error('Not a TBI file');\n // TODO: do we need to support big-endian TBI files?\n }\n // number of reference sequences in the index\n const refCount = bytes.readInt32LE(4);\n const formatFlags = bytes.readInt32LE(8);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const formatOpts = {\n 0: 'generic',\n 1: 'SAM',\n 2: 'VCF',\n };\n const format = formatOpts[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(12),\n start: bytes.readInt32LE(16),\n end: bytes.readInt32LE(20),\n };\n const metaValue = bytes.readInt32LE(24);\n const depth = 5;\n const maxBinNumber = ((1 << ((depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (14 + depth * 3);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(28);\n // read sequence dictionary\n const nameSectionLength = bytes.readInt32LE(32);\n const { refNameToId, refIdToName } = this._parseNameBytes(bytes.slice(36, 36 + nameSectionLength));\n // read the indexes for each reference sequence\n let currOffset = 36 + nameSectionLength;\n let firstDataLine;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats;\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n currOffset += 4;\n if (bin > maxBinNumber + 1) {\n throw new Error('tabix index contains too many bins, please use a CSI index');\n }\n else if (bin === maxBinNumber + 1) {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n if (chunkCount === 2) {\n stats = this.parsePseudoBin(bytes, currOffset);\n }\n currOffset += 16 * chunkCount;\n }\n else {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n firstDataLine = this._findFirstData(firstDataLine, u);\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n // the linear index\n const linearCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const linearIndex = new Array(linearCount);\n for (let k = 0; k < linearCount; k += 1) {\n linearIndex[k] = fromBytes(bytes, currOffset);\n currOffset += 8;\n firstDataLine = this._findFirstData(firstDataLine, linearIndex[k]);\n }\n return { binIndex, linearIndex, stats };\n });\n return {\n indices,\n metaChar,\n maxBinNumber,\n maxRefLength,\n skipLines,\n firstDataLine,\n columnNumbers,\n coordinateType,\n format,\n refIdToName,\n refNameToId,\n maxBlockSize: 1 << 16,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 16, offset + 24), true));\n return { lineCount };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n const minOffset = ba.linearIndex.length\n ? ba.linearIndex[min >> TAD_LIDX_SHIFT >= ba.linearIndex.length\n ? ba.linearIndex.length - 1\n : min >> TAD_LIDX_SHIFT]\n : new VirtualOffset(0, 0);\n if (!minOffset) {\n console.warn('querying outside of possible tabix range');\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n // Use the linear index to find minimum file position of chunks that could\n // contain alignments in the region\n const nintv = ba.linearIndex.length;\n let lowest = null;\n const minLin = Math.min(min >> 14, nintv - 1);\n const maxLin = Math.min(max >> 14, nintv - 1);\n for (let i = minLin; i <= maxLin; ++i) {\n const vp = ba.linearIndex[i];\n if (vp) {\n if (!lowest || vp.compareTo(lowest) < 0) {\n lowest = vp;\n }\n }\n }\n return optimizeChunks(chunks, lowest);\n }\n}\n//# sourceMappingURL=tbi.js.map","import Long from 'long';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { longToNumber, optimizeChunks } from './util';\nimport IndexFile from './indexFile';\nconst CSI1_MAGIC = 21582659; // CSI\\1\nconst CSI2_MAGIC = 38359875; // CSI\\2\nfunction lshift(num, bits) {\n return num * 2 ** bits;\n}\nfunction rshift(num, bits) {\n return Math.floor(num / 2 ** bits);\n}\nexport default class CSI extends IndexFile {\n constructor(args) {\n super(args);\n this.maxBinNumber = 0;\n this.depth = 0;\n this.minShift = 0;\n }\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n async indexCov() {\n throw new Error('CSI indexes do not support indexcov');\n }\n parseAuxData(bytes, offset) {\n const formatFlags = bytes.readInt32LE(offset);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const format = { 0: 'generic', 1: 'SAM', 2: 'VCF' }[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(offset + 4),\n start: bytes.readInt32LE(offset + 8),\n end: bytes.readInt32LE(offset + 12),\n };\n const metaValue = bytes.readInt32LE(offset + 16);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(offset + 20);\n const nameSectionLength = bytes.readInt32LE(offset + 24);\n const { refIdToName, refNameToId } = this._parseNameBytes(bytes.slice(offset + 28, offset + 28 + nameSectionLength));\n return {\n refIdToName,\n refNameToId,\n skipLines,\n metaChar,\n columnNumbers,\n format,\n coordinateType,\n };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const bytes = await unzip((await this.filehandle.readFile(opts)));\n // check TBI magic numbers\n let csiVersion;\n if (bytes.readUInt32LE(0) === CSI1_MAGIC) {\n csiVersion = 1;\n }\n else if (bytes.readUInt32LE(0) === CSI2_MAGIC) {\n csiVersion = 2;\n }\n else {\n throw new Error('Not a CSI file');\n // TODO: do we need to support big-endian CSI files?\n }\n this.minShift = bytes.readInt32LE(4);\n this.depth = bytes.readInt32LE(8);\n this.maxBinNumber = ((1 << ((this.depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (this.minShift + this.depth * 3);\n const auxLength = bytes.readInt32LE(12);\n const aux = auxLength && auxLength >= 30\n ? this.parseAuxData(bytes, 16)\n : {\n refIdToName: [],\n refNameToId: {},\n metaChar: null,\n columnNumbers: { ref: 0, start: 1, end: 2 },\n coordinateType: 'zero-based-half-open',\n format: 'generic',\n };\n const refCount = bytes.readInt32LE(16 + auxLength);\n // read the indexes for each reference sequence\n let firstDataLine;\n let currOffset = 16 + auxLength + 4;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats; // < provided by parsing a pseudo-bin, if present\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n if (bin > this.maxBinNumber) {\n // this is a fake bin that actually has stats information\n // about the reference sequence in it\n stats = this.parsePseudoBin(bytes, currOffset + 4);\n currOffset += 4 + 8 + 4 + 16 + 16;\n }\n else {\n const loffset = fromBytes(bytes, currOffset + 4);\n firstDataLine = this._findFirstData(firstDataLine, loffset);\n const chunkCount = bytes.readInt32LE(currOffset + 12);\n currOffset += 16;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n // this._findFirstData(data, u)\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n return { binIndex, stats };\n });\n return {\n ...aux,\n csi: true,\n refCount,\n maxBlockSize: 1 << 16,\n firstDataLine,\n csiVersion,\n indices,\n depth: this.depth,\n maxBinNumber: this.maxBinNumber,\n maxRefLength,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 28, offset + 36), true));\n return { lineCount };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = this.reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n return optimizeChunks(chunks, new VirtualOffset(0, 0));\n }\n /**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\n reg2bins(beg, end) {\n beg -= 1; // < convert to 1-based closed\n if (beg < 1) {\n beg = 1;\n }\n if (end > 2 ** 50) {\n end = 2 ** 34;\n } // 17 GiB ought to be enough for anybody\n end -= 1;\n let l = 0;\n let t = 0;\n let s = this.minShift + this.depth * 3;\n const bins = [];\n for (; l <= this.depth; s -= 3, t += lshift(1, l * 3), l += 1) {\n const b = t + rshift(beg, s);\n const e = t + rshift(end, s);\n if (e - b + bins.length > this.maxBinNumber) {\n throw new Error(`query ${beg}-${end} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);\n }\n bins.push([b, e]);\n }\n return bins;\n }\n}\n//# sourceMappingURL=csi.js.map","import AbortablePromiseCache from 'abortable-promise-cache';\nimport LRU from 'quick-lru';\nimport { Buffer } from 'buffer';\nimport { LocalFile } from 'generic-filehandle';\nimport { unzip, unzipChunkSlice } from '@gmod/bgzf-filehandle';\nimport { checkAbortSignal } from './util';\nimport TBI from './tbi';\nimport CSI from './csi';\nconst decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8') : undefined;\nfunction timeout(time) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\nexport default class TabixIndexedFile {\n /**\n * @param {object} args\n * @param {string} [args.path]\n * @param {filehandle} [args.filehandle]\n * @param {string} [args.tbiPath]\n * @param {filehandle} [args.tbiFilehandle]\n * @param {string} [args.csiPath]\n * @param {filehandle} [args.csiFilehandle]\n * @param {number} [args.yieldTime] yield to main thread after N milliseconds if reading features is taking a long time to avoid hanging main thread\n * @param {function} [args.renameRefSeqs] optional function with sig `string => string` to transform\n * reference sequence names for the purpose of indexing and querying. note that the data that is returned is\n * not altered, just the names of the reference sequences that are used for querying.\n */\n constructor({ path, filehandle, tbiPath, tbiFilehandle, csiPath, csiFilehandle, yieldTime = 500, chunkSizeLimit = 50000000, renameRefSeqs = n => n, chunkCacheSize = 5 * 2 ** 20, }) {\n if (filehandle) {\n this.filehandle = filehandle;\n }\n else if (path) {\n this.filehandle = new LocalFile(path);\n }\n else {\n throw new TypeError('must provide either filehandle or path');\n }\n if (tbiFilehandle) {\n this.index = new TBI({\n filehandle: tbiFilehandle,\n renameRefSeqs,\n });\n }\n else if (csiFilehandle) {\n this.index = new CSI({\n filehandle: csiFilehandle,\n renameRefSeqs,\n });\n }\n else if (tbiPath) {\n this.index = new TBI({\n filehandle: new LocalFile(tbiPath),\n renameRefSeqs,\n });\n }\n else if (csiPath) {\n this.index = new CSI({\n filehandle: new LocalFile(csiPath),\n renameRefSeqs,\n });\n }\n else if (path) {\n this.index = new TBI({\n filehandle: new LocalFile(`${path}.tbi`),\n renameRefSeqs,\n });\n }\n else {\n throw new TypeError('must provide one of tbiFilehandle, tbiPath, csiFilehandle, or csiPath');\n }\n this.chunkSizeLimit = chunkSizeLimit;\n this.renameRefSeq = renameRefSeqs;\n this.yieldTime = yieldTime;\n this.chunkCache = new AbortablePromiseCache({\n cache: new LRU({ maxSize: Math.floor(chunkCacheSize / (1 << 16)) }),\n fill: (args, signal) => this.readChunk(args, { signal }),\n });\n }\n /**\n * @param refName name of the reference sequence\n * @param start start of the region (in 0-based half-open coordinates)\n * @param end end of the region (in 0-based half-open coordinates)\n * @param opts callback called for each line in the region. can also pass a object param containing obj.lineCallback, obj.signal, etc\n * @returns promise that is resolved when the whole read is finished, rejected on error\n */\n async getLines(refName, start, end, opts) {\n let signal;\n let options = {};\n let callback;\n if (typeof opts === 'undefined') {\n throw new TypeError('line callback must be provided');\n }\n if (typeof opts === 'function') {\n callback = opts;\n }\n else {\n options = opts;\n callback = opts.lineCallback;\n }\n if (refName === undefined) {\n throw new TypeError('must provide a reference sequence name');\n }\n if (!callback) {\n throw new TypeError('line callback must be provided');\n }\n const metadata = await this.index.getMetadata(options);\n checkAbortSignal(signal);\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = metadata.maxRefLength;\n }\n if (!(start <= end)) {\n throw new TypeError('invalid start and end coordinates. start must be less than or equal to end');\n }\n if (start === end) {\n return;\n }\n const chunks = await this.index.blocksForRange(refName, start, end, options);\n checkAbortSignal(signal);\n // check the chunks for any that are over the size limit. if\n // any are, don't fetch any of them\n for (let i = 0; i < chunks.length; i += 1) {\n const size = chunks[i].fetchedSize();\n if (size > this.chunkSizeLimit) {\n throw new Error(`Too much data. Chunk size ${size.toLocaleString()} bytes exceeds chunkSizeLimit of ${this.chunkSizeLimit.toLocaleString()}.`);\n }\n }\n // now go through each chunk and parse and filter the lines out of it\n let last = Date.now();\n for (let chunkNum = 0; chunkNum < chunks.length; chunkNum += 1) {\n let previousStartCoordinate;\n const c = chunks[chunkNum];\n const { buffer, cpositions, dpositions } = await this.chunkCache.get(c.toString(), c);\n checkAbortSignal(signal);\n let blockStart = 0;\n let pos = 0;\n while (blockStart < buffer.length) {\n const n = buffer.indexOf('\\n', blockStart);\n if (n === -1) {\n break;\n }\n const b = buffer.slice(blockStart, n);\n const line = (decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString();\n if (dpositions) {\n while (blockStart + c.minv.dataPosition >= dpositions[pos++]) { }\n pos--;\n }\n // filter the line for whether it is within the requested range\n const { startCoordinate, overlaps } = this.checkLine(metadata, refName, start, end, line);\n // do a small check just to make sure that the lines are really sorted\n // by start coordinate\n if (previousStartCoordinate !== undefined &&\n startCoordinate !== undefined &&\n previousStartCoordinate > startCoordinate) {\n throw new Error(`Lines not sorted by start coordinate (${previousStartCoordinate} > ${startCoordinate}), this file is not usable with Tabix.`);\n }\n previousStartCoordinate = startCoordinate;\n if (overlaps) {\n callback(line.trim(), \n // cpositions[pos] refers to actual file offset of a bgzip block boundaries\n //\n // we multiply by (1 <<8) in order to make sure each block has a \"unique\"\n // address space so that data in that block could never overlap\n //\n // then the blockStart-dpositions is an uncompressed file offset from\n // that bgzip block boundary, and since the cpositions are multiplied by\n // (1 << 8) these uncompressed offsets get a unique space\n cpositions[pos] * (1 << 8) +\n (blockStart - dpositions[pos]) +\n c.minv.dataPosition +\n 1);\n }\n else if (startCoordinate !== undefined && startCoordinate >= end) {\n // the lines were overlapping the region, but now have stopped, so\n // we must be at the end of the relevant data and we can stop\n // processing data now\n return;\n }\n // yield if we have emitted beyond the yield limit\n if (this.yieldTime && last - Date.now() > this.yieldTime) {\n last = Date.now();\n checkAbortSignal(signal);\n await timeout(1);\n }\n blockStart = n + 1;\n }\n }\n }\n async getMetadata(opts = {}) {\n return this.index.getMetadata(opts);\n }\n /**\n * get a buffer containing the \"header\" region of\n * the file, which are the bytes up to the first\n * non-meta line\n */\n async getHeaderBuffer(opts = {}) {\n const { firstDataLine, metaChar, maxBlockSize } = await this.getMetadata(opts);\n checkAbortSignal(opts.signal);\n const maxFetch = ((firstDataLine === null || firstDataLine === void 0 ? void 0 : firstDataLine.blockPosition) || 0) + maxBlockSize;\n // TODO: what if we don't have a firstDataLine, and the header\n // actually takes up more than one block? this case is not covered here\n let bytes = await this._readRegion(0, maxFetch, opts);\n checkAbortSignal(opts.signal);\n try {\n bytes = await unzip(bytes);\n }\n catch (e) {\n console.error(e);\n throw new Error(\n //@ts-ignore\n `error decompressing block ${e.code} at 0 (length ${maxFetch}) ${e}`);\n }\n // trim off lines after the last non-meta line\n if (metaChar) {\n // trim backward from the end\n let lastNewline = -1;\n const newlineByte = '\\n'.charCodeAt(0);\n const metaByte = metaChar.charCodeAt(0);\n for (let i = 0; i < bytes.length; i += 1) {\n if (i === lastNewline + 1 && bytes[i] !== metaByte) {\n break;\n }\n if (bytes[i] === newlineByte) {\n lastNewline = i;\n }\n }\n bytes = bytes.slice(0, lastNewline + 1);\n }\n return bytes;\n }\n /**\n * get a string containing the \"header\" region of the\n * file, is the portion up to the first non-meta line\n *\n * @returns {Promise} for a string\n */\n async getHeader(opts = {}) {\n const bytes = await this.getHeaderBuffer(opts);\n return bytes.toString('utf8');\n }\n /**\n * get an array of reference sequence names, in the order in which\n * they occur in the file. reference sequence renaming is not applied\n * to these names.\n */\n async getReferenceSequenceNames(opts = {}) {\n const metadata = await this.getMetadata(opts);\n return metadata.refIdToName;\n }\n /**\n * @param {object} metadata metadata object from the parsed index,\n * containing columnNumbers, metaChar, and format\n * @param {string} regionRefName\n * @param {number} regionStart region start coordinate (0-based-half-open)\n * @param {number} regionEnd region end coordinate (0-based-half-open)\n * @param {array[string]} line\n * @returns {object} like `{startCoordinate, overlaps}`. overlaps is boolean,\n * true if line is a data line that overlaps the given region\n */\n checkLine(metadata, regionRefName, regionStart, regionEnd, line) {\n const { columnNumbers, metaChar, coordinateType, format } = metadata;\n // skip meta lines\n if (line.charAt(0) === metaChar) {\n return { overlaps: false };\n }\n // check ref/start/end using column metadata from index\n let { ref, start, end } = columnNumbers;\n if (!ref) {\n ref = 0;\n }\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = 0;\n }\n if (format === 'VCF') {\n end = 8;\n }\n const maxColumn = Math.max(ref, start, end);\n // this code is kind of complex, but it is fairly fast.\n // basically, we want to avoid doing a split, because if the lines are really long\n // that could lead to us allocating a bunch of extra memory, which is slow\n let currentColumnNumber = 1; // cols are numbered starting at 1 in the index metadata\n let currentColumnStart = 0;\n let refSeq = '';\n let startCoordinate = -Infinity;\n for (let i = 0; i < line.length + 1; i += 1) {\n if (line[i] === '\\t' || i === line.length) {\n if (currentColumnNumber === ref) {\n if (this.renameRefSeq(line.slice(currentColumnStart, i)) !==\n regionRefName) {\n return { overlaps: false };\n }\n }\n else if (currentColumnNumber === start) {\n startCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n // we convert to 0-based-half-open\n if (coordinateType === '1-based-closed') {\n startCoordinate -= 1;\n }\n if (startCoordinate >= regionEnd) {\n return { startCoordinate, overlaps: false };\n }\n if (end === 0 || end === start) {\n // if we have no end, we assume the feature is 1 bp long\n if (startCoordinate + 1 <= regionStart) {\n return { startCoordinate, overlaps: false };\n }\n }\n }\n else if (format === 'VCF' && currentColumnNumber === 4) {\n refSeq = line.slice(currentColumnStart, i);\n }\n else if (currentColumnNumber === end) {\n let endCoordinate;\n // this will never match if there is no end column\n if (format === 'VCF') {\n endCoordinate = this._getVcfEnd(startCoordinate, refSeq, line.slice(currentColumnStart, i));\n }\n else {\n endCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n }\n if (endCoordinate <= regionStart) {\n return { overlaps: false };\n }\n }\n currentColumnStart = i + 1;\n currentColumnNumber += 1;\n if (currentColumnNumber > maxColumn) {\n break;\n }\n }\n }\n return { startCoordinate, overlaps: true };\n }\n _getVcfEnd(startCoordinate, refSeq, info) {\n let endCoordinate = startCoordinate + refSeq.length;\n // ignore TRA features as they specify CHR2 and END\n // as being on a different chromosome\n // if CHR2 is on the same chromosome, still ignore it\n // because there should be another pairwise feature\n // at the end of this one\n const isTRA = info.indexOf('SVTYPE=TRA') !== -1;\n if (info[0] !== '.' && !isTRA) {\n let prevChar = ';';\n for (let j = 0; j < info.length; j += 1) {\n if (prevChar === ';' && info.slice(j, j + 4) === 'END=') {\n let valueEnd = info.indexOf(';', j);\n if (valueEnd === -1) {\n valueEnd = info.length;\n }\n endCoordinate = parseInt(info.slice(j + 4, valueEnd), 10);\n break;\n }\n prevChar = info[j];\n }\n }\n else if (isTRA) {\n return startCoordinate + 1;\n }\n return endCoordinate;\n }\n /**\n * return the approximate number of data lines in the given reference sequence\n * @param refSeq reference sequence name\n * @returns number of data lines present on that reference sequence\n */\n async lineCount(refName, opts = {}) {\n return this.index.lineCount(refName, opts);\n }\n async _readRegion(pos, size, opts = {}) {\n const b = Buffer.alloc(size);\n const { bytesRead, buffer } = await this.filehandle.read(b, 0, size, pos, opts);\n return buffer.slice(0, bytesRead);\n }\n /**\n * read and uncompress the data in a chunk (composed of one or more\n * contiguous bgzip blocks) of the file\n */\n async readChunk(c, opts = {}) {\n // fetch the uncompressed data, uncompress carefully a block at a time,\n // and stop when done\n const data = await this._readRegion(c.minv.blockPosition, c.fetchedSize(), opts);\n try {\n return unzipChunkSlice(data, c);\n }\n catch (e) {\n throw new Error(`error decompressing c ${c.toString()} ${e}`);\n }\n }\n}\n//# sourceMappingURL=tabixIndexedFile.js.map","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n","module.exports = require('events').EventEmitter;\n","'use strict';\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar _require = require('buffer'),\n Buffer = _require.Buffer;\nvar _require2 = require('util'),\n inspect = _require2.inspect;\nvar custom = inspect && inspect.custom || 'inspect';\nfunction copyBuffer(src, target, offset) {\n Buffer.prototype.copy.call(src, target, offset);\n}\nmodule.exports = /*#__PURE__*/function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n _createClass(BufferList, [{\n key: \"push\",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: \"unshift\",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: \"shift\",\n value: function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: \"join\",\n value: function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n while (p = p.next) ret += s + p.data;\n return ret;\n }\n }, {\n key: \"concat\",\n value: function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n\n // Consumes a specified amount of bytes or characters from the buffered data.\n }, {\n key: \"consume\",\n value: function consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n // `slice` is the same for buffers and strings.\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n // First chunk is a perfect match.\n ret = this.shift();\n } else {\n // Result spans more than one buffer.\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n }, {\n key: \"first\",\n value: function first() {\n return this.head.data;\n }\n\n // Consumes a specified amount of characters from the buffered data.\n }, {\n key: \"_getString\",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Consumes a specified amount of bytes from the buffered data.\n }, {\n key: \"_getBuffer\",\n value: function _getBuffer(n) {\n var ret = Buffer.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Make sure the linked list only shows the minimal necessary information.\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread(_objectSpread({}, options), {}, {\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n }));\n }\n }]);\n return BufferList;\n}();","'use strict';\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n return this;\n}\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};","'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar codes = {};\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inheritsLoose(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n\n return NodeError;\n }(Base);\n\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {\n return 'The value \"' + value + '\" is invalid for option \"' + name + '\"';\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n }\n\n msg += \". Received type \".concat(typeof actual);\n return msg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');\ncreateErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {\n return 'The ' + name + ' method is not implemented';\n});\ncreateErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');\ncreateErrorType('ERR_STREAM_DESTROYED', function (name) {\n return 'Cannot call ' + name + ' after a stream was destroyed';\n});\ncreateErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');\ncreateErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');\ncreateErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');\ncreateErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);\ncreateErrorType('ERR_UNKNOWN_ENCODING', function (arg) {\n return 'Unknown encoding: ' + arg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');\nmodule.exports.codes = codes;\n","'use strict';\n\nvar ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n return Math.floor(hwm);\n }\n\n // Default value\n return state.objectMode ? 16 : 16 * 1024;\n}\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};","\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\nmodule.exports = Writable;\n\n/* */\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n\n/**/\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\nvar Buffer = require('buffer').Buffer;\nvar OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\nvar destroyImpl = require('./internal/streams/destroy');\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nrequire('inherits')(Writable, Stream);\nfunction nop() {}\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'finish' (and potentially 'end')\n this.autoDestroy = !!options.autoDestroy;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex);\n\n // legacy.\n this.writable = true;\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n // TODO: defer error events consistently everywhere, not just the cb\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n}\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n return ret;\n}\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n if (entry === null) state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\nWritable.prototype._writev = null;\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n errorOrDestroy(stream, err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n return need;\n}\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n\n // reuse the free corkReq.\n state.corkedRequestsFree.next = corkReq;\n}\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n};\n/**/\n\nmodule.exports = Duplex;\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\nrequire('inherits')(Duplex, Readable);\n{\n // Allow the keys array to be GC'ed.\n var keys = objectKeys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(onEndNT, this);\n}\nfunction onEndNT(self) {\n self.end();\n}\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});","/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\n/**/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}","// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n\n'use strict';\n\nvar ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n callback.apply(this, args);\n };\n}\nfunction noop() {}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n var writableEnded = stream._writableState && stream._writableState.finished;\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n var onclose = function onclose() {\n var err;\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\nmodule.exports = eos;","'use strict';\n\nvar _Object$setPrototypeO;\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar finished = require('./end-of-stream');\nvar kLastResolve = Symbol('lastResolve');\nvar kLastReject = Symbol('lastReject');\nvar kError = Symbol('error');\nvar kEnded = Symbol('ended');\nvar kLastPromise = Symbol('lastPromise');\nvar kHandlePromise = Symbol('handlePromise');\nvar kStream = Symbol('stream');\nfunction createIterResult(value, done) {\n return {\n value: value,\n done: done\n };\n}\nfunction readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n if (resolve !== null) {\n var data = iter[kStream].read();\n // we defer if data is null\n // we can be expecting either 'end' or\n // 'error'\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n}\nfunction onReadable(iter) {\n // we wait for the next tick, because it might\n // emit an error with process.nextTick\n process.nextTick(readAndResolve, iter);\n}\nfunction wrapForNext(lastPromise, iter) {\n return function (resolve, reject) {\n lastPromise.then(function () {\n if (iter[kEnded]) {\n resolve(createIterResult(undefined, true));\n return;\n }\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n}\nvar AsyncIteratorPrototype = Object.getPrototypeOf(function () {});\nvar ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n next: function next() {\n var _this = this;\n // if we have detected an error in the meanwhile\n // reject straight away\n var error = this[kError];\n if (error !== null) {\n return Promise.reject(error);\n }\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(undefined, true));\n }\n if (this[kStream].destroyed) {\n // We need to defer via nextTick because if .destroy(err) is\n // called, the error will be emitted via nextTick, and\n // we cannot guarantee that there is no error lingering around\n // waiting to be emitted.\n return new Promise(function (resolve, reject) {\n process.nextTick(function () {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(undefined, true));\n }\n });\n });\n }\n\n // if we have multiple next() calls\n // we will wait for the previous Promise to finish\n // this logic is optimized to support for await loops,\n // where next() is only called once at a time\n var lastPromise = this[kLastPromise];\n var promise;\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n // fast path needed to support multiple this.push()\n // without triggering the next() queue\n var data = this[kStream].read();\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n promise = new Promise(this[kHandlePromise]);\n }\n this[kLastPromise] = promise;\n return promise;\n }\n}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {\n return this;\n}), _defineProperty(_Object$setPrototypeO, \"return\", function _return() {\n var _this2 = this;\n // destroy(err, cb) is a private API\n // we can guarantee we have that here, because we control the\n // Readable class this is attached to\n return new Promise(function (resolve, reject) {\n _this2[kStream].destroy(null, function (err) {\n if (err) {\n reject(err);\n return;\n }\n resolve(createIterResult(undefined, true));\n });\n });\n}), _Object$setPrototypeO), AsyncIteratorPrototype);\nvar createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {\n var _Object$create;\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function (err) {\n if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n var reject = iterator[kLastReject];\n // reject if we are waiting for data in the Promise\n // returned by next() and store the error\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n iterator[kError] = err;\n return;\n }\n var resolve = iterator[kLastResolve];\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(undefined, true));\n }\n iterator[kEnded] = true;\n });\n stream.on('readable', onReadable.bind(null, iterator));\n return iterator;\n};\nmodule.exports = createReadableStreamAsyncIterator;","module.exports = function () {\n throw new Error('Readable.from is not available in the browser')\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nmodule.exports = Readable;\n\n/**/\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n\n/**/\nvar EE = require('events').EventEmitter;\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\nvar Buffer = require('buffer').Buffer;\nvar OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/**/\nvar debugUtil = require('util');\nvar debug;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\nvar BufferList = require('./internal/streams/buffer_list');\nvar destroyImpl = require('./internal/streams/destroy');\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;\n\n// Lazy loaded to improve the startup performance.\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\nrequire('inherits')(Readable, Stream);\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'end' (and potentially 'finish')\n this.autoDestroy = !!options.autoDestroy;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options);\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex);\n\n // legacy\n this.readable = true;\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n Stream.call(this);\n}\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n\n // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n return er;\n}\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder;\n // If setEncoding(null), decoder.encoding equals utf8\n this._readableState.encoding = this._readableState.decoder.encoding;\n\n // Iterate over current buffer to convert already stored Buffers:\n var p = this._readableState.buffer.head;\n var content = '';\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n this._readableState.buffer.clear();\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n};\n\n// Don't raise the hwm > 1GB\nvar MAX_HWM = 0x40000000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n }\n\n // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n return dest;\n};\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0;\n\n // Try start flowing on next tick if stream isn't explicitly paused\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true;\n\n // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n state.paused = false;\n return this;\n};\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n this._readableState.paused = true;\n return this;\n};\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null);\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n return this;\n};\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');\n }\n return createReadableStreamAsyncIterator(this);\n };\n}\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n});\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length);\n\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = require('./internal/streams/from');\n }\n return from(Readable, iterable, opts);\n };\n}\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\nvar _require$codes = require('../errors').codes,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\nvar Duplex = require('./_stream_duplex');\nrequire('inherits')(Transform, Duplex);\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null)\n // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\nfunction prefinish() {\n var _this = this;\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null)\n // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\nvar Transform = require('./_stream_transform');\nrequire('inherits')(PassThrough, Transform);\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n Transform.call(this, options);\n}\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};","// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n\n'use strict';\n\nvar eos;\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n callback.apply(void 0, arguments);\n };\n}\nvar _require$codes = require('../../../errors').codes,\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\nfunction noop(err) {\n // Rethrow the error if it exists to avoid swallowing it\n if (err) throw err;\n}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on('close', function () {\n closed = true;\n });\n if (eos === undefined) eos = require('./end-of-stream');\n eos(stream, {\n readable: reading,\n writable: writing\n }, function (err) {\n if (err) return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function (err) {\n if (closed) return;\n if (destroyed) return;\n destroyed = true;\n\n // request.destroy just do .end - .abort is what we want\n if (isRequest(stream)) return stream.abort();\n if (typeof stream.destroy === 'function') return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED('pipe'));\n };\n}\nfunction call(fn) {\n fn();\n}\nfunction pipe(from, to) {\n return from.pipe(to);\n}\nfunction popCallback(streams) {\n if (!streams.length) return noop;\n if (typeof streams[streams.length - 1] !== 'function') return noop;\n return streams.pop();\n}\nfunction pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n var callback = popCallback(streams);\n if (Array.isArray(streams[0])) streams = streams[0];\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams');\n }\n var error;\n var destroys = streams.map(function (stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function (err) {\n if (!error) error = err;\n if (err) destroys.forEach(call);\n if (reading) return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n}\nmodule.exports = pipeline;","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = require('events').EventEmitter;\nvar inherits = require('inherits');\n\ninherits(Stream, EE);\nStream.Readable = require('readable-stream/lib/_stream_readable.js');\nStream.Writable = require('readable-stream/lib/_stream_writable.js');\nStream.Duplex = require('readable-stream/lib/_stream_duplex.js');\nStream.Transform = require('readable-stream/lib/_stream_transform.js');\nStream.PassThrough = require('readable-stream/lib/_stream_passthrough.js');\nStream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js')\nStream.pipeline = require('readable-stream/lib/internal/streams/pipeline.js')\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n","// Fast, low-level functions for parsing and formatting GFF3.\n// JavaScript port of Robert Buels's Bio::GFF3::LowLevel Perl module.\n/**\n * Unescape a string value used in a GFF3 attribute.\n *\n * @param stringVal - Escaped GFF3 string value\n * @returns An unescaped string value\n */\nexport function unescape(stringVal) {\n return stringVal.replace(/%([0-9A-Fa-f]{2})/g, (_match, seq) => String.fromCharCode(parseInt(seq, 16)));\n}\nfunction _escape(regex, s) {\n return String(s).replace(regex, (ch) => {\n const hex = ch.charCodeAt(0).toString(16).toUpperCase().padStart(2, '0');\n return `%${hex}`;\n });\n}\n/**\n * Escape a value for use in a GFF3 attribute value.\n *\n * @param rawVal - Raw GFF3 attribute value\n * @returns An escaped string value\n */\nexport function escape(rawVal) {\n return _escape(/[\\n;\\r\\t=%&,\\x00-\\x1f\\x7f-\\xff]/g, rawVal);\n}\n/**\n * Escape a value for use in a GFF3 column value.\n *\n * @param rawVal - Raw GFF3 column value\n * @returns An escaped column value\n */\nexport function escapeColumn(rawVal) {\n return _escape(/[\\n\\r\\t%\\x00-\\x1f\\x7f-\\xff]/g, rawVal);\n}\n/**\n * Parse the 9th column (attributes) of a GFF3 feature line.\n *\n * @param attrString - String of GFF3 9th column\n * @returns Parsed attributes\n */\nexport function parseAttributes(attrString) {\n if (!(attrString && attrString.length) || attrString === '.')\n return {};\n const attrs = {};\n attrString\n .replace(/\\r?\\n$/, '')\n .split(';')\n .forEach((a) => {\n const nv = a.split('=', 2);\n if (!(nv[1] && nv[1].length))\n return;\n nv[0] = nv[0].trim();\n let arec = attrs[nv[0].trim()];\n if (!arec) {\n arec = [];\n attrs[nv[0]] = arec;\n }\n arec.push(...nv[1]\n .split(',')\n .map((s) => s.trim())\n .map(unescape));\n });\n return attrs;\n}\n/**\n * Parse a GFF3 feature line\n *\n * @param line - GFF3 feature line\n * @returns The parsed feature\n */\nexport function parseFeature(line) {\n // split the line into columns and replace '.' with null in each column\n const f = line.split('\\t').map((a) => (a === '.' || a === '' ? null : a));\n // unescape only the ref, source, and type columns\n const parsed = {\n seq_id: f[0] && unescape(f[0]),\n source: f[1] && unescape(f[1]),\n type: f[2] && unescape(f[2]),\n start: f[3] === null ? null : parseInt(f[3], 10),\n end: f[4] === null ? null : parseInt(f[4], 10),\n score: f[5] === null ? null : parseFloat(f[5]),\n strand: f[6],\n phase: f[7],\n attributes: f[8] === null ? null : parseAttributes(f[8]),\n };\n return parsed;\n}\n/**\n * Parse a GFF3 directive line.\n *\n * @param line - GFF3 directive line\n * @returns The parsed directive\n */\nexport function parseDirective(line) {\n const match = /^\\s*##\\s*(\\S+)\\s*(.*)/.exec(line);\n if (!match)\n return null;\n const [, name] = match;\n let [, , contents] = match;\n const parsed = { directive: name };\n if (contents.length) {\n contents = contents.replace(/\\r?\\n$/, '');\n parsed.value = contents;\n }\n // do a little additional parsing for sequence-region and genome-build directives\n if (name === 'sequence-region') {\n const c = contents.split(/\\s+/, 3);\n return {\n ...parsed,\n seq_id: c[0],\n start: c[1] && c[1].replace(/\\D/g, ''),\n end: c[2] && c[2].replace(/\\D/g, ''),\n };\n }\n else if (name === 'genome-build') {\n const [source, buildName] = contents.split(/\\s+/, 2);\n return {\n ...parsed,\n source,\n buildName,\n };\n }\n return parsed;\n}\n/**\n * Format an attributes object into a string suitable for the 9th column of GFF3.\n *\n * @param attrs - Attributes\n * @returns GFF3 9th column string\n */\nexport function formatAttributes(attrs) {\n const attrOrder = [];\n Object.entries(attrs).forEach(([tag, val]) => {\n if (!val)\n return;\n let valstring;\n if (val.hasOwnProperty('toString')) {\n valstring = escape(val.toString());\n // } else if (Array.isArray(val.values)) {\n // valstring = val.values.map(escape).join(',')\n }\n else if (Array.isArray(val)) {\n valstring = val.map(escape).join(',');\n }\n else {\n valstring = escape(val);\n }\n attrOrder.push(`${escape(tag)}=${valstring}`);\n });\n return attrOrder.length ? attrOrder.join(';') : '.';\n}\nfunction _formatSingleFeature(f, seenFeature) {\n const attrString = f.attributes === null || f.attributes === undefined\n ? '.'\n : formatAttributes(f.attributes);\n const fields = [\n f.seq_id === null ? '.' : escapeColumn(f.seq_id),\n f.source === null ? '.' : escapeColumn(f.source),\n f.type === null ? '.' : escapeColumn(f.type),\n f.start === null ? '.' : escapeColumn(f.start),\n f.end === null ? '.' : escapeColumn(f.end),\n f.score === null ? '.' : escapeColumn(f.score),\n f.strand === null ? '.' : escapeColumn(f.strand),\n f.phase === null ? '.' : escapeColumn(f.phase),\n attrString,\n ];\n const formattedString = `${fields.join('\\t')}\\n`;\n // if we have already output this exact feature, skip it\n if (seenFeature[formattedString]) {\n return '';\n }\n seenFeature[formattedString] = true;\n return formattedString;\n}\nfunction _formatFeature(feature, seenFeature) {\n if (Array.isArray(feature)) {\n return feature.map((f) => _formatFeature(f, seenFeature)).join('');\n }\n const strings = [_formatSingleFeature(feature, seenFeature)];\n if (_isFeatureLineWithRefs(feature)) {\n strings.push(...feature.child_features.map((f) => _formatFeature(f, seenFeature)), ...feature.derived_features.map((f) => _formatFeature(f, seenFeature)));\n }\n return strings.join('');\n}\n/**\n * Format a feature object or array of feature objects into one or more lines of\n * GFF3.\n *\n * @param featureOrFeatures - A feature object or array of feature objects\n * @returns A string of one or more GFF3 lines\n */\nexport function formatFeature(featureOrFeatures) {\n const seen = {};\n return _formatFeature(featureOrFeatures, seen);\n}\n/**\n * Format a directive into a line of GFF3.\n *\n * @param directive - A directive object\n * @returns A directive line string\n */\nexport function formatDirective(directive) {\n let str = `##${directive.directive}`;\n if (directive.value)\n str += ` ${directive.value}`;\n str += '\\n';\n return str;\n}\n/**\n * Format a comment into a GFF3 comment.\n * Yes I know this is just adding a # and a newline.\n *\n * @param comment - A comment object\n * @returns A comment line string\n */\nexport function formatComment(comment) {\n return `# ${comment.comment}\\n`;\n}\n/**\n * Format a sequence object as FASTA\n *\n * @param seq - A sequence object\n * @returns Formatted single FASTA sequence string\n */\nexport function formatSequence(seq) {\n return `>${seq.id}${seq.description ? ` ${seq.description}` : ''}\\n${seq.sequence}\\n`;\n}\n/**\n * Format a directive, comment, sequence, or feature, or array of such items,\n * into one or more lines of GFF3.\n *\n * @param itemOrItems - A comment, sequence, or feature, or array of such items\n * @returns A formatted string or array of strings\n */\nexport function formatItem(itemOrItems) {\n function formatSingleItem(item) {\n if ('attributes' in item)\n return formatFeature(item);\n if ('directive' in item)\n return formatDirective(item);\n if ('sequence' in item)\n return formatSequence(item);\n if ('comment' in item)\n return formatComment(item);\n return '# (invalid item found during format)\\n';\n }\n if (Array.isArray(itemOrItems)) {\n return itemOrItems.map(formatSingleItem);\n }\n return formatSingleItem(itemOrItems);\n}\nfunction _isFeatureLineWithRefs(featureLine) {\n return (featureLine.child_features !== undefined &&\n featureLine.derived_features !== undefined);\n}\n//# sourceMappingURL=util.js.map","import * as GFF3 from './util';\nconst containerAttributes = {\n Parent: 'child_features',\n Derives_from: 'derived_features',\n};\nexport class FASTAParser {\n constructor(seqCallback) {\n this.seqCallback = seqCallback;\n this.currentSequence = undefined;\n }\n addLine(line) {\n const defMatch = /^>\\s*(\\S+)\\s*(.*)/.exec(line);\n if (defMatch) {\n this._flush();\n this.currentSequence = { id: defMatch[1], sequence: '' };\n if (defMatch[2])\n this.currentSequence.description = defMatch[2].trim();\n }\n else if (this.currentSequence && /\\S/.test(line)) {\n this.currentSequence.sequence += line.replace(/\\s/g, '');\n }\n }\n _flush() {\n if (this.currentSequence)\n this.seqCallback(this.currentSequence);\n }\n finish() {\n this._flush();\n }\n}\nexport default class Parser {\n constructor(args) {\n this.fastaParser = undefined;\n // if this is true, the parser ignores the\n // rest of the lines in the file. currently\n // set when the file switches over to FASTA\n this.eof = false;\n this.lineNumber = 0;\n // features that we have to keep on hand for now because they\n // might be referenced by something else\n this._underConstructionTopLevel = [];\n // index of the above by ID\n this._underConstructionById = {};\n this._completedReferences = {};\n // features that reference something we have not seen yet\n // structured as:\n // { 'some_id' : {\n // 'Parent' : [ orphans that have a Parent attr referencing it ],\n // 'Derives_from' : [ orphans that have a Derives_from attr referencing it ],\n // }\n // }\n this._underConstructionOrphans = {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const nullFunc = () => { };\n this.featureCallback = args.featureCallback || nullFunc;\n this.endCallback = args.endCallback || nullFunc;\n this.commentCallback = args.commentCallback || nullFunc;\n this.errorCallback = args.errorCallback || nullFunc;\n this.directiveCallback = args.directiveCallback || nullFunc;\n this.sequenceCallback = args.sequenceCallback || nullFunc;\n this.disableDerivesFromReferences =\n args.disableDerivesFromReferences || false;\n // number of lines to buffer\n this.bufferSize = args.bufferSize === undefined ? 1000 : args.bufferSize;\n }\n addLine(line) {\n // if we have transitioned to a fasta section, just delegate to that parser\n if (this.fastaParser) {\n this.fastaParser.addLine(line);\n return;\n }\n if (this.eof) {\n // otherwise, if we are done, ignore this line\n return;\n }\n this.lineNumber += 1;\n if (/^\\s*[^#\\s>]/.test(line)) {\n // feature line, most common case\n this._bufferLine(line);\n return;\n }\n const match = /^\\s*(#+)(.*)/.exec(line);\n if (match) {\n // directive or comment\n const [, hashsigns] = match;\n let [, , contents] = match;\n if (hashsigns.length === 3) {\n // sync directive, all forward-references are resolved.\n this._emitAllUnderConstructionFeatures();\n }\n else if (hashsigns.length === 2) {\n const directive = GFF3.parseDirective(line);\n if (directive) {\n if (directive.directive === 'FASTA') {\n this._emitAllUnderConstructionFeatures();\n this.eof = true;\n this.fastaParser = new FASTAParser(this.sequenceCallback);\n }\n else {\n this._emitItem(directive);\n }\n }\n }\n else {\n contents = contents.replace(/\\s*/, '');\n this._emitItem({ comment: contents });\n }\n }\n else if (/^\\s*$/.test(line)) {\n // blank line, do nothing\n }\n else if (/^\\s*>/.test(line)) {\n // implicit beginning of a FASTA section\n this._emitAllUnderConstructionFeatures();\n this.eof = true;\n this.fastaParser = new FASTAParser(this.sequenceCallback);\n this.fastaParser.addLine(line);\n }\n else {\n // it's a parse error\n const errLine = line.replace(/\\r?\\n?$/g, '');\n throw new Error(`GFF3 parse error. Cannot parse '${errLine}'.`);\n }\n }\n finish() {\n this._emitAllUnderConstructionFeatures();\n if (this.fastaParser)\n this.fastaParser.finish();\n this.endCallback();\n }\n _emitItem(i) {\n if (Array.isArray(i))\n this.featureCallback(i);\n else if ('directive' in i)\n this.directiveCallback(i);\n else if ('comment' in i)\n this.commentCallback(i);\n }\n _enforceBufferSizeLimit(additionalItemCount = 0) {\n const _unbufferItem = (item) => {\n if (item &&\n Array.isArray(item) &&\n item[0].attributes &&\n item[0].attributes.ID &&\n item[0].attributes.ID[0]) {\n const ids = item[0].attributes.ID;\n ids.forEach((id) => {\n delete this._underConstructionById[id];\n delete this._completedReferences[id];\n });\n item.forEach((i) => {\n if (i.child_features)\n i.child_features.forEach((c) => _unbufferItem(c));\n if (i.derived_features)\n i.derived_features.forEach((d) => _unbufferItem(d));\n });\n }\n };\n while (this._underConstructionTopLevel.length + additionalItemCount >\n this.bufferSize) {\n const item = this._underConstructionTopLevel.shift();\n if (item) {\n this._emitItem(item);\n _unbufferItem(item);\n }\n }\n }\n /**\n * return all under-construction features, called when we know\n * there will be no additional data to attach to them\n */\n _emitAllUnderConstructionFeatures() {\n this._underConstructionTopLevel.forEach(this._emitItem.bind(this));\n this._underConstructionTopLevel = [];\n this._underConstructionById = {};\n this._completedReferences = {};\n // if we have any orphans hanging around still, this is a\n // problem. die with a parse error\n if (Array.from(Object.values(this._underConstructionOrphans)).length) {\n throw new Error(`some features reference other features that do not exist in the file (or in the same '###' scope). ${Object.keys(this._underConstructionOrphans)}`);\n }\n }\n // do the right thing with a newly-parsed feature line\n _bufferLine(line) {\n var _a, _b, _c;\n const rawFeatureLine = GFF3.parseFeature(line);\n const featureLine = {\n ...rawFeatureLine,\n child_features: [],\n derived_features: [],\n };\n // featureLine._lineNumber = this.lineNumber //< debugging aid\n // NOTE: a feature is an arrayref of one or more feature lines.\n const ids = ((_a = featureLine.attributes) === null || _a === void 0 ? void 0 : _a.ID) || [];\n const parents = ((_b = featureLine.attributes) === null || _b === void 0 ? void 0 : _b.Parent) || [];\n const derives = this.disableDerivesFromReferences\n ? []\n : ((_c = featureLine.attributes) === null || _c === void 0 ? void 0 : _c.Derives_from) || [];\n if (!ids.length && !parents.length && !derives.length) {\n // if it has no IDs and does not refer to anything, we can just\n // output it\n this._emitItem([featureLine]);\n return;\n }\n let feature = undefined;\n ids.forEach((id) => {\n const existing = this._underConstructionById[id];\n if (existing) {\n // another location of the same feature\n if (existing[existing.length - 1].type !== featureLine.type) {\n this._parseError(`multi-line feature \"${id}\" has inconsistent types: \"${featureLine.type}\", \"${existing[existing.length - 1].type}\"`);\n }\n existing.push(featureLine);\n feature = existing;\n }\n else {\n // haven't seen it yet, so buffer it so we can attach\n // child features to it\n feature = [featureLine];\n this._enforceBufferSizeLimit(1);\n if (!parents.length && !derives.length) {\n this._underConstructionTopLevel.push(feature);\n }\n this._underConstructionById[id] = feature;\n // see if we have anything buffered that refers to it\n this._resolveReferencesTo(feature, id);\n }\n });\n // try to resolve all its references\n this._resolveReferencesFrom(feature || [featureLine], { Parent: parents, Derives_from: derives }, ids);\n }\n _resolveReferencesTo(feature, id) {\n const references = this._underConstructionOrphans[id];\n // references is of the form\n // {\n // 'Parent' : [ orphans that have a Parent attr referencing this feature ],\n // 'Derives_from' : [ orphans that have a Derives_from attr referencing this feature ],\n // }\n if (!references)\n return;\n feature.forEach((loc) => {\n loc.child_features.push(...references.Parent);\n });\n feature.forEach((loc) => {\n loc.derived_features.push(...references.Derives_from);\n });\n delete this._underConstructionOrphans[id];\n }\n _parseError(message) {\n this.eof = true;\n this.errorCallback(`${this.lineNumber}: ${message}`);\n }\n _resolveReferencesFrom(feature, references, ids) {\n // this is all a bit more awkward in javascript than it was in perl\n function postSet(obj, slot1, slot2) {\n let subObj = obj[slot1];\n if (!subObj) {\n subObj = {};\n obj[slot1] = subObj;\n }\n const returnVal = subObj[slot2] || false;\n subObj[slot2] = true;\n return returnVal;\n }\n references.Parent.forEach((toId) => {\n const otherFeature = this._underConstructionById[toId];\n if (otherFeature) {\n const pname = containerAttributes.Parent;\n if (!ids.filter((id) => postSet(this._completedReferences, id, `Parent,${toId}`)).length) {\n otherFeature.forEach((location) => {\n location[pname].push(feature);\n });\n }\n }\n else {\n let ref = this._underConstructionOrphans[toId];\n if (!ref) {\n ref = {\n Parent: [],\n Derives_from: [],\n };\n this._underConstructionOrphans[toId] = ref;\n }\n ref.Parent.push(feature);\n }\n });\n references.Derives_from.forEach((toId) => {\n const otherFeature = this._underConstructionById[toId];\n if (otherFeature) {\n const pname = containerAttributes.Derives_from;\n if (!ids.filter((id) => postSet(this._completedReferences, id, `Derives_from,${toId}`)).length) {\n otherFeature.forEach((location) => {\n location[pname].push(feature);\n });\n }\n }\n else {\n let ref = this._underConstructionOrphans[toId];\n if (!ref) {\n ref = {\n Parent: [],\n Derives_from: [],\n };\n this._underConstructionOrphans[toId] = ref;\n }\n ref.Derives_from.push(feature);\n }\n });\n }\n}\n//# sourceMappingURL=parse.js.map","import { Transform } from 'stream';\nimport { StringDecoder as Decoder } from 'string_decoder';\nimport Parser from './parse';\nimport { formatItem, formatSequence, } from './util';\n// call a callback on the next process tick if running in\n// an environment that supports it\nfunction _callback(callback) {\n if (process && process.nextTick)\n process.nextTick(callback);\n else\n callback();\n}\n// shared arg processing for the parse routines\nfunction _processParseOptions(options) {\n const out = {\n encoding: 'utf8',\n parseFeatures: true,\n parseDirectives: false,\n parseSequences: true,\n parseComments: false,\n bufferSize: 1000,\n disableDerivesFromReferences: false,\n ...options,\n };\n if (options.parseAll) {\n out.parseFeatures = true;\n out.parseDirectives = true;\n out.parseComments = true;\n out.parseSequences = true;\n }\n return out;\n}\nclass GFFTransform extends Transform {\n constructor(inputOptions = {}) {\n super({ objectMode: true });\n this.textBuffer = '';\n const options = _processParseOptions(inputOptions);\n this.encoding = inputOptions.encoding || 'utf8';\n this.decoder = new Decoder();\n const push = this.push.bind(this);\n this.parser = new Parser({\n featureCallback: options.parseFeatures ? push : undefined,\n directiveCallback: options.parseDirectives ? push : undefined,\n commentCallback: options.parseComments ? push : undefined,\n sequenceCallback: options.parseSequences ? push : undefined,\n errorCallback: (err) => this.emit('error', err),\n bufferSize: options.bufferSize,\n disableDerivesFromReferences: options.disableDerivesFromReferences,\n });\n }\n _addLine(data) {\n if (data) {\n this.parser.addLine(data);\n }\n }\n _nextText(buffer) {\n const pieces = (this.textBuffer + buffer).split(/\\r?\\n/);\n this.textBuffer = pieces.pop() || '';\n pieces.forEach((piece) => this._addLine(piece));\n }\n _transform(chunk, _encoding, callback) {\n this._nextText(this.decoder.write(chunk));\n _callback(callback);\n }\n _flush(callback) {\n if (this.decoder.end)\n this._nextText(this.decoder.end());\n if (this.textBuffer != null)\n this._addLine(this.textBuffer);\n this.parser.finish();\n _callback(callback);\n }\n}\n/**\n * Parse a stream of text data into a stream of feature, directive, comment,\n * an sequence objects.\n *\n * @param options - Parsing options\n * @returns stream (in objectMode) of parsed items\n */\nexport function parseStream(options = {}) {\n return new GFFTransform(options);\n}\nexport function parseStringSync(str, inputOptions = {}) {\n if (!str)\n return [];\n const options = _processParseOptions(inputOptions);\n const items = [];\n const push = items.push.bind(items);\n const parser = new Parser({\n featureCallback: options.parseFeatures ? push : undefined,\n directiveCallback: options.parseDirectives ? push : undefined,\n commentCallback: options.parseComments ? push : undefined,\n sequenceCallback: options.parseSequences ? push : undefined,\n disableDerivesFromReferences: options.disableDerivesFromReferences || false,\n bufferSize: Infinity,\n errorCallback: (err) => {\n throw err;\n },\n });\n str.split(/\\r?\\n/).forEach(parser.addLine.bind(parser));\n parser.finish();\n return items;\n}\n/**\n * Format an array of GFF3 items (features,directives,comments) into string of\n * GFF3. Does not insert synchronization (###) marks.\n *\n * @param items - Array of features, directives, comments and/or sequences\n * @returns the formatted GFF3\n */\nexport function formatSync(items) {\n // sort items into seq and other\n const other = [];\n const sequences = [];\n items.forEach((i) => {\n if ('sequence' in i)\n sequences.push(i);\n else\n other.push(i);\n });\n let str = other.map(formatItem).join('');\n if (sequences.length) {\n str += '##FASTA\\n';\n str += sequences.map(formatSequence).join('');\n }\n return str;\n}\nclass FormattingTransform extends Transform {\n constructor(options = {}) {\n super(Object.assign(options, { objectMode: true }));\n this.linesSinceLastSyncMark = 0;\n this.haveWeEmittedData = false;\n this.fastaMode = false;\n this.minLinesBetweenSyncMarks = options.minSyncLines || 100;\n this.insertVersionDirective = options.insertVersionDirective || false;\n }\n _transform(chunk, _encoding, callback) {\n // if we have not emitted anything yet, and this first\n // chunk is not a gff-version directive, emit one\n let str;\n if (!this.haveWeEmittedData && this.insertVersionDirective) {\n const thisChunk = Array.isArray(chunk) ? chunk[0] : chunk;\n if ('directive' in thisChunk) {\n if (thisChunk.directive !== 'gff-version') {\n this.push('##gff-version 3\\n');\n }\n }\n }\n // if it's a sequence chunk coming down, emit a FASTA directive and\n // change to FASTA mode\n if ('sequence' in chunk && !this.fastaMode) {\n this.push('##FASTA\\n');\n this.fastaMode = true;\n }\n if (Array.isArray(chunk))\n str = chunk.map(formatItem).join('');\n else\n str = formatItem(chunk);\n this.push(str);\n if (this.linesSinceLastSyncMark >= this.minLinesBetweenSyncMarks) {\n this.push('###\\n');\n this.linesSinceLastSyncMark = 0;\n }\n else {\n // count the number of newlines in this chunk\n let count = 0;\n for (let i = 0; i < str.length; i += 1) {\n if (str[i] === '\\n')\n count += 1;\n }\n this.linesSinceLastSyncMark += count;\n }\n this.haveWeEmittedData = true;\n _callback(callback);\n }\n}\n/**\n * Format a stream of features, directives, comments and/or sequences into a\n * stream of GFF3 text.\n *\n * Inserts synchronization (###) marks automatically.\n *\n * @param options - parser options\n */\nexport function formatStream(options = {}) {\n return new FormattingTransform(options);\n}\n/**\n * Format a stream of features, directives, comments and/or sequences into a\n * GFF3 file and write it to the filesystem.\n\n * Inserts synchronization (###) marks and a ##gff-version\n * directive automatically (if one is not already present).\n *\n * @param stream - the stream to write to the file\n * @param filename - the file path to write to\n * @param options - parser options\n * @returns promise for null that resolves when the stream has been written\n */\nexport function formatFile(stream, writeStream, options = {}) {\n const newOptions = {\n insertVersionDirective: true,\n ...options,\n };\n return new Promise((resolve, reject) => {\n stream\n .pipe(new FormattingTransform(newOptions))\n .on('end', () => resolve(null))\n .on('error', reject)\n .pipe(writeStream);\n });\n}\n//# sourceMappingURL=api.js.map","import { parseStream, parseStringSync, formatSync, formatStream, formatFile, } from './api';\nimport * as util from './util';\nexport default {\n parseStream,\n parseStringSync,\n formatSync,\n formatStream,\n formatFile,\n util,\n};\n//# sourceMappingURL=index.js.map","'use strict';\n\nmodule.exports = value => {\n\tif (!value) {\n\t\treturn false;\n\t}\n\n\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\tif (typeof Symbol.observable === 'symbol' && typeof value[Symbol.observable] === 'function') {\n\t\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\t\treturn value === value[Symbol.observable]();\n\t}\n\n\tif (typeof value['@@observable'] === 'function') {\n\t\treturn value === value['@@observable']();\n\t}\n\n\treturn false;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultSerializer = exports.extendSerializer = void 0;\nfunction extendSerializer(extend, implementation) {\n const fallbackDeserializer = extend.deserialize.bind(extend);\n const fallbackSerializer = extend.serialize.bind(extend);\n return {\n deserialize(message) {\n return implementation.deserialize(message, fallbackDeserializer);\n },\n serialize(input) {\n return implementation.serialize(input, fallbackSerializer);\n }\n };\n}\nexports.extendSerializer = extendSerializer;\nconst DefaultErrorSerializer = {\n deserialize(message) {\n return Object.assign(Error(message.message), {\n name: message.name,\n stack: message.stack\n });\n },\n serialize(error) {\n return {\n __error_marker: \"$$error\",\n message: error.message,\n name: error.name,\n stack: error.stack\n };\n }\n};\nconst isSerializedError = (thing) => thing && typeof thing === \"object\" && \"__error_marker\" in thing && thing.__error_marker === \"$$error\";\nexports.DefaultSerializer = {\n deserialize(message) {\n if (isSerializedError(message)) {\n return DefaultErrorSerializer.deserialize(message);\n }\n else {\n return message;\n }\n },\n serialize(input) {\n if (input instanceof Error) {\n return DefaultErrorSerializer.serialize(input);\n }\n else {\n return input;\n }\n }\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.serialize = exports.deserialize = exports.registerSerializer = void 0;\nconst serializers_1 = require(\"./serializers\");\nlet registeredSerializer = serializers_1.DefaultSerializer;\nfunction registerSerializer(serializer) {\n registeredSerializer = serializers_1.extendSerializer(registeredSerializer, serializer);\n}\nexports.registerSerializer = registerSerializer;\nfunction deserialize(message) {\n return registeredSerializer.deserialize(message);\n}\nexports.deserialize = deserialize;\nfunction serialize(input) {\n return registeredSerializer.serialize(input);\n}\nexports.serialize = serialize;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.$worker = exports.$transferable = exports.$terminate = exports.$events = exports.$errors = void 0;\nexports.$errors = Symbol(\"thread.errors\");\nexports.$events = Symbol(\"thread.events\");\nexports.$terminate = Symbol(\"thread.terminate\");\nexports.$transferable = Symbol(\"thread.transferable\");\nexports.$worker = Symbol(\"thread.worker\");\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Transfer = exports.isTransferDescriptor = void 0;\nconst symbols_1 = require(\"./symbols\");\nfunction isTransferable(thing) {\n if (!thing || typeof thing !== \"object\")\n return false;\n // Don't check too thoroughly, since the list of transferable things in JS might grow over time\n return true;\n}\nfunction isTransferDescriptor(thing) {\n return thing && typeof thing === \"object\" && thing[symbols_1.$transferable];\n}\nexports.isTransferDescriptor = isTransferDescriptor;\nfunction Transfer(payload, transferables) {\n if (!transferables) {\n if (!isTransferable(payload))\n throw Error();\n transferables = [payload];\n }\n return {\n [symbols_1.$transferable]: true,\n send: payload,\n transferables\n };\n}\nexports.Transfer = Transfer;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WorkerMessageType = exports.MasterMessageType = void 0;\n/////////////////////////////\n// Messages sent by master:\nvar MasterMessageType;\n(function (MasterMessageType) {\n MasterMessageType[\"cancel\"] = \"cancel\";\n MasterMessageType[\"run\"] = \"run\";\n})(MasterMessageType = exports.MasterMessageType || (exports.MasterMessageType = {}));\n////////////////////////////\n// Messages sent by worker:\nvar WorkerMessageType;\n(function (WorkerMessageType) {\n WorkerMessageType[\"error\"] = \"error\";\n WorkerMessageType[\"init\"] = \"init\";\n WorkerMessageType[\"result\"] = \"result\";\n WorkerMessageType[\"running\"] = \"running\";\n WorkerMessageType[\"uncaughtError\"] = \"uncaughtError\";\n})(WorkerMessageType = exports.WorkerMessageType || (exports.WorkerMessageType = {}));\n","\"use strict\";\n/// \n// tslint:disable no-shadowed-variable\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst isWorkerRuntime = function isWorkerRuntime() {\n const isWindowContext = typeof self !== \"undefined\" && typeof Window !== \"undefined\" && self instanceof Window;\n return typeof self !== \"undefined\" && self.postMessage && !isWindowContext ? true : false;\n};\nconst postMessageToMaster = function postMessageToMaster(data, transferList) {\n self.postMessage(data, transferList);\n};\nconst subscribeToMasterMessages = function subscribeToMasterMessages(onMessage) {\n const messageHandler = (messageEvent) => {\n onMessage(messageEvent.data);\n };\n const unsubscribe = () => {\n self.removeEventListener(\"message\", messageHandler);\n };\n self.addEventListener(\"message\", messageHandler);\n return unsubscribe;\n};\nexports.default = {\n isWorkerRuntime,\n postMessageToMaster,\n subscribeToMasterMessages\n};\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.expose = exports.isWorkerRuntime = exports.Transfer = exports.registerSerializer = void 0;\nconst is_observable_1 = __importDefault(require(\"is-observable\"));\nconst common_1 = require(\"../common\");\nconst transferable_1 = require(\"../transferable\");\nconst messages_1 = require(\"../types/messages\");\nconst implementation_1 = __importDefault(require(\"./implementation\"));\nvar common_2 = require(\"../common\");\nObject.defineProperty(exports, \"registerSerializer\", { enumerable: true, get: function () { return common_2.registerSerializer; } });\nvar transferable_2 = require(\"../transferable\");\nObject.defineProperty(exports, \"Transfer\", { enumerable: true, get: function () { return transferable_2.Transfer; } });\n/** Returns `true` if this code is currently running in a worker. */\nexports.isWorkerRuntime = implementation_1.default.isWorkerRuntime;\nlet exposeCalled = false;\nconst activeSubscriptions = new Map();\nconst isMasterJobCancelMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.cancel;\nconst isMasterJobRunMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.run;\n/**\n * There are issues with `is-observable` not recognizing zen-observable's instances.\n * We are using `observable-fns`, but it's based on zen-observable, too.\n */\nconst isObservable = (thing) => is_observable_1.default(thing) || isZenObservable(thing);\nfunction isZenObservable(thing) {\n return thing && typeof thing === \"object\" && typeof thing.subscribe === \"function\";\n}\nfunction deconstructTransfer(thing) {\n return transferable_1.isTransferDescriptor(thing)\n ? { payload: thing.send, transferables: thing.transferables }\n : { payload: thing, transferables: undefined };\n}\nfunction postFunctionInitMessage() {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"function\"\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postModuleInitMessage(methodNames) {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"module\",\n methods: methodNames\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postJobErrorMessage(uid, rawError) {\n const { payload: error, transferables } = deconstructTransfer(rawError);\n const errorMessage = {\n type: messages_1.WorkerMessageType.error,\n uid,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage, transferables);\n}\nfunction postJobResultMessage(uid, completed, resultValue) {\n const { payload, transferables } = deconstructTransfer(resultValue);\n const resultMessage = {\n type: messages_1.WorkerMessageType.result,\n uid,\n complete: completed ? true : undefined,\n payload\n };\n implementation_1.default.postMessageToMaster(resultMessage, transferables);\n}\nfunction postJobStartMessage(uid, resultType) {\n const startMessage = {\n type: messages_1.WorkerMessageType.running,\n uid,\n resultType\n };\n implementation_1.default.postMessageToMaster(startMessage);\n}\nfunction postUncaughtErrorMessage(error) {\n try {\n const errorMessage = {\n type: messages_1.WorkerMessageType.uncaughtError,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage);\n }\n catch (subError) {\n // tslint:disable-next-line no-console\n console.error(\"Not reporting uncaught error back to master thread as it \" +\n \"occured while reporting an uncaught error already.\" +\n \"\\nLatest error:\", subError, \"\\nOriginal error:\", error);\n }\n}\nfunction runFunction(jobUID, fn, args) {\n return __awaiter(this, void 0, void 0, function* () {\n let syncResult;\n try {\n syncResult = fn(...args);\n }\n catch (error) {\n return postJobErrorMessage(jobUID, error);\n }\n const resultType = isObservable(syncResult) ? \"observable\" : \"promise\";\n postJobStartMessage(jobUID, resultType);\n if (isObservable(syncResult)) {\n const subscription = syncResult.subscribe(value => postJobResultMessage(jobUID, false, common_1.serialize(value)), error => {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n activeSubscriptions.delete(jobUID);\n }, () => {\n postJobResultMessage(jobUID, true);\n activeSubscriptions.delete(jobUID);\n });\n activeSubscriptions.set(jobUID, subscription);\n }\n else {\n try {\n const result = yield syncResult;\n postJobResultMessage(jobUID, true, common_1.serialize(result));\n }\n catch (error) {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n }\n }\n });\n}\n/**\n * Expose a function or a module (an object whose values are functions)\n * to the main thread. Must be called exactly once in every worker thread\n * to signal its API to the main thread.\n *\n * @param exposed Function or object whose values are functions\n */\nfunction expose(exposed) {\n if (!implementation_1.default.isWorkerRuntime()) {\n throw Error(\"expose() called in the master thread.\");\n }\n if (exposeCalled) {\n throw Error(\"expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.\");\n }\n exposeCalled = true;\n if (typeof exposed === \"function\") {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && !messageData.method) {\n runFunction(messageData.uid, exposed, messageData.args.map(common_1.deserialize));\n }\n });\n postFunctionInitMessage();\n }\n else if (typeof exposed === \"object\" && exposed) {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && messageData.method) {\n runFunction(messageData.uid, exposed[messageData.method], messageData.args.map(common_1.deserialize));\n }\n });\n const methodNames = Object.keys(exposed).filter(key => typeof exposed[key] === \"function\");\n postModuleInitMessage(methodNames);\n }\n else {\n throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${exposed}`);\n }\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobCancelMessage(messageData)) {\n const jobUID = messageData.uid;\n const subscription = activeSubscriptions.get(jobUID);\n if (subscription) {\n subscription.unsubscribe();\n activeSubscriptions.delete(jobUID);\n }\n }\n });\n}\nexports.expose = expose;\nif (typeof self !== \"undefined\" && typeof self.addEventListener === \"function\" && implementation_1.default.isWorkerRuntime()) {\n self.addEventListener(\"error\", event => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(event.error || event), 250);\n });\n self.addEventListener(\"unhandledrejection\", event => {\n const error = event.reason;\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\nif (typeof process !== \"undefined\" && typeof process.on === \"function\" && implementation_1.default.isWorkerRuntime()) {\n process.on(\"uncaughtException\", (error) => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n });\n process.on(\"unhandledRejection\", (error) => {\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\n","import WorkerContext from \"./dist/worker/index.js\"\n\nexport const expose = WorkerContext.expose\nexport const registerSerializer = WorkerContext.registerSerializer\nexport const Transfer = WorkerContext.Transfer\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import toNumber from './toNumber.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nexport default toFinite;\n","import toFinite from './toFinite.js';\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nexport default toInteger;\n","import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nexport default copyArray;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n","import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n","import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nexport default isIterateeCall;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n","import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n","import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n","import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n","import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n","import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n","import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n","import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n","import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n","/**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\nfunction baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n}\n\nexport default baseClamp;\n","import arrayMap from './_arrayMap.js';\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nexport default baseValues;\n","import baseValues from './_baseValues.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n}\n\nexport default values;\n","/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeFloor = Math.floor,\n nativeRandom = Math.random;\n\n/**\n * The base implementation of `_.random` without support for returning\n * floating-point numbers.\n *\n * @private\n * @param {number} lower The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the random number.\n */\nfunction baseRandom(lower, upper) {\n return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n}\n\nexport default baseRandom;\n","import baseRandom from './_baseRandom.js';\n\n/**\n * A specialized version of `_.shuffle` which mutates and sets the size of `array`.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @param {number} [size=array.length] The size of `array`.\n * @returns {Array} Returns `array`.\n */\nfunction shuffleSelf(array, size) {\n var index = -1,\n length = array.length,\n lastIndex = length - 1;\n\n size = size === undefined ? length : size;\n while (++index < size) {\n var rand = baseRandom(index, lastIndex),\n value = array[rand];\n\n array[rand] = array[index];\n array[index] = value;\n }\n array.length = size;\n return array;\n}\n\nexport default shuffleSelf;\n","import baseClamp from './_baseClamp.js';\nimport copyArray from './_copyArray.js';\nimport shuffleSelf from './_shuffleSelf.js';\n\n/**\n * A specialized version of `_.sampleSize` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction arraySampleSize(array, n) {\n return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));\n}\n\nexport default arraySampleSize;\n","import baseClamp from './_baseClamp.js';\nimport shuffleSelf from './_shuffleSelf.js';\nimport values from './values.js';\n\n/**\n * The base implementation of `_.sampleSize` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction baseSampleSize(collection, n) {\n var array = values(collection);\n return shuffleSelf(array, baseClamp(n, 0, array.length));\n}\n\nexport default baseSampleSize;\n","import arraySampleSize from './_arraySampleSize.js';\nimport baseSampleSize from './_baseSampleSize.js';\nimport isArray from './isArray.js';\nimport isIterateeCall from './_isIterateeCall.js';\nimport toInteger from './toInteger.js';\n\n/**\n * Gets `n` random elements at unique keys from `collection` up to the\n * size of `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @param {number} [n=1] The number of elements to sample.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the random elements.\n * @example\n *\n * _.sampleSize([1, 2, 3], 2);\n * // => [3, 1]\n *\n * _.sampleSize([1, 2, 3], 4);\n * // => [2, 3, 1]\n */\nfunction sampleSize(collection, n, guard) {\n if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n var func = isArray(collection) ? arraySampleSize : baseSampleSize;\n return func(collection, n);\n}\n\nexport default sampleSize;\n","export default function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import ascending from \"./ascending.js\";\n\nexport default function(f) {\n let delta = f;\n let compare = f;\n\n if (f.length === 1) {\n delta = (d, x) => f(d) - x;\n compare = ascendingComparator(f);\n }\n\n function left(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function right(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n\n function center(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction ascendingComparator(f) {\n return (d, x) => ascending(f(d), x);\n}\n","import { bisector } from 'd3-array';\nimport { RemoteFile as _RemoteFile } from 'generic-filehandle';\n\nimport type * as HiGlass from '@higlass/types';\nimport type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema';\n\nexport type CommonDataConfig = {\n assembly: Assembly;\n x?: string;\n xe?: string;\n x1?: string;\n x1e?: string;\n urlFetchOptions?: RequestInit;\n};\n\nexport class DataSource {\n chromInfo: ExtendedChromInfo;\n tilesetInfo: ReturnType;\n\n constructor(public file: File, chromSizes: ChromSizes, public options: Options) {\n this.chromInfo = sizesToChromInfo(chromSizes);\n this.tilesetInfo = tilesetInfoFromChromInfo(this.chromInfo);\n }\n}\n\n/**\n * Filter data before sending to a track considering the visible genomic area in the track.\n * TODO(2022-Jul-13): Consider genomic `y` channels as well.\n */\nexport function filterUsingGenoPos(\n data: Datum[],\n [minX, maxX]: [number, number],\n config: Omit\n) {\n const { x, xe, x1, x1e } = config;\n const definedXFields = [x, xe, x1, x1e].filter(f => f) as string[];\n return data.filter((d: Datum) => {\n if (definedXFields.length === 0) {\n // no filter applies\n return true;\n } else if (definedXFields.length === 1) {\n // filter based on one genomic position\n const value = +d[definedXFields[0]];\n return typeof value === 'number' && minX < value && value <= maxX;\n } else {\n // filter based on two genomic positions, i.e., check overlaps\n const values = definedXFields.map(f => +d[f]).filter(v => !isNaN(v));\n const minValue = Math.min(...values);\n const maxValue = Math.max(...values);\n return minX <= maxValue && minValue <= maxX;\n }\n });\n}\n\nconst chromInfoBisector = bisector((d: { pos: number }) => d.pos).left;\n\nconst chrToAbs = (chrom: string, chromPos: number, chromInfo: HiGlass.ChromInfo) =>\n chromInfo.chrPositions[chrom].pos + chromPos;\n\nconst absToChr = (absPosition: number, chromInfo: HiGlass.ChromInfo) => {\n if (!chromInfo || !chromInfo.cumPositions || !chromInfo.cumPositions.length) {\n return null;\n }\n\n let insertPoint = chromInfoBisector(chromInfo.cumPositions, absPosition);\n const lastChr = chromInfo.cumPositions[chromInfo.cumPositions.length - 1].chr;\n const lastLength = chromInfo.chromLengths[lastChr];\n\n // @ts-expect-error\n insertPoint -= insertPoint > 0 && 1;\n\n let chrPosition = Math.floor(absPosition - chromInfo.cumPositions[insertPoint].pos);\n let offset = 0;\n\n if (chrPosition < 0) {\n // before the start of the genome\n offset = chrPosition - 1;\n chrPosition = 1;\n }\n\n if (insertPoint === chromInfo.cumPositions.length - 1 && chrPosition > lastLength) {\n // beyond the last chromosome\n offset = chrPosition - lastLength;\n chrPosition = lastLength;\n }\n\n return [chromInfo.cumPositions[insertPoint].chr, chrPosition, offset, insertPoint] as const;\n};\n\n/**\n * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`.\n * @param chrName A chromosome name to be sanitized\n * @param assembly A genome assembly of the data\n * @param chromosomePrefix A prefix string that can be replaced to 'chr'\n * @returns\n */\nexport function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string) {\n if (Array.isArray(assembly)) {\n // this is a custom assembly, so use this as is\n return chrName;\n }\n\n // For assemblies in Gosling, we use the `chr` prefix consistently\n if (chromosomePrefix) {\n // `hs1` --> `chr1`\n chrName = chrName.replace(chromosomePrefix, 'chr');\n } else if (!chrName.includes('chr')) {\n // `1` --> `chr1`\n chrName = `chr${chrName}`;\n }\n return chrName;\n}\n\nexport type ExtendedChromInfo = HiGlass.ChromInfo & {\n absToChr(absPos: number): ReturnType | null;\n chrToAbs(chr: [name: string, pos: number]): number | null;\n};\n\nexport function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize = 1024) {\n return {\n tile_size: tileSize,\n bins_per_dimension: tileSize,\n max_zoom: Math.ceil(Math.log(chromInfo.totalLength / tileSize) / Math.log(2)),\n max_width: chromInfo.totalLength,\n min_pos: [0],\n max_pos: [chromInfo.totalLength]\n };\n}\n\nexport function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo {\n const info: HiGlass.ChromInfo = {\n cumPositions: [],\n chromLengths: {},\n chrPositions: {},\n totalLength: 0\n };\n\n sizes.forEach(([chr, length], i) => {\n const chrPosition = { id: i, chr, pos: info.totalLength };\n info.chrPositions[chr] = chrPosition;\n info.chromLengths[chr] = length;\n info.cumPositions.push(chrPosition);\n info.totalLength += length;\n });\n\n return {\n ...info,\n absToChr: absPos => (info.chrPositions ? absToChr(absPos, info) : null),\n chrToAbs: ([chrName, chrPos]) => (info.chrPositions ? chrToAbs(chrName, chrPos, info) : null)\n };\n}\n\nexport class RemoteFile extends _RemoteFile {\n // Overrides `read` to eagerly read 200 or 206 response\n // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162\n public read: _RemoteFile['read'] = async (\n buffer,\n offset = 0,\n length,\n position = 0,\n opts = {}\n ): Promise<{ bytesRead: number; buffer: Buffer }> => {\n const { headers = {}, signal, overrides = {} } = opts;\n\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n } else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n // @ts-expect-error private property\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n // @ts-expect-error private property\n ...this.baseOverrides.headers\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal\n };\n const response = await this.fetch(this.url, args);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n\n // Just read the response if it was successful.\n if (response.status === 200 || response.status === 206) {\n // @ts-expect-error private method\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n // @ts-expect-error private property\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n\n return { bytesRead: bytesCopied, buffer };\n }\n\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n };\n}\n\nexport interface TabularDataFetcher {\n getTabularData(tileIds: string[]): Promise;\n MAX_TILE_WIDTH?: number;\n}\n","import type { GFF3Feature, GFF3Sequence } from '@gmod/gff';\n/**\n * Type guard for GFF3Feature\n * @param entry An element from GFF.parseStringSync() return value\n * @returns True if type is GFF3Feature\n */\nexport function isGFF3Feature(entry: GFF3Feature | GFF3Sequence): entry is GFF3Feature {\n return Array.isArray(entry as GFF3Feature);\n}\n\n/** Returns an array of the unique values sampled n times between 0 and maxValue */\nexport function makeRandomSortedArray(n: number, maxValue: number) {\n const randomArray = [];\n for (let i = 0; i < n; i++) {\n const randomNumber = Math.floor(Math.random() * (maxValue + 1));\n randomArray.push(randomNumber);\n }\n const sorted = randomArray.sort((a, b) => a - b);\n return [...new Set(sorted)];\n}\n","import { TabixIndexedFile } from '@gmod/tabix';\nimport GFF from '@gmod/gff';\nimport type { GFF3FeatureLineWithRefs, GFF3Feature, GFF3Sequence } from '@gmod/gff';\nimport { expose, Transfer } from 'threads/worker';\nimport { sampleSize } from 'lodash-es';\nimport type { TilesetInfo } from '@higlass/types';\nimport type { ChromSizes } from '@gosling-lang/gosling-schema';\nimport { DataSource, RemoteFile } from '../utils';\nimport { isGFF3Feature, makeRandomSortedArray } from './utils';\n\nexport type GffFileOptions = {\n sampleLength: number;\n attributesToFields?: { attribute: string; defaultValue: string }[];\n urlFetchOptions?: RequestInit;\n indexUrlFetchOptions?: RequestInit;\n};\n\nexport interface GffTile extends GFF3FeatureLineWithRefs {\n attribute?: string;\n}\n\nexport interface EmptyTile {\n tilePositionId: string;\n}\n\n/**\n * A class to represent a GFF file. It takes care of setting up gmod/tabix.\n */\nclass GffFile {\n #uid: string;\n tbi: TabixIndexedFile;\n #n_features?: number;\n\n constructor(tbi: TabixIndexedFile, uid: string) {\n this.tbi = tbi;\n this.#uid = uid;\n }\n /**\n * Function to create an instance of BedFile\n * @param url A string which is the URL of the bed file\n * @param indexUrl A string which is the URL of the bed index file\n * @param uid A unique identifier for the worker\n * @param urlFetchOptions When the url is fetched, these options will be used\n * @param indexUrlFetchOptions When the index URL is fetched, these options will be used\n * @returns an instance of BedFile\n */\n static fromUrl(\n url: string,\n indexUrl: string,\n uid: string,\n urlFetchOptions?: RequestInit,\n indexUrlFetchOptions?: RequestInit\n ): GffFile {\n const tbi = new TabixIndexedFile({\n filehandle: new RemoteFile(url, { overrides: urlFetchOptions }),\n tbiFilehandle: new RemoteFile(indexUrl, { overrides: indexUrlFetchOptions })\n });\n return new GffFile(tbi, uid);\n }\n /**\n * Calculates the total number of features in a file\n * @returns A number of the features in a file\n */\n async #getNumberFeatures() {\n if (!this.#n_features) {\n const source = dataSources.get(this.#uid)!;\n const { cumPositions } = source.chromInfo;\n const countPromises: Promise[] = [];\n for (const cumPos of cumPositions) {\n const chromName = cumPos.chr;\n countPromises.push(this.tbi.lineCount(chromName));\n }\n const counts = await Promise.all(countPromises);\n const total_counts = counts.reduce((acc, cur) => acc + cur, 0);\n this.#n_features = total_counts;\n }\n return this.#n_features;\n }\n /**\n * Retrieves the lines between a range of absolute genomic coordinates\n * @param minX the minimum absolute coordinate\n * @param maxX the maximum absolute coordinate\n * @returns A promise to an array of strings, where each string is a line from the GFF\n */\n #getLinePromises(minX: number, maxX: number): Promise[] {\n const source = dataSources.get(this.#uid)!;\n let curMinX = minX;\n const { chromLengths, cumPositions } = source.chromInfo;\n const linePromises: Promise[] = [];\n // This helps with the performance of viewing many features over a large genomic range\n // Strategy: Get features from randomly selected windows within the entire region\n // If the total number of features in the file is less than MAX_FEATURES, then we don't do this.\n const MAX_FEATURES = 500000; // if the number of features is less than this, we just get all the lines\n const MAX_WINDOW = 4000000; // if the maxX - minX is less than this, then we'll just get all the lines\n if (this.#n_features && this.#n_features > MAX_FEATURES && maxX - minX > MAX_WINDOW) {\n const diff = maxX - minX;\n const windowSize = 50000;\n const n_samples = 100;\n\n const totalBins = Math.floor(diff / windowSize);\n const selectedBins = makeRandomSortedArray(n_samples, totalBins);\n const binLines = selectedBins.map(bin => {\n const binStart = minX + bin * windowSize;\n const binEnd = binStart + windowSize;\n return this.#getLinePromises(binStart, binEnd);\n });\n return binLines.flat();\n }\n\n for (const cumPos of cumPositions) {\n const chromName = cumPos.chr;\n const chromStart = cumPos.pos;\n const chromEnd = cumPos.pos + chromLengths[chromName];\n let startPos, endPos;\n\n // Early break, rather than creating an nested if\n if (chromStart > curMinX || curMinX >= chromEnd) {\n continue;\n }\n\n // start of the visible region is within this chromosome\n const linePromise = new Promise(resolve => {\n const lines: string[] = [];\n const lineCallback = (line: string) => {\n lines.push(line);\n };\n\n if (maxX > chromEnd) {\n startPos = curMinX - chromStart;\n endPos = chromEnd - chromStart;\n } else {\n startPos = Math.floor(curMinX - chromStart);\n endPos = Math.ceil(maxX - chromStart);\n }\n\n this.tbi.getLines(chromName, startPos, endPos, lineCallback).then(() => {\n resolve(lines);\n });\n });\n\n linePromises.push(linePromise);\n\n if (maxX <= chromEnd) {\n continue;\n }\n\n curMinX = chromEnd;\n }\n return linePromises;\n }\n /**\n * Makes tiles for a given range of genomic positions\n * @param minX the minimum absolute coordinate\n * @param maxX the maximum absolute coordinate\n * @returns A promise to an array of GffTiles\n */\n async getTileData(minX: number, maxX: number): Promise {\n const source = dataSources.get(this.#uid)!;\n const sampleLength = source.options.sampleLength; // maximum number of features that can be shown\n const attributesToFields = source.options.attributesToFields;\n\n await this.#getNumberFeatures();\n /**\n * Function to filter out child features if there are too many features\n * @param lines an array of strings, where each string is a line from the GFF\n * @returns an array of strings, where each string is a line from the GFF\n */\n function filterLines(lines: string[]): string[] {\n // Keep only the non child lines\n const nonChildLines = lines.filter(line => {\n const lineColumns = line.split('\\t');\n const attributes = lineColumns[8]; // this is the attributes column\n return !attributes.includes('Parent=');\n });\n return sampleSize(nonChildLines, sampleLength);\n }\n\n /**\n * Function to reformat the output of GFF.parseStringSync() into tiles\n * @param parsed Output from GFF.parseStringSync()\n * @returns An array of GffTile\n */\n function parsedLinesToTiles(parsed: (GFF3Feature | GFF3Sequence)[]): GffTile[] {\n let tiles: GffTile[] = [];\n for (const line of parsed) {\n if (isGFF3Feature(line)) {\n for (const feature of line) {\n // make the start and end absolute\n if (feature.seq_id && feature.start)\n feature.start = source.chromInfo.chrToAbs([feature.seq_id, feature.start]);\n if (feature.seq_id && feature.end)\n feature.end = source.chromInfo.chrToAbs([feature.seq_id, feature.end]);\n tiles.push(feature);\n }\n }\n }\n // Add specific attributes to each tile if specified\n if (attributesToFields) {\n tiles = tiles.map(tile => {\n const attributes = tile.attributes;\n const cleanAtt: { [key: string]: unknown } = {};\n attributesToFields.forEach(attMap => {\n const attName = attMap.attribute;\n const attDefault = attMap.defaultValue;\n if (attributes == null || !(attName in attributes) || !Array.isArray(attributes[attName]))\n cleanAtt[attName] = attDefault;\n else {\n const attVal = attributes[attName];\n if (Array.isArray(attVal)) {\n // Join the array array if there is more than one element\n cleanAtt[attName] = attVal.length == 1 ? attVal[0] : attVal.join(',');\n }\n }\n });\n return { ...tile, ...cleanAtt };\n });\n }\n return tiles;\n }\n\n // First, we get the lines we want to parse and filter out the lines we don't want to parse\n const linePromises = this.#getLinePromises(minX, maxX);\n const allLines = (await Promise.all(linePromises)).flat();\n let linesToParse = [];\n if (allLines.length > sampleLength) {\n linesToParse = filterLines(allLines);\n } else {\n linesToParse = allLines;\n }\n // Second, we parse the lines using gmod/gff\n const parseOptions = {\n disableDerivesFromReferences: true,\n parseFeatures: true,\n parseComments: false,\n parseDirectives: false,\n parseSequences: false\n };\n const parsedLines = GFF.parseStringSync(linesToParse.join('\\n'), parseOptions);\n // Third, we reformat the parsed GFF into the expected tile format\n const tiles = parsedLinesToTiles(parsedLines);\n return tiles;\n }\n}\n\n// promises indexed by urls\nconst gffFiles: Map = new Map();\n\n/**\n * Object to store tile data. Each key a string which contains the coordinates of the tile\n */\nconst tileValues: Record = {};\n/**\n * Maps from UID to GFF File info\n */\nconst dataSources: Map> = new Map();\n\nfunction init(\n uid: string,\n bed: { url: string; indexUrl: string },\n chromSizes: ChromSizes,\n options: Partial = {}\n) {\n let gffFile = gffFiles.get(bed.url);\n if (!gffFile) {\n gffFile = GffFile.fromUrl(bed.url, bed.indexUrl, uid, options.urlFetchOptions, options.indexUrlFetchOptions);\n }\n const dataSource = new DataSource(gffFile, chromSizes, {\n sampleLength: 1000, // default sampleLength\n ...options\n });\n dataSources.set(uid, dataSource);\n}\n\nconst tilesetInfo = (uid: string) => {\n return dataSources.get(uid)!.tilesetInfo;\n};\n\n/**\n * Updates `tileValues` with the data for a specific tile.\n * @param uid A string which is the unique identifier of the worker\n * @param z A number which is the z coordinate of the tile\n * @param x A number which is the x coordinate of the tile\n */\nconst tile = async (uid: string, z: number, x: number): Promise => {\n const source = dataSources.get(uid)!;\n // const parseLine = await source.file.getParser();\n\n const CACHE_KEY = `${uid}.${z}.${x}`;\n\n // TODO: Caching is needed\n // if (!tileValues[CACHE_KEY]) {\n tileValues[CACHE_KEY] = [];\n // }\n\n const tileWidth = +source.tilesetInfo.max_width / 2 ** +z;\n\n // get bounds of this tile\n const minX = source.tilesetInfo.min_pos[0] + x * tileWidth;\n const maxX = source.tilesetInfo.min_pos[0] + (x + 1) * tileWidth;\n tileValues[CACHE_KEY] = await source.file.getTileData(minX, maxX);\n return [];\n};\n\nconst fetchTilesDebounced = async (uid: string, tileIds: string[]) => {\n const tiles: Record = {};\n const validTileIds: string[] = [];\n const tilePromises: Promise[] = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('Invalid tile zoom or position:', z, x);\n continue;\n }\n validTileIds.push(tileId);\n tilePromises.push(tile(uid, z, x));\n }\n return Promise.all(tilePromises).then(values => {\n for (let i = 0; i < values.length; i++) {\n const validTileId = validTileIds[i];\n tiles[validTileId] = { tilePositionId: validTileId };\n }\n return tiles;\n });\n};\n\n/**\n * Sends the data fetcher data from `tileValues`\n * @param uid A string which is the unique identifier of the worker\n * @param tileIds An array of strings where each string identifies a tile with a particular coordinate\n * @returns A transferable buffer\n */\nconst getTabularData = (uid: string, tileIds: string[]) => {\n const data: GffTile[][] = [];\n\n tileIds.forEach(tileId => {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n const tileValue = tileValues[`${uid}.${z}.${x}`];\n\n if (!tileValue) {\n console.warn(`No tile data constructed (${tileId})`);\n }\n\n data.push(tileValue);\n });\n const output = Object.values(data).flat();\n\n const buffer = new TextEncoder().encode(JSON.stringify(output)).buffer;\n return Transfer(buffer, [buffer]);\n};\n\nconst tileFunctions = {\n init,\n tilesetInfo,\n fetchTilesDebounced,\n tile,\n getTabularData\n};\n\nexport type WorkerApi = typeof tileFunctions;\nexport type { TilesetInfo };\n\nexpose(tileFunctions);\n"],"names":["i","_getPrototypeOf","o","_setPrototypeOf","p","self","_get","Emitter","AbortSignal","toString","AbortController","err","Request","init","abortableFetch","require$$0","global","AggregateAbortController_1","abortcontroller_ponyfill_1","AggregateStatusReporter_1","__importDefault","this","AbortablePromiseCache_1","require$$1","require$$2","len","len2","buffer","c","ieee754","exports","Buffer","fromString","byteLength","isBuffer","isEncoding","code","msg","utils","Z_FIXED","Z_UNKNOWN","zero","MIN_MATCH","MAX_MATCH","LENGTH_CODES","LITERALS","L_CODES","D_CODES","BL_CODES","HEAP_SIZE","MAX_BITS","rank","adler32","crc32","messages","require$$3","require$$4","Z_NO_FLUSH","Z_FINISH","Z_BLOCK","Z_OK","Z_STREAM_END","Z_STREAM_ERROR","Z_DATA_ERROR","Z_BUF_ERROR","Z_DEFAULT_COMPRESSION","Z_DEFAULT_STRATEGY","Z_DEFLATED","MAX_WBITS","deflate","strings","c2","ZStream","BAD","TYPE","inflate_fast","state","ENOUGH_LENS","ENOUGH_DISTS","CODES","LENS","DISTS","inflate_table","root","q","inflate","constants","GZheader","require$$5","require$$6","Inflate","Z_SYNC_FLUSH","toNumber","fromBytes","long","Long","TBI","AbortablePromiseCache","ReflectApply","ReflectOwnKeys","NumberIsNaN","eventsModule","events","once","keys","inherits_browserModule","inherits","symbols","_classCallCheck","_defineProperties","_createClass","NodeError","Stream","require$$7","realHasInstance","module","onlegacyfinish","onfinish","onend","onerror","onclose","onrequest","createReadableStreamAsyncIterator","EElistenerCount","debug","StringDecoder","require$$8","require$$9","require$$10","decoder","n","require$$11","require$$12","err2","GFF3.parseDirective","GFF3.parseFeature","Transform","Decoder","Transfer","isWorkerRuntime","postMessageToMaster","subscribeToMasterMessages","isObservable","expose","freeGlobal","Symbol","objectProto","hasOwnProperty","nativeObjectToString","symToStringTag","funcTag","MAX_SAFE_INTEGER","argsTag","freeExports","freeModule","moduleExports","nodeUtil","isArray","isArguments","isTypedArray","nativeKeys","_RemoteFile","tiles","tile","values"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117]} \ No newline at end of file diff --git a/dist/assets/vcf-worker-0bc0fe81.js.map b/dist/assets/vcf-worker-0bc0fe81.js.map new file mode 100644 index 00000000..36ef63fb --- /dev/null +++ b/dist/assets/vcf-worker-0bc0fe81.js.map @@ -0,0 +1 @@ +{"version":3,"file":"vcf-worker-0bc0fe81.js","sources":["../node_modules/.pnpm/abortcontroller-polyfill@1.7.5/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/abortcontroller-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateAbortController.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateStatusReporter.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AbortablePromiseCache.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/index.js","../node_modules/.pnpm/quick-lru@4.0.1/node_modules/quick-lru/index.js","../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js","../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js","../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js","../__vite-browser-external","../node_modules/.pnpm/generic-filehandle@3.1.1/node_modules/generic-filehandle/esm/remoteFile.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js","../node_modules/.pnpm/@gmod+bgzf-filehandle@1.4.7/node_modules/@gmod/bgzf-filehandle/esm/unzip-pako.js","../node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/util.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/virtualOffset.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/chunk.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/indexFile.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tbi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/csi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tabixIndexedFile.js","../node_modules/.pnpm/@gmod+vcf@5.0.10/node_modules/@gmod/vcf/esm/vcfReserved.js","../node_modules/.pnpm/@gmod+vcf@5.0.10/node_modules/@gmod/vcf/esm/parse.js","../node_modules/.pnpm/is-observable@2.1.0/node_modules/is-observable/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/serializers.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/common.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/symbols.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/transferable.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/types/messages.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/implementation.browser.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/worker.mjs","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayMap.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toFinite.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toInteger.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copyArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIterateeCall.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseClamp.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseValues.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/values.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseRandom.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_shuffleSelf.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/sampleSize.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/ascending.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/bisector.js","../src/data-fetchers/utils.ts","../src/data-fetchers/vcf/utils.ts","../src/data-fetchers/vcf/vcf-worker.ts"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get.apply(this, arguments);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'reason', {\n value: undefined,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort(reason) {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n var signalReason = reason;\n\n if (signalReason === undefined) {\n if (typeof document === 'undefined') {\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n } else {\n try {\n signalReason = new DOMException('signal is aborted without reason');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n }\n }\n }\n\n this.signal.reason = signalReason;\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","\"use strict\";\n/* eslint-disable */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbortSignal = exports.AbortController = void 0;\nconst cjs_ponyfill_1 = require(\"abortcontroller-polyfill/dist/cjs-ponyfill\");\nvar getGlobal = function () {\n // the only reliable means to get the global object is\n // `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n};\n//@ts-ignore\nlet AbortController = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortController : getGlobal().AbortController;\nexports.AbortController = AbortController;\n//@ts-ignore\nlet AbortSignal = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal;\nexports.AbortSignal = AbortSignal;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nclass NullSignal {\n}\n/**\n * aggregates a number of abort signals, will only fire the aggregated\n * abort if all of the input signals have been aborted\n */\nclass AggregateAbortController {\n constructor() {\n this.signals = new Set();\n this.abortController = new abortcontroller_ponyfill_1.AbortController();\n }\n /**\n * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy,\n * will be treated as a null-signal, and this abortcontroller will no\n * longer be abortable.\n */\n //@ts-ignore\n addSignal(signal = new NullSignal()) {\n if (this.signal.aborted) {\n throw new Error('cannot add a signal, already aborted!');\n }\n // note that a NullSignal will never fire, so if we\n // have one this thing will never actually abort\n this.signals.add(signal);\n if (signal.aborted) {\n // handle the abort immediately if it is already aborted\n // for some reason\n this.handleAborted(signal);\n }\n else if (typeof signal.addEventListener === 'function') {\n signal.addEventListener('abort', () => {\n this.handleAborted(signal);\n });\n }\n }\n handleAborted(signal) {\n this.signals.delete(signal);\n if (this.signals.size === 0) {\n this.abortController.abort();\n }\n }\n get signal() {\n return this.abortController.signal;\n }\n abort() {\n this.abortController.abort();\n }\n}\nexports.default = AggregateAbortController;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass AggregateStatusReporter {\n constructor() {\n this.callbacks = new Set();\n }\n addCallback(callback = () => { }) {\n this.callbacks.add(callback);\n callback(this.currentMessage);\n }\n callback(message) {\n this.currentMessage = message;\n this.callbacks.forEach(elt => {\n elt(message);\n });\n }\n}\nexports.default = AggregateStatusReporter;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nconst AggregateAbortController_1 = __importDefault(require(\"./AggregateAbortController\"));\nconst AggregateStatusReporter_1 = __importDefault(require(\"./AggregateStatusReporter\"));\nclass AbortablePromiseCache {\n constructor({ fill, cache, }) {\n if (typeof fill !== 'function') {\n throw new TypeError('must pass a fill function');\n }\n if (typeof cache !== 'object') {\n throw new TypeError('must pass a cache object');\n }\n if (typeof cache.get !== 'function' ||\n typeof cache.set !== 'function' ||\n typeof cache.delete !== 'function') {\n throw new TypeError('cache must implement get(key), set(key, val), and and delete(key)');\n }\n this.cache = cache;\n this.fillCallback = fill;\n }\n static isAbortException(exception) {\n return (\n // DOMException\n exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n //@ts-ignore\n exception.code === 'ERR_ABORTED' ||\n // stringified DOMException\n exception.message === 'AbortError: aborted' ||\n // stringified standard-ish exception\n exception.message === 'Error: aborted');\n }\n evict(key, entry) {\n if (this.cache.get(key) === entry) {\n this.cache.delete(key);\n }\n }\n fill(key, data, signal, statusCallback) {\n const aborter = new AggregateAbortController_1.default();\n const statusReporter = new AggregateStatusReporter_1.default();\n statusReporter.addCallback(statusCallback);\n const newEntry = {\n aborter: aborter,\n promise: this.fillCallback(data, aborter.signal, (message) => {\n statusReporter.callback(message);\n }),\n settled: false,\n statusReporter,\n get aborted() {\n return this.aborter.signal.aborted;\n },\n };\n newEntry.aborter.addSignal(signal);\n // remove the fill from the cache when its abortcontroller fires, if still in there\n newEntry.aborter.signal.addEventListener('abort', () => {\n if (!newEntry.settled) {\n this.evict(key, newEntry);\n }\n });\n // chain off the cached promise to record when it settles\n newEntry.promise\n .then(() => {\n newEntry.settled = true;\n }, () => {\n newEntry.settled = true;\n // if the fill throws an error (including abort) and is still in the cache, remove it\n this.evict(key, newEntry);\n })\n .catch(e => {\n // this will only be reached if there is some kind of\n // bad bug in this library\n console.error(e);\n throw e;\n });\n this.cache.set(key, newEntry);\n }\n static checkSinglePromise(promise, signal) {\n // check just this signal for having been aborted, and abort the\n // promise if it was, regardless of what happened with the cached\n // response\n function checkForSingleAbort() {\n if (signal && signal.aborted) {\n throw Object.assign(new Error('aborted'), { code: 'ERR_ABORTED' });\n }\n }\n return promise.then(result => {\n checkForSingleAbort();\n return result;\n }, error => {\n checkForSingleAbort();\n throw error;\n });\n }\n has(key) {\n return this.cache.has(key);\n }\n /**\n * Callback for getting status of the pending async\n *\n * @callback statusCallback\n * @param {any} status, current status string or message object\n */\n /**\n * @param {any} key cache key to use for this request\n * @param {any} data data passed as the first argument to the fill callback\n * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request\n * @param {statusCallback} a callback to get the current status of a pending async operation\n */\n get(key, data, signal, statusCallback) {\n if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) {\n throw new TypeError('second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?');\n }\n const cacheEntry = this.cache.get(key);\n if (cacheEntry) {\n if (cacheEntry.aborted && !cacheEntry.settled) {\n // if it's aborted but has not realized it yet, evict it and redispatch\n this.evict(key, cacheEntry);\n return this.get(key, data, signal, statusCallback);\n }\n if (cacheEntry.settled) {\n // too late to abort, just return it\n return cacheEntry.promise;\n }\n // request is in-flight, add this signal to its list of signals,\n // or if there is no signal, the aborter will become non-abortable\n cacheEntry.aborter.addSignal(signal);\n cacheEntry.statusReporter.addCallback(statusCallback);\n return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal);\n }\n // if we got here, it is not in the cache. fill.\n this.fill(key, data, signal, statusCallback);\n return AbortablePromiseCache.checkSinglePromise(\n //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-\n //eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.cache.get(key).promise, signal);\n }\n /**\n * delete the given entry from the cache. if it exists and its fill request has\n * not yet settled, the fill will be signaled to abort.\n *\n * @param {any} key\n */\n delete(key) {\n const cachedEntry = this.cache.get(key);\n if (cachedEntry) {\n if (!cachedEntry.settled) {\n cachedEntry.aborter.abort();\n }\n this.cache.delete(key);\n }\n }\n /**\n * Clear all requests from the cache. Aborts any that have not settled.\n * @returns {number} count of entries deleted\n */\n clear() {\n // iterate without needing regenerator-runtime\n const keyIter = this.cache.keys();\n let deleteCount = 0;\n for (let result = keyIter.next(); !result.done; result = keyIter.next()) {\n this.delete(result.value);\n deleteCount += 1;\n }\n return deleteCount;\n }\n}\nexports.default = AbortablePromiseCache;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst AbortablePromiseCache_1 = __importDefault(require(\"./AbortablePromiseCache\"));\nexports.default = AbortablePromiseCache_1.default;\n","'use strict';\n\nclass QuickLRU {\n\tconstructor(options = {}) {\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst value = this.oldCache.get(key);\n\t\t\tthis.oldCache.delete(key);\n\t\t\tthis._set(key, value);\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tset(key, value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, value);\n\t\t} else {\n\t\t\tthis._set(key, value);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\thas(key) {\n\t\treturn this.cache.has(key) || this.oldCache.has(key);\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this.oldCache.get(key);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tyield item;\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget size() {\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn this._size + oldCacheSize;\n\t}\n}\n\nmodule.exports = QuickLRU;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","export default {}","import { Buffer } from 'buffer';\nexport default class RemoteFile {\n async getBufferFromResponse(response) {\n if (typeof response.buffer === 'function') {\n return response.buffer();\n }\n else if (typeof response.arrayBuffer === 'function') {\n const resp = await response.arrayBuffer();\n return Buffer.from(resp);\n }\n else {\n throw new TypeError('invalid HTTP response object, has no buffer method, and no arrayBuffer method');\n }\n }\n constructor(source, opts = {}) {\n this.baseOverrides = {};\n this.url = source;\n const fetch = opts.fetch || globalThis.fetch.bind(globalThis);\n if (!fetch) {\n throw new TypeError(`no fetch function supplied, and none found in global environment`);\n }\n if (opts.overrides) {\n this.baseOverrides = opts.overrides;\n }\n this.fetchImplementation = fetch;\n }\n async fetch(input, init) {\n let response;\n try {\n response = await this.fetchImplementation(input, init);\n }\n catch (e) {\n if (`${e}`.includes('Failed to fetch')) {\n // refetch to to help work around a chrome bug (discussed in\n // generic-filehandle issue #72) in which the chrome cache returns a\n // CORS error for content in its cache. see also\n // https://github.com/GMOD/jbrowse-components/pull/1511\n console.warn(`generic-filehandle: refetching ${input} to attempt to work around chrome CORS header caching bug`);\n response = await this.fetchImplementation(input, {\n ...init,\n cache: 'reload',\n });\n }\n else {\n throw e;\n }\n }\n return response;\n }\n async read(buffer, offset = 0, length, position = 0, opts = {}) {\n const { headers = {}, signal, overrides = {} } = opts;\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n }\n else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n ...this.baseOverrides.headers,\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n };\n const response = await this.fetch(this.url, args);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n if ((response.status === 200 && position === 0) ||\n response.status === 206) {\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n return { bytesRead: bytesCopied, buffer };\n }\n if (response.status === 200) {\n throw new Error('${this.url} fetch returned status 200, expected 206');\n }\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n }\n async readFile(options = {}) {\n let encoding;\n let opts;\n if (typeof options === 'string') {\n encoding = options;\n opts = {};\n }\n else {\n encoding = options.encoding;\n opts = options;\n delete opts.encoding;\n }\n const { headers = {}, signal, overrides = {} } = opts;\n const args = {\n headers,\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n ...this.baseOverrides,\n ...overrides,\n };\n const response = await this.fetch(this.url, args);\n if (!response) {\n throw new Error('generic-filehandle failed to fetch');\n }\n if (response.status !== 200) {\n throw Object.assign(new Error(`HTTP ${response.status} fetching ${this.url}`), {\n status: response.status,\n });\n }\n if (encoding === 'utf8') {\n return response.text();\n }\n if (encoding) {\n throw new Error(`unsupported encoding: ${encoding}`);\n }\n return this.getBufferFromResponse(response);\n }\n async stat() {\n if (!this._stat) {\n const buf = Buffer.allocUnsafe(10);\n await this.read(buf, 0, 10, 0);\n if (!this._stat) {\n throw new Error(`unable to determine size of file at ${this.url}`);\n }\n }\n return this._stat;\n }\n async close() {\n return;\n }\n}\n//# sourceMappingURL=remoteFile.js.map","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","import { Buffer } from 'buffer';\n//@ts-ignore\nimport { Z_SYNC_FLUSH, Inflate } from 'pako';\n// browserify-zlib, which is the zlib shim used by default in webpacked code,\n// does not properly uncompress bgzf chunks that contain more than\n// one bgzf block, so export an unzip function that uses pako directly\n// if we are running in a browser.\nasync function unzip(inputData) {\n try {\n let strm;\n let pos = 0;\n let i = 0;\n const chunks = [];\n let totalSize = 0;\n let inflator;\n do {\n const remainingInput = inputData.subarray(pos);\n inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n pos += strm.next_in;\n chunks[i] = inflator.result;\n totalSize += chunks[i].length;\n i += 1;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n return Buffer.from(result);\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to pakounzip, except it does extra counting\n// to return the positions of compressed and decompressed\n// data offsets\nasync function unzipChunk(inputData) {\n try {\n let strm;\n let cpos = 0;\n let dpos = 0;\n const blocks = [];\n const cpositions = [];\n const dpositions = [];\n do {\n const remainingInput = inputData.slice(cpos);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = Buffer.from(inflator.result);\n blocks.push(buffer);\n cpositions.push(cpos);\n dpositions.push(dpos);\n cpos += strm.next_in;\n dpos += buffer.length;\n } while (strm.avail_in);\n const buffer = Buffer.concat(blocks);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to unzipChunk above but slices (0,minv.dataPosition) and\n// (maxv.dataPosition,end) off\nasync function unzipChunkSlice(inputData, chunk) {\n try {\n let strm;\n const { minv, maxv } = chunk;\n let cpos = minv.blockPosition;\n let dpos = minv.dataPosition;\n const chunks = [];\n const cpositions = [];\n const dpositions = [];\n let totalSize = 0;\n let i = 0;\n do {\n const remainingInput = inputData.subarray(cpos - minv.blockPosition);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = inflator.result;\n chunks.push(buffer);\n let len = buffer.length;\n cpositions.push(cpos);\n dpositions.push(dpos);\n if (chunks.length === 1 && minv.dataPosition) {\n // this is the first chunk, trim it\n chunks[0] = chunks[0].subarray(minv.dataPosition);\n len = chunks[0].length;\n }\n const origCpos = cpos;\n cpos += strm.next_in;\n dpos += len;\n if (origCpos >= maxv.blockPosition) {\n // this is the last chunk, trim it and stop decompressing\n // note if it is the same block is minv it subtracts that already\n // trimmed part of the slice length\n chunks[i] = chunks[i].subarray(0, maxv.blockPosition === minv.blockPosition\n ? maxv.dataPosition - minv.dataPosition + 1\n : maxv.dataPosition + 1);\n cpositions.push(cpos);\n dpositions.push(dpos);\n totalSize += chunks[i].length;\n break;\n }\n totalSize += chunks[i].length;\n i++;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n const buffer = Buffer.from(result);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\nfunction nodeUnzip() {\n throw new Error('nodeUnzip not implemented.');\n}\nexport { unzip, unzipChunk, unzipChunkSlice, unzip as pakoUnzip, nodeUnzip };\n//# sourceMappingURL=unzip-pako.js.map","module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n","export function longToNumber(long) {\n if (long.greaterThan(Number.MAX_SAFE_INTEGER) ||\n long.lessThan(Number.MIN_SAFE_INTEGER)) {\n throw new Error('integer overflow');\n }\n return long.toNumber();\n}\nclass AbortError extends Error {\n}\n/**\n * Properly check if the given AbortSignal is aborted.\n * Per the standard, if the signal reads as aborted,\n * this function throws either a DOMException AbortError, or a regular error\n * with a `code` attribute set to `ERR_ABORTED`.\n *\n * For convenience, passing `undefined` is a no-op\n *\n * @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute\n * @returns nothing\n */\nexport function checkAbortSignal(signal) {\n if (!signal) {\n return;\n }\n if (signal.aborted) {\n if (typeof DOMException !== 'undefined') {\n // eslint-disable-next-line no-undef\n throw new DOMException('aborted', 'AbortError');\n }\n else {\n const e = new AbortError('aborted');\n e.code = 'ERR_ABORTED';\n throw e;\n }\n }\n}\n/**\n * Skips to the next tick, then runs `checkAbortSignal`.\n * Await this to inside an otherwise synchronous loop to\n * provide a place to break when an abort signal is received.\n * @param {AbortSignal} signal\n */\nexport async function abortBreakPoint(signal) {\n await Promise.resolve();\n checkAbortSignal(signal);\n}\nexport function canMergeBlocks(chunk1, chunk2) {\n return (chunk2.minv.blockPosition - chunk1.maxv.blockPosition < 65000 &&\n chunk2.maxv.blockPosition - chunk1.minv.blockPosition < 5000000);\n}\nexport function optimizeChunks(chunks, lowest) {\n const mergedChunks = [];\n let lastChunk = null;\n if (chunks.length === 0) {\n return chunks;\n }\n chunks.sort(function (c0, c1) {\n const dif = c0.minv.blockPosition - c1.minv.blockPosition;\n if (dif !== 0) {\n return dif;\n }\n else {\n return c0.minv.dataPosition - c1.minv.dataPosition;\n }\n });\n chunks.forEach(chunk => {\n if (!lowest || chunk.maxv.compareTo(lowest) > 0) {\n if (lastChunk === null) {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n else {\n if (canMergeBlocks(lastChunk, chunk)) {\n if (chunk.maxv.compareTo(lastChunk.maxv) > 0) {\n lastChunk.maxv = chunk.maxv;\n }\n }\n else {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n }\n }\n });\n return mergedChunks;\n}\n//# sourceMappingURL=util.js.map","export default class VirtualOffset {\n constructor(blockPosition, dataPosition) {\n this.blockPosition = blockPosition; // < offset of the compressed data block\n this.dataPosition = dataPosition; // < offset into the uncompressed data\n }\n toString() {\n return `${this.blockPosition}:${this.dataPosition}`;\n }\n compareTo(b) {\n return (this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition);\n }\n static min(...args) {\n let min;\n let i = 0;\n for (; !min; i += 1) {\n min = args[i];\n }\n for (; i < args.length; i += 1) {\n if (min.compareTo(args[i]) > 0) {\n min = args[i];\n }\n }\n return min;\n }\n}\nexport function fromBytes(bytes, offset = 0, bigendian = false) {\n if (bigendian) {\n throw new Error('big-endian virtual file offsets not implemented');\n }\n return new VirtualOffset(bytes[offset + 7] * 0x10000000000 +\n bytes[offset + 6] * 0x100000000 +\n bytes[offset + 5] * 0x1000000 +\n bytes[offset + 4] * 0x10000 +\n bytes[offset + 3] * 0x100 +\n bytes[offset + 2], (bytes[offset + 1] << 8) | bytes[offset]);\n}\n//# sourceMappingURL=virtualOffset.js.map","// little class representing a chunk in the index\nexport default class Chunk {\n /**\n * @param {VirtualOffset} minv\n * @param {VirtualOffset} maxv\n * @param {number} bin\n * @param {number} [fetchedSize]\n */\n constructor(minv, maxv, bin, fetchedSize = undefined) {\n this.minv = minv;\n this.maxv = maxv;\n this.bin = bin;\n this._fetchedSize = fetchedSize;\n }\n toUniqueString() {\n return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`;\n }\n toString() {\n return this.toUniqueString();\n }\n compareTo(b) {\n return (this.minv.compareTo(b.minv) ||\n this.maxv.compareTo(b.maxv) ||\n this.bin - b.bin);\n }\n fetchedSize() {\n if (this._fetchedSize !== undefined) {\n return this._fetchedSize;\n }\n return this.maxv.blockPosition + (1 << 16) - this.minv.blockPosition;\n }\n}\n//# sourceMappingURL=chunk.js.map","export default class IndexFile {\n constructor({ filehandle, renameRefSeqs = (n) => n, }) {\n this.filehandle = filehandle;\n this.renameRefSeq = renameRefSeqs;\n }\n async getMetadata(opts = {}) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { indices, ...rest } = await this.parse(opts);\n return rest;\n }\n _findFirstData(currentFdl, virtualOffset) {\n if (currentFdl) {\n return currentFdl.compareTo(virtualOffset) > 0\n ? virtualOffset\n : currentFdl;\n }\n else {\n return virtualOffset;\n }\n }\n async parse(opts = {}) {\n if (!this.parseP) {\n this.parseP = this._parse(opts).catch(e => {\n this.parseP = undefined;\n throw e;\n });\n }\n return this.parseP;\n }\n async hasRefSeq(seqId, opts = {}) {\n return !!((await this.parse(opts)).indices[seqId] || {}).binIndex;\n }\n}\n//# sourceMappingURL=indexFile.js.map","import Long from 'long';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport { longToNumber, optimizeChunks, checkAbortSignal } from './util';\nimport IndexFile from './indexFile';\nconst TBI_MAGIC = 21578324; // TBI\\1\nconst TAD_LIDX_SHIFT = 14;\n/**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\nfunction reg2bins(beg, end) {\n beg += 1; // < convert to 1-based closed\n end -= 1;\n return [\n [0, 0],\n [1 + (beg >> 26), 1 + (end >> 26)],\n [9 + (beg >> 23), 9 + (end >> 23)],\n [73 + (beg >> 20), 73 + (end >> 20)],\n [585 + (beg >> 17), 585 + (end >> 17)],\n [4681 + (beg >> 14), 4681 + (end >> 14)],\n ];\n}\nexport default class TabixIndex extends IndexFile {\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const buf = await this.filehandle.readFile(opts);\n const bytes = await unzip(buf);\n checkAbortSignal(opts.signal);\n // check TBI magic numbers\n if (bytes.readUInt32LE(0) !== TBI_MAGIC /* \"TBI\\1\" */) {\n throw new Error('Not a TBI file');\n // TODO: do we need to support big-endian TBI files?\n }\n // number of reference sequences in the index\n const refCount = bytes.readInt32LE(4);\n const formatFlags = bytes.readInt32LE(8);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const formatOpts = {\n 0: 'generic',\n 1: 'SAM',\n 2: 'VCF',\n };\n const format = formatOpts[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(12),\n start: bytes.readInt32LE(16),\n end: bytes.readInt32LE(20),\n };\n const metaValue = bytes.readInt32LE(24);\n const depth = 5;\n const maxBinNumber = ((1 << ((depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (14 + depth * 3);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(28);\n // read sequence dictionary\n const nameSectionLength = bytes.readInt32LE(32);\n const { refNameToId, refIdToName } = this._parseNameBytes(bytes.slice(36, 36 + nameSectionLength));\n // read the indexes for each reference sequence\n let currOffset = 36 + nameSectionLength;\n let firstDataLine;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats;\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n currOffset += 4;\n if (bin > maxBinNumber + 1) {\n throw new Error('tabix index contains too many bins, please use a CSI index');\n }\n else if (bin === maxBinNumber + 1) {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n if (chunkCount === 2) {\n stats = this.parsePseudoBin(bytes, currOffset);\n }\n currOffset += 16 * chunkCount;\n }\n else {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n firstDataLine = this._findFirstData(firstDataLine, u);\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n // the linear index\n const linearCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const linearIndex = new Array(linearCount);\n for (let k = 0; k < linearCount; k += 1) {\n linearIndex[k] = fromBytes(bytes, currOffset);\n currOffset += 8;\n firstDataLine = this._findFirstData(firstDataLine, linearIndex[k]);\n }\n return { binIndex, linearIndex, stats };\n });\n return {\n indices,\n metaChar,\n maxBinNumber,\n maxRefLength,\n skipLines,\n firstDataLine,\n columnNumbers,\n coordinateType,\n format,\n refIdToName,\n refNameToId,\n maxBlockSize: 1 << 16,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 16, offset + 24), true));\n return { lineCount };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n const minOffset = ba.linearIndex.length\n ? ba.linearIndex[min >> TAD_LIDX_SHIFT >= ba.linearIndex.length\n ? ba.linearIndex.length - 1\n : min >> TAD_LIDX_SHIFT]\n : new VirtualOffset(0, 0);\n if (!minOffset) {\n console.warn('querying outside of possible tabix range');\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n // Use the linear index to find minimum file position of chunks that could\n // contain alignments in the region\n const nintv = ba.linearIndex.length;\n let lowest = null;\n const minLin = Math.min(min >> 14, nintv - 1);\n const maxLin = Math.min(max >> 14, nintv - 1);\n for (let i = minLin; i <= maxLin; ++i) {\n const vp = ba.linearIndex[i];\n if (vp) {\n if (!lowest || vp.compareTo(lowest) < 0) {\n lowest = vp;\n }\n }\n }\n return optimizeChunks(chunks, lowest);\n }\n}\n//# sourceMappingURL=tbi.js.map","import Long from 'long';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { longToNumber, optimizeChunks } from './util';\nimport IndexFile from './indexFile';\nconst CSI1_MAGIC = 21582659; // CSI\\1\nconst CSI2_MAGIC = 38359875; // CSI\\2\nfunction lshift(num, bits) {\n return num * 2 ** bits;\n}\nfunction rshift(num, bits) {\n return Math.floor(num / 2 ** bits);\n}\nexport default class CSI extends IndexFile {\n constructor(args) {\n super(args);\n this.maxBinNumber = 0;\n this.depth = 0;\n this.minShift = 0;\n }\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n async indexCov() {\n throw new Error('CSI indexes do not support indexcov');\n }\n parseAuxData(bytes, offset) {\n const formatFlags = bytes.readInt32LE(offset);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const format = { 0: 'generic', 1: 'SAM', 2: 'VCF' }[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(offset + 4),\n start: bytes.readInt32LE(offset + 8),\n end: bytes.readInt32LE(offset + 12),\n };\n const metaValue = bytes.readInt32LE(offset + 16);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(offset + 20);\n const nameSectionLength = bytes.readInt32LE(offset + 24);\n const { refIdToName, refNameToId } = this._parseNameBytes(bytes.slice(offset + 28, offset + 28 + nameSectionLength));\n return {\n refIdToName,\n refNameToId,\n skipLines,\n metaChar,\n columnNumbers,\n format,\n coordinateType,\n };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const bytes = await unzip((await this.filehandle.readFile(opts)));\n // check TBI magic numbers\n let csiVersion;\n if (bytes.readUInt32LE(0) === CSI1_MAGIC) {\n csiVersion = 1;\n }\n else if (bytes.readUInt32LE(0) === CSI2_MAGIC) {\n csiVersion = 2;\n }\n else {\n throw new Error('Not a CSI file');\n // TODO: do we need to support big-endian CSI files?\n }\n this.minShift = bytes.readInt32LE(4);\n this.depth = bytes.readInt32LE(8);\n this.maxBinNumber = ((1 << ((this.depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (this.minShift + this.depth * 3);\n const auxLength = bytes.readInt32LE(12);\n const aux = auxLength && auxLength >= 30\n ? this.parseAuxData(bytes, 16)\n : {\n refIdToName: [],\n refNameToId: {},\n metaChar: null,\n columnNumbers: { ref: 0, start: 1, end: 2 },\n coordinateType: 'zero-based-half-open',\n format: 'generic',\n };\n const refCount = bytes.readInt32LE(16 + auxLength);\n // read the indexes for each reference sequence\n let firstDataLine;\n let currOffset = 16 + auxLength + 4;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats; // < provided by parsing a pseudo-bin, if present\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n if (bin > this.maxBinNumber) {\n // this is a fake bin that actually has stats information\n // about the reference sequence in it\n stats = this.parsePseudoBin(bytes, currOffset + 4);\n currOffset += 4 + 8 + 4 + 16 + 16;\n }\n else {\n const loffset = fromBytes(bytes, currOffset + 4);\n firstDataLine = this._findFirstData(firstDataLine, loffset);\n const chunkCount = bytes.readInt32LE(currOffset + 12);\n currOffset += 16;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n // this._findFirstData(data, u)\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n return { binIndex, stats };\n });\n return {\n ...aux,\n csi: true,\n refCount,\n maxBlockSize: 1 << 16,\n firstDataLine,\n csiVersion,\n indices,\n depth: this.depth,\n maxBinNumber: this.maxBinNumber,\n maxRefLength,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 28, offset + 36), true));\n return { lineCount };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = this.reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n return optimizeChunks(chunks, new VirtualOffset(0, 0));\n }\n /**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\n reg2bins(beg, end) {\n beg -= 1; // < convert to 1-based closed\n if (beg < 1) {\n beg = 1;\n }\n if (end > 2 ** 50) {\n end = 2 ** 34;\n } // 17 GiB ought to be enough for anybody\n end -= 1;\n let l = 0;\n let t = 0;\n let s = this.minShift + this.depth * 3;\n const bins = [];\n for (; l <= this.depth; s -= 3, t += lshift(1, l * 3), l += 1) {\n const b = t + rshift(beg, s);\n const e = t + rshift(end, s);\n if (e - b + bins.length > this.maxBinNumber) {\n throw new Error(`query ${beg}-${end} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);\n }\n bins.push([b, e]);\n }\n return bins;\n }\n}\n//# sourceMappingURL=csi.js.map","import AbortablePromiseCache from 'abortable-promise-cache';\nimport LRU from 'quick-lru';\nimport { Buffer } from 'buffer';\nimport { LocalFile } from 'generic-filehandle';\nimport { unzip, unzipChunkSlice } from '@gmod/bgzf-filehandle';\nimport { checkAbortSignal } from './util';\nimport TBI from './tbi';\nimport CSI from './csi';\nconst decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8') : undefined;\nfunction timeout(time) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\nexport default class TabixIndexedFile {\n /**\n * @param {object} args\n * @param {string} [args.path]\n * @param {filehandle} [args.filehandle]\n * @param {string} [args.tbiPath]\n * @param {filehandle} [args.tbiFilehandle]\n * @param {string} [args.csiPath]\n * @param {filehandle} [args.csiFilehandle]\n * @param {number} [args.yieldTime] yield to main thread after N milliseconds if reading features is taking a long time to avoid hanging main thread\n * @param {function} [args.renameRefSeqs] optional function with sig `string => string` to transform\n * reference sequence names for the purpose of indexing and querying. note that the data that is returned is\n * not altered, just the names of the reference sequences that are used for querying.\n */\n constructor({ path, filehandle, tbiPath, tbiFilehandle, csiPath, csiFilehandle, yieldTime = 500, chunkSizeLimit = 50000000, renameRefSeqs = n => n, chunkCacheSize = 5 * 2 ** 20, }) {\n if (filehandle) {\n this.filehandle = filehandle;\n }\n else if (path) {\n this.filehandle = new LocalFile(path);\n }\n else {\n throw new TypeError('must provide either filehandle or path');\n }\n if (tbiFilehandle) {\n this.index = new TBI({\n filehandle: tbiFilehandle,\n renameRefSeqs,\n });\n }\n else if (csiFilehandle) {\n this.index = new CSI({\n filehandle: csiFilehandle,\n renameRefSeqs,\n });\n }\n else if (tbiPath) {\n this.index = new TBI({\n filehandle: new LocalFile(tbiPath),\n renameRefSeqs,\n });\n }\n else if (csiPath) {\n this.index = new CSI({\n filehandle: new LocalFile(csiPath),\n renameRefSeqs,\n });\n }\n else if (path) {\n this.index = new TBI({\n filehandle: new LocalFile(`${path}.tbi`),\n renameRefSeqs,\n });\n }\n else {\n throw new TypeError('must provide one of tbiFilehandle, tbiPath, csiFilehandle, or csiPath');\n }\n this.chunkSizeLimit = chunkSizeLimit;\n this.renameRefSeq = renameRefSeqs;\n this.yieldTime = yieldTime;\n this.chunkCache = new AbortablePromiseCache({\n cache: new LRU({ maxSize: Math.floor(chunkCacheSize / (1 << 16)) }),\n fill: (args, signal) => this.readChunk(args, { signal }),\n });\n }\n /**\n * @param refName name of the reference sequence\n * @param start start of the region (in 0-based half-open coordinates)\n * @param end end of the region (in 0-based half-open coordinates)\n * @param opts callback called for each line in the region. can also pass a object param containing obj.lineCallback, obj.signal, etc\n * @returns promise that is resolved when the whole read is finished, rejected on error\n */\n async getLines(refName, start, end, opts) {\n let signal;\n let options = {};\n let callback;\n if (typeof opts === 'undefined') {\n throw new TypeError('line callback must be provided');\n }\n if (typeof opts === 'function') {\n callback = opts;\n }\n else {\n options = opts;\n callback = opts.lineCallback;\n }\n if (refName === undefined) {\n throw new TypeError('must provide a reference sequence name');\n }\n if (!callback) {\n throw new TypeError('line callback must be provided');\n }\n const metadata = await this.index.getMetadata(options);\n checkAbortSignal(signal);\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = metadata.maxRefLength;\n }\n if (!(start <= end)) {\n throw new TypeError('invalid start and end coordinates. start must be less than or equal to end');\n }\n if (start === end) {\n return;\n }\n const chunks = await this.index.blocksForRange(refName, start, end, options);\n checkAbortSignal(signal);\n // check the chunks for any that are over the size limit. if\n // any are, don't fetch any of them\n for (let i = 0; i < chunks.length; i += 1) {\n const size = chunks[i].fetchedSize();\n if (size > this.chunkSizeLimit) {\n throw new Error(`Too much data. Chunk size ${size.toLocaleString()} bytes exceeds chunkSizeLimit of ${this.chunkSizeLimit.toLocaleString()}.`);\n }\n }\n // now go through each chunk and parse and filter the lines out of it\n let last = Date.now();\n for (let chunkNum = 0; chunkNum < chunks.length; chunkNum += 1) {\n let previousStartCoordinate;\n const c = chunks[chunkNum];\n const { buffer, cpositions, dpositions } = await this.chunkCache.get(c.toString(), c);\n checkAbortSignal(signal);\n let blockStart = 0;\n let pos = 0;\n while (blockStart < buffer.length) {\n const n = buffer.indexOf('\\n', blockStart);\n if (n === -1) {\n break;\n }\n const b = buffer.slice(blockStart, n);\n const line = (decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString();\n if (dpositions) {\n while (blockStart + c.minv.dataPosition >= dpositions[pos++]) { }\n pos--;\n }\n // filter the line for whether it is within the requested range\n const { startCoordinate, overlaps } = this.checkLine(metadata, refName, start, end, line);\n // do a small check just to make sure that the lines are really sorted\n // by start coordinate\n if (previousStartCoordinate !== undefined &&\n startCoordinate !== undefined &&\n previousStartCoordinate > startCoordinate) {\n throw new Error(`Lines not sorted by start coordinate (${previousStartCoordinate} > ${startCoordinate}), this file is not usable with Tabix.`);\n }\n previousStartCoordinate = startCoordinate;\n if (overlaps) {\n callback(line.trim(), \n // cpositions[pos] refers to actual file offset of a bgzip block boundaries\n //\n // we multiply by (1 <<8) in order to make sure each block has a \"unique\"\n // address space so that data in that block could never overlap\n //\n // then the blockStart-dpositions is an uncompressed file offset from\n // that bgzip block boundary, and since the cpositions are multiplied by\n // (1 << 8) these uncompressed offsets get a unique space\n cpositions[pos] * (1 << 8) +\n (blockStart - dpositions[pos]) +\n c.minv.dataPosition +\n 1);\n }\n else if (startCoordinate !== undefined && startCoordinate >= end) {\n // the lines were overlapping the region, but now have stopped, so\n // we must be at the end of the relevant data and we can stop\n // processing data now\n return;\n }\n // yield if we have emitted beyond the yield limit\n if (this.yieldTime && last - Date.now() > this.yieldTime) {\n last = Date.now();\n checkAbortSignal(signal);\n await timeout(1);\n }\n blockStart = n + 1;\n }\n }\n }\n async getMetadata(opts = {}) {\n return this.index.getMetadata(opts);\n }\n /**\n * get a buffer containing the \"header\" region of\n * the file, which are the bytes up to the first\n * non-meta line\n */\n async getHeaderBuffer(opts = {}) {\n const { firstDataLine, metaChar, maxBlockSize } = await this.getMetadata(opts);\n checkAbortSignal(opts.signal);\n const maxFetch = ((firstDataLine === null || firstDataLine === void 0 ? void 0 : firstDataLine.blockPosition) || 0) + maxBlockSize;\n // TODO: what if we don't have a firstDataLine, and the header\n // actually takes up more than one block? this case is not covered here\n let bytes = await this._readRegion(0, maxFetch, opts);\n checkAbortSignal(opts.signal);\n try {\n bytes = await unzip(bytes);\n }\n catch (e) {\n console.error(e);\n throw new Error(\n //@ts-ignore\n `error decompressing block ${e.code} at 0 (length ${maxFetch}) ${e}`);\n }\n // trim off lines after the last non-meta line\n if (metaChar) {\n // trim backward from the end\n let lastNewline = -1;\n const newlineByte = '\\n'.charCodeAt(0);\n const metaByte = metaChar.charCodeAt(0);\n for (let i = 0; i < bytes.length; i += 1) {\n if (i === lastNewline + 1 && bytes[i] !== metaByte) {\n break;\n }\n if (bytes[i] === newlineByte) {\n lastNewline = i;\n }\n }\n bytes = bytes.slice(0, lastNewline + 1);\n }\n return bytes;\n }\n /**\n * get a string containing the \"header\" region of the\n * file, is the portion up to the first non-meta line\n *\n * @returns {Promise} for a string\n */\n async getHeader(opts = {}) {\n const bytes = await this.getHeaderBuffer(opts);\n return bytes.toString('utf8');\n }\n /**\n * get an array of reference sequence names, in the order in which\n * they occur in the file. reference sequence renaming is not applied\n * to these names.\n */\n async getReferenceSequenceNames(opts = {}) {\n const metadata = await this.getMetadata(opts);\n return metadata.refIdToName;\n }\n /**\n * @param {object} metadata metadata object from the parsed index,\n * containing columnNumbers, metaChar, and format\n * @param {string} regionRefName\n * @param {number} regionStart region start coordinate (0-based-half-open)\n * @param {number} regionEnd region end coordinate (0-based-half-open)\n * @param {array[string]} line\n * @returns {object} like `{startCoordinate, overlaps}`. overlaps is boolean,\n * true if line is a data line that overlaps the given region\n */\n checkLine(metadata, regionRefName, regionStart, regionEnd, line) {\n const { columnNumbers, metaChar, coordinateType, format } = metadata;\n // skip meta lines\n if (line.charAt(0) === metaChar) {\n return { overlaps: false };\n }\n // check ref/start/end using column metadata from index\n let { ref, start, end } = columnNumbers;\n if (!ref) {\n ref = 0;\n }\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = 0;\n }\n if (format === 'VCF') {\n end = 8;\n }\n const maxColumn = Math.max(ref, start, end);\n // this code is kind of complex, but it is fairly fast.\n // basically, we want to avoid doing a split, because if the lines are really long\n // that could lead to us allocating a bunch of extra memory, which is slow\n let currentColumnNumber = 1; // cols are numbered starting at 1 in the index metadata\n let currentColumnStart = 0;\n let refSeq = '';\n let startCoordinate = -Infinity;\n for (let i = 0; i < line.length + 1; i += 1) {\n if (line[i] === '\\t' || i === line.length) {\n if (currentColumnNumber === ref) {\n if (this.renameRefSeq(line.slice(currentColumnStart, i)) !==\n regionRefName) {\n return { overlaps: false };\n }\n }\n else if (currentColumnNumber === start) {\n startCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n // we convert to 0-based-half-open\n if (coordinateType === '1-based-closed') {\n startCoordinate -= 1;\n }\n if (startCoordinate >= regionEnd) {\n return { startCoordinate, overlaps: false };\n }\n if (end === 0 || end === start) {\n // if we have no end, we assume the feature is 1 bp long\n if (startCoordinate + 1 <= regionStart) {\n return { startCoordinate, overlaps: false };\n }\n }\n }\n else if (format === 'VCF' && currentColumnNumber === 4) {\n refSeq = line.slice(currentColumnStart, i);\n }\n else if (currentColumnNumber === end) {\n let endCoordinate;\n // this will never match if there is no end column\n if (format === 'VCF') {\n endCoordinate = this._getVcfEnd(startCoordinate, refSeq, line.slice(currentColumnStart, i));\n }\n else {\n endCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n }\n if (endCoordinate <= regionStart) {\n return { overlaps: false };\n }\n }\n currentColumnStart = i + 1;\n currentColumnNumber += 1;\n if (currentColumnNumber > maxColumn) {\n break;\n }\n }\n }\n return { startCoordinate, overlaps: true };\n }\n _getVcfEnd(startCoordinate, refSeq, info) {\n let endCoordinate = startCoordinate + refSeq.length;\n // ignore TRA features as they specify CHR2 and END\n // as being on a different chromosome\n // if CHR2 is on the same chromosome, still ignore it\n // because there should be another pairwise feature\n // at the end of this one\n const isTRA = info.indexOf('SVTYPE=TRA') !== -1;\n if (info[0] !== '.' && !isTRA) {\n let prevChar = ';';\n for (let j = 0; j < info.length; j += 1) {\n if (prevChar === ';' && info.slice(j, j + 4) === 'END=') {\n let valueEnd = info.indexOf(';', j);\n if (valueEnd === -1) {\n valueEnd = info.length;\n }\n endCoordinate = parseInt(info.slice(j + 4, valueEnd), 10);\n break;\n }\n prevChar = info[j];\n }\n }\n else if (isTRA) {\n return startCoordinate + 1;\n }\n return endCoordinate;\n }\n /**\n * return the approximate number of data lines in the given reference sequence\n * @param refSeq reference sequence name\n * @returns number of data lines present on that reference sequence\n */\n async lineCount(refName, opts = {}) {\n return this.index.lineCount(refName, opts);\n }\n async _readRegion(pos, size, opts = {}) {\n const b = Buffer.alloc(size);\n const { bytesRead, buffer } = await this.filehandle.read(b, 0, size, pos, opts);\n return buffer.slice(0, bytesRead);\n }\n /**\n * read and uncompress the data in a chunk (composed of one or more\n * contiguous bgzip blocks) of the file\n */\n async readChunk(c, opts = {}) {\n // fetch the uncompressed data, uncompress carefully a block at a time,\n // and stop when done\n const data = await this._readRegion(c.minv.blockPosition, c.fetchedSize(), opts);\n try {\n return unzipChunkSlice(data, c);\n }\n catch (e) {\n throw new Error(`error decompressing c ${c.toString()} ${e}`);\n }\n }\n}\n//# sourceMappingURL=tabixIndexedFile.js.map","export default {\n // INFO fields\n InfoFields: {\n // from the VCF4.3 spec, https://samtools.github.io/hts-specs/VCFv4.3.pdf\n AA: { Number: 1, Type: 'String', Description: 'Ancestral allele' },\n AC: {\n Number: 'A',\n Type: 'Integer',\n Description: 'Allele count in genotypes, for each ALT allele, in the same order as listed',\n },\n AD: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Total read depth for each allele',\n },\n ADF: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Read depth for each allele on the forward strand',\n },\n ADR: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Read depth for each allele on the reverse strand',\n },\n AF: {\n Number: 'A',\n Type: 'Float',\n Description: 'Allele frequency for each ALT allele in the same order as listed (estimated from primary data, not called genotypes)',\n },\n AN: {\n Number: 1,\n Type: 'Integer',\n Description: 'Total number of alleles in called genotypes',\n },\n BQ: {\n Number: 1,\n Type: 'Float',\n Description: 'RMS base quality',\n },\n CIGAR: {\n Number: 1,\n Type: 'Float',\n Description: 'Cigar string describing how to align an alternate allele to the reference allele',\n },\n DB: {\n Number: 0,\n Type: 'Flag',\n Description: 'dbSNP membership',\n },\n DP: {\n Number: 1,\n Type: 'Integer',\n Description: 'combined depth across samples',\n },\n END: {\n Number: 1,\n Type: 'Integer',\n Description: 'End position (for use with symbolic alleles)',\n },\n H2: {\n Number: 0,\n Type: 'Flag',\n Description: 'HapMap2 membership',\n },\n H3: {\n Number: 0,\n Type: 'Flag',\n Description: 'HapMap3 membership',\n },\n MQ: {\n Number: 1,\n Type: null,\n Description: 'RMS mapping quality',\n },\n MQ0: {\n Number: 1,\n Type: 'Integer',\n Description: 'Number of MAPQ == 0 reads',\n },\n NS: {\n Number: 1,\n Type: 'Integer',\n Description: 'Number of samples with data',\n },\n SB: {\n Number: 4,\n Type: 'Integer',\n Description: 'Strand bias',\n },\n SOMATIC: {\n Number: 0,\n Type: 'Flag',\n Description: 'Somatic mutation (for cancer genomics)',\n },\n VALIDATED: {\n Number: 0,\n Type: 'Flag',\n Description: 'Validated by follow-up experiment',\n },\n '1000G': {\n Number: 0,\n Type: 'Flag',\n Description: '1000 Genomes membership',\n },\n // specifically for structural variants\n IMPRECISE: {\n Number: 0,\n Type: 'Flag',\n Description: 'Imprecise structural variation',\n },\n NOVEL: {\n Number: 0,\n Type: 'Flag',\n Description: 'Indicates a novel structural variation',\n },\n // For precise variants, END is POS + length of REF allele - 1,\n // and the for imprecise variants the corresponding best estimate.\n SVTYPE: {\n Number: 1,\n Type: 'String',\n Description: 'Type of structural variant',\n },\n // Value should be one of DEL, INS, DUP, INV, CNV, BND. This key can\n // be derived from the REF/ALT fields but is useful for filtering.\n SVLEN: {\n Number: null,\n Type: 'Integer',\n Description: 'Difference in length between REF and ALT alleles',\n },\n // One value for each ALT allele. Longer ALT alleles (e.g. insertions)\n // have positive values, shorter ALT alleles (e.g. deletions)\n // have negative values.\n CIPOS: {\n Number: 2,\n Type: 'Integer',\n Description: 'Confidence interval around POS for imprecise variants',\n },\n CIEND: {\n Number: 2,\n Type: 'Integer',\n Description: 'Confidence interval around END for imprecise variants',\n },\n HOMLEN: {\n Type: 'Integer',\n Description: 'Length of base pair identical micro-homology at event breakpoints',\n },\n HOMSEQ: {\n Type: 'String',\n Description: 'Sequence of base pair identical micro-homology at event breakpoints',\n },\n BKPTID: {\n Type: 'String',\n Description: 'ID of the assembled alternate allele in the assembly file',\n },\n // For precise variants, the consensus sequence the alternate allele assembly\n // is derivable from the REF and ALT fields. However, the alternate allele\n // assembly file may contain additional information about the characteristics\n // of the alt allele contigs.\n MEINFO: {\n Number: 4,\n Type: 'String',\n Description: 'Mobile element info of the form NAME,START,END,POLARITY',\n },\n METRANS: {\n Number: 4,\n Type: 'String',\n Description: 'Mobile element transduction info of the form CHR,START,END,POLARITY',\n },\n DGVID: {\n Number: 1,\n Type: 'String',\n Description: 'ID of this element in Database of Genomic Variation',\n },\n DBVARID: {\n Number: 1,\n Type: 'String',\n Description: 'ID of this element in DBVAR',\n },\n DBRIPID: {\n Number: 1,\n Type: 'String',\n Description: 'ID of this element in DBRIP',\n },\n MATEID: {\n Number: null,\n Type: 'String',\n Description: 'ID of mate breakends',\n },\n PARID: {\n Number: 1,\n Type: 'String',\n Description: 'ID of partner breakend',\n },\n EVENT: {\n Number: 1,\n Type: 'String',\n Description: 'ID of event associated to breakend',\n },\n CILEN: {\n Number: 2,\n Type: 'Integer',\n Description: 'Confidence interval around the inserted material between breakend',\n },\n DPADJ: { Type: 'Integer', Description: 'Read Depth of adjacency' },\n CN: {\n Number: 1,\n Type: 'Integer',\n Description: 'Copy number of segment containing breakend',\n },\n CNADJ: {\n Number: null,\n Type: 'Integer',\n Description: 'Copy number of adjacency',\n },\n CICN: {\n Number: 2,\n Type: 'Integer',\n Description: 'Confidence interval around copy number for the segment',\n },\n CICNADJ: {\n Number: null,\n Type: 'Integer',\n Description: 'Confidence interval around copy number for the adjacency',\n },\n },\n // FORMAT fields\n GenotypeFields: {\n // from the VCF4.3 spec, https://samtools.github.io/hts-specs/VCFv4.3.pdf\n AD: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Read depth for each allele',\n },\n ADF: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Read depth for each allele on the forward strand',\n },\n ADR: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Read depth for each allele on the reverse strand',\n },\n DP: {\n Number: 1,\n Type: 'Integer',\n Description: 'Read depth',\n },\n EC: {\n Number: 'A',\n Type: 'Integer',\n Description: 'Expected alternate allele counts',\n },\n FT: {\n Number: 1,\n Type: 'String',\n Description: 'Filter indicating if this genotype was \"called\"',\n },\n GL: {\n Number: 'G',\n Type: 'Float',\n Description: 'Genotype likelihoods',\n },\n GP: {\n Number: 'G',\n Type: 'Float',\n Description: 'Genotype posterior probabilities',\n },\n GQ: {\n Number: 1,\n Type: 'Integer',\n Description: 'Conditional genotype quality',\n },\n GT: {\n Number: 1,\n Type: 'String',\n Description: 'Genotype',\n },\n HQ: {\n Number: 2,\n Type: 'Integer',\n Description: 'Haplotype quality',\n },\n MQ: {\n Number: 1,\n Type: 'Integer',\n Description: 'RMS mapping quality',\n },\n PL: {\n Number: 'G',\n Type: 'Integer',\n Description: 'Phred-scaled genotype likelihoods rounded to the closest integer',\n },\n PQ: {\n Number: 1,\n Type: 'Integer',\n Description: 'Phasing quality',\n },\n PS: {\n Number: 1,\n Type: 'Integer',\n Description: 'Phase set',\n },\n },\n // ALT fields\n AltTypes: {\n DEL: {\n Description: 'Deletion relative to the reference',\n },\n INS: {\n Description: 'Insertion of novel sequence relative to the reference',\n },\n DUP: {\n Description: 'Region of elevated copy number relative to the reference',\n },\n INV: {\n Description: 'Inversion of reference sequence',\n },\n CNV: {\n Description: 'Copy number variable region (may be both deletion and duplication)',\n },\n 'DUP:TANDEM': {\n Description: 'Tandem duplication',\n },\n 'DEL:ME': {\n Description: 'Deletion of mobile element relative to the reference',\n },\n 'INS:ME': {\n Description: 'Insertion of a mobile element relative to the reference',\n },\n NON_REF: {\n Description: 'Represents any possible alternative allele at this location',\n },\n '*': {\n Description: 'Represents any possible alternative allele at this location',\n },\n },\n // FILTER fields\n FilterTypes: {\n PASS: {\n Description: 'Passed all filters',\n },\n },\n};\n//# sourceMappingURL=vcfReserved.js.map","import vcfReserved from './vcfReserved';\nfunction Variant(stuff) {\n //@ts-ignore\n Object.assign(this, stuff);\n}\nfunction decodeURIComponentNoThrow(uri) {\n try {\n return decodeURIComponent(uri);\n }\n catch (e) {\n // avoid throwing exception on a failure to decode URI component\n return uri;\n }\n}\n/**\n * Class representing a VCF parser, instantiated with the VCF header.\n * @param {object} args\n * @param {string} args.header - The VCF header. Supports both LF and CRLF\n * newlines.\n * @param {boolean} args.strict - Whether to parse in strict mode or not (default true)\n */\nexport default class VCF {\n constructor({ header = '', strict = true, }) {\n if (!header || !header.length) {\n throw new Error('empty header received');\n }\n const headerLines = header.split(/[\\r\\n]+/).filter(line => line);\n if (!headerLines.length) {\n throw new Error('no non-empty header lines specified');\n }\n this.strict = strict;\n this.metadata = JSON.parse(JSON.stringify({\n INFO: vcfReserved.InfoFields,\n FORMAT: vcfReserved.GenotypeFields,\n ALT: vcfReserved.AltTypes,\n FILTER: vcfReserved.FilterTypes,\n }));\n let lastLine;\n headerLines.forEach(line => {\n if (!line.startsWith('#')) {\n throw new Error(`Bad line in header:\\n${line}`);\n }\n else if (line.startsWith('##')) {\n this._parseMetadata(line);\n }\n else {\n lastLine = line;\n }\n });\n if (!lastLine) {\n throw new Error('No format line found in header');\n }\n const fields = lastLine.trim().split('\\t');\n const thisHeader = fields.slice(0, 8);\n const correctHeader = [\n '#CHROM',\n 'POS',\n 'ID',\n 'REF',\n 'ALT',\n 'QUAL',\n 'FILTER',\n 'INFO',\n ];\n if (fields.length < 8) {\n throw new Error(`VCF header missing columns:\\n${lastLine}`);\n }\n else if (thisHeader.length !== correctHeader.length ||\n !thisHeader.every((value, index) => value === correctHeader[index])) {\n throw new Error(`VCF column headers not correct:\\n${lastLine}`);\n }\n this.samples = fields.slice(9);\n }\n _parseGenotypes(format, prerest) {\n const rest = prerest.split('\\t');\n const genotypes = {};\n const formatKeys = format === null || format === void 0 ? void 0 : format.split(':');\n if (formatKeys) {\n this.samples.forEach((sample, index) => {\n genotypes[sample] = {};\n formatKeys.forEach(key => {\n genotypes[sample][key] = null;\n });\n rest[index]\n .split(':')\n .filter(f => f)\n .forEach((val, index) => {\n let thisValue;\n if (val === '' || val === '.' || val === undefined) {\n thisValue = null;\n }\n else {\n const entries = val\n .split(',')\n .map(ent => (ent === '.' ? null : ent));\n const valueType = this.getMetadata('FORMAT', formatKeys[index], 'Type');\n if (valueType === 'Integer' || valueType === 'Float') {\n thisValue = entries.map(val => (val ? +val : val));\n }\n else {\n thisValue = entries;\n }\n }\n genotypes[sample][formatKeys[index]] = thisValue;\n }, {});\n });\n }\n return genotypes;\n }\n /**\n * Parse a VCF metadata line (i.e. a line that starts with \"##\") and add its\n * properties to the object.\n * @param {string} line - A line from the VCF. Supports both LF and CRLF\n * newlines.\n */\n _parseMetadata(line) {\n const match = line.trim().match(/^##(.+?)=(.*)/);\n if (!match) {\n throw new Error(`Line is not a valid metadata line: ${line}`);\n }\n const [metaKey, metaVal] = match.slice(1, 3);\n if (metaVal.startsWith('<')) {\n if (!(metaKey in this.metadata)) {\n this.metadata[metaKey] = {};\n }\n const [id, keyVals] = this._parseStructuredMetaVal(metaVal);\n this.metadata[metaKey][id] = keyVals;\n }\n else {\n this.metadata[metaKey] = metaVal;\n }\n }\n /**\n * Parse a VCF header structured meta string (i.e. a meta value that starts\n * with \"$/g, ''), ',');\n const id = keyVals.ID;\n delete keyVals.ID;\n if ('Number' in keyVals) {\n if (!Number.isNaN(Number(keyVals.Number))) {\n keyVals.Number = Number(keyVals.Number);\n }\n }\n return [id, keyVals];\n }\n /**\n * Get metadata filtered by the elements in args. For example, can pass\n * ('INFO', 'DP') to only get info on an metadata tag that was like\n * \"##INFO=\"\n * @param {...string} args - List of metadata filter strings.\n *\n * @returns {any} An object, string, or number, depending on the filtering\n */\n getMetadata(...args) {\n let filteredMetadata = this.metadata;\n for (let i = 0; i < args.length; i += 1) {\n filteredMetadata = filteredMetadata[args[i]];\n if (!filteredMetadata) {\n return filteredMetadata;\n }\n }\n return filteredMetadata;\n }\n /**\n * Sometimes VCFs have key-value strings that allow the separator within\n * the value if it's in quotes, like:\n * 'ID=DB,Number=0,Type=Flag,Description=\"dbSNP membership, build 129\"'\n *\n * Parse this at a low level since we can't just split at \",\" (or whatever\n * separator). Above line would be parsed to:\n * {ID: 'DB', Number: '0', Type: 'Flag', Description: 'dbSNP membership, build 129'}\n * @param {string} str - Key-value pairs in a string\n * @param {string} [pairSeparator] - A string that separates sets of key-value\n * pairs\n *\n * @returns {object} An object containing the key-value pairs\n */\n _parseKeyValue(str, pairSeparator = ';') {\n const data = {};\n let currKey = '';\n let currValue = '';\n let state = 1; // states: 1: read key to = or pair sep, 2: read value to sep or quote, 3: read value to quote\n for (let i = 0; i < str.length; i += 1) {\n if (state === 1) {\n // read key to = or pair sep\n if (str[i] === '=') {\n state = 2;\n }\n else if (str[i] !== pairSeparator) {\n currKey += str[i];\n }\n else if (currValue === '') {\n data[currKey] = null;\n currKey = '';\n }\n }\n else if (state === 2) {\n // read value to pair sep or quote\n if (str[i] === pairSeparator) {\n data[currKey] = currValue;\n currKey = '';\n currValue = '';\n state = 1;\n }\n else if (str[i] === '\"') {\n state = 3;\n }\n else {\n currValue += str[i];\n }\n }\n else if (state === 3) {\n // read value to quote\n if (str[i] !== '\"') {\n currValue += str[i];\n }\n else {\n state = 2;\n }\n }\n }\n if (state === 2 || state === 3) {\n data[currKey] = currValue;\n }\n else if (state === 1) {\n data[currKey] = null;\n }\n return data;\n }\n /**\n * Parse a VCF line into an object like { CHROM POS ID REF ALT QUAL FILTER\n * INFO } with SAMPLES optionally included if present in the VCF\n * @param {string} line - A string of a line from a VCF. Supports both LF and\n * CRLF newlines.\n */\n parseLine(line) {\n // eslint-disable-next-line no-param-reassign\n line = line.trim();\n if (!line.length) {\n return undefined;\n }\n //@ts-ignore\n const parser = this; // so we can include this in lazy-property closure\n let currChar = 0;\n for (let currField = 0; currChar < line.length; currChar += 1) {\n if (line[currChar] === '\\t') {\n currField += 1;\n }\n if (currField === 9) {\n // reached genotypes, rest of fields are evaluated lazily\n break;\n }\n }\n const fields = line.substr(0, currChar).split('\\t');\n const rest = line.substr(currChar + 1);\n const [CHROM, POS, ID, REF, ALT, QUAL, FILTER] = fields;\n const chrom = CHROM;\n const pos = +POS;\n const id = ID === '.' ? null : ID.split(';');\n const ref = REF;\n const alt = ALT === '.' ? null : ALT.split(',');\n const qual = QUAL === '.' ? null : +QUAL;\n const filter = FILTER === '.' ? null : FILTER.split(';');\n if (this.strict && fields[7] === undefined) {\n throw new Error(\"no INFO field specified, must contain at least a '.' (turn off strict mode to allow)\");\n }\n const info = fields[7] === undefined || fields[7] === '.'\n ? {}\n : this._parseKeyValue(fields[7]);\n Object.keys(info).forEach(key => {\n let items;\n if (info[key]) {\n items = info[key]\n .split(',')\n .map(val => (val === '.' ? null : val))\n .map(f => (f ? decodeURIComponentNoThrow(f) : f));\n }\n else {\n // it will be falsy so just assign whatever is there\n items = info[key];\n }\n const itemType = this.getMetadata('INFO', key, 'Type');\n if (itemType) {\n if (itemType === 'Integer' || itemType === 'Float') {\n items = items.map((val) => {\n if (val === null) {\n return null;\n }\n return Number(val);\n });\n }\n else if (itemType === 'Flag') {\n if (info[key]) {\n // eslint-disable-next-line no-console\n console.warn(`Info field ${key} is a Flag and should not have a value (got value ${info[key]})`);\n }\n else {\n items = true;\n }\n }\n }\n info[key] = items;\n });\n //@ts-ignore\n const variant = new Variant({\n CHROM: chrom,\n POS: pos,\n ALT: alt,\n INFO: info,\n REF: ref,\n FILTER: filter && filter.length === 1 && filter[0] === 'PASS' ? 'PASS' : filter,\n ID: id,\n QUAL: qual,\n });\n Object.defineProperty(variant, 'SAMPLES', {\n get() {\n const samples = parser._parseGenotypes(fields[8], rest);\n Object.defineProperty(this, 'SAMPLES', {\n value: samples,\n configurable: false,\n });\n return samples;\n },\n configurable: true,\n });\n //@ts-ignore\n return variant;\n }\n}\n//# sourceMappingURL=parse.js.map","'use strict';\n\nmodule.exports = value => {\n\tif (!value) {\n\t\treturn false;\n\t}\n\n\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\tif (typeof Symbol.observable === 'symbol' && typeof value[Symbol.observable] === 'function') {\n\t\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\t\treturn value === value[Symbol.observable]();\n\t}\n\n\tif (typeof value['@@observable'] === 'function') {\n\t\treturn value === value['@@observable']();\n\t}\n\n\treturn false;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultSerializer = exports.extendSerializer = void 0;\nfunction extendSerializer(extend, implementation) {\n const fallbackDeserializer = extend.deserialize.bind(extend);\n const fallbackSerializer = extend.serialize.bind(extend);\n return {\n deserialize(message) {\n return implementation.deserialize(message, fallbackDeserializer);\n },\n serialize(input) {\n return implementation.serialize(input, fallbackSerializer);\n }\n };\n}\nexports.extendSerializer = extendSerializer;\nconst DefaultErrorSerializer = {\n deserialize(message) {\n return Object.assign(Error(message.message), {\n name: message.name,\n stack: message.stack\n });\n },\n serialize(error) {\n return {\n __error_marker: \"$$error\",\n message: error.message,\n name: error.name,\n stack: error.stack\n };\n }\n};\nconst isSerializedError = (thing) => thing && typeof thing === \"object\" && \"__error_marker\" in thing && thing.__error_marker === \"$$error\";\nexports.DefaultSerializer = {\n deserialize(message) {\n if (isSerializedError(message)) {\n return DefaultErrorSerializer.deserialize(message);\n }\n else {\n return message;\n }\n },\n serialize(input) {\n if (input instanceof Error) {\n return DefaultErrorSerializer.serialize(input);\n }\n else {\n return input;\n }\n }\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.serialize = exports.deserialize = exports.registerSerializer = void 0;\nconst serializers_1 = require(\"./serializers\");\nlet registeredSerializer = serializers_1.DefaultSerializer;\nfunction registerSerializer(serializer) {\n registeredSerializer = serializers_1.extendSerializer(registeredSerializer, serializer);\n}\nexports.registerSerializer = registerSerializer;\nfunction deserialize(message) {\n return registeredSerializer.deserialize(message);\n}\nexports.deserialize = deserialize;\nfunction serialize(input) {\n return registeredSerializer.serialize(input);\n}\nexports.serialize = serialize;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.$worker = exports.$transferable = exports.$terminate = exports.$events = exports.$errors = void 0;\nexports.$errors = Symbol(\"thread.errors\");\nexports.$events = Symbol(\"thread.events\");\nexports.$terminate = Symbol(\"thread.terminate\");\nexports.$transferable = Symbol(\"thread.transferable\");\nexports.$worker = Symbol(\"thread.worker\");\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Transfer = exports.isTransferDescriptor = void 0;\nconst symbols_1 = require(\"./symbols\");\nfunction isTransferable(thing) {\n if (!thing || typeof thing !== \"object\")\n return false;\n // Don't check too thoroughly, since the list of transferable things in JS might grow over time\n return true;\n}\nfunction isTransferDescriptor(thing) {\n return thing && typeof thing === \"object\" && thing[symbols_1.$transferable];\n}\nexports.isTransferDescriptor = isTransferDescriptor;\nfunction Transfer(payload, transferables) {\n if (!transferables) {\n if (!isTransferable(payload))\n throw Error();\n transferables = [payload];\n }\n return {\n [symbols_1.$transferable]: true,\n send: payload,\n transferables\n };\n}\nexports.Transfer = Transfer;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WorkerMessageType = exports.MasterMessageType = void 0;\n/////////////////////////////\n// Messages sent by master:\nvar MasterMessageType;\n(function (MasterMessageType) {\n MasterMessageType[\"cancel\"] = \"cancel\";\n MasterMessageType[\"run\"] = \"run\";\n})(MasterMessageType = exports.MasterMessageType || (exports.MasterMessageType = {}));\n////////////////////////////\n// Messages sent by worker:\nvar WorkerMessageType;\n(function (WorkerMessageType) {\n WorkerMessageType[\"error\"] = \"error\";\n WorkerMessageType[\"init\"] = \"init\";\n WorkerMessageType[\"result\"] = \"result\";\n WorkerMessageType[\"running\"] = \"running\";\n WorkerMessageType[\"uncaughtError\"] = \"uncaughtError\";\n})(WorkerMessageType = exports.WorkerMessageType || (exports.WorkerMessageType = {}));\n","\"use strict\";\n/// \n// tslint:disable no-shadowed-variable\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst isWorkerRuntime = function isWorkerRuntime() {\n const isWindowContext = typeof self !== \"undefined\" && typeof Window !== \"undefined\" && self instanceof Window;\n return typeof self !== \"undefined\" && self.postMessage && !isWindowContext ? true : false;\n};\nconst postMessageToMaster = function postMessageToMaster(data, transferList) {\n self.postMessage(data, transferList);\n};\nconst subscribeToMasterMessages = function subscribeToMasterMessages(onMessage) {\n const messageHandler = (messageEvent) => {\n onMessage(messageEvent.data);\n };\n const unsubscribe = () => {\n self.removeEventListener(\"message\", messageHandler);\n };\n self.addEventListener(\"message\", messageHandler);\n return unsubscribe;\n};\nexports.default = {\n isWorkerRuntime,\n postMessageToMaster,\n subscribeToMasterMessages\n};\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.expose = exports.isWorkerRuntime = exports.Transfer = exports.registerSerializer = void 0;\nconst is_observable_1 = __importDefault(require(\"is-observable\"));\nconst common_1 = require(\"../common\");\nconst transferable_1 = require(\"../transferable\");\nconst messages_1 = require(\"../types/messages\");\nconst implementation_1 = __importDefault(require(\"./implementation\"));\nvar common_2 = require(\"../common\");\nObject.defineProperty(exports, \"registerSerializer\", { enumerable: true, get: function () { return common_2.registerSerializer; } });\nvar transferable_2 = require(\"../transferable\");\nObject.defineProperty(exports, \"Transfer\", { enumerable: true, get: function () { return transferable_2.Transfer; } });\n/** Returns `true` if this code is currently running in a worker. */\nexports.isWorkerRuntime = implementation_1.default.isWorkerRuntime;\nlet exposeCalled = false;\nconst activeSubscriptions = new Map();\nconst isMasterJobCancelMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.cancel;\nconst isMasterJobRunMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.run;\n/**\n * There are issues with `is-observable` not recognizing zen-observable's instances.\n * We are using `observable-fns`, but it's based on zen-observable, too.\n */\nconst isObservable = (thing) => is_observable_1.default(thing) || isZenObservable(thing);\nfunction isZenObservable(thing) {\n return thing && typeof thing === \"object\" && typeof thing.subscribe === \"function\";\n}\nfunction deconstructTransfer(thing) {\n return transferable_1.isTransferDescriptor(thing)\n ? { payload: thing.send, transferables: thing.transferables }\n : { payload: thing, transferables: undefined };\n}\nfunction postFunctionInitMessage() {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"function\"\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postModuleInitMessage(methodNames) {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"module\",\n methods: methodNames\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postJobErrorMessage(uid, rawError) {\n const { payload: error, transferables } = deconstructTransfer(rawError);\n const errorMessage = {\n type: messages_1.WorkerMessageType.error,\n uid,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage, transferables);\n}\nfunction postJobResultMessage(uid, completed, resultValue) {\n const { payload, transferables } = deconstructTransfer(resultValue);\n const resultMessage = {\n type: messages_1.WorkerMessageType.result,\n uid,\n complete: completed ? true : undefined,\n payload\n };\n implementation_1.default.postMessageToMaster(resultMessage, transferables);\n}\nfunction postJobStartMessage(uid, resultType) {\n const startMessage = {\n type: messages_1.WorkerMessageType.running,\n uid,\n resultType\n };\n implementation_1.default.postMessageToMaster(startMessage);\n}\nfunction postUncaughtErrorMessage(error) {\n try {\n const errorMessage = {\n type: messages_1.WorkerMessageType.uncaughtError,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage);\n }\n catch (subError) {\n // tslint:disable-next-line no-console\n console.error(\"Not reporting uncaught error back to master thread as it \" +\n \"occured while reporting an uncaught error already.\" +\n \"\\nLatest error:\", subError, \"\\nOriginal error:\", error);\n }\n}\nfunction runFunction(jobUID, fn, args) {\n return __awaiter(this, void 0, void 0, function* () {\n let syncResult;\n try {\n syncResult = fn(...args);\n }\n catch (error) {\n return postJobErrorMessage(jobUID, error);\n }\n const resultType = isObservable(syncResult) ? \"observable\" : \"promise\";\n postJobStartMessage(jobUID, resultType);\n if (isObservable(syncResult)) {\n const subscription = syncResult.subscribe(value => postJobResultMessage(jobUID, false, common_1.serialize(value)), error => {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n activeSubscriptions.delete(jobUID);\n }, () => {\n postJobResultMessage(jobUID, true);\n activeSubscriptions.delete(jobUID);\n });\n activeSubscriptions.set(jobUID, subscription);\n }\n else {\n try {\n const result = yield syncResult;\n postJobResultMessage(jobUID, true, common_1.serialize(result));\n }\n catch (error) {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n }\n }\n });\n}\n/**\n * Expose a function or a module (an object whose values are functions)\n * to the main thread. Must be called exactly once in every worker thread\n * to signal its API to the main thread.\n *\n * @param exposed Function or object whose values are functions\n */\nfunction expose(exposed) {\n if (!implementation_1.default.isWorkerRuntime()) {\n throw Error(\"expose() called in the master thread.\");\n }\n if (exposeCalled) {\n throw Error(\"expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.\");\n }\n exposeCalled = true;\n if (typeof exposed === \"function\") {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && !messageData.method) {\n runFunction(messageData.uid, exposed, messageData.args.map(common_1.deserialize));\n }\n });\n postFunctionInitMessage();\n }\n else if (typeof exposed === \"object\" && exposed) {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && messageData.method) {\n runFunction(messageData.uid, exposed[messageData.method], messageData.args.map(common_1.deserialize));\n }\n });\n const methodNames = Object.keys(exposed).filter(key => typeof exposed[key] === \"function\");\n postModuleInitMessage(methodNames);\n }\n else {\n throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${exposed}`);\n }\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobCancelMessage(messageData)) {\n const jobUID = messageData.uid;\n const subscription = activeSubscriptions.get(jobUID);\n if (subscription) {\n subscription.unsubscribe();\n activeSubscriptions.delete(jobUID);\n }\n }\n });\n}\nexports.expose = expose;\nif (typeof self !== \"undefined\" && typeof self.addEventListener === \"function\" && implementation_1.default.isWorkerRuntime()) {\n self.addEventListener(\"error\", event => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(event.error || event), 250);\n });\n self.addEventListener(\"unhandledrejection\", event => {\n const error = event.reason;\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\nif (typeof process !== \"undefined\" && typeof process.on === \"function\" && implementation_1.default.isWorkerRuntime()) {\n process.on(\"uncaughtException\", (error) => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n });\n process.on(\"unhandledRejection\", (error) => {\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\n","import WorkerContext from \"./dist/worker/index.js\"\n\nexport const expose = WorkerContext.expose\nexport const registerSerializer = WorkerContext.registerSerializer\nexport const Transfer = WorkerContext.Transfer\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import toNumber from './toNumber.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nexport default toFinite;\n","import toFinite from './toFinite.js';\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nexport default toInteger;\n","import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nexport default copyArray;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n","import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n","import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nexport default isIterateeCall;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n","import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n","import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n","import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n","import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n","import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n","import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n","import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n","import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n","/**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\nfunction baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n}\n\nexport default baseClamp;\n","import arrayMap from './_arrayMap.js';\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nexport default baseValues;\n","import baseValues from './_baseValues.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n}\n\nexport default values;\n","/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeFloor = Math.floor,\n nativeRandom = Math.random;\n\n/**\n * The base implementation of `_.random` without support for returning\n * floating-point numbers.\n *\n * @private\n * @param {number} lower The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the random number.\n */\nfunction baseRandom(lower, upper) {\n return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n}\n\nexport default baseRandom;\n","import baseRandom from './_baseRandom.js';\n\n/**\n * A specialized version of `_.shuffle` which mutates and sets the size of `array`.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @param {number} [size=array.length] The size of `array`.\n * @returns {Array} Returns `array`.\n */\nfunction shuffleSelf(array, size) {\n var index = -1,\n length = array.length,\n lastIndex = length - 1;\n\n size = size === undefined ? length : size;\n while (++index < size) {\n var rand = baseRandom(index, lastIndex),\n value = array[rand];\n\n array[rand] = array[index];\n array[index] = value;\n }\n array.length = size;\n return array;\n}\n\nexport default shuffleSelf;\n","import baseClamp from './_baseClamp.js';\nimport copyArray from './_copyArray.js';\nimport shuffleSelf from './_shuffleSelf.js';\n\n/**\n * A specialized version of `_.sampleSize` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction arraySampleSize(array, n) {\n return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));\n}\n\nexport default arraySampleSize;\n","import baseClamp from './_baseClamp.js';\nimport shuffleSelf from './_shuffleSelf.js';\nimport values from './values.js';\n\n/**\n * The base implementation of `_.sampleSize` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction baseSampleSize(collection, n) {\n var array = values(collection);\n return shuffleSelf(array, baseClamp(n, 0, array.length));\n}\n\nexport default baseSampleSize;\n","import arraySampleSize from './_arraySampleSize.js';\nimport baseSampleSize from './_baseSampleSize.js';\nimport isArray from './isArray.js';\nimport isIterateeCall from './_isIterateeCall.js';\nimport toInteger from './toInteger.js';\n\n/**\n * Gets `n` random elements at unique keys from `collection` up to the\n * size of `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @param {number} [n=1] The number of elements to sample.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the random elements.\n * @example\n *\n * _.sampleSize([1, 2, 3], 2);\n * // => [3, 1]\n *\n * _.sampleSize([1, 2, 3], 4);\n * // => [2, 3, 1]\n */\nfunction sampleSize(collection, n, guard) {\n if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n var func = isArray(collection) ? arraySampleSize : baseSampleSize;\n return func(collection, n);\n}\n\nexport default sampleSize;\n","export default function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import ascending from \"./ascending.js\";\n\nexport default function(f) {\n let delta = f;\n let compare = f;\n\n if (f.length === 1) {\n delta = (d, x) => f(d) - x;\n compare = ascendingComparator(f);\n }\n\n function left(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function right(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n\n function center(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction ascendingComparator(f) {\n return (d, x) => ascending(f(d), x);\n}\n","import { bisector } from 'd3-array';\nimport { RemoteFile as _RemoteFile } from 'generic-filehandle';\n\nimport type * as HiGlass from '@higlass/types';\nimport type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema';\n\nexport type CommonDataConfig = {\n assembly: Assembly;\n x?: string;\n xe?: string;\n x1?: string;\n x1e?: string;\n urlFetchOptions?: RequestInit;\n};\n\nexport class DataSource {\n chromInfo: ExtendedChromInfo;\n tilesetInfo: ReturnType;\n\n constructor(public file: File, chromSizes: ChromSizes, public options: Options) {\n this.chromInfo = sizesToChromInfo(chromSizes);\n this.tilesetInfo = tilesetInfoFromChromInfo(this.chromInfo);\n }\n}\n\n/**\n * Filter data before sending to a track considering the visible genomic area in the track.\n * TODO(2022-Jul-13): Consider genomic `y` channels as well.\n */\nexport function filterUsingGenoPos(\n data: Datum[],\n [minX, maxX]: [number, number],\n config: Omit\n) {\n const { x, xe, x1, x1e } = config;\n const definedXFields = [x, xe, x1, x1e].filter(f => f) as string[];\n return data.filter((d: Datum) => {\n if (definedXFields.length === 0) {\n // no filter applies\n return true;\n } else if (definedXFields.length === 1) {\n // filter based on one genomic position\n const value = +d[definedXFields[0]];\n return typeof value === 'number' && minX < value && value <= maxX;\n } else {\n // filter based on two genomic positions, i.e., check overlaps\n const values = definedXFields.map(f => +d[f]).filter(v => !isNaN(v));\n const minValue = Math.min(...values);\n const maxValue = Math.max(...values);\n return minX <= maxValue && minValue <= maxX;\n }\n });\n}\n\nconst chromInfoBisector = bisector((d: { pos: number }) => d.pos).left;\n\nconst chrToAbs = (chrom: string, chromPos: number, chromInfo: HiGlass.ChromInfo) =>\n chromInfo.chrPositions[chrom].pos + chromPos;\n\nconst absToChr = (absPosition: number, chromInfo: HiGlass.ChromInfo) => {\n if (!chromInfo || !chromInfo.cumPositions || !chromInfo.cumPositions.length) {\n return null;\n }\n\n let insertPoint = chromInfoBisector(chromInfo.cumPositions, absPosition);\n const lastChr = chromInfo.cumPositions[chromInfo.cumPositions.length - 1].chr;\n const lastLength = chromInfo.chromLengths[lastChr];\n\n // @ts-expect-error\n insertPoint -= insertPoint > 0 && 1;\n\n let chrPosition = Math.floor(absPosition - chromInfo.cumPositions[insertPoint].pos);\n let offset = 0;\n\n if (chrPosition < 0) {\n // before the start of the genome\n offset = chrPosition - 1;\n chrPosition = 1;\n }\n\n if (insertPoint === chromInfo.cumPositions.length - 1 && chrPosition > lastLength) {\n // beyond the last chromosome\n offset = chrPosition - lastLength;\n chrPosition = lastLength;\n }\n\n return [chromInfo.cumPositions[insertPoint].chr, chrPosition, offset, insertPoint] as const;\n};\n\n/**\n * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`.\n * @param chrName A chromosome name to be sanitized\n * @param assembly A genome assembly of the data\n * @param chromosomePrefix A prefix string that can be replaced to 'chr'\n * @returns\n */\nexport function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string) {\n if (Array.isArray(assembly)) {\n // this is a custom assembly, so use this as is\n return chrName;\n }\n\n // For assemblies in Gosling, we use the `chr` prefix consistently\n if (chromosomePrefix) {\n // `hs1` --> `chr1`\n chrName = chrName.replace(chromosomePrefix, 'chr');\n } else if (!chrName.includes('chr')) {\n // `1` --> `chr1`\n chrName = `chr${chrName}`;\n }\n return chrName;\n}\n\nexport type ExtendedChromInfo = HiGlass.ChromInfo & {\n absToChr(absPos: number): ReturnType | null;\n chrToAbs(chr: [name: string, pos: number]): number | null;\n};\n\nexport function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize = 1024) {\n return {\n tile_size: tileSize,\n bins_per_dimension: tileSize,\n max_zoom: Math.ceil(Math.log(chromInfo.totalLength / tileSize) / Math.log(2)),\n max_width: chromInfo.totalLength,\n min_pos: [0],\n max_pos: [chromInfo.totalLength]\n };\n}\n\nexport function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo {\n const info: HiGlass.ChromInfo = {\n cumPositions: [],\n chromLengths: {},\n chrPositions: {},\n totalLength: 0\n };\n\n sizes.forEach(([chr, length], i) => {\n const chrPosition = { id: i, chr, pos: info.totalLength };\n info.chrPositions[chr] = chrPosition;\n info.chromLengths[chr] = length;\n info.cumPositions.push(chrPosition);\n info.totalLength += length;\n });\n\n return {\n ...info,\n absToChr: absPos => (info.chrPositions ? absToChr(absPos, info) : null),\n chrToAbs: ([chrName, chrPos]) => (info.chrPositions ? chrToAbs(chrName, chrPos, info) : null)\n };\n}\n\nexport class RemoteFile extends _RemoteFile {\n // Overrides `read` to eagerly read 200 or 206 response\n // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162\n public read: _RemoteFile['read'] = async (\n buffer,\n offset = 0,\n length,\n position = 0,\n opts = {}\n ): Promise<{ bytesRead: number; buffer: Buffer }> => {\n const { headers = {}, signal, overrides = {} } = opts;\n\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n } else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n // @ts-expect-error private property\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n // @ts-expect-error private property\n ...this.baseOverrides.headers\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal\n };\n const response = await this.fetch(this.url, args);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n\n // Just read the response if it was successful.\n if (response.status === 200 || response.status === 206) {\n // @ts-expect-error private method\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n // @ts-expect-error private property\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n\n return { bytesRead: bytesCopied, buffer };\n }\n\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n };\n}\n\nexport interface TabularDataFetcher {\n getTabularData(tileIds: string[]): Promise;\n MAX_TILE_WIDTH?: number;\n}\n","import type { VcfRecord, VcfTile } from './vcf-data-fetcher';\n\nexport const getMutationType = (ref: string, alt?: string) => {\n if (!alt) return 'unknown';\n if (ref.length === alt.length) return 'substitution';\n if (ref.length > alt.length) return 'deletion';\n if (ref.length < alt.length) return 'insertion';\n return 'unknown';\n};\n\nexport const getSubstitutionType = (ref: string, alt?: string) => {\n switch (ref + alt) {\n case 'CA':\n case 'GT':\n return 'C>A';\n case 'CG':\n case 'GC':\n return 'C>G';\n case 'CT':\n case 'GA':\n return 'C>T';\n case 'TA':\n case 'AT':\n return 'T>A';\n case 'TC':\n case 'AG':\n return 'T>C';\n case 'TG':\n case 'AC':\n return 'T>G';\n default:\n return 'unknown';\n }\n};\n\n/**\n * Convert a VCF record to a tile data\n * @param vcfRecord A row of a VCF files loaded\n * @param chrPos Cumulative start position of a chromosome\n * @param prevAbsPos Previous position of a point mutation for calculating 'distance to previous'\n */\nexport function recordToTile(vcfRecord: VcfRecord, chrPos: number, prevAbsPos?: number) {\n const absPos = chrPos + vcfRecord.POS + 1;\n\n let ALT: string | undefined;\n if (Array.isArray(vcfRecord.ALT) && vcfRecord.ALT.length > 0) {\n ALT = vcfRecord.ALT[0];\n }\n\n // Additionally inferred values\n const DISTPREV = !prevAbsPos ? null : absPos - prevAbsPos;\n const DISTPREVLOGE = !prevAbsPos ? null : Math.log(absPos - prevAbsPos);\n const MUTTYPE = getMutationType(vcfRecord.REF, ALT);\n const SUBTYPE = getSubstitutionType(vcfRecord.REF, ALT);\n const POSEND = absPos + vcfRecord.REF.length;\n\n // Create key values\n const data: VcfTile = {\n ...vcfRecord,\n ALT,\n MUTTYPE,\n SUBTYPE,\n INFO: JSON.stringify(vcfRecord.INFO),\n ORIGINALPOS: vcfRecord.POS,\n POS: absPos,\n POSEND,\n DISTPREV,\n DISTPREVLOGE\n };\n\n // Add optional INFO columns\n Object.keys(vcfRecord.INFO).forEach(key => {\n const val = vcfRecord.INFO[key];\n if (Array.isArray(val)) {\n data[key] = val.join(', ');\n } else {\n data[key] = val;\n }\n });\n return data;\n}\n","/*\n * This document is heavily based on the following repo by @alexander-veit:\n * https://github.com/dbmi-bgm/higlass-sv/blob/main/src/sv-fetcher-worker.js\n */\nimport { TabixIndexedFile } from '@gmod/tabix';\nimport VCF from '@gmod/vcf';\nimport { expose, Transfer } from 'threads/worker';\nimport { sampleSize } from 'lodash-es';\n\nimport { DataSource, RemoteFile } from '../utils';\n\nimport type { TilesetInfo } from '@higlass/types';\nimport type { ChromSizes } from '@gosling-lang/gosling-schema';\nimport type { VcfTile } from './vcf-data-fetcher';\nimport { recordToTile } from './utils';\n\n// promises indexed by urls\nconst vcfFiles: Map = new Map();\n\ntype VcfFileOptions = {\n sampleLength: number;\n urlFetchOptions?: RequestInit;\n indexUrlFetchOptions?: RequestInit;\n};\n\n/**\n * This is a class to represent a VCF file.\n */\nclass VcfFile {\n #parser?: VCF;\n #uid: string;\n constructor(public tbi: TabixIndexedFile, uid: string) {\n this.#uid = uid;\n }\n /**\n * Function to create an instance of VcfFile from URLs\n * @param url A string which is the URL of the bed file\n * @param indexUrl A string which is the URL of the bed index file\n * @param uid A unique identifier for the worker\n * @param urlFetchOptions\n * @param indexUrlFetchOptions\n * @returns an instance of VcfFile\n */\n static fromUrl(\n url: string,\n indexUrl: string,\n uid: string,\n urlFetchOptions?: RequestInit,\n indexUrlFetchOptions?: RequestInit\n ) {\n const tbi = new TabixIndexedFile({\n filehandle: new RemoteFile(url, { overrides: urlFetchOptions }),\n tbiFilehandle: new RemoteFile(indexUrl, { overrides: indexUrlFetchOptions })\n });\n return new VcfFile(tbi, uid);\n }\n /**\n * Creates the parser used for the VCF file.\n */\n async getParser() {\n if (!this.#parser) {\n const header = await this.tbi.getHeader();\n this.#parser = new VCF({ header });\n }\n return this.#parser;\n }\n /**\n * Retrieves data within a certain coordinate range\n * @param minX A number which is the minimum X boundary of the tile\n * @param maxX A number which is the maximum X boundary of the tile\n * @param callback A callback function which receives the VCF tile\n * @returns A promise of array of promises which resolve when the data has been successfully retrieved\n */\n async getTileData(minX: number, maxX: number): Promise {\n const source = dataSources.get(this.#uid)!;\n const parser = await this.getParser();\n\n let curMinX = minX;\n const { chromLengths, cumPositions } = source.chromInfo;\n const recordPromises: Promise[] = [];\n\n for (const cumPos of cumPositions) {\n const chromName = cumPos.chr;\n const chromStart = cumPos.pos;\n const chromEnd = cumPos.pos + chromLengths[chromName];\n let startPos, endPos;\n\n // Early break, rather than creating an nested if\n if (chromStart > curMinX || curMinX >= chromEnd) {\n continue;\n }\n\n // start of the visible region is within this chromosome\n let prevPOS: number | undefined;\n const tilesPromise = new Promise(resolve => {\n const tiles: VcfTile[] = [];\n const lineCallback = (line: string) => {\n const vcfRecord = parser.parseLine(line);\n const vcfTile = recordToTile(vcfRecord, chromStart, prevPOS);\n prevPOS = vcfTile.POS;\n tiles.push(vcfTile);\n };\n\n if (maxX > chromEnd) {\n startPos = curMinX - chromStart;\n endPos = chromEnd - chromStart;\n } else {\n startPos = Math.floor(curMinX - chromStart);\n endPos = Math.ceil(maxX - chromStart);\n }\n\n source.file.tbi.getLines(chromName, startPos, endPos, lineCallback).then(() => {\n resolve(tiles);\n });\n });\n\n recordPromises.push(tilesPromise);\n\n if (maxX <= chromEnd) {\n continue;\n }\n\n curMinX = chromEnd;\n }\n\n const tileArrays = await Promise.all(recordPromises);\n return tileArrays.flat();\n }\n}\n\n// promises indexed by url\nconst tileValues: Record = {}; // new LRU({ max: MAX_TILES });\n\n// const vcfData = [];\nconst dataSources: Map> = new Map();\n\nfunction init(\n uid: string,\n vcf: { url: string; indexUrl: string },\n chromSizes: ChromSizes,\n options: Partial = {}\n) {\n let vcfFile = vcfFiles.get(vcf.url);\n if (!vcfFile) {\n vcfFile = VcfFile.fromUrl(vcf.url, vcf.indexUrl, uid, options.urlFetchOptions, options.indexUrlFetchOptions);\n }\n const dataSource = new DataSource(vcfFile, chromSizes, {\n sampleLength: 1000,\n ...options\n });\n dataSources.set(uid, dataSource);\n}\n\nconst tilesetInfo = (uid: string) => {\n return dataSources.get(uid)!.tilesetInfo;\n};\n\n/**\n * Updates `tileValues` with the data for a specific tile.\n * @param uid A string which is the unique identifier of the worker\n * @param z A number which is the z coordinate of the tile\n * @param x A number which is the x coordinate of the tile\n */\nconst tile = async (uid: string, z: number, x: number): Promise => {\n const source = dataSources.get(uid)!;\n const CACHE_KEY = `${uid}.${z}.${x}`;\n\n // TODO: Caching is needed\n // if (!tileValues[CACHE_KEY]) {\n tileValues[CACHE_KEY] = [];\n // }\n const tileWidth = +source.tilesetInfo.max_width / 2 ** +z;\n\n // get bounds of this tile\n const minX = source.tilesetInfo.min_pos[0] + x * tileWidth;\n const maxX = source.tilesetInfo.min_pos[0] + (x + 1) * tileWidth;\n\n tileValues[CACHE_KEY] = await source.file.getTileData(minX, maxX);\n\n return tileValues[CACHE_KEY];\n};\n\nconst fetchTilesDebounced = async (uid: string, tileIds: string[]) => {\n const tiles: Record = {};\n const validTileIds: string[] = [];\n const tilePromises: Promise[] = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('Invalid tile zoom or position:', z, x);\n continue;\n }\n validTileIds.push(tileId);\n tilePromises.push(tile(uid, z, x));\n }\n return Promise.all(tilePromises).then(values => {\n for (let i = 0; i < values.length; i++) {\n const validTileId = validTileIds[i];\n // @ts-expect-error values is void, this should never happen.\n tiles[validTileId] = values[i];\n tiles[validTileId].tilePositionId = validTileId;\n }\n return tiles;\n });\n};\n\nconst getTabularData = (uid: string, tileIds: string[]) => {\n const data: VcfTile[][] = [];\n\n tileIds.forEach(tileId => {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n const tileValue = tileValues[`${uid}.${z}.${x}`];\n\n if (!tileValue) {\n console.warn(`No tile data constructed (${tileId})`);\n }\n\n data.push(tileValue);\n });\n\n let output = Object.values(data).flat();\n\n const sampleLength = dataSources.get(uid)!.options.sampleLength;\n if (output.length >= sampleLength) {\n // TODO: we can make this more generic\n // priotize that mutations with closer each other are selected when sampling.\n const highPriority = output.sort((a, b) => -(a.DISTPREV ?? 0) + (b.DISTPREV ?? 0)).slice(0, sampleLength / 2.0);\n output = sampleSize(output, sampleLength / 2.0).concat(highPriority);\n }\n\n const buffer = new TextEncoder().encode(JSON.stringify(output)).buffer;\n return Transfer(buffer, [buffer]);\n};\n\nconst tileFunctions = {\n init,\n tilesetInfo,\n fetchTilesDebounced,\n tile,\n getTabularData\n};\n\nexport type WorkerApi = typeof tileFunctions;\nexport type { TilesetInfo };\n\nexpose(tileFunctions);\n"],"names":["i","_getPrototypeOf","o","_setPrototypeOf","p","self","_get","Emitter","AbortSignal","toString","AbortController","err","Request","init","abortableFetch","require$$0","global","AggregateAbortController_1","abortcontroller_ponyfill_1","AggregateStatusReporter_1","__importDefault","this","AbortablePromiseCache_1","require$$1","require$$2","len","len2","buffer","c","ieee754","exports","Buffer","fromString","byteLength","isBuffer","code","msg","utils","Z_FIXED","Z_UNKNOWN","zero","MIN_MATCH","MAX_MATCH","LENGTH_CODES","LITERALS","L_CODES","D_CODES","BL_CODES","HEAP_SIZE","MAX_BITS","rank","adler32","crc32","messages","require$$3","require$$4","Z_NO_FLUSH","Z_FINISH","Z_BLOCK","Z_OK","Z_STREAM_END","Z_STREAM_ERROR","Z_DATA_ERROR","Z_BUF_ERROR","Z_DEFAULT_COMPRESSION","Z_DEFAULT_STRATEGY","Z_DEFLATED","MAX_WBITS","deflate","strings","c2","ZStream","BAD","TYPE","inflate_fast","ENOUGH_LENS","ENOUGH_DISTS","CODES","LENS","DISTS","inflate_table","root","q","inflate","constants","GZheader","require$$5","require$$6","Inflate","Z_SYNC_FLUSH","toNumber","fromBytes","long","Long","TBI","AbortablePromiseCache","index","val","Transfer","isWorkerRuntime","postMessageToMaster","subscribeToMasterMessages","isObservable","expose","freeGlobal","Symbol","objectProto","hasOwnProperty","nativeObjectToString","symToStringTag","funcTag","MAX_SAFE_INTEGER","argsTag","freeExports","freeModule","moduleExports","nodeUtil","isArray","isArguments","isTypedArray","nativeKeys","_RemoteFile","values"],"mappings":";;;;;;;;;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AI,EAAE,KAAK;AAEtC,UAAM,eAAe,YAAY,IAAI,GAAG,EAAG,QAAQ;AAC/C,QAAA,OAAO,UAAU,cAAc;AAG/B,YAAM,eAAe,OAAO,KAAK,CAAC,GAAG,MAAM;;AAAA,kBAAE,OAAE,aAAF,YAAc,OAAM,OAAE,aAAF,YAAc;AAAA,OAAE,EAAE,MAAM,GAAG,eAAe,CAAG;AAC9G,eAAS,WAAW,QAAQ,eAAe,CAAG,EAAE,OAAO,YAAY;AAAA,IACvE;AAEM,UAAA2B,UAAS,IAAI,YAAY,EAAE,OAAO,KAAK,UAAU,MAAM,CAAC,EAAE;AAChE,WAAO,SAASA,SAAQ,CAACA,OAAM,CAAC;AAAA,EACpC;AAEA,QAAM,gBAAgB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAKA,SAAO,aAAa;;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95]} \ No newline at end of file diff --git a/dist/exported-utils-c80467e4.js b/dist/exported-utils-c80467e4.js new file mode 100644 index 00000000..e1501bfc --- /dev/null +++ b/dist/exported-utils-c80467e4.js @@ -0,0 +1,10042 @@ +var __defProp = Object.defineProperty; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __publicField = (obj, key, value) => { + __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; +}; +import { group, max, min, bisector } from "d3-array"; +import { RemoteFile as RemoteFile$1 } from "generic-filehandle"; +import * as PIXI from "pixi.js"; +import { color } from "d3-color"; +import { Bezier } from "bezier-js"; +import { scaleLinear } from "d3-scale"; +import { isUndefined } from "lodash-es"; +import { interpolateViridis, interpolateGreys, interpolateWarm, interpolateSpectral, interpolateCividis, interpolateBuPu, interpolateRdBu, interpolateYlOrBr, interpolateRdPu } from "d3-scale-chromatic"; +const DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM = 6; +const DEFAULT_TRACK_HEIGHT_LINEAR = 130; +const DEFAULT_TRACK_WIDTH_LINEAR = 600; +const DEFAULT_TRACK_SIZE_2D = 600; +const DEFAULT_VIEW_SPACING = 10; +const DEFAULT_INNER_RADIUS_PROP = 0.3; +const DEFAULT_CIRCULAR_VIEW_PADDING = 0; +const DEFAULT_BACKUP_COLOR = "gray"; +const colorToHex = (colorStr) => { + let c = color(colorStr); + if (!c) { + c = color(DEFAULT_BACKUP_COLOR); + } + const hex = PIXI.utils.rgb2hex([c.rgb().r / 255, c.rgb().g / 255, c.rgb().b / 255]); + return hex; +}; +const RADIAN_GAP = 0; +function valueToRadian(v, max2, sa, ea, g) { + const safeVal = Math.max(Math.min(max2, v), 0); + const gap = g != null ? g : RADIAN_GAP; + const radExtent = (ea - sa) / 360 * Math.PI * 2 - gap * 2; + const radStart = sa / 360 * Math.PI * 2; + return -(radStart + safeVal / max2 * radExtent) - Math.PI / 2 - gap; +} +function cartesianToPolar(x, max2, r, cx, cy, sa, ea) { + return { + x: cx + r * Math.cos(valueToRadian(x, max2, sa, ea)), + y: cy + r * Math.sin(valueToRadian(x, max2, sa, ea)) + }; +} +function positionToRadian(x, y, cx, cy) { + if (cx <= x) { + return Math.atan((y - cy) / (x - cx)); + } else { + return Math.atan((y - cy) / (x - cx)) - Math.PI; + } +} +function pointsToDegree(x, y, cx, cy) { + return (Math.atan2(-(y - cy), x - cx) / Math.PI * 180 + 270) % 360; +} +function drawPoint(track, g, model) { + var _a, _b, _c, _d, _e; + const spec = model.spec(); + if (!spec.width || !spec.height) { + console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); + return; + } + const data2 = model.data(); + const [trackWidth, trackHeight] = track.dimensions; + const zoomLevel = model.getChannelScale("x").invert(trackWidth) - model.getChannelScale("x").invert(0); + const circular = spec.layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const tcx = trackWidth / 2; + const tcy = trackHeight / 2; + const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = trackHeight / rowCategories.length; + rowCategories.forEach((rowCategory) => { + const rowPosition = model.encodedValue("row", rowCategory); + data2.filter( + (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory + ).forEach((d) => { + const cx = model.encodedPIXIProperty("x-center", d); + const cy = model.encodedPIXIProperty("y-center", d); + const color2 = model.encodedPIXIProperty("color", d); + const radius = model.encodedPIXIProperty("p-size", d); + const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); + const stroke = model.encodedPIXIProperty("stroke", d); + const opacity = model.encodedPIXIProperty("opacity", d); + const alphaTransition = model.markVisibility(d, { width: radius, zoomLevel }); + const actualOpacity = Math.min(alphaTransition, opacity); + if (radius <= 0.1 || actualOpacity === 0 || cx + radius < 0 || cx - radius > trackWidth) { + return; + } + g.lineStyle( + strokeWidth, + colorToHex(stroke), + actualOpacity, + // alpha + 1 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + if (circular) { + const r = trackOuterRadius - (rowPosition + rowHeight - cy) / trackHeight * trackRingSize; + const pos = cartesianToPolar(cx, trackWidth, r, tcx, tcy, startAngle, endAngle); + g.beginFill(colorToHex(color2), actualOpacity); + g.drawCircle(pos.x, pos.y, radius); + model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, radius]); + } else { + g.beginFill(colorToHex(color2), actualOpacity); + g.drawCircle(cx, rowPosition + rowHeight - cy, radius); + model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - cy, radius]); + } + }); + }); +} +function pointProperty(model, propertyKey, datum) { + const xe = model.visualPropertyByChannel("xe", datum); + const x = model.visualPropertyByChannel("x", datum); + const size = model.visualPropertyByChannel("size", datum); + switch (propertyKey) { + case "x-center": + return xe ? (xe + x) / 2 : x; + case "y-center": { + const ye = model.visualPropertyByChannel("ye", datum); + const y = model.visualPropertyByChannel("y", datum); + return ye ? (ye + y) / 2 : y; + } + case "p-size": + return xe && model.spec().stretch ? (xe - x) / 2 : size; + default: + return void 0; + } +} +function drawLine(g, model, trackWidth, trackHeight) { + var _a, _b, _c, _d, _e, _f; + const spec = model.spec(); + if (!spec.width || !spec.height) { + console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); + return; + } + const data2 = model.data(); + const circular = spec.layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const trackCenterX = trackWidth / 2; + const trackCenterY = trackHeight / 2; + const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = trackHeight / rowCategories.length; + const colorCategories = (_f = model.getChannelDomainArray("color")) != null ? _f : ["___SINGLE_COLOR___"]; + rowCategories.forEach((rowCategory) => { + const rowPosition = model.encodedValue("row", rowCategory); + colorCategories.forEach((colorCategory) => { + data2.filter( + (d) => (!getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory) && (!getValueUsingChannel(d, spec.color) || getValueUsingChannel(d, spec.color) === colorCategory) + ).sort( + (d1, d2) => ( + // draw from the left to right + getValueUsingChannel(d1, spec.x) - getValueUsingChannel(d2, spec.x) + ) + ).forEach((d, i) => { + const cx = model.encodedPIXIProperty("x", d); + const y = model.encodedPIXIProperty("y", d); + const size = model.encodedPIXIProperty("size", d); + const color2 = model.encodedPIXIProperty("color", d); + const opacity = model.encodedPIXIProperty("opacity", d); + g.lineStyle( + size, + colorToHex(color2), + opacity, + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + if (circular) { + const r = trackOuterRadius - (rowPosition + rowHeight - y) / trackHeight * trackRingSize; + const pos = cartesianToPolar( + cx, + trackWidth, + r, + trackCenterX, + trackCenterY, + startAngle, + endAngle + ); + if (i === 0) { + g.moveTo(pos.x, pos.y); + } else { + g.lineTo(pos.x, pos.y); + } + model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, 1]); + } else { + if (i === 0) { + g.moveTo(cx, rowPosition + rowHeight - y); + } else { + g.lineTo(cx, rowPosition + rowHeight - y); + } + model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - y, 1]); + } + }); + }); + }); +} +function drawBar(track, tile, model) { + var _a, _b, _c, _d, _e, _f, _g; + const spec = model.spec(); + if (!spec.width || !spec.height) { + console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); + return; + } + const data2 = model.data(); + const [trackWidth, trackHeight] = track.dimensions; + const tileSize = track.tilesetInfo.tile_size; + const zoomLevel = model.getChannelScale("x").invert(trackWidth) - model.getChannelScale("x").invert(0); + const circular = spec.layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const cx = trackWidth / 2; + const cy = trackHeight / 2; + const xScale = model.getChannelScale("x"); + let tileUnitWidth; + if (tile.tileData.tilePos) { + const { tileX, tileWidth } = track.getTilePosAndDimensions( + tile.tileData.zoomLevel, + tile.tileData.tilePos, + tileSize + ); + tileUnitWidth = xScale(tileX + tileWidth / tileSize) - xScale(tileX); + } + const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = trackHeight / rowCategories.length; + const clipRow = !IsChannelDeep(spec.row) || IsChannelDeep(spec.row) && typeof spec.row.clip === "undefined" || spec.row.clip; + const baselineValue = IsChannelDeep(spec.y) ? (_f = spec.y) == null ? void 0 : _f.baseline : void 0; + const staticBaseY = (_g = model.encodedValue("y", baselineValue)) != null ? _g : 0; + const g = tile.graphics; + if (IsStackedMark(spec)) { + const genomicChannel = model.getGenomicChannel(); + if (!genomicChannel || !genomicChannel.field) { + console.warn("Genomic field is not provided in the specification"); + return; + } + const pivotedData = group(data2, (d) => d[genomicChannel.field]); + const xKeys = [...pivotedData.keys()]; + xKeys.forEach((k) => { + var _a2; + let prevYEnd = 0; + (_a2 = pivotedData.get(k)) == null ? void 0 : _a2.forEach((d) => { + const color2 = model.encodedPIXIProperty("color", d); + const stroke = model.encodedPIXIProperty("stroke", d); + const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); + const opacity = model.encodedPIXIProperty("opacity", d); + const y = model.encodedPIXIProperty("y", d); + const barWidth = model.encodedPIXIProperty("width", d, { tileUnitWidth }); + const xs = model.encodedPIXIProperty("x-start", d, { markWidth: barWidth }); + const xe = xs + barWidth; + const alphaTransition = model.markVisibility(d, { width: barWidth, zoomLevel }); + const actualOpacity = Math.min(alphaTransition, opacity); + if (actualOpacity === 0 || barWidth <= 0 || y <= 0) { + return; + } + g.lineStyle( + strokeWidth, + colorToHex(stroke), + actualOpacity, + 0 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + let polygonForMouseEvents = []; + if (circular) { + const farR = trackOuterRadius - (rowHeight - prevYEnd) / trackHeight * trackRingSize; + const nearR = trackOuterRadius - (rowHeight - y - prevYEnd) / trackHeight * trackRingSize; + const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle); + const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle); + const endRad = valueToRadian(xs + barWidth, trackWidth, startAngle, endAngle); + g.beginFill(colorToHex(color2), color2 === "none" ? 0 : actualOpacity); + g.moveTo(sPos.x, sPos.y); + g.arc(cx, cy, nearR, startRad, endRad, true); + g.arc(cx, cy, farR, endRad, startRad, false); + polygonForMouseEvents = Array.from(g.currentPath.points); + g.closePath(); + } else { + g.beginFill(colorToHex(color2), color2 === "none" ? 0 : actualOpacity); + g.drawRect(xs, rowHeight - y - prevYEnd, barWidth, y); + const ys = rowHeight - y - prevYEnd; + const ye = ys + y; + polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys]; + } + model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents); + prevYEnd += y; + }); + }); + } else { + rowCategories.forEach((rowCategory) => { + const rowPosition = model.encodedValue("row", rowCategory); + data2.filter((d) => { + const rowValue = getValueUsingChannel(d, spec.row); + return !rowValue || rowValue === rowCategory; + }).forEach((d) => { + const color2 = model.encodedPIXIProperty("color", d); + const stroke = model.encodedPIXIProperty("stroke", d); + const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); + const opacity = model.encodedPIXIProperty("opacity"); + let y = model.encodedPIXIProperty("y", d); + let ye = model.encodedPIXIProperty("ye", d); + if (typeof ye !== "undefined" && y > ye) { + [y, ye] = [ye, y]; + } + const barWidth = model.encodedPIXIProperty("width", d, { tileUnitWidth }); + const xs = model.encodedPIXIProperty("x-start", d, { markWidth: barWidth }); + const xe = xs + barWidth; + let ys; + if (typeof ye === "undefined") { + ys = rowPosition + rowHeight - staticBaseY - y; + ye = rowPosition + rowHeight - staticBaseY; + if (IsChannelDeep(spec.y) && spec.y.flip || spec.flipY) { + ye = ys; + ys = rowPosition; + } + } else { + ys = rowPosition + rowHeight - ye; + ye = rowPosition + rowHeight - y; + } + if (clipRow) { + ys = Math.max(rowPosition, ys); + ys = Math.min(ys, rowPosition + rowHeight); + ye = Math.max(rowPosition, ye); + ye = Math.min(ye, rowPosition + rowHeight); + } + const alphaTransition = model.markVisibility(d, { width: barWidth, zoomLevel }); + const actualOpacity = Math.min(alphaTransition, opacity); + if (actualOpacity === 0 || barWidth === 0 || ye - ys === 0) { + return; + } + g.lineStyle( + strokeWidth, + colorToHex(stroke), + actualOpacity, + 0 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + let polygonForMouseEvents = []; + if (circular) { + const farR = trackOuterRadius - ys / trackHeight * trackRingSize; + const nearR = trackOuterRadius - ye / trackHeight * trackRingSize; + const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle); + const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle); + const endRad = valueToRadian(xs + barWidth, trackWidth, startAngle, endAngle); + g.beginFill(colorToHex(color2), color2 === "none" ? 0 : actualOpacity); + g.moveTo(sPos.x, sPos.y); + g.arc(cx, cy, nearR, startRad, endRad, true); + g.arc(cx, cy, farR, endRad, startRad, false); + polygonForMouseEvents = Array.from(g.currentPath.points); + g.closePath(); + } else { + g.beginFill(colorToHex(color2), color2 === "none" ? 0 : actualOpacity); + g.drawRect(xs, ys, barWidth, ye - ys); + polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys]; + } + model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents); + }); + }); + } +} +function barProperty(gm, propertyKey, datum, additionalInfo) { + const x = gm.visualPropertyByChannel("x", datum); + const xe = gm.visualPropertyByChannel("xe", datum); + const size = gm.visualPropertyByChannel("size", datum); + switch (propertyKey) { + case "width": + return size != null ? size : xe ? xe - x : additionalInfo == null ? void 0 : additionalInfo.tileUnitWidth; + case "x-start": + if (!(additionalInfo == null ? void 0 : additionalInfo.markWidth)) { + return void 0; + } + return xe ? (x + xe - (additionalInfo == null ? void 0 : additionalInfo.markWidth)) / 2 : x - (additionalInfo == null ? void 0 : additionalInfo.markWidth) / 2; + default: + return void 0; + } +} +function drawArea(HGC, track, tile, model) { + var _a, _b, _c, _d, _e, _f; + const spec = model.spec(); + const data2 = model.data(); + const [trackWidth, trackHeight] = track.dimensions; + const circular = spec.layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const trackCenterX = trackWidth / 2; + const trackCenterY = trackHeight / 2; + const xScale = track._xScale; + const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = trackHeight / rowCategories.length; + const colorCategories = (_f = model.getChannelDomainArray("color")) != null ? _f : ["___SINGLE_COLOR___"]; + const constantOpacity = model.encodedPIXIProperty("opacity"); + const constantStrokeWidth = model.encodedPIXIProperty("strokeWidth"); + const constantStroke = model.encodedPIXIProperty("stroke"); + const graphics = tile.graphics; + if (IsStackedMark(spec)) { + const genomicChannel = model.getGenomicChannel(); + if (!genomicChannel || !genomicChannel.field) { + console.warn("Genomic field is not provided in the specification"); + return; + } + const pivotedData = group(data2, (d) => d[genomicChannel.field]); + const genomicPosCategories = [...pivotedData.keys()]; + graphics.lineStyle( + constantStrokeWidth, + colorToHex(constantStroke), + constantOpacity, + 1 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + const prevYEndByGPos = {}; + colorCategories.forEach((colorCategory) => { + const areaPointsTop = []; + const areaPointsBottom = []; + genomicPosCategories.forEach((genomicPosCategory, i, array) => { + var _a2, _b2; + (_b2 = (_a2 = pivotedData.get(genomicPosCategory)) == null ? void 0 : _a2.filter((d) => getValueUsingChannel(d, spec.color) === colorCategory)) == null ? void 0 : _b2.forEach((d) => { + const xValue = +genomicPosCategory; + const cx = xScale(xValue); + const cy = max([model.encodedPIXIProperty("y", d), 0]); + if (typeof prevYEndByGPos[genomicPosCategory] === "undefined") { + prevYEndByGPos[genomicPosCategory] = 0; + } + const ys = rowHeight - cy - prevYEndByGPos[genomicPosCategory]; + const ye = rowHeight - prevYEndByGPos[genomicPosCategory]; + if (circular) { + if (i === 0) { + const r = trackOuterRadius - rowHeight / trackHeight * trackRingSize; + const pos = cartesianToPolar( + cx, + trackWidth, + r, + trackCenterX, + trackCenterY, + startAngle, + endAngle + ); + areaPointsTop.push([pos.x, pos.y]); + areaPointsBottom.push([pos.x, pos.y]); + } + const rTop = trackOuterRadius - ys / trackHeight * trackRingSize; + const posTop = cartesianToPolar( + cx, + trackWidth, + rTop, + trackCenterX, + trackCenterY, + startAngle, + endAngle + ); + areaPointsTop.push([posTop.x, posTop.y]); + const rBot = trackOuterRadius - ye / trackHeight * trackRingSize; + const posBot = cartesianToPolar( + cx, + trackWidth, + rBot, + trackCenterX, + trackCenterY, + startAngle, + endAngle + ); + areaPointsBottom.push([posBot.x, posBot.y]); + if (i === array.length - 1) { + const r = trackOuterRadius - rowHeight / trackHeight * trackRingSize; + const pos = cartesianToPolar( + cx, + trackWidth, + r, + trackCenterX, + trackCenterY, + startAngle, + endAngle + ); + areaPointsTop.push([pos.x, pos.y]); + areaPointsBottom.push([pos.x, pos.y]); + } + model.getMouseEventModel().addPointBasedEvent(d, [posBot.x, posBot.y, 1]); + } else { + if (i === 0) { + areaPointsTop.push([cx, rowHeight]); + areaPointsBottom.push([cx, rowHeight]); + } + areaPointsTop.push([cx, ys]); + areaPointsBottom.push([cx, ye]); + if (i === array.length - 1) { + areaPointsTop.push([cx, rowHeight]); + areaPointsBottom.push([cx, rowHeight]); + } + model.getMouseEventModel().addPointBasedEvent(d, [cx, ys, 1]); + } + prevYEndByGPos[genomicPosCategory] += cy; + }); + }); + const color2 = model.encodedValue("color", colorCategory); + graphics.beginFill(colorToHex(color2), constantOpacity); + graphics.drawPolygon([ + ...areaPointsTop.reduce((a, b) => a.concat(b)), + ...areaPointsBottom.reverse().reduce((a, b) => a.concat(b)) + ]); + graphics.endFill(); + }); + } else { + rowCategories.forEach((rowCategory) => { + const rowPosition = model.encodedValue("row", rowCategory); + graphics.lineStyle( + constantStrokeWidth, + colorToHex(constantStroke), + constantOpacity, + 0 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + colorCategories.forEach((colorCategory) => { + const baselinePoints = []; + const areaPoints = []; + const baselineR = trackOuterRadius - (rowPosition + rowHeight) / trackHeight * trackRingSize; + let startX = 0; + data2.filter( + (d) => (typeof getValueUsingChannel(d, spec.row) === "undefined" || getValueUsingChannel(d, spec.row) === rowCategory) && (typeof getValueUsingChannel(d, spec.color) === "undefined" || getValueUsingChannel(d, spec.color) === colorCategory) + ).sort( + // should sort properly before visualizing it so that the path is correctly drawn + (a, b) => model.encodedPIXIProperty("x", a) - model.encodedPIXIProperty("x", b) + ).forEach((d, i, array) => { + const cy = min([max([model.encodedPIXIProperty("y", d), 0]), rowHeight]); + const cx = model.encodedPIXIProperty("x", d); + if (circular) { + const baselinePos = cartesianToPolar( + cx, + trackWidth, + baselineR, + trackCenterX, + trackCenterY, + startAngle, + endAngle + ); + baselinePoints.push([baselinePos.x, baselinePos.y]); + if (i === 0) { + areaPoints.push(baselinePos.x, baselinePos.y); + } + const r = trackOuterRadius - (rowPosition + rowHeight - cy) / trackHeight * trackRingSize; + const pos = cartesianToPolar( + cx, + trackWidth, + r, + trackCenterX, + trackCenterY, + startAngle, + endAngle + ); + areaPoints.push(pos.x, pos.y); + if (i === array.length - 1) { + const startR = trackOuterRadius - (rowPosition + rowHeight) / trackHeight * trackRingSize; + const curPos = cartesianToPolar( + cx, + trackWidth, + startR, + trackCenterX, + trackCenterY, + startAngle, + endAngle + ); + areaPoints.push(curPos.x, curPos.y); + } + model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, 1]); + } else { + if (i === 0) { + areaPoints.push(cx, rowPosition + rowHeight); + startX = cx; + } + areaPoints.push(cx, rowPosition + rowHeight - cy); + if (i === array.length - 1) { + areaPoints.push(cx, rowPosition + rowHeight); + areaPoints.push(startX, rowPosition + rowHeight); + } + model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - cy, 1]); + } + }); + if (circular && baselinePoints.length !== 0) { + areaPoints.push(...baselinePoints.reverse().reduce((a, b) => a.concat(b))); + } + const color2 = model.encodedValue("color", colorCategory); + graphics.beginFill(colorToHex(color2), constantOpacity); + graphics.drawPolygon(areaPoints); + graphics.endFill(); + }); + }); + } +} +function drawRect(HGC, track, tile, model) { + var _a, _b, _c, _d, _e, _f; + const spec = model.spec(); + const data2 = model.data(); + const [trackWidth, trackHeight] = track.dimensions; + const circular = spec.layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const cx = trackWidth / 2; + const cy = trackHeight / 2; + const xScale = track._xScale; + let tileUnitWidth; + if (tile.tileData.tilePos) { + const tileSize = track.tilesetInfo.tile_size; + const { tileX, tileWidth } = track.getTilePosAndDimensions( + tile.tileData.zoomLevel, + tile.tileData.tilePos, + // TODO: required parameter. Typing out `track` should address this issue. + tileSize + ); + tileUnitWidth = xScale(tileX + tileWidth / tileSize) - xScale(tileX); + } + const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = trackHeight / rowCategories.length; + const RPAD = IsChannelDeep(spec.row) && spec.row.padding ? spec.row.padding : 0; + const yCategories = (_f = model.getChannelDomainArray("y")) != null ? _f : ["___SINGLE_Y_POSITION___"]; + const cellHeight = rowHeight / yCategories.length - RPAD * 2; + const g = tile.graphics; + data2.forEach((d) => { + var _a2; + const rowPosition = model.encodedPIXIProperty("row", d) + RPAD; + const x = model.encodedPIXIProperty("x", d); + const color2 = model.encodedPIXIProperty("color", d); + const stroke = model.encodedPIXIProperty("stroke", d); + const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); + const opacity = model.encodedPIXIProperty("opacity", d); + const rectWidth = model.encodedPIXIProperty("width", d, { markWidth: tileUnitWidth }); + const rectHeight = model.encodedPIXIProperty("height", d, { markHeight: cellHeight }); + const y = model.encodedPIXIProperty("y", d); + const alphaTransition = model.markVisibility(d, { + width: rectWidth, + zoomLevel: track._xScale.invert(trackWidth) - track._xScale.invert(0) + }); + const actualOpacity = Math.min(alphaTransition, opacity); + if (actualOpacity === 0 || rectHeight === 0 || rectWidth <= 1e-4) { + return; + } + const [xs, xe, ys, ye] = [ + x, + x + rectWidth, + rowPosition + rowHeight - y - rectHeight / 2, + rowPosition + rowHeight - y + rectHeight / 2 + ]; + const absoluteHeight = (_a2 = model.visualPropertyByChannel("size", d)) != null ? _a2 : void 0; + g.lineStyle( + strokeWidth, + colorToHex(stroke), + actualOpacity, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + let polygonForMouseEvent = []; + if (circular) { + if (xe < 0 || trackWidth < xs) { + return; + } + let farR = trackOuterRadius - ys / trackHeight * trackRingSize; + let nearR = trackOuterRadius - ye / trackHeight * trackRingSize; + if (absoluteHeight) { + const midR = trackOuterRadius - (rowPosition + y) / trackHeight * trackRingSize; + farR = midR - absoluteHeight / 2; + nearR = midR + absoluteHeight / 2; + } + const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle); + const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle); + const endRad = valueToRadian(xe, trackWidth, startAngle, endAngle); + g.beginFill(colorToHex(color2 === "none" ? "white" : color2), color2 === "none" ? 0 : actualOpacity); + g.moveTo(sPos.x, sPos.y); + g.arc(cx, cy, nearR, startRad, endRad, true); + g.arc(cx, cy, farR, endRad, startRad, false); + polygonForMouseEvent = Array.from(g.currentPath.points); + g.closePath(); + } else { + g.beginFill(colorToHex(color2 === "none" ? "white" : color2), color2 === "none" ? 0 : actualOpacity); + g.drawRect(xs, ys, xe - xs, ye - ys); + polygonForMouseEvent = [xs, ys, xs, ye, xe, ye, xe, ys]; + } + model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvent); + }); +} +function rectProperty(gm, propertyKey, datum, additionalInfo) { + var _a; + switch (propertyKey) { + case "width": + const width = ( + // (1) size + gm.visualPropertyByChannel("xe", datum) ? gm.visualPropertyByChannel("xe", datum) - gm.visualPropertyByChannel("x", datum) : ( + // (2) unit mark height + additionalInfo == null ? void 0 : additionalInfo.markWidth + ) + ); + return width === 0 ? 0.1 : width; + case "height": + return ( + // (1) size + (_a = gm.visualPropertyByChannel("size", datum)) != null ? _a : ( + // (2) unit mark height + additionalInfo == null ? void 0 : additionalInfo.markHeight + ) + ); + default: + return void 0; + } +} +function drawTriangle(g, model, trackWidth, trackHeight) { + var _a, _b, _c, _d, _e, _f, _g; + const spec = model.spec(); + if (!spec.width || !spec.height) { + console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); + return; + } + const data2 = model.data(); + const zoomLevel = model.getChannelScale("x").invert(trackWidth) - model.getChannelScale("x").invert(0); + const circular = spec.layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const cx = trackWidth / 2; + const cy = trackHeight / 2; + const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = trackHeight / rowCategories.length; + const yCategories = (_f = model.getChannelDomainArray("y")) != null ? _f : ["___SINGLE_Y___"]; + const triHeight = (_g = model.encodedValue("size")) != null ? _g : circular ? trackRingSize / rowCategories.length / yCategories.length : rowHeight / yCategories.length; + rowCategories.forEach((rowCategory) => { + const rowPosition = model.encodedValue("row", rowCategory); + data2.filter( + (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory + ).forEach((d) => { + var _a2, _b2, _c2; + const x = model.encodedPIXIProperty("x", d); + const xe = model.encodedPIXIProperty("xe", d); + const markWidth = (_a2 = model.encodedPIXIProperty("size", d)) != null ? _a2 : xe === void 0 ? triHeight : xe - x; + const y = model.encodedPIXIProperty("y", d); + const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); + const stroke = model.encodedPIXIProperty("stroke", d); + const color2 = model.encodedPIXIProperty("color", d); + const opacity = model.encodedPIXIProperty("opacity", d); + let polygon = []; + if (circular) { + let x0 = x ? x : xe - markWidth; + let x1 = xe ? xe : x + markWidth; + let xm = (x0 + x1) / 2; + const rm = trackOuterRadius - (rowPosition + rowHeight - y) / trackHeight * trackRingSize; + const r0 = rm - triHeight / 2; + const r1 = rm + triHeight / 2; + if (((_b2 = spec.style) == null ? void 0 : _b2.align) === "right" && !xe) { + x0 -= markWidth; + x1 -= markWidth; + xm -= markWidth; + } + if (spec.mark === "triangleLeft") { + const p0 = cartesianToPolar(x1, trackWidth, r0, cx, cy, startAngle, endAngle); + const p1 = cartesianToPolar(x0, trackWidth, rm, cx, cy, startAngle, endAngle); + const p2 = cartesianToPolar(x1, trackWidth, r1, cx, cy, startAngle, endAngle); + const p3 = cartesianToPolar(x1, trackWidth, r0, cx, cy, startAngle, endAngle); + polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y]; + } else if (spec.mark === "triangleRight") { + const p0 = cartesianToPolar(x0, trackWidth, r0, cx, cy, startAngle, endAngle); + const p1 = cartesianToPolar(x1, trackWidth, rm, cx, cy, startAngle, endAngle); + const p2 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle); + const p3 = cartesianToPolar(x0, trackWidth, r0, cx, cy, startAngle, endAngle); + polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y]; + } else if (spec.mark === "triangleBottom") { + x0 = xm - markWidth / 2; + x1 = xm + markWidth / 2; + const p0 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle); + const p1 = cartesianToPolar(x1, trackWidth, r1, cx, cy, startAngle, endAngle); + const p2 = cartesianToPolar(xm, trackWidth, r0, cx, cy, startAngle, endAngle); + const p3 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle); + polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y]; + } + const alphaTransition = model.markVisibility(d, { width: x1 - x0, zoomLevel }); + const actualOpacity = Math.min(alphaTransition, opacity); + g.lineStyle( + strokeWidth, + colorToHex(stroke), + // too narrow triangle's stroke is becoming too sharp + x1 - x0 > 2 ? actualOpacity : 0, + // alpha + 0 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + g.beginFill(colorToHex(color2), actualOpacity); + g.drawPolygon(polygon); + g.endFill(); + } else { + let x0 = x ? x : xe - markWidth; + let x1 = xe ? xe : x + markWidth; + let xm = x0 + (x1 - x0) / 2; + const ym = rowPosition + rowHeight - y; + const y0 = rowPosition + rowHeight - y - triHeight / 2; + const y1 = rowPosition + rowHeight - y + triHeight / 2; + if (((_c2 = spec.style) == null ? void 0 : _c2.align) === "right" && !xe) { + x0 -= markWidth; + x1 -= markWidth; + xm -= markWidth; + } + polygon = { + triangleLeft: [x1, y0, x0, ym, x1, y1, x1, y0], + triangleRight: [x0, y0, x1, ym, x0, y1, x0, y0], + triangleBottom: [x0, y0, x1, y0, xm, y1, x0, y0] + }[spec.mark]; + const alphaTransition = model.markVisibility(d, { width: x1 - x0, zoomLevel }); + const actualOpacity = Math.min(alphaTransition, opacity); + g.lineStyle( + strokeWidth, + colorToHex(stroke), + // too narrow triangle's stroke is becoming too sharp + x1 - x0 > 2 ? actualOpacity : 0, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + g.beginFill(colorToHex(color2), actualOpacity); + g.drawPolygon(polygon); + g.endFill(); + } + model.getMouseEventModel().addPolygonBasedEvent(d, polygon); + }); + }); +} +const TEXT_STYLE_GLOBAL = { + fontSize: "12px", + fontFamily: "sans-serif", + // 'Arial', + fontWeight: "normal", + fill: "black", + background: "white", + lineJoin: "round", + stroke: "#ffffff", + strokeThickness: 0 +}; +function drawText(HGC, trackInfo, tile, model) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j; + const spec = model.spec(); + const data2 = model.data(); + const [trackWidth, trackHeight] = trackInfo.dimensions; + const circular = spec.layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const tcx = trackWidth / 2; + const tcy = trackHeight / 2; + const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = trackHeight / rowCategories.length; + const dx = (_g = (_f = spec.style) == null ? void 0 : _f.dx) != null ? _g : 0; + const dy = (_i = (_h = spec.style) == null ? void 0 : _h.dy) != null ? _i : 0; + const textAnchor = !((_j = spec.style) == null ? void 0 : _j.textAnchor) ? "middle" : spec.style.textAnchor; + if (IsStackedMark(spec)) { + if (circular) { + return; + } + const rowGraphics = tile.graphics; + const genomicChannel = model.getGenomicChannel(); + if (!genomicChannel || !genomicChannel.field) { + console.warn("Genomic field is not provided in the specification"); + return; + } + const pivotedData = group(data2, (d) => d[genomicChannel.field]); + const xKeys = [...pivotedData.keys()]; + xKeys.forEach((k) => { + var _a2; + let prevYEnd = 0; + (_a2 = pivotedData.get(k)) == null ? void 0 : _a2.forEach((d) => { + var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2; + const text = model.encodedPIXIProperty("text", d); + const color2 = model.encodedPIXIProperty("color", d); + const x = model.encodedPIXIProperty("x", d) + dx; + const xe = model.encodedPIXIProperty("xe", d) + dx; + const cx = model.encodedPIXIProperty("x-center", d) + dx; + const y = model.encodedPIXIProperty("y", d) + dy; + const size = model.encodedPIXIProperty("size", d); + const stroke = model.encodedPIXIProperty("stroke", d); + const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); + const opacity = model.encodedPIXIProperty("opacity", d); + if (cx < 0 || cx > trackWidth) { + return; + } + if (trackInfo.textsBeingUsed > 1e3) { + return; + } + const localTextStyle = { + ...TEXT_STYLE_GLOBAL, + fontSize: size != null ? size : ((_a3 = spec.style) == null ? void 0 : _a3.textFontSize) ? `${(_b2 = spec.style) == null ? void 0 : _b2.textFontSize}px` : TEXT_STYLE_GLOBAL.fontSize, + stroke: (_d2 = stroke != null ? stroke : (_c2 = spec.style) == null ? void 0 : _c2.textStroke) != null ? _d2 : TEXT_STYLE_GLOBAL.stroke, + strokeThickness: (_f2 = strokeWidth != null ? strokeWidth : (_e2 = spec.style) == null ? void 0 : _e2.textStrokeWidth) != null ? _f2 : TEXT_STYLE_GLOBAL.strokeThickness, + fontWeight: (_h2 = (_g2 = spec.style) == null ? void 0 : _g2.textFontWeight) != null ? _h2 : TEXT_STYLE_GLOBAL.fontWeight + }; + const textStyleObj = new HGC.libraries.PIXI.TextStyle(localTextStyle); + let textGraphic; + if (trackInfo.textGraphics.length > trackInfo.textsBeingUsed) { + textGraphic = trackInfo.textGraphics[trackInfo.textsBeingUsed]; + textGraphic.style.fill = color2; + textGraphic.visible = true; + textGraphic.text = text; + textGraphic.alpha = 1; + } else { + textGraphic = new HGC.libraries.PIXI.Text(text, { + ...localTextStyle, + fill: color2 + }); + trackInfo.textGraphics.push(textGraphic); + } + const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, textStyleObj); + trackInfo.textsBeingUsed++; + const alphaTransition = model.markVisibility(d, { + ...metric, + zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0) + }); + const actualOpacity = Math.min(alphaTransition, opacity); + if (!text || actualOpacity === 0) { + trackInfo.textsBeingUsed--; + textGraphic.visible = false; + return; + } + textGraphic.alpha = actualOpacity; + textGraphic.resolution = 8; + textGraphic.updateText(); + textGraphic.texture.baseTexture.scaleMode = HGC.libraries.PIXI.SCALE_MODES.LINEAR; + const sprite = new HGC.libraries.PIXI.Sprite(textGraphic.texture); + sprite.x = x; + sprite.y = rowHeight - y - prevYEnd; + sprite.width = xe - x; + sprite.height = y; + rowGraphics.addChild(sprite); + prevYEnd += y; + }); + }); + } else { + rowCategories.forEach((rowCategory) => { + const rowGraphics = tile.graphics; + const rowPosition = model.encodedValue("row", rowCategory); + data2.filter( + (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory + ).forEach((d) => { + var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2; + const text = model.encodedPIXIProperty("text", d); + const color2 = model.encodedPIXIProperty("color", d); + const cx = model.encodedPIXIProperty("x-center", d) + dx; + const y = model.encodedPIXIProperty("y", d) + dy; + const size = model.encodedPIXIProperty("size", d); + const stroke = model.encodedPIXIProperty("stroke", d); + const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); + const opacity = model.encodedPIXIProperty("opacity", d); + if (cx < 0 || cx > trackWidth) { + return; + } + if (trackInfo.textsBeingUsed > 1e3) { + return; + } + const localTextStyle = { + ...TEXT_STYLE_GLOBAL, + fontSize: size != null ? size : ((_a2 = spec.style) == null ? void 0 : _a2.textFontSize) ? `${(_b2 = spec.style) == null ? void 0 : _b2.textFontSize}px` : TEXT_STYLE_GLOBAL.fontSize, + stroke: (_d2 = stroke != null ? stroke : (_c2 = spec.style) == null ? void 0 : _c2.textStroke) != null ? _d2 : TEXT_STYLE_GLOBAL.stroke, + strokeThickness: (_f2 = strokeWidth != null ? strokeWidth : (_e2 = spec.style) == null ? void 0 : _e2.textStrokeWidth) != null ? _f2 : TEXT_STYLE_GLOBAL.strokeThickness, + fontWeight: (_h2 = (_g2 = spec.style) == null ? void 0 : _g2.textFontWeight) != null ? _h2 : TEXT_STYLE_GLOBAL.fontWeight + }; + const textStyleObj = new HGC.libraries.PIXI.TextStyle(localTextStyle); + let textGraphic; + if (trackInfo.textGraphics.length > trackInfo.textsBeingUsed) { + textGraphic = trackInfo.textGraphics[trackInfo.textsBeingUsed]; + textGraphic.style.fill = color2; + textGraphic.visible = true; + textGraphic.text = text; + textGraphic.alpha = 1; + } else { + textGraphic = new HGC.libraries.PIXI.Text(text, { + ...localTextStyle, + fill: color2 + }); + trackInfo.textGraphics.push(textGraphic); + } + const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, textStyleObj); + trackInfo.textsBeingUsed++; + const alphaTransition = model.markVisibility(d, { + ...metric, + zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0) + }); + const actualOpacity = Math.min(alphaTransition, opacity); + if (!text || actualOpacity === 0) { + trackInfo.textsBeingUsed--; + textGraphic.visible = false; + return; + } + textGraphic.alpha = actualOpacity; + textGraphic.anchor.y = 0.5; + textGraphic.anchor.x = textAnchor === "middle" ? 0.5 : textAnchor === "start" ? 0 : 1; + let polygonForMouseEvents = []; + if (circular) { + const r = trackOuterRadius - (rowPosition + rowHeight - y) / trackHeight * trackRingSize; + const centerPos = cartesianToPolar(cx, trackWidth, r, tcx, tcy, startAngle, endAngle); + textGraphic.x = centerPos.x; + textGraphic.y = centerPos.y; + textGraphic.resolution = 4; + const tw = metric.width / (2 * r * Math.PI) * trackWidth; + let [minX, maxX] = [cx - tw / 2, cx + tw / 2]; + if (minX < 0) { + const gap = -minX; + minX = 0; + maxX += gap; + } else if (maxX > trackWidth) { + const gap = maxX - trackWidth; + maxX = trackWidth; + minX -= gap; + } + const ropePoints = []; + const eventPointsFar = []; + const eventPointsNear = []; + for (let i = maxX; i >= minX; i -= tw / 10) { + const p = cartesianToPolar(i, trackWidth, r, tcx, tcy, startAngle, endAngle); + ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y)); + const pFar = cartesianToPolar( + i, + trackWidth, + r + metric.height / 2, + tcx, + tcy, + startAngle, + endAngle + ); + const pNear = cartesianToPolar( + i, + trackWidth, + r - metric.height / 2, + tcx, + tcy, + startAngle, + endAngle + ); + eventPointsFar.push(pFar.x, pFar.y); + if (i === maxX) { + eventPointsNear.push(pFar.y, pFar.x); + } + eventPointsNear.push(pNear.y, pNear.x); + } + textGraphic.updateText(); + const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints); + rope.alpha = actualOpacity; + rowGraphics.addChild(rope); + eventPointsNear.reverse(); + polygonForMouseEvents = eventPointsFar.concat(eventPointsNear); + } else { + textGraphic.position.x = cx; + textGraphic.position.y = rowPosition + rowHeight - y; + rowGraphics.addChild(textGraphic); + const { height: h, width: w } = metric; + const ys = textGraphic.position.y - h / 2; + const ye = ys + h; + let xs = 0; + let xe = 0; + if (textAnchor === "start") { + xs = cx; + xe = cx + w; + } else if (textAnchor === "middle") { + xs = cx - w / 2; + xe = cx + w / 2; + } else { + xs = cx - w; + xe = cx; + } + polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys]; + } + model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents); + }); + }); + } +} +function drawRule(HGC, trackInfo, tile, model) { + var _a, _b, _c, _d, _e, _f, _g, _h; + const spec = model.spec(); + const data2 = model.data(); + const [trackWidth, trackHeight] = trackInfo.dimensions; + const circular = spec.layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const cx = trackWidth / 2; + const cy = trackHeight / 2; + const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = trackHeight / rowCategories.length; + const dashed = (_f = spec.style) == null ? void 0 : _f.dashed; + const linePattern = (_g = spec.style) == null ? void 0 : _g.linePattern; + const curved = (_h = spec.style) == null ? void 0 : _h.curve; + const g = tile.graphics; + rowCategories.forEach((rowCategory) => { + const rowPosition = model.encodedValue("row", rowCategory); + data2.filter( + (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory + ).forEach((d) => { + const x = model.encodedPIXIProperty("x", d); + const xe = model.encodedPIXIProperty("xe", d); + const y = model.encodedPIXIProperty("y", d); + const color2 = model.encodedPIXIProperty("color", d); + const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); + const opacity = model.encodedPIXIProperty("opacity", d); + const alphaTransition = model.markVisibility(d, { + width: xe - x, + zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0) + }); + const actualOpacity = Math.min(alphaTransition, opacity); + g.lineStyle( + strokeWidth, + colorToHex(color2), + actualOpacity, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + if (!xe && (!spec.y || !("field" in spec.y))) { + if (circular) { + return; + } else { + if (dashed) { + const [dashSize, gapSize] = dashed; + let curPos = 0; + do { + g.moveTo(x, curPos); + g.lineTo(x, curPos + dashSize); + curPos += dashSize + gapSize; + } while (curPos < trackHeight); + } else { + g.moveTo(x, 0); + g.lineTo(x, trackHeight); + } + } + } else if (!xe && y) { + if (circular) { + g.lineStyle( + strokeWidth, + colorToHex(color2), + 0, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + const midR = trackOuterRadius - (rowPosition + y) / trackHeight * trackRingSize; + const farR = midR + strokeWidth / 2; + const nearR = midR - strokeWidth / 2; + const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle); + const startRad = valueToRadian(0, trackWidth, startAngle, endAngle); + const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle); + g.beginFill(colorToHex(color2), actualOpacity); + g.moveTo(sPos.x, sPos.y); + g.arc(cx, cy, nearR, startRad, endRad, true); + g.arc(cx, cy, farR, endRad, startRad, false); + g.closePath(); + } else { + if (dashed) { + const [dashSize, gapSize] = dashed; + let curPos = 0; + do { + g.moveTo(curPos, rowPosition + rowHeight - y); + g.lineTo(curPos + dashSize, rowPosition + rowHeight - y); + curPos += dashSize + gapSize; + } while (curPos < trackWidth); + } else { + g.moveTo(0, rowPosition + rowHeight - y); + g.lineTo(trackWidth, rowPosition + rowHeight - y); + } + } + } else { + if (circular) { + if (strokeWidth === 0) { + return; + } + g.lineStyle( + strokeWidth, + colorToHex(color2), + 0, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + const midR = trackOuterRadius - (rowPosition + rowHeight - y) / trackHeight * trackRingSize; + const farR = midR + strokeWidth / 2; + const nearR = midR - strokeWidth / 2; + const sPos = cartesianToPolar(x, trackWidth, nearR, cx, cy, startAngle, endAngle); + const startRad = valueToRadian(x, trackWidth, startAngle, endAngle); + const endRad = valueToRadian(xe, trackWidth, startAngle, endAngle); + g.beginFill(colorToHex(color2), actualOpacity); + g.moveTo(sPos.x, sPos.y); + g.arc(cx, cy, nearR, startRad, endRad, true); + g.arc(cx, cy, farR, endRad, startRad, false); + g.closePath(); + } else if (dashed) { + const [dashSize, gapSize] = dashed; + let curPos = x; + do { + g.moveTo(curPos, rowPosition + rowHeight - y); + g.lineTo(curPos + dashSize, rowPosition + rowHeight - y); + curPos += dashSize + gapSize; + } while (curPos < xe); + } else { + if (curved === void 0) { + g.moveTo(x, rowPosition + rowHeight - y); + g.lineTo(xe, rowPosition + rowHeight - y); + } else if (curved === "top") { + const CURVE_HEIGHT = 2; + const xm = x + (xe - x) / 2; + g.moveTo(x, rowPosition + rowHeight - y + CURVE_HEIGHT / 2); + g.lineTo(xm, rowPosition + rowHeight - y - CURVE_HEIGHT / 2); + g.moveTo(xm, rowPosition + rowHeight - y - CURVE_HEIGHT / 2); + g.lineTo(xe, rowPosition + rowHeight - y + CURVE_HEIGHT / 2); + } + } + if (linePattern && curved === void 0 && !circular) { + const { type: pType, size: pSize } = linePattern; + let curPos = Math.max(x, 0); + g.lineStyle(0); + const PATTERN_GAP_SIZE = pSize * 2; + let count = 0; + while (curPos < Math.min(xe, trackWidth) && count < 100) { + const x0 = curPos; + const x1 = curPos + pSize; + const ym = rowPosition + rowHeight - y; + const y0 = ym - pSize / 2; + const y1 = ym + pSize / 2; + g.beginFill(colorToHex(color2), actualOpacity); + g.drawPolygon( + pType === "triangleLeft" ? [x1, y0, x0, ym, x1, y1, x1, y0] : [x0, y0, x1, ym, x0, y1, x0, y0] + ); + g.endFill(); + curPos += pSize + PATTERN_GAP_SIZE; + count++; + } + } + } + }); + }); +} +function drawWithinLink(g, trackInfo, model) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j; + const spec = model.spec(); + if (!spec.width || !spec.height) { + console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); + return; + } + const data2 = model.data(); + const [trackWidth, trackHeight] = trackInfo.dimensions; + const circular = spec.layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const tcx = trackWidth / 2; + const tcy = trackHeight / 2; + const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = trackHeight / rowCategories.length; + const MIN_HEIGHT = (_g = (_f = spec.style) == null ? void 0 : _f.linkMinHeight) != null ? _g : 0.5; + const NUM_STEPS = ((_h = spec.experimental) == null ? void 0 : _h.performanceMode) ? 10 : 50; + const showVerticalLines = (_j = (_i = spec.style) == null ? void 0 : _i.withinLinkVerticalLines) != null ? _j : false; + rowCategories.forEach((rowCategory) => { + const rowPosition = model.encodedValue("row", rowCategory); + data2.filter( + (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory + ).forEach((d) => { + var _a2, _b2, _c2, _d2, _e2; + let x = model.encodedPIXIProperty("x", d); + let xe = model.encodedPIXIProperty("xe", d); + let x1 = model.encodedPIXIProperty("x1", d); + let x1e = model.encodedPIXIProperty("x1e", d); + const y = model.encodedPIXIProperty("y", d); + const ye = model.encodedPIXIProperty("ye", d); + const stroke = model.encodedPIXIProperty("stroke", d); + const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); + const color2 = model.encodedPIXIProperty("color", d); + const opacity = model.encodedPIXIProperty("opacity", d); + if (typeof xe !== "undefined") { + [x, xe] = [x, xe].sort((a, b) => a - b); + } + if (typeof x1 !== "undefined" && typeof x1e !== "undefined") { + [x1, x1e] = [x1, x1e].sort((a, b) => a - b); + } + const isRibbon = typeof xe !== "undefined" && typeof x1 !== "undefined" && typeof x1e !== "undefined" && // This means the strokeWidth of a band is too small, so we just need to draw a line instead + Math.abs(x - xe) > 0.1 && Math.abs(x1 - x1e) > 0.1; + if (!isRibbon && xe === void 0 && !Is2DTrack(spec)) { + if (x1 === void 0 && x1e === void 0) { + return; + } + xe = x1 !== void 0 ? x1 : x1e; + } + if (!isRibbon && Math.abs(x - xe) <= 0.1 && Math.abs(x1 - x1e) <= 0.1) { + x = (x + xe) / 2; + xe = (x1 + x1e) / 2; + } + g.lineStyle( + strokeWidth, + colorToHex(stroke), + opacity, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + const flipY = IsChannelDeep(spec.y) && spec.y.flip || spec.flipY; + const baseY = (_a2 = spec.baselineY) != null ? _a2 : rowPosition + (flipY ? 0 : rowHeight); + let pathForMouseEvent = []; + if (isRibbon) { + g.beginFill(color2 === "none" ? colorToHex("white") : colorToHex(color2), color2 === "none" ? 0 : opacity); + let [_x1, _x2, _x3, _x4] = [x, xe, x1, x1e]; + [_x1, _x2, _x3, _x4] = [_x1, _x2, _x3, _x4].sort((a, b) => a - b); + if (_x1 > trackWidth || _x4 < 0 || Math.abs(_x4 - _x1) < 0.5) { + return; + } + if (circular) { + if (_x1 < 0 || _x4 > trackWidth) { + return; + } + const r = trackOuterRadius - rowPosition / trackHeight * trackRingSize; + const posX = cartesianToPolar(_x1, trackWidth, r, tcx, tcy, startAngle, endAngle); + const posXE = cartesianToPolar(_x2, trackWidth, r, tcx, tcy, startAngle, endAngle); + const posX1 = cartesianToPolar(_x3, trackWidth, r, tcx, tcy, startAngle, endAngle); + const posX1E = cartesianToPolar(_x4, trackWidth, r, tcx, tcy, startAngle, endAngle); + g.moveTo(posX.x, posX.y); + g.bezierCurveTo(tcx, tcy, tcx, tcy, posX1E.x, posX1E.y); + g.arc( + tcx, + tcy, + trackOuterRadius, + positionToRadian(posX1E.x, posX1E.y, tcx, tcy), + positionToRadian(posX1.x, posX1.y, tcx, tcy), + false + ); + g.bezierCurveTo(tcx, tcy, tcx, tcy, posXE.x, posXE.y); + g.arc( + tcx, + tcy, + trackOuterRadius, + positionToRadian(posXE.x, posXE.y, tcx, tcy), + positionToRadian(posX.x, posX.y, tcx, tcy), + false + ); + pathForMouseEvent = Array.from(g.currentPath.points); + g.endFill(); + } else { + g.moveTo(_x1, baseY); + if (!((_b2 = spec.style) == null ? void 0 : _b2.linkStyle) || ((_c2 = spec.style) == null ? void 0 : _c2.linkStyle) === "circular") { + g.arc( + (_x1 + _x4) / 2, + // cx + baseY, + // cy + (_x4 - _x1) / 2, + // radius + -Math.PI, + // start angle + Math.PI, + // end angle + false + ); + g.arc((_x2 + _x3) / 2, baseY, (_x3 - _x2) / 2, Math.PI, -Math.PI, true); + pathForMouseEvent = Array.from(g.currentPath.points); + g.closePath(); + } else { + g.lineTo(_x3, rowPosition + rowHeight); + g.bezierCurveTo( + _x3 + (_x2 - _x3) / 3, + // rowPosition + (x1 - x), + rowPosition + rowHeight - (_x2 - _x3) / 2, + //Math.min(rowHeight - (x1 - x), (xe - x1) / 2.0), + _x3 + (_x2 - _x3) / 3 * 2, + // rowPosition + (x1 - x), + rowPosition + rowHeight - (_x2 - _x3) / 2, + //Math.min(rowHeight - (x1 - x), (xe - x1) / 2.0), + _x2, + rowPosition + rowHeight + ); + g.lineTo(_x4, rowPosition + rowHeight); + g.bezierCurveTo( + _x1 + (_x4 - _x1) / 3 * 2, + // rowPosition, + rowPosition + rowHeight - (_x4 - _x1) / 2, + //Math.min(rowHeight, (x1e - x) / 2.0), + _x1 + (_x4 - _x1) / 3, + // rowPosition, + rowPosition + rowHeight - (_x4 - _x1) / 2, + //Math.min(rowHeight, (x1e - x) / 2.0), + _x1, + rowPosition + rowHeight + ); + pathForMouseEvent = Array.from(g.currentPath.points); + g.endFill(); + } + } + model.getMouseEventModel().addPolygonBasedEvent(d, pathForMouseEvent); + } else { + const midX = (x + xe) / 2; + g.beginFill(colorToHex("white"), 0); + if (circular) { + if (x < 0 || xe > trackWidth) { + return; + } + if (((_d2 = spec.style) == null ? void 0 : _d2.linkStyle) === "straight") { + const r = trackOuterRadius - rowPosition / trackHeight * trackRingSize; + const posS = cartesianToPolar(x, trackWidth, r, tcx, tcy, startAngle, endAngle); + const posE = cartesianToPolar(xe, trackWidth, r, tcx, tcy, startAngle, endAngle); + const x12 = posS.x; + const y1 = posS.y; + const x4 = posE.x; + const y4 = posE.y; + g.moveTo(x12, y1); + g.lineTo(x4, y4); + const length = 100; + const eventPoints = Array.from({ length }, (d2, i) => { + return { + x: (x4 - x12) / (length - 1) * i + x12, + y: (y4 - y1) / (length - 1) * i + y1 + }; + }); + pathForMouseEvent = eventPoints.flatMap((d2) => [d2.x, d2.y]); + } else { + const r = trackOuterRadius - rowPosition / trackHeight * trackRingSize; + const posS = cartesianToPolar(x, trackWidth, r, tcx, tcy, startAngle, endAngle); + const posE = cartesianToPolar(xe, trackWidth, r, tcx, tcy, startAngle, endAngle); + const x12 = posS.x; + const y1 = posS.y; + const x2 = posS.x; + const y2 = posS.y; + const x3 = trackWidth / 2; + const y3 = trackHeight / 2; + const x4 = posE.x; + const y4 = posE.y; + g.moveTo(x12, y1); + const bezier = new Bezier(x12, y1, x2, y2, x3, y3, x4, y4); + const points = bezier.getLUT(14); + points.forEach((d2) => g.lineTo(d2.x, d2.y)); + const morePoints = bezier.getLUT(1e3); + pathForMouseEvent = morePoints.flatMap((d2) => [d2.x, d2.y]); + } + } else { + if (((_e2 = spec.style) == null ? void 0 : _e2.linkStyle) === "elliptical") { + if (!(0 <= x && x <= trackWidth) && !(0 <= xe && xe <= trackWidth)) { + return; + } + const points = []; + const isYSpecified = IsChannelDeep(spec.y); + for (let step = 0; step <= NUM_STEPS; step++) { + const theta = Math.PI * (step / NUM_STEPS); + const mx = (xe - x) / 2 * Math.cos(theta) + (x + xe) / 2; + let my = baseY - y * Math.sin(theta) * (isYSpecified ? 1 : Math.min(xe - x + trackWidth * MIN_HEIGHT, trackWidth) / trackWidth) * (flipY ? -1 : 1); + if (typeof y !== "undefined" && typeof ye !== "undefined") { + const linkHeight = Math.abs(ye - y); + const flipShape = ye > y; + my = y - linkHeight * Math.sin(theta) * (flipShape ? -1 : 1); + } + if (step === 0) { + if (showVerticalLines) { + const _y = flipY ? baseY - trackHeight : baseY; + g.moveTo(mx, _y); + points.push({ x: mx, y: _y }); + g.lineTo(mx, my); + } else { + g.moveTo(mx, my); + } + } else { + g.lineTo(mx, my); + } + points.push({ x: mx, y: my }); + if (step === NUM_STEPS && showVerticalLines) { + const _y = flipY ? baseY - trackHeight : baseY; + g.lineTo(mx, _y); + points.push({ x: mx, y: _y }); + } + } + pathForMouseEvent = points.flatMap((d2) => [d2.x, d2.y]); + } else { + if (xe < 0 || x > trackWidth) { + return; + } + g.arc(midX, baseY, (xe - x) / 2, -Math.PI, Math.PI); + pathForMouseEvent = Array.from(g.currentPath.points); + g.closePath(); + } + } + model.getMouseEventModel().addLineBasedEvent(d, pathForMouseEvent); + } + }); + }); +} +function insertItemToArray(array, index, item) { + return [...array.slice(0, index), item, ...array.slice(index)]; +} +function flatArrayToPairArray(array) { + const output = []; + for (let i = 0; i < array.length; i += 2) { + output.push([array[i], array[i + 1]]); + } + return output; +} +function isEvery(array, is) { + return array.every(is); +} +function isNumberArray(array) { + return isEvery(array, (x) => typeof x === "number"); +} +function isStringArray(array) { + return isEvery(array, (x) => typeof x === "string"); +} +function drawGrid(trackInfo, tm, theme) { + drawYGridQuantitative(trackInfo, tm, theme); + drawRowGrid(trackInfo, tm, theme); +} +function drawRowGrid(trackInfo, tm, theme) { + var _a, _b, _c, _d; + const spec = tm.spec(); + if (!IsChannelDeep(spec.row) || spec.row.grid !== true) { + return; + } + const [trackX, trackY] = trackInfo.position; + const [trackWidth, trackHeight] = trackInfo.dimensions; + const circular = tm.spec().layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const cx = trackWidth / 2; + const cy = trackHeight / 2; + const rowCategories = tm.getChannelDomainArray("row"); + if (!rowCategories) { + return; + } + const rowHeight = trackHeight / rowCategories.length; + if (circular && trackRingSize <= 20 || !circular && rowHeight <= 20) { + return; + } + const graphics = trackInfo.pBackground; + const strokeWidth = theme.axis.gridStrokeWidth; + rowCategories.forEach((rowCategory) => { + const rowPosition = tm.encodedValue("row", rowCategory); + if (!circular) { + graphics.lineStyle( + strokeWidth, + colorToHex(theme.axis.gridColor), + 1, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + const y = trackY + rowPosition + rowHeight / 2; + graphics.moveTo(trackX, y); + graphics.lineTo(trackX + trackWidth, y); + } else { + const y = rowPosition + rowHeight / 2; + const midR = trackOuterRadius - y / trackHeight * trackRingSize; + const farR = midR + strokeWidth / 2; + const nearR = midR - strokeWidth / 2; + const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle); + const startRad = valueToRadian(0, trackWidth, startAngle, endAngle); + const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle); + graphics.lineStyle( + strokeWidth, + colorToHex("black"), + 0, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + graphics.beginFill(colorToHex(theme.axis.gridColor), 1); + graphics.moveTo(trackX + sPos.x, trackY + sPos.y); + graphics.arc(trackX + cx, trackY + cy, nearR, startRad, endRad, true); + graphics.arc(trackX + cx, trackY + cy, farR, endRad, startRad, false); + graphics.closePath(); + } + }); +} +function drawYGridQuantitative(trackInfo, tm, theme) { + var _a, _b, _c, _d, _e; + const spec = tm.spec(); + if (!IsChannelDeep(spec.y) || spec.y.grid !== true) { + return; + } + const [trackX, trackY] = trackInfo.position; + const [trackWidth, trackHeight] = trackInfo.dimensions; + const startX = trackX; + const endX = trackX + trackWidth; + const circular = tm.spec().layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const cx = trackWidth / 2; + const cy = trackHeight / 2; + const rowCategories = (_e = tm.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = trackHeight / rowCategories.length; + if (!isStringArray(rowCategories)) { + return; + } + const scale = tm.getChannelScale("y"); + const domain = tm.getChannelDomainArray("y"); + if (!scale || !domain || !isNumberArray(domain)) { + return; + } + if (circular && rowHeight / trackHeight * trackRingSize <= 20 || !circular && rowHeight <= 20) { + return; + } + const graphics = trackInfo.pBackground; + const strokeWidth = theme.axis.gridStrokeWidth; + rowCategories.forEach((rowCategory) => { + const rowPosition = tm.encodedValue("row", rowCategory); + const assignedHeight = circular ? rowHeight / trackHeight * trackRingSize : rowHeight; + const tickCount = Math.max(Math.ceil(assignedHeight / 40), 1); + let ticks = scale.ticks(tickCount).filter((v) => domain[0] <= v && v <= domain[1]); + if (ticks.length === 1) { + ticks = scale.ticks(tickCount + 1).filter((v) => domain[0] <= v && v <= domain[1]); + } + if (!circular) { + graphics.lineStyle( + strokeWidth, + colorToHex(theme.axis.gridColor), + 1, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + ticks.forEach((value) => { + var _a2; + const y = trackY + rowPosition + rowHeight - scale(value); + if (theme.axis.gridStrokeType === "solid") { + graphics.moveTo(startX, y); + graphics.lineTo(endX, y); + } else if (theme.axis.gridStrokeType === "dashed") { + const [line, gap] = (_a2 = theme.axis.gridStrokeDash) != null ? _a2 : [1, 1]; + for (let i = startX; i < endX; i += line + gap) { + graphics.moveTo(i, y); + graphics.lineTo(i + line, y); + } + } + }); + } else { + ticks.forEach((value) => { + const y = scale(value); + const midR = trackOuterRadius - (rowPosition + rowHeight - y) / trackHeight * trackRingSize; + const farR = midR + strokeWidth / 2; + const nearR = midR - strokeWidth / 2; + const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle); + const startRad = valueToRadian(0, trackWidth, startAngle, endAngle); + const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle); + graphics.lineStyle( + strokeWidth, + colorToHex("black"), + 0, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + graphics.beginFill(colorToHex(theme.axis.gridColor), 1); + graphics.moveTo(trackX + sPos.x, trackY + sPos.y); + graphics.arc(trackX + cx, trackY + cy, nearR, startRad, endRad, true); + graphics.arc(trackX + cx, trackY + cy, farR, endRad, startRad, false); + graphics.closePath(); + }); + } + }); +} +const DEFAULT_TEXT_STYLE = { + color: "black", + size: 10, + fontFamily: "Arial", + fontWeight: "normal", + stroke: "#ffffff", + strokeThickness: 0 +}; +function getTextStyle(style = {}) { + const merged = { ...DEFAULT_TEXT_STYLE, ...style }; + const pixiTextStyle = { + fontSize: `${merged.size}px`, + fontFamily: merged.fontFamily, + fontWeight: merged.fontWeight === "light" ? "lighter" : merged.fontWeight, + fill: merged.color, + lineJoin: "round", + stroke: merged.stroke, + strokeThickness: merged.strokeThickness + }; + return pixiTextStyle; +} +function drawCircularTitle(HGC, trackInfo, tile, model, theme) { + var _a, _b, _c; + const spec = model.spec(); + const { title: title2 } = spec; + if (spec.layout !== "circular") { + return; + } + if (!title2) { + return; + } + const [tw, th] = trackInfo.dimensions; + const trackOuterRadius = (_a = spec.outerRadius) != null ? _a : 300; + const startAngle = (_b = spec.startAngle) != null ? _b : 0; + const endAngle = (_c = spec.endAngle) != null ? _c : 360; + const cx = tw / 2; + const cy = th / 2; + const g = tile.graphics; + const titleR = trackOuterRadius - 1; + const padding = 1; + const pos = cartesianToPolar(padding, tw, titleR, cx, cy, startAngle, endAngle); + const styleConfig = getTextStyle({ + color: theme.track.titleColor, + size: 12, + // `theme.track.titleFontSize` seems to use much larger fonts + fontFamily: theme.axis.labelFontFamily, + // TODO: support + fontWeight: theme.axis.labelFontWeight + // TODO: support + }); + const textGraphic = new HGC.libraries.PIXI.Text(title2, styleConfig); + textGraphic.anchor.x = 1; + textGraphic.anchor.y = 0.5; + textGraphic.position.x = pos.x; + textGraphic.position.y = pos.y; + textGraphic.resolution = 4; + const txtStyle = new HGC.libraries.PIXI.TextStyle(styleConfig); + const metric = HGC.libraries.PIXI.TextMetrics.measureText(textGraphic.text, txtStyle); + const txtWidth = metric.width / (2 * titleR * Math.PI) * tw * 360 / (endAngle - startAngle); + const scaledStartX = padding; + const scaledEndX = padding + txtWidth; + const ropePoints = []; + for (let i = scaledEndX; i >= scaledStartX; i -= txtWidth / 10) { + const p = cartesianToPolar(i, tw, titleR - metric.height / 2, cx, cy, startAngle, endAngle); + ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y)); + } + const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle); + const endRad = valueToRadian(scaledEndX + padding, tw, startAngle, endAngle); + g.lineStyle(1, colorToHex("red"), 0, 0.5); + g.beginFill(colorToHex(theme.track.titleBackground), 0.5); + g.moveTo(pos.x, pos.y); + g.arc(cx, cy, titleR - metric.height, startRad, endRad, true); + g.arc(cx, cy, titleR, endRad, startRad, false); + g.closePath(); + textGraphic.updateText(); + const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints); + g.addChild(rope); +} +function drawChartOutlines(trackInfo, tm, theme) { + var _a, _b, _c, _d; + const g = trackInfo.pBorder; + const [l, t] = trackInfo.position; + const [w, h] = trackInfo.dimensions; + g.lineStyle( + (_b = (_a = tm.spec().style) == null ? void 0 : _a.outlineWidth) != null ? _b : 1, + // TODO: outline not working + colorToHex((_d = (_c = tm.spec().style) == null ? void 0 : _c.outline) != null ? _d : theme.track.outline), + 1, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + g.beginFill(colorToHex("white"), 0); + g.drawRect(l, t, w, h); + const x = tm.spec().x; + g.lineStyle( + 1, + colorToHex(theme.axis.baselineColor), + 1, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + if (IsChannelDeep(x) && x.axis === "top") { + g.moveTo(l, t); + g.lineTo(l + w, t); + } else if (IsChannelDeep(x) && x.axis === "bottom") { + g.moveTo(l, t + h); + g.lineTo(l + w, t + h); + } +} +function drawColorLegend(HGC, trackInfo, _tile, model, theme) { + if (!trackInfo.gLegend) { + return; + } + trackInfo.gLegend.selectAll(".brush").remove(); + const spec = model.spec(); + const offset = { offsetRight: 0 }; + if (IsChannelDeep(spec.color) && spec.color.legend) { + switch (spec.color.type) { + case "nominal": + drawColorLegendCategories(HGC, trackInfo, _tile, model, theme); + break; + case "quantitative": + drawColorLegendQuantitative(HGC, trackInfo, _tile, model, theme, "color", offset); + break; + } + } + if (IsChannelDeep(spec.stroke) && spec.stroke.legend) { + switch (spec.stroke.type) { + case "quantitative": + drawColorLegendQuantitative(HGC, trackInfo, _tile, model, theme, "stroke", offset); + break; + } + } +} +function drawColorLegendQuantitative(HGC, trackInfo, _tile, model, theme, channelKey, offset) { + const spec = model.spec(); + const channel = spec[channelKey]; + if (!IsChannelDeep(channel) || channel.type !== "quantitative" || !channel.legend) { + return; + } + const [trackX, trackY] = trackInfo.position; + const [trackWidth, trackHeight] = trackInfo.dimensions; + const legendWidth = 80; + const legendHeight = trackHeight - 2 > 110 ? 110 : Math.max(trackHeight - 2, 40 - 2); + const colorBarDim = { + top: 10, + left: 55, + width: 20, + height: legendHeight - 20 + }; + const legendX = trackX + trackWidth - legendWidth - 1 - offset.offsetRight; + const legendY = trackY + 1; + const colorScale = model.getChannelScale(channelKey); + const colorDomain = model.getChannelDomainArray(channelKey); + if (!colorScale || !colorDomain) { + return; + } + const graphics = trackInfo.pBorder; + graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity); + graphics.lineStyle( + 1, + colorToHex(theme.legend.backgroundStroke), + theme.legend.backgroundOpacity, + // alpha + 0 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + graphics.drawRect(legendX, legendY, legendWidth, legendHeight); + if (channel.title) { + const titleStr = channel.title; + const labelTextStyle2 = getTextStyle({ + color: theme.legend.labelColor, + size: theme.legend.labelFontSize, + fontWeight: theme.legend.labelFontWeight, + fontFamily: theme.legend.labelFontFamily + }); + const textGraphic = new HGC.libraries.PIXI.Text(titleStr, { + ...labelTextStyle2, + fontWeight: "bold" + }); + textGraphic.anchor.x = 0; + textGraphic.anchor.y = 0; + textGraphic.position.x = legendX + 10; + textGraphic.position.y = legendY + 10; + const textStyleObj = new HGC.libraries.PIXI.TextStyle({ ...labelTextStyle2, fontWeight: "bold" }); + const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(titleStr, textStyleObj); + graphics.addChild(textGraphic); + colorBarDim.top += textMetrics.height + 4; + colorBarDim.height -= textMetrics.height + 4; + } + const [startValue, endValue] = colorDomain; + const extent = endValue - startValue; + const scaleOffset = IsChannelDeep(channel) && channel.scaleOffset ? channel.scaleOffset : [0, 1]; + [...Array(colorBarDim.height).keys()].forEach((y) => { + let value; + const scaleOffsetSorted = Array.from(scaleOffset).sort(); + if (y / colorBarDim.height >= scaleOffsetSorted[1]) { + value = endValue; + } else if (y / colorBarDim.height <= scaleOffsetSorted[0]) { + value = startValue; + } else { + const s1 = scaleLinear().domain([colorBarDim.height * scaleOffsetSorted[0], colorBarDim.height * scaleOffsetSorted[1]]).range([0, colorBarDim.height]); + const s2 = scaleLinear().domain([0, colorBarDim.height]).range([startValue, endValue]); + value = s2(s1(y)); + } + graphics.beginFill( + colorToHex(colorScale(value)), + 1 + // alpha + ); + graphics.lineStyle( + 1, + colorToHex(theme.legend.backgroundStroke), + 0, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + graphics.drawRect( + legendX + colorBarDim.left, + legendY + colorBarDim.top + colorBarDim.height - y, + colorBarDim.width, + 1 + ); + }); + const BRUSH_HEIGHT = 4; + trackInfo.colorBrushes = trackInfo.gLegend.append("g").attr("class", channelKey).selectAll(`.brush`).data( + scaleOffset.map((d, i) => { + return { y: d, id: i }; + }) + ).enter().append("rect").attr("class", `brush`).attr("pointer-events", "all").attr("cursor", "ns-resize").attr( + "transform", + (d) => `translate(${legendX + colorBarDim.left}, ${legendY + colorBarDim.top - BRUSH_HEIGHT / 2 + colorBarDim.height - colorBarDim.height * d.y})` + ).attr("width", `${colorBarDim.width}px`).attr("height", `${BRUSH_HEIGHT}px`).attr("fill", "lightgrey").attr("stroke", "black").attr("stroke-width", "0.5px").call( + HGC.libraries.d3Drag.drag().on("start", (event) => { + trackInfo.startEvent = event.sourceEvent; + }).on("drag", (event, d) => { + if (channel && channel.scaleOffset) { + const endEvent = event.sourceEvent; + const diffY = trackInfo.startEvent.clientY - endEvent.clientY; + const newScaleOffset = [channel.scaleOffset[0], channel.scaleOffset[1]]; + if (d.id === 0) { + newScaleOffset[0] += diffY / colorBarDim.height; + } else { + newScaleOffset[1] += diffY / colorBarDim.height; + } + newScaleOffset[0] = Math.min(1, Math.max(0, newScaleOffset[0])); + newScaleOffset[1] = Math.min(1, Math.max(0, newScaleOffset[1])); + trackInfo.updateScaleOffsetFromOriginalSpec(spec._renderingId, newScaleOffset, channelKey); + trackInfo.shareScaleOffsetAcrossTracksAndTiles(newScaleOffset, channelKey); + trackInfo.draw(); + trackInfo.startEvent = event.sourceEvent; + } + }) + ); + const tickCount = Math.max(Math.ceil(colorBarDim.height / 30), 2); + let ticks = colorScale.ticks(tickCount).filter((v) => colorDomain[0] <= v && v <= colorDomain[1]); + if (ticks.length === 1) { + ticks = colorScale.ticks(tickCount + 1).filter((v) => colorDomain[0] <= v && v <= colorDomain[1]); + } + const TICK_STROKE_SIZE = 1; + graphics.lineStyle( + TICK_STROKE_SIZE, + colorToHex(theme.legend.tickColor), + 1, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + const labelTextStyle = getTextStyle({ + color: theme.legend.labelColor, + size: theme.legend.labelFontSize, + fontWeight: theme.legend.labelFontWeight, + fontFamily: theme.legend.labelFontFamily + }); + const tickEnd = legendX + colorBarDim.left; + ticks.forEach((value) => { + let y = legendY + colorBarDim.top + colorBarDim.height - (value - startValue) / extent * colorBarDim.height; + if (y === legendY + colorBarDim.top) { + y += TICK_STROKE_SIZE / 2; + } else if (y === legendY + colorBarDim.top + colorBarDim.height) { + y -= TICK_STROKE_SIZE / 2; + } + graphics.moveTo(tickEnd - 3, y); + graphics.lineTo(tickEnd, y); + const textGraphic = new HGC.libraries.PIXI.Text(value, labelTextStyle); + textGraphic.anchor.x = 1; + textGraphic.anchor.y = 0.5; + textGraphic.position.x = tickEnd - 6; + textGraphic.position.y = y; + graphics.addChild(textGraphic); + }); + offset.offsetRight = trackWidth - legendX; +} +function drawColorLegendCategories(HGC, track, _tile, tm, theme) { + var _a, _b, _c, _d, _e; + const spec = tm.spec(); + if (!IsChannelDeep(spec.color) || spec.color.type !== "nominal" || !spec.color.legend) { + return; + } + const colorCategories = (_a = tm.getChannelDomainArray("color")) != null ? _a : ["___SINGLE_COLOR___"]; + if (colorCategories.length === 0) { + return; + } + const domain = spec.color.domain; + const range = spec.color.range; + const existingLegends = track.displayedLegends; + const toStr = (_) => { + return typeof _ === "string" ? _ : _.join(); + }; + if (existingLegends.find((d) => toStr(d.domain) === toStr(domain) && toStr(d.range) === toStr(range))) { + return; + } else { + existingLegends.push({ domain, range }); + } + const graphics = track.pBorder; + const paddingX = 10; + const paddingY = 4; + let cumY = paddingY; + let maxWidth = 0; + const recipe = []; + const labelTextStyle = getTextStyle({ + color: theme.legend.labelColor, + size: theme.legend.labelFontSize, + fontWeight: theme.legend.labelFontWeight, + fontFamily: theme.legend.labelFontFamily + }); + if ((_b = spec.style) == null ? void 0 : _b.inlineLegend) { + colorCategories.map((d) => d).reverse().forEach((category) => { + if (maxWidth > track.dimensions[0]) { + return; + } + const color2 = tm.encodedValue("color", category); + const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle); + textGraphic.anchor.x = 1; + textGraphic.anchor.y = 0; + textGraphic.position.x = track.position[0] + track.dimensions[0] - maxWidth - paddingX; + textGraphic.position.y = track.position[1] + paddingY; + graphics.addChild(textGraphic); + const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle); + const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj); + if (cumY < textMetrics.height + paddingY * 3) { + cumY = textMetrics.height + paddingY * 3; + } + recipe.push({ + x: track.position[0] + track.dimensions[0] - textMetrics.width - maxWidth - paddingX * 2, + y: track.position[1] + paddingY + textMetrics.height / 2, + color: color2 + }); + maxWidth += textMetrics.width + paddingX * 3; + }); + } else { + if ((_c = spec.style) == null ? void 0 : _c.legendTitle) { + const textGraphic = new HGC.libraries.PIXI.Text((_d = spec.style) == null ? void 0 : _d.legendTitle, { + ...labelTextStyle, + fontWeight: "bold" + }); + textGraphic.anchor.x = 1; + textGraphic.anchor.y = 0; + textGraphic.position.x = track.position[0] + track.dimensions[0] - paddingX; + textGraphic.position.y = track.position[1] + cumY; + const textStyleObj = new HGC.libraries.PIXI.TextStyle({ ...labelTextStyle, fontWeight: "bold" }); + const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText((_e = spec.style) == null ? void 0 : _e.legendTitle, textStyleObj); + graphics.addChild(textGraphic); + cumY += textMetrics.height + paddingY * 2; + } + colorCategories.forEach((category) => { + if (cumY > track.dimensions[1]) { + return; + } + const color2 = tm.encodedValue("color", category); + const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle); + textGraphic.anchor.x = 1; + textGraphic.anchor.y = 0; + textGraphic.position.x = track.position[0] + track.dimensions[0] - paddingX; + textGraphic.position.y = track.position[1] + cumY; + graphics.addChild(textGraphic); + const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle); + const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj); + if (maxWidth < textMetrics.width + paddingX * 3) { + maxWidth = textMetrics.width + paddingX * 3; + } + recipe.push({ + x: track.position[0] + track.dimensions[0] - textMetrics.width - paddingX * 2, + y: track.position[1] + cumY + textMetrics.height / 2, + color: color2 + }); + cumY += textMetrics.height + paddingY * 2; + }); + } + graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity); + graphics.lineStyle( + 1, + colorToHex(theme.legend.backgroundStroke), + theme.legend.backgroundOpacity, + // alpha + 0 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + graphics.drawRect( + track.position[0] + track.dimensions[0] - maxWidth - 1, + track.position[1] + 1, + maxWidth, + cumY - paddingY + ); + recipe.forEach((r) => { + graphics.lineStyle( + 1, + colorToHex("black"), + 0, + // alpha + 0 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + graphics.beginFill(colorToHex(r.color), 1); + graphics.drawCircle(r.x, r.y, 4); + }); +} +function drawRowLegend(HGC, trackInfo, _tile, tm, theme) { + var _a; + const spec = tm.spec(); + if (!IsChannelDeep(spec.row) || spec.row.type !== "nominal" || !spec.row.legend) { + return; + } + const rowCategories = (_a = tm.getChannelDomainArray("row")) != null ? _a : ["___SINGLE_ROW___"]; + if (rowCategories.length === 0) { + return; + } + const graphics = trackInfo.pBorder; + const paddingX = 4; + const paddingY = 2; + const labelTextStyle = getTextStyle({ + color: theme.legend.labelColor, + size: theme.legend.labelFontSize, + fontWeight: theme.legend.labelFontWeight, + fontFamily: theme.legend.labelFontFamily + }); + rowCategories.forEach((category) => { + const rowPosition = tm.encodedValue("row", category); + const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle); + textGraphic.anchor.x = 0; + textGraphic.anchor.y = 0; + textGraphic.position.x = trackInfo.position[0] + paddingX; + textGraphic.position.y = trackInfo.position[1] + rowPosition + paddingY; + graphics.addChild(textGraphic); + const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle); + const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj); + graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity); + graphics.lineStyle( + 1, + colorToHex(theme.legend.backgroundStroke), + 0, + // alpha + 0 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + graphics.drawRect( + trackInfo.position[0] + 1, + trackInfo.position[1] + rowPosition + 1, + textMetrics.width + paddingX * 2, + textMetrics.height + paddingY * 2 + ); + }); +} +const EXTENT_TICK_SIZE = 8; +const TICK_SIZE = 6; +function drawLinearYAxis(HGC, trackInfo, _tile, model, theme) { + var _a; + const spec = model.spec(); + const CIRCULAR = spec.layout === "circular"; + const yDomain = model.getChannelDomainArray("y"); + const yRange = model.getChannelRangeArray("y"); + if (CIRCULAR) { + return; + } + if (!model.isShowYAxis() || !yDomain || !yRange) { + return; + } + if (!isNumberArray(yDomain)) { + return; + } + const [tw, th] = trackInfo.dimensions; + const [tx, ty] = trackInfo.position; + const rowCategories = (_a = model.getChannelDomainArray("row")) != null ? _a : ["___SINGLE_ROW___"]; + if (!isStringArray(rowCategories)) { + return; + } + const rowHeight = th / rowCategories.length; + if (rowHeight <= 20) { + return; + } + const yChannel = model.spec().y; + const isLeft = IsChannelDeep(yChannel) && "axis" in yChannel && yChannel.axis === "right" ? false : true; + const yScale = scaleLinear().domain(yDomain).range(yRange); + const graphics = trackInfo.pBorder; + rowCategories.forEach((category) => { + const rowPosition = model.encodedValue("row", category); + const dx = isLeft ? tx : tx + tw; + const dy = ty + rowPosition; + graphics.lineStyle( + 1, + colorToHex(theme.axis.baselineColor), + 1, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + graphics.moveTo(dx, dy); + graphics.lineTo(dx, dy + rowHeight); + const tickCount = Math.max(Math.ceil(rowHeight / 40), 1); + let ticks = yScale.ticks(tickCount).filter((v) => yDomain[0] <= v && v <= yDomain[1]); + if (ticks.length === 1) { + ticks = yScale.ticks(tickCount + 1).filter((v) => yDomain[0] <= v && v <= yDomain[1]); + } + graphics.lineStyle( + 1, + colorToHex(theme.axis.tickColor), + 1, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + let tickEnd = isLeft ? dx + TICK_SIZE : dx - TICK_SIZE; + ticks.forEach((t) => { + const y = yScale(t); + graphics.moveTo(dx, dy + rowHeight - y); + graphics.lineTo(tickEnd, dy + rowHeight - y); + }); + tickEnd = isLeft ? dx + EXTENT_TICK_SIZE : dx - EXTENT_TICK_SIZE; + graphics.moveTo(dx, dy); + graphics.lineTo(tickEnd, dy); + graphics.moveTo(dx, dy + rowHeight); + graphics.lineTo(tickEnd, dy + rowHeight); + const styleConfig = getTextStyle({ + color: theme.axis.labelColor, + size: theme.axis.labelFontSize, + fontFamily: theme.axis.labelFontFamily, + fontWeight: theme.axis.labelFontWeight + }); + ticks.forEach((t) => { + const y = yScale(t); + tickEnd = isLeft ? dx + TICK_SIZE * 2 : dx - TICK_SIZE * 2; + const textGraphic = new HGC.libraries.PIXI.Text(t, styleConfig); + textGraphic.anchor.x = isLeft ? 0 : 1; + textGraphic.anchor.y = y === 0 ? 0.9 : 0.5; + textGraphic.position.x = tickEnd; + textGraphic.position.y = dy + rowHeight - y; + if (spec.orientation === "vertical") { + textGraphic.anchor.x = isLeft ? 1 : 0; + textGraphic.scale.x *= -1; + } + graphics.addChild(textGraphic); + }); + }); +} +function drawCircularYAxis(HGC, trackInfo, tile, model, theme) { + var _a, _b, _c, _d, _e; + const spec = model.spec(); + const CIRCULAR = spec.layout === "circular"; + const yDomain = model.getChannelDomainArray("y"); + const yRange = model.getChannelRangeArray("y"); + if (!CIRCULAR) { + return; + } + if (!model.isShowYAxis() || !yDomain || !yRange) { + return; + } + if (!isNumberArray(yDomain)) { + return; + } + const [tw, th] = trackInfo.dimensions; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const cx = tw / 2; + const cy = th / 2; + const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = th / rowCategories.length; + if (rowHeight / th * trackRingSize <= 20) { + return; + } + const yChannel = model.spec().y; + const isLeft = IsChannelDeep(yChannel) && "axis" in yChannel && yChannel.axis === "right" ? false : true; + const yScale = scaleLinear().domain(yDomain).range(yRange); + const graphics = tile.graphics; + rowCategories.forEach((category) => { + const rowPosition = model.encodedValue("row", category); + const innerR = trackOuterRadius - (rowPosition + rowHeight) / th * trackRingSize; + const outerR = trackOuterRadius - rowPosition / th * trackRingSize; + const innerPos = cartesianToPolar(isLeft ? 0 : tw, tw, innerR, cx, cy, startAngle, endAngle); + const outerPos = cartesianToPolar(isLeft ? 0 : tw, tw, outerR, cx, cy, startAngle, endAngle); + graphics.lineStyle( + 1, + colorToHex(theme.axis.baselineColor), + 1, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + graphics.moveTo(innerPos.x, innerPos.y); + graphics.lineTo(outerPos.x, outerPos.y); + const SCALED_TICK_SIZE = (r) => TICK_SIZE * tw / 2 / Math.PI / r; + const SCALED_EXTENT_TICK_SIZE = (r) => EXTENT_TICK_SIZE * tw / 2 / Math.PI / r; + const axisHeight = rowHeight / th * trackRingSize; + const tickCount = Math.max(Math.ceil(axisHeight / 40), 1); + let ticks = yScale.ticks(tickCount).filter((v) => yDomain[0] <= v && v <= yDomain[1]); + if (ticks.length === 1) { + ticks = yScale.ticks(tickCount + 1).filter((v) => yDomain[0] <= v && v <= yDomain[1]); + } + graphics.lineStyle( + 1, + colorToHex(theme.axis.tickColor), + 1, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + ticks.forEach((t) => { + const y = yScale(t); + const currentR = trackOuterRadius - (rowPosition + rowHeight - y) / th * trackRingSize; + const scaledStartX = isLeft ? 0 : tw - SCALED_TICK_SIZE(currentR); + const scaledEndX = isLeft ? SCALED_TICK_SIZE(currentR) : tw; + const pos = cartesianToPolar(scaledStartX, tw, currentR, cx, cy, startAngle, endAngle); + const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle); + const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle); + graphics.moveTo(pos.x, pos.y); + graphics.arc(cx, cy, currentR, startRad, endRad, true); + graphics.arc(cx, cy, currentR, endRad, startRad, false); + graphics.closePath(); + }); + { + const scaledStartX = isLeft ? 0 : tw - SCALED_EXTENT_TICK_SIZE(trackInnerRadius); + const scaledEndX = isLeft ? SCALED_EXTENT_TICK_SIZE(trackInnerRadius) : tw; + const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle); + const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle); + graphics.moveTo(innerPos.x, innerPos.y); + graphics.arc(cx, cy, trackInnerRadius, startRad, endRad, true); + graphics.arc(cx, cy, trackInnerRadius, endRad, startRad, false); + graphics.closePath(); + } + { + const scaledStartX = isLeft ? 0 : tw - SCALED_EXTENT_TICK_SIZE(trackOuterRadius); + const scaledEndX = isLeft ? SCALED_EXTENT_TICK_SIZE(trackOuterRadius) : tw; + const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle); + const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle); + graphics.moveTo(outerPos.x, outerPos.y); + graphics.arc(cx, cy, trackOuterRadius, startRad, endRad, true); + graphics.arc(cx, cy, trackOuterRadius, endRad, startRad, false); + graphics.closePath(); + } + ticks.forEach((t) => { + const y = yScale(t); + const currentR = trackOuterRadius - (rowPosition + rowHeight - y) / th * trackRingSize; + const pos = cartesianToPolar(SCALED_TICK_SIZE(currentR) * 2, tw, currentR, cx, cy, startAngle, endAngle); + const styleConfig = getTextStyle({ + color: theme.axis.labelColor, + size: theme.axis.labelFontSize, + fontFamily: theme.axis.labelFontFamily, + fontWeight: theme.axis.labelFontWeight + }); + const textGraphic = new HGC.libraries.PIXI.Text(t, styleConfig); + textGraphic.anchor.x = isLeft ? 1 : 0; + textGraphic.anchor.y = 0.5; + textGraphic.position.x = pos.x; + textGraphic.position.y = pos.y; + textGraphic.resolution = 4; + const txtStyle = new HGC.libraries.PIXI.TextStyle(styleConfig); + const metric = HGC.libraries.PIXI.TextMetrics.measureText(textGraphic.text, txtStyle); + const txtWidth = metric.width / (2 * currentR * Math.PI) * tw * 360 / (endAngle - startAngle); + const scaledStartX = isLeft ? SCALED_TICK_SIZE(currentR) * 2 : tw - SCALED_TICK_SIZE(currentR) * 2 - txtWidth; + const scaledEndX = isLeft ? SCALED_TICK_SIZE(currentR) * 2 + txtWidth : tw - SCALED_TICK_SIZE(currentR) * 2; + const ropePoints = []; + for (let i = scaledEndX; i >= scaledStartX; i -= txtWidth / 10) { + const p = cartesianToPolar(i, tw, currentR, cx, cy, startAngle, endAngle); + ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y)); + } + textGraphic.updateText(); + const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints); + graphics.addChild(rope); + }); + }); +} +function drawCircularOutlines(trackInfo, tm, theme) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; + const spec = tm.spec(); + const [l, t] = trackInfo.position; + const [trackWidth, trackHeight] = trackInfo.dimensions; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const cx = l + trackWidth / 2; + const cy = t + trackHeight / 2; + const posStartInner = cartesianToPolar(0, trackWidth, trackInnerRadius, cx, cy, startAngle, endAngle); + const startRad = valueToRadian(0, trackWidth, startAngle, endAngle); + const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle); + const g = trackInfo.pBackground; + if (!(spec.layout === "circular" && spec.mark === "withinLink")) { + g.lineStyle( + ((_e = spec.style) == null ? void 0 : _e.outlineWidth) ? ((_f = spec.style) == null ? void 0 : _f.outlineWidth) / 2.5 : 0, + colorToHex((_h = (_g = spec.style) == null ? void 0 : _g.outline) != null ? _h : "#DBDBDB"), + 1, + // 0.4, // alpha + 1 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + g.beginFill( + colorToHex((_j = (_i = tm.spec().style) == null ? void 0 : _i.background) != null ? _j : theme.track.background), + (_l = (_k = tm.spec().style) == null ? void 0 : _k.backgroundOpacity) != null ? _l : !theme.track.background || theme.track.background === "transparent" ? 0 : 1 + ); + g.moveTo(posStartInner.x, posStartInner.y); + g.arc(cx, cy, trackInnerRadius, startRad, endRad, true); + g.arc(cx, cy, trackOuterRadius, endRad, startRad, false); + g.closePath(); + } + if (IsChannelDeep(spec.x) && spec.x.axis === "top") { + g.lineStyle( + 0.5, + colorToHex("black"), + 0, + // 1, // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + g.beginFill(colorToHex("white"), 0); + g.moveTo(posStartInner.x, posStartInner.y); + g.arc(cx, cy, trackOuterRadius - 0.5, startRad, endRad, true); + g.arc(cx, cy, trackOuterRadius, endRad, startRad, false); + g.closePath(); + } + g.lineStyle( + 0.5, + colorToHex("black"), + 0, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + g.beginFill(colorToHex("white"), 0); + g.moveTo(cx, cy); + g.arc(cx, cy, trackOuterRadius + 3, startRad, endRad, false); + g.closePath(); + g.lineStyle( + 1, + colorToHex("#DBDBDB"), + 0, + // alpha + 0 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + g.beginFill(colorToHex("white"), 0); + g.drawCircle(cx, cy, trackInnerRadius - 1); +} +function drawBackground(trackInfo, tm, theme) { + var _a, _b, _c, _d, _e, _f; + const [l, t] = trackInfo.position; + const [w, h] = trackInfo.dimensions; + const g = trackInfo.pBackground; + if (((_a = tm.spec().style) == null ? void 0 : _a.background) || theme.track.background && theme.track.background !== "transparent") { + g.clear(); + const bg = (_c = (_b = tm.spec().style) == null ? void 0 : _b.background) != null ? _c : theme.track.background; + const alpha = isUndefined((_d = tm.spec().style) == null ? void 0 : _d.backgroundOpacity) ? 1 : (_e = tm.spec().style) == null ? void 0 : _e.backgroundOpacity; + g.lineStyle( + 1, + colorToHex("white"), + 0, + // alpha + 0 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + g.beginFill(colorToHex(bg), alpha); + g.drawRect(l, t, w, h); + } + if (theme.track.alternatingBackground && theme.track.alternatingBackground !== "transparent") { + const spec = tm.spec(); + if (!IsChannelDeep(spec.row) || spec.row.type !== "nominal") { + return; + } + const rowCategories = (_f = tm.getChannelDomainArray("row")) != null ? _f : ["___SINGLE_ROW___"]; + if (rowCategories.length === 0) { + return; + } + rowCategories.forEach((category, i) => { + var _a2, _b2, _c2, _d2; + if (i % 2 === 0) { + return; + } + const rowPosition = tm.encodedValue("row", category); + const bg = (_b2 = (_a2 = tm.spec().style) == null ? void 0 : _a2.background) != null ? _b2 : theme.track.alternatingBackground; + const alpha = isUndefined((_c2 = tm.spec().style) == null ? void 0 : _c2.backgroundOpacity) ? 1 : (_d2 = tm.spec().style) == null ? void 0 : _d2.backgroundOpacity; + g.lineStyle( + 1, + colorToHex("white"), + 0, + // alpha + 0 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + g.beginFill(colorToHex(bg), alpha); + g.drawRect(trackInfo.position[0], trackInfo.position[1] + rowPosition, w, h / rowCategories.length); + }); + } +} +function drawBetweenLink(g, trackInfo, model) { + var _a, _b, _c, _d, _e; + const spec = model.spec(); + if (!spec.width || !spec.height) { + console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); + return; + } + const data2 = model.data(); + const [trackWidth, trackHeight] = trackInfo.dimensions; + const circular = spec.layout === "circular"; + const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; + const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; + const startAngle = (_c = spec.startAngle) != null ? _c : 0; + const endAngle = (_d = spec.endAngle) != null ? _d : 360; + const trackRingSize = trackOuterRadius - trackInnerRadius; + const tcx = trackWidth / 2; + const tcy = trackHeight / 2; + const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; + const rowHeight = trackHeight / rowCategories.length; + rowCategories.forEach((rowCategory) => { + const rowPosition = model.encodedValue("row", rowCategory); + data2.filter( + (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory + ).forEach((d) => { + var _a2, _b2; + let x = model.encodedPIXIProperty("x", d); + let xe = model.encodedPIXIProperty("xe", d); + let x1 = model.encodedPIXIProperty("x1", d); + let x1e = model.encodedPIXIProperty("x1e", d); + const y = model.encodedPIXIProperty("y", d); + const stroke = model.encodedPIXIProperty("stroke", d); + const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); + const color2 = model.encodedPIXIProperty("color", d); + const opacity = model.encodedPIXIProperty("opacity", d); + if (typeof xe !== "undefined") { + [x, xe] = [x, xe].sort((a, b) => a - b); + } + if (typeof x1 !== "undefined" && typeof x1e !== "undefined") { + [x1, x1e] = [x1, x1e].sort((a, b) => a - b); + } + const isRibon = typeof xe !== "undefined" && typeof x1 !== "undefined" && typeof x1e !== "undefined" && // This means the strokeWidth of a band is too small, so we just need to draw a line instead + Math.abs(x - xe) > 0.1 && Math.abs(x1 - x1e) > 0.1; + if (!isRibon && xe === void 0 && !Is2DTrack(spec)) { + if (x1 === void 0 && x1e === void 0) { + return; + } + xe = x1 !== void 0 ? x1 : x1e; + } + if (!isRibon && Math.abs(x - xe) <= 0.1 && Math.abs(x1 - x1e) <= 0.1) { + x = (x + xe) / 2; + xe = (x1 + x1e) / 2; + } + g.lineStyle( + strokeWidth, + colorToHex(stroke), + opacity, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + if (isRibon) { + g.beginFill(color2 === "none" ? colorToHex("white") : colorToHex(color2), color2 === "none" ? 0 : opacity); + let [_x1, _x2, _x3, _x4] = [x, xe, x1, x1e]; + [_x1, _x2] = [_x1, _x2].sort((a, b) => a - b); + [_x3, _x4] = [_x3, _x4].sort((a, b) => a - b); + if (_x1 > trackWidth || _x4 < 0 || Math.abs(_x4 - _x1) < 0.5) { + return; + } + if (circular) { + if (_x1 < 0 || _x4 > trackWidth) { + return; + } + const r = trackOuterRadius - rowPosition / trackHeight * trackRingSize; + const posX = cartesianToPolar(_x1, trackWidth, r, tcx, tcy, startAngle, endAngle); + const posXE = cartesianToPolar(_x2, trackWidth, r, tcx, tcy, startAngle, endAngle); + const posX1 = cartesianToPolar(_x3, trackWidth, r, tcx, tcy, startAngle, endAngle); + const posX1E = cartesianToPolar(_x4, trackWidth, r, tcx, tcy, startAngle, endAngle); + g.moveTo(posX.x, posX.y); + g.bezierCurveTo(tcx, tcy, tcx, tcy, posX1E.x, posX1E.y); + g.arc( + tcx, + tcy, + trackOuterRadius, + positionToRadian(posX1E.x, posX1E.y, tcx, tcy), + positionToRadian(posX1.x, posX1.y, tcx, tcy), + false + ); + g.bezierCurveTo(tcx, tcy, tcx, tcy, posXE.x, posXE.y); + g.arc( + tcx, + tcy, + trackOuterRadius, + positionToRadian(posXE.x, posXE.y, tcx, tcy), + positionToRadian(posX.x, posX.y, tcx, tcy), + false + ); + g.endFill(); + } else { + g.moveTo(_x1, rowPosition); + g.lineTo(_x2, rowPosition); + g.lineTo(_x4, rowPosition + rowHeight); + g.lineTo(_x3, rowPosition + rowHeight); + g.lineTo(_x1, rowPosition); + g.closePath(); + } + } else { + if (Is2DTrack(spec)) { + if (((_a2 = spec.style) == null ? void 0 : _a2.linkConnectionType) === "curve") { + g.moveTo(x, 0); + g.bezierCurveTo( + x / 5 * 4, + (rowPosition + rowHeight - y) / 2, + x / 2, + (rowPosition + rowHeight - y) / 5 * 4, + 0, + rowPosition + rowHeight - y + ); + } else if (((_b2 = spec.style) == null ? void 0 : _b2.linkConnectionType) === "straight") { + g.moveTo(x, 0); + g.lineTo(0, rowPosition + rowHeight - y); + } else { + g.moveTo(x, 0); + g.lineTo(x, rowPosition + rowHeight - y); + g.lineTo(0, rowPosition + rowHeight - y); + } + return; + } + if (circular) { + let prevX, prevY; + for (let t = 0; t <= 1; t += 0.02) { + const logodds = (t2) => Math.log(t2 / (1 - t2)); + const movingRadius = (t2) => trackOuterRadius - 1 / (1 + Math.exp(logodds(t2))) * trackRingSize + 3; + const getRadian = (t2, s, e) => ((e - s) * t2 + s) / trackWidth; + const _x = tcx + movingRadius(t) * Math.cos(-getRadian(t, x, xe) * 2 * Math.PI - Math.PI / 2); + const _y = tcy + movingRadius(t) * Math.sin(-getRadian(t, x, xe) * 2 * Math.PI - Math.PI / 2); + if (prevX && prevY) { + g.lineStyle( + strokeWidth, + colorToHex(stroke), + opacity, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + g.moveTo(prevX, prevY); + g.lineTo(_x, _y); + } + prevX = _x; + prevY = _y; + } + return; + } + g.moveTo(xe, rowPosition + rowHeight); + g.lineTo(x, rowPosition); + } + }); + }); +} +const SUPPORTED_CHANNELS = [ + "x", + "xe", + "x1", + "x1e", + "y", + "ye", + "y1", + "y1e", + "color", + "size", + "row", + "stroke", + "strokeWidth", + "opacity", + "text" + // ... +]; +function drawMark(HGC, trackInfo, tile, model) { + if (!HGC || !trackInfo || !tile) { + return; + } + if (model.spec().mark === "brush") { + return; + } + ["x", "x1", "x1e", "xe"].forEach((d) => { + model.setChannelScale(d, trackInfo._xScale); + }); + if (Is2DTrack(model.spec()) || IsVerticalRule(model.spec())) { + const yScale = trackInfo._yScale.copy(); + yScale.range([yScale.range()[1], yScale.range()[0]]); + ["y", "y1", "y1e", "ye"].forEach((d) => { + model.setChannelScale(d, yScale); + }); + } + const [trackWidth, trackHeight] = trackInfo.dimensions; + switch (model.spec().mark) { + case "point": + drawPoint(trackInfo, tile.graphics, model); + break; + case "bar": + drawBar(trackInfo, tile, model); + break; + case "line": + drawLine(tile.graphics, model, trackWidth, trackHeight); + break; + case "area": + drawArea(HGC, trackInfo, tile, model); + break; + case "rect": + drawRect(HGC, trackInfo, tile, model); + break; + case "triangleLeft": + case "triangleRight": + case "triangleBottom": + drawTriangle(tile.graphics, model, trackWidth, trackHeight); + break; + case "text": + drawText(HGC, trackInfo, tile, model); + break; + case "rule": + drawRule(HGC, trackInfo, tile, model); + break; + case "betweenLink": + drawBetweenLink(tile.graphics, trackInfo, model); + break; + case "withinLink": + drawWithinLink(tile.graphics, trackInfo, model); + break; + default: + console.warn("Unsupported mark type"); + break; + } +} +function drawPreEmbellishment(HGC, trackInfo, tile, model, theme) { + if (!HGC || !trackInfo || !tile) { + return; + } + if (model.spec().mark === "brush") { + return; + } + ["x", "x1", "x1e", "xe"].forEach((d) => { + model.setChannelScale(d, trackInfo._xScale); + }); + const isCircular = model.spec().layout === "circular"; + if (isCircular) { + drawCircularOutlines(trackInfo, model, theme); + } else { + drawBackground(trackInfo, model, theme); + drawChartOutlines(trackInfo, model, theme); + } + drawGrid(trackInfo, model, theme); +} +function drawPostEmbellishment(HGC, trackInfo, tile, model, theme) { + if (!HGC || !trackInfo || !tile) { + return; + } + if (model.spec().mark === "brush") { + return; + } + ["x", "x1", "x1e", "xe"].forEach((d) => { + model.setChannelScale(d, trackInfo._xScale); + }); + const isCircular = model.spec().layout === "circular"; + if (isCircular) { + drawCircularYAxis(HGC, trackInfo, tile, model, theme); + drawCircularTitle(HGC, trackInfo, tile, model, theme); + } else { + drawLinearYAxis(HGC, trackInfo, tile, model, theme); + drawRowLegend(HGC, trackInfo, tile, model, theme); + } + drawColorLegend(HGC, trackInfo, tile, model, theme); +} +function resolveSuperposedTracks(track) { + if (IsDataTrack(track) || IsDummyTrack(track)) { + return []; + } + if (!IsOverlaidTrack(track)) { + return [track]; + } + if (track._overlay.length === 0) { + return [{ ...track, superpose: void 0 }]; + } + const { _overlay, ...base } = track; + const resolved = []; + track._overlay.forEach((subSpec, i) => { + const spec = Object.assign({}, base, subSpec); + if (spec.title && i !== 0) { + delete spec.title; + } + resolved.push(spec); + }); + let xAxisPosition = void 0; + resolved.forEach((d) => { + if (IsChannelDeep(d.x) && d.x.axis && !xAxisPosition) { + xAxisPosition = d.x.axis; + } + }); + const corrected = resolved.map((d) => { + return { + ...d, + x: { ...d.x, axis: xAxisPosition } + }; + }); + return corrected; +} +function spreadTracksByData(tracks) { + return [].concat( + ...tracks.map((t) => { + if (IsDataTrack(t) || !IsOverlaidTrack(t) || t._overlay.length <= 1) { + return [t]; + } + if (t._overlay.filter((s) => s.data).length === 0) { + return [t]; + } + if (isIdenticalDataSpec([t.data, ...t._overlay.map((s) => s.data)])) { + return [t]; + } + const base = { ...t, id: void 0, _overlay: void 0 }; + const spread = []; + const original = JSON.parse(JSON.stringify(base)); + original._overlay = []; + t._overlay.forEach((subSpec) => { + if (!original.data) { + original.data = subSpec.data; + } + if (!original.id) { + original.id = subSpec.id; + } + if (!subSpec.data || isIdenticalDataSpec([original.data, subSpec.data])) { + original._overlay.push(subSpec); + return; + } + const spec = Object.assign(JSON.parse(JSON.stringify(base)), subSpec); + spread.push(spec); + }); + const output = original._overlay.length > 0 ? [original, ...spread] : spread; + return output.map((track, i, arr) => { + const overlayOnPreviousTrack = i !== 0; + const y = IsSingleTrack(track) && IsChannelDeep(track.y) && !track.y.axis && overlayOnPreviousTrack ? { ...track.y, axis: i === 1 ? "right" : "none" } : IsSingleTrack(track) ? track.y : void 0; + if (track.title && i !== arr.length - 1 && arr.length !== 1) { + delete track.title; + } + return { ...track, overlayOnPreviousTrack, y }; + }); + }) + ); +} +function isIdenticalDataSpec(specs) { + if (specs.length === 0) { + return false; + } + const definedSpecs = specs.filter((d) => d); + if (definedSpecs.length !== specs.length) { + return false; + } + const keys = Object.keys(definedSpecs[0]).sort(); + let isIdentical = true; + keys.forEach((k) => { + const uniqueProperties = Array.from(new Set(definedSpecs.map((d) => JSON.stringify(d[k])))); + if (uniqueProperties.length !== 1) { + isIdentical = false; + return; + } + }); + return isIdentical; +} +const PREDEFINED_COLOR_STR_MAP = { + viridis: interpolateViridis, + grey: interpolateGreys, + warm: interpolateWarm, + spectral: interpolateSpectral, + cividis: interpolateCividis, + bupu: interpolateBuPu, + rdbu: interpolateRdBu, + hot: interpolateYlOrBr, + pink: interpolateRdPu +}; +function isObject(x) { + return typeof x === "object" && x !== null; +} +function isTabularDataFetcher(dataFetcher) { + return isObject(dataFetcher) && "getTabularData" in dataFetcher; +} +function hasDataTransform(spec, type2) { + var _a; + return ((_a = spec.dataTransform) != null ? _a : []).some((d) => d.type === type2); +} +function getHiGlassColorRange(colorStr = "viridis", step = 100) { + var _a; + const interpolate = (_a = PREDEFINED_COLOR_STR_MAP[colorStr]) != null ? _a : PREDEFINED_COLOR_STR_MAP["viridis"]; + return [...Array(step)].map((_, i) => interpolate(1 / step * i)); +} +function IsFlatTracks(_) { + return !("alignment" in _) && !_.tracks.find((d) => d.alignment === "overlay" || "tracks" in d); +} +function IsOverlaidTracks(_) { + return "alignment" in _ && _.alignment === "overlay"; +} +function IsStackedTracks(_) { + return !IsFlatTracks(_) && !IsOverlaidTracks(_); +} +function IsDataTrack(_) { + return !IsOverlaidTrack(_) && "data" in _ && !("mark" in _); +} +function IsDummyTrack(_) { + return "type" in _ && _.type == "dummy-track"; +} +function IsDataTemplate(_) { + return !!("data" in _ && "overrideTemplate" in _ && _.overrideTemplate); +} +function IsDataDeep(data2) { + return typeof data2 === "object"; +} +function IsDomainChr(domain) { + return "chromosome" in domain && !("interval" in domain); +} +function IsDomainInterval(domain) { + return !("chromosome" in domain) && "interval" in domain; +} +function IsDomainChrInterval(domain) { + return "chromosome" in domain && "interval" in domain; +} +function IsSingleTrack(track) { + return !("_overlay" in track); +} +function IsOverlaidTrack(track) { + return "_overlay" in track; +} +function IsTemplateTrack(track) { + return "template" in track; +} +function IsVerticalRule(track) { + return IsSingleTrack(track) && !IsChannelDeep(track.x) && IsChannelDeep(track.y) && track.y.type === "genomic"; +} +function Is2DTrack(track) { + const t = IsSingleTrack(track) ? track : resolveSuperposedTracks(track)[0]; + return IsChannelDeep(t.x) && t.x.type === "genomic" && IsChannelDeep(t.y) && t.y.type === "genomic"; +} +function IsHiGlassMatrix(track) { + return Is2DTrack(track) && track.data.type === "matrix" && (track.mark === "bar" || track.mark === "rect") && track.xe && track.ye; +} +function IsChannelValue(channel) { + return channel !== null && typeof channel === "object" && "value" in channel; +} +function IsDataDeepTileset(_) { + return _ !== void 0 && (_.type === "vector" || _.type === "beddb" || _.type === "multivec" || _.type === "bigwig" || _.type === "matrix" || _.type === "bam" || _.type === "vcf" || _.type === "gff" || _.type === "bed"); +} +function IsChannelDeep(channel) { + return isObject(channel) && !("value" in channel); +} +function IsOneOfFilter(_) { + return "oneOf" in _; +} +function IsRangeFilter(_) { + return "inRange" in _; +} +function IsIncludeFilter(_) { + return "include" in _; +} +function IsDomainArray(domain) { + return Array.isArray(domain); +} +function IsRangeArray(range) { + return Array.isArray(range); +} +function IsStackedMark(track) { + return (track.mark === "bar" || track.mark === "area" || track.mark === "text") && IsChannelDeep(track.color) && track.color.type === "nominal" && (!track.row || IsChannelValue(track.row)) && // TODO: determine whether to use stacked bar for nominal fields or not + IsChannelDeep(track.y) && track.y.type === "quantitative" && !IsChannelDeep(track.ye); +} +function IsStackedChannel(track, channelKey) { + const channel = track[channelKey]; + return IsStackedMark(track) && // only x or y channel can be stacked + (channelKey === "x" || channelKey === "y") && // only quantitative channel can be stacked + IsChannelDeep(channel) && channel.type === "quantitative"; +} +function getValueUsingChannel(datum, channel) { + if (IsChannelDeep(channel) && channel.field) { + return datum[channel == null ? void 0 : channel.field]; + } + return void 0; +} +function getChannelKeysByAggregateFnc(spec) { + const keys = []; + SUPPORTED_CHANNELS.forEach((k) => { + const c = spec[k]; + if (IsChannelDeep(c) && "aggregate" in c) { + keys.push(k); + } + }); + return keys; +} +function getChannelKeysByType(spec, t) { + const keys = []; + SUPPORTED_CHANNELS.forEach((k) => { + const c = spec[k]; + if (IsChannelDeep(c) && c.type === t) { + keys.push(k); + } + }); + return keys; +} +function IsXAxis(_) { + if ((IsSingleTrack(_) || IsOverlaidTrack(_)) && IsChannelDeep(_.x) && _.x.axis && _.x.axis !== "none") { + return true; + } else if (IsOverlaidTrack(_)) { + let isFound = false; + _._overlay.forEach((t) => { + if (isFound) + return; + if (IsChannelDeep(t.x) && t.x.axis && t.x.axis !== "none") { + isFound = true; + } + }); + return isFound; + } + return false; +} +function IsYAxis(_) { + if ((IsSingleTrack(_) || IsOverlaidTrack(_)) && IsChannelDeep(_.y) && _.y.axis && _.y.axis !== "none") { + return true; + } else if (IsOverlaidTrack(_)) { + let isFound = false; + _._overlay.forEach((t) => { + if (isFound) + return; + if (IsChannelDeep(t.y) && t.y.axis && t.y.axis !== "none") { + isFound = true; + } + }); + return isFound; + } + return false; +} +function IsMouseEventsDeep(_) { + return typeof _ === "object"; +} +var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; +function getDefaultExportFromCjs(x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; +} +var uri_all = { exports: {} }; +/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ +(function(module, exports) { + (function(global2, factory) { + factory(exports); + })(commonjsGlobal, function(exports2) { + function merge() { + for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) { + sets[_key] = arguments[_key]; + } + if (sets.length > 1) { + sets[0] = sets[0].slice(0, -1); + var xl = sets.length - 1; + for (var x = 1; x < xl; ++x) { + sets[x] = sets[x].slice(1, -1); + } + sets[xl] = sets[xl].slice(1); + return sets.join(""); + } else { + return sets[0]; + } + } + function subexp(str) { + return "(?:" + str + ")"; + } + function typeOf(o) { + return o === void 0 ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase(); + } + function toUpperCase(str) { + return str.toUpperCase(); + } + function toArray(obj) { + return obj !== void 0 && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : []; + } + function assign(target, source) { + var obj = target; + if (source) { + for (var key in source) { + obj[key] = source[key]; + } + } + return obj; + } + function buildExps(isIRI) { + var ALPHA$$ = "[A-Za-z]", DIGIT$$ = "[0-9]", HEXDIG$$2 = merge(DIGIT$$, "[A-Fa-f]"), PCT_ENCODED$2 = subexp(subexp("%[EFef]" + HEXDIG$$2 + "%" + HEXDIG$$2 + HEXDIG$$2 + "%" + HEXDIG$$2 + HEXDIG$$2) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$2 + "%" + HEXDIG$$2 + HEXDIG$$2) + "|" + subexp("%" + HEXDIG$$2 + HEXDIG$$2)), GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]", SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", UNRESERVED$$2 = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$); + subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"); + subexp(subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\:]")) + "*"); + var DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$), H16$ = subexp(HEXDIG$$2 + "{1,4}"), LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$), IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$), IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$), IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"), IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")), ZONEID$ = subexp(subexp(UNRESERVED$$2 + "|" + PCT_ENCODED$2) + "+"); + subexp("[vV]" + HEXDIG$$2 + "+\\." + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\:]") + "+"); + subexp(subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$)) + "*"); + var PCHAR$ = subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\:\\@]")); + subexp(subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\@]")) + "+"); + subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"); + return { + NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"), + NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$2, SUB_DELIMS$$), "g"), + NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$2, SUB_DELIMS$$), "g"), + NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$2, SUB_DELIMS$$), "g"), + NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$2, SUB_DELIMS$$), "g"), + NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$2, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"), + NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$2, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"), + ESCAPE: new RegExp(merge("[^]", UNRESERVED$$2, SUB_DELIMS$$), "g"), + UNRESERVED: new RegExp(UNRESERVED$$2, "g"), + OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$2, RESERVED$$), "g"), + PCT_ENCODED: new RegExp(PCT_ENCODED$2, "g"), + IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"), + IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$2 + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") + //RFC 6874, with relaxed parsing rules + }; + } + var URI_PROTOCOL = buildExps(false); + var IRI_PROTOCOL = buildExps(true); + var slicedToArray = function() { + function sliceIterator(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = void 0; + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + if (i && _arr.length === i) + break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"]) + _i["return"](); + } finally { + if (_d) + throw _e; + } + } + return _arr; + } + return function(arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if (Symbol.iterator in Object(arr)) { + return sliceIterator(arr, i); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; + }(); + var toConsumableArray = function(arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) + arr2[i] = arr[i]; + return arr2; + } else { + return Array.from(arr); + } + }; + var maxInt = 2147483647; + var base = 36; + var tMin = 1; + var tMax = 26; + var skew = 38; + var damp = 700; + var initialBias = 72; + var initialN = 128; + var delimiter = "-"; + var regexPunycode = /^xn--/; + var regexNonASCII = /[^\0-\x7E]/; + var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; + var errors = { + "overflow": "Overflow: input needs wider integers to process", + "not-basic": "Illegal input >= 0x80 (not a basic code point)", + "invalid-input": "Invalid input" + }; + var baseMinusTMin = base - tMin; + var floor = Math.floor; + var stringFromCharCode = String.fromCharCode; + function error$1(type2) { + throw new RangeError(errors[type2]); + } + function map(array, fn) { + var result = []; + var length = array.length; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + function mapDomain(string, fn) { + var parts = string.split("@"); + var result = ""; + if (parts.length > 1) { + result = parts[0] + "@"; + string = parts[1]; + } + string = string.replace(regexSeparators, "."); + var labels = string.split("."); + var encoded = map(labels, fn).join("."); + return result + encoded; + } + function ucs2decode(string) { + var output = []; + var counter = 0; + var length = string.length; + while (counter < length) { + var value = string.charCodeAt(counter++); + if (value >= 55296 && value <= 56319 && counter < length) { + var extra = string.charCodeAt(counter++); + if ((extra & 64512) == 56320) { + output.push(((value & 1023) << 10) + (extra & 1023) + 65536); + } else { + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + var ucs2encode = function ucs2encode2(array) { + return String.fromCodePoint.apply(String, toConsumableArray(array)); + }; + var basicToDigit = function basicToDigit2(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + }; + var digitToBasic = function digitToBasic2(digit, flag) { + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + }; + var adapt = function adapt2(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for ( + ; + /* no initialization */ + delta > baseMinusTMin * tMax >> 1; + k += base + ) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + }; + var decode = function decode2(input) { + var output = []; + var inputLength = input.length; + var i = 0; + var n = initialN; + var bias = initialBias; + var basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + for (var j = 0; j < basic; ++j) { + if (input.charCodeAt(j) >= 128) { + error$1("not-basic"); + } + output.push(input.charCodeAt(j)); + } + for (var index = basic > 0 ? basic + 1 : 0; index < inputLength; ) { + var oldi = i; + for ( + var w = 1, k = base; + ; + /* no condition */ + k += base + ) { + if (index >= inputLength) { + error$1("invalid-input"); + } + var digit = basicToDigit(input.charCodeAt(index++)); + if (digit >= base || digit > floor((maxInt - i) / w)) { + error$1("overflow"); + } + i += digit * w; + var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; + if (digit < t) { + break; + } + var baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error$1("overflow"); + } + w *= baseMinusT; + } + var out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + if (floor(i / out) > maxInt - n) { + error$1("overflow"); + } + n += floor(i / out); + i %= out; + output.splice(i++, 0, n); + } + return String.fromCodePoint.apply(String, output); + }; + var encode = function encode2(input) { + var output = []; + input = ucs2decode(input); + var inputLength = input.length; + var n = initialN; + var delta = 0; + var bias = initialBias; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = void 0; + try { + for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var _currentValue2 = _step.value; + if (_currentValue2 < 128) { + output.push(stringFromCharCode(_currentValue2)); + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + var basicLength = output.length; + var handledCPCount = basicLength; + if (basicLength) { + output.push(delimiter); + } + while (handledCPCount < inputLength) { + var m = maxInt; + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = void 0; + try { + for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var currentValue = _step2.value; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + var handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error$1("overflow"); + } + delta += (m - n) * handledCPCountPlusOne; + n = m; + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = void 0; + try { + for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var _currentValue = _step3.value; + if (_currentValue < n && ++delta > maxInt) { + error$1("overflow"); + } + if (_currentValue == n) { + var q = delta; + for ( + var k = base; + ; + /* no condition */ + k += base + ) { + var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; + if (q < t) { + break; + } + var qMinusT = q - t; + var baseMinusT = base - t; + output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))); + q = floor(qMinusT / baseMinusT); + } + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + ++delta; + ++n; + } + return output.join(""); + }; + var toUnicode = function toUnicode2(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; + }); + }; + var toASCII = function toASCII2(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) ? "xn--" + encode(string) : string; + }); + }; + var punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + "version": "2.1.0", + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + "ucs2": { + "decode": ucs2decode, + "encode": ucs2encode + }, + "decode": decode, + "encode": encode, + "toASCII": toASCII, + "toUnicode": toUnicode + }; + var SCHEMES = {}; + function pctEncChar(chr) { + var c = chr.charCodeAt(0); + var e = void 0; + if (c < 16) + e = "%0" + c.toString(16).toUpperCase(); + else if (c < 128) + e = "%" + c.toString(16).toUpperCase(); + else if (c < 2048) + e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(); + else + e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(); + return e; + } + function pctDecChars(str) { + var newStr = ""; + var i = 0; + var il = str.length; + while (i < il) { + var c = parseInt(str.substr(i + 1, 2), 16); + if (c < 128) { + newStr += String.fromCharCode(c); + i += 3; + } else if (c >= 194 && c < 224) { + if (il - i >= 6) { + var c2 = parseInt(str.substr(i + 4, 2), 16); + newStr += String.fromCharCode((c & 31) << 6 | c2 & 63); + } else { + newStr += str.substr(i, 6); + } + i += 6; + } else if (c >= 224) { + if (il - i >= 9) { + var _c = parseInt(str.substr(i + 4, 2), 16); + var c3 = parseInt(str.substr(i + 7, 2), 16); + newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63); + } else { + newStr += str.substr(i, 9); + } + i += 9; + } else { + newStr += str.substr(i, 3); + i += 3; + } + } + return newStr; + } + function _normalizeComponentEncoding(components, protocol) { + function decodeUnreserved2(str) { + var decStr = pctDecChars(str); + return !decStr.match(protocol.UNRESERVED) ? str : decStr; + } + if (components.scheme) + components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved2).toLowerCase().replace(protocol.NOT_SCHEME, ""); + if (components.userinfo !== void 0) + components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.host !== void 0) + components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved2).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.path !== void 0) + components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.query !== void 0) + components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + if (components.fragment !== void 0) + components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); + return components; + } + function _stripLeadingZeros(str) { + return str.replace(/^0*(.*)/, "$1") || "0"; + } + function _normalizeIPv4(host, protocol) { + var matches = host.match(protocol.IPV4ADDRESS) || []; + var _matches = slicedToArray(matches, 2), address = _matches[1]; + if (address) { + return address.split(".").map(_stripLeadingZeros).join("."); + } else { + return host; + } + } + function _normalizeIPv6(host, protocol) { + var matches = host.match(protocol.IPV6ADDRESS) || []; + var _matches2 = slicedToArray(matches, 3), address = _matches2[1], zone = _matches2[2]; + if (address) { + var _address$toLowerCase$ = address.toLowerCase().split("::").reverse(), _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2), last = _address$toLowerCase$2[0], first = _address$toLowerCase$2[1]; + var firstFields = first ? first.split(":").map(_stripLeadingZeros) : []; + var lastFields = last.split(":").map(_stripLeadingZeros); + var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]); + var fieldCount = isLastFieldIPv4Address ? 7 : 8; + var lastFieldsStart = lastFields.length - fieldCount; + var fields = Array(fieldCount); + for (var x = 0; x < fieldCount; ++x) { + fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || ""; + } + if (isLastFieldIPv4Address) { + fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol); + } + var allZeroFields = fields.reduce(function(acc, field, index) { + if (!field || field === "0") { + var lastLongest = acc[acc.length - 1]; + if (lastLongest && lastLongest.index + lastLongest.length === index) { + lastLongest.length++; + } else { + acc.push({ index, length: 1 }); + } + } + return acc; + }, []); + var longestZeroFields = allZeroFields.sort(function(a, b) { + return b.length - a.length; + })[0]; + var newHost = void 0; + if (longestZeroFields && longestZeroFields.length > 1) { + var newFirst = fields.slice(0, longestZeroFields.index); + var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length); + newHost = newFirst.join(":") + "::" + newLast.join(":"); + } else { + newHost = fields.join(":"); + } + if (zone) { + newHost += "%" + zone; + } + return newHost; + } else { + return host; + } + } + var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i; + var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === void 0; + function parse(uriString) { + var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + var components = {}; + var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; + if (options.reference === "suffix") + uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString; + var matches = uriString.match(URI_PARSE); + if (matches) { + if (NO_MATCH_IS_UNDEFINED) { + components.scheme = matches[1]; + components.userinfo = matches[3]; + components.host = matches[4]; + components.port = parseInt(matches[5], 10); + components.path = matches[6] || ""; + components.query = matches[7]; + components.fragment = matches[8]; + if (isNaN(components.port)) { + components.port = matches[5]; + } + } else { + components.scheme = matches[1] || void 0; + components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : void 0; + components.host = uriString.indexOf("//") !== -1 ? matches[4] : void 0; + components.port = parseInt(matches[5], 10); + components.path = matches[6] || ""; + components.query = uriString.indexOf("?") !== -1 ? matches[7] : void 0; + components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : void 0; + if (isNaN(components.port)) { + components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : void 0; + } + } + if (components.host) { + components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol); + } + if (components.scheme === void 0 && components.userinfo === void 0 && components.host === void 0 && components.port === void 0 && !components.path && components.query === void 0) { + components.reference = "same-document"; + } else if (components.scheme === void 0) { + components.reference = "relative"; + } else if (components.fragment === void 0) { + components.reference = "absolute"; + } else { + components.reference = "uri"; + } + if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) { + components.error = components.error || "URI is not a " + options.reference + " reference."; + } + var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; + if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) { + if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) { + try { + components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()); + } catch (e) { + components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e; + } + } + _normalizeComponentEncoding(components, URI_PROTOCOL); + } else { + _normalizeComponentEncoding(components, protocol); + } + if (schemeHandler && schemeHandler.parse) { + schemeHandler.parse(components, options); + } + } else { + components.error = components.error || "URI can not be parsed."; + } + return components; + } + function _recomposeAuthority(components, options) { + var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; + var uriTokens = []; + if (components.userinfo !== void 0) { + uriTokens.push(components.userinfo); + uriTokens.push("@"); + } + if (components.host !== void 0) { + uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function(_, $1, $2) { + return "[" + $1 + ($2 ? "%25" + $2 : "") + "]"; + })); + } + if (typeof components.port === "number" || typeof components.port === "string") { + uriTokens.push(":"); + uriTokens.push(String(components.port)); + } + return uriTokens.length ? uriTokens.join("") : void 0; + } + var RDS1 = /^\.\.?\//; + var RDS2 = /^\/\.(\/|$)/; + var RDS3 = /^\/\.\.(\/|$)/; + var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/; + function removeDotSegments(input) { + var output = []; + while (input.length) { + if (input.match(RDS1)) { + input = input.replace(RDS1, ""); + } else if (input.match(RDS2)) { + input = input.replace(RDS2, "/"); + } else if (input.match(RDS3)) { + input = input.replace(RDS3, "/"); + output.pop(); + } else if (input === "." || input === "..") { + input = ""; + } else { + var im = input.match(RDS5); + if (im) { + var s = im[0]; + input = input.slice(s.length); + output.push(s); + } else { + throw new Error("Unexpected dot segment condition"); + } + } + } + return output.join(""); + } + function serialize(components) { + var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL; + var uriTokens = []; + var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; + if (schemeHandler && schemeHandler.serialize) + schemeHandler.serialize(components, options); + if (components.host) { + if (protocol.IPV6ADDRESS.test(components.host)) + ; + else if (options.domainHost || schemeHandler && schemeHandler.domainHost) { + try { + components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host); + } catch (e) { + components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; + } + } + } + _normalizeComponentEncoding(components, protocol); + if (options.reference !== "suffix" && components.scheme) { + uriTokens.push(components.scheme); + uriTokens.push(":"); + } + var authority = _recomposeAuthority(components, options); + if (authority !== void 0) { + if (options.reference !== "suffix") { + uriTokens.push("//"); + } + uriTokens.push(authority); + if (components.path && components.path.charAt(0) !== "/") { + uriTokens.push("/"); + } + } + if (components.path !== void 0) { + var s = components.path; + if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { + s = removeDotSegments(s); + } + if (authority === void 0) { + s = s.replace(/^\/\//, "/%2F"); + } + uriTokens.push(s); + } + if (components.query !== void 0) { + uriTokens.push("?"); + uriTokens.push(components.query); + } + if (components.fragment !== void 0) { + uriTokens.push("#"); + uriTokens.push(components.fragment); + } + return uriTokens.join(""); + } + function resolveComponents(base2, relative) { + var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; + var skipNormalization = arguments[3]; + var target = {}; + if (!skipNormalization) { + base2 = parse(serialize(base2, options), options); + relative = parse(serialize(relative, options), options); + } + options = options || {}; + if (!options.tolerant && relative.scheme) { + target.scheme = relative.scheme; + target.userinfo = relative.userinfo; + target.host = relative.host; + target.port = relative.port; + target.path = removeDotSegments(relative.path || ""); + target.query = relative.query; + } else { + if (relative.userinfo !== void 0 || relative.host !== void 0 || relative.port !== void 0) { + target.userinfo = relative.userinfo; + target.host = relative.host; + target.port = relative.port; + target.path = removeDotSegments(relative.path || ""); + target.query = relative.query; + } else { + if (!relative.path) { + target.path = base2.path; + if (relative.query !== void 0) { + target.query = relative.query; + } else { + target.query = base2.query; + } + } else { + if (relative.path.charAt(0) === "/") { + target.path = removeDotSegments(relative.path); + } else { + if ((base2.userinfo !== void 0 || base2.host !== void 0 || base2.port !== void 0) && !base2.path) { + target.path = "/" + relative.path; + } else if (!base2.path) { + target.path = relative.path; + } else { + target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative.path; + } + target.path = removeDotSegments(target.path); + } + target.query = relative.query; + } + target.userinfo = base2.userinfo; + target.host = base2.host; + target.port = base2.port; + } + target.scheme = base2.scheme; + } + target.fragment = relative.fragment; + return target; + } + function resolve2(baseURI, relativeURI, options) { + var schemelessOptions = assign({ scheme: "null" }, options); + return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions); + } + function normalize(uri2, options) { + if (typeof uri2 === "string") { + uri2 = serialize(parse(uri2, options), options); + } else if (typeOf(uri2) === "object") { + uri2 = parse(serialize(uri2, options), options); + } + return uri2; + } + function equal3(uriA, uriB, options) { + if (typeof uriA === "string") { + uriA = serialize(parse(uriA, options), options); + } else if (typeOf(uriA) === "object") { + uriA = serialize(uriA, options); + } + if (typeof uriB === "string") { + uriB = serialize(parse(uriB, options), options); + } else if (typeOf(uriB) === "object") { + uriB = serialize(uriB, options); + } + return uriA === uriB; + } + function escapeComponent(str, options) { + return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar); + } + function unescapeComponent(str, options) { + return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars); + } + var handler = { + scheme: "http", + domainHost: true, + parse: function parse2(components, options) { + if (!components.host) { + components.error = components.error || "HTTP URIs must have a host."; + } + return components; + }, + serialize: function serialize2(components, options) { + var secure = String(components.scheme).toLowerCase() === "https"; + if (components.port === (secure ? 443 : 80) || components.port === "") { + components.port = void 0; + } + if (!components.path) { + components.path = "/"; + } + return components; + } + }; + var handler$1 = { + scheme: "https", + domainHost: handler.domainHost, + parse: handler.parse, + serialize: handler.serialize + }; + function isSecure(wsComponents) { + return typeof wsComponents.secure === "boolean" ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss"; + } + var handler$2 = { + scheme: "ws", + domainHost: true, + parse: function parse2(components, options) { + var wsComponents = components; + wsComponents.secure = isSecure(wsComponents); + wsComponents.resourceName = (wsComponents.path || "/") + (wsComponents.query ? "?" + wsComponents.query : ""); + wsComponents.path = void 0; + wsComponents.query = void 0; + return wsComponents; + }, + serialize: function serialize2(wsComponents, options) { + if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") { + wsComponents.port = void 0; + } + if (typeof wsComponents.secure === "boolean") { + wsComponents.scheme = wsComponents.secure ? "wss" : "ws"; + wsComponents.secure = void 0; + } + if (wsComponents.resourceName) { + var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path = _wsComponents$resourc2[0], query = _wsComponents$resourc2[1]; + wsComponents.path = path && path !== "/" ? path : void 0; + wsComponents.query = query; + wsComponents.resourceName = void 0; + } + wsComponents.fragment = void 0; + return wsComponents; + } + }; + var handler$3 = { + scheme: "wss", + domainHost: handler$2.domainHost, + parse: handler$2.parse, + serialize: handler$2.serialize + }; + var O = {}; + var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]"; + var HEXDIG$$ = "[0-9A-Fa-f]"; + var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); + var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]"; + var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]"; + var VCHAR$$ = merge(QTEXT$$, '[\\"\\\\]'); + var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"; + var UNRESERVED = new RegExp(UNRESERVED$$, "g"); + var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g"); + var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g"); + var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g"); + var NOT_HFVALUE = NOT_HFNAME; + function decodeUnreserved(str) { + var decStr = pctDecChars(str); + return !decStr.match(UNRESERVED) ? str : decStr; + } + var handler$4 = { + scheme: "mailto", + parse: function parse$$1(components, options) { + var mailtoComponents = components; + var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : []; + mailtoComponents.path = void 0; + if (mailtoComponents.query) { + var unknownHeaders = false; + var headers = {}; + var hfields = mailtoComponents.query.split("&"); + for (var x = 0, xl = hfields.length; x < xl; ++x) { + var hfield = hfields[x].split("="); + switch (hfield[0]) { + case "to": + var toAddrs = hfield[1].split(","); + for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) { + to.push(toAddrs[_x]); + } + break; + case "subject": + mailtoComponents.subject = unescapeComponent(hfield[1], options); + break; + case "body": + mailtoComponents.body = unescapeComponent(hfield[1], options); + break; + default: + unknownHeaders = true; + headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options); + break; + } + } + if (unknownHeaders) + mailtoComponents.headers = headers; + } + mailtoComponents.query = void 0; + for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) { + var addr = to[_x2].split("@"); + addr[0] = unescapeComponent(addr[0]); + if (!options.unicodeSupport) { + try { + addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase()); + } catch (e) { + mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e; + } + } else { + addr[1] = unescapeComponent(addr[1], options).toLowerCase(); + } + to[_x2] = addr.join("@"); + } + return mailtoComponents; + }, + serialize: function serialize$$1(mailtoComponents, options) { + var components = mailtoComponents; + var to = toArray(mailtoComponents.to); + if (to) { + for (var x = 0, xl = to.length; x < xl; ++x) { + var toAddr = String(to[x]); + var atIdx = toAddr.lastIndexOf("@"); + var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar); + var domain = toAddr.slice(atIdx + 1); + try { + domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain); + } catch (e) { + components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; + } + to[x] = localPart + "@" + domain; + } + components.path = to.join(","); + } + var headers = mailtoComponents.headers = mailtoComponents.headers || {}; + if (mailtoComponents.subject) + headers["subject"] = mailtoComponents.subject; + if (mailtoComponents.body) + headers["body"] = mailtoComponents.body; + var fields = []; + for (var name in headers) { + if (headers[name] !== O[name]) { + fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)); + } + } + if (fields.length) { + components.query = fields.join("&"); + } + return components; + } + }; + var URN_PARSE = /^([^\:]+)\:(.*)/; + var handler$5 = { + scheme: "urn", + parse: function parse$$1(components, options) { + var matches = components.path && components.path.match(URN_PARSE); + var urnComponents = components; + if (matches) { + var scheme = options.scheme || urnComponents.scheme || "urn"; + var nid = matches[1].toLowerCase(); + var nss = matches[2]; + var urnScheme = scheme + ":" + (options.nid || nid); + var schemeHandler = SCHEMES[urnScheme]; + urnComponents.nid = nid; + urnComponents.nss = nss; + urnComponents.path = void 0; + if (schemeHandler) { + urnComponents = schemeHandler.parse(urnComponents, options); + } + } else { + urnComponents.error = urnComponents.error || "URN can not be parsed."; + } + return urnComponents; + }, + serialize: function serialize$$1(urnComponents, options) { + var scheme = options.scheme || urnComponents.scheme || "urn"; + var nid = urnComponents.nid; + var urnScheme = scheme + ":" + (options.nid || nid); + var schemeHandler = SCHEMES[urnScheme]; + if (schemeHandler) { + urnComponents = schemeHandler.serialize(urnComponents, options); + } + var uriComponents = urnComponents; + var nss = urnComponents.nss; + uriComponents.path = (nid || options.nid) + ":" + nss; + return uriComponents; + } + }; + var UUID2 = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/; + var handler$6 = { + scheme: "urn:uuid", + parse: function parse2(urnComponents, options) { + var uuidComponents = urnComponents; + uuidComponents.uuid = uuidComponents.nss; + uuidComponents.nss = void 0; + if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID2))) { + uuidComponents.error = uuidComponents.error || "UUID is not valid."; + } + return uuidComponents; + }, + serialize: function serialize2(uuidComponents, options) { + var urnComponents = uuidComponents; + urnComponents.nss = (uuidComponents.uuid || "").toLowerCase(); + return urnComponents; + } + }; + SCHEMES[handler.scheme] = handler; + SCHEMES[handler$1.scheme] = handler$1; + SCHEMES[handler$2.scheme] = handler$2; + SCHEMES[handler$3.scheme] = handler$3; + SCHEMES[handler$4.scheme] = handler$4; + SCHEMES[handler$5.scheme] = handler$5; + SCHEMES[handler$6.scheme] = handler$6; + exports2.SCHEMES = SCHEMES; + exports2.pctEncChar = pctEncChar; + exports2.pctDecChars = pctDecChars; + exports2.parse = parse; + exports2.removeDotSegments = removeDotSegments; + exports2.serialize = serialize; + exports2.resolveComponents = resolveComponents; + exports2.resolve = resolve2; + exports2.normalize = normalize; + exports2.equal = equal3; + exports2.escapeComponent = escapeComponent; + exports2.unescapeComponent = unescapeComponent; + Object.defineProperty(exports2, "__esModule", { value: true }); + }); +})(uri_all, uri_all.exports); +var uri_allExports = uri_all.exports; +var fastDeepEqual = function equal(a, b) { + if (a === b) + return true; + if (a && b && typeof a == "object" && typeof b == "object") { + if (a.constructor !== b.constructor) + return false; + var length, i, keys; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) + return false; + for (i = length; i-- !== 0; ) + if (!equal(a[i], b[i])) + return false; + return true; + } + if (a.constructor === RegExp) + return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) + return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) + return a.toString() === b.toString(); + keys = Object.keys(a); + length = keys.length; + if (length !== Object.keys(b).length) + return false; + for (i = length; i-- !== 0; ) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) + return false; + for (i = length; i-- !== 0; ) { + var key = keys[i]; + if (!equal(a[key], b[key])) + return false; + } + return true; + } + return a !== a && b !== b; +}; +var ucs2length$1 = function ucs2length(str) { + var length = 0, len = str.length, pos = 0, value; + while (pos < len) { + length++; + value = str.charCodeAt(pos++); + if (value >= 55296 && value <= 56319 && pos < len) { + value = str.charCodeAt(pos); + if ((value & 64512) == 56320) + pos++; + } + } + return length; +}; +var util$5 = { + copy, + checkDataType, + checkDataTypes, + coerceToTypes, + toHash: toHash$1, + getProperty, + escapeQuotes, + equal: fastDeepEqual, + ucs2length: ucs2length$1, + varOccurences, + varReplace, + schemaHasRules, + schemaHasRulesExcept, + schemaUnknownRules, + toQuotedString, + getPathExpr, + getPath, + getData, + unescapeFragment, + unescapeJsonPointer, + escapeFragment, + escapeJsonPointer +}; +function copy(o, to) { + to = to || {}; + for (var key in o) + to[key] = o[key]; + return to; +} +function checkDataType(dataType, data2, strictNumbers, negate) { + var EQUAL = negate ? " !== " : " === ", AND = negate ? " || " : " && ", OK = negate ? "!" : "", NOT = negate ? "" : "!"; + switch (dataType) { + case "null": + return data2 + EQUAL + "null"; + case "array": + return OK + "Array.isArray(" + data2 + ")"; + case "object": + return "(" + OK + data2 + AND + "typeof " + data2 + EQUAL + '"object"' + AND + NOT + "Array.isArray(" + data2 + "))"; + case "integer": + return "(typeof " + data2 + EQUAL + '"number"' + AND + NOT + "(" + data2 + " % 1)" + AND + data2 + EQUAL + data2 + (strictNumbers ? AND + OK + "isFinite(" + data2 + ")" : "") + ")"; + case "number": + return "(typeof " + data2 + EQUAL + '"' + dataType + '"' + (strictNumbers ? AND + OK + "isFinite(" + data2 + ")" : "") + ")"; + default: + return "typeof " + data2 + EQUAL + '"' + dataType + '"'; + } +} +function checkDataTypes(dataTypes, data2, strictNumbers) { + switch (dataTypes.length) { + case 1: + return checkDataType(dataTypes[0], data2, strictNumbers, true); + default: + var code = ""; + var types = toHash$1(dataTypes); + if (types.array && types.object) { + code = types.null ? "(" : "(!" + data2 + " || "; + code += "typeof " + data2 + ' !== "object")'; + delete types.null; + delete types.array; + delete types.object; + } + if (types.number) + delete types.integer; + for (var t in types) + code += (code ? " && " : "") + checkDataType(t, data2, strictNumbers, true); + return code; + } +} +var COERCE_TO_TYPES = toHash$1(["string", "number", "integer", "boolean", "null"]); +function coerceToTypes(optionCoerceTypes, dataTypes) { + if (Array.isArray(dataTypes)) { + var types = []; + for (var i = 0; i < dataTypes.length; i++) { + var t = dataTypes[i]; + if (COERCE_TO_TYPES[t]) + types[types.length] = t; + else if (optionCoerceTypes === "array" && t === "array") + types[types.length] = t; + } + if (types.length) + return types; + } else if (COERCE_TO_TYPES[dataTypes]) { + return [dataTypes]; + } else if (optionCoerceTypes === "array" && dataTypes === "array") { + return ["array"]; + } +} +function toHash$1(arr) { + var hash = {}; + for (var i = 0; i < arr.length; i++) + hash[arr[i]] = true; + return hash; +} +var IDENTIFIER$1 = /^[a-z$_][a-z$_0-9]*$/i; +var SINGLE_QUOTE = /'|\\/g; +function getProperty(key) { + return typeof key == "number" ? "[" + key + "]" : IDENTIFIER$1.test(key) ? "." + key : "['" + escapeQuotes(key) + "']"; +} +function escapeQuotes(str) { + return str.replace(SINGLE_QUOTE, "\\$&").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\f/g, "\\f").replace(/\t/g, "\\t"); +} +function varOccurences(str, dataVar) { + dataVar += "[^0-9]"; + var matches = str.match(new RegExp(dataVar, "g")); + return matches ? matches.length : 0; +} +function varReplace(str, dataVar, expr) { + dataVar += "([^0-9])"; + expr = expr.replace(/\$/g, "$$$$"); + return str.replace(new RegExp(dataVar, "g"), expr + "$1"); +} +function schemaHasRules(schema, rules3) { + if (typeof schema == "boolean") + return !schema; + for (var key in schema) + if (rules3[key]) + return true; +} +function schemaHasRulesExcept(schema, rules3, exceptKeyword) { + if (typeof schema == "boolean") + return !schema && exceptKeyword != "not"; + for (var key in schema) + if (key != exceptKeyword && rules3[key]) + return true; +} +function schemaUnknownRules(schema, rules3) { + if (typeof schema == "boolean") + return; + for (var key in schema) + if (!rules3[key]) + return key; +} +function toQuotedString(str) { + return "'" + escapeQuotes(str) + "'"; +} +function getPathExpr(currentPath, expr, jsonPointers, isNumber) { + var path = jsonPointers ? "'/' + " + expr + (isNumber ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : isNumber ? "'[' + " + expr + " + ']'" : "'[\\'' + " + expr + " + '\\']'"; + return joinPaths(currentPath, path); +} +function getPath(currentPath, prop, jsonPointers) { + var path = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop)); + return joinPaths(currentPath, path); +} +var JSON_POINTER$1 = /^\/(?:[^~]|~0|~1)*$/; +var RELATIVE_JSON_POINTER$1 = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function getData($data, lvl, paths) { + var up, jsonPointer, data2, matches; + if ($data === "") + return "rootData"; + if ($data[0] == "/") { + if (!JSON_POINTER$1.test($data)) + throw new Error("Invalid JSON-pointer: " + $data); + jsonPointer = $data; + data2 = "rootData"; + } else { + matches = $data.match(RELATIVE_JSON_POINTER$1); + if (!matches) + throw new Error("Invalid JSON-pointer: " + $data); + up = +matches[1]; + jsonPointer = matches[2]; + if (jsonPointer == "#") { + if (up >= lvl) + throw new Error("Cannot access property/index " + up + " levels up, current level is " + lvl); + return paths[lvl - up]; + } + if (up > lvl) + throw new Error("Cannot access data " + up + " levels up, current level is " + lvl); + data2 = "data" + (lvl - up || ""); + if (!jsonPointer) + return data2; + } + var expr = data2; + var segments = jsonPointer.split("/"); + for (var i = 0; i < segments.length; i++) { + var segment = segments[i]; + if (segment) { + data2 += getProperty(unescapeJsonPointer(segment)); + expr += " && " + data2; + } + } + return expr; +} +function joinPaths(a, b) { + if (a == '""') + return b; + return (a + " + " + b).replace(/([^\\])' \+ '/g, "$1"); +} +function unescapeFragment(str) { + return unescapeJsonPointer(decodeURIComponent(str)); +} +function escapeFragment(str) { + return encodeURIComponent(escapeJsonPointer(str)); +} +function escapeJsonPointer(str) { + return str.replace(/~/g, "~0").replace(/\//g, "~1"); +} +function unescapeJsonPointer(str) { + return str.replace(/~1/g, "/").replace(/~0/g, "~"); +} +var util$4 = util$5; +var schema_obj = SchemaObject$2; +function SchemaObject$2(obj) { + util$4.copy(obj, this); +} +var jsonSchemaTraverse = { exports: {} }; +var traverse$1 = jsonSchemaTraverse.exports = function(schema, opts, cb) { + if (typeof opts == "function") { + cb = opts; + opts = {}; + } + cb = opts.cb || cb; + var pre = typeof cb == "function" ? cb : cb.pre || function() { + }; + var post = cb.post || function() { + }; + _traverse(opts, pre, post, schema, "", schema); +}; +traverse$1.keywords = { + additionalItems: true, + items: true, + contains: true, + additionalProperties: true, + propertyNames: true, + not: true +}; +traverse$1.arrayKeywords = { + items: true, + allOf: true, + anyOf: true, + oneOf: true +}; +traverse$1.propsKeywords = { + definitions: true, + properties: true, + patternProperties: true, + dependencies: true +}; +traverse$1.skipKeywords = { + default: true, + enum: true, + const: true, + required: true, + maximum: true, + minimum: true, + exclusiveMaximum: true, + exclusiveMinimum: true, + multipleOf: true, + maxLength: true, + minLength: true, + pattern: true, + format: true, + maxItems: true, + minItems: true, + uniqueItems: true, + maxProperties: true, + minProperties: true +}; +function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { + if (schema && typeof schema == "object" && !Array.isArray(schema)) { + pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); + for (var key in schema) { + var sch = schema[key]; + if (Array.isArray(sch)) { + if (key in traverse$1.arrayKeywords) { + for (var i = 0; i < sch.length; i++) + _traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key, schema, i); + } + } else if (key in traverse$1.propsKeywords) { + if (sch && typeof sch == "object") { + for (var prop in sch) + _traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop); + } + } else if (key in traverse$1.keywords || opts.allKeys && !(key in traverse$1.skipKeywords)) { + _traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema); + } + } + post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); + } +} +function escapeJsonPtr(str) { + return str.replace(/~/g, "~0").replace(/\//g, "~1"); +} +var jsonSchemaTraverseExports = jsonSchemaTraverse.exports; +var URI$1 = uri_allExports, equal$1 = fastDeepEqual, util$3 = util$5, SchemaObject$1 = schema_obj, traverse = jsonSchemaTraverseExports; +var resolve_1 = resolve$3; +resolve$3.normalizeId = normalizeId; +resolve$3.fullPath = getFullPath; +resolve$3.url = resolveUrl; +resolve$3.ids = resolveIds; +resolve$3.inlineRef = inlineRef; +resolve$3.schema = resolveSchema; +function resolve$3(compile2, root, ref2) { + var refVal = this._refs[ref2]; + if (typeof refVal == "string") { + if (this._refs[refVal]) + refVal = this._refs[refVal]; + else + return resolve$3.call(this, compile2, root, refVal); + } + refVal = refVal || this._schemas[ref2]; + if (refVal instanceof SchemaObject$1) { + return inlineRef(refVal.schema, this._opts.inlineRefs) ? refVal.schema : refVal.validate || this._compile(refVal); + } + var res = resolveSchema.call(this, root, ref2); + var schema, v, baseId; + if (res) { + schema = res.schema; + root = res.root; + baseId = res.baseId; + } + if (schema instanceof SchemaObject$1) { + v = schema.validate || compile2.call(this, schema.schema, root, void 0, baseId); + } else if (schema !== void 0) { + v = inlineRef(schema, this._opts.inlineRefs) ? schema : compile2.call(this, schema, root, void 0, baseId); + } + return v; +} +function resolveSchema(root, ref2) { + var p = URI$1.parse(ref2), refPath = _getFullPath(p), baseId = getFullPath(this._getId(root.schema)); + if (Object.keys(root.schema).length === 0 || refPath !== baseId) { + var id = normalizeId(refPath); + var refVal = this._refs[id]; + if (typeof refVal == "string") { + return resolveRecursive.call(this, root, refVal, p); + } else if (refVal instanceof SchemaObject$1) { + if (!refVal.validate) + this._compile(refVal); + root = refVal; + } else { + refVal = this._schemas[id]; + if (refVal instanceof SchemaObject$1) { + if (!refVal.validate) + this._compile(refVal); + if (id == normalizeId(ref2)) + return { schema: refVal, root, baseId }; + root = refVal; + } else { + return; + } + } + if (!root.schema) + return; + baseId = getFullPath(this._getId(root.schema)); + } + return getJsonPointer.call(this, p, baseId, root.schema, root); +} +function resolveRecursive(root, ref2, parsedRef) { + var res = resolveSchema.call(this, root, ref2); + if (res) { + var schema = res.schema; + var baseId = res.baseId; + root = res.root; + var id = this._getId(schema); + if (id) + baseId = resolveUrl(baseId, id); + return getJsonPointer.call(this, parsedRef, baseId, schema, root); + } +} +var PREVENT_SCOPE_CHANGE = util$3.toHash(["properties", "patternProperties", "enum", "dependencies", "definitions"]); +function getJsonPointer(parsedRef, baseId, schema, root) { + parsedRef.fragment = parsedRef.fragment || ""; + if (parsedRef.fragment.slice(0, 1) != "/") + return; + var parts = parsedRef.fragment.split("/"); + for (var i = 1; i < parts.length; i++) { + var part = parts[i]; + if (part) { + part = util$3.unescapeFragment(part); + schema = schema[part]; + if (schema === void 0) + break; + var id; + if (!PREVENT_SCOPE_CHANGE[part]) { + id = this._getId(schema); + if (id) + baseId = resolveUrl(baseId, id); + if (schema.$ref) { + var $ref = resolveUrl(baseId, schema.$ref); + var res = resolveSchema.call(this, root, $ref); + if (res) { + schema = res.schema; + root = res.root; + baseId = res.baseId; + } + } + } + } + } + if (schema !== void 0 && schema !== root.schema) + return { schema, root, baseId }; +} +var SIMPLE_INLINED = util$3.toHash([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum" +]); +function inlineRef(schema, limit) { + if (limit === false) + return false; + if (limit === void 0 || limit === true) + return checkNoRef(schema); + else if (limit) + return countKeys(schema) <= limit; +} +function checkNoRef(schema) { + var item; + if (Array.isArray(schema)) { + for (var i = 0; i < schema.length; i++) { + item = schema[i]; + if (typeof item == "object" && !checkNoRef(item)) + return false; + } + } else { + for (var key in schema) { + if (key == "$ref") + return false; + item = schema[key]; + if (typeof item == "object" && !checkNoRef(item)) + return false; + } + } + return true; +} +function countKeys(schema) { + var count = 0, item; + if (Array.isArray(schema)) { + for (var i = 0; i < schema.length; i++) { + item = schema[i]; + if (typeof item == "object") + count += countKeys(item); + if (count == Infinity) + return Infinity; + } + } else { + for (var key in schema) { + if (key == "$ref") + return Infinity; + if (SIMPLE_INLINED[key]) { + count++; + } else { + item = schema[key]; + if (typeof item == "object") + count += countKeys(item) + 1; + if (count == Infinity) + return Infinity; + } + } + } + return count; +} +function getFullPath(id, normalize) { + if (normalize !== false) + id = normalizeId(id); + var p = URI$1.parse(id); + return _getFullPath(p); +} +function _getFullPath(p) { + return URI$1.serialize(p).split("#")[0] + "#"; +} +var TRAILING_SLASH_HASH = /#\/?$/; +function normalizeId(id) { + return id ? id.replace(TRAILING_SLASH_HASH, "") : ""; +} +function resolveUrl(baseId, id) { + id = normalizeId(id); + return URI$1.resolve(baseId, id); +} +function resolveIds(schema) { + var schemaId = normalizeId(this._getId(schema)); + var baseIds = { "": schemaId }; + var fullPaths = { "": getFullPath(schemaId, false) }; + var localRefs = {}; + var self2 = this; + traverse(schema, { allKeys: true }, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { + if (jsonPtr === "") + return; + var id = self2._getId(sch); + var baseId = baseIds[parentJsonPtr]; + var fullPath = fullPaths[parentJsonPtr] + "/" + parentKeyword; + if (keyIndex !== void 0) + fullPath += "/" + (typeof keyIndex == "number" ? keyIndex : util$3.escapeFragment(keyIndex)); + if (typeof id == "string") { + id = baseId = normalizeId(baseId ? URI$1.resolve(baseId, id) : id); + var refVal = self2._refs[id]; + if (typeof refVal == "string") + refVal = self2._refs[refVal]; + if (refVal && refVal.schema) { + if (!equal$1(sch, refVal.schema)) + throw new Error('id "' + id + '" resolves to more than one schema'); + } else if (id != normalizeId(fullPath)) { + if (id[0] == "#") { + if (localRefs[id] && !equal$1(sch, localRefs[id])) + throw new Error('id "' + id + '" resolves to more than one schema'); + localRefs[id] = sch; + } else { + self2._refs[id] = fullPath; + } + } + } + baseIds[jsonPtr] = baseId; + fullPaths[jsonPtr] = fullPath; + }); + return localRefs; +} +var resolve$2 = resolve_1; +var error_classes = { + Validation: errorSubclass(ValidationError$1), + MissingRef: errorSubclass(MissingRefError$1) +}; +function ValidationError$1(errors) { + this.message = "validation failed"; + this.errors = errors; + this.ajv = this.validation = true; +} +MissingRefError$1.message = function(baseId, ref2) { + return "can't resolve reference " + ref2 + " from id " + baseId; +}; +function MissingRefError$1(baseId, ref2, message) { + this.message = message || MissingRefError$1.message(baseId, ref2); + this.missingRef = resolve$2.url(baseId, ref2); + this.missingSchema = resolve$2.normalizeId(resolve$2.fullPath(this.missingRef)); +} +function errorSubclass(Subclass) { + Subclass.prototype = Object.create(Error.prototype); + Subclass.prototype.constructor = Subclass; + return Subclass; +} +var fastJsonStableStringify = function(data2, opts) { + if (!opts) + opts = {}; + if (typeof opts === "function") + opts = { cmp: opts }; + var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false; + var cmp = opts.cmp && function(f) { + return function(node) { + return function(a, b) { + var aobj = { key: a, value: node[a] }; + var bobj = { key: b, value: node[b] }; + return f(aobj, bobj); + }; + }; + }(opts.cmp); + var seen = []; + return function stringify(node) { + if (node && node.toJSON && typeof node.toJSON === "function") { + node = node.toJSON(); + } + if (node === void 0) + return; + if (typeof node == "number") + return isFinite(node) ? "" + node : "null"; + if (typeof node !== "object") + return JSON.stringify(node); + var i, out; + if (Array.isArray(node)) { + out = "["; + for (i = 0; i < node.length; i++) { + if (i) + out += ","; + out += stringify(node[i]) || "null"; + } + return out + "]"; + } + if (node === null) + return "null"; + if (seen.indexOf(node) !== -1) { + if (cycles) + return JSON.stringify("__cycle__"); + throw new TypeError("Converting circular structure to JSON"); + } + var seenIndex = seen.push(node) - 1; + var keys = Object.keys(node).sort(cmp && cmp(node)); + out = ""; + for (i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = stringify(node[key]); + if (!value) + continue; + if (out) + out += ","; + out += JSON.stringify(key) + ":" + value; + } + seen.splice(seenIndex, 1); + return "{" + out + "}"; + }(data2); +}; +var validate$1 = function generate_validate(it, $keyword, $ruleType) { + var out = ""; + var $async = it.schema.$async === true, $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, "$ref"), $id2 = it.self._getId(it.schema); + if (it.opts.strictKeywords) { + var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords); + if ($unknownKwd) { + var $keywordsMsg = "unknown keyword: " + $unknownKwd; + if (it.opts.strictKeywords === "log") + it.logger.warn($keywordsMsg); + else + throw new Error($keywordsMsg); + } + } + if (it.isTop) { + out += " var validate = "; + if ($async) { + it.async = true; + out += "async "; + } + out += "function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; "; + if ($id2 && (it.opts.sourceCode || it.opts.processCode)) { + out += " " + ("/*# sourceURL=" + $id2 + " */") + " "; + } + } + if (typeof it.schema == "boolean" || !($refKeywords || it.schema.$ref)) { + var $keyword = "false schema"; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = "data" + ($dataLvl || ""); + var $valid = "valid" + $lvl; + if (it.schema === false) { + if (it.isTop) { + $breakOnError = true; + } else { + out += " var " + $valid + " = false; "; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: '" + ($errorKeyword || "false schema") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; + if (it.opts.messages !== false) { + out += " , message: 'boolean schema is false' "; + } + if (it.opts.verbose) { + out += " , schema: false , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + } else { + if (it.isTop) { + if ($async) { + out += " return data; "; + } else { + out += " validate.errors = null; return true; "; + } + } else { + out += " var " + $valid + " = true; "; + } + } + if (it.isTop) { + out += " }; return validate; "; + } + return out; + } + if (it.isTop) { + var $top = it.isTop, $lvl = it.level = 0, $dataLvl = it.dataLevel = 0, $data = "data"; + it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); + it.baseId = it.baseId || it.rootId; + delete it.isTop; + it.dataPathArr = [""]; + if (it.schema.default !== void 0 && it.opts.useDefaults && it.opts.strictDefaults) { + var $defaultMsg = "default is ignored in the schema root"; + if (it.opts.strictDefaults === "log") + it.logger.warn($defaultMsg); + else + throw new Error($defaultMsg); + } + out += " var vErrors = null; "; + out += " var errors = 0; "; + out += " if (rootData === undefined) rootData = data; "; + } else { + var $lvl = it.level, $dataLvl = it.dataLevel, $data = "data" + ($dataLvl || ""); + if ($id2) + it.baseId = it.resolve.url(it.baseId, $id2); + if ($async && !it.async) + throw new Error("async schema in sync schema"); + out += " var errs_" + $lvl + " = errors;"; + } + var $valid = "valid" + $lvl, $breakOnError = !it.opts.allErrors, $closingBraces1 = "", $closingBraces2 = ""; + var $errorKeyword; + var $typeSchema = it.schema.type, $typeIsArray = Array.isArray($typeSchema); + if ($typeSchema && it.opts.nullable && it.schema.nullable === true) { + if ($typeIsArray) { + if ($typeSchema.indexOf("null") == -1) + $typeSchema = $typeSchema.concat("null"); + } else if ($typeSchema != "null") { + $typeSchema = [$typeSchema, "null"]; + $typeIsArray = true; + } + } + if ($typeIsArray && $typeSchema.length == 1) { + $typeSchema = $typeSchema[0]; + $typeIsArray = false; + } + if (it.schema.$ref && $refKeywords) { + if (it.opts.extendRefs == "fail") { + throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); + } else if (it.opts.extendRefs !== true) { + $refKeywords = false; + it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); + } + } + if (it.schema.$comment && it.opts.$comment) { + out += " " + it.RULES.all.$comment.code(it, "$comment"); + } + if ($typeSchema) { + if (it.opts.coerceTypes) { + var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); + } + var $rulesGroup = it.RULES.types[$typeSchema]; + if ($coerceToTypes || $typeIsArray || $rulesGroup === true || $rulesGroup && !$shouldUseGroup($rulesGroup)) { + var $schemaPath = it.schemaPath + ".type", $errSchemaPath = it.errSchemaPath + "/type"; + var $schemaPath = it.schemaPath + ".type", $errSchemaPath = it.errSchemaPath + "/type", $method = $typeIsArray ? "checkDataTypes" : "checkDataType"; + out += " if (" + it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true) + ") { "; + if ($coerceToTypes) { + var $dataType = "dataType" + $lvl, $coerced = "coerced" + $lvl; + out += " var " + $dataType + " = typeof " + $data + "; var " + $coerced + " = undefined; "; + if (it.opts.coerceTypes == "array") { + out += " if (" + $dataType + " == 'object' && Array.isArray(" + $data + ") && " + $data + ".length == 1) { " + $data + " = " + $data + "[0]; " + $dataType + " = typeof " + $data + "; if (" + it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers) + ") " + $coerced + " = " + $data + "; } "; + } + out += " if (" + $coerced + " !== undefined) ; "; + var arr1 = $coerceToTypes; + if (arr1) { + var $type, $i = -1, l1 = arr1.length - 1; + while ($i < l1) { + $type = arr1[$i += 1]; + if ($type == "string") { + out += " else if (" + $dataType + " == 'number' || " + $dataType + " == 'boolean') " + $coerced + " = '' + " + $data + "; else if (" + $data + " === null) " + $coerced + " = ''; "; + } else if ($type == "number" || $type == "integer") { + out += " else if (" + $dataType + " == 'boolean' || " + $data + " === null || (" + $dataType + " == 'string' && " + $data + " && " + $data + " == +" + $data + " "; + if ($type == "integer") { + out += " && !(" + $data + " % 1)"; + } + out += ")) " + $coerced + " = +" + $data + "; "; + } else if ($type == "boolean") { + out += " else if (" + $data + " === 'false' || " + $data + " === 0 || " + $data + " === null) " + $coerced + " = false; else if (" + $data + " === 'true' || " + $data + " === 1) " + $coerced + " = true; "; + } else if ($type == "null") { + out += " else if (" + $data + " === '' || " + $data + " === 0 || " + $data + " === false) " + $coerced + " = null; "; + } else if (it.opts.coerceTypes == "array" && $type == "array") { + out += " else if (" + $dataType + " == 'string' || " + $dataType + " == 'number' || " + $dataType + " == 'boolean' || " + $data + " == null) " + $coerced + " = [" + $data + "]; "; + } + } + } + out += " else { "; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: '" + ($errorKeyword || "type") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { type: '"; + if ($typeIsArray) { + out += "" + $typeSchema.join(","); + } else { + out += "" + $typeSchema; + } + out += "' } "; + if (it.opts.messages !== false) { + out += " , message: 'should be "; + if ($typeIsArray) { + out += "" + $typeSchema.join(","); + } else { + out += "" + $typeSchema; + } + out += "' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " } if (" + $coerced + " !== undefined) { "; + var $parentData = $dataLvl ? "data" + ($dataLvl - 1 || "") : "parentData", $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : "parentDataProperty"; + out += " " + $data + " = " + $coerced + "; "; + if (!$dataLvl) { + out += "if (" + $parentData + " !== undefined)"; + } + out += " " + $parentData + "[" + $parentDataProperty + "] = " + $coerced + "; } "; + } else { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: '" + ($errorKeyword || "type") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { type: '"; + if ($typeIsArray) { + out += "" + $typeSchema.join(","); + } else { + out += "" + $typeSchema; + } + out += "' } "; + if (it.opts.messages !== false) { + out += " , message: 'should be "; + if ($typeIsArray) { + out += "" + $typeSchema.join(","); + } else { + out += "" + $typeSchema; + } + out += "' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + } + out += " } "; + } + } + if (it.schema.$ref && !$refKeywords) { + out += " " + it.RULES.all.$ref.code(it, "$ref") + " "; + if ($breakOnError) { + out += " } if (errors === "; + if ($top) { + out += "0"; + } else { + out += "errs_" + $lvl; + } + out += ") { "; + $closingBraces2 += "}"; + } + } else { + var arr2 = it.RULES; + if (arr2) { + var $rulesGroup, i2 = -1, l2 = arr2.length - 1; + while (i2 < l2) { + $rulesGroup = arr2[i2 += 1]; + if ($shouldUseGroup($rulesGroup)) { + if ($rulesGroup.type) { + out += " if (" + it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers) + ") { "; + } + if (it.opts.useDefaults) { + if ($rulesGroup.type == "object" && it.schema.properties) { + var $schema2 = it.schema.properties, $schemaKeys = Object.keys($schema2); + var arr3 = $schemaKeys; + if (arr3) { + var $propertyKey, i3 = -1, l3 = arr3.length - 1; + while (i3 < l3) { + $propertyKey = arr3[i3 += 1]; + var $sch = $schema2[$propertyKey]; + if ($sch.default !== void 0) { + var $passData = $data + it.util.getProperty($propertyKey); + if (it.compositeRule) { + if (it.opts.strictDefaults) { + var $defaultMsg = "default is ignored for: " + $passData; + if (it.opts.strictDefaults === "log") + it.logger.warn($defaultMsg); + else + throw new Error($defaultMsg); + } + } else { + out += " if (" + $passData + " === undefined "; + if (it.opts.useDefaults == "empty") { + out += " || " + $passData + " === null || " + $passData + " === '' "; + } + out += " ) " + $passData + " = "; + if (it.opts.useDefaults == "shared") { + out += " " + it.useDefault($sch.default) + " "; + } else { + out += " " + JSON.stringify($sch.default) + " "; + } + out += "; "; + } + } + } + } + } else if ($rulesGroup.type == "array" && Array.isArray(it.schema.items)) { + var arr4 = it.schema.items; + if (arr4) { + var $sch, $i = -1, l4 = arr4.length - 1; + while ($i < l4) { + $sch = arr4[$i += 1]; + if ($sch.default !== void 0) { + var $passData = $data + "[" + $i + "]"; + if (it.compositeRule) { + if (it.opts.strictDefaults) { + var $defaultMsg = "default is ignored for: " + $passData; + if (it.opts.strictDefaults === "log") + it.logger.warn($defaultMsg); + else + throw new Error($defaultMsg); + } + } else { + out += " if (" + $passData + " === undefined "; + if (it.opts.useDefaults == "empty") { + out += " || " + $passData + " === null || " + $passData + " === '' "; + } + out += " ) " + $passData + " = "; + if (it.opts.useDefaults == "shared") { + out += " " + it.useDefault($sch.default) + " "; + } else { + out += " " + JSON.stringify($sch.default) + " "; + } + out += "; "; + } + } + } + } + } + } + var arr5 = $rulesGroup.rules; + if (arr5) { + var $rule, i5 = -1, l5 = arr5.length - 1; + while (i5 < l5) { + $rule = arr5[i5 += 1]; + if ($shouldUseRule($rule)) { + var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); + if ($code) { + out += " " + $code + " "; + if ($breakOnError) { + $closingBraces1 += "}"; + } + } + } + } + } + if ($breakOnError) { + out += " " + $closingBraces1 + " "; + $closingBraces1 = ""; + } + if ($rulesGroup.type) { + out += " } "; + if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { + out += " else { "; + var $schemaPath = it.schemaPath + ".type", $errSchemaPath = it.errSchemaPath + "/type"; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: '" + ($errorKeyword || "type") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { type: '"; + if ($typeIsArray) { + out += "" + $typeSchema.join(","); + } else { + out += "" + $typeSchema; + } + out += "' } "; + if (it.opts.messages !== false) { + out += " , message: 'should be "; + if ($typeIsArray) { + out += "" + $typeSchema.join(","); + } else { + out += "" + $typeSchema; + } + out += "' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " } "; + } + } + if ($breakOnError) { + out += " if (errors === "; + if ($top) { + out += "0"; + } else { + out += "errs_" + $lvl; + } + out += ") { "; + $closingBraces2 += "}"; + } + } + } + } + } + if ($breakOnError) { + out += " " + $closingBraces2 + " "; + } + if ($top) { + if ($async) { + out += " if (errors === 0) return data; "; + out += " else throw new ValidationError(vErrors); "; + } else { + out += " validate.errors = vErrors; "; + out += " return errors === 0; "; + } + out += " }; return validate;"; + } else { + out += " var " + $valid + " = errors === errs_" + $lvl + ";"; + } + function $shouldUseGroup($rulesGroup2) { + var rules3 = $rulesGroup2.rules; + for (var i = 0; i < rules3.length; i++) + if ($shouldUseRule(rules3[i])) + return true; + } + function $shouldUseRule($rule2) { + return it.schema[$rule2.keyword] !== void 0 || $rule2.implements && $ruleImplementsSomeKeyword($rule2); + } + function $ruleImplementsSomeKeyword($rule2) { + var impl = $rule2.implements; + for (var i = 0; i < impl.length; i++) + if (it.schema[impl[i]] !== void 0) + return true; + } + return out; +}; +var resolve$1 = resolve_1, util$2 = util$5, errorClasses$1 = error_classes, stableStringify$1 = fastJsonStableStringify; +var validateGenerator = validate$1; +var ucs2length2 = util$2.ucs2length; +var equal2 = fastDeepEqual; +var ValidationError = errorClasses$1.Validation; +var compile_1 = compile$1; +function compile$1(schema, root, localRefs, baseId) { + var self2 = this, opts = this._opts, refVal = [void 0], refs = {}, patterns = [], patternsHash = {}, defaults = [], defaultsHash = {}, customRules = []; + root = root || { schema, refVal, refs }; + var c = checkCompiling.call(this, schema, root, baseId); + var compilation = this._compilations[c.index]; + if (c.compiling) + return compilation.callValidate = callValidate; + var formats2 = this._formats; + var RULES = this.RULES; + try { + var v = localCompile(schema, root, localRefs, baseId); + compilation.validate = v; + var cv = compilation.callValidate; + if (cv) { + cv.schema = v.schema; + cv.errors = null; + cv.refs = v.refs; + cv.refVal = v.refVal; + cv.root = v.root; + cv.$async = v.$async; + if (opts.sourceCode) + cv.source = v.source; + } + return v; + } finally { + endCompiling.call(this, schema, root, baseId); + } + function callValidate() { + var validate2 = compilation.validate; + var result = validate2.apply(this, arguments); + callValidate.errors = validate2.errors; + return result; + } + function localCompile(_schema, _root, localRefs2, baseId2) { + var isRoot = !_root || _root && _root.schema == _schema; + if (_root.schema != root.schema) + return compile$1.call(self2, _schema, _root, localRefs2, baseId2); + var $async = _schema.$async === true; + var sourceCode = validateGenerator({ + isTop: true, + schema: _schema, + isRoot, + baseId: baseId2, + root: _root, + schemaPath: "", + errSchemaPath: "#", + errorPath: '""', + MissingRefError: errorClasses$1.MissingRef, + RULES, + validate: validateGenerator, + util: util$2, + resolve: resolve$1, + resolveRef, + usePattern, + useDefault, + useCustomRule, + opts, + formats: formats2, + logger: self2.logger, + self: self2 + }); + sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) + vars(defaults, defaultCode) + vars(customRules, customRuleCode$1) + sourceCode; + if (opts.processCode) + sourceCode = opts.processCode(sourceCode, _schema); + var validate2; + try { + var makeValidate = new Function( + "self", + "RULES", + "formats", + "root", + "refVal", + "defaults", + "customRules", + "equal", + "ucs2length", + "ValidationError", + sourceCode + ); + validate2 = makeValidate( + self2, + RULES, + formats2, + root, + refVal, + defaults, + customRules, + equal2, + ucs2length2, + ValidationError + ); + refVal[0] = validate2; + } catch (e) { + self2.logger.error("Error compiling schema, function code:", sourceCode); + throw e; + } + validate2.schema = _schema; + validate2.errors = null; + validate2.refs = refs; + validate2.refVal = refVal; + validate2.root = isRoot ? validate2 : _root; + if ($async) + validate2.$async = true; + if (opts.sourceCode === true) { + validate2.source = { + code: sourceCode, + patterns, + defaults + }; + } + return validate2; + } + function resolveRef(baseId2, ref2, isRoot) { + ref2 = resolve$1.url(baseId2, ref2); + var refIndex = refs[ref2]; + var _refVal, refCode; + if (refIndex !== void 0) { + _refVal = refVal[refIndex]; + refCode = "refVal[" + refIndex + "]"; + return resolvedRef(_refVal, refCode); + } + if (!isRoot && root.refs) { + var rootRefId = root.refs[ref2]; + if (rootRefId !== void 0) { + _refVal = root.refVal[rootRefId]; + refCode = addLocalRef(ref2, _refVal); + return resolvedRef(_refVal, refCode); + } + } + refCode = addLocalRef(ref2); + var v2 = resolve$1.call(self2, localCompile, root, ref2); + if (v2 === void 0) { + var localSchema = localRefs && localRefs[ref2]; + if (localSchema) { + v2 = resolve$1.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile$1.call(self2, localSchema, root, localRefs, baseId2); + } + } + if (v2 === void 0) { + removeLocalRef(ref2); + } else { + replaceLocalRef(ref2, v2); + return resolvedRef(v2, refCode); + } + } + function addLocalRef(ref2, v2) { + var refId = refVal.length; + refVal[refId] = v2; + refs[ref2] = refId; + return "refVal" + refId; + } + function removeLocalRef(ref2) { + delete refs[ref2]; + } + function replaceLocalRef(ref2, v2) { + var refId = refs[ref2]; + refVal[refId] = v2; + } + function resolvedRef(refVal2, code) { + return typeof refVal2 == "object" || typeof refVal2 == "boolean" ? { code, schema: refVal2, inline: true } : { code, $async: refVal2 && !!refVal2.$async }; + } + function usePattern(regexStr) { + var index = patternsHash[regexStr]; + if (index === void 0) { + index = patternsHash[regexStr] = patterns.length; + patterns[index] = regexStr; + } + return "pattern" + index; + } + function useDefault(value) { + switch (typeof value) { + case "boolean": + case "number": + return "" + value; + case "string": + return util$2.toQuotedString(value); + case "object": + if (value === null) + return "null"; + var valueStr = stableStringify$1(value); + var index = defaultsHash[valueStr]; + if (index === void 0) { + index = defaultsHash[valueStr] = defaults.length; + defaults[index] = value; + } + return "default" + index; + } + } + function useCustomRule(rule, schema2, parentSchema, it) { + if (self2._opts.validateSchema !== false) { + var deps = rule.definition.dependencies; + if (deps && !deps.every(function(keyword2) { + return Object.prototype.hasOwnProperty.call(parentSchema, keyword2); + })) + throw new Error("parent schema must have all required keywords: " + deps.join(",")); + var validateSchema2 = rule.definition.validateSchema; + if (validateSchema2) { + var valid = validateSchema2(schema2); + if (!valid) { + var message = "keyword schema is invalid: " + self2.errorsText(validateSchema2.errors); + if (self2._opts.validateSchema == "log") + self2.logger.error(message); + else + throw new Error(message); + } + } + } + var compile2 = rule.definition.compile, inline = rule.definition.inline, macro = rule.definition.macro; + var validate2; + if (compile2) { + validate2 = compile2.call(self2, schema2, parentSchema, it); + } else if (macro) { + validate2 = macro.call(self2, schema2, parentSchema, it); + if (opts.validateSchema !== false) + self2.validateSchema(validate2, true); + } else if (inline) { + validate2 = inline.call(self2, it, rule.keyword, schema2, parentSchema); + } else { + validate2 = rule.definition.validate; + if (!validate2) + return; + } + if (validate2 === void 0) + throw new Error('custom keyword "' + rule.keyword + '"failed to compile'); + var index = customRules.length; + customRules[index] = validate2; + return { + code: "customRule" + index, + validate: validate2 + }; + } +} +function checkCompiling(schema, root, baseId) { + var index = compIndex.call(this, schema, root, baseId); + if (index >= 0) + return { index, compiling: true }; + index = this._compilations.length; + this._compilations[index] = { + schema, + root, + baseId + }; + return { index, compiling: false }; +} +function endCompiling(schema, root, baseId) { + var i = compIndex.call(this, schema, root, baseId); + if (i >= 0) + this._compilations.splice(i, 1); +} +function compIndex(schema, root, baseId) { + for (var i = 0; i < this._compilations.length; i++) { + var c = this._compilations[i]; + if (c.schema == schema && c.root == root && c.baseId == baseId) + return i; + } + return -1; +} +function patternCode(i, patterns) { + return "var pattern" + i + " = new RegExp(" + util$2.toQuotedString(patterns[i]) + ");"; +} +function defaultCode(i) { + return "var default" + i + " = defaults[" + i + "];"; +} +function refValCode(i, refVal) { + return refVal[i] === void 0 ? "" : "var refVal" + i + " = refVal[" + i + "];"; +} +function customRuleCode$1(i) { + return "var customRule" + i + " = customRules[" + i + "];"; +} +function vars(arr, statement) { + if (!arr.length) + return ""; + var code = ""; + for (var i = 0; i < arr.length; i++) + code += statement(i, arr); + return code; +} +var cache = { exports: {} }; +var Cache$1 = cache.exports = function Cache() { + this._cache = {}; +}; +Cache$1.prototype.put = function Cache_put(key, value) { + this._cache[key] = value; +}; +Cache$1.prototype.get = function Cache_get(key) { + return this._cache[key]; +}; +Cache$1.prototype.del = function Cache_del(key) { + delete this._cache[key]; +}; +Cache$1.prototype.clear = function Cache_clear() { + this._cache = {}; +}; +var cacheExports = cache.exports; +var util$1 = util$5; +var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; +var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i; +var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i; +var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*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{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; +var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i; +var URL$1 = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; +var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i; +var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/; +var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i; +var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/; +var formats_1 = formats$1; +function formats$1(mode) { + mode = mode == "full" ? "full" : "fast"; + return util$1.copy(formats$1[mode]); +} +formats$1.fast = { + // date: http://tools.ietf.org/html/rfc3339#section-5.6 + date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/, + // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 + time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, + "date-time": /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, + // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js + uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, + "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, + "uri-template": URITEMPLATE, + url: URL$1, + // email (sources from jsen validator): + // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 + // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation') + email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, + hostname: HOSTNAME, + // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, + // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses + ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, + regex, + // uuid: http://tools.ietf.org/html/rfc4122 + uuid: UUID, + // JSON-pointer: https://tools.ietf.org/html/rfc6901 + // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A + "json-pointer": JSON_POINTER, + "json-pointer-uri-fragment": JSON_POINTER_URI_FRAGMENT, + // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 + "relative-json-pointer": RELATIVE_JSON_POINTER +}; +formats$1.full = { + date, + time, + "date-time": date_time, + uri, + "uri-reference": URIREF, + "uri-template": URITEMPLATE, + url: URL$1, + email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, + hostname: HOSTNAME, + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, + ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, + regex, + uuid: UUID, + "json-pointer": JSON_POINTER, + "json-pointer-uri-fragment": JSON_POINTER_URI_FRAGMENT, + "relative-json-pointer": RELATIVE_JSON_POINTER +}; +function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} +function date(str) { + var matches = str.match(DATE); + if (!matches) + return false; + var year = +matches[1]; + var month = +matches[2]; + var day = +matches[3]; + return month >= 1 && month <= 12 && day >= 1 && day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]); +} +function time(str, full) { + var matches = str.match(TIME); + if (!matches) + return false; + var hour = matches[1]; + var minute = matches[2]; + var second = matches[3]; + var timeZone = matches[5]; + return (hour <= 23 && minute <= 59 && second <= 59 || hour == 23 && minute == 59 && second == 60) && (!full || timeZone); +} +var DATE_TIME_SEPARATOR = /t|\s/i; +function date_time(str) { + var dateTime = str.split(DATE_TIME_SEPARATOR); + return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true); +} +var NOT_URI_FRAGMENT = /\/|:/; +function uri(str) { + return NOT_URI_FRAGMENT.test(str) && URI.test(str); +} +var Z_ANCHOR = /[^\\]\\Z/; +function regex(str) { + if (Z_ANCHOR.test(str)) + return false; + try { + new RegExp(str); + return true; + } catch (e) { + return false; + } +} +var ref = function generate_ref(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $valid = "valid" + $lvl; + var $async, $refCode; + if ($schema2 == "#" || $schema2 == "#/") { + if (it.isRoot) { + $async = it.async; + $refCode = "validate"; + } else { + $async = it.root.schema.$async === true; + $refCode = "root.refVal[0]"; + } + } else { + var $refVal = it.resolveRef(it.baseId, $schema2, it.isRoot); + if ($refVal === void 0) { + var $message = it.MissingRefError.message(it.baseId, $schema2); + if (it.opts.missingRefs == "fail") { + it.logger.error($message); + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: '$ref' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { ref: '" + it.util.escapeQuotes($schema2) + "' } "; + if (it.opts.messages !== false) { + out += " , message: 'can\\'t resolve reference " + it.util.escapeQuotes($schema2) + "' "; + } + if (it.opts.verbose) { + out += " , schema: " + it.util.toQuotedString($schema2) + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + if ($breakOnError) { + out += " if (false) { "; + } + } else if (it.opts.missingRefs == "ignore") { + it.logger.warn($message); + if ($breakOnError) { + out += " if (true) { "; + } + } else { + throw new it.MissingRefError(it.baseId, $schema2, $message); + } + } else if ($refVal.inline) { + var $it = it.util.copy(it); + $it.level++; + var $nextValid = "valid" + $it.level; + $it.schema = $refVal.schema; + $it.schemaPath = ""; + $it.errSchemaPath = $schema2; + var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); + out += " " + $code + " "; + if ($breakOnError) { + out += " if (" + $nextValid + ") { "; + } + } else { + $async = $refVal.$async === true || it.async && $refVal.$async !== false; + $refCode = $refVal.code; + } + } + if ($refCode) { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.opts.passContext) { + out += " " + $refCode + ".call(this, "; + } else { + out += " " + $refCode + "( "; + } + out += " " + $data + ", (dataPath || '')"; + if (it.errorPath != '""') { + out += " + " + it.errorPath; + } + var $parentData = $dataLvl ? "data" + ($dataLvl - 1 || "") : "parentData", $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : "parentDataProperty"; + out += " , " + $parentData + " , " + $parentDataProperty + ", rootData) "; + var __callValidate = out; + out = $$outStack.pop(); + if ($async) { + if (!it.async) + throw new Error("async schema referenced by sync schema"); + if ($breakOnError) { + out += " var " + $valid + "; "; + } + out += " try { await " + __callValidate + "; "; + if ($breakOnError) { + out += " " + $valid + " = true; "; + } + out += " } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; "; + if ($breakOnError) { + out += " " + $valid + " = false; "; + } + out += " } "; + if ($breakOnError) { + out += " if (" + $valid + ") { "; + } + } else { + out += " if (!" + __callValidate + ") { if (vErrors === null) vErrors = " + $refCode + ".errors; else vErrors = vErrors.concat(" + $refCode + ".errors); errors = vErrors.length; } "; + if ($breakOnError) { + out += " else { "; + } + } + } + return out; +}; +var allOf = function generate_allOf(it, $keyword, $ruleType) { + var out = " "; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $it = it.util.copy(it); + var $closingBraces = ""; + $it.level++; + var $nextValid = "valid" + $it.level; + var $currentBaseId = $it.baseId, $allSchemasEmpty = true; + var arr1 = $schema2; + if (arr1) { + var $sch, $i = -1, l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { + $allSchemasEmpty = false; + $it.schema = $sch; + $it.schemaPath = $schemaPath + "[" + $i + "]"; + $it.errSchemaPath = $errSchemaPath + "/" + $i; + out += " " + it.validate($it) + " "; + $it.baseId = $currentBaseId; + if ($breakOnError) { + out += " if (" + $nextValid + ") { "; + $closingBraces += "}"; + } + } + } + } + if ($breakOnError) { + if ($allSchemasEmpty) { + out += " if (true) { "; + } else { + out += " " + $closingBraces.slice(0, -1) + " "; + } + } + return out; +}; +var anyOf = function generate_anyOf(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $valid = "valid" + $lvl; + var $errs = "errs__" + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ""; + $it.level++; + var $nextValid = "valid" + $it.level; + var $noEmptySchema = $schema2.every(function($sch2) { + return it.opts.strictKeywords ? typeof $sch2 == "object" && Object.keys($sch2).length > 0 || $sch2 === false : it.util.schemaHasRules($sch2, it.RULES.all); + }); + if ($noEmptySchema) { + var $currentBaseId = $it.baseId; + out += " var " + $errs + " = errors; var " + $valid + " = false; "; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var arr1 = $schema2; + if (arr1) { + var $sch, $i = -1, l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + $it.schema = $sch; + $it.schemaPath = $schemaPath + "[" + $i + "]"; + $it.errSchemaPath = $errSchemaPath + "/" + $i; + out += " " + it.validate($it) + " "; + $it.baseId = $currentBaseId; + out += " " + $valid + " = " + $valid + " || " + $nextValid + "; if (!" + $valid + ") { "; + $closingBraces += "}"; + } + } + it.compositeRule = $it.compositeRule = $wasComposite; + out += " " + $closingBraces + " if (!" + $valid + ") { var err = "; + if (it.createErrors !== false) { + out += " { keyword: 'anyOf' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; + if (it.opts.messages !== false) { + out += " , message: 'should match some schema in anyOf' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError(vErrors); "; + } else { + out += " validate.errors = vErrors; return false; "; + } + } + out += " } else { errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } "; + if (it.opts.allErrors) { + out += " } "; + } + } else { + if ($breakOnError) { + out += " if (true) { "; + } + } + return out; +}; +var comment = function generate_comment(it, $keyword, $ruleType) { + var out = " "; + var $schema2 = it.schema[$keyword]; + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + !it.opts.allErrors; + var $comment = it.util.toQuotedString($schema2); + if (it.opts.$comment === true) { + out += " console.log(" + $comment + ");"; + } else if (typeof it.opts.$comment == "function") { + out += " self._opts.$comment(" + $comment + ", " + it.util.toQuotedString($errSchemaPath) + ", validate.root.schema);"; + } + return out; +}; +var _const = function generate_const(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $valid = "valid" + $lvl; + var $isData = it.opts.$data && $schema2 && $schema2.$data; + if ($isData) { + out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; + } + if (!$isData) { + out += " var schema" + $lvl + " = validate.schema" + $schemaPath + ";"; + } + out += "var " + $valid + " = equal(" + $data + ", schema" + $lvl + "); if (!" + $valid + ") { "; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'const' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { allowedValue: schema" + $lvl + " } "; + if (it.opts.messages !== false) { + out += " , message: 'should be equal to constant' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " }"; + if ($breakOnError) { + out += " else { "; + } + return out; +}; +var contains = function generate_contains(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $valid = "valid" + $lvl; + var $errs = "errs__" + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ""; + $it.level++; + var $nextValid = "valid" + $it.level; + var $idx = "i" + $lvl, $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $currentBaseId = it.baseId, $nonEmptySchema = it.opts.strictKeywords ? typeof $schema2 == "object" && Object.keys($schema2).length > 0 || $schema2 === false : it.util.schemaHasRules($schema2, it.RULES.all); + out += "var " + $errs + " = errors;var " + $valid + ";"; + if ($nonEmptySchema) { + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.schema = $schema2; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += " var " + $nextValid + " = false; for (var " + $idx + " = 0; " + $idx + " < " + $data + ".length; " + $idx + "++) { "; + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + "[" + $idx + "]"; + $it.dataPathArr[$dataNxt] = $idx; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += " " + it.util.varReplace($code, $nextData, $passData) + " "; + } else { + out += " var " + $nextData + " = " + $passData + "; " + $code + " "; + } + out += " if (" + $nextValid + ") break; } "; + it.compositeRule = $it.compositeRule = $wasComposite; + out += " " + $closingBraces + " if (!" + $nextValid + ") {"; + } else { + out += " if (" + $data + ".length == 0) {"; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'contains' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; + if (it.opts.messages !== false) { + out += " , message: 'should contain a valid item' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " } else { "; + if ($nonEmptySchema) { + out += " errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } "; + } + if (it.opts.allErrors) { + out += " } "; + } + return out; +}; +var dependencies = function generate_dependencies(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $errs = "errs__" + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ""; + $it.level++; + var $nextValid = "valid" + $it.level; + var $schemaDeps = {}, $propertyDeps = {}, $ownProperties = it.opts.ownProperties; + for ($property in $schema2) { + if ($property == "__proto__") + continue; + var $sch = $schema2[$property]; + var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps; + $deps[$property] = $sch; + } + out += "var " + $errs + " = errors;"; + var $currentErrorPath = it.errorPath; + out += "var missing" + $lvl + ";"; + for (var $property in $propertyDeps) { + $deps = $propertyDeps[$property]; + if ($deps.length) { + out += " if ( " + $data + it.util.getProperty($property) + " !== undefined "; + if ($ownProperties) { + out += " && Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($property) + "') "; + } + if ($breakOnError) { + out += " && ( "; + var arr1 = $deps; + if (arr1) { + var $propertyKey, $i = -1, l1 = arr1.length - 1; + while ($i < l1) { + $propertyKey = arr1[$i += 1]; + if ($i) { + out += " || "; + } + var $prop = it.util.getProperty($propertyKey), $useData = $data + $prop; + out += " ( ( " + $useData + " === undefined "; + if ($ownProperties) { + out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; + } + out += ") && (missing" + $lvl + " = " + it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) + ") ) "; + } + } + out += ")) { "; + var $propertyPath = "missing" + $lvl, $missingProperty = "' + " + $propertyPath + " + '"; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + " + " + $propertyPath; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'dependencies' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { property: '" + it.util.escapeQuotes($property) + "', missingProperty: '" + $missingProperty + "', depsCount: " + $deps.length + ", deps: '" + it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", ")) + "' } "; + if (it.opts.messages !== false) { + out += " , message: 'should have "; + if ($deps.length == 1) { + out += "property " + it.util.escapeQuotes($deps[0]); + } else { + out += "properties " + it.util.escapeQuotes($deps.join(", ")); + } + out += " when property " + it.util.escapeQuotes($property) + " is present' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + } else { + out += " ) { "; + var arr2 = $deps; + if (arr2) { + var $propertyKey, i2 = -1, l2 = arr2.length - 1; + while (i2 < l2) { + $propertyKey = arr2[i2 += 1]; + var $prop = it.util.getProperty($propertyKey), $missingProperty = it.util.escapeQuotes($propertyKey), $useData = $data + $prop; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + out += " if ( " + $useData + " === undefined "; + if ($ownProperties) { + out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; + } + out += ") { var err = "; + if (it.createErrors !== false) { + out += " { keyword: 'dependencies' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { property: '" + it.util.escapeQuotes($property) + "', missingProperty: '" + $missingProperty + "', depsCount: " + $deps.length + ", deps: '" + it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", ")) + "' } "; + if (it.opts.messages !== false) { + out += " , message: 'should have "; + if ($deps.length == 1) { + out += "property " + it.util.escapeQuotes($deps[0]); + } else { + out += "properties " + it.util.escapeQuotes($deps.join(", ")); + } + out += " when property " + it.util.escapeQuotes($property) + " is present' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "; + } + } + } + out += " } "; + if ($breakOnError) { + $closingBraces += "}"; + out += " else { "; + } + } + } + it.errorPath = $currentErrorPath; + var $currentBaseId = $it.baseId; + for (var $property in $schemaDeps) { + var $sch = $schemaDeps[$property]; + if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { + out += " " + $nextValid + " = true; if ( " + $data + it.util.getProperty($property) + " !== undefined "; + if ($ownProperties) { + out += " && Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($property) + "') "; + } + out += ") { "; + $it.schema = $sch; + $it.schemaPath = $schemaPath + it.util.getProperty($property); + $it.errSchemaPath = $errSchemaPath + "/" + it.util.escapeFragment($property); + out += " " + it.validate($it) + " "; + $it.baseId = $currentBaseId; + out += " } "; + if ($breakOnError) { + out += " if (" + $nextValid + ") { "; + $closingBraces += "}"; + } + } + } + if ($breakOnError) { + out += " " + $closingBraces + " if (" + $errs + " == errors) {"; + } + return out; +}; +var _enum = function generate_enum(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $valid = "valid" + $lvl; + var $isData = it.opts.$data && $schema2 && $schema2.$data; + if ($isData) { + out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; + } + var $i = "i" + $lvl, $vSchema = "schema" + $lvl; + if (!$isData) { + out += " var " + $vSchema + " = validate.schema" + $schemaPath + ";"; + } + out += "var " + $valid + ";"; + if ($isData) { + out += " if (schema" + $lvl + " === undefined) " + $valid + " = true; else if (!Array.isArray(schema" + $lvl + ")) " + $valid + " = false; else {"; + } + out += "" + $valid + " = false;for (var " + $i + "=0; " + $i + "<" + $vSchema + ".length; " + $i + "++) if (equal(" + $data + ", " + $vSchema + "[" + $i + "])) { " + $valid + " = true; break; }"; + if ($isData) { + out += " } "; + } + out += " if (!" + $valid + ") { "; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'enum' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { allowedValues: schema" + $lvl + " } "; + if (it.opts.messages !== false) { + out += " , message: 'should be equal to one of the allowed values' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " }"; + if ($breakOnError) { + out += " else { "; + } + return out; +}; +var format = function generate_format(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + if (it.opts.format === false) { + if ($breakOnError) { + out += " if (true) { "; + } + return out; + } + var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; + if ($isData) { + out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; + $schemaValue = "schema" + $lvl; + } else { + $schemaValue = $schema2; + } + var $unknownFormats = it.opts.unknownFormats, $allowUnknown = Array.isArray($unknownFormats); + if ($isData) { + var $format = "format" + $lvl, $isObject = "isObject" + $lvl, $formatType = "formatType" + $lvl; + out += " var " + $format + " = formats[" + $schemaValue + "]; var " + $isObject + " = typeof " + $format + " == 'object' && !(" + $format + " instanceof RegExp) && " + $format + ".validate; var " + $formatType + " = " + $isObject + " && " + $format + ".type || 'string'; if (" + $isObject + ") { "; + if (it.async) { + out += " var async" + $lvl + " = " + $format + ".async; "; + } + out += " " + $format + " = " + $format + ".validate; } if ( "; + if ($isData) { + out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'string') || "; + } + out += " ("; + if ($unknownFormats != "ignore") { + out += " (" + $schemaValue + " && !" + $format + " "; + if ($allowUnknown) { + out += " && self._opts.unknownFormats.indexOf(" + $schemaValue + ") == -1 "; + } + out += ") || "; + } + out += " (" + $format + " && " + $formatType + " == '" + $ruleType + "' && !(typeof " + $format + " == 'function' ? "; + if (it.async) { + out += " (async" + $lvl + " ? await " + $format + "(" + $data + ") : " + $format + "(" + $data + ")) "; + } else { + out += " " + $format + "(" + $data + ") "; + } + out += " : " + $format + ".test(" + $data + "))))) {"; + } else { + var $format = it.formats[$schema2]; + if (!$format) { + if ($unknownFormats == "ignore") { + it.logger.warn('unknown format "' + $schema2 + '" ignored in schema at path "' + it.errSchemaPath + '"'); + if ($breakOnError) { + out += " if (true) { "; + } + return out; + } else if ($allowUnknown && $unknownFormats.indexOf($schema2) >= 0) { + if ($breakOnError) { + out += " if (true) { "; + } + return out; + } else { + throw new Error('unknown format "' + $schema2 + '" is used in schema at path "' + it.errSchemaPath + '"'); + } + } + var $isObject = typeof $format == "object" && !($format instanceof RegExp) && $format.validate; + var $formatType = $isObject && $format.type || "string"; + if ($isObject) { + var $async = $format.async === true; + $format = $format.validate; + } + if ($formatType != $ruleType) { + if ($breakOnError) { + out += " if (true) { "; + } + return out; + } + if ($async) { + if (!it.async) + throw new Error("async format in sync schema"); + var $formatRef = "formats" + it.util.getProperty($schema2) + ".validate"; + out += " if (!(await " + $formatRef + "(" + $data + "))) { "; + } else { + out += " if (! "; + var $formatRef = "formats" + it.util.getProperty($schema2); + if ($isObject) + $formatRef += ".validate"; + if (typeof $format == "function") { + out += " " + $formatRef + "(" + $data + ") "; + } else { + out += " " + $formatRef + ".test(" + $data + ") "; + } + out += ") { "; + } + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'format' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { format: "; + if ($isData) { + out += "" + $schemaValue; + } else { + out += "" + it.util.toQuotedString($schema2); + } + out += " } "; + if (it.opts.messages !== false) { + out += ` , message: 'should match format "`; + if ($isData) { + out += "' + " + $schemaValue + " + '"; + } else { + out += "" + it.util.escapeQuotes($schema2); + } + out += `"' `; + } + if (it.opts.verbose) { + out += " , schema: "; + if ($isData) { + out += "validate.schema" + $schemaPath; + } else { + out += "" + it.util.toQuotedString($schema2); + } + out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " } "; + if ($breakOnError) { + out += " else { "; + } + return out; +}; +var _if = function generate_if(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $valid = "valid" + $lvl; + var $errs = "errs__" + $lvl; + var $it = it.util.copy(it); + $it.level++; + var $nextValid = "valid" + $it.level; + var $thenSch = it.schema["then"], $elseSch = it.schema["else"], $thenPresent = $thenSch !== void 0 && (it.opts.strictKeywords ? typeof $thenSch == "object" && Object.keys($thenSch).length > 0 || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)), $elsePresent = $elseSch !== void 0 && (it.opts.strictKeywords ? typeof $elseSch == "object" && Object.keys($elseSch).length > 0 || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)), $currentBaseId = $it.baseId; + if ($thenPresent || $elsePresent) { + var $ifClause; + $it.createErrors = false; + $it.schema = $schema2; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += " var " + $errs + " = errors; var " + $valid + " = true; "; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + out += " " + it.validate($it) + " "; + $it.baseId = $currentBaseId; + $it.createErrors = true; + out += " errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } "; + it.compositeRule = $it.compositeRule = $wasComposite; + if ($thenPresent) { + out += " if (" + $nextValid + ") { "; + $it.schema = it.schema["then"]; + $it.schemaPath = it.schemaPath + ".then"; + $it.errSchemaPath = it.errSchemaPath + "/then"; + out += " " + it.validate($it) + " "; + $it.baseId = $currentBaseId; + out += " " + $valid + " = " + $nextValid + "; "; + if ($thenPresent && $elsePresent) { + $ifClause = "ifClause" + $lvl; + out += " var " + $ifClause + " = 'then'; "; + } else { + $ifClause = "'then'"; + } + out += " } "; + if ($elsePresent) { + out += " else { "; + } + } else { + out += " if (!" + $nextValid + ") { "; + } + if ($elsePresent) { + $it.schema = it.schema["else"]; + $it.schemaPath = it.schemaPath + ".else"; + $it.errSchemaPath = it.errSchemaPath + "/else"; + out += " " + it.validate($it) + " "; + $it.baseId = $currentBaseId; + out += " " + $valid + " = " + $nextValid + "; "; + if ($thenPresent && $elsePresent) { + $ifClause = "ifClause" + $lvl; + out += " var " + $ifClause + " = 'else'; "; + } else { + $ifClause = "'else'"; + } + out += " } "; + } + out += " if (!" + $valid + ") { var err = "; + if (it.createErrors !== false) { + out += " { keyword: 'if' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { failingKeyword: " + $ifClause + " } "; + if (it.opts.messages !== false) { + out += ` , message: 'should match "' + ` + $ifClause + ` + '" schema' `; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError(vErrors); "; + } else { + out += " validate.errors = vErrors; return false; "; + } + } + out += " } "; + if ($breakOnError) { + out += " else { "; + } + } else { + if ($breakOnError) { + out += " if (true) { "; + } + } + return out; +}; +var items = function generate_items(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $valid = "valid" + $lvl; + var $errs = "errs__" + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ""; + $it.level++; + var $nextValid = "valid" + $it.level; + var $idx = "i" + $lvl, $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $currentBaseId = it.baseId; + out += "var " + $errs + " = errors;var " + $valid + ";"; + if (Array.isArray($schema2)) { + var $additionalItems = it.schema.additionalItems; + if ($additionalItems === false) { + out += " " + $valid + " = " + $data + ".length <= " + $schema2.length + "; "; + var $currErrSchemaPath = $errSchemaPath; + $errSchemaPath = it.errSchemaPath + "/additionalItems"; + out += " if (!" + $valid + ") { "; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'additionalItems' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schema2.length + " } "; + if (it.opts.messages !== false) { + out += " , message: 'should NOT have more than " + $schema2.length + " items' "; + } + if (it.opts.verbose) { + out += " , schema: false , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " } "; + $errSchemaPath = $currErrSchemaPath; + if ($breakOnError) { + $closingBraces += "}"; + out += " else { "; + } + } + var arr1 = $schema2; + if (arr1) { + var $sch, $i = -1, l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { + out += " " + $nextValid + " = true; if (" + $data + ".length > " + $i + ") { "; + var $passData = $data + "[" + $i + "]"; + $it.schema = $sch; + $it.schemaPath = $schemaPath + "[" + $i + "]"; + $it.errSchemaPath = $errSchemaPath + "/" + $i; + $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); + $it.dataPathArr[$dataNxt] = $i; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += " " + it.util.varReplace($code, $nextData, $passData) + " "; + } else { + out += " var " + $nextData + " = " + $passData + "; " + $code + " "; + } + out += " } "; + if ($breakOnError) { + out += " if (" + $nextValid + ") { "; + $closingBraces += "}"; + } + } + } + } + if (typeof $additionalItems == "object" && (it.opts.strictKeywords ? typeof $additionalItems == "object" && Object.keys($additionalItems).length > 0 || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) { + $it.schema = $additionalItems; + $it.schemaPath = it.schemaPath + ".additionalItems"; + $it.errSchemaPath = it.errSchemaPath + "/additionalItems"; + out += " " + $nextValid + " = true; if (" + $data + ".length > " + $schema2.length + ") { for (var " + $idx + " = " + $schema2.length + "; " + $idx + " < " + $data + ".length; " + $idx + "++) { "; + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + "[" + $idx + "]"; + $it.dataPathArr[$dataNxt] = $idx; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += " " + it.util.varReplace($code, $nextData, $passData) + " "; + } else { + out += " var " + $nextData + " = " + $passData + "; " + $code + " "; + } + if ($breakOnError) { + out += " if (!" + $nextValid + ") break; "; + } + out += " } } "; + if ($breakOnError) { + out += " if (" + $nextValid + ") { "; + $closingBraces += "}"; + } + } + } else if (it.opts.strictKeywords ? typeof $schema2 == "object" && Object.keys($schema2).length > 0 || $schema2 === false : it.util.schemaHasRules($schema2, it.RULES.all)) { + $it.schema = $schema2; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += " for (var " + $idx + " = 0; " + $idx + " < " + $data + ".length; " + $idx + "++) { "; + $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); + var $passData = $data + "[" + $idx + "]"; + $it.dataPathArr[$dataNxt] = $idx; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += " " + it.util.varReplace($code, $nextData, $passData) + " "; + } else { + out += " var " + $nextData + " = " + $passData + "; " + $code + " "; + } + if ($breakOnError) { + out += " if (!" + $nextValid + ") break; "; + } + out += " }"; + } + if ($breakOnError) { + out += " " + $closingBraces + " if (" + $errs + " == errors) {"; + } + return out; +}; +var _limit = function generate__limit(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = "data" + ($dataLvl || ""); + var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; + if ($isData) { + out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; + $schemaValue = "schema" + $lvl; + } else { + $schemaValue = $schema2; + } + var $isMax = $keyword == "maximum", $exclusiveKeyword = $isMax ? "exclusiveMaximum" : "exclusiveMinimum", $schemaExcl = it.schema[$exclusiveKeyword], $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data, $op = $isMax ? "<" : ">", $notOp = $isMax ? ">" : "<", $errorKeyword = void 0; + if (!($isData || typeof $schema2 == "number" || $schema2 === void 0)) { + throw new Error($keyword + " must be number"); + } + if (!($isDataExcl || $schemaExcl === void 0 || typeof $schemaExcl == "number" || typeof $schemaExcl == "boolean")) { + throw new Error($exclusiveKeyword + " must be number or boolean"); + } + if ($isDataExcl) { + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), $exclusive = "exclusive" + $lvl, $exclType = "exclType" + $lvl, $exclIsNumber = "exclIsNumber" + $lvl, $opExpr = "op" + $lvl, $opStr = "' + " + $opExpr + " + '"; + out += " var schemaExcl" + $lvl + " = " + $schemaValueExcl + "; "; + $schemaValueExcl = "schemaExcl" + $lvl; + out += " var " + $exclusive + "; var " + $exclType + " = typeof " + $schemaValueExcl + "; if (" + $exclType + " != 'boolean' && " + $exclType + " != 'undefined' && " + $exclType + " != 'number') { "; + var $errorKeyword = $exclusiveKeyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: '" + ($errorKeyword || "_exclusiveLimit") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; + if (it.opts.messages !== false) { + out += " , message: '" + $exclusiveKeyword + " should be boolean' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " } else if ( "; + if ($isData) { + out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; + } + out += " " + $exclType + " == 'number' ? ( (" + $exclusive + " = " + $schemaValue + " === undefined || " + $schemaValueExcl + " " + $op + "= " + $schemaValue + ") ? " + $data + " " + $notOp + "= " + $schemaValueExcl + " : " + $data + " " + $notOp + " " + $schemaValue + " ) : ( (" + $exclusive + " = " + $schemaValueExcl + " === true) ? " + $data + " " + $notOp + "= " + $schemaValue + " : " + $data + " " + $notOp + " " + $schemaValue + " ) || " + $data + " !== " + $data + ") { var op" + $lvl + " = " + $exclusive + " ? '" + $op + "' : '" + $op + "='; "; + if ($schema2 === void 0) { + $errorKeyword = $exclusiveKeyword; + $errSchemaPath = it.errSchemaPath + "/" + $exclusiveKeyword; + $schemaValue = $schemaValueExcl; + $isData = $isDataExcl; + } + } else { + var $exclIsNumber = typeof $schemaExcl == "number", $opStr = $op; + if ($exclIsNumber && $isData) { + var $opExpr = "'" + $opStr + "'"; + out += " if ( "; + if ($isData) { + out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; + } + out += " ( " + $schemaValue + " === undefined || " + $schemaExcl + " " + $op + "= " + $schemaValue + " ? " + $data + " " + $notOp + "= " + $schemaExcl + " : " + $data + " " + $notOp + " " + $schemaValue + " ) || " + $data + " !== " + $data + ") { "; + } else { + if ($exclIsNumber && $schema2 === void 0) { + $exclusive = true; + $errorKeyword = $exclusiveKeyword; + $errSchemaPath = it.errSchemaPath + "/" + $exclusiveKeyword; + $schemaValue = $schemaExcl; + $notOp += "="; + } else { + if ($exclIsNumber) + $schemaValue = Math[$isMax ? "min" : "max"]($schemaExcl, $schema2); + if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { + $exclusive = true; + $errorKeyword = $exclusiveKeyword; + $errSchemaPath = it.errSchemaPath + "/" + $exclusiveKeyword; + $notOp += "="; + } else { + $exclusive = false; + $opStr += "="; + } + } + var $opExpr = "'" + $opStr + "'"; + out += " if ( "; + if ($isData) { + out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; + } + out += " " + $data + " " + $notOp + " " + $schemaValue + " || " + $data + " !== " + $data + ") { "; + } + } + $errorKeyword = $errorKeyword || $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: '" + ($errorKeyword || "_limit") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { comparison: " + $opExpr + ", limit: " + $schemaValue + ", exclusive: " + $exclusive + " } "; + if (it.opts.messages !== false) { + out += " , message: 'should be " + $opStr + " "; + if ($isData) { + out += "' + " + $schemaValue; + } else { + out += "" + $schemaValue + "'"; + } + } + if (it.opts.verbose) { + out += " , schema: "; + if ($isData) { + out += "validate.schema" + $schemaPath; + } else { + out += "" + $schema2; + } + out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " } "; + if ($breakOnError) { + out += " else { "; + } + return out; +}; +var _limitItems = function generate__limitItems(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = "data" + ($dataLvl || ""); + var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; + if ($isData) { + out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; + $schemaValue = "schema" + $lvl; + } else { + $schemaValue = $schema2; + } + if (!($isData || typeof $schema2 == "number")) { + throw new Error($keyword + " must be number"); + } + var $op = $keyword == "maxItems" ? ">" : "<"; + out += "if ( "; + if ($isData) { + out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; + } + out += " " + $data + ".length " + $op + " " + $schemaValue + ") { "; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: '" + ($errorKeyword || "_limitItems") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schemaValue + " } "; + if (it.opts.messages !== false) { + out += " , message: 'should NOT have "; + if ($keyword == "maxItems") { + out += "more"; + } else { + out += "fewer"; + } + out += " than "; + if ($isData) { + out += "' + " + $schemaValue + " + '"; + } else { + out += "" + $schema2; + } + out += " items' "; + } + if (it.opts.verbose) { + out += " , schema: "; + if ($isData) { + out += "validate.schema" + $schemaPath; + } else { + out += "" + $schema2; + } + out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += "} "; + if ($breakOnError) { + out += " else { "; + } + return out; +}; +var _limitLength = function generate__limitLength(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = "data" + ($dataLvl || ""); + var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; + if ($isData) { + out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; + $schemaValue = "schema" + $lvl; + } else { + $schemaValue = $schema2; + } + if (!($isData || typeof $schema2 == "number")) { + throw new Error($keyword + " must be number"); + } + var $op = $keyword == "maxLength" ? ">" : "<"; + out += "if ( "; + if ($isData) { + out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; + } + if (it.opts.unicode === false) { + out += " " + $data + ".length "; + } else { + out += " ucs2length(" + $data + ") "; + } + out += " " + $op + " " + $schemaValue + ") { "; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: '" + ($errorKeyword || "_limitLength") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schemaValue + " } "; + if (it.opts.messages !== false) { + out += " , message: 'should NOT be "; + if ($keyword == "maxLength") { + out += "longer"; + } else { + out += "shorter"; + } + out += " than "; + if ($isData) { + out += "' + " + $schemaValue + " + '"; + } else { + out += "" + $schema2; + } + out += " characters' "; + } + if (it.opts.verbose) { + out += " , schema: "; + if ($isData) { + out += "validate.schema" + $schemaPath; + } else { + out += "" + $schema2; + } + out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += "} "; + if ($breakOnError) { + out += " else { "; + } + return out; +}; +var _limitProperties = function generate__limitProperties(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = "data" + ($dataLvl || ""); + var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; + if ($isData) { + out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; + $schemaValue = "schema" + $lvl; + } else { + $schemaValue = $schema2; + } + if (!($isData || typeof $schema2 == "number")) { + throw new Error($keyword + " must be number"); + } + var $op = $keyword == "maxProperties" ? ">" : "<"; + out += "if ( "; + if ($isData) { + out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; + } + out += " Object.keys(" + $data + ").length " + $op + " " + $schemaValue + ") { "; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: '" + ($errorKeyword || "_limitProperties") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schemaValue + " } "; + if (it.opts.messages !== false) { + out += " , message: 'should NOT have "; + if ($keyword == "maxProperties") { + out += "more"; + } else { + out += "fewer"; + } + out += " than "; + if ($isData) { + out += "' + " + $schemaValue + " + '"; + } else { + out += "" + $schema2; + } + out += " properties' "; + } + if (it.opts.verbose) { + out += " , schema: "; + if ($isData) { + out += "validate.schema" + $schemaPath; + } else { + out += "" + $schema2; + } + out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += "} "; + if ($breakOnError) { + out += " else { "; + } + return out; +}; +var multipleOf = function generate_multipleOf(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; + if ($isData) { + out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; + $schemaValue = "schema" + $lvl; + } else { + $schemaValue = $schema2; + } + if (!($isData || typeof $schema2 == "number")) { + throw new Error($keyword + " must be number"); + } + out += "var division" + $lvl + ";if ("; + if ($isData) { + out += " " + $schemaValue + " !== undefined && ( typeof " + $schemaValue + " != 'number' || "; + } + out += " (division" + $lvl + " = " + $data + " / " + $schemaValue + ", "; + if (it.opts.multipleOfPrecision) { + out += " Math.abs(Math.round(division" + $lvl + ") - division" + $lvl + ") > 1e-" + it.opts.multipleOfPrecision + " "; + } else { + out += " division" + $lvl + " !== parseInt(division" + $lvl + ") "; + } + out += " ) "; + if ($isData) { + out += " ) "; + } + out += " ) { "; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'multipleOf' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { multipleOf: " + $schemaValue + " } "; + if (it.opts.messages !== false) { + out += " , message: 'should be multiple of "; + if ($isData) { + out += "' + " + $schemaValue; + } else { + out += "" + $schemaValue + "'"; + } + } + if (it.opts.verbose) { + out += " , schema: "; + if ($isData) { + out += "validate.schema" + $schemaPath; + } else { + out += "" + $schema2; + } + out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += "} "; + if ($breakOnError) { + out += " else { "; + } + return out; +}; +var not = function generate_not(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $errs = "errs__" + $lvl; + var $it = it.util.copy(it); + $it.level++; + var $nextValid = "valid" + $it.level; + if (it.opts.strictKeywords ? typeof $schema2 == "object" && Object.keys($schema2).length > 0 || $schema2 === false : it.util.schemaHasRules($schema2, it.RULES.all)) { + $it.schema = $schema2; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + out += " var " + $errs + " = errors; "; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.createErrors = false; + var $allErrorsOption; + if ($it.opts.allErrors) { + $allErrorsOption = $it.opts.allErrors; + $it.opts.allErrors = false; + } + out += " " + it.validate($it) + " "; + $it.createErrors = true; + if ($allErrorsOption) + $it.opts.allErrors = $allErrorsOption; + it.compositeRule = $it.compositeRule = $wasComposite; + out += " if (" + $nextValid + ") { "; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'not' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; + if (it.opts.messages !== false) { + out += " , message: 'should NOT be valid' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " } else { errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } "; + if (it.opts.allErrors) { + out += " } "; + } + } else { + out += " var err = "; + if (it.createErrors !== false) { + out += " { keyword: 'not' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; + if (it.opts.messages !== false) { + out += " , message: 'should NOT be valid' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + if ($breakOnError) { + out += " if (false) { "; + } + } + return out; +}; +var oneOf = function generate_oneOf(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $valid = "valid" + $lvl; + var $errs = "errs__" + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ""; + $it.level++; + var $nextValid = "valid" + $it.level; + var $currentBaseId = $it.baseId, $prevValid = "prevValid" + $lvl, $passingSchemas = "passingSchemas" + $lvl; + out += "var " + $errs + " = errors , " + $prevValid + " = false , " + $valid + " = false , " + $passingSchemas + " = null; "; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var arr1 = $schema2; + if (arr1) { + var $sch, $i = -1, l1 = arr1.length - 1; + while ($i < l1) { + $sch = arr1[$i += 1]; + if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { + $it.schema = $sch; + $it.schemaPath = $schemaPath + "[" + $i + "]"; + $it.errSchemaPath = $errSchemaPath + "/" + $i; + out += " " + it.validate($it) + " "; + $it.baseId = $currentBaseId; + } else { + out += " var " + $nextValid + " = true; "; + } + if ($i) { + out += " if (" + $nextValid + " && " + $prevValid + ") { " + $valid + " = false; " + $passingSchemas + " = [" + $passingSchemas + ", " + $i + "]; } else { "; + $closingBraces += "}"; + } + out += " if (" + $nextValid + ") { " + $valid + " = " + $prevValid + " = true; " + $passingSchemas + " = " + $i + "; }"; + } + } + it.compositeRule = $it.compositeRule = $wasComposite; + out += "" + $closingBraces + "if (!" + $valid + ") { var err = "; + if (it.createErrors !== false) { + out += " { keyword: 'oneOf' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { passingSchemas: " + $passingSchemas + " } "; + if (it.opts.messages !== false) { + out += " , message: 'should match exactly one schema in oneOf' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError(vErrors); "; + } else { + out += " validate.errors = vErrors; return false; "; + } + } + out += "} else { errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; }"; + if (it.opts.allErrors) { + out += " } "; + } + return out; +}; +var pattern = function generate_pattern(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; + if ($isData) { + out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; + $schemaValue = "schema" + $lvl; + } else { + $schemaValue = $schema2; + } + var $regexp = $isData ? "(new RegExp(" + $schemaValue + "))" : it.usePattern($schema2); + out += "if ( "; + if ($isData) { + out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'string') || "; + } + out += " !" + $regexp + ".test(" + $data + ") ) { "; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'pattern' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { pattern: "; + if ($isData) { + out += "" + $schemaValue; + } else { + out += "" + it.util.toQuotedString($schema2); + } + out += " } "; + if (it.opts.messages !== false) { + out += ` , message: 'should match pattern "`; + if ($isData) { + out += "' + " + $schemaValue + " + '"; + } else { + out += "" + it.util.escapeQuotes($schema2); + } + out += `"' `; + } + if (it.opts.verbose) { + out += " , schema: "; + if ($isData) { + out += "validate.schema" + $schemaPath; + } else { + out += "" + it.util.toQuotedString($schema2); + } + out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += "} "; + if ($breakOnError) { + out += " else { "; + } + return out; +}; +var properties$2 = function generate_properties(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $errs = "errs__" + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ""; + $it.level++; + var $nextValid = "valid" + $it.level; + var $key = "key" + $lvl, $idx = "idx" + $lvl, $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $dataProperties = "dataProperties" + $lvl; + var $schemaKeys = Object.keys($schema2 || {}).filter(notProto), $pProperties = it.schema.patternProperties || {}, $pPropertyKeys = Object.keys($pProperties).filter(notProto), $aProperties = it.schema.additionalProperties, $someProperties = $schemaKeys.length || $pPropertyKeys.length, $noAdditional = $aProperties === false, $additionalIsSchema = typeof $aProperties == "object" && Object.keys($aProperties).length, $removeAdditional = it.opts.removeAdditional, $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, $ownProperties = it.opts.ownProperties, $currentBaseId = it.baseId; + var $required = it.schema.required; + if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) { + var $requiredHash = it.util.toHash($required); + } + function notProto(p) { + return p !== "__proto__"; + } + out += "var " + $errs + " = errors;var " + $nextValid + " = true;"; + if ($ownProperties) { + out += " var " + $dataProperties + " = undefined;"; + } + if ($checkAdditional) { + if ($ownProperties) { + out += " " + $dataProperties + " = " + $dataProperties + " || Object.keys(" + $data + "); for (var " + $idx + "=0; " + $idx + "<" + $dataProperties + ".length; " + $idx + "++) { var " + $key + " = " + $dataProperties + "[" + $idx + "]; "; + } else { + out += " for (var " + $key + " in " + $data + ") { "; + } + if ($someProperties) { + out += " var isAdditional" + $lvl + " = !(false "; + if ($schemaKeys.length) { + if ($schemaKeys.length > 8) { + out += " || validate.schema" + $schemaPath + ".hasOwnProperty(" + $key + ") "; + } else { + var arr1 = $schemaKeys; + if (arr1) { + var $propertyKey, i1 = -1, l1 = arr1.length - 1; + while (i1 < l1) { + $propertyKey = arr1[i1 += 1]; + out += " || " + $key + " == " + it.util.toQuotedString($propertyKey) + " "; + } + } + } + } + if ($pPropertyKeys.length) { + var arr2 = $pPropertyKeys; + if (arr2) { + var $pProperty, $i = -1, l2 = arr2.length - 1; + while ($i < l2) { + $pProperty = arr2[$i += 1]; + out += " || " + it.usePattern($pProperty) + ".test(" + $key + ") "; + } + } + } + out += " ); if (isAdditional" + $lvl + ") { "; + } + if ($removeAdditional == "all") { + out += " delete " + $data + "[" + $key + "]; "; + } else { + var $currentErrorPath = it.errorPath; + var $additionalProperty = "' + " + $key + " + '"; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + } + if ($noAdditional) { + if ($removeAdditional) { + out += " delete " + $data + "[" + $key + "]; "; + } else { + out += " " + $nextValid + " = false; "; + var $currErrSchemaPath = $errSchemaPath; + $errSchemaPath = it.errSchemaPath + "/additionalProperties"; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'additionalProperties' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { additionalProperty: '" + $additionalProperty + "' } "; + if (it.opts.messages !== false) { + out += " , message: '"; + if (it.opts._errorDataPathProperty) { + out += "is an invalid additional property"; + } else { + out += "should NOT have additional properties"; + } + out += "' "; + } + if (it.opts.verbose) { + out += " , schema: false , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + $errSchemaPath = $currErrSchemaPath; + if ($breakOnError) { + out += " break; "; + } + } + } else if ($additionalIsSchema) { + if ($removeAdditional == "failing") { + out += " var " + $errs + " = errors; "; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + $it.schema = $aProperties; + $it.schemaPath = it.schemaPath + ".additionalProperties"; + $it.errSchemaPath = it.errSchemaPath + "/additionalProperties"; + $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + "[" + $key + "]"; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += " " + it.util.varReplace($code, $nextData, $passData) + " "; + } else { + out += " var " + $nextData + " = " + $passData + "; " + $code + " "; + } + out += " if (!" + $nextValid + ") { errors = " + $errs + "; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete " + $data + "[" + $key + "]; } "; + it.compositeRule = $it.compositeRule = $wasComposite; + } else { + $it.schema = $aProperties; + $it.schemaPath = it.schemaPath + ".additionalProperties"; + $it.errSchemaPath = it.errSchemaPath + "/additionalProperties"; + $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + "[" + $key + "]"; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += " " + it.util.varReplace($code, $nextData, $passData) + " "; + } else { + out += " var " + $nextData + " = " + $passData + "; " + $code + " "; + } + if ($breakOnError) { + out += " if (!" + $nextValid + ") break; "; + } + } + } + it.errorPath = $currentErrorPath; + } + if ($someProperties) { + out += " } "; + } + out += " } "; + if ($breakOnError) { + out += " if (" + $nextValid + ") { "; + $closingBraces += "}"; + } + } + var $useDefaults = it.opts.useDefaults && !it.compositeRule; + if ($schemaKeys.length) { + var arr3 = $schemaKeys; + if (arr3) { + var $propertyKey, i3 = -1, l3 = arr3.length - 1; + while (i3 < l3) { + $propertyKey = arr3[i3 += 1]; + var $sch = $schema2[$propertyKey]; + if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { + var $prop = it.util.getProperty($propertyKey), $passData = $data + $prop, $hasDefault = $useDefaults && $sch.default !== void 0; + $it.schema = $sch; + $it.schemaPath = $schemaPath + $prop; + $it.errSchemaPath = $errSchemaPath + "/" + it.util.escapeFragment($propertyKey); + $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); + $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + $code = it.util.varReplace($code, $nextData, $passData); + var $useData = $passData; + } else { + var $useData = $nextData; + out += " var " + $nextData + " = " + $passData + "; "; + } + if ($hasDefault) { + out += " " + $code + " "; + } else { + if ($requiredHash && $requiredHash[$propertyKey]) { + out += " if ( " + $useData + " === undefined "; + if ($ownProperties) { + out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; + } + out += ") { " + $nextValid + " = false; "; + var $currentErrorPath = it.errorPath, $currErrSchemaPath = $errSchemaPath, $missingProperty = it.util.escapeQuotes($propertyKey); + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + $errSchemaPath = it.errSchemaPath + "/required"; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; + if (it.opts.messages !== false) { + out += " , message: '"; + if (it.opts._errorDataPathProperty) { + out += "is a required property"; + } else { + out += "should have required property \\'" + $missingProperty + "\\'"; + } + out += "' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + $errSchemaPath = $currErrSchemaPath; + it.errorPath = $currentErrorPath; + out += " } else { "; + } else { + if ($breakOnError) { + out += " if ( " + $useData + " === undefined "; + if ($ownProperties) { + out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; + } + out += ") { " + $nextValid + " = true; } else { "; + } else { + out += " if (" + $useData + " !== undefined "; + if ($ownProperties) { + out += " && Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; + } + out += " ) { "; + } + } + out += " " + $code + " } "; + } + } + if ($breakOnError) { + out += " if (" + $nextValid + ") { "; + $closingBraces += "}"; + } + } + } + } + if ($pPropertyKeys.length) { + var arr4 = $pPropertyKeys; + if (arr4) { + var $pProperty, i4 = -1, l4 = arr4.length - 1; + while (i4 < l4) { + $pProperty = arr4[i4 += 1]; + var $sch = $pProperties[$pProperty]; + if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { + $it.schema = $sch; + $it.schemaPath = it.schemaPath + ".patternProperties" + it.util.getProperty($pProperty); + $it.errSchemaPath = it.errSchemaPath + "/patternProperties/" + it.util.escapeFragment($pProperty); + if ($ownProperties) { + out += " " + $dataProperties + " = " + $dataProperties + " || Object.keys(" + $data + "); for (var " + $idx + "=0; " + $idx + "<" + $dataProperties + ".length; " + $idx + "++) { var " + $key + " = " + $dataProperties + "[" + $idx + "]; "; + } else { + out += " for (var " + $key + " in " + $data + ") { "; + } + out += " if (" + it.usePattern($pProperty) + ".test(" + $key + ")) { "; + $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); + var $passData = $data + "[" + $key + "]"; + $it.dataPathArr[$dataNxt] = $key; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += " " + it.util.varReplace($code, $nextData, $passData) + " "; + } else { + out += " var " + $nextData + " = " + $passData + "; " + $code + " "; + } + if ($breakOnError) { + out += " if (!" + $nextValid + ") break; "; + } + out += " } "; + if ($breakOnError) { + out += " else " + $nextValid + " = true; "; + } + out += " } "; + if ($breakOnError) { + out += " if (" + $nextValid + ") { "; + $closingBraces += "}"; + } + } + } + } + } + if ($breakOnError) { + out += " " + $closingBraces + " if (" + $errs + " == errors) {"; + } + return out; +}; +var propertyNames = function generate_propertyNames(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $errs = "errs__" + $lvl; + var $it = it.util.copy(it); + var $closingBraces = ""; + $it.level++; + var $nextValid = "valid" + $it.level; + out += "var " + $errs + " = errors;"; + if (it.opts.strictKeywords ? typeof $schema2 == "object" && Object.keys($schema2).length > 0 || $schema2 === false : it.util.schemaHasRules($schema2, it.RULES.all)) { + $it.schema = $schema2; + $it.schemaPath = $schemaPath; + $it.errSchemaPath = $errSchemaPath; + var $key = "key" + $lvl, $idx = "idx" + $lvl, $i = "i" + $lvl, $invalidName = "' + " + $key + " + '", $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $dataProperties = "dataProperties" + $lvl, $ownProperties = it.opts.ownProperties, $currentBaseId = it.baseId; + if ($ownProperties) { + out += " var " + $dataProperties + " = undefined; "; + } + if ($ownProperties) { + out += " " + $dataProperties + " = " + $dataProperties + " || Object.keys(" + $data + "); for (var " + $idx + "=0; " + $idx + "<" + $dataProperties + ".length; " + $idx + "++) { var " + $key + " = " + $dataProperties + "[" + $idx + "]; "; + } else { + out += " for (var " + $key + " in " + $data + ") { "; + } + out += " var startErrs" + $lvl + " = errors; "; + var $passData = $key; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var $code = it.validate($it); + $it.baseId = $currentBaseId; + if (it.util.varOccurences($code, $nextData) < 2) { + out += " " + it.util.varReplace($code, $nextData, $passData) + " "; + } else { + out += " var " + $nextData + " = " + $passData + "; " + $code + " "; + } + it.compositeRule = $it.compositeRule = $wasComposite; + out += " if (!" + $nextValid + ") { for (var " + $i + "=startErrs" + $lvl + "; " + $i + " 0 || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) { + $required[$required.length] = $property; + } + } + } + } else { + var $required = $schema2; + } + } + if ($isData || $required.length) { + var $currentErrorPath = it.errorPath, $loopRequired = $isData || $required.length >= it.opts.loopRequired, $ownProperties = it.opts.ownProperties; + if ($breakOnError) { + out += " var missing" + $lvl + "; "; + if ($loopRequired) { + if (!$isData) { + out += " var " + $vSchema + " = validate.schema" + $schemaPath + "; "; + } + var $i = "i" + $lvl, $propertyPath = "schema" + $lvl + "[" + $i + "]", $missingProperty = "' + " + $propertyPath + " + '"; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); + } + out += " var " + $valid + " = true; "; + if ($isData) { + out += " if (schema" + $lvl + " === undefined) " + $valid + " = true; else if (!Array.isArray(schema" + $lvl + ")) " + $valid + " = false; else {"; + } + out += " for (var " + $i + " = 0; " + $i + " < " + $vSchema + ".length; " + $i + "++) { " + $valid + " = " + $data + "[" + $vSchema + "[" + $i + "]] !== undefined "; + if ($ownProperties) { + out += " && Object.prototype.hasOwnProperty.call(" + $data + ", " + $vSchema + "[" + $i + "]) "; + } + out += "; if (!" + $valid + ") break; } "; + if ($isData) { + out += " } "; + } + out += " if (!" + $valid + ") { "; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; + if (it.opts.messages !== false) { + out += " , message: '"; + if (it.opts._errorDataPathProperty) { + out += "is a required property"; + } else { + out += "should have required property \\'" + $missingProperty + "\\'"; + } + out += "' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " } else { "; + } else { + out += " if ( "; + var arr2 = $required; + if (arr2) { + var $propertyKey, $i = -1, l2 = arr2.length - 1; + while ($i < l2) { + $propertyKey = arr2[$i += 1]; + if ($i) { + out += " || "; + } + var $prop = it.util.getProperty($propertyKey), $useData = $data + $prop; + out += " ( ( " + $useData + " === undefined "; + if ($ownProperties) { + out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; + } + out += ") && (missing" + $lvl + " = " + it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) + ") ) "; + } + } + out += ") { "; + var $propertyPath = "missing" + $lvl, $missingProperty = "' + " + $propertyPath + " + '"; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + " + " + $propertyPath; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; + if (it.opts.messages !== false) { + out += " , message: '"; + if (it.opts._errorDataPathProperty) { + out += "is a required property"; + } else { + out += "should have required property \\'" + $missingProperty + "\\'"; + } + out += "' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " } else { "; + } + } else { + if ($loopRequired) { + if (!$isData) { + out += " var " + $vSchema + " = validate.schema" + $schemaPath + "; "; + } + var $i = "i" + $lvl, $propertyPath = "schema" + $lvl + "[" + $i + "]", $missingProperty = "' + " + $propertyPath + " + '"; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); + } + if ($isData) { + out += " if (" + $vSchema + " && !Array.isArray(" + $vSchema + ")) { var err = "; + if (it.createErrors !== false) { + out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; + if (it.opts.messages !== false) { + out += " , message: '"; + if (it.opts._errorDataPathProperty) { + out += "is a required property"; + } else { + out += "should have required property \\'" + $missingProperty + "\\'"; + } + out += "' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (" + $vSchema + " !== undefined) { "; + } + out += " for (var " + $i + " = 0; " + $i + " < " + $vSchema + ".length; " + $i + "++) { if (" + $data + "[" + $vSchema + "[" + $i + "]] === undefined "; + if ($ownProperties) { + out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", " + $vSchema + "[" + $i + "]) "; + } + out += ") { var err = "; + if (it.createErrors !== false) { + out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; + if (it.opts.messages !== false) { + out += " , message: '"; + if (it.opts._errorDataPathProperty) { + out += "is a required property"; + } else { + out += "should have required property \\'" + $missingProperty + "\\'"; + } + out += "' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } "; + if ($isData) { + out += " } "; + } + } else { + var arr3 = $required; + if (arr3) { + var $propertyKey, i3 = -1, l3 = arr3.length - 1; + while (i3 < l3) { + $propertyKey = arr3[i3 += 1]; + var $prop = it.util.getProperty($propertyKey), $missingProperty = it.util.escapeQuotes($propertyKey), $useData = $data + $prop; + if (it.opts._errorDataPathProperty) { + it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); + } + out += " if ( " + $useData + " === undefined "; + if ($ownProperties) { + out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; + } + out += ") { var err = "; + if (it.createErrors !== false) { + out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; + if (it.opts.messages !== false) { + out += " , message: '"; + if (it.opts._errorDataPathProperty) { + out += "is a required property"; + } else { + out += "should have required property \\'" + $missingProperty + "\\'"; + } + out += "' "; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "; + } + } + } + } + it.errorPath = $currentErrorPath; + } else if ($breakOnError) { + out += " if (true) {"; + } + return out; +}; +var uniqueItems = function generate_uniqueItems(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $data = "data" + ($dataLvl || ""); + var $valid = "valid" + $lvl; + var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; + if ($isData) { + out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; + $schemaValue = "schema" + $lvl; + } else { + $schemaValue = $schema2; + } + if (($schema2 || $isData) && it.opts.uniqueItems !== false) { + if ($isData) { + out += " var " + $valid + "; if (" + $schemaValue + " === false || " + $schemaValue + " === undefined) " + $valid + " = true; else if (typeof " + $schemaValue + " != 'boolean') " + $valid + " = false; else { "; + } + out += " var i = " + $data + ".length , " + $valid + " = true , j; if (i > 1) { "; + var $itemType = it.schema.items && it.schema.items.type, $typeIsArray = Array.isArray($itemType); + if (!$itemType || $itemType == "object" || $itemType == "array" || $typeIsArray && ($itemType.indexOf("object") >= 0 || $itemType.indexOf("array") >= 0)) { + out += " outer: for (;i--;) { for (j = i; j--;) { if (equal(" + $data + "[i], " + $data + "[j])) { " + $valid + " = false; break outer; } } } "; + } else { + out += " var itemIndices = {}, item; for (;i--;) { var item = " + $data + "[i]; "; + var $method = "checkDataType" + ($typeIsArray ? "s" : ""); + out += " if (" + it.util[$method]($itemType, "item", it.opts.strictNumbers, true) + ") continue; "; + if ($typeIsArray) { + out += ` if (typeof item == 'string') item = '"' + item; `; + } + out += " if (typeof itemIndices[item] == 'number') { " + $valid + " = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "; + } + out += " } "; + if ($isData) { + out += " } "; + } + out += " if (!" + $valid + ") { "; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: 'uniqueItems' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { i: i, j: j } "; + if (it.opts.messages !== false) { + out += " , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "; + } + if (it.opts.verbose) { + out += " , schema: "; + if ($isData) { + out += "validate.schema" + $schemaPath; + } else { + out += "" + $schema2; + } + out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + out += " } "; + if ($breakOnError) { + out += " else { "; + } + } else { + if ($breakOnError) { + out += " if (true) { "; + } + } + return out; +}; +var dotjs = { + "$ref": ref, + allOf, + anyOf, + "$comment": comment, + const: _const, + contains, + dependencies, + "enum": _enum, + format, + "if": _if, + items, + maximum: _limit, + minimum: _limit, + maxItems: _limitItems, + minItems: _limitItems, + maxLength: _limitLength, + minLength: _limitLength, + maxProperties: _limitProperties, + minProperties: _limitProperties, + multipleOf, + not, + oneOf, + pattern, + properties: properties$2, + propertyNames, + required: required$1, + uniqueItems, + validate: validate$1 +}; +var ruleModules = dotjs, toHash = util$5.toHash; +var rules$1 = function rules() { + var RULES = [ + { + type: "number", + rules: [ + { "maximum": ["exclusiveMaximum"] }, + { "minimum": ["exclusiveMinimum"] }, + "multipleOf", + "format" + ] + }, + { + type: "string", + rules: ["maxLength", "minLength", "pattern", "format"] + }, + { + type: "array", + rules: ["maxItems", "minItems", "items", "contains", "uniqueItems"] + }, + { + type: "object", + rules: [ + "maxProperties", + "minProperties", + "required", + "dependencies", + "propertyNames", + { "properties": ["additionalProperties", "patternProperties"] } + ] + }, + { rules: ["$ref", "const", "enum", "not", "anyOf", "oneOf", "allOf", "if"] } + ]; + var ALL = ["type", "$comment"]; + var KEYWORDS2 = [ + "$schema", + "$id", + "id", + "$data", + "$async", + "title", + "description", + "default", + "definitions", + "examples", + "readOnly", + "writeOnly", + "contentMediaType", + "contentEncoding", + "additionalItems", + "then", + "else" + ]; + var TYPES = ["number", "integer", "string", "array", "object", "boolean", "null"]; + RULES.all = toHash(ALL); + RULES.types = toHash(TYPES); + RULES.forEach(function(group2) { + group2.rules = group2.rules.map(function(keyword2) { + var implKeywords; + if (typeof keyword2 == "object") { + var key = Object.keys(keyword2)[0]; + implKeywords = keyword2[key]; + keyword2 = key; + implKeywords.forEach(function(k) { + ALL.push(k); + RULES.all[k] = true; + }); + } + ALL.push(keyword2); + var rule = RULES.all[keyword2] = { + keyword: keyword2, + code: ruleModules[keyword2], + implements: implKeywords + }; + return rule; + }); + RULES.all.$comment = { + keyword: "$comment", + code: ruleModules.$comment + }; + if (group2.type) + RULES.types[group2.type] = group2; + }); + RULES.keywords = toHash(ALL.concat(KEYWORDS2)); + RULES.custom = {}; + return RULES; +}; +var KEYWORDS = [ + "multipleOf", + "maximum", + "exclusiveMaximum", + "minimum", + "exclusiveMinimum", + "maxLength", + "minLength", + "pattern", + "additionalItems", + "maxItems", + "minItems", + "uniqueItems", + "maxProperties", + "minProperties", + "required", + "additionalProperties", + "enum", + "format", + "const" +]; +var data = function(metaSchema2, keywordsJsonPointers) { + for (var i = 0; i < keywordsJsonPointers.length; i++) { + metaSchema2 = JSON.parse(JSON.stringify(metaSchema2)); + var segments = keywordsJsonPointers[i].split("/"); + var keywords = metaSchema2; + var j; + for (j = 1; j < segments.length; j++) + keywords = keywords[segments[j]]; + for (j = 0; j < KEYWORDS.length; j++) { + var key = KEYWORDS[j]; + var schema = keywords[key]; + if (schema) { + keywords[key] = { + anyOf: [ + schema, + { $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" } + ] + }; + } + } + } + return metaSchema2; +}; +var MissingRefError = error_classes.MissingRef; +var async = compileAsync; +function compileAsync(schema, meta, callback) { + var self2 = this; + if (typeof this._opts.loadSchema != "function") + throw new Error("options.loadSchema should be a function"); + if (typeof meta == "function") { + callback = meta; + meta = void 0; + } + var p = loadMetaSchemaOf(schema).then(function() { + var schemaObj = self2._addSchema(schema, void 0, meta); + return schemaObj.validate || _compileAsync(schemaObj); + }); + if (callback) { + p.then( + function(v) { + callback(null, v); + }, + callback + ); + } + return p; + function loadMetaSchemaOf(sch) { + var $schema2 = sch.$schema; + return $schema2 && !self2.getSchema($schema2) ? compileAsync.call(self2, { $ref: $schema2 }, true) : Promise.resolve(); + } + function _compileAsync(schemaObj) { + try { + return self2._compile(schemaObj); + } catch (e) { + if (e instanceof MissingRefError) + return loadMissingSchema(e); + throw e; + } + function loadMissingSchema(e) { + var ref2 = e.missingSchema; + if (added(ref2)) + throw new Error("Schema " + ref2 + " is loaded but " + e.missingRef + " cannot be resolved"); + var schemaPromise = self2._loadingSchemas[ref2]; + if (!schemaPromise) { + schemaPromise = self2._loadingSchemas[ref2] = self2._opts.loadSchema(ref2); + schemaPromise.then(removePromise, removePromise); + } + return schemaPromise.then(function(sch) { + if (!added(ref2)) { + return loadMetaSchemaOf(sch).then(function() { + if (!added(ref2)) + self2.addSchema(sch, ref2, void 0, meta); + }); + } + }).then(function() { + return _compileAsync(schemaObj); + }); + function removePromise() { + delete self2._loadingSchemas[ref2]; + } + function added(ref3) { + return self2._refs[ref3] || self2._schemas[ref3]; + } + } + } +} +var custom = function generate_custom(it, $keyword, $ruleType) { + var out = " "; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema2 = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + "/" + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = "data" + ($dataLvl || ""); + var $valid = "valid" + $lvl; + var $errs = "errs__" + $lvl; + var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; + if ($isData) { + out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; + $schemaValue = "schema" + $lvl; + } else { + $schemaValue = $schema2; + } + var $rule = this, $definition = "definition" + $lvl, $rDef = $rule.definition, $closingBraces = ""; + var $compile, $inline, $macro, $ruleValidate, $validateCode; + if ($isData && $rDef.$data) { + $validateCode = "keywordValidate" + $lvl; + var $validateSchema = $rDef.validateSchema; + out += " var " + $definition + " = RULES.custom['" + $keyword + "'].definition; var " + $validateCode + " = " + $definition + ".validate;"; + } else { + $ruleValidate = it.useCustomRule($rule, $schema2, it.schema, it); + if (!$ruleValidate) + return; + $schemaValue = "validate.schema" + $schemaPath; + $validateCode = $ruleValidate.code; + $compile = $rDef.compile; + $inline = $rDef.inline; + $macro = $rDef.macro; + } + var $ruleErrs = $validateCode + ".errors", $i = "i" + $lvl, $ruleErr = "ruleErr" + $lvl, $asyncKeyword = $rDef.async; + if ($asyncKeyword && !it.async) + throw new Error("async keyword in sync schema"); + if (!($inline || $macro)) { + out += "" + $ruleErrs + " = null;"; + } + out += "var " + $errs + " = errors;var " + $valid + ";"; + if ($isData && $rDef.$data) { + $closingBraces += "}"; + out += " if (" + $schemaValue + " === undefined) { " + $valid + " = true; } else { "; + if ($validateSchema) { + $closingBraces += "}"; + out += " " + $valid + " = " + $definition + ".validateSchema(" + $schemaValue + "); if (" + $valid + ") { "; + } + } + if ($inline) { + if ($rDef.statements) { + out += " " + $ruleValidate.validate + " "; + } else { + out += " " + $valid + " = " + $ruleValidate.validate + "; "; + } + } else if ($macro) { + var $it = it.util.copy(it); + var $closingBraces = ""; + $it.level++; + var $nextValid = "valid" + $it.level; + $it.schema = $ruleValidate.validate; + $it.schemaPath = ""; + var $wasComposite = it.compositeRule; + it.compositeRule = $it.compositeRule = true; + var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); + it.compositeRule = $it.compositeRule = $wasComposite; + out += " " + $code; + } else { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + out += " " + $validateCode + ".call( "; + if (it.opts.passContext) { + out += "this"; + } else { + out += "self"; + } + if ($compile || $rDef.schema === false) { + out += " , " + $data + " "; + } else { + out += " , " + $schemaValue + " , " + $data + " , validate.schema" + it.schemaPath + " "; + } + out += " , (dataPath || '')"; + if (it.errorPath != '""') { + out += " + " + it.errorPath; + } + var $parentData = $dataLvl ? "data" + ($dataLvl - 1 || "") : "parentData", $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : "parentDataProperty"; + out += " , " + $parentData + " , " + $parentDataProperty + " , rootData ) "; + var def_callRuleValidate = out; + out = $$outStack.pop(); + if ($rDef.errors === false) { + out += " " + $valid + " = "; + if ($asyncKeyword) { + out += "await "; + } + out += "" + def_callRuleValidate + "; "; + } else { + if ($asyncKeyword) { + $ruleErrs = "customErrors" + $lvl; + out += " var " + $ruleErrs + " = null; try { " + $valid + " = await " + def_callRuleValidate + "; } catch (e) { " + $valid + " = false; if (e instanceof ValidationError) " + $ruleErrs + " = e.errors; else throw e; } "; + } else { + out += " " + $ruleErrs + " = null; " + $valid + " = " + def_callRuleValidate + "; "; + } + } + } + if ($rDef.modifying) { + out += " if (" + $parentData + ") " + $data + " = " + $parentData + "[" + $parentDataProperty + "];"; + } + out += "" + $closingBraces; + if ($rDef.valid) { + if ($breakOnError) { + out += " if (true) { "; + } + } else { + out += " if ( "; + if ($rDef.valid === void 0) { + out += " !"; + if ($macro) { + out += "" + $nextValid; + } else { + out += "" + $valid; + } + } else { + out += " " + !$rDef.valid + " "; + } + out += ") { "; + $errorKeyword = $rule.keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ""; + if (it.createErrors !== false) { + out += " { keyword: '" + ($errorKeyword || "custom") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { keyword: '" + $rule.keyword + "' } "; + if (it.opts.messages !== false) { + out += ` , message: 'should pass "` + $rule.keyword + `" keyword validation' `; + } + if (it.opts.verbose) { + out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; + } + out += " } "; + } else { + out += " {} "; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { + if (it.async) { + out += " throw new ValidationError([" + __err + "]); "; + } else { + out += " validate.errors = [" + __err + "]; return false; "; + } + } else { + out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; + } + var def_customError = out; + out = $$outStack.pop(); + if ($inline) { + if ($rDef.errors) { + if ($rDef.errors != "full") { + out += " for (var " + $i + "=" + $errs + "; " + $i + " { + callback(t, i, ts); + traverseTracks(t, callback); + }); + } else if ("views" in spec) { + spec.views.forEach((view) => traverseTracks(view, callback)); + } +} +function traverseTracksAndViews(spec, callback) { + if ("tracks" in spec) { + spec.tracks.forEach((t) => { + callback(t); + traverseTracksAndViews(t, callback); + }); + } else if ("views" in spec) { + spec.views.forEach((v) => { + callback(v); + traverseTracksAndViews(v, callback); + }); + } +} +function traverseViewArrangements(spec, callback) { + if ("tracks" in spec) + ; + else { + callback(spec); + spec.views.forEach((v) => { + traverseViewArrangements(v, callback); + }); + } +} +function convertToFlatTracks(spec) { + if (IsFlatTracks(spec)) { + const base = { ...spec, tracks: void 0, id: void 0 }; + return spec.tracks.filter((track) => !track._invalidTrack).map((track) => Object.assign(JSON.parse(JSON.stringify(base)), track)); + } + const newTracks = []; + if (IsStackedTracks(spec)) { + spec.tracks.filter((track) => !track._invalidTrack).map((track) => { + if ("alignment" in track) { + newTracks.push({ + ...track, + _overlay: [...track.tracks], + tracks: void 0, + alignment: void 0 + }); + } else { + const base = { ...spec, tracks: void 0, id: void 0 }; + const newSpec = Object.assign(JSON.parse(JSON.stringify(base)), track); + newTracks.push(newSpec); + } + }); + } else { + newTracks.push({ + ...spec, + _overlay: [...spec.tracks.filter((track) => !track._invalidTrack)], + tracks: void 0, + alignment: void 0 + }); + } + return JSON.parse(JSON.stringify(newTracks)); +} +function traverseToFixSpecDownstream(spec, parentDef) { + if (parentDef) { + if (spec.assembly === void 0) + spec.assembly = parentDef.assembly; + if (spec.layout === void 0) + spec.layout = parentDef.layout; + if (spec.orientation === void 0) + spec.orientation = parentDef.orientation; + if (spec.static === void 0) + spec.static = parentDef.static !== void 0 ? parentDef.static : false; + if (spec.zoomLimits === void 0) + spec.zoomLimits = parentDef.zoomLimits; + if (spec.xDomain === void 0) + spec.xDomain = parentDef.xDomain; + if (spec.yDomain === void 0) + spec.yDomain = parentDef.yDomain; + if (spec.linkingId === void 0) + spec.linkingId = parentDef.linkingId; + if (spec.centerRadius === void 0) + spec.centerRadius = parentDef.centerRadius; + if (spec.spacing === void 0 && !("tracks" in spec)) + spec.spacing = parentDef.spacing; + if (spec.xOffset === void 0) + spec.xOffset = parentDef.xOffset; + if (spec.yOffset === void 0) + spec.yOffset = parentDef.yOffset; + if ("views" in spec && "arrangement" in parentDef && spec.arrangement === void 0) + spec.arrangement = parentDef.arrangement; + spec.style = getStyleOverridden(parentDef.style, spec.style); + } else { + if (spec.assembly === void 0) + spec.assembly = "hg38"; + if (spec.layout === void 0) + spec.layout = "linear"; + if (spec.orientation === void 0) + spec.orientation = "horizontal"; + if (spec.static === void 0) + spec.static = false; + if (spec.zoomLimits === void 0) + spec.zoomLimits = [1, null]; + if (spec.centerRadius === void 0) + spec.centerRadius = DEFAULT_INNER_RADIUS_PROP; + if (spec.spacing === void 0) + spec.spacing = DEFAULT_VIEW_SPACING; + if ("views" in spec && spec.arrangement === void 0) + spec.arrangement = "vertical"; + if (spec.xOffset === void 0) + spec.xOffset = 0; + if (spec.yOffset === void 0) + spec.yOffset = 0; + } + if (!spec.id) { + spec.id = uuid(); + } + if ("tracks" in spec) { + let tracks = convertToFlatTracks(spec); + tracks = spreadTracksByData(tracks); + const linkID = uuid(); + tracks.forEach((track, i, array) => { + var _a, _b, _c; + if (!track.id) { + track.id = uuid(); + } + if (!track.width) { + track.width = Is2DTrack(track) ? DEFAULT_TRACK_SIZE_2D : DEFAULT_TRACK_WIDTH_LINEAR; + } + if (!track.height) { + track.height = Is2DTrack(track) ? DEFAULT_TRACK_SIZE_2D : DEFAULT_TRACK_HEIGHT_LINEAR; + } + if ("displacement" in track) { + if (((_a = track.displacement) == null ? void 0 : _a.type) === "pile" && track.row === void 0 && IsChannelDeep(track.x) && track.x.field && IsChannelDeep(track.xe) && track.xe.field) { + const newField = uuid(); + const startField = track.x.field; + const endField = track.xe.field; + const padding = track.displacement.padding; + const displaceTransform = { + type: "displace", + newField, + boundingBox: { startField, endField, padding }, + method: "pile" + }; + if (!track.dataTransform) { + track.dataTransform = []; + } + track.dataTransform = [...track.dataTransform, displaceTransform]; + track.row = { field: newField, type: "nominal" }; + } else if (((_b = track.displacement) == null ? void 0 : _b.type) === "spread") + ; + } + if (track.layout) + track.layout = void 0; + if (track.zoomLimits) + track.zoomLimits = void 0; + if (!track.assembly) + track.assembly = spec.assembly; + if (!track.layout) + track.layout = spec.layout; + if (!track.orientation) + track.orientation = spec.orientation; + if (track.static === void 0) + track.static = spec.static !== void 0 ? spec.static : false; + if (!track.zoomLimits) + track.zoomLimits = spec.zoomLimits; + if (track.layout == "circular" && IsDummyTrack(track)) { + track._invalidTrack = true; + return; + } + track.style = getStyleOverridden(spec.style, track.style); + if (IsOverlaidTrack(track)) { + track._overlay = track._overlay.filter((overlayTrack) => { + return !("type" in overlayTrack && overlayTrack.type == "dummy-track"); + }); + track._overlay.forEach((o) => { + o.style = getStyleOverridden(track.style, o.style); + }); + } + if ((track.layout === "circular" || Is2DTrack(track)) && track.orientation === "vertical") { + track.orientation = "horizontal"; + } + if (Is2DTrack(track)) { + track.layout = "linear"; + if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.y) && !track.y.domain) { + track.y.domain = spec.yDomain; + } else if (IsOverlaidTrack(track)) { + track._overlay.forEach((o) => { + if (IsChannelDeep(o.y) && !o.y.domain) { + o.y.domain = spec.yDomain; + } + }); + } + } + if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.domain) { + track.x.domain = spec.xDomain; + } else if (IsOverlaidTrack(track)) { + track._overlay.forEach((o) => { + if (IsChannelDeep(o.x) && !o.x.domain) { + o.x.domain = spec.xDomain; + } + }); + } + if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.linkingId) { + track.x.linkingId = (_c = spec.linkingId) != null ? _c : linkID; + } else if (IsOverlaidTrack(track)) { + let isAdded = false; + track._overlay.forEach((o) => { + var _a2; + if (isAdded) + return; + if (IsChannelDeep(o.x) && !o.x.linkingId) { + o.x.linkingId = (_a2 = spec.linkingId) != null ? _a2 : linkID; + isAdded = true; + } + }); + } + if (i === 0) { + track.overlayOnPreviousTrack = false; + } + if (i === 0 || i !== 0 && tracks.slice(0, i).filter((d) => !d.overlayOnPreviousTrack).length === 1 && track.overlayOnPreviousTrack === true) { + if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.axis) { + if (track.orientation === "vertical") { + track.x.axis = "left"; + } else { + track.x.axis = "top"; + } + } else if (IsOverlaidTrack(track)) { + track._overlay.forEach((o) => { + if (IsChannelDeep(o.x) && !o.x.axis) { + if (track.orientation === "vertical") { + o.x.axis = "left"; + } else { + o.x.axis = "top"; + } + } + }); + } + } + if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && track.x.axis && track.x.axis !== "none") { + if (track.orientation === "vertical") { + if (track.x.axis === "top") { + track.x.axis = "left"; + } else if (track.x.axis === "bottom") { + track.x.axis = "right"; + } + } else { + if (track.x.axis === "left") { + track.x.axis = "top"; + } else if (track.x.axis === "right") { + track.x.axis = "bottom"; + } + } + } else if (IsOverlaidTrack(track)) { + track._overlay.forEach((o) => { + if (IsChannelDeep(o.x) && o.x.axis && o.x.axis !== "none") { + if (track.orientation === "vertical") { + if (o.x.axis === "top") { + o.x.axis = "left"; + } else if (o.x.axis === "bottom") { + o.x.axis = "right"; + } + } else { + if (o.x.axis === "left") { + o.x.axis = "top"; + } else if (o.x.axis === "right") { + o.x.axis = "bottom"; + } + } + } + }); + } + if ( + // first track can never flipped by default + i !== 0 && // [0, ..., i] tracks should not overlaid as a single track + (i === array.length - 1 && array.slice(0, i + 1).filter((d) => d.overlayOnPreviousTrack).length < i || // Are the rest of the tracks overlaid as a single track? + i !== array.length - 1 && array.slice(i + 1).filter((d) => d.overlayOnPreviousTrack).length === array.length - i - 1 && array.slice(0, i + 1).filter((d) => d.overlayOnPreviousTrack).length < i) + ) { + if (IsSingleTrack(track) && track.mark === "withinLink" && track.flipY === void 0) { + track.flipY = true; + } else if (IsOverlaidTrack(track)) { + if (track.mark === "withinLink" && track.flipY === void 0) { + track.flipY = true; + } + track._overlay.forEach((o) => { + if (o.mark === "withinLink" && o.flipY === void 0) { + o.flipY = true; + } + }); + } + } + if (track.overlayOnPreviousTrack && array[i - 1]) { + track.width = array[i - 1].width; + track.height = array[i - 1].height; + track.layout = array[i - 1].layout; + track.assembly = array[i - 1].assembly; + } + }); + tracks = tracks.filter((track) => !track._invalidTrack); + spec.tracks = tracks; + } else { + spec.views.forEach((v) => { + traverseToFixSpecDownstream(v, spec); + }); + } +} +function getVectorTemplate(column, value) { + return { + data: { + type: "vector", + url: "", + column, + value + }, + mark: "bar", + x: { field: column, type: "genomic", axis: "top" }, + y: { field: value, type: "quantitative" }, + width: 400, + height: 100 + }; +} +function getMultivecTemplate(row, column, value, categories) { + return categories && categories.length < 10 ? { + data: { + type: "multivec", + url: "", + row, + column, + value, + categories + }, + mark: "bar", + x: { field: column, type: "genomic", axis: "top" }, + y: { field: value, type: "quantitative" }, + row: { field: row, type: "nominal", legend: true }, + color: { field: row, type: "nominal" }, + width: 400, + height: 100 + } : { + data: { + type: "multivec", + url: "", + row, + column, + value, + categories + }, + mark: "rect", + x: { field: column, type: "genomic", axis: "top" }, + row: { field: row, type: "nominal", legend: true }, + color: { field: value, type: "quantitative" }, + width: 400, + height: 100 + }; +} +function overrideDataTemplates(spec) { + traverseTracks(spec, (t, i, ts) => { + var _a, _b, _c, _d, _e; + if (!("data" in t) || !t.data || !IsDataDeepTileset(t.data)) { + return; + } + if ("alignment" in t) { + return; + } + if (!IsDataTemplate(t)) { + return; + } + switch (t.data.type) { + case "vector": + case "bigwig": + ts[i] = Object.assign(getVectorTemplate((_a = t.data.column) != null ? _a : "position", (_b = t.data.value) != null ? _b : "value"), t); + break; + case "multivec": + ts[i] = Object.assign( + getMultivecTemplate( + (_c = t.data.row) != null ? _c : "category", + (_d = t.data.column) != null ? _d : "position", + (_e = t.data.value) != null ? _e : "value", + t.data.categories + ), + t + ); + break; + } + }); +} +const CHROM_SIZE_HG38 = { + chr1: 248956422, + chr2: 242193529, + chr3: 198295559, + chr4: 190214555, + chr5: 181538259, + chr6: 170805979, + chr7: 159345973, + chr8: 145138636, + chr9: 138394717, + chr10: 133797422, + chr11: 135086622, + chr12: 133275309, + chr13: 114364328, + chr14: 107043718, + chr15: 101991189, + chr16: 90338345, + chr17: 83257441, + chr18: 80373285, + chr19: 58617616, + chr20: 64444167, + chr21: 46709983, + chr22: 50818468, + chrX: 156040895, + chrY: 57227415 +}; +const CHROM_SIZE_HG19 = { + chr1: 249250621, + chr2: 243199373, + chr3: 198022430, + chr4: 191154276, + chr5: 180915260, + chr6: 171115067, + chr7: 159138663, + chr8: 146364022, + chr9: 141213431, + chr10: 135534747, + chr11: 135006516, + chr12: 133851895, + chr13: 115169878, + chr14: 107349540, + chr15: 102531392, + chr16: 90354753, + chr17: 81195210, + chr18: 78077248, + chr19: 59128983, + chr20: 63025520, + chr21: 48129895, + chr22: 51304566, + chrX: 155270560, + chrY: 59373566, + chrM: 16571 +}; +const CHROM_SIZE_HG18 = { + chr1: 247249719, + chr2: 242951149, + chr3: 199501827, + chr4: 191273063, + chr5: 180857866, + chr6: 170899992, + chr7: 158821424, + chr8: 146274826, + chr9: 140273252, + chr10: 135374737, + chr11: 134452384, + chr12: 132349534, + chr13: 114142980, + chr14: 106368585, + chr15: 100338915, + chr16: 88827254, + chr17: 78774742, + chr18: 76117153, + chr19: 63811651, + chr20: 62435964, + chr21: 46944323, + chr22: 49691432, + chrX: 154913754, + chrY: 57772954, + chrM: 16571 +}; +const CHROM_SIZE_HG17 = { + chr1: 245522847, + chr2: 243018229, + chr3: 199505740, + chr4: 191411218, + chr5: 180857866, + chr6: 170975699, + chr7: 158628139, + chr8: 146274826, + chr9: 138429268, + chr10: 135413628, + chr11: 134452384, + chr12: 132449811, + chr13: 114142980, + chr14: 106368585, + chr15: 100338915, + chr16: 88827254, + chr17: 78774742, + chr18: 76117153, + chr19: 63811651, + chr20: 62435964, + chr21: 46944323, + chr22: 49554710, + chrX: 154824264, + chrY: 57701691, + chrM: 16571 +}; +const CHROM_SIZE_HG16 = { + chr1: 246127941, + chr2: 243615958, + chr3: 199344050, + chr4: 191731959, + chr5: 181034922, + chr6: 170914576, + chr7: 158545518, + chr8: 146308819, + chr9: 136372045, + chr10: 135037215, + chr11: 134482954, + chr12: 132078379, + chr13: 113042980, + chr14: 105311216, + chr15: 100256656, + chr16: 90041932, + chr17: 81860266, + chr18: 76115139, + chr19: 63811651, + chr20: 63741868, + chr21: 46976097, + chr22: 49396972, + chrX: 153692391, + chrY: 50286555, + chrM: 16571 +}; +const CHROM_SIZE_MM10 = { + chr1: 195471971, + chr2: 182113224, + chr3: 160039680, + chr4: 156508116, + chr5: 151834684, + chr6: 149736546, + chr7: 145441459, + chr8: 129401213, + chr9: 124595110, + chr10: 130694993, + chr11: 122082543, + chr12: 120129022, + chr13: 120421639, + chr14: 124902244, + chr15: 104043685, + chr16: 98207768, + chr17: 94987271, + chr18: 90702639, + chr19: 61431566, + chrX: 171031299, + chrY: 91744698, + chrM: 16299 +}; +const CHROM_SIZE_MM9 = { + chr1: 197195432, + chr2: 181748087, + chr3: 159599783, + chr4: 155630120, + chr5: 152537259, + chr6: 149517037, + chr7: 152524553, + chr8: 131738871, + chr9: 124076172, + chr10: 129993255, + chr11: 121843856, + chr12: 121257530, + chr13: 120284312, + chr14: 125194864, + chr15: 103494974, + chr16: 98319150, + chr17: 95272651, + chr18: 90772031, + chr19: 61342430, + chrX: 166650296, + chrY: 15902555, + chrM: 16299 +}; +function getRelativeGenomicPosition(absPos, assembly, returnWithinAssembly = false) { + const chrSizes = Object.entries(computeChromSizes(assembly).interval); + const minPosChr = { chromosome: "unknown", position: Infinity }; + const maxPosChr = { chromosome: "unknown", position: 0 }; + for (const chrSize of chrSizes) { + const [chromosome, absInterval] = chrSize; + const [start, end] = absInterval; + if (start <= absPos && absPos < end) { + return { chromosome, position: absPos - start }; + } + if (start < minPosChr.position) { + minPosChr.chromosome = chromosome; + minPosChr.position = start; + } + if (end > maxPosChr.position) { + maxPosChr.chromosome = chromosome; + maxPosChr.position = end; + } + } + if (returnWithinAssembly) { + if (absPos < minPosChr.position) { + return minPosChr; + } else { + return maxPosChr; + } + } else { + return { chromosome: "unknown", position: absPos }; + } +} +function createChromSizesUrl(chromSizes) { + const text = chromSizes.map((d) => d.join(" ")).join("\n"); + const tsv = new Blob([text], { type: "text/tsv" }); + return URL.createObjectURL(tsv); +} +function computeChromSizes(assembly) { + if (assembly && typeof assembly === "string" && assembly in CRHOM_SIZES) { + return CRHOM_SIZES[assembly]; + } else if (Array.isArray(assembly) && assembly.length !== 0) { + const size = Object.fromEntries(assembly); + return { + size, + interval: getChromInterval(size), + total: getChromTotalSize(size), + path: createChromSizesUrl(assembly) + }; + } else { + return CRHOM_SIZES.hg38; + } +} +const basePath = (assembly) => `https://s3.amazonaws.com/gosling-lang.org/data/${assembly}.chrom.sizes`; +const CRHOM_SIZES = Object.freeze({ + hg38: { + size: CHROM_SIZE_HG38, + interval: getChromInterval(CHROM_SIZE_HG38), + total: getChromTotalSize(CHROM_SIZE_HG38), + path: basePath("hg38") + }, + hg19: { + size: CHROM_SIZE_HG19, + interval: getChromInterval(CHROM_SIZE_HG19), + total: getChromTotalSize(CHROM_SIZE_HG19), + path: basePath("hg19") + }, + hg18: { + size: CHROM_SIZE_HG18, + interval: getChromInterval(CHROM_SIZE_HG18), + total: getChromTotalSize(CHROM_SIZE_HG18), + path: basePath("hg18") + }, + hg17: { + size: CHROM_SIZE_HG17, + interval: getChromInterval(CHROM_SIZE_HG17), + total: getChromTotalSize(CHROM_SIZE_HG17), + path: basePath("hg17") + }, + hg16: { + size: CHROM_SIZE_HG16, + interval: getChromInterval(CHROM_SIZE_HG16), + total: getChromTotalSize(CHROM_SIZE_HG16), + path: basePath("hg16") + }, + mm10: { + size: CHROM_SIZE_MM10, + interval: getChromInterval(CHROM_SIZE_MM10), + total: getChromTotalSize(CHROM_SIZE_MM10), + path: basePath("mm10") + }, + mm9: { + size: CHROM_SIZE_MM9, + interval: getChromInterval(CHROM_SIZE_MM9), + total: getChromTotalSize(CHROM_SIZE_MM9), + path: basePath("mm9") + }, + // `unknown` assembly contains only one chromosome with max length + unknown: { + size: { chr: Number.MAX_VALUE }, + interval: { chr: [0, Number.MAX_VALUE] }, + total: Number.MAX_VALUE, + path: basePath("hg38") + // just to ensure this does not make crash + } +}); +function getAutoCompleteId(assembly) { + switch (assembly) { + case "hg19": + return "OHJakQICQD6gTD7skx4EWA"; + case "mm10": + return "QDutvmyiSrec5nX4pA5WGQ"; + case "mm9": + return "GUm5aBiLRCyz2PsBea7Yzg"; + case "hg38": + default: + return "P0PLbQMwTYGy-5uPIQid7A"; + } +} +function getChromInterval(chromSize) { + const interval = {}; + Object.keys(chromSize).reduce((sum, k) => { + interval[k] = [sum, sum + chromSize[k]]; + return sum + chromSize[k]; + }, 0); + return interval; +} +function getChromTotalSize(chromSize) { + return Object.values(chromSize).reduce((sum, current) => sum + current, 0); +} +function parseGenomicPosition(position) { + const [chromosome, intervalString] = position.split(":"); + if (intervalString) { + const [start, end] = intervalString.split("-").map((s) => +s.replace(/,/g, "")); + if (!Number.isNaN(start) && !Number.isNaN(end)) { + return { chromosome, start, end }; + } + } + return { chromosome }; +} +class GenomicPositionHelper { + constructor(chromosome, start, end) { + this.chromosome = chromosome; + this.start = start; + this.end = end; + } + static fromString(str) { + const result = parseGenomicPosition(str); + return new GenomicPositionHelper(result.chromosome, result.start, result.end); + } + toAbsoluteCoordinates(assembly, padding = 0) { + const info = computeChromSizes(assembly); + const size = info.size[this.chromosome]; + const interval = info.interval[this.chromosome]; + if (size === void 0 || interval === void 0) { + throw new Error(`Chromosome name ${this.chromosome} is not valid`); + } + let { start, end } = this; + if (start === void 0 || end === void 0) { + [start, end] = [1, size]; + } + const offset = interval[0]; + return [start + offset - padding, end + offset + padding]; + } +} +function filterUsingGenoPos(data2, [minX, maxX], config) { + const { x, xe, x1, x1e } = config; + const definedXFields = [x, xe, x1, x1e].filter((f) => f); + return data2.filter((d) => { + if (definedXFields.length === 0) { + return true; + } else if (definedXFields.length === 1) { + const value = +d[definedXFields[0]]; + return typeof value === "number" && minX < value && value <= maxX; + } else { + const values = definedXFields.map((f) => +d[f]).filter((v) => !isNaN(v)); + const minValue = Math.min(...values); + const maxValue = Math.max(...values); + return minX <= maxValue && minValue <= maxX; + } + }); +} +bisector((d) => d.pos).left; +function sanitizeChrName(chrName, assembly, chromosomePrefix) { + if (Array.isArray(assembly)) { + return chrName; + } + if (chromosomePrefix) { + chrName = chrName.replace(chromosomePrefix, "chr"); + } else if (!chrName.includes("chr")) { + chrName = `chr${chrName}`; + } + return chrName; +} +class RemoteFile extends RemoteFile$1 { + constructor() { + super(...arguments); + // Overrides `read` to eagerly read 200 or 206 response + // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162 + __publicField(this, "read", async (buffer, offset = 0, length, position = 0, opts = {}) => { + const { headers = {}, signal, overrides = {} } = opts; + if (length < Infinity) { + headers.range = `bytes=${position}-${position + length}`; + } else if (length === Infinity && position !== 0) { + headers.range = `bytes=${position}-`; + } + const args = { + // @ts-expect-error private property + ...this.baseOverrides, + ...overrides, + headers: { + ...headers, + ...overrides.headers, + // @ts-expect-error private property + ...this.baseOverrides.headers + }, + method: "GET", + redirect: "follow", + mode: "cors", + signal + }; + const response = await this.fetch(this.url, args); + if (!response.ok) { + throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`); + } + if (response.status === 200 || response.status === 206) { + const responseData = await this.getBufferFromResponse(response); + const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length)); + const res = response.headers.get("content-range"); + const sizeMatch = /\/(\d+)$/.exec(res || ""); + if (sizeMatch && sizeMatch[1]) { + this._stat = { size: parseInt(sizeMatch[1], 10) }; + } + return { bytesRead: bytesCopied, buffer }; + } + throw new Error(`HTTP ${response.status} fetching ${this.url}`); + }); + } +} +export { + IsDummyTrack as $, + Ajv$1 as A, + rectProperty as B, + pointProperty as C, + barProperty as D, + IsStackedChannel as E, + IsDomainArray as F, + IsRangeArray as G, + Is2DTrack as H, + IsChannelDeep as I, + isTabularDataFetcher as J, + drawPreEmbellishment as K, + drawMark as L, + drawPostEmbellishment as M, + getRelativeGenomicPosition as N, + hasDataTransform as O, + PREDEFINED_COLOR_STR_MAP as P, + IsXAxis as Q, + RADIAN_GAP as R, + SUPPORTED_CHANNELS as S, + IsMouseEventsDeep as T, + colorToHex as U, + flatArrayToPairArray as V, + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM as W, + traverseTracksAndViews as X, + traverseViewArrangements as Y, + DEFAULT_VIEW_SPACING as Z, + DEFAULT_INNER_RADIUS_PROP as _, + IsTemplateTrack as a, + IsOverlaidTrack as a0, + IsYAxis as a1, + DEFAULT_CIRCULAR_VIEW_PADDING as a2, + IsDataDeep as a3, + IsHiGlassMatrix as a4, + getHiGlassColorRange as a5, + DEFAULT_TEXT_STYLE as a6, + overrideDataTemplates as a7, + traverseToFixSpecDownstream as a8, + GenomicPositionHelper as a9, + isObject as aa, + getChromInterval as ab, + getChromTotalSize as ac, + parseGenomicPosition as ad, + convertToFlatTracks as ae, + spreadTracksByData as af, + cartesianToPolar as b, + computeChromSizes as c, + commonjsGlobal as d, + RemoteFile as e, + IsOneOfFilter as f, + getTextStyle as g, + IsRangeFilter as h, + IsIncludeFilter as i, + getChannelKeysByAggregateFnc as j, + getChannelKeysByType as k, + filterUsingGenoPos as l, + IsDataDeepTileset as m, + IsDomainChr as n, + IsDomainInterval as o, + pointsToDegree as p, + IsDomainChrInterval as q, + resolveSuperposedTracks as r, + sanitizeChrName as s, + traverseTracks as t, + uuid as u, + valueToRadian as v, + insertItemToArray as w, + getAutoCompleteId as x, + IsChannelValue as y, + getValueUsingChannel as z +}; +//# sourceMappingURL=exported-utils-c80467e4.js.map diff --git a/dist/exported-utils-c80467e4.js.map b/dist/exported-utils-c80467e4.js.map new file mode 100644 index 00000000..d0973c31 --- /dev/null +++ b/dist/exported-utils-c80467e4.js.map @@ -0,0 +1 @@ +{"version":3,"file":"exported-utils-c80467e4.js","sources":["../src/compiler/defaults.ts","../src/core/utils/color-to-hex.ts","../src/core/utils/polar.ts","../src/core/mark/point.ts","../src/core/mark/line.ts","../src/core/mark/bar.ts","../src/core/mark/area.ts","../src/core/mark/rect.ts","../src/core/mark/triangle.ts","../src/core/mark/text.ts","../src/core/mark/rule.ts","../src/core/mark/withinLink.ts","../src/core/utils/array.ts","../src/core/mark/grid.ts","../src/core/utils/text-style.ts","../src/core/mark/title.ts","../src/core/mark/outline.ts","../src/core/mark/legend.ts","../src/core/mark/axis.ts","../src/core/mark/outline-circular.ts","../src/core/mark/background.ts","../src/core/mark/betweenLink.ts","../src/core/mark/index.ts","../src/core/utils/overlay.ts","../src/gosling-schema/gosling.schema.guards.ts","../node_modules/.pnpm/uri-js@4.4.1/node_modules/uri-js/dist/es5/uri.all.js","../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/ucs2length.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/util.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/schema_obj.js","../node_modules/.pnpm/json-schema-traverse@0.4.1/node_modules/json-schema-traverse/index.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/resolve.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/error_classes.js","../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/validate.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/index.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/cache.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/formats.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/ref.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/allOf.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/anyOf.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/comment.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/const.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/contains.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/dependencies.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/enum.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/format.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/if.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/items.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/_limit.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/_limitItems.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/_limitLength.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/_limitProperties.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/multipleOf.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/not.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/oneOf.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/pattern.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/properties.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/propertyNames.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/required.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/uniqueItems.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/index.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/rules.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/data.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/async.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/custom.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/definition_schema.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/keyword.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/ajv.js","../src/core/utils/style.ts","../src/core/utils/uuid.ts","../src/compiler/spec-preprocess.ts","../src/core/utils/chrom-size.ts","../src/core/utils/assembly.ts","../src/data-fetchers/utils.ts"],"sourcesContent":["export const DEFAULT_VISUAL_PROPERTIES = {\n opacity: 1\n};\n\nexport const DEFAULT_TITLE_HEIGHT = 20; // deprecated\nexport const DEFAULT_SUBTITLE_HEIGHT = 20; // deprecated\nexport const DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM = 6;\n\n// default track size\nexport const DEFAULT_TRACK_HEIGHT_LINEAR = 130;\nexport const DEFAULT_TRACK_WIDTH_LINEAR = 600;\nexport const DEFAULT_TRACK_SIZE_2D = 600;\n\n// gab between views\nexport const DEFAULT_VIEW_SPACING = 10;\n\n// empty space inside the visualization for circular layouts\nexport const DEFAULT_INNER_RADIUS_PROP = 0.3;\n\n// padding around a circular view\nexport const DEFAULT_CIRCULAR_VIEW_PADDING = 0; // TODO: this is not properly considered in determining the arrangement of views\n\n// default color when cannot parse\nexport const DEFAULT_BACKUP_COLOR = 'gray';\n","import * as PIXI from 'pixi.js';\nimport { color } from 'd3-color';\nimport { DEFAULT_BACKUP_COLOR } from '../../compiler/defaults';\n\n/**\n * Convert a regular color value (e.g. 'red', '#FF0000', 'rgb(255,0,0)') to a hex value which is legible by PIXI.\n */\nconst colorToHex = (colorStr: string) => {\n let c = color(colorStr) as any;\n\n if (!c) {\n c = color(DEFAULT_BACKUP_COLOR) as any;\n }\n\n const hex = PIXI.utils.rgb2hex([c.rgb().r / 255.0, c.rgb().g / 255.0, c.rgb().b / 255.0]);\n return hex;\n};\n\nexport default colorToHex;\n","export const RADIAN_GAP = 0; //0.04;\n\n/**\n * Convert a value in a single-linear axis to a radian value. Anticlockwise, starts from 12 o'clock.\n * v span from zero to `max`.\n */\nexport function valueToRadian(v: number, max: number, sa: number, ea: number, g?: number) {\n const safeVal = Math.max(Math.min(max, v), 0);\n const gap = g ?? RADIAN_GAP;\n const radExtent = ((ea - sa) / 360) * Math.PI * 2 - gap * 2;\n const radStart = (sa / 360) * Math.PI * 2;\n return -(radStart + (safeVal / max) * radExtent) - Math.PI / 2.0 - gap;\n}\n\n/**\n * Convert a position in a cartesian system to a polar coordinate.\n */\nexport function cartesianToPolar(x: number, max: number, r: number, cx: number, cy: number, sa: number, ea: number) {\n return {\n x: cx + r * Math.cos(valueToRadian(x, max, sa, ea)),\n y: cy + r * Math.sin(valueToRadian(x, max, sa, ea))\n };\n}\n\nexport function positionToRadian(x: number, y: number, cx: number, cy: number) {\n if (cx <= x) {\n return Math.atan((y - cy) / (x - cx));\n } else {\n return Math.atan((y - cy) / (x - cx)) - Math.PI;\n }\n}\n\n/**\n * Calculate a degree in the range of [0, 360) based on two points. Anticlockwise, starts from 12 o'clock.\n */\nexport function pointsToDegree(x: number, y: number, cx: number, cy: number) {\n return ((Math.atan2(-(y - cy), x - cx) / Math.PI) * 180 + 270) % 360;\n}\n","import type * as PIXI from 'pixi.js';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport { getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport { cartesianToPolar } from '../utils/polar';\nimport type { PIXIVisualProperty } from '../visual-property.schema';\n\nexport function drawPoint(track: any, g: PIXI.Graphics, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = track.dimensions;\n const zoomLevel =\n (model.getChannelScale('x') as any).invert(trackWidth) - (model.getChannelScale('x') as any).invert(0);\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300;\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const tcx = trackWidth / 2.0;\n const tcy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* render */\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n const cx = model.encodedPIXIProperty('x-center', d);\n const cy = model.encodedPIXIProperty('y-center', d);\n const color = model.encodedPIXIProperty('color', d);\n const radius = model.encodedPIXIProperty('p-size', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n const alphaTransition = model.markVisibility(d, { width: radius, zoomLevel });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (radius <= 0.1 || actualOpacity === 0 || cx + radius < 0 || cx - radius > trackWidth) {\n // Don't draw invisible marks\n return;\n }\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n actualOpacity, // alpha\n 1 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n if (circular) {\n const r = trackOuterRadius - ((rowPosition + rowHeight - cy) / trackHeight) * trackRingSize;\n const pos = cartesianToPolar(cx, trackWidth, r, tcx, tcy, startAngle, endAngle);\n g.beginFill(colorToHex(color), actualOpacity);\n g.drawCircle(pos.x, pos.y, radius);\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, radius]);\n } else {\n g.beginFill(colorToHex(color), actualOpacity);\n g.drawCircle(cx, rowPosition + rowHeight - cy, radius);\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - cy, radius]);\n }\n });\n });\n}\n\nexport function pointProperty(\n model: GoslingTrackModel,\n propertyKey: PIXIVisualProperty,\n datum?: { [k: string]: string | number }\n) {\n const xe = model.visualPropertyByChannel('xe', datum);\n const x = model.visualPropertyByChannel('x', datum);\n const size = model.visualPropertyByChannel('size', datum);\n\n // priority of channels\n switch (propertyKey) {\n case 'x-center':\n return xe ? (xe + x) / 2.0 : x;\n case 'y-center': {\n const ye = model.visualPropertyByChannel('ye', datum);\n const y = model.visualPropertyByChannel('y', datum);\n return ye ? (ye + y) / 2.0 : y;\n }\n case 'p-size':\n return xe && model.spec().stretch ? (xe - x) / 2.0 : size;\n default:\n return undefined;\n }\n}\n","import type * as PIXI from 'pixi.js';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport { getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport { cartesianToPolar } from '../utils/polar';\n\nexport function drawLine(g: PIXI.Graphics, model: GoslingTrackModel, trackWidth: number, trackHeight: number) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220; // TODO: should default values be filled already\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const trackCenterX = trackWidth / 2.0;\n const trackCenterY = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* color separation */\n const colorCategories = (model.getChannelDomainArray('color') as string[]) ?? ['___SINGLE_COLOR___'];\n\n /* render */\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n // line marks are drawn for each color\n colorCategories.forEach(colorCategory => {\n data.filter(\n d =>\n (!getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory) &&\n (!getValueUsingChannel(d, spec.color as Channel) ||\n (getValueUsingChannel(d, spec.color as Channel) as string) === colorCategory)\n )\n .sort(\n (d1, d2) =>\n // draw from the left to right\n (getValueUsingChannel(d1, spec.x as Channel) as number) -\n (getValueUsingChannel(d2, spec.x as Channel) as number)\n )\n .forEach((d, i) => {\n const cx = model.encodedPIXIProperty('x', d);\n const y = model.encodedPIXIProperty('y', d);\n const size = model.encodedPIXIProperty('size', d);\n const color = model.encodedPIXIProperty('color', d); // should be identical for a single line\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n g.lineStyle(\n size,\n colorToHex(color),\n opacity,\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n if (circular) {\n const r = trackOuterRadius - ((rowPosition + rowHeight - y) / trackHeight) * trackRingSize;\n const pos = cartesianToPolar(\n cx,\n trackWidth,\n r,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n\n if (i === 0) {\n g.moveTo(pos.x, pos.y);\n } else {\n g.lineTo(pos.x, pos.y);\n }\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, 1]);\n } else {\n if (i === 0) {\n g.moveTo(cx, rowPosition + rowHeight - y);\n } else {\n g.lineTo(cx, rowPosition + rowHeight - y);\n }\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - y, 1]);\n }\n });\n });\n });\n}\n","import type { Tile } from '@gosling-lang/gosling-track';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { group } from 'd3-array';\nimport type { PIXIVisualProperty } from '../visual-property.schema';\nimport { IsChannelDeep, IsStackedMark, getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\n\nexport function drawBar(track: any, tile: Tile, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = track.dimensions;\n const tileSize = track.tilesetInfo.tile_size;\n const zoomLevel =\n (model.getChannelScale('x') as any).invert(trackWidth) - (model.getChannelScale('x') as any).invert(0);\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* genomic scale */\n const xScale = model.getChannelScale('x');\n let tileUnitWidth: number;\n if (tile.tileData.tilePos) {\n const { tileX, tileWidth } = track.getTilePosAndDimensions(\n tile.tileData.zoomLevel,\n tile.tileData.tilePos,\n tileSize\n );\n tileUnitWidth = xScale(tileX + tileWidth / tileSize) - xScale(tileX);\n }\n\n /* row separation */\n const rowCategories = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n const clipRow =\n !IsChannelDeep(spec.row) || (IsChannelDeep(spec.row) && typeof spec.row.clip === 'undefined') || spec.row.clip;\n\n /* baseline */\n const baselineValue = IsChannelDeep(spec.y) ? spec.y?.baseline : undefined;\n const staticBaseY = model.encodedValue('y', baselineValue) ?? 0;\n\n /* render */\n const g = tile.graphics;\n if (IsStackedMark(spec)) {\n // TODO: many parts in this scope are identical to the below `else` statement, so encaptulate this?\n // const rowGraphics = tile.graphics; // new HGC.libraries.PIXI.Graphics(); // only one row for stacked marks\n\n const genomicChannel = model.getGenomicChannel();\n if (!genomicChannel || !genomicChannel.field) {\n console.warn('Genomic field is not provided in the specification');\n return;\n }\n const pivotedData = group(data, d => d[genomicChannel.field as string]);\n const xKeys = [...pivotedData.keys()];\n\n // TODO: users may want to align rows by values\n xKeys.forEach(k => {\n let prevYEnd = 0;\n pivotedData.get(k)?.forEach(d => {\n const color = model.encodedPIXIProperty('color', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n const y = model.encodedPIXIProperty('y', d);\n\n const barWidth = model.encodedPIXIProperty('width', d, { tileUnitWidth });\n\n const xs = model.encodedPIXIProperty('x-start', d, { markWidth: barWidth });\n const xe = xs + barWidth;\n\n const alphaTransition = model.markVisibility(d, { width: barWidth, zoomLevel });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (actualOpacity === 0 || barWidth <= 0 || y <= 0) {\n // do not draw invisible marks\n return;\n }\n\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n actualOpacity,\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n let polygonForMouseEvents: number[] = [];\n\n if (circular) {\n const farR = trackOuterRadius - ((rowHeight - prevYEnd) / trackHeight) * trackRingSize;\n const nearR = trackOuterRadius - ((rowHeight - y - prevYEnd) / trackHeight) * trackRingSize;\n\n const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(xs + barWidth, trackWidth, startAngle, endAngle);\n\n g.beginFill(colorToHex(color), color === 'none' ? 0 : actualOpacity);\n g.moveTo(sPos.x, sPos.y);\n g.arc(cx, cy, nearR, startRad, endRad, true);\n g.arc(cx, cy, farR, endRad, startRad, false);\n polygonForMouseEvents = Array.from(g.currentPath.points);\n g.closePath();\n } else {\n g.beginFill(colorToHex(color), color === 'none' ? 0 : actualOpacity);\n g.drawRect(xs, rowHeight - y - prevYEnd, barWidth, y);\n const ys = rowHeight - y - prevYEnd;\n const ye = ys + y;\n polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys];\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents);\n\n prevYEnd += y;\n });\n });\n } else {\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(d => {\n const rowValue = getValueUsingChannel(d, spec.row as Channel);\n return !rowValue || rowValue === rowCategory;\n }).forEach(d => {\n const color = model.encodedPIXIProperty('color', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity');\n let y = model.encodedPIXIProperty('y', d);\n let ye = model.encodedPIXIProperty('ye', d);\n\n if (typeof ye !== 'undefined' && y > ye) {\n // ensure `ye` is larger\n [y, ye] = [ye, y];\n }\n\n const barWidth = model.encodedPIXIProperty('width', d, { tileUnitWidth });\n const xs = model.encodedPIXIProperty('x-start', d, { markWidth: barWidth });\n const xe = xs + barWidth;\n\n let ys: number;\n if (typeof ye === 'undefined') {\n ys = rowPosition + rowHeight - staticBaseY - y;\n ye = rowPosition + rowHeight - staticBaseY;\n\n // Flip the bar along y-axis\n if ((IsChannelDeep(spec.y) && spec.y.flip) || spec.flipY) {\n ye = ys;\n ys = rowPosition;\n }\n } else {\n ys = rowPosition + rowHeight - ye;\n ye = rowPosition + rowHeight - y;\n }\n\n // If the position exceeds the given scale, clip it!\n if (clipRow) {\n ys = Math.max(rowPosition, ys);\n ys = Math.min(ys, rowPosition + rowHeight);\n ye = Math.max(rowPosition, ye);\n ye = Math.min(ye, rowPosition + rowHeight);\n }\n\n const alphaTransition = model.markVisibility(d, { width: barWidth, zoomLevel });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (actualOpacity === 0 || barWidth === 0 || ye - ys === 0) {\n // do not draw invisible marks\n return;\n }\n\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n actualOpacity,\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n let polygonForMouseEvents: number[] = [];\n\n if (circular) {\n const farR = trackOuterRadius - (ys / trackHeight) * trackRingSize;\n const nearR = trackOuterRadius - (ye / trackHeight) * trackRingSize;\n\n const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(xs + barWidth, trackWidth, startAngle, endAngle);\n\n g.beginFill(colorToHex(color), color === 'none' ? 0 : actualOpacity);\n g.moveTo(sPos.x, sPos.y);\n g.arc(cx, cy, nearR, startRad, endRad, true);\n g.arc(cx, cy, farR, endRad, startRad, false);\n polygonForMouseEvents = Array.from(g.currentPath.points);\n g.closePath();\n } else {\n g.beginFill(colorToHex(color), color === 'none' ? 0 : actualOpacity);\n g.drawRect(xs, ys, barWidth, ye - ys);\n polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys];\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents);\n });\n });\n }\n}\n\nexport function barProperty(\n gm: GoslingTrackModel,\n propertyKey: PIXIVisualProperty,\n datum?: { [k: string]: string | number },\n additionalInfo?: {\n tileUnitWidth?: number;\n markWidth?: number;\n }\n) {\n const x = gm.visualPropertyByChannel('x', datum);\n const xe = gm.visualPropertyByChannel('xe', datum);\n const size = gm.visualPropertyByChannel('size', datum);\n switch (propertyKey) {\n case 'width':\n return size ?? (xe ? xe - x : additionalInfo?.tileUnitWidth);\n case 'x-start':\n if (!additionalInfo?.markWidth) {\n // `markWidth` is required\n return undefined;\n }\n return xe ? (x + xe - additionalInfo?.markWidth) / 2.0 : x - additionalInfo?.markWidth / 2.0;\n default:\n return undefined;\n }\n}\n","import { min as d3min, max as d3max, group } from 'd3-array';\nimport type { Channel, Datum } from '@gosling-lang/gosling-schema';\nimport type { Tile } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsStackedMark, getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\n\n/**\n * Draw area marks\n */\nexport function drawArea(HGC: import('@higlass/types').HGC, track: any, tile: Tile, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = track.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220; // TODO: should default values be filled already\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const trackCenterX = trackWidth / 2.0;\n const trackCenterY = trackHeight / 2.0;\n\n /* genomic scale */\n const xScale = track._xScale;\n\n /* row separation */\n const rowCategories = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* color separation */\n const colorCategories = (model.getChannelDomainArray('color') as string[]) ?? ['___SINGLE_COLOR___'];\n\n /* constant values */\n // we do not support encoding opacity, strokeWidth, and stroke for area marks\n const constantOpacity = model.encodedPIXIProperty('opacity');\n const constantStrokeWidth = model.encodedPIXIProperty('strokeWidth');\n const constantStroke = model.encodedPIXIProperty('stroke');\n\n /* render */\n const graphics = tile.graphics;\n if (IsStackedMark(spec)) {\n // TODO: many parts in this scope are identical as the below `else` statement, so encaptulate this?\n\n const genomicChannel = model.getGenomicChannel();\n if (!genomicChannel || !genomicChannel.field) {\n console.warn('Genomic field is not provided in the specification');\n return;\n }\n const pivotedData = group(data, d => d[genomicChannel.field as string]);\n const genomicPosCategories = [...pivotedData.keys()]; // TODO: make sure to be sorted from left to right or top to bottom\n\n // stroke\n graphics.lineStyle(\n constantStrokeWidth,\n colorToHex(constantStroke),\n constantOpacity,\n 1 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n const prevYEndByGPos: { [k: string]: number } = {};\n\n // TODO: we can have a multiple rows when color and row are mapped with different fields\n // are marks are drawn for each color\n colorCategories.forEach(colorCategory => {\n // we have two sets of points since we need to draw the bottom line as well\n const areaPointsTop: number[][] = [];\n const areaPointsBottom: number[][] = [];\n\n // TODO: users may want to align rows by values\n genomicPosCategories.forEach((genomicPosCategory, i, array) => {\n pivotedData\n .get(genomicPosCategory)\n ?.filter(d => getValueUsingChannel(d, spec.color as Channel) === colorCategory)\n ?.forEach(d => {\n const xValue = +genomicPosCategory;\n\n const cx = xScale(xValue);\n const cy = d3max([model.encodedPIXIProperty('y', d), 0]); // make should not to overflow\n\n if (typeof prevYEndByGPos[genomicPosCategory] === 'undefined') {\n prevYEndByGPos[genomicPosCategory] = 0;\n }\n\n const ys = rowHeight - cy - prevYEndByGPos[genomicPosCategory];\n const ye = rowHeight - prevYEndByGPos[genomicPosCategory];\n\n if (circular) {\n if (i === 0) {\n // start position of the polygon\n const r = trackOuterRadius - (rowHeight / trackHeight) * trackRingSize;\n const pos = cartesianToPolar(\n cx,\n trackWidth,\n r,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n areaPointsTop.push([pos.x, pos.y]);\n areaPointsBottom.push([pos.x, pos.y]);\n }\n\n const rTop = trackOuterRadius - (ys / trackHeight) * trackRingSize;\n const posTop = cartesianToPolar(\n cx,\n trackWidth,\n rTop,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n areaPointsTop.push([posTop.x, posTop.y]);\n\n const rBot = trackOuterRadius - (ye / trackHeight) * trackRingSize;\n const posBot = cartesianToPolar(\n cx,\n trackWidth,\n rBot,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n areaPointsBottom.push([posBot.x, posBot.y]);\n\n if (i === array.length - 1) {\n // end position of the polygon\n const r = trackOuterRadius - (rowHeight / trackHeight) * trackRingSize;\n const pos = cartesianToPolar(\n cx,\n trackWidth,\n r,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n areaPointsTop.push([pos.x, pos.y]);\n areaPointsBottom.push([pos.x, pos.y]);\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [posBot.x, posBot.y, 1]);\n } else {\n if (i === 0) {\n // start position of the polygon\n areaPointsTop.push([cx, rowHeight]); // TODO: confirm if this is correct\n areaPointsBottom.push([cx, rowHeight]);\n }\n\n areaPointsTop.push([cx, ys]);\n areaPointsBottom.push([cx, ye]);\n\n if (i === array.length - 1) {\n // end position of the polygon\n areaPointsTop.push([cx, rowHeight]);\n areaPointsBottom.push([cx, rowHeight]);\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [cx, ys, 1]);\n }\n\n prevYEndByGPos[genomicPosCategory] += cy;\n });\n });\n const color = model.encodedValue('color', colorCategory);\n graphics.beginFill(colorToHex(color), constantOpacity);\n graphics.drawPolygon([\n ...areaPointsTop.reduce((a, b) => a.concat(b)),\n ...areaPointsBottom.reverse().reduce((a, b) => a.concat(b))\n ]);\n graphics.endFill();\n });\n } else {\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n // stroke\n graphics.lineStyle(\n constantStrokeWidth,\n colorToHex(constantStroke),\n constantOpacity,\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n // area marks are drawn for each color\n colorCategories.forEach(colorCategory => {\n const baselinePoints: number[][] = [];\n const areaPoints: number[] = [];\n const baselineR = trackOuterRadius - ((rowPosition + rowHeight) / trackHeight) * trackRingSize;\n let startX = 0;\n\n data.filter(\n d =>\n (typeof getValueUsingChannel(d, spec.row as Channel) === 'undefined' ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory) &&\n (typeof getValueUsingChannel(d, spec.color as Channel) === 'undefined' ||\n (getValueUsingChannel(d, spec.color as Channel) as string) === colorCategory)\n )\n .sort(\n // should sort properly before visualizing it so that the path is correctly drawn\n (a: Datum, b: Datum) => model.encodedPIXIProperty('x', a) - model.encodedPIXIProperty('x', b)\n )\n .forEach((d, i, array) => {\n // TODO: this should be included in the `encodedValue` functions\n // make should not to overflow when using use-defined `domain`\n const cy = d3min([d3max([model.encodedPIXIProperty('y', d), 0]), rowHeight]);\n const cx = model.encodedPIXIProperty('x', d);\n\n if (circular) {\n // we need to prepare the points for drawing baseline\n const baselinePos = cartesianToPolar(\n cx,\n trackWidth,\n baselineR,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n baselinePoints.push([baselinePos.x, baselinePos.y]);\n\n if (i === 0) {\n // start position of the polygon\n areaPoints.push(baselinePos.x, baselinePos.y);\n }\n\n const r = trackOuterRadius - ((rowPosition + rowHeight - cy) / trackHeight) * trackRingSize;\n const pos = cartesianToPolar(\n cx,\n trackWidth,\n r,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n areaPoints.push(pos.x, pos.y);\n\n if (i === array.length - 1) {\n // close the polygon with a point at the start\n const startR =\n trackOuterRadius - ((rowPosition + rowHeight) / trackHeight) * trackRingSize;\n const curPos = cartesianToPolar(\n cx,\n trackWidth,\n startR,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n\n areaPoints.push(curPos.x, curPos.y);\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, 1]);\n } else {\n if (i === 0) {\n // start position of the polygon\n areaPoints.push(cx, rowPosition + rowHeight);\n startX = cx;\n }\n\n areaPoints.push(cx, rowPosition + rowHeight - cy);\n\n if (i === array.length - 1) {\n // close the polygon with a point at the start\n areaPoints.push(cx, rowPosition + rowHeight);\n areaPoints.push(startX, rowPosition + rowHeight);\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - cy, 1]);\n }\n });\n\n if (circular && baselinePoints.length !== 0) {\n // Add baseline points\n areaPoints.push(...baselinePoints.reverse().reduce((a, b) => a.concat(b)));\n }\n\n const color = model.encodedValue('color', colorCategory);\n graphics.beginFill(colorToHex(color), constantOpacity);\n graphics.drawPolygon(areaPoints);\n graphics.endFill();\n });\n });\n }\n}\n","import type { Tile } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport type { PIXIVisualProperty } from '../visual-property.schema';\nimport colorToHex from '../utils/color-to-hex';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\n\nexport function drawRect(HGC: import('@higlass/types').HGC, track: any, tile: Tile, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = track.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* genomic scale */\n const xScale = track._xScale;\n let tileUnitWidth: number;\n if (tile.tileData.tilePos) {\n const tileSize = track.tilesetInfo.tile_size;\n const { tileX, tileWidth } = track.getTilePosAndDimensions(\n tile.tileData.zoomLevel,\n tile.tileData.tilePos, // TODO: required parameter. Typing out `track` should address this issue.\n tileSize\n );\n tileUnitWidth = xScale(tileX + tileWidth / tileSize) - xScale(tileX);\n }\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n const RPAD = IsChannelDeep(spec.row) && spec.row.padding ? spec.row.padding : 0;\n\n // TODO: what if quantitative Y field is used?\n const yCategories = (model.getChannelDomainArray('y') as string[]) ?? ['___SINGLE_Y_POSITION___'];\n const cellHeight = rowHeight / yCategories.length - RPAD * 2;\n\n /* render */\n const g = tile.graphics;\n data.forEach(d => {\n const rowPosition = model.encodedPIXIProperty('row', d) + RPAD;\n const x = model.encodedPIXIProperty('x', d);\n const color = model.encodedPIXIProperty('color', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n const rectWidth = model.encodedPIXIProperty('width', d, { markWidth: tileUnitWidth });\n const rectHeight = model.encodedPIXIProperty('height', d, { markHeight: cellHeight });\n const y = model.encodedPIXIProperty('y', d); // - rectHeight / 2.0; // It is top posiiton now\n\n const alphaTransition = model.markVisibility(d, {\n width: rectWidth,\n zoomLevel: track._xScale.invert(trackWidth) - track._xScale.invert(0)\n });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (actualOpacity === 0 || rectHeight === 0 || rectWidth <= 0.0001) {\n // No need to draw invisible objects\n return;\n }\n\n const [xs, xe, ys, ye] = [\n x,\n x + rectWidth,\n rowPosition + rowHeight - y - rectHeight / 2.0,\n rowPosition + rowHeight - y + rectHeight / 2.0\n ];\n\n const absoluteHeight = model.visualPropertyByChannel('size', d) ?? undefined; // TODO: this is making it complicated, way to simplify this?\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n actualOpacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n let polygonForMouseEvent: number[] = [];\n\n if (circular) {\n if (xe < 0 || trackWidth < xs) {\n // do not draw overflewed visual marks\n return;\n }\n\n // TODO: Does a `row` channel affect here?\n let farR = trackOuterRadius - (ys / trackHeight) * trackRingSize;\n let nearR = trackOuterRadius - (ye / trackHeight) * trackRingSize;\n\n if (absoluteHeight) {\n const midR = trackOuterRadius - ((rowPosition + y) / trackHeight) * trackRingSize;\n farR = midR - absoluteHeight / 2.0;\n nearR = midR + absoluteHeight / 2.0;\n }\n\n const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(xe, trackWidth, startAngle, endAngle);\n\n g.beginFill(colorToHex(color === 'none' ? 'white' : color), color === 'none' ? 0 : actualOpacity);\n g.moveTo(sPos.x, sPos.y);\n g.arc(cx, cy, nearR, startRad, endRad, true);\n g.arc(cx, cy, farR, endRad, startRad, false);\n polygonForMouseEvent = Array.from(g.currentPath.points);\n g.closePath();\n } else {\n g.beginFill(colorToHex(color === 'none' ? 'white' : color), color === 'none' ? 0 : actualOpacity);\n g.drawRect(xs, ys, xe - xs, ye - ys);\n polygonForMouseEvent = [xs, ys, xs, ye, xe, ye, xe, ys];\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvent);\n });\n}\n\nexport function rectProperty(\n gm: GoslingTrackModel,\n propertyKey: PIXIVisualProperty,\n datum?: { [k: string]: string | number },\n additionalInfo?: {\n markHeight?: number;\n markWidth?: number;\n }\n) {\n switch (propertyKey) {\n case 'width':\n const width =\n // (1) size\n gm.visualPropertyByChannel('xe', datum)\n ? gm.visualPropertyByChannel('xe', datum) - gm.visualPropertyByChannel('x', datum)\n : // (2) unit mark height\n additionalInfo?.markWidth;\n return width === 0 ? 0.1 : width; // TODO: not sure if this is necessary for all cases. Perhaps, we can have an option.\n case 'height':\n return (\n // (1) size\n gm.visualPropertyByChannel('size', datum) ??\n // (2) unit mark height\n additionalInfo?.markHeight\n );\n default:\n return undefined;\n }\n}\n","import type * as PIXI from 'pixi.js';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Channel, Mark } from '@gosling-lang/gosling-schema';\nimport { getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport { cartesianToPolar } from '../utils/polar';\n\nexport function drawTriangle(g: PIXI.Graphics, model: GoslingTrackModel, trackWidth: number, trackHeight: number) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* track size */\n const zoomLevel =\n (model.getChannelScale('x') as any).invert(trackWidth) - (model.getChannelScale('x') as any).invert(0);\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n const yCategories: string[] = (model.getChannelDomainArray('y') as string[]) ?? ['___SINGLE_Y___'];\n const triHeight =\n model.encodedValue('size') ??\n (circular ? trackRingSize / rowCategories.length / yCategories.length : rowHeight / yCategories.length);\n\n /* render */\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n const x = model.encodedPIXIProperty('x', d);\n const xe = model.encodedPIXIProperty('xe', d);\n const markWidth = model.encodedPIXIProperty('size', d) ?? (xe === undefined ? triHeight : xe - x);\n\n const y = model.encodedPIXIProperty('y', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const color = model.encodedPIXIProperty('color', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n let polygon: number[] = [];\n\n if (circular) {\n let x0 = x ? x : xe - markWidth;\n let x1 = xe ? xe : x + markWidth;\n let xm = (x0 + x1) / 2.0;\n\n const rm = trackOuterRadius - ((rowPosition + rowHeight - y) / trackHeight) * trackRingSize;\n const r0 = rm - triHeight / 2.0;\n const r1 = rm + triHeight / 2.0;\n\n if (spec.style?.align === 'right' && !xe) {\n x0 -= markWidth;\n x1 -= markWidth;\n xm -= markWidth;\n }\n\n if (spec.mark === 'triangleLeft') {\n const p0 = cartesianToPolar(x1, trackWidth, r0, cx, cy, startAngle, endAngle);\n const p1 = cartesianToPolar(x0, trackWidth, rm, cx, cy, startAngle, endAngle);\n const p2 = cartesianToPolar(x1, trackWidth, r1, cx, cy, startAngle, endAngle);\n const p3 = cartesianToPolar(x1, trackWidth, r0, cx, cy, startAngle, endAngle);\n polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y];\n } else if (spec.mark === 'triangleRight') {\n const p0 = cartesianToPolar(x0, trackWidth, r0, cx, cy, startAngle, endAngle);\n const p1 = cartesianToPolar(x1, trackWidth, rm, cx, cy, startAngle, endAngle);\n const p2 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle);\n const p3 = cartesianToPolar(x0, trackWidth, r0, cx, cy, startAngle, endAngle);\n polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y];\n } else if (spec.mark === 'triangleBottom') {\n x0 = xm - markWidth / 2.0;\n x1 = xm + markWidth / 2.0;\n const p0 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle);\n const p1 = cartesianToPolar(x1, trackWidth, r1, cx, cy, startAngle, endAngle);\n const p2 = cartesianToPolar(xm, trackWidth, r0, cx, cy, startAngle, endAngle);\n const p3 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle);\n polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y];\n }\n\n const alphaTransition = model.markVisibility(d, { width: x1 - x0, zoomLevel });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n // too narrow triangle's stroke is becoming too sharp\n x1 - x0 > 2 ? actualOpacity : 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n g.beginFill(colorToHex(color), actualOpacity);\n g.drawPolygon(polygon);\n g.endFill();\n } else {\n let x0 = x ? x : xe - markWidth;\n let x1 = xe ? xe : x + markWidth;\n let xm = x0 + (x1 - x0) / 2.0;\n const ym = rowPosition + rowHeight - y;\n const y0 = rowPosition + rowHeight - y - triHeight / 2.0;\n const y1 = rowPosition + rowHeight - y + triHeight / 2.0;\n\n if (spec.style?.align === 'right' && !xe) {\n x0 -= markWidth;\n x1 -= markWidth;\n xm -= markWidth;\n }\n\n polygon = (\n {\n triangleLeft: [x1, y0, x0, ym, x1, y1, x1, y0],\n triangleRight: [x0, y0, x1, ym, x0, y1, x0, y0],\n triangleBottom: [x0, y0, x1, y0, xm, y1, x0, y0]\n } as any\n )[spec.mark as Mark];\n\n const alphaTransition = model.markVisibility(d, { width: x1 - x0, zoomLevel });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n // too narrow triangle's stroke is becoming too sharp\n x1 - x0 > 2 ? actualOpacity : 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n g.beginFill(colorToHex(color), actualOpacity);\n g.drawPolygon(polygon);\n g.endFill();\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPolygonBasedEvent(d, polygon);\n });\n });\n}\n","import type { Tile } from '@gosling-lang/gosling-track';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { group } from 'd3-array';\nimport { getValueUsingChannel, IsStackedMark } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar } from '../utils/polar';\n\n// Merge with the one in the `utils/text-style.ts`\nexport const TEXT_STYLE_GLOBAL = {\n fontSize: '12px',\n fontFamily: 'sans-serif', // 'Arial',\n fontWeight: 'normal',\n fill: 'black',\n background: 'white',\n lineJoin: 'round',\n stroke: '#ffffff',\n strokeThickness: 0\n} as const;\n\nexport function drawText(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const tcx = trackWidth / 2.0;\n const tcy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* styles */\n const dx = spec.style?.dx ?? 0;\n const dy = spec.style?.dy ?? 0;\n const textAnchor = !spec.style?.textAnchor ? 'middle' : spec.style.textAnchor;\n\n /* render */\n if (IsStackedMark(spec)) {\n if (circular) {\n // TODO: Not supported for circular layouts yet.\n return;\n }\n\n const rowGraphics = tile.graphics; // new HGC.libraries.PIXI.Graphics(); // only one row for stacked marks\n\n const genomicChannel = model.getGenomicChannel();\n if (!genomicChannel || !genomicChannel.field) {\n console.warn('Genomic field is not provided in the specification');\n return;\n }\n const pivotedData = group(data, d => d[genomicChannel.field as string]);\n const xKeys = [...pivotedData.keys()];\n\n // TODO: users may want to align rows by values\n xKeys.forEach(k => {\n let prevYEnd = 0;\n pivotedData.get(k)?.forEach(d => {\n const text = model.encodedPIXIProperty('text', d);\n const color = model.encodedPIXIProperty('color', d);\n const x = model.encodedPIXIProperty('x', d) + dx;\n const xe = model.encodedPIXIProperty('xe', d) + dx;\n const cx = model.encodedPIXIProperty('x-center', d) + dx;\n const y = model.encodedPIXIProperty('y', d) + dy;\n const size = model.encodedPIXIProperty('size', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n if (cx < 0 || cx > trackWidth) {\n // we do not draw texts that are out of the view\n return;\n }\n\n if (trackInfo.textsBeingUsed > 1000) {\n // prevent from drawing too many text elements for the performance\n return;\n }\n\n /* text styles */\n const localTextStyle = {\n ...TEXT_STYLE_GLOBAL,\n fontSize:\n size ??\n (spec.style?.textFontSize ? `${spec.style?.textFontSize}px` : TEXT_STYLE_GLOBAL.fontSize),\n stroke: stroke ?? spec.style?.textStroke ?? TEXT_STYLE_GLOBAL.stroke,\n strokeThickness: strokeWidth ?? spec.style?.textStrokeWidth ?? TEXT_STYLE_GLOBAL.strokeThickness,\n fontWeight: spec.style?.textFontWeight ?? TEXT_STYLE_GLOBAL.fontWeight\n };\n const textStyleObj = new HGC.libraries.PIXI.TextStyle(localTextStyle);\n\n let textGraphic;\n if (trackInfo.textGraphics.length > trackInfo.textsBeingUsed) {\n textGraphic = trackInfo.textGraphics[trackInfo.textsBeingUsed];\n textGraphic.style.fill = color;\n textGraphic.visible = true;\n textGraphic.text = text;\n textGraphic.alpha = 1;\n } else {\n textGraphic = new HGC.libraries.PIXI.Text(text, {\n ...localTextStyle,\n fill: color\n });\n trackInfo.textGraphics.push(textGraphic);\n }\n\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, textStyleObj);\n trackInfo.textsBeingUsed++;\n\n const alphaTransition = model.markVisibility(d, {\n ...metric,\n zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0)\n });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (!text || actualOpacity === 0) {\n trackInfo.textsBeingUsed--;\n textGraphic.visible = false;\n return;\n }\n\n textGraphic.alpha = actualOpacity;\n\n textGraphic.resolution = 8;\n textGraphic.updateText();\n\n textGraphic.texture.baseTexture.scaleMode = HGC.libraries.PIXI.SCALE_MODES.LINEAR; // or .NEAREST\n\n const sprite = new HGC.libraries.PIXI.Sprite(textGraphic.texture);\n sprite.x = x;\n sprite.y = rowHeight - y - prevYEnd;\n sprite.width = xe - x;\n sprite.height = y;\n\n rowGraphics.addChild(sprite);\n\n prevYEnd += y;\n });\n });\n } else {\n rowCategories.forEach(rowCategory => {\n // we are separately drawing each row so that y scale can be more effectively shared across tiles without rerendering from the bottom\n const rowGraphics = tile.graphics;\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n const text = model.encodedPIXIProperty('text', d);\n const color = model.encodedPIXIProperty('color', d);\n const cx = model.encodedPIXIProperty('x-center', d) + dx;\n const y = model.encodedPIXIProperty('y', d) + dy;\n const size = model.encodedPIXIProperty('size', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n if (cx < 0 || cx > trackWidth) {\n // we do not draw texts that are out of the view\n return;\n }\n\n if (trackInfo.textsBeingUsed > 1000) {\n // prevent from drawing too many text elements for the performance\n return;\n }\n\n /* text styles */\n const localTextStyle = {\n ...TEXT_STYLE_GLOBAL,\n fontSize:\n size ??\n (spec.style?.textFontSize ? `${spec.style?.textFontSize}px` : TEXT_STYLE_GLOBAL.fontSize),\n stroke: stroke ?? spec.style?.textStroke ?? TEXT_STYLE_GLOBAL.stroke,\n strokeThickness: strokeWidth ?? spec.style?.textStrokeWidth ?? TEXT_STYLE_GLOBAL.strokeThickness,\n fontWeight: spec.style?.textFontWeight ?? TEXT_STYLE_GLOBAL.fontWeight\n };\n const textStyleObj = new HGC.libraries.PIXI.TextStyle(localTextStyle);\n\n let textGraphic;\n if (trackInfo.textGraphics.length > trackInfo.textsBeingUsed) {\n textGraphic = trackInfo.textGraphics[trackInfo.textsBeingUsed];\n textGraphic.style.fill = color;\n textGraphic.visible = true;\n textGraphic.text = text;\n textGraphic.alpha = 1;\n } else {\n textGraphic = new HGC.libraries.PIXI.Text(text, {\n ...localTextStyle,\n fill: color\n });\n trackInfo.textGraphics.push(textGraphic);\n }\n\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, textStyleObj);\n trackInfo.textsBeingUsed++;\n\n const alphaTransition = model.markVisibility(d, {\n ...metric,\n zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0)\n });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (!text || actualOpacity === 0) {\n trackInfo.textsBeingUsed--;\n textGraphic.visible = false;\n return;\n }\n\n textGraphic.alpha = actualOpacity;\n textGraphic.anchor.y = 0.5;\n textGraphic.anchor.x = textAnchor === 'middle' ? 0.5 : textAnchor === 'start' ? 0 : 1;\n\n let polygonForMouseEvents: number[] = [];\n\n if (circular) {\n const r = trackOuterRadius - ((rowPosition + rowHeight - y) / trackHeight) * trackRingSize;\n const centerPos = cartesianToPolar(cx, trackWidth, r, tcx, tcy, startAngle, endAngle);\n textGraphic.x = centerPos.x;\n textGraphic.y = centerPos.y;\n\n textGraphic.resolution = 4;\n // const txtStyle = new HGC.libraries.PIXI.TextStyle(textStyleObj);\n // const metric = HGC.libraries.PIXI.TextMetrics.measureText(textGraphic.text, txtStyle);\n\n // scale the width of text label so that its width is the same when converted into circular form\n const tw = (metric.width / (2 * r * Math.PI)) * trackWidth;\n let [minX, maxX] = [cx - tw / 2.0, cx + tw / 2.0];\n\n // make sure not to place the label on the origin\n if (minX < 0) {\n const gap = -minX;\n minX = 0;\n maxX += gap;\n } else if (maxX > trackWidth) {\n const gap = maxX - trackWidth;\n maxX = trackWidth;\n minX -= gap;\n }\n\n const ropePoints: import('pixi.js').Point[] = [];\n const eventPointsFar: number[] = [];\n const eventPointsNear: number[] = [];\n for (let i = maxX; i >= minX; i -= tw / 10.0) {\n const p = cartesianToPolar(i, trackWidth, r, tcx, tcy, startAngle, endAngle);\n ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y));\n\n const pFar = cartesianToPolar(\n i,\n trackWidth,\n r + metric.height / 2.0,\n tcx,\n tcy,\n startAngle,\n endAngle\n );\n const pNear = cartesianToPolar(\n i,\n trackWidth,\n r - metric.height / 2.0,\n tcx,\n tcy,\n startAngle,\n endAngle\n );\n eventPointsFar.push(pFar.x, pFar.y);\n if (i === maxX) {\n eventPointsNear.push(pFar.y, pFar.x);\n }\n eventPointsNear.push(pNear.y, pNear.x);\n }\n\n textGraphic.updateText();\n const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints);\n rope.alpha = actualOpacity;\n rowGraphics.addChild(rope);\n\n /* Mouse Events */\n eventPointsNear.reverse();\n polygonForMouseEvents = eventPointsFar.concat(eventPointsNear);\n } else {\n textGraphic.position.x = cx;\n textGraphic.position.y = rowPosition + rowHeight - y;\n rowGraphics.addChild(textGraphic);\n\n /* Mouse Events */\n const { height: h, width: w } = metric;\n const ys = textGraphic.position.y - h / 2.0;\n const ye = ys + h;\n let xs = 0;\n let xe = 0;\n if (textAnchor === 'start') {\n xs = cx;\n xe = cx + w;\n } else if (textAnchor === 'middle') {\n xs = cx - w / 2;\n xe = cx + w / 2;\n } else {\n xs = cx - w;\n xe = cx;\n }\n polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys];\n }\n\n model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents);\n });\n });\n }\n}\n","import type { Tile } from '@gosling-lang/gosling-track';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\n\nexport function drawRule(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* style */\n const dashed = spec.style?.dashed;\n const linePattern = spec.style?.linePattern;\n const curved = spec.style?.curve;\n\n /* render */\n const g = tile.graphics;\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n const x = model.encodedPIXIProperty('x', d);\n const xe = model.encodedPIXIProperty('xe', d);\n const y = model.encodedPIXIProperty('y', d); // y middle position\n const color = model.encodedPIXIProperty('color', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n const alphaTransition = model.markVisibility(d, {\n width: xe - x,\n zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0)\n });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n g.lineStyle(\n strokeWidth,\n colorToHex(color),\n actualOpacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n // TODO: Large parts of the following code blocks can be reused, reducing the lines\n // Does this rule span entire width or height of a track?\n if (!xe && (!spec.y || !('field' in spec.y))) {\n /* vertical rule */\n if (circular) {\n // TODO:\n return;\n } else {\n if (dashed) {\n const [dashSize, gapSize] = dashed;\n let curPos = 0;\n\n do {\n g.moveTo(x, curPos);\n g.lineTo(x, curPos + dashSize);\n curPos += dashSize + gapSize;\n } while (curPos < trackHeight);\n } else {\n g.moveTo(x, 0);\n g.lineTo(x, trackHeight);\n }\n }\n } else if (!xe && y) {\n // TODO: draw only single rule regardless of multiple tiles.\n /* horizontal rule */\n if (circular) {\n // Actually, we are drawing arcs instead of lines, so lets remove stroke.\n g.lineStyle(\n strokeWidth,\n colorToHex(color),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n const midR = trackOuterRadius - ((rowPosition + y) / trackHeight) * trackRingSize;\n const farR = midR + strokeWidth / 2.0;\n const nearR = midR - strokeWidth / 2.0;\n\n const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(0, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle);\n\n g.beginFill(colorToHex(color), actualOpacity);\n g.moveTo(sPos.x, sPos.y);\n g.arc(cx, cy, nearR, startRad, endRad, true);\n g.arc(cx, cy, farR, endRad, startRad, false);\n g.closePath();\n } else {\n if (dashed) {\n const [dashSize, gapSize] = dashed;\n let curPos = 0;\n\n do {\n g.moveTo(curPos, rowPosition + rowHeight - y);\n g.lineTo(curPos + dashSize, rowPosition + rowHeight - y);\n curPos += dashSize + gapSize;\n } while (curPos < trackWidth);\n } else {\n g.moveTo(0, rowPosition + rowHeight - y);\n g.lineTo(trackWidth, rowPosition + rowHeight - y);\n }\n }\n } else {\n if (circular) {\n // !!! Currently, we only support simple straight lines for circular layouts.\n if (strokeWidth === 0) {\n // Do not render invisible elements.\n return;\n }\n\n // Actually, we are drawing arcs instead of lines, so lets remove stroke.\n g.lineStyle(\n strokeWidth,\n colorToHex(color),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n const midR = trackOuterRadius - ((rowPosition + rowHeight - y) / trackHeight) * trackRingSize;\n const farR = midR + strokeWidth / 2.0;\n const nearR = midR - strokeWidth / 2.0;\n\n const sPos = cartesianToPolar(x, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(x, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(xe, trackWidth, startAngle, endAngle);\n\n g.beginFill(colorToHex(color), actualOpacity);\n g.moveTo(sPos.x, sPos.y);\n g.arc(cx, cy, nearR, startRad, endRad, true);\n g.arc(cx, cy, farR, endRad, startRad, false);\n g.closePath();\n } else if (dashed) {\n const [dashSize, gapSize] = dashed;\n let curPos = x;\n\n do {\n g.moveTo(curPos, rowPosition + rowHeight - y);\n g.lineTo(curPos + dashSize, rowPosition + rowHeight - y);\n curPos += dashSize + gapSize;\n } while (curPos < xe);\n } else {\n /* regular horizontal lines */\n if (curved === undefined) {\n g.moveTo(x, rowPosition + rowHeight - y);\n g.lineTo(xe, rowPosition + rowHeight - y);\n } else if (curved === 'top') {\n // TODO: to default value\n const CURVE_HEIGHT = 2;\n ///\n\n const xm = x + (xe - x) / 2.0;\n\n g.moveTo(x, rowPosition + rowHeight - y + CURVE_HEIGHT / 2.0);\n g.lineTo(xm, rowPosition + rowHeight - y - CURVE_HEIGHT / 2.0);\n g.moveTo(xm, rowPosition + rowHeight - y - CURVE_HEIGHT / 2.0);\n g.lineTo(xe, rowPosition + rowHeight - y + CURVE_HEIGHT / 2.0);\n }\n }\n\n if (linePattern && curved === undefined && !circular) {\n const { type: pType, size: pSize } = linePattern;\n let curPos = Math.max(x, 0); // saftly start from visible position\n\n g.lineStyle(0);\n\n // TODO: to default value\n const PATTERN_GAP_SIZE = pSize * 2;\n ///\n\n let count = 0;\n while (curPos < Math.min(xe, trackWidth) && count < 100) {\n const x0 = curPos;\n const x1 = curPos + pSize;\n const ym = rowPosition + rowHeight - y;\n const y0 = ym - pSize / 2.0;\n const y1 = ym + pSize / 2.0;\n\n g.beginFill(colorToHex(color), actualOpacity);\n g.drawPolygon(\n pType === 'triangleLeft'\n ? [x1, y0, x0, ym, x1, y1, x1, y0]\n : [x0, y0, x1, ym, x0, y1, x0, y0]\n );\n g.endFill();\n curPos += pSize + PATTERN_GAP_SIZE;\n\n count++;\n\n // saftly end before the visible position\n }\n }\n }\n });\n });\n}\n","import type * as PIXI from 'pixi.js';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport { IsChannelDeep, getValueUsingChannel, Is2DTrack } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar, positionToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\nimport { Bezier } from 'bezier-js';\n\nexport function drawWithinLink(g: PIXI.Graphics, trackInfo: any, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300;\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const tcx = trackWidth / 2.0;\n const tcy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* defaults */\n const MIN_HEIGHT = spec.style?.linkMinHeight ?? 0.5;\n const NUM_STEPS = spec.experimental?.performanceMode ? 10 : 50; // https://github.com/gosling-lang/gosling.js/issues/634\n const showVerticalLines = spec.style?.withinLinkVerticalLines ?? false;\n\n // TODO: Can row be actually used for circular layouts?\n /* render */\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n let x = model.encodedPIXIProperty('x', d);\n let xe = model.encodedPIXIProperty('xe', d);\n let x1 = model.encodedPIXIProperty('x1', d);\n let x1e = model.encodedPIXIProperty('x1e', d);\n const y = model.encodedPIXIProperty('y', d);\n const ye = model.encodedPIXIProperty('ye', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const color = model.encodedPIXIProperty('color', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n // sort properly\n if (typeof xe !== 'undefined') {\n [x, xe] = [x, xe].sort((a, b) => a - b);\n }\n if (typeof x1 !== 'undefined' && typeof x1e !== 'undefined') {\n [x1, x1e] = [x1, x1e].sort((a, b) => a - b);\n }\n\n // Is this band or line?\n const isRibbon =\n typeof xe !== 'undefined' &&\n typeof x1 !== 'undefined' &&\n typeof x1e !== 'undefined' &&\n // This means the strokeWidth of a band is too small, so we just need to draw a line instead\n Math.abs(x - xe) > 0.1 &&\n Math.abs(x1 - x1e) > 0.1;\n\n // TODO: This correction can be moved to the compile process\n if (!isRibbon && xe === undefined && !Is2DTrack(spec)) {\n // We need to use a valid value to draw lines, so lets find alternative one.\n if (x1 === undefined && x1e === undefined) {\n // We do not have a valid ones.\n return;\n }\n xe = x1 !== undefined ? x1 : x1e;\n }\n\n if (!isRibbon && Math.abs(x - xe) <= 0.1 && Math.abs(x1 - x1e) <= 0.1) {\n // Put the larger value on `xe` so that it can be used in line connection\n x = (x + xe) / 2.0;\n xe = (x1 + x1e) / 2.0;\n }\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n opacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n const flipY = (IsChannelDeep(spec.y) && spec.y.flip) || spec.flipY;\n const baseY = spec.baselineY ?? rowPosition + (flipY ? 0 : rowHeight);\n\n let pathForMouseEvent: number[] = [];\n\n if (isRibbon) {\n g.beginFill(color === 'none' ? colorToHex('white') : colorToHex(color), color === 'none' ? 0 : opacity);\n\n let [_x1, _x2, _x3, _x4] = [x, xe, x1, x1e];\n\n // Sort values to safely draw bands\n [_x1, _x2, _x3, _x4] = [_x1, _x2, _x3, _x4].sort((a, b) => a - b);\n\n if (_x1 > trackWidth || _x4 < 0 || Math.abs(_x4 - _x1) < 0.5) {\n // Do not draw very small visual marks\n return;\n }\n\n if (circular) {\n if (_x1 < 0 || _x4 > trackWidth) {\n // Do not show bands that are partly outside of the current domain\n return;\n }\n\n // https://pixijs.download/dev/docs/PIXI.Graphics.html#bezierCurveTo\n const r = trackOuterRadius - (rowPosition / trackHeight) * trackRingSize;\n const posX = cartesianToPolar(_x1, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posXE = cartesianToPolar(_x2, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posX1 = cartesianToPolar(_x3, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posX1E = cartesianToPolar(_x4, trackWidth, r, tcx, tcy, startAngle, endAngle);\n\n g.moveTo(posX.x, posX.y);\n\n // outer curve\n g.bezierCurveTo(tcx, tcy, tcx, tcy, posX1E.x, posX1E.y);\n\n g.arc(\n tcx,\n tcy,\n trackOuterRadius,\n positionToRadian(posX1E.x, posX1E.y, tcx, tcy),\n positionToRadian(posX1.x, posX1.y, tcx, tcy),\n false\n );\n\n // inner curve\n g.bezierCurveTo(tcx, tcy, tcx, tcy, posXE.x, posXE.y);\n\n g.arc(\n tcx,\n tcy,\n trackOuterRadius,\n positionToRadian(posXE.x, posXE.y, tcx, tcy),\n positionToRadian(posX.x, posX.y, tcx, tcy),\n false\n );\n pathForMouseEvent = Array.from(g.currentPath.points);\n g.endFill();\n } else {\n // Linear mark\n\n g.moveTo(_x1, baseY);\n\n if (!spec.style?.linkStyle || spec.style?.linkStyle === 'circular') {\n g.arc(\n (_x1 + _x4) / 2.0, // cx\n baseY, // cy\n (_x4 - _x1) / 2.0, // radius\n -Math.PI, // start angle\n Math.PI, // end angle\n false\n );\n g.arc((_x2 + _x3) / 2.0, baseY, (_x3 - _x2) / 2.0, Math.PI, -Math.PI, true);\n pathForMouseEvent = Array.from(g.currentPath.points);\n g.closePath();\n } else {\n g.lineTo(_x3, rowPosition + rowHeight);\n g.bezierCurveTo(\n _x3 + (_x2 - _x3) / 3.0,\n // rowPosition + (x1 - x),\n rowPosition + rowHeight - (_x2 - _x3) / 2.0, //Math.min(rowHeight - (x1 - x), (xe - x1) / 2.0),\n _x3 + ((_x2 - _x3) / 3.0) * 2,\n // rowPosition + (x1 - x),\n rowPosition + rowHeight - (_x2 - _x3) / 2.0, //Math.min(rowHeight - (x1 - x), (xe - x1) / 2.0),\n _x2,\n rowPosition + rowHeight\n );\n g.lineTo(_x4, rowPosition + rowHeight);\n g.bezierCurveTo(\n _x1 + ((_x4 - _x1) / 3.0) * 2,\n // rowPosition,\n rowPosition + rowHeight - (_x4 - _x1) / 2.0, //Math.min(rowHeight, (x1e - x) / 2.0),\n _x1 + (_x4 - _x1) / 3.0,\n // rowPosition,\n rowPosition + rowHeight - (_x4 - _x1) / 2.0, //Math.min(rowHeight, (x1e - x) / 2.0),\n _x1,\n rowPosition + rowHeight\n );\n pathForMouseEvent = Array.from(g.currentPath.points);\n g.endFill();\n }\n }\n /* Mouse Events */\n model.getMouseEventModel().addPolygonBasedEvent(d, pathForMouseEvent);\n } else {\n /**\n * Line connection and not ribbon style\n */\n\n const midX = (x + xe) / 2.0;\n\n // Must not fill color for `line`, just use `stroke`\n g.beginFill(colorToHex('white'), 0);\n\n if (circular) {\n if (x < 0 || xe > trackWidth) {\n // Do not show bands that are partly outside of the current domain\n return;\n }\n\n const IS_ELLIPTICAL_READY = false;\n if (IS_ELLIPTICAL_READY && spec.style?.linkStyle === 'elliptical') {\n // !! Not ready to use\n const morePoints: { x: number; y: number }[] = [];\n\n for (let step = 0; step <= NUM_STEPS; step++) {\n const theta = (Math.PI * step) / NUM_STEPS;\n const mx = ((xe - x) / 2.0) * Math.cos(theta) + (x + xe) / 2.0;\n const my =\n baseY -\n (((rowHeight - y) *\n Math.sin(theta) *\n Math.min(xe - x + trackWidth * 0.5, trackWidth * 1.5)) /\n trackWidth /\n 1.5) *\n (flipY ? -1 : 1);\n\n const r = trackOuterRadius - (my / trackHeight) * trackRingSize;\n const cmx = cartesianToPolar(mx, trackWidth, r, tcx, tcy, startAngle, endAngle);\n\n if (step % 20 === 0 || step === NUM_STEPS) {\n // we draw less points than the hidden points for mouse events\n if (step === 0) {\n g.moveTo(cmx.x, cmx.y);\n } else {\n g.lineTo(cmx.x, cmx.y);\n }\n }\n morePoints.push({ ...cmx });\n }\n\n pathForMouseEvent = morePoints.flatMap(d => [d.x, d.y]);\n } else if (spec.style?.linkStyle === 'straight') {\n const r = trackOuterRadius - (rowPosition / trackHeight) * trackRingSize;\n const posS = cartesianToPolar(x, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posE = cartesianToPolar(xe, trackWidth, r, tcx, tcy, startAngle, endAngle);\n\n const x1 = posS.x;\n const y1 = posS.y;\n const x4 = posE.x;\n const y4 = posE.y;\n\n g.moveTo(x1, y1);\n g.lineTo(x4, y4);\n\n /* click event data */\n const length = 100;\n const eventPoints = Array.from({ length }, (d, i) => {\n return {\n x: ((x4 - x1) / (length - 1)) * i + x1,\n y: ((y4 - y1) / (length - 1)) * i + y1\n };\n });\n\n pathForMouseEvent = eventPoints.flatMap(d => [d.x, d.y]);\n } else {\n const r = trackOuterRadius - (rowPosition / trackHeight) * trackRingSize;\n const posS = cartesianToPolar(x, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posE = cartesianToPolar(xe, trackWidth, r, tcx, tcy, startAngle, endAngle);\n\n const x1 = posS.x;\n const y1 = posS.y;\n const x2 = posS.x;\n const y2 = posS.y;\n const x3 = trackWidth / 2.0;\n const y3 = trackHeight / 2.0;\n const x4 = posE.x;\n const y4 = posE.y;\n\n g.moveTo(x1, y1);\n\n const bezier = new Bezier(x1, y1, x2, y2, x3, y3, x4, y4);\n const points = bezier.getLUT(14);\n points.forEach(d => g.lineTo(d.x, d.y));\n\n /* click event data */\n const morePoints = bezier.getLUT(1000);\n pathForMouseEvent = morePoints.flatMap(d => [d.x, d.y]);\n }\n } else {\n // linear line connection\n\n if (spec.style?.linkStyle === 'elliptical') {\n if (!(0 <= x && x <= trackWidth) && !(0 <= xe && xe <= trackWidth)) {\n // not within this window\n return;\n }\n\n const points: { x: number; y: number }[] = [];\n\n // https://github.com/gosling-lang/gosling.js/issues/634\n const isYSpecified = IsChannelDeep(spec.y);\n // Iterate from right to left side\n for (let step = 0; step <= NUM_STEPS; step++) {\n const theta = Math.PI * (step / NUM_STEPS);\n const mx = ((xe - x) / 2.0) * Math.cos(theta) + (x + xe) / 2.0;\n let my =\n baseY -\n y *\n Math.sin(theta) *\n (isYSpecified\n ? 1\n : Math.min(xe - x + trackWidth * MIN_HEIGHT, trackWidth) / trackWidth) *\n (flipY ? -1 : 1);\n\n if (typeof y !== 'undefined' && typeof ye !== 'undefined') {\n // If both defined, we draw link between `y` and `ye`\n const linkHeight = Math.abs(ye - y);\n const flipShape = ye > y;\n my = y - linkHeight * Math.sin(theta) * (flipShape ? -1 : 1);\n }\n\n if (step === 0) {\n if (showVerticalLines) {\n const _y = flipY ? baseY - trackHeight : baseY;\n g.moveTo(mx, _y);\n points.push({ x: mx, y: _y });\n\n g.lineTo(mx, my);\n } else {\n g.moveTo(mx, my);\n }\n } else {\n g.lineTo(mx, my);\n }\n points.push({ x: mx, y: my });\n\n if (step === NUM_STEPS && showVerticalLines) {\n const _y = flipY ? baseY - trackHeight : baseY;\n g.lineTo(mx, _y);\n points.push({ x: mx, y: _y });\n }\n }\n\n pathForMouseEvent = points.flatMap(d => [d.x, d.y]);\n } else {\n if (xe < 0 || x > trackWidth) {\n // Q: Do we really need this?\n return;\n }\n g.arc(midX, baseY, (xe - x) / 2.0, -Math.PI, Math.PI);\n pathForMouseEvent = Array.from(g.currentPath.points);\n g.closePath();\n }\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addLineBasedEvent(d, pathForMouseEvent);\n }\n });\n });\n}\n","/**\n * Repeat elements in the array until its size becomes to `targetLength`.\n */\nexport function arrayRepeat(base: T[], targetLength: number): T[] {\n if (base.length === targetLength) return base;\n else if (base.length > targetLength) return base.slice(0, targetLength);\n else {\n const repeated = Array.from(base);\n do {\n repeated.push(...Array.from(base));\n } while (repeated.length < targetLength);\n return repeated.slice(0, targetLength);\n }\n}\n\n/**\n * Insert item to an array and return it.\n * @param array Array to be updated.\n * @param index Index of array to insert new item.\n * @param item Item to be inserted.\n * @returns Updated array.\n */\nexport function insertItemToArray(array: T[], index: number, item: T): T[] {\n return [...array.slice(0, index), item, ...array.slice(index)];\n}\n\n/**\n * Insert item to an array and return it.\n * @param array Array to be updated.\n * @param index Index of array to change item.\n * @param item Item to be inserted.\n * @returns Updated array.\n */\nexport function modifyItemInArray(array: T[], index: number, item: T): T[] {\n return [...array.slice(0, index), item, ...array.slice(index + 1)];\n}\n\n/**\n * Remove item from an array stored in a certain index.\n * @param array Array to be updated.\n * @param index Index of an item to be removed.\n * @returns Updated array.\n */\nexport function removeItemFromArray(array: T[], index: number): T[] {\n return [...array.slice(0, index), ...array.slice(index + 1)];\n}\n\n/**\n * Convert 1D array into 2D array where each pair of elements are grouped.\n * @param array Array to be used.\n * @returns Updated array.\n */\nexport function flatArrayToPairArray(array: T[]): [T, T][] {\n const output: [T, T][] = [];\n for (let i = 0; i < array.length; i += 2) {\n output.push([array[i], array[i + 1]]);\n }\n return output;\n}\n\n/**\n * Check if all elements in an array satisfy a type guard.\n * @param array Array to check\n * @param is Type guard to check each element\n */\nexport function isEvery(array: any[], is: (x: Arr[number]) => x is T): array is T[] {\n return array.every(is);\n}\n\n/** Check if all elements in an array are numbers. */\nexport function isNumberArray(array: any[]): array is number[] {\n return isEvery(array, (x): x is number => typeof x === 'number');\n}\n\n/** Check if all elements in an array are strings. */\nexport function isStringArray(array: any[]): array is string[] {\n return isEvery(array, (x): x is string => typeof x === 'string');\n}\n","import type { ScaleLinear } from 'd3-scale';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport { isNumberArray, isStringArray } from '../utils/array';\nimport type { CompleteThemeDeep } from '../utils/theme';\n\nexport function drawGrid(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n drawYGridQuantitative(trackInfo, tm, theme);\n drawRowGrid(trackInfo, tm, theme);\n}\n\nexport function drawRowGrid(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n const spec = tm.spec();\n\n if (!IsChannelDeep(spec.row) || spec.row.grid !== true) {\n // we do not need to draw grid\n return;\n }\n\n /* track size */\n const [trackX, trackY] = trackInfo.position;\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const circular = tm.spec().layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories = tm.getChannelDomainArray('row') as string[] | undefined;\n\n if (!rowCategories) {\n // We do not have categories mapped to row to draw grid with\n return;\n }\n\n const rowHeight = trackHeight / rowCategories.length;\n\n if ((circular && trackRingSize <= 20) || (!circular && rowHeight <= 20)) {\n // Height is too narrow to draw axis\n return;\n }\n\n /* render */\n const graphics = trackInfo.pBackground;\n\n const strokeWidth = theme.axis.gridStrokeWidth;\n rowCategories.forEach(rowCategory => {\n const rowPosition = tm.encodedValue('row', rowCategory);\n\n if (!circular) {\n graphics.lineStyle(\n strokeWidth,\n colorToHex(theme.axis.gridColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n const y = trackY + rowPosition + rowHeight / 2.0;\n graphics.moveTo(trackX, y);\n graphics.lineTo(trackX + trackWidth, y);\n } else {\n const y = rowPosition + rowHeight / 2.0;\n const midR = trackOuterRadius - (y / trackHeight) * trackRingSize;\n const farR = midR + strokeWidth / 2.0;\n const nearR = midR - strokeWidth / 2.0;\n\n const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(0, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle);\n\n // For circular grid, we draw 'filled' arc w/ zero strokeWidth\n graphics.lineStyle(\n strokeWidth,\n colorToHex('black'),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n graphics.beginFill(colorToHex(theme.axis.gridColor), 1);\n graphics.moveTo(trackX + sPos.x, trackY + sPos.y);\n graphics.arc(trackX + cx, trackY + cy, nearR, startRad, endRad, true);\n graphics.arc(trackX + cx, trackY + cy, farR, endRad, startRad, false);\n graphics.closePath();\n }\n });\n}\n\nexport function drawYGridQuantitative(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n const spec = tm.spec();\n\n if (!IsChannelDeep(spec.y) || spec.y.grid !== true) {\n // we do not need to draw grid\n return;\n }\n\n /* track size */\n const [trackX, trackY] = trackInfo.position;\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n const startX = trackX;\n const endX = trackX + trackWidth;\n\n /* circular parameters */\n const circular = tm.spec().layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories = tm.getChannelDomainArray('row') ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n if (!isStringArray(rowCategories)) {\n // We do not have categories mapped to row to draw grid with\n return;\n }\n\n /* Grid Components */\n const scale = tm.getChannelScale('y');\n const domain = tm.getChannelDomainArray('y');\n\n if (!scale || !domain || !isNumberArray(domain)) {\n // We do not have sufficient information to draw a grid\n return;\n }\n\n if ((circular && (rowHeight / trackHeight) * trackRingSize <= 20) || (!circular && rowHeight <= 20)) {\n // Height is too narrow to draw axis\n return;\n }\n\n /* render */\n const graphics = trackInfo.pBackground;\n const strokeWidth = theme.axis.gridStrokeWidth;\n\n rowCategories.forEach(rowCategory => {\n const rowPosition = tm.encodedValue('row', rowCategory);\n\n const assignedHeight = circular ? (rowHeight / trackHeight) * trackRingSize : rowHeight;\n const tickCount = Math.max(Math.ceil(assignedHeight / 40), 1);\n\n let ticks = (scale as ScaleLinear).ticks(tickCount).filter(v => domain[0] <= v && v <= domain[1]);\n\n if (ticks.length === 1) {\n // Sometimes, ticks() gives a single value, so use a larger tickCount.\n ticks = (scale as ScaleLinear).ticks(tickCount + 1).filter(v => domain[0] <= v && v <= domain[1]);\n }\n\n if (!circular) {\n graphics.lineStyle(\n strokeWidth,\n colorToHex(theme.axis.gridColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n ticks.forEach(value => {\n const y = trackY + rowPosition + rowHeight - scale(value);\n if (theme.axis.gridStrokeType === 'solid') {\n graphics.moveTo(startX, y);\n graphics.lineTo(endX, y);\n } else if (theme.axis.gridStrokeType === 'dashed') {\n const [line, gap] = theme.axis.gridStrokeDash ?? [1, 1];\n // eslint-disable-next-line\n for (let i = startX; i < endX; i += line + gap) {\n graphics.moveTo(i, y);\n graphics.lineTo(i + line, y);\n }\n }\n });\n } else {\n ticks.forEach(value => {\n const y = scale(value);\n const midR = trackOuterRadius - ((rowPosition + rowHeight - y) / trackHeight) * trackRingSize;\n const farR = midR + strokeWidth / 2.0;\n const nearR = midR - strokeWidth / 2.0;\n\n const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(0, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle);\n\n // For circular grid, we draw 'filled' arc w/ zero strokeWidth\n graphics.lineStyle(\n strokeWidth,\n colorToHex('black'),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n graphics.beginFill(colorToHex(theme.axis.gridColor), 1);\n graphics.moveTo(trackX + sPos.x, trackY + sPos.y);\n graphics.arc(trackX + cx, trackY + cy, nearR, startRad, endRad, true);\n graphics.arc(trackX + cx, trackY + cy, farR, endRad, startRad, false);\n graphics.closePath();\n });\n }\n });\n}\n","export type TextStyle = {\n color?: string;\n size?: number;\n fontFamily?: string;\n fontWeight?: 'bold' | 'normal' | 'light';\n stroke?: string;\n strokeThickness?: number;\n};\n\nexport const DEFAULT_TEXT_STYLE: Required = {\n color: 'black',\n size: 10,\n fontFamily: 'Arial',\n fontWeight: 'normal',\n stroke: '#ffffff',\n strokeThickness: 0\n};\n\nexport function getTextStyle(style: TextStyle = {}) {\n const merged: Required = { ...DEFAULT_TEXT_STYLE, ...style };\n // Use `const` to get object literal which is compatible with `Partial`\n const pixiTextStyle = {\n fontSize: `${merged.size}px`,\n fontFamily: merged.fontFamily,\n fontWeight: merged.fontWeight === 'light' ? 'lighter' : merged.fontWeight,\n fill: merged.color,\n lineJoin: 'round',\n stroke: merged.stroke,\n strokeThickness: merged.strokeThickness\n } as const;\n // Allow returned object to be mutable (strip `readonly` modifier from `const`)\n return pixiTextStyle as {\n -readonly [K in keyof typeof pixiTextStyle]: (typeof pixiTextStyle)[K];\n };\n}\n","import type * as PIXI from 'pixi.js';\nimport type { Tile } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\nimport { getTextStyle } from '../utils/text-style';\n\nexport function drawCircularTitle(\n HGC: import('@higlass/types').HGC,\n trackInfo: any,\n tile: Tile,\n model: GoslingTrackModel,\n theme: Required\n) {\n const spec = model.spec();\n const { title } = spec;\n\n if (spec.layout !== 'circular') {\n // Wrong function call, this is for circular tracks.\n return;\n }\n\n if (!title) {\n // No point to render a title.\n return;\n }\n\n /* track size */\n const [tw, th] = trackInfo.dimensions;\n\n /* circular parameters */\n const trackOuterRadius = spec.outerRadius ?? 300;\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const cx = tw / 2.0;\n const cy = th / 2.0;\n\n /* render */\n const g = tile.graphics; // We do not use `pBorder` as in linear layouts.\n\n // The current position, i.e., radius, of this label\n const titleR = trackOuterRadius - 1;\n\n // The position of a tick in the polar system\n const padding = 1;\n const pos = cartesianToPolar(padding, tw, titleR, cx, cy, startAngle, endAngle);\n\n /* Title label */\n const styleConfig = getTextStyle({\n color: theme.track.titleColor,\n size: 12, // `theme.track.titleFontSize` seems to use much larger fonts\n fontFamily: theme.axis.labelFontFamily, // TODO: support\n fontWeight: theme.axis.labelFontWeight // TODO: support\n });\n const textGraphic = new HGC.libraries.PIXI.Text(title, styleConfig);\n textGraphic.anchor.x = 1;\n textGraphic.anchor.y = 0.5;\n textGraphic.position.x = pos.x;\n textGraphic.position.y = pos.y;\n\n textGraphic.resolution = 4;\n const txtStyle = new HGC.libraries.PIXI.TextStyle(styleConfig);\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(textGraphic.text, txtStyle);\n\n // Scale the width of text label so that its width is the same when converted into circular form\n const txtWidth = ((metric.width / (2 * titleR * Math.PI)) * tw * 360) / (endAngle - startAngle);\n const scaledStartX = padding;\n const scaledEndX = padding + txtWidth;\n\n // Determine the points of a rope element for a lebel\n const ropePoints: PIXI.Point[] = [];\n for (let i = scaledEndX; i >= scaledStartX; i -= txtWidth / 10.0) {\n const p = cartesianToPolar(i, tw, titleR - metric.height / 2.0, cx, cy, startAngle, endAngle);\n ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y));\n }\n\n /* Background */\n const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle);\n const endRad = valueToRadian(scaledEndX + padding, tw, startAngle, endAngle);\n\n g.lineStyle(1, colorToHex('red'), 0, 0.5);\n g.beginFill(colorToHex(theme.track.titleBackground), 0.5); // TODO: support `theme.track.titleBackgroundOpacity`\n g.moveTo(pos.x, pos.y);\n g.arc(cx, cy, titleR - metric.height, startRad, endRad, true);\n g.arc(cx, cy, titleR, endRad, startRad, false);\n g.closePath();\n\n // Render a label\n // @ts-expect-error, missing argument to updateText\n textGraphic.updateText();\n const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints);\n g.addChild(rope);\n}\n","import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\n\nexport const TITLE_STYLE = {\n fontSize: '12px',\n fontFamily: 'sans-serif', // 'Arial',\n fontWeight: 'normal',\n fill: 'black',\n background: 'white',\n lineJoin: 'round'\n};\n\nexport function drawChartOutlines(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n const g = trackInfo.pBorder; // use pBorder not to affected by zoomming\n\n // size and position\n const [l, t] = trackInfo.position;\n const [w, h] = trackInfo.dimensions;\n\n // Let's try using the native title (`name` in viewConfig options)\n // if (tm.spec().title) {\n // const paddingX = 3;\n // const paddingY = 3;\n\n // const text = tm.spec().title;\n // const textGraphic = new HGC.libraries.PIXI.Text(text, { ...TITLE_STYLE });\n // textGraphic.anchor.x = 0;\n // textGraphic.anchor.y = 0;\n // textGraphic.position.x = l + paddingX;\n // textGraphic.position.y = t + paddingY;\n // g.addChild(textGraphic);\n\n // const textStyleObj = new HGC.libraries.PIXI.TextStyle(TITLE_STYLE);\n // const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(text, textStyleObj);\n // const textWidth = textMetrics.width;\n // const textHeight = textMetrics.height;\n // g.beginFill(colorToHex('white'), 0.7);\n // g.lineStyle(\n // 0,\n // colorToHex('#DBDBDB'),\n // 0.7, // alpha\n // 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n // );\n // g.drawRect(l, t, textWidth + paddingX * 2, textHeight + paddingY * 2);\n // }\n\n // Rectangular outline\n g.lineStyle(\n tm.spec().style?.outlineWidth ?? 1,\n // TODO: outline not working\n colorToHex(tm.spec().style?.outline ?? theme.track.outline),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex('white'), 0);\n g.drawRect(l, t, w, h);\n\n // Borders\n const x = tm.spec().x;\n\n g.lineStyle(\n 1,\n colorToHex(theme.axis.baselineColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n if (IsChannelDeep(x) && x.axis === 'top') {\n // top\n g.moveTo(l, t);\n g.lineTo(l + w, t);\n\n // left\n // g.moveTo(l, t);\n // g.lineTo(l, t + h);\n } else if (IsChannelDeep(x) && x.axis === 'bottom') {\n // bottom\n g.moveTo(l, t + h);\n g.lineTo(l + w, t + h);\n\n // left\n // g.moveTo(l, t);\n // g.lineTo(l, t + h);\n }\n}\n","import type { DisplayedLegend } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\nimport type { Dimension } from '../utils/position';\nimport { scaleLinear, type ScaleLinear } from 'd3-scale';\nimport { getTextStyle } from '../utils/text-style';\nimport type { SubjectPosition, D3DragEvent } from 'd3-drag';\n\n// Just the libraries necesssary fro this module\ntype Libraries = Pick;\n\ntype LegendOffset = { offsetRight: number };\n\nexport function drawColorLegend(\n HGC: { libraries: Libraries },\n trackInfo: any,\n _tile: unknown,\n model: GoslingTrackModel,\n theme: Required\n) {\n if (!trackInfo.gLegend) {\n // We do not have enough components to draw legends\n return;\n }\n\n trackInfo.gLegend.selectAll('.brush').remove();\n\n const spec = model.spec();\n const offset: LegendOffset = { offsetRight: 0 };\n\n if (IsChannelDeep(spec.color) && spec.color.legend) {\n switch (spec.color.type) {\n case 'nominal':\n drawColorLegendCategories(HGC, trackInfo, _tile, model, theme);\n break;\n case 'quantitative':\n drawColorLegendQuantitative(HGC, trackInfo, _tile, model, theme, 'color', offset);\n break;\n }\n }\n\n if (IsChannelDeep(spec.stroke) && spec.stroke.legend) {\n switch (spec.stroke.type) {\n case 'quantitative':\n drawColorLegendQuantitative(HGC, trackInfo, _tile, model, theme, 'stroke', offset);\n break;\n }\n }\n}\n\nexport function drawColorLegendQuantitative(\n HGC: { libraries: Libraries },\n trackInfo: any,\n _tile: unknown,\n model: GoslingTrackModel,\n theme: Required,\n channelKey: 'color' | 'stroke',\n offset: LegendOffset\n) {\n const spec = model.spec();\n\n const channel = spec[channelKey];\n if (!IsChannelDeep(channel) || channel.type !== 'quantitative' || !channel.legend) {\n // This means we do not need to draw legend\n return;\n }\n\n /* track size */\n const [trackX, trackY] = trackInfo.position;\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* Visual Parameters */\n const legendWidth = 80;\n const legendHeight = trackHeight - 2 > 110 ? 110 : Math.max(trackHeight - 2, 40 - 2);\n const colorBarDim: Dimension = {\n top: 10,\n left: 55,\n width: 20,\n height: legendHeight - 20\n };\n const legendX = trackX + trackWidth - legendWidth - 1 - offset.offsetRight;\n const legendY = trackY + 1;\n\n /* Legend Components */\n const colorScale = model.getChannelScale(channelKey);\n // TODO: Use overloads to remove type-casting (via `as`)\n const colorDomain = model.getChannelDomainArray(channelKey) as [number, number] | undefined;\n\n if (!colorScale || !colorDomain) {\n // We do not have enough information for creating a color legend\n return;\n }\n\n /* render */\n const graphics = trackInfo.pBorder; // use pBorder not to be affected by zoomming\n\n // Background\n graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity);\n graphics.lineStyle(\n 1,\n colorToHex(theme.legend.backgroundStroke),\n theme.legend.backgroundOpacity, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.drawRect(legendX, legendY, legendWidth, legendHeight);\n\n /* Lgend title */\n if (channel.title) {\n const titleStr = channel.title;\n\n // label text style\n const labelTextStyle = getTextStyle({\n color: theme.legend.labelColor,\n size: theme.legend.labelFontSize,\n fontWeight: theme.legend.labelFontWeight,\n fontFamily: theme.legend.labelFontFamily\n });\n\n const textGraphic = new HGC.libraries.PIXI.Text(titleStr, {\n ...labelTextStyle,\n fontWeight: 'bold'\n });\n textGraphic.anchor.x = 0;\n textGraphic.anchor.y = 0;\n textGraphic.position.x = legendX + 10;\n textGraphic.position.y = legendY + 10;\n\n const textStyleObj = new HGC.libraries.PIXI.TextStyle({ ...labelTextStyle, fontWeight: 'bold' });\n const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(titleStr, textStyleObj);\n\n graphics.addChild(textGraphic);\n\n // Adjust the color bar\n colorBarDim.top += textMetrics.height + 4;\n colorBarDim.height -= textMetrics.height + 4;\n }\n\n // Color bar\n const [startValue, endValue] = colorDomain as [number, number];\n const extent = endValue - startValue;\n const scaleOffset = IsChannelDeep(channel) && channel.scaleOffset ? channel.scaleOffset : [0, 1];\n\n [...Array(colorBarDim.height).keys()].forEach(y => {\n // For each pixel, draw a small rectangle with different color\n let value;\n const scaleOffsetSorted = Array.from(scaleOffset).sort();\n if (y / colorBarDim.height >= scaleOffsetSorted[1]) {\n value = endValue;\n } else if (y / colorBarDim.height <= scaleOffsetSorted[0]) {\n value = startValue;\n } else {\n const s1 = scaleLinear()\n .domain([colorBarDim.height * scaleOffsetSorted[0], colorBarDim.height * scaleOffsetSorted[1]])\n .range([0, colorBarDim.height]);\n const s2 = scaleLinear().domain([0, colorBarDim.height]).range([startValue, endValue]);\n value = s2(s1(y));\n }\n\n graphics.beginFill(\n colorToHex(colorScale(value)),\n 1 // alpha\n );\n graphics.lineStyle(\n 1,\n colorToHex(theme.legend.backgroundStroke),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.drawRect(\n legendX + colorBarDim.left,\n legendY + colorBarDim.top + colorBarDim.height - y,\n colorBarDim.width,\n 1\n );\n });\n\n // Brush\n // Refer to https://github.com/higlass/higlass/blob/0b2cac5a770db6d55370a61d5dbbe09c4f577c68/app/scripts/HeatmapTiledPixiTrack.js#L580\n const BRUSH_HEIGHT = 4;\n type Datum = { y: number; id: number };\n trackInfo.colorBrushes = trackInfo.gLegend\n .append('g')\n .attr('class', channelKey)\n .selectAll(`.brush`)\n // We could consider using `_renderingId` to support multiple color legends in overlaid tracks.\n .data(\n scaleOffset.map((d, i) => {\n return { y: d, id: i };\n })\n )\n .enter()\n .append('rect')\n .attr('class', `brush`)\n .attr('pointer-events', 'all')\n .attr('cursor', 'ns-resize')\n .attr(\n 'transform',\n (d: Datum) =>\n `translate(${legendX + colorBarDim.left}, ${\n legendY + colorBarDim.top - BRUSH_HEIGHT / 2.0 + colorBarDim.height - colorBarDim.height * d.y\n })`\n )\n .attr('width', `${colorBarDim.width}px`)\n .attr('height', `${BRUSH_HEIGHT}px`)\n .attr('fill', 'lightgrey')\n .attr('stroke', 'black')\n .attr('stroke-width', '0.5px')\n .call(\n HGC.libraries.d3Drag\n .drag()\n .on('start', (event: D3DragEvent) => {\n trackInfo.startEvent = event.sourceEvent;\n })\n .on('drag', (event: D3DragEvent, d: Datum) => {\n if (channel && channel.scaleOffset) {\n const endEvent = event.sourceEvent;\n const diffY = trackInfo.startEvent.clientY - endEvent.clientY;\n const newScaleOffset = [channel.scaleOffset[0], channel.scaleOffset[1]];\n if (d.id === 0) {\n newScaleOffset[0] += diffY / colorBarDim.height;\n } else {\n newScaleOffset[1] += diffY / colorBarDim.height;\n }\n newScaleOffset[0] = Math.min(1, Math.max(0, newScaleOffset[0]));\n newScaleOffset[1] = Math.min(1, Math.max(0, newScaleOffset[1]));\n trackInfo.updateScaleOffsetFromOriginalSpec(spec._renderingId, newScaleOffset, channelKey);\n trackInfo.shareScaleOffsetAcrossTracksAndTiles(newScaleOffset, channelKey);\n trackInfo.draw();\n trackInfo.startEvent = event.sourceEvent;\n }\n })\n );\n\n // Ticks & labels\n const tickCount = Math.max(Math.ceil(colorBarDim.height / 30), 2);\n let ticks = (colorScale as ScaleLinear)\n .ticks(tickCount)\n .filter(v => colorDomain[0] <= v && v <= colorDomain[1]);\n\n if (ticks.length === 1) {\n // Sometimes, ticks() gives a single value, so use a larger tickCount.\n ticks = (colorScale as ScaleLinear)\n .ticks(tickCount + 1)\n .filter(v => colorDomain[0] <= v && v <= colorDomain[1]);\n }\n const TICK_STROKE_SIZE = 1;\n graphics.lineStyle(\n TICK_STROKE_SIZE,\n colorToHex(theme.legend.tickColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n // label text style\n const labelTextStyle = getTextStyle({\n color: theme.legend.labelColor,\n size: theme.legend.labelFontSize,\n fontWeight: theme.legend.labelFontWeight,\n fontFamily: theme.legend.labelFontFamily\n });\n\n const tickEnd = legendX + colorBarDim.left;\n ticks.forEach(value => {\n let y = legendY + colorBarDim.top + colorBarDim.height - ((value - startValue) / extent) * colorBarDim.height;\n\n // Prevent ticks from exceeding outside of a color bar by the stroke size of ticks\n if (y === legendY + colorBarDim.top) {\n y += TICK_STROKE_SIZE / 2.0;\n } else if (y === legendY + colorBarDim.top + colorBarDim.height) {\n y -= TICK_STROKE_SIZE / 2.0;\n }\n\n // ticks\n graphics.moveTo(tickEnd - 3, y);\n graphics.lineTo(tickEnd, y);\n\n // labels\n const textGraphic = new HGC.libraries.PIXI.Text(value, labelTextStyle);\n textGraphic.anchor.x = 1;\n textGraphic.anchor.y = 0.5;\n textGraphic.position.x = tickEnd - 6;\n textGraphic.position.y = y;\n\n graphics.addChild(textGraphic);\n });\n\n // Record this info so that additional legends can be displayed on the side\n offset.offsetRight = trackWidth - legendX;\n}\n\nexport function drawColorLegendCategories(\n HGC: { libraries: Libraries },\n track: any,\n _tile: unknown,\n tm: GoslingTrackModel,\n theme: Required\n) {\n /* track spec */\n const spec = tm.spec();\n if (!IsChannelDeep(spec.color) || spec.color.type !== 'nominal' || !spec.color.legend) {\n // This means we do not need to draw legend\n return;\n }\n\n /* color separation */\n const colorCategories: string[] = (tm.getChannelDomainArray('color') as string[]) ?? ['___SINGLE_COLOR___'];\n if (colorCategories.length === 0) {\n // We do not need to draw a legend for only one color\n return;\n }\n\n /* check redundancy */\n const domain = spec.color.domain!;\n const range = spec.color.range!;\n const existingLegends: DisplayedLegend[] = track.displayedLegends;\n const toStr = (_: any[] | string) => {\n return typeof _ === 'string' ? _ : _.join();\n };\n if (existingLegends.find(d => toStr(d.domain) === toStr(domain) && toStr(d.range) === toStr(range))) {\n // Identical color legend already added\n return;\n } else {\n existingLegends.push({ domain, range });\n }\n\n /* render */\n const graphics = track.pBorder; // use pBorder not to be affected by zoomming\n\n const paddingX = 10;\n const paddingY = 4;\n let cumY = paddingY;\n let maxWidth = 0;\n\n const recipe: { x: number; y: number; color: string }[] = [];\n\n // label text style\n const labelTextStyle = getTextStyle({\n color: theme.legend.labelColor,\n size: theme.legend.labelFontSize,\n fontWeight: theme.legend.labelFontWeight,\n fontFamily: theme.legend.labelFontFamily\n });\n\n if (spec.style?.inlineLegend) {\n // Show legend in a single horizontal line\n\n // !! reversed to add the last category first from the right side\n colorCategories\n .map(d => d)\n .reverse()\n .forEach(category => {\n if (maxWidth > track.dimensions[0]) {\n // We do not draw labels overflow\n return;\n }\n\n const color = tm.encodedValue('color', category);\n const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle);\n textGraphic.anchor.x = 1;\n textGraphic.anchor.y = 0;\n textGraphic.position.x = track.position[0] + track.dimensions[0] - maxWidth - paddingX;\n textGraphic.position.y = track.position[1] + paddingY;\n\n graphics.addChild(textGraphic);\n\n const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle);\n const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj);\n\n if (cumY < textMetrics.height + paddingY * 3) {\n cumY = textMetrics.height + paddingY * 3;\n }\n\n recipe.push({\n x: track.position[0] + track.dimensions[0] - textMetrics.width - maxWidth - paddingX * 2,\n y: track.position[1] + paddingY + textMetrics.height / 2.0,\n color\n });\n\n maxWidth += textMetrics.width + paddingX * 3;\n });\n } else {\n // Show legend vertically\n\n if (spec.style?.legendTitle) {\n const textGraphic = new HGC.libraries.PIXI.Text(spec.style?.legendTitle, {\n ...labelTextStyle,\n fontWeight: 'bold'\n });\n textGraphic.anchor.x = 1;\n textGraphic.anchor.y = 0;\n textGraphic.position.x = track.position[0] + track.dimensions[0] - paddingX;\n textGraphic.position.y = track.position[1] + cumY;\n\n const textStyleObj = new HGC.libraries.PIXI.TextStyle({ ...labelTextStyle, fontWeight: 'bold' });\n const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(spec.style?.legendTitle, textStyleObj);\n\n graphics.addChild(textGraphic);\n\n cumY += textMetrics.height + paddingY * 2;\n }\n\n colorCategories.forEach(category => {\n if (cumY > track.dimensions[1]) {\n // We do not draw labels overflow\n return;\n }\n\n const color = tm.encodedValue('color', category);\n\n const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle);\n textGraphic.anchor.x = 1;\n textGraphic.anchor.y = 0;\n textGraphic.position.x = track.position[0] + track.dimensions[0] - paddingX;\n textGraphic.position.y = track.position[1] + cumY;\n\n graphics.addChild(textGraphic);\n\n const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle);\n const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj);\n\n if (maxWidth < textMetrics.width + paddingX * 3) {\n maxWidth = textMetrics.width + paddingX * 3;\n }\n\n recipe.push({\n x: track.position[0] + track.dimensions[0] - textMetrics.width - paddingX * 2,\n y: track.position[1] + cumY + textMetrics.height / 2.0,\n color\n });\n\n cumY += textMetrics.height + paddingY * 2;\n });\n }\n\n graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity);\n graphics.lineStyle(\n 1,\n colorToHex(theme.legend.backgroundStroke),\n theme.legend.backgroundOpacity, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.drawRect(\n track.position[0] + track.dimensions[0] - maxWidth - 1,\n track.position[1] + 1,\n maxWidth,\n cumY - paddingY\n );\n\n recipe.forEach(r => {\n graphics.lineStyle(\n 1,\n colorToHex('black'),\n 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.beginFill(colorToHex(r.color), 1);\n graphics.drawCircle(r.x, r.y, 4);\n });\n}\n\nexport function drawRowLegend(\n HGC: { libraries: Libraries },\n trackInfo: any,\n _tile: unknown,\n tm: GoslingTrackModel,\n theme: Required\n) {\n /* track spec */\n const spec = tm.spec();\n if (\n !IsChannelDeep(spec.row) ||\n spec.row.type !== 'nominal' ||\n !spec.row.legend\n // || (!IsChannelDeep(spec.y) || spec.y.type !== 'nominal' || !spec.y.legend)\n ) {\n // we do not need to draw a legend\n return;\n }\n\n /* track size */\n // const trackHeight = trackInfo.dimensions[1];\n\n /* row separation */\n const rowCategories: string[] = (tm.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n // const rowHeight = trackHeight / rowCategories.length;\n if (rowCategories.length === 0) {\n // We do not need to draw a legend for only one category\n return;\n }\n\n /* render */\n const graphics = trackInfo.pBorder; // use pBorder not to affected by zoomming\n\n const paddingX = 4;\n const paddingY = 2;\n\n // label text style\n const labelTextStyle = getTextStyle({\n color: theme.legend.labelColor,\n size: theme.legend.labelFontSize,\n fontWeight: theme.legend.labelFontWeight,\n fontFamily: theme.legend.labelFontFamily\n });\n\n rowCategories.forEach(category => {\n const rowPosition = tm.encodedValue('row', category);\n\n const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle);\n textGraphic.anchor.x = 0;\n textGraphic.anchor.y = 0;\n textGraphic.position.x = trackInfo.position[0] + paddingX;\n textGraphic.position.y = trackInfo.position[1] + rowPosition + paddingY;\n\n graphics.addChild(textGraphic);\n\n const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle);\n const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj);\n\n graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity);\n graphics.lineStyle(\n 1,\n colorToHex(theme.legend.backgroundStroke),\n 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.drawRect(\n trackInfo.position[0] + 1,\n trackInfo.position[1] + rowPosition + 1,\n textMetrics.width + paddingX * 2,\n textMetrics.height + paddingY * 2\n );\n });\n}\n","import { scaleLinear } from 'd3-scale';\nimport type { Tile } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport { isNumberArray, isStringArray } from '../utils/array';\nimport { getTextStyle } from '../utils/text-style';\n\nconst EXTENT_TICK_SIZE = 8;\nconst TICK_SIZE = 6;\n\n/**\n * Draw linear scale Y axis\n */\nexport function drawLinearYAxis(\n HGC: { libraries: { PIXI: typeof import('pixi.js') } },\n trackInfo: any,\n _tile: unknown,\n model: GoslingTrackModel,\n theme: Required\n) {\n const spec = model.spec();\n const CIRCULAR = spec.layout === 'circular';\n const yDomain = model.getChannelDomainArray('y');\n const yRange = model.getChannelRangeArray('y');\n\n if (CIRCULAR) {\n // Wrong function call, this is for linear tracks!\n return;\n }\n\n if (!model.isShowYAxis() || !yDomain || !yRange) {\n // We do not need to draw a y-axis\n return;\n }\n\n if (!isNumberArray(yDomain)) {\n // We can only draw axis for number domains\n return;\n }\n\n /* track size */\n const [tw, th] = trackInfo.dimensions;\n const [tx, ty] = trackInfo.position;\n\n /* row separation */\n const rowCategories = model.getChannelDomainArray('row') ?? ['___SINGLE_ROW___'];\n if (!isStringArray(rowCategories)) {\n // We can only draw axis for string categories\n return;\n }\n const rowHeight = th / rowCategories.length;\n\n if (rowHeight <= 20) {\n // Height is too narrow to draw axis\n return;\n }\n\n /* Axis components */\n const yChannel = model.spec().y;\n const isLeft = IsChannelDeep(yChannel) && 'axis' in yChannel && yChannel.axis === 'right' ? false : true; // Right position only if explicitly specified\n const yScale = scaleLinear()\n .domain(yDomain as number[])\n .range(yRange as number[]);\n\n /* render */\n const graphics = trackInfo.pBorder;\n\n rowCategories.forEach(category => {\n // if (rowCategories.length > 1 ? i !== 1 : i !== 0) {\n // // Let's draw only one y-axis since the scale is shared anyway.\n // // Draw the second y-axis if exist, so that track title is not occluded by the y-axis.\n // return;\n // }\n\n const rowPosition = model.encodedValue('row', category);\n const dx = isLeft ? tx : tx + tw;\n const dy = ty + rowPosition;\n\n /* Axis Baseline */\n graphics.lineStyle(\n 1,\n colorToHex(theme.axis.baselineColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.moveTo(dx, dy);\n graphics.lineTo(dx, dy + rowHeight);\n\n /* Ticks */\n const tickCount = Math.max(Math.ceil(rowHeight / 40), 1);\n let ticks = yScale.ticks(tickCount).filter(v => yDomain[0] <= v && v <= yDomain[1]);\n\n if (ticks.length === 1) {\n // Sometimes, ticks() gives a single value, so use a larger tickCount.\n ticks = yScale.ticks(tickCount + 1).filter(v => yDomain[0] <= v && v <= yDomain[1]);\n }\n\n graphics.lineStyle(\n 1,\n colorToHex(theme.axis.tickColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n let tickEnd = isLeft ? dx + TICK_SIZE : dx - TICK_SIZE;\n ticks.forEach(t => {\n const y = yScale(t);\n graphics.moveTo(dx, dy + rowHeight - y);\n graphics.lineTo(tickEnd, dy + rowHeight - y);\n });\n\n // Two ticks on the bottom and top\n tickEnd = isLeft ? dx + EXTENT_TICK_SIZE : dx - EXTENT_TICK_SIZE;\n graphics.moveTo(dx, dy);\n graphics.lineTo(tickEnd, dy);\n graphics.moveTo(dx, dy + rowHeight);\n graphics.lineTo(tickEnd, dy + rowHeight);\n\n const styleConfig = getTextStyle({\n color: theme.axis.labelColor,\n size: theme.axis.labelFontSize,\n fontFamily: theme.axis.labelFontFamily,\n fontWeight: theme.axis.labelFontWeight\n });\n\n /* Labels */\n ticks.forEach(t => {\n const y = yScale(t);\n tickEnd = isLeft ? dx + TICK_SIZE * 2 : dx - TICK_SIZE * 2;\n\n const textGraphic = new HGC.libraries.PIXI.Text(t, styleConfig);\n textGraphic.anchor.x = isLeft ? 0 : 1;\n textGraphic.anchor.y = y === 0 ? 0.9 : 0.5;\n textGraphic.position.x = tickEnd;\n textGraphic.position.y = dy + rowHeight - y;\n\n // Flip labels when orientation is vertical\n if (spec.orientation === 'vertical') {\n textGraphic.anchor.x = isLeft ? 1 : 0;\n textGraphic.scale.x *= -1;\n }\n graphics.addChild(textGraphic);\n });\n });\n}\n\n/**\n * Draw linear scale Y axis\n */\nexport function drawCircularYAxis(\n HGC: import('@higlass/types').HGC,\n trackInfo: any,\n tile: Tile,\n model: GoslingTrackModel,\n theme: Required\n) {\n const spec = model.spec();\n const CIRCULAR = spec.layout === 'circular';\n const yDomain = model.getChannelDomainArray('y');\n const yRange = model.getChannelRangeArray('y');\n\n if (!CIRCULAR) {\n // Wrong function call, this is for circular tracks.\n return;\n }\n\n if (!model.isShowYAxis() || !yDomain || !yRange) {\n // We do not need to draw a y-axis\n return;\n }\n\n if (!isNumberArray(yDomain)) {\n // We can only draw axis for number domains\n return;\n }\n\n /* track size */\n const [tw, th] = trackInfo.dimensions;\n\n /* circular parameters */\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const cx = tw / 2.0;\n const cy = th / 2.0;\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = th / rowCategories.length;\n\n if ((rowHeight / th) * trackRingSize <= 20) {\n // Height is too narrow to draw axis\n return;\n }\n\n /* Axis components */\n const yChannel = model.spec().y;\n const isLeft = IsChannelDeep(yChannel) && 'axis' in yChannel && yChannel.axis === 'right' ? false : true; // Right position only if explicitly specified\n const yScale = scaleLinear()\n .domain(yDomain as number[])\n .range(yRange as number[]);\n\n /* render */\n const graphics = tile.graphics; // We do not use `pBorder` as in linear layouts.\n\n rowCategories.forEach(category => {\n // if (rowCategories.length > 1 ? i !== 1 : i !== 0) {\n // // Let's draw only one y-axis since the scale is shared anyway.\n // // Draw the second y-axis if exist, so that track title is not occluded by the y-axis.\n // return;\n // }\n\n const rowPosition = model.encodedValue('row', category);\n\n /* Axis Baseline */\n const innerR = trackOuterRadius - ((rowPosition + rowHeight) / th) * trackRingSize;\n const outerR = trackOuterRadius - (rowPosition / th) * trackRingSize;\n const innerPos = cartesianToPolar(isLeft ? 0 : tw, tw, innerR, cx, cy, startAngle, endAngle);\n const outerPos = cartesianToPolar(isLeft ? 0 : tw, tw, outerR, cx, cy, startAngle, endAngle);\n\n graphics.lineStyle(\n 1,\n colorToHex(theme.axis.baselineColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.moveTo(innerPos.x, innerPos.y);\n graphics.lineTo(outerPos.x, outerPos.y);\n\n /* Ticks */\n // Since we use the polar system, we use numbers 'scaled' for the polar system.\n const SCALED_TICK_SIZE = (r: number) => (TICK_SIZE * tw) / 2 / Math.PI / r;\n const SCALED_EXTENT_TICK_SIZE = (r: number) => (EXTENT_TICK_SIZE * tw) / 2 / Math.PI / r;\n\n // Determine ticks to display\n const axisHeight = (rowHeight / th) * trackRingSize;\n const tickCount = Math.max(Math.ceil(axisHeight / 40), 1);\n let ticks = yScale.ticks(tickCount).filter(v => yDomain[0] <= v && v <= yDomain[1]);\n\n if (ticks.length === 1) {\n // Sometimes, ticks() gives a single tick (e.g., only baseline), so let's use a larger tickCount.\n ticks = yScale.ticks(tickCount + 1).filter(v => yDomain[0] <= v && v <= yDomain[1]);\n }\n\n // Render ticks\n graphics.lineStyle(\n 1,\n colorToHex(theme.axis.tickColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n ticks.forEach(t => {\n const y = yScale(t);\n\n // The current position, i.e., radius, of this tick\n const currentR = trackOuterRadius - ((rowPosition + rowHeight - y) / th) * trackRingSize;\n\n // Ticks are drawn in anti-clockwise direction\n const scaledStartX = isLeft ? 0 : tw - SCALED_TICK_SIZE(currentR);\n const scaledEndX = isLeft ? SCALED_TICK_SIZE(currentR) : tw;\n\n // The position of a tick in the polar system\n const pos = cartesianToPolar(scaledStartX, tw, currentR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle);\n const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle);\n\n // Render a tick\n graphics.moveTo(pos.x, pos.y);\n graphics.arc(cx, cy, currentR, startRad, endRad, true);\n graphics.arc(cx, cy, currentR, endRad, startRad, false);\n graphics.closePath();\n });\n\n // Two ticks on the bottom and top\n {\n // The inner tick\n const scaledStartX = isLeft ? 0 : tw - SCALED_EXTENT_TICK_SIZE(trackInnerRadius);\n const scaledEndX = isLeft ? SCALED_EXTENT_TICK_SIZE(trackInnerRadius) : tw;\n\n const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle);\n const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle);\n\n graphics.moveTo(innerPos.x, innerPos.y);\n graphics.arc(cx, cy, trackInnerRadius, startRad, endRad, true);\n graphics.arc(cx, cy, trackInnerRadius, endRad, startRad, false);\n graphics.closePath();\n }\n {\n // The outer tick\n const scaledStartX = isLeft ? 0 : tw - SCALED_EXTENT_TICK_SIZE(trackOuterRadius);\n const scaledEndX = isLeft ? SCALED_EXTENT_TICK_SIZE(trackOuterRadius) : tw;\n\n const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle);\n const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle);\n\n graphics.moveTo(outerPos.x, outerPos.y);\n graphics.arc(cx, cy, trackOuterRadius, startRad, endRad, true);\n graphics.arc(cx, cy, trackOuterRadius, endRad, startRad, false);\n graphics.closePath();\n }\n\n /* Labels */\n ticks.forEach(t => {\n const y = yScale(t);\n\n // The current position, i.e., radius, of this label\n const currentR = trackOuterRadius - ((rowPosition + rowHeight - y) / th) * trackRingSize;\n\n // The position of a tick in the polar system\n const pos = cartesianToPolar(SCALED_TICK_SIZE(currentR) * 2, tw, currentR, cx, cy, startAngle, endAngle);\n\n const styleConfig = getTextStyle({\n color: theme.axis.labelColor,\n size: theme.axis.labelFontSize,\n fontFamily: theme.axis.labelFontFamily,\n fontWeight: theme.axis.labelFontWeight\n });\n const textGraphic = new HGC.libraries.PIXI.Text(t, styleConfig);\n textGraphic.anchor.x = isLeft ? 1 : 0;\n textGraphic.anchor.y = 0.5;\n textGraphic.position.x = pos.x;\n textGraphic.position.y = pos.y;\n\n textGraphic.resolution = 4;\n const txtStyle = new HGC.libraries.PIXI.TextStyle(styleConfig);\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(textGraphic.text, txtStyle);\n\n // Scale the width of text label so that its width is the same when converted into circular form\n const txtWidth = ((metric.width / (2 * currentR * Math.PI)) * tw * 360) / (endAngle - startAngle);\n const scaledStartX = isLeft\n ? SCALED_TICK_SIZE(currentR) * 2\n : tw - SCALED_TICK_SIZE(currentR) * 2 - txtWidth;\n const scaledEndX = isLeft ? SCALED_TICK_SIZE(currentR) * 2 + txtWidth : tw - SCALED_TICK_SIZE(currentR) * 2;\n\n // Determine the points of a rope element for a lebel\n const ropePoints: import('pixi.js').Point[] = [];\n for (let i = scaledEndX; i >= scaledStartX; i -= txtWidth / 10.0) {\n const p = cartesianToPolar(i, tw, currentR, cx, cy, startAngle, endAngle);\n ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y));\n }\n\n // Render a label\n // @ts-expect-error missing argument in updateText?\n textGraphic.updateText();\n const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints);\n graphics.addChild(rope);\n });\n });\n}\n","import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\n\nexport function drawCircularOutlines(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n /* track spec */\n const spec = tm.spec();\n\n /* track size */\n const [l, t] = trackInfo.position;\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const trackInnerRadius = spec.innerRadius ?? 220; // TODO: should default values be filled already\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const cx = l + trackWidth / 2.0;\n const cy = t + trackHeight / 2.0;\n\n const posStartInner = cartesianToPolar(0, trackWidth, trackInnerRadius, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(0, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle);\n\n /* render */\n const g = trackInfo.pBackground;\n\n if (!(spec.layout === 'circular' && spec.mark === 'withinLink')) {\n // circular link marks usually use entire inner space\n g.lineStyle(\n spec.style?.outlineWidth ? spec.style?.outlineWidth / 2.5 : 0,\n colorToHex(spec.style?.outline ?? '#DBDBDB'),\n 1, // 0.4, // alpha\n 1 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(\n colorToHex(tm.spec().style?.background ?? theme.track.background),\n tm.spec().style?.backgroundOpacity ??\n (!theme.track.background || theme.track.background === 'transparent' ? 0 : 1)\n );\n g.moveTo(posStartInner.x, posStartInner.y);\n g.arc(cx, cy, trackInnerRadius, startRad, endRad, true);\n g.arc(cx, cy, trackOuterRadius, endRad, startRad, false);\n g.closePath();\n }\n\n if (IsChannelDeep(spec.x) && spec.x.axis === 'top') {\n // outer line\n g.lineStyle(\n 0.5,\n colorToHex('black'),\n 0, // 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex('white'), 0);\n g.moveTo(posStartInner.x, posStartInner.y);\n g.arc(cx, cy, trackOuterRadius - 0.5, startRad, endRad, true);\n g.arc(cx, cy, trackOuterRadius, endRad, startRad, false);\n g.closePath();\n }\n\n // inner line\n // graphics.lineStyle(\n // 0.5,\n // colorToHex('black'),\n // 1, // alpha\n // 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n // );\n // graphics.beginFill(colorToHex('white'), 0);\n // graphics.moveTo(xToPos(0, innerRadius - 0.5).x, xToPos(0, innerRadius - 0.5).y);\n // graphics.arc(cx, cy, innerRadius - 0.5, xToDt(0), xToDt(trackWidth), true);\n // graphics.arc(cx, cy, innerRadius, xToDt(trackWidth), xToDt(0), false);\n // graphics.closePath();\n\n // slice on the top\n g.lineStyle(\n 0.5,\n colorToHex('black'),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex('white'), 0);\n g.moveTo(cx, cy);\n g.arc(cx, cy, trackOuterRadius + 3, startRad, endRad, false);\n g.closePath();\n\n // center white hole\n g.lineStyle(\n 1,\n colorToHex('#DBDBDB'),\n 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex('white'), 0);\n g.drawCircle(cx, cy, trackInnerRadius - 1);\n}\n","import { isUndefined } from 'lodash-es';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\n\nexport function drawBackground(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n // size and position\n const [l, t] = trackInfo.position;\n const [w, h] = trackInfo.dimensions;\n\n // refer to https://github.com/higlass/higlass/blob/f82c0a4f7b2ab1c145091166b0457638934b15f3/app/scripts/PixiTrack.js#L129\n const g = trackInfo.pBackground;\n\n if (tm.spec().style?.background || (theme.track.background && theme.track.background !== 'transparent')) {\n g.clear();\n\n const bg = tm.spec().style?.background ?? theme.track.background;\n const alpha = isUndefined(tm.spec().style?.backgroundOpacity) ? 1 : tm.spec().style?.backgroundOpacity;\n // background\n g.lineStyle(\n 1,\n colorToHex('white'),\n 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex(bg), alpha);\n g.drawRect(l, t, w, h);\n }\n\n if (theme.track.alternatingBackground && theme.track.alternatingBackground !== 'transparent') {\n const spec = tm.spec();\n\n if (!IsChannelDeep(spec.row) || spec.row.type !== 'nominal') {\n // we do not use a `row` channel, so no need to draw alternating backgrounds\n return;\n }\n\n /* row separation */\n const rowCategories: string[] = (tm.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n if (rowCategories.length === 0) {\n // We do not need to fill alternating colors for only one category\n return;\n }\n\n /* render */\n rowCategories.forEach((category, i) => {\n if (i % 2 === 0) {\n // we only draw even rows\n return;\n }\n const rowPosition = tm.encodedValue('row', category);\n\n const bg = tm.spec().style?.background ?? theme.track.alternatingBackground;\n const alpha = isUndefined(tm.spec().style?.backgroundOpacity) ? 1 : tm.spec().style?.backgroundOpacity;\n // background\n g.lineStyle(\n 1,\n colorToHex('white'),\n 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex(bg), alpha);\n g.drawRect(trackInfo.position[0], trackInfo.position[1] + rowPosition, w, h / rowCategories.length);\n });\n }\n}\n","import type * as PIXI from 'pixi.js';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport { getValueUsingChannel, Is2DTrack } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar, positionToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\n\n// TODO: This code is taken from `link.ts` which is for withinLink marks. Large parts should be removed.\nexport function drawBetweenLink(g: PIXI.Graphics, trackInfo: any, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300;\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const tcx = trackWidth / 2.0;\n const tcy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n // TODO: Can row be actually used for circular layouts?\n /* render */\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n let x = model.encodedPIXIProperty('x', d);\n let xe = model.encodedPIXIProperty('xe', d);\n let x1 = model.encodedPIXIProperty('x1', d);\n let x1e = model.encodedPIXIProperty('x1e', d);\n const y = model.encodedPIXIProperty('y', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const color = model.encodedPIXIProperty('color', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n // sort properly\n if (typeof xe !== 'undefined') {\n [x, xe] = [x, xe].sort((a, b) => a - b);\n }\n if (typeof x1 !== 'undefined' && typeof x1e !== 'undefined') {\n [x1, x1e] = [x1, x1e].sort((a, b) => a - b);\n }\n\n // Is this band or line?\n const isRibon =\n typeof xe !== 'undefined' &&\n typeof x1 !== 'undefined' &&\n typeof x1e !== 'undefined' &&\n // This means the strokeWidth of a band is too small, so we just need to draw a line instead\n Math.abs(x - xe) > 0.1 &&\n Math.abs(x1 - x1e) > 0.1;\n\n // TODO: This correction can be moved to the compile process\n if (!isRibon && xe === undefined && !Is2DTrack(spec)) {\n // We need to use a valid value to draw lines, so lets find alternative one.\n if (x1 === undefined && x1e === undefined) {\n // We do not have a valid ones.\n return;\n }\n xe = x1 !== undefined ? x1 : x1e;\n }\n\n if (!isRibon && Math.abs(x - xe) <= 0.1 && Math.abs(x1 - x1e) <= 0.1) {\n // Put the larger value on `xe` so that it can be used in line connection\n x = (x + xe) / 2.0;\n xe = (x1 + x1e) / 2.0;\n }\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n opacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n if (isRibon) {\n g.beginFill(color === 'none' ? colorToHex('white') : colorToHex(color), color === 'none' ? 0 : opacity);\n\n let [_x1, _x2, _x3, _x4] = [x, xe, x1, x1e];\n\n // Sort values to safely draw bands\n [_x1, _x2] = [_x1, _x2].sort((a, b) => a - b);\n [_x3, _x4] = [_x3, _x4].sort((a, b) => a - b);\n\n if (_x1 > trackWidth || _x4 < 0 || Math.abs(_x4 - _x1) < 0.5) {\n // Do not draw very small visual marks\n return;\n }\n\n if (circular) {\n if (_x1 < 0 || _x4 > trackWidth) {\n // Do not show bands that are partly outside of the current domain\n return;\n }\n\n // https://pixijs.download/dev/docs/PIXI.Graphics.html#bezierCurveTo\n const r = trackOuterRadius - (rowPosition / trackHeight) * trackRingSize;\n const posX = cartesianToPolar(_x1, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posXE = cartesianToPolar(_x2, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posX1 = cartesianToPolar(_x3, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posX1E = cartesianToPolar(_x4, trackWidth, r, tcx, tcy, startAngle, endAngle);\n\n g.moveTo(posX.x, posX.y);\n\n // outer curve\n g.bezierCurveTo(tcx, tcy, tcx, tcy, posX1E.x, posX1E.y);\n\n g.arc(\n tcx,\n tcy,\n trackOuterRadius,\n positionToRadian(posX1E.x, posX1E.y, tcx, tcy),\n positionToRadian(posX1.x, posX1.y, tcx, tcy),\n false\n );\n\n // inner curve\n g.bezierCurveTo(tcx, tcy, tcx, tcy, posXE.x, posXE.y);\n\n g.arc(\n tcx,\n tcy,\n trackOuterRadius,\n positionToRadian(posXE.x, posXE.y, tcx, tcy),\n positionToRadian(posX.x, posX.y, tcx, tcy),\n false\n );\n g.endFill();\n } else {\n // Linear mark\n g.moveTo(_x1, rowPosition);\n g.lineTo(_x2, rowPosition);\n g.lineTo(_x4, rowPosition + rowHeight);\n g.lineTo(_x3, rowPosition + rowHeight);\n g.lineTo(_x1, rowPosition);\n g.closePath();\n }\n } else {\n /* Line Connection */\n\n // Experimental\n if (Is2DTrack(spec)) {\n if (spec.style?.linkConnectionType === 'curve') {\n g.moveTo(x, 0);\n g.bezierCurveTo(\n (x / 5.0) * 4,\n (rowPosition + rowHeight - y) / 2.0,\n x / 2.0,\n ((rowPosition + rowHeight - y) / 5.0) * 4,\n 0,\n rowPosition + rowHeight - y\n );\n } else if (spec.style?.linkConnectionType === 'straight') {\n g.moveTo(x, 0);\n g.lineTo(0, rowPosition + rowHeight - y);\n } else {\n // spec.style?.linkConnectionType === 'corner'\n g.moveTo(x, 0);\n g.lineTo(x, rowPosition + rowHeight - y);\n g.lineTo(0, rowPosition + rowHeight - y);\n }\n return;\n }\n\n if (circular) {\n /* Original lines */\n // const r = trackOuterRadius - (rowPosition / trackHeight) * trackRingSize;\n // const posX = cartesianToPolar(x, trackWidth, r, tcx, tcy, startAngle, endAngle);\n // const posXE = cartesianToPolar(xe, trackWidth, trackInnerRadius, tcx, tcy, startAngle, endAngle);\n // g.lineStyle(\n // 1,\n // colorToHex('red'),\n // 1, // alpha\n // 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n // );\n // g.moveTo(posX.x, posX.y);\n // g.lineTo(posXE.x, posXE.y);\n\n // https://www.tessellationtech.io/tutorial-circular-sankey/\n let prevX, prevY;\n for (let t = 0; t <= 1; t += 0.02) {\n const logodds = (t: number) => Math.log(t / (1 - t));\n const movingRadius = (t: number) =>\n trackOuterRadius - (1 / (1 + Math.exp(logodds(t)))) * trackRingSize + 3;\n const getRadian = (t: number, s: number, e: number) => ((e - s) * t + s) / trackWidth;\n const _x = tcx + movingRadius(t) * Math.cos(-getRadian(t, x, xe) * 2 * Math.PI - Math.PI / 2.0);\n const _y = tcy + movingRadius(t) * Math.sin(-getRadian(t, x, xe) * 2 * Math.PI - Math.PI / 2.0);\n if (prevX && prevY) {\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n opacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.moveTo(prevX, prevY);\n g.lineTo(_x, _y);\n }\n prevX = _x;\n prevY = _y;\n }\n\n return;\n }\n\n // TODO: Not yet supported.\n g.moveTo(xe, rowPosition + rowHeight);\n g.lineTo(x, rowPosition);\n }\n });\n });\n}\n","import type { Tile } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { drawPoint } from './point';\nimport { drawLine } from './line';\nimport { drawBar } from './bar';\nimport { drawArea } from './area';\nimport { drawRect } from './rect';\nimport type { ChannelTypes } from '@gosling-lang/gosling-schema';\nimport { drawTriangle } from './triangle';\nimport { drawText } from './text';\nimport { drawRule } from './rule';\nimport { drawWithinLink } from './withinLink';\nimport { drawGrid } from './grid';\nimport { drawCircularTitle } from './title';\nimport { drawChartOutlines } from './outline';\nimport { drawColorLegend, drawRowLegend } from './legend';\nimport { drawCircularYAxis, drawLinearYAxis } from './axis';\nimport { drawCircularOutlines } from './outline-circular';\nimport { drawBackground } from './background';\nimport type { CompleteThemeDeep } from '../utils/theme';\nimport { Is2DTrack, IsVerticalRule } from '@gosling-lang/gosling-schema';\nimport { drawBetweenLink } from './betweenLink';\n\n/**\n * Visual channels currently supported for visual encoding.\n */\nexport const SUPPORTED_CHANNELS: (keyof typeof ChannelTypes)[] = [\n 'x',\n 'xe',\n 'x1',\n 'x1e',\n\n 'y',\n 'ye',\n 'y1',\n 'y1e',\n\n 'color',\n 'size',\n 'row',\n 'stroke',\n 'strokeWidth',\n 'opacity',\n 'text'\n // ...\n];\n\nexport const RESOLUTION = 4;\n\n/**\n * Draw a track based on the track specification in a Gosling grammar.\n */\nexport function drawMark(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel) {\n if (!HGC || !trackInfo || !tile) {\n // We did not receive parameters correctly.\n return;\n }\n\n if (model.spec().mark === 'brush') {\n // Interactive brushes are rendered by our another plugin track, called `gosling-brush`\n return;\n }\n\n // Replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher.\n (['x', 'x1', 'x1e', 'xe'] as const).forEach(d => {\n model.setChannelScale(d, trackInfo._xScale);\n });\n\n if (Is2DTrack(model.spec()) || IsVerticalRule(model.spec())) {\n // Since small numbers are positioned on the top in the y axis, we reverse the domain, making it consistent to regular y scale.\n const yScale = trackInfo._yScale.copy();\n yScale.range([yScale.range()[1], yScale.range()[0]]);\n\n ['y', 'y1', 'y1e', 'ye'].forEach((d: any) => {\n model.setChannelScale(d, yScale);\n });\n }\n\n // Size of a track\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* spec */\n switch (model.spec().mark) {\n case 'point':\n drawPoint(trackInfo, tile.graphics, model);\n break;\n case 'bar':\n drawBar(trackInfo, tile, model);\n break;\n case 'line':\n drawLine(tile.graphics, model, trackWidth, trackHeight);\n break;\n case 'area':\n drawArea(HGC, trackInfo, tile, model);\n break;\n case 'rect':\n drawRect(HGC, trackInfo, tile, model);\n break;\n case 'triangleLeft':\n case 'triangleRight':\n case 'triangleBottom':\n drawTriangle(tile.graphics, model, trackWidth, trackHeight);\n break;\n case 'text':\n drawText(HGC, trackInfo, tile, model);\n break;\n case 'rule':\n drawRule(HGC, trackInfo, tile, model);\n break;\n case 'betweenLink':\n drawBetweenLink(tile.graphics, trackInfo, model);\n break;\n case 'withinLink':\n drawWithinLink(tile.graphics, trackInfo, model);\n break;\n default:\n console.warn('Unsupported mark type');\n break;\n }\n}\n\n/**\n * Draw chart embellishments before rendering marks.\n */\nexport function drawPreEmbellishment(\n HGC: import('@higlass/types').HGC,\n trackInfo: any,\n tile: Tile,\n model: GoslingTrackModel,\n theme: Required\n) {\n if (!HGC || !trackInfo || !tile) {\n // We did not receive parameters correctly.\n return;\n }\n\n if (model.spec().mark === 'brush') {\n // We do not draw brush. Instead, higlass do.\n return;\n }\n // Replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher.\n (['x', 'x1', 'x1e', 'xe'] as const).forEach(d => {\n model.setChannelScale(d, trackInfo._xScale);\n });\n\n const isCircular = model.spec().layout === 'circular';\n\n if (isCircular) {\n drawCircularOutlines(trackInfo, model, theme);\n } else {\n drawBackground(trackInfo, model, theme);\n drawChartOutlines(trackInfo, model, theme);\n }\n drawGrid(trackInfo, model, theme);\n}\n\n/**\n * Draw chart embellishments after rendering marks.\n */\nexport function drawPostEmbellishment(\n HGC: import('@higlass/types').HGC,\n trackInfo: any,\n tile: Tile,\n model: GoslingTrackModel,\n theme: Required\n) {\n if (!HGC || !trackInfo || !tile) {\n // We did not receive parameters correctly.\n return;\n }\n\n if (model.spec().mark === 'brush') {\n // We do not draw brush. Instead, higlass do.\n return;\n }\n // Replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher.\n (['x', 'x1', 'x1e', 'xe'] as const).forEach(d => {\n model.setChannelScale(d, trackInfo._xScale);\n });\n\n const isCircular = model.spec().layout === 'circular';\n\n if (isCircular) {\n drawCircularYAxis(HGC, trackInfo, tile, model, theme);\n drawCircularTitle(HGC, trackInfo, tile, model, theme);\n } else {\n drawLinearYAxis(HGC, trackInfo, tile, model, theme);\n drawRowLegend(HGC, trackInfo, tile, model, theme);\n }\n drawColorLegend(HGC, trackInfo, tile, model, theme);\n}\n","import type {\n AxisPosition,\n SingleTrack,\n OverlaidTrack,\n Track,\n ChannelDeep,\n DataDeep\n} from '@gosling-lang/gosling-schema';\nimport { IsChannelDeep, IsDataTrack, IsOverlaidTrack, IsSingleTrack, IsDummyTrack } from '@gosling-lang/gosling-schema';\n\n/**\n * Resolve superposed tracks into multiple track specifications.\n * Some options are corrected to ensure the resolved tracks use consistent visual properties, such as the existence of the axis for genomic coordinates.\n */\nexport function resolveSuperposedTracks(track: Track): SingleTrack[] {\n if (IsDataTrack(track) || IsDummyTrack(track)) {\n // no BasicSingleTrack to return\n return [];\n }\n\n if (!IsOverlaidTrack(track)) {\n // no `superpose` to resolve\n return [track];\n }\n\n if (track._overlay.length === 0) {\n // This makes sure not to return empty object\n return [{ ...track, superpose: undefined } as SingleTrack];\n }\n\n // TODO: Is this sufficient? If yes, also apply to other functions doing this.\n const { _overlay, ...base } = track as Partial;\n // delete (base as Partial).overlay; // remove `superpose` from the base spec\n\n const resolved: SingleTrack[] = [];\n track._overlay.forEach((subSpec, i) => {\n const spec = Object.assign({}, base, subSpec) as SingleTrack;\n if (spec.title && i !== 0) {\n delete spec.title;\n }\n resolved.push(spec);\n });\n\n /* Correct the spec for consistency */\n // x-axis\n let xAxisPosition: undefined | AxisPosition = undefined;\n resolved.forEach(d => {\n if (IsChannelDeep(d.x) && d.x.axis && !xAxisPosition) {\n xAxisPosition = d.x.axis;\n }\n });\n\n const corrected = resolved.map(d => {\n return {\n ...d,\n x: { ...d.x, axis: xAxisPosition }\n } as SingleTrack;\n });\n\n // height\n // ...\n\n return corrected;\n}\n\n/**\n * Spread overlaid tracks if they are assigned to different data/metadata.\n * This process is necessary since we are passing over each track to HiGlass, and if a single track is mapped to multiple datastes, HiGlass cannot handle that.\n */\nexport function spreadTracksByData(tracks: Track[]): Track[] {\n return ([] as Track[]).concat(\n ...tracks.map(t => {\n if (IsDataTrack(t) || !IsOverlaidTrack(t) || t._overlay.length <= 1) {\n // no overlaid tracks to spread\n return [t];\n }\n\n if (t._overlay.filter(s => s.data).length === 0) {\n // overlaid tracks use the parent's data specs as it w/o re-specification, so no point to spread.\n return [t];\n }\n\n if (isIdenticalDataSpec([t.data, ...t._overlay.map(s => s.data)])) {\n // individual overlaid tracks define the same data, so no point to spread.\n return [t];\n }\n\n const base: Partial = { ...t, id: undefined, _overlay: undefined };\n const spread: Track[] = [];\n const original: OverlaidTrack = JSON.parse(JSON.stringify(base));\n original._overlay = [];\n\n t._overlay.forEach(subSpec => {\n // If data specs are undefined, put the first spec to the parent\n if (!original.data) {\n original.data = subSpec.data;\n }\n\n // If the id is undefined, put the first spec to the parent\n if (!original.id) {\n original.id = subSpec.id;\n }\n\n // Determine if this `subSpec` should be added to `overlay` or become a separate track\n if (!subSpec.data || isIdenticalDataSpec([original.data, subSpec.data])) {\n original._overlay.push(subSpec);\n return;\n }\n\n const spec = Object.assign(JSON.parse(JSON.stringify(base)), subSpec) as SingleTrack;\n spread.push(spec);\n });\n\n const output = original._overlay.length > 0 ? [original, ...spread] : spread;\n return output.map((track, i, arr) => {\n const overlayOnPreviousTrack = i !== 0;\n\n // Y axis should be positioned on the right or hidden if multiple tracks are overlaid to prevent visual occlussion.\n // Refer to this issue: https://github.com/gosling-lang/gosling.js/issues/400\n const y =\n IsSingleTrack(track) && IsChannelDeep(track.y) && !track.y.axis && overlayOnPreviousTrack\n ? ({ ...track.y, axis: i === 1 ? 'right' : 'none' } as ChannelDeep)\n : IsSingleTrack(track)\n ? track.y\n : undefined;\n\n if (track.title && i !== arr.length - 1 && arr.length !== 1) {\n delete track.title; // remove `title` except the last one\n }\n return { ...track, overlayOnPreviousTrack, y } as Track;\n });\n })\n );\n}\n\nexport function isIdenticalDataSpec(specs: (DataDeep | undefined)[]): boolean {\n if (specs.length === 0) {\n return false;\n }\n\n const definedSpecs = specs.filter(d => d) as DataDeep[];\n\n if (definedSpecs.length !== specs.length) {\n return false;\n }\n\n // Iterate keys to check if these are identical\n const keys = Object.keys(definedSpecs[0]).sort();\n let isIdentical = true;\n keys.forEach(k => {\n const uniqueProperties = Array.from(new Set(definedSpecs.map(d => JSON.stringify((d as any)[k]))));\n if (uniqueProperties.length !== 1) {\n isIdentical = false;\n return;\n }\n });\n return isIdentical;\n}\n","import type {\n ChannelDeep,\n ChannelValue,\n DataDeep,\n Datum,\n DomainChr,\n DomainInterval,\n DomainChrInterval,\n Style,\n Track,\n SingleTrack,\n OverlaidTrack,\n ChannelTypes,\n Channel,\n FieldType,\n Domain,\n FilterTransform,\n OneOfFilter,\n RangeFilter,\n IncludeFilter,\n BeddbData,\n MultivecData,\n MatrixData,\n VectorData,\n DataTrack,\n BigWigData,\n SingleView,\n FlatTracks,\n OverlaidTracks,\n StackedTracks,\n BamData,\n Range,\n TemplateTrack,\n MouseEventsDeep,\n DataTransform,\n DummyTrack\n} from './gosling.schema';\nimport { SUPPORTED_CHANNELS } from '../core/mark';\nimport {\n interpolateGreys,\n interpolateWarm,\n interpolateSpectral,\n interpolateCividis,\n interpolateBuPu,\n interpolateRdBu,\n interpolateViridis,\n interpolateYlOrBr,\n interpolateRdPu\n} from 'd3-scale-chromatic';\nimport { resolveSuperposedTracks } from '../core/utils/overlay';\nimport type { TabularDataFetcher } from '@data-fetchers';\n\nexport const PREDEFINED_COLOR_STR_MAP: { [k: string]: (t: number) => string } = {\n viridis: interpolateViridis,\n grey: interpolateGreys,\n warm: interpolateWarm,\n spectral: interpolateSpectral,\n cividis: interpolateCividis,\n bupu: interpolateBuPu,\n rdbu: interpolateRdBu,\n hot: interpolateYlOrBr,\n pink: interpolateRdPu\n};\n\nexport function isObject(x: unknown): x is Record {\n return typeof x === 'object' && x !== null;\n}\n\nexport function isTabularDataFetcher(dataFetcher: unknown): dataFetcher is TabularDataFetcher {\n return isObject(dataFetcher) && 'getTabularData' in dataFetcher;\n}\n\nexport function hasDataTransform(spec: SingleTrack | OverlaidTrack, type: DataTransform['type']) {\n return (spec.dataTransform ?? []).some(d => d.type === type);\n}\n\n/**\n * This returns an array of color strings that can be assigned to HiGlass' option, `colorRange`\n */\nexport function getHiGlassColorRange(colorStr = 'viridis', step = 100) {\n const interpolate = PREDEFINED_COLOR_STR_MAP[colorStr] ?? PREDEFINED_COLOR_STR_MAP['viridis'];\n return [...Array(step)].map((_, i) => interpolate((1 / step) * i));\n}\n\nexport function IsFlatTracks(_: SingleView): _ is FlatTracks {\n return !('alignment' in _) && !_.tracks.find(d => (d as any).alignment === 'overlay' || 'tracks' in d);\n}\nexport function IsOverlaidTracks(_: SingleView): _ is OverlaidTracks {\n return 'alignment' in _ && _.alignment === 'overlay';\n}\nexport function IsStackedTracks(_: SingleView): _ is StackedTracks {\n return !IsFlatTracks(_) && !IsOverlaidTracks(_);\n}\n\nexport function IsDataTrack(_: Track): _ is DataTrack {\n // !!! Track might not contain `mark` when it is superposed one\n return !IsOverlaidTrack(_) && 'data' in _ && !('mark' in _);\n}\nexport function IsDummyTrack(_: Track): _ is DummyTrack {\n return 'type' in _ && _.type == 'dummy-track';\n}\n\nexport function IsDataTemplate(_: Partial): boolean {\n return !!('data' in _ && 'overrideTemplate' in _ && _.overrideTemplate);\n}\n\nexport function IsDataDeep(data: DataDeep | Datum[]): data is DataDeep {\n return typeof data === 'object';\n}\n\nexport function IsDomainFlat(domain: Domain): domain is string[] | number[] {\n return Array.isArray(domain);\n}\n\nexport function IsDomainChr(domain: Domain): domain is DomainChr {\n return 'chromosome' in domain && !('interval' in domain);\n}\n\nexport function IsDomainInterval(domain: Domain): domain is DomainInterval {\n return !('chromosome' in domain) && 'interval' in domain;\n}\n\nexport function IsDomainChrInterval(domain: Domain): domain is DomainChrInterval {\n return 'chromosome' in domain && 'interval' in domain;\n}\n\nexport function IsTrackStyle(track: Style | undefined): track is Style {\n return track !== undefined;\n}\n\nexport function IsSingleTrack(track: Track): track is SingleTrack {\n return !('_overlay' in track);\n}\n\nexport function IsOverlaidTrack(track: Partial): track is OverlaidTrack {\n return '_overlay' in track;\n}\n\nexport function IsTemplateTrack(track: Partial): track is TemplateTrack {\n return 'template' in track;\n}\n\n/**\n * Is this a vertical rule, i.e., y genomic axis?\n */\nexport function IsVerticalRule(track: Track) {\n return IsSingleTrack(track) && !IsChannelDeep(track.x) && IsChannelDeep(track.y) && track.y.type === 'genomic';\n}\n\n/**\n * Is this 2D track, i.e., two genomic axes?\n */\nexport function Is2DTrack(track: Track) {\n // If this is an overlaid tracks (e.g., matrix w/ rules),\n // we use the first `SingleTrack` to check the type of two axes.\n const t = IsSingleTrack(track) ? track : resolveSuperposedTracks(track)[0];\n return IsChannelDeep(t.x) && t.x.type === 'genomic' && IsChannelDeep(t.y) && t.y.type === 'genomic';\n}\n\n/**\n * Do we want to use HiGlass matrix track (i.e., 'heatmap') to rendering the given visualization?\n */\nexport function IsHiGlassMatrix(track: SingleTrack) {\n return (\n Is2DTrack(track) &&\n track.data.type === 'matrix' &&\n (track.mark === 'bar' || track.mark === 'rect') &&\n track.xe &&\n track.ye\n );\n}\n\nexport function IsChannelValue(channel: ChannelDeep | ChannelValue | undefined | 'none'): channel is ChannelValue {\n return channel !== null && typeof channel === 'object' && 'value' in channel;\n}\n\nexport function IsDataDeepTileset(\n _: DataDeep | undefined\n): _ is BeddbData | VectorData | MultivecData | BigWigData | BamData | MatrixData {\n return (\n _ !== undefined &&\n (_.type === 'vector' ||\n _.type === 'beddb' ||\n _.type === 'multivec' ||\n _.type === 'bigwig' ||\n _.type === 'matrix' ||\n _.type === 'bam' ||\n _.type === 'vcf' ||\n _.type === 'gff' ||\n _.type === 'bed')\n );\n}\n\n/**\n * Checks if a channel is of type ChannelDeep\n */\nexport function IsChannelDeep(channel: ChannelDeep | ChannelValue | undefined): channel is ChannelDeep {\n return isObject(channel) && !('value' in channel);\n}\n\nexport function IsOneOfFilter(_: FilterTransform): _ is OneOfFilter {\n return 'oneOf' in _;\n}\n\nexport function IsRangeFilter(_: FilterTransform): _ is RangeFilter {\n return 'inRange' in _;\n}\n\nexport function IsIncludeFilter(_: FilterTransform): _ is IncludeFilter {\n return 'include' in _;\n}\n\n/**\n * Check whether domain is in array shape.\n */\nexport function IsDomainArray(domain?: Domain): domain is string[] | number[] {\n return Array.isArray(domain);\n}\n\n/**\n * Check whether range is in array shape.\n */\nexport function IsRangeArray(range?: Range): range is string[] | number[] {\n return Array.isArray(range);\n}\n\n// TODO: perhaps, combine this with `isStackedChannel`\n/**\n * Check whether visual marks can be stacked on top of each other.\n */\nexport function IsStackedMark(track: SingleTrack): boolean {\n return (\n (track.mark === 'bar' || track.mark === 'area' || track.mark === 'text') &&\n IsChannelDeep(track.color) &&\n track.color.type === 'nominal' &&\n (!track.row || IsChannelValue(track.row)) &&\n // TODO: determine whether to use stacked bar for nominal fields or not\n IsChannelDeep(track.y) &&\n track.y.type === 'quantitative' &&\n !IsChannelDeep(track.ye)\n );\n}\n\n/**\n * Check whether visual marks in this channel are stacked on top of each other.\n * For example, `area` marks with a `quantitative` `y` channel are being stacked.\n */\nexport function IsStackedChannel(track: SingleTrack, channelKey: keyof typeof ChannelTypes): boolean {\n const channel = track[channelKey];\n return (\n IsStackedMark(track) &&\n // only x or y channel can be stacked\n (channelKey === 'x' || channelKey === 'y') &&\n // only quantitative channel can be stacked\n IsChannelDeep(channel) &&\n channel.type === 'quantitative'\n );\n}\n\n/**\n * Retreive value using a `channel`.\n * `undefined` if unable to retreive the value.\n */\nexport function getValueUsingChannel(datum: { [k: string]: string | number }, channel: Channel) {\n if (IsChannelDeep(channel) && channel.field) {\n return datum[channel?.field];\n }\n return undefined;\n}\n\nexport function getChannelKeysByAggregateFnc(spec: SingleTrack) {\n const keys: (keyof typeof ChannelTypes)[] = [];\n SUPPORTED_CHANNELS.forEach(k => {\n const c = spec[k];\n if (IsChannelDeep(c) && 'aggregate' in c) {\n keys.push(k);\n }\n });\n return keys;\n}\n\n/**\n * Get channel keys by a field type.\n */\nexport function getChannelKeysByType(spec: SingleTrack, t: FieldType) {\n const keys: (keyof typeof ChannelTypes)[] = [];\n SUPPORTED_CHANNELS.forEach(k => {\n const c = spec[k];\n if (IsChannelDeep(c) && c.type === t) {\n keys.push(k);\n }\n });\n return keys;\n}\n\nexport function IsXAxis(_: Track) {\n if ((IsSingleTrack(_) || IsOverlaidTrack(_)) && IsChannelDeep(_.x) && _.x.axis && _.x.axis !== 'none') {\n return true;\n } else if (IsOverlaidTrack(_)) {\n let isFound = false;\n _._overlay.forEach(t => {\n if (isFound) return;\n\n if (IsChannelDeep(t.x) && t.x.axis && t.x.axis !== 'none') {\n isFound = true;\n }\n });\n return isFound;\n }\n return false;\n}\n\nexport function IsYAxis(_: Track) {\n if ((IsSingleTrack(_) || IsOverlaidTrack(_)) && IsChannelDeep(_.y) && _.y.axis && _.y.axis !== 'none') {\n return true;\n } else if (IsOverlaidTrack(_)) {\n let isFound = false;\n _._overlay.forEach(t => {\n if (isFound) return;\n\n if (IsChannelDeep(t.y) && t.y.axis && t.y.axis !== 'none') {\n isFound = true;\n }\n });\n return isFound;\n }\n return false;\n}\n\n/* ----------------------------- MOUSE EVENT ----------------------------- */\n\nexport function IsMouseEventsDeep(_?: boolean | MouseEventsDeep): _ is MouseEventsDeep {\n return typeof _ === 'object';\n}\n","/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */\n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n\ttypeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t(factory((global.URI = global.URI || {})));\n}(this, (function (exports) { 'use strict';\n\nfunction merge() {\n for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {\n sets[_key] = arguments[_key];\n }\n\n if (sets.length > 1) {\n sets[0] = sets[0].slice(0, -1);\n var xl = sets.length - 1;\n for (var x = 1; x < xl; ++x) {\n sets[x] = sets[x].slice(1, -1);\n }\n sets[xl] = sets[xl].slice(1);\n return sets.join('');\n } else {\n return sets[0];\n }\n}\nfunction subexp(str) {\n return \"(?:\" + str + \")\";\n}\nfunction typeOf(o) {\n return o === undefined ? \"undefined\" : o === null ? \"null\" : Object.prototype.toString.call(o).split(\" \").pop().split(\"]\").shift().toLowerCase();\n}\nfunction toUpperCase(str) {\n return str.toUpperCase();\n}\nfunction toArray(obj) {\n return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== \"number\" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : [];\n}\nfunction assign(target, source) {\n var obj = target;\n if (source) {\n for (var key in source) {\n obj[key] = source[key];\n }\n }\n return obj;\n}\n\nfunction buildExps(isIRI) {\n var ALPHA$$ = \"[A-Za-z]\",\n CR$ = \"[\\\\x0D]\",\n DIGIT$$ = \"[0-9]\",\n DQUOTE$$ = \"[\\\\x22]\",\n HEXDIG$$ = merge(DIGIT$$, \"[A-Fa-f]\"),\n //case-insensitive\n LF$$ = \"[\\\\x0A]\",\n SP$$ = \"[\\\\x20]\",\n PCT_ENCODED$ = subexp(subexp(\"%[EFef]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%[89A-Fa-f]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%\" + HEXDIG$$ + HEXDIG$$)),\n //expanded\n GEN_DELIMS$$ = \"[\\\\:\\\\/\\\\?\\\\#\\\\[\\\\]\\\\@]\",\n SUB_DELIMS$$ = \"[\\\\!\\\\$\\\\&\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\;\\\\=]\",\n RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),\n UCSCHAR$$ = isIRI ? \"[\\\\xA0-\\\\u200D\\\\u2010-\\\\u2029\\\\u202F-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFEF]\" : \"[]\",\n //subset, excludes bidi control characters\n IPRIVATE$$ = isIRI ? \"[\\\\uE000-\\\\uF8FF]\" : \"[]\",\n //subset\n UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, \"[\\\\-\\\\.\\\\_\\\\~]\", UCSCHAR$$),\n SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, \"[\\\\+\\\\-\\\\.]\") + \"*\"),\n USERINFO$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:]\")) + \"*\"),\n DEC_OCTET$ = subexp(subexp(\"25[0-5]\") + \"|\" + subexp(\"2[0-4]\" + DIGIT$$) + \"|\" + subexp(\"1\" + DIGIT$$ + DIGIT$$) + \"|\" + subexp(\"[1-9]\" + DIGIT$$) + \"|\" + DIGIT$$),\n DEC_OCTET_RELAXED$ = subexp(subexp(\"25[0-5]\") + \"|\" + subexp(\"2[0-4]\" + DIGIT$$) + \"|\" + subexp(\"1\" + DIGIT$$ + DIGIT$$) + \"|\" + subexp(\"0?[1-9]\" + DIGIT$$) + \"|0?0?\" + DIGIT$$),\n //relaxed parsing rules\n IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$),\n H16$ = subexp(HEXDIG$$ + \"{1,4}\"),\n LS32$ = subexp(subexp(H16$ + \"\\\\:\" + H16$) + \"|\" + IPV4ADDRESS$),\n IPV6ADDRESS1$ = subexp(subexp(H16$ + \"\\\\:\") + \"{6}\" + LS32$),\n // 6( h16 \":\" ) ls32\n IPV6ADDRESS2$ = subexp(\"\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{5}\" + LS32$),\n // \"::\" 5( h16 \":\" ) ls32\n IPV6ADDRESS3$ = subexp(subexp(H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{4}\" + LS32$),\n //[ h16 ] \"::\" 4( h16 \":\" ) ls32\n IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,1}\" + H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{3}\" + LS32$),\n //[ *1( h16 \":\" ) h16 ] \"::\" 3( h16 \":\" ) ls32\n IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,2}\" + H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{2}\" + LS32$),\n //[ *2( h16 \":\" ) h16 ] \"::\" 2( h16 \":\" ) ls32\n IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,3}\" + H16$) + \"?\\\\:\\\\:\" + H16$ + \"\\\\:\" + LS32$),\n //[ *3( h16 \":\" ) h16 ] \"::\" h16 \":\" ls32\n IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,4}\" + H16$) + \"?\\\\:\\\\:\" + LS32$),\n //[ *4( h16 \":\" ) h16 ] \"::\" ls32\n IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,5}\" + H16$) + \"?\\\\:\\\\:\" + H16$),\n //[ *5( h16 \":\" ) h16 ] \"::\" h16\n IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,6}\" + H16$) + \"?\\\\:\\\\:\"),\n //[ *6( h16 \":\" ) h16 ] \"::\"\n IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join(\"|\")),\n ZONEID$ = subexp(subexp(UNRESERVED$$ + \"|\" + PCT_ENCODED$) + \"+\"),\n //RFC 6874\n IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + \"\\\\%25\" + ZONEID$),\n //RFC 6874\n IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp(\"\\\\%25|\\\\%(?!\" + HEXDIG$$ + \"{2})\") + ZONEID$),\n //RFC 6874, with relaxed parsing rules\n IPVFUTURE$ = subexp(\"[vV]\" + HEXDIG$$ + \"+\\\\.\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:]\") + \"+\"),\n IP_LITERAL$ = subexp(\"\\\\[\" + subexp(IPV6ADDRZ_RELAXED$ + \"|\" + IPV6ADDRESS$ + \"|\" + IPVFUTURE$) + \"\\\\]\"),\n //RFC 6874\n REG_NAME$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$)) + \"*\"),\n HOST$ = subexp(IP_LITERAL$ + \"|\" + IPV4ADDRESS$ + \"(?!\" + REG_NAME$ + \")\" + \"|\" + REG_NAME$),\n PORT$ = subexp(DIGIT$$ + \"*\"),\n AUTHORITY$ = subexp(subexp(USERINFO$ + \"@\") + \"?\" + HOST$ + subexp(\"\\\\:\" + PORT$) + \"?\"),\n PCHAR$ = subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@]\")),\n SEGMENT$ = subexp(PCHAR$ + \"*\"),\n SEGMENT_NZ$ = subexp(PCHAR$ + \"+\"),\n SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\@]\")) + \"+\"),\n PATH_ABEMPTY$ = subexp(subexp(\"\\\\/\" + SEGMENT$) + \"*\"),\n PATH_ABSOLUTE$ = subexp(\"\\\\/\" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + \"?\"),\n //simplified\n PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$),\n //simplified\n PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$),\n //simplified\n PATH_EMPTY$ = \"(?!\" + PCHAR$ + \")\",\n PATH$ = subexp(PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$),\n QUERY$ = subexp(subexp(PCHAR$ + \"|\" + merge(\"[\\\\/\\\\?]\", IPRIVATE$$)) + \"*\"),\n FRAGMENT$ = subexp(subexp(PCHAR$ + \"|[\\\\/\\\\?]\") + \"*\"),\n HIER_PART$ = subexp(subexp(\"\\\\/\\\\/\" + AUTHORITY$ + PATH_ABEMPTY$) + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$),\n URI$ = subexp(SCHEME$ + \"\\\\:\" + HIER_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\" + subexp(\"\\\\#\" + FRAGMENT$) + \"?\"),\n RELATIVE_PART$ = subexp(subexp(\"\\\\/\\\\/\" + AUTHORITY$ + PATH_ABEMPTY$) + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_EMPTY$),\n RELATIVE$ = subexp(RELATIVE_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\" + subexp(\"\\\\#\" + FRAGMENT$) + \"?\"),\n URI_REFERENCE$ = subexp(URI$ + \"|\" + RELATIVE$),\n ABSOLUTE_URI$ = subexp(SCHEME$ + \"\\\\:\" + HIER_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\"),\n GENERIC_REF$ = \"^(\" + SCHEME$ + \")\\\\:\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n RELATIVE_REF$ = \"^(){0}\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n ABSOLUTE_REF$ = \"^(\" + SCHEME$ + \")\\\\:\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?$\",\n SAMEDOC_REF$ = \"^\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n AUTHORITY_REF$ = \"^\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?$\";\n return {\n NOT_SCHEME: new RegExp(merge(\"[^]\", ALPHA$$, DIGIT$$, \"[\\\\+\\\\-\\\\.]\"), \"g\"),\n NOT_USERINFO: new RegExp(merge(\"[^\\\\%\\\\:]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n NOT_HOST: new RegExp(merge(\"[^\\\\%\\\\[\\\\]\\\\:]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n NOT_PATH: new RegExp(merge(\"[^\\\\%\\\\/\\\\:\\\\@]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n NOT_PATH_NOSCHEME: new RegExp(merge(\"[^\\\\%\\\\/\\\\@]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n NOT_QUERY: new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@\\\\/\\\\?]\", IPRIVATE$$), \"g\"),\n NOT_FRAGMENT: new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@\\\\/\\\\?]\"), \"g\"),\n ESCAPE: new RegExp(merge(\"[^]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n UNRESERVED: new RegExp(UNRESERVED$$, \"g\"),\n OTHER_CHARS: new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, RESERVED$$), \"g\"),\n PCT_ENCODED: new RegExp(PCT_ENCODED$, \"g\"),\n IPV4ADDRESS: new RegExp(\"^(\" + IPV4ADDRESS$ + \")$\"),\n IPV6ADDRESS: new RegExp(\"^\\\\[?(\" + IPV6ADDRESS$ + \")\" + subexp(subexp(\"\\\\%25|\\\\%(?!\" + HEXDIG$$ + \"{2})\") + \"(\" + ZONEID$ + \")\") + \"?\\\\]?$\") //RFC 6874, with relaxed parsing rules\n };\n}\nvar URI_PROTOCOL = buildExps(false);\n\nvar IRI_PROTOCOL = buildExps(true);\n\nvar slicedToArray = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n}();\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar toConsumableArray = function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n};\n\n/** Highest positive signed 32-bit float value */\n\nvar maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\n\n/** Bootstring parameters */\nvar base = 36;\nvar tMin = 1;\nvar tMax = 26;\nvar skew = 38;\nvar damp = 700;\nvar initialBias = 72;\nvar initialN = 128; // 0x80\nvar delimiter = '-'; // '\\x2D'\n\n/** Regular expressions */\nvar regexPunycode = /^xn--/;\nvar regexNonASCII = /[^\\0-\\x7E]/; // non-ASCII chars\nvar regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\n\n/** Error messages */\nvar errors = {\n\t'overflow': 'Overflow: input needs wider integers to process',\n\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t'invalid-input': 'Invalid input'\n};\n\n/** Convenience shortcuts */\nvar baseMinusTMin = base - tMin;\nvar floor = Math.floor;\nvar stringFromCharCode = String.fromCharCode;\n\n/*--------------------------------------------------------------------------*/\n\n/**\n * A generic error utility function.\n * @private\n * @param {String} type The error type.\n * @returns {Error} Throws a `RangeError` with the applicable error message.\n */\nfunction error$1(type) {\n\tthrow new RangeError(errors[type]);\n}\n\n/**\n * A generic `Array#map` utility function.\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} callback The function that gets called for every array\n * item.\n * @returns {Array} A new array of values returned by the callback function.\n */\nfunction map(array, fn) {\n\tvar result = [];\n\tvar length = array.length;\n\twhile (length--) {\n\t\tresult[length] = fn(array[length]);\n\t}\n\treturn result;\n}\n\n/**\n * A simple `Array#map`-like wrapper to work with domain name strings or email\n * addresses.\n * @private\n * @param {String} domain The domain name or email address.\n * @param {Function} callback The function that gets called for every\n * character.\n * @returns {Array} A new string of characters returned by the callback\n * function.\n */\nfunction mapDomain(string, fn) {\n\tvar parts = string.split('@');\n\tvar result = '';\n\tif (parts.length > 1) {\n\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t// the local part (i.e. everything up to `@`) intact.\n\t\tresult = parts[0] + '@';\n\t\tstring = parts[1];\n\t}\n\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\tstring = string.replace(regexSeparators, '\\x2E');\n\tvar labels = string.split('.');\n\tvar encoded = map(labels, fn).join('.');\n\treturn result + encoded;\n}\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n * @see `punycode.ucs2.encode`\n * @see \n * @memberOf punycode.ucs2\n * @name decode\n * @param {String} string The Unicode input string (UCS-2).\n * @returns {Array} The new array of code points.\n */\nfunction ucs2decode(string) {\n\tvar output = [];\n\tvar counter = 0;\n\tvar length = string.length;\n\twhile (counter < length) {\n\t\tvar value = string.charCodeAt(counter++);\n\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t// It's a high surrogate, and there is a next character.\n\t\t\tvar extra = string.charCodeAt(counter++);\n\t\t\tif ((extra & 0xFC00) == 0xDC00) {\n\t\t\t\t// Low surrogate.\n\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t} else {\n\t\t\t\t// It's an unmatched surrogate; only append this code unit, in case the\n\t\t\t\t// next code unit is the high surrogate of a surrogate pair.\n\t\t\t\toutput.push(value);\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t} else {\n\t\t\toutput.push(value);\n\t\t}\n\t}\n\treturn output;\n}\n\n/**\n * Creates a string based on an array of numeric code points.\n * @see `punycode.ucs2.decode`\n * @memberOf punycode.ucs2\n * @name encode\n * @param {Array} codePoints The array of numeric code points.\n * @returns {String} The new Unicode string (UCS-2).\n */\nvar ucs2encode = function ucs2encode(array) {\n\treturn String.fromCodePoint.apply(String, toConsumableArray(array));\n};\n\n/**\n * Converts a basic code point into a digit/integer.\n * @see `digitToBasic()`\n * @private\n * @param {Number} codePoint The basic numeric code point value.\n * @returns {Number} The numeric value of a basic code point (for use in\n * representing integers) in the range `0` to `base - 1`, or `base` if\n * the code point does not represent a value.\n */\nvar basicToDigit = function basicToDigit(codePoint) {\n\tif (codePoint - 0x30 < 0x0A) {\n\t\treturn codePoint - 0x16;\n\t}\n\tif (codePoint - 0x41 < 0x1A) {\n\t\treturn codePoint - 0x41;\n\t}\n\tif (codePoint - 0x61 < 0x1A) {\n\t\treturn codePoint - 0x61;\n\t}\n\treturn base;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n * @see `basicToDigit()`\n * @private\n * @param {Number} digit The numeric value of a basic code point.\n * @returns {Number} The basic code point whose value (when used for\n * representing integers) is `digit`, which needs to be in the range\n * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n * used; else, the lowercase form is used. The behavior is undefined\n * if `flag` is non-zero and `digit` has no uppercase form.\n */\nvar digitToBasic = function digitToBasic(digit, flag) {\n\t// 0..25 map to ASCII a..z or A..Z\n\t// 26..35 map to ASCII 0..9\n\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n * @private\n */\nvar adapt = function adapt(delta, numPoints, firstTime) {\n\tvar k = 0;\n\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\tdelta += floor(delta / numPoints);\n\tfor (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\tdelta = floor(delta / baseMinusTMin);\n\t}\n\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n};\n\n/**\n * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n * symbols.\n * @memberOf punycode\n * @param {String} input The Punycode string of ASCII-only symbols.\n * @returns {String} The resulting string of Unicode symbols.\n */\nvar decode = function decode(input) {\n\t// Don't use UCS-2.\n\tvar output = [];\n\tvar inputLength = input.length;\n\tvar i = 0;\n\tvar n = initialN;\n\tvar bias = initialBias;\n\n\t// Handle the basic code points: let `basic` be the number of input code\n\t// points before the last delimiter, or `0` if there is none, then copy\n\t// the first basic code points to the output.\n\n\tvar basic = input.lastIndexOf(delimiter);\n\tif (basic < 0) {\n\t\tbasic = 0;\n\t}\n\n\tfor (var j = 0; j < basic; ++j) {\n\t\t// if it's not a basic code point\n\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\terror$1('not-basic');\n\t\t}\n\t\toutput.push(input.charCodeAt(j));\n\t}\n\n\t// Main decoding loop: start just after the last delimiter if any basic code\n\t// points were copied; start at the beginning otherwise.\n\n\tfor (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{\n\n\t\t// `index` is the index of the next character to be consumed.\n\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t// which gets added to `i`. The overflow checking is easier\n\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t// value at the end to obtain `delta`.\n\t\tvar oldi = i;\n\t\tfor (var w = 1, k = base;; /* no condition */k += base) {\n\n\t\t\tif (index >= inputLength) {\n\t\t\t\terror$1('invalid-input');\n\t\t\t}\n\n\t\t\tvar digit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\terror$1('overflow');\n\t\t\t}\n\n\t\t\ti += digit * w;\n\t\t\tvar t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n\n\t\t\tif (digit < t) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tvar baseMinusT = base - t;\n\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\terror$1('overflow');\n\t\t\t}\n\n\t\t\tw *= baseMinusT;\n\t\t}\n\n\t\tvar out = output.length + 1;\n\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t// incrementing `n` each time, so we'll fix that now:\n\t\tif (floor(i / out) > maxInt - n) {\n\t\t\terror$1('overflow');\n\t\t}\n\n\t\tn += floor(i / out);\n\t\ti %= out;\n\n\t\t// Insert `n` at position `i` of the output.\n\t\toutput.splice(i++, 0, n);\n\t}\n\n\treturn String.fromCodePoint.apply(String, output);\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n * @memberOf punycode\n * @param {String} input The string of Unicode symbols.\n * @returns {String} The resulting Punycode string of ASCII-only symbols.\n */\nvar encode = function encode(input) {\n\tvar output = [];\n\n\t// Convert the input in UCS-2 to an array of Unicode code points.\n\tinput = ucs2decode(input);\n\n\t// Cache the length.\n\tvar inputLength = input.length;\n\n\t// Initialize the state.\n\tvar n = initialN;\n\tvar delta = 0;\n\tvar bias = initialBias;\n\n\t// Handle the basic code points.\n\tvar _iteratorNormalCompletion = true;\n\tvar _didIteratorError = false;\n\tvar _iteratorError = undefined;\n\n\ttry {\n\t\tfor (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\tvar _currentValue2 = _step.value;\n\n\t\t\tif (_currentValue2 < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(_currentValue2));\n\t\t\t}\n\t\t}\n\t} catch (err) {\n\t\t_didIteratorError = true;\n\t\t_iteratorError = err;\n\t} finally {\n\t\ttry {\n\t\t\tif (!_iteratorNormalCompletion && _iterator.return) {\n\t\t\t\t_iterator.return();\n\t\t\t}\n\t\t} finally {\n\t\t\tif (_didIteratorError) {\n\t\t\t\tthrow _iteratorError;\n\t\t\t}\n\t\t}\n\t}\n\n\tvar basicLength = output.length;\n\tvar handledCPCount = basicLength;\n\n\t// `handledCPCount` is the number of code points that have been handled;\n\t// `basicLength` is the number of basic code points.\n\n\t// Finish the basic string with a delimiter unless it's empty.\n\tif (basicLength) {\n\t\toutput.push(delimiter);\n\t}\n\n\t// Main encoding loop:\n\twhile (handledCPCount < inputLength) {\n\n\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t// larger one:\n\t\tvar m = maxInt;\n\t\tvar _iteratorNormalCompletion2 = true;\n\t\tvar _didIteratorError2 = false;\n\t\tvar _iteratorError2 = undefined;\n\n\t\ttry {\n\t\t\tfor (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n\t\t\t\tvar currentValue = _step2.value;\n\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow.\n\t\t} catch (err) {\n\t\t\t_didIteratorError2 = true;\n\t\t\t_iteratorError2 = err;\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (!_iteratorNormalCompletion2 && _iterator2.return) {\n\t\t\t\t\t_iterator2.return();\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tif (_didIteratorError2) {\n\t\t\t\t\tthrow _iteratorError2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar handledCPCountPlusOne = handledCPCount + 1;\n\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\terror$1('overflow');\n\t\t}\n\n\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\tn = m;\n\n\t\tvar _iteratorNormalCompletion3 = true;\n\t\tvar _didIteratorError3 = false;\n\t\tvar _iteratorError3 = undefined;\n\n\t\ttry {\n\t\t\tfor (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n\t\t\t\tvar _currentValue = _step3.value;\n\n\t\t\t\tif (_currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror$1('overflow');\n\t\t\t\t}\n\t\t\t\tif (_currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer.\n\t\t\t\t\tvar q = delta;\n\t\t\t\t\tfor (var k = base;; /* no condition */k += base) {\n\t\t\t\t\t\tvar t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar qMinusT = q - t;\n\t\t\t\t\t\tvar baseMinusT = base - t;\n\t\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t_didIteratorError3 = true;\n\t\t\t_iteratorError3 = err;\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (!_iteratorNormalCompletion3 && _iterator3.return) {\n\t\t\t\t\t_iterator3.return();\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tif (_didIteratorError3) {\n\t\t\t\t\tthrow _iteratorError3;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t++delta;\n\t\t++n;\n\t}\n\treturn output.join('');\n};\n\n/**\n * Converts a Punycode string representing a domain name or an email address\n * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n * it doesn't matter if you call it on a string that has already been\n * converted to Unicode.\n * @memberOf punycode\n * @param {String} input The Punycoded domain name or email address to\n * convert to Unicode.\n * @returns {String} The Unicode representation of the given Punycode\n * string.\n */\nvar toUnicode = function toUnicode(input) {\n\treturn mapDomain(input, function (string) {\n\t\treturn regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;\n\t});\n};\n\n/**\n * Converts a Unicode string representing a domain name or an email address to\n * Punycode. Only the non-ASCII parts of the domain name will be converted,\n * i.e. it doesn't matter if you call it with a domain that's already in\n * ASCII.\n * @memberOf punycode\n * @param {String} input The domain name or email address to convert, as a\n * Unicode string.\n * @returns {String} The Punycode representation of the given domain name or\n * email address.\n */\nvar toASCII = function toASCII(input) {\n\treturn mapDomain(input, function (string) {\n\t\treturn regexNonASCII.test(string) ? 'xn--' + encode(string) : string;\n\t});\n};\n\n/*--------------------------------------------------------------------------*/\n\n/** Define the public API */\nvar punycode = {\n\t/**\n * A string representing the current Punycode.js version number.\n * @memberOf punycode\n * @type String\n */\n\t'version': '2.1.0',\n\t/**\n * An object of methods to convert from JavaScript's internal character\n * representation (UCS-2) to Unicode code points, and back.\n * @see \n * @memberOf punycode\n * @type Object\n */\n\t'ucs2': {\n\t\t'decode': ucs2decode,\n\t\t'encode': ucs2encode\n\t},\n\t'decode': decode,\n\t'encode': encode,\n\t'toASCII': toASCII,\n\t'toUnicode': toUnicode\n};\n\n/**\n * URI.js\n *\n * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.\n * @author Gary Court\n * @see http://github.com/garycourt/uri-js\n */\n/**\n * Copyright 2011 Gary Court. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification, are\n * permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this list of\n * conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice, this list\n * of conditions and the following disclaimer in the documentation and/or other materials\n * provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED\n * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * The views and conclusions contained in the software and documentation are those of the\n * authors and should not be interpreted as representing official policies, either expressed\n * or implied, of Gary Court.\n */\nvar SCHEMES = {};\nfunction pctEncChar(chr) {\n var c = chr.charCodeAt(0);\n var e = void 0;\n if (c < 16) e = \"%0\" + c.toString(16).toUpperCase();else if (c < 128) e = \"%\" + c.toString(16).toUpperCase();else if (c < 2048) e = \"%\" + (c >> 6 | 192).toString(16).toUpperCase() + \"%\" + (c & 63 | 128).toString(16).toUpperCase();else e = \"%\" + (c >> 12 | 224).toString(16).toUpperCase() + \"%\" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + \"%\" + (c & 63 | 128).toString(16).toUpperCase();\n return e;\n}\nfunction pctDecChars(str) {\n var newStr = \"\";\n var i = 0;\n var il = str.length;\n while (i < il) {\n var c = parseInt(str.substr(i + 1, 2), 16);\n if (c < 128) {\n newStr += String.fromCharCode(c);\n i += 3;\n } else if (c >= 194 && c < 224) {\n if (il - i >= 6) {\n var c2 = parseInt(str.substr(i + 4, 2), 16);\n newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);\n } else {\n newStr += str.substr(i, 6);\n }\n i += 6;\n } else if (c >= 224) {\n if (il - i >= 9) {\n var _c = parseInt(str.substr(i + 4, 2), 16);\n var c3 = parseInt(str.substr(i + 7, 2), 16);\n newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);\n } else {\n newStr += str.substr(i, 9);\n }\n i += 9;\n } else {\n newStr += str.substr(i, 3);\n i += 3;\n }\n }\n return newStr;\n}\nfunction _normalizeComponentEncoding(components, protocol) {\n function decodeUnreserved(str) {\n var decStr = pctDecChars(str);\n return !decStr.match(protocol.UNRESERVED) ? str : decStr;\n }\n if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, \"\");\n if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n return components;\n}\n\nfunction _stripLeadingZeros(str) {\n return str.replace(/^0*(.*)/, \"$1\") || \"0\";\n}\nfunction _normalizeIPv4(host, protocol) {\n var matches = host.match(protocol.IPV4ADDRESS) || [];\n\n var _matches = slicedToArray(matches, 2),\n address = _matches[1];\n\n if (address) {\n return address.split(\".\").map(_stripLeadingZeros).join(\".\");\n } else {\n return host;\n }\n}\nfunction _normalizeIPv6(host, protocol) {\n var matches = host.match(protocol.IPV6ADDRESS) || [];\n\n var _matches2 = slicedToArray(matches, 3),\n address = _matches2[1],\n zone = _matches2[2];\n\n if (address) {\n var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),\n _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),\n last = _address$toLowerCase$2[0],\n first = _address$toLowerCase$2[1];\n\n var firstFields = first ? first.split(\":\").map(_stripLeadingZeros) : [];\n var lastFields = last.split(\":\").map(_stripLeadingZeros);\n var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);\n var fieldCount = isLastFieldIPv4Address ? 7 : 8;\n var lastFieldsStart = lastFields.length - fieldCount;\n var fields = Array(fieldCount);\n for (var x = 0; x < fieldCount; ++x) {\n fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';\n }\n if (isLastFieldIPv4Address) {\n fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);\n }\n var allZeroFields = fields.reduce(function (acc, field, index) {\n if (!field || field === \"0\") {\n var lastLongest = acc[acc.length - 1];\n if (lastLongest && lastLongest.index + lastLongest.length === index) {\n lastLongest.length++;\n } else {\n acc.push({ index: index, length: 1 });\n }\n }\n return acc;\n }, []);\n var longestZeroFields = allZeroFields.sort(function (a, b) {\n return b.length - a.length;\n })[0];\n var newHost = void 0;\n if (longestZeroFields && longestZeroFields.length > 1) {\n var newFirst = fields.slice(0, longestZeroFields.index);\n var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);\n newHost = newFirst.join(\":\") + \"::\" + newLast.join(\":\");\n } else {\n newHost = fields.join(\":\");\n }\n if (zone) {\n newHost += \"%\" + zone;\n }\n return newHost;\n } else {\n return host;\n }\n}\nvar URI_PARSE = /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:([^\\/?#@]*)@)?(\\[[^\\/?#\\]]+\\]|[^\\/?#:]*)(?:\\:(\\d*))?))?([^?#]*)(?:\\?([^#]*))?(?:#((?:.|\\n|\\r)*))?/i;\nvar NO_MATCH_IS_UNDEFINED = \"\".match(/(){0}/)[1] === undefined;\nfunction parse(uriString) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var components = {};\n var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;\n if (options.reference === \"suffix\") uriString = (options.scheme ? options.scheme + \":\" : \"\") + \"//\" + uriString;\n var matches = uriString.match(URI_PARSE);\n if (matches) {\n if (NO_MATCH_IS_UNDEFINED) {\n //store each component\n components.scheme = matches[1];\n components.userinfo = matches[3];\n components.host = matches[4];\n components.port = parseInt(matches[5], 10);\n components.path = matches[6] || \"\";\n components.query = matches[7];\n components.fragment = matches[8];\n //fix port number\n if (isNaN(components.port)) {\n components.port = matches[5];\n }\n } else {\n //IE FIX for improper RegExp matching\n //store each component\n components.scheme = matches[1] || undefined;\n components.userinfo = uriString.indexOf(\"@\") !== -1 ? matches[3] : undefined;\n components.host = uriString.indexOf(\"//\") !== -1 ? matches[4] : undefined;\n components.port = parseInt(matches[5], 10);\n components.path = matches[6] || \"\";\n components.query = uriString.indexOf(\"?\") !== -1 ? matches[7] : undefined;\n components.fragment = uriString.indexOf(\"#\") !== -1 ? matches[8] : undefined;\n //fix port number\n if (isNaN(components.port)) {\n components.port = uriString.match(/\\/\\/(?:.|\\n)*\\:(?:\\/|\\?|\\#|$)/) ? matches[4] : undefined;\n }\n }\n if (components.host) {\n //normalize IP hosts\n components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);\n }\n //determine reference type\n if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {\n components.reference = \"same-document\";\n } else if (components.scheme === undefined) {\n components.reference = \"relative\";\n } else if (components.fragment === undefined) {\n components.reference = \"absolute\";\n } else {\n components.reference = \"uri\";\n }\n //check for reference errors\n if (options.reference && options.reference !== \"suffix\" && options.reference !== components.reference) {\n components.error = components.error || \"URI is not a \" + options.reference + \" reference.\";\n }\n //find scheme handler\n var schemeHandler = SCHEMES[(options.scheme || components.scheme || \"\").toLowerCase()];\n //check if scheme can't handle IRIs\n if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {\n //if host component is a domain name\n if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {\n //convert Unicode IDN -> ASCII IDN\n try {\n components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());\n } catch (e) {\n components.error = components.error || \"Host's domain name can not be converted to ASCII via punycode: \" + e;\n }\n }\n //convert IRI -> URI\n _normalizeComponentEncoding(components, URI_PROTOCOL);\n } else {\n //normalize encodings\n _normalizeComponentEncoding(components, protocol);\n }\n //perform scheme specific parsing\n if (schemeHandler && schemeHandler.parse) {\n schemeHandler.parse(components, options);\n }\n } else {\n components.error = components.error || \"URI can not be parsed.\";\n }\n return components;\n}\n\nfunction _recomposeAuthority(components, options) {\n var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;\n var uriTokens = [];\n if (components.userinfo !== undefined) {\n uriTokens.push(components.userinfo);\n uriTokens.push(\"@\");\n }\n if (components.host !== undefined) {\n //normalize IP hosts, add brackets and escape zone separator for IPv6\n uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {\n return \"[\" + $1 + ($2 ? \"%25\" + $2 : \"\") + \"]\";\n }));\n }\n if (typeof components.port === \"number\" || typeof components.port === \"string\") {\n uriTokens.push(\":\");\n uriTokens.push(String(components.port));\n }\n return uriTokens.length ? uriTokens.join(\"\") : undefined;\n}\n\nvar RDS1 = /^\\.\\.?\\//;\nvar RDS2 = /^\\/\\.(\\/|$)/;\nvar RDS3 = /^\\/\\.\\.(\\/|$)/;\nvar RDS5 = /^\\/?(?:.|\\n)*?(?=\\/|$)/;\nfunction removeDotSegments(input) {\n var output = [];\n while (input.length) {\n if (input.match(RDS1)) {\n input = input.replace(RDS1, \"\");\n } else if (input.match(RDS2)) {\n input = input.replace(RDS2, \"/\");\n } else if (input.match(RDS3)) {\n input = input.replace(RDS3, \"/\");\n output.pop();\n } else if (input === \".\" || input === \"..\") {\n input = \"\";\n } else {\n var im = input.match(RDS5);\n if (im) {\n var s = im[0];\n input = input.slice(s.length);\n output.push(s);\n } else {\n throw new Error(\"Unexpected dot segment condition\");\n }\n }\n }\n return output.join(\"\");\n}\n\nfunction serialize(components) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;\n var uriTokens = [];\n //find scheme handler\n var schemeHandler = SCHEMES[(options.scheme || components.scheme || \"\").toLowerCase()];\n //perform scheme specific serialization\n if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);\n if (components.host) {\n //if host component is an IPv6 address\n if (protocol.IPV6ADDRESS.test(components.host)) {}\n //TODO: normalize IPv6 address as per RFC 5952\n\n //if host component is a domain name\n else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {\n //convert IDN via punycode\n try {\n components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);\n } catch (e) {\n components.error = components.error || \"Host's domain name can not be converted to \" + (!options.iri ? \"ASCII\" : \"Unicode\") + \" via punycode: \" + e;\n }\n }\n }\n //normalize encoding\n _normalizeComponentEncoding(components, protocol);\n if (options.reference !== \"suffix\" && components.scheme) {\n uriTokens.push(components.scheme);\n uriTokens.push(\":\");\n }\n var authority = _recomposeAuthority(components, options);\n if (authority !== undefined) {\n if (options.reference !== \"suffix\") {\n uriTokens.push(\"//\");\n }\n uriTokens.push(authority);\n if (components.path && components.path.charAt(0) !== \"/\") {\n uriTokens.push(\"/\");\n }\n }\n if (components.path !== undefined) {\n var s = components.path;\n if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {\n s = removeDotSegments(s);\n }\n if (authority === undefined) {\n s = s.replace(/^\\/\\//, \"/%2F\"); //don't allow the path to start with \"//\"\n }\n uriTokens.push(s);\n }\n if (components.query !== undefined) {\n uriTokens.push(\"?\");\n uriTokens.push(components.query);\n }\n if (components.fragment !== undefined) {\n uriTokens.push(\"#\");\n uriTokens.push(components.fragment);\n }\n return uriTokens.join(\"\"); //merge tokens into a string\n}\n\nfunction resolveComponents(base, relative) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var skipNormalization = arguments[3];\n\n var target = {};\n if (!skipNormalization) {\n base = parse(serialize(base, options), options); //normalize base components\n relative = parse(serialize(relative, options), options); //normalize relative components\n }\n options = options || {};\n if (!options.tolerant && relative.scheme) {\n target.scheme = relative.scheme;\n //target.authority = relative.authority;\n target.userinfo = relative.userinfo;\n target.host = relative.host;\n target.port = relative.port;\n target.path = removeDotSegments(relative.path || \"\");\n target.query = relative.query;\n } else {\n if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {\n //target.authority = relative.authority;\n target.userinfo = relative.userinfo;\n target.host = relative.host;\n target.port = relative.port;\n target.path = removeDotSegments(relative.path || \"\");\n target.query = relative.query;\n } else {\n if (!relative.path) {\n target.path = base.path;\n if (relative.query !== undefined) {\n target.query = relative.query;\n } else {\n target.query = base.query;\n }\n } else {\n if (relative.path.charAt(0) === \"/\") {\n target.path = removeDotSegments(relative.path);\n } else {\n if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {\n target.path = \"/\" + relative.path;\n } else if (!base.path) {\n target.path = relative.path;\n } else {\n target.path = base.path.slice(0, base.path.lastIndexOf(\"/\") + 1) + relative.path;\n }\n target.path = removeDotSegments(target.path);\n }\n target.query = relative.query;\n }\n //target.authority = base.authority;\n target.userinfo = base.userinfo;\n target.host = base.host;\n target.port = base.port;\n }\n target.scheme = base.scheme;\n }\n target.fragment = relative.fragment;\n return target;\n}\n\nfunction resolve(baseURI, relativeURI, options) {\n var schemelessOptions = assign({ scheme: 'null' }, options);\n return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);\n}\n\nfunction normalize(uri, options) {\n if (typeof uri === \"string\") {\n uri = serialize(parse(uri, options), options);\n } else if (typeOf(uri) === \"object\") {\n uri = parse(serialize(uri, options), options);\n }\n return uri;\n}\n\nfunction equal(uriA, uriB, options) {\n if (typeof uriA === \"string\") {\n uriA = serialize(parse(uriA, options), options);\n } else if (typeOf(uriA) === \"object\") {\n uriA = serialize(uriA, options);\n }\n if (typeof uriB === \"string\") {\n uriB = serialize(parse(uriB, options), options);\n } else if (typeOf(uriB) === \"object\") {\n uriB = serialize(uriB, options);\n }\n return uriA === uriB;\n}\n\nfunction escapeComponent(str, options) {\n return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);\n}\n\nfunction unescapeComponent(str, options) {\n return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);\n}\n\nvar handler = {\n scheme: \"http\",\n domainHost: true,\n parse: function parse(components, options) {\n //report missing host\n if (!components.host) {\n components.error = components.error || \"HTTP URIs must have a host.\";\n }\n return components;\n },\n serialize: function serialize(components, options) {\n var secure = String(components.scheme).toLowerCase() === \"https\";\n //normalize the default port\n if (components.port === (secure ? 443 : 80) || components.port === \"\") {\n components.port = undefined;\n }\n //normalize the empty path\n if (!components.path) {\n components.path = \"/\";\n }\n //NOTE: We do not parse query strings for HTTP URIs\n //as WWW Form Url Encoded query strings are part of the HTML4+ spec,\n //and not the HTTP spec.\n return components;\n }\n};\n\nvar handler$1 = {\n scheme: \"https\",\n domainHost: handler.domainHost,\n parse: handler.parse,\n serialize: handler.serialize\n};\n\nfunction isSecure(wsComponents) {\n return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === \"wss\";\n}\n//RFC 6455\nvar handler$2 = {\n scheme: \"ws\",\n domainHost: true,\n parse: function parse(components, options) {\n var wsComponents = components;\n //indicate if the secure flag is set\n wsComponents.secure = isSecure(wsComponents);\n //construct resouce name\n wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');\n wsComponents.path = undefined;\n wsComponents.query = undefined;\n return wsComponents;\n },\n serialize: function serialize(wsComponents, options) {\n //normalize the default port\n if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === \"\") {\n wsComponents.port = undefined;\n }\n //ensure scheme matches secure flag\n if (typeof wsComponents.secure === 'boolean') {\n wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';\n wsComponents.secure = undefined;\n }\n //reconstruct path from resource name\n if (wsComponents.resourceName) {\n var _wsComponents$resourc = wsComponents.resourceName.split('?'),\n _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),\n path = _wsComponents$resourc2[0],\n query = _wsComponents$resourc2[1];\n\n wsComponents.path = path && path !== '/' ? path : undefined;\n wsComponents.query = query;\n wsComponents.resourceName = undefined;\n }\n //forbid fragment component\n wsComponents.fragment = undefined;\n return wsComponents;\n }\n};\n\nvar handler$3 = {\n scheme: \"wss\",\n domainHost: handler$2.domainHost,\n parse: handler$2.parse,\n serialize: handler$2.serialize\n};\n\nvar O = {};\nvar isIRI = true;\n//RFC 3986\nvar UNRESERVED$$ = \"[A-Za-z0-9\\\\-\\\\.\\\\_\\\\~\" + (isIRI ? \"\\\\xA0-\\\\u200D\\\\u2010-\\\\u2029\\\\u202F-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFEF\" : \"\") + \"]\";\nvar HEXDIG$$ = \"[0-9A-Fa-f]\"; //case-insensitive\nvar PCT_ENCODED$ = subexp(subexp(\"%[EFef]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%[89A-Fa-f]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%\" + HEXDIG$$ + HEXDIG$$)); //expanded\n//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =\n//const ATEXT$$ = \"[A-Za-z0-9\\\\!\\\\#\\\\$\\\\%\\\\&\\\\'\\\\*\\\\+\\\\-\\\\/\\\\=\\\\?\\\\^\\\\_\\\\`\\\\{\\\\|\\\\}\\\\~]\";\n//const WSP$$ = \"[\\\\x20\\\\x09]\";\n//const OBS_QTEXT$$ = \"[\\\\x01-\\\\x08\\\\x0B\\\\x0C\\\\x0E-\\\\x1F\\\\x7F]\"; //(%d1-8 / %d11-12 / %d14-31 / %d127)\n//const QTEXT$$ = merge(\"[\\\\x21\\\\x23-\\\\x5B\\\\x5D-\\\\x7E]\", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext\n//const VCHAR$$ = \"[\\\\x21-\\\\x7E]\";\n//const WSP$$ = \"[\\\\x20\\\\x09]\";\n//const OBS_QP$ = subexp(\"\\\\\\\\\" + merge(\"[\\\\x00\\\\x0D\\\\x0A]\", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext\n//const FWS$ = subexp(subexp(WSP$$ + \"*\" + \"\\\\x0D\\\\x0A\") + \"?\" + WSP$$ + \"+\");\n//const QUOTED_PAIR$ = subexp(subexp(\"\\\\\\\\\" + subexp(VCHAR$$ + \"|\" + WSP$$)) + \"|\" + OBS_QP$);\n//const QUOTED_STRING$ = subexp('\\\\\"' + subexp(FWS$ + \"?\" + QCONTENT$) + \"*\" + FWS$ + \"?\" + '\\\\\"');\nvar ATEXT$$ = \"[A-Za-z0-9\\\\!\\\\$\\\\%\\\\'\\\\*\\\\+\\\\-\\\\^\\\\_\\\\`\\\\{\\\\|\\\\}\\\\~]\";\nvar QTEXT$$ = \"[\\\\!\\\\$\\\\%\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\-\\\\.0-9\\\\<\\\\>A-Z\\\\x5E-\\\\x7E]\";\nvar VCHAR$$ = merge(QTEXT$$, \"[\\\\\\\"\\\\\\\\]\");\nvar SOME_DELIMS$$ = \"[\\\\!\\\\$\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\;\\\\:\\\\@]\";\nvar UNRESERVED = new RegExp(UNRESERVED$$, \"g\");\nvar PCT_ENCODED = new RegExp(PCT_ENCODED$, \"g\");\nvar NOT_LOCAL_PART = new RegExp(merge(\"[^]\", ATEXT$$, \"[\\\\.]\", '[\\\\\"]', VCHAR$$), \"g\");\nvar NOT_HFNAME = new RegExp(merge(\"[^]\", UNRESERVED$$, SOME_DELIMS$$), \"g\");\nvar NOT_HFVALUE = NOT_HFNAME;\nfunction decodeUnreserved(str) {\n var decStr = pctDecChars(str);\n return !decStr.match(UNRESERVED) ? str : decStr;\n}\nvar handler$4 = {\n scheme: \"mailto\",\n parse: function parse$$1(components, options) {\n var mailtoComponents = components;\n var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(\",\") : [];\n mailtoComponents.path = undefined;\n if (mailtoComponents.query) {\n var unknownHeaders = false;\n var headers = {};\n var hfields = mailtoComponents.query.split(\"&\");\n for (var x = 0, xl = hfields.length; x < xl; ++x) {\n var hfield = hfields[x].split(\"=\");\n switch (hfield[0]) {\n case \"to\":\n var toAddrs = hfield[1].split(\",\");\n for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {\n to.push(toAddrs[_x]);\n }\n break;\n case \"subject\":\n mailtoComponents.subject = unescapeComponent(hfield[1], options);\n break;\n case \"body\":\n mailtoComponents.body = unescapeComponent(hfield[1], options);\n break;\n default:\n unknownHeaders = true;\n headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);\n break;\n }\n }\n if (unknownHeaders) mailtoComponents.headers = headers;\n }\n mailtoComponents.query = undefined;\n for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {\n var addr = to[_x2].split(\"@\");\n addr[0] = unescapeComponent(addr[0]);\n if (!options.unicodeSupport) {\n //convert Unicode IDN -> ASCII IDN\n try {\n addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());\n } catch (e) {\n mailtoComponents.error = mailtoComponents.error || \"Email address's domain name can not be converted to ASCII via punycode: \" + e;\n }\n } else {\n addr[1] = unescapeComponent(addr[1], options).toLowerCase();\n }\n to[_x2] = addr.join(\"@\");\n }\n return mailtoComponents;\n },\n serialize: function serialize$$1(mailtoComponents, options) {\n var components = mailtoComponents;\n var to = toArray(mailtoComponents.to);\n if (to) {\n for (var x = 0, xl = to.length; x < xl; ++x) {\n var toAddr = String(to[x]);\n var atIdx = toAddr.lastIndexOf(\"@\");\n var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);\n var domain = toAddr.slice(atIdx + 1);\n //convert IDN via punycode\n try {\n domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);\n } catch (e) {\n components.error = components.error || \"Email address's domain name can not be converted to \" + (!options.iri ? \"ASCII\" : \"Unicode\") + \" via punycode: \" + e;\n }\n to[x] = localPart + \"@\" + domain;\n }\n components.path = to.join(\",\");\n }\n var headers = mailtoComponents.headers = mailtoComponents.headers || {};\n if (mailtoComponents.subject) headers[\"subject\"] = mailtoComponents.subject;\n if (mailtoComponents.body) headers[\"body\"] = mailtoComponents.body;\n var fields = [];\n for (var name in headers) {\n if (headers[name] !== O[name]) {\n fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + \"=\" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar));\n }\n }\n if (fields.length) {\n components.query = fields.join(\"&\");\n }\n return components;\n }\n};\n\nvar URN_PARSE = /^([^\\:]+)\\:(.*)/;\n//RFC 2141\nvar handler$5 = {\n scheme: \"urn\",\n parse: function parse$$1(components, options) {\n var matches = components.path && components.path.match(URN_PARSE);\n var urnComponents = components;\n if (matches) {\n var scheme = options.scheme || urnComponents.scheme || \"urn\";\n var nid = matches[1].toLowerCase();\n var nss = matches[2];\n var urnScheme = scheme + \":\" + (options.nid || nid);\n var schemeHandler = SCHEMES[urnScheme];\n urnComponents.nid = nid;\n urnComponents.nss = nss;\n urnComponents.path = undefined;\n if (schemeHandler) {\n urnComponents = schemeHandler.parse(urnComponents, options);\n }\n } else {\n urnComponents.error = urnComponents.error || \"URN can not be parsed.\";\n }\n return urnComponents;\n },\n serialize: function serialize$$1(urnComponents, options) {\n var scheme = options.scheme || urnComponents.scheme || \"urn\";\n var nid = urnComponents.nid;\n var urnScheme = scheme + \":\" + (options.nid || nid);\n var schemeHandler = SCHEMES[urnScheme];\n if (schemeHandler) {\n urnComponents = schemeHandler.serialize(urnComponents, options);\n }\n var uriComponents = urnComponents;\n var nss = urnComponents.nss;\n uriComponents.path = (nid || options.nid) + \":\" + nss;\n return uriComponents;\n }\n};\n\nvar UUID = /^[0-9A-Fa-f]{8}(?:\\-[0-9A-Fa-f]{4}){3}\\-[0-9A-Fa-f]{12}$/;\n//RFC 4122\nvar handler$6 = {\n scheme: \"urn:uuid\",\n parse: function parse(urnComponents, options) {\n var uuidComponents = urnComponents;\n uuidComponents.uuid = uuidComponents.nss;\n uuidComponents.nss = undefined;\n if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {\n uuidComponents.error = uuidComponents.error || \"UUID is not valid.\";\n }\n return uuidComponents;\n },\n serialize: function serialize(uuidComponents, options) {\n var urnComponents = uuidComponents;\n //normalize UUID\n urnComponents.nss = (uuidComponents.uuid || \"\").toLowerCase();\n return urnComponents;\n }\n};\n\nSCHEMES[handler.scheme] = handler;\nSCHEMES[handler$1.scheme] = handler$1;\nSCHEMES[handler$2.scheme] = handler$2;\nSCHEMES[handler$3.scheme] = handler$3;\nSCHEMES[handler$4.scheme] = handler$4;\nSCHEMES[handler$5.scheme] = handler$5;\nSCHEMES[handler$6.scheme] = handler$6;\n\nexports.SCHEMES = SCHEMES;\nexports.pctEncChar = pctEncChar;\nexports.pctDecChars = pctDecChars;\nexports.parse = parse;\nexports.removeDotSegments = removeDotSegments;\nexports.serialize = serialize;\nexports.resolveComponents = resolveComponents;\nexports.resolve = resolve;\nexports.normalize = normalize;\nexports.equal = equal;\nexports.escapeComponent = escapeComponent;\nexports.unescapeComponent = unescapeComponent;\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=uri.all.js.map\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","'use strict';\n\n// https://mathiasbynens.be/notes/javascript-encoding\n// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode\nmodule.exports = function ucs2length(str) {\n var length = 0\n , len = str.length\n , pos = 0\n , value;\n while (pos < len) {\n length++;\n value = str.charCodeAt(pos++);\n if (value >= 0xD800 && value <= 0xDBFF && pos < len) {\n // high surrogate, and there is a next character\n value = str.charCodeAt(pos);\n if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate\n }\n }\n return length;\n};\n","'use strict';\n\n\nmodule.exports = {\n copy: copy,\n checkDataType: checkDataType,\n checkDataTypes: checkDataTypes,\n coerceToTypes: coerceToTypes,\n toHash: toHash,\n getProperty: getProperty,\n escapeQuotes: escapeQuotes,\n equal: require('fast-deep-equal'),\n ucs2length: require('./ucs2length'),\n varOccurences: varOccurences,\n varReplace: varReplace,\n schemaHasRules: schemaHasRules,\n schemaHasRulesExcept: schemaHasRulesExcept,\n schemaUnknownRules: schemaUnknownRules,\n toQuotedString: toQuotedString,\n getPathExpr: getPathExpr,\n getPath: getPath,\n getData: getData,\n unescapeFragment: unescapeFragment,\n unescapeJsonPointer: unescapeJsonPointer,\n escapeFragment: escapeFragment,\n escapeJsonPointer: escapeJsonPointer\n};\n\n\nfunction copy(o, to) {\n to = to || {};\n for (var key in o) to[key] = o[key];\n return to;\n}\n\n\nfunction checkDataType(dataType, data, strictNumbers, negate) {\n var EQUAL = negate ? ' !== ' : ' === '\n , AND = negate ? ' || ' : ' && '\n , OK = negate ? '!' : ''\n , NOT = negate ? '' : '!';\n switch (dataType) {\n case 'null': return data + EQUAL + 'null';\n case 'array': return OK + 'Array.isArray(' + data + ')';\n case 'object': return '(' + OK + data + AND +\n 'typeof ' + data + EQUAL + '\"object\"' + AND +\n NOT + 'Array.isArray(' + data + '))';\n case 'integer': return '(typeof ' + data + EQUAL + '\"number\"' + AND +\n NOT + '(' + data + ' % 1)' +\n AND + data + EQUAL + data +\n (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';\n case 'number': return '(typeof ' + data + EQUAL + '\"' + dataType + '\"' +\n (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';\n default: return 'typeof ' + data + EQUAL + '\"' + dataType + '\"';\n }\n}\n\n\nfunction checkDataTypes(dataTypes, data, strictNumbers) {\n switch (dataTypes.length) {\n case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);\n default:\n var code = '';\n var types = toHash(dataTypes);\n if (types.array && types.object) {\n code = types.null ? '(': '(!' + data + ' || ';\n code += 'typeof ' + data + ' !== \"object\")';\n delete types.null;\n delete types.array;\n delete types.object;\n }\n if (types.number) delete types.integer;\n for (var t in types)\n code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);\n\n return code;\n }\n}\n\n\nvar COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);\nfunction coerceToTypes(optionCoerceTypes, dataTypes) {\n if (Array.isArray(dataTypes)) {\n var types = [];\n for (var i=0; i= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);\n return paths[lvl - up];\n }\n\n if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);\n data = 'data' + ((lvl - up) || '');\n if (!jsonPointer) return data;\n }\n\n var expr = data;\n var segments = jsonPointer.split('/');\n for (var i=0; i= 0) return { index: index, compiling: true };\n index = this._compilations.length;\n this._compilations[index] = {\n schema: schema,\n root: root,\n baseId: baseId\n };\n return { index: index, compiling: false };\n}\n\n\n/**\n * Removes the schema from the currently compiled list\n * @this Ajv\n * @param {Object} schema schema to compile\n * @param {Object} root root object\n * @param {String} baseId base schema ID\n */\nfunction endCompiling(schema, root, baseId) {\n /* jshint validthis: true */\n var i = compIndex.call(this, schema, root, baseId);\n if (i >= 0) this._compilations.splice(i, 1);\n}\n\n\n/**\n * Index of schema compilation in the currently compiled list\n * @this Ajv\n * @param {Object} schema schema to compile\n * @param {Object} root root object\n * @param {String} baseId base schema ID\n * @return {Integer} compilation index\n */\nfunction compIndex(schema, root, baseId) {\n /* jshint validthis: true */\n for (var i=0; i%\\\\^`{|}]|%[0-9a-f]{2})|\\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?)*\\})*$/i;\n// For the source: https://gist.github.com/dperini/729294\n// For test cases: https://mathiasbynens.be/demo/url-regex\n// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.\n// var URL = /^(?:(?:https?|ftp):\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!192\\.168(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-)*[a-z\\u{00a1}-\\u{ffff}0-9]+)(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-)*[a-z\\u{00a1}-\\u{ffff}0-9]+)*(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?$/iu;\nvar URL = /^(?:(?:http[s\\u017F]?|ftp):\\/\\/)(?:(?:[\\0-\\x08\\x0E-\\x1F!-\\x9F\\xA1-\\u167F\\u1681-\\u1FFF\\u200B-\\u2027\\u202A-\\u202E\\u2030-\\u205E\\u2060-\\u2FFF\\u3001-\\uD7FF\\uE000-\\uFEFE\\uFF00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])+(?::(?:[\\0-\\x08\\x0E-\\x1F!-\\x9F\\xA1-\\u167F\\u1681-\\u1FFF\\u200B-\\u2027\\u202A-\\u202E\\u2030-\\u205E\\u2060-\\u2FFF\\u3001-\\uD7FF\\uE000-\\uFEFE\\uFF00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])*)?@)?(?:(?!10(?:\\.[0-9]{1,3}){3})(?!127(?:\\.[0-9]{1,3}){3})(?!169\\.254(?:\\.[0-9]{1,3}){2})(?!192\\.168(?:\\.[0-9]{1,3}){2})(?!172\\.(?:1[6-9]|2[0-9]|3[01])(?:\\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\\xA1-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])+-)*(?:[0-9a-z\\xA1-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])+)(?:\\.(?:(?:[0-9a-z\\xA1-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])+-)*(?:[0-9a-z\\xA1-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])+)*(?:\\.(?:(?:[a-z\\xA1-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\\/(?:[\\0-\\x08\\x0E-\\x1F!-\\x9F\\xA1-\\u167F\\u1681-\\u1FFF\\u200B-\\u2027\\u202A-\\u202E\\u2030-\\u205E\\u2060-\\u2FFF\\u3001-\\uD7FF\\uE000-\\uFEFE\\uFF00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])*)?$/i;\nvar UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;\nvar JSON_POINTER = /^(?:\\/(?:[^~/]|~0|~1)*)*$/;\nvar JSON_POINTER_URI_FRAGMENT = /^#(?:\\/(?:[a-z0-9_\\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;\nvar RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/;\n\n\nmodule.exports = formats;\n\nfunction formats(mode) {\n mode = mode == 'full' ? 'full' : 'fast';\n return util.copy(formats[mode]);\n}\n\n\nformats.fast = {\n // date: http://tools.ietf.org/html/rfc3339#section-5.6\n date: /^\\d\\d\\d\\d-[0-1]\\d-[0-3]\\d$/,\n // date-time: http://tools.ietf.org/html/rfc3339#section-5.6\n time: /^(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)(?:\\.\\d+)?(?:z|[+-]\\d\\d(?::?\\d\\d)?)?$/i,\n 'date-time': /^\\d\\d\\d\\d-[0-1]\\d-[0-3]\\d[t\\s](?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)(?:\\.\\d+)?(?:z|[+-]\\d\\d(?::?\\d\\d)?)$/i,\n // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js\n uri: /^(?:[a-z][a-z0-9+\\-.]*:)(?:\\/?\\/)?[^\\s]*$/i,\n 'uri-reference': /^(?:(?:[a-z][a-z0-9+\\-.]*:)?\\/?\\/)?(?:[^\\\\\\s#][^\\s#]*)?(?:#[^\\\\\\s]*)?$/i,\n 'uri-template': URITEMPLATE,\n url: URL,\n // email (sources from jsen validator):\n // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363\n // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')\n email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,\n hostname: HOSTNAME,\n // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html\n ipv4: /^(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$/,\n // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses\n ipv6: /^\\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(?:%.+)?\\s*$/i,\n regex: regex,\n // uuid: http://tools.ietf.org/html/rfc4122\n uuid: UUID,\n // JSON-pointer: https://tools.ietf.org/html/rfc6901\n // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A\n 'json-pointer': JSON_POINTER,\n 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,\n // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00\n 'relative-json-pointer': RELATIVE_JSON_POINTER\n};\n\n\nformats.full = {\n date: date,\n time: time,\n 'date-time': date_time,\n uri: uri,\n 'uri-reference': URIREF,\n 'uri-template': URITEMPLATE,\n url: URL,\n email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,\n hostname: HOSTNAME,\n ipv4: /^(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$/,\n ipv6: /^\\s*(?:(?:(?:[0-9a-f]{1,4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0,5}:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(?:%.+)?\\s*$/i,\n regex: regex,\n uuid: UUID,\n 'json-pointer': JSON_POINTER,\n 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,\n 'relative-json-pointer': RELATIVE_JSON_POINTER\n};\n\n\nfunction isLeapYear(year) {\n // https://tools.ietf.org/html/rfc3339#appendix-C\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\n\nfunction date(str) {\n // full-date from http://tools.ietf.org/html/rfc3339#section-5.6\n var matches = str.match(DATE);\n if (!matches) return false;\n\n var year = +matches[1];\n var month = +matches[2];\n var day = +matches[3];\n\n return month >= 1 && month <= 12 && day >= 1 &&\n day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);\n}\n\n\nfunction time(str, full) {\n var matches = str.match(TIME);\n if (!matches) return false;\n\n var hour = matches[1];\n var minute = matches[2];\n var second = matches[3];\n var timeZone = matches[5];\n return ((hour <= 23 && minute <= 59 && second <= 59) ||\n (hour == 23 && minute == 59 && second == 60)) &&\n (!full || timeZone);\n}\n\n\nvar DATE_TIME_SEPARATOR = /t|\\s/i;\nfunction date_time(str) {\n // http://tools.ietf.org/html/rfc3339#section-5.6\n var dateTime = str.split(DATE_TIME_SEPARATOR);\n return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);\n}\n\n\nvar NOT_URI_FRAGMENT = /\\/|:/;\nfunction uri(str) {\n // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required \".\"\n return NOT_URI_FRAGMENT.test(str) && URI.test(str);\n}\n\n\nvar Z_ANCHOR = /[^\\\\]\\\\Z/;\nfunction regex(str) {\n if (Z_ANCHOR.test(str)) return false;\n try {\n new RegExp(str);\n return true;\n } catch(e) {\n return false;\n }\n}\n","'use strict';\nmodule.exports = function generate_ref(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $async, $refCode;\n if ($schema == '#' || $schema == '#/') {\n if (it.isRoot) {\n $async = it.async;\n $refCode = 'validate';\n } else {\n $async = it.root.schema.$async === true;\n $refCode = 'root.refVal[0]';\n }\n } else {\n var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot);\n if ($refVal === undefined) {\n var $message = it.MissingRefError.message(it.baseId, $schema);\n if (it.opts.missingRefs == 'fail') {\n it.logger.error($message);\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('$ref') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \\'' + (it.util.escapeQuotes($schema)) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'can\\\\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n if ($breakOnError) {\n out += ' if (false) { ';\n }\n } else if (it.opts.missingRefs == 'ignore') {\n it.logger.warn($message);\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n } else {\n throw new it.MissingRefError(it.baseId, $schema, $message);\n }\n } else if ($refVal.inline) {\n var $it = it.util.copy(it);\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n $it.schema = $refVal.schema;\n $it.schemaPath = '';\n $it.errSchemaPath = $schema;\n var $code = it.validate($it).replace(/validate\\.schema/g, $refVal.code);\n out += ' ' + ($code) + ' ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n }\n } else {\n $async = $refVal.$async === true || (it.async && $refVal.$async !== false);\n $refCode = $refVal.code;\n }\n }\n if ($refCode) {\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = '';\n if (it.opts.passContext) {\n out += ' ' + ($refCode) + '.call(this, ';\n } else {\n out += ' ' + ($refCode) + '( ';\n }\n out += ' ' + ($data) + ', (dataPath || \\'\\')';\n if (it.errorPath != '\"\"') {\n out += ' + ' + (it.errorPath);\n }\n var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',\n $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';\n out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ', rootData) ';\n var __callValidate = out;\n out = $$outStack.pop();\n if ($async) {\n if (!it.async) throw new Error('async schema referenced by sync schema');\n if ($breakOnError) {\n out += ' var ' + ($valid) + '; ';\n }\n out += ' try { await ' + (__callValidate) + '; ';\n if ($breakOnError) {\n out += ' ' + ($valid) + ' = true; ';\n }\n out += ' } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ';\n if ($breakOnError) {\n out += ' ' + ($valid) + ' = false; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' if (' + ($valid) + ') { ';\n }\n } else {\n out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } ';\n if ($breakOnError) {\n out += ' else { ';\n }\n }\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_allOf(it, $keyword, $ruleType) {\n var out = ' ';\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $currentBaseId = $it.baseId,\n $allSchemasEmpty = true;\n var arr1 = $schema;\n if (arr1) {\n var $sch, $i = -1,\n l1 = arr1.length - 1;\n while ($i < l1) {\n $sch = arr1[$i += 1];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n $allSchemasEmpty = false;\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + '[' + $i + ']';\n $it.errSchemaPath = $errSchemaPath + '/' + $i;\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n }\n }\n if ($breakOnError) {\n if ($allSchemasEmpty) {\n out += ' if (true) { ';\n } else {\n out += ' ' + ($closingBraces.slice(0, -1)) + ' ';\n }\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_anyOf(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $noEmptySchema = $schema.every(function($sch) {\n return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all));\n });\n if ($noEmptySchema) {\n var $currentBaseId = $it.baseId;\n out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; ';\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n var arr1 = $schema;\n if (arr1) {\n var $sch, $i = -1,\n l1 = arr1.length - 1;\n while ($i < l1) {\n $sch = arr1[$i += 1];\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + '[' + $i + ']';\n $it.errSchemaPath = $errSchemaPath + '/' + $i;\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { ';\n $closingBraces += '}';\n }\n }\n it.compositeRule = $it.compositeRule = $wasComposite;\n out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('anyOf') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should match some schema in anyOf\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError(vErrors); ';\n } else {\n out += ' validate.errors = vErrors; return false; ';\n }\n }\n out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';\n if (it.opts.allErrors) {\n out += ' } ';\n }\n } else {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_comment(it, $keyword, $ruleType) {\n var out = ' ';\n var $schema = it.schema[$keyword];\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $comment = it.util.toQuotedString($schema);\n if (it.opts.$comment === true) {\n out += ' console.log(' + ($comment) + ');';\n } else if (typeof it.opts.$comment == 'function') {\n out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_const(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (!$isData) {\n out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';';\n }\n out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('const') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should be equal to constant\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' }';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_contains(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $idx = 'i' + $lvl,\n $dataNxt = $it.dataLevel = it.dataLevel + 1,\n $nextData = 'data' + $dataNxt,\n $currentBaseId = it.baseId,\n $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all));\n out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';\n if ($nonEmptySchema) {\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n $it.schema = $schema;\n $it.schemaPath = $schemaPath;\n $it.errSchemaPath = $errSchemaPath;\n out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';\n $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);\n var $passData = $data + '[' + $idx + ']';\n $it.dataPathArr[$dataNxt] = $idx;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n out += ' if (' + ($nextValid) + ') break; } ';\n it.compositeRule = $it.compositeRule = $wasComposite;\n out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {';\n } else {\n out += ' if (' + ($data) + '.length == 0) {';\n }\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('contains') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should contain a valid item\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } else { ';\n if ($nonEmptySchema) {\n out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';\n }\n if (it.opts.allErrors) {\n out += ' } ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_dependencies(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $schemaDeps = {},\n $propertyDeps = {},\n $ownProperties = it.opts.ownProperties;\n for ($property in $schema) {\n if ($property == '__proto__') continue;\n var $sch = $schema[$property];\n var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;\n $deps[$property] = $sch;\n }\n out += 'var ' + ($errs) + ' = errors;';\n var $currentErrorPath = it.errorPath;\n out += 'var missing' + ($lvl) + ';';\n for (var $property in $propertyDeps) {\n $deps = $propertyDeps[$property];\n if ($deps.length) {\n out += ' if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';\n if ($ownProperties) {\n out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($property)) + '\\') ';\n }\n if ($breakOnError) {\n out += ' && ( ';\n var arr1 = $deps;\n if (arr1) {\n var $propertyKey, $i = -1,\n l1 = arr1.length - 1;\n while ($i < l1) {\n $propertyKey = arr1[$i += 1];\n if ($i) {\n out += ' || ';\n }\n var $prop = it.util.getProperty($propertyKey),\n $useData = $data + $prop;\n out += ' ( ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';\n }\n }\n out += ')) { ';\n var $propertyPath = 'missing' + $lvl,\n $missingProperty = '\\' + ' + $propertyPath + ' + \\'';\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;\n }\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('dependencies') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \\'' + (it.util.escapeQuotes($property)) + '\\', missingProperty: \\'' + ($missingProperty) + '\\', depsCount: ' + ($deps.length) + ', deps: \\'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(\", \"))) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should have ';\n if ($deps.length == 1) {\n out += 'property ' + (it.util.escapeQuotes($deps[0]));\n } else {\n out += 'properties ' + (it.util.escapeQuotes($deps.join(\", \")));\n }\n out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n } else {\n out += ' ) { ';\n var arr2 = $deps;\n if (arr2) {\n var $propertyKey, i2 = -1,\n l2 = arr2.length - 1;\n while (i2 < l2) {\n $propertyKey = arr2[i2 += 1];\n var $prop = it.util.getProperty($propertyKey),\n $missingProperty = it.util.escapeQuotes($propertyKey),\n $useData = $data + $prop;\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);\n }\n out += ' if ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('dependencies') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \\'' + (it.util.escapeQuotes($property)) + '\\', missingProperty: \\'' + ($missingProperty) + '\\', depsCount: ' + ($deps.length) + ', deps: \\'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(\", \"))) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should have ';\n if ($deps.length == 1) {\n out += 'property ' + (it.util.escapeQuotes($deps[0]));\n } else {\n out += 'properties ' + (it.util.escapeQuotes($deps.join(\", \")));\n }\n out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';\n }\n }\n }\n out += ' } ';\n if ($breakOnError) {\n $closingBraces += '}';\n out += ' else { ';\n }\n }\n }\n it.errorPath = $currentErrorPath;\n var $currentBaseId = $it.baseId;\n for (var $property in $schemaDeps) {\n var $sch = $schemaDeps[$property];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';\n if ($ownProperties) {\n out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($property)) + '\\') ';\n }\n out += ') { ';\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + it.util.getProperty($property);\n $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n out += ' } ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n }\n if ($breakOnError) {\n out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_enum(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n var $i = 'i' + $lvl,\n $vSchema = 'schema' + $lvl;\n if (!$isData) {\n out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';';\n }\n out += 'var ' + ($valid) + ';';\n if ($isData) {\n out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';\n }\n out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }';\n if ($isData) {\n out += ' } ';\n }\n out += ' if (!' + ($valid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('enum') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should be equal to one of the allowed values\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' }';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_format(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n if (it.opts.format === false) {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n return out;\n }\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n var $unknownFormats = it.opts.unknownFormats,\n $allowUnknown = Array.isArray($unknownFormats);\n if ($isData) {\n var $format = 'format' + $lvl,\n $isObject = 'isObject' + $lvl,\n $formatType = 'formatType' + $lvl;\n out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \\'object\\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \\'string\\'; if (' + ($isObject) + ') { ';\n if (it.async) {\n out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; ';\n }\n out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'string\\') || ';\n }\n out += ' (';\n if ($unknownFormats != 'ignore') {\n out += ' (' + ($schemaValue) + ' && !' + ($format) + ' ';\n if ($allowUnknown) {\n out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 ';\n }\n out += ') || ';\n }\n out += ' (' + ($format) + ' && ' + ($formatType) + ' == \\'' + ($ruleType) + '\\' && !(typeof ' + ($format) + ' == \\'function\\' ? ';\n if (it.async) {\n out += ' (async' + ($lvl) + ' ? await ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) ';\n } else {\n out += ' ' + ($format) + '(' + ($data) + ') ';\n }\n out += ' : ' + ($format) + '.test(' + ($data) + '))))) {';\n } else {\n var $format = it.formats[$schema];\n if (!$format) {\n if ($unknownFormats == 'ignore') {\n it.logger.warn('unknown format \"' + $schema + '\" ignored in schema at path \"' + it.errSchemaPath + '\"');\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n return out;\n } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n return out;\n } else {\n throw new Error('unknown format \"' + $schema + '\" is used in schema at path \"' + it.errSchemaPath + '\"');\n }\n }\n var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate;\n var $formatType = $isObject && $format.type || 'string';\n if ($isObject) {\n var $async = $format.async === true;\n $format = $format.validate;\n }\n if ($formatType != $ruleType) {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n return out;\n }\n if ($async) {\n if (!it.async) throw new Error('async format in sync schema');\n var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';\n out += ' if (!(await ' + ($formatRef) + '(' + ($data) + '))) { ';\n } else {\n out += ' if (! ';\n var $formatRef = 'formats' + it.util.getProperty($schema);\n if ($isObject) $formatRef += '.validate';\n if (typeof $format == 'function') {\n out += ' ' + ($formatRef) + '(' + ($data) + ') ';\n } else {\n out += ' ' + ($formatRef) + '.test(' + ($data) + ') ';\n }\n out += ') { ';\n }\n }\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('format') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: ';\n if ($isData) {\n out += '' + ($schemaValue);\n } else {\n out += '' + (it.util.toQuotedString($schema));\n }\n out += ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should match format \"';\n if ($isData) {\n out += '\\' + ' + ($schemaValue) + ' + \\'';\n } else {\n out += '' + (it.util.escapeQuotes($schema));\n }\n out += '\"\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + (it.util.toQuotedString($schema));\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_if(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $thenSch = it.schema['then'],\n $elseSch = it.schema['else'],\n $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),\n $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),\n $currentBaseId = $it.baseId;\n if ($thenPresent || $elsePresent) {\n var $ifClause;\n $it.createErrors = false;\n $it.schema = $schema;\n $it.schemaPath = $schemaPath;\n $it.errSchemaPath = $errSchemaPath;\n out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true; ';\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n $it.createErrors = true;\n out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';\n it.compositeRule = $it.compositeRule = $wasComposite;\n if ($thenPresent) {\n out += ' if (' + ($nextValid) + ') { ';\n $it.schema = it.schema['then'];\n $it.schemaPath = it.schemaPath + '.then';\n $it.errSchemaPath = it.errSchemaPath + '/then';\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';\n if ($thenPresent && $elsePresent) {\n $ifClause = 'ifClause' + $lvl;\n out += ' var ' + ($ifClause) + ' = \\'then\\'; ';\n } else {\n $ifClause = '\\'then\\'';\n }\n out += ' } ';\n if ($elsePresent) {\n out += ' else { ';\n }\n } else {\n out += ' if (!' + ($nextValid) + ') { ';\n }\n if ($elsePresent) {\n $it.schema = it.schema['else'];\n $it.schemaPath = it.schemaPath + '.else';\n $it.errSchemaPath = it.errSchemaPath + '/else';\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';\n if ($thenPresent && $elsePresent) {\n $ifClause = 'ifClause' + $lvl;\n out += ' var ' + ($ifClause) + ' = \\'else\\'; ';\n } else {\n $ifClause = '\\'else\\'';\n }\n out += ' } ';\n }\n out += ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('if') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should match \"\\' + ' + ($ifClause) + ' + \\'\" schema\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError(vErrors); ';\n } else {\n out += ' validate.errors = vErrors; return false; ';\n }\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' else { ';\n }\n } else {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_items(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $idx = 'i' + $lvl,\n $dataNxt = $it.dataLevel = it.dataLevel + 1,\n $nextData = 'data' + $dataNxt,\n $currentBaseId = it.baseId;\n out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';\n if (Array.isArray($schema)) {\n var $additionalItems = it.schema.additionalItems;\n if ($additionalItems === false) {\n out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; ';\n var $currErrSchemaPath = $errSchemaPath;\n $errSchemaPath = it.errSchemaPath + '/additionalItems';\n out += ' if (!' + ($valid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('additionalItems') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT have more than ' + ($schema.length) + ' items\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } ';\n $errSchemaPath = $currErrSchemaPath;\n if ($breakOnError) {\n $closingBraces += '}';\n out += ' else { ';\n }\n }\n var arr1 = $schema;\n if (arr1) {\n var $sch, $i = -1,\n l1 = arr1.length - 1;\n while ($i < l1) {\n $sch = arr1[$i += 1];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';\n var $passData = $data + '[' + $i + ']';\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + '[' + $i + ']';\n $it.errSchemaPath = $errSchemaPath + '/' + $i;\n $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);\n $it.dataPathArr[$dataNxt] = $i;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n }\n }\n if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) {\n $it.schema = $additionalItems;\n $it.schemaPath = it.schemaPath + '.additionalItems';\n $it.errSchemaPath = it.errSchemaPath + '/additionalItems';\n out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';\n $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);\n var $passData = $data + '[' + $idx + ']';\n $it.dataPathArr[$dataNxt] = $idx;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n if ($breakOnError) {\n out += ' if (!' + ($nextValid) + ') break; ';\n }\n out += ' } } ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {\n $it.schema = $schema;\n $it.schemaPath = $schemaPath;\n $it.errSchemaPath = $errSchemaPath;\n out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';\n $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);\n var $passData = $data + '[' + $idx + ']';\n $it.dataPathArr[$dataNxt] = $idx;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n if ($breakOnError) {\n out += ' if (!' + ($nextValid) + ') break; ';\n }\n out += ' }';\n }\n if ($breakOnError) {\n out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate__limit(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $errorKeyword;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n var $isMax = $keyword == 'maximum',\n $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum',\n $schemaExcl = it.schema[$exclusiveKeyword],\n $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data,\n $op = $isMax ? '<' : '>',\n $notOp = $isMax ? '>' : '<',\n $errorKeyword = undefined;\n if (!($isData || typeof $schema == 'number' || $schema === undefined)) {\n throw new Error($keyword + ' must be number');\n }\n if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {\n throw new Error($exclusiveKeyword + ' must be number or boolean');\n }\n if ($isDataExcl) {\n var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),\n $exclusive = 'exclusive' + $lvl,\n $exclType = 'exclType' + $lvl,\n $exclIsNumber = 'exclIsNumber' + $lvl,\n $opExpr = 'op' + $lvl,\n $opStr = '\\' + ' + $opExpr + ' + \\'';\n out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';\n $schemaValueExcl = 'schemaExcl' + $lvl;\n out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \\'boolean\\' && ' + ($exclType) + ' != \\'undefined\\' && ' + ($exclType) + ' != \\'number\\') { ';\n var $errorKeyword = $exclusiveKeyword;\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ($errorKeyword || '_exclusiveLimit') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'' + ($exclusiveKeyword) + ' should be boolean\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } else if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n out += ' ' + ($exclType) + ' == \\'number\\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \\'' + ($op) + '\\' : \\'' + ($op) + '=\\'; ';\n if ($schema === undefined) {\n $errorKeyword = $exclusiveKeyword;\n $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;\n $schemaValue = $schemaValueExcl;\n $isData = $isDataExcl;\n }\n } else {\n var $exclIsNumber = typeof $schemaExcl == 'number',\n $opStr = $op;\n if ($exclIsNumber && $isData) {\n var $opExpr = '\\'' + $opStr + '\\'';\n out += ' if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { ';\n } else {\n if ($exclIsNumber && $schema === undefined) {\n $exclusive = true;\n $errorKeyword = $exclusiveKeyword;\n $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;\n $schemaValue = $schemaExcl;\n $notOp += '=';\n } else {\n if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);\n if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {\n $exclusive = true;\n $errorKeyword = $exclusiveKeyword;\n $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;\n $notOp += '=';\n } else {\n $exclusive = false;\n $opStr += '=';\n }\n }\n var $opExpr = '\\'' + $opStr + '\\'';\n out += ' if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { ';\n }\n }\n $errorKeyword = $errorKeyword || $keyword;\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ($errorKeyword || '_limit') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should be ' + ($opStr) + ' ';\n if ($isData) {\n out += '\\' + ' + ($schemaValue);\n } else {\n out += '' + ($schemaValue) + '\\'';\n }\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate__limitItems(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $errorKeyword;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (!($isData || typeof $schema == 'number')) {\n throw new Error($keyword + ' must be number');\n }\n var $op = $keyword == 'maxItems' ? '>' : '<';\n out += 'if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { ';\n var $errorKeyword = $keyword;\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ($errorKeyword || '_limitItems') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT have ';\n if ($keyword == 'maxItems') {\n out += 'more';\n } else {\n out += 'fewer';\n }\n out += ' than ';\n if ($isData) {\n out += '\\' + ' + ($schemaValue) + ' + \\'';\n } else {\n out += '' + ($schema);\n }\n out += ' items\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += '} ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate__limitLength(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $errorKeyword;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (!($isData || typeof $schema == 'number')) {\n throw new Error($keyword + ' must be number');\n }\n var $op = $keyword == 'maxLength' ? '>' : '<';\n out += 'if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n if (it.opts.unicode === false) {\n out += ' ' + ($data) + '.length ';\n } else {\n out += ' ucs2length(' + ($data) + ') ';\n }\n out += ' ' + ($op) + ' ' + ($schemaValue) + ') { ';\n var $errorKeyword = $keyword;\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ($errorKeyword || '_limitLength') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT be ';\n if ($keyword == 'maxLength') {\n out += 'longer';\n } else {\n out += 'shorter';\n }\n out += ' than ';\n if ($isData) {\n out += '\\' + ' + ($schemaValue) + ' + \\'';\n } else {\n out += '' + ($schema);\n }\n out += ' characters\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += '} ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate__limitProperties(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $errorKeyword;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (!($isData || typeof $schema == 'number')) {\n throw new Error($keyword + ' must be number');\n }\n var $op = $keyword == 'maxProperties' ? '>' : '<';\n out += 'if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { ';\n var $errorKeyword = $keyword;\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ($errorKeyword || '_limitProperties') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT have ';\n if ($keyword == 'maxProperties') {\n out += 'more';\n } else {\n out += 'fewer';\n }\n out += ' than ';\n if ($isData) {\n out += '\\' + ' + ($schemaValue) + ' + \\'';\n } else {\n out += '' + ($schema);\n }\n out += ' properties\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += '} ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_multipleOf(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (!($isData || typeof $schema == 'number')) {\n throw new Error($keyword + ' must be number');\n }\n out += 'var division' + ($lvl) + ';if (';\n if ($isData) {\n out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \\'number\\' || ';\n }\n out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', ';\n if (it.opts.multipleOfPrecision) {\n out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' ';\n } else {\n out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') ';\n }\n out += ' ) ';\n if ($isData) {\n out += ' ) ';\n }\n out += ' ) { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('multipleOf') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should be multiple of ';\n if ($isData) {\n out += '\\' + ' + ($schemaValue);\n } else {\n out += '' + ($schemaValue) + '\\'';\n }\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += '} ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_not(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {\n $it.schema = $schema;\n $it.schemaPath = $schemaPath;\n $it.errSchemaPath = $errSchemaPath;\n out += ' var ' + ($errs) + ' = errors; ';\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n $it.createErrors = false;\n var $allErrorsOption;\n if ($it.opts.allErrors) {\n $allErrorsOption = $it.opts.allErrors;\n $it.opts.allErrors = false;\n }\n out += ' ' + (it.validate($it)) + ' ';\n $it.createErrors = true;\n if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;\n it.compositeRule = $it.compositeRule = $wasComposite;\n out += ' if (' + ($nextValid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('not') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT be valid\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';\n if (it.opts.allErrors) {\n out += ' } ';\n }\n } else {\n out += ' var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('not') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT be valid\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n if ($breakOnError) {\n out += ' if (false) { ';\n }\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_oneOf(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $currentBaseId = $it.baseId,\n $prevValid = 'prevValid' + $lvl,\n $passingSchemas = 'passingSchemas' + $lvl;\n out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; ';\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n var arr1 = $schema;\n if (arr1) {\n var $sch, $i = -1,\n l1 = arr1.length - 1;\n while ($i < l1) {\n $sch = arr1[$i += 1];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + '[' + $i + ']';\n $it.errSchemaPath = $errSchemaPath + '/' + $i;\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n } else {\n out += ' var ' + ($nextValid) + ' = true; ';\n }\n if ($i) {\n out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { ';\n $closingBraces += '}';\n }\n out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }';\n }\n }\n it.compositeRule = $it.compositeRule = $wasComposite;\n out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('oneOf') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should match exactly one schema in oneOf\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError(vErrors); ';\n } else {\n out += ' validate.errors = vErrors; return false; ';\n }\n }\n out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }';\n if (it.opts.allErrors) {\n out += ' } ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_pattern(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema);\n out += 'if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'string\\') || ';\n }\n out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('pattern') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: ';\n if ($isData) {\n out += '' + ($schemaValue);\n } else {\n out += '' + (it.util.toQuotedString($schema));\n }\n out += ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should match pattern \"';\n if ($isData) {\n out += '\\' + ' + ($schemaValue) + ' + \\'';\n } else {\n out += '' + (it.util.escapeQuotes($schema));\n }\n out += '\"\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + (it.util.toQuotedString($schema));\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += '} ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_properties(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $key = 'key' + $lvl,\n $idx = 'idx' + $lvl,\n $dataNxt = $it.dataLevel = it.dataLevel + 1,\n $nextData = 'data' + $dataNxt,\n $dataProperties = 'dataProperties' + $lvl;\n var $schemaKeys = Object.keys($schema || {}).filter(notProto),\n $pProperties = it.schema.patternProperties || {},\n $pPropertyKeys = Object.keys($pProperties).filter(notProto),\n $aProperties = it.schema.additionalProperties,\n $someProperties = $schemaKeys.length || $pPropertyKeys.length,\n $noAdditional = $aProperties === false,\n $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length,\n $removeAdditional = it.opts.removeAdditional,\n $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional,\n $ownProperties = it.opts.ownProperties,\n $currentBaseId = it.baseId;\n var $required = it.schema.required;\n if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {\n var $requiredHash = it.util.toHash($required);\n }\n\n function notProto(p) {\n return p !== '__proto__';\n }\n out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';\n if ($ownProperties) {\n out += ' var ' + ($dataProperties) + ' = undefined;';\n }\n if ($checkAdditional) {\n if ($ownProperties) {\n out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';\n } else {\n out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';\n }\n if ($someProperties) {\n out += ' var isAdditional' + ($lvl) + ' = !(false ';\n if ($schemaKeys.length) {\n if ($schemaKeys.length > 8) {\n out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') ';\n } else {\n var arr1 = $schemaKeys;\n if (arr1) {\n var $propertyKey, i1 = -1,\n l1 = arr1.length - 1;\n while (i1 < l1) {\n $propertyKey = arr1[i1 += 1];\n out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' ';\n }\n }\n }\n }\n if ($pPropertyKeys.length) {\n var arr2 = $pPropertyKeys;\n if (arr2) {\n var $pProperty, $i = -1,\n l2 = arr2.length - 1;\n while ($i < l2) {\n $pProperty = arr2[$i += 1];\n out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') ';\n }\n }\n }\n out += ' ); if (isAdditional' + ($lvl) + ') { ';\n }\n if ($removeAdditional == 'all') {\n out += ' delete ' + ($data) + '[' + ($key) + ']; ';\n } else {\n var $currentErrorPath = it.errorPath;\n var $additionalProperty = '\\' + ' + $key + ' + \\'';\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);\n }\n if ($noAdditional) {\n if ($removeAdditional) {\n out += ' delete ' + ($data) + '[' + ($key) + ']; ';\n } else {\n out += ' ' + ($nextValid) + ' = false; ';\n var $currErrSchemaPath = $errSchemaPath;\n $errSchemaPath = it.errSchemaPath + '/additionalProperties';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('additionalProperties') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \\'' + ($additionalProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is an invalid additional property';\n } else {\n out += 'should NOT have additional properties';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n $errSchemaPath = $currErrSchemaPath;\n if ($breakOnError) {\n out += ' break; ';\n }\n }\n } else if ($additionalIsSchema) {\n if ($removeAdditional == 'failing') {\n out += ' var ' + ($errs) + ' = errors; ';\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n $it.schema = $aProperties;\n $it.schemaPath = it.schemaPath + '.additionalProperties';\n $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';\n $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);\n var $passData = $data + '[' + $key + ']';\n $it.dataPathArr[$dataNxt] = $key;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } ';\n it.compositeRule = $it.compositeRule = $wasComposite;\n } else {\n $it.schema = $aProperties;\n $it.schemaPath = it.schemaPath + '.additionalProperties';\n $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';\n $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);\n var $passData = $data + '[' + $key + ']';\n $it.dataPathArr[$dataNxt] = $key;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n if ($breakOnError) {\n out += ' if (!' + ($nextValid) + ') break; ';\n }\n }\n }\n it.errorPath = $currentErrorPath;\n }\n if ($someProperties) {\n out += ' } ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n var $useDefaults = it.opts.useDefaults && !it.compositeRule;\n if ($schemaKeys.length) {\n var arr3 = $schemaKeys;\n if (arr3) {\n var $propertyKey, i3 = -1,\n l3 = arr3.length - 1;\n while (i3 < l3) {\n $propertyKey = arr3[i3 += 1];\n var $sch = $schema[$propertyKey];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n var $prop = it.util.getProperty($propertyKey),\n $passData = $data + $prop,\n $hasDefault = $useDefaults && $sch.default !== undefined;\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + $prop;\n $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);\n $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);\n $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n $code = it.util.varReplace($code, $nextData, $passData);\n var $useData = $passData;\n } else {\n var $useData = $nextData;\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ';\n }\n if ($hasDefault) {\n out += ' ' + ($code) + ' ';\n } else {\n if ($requiredHash && $requiredHash[$propertyKey]) {\n out += ' if ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') { ' + ($nextValid) + ' = false; ';\n var $currentErrorPath = it.errorPath,\n $currErrSchemaPath = $errSchemaPath,\n $missingProperty = it.util.escapeQuotes($propertyKey);\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);\n }\n $errSchemaPath = it.errSchemaPath + '/required';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n $errSchemaPath = $currErrSchemaPath;\n it.errorPath = $currentErrorPath;\n out += ' } else { ';\n } else {\n if ($breakOnError) {\n out += ' if ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') { ' + ($nextValid) + ' = true; } else { ';\n } else {\n out += ' if (' + ($useData) + ' !== undefined ';\n if ($ownProperties) {\n out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ' ) { ';\n }\n }\n out += ' ' + ($code) + ' } ';\n }\n }\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n }\n }\n if ($pPropertyKeys.length) {\n var arr4 = $pPropertyKeys;\n if (arr4) {\n var $pProperty, i4 = -1,\n l4 = arr4.length - 1;\n while (i4 < l4) {\n $pProperty = arr4[i4 += 1];\n var $sch = $pProperties[$pProperty];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n $it.schema = $sch;\n $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);\n $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);\n if ($ownProperties) {\n out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';\n } else {\n out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';\n }\n out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { ';\n $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);\n var $passData = $data + '[' + $key + ']';\n $it.dataPathArr[$dataNxt] = $key;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n if ($breakOnError) {\n out += ' if (!' + ($nextValid) + ') break; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' else ' + ($nextValid) + ' = true; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n }\n }\n }\n if ($breakOnError) {\n out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_propertyNames(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n out += 'var ' + ($errs) + ' = errors;';\n if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {\n $it.schema = $schema;\n $it.schemaPath = $schemaPath;\n $it.errSchemaPath = $errSchemaPath;\n var $key = 'key' + $lvl,\n $idx = 'idx' + $lvl,\n $i = 'i' + $lvl,\n $invalidName = '\\' + ' + $key + ' + \\'',\n $dataNxt = $it.dataLevel = it.dataLevel + 1,\n $nextData = 'data' + $dataNxt,\n $dataProperties = 'dataProperties' + $lvl,\n $ownProperties = it.opts.ownProperties,\n $currentBaseId = it.baseId;\n if ($ownProperties) {\n out += ' var ' + ($dataProperties) + ' = undefined; ';\n }\n if ($ownProperties) {\n out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';\n } else {\n out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';\n }\n out += ' var startErrs' + ($lvl) + ' = errors; ';\n var $passData = $key;\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n it.compositeRule = $it.compositeRule = $wasComposite;\n out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + ' 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {\n $required[$required.length] = $property;\n }\n }\n }\n } else {\n var $required = $schema;\n }\n }\n if ($isData || $required.length) {\n var $currentErrorPath = it.errorPath,\n $loopRequired = $isData || $required.length >= it.opts.loopRequired,\n $ownProperties = it.opts.ownProperties;\n if ($breakOnError) {\n out += ' var missing' + ($lvl) + '; ';\n if ($loopRequired) {\n if (!$isData) {\n out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';\n }\n var $i = 'i' + $lvl,\n $propertyPath = 'schema' + $lvl + '[' + $i + ']',\n $missingProperty = '\\' + ' + $propertyPath + ' + \\'';\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);\n }\n out += ' var ' + ($valid) + ' = true; ';\n if ($isData) {\n out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';\n }\n out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined ';\n if ($ownProperties) {\n out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';\n }\n out += '; if (!' + ($valid) + ') break; } ';\n if ($isData) {\n out += ' } ';\n }\n out += ' if (!' + ($valid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } else { ';\n } else {\n out += ' if ( ';\n var arr2 = $required;\n if (arr2) {\n var $propertyKey, $i = -1,\n l2 = arr2.length - 1;\n while ($i < l2) {\n $propertyKey = arr2[$i += 1];\n if ($i) {\n out += ' || ';\n }\n var $prop = it.util.getProperty($propertyKey),\n $useData = $data + $prop;\n out += ' ( ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';\n }\n }\n out += ') { ';\n var $propertyPath = 'missing' + $lvl,\n $missingProperty = '\\' + ' + $propertyPath + ' + \\'';\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;\n }\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } else { ';\n }\n } else {\n if ($loopRequired) {\n if (!$isData) {\n out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';\n }\n var $i = 'i' + $lvl,\n $propertyPath = 'schema' + $lvl + '[' + $i + ']',\n $missingProperty = '\\' + ' + $propertyPath + ' + \\'';\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);\n }\n if ($isData) {\n out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { ';\n }\n out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';\n }\n out += ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ';\n if ($isData) {\n out += ' } ';\n }\n } else {\n var arr3 = $required;\n if (arr3) {\n var $propertyKey, i3 = -1,\n l3 = arr3.length - 1;\n while (i3 < l3) {\n $propertyKey = arr3[i3 += 1];\n var $prop = it.util.getProperty($propertyKey),\n $missingProperty = it.util.escapeQuotes($propertyKey),\n $useData = $data + $prop;\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);\n }\n out += ' if ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';\n }\n }\n }\n }\n it.errorPath = $currentErrorPath;\n } else if ($breakOnError) {\n out += ' if (true) {';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_uniqueItems(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (($schema || $isData) && it.opts.uniqueItems !== false) {\n if ($isData) {\n out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \\'boolean\\') ' + ($valid) + ' = false; else { ';\n }\n out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { ';\n var $itemType = it.schema.items && it.schema.items.type,\n $typeIsArray = Array.isArray($itemType);\n if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) {\n out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } ';\n } else {\n out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';\n var $method = 'checkDataType' + ($typeIsArray ? 's' : '');\n out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';\n if ($typeIsArray) {\n out += ' if (typeof item == \\'string\\') item = \\'\"\\' + item; ';\n }\n out += ' if (typeof itemIndices[item] == \\'number\\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } ';\n }\n out += ' } ';\n if ($isData) {\n out += ' } ';\n }\n out += ' if (!' + ($valid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('uniqueItems') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT have duplicate items (items ## \\' + j + \\' and \\' + i + \\' are identical)\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' else { ';\n }\n } else {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n }\n return out;\n}\n","'use strict';\n\n//all requires must be explicit because browserify won't work with dynamic requires\nmodule.exports = {\n '$ref': require('./ref'),\n allOf: require('./allOf'),\n anyOf: require('./anyOf'),\n '$comment': require('./comment'),\n const: require('./const'),\n contains: require('./contains'),\n dependencies: require('./dependencies'),\n 'enum': require('./enum'),\n format: require('./format'),\n 'if': require('./if'),\n items: require('./items'),\n maximum: require('./_limit'),\n minimum: require('./_limit'),\n maxItems: require('./_limitItems'),\n minItems: require('./_limitItems'),\n maxLength: require('./_limitLength'),\n minLength: require('./_limitLength'),\n maxProperties: require('./_limitProperties'),\n minProperties: require('./_limitProperties'),\n multipleOf: require('./multipleOf'),\n not: require('./not'),\n oneOf: require('./oneOf'),\n pattern: require('./pattern'),\n properties: require('./properties'),\n propertyNames: require('./propertyNames'),\n required: require('./required'),\n uniqueItems: require('./uniqueItems'),\n validate: require('./validate')\n};\n","'use strict';\n\nvar ruleModules = require('../dotjs')\n , toHash = require('./util').toHash;\n\nmodule.exports = function rules() {\n var RULES = [\n { type: 'number',\n rules: [ { 'maximum': ['exclusiveMaximum'] },\n { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] },\n { type: 'string',\n rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },\n { type: 'array',\n rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] },\n { type: 'object',\n rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames',\n { 'properties': ['additionalProperties', 'patternProperties'] } ] },\n { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] }\n ];\n\n var ALL = [ 'type', '$comment' ];\n var KEYWORDS = [\n '$schema', '$id', 'id', '$data', '$async', 'title',\n 'description', 'default', 'definitions',\n 'examples', 'readOnly', 'writeOnly',\n 'contentMediaType', 'contentEncoding',\n 'additionalItems', 'then', 'else'\n ];\n var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];\n RULES.all = toHash(ALL);\n RULES.types = toHash(TYPES);\n\n RULES.forEach(function (group) {\n group.rules = group.rules.map(function (keyword) {\n var implKeywords;\n if (typeof keyword == 'object') {\n var key = Object.keys(keyword)[0];\n implKeywords = keyword[key];\n keyword = key;\n implKeywords.forEach(function (k) {\n ALL.push(k);\n RULES.all[k] = true;\n });\n }\n ALL.push(keyword);\n var rule = RULES.all[keyword] = {\n keyword: keyword,\n code: ruleModules[keyword],\n implements: implKeywords\n };\n return rule;\n });\n\n RULES.all.$comment = {\n keyword: '$comment',\n code: ruleModules.$comment\n };\n\n if (group.type) RULES.types[group.type] = group;\n });\n\n RULES.keywords = toHash(ALL.concat(KEYWORDS));\n RULES.custom = {};\n\n return RULES;\n};\n","'use strict';\n\nvar KEYWORDS = [\n 'multipleOf',\n 'maximum',\n 'exclusiveMaximum',\n 'minimum',\n 'exclusiveMinimum',\n 'maxLength',\n 'minLength',\n 'pattern',\n 'additionalItems',\n 'maxItems',\n 'minItems',\n 'uniqueItems',\n 'maxProperties',\n 'minProperties',\n 'required',\n 'additionalProperties',\n 'enum',\n 'format',\n 'const'\n];\n\nmodule.exports = function (metaSchema, keywordsJsonPointers) {\n for (var i=0; i} errors optional array of validation errors, if not passed errors from the instance are used.\n * @param {Object} options optional options with properties `separator` and `dataVar`.\n * @return {String} human readable string with all errors descriptions\n */\nfunction errorsText(errors, options) {\n errors = errors || this.errors;\n if (!errors) return 'No errors';\n options = options || {};\n var separator = options.separator === undefined ? ', ' : options.separator;\n var dataVar = options.dataVar === undefined ? 'data' : options.dataVar;\n\n var text = '';\n for (var i=0; i, i: number, ts: Partial[]) => void\n) {\n if ('tracks' in spec) {\n spec.tracks.forEach((t, i, ts) => {\n callback(t, i, ts);\n traverseTracks(t, callback);\n });\n } else if ('views' in spec) {\n spec.views.forEach(view => traverseTracks(view, callback));\n }\n}\n\n/**\n * Traverse individual tracks and views and call the callback function to read and/or update the common definition of views and tracks.\n * @param spec\n * @param callback\n */\nexport function traverseTracksAndViews(\n spec: GoslingSpec | View | PartialTrack,\n callback: (tv: CommonViewDef | CommonTrackDef) => void\n) {\n if ('tracks' in spec) {\n spec.tracks.forEach(t => {\n callback(t);\n traverseTracksAndViews(t, callback);\n });\n } else if ('views' in spec) {\n spec.views.forEach(v => {\n callback(v);\n traverseTracksAndViews(v, callback);\n });\n }\n}\n\n/**\n * Traverse individual view arrangements and call the callback function to read and/or update the arrangement information.\n * @param spec\n * @param callback\n */\nexport function traverseViewArrangements(spec: GoslingSpec, callback: (tv: MultipleViews) => void) {\n if ('tracks' in spec) {\n // No need to do anything\n } else {\n callback(spec);\n spec.views.forEach(v => {\n traverseViewArrangements(v, callback);\n });\n }\n}\n\n/**\n * This convert the nested track definitions into a flat array.\n * @param spec\n */\nexport function convertToFlatTracks(spec: SingleView): Track[] {\n if (IsFlatTracks(spec)) {\n // This is already `FlatTracks`, so just override the view definition\n const base = { ...spec, tracks: undefined, id: undefined };\n return spec.tracks\n .filter(track => !track._invalidTrack)\n .map(track => Object.assign(JSON.parse(JSON.stringify(base)), track) as SingleTrack);\n }\n\n const newTracks: Track[] = [];\n if (IsStackedTracks(spec)) {\n spec.tracks\n .filter(track => !track._invalidTrack)\n .map(track => {\n if ('alignment' in track) {\n // This is OverlaidTracks\n newTracks.push({\n ...track,\n _overlay: [...track.tracks],\n tracks: undefined,\n alignment: undefined\n } as Track);\n } else {\n // Override track definitions from views\n const base = { ...spec, tracks: undefined, id: undefined };\n const newSpec = Object.assign(JSON.parse(JSON.stringify(base)), track) as SingleTrack;\n newTracks.push(newSpec);\n }\n });\n } else {\n newTracks.push({\n ...spec,\n _overlay: [...spec.tracks.filter(track => !track._invalidTrack)],\n tracks: undefined,\n alignment: undefined\n } as Track);\n }\n\n return JSON.parse(JSON.stringify(newTracks));\n}\n\n/**\n * Traverse views and tracks to use parents's properties if missing.\n * @param spec\n * @param callback\n */\nexport function traverseToFixSpecDownstream(spec: GoslingSpec | SingleView, parentDef?: CommonViewDef | MultipleViews) {\n // TODO: Instead of overriding props individually, use Object.assign()\n if (parentDef) {\n // For assembly and layout, we use the ones defiend by the parents if missing\n if (spec.assembly === undefined) spec.assembly = parentDef.assembly;\n if (spec.layout === undefined) spec.layout = parentDef.layout;\n if (spec.orientation === undefined) spec.orientation = parentDef.orientation;\n if (spec.static === undefined) spec.static = parentDef.static !== undefined ? parentDef.static : false;\n if (spec.zoomLimits === undefined) spec.zoomLimits = parentDef.zoomLimits;\n if (spec.xDomain === undefined) spec.xDomain = parentDef.xDomain;\n if (spec.yDomain === undefined) spec.yDomain = parentDef.yDomain;\n if (spec.linkingId === undefined) spec.linkingId = parentDef.linkingId;\n if (spec.centerRadius === undefined) spec.centerRadius = parentDef.centerRadius;\n if (spec.spacing === undefined && !('tracks' in spec)) spec.spacing = parentDef.spacing;\n if (spec.xOffset === undefined) spec.xOffset = parentDef.xOffset;\n if (spec.yOffset === undefined) spec.yOffset = parentDef.yOffset;\n if ('views' in spec && 'arrangement' in parentDef && spec.arrangement === undefined)\n spec.arrangement = parentDef.arrangement;\n spec.style = getStyleOverridden(parentDef.style, spec.style); // override styles deeply\n } else {\n // This means we are at the rool level, so assign default values if missing\n if (spec.assembly === undefined) spec.assembly = 'hg38';\n if (spec.layout === undefined) spec.layout = 'linear';\n if (spec.orientation === undefined) spec.orientation = 'horizontal';\n if (spec.static === undefined) spec.static = false;\n if (spec.zoomLimits === undefined) spec.zoomLimits = [1, null];\n if (spec.centerRadius === undefined) spec.centerRadius = DEFAULT_INNER_RADIUS_PROP;\n if (spec.spacing === undefined) spec.spacing = DEFAULT_VIEW_SPACING;\n if ('views' in spec && spec.arrangement === undefined) spec.arrangement = 'vertical';\n if (spec.xOffset === undefined) spec.xOffset = 0;\n if (spec.yOffset === undefined) spec.yOffset = 0;\n // Nothing to do when `xDomain` not suggested\n // Nothing to do when `xLinkID` not suggested\n }\n\n // ID should be assigned to each view and track for an API usage\n if (!spec.id) {\n spec.id = uuid();\n }\n\n if ('tracks' in spec) {\n let tracks: Track[] = convertToFlatTracks(spec);\n // !!! Be aware that this should be taken before fixing `overlayOnPreviousTrack` options.\n /**\n * Spread superposed tracks if they are assigned to different data spec.\n * This process is necessary since we are passing over each track to HiGlass, and if a track contain multiple datastes, HiGlass cannot handle that.\n */\n tracks = spreadTracksByData(tracks);\n\n const linkID = uuid();\n tracks.forEach((track, i, array) => {\n // ID should be assigned to each view and track for an API usage\n if (!track.id) {\n track.id = uuid();\n }\n\n // If size not defined, set default ones\n if (!track.width) {\n track.width = Is2DTrack(track) ? DEFAULT_TRACK_SIZE_2D : DEFAULT_TRACK_WIDTH_LINEAR;\n }\n if (!track.height) {\n track.height = Is2DTrack(track) ? DEFAULT_TRACK_SIZE_2D : DEFAULT_TRACK_HEIGHT_LINEAR;\n }\n /**\n * Process a stack option.\n */\n if ('displacement' in track) {\n if (\n track.displacement?.type === 'pile' &&\n track.row === undefined &&\n IsChannelDeep(track.x) &&\n track.x.field &&\n IsChannelDeep(track.xe) &&\n track.xe.field\n // Question: Should we consider mark types? (e.g., link might not be supported?)\n ) {\n const newField = uuid();\n const startField = track.x.field;\n const endField = track.xe.field;\n const padding = track.displacement.padding;\n const displaceTransform: DisplaceTransform = {\n type: 'displace',\n newField,\n boundingBox: { startField, endField, padding },\n method: 'pile'\n };\n\n // Add a data transform for stacking\n if (!track.dataTransform) {\n track.dataTransform = [];\n }\n track.dataTransform = [...track.dataTransform, displaceTransform];\n track.row = { field: newField, type: 'nominal' };\n } else if (track.displacement?.type === 'spread') {\n // ...\n }\n }\n\n /*\n * Properties that shouldn't be suggested\n */\n if (track.layout) track.layout = undefined;\n if (track.zoomLimits) track.zoomLimits = undefined;\n /**\n * Override options received from the parent\n */\n if (!track.assembly) track.assembly = spec.assembly;\n if (!track.layout) track.layout = spec.layout;\n if (!track.orientation) track.orientation = spec.orientation;\n if (track.static === undefined) track.static = spec.static !== undefined ? spec.static : false;\n if (!track.zoomLimits) track.zoomLimits = spec.zoomLimits;\n\n /**\n * Dummy track can't have a circular layout\n */\n if (track.layout == 'circular' && IsDummyTrack(track)) {\n track._invalidTrack = true;\n return;\n }\n\n // Override styles\n track.style = getStyleOverridden(spec.style, track.style);\n if (IsOverlaidTrack(track)) {\n // Remove the dummy tracks from an overlay track\n track._overlay = track._overlay.filter(overlayTrack => {\n return !('type' in overlayTrack && overlayTrack.type == 'dummy-track');\n });\n track._overlay.forEach(o => {\n o.style = getStyleOverridden(track.style, o.style);\n });\n }\n\n /**\n * Orientation is only supported in 1D linear layouts\n */\n if ((track.layout === 'circular' || Is2DTrack(track)) && track.orientation === 'vertical') {\n track.orientation = 'horizontal';\n }\n\n /**\n * A track with 2D genomic coordinates is forced to use a linear layout\n */\n if (Is2DTrack(track)) {\n // TODO: Add a test for this.\n track.layout = 'linear';\n\n /**\n * Add y-axis domain\n */\n if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.y) && !track.y.domain) {\n track.y.domain = spec.yDomain;\n } else if (IsOverlaidTrack(track)) {\n track._overlay.forEach(o => {\n if (IsChannelDeep(o.y) && !o.y.domain) {\n o.y.domain = spec.yDomain;\n }\n });\n }\n }\n\n /**\n * Add x-axis domain\n */\n if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.domain) {\n track.x.domain = spec.xDomain;\n } else if (IsOverlaidTrack(track)) {\n track._overlay.forEach(o => {\n if (IsChannelDeep(o.x) && !o.x.domain) {\n o.x.domain = spec.xDomain;\n }\n });\n }\n\n /**\n * Link tracks in a single view\n */\n if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.linkingId) {\n track.x.linkingId = spec.linkingId ?? linkID;\n } else if (IsOverlaidTrack(track)) {\n let isAdded = false;\n track._overlay.forEach(o => {\n if (isAdded) return; // We want to add only once\n\n if (IsChannelDeep(o.x) && !o.x.linkingId) {\n // TODO: Is this safe?\n o.x.linkingId = spec.linkingId ?? linkID;\n isAdded = true;\n }\n });\n }\n\n if (i === 0) {\n // There is no track to overlay on\n track.overlayOnPreviousTrack = false;\n }\n\n // This means this track is positioned on the top of a view\n if (\n i === 0 ||\n (i !== 0 &&\n tracks.slice(0, i).filter(d => !d.overlayOnPreviousTrack).length === 1 &&\n track.overlayOnPreviousTrack === true)\n ) {\n /**\n * Add axis to the first track, i.e., the track on the top, if undefined\n */\n if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.axis) {\n if (track.orientation === 'vertical') {\n track.x.axis = 'left';\n } else {\n track.x.axis = 'top';\n }\n } else if (IsOverlaidTrack(track)) {\n // let isNone = false; // If there is at least one 'none' axis, should not render axis.\n track._overlay.forEach(o => {\n if (IsChannelDeep(o.x) && !o.x.axis) {\n if (track.orientation === 'vertical') {\n o.x.axis = 'left';\n } else {\n o.x.axis = 'top';\n }\n }\n // else if (IsChannelDeep(o.x) && o.x.axis === 'none') {\n // isNone = true;\n // }\n });\n }\n }\n\n /*\n * Change axis positions considering the orientation.\n */\n if (\n (IsSingleTrack(track) || IsOverlaidTrack(track)) &&\n IsChannelDeep(track.x) &&\n track.x.axis &&\n track.x.axis !== 'none'\n ) {\n if (track.orientation === 'vertical') {\n if (track.x.axis === 'top') {\n track.x.axis = 'left';\n } else if (track.x.axis === 'bottom') {\n track.x.axis = 'right';\n }\n } else {\n if (track.x.axis === 'left') {\n track.x.axis = 'top';\n } else if (track.x.axis === 'right') {\n track.x.axis = 'bottom';\n }\n }\n } else if (IsOverlaidTrack(track)) {\n // let isNone = false; // If there is at least one 'none' axis, should not render axis.\n track._overlay.forEach(o => {\n if (IsChannelDeep(o.x) && o.x.axis && o.x.axis !== 'none') {\n if (track.orientation === 'vertical') {\n if (o.x.axis === 'top') {\n o.x.axis = 'left';\n } else if (o.x.axis === 'bottom') {\n o.x.axis = 'right';\n }\n } else {\n if (o.x.axis === 'left') {\n o.x.axis = 'top';\n } else if (o.x.axis === 'right') {\n o.x.axis = 'bottom';\n }\n }\n }\n // else if (IsChannelDeep(o.x) && o.x.axis === 'none') {\n // isNone = true;\n // }\n });\n }\n\n /*\n * Flip y scale if the last track uses `link` marks\n */\n if (\n // first track can never flipped by default\n i !== 0 &&\n // [0, ..., i] tracks should not overlaid as a single track\n ((i === array.length - 1 && array.slice(0, i + 1).filter(d => d.overlayOnPreviousTrack).length < i) ||\n // Are the rest of the tracks overlaid as a single track?\n (i !== array.length - 1 &&\n array.slice(i + 1).filter(d => d.overlayOnPreviousTrack).length === array.length - i - 1 &&\n array.slice(0, i + 1).filter(d => d.overlayOnPreviousTrack).length < i))\n ) {\n if (IsSingleTrack(track) && track.mark === 'withinLink' && track.flipY === undefined) {\n track.flipY = true;\n } else if (IsOverlaidTrack(track)) {\n if (track.mark === 'withinLink' && track.flipY === undefined) {\n track.flipY = true;\n }\n track._overlay.forEach(o => {\n if (o.mark === 'withinLink' && o.flipY === undefined) {\n o.flipY = true;\n }\n });\n }\n }\n\n if (track.overlayOnPreviousTrack && array[i - 1]) {\n // Use the same size as the previous one\n track.width = array[i - 1].width;\n track.height = array[i - 1].height;\n\n track.layout = array[i - 1].layout;\n track.assembly = array[i - 1].assembly;\n }\n });\n // Filter out any invalid tracks\n tracks = tracks.filter(track => !track._invalidTrack);\n\n spec.tracks = tracks;\n } else {\n // we did not reach track definition, so continue traversing\n spec.views.forEach(v => {\n traverseToFixSpecDownstream(v, spec as CommonViewDef);\n });\n }\n}\n\n/**\n * Get an encoding template for the `higlass-vector` data type.\n * @param column\n * @param value\n */\nexport function getVectorTemplate(column: string, value: string): SingleTrack {\n return {\n data: {\n type: 'vector',\n url: '',\n column,\n value\n },\n mark: 'bar',\n x: { field: column, type: 'genomic', axis: 'top' },\n y: { field: value, type: 'quantitative' },\n width: 400,\n height: 100\n };\n}\n\nexport function getMultivecTemplate(\n row: string,\n column: string,\n value: string,\n categories: string[] | undefined\n): SingleTrack {\n return categories && categories.length < 10\n ? {\n data: {\n type: 'multivec',\n url: '',\n row,\n column,\n value,\n categories\n },\n mark: 'bar',\n x: { field: column, type: 'genomic', axis: 'top' },\n y: { field: value, type: 'quantitative' },\n row: { field: row, type: 'nominal', legend: true },\n color: { field: row, type: 'nominal' },\n width: 400,\n height: 100\n }\n : {\n data: {\n type: 'multivec',\n url: '',\n row,\n column,\n value,\n categories\n },\n mark: 'rect',\n x: { field: column, type: 'genomic', axis: 'top' },\n row: { field: row, type: 'nominal', legend: true },\n color: { field: value, type: 'quantitative' },\n width: 400,\n height: 100\n };\n}\n\n/**\n * Override default visual encoding in each track for given data type.\n * @param spec\n */\nexport function overrideDataTemplates(spec: GoslingSpec) {\n traverseTracks(spec, (t, i, ts) => {\n if (!('data' in t) || !t.data || !IsDataDeepTileset(t.data)) {\n // if `data` is not specified, we can not provide a correct template.\n return;\n }\n\n if ('alignment' in t) {\n // This is an OverlaidTracks, so skip this.\n return;\n }\n\n if (!IsDataTemplate(t)) {\n // This is not partial specification that we need to use templates\n return;\n }\n\n switch (t.data.type) {\n case 'vector':\n case 'bigwig':\n ts[i] = Object.assign(getVectorTemplate(t.data.column ?? 'position', t.data.value ?? 'value'), t);\n break;\n case 'multivec':\n ts[i] = Object.assign(\n getMultivecTemplate(\n t.data.row ?? 'category',\n t.data.column ?? 'position',\n t.data.value ?? 'value',\n t.data.categories\n ),\n t\n );\n break;\n }\n });\n}\n","export const CHROM_SIZE_HG38 = {\n chr1: 248956422,\n chr2: 242193529,\n chr3: 198295559,\n chr4: 190214555,\n chr5: 181538259,\n chr6: 170805979,\n chr7: 159345973,\n chr8: 145138636,\n chr9: 138394717,\n chr10: 133797422,\n chr11: 135086622,\n chr12: 133275309,\n chr13: 114364328,\n chr14: 107043718,\n chr15: 101991189,\n chr16: 90338345,\n chr17: 83257441,\n chr18: 80373285,\n chr19: 58617616,\n chr20: 64444167,\n chr21: 46709983,\n chr22: 50818468,\n chrX: 156040895,\n chrY: 57227415\n};\n\nexport const CHROM_SIZE_HG19 = {\n chr1: 249250621,\n chr2: 243199373,\n chr3: 198022430,\n chr4: 191154276,\n chr5: 180915260,\n chr6: 171115067,\n chr7: 159138663,\n chr8: 146364022,\n chr9: 141213431,\n chr10: 135534747,\n chr11: 135006516,\n chr12: 133851895,\n chr13: 115169878,\n chr14: 107349540,\n chr15: 102531392,\n chr16: 90354753,\n chr17: 81195210,\n chr18: 78077248,\n chr19: 59128983,\n chr20: 63025520,\n chr21: 48129895,\n chr22: 51304566,\n chrX: 155270560,\n chrY: 59373566,\n chrM: 16571\n};\n\nexport const CHROM_SIZE_HG18 = {\n chr1: 247249719,\n chr2: 242951149,\n chr3: 199501827,\n chr4: 191273063,\n chr5: 180857866,\n chr6: 170899992,\n chr7: 158821424,\n chr8: 146274826,\n chr9: 140273252,\n chr10: 135374737,\n chr11: 134452384,\n chr12: 132349534,\n chr13: 114142980,\n chr14: 106368585,\n chr15: 100338915,\n chr16: 88827254,\n chr17: 78774742,\n chr18: 76117153,\n chr19: 63811651,\n chr20: 62435964,\n chr21: 46944323,\n chr22: 49691432,\n chrX: 154913754,\n chrY: 57772954,\n chrM: 16571\n};\n\nexport const CHROM_SIZE_HG17 = {\n chr1: 245522847,\n chr2: 243018229,\n chr3: 199505740,\n chr4: 191411218,\n chr5: 180857866,\n chr6: 170975699,\n chr7: 158628139,\n chr8: 146274826,\n chr9: 138429268,\n chr10: 135413628,\n chr11: 134452384,\n chr12: 132449811,\n chr13: 114142980,\n chr14: 106368585,\n chr15: 100338915,\n chr16: 88827254,\n chr17: 78774742,\n chr18: 76117153,\n chr19: 63811651,\n chr20: 62435964,\n chr21: 46944323,\n chr22: 49554710,\n chrX: 154824264,\n chrY: 57701691,\n chrM: 16571\n};\n\nexport const CHROM_SIZE_HG16 = {\n chr1: 246127941,\n chr2: 243615958,\n chr3: 199344050,\n chr4: 191731959,\n chr5: 181034922,\n chr6: 170914576,\n chr7: 158545518,\n chr8: 146308819,\n chr9: 136372045,\n chr10: 135037215,\n chr11: 134482954,\n chr12: 132078379,\n chr13: 113042980,\n chr14: 105311216,\n chr15: 100256656,\n chr16: 90041932,\n chr17: 81860266,\n chr18: 76115139,\n chr19: 63811651,\n chr20: 63741868,\n chr21: 46976097,\n chr22: 49396972,\n chrX: 153692391,\n chrY: 50286555,\n chrM: 16571\n};\n\nexport const CHROM_SIZE_MM10 = {\n chr1: 195471971,\n chr2: 182113224,\n chr3: 160039680,\n chr4: 156508116,\n chr5: 151834684,\n chr6: 149736546,\n chr7: 145441459,\n chr8: 129401213,\n chr9: 124595110,\n chr10: 130694993,\n chr11: 122082543,\n chr12: 120129022,\n chr13: 120421639,\n chr14: 124902244,\n chr15: 104043685,\n chr16: 98207768,\n chr17: 94987271,\n chr18: 90702639,\n chr19: 61431566,\n chrX: 171031299,\n chrY: 91744698,\n chrM: 16299\n};\n\nexport const CHROM_SIZE_MM9 = {\n chr1: 197195432,\n chr2: 181748087,\n chr3: 159599783,\n chr4: 155630120,\n chr5: 152537259,\n chr6: 149517037,\n chr7: 152524553,\n chr8: 131738871,\n chr9: 124076172,\n chr10: 129993255,\n chr11: 121843856,\n chr12: 121257530,\n chr13: 120284312,\n chr14: 125194864,\n chr15: 103494974,\n chr16: 98319150,\n chr17: 95272651,\n chr18: 90772031,\n chr19: 61342430,\n chrX: 166650296,\n chrY: 15902555,\n chrM: 16299\n};\n\nexport type Chromosome =\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | '8'\n | '9'\n | '10'\n | '11'\n | '12'\n | '13'\n | '14'\n | '15'\n | '16'\n | '17'\n | '18'\n | '19'\n | '20'\n | '21'\n | '22'\n | 'X'\n | 'Y'\n | 'M'\n | 'chr1'\n | 'chr2'\n | 'chr3'\n | 'chr4'\n | 'chr5'\n | 'chr6'\n | 'chr7'\n | 'chr8'\n | 'chr9'\n | 'chr10'\n | 'chr11'\n | 'chr12'\n | 'chr13'\n | 'chr14'\n | 'chr15'\n | 'chr16'\n | 'chr17'\n | 'chr18'\n | 'chr19'\n | 'chr20'\n | 'chr21'\n | 'chr22'\n | 'chrX'\n | 'chrY'\n | 'chrM';\n","import type { Assembly, ChromSizes, GenomicPosition } from '@gosling-lang/gosling-schema';\nimport {\n CHROM_SIZE_HG16,\n CHROM_SIZE_HG17,\n CHROM_SIZE_HG18,\n CHROM_SIZE_HG19,\n CHROM_SIZE_HG38,\n CHROM_SIZE_MM10,\n CHROM_SIZE_MM9\n} from './chrom-size';\n\nexport interface ChromSize {\n size: { [chr: string]: number };\n interval: { [chr: string]: [number, number] };\n total: number;\n path: string;\n}\n\n/**\n * Get relative chromosome position (e.g., `100` => `{ chromosome: 'chr1', position: 100 }`)\n * @param absPos number which is the absolute chromosome position\n * @param assembly the assembly used to calculate which chromosome position\n * @param returnWithinAssembly If true, then if the absolute position is before the first chromosome, it returns the\n * first position of the first chromosome. If the absolute position is after the last chromosome, it returns the last\n * position of the last chromosome\n * @returns the genomic position of the absPos\n */\nexport function getRelativeGenomicPosition(\n absPos: number,\n assembly?: Assembly,\n returnWithinAssembly = false\n): GenomicPosition {\n const chrSizes = Object.entries(computeChromSizes(assembly).interval);\n const minPosChr = { chromosome: 'unknown', position: Infinity } as GenomicPosition;\n const maxPosChr = { chromosome: 'unknown', position: 0 } as GenomicPosition;\n for (const chrSize of chrSizes) {\n const [chromosome, absInterval] = chrSize;\n const [start, end] = absInterval;\n // absPos was found within this chromosome\n if (start <= absPos && absPos < end) {\n return { chromosome, position: absPos - start } as GenomicPosition;\n }\n // Update the min and max chromosomes found\n if (start < minPosChr.position) {\n minPosChr.chromosome = chromosome;\n minPosChr.position = start;\n }\n if (end > maxPosChr.position) {\n maxPosChr.chromosome = chromosome;\n maxPosChr.position = end;\n }\n }\n if (returnWithinAssembly) {\n // Return either the min or max chromosome position\n if (absPos < minPosChr.position) {\n return minPosChr;\n } else {\n return maxPosChr;\n }\n } else {\n return { chromosome: 'unknown', position: absPos };\n }\n}\n\n/**\n * Generate a URL for custom chrom sizes\n * @param chromSizes A custom assembly that specifies chromosomes and their sizes\n */\nfunction createChromSizesUrl(chromSizes: ChromSizes): string {\n const text = chromSizes.map(d => d.join('\\t')).join('\\n');\n const tsv = new Blob([text], { type: 'text/tsv' });\n return URL.createObjectURL(tsv);\n}\n\n/**\n * Get chromosome sizes.\n * @param assembly (default: 'hg38')\n */\nexport function computeChromSizes(assembly?: Assembly): ChromSize {\n if (assembly && typeof assembly === 'string' && assembly in CRHOM_SIZES) {\n return CRHOM_SIZES[assembly];\n } else if (Array.isArray(assembly) && assembly.length !== 0) {\n // custom assembly\n const size = Object.fromEntries(assembly);\n return {\n size,\n interval: getChromInterval(size),\n total: getChromTotalSize(size),\n path: createChromSizesUrl(assembly)\n };\n } else {\n // We do not have that assembly prepared, so return a default one.\n return CRHOM_SIZES.hg38;\n }\n}\n\nconst basePath = (assembly: string) => `https://s3.amazonaws.com/gosling-lang.org/data/${assembly}.chrom.sizes`;\nconst CRHOM_SIZES: { [assembly: string]: ChromSize } = Object.freeze({\n hg38: {\n size: CHROM_SIZE_HG38,\n interval: getChromInterval(CHROM_SIZE_HG38),\n total: getChromTotalSize(CHROM_SIZE_HG38),\n path: basePath('hg38')\n },\n hg19: {\n size: CHROM_SIZE_HG19,\n interval: getChromInterval(CHROM_SIZE_HG19),\n total: getChromTotalSize(CHROM_SIZE_HG19),\n path: basePath('hg19')\n },\n hg18: {\n size: CHROM_SIZE_HG18,\n interval: getChromInterval(CHROM_SIZE_HG18),\n total: getChromTotalSize(CHROM_SIZE_HG18),\n path: basePath('hg18')\n },\n hg17: {\n size: CHROM_SIZE_HG17,\n interval: getChromInterval(CHROM_SIZE_HG17),\n total: getChromTotalSize(CHROM_SIZE_HG17),\n path: basePath('hg17')\n },\n hg16: {\n size: CHROM_SIZE_HG16,\n interval: getChromInterval(CHROM_SIZE_HG16),\n total: getChromTotalSize(CHROM_SIZE_HG16),\n path: basePath('hg16')\n },\n mm10: {\n size: CHROM_SIZE_MM10,\n interval: getChromInterval(CHROM_SIZE_MM10),\n total: getChromTotalSize(CHROM_SIZE_MM10),\n path: basePath('mm10')\n },\n mm9: {\n size: CHROM_SIZE_MM9,\n interval: getChromInterval(CHROM_SIZE_MM9),\n total: getChromTotalSize(CHROM_SIZE_MM9),\n path: basePath('mm9')\n },\n // `unknown` assembly contains only one chromosome with max length\n unknown: {\n size: { chr: Number.MAX_VALUE },\n interval: { chr: [0, Number.MAX_VALUE] },\n total: Number.MAX_VALUE,\n path: basePath('hg38') // just to ensure this does not make crash\n }\n});\n\n/**\n * Some presets of auto-complete IDs (`autocompleteId`) to search for genes using the HiGlass server.\n */\nexport function getAutoCompleteId(assembly?: Assembly) {\n switch (assembly) {\n case 'hg19':\n return 'OHJakQICQD6gTD7skx4EWA';\n case 'mm10':\n return 'QDutvmyiSrec5nX4pA5WGQ';\n case 'mm9':\n return 'GUm5aBiLRCyz2PsBea7Yzg';\n case 'hg38':\n default:\n return 'P0PLbQMwTYGy-5uPIQid7A';\n }\n}\n\n/**\n * Calculate cumulative interval of each chromosome.\n */\nexport function getChromInterval(chromSize: { [k: string]: number }) {\n const interval: { [k: string]: [number, number] } = {};\n\n Object.keys(chromSize).reduce((sum, k) => {\n interval[k] = [sum, sum + chromSize[k]];\n return sum + chromSize[k];\n }, 0);\n\n return interval;\n}\n\n/**\n * Calculate total size of entire chromosomes.\n */\nexport function getChromTotalSize(chromSize: { [k: string]: number }) {\n return Object.values(chromSize).reduce((sum, current) => sum + current, 0);\n}\n\nexport function parseGenomicPosition(position: string): { chromosome: string; start?: number; end?: number } {\n const [chromosome, intervalString] = position.split(':');\n if (intervalString) {\n const [start, end] = intervalString.split('-').map(s => +s.replace(/,/g, ''));\n // only return if both are valid\n if (!Number.isNaN(start) && !Number.isNaN(end)) {\n return { chromosome, start, end };\n }\n }\n return { chromosome };\n}\n\n/**\n * A class that consistently manage and convert genomics positions.\n */\nexport class GenomicPositionHelper {\n constructor(public chromosome: string, public start?: number, public end?: number) {}\n static fromString(str: string) {\n const result = parseGenomicPosition(str);\n return new GenomicPositionHelper(result.chromosome, result.start, result.end);\n }\n toAbsoluteCoordinates(assembly?: Assembly, padding = 0): [number, number] {\n const info = computeChromSizes(assembly);\n const size = info.size[this.chromosome];\n const interval = info.interval[this.chromosome];\n if (size === undefined || interval === undefined) {\n throw new Error(`Chromosome name ${this.chromosome} is not valid`);\n }\n let { start, end } = this;\n if (start === undefined || end === undefined) {\n // if only a chromosome name is specified, set to the extent of the chromosome\n [start, end] = [1, size];\n }\n const offset = interval[0];\n return [start + offset - padding, end + offset + padding];\n }\n}\n","import { bisector } from 'd3-array';\nimport { RemoteFile as _RemoteFile } from 'generic-filehandle';\n\nimport type * as HiGlass from '@higlass/types';\nimport type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema';\n\nexport type CommonDataConfig = {\n assembly: Assembly;\n x?: string;\n xe?: string;\n x1?: string;\n x1e?: string;\n urlFetchOptions?: RequestInit;\n};\n\nexport class DataSource {\n chromInfo: ExtendedChromInfo;\n tilesetInfo: ReturnType;\n\n constructor(public file: File, chromSizes: ChromSizes, public options: Options) {\n this.chromInfo = sizesToChromInfo(chromSizes);\n this.tilesetInfo = tilesetInfoFromChromInfo(this.chromInfo);\n }\n}\n\n/**\n * Filter data before sending to a track considering the visible genomic area in the track.\n * TODO(2022-Jul-13): Consider genomic `y` channels as well.\n */\nexport function filterUsingGenoPos(\n data: Datum[],\n [minX, maxX]: [number, number],\n config: Omit\n) {\n const { x, xe, x1, x1e } = config;\n const definedXFields = [x, xe, x1, x1e].filter(f => f) as string[];\n return data.filter((d: Datum) => {\n if (definedXFields.length === 0) {\n // no filter applies\n return true;\n } else if (definedXFields.length === 1) {\n // filter based on one genomic position\n const value = +d[definedXFields[0]];\n return typeof value === 'number' && minX < value && value <= maxX;\n } else {\n // filter based on two genomic positions, i.e., check overlaps\n const values = definedXFields.map(f => +d[f]).filter(v => !isNaN(v));\n const minValue = Math.min(...values);\n const maxValue = Math.max(...values);\n return minX <= maxValue && minValue <= maxX;\n }\n });\n}\n\nconst chromInfoBisector = bisector((d: { pos: number }) => d.pos).left;\n\nconst chrToAbs = (chrom: string, chromPos: number, chromInfo: HiGlass.ChromInfo) =>\n chromInfo.chrPositions[chrom].pos + chromPos;\n\nconst absToChr = (absPosition: number, chromInfo: HiGlass.ChromInfo) => {\n if (!chromInfo || !chromInfo.cumPositions || !chromInfo.cumPositions.length) {\n return null;\n }\n\n let insertPoint = chromInfoBisector(chromInfo.cumPositions, absPosition);\n const lastChr = chromInfo.cumPositions[chromInfo.cumPositions.length - 1].chr;\n const lastLength = chromInfo.chromLengths[lastChr];\n\n // @ts-expect-error\n insertPoint -= insertPoint > 0 && 1;\n\n let chrPosition = Math.floor(absPosition - chromInfo.cumPositions[insertPoint].pos);\n let offset = 0;\n\n if (chrPosition < 0) {\n // before the start of the genome\n offset = chrPosition - 1;\n chrPosition = 1;\n }\n\n if (insertPoint === chromInfo.cumPositions.length - 1 && chrPosition > lastLength) {\n // beyond the last chromosome\n offset = chrPosition - lastLength;\n chrPosition = lastLength;\n }\n\n return [chromInfo.cumPositions[insertPoint].chr, chrPosition, offset, insertPoint] as const;\n};\n\n/**\n * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`.\n * @param chrName A chromosome name to be sanitized\n * @param assembly A genome assembly of the data\n * @param chromosomePrefix A prefix string that can be replaced to 'chr'\n * @returns\n */\nexport function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string) {\n if (Array.isArray(assembly)) {\n // this is a custom assembly, so use this as is\n return chrName;\n }\n\n // For assemblies in Gosling, we use the `chr` prefix consistently\n if (chromosomePrefix) {\n // `hs1` --> `chr1`\n chrName = chrName.replace(chromosomePrefix, 'chr');\n } else if (!chrName.includes('chr')) {\n // `1` --> `chr1`\n chrName = `chr${chrName}`;\n }\n return chrName;\n}\n\nexport type ExtendedChromInfo = HiGlass.ChromInfo & {\n absToChr(absPos: number): ReturnType | null;\n chrToAbs(chr: [name: string, pos: number]): number | null;\n};\n\nexport function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize = 1024) {\n return {\n tile_size: tileSize,\n bins_per_dimension: tileSize,\n max_zoom: Math.ceil(Math.log(chromInfo.totalLength / tileSize) / Math.log(2)),\n max_width: chromInfo.totalLength,\n min_pos: [0],\n max_pos: [chromInfo.totalLength]\n };\n}\n\nexport function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo {\n const info: HiGlass.ChromInfo = {\n cumPositions: [],\n chromLengths: {},\n chrPositions: {},\n totalLength: 0\n };\n\n sizes.forEach(([chr, length], i) => {\n const chrPosition = { id: i, chr, pos: info.totalLength };\n info.chrPositions[chr] = chrPosition;\n info.chromLengths[chr] = length;\n info.cumPositions.push(chrPosition);\n info.totalLength += length;\n });\n\n return {\n ...info,\n absToChr: absPos => (info.chrPositions ? absToChr(absPos, info) : null),\n chrToAbs: ([chrName, chrPos]) => (info.chrPositions ? chrToAbs(chrName, chrPos, info) : null)\n };\n}\n\nexport class RemoteFile extends _RemoteFile {\n // Overrides `read` to eagerly read 200 or 206 response\n // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162\n public read: _RemoteFile['read'] = async (\n buffer,\n offset = 0,\n length,\n position = 0,\n opts = {}\n ): Promise<{ bytesRead: number; buffer: Buffer }> => {\n const { headers = {}, signal, overrides = {} } = opts;\n\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n } else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n // @ts-expect-error private property\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n // @ts-expect-error private property\n ...this.baseOverrides.headers\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal\n };\n const response = await this.fetch(this.url, args);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n\n // Just read the response if it was successful.\n if (response.status === 200 || response.status === 206) {\n // @ts-expect-error private method\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n // @ts-expect-error private property\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n\n return { bytesRead: bytesCopied, buffer };\n }\n\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n };\n}\n\nexport interface TabularDataFetcher {\n getTabularData(tileIds: string[]): Promise;\n MAX_TILE_WIDTH?: number;\n}\n"],"names":["max","data","color","_a","_b","d3max","d3min","_c","_d","_f","_e","_h","_g","x1","d","title","labelTextStyle","t","type","global","this","exports","HEXDIG$$","PCT_ENCODED$","UNRESERVED$$","ucs2encode","basicToDigit","digitToBasic","adapt","decode","encode","toUnicode","toASCII","decodeUnreserved","base","resolve","uri","equal","parse","serialize","UUID","ucs2length","util","toHash","require$$0","require$$1","IDENTIFIER","rules","JSON_POINTER","RELATIVE_JSON_POINTER","SchemaObject","traverse","jsonSchemaTraverseModule","URI","require$$2","require$$3","require$$4","compile","ref","self","ValidationError","MissingRefError","validate","$id","$schema","$rulesGroup","$rule","errorClasses","stableStringify","require$$5","formats","localRefs","baseId","customRuleCode","v","refVal","schema","keyword","validateSchema","Cache","cacheModule","URL","$sch","properties","required","require$$7","require$$9","require$$11","require$$12","require$$13","require$$14","require$$19","require$$21","require$$23","KEYWORDS","group","metaSchema","dataType","definition","i","require$$6","require$$8","require$$10","regex","format","_RemoteFile"],"mappings":";;;;;;;;;;;;;;AAMO,MAAM,2CAA2C;AAGjD,MAAM,8BAA8B;AACpC,MAAM,6BAA6B;AACnC,MAAM,wBAAwB;AAG9B,MAAM,uBAAuB;AAG7B,MAAM,4BAA4B;AAGlC,MAAM,gCAAgC;AAGtC,MAAM,uBAAuB;AChB9B,MAAA,aAAa,CAAC,aAAqB;AACjC,MAAA,IAAI,MAAM,QAAQ;AAEtB,MAAI,CAAC,GAAG;AACJ,QAAI,MAAM,oBAAoB;AAAA,EAClC;AAEM,QAAA,MAAM,KAAK,MAAM,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAO,EAAE,IAAI,EAAE,IAAI,KAAO,EAAE,MAAM,IAAI,GAAK,CAAC;AACjF,SAAA;AACX;AChBO,MAAM,aAAa;AAMnB,SAAS,cAAc,GAAWA,MAAa,IAAY,IAAY,GAAY;AAChF,QAAA,UAAU,KAAK,IAAI,KAAK,IAAIA,MAAK,CAAC,GAAG,CAAC;AAC5C,QAAM,MAAM,gBAAK;AACjB,QAAM,aAAc,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;AAGM,YAAA,IAAI,MAAM,QAAQ,SAAS,MAAM,aAAa,KAAK,GAAG,EAAE;AAAA,IAAA;AAAA;AAEtE;","x_google_ignoreList":[25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]} \ No newline at end of file diff --git a/dist/favicon.ico b/dist/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..25998e805bf746eae340ffa3addbc253b45bad0b GIT binary patch literal 2055 zcmb7Fdo&Xa8{ab5A%riNw5{2+l+YUuZyVcZE4;>(#bzr?lgzDLMvZ;$xhCY2n#){1 zVMK1da(Po(ujGA|=R4mYzvp+(^E~JL&iS3^Ilp*E2U{ftZ3O@T zphP6#oOapsZ^+5)R@Ou&d6(o_1WF(Pu&48H0Nv8^!2p2lQz8ya4#`_^f0K9!ufC{3 zxlD()BK_WfGaCM8lr7e69oCa(911ZLw}4~=mS;jpe%*;kMy;Nerz!HhBjKQQyB!_- z`t@-BYlIe~VQQ@{-OM-4DZgqy61;{r&ViP-ls}%|T70U{Wf`uI|ME)O$kjT#UG2Hz zJ(bJV+~d*uTrETBYq~r`=B%9Q{~kR)Z;&i8PfmPn`{m|LapkXV1>?u}dIuao;SR;k zPE1VftpR@B_<60ym95WRQhMna1e%?l9eX_Vc>s}fMezO-6elWD{3qhhXH4`^hDc4{5bt3kDfQ&ZfD6_g;_NttM3}Nbl!~1YoUEI)4&l(#;cBZB} zbL`$tl-NrWC)Y-Hhgm8ZmvX*)+#oTkj_0Q5ywd}9|Mxi$ ziA3^D6;Ha)=A}KAY?k?mnDw*|Z4sLf*21>%yuS5LE+m0{^ zjJ`k0@KOSF%jJB#04!Li$M%kK{c=Yc;kK0V8y}8rY^jPL1)XTN**9R<%C!qWI$Zq( zv8R@RY1J5&yE~^NwL*wW4jR!PrQN#{rzpF&bL?MB`PVb|6gp2Fy7;{g(~u>-mGgj^ zX9T;W+&sUmDujmL3ew9idVipNtq5h^th6gD^@qRs@KTzb733;z5|w0t)_N-lj2HAd zt~YiHZyeo=m`L4L;u0iYT=7}oV~CAKpDEsv#X}@fOZ%bG0IlWPxbuMuy&ut*`&LKb z-J%(o+3$ySTxUX(NCJ!126o+XJN!H&jh~I1679jor}&}s&Bx**Z|u67gA`iN;QXa+2Oz)gAm{k?V1h7i+pukIC27`5|w$d44l)OjFNyJz7EyY_iDz{$RnM5ow8*4_WR0ZBi&~Hm)3V!z9>?m4_ zafJQbZQ$}E*;km0@Ikrk50+CuczHW7b-id1K!WX4i8%$bV%~@iI~dbbs9;U!q!^!( zRg=NXL;MpmHcp>2}e_m#zyebk%c84N&nmbbpkNb%Lv2kMZ2C%Q>z&eiIm)59VBk*xYK7fN*`T~_|lRpnCp7FUypC=#~E+%}|bAo<>9PhKk9 sI9I3C8AnIxa{jN#`!7L>+&zDzqP|m?y+AkHcat4J#5>@stm#pI0h-RiGXMYp literal 0 HcmV?d00001 diff --git a/dist/gosling.js b/dist/gosling.js new file mode 100644 index 00000000..7e7e5ab8 --- /dev/null +++ b/dist/gosling.js @@ -0,0 +1,26774 @@ +var __defProp = Object.defineProperty; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __publicField = (obj, key, value) => { + __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; +}; +var __accessCheck = (obj, member, msg) => { + if (!member.has(obj)) + throw TypeError("Cannot " + msg); +}; +var __privateGet = (obj, member, getter) => { + __accessCheck(obj, member, "read from private field"); + return getter ? getter.call(obj) : member.get(obj); +}; +var __privateAdd = (obj, member, value) => { + if (member.has(obj)) + throw TypeError("Cannot add the same private member more than once"); + member instanceof WeakSet ? member.add(obj) : member.set(obj, value); +}; +var __privateSet = (obj, member, value, setter) => { + __accessCheck(obj, member, "write to private field"); + setter ? setter.call(obj, value) : member.set(obj, value); + return value; +}; +var __privateMethod = (obj, member, method) => { + __accessCheck(obj, member, "access private method"); + return method; +}; +var _dataPromise, _chromSizes, _parsedData, _assembly, _filter, _file, _fetchCsv, fetchCsv_fn, _processCsvRow, processCsvRow_fn, _calcCumulativePos, calcCumulativePos_fn, _generateTilesetInfo, generateTilesetInfo_fn, _tile, tile_fn, _generateChomSizeInfo, generateChomSizeInfo_fn, _table; +import * as PIXI from "pixi.js"; +import "d3-color"; +import { group, min, sum, max } from "d3-array"; +import "bezier-js"; +import { scaleLinear, scaleSequential, scaleOrdinal, scaleBand } from "d3-scale"; +import { sampleSize, isEqual, uniqBy, cloneDeepWith } from "lodash-es"; +import { interpolateViridis } from "d3-scale-chromatic"; +import { A as Ajv, I as IsChannelDeep, r as resolveSuperposedTracks, t as traverseTracks, a as IsTemplateTrack, g as getTextStyle, c as computeChromSizes, b as cartesianToPolar, u as uuid, R as RADIAN_GAP, v as valueToRadian, p as pointsToDegree, d as commonjsGlobal, e as RemoteFile, f as IsOneOfFilter, h as IsRangeFilter, i as IsIncludeFilter, j as getChannelKeysByAggregateFnc, k as getChannelKeysByType, s as sanitizeChrName, l as filterUsingGenoPos, m as IsDataDeepTileset, n as IsDomainChr, o as IsDomainInterval, q as IsDomainChrInterval, S as SUPPORTED_CHANNELS, w as insertItemToArray, x as getAutoCompleteId, y as IsChannelValue, z as getValueUsingChannel, B as rectProperty, C as pointProperty, D as barProperty, E as IsStackedChannel, F as IsDomainArray, P as PREDEFINED_COLOR_STR_MAP, G as IsRangeArray, H as Is2DTrack, J as isTabularDataFetcher, K as drawPreEmbellishment, L as drawMark, M as drawPostEmbellishment, N as getRelativeGenomicPosition, O as hasDataTransform, Q as IsXAxis, T as IsMouseEventsDeep, U as colorToHex, V as flatArrayToPairArray, W as DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM, X as traverseTracksAndViews, Y as traverseViewArrangements, Z as DEFAULT_VIEW_SPACING, _ as DEFAULT_INNER_RADIUS_PROP, $ as IsDummyTrack, a0 as IsOverlaidTrack, a1 as IsYAxis, a2 as DEFAULT_CIRCULAR_VIEW_PADDING, a3 as IsDataDeep, a4 as IsHiGlassMatrix, a5 as getHiGlassColorRange, a6 as DEFAULT_TEXT_STYLE, a7 as overrideDataTemplates, a8 as traverseToFixSpecDownstream, a9 as GenomicPositionHelper, aa as isObject } from "./exported-utils-c80467e4.js"; +import higlassRegister from "higlass-register"; +import { TextTrack } from "higlass-text"; +import RBush from "rbush"; +import { precisionPrefix, format, formatPrefix } from "d3-format"; +import { arc } from "d3-shape"; +import { createNanoEvents } from "nanoevents"; +import { spawn } from "threads"; +import { Buffer as Buffer2 } from "buffer"; +import QuickLRU from "quick-lru"; +import { RemoteFile as RemoteFile$1, LocalFile } from "generic-filehandle"; +import { dsvFormat } from "d3-dsv"; +import PubSub$1 from "pubsub-js"; +import React, { forwardRef, useState, useEffect, useMemo, useRef, useImperativeHandle, useCallback } from "react"; +import require$$0 from "react-dom"; +import { HiGlassComponent } from "higlass"; +import { ResizeSensor } from "css-element-queries"; +const name = "gosling.js"; +const version = "0.14.0"; +const $ref$2 = "#/definitions/GoslingSpec"; +const $schema$2 = "http://json-schema.org/draft-07/schema#"; +const definitions$2 = { + Aggregate: { + "enum": [ + "max", + "min", + "mean", + "bin", + "count" + ], + type: "string" + }, + Assembly: { + anyOf: [ + { + "const": "hg38", + type: "string" + }, + { + "const": "hg19", + type: "string" + }, + { + "const": "hg18", + type: "string" + }, + { + "const": "hg17", + type: "string" + }, + { + "const": "hg16", + type: "string" + }, + { + "const": "mm10", + type: "string" + }, + { + "const": "mm9", + type: "string" + }, + { + "const": "unknown", + type: "string" + }, + { + $ref: "#/definitions/ChromSizes" + } + ] + }, + AxisPosition: { + "enum": [ + "none", + "top", + "bottom", + "left", + "right" + ], + type: "string" + }, + BamData: { + additionalProperties: false, + description: "Binary Alignment Map (BAM) is the comprehensive raw data of genome sequencing; it consists of the lossless, compressed binary representation of the Sequence Alignment Map-files.", + properties: { + extractJunction: { + description: "Determine whether to extract exon-to-exon junctions. __Default__: `false`", + type: "boolean" + }, + indexUrl: { + description: "URL link to the index file of the BAM file", + type: "string" + }, + junctionMinCoverage: { + description: "Determine the threshold of coverage when extracting exon-to-exon junctions. __Default__: `1`", + type: "number" + }, + loadMates: { + description: "Load mates that are located in the same chromosome. __Default__: `false`", + type: "boolean" + }, + maxInsertSize: { + description: "Determines the threshold of insert sizes for determining the structural variants. __Default__: `5000`", + type: "number" + }, + type: { + "const": "bam", + type: "string" + }, + url: { + description: "URL link to the BAM data file", + type: "string" + } + }, + required: [ + "type", + "url", + "indexUrl" + ], + type: "object" + }, + BedData: { + additionalProperties: false, + description: "BED file format", + properties: { + customFields: { + description: "An array of strings, where each string is the name of a non-standard field in the BED file. If there are `n` custom fields, we assume that the last `n` columns of the BED file correspond to the custom fields.", + items: { + type: "string" + }, + type: "array" + }, + indexUrl: { + description: "Specify the URL address of the data file index.", + type: "string" + }, + sampleLength: { + description: "Specify the number of rows loaded from the URL.\n\n__Default:__ `1000`", + type: "number" + }, + type: { + "const": "bed", + type: "string" + }, + url: { + description: "Specify the URL address of the data file.", + type: "string" + } + }, + required: [ + "type", + "url", + "indexUrl" + ], + type: "object" + }, + BeddbData: { + additionalProperties: false, + description: "Regular BED or similar files can be pre-aggregated for the scalable data exploration. Find our more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#bed-files).", + properties: { + exonIntervalFields: { + description: "experimental", + items: [ + { + additionalProperties: false, + properties: { + index: { + type: "number" + }, + name: { + type: "string" + } + }, + required: [ + "index", + "name" + ], + type: "object" + }, + { + additionalProperties: false, + properties: { + index: { + type: "number" + }, + name: { + type: "string" + } + }, + required: [ + "index", + "name" + ], + type: "object" + } + ], + maxItems: 2, + minItems: 2, + type: "array" + }, + genomicFields: { + description: "Specify the name of genomic data fields.", + items: { + additionalProperties: false, + properties: { + index: { + type: "number" + }, + name: { + type: "string" + } + }, + required: [ + "index", + "name" + ], + type: "object" + }, + type: "array" + }, + type: { + "const": "beddb", + type: "string" + }, + url: { + description: "Specify the URL address of the data file.", + type: "string" + }, + valueFields: { + description: "Specify the column indexes, field names, and field types.", + items: { + additionalProperties: false, + properties: { + index: { + type: "number" + }, + name: { + type: "string" + }, + type: { + "enum": [ + "nominal", + "quantitative" + ], + type: "string" + } + }, + required: [ + "index", + "name", + "type" + ], + type: "object" + }, + type: "array" + } + }, + required: [ + "type", + "url", + "genomicFields" + ], + type: "object" + }, + BigWigData: { + additionalProperties: false, + properties: { + aggregation: { + $ref: "#/definitions/BinAggregate", + description: 'Determine aggregation function to apply within bins. __Default__: `"mean"`' + }, + binSize: { + description: "Binning the genomic interval in tiles (unit size: 256).", + type: "number" + }, + column: { + description: 'Assign a field name of the middle position of genomic intervals. __Default__: `"position"`', + type: "string" + }, + end: { + description: 'Assign a field name of the end position of genomic intervals. __Default__: `"end"`', + type: "string" + }, + start: { + description: 'Assign a field name of the start position of genomic intervals. __Default__: `"start"`', + type: "string" + }, + type: { + "const": "bigwig", + type: "string" + }, + url: { + description: "Specify the URL address of the data file.", + type: "string" + }, + value: { + description: 'Assign a field name of quantitative values. __Default__: `"value"`', + type: "string" + } + }, + required: [ + "type", + "url" + ], + type: "object" + }, + BinAggregate: { + "enum": [ + "mean", + "sum" + ], + type: "string" + }, + Channel: { + anyOf: [ + { + $ref: "#/definitions/ChannelDeep" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + ChannelDeep: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/Text" + } + ] + }, + ChannelValue: { + additionalProperties: false, + properties: { + value: { + description: "Assign a constant value for a visual channel.", + type: [ + "number", + "string" + ] + } + }, + required: [ + "value" + ], + type: "object" + }, + ChromSizes: { + description: 'Custom chromosome sizes, e.g., [["foo", 1000], ["bar", 300], ["baz", 240]]', + items: { + items: [ + { + type: "string" + }, + { + type: "number" + } + ], + maxItems: 2, + minItems: 2, + type: "array" + }, + type: "array" + }, + Color: { + additionalProperties: false, + properties: { + domain: { + $ref: "#/definitions/ValueExtent", + description: "Values of the data" + }, + field: { + description: "Name of the data field", + type: "string" + }, + legend: { + description: "Whether to display legend. __Default__: `false`", + type: "boolean" + }, + range: { + $ref: "#/definitions/Range", + description: "Determine the colors that should be bound to data value. Default properties are determined considering the field type." + }, + scale: { + "enum": [ + "linear", + "log" + ], + type: "string" + }, + scaleOffset: { + description: "Whether to use offset of the domain proportionally. This is bound to brushes on the color legend. __Default__: `[0, 1]`", + items: { + type: "number" + }, + maxItems: 2, + minItems: 2, + type: "array" + }, + title: { + description: "Title of the legend. __Default__: `undefined`", + type: "string" + }, + type: { + description: "Specify the data type", + "enum": [ + "quantitative", + "nominal" + ], + type: "string" + } + }, + type: "object" + }, + CoverageTransform: { + additionalProperties: false, + description: "Aggregate rows and calculate coverage", + properties: { + endField: { + type: "string" + }, + groupField: { + description: "The name of a nominal field to group rows by in prior to piling-up", + type: "string" + }, + newField: { + type: "string" + }, + startField: { + type: "string" + }, + type: { + "const": "coverage", + type: "string" + } + }, + required: [ + "type", + "startField", + "endField" + ], + type: "object" + }, + CsvData: { + additionalProperties: false, + description: 'Any small enough tabular data files, such as tsv, csv, BED, BEDPE, and GFF, can be loaded using "csv" data specification.', + properties: { + chromosomeField: { + description: "Specify the name of chromosome data fields.", + type: "string" + }, + chromosomePrefix: { + description: 'Specify the chromosome prefix if chromosomes are denoted using a prefix besides "chr" or a number', + type: "string" + }, + genomicFields: { + description: "Specify the name of genomic data fields.", + items: { + type: "string" + }, + type: "array" + }, + genomicFieldsToConvert: { + description: "experimental", + items: { + additionalProperties: false, + properties: { + chromosomeField: { + type: "string" + }, + genomicFields: { + items: { + type: "string" + }, + type: "array" + } + }, + required: [ + "chromosomeField", + "genomicFields" + ], + type: "object" + }, + type: "array" + }, + headerNames: { + description: "Specify the names of data fields if a CSV file does not contain a header.", + items: { + type: "string" + }, + type: "array" + }, + longToWideId: { + description: "experimental", + type: "string" + }, + sampleLength: { + description: "Specify the number of rows loaded from the URL.\n\n__Default:__ `1000`", + type: "number" + }, + separator: { + description: "Specify file separator, __Default:__ ','", + type: "string" + }, + type: { + "const": "csv", + type: "string" + }, + url: { + description: "Specify the URL address of the data file.", + type: "string" + } + }, + required: [ + "type", + "url" + ], + type: "object" + }, + DataDeep: { + anyOf: [ + { + $ref: "#/definitions/JsonData" + }, + { + $ref: "#/definitions/CsvData" + }, + { + $ref: "#/definitions/BedData" + }, + { + $ref: "#/definitions/BigWigData" + }, + { + $ref: "#/definitions/MultivecData" + }, + { + $ref: "#/definitions/BeddbData" + }, + { + $ref: "#/definitions/VectorData" + }, + { + $ref: "#/definitions/MatrixData" + }, + { + $ref: "#/definitions/BamData" + }, + { + $ref: "#/definitions/VcfData" + }, + { + $ref: "#/definitions/GffData" + } + ] + }, + DataTrack: { + additionalProperties: false, + description: "Partial specification of `BasicSingleTrack` to use default visual encoding predefined by data type.", + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + data: { + $ref: "#/definitions/DataDeep" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "data" + ], + type: "object" + }, + DataTransform: { + anyOf: [ + { + $ref: "#/definitions/FilterTransform" + }, + { + $ref: "#/definitions/StrConcatTransform" + }, + { + $ref: "#/definitions/StrReplaceTransform" + }, + { + $ref: "#/definitions/LogTransform" + }, + { + $ref: "#/definitions/DisplaceTransform" + }, + { + $ref: "#/definitions/ExonSplitTransform" + }, + { + $ref: "#/definitions/GenomicLengthTransform" + }, + { + $ref: "#/definitions/SvTypeTransform" + }, + { + $ref: "#/definitions/CoverageTransform" + }, + { + $ref: "#/definitions/JsonParseTransform" + } + ] + }, + Datum: { + additionalProperties: { + type: [ + "number", + "string" + ] + }, + description: "Values in the form of JSON.", + type: "object" + }, + DisplaceTransform: { + additionalProperties: false, + properties: { + boundingBox: { + additionalProperties: false, + properties: { + endField: { + description: "The name of a quantitative field that represents the end position.", + type: "string" + }, + groupField: { + description: "The name of a nominal field to group rows by in prior to piling-up.", + type: "string" + }, + isPaddingBP: { + description: "Whether to consider `padding` as the bp length.", + type: "boolean" + }, + padding: { + description: "The padding around visual lements. Either px or bp", + type: "number" + }, + startField: { + description: "The name of a quantitative field that represents the start position.", + type: "string" + } + }, + required: [ + "startField", + "endField" + ], + type: "object" + }, + maxRows: { + description: "Specify maximum rows to be generated (default has no limit).", + type: "number" + }, + method: { + $ref: "#/definitions/DisplacementType", + description: "A string that specifies the type of displacement." + }, + newField: { + type: "string" + }, + type: { + "const": "displace", + type: "string" + } + }, + required: [ + "type", + "boundingBox", + "method", + "newField" + ], + type: "object" + }, + Displacement: { + additionalProperties: false, + properties: { + padding: { + type: "number" + }, + type: { + $ref: "#/definitions/DisplacementType" + } + }, + required: [ + "type" + ], + type: "object" + }, + DisplacementType: { + "enum": [ + "pile", + "spread" + ], + type: "string" + }, + DomainChr: { + additionalProperties: false, + properties: { + chromosome: { + type: "string" + } + }, + required: [ + "chromosome" + ], + type: "object" + }, + DomainChrInterval: { + additionalProperties: false, + properties: { + chromosome: { + description: "If specified, only showing a certain interval in a chromosome.", + type: "string" + }, + interval: { + items: { + type: "number" + }, + maxItems: 2, + minItems: 2, + type: "array" + } + }, + required: [ + "chromosome", + "interval" + ], + type: "object" + }, + DomainInterval: { + additionalProperties: false, + properties: { + interval: { + description: "Show a certain interval within entire chromosome", + items: { + type: "number" + }, + maxItems: 2, + minItems: 2, + type: "array" + } + }, + required: [ + "interval" + ], + type: "object" + }, + DummyTrack: { + additionalProperties: false, + description: "A placeholder track. In contrast to other tracks, this track does not display any data. Instead it provides empty space for third party tools to display their data on top of.", + properties: { + _invalidTrack: { + description: "internal", + type: "boolean" + }, + assembly: { + "const": "unknown", + description: "No assemblies can be associated with a dummy track", + type: "string" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", + type: "string" + }, + layout: { + "const": "linear", + description: "Only linear layout are supported at this time", + type: "string" + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + "static": { + "const": true, + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + style: { + $ref: "#/definitions/DummyTrackStyle", + description: "Defines how the track is styled" + }, + title: { + description: "Text that gets shown on the DummyTrack", + type: "string" + }, + type: { + "const": "dummy-track", + description: "Used to specify the dummy track", + type: "string" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + zoomLimits: { + description: "Unused property for DummyTrack", + items: { + type: "null" + }, + maxItems: 2, + minItems: 2, + type: "array" + } + }, + required: [ + "type" + ], + type: "object" + }, + DummyTrackStyle: { + additionalProperties: false, + properties: { + background: { + description: "Background color of the track", + type: "string" + }, + outline: { + description: "Color of the outline of the track", + type: "string" + }, + textFontSize: { + description: "Specify the font size of the title", + type: "number" + }, + textFontWeight: { + description: "Specify the font weight of the title.", + "enum": [ + "bold", + "normal" + ], + type: "string" + }, + textStroke: { + description: "Specify the stroke color of title.", + type: "string" + }, + textStrokeWidth: { + description: "Specify the stroke width of the title.", + type: "number" + } + }, + type: "object" + }, + EventStyle: { + additionalProperties: false, + description: "The styles defined here will be applied to the target marks of mouse events, such as a point mark after the user clicks on it.", + properties: { + arrange: { + description: "Show event effects behind or in front of marks.", + "enum": [ + "behind", + "front" + ], + type: "string" + }, + color: { + description: "color of the marks when mouse events are triggered", + type: "string" + }, + opacity: { + description: "opacity of the marks when mouse events are triggered", + type: "number" + }, + stroke: { + description: "stroke color of the marks when mouse events are triggered", + type: "string" + }, + strokeOpacity: { + type: "number" + }, + strokeWidth: { + description: "stroke width of the marks when mouse events are triggered", + type: "number" + } + }, + type: "object" + }, + ExonSplitTransform: { + additionalProperties: false, + properties: { + fields: { + items: { + additionalProperties: false, + properties: { + chrField: { + type: "string" + }, + field: { + type: "string" + }, + newField: { + type: "string" + }, + type: { + $ref: "#/definitions/FieldType" + } + }, + required: [ + "field", + "type", + "newField", + "chrField" + ], + type: "object" + }, + type: "array" + }, + flag: { + additionalProperties: false, + properties: { + field: { + type: "string" + }, + value: { + type: [ + "number", + "string" + ] + } + }, + required: [ + "field", + "value" + ], + type: "object" + }, + separator: { + type: "string" + }, + type: { + "const": "exonSplit", + type: "string" + } + }, + required: [ + "type", + "separator", + "flag", + "fields" + ], + type: "object" + }, + FieldType: { + "enum": [ + "genomic", + "nominal", + "quantitative" + ], + type: "string" + }, + FilterTransform: { + anyOf: [ + { + $ref: "#/definitions/OneOfFilter" + }, + { + $ref: "#/definitions/RangeFilter" + }, + { + $ref: "#/definitions/IncludeFilter" + } + ] + }, + GenomicDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ] + }, + GenomicLengthTransform: { + additionalProperties: false, + description: "Calculate genomic length using two genomic fields", + properties: { + endField: { + type: "string" + }, + newField: { + type: "string" + }, + startField: { + type: "string" + }, + type: { + "const": "genomicLength", + type: "string" + } + }, + required: [ + "type", + "startField", + "endField", + "newField" + ], + type: "object" + }, + GffData: { + additionalProperties: false, + description: "Generic Feature Format Version 3 (GFF3) format data. It parses files that follow the [GFF3 specification](https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md).", + properties: { + attributesToFields: { + description: 'Specifies which attributes to include as a fields. GFF files have an "attributes" column which contains a list of attributes which are each tag-value pairs (`tag=value`). This option allows for specific attributes to be accessible as a field. For example, if you have an attribute called "gene_name" and you want label features on your track using those values, you can use this option so that you can use `"field": "gene_name"` in the schema.\n\nIf there is a single `value` corresponding to the `tag`, Gosling will parse that value as a string. If there are multiple `value`s corresponding to a `tag`, Gosling will parse it as a comma-separated list string. If a feature does not have a particular attribute, then the attribute value will be set to the `defaultValue`.', + items: { + additionalProperties: false, + properties: { + attribute: { + type: "string" + }, + defaultValue: { + type: "string" + } + }, + required: [ + "attribute", + "defaultValue" + ], + type: "object" + }, + type: "array" + }, + indexUrl: { + description: "URL link to the tabix index file", + type: "string" + }, + sampleLength: { + description: "The maximum number of samples to be shown on the track. Samples are uniformly randomly selected so that this threshold is not exceeded. __Default:__ `1000`", + type: "number" + }, + type: { + "const": "gff", + type: "string" + }, + url: { + description: "URL link to the GFF file", + type: "string" + } + }, + required: [ + "type", + "url", + "indexUrl" + ], + type: "object" + }, + GoslingSpec: { + anyOf: [ + { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + alignment: { + "const": "overlay", + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + description: { + type: "string" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + responsiveSize: { + $ref: "#/definitions/ResponsiveSize", + description: "Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false`" + }, + responsiveSpec: { + items: { + additionalProperties: false, + properties: { + selectivity: { + items: { + $ref: "#/definitions/SelectivityCondition" + }, + type: "array" + }, + spec: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + alignment: { + "enum": [ + "overlay", + "stack" + ], + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + tracks: { + anyOf: [ + { + items: { + $ref: "#/definitions/PartialTrack" + }, + type: "array" + }, + { + items: { + anyOf: [ + { + $ref: "#/definitions/PartialTrack" + }, + { + $ref: "#/definitions/OverlaidTracks" + } + ] + }, + type: "array" + } + ] + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + type: "object" + } + }, + required: [ + "spec", + "selectivity" + ], + type: "object" + }, + type: "array" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + tracks: { + items: { + $ref: "#/definitions/PartialTrack" + }, + type: "array" + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "alignment", + "tracks" + ], + type: "object" + }, + { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + alignment: { + "const": "stack", + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + description: { + type: "string" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + responsiveSize: { + $ref: "#/definitions/ResponsiveSize", + description: "Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false`" + }, + responsiveSpec: { + items: { + additionalProperties: false, + properties: { + selectivity: { + items: { + $ref: "#/definitions/SelectivityCondition" + }, + type: "array" + }, + spec: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + alignment: { + "enum": [ + "overlay", + "stack" + ], + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + tracks: { + anyOf: [ + { + items: { + $ref: "#/definitions/PartialTrack" + }, + type: "array" + }, + { + items: { + anyOf: [ + { + $ref: "#/definitions/PartialTrack" + }, + { + $ref: "#/definitions/OverlaidTracks" + } + ] + }, + type: "array" + } + ] + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + type: "object" + } + }, + required: [ + "spec", + "selectivity" + ], + type: "object" + }, + type: "array" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + tracks: { + items: { + anyOf: [ + { + $ref: "#/definitions/PartialTrack" + }, + { + $ref: "#/definitions/OverlaidTracks" + } + ] + }, + type: "array" + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "tracks" + ], + type: "object" + }, + { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + description: { + type: "string" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + responsiveSize: { + $ref: "#/definitions/ResponsiveSize", + description: "Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false`" + }, + responsiveSpec: { + items: { + additionalProperties: false, + properties: { + selectivity: { + items: { + $ref: "#/definitions/SelectivityCondition" + }, + type: "array" + }, + spec: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + alignment: { + "enum": [ + "overlay", + "stack" + ], + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + tracks: { + anyOf: [ + { + items: { + $ref: "#/definitions/PartialTrack" + }, + type: "array" + }, + { + items: { + anyOf: [ + { + $ref: "#/definitions/PartialTrack" + }, + { + $ref: "#/definitions/OverlaidTracks" + } + ] + }, + type: "array" + } + ] + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + type: "object" + } + }, + required: [ + "spec", + "selectivity" + ], + type: "object" + }, + type: "array" + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + title: { + type: "string" + }, + tracks: { + items: { + $ref: "#/definitions/Track" + }, + type: "array" + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "tracks" + ], + type: "object" + }, + { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + arrangement: { + description: "Specify how multiple views are arranged.", + "enum": [ + "parallel", + "serial", + "horizontal", + "vertical" + ], + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + description: { + type: "string" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + responsiveSize: { + $ref: "#/definitions/ResponsiveSize", + description: "Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false`" + }, + responsiveSpec: { + items: { + additionalProperties: false, + properties: { + selectivity: { + items: { + $ref: "#/definitions/SelectivityCondition" + }, + type: "array" + }, + spec: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + arrangement: { + description: "Specify how multiple views are arranged.", + "enum": [ + "parallel", + "serial", + "horizontal", + "vertical" + ], + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + views: { + description: "An array of view specifications", + items: { + anyOf: [ + { + $ref: "#/definitions/SingleView" + }, + { + $ref: "#/definitions/MultipleViews" + } + ] + }, + type: "array" + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + type: "object" + } + }, + required: [ + "spec", + "selectivity" + ], + type: "object" + }, + type: "array" + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + title: { + type: "string" + }, + views: { + description: "An array of view specifications", + items: { + anyOf: [ + { + $ref: "#/definitions/SingleView" + }, + { + $ref: "#/definitions/MultipleViews" + } + ] + }, + type: "array" + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "views" + ], + type: "object" + } + ] + }, + IncludeFilter: { + additionalProperties: false, + properties: { + field: { + description: "A filter is applied based on the values of the specified data field", + type: "string" + }, + include: { + description: "Check whether the value includes a substring.", + type: "string" + }, + not: { + description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', + type: "boolean" + }, + type: { + "const": "filter", + type: "string" + } + }, + required: [ + "field", + "include", + "type" + ], + type: "object" + }, + JsonData: { + additionalProperties: false, + description: "The JSON data format allows users to include data directly in the Gosling's JSON specification.", + properties: { + chromosomeField: { + description: "Specify the name of chromosome data fields.", + type: "string" + }, + genomicFields: { + description: "Specify the name of genomic data fields.", + items: { + type: "string" + }, + type: "array" + }, + genomicFieldsToConvert: { + description: "experimental", + items: { + additionalProperties: false, + properties: { + chromosomeField: { + type: "string" + }, + genomicFields: { + items: { + type: "string" + }, + type: "array" + } + }, + required: [ + "chromosomeField", + "genomicFields" + ], + type: "object" + }, + type: "array" + }, + sampleLength: { + description: "Specify the number of rows loaded from the URL.\n\n__Default:__ `1000`", + type: "number" + }, + sampleType: { + description: "Specify the way of sampling from the data if the number of rows to show exceeds `sampleLength`.\n\n__Default:__ `random`", + "enum": [ + "first", + "random" + ], + type: "string" + }, + type: { + "const": "json", + description: "Define data type.", + type: "string" + }, + values: { + description: "Values in the form of JSON.", + items: { + $ref: "#/definitions/Datum" + }, + type: "array" + } + }, + required: [ + "type", + "values" + ], + type: "object" + }, + JsonParseTransform: { + additionalProperties: false, + description: "Parse JSON Object Array and append vertically", + properties: { + baseGenomicField: { + description: "Base genomic position when parsing relative position.", + type: "string" + }, + field: { + description: "The field that contains the JSON object array.", + type: "string" + }, + genomicField: { + description: "Relative genomic position to parse.", + type: "string" + }, + genomicLengthField: { + description: "Length of genomic interval.", + type: "string" + }, + type: { + "const": "subjson", + type: "string" + } + }, + required: [ + "type", + "field", + "baseGenomicField", + "genomicField", + "genomicLengthField" + ], + type: "object" + }, + Layout: { + "enum": [ + "linear", + "circular" + ], + type: "string" + }, + LogBase: { + anyOf: [ + { + type: "number" + }, + { + "const": "e", + type: "string" + } + ] + }, + LogTransform: { + additionalProperties: false, + properties: { + base: { + $ref: "#/definitions/LogBase", + description: "If not specified, 10 is used." + }, + field: { + type: "string" + }, + newField: { + description: "If specified, store transformed values in a new field.", + type: "string" + }, + type: { + "const": "log", + type: "string" + } + }, + required: [ + "type", + "field" + ], + type: "object" + }, + LogicalOperation: { + "enum": [ + "less-than", + "lt", + "LT", + "greater-than", + "gt", + "GT", + "less-than-or-equal-to", + "ltet", + "LTET", + "greater-than-or-equal-to", + "gtet", + "GTET" + ], + type: "string" + }, + Mark: { + "enum": [ + "point", + "line", + "area", + "bar", + "rect", + "text", + "withinLink", + "betweenLink", + "rule", + "triangleLeft", + "triangleRight", + "triangleBottom", + "brush", + "header" + ], + type: "string" + }, + MatrixData: { + additionalProperties: false, + properties: { + binSize: { + description: "Determine the number of nearby cells to aggregate. __Default__: `1`", + type: "number" + }, + column: { + description: "The name of the first genomic field. __Default__: `x`", + type: "string" + }, + row: { + description: "The name of the first genomic field. __Default__: `y`", + type: "string" + }, + type: { + "const": "matrix", + type: "string" + }, + url: { + description: "URL link to the matrix data file", + type: "string" + }, + value: { + description: "The name of the value field. __Default__: `value`", + type: "string" + } + }, + required: [ + "type", + "url" + ], + type: "object" + }, + MouseEventsDeep: { + additionalProperties: false, + description: "Options for determining mouse events in detail, e.g., turning on specific events only", + properties: { + click: { + description: "Whether to enable click events.", + type: "boolean" + }, + enableMouseOverOnMultipleMarks: { + description: "Determine whether all marks underneath the mouse point should be affected by mouse over. __Default__: `false`", + type: "boolean" + }, + groupMarksByField: { + description: "Group marks using keys in a data field. This affects how a set of marks are highlighted/selected by interaction. __Default__: `undefined`", + type: "string" + }, + mouseOver: { + description: "Whether to enable mouseover events.", + type: "boolean" + }, + rangeSelect: { + description: "Whether to send range selection events.", + type: "boolean" + } + }, + type: "object" + }, + MultipleViews: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + arrangement: { + description: "Specify how multiple views are arranged.", + "enum": [ + "parallel", + "serial", + "horizontal", + "vertical" + ], + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + views: { + description: "An array of view specifications", + items: { + anyOf: [ + { + $ref: "#/definitions/SingleView" + }, + { + $ref: "#/definitions/MultipleViews" + } + ] + }, + type: "array" + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "views" + ], + type: "object" + }, + MultivecData: { + additionalProperties: false, + description: 'Two-dimensional quantitative values, one axis for genomic coordinate and the other for different samples, can be converted into HiGlass\' `"multivec"` data. For example, multiple BigWig files can be converted into a single multivec file. You can also convert sequence data (FASTA) into this format where rows will be different nucleotide bases (e.g., A, T, G, C) and quantitative values represent the frequency. Find out more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#multivec-files).', + properties: { + aggregation: { + $ref: "#/definitions/BinAggregate", + description: 'Determine aggregation function to apply within bins. __Default__: `"mean"`' + }, + binSize: { + description: "Binning the genomic interval in tiles (unit size: 256).", + type: "number" + }, + categories: { + description: "assign names of individual samples.", + items: { + type: "string" + }, + type: "array" + }, + column: { + description: 'Assign a field name of the middle position of genomic intervals. __Default__: `"position"`', + type: "string" + }, + end: { + description: 'Assign a field name of the end position of genomic intervals. __Default__: `"end"`', + type: "string" + }, + row: { + description: 'Assign a field name of samples. __Default__: `"category"`', + type: "string" + }, + start: { + description: 'Assign a field name of the start position of genomic intervals. __Default__: `"start"`', + type: "string" + }, + type: { + "const": "multivec", + type: "string" + }, + url: { + description: "Specify the URL address of the data file.", + type: "string" + }, + value: { + description: 'Assign a field name of quantitative values. __Default__: `"value"`', + type: "string" + } + }, + required: [ + "type", + "url" + ], + type: "object" + }, + OneOfFilter: { + additionalProperties: false, + properties: { + field: { + description: "A filter is applied based on the values of the specified data field", + type: "string" + }, + not: { + description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', + type: "boolean" + }, + oneOf: { + description: "Check whether the value is an element in the provided list.", + items: { + type: [ + "string", + "number", + "null" + ] + }, + type: "array" + }, + type: { + "const": "filter", + type: "string" + } + }, + required: [ + "field", + "oneOf", + "type" + ], + type: "object" + }, + Opacity: { + additionalProperties: false, + properties: { + domain: { + $ref: "#/definitions/ValueExtent", + description: "Values of the data" + }, + field: { + description: "Name of the data field", + type: "string" + }, + range: { + $ref: "#/definitions/ValueExtent", + description: "Ranges of visual channel values" + }, + type: { + description: "Specify the data type", + "enum": [ + "quantitative", + "nominal" + ], + type: "string" + } + }, + type: "object" + }, + Orientation: { + "enum": [ + "horizontal", + "vertical" + ], + type: "string" + }, + OverlaidTrack: { + additionalProperties: false, + description: "Superposing multiple tracks.", + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _overlay: { + items: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + id: { + description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + type: "object" + }, + type: "array" + }, + _renderingId: { + description: "internal", + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "_overlay" + ], + type: "object" + }, + OverlaidTracks: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + alignment: { + "const": "overlay", + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + tracks: { + items: { + $ref: "#/definitions/PartialTrack" + }, + type: "array" + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "alignment", + "tracks" + ], + type: "object" + }, + PartialTrack: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _overlay: { + items: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + id: { + description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + type: "object" + }, + type: "array" + }, + _renderingId: { + description: "internal", + type: "string" + }, + assembly: { + anyOf: [ + { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + { + "const": "unknown", + description: "No assemblies can be associated with a dummy track", + type: "string" + } + ], + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + encoding: { + additionalProperties: { + $ref: "#/definitions/Channel" + }, + type: "object" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + anyOf: [ + { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + { + "const": "linear", + description: "Only linear layout are supported at this time", + type: "string" + } + ], + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + anyOf: [ + { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + { + "const": true, + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + } + ], + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`." + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + anyOf: [ + { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + { + $ref: "#/definitions/DummyTrackStyle", + description: "Defines how the track is styled" + } + ], + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + template: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + type: { + "const": "dummy-track", + description: "Used to specify the dummy track", + type: "string" + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + anyOf: [ + { + $ref: "#/definitions/ZoomLimits" + }, + { + description: "Unused property for DummyTrack", + items: { + type: "null" + }, + maxItems: 2, + minItems: 2, + type: "array" + } + ] + } + }, + type: "object" + }, + PredefinedColors: { + "enum": [ + "viridis", + "grey", + "spectral", + "warm", + "cividis", + "bupu", + "rdbu", + "hot", + "pink" + ], + type: "string" + }, + Range: { + anyOf: [ + { + $ref: "#/definitions/ValueExtent" + }, + { + $ref: "#/definitions/PredefinedColors" + } + ] + }, + RangeFilter: { + additionalProperties: false, + properties: { + field: { + description: "A filter is applied based on the values of the specified data field", + type: "string" + }, + inRange: { + description: "Check whether the value is in a number range.", + items: { + type: "number" + }, + type: "array" + }, + not: { + description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', + type: "boolean" + }, + type: { + "const": "filter", + type: "string" + } + }, + required: [ + "field", + "inRange", + "type" + ], + type: "object" + }, + ResponsiveSize: { + anyOf: [ + { + type: "boolean" + }, + { + additionalProperties: false, + properties: { + height: { + type: "boolean" + }, + width: { + type: "boolean" + } + }, + type: "object" + } + ] + }, + Row: { + additionalProperties: false, + properties: { + clip: { + description: "Clip row when the actual y value exceeds the max value of the y scale. Used only for bar marks at the moment. __Default__: `true`", + type: "boolean" + }, + domain: { + $ref: "#/definitions/ValueExtent", + description: "Values of the data" + }, + field: { + description: "Name of the data field", + type: "string" + }, + grid: { + description: "Whether to display grid. __Default__: `false`", + type: "boolean" + }, + legend: { + description: "Whether to display legend. __Default__: `false`", + type: "boolean" + }, + padding: { + description: "Determines the size of inner white spaces on the top and bottom of individiual rows. __Default__: `0`", + type: "number" + }, + range: { + $ref: "#/definitions/ValueExtent", + description: "Determine the start and end position of rendering area of this track along vertical axis. __Default__: `[0, height]`" + }, + type: { + "const": "nominal", + description: "Specify the data type", + type: "string" + } + }, + type: "object" + }, + SelectivityCondition: { + additionalProperties: false, + properties: { + measure: { + "enum": [ + "width", + "height", + "aspectRatio" + ], + type: "string" + }, + operation: { + $ref: "#/definitions/LogicalOperation" + }, + target: { + description: "Does the condition applied to the visualization itself or its container? __Default__: `'self'`", + "enum": [ + "self", + "container" + ], + type: "string" + }, + threshold: { + description: "Threshold in the unit of pixels.", + type: "number" + } + }, + required: [ + "operation", + "measure", + "threshold" + ], + type: "object" + }, + SingleTrack: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "data", + "mark" + ], + type: "object" + }, + SingleView: { + anyOf: [ + { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + alignment: { + "const": "overlay", + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + responsiveSpec: { + items: { + additionalProperties: false, + properties: { + selectivity: { + items: { + $ref: "#/definitions/SelectivityCondition" + }, + type: "array" + }, + spec: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + alignment: { + "enum": [ + "overlay", + "stack" + ], + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + tracks: { + anyOf: [ + { + items: { + $ref: "#/definitions/PartialTrack" + }, + type: "array" + }, + { + items: { + anyOf: [ + { + $ref: "#/definitions/PartialTrack" + }, + { + $ref: "#/definitions/OverlaidTracks" + } + ] + }, + type: "array" + } + ] + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + type: "object" + } + }, + required: [ + "spec", + "selectivity" + ], + type: "object" + }, + type: "array" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + tracks: { + items: { + $ref: "#/definitions/PartialTrack" + }, + type: "array" + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "alignment", + "tracks" + ], + type: "object" + }, + { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + alignment: { + "const": "stack", + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + responsiveSpec: { + items: { + additionalProperties: false, + properties: { + selectivity: { + items: { + $ref: "#/definitions/SelectivityCondition" + }, + type: "array" + }, + spec: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + alignment: { + "enum": [ + "overlay", + "stack" + ], + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + tracks: { + anyOf: [ + { + items: { + $ref: "#/definitions/PartialTrack" + }, + type: "array" + }, + { + items: { + anyOf: [ + { + $ref: "#/definitions/PartialTrack" + }, + { + $ref: "#/definitions/OverlaidTracks" + } + ] + }, + type: "array" + } + ] + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + type: "object" + } + }, + required: [ + "spec", + "selectivity" + ], + type: "object" + }, + type: "array" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + tracks: { + items: { + anyOf: [ + { + $ref: "#/definitions/PartialTrack" + }, + { + $ref: "#/definitions/OverlaidTracks" + } + ] + }, + type: "array" + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "tracks" + ], + type: "object" + }, + { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + responsiveSpec: { + items: { + additionalProperties: false, + properties: { + selectivity: { + items: { + $ref: "#/definitions/SelectivityCondition" + }, + type: "array" + }, + spec: { + additionalProperties: false, + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + alignment: { + "enum": [ + "overlay", + "stack" + ], + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + baselineY: { + type: "number" + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + color: { + anyOf: [ + { + $ref: "#/definitions/Color" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + data: { + $ref: "#/definitions/DataDeep" + }, + dataTransform: { + items: { + $ref: "#/definitions/DataTransform" + }, + type: "array" + }, + displacement: { + $ref: "#/definitions/Displacement" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + experimental: { + additionalProperties: false, + properties: { + mouseEvents: { + anyOf: [ + { + type: "boolean" + }, + { + $ref: "#/definitions/MouseEventsDeep" + } + ] + }, + performanceMode: { + "default": false, + description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", + type: "boolean" + }, + stretchGraphics: { + description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", + type: "boolean" + }, + stretchGraphicsThreshold: { + "default": 1.5, + description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", + type: "number" + } + }, + type: "object" + }, + flipY: { + type: "boolean" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + mark: { + $ref: "#/definitions/Mark" + }, + opacity: { + anyOf: [ + { + $ref: "#/definitions/Opacity" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + overrideTemplate: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + row: { + anyOf: [ + { + $ref: "#/definitions/Row" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + size: { + anyOf: [ + { + $ref: "#/definitions/Size" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + stretch: { + type: "boolean" + }, + stroke: { + anyOf: [ + { + $ref: "#/definitions/Stroke" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + strokeWidth: { + anyOf: [ + { + $ref: "#/definitions/StrokeWidth" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + text: { + anyOf: [ + { + $ref: "#/definitions/Text" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + tooltip: { + items: { + $ref: "#/definitions/Tooltip" + }, + type: "array" + }, + tracks: { + anyOf: [ + { + items: { + $ref: "#/definitions/PartialTrack" + }, + type: "array" + }, + { + items: { + anyOf: [ + { + $ref: "#/definitions/PartialTrack" + }, + { + $ref: "#/definitions/OverlaidTracks" + } + ] + }, + type: "array" + } + ] + }, + visibility: { + items: { + $ref: "#/definitions/VisibilityCondition" + }, + type: "array" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + x: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + x1e: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + xe: { + anyOf: [ + { + $ref: "#/definitions/X" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + y1e: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + ye: { + anyOf: [ + { + $ref: "#/definitions/Y" + }, + { + $ref: "#/definitions/ChannelValue" + } + ] + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + type: "object" + } + }, + required: [ + "spec", + "selectivity" + ], + type: "object" + }, + type: "array" + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + tracks: { + items: { + $ref: "#/definitions/Track" + }, + type: "array" + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "tracks" + ], + type: "object" + } + ] + }, + Size: { + additionalProperties: false, + properties: { + domain: { + $ref: "#/definitions/ValueExtent", + description: "Values of the data" + }, + field: { + description: "Name of the data field", + type: "string" + }, + legend: { + description: "not supported: Whether to display legend. __Default__: `false`", + type: "boolean" + }, + range: { + $ref: "#/definitions/ValueExtent", + description: "Ranges of visual channel values" + }, + type: { + description: "Specify the data type", + "enum": [ + "quantitative", + "nominal" + ], + type: "string" + } + }, + type: "object" + }, + SizeVisibilityCondition: { + additionalProperties: false, + properties: { + conditionPadding: { + description: "Specify the buffer size (in pixel) of width or height when calculating the visibility.\n\n__Default__: `0`", + type: "number" + }, + measure: { + description: "Specify which aspect of the `target` will be compared to the `threshold`.", + "enum": [ + "width", + "height" + ], + type: "string" + }, + operation: { + $ref: "#/definitions/LogicalOperation", + description: 'A string that specifies the logical operation to conduct between `threshold` and the `measure` of `target`. Support\n\n- greater than : "greater-than", "gt", "GT"\n\n- less than : "less-than", "lt", "LT"\n\n- greater than or equal to : "greater-than-or-equal-to", "gtet", "GTET"\n\n- less than or equal to : "less-than-or-equal-to", "ltet", "LTET"' + }, + target: { + description: "Target specifies the object that you want to compare with the threshold.", + "enum": [ + "track", + "mark" + ], + type: "string" + }, + threshold: { + anyOf: [ + { + type: "number" + }, + { + "const": "|xe-x|", + type: "string" + } + ], + description: 'Specify the threshold as one of:\n\n- A number representing a fixed threshold in the unit of pixels;\n\n- `"|xe-x|"`, using the distance between `xe` and `x` as threshold' + }, + transitionPadding: { + description: "Specify the buffer size (in pixel) of width or height for smooth transition.\n\n__Default__: `0`", + type: "number" + } + }, + required: [ + "measure", + "operation", + "target", + "threshold" + ], + type: "object" + }, + StrConcatTransform: { + additionalProperties: false, + properties: { + fields: { + items: { + type: "string" + }, + type: "array" + }, + newField: { + type: "string" + }, + separator: { + type: "string" + }, + type: { + "const": "concat", + type: "string" + } + }, + required: [ + "type", + "fields", + "newField", + "separator" + ], + type: "object" + }, + StrReplaceTransform: { + additionalProperties: false, + properties: { + field: { + type: "string" + }, + newField: { + type: "string" + }, + replace: { + items: { + additionalProperties: false, + properties: { + from: { + type: "string" + }, + to: { + type: "string" + } + }, + required: [ + "from", + "to" + ], + type: "object" + }, + type: "array" + }, + type: { + "const": "replace", + type: "string" + } + }, + required: [ + "type", + "field", + "newField", + "replace" + ], + type: "object" + }, + Stroke: { + additionalProperties: false, + properties: { + domain: { + $ref: "#/definitions/ValueExtent", + description: "Values of the data" + }, + field: { + description: "Name of the data field", + type: "string" + }, + legend: { + description: "Whether to display legend. __Default__: `false`", + type: "boolean" + }, + range: { + $ref: "#/definitions/Range", + description: "Ranges of visual channel values" + }, + scaleOffset: { + description: "Whether to use offset of the domain proportionally. This is bound to brushes on the color legend. __Default__: `[0, 1]`", + items: { + type: "number" + }, + maxItems: 2, + minItems: 2, + type: "array" + }, + title: { + description: "Title of the legend. __Default__: `undefined`", + type: "string" + }, + type: { + description: "Specify the data type", + "enum": [ + "quantitative", + "nominal" + ], + type: "string" + } + }, + type: "object" + }, + StrokeWidth: { + additionalProperties: false, + properties: { + domain: { + $ref: "#/definitions/ValueExtent", + description: "Values of the data" + }, + field: { + description: "Name of the data field", + type: "string" + }, + range: { + $ref: "#/definitions/ValueExtent", + description: "Ranges of visual channel values" + }, + type: { + description: "Specify the data type", + "enum": [ + "quantitative", + "nominal" + ], + type: "string" + } + }, + type: "object" + }, + Style: { + additionalProperties: false, + properties: { + align: { + description: "Specify the alignment of marks. This property is currently only supported for `triangle` marks.", + "enum": [ + "left", + "right" + ], + type: "string" + }, + background: { + type: "string" + }, + backgroundOpacity: { + type: "number" + }, + brush: { + additionalProperties: false, + description: "Customize the style of the brush mark in the `rangeSelect` mouse event.", + properties: { + color: { + description: "color of the marks when mouse events are triggered", + type: "string" + }, + opacity: { + description: "opacity of the marks when mouse events are triggered", + type: "number" + }, + stroke: { + description: "stroke color of the marks when mouse events are triggered", + type: "string" + }, + strokeOpacity: { + type: "number" + }, + strokeWidth: { + description: "stroke width of the marks when mouse events are triggered", + type: "number" + } + }, + type: "object" + }, + curve: { + description: "Specify the curve of `rule` marks.", + "enum": [ + "top", + "bottom", + "left", + "right" + ], + type: "string" + }, + dashed: { + description: "Specify the pattern of dashes and gaps for `rule` marks.", + items: { + type: "number" + }, + maxItems: 2, + minItems: 2, + type: "array" + }, + dx: { + description: "Offset the position of marks in x direction. This property is currently only supported for `text` marks", + type: "number" + }, + dy: { + description: "Offset the position of marks in y direction. This property is currently only supported for `text` marks.", + type: "number" + }, + enableSmoothPath: { + description: "Whether to enable smooth paths when drawing curves.\n\n__Default__: `false`", + type: "boolean" + }, + inlineLegend: { + description: "Specify whether to show legend in a single horizontal line?", + type: "boolean" + }, + legendTitle: { + description: "If defined, show legend title on the top or left", + type: "string" + }, + linePattern: { + additionalProperties: false, + description: "Specify the pattern of dashes and gaps for `rule` marks.", + properties: { + size: { + type: "number" + }, + type: { + "enum": [ + "triangleLeft", + "triangleRight" + ], + type: "string" + } + }, + required: [ + "type", + "size" + ], + type: "object" + }, + linkConnectionType: { + description: 'Specify the connetion type of `betweenLink` marks.\n\n__Default__: `"corner"`', + "enum": [ + "straight", + "curve", + "corner" + ], + type: "string" + }, + linkMinHeight: { + description: "The minimum height of `withinLink` and `betweenLink` marks. Unit is a percentagle. __Default__: `0.5`", + type: "number" + }, + linkStyle: { + description: "The style of `withinLink` and `betweenLink` marks. __Default__: `'circular'` `'elliptical'` will be used as a default option.", + "enum": [ + "elliptical", + "circular", + "straight" + ], + type: "string" + }, + matrixExtent: { + description: 'Determine to show only one side of the diagonal in a HiGlass matrix. __Default__: `"full"`', + "enum": [ + "full", + "upper-right", + "lower-left" + ], + type: "string" + }, + mouseOver: { + $ref: "#/definitions/EventStyle", + description: "Customize visual effects of `mouseOver` events on marks." + }, + outline: { + type: "string" + }, + outlineWidth: { + type: "number" + }, + select: { + $ref: "#/definitions/EventStyle", + description: "Customize visual effects of `rangeSelect` events on marks ." + }, + textAnchor: { + description: "Specify the alignment of `text` marks to a given point.", + "enum": [ + "start", + "middle", + "end" + ], + type: "string" + }, + textFontSize: { + description: "Specify the font size of `text` marks. Can also be specified using the `size` channel option of `text` marks.", + type: "number" + }, + textFontWeight: { + description: "Specify the font weight of `text` marks.", + "enum": [ + "bold", + "normal" + ], + type: "string" + }, + textStroke: { + description: "Specify the stroke of `text` marks. Can also be specified using the `stroke` channel option of `text` marks.", + type: "string" + }, + textStrokeWidth: { + description: "Specify the stroke width of `text` marks. Can also be specified using the `strokeWidth` channel option of `text` marks.", + type: "number" + }, + withinLinkVerticalLines: { + description: "Whether to show vertical lines that connect to the baseline (axis) when `y` and `ye` are both used. __Default__: `false`", + type: "boolean" + } + }, + type: "object" + }, + SvTypeTransform: { + additionalProperties: false, + properties: { + firstBp: { + additionalProperties: false, + description: "Based on the BEDPE, infer SV types. SV types are specified as one of the following strings: DUP, TRA, DEL, t2tINV, h2hINV.", + properties: { + chrField: { + type: "string" + }, + posField: { + type: "string" + }, + strandField: { + type: "string" + } + }, + required: [ + "chrField", + "posField", + "strandField" + ], + type: "object" + }, + newField: { + type: "string" + }, + secondBp: { + additionalProperties: false, + description: "Based on the BEDPE, infer SV types. SV types are specified as one of the following strings: DUP, TRA, DEL, t2tINV, h2hINV.", + properties: { + chrField: { + type: "string" + }, + posField: { + type: "string" + }, + strandField: { + type: "string" + } + }, + required: [ + "chrField", + "posField", + "strandField" + ], + type: "object" + }, + type: { + "const": "svType", + type: "string" + } + }, + required: [ + "type", + "firstBp", + "secondBp", + "newField" + ], + type: "object" + }, + TemplateTrack: { + additionalProperties: false, + description: "Template specification that will be internally converted into `SingleTrack` for rendering.", + properties: { + _assignedHeight: { + type: "number" + }, + _assignedWidth: { + description: "Internal: Used for responsive spec", + type: "number" + }, + _invalidTrack: { + description: "internal", + type: "boolean" + }, + _renderingId: { + description: "internal", + type: "string" + }, + assembly: { + $ref: "#/definitions/Assembly", + description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' + }, + centerRadius: { + description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", + type: "number" + }, + data: { + $ref: "#/definitions/DataDeep" + }, + encoding: { + additionalProperties: { + $ref: "#/definitions/Channel" + }, + type: "object" + }, + endAngle: { + description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + height: { + description: "Specify the track height in pixels.", + type: "number" + }, + id: { + description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", + type: "string" + }, + innerRadius: { + description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', + type: "number" + }, + layout: { + $ref: "#/definitions/Layout", + description: "Specify the layout type of all tracks." + }, + linkingId: { + description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", + type: "string" + }, + orientation: { + $ref: "#/definitions/Orientation", + description: "Specify the orientation." + }, + outerRadius: { + description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', + type: "number" + }, + overlayOnPreviousTrack: { + type: "boolean" + }, + prerelease: { + additionalProperties: false, + description: "internal", + type: "object" + }, + spacing: { + description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", + type: "number" + }, + startAngle: { + description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', + type: "number" + }, + "static": { + description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", + type: "boolean" + }, + style: { + $ref: "#/definitions/Style", + description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." + }, + subtitle: { + type: "string" + }, + template: { + type: "string" + }, + title: { + description: "If defined, will show the textual label on the left-top corner of a track.", + type: "string" + }, + width: { + description: "Specify the track width in pixels.", + type: "number" + }, + xAxis: { + $ref: "#/definitions/AxisPosition", + description: "not supported" + }, + xDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic x-axis" + }, + xOffset: { + description: "Specify the x offset of views in the unit of pixels", + type: "number" + }, + yDomain: { + anyOf: [ + { + $ref: "#/definitions/DomainInterval" + }, + { + $ref: "#/definitions/DomainChrInterval" + }, + { + $ref: "#/definitions/DomainChr" + } + ], + description: "Specify the visible region of genomic y-axis" + }, + yOffset: { + description: "Specify the y offset of views in the unit of pixels", + type: "number" + }, + zoomLimits: { + $ref: "#/definitions/ZoomLimits" + } + }, + required: [ + "template", + "data" + ], + type: "object" + }, + Text: { + additionalProperties: false, + properties: { + domain: { + description: "Values of the data", + items: { + type: "string" + }, + type: "array" + }, + field: { + description: "Name of the data field", + type: "string" + }, + range: { + description: "Ranges of visual channel values", + items: { + type: "string" + }, + type: "array" + }, + type: { + description: "Specify the data type", + "enum": [ + "quantitative", + "nominal" + ], + type: "string" + } + }, + type: "object" + }, + Tooltip: { + additionalProperties: false, + properties: { + alt: { + description: "Name of the data field for showing in the tooltip. Will use the field name if not specified.", + type: "string" + }, + field: { + description: "Specifiy a data field whose value will show in the tooltip.", + type: "string" + }, + format: { + description: "format of the data value.", + type: "string" + }, + type: { + $ref: "#/definitions/FieldType", + description: "Type of the data field." + } + }, + required: [ + "field", + "type" + ], + type: "object" + }, + Track: { + anyOf: [ + { + $ref: "#/definitions/SingleTrack" + }, + { + $ref: "#/definitions/OverlaidTrack" + }, + { + $ref: "#/definitions/DataTrack" + }, + { + $ref: "#/definitions/TemplateTrack" + }, + { + $ref: "#/definitions/DummyTrack" + } + ] + }, + ValueExtent: { + anyOf: [ + { + items: { + type: "string" + }, + type: "array" + }, + { + items: { + type: "number" + }, + type: "array" + } + ] + }, + VcfData: { + additionalProperties: false, + description: "The Variant Call Format (VCF).", + properties: { + indexUrl: { + description: "URL link to the tabix index file", + type: "string" + }, + sampleLength: { + description: "The maximum number of rows to be loaded from the URL. __Default:__ `1000`", + type: "number" + }, + type: { + "const": "vcf", + type: "string" + }, + url: { + description: "URL link to the VCF file", + type: "string" + } + }, + required: [ + "type", + "url", + "indexUrl" + ], + type: "object" + }, + VectorData: { + additionalProperties: false, + description: 'One-dimensional quantitative values along genomic position (e.g., bigwig) can be converted into HiGlass\' `"vector"` format data. Find out more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#bigwig-files).', + properties: { + aggregation: { + $ref: "#/definitions/BinAggregate", + description: 'Determine aggregation function to apply within bins. __Default__: `"mean"`' + }, + binSize: { + description: "Binning the genomic interval in tiles (unit size: 256).", + type: "number" + }, + column: { + description: 'Assign a field name of the middle position of genomic intervals. __Default__: `"position"`', + type: "string" + }, + end: { + description: 'Assign a field name of the end position of genomic intervals. __Default__: `"end"`', + type: "string" + }, + start: { + description: 'Assign a field name of the start position of genomic intervals. __Default__: `"start"`', + type: "string" + }, + type: { + "const": "vector", + type: "string" + }, + url: { + description: "Specify the URL address of the data file.", + type: "string" + }, + value: { + description: 'Assign a field name of quantitative values. __Default__: `"value"`', + type: "string" + } + }, + required: [ + "type", + "url" + ], + type: "object" + }, + VisibilityCondition: { + anyOf: [ + { + $ref: "#/definitions/SizeVisibilityCondition" + }, + { + $ref: "#/definitions/ZoomLevelVisibilityCondition" + } + ] + }, + X: { + additionalProperties: false, + properties: { + aggregate: { + $ref: "#/definitions/Aggregate", + description: "Specify how to aggregate data. __Default__: `undefined`" + }, + axis: { + $ref: "#/definitions/AxisPosition", + description: "Specify where should the axis be put" + }, + domain: { + $ref: "#/definitions/GenomicDomain", + description: "Values of the data" + }, + field: { + description: "Name of the data field.", + type: "string" + }, + grid: { + description: "Whether to display grid. __Default__: `false`", + type: "boolean" + }, + legend: { + description: "Whether to display legend. __Default__: `false`", + type: "boolean" + }, + linkingId: { + description: "Users need to assign a unique linkingId for [linking views](/docs/user-interaction#linking-views) and [Brushing and Linking](/docs/user-interaction#brushing-and-linking)", + type: "string" + }, + range: { + $ref: "#/definitions/ValueExtent", + description: "Values of the visual channel." + }, + type: { + "const": "genomic", + description: "Specify the data type.", + type: "string" + } + }, + type: "object" + }, + Y: { + additionalProperties: false, + properties: { + aggregate: { + $ref: "#/definitions/Aggregate", + description: "Specify how to aggregate data. __Default__: `undefined`" + }, + axis: { + $ref: "#/definitions/AxisPosition", + description: "Specify where should the axis be put" + }, + baseline: { + description: "Custom baseline of the y-axis. __Default__: `0`", + type: [ + "string", + "number" + ] + }, + domain: { + anyOf: [ + { + $ref: "#/definitions/ValueExtent" + }, + { + $ref: "#/definitions/GenomicDomain" + } + ], + description: "Values of the data" + }, + field: { + description: "Name of the data field.", + type: "string" + }, + flip: { + description: "Whether to flip the y-axis. This is done by inverting the `range` property. __Default__: `false`", + type: "boolean" + }, + grid: { + description: "Whether to display grid. __Default__: `false`", + type: "boolean" + }, + legend: { + description: "Whether to display legend. __Default__: `false`", + type: "boolean" + }, + linkingId: { + description: "Users need to assign a unique linkingId for [linking views](/docs/user-interaction#linking-views) and [Brushing and Linking](/docs/user-interaction#brushing-and-linking)", + type: "string" + }, + range: { + $ref: "#/definitions/ValueExtent", + description: "Values of the visual channel." + }, + type: { + description: "Specify the data type.", + "enum": [ + "quantitative", + "nominal", + "genomic" + ], + type: "string" + }, + zeroBaseline: { + description: "Specify whether to use zero baseline. __Default__: `true`", + type: "boolean" + } + }, + type: "object" + }, + ZoomLevelVisibilityCondition: { + additionalProperties: false, + properties: { + conditionPadding: { + description: "Specify the buffer size (in pixel) of width or height when calculating the visibility.\n\n__Default__: `0`", + type: "number" + }, + measure: { + "const": "zoomLevel", + description: "Specify which aspect of the `target` will be compared to the `threshold`.", + type: "string" + }, + operation: { + $ref: "#/definitions/LogicalOperation", + description: 'A string that specifies the logical operation to conduct between `threshold` and the `measure` of `target`. Support\n\n- greater than : "greater-than", "gt", "GT"\n\n- less than : "less-than", "lt", "LT"\n\n- greater than or equal to : "greater-than-or-equal-to", "gtet", "GTET"\n\n- less than or equal to : "less-than-or-equal-to", "ltet", "LTET"' + }, + target: { + description: "Target specifies the object that you want to compare with the threshold.", + "enum": [ + "track", + "mark" + ], + type: "string" + }, + threshold: { + description: "Set a threshold in the unit of base pairs (bp)", + type: "number" + }, + transitionPadding: { + description: "Specify the buffer size (in pixel) of width or height for smooth transition.\n\n__Default__: `0`", + type: "number" + } + }, + required: [ + "measure", + "operation", + "target", + "threshold" + ], + type: "object" + }, + ZoomLimits: { + items: { + type: [ + "number", + "null" + ] + }, + maxItems: 2, + minItems: 2, + type: "array" + } +}; +const GoslingSchema = { + $ref: $ref$2, + $schema: $schema$2, + definitions: definitions$2 +}; +function validateGoslingSpec(spec) { + return validateSpec(GoslingSchema, spec); +} +function validateSpec(schema, spec, silence = false) { + const validate = new Ajv({ extendRefs: true }).compile(schema); + const valid = validate(spec); + let message = ""; + let details = ""; + if (validate.errors) { + details = JSON.stringify(validate.errors, null, 2); + if (!silence) { + console.warn(details); + } + message = "⚠️ Some properties are incorrectly used."; + } + return { state: valid ? "success" : "warn", message, details }; +} +function validateTrack(track) { + let valid = true; + const errorMessages = []; + const resolvedTrack = resolveSuperposedTracks(track); + resolvedTrack.forEach((spec) => { + if (!getGenomicChannelFromTrack(spec) && spec.mark !== "brush" && spec.mark !== "rule") { + errorMessages.push("genomic type is not encoded to either a x- or y- axis"); + valid = false; + } + const color = spec.color; + if (spec.mark === "line" && IsChannelDeep(color) && color.type === "quantitative") { + errorMessages.push("`line` mark cannot be used with `quantitative` value"); + valid = false; + } + }); + return { valid, errorMessages }; +} +function getGenomicChannelFromTrack(track) { + let genomicChannel = void 0; + ["x", "y", "xe", "ye", "x1", "y1", "x1e", "y1e"].reverse().forEach((channelType) => { + const channel = track[channelType]; + if (IsChannelDeep(channel) && channel.type === "genomic") { + genomicChannel = channel; + } + }); + return genomicChannel; +} +function getGenomicChannelKeyFromTrack(track) { + let genomicChannelKey = void 0; + ["x", "xe", "y", "ye", "x1", "y1", "x1e", "y1e"].reverse().forEach((channelKey) => { + const channel = track[channelKey]; + if (IsChannelDeep(channel) && channel.type === "genomic") { + genomicChannelKey = channelKey; + } + }); + return genomicChannelKey; +} +const $ref$1 = "#/definitions/Theme"; +const $schema$1 = "http://json-schema.org/draft-07/schema#"; +const definitions$1 = { + AxisStyle: { + additionalProperties: false, + properties: { + baselineColor: { + type: "string" + }, + gridColor: { + type: "string" + }, + gridStrokeDash: { + items: { + type: "number" + }, + maxItems: 2, + minItems: 2, + type: "array" + }, + gridStrokeType: { + "enum": [ + "solid", + "dashed" + ], + type: "string" + }, + gridStrokeWidth: { + type: "number" + }, + labelColor: { + type: "string" + }, + labelExcludeChrPrefix: { + description: "If `true`, labels of genomics axes excludes the chromosome prefix (e.g., `chr1` -> `1`).", + type: "boolean" + }, + labelFontFamily: { + type: "string" + }, + labelFontSize: { + type: "number" + }, + labelFontWeight: { + "enum": [ + "bold", + "normal", + "light" + ], + type: "string" + }, + labelMargin: { + description: "The margin around labels for calculating visual overlaps between labels. This is mainly used for determining the visibility of axis labels. `0` if no margin to use. Negative values (`-1`) for showing all labels even if they overlap.", + type: "number" + }, + tickColor: { + type: "string" + } + }, + type: "object" + }, + LegendStyle: { + additionalProperties: false, + properties: { + background: { + type: "string" + }, + backgroundOpacity: { + type: "number" + }, + backgroundStroke: { + type: "string" + }, + labelColor: { + type: "string" + }, + labelFontFamily: { + type: "string" + }, + labelFontSize: { + type: "number" + }, + labelFontWeight: { + "enum": [ + "bold", + "normal", + "light" + ], + type: "string" + }, + position: { + "enum": [ + "top", + "right" + ], + type: "string" + }, + tickColor: { + type: "string" + } + }, + type: "object" + }, + MarkStyle: { + additionalProperties: false, + properties: { + color: { + type: "string" + }, + nominalColorRange: { + items: { + type: "string" + }, + type: "array" + }, + opacity: { + type: "number" + }, + quantitativeSizeRange: { + items: { + type: "number" + }, + maxItems: 2, + minItems: 2, + type: "array" + }, + size: { + type: "number" + }, + stroke: { + type: "string" + }, + strokeWidth: { + type: "number" + } + }, + type: "object" + }, + RootStyle: { + additionalProperties: false, + properties: { + background: { + type: "string" + }, + mousePositionColor: { + type: "string" + }, + showMousePosition: { + type: "boolean" + }, + subtitleAlign: { + "enum": [ + "left", + "middle", + "right" + ], + type: "string" + }, + subtitleBackgroundColor: { + type: "string" + }, + subtitleColor: { + type: "string" + }, + subtitleFontFamily: { + type: "string" + }, + subtitleFontSize: { + type: "number" + }, + subtitleFontWeight: { + "enum": [ + "bold", + "normal", + "light" + ], + type: "string" + }, + titleAlign: { + "enum": [ + "left", + "middle", + "right" + ], + type: "string" + }, + titleBackgroundColor: { + type: "string" + }, + titleColor: { + type: "string" + }, + titleFontFamily: { + type: "string" + }, + titleFontSize: { + type: "number" + }, + titleFontWeight: { + "enum": [ + "bold", + "normal", + "light" + ], + type: "string" + } + }, + type: "object" + }, + Theme: { + anyOf: [ + { + $ref: "#/definitions/ThemeType" + }, + { + $ref: "#/definitions/ThemeDeep" + } + ] + }, + ThemeDeep: { + additionalProperties: false, + properties: { + area: { + $ref: "#/definitions/MarkStyle" + }, + axis: { + $ref: "#/definitions/AxisStyle" + }, + bar: { + $ref: "#/definitions/MarkStyle" + }, + base: { + $ref: "#/definitions/ThemeType" + }, + brush: { + $ref: "#/definitions/MarkStyle" + }, + legend: { + $ref: "#/definitions/LegendStyle" + }, + line: { + $ref: "#/definitions/MarkStyle" + }, + link: { + $ref: "#/definitions/MarkStyle" + }, + markCommon: { + $ref: "#/definitions/MarkStyle" + }, + point: { + $ref: "#/definitions/MarkStyle" + }, + rect: { + $ref: "#/definitions/MarkStyle" + }, + root: { + $ref: "#/definitions/RootStyle" + }, + rule: { + $ref: "#/definitions/MarkStyle" + }, + text: { + additionalProperties: false, + properties: { + color: { + type: "string" + }, + nominalColorRange: { + items: { + type: "string" + }, + type: "array" + }, + opacity: { + type: "number" + }, + quantitativeSizeRange: { + items: { + type: "number" + }, + maxItems: 2, + minItems: 2, + type: "array" + }, + size: { + type: "number" + }, + stroke: { + type: "string" + }, + strokeWidth: { + type: "number" + }, + textAnchor: { + "enum": [ + "start", + "middle", + "end" + ], + type: "string" + }, + textFontWeight: { + "enum": [ + "bold", + "normal" + ], + type: "string" + } + }, + type: "object" + }, + track: { + $ref: "#/definitions/TrackStyle" + }, + triangle: { + $ref: "#/definitions/MarkStyle" + } + }, + required: [ + "base" + ], + type: "object" + }, + ThemeType: { + "enum": [ + "light", + "dark", + "warm", + "ggplot", + "igv", + "ensembl", + "jbrowse", + "ucsc", + "washu", + "excel", + "google" + ], + type: "string" + }, + TrackStyle: { + additionalProperties: false, + properties: { + alternatingBackground: { + type: "string" + }, + background: { + type: "string" + }, + outline: { + type: "string" + }, + outlineWidth: { + type: "number" + }, + titleAlign: { + "enum": [ + "left", + "middle", + "right" + ], + type: "string" + }, + titleBackground: { + type: "string" + }, + titleColor: { + type: "string" + }, + titleFontSize: { + type: "number" + } + }, + type: "object" + } +}; +const theme_schema = { + $ref: $ref$1, + $schema: $schema$1, + definitions: definitions$1 +}; +const GoslingTemplates = [ + { + name: "gene", + channels: [ + { name: "startPosition", type: "genomic", required: true }, + { name: "endPosition", type: "genomic", required: true }, + { name: "strandColor", type: "nominal", required: true }, + { name: "strandRow", type: "nominal", required: true }, + { name: "opacity", type: "value", required: false }, + { name: "geneHeight", type: "value", required: false }, + { name: "geneLabel", type: "nominal", required: true }, + { name: "geneLabelColor", type: "nominal", required: true }, + { name: "geneLabelFontSize", type: "value", required: false }, + { name: "geneLabelStroke", type: "value", required: false }, + { name: "geneLabelStrokeThickness", type: "value", required: false }, + { name: "geneLabelOpacity", type: "value", required: false }, + { name: "type", type: "nominal", required: true } + // either 'gene' or 'exon' + ], + mapping: [ + { + dataTransform: [ + { type: "filter", base: "type", oneOf: ["gene"] }, + { type: "filter", base: "strandColor", oneOf: ["-"] } + ], + mark: "triangleLeft", + x: { base: "startPosition", type: "genomic" }, + size: { base: "geneHeight", value: 12 }, + row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, + color: { base: "strandColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, + opacity: { base: "opacity", value: 0.4 }, + style: { align: "right" } + }, + { + dataTransform: [ + { type: "filter", base: "type", oneOf: ["gene"] }, + { type: "filter", base: "strandColor", oneOf: ["+"] } + ], + mark: "triangleRight", + x: { base: "endPosition", type: "genomic" }, + size: { base: "geneHeight", value: 12 }, + row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, + color: { base: "strandColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, + opacity: { base: "opacity", value: 0.4 }, + style: { align: "left" } + }, + { + dataTransform: [{ type: "filter", base: "type", oneOf: ["exon"] }], + mark: "rect", + x: { base: "startPosition", type: "genomic" }, + xe: { base: "endPosition", type: "genomic" }, + size: { base: "geneHeight", value: 12 }, + row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, + color: { base: "strandColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, + opacity: { base: "opacity", value: 0.4 } + }, + { + dataTransform: [ + { type: "filter", base: "type", oneOf: ["gene"] }, + { type: "filter", base: "strandColor", oneOf: ["+"] } + ], + mark: "rect", + x: { base: "startPosition", type: "genomic" }, + xe: { base: "endPosition", type: "genomic" }, + row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, + color: { base: "strandColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, + opacity: { base: "opacity", value: 0.4 }, + size: { value: 3 } + // style: { + // linePattern: { type: 'triangleRight', size: 5 } + // } + }, + { + dataTransform: [ + { type: "filter", base: "type", oneOf: ["gene"] }, + { type: "filter", base: "strandColor", oneOf: ["-"] } + ], + mark: "rect", + x: { base: "startPosition", type: "genomic" }, + xe: { base: "endPosition", type: "genomic" }, + row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, + color: { base: "strandColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, + opacity: { base: "opacity", value: 0.4 }, + size: { value: 3 } + // style: { + // linePattern: { type: 'triangleLeft', size: 5 } + // } + }, + { + dataTransform: [{ type: "filter", base: "type", oneOf: ["gene"] }], + mark: "text", + text: { base: "geneLabel", type: "nominal" }, + // TODO: add dy here + x: { base: "startPosition", type: "genomic" }, + xe: { base: "endPosition", type: "genomic" }, + row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, + color: { base: "geneLabelColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, + opacity: { base: "opacity", value: 1 }, + size: { base: "geneLabelFontSize", value: 18 }, + stroke: { base: "geneLabelStroke", value: "white" }, + strokeWidth: { base: "geneLabelStrokeThickness", value: 2 }, + // TODO: how to redefine style from the users' side? (e.g., dy: -30) + visibility: [ + { + operation: "less-than", + measure: "width", + threshold: "|xe-x|", + transitionPadding: 10, + target: "mark" + } + ] + } + ] + }, + { + name: "ideogram", + channels: [ + { name: "startPosition", type: "genomic", required: true }, + { name: "endPosition", type: "genomic", required: true }, + { name: "chrHeight", type: "value", required: false }, + // https://eweitz.github.io/ideogram/ + { name: "name", type: "nominal", required: true }, + { name: "stainBackgroundColor", type: "nominal", required: true }, + { name: "stainLabelColor", type: "nominal", required: true }, + { name: "stainStroke", type: "value", required: false }, + { name: "stainStrokeWidth", type: "value", required: false } + ], + mapping: [ + { + mark: "rect", + dataTransform: [{ type: "filter", base: "stainBackgroundColor", oneOf: ["acen"], not: true }], + color: { + base: "stainBackgroundColor", + type: "nominal", + domain: ["gneg", "gpos25", "gpos50", "gpos75", "gpos100", "gvar", "acen"], + range: ["white", "lightgray", "gray", "gray", "black", "#7B9CC8", "#DC4542"] + }, + size: { base: "chrHeight", value: 18 }, + x: { base: "startPosition", type: "genomic" }, + xe: { base: "endPosition", type: "genomic" }, + stroke: { base: "stainStroke", value: "gray" }, + strokeWidth: { base: "stainStrokeWidth", value: 0.3 } + }, + { + mark: "triangleRight", + dataTransform: [ + { type: "filter", base: "stainBackgroundColor", oneOf: ["acen"] }, + { type: "filter", base: "name", include: "q" } + ], + color: { + base: "stainBackgroundColor", + type: "nominal", + domain: ["gneg", "gpos25", "gpos50", "gpos75", "gpos100", "gvar", "acen"], + range: ["white", "lightgray", "gray", "gray", "black", "#7B9CC8", "#DC4542"] + }, + size: { base: "chrHeight", value: 18 }, + x: { base: "startPosition", type: "genomic" }, + xe: { base: "endPosition", type: "genomic" }, + stroke: { base: "stainStroke", value: "gray" }, + strokeWidth: { base: "stainStrokeWidth", value: 0.3 } + }, + { + mark: "triangleLeft", + dataTransform: [ + { type: "filter", base: "stainBackgroundColor", oneOf: ["acen"] }, + { type: "filter", base: "name", include: "p" } + ], + color: { + base: "stainBackgroundColor", + type: "nominal", + domain: ["gneg", "gpos25", "gpos50", "gpos75", "gpos100", "gvar", "acen"], + range: ["white", "lightgray", "gray", "gray", "black", "#7B9CC8", "#DC4542"] + }, + size: { base: "chrHeight", value: 18 }, + x: { base: "startPosition", type: "genomic" }, + xe: { base: "endPosition", type: "genomic" }, + stroke: { base: "stainStroke", value: "gray" }, + strokeWidth: { base: "stainStrokeWidth", value: 0.3 } + }, + { + mark: "text", + dataTransform: [{ type: "filter", base: "stainLabelColor", oneOf: ["acen"], not: true }], + color: { + base: "stainLabelColor", + type: "nominal", + domain: ["gneg", "gpos25", "gpos50", "gpos75", "gpos100", "gvar"], + range: ["black", "black", "black", "black", "white", "black"] + }, + text: { base: "name", type: "nominal" }, + x: { base: "startPosition", type: "genomic" }, + xe: { base: "endPosition", type: "genomic" }, + visibility: [ + { + operation: "less-than", + measure: "width", + threshold: "|xe-x|", + transitionPadding: 10, + target: "mark" + } + ] + } + ] + }, + { + name: "sequence", + channels: [ + { name: "startPosition", type: "genomic", required: true }, + { name: "endPosition", type: "genomic", required: true }, + { name: "barLength", type: "quantitative", required: true }, + { name: "baseBackground", type: "nominal", required: true }, + { name: "baseLabelColor", type: "nominal", required: true }, + { name: "baseLabelFontSize", type: "value", required: false } + ], + mapping: [ + { + mark: "bar", + // x: { base: 'position', type: 'genomic' }, + x: { base: "startPosition", type: "genomic" }, + xe: { base: "endPosition", type: "genomic" }, + y: { base: "barLength", type: "quantitative", axis: "none" }, + color: { base: "baseBackground", type: "nominal", domain: ["A", "T", "G", "C"] } + }, + { + dataTransform: [{ type: "filter", base: "barLength", oneOf: [0], not: true }], + mark: "text", + x: { base: "startPosition", type: "genomic" }, + xe: { base: "endPosition", type: "genomic" }, + color: { base: "baseLabelColor", type: "nominal", domain: ["A", "T", "G", "C"], range: ["white"] }, + text: { base: "baseBackground", type: "nominal" }, + size: { base: "baseLabelFontSize", value: 18 }, + visibility: [ + { + operation: "less-than", + measure: "width", + threshold: "|xe-x|", + transitionPadding: 30, + target: "mark" + }, + { + operation: "LT", + measure: "zoomLevel", + threshold: 10, + target: "track" + } + ] + } + ] + } +]; +function replaceTrackTemplates(spec, templates) { + traverseTracks(spec, (t, i, ts) => { + var _a, _b; + if (!IsTemplateTrack(t)) { + return; + } + const { template: name2 } = t; + const templateDef = templates.find((d) => d.name === name2); + if (!templateDef) { + t._invalidTrack = true; + console.warn(`There is no track template named '${name2}'`); + return; + } + let isValid = true; + templateDef.channels.forEach((d) => { + if (d.required && (!t.encoding || !(d.name in t.encoding))) { + isValid = false; + console.warn(`A template spec ('${name2}') does not contain a required channel, ${d.name}`); + } + }); + if (!isValid) { + t._invalidTrack = true; + return; + } + const viewBase = JSON.parse(JSON.stringify(t)); + if ("encoding" in viewBase) { + delete viewBase.encoding; + } + const convertedView = { + ...viewBase, + alignment: "overlay", + tracks: [], + width: (_a = t.width) != null ? _a : 100, + height: (_b = t.height) != null ? _b : 100 + }; + templateDef.mapping.forEach((singleTrackMappingDef) => { + const convertedTrack = { + data: t.data, + mark: singleTrackMappingDef.mark + }; + const { dataTransform } = singleTrackMappingDef; + if (dataTransform) { + dataTransform.map((dataTramsformMap) => { + const baseChannelName = dataTramsformMap.base; + if (baseChannelName && t.encoding && baseChannelName in t.encoding && "field" in t.encoding[baseChannelName]) { + delete dataTramsformMap.base; + dataTramsformMap.field = t.encoding[baseChannelName].field; + } + }); + } + const encodingSpec = t.encoding; + if (!encodingSpec) { + Object.keys(singleTrackMappingDef).filter((k) => k !== "mark").forEach((channelKey) => { + const channelMap = JSON.parse(JSON.stringify(singleTrackMappingDef[channelKey])); + if ("base" in channelMap) { + delete channelMap.base; + } + convertedTrack[channelKey] = channelMap; + }); + } else { + Object.keys(singleTrackMappingDef).filter((k) => k !== "mark").forEach((channelKey) => { + const channelMap = JSON.parse(JSON.stringify(singleTrackMappingDef[channelKey])); + if ("base" in channelMap) { + const baseChannelName = channelMap.base; + if (baseChannelName in encodingSpec) { + const base = JSON.parse(JSON.stringify(encodingSpec[baseChannelName])); + delete channelMap.base; + const newChannelSpec = Object.assign(channelMap, JSON.parse(JSON.stringify(base))); + convertedTrack[channelKey] = newChannelSpec; + } else { + delete channelMap.base; + convertedTrack[channelKey] = channelMap; + } + } else { + convertedTrack[channelKey] = channelMap; + } + }); + } + convertedView.tracks.push(convertedTrack); + }); + ts[i] = convertedView; + }); +} +const NOMINAL_COLOR$a = [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + /*'#000000'*/ +]; +const LightThemeMarkCommonStyle$1 = { + color: NOMINAL_COLOR$a[0], + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR$a, + quantitativeSizeRange: [2, 6] +}; +const light = { + base: "light", + root: { + background: "white", + titleColor: "black", + titleBackgroundColor: "transparent", + titleFontSize: 18, + titleFontFamily: "Arial", + titleAlign: "left", + titleFontWeight: "bold", + subtitleColor: "gray", + subtitleBackgroundColor: "transparent", + subtitleFontSize: 16, + subtitleFontFamily: "Arial", + subtitleFontWeight: "normal", + subtitleAlign: "left", + showMousePosition: true, + mousePositionColor: "#000000" + }, + track: { + background: "transparent", + alternatingBackground: "transparent", + titleColor: "black", + titleBackground: "white", + titleFontSize: 24, + titleAlign: "left", + outline: "black", + outlineWidth: 1 + }, + legend: { + position: "top", + background: "white", + backgroundOpacity: 0.7, + labelColor: "black", + labelFontSize: 12, + labelFontWeight: "normal", + labelFontFamily: "Arial", + backgroundStroke: "#DBDBDB", + tickColor: "black" + }, + axis: { + tickColor: "black", + labelColor: "black", + labelMargin: 5, + labelExcludeChrPrefix: false, + labelFontSize: 12, + labelFontWeight: "normal", + labelFontFamily: "Arial", + baselineColor: "black", + gridColor: "#E3E3E3", + gridStrokeWidth: 1, + gridStrokeType: "solid", + gridStrokeDash: [4, 4] + }, + markCommon: { + ...LightThemeMarkCommonStyle$1 + }, + point: { + ...LightThemeMarkCommonStyle$1, + size: 3 + }, + rect: { + ...LightThemeMarkCommonStyle$1 + }, + triangle: { + ...LightThemeMarkCommonStyle$1 + }, + area: { + ...LightThemeMarkCommonStyle$1 + }, + line: { + ...LightThemeMarkCommonStyle$1 + }, + bar: { + ...LightThemeMarkCommonStyle$1 + }, + rule: { + ...LightThemeMarkCommonStyle$1, + strokeWidth: 1 + }, + link: { + ...LightThemeMarkCommonStyle$1, + strokeWidth: 1 + }, + text: { + ...LightThemeMarkCommonStyle$1, + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + ...LightThemeMarkCommonStyle$1, + color: "gray", + opacity: 0.3, + stroke: "black", + strokeWidth: 1 + } +}; +const NOMINAL_COLOR$9 = [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + /*'#000000'*/ +]; +const LightThemeMarkCommonStyle = { + color: NOMINAL_COLOR$9[0], + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR$9, + quantitativeSizeRange: [2, 6] +}; +const DarkThemeMarkCommonStyle = { ...LightThemeMarkCommonStyle, stroke: "white" }; +const dark = { + base: "dark", + root: { + background: "black", + titleColor: "white", + titleBackgroundColor: "transparent", + titleFontSize: 18, + titleFontFamily: "Arial", + titleAlign: "middle", + titleFontWeight: "bold", + subtitleColor: "lightgray", + subtitleBackgroundColor: "transparent", + subtitleFontSize: 16, + subtitleFontFamily: "Arial", + subtitleAlign: "middle", + subtitleFontWeight: "normal", + showMousePosition: true, + mousePositionColor: "#FFFFFF" + }, + track: { + background: "transparent", + alternatingBackground: "transparent", + titleColor: "white", + titleBackground: "black", + titleFontSize: 18, + titleAlign: "left", + outline: "white", + outlineWidth: 1 + }, + legend: { + position: "right", + background: "black", + backgroundOpacity: 0.7, + labelColor: "white", + labelFontSize: 12, + labelFontWeight: "normal", + labelFontFamily: "Arial", + backgroundStroke: "#DBDBDB", + tickColor: "white" + }, + axis: { + tickColor: "white", + labelMargin: 5, + labelExcludeChrPrefix: false, + labelColor: "white", + labelFontSize: 10, + labelFontWeight: "normal", + labelFontFamily: "Arial", + baselineColor: "white", + gridColor: "gray", + gridStrokeWidth: 1, + gridStrokeType: "solid", + gridStrokeDash: [4, 4] + }, + markCommon: { + ...DarkThemeMarkCommonStyle + }, + point: { + ...DarkThemeMarkCommonStyle, + size: 3 + }, + rect: { + ...DarkThemeMarkCommonStyle + }, + triangle: { + ...DarkThemeMarkCommonStyle + }, + area: { + ...DarkThemeMarkCommonStyle + }, + line: { + ...DarkThemeMarkCommonStyle + }, + bar: { + ...DarkThemeMarkCommonStyle + }, + rule: { + ...DarkThemeMarkCommonStyle, + strokeWidth: 1 + }, + link: { + ...DarkThemeMarkCommonStyle, + strokeWidth: 1 + }, + text: { + ...DarkThemeMarkCommonStyle, + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + ...DarkThemeMarkCommonStyle, + color: "lightgray", + opacity: 0.3, + stroke: "white", + strokeWidth: 1 + } +}; +const NOMINAL_COLOR$8 = ["#D19000", "#008F67", "#005F96", "#B86E97", "#B55100", "#4793BF", "#C9C03"]; +const WarmThemeMarkCommonStyle = { + color: NOMINAL_COLOR$8[0], + size: 1, + stroke: "#3C3C3C", + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR$8, + quantitativeSizeRange: [2, 6] +}; +const warm = { + base: "warm", + root: { + background: "#FFF8E8", + titleColor: "#3C3C3C", + subtitleColor: "gray", + showMousePosition: true, + mousePositionColor: "#3C3C3C" + }, + track: { + titleColor: "#3C3C3C", + titleBackground: "#FFF8E8", + outline: "#3C3C3C", + outlineWidth: 1 + }, + legend: { + background: "#FFF8E8", + backgroundOpacity: 0.7, + labelColor: "#3C3C3C", + backgroundStroke: "#3C3C3C", + tickColor: "3C3C3C" + }, + axis: { + tickColor: "#3C3C3C", + labelColor: "#3C3C3C", + baselineColor: "#3C3C3C", + gridColor: "#E3E3E3", + gridStrokeWidth: 1 + }, + markCommon: { + ...WarmThemeMarkCommonStyle + }, + point: { + ...WarmThemeMarkCommonStyle, + size: 3 + }, + rect: { + ...WarmThemeMarkCommonStyle + }, + triangle: { + ...WarmThemeMarkCommonStyle + }, + area: { + ...WarmThemeMarkCommonStyle + }, + line: { + ...WarmThemeMarkCommonStyle + }, + bar: { + ...WarmThemeMarkCommonStyle + }, + rule: { + ...WarmThemeMarkCommonStyle, + strokeWidth: 1 + }, + link: { + ...WarmThemeMarkCommonStyle, + strokeWidth: 1 + }, + text: { + ...WarmThemeMarkCommonStyle, + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + ...WarmThemeMarkCommonStyle, + color: "lightgray", + opacity: 0.3, + stroke: "#3C3C3C", + strokeWidth: 1 + } +}; +const NOMINAL_COLOR$7 = ["#F66A62", "#05B230", "#5692FF", "#D764D6", "#86E9D4", "#6E6AD7", "#FFFB00"]; +const GgplotThemeMarkCommonStyle = { + color: NOMINAL_COLOR$7[0], + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR$7, + quantitativeSizeRange: [2, 6] +}; +const ggplot = { + base: "ggplot", + root: { + background: "white", + titleColor: "black", + titleFontSize: 18, + titleFontFamily: "Helvetica", + titleAlign: "middle", + titleFontWeight: "bold", + titleBackgroundColor: "white", + subtitleColor: "gray", + subtitleFontSize: 14, + subtitleFontFamily: "Helvetica", + subtitleAlign: "middle", + subtitleFontWeight: "light", + subtitleBackgroundColor: "white", + showMousePosition: true, + mousePositionColor: "black" + }, + track: { + background: "#e8e8e8", + alternatingBackground: "#d1d1d1", + titleColor: "black", + titleBackground: "white", + //titleFontSize:'', + //titleAlign:'', + outline: "black", + outlineWidth: 2 + }, + legend: { + position: "right", + background: "#e8e8e8", + backgroundOpacity: 1, + labelColor: "black", + backgroundStroke: "#e8e8e8", + tickColor: "white" + //,labelFontSize: '', + //labelFontWeight: '', + //labelFontFamily: '' + }, + axis: { + tickColor: "white", + labelColor: "black", + //labelFontSize: '', + //labelFontWeight: '', + //labelFontFamily: '', + baselineColor: "#e8e8e8", + gridColor: "white", + gridStrokeWidth: 2 + //,gridStrokeType: '', + //gridStrokeDash: + }, + markCommon: { + ...GgplotThemeMarkCommonStyle + }, + point: { + ...GgplotThemeMarkCommonStyle, + size: 3 + }, + rect: { + ...GgplotThemeMarkCommonStyle + }, + triangle: { + ...GgplotThemeMarkCommonStyle + }, + area: { + ...GgplotThemeMarkCommonStyle + }, + line: { + ...GgplotThemeMarkCommonStyle + }, + bar: { + ...GgplotThemeMarkCommonStyle + }, + rule: { + ...GgplotThemeMarkCommonStyle, + strokeWidth: 1 + }, + link: { + ...GgplotThemeMarkCommonStyle, + strokeWidth: 1 + }, + text: { + ...GgplotThemeMarkCommonStyle, + textAnchor: "middle", + textFontWeight: "bold" + }, + brush: { + ...GgplotThemeMarkCommonStyle, + color: "black", + opacity: 0.3, + stroke: "black", + strokeWidth: 1 + } +}; +const NOMINAL_COLOR$6 = ["#37E649", "#ED2D44", "#AEAFEA", "#EBAEAE", "#CE7B3D", "#8743E0", "#5233F0"]; +const IGVThemeMarkCommonStyle = { + color: NOMINAL_COLOR$6[0], + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR$6, + quantitativeSizeRange: [2, 6] +}; +const igv = { + base: "igv", + root: { + background: "white", + titleColor: "white", + //titleFontSize:'', + //titleFontFamily:'', + titleAlign: "left", + titleFontWeight: "bold", + titleBackgroundColor: "#5f5f5f", + subtitleColor: "#3b3b3b", + //subtitleFontSize:'', + //subtitleFontFamily:'', + subtitleAlign: "left", + subtitleFontWeight: "bold", + subtitleBackgroundColor: "#c4c4c4", + showMousePosition: true, + mousePositionColor: "black" + }, + track: { + background: "white", + alternatingBackground: "#e8e8e8", + titleColor: "white", + titleBackground: "#5F5F5F", + //titleFontSize:'', + //titleAlign:'', + outline: "#5F5F5F", + outlineWidth: 1 + }, + legend: { + position: "top", + background: "white", + backgroundOpacity: 1, + labelColor: "black", + //labelFontSize: '', + //labelFontWeight: '', + //labelFontFamily: '', + backgroundStroke: "black", + tickColor: "black" + }, + axis: { + tickColor: "black", + labelColor: "black", + //labelFontSize: '', + //labelFontWeight: '', + //labelFontFamily: '', + //baselineColor: '#E6E6E6', + baselineColor: "white", + gridColor: "transparent", + gridStrokeWidth: 0 + //gridStrokeType: '', + //gridStrokeDash: + }, + markCommon: { + ...IGVThemeMarkCommonStyle + }, + point: { + ...IGVThemeMarkCommonStyle, + size: 3 + }, + rect: { + ...IGVThemeMarkCommonStyle + }, + triangle: { + ...IGVThemeMarkCommonStyle + }, + area: { + ...IGVThemeMarkCommonStyle + }, + line: { + ...IGVThemeMarkCommonStyle + }, + bar: { + ...IGVThemeMarkCommonStyle + }, + rule: { + ...IGVThemeMarkCommonStyle, + strokeWidth: 1 + }, + link: { + ...IGVThemeMarkCommonStyle, + strokeWidth: 1 + }, + text: { + ...IGVThemeMarkCommonStyle, + textAnchor: "middle", + textFontWeight: "bold" + }, + brush: { + ...IGVThemeMarkCommonStyle, + color: "white", + opacity: 0.3, + stroke: "black", + strokeWidth: 1 + } +}; +const NOMINAL_COLOR$5 = [ + "#CD9B1D", + "#8A668B", + "#40E0D0", + "#FF6969", + "#666666", + "#FAC902", + "#FE0000", + "#CC96CD", + "#D9D9D9" + /*'#000000'*/ +]; +const EnsemblThemeMarkCommonStyle = { + color: NOMINAL_COLOR$5[0], + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR$5, + quantitativeSizeRange: [2, 6] +}; +const ensembl = { + base: "ensembl", + root: { + background: "white", + titleColor: "#494949", + titleFontSize: 24, + titleFontFamily: "GGX88", + titleAlign: "left", + titleFontWeight: "bold", + titleBackgroundColor: "white", + subtitleColor: "white", + subtitleFontSize: 19, + subtitleFontFamily: "GGX88", + subtitleAlign: "left", + subtitleFontWeight: "normal", + subtitleBackgroundColor: "#7B8BAF", + mousePositionColor: "#FE0000", + showMousePosition: true + }, + track: { + background: "white", + alternatingBackground: "#fffdf7", + titleColor: "black", + titleBackground: "white", + titleAlign: "left", + outline: "#7B8BAF", + outlineWidth: 2 + }, + legend: { + tickColor: "black", + labelColor: "black", + //labelFontSize: , + labelFontWeight: "normal", + labelFontFamily: "GGX88", + background: "white", + backgroundOpacity: 2, + backgroundStroke: "lightgray" + }, + axis: { + tickColor: "black", + labelColor: "black", + //labelFontSize: , + //labelFontWeight: '', + labelFontFamily: "GGX88", + baselineColor: "black", + gridColor: "#7B8BAF", + gridStrokeWidth: 2 + //gridStrokeType: '', + //gridStrokeDash: + }, + markCommon: { + ...EnsemblThemeMarkCommonStyle + }, + point: { + ...EnsemblThemeMarkCommonStyle, + /*color: NOMINAL_COLOR[0], + stroke: 'black', + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR, + quantitativeSizeRange: [2, 6]*/ + size: 3 + }, + rect: { + ...EnsemblThemeMarkCommonStyle + /*color: NOMINAL_COLOR[0], + size: 1, + stroke: 'black', + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR, + quantitativeSizeRange: [2, 6]*/ + }, + triangle: { + ...EnsemblThemeMarkCommonStyle + /*color: NOMINAL_COLOR[0], + size: 1, + stroke: 'black', + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR, + quantitativeSizeRange: [2, 6]*/ + }, + area: { + ...EnsemblThemeMarkCommonStyle + /*color: NOMINAL_COLOR[0], + size: 1, + stroke: 'black', + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR, + quantitativeSizeRange: [2, 6]*/ + }, + line: { + ...EnsemblThemeMarkCommonStyle + /*color: NOMINAL_COLOR[0], + size: 1, + stroke: 'black', + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR, + quantitativeSizeRange: [2, 6]*/ + }, + bar: { + ...EnsemblThemeMarkCommonStyle + /*color: NOMINAL_COLOR[0], + size: 1, + stroke: 'black', + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR, + quantitativeSizeRange: [2, 6]*/ + }, + rule: { + ...EnsemblThemeMarkCommonStyle, + /*color: NOMINAL_COLOR[0], + size: 1, + stroke: 'black', + opacity: 1, + nominalColorRange: NOMINAL_COLOR, + quantitativeSizeRange: [2, 6]*/ + strokeWidth: 1 + }, + link: { + ...EnsemblThemeMarkCommonStyle, + /*color: NOMINAL_COLOR[0], + size: 1, + stroke: 'black', + opacity: 1, + nominalColorRange: NOMINAL_COLOR, + quantitativeSizeRange: [2, 6]*/ + strokeWidth: 1 + }, + text: { + ...EnsemblThemeMarkCommonStyle, + /*color: NOMINAL_COLOR[0], + size: 1, + stroke: 'black', + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR, + quantitativeSizeRange: [2, 6]*/ + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + ...EnsemblThemeMarkCommonStyle, + /*size: 1, + nominalColorRange: NOMINAL_COLOR, + quantitativeSizeRange: [2, 6]*/ + color: "gray", + opacity: 0.3, + stroke: "black", + strokeWidth: 1 + } +}; +const NOMINAL_COLOR$4 = [ + "#3A62FE", + "#F85353", + "#3A62FE", + "#F85353", + "#DCA326", + "#03BF06", + "#BABABA" + /*'#000000'*/ +]; +const JBrowseThemeMarkCommonStyle = { + color: NOMINAL_COLOR$4[0], + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR$4, + quantitativeSizeRange: [2, 6] +}; +const jbrowse = { + base: "jbrowse", + root: { + background: "white", + titleColor: "white", + titleFontSize: 20, + titleFontFamily: "Roboto", + titleAlign: "middle", + titleFontWeight: "normal", + titleBackgroundColor: "#0b243f", + subtitleColor: "white", + subtitleFontSize: 18, + subtitleFontFamily: "Roboto", + subtitleAlign: "middle", + subtitleFontWeight: "normal", + subtitleBackgroundColor: "#732162", + showMousePosition: true, + mousePositionColor: "#000000" + }, + track: { + background: "white", + alternatingBackground: "white", + //titleFontSize:'', + titleAlign: "middle", + titleColor: "white", + titleBackground: "#0B243F", + outline: "black", + outlineWidth: 1 + }, + legend: { + position: "top", + background: "white", + backgroundOpacity: 0.7, + labelColor: "#DCA326", + //labelFontSize: '', + labelFontWeight: "bold", + labelFontFamily: "Roboto", + backgroundStroke: "#black", + tickColor: "black" + }, + axis: { + tickColor: "black", + labelColor: "#DCA326", + //labelFontSize: '', + labelFontWeight: "bold", + labelFontFamily: "Roboto", + baselineColor: "black", + gridColor: "#c5d5d9", + gridStrokeWidth: 1 + //, + //gridStrokeType: '', + //gridStrokeDash: + }, + markCommon: { + ...JBrowseThemeMarkCommonStyle + }, + point: { + ...JBrowseThemeMarkCommonStyle, + size: 3 + }, + rect: { + ...JBrowseThemeMarkCommonStyle + }, + triangle: { + ...JBrowseThemeMarkCommonStyle + }, + area: { + ...JBrowseThemeMarkCommonStyle + }, + line: { + ...JBrowseThemeMarkCommonStyle + }, + bar: { + ...JBrowseThemeMarkCommonStyle + }, + rule: { + ...JBrowseThemeMarkCommonStyle, + strokeWidth: 1 + }, + link: { + ...JBrowseThemeMarkCommonStyle, + strokeWidth: 1 + }, + text: { + ...JBrowseThemeMarkCommonStyle, + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + ...JBrowseThemeMarkCommonStyle, + color: "#c5d5d9", + opacity: 0.3, + stroke: "black", + strokeWidth: 1 + } +}; +const NOMINAL_COLOR$3 = [ + "#3A5FCD", + "#FFA54E", + "#8FBC8F", + "#B6709B", + "#EE6A50", + "#CCB79E", + "#DADA8F", + "#00CDCC", + "#EED5D2", + "#CD8EDD", + "#9ACD31", + "#D1BEA8", + "#FFB6C0" + /*'#000000'*/ +]; +const UCSCThemeMarkCommonStyle = { + color: NOMINAL_COLOR$3[0], + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR$3, + quantitativeSizeRange: [2, 6] +}; +const ucsc = { + base: "ucsc", + root: { + background: "white", + titleColor: "white", + titleFontSize: 22, + //titleFontFamily:'', + titleAlign: "middle", + titleFontWeight: "bold", + titleBackgroundColor: "#00457c", + subtitleColor: "black", + //subtitleFontSize:'', + //subtitleFontFamily:'', + subtitleAlign: "middle", + subtitleFontWeight: "bold", + subtitleBackgroundColor: "white", + showMousePosition: true, + mousePositionColor: "#FE0000" + }, + track: { + background: "white", + alternatingBackground: "#e3f7fc", + titleColor: "#3A5FCD", + titleBackground: "white", + //titleFontSize:'', + //titleAlign:'', + outline: "black", + outlineWidth: 1 + }, + legend: { + position: "top", + background: "white", + backgroundOpacity: 0.7, + labelColor: "black", + //labelFontSize: '', + labelFontWeight: "bold", + //labelFontFamily: '', + backgroundStroke: "#DBDBDB", + tickColor: "black" + }, + axis: { + tickColor: "black", + labelColor: "#3A5FCD", + //labelFontSize: '', + labelFontWeight: "bold", + //labelFontFamily: '', + baselineColor: "black", + gridColor: "#E3E3E3", + gridStrokeWidth: 1 + //, + //gridStrokeType: '', + //gridStrokeDash: + }, + markCommon: { + ...UCSCThemeMarkCommonStyle + }, + point: { + ...UCSCThemeMarkCommonStyle, + size: 3 + }, + rect: { + ...UCSCThemeMarkCommonStyle + }, + triangle: { + ...UCSCThemeMarkCommonStyle + }, + area: { + ...UCSCThemeMarkCommonStyle + }, + line: { + ...UCSCThemeMarkCommonStyle + }, + bar: { + ...UCSCThemeMarkCommonStyle + }, + rule: { + ...UCSCThemeMarkCommonStyle, + strokeWidth: 1 + }, + link: { + ...UCSCThemeMarkCommonStyle, + strokeWidth: 1 + }, + text: { + ...UCSCThemeMarkCommonStyle, + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + ...UCSCThemeMarkCommonStyle, + color: "gray", + opacity: 0.3, + stroke: "black", + strokeWidth: 1 + } +}; +const NOMINAL_COLOR$2 = [ + "#6E12AC", + "#15C250", + "#E70FB1", + "#FF8E55", + "#A3B8F3", + "#DE5E59", + "#77AAAA", + "#F5CCCA" + /*'#000000'*/ +]; +const WashUThemeMarkCommonStyle = { + color: NOMINAL_COLOR$2[0], + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR$2, + quantitativeSizeRange: [2, 6] +}; +const washu = { + base: "washu", + root: { + background: "white", + titleColor: "gray", + //titleFontSize:16, + //titleFontFamily:'', + titleAlign: "left", + titleFontWeight: "normal", + titleBackgroundColor: "white", + subtitleColor: "lightgray", + //subtitleFontSize:12, + //subtitleFontFamily:'', + subtitleAlign: "left", + subtitleFontWeight: "light", + subtitleBackgroundColor: "white", + showMousePosition: true, + mousePositionColor: "#000000" + }, + track: { + background: "white", + //alternatingBackground:'', + titleColor: "gray", + titleBackground: "white", + //titleFontSize:'', + titleAlign: "left", + outline: "gray", + outlineWidth: 1 + }, + legend: { + background: "white", + backgroundOpacity: 0.5, + labelColor: "gray", + //labelFontSize: '', + labelFontWeight: "light", + //labelFontFamily: '', + backgroundStroke: "#DBDBDB", + tickColor: "gray" + }, + axis: { + tickColor: "lightgray", + labelColor: "gray", + //labelFontSize: '', + labelFontWeight: "light", + //labelFontFamily: '', + baselineColor: "gray", + gridColor: "transparent", + gridStrokeWidth: 0 + //, + //gridStrokeType: '', + //gridStrokeDash: + }, + markCommon: { + ...WashUThemeMarkCommonStyle + }, + point: { + ...WashUThemeMarkCommonStyle, + size: 3 + }, + rect: { + ...WashUThemeMarkCommonStyle + }, + triangle: { + ...WashUThemeMarkCommonStyle + }, + area: { + ...WashUThemeMarkCommonStyle + }, + line: { + ...WashUThemeMarkCommonStyle + }, + bar: { + ...WashUThemeMarkCommonStyle + }, + rule: { + ...WashUThemeMarkCommonStyle, + strokeWidth: 1 + }, + link: { + ...WashUThemeMarkCommonStyle, + strokeWidth: 1 + }, + text: { + ...WashUThemeMarkCommonStyle, + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + ...WashUThemeMarkCommonStyle, + color: "gray", + opacity: 0.3, + stroke: "gray", + strokeWidth: 1 + } +}; +const NOMINAL_COLOR$1 = [ + "#ED7D31", + "#4472C4", + "#FFC207", + "#76AE4F", + "#9E480E", + "#A5A5A5", + "#4472C4", + "#264378", + "#76AE4F", + "#5B9CD5" + /*'#000000'*/ +]; +const ExcelThemeMarkCommonStyle = { + color: NOMINAL_COLOR$1[0], + size: 1, + stroke: "#5A5A5A", + strokeWidth: 0, + opacity: 1, + nominalColorRange: NOMINAL_COLOR$1, + quantitativeSizeRange: [2, 6] +}; +const excel = { + base: "excel", + root: { + background: "white", + titleColor: "#5A5A5A", + titleFontSize: 30, + titleFontFamily: "Calibri", + titleAlign: "middle", + titleFontWeight: "bold", + titleBackgroundColor: "white", + subtitleColor: "#5A5A5A", + subtitleFontSize: 22, + subtitleFontFamily: "Calibri", + subtitleAlign: "middle", + subtitleFontWeight: "bold", + subtitleBackgroundColor: "white", + showMousePosition: true, + mousePositionColor: "#000000" + }, + track: { + background: "white", + alternatingBackground: "#f5f5f5", + titleColor: "#5A5A5A", + titleBackground: "white", + //titleFontSize:'', + //titleAlign:'', + outline: "#5A5A5A", + outlineWidth: 1 + }, + legend: { + position: "right", + tickColor: "#5A5A5A", + labelColor: "#5A5A5A", + labelFontSize: 12, + labelFontWeight: "bold", + labelFontFamily: "Calibri", + background: "white", + backgroundOpacity: 0.7, + backgroundStroke: "#5A5A5A" + }, + axis: { + tickColor: "#5A5A5A", + labelColor: "#5A5A5A", + //labelFontSize: '', + //labelFontWeight: '', + labelFontFamily: "Calibri", + baselineColor: "#5A5A5A", + gridColor: "#5A5A5A", + gridStrokeWidth: 1 + //gridStrokeType: '', + //gridStrokeDash: + }, + markCommon: { + ...ExcelThemeMarkCommonStyle + }, + point: { + ...ExcelThemeMarkCommonStyle, + size: 3 + }, + rect: { + ...ExcelThemeMarkCommonStyle + }, + triangle: { + ...ExcelThemeMarkCommonStyle + }, + area: { + ...ExcelThemeMarkCommonStyle + }, + line: { + ...ExcelThemeMarkCommonStyle + }, + bar: { + ...ExcelThemeMarkCommonStyle + }, + rule: { + ...ExcelThemeMarkCommonStyle, + strokeWidth: 1 + }, + link: { + ...ExcelThemeMarkCommonStyle, + strokeWidth: 1 + }, + text: { + ...ExcelThemeMarkCommonStyle, + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + ...ExcelThemeMarkCommonStyle, + color: "#5A5A5A", + opacity: 0.3, + stroke: "#5A5A5A", + strokeWidth: 1 + } +}; +const NOMINAL_COLOR = [ + "#4185f4", + "#DB4437", + "#F4B400", + "#0D9D58", + "#AA30C3", + "#FF6E02", + "#CBC74C" + /*'#000000'*/ +]; +const GoogleThemeMarkCommonStyle = { + color: NOMINAL_COLOR[0], + size: 2, + stroke: "black", + strokeWidth: 0.3, + opacity: 1, + nominalColorRange: NOMINAL_COLOR, + quantitativeSizeRange: [2, 6] +}; +const google = { + base: "google", + root: { + background: "white", + titleColor: "#454545", + titleFontSize: 20, + titleFontFamily: "Arial", + titleAlign: "left", + titleFontWeight: "normal", + titleBackgroundColor: "white", + subtitleColor: "#7d7d7d", + subtitleFontSize: 16, + subtitleFontFamily: "Arial", + subtitleAlign: "left", + subtitleFontWeight: "light", + subtitleBackgroundColor: "white", + showMousePosition: true, + mousePositionColor: "#000000" + }, + track: { + background: "white", + alternatingBackground: "#f5f5f5", + titleColor: "#e8e8e8", + titleBackground: "white", + titleFontSize: 12, + titleAlign: "left", + outline: "black", + outlineWidth: 1 + }, + legend: { + position: "right", + background: "white", + backgroundOpacity: 1, + labelColor: "black", + labelFontSize: 12, + labelFontWeight: "normal", + labelFontFamily: "Arial", + backgroundStroke: "black", + tickColor: "black" + }, + axis: { + labelFontSize: 12, + labelFontWeight: "normal", + labelFontFamily: "Arial", + tickColor: "black", + labelColor: "black", + baselineColor: "black", + gridColor: "black", + gridStrokeWidth: 1 + //, + //gridStrokeType: '', + //gridStrokeDash: + }, + markCommon: { + ...GoogleThemeMarkCommonStyle + }, + point: { + ...GoogleThemeMarkCommonStyle, + size: 3 + }, + rect: { + ...GoogleThemeMarkCommonStyle + }, + triangle: { + ...GoogleThemeMarkCommonStyle + }, + area: { + ...GoogleThemeMarkCommonStyle + }, + line: { + ...GoogleThemeMarkCommonStyle + }, + bar: { + ...GoogleThemeMarkCommonStyle + }, + rule: { + ...GoogleThemeMarkCommonStyle, + strokeWidth: 1 + }, + link: { + ...GoogleThemeMarkCommonStyle, + strokeWidth: 1 + }, + text: { + ...GoogleThemeMarkCommonStyle, + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + ...GoogleThemeMarkCommonStyle, + color: "#999999", + opacity: 0.3, + stroke: "black", + strokeWidth: 0.7 + } +}; +const Themes = { + light, + dark, + warm, + ggplot, + igv, + ensembl, + jbrowse, + ucsc, + washu, + excel, + google +}; +function isThereTheme(key) { + return Object.keys(Themes).indexOf(key) !== -1; +} +function getTheme$1(key) { + return isThereTheme(key) ? Themes[key] : Themes["light"]; +} +function createPluginTrack(config2, factory2) { + var _a; + function Track(...args) { + if (!new.target) { + throw new Error('Uncaught TypeError: Class constructor cannot be invoked without "new"'); + } + return factory2(...args); + } + Track.config = { + ...config2, + availableOptions: Object.keys((_a = config2.defaultOptions) != null ? _a : {}) + }; + return Track; +} +const TICK_WIDTH = 200; +const TICK_HEIGHT = 6; +const TICK_TEXT_SEPARATION = 2; +const TICK_COLOR = 7829367; +const icon$1 = ' '; +const config$3 = { + type: "axis-track", + datatype: ["multivec", "epilogos"], + local: false, + orientation: "1d-horizontal", + thumbnail: new DOMParser().parseFromString(icon$1, "text/xml").documentElement, + defaultOptions: { + innerRadius: 340, + outerRadius: 310, + startAngle: 0, + endAngle: 360, + width: 700, + height: 700, + layout: "linear", + labelMargin: 5, + excludeChrPrefix: false, + labelPosition: "none", + labelColor: "black", + labelTextOpacity: 0.4, + trackBorderWidth: 0, + trackBorderColor: "black", + tickPositions: "even", + fontSize: 12, + fontFamily: "sans-serif", + // 'Arial', + fontWeight: "normal", + color: "#808080", + stroke: "#ffffff", + backgroundColor: "transparent", + showMousePosition: false, + tickColor: TICK_COLOR + } +}; +const factory$2 = (HGC, context, options) => { + const { absToChr, colorToHex: colorToHex2, pixiTextToSvg, svgLine, showMousePosition } = HGC.utils; + function createTickText(text, style) { + return Object.assign(new HGC.libraries.PIXI.Text(text, style), { hashValue: Math.random() }); + } + class AxisTrackClass extends HGC.tracks.PixiTrack { + constructor() { + super(context, options); + __publicField(this, "allTexts"); + __publicField(this, "searchField"); + __publicField(this, "chromInfo"); + __publicField(this, "dataConfig"); + __publicField(this, "pTicksCircular"); + __publicField(this, "pTicks"); + __publicField(this, "gTicks"); + __publicField(this, "tickTexts"); + __publicField(this, "isShowGlobalMousePosition"); + __publicField(this, "pixiTextConfig"); + __publicField(this, "stroke"); + __publicField(this, "tickWidth"); + __publicField(this, "tickHeight"); + __publicField(this, "tickTextSeparation"); + __publicField(this, "tickColor"); + __publicField(this, "animate"); + __publicField(this, "hideMousePosition"); + __publicField(this, "gBoundTicks"); + __publicField(this, "leftBoundTick"); + __publicField(this, "rightBoundTick"); + __publicField(this, "is2d"); + __publicField(this, "texts"); + const { dataConfig, animate, chromInfoPath, isShowGlobalMousePosition } = context; + this.searchField = null; + this.dataConfig = dataConfig; + this.allTexts = []; + this.pTicksCircular = new HGC.libraries.PIXI.Graphics(); + this.pTicks = new HGC.libraries.PIXI.Graphics(); + this.pMain.addChild(this.pTicks); + this.pMain.addChild(this.pTicksCircular); + this.gTicks = {}; + this.tickTexts = {}; + this.options = options; + this.isShowGlobalMousePosition = isShowGlobalMousePosition; + this.pixiTextConfig = getTextStyle({ + size: +this.options.fontSize, + fontFamily: this.options.fontFamily, + fontWeight: this.options.fontWeight, + color: this.options.color, + stroke: this.options.stroke, + strokeThickness: 2 + }); + this.stroke = colorToHex2(this.pixiTextConfig.stroke); + this.tickWidth = TICK_WIDTH; + this.tickHeight = TICK_HEIGHT; + this.tickTextSeparation = TICK_TEXT_SEPARATION; + this.tickColor = colorToHex2(this.options.tickColor); + this.animate = animate; + this.pubSubs = []; + if (this.options.showMousePosition && !this.hideMousePosition) { + this.hideMousePosition = showMousePosition(this, this.is2d, this.isShowGlobalMousePosition()); + } + let chromSizesPath = chromInfoPath; + if (!chromSizesPath) { + chromSizesPath = `${dataConfig.server}/chrom-sizes/?id=${dataConfig.tilesetUid}`; + } + const assembly = this.options.assembly; + const chrPositions = {}; + const chromLengths = { ...computeChromSizes(assembly).size }; + const cumPositions = []; + Object.keys(computeChromSizes(assembly).size).forEach((k) => { + chrPositions[k] = { chr: k, pos: computeChromSizes(assembly).size[k] }; + }); + Object.keys(computeChromSizes(assembly).interval).forEach((k) => { + cumPositions.push({ chr: k, pos: computeChromSizes(assembly).interval[k][0] }); + }); + this.chromInfo = { chrPositions, chromLengths, cumPositions }; + this.rerender(this.options, true); + this.draw(); + this.animate(); + } + initBoundsTicks() { + if (this.pTicks) { + this.pMain.removeChild(this.pTicks); + this.pTicks = null; + } + if (!this.gBoundTicks) { + this.gBoundTicks = new HGC.libraries.PIXI.Graphics(); + this.leftBoundTick = createTickText("", this.pixiTextConfig); + this.rightBoundTick = createTickText("", this.pixiTextConfig); + this.gBoundTicks.addChild(this.leftBoundTick); + this.gBoundTicks.addChild(this.rightBoundTick); + this.pMain.addChild(this.gBoundTicks); + } + this.texts = []; + } + initChromLabels() { + if (!this.chromInfo) + return; + if (this.gBoundTicks) { + this.pMain.removeChild(this.gBoundTicks); + this.gBoundTicks = void 0; + } + if (!this.pTicks) { + this.pTicks = new HGC.libraries.PIXI.Graphics(); + this.pMain.addChild(this.pTicks); + } + this.texts = []; + this.pTicks.removeChildren(); + this.chromInfo.cumPositions.forEach((info) => { + var _a, _b, _c; + const chromName = info.chr; + this.gTicks[chromName] = new HGC.libraries.PIXI.Graphics(); + if (!this.tickTexts[chromName]) + this.tickTexts[chromName] = []; + const chromNameText = this.options.excludeChrPrefix ? chromName.replace("chr", "") : chromName; + const text = createTickText(chromNameText, this.pixiTextConfig); + (_a = this.pTicks) == null ? void 0 : _a.addChild(text); + (_b = this.pTicks) == null ? void 0 : _b.addChild(this.gTicks[chromName]); + (_c = this.texts) == null ? void 0 : _c.push(text); + }); + } + rerender(options2, force) { + const strOptions = JSON.stringify(options2); + if (!force && strOptions === this.prevOptions) + return; + this.prevOptions = strOptions; + this.options = options2; + this.pixiTextConfig.fontSize = +this.options.fontSize ? `${+this.options.fontSize}px` : this.pixiTextConfig.fontSize; + this.pixiTextConfig.fill = this.options.color || this.pixiTextConfig.fill; + this.pixiTextConfig.stroke = this.options.stroke || this.pixiTextConfig.stroke; + this.stroke = colorToHex2(this.pixiTextConfig.stroke); + this.tickColor = this.options.tickColor ? colorToHex2(this.options.tickColor) : TICK_COLOR; + if (this.options.tickPositions === "ends" && this.options.layout !== "circular") { + this.initBoundsTicks(); + } else { + this.initChromLabels(); + } + super.rerender(options2, force); + if (this.options.showMousePosition && !this.hideMousePosition) { + this.hideMousePosition = showMousePosition(this, this.is2d, this.isShowGlobalMousePosition()); + } + if (!this.options.showMousePosition && this.hideMousePosition) { + this.hideMousePosition(); + this.hideMousePosition = void 0; + } + } + formatTick(pos) { + if (isNaN(pos)) { + return "null"; + } + const domain = this._xScale.domain(); + const viewWidth = domain[1] - domain[0]; + const p = precisionPrefix(pos, viewWidth); + const fPlain = format(","); + const fPrecision = formatPrefix(`,.${p}`, viewWidth); + let f = fPlain; + if (this.options.tickFormat === "si") { + f = fPrecision; + } else if (this.options.tickFormat === "plain") { + f = fPlain; + } else if (this.options.tickPositions === "ends") { + f = fPrecision; + } + return f(pos); + } + /** Show two labels at the end of both left and right sides */ + drawBoundsTicks(x1, x2) { + if (!this.gBoundTicks || !this.leftBoundTick || !this.rightBoundTick) + return; + const graphics = this.gBoundTicks; + graphics.clear(); + graphics.lineStyle(1, 0); + const lineYStart = this.options.reverseOrientation ? 0 : this.dimensions[1]; + const lineYEnd = this.options.reverseOrientation ? this.tickHeight : this.dimensions[1] - this.tickHeight; + graphics.moveTo(1, lineYStart); + graphics.lineTo(1, lineYEnd); + graphics.moveTo(this.dimensions[0] - 1, lineYStart); + graphics.lineTo(this.dimensions[0] - 1, lineYEnd); + this.leftBoundTick.x = 0; + this.leftBoundTick.y = this.options.reverseOrientation ? lineYEnd + this.tickTextSeparation : lineYEnd - this.tickTextSeparation; + this.leftBoundTick.text = this.options.assembly === "unknown" ? `${this.formatTick(x1[1])}` : `${x1[0]}: ${this.formatTick(x1[1])}`; + this.leftBoundTick.anchor.y = this.options.reverseOrientation ? 0 : 1; + this.rightBoundTick.x = this.dimensions[0]; + this.rightBoundTick.text = this.options.assembly === "unknown" ? `${this.formatTick(x2[1])}` : `${x2[0]}: ${this.formatTick(x2[1])}`; + this.rightBoundTick.y = this.options.reverseOrientation ? lineYEnd + this.tickTextSeparation : lineYEnd - this.tickTextSeparation; + this.rightBoundTick.anchor.y = this.options.reverseOrientation ? 0 : 1; + this.rightBoundTick.anchor.x = 1; + if (this.flipText) { + this.leftBoundTick.scale.x = -1; + this.leftBoundTick.anchor.x = 1; + this.rightBoundTick.scale.x = -1; + this.rightBoundTick.anchor.x = 0; + } + this.leftBoundTick.tickLine = [1, this.dimensions[1], 1, this.dimensions[1] - this.tickHeight]; + this.rightBoundTick.tickLine = [ + this.dimensions[0] - 1, + this.dimensions[1], + this.dimensions[0] - 1, + this.dimensions[1] - this.tickHeight + ]; + this.tickTexts = {}; + this.tickTexts.all = [this.leftBoundTick, this.rightBoundTick]; + } + drawTicks(cumPos) { + const graphics = this.gTicks[cumPos.chr]; + graphics.visible = true; + graphics.clear(); + const chromLen = +this.chromInfo.chromLengths[cumPos.chr]; + const vpLeft = Math.max(this._xScale(cumPos.pos), 0); + const vpRight = Math.min(this._xScale(cumPos.pos + chromLen), this.dimensions[0]); + const numTicks = (vpRight - vpLeft) / this.tickWidth; + const xScale = scaleLinear().domain([ + Math.max(1, this._xScale.invert(0) - cumPos.pos), + Math.min(chromLen, this._xScale.invert(this.dimensions[0]) - cumPos.pos) + ]).range([vpLeft, vpRight]); + const ticks = xScale.ticks(numTicks).filter((tick) => Number.isInteger(tick)); + const tickTexts = this.tickTexts[cumPos.chr]; + const tickHeight = this.tickHeight; + const xPadding = 0; + let yPadding = tickHeight + this.tickTextSeparation; + if (this.options.reverseOrientation) { + yPadding = this.dimensions[1] - yPadding; + } + while (tickTexts.length < ticks.length) { + const newText = createTickText("", this.pixiTextConfig); + tickTexts.push(newText); + this.gTicks[cumPos.chr].addChild(newText); + } + while (tickTexts.length > ticks.length) { + const text = tickTexts.pop(); + this.gTicks[cumPos.chr].removeChild(text); + } + let i = 0; + while (i < ticks.length) { + tickTexts[i].visible = true; + tickTexts[i].anchor.x = 0.5; + tickTexts[i].anchor.y = this.options.layout === "circular" ? 0 : this.options.reverseOrientation ? 0 : 1; + if (this.flipText) + tickTexts[i].scale.x = -1; + const chrText = this.options.assembly === "unknown" ? "" : `${cumPos.chr}: `; + tickTexts[i].text = ticks[i] === 0 ? `${chrText}1` : `${chrText}${this.formatTick(ticks[i])}`; + const x = this._xScale(cumPos.pos + ticks[i]); + if (this.options.layout === "circular") { + const rope = this.addCurvedText(tickTexts[i], x + xPadding); + rope && this.pTicksCircular.addChild(rope); + } else { + tickTexts[i].x = x + xPadding; + tickTexts[i].y = this.dimensions[1] - yPadding; + tickTexts[i].tickLine = [x - 1, this.dimensions[1], x - 1, this.dimensions[1] - tickHeight - 1]; + const lineYStart = this.options.reverseOrientation ? 0 : this.dimensions[1]; + const lineYEnd = this.options.reverseOrientation ? tickHeight : this.dimensions[1] - tickHeight; + graphics.lineStyle(1, this.tickColor); + graphics.moveTo(x, lineYStart); + graphics.lineTo(x, lineYEnd); + } + i += 1; + } + if (this.options.layout === "circular") + i = 0; + while (i < tickTexts.length) { + tickTexts[i].visible = false; + i += 1; + } + return ticks.length; + } + addCurvedText(textObj, cx) { + const [width, height] = this.dimensions; + const { startAngle, endAngle } = this.options; + const factor = Math.min(width, height) / Math.min(this.options.width, this.options.height); + const innerRadius = this.options.innerRadius * factor; + const outerRadius = this.options.outerRadius * factor; + const r = (outerRadius + innerRadius) / 2; + const centerPos = cartesianToPolar(cx, width, r, width / 2, height / 2, startAngle, endAngle); + textObj.x = centerPos.x; + textObj.y = centerPos.y; + textObj.resolution = 4; + const txtStyle = new HGC.libraries.PIXI.TextStyle(this.pixiTextConfig); + const metric = HGC.libraries.PIXI.TextMetrics.measureText(textObj.text, txtStyle); + const tw = metric.width / (2 * r * Math.PI) * width * 360 / (endAngle - startAngle); + let [minX, maxX] = [cx - tw / 2, cx + tw / 2]; + if (minX < 0) { + const gap = -minX; + minX = 0; + maxX += gap; + } else if (maxX > width) { + const gap = maxX - width; + maxX = width; + minX -= gap; + } + const ropePoints = []; + const baseR = innerRadius + metric.height / 2 + 3; + for (let i = maxX; i >= minX; i -= tw / 10) { + const p = cartesianToPolar(i, width, baseR, width / 2, height / 2, startAngle, endAngle); + ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y)); + } + if (ropePoints.length === 0) { + return void 0; + } + textObj.updateText(); + const rope = new HGC.libraries.PIXI.SimpleRope(textObj.texture, ropePoints); + return rope; + } + draw() { + this.allTexts = []; + if (!this.texts) + return; + const x1 = absToChr(this._xScale.domain()[0], this.chromInfo); + const x2 = absToChr(this._xScale.domain()[1], this.chromInfo); + if (!x1 || !x2) { + console.warn("Empty chromInfo:", this.dataConfig, this.chromInfo); + return; + } + if (this.options.tickPositions === "ends" && this.options.layout !== "circular") { + if (!this.gBoundTicks) + return; + this.gBoundTicks.visible = true; + this.drawBoundsTicks(x1, x2); + return; + } + if (!this.pTicks) { + return; + } + const circular = this.options.layout === "circular"; + for (let i = 0; i < this.texts.length; i++) { + this.texts[i].visible = false; + this.gTicks[this.chromInfo.cumPositions[i].chr].visible = false; + } + let yPadding = this.tickHeight + this.tickTextSeparation; + if (this.options.reverseOrientation) { + yPadding = this.dimensions[1] - yPadding; + } + Object.keys(this.chromInfo.chrPositions).forEach((chrom) => { + if (this.tickTexts[chrom]) { + this.tickTexts[chrom].forEach((tick) => { + tick.visible = false; + }); + } + }); + this.pTicksCircular.removeChildren(); + for (let i = x1[3]; i <= x2[3]; i++) { + const xCumPos = this.chromInfo.cumPositions[i]; + const midX = xCumPos.pos + this.chromInfo.chromLengths[xCumPos.chr] / 2; + const viewportMidX = this._xScale(midX); + const chrText = this.texts[i]; + chrText.anchor.x = 0.5; + chrText.anchor.y = circular ? 0.5 : this.options.reverseOrientation ? 0 : 1; + let rope; + if (circular) { + rope = this.addCurvedText(chrText, viewportMidX); + if (rope) { + this.pTicksCircular.addChild(rope); + } + } else { + chrText.x = viewportMidX; + chrText.y = this.dimensions[1] - yPadding; + } + chrText.updateTransform(); + if (this.flipText) + chrText.scale.x = -1; + const numTicksDrawn = this.drawTicks(xCumPos); + if (!circular) { + chrText.visible = numTicksDrawn <= 0; + } else { + if (numTicksDrawn > 0) { + rope && this.pTicksCircular.removeChild(rope); + } + } + this.allTexts.push({ + importance: chrText.hashValue, + text: chrText, + rope + }); + } + this.hideOverlaps(this.allTexts); + } + hideOverlaps(allTexts) { + const tree = new RBush(); + allTexts.sort((a, b) => b.importance - a.importance).forEach(({ text, rope }) => { + text.updateTransform(); + const b = text.getBounds(); + const m2 = this.options.labelMargin; + const boxWithMargin = { + minX: b.x - m2, + minY: b.y - m2, + maxX: b.x + b.width + m2 * 2, + maxY: b.y + b.height + m2 * 2 + }; + if (m2 < 0 || !tree.collides(boxWithMargin)) { + tree.insert(boxWithMargin); + } else { + text.visible = false; + if (this.options.layout === "circular" && rope) { + this.pTicksCircular.removeChild(rope); + } + } + }); + } + setPosition(newPosition) { + super.setPosition(newPosition); + [this.pMain.position.x, this.pMain.position.y] = this.position; + } + zoomed(newXScale, newYScale) { + const domainValues = [...newXScale.domain(), ...newYScale.domain()]; + if (domainValues.filter((d) => isNaN(d)).length !== 0) { + return; + } + this.xScale(newXScale); + this.yScale(newYScale); + this.draw(); + } + exportSVG() { + let track = null; + let base = null; + if (super.exportSVG) { + [base, track] = super.exportSVG(); + } else { + base = document.createElement("g"); + track = base; + } + base.setAttribute("class", "chromosome-labels"); + const output = document.createElement("g"); + track.appendChild(output); + output.setAttribute("transform", `translate(${this.position[0]},${this.position[1]})`); + this.allTexts.filter((text) => text.text.visible).forEach((text) => { + const g = pixiTextToSvg(text.text); + output.appendChild(g); + }); + Object.values(this.tickTexts).forEach((texts) => { + texts.filter((x) => x.visible).forEach((text) => { + if (!text.tickLine) + return; + let g = pixiTextToSvg(text); + output.appendChild(g); + g = svgLine( + text.x, + this.options.reverseOrientation ? 0 : this.dimensions[1], + text.x, + this.options.reverseOrientation ? this.tickHeight : this.dimensions[1] - this.tickHeight, + 1, + this.tickColor + ); + const line = document.createElement("line"); + line.setAttribute("x1", String(text.tickLine[0])); + line.setAttribute("y1", String(text.tickLine[1])); + line.setAttribute("x2", String(text.tickLine[2])); + line.setAttribute("y2", String(text.tickLine[3])); + line.setAttribute("style", "stroke: grey"); + output.appendChild(g); + output.appendChild(line); + }); + }); + return [base, track]; + } + } + return new AxisTrackClass(); +}; +const AxisTrack = createPluginTrack(config$3, factory$2); +function BrushTrack(HGC, ...args) { + if (!new.target) { + throw new Error('Uncaught TypeError: Class constructor cannot be invoked without "new"'); + } + class BrushTrackClass extends HGC.tracks.SVGTrack { + constructor(params) { + var _a, _b; + super(...params); + __publicField(this, "circularBrushData"); + __publicField(this, "prevExtent"); + const [context, options] = params; + const { registerViewportChanged, removeViewportChanged, setDomainsCallback } = context; + this.uid = uuid(); + this.options = options; + this.hasFromView = !context.projectionXDomain; + this.removeViewportChanged = removeViewportChanged; + this.setDomainsCallback = setDomainsCallback; + this.viewportXDomain = this.hasFromView ? null : context.projectionXDomain; + this.viewportYDomain = this.hasFromView ? null : [0, 0]; + this.prevExtent = [0, 0]; + this.RR = 0.02; + const extent = [0, Math.PI * 1.7]; + this.circularBrushData = this.getBrushData(extent); + this.brush = arc().innerRadius((_a = this.options.innerRadius) != null ? _a : 100).outerRadius((_b = this.options.outerRadius) != null ? _b : 200); + this.gBrush = this.gMain.append("g").attr("id", `brush-${this.uid}`).selectAll(".brush").data(this.circularBrushData).enter().append("path").attr("class", "brush").attr("d", this.brush).attr("fill", this.options.projectionFillColor).attr("stroke", this.options.projectionStrokeColor).attr( + "fill-opacity", + (d) => d.type === "brush" ? this.options.projectionFillOpacity : 0 + ).attr( + "stroke-opacity", + (d) => d.type === "brush" ? this.options.projectionStrokeOpacity : 0 + ).attr("stroke-width", this.options.strokeWidth).style("pointer-events", "all").style("cursor", (d) => d.cursor).call(this.dragged()); + registerViewportChanged(this.uid, this.viewportChanged.bind(this)); + this.draw(); + } + /** + * Get information for circular brush for given extent of angle. + */ + getBrushData(extent) { + return [ + { + type: "brush", + startAngle: extent[0], + endAngle: extent[1], + cursor: "grab" + }, + { + type: "start", + startAngle: extent[0], + endAngle: extent[0] + this.RR, + cursor: "move" + }, + { + type: "end", + startAngle: extent[1] - this.RR, + endAngle: extent[1], + cursor: "move" + } + ]; + } + cropExtent(extent) { + let [s, e] = extent; + let round = 0; + while (s > Math.PI * 2 || e > Math.PI * 2 || s < 0 || e < 0) { + if (round++ > 10) { + break; + } + if (s > Math.PI * 2 || e > Math.PI * 2) { + s -= Math.PI * 2; + e -= Math.PI * 2; + } else if (s < 0 || e < 0) { + s += Math.PI * 2; + e += Math.PI * 2; + } + } + return [s, e].sort((a, b) => a - b); + } + /** + * Update the position and size of brush. + */ + updateBrush(extent) { + let [s, e] = extent; + if (s <= RADIAN_GAP && e <= RADIAN_GAP || s >= Math.PI * 2 - RADIAN_GAP && e >= Math.PI * 2 - RADIAN_GAP) { + this.gBrush.attr("visibility", "hidden"); + return; + } + if (s < RADIAN_GAP) { + s = RADIAN_GAP; + } + if (s > Math.PI * 2 - RADIAN_GAP) { + s = Math.PI * 2 - RADIAN_GAP; + } + if (e < RADIAN_GAP) { + e = RADIAN_GAP; + } + if (e > Math.PI * 2 - RADIAN_GAP) { + e = Math.PI * 2 - RADIAN_GAP; + } + this.circularBrushData = this.getBrushData(extent); + this.gBrush.data(this.circularBrushData).attr("d", this.brush).attr("visibility", "visible"); + } + /** + * Function to call upon hearing click event on the brush + */ + dragged() { + const start = (event) => { + this.startEvent = event.sourceEvent; + this.prevExtent = [this.circularBrushData[0].startAngle, this.circularBrushData[0].endAngle]; + }; + const drag = (event, d) => { + const [x, y] = this.position; + const [w, h] = this.dimensions; + const endEvent = event.sourceEvent; + const startX = this.startEvent.layerX - x; + const startY = this.startEvent.layerY - y; + const endX = endEvent.layerX - x; + const endY = endEvent.layerY - y; + const radDiff = ( + // radian of the start position + Math.atan2(startX - w / 2, startY - h / 2) - // radian of the current position + Math.atan2(endX - w / 2, endY - h / 2) + ); + let [s, e] = this.prevExtent; + if (d.type === "brush") { + s = s + radDiff; + e = e + radDiff; + if (s < RADIAN_GAP || Math.PI * 2 - RADIAN_GAP < e) { + const sto = RADIAN_GAP - s; + const eto = e - (Math.PI * 2 - RADIAN_GAP); + if (sto > eto) { + e += sto; + s += sto; + } else { + s -= eto; + e -= eto; + } + } + } else if (d.type === "start") { + s = s + radDiff; + } else if (d.type === "end") { + e = e + radDiff; + } + [s, e] = this.cropExtent([s, e]); + if (!this._xScale || !this._yScale) { + return; + } + const scale = (this.options.endAngle - this.options.startAngle) / 360; + const offsetedS = s - this.options.startAngle / 360 * Math.PI * 2; + const offsetedE = e - this.options.startAngle / 360 * Math.PI * 2; + const xDomain = [ + this._xScale.invert(w - w * offsetedE / (Math.PI * 2 * scale)), + this._xScale.invert(w - w * offsetedS / (Math.PI * 2 * scale)) + ]; + const yDomain = this.viewportYDomain; + if (!this.hasFromView) { + this.viewportXDomain = xDomain; + } + this.setDomainsCallback(xDomain, yDomain); + this.updateBrush([s, e]); + }; + return HGC.libraries.d3Drag.drag().on("start", start).on("drag", drag); + } + draw() { + if (!this._xScale || !this.yScale) { + return; + } + if (!this.viewportXDomain || !this.viewportYDomain) { + return; + } + const x0 = this._xScale(this.viewportXDomain[0]); + const x1 = this._xScale(this.viewportXDomain[1]); + const [w] = this.dimensions; + let e = valueToRadian(x0, w, this.options.startAngle, this.options.endAngle) + Math.PI / 2; + let s = valueToRadian(x1, w, this.options.startAngle, this.options.endAngle) + Math.PI / 2; + [s, e] = this.cropExtent([s, e]); + this.updateBrush([s, e]); + } + viewportChanged(viewportXScale, viewportYScale) { + const viewportXDomain = viewportXScale.domain(); + const viewportYDomain = viewportYScale.domain(); + this.viewportXDomain = viewportXDomain; + this.viewportYDomain = viewportYDomain; + this.draw(); + } + remove() { + this.removeViewportChanged(this.uid); + super.remove(); + } + rerender() { + } + zoomed(newXScale, newYScale) { + this.xScale(newXScale); + this.yScale(newYScale); + this.draw(); + } + setPosition(newPosition) { + super.setPosition(newPosition); + this.draw(); + } + setDimensions(newDimensions) { + super.setDimensions(newDimensions); + this.gBrush.attr("transform", `translate(${newDimensions[0] / 2},${newDimensions[1] / 2})`); + this.draw(); + } + } + return new BrushTrackClass(args); +} +const icon = ' '; +BrushTrack.config = { + type: "brush-track", + datatype: ["projection"], + local: false, + // TODO: + projection: true, + orientation: "2d", + thumbnail: new DOMParser().parseFromString(icon, "text/xml").documentElement, + availableOptions: [ + "innerRadius", + "outerRadius", + "startAngle", + "endAngle", + "axisPositionHorizontal", + "projectionFillColor", + "projectionStrokeColor", + "projectionFillOpacity", + "projectionStrokeOpacity", + "strokeWidth" + ], + defaultOptions: { + innerRadius: 100, + outerRadius: 200, + startAngle: 0, + endAngle: 360, + axisPositionHorizontal: "left", + projectionFillColor: "#777", + projectionStrokeColor: "#777", + projectionFillOpacity: 0.3, + projectionStrokeOpacity: 0.7, + strokeWidth: 1 + } +}; +const HIDDEN_BRUSH_EDGE_SIZE = 3; +const BRUSH_STYLE_DEFAULT = { + color: "#777", + stroke: "#777", + strokeWidth: 1, + strokeOpacity: 0.7, + opacity: 0.3 +}; +class LinearBrushModel { + constructor(selection, hgLibraries, style = {}) { + /* graphical elements */ + __publicField(this, "brushSelection"); + __publicField(this, "style"); + /* data */ + __publicField(this, "range"); + __publicField(this, "data"); + /* drag */ + __publicField(this, "startEvent"); + __publicField(this, "prevExtent"); + /* visual parameters */ + __publicField(this, "offset"); + __publicField(this, "size"); + // fixed size of one-dimension of a brush (e.g., height) + /* External libraries that we re-use from HiGlass */ + __publicField(this, "externals"); + __publicField(this, "emitter"); + this.emitter = createNanoEvents(); + this.range = null; + this.prevExtent = [0, 0]; + this.data = this.rangeToData(0, 0); + this.offset = [0, 0]; + this.size = 0; + this.externals = { + d3Selection: hgLibraries.d3Selection, + d3Drag: hgLibraries.d3Drag + }; + this.style = Object.assign({}, BRUSH_STYLE_DEFAULT, style); + this.brushSelection = selection.selectAll(".genomic-range-brush").data(this.data).enter().append("rect").attr("class", "genomic-range-brush").call(this.onDrag()); + } + getRange() { + return this.range; + } + setSize(size) { + this.size = size; + return this; + } + /** + * Update the left and top offsets for drawing the brush. + */ + setOffset(offsetX, offsetY) { + this.offset = [offsetX, offsetY]; + return this; + } + /** + * Update brush data based on the positions of two edges. + */ + updateRange(range) { + if (range) { + this.range = [Math.min(...range), Math.max(...range)]; + this.data = this.rangeToData(...this.range); + } else { + this.range = null; + } + return this; + } + /** + * Update the brush using the internal range value. By default, + * This function calls a render function from gosling-track. + */ + drawBrush(skipApiTrigger = false) { + const [x, y] = this.offset; + const height = this.size; + const getWidth = (d) => Math.abs(d.end - d.start); + this.brushSelection.data(this.data).attr("transform", (d) => `translate(${x + d.start}, ${y + 1})`).attr("width", (d) => `${getWidth(d)}px`).attr("height", `${height - 2}px`).attr("fill", this.style.color).attr("stroke", this.style.stroke).attr("stroke-width", `${this.style.strokeWidth}px`).attr("fill-opacity", (d) => d.type === "body" ? this.style.opacity : 0).attr("stroke-opacity", (d) => d.type === "body" ? this.style.strokeOpacity : 0).attr("cursor", (d) => d.cursor); + this.emitter.emit("brush", this.getRange(), skipApiTrigger); + return this; + } + enable() { + this.brushSelection.attr("pointer-events", "all"); + return this; + } + disable() { + this.brushSelection.attr("pointer-events", "none"); + return this; + } + visible() { + this.brushSelection.attr("visibility", "visible"); + return this; + } + hidden() { + this.brushSelection.attr("visibility", "hidden"); + return this; + } + clear() { + this.updateRange(null).drawBrush().hidden().disable(); + return this; + } + remove() { + this.brushSelection.remove(); + return this; + } + /** + * Based on the extent values, generate a JSON object for the brush. + */ + rangeToData(start, end) { + return [ + { + type: "body", + cursor: "grab", + start, + end + }, + { + type: "start", + cursor: "ew-resize", + start: start - HIDDEN_BRUSH_EDGE_SIZE, + end: start + }, + { + type: "end", + cursor: "ew-resize", + start: end, + end: end + HIDDEN_BRUSH_EDGE_SIZE + } + ]; + } + onDrag() { + const started = (event) => { + this.startEvent = event.sourceEvent; + this.prevExtent = this.range; + }; + const dragged = (event, d) => { + var _a; + const delta = event.sourceEvent.layerX - this.startEvent.layerX; + let [s, e] = (_a = this.prevExtent) != null ? _a : [0, 0]; + if (d.type === "body") { + s += delta; + e += delta; + } else if (d.type === "start") { + s += delta; + } else if (d.type === "end") { + e += delta; + } + this.updateRange([s, e]).drawBrush(); + }; + return this.externals.d3Drag.drag().on("start", started).on("drag", dragged); + } + on(event, callback) { + this.emitter.on(event, callback); + } +} +const isPointInsideDonutSlice = ([x, y], [cx, cy], [innerRadius, outerRadius], [startAngle, endAngle]) => { + const dist = Math.sqrt((x - cx) ** 2 + (y - cy) ** 2); + if (dist < innerRadius || outerRadius < dist) { + return false; + } + const degree = pointsToDegree(x, y, cx, cy); + if (degree < startAngle || endAngle < degree) { + return false; + } + return true; +}; +const isPointNearPoint = ([x1, y1], [x2, y2], radius = 5) => { + return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) < radius; +}; +const isPointInsideRange = ([x1, x2], x) => { + return x1 <= x && x <= x2; +}; +const isCircleWithinRange = (range, x, radius = 5) => { + return isPointInsideRange(range, x - radius) && isPointInsideRange(range, x + radius); +}; +const isAllPointsWithinRange = (range, path) => { + return path.filter((_, i) => i % 2 === 0).every((x) => isPointInsideRange(range, x)); +}; +const isPointNearLine = ([x, y], path, dist = 5) => { + let x1; + let y1; + let x2; + let y2; + let isWithin = false; + for (let i = 0; i < path.length - 2; i += 2) { + x1 = path[i]; + y1 = path[i + 1]; + x2 = path[i + 2]; + y2 = path[i + 3]; + const AB = [x2 - x1, y2 - y1]; + const BE = [x - x2, y - y2]; + const AE = [x - x1, y - y1]; + const AB_BE = AB[0] * BE[0] + AB[1] * BE[1]; + const AB_AE = AB[0] * AE[0] + AB[1] * AE[1]; + let actDist = 0; + if (AB_BE > 0) { + actDist = Math.sqrt((y - y2) ** 2 + (x - x2) ** 2); + } else if (AB_AE < 0) { + actDist = Math.sqrt((y - y1) ** 2 + (x - x1) ** 2); + } else { + actDist = Math.abs(AB[0] * AE[1] - AB[1] * AE[0]) / Math.sqrt(AB[0] ** 2 + AB[1] ** 2); + } + if (actDist < dist) { + isWithin = true; + } + } + return isWithin; +}; +const isPointInPolygon = ([x, y], polygon) => { + let x1; + let y1; + let x2; + let y2; + let isWithin = false; + for (let i = 0, j = polygon.length - 2; i < polygon.length; i += 2) { + x1 = polygon[i]; + y1 = polygon[i + 1]; + x2 = polygon[j]; + y2 = polygon[j + 1]; + if (y1 > y !== y2 > y && x < (x2 - x1) * (y - y1) / (y2 - y1) + x1) { + isWithin = !isWithin; + } + j = i; + } + return isWithin; +}; +class MouseEventModel { + constructor() { + // main data that this model manage + __publicField(this, "data"); + this.data = []; + } + /** + * Access the number of mouse events stored. + */ + size() { + return this.data.length; + } + /** + * Add a new mouse event that is polygon-based. + */ + addPolygonBasedEvent(value, polygon) { + this.data.push({ uid: uuid(), type: "polygon", value, polygon }); + } + /** + * Add a new mouse event that is point-based. + */ + addPointBasedEvent(value, pointAndRadius) { + this.data.push({ uid: uuid(), type: "point", value, polygon: pointAndRadius }); + } + /** + * Add a new mouse event that is line-based. + */ + addLineBasedEvent(value, path) { + this.data.push({ uid: uuid(), type: "line", value, polygon: path }); + } + /** + * Make the data array empty. + */ + clear() { + this.data = []; + } + /** + * Find the first event data that is within the mouse position. + */ + find(x, y, reverse = false) { + const _ = Array.from(this.data); + if (reverse) + _.reverse(); + return _.find((d) => this.isMouseWithin(d, x, y)); + } + /** + * Find all event data that is within the mouse position. + */ + findAll(x, y, reverse = false) { + const _ = Array.from(this.data); + if (reverse) + _.reverse(); + return _.filter((d) => this.isMouseWithin(d, x, y)); + } + /** + * Find all event data that matches the id values in the source and return them. + */ + getSiblings(source, idField) { + const siblings = []; + const sourceUids = Array.from(new Set(source.map((d) => d.uid))); + source.forEach((s) => { + const id = s.value[idField]; + if (id) { + siblings.push(...this.data.filter((_) => _.value[idField] === id && sourceUids.indexOf(_.uid) === -1)); + } + }); + return siblings; + } + /** + * Test if a mouse position is within a given object. + */ + isMouseWithin(data, x, y) { + switch (data.type) { + case "point": + return isPointNearPoint([x, y], data.polygon); + case "line": + return isPointNearLine([x, y], data.polygon); + case "polygon": + default: + return isPointInPolygon([x, y], data.polygon); + } + } + /** + * Find all event data that is within the range along the x-axis. + */ + findAllWithinRange(x1, x2, reverse = false) { + const _ = Array.from(this.data); + if (reverse) + _.reverse(); + return _.filter((d) => this.isWithinRange(d, x1, x2)); + } + /** + * Test if a given object is within an 1D range. + */ + isWithinRange(data, x1, x2) { + switch (data.type) { + case "point": + return isCircleWithinRange([x1, x2], data.polygon[0], data.polygon[2]); + case "line": + case "polygon": + default: + return isAllPointsWithinRange([x1, x2], data.polygon); + } + } +} +const encodedJs$3 = "KCgpID0+IHsKICB2YXIgX19jcmVhdGUgPSBPYmplY3QuY3JlYXRlOwogIHZhciBfX2RlZlByb3AgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiAgdmFyIF9fZ2V0T3duUHJvcERlc2MgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOwogIHZhciBfX2dldE93blByb3BOYW1lcyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzOwogIHZhciBfX2dldFByb3RvT2YgPSBPYmplY3QuZ2V0UHJvdG90eXBlT2Y7CiAgdmFyIF9faGFzT3duUHJvcCA9IE9iam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2N1ckJ5dGUrK10gPSB0bXAgJiAyNTU7CiAgICAgICAgfQogICAgICAgIGlmIChwbGFjZUhvbGRlcnNMZW4gPT09IDIpIHsKICAgICAgICAgIHRtcCA9IHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpMildIDw8IDIgfCByZXZMb29rdXBbYjY0LmNoYXJDb2RlQXQoaTIgKyAxKV0gPj4gNDsKICAgICAgICAgIGFycltjdXJCeXRlKytdID0gdG1wICYgMjU1OwogICAgICAgIH0KICAgICAgICBpZiAocGxhY2VIb2xkZXJzTGVuID09PSAxKSB7CiAgICAgICAgICB0bXAgPSByZXZMb29rdXBbYjY0LmNoYXJDb2RlQXQoaTIpXSA8PCAxMCB8IHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpMiArIDEpXSA8PCA0IHwgcmV2TG9va3VwW2I2NC5jaGFyQ29kZUF0KGkyICsgMildID4+IDI7CiAgICAgICAgICBhcnJbY3VyQnl0ZSsrXSA9IHRtcCA+PiA4ICYgMjU1OwogICAgICAgICAgYXJyW2N1ckJ5dGUrK10gPSB0bXAgJiAyNTU7CiAgICAgICAgfQogICAgICAgIHJldHVybiBhcnI7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdHJpcGxldFRvQmFzZTY0KG51bSkgewogICAgICAgIHJldHVybiBsb29rdXBbbnVtID4+IDE4ICYgNjNdICsgbG9va3VwW251bSA+PiAxMiAmIDYzXSArIGxvb2t1cFtudW0gPj4gNiAmIDYzXSArIGxvb2t1cFtudW0gJiA2M107CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZW5jb2RlQ2h1bmsodWludDgsIHN0YXJ0LCBlbmQpIHsKICAgICAgICB2YXIgdG1wOwogICAgICAgIHZhciBvdXRwdXQgPSBbXTsKICAgICAgICBmb3IgKHZhciBpMiA9IHN0YXJ0OyBpMiA8IGVuZDsgaTIgKz0gMykgewogICAgICAgICAgdG1wID0gKHVpbnQ4W2kyXSA8PCAxNiAmIDE2NzExNjgwKSArICh1aW50O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Qml0cykgLSAxOwogICAgICAgIGUgPj49IC1uQml0czsKICAgICAgICBuQml0cyArPSBtTGVuOwogICAgICAgIGZvciAoOyBuQml0cyA+IDA7IG0gPSBtICogMjU2ICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9IGQsIG5CaXRzIC09IDgpIHsKICAgICAgICB9CiAgICAgICAgaWYgKGUgPT09IDApIHsKICAgICAgICAgIGUgPSAxIC0gZUJpYXM7CiAgICAgICAgfSBlbHNlIGlmIChlID09PSBlTWF4KSB7CiAgICAgICAgICByZXR1cm4gbSA/IE5hTiA6IChzID8gLTEgOiAxKSAqIEluZmluaXR5OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBtID0gbSArIE1hdGgucG93KDIsIG1MZW4pOwogICAgICAgICAgZSA9IGUgLSBlQmlhczsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIChzID8gLTEgOiAxKSAqIG0gKiBNYXRoLnBvdygyLCBlIC0gbUxlbik7CiAgICAgIH07CiAgICAgIGV4cG9ydHMud3JpdGUgPSBmdW5jdGlvbihidWZmZXIsIHZhbHVlLCBvZmZzZXQsIGlzTEUsIG1MZW4sIG5CeXRlcykgewogICAgICAgIHZhciBlLCBtLCBjOwogICAgICAgIHZhciBlTGVuID0gbkJ5dGVzICogOCAtIG1MZW4gLSAxOwogICAgICAgIHZhciBlTWF4ID0gKDEgPDwgZUxlbikgLSAxOwogICAgICAgIHZhciBlQmlhcyA9IGVNYXggPj4gMTsKICAgICAgICB2YXIgcnQgPSBtTGVuID09PSAyMyA/IE1hdGgucG93KDIsIC0yNCkgLSBNYXRoLnBvdygyLCAtNzcpIDogMDsKICAgICAgICB2YXIgaSA9IGlzTEUgPyAwIDogbkJ5dGVzIC0gMTsKICAgICAgICB2YXIgZCA9IGlzTEUgPyAxIDogLTE7CiAgICAgICAgdmFyIHMgPSB2YWx1ZSA8IDAgfHwgdmFsdWUgPT09IDAgJiYgMSAvIHZhbHVlIDwgMCA/IDEgOiAwOwogICAgICAgIHZhbHVlID0gTWF0aC5hYnModmFsdWUpOwogICAgICAgIGlmIChpc05hTih2YWx1ZSkgfHwgdmFsdWUgPT09IEluZmluaXR5KSB7CiAgICAgICAgICBtID0gaXNOYU4odmFsdWUpID8gMSA6IDA7CiAgICAgICAgICBlID0gZU1heDsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZSA9IE1hdGguZmxvb3IoTWF0aC5sb2codmFsdWUpIC8gTWF0aC5MTjIpOwogICAgICAgICAgaWYgKHZhbHVlICogKGMgPSBNYXRoLnBvdygyLCAtZSkpIDwgMSkgewogICAgICAgICAgICBlLS07CiAgICAgICAgICAgIGMgKj0gMjsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChlICsgZUJpYXMgPj0gMSkgewogICAgICAgICAgICB2YWx1ZSArPSBydCAvIGM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB2YWx1ZSArPSBydCAqIE1hdGgucG93KDIsIDEgLSBlQmlhcyk7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodmFsdWUgKiBjID49IDIpIHsKICAgICAgICAgICAgZSsrOwogICAgICAgICAgICBjIC89IDI7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoZSArIGVCaWFzID49IGVNYXgpIHsKICAgICAgICAgICAgbSA9IDA7CiAgICAgICAgICAgIGUgPSBlTWF4OwogICAgICAgICAgfSBlbHNlIGlmIChlICsgZUJpYXMgPj0gMSkgewogICAgICAgICAgICBtID0gKHZhbHVlICogYyAtIDEpICogTWF0aC5wb3coMiwgbUxlbik7CiAgICAgICAgICAgIGUgPSBlICsgZUJpYXM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBtID0gdmFsdWUgKiBNYXRoLnBvdygyLCBlQmlhcyAtIDEpICogTWF0aC5wb3coMiwgbUxlbik7CiAgICAgICAgICAgIGUgPSAwOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmb3IgKDsgbUxlbiA+PSA4OyBidWZmZXJbb2Zmc2V0ICsga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WZmZXI4LnByb3RvdHlwZSwgInBhcmVudCIsIHsKICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgIGdldDogZnVuY3Rpb24oKSB7CiAgICAgICAgICBpZiAoIUJ1ZmZlcjguaXNCdWZmZXIodGhpcykpCiAgICAgICAgICAgIHJldHVybiB2b2lkIDA7CiAgICAgICAgICByZXR1cm4gdGhpcy5idWZmZXI7CiAgICAgICAgfQogICAgICB9KTsKICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KEJ1ZmZlcjgucHJvdG90eXBlLCAib2Zmc2V0IiwgewogICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHsKICAgICAgICAgIGlmICghQnVmZmVyOC5pc0J1ZmZlcih0aGlzKSkKICAgICAgICAgICAgcmV0dXJuIHZvaWQgMDsKICAgICAgICAgIHJldHVybiB0aGlzLmJ5dGVPZmZzZXQ7CiAgICAgICAgfQogICAgICB9KTsKICAgICAgZnVuY3Rpb24gY3JlYXRlQnVmZmVyKGxlbmd0aCkgewogICAgICAgIGlmIChsZW5ndGggPiBLX01BWF9MRU5HVEgpIHsKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCdUaGUgdmFsdWUgIicgKyBsZW5ndGggKyAnIiBpcyBpbnZhbGlkIGZvciBvcHRpb24gInNpemUiJyk7CiAgICAgICAgfQogICAgICAgIGNvbnN0IGJ1ZiA9IG5ldyBVaW50OEFycmF5KGxlbmd0aCk7CiAgICAgICAgT2JqZWN0LnNldFByb3RvdHlwZU9mKGJ1ZiwgQnVmZmVyOC5wcm90b3R5cGUpOwogICAgICAgIHJldHVybiBidWY7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gQnVmZmVyOChhcmcsIGVuY29kaW5nT3JPZmZzZXQsIGxlbmd0aCkgewogICAgICAgIGlmICh0eXBlb2YgYXJnID09PSAibnVtYmVyIikgewogICAgICAgICAgaWYgKHR5cGVvZiBlbmNvZGlu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LCBCdWZmZXI4LnByb3RvdHlwZSk7CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfQogICAgICBmdW5jdGlvbiBmcm9tT2JqZWN0KG9iaikgewogICAgICAgIGlmIChCdWZmZXI4LmlzQnVmZmVyKG9iaikpIHsKICAgICAgICAgIGNvbnN0IGxlbiA9IGNoZWNrZWQob2JqLmxlbmd0aCkgfCAwOwogICAgICAgICAgY29uc3QgYnVmID0gY3JlYXRlQnVmZmVyKGxlbik7CiAgICAgICAgICBpZiAoYnVmLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gYnVmOwogICAgICAgICAgfQogICAgICAgICAgb2JqLmNvcHkoYnVmLCAwLCAwLCBsZW4pOwogICAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai5sZW5ndGggIT09IHZvaWQgMCkgewogICAgICAgICAgaWYgKHR5cGVvZiBvYmoubGVuZ3RoICE9PSAibnVtYmVyIiB8fCBudW1iZXJJc05hTihvYmoubGVuZ3RoKSkgewogICAgICAgICAgICByZXR1cm4gY3JlYXRlQnVmZmVyKDApOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUxpa2Uob2JqKTsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai50eXBlID09PSAiQnVmZmVyIiAmJiBBcnJheS5pc0FycmF5KG9iai5kYXRhKSkgewogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUxpa2Uob2JqLmRhdGEpOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBjaGVja2VkKGxlbmd0aCkgewogICAgICAgIGlmIChsZW5ndGggPj0gS19NQVhfTEVOR1RIKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigiQXR0ZW1wdCB0byBhbGxvY2F0ZSBCdWZmZXIgbGFyZ2VyIHRoYW4gbWF4aW11bSBzaXplOiAweCIgKyBLX01BWF9MRU5HVEgudG9TdHJpb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GIubGVuZ3RoOwogICAgICAgIGZvciAobGV0IGkgPSAwLCBsZW4gPSBNYXRoLm1pbih4LCB5KTsgaSA8IGxlbjsgKytpKSB7CiAgICAgICAgICBpZiAoYVtpXSAhPT0gYltpXSkgewogICAgICAgICAgICB4ID0gYVtpXTsKICAgICAgICAgICAgeSA9IGJbaV07CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoeCA8IHkpCiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHkgPCB4KQogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgcmV0dXJuIDA7CiAgICAgIH07CiAgICAgIEJ1ZmZlcjguaXNFbmNvZGluZyA9IGZ1bmN0aW9uIGlzRW5jb2RpbmcoZW5jb2RpbmcpIHsKICAgICAgICBzd2l0Y2ggKFN0cmluZyhlbmNvZGluZykudG9Mb3dlckNhc2UoKSkgewogICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgY2FzZSAidXRmLTgiOgogICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgY2FzZSAibGF0aW4xIjoKICAgICAgICAgIGNhc2UgImJpbmFyeSI6CiAgICAgICAgICBjYXNlICJiYXNlNjQiOgogICAgICAgICAgY2FzZSAidWNzMiI6CiAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICBjYXNlICJ1dGYxNmxlIjoKICAgICAgICAgIGNhc2UgInV0Zi0xNmxlIjoKICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICB9OwogICAgICBCdWZmZXI4LmNvbmNhdCA9IGZ1bmN0aW9uIGNvbmNhdChsaXN0LCBsZW5ndGgpIHsKICAgICAgICBpZiAoIUFycmF5LmlzQXJyYXkobGlzdCkpIHsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJyJsaXN0IiBhcmd1bWVudCBtdXN0IGJlIGFuIEFycmF5IG9mIEJ1ZmZlcnMnKTsKICAgICAgICB9CiAgICAgICAgaWYgKGxpc3QubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICByZXR1cm4gQnVmZmVyOC5hbGxvYygwKTsKICAgICAgICB9CiAgICAgICAgbGV0IGk7CiAgICAgICAgaWYgKGxlbmd0aCA9PT0gdm9pZCAwKSB7CiAgICAgICAgICBsZW5ndGggPSAwOwogICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyArK2kpIHsKICAgICAgICAgICAgbGVuZ3RoICs9IGxpc3RbaV0ubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb25zdCBidWZmZXIgPSBCdWZmZXI4LmFsbG9jVW5zYWZlKGxlbmd0aCk7CiAgICAgICAgbGV0IHBvcyA9IDA7CiAgICAgICAgZm9yIChpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGxldCBidWYgPSBsaXN0W2ldOwogICAgICAgICAgaWYgKGlzSW5zdGFuY2UoYnVmLCBVaW50OEFycmF5KSkgewogICAgICAgICAgICBpZiAocG9zICsgYnVmLmxlbmd0aCA+IGJ1ZmZlci5sZW5ndGgpIHsKICAgICAgICAgICAgICBpZiAoIUJ1ZmZlcjguaXNCdWZmZXIoYnVmKSkKICAgICAgICAgICAgICAgIGJ1ZiA9IEJ1ZmZlcjguZnJvbShidWYpOwogICAgICAgICAgICAgIGJ1Zi5jb3B5KGJ1ZmZlciwgcG9zKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBVaW50OEFycmF5LnByb3RvdHlwZS5zZXQuY2FsbChidWZmZXIsIGJ1ZiwgcG9zKTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIGlmICghQnVmZmVyOC5pc0J1ZmZlcihidWYpKSB7CiAgICAgICAgICAgI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ENhc2UgPSBmYWxzZTsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBsZW47CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhUb0J5dGVzKHN0cmluZykubGVuZ3RoOwogICAgICAgICAgICBjYXNlICJ1Y3MyIjoKICAgICAgICAgICAgY2FzZSAidWNzLTIiOgogICAgICAgICAgICBjYXNlICJ1dGYxNmxlIjoKICAgICAgICAgICAgY2FzZSAidXRmLTE2bGUiOgogICAgICAgICAgICAgIHJldHVybiBsZW4gKiAyOwogICAgICAgICAgICBjYXNlICJoZXgiOgogICAgICAgICAgICAgIHJldHVybiBsZW4gPj4+IDE7CiAgICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICAgICAgcmV0dXJuIGJhc2U2NFRvQnl0ZXMoc3RyaW5nKS5sZW5ndGg7CiAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgaWYgKGxvd2VyZWRDYXNlKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbXVzdE1hdGNoID8gLTEgOiB1dGY4VG9CeXRlcyhzdHJpbmcpLmxlbmd0aDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgZW5jb2RpbmcgPSAoIiIgKyBlbmNvZGluZykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICBsb3dlcmVkQ2FzZSA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIEJ1ZmZlcjguYnl0ZUxlbmd0aCA9IGJ5dGVMZW5ndGg7CiAgICAgIGZ1bmN0aW9uIHNsb3dUb1N0cmluZyhlbmNvZGluZywgc3RhcnQsIGVuZCkgewogICAgICAgIGxldCBsb3dlcmVkQ2FzZSA9IGZhbHNlOwogICAgICAgIGlmIChzdGFydCA9PT0gdm9pZCAwIHx8IHN0YXJ0IDwgMCkgewogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPiB0aGlzLmxlbmd0aCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kID09PSB2b2lkIDAgfHwgZW5kID4gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kIDw9IDApIHsKICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICB9CiAgICAgICAgZW5kID4+Pj0gMDsKICAgICAgICBzdGFydCA+Pj49IDA7CiAgICAgICAgaWYgKGVuZCA8PSBzdGFydCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoIWVuY29kaW5nKQogICAgICAgICAgZW5jb2RpbmcgPSAidXRmOCI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gaGV4U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICAgIHJldHVybiBhc2NpaVNsaWNlKHRoaXMsIHN0YXJ0LCBlbmQpOwogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBsYXRpbjFTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjE2bGVTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgICAgIGVuY29kaW5nID0gKGVuY29kaW5nICsgIiIpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgbG93ZXJlZENhc2UgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBCdWZmZXI4LnByb3RvdHlwZS5faXNCdWZmZXIgPSB0cnVlOwogICAgICBmdW5jdGlvbiBzd2FwKGIsIG4sIG0pIHsKICAgICAgICBjb25zdCBpID0gYltuXTsKICAgICAgICBiW25dID0gYlttXTsKICAgICAgICBiW21dID0gaTsKICAgICAgfQogICAgICBCdWZmZXI4LnByb3RvdHlwZS5zd2FwMTYgPSBmdW5jdGlvbiBzd2FwMTYoKSB7CiAgICAgICAgY29uc3QgbGVuID0gdGhpcy5sZW5ndGg7CiAgICAgICAgaWYgKGxlbiAlIDIgIT09IDApIHsKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJCdWZmZXIgc2l6ZSBtdXN0IGJlIGEgbXVsdGlwbGUgb2YgMTYtYml0cyIpOwogICAgICAgIH0KICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbjsgaSArPSAyKSB7CiAgICAgICAgICBzd2FwKHRoaXMsIGksIGkgKyAxKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgIH07CiAgICAgIEJ1ZmZlcjgucHJvdG90eXBlLnN3YXAzMiA9IGZ1bmN0aW9uIHN3YXAzMigpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgNCAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiAzMi1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDQpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDMpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMSwgaSArIDIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgQnVmZmVyOC5wcm90b3R5cGUuc3dhcDY0ID0gZnVuY3Rpb24gc3dhcDY0KCkgewogICAgICAgIGNvbnN0IGxlbiA9IHRoaXMubGVuZ3RoOwogICAgICAgIGlmIChsZW4gJSA4ICE9PSAwKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigiQnVmZmVyIHNpemUgbXVzdCBiZSBhIG11bHRpcGxlIG9mIDY0LWJpdHMiKTsKICAgICAgICB9CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsZW47IGkgKz0gOCkgewogICAgICAgICAgc3dhcCh0aGlzLCBpLCBpICsgNyk7CiAgICAgICAgICBzd2FwKHRoaXMsIGkgKyAxLCBpICsgNik7CiAgICAgICAgICBzd2FwKHRoaXMsIGkgKyAyLCBpICsgNSk7CiAgICAgICAgICBzd2FwKHRoaXMsIGkgKyAzLCBpICsgNCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9OwogICAgICBCdWZmZXI4LnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uIHRvU3RyaW5nKCkgewogICAgICAgIGNvbnN0IGxlbmd0aCA9IHRoaXMubGVuZ3RoOwogICAgICAgIGlmIChsZW5ndGggPT09IDApCiAgICAgICAgICByZXR1cm4gIiI7CiAgICAgICAgaWYgKGFyZ3VtZW50cy5sZW5ndGggPT09IDApCiAgICAgICAgICByZXR1cm4gdXRmOFNsaWNlKHRoaXMsIDAsIGxlbmd0aCk7CiAgICAgICAgcmV0dXJuIHNsb3dUb1N0cmluZy5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICB9OwogICAgICBCdWZmZXI4LnByb3RvdHlwZS50b0xvY2FsZVN0cmluZyA9IEJ1ZmZlcjgucHJvdG90eXBlLnRvU3RyaW5nOwogICAgICBCdWZmZXI4LnByb3RvdHlwZS5lcXVhbHMgPSBmdW5jdGlvbiBlcXVhbHMoYikgewogICAgICAgIGlmICghQnVmZmVyOC5pc0J1ZmZlcihiKSkKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoIkFyZ3VtZW50IG11c3QgYmUgYSBCdWZmZXIiKTsKICAgICAgICBpZiAodGhpcyA9PT0gYikKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIHJldHVybiBCdWZmZXI4LmNvbXBhcmUodGhpcywgYikgPT09IDA7CiAgICAgIH07CiAgICAgIEJ1ZmZlcjgucHJvdG90eXBlLmluc3BlY3QgPSBmdW5jdGlvbiBpbnNwZWN0KCkgewogICAgICAgIGxldCBzdHIgPSAiIjsKICAgICAgICBjb25zdCBtYXggPSBleHBvcnRzLklOU1BFQ1RfTUFYX0JZVEVTOwogICAgICAgIHN0ciA9IHRoaXMudG9TdHJpbmcoImhleCIsIDAsIG1heCkucmVwbGFjZSgvKC57Mn0pL2csICIkMSAiKS50cmltKCk7CiAgICAgIC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gICAgfQogICAgICAgIGlmICh0aGlzRW5kID09PSB2b2lkIDApIHsKICAgICAgICAgIHRoaXNFbmQgPSB0aGlzLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0IDwgMCB8fCBlbmQgPiB0YXJnZXQubGVuZ3RoIHx8IHRoaXNTdGFydCA8IDAgfHwgdGhpc0VuZCA+IHRoaXMubGVuZ3RoKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigib3V0IG9mIHJhbmdlIGluZGV4Iik7CiAgICAgICAgfQogICAgICAgIGlmICh0aGlzU3RhcnQgPj0gdGhpc0VuZCAmJiBzdGFydCA+PSBlbmQpIHsKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgICAgICBpZiAodGhpc1N0YXJ0ID49IHRoaXNFbmQpIHsKICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0ID49IGVuZCkgewogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIHN0YXJ0ID4+Pj0gMDsKICAgICAgICBlbmQgPj4+PSAwOwogICAgICAgIHRoaXNTdGFydCA+Pj49IDA7CiAgICAgICAgdGhpc0VuZCA+Pj49IDA7CiAgICAgICAgaWYgKHRoaXMgPT09IHRhcmdldCkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIGxldCB4ID0gdGhpc0VuZCAtIHRoaXNTdGFydDsKICAgICAgICBsZXQgeSA9IGVuZCAtIHN0YXJ0OwogICAgICAgIGNvbnN0IGxlbiA9IE1hdGgubWluKHgsIHkpOwogICAgICAgIGNvbnN0IHRoaXNDb3B5ID0gdGhpcy5zbGljZSh0aGlzU3RhcnQsIHRoaXNFbmQpOwogICAgICAgIGNvbnN0IHRhcmdldENvcHkgPSB0YXJnZXQuc2xpY2Uoc3RhcnQsIGVuZCk7CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsZW47ICsraSkgewogICAgICAgICAga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Zlci5sZW5ndGggKyBieXRlT2Zmc2V0OwogICAgICAgIGlmIChieXRlT2Zmc2V0ID49IGJ1ZmZlci5sZW5ndGgpIHsKICAgICAgICAgIGlmIChkaXIpCiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgIGVsc2UKICAgICAgICAgICAgYnl0ZU9mZnNldCA9IGJ1ZmZlci5sZW5ndGggLSAxOwogICAgICAgIH0gZWxzZSBpZiAoYnl0ZU9mZnNldCA8IDApIHsKICAgICAgICAgIGlmIChkaXIpCiAgICAgICAgICAgIGJ5dGVPZmZzZXQgPSAwOwogICAgICAgICAgZWxzZQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAic3RyaW5nIikgewogICAgICAgICAgdmFsID0gQnVmZmVyOC5mcm9tKHZhbCwgZW5jb2RpbmcpOwogICAgICAgIH0KICAgICAgICBpZiAoQnVmZmVyOC5pc0J1ZmZlcih2YWwpKSB7CiAgICAgICAgICBpZiAodmFsLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gYXJyYXlJbmRleE9mKGJ1ZmZlciwgdmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZywgZGlyKTsKICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiB2YWwgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICB2YWwgPSB2YWwgJiAyNTU7CiAgICAgICAgICBpZiAodHlwZW9mIFVpbnQ4QXJyYXkucHJvdG90eXBlLmluZGV4T2YgPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgICAgaWYgKGRpcikgewogICAgICAgICAgICAgIHJldHVybiBVaW50OEFycmF5LnByb3RvdHlwZS5pbmRleE9mLmNhbGwoYnVmZmVyLCB2YWwsIGJ5dGVPZmZzZXQpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHJldHVybiBVaW50OEFycmF5LnByb3RvdHlwZS5sYXN0SW5kZXhPZi5jYWxsKGJ1ZmZlciwgdmFsLCBieXRlT2Zmc2V0KTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGFycmF5SW5kZXhPZihidWZmZXIsIFt2YWxdLCBieXRlT2Zmc2V0LCBlbmNvZGluZywgZGlyKTsKICAgICAgICB9CiAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigidmFsIG11c3QgYmUgc3RyaW5nLCBudW1iZXIgb3IgQnVmZmVyIik7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYXJyYXlJbmRleE9mKGFyciwgdmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZywgZGlyKSB7CiAgICAgICAgbGV0IGluZGV4U2l6ZSA9IDE7CiAgICAgICAgbGV0IGFyckxlbmd0aCA9IGFyci5sZW5ndGg7CiAgICAgICAgbGV0IHZhbExlbmd0aCA9IHZhbC5sZW5ndGg7CiAgICAgICAgaWYgKGVuY29kaW5nICE9PSB2b2lkIDApIHsKICAgICAgICAgIGVuY29kaW5nID0gU3RyaW5nKGVuY29kaW5nKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgaWYgKGVuY29kaW5nID09PSAidWNzMiIgfHwgZW5jb2RpbmcgPT09ICJ1Y3MtMiIgfHwgZW5jb2RpbmcgPT09ICJ1dGYxNmxlIiB8fCBlbmNvZGluZyA9PT0gInV0Zi0xNmxlIikgewogICAgICAgICAgICBpZiAoYXJyLmxlbmd0aCA8IDIgfHwgdmFsLmxlbmd0aCA8IDIpIHsKICAgICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaW5kZXhTaXplID0gMjsKICAgICAgICAgICAgYXJyTGVuZ3RoIC89IDI7CiAgICAgICAgICAgIHZhbExlbmd0aCAvPSAyOwogICAgICAgICAgICBieXRlT2Zmc2V0IC89IDI7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHJlYWQoYnVmLCBpMikgewogICAgICAgICAgaWYgKGluZGV4U2l6ZSA9PT0gMSkgewogICAgICAgICAgICByZXR1cm4gYnVmW2kyXTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiBidWYucmVhZFVJbnQxNkJFKGkyICogaW5kZXhTaXplKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgbGV0IGk7CiAgICAgICAgaWYgKGRpcikgewogICAgICAgICAgbGV0IGZvdW5kSW5kZXggPSAtMTsKICAgICAgICAgIGZvciAoaSA9IGJ5dGVPZmZzZXQ7IGkgPCBhcnJMZW5ndGg7IGkrKykgewogICAgICAgICAgICBpZiAocmVhZChhcnIsIGkpID09PSByZWFkKHZhbCwgZm91bmRJbmRleCA9PT0gLTEgPyAwIDogaSAtIGZvdW5kSW5kZXgpKSB7CiAgICAgICAgICAgICAgaWYgKGZvdW5kSW5kZXggPT09IC0xKQogICAgICAgICAgICAgICAgZm91bmRJbmRleCA9IGk7CiAgICAgICAgICAgICAgaWYgKGkgLSBmb3VuZEluZGV4ICsgMSA9PT0gdmFsTGVuZ3RoKQogICAgICAgICAgICAgICAgcmV0dXJuIGZvdW5kSW5kZXggKiBpbmRleFNpemU7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgaWYgKGZvdW5kSW5kZXggIT09IC0xKQogICAgICAgICAgICAgICAgaSAtPSBpIC0gZm91bmRJbmRleDsKICAgICAgICAgICAgICBmb3VuZEluZGV4ID0gLTE7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKGJ5dGVPZmZzZXQgKyB2YWxMZW5ndGggPiBhcnJMZW5ndGgpCiAgICAgICAgICAgIGJ5dGVPZmZzZXQgPSBhcnJMZW5ndGggLSB2YWxMZW5ndGg7CiAgICAgICAgICBmb3IgKGkgPSBieXRlT2Zmc2V0OyBpID49IDA7IGktLSkgewogICAgICAgICAgICBsZXQgZm91bmQgPSB0cnVlOwogICAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IHZhbExlbmd0aDsgaisrKSB7CiAgICAgICAgICAgICAgaWYgKHJlYWQoYXJyLCBpICsgaikgIT09IHJlYWQodmFsLCBqKSkgewogICAgICAgICAgICAgICAgZm91bmQgPSBmYWxzZTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoZm91bmQpCiAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiAtMTsKICAgICAgfQogICAgICBCdWZmZXI4LnByb3RvdHlwZS5pbmNsdWRlcyA9IGZ1bmN0aW9uIGluY2x1ZGVzKHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcpIHsKICAgICAgICByZXR1cm4gdGhpcy5pbmRleE9mKHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcpICE9PSAtMTsKICAgICAgfTsKICAgICAgQnVmZmVyOC5wcm90b3R5cGUuaW5kZXhPZiA9IGZ1bmN0aW9uIGluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBiaWRpcmVjdGlvbmFsSW5kZXhPZih0aGlzLCB2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nLCB0cnVlKTsKICAgICAgfTsKICAgICAgQnVmZmVyOC5wcm90b3R5cGUubGFzdEluZGV4T2YgPSBmdW5jdGlvbiBsYXN0SW5kZXhPZih2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nKSB7CiAgICAgICAgcmV0dXJuIGJpZGlyZWN0aW9uYWxJbmRleE9mKHRoaXMsIHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGZhbHNlKTsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gaGV4V3JpdGUoYnVmLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKSB7CiAgICAgICAgb2Zmc2V0ID0gTnVtYmVyKG9mZnNldCkgfHwgMDsKICAgICAgICBjb25zdCByZW1haW5pbmcgPSBidWYubGVuZ3RoIC0gb2Zmc2V0OwogICAgICAgIGlmICghbGVuZ3RoKSB7CiAgICAgICAgICBsZW5ndGggPSByZW1haW5pbmc7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGxlbmd0aCA9IE51bWJlcihsZW5ndGgpOwogICAgICAgICAgaWYgKGxlbmd0aCA+IHJlbWFpbmluZykgewogICAgICAgICAgICBsZW5ndGggPSByZW1haW5pbmc7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNvbnN0IHN0ckxlbiA9IHN0cmluZy5sZW5ndGg7CiAgICAgICAgaWYgKGxlbmd0aCA+IHN0ckxlbiAvIDIpIHsKICAgICAgICAgIGxlbmd0aCA9IHN0ckxlbiAvIDI7CiAgICAgICAgfQogICAgICAgIGxldCBpOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW5ndGg7ICsraSkgewogICAgICAgICAgY29uc3QgcGFyc2VkID0gcGFyc2VJbnQoc3RyaW5nLnN1YnN0cihpICogMiwgMiksIDE2KTsKICAgICAgICAgIGlmIChudW1iZXJJc05hTihwYXJzZWQpKQogICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgIGJ1ZltvZmZzZXQgKyBpXSA9IHBhcnNlZDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdXRmOFdyaXRlKGJ1Ziwgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCkgewogICAgICAgIHJldHVybiBibGl0QnVmZmVyKHV0ZjhUb0J5dGVzKHN0cmluZywgYnVmLmxlbmd0aCAtIG9mZnNldCksIGJ1Ziwgb2Zmc2V0LCBsZW5ndGgpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGFzY2lpV3JpdGUoYnVmLCBzdHJpbmcsIG9mZnNld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XMsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpOwogICAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgICAgY2FzZSAidXRmLTgiOgogICAgICAgICAgICAgIHJldHVybiB1dGY4V3JpdGUodGhpcywgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCk7CiAgICAgICAgICAgIGNhc2UgImFzY2lpIjoKICAgICAgICAgICAgY2FzZSAibGF0aW4xIjoKICAgICAgICAgICAgY2FzZSAiYmluYXJ5IjoKICAgICAgICAgICAgICByZXR1cm4gYXNjaWlXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0V3JpdGUodGhpcywgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCk7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIHVjczJXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgICAgIGVuY29kaW5nID0gKCIiICsgZW5jb2RpbmcpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgbG93ZXJlZENhc2UgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfTsKICAgICAgQnVmZmVyOC5wcm90b3R5cGUudG9KU09OID0gZnVuY3Rpb24gdG9KU09OKCkgewogICAgICAgIHJldHVybiB7CiAgICAgICAg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ICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgIGlmIChmaXJzdEJ5dGUgPCAxMjgpIHsKICAgICAgICAgICAgICAgICAgY29kZVBvaW50ID0gZmlyc3RCeXRlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgc2Vjb25kQnl0ZSA9IGJ1ZltpICsgMV07CiAgICAgICAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAzMSkgPDwgNiB8IHNlY29uZEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAxMjcpIHsKICAgICAgICAgICAgICAgICAgICBjb2RlUG9pbnQgPSB0ZW1wQ29kZVBvaW50OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICBzZWNvbmRCeXRlID0gYnVmW2kgKyAxXTsKICAgICAgICAgICAgICAgIHRoaXJkQnl0ZSA9IGJ1ZltpICsgMl07CiAgICAgICAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAxOTIpID09PSAxMjggJiYgKHRoaXJkQnl0ZSAmIDE5MikgPT09IDEyOCkgewogICAgICAgICAgICAgICAgICB0ZW1wQ29kZVBvaW50ID0gKGZpcnN0Qnl0ZSAmIDE1KSA8PCAxMiB8IChzZWNvbmRCeXRlICYgNjMpIDw8IDYgfCB0aGlyZEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAyMDQ3ICYmICh0ZW1wQ29kZVBvaW50IDwgNTUyOTYgfHwgdGVtcENvZGVQb2ludCA+IDU3MzQzKSkgewogICAgICAgICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgIHNlY29uZEJ5dGUgPSBidWZbaSArIDFdOwogICAgICAgICAgICAgICAgdGhpcmRCeXRlID0gYnVmW2kgKyAyXTsKICAgICAgICAgICAgICAgIGZvdXJ0aEJ5dGUgPSBidWZbaSArIDNdOwogICAgICAgICAgICAgICAgaWYgKChzZWNvbmRCeXRlICYgMTkyKSA9PT0gMTI4ICYmICh0aGlyZEJ5dGUgJiAxOTIpID09PSAxMjggJiYgKGZvdXJ0aEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAxNSkgPDwgMTggfCAoc2Vjb25kQnl0ZSAmIDYzKSA8PCAxMiB8ICh0aGlyZEJ5dGUgJiA2MykgPDwgNiB8IGZvdXJ0aEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiA2NTUzNSAmJiB0ZW1wQ29kZVBvaW50IDwgMTExNDExMikgewogICAgICAgICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKGNvZGVQb2ludCA9PT0gbnVsbCkgewogICAgICAgICAgICBjb2RlUG9pbnQgPSA2NTUzMzsKICAgICAgICAgICAgYnl0ZXNQZXJTZXF1ZW5jZSA9IDE7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA+IDY1NTM1KSB7CiAgICAgICAgICAgIGNvZGVQb2ludCAtPSA2NTUzNjsKICAgICAgICAgICAgcmVzLnB1c2goY29kZVBvaW50ID4+PiAxMCAmIDEwMjMgfCA1NTI5Nik7CiAgICAgICAgICAgIGNvZGVQb2ludCA9IDU2MzIwIHwgY29kZVBvaW50ICYgMTAyMzsKICAgICAgICAgIH0KICAgICAgICAgIHJlcy5wdXNoKGNvZGVQb2ludCk7CiAgICAgICAgICBpICs9IGJ5dGVzUGVyU2VxdWVuY2U7CiAgICAgICAgfQogICAgICAgIHJldHVybiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkocmVzKTsKICAgICAgfQogICAgICB2YXIgTUFYX0FSR1VNRU5UU19MRU5HVEggPSA0MDk2OwogICAgICBmdW5jdGlvbiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkoY29kZVBvaW50cykgewogICAgICAgIGNvbnN0IGxlbiA9IGNvZGVQb2ludHMubGVuZ3RoOwogICAgICAgIGlmIChsZW4gPD0gTUFYX0FSR1VNRU5UU19MRU5HVEgpIHsKICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cyk7CiAgICAgICAgfQogICAgICAgIGxldCByZXMgPSAiIjsKICAgICAgICBsZXQgaSA9IDA7CiAgICAgICAgd2hpbGUgKGkgPCBsZW4pIHsKICAgICAgICAgIHJlcyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cy5zbGljZShpLCBpICs9IE1BWF9BUkdVTUVOVFNfTEVOR1RIKSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYXNjaWlTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldICYgMTI3KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBsYXRpbjFTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBoZXhTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBjb25zdCBsZW4gPSBidWYubGVuZ3RoOwogICAgICAgIGlmICghc3RhcnQgfHwgc3RhcnQgPCAwKQogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIGlmICghZW5kIHx8IGVuZCA8IDAgfHwgZW5kID4gbGVuKQogICAgICAgICAgZW5kID0gbGVuOwogICAgICAgIGxldCBvdXQgPSAiIjsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgb3V0ICs9IGhleFNsaWNlTG9va3VwVGFibGVbYnVmW2ldXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG91dDsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNmxlU2xpY2UoYnVmLCBzdGFydCwgZW5kKSB7CiAgICAgICAgY29uc3QgYnl0ZXMgPSBidWYuc2xpY2Uoc3RhcnQsIGVuZCk7CiAgICAgICAgbGV0IHJlcyA9ICIiOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYnl0ZXMubGVuZ3RoIC0gMTsgaSArPSAyKSB7CiAgICAgICAgICByZXMgKz0gU3RyaW5nLmZyb21DaGFyQ29kZ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GwgPSBmdW5jdGlvbiBmaWxsKHZhbCwgc3RhcnQsIGVuZCwgZW5jb2RpbmcpIHsKICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gInN0cmluZyIpIHsKICAgICAgICAgIGlmICh0eXBlb2Ygc3RhcnQgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIGVuY29kaW5nID0gc3RhcnQ7CiAgICAgICAgICAgIHN0YXJ0ID0gMDsKICAgICAgICAgICAgZW5kID0gdGhpcy5sZW5ndGg7CiAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBlbmQgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIGVuY29kaW5nID0gZW5kOwogICAgICAgICAgICBlbmQgPSB0aGlzLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChlbmNvZGluZyAhPT0gdm9pZCAwICYmIHR5cGVvZiBlbmNvZGluZyAhPT0gInN0cmluZyIpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiZW5jb2RpbmcgbXVzdCBiZSBhIHN0cmluZyIpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHR5cGVvZiBlbmNvZGluZyA9PT0gInN0cmluZyIgJiYgIUJ1ZmZlcjguaXNFbmNvZGluZyhlbmNvZGluZykpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiVW5rbm93biBlbmNvZGluZzogIiArIGVuY29kaW5nKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh2YWwubGVuZ3RoID09PSAxKSB7CiAgICAgICAgICAgIGNvbnN0IGNvZGUgPSB2YWwuY2hhckNvZGVBdCgwKTsKICAgICAgICAgICAgaWYgKGVuY29kaW5nID09PSAidXRmOCIgJiYgY29kZSA8IDEyOCB8fCBlbmNvZGluZyA9PT0gImxhdGluMSIpIHsKICAgICAgICAgICAgICB2YWwgPSBjb2RlOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgdmFsID0gdmFsICYgMjU1OwogICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIHZhbCA9PT0gImJvb2xlYW4iKSB7CiAgICAgICAgICB2YWwgPSBOdW1iZXIodmFsKTsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0IDwgMCB8fCB0aGlzLmxlbmd0aCA8IHN0YXJ0IHx8IHRoaXMubGVuZ3RoIDwgZW5kKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigiT3V0IG9mIHJhbmdlIGluZGV4Iik7CiAgICAgICAgfQogICAgICAgIGlmIChlbmQgPD0gc3RhcnQpIHsKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIH0KICAgICAgICBzdGFydCA9IHN0YXJ0ID4+PiAwOwogICAgICAgIGVuZCA9IGVuZCA9PT0gdm9pZCAwID8gdGhpcy5sZW5ndGggOiBlbmQgPj4+IDA7CiAgICAgICAgaWYgKCF2YWwpCiAgICAgICAgICB2YWwgPSAwOwogICAgICAgIGxldCBpOwogICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgZm9yIChpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgICB0aGlzW2ldID0gdmFsOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBjb25zdCBieXRlcyA9IEJ1ZmZlcjguaXNCdWZmZXIodmFsKSA/IHZhbCA6IEJ1ZmZlcjguZnJvbSh2YWwsIGVuY29kaW5nKTsKICAgICAgICAgIGNvbnN0IGxlbiA9IGJ5dGVzLmxlbmd0aDsKICAgICAgICAgIGlmIChsZW4gPT09IDApIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignVGhlIHZhbHVlICInICsgdmFsICsgJyIgaXMgaW52YWxpZCBmb3IgYXJndW1lbnQgInZhbHVlIicpOwogICAgICAgICAgfQogICAgICAgICAgZm9yIChpID0gMDsgaSA8IGVuZCAtIHN0YXJ0OyArK2kpIHsKICAgICAgICAgICAgdGhpc1tpICsgc3RhcnRdID0gYnl0ZXNbaSAlIGxlbl07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9OwogICAgICB2YXIgZXJyb3JzID0ge307CiAgICAgIGZ1bmN0aW9uIEUoc3ltLCBnZXRNZXNzYWdlLCBCYXNlKSB7CiAgICAgICAgZXJyb3JzW3N5bV0gPSBjbGFzcyBOb2RlRXJyb3IgZXh0ZW5kcyBCYXNlIHsKICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgIm1lc3NhZ2UiLCB7CiAgICAgICAgICAgICAgdmFsdWU6IGdldE1lc3NhZ2UuYXBwbHkodGhpcywgYXJndW1lbnRzKSwKICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHRoaXMubmFtZSA9IGAke3RoaXMubmFtZX0gWyR7c3ltfV1gOwogICAgICAgICAgICB0aGlzLnN0YWNrOwogICAgICAgICAgICBkZWxldGUgdGhpcy5uYW1lOwogICAgICAgICAgfQogICAgICAgICAgZ2V0IGNvZGUoKSB7CiAgICAgICAgICAgIHJldHVybiBzeW07CiAgICAgICAgICB9CiAgICAgICAgICBzZXQgY29kZSh2YWx1ZSkgewogICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgImNvZGUiLCB7CiAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgICAgdmFsdWUsCiAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAg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dHIgKyAiPSI7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzdHI7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdXRmOFRvQnl0ZXMoc3RyaW5nLCB1bml0cykgewogICAgICAgIHVuaXRzID0gdW5pdHMgfHwgSW5maW5pdHk7CiAgICAgICAgbGV0IGNvZGVQb2ludDsKICAgICAgICBjb25zdCBsZW5ndGggPSBzdHJpbmcubGVuZ3RoOwogICAgICAgIGxldCBsZWFkU3Vycm9nYXRlID0gbnVsbDsKICAgICAgICBjb25zdCBieXRlcyA9IFtdOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGNvZGVQb2ludCA9IHN0cmluZy5jaGFyQ29kZUF0KGkpOwogICAgICAgICAgaWYgKGNvZGVQb2ludCA+IDU1Mjk1ICYmIGNvZGVQb2ludCA8IDU3MzQ0KSB7CiAgICAgICAgICAgIGlmICghbGVhZFN1cnJvZ2F0ZSkgewogICAgICAgICAgICAgIGlmIChjb2RlUG9pbnQgPiA1NjMxOSkgewogICAgICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgICAgICBieXRlcy5wdXNoKDIzOSwgMTkxLCAxODkpOwogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgfSBlbHNlIGlmIChpICsgMSA9PT0gbGVuZ3RoKSB7CiAgICAgICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpCiAgICAgICAgICAgICAgICAgIGJ5dGVzLnB1c2goMjM5LCAxOTEsIDE4OSk7CiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgbGVhZFN1cnJvZ2F0ZSA9IGNvZGVQb2ludDsKICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY29kZVBvaW50IDwgNTYzMjApIHsKICAgICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpCiAgICAgICAgICAgICAgICBieXRlcy5wdXNoKDIzOSwgMTkxLCAxODkpOwogICAgICAgICAgICAgIGxlYWRTdXJyb2dhdGUgPSBjb2RlUG9pbnQ7CiAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY29kZVBvaW50ID0gKGxlYWRTdXJyb2dhdGUgLSA1NTI5NiA8PCAxMCB8IGNvZGVQb2ludCAtIDU2MzIwKSArIDY1NTM2OwogICAgICAgICAgfSBlbHNlIGlmIChsZWFkU3Vycm9nYXRlKSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkKICAgICAgICAgICAgICBieXRlcy5wdXNoKDIzOSwgMTkxLCAxODkpOwogICAgICAgICAgfQogICAgICAgICAgbGVhZFN1cnJvZ2F0ZSA9IG51bGw7CiAgICAgICAgICBpZiAoY29kZVBvaW50IDwgMTI4KSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMSkgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA8IDIwNDgpIHsKICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAyKSA8IDApCiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIGJ5dGVzLnB1c2goY29kZVBvaW50ID4+IDYgfCAxOTIsIGNvZGVQb2ludCAmIDYzIHwgMTI4KTsKICAgICAgICAgIH0gZWxzZSBpZiAoY29kZVBvaW50IDwgNjU1MzYpIHsKICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA8IDApCiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIGJ5dGVzLnB1c2goY29kZVBvaW50ID4+IDEyIHwgMjI0LCBjb2RlUG9pbnQgPj4gNiAmIDYzIHwgMTI4LCBjb2RlUG9pbnQgJiA2MyB8IDEyOCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA8IDExMTQxMTIpIHsKICAgICAgICAgICAgaWYgKCh1bml0cyAtPSA0KSA8IDApCiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIGJ5dGVzLnB1c2goY29kZVBvaW50ID4+IDE4IHwgMjQwLCBjb2RlUG9pbnQgPj4gMTIgJiA2MyB8IDEyOCwgY29kZVBvaW50ID4+IDYgJiA2MyB8IDEyOCwgY29kZVBvaW50ICYgNjMgfCAxMjgpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJJbnZhbGlkIGNvZGUgcG9pbnQiKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ5dGVzOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGFzY2lpVG9CeXRlcyhzdHIpIHsKICAgICAgICBjb25zdCBieXRlQXJyYXkgPSBbXTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0ci5sZW5ndGg7ICsraSkgewogICAgICAgICAgYnl0ZUFycmF5LnB1c2goc3RyLmNoYXJDb2RlQXQoaSkgJiAyNTUpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gYnl0ZUFycmF5OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHV0ZjE2bGVUb0J5dGVzKHN0ciwgdW5pdHMpIHsKICAgICAgICBsZXQgYywgaGksIGxvOwogICAgICAgIGNvbnN0IGJ5dGVBcnJheSA9IFtdOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgKytpKSB7CiAgICAgICAgICBpZiAoKHVuaXRzIC09IDIpIDwgMCkKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjID0gc3RyLmNoYXJDb2RlQXQoaSk7CiAgICAgICAgICBoaSA9IGMgPj4gODsKICAgICAgICAgIGxvID0gYyAlIDI1NjsKICAgICAgICAgIGJ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pOwogICAgICBleHBvcnRzLkRlZmF1bHRTZXJpYWxpemVyID0gZXhwb3J0cy5leHRlbmRTZXJpYWxpemVyID0gdm9pZCAwOwogICAgICBmdW5jdGlvbiBleHRlbmRTZXJpYWxpemVyKGV4dGVuZCwgaW1wbGVtZW50YXRpb24pIHsKICAgICAgICBjb25zdCBmYWxsYmFja0Rlc2VyaWFsaXplciA9IGV4dGVuZC5kZXNlcmlhbGl6ZS5iaW5kKGV4dGVuZCk7CiAgICAgICAgY29uc3QgZmFsbGJhY2tTZXJpYWxpemVyID0gZXh0ZW5kLnNlcmlhbGl6ZS5iaW5kKGV4dGVuZCk7CiAgICAgICAgcmV0dXJuIHsKICAgICAgICAgIGRlc2VyaWFsaXplKG1lc3NhZ2UpIHsKICAgICAgICAgICAgcmV0dXJuIGltcGxlbWVudGF0aW9uLmRlc2VyaWFsaXplKG1lc3NhZ2UsIGZhbGxiYWNrRGVzZXJpYWxpemVyKTsKICAgICAgICAgIH0sCiAgICAgICAgICBzZXJpYWxpemUoaW5wdXQpIHsKICAgICAgICAgICAgcmV0dXJuIGltcGxlbWVudGF0aW9uLnNlcmlhbGl6ZShpbnB1dCwgZmFsbGJhY2tTZXJpYWxpemVyKTsKICAgICAgICAgIH0KICAgICAgICB9OwogICAgICB9CiAgICAgIGV4cG9ydHMuZXh0ZW5kU2VyaWFsaXplciA9IGV4dGVuZFNlcmlhbGl6ZXI7CiAgICAgIHZhciBEZWZhdWx0RXJyb3JTZXJpYWxpemVyID0gewogICAgICAgIGRlc2VyaWFsaXplKG1lc3NhZ2UpIHsKICAgICAgICAgIHJldHVybiBPYmplY3QuYXNzaWduKEVycm9yKG1lc3NhZ2UubWVzc2FnZSksIHsKICAgICAgICAgICAgbmFtZTogbWVzc2FnZS5uYW1lLAogICAgICAgICAgICBzdGFjazogbWVzc2FnZS5zdGFjawogICAgICAgICAgfSk7CiAgICAgICAgfSwKICAgICAgICBzZXJpYWxpemUoZXJyb3IpIHsKICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIF9fZXJyb3JfbWFya2VyOiAiJCRlcnJvciIsCiAgICAgICAgICAgIG1lc3NhZ2U6IGVycm9yLm1lc3NhZ2UsCiAgICAgICAgICAgIG5hbWU6IGVycm9yLm5hbWUsCiAgICAgICAgICAgIHN0YWNrOiBlcnJvci5zdGFjawogICAgICAgICAgfTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIHZhciBpc1NlcmlhbGl6ZWRFcnJvciA9ICh0aGluZykgPT4gdGhpbmcgJiYgdHlwZW9mIHRoaW5nID09PSAib2JqZWN0IiAmJiAiX19lcnJvcl9tYXJrZXIiIGluIHRoaW5nICYmIHRoaW5nLl9fZXJyb3JfbWFya2VyID09PSAiJCRlcnJvciI7CiAgICAgIGV4cG9ydHMuRGVmYXVsdFNlcmlhbGl6ZXIgPSB7CiAgICAgICAgZGVzZXJpYWxpemUobWVzc2FnZSkgewogICAgICAgICAgaWYgKGlzU2VyaWFsaXplZEVycm9yKG1lc3NhZ2UpKSB7CiAgICAgICAgICAgIHJldHVybiBEZWZhdWx0RXJyb3JTZXJpYWxpemVyLmRlc2VyaWFsaXplKG1lc3NhZ2UpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIG1lc3NhZ2U7CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBzZXJpYWxpemUoaW5wdXQpIHsKICAgICAgICAgIGlmIChpbnB1dCBpbnN0YW5jZW9mIEVycm9yKSB7CiAgICAgICAgICAgIHJldHVybiBEZWZhdWx0RXJyb3JTZXJpYWxpemVyLnNlcmlhbGl6ZShpbnB1dCk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gaW5wdXQ7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vdGhyZWFkc0AxLjcuMC9ub2RlX21vZHVsZXMvdGhyZWFkcy9kaXN0L2NvbW1vbi5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W5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgIGZ1bmN0aW9uIGZ1bGZpbGxlZCh2YWx1ZSkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgIHN0ZXAoZ2VuZXJhdG9yLm5leHQodmFsdWUpKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgIHJlamVjdChlKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gcmVqZWN0ZWQodmFsdWUpIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgcmVqZWN0KGUpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgewogICAgICAgICAgICByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsKICAgICAgICAgIH0KICAgICAgICAgIHN0ZXAoKGdlbmVyYXRvciA9IGdlbmVyYXRvci5hcHBseSh0aGlzQXJnLCBfYXJndW1lbnRzIHx8IFtdKSkubmV4dCgpKTsKICAgICAgICB9KTsKICAgICAgfTsKICAgICAgdmFyIF9faW1wb3J0RGVmYXVsdCA9IGV4cG9ydHMgJiYgZXhwb3J0cy5fX2ltcG9ydERlZmF1bHQgfHwgZnVuY3Rpb24obW9kKSB7CiAgICAgICAgcmV0dXJuIG1vZCAmJiBtb2QuX19lc01vZHVsZSA/IG1vZCA6IHsgImRlZmF1bHQiOiBtb2QgfTsKICAgICAgfTsKICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGV4cG9ydHMsICJfX2VzTW9kdWxlIiwgeyB2YWx1ZTogdHJ1ZSB9KTsK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nN0IGluaXRNZXNzYWdlID0gewogICAgICAgICAgdHlwZTogbWVzc2FnZXNfMS5Xb3JrZXJNZXNzYWdlVHlwZS5pbml0LAogICAgICAgICAgZXhwb3NlZDogewogICAgICAgICAgICB0eXBlOiAiZnVuY3Rpb24iCiAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBpbXBsZW1lbnRhdGlvbl8xLmRlZmF1bHQucG9zdE1lc3NhZ2VUb01hc3Rlcihpbml0TWVzc2FnZSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcG9zdE1vZHVsZUluaXRNZXNzYWdlKG1ldGhvZE5hbWVzKSB7CiAgICAgICAgY29uc3QgaW5pdE1lc3NhZ2UgPSB7CiAgICAgICAgICB0eXBlOiBtZXNzYWdlc18xLldvcmtlck1lc3NhZ2VUeXBlLmluaXQsCiAgICAgICAgICBleHBvc2VkOiB7CiAgICAgICAgICAgIHR5cGU6ICJtb2R1bGUiLAogICAgICAgICAgICBtZXRob2RzOiBtZXRob2ROYW1lcwogICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgaW1wbGVtZW50YXRpb25fMS5kZWZhdWx0LnBvc3RNZXNzYWdlVG9NYXN0ZXIoaW5pdE1lc3NhZ2UpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHBvc3RKb2JFcnJvck1lc3NhZ2UodWlkLCByYXdFcnJvcikgewogICAgICAgIGNvbnN0IHsgcGF5bG9hZDogZXJyb3IsIHRyYW5zZmVyYWJsZXMgfSA9IGRlY29uc3RydWN0VHJhbnNmZXIocmF3RXJyb3IpOwogICAgICAgIGNvbnN0IGVycm9yTWVzc2FnZSA9IHsKICAgICAgICAgIHR5cGU6IG1lc3NhZ2VzXzEuV29ya2VyTWVzc2FnZVR5cGUuZXJyb3IsCiAgICAgICAgICB1aWQsCiAgICAgICAgICBlcnJvcjogY29tbW9uXzEuc2VyaWFsaXplKGVycm9yKQogICAgICAgIH07CiAgICAgICAgaW1wbGVtZW50YXRpb25fMS5kZWZhd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vYlVJRCwgcmVzdWx0VHlwZSk7CiAgICAgICAgICBpZiAoaXNPYnNlcnZhYmxlKHN5bmNSZXN1bHQpKSB7CiAgICAgICAgICAgIGNvbnN0IHN1YnNjcmlwdGlvbiA9IHN5bmNSZXN1bHQuc3Vic2NyaWJlKCh2YWx1ZSkgPT4gcG9zdEpvYlJlc3VsdE1lc3NhZ2Uoam9iVUlELCBmYWxzZSwgY29tbW9uXzEuc2VyaWFsaXplKHZhbHVlKSksIChlcnJvcikgPT4gewogICAgICAgICAgICAgIHBvc3RKb2JFcnJvck1lc3NhZ2Uoam9iVUlELCBjb21tb25fMS5zZXJpYWxpemUoZXJyb3IpKTsKICAgICAgICAgICAgICBhY3RpdmVTdWJzY3JpcHRpb25zLmRlbGV0ZShqb2JVSUQpOwogICAgICAgICAgICB9LCAoKSA9PiB7CiAgICAgICAgICAgICAgcG9zdEpvYlJlc3VsdE1lc3NhZ2Uoam9iVUlELCB0cnVlKTsKICAgICAgICAgICAgICBhY3RpdmVTdWJzY3JpcHRpb25zLmRlbGV0ZShqb2JVSUQpOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgYWN0aXZlU3Vic2NyaXB0aW9ucy5zZXQoam9iVUlELCBzdWJzY3JpcHRpb24pOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBjb25zdCByZXN1bHQgPSB5aWVsZCBzeW5jUmVzdWx0OwogICAgICAgICAgICAgIHBvc3RKb2JSZXN1bHRNZXNzYWdlKGpvYlVJRCwgdHJ1ZSwgY29tbW9uXzEuc2VyaWFsaXplKHJlc3VsdCkpOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgIHBvc3RKb2JFcnJvck1lc3NhZ2Uoam9iVUlELCBjb21tb25fMS5zZXJpYWxpemUoZXJyb3IpKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIG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ICAgIHByb2Nlc3Mub24oInVuY2F1Z2h0RXhjZXB0aW9uIiwgKGVycm9yKSA9PiB7CiAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHBvc3RVbmNhdWdodEVycm9yTWVzc2FnZShlcnJvciksIDI1MCk7CiAgICAgICAgfSk7CiAgICAgICAgcHJvY2Vzcy5vbigidW5oYW5kbGVkUmVqZWN0aW9uIiwgKGVycm9yKSA9PiB7CiAgICAgICAgICBpZiAoZXJyb3IgJiYgdHlwZW9mIGVycm9yLm1lc3NhZ2UgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHNldFRpbWVvdXQoKCkgPT4gcG9zdFVuY2F1Z2h0RXJyb3JNZXNzYWdlKGVycm9yKSwgMjUwKTsKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgfQogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vbG9uZ0A0LjAuMC9ub2RlX21vZHVsZXMvbG9uZy9zcmMvbG9uZy5qcwogIHZhciByZXF1aXJlX2xvbmcgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vbG9uZ0A0LjAuMC9ub2RlX21vZHVsZXMvbG9uZy9zcmMvbG9uZy5qcyIoZXhwb3J0cywgbW9kdWxlKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgbW9kdWxlLmV4cG9ydHMgPSBMb25nNDsKICAgICAgdmFyIHdhc20gPSBudWxsOwogICAgICB0cnkgewogICAgICAgIHdhc20gPSBuZXcgV2ViQXNzZW1ibHkuSW5zdGFuY2UobmV3IFdlYkFzc2VtYmx5Lk1vZHVsZShuZXcgVWludDhBcnJheShbCiAgICAgICAgICAwLAogICAgICAgICAgOTcsCiAgICAgICAgICAxMTUsCiAgICAgICAgICAxMDksCiAgICAgICAgICAxLAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEzLAogICAgICAgICAgMiwKICAgICAgICAgIDk2LAogICAgICAgICAgMCwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICA5NiwKICAgICAgICAgIDQsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxLAogICAgICAgICAgMTI3LAogICAgICAgICAgMywKICAgICAgICAgIDcsCiAgICAgICAgICA2LAogICAgICAgICAgMCwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgNiwKICAgICAgICAgIDYsCiAgICAgICAgICAxLAogICAgICAgICAgMTI3LAogICAgICAgICAgMSwKICAgICAgICAgIDY1LAogICAgICAgICAgMCwKICAgICAgICAgIDExLAogICAgICAgICAgNywKICAgICAgICAgIDUwLAogICAgICAgICAgNiwKICAgICAgICAgIDMsCiAgICAgICAgICAxMDksCiAgICAgICAgICAxMTcsCiAgICAgICAgICAxMDgsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDUsCiAgICAgICAgICAxMDAsCiAgICAgICAgICAxMDUsCiAgICAgICAgICAxMTgsCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNSwKICAgICAgICAgIDAsCiAgICAgICAgICAyLAogICAgICAgICAgNSwKICAgICAgICAgIDEwMCwKICAgICAgICAgIDEwNSwKICAgICAgICAgIDExOCwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE3LAogICAgICAgICAgMCwKICAgICAgICAgIDMsCiAgICAgICAgICA1LAogICAgICAgICAgMTE0LAogICAgICAgICAgMTAxLAogICAgICAgICAgMTA5LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMTUsCiAgICAgICAgICAwLAogICAgICAgICAgNCwKICAgICAgICAgIDUsCiAgICAgICAgICAxMTQsCiAgICAgICAgICAxMDEsCiAgICAgICAgICAxMDksCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNywKICAgICAgICAgIDAsCiAgICAgICAgICA1LAogICAgICAgICAgOCwKICAgICAgICAgIDEwMywKICAgICAgICAgIDEwMSwKICAgICAgICAgIDExNiwKICAgICAgICAgIDk1LAogICAgICAgICAgMTA0LAogICAgICAgICAgMTA1LAogICAgICAgICAgMTAzLAogICAgICAgICAgMTA0LAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAxMCwKICAgICAgICAgIDE5MSwKICAgICAgICAgIDEsCiAgICAgICAgICA2LAogICAgICAgICAgNCwKICAgICAgICAgIDAsCiAgICAgICAgICAzNSwKICAgICAgICAgIDAsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyNywKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyOCwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyOSwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEzMCwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMQogICAgICAgIF0pKSwge30pLmV4cG9ydHM7CiAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgfQogICAgICBmdW5jdGlvbiBMb25nNChsb3csIGhpZ2gsIHVuc2lnbmVkKSB7CiAgICAgICAgdGhpcy5sb3cgPSBsb3cgfCAwOwogICAgICAgIHRoaXMuaGlnaCA9IGhpZ2ggfCAwOwogICAgICAgIHRoaXMudW5zaWduZWQgPSAhIXVuc2lnbmVkOwogICAgICB9CiAgICAgIExvbmc0LnByb3RvdHlwZS5fX2lzTG9uZ19fOwogICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoTG9uZzQucHJvdG90eXBlLCAiX19pc0xvbmdfXyIsIHsgdmFsdWU6IHRydWUgfSk7CiAgICAgIGZ1bmN0aW9uIGlzTG9uZyhvYmopIHsKICAgICAgICByZXR1cm4gKG9iaiAmJiBvYmpbIl9faXNMb25nX18iXSkgPT09IHRydWU7CiAgICAgIH0KICAgICAgTG9uZzQuaXNMb25nID0gaXNMb25nOwogICAgICB2YXIgSU5UX0NBQ0hFID0ge307CiAgICAgIHZhciBVSU5UX0NBQ0hFID0ge307CiAgICAgIGZ1bmN0aW9uIGZyb21JbnQodmFsdWUsIHVuc2lnbmVkKSB7CiAgICAgICAgdmFyIG9iaiwgY2FjaGVkT2JqLCBjYWNoZTsKICAgICAgICBpZiAodW5zaWduZWQpIHsKICAgICAgICAgIHZhbHVlID4+Pj0gMDsKICAgICAgICAgIGlmIChjYWNoZSA9IDAgPD0gdmFsdWUgJiYgdmFsdWUgPCAyNTYpIHsKICAgICAgICAgICAgY2FjaGVkT2JqID0gVUlOVF9DQUNIRVt2YWx1ZV07CiAgICAgICAgICAgIGlmIChjYWNoZWRPYmopCiAgICAgICAgICAgICAgcmV0dXJuIGNhY2hlZE9iajsKICAgICAgICAgIH0KICAgICAgICAgIG9iaiA9IGZyb21CaXRzKHZhbHVlLCAodmFsdWUgfCAwKSA8IDAgPyAtMSA6IDAsIHRydWUpOwogICAgICAgICAgaWYgKGNhY2hlKQogICAgICAgICAgICBVSU5UX0NBQ0hFW3ZhbHVlXSA9IG9iajsKICAgICAgICAgIHJldHVybiBvYmo7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHZhbHVlIHw9IDA7CiAgICAgICAgICBpZiAoY2FjaGUgPSAtMTI4IDw9IHZhbHVlICYmIHZhbHVlIDwgMTI4KSB7CiAgICAgICAgICAgIGNhY2hlZE9iaiA9IElOVF9DQUNIRVt2YWx1ZV07CiAgICAgICAgICAgIGlmIChjYWNoZWRPYmopCiAgICAgICAgICAgICAgcmV0dXJuIGNhY2hlZE9iajsKICAgICAgICAgIH0KICAgICAgICAgIG9iaiA9IGZyb21CaXRzKHZhbHVlLCB2YWx1ZSA8IDAgPyAtMSA6IDAsIGZhbHNlKTsKICAgICAgICAgIGlmIChjYWNoZSkKICAgICAgICAgICAgSU5UX0NBQ0hFW3ZhbHVlXSA9IG9iajsKICAgICAgICAgIHJldHVybiBvYmo7CiAgICAgICAgfQogICAgICB9CiAgICAgIExvbmc0LmZyb21JbnQgPSBmcm9tSW50OwogICAgICBmdW5jdGlvbiBmcm9tTnVtYmVyKHZhbHVlLCB1bnNpZ25lZCkgewogICAgICAgIGlmIChpc05hTih2YWx1ZSkpCiAgICAgICAgICByZXR1cm4gdW5zaWduZWQgPyBVWkVSTyA6IFpFUk87CiAgICAgICAgaWYgKHVuc2lnbmVkKSB7CiAgICAgICAgICBpZiAodmFsdWUgPCAwKQogICAgICAgICAgICByZXR1cm4gVVpFUk87CiAgICAgICAgICBpZiAodmFsdWUgPj0gVFdPX1BXUl82NF9EQkwpCiAgICAgICAgICAgIHJldHVybiBNQVhfVU5TSUdORURfVkFMVUU7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGlmICh2YWx1ZSA8PSAtVFdPX1BXUl82M19EQkwpCiAgICAgICAgICAgIHJldHVybiBNSU5fVkFMVUU7CiAgICAgICAgICBpZiAodmFsdWUgKyAxID49IFRXT19QV1JfNjNfREJMKQogICAgICAgICAgICByZXR1cm4gTUFYX1ZBTFVFOwogICAgICAgIH0KICAgICAgICBpZiAodmFsdWUgPCAwKQogICAgICAgICAgcmV0dXJuIGZyb21OdW1iZXIoLXZhbHVlLCB1bnNpZ25lZCkubmVnKCk7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHZhbHVlICUgVFdPX1BXUl8zMl9EQkwgfCAwLCB2YWx1ZSAvIFRXT19QV1JfMzJfREJMIHwgMCwgdW5zaWduZWQpOwogICAgICB9CiAgICAgIExvbmc0LmZyb21OdW1iZXIgPSBmcm9tTnVtYmVyOwogICAgICBmdW5jdGlvbiBmcm9tQml0cyhsb3dCaXRzLCBoaWdoQml0cywgdW5zaWduZWQpIHsKICAgICAgICByZXR1cm4gbmV3IExvbmc0KGxvd0JpdHMsIGhpZ2hCaXRzLCB1bnNpZ25lZCk7CiAgICAgIH0KICAgICAgTG9uZzQuZnJvbUJpdHMgPSBmcm9tQml0czsKICAgICAgdmFyIHBvd19kYmwgPSBNYXRoLnBvdzsKICAgICAgZnVuY3Rpb24gZnJvbVN0cmluZyhzdHIsIHVuc2lnbmVkLCByYWRpeCkgewogICAgICAgIGlmIChzdHIubGVuZ3RoID09PSAwKQogICAgICAgICAgdGhyb3cgRXJyb3IoImVtcHR5IHN0cmluZyIpOwogICAgICAgIGlmIChzdHIgPT09ICJOYU4iIHx8IHN0ciA9PT0gIkluZmluaXR5IiB8fCBzdHIgPT09ICIrSW5maW5pdHkiIHx8IHN0ciA9PT0gIi1JbmZpbml0eSIpCiAgICAgICAgICByZXR1cm4gWkVSTzsKICAgICAgICBpZiAodHlwZW9mIHVuc2lnbmVkID09PSAibnVtYmVyIikgewogICAgICAgICAgcmFkaXggPSB1bnNpZ25lZCwgdW5zaWduZWQgPSBmYWxzZTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdW5zaWduZWQgPSAhIXVuc2lnbmVkOwogICAgICAgIH0KICAgICAgICByYWRpeCA9IHJhZGl4IHx8IDEwOwogICAgICAgIGlmIChyYWRpeCA8IDIgfHwgMzYgPCByYWRpeCkKICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoInJhZGl4Iik7CiAgICAgICAgdmFyIHA7CiAgICAgICAgaWYgKChwID0gc3RyLmluZGV4T2YoIi0iKSkgPiAwKQogICAgICAgICAgdGhyb3cgRXJyb3IoImludGVyaW9yIGh5cGhlbiIpOwogICAgICAgIGVsc2UgaWYgKHAgPT09IDApIHsKICAgICAgICAgIHJldHVybiBmcm9tU3RyaW5nKHN0ci5zdWJzdHJpbmcoMSksIHVuc2lnbmVkLCByYWRpeCkubmVnKCk7CiAgICAgICAgfQogICAgICAgIHZhciByYWRpeFRvUG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIDgpKTsKICAgICAgICB2YXIgcmVzdWx0ID0gWkVSTzsKICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkgKz0gOCkgewogICAgICAgICAgdmFyIHNpemUgPSBNYXRoLm1pbig4LCBzdHIubGVuZ3RoIC0gaSksIHZhbHVlID0gcGFyc2VJbnQoc3RyLnN1YnN0cmluZyhpLCBpICsgc2l6ZSksIHJhZGl4KTsKICAgICAgICAgIGlmIChzaXplIDwgOCkgewogICAgICAgICAgICB2YXIgcG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIHNpemUpKTsKICAgICAgICAgICAgcmVzdWx0ID0gcmVzdWx0Lm11bChwb3dlcikuYWRkKGZyb21OdW1iZXIodmFsdWUpKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJlc3VsdCA9IHJlc3VsdC5tdWwocmFkaXhUb1Bvd2VyKTsKICAgICAgICA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zLnVuc2lnbmVkKQogICAgICAgICAgcmV0dXJuICh0aGlzLmhpZ2ggPj4+IDApICogVFdPX1BXUl8zMl9EQkwgKyAodGhpcy5sb3cgPj4+IDApOwogICAgICAgIHJldHVybiB0aGlzLmhpZ2ggKiBUV09fUFdSXzMyX0RCTCArICh0aGlzLmxvdyA+Pj4gMCk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZyhyYWRpeCkgewogICAgICAgIHJhZGl4ID0gcmFkaXggfHwgMTA7CiAgICAgICAgaWYgKHJhZGl4IDwgMiB8fCAzNiA8IHJhZGl4KQogICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcigicmFkaXgiKTsKICAgICAgICBpZiAodGhpcy5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiAiMCI7CiAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKSB7CiAgICAgICAgICBpZiAodGhpcy5lcShNSU5fVkFMVUUpKSB7CiAgICAgICAgICAgIHZhciByYWRpeExvbmcgPSBmcm9tTnVtYmVyKHJhZGl4KSwgZGl2ID0gdGhpcy5kaXYocmFkaXhMb25nKSwgcmVtMSA9IGRpdi5tdWwocmFkaXhMb25nKS5zdWIodGhpcyk7CiAgICAgICAgICAgIHJldHVybiBkaXYudG9TdHJpbmcocmFkaXgpICsgcmVtMS50b0ludCgpLnRvU3RyaW5nKHJhZGl4KTsKICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICByZXR1cm4gIi0iICsgdGhpcy5uZWcoKS50b1N0cmluZyhyYWRpeCk7CiAgICAgICAgfQogICAgICAgIHZhciByYWRpeFRvUG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIDYpLCB0aGlzLnVuc2lnbmVkKSwgcmVtID0gdGhpczsKICAgICAgICB2YXIgcmVzdWx0ID0gIiI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHZhciByZW1EaXYgPSByZW0uZGl2KHJhZGl4VG9Qb3dlciksIGludHZhbCA9IHJlbS5zdWIocmVtRGl2Lm11bChyYWRpeFRvUG93ZXIpKS50b0ludCgpID4+PiAwLCBkaWdpdHMgPSBpbnR2YWwudG9TdHJpbmcocmFkaXgpOwogICAgICAgICAgcmVtID0gcmVtRGl2OwogICAgICAgICAgaWYgKHJlbS5pc1plcm8oKSkKICAgICAgICAgICAgcmV0dXJuIGRpZ2l0cyArIHJlc3VsdDsKICAgICAgICAgIGVsc2UgewogICAgICAgICAgICB3aGlsZSAoZGlnaXRzLmxlbmd0aCA8IDYpCiAgICAgICAgICAgICAgZGlnaXRzID0gIjAiICsgZGlnaXRzOwogICAgICAgICAgICByZXN1bHQgPSAiIiArIGRpZ2l0cyArIHJlc3VsdDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0SGlnaEJpdHMgPSBmdW5jdGlvbiBnZXRIaWdoQml0cygpIHsKICAgICAgICByZXR1cm4gdGhpcy5oaWdoOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmdldEhpZ2hCaXRzVW5zaWduZWQgPSBmdW5jdGlvbiBnZXRIaWdoQml0c1Vuc2lnbmVkKCkgewogICAgICAgIHJldHVybiB0aGlzLmhpZ2ggPj4+IDA7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0TG93Qml0cyA9IGZ1bmN0aW9uIGdldExvd0JpdHMoKSB7CiAgICAgICAgcmV0dXJuIHRoaXMubG93OwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmdldExvd0JpdHNVbnNpZ25lZCA9IGZ1bmN0aW9uIGdldExvd0JpdHNVbnNpZ25lZCgpIHsKICAgICAgICByZXR1cm4gdGhpcy5sb3cgPj4+IDA7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0TnVtQml0c0FicyA9IGZ1bmN0aW9uIGdldE51bUJpdHNBYnMoKSB7C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KICAgICAgICByZXR1cm4gdGhpcy5jb21wKG90aGVyKSA8PSAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmx0ZSA9IExvbmdQcm90b3R5cGUubGVzc1RoYW5PckVxdWFsOwogICAgICBMb25nUHJvdG90eXBlLmxlID0gTG9uZ1Byb3RvdHlwZS5sZXNzVGhhbk9yRXF1YWw7CiAgICAgIExvbmdQcm90b3R5cGUuZ3JlYXRlclRoYW4gPSBmdW5jdGlvbiBncmVhdGVyVGhhbihvdGhlcikgewogICAgICAgIHJldHVybiB0aGlzLmNvbXAob3RoZXIpID4gMDsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5ndCA9IExvbmdQcm90b3R5cGUuZ3JlYXRlclRoYW47CiAgICAgIExvbmdQcm90b3R5cGUuZ3JlYXRlclRoYW5PckVxdWFsID0gZnVuY3Rpb24gZ3JlYXRlclRoYW5PckVxdWFsKG90aGVyKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuY29tcChvdGhlcikgPj0gMDsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5ndGUgPSBMb25nUHJvdG90eXBlLmdyZWF0ZXJUaGFuT3JFcXVhbDsKICAgICAgTG9uZ1Byb3RvdHlwZS5nZSA9IExvbmdQcm90b3R5cGUuZ3JlYXRlclRoYW5PckVxdWFsOwogICAgICBMb25nUHJvdG90eXBlLmNvbXBhcmUgPSBmdW5jdGlvbiBjb21wYXJlKG90aGVyKSB7CiAgICAgICAgaWYgKCFpc0xvbmcob3RoZXIpKQogICAgICAgICAgb3RoZXIgPSBmcm9tVmFsdWUob3RoZXIpOwogICAgICAgIGlmICh0aGlzLmVxKG90aGVyKSkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIHZhciB0aGlzTmVnID0gdGhpcy5pc05lZ2F0aXZlKCksIG90aGVyTmVnID0gb3RoZXIuaXNOZWdhdGl2ZSgpOwogICAgICAgIGlmICh0aGlzTmVnICYmICFvdGhlck5lZykKICAgICA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HkobXVsdGlwbGllcikgewogICAgICAgIGlmICh0aGlzLmlzWmVybygpKQogICAgICAgICAgcmV0dXJuIFpFUk87CiAgICAgICAgaWYgKCFpc0xvbmcobXVsdGlwbGllcikpCiAgICAgICAgICBtdWx0aXBsaWVyID0gZnJvbVZhbHVlKG11bHRpcGxpZXIpOwogICAgICAgIGlmICh3YXNtKSB7CiAgICAgICAgICB2YXIgbG93ID0gd2FzbS5tdWwodGhpcy5sb3csIHRoaXMuaGlnaCwgbXVsdGlwbGllci5sb3csIG11bHRpcGxpZXIuaGlnaCk7CiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMobG93LCB3YXNtLmdldF9oaWdoKCksIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgICBpZiAobXVsdGlwbGllci5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiBaRVJPOwogICAgICAgIGlmICh0aGlzLmVxKE1JTl9WQUxVRSkpCiAgICAgICAgICByZXR1cm4gbXVsdGlwbGllci5pc09kZCgpID8gTUlOX1ZBTFVFIDogWkVSTzsKICAgICAgICBpZiAobXVsdGlwbGllci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgcmV0dXJuIHRoaXMuaXNPZGQoKSA/IE1JTl9WQUxVRSA6IFpFUk87CiAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKSB7CiAgICAgICAgICBpZiAobXVsdGlwbGllci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICAgIHJldHVybiB0aGlzLm5lZygpLm11bChtdWx0aXBsaWVyLm5lZygpKTsKICAgICAgICAgIGVsc2UKICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkubXVsKG11bHRpcGxpZXIpLm5lZygpOwogICAgICAgIH0gZWxzZSBpZiAobXVsdGlwbGllci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICByZXR1cm4gdGhpcy5tdWwobXVsdGlwbGllci5uZWcoKSkubmVnKCk7CiAgICAgICAgaWYgKHRoaXMubHQoVFdPX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XMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiB0aGlzLnVuc2lnbmVkID8gVVpFUk8gOiBaRVJPOwogICAgICAgIHZhciBhcHByb3gsIHJlbSwgcmVzOwogICAgICAgIGlmICghdGhpcy51bnNpZ25lZCkgewogICAgICAgICAgaWYgKHRoaXMuZXEoTUlOX1ZBTFVFKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5lcShPTkUpIHx8IGRpdmlzb3IuZXEoTkVHX09ORSkpCiAgICAgICAgICAgICAgcmV0dXJuIE1JTl9WQUxVRTsKICAgICAgICAgICAgZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICAgIHJldHVybiBPTkU7CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgIHZhciBoYWxmVGhpcyA9IHRoaXMuc2hyKDEpOwogICAgICAgICAgICAgIGFwcHJveCA9IGhhbGZUaGlzLmRpdihkaXZpc29yKS5zaGwoMSk7CiAgICAgICAgICAgICAgaWYgKGFwcHJveC5lcShaRVJPKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGRpdmlzb3IuaXNOZWdhdGl2ZSgpID8gT05FIDogTkVHX09ORTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmVtID0gdGhpcy5zdWIoZGl2aXNvci5tdWwoYXBwcm94KSk7CiAgICAgICAgICAgICAgICByZXMgPSBhcHByb3guYWRkKHJlbS5kaXYoZGl2aXNvcikpOwogICAgICAgICAgICAgICAgcmV0dXJuIHJlczsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICByZXR1cm4gdGhpcy51bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICAgIGlmICh0aGlzLmlzTmVnYXRpdmUoKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkuZGl2KGRpdmlzb3IubmVnKCkpOwogICAgICAgICAgICByZXR1cm4gdGhpcy5uZWcoKS5kaXYoZGl2aXNvcikubmVnKCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGRpdmlzb3IuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgICByZXR1cm4gdGhpcy5kaXYoZGl2aXNvci5uZWcoKSkubmVnKCk7CiAgICAgICAgICByZXMgPSBaRVJPOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAoIWRpdmlzb3IudW5zaWduZWQpCiAgICAgICAgICAgIGRpdmlzb3IgPSBkaXZpc29yLnRvVW5zaWduZWQoKTsKICAgICAgICAgIGlmIChkaXZpc29yLmd0KHRoaXMpKQogICAgICAgICAgICByZXR1cm4gVVpFUk87CiAgICAgICAgICBpZiAoZGl2aXNvci5ndCh0aGlzLnNocnUoMSkpKQogICAgICAgICAgICByZXR1cm4gVU9ORTsKICAgICAgICAgIHJlcyA9IFVaRVJPOwogICAgICAgIH0KICAgICAgICByZW0gPSB0aGlzOwogICAgICAgIHdoaWxlIChyZW0uZ3RlKGRpdmlzb3IpKSB7CiAgICAgICAgICBhcHByb3ggPSBNYXRoLm1heCgxLCBNYXRoLmZsb29yKHJlbS50b051bWJlcigpIC8gZGl2aXNvci50b051bWJlcigpKSk7CiAgICAgICAgICB2YXIgbG9nMiA9IE1hdGguY2VpbChNYXRoLmxvZyhhcHByb3gpIC8gTWF0aC5MTjIpLCBkZWx0YSA9IGxvZzIgPD0gNDggPyAxIDogcG93X2RibCgyLCBsb2cyIC0gNDgpLCBhcHByb3hSZXMgPSBmcm9tTnVtYmVyKGFwcHJveCksIGFwcHJveFJlbSA9IGFwcHJveFJlcy5tdWwoZGl2aXNvcik7CiAgICAgICAgICB3aGlsZSAoYXBwcm94UmVtLmlzTmVnYXRpdmUoKSB8fCBhcHByb3hSZW0uZ3QocmVtKSkgewogICAgICAgICAgICBhcHByb3ggLT0gZGVsdGE7CiAgICAgICAgICAgIGFwcHJveFJlcyA9IGZyb21OdW1iZXIoYXBwcm94LCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICAgICAgYXBwcm94UmVtID0gYXBwcm94UmVzLm11bChkaXZpc29yKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChhcHByb3hSZXMuaXNaZXJvKCkpCiAgICAgICAgICAgIGFwcHJveFJlcyA9IE9ORTsKICAgICAgICAgIHJlcyA9IHJlcy5hZGQoYXBwcm94UmVzKTsKICAgICAgICAgIHJlbSA9IHJlbS5zdWIoYXBwcm94UmVtKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlczsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5kaXYgPSBMb25nUHJvdG90eXBlLmRpdmlkZTsKICAgICAgTG9uZ1Byb3RvdHlwZS5tb2R1bG8gPSBmdW5jdGlvbiBtb2R1bG8oZGl2aXNvcikgewogICAgICAgIGlmICghaXNMb25nKGRpdmlzb3IpKQogICAgICAgICAgZGl2aXNvciA9IGZyb21WYWx1ZShkaXZpc29yKTsKICAgICAgICBpZiAod2FzbSkgewogICAgICAgICAgdmFyIGxvdyA9ICh0aGlzLnVuc2lnbmVkID8gd2FzbS5yZW1fdSA6IHdhc20ucmVtX3MpKHRoaXMubG93LCB0aGlzLmhpZ2gsIGRpdmlzb3IubG93LCBkaXZpc29yLmhpZ2gpOwogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKGxvdywgd2FzbS5nZXRfaGlnaCgpLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXMuc3ViKHRoaXMuZGl2KGRpdmlzb3IpLm11bChkaXZpc29yKSk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUubW9kID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUucmVtID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUubm90ID0gZnVuY3Rpb24gbm90KCkgewogICAgICAgIHJldHVybiBmcm9tQml0cyh+dGhpcy5sb3csIH50aGlzLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmFuZCA9IGZ1bmN0aW9uIGFuZChvdGhlcikgewogICAgICAgIGlmICghaXNMb25nKG90aGVyKSkKICAgICAgICAgIG90aGVyID0gZnJvbVZhbHVlKG90aGVyKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgJiBvdGhlci5sb3csIHRoaXMuaGlnaCAmIG90aGVyLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLm9yID0gZnVuY3Rpb24gb3Iob3RoZXIpIHsKICAgICAgICBpZiAoIWlzTG9uZyhvdGhlcikpCiAgICAgICAgICBvdGhlciA9IGZyb21WYWx1ZShvdGhlcik7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IHwgb3RoZXIubG93LCB0aGlzLmhpZ2ggfCBvdGhlci5oaWdoLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS54b3IgPSBmdW5jdGlvbiB4b3Iob3RoZXIpIHsKICAgICAgICBpZiAoIWlzTG9uZyhvdGhlcikpCiAgICAgICAgICBvdGhlciA9IGZyb21WYWx1ZShvdGhlcik7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IF4gb3RoZXIubG93LCB0aGlzLmhpZ2ggXiBvdGhlci5oaWdoLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdExlZnQgPSBmdW5jdGlvbiBzaGlmdExlZnQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIGlmICgobnVtQml0cyAmPSA2MykgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNlIGlmIChudW1CaXRzIDwgMzIpCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgPDwgbnVtQml0cywgdGhpcy5oaWdoIDw8IG51bUJpdHMgfCB0aGlzLmxvdyA+Pj4gMzIgLSBudW1CaXRzLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICBlbHNlCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMoMCwgdGhpcy5sb3cgPDwgbnVtQml0cyAtIDMyLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGwgPSBMb25nUHJvdG90eXBlLnNoaWZ0TGVmdDsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0ID0gZnVuY3Rpb24gc2hpZnRSaWdodChudW1CaXRzKSB7CiAgICAgICAgaWYgKGlzTG9uZyhudW1CaXRzKSkKICAgICAgICAgIG51bUJpdHMgPSBudW1CaXRzLnRvSW50KCk7CiAgICAgICAgaWYgKChudW1CaXRzICY9IDYzKSA9PT0gMCkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKG51bUJpdHMgPCAzMikKICAgICAgICAgIHJldHVybiBmcm9tQml0cyh0aGlzLmxvdyA+Pj4gbnVtQml0cyB8IHRoaXMuaGlnaCA8PCAzMiAtIG51bUJpdHMsIHRoaXMuaGlnaCA+PiBudW1CaXRzLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICBlbHNlCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5oaWdoID4+IG51bUJpdHMgLSAzMiwgdGhpcy5oaWdoID49IDAgPyAwIDogLTEsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLnNociA9IExvbmdQcm90b3R5cGUuc2hpZnRSaWdodDsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0VW5zaWduZWQgPSBmdW5jdGlvbiBzaGlmdFJpZ2h0VW5zaWduZWQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIG51bUJpdHMgJj0gNjM7CiAgICAgICAgaWYgKG51bUJpdHMgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNlIHsKICAgICAgICAgIHZhciBoaWdoID0gdGhpcy5oaWdoOwogICAgICAgICAgaWYgKG51bUJpdHMgPCAzMikgewogICAgICAgICAgICB2YXIgbG93ID0gdGhpcy5sb3c7CiAgICAgICAgICAgIHJldHVybiBmcm9tQml0cyhsb3cgPj4+IG51bUJpdHMgfCBoaWdoIDw8IDMyIC0gbnVtQml0cywgaGlnaCA+Pj4gbnVtQml0cywgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgICB9IGVsc2UgaWYgKG51bUJpdHMgPT09IDMyKQogICAgICAgICAgICByZXR1cm4gZnJvbUJpdHMoaGlnaCwgMCwgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiBmcm9tQml0cyhoaWdoID4+PiBudW1CaXRzIC0gMzIsIDAsIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaHJ1ID0gTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0VW5zaWduZWQ7CiAgICAgIExvbmdQcm90b3R5cGUuc2hyX3UgPSBMb25nUHJvdG90eXBlLnNoaWZ0UmlnaHRVbnNpZ25lZDsKICAgICAgTG9uZ1Byb3RvdHlwZS50b1NpZ25lZCA9IGZ1bmN0aW9uIHRvU2lnbmVkKCkgewogICAgICAgIGlmICghdGhpcy51bnNpZ25lZCkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIHJldHVybiBmcm9tQml0cyh0aGlzLmxvdywgdGhpcy5oaWdoLCBmYWxzZSk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9VbnNpZ25lZCA9IGZ1bmN0aW9uIHRvVW5zaWduZWQoKSB7CiAgICAgICAgaWYgKHRoaXMudW5zaWduZWQpCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3csIHRoaXMuaGlnaCwgdHJ1ZSk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9CeXRlcyA9IGZ1bmN0aW9uIHRvQnl0ZXMobGUpIHsKICAgICAgICByZXR1cm4gbGUgPyB0aGlzLnRvQnl0ZXNMRSgpIDogdGhpcy50b0J5dGVzQkUoKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS50b0J5dGVzTEUgPSBmdW5jdGlvbiB0b0J5dGVzTEUoKSB7CiAgICAgICAgdmFyIGhpID0gdGhpcy5oaWdoLCBsbyA9IHRoaXMubG93OwogICAgICAgIHJldHVybiBbCiAgICAgICAgICBsbyAmIDI1NSwKICAgICAgICAgIGxvID4+PiA4ICYgMjU1LAogICAgICAgICAgbG8gPj4+IDE2ICYgMjU1LAogICAgICAgICAgbG8gPj4+IDI0LAogICAgICAgICAgaGkgJiAyNTUsCiAgICAgICAgICBoaSA+Pj4gOCAmIDI1NSwKICAgICAgICAgIGhpID4+PiAxNiAmIDI1NSwKICAgICAgICAgIGhpID4+PiAyNAogICAgICAgIF07CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9CeXRlc0JFID0gZnVuY3Rpb24gdG9CeXRlc0JFKCkgewogICAgICAgIHZhciBoaSA9IHRoaXMuaGlnaCwgbG8gPSB0aGlzLmxvdzsKICAgICAgICByZXR1cm4gWwogICAgICAgICAgaGkgPj4+IDI0L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aW9uKG9iaikgewogICAgICAgIHZhciBzb3VyY2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKTsKICAgICAgICB3aGlsZSAoc291cmNlcy5sZW5ndGgpIHsKICAgICAgICAgIHZhciBzb3VyY2UgPSBzb3VyY2VzLnNoaWZ0KCk7CiAgICAgICAgICBpZiAoIXNvdXJjZSkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0eXBlb2Ygc291cmNlICE9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKHNvdXJjZSArICJtdXN0IGJlIG5vbi1vYmplY3QiKTsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAodmFyIHAgaW4gc291cmNlKSB7CiAgICAgICAgICAgIGlmIChfaGFzKHNvdXJjZSwgcCkpIHsKICAgICAgICAgICAgICBvYmpbcF0gPSBzb3VyY2VbcF07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIG9iajsKICAgICAgfTsKICAgICAgZXhwb3J0cy5zaHJpbmtCdWYgPSBmdW5jdGlvbihidWYsIHNpemUpIHsKICAgICAgICBpZiAoYnVmLmxlbmd0aCA9PT0gc2l6ZSkgewogICAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgICB9CiAgICAgICAgaWYgKGJ1Zi5zdWJhcnJheSkgewogICAgICAgICAgcmV0dXJuIGJ1Zi5zdWJhcnJheSgwLCBzaXplKTsKICAgICAgICB9CiAgICAgICAgYnVmLmxlbmd0aCA9IHNpemU7CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfTsKICAgICAgdmFyIGZuVHlwZWQgPSB7CiAgICAgICAgYXJyYXlTZXQ6IGZ1bmN0aW9uKGRlc3QsIHNyYywgc3JjX29mZnMsIGxlbiwgZGVzdF9vZmZzKSB7CiAgICAgICAgICBpZiAoc3JjLnN1YmFycmF5ICYmIGRlc3Quc3ViYXJyYXkpIHsKICAgICAgICAgICAgZGVzdC5zZXQoc3JjLnN1YmFycmF5KHNyY19vZmZzLCBzcmNfb2ZmcyArIGxlbiksIGRlc3Rfb2Zmcyk7CiAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKICAgICAgICAgICAgZGVzdFtkZXN0X29mZnMgKyBpXSA9IHNyY1tzcmNfb2ZmcyArIGldOwogICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgZmxhdHRlbkNodW5rczogZnVuY3Rpb24oY2h1bmtzKSB7CiAgICAgICAgICB2YXIgaSwgbCwgbGVuLCBwb3MsIGNodW5rLCByZXN1bHQ7CiAgICAgICAgICBsZW4gPSAwOwogICAgICAgICAgZm9yIChpID0gMCwgbCA9IGNodW5rcy5sZW5ndGg7IGkgPCBsOyBpKyspIHsKICAgICAgICAgICAgbGVuICs9IGNodW5rc1tpXS5sZW5ndGg7CiAgICAgICAgICB9CiAgICAgICAgICByZXN1bHQgPSBuZXcgVWludDhBcnJheShsZW4pOwogICAgICAgICAgcG9zID0gMDsKICAgICAgICAgIGZvciAoaSA9IDAsIGwgPSBjaHVua3MubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgICAgIGNodW5rID0gY2h1bmtzW2ldOwogICAgICAgICAgICByZXN1bHQuc2V0KGNodW5rLCBwb3MpOwogICAgICAgICAgICBwb3MgKz0gY2h1bmsubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgICB9CiAgICAgIH07CiAgICAgIHZhciBmblVudHlwZWQgPSB7CiAgICAgICAgYXJyYXlTZXQ6IGZ1bmN0aW9uKGRlc3QsIHNyYywgc3JjX29mZnMsIGxlbiwgZGVzdF9vZmZzKSB7CiAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgICAgIGRlc3RbZGVzdF9vZmZzICsgaV0gPSBzcmNbc3JjX29mZnMgKyBpXTsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIGZsYXR0ZW5DaHVua3M6IGZ1bmN0aW9uKGNodW5rcykgewogICAgICAgICAgcmV0dXJuIFtdLmNvbmNhdC5hcHBseShbXSwgY2h1bmtzKTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIGV4cG9ydHMuc2V0VHlwZWQgPSBmdW5jdGlvbihvbikgewogICAgICAgIGlmIChvbikgewogICAgICAgICAgZXhwb3J0cy5CdWY4ID0gVWludDhBcnJheTsKICAgICAgICAgIGV4cG9ydHMuQnVmMTYgPSBVaW50MTZBcnJheTsKICAgICAgICAgIGV4cG9ydHMuQnVmMzIgPSBJbnQzMkFycmF5OwogICAgICAgICAgZXhwb3J0cy5hc3NpZ24oZXhwb3J0cywgZm5UeXBlZCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGV4cG9ydHMuQnVmOCA9IEFycmF5OwogICAgICAgICAgZXhwb3J0cy5CdWYxNiA9IEFycmF5OwogICAgICAgICAgZXhwb3J0cy5CdWYzMiA9IEFycmF5OwogICAgICAgICAgZXhwb3J0cy5hc3NpZ24oZXhwb3J0cywgZm5VbnR5cGVkKTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIGV4cG9ydHMuc2V0VHlwZWQoVFlQRURfT0spOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvdHJlZXMuanMKICB2YXIgcmVxdWlyZV90cmVlcyA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi90cmVlcy5qcyIoZXhwb3J0cykgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3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gICAgfQogICAgICBmdW5jdGlvbiBzZW5kX2JpdHMocywgdmFsdWUsIGxlbmd0aCkgewogICAgICAgIGlmIChzLmJpX3ZhbGlkID4gQnVmX3NpemUgLSBsZW5ndGgpIHsKICAgICAgICAgIHMuYmlfYnVmIHw9IHZhbHVlIDw8IHMuYmlfdmFsaWQgJiA2NTUzNTsKICAgICAgICAgIHB1dF9zaG9ydChzLCBzLmJpX2J1Zik7CiAgICAgICAgICBzLmJpX2J1ZiA9IHZhbHVlID4+IEJ1Zl9zaXplIC0gcy5iaV92YWxpZDsKICAgICAgICAgIHMuYmlfdmFsaWQgKz0gbGVuZ3RoIC0gQnVmX3NpemU7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHMuYmlfYnVmIHw9IHZhbHVlIDw8IHMuYmlfdmFsaWQgJiA2NTUzNTsKICAgICAgICAgIHMuYmlfdmFsaWQgKz0gbGVuZ3RoOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBzZW5kX2NvZGUocywgYywgdHJlZSkgewogICAgICAgIHNlbmRfYml0cyhzLCB0cmVlW2MgKiAyXSwgdHJlZVtjICogMiArIDFdKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBiaV9yZXZlcnNlKGNvZGUsIGxlbikgewogICAgICAgIHZhciByZXMgPSAwOwogICAgICAgIGRvIHsKICAgICAgICAgIHJlcyB8PSBjb2RlICYgMTsKICAgICAgICAgIGNvZGUgPj4+PSAxOwogICAgICAgICAgcmVzIDw8PSAxOwogICAgICAgIH0gd2hpbGUgKC0tbGVuID4gMCk7CiAgICAgICAgcmV0dXJuIHJlcyA+Pj4gMTsKICAgICAgfQogICAgICBmdW5jdGlvbiBiaV9mbHVzaChzKSB7CiAgICAgICAgaWYgKHMuYmlfdmFsaWQgPT09IDE2KSB7CiAgICAgICAgICBwdXRfc2hvcnQocywgcy5iaV9idWYpOwogICAgICAgICAgcy5iaV9idWYgPSAwOwogICAgICAgICAgcy5iaV92YWxpZCA9IDA7Ci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07CiAgICAgICAgICBiaXRzID0gdHJlZVt0cmVlW24gKiAyICsgMV0gKiAyICsgMV0gKyAxOwogICAgICAgICAgaWYgKGJpdHMgPiBtYXhfbGVuZ3RoKSB7CiAgICAgICAgICAgIGJpdHMgPSBtYXhfbGVuZ3RoOwogICAgICAgICAgICBvdmVyZmxvdysrOwogICAgICAgICAgfQogICAgICAgICAgdHJlZVtuICogMiArIDFdID0gYml0czsKICAgICAgICAgIGlmIChuID4gbWF4X2NvZGUpIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBzLmJsX2NvdW50W2JpdHNdKys7CiAgICAgICAgICB4Yml0cyA9IDA7CiAgICAgICAgICBpZiAobiA+PSBiYXNlKSB7CiAgICAgICAgICAgIHhiaXRzID0gZXh0cmFbbiAtIGJhc2VdOwogICAgICAgICAgfQogICAgICAgICAgZiA9IHRyZWVbbiAqIDJdOwogICAgICAgICAgcy5vcHRfbGVuICs9IGYgKiAoYml0cyArIHhiaXRzKTsKICAgICAgICAgIGlmIChoYXNfc3RyZWUpIHsKICAgICAgICAgICAgcy5zdGF0aWNfbGVuICs9IGYgKiAoc3RyZWVbbiAqIDIgKyAxXSArIHhiaXRzKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKG92ZXJmbG93ID09PSAwKSB7CiAgICAgICAgICByZXR1cm47CiAgICAgICAgfQogICAgICAgIGRvIHsKICAgICAgICAgIGJpdHMgPSBtYXhfbGVuZ3RoIC0gMTsKICAgICAgICAgIHdoaWxlIChzLmJsX2NvdW50W2JpdHNdID09PSAwKSB7CiAgICAgICAgICAgIGJpdHMtLTsKICAgICAgICAgIH0KICAgICAgICAgIHMuYmxfY291bnRbYml0c10tLTsKICAgICAgICAgIHMuYmxfY291bnRbYml0cyArIDFdICs9IDI7CiAgICAgICAgICBzLmJsX2NvdW50W21heF9sZW5ndGhdLS07CiAgICAgICAgICBvdmVyZmxvdyAtPSAyOwogICAgICAgIH0gd2hpbGUgKG92ZXJmbG93ID4gMCk7CiAgICAgICAgZm9yIChiaXRzID0gbWF4X2xlbmd0aDsgYml0cyAhPT0gMDsgYml0cy0tKSB7CiAgICAgICAgICBuID0gcy5ibF9jb3VudFtiaXRzXTsKICAgICAgICAgIHdoaWxlIChuICE9PSAwKSB7CiAgICAgICAgICAgIG0gPSBzLmhlYXBbLS1oXTsKICAgICAgICAgICAgaWYgKG0gPiBtYXhfY29kZSkgewogICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh0cmVlW20gKiAyICsgMV0gIT09IGJpdHMpIHsKICAgICAgICAgICAgICBzLm9wdF9sZW4gKz0gKGJpdHMgLSB0cmVlW20gKiAyICsgMV0pICogdHJlZVttICogMl07CiAgICAgICAgICAgICAgdHJlZVttICogMiArIDFdID0gYml0czsKICAgICAgICAgICAgfQogICAgICAgICAgICBuLS07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGdlbl9jb2Rlcyh0cmVlLCBtYXhfY29kZSwgYmxfY291bnQpIHsKICAgICAgICB2YXIgbmV4dF9jb2RlID0gbmV3IEFycmF5KE1BWF9CSVRTICsgMSk7CiAgICAgICAgdmFyIGNvZGUgPSAwOwogICAgICAgIHZhciBiaXRzOwogICAgICAgIHZhciBuOwogICAgICAgIGZvciAoYml0cyA9IDE7IGJpdHMgPD0gTUFYX0JJVFM7IGJpdHMrKykgewogICAgICAgICAgbmV4dF9jb2RlW2JpdHNdID0gY29kZSA9IGNvZGUgKyBibF9jb3VudFtiaXRzIC0gMV0gPDwgMTsKICAgICAgICB9CiAgICAgICAgZm9yIChuID0gMDsgbiA8PSBtYXhfY29kZTsgbisrKSB7CiAgICAgICAgICB2YXIgbGVuID0gdHJlZVtuICogMiArIDFdOwogICAgICAgICAgaWYgKGxlbiA9PT0gMCkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIHRyZWVbbiAqIDJdID0gYmlfcmV2ZXJzZShuZXh0X2NvZGVbbGVuXSsrLCBsZW4pOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiB0cl9zdGF0aWNfaW5pdCgpIHsKICAgICAgICB2YXIgbjsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgbGVuZ3RoOwogICAgICAgIHZhciBjb2RlOwogICAgICAgIHZhciBkaXN0OwogICAgICAgIHZhciBibF9jb3VudCA9IG5ldyBBcnJheShNQVhfQklUUyArIDEpOwogICAgICAgIGxlbmd0aCA9IDA7CiAgICAgICAgZm9yIChjb2RlID0gMDsgY29kZSA8IExFTkdUSF9DT0RFUyAtIDE7IGNvZGUrKykgewogICAgICAgICAgYmFzZV9sZW5ndGhbY29kZV0gPSBsZW5ndGg7CiAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgMSA8PCBleHRyYV9sYml0c1tjb2RlXTsgbisrKSB7CiAgICAgICAgICAgIF9sZW5ndGhfY29kZVtsZW5ndGgrK10gPSBjb2RlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBfbGVuZ3RoX2NvZGVbbGVuZ3RoIC0gMV0gPSBjb2RlOwogICAgICAgIGRpc3QgPSAwOwogICAgICAgIGZvciAoY29kZSA9IDA7IGNvZGUgPCAxNjsgY29kZSsrKSB7CiAgICAgICAgICBiYXNlX2Rpc3RbY29kZV0gPSBkaXN0OwogICAgICAgICAgZm9yIChuID0gMDsgbiA8IDEgPDwgZXh0cmFfZGJpdHNbY29kZV07IG4rKykgewogICAgICAgICAgICBfZGlzdF9jb2RlW2Rpc3QrK10gPSBjb2RlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkaXN0ID4+PSA3OwogICAgICAgIGZvciAoOyBjb2RlIDwgRF9DT0RFUzsgY29kZSsrKSB7CiAgICAgICAgICBiYXNlX2Rpc3RbY29kZV0gPSBkaXN0IDw8IDc7CiAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgMSA8PCBleHRyYV9kYml0c1tjb2RlXSAtIDc7IG4rKykgewogICAgICAgICAgICBfZGlzdF9jb2RlWzI1NiArIGRpc3QrK10gPSBjb2RlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmb3IgKGJpdHMgPSAwOyBiaXRzIDw9IE1BWF9CSVRTOyBiaXRzKyspIHsKICAgICAgICAgIGJsX2NvdW50W2JpdHNdID0gMDsKICAgICAgICB9CiAgICAgICAgbiA9IDA7CiAgICAgICAgd2hpbGUgKG4gPD0gMTQzKSB7CiAgICAgICAgICBzdGF0aWNfbHRyZWVbbiAqIDIgKyAxXSA9IDg7CiAgICAgICAgICBuKys7CiAgICAgICAgICBibF9jb3VudFs4XSsrOwogICAgICAgIH0KICAgICAgICB3aGlsZSAobiA8PSAyNTUpIHsKICAgICAgICAgIHN0YXRpY19sdHJlZVtuICogMiArIDFdID0gOTsKICAgICAgICAgIG4rKzsKICAgICAgICAgIGJsX2NvdW50WzldKys7CiAgICAgICAgfQogICAgICAgIHdoaWxlIChuIDw9IDI3OSkgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA3OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbN10rKzsKICAgICAgICB9CiAgICAgICAgd2hpbGUgKG4gPD0gMjg3KSB7CiAgICAgICAgICBzdGF0aWNfbHRyZWVbbiAqIDIgKyAxXSA9IDg7CiAgICAgICAgICBuKys7CiAgICAgICAgICBibF9jb3VudFs4XSsrOwogICAgICAgIH0KICAgICAgICBnZW5fY29kZXMoc3RhdGljX2x0cmVlLCBMX0NPREVTICsgMSwgYmxfY291bnQpOwogICAgICAgIGZvciAobiA9IDA7IG4gPCBEX0NPREVTOyBuKyspIHsKICAgICAgICAgIHN0YXRpY19kdHJlZVtuICogMiArIDFdID0gNTsKICAgICAgICAgIHN0YXRpY19kdHJlZVtuICogMl0gPSBiaV9yZXZlcnNlKG4sIDUpOwogICAgICAgIH0KICAgICAgICBzdGF0aWNfbF9kZXNjID0gbmV3IFN0YXRpY1RyZWVEZXNjKHN0YXRpY19sdHJlZSwgZXh0cmFfbGJpdHMsIExJVEVSQUxTICsgMSwgTF9DT0RFUywgTUFYX0JJVFMpOwogICAgICAgIHN0YXRpY19kX2Rlc2MgPSBuZXcgU3RhdGljVHJlZURlc2Moc3RhdGljX2R0cmVlLCBleHRyYV9kYml0cywgMCwgRF9DT0RFUywgTUFYX0JJVFMpOwogICAgICAgIHN0YXRpY19ibF9kZXNjID0gbmV3IFN0YXRpY1RyZWVEZXNjKG5ldyBBcnJheSgwKSwgZXh0cmFfYmxiaXRzLCAwLCBCTF9DT0RFUywgTUFYX0JMX0JJVFMpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluaXRfYmxvY2socykgewogICAgICAgIHZhciBuOwogICAgICAgIGZvciAobiA9IDA7IG4gPCBMX0NPREVTOyBuKyspIHsKICAgICAgICAgIHMuZHluX2x0cmVlW24gKiAyXSA9IDA7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDA7IG4gPCBEX0NPREVTOyBuKyspIHsKICAgICAgICAgIHMuZHluX2R0cmVlW24gKiAyXSA9IDA7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDA7IG4gPCBCTF9DT0RFUzsgbisrKSB7CiAgICAgICAgICBzLmJsX3RyZWVbbiAqIDJdID0gMDsKICAgICAgICB9CiAgICAgICAgcy5keW5fbHRyZWVbRU5EX0JMT0NLICogMl0gPSAxOwogICAgICAgIHMub3B0X2xlbiA9IHMuc3RhdGljX2xlbiA9IDA7CiAgICAgICAgcy5sYXN0X2xpdCA9IHMubWF0Y2hlcyA9IDA7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYmlfd2luZHVwKHMpIHsKICAgICAgICBpZiAocy5iaV92YWxpZCA+IDgpIHsKICAgICAgICAgIHB1dF9zaG9ydChzLCBzLmJpX2J1Zik7CiAgICAgICAgfSBlbHNlIGlmIChzLmJpX3ZhbGlkID4gMCkgewogICAgICAgICAgcy5wZW5kaW5nX2J1ZltzLnBlbmRpbmcrK10gPSBzLmJpX2J1ZjsKICAgICAgICB9CiAgICAgICAgcy5iaV9idWYgPSAwOwogICAgICAgIHMuYmlfdmFsaWQgPSAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGNvcHlfYmxvY2socywgYnVmLCBsZW4sIGhlYWRlcikgewogICAgICAgIGJpX3dpbmR1cChzKTsKICAgICAgICBpZiAoaGVhZGVyKSB7CiAgICAgICAgICBwdXRfc2hvcnQocywgbGVuKTsKICAgICAgICAgIHB1dF9zaG9ydChzLCB+bGVuKTsKICAgICAgICB9CiAgICAgICAgdXRpbHMuYXJyYXlTZXQocy5wZW5kaW5nX2J1Ziwgcy53aW5kb3csIGJ1ZiwgbGVuLCBzLnBlbmRpbmcpOwogICAgICAgIHMucGVuZGluZyArPSBsZW47CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc21hbGxlcih0cmVlLCBuLCBtLCBkZXB0aCkgewogICAgICAgIHZhciBfbjIgPSBuICogMjsKICAgICAgICB2YXIgX20yID0gbSAqIDI7CiAgICAgICAgcmV0dXJuIHRyZWVbX24yXSA8IHRyZWVbX20yXSB8fCB0cmVlW19uMl0gPT09IHRyZWVbX20yXSAmJiBkZXB0aFtuXSA8PSBkZXB0aFttXTsKICAgICAgfQogICAgICBmdW5jdGlvbiBwcWRvd25oZWFwKHMsIHRyZWUsIGspIHsKICAgICAgICB2YXIgdiA9IHMuaGVhcFtrXTsKICAgICAgICB2YXIgaiA9IGsgPDwgMTsKICAgICAgICB3aGlsZSAoaiA8PSBzLmhlYXBfbGVuKSB7CiAgICAgICAgICBpZiAoaiA8IHMuaGVhcF9sZW4gJiYgc21hbGxlcih0cmVlLCBzLmhlYXBbaiArIDFdLCBzLmhlYXBbal0sIHMuZGVwdGgpKSB7CiAgICAgICAgICAgIGorKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzbWFsbGVyKHRyZWUsIHYsIHMuaGVhcFtqXSwgcy5kZXB0aCkpIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgICBzLmhlYXBba10gPSBzLmhlYXBbal07CiAgICAgICAgICBrID0gajsKICAgICAgICAgIGogPDw9IDE7CiAgICAgICAgfQogICAgICAgIHMuaGVhcFtrXSA9IHY7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gY29tcHJlc3NfYmxvY2socywgbHRyZWUsIGR0cmVlKSB7CiAgICAgICAgdmFyIGRpc3Q7CiAgICAgICAgdmFyIGxjOwogICAgICAgIHZhciBseCA9IDA7CiAgICAgICAgdmFyIGNvZGU7CiAgICAgICAgdmFyIGV4dHJhOwogICAgICAgIGlmIChzLmxhc3RfbGl0ICE9PSAwKSB7CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIGRpc3QgPSBzLnBlbmRpbmdfYnVmW3MuZF9idWYgKyBseCAqIDJdIDw8IDggfCBzLnBlbmRpbmdfYnVmW3MuZF9idWYgKyBseCAqIDIgKyAxXTsKICAgICAgICAgICAgbGMgPSBzLnBlbmRpbmdfYnVmW3MubF9idWYgKyBseF07CiAgICAgICAgICAgIGx4Kys7CiAgICAgICAgICAgIGlmIChkaXN0ID09PSAwKSB7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGxjLCBsdHJlZSk7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgY29kZSA9IF9sZW5ndGhfY29kZVtsY107CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGNvZGUgKyBMSVRFUkFMUyArIDEsIGx0cmVlKTsKICAgICAgICAgICAgICBleHRyYSA9IGV4dHJhX2xiaXRzW2NvZGVdOwogICAgICAgICAgICAgIGlmIChleHRyYSAhPT0gMCkgewogICAgICAgICAgICAgICAgbGMgLT0gYmFzZV9sZW5ndGhbY29kZV07CiAgICAgICAgICAgICAgICBzZW5kX2JpdHMocywgbGMsIGV4dHJhKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgZGlzdC0tOwogICAgICAgICAgICAgIGNvZGUgPSBkX2NvZGUoZGlzdCk7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGNvZGUsIGR0cmVlKTsKICAgICAgICAgICAgICBleHRyYSA9IGV4dHJhX2RiaXRzW2NvZGVdOwogICAgICAgICAgICAgIGlmIChleHRyYSAhPT0gMCkgewogICAgICAgICAgICAgICAgZGlzdCAtPSBiYXNlX2Rpc3RbY29kZV07CiAgICAgICAgICAgICAgICBzZW5kX2JpdHMocywgZGlzdCwgZXh0cmEpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfSB3aGlsZSAobHggPCBzLmxhc3RfbGl0KTsKICAgICAgICB9CiAgICAgICAgc2VuZF9jb2RlKHMsIEVORF9CTE9DSywgbHRyZWUpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJ1aWxkX3RyZWUocywgZGVzYykgewogICAgICAgIHZhciB0cmVlID0gZGVzYy5keW5fdHJlZTsKICAgICAgICB2YXIgc3RyZWUgPSBkZXNjLnN0YXRfZGVzYy5zdGF0aWNfdHJlZTsKICAgICAgICB2YXIgaGFzX3N0cmVlID0gZGVzYy5zdGF0X2Rlc2MuaGFzX3N0cmVlOwogICAgICAgIHZhciBlbGVtcyA9IGRlc2Muc3RhdF9kZXNjLmVsZW1zOwogICAgICAgIHZhciBuLCBtOwogICAgICAgIHZhciBtYXhfY29kZSA9IC0xOwogICAgICAgIHZhciBub2RlOwogICAgICAgIHMuaGVhcF9sZW4gPSAwOwogICAgICAgIHMuaGVhcF9tYXggPSBIRUFQX1NJWkU7CiAgICAgICAgZm9yIChuID0gMDsgbiA8IGVsZW1zOyBuKyspIHsKICAgICAgICAgIGlmICh0cmVlW24gKiAyXSAhPT0gMCkgewogICAgICAgICAgICBzLmhlYXBbKytzLmhlYXBfbGVuXSA9IG1heF9jb2RlID0gbjsKICAgICAgICAgICAgcy5kZXB0aFtuXSA9IDA7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0cmVlW24gKiAyICsgMV0gPSAwOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB3aGlsZSAocy5oZWFwX2xlbiA8IDIpIHsKICAgICAgICAgIG5vZGUgPSBzLmhlYXBbKytzLmhlYXBfbGVuXSA9IG1heF9jb2RlIDwgMiA/ICsrbWF4X2NvZGUgOiAwOwogICAgICAgICAgdHJlZVtub2RlICogMl0gPSAxOwogICAgICAgICAgcy5kZXB0aFtub2RlXSA9IDA7CiAgICAgICAgICBzLm9wdF9sZW4tLTsKICAgICAgICAgIGlmIChoYXNfc3RyZWUpIHsKICAgICAgICAgICAgcy5zdGF0aWNfbGVuIC09IHN0cmVlW25vZGUgKiAyICsgMV07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGRlc2MubWF4X2NvZGUgPSBtYXhfY29kZTsKICAgICAgICBmb3IgKG4gPSBzLmhlYXBfbGVuID4+IDE7IG4gPj0gMTsgbi0tKSB7CiAgICAgICAgICBwcWRvd25oZWFwKHMsIHRyZWUsIG4pOwogICAgICAgIH0KICAgICAgICBub2RlID0gZWxlbXM7CiAgICAgICAgZG8gewogICAgICAgICAgbiA9IHMuaGVhcFsxXTsKICAgICAgICAgIHMuaGVhcFsxXSA9IHMuaGVhcFtzLmhlYXBfbGVuLS1dOwogICAgICAgICAgcHFkb3duaGVhcChzLCB0cmVlLCAxKTsKICAgICAgICAgIG0gPSBzLmhlYXBbMV07CiAgICAgICAgICBzLmhlYXBbLS1zLmhlYXBfbWF4XSA9IG47CiAgICAgICAgICBzLmhlYXBbLS1zLmhlYXBfbWF4XSA9IG07CiAgICAgICAgICB0cmVlW25vZGUgKiAyXSA9IHRyZWVbbiAqIDJdICsgdHJlZVttICogMl07CiAgICAgICAgICBzLmRlcHRoW25vZGVdID0gKHMuZGVwdGhbbl0gPj0gcy5kZXB0aFttXSA/IHMuZGVwdGhbbl0gOiBzLmRlcHRoW21dKSArIDE7CiAgICAgICAgICB0cmVlW24gKiAyICsgMV0gPSB0cmVlW20gKiAyICsgMV0gPSBub2RlOwogICAgICAgICAgcy5oZWFwWzFdID0gbm9kZSsrOwogICAgICAgICAgcHFkb3duaGVhcChzLCB0cmVlLCAxKTsKICAgICAgICB9IHdoaWxlIChzLmhlYXBfbGVuID49IDIpOwogICAgICAgIHMuaGVhcFstLXMuaGVhcF9tYXhdID0gcy5oZWFwWzFdOwogICAgICAgIGdlbl9iaXRsZW4ocywgZGVzYyk7CiAgICAgICAgZ2VuX2NvZGVzKHRyZWUsIG1heF9jb2RlLCBzLmJsX2NvdW50KTsKICAgICAgfQogICAgICBmdW5jdGlvbiBzY2FuX3RyZWUocywgdHJlZSwgbWF4X2NvZGUpIHsKICAgICAgICB2YXIgbjsKICAgICAgICB2YXIgcHJldmxlbiA9IC0xOwogICAgICAgIHZhciBjdXJsZW47CiAgICAgICAgdmFyIG5leHRsZW4gPSB0cmVlWzAgKiAyICsgMV07CiAgICAgICAgdmFyIGNvdW50ID0gMDsKICAgICAgICB2YXIgbWF4X2NvdW50ID0gNzsKICAgICAgICB2YXIgbWluX2NvdW50ID0gNDsKICAgICAgICBpZiAobmV4dGxlbiA9PT0gMCkgewogICAgICAgICAgbWF4X2NvdW50ID0gMTM4OwogICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICB9CiAgICAgICAgdHJlZVsobWF4X2NvZGUgKyAxKSAqIDIgKyAxXSA9IDY1NTM1OwogICAgICAgIGZvciAobiA9IDA7IG4gPD0gbWF4X2NvZGU7IG4rKykgewogICAgICAgICAgY3VybGVuID0gbmV4dGxlbjsKICAgICAgICAgIG5leHRsZW4gPSB0cmVlWyhuICsgMSkgKiAyICsgMV07CiAgICAgICAgICBpZiAoKytjb3VudCA8IG1heF9jb3VudCAmJiBjdXJsZW4gPT09IG5leHRsZW4pIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvdW50IDwgbWluX2NvdW50KSB7CiAgICAgICAgICAgIHMuYmxfdHJlZVtjdXJsZW4gKiAyXSArPSBjb3VudDsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VybGVuICE9PSAwKSB7CiAgICAgICAgICAgIGlmIChjdXJsZW4gIT09IHByZXZsZW4pIHsKICAgICAgICAgICAgICBzLmJsX3RyZWVbY3VybGVuICogMl0rKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBzLmJsX3RyZWVbUkVQXzNfNiAqIDJdKys7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvdW50IDw9IDEwKSB7CiAgICAgICAgICAgIHMuYmxfdHJlZVtSRVBaXzNfMTAgKiAyXSsrOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5ibF90cmVlW1JFUFpfMTFfMTM4ICogMl0rKzsKICAgICAgICAgIH0KICAgICAgICAgIGNvdW50ID0gMDsKICAgICAgICAgIHByZXZsZW4gPSBjdXJsZW47CiAgICAgICAgICBpZiAobmV4dGxlbiA9PT0gMCkgewogICAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiA9PT0gbmV4dGxlbikgewogICAgICAgICAgICBtYXhfY291bnQgPSA2OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNzsKICAgICAgICAgICAgbWluX2NvdW50ID0gNDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2VuZF90cmVlKHMsIHRyZWUsIG1heF9jb2RlKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIHByZXZsZW4gPSAtMTsKICAgICAgICB2YXIgY3VybGVuOwogICAgICAgIHZhciBuZXh0bGVuID0gdHJlZVswICogMiArIDFdOwogICAgICAgIHZhciBjb3VudCA9IDA7CiAgICAgICAgdmFyIG1heF9jb3VudCA9IDc7CiAgICAgICAgdmFyIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgIG1heF9jb3VudCA9IDEzODsKICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDA7IG4gPD0gbWF4X2NvZGU7IG4rKykgewogICAgICAgICAgY3VybGVuID0gbmV4dGxlbjsKICAgICAgICAgIG5leHRsZW4gPSB0cmVlWyhuICsgMSkgKiAyICsgMV07CiAgICAgICAgICBpZiAoKytjb3VudCA8IG1heF9jb3VudCAmJiBjdXJsZW4gPT09IG5leHRsZW4pIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvdW50IDwgbWluX2NvdW50KSB7CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBzZW5kX2NvZGUocywgY3VybGVuLCBzLmJsX3RyZWUpOwogICAgICAgICAgICB9IHdoaWxlICgtLWNvdW50ICE9PSAwKTsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VybGVuICE9PSAwKSB7CiAgICAgICAgICAgIGlmIChjdXJsZW4gIT09IHByZXZsZW4pIHsKICAgICAgICAgICAgICBzZW5kX2NvZGUocywgY3VybGVuLCBzLmJsX3RyZWUpOwogICAgICAgICAgICAgIGNvdW50LS07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZF9jb2RlKHMsIFJFUF8zXzYsIHMuYmxfdHJlZSk7CiAgICAgICAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDMsIDIpOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkgewogICAgICAgICAgICBzZW5kX2NvZGUocywgUkVQWl8zXzEwLCBzLmJsX3RyZWUpOwogICAgICAgICAgICBzZW5kX2JpdHMocywgY291bnQgLSAzLCAzKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHNlbmRfY29kZShzLCBSRVBaXzExXzEzOCwgcy5ibF90cmVlKTsKICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGNvdW50IC0gMTEsIDcpOwogICAgICAgICAgfQogICAgICAgICAgY291bnQgPSAwOwogICAgICAgICAgcHJldmxlbiA9IGN1cmxlbjsKICAgICAgICAgIGlmIChuZXh0bGVuID09PSAwKSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDEzODsKICAgICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDY7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBtYXhfY291bnQgPSA3OwogICAgICAgICAgICBtaW5fY291bnQgPSA0OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBidWlsZF9ibF90cmVlKHMpIHsKICAgICAgICB2YXIgbWF4X2JsaW5kZXg7CiAgICAgICAgc2Nhbl90cmVlKHMsIHMuZHluX2x0cmVlLCBzLmxfZGVzYy5tYXhfY29kZSk7CiAgICAgICAgc2Nhbl90cmVlKHMsIHMuZHluX2R0cmVlLCBzLmRfZGVzYy5tYXhfY29kZSk7CiAgICAgICAgYnVpbGRfdHJlZShzLCBzLmJsX2Rlc2MpOwogICAgICAgIGZvciAobWF4X2JsaW5kZXggPSBCTF9DT0RFUyAtIDE7IG1heF9ibGluZGV4ID49IDM7IG1heF9ibGluZGV4LS0pIHsKICAgICAgICAgIGlmIChzLmJsX3RyZWVbYmxfb3JkZXJbbWF4X2JsaW5kZXhdICogMiArIDFdICE9PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLm9wdF9sZW4gKz0gMyAqIChtYXhfYmxpbmRleCArIDEpICsgNSArIDUgKyA0OwogICAgICAgIHJldHVybiBtYXhfYmxpbmRleDsKICAgICAgfQogICAgICBmdW5jdGlvbiBzZW5kX2FsbF90cmVlcyhzLCBsY29kZXMsIGRjb2RlcywgYmxjb2RlcykgewogICAgICAgIHZhciByYW5rOwogICAgICAgIHNlbmRfYml0cyhzLCBsY29kZXMgLSAyNTcsIDUpOwogICAgICAgIHNlbmRfYml0cyhzLCBkY29kZXMgLSAxLCA1KTsKICAgICAgICBzZW5kX2JpdHMocywgYmxjb2RlcyAtIDQsIDQpOwogICAgICAgIGZvciAocmFuayA9IDA7IHJhbmsgPCBibGNvZGVzOyByYW5rKyspIHsKICAgICAgICAgIHNlbmRfYml0cyhzLCBzLmJsX3RyZWVbYmxfb3JkZXJbcmFua10gKiAyICsgMV0sIDMpOwogICAgICAgIH0KICAgICAgICBzZW5kX3RyZWUocywgcy5keW5fbHRyZWUsIGxjb2RlcyAtIDEpOwogICAgICAgIHNlbmRfdHJlZShzLCBzLmR5bl9kdHJlZSwgZGNvZGVzIC0gMSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGV0ZWN0X2RhdGFfdHlwZShzKSB7CiAgICAgICAgdmFyIGJsYWNrX21hc2sgPSA0MDkzNjI0NDQ3OwogICAgICAgIHZhciBuOwogICAgICAgIGZvciAobiA9IDA7IG4gPD0gMzE7IG4rKywgYmxhY2tfbWFzayA+Pj49IDEpIHsKICAgICAgICAgIGlmIChibGFja19tYXNrICYgMSAmJiBzLmR5bl9sdHJlZVtuICogMl0gIT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIFpfQklOQVJZOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5keW5fbHRyZWVbOSAqIDJdICE9PSAwIHx8IHMuZHluX2x0cmVlWzEwICogMl0gIT09IDAgfHwgcy5keW5fbHRyZWVbMTMgKiAyXSAhPT0gMCkgewogICAgICAgICAgcmV0dXJuIFpfVEVYVDsKICAgICAgICB9CiAgICAgICAgZm9yIChuID0gMzI7IG4gPCBMSVRFUkFMUzsgbisrKSB7CiAgICAgICAgICBpZiAocy5keW5fbHRyZWVbbiAqIDJdICE9PSAwKSB7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KyBidWZbcG9zKytdIHwgMDsKICAgICAgICAgICAgczIgPSBzMiArIHMxIHwgMDsKICAgICAgICAgIH0gd2hpbGUgKC0tbik7CiAgICAgICAgICBzMSAlPSA2NTUyMTsKICAgICAgICAgIHMyICU9IDY1NTIxOwogICAgICAgIH0KICAgICAgICByZXR1cm4gczEgfCBzMiA8PCAxNiB8IDA7CiAgICAgIH0KICAgICAgbW9kdWxlLmV4cG9ydHMgPSBhZGxlcjMyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvY3JjMzIuanMKICB2YXIgcmVxdWlyZV9jcmMzMiA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9jcmMzMi5qcyIoZXhwb3J0cywgbW9kdWxlKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBmdW5jdGlvbiBtYWtlVGFibGUoKSB7CiAgICAgICAgdmFyIGMsIHRhYmxlID0gW107CiAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCAyNTY7IG4rKykgewogICAgICAgICAgYyA9IG47CiAgICAgICAgICBmb3IgKHZhciBrID0gMDsgayA8IDg7IGsrKykgewogICAgICAgICAgICBjID0gYyAmIDEgPyAzOTg4MjkyMzg0IF4gYyA+Pj4gMSA6IGMgPj4+IDE7CiAgICAgICAgICB9CiAgICAgICAgICB0YWJsZVtuXSA9IGM7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0YWJsZTsKICAgICAgfQogICAgICB2YXIgY3JjVGFibGUgPSBtYWtlVGFibGUoKTsKICAgICAgZnVuY3Rpb24gY3JjMzIyKGNyYywgYnVmLCBsZW4sIHBvcykgewogICAgICAgIHZhciB0ID0gY3JjVGFibGUsIGVuZCA9IHBvcyArIGxlbjsKICAgICAgICBjcmMgXj0gLTE7CiAgICAgICAgZm9yICh2YXIgaSA9IHBvczsgaSA8IGVuZDsgaSsrKSB7CiAgICAgICAgICBjcmMgPSBjcmMgPj4+IDggXiB0WyhjcmMgXiBidWZbaV0pICYgMjU1XTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGNyYyBeIC0xOwogICAgICB9CiAgICAgIG1vZHVsZS5leHBvcnRzID0gY3JjMzIyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvbWVzc2FnZXMuanMKICB2YXIgcmVxdWlyZV9tZXNzYWdlczIgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvbWVzc2FnZXMuanMiKGV4cG9ydHMsIG1vZHVsZSkgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgbW9kdWxlLmV4cG9ydHMgPSB7CiAgICAgICAgMjogIm5lZWQgZGljdGlvbmFyeSIsCiAgICAgICAgMTogInN0cmVhbSBlbmQiLAogICAgICAgIDA6ICIiLAogICAgICAgICItMSI6ICJmaWxlIGVycm9yIiwKICAgICAgICAiLTIiOiAic3RyZWFtIGVycm9yIiwKICAgICAgICAiLTMiOiAiZGF0YSBlcnJvciIsCiAgICAgICAgIi00IjogImluc3VmZmljaWVudCBtZW1vcnkiLAogICAgICAgICItNSI6ICJidWZmZXIgZXJyb3IiLAogICAgICAgICItNiI6ICJpbmNvbXBhdGlibGUgdmVyc2lvbiIKICAgICAgfTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2RlZmxhdGUuanMKICB2Y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b2RlXTsKICAgICAgICByZXR1cm4gZXJyb3JDb2RlOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHJhbmsoZikgewogICAgICAgIHJldHVybiAoZiA8PCAxKSAtIChmID4gNCA/IDkgOiAwKTsKICAgICAgfQogICAgICBmdW5jdGlvbiB6ZXJvKGJ1ZikgewogICAgICAgIHZhciBsZW4gPSBidWYubGVuZ3RoOwogICAgICAgIHdoaWxlICgtLWxlbiA+PSAwKSB7CiAgICAgICAgICBidWZbbGVuXSA9IDA7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZsdXNoX3BlbmRpbmcoc3RybSkgewogICAgICAgIHZhciBzID0gc3RybS5zdGF0ZTsKICAgICAgICB2YXIgbGVuID0gcy5wZW5kaW5nOwogICAgICAgIGlmIChsZW4gPiBzdHJtLmF2YWlsX291dCkgewogICAgICAgICAgbGVuID0gc3RybS5hdmFpbF9vdXQ7CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gPT09IDApIHsKICAgICAgICAgIHJldHVybjsKICAgICAgICB9CiAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RybS5vdXRwdXQsIHMucGVuZGluZ19idWYsIHMucGVuZGluZ19vdXQsIGxlbiwgc3RybS5uZXh0X291dCk7CiAgICAgICAgc3RybS5uZXh0X291dCArPSBsZW47CiAgICAgICAgcy5wZW5kaW5nX291dCArPSBsZW47CiAgICAgICAgc3RybS50b3RhbF9vdXQgKz0gbGVuOwogICAgICAgIHN0cm0uYXZhaWxfb3V0IC09IGxlbjsKICAgICAgICBzLnBlbmRpbmcgLT0gbGVuOwogICAgICAgIGlmIChzLnBlbmRpbmcgPT09IDApIHsKICAgICAgICAgIHMucGVuZGluZ19vdXQgPSAwOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBmbHVzaF9ibG9ja19vbmx5KHMsIGxhc3QpIHsKICAgICAgICB0cmVlcy5fdHJfZmx1c2hfYmxvY2socywgcy5ibG9ja19zdGFydCA+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IHN0YXJ0KTsKICAgICAgICB9CiAgICAgICAgc3RybS5uZXh0X2luICs9IGxlbjsKICAgICAgICBzdHJtLnRvdGFsX2luICs9IGxlbjsKICAgICAgICByZXR1cm4gbGVuOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGxvbmdlc3RfbWF0Y2gocywgY3VyX21hdGNoKSB7CiAgICAgICAgdmFyIGNoYWluX2xlbmd0aCA9IHMubWF4X2NoYWluX2xlbmd0aDsKICAgICAgICB2YXIgc2NhbiA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgdmFyIG1hdGNoOwogICAgICAgIHZhciBsZW47CiAgICAgICAgdmFyIGJlc3RfbGVuID0gcy5wcmV2X2xlbmd0aDsKICAgICAgICB2YXIgbmljZV9tYXRjaCA9IHMubmljZV9tYXRjaDsKICAgICAgICB2YXIgbGltaXQgPSBzLnN0cnN0YXJ0ID4gcy53X3NpemUgLSBNSU5fTE9PS0FIRUFEID8gcy5zdHJzdGFydCAtIChzLndfc2l6ZSAtIE1JTl9MT09LQUhFQUQpIDogMDsKICAgICAgICB2YXIgX3dpbiA9IHMud2luZG93OwogICAgICAgIHZhciB3bWFzayA9IHMud19tYXNrOwogICAgICAgIHZhciBwcmV2ID0gcy5wcmV2OwogICAgICAgIHZhciBzdHJlbmQgPSBzLnN0cnN0YXJ0ICsgTUFYX01BVENIOwogICAgICAgIHZhciBzY2FuX2VuZDEgPSBfd2luW3NjYW4gKyBiZXN0X2xlbiAtIDFdOwogICAgICAgIHZhciBzY2FuX2VuZCA9IF93aW5bc2NhbiArIGJlc3RfbGVuXTsKICAgICAgICBpZiAocy5wcmV2X2xlbmd0aCA+PSBzLmdvb2RfbWF0Y2gpIHsKICAgICAgICAgIGNoYWluX2xlbmd0aCA+Pj0gMjsKICAgICAgICB9CiAgICAgICAgaWYgKG5pY2VfbWF0Y2ggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgbmljZV9tYXRjaCA9IHMubG9va2FoZWFkOwogICAgICAgIH0KICAgICAgICBkbyB7CiAgICAgICAgICBtYXRjaCA9IGN1cl9tYXRjaDsKICAgICAgICAgIGlmIChfd2luW21hdGNoICsgYmVzdF9sZW5dICE9PSBzY2FuX2VuZCB8fCBfd2luW21hdGNoICsgYmVzdF9sZW4gLSAxXSAhPT0gc2Nhbl9lbmQxIHx8IF93aW5bbWF0Y2hdICE9PSBfd2luW3NjYW5dIHx8IF93aW5bKyttYXRjaF0gIT09IF93aW5bc2NhbiArIDFdKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgc2NhbiArPSAyOwogICAgICAgICAgbWF0Y2grKzsKICAgICAgICAgIGRvIHsKICAgICAgICAgIH0gd2hpbGUgKF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgc2NhbiA8IHN0cmVuZCk7CiAgICAgICAgICBsZW4gPSBNQVhfTUFUQ0ggLSAoc3RyZW5kIC0gc2Nhbik7CiAgICAgICAgICBzY2FuID0gc3RyZW5kIC0gTUFYX01BVENIOwogICAgICAgICAgaWYgKGxlbiA+IGJlc3RfbGVuKSB7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgPSBjdXJfbWF0Y2g7CiAgICAgICAgICAgIGJlc3RfbGVuID0gbGVuOwogICAgICAgICAgICBpZiAobGVuID49IG5pY2VfbWF0Y2gpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBzY2FuX2VuZDEgPSBfd2luW3NjYW4gKyBiZXN0X2xlbiAtIDFdOwogICAgICAgICAgICBzY2FuX2VuZCA9IF93aW5bc2NhbiArIGJlc3RfbGVuXTsKICAgICAgICAgIH0KICAgICAgICB9IHdoaWxlICgoY3VyX21hdGNoID0gcHJldltjdXJfbWF0Y2ggJiB3bWFza10pID4gbGltaXQgJiYgLS1jaGFpbl9sZW5ndGggIT09IDApOwogICAgICAgIGlmIChiZXN0X2xlbiA8PSBzLmxvb2thaGVhZCkgewogICAgICAgICAgcmV0dXJuIGJlc3RfbGVuOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcy5sb29rYWhlYWQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZmlsbF93aW5kb3cocykgewogICAgICAgIHZhciBfd19zaXplID0gcy53X3NpemU7CiAgICAgICAgdmFyIHAsIG4sIG0sIG1vcmUsIHN0cjsKICAgICAgICBkbyB7CiAgICAgICAgICBtb3JlID0gcy53aW5kb3dfc2l6ZSAtIHMubG9va2FoZWFkIC0gcy5zdHJzdGFydDsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID49IF93X3NpemUgKyAoX3dfc2l6ZSAtIE1JTl9MT09LQUhFQUQpKSB7CiAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHMud2luZG93LCBzLndpbmRvdywgX3dfc2l6ZSwgX3dfc2l6ZSwgMCk7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgLT0gX3dfc2l6ZTsKICAgICAgICAgICAgcy5zdHJzdGFydCAtPSBfd19zaXplOwogICAgICAgICAgICBzLmJsb2NrX3N0YXJ0IC09IF93X3NpemU7CiAgICAgICAgICAgIG4gPSBzLmhhc2hfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5oZWFkWy0tcF07CiAgICAgICAgICAgICAgcy5oZWFkW3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBuID0gX3dfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5wcmV2Wy0tcF07CiAgICAgICAgICAgICAgcy5wcmV2W3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBtb3JlICs9IF93X3NpemU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX2luID09PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgbiA9IHJlYWRfYnVmKHMuc3RybSwgcy53aW5kb3csIHMuc3Ryc3RhcnQgKyBzLmxvb2thaGVhZCwgbW9yZSk7CiAgICAgICAgICBzLmxvb2thaGVhZCArPSBuOwogICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHN0ciA9IHMuc3Ryc3RhcnQgLSBzLmluc2VydDsKICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3N0cl07CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzdHIgKyAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgd2hpbGUgKHMuaW5zZXJ0KSB7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3N0ciArIE1JTl9NQVRDSCAtIDFdKSAmIHMuaGFzaF9tYXNrOwogICAgICAgICAgICAgIHMucHJldltzdHIgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gc3RyOwogICAgICAgICAgICAgIHN0cisrOwogICAgICAgICAgICAgIHMuaW5zZXJ0LS07CiAgICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPCBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBzLnN0cm0uYXZhaWxfaW4gIT09IDApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVfc3RvcmVkKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIG1heF9ibG9ja19zaXplID0gNjU1MzU7CiAgICAgICAgaWYgKG1heF9ibG9ja19zaXplID4gcy5wZW5kaW5nX2J1Zl9zaXplIC0gNSkgewogICAgICAgICAgbWF4X2Jsb2NrX3NpemUgPSBzLnBlbmRpbmdfYnVmX3NpemUgLSA1OwogICAgICAgIH0KICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8PSAxKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDAgJiYgZmx1c2ggPT09IFpfTk9fRkxVU0gpIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBzLnN0cnN0YXJ0ICs9IHMubG9va2FoZWFkOwogICAgICAgICAgcy5sb29rYWhlYWQgPSAwOwogICAgICAgICAgdmFyIG1heF9zdGFydCA9IHMuYmxvY2tfc3RhcnQgKyBtYXhfYmxvY2tfc2l6ZTsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID09PSAwIHx8IHMuc3Ryc3RhcnQgPj0gbWF4X3N0YXJ0KSB7CiAgICAgICAgICAgIHMubG9va2FoZWFkID0gcy5zdHJzdGFydCAtIG1heF9zdGFydDsKICAgICAgICAgICAgcy5zdHJzdGFydCA9IG1heF9zdGFydDsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgLSBzLmJsb2NrX3N0YXJ0ID49IHMud19zaXplIC0gTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5zdHJzdGFydCA+IHMuYmxvY2tfc3RhcnQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX2Zhc3QocywgZmx1c2gpIHsKICAgICAgICB2YXIgaGFzaF9oZWFkOwogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEICYmIGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDApIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaGFzaF9oZWFkID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgaGFzaF9oZWFkID0gcy5wcmV2W3Muc3Ryc3RhcnQgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoaGFzaF9oZWFkICE9PSAwICYmIHMuc3Ryc3RhcnQgLSBoYXNoX2hlYWQgPD0gcy53X3NpemUgLSBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gbG9uZ2VzdF9tYXRjaChzLCBoYXNoX2hlYWQpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHMubWF0Y2hfbGVuZ3RoID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICBiZmx1c2ggPSB0cmVlcy5fdHJfdGFsbHkocywgcy5zdHJzdGFydCAtIHMubWF0Y2hfc3RhcnQsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA8PSBzLm1heF9sYXp5X21hdGNoICYmIHMubG9va2FoZWFkID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoLS07CiAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9IHdoaWxlICgtLXMubWF0Y2hfbGVuZ3RoICE9PSAwKTsKICAgICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcy5zdHJzdGFydCArPSBzLm1hdGNoX2xlbmd0aDsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3Muc3Ryc3RhcnRdOwogICAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IHMuc3Ryc3RhcnQgPCBNSU5fTUFUQ0ggLSAxID8gcy5zdHJzdGFydCA6IE1JTl9NQVRDSCAtIDE7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9zbG93KHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGhhc2hfaGVhZDsKICAgICAgICB2YXIgYmZsdXNoOwogICAgICAgIHZhciBtYXhfaW5zZXJ0OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGhhc2hfaGVhZCA9IDA7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgTUlOX01BVENIIC0gMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICBzLmhlYWRbcy5pbnNfaF0gPSBzLnN0cnN0YXJ0OwogICAgICAgICAgfQogICAgICAgICAgcy5wcmV2X2xlbmd0aCA9IHMubWF0Y2hfbGVuZ3RoOwogICAgICAgICAgcy5wcmV2X21hdGNoID0gcy5tYXRjaF9zdGFydDsKICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gTUlOX01BVENIIC0gMTsKICAgICAgICAgIGlmIChoYXNoX2hlYWQg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ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gd2hpbGUgKC0tcy5wcmV2X2xlbmd0aCAhPT0gMCk7CiAgICAgICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMDsKICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAocy5tYXRjaF9hdmFpbGFibGUpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5tYXRjaF9hdmFpbGFibGUgPSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLm1hdGNoX2F2YWlsYWJsZSkgewogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICBzLm1hdGNoX2F2YWlsYWJsZSA9IDA7CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gcy5zdHJzdGFydCA8IE1JTl9NQVRDSCAtIDEgPyBzLnN0cnN0YXJ0IDogTUlOX01BVENIIC0gMTsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5sYXN0X2xpdCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gQlNfQkxPQ0tfRE9ORTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX3JsZShzLCBmbHVzaCkgewogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgdmFyIHByZXY7CiAgICAgICAgdmFyIHNjYW4sIHN0cmVuZDsKICAgICAgICB2YXIgX3dpbiA9IHMud2luZG93OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0ggJiYgcy5zdHJzdGFydCA+IDApIHsKICAgICAgICAgICAgc2NhbiA9IHMuc3Ryc3RhcnQgLSAxOwogICAgICAgICAgICBwcmV2ID0gX3dpbltzY2FuXTsKICAgICAgICAgICAgaWYgKHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dKSB7CiAgICAgICAgICAgICAgc3RyZW5kID0gcy5zdHJzdGFydCArIE1BWF9NQVRDSDsKICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgfSB3aGlsZSAocHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBzY2FuIDwgc3RyZW5kKTsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IE1BWF9NQVRDSCAtIChzdHJlbmQgLSBzY2FuKTsKICAgICAgICAgICAgICBpZiAocy5tYXRjaF9sZW5ndGggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBzLmxvb2thaGVhZDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDEsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgKz0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IDA7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9odWZmKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGJmbHVzaDsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSAwOwogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnRdKTsKICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgIGlmIChmbHVzaCA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgdHJ1ZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX1NUQVJURUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX0RPTkU7CiAgICAgICAgfQogICAgICAgIGlmIChzLmxhc3RfbGl0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBCU19CTE9DS19ET05FOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIENvbmZpZyhnb29kX2xlbmd0aCwgbWF4X2xhenksIG5pY2VfbGVuZ3RoLCBtYXhfY2hhaW4sIGZ1bmMpIHsKICAgICAgICB0aGlzLmdvb2RfbGVuZ3RoID0gZ29vZF9sZW5ndGg7CiAgICAgICAgdGhpcy5tYXhfbGF6eSA9IG1heF9sYXp5OwogICAgICAgIHRoaXMubmljZV9sZW5ndGggPSBuaWNlX2xlbmd0aDsKICAgICAgICB0aGlzLm1heF9jaGFpbiA9IG1heF9jaGFpbjsKICAgICAgICB0aGlzLmZ1bmMgPSBmdW5jOwogICAgICB9CiAgICAgIHZhciBjb25maWd1cmF0aW9uX3RhYmxlOwogICAgICBjb25maWd1cmF0aW9uX3RhYmxlID0gWwogICAgICAgIG5ldyBDb25maWcoMCwgMCwgMCwgMCwgZGVmbGF0ZV9zdG9yZWQpLAogICAgICAgIG5ldyBDb25maWcoNCwgNCwgOCwgNC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7CiAgICAgICAgcy5sb29rYWhlYWQgPSAwOwogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IHMucHJldl9sZW5ndGggPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMDsKICAgICAgICBzLmluc19oID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBEZWZsYXRlU3RhdGUoKSB7CiAgICAgICAgdGhpcy5zdHJtID0gbnVsbDsKICAgICAgICB0aGlzLnN0YXR1cyA9IDA7CiAgICAgICAgdGhpcy5wZW5kaW5nX2J1ZiA9IG51bGw7CiAgICAgICAgdGhpcy5wZW5kaW5nX2J1Zl9zaXplID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmcgPSAwOwogICAgICAgIHRoaXMud3JhcCA9IDA7CiAgICAgICAgdGhpcy5nemhlYWQgPSBudWxsOwogICAgICAgIHRoaXMuZ3ppbmRleCA9IDA7CiAgICAgICAgdGhpcy5tZXRob2QgPSBaX0RFRkxBVEVEOwogICAgICAgIHRoaXMubGFzdF9mbHVzaCA9IC0xOwogICAgICAgIHRoaXMud19zaXplID0gMDsKICAgICAgICB0aGlzLndfYml0cyA9IDA7CiAgICAgICAgdGhpcy53X21hc2sgPSAwOwogICAgICAgIHRoaXMud2luZG93ID0gbnVsbDsKICAgICAgICB0aGlzLndpbmRvd19zaXplID0gMDsKICAgICAgICB0aGlzLnByZXYgPSBudWxsOwogICAgICAgIHRoaXMuaGVhZCA9IG51bGw7CiAgICAgICAgdGhpcy5pbnNfaCA9IDA7CiAgICAgICAgdGhpcy5oYXNoX3NpemUgPSAwOwogICAgICAgIHRoaXMuaGFzaF9iaXRzID0gMDsKICAgICAgICB0aGlzLmhhc2hfbWFzayA9IDA7CiAgICAgICAgdGhpcy5oYXNoX3NoaWZ0ID0gMDsKICAgICAgICB0aGlzLmJsb2NrX3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WYxNigyICogTF9DT0RFUyArIDEpOwogICAgICAgIHplcm8odGhpcy5oZWFwKTsKICAgICAgICB0aGlzLmhlYXBfbGVuID0gMDsKICAgICAgICB0aGlzLmhlYXBfbWF4ID0gMDsKICAgICAgICB0aGlzLmRlcHRoID0gbmV3IHV0aWxzLkJ1ZjE2KDIgKiBMX0NPREVTICsgMSk7CiAgICAgICAgemVybyh0aGlzLmRlcHRoKTsKICAgICAgICB0aGlzLmxfYnVmID0gMDsKICAgICAgICB0aGlzLmxpdF9idWZzaXplID0gMDsKICAgICAgICB0aGlzLmxhc3RfbGl0ID0gMDsKICAgICAgICB0aGlzLmRfYnVmID0gMDsKICAgICAgICB0aGlzLm9wdF9sZW4gPSAwOwogICAgICAgIHRoaXMuc3RhdGljX2xlbiA9IDA7CiAgICAgICAgdGhpcy5tYXRjaGVzID0gMDsKICAgICAgICB0aGlzLmluc2VydCA9IDA7CiAgICAgICAgdGhpcy5iaV9idWYgPSAwOwogICAgICAgIHRoaXMuYmlfdmFsaWQgPSAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVSZXNldEtlZXAoc3RybSkgewogICAgICAgIHZhciBzOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBaX1NUUkVBTV9FUlJPUik7CiAgICAgICAgfQogICAgICAgIHN0cm0udG90YWxfaW4gPSBzdHJtLnRvdGFsX291dCA9IDA7CiAgICAgICAgc3RybS5kYXRhX3R5cGUgPSBaX1VOS05PV047CiAgICAgICAgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgcy5wZW5kaW5nID0gMDsKICAgICAgICBzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICBpZiAocy53cmFwIDwgMCkgewogICAgICAgICAgcy53cmFwID0gLXMud3JhcDsKICAgICAgICB9CiAgICAgICAgcy5zdGF0dXMgPSBzLndyYXAgPyBJTklUX1NUQVRFIDogQlVTWV9TVEFURTsKICAgICAgICBzdHJtLmFkbGVyID0gcy53cmFwID09PSAyID8gMCA6IDE7CiAgICAgICAgcy5sYXN0X2ZsdXNoID0gWl9OT19GTFVTSDsKICAgICAgICB0cmVlcy5fdHJfaW5pdChzKTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlUmVzZXQoc3RybSkgewogICAgICAgIHZhciByZXQgPSBkZWZsYXRlUmVzZXRLZWVwKHN0cm0pOwogICAgICAgIGlmIChyZXQgPT09IFpfT0spIHsKICAgICAgICAgIGxtX2luaXQoc3RybS5zdGF0ZSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZVNldEhlYWRlcihzdHJtLCBoZWFkKSB7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdHJtLnN0YXRlLndyYXAgIT09IDIpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RybS5zdGF0ZS5nemhlYWQgPSBoZWFkOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVJbml0MihzdHJtLCBsZXZlbCwgbWV0aG9kLCB3aW5kb3dCaXRzLCBtZW1MZXZlbCwgc3RyYXRlZ3kpIHsKICAgICAgICBpZiAoIXN0cm0pIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgdmFyIHdyYXAgPSAxOwogICAgICAgIGlmIChsZXZlbCA9PT0gWl9ERUZBVUxUX0NPTVBSRVNTSU9OKSB7CiAgICAgICAgICBsZXZlbCA9IDY7CiAgICAgICAgfQogICAgICAgIGlmICh3aW5kb3dCaXRzIDwgMCkgewogICAgICAgICAgd3JhcCA9IDA7CiAgICAgICAgICB3aW5kb3dCaXRzID0gLXdpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIGlmICh3aW5kb3dCaXRzID4gMTUpIHsKICAgICAgICAgIHdyYXAgPSAyOwogICAgICAgICAgd2luZG93Qml0cyAtPSAxNjsKICAgICAgICB9CiAgICAgICAgaWYgKG1lbUxldmVsIDwgMSB8fCBtZW1MZXZlbCA+IE1BWF9NRU1fTEVWRUwgfHwgbWV0aG9kICE9PSBaX0RFRkxBVEVEIHx8IHdpbmRvd0JpdHMgPCA4IHx8IHdpbmRvd0JpdHMgPiAxNSB8fCBsZXZlbCA8IDAgfHwgbGV2ZWwgPiA5IHx8IHN0cmF0ZWd5IDwgMCB8fCBzdHJhdGVneSA+IFpfRklYRUQpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBpZiAod2luZG93Qml0cyA9PT0gOCkgewogICAgICAgICAgd2luZG93Qml0cyA9IDk7CiAgICAgICAgfQogICAgICAgIHZhciBzID0gbmV3IERlZmxhdGVTdGF0ZSgpOwogICAgICAgIHN0cm0uc3RhdGUgPSBzOwogICAgICAgIHMuc3RybSA9IHN0cm07CiAgICAgICAgcy53cmFwID0gd3JhcDsKICAgICAgICBzLmd6aGVhZCA9IG51bGw7CiAgICAgICAgcy53X2JpdHMgPSB3aW5kb3dCaXRzOwogICAgICAgIHMud19zaXplID0gMSA8PCBzLndfYml0czsKICAgICAgICBzLndfbWFzayA9IHMud19zaXplIC0gMTsKICAgICAgICBzLmhhc2hfYml0cyA9IG1lbUxldmVsICsgNzsKICAgICAgICBzLmhhc2hfc2l6ZSA9IDEgPDwgcy5oYXNoX2JpdHM7CiAgICAgICAgcy5oYXNoX21hc2sgPSBzLmhhc2hfc2l6ZSAtIDE7CiAgICAgICAgcy5oYXNoX3NoaWZ0ID0gfn4oKHMuaGFzaF9iaXRzICsgTUlOX01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gICAgcmV0dXJuIHN0cm0gPyBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpIDogWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHMgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICghc3RybS5vdXRwdXQgfHwgIXN0cm0uaW5wdXQgJiYgc3RybS5hdmFpbF9pbiAhPT0gMCB8fCBzLnN0YXR1cyA9PT0gRklOSVNIX1NUQVRFICYmIGZsdXNoICE9PSBaX0ZJTklTSCkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBzdHJtLmF2YWlsX291dCA9PT0gMCA/IFpfQlVGX0VSUk9SIDogWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBzLnN0cm0gPSBzdHJtOwogICAgICAgIG9sZF9mbHVzaCA9IHMubGFzdF9mbHVzaDsKICAgICAgICBzLmxhc3RfZmx1c2ggPSBmbHVzaDsKICAgICAgICBpZiAocy5zdGF0dXMgPT09IElOSVRfU1RBVEUpIHsKICAgICAgICAgIGlmIChzLndyYXAgPT09IDIpIHsKICAgICAgICAgICAgc3RybS5hZGxlciA9IDA7CiAgICAgICAgICAgIHB1dF9ieXRlKHMsIDMxKTsKICAgICAgICAgICAgcHV0X2J5dGUocywgMTM5KTsKICAgICAgICAgICAgcHV0X2J5dGUocywgOCk7CiAgICAgICAgICAgIGlmICghcy5nemhlYWQpIHsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgT1NfQ09ERSk7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50ZXh0ID8gMSA6IDApICsgKHMuZ3poZWFkLmhjcmMgPyAyIDogMCkgKyAoIXMuZ3poZWFkLmV4dHJhID8gMCA6IDQpICsgKCFzLmd6aGVhZC5uYW1lID8gMCA6IDgpICsgKCFzLmd6aGVhZC5jb21tZW50ID8gMCA6IDE2KSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSA+PiA4ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDE2ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDI0ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQub3MgJiAyNTUpOwogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5leHRyYSAmJiBzLmd6aGVhZC5leHRyYS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLmV4dHJhLmxlbmd0aCAmIDI1NSk7CiAgICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYS5sZW5ndGggPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjKSB7CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZywgMCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBFWFRSQV9TVEFURTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdmFyIGhlYWRlciA9IFpfREVGTEFURUQgKyAocy53X2JpdHMgLSA4IDw8IDQpIDw8IDg7CiAgICAgICAgICAgIHZhciBsZXZlbF9mbGFncyA9IC0xOwogICAgICAgICAgICBpZiAocy5zdHJhdGVneSA+PSBaX0hVRkZNQU5fT05MWSB8fCBzLmxldmVsIDwgMikgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMDsKICAgICAgICAgICAgfSBlbHNlIGlmIChzLmxldmVsIDwgNikgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMTsKICAgICAgICAgICAgfSBlbHNlIGlmIChzLmxldmVsID09PSA2KSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAyOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMzsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXIgfD0gbGV2ZWxfZmxhZ3MgPDwgNjsKICAgICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgIT09IDApIHsKICAgICAgICAgICAgICBoZWFkZXIgfD0gUFJFU0VUX0RJQ1Q7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaGVhZGVyICs9IDMxIC0gaGVhZGVyICUgMzE7CiAgICAgICAgICAgIHMuc3RhdHVzID0gQlVTWV9TVEFURTsKICAgICAgICAgICAgcHV0U2hvcnRNU0IocywgaGVhZGVyKTsKICAgICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgIT09IDApIHsKICAgICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBzdHJtLmFkbGVyID4+PiAxNik7CiAgICAgICAgICAgICAgcHV0U2hvcnRNU0Iocywgc3RybS5hZGxlciAmIDY1NTM1KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzdHJtLmFkbGVyID0gMTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBFWFRSQV9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLmV4dHJhKSB7CiAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgd2hpbGUgKHMuZ3ppbmRleCA8IChzLmd6aGVhZC5leHRyYS5sZW5ndGggJiA2NTUzNSkpIHsKICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLmV4dHJhW3MuZ3ppbmRleF0gJiAyNTUpOwogICAgICAgICAgICAgIHMuZ3ppbmRleCsrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMjIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPT09IHMuZ3poZWFkLmV4dHJhLmxlbmd0aCkgewogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBOQU1FX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IE5BTUVfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gTkFNRV9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLm5hbWUpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyMihzdHJtLmFkbGVyLCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmcgLSBiZWcsIGJlZyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICAgIHZhbCA9IDE7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBpZiAocy5nemluZGV4IDwgcy5nemhlYWQubmFtZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHZhbCA9IHMuZ3poZWFkLm5hbWUuY2hhckNvZGVBdChzLmd6aW5kZXgrKykgJiAyNTU7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHZhbCA9IDA7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHZhbCk7CiAgICAgICAgICAgIH0gd2hpbGUgKHZhbCAhPT0gMCk7CiAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMjIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh2YWwgPT09IDApIHsKICAgICAgICAgICAgICBzLmd6aW5kZXggPSAwOwogICAgICAgICAgICAgIHMuc3RhdHVzID0gQ09NTUVOVF9TVEFURTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5zdGF0dXMgPSBDT01NRU5UX1NUQVRFOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5zdGF0dXMgPT09IENPTU1FTlRfU1RBVEUpIHsKICAgICAgICAgIGlmIChzLmd6aGVhZC5jb21tZW50KSB7CiAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMjIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgICB2YWwgPSAxOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHMuZ3ppbmRleCA8IHMuZ3poZWFkLmNvbW1lbnQubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICB2YWwgPSBzLmd6aGVhZC5jb21tZW50LmNoYXJDb2RlQXQocy5nemluZGV4KyspICYgMjU1OwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB2YWwgPSAwOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwdXRfYnl0ZShzLCB2YWwpOwogICAgICAgICAgICB9IHdoaWxlICh2YWwgIT09IDApOwogICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodmFsID09PSAwKSB7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBIQ1JDX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IEhDUkNfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gSENSQ19TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMpIHsKICAgICAgICAgICAgaWYgKHMucGVuZGluZyArIDIgPiBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgKyAyIDw9IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgJiAyNTUpOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IEJVU1lfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnBlbmRpbmcgIT09IDApIHsKICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcy5sYXN0X2ZsdXNoID0gLTE7CiAgICAgICAgICAgIHJldHVybiBaX09LOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSBpZiAoc3RybS5hdmFpbF9pbiA9PT0gMCAmJiByYW5rKGZsdXNoKSA8PSByYW5rKG9sZF9mbHVzaCkgJiYgZmx1c2ggIT09IFpfRklOSVNIKSB7CiAgICAgICAgICByZXR1cm4gZXJyKHN0cm0sIFpfQlVGX0VSUk9SKTsKICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBGSU5JU0hfU1RBVEUgJiYgc3RybS5hdmFpbF9pbiAhPT0gMCkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBaX0JVRl9FUlJPUik7CiAgICAgICAgfQogICAgICAgIGlmIChzdHJtLmF2YWlsX2luICE9PSAwIHx8IHMubG9va2FoZWF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plcm8ocy5oZWFkKTsKICAgICAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzLnN0cnN0YXJ0ID0gMDsKICAgICAgICAgICAgICAgICAgcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgICAgICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcy5sYXN0X2ZsdXNoID0gLTE7CiAgICAgICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKGZsdXNoICE9PSBaX0ZJTklTSCkgewogICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgfQogICAgICAgIGlmIChzLndyYXAgPD0gMCkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VORDsKICAgICAgICB9CiAgICAgICAgaWYgKHMud3JhcCA9PT0gMikgewogICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyID4+IDggJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciA+PiAxNiAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyID4+IDI0ICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0udG90YWxfaW4gJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiA+PiA4ICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0udG90YWxfaW4gPj4gMTYgJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiA+PiAyNCAmIDI1NSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHB1dFNob3J0TVNCKHMsIHN0cm0uYWRsZXIgPj4+IDE2KTsKICAgICAgICAgIHB1dFNob3J0TVNCKHMsIHN0cm0uYWRsZXIgJiA2NTUzNSk7CiAgICAgICAgfQogICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgaWYgKHMud3JhcCA+IDApIHsKICAgICAgICAgIHMud3JhcCA9IC1zLndyYXA7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzLnBlbmRpbmcgIT09IDAgPyBaX09LIDogWl9TVFJFQU1fRU5EOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVFbmQoc3RybSkgewogICAgICAgIHZhciBzdGF0dXM7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXR1cyA9IHN0cm0uc3RhdGUuc3RhdHVzOwogICAgICAgIGlmIChzdGF0dXMgIT09IElOSVRfU1RBVEUgJiYgc3RhdHVzICE9PSBFWFRSQV9TVEFURSAmJiBzdGF0dXMgIT09IE5BTUVfU1RBVEUgJiYgc3RhdHVzICE9PSBDT01NRU5UX1NUQVRFICYmIHN0YXR1cyAhPT0gSENSQ19TVEFURSAmJiBzdGF0dXMgIT09IEJVU1lfU1RBVEUgJiYgc3RhdHVzICE9PSBGSU5JU0hfU1RBVEUpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBzdHJtLnN0YXRlID0gbnVsbDsKICAgICAgICByZXR1cm4gc3RhdHVzID09PSBCVVNZX1NUQVRFID8gZXJyKHN0cm0sIFpfREFUQV9FUlJPUikgOiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVTZXREaWN0aW9uYXJ5KHN0cm0sIGRpY3Rpb25hcnkpIHsKICAgICAgICB2YXIgZGljdExlbmd0aCA9IGRpY3Rpb25hcnkubGVuZ3RoOwogICAgICAgIHZhciBzOwogICAgICAgIHZhciBzdHIsIG47CiAgICAgICAgdmFyIHdyYXA7CiAgICAgICAgdmFyIGF2YWlsOwogICAgICAgIHZhciBuZXh0OwogICAgICAgIHZhciBpbnB1dDsKICAgICAgICB2YXIgdG1wRGljdDsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgd3JhcCA9IHMud3JhcDsKICAgICAgICBpZiAod3JhcCA9PT0gMiB8fCB3cmFwID09PSAxICYmIHMuc3RhdHVzICE9PSBJTklUX1NUQVRFIHx8IHMubG9va2FoZWFkKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmICh3cmFwID09PSAxKSB7CiAgICAgICAgICBzdHJtLmFkbGVyID0gYWRsZXIzMihzdHJtLmFkbGVyLCBkaWN0aW9uYXJ5LCBkaWN0TGVuZ3RoLCAwKTsKICAgICAgICB9CiAgICAgICAgcy53cmFwID0gMDsKICAgICAgICBpZiAoZGljdExlbmd0aCA+PSBzLndfc2l6ZSkgewogICAgICAgICAgaWYgKHdyYXAgPT09IDApIHsKICAgICAgICAgICAgemVybyhzLmhlYWQpOwogICAgICAgICAgICBzLnN0cnN0YXJ0ID0gMDsKICAgICAgICAgICAgcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIHRtcERpY3QgPSBuZXcgdXRpbHMuQnVmOChzLndfc2l6ZSk7CiAgICAgICAgICB1dGlscy5hcnJheVNldCh0bXBEaWN0LCBkaWN0aW9uYXJ5LCBkaWN0TGVuZ3RoIC0gcy53X3NpemUsIHMud19zaXplLCAwKTsKICAgICAgICAgIGRpY3Rpb25hcnkgPSB0bXBEaWN0OwogICAgICAgICAgZGljdExlbmd0aCA9IHMud19zaXplOwogICAgICAgIH0KICAgICAgICBhdmFpbCA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgbmV4dCA9IHN0cm0ubmV4dF9pbjsKICAgICAgICBpbnB1dCA9IHN0cm0uaW5wdXQ7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IGRpY3RMZW5ndGg7CiAgICAgICAgc3RybS5uZXh0X2luID0gMDsKICAgICAgICBzdHJtLmlucHV0ID0gZGljdGlvbmFyeTsKICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICB3aGlsZSAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICBzdHIgPSBzLnN0cnN0YXJ0OwogICAgICAgICAgbiA9IHMubG9va2FoZWFkIC0gKE1JTl9NQVRDSCAtIDEpOwogICAgICAgICAgZG8gewogICAgICAgICAgICBzLmluc19oID0gKHMuaW5zX2ggPDwgcy5oYXNoX3NoaWZ0IF4gcy53aW5kb3dbc3RyICsgTUlOX01BVENIIC0gMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIHMucHJldltzdHIgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHN0cjsKICAgICAgICAgICAgc3RyKys7CiAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgcy5zdHJzdGFydCA9IHN0cjsKICAgICAgICAgIHMubG9va2FoZWFkID0gTUlOX01BVENIIC0gMTsKICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgIH0KICAgICAgICBzLnN0cnN0YXJ0ICs9IHMubG9va2FoZWFkOwogICAgICAgIHMuYmxvY2tfc3RhcnQgPSBzLnN0cnN0YXJ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RyLmxlbmd0aCwgYnVmX2xlbiA9IDA7CiAgICAgICAgZm9yIChtX3BvcyA9IDA7IG1fcG9zIDwgc3RyX2xlbjsgbV9wb3MrKykgewogICAgICAgICAgYyA9IHN0ci5jaGFyQ29kZUF0KG1fcG9zKTsKICAgICAgICAgIGlmICgoYyAmIDY0NTEyKSA9PT0gNTUyOTYgJiYgbV9wb3MgKyAxIDwgc3RyX2xlbikgewogICAgICAgICAgICBjMiA9IHN0ci5jaGFyQ29kZUF0KG1fcG9zICsgMSk7CiAgICAgICAgICAgIGlmICgoYzIgJiA2NDUxMikgPT09IDU2MzIwKSB7CiAgICAgICAgICAgICAgYyA9IDY1NTM2ICsgKGMgLSA1NTI5NiA8PCAxMCkgKyAoYzIgLSA1NjMyMCk7CiAgICAgICAgICAgICAgbV9wb3MrKzsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgYnVmX2xlbiArPSBjIDwgMTI4ID8gMSA6IGMgPCAyMDQ4ID8gMiA6IGMgPCA2NTUzNiA/IDMgOiA0OwogICAgICAgIH0KICAgICAgICBidWYgPSBuZXcgdXRpbHMuQnVmOChidWZfbGVuKTsKICAgICAgICBmb3IgKGkgPSAwLCBtX3BvcyA9IDA7IGkgPCBidWZfbGVuOyBtX3BvcysrKSB7CiAgICAgICAgICBjID0gc3RyLmNoYXJDb2RlQXQobV9wb3MpOwogICAgICAgICAgaWYgKChjICYgNjQ1MTIpID09PSA1NTI5NiAmJiBtX3BvcyArIDEgPCBzdHJfbGVuKSB7CiAgICAgICAgICAgIGMyID0gc3RyLmNoYXJDb2RlQXQobV9wb3MgKyAxKTsKICAgICAgICAgICAgaWYgKChjMiAmIDY0NTEyKSA9PT0gNTYzMjApIHsKICAgICAgICAgICAgICBjID0gNjU1MzYgKyAoYyAtIDU1Mjk2IDw8IDEwKSArIChjMiAtIDU2MzIwKTsKICAgICAgICAgICAgICBtX3BvcysrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDEyOCkgewogICAgICAgICAgICBidWZbaSsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCAyMDQ4KSB7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTkyIHwgYyA+Pj4gNjsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCA2NTUzNikgewogICAgICAgICAgICBidWZbaSsrXSA9IDIyNCB8IGMgPj4+IDEyOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDYgJiA2MzsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBidWZbaSsrXSA9IDI0MCB8IGMgPj4+IDE4OwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDEyICYgNjM7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTI4IHwgYyA+Pj4gNiAmIDYzOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgJiA2MzsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gYnVmMmJpbnN0cmluZyhidWYsIGxlbikgewogICAgICAgIGlmIChsZW4gPCA2NTUzNCkgewogICAgICAgICAgaWYgKGJ1Zi5zdWJhcnJheSAmJiBTVFJfQVBQTFlfVUlBX09LIHx8ICFidWYuc3ViYXJyYXkgJiYgU1RSX0FQUExZX09LKSB7CiAgICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KG51bGwsIHV0aWxzLnNocmlua0J1ZihidWYsIGxlbikpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB2YXIgcmVzdWx0ID0gIiI7CiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgcmVzdWx0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgfQogICAgICBleHBvcnRzLmJ1ZjJiaW5zdHJpbmcgPSBmdW5jdGlvbihidWYpIHsKICAgICAgICByZXR1cm4gYnVmMmJpbnN0cmluZyhidWYsIGJ1Zi5sZW5ndGgpOwogICAgICB9OwogICAgICBleHBvcnRzLmJpbnN0cmluZzJidWYgPSBmdW5jdGlvbihzdHIpIHsKICAgICAgICB2YXIgYnVmID0gbmV3IHV0aWxzLkJ1Zjgoc3RyLmxlbmd0aCk7CiAgICAgICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IGJ1Zi5sZW5ndGg7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgYnVmW2ldID0gc3RyLmNoYXJDb2RlQXQoaSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBidWY7CiAgICAgIH07CiAgICAgIGV4cG9ydHMuYnVmMnN0cmluZyA9IGZ1bmN0aW9uKGJ1ZiwgbWF4KSB7CiAgICAgICAgdmFyIGksIG91dCwgYywgY19sZW47CiAgICAgICAgdmFyIGxlbiA9IG1heCB8fCBidWYubGVuZ3RoOwogICAgICAgIHZhciB1dGYxNmJ1ZiA9IG5ldyBBcnJheShsZW4gKiAyKTsKICAgICAgICBmb3IgKG91dCA9IDAsIGkgPSAwOyBpIDwgbGVuOyApIHsKICAgICAgICAgIGMgPSBidWZbaSsrXTsKICAgICAgICAgIGlmIChjIDwgMTI4KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgY19sZW4gPSBfdXRmOGxlbltjXTsKICAgICAgICAgIGlmIChjX2xlbiA+IDQpIHsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNjU1MzM7CiAgICAgICAgICAgIGkgKz0gY19sZW4gLSAxOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGMgJj0gY19sZW4gPT09IDIgPyAzMSA6IGNfbGVuID09PSAzID8gMTUgOiA3OwogICAgICAgICAgd2hpbGUgKGNfbGVuID4gMSAmJiBpIDwgbGVuKSB7CiAgICAgICAgICAgIGMgPSBjIDw8IDYgfCBidWZbaSsrXSAmIDYzOwogICAgICAgICAgICBjX2xlbi0tOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGNfbGVuID4gMSkgewogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA2NTUzMzsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDY1NTM2KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjIC09IDY1NTM2OwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NTI5NiB8IGMgPj4gMTAgJiAxMDIzOwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NjMyMCB8IGMgJiAxMDIzOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gYnVmMmJpbnN0cmluZyh1dGYxNmJ1Ziwgb3V0KTsKICAgICAgfTsKICAgICAgZXhwb3J0cy51dGY4Ym9yZGVyID0gZnVuY3Rpb24oYnVmLCBtYXgpIHsKICAgICAgICB2YXIgcG9zOwogICAgICAgIG1heCA9IG1heCB8fCBidWYubGVuZ3RoOwogICAgICAgIGlmIChtYXggPiBidWYubGVuZ3RoKSB7CiAgICAgICAgICBtYXggPSBidWYubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBwb3MgPSBtYXggLSAxOwogICAgICAgIHdoaWxlIChwb3MgPj0gMCAmJiAoYnVmW3Bvc10gJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgIHBvcy0tOwogICAgICAgIH0KICAgICAgICBpZiAocG9zIDwgMCkgewogICAgICAgICAgcmV0dXJuIG1heDsKICAgICAgICB9CiAgICAgICAgaWYgKHBvcyA9PT0gMCkgewogICAgICAgICAgcmV0dXJuIG1heDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHBvcyArIF91dGY4bGVuW2J1Zltwb3NdXSA+IG1heCA/IHBvcyA6IG1heDsKICAgICAgfTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL3pzdHJlYW0uanMKICB2YXIgcmVxdWlyZV96c3RyZWFtID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL3pzdHJlYW0uanMiKGV4cG9ydHMsIG1vZHVsZSkgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgZnVuY3Rpb24gWlN0cmVhbSgpIHsKICAgICAgICB0aGlzLmlucHV0ID0gbnVsbDsKICAgICAgICB0aGlzLm5leHRfaW4gPSAwOwogICAgICAgIHRoaXMuYXZhaWxfaW4gPSAwOwogICAgICAgIHRoaXMudG90YWxfaW4gPSAwOwogICAgICAgIHRoaXMub3V0cHV0ID0gbnVsbDsKICAgICAgICB0aGlzLm5leHRfb3V0ID0gMDsKICAgICAgICB0aGlzLmF2YWlsX291dCA9IDA7CiAgICAgICAgdGhpcy50b3RhbF9vdXQgPSAwOwogICAgICAgIHRoaXMubXNnID0gIiI7CiAgICAgICAgdGhpcy5zdGF0ZSA9IG51bGw7CiAgICAgICAgdGhpcy5kYXRhX3R5cGUgPSAyOwogICAgICAgIHRoaXMuYWRsZXIgPSAwOwogICAgICB9CiAgICAgIG1vZHVsZS5leHBvcnRzID0gWlN0cmVhbTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AM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VsOiBaX0RFRkFVTFRfQ09NUFJFU1NJT04sCiAgICAgICAgICBtZXRob2Q6IFpfREVGTEFURUQsCiAgICAgICAgICBjaHVua1NpemU6IDE2Mzg0LAogICAgICAgICAgd2luZG93Qml0czogMTUsCiAgICAgICAgICBtZW1MZXZlbDogOCwKICAgICAgICAgIHN0cmF0ZWd5OiBaX0RFRkFVTFRfU1RSQVRFR1ksCiAgICAgICAgICB0bzogIiIKICAgICAgICB9LCBvcHRpb25zIHx8IHt9KTsKICAgICAgICB2YXIgb3B0ID0gdGhpcy5vcHRpb25zOwogICAgICAgIGlmIChvcHQucmF3ICYmIG9wdC53aW5kb3dCaXRzID4gMCkgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgPSAtb3B0LndpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIGlmIChvcHQuZ3ppcCAmJiBvcHQud2luZG93Qml0cyA+IDAgJiYgb3B0LndpbmRvd0JpdHMgPCAxNikgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgKz0gMTY7CiAgICAgICAgfQogICAgICAgIHRoaXMuZXJyID0gMDsKICAgICAgICB0aGlzLm1zZyA9ICIiOwogICAgICAgIHRoaXMuZW5kZWQgPSBmYWxzZTsKICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAgICAgIHRoaXMuc3RybSA9IG5ldyBaU3RyZWFtKCk7CiAgICAgICAgdGhpcy5zdHJtLmF2YWlsX291dCA9IDA7CiAgICAgICAgdmFyIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlSW5pdDIodGhpcy5zdHJtLCBvcHQubGV2ZWwsIG9wdC5tZXRob2QsIG9wdC53aW5kb3dCaXRzLCBvcHQubWVtTGV2ZWwsIG9wdC5zdHJhdGVneSk7CiAgICAgICAgaWYgKHN0YXR1cyAhPT0gWl9PSykgewogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKG1zZ1tzdGF0dXNdKTsKICAgICAgICB9CiAgICAgICAgaWYgKG9wdC5oZWFkZXIpIHsKICAgICAgICAgIHpsaWJfZGVmbGF0ZS5kZWZsYXRlU2V0SGVhZGVyKHRoaXMuc3RybSwgb3B0LmhlYWRlcik7CiAgICAgICAgfQogICAgICAgIGlmIChvcHQuZGljdGlvbmFyeSkgewogICAgICAgICAgdmFyIGRpY3Q7CiAgICAgICAgICBpZiAodHlwZW9mIG9wdC5kaWN0aW9uYXJ5ID09PSAic3RyaW5nIikgewogICAgICAgICAgICBkaWN0ID0gc3RyaW5ncy5zdHJpbmcyYnVmKG9wdC5kaWN0aW9uYXJ5KTsKICAgICAgICAgIH0gZWxzZSBpZiAodG9TdHJpbmcuY2FsbChvcHQuZGljdGlvbmFyeSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgICAgZGljdCA9IG5ldyBVaW50OEFycmF5KG9wdC5kaWN0aW9uYXJ5KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGRpY3QgPSBvcHQuZGljdGlvbmFyeTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlU2V0RGljdGlvbmFyeSh0aGlzLnN0cm0sIGRpY3QpOwogICAgICAgICAgaWYgKHN0YXR1cyAhPT0gWl9PSykgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IobXNnW3N0YXR1c10pOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5fZGljdF9zZXQgPSB0cnVlOwogICAgICAgIH0KICAgICAgfQogICAgICBEZWZsYXRlLnByb3RvdHlwZS5wdXNoID0gZnVuY3Rpb24oZGF0YSwgbW9kZSkgewogICAgICAgIHZhciBzdHJtID0gdGhpcy5zdHJtOwogICAgICAgIHZhciBjaHVua1NpemUgPSB0aGlzLm9wdGlvbnMuY2h1bmtTaXplOwogICAgICAgIHZhciBzdGF0dXMsIF9tb2RlOwogICAgICAgIGlmICh0aGlzLmVuZGVkKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICAgIF9tb2RlID0gbW9kZSA9PT0gfn5tb2RlID8gbW9kZSA6IG1vZGUgPT09IHRydWUgPyBaX0ZJTklTSCA6IFpfTk9fRkxVU0g7CiAgICAgICAgaWYgKHR5cGVvZiBkYXRhID09PSAic3RyaW5nIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IHN0cmluZ3Muc3RyaW5nMmJ1ZihkYXRhKTsKICAgICAgICB9IGVsc2UgaWYgKHRvU3RyaW5nLmNhbGwoZGF0YSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgIHN0cm0uaW5wdXQgPSBuZXcgVWludDhBcnJheShkYXRhKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RybS5pbnB1dCA9IGRhdGE7CiAgICAgICAgfQogICAgICAgIHN0cm0ubmV4dF9pbiA9IDA7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IHN0cm0uaW5wdXQubGVuZ3RoOwogICAgICAgIGRvIHsKICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBzdHJtLm91dHB1dCA9IG5ldyB1dGlscy5CdWY4KGNodW5rU2l6ZSk7CiAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSAwOwogICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGNodW5rU2l6ZTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlKHN0cm0sIF9tb2RlKTsKICAgICAgICAgIGlmIChzdGF0dXMgIT09IFpfU1RSRUFNX0VORCAmJiBzdGF0dXMgIT09IFpfT0spIHsKICAgICAgICAgICAgdGhpcy5vbkVuZChzdGF0dXMpOwogICAgICAgICAgICB0aGlzLmVuZGVkID0gdHJ1ZTsKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwIHx8IHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgKF9tb2RlID09PSBaX0ZJTklTSCB8fCBfbW9kZSA9PT0gWl9TWU5DX0ZMVVNIMikpIHsKICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICB0aGlzLm9uRGF0YShzdHJpbmdzLmJ1ZjJiaW5zdHJpbmcodXRpbHMuc2hyaW5rQnVmKHN0cm0ub3V0cHV0LCBzdHJtLm5leHRfb3V0KSkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0aWxzLnNocmlua0J1ZihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCkpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSB3aGlsZSAoKHN0cm0uYXZhaWxfaW4gPiAwIHx8IHN0cm0uYXZhaWxfb3V0ID09PSAwKSAmJiBzdGF0dXMgIT09IFpfU1RSRUFNX0VORCk7CiAgICAgICAgaWYgKF9tb2RlID09PSBaX0ZJTklTSCkgewogICAgICAgICAgc3RhdHVzID0gemxpYl9kZWZsYXRlLmRlZmxhdGVFbmQodGhpcy5zdHJtKTsKICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgIHRoaXMuZW5kZWQgPSB0cnVlOwogICAgICAgICAgcmV0dXJuIHN0YXR1cyA9PT0gWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBaX1NZTkNfRkxVU0gyKSB7CiAgICAgICAgICB0aGlzLm9uRW5kKFpfT0spOwogICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSAwOwogICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0cnVlOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkRhdGEgPSBmdW5jdGlvbihjaHVuaykgewogICAgICAgIHRoaXMuY2h1bmtzLnB1c2goY2h1bmspOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkVuZCA9IGZ1bmN0aW9uKHN0YXR1cykgewogICAgICAgIGlmIChzdGF0dXMgPT09IFpfT0spIHsKICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMudG8gPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdGhpcy5jaHVua3Muam9pbigiIik7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aGlzLnJlc3VsdCA9IHV0aWxzLmZsYXR0ZW5DaHVua3ModGhpcy5jaHVua3MpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAgICAgIHRoaXMuZXJyID0gc3RhdHVzOwogICAgICAgIHRoaXMubXNnID0gdGhpcy5zdHJtLm1zZzsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gZGVmbGF0ZShpbnB1dCwgb3B0aW9ucykgewogICAgICAgIHZhciBkZWZsYXRvciA9IG5ldyBEZWZsYXRlKG9wdGlvbnMpOwogICAgICAgIGRlZmxhdG9yLnB1c2goaW5wdXQsIHRydWUpOwogICAgICAgIGlmIChkZWZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IGRlZmxhdG9yLm1zZyB8fCBtc2dbZGVmbGF0b3IuZXJyXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGRlZmxhdG9yLnJlc3VsdDsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlUmF3KGlucHV0LCBvcHRpb25zKSB7CiAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307CiAgICAgICAgb3B0aW9ucy5yYXcgPSB0cnVlOwogICAgICAgIHJldHVybiBkZWZsYXRlKGlucHV0LCBvcHRpb25zKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBnemlwKGlucHV0LCBvcHRpb25zKSB7CiAgICAgICAgb3B0aW9ucyA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b2RlOwogICAgICAgIHZhciBkY29kZTsKICAgICAgICB2YXIgbG1hc2s7CiAgICAgICAgdmFyIGRtYXNrOwogICAgICAgIHZhciBoZXJlOwogICAgICAgIHZhciBvcDsKICAgICAgICB2YXIgbGVuOwogICAgICAgIHZhciBkaXN0OwogICAgICAgIHZhciBmcm9tOwogICAgICAgIHZhciBmcm9tX3NvdXJjZTsKICAgICAgICB2YXIgaW5wdXQsIG91dHB1dDsKICAgICAgICBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgX2luID0gc3RybS5uZXh0X2luOwogICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICBsYXN0ID0gX2luICsgKHN0cm0uYXZhaWxfaW4gLSA1KTsKICAgICAgICBfb3V0ID0gc3RybS5uZXh0X291dDsKICAgICAgICBvdXRwdXQgPSBzdHJtLm91dHB1dDsKICAgICAgICBiZWcgPSBfb3V0IC0gKHN0YXJ0IC0gc3RybS5hdmFpbF9vdXQpOwogICAgICAgIGVuZCA9IF9vdXQgKyAoc3RybS5hdmFpbF9vdXQgLSAyNTcpOwogICAgICAgIGRtYXggPSBzdGF0ZS5kbWF4OwogICAgICAgIHdzaXplID0gc3RhdGUud3NpemU7CiAgICAgICAgd2hhdmUgPSBzdGF0ZS53aGF2ZTsKICAgICAgICB3bmV4dCA9IHN0YXRlLnduZXh0OwogICAgICAgIHNfd2luZG93ID0gc3RhdGUud2luZG93OwogICAgICAgIGhvbGQgPSBzdGF0ZS5ob2xkOwogICAgICAgIGJpdHMgPSBzdGF0ZS5iaXRzOwogICAgICAgIGxjb2RlID0gc3RhdGUubGVuY29kZTsKICAgICAgICBkY29kZSA9IHN0YXRlLmRpc3Rjb2RlOwogICAgICAgIGxtYXNrID0gKDEgPDwgc3RhdGUubGVuYml0cykgLSAxOwogICAgICAgIGRtYXNrID0gKDEgPDwgc3RhdGUuZGlzdGJpdHMpIC0gMTsKICAgICAgICB0b3A6CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIGlmIChiaXRzIDwgMTUpIHsKICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZXJlID0gbGNvZGVbaG9sZCAmIGxtYXNrXTsKICAgICAgICAgICAgZG9sZW46CiAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICBvcCA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgaG9sZCA+Pj49IG9wOwogICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgIG9wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICBpZiAob3AgPT09IDApIHsKICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG9wICYgMTYpIHsKICAgICAgICAgICAgICAgICAgbGVuID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICBvcCAmPSAxNTsKICAgICAgICAgICAgICAgICAgaWYgKG9wKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkgewogICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbGVuICs9IGhvbGQgJiAoMSA8PCBvcCkgLSAxOwogICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgICAgICBiaXRzIC09IG9wOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChiaXRzIDwgMTUpIHsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoZXJlID0gZGNvZGVbaG9sZCAmIGRtYXNrXTsKICAgICAgICAgICAgICAgICAgZG9kaXN0OgogICAgICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAyNDsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICBvcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgICAgaWYgKG9wICYgMTYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZGlzdCA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgICAgICAgb3AgJj0gMTU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiaXRzIDwgb3ApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBkaXN0ICs9IGhvbGQgJiAoMSA8PCBvcCkgLSAxOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGlzdCA+IGRtYXgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0b3A7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IG9wOwogICAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgICBvcCA9IF9vdXQgLSBiZWc7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXN0ID4gb3ApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBvcCA9IGRpc3QgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob3AgPiB3aGF2ZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLnNhbmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2siOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0b3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gc193aW5kb3c7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHduZXh0ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tICs9IHdzaXplIC0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob3AgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHduZXh0IDwgb3ApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gKz0gd3NpemUgKyB3bmV4dCAtIG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3AgLT0gd25leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob3AgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3bmV4dCA8IGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wID0gd25leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSArPSB3bmV4dCAtIG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wIDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChsZW4gPiAyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gMzsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbiA+IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IDM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobGVuID4gMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4gPiAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKChvcCAmIDY0KSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICBoZXJlID0gZGNvZGVbKGhlcmUgJiA2NTUzNSkgKyAoaG9sZCAmICgxIDw8IG9wKSAtIDEpXTsKICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWUgZG9kaXN0OwogICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSBjb2RlIjsKICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIGlmICgob3AgJiA2NCkgPT09IDApIHsKICAgICAgICAgICAgICAgICAgaGVyZSA9IGxjb2RlWyhoZXJlICYgNjU1MzUpICsgKGhvbGQgJiAoMSA8PCBvcCkgLSAxKV07CiAgICAgICAgICAgICAgICAgIGNvbnRpbnVlIGRvbGVuOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChvcCAmIDMyKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFOwogICAgICAgICAgICAgICAgICBicmVhayB0b3A7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGxpdGVyYWwvbGVuZ3RoIGNvZGUiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhayB0b3A7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICB9IHdoaWxlIChfaW4gPCBsYXN0ICYmIF9vdXQgPCBlbmQpOwogICAgICAgIGxlbiA9IGJpdHMgPj4gMzsKICAgICAgICBfaW4gLT0gbGVuOwogICAgICAgIGJpdHMgLT0gbGVuIDw8IDM7CiAgICAgICAgaG9sZCAmPSAoMSA8PCBiaXRzKSAtIDE7CiAgICAgICAgc3RybS5uZXh0X2luID0gX2luOwogICAgICAgIHN0cm0ubmV4dF9vdXQgPSBfb3V0OwogICAgICAgIHN0cm0uYXZhaWxfaW4gPSBfaW4gPCBsYXN0ID8gNSArIChsYXN0IC0gX2luKSA6IDUgLSAoX2luIC0gbGFzdCk7CiAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBfb3V0IDwgZW5kID8gMjU3ICsgKGVuZCAtIF9vdXQpIDogMjU3IC0gKF9vdXQgLSBlbmQpOwogICAgICAgIHN0YXRlLmhvbGQgPSBob2xkOwogICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgIHJldHVybjsKICAgICAgfTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2luZnRyZWVzLmpzCiAgdmFyIHJlcXVpcmVfaW5mdHJlZXMgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvaW5mdHJlZXMuanMiKGV4cG9ydHMsIG1vZHVsZSkgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIHV0aWxzID0gcmVxdWlyZV9jb21tb24yKCk7CiAgICAgIHZhciBNQVhCSVRTID0gMTU7CiAgICAgIHZhciBFTk9VR0hfTEVOUyA9IDg1MjsKICAgICAgdmFyIEVOT1VHSF9ESVNUUyA9IDU5MjsKICAgICAgdmFyIENPREVTID0gMDsKICAgICAgdmFyIExFTlMgPSAxOwogICAgICB2YXIgRElTVFMgPSAyOwogICAgICB2YXIgbGJhc2UgPSBbCiAgICAgICAgMywKICAgICAgICA0LAogICAgICAgIDUsCiAgICAgICAgNiwKICAgICAgICA3LAogICAgICAgIDgsCiAgICAgICAgOSwKICAgICAgICAxMCwKICAgICAgICAxMSwKICAgICAgICAxMywKICAgICAgICAxNSwKICAgICAgICAxNywKICAgICAgICAxOSwKICAgICAgICAyMywKICAgICAgICAyNywKICAgICAgICAzMSwKICAgICAgICAzNSwKICAgICAgICA0MywKICAgICAgICA1MSwKICAgICAgICA1OSwKICAgICAgICA2NywKICAgICAgICA4MywKICAgICAgICA5OSwKICAgICAgICAxMTUsCiAgICAgICAgMTMxLAogICAgICAgIDE2MywKICAgICAgICAxOTUsCiAgICAgICAgMjI3LAogICAgICAgIDI1OCwKICAgICAgICAwLAogICAgICAgIDAKICAgICAgXTsKICAgICAgdmFyIGxleHQgPSBbCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMTYsCiAgICAgICAgNzIsCiAgICAgICAgNzgKICAgICAgXTsKICAgICAgdmFyIGRiYXNlID0gWwogICAgICAgIDEsCiAgICAgICAgMiwKICAgICAgICAzLAogICAgICAgIDQsCiAgICAgICAgNSwKICAgICAgICA3LAogICAgICAgIDksCiAgICAgICAgMTMsCiAgICAgICAgMTcsCiAgICAgICAgMjUsCiAgICAgICAgMzMsCiAgICAgICAgNDksCiAgICAgICAgNjUsCiAgICAgICAgOTcsCiAgICAgICAgMTI5LAogICAgICAgIDE5MywKICAgICAgICAyNTcsCiAgICAgICAgMzg1LAogICAgICAgIDUxMywKICAgICAgICA3NjksCiAgICAgICAgMTAyNSwKICAgICAgICAxNTM3LAogICAgICAgIDIwNDksCiAgICAgICAgMzA3MywKICAgICAgICA0MDk3LAogICAgICAgIDYxNDUsCiAgICAgICAgODE5MywKICAgICAgICAxMjI4OSwKICAgICAgICAxNjM4NSwKICAgICAgICAyNDU3NywKICAgICAgICAwLAogICAgICAgIDAKICAgICAgXTsKICAgICAgdmFyIGRleHQgPSBbCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjIsCiAgICAgICAgMjIsCiAgICAgICAgMjMsCiAgICAgICAgMjMsCiAgICAgICAgMjQsCiAgICAgICAgMjQsCiAgICAgICAgMjUsCiAgICAgICAgMjUsCiAgICAgICAgMjYsCiAgICAgICAgMjYsCiAgICAgICAgMjcsCiAgICAgICAgMjcsCiAgICAgICAgMjgsCiAgICAgICAgMjgsCiAgICAgICAgMjksCiAgICAgICAgMjksCiAgICAgICAgNjQsCiAgICAgICAgNjQKICAgICAgXTsKICAgICAgbW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBpbmZsYXRlX3RhYmxlKHR5cGUsIGxlbnMsIGxlbnNfaW5kZXgsIGNvZGVzLCB0YWJsZSwgdGFibGVfaW5kZXgsIHdvcmssIG9wdHMpIHsKICAgICAgICB2YXIgYml0cyA9IG9wdHMuYml0czsKICAgICAgICB2YXIgbGVuID0gMDsKICAgICAgICB2YXIgc3ltID0gMDsKICAgICAgICB2YXIgbWluID0gMCwgbWF4ID0gMDsKICAgICAgICB2YXIgcm9vdCA9IDA7CiAgICAgICAgdmFyIGN1cnIgPSAwOwogICAgICAgIHZhciBkcm9wID0gMDsKICAgICAgICB2YXIgbGVmdCA9IDA7CiAgICAgICAgdmFyIHVzZWQgPSAwOwogICAgICAgIHZhciBodWZmID0gMDsKICAgICAgICB2YXIgaW5jcjsKICAgICAgICB2YXIgZmlsbDsKICAgICAgICB2YXIgbG93OwogICAgICAgIHZhciBtYXNrOwogICAgICAgIHZhciBuZXh0OwogICAgICAgIHZhciBiYXNlID0gbnVsbDsKICAgICAgICB2YXIgYmFzZV9pbmRleCA9IDA7CiAgICAgICAgdmFyIGVuZDsKICAgICAgICB2YXIgY291bnQgPSBuZXcgdXRpbHMuQnVmMTYoTUFYQklUUyArIDEpOwogICAgICAgIHZhciBvZmZzID0gbmV3IHV0aWxzLkJ1ZjE2KE1BWEJJVFMgKyAxKTsKICAgICAgICB2YXIgZXh0cmEgPSBudWxsOwogICAgICAgIHZhciBleHRyYV9pbmRleCA9IDA7CiAgICAgICAgdmFyIGhlcmVfYml0cywgaGVyZV9vcCwgaGVyZV92YWw7CiAgICAgICAgZm9yIChsZW4gPSAwOyBsZW4gPD0gTUFYQklUUzsgbGVuKyspIHsKICAgICAgICAgIGNvdW50W2xlbl0gPSAwOwogICAgICAgIH0KICAgICAgICBmb3IgKHN5bSA9IDA7IHN5bSA8IGNvZGVzOyBzeW0rKykgewogICAgICAgICAgY291bnRbbGVuc1tsZW5zX2luZGV4ICsgc3ltXV0rKzsKICAgICAgICB9CiAgICAgICAgcm9vdCA9IGJpdHM7CiAgICAgICAgZm9yIChtYXggPSBNQVhCSVRTOyBtYXggPj0gMTsgbWF4LS0pIHsKICAgICAgICAgIGlmIChjb3VudFttYXhdICE9PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocm9vdCA+IG1heCkgewogICAgICAgICAgcm9vdCA9IG1heDsKICAgICAgICB9CiAgICAgICAgaWYgKG1heCA9PT0gMCkgewogICAgICAgICAgdGFibGVbdGFibGVfaW5kZXgrK10gPSAxIDw8IDI0IHwgNjQgPDwgMTYgfCAwOwogICAgICAgICAgdGFibGVbdGFibGVfaW5kZXgrK10gPSAxIDw8IDI0IHwgNjQgPDwgMTYgfCAwOwogICAgICAgICAgb3B0cy5iaXRzID0gMTsKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgICAgICBmb3IgKG1pbiA9IDE7IG1pbiA8IG1heDsgbWluKyspIHsKICAgICAgICAgIGlmIChjb3VudFttaW5dICE9PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocm9vdCA8IG1pbikgewogICAgICAgICAgcm9vdCA9IG1pbjsKICAgICAgICB9CiAgICAgICAgbGVmdCA9IDE7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPD0gTUFYQklUUzsgbGVuKyspIHsKICAgICAgICAgIGxlZnQgPDw9IDE7CiAgICAgICAgICBsZWZ0IC09IGNvdW50W2xlbl07CiAgICAgICAgICBpZiAobGVmdCA8IDApIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAobGVmdCA+IDAgJiYgKHR5cGUgPT09IENPREVTIHx8IG1heCAhPT0gMSkpIHsKICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgb2Zmc1sxXSA9IDA7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPCBNQVhCSVRTOyBsZW4rKykgewogICAgICAgICAgb2Zmc1tsZW4gKyAxXSA9IG9mZnNbbGVuXSArIGNvdW50W2xlbl07CiAgICAgICAgfQogICAgICAgIGZvciAoc3ltID0gMDsgc3ltIDwgY29kZXM7IHN5bSsrKSB7CiAgICAgICAgICBpZiAobGVuc1tsZW5zX2luZGV4ICsgc3ltXSAhPT0gMCkgewogICAgICAgICAgICB3b3JrW29mZnNbbGVuc1tsZW5zX2luZGV4ICsgc3ltXV0rK10gPSBzeW07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICh0eXBlID09PSBDT0RFUykgewogICAgICAgICAgYmFzZSA9IGV4dHJhID0gd29yazsKICAgICAgICAgIGVuZCA9IDE5OwogICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PT0gTEVOUykgewogICAgICAgICAgYmFzZSA9IGxiYXNlOwogICAgICAgICAgYmFzZV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBleHRyYSA9IGxleHQ7CiAgICAgICAgICBleHRyYV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBlbmQgPSAyNTY7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGJhc2UgPSBkYmFzZTsKICAgICAgICAgIGV4dHJhID0gZGV4dDsKICAgICAgICAgIGVuZCA9IC0xOwogICAgICAgIH0KICAgICAgICBodWZmID0gMDsKICAgICAgICBzeW0gPSAwOwogICAgICAgIGxlbiA9IG1pbjsKICAgICAgICBuZXh0ID0gdGFibGVfaW5kZXg7CiAgICAgICAgY3VyciA9IHJvb3Q7CiAgICAgICAgZHJvcCA9IDA7CiAgICAgICAgbG93ID0gLTE7CiAgICAgICAgdXNlZCA9IDEgPDwgcm9vdDsKICAgICAgICBtYXNrID0gdXNlZCAtIDE7CiAgICAgICAgaWYgKHR5cGUgPT09IExFTlMgJiYgdXNlZCA+IEVOT1VHSF9MRU5TIHx8IHR5cGUgPT09IERJU1RTICYmIHVzZWQgPiBFTk9VR0hfRElTVFMpIHsKICAgICAgICAgIHJldHVybiAxOwogICAgICAgIH0KICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGhlcmVfYml0cyA9IGxlbiAtIGRyb3A7CiAgICAgICAgICBpZiAod29ya1tzeW1dIDwgZW5kKSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSAwOwogICAgICAgICAgICBoZXJlX3ZhbCA9IHdvcmtbc3ltXTsKICAgICAgICAgIH0gZWxzZSBpZiAod29ya1tzeW1dID4gZW5kKSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSBleHRyYVtleHRyYV9pbmRleCArIHdvcmtbc3ltXV07CiAgICAgICAgICAgIGhlcmVfdmFsID0gYmFzZVtiYXNlX2luZGV4ICsgd29ya1tzeW1dXTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSAzMiArIDY0OwogICAgICAgICAgICBoZXJlX3ZhbCA9IDA7CiAgICAgICAgICB9CiAgICAgICAgICBpbmNyID0gMSA8PCBsZW4gLSBkcm9wOwogICAgICAgICAgZmlsbCA9IDEgPDwgY3VycjsKICAgICAgICAgIG1pbiA9IGZpbGw7CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIGZpbGwgLT0gaW5jcjsKICAgICAgICAgICAgdGFibGVbbmV4dCArIChodWZmID4+IGRyb3ApICsgZmlsbF0gPSBoZXJlX2JpdHMgPDwgMjQgfCBoZXJlX29wIDw8IDE2IHwgaGVyZV92YWwgfCAwOwogICAgICAgICAgfSB3aGlsZSAoZmlsbCAhPT0gMCk7CiAgICAgICAgICBpbmNyID0gMSA8PCBsZW4gLSAxOwogICAgICAgICAgd2hpbGUgKGh1ZmYgJiBpbmNyKSB7CiAgICAgICAgICAgIGluY3IgPj49IDE7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoaW5jciAhPT0gMCkgewogICAgICAgICAgICBodWZmICY9IGluY3IgLSAxOwogICAgICAgICAgICBodWZmICs9IGluY3I7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBodWZmID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIHN5bSsrOwogICAgICAgICAgaWYgKC0tY291bnRbbGVuXSA9PT0gMCkgewogICAgICAgICAgICBpZiAobGVuID09PSBtYXgpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZW4gPSBsZW5zW2xlbnNfaW5kZXggKyB3b3JrW3N5bV1dOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGxlbiA+IHJvb3QgJiYgKGh1ZmYgJiBtYXNrKSAhPT0gbG93KSB7CiAgICAgICAgICAgIGlmIChkcm9wID09PSAwKSB7CiAgICAgICAgICAgICAgZHJvcCA9IHJvb3Q7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbmV4dCArPSBtaW47CiAgICAgICAgICAgIGN1cnIgPSBsZW4gLSBkcm9wOwogICAgICAgICAgICBsZWZ0ID0gMSA8PCBjdXJyOwogICAgICAgICAgICB3aGlsZSAoY3VyciArIGRyb3AgPCBtYXgpIHsKICAgICAgICAgICAgICBsZWZ0IC09IGNvdW50W2N1cnIgKyBkcm9wXTsKICAgICAgICAgICAgICBpZiAobGVmdCA8PSAwKSB7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgY3VycisrOwogICAgICAgICAgICAgIGxlZnQgPDw9IDE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdXNlZCArPSAxIDw8IGN1cnI7CiAgICAgICAgICAgIGlmICh0eXBlID09PSBMRU5TICYmIHVzZWQgPiBFTk9VR0hfTEVOUyB8fCB0eXBlID09PSBESVNUUyAmJiB1c2VkID4gRU5PVUdIX0RJU1RTKSB7CiAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbG93ID0gaHVmZiAmIG1hc2s7CiAgICAgICAgICAgIHRhYmxlW2xvd10gPSByb290IDw8IDI0IHwgY3VyciA8PCAxNiB8IG5leHQgLSB0YWJsZV9pbmRleCB8IDA7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChodWZmICE9PSAwKSB7CiAgICAgICAgICB0YWJsZVtuZXh0ICsgaHVmZl0gPSBsZW4gLSBkcm9wIDw8IDI0IHwgNjQgPDwgMTYgfCAwOwogICAgICAgIH0KICAgICAgICBvcHRzLmJpdHMgPSByb290OwogICAgICAgIHJldHVybiAwOwogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvaW5mbGF0ZS5qcwogIHZhciByZXF1aXJlX2luZmxhdGUgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvaW5mbGF0ZS5qcyIoZXhwb3J0cykgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIHV0aWxzID0gcmVxdWlyZV9jb21tb24yKCk7CiAgICAgIHZhciBhZGxlcjMyID0gcmVxdWlyZV9hZGxlcjMyKCk7CiAgICAgIHZhciBjcmMzMjIgPSByZXF1aXJlX2NyYzMyKCk7CiAgICAgIHZhciBpbmZsYXRlX2Zhc3QgPSByZXF1aXJlX2luZmZhc3QoKTsKICAgICAgdmFyIGluZmxhdGVfdGFibGUgPSByZXF1aXJlX2luZnRyZWVzKCk7CiAgICAgIHZhciBDT0RFUyA9IDA7CiAgICAgIHZhciBMRU5TID0gMTsKICAgICAgdmFyIERJU1RTID0gMjsKICAgICAgdmFyIFpfRklOSVNIID0gNDsKICAgICAgdmFyIFpfQkxPQ0sgPSA1OwogICAgICB2YXIgWl9UUkVFUyA9IDY7CiAgICAgIHZhciBaX09LID0gMDsKICAgICAgdmFyIFpfU1RSRUFNX0VORCA9IDE7CiAgICAgIHZhciBaX05FRURfRElDVCA9IDI7CiAgICAgIHZhciBaX1NUUkVBTV9FUlJPUiA9IC0yOwogICAgICB2YXIgWl9EQVRBX0VSUk9SID0gLTM7CiAgICAgIHZhciBaX01FTV9FUlJPUiA9IC00OwogICAgICB2YXIgWl9CVUZfRVJST1IgPSAtNTsKICAgICAgdmFyIFpfREVGTEFURUQgPSA4OwogICAgICB2YXIgSEVBRCA9IDE7CiAgICAgIHZhciBGTEFHUyA9IDI7CiAgICAgIHZhciBUSU1FID0gMzsKICAgICAgdmFyIE9TID0gNDsKICAgICAgdmFyIEVYTEVOID0gNTsKICAgICAgdmFyIEVYVFJBID0gNjsKICAgICAgdmFyIE5BTUUgPSA3OwogICAgICB2YXIgQ09NTUVOVCA9IDg7CiAgICAgIHZhciBIQ1JDID0gOTsKICAgICAgdmFyIERJQ1RJRCA9IDEwOwogICAgICB2YXIgRElDVCA9IDExOwogICAgICB2YXIgVFlQRSA9IDEyOwogICAgICB2YXIgVFlQRURPID0gMTM7CiAgICAgIHZhciBTVE9SRUQgPSAxNDsKICAgICAgdmFyIENPUFlfID0gMTU7CiAgICAgIHZhciBDT1BZID0gMTY7CiAgICAgIHZhciBUQUJMRSA9IDE3OwogICAgICB2YXIgTEVOTEVOUyA9IDE4OwogICAgICB2YXIgQ09ERUxFTlMgPSAxOTsKICAgICAgdmFyIExFTl8gPSAyMDsKICAgICAgdmFyIExFTiA9IDIxOwogICAgICB2YXIgTEVORVhUID0gMjI7CiAgICAgIHZhciBESVNUID0gMjM7CiAgICAgIHZhciBESVNURVhUID0gMjQ7CiAgICAgIHZhciBNQVRDSCA9IDI1OwogICAgICB2YXIgTElUID0gMjY7CiAgICAgIHZhciBDSEVDSyA9IDI3OwogICAgICB2YXIgTEVOR1RIID0gMjg7CiAgICAgIHZhciBET05FID0gMjk7CiAgICAgIHZhciBCQUQgPSAzMDsKICAgICAgdmFyIE1FTSA9IDMxOwogICAgICB2YXIgU1lOQyA9IDMyOwogICAgICB2YXIgRU5PVUdIX0xFTlMgPSA4NTI7CiAgICAgIHZhciBFTk9VR0hfRElTVFMgPSA1OTI7CiAgICAgIHZhciBNQVhfV0JJVFMgPSAxNTsKICAgICAgdmFyIERFRl9XQklUUyA9IE1BWF9XQklUUzsKICAgICAgZnVuY3Rpb24genN3YXAzMihxKSB7CiAgICAgICAgcmV0dXJuIChxID4+PiAyNCAmIDI1NSkgKyAocSA+Pj4gOCAmIDY1MjgwKSArICgocSAmIDY1MjgwKSA8PCA4KSArICgocSAmIDI1NSkgPDwgMjQpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIEluZmxhdGVTdGF0ZSgpIHsKICAgICAgICB0aGlzLm1vZGUgPSAwOwogICAgICAgIHRoaXMubGFzdCA9IGZhbHNlOwogICAgICAgIHRoaXMud3JhcCA9IDA7CiAgICAgICAgdGhpcy5oYXZlZGljdCA9IGZhbHNlOwogICAgICAgIHRoaXMuZmxhZ3MgPSAwOwogICAgICAgIHRoaXMuZG1heCA9IDA7CiAgICAgICAgdGhpcy5jaGVjayA9IDA7CiAgICAgICAgdGhpcy50b3RhbCA9IDA7CiAgICAgICAgdGhpcy5oZWFkID0gbnVsbDsKICAgICAgICB0aGlzLndiaXRzID0gMDsKICAgICAgICB0aGlzLndzaXplID0gMDsKICAgICAgICB0aGlzLndoYXZlID0gMDsKICAgICAgICB0aGlzLnduZXh0ID0gMDsKICAgICAgICB0aGlzLndpbmRvdyA9IG51bGw7CiAgICAgICAgdGhpcy5ob2xkID0gMDsKICAgICAgICB0aGlzLmJpdHMgPSAwOwogICAgICAgIHRoaXMubGVuZ3RoID0gMDsKICAgICAgICB0aGlzLm9mZnNldCA9IDA7CiAgICAgICAgdGhpcy5leHRyYSA9IDA7CiAgICAgICAgdGhpcy5sZW5jb2RlID0gbnVsbDsKICAgICAgICB0aGlzLmRpc3Rjb2RlID0gbnVsbDsKICAgICAgICB0aGlzLmxlbmJpdHMgPSAwOwogICAgICAgIHRoaXMuZGlzdGJpdHMgPSAwOwogICAgICAgIHRoaXMubmNvZGUgPSAwOwogICAgICAgIHRoaXMubmxlbiA9IDA7CiAgICAgICAgdGhpcy5uZGlzdCA9IDA7CiAgICAgICAgdGhpcy5oYXZlID0gMDsKICAgICAgICB0aGlzLm5leHQgPSBudWxsOwogICAgICAgIHRoaXMubGVucyA9IG5ldyB1dGlscy5CdWYxNigzMjApOwogICAgICAgIHRoaXMud29yayA9IG5ldyB1dGlscy5CdWYxNigyODgpOwogICAgICAgIHRoaXMubGVuZHluID0gbnVsbDsKICAgICAgICB0aGlzLmRpc3RkeW4gPSBudWxsOwogICAgICAgIHRoaXMuc2FuZSA9IDA7CiAgICAgICAgdGhpcy5iYWNrID0gMDsKICAgICAgICB0aGlzLndhcyA9IDA7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZVJlc2V0S2VlcChzdHJtKSB7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgc3RybS50b3RhbF9pbiA9IHN0cm0udG90YWxfb3V0ID0gc3RhdGUudG90YWwgPSAwOwogICAgICAgIHN0cm0ubXNnID0gIiI7CiAgICAgICAgaWYgKHN0YXRlLndyYXApIHsKICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS53cmFwICYgMTsKICAgICAgICB9CiAgICAgICAgc3RhdGUubW9kZSA9IEhFQUQ7CiAgICAgICAgc3RhdGUubGFzdCA9IDA7CiAgICAgICAgc3RhdGUuaGF2ZWRpY3QgPSAwOwogICAgICAgIHN0YXRlLmRtYXggPSAzMjc2ODsKICAgICAgICBzdGF0ZS5oZWFkID0gbnVsbDsKICAgICAgICBzdGF0ZS5ob2xkID0gMDsKICAgICAgICBzdGF0ZS5iaXRzID0gMDsKICA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ICAgICAgICAgaWYgKHdpbmRvd0JpdHMgPCA0OCkgewogICAgICAgICAgICB3aW5kb3dCaXRzICY9IDE1OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAod2luZG93Qml0cyAmJiAod2luZG93Qml0cyA8IDggfHwgd2luZG93Qml0cyA+IDE1KSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhdGUud2luZG93ICE9PSBudWxsICYmIHN0YXRlLndiaXRzICE9PSB3aW5kb3dCaXRzKSB7CiAgICAgICAgICBzdGF0ZS53aW5kb3cgPSBudWxsOwogICAgICAgIH0KICAgICAgICBzdGF0ZS53cmFwID0gd3JhcDsKICAgICAgICBzdGF0ZS53Yml0cyA9IHdpbmRvd0JpdHM7CiAgICAgICAgcmV0dXJuIGluZmxhdGVSZXNldChzdHJtKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlSW5pdDIoc3RybSwgd2luZG93Qml0cykgewogICAgICAgIHZhciByZXQ7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIGlmICghc3RybSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZSA9IG5ldyBJbmZsYXRlU3RhdGUoKTsKICAgICAgICBzdHJtLnN0YXRlID0gc3RhdGU7CiAgICAgICAgc3RhdGUud2luZG93ID0gbnVsbDsKICAgICAgICByZXQgPSBpbmZsYXRlUmVzZXQyKHN0cm0sIHdpbmRvd0JpdHMpOwogICAgICAgIGlmIChyZXQgIT09IFpfT0spIHsKICAgICAgICAgIHN0cm0uc3RhdGUgPSBudWxsOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmV0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVJbml0KHN0cm0pIHsKICAgICAgICByZXR1cm4gaW5mbGF0ZUluaXQyKHN0cm0sIERFRl9XQklUUyk7CiAgICAgIH0KICAgICAgdmFyIHZpcmdpbiA9IHRydWU7CiAgICAgIHZhciBsZW5maXg7CiAgICAgIHZhciBkaXN0Zml4OwogICAgICBmdW5jdGlvbiBmaXhlZHRhYmxlcyhzdGF0ZSkgewogICAgICAgIGlmICh2aXJnaW4pIHsKICAgICAgICAgIHZhciBzeW07CiAgICAgICAgICBsZW5maXggPSBuZXcgdXRpbHMuQnVmMzIoNTEyKTsKICAgICAgICAgIGRpc3RmaXggPSBuZXcgdXRpbHMuQnVmMzIoMzIpOwogICAgICAgICAgc3ltID0gMDsKICAgICAgICAgIHdoaWxlIChzeW0gPCAxNDQpIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA4OwogICAgICAgICAgfQogICAgICAgICAgd2hpbGUgKHN5bSA8IDI1NikgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDk7CiAgICAgICAgICB9CiAgICAgICAgICB3aGlsZSAoc3ltIDwgMjgwKSB7CiAgICAgICAgICAgIHN0YXRlLmxlbnNbc3ltKytdID0gNzsKICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzeW0gPCAyODgpIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA4OwogICAgICAgICAgfQogICAgICAgICAgaW5mbGF0ZV90YWJsZShMRU5TLCBzdGF0ZS5sZW5zLCAwLCAyODgsIGxlbmZpeCwgMCwgc3RhdGUud29yaywgeyBiaXRzOiA5IH0pOwogICAgICAgICAgc3ltID0gMDsKICAgICAgICAgIHdoaWxlIChzeW0gPCAzMikgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDU7CiAgICAgICAgICB9CiAgICAgICAgICBpbmZsYXRlX3RhYmxlKERJU1RTLCBzdGF0ZS5sZW5zLCAwLCAzMiwgZGlzdGZpeCwgMCwgc3RhdGUud29yaywgeyBiaXRzOiA1IH0pOwogICAgICAgICAgdmlyZ2luID0gZmFsc2U7CiAgICAgICAgfQogICAgICAgIHN0YXRlLmxlbmNvZGUgPSBsZW5maXg7CiAgICAgICAgc3RhdGUubGVuYml0cyA9IDk7CiAgICAgICAgc3RhdGUuZGlzdGNvZGUgPSBkaXN0Zml4OwogICAgICAgIHN0YXRlLmRpc3RiaXRzID0gNTsKICAgICAgfQogICAgICBmdW5jdGlvbiB1cGRhdGV3aW5kb3coc3RybSwgc3JjLCBlbmQsIGNvcHkpIHsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS53aW5kb3cgPT09IG51bGwpIHsKICAgICAgICAgIHN0YXRlLndzaXplID0gMSA8PCBzdGF0ZS53Yml0czsKICAgICAgICAgIHN0YXRlLnduZXh0ID0gMDsKICAgICAgICAgIHN0YXRlLndoYXZlID0gMDsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG5ldyB1dGlscy5CdWY4KHN0YXRlLndzaXplKTsKICAgICAgICB9CiAgICAgICAgaWYgKGNvcHkgPj0gc3RhdGUud3NpemUpIHsKICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0YXRlLndpbmRvdywgc3JjLCBlbmQgLSBzdGF0ZS53c2l6ZSwgc3RhdGUud3NpemUsIDApOwogICAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgICAgc3RhdGUud2hhdmUgPSBzdGF0ZS53c2l6ZTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZGlzdCA9IHN0YXRlLndzaXplIC0gc3RhdGUud25leHQ7CiAgICAgICAgICBpZiAoZGlzdCA+IGNvcHkpIHsKICAgICAgICAgICAgZGlzdCA9IGNvcHk7CiAgICAgICAgICB9CiAgICAgICAgICB1dGlscy5hcnJheVNldChzdGF0ZS53aW5kb3csIHNyYywgZW5kIC0gY29weSwgZGlzdCwgc3RhdGUud25leHQpOwogICAgICAgICAgY29weSAtPSBkaXN0OwogICAgICAgICAgaWYgKGNvcHkpIHsKICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUud2luZG93LCBzcmMsIGVuZCAtIGNvcHksIGNvcHksIDApOwogICAgICAgICAgICBzdGF0ZS53bmV4dCA9IGNvcHk7CiAgICAgICAgICAgIHN0YXRlLndoYXZlID0gc3RhdGUud3NpemU7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzdGF0ZS53bmV4dCArPSBkaXN0OwogICAgICAgICAgICBpZiAoc3RhdGUud25leHQgPT09IHN0YXRlLndzaXplKSB7CiAgICAgICAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzdGF0ZS53aGF2ZSA8IHN0YXRlLndzaXplKSB7CiAgICAgICAgICAgICAgc3RhdGUud2hhdmUgKz0gZGlzdDsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlKHN0cm0sIGZsdXNoKSB7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIHZhciBpbnB1dCwgb3V0cHV0OwogICAgICAgIHZhciBuZXh0OwogICAgICAgIHZhciBwdXQ7CiAgICAgICAgdmFyIGhhdmUsIGxlZnQ7CiAgICAgICAgdmFyIGhvbGQ7CiAgICAgICAgdmFyIGJpdHM7CiAgICAgICAgdmFyIF9pbiwgX291dDsKICAgICAgICB2YXIgY29weTsKICAgICAgICB2YXIgZnJvbTsKICAgICAgICB2YXIgZnJvbV9zb3VyY2U7CiAgICAgICAgdmFyIGhlcmUgPSAwOwogICAgICAgIHZhciBoZXJlX2JpdHMsIGhlcmVfb3AsIGhlcmVfdmFsOwogICAgICAgIHZhciBsYXN0X2JpdHMsIGxhc3Rfb3AsIGxhc3RfdmFsOwogICAgICAgIHZhciBsZW47CiAgICAgICAgdmFyIHJldDsKICAgICAgICB2YXIgaGJ1ZiA9IG5ldyB1dGlscy5CdWY4KDQpOwogICAgICAgIHZhciBvcHRzOwogICAgICAgIHZhciBuOwogICAgICAgIHZhciBvcmRlciA9IFsxNiwgMTcsIDE4LCAwLCA4LCA3LCA5LCA2LCAxMCwgNSwgMTEsIDQsIDEyLCAzLCAxMywgMiwgMTQsIDEsIDE1XTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUgfHwgIXN0cm0ub3V0cHV0IHx8ICFzdHJtLmlucHV0ICYmIHN0cm0uYXZhaWxfaW4gIT09IDApIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS5tb2RlID09PSBUWVBFKSB7CiAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRURPOwogICAgICAgIH0KICAgICAgICBwdXQgPSBzdHJtLm5leHRfb3V0OwogICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgIGxlZnQgPSBzdHJtLmF2YWlsX291dDsKICAgICAgICBuZXh0ID0gc3RybS5uZXh0X2luOwogICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICBoYXZlID0gc3RybS5hdmFpbF9pbjsKICAgICAgICBob2xkID0gc3RhdGUuaG9sZDsKICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICBfaW4gPSBoYXZlOwogICAgICAgIF9vdXQgPSBsZWZ0OwogICAgICAgIHJldCA9IFpfT0s7CiAgICAgICAgaW5mX2xlYXZlOgogICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgIHN3aXRjaCAoc3RhdGUubW9kZSkgewogICAgICAgICAgICAgIGNhc2UgSEVBRDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFRE87CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUud3JhcCAmIDIgJiYgaG9sZCA9PT0gMzU2MTUpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSAwOwogICAgICAgICAgICAgICAgICBoYnVmWzBdID0gaG9sZCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIyKHN0YXRlLmNoZWNrLCBoYnVmLCAyLCAwKTsKICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRkxBR1M7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZmxhZ3MgPSAwOwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5kb25lID0gZmFsc2U7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoIShzdGF0ZS53cmFwICYgMSkgfHwgKCgoaG9sZCAmIDI1NSkgPDwgOCkgKyAoaG9sZCA+PiA4KSkgJSAzMSkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbmNvcnJlY3QgaGVhZGVyIGNoZWNrIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhvbGQgJiAxNSkgIT09IFpfREVGTEFURUQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAidW5rbm93biBjb21wcmVzc2lvbiBtZXRob2QiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA0OwogICAgICAgICAgICAgICAgYml0cyAtPSA0OwogICAgICAgICAgICAgICAgbGVuID0gKGhvbGQgJiAxNSkgKyA4OwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLndiaXRzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLndiaXRzID0gbGVuOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsZW4gPiBzdGF0ZS53Yml0cykgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIHdpbmRvdyBzaXplIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5kbWF4ID0gMSA8PCBsZW47CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSAxOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IGhvbGQgJiA1MTIgPyBESUNUSUQgOiBUWVBFOwogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgRkxBR1M6CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmZsYWdzID0gaG9sZDsKICAgICAgICAgICAgICAgIGlmICgoc3RhdGUuZmxhZ3MgJiAyNTUpICE9PSBaX0RFRkxBVEVEKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInVua25vd24gY29tcHJlc3Npb24gbWV0aG9kIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1NzM0NCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJ1bmtub3duIGhlYWRlciBmbGFncyBzZXQiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQudGV4dCA9IGhvbGQgPj4gOCAmIDE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhidWZbMV0gPSBob2xkID4+PiA4ICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRJTUU7CiAgICAgICAgICAgICAgY2FzZSBUSU1FOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnRpbWUgPSBob2xkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsyXSA9IGhvbGQgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzNdID0gaG9sZCA+Pj4gMjQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIyKHN0YXRlLmNoZWNrLCBoYnVmLCA0LCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gT1M7CiAgICAgICAgICAgICAgY2FzZSBPUzoKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC54ZmxhZ3MgPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLm9zID0gaG9sZCA+PiA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMjIoc3RhdGUuY2hlY2ssIGhidWYsIDIsIDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBFWExFTjsKICAgICAgICAgICAgICBjYXNlIEVYTEVOOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMTAyNCkgewogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBob2xkOwogICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmFfbGVuID0gaG9sZDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgICBoYnVmWzBdID0gaG9sZCAmIDI1NTsKICAgICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEVYVFJBOwogICAgICAgICAgICAgIGNhc2UgRVhUUkE6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAxMDI0KSB7CiAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmhlYWQuZXh0cmFfbGVuIC0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgaWYgKCFzdGF0ZS5oZWFkLmV4dHJhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBuZXcgQXJyYXkoc3RhdGUuaGVhZC5leHRyYV9sZW4pOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUuaGVhZC5leHRyYSwgaW5wdXQsIG5leHQsIGNvcHksIGxlbik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMjIoc3RhdGUuY2hlY2ssIGlucHV0LCBjb3B5LCBuZXh0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZSAtPSBjb3B5OwogICAgICAgICAgICAgICAgICAgIG5leHQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IE5BTUU7CiAgICAgICAgICAgICAgY2FzZSBOQU1FOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMjA0OCkgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBjb3B5ID0gMDsKICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgIGxlbiA9IGlucHV0W25leHQgKyBjb3B5KytdOwogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkICYmIGxlbiAmJiBzdGF0ZS5sZW5ndGggPCA2NTUzNikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5uYW1lICs9IFN0cmluZy5mcm9tQ2hhckNvZGUobGVuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiAmJiBjb3B5IDwgaGF2ZSk7CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIyKHN0YXRlLmNoZWNrLCBpbnB1dCwgY29weSwgbmV4dCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZSAtPSBjb3B5OwogICAgICAgICAgICAgICAgICBuZXh0ICs9IGNvcHk7CiAgICAgICAgICAgICAgICAgIGlmIChsZW4pIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLm5hbWUgPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT01NRU5UOwogICAgICAgICAgICAgIGNhc2UgQ09NTUVOVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDQwOTYpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgY29weSA9IDA7CiAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICBsZW4gPSBpbnB1dFtuZXh0ICsgY29weSsrXTsKICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCAmJiBsZW4gJiYgc3RhdGUubGVuZ3RoIDwgNjU1MzYpIHsKICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuY29tbWVudCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGxlbik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9IHdoaWxlIChsZW4gJiYgY29weSA8IGhhdmUpOwogICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5jb21tZW50ID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBIQ1JDOwogICAgICAgICAgICAgIGNhc2UgSENSQzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaG9sZCAhPT0gKHN0YXRlLmNoZWNrICYgNjU1MzUpKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaGVhZGVyIGNyYyBtaXNtYXRjaCI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmhjcmMgPSBzdGF0ZS5mbGFncyA+PiA5ICYgMTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5kb25lID0gdHJ1ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgRElDVElEOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSB6c3dhcDMyKGhvbGQpOwogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESUNUOwogICAgICAgICAgICAgIGNhc2UgRElDVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlZGljdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfb3V0ID0gcHV0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGxlZnQ7CiAgICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9pbiA9IG5leHQ7CiAgICAgICAgICAgICAgICAgIHN0cm0uYXZhaWxfaW4gPSBoYXZlOwogICAgICAgICAgICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICAgICAgICAgICAgc3RhdGUuYml0cyA9IGJpdHM7CiAgICAgICAgICAgICAgICAgIHJldHVybiBaX05FRURfRElDVDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDE7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICBjYXNlIFRZUEU6CiAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfQkxPQ0sgfHwgZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGNhc2UgVFlQRURPOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxhc3QpIHsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ0hFQ0s7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxhc3QgPSBob2xkICYgMTsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAxOwogICAgICAgICAgICAgICAgYml0cyAtPSAxOwogICAgICAgICAgICAgICAgc3dpdGNoIChob2xkICYgMykgewogICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFNUT1JFRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgIGZpeGVkdGFibGVzKHN0YXRlKTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUQUJMRTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYmxvY2sgdHlwZSI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBTVE9SRUQ6CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gYml0cyAmIDc7CiAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhvbGQgJiA2NTUzNSkgIT09IChob2xkID4+PiAxNiBeIDY1NTM1KSkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIHN0b3JlZCBibG9jayBsZW5ndGhzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBob2xkICYgNjU1MzU7CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFlfOwogICAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX1RSRUVTKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBjYXNlIENPUFlfOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFk7CiAgICAgICAgICAgICAgY2FzZSBDT1BZOgogICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBsZWZ0OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KG91dHB1dCwgaW5wdXQsIG5leHQsIGNvcHksIHB1dCk7CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBsZWZ0IC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIHB1dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgVEFCTEU6CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE0KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm5sZW4gPSAoaG9sZCAmIDMxKSArIDI1NzsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA1OwogICAgICAgICAgICAgICAgYml0cyAtPSA1OwogICAgICAgICAgICAgICAgc3RhdGUubmRpc3QgPSAoaG9sZCAmIDMxKSArIDE7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNTsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNTsKICAgICAgICAgICAgICAgIHN0YXRlLm5jb2RlID0gKGhvbGQgJiAxNSkgKyA0OwogICAgICAgICAgICAgICAgaG9sZCA+Pj49IDQ7CiAgICAgICAgICAgICAgICBiaXRzIC09IDQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubmxlbiA+IDI4NiB8fCBzdGF0ZS5uZGlzdCA+IDMwKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInRvbyBtYW55IGxlbmd0aCBvciBkaXN0YW5jZSBzeW1ib2xzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5MRU5TOwogICAgICAgICAgICAgIGNhc2UgTEVOTEVOUzoKICAgICAgICAgICAgICAgIHdoaWxlIChzdGF0ZS5oYXZlIDwgc3RhdGUubmNvZGUpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW29yZGVyW3N0YXRlLmhhdmUrK11dID0gaG9sZCAmIDc7CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAzOwogICAgICAgICAgICAgICAgICBiaXRzIC09IDM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB3aGlsZSAoc3RhdGUuaGF2ZSA8IDE5KSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbb3JkZXJbc3RhdGUuaGF2ZSsrXV0gPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubGVuY29kZSA9IHN0YXRlLmxlbmR5bjsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA3OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShDT0RFUywgc3RhdGUubGVucywgMCwgMTksIHN0YXRlLmxlbmNvZGUsIDAsIHN0YXRlLndvcmssIG9wdHMpOwogICAgICAgICAgICAgICAgc3RhdGUubGVuYml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBjb2RlIGxlbmd0aHMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT0RFTEVOUzsKICAgICAgICAgICAgICBjYXNlIENPREVMRU5TOgogICAgICAgICAgICAgICAgd2hpbGUgKHN0YXRlLmhhdmUgPCBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgICAgaGVyZSA9IHN0YXRlLmxlbmNvZGVbaG9sZCAmICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhlcmVfdmFsIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSsrXSA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX3ZhbCA9PT0gMTYpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAyOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgY29weSA9IDMgKyAoaG9sZCAmIDMpOwogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IDI7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IDI7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChoZXJlX3ZhbCA9PT0gMTcpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAzOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICBjb3B5ID0gMyArIChob2xkICYgNyk7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gMzsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gMzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgbiA9IGhlcmVfYml0cyArIDc7CiAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgICAgbGVuID0gMDsKICAgICAgICAgICAgICAgICAgICAgIGNvcHkgPSAxMSArIChob2xkICYgMTI3KTsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA3OwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSA3OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSArIGNvcHkgPiBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB3aGlsZSAoY29weS0tKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBsZW47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubW9kZSA9PT0gQkFEKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxlbnNbMjU2XSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGNvZGUgLS0gbWlzc2luZyBlbmQtb2YtYmxvY2siOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA5OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShMRU5TLCBzdGF0ZS5sZW5zLCAwLCBzdGF0ZS5ubGVuLCBzdGF0ZS5sZW5jb2RlLCAwLCBzdGF0ZS53b3JrLCBvcHRzKTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgICAgICAgICBpZiAocmV0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgbGl0ZXJhbC9sZW5ndGhzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGJpdHMgPSA2OwogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGNvZGUgPSBzdGF0ZS5kaXN0ZHluOwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUuZGlzdGJpdHMgfTsKICAgICAgICAgICAgICAgIHJldCA9IGluZmxhdGVfdGFibGUoRElTVFMsIHN0YXRlLmxlbnMsIHN0YXRlLm5sZW4sIHN0YXRlLm5kaXN0LCBzdGF0ZS5kaXN0Y29kZSwgMCwgc3RhdGUud29yaywgb3B0cyk7CiAgICAgICAgICAgICAgICBzdGF0ZS5kaXN0Yml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZXMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9UUkVFUykgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgY2FzZSBMRU5fOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTjsKICAgICAgICAgICAgICBjYXNlIExFTjoKICAgICAgICAgICAgICAgIGlmIChoYXZlID49IDYgJiYgbGVmdCA+PSAyNTgpIHsKICAgICAgICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBsZWZ0OwogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaG9sZCA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgICAgICAgICAgICBpbmZsYXRlX2Zhc3Qoc3RybSwgX291dCk7CiAgICAgICAgICAgICAgICAgIHB1dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgICAgICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgICAgICAgICAgICBsZWZ0ID0gc3RybS5hdmFpbF9vdXQ7CiAgICAgICAgICAgICAgICAgIG5leHQgPSBzdHJtLm5leHRfaW47CiAgICAgICAgICAgICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICAgICAgICAgICAgaGF2ZSA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgICAgICAgICAgIGhvbGQgPSBzdGF0ZS5ob2xkOwogICAgICAgICAgICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IFRZUEUpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gMDsKICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtob2xkICYgKDEgPDwgc3RhdGUubGVuYml0cykgLSAxXTsKICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGVyZV92YWwgPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYmIChoZXJlX29wICYgMjQwKSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBsYXN0X2JpdHMgPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgIGxhc3Rfb3AgPSBoZXJlX29wOwogICAgICAgICAgICAgICAgICBsYXN0X3ZhbCA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBoZXJlX3ZhbDsKICAgICAgICAgICAgICAgIGlmIChoZXJlX29wID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMSVQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGhlcmVfb3AgJiAzMikgewogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYgNjQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5FWFQ7CiAgICAgICAgICAgICAgY2FzZSBMRU5FWFQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZXh0cmEpIHsKICAgICAgICAgICAgICAgICAgbiA9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCArPSBob2xkICYgKDEgPDwgc3RhdGUuZXh0cmEpIC0gMTsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBiaXRzIC09IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUud2FzID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IERJU1Q7CiAgICAgICAgICAgICAgY2FzZSBESVNUOgogICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtob2xkICYgKDEgPDwgc3RhdGUuZGlzdGJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICBoZXJlX29wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICBpZiAoaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhlcmVfb3AgJiAyNDApID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGxhc3RfYml0cyA9IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgbGFzdF9vcCA9IGhlcmVfb3A7CiAgICAgICAgICAgICAgICAgIGxhc3RfdmFsID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCAmIDY0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgY29kZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESVNURVhUOwogICAgICAgICAgICAgIGNhc2UgRElTVEVYVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5leHRyYSkgewogICAgICAgICAgICAgICAgICBuID0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ICs9IGhvbGQgJiAoMSA8PCBzdGF0ZS5leHRyYSkgLSAxOwogICAgICAgICAgICAgICAgICBob2xkID4+Pj0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIGJpdHMgLT0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gc3RhdGUuZG1heCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IE1BVENIOwogICAgICAgICAgICAgIGNhc2UgTUFUQ0g6CiAgICAgICAgICAgICAgICBpZiAobGVmdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjb3B5ID0gX291dCAtIGxlZnQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gY29weSkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gc3RhdGUub2Zmc2V0IC0gY29weTsKICAgICAgICAgICAgICAgICAgaWYgKGNvcHkgPiBzdGF0ZS53aGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gc3RhdGUud25leHQpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5IC09IHN0YXRlLnduZXh0OwogICAgICAgICAgICAgICAgICAgIGZyb20gPSBzdGF0ZS53c2l6ZSAtIGNvcHk7CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZnJvbSA9IHN0YXRlLnduZXh0IC0gY29weTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IHN0YXRlLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBzdGF0ZS53aW5kb3c7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgZnJvbSA9IHB1dCAtIHN0YXRlLm9mZnNldDsKICAgICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gbGVmdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGxlZnQgLT0gY29weTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCAtPSBjb3B5OwogICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICBvdXRwdXRbcHV0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tY29weSk7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIExJVDoKICAgICAgICAgICAgICAgIGlmIChsZWZ0ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG91dHB1dFtwdXQrK10gPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICBsZWZ0LS07CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBDSEVDSzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCB8PSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIF9vdXQgLT0gbGVmdDsKICAgICAgICAgICAgICAgICAgc3RybS50b3RhbF9vdXQgKz0gX291dDsKICAgICAgICAgICAgICAgICAgc3RhdGUudG90YWwgKz0gX291dDsKICAgICAgICAgICAgICAgICAgaWYgKF9vdXQpIHsKICAgICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSBzdGF0ZS5mbGFncyA/IGNyYzMyMihzdGF0ZS5jaGVjaywgb3V0cHV0LCBfb3V0LCBwdXQgLSBfb3V0KSA6IGFkbGVyMzIoc3RhdGUuY2hlY2ssIG91dHB1dCwgX291dCwgcHV0IC0gX291dCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgX291dCA9IGxlZnQ7CiAgICAgICAgICAgICAgICAgIGlmICgoc3RhdGUuZmxhZ3MgPyBob2xkIDogenN3YXAzMihob2xkKSkgIT09IHN0YXRlLmNoZWNrKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGRhdGEgY2hlY2siOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTkdUSDsKICAgICAgICAgICAgICBjYXNlIExFTkdUSDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwICYmIHN0YXRlLmZsYWdzKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChob2xkICE9PSAoc3RhdGUudG90YWwgJiA0Mjk0OTY3Mjk1KSkgewogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImluY29ycmVjdCBsZW5ndGggY2hlY2siOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IERPTkU7CiAgICAgICAgICAgICAgY2FzZSBET05FOgogICAgICAgICAgICAgICAgcmV0ID0gWl9TVFJFQU1fRU5EOwogICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgIGNhc2UgQkFEOgogICAgICAgICAgICAgICAgcmV0ID0gWl9EQVRBX0VSUk9SOwogICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgIGNhc2UgTUVNOgogICAgICAgICAgICAgICAgcmV0dXJuIFpfTUVNX0VSUk9SOwogICAgICAgICAgICAgIGNhc2UgU1lOQzoKICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICBzdHJtLmF2YWlsX291dCA9IGxlZnQ7CiAgICAgICAgc3RybS5uZXh0X2luID0gbmV4dDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTsKICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICBzdGF0ZS5iaXRzID0gYml0czsKICAgICAgICBpZiAoc3RhdGUud3NpemUgfHwgX291dCAhPT0gc3RybS5hdmFpbF9vdXQgJiYgc3RhdGUubW9kZSA8IEJBRCAmJiAoc3RhdG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gICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZUVuZChzdHJtKSB7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHZhciBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgaWYgKHN0YXRlLndpbmRvdykgewogICAgICAgICAgc3RhdGUud2luZG93ID0gbnVsbDsKICAgICAgICB9CiAgICAgICAgc3RybS5zdGF0ZSA9IG51bGw7CiAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZUdldEhlYWRlcihzdHJtLCBoZWFkKSB7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgaWYgKChzdGF0ZS53cmFwICYgMikgPT09IDApIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUuaGVhZCA9IGhlYWQ7CiAgICAgICAgaGVhZC5kb25lID0gZmFsc2U7CiAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZVNldERpY3Rpb25hcnkoc3RybSwgZGljdGlvbmFyeSkgewogICAgICAgIHZhciBkaWN0TGVuZ3RoID0gZGljdGlvbmFyeS5sZW5ndGg7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIHZhciBkaWN0aWQ7CiAgICAgICAgdmFyIHJldDsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS53cmFwICE9PSAwICYmIHN0YXRlLm1vZGUgIT09IERJQ1QpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IERJQ1QpIHsKICAgICAgICAgIGRpY3RpZCA9IDE7CiAgICAgICAgICBkaWN0aWQgPSBhZGxlcjMyKGRpY3RpZCwgZGljdGlvbmFyeSwgZGljdExlbmd0aCwgMCk7CiAgICAgICAgICBpZiAoZGljdGlkICE9PSBzdGF0ZS5jaGVjaykgewogICAgICAgICAgICByZXR1cm4gWl9EQVRBX0VSUk9SOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXQgPSB1cGRhdGV3aW5kb3coc3RybSwgZGljdGlvbmFyeSwgZGljdExlbmd0aCwgZGljdExlbmd0aCk7CiAgICAgICAgaWYgKHJldCkgewogICAgICAgICAgc3RhdGUubW9kZSA9IE1FTTsKICAgICAgICAgIHJldHVybiBaX01FTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUuaGF2ZWRpY3QgPSAxOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGV4cG9ydHMuaW5mbGF0ZVJlc2V0ID0gaW5mbGF0ZVJlc2V0OwogICAgICBleHBvcnRzLmluZmxhdGVSZXNldDIgPSBpbmZsYXRlUmVzZXQyOwogICAgICBleHBvcnRzLmluZmxhdGVSZXNldEtlZXAgPSBpbmZsYXRlUmVzZXRLZWVwOwogICAgICBleHBvcnRzLmluZmxhdGVJbml0ID0gaW5mbGF0ZUluaXQ7CiAgICAgIGV4cG9ydHMuaW5mbGF0ZUluaXQyID0gaW5mbGF0ZUluaXQyOwogICAgICBleHBvcnRzLmluZmxhdGUgPSBpbmZsYXRlOwogICAgICBleHBvcnRzLmluZmxhdGVFbm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OiAwLAogICAgICAgIFpfQkVTVF9TUEVFRDogMSwKICAgICAgICBaX0JFU1RfQ09NUFJFU1NJT046IDksCiAgICAgICAgWl9ERUZBVUxUX0NPTVBSRVNTSU9OOiAtMSwKICAgICAgICBaX0ZJTFRFUkVEOiAxLAogICAgICAgIFpfSFVGRk1BTl9PTkxZOiAyLAogICAgICAgIFpfUkxFOiAzLAogICAgICAgIFpfRklYRUQ6IDQsCiAgICAgICAgWl9ERUZBVUxUX1NUUkFURUdZOiAwLAogICAgICAgIFpfQklOQVJZOiAwLAogICAgICAgIFpfVEVYVDogMSwKICAgICAgICBaX1VOS05PV046IDIsCiAgICAgICAgWl9ERUZMQVRFRDogOAogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvZ3poZWFkZXIuanMKICB2YXIgcmVxdWlyZV9nemhlYWRlciA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9nemhlYWRlci5qcyIoZXhwb3J0cywgbW9kdWxlKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBmdW5jdGlvbiBHWmhlYWRlcigpIHsKICAgICAgICB0aGlzLnRleHQgPSAwOwogICAgICAgIHRoaXMudGltZSA9IDA7CiAgICAgICAgdGhpcy54ZmxhZ3MgPSAwOwogICAgICAgIHRoaXMub3MgPSAwOwogICAgICAgIHRoaXMuZXh0cmEgPSBudWxsOwogICAgICAgIHRoaXMuZXh0cmFfbGVuID0gMDsKICAgICAgICB0aGlzLm5hbWUgPSAiIjsKICAgICAgICB0aGlzLmNvbW1lbnQgPSAiIjsKICAgICAgICB0aGlzLmhjcmMgPSAwOwogICAgICAgIHRoaXMuZG9uZSA9IGZhbHNlOwogICAg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HRpb25zIHx8IHt9KTsKICAgICAgICB2YXIgb3B0ID0gdGhpcy5vcHRpb25zOwogICAgICAgIGlmIChvcHQucmF3ICYmIG9wdC53aW5kb3dCaXRzID49IDAgJiYgb3B0LndpbmRvd0JpdHMgPCAxNikgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgPSAtb3B0LndpbmRvd0JpdHM7CiAgICAgICAgICBpZiAob3B0LndpbmRvd0JpdHMgPT09IDApIHsKICAgICAgICAgICAgb3B0LndpbmRvd0JpdHMgPSAtMTU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChvcHQud2luZG93Qml0cyA+PSAwICYmIG9wdC53aW5kb3dCaXRzIDwgMTYgJiYgIShvcHRpb25zICYmIG9wdGlvbnMud2luZG93Qml0cykpIHsKICAgICAgICAgIG9wdC53aW5kb3dCaXRzICs9IDMyOwogICAgICAgIH0KICAgICAgICBpZiAob3B0LndpbmRvd0JpdHMgPiAxNSAmJiBvcHQud2luZG93Qml0cyA8IDQ4KSB7CiAgICAgICAgICBpZiAoKG9wdC53aW5kb3dCaXRzICYgMTUpID09PSAwKSB7CiAgICAgICAgICAgIG9wdC53aW5kb3dCaXRzIHw9IDE1OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB0aGlzLmVyciA9IDA7CiAgICAgICAgdGhpcy5tc2cgPSAiIjsKICAgICAgICB0aGlzLmVuZGVkID0gZmFsc2U7CiAgICAgICAgdGhpcy5jaHVua3MgPSBbXTsKICAgICAgICB0aGlzLnN0cm0gPSBuZXcgWlN0cmVhbSgpOwogICAgICAgIHRoaXMuc3RybS5hdmFpbF9vdXQgPSAwOwogICAgICAgIHZhciBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZUluaXQyKHRoaXMuc3RybSwgb3B0LndpbmRvd0JpdHMpOwogICAgICAgIGlmIChzdGF0dXMgIT09IGMuWl9PSykgewogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKG1zZ1tzdGF0dXNdKTsK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HVzLCBfbW9kZTsKICAgICAgICB2YXIgbmV4dF9vdXRfdXRmOCwgdGFpbCwgdXRmOHN0cjsKICAgICAgICB2YXIgYWxsb3dCdWZFcnJvciA9IGZhbHNlOwogICAgICAgIGlmICh0aGlzLmVuZGVkKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICAgIF9tb2RlID0gbW9kZSA9PT0gfn5tb2RlID8gbW9kZSA6IG1vZGUgPT09IHRydWUgPyBjLlpfRklOSVNIIDogYy5aX05PX0ZMVVNIOwogICAgICAgIGlmICh0eXBlb2YgZGF0YSA9PT0gInN0cmluZyIpIHsKICAgICAgICAgIHN0cm0uaW5wdXQgPSBzdHJpbmdzLmJpbnN0cmluZzJidWYoZGF0YSk7CiAgICAgICAgfSBlbHNlIGlmICh0b1N0cmluZy5jYWxsKGRhdGEpID09PSAiW29iamVjdCBBcnJheUJ1ZmZlcl0iKSB7CiAgICAgICAgICBzdHJtLmlucHV0ID0gbmV3IFVpbnQ4QXJyYXkoZGF0YSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHN0cm0uaW5wdXQgPSBkYXRhOwogICAgICAgIH0KICAgICAgICBzdHJtLm5leHRfaW4gPSAwOwogICAgICAgIHN0cm0uYXZhaWxfaW4gPSBzdHJtLmlucHV0Lmxlbmd0aDsKICAgICAgICBkbyB7CiAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgc3RybS5vdXRwdXQgPSBuZXcgdXRpbHMuQnVmOChjaHVua1NpemUpOwogICAgICAgICAgICBzdHJtLm5leHRfb3V0ID0gMDsKICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBjaHVua1NpemU7CiAgICAgICAgICB9CiAgICAgICAgICBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZShzdHJtLCBjLlpfTk9fRkxVU0gpOwogICAgICAgICAgaWYgKHN0YXR1cyA9PT0gYy5aX05FRURfRElD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XQsIG5leHRfb3V0X3V0ZjgpOwogICAgICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IHRhaWw7CiAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGNodW5rU2l6ZSAtIHRhaWw7CiAgICAgICAgICAgICAgICBpZiAodGFpbCkgewogICAgICAgICAgICAgICAgICB1dGlscy5hcnJheVNldChzdHJtLm91dHB1dCwgc3RybS5vdXRwdXQsIG5leHRfb3V0X3V0ZjgsIHRhaWwsIDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpcy5vbkRhdGEodXRmOHN0cik7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0aWxzLnNocmlua0J1ZihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCkpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgYWxsb3dCdWZFcnJvciA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgfSB3aGlsZSAoKHN0cm0uYXZhaWxfaW4gPiAwIHx8IHN0cm0uYXZhaWxfb3V0ID09PSAwKSAmJiBzdGF0dXMgIT09IGMuWl9TVFJFQU1fRU5EKTsKICAgICAgICBpZiAoc3RhdHVzID09PSBjLlpfU1RSRUFNX0VORCkgewogICAgICAgICAgX21vZGUgPSBjLlpfRklOSVNIOwogICAgICAgIH0KICAgICAgICBpZiAoX21vZGUgPT09IGMuWl9GSU5JU0gpIHsKICAgICAgICAgIHN0YXR1cyA9IHpsaWJfaW5mbGF0ZS5pbmZsYXRlRW5kKHRoaXMuc3RybSk7CiAgICAgICAgICB0aGlzLm9uRW5kKHN0YXR1cyk7CiAgICAgICAgICB0aGlzLmVuZGVkID0gdHJ1ZTsKICAgICAgICAgIHJldHVybiBzdGF0dXMgPT09IGMuWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBjLlpfU1lOQ19GTFVTSCkgewogICAgICAgICAgdGhpcy5vbkVuZChjLlpfT0spOwogICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSAwOwogICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0cnVlOwogICAgICB9OwogICAgICBJbmZsYXRlMi5wcm90b3R5cGUub25EYXRhID0gZnVuY3Rpb24oY2h1bmspIHsKICAgICAgICB0aGlzLmNodW5rcy5wdXNoKGNodW5rKTsKICAgICAgfTsKICAgICAgSW5mbGF0ZTIucHJvdG90eXBlLm9uRW5kID0gZnVuY3Rpb24oc3RhdHVzKSB7CiAgICAgICAgaWYgKHN0YXR1cyA9PT0gYy5aX09LKSB7CiAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLnRvID09PSAic3RyaW5nIikgewogICAgICAgICAgICB0aGlzLnJlc3VsdCA9IHRoaXMuY2h1bmtzLmpvaW4oIiIpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdGhpcy5yZXN1bHQgPSB1dGlscy5mbGF0dGVuQ2h1bmtzKHRoaXMuY2h1bmtzKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgdGhpcy5jaHVua3MgPSBbXTsKICAgICAgICB0aGlzLmVyciA9IHN0YXR1czsKICAgICAgICB0aGlzLm1zZyA9IHRoaXMuc3RybS5tc2c7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGluZmxhdGUoaW5wdXQsIG9wdGlvbnMpIHsKICAgICAgICB2YXIgaW5mbGF0b3IgPSBuZXcgSW5mbGF0ZTIob3B0aW9ucyk7CiAgICAgICAgaW5mbGF0b3IucHVzaChpbnB1dCwgdHJ1ZSk7CiAgICAgICAgaWYgKGluZmxhdG9yLmVycikgewogICAgICAgICAgdGhyb3cgaW5mbGF0b3IubXNnIHx8IG1zZ1tpbmZsYXRvci5lcnJdOw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MTUyLAogICAgICAgIDQyNTExMjIwNDIsCiAgICAgICAgMjMyMTkyNjYzNiwKICAgICAgICAzMzU2MzM0ODcsCiAgICAgICAgMTY2MTM2NTQ2NSwKICAgICAgICA0MTk1MzAyNzU1LAogICAgICAgIDIzNjYxMTUzMTcsCiAgICAgICAgOTk3MDczMDk2LAogICAgICAgIDEyODE5NTM4ODYsCiAgICAgICAgMzU3OTg1NTMzMiwKICAgICAgICAyNzI0Njg4MjQyLAogICAgICAgIDEwMDY4ODgxNDUsCiAgICAgICAgMTI1ODYwNzY4NywKICAgICAgICAzNTI0MTAxNjI5LAogICAgICAgIDI3Njg5NDI0NDMsCiAgICAgICAgOTAxMDk3NzIyLAogICAgICAgIDExMTkwMDA2ODQsCiAgICAgICAgMzY4NjUxNzIwNiwKICAgICAgICAyODk4MDY1NzI4LAogICAgICAgIDg1MzA0NDQ1MSwKICAgICAgICAxMTcyMjY2MTAxLAogICAgICAgIDM3MDUwMTU3NTksCiAgICAgICAgMjg4MjYxNjY2NSwKICAgICAgICA2NTE3Njc5ODAsCiAgICAgICAgMTM3MzUwMzU0NiwKICAgICAgICAzMzY5NTU0MzA0LAogICAgICAgIDMyMTgxMDQ1OTgsCiAgICAgICAgNTY1NTA3MjUzLAogICAgICAgIDE0NTQ2MjE3MzEsCiAgICAgICAgMzQ4NTExMTcwNSwKICAgICAgICAzMDk5NDM2MzAzLAogICAgICAgIDY3MTI2Njk3NCwKICAgICAgICAxNTk0MTk4MDI0LAogICAgICAgIDMzMjI3MzA5MzAsCiAgICAgICAgMjk3MDM0NzgxMiwKICAgICAgICA3OTU4MzU1MjcsCiAgICAgICAgMTQ4MzIzMDIyNSwKICAgICAgICAzMjQ0MzY3Mjc1LAogICAgICAgIDMwNjAxNDk1NjUsCiAgICAgICAgMTk5NDE0NjE5MiwKICAgICAgICAzMTE1ODUzNCwKICAgICAgICAyNTYzOTA3NzcyLAogICAgICAgIDQwMjM3MTc5MzAsCiAgICAgICAgMTkwNzQ1OTQ2NSwKICAgICAgICAxMTI2MzcyMTUsCiAgICAgICAgMjY4MDE1MzI1MywKICAgICAgICAzOTA0NDI3MDU5LAogICAgICAgIDIwMTM3NzYyOTAsCiAgICAgICAgMjUxNzIyMDM2LAogICAgICAgIDI1MTcyMTUzNzQsCiAgICAgICAgMzc3NTgzMDA0MCwKICAgICAgICAyMTM3NjU2NzYzLAogICAgICAgIDE0MTM3NjgxMywKICAgICAgICAyNDM5Mjc3NzE5LAogICAgICAgIDM4NjUyNzEyOTcsCiAgICAgICAgMTgwMjE5NTQ0NCwKICAgICAgICA0NzY4NjQ4NjYsCiAgICAgICAgMjIzODAwMTM2OCwKICAgICAgICA0MDY2NTA4ODc4LAogICAgICAgIDE4MTIzNzA5MjUsCiAgICAgICAgNDUzMDkyNzMxLAogICAgICAgIDIxODE2MjUwMjUsCiAgICAgICAgNDExMTQ1MTIyMywKICAgICAgICAxNzA2MDg4OTAyLAogICAgICAgIDMxNDA0MjcwNCwKICAgICAgICAyMzQ0NTMyMjAyLAogICAgICAgIDQyNDAwMTc1MzIsCiAgICAgICAgMTY1ODY1ODI3MSwKICAgICAgICAzNjY2MTk5NzcsCiAgICAgICAgMjM2MjY3MDMyMywKICAgICAgICA0MjI0OTk0NDA1LAogICAgICAgIDEzMDM1MzU5NjAsCiAgICAgICAgOTg0OTYxNDg2LAogICAgICAgIDI3NDcwMDcwOTIsCiAgICAgICAgMzU2OTAzNzUzOCwKICAgICAgICAxMjU2MTcwODE3LAogICAgICAgIDEwMzc2MDQzMTEsCiAgICAgICAgMjc2NTIxMDczMywKICAgICAgICAzNTU0MDc5OTk1LAogICAgICAgIDExMzEwMTQ1MDYsCiAgICAgICAgODc5Njc5OTk2LAogICAgICAgIDI5MDkyNDM0NjIsCiAgICAgICAgMzY2Mzc3MTg1NiwKICAgICAgICAxMTQxMTI0NDY3LAogICAgICAgIDg1NTg0MjI3NywKICAgICAgICAyODUyODAxNjMxLAogICAgICAgIDM3MDg2NDg2NDksCiAgICAgICAgMTM0MjUzMzk0OCwKICAgICAgICA2NTQ0NTkzMDYsCiAgICAgICAgMzE4ODM5NjA0OCwKICAgICAgICAzMzczMDE1MTc0LAogICAgICAgIDE0NjY0Nzk5MDksCiAgICAgICAgNTQ0MTc5NjM1LAogICAgICAgIDMxMTA1MjM5MTMsCiAgICAgICAgMzQ2MjUyMjAxNSwKICAgICAgICAxNTkxNjcxMDU0LAogICAgICAgIDcwMjEzODc3NiwKICAgICAgICAyOTY2NDYwNDUwLAogICAgICAgIDMzNTI3OTk0MTIsCiAgICAgICAgMTUwNDkxODgwNywKICAgICAgICA3ODM1NTE4NzMsCiAgICAgICAgMzA4MjY0MDQ0MywKICAgICAgICAzMjMzNDQyOTg5LAogICAgICAgIDM5ODgyOTIzODQsCiAgICAgICAgMjU5NjI1NDY0NiwKICAgICAgICA2MjMxNzA2OCwKICAgICAgICAxOTU3ODEwODQyLAogICAgICAgIDM5Mzk4NDU5NDUsCiAgICAgICAgMjY0NzgxNjExMSwKICAgICAgICA4MTQ3MDk5NywKICAgICAgICAxOTQzODAzNTIzLAogICAgICAgIDM4MTQ5MTg5MzAsCiAgICAgICAgMjQ4OTU5NjgwNCwKICAgICAgICAyMjUyNzQ0MzAsCiAgICAgICAgMjA1Mzc5MDM3NiwKICAgICAgICAzODI2MTc1NzU1LAogICAgICAgIDI0NjY5MDYwMTMsCiAgICAgICAgMTY3ODE2NzQzLAogICAgICAgIDIwOTc2NTEzNzcsCiAgICAgICAgNDAyNzU1MjU4MCwKICAgICAgICAyMjY1NDkwMzg2LAogICAgICAgIDUwMzQ0NDA3MiwKICAgICAgICAxNzYyMDUwODE0LAogICAgICAgIDQxNTA0MTcyNDUsCiAgICAgICAgMjE1NDEyOTM1NSwKICAgICAgICA0MjY1MjIyMjUsCiAgICAgICAgMTg1MjUwNzg3OSwKICAgICAgICA0Mjc1MzEzNTI2LAogICAgICAgIDIzMTIzMTc5MjAsCiAgICAgICAgMjgyNzUzNjI2LAogICAgICAgIDE3NDI1NTU4NTIsCiAgICAgICAgNDE4OTcwODE0MywKICAgICAgICAyMzk0ODc3OTQ1LAogICAgICAgIDM5NzkxNzc2MywKICAgICAgICAxNjIyMTgzNjM3LAogICAgICAgIDM2MDQzOTA4ODgsCiAgICAgICAgMjcxNDg2NjU1OCwKICAgICAgICA5NTM3Mjk3MzIsCiAgICAgICAgMTM0MDA3NjYyNiwKICAgICAgICAzNTE4NzE5OTg1LAogICAgICAgIDI3OTczNjA5OTksCiAgICAgICAgMTA2ODgyODM4MSwKICAgICAgICAxMjE5NjM4ODU5LAogICAgICAgIDM2MjQ3NDE4NTAsCiAgICAgICAgMjkzNjY3NTE0OCwKICAgICAgICA5MDYxODU0NjIsCiAgICAgICAgMTA5MDgxMjUxMiwKICAgICAgICAzNzQ3NjcyMDAzLAogICAgICAgIDI4MjUzNzk2NjksCiAgICAgICAgODI5MzI5MTM1LAogICAgICAgIDExODEzMzUxNjEsCiAgICAgICAgMzQxMjE3NzgwNCwKICAgICAgICAzMTYwODM0ODQyLAogICAgICAgIDYyODA4NTQwOCwKICAgICAgICAxMzgyNjA1MzY2LAogICAgICAgIDM0MjMzNjkxMDksCiAgICAgICAgMzEzODA3ODQ2NywKICAgICAgICA1NzA1NjIyMzMsCiAgICAgICAgMTQyNjQwMDgxNSwKICAgICAgICAzMzE3MzE2NTQyLAogICAgICAgIDI5OTg3MzM2MDgsCiAgICAgICAgNzMzMjM5OTU0LAogICAgICAgIDE1NTUyNjE5NTYsCiAgICAgICAgMzI2ODkzNTU5MSwKICAgICAgICAzMDUwMzYwNjI1LAogICAgICAgIDc1MjQ1OTQwMywKICAgICAgICAxNTQxMzIwMjIxLAogICAgICAgIDI2MDcwNzE5MjAsCiAgICAgICAgMzk2NTk3MzAzMCwKICAgICAgICAxOTY5OTIyOTcyLAogICAgICAgIDQwNzM1NDk4LAogICAgICAgIDI2MTc4MzcyMjUsCiAgICAgICAgMzk0MzU3NzE1MSwKICAgICAgICAxOTEzMDg3ODc3LAogICAgICAgIDgzOTA4MzcxLAogICAgICAgIDI1MTIzNDE2MzQsCiAgICAgICAgMzgwMzc0MDY5MiwKICAgICAgICAyMDc1MjA4NjIyLAogICAgICAgIDIxMzI2MTExMiwKICAgICAgICAyNDYzMjcyNjAzLAogICAgICAgIDM4NTU5OTAyODUsCiAgICAgICAgMjA5NDg1NDA3MSwKICAgICAgICAxOTg5NTg4ODEsCiAgICAgICAgMjI2MjAyOTAxMiwKICAgICAgICA0MDU3MjYwNjEwLAogICAgICAgIDE3NTkzNTk5OTIsCiAgICAgICAgNTM0NDE0MTkwLAogICAgICAgIDIxNzY3MTg1NDEsCiAgICAgICAgNDEzOTMyOTExNSwKICAgICAgICAxODczODM2MDAxLAogICAgICAgIDQxNDY2NDU2NywKICAgICAgICAyMjgyMjQ4OTM0LAogICAgICAgIDQyNzkyMDAzNjgsCiAgICAgICAgMTcxMTY4NDU1NCwKICAgICAgICAyODUyODExMTYsCiAgICAgICAgMjQwNTgwMTcyNywKICAgICAgICA0MTY3MjE2NzQ1LAogICAgICAgIDE2MzQ0Njc3OTUsCiAgICAgICAgMzc2MjI5NzAxLAogICAgICAgIDI2ODUwNjc4OTYsCiAgICAgICAgMzYwODAwNzQwNiwKICAgICAgICAxMzA4OTE4NjEyLAogICAgICAgIDk1NjU0MzkzOCwKICAgICAgICAyODA4NTU1MTA1LAogICAgICAgIDM0OTU5NTgyNjMsCiAgICAgICAgMTIzMTYzNjMwMSwKICAgICAgICAxMDQ3NDI3MDM1LAogICAgICAgIDI5MzI5NTk4MTgsCiAgICAgICAgMzY1NDcwMzgzNiwKICAgICAgICAxMDg4MzU5MjcwLAogICAgICAgIDkzNjkxOGUzLAogICAgICAgIDI4NDc3MTQ4OTksCiAgICAgICAgMzczNjgzNzgyOSwKICAgICAgICAxMjAyOTAwODYzLAogICAgICAgIDgxNzIzMzg5NywKICAgICAgICAzMTgzMzQyMTA4LAogICAgICAgIDM0MDEyMzcxMzAsCiAgICAgICAgMTQwNDI3NzU1MiwKICAgICAgICA2M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5hcHBseShudWxsLCBhcmd1bWVudHMpID4+PiAwOwogICAgICB9OwogICAgICBtb2R1bGUuZXhwb3J0cyA9IGNyYzMyMjsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL29iamVjdC5lbnRyaWVzLXBvbnlmaWxsQDEuMC4xL25vZGVfbW9kdWxlcy9vYmplY3QuZW50cmllcy1wb255ZmlsbC9lbnRyaWVzLmpzCiAgdmFyIHJlcXVpcmVfZW50cmllcyA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9vYmplY3QuZW50cmllcy1wb255ZmlsbEAxLjAuMS9ub2RlX21vZHVsZXMvb2JqZWN0LmVudHJpZXMtcG9ueWZpbGwvZW50cmllcy5qcyIoZXhwb3J0cywgbW9kdWxlKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICB2YXIgaGFzID0gZnVuY3Rpb24ob2JqLCBwcm9wKSB7CiAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChvYmosIHByb3ApOwogICAgICB9OwogICAgICB2YXIgaXNFbnVtZXJhYmxlID0gZnVuY3Rpb24ob2JqLCBwcm9wKSB7CiAgICAgICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChvYmosIHByb3ApOwogICAgICB9OwogICAgICBmdW5jdGlvbiBlbnRyaWVzMihvYmopIHsKICAgICAgICBpZiAob2JqID09IG51bGwpIHsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoIkNhbm5vdCBjb252ZXJ0IHVuZGVmaW5lZCBvciBudWxsIHRvIG9iamVjdCIpOwogICAgICAgIH0KICAgICAgICB2YXIgcGFpcnMgPSBbXTsKICAgICAgICBmb3IgKHZhciBrZXkgaW4gb2JqKSB7CiAgICAgICAgICBpZiAoaGFzKG9ia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AgICAgICAgX2RlZmluZVByb3BlcnRpZXMoQ29uc3RydWN0b3IucHJvdG90eXBlLCBwcm90b1Byb3BzKTsKICAgICAgICBpZiAoc3RhdGljUHJvcHMpCiAgICAgICAgICBfZGVmaW5lUHJvcGVydGllcyhDb25zdHJ1Y3Rvciwgc3RhdGljUHJvcHMpOwogICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShDb25zdHJ1Y3RvciwgInByb3RvdHlwZSIsIHsKICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pOwogICAgICAgIHJldHVybiBDb25zdHJ1Y3RvcjsKICAgICAgfQogICAgICBmdW5jdGlvbiBfaW5oZXJpdHMoc3ViQ2xhc3MsIHN1cGVyQ2xhc3MpIHsKICAgICAgICBpZiAodHlwZW9mIHN1cGVyQ2xhc3MgIT09ICJmdW5jdGlvbiIgJiYgc3VwZXJDbGFzcyAhPT0gbnVsbCkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiU3VwZXIgZXhwcmVzc2lvbiBtdXN0IGVpdGhlciBiZSBudWxsIG9yIGEgZnVuY3Rpb24iKTsKICAgICAgICB9CiAgICAgICAgc3ViQ2xhc3MucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShzdXBlckNsYXNzICYmIHN1cGVyQ2xhc3MucHJvdG90eXBlLCB7CiAgICAgICAgICBjb25zdHJ1Y3RvcjogewogICAgICAgICAgICB2YWx1ZTogc3ViQ2xhc3MsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlLAogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoc3ViQ2xhc3MsICJwcm90b3R5cGUiLCB7CiAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KTsKICAgICAgICBpZiAoc3VwZXJDbGFzcykKICAgICAgICAgIF9zZXRQcm90b3R5cGVPZihzdWJDbGFzcywgc3VwZXJDbGFzcyk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mKG8pIHsKICAgICAgICBfZ2V0UHJvdG90eXBlT2YgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgPyBPYmplY3QuZ2V0UHJvdG90eXBlT2YuYmluZCgpIDogZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mMihvMikgewogICAgICAgICAgcmV0dXJuIG8yLl9fcHJvdG9fXyB8fCBPYmplY3QuZ2V0UHJvdG90eXBlT2YobzIpOwogICAgICAgIH07CiAgICAgICAgcmV0dXJuIF9nZXRQcm90b3R5cGVPZihvKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YobywgcCkgewogICAgICAgIF9zZXRQcm90b3R5cGVPZiA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiA/IE9iamVjdC5zZXRQcm90b3R5cGVPZi5iaW5kKCkgOiBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YyKG8yLCBwMikgewogICAgICAgICAgbzIuX19wcm90b19fID0gcDI7CiAgICAgICAgICByZXR1cm4gbzI7CiAgICAgICAgfTsKICAgICAgICByZXR1cm4gX3NldFByb3RvdHlwZU9mKG8sIHApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9pc05hdGl2ZVJlZmxlY3RDb25zdHJ1Y3QoKSB7CiAgICAgICAgaWYgKHR5cGVvZiBSZWZsZWN0ID09PSAidW5kZWZpbmVkIiB8fCAhUmVmbGVjdC5jb25zdHJ1Y3QpCiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKFJlZmxlY3QuY29uc3RydWN0LnNoYW0pCiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKHR5cGVvZiBQcm94eSA9PT0gImZ1bmN0aW9uIikKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIHRyeSB7CiAgICAgICAgICBCb29sZWFu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uc3RydWN0KCk7CiAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIF9jcmVhdGVTdXBlckludGVybmFsKCkgewogICAgICAgICAgdmFyIFN1cGVyID0gX2dldFByb3RvdHlwZU9mKERlcml2ZWQpLCByZXN1bHQ7CiAgICAgICAgICBpZiAoaGFzTmF0aXZlUmVmbGVjdENvbnN0cnVjdCkgewogICAgICAgICAgICB2YXIgTmV3VGFyZ2V0ID0gX2dldFByb3RvdHlwZU9mKHRoaXMpLmNvbnN0cnVjdG9yOwogICAgICAgICAgICByZXN1bHQgPSBSZWZsZWN0LmNvbnN0cnVjdChTdXBlciwgYXJndW1lbnRzLCBOZXdUYXJnZXQpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmVzdWx0ID0gU3VwZXIuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBfcG9zc2libGVDb25zdHJ1Y3RvclJldHVybih0aGlzLCByZXN1bHQpOwogICAgICAgIH07CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX3N1cGVyUHJvcEJhc2Uob2JqZWN0LCBwcm9wZXJ0eSkgewogICAgICAgIHdoaWxlICghT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwgcHJvcGVydHkpKSB7CiAgICAgICAgICBvYmplY3QgPSBfZ2V0UHJvdG90eXBlT2Yob2JqZWN0KTsKICAgICAgICAgIGlmIChvYmplY3QgPT09IG51bGwpCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICByZXR1cm4gb2JqZWN0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9nZXQoKSB7CiAgICAgICAgaWYgKHR5cGVvZiBSZWZsZWN0ICE9PSAidW5kZWZpbmVkIiAmJiBSZWZsZWN0LmdldCkgewogICAgICAgICAgX2dldCA9IFJlZmxlY3QuZ2V0LmJpbmQoKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgX2dldCA9IGZ1bmN0aW9uIF9nZXQyKHRhcmdldCwgcHJvcGVydHksIHJlY2VpdmVyKSB7CiAgICAgICAgICAgIHZhciBiYXNlID0gX3N1cGVyUHJvcEJhc2UodGFyZ2V0LCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmICghYmFzZSkKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIHZhciBkZXNjID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihiYXNlLCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmIChkZXNjLmdldCkgewogICAgICAgICAgICAgIHJldHVybiBkZXNjLmdldC5jYWxsKGFyZ3VtZW50cy5sZW5ndGggPCAzID8gdGFyZ2V0IDogcmVjZWl2ZXIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBkZXNjLnZhbHVlOwogICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIF9nZXQuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgfQogICAgICB2YXIgRW1pdHRlciA9IC8qIEBfX1BVUkVfXyAqLyBmdW5jdGlvbigpIHsKICAgICAgICBmdW5jdGlvbiBFbWl0dGVyMigpIHsKICAgICAgICAgIF9jbGFzc0NhbGxDaGVjayh0aGlzLCBFbWl0dGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgImxpc3RlbmVycyIsIHsKICAgICAgICAgICAgdmFsdWU6IHt9LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEVtaXR0ZXIyLCBbewogICAgICAgICAga2V5OiAiYWRkRXZlbnRMaXN0ZW5lciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWRkRXZlbnRMaXN0ZW5lcih0eXBlLCBjYWxsYmFjaywgb3B0aW9ucykgewogICAgICAgICAgICBpZiAoISh0eXBlIGluIHRoaXMubGlzdGVuZXJzKSkgewogICAgICAgICAgICAgIHRoaXMubGlzdGVuZXJzW3R5cGVdID0gW107CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5saXN0ZW5lcnNbdHlwZV0ucHVzaCh7CiAgICAgICAgICAgICAgY2FsbGJhY2ssCiAgICAgICAgICAgICAgb3B0aW9ucwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJyZW1vdmVFdmVudExpc3RlbmVyIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiByZW1vdmVFdmVudExpc3RlbmVyKHR5cGUsIGNhbGxiYWNrKSB7CiAgICAgICAgICAgIGlmICghKHR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW3R5cGVdOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIGlmIChzdGFja1tpXS5jYWxsYmFjayA9PT0gY2FsbGJhY2spIHsKICAgICAgICAgICAgICAgIHN0YWNrLnNwbGljZShpLCAxKTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJkaXNwYXRjaEV2ZW50IiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBkaXNwYXRjaEV2ZW50KGV2ZW50KSB7CiAgICAgICAgICAgIGlmICghKGV2ZW50LnR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW2V2ZW50LnR5cGVdOwogICAgICAgICAgICB2YXIgc3RhY2tUb0NhbGwgPSBzdGFjay5zbGljZSgpOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrVG9DYWxsLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIHZhciBsaXN0ZW5lciA9IHN0YWNrVG9DYWxsW2ldOwogICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBsaXN0ZW5lci5jYWxsYmFjay5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBQcm9taXNlLnJlc29sdmUoKS50aGVuKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChsaXN0ZW5lci5vcHRpb25zICYmIGxpc3RlbmVyLm9wdGlvbnMub25jZSkgewogICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVFdmVudExpc3RlbmVyKGV2ZW50LnR5cGUsIGxpc3RlbmVyLmNhbGxiYWNrKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuICFldmVudC5kZWZhdWx0UHJldmVudGVkOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gRW1pdHRlcjI7CiAgICAgIH0oKTsKICAgICAgdmFyIEFib3J0U2lnbmFsID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKF9FbWl0dGVyKSB7CiAgICAgICAgX2luaGVyaXRzKEFib3J0U2lnbmFsMiwgX0VtaXR0ZXIpOwogICAgICAgIHZhciBfc3VwZXIgPSBfY3JlYXRlU3VwZXIoQWJvcnRTaWduYWwyKTsKICAgICAgICBmdW5jdGlvbiBBYm9ydFNpZ25hbDIoKSB7CiAgICAgICAgICB2YXIgX3RoaXM7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRTaWduYWwyKTsKICAgICAgICAgIF90aGlzID0gX3N1cGVyLmNhbGwodGhpcyk7CiAgICAgICAgICBpZiAoIV90aGlzLmxpc3RlbmVycykgewogICAgICAgICAgICBFbWl0dGVyLmNhbGwoX2Fzc2VydFRoaXNJbml0aWFsaXplZChfdGhpcykpOwogICAgICAgICAgfQogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KF9hc3NlcnRUaGlzSW5pdGlhbGl6ZWQoX3RoaXMpLCAiYWJvcnRlZCIsIHsKICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgIm9uYWJvcnQiLCB7CiAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgInJlYXNvbiIsIHsKICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgICByZXR1cm4gX3RoaXM7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhBYm9ydFNpZ25hbDIsIFt7CiAgICAgICAgICBrZXk6ICJ0b1N0cmluZyIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gdG9TdHJpbmcoKSB7CiAgICAgICAgICAgIHJldHVybiAiW29iamVjdCBBYm9ydFNpZ25hbF0iOwogICAgICAgICAgfQogICAgICAgIH0sIHsKICAgICAgICAgIGtleTogImRpc3BhdGNoRXZlbnQiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGRpc3BhdGNoRXZlbnQoZXZlbnQpIHsKICAgICAgICAgICAgaWYgKGV2ZW50LnR5cGUgPT09ICJhYm9ydCIpIHsKICAgICAgICAgICAgICB0aGlzLmFib3J0ZWQgPSB0cnVlOwogICAgICAgICAgICAgIGlmICh0eXBlb2YgdGhpcy5vbmFib3J0ID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICB0aGlzLm9uYWJvcnQuY2FsbCh0aGlzLCBldmVudCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIF9nZXQoX2dldFByb3RvdHlwZU9mKEFib3J0U2lnbmFsMi5wcm90b3R5cGUpLCAiZGlzcGF0Y2hFdmVudCIsIHRoaXMpLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gQWJvcnRTaWduYWwyOwogICAgICB9KEVtaXR0ZXIpOwogICAgICB2YXIgQWJvcnRDb250cm9sbGVyID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKCkgewogICAgICAgIGZ1bmN0aW9uIEFib3J0Q29udHJvbGxlcjIoKSB7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRDb250cm9sbGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgInNpZ25hbCIsIHsKICAgICAgICAgICAgdmFsdWU6IG5ldyBBYm9ydFNpZ25hbCgpLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEFib3J0Q29udHJvbGxlcjIsIFt7CiAgICAgICAgICBrZXk6ICJhYm9ydCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWJvcnQocmVhc29uKSB7CiAgICAgICAgICAgIHZhciBldmVudDsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBldmVudCA9IG5ldyBFdmVudCgiYWJvcnQiKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgIGlmICh0eXBlb2YgZG9jdW1lbnQgIT09ICJ1bmRlZmluZWQiKSB7CiAgICAgICAgICAgICAgICBpZiAoIWRvY3VtZW50LmNyZWF0ZUV2ZW50KSB7CiAgICAgICAgICAgICAgICAgIGV2ZW50ID0gZG9jdW1lbnQuY3JlYXRlRXZlbnRPYmplY3QoKTsKICAgICAgICAgICAgICAgICAgZXZlbnQudHlwZSA9ICJhYm9ydCI7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBldmVudCA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCJFdmVudCIpOwogICAgICAgICAgICAgICAgICBldmVudC5pbml0RXZlbnQoImFib3J0IiwgZmFsc2UsIGZhbHNlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZXZlbnQgPSB7CiAgICAgICAgICAgICAgICAgIHR5cGU6ICJhYm9ydCIsCiAgICAgICAgICAgICAgICAgIGJ1YmJsZXM6IGZhbHNlLAogICAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHNpZ25hbFJlYXNvbiA9IHJlYXNvbjsKICAgICAgICAgICAgaWYgKHNpZ25hbFJlYXNvbiA9PT0gdm9pZCAwKSB7CiAgICAgICAgICAgICAgaWYgKHR5cGVvZiBkb2N1bWVudCA9PT0gInVuZGVmaW5lZCIpIHsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbi5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24gPSBuZXcgRE9NRXhjZXB0aW9uKCJzaWduYWwgaXMgYWJvcnRlZCB3aXRob3V0IHJlYXNvbiIpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgICAgc2lnbmFsUmVhc29uLm5hbWUgPSAiQWJvcnRFcnJvciI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMuc2lnbmFsLnJlYXNvbiA9IHNpZ25hbFJlYXNvbjsKICAgICAgICAgICAgdGhpcy5zaWduYWwuZGlzcGF0Y2hFdmVudChldmVudCk7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAidG9TdHJpbmciLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIHRvU3RyaW5nKCkgewogICAgICAgICAgICByZXR1cm4gIltvYmplY3QgQWJvcnRDb250cm9sbGVyXSI7CiAgICAgICAgICB9CiAgICAgICAgfV0pOwogICAgICAgIHJldHVybiBBYm9ydENvbnRyb2xsZXIyOwogICAgICB9KCk7CiAgICAgIGlmICh0eXBlb2YgU3ltYm9sICE9PSAidW5kZWZpbmVkIiAmJiBTeW1ib2wudG9TdHJpbmdUYWcpIHsKICAgICAgICBBYm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aW9uIFJlcXVlc3QyKGlucHV0LCBpbml0MikgewogICAgICAgICAgICB2YXIgc2lnbmFsOwogICAgICAgICAgICBpZiAoaW5pdDIgJiYgaW5pdDIuc2lnbmFsKSB7CiAgICAgICAgICAgICAgc2lnbmFsID0gaW5pdDIuc2lnbmFsOwogICAgICAgICAgICAgIGRlbGV0ZSBpbml0Mi5zaWduYWw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHJlcXVlc3QgPSBuZXcgTmF0aXZlUmVxdWVzdChpbnB1dCwgaW5pdDIpOwogICAgICAgICAgICBpZiAoc2lnbmFsKSB7CiAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHJlcXVlc3QsICJzaWduYWwiLCB7CiAgICAgICAgICAgICAgICB3cml0YWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICAgIHZhbHVlOiBzaWduYWwKICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmVxdWVzdDsKICAgICAgICAgIH07CiAgICAgICAgICBSZXF1ZXN0LnByb3RvdHlwZSA9IE5hdGl2ZVJlcXVlc3QucHJvdG90eXBlOwogICAgICAgIH0KICAgICAgICB2YXIgcmVhbEZldGNoID0gZmV0Y2gyOwogICAgICAgIHZhciBhYm9ydGFibGVGZXRjaCA9IGZ1bmN0aW9uIGFib3J0YWJsZUZldGNoMihpbnB1dCwgaW5pdDIpIHsKICAgICAgICAgIHZhciBzaWduYWwgPSBSZXF1ZXN0ICYmIFJlcXVlc3QucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoaW5wdXQpID8gaW5wdXQuc2lnbmFsIDogaW5pdDIgPyBpbml0Mi5zaWduYWwgOiB2b2lkIDA7CiAgICAgICAgICBpZiAoc2lnbmFsKSB7CiAgICAgICAgICAgIHZhciBhYm9ydEVycm9yOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgIGFib3J0RXJyb3IgPSBuZXcgRE9NRXhjZXB0aW9uKCJBYm9ydGVkIiwgIkFib3J0RXJyb3IiKTsKICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgICAgYWJvcnRFcnJvciA9IG5ldyBFcnJvcigiQWJvcnRlZCIpOwogICAgICAgICAgICAgIGFib3J0RXJyb3IubmFtZSA9ICJBYm9ydEVycm9yIjsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoYWJvcnRFcnJvcik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIGNhbmNlbGxhdGlvbiA9IG5ldyBQcm9taXNlKGZ1bmN0aW9uKF8sIHJlamVjdCkgewogICAgICAgICAgICAgIHNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsIGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHJlamVjdChhYm9ydEVycm9yKTsKICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICBvbmNlOiB0cnVlCiAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBpZiAoaW5pdDIgJiYgaW5pdDIuc2lnbmFsKSB7CiAgICAgICAgICAgICAgZGVsZXRlIGluaXQyLnNpZ25hbDsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yYWNlKFtjYW5jZWxsYXRpb24sIHJlYWxGZXRjaChpbnB1dCwgaW5pdDIpXSk7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gcmVhbEZldGNoKGlucHV0LCBpbml0Mik7CiAgICAgICAgfTsKICAgICAgICByZXR1cm4gewogICAgICAgICAgZmV0Y2g6IGFib3J0YWJsZUZldGNoLAogICAgICAgICAgUmV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EV2ZW50TGlzdGVuZXIgPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgICAgc2lnbmFsLmFkZEV2ZW50TGlzdGVuZXIoImFib3J0IiwgKCkgPT4gewogICAgICAgICAgICAgIHRoaXMuaGFuZGxlQWJvcnRlZChzaWduYWwpOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaGFuZGxlQWJvcnRlZChzaWduYWwpIHsKICAgICAgICAgIHRoaXMuc2lnbmFscy5kZWxldGUoc2lnbmFsKTsKICAgICAgICAgIGlmICh0aGlzLnNpZ25hbHMuc2l6ZSA9PT0gMCkgewogICAgICAgICAgICB0aGlzLmFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBnZXQgc2lnbmFsKCkgewogICAgICAgICAgcmV0dXJuIHRoaXMuYWJvcnRDb250cm9sbGVyLnNpZ25hbDsKICAgICAgICB9CiAgICAgICAgYWJvcnQoKSB7CiAgICAgICAgICB0aGlzLmFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgIH0KICAgICAgfTsKICAgICAgZXhwb3J0cy5kZWZhdWx0ID0gQWdncmVnYXRlQWJvcnRDb250cm9sbGVyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vYWJvcnRhYmxlLXByb21pc2UtY2FjaGVAMS41LjAvbm9kZV9tb2R1bGVzL2Fib3J0YWJsZS1wcm9taXNlLWNhY2hlL2VzbS9BZ2dyZWdhdGVTdGF0dXNSZXBvcnRlci5qcwogIHZhciByZXF1aXJlX0FnZ3JlZ2F0ZVN0YXR1c1JlcG9ydGVyID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL2Fib3J0YWJsZS1wcm9taXNlLWNhY2hlQDEuNS4wL25vZGVfbW9kdWxlcy9hYm9ydGFibGUtcHJvbWlzZS1jYWNoZS9lc20vQWdncmVnYXRlU3RhdHVzUmVw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xsYmFjaykgewogICAgICAgICAgY29uc3QgYWJvcnRlciA9IG5ldyBBZ2dyZWdhdGVBYm9ydENvbnRyb2xsZXJfMS5kZWZhdWx0KCk7CiAgICAgICAgICBjb25zdCBzdGF0dXNSZXBvcnRlciA9IG5ldyBBZ2dyZWdhdGVTdGF0dXNSZXBvcnRlcl8xLmRlZmF1bHQoKTsKICAgICAgICAgIHN0YXR1c1JlcG9ydGVyLmFkZENhbGxiYWNrKHN0YXR1c0NhbGxiYWNrKTsKICAgICAgICAgIGNvbnN0IG5ld0VudHJ5ID0gewogICAgICAgICAgICBhYm9ydGVyLAogICAgICAgICAgICBwcm9taXNlOiB0aGlzLmZpbGxDYWxsYmFjayhkYXRhLCBhYm9ydGVyLnNpZ25hbCwgKG1lc3NhZ2UpID0+IHsKICAgICAgICAgICAgICBzdGF0dXNSZXBvcnRlci5jYWxsYmFjayhtZXNzYWdlKTsKICAgICAgICAgICAgfSksCiAgICAgICAgICAgIHNldHRsZWQ6IGZhbHNlLAogICAgICAgICAgICBzdGF0dXNSZXBvcnRlciwKICAgICAgICAgICAgZ2V0IGFib3J0ZWQoKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYWJvcnRlci5zaWduYWwuYWJvcnRlZDsKICAgICAgICAgICAgfQogICAgICAgICAgfTsKICAgICAgICAgIG5ld0VudHJ5LmFib3J0ZXIuYWRkU2lnbmFsKHNpZ25hbCk7CiAgICAgICAgICBuZXdFbnRyeS5hYm9ydGVyLnNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsICgpID0+IHsKICAgICAgICAgICAgaWYgKCFuZXdFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgdGhpcy5ldmljdChrZXksIG5ld0VudHJ5KTsKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgICBuZXdFbnRyeS5wcm9taXNlLnRoZW4oKCkgPT4gewogICAgICAgICAgICBuZXdFbnRyeS5zZXR0bGVkID0gdHJ1ZTsKICAgICAgICAgIH0sICgpID0+IHsKICAgICAgICAgICAgbmV3RW50cnkuc2V0dGxlZCA9IHRydWU7CiAgICAgICAgICAgIHRoaXMuZXZpY3Qoa2V5LCBuZXdFbnRyeSk7CiAgICAgICAgICB9KS5jYXRjaCgoZSkgPT4gewogICAgICAgICAgICBjb25zb2xlLmVycm9yKGUpOwogICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgfSk7CiAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIG5ld0VudHJ5KTsKICAgICAgICB9CiAgICAgICAgc3RhdGljIGNoZWNrU2luZ2xlUHJvbWlzZShwcm9taXNlLCBzaWduYWwpIHsKICAgICAgICAgIGZ1bmN0aW9uIGNoZWNrRm9yU2luZ2xlQWJvcnQoKSB7CiAgICAgICAgICAgIGlmIChzaWduYWwgJiYgc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICB0aHJvdyBPYmplY3QuYXNzaWduKG5ldyBFcnJvcigiYWJvcnRlZCIpLCB7IGNvZGU6ICJFUlJfQUJPUlRFRCIgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBwcm9taXNlLnRoZW4oKHJlc3VsdCkgPT4gewogICAgICAgICAgICBjaGVja0ZvclNpbmdsZUFib3J0KCk7CiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICAgICB9LCAoZXJyb3IpID0+IHsKICAgICAgICAgICAgY2hlY2tGb3JTaW5nbGVBYm9ydCgpOwogICAgICAgICAgICB0aHJvdyBlcnJvcjsKICAgICAgICAgIH0pOwogICAgICAgIH0KICAgICAgICBoYXMoa2V5KSB7CiAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5oYXMoa2V5KTsKICAgICAgICB9CiAgICAgICAgZ2V0KGtleSwgZGF0YSwgc2lnbmFsLCBzdGF0dXNDYWxsYmFjaykgewogICAgICAgICAgaWYgKCFzaWduYWwgJiYgZGF0YSBpbnN0YW5j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1cm4gQWJvcnRhYmxlUHJvbWlzZUNhY2hlMi5jaGVja1NpbmdsZVByb21pc2UodGhpcy5jYWNoZS5nZXQoa2V5KS5wcm9taXNlLCBzaWduYWwpOwogICAgICAgIH0KICAgICAgICBkZWxldGUoa2V5KSB7CiAgICAgICAgICBjb25zdCBjYWNoZWRFbnRyeSA9IHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICBpZiAoY2FjaGVkRW50cnkpIHsKICAgICAgICAgICAgaWYgKCFjYWNoZWRFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgY2FjaGVkRW50cnkuYWJvcnRlci5hYm9ydCgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMuY2FjaGUuZGVsZXRlKGtleSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNsZWFyKCkgewogICAgICAgICAgY29uc3Qga2V5SXRlciA9IHRoaXMuY2FjaGUua2V5cygpOwogICAgICAgICAgbGV0IGRlbGV0ZUNvdW50ID0gMDsKICAgICAgICAgIGZvciAobGV0IHJlc3VsdCA9IGtleUl0ZXIubmV4dCgpOyAhcmVzdWx0LmRvbmU7IHJlc3VsdCA9IGtleUl0ZXIubmV4dCgpKSB7CiAgICAgICAgICAgIHRoaXMuZGVsZXRlKHJlc3VsdC52YWx1ZSk7CiAgICAgICAgICAgIGRlbGV0ZUNvdW50ICs9IDE7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gZGVsZXRlQ291bnQ7CiAgICAgICAgfQogICAgICB9OwogICAgICBleHBvcnRzLmRlZmF1bHQgPSBBYm9ydGFibGVQcm9taXNlQ2FjaGUyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vYWJvcnRhYmxlLXByb21pc2UtY2FjaGVAMS41LjAvbm9kZV9tb2R1bGVzL2Fib3J0YWJsZS1wcm9taXNlLWNhY2hlL2VzbS9pbmRleC5qcwogIHZhciByZXF1aXJlX2VzbSA9IF9fY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c3MgewogICAgICAgIGNvbnN0cnVjdG9yKG9wdGlvbnMgPSB7fSkgewogICAgICAgICAgaWYgKCEob3B0aW9ucy5tYXhTaXplICYmIG9wdGlvbnMubWF4U2l6ZSA+IDApKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoImBtYXhTaXplYCBtdXN0IGJlIGEgbnVtYmVyIGdyZWF0ZXIgdGhhbiAwIik7CiAgICAgICAgICB9CiAgICAgICAgICB0aGlzLm1heFNpemUgPSBvcHRpb25zLm1heFNpemU7CiAgICAgICAgICB0aGlzLmNhY2hlID0gbmV3IE1hcCgpOwogICAgICAgICAgdGhpcy5vbGRDYWNoZSA9IG5ldyBNYXAoKTsKICAgICAgICAgIHRoaXMuX3NpemUgPSAwOwogICAgICAgIH0KICAgICAgICBfc2V0KGtleSwgdmFsdWUpIHsKICAgICAgICAgIHRoaXMuY2FjaGUuc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgdGhpcy5fc2l6ZSsrOwogICAgICAgICAgaWYgKHRoaXMuX3NpemUgPj0gdGhpcy5tYXhTaXplKSB7CiAgICAgICAgICAgIHRoaXMuX3NpemUgPSAwOwogICAgICAgICAgICB0aGlzLm9sZENhY2hlID0gdGhpcy5jYWNoZTsKICAgICAgICAgICAgdGhpcy5jYWNoZSA9IG5ldyBNYXAoKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZ2V0KGtleSkgewogICAgICAgICAgaWYgKHRoaXMuY2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodGhpcy5vbGRDYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICBjb25zdCB2YWx1ZSA9IHRoaXMub2xkQ2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICAgIHRoaXMuX3NldChrZXksIHZhbHVlKTsKICAgICAgICAgICAgcmV0dXJuIHZhbHVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzZXQoa2V5LCB2YWx1ZSkgewogICAgICAgICAgaWYgKHRoaXMuY2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgdGhpcy5jYWNoZS5zZXQoa2V5LCB2YWx1ZSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aGlzLl9zZXQoa2V5LCB2YWx1ZSk7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICB9CiAgICAgICAgaGFzKGtleSkgewogICAgICAgICAgcmV0dXJuIHRoaXMuY2FjaGUuaGFzKGtleSkgfHwgdGhpcy5vbGRDYWNoZS5oYXMoa2V5KTsKICAgICAgICB9CiAgICAgICAgcGVlayhrZXkpIHsKICAgICAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLmNhY2hlLmdldChrZXkpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHRoaXMub2xkQ2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMub2xkQ2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGRlbGV0ZShrZXkpIHsKICAgICAgICAgIGNvbnN0IGRlbGV0ZWQgPSB0aGlzLmNhY2hlLmRlbGV0ZShrZXkpOwogICAgICAgICAgaWYgKGRlbGV0ZWQpIHsKICAgICAgICAgICAgdGhpcy5fc2l6ZS0tOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHRoaXMub2xkQ2FjaGUuZGVsZXRlKGtleSkgfHwgZGVsZXRlZDsKICAgICAgICB9CiAgICAgICAgY2xlYXIoKSB7CiAgICAgICAgICB0aGlzLmNhY2hlLmNsZWFyKCk7CiAgICAgICAgICB0aGlzLm9sZENhY2hlLmNsZWFyKCk7CiAgICAgICAgICB0aGlzLl9zaXplID0gMDsKICAgICAgICB9CiAgICAgICAgKmtleXMoKSB7CiAgICAgICAgICBmb3IgKGNvbnN0IFtrZXldIG9mIHRoaXMpIHsKICAgICAgICAgICAgeWllbGQga2V5OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICAqdmFsdWVzKCkgewogICAgICAgICAgZm9yIChjb25zdCBbLCB2YWx1ZV0gb2YgdGhpcykgewogICAgICAgICAgICB5aWVsZCB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgKltTeW1ib2wuaXRlcmF0b3JdKCkgewogICAgICAgICAgZm9yIChjb25zdCBpdGVtIG9mIHRoaXMuY2FjaGUpIHsKICAgICAgICAgICAgeWllbGQgaXRlbTsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAoY29uc3QgaXRlbSBvZiB0aGlzLm9sZENhY2hlKSB7CiAgICAgICAgICAgIGNvbnN0IFtrZXldID0gaXRlbTsKICAgICAgICAgICAgaWYgKCF0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgICAgeWllbGQgaXRlbTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBnZXQgc2l6ZSgpIHsKICAgICAgICAgIGxldCBvbGRDYWNoZVNpemUgPSAwOwogICAgICAgICAgZm9yIChjb25zdCBrZXkgb2YgdGhpcy5vbGRDYWNoZS5rZXlzKCkpIHsKICAgICAgICAgICAgaWYgKCF0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgICAgb2xkQ2FjaGVTaXplKys7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiB0aGlzLl9zaXplICsgb2xkQ2FjaGVTaXplOwogICAgICAgIH0KICAgICAgfTsKICAgICAgbW9kdWxlLmV4cG9ydHMgPSBRdWlja0xSVTM7CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9jcm9zcy1mZXRjaEAzLjEuOC9ub2RlX21vZHVsZXMvY3Jvc3MtZmV0Y2gvZG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uaXNQcm90b3R5cGVPZihvYmopOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHN1cHBvcnQuYXJyYXlCdWZmZXIpIHsKICAgICAgICAgICAgdmFyIHZpZXdDbGFzc2VzID0gWwogICAgICAgICAgICAgICJbb2JqZWN0IEludDhBcnJheV0iLAogICAgICAgICAgICAgICJbb2JqZWN0IFVpbnQ4QXJyYXldIiwKICAgICAgICAgICAgICAiW29iamVjdCBVaW50OENsYW1wZWRBcnJheV0iLAogICAgICAgICAgICAgICJbb2JqZWN0IEludDE2QXJyYXldIiwKICAgICAgICAgICAgICAiW29iamVjdCBVaW50MTZBcnJheV0iLAogICAgICAgICAgICAgICJbb2JqZWN0IEludDMyQXJyYXldIiwKICAgICAgICAgICAgICAiW29iamVjdCBVaW50MzJBcnJheV0iLAogICAgICAgICAgICAgICJbb2JqZWN0IEZsb2F0MzJBcnJheV0iLAogICAgICAgICAgICAgICJbb2JqZWN0IEZsb2F0NjRBcnJheV0iCiAgICAgICAgICAgIF07CiAgICAgICAgICAgIHZhciBpc0FycmF5QnVmZmVyVmlldyA9IEFycmF5QnVmZmVyLmlzVmlldyB8fCBmdW5jdGlvbihvYmopIHsKICAgICAgICAgICAgICByZXR1cm4gb2JqICYmIHZpZXdDbGFzc2VzLmluZGV4T2YoT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKG9iaikpID4gLTE7CiAgICAgICAgICAgIH07CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiBub3JtYWxpemVOYW1lKG5hbWUpIHsKICAgICAgICAgICAgaWYgKHR5cGVvZiBuYW1lICE9PSAic3RyaW5nIikgewogICAgICAgICAgICAgIG5hbWUgPSBTdHJpbmcobmFtZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKC9bXmEtejAtOVwtIyQlJicqKy5eX2B8fl0vaS50ZXN0KG5hbWUpKSB7CiAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiSW52YWxpZCBjaGFyYWN0ZXIgaW4gaGVhZGVyIGZpZWxkIG5hbWUiKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gbmFtZS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gbm9ybWFsaXplVmFsdWUodmFsdWUpIHsKICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSAhPT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICB2YWx1ZSA9IFN0cmluZyh2YWx1ZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHZhbHVlOwogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gaXRlcmF0b3JGb3IoaXRlbXMpIHsKICAgICAgICAgICAgdmFyIGl0ZXJhdG9yID0gewogICAgICAgICAgICAgIG5leHQ6IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gaXRlbXMuc2hpZnQoKTsKICAgICAgICAgICAgICAgIHJldHVybiB7IGRvbmU6IHZhbHVlID09PSB2b2lkIDAsIHZhbHVlIH07CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBpZiAoc3VwcG9ydC5pdGVyYWJsZSkgewogICAgICAgICAgICAgIGl0ZXJhdG9yW1N5bWJvbC5pdGVyYXRvcl0gPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHJldHVybiBpdGVyYXRvcjsKICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBpdGVyYXRvcjsKICAgICAgICAgIH0KICAgICAgICAgIGZ1bmN0aW9uIEhlYWRlcnMoaGVhZGVycykgewogICAgICAgICAgICB0aGlzLm1hcCA9IHt9OwogICAgICAgICAgICBpZiAoaGVhZGVycyBpbnN0YW5jZW9mIEhlYWRlcnMpIHsKICAgICAgICAgICAgICBoZWFkZXJzLmZvckVhY2goZnVuY3Rpb24odmFsdWUsIG5hbWUpIHsKICAgICAgICAgICAgICAgIHRoaXMuYXBwZW5kKG5hbWUsIHZhbHVlKTsKICAgICAgICAgICAgICB9LCB0aGlzKTsKICAgICAgICAgICAgfSBlbHNlIGlmIChBcnJheS5pc0FycmF5KGhlYWRlcnMpKSB7CiAgICAgICAgICAgICAgaGVhZGVycy5mb3JFYWNoKGZ1bmN0aW9uKGhlYWRlcikgewogICAgICAgICAgICAgICAgdGhpcy5hcHBlbmQoaGVhZGVyWzBdLCBoZWFkZXJbMV0pOwogICAgICAgICAgICAgIH0sIHRoaXMpOwogICAgICAgICAgICB9IGVsc2UgaWYgKGhlYWRlcnMpIHsKICAgICAgICAgICAgICBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyhoZWFkZXJzKS5mb3JFYWNoKGZ1bmN0aW9uKG5hbWUpIHsKICAgICAgICAgICAgICAgIHRoaXMuYXBwZW5kKG5hbWUsIGhlYWRlcnNbbmFtZV0pOwogICAgICAgICAgICAgIH0sIHRoaXMpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBIZWFkZXJzLnByb3RvdHlwZS5hcHBlbmQgPSBmdW5jdGlvbihuYW1lLCB2YWx1ZSkgewogICAgICAgICAgICBuYW1lID0gbm9ybWFsaXplTmFtZShuYW1lKTsKICAgICAgICAgICAgdmFsdWUgPSBub3JtYWxpemVWYWx1ZSh2YWx1ZSk7CiAgICAgICAgICAgIHZhciBvbGRWYWx1ZSA9IHRoaXMubWFwW25hbWVdOwogICAgICAgICAgICB0aGlzLm1hcFtuYW1lXSA9IG9sZFZhbHVlID8gb2xkVmFsdWUgKyAiLCAiICsgdmFsdWUgOiB2YWx1ZTsKICAgICAgICAgIH07CiAgICAgICAgICBIZWFkZXJzLnByb3RvdHlwZVsiZGVsZXRlIl0gPSBmdW5jdGlvbihuYW1lKSB7CiAgICAgICAgICAgIGRlbGV0ZSB0aGlzLm1hcFtub3JtYWxpemVOYW1lKG5hbWUpXTsKICAgICAgICAgIH07CiAgICAgICAgICBIZWFkZXJzLnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbihuYW1lKSB7CiAgICAgICAgICAgIG5hbWUgPSBub3JtYWxpemVOYW1lKG5hbWUpOwogICAgICAgICAgICByZXR1cm4gdGhpcy5oYXMobmFtZSkgPyB0aGlzLm1hcFtuYW1lXSA6IG51bGw7CiAgICAgICAgICB9OwogICAgICAgICAgSGVhZGVycy5wcm90b3R5cGUuaGFzID0gZnVuY3Rpb24obmFtZSkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5tYXAuaGFzT3duUHJvcGVydHkobm9ybWFsaXplTmFtZShuYW1lKSk7CiAgICAgICAgICB9OwogICAgICAgICAgSGVhZGVycy5wcm90b3R5cGUuc2V0ID0gZnVuY3Rpb24obmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgdGhpcy5tYXBbbm9ybWFsaXplTmFtZShuYW1lKV0gPSBub3JtYWxpemVWYWx1ZSh2YWx1ZSk7CiAgICAgICAgICB9OwogICAgICAgICAgSGVhZGVycy5wcm90b3R5cGUuZm9yRWFjaCA9IGZ1bmN0aW9uKGNhbGxiYWNrLCB0aGlzQXJnKSB7CiAgICAgICAgICAgIGZvciAodmFyIG5hbWUgaW4gdGhpcy5tYXApIHsKICAgICAgICAgICAgICBpZiAodGhpcy5tYXAuaGFzT3duUHJvcGVydHkobmFtZSkpIHsKICAgICAgICAgICAgICAgIGNhbGxiYWNrLmNhbGwodGhpc0FyZywgdGhpcy5tYXBbbmFtZV0sIG5hbWUsIHRoaXMpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfTsKICAgICAgICAgIEhlYWRlcnMucHJvdG90eXBlLmtleXMgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgdmFyIGl0ZW1zID0gW107CiAgICAgICAgICAgIHRoaXMuZm9yRWFjaChmdW5jdGlvbih2YWx1ZSwgbmFtZSkgewogICAgICAgICAgICAgIGl0ZW1zLnB1c2gobmFtZSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICByZXR1cm4gaXRlcmF0b3JGb3IoaXRlbXMpOwogICAgICAgICAgfTsKICAgICAgICAgIEhlYWRlcnMucHJvdG90eXBlLnZhbHVlcyA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICB2YXIgaXRlbXMgPSBbXTsKICAgICAgICAgICAgdGhpcy5mb3JFYWNoKGZ1bmN0aW9uKHZhbHVlKSB7CiAgICAgICAgICAgICAgaXRlbXMucHVzaCh2YWx1ZSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICByZXR1cm4gaXRlcmF0b3JGb3IoaXRlbXMpOwogICAgICAgICAgfTsKICAgICAgICAgIEhlYWRlcnMucHJvdG90eXBlLmVudHJpZXMgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgdmFyIGl0ZW1zID0gW107CiAgICAgICAgICAgIHRoaXMuZm9yRWFjaChmdW5jdGlvbih2YWx1ZSwgbmFtZSkgewogICAgICAgICAgICAgIGl0ZW1zLnB1c2goW25hbWUsIHZhbHVlXSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICByZXR1cm4gaXRlcmF0b3JGb3IoaXRlbXMpOwogICAgICAgICAgfTsKICAgICAgICAgIGlmIChzdXBwb3J0Lml0ZXJhYmxlKSB7CiAgICAgICAgICAgIEhlYWRlcnMucHJvdG90eXBlW1N5bWJvbC5pdGVyYXRvcl0gPSBIZWFkZXJzLnByb3RvdHlwZS5lbnRyaWVzOwogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gY29uc3VtZWQoYm9keSkgewogICAgICAgICAgICBpZiAoYm9keS5ib2R5VXNlZCkgewogICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChuZXcgVHlwZUVycm9yKCJBbHJlYWR5IHJlYWQiKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYm9keS5ib2R5VXNlZCA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiBmaWxlUmVhZGVyUmVhZHkocmVhZGVyKSB7CiAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgICAgICByZWFkZXIub25sb2FkID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXNvbHZlKHJlYWRlci5yZXN1bHQpOwogICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgcmVhZGVyLm9uZXJyb3IgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHJlamVjdChyZWFkZXIuZXJyb3IpOwogICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0pOwogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gcmVhZEJsb2JBc0FycmF5QnVmZmVyKGJsb2IpIHsKICAgICAgICAgICAgdmFyIHJlYWRlciA9IG5ldyBGaWxlUmVhZGVyKCk7CiAgICAgICAgICAgIHZhciBwcm9taXNlID0gZmlsZVJlYWRlclJlYWR5KHJlYWRlcik7CiAgICAgICAgICAgIHJlYWRlci5yZWFkQXNBcnJheUJ1ZmZlcihibG9iKTsKICAgICAgICAgICAgcmV0dXJuIHByb21pc2U7CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiByZWFkQmxvYkFzVGV4dChibG9iKSB7CiAgICAgICAgICAgIHZhciByZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpOwogICAgICAgICAgICB2YXIgcHJvbWlzZSA9IGZpbGVSZWFkZXJSZWFkeShyZWFkZXIpOwogICAgICAgICAgICByZWFkZXIucmVhZEFzVGV4dChibG9iKTsKICAgICAgICAgICAgcmV0dXJuIHByb21pc2U7CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiByZWFkQXJyYXlCdWZmZXJBc1RleHQoYnVmKSB7CiAgICAgICAgICAgIHZhciB2aWV3ID0gbmV3IFVpbnQ4QXJyYXkoYnVmKTsKICAgICAgICAgICAgdmFyIGNoYXJzID0gbmV3IEFycmF5KHZpZXcubGVuZ3RoKTsKICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCB2aWV3Lmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgY2hhcnNbaV0gPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHZpZXdbaV0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBjaGFycy5qb2luKCIiKTsKICAgICAgICAgIH0KICAgICAgICAgIGZ1bmN0aW9uIGJ1ZmZlckNsb25lKGJ1ZikgewogICAgICAgICAgICBpZiAoYnVmLnNsaWNlKSB7CiAgICAgICAgICAgICAgcmV0dXJuIGJ1Zi5zbGljZSgwKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICB2YXIgdmlldyA9IG5ldyBVaW50OEFycmF5KGJ1Zi5ieXRlTGVuZ3RoKTsKICAgICAgICAgICAgICB2aWV3LnNldChuZXcgVWludDhBcnJheShidWYpKTsKICAgICAgICAgICAgICByZXR1cm4gdmlldy5idWZmZXI7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGZ1bmN0aW9uIEJvZHkoKSB7CiAgICAgICAgICAgIHRoaXMuYm9keVVzZWQgPSBmYWxzZTsKICAgICAgICAgICAgdGhpcy5faW5pdEJvZHkgPSBmdW5jdGlvbihib2R5KSB7CiAgICAgICAgICAgICAgdGhpcy5fYm9keUluaXQgPSBib2R5OwogICAgICAgICAgICAgIGlmICghYm9keSkgewogICAgICAgICAgICAgICAgdGhpcy5fYm9keVRleHQgPSAiIjsKICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBib2R5ID09PSAic3RyaW5nIikgewogICAgICAgICAgICAgICAgdGhpcy5fYm9keVRleHQgPSBib2R5OwogICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3VwcG9ydC5ibG9iICYmIEJsb2IucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoYm9keSkpIHsKICAgICAgICAgICAgICAgIHRoaXMuX2JvZHlCbG9iID0gYm9keTsKICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN1cHBvcnQuZm9ybURhdGEgJiYgRm9ybURhdGEucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoYm9keSkpIHsKICAgICAgICAgICAgICAgIHRoaXMuX2JvZHlGb3JtRGF0YSA9IGJvZHk7CiAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdXBwb3J0LnNlYXJjaFBhcmFtcyAmJiBVUkxTZWFyY2hQYXJhbXMucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoYm9keSkpIHsKICAgICAgICAgICAgICAgIHRoaXMuX2JvZHlUZXh0ID0gYm9keS50b1N0cmluZygpOwogICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3VwcG9ydC5hcnJheUJ1ZmZlciAmJiBzdXBwb3J0LmJsb2IgJiYgaXNEYXRhVmlldyhib2R5KSkgewogICAgICAgICAgICAgICAgdGhpcy5fYm9keUFycmF5QnVmZmVyID0gYnVmZmVyQ2xvbmUoYm9keS5idWZmZXIpOwogICAgICAgICAgICAgICAgdGhpcy5fYm9keUluaXQgPSBuZXcgQmxvYihbdGhpcy5fYm9keUFycmF5QnVmZmVyXSk7CiAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdXBwb3J0LmFycmF5QnVmZmVyICYmIChBcnJheUJ1ZmZlci5wcm90b3R5cGUuaXNQcm90b3R5cGVPZihib2R5KSB8fCBpc0FycmF5QnVmZmVyVmlldyhib2R5KSkpIHsKICAgICAgICAgICAgICAgIHRoaXMuX2JvZHlBcnJheUJ1ZmZlciA9IGJ1ZmZlckNsb25lKGJvZHkpOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0aGlzLl9ib2R5VGV4dCA9IGJvZHkgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoYm9keSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmICghdGhpcy5oZWFkZXJzLmdldCgiY29udGVudC10eXBlIikpIHsKICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgYm9keSA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkZXJzLnNldCgiY29udGVudC10eXBlIiwgInRleHQvcGxhaW47Y2hhcnNldD1VVEYtOCIpOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0aGlzLl9ib2R5QmxvYiAmJiB0aGlzLl9ib2R5QmxvYi50eXBlKSB7CiAgICAgICAgICAgICAgICAgIHRoaXMuaGVhZGVycy5zZXQoImNvbnRlbnQtdHlwZSIsIHRoaXMuX2JvZHlCbG9iLnR5cGUpOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdXBwb3J0LnNlYXJjaFBhcmFtcyAmJiBVUkxTZWFyY2hQYXJhbXMucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoYm9keSkpIHsKICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkZXJzLnNldCgiY29udGVudC10eXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZDtjaGFyc2V0PVVURi04Iik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBpZiAoc3VwcG9ydC5ibG9iKSB7CiAgICAgICAgICAgICAgdGhpcy5ibG9iID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICB2YXIgcmVqZWN0ZWQgPSBjb25zdW1lZCh0aGlzKTsKICAgICAgICAgICAgICAgIGlmIChyZWplY3RlZCkgewogICAgICAgICAgICAgICAgICByZXR1cm4gcmVqZWN0ZWQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAodGhpcy5fYm9keUJsb2IpIHsKICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSh0aGlzLl9ib2R5QmxvYik7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuX2JvZHlBcnJheUJ1ZmZlcikgewogICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKG5ldyBCbG9iKFt0aGlzLl9ib2R5QXJyYXlCdWZmZXJdKSk7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuX2JvZHlGb3JtRGF0YSkgewogICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoImNvdWxkIG5vdCByZWFkIEZvcm1EYXRhIGJvZHkgYXMgYmxvYiIpOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShuZXcgQmxvYihbdGhpcy5fYm9keVRleHRdKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICB0aGlzLmFycmF5QnVmZmVyID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICBpZiAodGhpcy5fYm9keUFycmF5QnVmZmVyKSB7CiAgICAgICAgICAgICAgICAgIHJldHVybiBjb25zdW1lZCh0aGlzKSB8fCBQcm9taXNlLnJlc29sdmUodGhpcy5fYm9keUFycmF5QnVmZmVyKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmJsb2IoKS50aGVuKHJlYWRCbG9iQXNBcnJheUJ1ZmZlcik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnRleHQgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICB2YXIgcmVqZWN0ZWQgPSBjb25zdW1lZCh0aGlzKTsKICAgICAgICAgICAgICBpZiAocmVqZWN0ZWQpIHsKICAgICAgICAgICAgICAgIHJldHVybiByZWplY3RlZDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHRoaXMuX2JvZHlCbG9iKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gcmVhZEJsb2JBc1RleHQodGhpcy5fYm9keUJsb2IpOwogICAgICAgICAgICAgIH0gZWxzZSBpZiAodGhpcy5fYm9keUFycmF5QnVmZmVyKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKHJlYWRBcnJheUJ1ZmZlckFzVGV4dCh0aGlzLl9ib2R5QXJyYXlCdWZmZXIpKTsKICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuX2JvZHlGb3JtRGF0YSkgewogICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJjb3VsZCBub3QgcmVhZCBGb3JtRGF0YSBib2R5IGFzIHRleHQiKTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSh0aGlzLl9ib2R5VGV4dCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBpZiAoc3VwcG9ydC5mb3JtRGF0YSkgewogICAgICAgICAgICAgIHRoaXMuZm9ybURhdGEgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRleHQoKS50aGVuKGRlY29kZSk7CiAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLmpzb24gPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICByZXR1cm4gdGhpcy50ZXh0KCkudGhlbihKU09OLnBhcnNlKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICB9CiAgICAgICAgICB2YXIgbWV0aG9kcyA9IFsiREVMRVRFIiwgIkdFVCIsICJIRUFEIiwgIk9QVElPTlMiLCAiUE9TVCIsICJQVVQiXTsKICAgICAgICAgIGZ1bmN0aW9uIG5vcm1hbGl6ZU1ldGhvZChtZXRob2QpIHsKICAgICAgICAgICAgdmFyIHVwY2FzZWQgPSBtZXRob2QudG9VcHBlckNhc2UoKTsKICAgICAgICAgICAgcmV0dXJuIG1ldGhvZHMuaW5kZXhPZih1cGNhc2VkKSA+IC0xID8gdXBjYXNlZCA6IG1ldGhvZDsKICAgICAgICAgIH0KICAgICAgICAgIGZ1bmN0aW9uIFJlcXVlc3QoaW5wdXQsIG9wdGlvbnMpIHsKICAgICAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307CiAgICAgICAgICAgIHZhciBib2R5ID0gb3B0aW9ucy5ib2R5OwogICAgICAgICAgICBpZiAoaW5wdXQgaW5zdGFuY2VvZiBSZXF1ZXN0KSB7CiAgICAgICAgICAgICAgaWYgKGlucHV0LmJvZHlVc2VkKSB7CiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJBbHJlYWR5IHJlYWQiKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgdGhpcy51cmwgPSBpbnB1dC51cmw7CiAgICAgICAgICAgICAgdGhpcy5jcmVkZW50aWFscyA9IGlucHV0LmNyZWRlbnRpYWxzOwogICAgICAgICAgICAgIGlmICghb3B0aW9ucy5oZWFkZXJzKSB7CiAgICAgICAgICAgICAgICB0aGlzLmhlYWRlcnMgPSBuZXcgSGVhZGVycyhpbnB1dC5oZWFkZXJzKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgdGhpcy5tZXRob2QgPSBpbnB1dC5tZXRob2Q7CiAgICAgICAgICAgICAgdGhpcy5tb2RlID0gaW5wdXQubW9kZTsKICAgICAgICAgICAgICB0aGlzLnNpZ25hbCA9IGlucHV0LnNpZ25hbDsKICAgICAgICAgICAgICBpZiAoIWJvZHkgJiYgaW5wdXQuX2JvZHlJbml0ICE9IG51bGwpIHsKICAgICAgICAgICAgICAgIGJvZHkgPSBpbnB1dC5fYm9keUluaXQ7CiAgICAgICAgICAgICAgICBpbnB1dC5ib2R5VXNlZCA9IHRydWU7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHRoaXMudXJsID0gU3RyaW5nKGlucHV0KTsKICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLmNyZWRlbnRpYWxzID0gb3B0aW9ucy5jcmVkZW50aWFscyB8fCB0aGlzLmNyZWRlbnRpYWxzIHx8ICJzYW1lLW9yaWdpbiI7CiAgICAgICAgICAgIGlmIChvcHRpb25zLmhlYWRlcnMgfHwgIXRoaXMuaGVhZGVycykgewogICAgICAgICAgICAgIHRoaXMuaGVhZGVycyA9IG5ldyBIZWFkZXJzKG9wdGlvbnMuaGVhZGVycyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5tZXRob2QgPSBub3JtYWxpemVNZXRob2Qob3B0aW9ucy5tZXRob2QgfHwgdGhpcy5tZXRob2QgfHwgIkdFVCIpOwogICAgICAgICAgICB0aGlzLm1vZGUgPSBvcHRpb25zLm1vZGUgfHwgdGhpcy5tb2RlIHx8IG51bGw7CiAgICAgICAgICAgIHRoaXMuc2lnbmFsID0gb3B0aW9ucy5zaWduYWwgfHwgdGhpcy5zaWduYWw7CiAgICAgICAgICAgIHRoaXMucmVmZXJyZXIgPSBudWxsOwogICAgICAgICAgICBpZiAoKHRoaXMubWV0aG9kID09PSAiR0VUIiB8fCB0aGlzLm1ldGhvZCA9PT0gIkhFQUQiKSAmJiBib2R5KSB7CiAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiQm9keSBub3QgYWxsb3dlZCBmb3IgR0VUIG9yIEhFQUQgcmVxdWVzdHMiKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLl9pbml0Qm9keShib2R5KTsKICAgICAgICAgIH0KICAgICAgICAgIFJlcXVlc3QucHJvdG90eXBlLmNsb25lID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgIHJldHVybiBuZXcgUmVxdWVzdCh0aGlzLCB7IGJvZHk6IHRoaXMuX2JvZHlJbml0IH0pOwogICAgICAgICAgfTsKICAgICAgICAgIGZ1bmN0aW9uIGRlY29kZShib2R5KSB7CiAgICAgICAgICAgIHZhciBmb3JtID0gbmV3IEZvcm1EYXRhKCk7CiAgICAgICAgICAgIGJvZHkudHJpbSgpLnNwbGl0KCImIikuZm9yRWFjaChmdW5jdGlvbihieXRlcykgewogICAgICAgICAgICAgIGlmIChieXRlcykgewogICAgICAgICAgICAgICAgdmFyIHNwbGl0ID0gYnl0ZXMuc3BsaXQoIj0iKTsKICAgICAgICAgICAgICAgIHZhciBuYW1lID0gc3BsaXQuc2hpZnQoKS5yZXBsYWNlKC9cKy9nLCAiICIpOwogICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gc3BsaXQuam9pbigiPSIpLnJlcGxhY2UoL1wrL2csICIgIik7CiAgICAgICAgICAgICAgICBmb3JtLmFwcGVuZChkZWNvZGVVUklDb21wb25lbnQobmFtZSksIGRlY29kZVVSSUNvbXBvbmVudCh2YWx1ZSkpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHJldHVybiBmb3JtOwogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gcGFyc2VIZWFkZXJzKHJhd0hlYWRlcnMpIHsKICAgICAgICAgICAgdmFyIGhlYWRlcnMgPSBuZXcgSGVhZGVycygpOwogICAgICAgICAgICB2YXIgcHJlUHJvY2Vzc2VkSGVhZGVycyA9IHJhd0hlYWRlcnMucmVwbGFjZSgvXHI/XG5bXHQgXSsvZywgIiAiKTsKICAgICAgICAgICAgcHJlUHJvY2Vzc2VkSGVhZGVycy5zcGxpdCgvXHI/XG4vKS5mb3JFYWNoKGZ1bmN0aW9uKGxpbmUpIHsKICAgICAgICAgICAgICB2YXIgcGFydHMgPSBsaW5lLnNwbGl0KCI6Iik7CiAgICAgICAgICAgICAgdmFyIGtleSA9IHBhcnRzLnNoaWZ0KCkudHJpbSgpOwogICAgICAgICAgICAgIGlmIChrZXkpIHsKICAgICAgICAgICAgICAgIHZhciB2YWx1ZSA9IHBhcnRzLmpvaW4oIjoiKS50cmltKCk7CiAgICAgICAgICAgICAgICBoZWFkZXJzLmFwcGVuZChrZXksIHZhbHVlKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICByZXR1cm4gaGVhZGVyczsKICAgICAgICAgIH0KICAgICAgICAgIEJvZHkuY2FsbChSZXF1ZXN0LnByb3RvdHlwZSk7CiAgICAgICAgICBmdW5jdGlvbiBSZXNwb25zZShib2R5SW5pdCwgb3B0aW9ucykgewogICAgICAgICAgICBpZiAoIW9wdGlvbnMpIHsKICAgICAgICAgICAgICBvcHRpb25zID0ge307CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy50eXBlID0gImRlZmF1bHQiOwogICAgICAgICAgICB0aGlzLnN0YXR1cyA9IG9wdGlvbnMuc3RhdHVzID09PSB2b2lkIDAgPyAyMDAgOiBvcHRpb25zLnN0YXR1czsKICAgICAgICAgICAgdGhpcy5vayA9IHRoaXMuc3RhdHVzID49IDIwMCAmJiB0aGlzLnN0YXR1cyA8IDMwMDsKICAgICAgICAgICAgdGhpcy5zdGF0dXNUZXh0ID0gInN0YXR1c1RleHQiIGluIG9wdGlvbnMgPyBvcHRpb25zLnN0YXR1c1RleHQgOiAiT0siOwogICAgICAgICAgICB0aGlzLmhlYWRlcnMgPSBuZXcgSGVhZGVycyhvcHRpb25zLmhlYWRlcnMpOwogICAgICAgICAgICB0aGlzLnVybCA9IG9wdGlvbnMudXJsIHx8ICIiOwogICAgICAgICAgICB0aGlzLl9pbml0Qm9keShib2R5SW5pdCk7CiAgICAgICAgICB9CiAgICAgICAgICBCb2R5LmNhbGwoUmVzcG9uc2UucHJvdG90eXBlKTsKICAgICAgICAgIFJlc3BvbnNlLnByb3RvdHlwZS5jbG9uZSA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICByZXR1cm4gbmV3IFJlc3BvbnNlKHRoaXMuX2JvZHlJbml0LCB7CiAgICAgICAgICAgICAgc3RhdHVzOiB0aGlzLnN0YXR1cywKICAgICAgICAgICAgICBzdGF0dXNUZXh0OiB0aGlzLnN0YXR1c1RleHQsCiAgICAgICAgICAgICAgaGVhZGVyczogbmV3IEhlYWRlcnModGhpcy5oZWFkZXJzKSwKICAgICAgICAgICAgICB1cmw6IHRoaXMudXJsCiAgICAgICAgICAgIH0pOwogICAgICAgICAgfTsKICAgICAgICAgIFJlc3BvbnNlLmVycm9yID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgIHZhciByZXNwb25zZSA9IG5ldyBSZXNwb25zZShudWxsLCB7IHN0YXR1czogMCwgc3RhdHVzVGV4dDogIiIgfSk7CiAgICAgICAgICAgIHJlc3BvbnNlLnR5cGUgPSAiZXJyb3IiOwogICAgICAgICAgICByZXR1cm4gcmVzcG9uc2U7CiAgICAgICAgICB9OwogICAgICAgICAgdmFyIHJlZGlyZWN0U3RhdHVzZXMgPSBbMzAxLCAzMDIsIDMwMywgMzA3LCAzMDhdOwogICAgICAgICAgUmVzcG9uc2UucmVkaXJlY3QgPSBmdW5jdGlvbih1cmwsIHN0YXR1cykgewogICAgICAgICAgICBpZiAocmVkaXJlY3RTdGF0dXNlcy5pbmRleE9mKHN0YXR1cykgPT09IC0xKSB7CiAgICAgICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkludmFsaWQgc3RhdHVzIGNvZGUiKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gbmV3IFJlc3BvbnNlKG51bGwsIHsgc3RhdHVzLCBoZWFkZXJzOiB7IGxvY2F0aW9uOiB1cmwgfSB9KTsKICAgICAgICAgIH07CiAgICAgICAgICBleHBvcnRzMi5ET01FeGNlcHRpb24gPSBzZWxmMi5ET01FeGNlcHRpb247CiAgICAgICAgICB0cnkgewogICAgICAgICAgICBuZXcgZXhwb3J0czIuRE9NRXhjZXB0aW9uKCk7CiAgICAgICAgICB9IGNhdGNoIChlcnIpIHsKICAgICAgICAgICAgZXhwb3J0czIuRE9NRXhjZXB0aW9uID0gZnVuY3Rpb24obWVzc2FnZSwgbmFtZSkgewogICAgICAgICAgICAgIHRoaXMubWVzc2FnZSA9IG1lc3NhZ2U7CiAgICAgICAgICAgICAgdGhpcy5uYW1lID0gbmFtZTsKICAgICAgICAgICAgICB2YXIgZXJyb3IgPSBFcnJvcihtZXNzYWdlKTsKICAgICAgICAgICAgICB0aGlzLnN0YWNrID0gZXJyb3Iuc3RhY2s7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGV4cG9ydHMyLkRPTUV4Y2VwdGlvbi5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKEVycm9yLnByb3RvdHlwZSk7CiAgICAgICAgICAgIGV4cG9ydHMyLkRPTUV4Y2VwdGlvbi5wcm90b3R5cGUuY29uc3RydWN0b3IgPSBleHBvcnRzMi5ET01FeGNlcHRpb247CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiBmZXRjaDIoaW5wdXQsIGluaXQyKSB7CiAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgICAgICB2YXIgcmVxdWVzdCA9IG5ldyBSZXF1ZXN0KGlucHV0LCBpbml0Mik7CiAgICAgICAgICAgICAgaWYgKHJlcXVlc3Quc2lnbmFsICYmIHJlcXVlc3Quc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICAgIHJldHVybiByZWplY3QobmV3IGV4cG9ydHMyLkRPTUV4Y2VwdGlvbigiQWJvcnRlZCIsICJBYm9ydEVycm9yIikpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB2YXIgeGhyID0gbmV3IFhNTEh0dHBSZXF1ZXN0KCk7CiAgICAgICAgICAgICAgZnVuY3Rpb24gYWJvcnRYaHIoKSB7CiAgICAgICAgICAgICAgICB4aHIuYWJvcnQoKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgeGhyLm9ubG9hZCA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgdmFyIG9wdGlvbnMgPSB7CiAgICAgICAgICAgICAgICAgIHN0YXR1czogeGhyLnN0YXR1cywKICAgICAgICAgICAgICAgICAgc3RhdHVzVGV4dDogeGhyLnN0YXR1c1RleHQsCiAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHBhcnNlSGVhZGVycyh4aHIuZ2V0QWxsUmVzcG9uc2VIZWFkZXJzKCkgfHwgIiIpCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgb3B0aW9ucy51cmwgPSAicmVzcG9uc2VVUkwiIGluIHhociA/IHhoci5yZXNwb25zZVVSTCA6IG9wdGlvbnMuaGVhZGVycy5nZXQoIlgtUmVxdWVzdC1VUkwiKTsKICAgICAgICAgICAgICAgIHZhciBib2R5ID0gInJlc3BvbnNlIiBpbiB4aHIgPyB4aHIucmVzcG9uc2UgOiB4aHIucmVzcG9uc2VUZXh0OwogICAgICAgICAgICAgICAgcmVzb2x2ZShuZXcgUmVzcG9uc2UoYm9keSwgb3B0aW9ucykpOwogICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgeGhyLm9uZXJyb3IgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHJlamVjdChuZXcgVHlwZUVycm9yKCJOZXR3b3JrIHJlcXVlc3QgZmFpbGVkIikpOwogICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgeGhyLm9udGltZW91dCA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgcmVqZWN0KG5ldyBUeXBlRXJyb3IoIk5ldHdvcmsgcmVxdWVzdCBmYWlsZWQiKSk7CiAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICB4aHIub25hYm9ydCA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgcmVqZWN0KG5ldyBleHBvcnRzMi5ET01FeGNlcHRpb24oIkFib3J0ZWQiLCAiQWJvcnRFcnJvciIpKTsKICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgIHhoci5vcGVuKHJlcXVlc3QubWV0aG9kLCByZXF1ZXN0LnVybCwgdHJ1ZSk7CiAgICAgICAgICAgICAgaWYgKHJlcXVlc3QuY3JlZGVudGlhbHMgPT09ICJpbmNsdWRlIikgewogICAgICAgICAgICAgICAgeGhyLndpdGhDcmVkZW50aWFscyA9IHRydWU7CiAgICAgICAgICAgICAgfSBlbHNlIGlmIChyZXF1ZXN0LmNyZWRlbnRpYWxzID09PSAib21pdCIpIHsKICAgICAgICAgICAgICAgIHhoci53aXRoQ3JlZGVudGlhbHMgPSBmYWxzZTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKCJyZXNwb25zZVR5cGUiIGluIHhociAmJiBzdXBwb3J0LmJsb2IpIHsKICAgICAgICAgICAgICAgIHhoci5yZXNwb25zZVR5cGUgPSAiYmxvYiI7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHJlcXVlc3QuaGVhZGVycy5mb3JFYWNoKGZ1bmN0aW9uKHZhbHVlLCBuYW1lKSB7CiAgICAgICAgICAgICAgICB4aHIuc2V0UmVxdWVzdEhlYWRlcihuYW1lLCB2YWx1ZSk7CiAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgaWYgKHJlcXVlc3Quc2lnbmFsKSB7CiAgICAgICAgICAgICAgICByZXF1ZXN0LnNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsIGFib3J0WGhyKTsKICAgICAgICAgICAgICAgIHhoci5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICAgaWYgKHhoci5yZWFkeVN0YXRlID09PSA0KSB7CiAgICAgICAgICAgICAgICAgICAgcmVxdWVzdC5zaWduYWwucmVtb3ZlRXZlbnRMaXN0ZW5lcigiYWJvcnQiLCBhYm9ydFhocik7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHhoci5zZW5kKHR5cGVvZiByZXF1ZXN0Ll9ib2R5SW5p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ByZXR1cm4gY2h1bmsyLm1pbnYuYmxvY2tQb3NpdGlvbiAtIGNodW5rMS5tYXh2LmJsb2NrUG9zaXRpb24gPCA2NWUzICYmIGNodW5rMi5tYXh2LmJsb2NrUG9zaXRpb24gLSBjaHVuazEubWludi5ibG9ja1Bvc2l0aW9uIDwgNWU2OwogIH0KICBmdW5jdGlvbiBtYWtlT3B0cyhvYmogPSB7fSkgewogICAgcmV0dXJuICJhYm9ydGVkIiBpbiBvYmogPyB7IHNpZ25hbDogb2JqIH0gOiBvYmo7CiAgfQogIGZ1bmN0aW9uIG9wdGltaXplQ2h1bmtzKGNodW5rcywgbG93ZXN0KSB7CiAgICBjb25zdCBtZXJnZWRDaHVua3MgPSBbXTsKICAgIGxldCBsYXN0Q2h1bmsgPSBudWxsOwogICAgaWYgKGNodW5rcy5sZW5ndGggPT09IDApIHsKICAgICAgcmV0dXJuIGNodW5rczsKICAgIH0KICAgIGNodW5rcy5zb3J0KChjMCwgYzEpID0+IHsKICAgICAgY29uc3QgZGlmID0gYzAubWludi5ibG9ja1Bvc2l0aW9uIC0gYzEubWludi5ibG9ja1Bvc2l0aW9uOwogICAgICBpZiAoZGlmICE9PSAwKSB7CiAgICAgICAgcmV0dXJuIGRpZjsKICAgICAgfSBlbHNlIHsKICAgICAgICByZXR1cm4gYzAubWludi5kYXRhUG9zaXRpb24gLSBjMS5taW52LmRhdGFQb3NpdGlvbjsKICAgICAgfQogICAgfSk7CiAgICBjaHVua3MuZm9yRWFjaCgoY2h1bmspID0+IHsKICAgICAgaWYgKCFsb3dlc3QgfHwgY2h1bmsubWF4di5jb21wYXJlVG8obG93ZXN0KSA+IDApIHsKICAgICAgICBpZiAobGFzdENodW5rID09PSBudWxsKSB7CiAgICAgICAgICBtZXJnZWRDaHVua3MucHVzaChjaHVuayk7CiAgICAgICAgICBsYXN0Q2h1bmsgPSBjaHVuazsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKGNhbk1lcmdlQmxvY2tzKGxhc3R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HJvbSA9IGF3YWl0IHRoaXMucGFyc2Uob3B0cyk7CiAgICAgIGNvbnN0IGluZGV4ID0gcHJvbS5pbmRpY2VzW3JlZklkXTsKICAgICAgaWYgKCFpbmRleCkgewogICAgICAgIHJldHVybiAtMTsKICAgICAgfQogICAgICBjb25zdCByZXQgPSBpbmRleC5zdGF0cyB8fCB7fTsKICAgICAgcmV0dXJuIHJldC5saW5lQ291bnQgPT09IHZvaWQgMCA/IC0xIDogcmV0LmxpbmVDb3VudDsKICAgIH0KICAgIGZldGNoQmFpKG9wdHMgPSB7fSkgewogICAgICBpZiAoIXRoaXMuYmFpUCkgewogICAgICAgIHRoaXMuYmFpUCA9IHRoaXMuZmlsZWhhbmRsZS5yZWFkRmlsZShvcHRzKS5jYXRjaCgoZSkgPT4gewogICAgICAgICAgdGhpcy5iYWlQID0gdm9pZCAwOwogICAgICAgICAgdGhyb3cgZTsKICAgICAgICB9KTsKICAgICAgfQogICAgICByZXR1cm4gdGhpcy5iYWlQOwogICAgfQogICAgYXN5bmMgX3BhcnNlKCkgewogICAgICBjb25zdCBkYXRhID0geyBiYWk6IHRydWUsIG1heEJsb2NrU2l6ZTogMSA8PCAxNiB9OwogICAgICBjb25zdCBieXRlcyA9IGF3YWl0IHRoaXMuZmV0Y2hCYWkoKTsKICAgICAgaWYgKGJ5dGVzLnJlYWRVSW50MzJMRSgwKSAhPT0gQkFJX01BR0lDKSB7CiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJOb3QgYSBCQUkgZmlsZSIpOwogICAgICB9CiAgICAgIGRhdGEucmVmQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRSg0KTsKICAgICAgY29uc3QgZGVwdGggPSA1OwogICAgICBjb25zdCBiaW5MaW1pdCA9ICgoMSA8PCAoZGVwdGggKyAxKSAqIDMpIC0gMSkgLyA3OwogICAgICBkYXRhLmluZGljZXMgPSBuZXcgQXJyYXkoZGF0YS5yZWZDb3VudCk7CiAgICAgIGxldCBjdXJyT2Zmc2V0ID0gODsKICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBkYXRhLnJlZkNvdW50OyBpICs9IDEpIHsKICAgICAgICBjb25zdCBiaW5Db3VudCA9IGJ5dGVzLnJlYWRJbnQzMkxFKGN1cnJPZmZzZXQpOwogICAgICAgIGxldCBzdGF0czsKICAgICAgICBjdXJyT2Zmc2V0ICs9IDQ7CiAgICAgICAgY29uc3QgYmluSW5kZXggPSB7fTsKICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGJpbkNvdW50OyBqICs9IDEpIHsKICAgICAgICAgIGNvbnN0IGJpbiA9IGJ5dGVzLnJlYWRVSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgIGN1cnJPZmZzZXQgKz0gNDsKICAgICAgICAgIGlmIChiaW4gPT09IGJpbkxpbWl0ICsgMSkgewogICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDQ7CiAgICAgICAgICAgIHN0YXRzID0gdGhpcy5wYXJzZVBzZXVkb0JpbihieXRlcywgY3Vyck9mZnNldCk7CiAgICAgICAgICAgIGN1cnJPZmZzZXQgKz0gMzI7CiAgICAgICAgICB9IGVsc2UgaWYgKGJpbiA+IGJpbkxpbWl0ICsgMSkgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoImJhaSBpbmRleCBjb250YWlucyB0b28gbWFueSBiaW5zLCBwbGVhc2UgdXNlIENTSSIpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgY29uc3QgY2h1bmtDb3VudCA9IGJ5dGVzLnJlYWRJbnQzMkxFKGN1cnJPZmZzZXQpOwogICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDQ7CiAgICAgICAgICAgIGNvbnN0IGNodW5rcyA9IG5ldyBBcnJheShjaHVua0NvdW50KTsKICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBjaHVua0NvdW50OyBrICs9IDEpIHsKICAgICAgICAgICAgICBjb25zdCB1ID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgICBjb25zdCB2ID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0ICsgOCk7CiAgICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNjsKICAgICAgICAgICAgICB0aGlzLl9maW5kRmlyc3REYXRhKGRhdGEsIHUpOwogICAgICAgICAgICAgIGNodW5rc1trXSA9IG5ldyBDaHVuayh1LCB2LCBiaW4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGJpbkluZGV4W2Jpbl0gPSBjaHVua3M7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNvbnN0IGxpbmVhckNvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCk7CiAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgIGNvbnN0IGxpbmVhckluZGV4ID0gbmV3IEFycmF5KGxpbmVhckNvdW50KTsKICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGxpbmVhckNvdW50OyBrICs9IDEpIHsKICAgICAgICAgIGxpbmVhckluZGV4W2tdID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0KTsKICAgICAgICAgIGN1cnJPZmZzZXQgKz0gODsKICAgICAgICAgIHRoaXMuX2ZpbmRGaXJzdERhdGEoZGF0YSwgbGluZWFySW5kZXhba10pOwogICAgICAgIH0KICAgICAgICBkYXRhLmluZGljZXNbaV0gPSB7IGJpbkluZGV4LCBsaW5lYXJJbmRleCwgc3RhdHMgfTsKICAgICAgfQogICAgICByZXR1cm4gZGF0YTsKICAgIH0KICAgIGFzeW5jIGluZGV4Q292KHNlcUlkLCBzdGFydCwgZW5kLCBvcHRzID0ge30pIHsKICAgICAgY29uc3QgdiA9IDE2Mzg0OwogICAgICBjb25zdCByYW5nZSA9IHN0YXJ0ICE9PSB2b2lkIDA7CiAgICAgIGNvbnN0IGluZGV4RGF0YSA9IGF3YWl0IHRoaXMucGFyc2Uob3B0cyk7CiAgICAgIGNvbnN0IHNlcUlkeCA9IGluZGV4RGF0YS5pbmRpY2VzW3NlcUlkXTsKICAgICAgaWYgKCFzZXFJZHgpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3QgeyBsaW5lYXJJbmRleCA9IFtdLCBzdGF0cyB9ID0gc2VxSWR4OwogICAgICBpZiAoIWxpbmVhckluZGV4Lmxlbmd0aCkgewogICAgICAgIHJldHVybiBbXTsKICAgICAgfQogICAgICBjb25zdCBlID0gZW5kICE9PSB2b2lkIDAgPyByb3VuZFVwKGVuZCwgdikgOiAobGluZWFySW5kZXgubGVuZ3RoIC0gMSkgKiB2OwogICAgICBjb25zdCBzID0gc3RhcnQgIT09IHZvaWQgMCA/IHJvdW5kRG93bihzdGFydCwgdikgOiAwOwogICAgICBsZXQgZGVwdGhzOwogICAgICBpZiAocmFuZ2UpIHsKICAgICAgICBkZXB0aHMgPSBuZXcgQXJyYXkoKGUgLSBzKSAvIHYpOwogICAgICB9IGVsc2UgewogICAgICAgIGRlcHRocyA9IG5ldyBBcnJheShsaW5lYXJJbmRleC5sZW5ndGggLSAxKTsKICAgICAgfQogICAgICBjb25zdCB0b3RhbFNpemUgPSBsaW5lYXJJbmRleFtsaW5lYXJJbmRleC5sZW5ndGggLSAxXS5ibG9ja1Bvc2l0aW9uOwogICAgICBpZiAoZSA+IChsaW5lYXJJbmRleC5sZW5ndGggLSAxKSAqIHYpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoInF1ZXJ5IG91dHNpZGUgb2YgcmFuZ2Ugb2YgbGluZWFyIGluZGV4Iik7CiAgICAgIH0KICAgICAgbGV0IGN1cnJlbnRQb3MgPSBsaW5lYXJJbmRleFtzIC8gdl0uYmxvY2tQb3NpdGlvbjsKICAgICAgZm9yIChsZXQgaSA9IHMgLyB2LCBqID0gMDsgaSA8IGUgLyB2OyBpKyssIGorKykgewogICAgICAgIGRlcHRoc1tqXSA9IHsKICAgICAgICAgIHNjb3JlOiBsaW5lYXJJbmRleFtpICsgMV0uYmxvY2tQb3NpdGlvbiAtIGN1cnJlbnRQb3MsCiAgICAgICAgICBzdGFydDogaSAqIHYsCiAgICAgICAgICBlbmQ6IGkgKiB2ICsgdgogICAgICAgIH07CiAgICAgICAgY3VycmVudFBvcyA9IGxpbmVhckluZGV4W2kgKyAxXS5ibG9ja1Bvc2l0aW9uOwogICAgICB9CiAgICAgIHJldHVybiBkZXB0aHMubWFwKChkKSA9PiB7CiAgICAgICAgcmV0dXJuIHsgLi4uZCwgc2NvcmU6IGQuc2NvcmUgKiBzdGF0cy5saW5lQ291bnQgLyB0b3RhbFNpemUgfTsKICAgICAgfSk7CiAgICB9CiAgICByZWcyYmlucyhiZWcsIGVuZCkgewogICAgICBlbmQgLT0gMTsKICAgICAgcmV0dXJuIFsKICAgICAgICBbMCwgMF0sCiAgICAgICAgWzEgKyAoYmVnID4+IDI2KSwgMSArIChlbmQgPj4gMjYpXSwKICAgICAgICBbOSArIChiZWcgPj4gMjMpLCA5ICsgKGVuZCA+PiAyMyldLAogICAgICAgIFs3MyArIChiZWcgPj4gMjApLCA3MyArIChlbmQgPj4gMjApXSwKICAgICAgICBbNTg1ICsgKGJlZyA+PiAxNyksIDU4NSArIChlbmQgPj4gMTcpXSwKICAgICAgICBbNDY4MSArIChiZWcgPj4gMTQpLCA0NjgxICsgKGVuZCA+PiAxNCldCiAgICAgIF07CiAgICB9CiAgICBhc3luYyBibG9ja3NGb3JSYW5nZShyZWZJZCwgbWluLCBtYXgsIG9wdHMgPSB7fSkgewogICAgICBpZiAobWluIDwgMCkgewogICAgICAgIG1pbiA9IDA7CiAgICAgIH0KICAgICAgY29uc3QgaW5kZXhEYXRhID0gYXdhaXQgdGhpcy5wYXJzZShvcHRzKTsKICAgICAgaWYgKCFpbmRleERhdGEpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3QgYmEgPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmICghYmEpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3Qgb3ZlcmxhcHBpbmdCaW5zID0gdGhpcy5yZWcyYmlucyhtaW4sIG1heCk7CiAgICAgIGNvbnN0IGNodW5rcyA9IFtdOwogICAgICBmb3IgKGNvbnN0IFtzdGFydCwgZW5kXSBvZiBvdmVybGFwcGluZ0JpbnMpIHsKICAgICAgICBmb3IgKGxldCBiaW4gPSBzdGFydDsgYmluIDw9IGVuZDsgYmluKyspIHsKICAgICAgICAgIGlmIChiYS5iaW5JbmRleFtiaW5dKSB7CiAgICAgICAgICAgIGNvbnN0IGJpbkNodW5rcyA9IGJhLmJpbkluZGV4W2Jpbl07CiAgICAgICAgICAgIGZvciAobGV0IGMgPSAwOyBjIDwgYmluQ2h1bmtzLmxlbmd0aDsgKytjKSB7CiAgICAgICAgICAgICAgY2h1bmtzLnB1c2gobmV3IENodW5rKGJpbkNodW5rc1tjXS5taW52LCBiaW5DaHVua3NbY10ubWF4diwgYmluKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgY29uc3QgbmludHYgPSBiYS5saW5lYXJJbmRleC5sZW5ndGg7CiAgICAgIGxldCBsb3dlc3QgPSBudWxsOwogICAgICBjb25zdCBtaW5MaW4gPSBNYXRoLm1pbihtaW4gPj4gMTQsIG5pbnR2IC0gMSk7CiAgICAgIGNvbnN0IG1heExpbiA9IE1hdGgubWluKG1heCA+PiAxNCwgbmludHYgLSAxKTsKICAgICAgZm9yIChsZXQgaSA9IG1pbkxpbjsgaSA8PSBtYXhMaW47ICsraSkgewogICAgICAgIGNvbnN0IHZwID0gYmEubGluZWFySW5kZXhbaV07CiAgICAgICAgaWYgKHZwKSB7CiAgICAgICAgICBpZiAoIWxvd2VzdCB8fCB2cC5jb21wYXJlVG8obG93ZXN0KSA8IDApIHsKICAgICAgICAgICAgbG93ZXN0ID0gdnA7CiAgICAgICAgICB9Ci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9wdHMub3ZlcnJpZGVzKSB7CiAgICAgICAgdGhpcy5iYXNlT3ZlcnJpZGVzID0gb3B0cy5vdmVycmlkZXM7CiAgICAgIH0KICAgICAgdGhpcy5mZXRjaEltcGxlbWVudGF0aW9uID0gZmV0Y2gyOwogICAgfQogICAgYXN5bmMgZmV0Y2goaW5wdXQsIGluaXQyKSB7CiAgICAgIGxldCByZXNwb25zZTsKICAgICAgdHJ5IHsKICAgICAgICByZXNwb25zZSA9IGF3YWl0IHRoaXMuZmV0Y2hJbXBsZW1lbnRhdGlvbihpbnB1dCwgaW5pdDIpOwogICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgaWYgKGAke2V9YC5pbmNsdWRlcygiRmFpbGVkIHRvIGZldGNoIikpIHsKICAgICAgICAgIGNvbnNvbGUud2FybihgZ2VuZXJpYy1maWxlaGFuZGxlOiByZWZldGNoaW5nICR7aW5wdXR9IHRvIGF0dGVtcHQgdG8gd29yayBhcm91bmQgY2hyb21lIENPUlMgaGVhZGVyIGNhY2hpbmcgYnVnYCk7CiAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IHRoaXMuZmV0Y2hJbXBsZW1lbnRhdGlvbihpbnB1dCwgewogICAgICAgICAgICAuLi5pbml0MiwKICAgICAgICAgICAgY2FjaGU6ICJyZWxvYWQiCiAgICAgICAgICB9KTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdGhyb3cgZTsKICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIHJlc3BvbnNlOwogICAgfQogICAgYXN5bmMgcmVhZChidWZmZXIsIG9mZnNldCA9IDAsIGxlbmd0aCwgcG9zaXRpb24gPSAwLCBvcHRzID0ge30pIHsKICAgICAgY29uc3QgeyBoZWFkZXJzID0ge30sIHNpZ25hbCwgb3ZlcnJpZGVzID0ge30gfSA9IG9wdHM7CiAgICAgIGlmIChsZW5ndGggPCBJbmZpbml0eSkgewogICAgICAgIGhlYWRlcnMucmFuZ2UgPSBgYnl0ZXM9JHtwb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IH0gPSBvcHRzOwogICAgICBjb25zdCBhcmdzID0gewogICAgICAgIGhlYWRlcnMsCiAgICAgICAgbWV0aG9kOiAiR0VUIiwKICAgICAgICByZWRpcmVjdDogImZvbGxvdyIsCiAgICAgICAgbW9kZTogImNvcnMiLAogICAgICAgIHNpZ25hbCwKICAgICAgICAuLi50aGlzLmJhc2VPdmVycmlkZXMsCiAgICAgICAgLi4ub3ZlcnJpZGVzCiAgICAgIH07CiAgICAgIGNvbnN0IHJlc3BvbnNlID0gYXdhaXQgdGhpcy5mZXRjaCh0aGlzLnVybCwgYXJncyk7CiAgICAgIGlmICghcmVzcG9uc2UpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoImdlbmVyaWMtZmlsZWhhbmRsZSBmYWlsZWQgdG8gZmV0Y2giKTsKICAgICAgfQogICAgICBpZiAocmVzcG9uc2Uuc3RhdHVzICE9PSAyMDApIHsKICAgICAgICB0aHJvdyBPYmplY3QuYXNzaWduKG5ldyBFcnJvcihgSFRUUCAke3Jlc3BvbnNlLnN0YXR1c30gZmV0Y2hpbmcgJHt0aGlzLnVybH1gKSwgewogICAgICAgICAgc3RhdHVzOiByZXNwb25zZS5zdGF0dXMKICAgICAgICB9KTsKICAgICAgfQogICAgICBpZiAoZW5jb2RpbmcgPT09ICJ1dGY4IikgewogICAgICAgIHJldHVybiByZXNwb25zZS50ZXh0KCk7CiAgICAgIH0KICAgICAgaWYgKGVuY29kaW5nKSB7CiAgICAgICAgdGhyb3cgbmV3IEVycm9yKGB1bnN1cHBvcnRlZCBlbmNvZGluZzogJHtlbmNvZGluZ31gKTsKICAgICAgfQogICAgICByZXR1cm4gdGhpcy5nZXRCdWZmZXJGcm9tUmVzcG9uc2UocmVzcG9uc2UpOwogICAgfQogICAgYXN5bmMgc3RhdCgpIHsKICAgICAgaWYgKCF0aGlzLl9zdGF0KSB7CiAgICAgICAgY29uc3QgYnVmID0gaW1wb3J0X2J1ZmZlcjIuQnVmZmVyLmFsbG9jVW5zYWZ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nkgewogICAgICBsZXQgc3RybTsKICAgICAgbGV0IHBvcyA9IDA7CiAgICAgIGxldCBpID0gMDsKICAgICAgY29uc3QgY2h1bmtzID0gW107CiAgICAgIGxldCB0b3RhbFNpemUgPSAwOwogICAgICBsZXQgaW5mbGF0b3I7CiAgICAgIGRvIHsKICAgICAgICBjb25zdCByZW1haW5pbmdJbnB1dCA9IGlucHV0RGF0YS5zdWJhcnJheShwb3MpOwogICAgICAgIGluZmxhdG9yID0gbmV3IGltcG9ydF9wYWtvLkluZmxhdGUoKTsKICAgICAgICAoeyBzdHJtIH0gPSBpbmZsYXRvcik7CiAgICAgICAgaW5mbGF0b3IucHVzaChyZW1haW5pbmdJbnB1dCwgaW1wb3J0X3Bha28uWl9TWU5DX0ZMVVNIKTsKICAgICAgICBpZiAoaW5mbGF0b3IuZXJyKSB7CiAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoaW5mbGF0b3IubXNnKTsKICAgICAgICB9CiAgICAgICAgcG9zICs9IHN0cm0ubmV4dF9pbjsKICAgICAgICBjaHVua3NbaV0gPSBpbmZsYXRvci5yZXN1bHQ7CiAgICAgICAgdG90YWxTaXplICs9IGNodW5rc1tpXS5sZW5ndGg7CiAgICAgICAgaSArPSAxOwogICAgICB9IHdoaWxlIChzdHJtLmF2YWlsX2luKTsKICAgICAgY29uc3QgcmVzdWx0ID0gbmV3IFVpbnQ4QXJyYXkodG90YWxTaXplKTsKICAgICAgZm9yIChsZXQgaTIgPSAwLCBvZmZzZXQgPSAwOyBpMiA8IGNodW5rcy5sZW5ndGg7IGkyKyspIHsKICAgICAgICByZXN1bHQuc2V0KGNodW5rc1tpMl0sIG9mZnNldCk7CiAgICAgICAgb2Zmc2V0ICs9IGNodW5rc1tpMl0ubGVuZ3RoOwogICAgICB9CiAgICAgIHJldHVybiBpbXBvcnRfYnVmZmVyNC5CdWZmZXIuZnJvbShyZXN1bHQpOwogICAgfSBjYXRjaCAoZSkgewogICAgICBpZiAoYCR7ZX1gLm1hd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DIgKiogYml0czsKICB9CiAgZnVuY3Rpb24gcnNoaWZ0KG51bSwgYml0cykgewogICAgcmV0dXJuIE1hdGguZmxvb3IobnVtIC8gMiAqKiBiaXRzKTsKICB9CiAgdmFyIENTSSA9IGNsYXNzIGV4dGVuZHMgSW5kZXhGaWxlIHsKICAgIGNvbnN0cnVjdG9yKGFyZ3MpIHsKICAgICAgc3VwZXIoYXJncyk7CiAgICAgIHRoaXMubWF4QmluTnVtYmVyID0gMDsKICAgICAgdGhpcy5kZXB0aCA9IDA7CiAgICAgIHRoaXMubWluU2hpZnQgPSAwOwogICAgfQogICAgYXN5bmMgbGluZUNvdW50KHJlZklkKSB7CiAgICAgIGNvbnN0IGluZGV4RGF0YSA9IGF3YWl0IHRoaXMucGFyc2UoKTsKICAgICAgaWYgKCFpbmRleERhdGEpIHsKICAgICAgICByZXR1cm4gLTE7CiAgICAgIH0KICAgICAgY29uc3QgaWR4ID0gaW5kZXhEYXRhLmluZGljZXNbcmVmSWRdOwogICAgICBpZiAoIWlkeCkgewogICAgICAgIHJldHVybiAtMTsKICAgICAgfQogICAgICBjb25zdCB7IHN0YXRzIH0gPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmIChzdGF0cykgewogICAgICAgIHJldHVybiBzdGF0cy5saW5lQ291bnQ7CiAgICAgIH0KICAgICAgcmV0dXJuIC0xOwogICAgfQogICAgYXN5bmMgaW5kZXhDb3YoKSB7CiAgICAgIHJldHVybiBbXTsKICAgIH0KICAgIHBhcnNlQXV4RGF0YShieXRlcywgb2Zmc2V0LCBhdXhMZW5ndGgpIHsKICAgICAgaWYgKGF1eExlbmd0aCA8IDMwKSB7CiAgICAgICAgcmV0dXJuIHt9OwogICAgICB9CiAgICAgIGNvbnN0IGRhdGEgPSB7fTsKICAgICAgZGF0YS5mb3JtYXRGbGFncyA9IGJ5dGVzLnJlYWRJbnQzMkxFKG9mZnNldCk7CiAgICAgIGRhdGEuY29vcmRpbmF0ZVR5cGUgP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gICBjb25zdCBiaW5JbmRleCA9IHt9OwogICAgICAgIGxldCBzdGF0czsKICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGJpbkNvdW50OyBqICs9IDEpIHsKICAgICAgICAgIGNvbnN0IGJpbiA9IGJ5dGVzLnJlYWRVSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgIGlmIChiaW4gPiB0aGlzLm1heEJpbk51bWJlcikgewogICAgICAgICAgICBzdGF0cyA9IHRoaXMucGFyc2VQc2V1ZG9CaW4oYnl0ZXMsIGN1cnJPZmZzZXQgKyA0KTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSA0ICsgOCArIDQgKyAxNiArIDE2OwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgY29uc3QgbG9mZnNldCA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCArIDQpOwogICAgICAgICAgICB0aGlzLl9maW5kRmlyc3REYXRhKGRhdGEsIGxvZmZzZXQpOwogICAgICAgICAgICBjb25zdCBjaHVua0NvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCArIDEyKTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNjsKICAgICAgICAgICAgY29uc3QgY2h1bmtzID0gbmV3IEFycmF5KGNodW5rQ291bnQpOwogICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGNodW5rQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgICAgIGNvbnN0IHUgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQpOwogICAgICAgICAgICAgIGNvbnN0IHYgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQgKyA4KTsKICAgICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDE2OwogICAgICAgICAgICAgIGNodW5rc1trXSA9IG5ldyBDaHVuayh1LCB2LCBiaW4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGJpbkluZGV4W2Jpbl0gPS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gYmluQ2h1bmtzID0gYmEuYmluSW5kZXhbYmluXTsKICAgICAgICAgICAgZm9yIChsZXQgYyA9IDA7IGMgPCBiaW5DaHVua3MubGVuZ3RoOyArK2MpIHsKICAgICAgICAgICAgICBjaHVua3MucHVzaChuZXcgQ2h1bmsoYmluQ2h1bmtzW2NdLm1pbnYsIGJpbkNodW5rc1tjXS5tYXh2LCBiaW4pKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gb3B0aW1pemVDaHVua3MoY2h1bmtzLCBuZXcgVmlydHVhbE9mZnNldCgwLCAwKSk7CiAgICB9CiAgICByZWcyYmlucyhiZWcsIGVuZCkgewogICAgICBiZWcgLT0gMTsKICAgICAgaWYgKGJlZyA8IDEpIHsKICAgICAgICBiZWcgPSAxOwogICAgICB9CiAgICAgIGlmIChlbmQgPiAyICoqIDUwKSB7CiAgICAgICAgZW5kID0gMiAqKiAzNDsKICAgICAgfQogICAgICBlbmQgLT0gMTsKICAgICAgbGV0IGwgPSAwOwogICAgICBsZXQgdCA9IDA7CiAgICAgIGxldCBzID0gdGhpcy5taW5TaGlmdCArIHRoaXMuZGVwdGggKiAzOwogICAgICBjb25zdCBiaW5zID0gW107CiAgICAgIGZvciAoOyBsIDw9IHRoaXMuZGVwdGg7IHMgLT0gMywgdCArPSBsc2hpZnQoMSwgbCAqIDMpLCBsICs9IDEpIHsKICAgICAgICBjb25zdCBiID0gdCArIHJzaGlmdChiZWcsIHMpOwogICAgICAgIGNvbnN0IGUgPSB0ICsgcnNoaWZ0KGVuZCwgcyk7CiAgICAgICAgaWYgKGUgLSBiICsgYmlucy5sZW5ndGggPiB0aGlzLm1heEJpbk51bWJlcikgewogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBxdWVyeSAke2JlZ30tJHtlbmR9IGlzIHRvbyBsYXJnZSBmb3IgY3VycmVudCBiaW5uaW5nIHNjaGVtZSAoc2hpZnQgJHt0aGlzLm1pblNoaWZ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7CiAgICAgICAgdGFncy5wdXNoKCJuZXh0X3NlZ21lbnRfcG9zaXRpb24iLCAicGFpcl9vcmllbnRhdGlvbiIpOwogICAgICB9CiAgICAgIHRhZ3MgPSB0YWdzLmNvbmNhdCh0aGlzLl90YWdMaXN0IHx8IFtdKTsKICAgICAgT2JqZWN0LmtleXModGhpcy5kYXRhKS5mb3JFYWNoKChrKSA9PiB7CiAgICAgICAgaWYgKGtbMF0gIT09ICJfIiAmJiBrICE9PSAibmV4dF9zZXFfaWQiKSB7CiAgICAgICAgICB0YWdzLnB1c2goayk7CiAgICAgICAgfQogICAgICB9KTsKICAgICAgY29uc3Qgc2VlbiA9IHt9OwogICAgICByZXR1cm4gdGFncy5maWx0ZXIoKHQpID0+IHsKICAgICAgICBpZiAodCBpbiB0aGlzLmRhdGEgJiYgdGhpcy5kYXRhW3RdID09PSB2b2lkIDAgfHwgdCA9PT0gIkNHIiB8fCB0ID09PSAiY2ciKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICAgIGNvbnN0IGx0ID0gdC50b0xvd2VyQ2FzZSgpOwogICAgICAgIGNvbnN0IHMgPSBzZWVuW2x0XTsKICAgICAgICBzZWVuW2x0XSA9IHRydWU7CiAgICAgICAgcmV0dXJuICFzOwogICAgICB9KTsKICAgIH0KICAgIHBhcmVudCgpIHsKICAgICAgcmV0dXJuIHZvaWQgMDsKICAgIH0KICAgIGNoaWxkcmVuKCkgewogICAgICByZXR1cm4gdGhpcy5nZXQoInN1YmZlYXR1cmVzIik7CiAgICB9CiAgICBpZCgpIHsKICAgICAgcmV0dXJuIHRoaXMuX2lkOwogICAgfQogICAgbXEoKSB7CiAgICAgIGNvbnN0IG1xID0gKHRoaXMuZ2V0KCJfYmluX21xX25sIikgJiA2NTI4MCkgPj4gODsKICAgICAgcmV0dXJuIG1xID09PSAyNTUgPyB2b2lkIDAgOiBtcTsKICAgIH0KICAgIHNjb3JlKCkgewogICAgICByZXR1cm4gdGhpcy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wXSk7CiAgICAgICAgICAgIHAgKz0gMTsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlICJpIjoKICAgICAgICAgICAgdmFsdWUgPSBieXRlQXJyYXkucmVhZEludDMyTEUocCk7CiAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlICJJIjoKICAgICAgICAgICAgdmFsdWUgPSBieXRlQXJyYXkucmVhZFVJbnQzMkxFKHApOwogICAgICAgICAgICBwICs9IDQ7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgY2FzZSAiYyI6CiAgICAgICAgICAgIHZhbHVlID0gYnl0ZUFycmF5LnJlYWRJbnQ4KHApOwogICAgICAgICAgICBwICs9IDE7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgY2FzZSAiQyI6CiAgICAgICAgICAgIHZhbHVlID0gYnl0ZUFycmF5LnJlYWRVSW50OChwKTsKICAgICAgICAgICAgcCArPSAxOwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGNhc2UgInMiOgogICAgICAgICAgICB2YWx1ZSA9IGJ5dGVBcnJheS5yZWFkSW50MTZMRShwKTsKICAgICAgICAgICAgcCArPSAyOwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGNhc2UgIlMiOgogICAgICAgICAgICB2YWx1ZSA9IGJ5dGVBcnJheS5yZWFkVUludDE2TEUocCk7CiAgICAgICAgICAgIHAgKz0gMjsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlICJmIjoKICAgICAgICAgICAgdmFsdWUgPSBieXRlQXJyYXkucmVhZEZsb2F0TEUocCk7CiAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlICJaIjoKICAgICAgICAgIGNhc2UgIkgiOgogICAgICAgICAgICB2YWx1ZSA9ICIiOwogICAgICAgICAgICB3aGlsZSAocCA8PSBibG9ja0VuZCkgewogICAgICAgICAgICAgIGNvbnN0IGNjID0gYnl0ZUFycmF5W3ArK107CiAgICAgICAgICAgICAgaWYgKGNjID09PSAwKSB7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdmFsdWUgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShjYyk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgY2FzZSAiQiI6IHsKICAgICAgICAgICAgdmFsdWUgPSAiIjsKICAgICAgICAgICAgY29uc3QgY2MgPSBieXRlQXJyYXlbcCsrXTsKICAgICAgICAgICAgY29uc3QgQnR5cGUgPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGNjKTsKICAgICAgICAgICAgY29uc3QgbGltaXQgPSBieXRlQXJyYXkucmVhZEludDMyTEUocCk7CiAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgaWYgKEJ0eXBlID09PSAiaSIpIHsKICAgICAgICAgICAgICBpZiAodGFnID09PSAiQ0ciKSB7CiAgICAgICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGxpbWl0OyBrKyspIHsKICAgICAgICAgICAgICAgICAgY29uc3QgY2lnb3AgPSBieXRlQXJyYXkucmVhZEludDMyTEUocCk7CiAgICAgICAgICAgICAgICAgIGNvbnN0IGxvcCA9IGNpZ29wID4+IDQ7CiAgICAgICAgICAgICAgICAgIGNvbnN0IG9wID0gQ0lHQVJfREVDT0RFUltjaWdvcCAmIDE1XTsKICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gbG9wICsgb3A7CiAgICAgICAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBsaW1pdDsgaysrKSB7CiAgICAgICAgICAgICAgICAgIHZhbHVlICs9IGJ5dGVBcnJheS5yZWFkSW50MzJMRShwKTsKICAgICAgICAgICAgICAgICAgaWYgKGsgKyAxIDwgbGltaXQpIHsKICAgICAgICAgICAgICAgICAgICB2YWx1ZSArPSAiLCI7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgcCArPSA0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoQnR5cGUgPT09ICJJIikgewogICAgICAgICAgICAgIGlmICh0YWcgPT09ICJDRyIpIHsKICAgICAgICAgICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgbGltaXQ7IGsrKykgewogICAgICAgICAgICAgICAgICBjb25zdCBjaWdvcCA9IGJ5dGVBcnJheS5yZWFkVUludDMyTEUocCk7CiAgICAgICAgICAgICAgICAgIGNvbnN0IGxvcCA9IGNpZ29wID4+IDQ7CiAgICAgICAgICAgICAgICAgIGNvbnN0IG9wID0gQ0lHQVJfREVDT0RFUltjaWdvcCAmIDE1XTsKICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gbG9wICsgb3A7CiAgICAgICAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBsaW1pdDsgaysrKSB7CiAgICAgICAgICAgICAgICAgIHZhbHVlICs9IGJ5dGVBcnJheS5yZWFkVUludDMyTEUocCk7CiAgICAgICAgICAgICAgICAgIGlmIChrICsgMSA8IGxpbWl0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gIiwiOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKEJ0eXBlID09PSAicyIpIHsKICAgICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGxpbWl0OyBrKyspIHsKICAgICAgICAgICAgICAgIHZhbHVlICs9IGJ5dGVBcnJheS5yZWFkSW50MTZMRShwKTsKICAgICAgICAgICAgICAgIGlmIChrICsgMSA8IGxpbWl0KSB7CiAgICAgICAgICAgICAgICAgIHZhbHVlICs9ICIsIjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHAgKz0gMjsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKEJ0eXBlID09PSAiUyIpIHsKICAgICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGxpbWl0OyBrKyspIHsKICAgICAgICAgICAgICAgIHZhbHVlICs9IGJ5dGVBcnJheS5yZWFkVUludDE2TEUocCk7CiAgICAgICAgICAgICAgICBpZiAoayArIDEgPCBsaW1pdCkgewogICAgICAgICAgICAgICAgICB2YWx1ZSArPSAiLCI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBwICs9IDI7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChCdHlwZSA9PT0gImMiKSB7CiAgICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBsaW1pdDsgaysrKSB7CiAgICAgICAgICAgICAgICB2YWx1ZSArPSBieXRlQXJyYXkucmVhZEludDgocCk7CiAgICAgICAgICAgICAgICBpZiAoayArIDEgPCBsaW1pdCkgewogICAgICAgICAgICAgICAgICB2YWx1ZSArPSAiLCI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBwICs9IDE7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChCdHlwZSA9PT0gIkMiKSB7CiAgICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBsaW1pdDsgaysrKSB7CiAgICAgICAgICAgICAgICB2YWx1ZSArPSBieXRlQXJyYXkucmVhZFVJbnQ4KHApOwogICAgICAgICAgICAgICAgaWYgKGsgKyAxIDwgbGltaXQpIHsKICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gIiwiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcCArPSAxOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoQnR5cGUgPT09ICJmIikgewogICAgICAgICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgbGltaXQ7IGsrKykgewogICAgICAgICAgICAgICAgdmFsdWUgKz0gYnl0ZUFycmF5LnJlYWRGbG9hdExFKHApOwogICAgICAgICAgICAgICAgaWYgKGsgKyAxIDwgbGltaXQpIHsKICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gIiwiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcCArPSA0OwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgIGNvbnNvbGUud2FybihgVW5rbm93biBCQU0gdGFnIHR5cGUgJyR7dHlwZX0nLCB0YWdzIG1heSBiZSBpbmNvbXBsZXRlYCk7CiAgICAgICAgICAgIHZhbHVlID0gdm9pZCAwOwogICAgICAgICAgICBwID0gYmxvY2tFbmQ7CiAgICAgICAgfQogICAgICAgIHRoaXMuX3RhZ09mZnNldCA9IHA7CiAgICAgICAgdGhpcy5fdGFnTGlzdC5wdXNoKHRhZyk7CiAgICAgICAgaWYgKGxjVGFnID09PSB0YWdOYW1lKSB7CiAgICAgICAgICByZXR1cm4gdmFsdWU7CiAgICAgICAgfQogICAgICAgIHRoaXMuZGF0YVtsY1RhZ10gPSB2YWx1ZTsKICAgICAgfQogICAgICB0aGlzLl9hbGxUYWdzUGFyc2VkID0gdHJ1ZTsKICAgICAgcmV0dXJuIHZvaWQgMDsKICAgIH0KICAgIF9wYXJzZUFsbFRhZ3MoKSB7CiAgICAgIHRoaXMuX3BhcnNlVGFnKCIiKTsKICAgIH0KICAgIF9wYXJzZUNpZ2FyKGNpZ2FyKSB7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G9wID09PSBzZXFMZW4pIHsKICAgICAgICBwICs9IDQ7CiAgICAgICAgY2lnb3AgPSBieXRlQXJyYXkucmVhZEludDMyTEUocCk7CiAgICAgICAgbG9wID0gY2lnb3AgPj4gNDsKICAgICAgICBvcCA9IENJR0FSX0RFQ09ERVJbY2lnb3AgJiAxNV07CiAgICAgICAgaWYgKG9wICE9PSAiTiIpIHsKICAgICAgICAgIGNvbnNvbGUud2FybigiQ0cgdGFnIHdpdGggbm8gTiB0YWciKTsKICAgICAgICB9CiAgICAgICAgdGhpcy5kYXRhLmxlbmd0aF9vbl9yZWYgPSBsb3A7CiAgICAgICAgcmV0dXJuIHRoaXMuZ2V0KCJDRyIpOwogICAgICB9IGVsc2UgewogICAgICAgIGZvciAobGV0IGMgPSAwOyBjIDwgbnVtQ2lnYXJPcHM7ICsrYykgewogICAgICAgICAgY2lnb3AgPSBieXRlQXJyYXkucmVhZEludDMyTEUocCk7CiAgICAgICAgICBsb3AgPSBjaWdvcCA+PiA0OwogICAgICAgICAgb3AgPSBDSUdBUl9ERUNPREVSW2NpZ29wICYgMTVdOwogICAgICAgICAgY2lnYXIgKz0gbG9wICsgb3A7CiAgICAgICAgICBpZiAob3AgIT09ICJIIiAmJiBvcCAhPT0gIlMiICYmIG9wICE9PSAiSSIpIHsKICAgICAgICAgICAgbHJlZiArPSBsb3A7CiAgICAgICAgICB9CiAgICAgICAgICBwICs9IDQ7CiAgICAgICAgfQogICAgICAgIHRoaXMuZGF0YS5sZW5ndGhfb25fcmVmID0gbHJlZjsKICAgICAgICByZXR1cm4gY2lnYXI7CiAgICAgIH0KICAgIH0KICAgIF9mbGFncygpIHsKICAgIH0KICAgIGxlbmd0aF9vbl9yZWYoKSB7CiAgICAgIGlmICh0aGlzLmRhdGEubGVuZ3RoX29uX3JlZikgewogICAgICAgIHJldHVybiB0aGlzLmRhdGEubGVuZ3RoX29uX3JlZjsKICAgICAgfSBlbHNlIHsKICAgICAgICB0aGlzLmdldCgiY2lnYXIiKTs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0dXJuIGJ1ZjsKICAgIH0KICAgIGdldFBhaXJPcmllbnRhdGlvbigpIHsKICAgICAgaWYgKCF0aGlzLmlzU2VnbWVudFVubWFwcGVkKCkgJiYgIXRoaXMuaXNNYXRlVW5tYXBwZWQoKSAmJiB0aGlzLl9yZWZJRCA9PT0gdGhpcy5fbmV4dF9yZWZpZCgpKSB7CiAgICAgICAgY29uc3QgczEgPSB0aGlzLmlzUmV2ZXJzZUNvbXBsZW1lbnRlZCgpID8gIlIiIDogIkYiOwogICAgICAgIGNvbnN0IHMyID0gdGhpcy5pc01hdGVSZXZlcnNlQ29tcGxlbWVudGVkKCkgPyAiUiIgOiAiRiI7CiAgICAgICAgbGV0IG8xID0gIiAiOwogICAgICAgIGxldCBvMiA9ICIgIjsKICAgICAgICBpZiAodGhpcy5pc1JlYWQxKCkpIHsKICAgICAgICAgIG8xID0gIjEiOwogICAgICAgICAgbzIgPSAiMiI7CiAgICAgICAgfSBlbHNlIGlmICh0aGlzLmlzUmVhZDIoKSkgewogICAgICAgICAgbzEgPSAiMiI7CiAgICAgICAgICBvMiA9ICIxIjsKICAgICAgICB9CiAgICAgICAgY29uc3QgdG1wID0gW107CiAgICAgICAgY29uc3QgaXNpemUgPSB0aGlzLnRlbXBsYXRlX2xlbmd0aCgpOwogICAgICAgIGlmIChpc2l6ZSA+IDApIHsKICAgICAgICAgIHRtcFswXSA9IHMxOwogICAgICAgICAgdG1wWzFdID0gbzE7CiAgICAgICAgICB0bXBbMl0gPSBzMjsKICAgICAgICAgIHRtcFszXSA9IG8yOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB0bXBbMl0gPSBzMTsKICAgICAgICAgIHRtcFszXSA9IG8xOwogICAgICAgICAgdG1wWzBdID0gczI7CiAgICAgICAgICB0bXBbMV0gPSBvMjsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRtcC5qb2luKCIiKTsKICAgICAgfQogICAgICByZXR1cm4gbnVsbDsKICAgIH0KICAgIF9iaW5fbXFfb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0cmluZygpfSBieXRlcyBleGNlZWRlZCBmZXRjaCBzaXplIGxpbWl0IG9mICR7dGhpcy5mZXRjaFNpemVMaW1pdC50b0xvY2FsZVN0cmluZygpfSBieXRlc2ApOwogICAgICB9CiAgICAgIHlpZWxkKiB0aGlzLl9mZXRjaENodW5rRmVhdHVyZXMoY2h1bmtzLCBjaHJJZCwgbWluLCBtYXgsIG9wdHMpOwogICAgfQogICAgYXN5bmMgKl9mZXRjaENodW5rRmVhdHVyZXMoY2h1bmtzLCBjaHJJZCwgbWluLCBtYXgsIG9wdHMpIHsKICAgICAgY29uc3QgeyB2aWV3QXNQYWlycyA9IGZhbHNlIH0gPSBvcHRzOwogICAgICBjb25zdCBmZWF0cyA9IFtdOwogICAgICBsZXQgZG9uZSA9IGZhbHNlOwogICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGNodW5rcy5sZW5ndGg7IGkrKykgewogICAgICAgIGNvbnN0IGMgPSBjaHVua3NbaV07CiAgICAgICAgY29uc3QgcmVjb3JkcyA9IGF3YWl0IHRoaXMuZmVhdHVyZUNhY2hlLmdldChjLnRvU3RyaW5nKCksIHsKICAgICAgICAgIGNodW5rOiBjLAogICAgICAgICAgb3B0cwogICAgICAgIH0sIG9wdHMuc2lnbmFsKTsKICAgICAgICBjb25zdCByZWNzID0gW107CiAgICAgICAgZm9yIChsZXQgaTIgPSAwOyBpMiA8IHJlY29yZHMubGVuZ3RoOyBpMiArPSAxKSB7CiAgICAgICAgICBjb25zdCBmZWF0dXJlID0gcmVjb3Jkc1tpMl07CiAgICAgICAgICBpZiAoZmVhdHVyZS5zZXFfaWQoKSA9PT0gY2hySWQpIHsKICAgICAgICAgICAgaWYgKGZlYXR1cmUuZ2V0KCJzdGFydCIpID49IG1heCkgewogICAgICAgICAgICAgIGRvbmUgPSB0cnVlOwogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9IGVsc2UgaWYgKGZlYXR1cmUuZ2V0KCJlbmQiKSA+PSBtaW4pIHsKICAgICAgICAgICAgICByZWNzLnB1c2goZmVhdHVyZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZmVhdHMucHVzaChyZWNzKTsKICAgICAgICB5aWVsZCByZWNzOwogICAgICAgIGlmIChkb25lKSB7CiAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgIH0KICAgICAgY2hlY2tBYm9ydFNpZ25hbChvcHRzLnNpZ25hbCk7CiAgICAgIGlmICh2aWV3QXNQYWlycykgewogICAgICAgIHlpZWxkIHRoaXMuZmV0Y2hQYWlycyhjaHJJZCwgZmVhdHMsIG9wdHMpOwogICAgICB9CiAgICB9CiAgICBhc3luYyBmZXRjaFBhaXJzKGNocklkLCBmZWF0cywgb3B0cykgewogICAgICBjb25zdCB7IHBhaXJBY3Jvc3NDaHIgPSBmYWxzZSwgbWF4SW5zZXJ0U2l6ZSA9IDJlNSB9ID0gb3B0czsKICAgICAgY29uc3QgdW5tYXRlZFBhaXJzID0ge307CiAgICAgIGNvbnN0IHJlYWRJZHMgPSB7fTsKICAgICAgZmVhdHMubWFwKChyZXQpID0+IHsKICAgICAgICBjb25zdCByZWFkTmFtZXMgPSB7fTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHJldC5sZW5ndGg7IGkrKykgewogICAgICAgICAgY29uc3QgbmFtZSA9IHJldFtpXS5uYW1lKCk7CiAgICAgICAgICBjb25zdCBpZCA9IHJldFtpXS5pZCgpOwogICAgICAgICAgaWYgKCFyZWFkTmFtZXNbbmFtZV0pIHsKICAgICAgICAgICAgcmVhZE5hbWVzW25hbWVdID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIHJlYWROYW1lc1tuYW1lXSsrOwogICAgICAgICAgcmVhZElkc1tpZF0gPSAxOwogICAgICAgIH0KICAgICAgICAoMCwgaW1wb3J0X29iamVjdC5kZWZhdWx0KShyZWFkTmFtZXMpLmZvckVhY2goKFtrLCB2XSkgPT4gewogICAgICAgICAgaWYgKHYgP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wb3NpdGlvbnNbcG9zKytdKSB7CiAgICAgICAgICB9CiAgICAgICAgICBwb3MtLTsKICAgICAgICB9CiAgICAgICAgaWYgKGJsb2NrRW5kIDwgYmEubGVuZ3RoKSB7CiAgICAgICAgICBjb25zdCBmZWF0dXJlID0gbmV3IEJhbVJlY29yZCh7CiAgICAgICAgICAgIGJ5dGVzOiB7CiAgICAgICAgICAgICAgYnl0ZUFycmF5OiBiYSwKICAgICAgICAgICAgICBzdGFydDogYmxvY2tTdGFydCwKICAgICAgICAgICAgICBlbmQ6IGJsb2NrRW5kCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZpbGVPZmZzZXQ6IGNwb3NpdGlvbnMgPyBjcG9zaXRpb25zW3Bvc10gKiAoMSA8PCA4KSArIChibG9ja1N0YXJ0IC0gZHBvc2l0aW9uc1twb3NdKSArIGNodW5rLm1pbnYuZGF0YVBvc2l0aW9uICsgMSA6IGltcG9ydF9idWZmZXJfY3JjMzIuZGVmYXVsdC5zaWduZWQoYmEuc2xpY2UoYmxvY2tTdGFydCwgYmxvY2tFbmQpKQogICAgICAgICAgfSk7CiAgICAgICAgICBzaW5rLnB1c2goZmVhdHVyZSk7CiAgICAgICAgICBpZiAodGhpcy55aWVsZFRocmVhZFRpbWUgJiYgK0RhdGUubm93KCkgLSBsYXN0ID4gdGhpcy55aWVsZFRocmVhZFRpbWUpIHsKICAgICAgICAgICAgYXdhaXQgdGltZW91dCgxKTsKICAgICAgICAgICAgbGFzdCA9ICtEYXRlLm5vdygpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBibG9ja1N0YXJ0ID0gYmxvY2tFbmQgKyAxOwogICAgICB9CiAgICAgIHJldHVybiBzaW5rOwogICAgfQogICAgYXN5bmMgaGFzUmVmU2VxKHNlcU5hbWUpIHsKICAgICAgY29uc3QgcmVmSWQgPSB0aGlzLmNoclRvSW5kZXggJiYgdGhpcy5jaHJUb0luZGV4W3NlcU5hbWVdOwogICAgICByZXR1cm4gdGhpcy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AgICAgICAgdGhpcy5fZW1pdEV2aWN0aW9ucyh0aGlzLm9sZENhY2hlKTsKICAgICAgICB0aGlzLm9sZENhY2hlID0gdGhpcy5jYWNoZTsKICAgICAgICB0aGlzLmNhY2hlID0gbmV3IE1hcCgpOwogICAgICB9CiAgICB9CiAgICBfbW92ZVRvUmVjZW50KGtleSwgaXRlbSkgewogICAgICB0aGlzLm9sZENhY2hlLmRlbGV0ZShrZXkpOwogICAgICB0aGlzLl9zZXQoa2V5LCBpdGVtKTsKICAgIH0KICAgICpfZW50cmllc0FzY2VuZGluZygpIHsKICAgICAgZm9yIChjb25zdCBpdGVtIG9mIHRoaXMub2xkQ2FjaGUpIHsKICAgICAgICBjb25zdCBba2V5LCB2YWx1ZV0gPSBpdGVtOwogICAgICAgIGlmICghdGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgY29uc3QgZGVsZXRlZCA9IHRoaXMuX2RlbGV0ZUlmRXhwaXJlZChrZXksIHZhbHVlKTsKICAgICAgICAgIGlmIChkZWxldGVkID09PSBmYWxzZSkgewogICAgICAgICAgICB5aWVsZCBpdGVtOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBmb3IgKGNvbnN0IGl0ZW0gb2YgdGhpcy5jYWNoZSkgewogICAgICAgIGNvbnN0IFtrZXksIHZhbHVlXSA9IGl0ZW07CiAgICAgICAgY29uc3QgZGVsZXRlZCA9IHRoaXMuX2RlbGV0ZUlmRXhwaXJlZChrZXksIHZhbHVlKTsKICAgICAgICBpZiAoZGVsZXRlZCA9PT0gZmFsc2UpIHsKICAgICAgICAgIHlpZWxkIGl0ZW07CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICBnZXQoa2V5KSB7CiAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgY29uc3QgaXRlbSA9IHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgcmV0dXJuIHRoaXMuX2dldEl0ZW1WYWx1ZShrZXksIGl0ZW0pOwogICAgICB9CiAgICAgIGlmICh0aGlzLm9sZENhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgY29uc3QgaXRlbSA9IHRoaXMub2xkQ2FjaGUuZ2V0KGtleSk7CiAgICAgICAgaWYgKHRoaXMuX2RlbGV0ZUlmRXhwaXJlZChrZXksIGl0ZW0pID09PSBmYWxzZSkgewogICAgICAgICAgdGhpcy5fbW92ZVRvUmVjZW50KGtleSwgaXRlbSk7CiAgICAgICAgICByZXR1cm4gaXRlbS52YWx1ZTsKICAgICAgICB9CiAgICAgIH0KICAgIH0KICAgIHNldChrZXksIHZhbHVlLCB7IG1heEFnZSA9IHRoaXMubWF4QWdlIH0gPSB7fSkgewogICAgICBjb25zdCBleHBpcnkgPSB0eXBlb2YgbWF4QWdlID09PSAibnVtYmVyIiAmJiBtYXhBZ2UgIT09IE51bWJlci5QT1NJVElWRV9JTkZJTklUWSA/IERhdGUubm93KCkgKyBtYXhBZ2UgOiB2b2lkIDA7CiAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgdGhpcy5jYWNoZS5zZXQoa2V5LCB7CiAgICAgICAgICB2YWx1ZSwKICAgICAgICAgIGV4cGlyeQogICAgICAgIH0pOwogICAgICB9IGVsc2UgewogICAgICAgIHRoaXMuX3NldChrZXksIHsgdmFsdWUsIGV4cGlyeSB9KTsKICAgICAgfQogICAgICByZXR1cm4gdGhpczsKICAgIH0KICAgIGhhcyhrZXkpIHsKICAgICAgaWYgKHRoaXMuY2FjaGUuaGFzKGtleSkpIHsKICAgICAgICByZXR1cm4gIXRoaXMuX2RlbGV0ZUlmRXhwaXJlZChrZXksIHRoaXMuY2FjaGUuZ2V0KGtleSkpOwogICAgICB9CiAgICAgIGlmICh0aGlzLm9sZENhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgcmV0dXJuICF0aGlzLl9kZWxldGVJZkV4cGlyZWQoa2V5LCB0aGlzLm9sZENhY2hlLmdldChrZXkpKTsKICAgICAgfQogICAgICByZXR1cm4gZmFsc2U7CiAgICB9CiAgICBwZWVrKGtleSkgewogICAgICBpZiAodGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgIHJldHVybiB0aGlzLl9wZWVrKGtleSwgdGhpcy5jYWNoZSk7CiAgICAgIH0KICAgICAgaWYgKHRoaXMub2xkQ2FjaGUuaGFzKGtleSkpIHsKICAgICAgICByZXR1cm4gdGhpcy5fcGVlayhrZXksIHRoaXMub2xkQ2FjaGUpOwogICAgICB9CiAgICB9CiAgICBkZWxldGUoa2V5KSB7CiAgICAgIGNvbnN0IGRlbGV0ZWQgPSB0aGlzLmNhY2hlLmRlbGV0ZShrZXkpOwogICAgICBpZiAoZGVsZXRlZCkgewogICAgICAgIHRoaXMuX3NpemUtLTsKICAgICAgfQogICAgICByZXR1cm4gdGhpcy5vbGRDYWNoZS5kZWxldGUoa2V5KSB8fCBkZWxldGVkOwogICAgfQogICAgY2xlYXIoKSB7CiAgICAgIHRoaXMuY2FjaGUuY2xlYXIoKTsKICAgICAgdGhpcy5vbGRDYWNoZS5jbGVhcigpOwogICAgICB0aGlzLl9zaXplID0gMDsKICAgIH0KICAgIHJlc2l6ZShuZXdTaXplKSB7CiAgICAgIGlmICghKG5ld1NpemUgJiYgbmV3U2l6ZSA+IDApKSB7CiAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiYG1heFNpemVgIG11c3QgYmUgYSBudW1iZXIgZ3JlYXRlciB0aGFuIDAiKTsKICAgICAgfQogICAgICBjb25zdCBpdGVtcyA9IFsuLi50aGlzLl9lbnRyaWVzQXNjZW5kaW5nKCldOwogICAgICBjb25zdCByZW1vdmVDb3VudCA9IGl0ZW1zLmxlbmd0aCAtIG5ld1NpemU7CiAgICAgIGlmIChyZW1vdmVDb3VudCA8IDApIHsKICAgICAgICB0aGlzLmNhY2hlID0gbmV3IE1hcChpdGVtcyk7CiAgICAgICAgdGhpcy5vbGRDYWNoZSA9IG5ldyBN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ICAgbG8gPSBtaWQgKyAxOwogICAgICAgIGVsc2UKICAgICAgICAgIGhpID0gbWlkOwogICAgICB9CiAgICAgIHJldHVybiBsbzsKICAgIH0KICAgIGZ1bmN0aW9uIHJpZ2h0KGEsIHgsIGxvLCBoaSkgewogICAgICBpZiAobG8gPT0gbnVsbCkKICAgICAgICBsbyA9IDA7CiAgICAgIGlmIChoaSA9PSBudWxsKQogICAgICAgIGhpID0gYS5sZW5ndGg7CiAgICAgIHdoaWxlIChsbyA8IGhpKSB7CiAgICAgICAgY29uc3QgbWlkID0gbG8gKyBoaSA+Pj4gMTsKICAgICAgICBpZiAoY29tcGFyZShhW21pZF0sIHgpID4gMCkKICAgICAgICAgIGhpID0gbWlkOwogICAgICAgIGVsc2UKICAgICAgICAgIGxvID0gbWlkICsgMTsKICAgICAgfQogICAgICByZXR1cm4gbG87CiAgICB9CiAgICBmdW5jdGlvbiBjZW50ZXIoYSwgeCwgbG8sIGhpKSB7CiAgICAgIGlmIChsbyA9PSBudWxsKQogICAgICAgIGxvID0gMDsKICAgICAgaWYgKGhpID09IG51bGwpCiAgICAgICAgaGkgPSBhLmxlbmd0aDsKICAgICAgY29uc3QgaSA9IGxlZnQoYSwgeCwgbG8sIGhpIC0gMSk7CiAgICAgIHJldHVybiBpID4gbG8gJiYgZGVsdGEoYVtpIC0gMV0sIHgpID4gLWRlbHRhKGFbaV0sIHgpID8gaSAtIDEgOiBpOwogICAgfQogICAgcmV0dXJuIHsgbGVmdCwgY2VudGVyLCByaWdodCB9OwogIH0KICBmdW5jdGlvbiBhc2NlbmRpbmdDb21wYXJhdG9yKGYpIHsKICAgIHJldHVybiAoZCwgeCkgPT4gYXNjZW5kaW5nX2RlZmF1bHQoZihkKSwgeCk7CiAgfQoKICAvLyBzcmMvZGF0YS1mZXRjaGVycy91dGlscy50cwogIHZhciBEYXRhU291cmNlID0gY2xhc3MgewogICAgY29uc3RydWN0b3IoZmlsZSwgY2hyb21TaXplcywgb3B0aW9ucykgewogICAgIC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kZWxldGlvbkVuY291bnRlcmVkID0gdHJ1ZTsKICAgICAgfSBlbHNlIHsKICAgICAgICBjdXJyUG9zICs9IGN1cnJOdW07CiAgICAgICAgaWYgKHVzZUNvdW50cykgewogICAgICAgICAgc3Vic3RpdHV0aW9ucy5wdXNoKHsKICAgICAgICAgICAgbGVuZ3RoOiBjdXJyTnVtLAogICAgICAgICAgICB0eXBlOiBtZFN0cmluZ1tpXQogICAgICAgICAgfSk7CiAgICAgICAgfSBlbHNlIGlmIChkZWxldGlvbkVuY291bnRlcmVkKSB7CiAgICAgICAgICBiYW1TZXFTaGlmdCAtPSAxOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBzdWJzdGl0dXRpb25zLnB1c2goewogICAgICAgICAgICBwb3M6IGN1cnJQb3MsCiAgICAgICAgICAgIGJhc2U6IG1kU3RyaW5nW2ldLAogICAgICAgICAgICBsZW5ndGg6IDEsCiAgICAgICAgICAgIGJhbVNlcVNoaWZ0CiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgY3Vyck51bSA9IDA7CiAgICAgICAgY3VyclBvcyArPSAxOwogICAgICB9CiAgICB9CiAgICByZXR1cm4gc3Vic3RpdHV0aW9uczsKICB9CiAgZnVuY3Rpb24gZ2V0U3Vic3RpdHV0aW9ucyhzZWdtZW50LCBzZXEpIHsKICAgIGxldCBzdWJzdGl0dXRpb25zID0gW107CiAgICBsZXQgc29mdENsaXBwaW5nQXRSZWFkU3RhcnQgPSBudWxsOwogICAgaWYgKHNlZ21lbnQuY2lnYXIpIHsKICAgICAgY29uc3QgY2lnYXJTdWJzID0gcGFyc2VNRChzZWdtZW50LmNpZ2FyLCB0cnVlKTsKICAgICAgbGV0IGN1cnJQb3MgPSAwOwogICAgICBmb3IgKGNvbnN0IHN1YiBvZiBjaWdhclN1YnMpIHsKICAgICAgICBpZiAoc3ViLnR5cGUgPT09ICJYIikgewogICAgICAgICAgc3Vic3RpdHV0aW9ucy5wdXNoKHsKICAgICAgICAgICAgcG9zOiBjdXJyUG9zLAogICAgICAgICAgICBsZW5ndGg6IHN1Yi5sZW5ndGgsCiAgICAgICAgICAgIHR5cGU6ICJYIgogICAgICAgICAgfSk7CiAgICAgICAgICBjdXJyUG9zICs9IHN1Yi5sZW5ndGg7CiAgICAgICAgfSBlbHNlIGlmIChzdWIudHlwZSA9PT0gIkkiKSB7CiAgICAgICAgICBzdWJzdGl0dXRpb25zLnB1c2goewogICAgICAgICAgICBwb3M6IGN1cnJQb3MsCiAgICAgICAgICAgIGxlbmd0aDogc3ViLmxlbmd0aCwKICAgICAgICAgICAgdHlwZTogIkkiCiAgICAgICAgICB9KTsKICAgICAgICB9IGVsc2UgaWYgKHN1Yi50eXBlID09PSAiRCIpIHsKICAgICAgICAgIHN1YnN0aXR1dGlvbnMucHVzaCh7CiAgICAgICAgICAgIHBvczogY3VyclBvcywKICAgICAgICAgICAgbGVuZ3RoOiBzdWIubGVuZ3RoLAogICAgICAgICAgICB0eXBlOiAiRCIKICAgICAgICAgIH0pOwogICAgICAgICAgY3VyclBvcyArPSBzdWIubGVuZ3RoOwogICAgICAgIH0gZWxzZSBpZiAoc3ViLnR5cGUgPT09ICJOIikgewogICAgICAgICAgc3Vic3RpdHV0aW9ucy5wdXNoKHsKICAgICAgICAgICAgcG9zOiBjdXJyUG9zLAogICAgICAgICAgICBsZW5ndGg6IHN1Yi5sZW5ndGgsCiAgICAgICAgICAgIHR5cGU6ICJOIgogICAgICAgICAgfSk7CiAgICAgICAgICBjdXJyUG9zICs9IHN1Yi5sZW5ndGg7CiAgICAgICAgfSBlbHNlIGlmIChzdWIudHlwZSA9PT0gIj0iIHx8IHN1Yi50eXBlID09PSAiTSIpIHsKICAgICAgICAgIGN1cnJQb3MgKz0gc3ViLmxlbmd0aDsKICAgICAgICB9IGVsc2UgewogICAgICAgIH0KICAgICAgfQogICAgICBjb25zdCBmaXJzdFN1YiA9IGNpZ2FyU3Vic1swXTsKICAgICAgY29uc3QgbGFzdFN1YiA9IGNpZ2FyU3Vic1tjaWdhclN1YnMubGVuZ3RoIC0gMV07CiAgICAgIGlmIChmaXJzdFN1Yi50eXBlID09PSAiUyIpIHsKICAgICAgICBzb2Z0Q2xpcHBpbmdBdFJlYWRTdGFydCA9IGZpcnN0U3ViOwogICAgICAgIHN1YnN0aXR1dGlvbnMucHVzaCh7CiAgICAgICAgICBwb3M6IC1maXJzdFN1Yi5sZW5ndGgsCiAgICAgICAgICB0eXBlOiAiUyIsCiAgICAgICAgICBsZW5ndGg6IGZpcnN0U3ViLmxlbmd0aAogICAgICAgIH0pOwogICAgICB9CiAgICAgIGlmIChsYXN0U3ViLnR5cGUgPT09ICJTIikgewogICAgICAgIHN1YnN0aXR1dGlvbnMucHVzaCh7CiAgICAgICAgICBwb3M6IHNlZ21lbnQuZW5kIC0gc2VnbWVudC5zdGFydCwKICAgICAgICAgIGxlbmd0aDogbGFzdFN1Yi5sZW5ndGgsCiAgICAgICAgICB0eXBlOiAiUyIKICAgICAgICB9KTsKICAgICAgfQogICAgICBpZiAoZmlyc3RTdWIudHlwZSA9PT0gIkgiKSB7CiAgICAgICAgc3Vic3RpdHV0aW9ucy5wdXNoKHsKICAgICAgICAgIHBvczogLWZpcnN0U3ViLmxlbmd0aCwKICAgICAgICAgIHR5cGU6ICJIIiwKICAgICAgICAgIGxlbmd0aDogZmlyc3RTdWIubGVuZ3RoCiAgICAgICAgfSk7CiAgICAgIH0KICAgICAgaWYgKGxhc3RTdWIudHlwZSA9PT0gIkgiKSB7CiAgICAgICAgc3Vic3RpdHV0aW9ucy5wdXNoKHsKICAgICAgICAgIHBvczogc2VnbWVudC5lbmQgLSBzZWdtZW50LnN0YXJ0LAogICAgICAgICAgbGVuZ3RoOiBsYXN0U3ViLmxlbmd0aCwKICAgICAgICAgIHR5cGU6ICJIIgogICAgICAgIH0pOwogICAgICB9CiAgICB9CiAgICBpZiAoc2VnbWVudC5tZCkgewogICAgICBjb25zdCBtZFN1YnN0aXR1dGlvbnMgPSBwYXJzZU1EKH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R5cGU7CiAgICAgICAgaWYgKCFsYXJnZUluc2VydFNpemUpIHsKICAgICAgICAgIHN2VHlwZSA9ICJub3JtYWwgcmVhZCI7CiAgICAgICAgfSBlbHNlIGlmIChsLnN0cmFuZCA9PT0gIisiICYmIHIuc3RyYW5kID09PSAiLSIpIHsKICAgICAgICAgIHN2VHlwZSA9ICJkZWxldGlvbiAoKy0pIjsKICAgICAgICB9IGVsc2UgaWYgKGwuc3RyYW5kID09PSAiKyIgJiYgci5zdHJhbmQgPT09ICIrIikgewogICAgICAgICAgc3ZUeXBlID0gImludmVyc2lvbiAoKyspIjsKICAgICAgICB9IGVsc2UgaWYgKGwuc3RyYW5kID09PSAiLSIgJiYgci5zdHJhbmQgPT09ICItIikgewogICAgICAgICAgc3ZUeXBlID0gImludmVyc2lvbiAoLS0pIjsKICAgICAgICB9IGVsc2UgaWYgKGwuc3RyYW5kID09PSAiLSIgJiYgci5zdHJhbmQgPT09ICIrIikgewogICAgICAgICAgc3ZUeXBlID0gImR1cGxpY2F0aW9uICgtKykiOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBzdlR5cGUgPSBgKCR7bC5zdHJhbmR9JHtyLnN0cmFuZH0pYDsKICAgICAgICB9CiAgICAgICAgW3JlYWQsIG1hdGVdLmZvckVhY2goKGQpID0+IHsKICAgICAgICAgIGQuZm91bmRNYXRlID0gdHJ1ZTsKICAgICAgICAgIGQuaW5zZXJ0U2l6ZSA9IGluc2VydFNpemU7CiAgICAgICAgICBkLmxhcmdlSW5zZXJ0U2l6ZSA9IGxhcmdlSW5zZXJ0U2l6ZTsKICAgICAgICAgIGQuc3ZUeXBlID0gc3ZUeXBlOwogICAgICAgICAgZC5udW1NYXRlcyA9IDI7CiAgICAgICAgfSk7CiAgICAgIH0gZWxzZSB7CiAgICAgICAgc2VnbWVudEdyb3VwLmZvckVhY2goKGQpID0+IHsKICAgICAgICAgIGQubWF0ZUlkcyA9IHNlZ21lbnRHcm91cC5maWx0ZXIoKG1hdGUp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CiAgICAgICAgICAgIGouc2NvcmUgKz0gMTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGp1bmN0aW9ucy5wdXNoKHsgc3RhcnQ6IGRvbiwgZW5kOiBhY2MsIHNjb3JlOiAxIH0pOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfSk7CiAgICB9KTsKICAgIHJldHVybiBqdW5jdGlvbnMuZmlsdGVyKChkKSA9PiBkLnNjb3JlID49IG1pbkNvdmVyYWdlKTsKICB9OwogIHZhciB0aWxlRnVuY3Rpb25zID0gewogICAgaW5pdCwKICAgIHRpbGVzZXRJbmZvLAogICAgZmV0Y2hUaWxlc0RlYm91bmNlZCwKICAgIHRpbGUsCiAgICBnZXRUYWJ1bGFyRGF0YQogIH07CiAgZXhwb3NlKHRpbGVGdW5jdGlvbnMpOwp9KSgpOwovKiEKICogVGhlIGJ1ZmZlciBtb2R1bGUgZnJvbSBub2RlLmpzLCBmb3IgdGhlIGJyb3dzZXIuCiAqCiAqIEBhdXRob3IgICBGZXJvc3MgQWJvdWtoYWRpamVoIDxodHRwczovL2Zlcm9zcy5vcmc+CiAqIEBsaWNlbnNlICBNSVQKICovCi8qISBpZWVlNzU0LiBCU0QtMy1DbGF1c2UgTGljZW5zZS4gRmVyb3NzIEFib3VraGFkaWplaCA8aHR0cHM6Ly9mZXJvc3Mub3JnL29wZW5zb3VyY2U+ICovCg=="; +const blob$3 = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs$3)], { type: "text/javascript;charset=utf-8" }); +function Worker$4() { + const objURL = blob$3 && (window.URL || window.webkitURL).createObjectURL(blob$3); + try { + return objURL ? new Worker(objURL) : new Worker("data:application/javascript;base64," + encodedJs$3, { type: "module" }); + } finally { + objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL); + } +} +const DEBOUNCE_TIME$3 = 200; +class BamDataFetcher { + constructor(HGC, config2) { + __publicField(this, "dataConfig", {}); + // required for higlass + __publicField(this, "uid"); + __publicField(this, "fetchTimeout"); + __publicField(this, "toFetch"); + __publicField(this, "MAX_TILE_WIDTH", 2e4); + __publicField(this, "worker"); + // This is set by us but is accessed in `fetchTilesDebounced` + __publicField(this, "track"); + this.uid = HGC.libraries.slugid.nice(); + this.toFetch = /* @__PURE__ */ new Set(); + const { url, indexUrl, assembly, ...options } = config2; + this.worker = spawn(new Worker$4()).then(async (worker) => { + const chromSizes = Object.entries(computeChromSizes(assembly).size); + await worker.init(this.uid, { url, indexUrl }, chromSizes, options); + return worker; + }); + } + /* + * Collect Tileset Information, such as tile size and genomic positions + */ + async tilesetInfo(callback) { + (await this.worker).tilesetInfo(this.uid).then(callback); + } + fetchTilesDebounced(receivedTiles, tileIds) { + var _a; + const { toFetch } = this; + const thisZoomLevel = tileIds[0].split(".")[0]; + const toFetchZoomLevel = toFetch.size ? [...toFetch][0].split(".")[0] : null; + if (thisZoomLevel !== toFetchZoomLevel) { + for (const tileId of this.toFetch) { + (_a = this.track) == null ? void 0 : _a.fetching.delete(tileId); + } + this.toFetch.clear(); + } + tileIds.forEach((x) => this.toFetch.add(x)); + if (this.fetchTimeout) { + clearTimeout(this.fetchTimeout); + } + this.fetchTimeout = setTimeout(() => { + this.sendFetch(receivedTiles, [...this.toFetch]); + this.toFetch.clear(); + }, DEBOUNCE_TIME$3); + } + async sendFetch(receivedTiles, tileIds) { + (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles); + } + async getTabularData(tileIds) { + const buf = await (await this.worker).getTabularData(this.uid, tileIds); + return JSON.parse(new TextDecoder().decode(buf)); + } +} +__publicField(BamDataFetcher, "config", { type: "bam" }); +const encodedJs$2 = "KCgpID0+IHsKICB2YXIgX19jcmVhdGUgPSBPYmplY3QuY3JlYXRlOwogIHZhciBfX2RlZlByb3AgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiAgdmFyIF9fZ2V0T3duUHJvcERlc2MgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOwogIHZhciBfX2dldE93bl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IDYgfCByZXZMb29rdXBbYjY0LmNoYXJDb2RlQXQoaTIgKyAzKV07CiAgICAgICAgICBhcnJbY3VyQnl0ZSsrXSA9IHRtcCA+PiAxNiAmIDI1NTsKICAgICAgICAgIGFycltjdXJCeXRlKytdID0gdG1wID4+IDggJiAyNTU7CiAgICAgICAgICBhcnJbY3VyQnl0ZSsrXSA9IHRtcCAmIDI1NTsKICAgICAgICB9CiAgICAgICAgaWYgKHBsYWNlSG9sZGVyc0xlbiA9PT0gMikgewogICAgICAgICAgdG1wID0gcmV2TG9va3VwW2I2NC5jaGFyQ29kZUF0KGkyKV0gPDwgMiB8IHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpMiArIDEpXSA+PiA0OwogICAgICAgICAgYXJyW2N1ckJ5dGUrK10gPSB0bXAgJiAyNTU7CiAgICAgICAgfQogICAgICAgIGlmIChwbGFjZUhvbGRlcnNMZW4gPT09IDEpIHsKICAgICAgICAgIHRtcCA9IHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpMildIDw8IDEwIHwgcmV2TG9va3VwW2I2NC5jaGFyQ29kZUF0KGkyICsgMSldIDw8IDQgfCByZXZMb29rdXBbYjY0LmNoYXJDb2RlQXQoaTIgKyAyKV0gPj4gMjsKICAgICAgICAgIGFycltjdXJCeXRlKytdID0gdG1wID4+IDggJiAyNTU7CiAgICAgICAgICBhcnJbY3VyQnl0ZSsrXSA9IHRtcCAmIDI1NTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGFycjsKICAgICAgfQogICAgICBmdW5jdGlvbiB0cmlwbGV0VG9CYXNlNjQobnVtKSB7CiAgICAgICAgcmV0dXJuIGxvb2t1cFtudW0gPj4gMTggJiA2M10gKyBsb29rdXBbbnVtID4+IDEyICYgNjNdICsgbG9va3VwW251bSA+PiA2ICYgNjNdICsgbG9va3VwW251bSAmIDYzXTsKICAgICAgfQogICAgICBmdW5jdGlvbiBlbmNvZGVDaHVuayh1aW50OCwgc3RhcnQsIGVuZCkgewogIC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sKICAgICAgICBuQml0cyArPSBlTGVuOwogICAgICAgIGZvciAoOyBuQml0cyA+IDA7IGUgPSBlICogMjU2ICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9IGQsIG5CaXRzIC09IDgpIHsKICAgICAgICB9CiAgICAgICAgbSA9IGUgJiAoMSA8PCAtbkJpdHMpIC0gMTsKICAgICAgICBlID4+PSAtbkJpdHM7CiAgICAgICAgbkJpdHMgKz0gbUxlbjsKICAgICAgICBmb3IgKDsgbkJpdHMgPiAwOyBtID0gbSAqIDI1NiArIGJ1ZmZlcltvZmZzZXQgKyBpXSwgaSArPSBkLCBuQml0cyAtPSA4KSB7CiAgICAgICAgfQogICAgICAgIGlmIChlID09PSAwKSB7CiAgICAgICAgICBlID0gMSAtIGVCaWFzOwogICAgICAgIH0gZWxzZSBpZiAoZSA9PT0gZU1heCkgewogICAgICAgICAgcmV0dXJuIG0gPyBOYU4gOiAocyA/IC0xIDogMSkgKiBJbmZpbml0eTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgbSA9IG0gKyBNYXRoLnBvdygyLCBtTGVuKTsKICAgICAgICAgIGUgPSBlIC0gZUJpYXM7CiAgICAgICAgfQogICAgICAgIHJldHVybiAocyA/IC0xIDogMSkgKiBtICogTWF0aC5wb3coMiwgZSAtIG1MZW4pOwogICAgICB9OwogICAgICBleHBvcnRzMi53cml0ZSA9IGZ1bmN0aW9uKGJ1ZmZlciwgdmFsdWUsIG9mZnNldCwgaXNMRSwgbUxlbiwgbkJ5dGVzKSB7CiAgICAgICAgdmFyIGUsIG0sIGM7CiAgICAgICAgdmFyIGVMZW4gPSBuQnl0ZXMgKiA4IC0gbUxlbiAtIDE7CiAgICAgICAgdmFyIGVNYXggPSAoMSA8PCBlTGVuKSAtIDE7CiAgICAgICAgdmFyIGVCaWFzID0gZU1heCA+PiAxOwogICAgICAgIHZhciBydCA9IG1MZW4gPT09IDIzID8gTWF0aC5wb3coMiwgLTI0KSAtIE1hdGgucG93KDIsIC03NykgOiAwOwogICAgICAgIHZhciBpID0gaXNMRSA/IDAgOiBuQnl0ZXMgLSAxOwogICAgICAgIHZhciBkID0gaXNMRSA/IDEgOiAtMTsKICAgICAgICB2YXIgcyA9IHZhbHVlIDwgMCB8fCB2YWx1ZSA9PT0gMCAmJiAxIC8gdmFsdWUgPCAwID8gMSA6IDA7CiAgICAgICAgdmFsdWUgPSBNYXRoLmFicyh2YWx1ZSk7CiAgICAgICAgaWYgKGlzTmFOKHZhbHVlKSB8fCB2YWx1ZSA9PT0gSW5maW5pdHkpIHsKICAgICAgICAgIG0gPSBpc05hTih2YWx1ZSkgPyAxIDogMDsKICAgICAgICAgIGUgPSBlTWF4OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBlID0gTWF0aC5mbG9vcihNYXRoLmxvZyh2YWx1ZSkgLyBNYXRoLkxOMik7CiAgICAgICAgICBpZiAodmFsdWUgKiAoYyA9IE1hdGgucG93KDIsIC1lKSkgPCAxKSB7CiAgICAgICAgICAgIGUtLTsKICAgICAgICAgICAgYyAqPSAyOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGUgKyBlQmlhcyA+PSAxKSB7CiAgICAgICAgICAgIHZhbHVlICs9IHJ0IC8gYzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHZhbHVlICs9IHJ0ICogTWF0aC5wb3coMiwgMSAtIGVCaWFzKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh2YWx1ZSAqIGMgPj0gMikgewogICAgICAgICAgICBlKys7CiAgICAgICAgICAgIGMgLz0gMjsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChlICsgZUJpYXMgPj0gZU1heCkgewogICAgICAgICAgICBtID0gMDsKICAgICAgICAgICAgZSA9IGVNYXg7CiAgICAgICAgICB9IGVsc2UgaWYgKGUgKyBlQmlhcyA+PSAxKSB7CiAgICAgICAgICAgIG0gPSAodmFsdWUgKiBjIC0gMSkgKiBNYXRoLnBvdygyLCBtTGVuKTsKICAgICAgICAgIC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WludDhBcnJheS5wcm90b3R5cGUpOwogICAgICAgICAgT2JqZWN0LnNldFByb3RvdHlwZU9mKGFyciwgcHJvdG8pOwogICAgICAgICAgcmV0dXJuIGFyci5mb28oKSA9PT0gNDI7CiAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgfQogICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoQnVmZmVyMTAucHJvdG90eXBlLCAicGFyZW50IiwgewogICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHsKICAgICAgICAgIGlmICghQnVmZmVyMTAuaXNCdWZmZXIodGhpcykpCiAgICAgICAgICAgIHJldHVybiB2b2lkIDA7CiAgICAgICAgICByZXR1cm4gdGhpcy5idWZmZXI7CiAgICAgICAgfQogICAgICB9KTsKICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KEJ1ZmZlcjEwLnByb3RvdHlwZSwgIm9mZnNldCIsIHsKICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgIGdldDogZnVuY3Rpb24oKSB7CiAgICAgICAgICBpZiAoIUJ1ZmZlcjEwLmlzQnVmZmVyKHRoaXMpKQogICAgICAgICAgICByZXR1cm4gdm9pZCAwOwogICAgICAgICAgcmV0dXJuIHRoaXMuYnl0ZU9mZnNldDsKICAgICAgICB9CiAgICAgIH0pOwogICAgICBmdW5jdGlvbiBjcmVhdGVCdWZmZXIobGVuZ3RoKSB7CiAgICAgICAgaWYgKGxlbmd0aCA+IEtfTUFYX0xFTkdUSCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoJ1RoZSB2YWx1ZSAiJyArIGxlbmd0aCArICciIGlzIGludmFsaWQgZm9yIG9wdGlvbiAic2l6ZSInKTsKICAgICAgICB9CiAgICAgICAgY29uc3QgYnVmID0gbmV3IFVpbnQ4QXJyYXkobGVuZ3RoKTsKICAgICAgICBPY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bmV3IFR5cGVFcnJvcignInNpemUiIGFyZ3VtZW50IG11c3QgYmUgb2YgdHlwZSBudW1iZXInKTsKICAgICAgICB9IGVsc2UgaWYgKHNpemUgPCAwKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcignVGhlIHZhbHVlICInICsgc2l6ZSArICciIGlzIGludmFsaWQgZm9yIG9wdGlvbiAic2l6ZSInKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYWxsb2Moc2l6ZSwgZmlsbCwgZW5jb2RpbmcpIHsKICAgICAgICBhc3NlcnRTaXplKHNpemUpOwogICAgICAgIGlmIChzaXplIDw9IDApIHsKICAgICAgICAgIHJldHVybiBjcmVhdGVCdWZmZXIoc2l6ZSk7CiAgICAgICAgfQogICAgICAgIGlmIChmaWxsICE9PSB2b2lkIDApIHsKICAgICAgICAgIHJldHVybiB0eXBlb2YgZW5jb2RpbmcgPT09ICJzdHJpbmciID8gY3JlYXRlQnVmZmVyKHNpemUpLmZpbGwoZmlsbCwgZW5jb2RpbmcpIDogY3JlYXRlQnVmZmVyKHNpemUpLmZpbGwoZmlsbCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBjcmVhdGVCdWZmZXIoc2l6ZSk7CiAgICAgIH0KICAgICAgQnVmZmVyMTAuYWxsb2MgPSBmdW5jdGlvbihzaXplLCBmaWxsLCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBhbGxvYyhzaXplLCBmaWxsLCBlbmNvZGluZyk7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGFsbG9jVW5zYWZlKHNpemUpIHsKICAgICAgICBhc3NlcnRTaXplKHNpemUpOwogICAgICAgIHJldHVybiBjcmVhdGVCdWZmZXIoc2l6ZSA8IDAgPyAwIDogY2hlY2tlZChzaXplKSB8IDApOwogICAgICB9CiAgICAgIEJ1ZmZlcjEwLmFsbG9jVW5zYWZlID0gZnVuY3Rpb24oc2l6ZSkgewogICAgICAgIHJldHVybiBhbGx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KCFCdWZmZXIxMC5pc0J1ZmZlcihhKSB8fCAhQnVmZmVyMTAuaXNCdWZmZXIoYikpIHsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1RoZSAiYnVmMSIsICJidWYyIiBhcmd1bWVudHMgbXVzdCBiZSBvbmUgb2YgdHlwZSBCdWZmZXIgb3IgVWludDhBcnJheScpOwogICAgICAgIH0KICAgICAgICBpZiAoYSA9PT0gYikKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIGxldCB4ID0gYS5sZW5ndGg7CiAgICAgICAgbGV0IHkgPSBiLmxlbmd0aDsKICAgICAgICBmb3IgKGxldCBpID0gMCwgbGVuID0gTWF0aC5taW4oeCwgeSk7IGkgPCBsZW47ICsraSkgewogICAgICAgICAgaWYgKGFbaV0gIT09IGJbaV0pIHsKICAgICAgICAgICAgeCA9IGFbaV07CiAgICAgICAgICAgIHkgPSBiW2ldOwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHggPCB5KQogICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIGlmICh5IDwgeCkKICAgICAgICAgIHJldHVybiAxOwogICAgICAgIHJldHVybiAwOwogICAgICB9OwogICAgICBCdWZmZXIxMC5pc0VuY29kaW5nID0gZnVuY3Rpb24gaXNFbmNvZGluZyhlbmNvZGluZykgewogICAgICAgIHN3aXRjaCAoU3RyaW5nKGVuY29kaW5nKS50b0xvd2VyQ2FzZSgpKSB7CiAgICAgICAgICBjYXNlICJoZXgiOgogICAgICAgICAgY2FzZSAidXRmOCI6CiAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICBjYXNlICJhc2NpaSI6CiAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgY2FzZSAiYmluYXJ5IjoKICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICBjYXNlICJ1Y3MyIjoKICAgICAgICAgIGNhc2UgInVjcy0yIjoKICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgY2FzZSAidXRmLTE2bGUiOgogICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIEJ1ZmZlcjEwLmNvbmNhdCA9IGZ1bmN0aW9uIGNvbmNhdChsaXN0LCBsZW5ndGgpIHsKICAgICAgICBpZiAoIUFycmF5LmlzQXJyYXkobGlzdCkpIHsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJyJsaXN0IiBhcmd1bWVudCBtdXN0IGJlIGFuIEFycmF5IG9mIEJ1ZmZlcnMnKTsKICAgICAgICB9CiAgICAgICAgaWYgKGxpc3QubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICByZXR1cm4gQnVmZmVyMTAuYWxsb2MoMCk7CiAgICAgICAgfQogICAgICAgIGxldCBpOwogICAgICAgIGlmIChsZW5ndGggPT09IHZvaWQgMCkgewogICAgICAgICAgbGVuZ3RoID0gMDsKICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgKytpKSB7CiAgICAgICAgICAgIGxlbmd0aCArPSBsaXN0W2ldLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgY29uc3QgYnVmZmVyID0gQnVmZmVyMTAuYWxsb2NVbnNhZmUobGVuZ3RoKTsKICAgICAgICBsZXQgcG9zID0gMDsKICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGlzdC5sZW5ndGg7ICsraSkgewogICAgICAgICAgbGV0IGJ1ZiA9IGxpc3RbaV07CiAgICAgICAgICBpZiAoaXNJbnN0YW5jZShidWYsIFVpbnQ4QXJyYXkpKSB7CiAgICAgICAgICAgIGlmIChwb3MgKyBidWYubGVuZ3RoID4gYnVmZmVyLmxlbmd0aCkgewogICAgICAgICAgICAgIGlmICghQnVmZmVyMTAuaXNCdW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XJyYXlCdWZmZXIuIFJlY2VpdmVkIHR5cGUgJyArIHR5cGVvZiBzdHJpbmcpOwogICAgICAgIH0KICAgICAgICBjb25zdCBsZW4gPSBzdHJpbmcubGVuZ3RoOwogICAgICAgIGNvbnN0IG11c3RNYXRjaCA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIGFyZ3VtZW50c1syXSA9PT0gdHJ1ZTsKICAgICAgICBpZiAoIW11c3RNYXRjaCAmJiBsZW4gPT09IDApCiAgICAgICAgICByZXR1cm4gMDsKICAgICAgICBsZXQgbG93ZXJlZENhc2UgPSBmYWxzZTsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBsZW47CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhUb0J5dGVzKHN0cmluZykubGVuZ3RoOwogICAgICAgICAgICBjYXNlICJ1Y3MyIjoKICAgICAgICAgICAgY2FzZSAidWNzLTIiOgogICAgICAgICAgICBjYXNlICJ1dGYxNmxlIjoKICAgICAgICAgICAgY2FzZSAidXRmLTE2bGUiOgogICAgICAgICAgICAgIHJldHVybiBsZW4gKiAyOwogICAgICAgICAgICBjYXNlICJoZXgiOgogICAgICAgICAgICAgIHJldHVybiBsZW4gPj4+IDE7CiAgICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICAgICAgcmV0dXJuIGJhc2U2NFRvQnl0ZXMoc3RyaW5nKS5sZW5ndGg7CiAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgaWYgKGxvd2VyZWRDYXNlKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbXVzdE1hdGNoID8gLTEgOiB1dGY4VG9CeXRlcyhzdHJpbmcpLmxlbmd0aDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgZW5jb2RpbmcgPSAoIiIgKyBlbmNvZGluZykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICBsb3dlcmVkQ2FzZSA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIEJ1ZmZlcjEwLmJ5dGVMZW5ndGggPSBieXRlTGVuZ3RoOwogICAgICBmdW5jdGlvbiBzbG93VG9TdHJpbmcoZW5jb2RpbmcsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgbG93ZXJlZENhc2UgPSBmYWxzZTsKICAgICAgICBpZiAoc3RhcnQgPT09IHZvaWQgMCB8fCBzdGFydCA8IDApIHsKICAgICAgICAgIHN0YXJ0ID0gMDsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0ID4gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICB9CiAgICAgICAgaWYgKGVuZCA9PT0gdm9pZCAwIHx8IGVuZCA+IHRoaXMubGVuZ3RoKSB7CiAgICAgICAgICBlbmQgPSB0aGlzLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgaWYgKGVuZCA8PSAwKSB7CiAgICAgICAgICByZXR1cm4gIiI7CiAgICAgICAgfQogICAgICAgIGVuZCA+Pj49IDA7CiAgICAgICAgc3RhcnQgPj4+PSAwOwogICAgICAgIGlmIChlbmQgPD0gc3RhcnQpIHsKICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICB9CiAgICAgICAgaWYgKCFlbmNvZGluZykKICAgICAgICAgIGVuY29kaW5nID0gInV0ZjgiOwogICAgICAgIHdoaWxlICh0cnVlKSB7CiAgICAgICAgICBzd2l0Y2ggKGVuY29kaW5nKSB7CiAgICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICAgICAgcmV0dXJuIGhleFNsaWNlKHRoaXMsIHN0YXJ0LCBlbmQpOwogICAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgICAgY2FzZSAidXRmLTgiOgogICAgICAgICAgICAgIHJldHVybiB1dGY4U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgImFzY2lpIjoKICAgICAgICAgICAgICByZXR1cm4gYXNjaWlTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAibGF0aW4xIjoKICAgICAgICAgICAgY2FzZSAiYmluYXJ5IjoKICAgICAgICAgICAgICByZXR1cm4gbGF0aW4xU2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICAgICAgcmV0dXJuIGJhc2U2NFNsaWNlKHRoaXMsIHN0YXJ0LCBlbmQpOwogICAgICAgICAgICBjYXNlICJ1Y3MyIjoKICAgICAgICAgICAgY2FzZSAidWNzLTIiOgogICAgICAgICAgICBjYXNlICJ1dGYxNmxlIjoKICAgICAgICAgICAgY2FzZSAidXRmLTE2bGUiOgogICAgICAgICAgICAgIHJldHVybiB1dGYxNmxlU2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgaWYgKGxvd2VyZWRDYXNlKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiVW5rbm93biBlbmNvZGluZzogIiArIGVuY29kaW5nKTsKICAgICAgICAgICAgICBlbmNvZGluZyA9IChlbmNvZGluZyArICIiKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgIGxvd2VyZWRDYXNlID0gdHJ1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLl9pc0J1ZmZlciA9IHRydWU7CiAgICAgIGZ1bmN0aW9uIHN3YXAoYiwgbiwgbSkgewogICAgICAgIGNv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c3QgYmUgb25lIG9mIHR5cGUgQnVmZmVyIG9yIFVpbnQ4QXJyYXkuIFJlY2VpdmVkIHR5cGUgJyArIHR5cGVvZiB0YXJnZXQpOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPT09IHZvaWQgMCkgewogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kID09PSB2b2lkIDApIHsKICAgICAgICAgIGVuZCA9IHRhcmdldCA/IHRhcmdldC5sZW5ndGggOiAwOwogICAgICAgIH0KICAgICAgICBpZiAodGhpc1N0YXJ0ID09PSB2b2lkIDApIHsKICAgICAgICAgIHRoaXNTdGFydCA9IDA7CiAgICAgICAgfQogICAgICAgIGlmICh0aGlzRW5kID09PSB2b2lkIDApIHsKICAgICAgICAgIHRoaXNFbmQgPSB0aGlzLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0IDwgMCB8fCBlbmQgPiB0YXJnZXQubGVuZ3RoIHx8IHRoaXNTdGFydCA8IDAgfHwgdGhpc0VuZCA+IHRoaXMubGVuZ3RoKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigib3V0IG9mIHJhbmdlIGluZGV4Iik7CiAgICAgICAgfQogICAgICAgIGlmICh0aGlzU3RhcnQgPj0gdGhpc0VuZCAmJiBzdGFydCA+PSBlbmQpIHsKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgICAgICBpZiAodGhpc1N0YXJ0ID49IHRoaXNFbmQpIHsKICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0ID49IGVuZCkgewogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIHN0YXJ0ID4+Pj0gMDsKICAgICAgICBlbmQgPj4+PSAwOwogICAgICAgIHRoaXNTdGFydCA+Pj49IDA7CiAgICAgICAgdGhpc0VuZCA+Pj49IDA7CiAgICAgICAgaWYgKHRoaXMgPT09IHRhcmdldCkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIGxldCB4ID0gdGhpc0VuZCAtIHRoaXNTdGFydDsKICAgICAgICBsZXQgeSA9IGVuZCAtIHN0YXJ0OwogICAgICAgIGNvbnN0IGxlbiA9IE1hdGgubWluKHgsIHkpOwogICAgICAgIGNvbnN0IHRoaXNDb3B5ID0gdGhpcy5zbGljZSh0aGlzU3RhcnQsIHRoaXNFbmQpOwogICAgICAgIGNvbnN0IHRhcmdldENvcHkgPSB0YXJnZXQuc2xpY2Uoc3RhcnQsIGVuZCk7CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsZW47ICsraSkgewogICAgICAgICAgaWYgKHRoaXNDb3B5W2ldICE9PSB0YXJnZXRDb3B5W2ldKSB7CiAgICAgICAgICAgIHggPSB0aGlzQ29weVtpXTsKICAgICAgICAgICAgeSA9IHRhcmdldENvcHlbaV07CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoeCA8IHkpCiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHkgPCB4KQogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgcmV0dXJuIDA7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGJpZGlyZWN0aW9uYWxJbmRleE9mKGJ1ZmZlciwgdmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZywgZGlyKSB7CiAgICAgICAgaWYgKGJ1ZmZlci5sZW5ndGggPT09IDApCiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHR5cGVvZiBieXRlT2Zmc2V0ID09PSAic3RyaW5nIikgewogICAgICAgICAgZW5jb2RpbmcgPSBieXRlT2Zmc2V0OwogICAgICAgICAgYnl0ZU9mZnNldCA9IDA7CiAgICAgICAgfSBlbHNlIGlmIChieXRlT2Zmc2V0ID4gMjE0NzQ4MzY0NykgewogICAgICAgICAgYnl0ZU9mZnNldCA9IDIxNDc0ODM2NDc7CiAgICAgICAgfSBlbHNlIGlmIChieXRlT2Zmc2V0IDwgLTIxNDc0ODM2NDgpIHsKICAgICAgICAgIGJ5dGVPZmZzZXQgPSAtMjE0NzQ4MzY0ODsKICAgICAgICB9CiAgICAgICAgYnl0ZU9mZnNldCA9ICtieXRlT2Zmc2V0OwogICAgICAgIGlmIChudW1iZXJJc05hTihieXRlT2Zmc2V0KSkgewogICAgICAgICAgYnl0ZU9mZnNldCA9IGRpciA/IDAgOiBidWZmZXIubGVuZ3RoIC0gMTsKICAgICAgICB9CiAgICAgICAgaWYgKGJ5dGVPZmZzZXQgPCAwKQogICAgICAgICAgYnl0ZU9mZnNldCA9IGJ1ZmZlci5sZW5ndGggKyBieXRlT2Zmc2V0OwogICAgICAgIGlmIChieXRlT2Zmc2V0ID49IGJ1ZmZlci5sZW5ndGgpIHsKICAgICAgICAgIGlmIChkaXIpCiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgIGVsc2UKICAgICAgICAgICAgYnl0ZU9mZnNldCA9IGJ1ZmZlci5sZW5ndGggLSAxOwogICAgICAgIH0gZWxzZSBpZiAoYnl0ZU9mZnNldCA8IDApIHsKICAgICAgICAgIGlmIChkaXIpCiAgICAgICAgICAgIGJ5dGVPZmZzZXQgPSAwOwogICAgICAgICAgZWxzZQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAic3RyaW5nIikgewogICAgICAgICAgdmFsID0gQnVmZmVyMTAuZnJvbSh2YWwsIGVuY29kaW5nKTsKICAgICAgICB9CiAgICAgICAgaWYgKEJ1ZmZlcjEwLmlzQnVmZmVyKHZhbCkpIHsKICAgICAgICAgIGlmICh2YWwubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBhcnJheUluZGV4T2YoYnVmZmVyLCB2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5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fCBlbmNvZGluZyA9PT0gInVjcy0yIiB8fCBlbmNvZGluZyA9PT0gInV0ZjE2bGUiIHx8IGVuY29kaW5nID09PSAidXRmLTE2bGUiKSB7CiAgICAgICAgICAgIGlmIChhcnIubGVuZ3RoIDwgMiB8fCB2YWwubGVuZ3RoIDwgMikgewogICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpbmRleFNpemUgPSAyOwogICAgICAgICAgICBhcnJMZW5ndGggLz0gMjsKICAgICAgICAgICAgdmFsTGVuZ3RoIC89IDI7CiAgICAgICAgICAgIGJ5dGVPZmZzZXQgLz0gMjsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcmVhZChidWYsIGkyKSB7CiAgICAgICAgICBpZiAoaW5kZXhTaXplID09PSAxKSB7CiAgICAgICAgICAgIHJldHVybiBidWZbaTJdOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIGJ1Zi5yZWFkVUludDE2QkUoaTIgKiBpbmRleFNpemUpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBsZXQgaTsKICAgICAgICBpZiAoZGlyKSB7CiAgICAgICAgICBsZXQgZm91bmRJbmRleCA9IC0xOwogICAgICAgICAgZm9yIChpID0gYnl0ZU9mZnNldDsgaSA8IGFyckxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIGlmIChyZWFkKGFyciwgaSkgPT09IHJlYWQodmFsLCBmb3VuZEluZGV4ID09PSAtMSA/IDAgOiBpIC0gZm91bmRJbmRleCkpIHsKICAgICAgICAgICAgICBpZiAoZm91bmRJbmRleCA9PT0gLTEpCiAgICAgICAgICAgICAgICBmb3VuZEluZGV4ID0gaTsKICAgICAgICAgICAgICBpZiAoaSAtIGZvdW5kSW5kZXggKyAxID09PSB2YWxMZW5ndGgpCiAgICAgICAgICAgICAgICByZXR1cm4gZm91bmRJbmRleCAqIGluZGV4U2l6ZTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBpZiAoZm91bmRJbmRleCAhPT0gLTEpCiAgICAgICAgICAgICAgICBpIC09IGkgLSBmb3VuZEluZGV4OwogICAgICAgICAgICAgIGZvdW5kSW5kZXggPSAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAoYnl0ZU9mZnNldCArIHZhbExlbmd0aCA+IGFyckxlbmd0aCkKICAgICAgICAgICAgYnl0ZU9mZnNldCA9IGFyckxlbmd0aCAtIHZhbExlbmd0aDsKICAgICAgICAgIGZvciAoaSA9IGJ5dGVPZmZzZXQ7IGkgPj0gMDsgaS0tKSB7CiAgICAgICAgICAgIGxldCBmb3VuZCA9IHRydWU7CiAgICAgICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgdmFsTGVuZ3RoOyBqKyspIHsKICAgICAgICAgICAgICBpZiAocmVhZChhcnIsIGkgKyBqKSAhPT0gcmVhZCh2YWwsIGopKSB7CiAgICAgICAgICAgICAgICBmb3VuZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChmb3VuZCkKICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIC0xOwogICAgICB9CiAgICAgIEJ1ZmZlcjEwLnByb3RvdHlwZS5pbmNsdWRlcyA9IGZ1bmN0aW9uIGluY2x1ZGVzKHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcpIHsKICAgICAgICByZXR1cm4gdGhpcy5pbmRleE9mKHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcpICE9PSAtMTsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLmluZGV4T2YgPSBmdW5jdGlvbiBpbmRleE9mKHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcpIHsKICAgICAg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ICAgICAgIGVuY29kaW5nID0gInV0ZjgiOwogICAgICAgICAgbGVuZ3RoID0gdGhpcy5sZW5ndGg7CiAgICAgICAgICBvZmZzZXQgPSAwOwogICAgICAgIH0gZWxzZSBpZiAobGVuZ3RoID09PSB2b2lkIDAgJiYgdHlwZW9mIG9mZnNldCA9PT0gInN0cmluZyIpIHsKICAgICAgICAgIGVuY29kaW5nID0gb2Zmc2V0OwogICAgICAgICAgbGVuZ3RoID0gdGhpcy5sZW5ndGg7CiAgICAgICAgICBvZmZzZXQgPSAwOwogICAgICAgIH0gZWxzZSBpZiAoaXNGaW5pdGUob2Zmc2V0KSkgewogICAgICAgICAgb2Zmc2V0ID0gb2Zmc2V0ID4+PiAwOwogICAgICAgICAgaWYgKGlzRmluaXRlKGxlbmd0aCkpIHsKICAgICAgICAgICAgbGVuZ3RoID0gbGVuZ3RoID4+PiAwOwogICAgICAgICAgICBpZiAoZW5jb2RpbmcgPT09IHZvaWQgMCkKICAgICAgICAgICAgICBlbmNvZGluZyA9ICJ1dGY4IjsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGVuY29kaW5nID0gbGVuZ3RoOwogICAgICAgICAgICBsZW5ndGggPSB2b2lkIDA7CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcigiQnVmZmVyLndyaXRlKHN0cmluZywgZW5jb2RpbmcsIG9mZnNldFssIGxlbmd0aF0pIGlzIG5vIGxvbmdlciBzdXBwb3J0ZWQiKTsKICAgICAgICB9CiAgICAgICAgY29uc3QgcmVtYWluaW5nID0gdGhpcy5sZW5ndGggLSBvZmZzZXQ7CiAgICAgICAgaWYgKGxlbmd0aCA9PT0gdm9pZCAwIHx8IGxlbmd0aCA+IHJlbWFpbmluZykKICAgICAgICAgIGxlbmd0aCA9IHJlbWFpbmluZzsKICAgICAgICBpZiAoc3RyaW5nLmxlbmd0aCA+IDAgJiYgKGxlbmd0aCA8IDAgfHwgb2Zmc2V0IDwgMCkgfHwgb2Zmc2V0ID4gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJBdHRlbXB0IHRvIHdyaXRlIG91dHNpZGUgYnVmZmVyIGJvdW5kcyIpOwogICAgICAgIH0KICAgICAgICBpZiAoIWVuY29kaW5nKQogICAgICAgICAgZW5jb2RpbmcgPSAidXRmOCI7CiAgICAgICAgbGV0IGxvd2VyZWRDYXNlID0gZmFsc2U7CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBzd2l0Y2ggKGVuY29kaW5nKSB7CiAgICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICAgICAgcmV0dXJuIGhleFdyaXRlKHRoaXMsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpOwogICAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgICAgY2FzZSAidXRmLTgiOgogICAgICAgICAgICAgIHJldHVybiB1dGY4V3JpdGUodGhpcywgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCk7CiAgICAgICAgICAgIGNhc2UgImFzY2lpIjoKICAgICAgICAgICAgY2FzZSAibGF0aW4xIjoKICAgICAgICAgICAgY2FzZSAiYmluYXJ5IjoKICAgICAgICAgICAgICByZXR1cm4gYXNjaWlXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0V3JpdGUodGhpcywgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCk7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIHVjczJXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgICAgIGVuY29kaW5nID0gKCIiICsgZW5jb2RpbmcpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgbG93ZXJlZENhc2UgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnRvSlNPTiA9IGZ1bmN0aW9uIHRvSlNPTigpIHsKICAgICAgICByZXR1cm4gewogICAgICAgICAgdHlwZTogIkJ1ZmZlciIsCiAgICAgICAgICBkYXRhOiBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbCh0aGlzLl9hcnIgfHwgdGhpcywgMCkKICAgICAgICB9OwogICAgICB9OwogICAgICBmdW5jdGlvbiBiYXNlNjRTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBpZiAoc3RhcnQgPT09IDAgJiYgZW5kID09PSBidWYubGVuZ3RoKSB7CiAgICAgICAgICByZXR1cm4gYmFzZTY0LmZyb21CeXRlQXJyYXkoYnVmKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgcmV0dXJuIGJhc2U2NC5mcm9tQnl0ZUFycmF5KGJ1Zi5zbGljZShzdGFydCwgZW5kKSk7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIHV0ZjhTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBlbmQgPSBNYXRoLm1pbihidWYubGVuZ3RoLCBlbmQpOwogICAgICAgIGNvbnN0IHJlcyA9IFtdOwogICAgICAgIGxldCBpID0gc3RhcnQ7CiAgICAgICAgd2hpbGUgKGkgPCBlbmQpIHsKICAgICAgICAgIGNvbnN0IGZpcnN0Qnl0ZSA9IGJ1ZltpXTsKICAgICAgICAgIGxldCBjb2RlUG9pbnQgPSBudWxsOwogICAgICAgICAgbGV0IGJ5dGVzUGVyU2VxdWVuY2UgPSBmaXJzdEJ5dGUgPiAyMzkgPyA0IDogZmlyc3RCeXRlID4gMjIzID8gMyA6IGZpcnN0Qnl0ZSA+IDE5MSA/IDIgOiAxOwogICAgICAgICAgaWYgKGkgKyBieXRlc1BlclNlcXVlbmNlIDw9IGVuZCkgewogICAgICAgICAgICBsZXQgc2Vjb25kQnl0ZSwgdGhpcmRCeXRlLCBmb3VydGhCeXRlLCB0ZW1wQ29kZVBvaW50OwogICAgICAgICAgICBzd2l0Y2ggKGJ5dGVzUGVyU2VxdWVuY2UpIHsKICAgICAgICAgICAgICBjYXNlIDE6CiAgICAgICAgICAgICAgICBpZiAoZmlyc3RCeXRlIDwgMTI4KSB7CiAgICAgICAgICAgICAgICAgIGNvZGVQb2ludCA9IGZpcnN0Qnl0ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgIHNlY29uZEJ5dGUgPSBidWZbaSArIDFdOwogICAgICAgICAgICAgICAgaWYgKChzZWNvbmRCeXRlICYgMTkyKSA9PT0gMTI4KSB7CiAgICAgICAgICAgICAgICAgIHRlbXBDb2RlUG9pbnQgPSAoZmlyc3RCeXRlICYgMzEpIDw8IDYgfCBzZWNvbmRCeXRlICYgNjM7CiAgICAgICAgICAgICAgICAgIGlmICh0ZW1wQ29kZVBvaW50ID4gMTI3KSB7CiAgICAgICAgICAgICAgICAgICAgY29kZVBvaW50ID0gdGVtcENvZGVQb2ludDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgc2Vjb25kQnl0ZSA9IGJ1ZltpICsgMV07CiAgICAgICAgICAgICAgICB0aGlyZEJ5dGUgPSBidWZbaSArIDJdOwogICAgICAgICAgICAgICAgaWYgKChzZWNvbmRCeXRlICYgMTkyKSA9PT0gMTI4ICYmICh0aGlyZEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAxNSkgPDwgMTIgfCAoc2Vjb25kQnl0ZSAmIDYzKSA8PCA2IHwgdGhpcmRCeXRlICYgNjM7CiAgICAgICAgICAgICAgICAgIGlmICh0ZW1wQ29kZVBvaW50ID4gMjA0NyAmJiAodGVtcENvZGVQb2ludCA8IDU1Mjk2IHx8IHRlbXBDb2RlUG9pbnQgPiA1NzM0MykpIHsKICAgICAgICAgICAgICAgICAgICBjb2RlUG9pbnQgPSB0ZW1wQ29kZVBvaW50OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICBzZWNvbmRCeXRlID0gYnVmW2kgKyAxXTsKICAgICAgICAgICAgICAgIHRoaXJkQnl0ZSA9IGJ1ZltpICsgMl07CiAgICAgICAgICAgICAgICBmb3VydGhCeXRlID0gYnVmW2kgKyAzXTsKICAgICAgICAgICAgICAgIGlmICgoc2Vjb25kQnl0ZSAmIDE5MikgPT09IDEyOCAmJiAodGhpcmRCeXRlICYgMTkyKSA9PT0gMTI4ICYmIChmb3VydGhCeXRlICYgMTkyKSA9PT0gMTI4KSB7CiAgICAgICAgICAgICAgICAgIHRlbXBDb2RlUG9pbnQgPSAoZmlyc3RCeXRlICYgMTUpIDw8IDE4IHwgKHNlY29uZEJ5dGUgJiA2MykgPDwgMTIgfCAodGhpcmRCeXRlICYgNjMpIDw8IDYgfCBmb3VydGhCeXRlICYgNjM7CiAgICAgICAgICAgICAgICAgIGlmICh0ZW1wQ29kZVBvaW50ID4gNjU1MzUgJiYgdGVtcENvZGVQb2ludCA8IDExMTQxMTIpIHsKICAgICAgICAgICAgICAgICAgICBjb2RlUG9pbnQgPSB0ZW1wQ29kZVBvaW50OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChjb2RlUG9pbnQgPT09IG51bGwpIHsKICAgICAgICAgICAgY29kZVBvaW50ID0gNjU1MzM7CiAgICAgICAgICAgIGJ5dGVzUGVyU2VxdWVuY2UgPSAxOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPiA2NTUzNSkgewogICAgICAgICAgICBjb2RlUG9pbnQgLT0gNjU1MzY7CiAgICAgICAgICAgIHJlcy5wdXNoKGNvZGVQb2ludCA+Pj4gMTAgJiAxMDIzIHwgNTUyOTYpOwogICAgICAgICAgICBjb2RlUG9pbnQgPSA1NjMyMCB8IGNvZGVQb2ludCAmIDEwMjM7CiAgICAgICAgICB9CiAgICAgICAgICByZXMucHVzaChjb2RlUG9pbnQpOwogICAgICAgICAgaSArPSBieXRlc1BlclNlcXVlbmNlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gZGVjb2RlQ29kZVBvaW50c0FycmF5KHJlcyk7CiAgICAgIH0KICAgICAgdmFyIE1BWF9BUkdVTUVOVFNfTEVOR1RIID0gNDA5NjsKICAgICAgZnVuY3Rpb24gZGVjb2RlQ29kZVBvaW50c0FycmF5KGNvZGVQb2ludHMpIHsKICAgICAgICBjb25zdCBsZW4gPSBjb2RlUG9pbnRzLmxlbmd0aDsKICAgICAgICBpZiAobGVuIDw9IE1BWF9BUkdVTUVOVFNfTEVOR1RIKSB7CiAgICAgICAgICByZXR1cm4gU3RyaW5nLmZyb21DaGFyQ29kZS5hcHBseShTdHJpbmcsIGNvZGVQb2ludHMpOwogICAgICAgIH0KICAgICAgICBsZXQgcmVzID0gIiI7CiAgICAgICAgbGV0IGkgPSAwOwogICAgICAgIHdoaWxlIChpIDwgbGVuKSB7CiAgICAgICAgICBy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yIChsZXQgaSA9IHN0YXJ0OyBpIDwgZW5kOyArK2kpIHsKICAgICAgICAgIG91dCArPSBoZXhTbGljZUxvb2t1cFRhYmxlW2J1ZltpXV07CiAgICAgICAgfQogICAgICAgIHJldHVybiBvdXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdXRmMTZsZVNsaWNlKGJ1Ziwgc3RhcnQsIGVuZCkgewogICAgICAgIGNvbnN0IGJ5dGVzID0gYnVmLnNsaWNlKHN0YXJ0LCBlbmQpOwogICAgICAgIGxldCByZXMgPSAiIjsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGJ5dGVzLmxlbmd0aCAtIDE7IGkgKz0gMikgewogICAgICAgICAgcmVzICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnl0ZXNbaV0gKyBieXRlc1tpICsgMV0gKiAyNTYpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmVzOwogICAgICB9CiAgICAgIEJ1ZmZlcjEwLnByb3RvdHlwZS5zbGljZSA9IGZ1bmN0aW9uIHNsaWNlKHN0YXJ0LCBlbmQpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBzdGFydCA9IH5+c3RhcnQ7CiAgICAgICAgZW5kID0gZW5kID09PSB2b2lkIDAgPyBsZW4gOiB+fmVuZDsKICAgICAgICBpZiAoc3RhcnQgPCAwKSB7CiAgICAgICAgICBzdGFydCArPSBsZW47CiAgICAgICAgICBpZiAoc3RhcnQgPCAwKQogICAgICAgICAgICBzdGFydCA9IDA7CiAgICAgICAgfSBlbHNlIGlmIChzdGFydCA+IGxlbikgewogICAgICAgICAgc3RhcnQgPSBsZW47CiAgICAgICAgfQogICAgICAgIGlmIChlbmQgPCAwKSB7CiAgICAgICAgICBlbmQgKz0gbGVuOwogICAgICAgICAgaWYgKGVuZCA8IDApCiAgICAgICAgICAgIGVuZCA9IDA7CiAgICAgICAgfSBlbHNlIGlmIChlbmQgPiBsZW4pIHsKICAgICA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gICAgIGxldCBpID0gYnl0ZUxlbmd0aDI7CiAgICAgICAgbGV0IG11bCA9IDE7CiAgICAgICAgbGV0IHZhbCA9IHRoaXNbb2Zmc2V0ICsgLS1pXTsKICAgICAgICB3aGlsZSAoaSA+IDAgJiYgKG11bCAqPSAyNTYpKSB7CiAgICAgICAgICB2YWwgKz0gdGhpc1tvZmZzZXQgKyAtLWldICogbXVsOwogICAgICAgIH0KICAgICAgICBtdWwgKj0gMTI4OwogICAgICAgIGlmICh2YWwgPj0gbXVsKQogICAgICAgICAgdmFsIC09IE1hdGgucG93KDIsIDggKiBieXRlTGVuZ3RoMik7CiAgICAgICAgcmV0dXJuIHZhbDsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnJlYWRJbnQ4ID0gZnVuY3Rpb24gcmVhZEludDgob2Zmc2V0LCBub0Fzc2VydCkgewogICAgICAgIG9mZnNldCA9IG9mZnNldCA+Pj4gMDsKICAgICAgICBpZiAoIW5vQXNzZXJ0KQogICAgICAgICAgY2hlY2tPZmZzZXQob2Zmc2V0LCAxLCB0aGlzLmxlbmd0aCk7CiAgICAgICAgaWYgKCEodGhpc1tvZmZzZXRdICYgMTI4KSkKICAgICAgICAgIHJldHVybiB0aGlzW29mZnNldF07CiAgICAgICAgcmV0dXJuICgyNTUgLSB0aGlzW29mZnNldF0gKyAxKSAqIC0xOwogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUucmVhZEludDE2TEUgPSBmdW5jdGlvbiByZWFkSW50MTZMRShvZmZzZXQsIG5vQXNzZXJ0KSB7CiAgICAgICAgb2Zmc2V0ID0gb2Zmc2V0ID4+PiAwOwogICAgICAgIGlmICghbm9Bc3NlcnQpCiAgICAgICAgICBjaGVja09mZnNldChvZmZzZXQsIDIsIHRoaXMubGVuZ3RoKTsKICAgICAgICBjb25zdCB2YWwgPSB0aGlzW29mZnNldF0gfCB0aGlzW29mZnNldCArIDFdIDw8IDg7CiAgICAgICAgcmV0dXJuIH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QogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIGlmICghZW5kICYmIGVuZCAhPT0gMCkKICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgIGlmICh0YXJnZXRTdGFydCA+PSB0YXJnZXQubGVuZ3RoKQogICAgICAgICAgdGFyZ2V0U3RhcnQgPSB0YXJnZXQubGVuZ3RoOwogICAgICAgIGlmICghdGFyZ2V0U3RhcnQpCiAgICAgICAgICB0YXJnZXRTdGFydCA9IDA7CiAgICAgICAgaWYgKGVuZCA+IDAgJiYgZW5kIDwgc3RhcnQpCiAgICAgICAgICBlbmQgPSBzdGFydDsKICAgICAgICBpZiAoZW5kID09PSBzdGFydCkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIGlmICh0YXJnZXQubGVuZ3RoID09PSAwIHx8IHRoaXMubGVuZ3RoID09PSAwKQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgaWYgKHRhcmdldFN0YXJ0IDwgMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoInRhcmdldFN0YXJ0IG91dCBvZiBib3VuZHMiKTsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0IDwgMCB8fCBzdGFydCA+PSB0aGlzLmxlbmd0aCkKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJJbmRleCBvdXQgb2YgcmFuZ2UiKTsKICAgICAgICBpZiAoZW5kIDwgMCkKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJzb3VyY2VFbmQgb3V0IG9mIGJvdW5kcyIpOwogICAgICAgIGlmIChlbmQgPiB0aGlzLmxlbmd0aCkKICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgIGlmICh0YXJnZXQubGVuZ3RoIC0gdGFyZ2V0U3RhcnQgPCBlbmQgLSBzdGFydCkgewogICAgICAgICAgZW5kID0gdGFyZ2V0Lmxlbmd0aCAtIHRhcmdldFN0YXJ0ICsgc3RhcnQ7CiAgICAgICAgfQogICAgICAgIGNvbnN0IGxlbiA9IGVuZCAtIHN0YXJ0OwogICAgICAgIGlmICh0aGlzID09PSB0YXJnZXQgJiYgdHlwZW9mIFVpbnQ4QXJyYXkucHJvdG90eXBlLmNvcHlXaXRoaW4gPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgIHRoaXMuY29weVdpdGhpbih0YXJnZXRTdGFydCwgc3RhcnQsIGVuZCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIFVpbnQ4QXJyYXkucHJvdG90eXBlLnNldC5jYWxsKHRhcmdldCwgdGhpcy5zdWJhcnJheShzdGFydCwgZW5kKSwgdGFyZ2V0U3RhcnQpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gbGVuOwogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUuZmlsbCA9IGZ1bmN0aW9uIGZpbGwodmFsLCBzdGFydCwgZW5kLCBlbmNvZGluZykgewogICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAic3RyaW5nIikgewogICAgICAgICAgaWYgKHR5cGVvZiBzdGFydCA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgZW5jb2RpbmcgPSBzdGFydDsKICAgICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgICAgICBlbmQgPSB0aGlzLmxlbmd0aDsKICAgICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIGVuZCA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgZW5jb2RpbmcgPSBlbmQ7CiAgICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGVuY29kaW5nICE9PSB2b2lkIDAgJiYgdHlwZW9mIGVuY29kaW5nICE9PSAic3RyaW5nIikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJlbmNvZGluZyBtdXN0IGJlIGEgc3RyaW5nIik7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodHlwZW9mIGVuY29kaW5nID09PSAic3RyaW5nIiAmJiAhQnVmZmVyMTAuaXNFbmNvZGluZyhlbmNvZGluZykpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiVW5rbm93biBlbmNvZGluZzogIiArIGVuY29kaW5nKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh2YWwubGVuZ3RoID09PSAxKSB7CiAgICAgICAgICAgIGNvbnN0IGNvZGUgPSB2YWwuY2hhckNvZGVBdCgwKTsKICAgICAgICAgICAgaWYgKGVuY29kaW5nID09PSAidXRmOCIgJiYgY29kZSA8IDEyOCB8fCBlbmNvZGluZyA9PT0gImxhdGluMSIpIHsKICAgICAgICAgICAgICB2YWwgPSBjb2RlOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgdmFsID0gdmFsICYgMjU1OwogICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIHZhbCA9PT0gImJvb2xlYW4iKSB7CiAgICAgICAgICB2YWwgPSBOdW1iZXIodmFsKTsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0IDwgMCB8fCB0aGlzLmxlbmd0aCA8IHN0YXJ0IHx8IHRoaXMubGVuZ3RoIDwgZW5kKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigiT3V0IG9mIHJhbmdlIGluZGV4Iik7CiAgICAgICAgfQogICAgICAgIGlmIChlbmQgPD0gc3RhcnQpIHsKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIH0KICAgICAgICBzdGFydCA9IHN0YXJ0ID4+PiAwOwogICAgICAgIGVuZCA9IGVuZCA9PT0gdm9pZCAwID8gdGhpcy5sZW5ndGggOiBlbmQgPj4+IDA7CiAgICAgICAgaWYgKCF2YWwpCiAgICAgICAgICB2YWwgPSAwOwogICAgICAgIGxldCBpOwogICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgZm9yIChpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgICB0aGlzW2ldID0gdmFsOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBjb25zdCBieXRlcyA9IEJ1ZmZlcjEwLmlzQnVmZmVyKHZhbCkgPyB2YWwgOiBCdWZmZXIxMC5mcm9tKHZhbCwgZW5jb2RpbmcpOwogICAgICAgICAgY29uc3QgbGVuID0gYnl0ZXMubGVuZ3RoOwogICAgICAgICAgaWYgKGxlbiA9PT0gMCkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdUaGUgdmFsdWUgIicgKyB2YWwgKyAnIiBpcyBpbnZhbGlkIGZvciBhcmd1bWVudCAidmFsdWUiJyk7CiAgICAgICAgICB9CiAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgZW5kIC0gc3RhcnQ7ICsraSkgewogICAgICAgICAgICB0aGlzW2kgKyBzdGFydF0gPSBieXRlc1tpICUgbGVuXTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgIH07CiAgICAgIHZhciBlcnJvcnMgPSB7fTsKICAgICAgZnVuY3Rpb24gRShzeW0sIGdldE1lc3NhZ2UsIEJhc2UpIHsKICAgICAgICBlcnJvcnNbc3ltXSA9IGNsYXNzIE5vZGVFcnJvciBleHRlbmRzIEJhc2UgewogICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCAibWVzc2FnZSIsIHsKICAgICAgICAgICAgICB2YWx1ZTogZ2V0TWVzc2FnZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpLAogICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlLAogICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdGhpcy5uYW1lID0gYCR7dGhpcy5uYW1lfSBbJHtzeW19XWA7CiAgICAgICAgICAgIHRoaXMuc3RhY2s7CiAgICAgICAgICAgIGRlbGV0ZSB0aGlzLm5hbWU7CiAgICAgICAgICB9CiAgICAgICAgICBnZXQgY29kZSgpIHsKICAgICAgICAgICAgcmV0dXJuIHN5bTsKICAgICAgICAgIH0KICAgICAgICAgIHNldCBjb2RlKHZhbHVlKSB7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCAiY29kZSIsIHsKICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICB2YWx1ZSwKICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICAgIHRvU3RyaW5nKCkgewogICAgICAgICAgICByZXR1cm4gYCR7dGhpcy5uYW1lfSBbJHtzeW19XTogJHt0aGlzLm1lc3NhZ2V9YDsKICAgICAgICAgIH0KICAgICAgICB9OwogICAgICB9CiAgICAgIEUoIkVSUl9CVUZGRVJfT1VUX09GX0JPVU5EUyIsIGZ1bmN0aW9uKG5hbWUpIHsKICAgICAgICBpZiAobmFtZSkgewogICAgICAgICAgcmV0dXJuIGAke25hbWV9IGlzIG91dHNpZGUgb2YgYnVmZmVyIGJvdW5kc2A7CiAgICAgICAgfQogICAgICAgIHJldHVybiAiQXR0ZW1wdCB0byBhY2Nlc3MgbWVtb3J5IG91dHNpZGUgYnVmZmVyIGJvdW5kcyI7CiAgICAgIH0sIFJhbmdlRXJyb3IpOwogICAgICBFKCJFUlJfSU5WQUxJRF9BUkdfVFlQRSIsIGZ1bmN0aW9uKG5hbWUsIGFjdHVhbCkgewogICAgICAgIHJldHVybiBgVGhlICIke25hbWV9IiBhcmd1bWVudCBtdXN0IGJlIG9mIHR5cG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kVSUl9PVVRfT0ZfUkFOR0UodHlwZSB8fCAib2Zmc2V0IiwgYD49ICR7dHlwZSA/IDEgOiAwfSBhbmQgPD0gJHtsZW5ndGh9YCwgdmFsdWUpOwogICAgICB9CiAgICAgIHZhciBJTlZBTElEX0JBU0U2NF9SRSA9IC9bXisvMC05QS1aYS16LV9dL2c7CiAgICAgIGZ1bmN0aW9uIGJhc2U2NGNsZWFuKHN0cikgewogICAgICAgIHN0ciA9IHN0ci5zcGxpdCgiPSIpWzBdOwogICAgICAgIHN0ciA9IHN0ci50cmltKCkucmVwbGFjZShJTlZBTElEX0JBU0U2NF9SRSwgIiIpOwogICAgICAgIGlmIChzdHIubGVuZ3RoIDwgMikKICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICB3aGlsZSAoc3RyLmxlbmd0aCAlIDQgIT09IDApIHsKICAgICAgICAgIHN0ciA9IHN0ciArICI9IjsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHN0cjsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGY4VG9CeXRlcyhzdHJpbmcsIHVuaXRzKSB7CiAgICAgICAgdW5pdHMgPSB1bml0cyB8fCBJbmZpbml0eTsKICAgICAgICBsZXQgY29kZVBvaW50OwogICAgICAgIGNvbnN0IGxlbmd0aCA9IHN0cmluZy5sZW5ndGg7CiAgICAgICAgbGV0IGxlYWRTdXJyb2dhdGUgPSBudWxsOwogICAgICAgIGNvbnN0IGJ5dGVzID0gW107CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsZW5ndGg7ICsraSkgewogICAgICAgICAgY29kZVBvaW50ID0gc3RyaW5nLmNoYXJDb2RlQXQoaSk7CiAgICAgICAgICBpZiAoY29kZVBvaW50ID4gNTUyOTUgJiYgY29kZVBvaW50IDwgNTczNDQpIHsKICAgICAgICAgICAgaWYgKCFsZWFkU3Vycm9nYXRlKSB7CiAgICAgICAgICAgICAgaWYgKGNvZGVQb2ludCA+IDU2MzE5KSB7CiAgICAgICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpCiAgICAgICAgICAgICAgICAgIGJ5dGVzLnB1c2goMjM5LCAxOTEsIDE4OSk7CiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICB9IGVsc2UgaWYgKGkgKyAxID09PSBsZW5ndGgpIHsKICAgICAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkKICAgICAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50OwogICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChjb2RlUG9pbnQgPCA1NjMyMCkgewogICAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkKICAgICAgICAgICAgICAgIGJ5dGVzLnB1c2goMjM5LCAxOTEsIDE4OSk7CiAgICAgICAgICAgICAgbGVhZFN1cnJvZ2F0ZSA9IGNvZGVQb2ludDsKICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjb2RlUG9pbnQgPSAobGVhZFN1cnJvZ2F0ZSAtIDU1Mjk2IDw8IDEwIHwgY29kZVBvaW50IC0gNTYzMjApICsgNjU1MzY7CiAgICAgICAgICB9IGVsc2UgaWYgKGxlYWRTdXJyb2dhdGUpIHsKICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgIGJ5dGVzLnB1c2goMjM5LCAxOTEsIDE4OSk7CiAgICAgICAgICB9CiAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gbnVsbDsKICAgICAgICAgIGlmIChjb2RlUG9pbnQgPCAxMjgpIHsKICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAxKSA8IDApCiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIGJ5dGVzLnB1c2goY29kZVBvaW50KTsKICAgICAgICAgIH0gZWxzZSBpZiAoY29kZVBvaW50IDwgMjA0OCkgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDIpIDwgMCkKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgYnl0ZXMucHVzaChjb2RlUG9pbnQgPj4gNiB8IDE5MiwgY29kZVBvaW50ICYgNjMgfCAxMjgpOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPCA2NTUzNikgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpIDwgMCkKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgYnl0ZXMucHVzaChjb2RlUG9pbnQgPj4gMTIgfCAyMjQsIGNvZGVQb2ludCA+PiA2ICYgNjMgfCAxMjgsIGNvZGVQb2ludCAmIDYzIHwgMTI4KTsKICAgICAgICAgIH0gZWxzZSBpZiAoY29kZVBvaW50IDwgMTExNDExMikgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDQpIDwgMCkKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgYnl0ZXMucHVzaChjb2RlUG9pbnQgPj4gMTggfCAyNDAsIGNvZGVQb2ludCA+PiAxMiAmIDYzIHwgMTI4LCBjb2RlUG9pbnQgPj4gNiAmIDYzIHwgMTI4LCBjb2RlUG9pbnQgJiA2MyB8IDEyOCk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgY29kZSBwb2ludCIpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gYnl0ZXM7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYXNjaWlUb0J5dGVzKHN0cikgewogICAgICAgIGNvbnN0IGJ5dGVBcnJheSA9IFtdOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgKytpKSB7CiAgICAgICAgICBieXRlQXJyYXkucHVzaChzdHIuY2hhckNvZGVBdChpKSAmIDI1NSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBieXRlQXJyYXk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdXRmMTZsZVRvQnl0ZXMoc3RyLCB1bml0cykgewogICAgICAgIGxldCBjLCBoaSwgbG87CiAgICAgICAgY29uc3QgYnl0ZUFycmF5ID0gW107CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBzdHIubGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGlmICgodW5pdHMgLT0gMikgPCAwKQogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGMgPSBzdHIuY2hhckNvZGVBdChpKTsKICAgICAgICAgIGhpID0gYyA+PiA4OwogICAgICAgICAgbG8gPSBjICUgMjU2OwogICAgICAgICAgYnl0ZUFycmF5LnB1c2gobG8pOwogICAgICAgICAgYnl0ZUFycmF5LnB1c2goaGkpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gYnl0ZUFycmF5OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJhc2U2NFRvQnl0ZXMoc3RyKSB7CiAgICAgICAgcmV0dXJuIGJhc2U2NC50b0J5dGVBcnJheShiYXNlNjRjbGVhbihzdHIpKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBibGl0QnVmZmVyKHNyYywgZHN0LCBvZmZzZXQsIGxlbmd0aCkgewogICAgICAgIGxldCBpOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW5ndGg7ICsraSkgewogICAgICAgICAgaWYgKGkgKyBvZmZzZXQgPj0gZHN0Lmxlbmd0aCB8fCBpID49IHNyYy5sZW5ndGgpCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgZHN0W2kgKyBvZmZzZXRdID0gc3JjW2ldOwogICAgICAgIH0KICAgICAgICByZXR1cm4gaTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpc0luc3RhbmNlKG9iaiwgdHlwZSkgewogICAgICAgIHJldHVybiBvYmogaW5zdGFuY2VvZiB0eXBlIHx8IG9iaiAhPSBudWxsICYmIG9iai5jb25zdHJ1Y3RvciAhPSBudWxsICYmIG9iai5jb25zdHJ1Y3Rvci5uYW1lICE9IG51bGwgJiYgb2JqLmNvbnN0cnVjdG9yLm5hbWUgPT09IHR5cGUubmFtZTsKICAgICAgfQogICAgICBmdW5jdGlvbiBudW1iZXJJc05hTihvYmopIHsKICAgICAgICByZXR1cm4gb2JqICE9PSBvYmo7CiAgICAgIH0KICAgICAgdmFyIGhleFNsaWNlTG9va3VwVGFibGUgPSBmdW5jdGlvbigpIHsKICAgICAgICBjb25zdCBhbHBoYWJldCA9ICIwMTIzNDU2Nzg5YWJjZGVmIjsKICAgICAgICBjb25zdCB0YWJsZSA9IG5ldyBBcnJheSgyNTYpOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgMTY7ICsraSkgewogICAgICAgICAgY29uc3QgaTE2ID0gaSAqIDE2OwogICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCAxNjsgKytqKSB7CiAgICAgICAgICAgIHRhYmxlW2kxNiArIGpdID0gYWxwaGFiZXRbaV0gKyBhbHBoYWJldFtqXTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRhYmxlOwogICAgICB9KCk7CiAgICAgIGZ1bmN0aW9uIGRlZmluZUJpZ0ludE1ldGhvZChmbikgewogICAgICAgIHJldHVybiB0eXBlb2YgQmlnSW50ID09PSAidW5kZWZpbmVkIiA/IEJ1ZmZlckJpZ0ludE5vdERlZmluZWQgOiBmbjsKICAgICAgfQogICAgICBmdW5jdGlvbiBCdWZmZXJCaWdJbnROb3REZWZpbmVkKCkgewogICAgICAgIHRocm93IG5ldyBFcnJvcigiQmlnSW50IG5vdCBzdXBwb3J0ZWQiKTsKICAgICAgfQogICAgfQogIH0pOwoKICAvLyBzcmMvYWxpYXMvYnVmZmVyLXNoaW0uanMKICB2YXIgaW1wb3J0X2J1ZmZlcjsKICB2Y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c3Npb24gbXVzdCBlaXRoZXIgYmUgbnVsbCBvciBhIGZ1bmN0aW9uIik7CiAgICAgICAgfQogICAgICAgIHN1YkNsYXNzLnByb3RvdHlwZSA9IE9iamVjdC5jcmVhdGUoc3VwZXJDbGFzcyAmJiBzdXBlckNsYXNzLnByb3RvdHlwZSwgewogICAgICAgICAgY29uc3RydWN0b3I6IHsKICAgICAgICAgICAgdmFsdWU6IHN1YkNsYXNzLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9CiAgICAgICAgfSk7CiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHN1YkNsYXNzLCAicHJvdG90eXBlIiwgewogICAgICAgICAgd3JpdGFibGU6IGZhbHNlCiAgICAgICAgfSk7CiAgICAgICAgaWYgKHN1cGVyQ2xhc3MpCiAgICAgICAgICBfc2V0UHJvdG90eXBlT2Yoc3ViQ2xhc3MsIHN1cGVyQ2xhc3MpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9nZXRQcm90b3R5cGVPZihvKSB7CiAgICAgICAgX2dldFByb3RvdHlwZU9mID0gT2JqZWN0LnNldFByb3RvdHlwZU9mID8gT2JqZWN0LmdldFByb3RvdHlwZU9mLmJpbmQoKSA6IGZ1bmN0aW9uIF9nZXRQcm90b3R5cGVPZjIobzIpIHsKICAgICAgICAgIHJldHVybiBvMi5fX3Byb3RvX18gfHwgT2JqZWN0LmdldFByb3RvdHlwZU9mKG8yKTsKICAgICAgICB9OwogICAgICAgIHJldHVybiBfZ2V0UHJvdG90eXBlT2Yobyk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX3NldFByb3RvdHlwZU9mKG8sIHApIHsKICAgICAgICBfc2V0UHJvdG90eXBlT2YgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgPyBPYmplY3Quc2V0UHJvdG90eXBlT2YuYmluZCgpIDogZnVuY3Rpb24gX3NldFByb3RvdHlwZU9mMihvMiwgcDIpIHsKICAgICAgICAgIG8yLl9fcHJvdG9fXyA9IHAyOwogICAgICAgICAgcmV0dXJuIG8yOwogICAgICAgIH07CiAgICAgICAgcmV0dXJuIF9zZXRQcm90b3R5cGVPZihvLCBwKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfaXNOYXRpdmVSZWZsZWN0Q29uc3RydWN0KCkgewogICAgICAgIGlmICh0eXBlb2YgUmVmbGVjdCA9PT0gInVuZGVmaW5lZCIgfHwgIVJlZmxlY3QuY29uc3RydWN0KQogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIGlmIChSZWZsZWN0LmNvbnN0cnVjdC5zaGFtKQogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIGlmICh0eXBlb2YgUHJveHkgPT09ICJmdW5jdGlvbiIpCiAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICB0cnkgewogICAgICAgICAgQm9vbGVhbi5wcm90b3R5cGUudmFsdWVPZi5jYWxsKFJlZmxlY3QuY29uc3RydWN0KEJvb2xlYW4sIFtdLCBmdW5jdGlvbigpIHsKICAgICAgICAgIH0pKTsKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX2Fzc2VydFRoaXNJbml0aWFsaXplZChzZWxmMikgewogICAgICAgIGlmIChzZWxmMiA9PT0gdm9pZCAwKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmVmZXJlbmNlRXJyb3IoInRoaXMgaGFzbid0IGJlZW4gaW5pdGlhbGlzZWQgLSBzdXBlcigpIGhhc24ndCBiZWVuIGNhbGxlZCIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gc2VsZjI7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX3Bvc3NpYmxlQ29uc3RydWN0b3JSZXR1cm4oc2VsZjIsIG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gICAgICB9OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9zdXBlclByb3BCYXNlKG9iamVjdCwgcHJvcGVydHkpIHsKICAgICAgICB3aGlsZSAoIU9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChvYmplY3QsIHByb3BlcnR5KSkgewogICAgICAgICAgb2JqZWN0ID0gX2dldFByb3RvdHlwZU9mKG9iamVjdCk7CiAgICAgICAgICBpZiAob2JqZWN0ID09PSBudWxsKQogICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG9iamVjdDsKICAgICAgfQogICAgICBmdW5jdGlvbiBfZ2V0KCkgewogICAgICAgIGlmICh0eXBlb2YgUmVmbGVjdCAhPT0gInVuZGVmaW5lZCIgJiYgUmVmbGVjdC5nZXQpIHsKICAgICAgICAgIF9nZXQgPSBSZWZsZWN0LmdldC5iaW5kKCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIF9nZXQgPSBmdW5jdGlvbiBfZ2V0Mih0YXJnZXQsIHByb3BlcnR5LCByZWNlaXZlcikgewogICAgICAgICAgICB2YXIgYmFzZSA9IF9zdXBlclByb3BCYXNlKHRhcmdldCwgcHJvcGVydHkpOwogICAgICAgICAgICBpZiAoIWJhc2UpCiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB2YXIgZGVzYyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoYmFzZSwgcHJvcGVydHkpOwogICAgICAgICAgICBpZiAoZGVzYy5nZXQpIHsKICAgICAgICAgICAgICByZXR1cm4gZGVzYy5nZXQuY2FsbChhcmd1bWVudHMubGVuZ3RoIDwgMyA/IHRhcmdldCA6IHJlY2VpdmVyKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gZGVzYy52YWx1ZTsKICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIHJldHVybiBfZ2V0LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgIH0KICAgICAgdmFyIEVtaXR0ZXIgPSAvKiBAX19QVVJFX18gKi8gZnVuY3Rpb24oKSB7CiAgICAgICAgZnVuY3Rpb24gRW1pdHRlcjIoKSB7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgRW1pdHRlcjIpOwogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJsaXN0ZW5lcnMiLCB7CiAgICAgICAgICAgIHZhbHVlOiB7fSwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhFbWl0dGVyMiwgW3sKICAgICAgICAgIGtleTogImFkZEV2ZW50TGlzdGVuZXIiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGFkZEV2ZW50TGlzdGVuZXIodHlwZSwgY2FsbGJhY2ssIG9wdGlvbnMpIHsKICAgICAgICAgICAgaWYgKCEodHlwZSBpbiB0aGlzLmxpc3RlbmVycykpIHsKICAgICAgICAgICAgICB0aGlzLmxpc3RlbmVyc1t0eXBlXSA9IFtdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMubGlzdGVuZXJzW3R5cGVdLnB1c2goewogICAgICAgICAgICAgIGNhbGxiYWNrLAogICAgICAgICAgICAgIG9wdGlvbnMKICAgICAgICAgICAgfSk7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAicmVtb3ZlRXZlbnRMaXN0ZW5lciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gcmVtb3ZlRXZlbnRMaXN0ZW5lcih0eXBlLCBjYWxsYmFjaykgewogICAgICAgICAgICBpZiAoISh0eXBlIGluIHRoaXMubGlzdGVuZXJzKSkgewogICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgc3RhY2sgPSB0aGlzLmxpc3RlbmVyc1t0eXBlXTsKICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSBzdGFjay5sZW5ndGg7IGkgPCBsOyBpKyspIHsKICAgICAgICAgICAgICBpZiAoc3RhY2tbaV0uY2FsbGJhY2sgPT09IGNhbGxiYWNrKSB7CiAgICAgICAgICAgICAgICBzdGFjay5zcGxpY2UoaSwgMSk7CiAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAiZGlzcGF0Y2hFdmVudCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gZGlzcGF0Y2hFdmVudChldmVudCkgewogICAgICAgICAgICBpZiAoIShldmVudC50eXBlIGluIHRoaXMubGlzdGVuZXJzKSkgewogICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgc3RhY2sgPSB0aGlzLmxpc3RlbmVyc1tldmVudC50eXBlXTsKICAgICAgICAgICAgdmFyIHN0YWNrVG9DYWxsID0gc3RhY2suc2xpY2UoKTsKICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSBzdGFja1RvQ2FsbC5sZW5ndGg7IGkgPCBsOyBpKyspIHsKICAgICAgICAgICAgICB2YXIgbGlzdGVuZXIgPSBzdGFja1RvQ2FsbFtpXTsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgbGlzdGVuZXIuY2FsbGJhY2suY2FsbCh0aGlzLCBldmVudCk7CiAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgUHJvbWlzZS5yZXNvbHZlKCkudGhlbihmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICAgdGhyb3cgZTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBpZiAobGlzdGVuZXIub3B0aW9ucyAmJiBsaXN0ZW5lci5vcHRpb25zLm9uY2UpIHsKICAgICAgICAgICAgICAgIHRoaXMucmVtb3ZlRXZlbnRMaXN0ZW5lcihldmVudC50eXBlLCBsaXN0ZW5lci5jYWxsYmFjayk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiAhZXZlbnQuZGVmYXVsdFByZXZlbnRlZDsKICAgICAgICAgIH0KICAgICAgICB9XSk7CiAgICAgICAgcmV0dXJuIEVtaXR0ZXIyOwogICAgICB9KCk7CiAgICAgIHZhciBBYm9ydFNpZ25hbCA9IC8qIEBfX1BVUkVfXyAqLyBmdW5jdGlvbihfRW1pdHRlcikgewogICAgICAgIF9pbmhlcml0cyhBYm9ydFNpZ25hbDIsIF9FbWl0dGVyKTsKICAgICAgICB2YXIgX3N1cGVyID0gX2NyZWF0ZVN1cGVyKEFib3J0U2lnbmFsMik7CiAgICAgICAgZnVuY3Rpb24gQWJvcnRTaWduYWwyKCkgewogICAgICAgICAgdmFyIF90aGlzOwogICAgICAgICAgX2NsYXNzQ2FsbENoZWNrKHRoaXMsIEFib3J0U2lnbmFsMik7CiAgICAgICAgICBfdGhpcyA9IF9zdXBlci5jYWxsKHRoaXMpOwogICAgICAgICAgaWYgKCFfdGhpcy5saXN0ZW5lcnMpIHsKICAgICAgICAgICAgRW1pdHRlci5jYWxsKF9hc3NlcnRUaGlzSW5pdGlhbGl6ZWQoX3RoaXMpKTsKICAgICAgICAgIH0KICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgImFib3J0ZWQiLCB7CiAgICAgICAgICAgIHZhbHVlOiBmYWxzZSwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoX2Fzc2VydFRoaXNJbml0aWFsaXplZChfdGhpcyksICJvbmFib3J0IiwgewogICAgICAgICAgICB2YWx1ZTogbnVsbCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoX2Fzc2VydFRoaXNJbml0aWFsaXplZChfdGhpcyksICJyZWFzb24iLCB7CiAgICAgICAgICAgIHZhbHVlOiB2b2lkIDAsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlLAogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUKICAgICAgICAgIH0pOwogICAgICAgICAgcmV0dXJuIF90aGlzOwogICAgICAgIH0KICAgICAgICBfY3JlYXRlQ2xhc3MoQWJvcnRTaWduYWwyLCBbewogICAgICAgICAga2V5OiAidG9TdHJpbmciLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIHRvU3RyaW5nKCkgewogICAgICAgICAgICByZXR1cm4gIltvYmplY3QgQWJvcnRTaWduYWxdIjsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJkaXNwYXRjaEV2ZW50IiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBkaXNwYXRjaEV2ZW50KGV2ZW50KSB7CiAgICAgICAgICAgIGlmIChldmVudC50eXBlID09PSAiYWJvcnQiKSB7CiAgICAgICAgICAgICAgdGhpcy5hYm9ydGVkID0gdHJ1ZTsKICAgICAgICAgICAgICBpZiAodHlwZW9mIHRoaXMub25hYm9ydCA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgICAgICAgdGhpcy5vbmFib3J0LmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBfZ2V0KF9nZXRQcm90b3R5cGVPZihBYm9ydFNpZ25hbDIucHJvdG90eXBlKSwgImRpc3BhdGNoRXZlbnQiLCB0aGlzKS5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgIH0KICAgICAgICB9XSk7CiAgICAgICAgcmV0dXJuIEFib3J0U2lnbmFsMjsKICAgICAgfShFbWl0dGVyKTsKICAgICAgdmFyIEFib3J0Q29udHJvbGxlciA9IC8qIEBfX1BVUkVfXyAqLyBmdW5jdGlvbigpIHsKICAgICAgICBmdW5jdGlvbiBBYm9ydENvbnRyb2xsZXIyKCkgewogICAgICAgICAgX2NsYXNzQ2FsbENoZWNrKHRoaXMsIEFib3J0Q29udHJvbGxlcjIpOwogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJzaWduYWwiLCB7CiAgICAgICAgICAgIHZhbHVlOiBuZXcgQWJvcnRTaWduYWwoKSwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhBYm9ydENvbnRyb2xsZXIyLCBbewogICAgICAgICAga2V5OiAiYWJvcnQiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGFib3J0KHJlYXNvbikgewogICAgICAgICAgICB2YXIgZXZlbnQ7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgZXZlbnQgPSBuZXcgRXZlbnQoImFib3J0Iik7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICBpZiAodHlwZW9mIGRvY3VtZW50ICE9PSAidW5kZWZpbmVkIikgewogICAgICAgICAgICAgICAgaWYgKCFkb2N1bWVudC5jcmVhdGVFdmVudCkgewogICAgICAgICAgICAgICAgICBldmVudCA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50T2JqZWN0KCk7CiAgICAgICAgICAgICAgICAgIGV2ZW50LnR5cGUgPSAiYWJvcnQiOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgZXZlbnQgPSBkb2N1bWVudC5jcmVhdGVFdmVudCgiRXZlbnQiKTsKICAgICAgICAgICAgICAgICAgZXZlbnQuaW5pdEV2ZW50KCJhYm9ydCIsIGZhbHNlLCBmYWxzZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGV2ZW50ID0gewogICAgICAgICAgICAgICAgICB0eXBlOiAiYWJvcnQiLAogICAgICAgICAgICAgICAgICBidWJibGVzOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogZmFsc2UKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzaWduYWxSZWFzb24gPSByZWFzb247CiAgICAgICAgICAgIGlmIChzaWduYWxSZWFzb24gPT09IHZvaWQgMCkgewogICAgICAgICAgICAgIGlmICh0eXBlb2YgZG9jdW1lbnQgPT09ICJ1bmRlZmluZWQiKSB7CiAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24gPSBuZXcgRXJyb3IoIlRoaXMgb3BlcmF0aW9uIHdhcyBhYm9ydGVkIik7CiAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24ubmFtZSA9ICJBYm9ydEVycm9yIjsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgc2lnbmFsUmVhc29uID0gbmV3IERPTUV4Y2VwdGlvbigic2lnbmFsIGlzIGFib3J0ZWQgd2l0aG91dCByZWFzb24iKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGVycikgewogICAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24gPSBuZXcgRXJyb3IoIlRoaXMgb3BlcmF0aW9uIHdhcyBhYm9ydGVkIik7CiAgICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbi5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnNpZ25hbC5yZWFzb24gPSBzaWduYWxSZWFzb247CiAgICAgICAgICAgIHRoaXMuc2lnbmFsLmRpc3BhdGNoRXZlbnQoZXZlbnQpOwogICAgICAgICAgfQogICAgICAgIH0sIHsKICAgICAgICAgIGtleTogInRvU3RyaW5nIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiB0b1N0cmluZygpIHsKICAgICAgICAgICAgcmV0dXJuICJbb2JqZWN0IEFib3J0Q29udHJvbGxlcl0iOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gQWJvcnRDb250cm9sbGVyMjsKICAgICAgfSgpOwogICAgICBpZiAodHlwZW9mIFN5bWJvbCAhPT0gInVuZGVmaW5lZCIgJiYgU3ltYm9sLnRvU3RyaW5nVGFnKSB7CiAgICAgICAgQWJvcnRDb250cm9sbGVyLnByb3RvdHlwZVtTeW1ib2wudG9TdHJpbmdUYWddID0gIkFib3J0Q29udHJvbGxlciI7CiAgICAgICAgQWJvcnRTaWduYWwucHJvdG90eXBlW1N5bWJvbC50b1N0cmluZ1RhZ10gPSAiQWJvcnRTaWduYWwiOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHBvbHlmaWxsTmVlZGVkKHNlbGYyKSB7CiAgICAgICAgaWYgKHNlbGYyLl9fRk9SQ0VfSU5TVEFMTF9BQk9SVENPTlRST0xMRVJfUE9MWUZJTEwpIHsKICAgICAgICAgIGNvbnNvbGUubG9nKCJfX0ZPUkNFX0lOU1RBTExfQUJPUlRDT05UUk9MTEVSX1BPTFlGSUxMPXRydWUgaXMgc2V0LCB3aWxsIGZvcmNlIGluc3RhbGwgcG9seWZpbGwiKTsKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdHlwZW9mIHNlbGYyLlJlcXVlc3QgPT09ICJmdW5jdGlvbiIgJiYgIXNlbGY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bnRyb2xsZXI6IE5hdGl2ZUFib3J0Q29udHJvbGxlciwKICAgICAgICAgIF9fRk9SQ0VfSU5TVEFMTF9BQk9SVENPTlRST0xMRVJfUE9MWUZJTEwKICAgICAgICB9KSkgewogICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgZmV0Y2gsCiAgICAgICAgICAgIFJlcXVlc3QKICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIHZhciBSZXF1ZXN0ID0gTmF0aXZlUmVxdWVzdDsKICAgICAgICBpZiAoUmVxdWVzdCAmJiAhUmVxdWVzdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkoInNpZ25hbCIpIHx8IF9fRk9SQ0VfSU5TVEFMTF9BQk9SVENPTlRST0xMRVJfUE9MWUZJTEwpIHsKICAgICAgICAgIFJlcXVlc3QgPSBmdW5jdGlvbiBSZXF1ZXN0MihpbnB1dCwgaW5pdDIpIHsKICAgICAgICAgICAgdmFyIHNpZ25hbDsKICAgICAgICAgICAgaWYgKGluaXQyICYmIGluaXQyLnNpZ25hbCkgewogICAgICAgICAgICAgIHNpZ25hbCA9IGluaXQyLnNpZ25hbDsKICAgICAgICAgICAgICBkZWxldGUgaW5pdDIuc2lnbmFsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciByZXF1ZXN0ID0gbmV3IE5hdGl2ZVJlcXVlc3QoaW5wdXQsIGluaXQyKTsKICAgICAgICAgICAgaWYgKHNpZ25hbCkgewogICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShyZXF1ZXN0LCAic2lnbmFsIiwgewogICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgICAgICB2YWx1ZTogc2lnbmFsCiAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJlcXVlc3Q7CiAgICAgICAgICB9OwogICAgICAgICAgUmVxdWVzdC5wcm90b3R5cGUgPSBOYXRpdmVSZXF1ZXN0LnByb3RvdHlwZTsKICAgICAgICB9CiAgICAgICAgdmFyIHJlYWxGZXRjaCA9IGZldGNoOwogICAgICAgIHZhciBhYm9ydGFibGVGZXRjaCA9IGZ1bmN0aW9uIGFib3J0YWJsZUZldGNoMihpbnB1dCwgaW5pdDIpIHsKICAgICAgICAgIHZhciBzaWduYWwgPSBSZXF1ZXN0ICYmIFJlcXVlc3QucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoaW5wdXQpID8gaW5wdXQuc2lnbmFsIDogaW5pdDIgPyBpbml0Mi5zaWduYWwgOiB2b2lkIDA7CiAgICAgICAgICBpZiAoc2lnbmFsKSB7CiAgICAgICAgICAgIHZhciBhYm9ydEVycm9yOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgIGFib3J0RXJyb3IgPSBuZXcgRE9NRXhjZXB0aW9uKCJBYm9ydGVkIiwgIkFib3J0RXJyb3IiKTsKICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgICAgYWJvcnRFcnJvciA9IG5ldyBFcnJvcigiQWJvcnRlZCIpOwogICAgICAgICAgICAgIGFib3J0RXJyb3IubmFtZSA9ICJBYm9ydEVycm9yIjsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoYWJvcnRFcnJvcik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIGNhbmNlbGxhdGlvbiA9IG5ldyBQcm9taXNlKGZ1bmN0aW9uKF8sIHJlamVjdCkgewogICAgICAgICAgICAgIHNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsIGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHJlamVjdChhYm9ydEVycm9yKTsKICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICBvbmNlOiB0cnVlCiAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBpZiAoaW5pdDIgJiYgaW5pdDIuc2lnbmFsKSB7CiAgICAgICAgICAgICAgZGVsZXRlIGluaXQyLnNpZ25hbDsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yYWNlKFtjYW5jZWxsYXRpb24sIHJlYWxGZXRjaChpbnB1dCwgaW5pdDIpXSk7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gcmVhbEZldGNoKGlucHV0LCBpbml0Mik7CiAgICAgICAgfTsKICAgICAgICByZXR1cm4gewogICAgICAgICAgZmV0Y2g6IGFib3J0YWJsZUZldGNoLAogICAgICAgICAgUmVxdWVzdAogICAgICAgIH07CiAgICAgIH0KICAgICAgZXhwb3J0czIuQWJvcnRDb250cm9sbGVyID0gQWJvcnRDb250cm9sbGVyOwogICAgICBleHBvcnRzMi5BYm9ydFNpZ25hbCA9IEFib3J0U2lnbmFsOwogICAgICBleHBvcnRzMi5hYm9ydGFibGVGZXRjaCA9IGFib3J0YWJsZUZldGNoRGVjb3JhdG9yOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vYWJvcnRhYmxlLXByb21pc2UtY2FjaGVAMS41LjAvbm9kZV9tb2R1bGVzL2Fib3J0YWJsZS1wcm9taXNlLWNhY2hlL2VzbS9hYm9ydGNvbnRyb2xsZXItcG9ueWZpbGwuanMKICB2YXIgcmVxdWlyZV9hYm9ydGNvbnRyb2xsZXJfcG9ueWZpbGwgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vYWJvcnRhYmxlLXByb21pc2UtY2FjaGVAMS41LjAvbm9kZV9tb2R1bGVzL2Fib3J0YWJsZS1wcm9taXNlLWNhY2hlL2VzbS9hYm9ydGNvbnRyb2xsZXItcG9ueWZpbG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29udHJvbGxlcl9wb255ZmlsbF8xLkFib3J0Q29udHJvbGxlcigpOwogICAgICAgIH0KICAgICAgICBhZGRTaWduYWwoc2lnbmFsID0gbmV3IE51bGxTaWduYWwoKSkgewogICAgICAgICAgaWYgKHRoaXMuc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJjYW5ub3QgYWRkIGEgc2lnbmFsLCBhbHJlYWR5IGFib3J0ZWQhIik7CiAgICAgICAgICB9CiAgICAgICAgICB0aGlzLnNpZ25hbHMuYWRkKHNpZ25hbCk7CiAgICAgICAgICBpZiAoc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgdGhpcy5oYW5kbGVBYm9ydGVkKHNpZ25hbCk7CiAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBzaWduYWwuYWRkRXZlbnRMaXN0ZW5lciA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgICBzaWduYWwuYWRkRXZlbnRMaXN0ZW5lcigiYWJvcnQiLCAoKSA9PiB7CiAgICAgICAgICAgICAgdGhpcy5oYW5kbGVBYm9ydGVkKHNpZ25hbCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBoYW5kbGVBYm9ydGVkKHNpZ25hbCkgewogICAgICAgICAgdGhpcy5zaWduYWxzLmRlbGV0ZShzaWduYWwpOwogICAgICAgICAgaWYgKHRoaXMuc2lnbmFscy5zaXplID09PSAwKSB7CiAgICAgICAgICAgIHRoaXMuYWJvcnRDb250cm9sbGVyLmFib3J0KCk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGdldCBzaWduYWwoKSB7CiAgICAgICAgICByZXR1cm4gdGhpcy5hYm9ydENvbnRyb2xsZXIuc2lnbmFsOwogICAgICAgIH0KICAgICAgICBhYm9ydCgpIHsKICAgICAgICAgIHRoaXMuYWJvcnRDb250cm9sbGVyLmFib3J0KCk7CiAgICAgICAgfQogICAgICB9Owog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ydGVkKCkgewogICAgICAgICAgICAgIHJldHVybiB0aGlzLmFib3J0ZXIuc2lnbmFsLmFib3J0ZWQ7CiAgICAgICAgICAgIH0KICAgICAgICAgIH07CiAgICAgICAgICBuZXdFbnRyeS5hYm9ydGVyLmFkZFNpZ25hbChzaWduYWwpOwogICAgICAgICAgbmV3RW50cnkuYWJvcnRlci5zaWduYWwuYWRkRXZlbnRMaXN0ZW5lcigiYWJvcnQiLCAoKSA9PiB7CiAgICAgICAgICAgIGlmICghbmV3RW50cnkuc2V0dGxlZCkgewogICAgICAgICAgICAgIHRoaXMuZXZpY3Qoa2V5LCBuZXdFbnRyeSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0pOwogICAgICAgICAgbmV3RW50cnkucHJvbWlzZS50aGVuKCgpID0+IHsKICAgICAgICAgICAgbmV3RW50cnkuc2V0dGxlZCA9IHRydWU7CiAgICAgICAgICB9LCAoKSA9PiB7CiAgICAgICAgICAgIG5ld0VudHJ5LnNldHRsZWQgPSB0cnVlOwogICAgICAgICAgICB0aGlzLmV2aWN0KGtleSwgbmV3RW50cnkpOwogICAgICAgICAgfSkuY2F0Y2goKGUpID0+IHsKICAgICAgICAgICAgY29uc29sZS5lcnJvcihlKTsKICAgICAgICAgICAgdGhyb3cgZTsKICAgICAgICAgIH0pOwogICAgICAgICAgdGhpcy5jYWNoZS5zZXQoa2V5LCBuZXdFbnRyeSk7CiAgICAgICAgfQogICAgICAgIHN0YXRpYyBjaGVja1NpbmdsZVByb21pc2UocHJvbWlzZSwgc2lnbmFsKSB7CiAgICAgICAgICBmdW5jdGlvbiBjaGVja0ZvclNpbmdsZUFib3J0KCkgewogICAgICAgICAgICBpZiAoc2lnbmFsICYmIHNpZ25hbC5hYm9ydGVkKSB7CiAgICAgICAgICAgICAgdGhyb3cgT2JqZWN0LmFzc2lnbihuZXcgRXJyb3IoImFib3J0ZWQiKSwgeyBjb2RlOiAiRVJSX0FCT1JURUQiIH0pOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gcHJvbWlzZS50aGVuKChyZXN1bHQpID0+IHsKICAgICAgICAgICAgY2hlY2tGb3JTaW5nbGVBYm9ydCgpOwogICAgICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgICAgICAgfSwgKGVycm9yKSA9PiB7CiAgICAgICAgICAgIGNoZWNrRm9yU2luZ2xlQWJvcnQoKTsKICAgICAgICAgICAgdGhyb3cgZXJyb3I7CiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgaGFzKGtleSkgewogICAgICAgICAgcmV0dXJuIHRoaXMuY2FjaGUuaGFzKGtleSk7CiAgICAgICAgfQogICAgICAgIGdldChrZXksIGRhdGEsIHNpZ25hbCwgc3RhdHVzQ2FsbGJhY2spIHsKICAgICAgICAgIGlmICghc2lnbmFsICYmIGRhdGEgaW5zdGFuY2VvZiBhYm9ydGNvbnRyb2xsZXJfcG9ueWZpbGxfMS5BYm9ydFNpZ25hbCkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJzZWNvbmQgZ2V0IGFyZ3VtZW50IGFwcGVhcnMgdG8gYmUgYW4gQWJvcnRTaWduYWwsIHBlcmhhcHMgeW91IG1lYW50IHRvIHBhc3MgYG51bGxgIGZvciB0aGUgZmlsbCBkYXRhPyIpOwogICAgICAgICAgfQogICAgICAgICAgY29uc3QgY2FjaGVFbnRyeSA9IHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICBpZiAoY2FjaGVFbnRyeSkgewogICAgICAgICAgICBpZiAoY2FjaGVFbnRyeS5hYm9ydGVkICYmICFjYWNoZUVudHJ5LnNldHRsZWQpIHsKICAgICAgICAgICAgICB0aGlzLmV2aWN0KGtleSwgY2FjaGVFbnRyeSk7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0KGtleSwgZGF0YSwgc2lnbmFsLCBzdGF0dXNDYWxsYmFjayk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGNhY2hlRW50cnkuc2V0dGxlZCkgewogICAgICAgICAgICAgIHJldHVybiBjYWNoZUVudHJ5LnByb21pc2U7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2FjaGVFbnRyeS5hYm9ydGVyLmFkZFNpZ25hbChzaWduYWwpOwogICAgICAgICAgICBjYWNoZUVudHJ5LnN0YXR1c1JlcG9ydGVyLmFkZENhbGxiYWNrKHN0YXR1c0NhbGxiYWNrKTsKICAgICAgICAgICAgcmV0dXJuIEFib3J0YWJsZVByb21pc2VDYWNoZTIuY2hlY2tTaW5nbGVQcm9taXNlKGNhY2hlRW50cnkucHJvbWlzZSwgc2lnbmFsKTsKICAgICAgICAgIH0KICAgICAgICAgIHRoaXMuZmlsbChrZXksIGRhdGEsIHNpZ25hbCwgc3RhdHVzQ2FsbGJhY2spOwogICAgICAgICAgcmV0dXJuIEFib3J0YWJsZVByb21pc2VDYWNoZTIuY2hlY2tTaW5nbGVQcm9taXNlKHRoaXMuY2FjaGUuZ2V0KGtleSkucHJvbWlzZSwgc2lnbmFsKTsKICAgICAgICB9CiAgICAgICAgZGVsZXRlKGtleSkgewogICAgICAgICAgY29uc3QgY2FjaGVkRW50cnkgPSB0aGlzLmNhY2hlLmdldChrZXkpOwogICAgICAgICAgaWYgKGNhY2hlZEVudHJ5KSB7CiAgICAgICAgICAgIGlmICghY2FjaGVkRW50cnkuc2V0dGxlZCkgewogICAgICAgICAgICAgIGNhY2hlZEVudHJ5LmFib3J0ZXIuYWJvcnQoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLmNhY2hlLmRlbGV0ZShrZXkpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjbGVhcigpIHsKICAgICAgICAgIGNvbnN0IGtleUl0ZXIgPSB0aGlzLmNhY2hlLmtleXMoKTsKICAgICAgICAgIGxldCBkZWxldGVDb3VudCA9IDA7CiAgICAgICAgICBmb3IgKGxldCByZXN1bHQgPSBrZXlJdGVyLm5leHQoKTsgIXJlc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cy5fc2l6ZSA9IDA7CiAgICAgICAgICAgIHRoaXMub2xkQ2FjaGUgPSB0aGlzLmNhY2hlOwogICAgICAgICAgICB0aGlzLmNhY2hlID0gbmV3IE1hcCgpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBnZXQoa2V5KSB7CiAgICAgICAgICBpZiAodGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5nZXQoa2V5KTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0aGlzLm9sZENhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gdGhpcy5vbGRDYWNoZS5nZXQoa2V5KTsKICAgICAgICAgICAgdGhpcy5vbGRDYWNoZS5kZWxldGUoa2V5KTsKICAgICAgICAgICAgdGhpcy5fc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgICByZXR1cm4gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHNldChrZXksIHZhbHVlKSB7CiAgICAgICAgICBpZiAodGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIHZhbHVlKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRoaXMuX3NldChrZXksIHZhbHVlKTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIH0KICAgICAgICBoYXMoa2V5KSB7CiAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5oYXMoa2V5KSB8fCB0aGlzLm9sZENhY2hlLmhhcyhrZXkpOwogICAgICAgIH0KICAgICAgICBwZWVrKGtleSkgewogICAgICAgICAgaWYgKHRoaXMuY2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodGhpcy5vbGRDYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5vbGRDYWNoZS5nZXQoa2V5KTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZGVsZXRlKGtleSkgewogICAgICAgICAgY29uc3QgZGVsZXRlZCA9IHRoaXMuY2FjaGUuZGVsZXRlKGtleSk7CiAgICAgICAgICBpZiAoZGVsZXRlZCkgewogICAgICAgICAgICB0aGlzLl9zaXplLS07CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gdGhpcy5vbGRDYWNoZS5kZWxldGUoa2V5KSB8fCBkZWxldGVkOwogICAgICAgIH0KICAgICAgICBjbGVhcigpIHsKICAgICAgICAgIHRoaXMuY2FjaGUuY2xlYXIoKTsKICAgICAgICAgIHRoaXMub2xkQ2FjaGUuY2xlYXIoKTsKICAgICAgICAgIHRoaXMuX3NpemUgPSAwOwogICAgICAgIH0KICAgICAgICAqa2V5cygpIHsKICAgICAgICAgIGZvciAoY29uc3QgW2tleV0gb2YgdGhpcykgewogICAgICAgICAgICB5aWVsZCBrZXk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgICp2YWx1ZXMoKSB7CiAgICAgICAgICBmb3IgKGNvbnN0IFssIHZhbHVlXSBvZiB0aGlzKSB7CiAgICAgICAgICAgIHlpZWxkIHZhbHVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICAqW1N5bWJvbC5pdGVyYXRvcl0oKSB7CiAgICAgICAgICBmb3IgKGNvbnN0IGl0ZW0gb2YgdGhpcy5jYWNoZSkgewogICAgICAgICAgICB5aWVsZCBpdGVtOwogICAgICAgICAgfQogICAgICAgICAgZm9yIChjb25zdCBpdGVtIG9mIHRoaXMub2xkQ2FjaGUpIHsKICAgICAgICAgICAgY29uc3QgW2tleV0gPSBpdGVtOwogICAgICAgICAgICBpZiAoIXRoaXMuY2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgICB5aWVsZCBpdGVtOwogICAgICAgICAgICB9CiAgICAgICAgICB9C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AgInVzZSBzdHJpY3QiOwogICAgICB2YXIgVFlQRURfT0sgPSB0eXBlb2YgVWludDhBcnJheSAhPT0gInVuZGVmaW5lZCIgJiYgdHlwZW9mIFVpbnQxNkFycmF5ICE9PSAidW5kZWZpbmVkIiAmJiB0eXBlb2YgSW50MzJBcnJheSAhPT0gInVuZGVmaW5lZCI7CiAgICAgIGZ1bmN0aW9uIF9oYXMob2JqLCBrZXkpIHsKICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iaiwga2V5KTsKICAgICAgfQogICAgICBleHBvcnRzMi5hc3NpZ24gPSBmdW5jdGlvbihvYmopIHsKICAgICAgICB2YXIgc291cmNlcyA9IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMSk7CiAgICAgICAgd2hpbGUgKHNvdXJjZXMubGVuZ3RoKSB7CiAgICAgICAgICB2YXIgc291cmNlID0gc291cmNlcy5zaGlmdCgpOwogICAgICAgICAgaWYgKCFzb3VyY2UpIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodHlwZW9mIHNvdXJjZSAhPT0gIm9iamVjdCIpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihzb3VyY2UgKyAibXVzdCBiZSBub24tb2JqZWN0Iik7CiAgICAgICAgICB9CiAgICAgICAgICBmb3IgKHZhciBwIGluIHNvdXJjZSkgewogICAgICAgICAgICBpZiAoX2hhcyhzb3VyY2UsIHApKSB7CiAgICAgICAgICAgICAgb2JqW3BdID0gc291cmNlW3BdOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBvYmo7CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLnNocmlua0J1ZiA9IGZ1bmN0aW9uKGJ1Ziwgc2l6ZSkgewogICAgICAgIGlmIChidWYubGVuZ3RoID09PSBzaXplKSB7CiAgICAgICAgICByZXR1cm4gYnVmOwogICAgICAgIH0KICAgICAgICBpZiAoYnVmLnN1YmFycmF5KSB7CiAgICAgICAgICByZXR1cm4gYnVmLnN1YmFycmF5KDAsIHNpemUpOwogICAgICAgIH0KICAgICAgICBidWYubGVuZ3RoID0gc2l6ZTsKICAgICAgICByZXR1cm4gYnVmOwogICAgICB9OwogICAgICB2YXIgZm5UeXBlZCA9IHsKICAgICAgICBhcnJheVNldDogZnVuY3Rpb24oZGVzdCwgc3JjLCBzcmNfb2ZmcywgbGVuLCBkZXN0X29mZnMpIHsKICAgICAgICAgIGlmIChzcmMuc3ViYXJyYXkgJiYgZGVzdC5zdWJhcnJheSkgewogICAgICAgICAgICBkZXN0LnNldChzcmMuc3ViYXJyYXkoc3JjX29mZnMsIHNyY19vZmZzICsgbGVuKSwgZGVzdF9vZmZzKTsKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgfQogICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgICBkZXN0W2Rlc3Rfb2ZmcyArIGldID0gc3JjW3NyY19vZmZzICsgaV07CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBmbGF0dGVuQ2h1bmtzOiBmdW5jdGlvbihjaHVua3MpIHsKICAgICAgICAgIHZhciBpLCBsLCBsZW4sIHBvcywgY2h1bmssIHJlc3VsdDsKICAgICAgICAgIGxlbiA9IDA7CiAgICAgICAgICBmb3IgKGkgPSAwLCBsID0gY2h1bmtzLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICBsZW4gKz0gY2h1bmtzW2ldLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICAgIHJlc3VsdCA9IG5ldyBVaW50OEFycmF5KGxlbik7CiAgICAgICAgICBwb3MgPSAwOwogICAgICAgICAgZm9yIChpID0gMCwgbCA9IGNodW5rcy5sZW5ndGg7IGkgPCBsOyBpKyspIHsKICAgICAgICAgICAgY2h1bmsgPSBjaHVua3NbaV07CiAgICAgICAgICAgIHJlc3VsdC5zZXQoY2h1bmssIHBvcyk7CiAgICAgICAgICAgIHBvcyArPSBjaHVuay5sZW5ndGg7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgICAgIH0KICAgICAgfTsKICAgICAgdmFyIGZuVW50eXBlZCA9IHsKICAgICAgICBhcnJheVNldDogZnVuY3Rpb24oZGVzdCwgc3JjLCBzcmNfb2ZmcywgbGVuLCBkZXN0X29mZnMpIHsKICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKICAgICAgICAgICAgZGVzdFtkZXN0X29mZnMgKyBpXSA9IHNyY1tzcmNfb2ZmcyArIGldOwogICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgZmxhdHRlbkNodW5rczogZnVuY3Rpb24oY2h1bmtzKSB7CiAgICAgICAgICByZXR1cm4gW10uY29uY2F0LmFwcGx5KFtdLCBjaHVua3MpOwogICAgICAgIH0KICAgICAgfTsKICAgICAgZXhwb3J0czIuc2V0VHlwZWQgPSBmdW5jdGlvbihvbikgewogICAgICAgIGlmIChvbikgewogICAgICAgICAgZXhwb3J0czIuQnVmOCA9IFVpbnQ4QXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5CdWYxNiA9IFVpbnQxNkFycmF5OwogICAgICAgICAgZXhwb3J0czIuQnVmMzIgPSBJbnQzMkFycmF5OwogICAgICAgICAgZXhwb3J0czIuYXNzaWduKGV4cG9ydHMyLCBmblR5cGVkKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZXhwb3J0czIuQnVmOCA9IEFycmF5OwogICAgICAgICAgZXhwb3J0czIuQnVmMTYgPSBBcnJheTsKICAgICAgICAgIGV4cG9ydHMyLkJ1ZjMyID0gQXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5hc3NpZ24oZXhwb3J0czIsIGZuVW50eXBlZCk7CiAgICAgICAgfQogICAgICB9OwogICAgICBleHBvcnRzM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gICAgICB2YXIgYml0czsKICAgICAgICB2YXIgeGJpdHM7CiAgICAgICAgdmFyIGY7CiAgICAgICAgdmFyIG92ZXJmbG93ID0gMDsKICAgICAgICBmb3IgKGJpdHMgPSAwOyBiaXRzIDw9IE1BWF9CSVRTOyBiaXRzKyspIHsKICAgICAgICAgIHMuYmxfY291bnRbYml0c10gPSAwOwogICAgICAgIH0KICAgICAgICB0cmVlW3MuaGVhcFtzLmhlYXBfbWF4XSAqIDIgKyAxXSA9IDA7CiAgICAgICAgZm9yIChoID0gcy5oZWFwX21heCArIDE7IGggPCBIRUFQX1NJWkU7IGgrKykgewogICAgICAgICAgbiA9IHMuaGVhcFtoXTsKICAgICAgICAgIGJpdHMgPSB0cmVlW3RyZWVbbiAqIDIgKyAxXSAqIDIgKyAxXSArIDE7CiAgICAgICAgICBpZiAoYml0cyA+IG1heF9sZW5ndGgpIHsKICAgICAgICAgICAgYml0cyA9IG1heF9sZW5ndGg7CiAgICAgICAgICAgIG92ZXJmbG93Kys7CiAgICAgICAgICB9CiAgICAgICAgICB0cmVlW24gKiAyICsgMV0gPSBiaXRzOwogICAgICAgICAgaWYgKG4gPiBtYXhfY29kZSkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIHMuYmxfY291bnRbYml0c10rKzsKICAgICAgICAgIHhiaXRzID0gMDsKICAgICAgICAgIGlmIChuID49IGJhc2UpIHsKICAgICAgICAgICAgeGJpdHMgPSBleHRyYVtuIC0gYmFzZV07CiAgICAgICAgICB9CiAgICAgICAgICBmID0gdHJlZVtuICogMl07CiAgICAgICAgICBzLm9wdF9sZW4gKz0gZiAqIChiaXRzICsgeGJpdHMpOwogICAgICAgICAgaWYgKGhhc19zdHJlZSkgewogICAgICAgICAgICBzLnN0YXRpY19sZW4gKz0gZiAqIChzdHJlZVtuICogMiArIDFdICsgeGJpdHMpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAob3ZlcmZsb3cgPT09IDApIHsKICAgICAgICAgIHJldHVybjsKICAgICAgICB9CiAgICAgICAgZG8gewogICAgICAgICAgYml0cyA9IG1heF9sZW5ndGggLSAxOwogICAgICAgICAgd2hpbGUgKHMuYmxfY291bnRbYml0c10gPT09IDApIHsKICAgICAgICAgICAgYml0cy0tOwogICAgICAgICAgfQogICAgICAgICAgcy5ibF9jb3VudFtiaXRzXS0tOwogICAgICAgICAgcy5ibF9jb3VudFtiaXRzICsgMV0gKz0gMjsKICAgICAgICAgIHMuYmxfY291bnRbbWF4X2xlbmd0aF0tLTsKICAgICAgICAgIG92ZXJmbG93IC09IDI7CiAgICAgICAgfSB3aGlsZSAob3ZlcmZsb3cgPiAwKTsKICAgICAgICBmb3IgKGJpdHMgPSBtYXhfbGVuZ3RoOyBiaXRzICE9PSAwOyBiaXRzLS0pIHsKICAgICAgICAgIG4gPSBzLmJsX2NvdW50W2JpdHNdOwogICAgICAgICAgd2hpbGUgKG4gIT09IDApIHsKICAgICAgICAgICAgbSA9IHMuaGVhcFstLWhdOwogICAgICAgICAgICBpZiAobSA+IG1heF9jb2RlKSB7CiAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHRyZWVbbSAqIDIgKyAxXSAhPT0gYml0cykgewogICAgICAgICAgICAgIHMub3B0X2xlbiArPSAoYml0cyAtIHRyZWVbbSAqIDIgKyAxXSkgKiB0cmVlW20gKiAyXTsKICAgICAgICAgICAgICB0cmVlW20gKiAyICsgMV0gPSBiaXRzOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG4tLTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZ2VuX2NvZGVzKHRyZWUsIG1heF9jb2RlLCBibF9jb3VudCkgewogICAgICAgIHZhciBuZXh0X2NvZGUgPSBuZXcgQXJyYXkoTUFYX0JJVFMgKyAxKTsKICAgICAgICB2YXIgY29kZSA9IDA7CiAgICAgICAgdmFyIGJpdHM7CiAgICAgICAgdmFyIG47CiAgICAgICAgZm9yIChiaXRzID0gMTsgYml0cyA8PSBNQVhfQklUUzsgYml0cysrKSB7CiAgICAgICAgICBuZXh0X2NvZGVbYml0c10gPSBjb2RlID0gY29kZSArIGJsX2NvdW50W2JpdHMgLSAxXSA8PCAxOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IG1heF9jb2RlOyBuKyspIHsKICAgICAgICAgIHZhciBsZW4gPSB0cmVlW24gKiAyICsgMV07CiAgICAgICAgICBpZiAobGVuID09PSAwKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgdHJlZVtuICogMl0gPSBiaV9yZXZlcnNlKG5leHRfY29kZVtsZW5dKyssIGxlbik7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIHRyX3N0YXRpY19pbml0KCkgewogICAgICAgIHZhciBuOwogICAgICAgIHZhciBiaXRzOwogICAgICAgIHZhciBsZW5ndGg7CiAgICAgICAgdmFyIGNvZGU7CiAgICAgICAgdmFyIGRpc3Q7CiAgICAgICAgdmFyIGJsX2NvdW50ID0gbmV3IEFycmF5KE1BWF9CSVRTICsgMSk7CiAgICAgICAgbGVuZ3RoID0gMDsKICAgICAgICBmb3IgKGNvZGUgPSAwOyBjb2RlIDwgTEVOR1RIX0NPREVTIC0gMTsgY29kZSsrKSB7CiAgICAgICAgICBiYXNlX2xlbmd0aFtjb2RlXSA9IGxlbmd0aDsKICAgICAgICAgIGZvciAobiA9IDA7IG4gPCAxIDw8IGV4dHJhX2xiaXRzW2NvZGVdOyBuKyspIHsKICAgICAgICAgICAgX2xlbmd0aF9jb2RlW2xlbmd0aCsrXSA9IGNvZGU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIF9sZW5ndGhfY29kZVtsZW5ndGggLSAxXSA9IGNvZGU7CiAgICAgICAgZGlzdCA9IDA7CiAgICAgICAgZm9yIChjb2RlID0gMDsgY29kZSA8IDE2OyBjb2RlKyspIHsKICAgICAgICAgIGJhc2VfZGlzdFtjb2RlXSA9IGRpc3Q7CiAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgMSA8PCBleHRyYV9kYml0c1tjb2RlXTsgbisrKSB7CiAgICAgICAgICAgIF9kaXN0X2NvZGVbZGlzdCsrXSA9IGNvZGU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGRpc3QgPj49IDc7CiAgICAgICAgZm9yICg7IGNvZGUgPCBEX0NPREVTOyBjb2RlKyspIHsKICAgICAgICAgIGJhc2VfZGlzdFtjb2RlXSA9IGRpc3QgPDwgNzsKICAgICAgICAgIGZvciAobiA9IDA7IG4gPCAxIDw8IGV4dHJhX2RiaXRzW2NvZGVdIC0gNzsgbisrKSB7CiAgICAgICAgICAgIF9kaXN0X2NvZGVbMjU2ICsgZGlzdCsrXSA9IGNvZGU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZvciAoYml0cyA9IDA7IGJpdHMgPD0gTUFYX0JJVFM7IGJpdHMrKykgewogICAgICAgICAgYmxfY291bnRbYml0c10gPSAwOwogICAgICAgIH0KICAgICAgICBuID0gMDsKICAgICAgICB3aGlsZSAobiA8PSAxNDMpIHsKICAgICAgICAgIHN0YXRpY19sdHJlZVtuICogMiArIDFdID0gODsKICAgICAgICAgIG4rKzsKICAgICAgICAgIGJsX2NvdW50WzhdKys7CiAgICAgICAgfQogICAgICAgIHdoaWxlIChuIDw9IDI1NSkgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA5OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbOV0rKzsKICAgICAgICB9CiAgICAgICAgd2hpbGUgKG4gPD0gMjc5KSB7CiAgICAgICAgICBzdGF0aWNfbHRyZWVbbiAqIDIgKyAxXSA9IDc7CiAgICAgICAgICBuKys7CiAgICAgICAgICBibF9jb3VudFs3XSsrOwogICAgICAgIH0KICAgICAgICB3aGlsZSAobiA8PSAyODcpIHsKICAgICAgICAgIHN0YXRpY19sdHJlZVtuICogMiArIDFdID0gODsKICAgICAgICAgIG4rKzsKICAgICAgICAgIGJsX2NvdW50WzhdKys7CiAgICAgICAgfQogICAgICAgIGdlbl9jb2RlcyhzdGF0aWNfbHRyZWUsIExfQ09ERVMgKyAxLCBibF9jb3VudCk7CiAgICAgICAgZm9yIChuID0gMDsgbiA8IERfQ09ERVM7IG4rKykgewogICAgICAgICAgc3RhdGljX2R0cmVlW24gKiAyICsgMV0gPSA1OwogICAgICAgICAgc3RhdGljX2R0cmVlW24gKiAyXSA9IGJpX3JldmVyc2UobiwgNSk7CiAgICAgICAgfQogICAgICAgIHN0YXRpY19sX2Rlc2MgPSBuZXcgU3RhdGljVHJlZURlc2Moc3RhdGljX2x0cmVlLCBleHRyYV9sYml0cywgTElURVJBTFMgKyAxLCBMX0NPREVTLCBNQVhfQklUUyk7CiAgICAgICAgc3RhdGljX2RfZGVzYyA9IG5ldyBTdGF0aWNUcmVlRGVzYyhzdGF0aWNfZHRyZWUsIGV4dHJhX2RiaXRzLCAwLCBEX0NPREVTLCBNQVhfQklUUyk7CiAgICAgICAgc3RhdGljX2JsX2Rlc2MgPSBuZXcgU3RhdGljVHJlZURlc2MobmV3IEFycmF5KDApLCBleHRyYV9ibGJpdHMsIDAsIEJMX0NPREVTLCBNQVhfQkxfQklUUyk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5pdF9ibG9jayhzKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgZm9yIChuID0gMDsgbiA8IExfQ09ERVM7IG4rKykgewogICAgICAgICAgcy5keW5fbHRyZWVbbiAqIDJdID0gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChuID0gMDsgbiA8IERfQ09ERVM7IG4rKykgewogICAgICAgICAgcy5keW5fZHRyZWVbbiAqIDJdID0gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChuID0gMDsgbiA8IEJMX0NPREVTOyBuKyspIHsKICAgICAgICAgIHMuYmxfdHJlZVtuICogMl0gPSAwOwogICAgICAgIH0KICAgICAgICBzLmR5bl9sdHJlZVtFTkRfQkxPQ0sgKiAyXSA9IDE7CiAgICAgICAgcy5vcHRfbGVuID0gcy5zdGF0aWNfbGVuID0gMDsKICAgICAgICBzLmxhc3RfbGl0ID0gcy5tYXRjaGVzID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBiaV93aW5kdXAocykgewogICAgICAgIGlmIChzLmJpX3ZhbGlkID4gOCkgewogICAgICAgICAgcHV0X3Nob3J0KHMsIHMuYmlfYnVmKTsKICAgICAgICB9IGVsc2UgaWYgKHMuYmlfdmFsaWQgPiAwKSB7CiAgICAgICAgICBzLnBlbmRpbmdfYnVmW3MucGVuZGluZysrXSA9IHMuYmlfYnVmOwogICAgICAgIH0KICAgICAgICBzLmJpX2J1ZiA9IDA7CiAgICAgICAgcy5iaV92YWxpZCA9IDA7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gY29weV9ibG9jayhzLCBidWYsIGxlbiwgaGVhZGVyKSB7CiAgICAgICAgYmlfd2luZHVwKHMpOwogICAgICAgIGlmIChoZWFkZXIpIHsKICAgICAgICAgIHB1dF9zaG9ydChzLCBsZW4pOwogICAgICAgICAgcHV0X3Nob3J0KHMsIH5sZW4pOwogICAgICAgIH0KICAgICAgICB1dGlscy5hcnJheVNldChzLnBlbmRpbmdfYnVmLCBzLndpbmRvdywgYnVmLCBsZW4sIHMucGVuZGluZyk7CiAgICAgICAgcy5wZW5kaW5nICs9IGxlbjsKICAgICAgfQogICAgICBmdW5jdGlvbiBzbWFsbGVyKHRyZWUsIG4sIG0sIGRlcHRoKSB7CiAgICAgICAgdmFyIF9uMiA9IG4gKiAyOwogICAgICAgIHZhciBfbTIgPSBtICogMjsKICAgICAgICByZXR1cm4gdHJlZVtfbjJdIDwgdHJlZVtfbTJdIHx8IHRyZWVbX24yXSA9PT0gdHJlZVtfbTJdICYmIGRlcHRoW25dIDw9IGRlcHRoW21dOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHBxZG93bmhlYXAocywgdHJlZSwgaykgewogICAgICAgIHZhciB2ID0gcy5oZWFwW2tdOwogICAgICAgIHZhciBqID0gayA8PCAxOwogICAgICAgIHdoaWxlIChqIDw9IHMuaGVhcF9sZW4pIHsKICAgICAgICAgIGlmIChqIDwgcy5oZWFwX2xlbiAmJiBzbWFsbGVyKHRyZWUsIHMuaGVhcFtqICsgMV0sIHMuaGVhcFtqXSwgcy5kZXB0aCkpIHsKICAgICAgICAgICAgaisrOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHNtYWxsZXIodHJlZSwgdiwgcy5oZWFwW2pdLCBzLmRlcHRoKSkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICAgIHMuaGVhcFtrXSA9IHMuaGVhcFtqXTsKICAgICAgICAgIGsgPSBqOwogICAgICAgICAgaiA8PD0gMTsKICAgICAgICB9CiAgICAgICAgcy5oZWFwW2tdID0gdjsKICAgICAgfQogICAgICBmdW5jdGlvbiBjb21wcmVzc19ibG9jayhzLCBsdHJlZSwgZHRyZWUpIHsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgbGM7CiAgICAgICAgdmFyIGx4ID0gMDsKICAgICAgICB2YXIgY29kZTsKICAgICAgICB2YXIgZXh0cmE7CiAgICAgICAgaWYgKHMubGFzdF9saXQgIT09IDApIHsKICAgICAgICAgIGRvIHsKICAgICAgICAgICAgZGlzdCA9IHMucGVuZGluZ19idWZbcy5kX2J1ZiArIGx4ICogMl0gPDwgOCB8IHMucGVuZGluZ19idWZbcy5kX2J1ZiArIGx4ICogMiArIDFdOwogICAgICAgICAgICBsYyA9IHMucGVuZGluZ19idWZbcy5sX2J1ZiArIGx4XTsKICAgICAgICAgICAgbHgrKzsKICAgICAgICAgICAgaWYgKGRpc3QgPT09IDApIHsKICAgICAgICAgICAgICBzZW5kX2NvZGUocywgbGMsIGx0cmVlKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBjb2RlID0gX2xlbmd0aF9jb2RlW2xjXTsKICAgICAgICAgICAgICBzZW5kX2NvZGUocywgY29kZSArIExJVEVSQUxTICsgMSwgbHRyZWUpOwogICAgICAgICAgICAgIGV4dHJhID0gZXh0cmFfbGJpdHNbY29kZV07CiAgICAgICAgICAgICAgaWYgKGV4dHJhICE9PSAwKSB7CiAgICAgICAgICAgICAgICBsYyAtPSBiYXNlX2xlbmd0aFtjb2RlXTsKICAgICAgICAgICAgICAgIHNlbmRfYml0cyhzLCBsYywgZXh0cmEpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBkaXN0LS07CiAgICAgICAgICAgICAgY29kZSA9IGRfY29kZShkaXN0KTsKICAgICAgICAgICAgICBzZW5kX2NvZGUocywgY29kZSwgZHRyZWUpOwogICAgICAgICAgICAgIGV4dHJhID0gZXh0cmFfZGJpdHNbY29kZV07CiAgICAgICAgICAgICAgaWYgKGV4dHJhICE9PSAwKSB7CiAgICAgICAgICAgICAgICBkaXN0IC09IGJhc2VfZGlzdFtjb2RlXTsKICAgICAgICAgICAgICAgIHNlbmRfYml0cyhzLCBkaXN0LCBleHRyYSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9IHdoaWxlIChseCA8IHMubGFzdF9saXQpOwogICAgICAgIH0KICAgICAgICBzZW5kX2NvZGUocywgRU5EX0JMT0NLLCBsdHJlZSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYnVpbGRfdHJlZShzLCBkZXNjKSB7CiAgICAgICAgdmFyIHRyZWUgPSBkZXNjLmR5bl90cmVlOwogICAgICAgIHZhciBzdHJlZSA9IGRlc2Muc3RhdF9kZXNjLnN0YXRpY190cmVlOwogICAgICAgIHZhciBoYXNfc3RyZWUgPSBkZXNjLnN0YXRfZGVzYy5oYXNfc3RyZWU7CiAgICAgICAgdmFyIGVsZW1zID0gZGVzYy5zdGF0X2Rlc2MuZWxlbXM7CiAgICAgICAgdmFyIG4sIG07CiAgICAgICAgdmFyIG1heF9jb2RlID0gLTE7CiAgICAgICAgdmFyIG5vZGU7CiAgICAgICAgcy5oZWFwX2xlbiA9IDA7CiAgICAgICAgcy5oZWFwX21heCA9IEhFQVBfU0laRTsKICAgICAgICBmb3IgKG4gPSAwOyBuIDwgZWxlbXM7IG4rKykgewogICAgICAgICAgaWYgKHRyZWVbbiAqIDJdICE9PSAwKSB7CiAgICAgICAgICAgIHMuaGVhcFsrK3MuaGVhcF9sZW5dID0gbWF4X2NvZGUgPSBuOwogICAgICAgICAgICBzLmRlcHRoW25dID0gMDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRyZWVbbiAqIDIgKyAxXSA9IDA7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHdoaWxlIChzLmhlYXBfbGVuIDwgMikgewogICAgICAgICAgbm9kZSA9IHMuaGVhcFsrK3MuaGVhcF9sZW5dID0gbWF4X2NvZGUgPCAyID8gKyttYXhfY29kZSA6IDA7CiAgICAgICAgICB0cmVlW25vZGUgKiAyXSA9IDE7CiAgICAgICAgICBzLmRlcHRoW25vZGVdID0gMDsKICAgICAgICAgIHMub3B0X2xlbi0tOwogICAgICAgICAgaWYgKGhhc19zdHJlZSkgewogICAgICAgICAgICBzLnN0YXRpY19sZW4gLT0gc3RyZWVbbm9kZSAqIDIgKyAxXTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZGVzYy5tYXhfY29kZSA9IG1heF9jb2RlOwogICAgICAgIGZvciAobiA9IHMuaGVhcF9sZW4gPj4gMTsgbiA+PSAxOyBuLS0pIHsKICAgICAgICAgIHBxZG93bmhlYXAocywgdHJlZSwgbik7CiAgICAgICAgfQogICAgICAgIG5vZGUgPSBlbGVtczsKICAgICAgICBkbyB7CiAgICAgICAgICBuID0gcy5oZWFwWzFdOwogICAgICAgICAgcy5oZWFwWzFdID0gcy5oZWFwW3MuaGVhcF9sZW4tLV07CiAgICAgICAgICBwcWRvd25oZWFwKHMsIHRyZWUsIDEpOwogICAgICAgICAgbSA9IHMuaGVhcFsxXTsKICAgICAgICAgIHMuaGVhcFstLXMuaGVhcF9tYXhdID0gbjsKICAgICAgICAgIHMuaGVhcFstLXMuaGVhcF9tYXhdID0gbTsKICAgICAgICAgIHRyZWVbbm9kZSAqIDJdID0gdHJlZVtuICogMl0gKyB0cmVlW20gKiAyXTsKICAgICAgICAgIHMuZGVwdGhbbm9kZV0gPSAocy5kZXB0aFtuXSA+PSBzLmRlcHRoW21dID8gcy5kZXB0aFtuXSA6IHMuZGVwdGhbbV0pICsgMTsKICAgICAgICAgIHRyZWVbbiAqIDIgKyAxXSA9IHRyZWVbbSAqIDIgKyAxXSA9IG5vZGU7CiAgICAgICAgICBzLmhlYXBbMV0gPSBub2RlKys7CiAgICAgICAgICBwcWRvd25oZWFwKHMsIHRyZWUsIDEpOwogICAgICAgIH0gd2hpbGUgKHMuaGVhcF9sZW4gPj0gMik7CiAgICAgICAgcy5oZWFwWy0tcy5oZWFwX21heF0gPSBzLmhlYXBbMV07CiAgICAgICAgZ2VuX2JpdGxlbihzLCBkZXNjKTsKICAgICAgICBnZW5fY29kZXModHJlZSwgbWF4X2NvZGUsIHMuYmxfY291bnQpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNjYW5fdHJlZShzLCB0cmVlLCBtYXhfY29kZSkgewogICAgICAgIHZhciBuOwogICAgICAgIHZhciBwcmV2bGVuID0gLTE7CiAgICAgICAgdmFyIGN1cmxlbjsKICAgICAgICB2YXIgbmV4dGxlbiA9IHRyZWVbMCAqIDIgKyAxXTsKICAgICAgICB2YXIgY291bnQgPSAwOwogICAgICAgIHZhciBtYXhfY291bnQgPSA3OwogICAgICAgIHZhciBtaW5fY291bnQgPSA0OwogICAgICAgIGlmIChuZXh0bGVuID09PSAwKSB7CiAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgIH0KICAgICAgICB0cmVlWyhtYXhfY29kZSArIDEpICogMiArIDFdID0gNjU1MzU7CiAgICAgICAgZm9yIChuID0gMDsgbiA8PSBtYXhfY29kZTsgbisrKSB7CiAgICAgICAgICBjdXJsZW4gPSBuZXh0bGVuOwogICAgICAgICAgbmV4dGxlbiA9IHRyZWVbKG4gKyAxKSAqIDIgKyAxXTsKICAgICAgICAgIGlmICgrK2NvdW50IDwgbWF4X2NvdW50ICYmIGN1cmxlbiA9PT0gbmV4dGxlbikgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0gZWxzZSBpZiAoY291bnQgPCBtaW5fY291bnQpIHsKICAgICAgICAgICAgcy5ibF90cmVlW2N1cmxlbiAqIDJdICs9IGNvdW50OwogICAgICAgICAgfSBlbHNlIGlmIChjdXJsZW4gIT09IDApIHsKICAgICAgICAgICAgaWYgKGN1cmxlbiAhPT0gcHJldmxlbikgewogICAgICAgICAgICAgIHMuYmxfdHJlZVtjdXJsZW4gKiAyXSsrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHMuYmxfdHJlZVtSRVBfM182ICogMl0rKzsKICAgICAgICAgIH0gZWxzZSBpZiAoY291bnQgPD0gMTApIHsKICAgICAgICAgICAgcy5ibF90cmVlW1JFUFpfM18xMCAqIDJdKys7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLmJsX3RyZWVbUkVQWl8xMV8xMzggKiAyXSsrOwogICAgICAgICAgfQogICAgICAgICAgY291bnQgPSAwOwogICAgICAgICAgcHJldmxlbiA9IGN1cmxlbjsKICAgICAgICAgIGlmIChuZXh0bGVuID09PSAwKSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDEzODsKICAgICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDY7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBtYXhfY291bnQgPSA3OwogICAgICAgICAgICBtaW5fY291bnQgPSA0OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBzZW5kX3RyZWUocywgdHJlZSwgbWF4X2NvZGUpIHsKICAgICAgICB2YXIgbjsKICAgICAgICB2YXIgcHJldmxlbiA9IC0xOwogICAgICAgIHZhciBjdXJsZW47CiAgICAgICAgdmFyIG5leHRsZW4gPSB0cmVlWzAgKiAyICsgMV07CiAgICAgICAgdmFyIGNvdW50ID0gMDsKICAgICAgICB2YXIgbWF4X2NvdW50ID0gNzsKICAgICAgICB2YXIgbWluX2NvdW50ID0gNDsKICAgICAgICBpZiAobmV4dGxlbiA9PT0gMCkgewogICAgICAgICAgbWF4X2NvdW50ID0gMTM4OwogICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICB9CiAgICAgICAgZm9yIChuID0gMDsgbiA8PSBtYXhfY29kZTsgbisrKSB7CiAgICAgICAgICBjdXJsZW4gPSBuZXh0bGVuOwogICAgICAgICAgbmV4dGxlbiA9IHRyZWVbKG4gKyAxKSAqIDIgKyAxXTsKICAgICAgICAgIGlmICgrK2NvdW50IDwgbWF4X2NvdW50ICYmIGN1cmxlbiA9PT0gbmV4dGxlbikgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0gZWxzZSBpZiAoY291bnQgPCBtaW5fY291bnQpIHsKICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjdXJsZW4sIHMuYmxfdHJlZSk7CiAgICAgICAgICAgIH0gd2hpbGUgKC0tY291bnQgIT09IDApOwogICAgICAgICAgfSBlbHNlIGlmIChjdXJsZW4gIT09IDApIHsKICAgICAgICAgICAgaWYgKGN1cmxlbiAhPT0gcHJldmxlbikgewogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjdXJsZW4sIHMuYmxfdHJlZSk7CiAgICAgICAgICAgICAgY291bnQtLTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZW5kX2NvZGUocywgUkVQXzNfNiwgcy5ibF90cmVlKTsKICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGNvdW50IC0gMywgMik7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvdW50IDw9IDEwKSB7CiAgICAgICAgICAgIHNlbmRfY29kZShzLCBSRVBaXzNfMTAsIHMuYmxfdHJlZSk7CiAgICAgICAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDMsIDMpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgc2VuZF9jb2RlKHMsIFJFUFpfMTFfMTM4LCBzLmJsX3RyZWUpOwogICAgICAgICAgICBzZW5kX2JpdHMocywgY291bnQgLSAxMSwgNyk7CiAgICAgICAgICB9CiAgICAgICAgICBjb3VudCA9IDA7CiAgICAgICAgICBwcmV2bGVuID0gY3VybGVuOwogICAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gMTM4OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIGlmIChjdXJsZW4gPT09IG5leHRsZW4pIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNjsKICAgICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDc7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJ1aWxkX2JsX3RyZWUocykgewogICAgICAgIHZhciBtYXhfYmxpbmRleDsKICAgICAgICBzY2FuX3RyZWUocywgcy5keW5fbHRyZWUsIHMubF9kZXNjLm1heF9jb2RlKTsKICAgICAgICBzY2FuX3RyZWUocywgcy5keW5fZHRyZWUsIHMuZF9kZXNjLm1heF9jb2RlKTsKICAgICAgICBidWlsZF90cmVlKHMsIHMuYmxfZGVzYyk7CiAgICAgICAgZm9yIChtYXhfYmxpbmRleCA9IEJMX0NPREVTIC0gMTsgbWF4X2JsaW5kZXggPj0gMzsgbWF4X2JsaW5kZXgtLSkgewogICAgICAgICAgaWYgKHMuYmxfdHJlZVtibF9vcmRlclttYXhfYmxpbmRleF0gKiAyICsgMV0gIT09IDApIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHMub3B0X2xlbiArPSAzICogKG1heF9ibGluZGV4ICsgMSkgKyA1ICsgNSArIDQ7CiAgICAgICAgcmV0dXJuIG1heF9ibGluZGV4OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNlbmRfYWxsX3RyZWVzKHMsIGxjb2RlcywgZGNvZGVzLCBibGNvZGVzKSB7CiAgICAgICAgdmFyIHJhbms7CiAgICAgICAgc2VuZF9iaXRzKHMsIGxjb2RlcyAtIDI1NywgNSk7CiAgICAgICAgc2VuZF9iaXRzKHMsIGRjb2RlcyAtIDEsIDUpOwogICAgICAgIHNlbmRfYml0cyhzLCBibGNvZGVzIC0gNCwgNCk7CiAgICAgICAgZm9yIChyYW5rID0gMDsgcmFuayA8IGJsY29kZXM7IHJhbmsrKykgewogICAgICAgICAgc2VuZF9iaXRzKHMsIHMuYmxfdHJlZVtibF9vcmRlcltyYW5rXSAqIDIgKyAxXSwgMyk7CiAgICAgICAgfQogICAgICAgIHNlbmRfdHJlZShzLCBzLmR5bl9sdHJlZSwgbGNvZGVzIC0gMSk7CiAgICAgICAgc2VuZF90cmVlKHMsIHMuZHluX2R0cmVlLCBkY29kZXMgLSAxKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZXRlY3RfZGF0YV90eXBlKHMpIHsKICAgICAgICB2YXIgYmxhY2tfbWFzayA9IDQwOTM2MjQ0NDc7CiAgICAgICAgdmFyIG47CiAgICAgICAgZm9yIChuID0gMDsgbiA8PSAzMTsgbisrLCBibGFja19tYXNrID4+Pj0gMSkgewogICAgICAgICAgaWYgKGJsYWNrX21hc2sgJiAxICYmIHMuZHluX2x0cmVlW24gKiAyXSAhPT0gMCkgewogICAgICAgICAgICByZXR1cm4gWl9CSU5BUlk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLmR5bl9sdHJlZVs5ICogMl0gIT09IDAgfHwgcy5keW5fbHRyZWVbMTAgKiAyXSAhPT0gMCB8fCBzLmR5bl9sdHJlZVsxMyAqIDJdICE9PSAwKSB7CiAgICAgICAgICByZXR1cm4gWl9URVhUOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAzMjsgbiA8IExJVEVSQUxTOyBuKyspIHsKICAgICAgICAgIGlmIChzLmR5bl9sdHJlZVtuICogMl0gIT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIFpfVEVYVDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIFpfQklOQVJZOwogICAgICB9CiAgICAgIHZhciBzdGF0aWNfaW5pdF9kb25lID0gZmFsc2U7CiAgICAgIGZ1bmN0aW9uIF90cl9pbml0KHMpIHsKICAgICAgICBpZiAoIXN0YXRpY19pbml0X2RvbmUpIHsKICAgICAgICAgIHRyX3N0YXRpY19pbml0KCk7CiAgICAgICAgICBzdGF0aWNfaW5pdF9kb25lID0gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgcy5sX2Rlc2MgPSBuZXcgVHJlZURlc2Mocy5keW5fbHRyZWUsIHN0YXRpY19sX2Rlc2MpOwogICAgICAgIHMuZF9kZXNjID0gbmV3IFRyZWVEZXNjKHMuZHluX2R0cmVlLCBzdGF0aWNfZF9kZXNjKTsKICAgICAgICBzLmJsX2Rlc2MgPSBuZXcgVHJlZURlc2Mocy5ibF90cmVlLCBzdGF0aWNfYmxfZGVzYyk7CiAgICAgICAgcy5iaV9idWYgPSAwOwogICAgICAgIHMuYmlfdmFsaWQgPSAwOwogICAgICAgIGluaXRfYmxvY2socyk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX3RyX3N0b3JlZF9ibG9jayhzLCBidWYsIHN0b3JlZF9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H0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgb3B0X2xlbmIgPSBzdGF0aWNfbGVuYiA9IHN0b3JlZF9sZW4gKyA1OwogICAgICAgIH0KICAgICAgICBpZiAoc3RvcmVkX2xlbiArIDQgPD0gb3B0X2xlbmIgJiYgYnVmICE9PSAtMSkgewogICAgICAgICAgX3RyX3N0b3JlZF9ibG9jayhzLCBidWYsIHN0b3JlZF9sZW4sIGxhc3QpOwogICAgICAgIH0gZWxzZSBpZiAocy5zdHJhdGVneSA9PT0gWl9GSVhFRCB8fCBzdGF0aWNfbGVuYiA9PT0gb3B0X2xlbmIpIHsKICAgICAgICAgIHNlbmRfYml0cyhzLCAoU1RBVElDX1RSRUVTIDw8IDEpICsgKGxhc3QgPyAxIDogMCksIDMpOwogICAgICAgICAgY29tcHJlc3NfYmxvY2socywgc3RhdGljX2x0cmVlLCBzdGF0aWNfZHRyZWUpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBzZW5kX2JpdHMocywgKERZTl9UUkVFUyA8PCAxKSArIChsYXN0ID8gMSA6IDApLCAzKTsKICAgICAgICAgIHNlbmRfYWxsX3RyZWVzKHMsIHMubF9kZXNjLm1heF9jb2RlICsgMSwgcy5kX2Rlc2MubWF4X2NvZGUgKyAxLCBtYXhfYmxpbmRleCArIDEpOwogICAgICAgICAgY29tcHJlc3NfYmxvY2socywgcy5keW5fbHRyZWUsIHMuZHluX2R0cmVlKTsKICAgICAgICB9CiAgICAgICAgaW5pdF9ibG9jayhzKTsKICAgICAgICBpZiAobGFzdCkgewogICAgICAgICAgYmlfd2luZHVwKHMpOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBfdHJfdGFsbHkocywgZGlzdCwgbGMpIHsKICAgICAgICBzLnBlbmRpbmdfYnVmW3MuZF9idWYgKyBzLmxhc3RfbGl0ICogMl0gPSBkaXN0ID4+PiA4ICYgMjU1OwogICAgICAgIHMucGVuZGluZ19idWZbcy5kX2J1ZiArIHMubGFzdF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ZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBmdW5jdGlvbiBhZGxlcjMyKGFkbGVyLCBidWYsIGxlbiwgcG9zKSB7CiAgICAgICAgdmFyIHMxID0gYWRsZXIgJiA2NTUzNSB8IDAsIHMyID0gYWRsZXIgPj4+IDE2ICYgNjU1MzUgfCAwLCBuID0gMDsKICAgICAgICB3aGlsZSAobGVuICE9PSAwKSB7CiAgICAgICAgICBuID0gbGVuID4gMmUzID8gMmUzIDogbGVuOwogICAgICAgICAgbGVuIC09IG47CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIHMxID0gczEgKyBidWZbcG9zKytdIHwgMDsKICAgICAgICAgICAgczIgPSBzMiArIHMxIHwgMDsKICAgICAgICAgIH0gd2hpbGUgKC0tbik7CiAgICAgICAgICBzMSAlPSA2NTUyMTsKICAgICAgICAgIHMyICU9IDY1NTIxOwogICAgICAgIH0KICAgICAgICByZXR1cm4gczEgfCBzMiA8PCAxNiB8IDA7CiAgICAgIH0KICAgICAgbW9kdWxlMi5leHBvcnRzID0gYWRsZXIzMjsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2NyYzMyLmpzCiAgdmFyIHJlcXVpcmVfY3JjMzIgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvY3JjMzIuanMiKGV4cG9ydHMyLCBtb2R1bGUyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBmdW5jdGlvbiBtYWtlVGFibGUoKSB7CiAgICAgICAgdmFyIGMsIHRhYmxlID0gW107CiAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCAyNTY7IG4rKykgewogICAgICAgICAgYyA9IG47CiAgICAgICAgICBmb3IgKHZhciBrID0gMDsgayA8IDg7IGsrKykgewogICAgICAgICAgICBjID0gYyAmIDEgPyAzOTg4MjkyMzg0IF4gYyA+Pj4gMSA6IGMgPj4+IDE7CiAgICAgICAgICB9CiAgICAgICAgICB0YWJsZVtuXSA9IGM7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0YWJsZTsKICAgICAgfQogICAgICB2YXIgY3JjVGFibGUgPSBtYWtlVGFibGUoKTsKICAgICAgZnVuY3Rpb24gY3JjMzIoY3JjLCBidWYsIGxlbiwgcG9zKSB7CiAgICAgICAgdmFyIHQgPSBjcmNUYWJsZSwgZW5kID0gcG9zICsgbGVuOwogICAgICAgIGNyYyBePSAtMTsKICAgICAgICBmb3IgKHZhciBpID0gcG9zOyBpIDwgZW5kOyBpKyspIHsKICAgICAgICAgIGNyYyA9IGNyYyA+Pj4gOCBeIHRbKGNyYyBeIGJ1ZltpXSkgJiAyNTVdOwogICAgICAgIH0KICAgICAgICByZXR1cm4gY3JjIF4gLTE7CiAgICAgIH0KICAgICAgbW9kdWxlMi5leHBvcnRzID0gY3JjMzI7CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9tZXNzYWdlcy5qcwogIHZhciByZXF1aXJlX21lc3NhZ2VzID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL21lc3NhZ2VzLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgbW9kdWxlMi5leHBvcnRzID0gewogICAgICAgIDI6ICJuZWVkIGRpY3Rpb25hcnkiLAogICAgICAgIDE6ICJzdHJlYW0gZW5kIiwKICAgICAgICAwOiAiIiwKICAg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iA9IC0yOwogICAgICB2YXIgWl9EQVRBX0VSUk9SID0gLTM7CiAgICAgIHZhciBaX0JVRl9FUlJPUiA9IC01OwogICAgICB2YXIgWl9ERUZBVUxUX0NPTVBSRVNTSU9OID0gLTE7CiAgICAgIHZhciBaX0ZJTFRFUkVEID0gMTsKICAgICAgdmFyIFpfSFVGRk1BTl9PTkxZID0gMjsKICAgICAgdmFyIFpfUkxFID0gMzsKICAgICAgdmFyIFpfRklYRUQgPSA0OwogICAgICB2YXIgWl9ERUZBVUxUX1NUUkFURUdZID0gMDsKICAgICAgdmFyIFpfVU5LTk9XTiA9IDI7CiAgICAgIHZhciBaX0RFRkxBVEVEID0gODsKICAgICAgdmFyIE1BWF9NRU1fTEVWRUwgPSA5OwogICAgICB2YXIgTUFYX1dCSVRTID0gMTU7CiAgICAgIHZhciBERUZfTUVNX0xFVkVMID0gODsKICAgICAgdmFyIExFTkdUSF9DT0RFUyA9IDI5OwogICAgICB2YXIgTElURVJBTFMgPSAyNTY7CiAgICAgIHZhciBMX0NPREVTID0gTElURVJBTFMgKyAxICsgTEVOR1RIX0NPREVTOwogICAgICB2YXIgRF9DT0RFUyA9IDMwOwogICAgICB2YXIgQkxfQ09ERVMgPSAxOTsKICAgICAgdmFyIEhFQVBfU0laRSA9IDIgKiBMX0NPREVTICsgMTsKICAgICAgdmFyIE1BWF9CSVRTID0gMTU7CiAgICAgIHZhciBNSU5fTUFUQ0ggPSAzOwogICAgICB2YXIgTUFYX01BVENIID0gMjU4OwogICAgICB2YXIgTUlOX0xPT0tBSEVBRCA9IE1BWF9NQVRDSCArIE1JTl9NQVRDSCArIDE7CiAgICAgIHZhciBQUkVTRVRfRElDVCA9IDMyOwogICAgICB2YXIgSU5JVF9TVEFURSA9IDQyOwogICAgICB2YXIgRVhUUkFfU1RBVEUgPSA2OTsKICAgICAgdmFyIE5BTUVfU1RBVEUgPSA3MzsKICAgICAgdmFyIENPTU1FTlRfU1RBVEUgPSA5MTsKICAgICAgdmFyIEhDUkNfU1RBVEUgPSAxMDM7CiAgICAgIHZhciBCVVNZX1NUQVRFID0gMTEzOwogICAgICB2YXIgRklOSVNIX1NUQVRFID0gNjY2OwogICAgICB2YXIgQlNfTkVFRF9NT1JFID0gMTsKICAgICAgdmFyIEJTX0JMT0NLX0RPTkUgPSAyOwogICAgICB2YXIgQlNfRklOSVNIX1NUQVJURUQgPSAzOwogICAgICB2YXIgQlNfRklOSVNIX0RPTkUgPSA0OwogICAgICB2YXIgT1NfQ09ERSA9IDM7CiAgICAgIGZ1bmN0aW9uIGVycihzdHJtLCBlcnJvckNvZGUpIHsKICAgICAgICBzdHJtLm1zZyA9IG1zZ1tlcnJvckNvZGVdOwogICAgICAgIHJldHVybiBlcnJvckNvZGU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcmFuayhmKSB7CiAgICAgICAgcmV0dXJuIChmIDw8IDEpIC0gKGYgPiA0ID8gOSA6IDApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHplcm8oYnVmKSB7CiAgICAgICAgdmFyIGxlbiA9IGJ1Zi5sZW5ndGg7CiAgICAgICAgd2hpbGUgKC0tbGVuID49IDApIHsKICAgICAgICAgIGJ1ZltsZW5dID0gMDsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZmx1c2hfcGVuZGluZyhzdHJtKSB7CiAgICAgICAgdmFyIHMgPSBzdHJtLnN0YXRlOwogICAgICAgIHZhciBsZW4gPSBzLnBlbmRpbmc7CiAgICAgICAgaWYgKGxlbiA+IHN0cm0uYXZhaWxfb3V0KSB7CiAgICAgICAgICBsZW4gPSBzdHJtLmF2YWlsX291dDsKICAgICAgICB9CiAgICAgICAgaWYgKGxlbiA9PT0gMCkgewogICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICB1dGlscy5hcnJheVNldChzdHJtLm91dHB1dCwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nX291dCwgbGVuLCBzdHJtLm5leHRfb3V0KTsKICAgICAgICBzdHJtLm5leHRfb3V0ICs9IGxlbjsKICAgICAgICBzLnBlbmRpbmdfb3V0ICs9IGxlbjsKICAgICAgICBzdHJtLnRvdGFsX291dCArPSBsZW47CiAgICAgICAgc3RybS5hdmFpbF9vdXQgLT0gbGVuOwogICAgICAgIHMucGVuZGluZyAtPSBsZW47CiAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gMCkgewogICAgICAgICAgcy5wZW5kaW5nX291dCA9IDA7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZsdXNoX2Jsb2NrX29ubHkocywgbGFzdCkgewogICAgICAgIHRyZWVzLl90cl9mbHVzaF9ibG9jayhzLCBzLmJsb2NrX3N0YXJ0ID49IDAgPyBzLmJsb2NrX3N0YXJ0IDogLTEsIHMuc3Ryc3RhcnQgLSBzLmJsb2NrX3N0YXJ0LCBsYXN0KTsKICAgICAgICBzLmJsb2NrX3N0YXJ0ID0gcy5zdHJzdGFydDsKICAgICAgICBmbHVzaF9wZW5kaW5nKHMuc3RybSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcHV0X2J5dGUocywgYikgewogICAgICAgIHMucGVuZGluZ19idWZbcy5wZW5kaW5nKytdID0gYjsKICAgICAgfQogICAgICBmdW5jdGlvbiBwdXRTaG9ydE1TQihzLCBiKSB7CiAgICAgICAgcy5wZW5kaW5nX2J1ZltzLnBlbmRpbmcrK10gPSBiID4+PiA4ICYgMjU1OwogICAgICAgIHMucGVuZGluZ19idWZbcy5wZW5kaW5nKytdID0gYiAmIDI1NTsKICAgICAgfQogICAgICBmdW5jdGlvbiByZWFkX2J1ZihzdHJtLCBidWYsIHN0YXJ0LCBzaXplKSB7CiAgICAgICAgdmFyIGxlbiA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgaWYgKGxlbiA+IHNpemUpIHsKICAgICAgICAgIGxlbiA9IHNpemU7CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gPT09IDApIHsKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgICAgICBzdHJtLmF2YWlsX2luIC09IGxlbjsKICAgICAgICB1dGlscy5hcnJheVNldChidWYsIHN0cm0uaW5wdXQsIHN0cm0ubmV4dF9pbiwgbGVuLCBzdGFydCk7CiAgICAgICAgaWYgKHN0cm0uc3RhdGUud3JhcCA9PT0gMSkgewogICAgICAgICAgc3RybS5hZGxlciA9IGFkbGVyMzIoc3RybS5hZGxlciwgYnVmLCBsZW4sIHN0YXJ0KTsKICAgICAgICB9IGVsc2UgaWYgKHN0cm0uc3RhdGUud3JhcCA9PT0gMikgewogICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIGJ1ZiwgbGVuLCBzdGFydCk7CiAgICAgICAgfQogICAgICAgIHN0cm0ubmV4dF9pbiArPSBsZW47CiAgICAgICAgc3RybS50b3RhbF9pbiArPSBsZW47CiAgICAgICAgcmV0dXJuIGxlbjsKICAgICAgfQogICAgICBmdW5jdGlvbiBsb25nZXN0X21hdGNoKHMsIGN1cl9tYXRjaCkgewogICAgICAgIHZhciBjaGFpbl9sZW5ndGggPSBzLm1heF9jaGFpbl9sZW5ndGg7CiAgICAgICAgdmFyIHNjYW4gPSBzLnN0cnN0YXJ0OwogICAgICAgIHZhciBtYXRjaDsKICAgICAgICB2YXIgbGVuOwogICAgICAgIHZhciBiZXN0X2xlbiA9IHMucHJldl9sZW5ndGg7CiAgICAgICAgdmFyIG5pY2VfbWF0Y2ggPSBzLm5pY2VfbWF0Y2g7CiAgICAgICAgdmFyIGxpbWl0ID0gcy5zdHJzdGFydCA+IHMud19zaXplIC0gTUlOX0xPT0tBSEVBRCA/IHMuc3Ryc3RhcnQgLSAocy53X3NpemUgLSBNSU5fTE9PS0FIRUFEKSA6IDA7CiAgICAgICAgdmFyIF93aW4gPSBzLndpbmRvdzsKICAgICAgICB2YXIgd21hc2sgPSBzLndfbWFzazsKICAgICAgICB2YXIgcHJldiA9IHMucHJldjsKICAgICAgICB2YXIgc3RyZW5kID0gcy5zdHJzdGFydCArIE1BWF9NQVRDSDsKICAgICAgICB2YXIgc2Nhbl9lbmQxID0gX3dpbltzY2FuICsgYmVzdF9sZW4gLSAxXTsKICAgICAgICB2YXIgc2Nhbl9lbmQgPSBfd2luW3NjYW4gKyBiZXN0X2xlbl07CiAgICAgICAgaWYgKHMucHJldl9sZW5ndGggPj0gcy5nb29kX21hdGNoKSB7CiAgICAgICAgICBjaGFpbl9sZW5ndGggPj49IDI7CiAgICAgICAgfQogICAgICAgIGlmIChuaWNlX21hdGNoID4gcy5sb29rYWhlYWQpIHsKICAgICAgICAgIG5pY2VfbWF0Y2ggPSBzLmxvb2thaGVhZDsKICAgICAgICB9CiAgICAgICAgZG8gewogICAgICAgICAgbWF0Y2ggPSBjdXJfbWF0Y2g7CiAgICAgICAgICBpZiAoX3dpblttYXRjaCArIGJlc3RfbGVuXSAhPT0gc2Nhbl9lbmQgfHwgX3dpblttYXRjaCArIGJlc3RfbGVuIC0gMV0gIT09IHNjYW5fZW5kMSB8fCBfd2luW21hdGNoXSAhPT0gX3dpbltzY2FuXSB8fCBfd2luWysrbWF0Y2hdICE9PSBfd2luW3NjYW4gKyAxXSkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIHNjYW4gKz0gMjsKICAgICAgICAgIG1hdGNoKys7CiAgICAgICAgICBkbyB7CiAgICAgICAgICB9IHdoaWxlIChfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIHNjYW4gPCBzdHJlbmQpOwogICAgICAgICAgbGVuID0gTUFYX01BVENIIC0gKHN0cmVuZCAtIHNjYW4pOwogICAgICAgICAgc2NhbiA9IHN0cmVuZCAtIE1BWF9NQVRDSDsKICAgICAgICAgIGlmIChsZW4gPiBiZXN0X2xlbikgewogICAgICAgICAgICBzLm1hdGNoX3N0YXJ0ID0gY3VyX21hdGNoOwogICAgICAgICAgICBiZXN0X2xlbiA9IGxlbjsKICAgICAgICAgICAgaWYgKGxlbiA+PSBuaWNlX21hdGNoKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2Nhbl9lbmQxID0gX3dpbltzY2FuICsgYmVzdF9sZW4gLSAxXTsKICAgICAgICAgICAgc2Nhbl9lbmQgPSBfd2luW3NjYW4gKyBiZXN0X2xlbl07CiAgICAgICAgICB9CiAgICAgICAgfSB3aGlsZSAoKGN1cl9tYXRjaCA9IHByZXZbY3VyX21hdGNoICYgd21hc2tdKSA+IGxpbWl0ICYmIC0tY2hhaW5fbGVuZ3RoICE9PSAwKTsKICAgICAgICBpZiAoYmVzdF9sZW4gPD0gcy5sb29rYWhlYWQpIHsKICAgICAgICAgIHJldHVybiBiZXN0X2xlbjsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHMubG9va2FoZWFkOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZpbGxfd2luZG93KHMpIHsKICAgICAgICB2YXIgX3dfc2l6ZSA9IHMud19zaXplOwogICAgICAgIHZhciBwLCBuLCBtLCBtb3JlLCBzdHI7CiAgICAgICAgZG8gewogICAgICAgICAgbW9yZSA9IHMud2luZG93X3NpemUgLSBzLmxvb2thaGVhZCAtIHMuc3Ryc3RhcnQ7CiAgICAgICAgICBpZiAocy5zdHJzdGFydCA+PSBfd19zaXplICsgKF93X3NpemUgLSBNSU5fTE9PS0FIRUFEKSkgewogICAgICAgICAgICB1dGlscy5hcnJheVNldChzLndpbmRvdywgcy53aW5kb3csIF93X3NpemUsIF93X3NpemUsIDApOwogICAgICAgICAgICBzLm1hdGNoX3N0YXJ0IC09IF93X3NpemU7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgLT0gX3dfc2l6ZTsKICAgICAgICAgICAgcy5ibG9ja19zdGFydCAtPSBfd19zaXplOwogICAgICAgICAgICBuID0gcy5oYXNoX3NpemU7CiAgICAgICAgICAgIHAgPSBuOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgbSA9IHMuaGVhZFstLXBdOwogICAgICAgICAgICAgIHMuaGVhZFtwXSA9IG0gPj0gX3dfc2l6ZSA/IG0gLSBfd19zaXplIDogMDsKICAgICAgICAgICAgfSB3aGlsZSAoLS1uKTsKICAgICAgICAgICAgbiA9IF93X3NpemU7CiAgICAgICAgICAgIHAgPSBuOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgbSA9IHMucHJldlstLXBdOwogICAgICAgICAgICAgIHMucHJldltwXSA9IG0gPj0gX3dfc2l6ZSA/IG0gLSBfd19zaXplIDogMDsKICAgICAgICAgICAgfSB3aGlsZSAoLS1uKTsKICAgICAgICAgICAgbW9yZSArPSBfd19zaXplOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9pbiA9PT0gMCkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICAgIG4gPSByZWFkX2J1ZihzLnN0cm0sIHMud2luZG93LCBzLnN0cnN0YXJ0ICsgcy5sb29rYWhlYWQsIG1vcmUpOwogICAgICAgICAgcy5sb29rYWhlYWQgKz0gbjsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCArIHMuaW5zZXJ0ID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICBzdHIgPSBzLnN0cnN0YXJ0IC0gcy5pbnNlcnQ7CiAgICAgICAgICAgIHMuaW5zX2ggPSBzLndpbmRvd1tzdHJdOwogICAgICAgICAgICBzLmluc19oID0gKHMuaW5zX2ggPDwgcy5oYXNoX3NoaWZ0IF4gcy53aW5kb3dbc3RyICsgMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIHdoaWxlIChzLmluc2VydCkgewogICAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzdHIgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICBzLnByZXZbc3RyICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHN0cjsKICAgICAgICAgICAgICBzdHIrKzsKICAgICAgICAgICAgICBzLmluc2VydC0tOwogICAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCArIHMuaW5zZXJ0IDwgTUlOX01BVENIKSB7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9IHdoaWxlIChzLmxvb2thaGVhZCA8IE1JTl9MT09LQUhFQUQgJiYgcy5zdHJtLmF2YWlsX2luICE9PSAwKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX3N0b3JlZChzLCBmbHVzaCkgewogICAgICAgIHZhciBtYXhfYmxvY2tfc2l6ZSA9IDY1NTM1OwogICAgICAgIGlmIChtYXhfYmxvY2tfc2l6ZSA+IHMucGVuZGluZ19idWZfc2l6ZSAtIDUpIHsKICAgICAgICAgIG1heF9ibG9ja19zaXplID0gcy5wZW5kaW5nX2J1Zl9zaXplIC0gNTsKICAgICAgICB9CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPD0gMSkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwICYmIGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDApIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcy5zdHJzdGFydCArPSBzLmxvb2thaGVhZDsKICAgICAgICAgIHMubG9va2FoZWFkID0gMDsKICAgICAgICAgIHZhciBtYXhfc3RhcnQgPSBzLmJsb2NrX3N0YXJ0ICsgbWF4X2Jsb2NrX3NpemU7CiAgICAgICAgICBpZiAocy5zdHJzdGFydCA9PT0gMCB8fCBzLnN0cnN0YXJ0ID49IG1heF9zdGFydCkgewogICAgICAgICAgICBzLmxvb2thaGVhZCA9IHMuc3Ryc3RhcnQgLSBtYXhfc3RhcnQ7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgPSBtYXhfc3RhcnQ7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzLnN0cnN0YXJ0IC0gcy5ibG9ja19zdGFydCA+PSBzLndfc2l6ZSAtIE1JTl9MT09LQUhFQUQpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IDA7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMuc3Ryc3RhcnQgPiBzLmJsb2NrX3N0YXJ0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9mYXN0KHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGhhc2hfaGVhZDsKICAgICAgICB2YXIgYmZsdXNoOwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGhhc2hfaGVhZCA9IDA7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgTUlOX01BVEN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19oXTsKICAgICAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICAgICAgfSB3aGlsZSAoLS1zLm1hdGNoX2xlbmd0aCAhPT0gMCk7CiAgICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHMuc3Ryc3RhcnQgKz0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSAwOwogICAgICAgICAgICAgIHMuaW5zX2ggPSBzLndpbmRvd1tzLnN0cnN0YXJ0XTsKICAgICAgICAgICAgICBzLmluc19oID0gKHMuaW5zX2ggPDwgcy5oYXNoX3NoaWZ0IF4gcy53aW5kb3dbcy5zdHJzdGFydCArIDFdKSAmIHMuaGFzaF9tYXNrOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBiZmx1c2ggPSB0cmVlcy5fdHJfdGFsbHkocywgMCwgcy53aW5kb3dbcy5zdHJzdGFydF0pOwogICAgICAgICAgICBzLmxvb2thaGVhZC0tOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5pbnNlcnQgPSBzLnN0cnN0YXJ0IDwgTUlOX01BVENIIC0gMSA/IHMuc3Ryc3RhcnQgOiBNSU5fTUFUQ0ggLSAxOwogICAgICAgIGlmIChmbHVzaCA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgdHJ1ZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX1NUQVJURUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX0RPTkU7CiAgICAgICAgfQogICAgICAgIGlmIChzLmxhc3RfbGl0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBCU19CTE9DS19ET05FOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVfc2xvdyhzLCBmbHVzaCkgewogICAgICAgIHZhciBoYXNoX2hlYWQ7CiAgICAgICAgdmFyIGJmbHVzaDsKICAgICAgICB2YXIgbWF4X2luc2VydDsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8IE1JTl9MT09LQUhFQUQpIHsKICAgICAgICAgICAgZmlsbF93aW5kb3cocyk7CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8IE1JTl9MT09LQUhFQUQgJiYgZmx1c2ggPT09IFpfTk9fRkxVU0gpIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBoYXNoX2hlYWQgPSAwOwogICAgICAgICAgaWYgKHMubG9va2FoZWFkID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICBzLmluc19oID0gKHMuaW5zX2ggPDwgcy5oYXNoX3NoaWZ0IF4gcy53aW5kb3dbcy5zdHJzdGFydCArIE1JTl9NQVRDSC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WVzLl90cl90YWxseShzLCBzLnN0cnN0YXJ0IC0gMSAtIHMucHJldl9tYXRjaCwgcy5wcmV2X2xlbmd0aCAtIE1JTl9NQVRDSCk7CiAgICAgICAgICAgIHMubG9va2FoZWFkIC09IHMucHJldl9sZW5ndGggLSAxOwogICAgICAgICAgICBzLnByZXZfbGVuZ3RoIC09IDI7CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBpZiAoKytzLnN0cnN0YXJ0IDw9IG1heF9pbnNlcnQpIHsKICAgICAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgTUlOX01BVENIIC0gMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgICAgICBoYXNoX2hlYWQgPSBzLnByZXZbcy5zdHJzdGFydCAmIHMud19tYXNrXSA9IHMuaGVhZFtzLmluc19oXTsKICAgICAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IHdoaWxlICgtLXMucHJldl9sZW5ndGggIT09IDApOwogICAgICAgICAgICBzLm1hdGNoX2F2YWlsYWJsZSA9IDA7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gTUlOX01BVENIIC0gMTsKICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgaWYgKHMubWF0Y2hfYXZhaWxhYmxlKSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0IC0gMV0pOwogICAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICBzLmxvb2thaGVhZC0tOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMTsKICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICBzLmxvb2thaGVhZC0tOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5tYXRjaF9hdmFpbGFibGUpIHsKICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0IC0gMV0pOwogICAgICAgICAgcy5tYXRjaF9hdmFpbGFibGUgPSAwOwogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IHMuc3Ryc3RhcnQgPCBNSU5fTUFUQ0ggLSAxID8gcy5zdHJzdGFydCA6IE1JTl9NQVRDSCAtIDE7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9ybGUocywgZmx1c2gpIHsKICAgICAgICB2YXIgYmZsdXNoOwogICAgICAgIHZhciBwcmV2OwogICAgICAgIHZhciBzY2FuLCBzdHJlbmQ7CiAgICAgICAgdmFyIF93aW4gPSBzLndpbmRvdzsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8PSBNQVhfTUFUQ0gpIHsKICAgICAgICAgICAgZmlsbF93aW5kb3cocyk7CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8PSBNQVhfTUFUQ0ggJiYgZmx1c2ggPT09IFpfTk9fRkxVU0gpIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIICYmIHMuc3Ryc3RhcnQgPiAwKSB7CiAgICAgICAgICAgIHNjYW4gPSBzLnN0cnN0YXJ0IC0gMTsKICAgICAgICAgICAgcHJldiA9IF93aW5bc2Nhbl07CiAgICAgICAgICAgIGlmIChwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSkgewogICAgICAgICAgICAgIHN0cmVuZCA9IHMuc3Ryc3RhcnQgKyBNQVhfTUFUQ0g7CiAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgIH0gd2hpbGUgKHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgc2NhbiA8IHN0cmVuZCk7CiAgICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBNQVhfTUFUQ0ggLSAoc3RyZW5kIC0gc2Nhbik7CiAgICAgICAgICAgICAgaWYgKHMubWF0Y2hfbGVuZ3RoID4gcy5sb29rYWhlYWQpIHsKICAgICAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gcy5sb29rYWhlYWQ7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAocy5tYXRjaF9sZW5ndGggPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAxLCBzLm1hdGNoX2xlbmd0aCAtIE1JTl9NQVRDSCk7CiAgICAgICAgICAgIHMubG9va2FoZWFkIC09IHMubWF0Y2hfbGVuZ3RoOwogICAgICAgICAgICBzLnN0cnN0YXJ0ICs9IHMubWF0Y2hfbGVuZ3RoOwogICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBiZmx1c2ggPSB0cmVlcy5fdHJfdGFsbHkocywgMCwgcy53aW5kb3dbcy5zdHJzdGFydF0pOwogICAgICAgICAgICBzLmxvb2thaGVhZC0tOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgIGlmIChmbHVzaCA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgdHJ1ZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX1NUQVJURUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX0RPTkU7CiAgICAgICAgfQogICAgICAgIGlmIChzLmxhc3RfbGl0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBCU19CTE9DS19ET05FOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVfaHVmZihzLCBmbHVzaCkgewogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDApIHsKICAgICAgICAgICAgZmlsbF93aW5kb3cocyk7CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICBzLmxvb2thaGVhZC0tOwogICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgaWYgKGJmbHVzaCkgewogICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5sYXN0X2xpdCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gQlNfQkxPQ0tfRE9ORTsKICAgICAgfQogICAgICBmdW5jdGlvbiBDb25maWcoZ29vZF9sZW5ndGgsIG1heF9sYXp5LCBuaWNlX2xlbmd0aCwgbWF4X2NoYWluLCBmdW5jKSB7CiAgICAgICAgdGhpcy5nb29kX2xlbmd0aCA9IGdvb2Rf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tYXRjaCA9IGNvbmZpZ3VyYXRpb25fdGFibGVbcy5sZXZlbF0ubWF4X2xhenk7CiAgICAgICAgcy5nb29kX21hdGNoID0gY29uZmlndXJhdGlvbl90YWJsZVtzLmxldmVsXS5nb29kX2xlbmd0aDsKICAgICAgICBzLm5pY2VfbWF0Y2ggPSBjb25maWd1cmF0aW9uX3RhYmxlW3MubGV2ZWxdLm5pY2VfbGVuZ3RoOwogICAgICAgIHMubWF4X2NoYWluX2xlbmd0aCA9IGNvbmZpZ3VyYXRpb25fdGFibGVbcy5sZXZlbF0ubWF4X2NoYWluOwogICAgICAgIHMuc3Ryc3RhcnQgPSAwOwogICAgICAgIHMuYmxvY2tfc3RhcnQgPSAwOwogICAgICAgIHMubG9va2FoZWFkID0gMDsKICAgICAgICBzLmluc2VydCA9IDA7CiAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBzLnByZXZfbGVuZ3RoID0gTUlOX01BVENIIC0gMTsKICAgICAgICBzLm1hdGNoX2F2YWlsYWJsZSA9IDA7CiAgICAgICAgcy5pbnNfaCA9IDA7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gRGVmbGF0ZVN0YXRlKCkgewogICAgICAgIHRoaXMuc3RybSA9IG51bGw7CiAgICAgICAgdGhpcy5zdGF0dXMgPSAwOwogICAgICAgIHRoaXMucGVuZGluZ19idWYgPSBudWxsOwogICAgICAgIHRoaXMucGVuZGluZ19idWZfc2l6ZSA9IDA7CiAgICAgICAgdGhpcy5wZW5kaW5nX291dCA9IDA7CiAgICAgICAgdGhpcy5wZW5kaW5nID0gMDsKICAgICAgICB0aGlzLndyYXAgPSAwOwogICAgICAgIHRoaXMuZ3poZWFkID0gbnVsbDsKICAgICAgICB0aGlzLmd6aW5kZXggPSAwOwogICAgICAgIHRoaXMubWV0aG9kID0gWl9ERUZMQVRFRDsKICAgICAgICB0aGlzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICB0aGlzLndfc2l6ZSA9IDA7CiAgICAgICAgdGhpcy53X2JpdHMgPSAwOwogICAgICAgIHRoaXMud19tYXNrID0gMDsKICAgICAgICB0aGlzLndpbmRvdyA9IG51bGw7CiAgICAgICAgdGhpcy53aW5kb3dfc2l6ZSA9IDA7CiAgICAgICAgdGhpcy5wcmV2ID0gbnVsbDsKICAgICAgICB0aGlzLmhlYWQgPSBudWxsOwogICAgICAgIHRoaXMuaW5zX2ggPSAwOwogICAgICAgIHRoaXMuaGFzaF9zaXplID0gMDsKICAgICAgICB0aGlzLmhhc2hfYml0cyA9IDA7CiAgICAgICAgdGhpcy5oYXNoX21hc2sgPSAwOwogICAgICAgIHRoaXMuaGFzaF9zaGlmdCA9IDA7CiAgICAgICAgdGhpcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgdGhpcy5tYXRjaF9sZW5ndGggPSAwOwogICAgICAgIHRoaXMucHJldl9tYXRjaCA9IDA7CiAgICAgICAgdGhpcy5tYXRjaF9hdmFpbGFibGUgPSAwOwogICAgICAgIHRoaXMuc3Ryc3RhcnQgPSAwOwogICAgICAgIHRoaXMubWF0Y2hfc3RhcnQgPSAwOwogICAgICAgIHRoaXMubG9va2FoZWFkID0gMDsKICAgICAgICB0aGlzLnByZXZfbGVuZ3RoID0gMDsKICAgICAgICB0aGlzLm1heF9jaGFpbl9sZW5ndGggPSAwOwogICAgICAgIHRoaXMubWF4X2xhenlfbWF0Y2ggPSAwOwogICAgICAgIHRoaXMubGV2ZWwgPSAwOwogICAgICAgIHRoaXMuc3RyYXRlZ3kgPSAwOwogICAgICAgIHRoaXMuZ29vZF9tYXRjaCA9IDA7CiAgICAgICAgdGhpcy5uaWNlX21hdGNoID0gMDsKICAgICAgICB0aGlzLmR5bl9sdHJlZSA9IG5ldyB1dGlscy5CdWYxNihIRUFQX1NJWkUgKiAyKTsKICAgICAgICB0aGlzLmR5bl9kdHJlZSA9IG5ldyB1dGlscy5CdWYxNigoMiAqIERfQ09ERVMgKyAxKSAqIDIpOwogICAgICAgIHRoaXMuYmxfdHJlZSA9I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cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBzdHJtLnRvdGFsX2luID0gc3RybS50b3RhbF9vdXQgPSAwOwogICAgICAgIHN0cm0uZGF0YV90eXBlID0gWl9VTktOT1dOOwogICAgICAgIHMgPSBzdHJtLnN0YXRlOwogICAgICAgIHMucGVuZGluZyA9IDA7CiAgICAgICAgcy5wZW5kaW5nX291dCA9IDA7CiAgICAgICAgaWYgKHMud3JhcCA8IDApIHsKICAgICAgICAgIHMud3JhcCA9IC1zLndyYXA7CiAgICAgICAgfQogICAgICAgIHMuc3RhdHVzID0gcy53cmFwID8gSU5JVF9TVEFURSA6IEJVU1lfU1RBVEU7CiAgICAgICAgc3RybS5hZGxlciA9IHMud3JhcCA9PT0gMiA/IDAgOiAxOwogICAgICAgIHMubGFzdF9mbHVzaCA9IFpfTk9fRkxVU0g7CiAgICAgICAgdHJlZXMuX3RyX2luaXQocyk7CiAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZVJlc2V0KHN0cm0pIHsKICAgICAgICB2YXIgcmV0ID0gZGVmbGF0ZVJlc2V0S2VlcChzdHJtKTsKICAgICAgICBpZiAocmV0ID09PSBaX09LKSB7CiAgICAgICAgICBsbV9pbml0KHN0cm0uc3RhdGUpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmV0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVTZXRIZWFkZXIoc3RybSwgaGVhZCkgewogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBpZiAoc3RybS5zdGF0ZS53cmFwICE9PSAyKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0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0gczsKICAgICAgICBzLnN0cm0gPSBzdHJtOwogICAgICAgIHMud3JhcCA9IHdyYXA7CiAgICAgICAgcy5nemhlYWQgPSBudWxsOwogICAgICAgIHMud19iaXRzID0gd2luZG93Qml0czsKICAgICAgICBzLndfc2l6ZSA9IDEgPDwgcy53X2JpdHM7CiAgICAgICAgcy53X21hc2sgPSBzLndfc2l6ZSAtIDE7CiAgICAgICAgcy5oYXNoX2JpdHMgPSBtZW1MZXZlbCArIDc7CiAgICAgICAgcy5oYXNoX3NpemUgPSAxIDw8IHMuaGFzaF9iaXRzOwogICAgICAgIHMuaGFzaF9tYXNrID0gcy5oYXNoX3NpemUgLSAxOwogICAgICAgIHMuaGFzaF9zaGlmdCA9IH5+KChzLmhhc2hfYml0cyArIE1JTl9NQVRDSCAtIDEpIC8gTUlOX01BVENIKTsKICAgICAgICBzLndpbmRvdyA9IG5ldyB1dGlscy5CdWY4KHMud19zaXplICogMik7CiAgICAgICAgcy5oZWFkID0gbmV3IHV0aWxzLkJ1ZjE2KHMuaGFzaF9zaXplKTsKICAgICAgICBzLnByZXYgPSBuZXcgdXRpbHMuQnVmMTYocy53X3NpemUpOwogICAgICAgIHMubGl0X2J1ZnNpemUgPSAxIDw8IG1lbUxldmVsICsgNjsKICAgICAgICBzLnBlbmRpbmdfYnVmX3NpemUgPSBzLmxpdF9idWZzaXplICogNDsKICAgICAgICBzLnBlbmRpbmdfYnVmID0gbmV3IHV0aWxzLkJ1Zjgocy5wZW5kaW5nX2J1Zl9zaXplKTsKICAgICAgICBzLmRfYnVmID0gMSAqIHMubGl0X2J1ZnNpemU7CiAgICAgICAgcy5sX2J1ZiA9ICgxICsgMikgKiBzLmxpdF9idWZzaXplOwogICAgICAgIHMubGV2ZWwgPSBsZXZlbDsKICAgICAgICBzLnN0cmF0ZWd5ID0gc3RyYXRlZ3k7CiAgICAgICAgcy5tZXRob2QgPSBtZXRob2Q7CiAgICAgICAgcmV0dXJuIGRlZmxhdGVSZXNldChzdHJtKTsK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ICAgICAgIHB1dF9ieXRlKHMsIDEzOSk7CiAgICAgICAgICAgIHB1dF9ieXRlKHMsIDgpOwogICAgICAgICAgICBpZiAoIXMuZ3poZWFkKSB7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5sZXZlbCA9PT0gOSA/IDIgOiBzLnN0cmF0ZWd5ID49IFpfSFVGRk1BTl9PTkxZIHx8IHMubGV2ZWwgPCAyID8gNCA6IDApOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIE9TX0NPREUpOwogICAgICAgICAgICAgIHMuc3RhdHVzID0gQlVTWV9TVEFURTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAocy5nemhlYWQudGV4dCA/IDEgOiAwKSArIChzLmd6aGVhZC5oY3JjID8gMiA6IDApICsgKCFzLmd6aGVhZC5leHRyYSA/IDAgOiA0KSArICghcy5nemhlYWQubmFtZSA/IDAgOiA4KSArICghcy5nemhlYWQuY29tbWVudCA/IDAgOiAxNikpOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLnRpbWUgJiAyNTUpOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLnRpbWUgPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSA+PiAxNiAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSA+PiAyNCAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5sZXZlbCA9PT0gOSA/IDIgOiBzLnN0cmF0ZWd5ID49IFpfSFVGRk1BTl9PTkxZIHx8IHMubGV2ZWwgPCAyID8gNCA6IDApOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLm9zICYgMjU1KTsKICAgICAgICAgICAgICBpZiAocy5nemhlYWQuZXh0cmEgJiYgcy5nemhlYWQuZXh0cmEubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYS5sZW5ndGggJiAyNTUpOwogICAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQuZXh0cmEubGVuZ3RoID4+IDggJiAyNTUpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYykgewogICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZywgMCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBFWFRSQV9TVEFURTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdmFyIGhlYWRlciA9IFpfREVGTEFURUQgKyAocy53X2JpdHMgLSA4IDw8IDQpIDw8IDg7CiAgICAgICAgICAgIHZhciBsZXZlbF9mbGFncyA9IC0xOwogICAgICAgICAgICBpZiAocy5zdHJhdGVneSA+PSBaX0hVRkZNQU5fT05MWSB8fCBzLmxldmVsIDwgMikgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMDsKICAgICAgICAgICAgfSBlbHNlIGlmIChzLmxldmVsIDwgNikgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMTsKICAgICAgICAgICAgfSBlbHNlIGlmIChzLmxldmVsID09PSA2KSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAyOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMzsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXIgfD0gbGV2ZWxfZmxhZ3MgPDwgNjsKICAgICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgIT09IDApIHsKICAgICAgICAgICAgICBoZWFkZXIgfD0gUFJFU0VUX0RJQ1Q7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaGVhZGVyICs9IDMxIC0gaGVhZGVyICUgMzE7CiAgICAgICAgICAgIHMuc3RhdHVzID0gQlVTWV9TVEFURTsKICAgICAgICAgICAgcHV0U2hvcnRNU0IocywgaGVhZGVyKTsKICAgICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgIT09IDApIHsKICAgICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBzdHJtLmFkbGVyID4+PiAxNik7CiAgICAgICAgICAgICAgcHV0U2hvcnRNU0Iocywgc3RybS5hZGxlciAmIDY1NTM1KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzdHJtLmFkbGVyID0gMTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBFWFRSQV9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLmV4dHJhKSB7CiAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgd2hpbGUgKHMuZ3ppbmRleCA8IChzLmd6aGVhZC5leHRyYS5sZW5ndGggJiA2NTUzNSkpIHsKICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQuZXh0cmFbcy5nemluZGV4XSAmIDI1NSk7CiAgICAgICAgICAgICAgcy5nemluZGV4Kys7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5nemluZGV4ID09PSBzLmd6aGVhZC5leHRyYS5sZW5ndGgpIHsKICAgICAgICAgICAgICBzLmd6aW5kZXggPSAwOwogICAgICAgICAgICAgIHMuc3RhdHVzID0gTkFNRV9TVEFURTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5zdGF0dXMgPSBOQU1FX1NUQVRFOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5zdGF0dXMgPT09IE5BTUVfU1RBVEUpIHsKICAgICAgICAgIGlmIChzLmd6aGVhZC5uYW1lKSB7CiAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMihzdHJtLmFkbGVyLCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmcgLSBiZWcsIGJlZyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICAgIHZhbCA9IDE7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBpZiAocy5nemluZGV4IDwgcy5nemhlYWQubmFtZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHZhbCA9IHMuZ3poZWFkLm5hbWUuY2hhckNvZGVBdChzLmd6aW5kZXgrKykgJiAyNTU7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHZhbCA9IDA7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHZhbCk7CiAgICAgICAgICAgIH0gd2hpbGUgKHZhbCAhPT0gMCk7CiAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMihzdHJtLmFkbGVyLCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmcgLSBiZWcsIGJlZyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHZhbCA9PT0gMCkgewogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBDT01NRU5UX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IENPTU1FTlRfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gQ09NTUVOVF9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLmNvbW1lbnQpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgICAgdmFsID0gMTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPCBzLmd6aGVhZC5jb21tZW50Lmxlbmd0aCkgewogICAgICAgICAgICAgICAgdmFsID0gcy5nemhlYWQuY29tbWVudC5jaGFyQ29kZUF0KHMuZ3ppbmRleCsrKSAmIDI1NTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdmFsID0gMDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgdmFsKTsKICAgICAgICAgICAgfSB3aGlsZSAodmFsICE9PSAwKTsKICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodmFsID09PSAwKSB7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBIQ1JDX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IEhDUkNfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gSENSQ19TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMpIHsKICAgICAgICAgICAgaWYgKHMucGVuZGluZyArIDIgPiBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgKyAyIDw9IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgJiAyNTUpOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IEJVU1lfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnBlbmRpbmcgIT09IDApIHsKICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcy5sYXN0X2ZsdXNoID0gLTE7CiAgICAgICAgICAgIHJldHVybiBaX09LOwogICAgICAgICAgfQogICAgICAgIH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gcmV0dXJuIFpfT0s7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYnN0YXRlID09PSBCU19CTE9DS19ET05FKSB7CiAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9QQVJUSUFMX0ZMVVNIKSB7CiAgICAgICAgICAgICAgdHJlZXMuX3RyX2FsaWduKHMpOwogICAgICAgICAgICB9IGVsc2UgaWYgKGZsdXNoICE9PSBaX0JMT0NLKSB7CiAgICAgICAgICAgICAgdHJlZXMuX3RyX3N0b3JlZF9ibG9jayhzLCAwLCAwLCBmYWxzZSk7CiAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZVTExfRkxVU0gpIHsKICAgICAgICAgICAgICAgIHplcm8ocy5oZWFkKTsKICAgICAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzLnN0cnN0YXJ0ID0gMDsKICAgICAgICAgICAgICAgICAgcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgICAgICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcy5sYXN0X2ZsdXNoID0gLTE7CiAgICAgICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKGZsdXNoICE9PSBaX0ZJTklTSCkgewogICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgfQogICAgICAgIGlmIChzLndyYXAgPD0gMCkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VORDsKICAgICAgICB9CiAgICAgICAgaWYgKHMud3JhcCA9PT0gMikgewogICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyID4+IDggJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciA+PiAxNiAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyID4+IDI0ICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0udG90YWxfaW4gJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiA+PiA4ICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0udG90YWxfaW4gPj4gMTYgJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiA+PiAyNCAmIDI1NSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHB1dFNob3J0TVNCKHMsIHN0cm0uYWRsZXIgPj4+IDE2KTsKICAgICAgICAgIHB1dFNob3J0TVNCKHMsIHN0cm0uYWRsZXIgJiA2NTUzNSk7CiAgICAgICAgfQogICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgaWYgKHMud3JhcCA+IDApIHsKICAgICAgICAgIHMud3JhcCA9IC1zLndyYXA7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzLnBlbmRpbmcgIT09IDAgPyBaX09LIDogWl9TVFJFQU1fRU5EOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVFbmQoc3RybSkgewogICAgICAgIHZhciBzdGF0dXM7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXR1cyA9IHN0cm0uc3RhdGUuc3RhdHVzOwogICAgICAgIGlmIChzdGF0dXMgIT09IElOSVRfU1RBVEUgJiYgc3RhdHVzICE9PSBFWFRSQV9TVEFURSAmJiBzdGF0dXMgIT09IE5BTUVfU1RBVEUgJiYgc3RhdHVzICE9PSBDT01NRU5UX1NUQVRFICYmIHN0YXR1cyAhPT0gSENSQ19TVEFURSAmJiBzdGF0dXMgIT09IEJVU1lfU1RBVEUgJiYgc3RhdHVzICE9PSBGSU5JU0hfU1RBVEUpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBzdHJtLnN0YXRlID0gbnVsbDsKICAgICAgICByZXR1cm4gc3RhdHVzID09PSBCVVNZX1NUQVRFID8gZXJyKHN0cm0sIFpfREFUQV9FUlJPUikgOiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVTZXREaWN0aW9uYXJ5KHN0cm0sIGRpY3Rpb25hcnkpIHsKICAgICAgICB2YXIgZGljdExlbmd0aCA9IGRpY3Rpb25hcnkubGVuZ3RoOwogICAgICAgIHZhciBzOwogICAgICAgIHZhciBzdHIsIG47CiAgICAgICAgdmFyIHdyYXA7CiAgICAgICAgdmFyIGF2YWlsOwogICAgICAgIHZhciBuZXh0OwogICAgICAgIHZhciBpbnB1dDsKICAgICAgICB2YXIgdG1wRGljdDsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgd3JhcCA9IHMud3JhcDsKICAgICAgICBpZiAod3JhcCA9PT0gMiB8fCB3cmFwID09PSAxICYmIHMuc3RhdHVzICE9PSBJTklUX1NUQVRFIHx8IHMubG9va2FoZWFkKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmICh3cmFwID09PSAxKSB7CiAgICAgICAgICBzdHJtLmFkbGVyID0gYWRsZXIzMihzdHJtLmFkbGVyLCBkaWN0aW9uYXJ5LCBkaWN0TGVuZ3RoLCAwKTsKICAgICAgICB9CiAgICAgICAgcy53cmFwID0gMDsKICAgICAgICBpZiAoZGljdExlbmd0aCA+PSBzLndfc2l6ZSkgewogICAgICAgICAgaWYgKHdyYXAgPT09IDApIHsKICAgICAgICAgICAgemVybyhzLmhlYWQpOwogICAgICAgICAgICBzLnN0cnN0YXJ0ID0gMDsKICAgICAgICAgICAgcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIHRtcERpY3QgPSBuZXcgdXRpbHMuQnVmOChzLndfc2l6ZSk7CiAgICAgICAgICB1dGlscy5hcnJheVNldCh0bXBEaWN0LCBkaWN0aW9uYXJ5LCBkaWN0TGVuZ3RoIC0gcy53X3NpemUsIHMud19zaXplLCAwKTsKICAgICAgICAgIGRpY3Rpb25hcnkgPSB0bXBEaWN0OwogICAgICAgICAgZGljdExlbmd0aCA9IHMud19zaXplOwogICAgICAgIH0KICAgICAgICBhdmFpbCA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgbmV4dCA9IHN0cm0ubmV4dF9pbjsKICAgICAgICBpbnB1dCA9IHN0cm0uaW5wdXQ7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IGRpY3RMZW5ndGg7CiAgICAgICAgc3RybS5uZXh0X2luID0gMDsKICAgICAgICBzdHJtLmlucHV0ID0gZGljdGlvbmFyeTsKICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICB3aGlsZSAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICBzdHIgPSBzLnN0cnN0YXJ0OwogICAgICAgICAgbiA9IHMubG9va2FoZWFkIC0gKE1JTl9NQVRDSCAtIDEpOwogICAgICAgICAgZG8gewogICAgICAgICAgICBzLmluc19oID0gKHMuaW5zX2ggPDwgcy5oYXNoX3NoaWZ0IF4gcy53aW5kb3dbc3RyICsgTUlOX01BVENIIC0gMV0pICYgcy5o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gbV9wb3MrKykgewogICAgICAgICAgYyA9IHN0ci5jaGFyQ29kZUF0KG1fcG9zKTsKICAgICAgICAgIGlmICgoYyAmIDY0NTEyKSA9PT0gNTUyOTYgJiYgbV9wb3MgKyAxIDwgc3RyX2xlbikgewogICAgICAgICAgICBjMiA9IHN0ci5jaGFyQ29kZUF0KG1fcG9zICsgMSk7CiAgICAgICAgICAgIGlmICgoYzIgJiA2NDUxMikgPT09IDU2MzIwKSB7CiAgICAgICAgICAgICAgYyA9IDY1NTM2ICsgKGMgLSA1NTI5NiA8PCAxMCkgKyAoYzIgLSA1NjMyMCk7CiAgICAgICAgICAgICAgbV9wb3MrKzsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKGMgPCAxMjgpIHsKICAgICAgICAgICAgYnVmW2krK10gPSBjOwogICAgICAgICAgfSBlbHNlIGlmIChjIDwgMjA0OCkgewogICAgICAgICAgICBidWZbaSsrXSA9IDE5MiB8IGMgPj4+IDY7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTI4IHwgYyAmIDYzOwogICAgICAgICAgfSBlbHNlIGlmIChjIDwgNjU1MzYpIHsKICAgICAgICAgICAgYnVmW2krK10gPSAyMjQgfCBjID4+PiAxMjsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjID4+PiA2ICYgNjM7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTI4IHwgYyAmIDYzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgYnVmW2krK10gPSAyNDAgfCBjID4+PiAxODsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjID4+PiAxMiAmIDYzOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDYgJiA2MzsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBidWY7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGJ1Zj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ICB2YXIgdXRmMTZidWYgPSBuZXcgQXJyYXkobGVuICogMik7CiAgICAgICAgZm9yIChvdXQgPSAwLCBpID0gMDsgaSA8IGxlbjsgKSB7CiAgICAgICAgICBjID0gYnVmW2krK107CiAgICAgICAgICBpZiAoYyA8IDEyOCkgewogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSBjOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGNfbGVuID0gX3V0ZjhsZW5bY107CiAgICAgICAgICBpZiAoY19sZW4gPiA0KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IDY1NTMzOwogICAgICAgICAgICBpICs9IGNfbGVuIC0gMTsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBjICY9IGNfbGVuID09PSAyID8gMzEgOiBjX2xlbiA9PT0gMyA/IDE1IDogNzsKICAgICAgICAgIHdoaWxlIChjX2xlbiA+IDEgJiYgaSA8IGxlbikgewogICAgICAgICAgICBjID0gYyA8PCA2IHwgYnVmW2krK10gJiA2MzsKICAgICAgICAgICAgY19sZW4tLTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChjX2xlbiA+IDEpIHsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNjU1MzM7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGMgPCA2NTUzNikgewogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSBjOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgYyAtPSA2NTUzNjsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNTUyOTYgfCBjID4+IDEwICYgMTAyMzsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNTYzMjAgfCBjICYgMTAyMzsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjJiaW5zdHJpbmcodXRmMTZidWYsIG91dCk7CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLnV0Zjhib3JkZXIgPSBmdW5jdGlvbihidWYsIG1heCkgewogICAgICAgIHZhciBwb3M7CiAgICAgICAgbWF4ID0gbWF4IHx8IGJ1Zi5sZW5ndGg7CiAgICAgICAgaWYgKG1heCA+IGJ1Zi5sZW5ndGgpIHsKICAgICAgICAgIG1heCA9IGJ1Zi5sZW5ndGg7CiAgICAgICAgfQogICAgICAgIHBvcyA9IG1heCAtIDE7CiAgICAgICAgd2hpbGUgKHBvcyA+PSAwICYmIChidWZbcG9zXSAmIDE5MikgPT09IDEyOCkgewogICAgICAgICAgcG9zLS07CiAgICAgICAgfQogICAgICAgIGlmIChwb3MgPCAwKSB7CiAgICAgICAgICByZXR1cm4gbWF4OwogICAgICAgIH0KICAgICAgICBpZiAocG9zID09PSAwKSB7CiAgICAgICAgICByZXR1cm4gbWF4OwogICAgICAgIH0KICAgICAgICByZXR1cm4gcG9zICsgX3V0ZjhsZW5bYnVmW3Bvc11dID4gbWF4ID8gcG9zIDogbWF4OwogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvenN0cmVhbS5qcwogIHZhciByZXF1aXJlX3pzdHJlYW0gPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvenN0cmVhbS5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIGZ1bmN0aW9uIFpTdHJlYW0oKSB7CiAgICAgICAgdGhpcy5pbnB1dCA9IG51bGw7CiAgICAgICAgdGhpcy5uZXh0X2luID0gMDsKICAgICAgICB0aGlzLmF2YWlsX2luID0gMDsKICAgICAgICB0aGlzLn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UkVBTV9FTkQgPSAxOwogICAgICB2YXIgWl9TWU5DX0ZMVVNIMiA9IDI7CiAgICAgIHZhciBaX0RFRkFVTFRfQ09NUFJFU1NJT04gPSAtMTsKICAgICAgdmFyIFpfREVGQVVMVF9TVFJBVEVHWSA9IDA7CiAgICAgIHZhciBaX0RFRkxBVEVEID0gODsKICAgICAgZnVuY3Rpb24gRGVmbGF0ZShvcHRpb25zKSB7CiAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIERlZmxhdGUpKQogICAgICAgICAgcmV0dXJuIG5ldyBEZWZsYXRlKG9wdGlvbnMpOwogICAgICAgIHRoaXMub3B0aW9ucyA9IHV0aWxzLmFzc2lnbih7CiAgICAgICAgICBsZXZlbDogWl9ERUZBVUxUX0NPTVBSRVNTSU9OLAogICAgICAgICAgbWV0aG9kOiBaX0RFRkxBVEVELAogICAgICAgICAgY2h1bmtTaXplOiAxNjM4NCwKICAgICAgICAgIHdpbmRvd0JpdHM6IDE1LAogICAgICAgICAgbWVtTGV2ZWw6IDgsCiAgICAgICAgICBzdHJhdGVneTogWl9ERUZBVUxUX1NUUkFURUdZLAogICAgICAgICAgdG86ICIiCiAgICAgICAgfSwgb3B0aW9ucyB8fCB7fSk7CiAgICAgICAgdmFyIG9wdCA9IHRoaXMub3B0aW9uczsKICAgICAgICBpZiAob3B0LnJhdyAmJiBvcHQud2luZG93Qml0cyA+IDApIHsKICAgICAgICAgIG9wdC53aW5kb3dCaXRzID0gLW9wdC53aW5kb3dCaXRzOwogICAgICAgIH0gZWxzZSBpZiAob3B0Lmd6aXAgJiYgb3B0LndpbmRvd0JpdHMgPiAwICYmIG9wdC53aW5kb3dCaXRzIDwgMTYpIHsKICAgICAgICAgIG9wdC53aW5kb3dCaXRzICs9IDE2OwogICAgICAgIH0KICAgICAgICB0aGlzLmVyciA9IDA7CiAgICAgICAgdGhpcy5tc2cgPSAiIjsKICAgICAgICB0aGlzLmVuZGVkID0gZmFsc2U7CiAgICAgICAgdGhpcy5jaHVua3MgPSBbXTsKICAgICAgICB0aGlzLnN0cm0gPSBuZXcgWlN0cmVhbSgpOwogICAgICAgIHRoaXMuc3RybS5hdmFpbF9vdXQgPSAwOwogICAgICAgIHZhciBzdGF0dXMgPSB6bGliX2RlZmxhdGUuZGVmbGF0ZUluaXQyKHRoaXMuc3RybSwgb3B0LmxldmVsLCBvcHQubWV0aG9kLCBvcHQud2luZG93Qml0cywgb3B0Lm1lbUxldmVsLCBvcHQuc3RyYXRlZ3kpOwogICAgICAgIGlmIChzdGF0dXMgIT09IFpfT0spIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcihtc2dbc3RhdHVzXSk7CiAgICAgICAgfQogICAgICAgIGlmIChvcHQuaGVhZGVyKSB7CiAgICAgICAgICB6bGliX2RlZmxhdGUuZGVmbGF0ZVNldEhlYWRlcih0aGlzLnN0cm0sIG9wdC5oZWFkZXIpOwogICAgICAgIH0KICAgICAgICBpZiAob3B0LmRpY3Rpb25hcnkpIHsKICAgICAgICAgIHZhciBkaWN0OwogICAgICAgICAgaWYgKHR5cGVvZiBvcHQuZGljdGlvbmFyeSA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgZGljdCA9IHN0cmluZ3Muc3RyaW5nMmJ1ZihvcHQuZGljdGlvbmFyeSk7CiAgICAgICAgICB9IGVsc2UgaWYgKHRvU3RyaW5nLmNhbGwob3B0LmRpY3Rpb25hcnkpID09PSAiW29iamVjdCBBcnJheUJ1ZmZlcl0iKSB7CiAgICAgICAgICAgIGRpY3QgPSBuZXcgVWludDhBcnJheShvcHQuZGljdGlvbmFyeSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBkaWN0ID0gb3B0LmRpY3Rpb25hcnk7CiAgICAgICAgICB9CiAgICAgICAgICBzdGF0dXMgPSB6bGliX2RlZmxhdGUuZGVmbGF0ZVNldERpY3Rpb25hcnkodGhpcy5zdHJtLCBkaWN0KTsKICAgICAgICAgIGlmIChzdGF0dXMgIT09IFpfT0spI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gICAgICBzdHJtLm5leHRfb3V0ID0gMDsKICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBjaHVua1NpemU7CiAgICAgICAgICB9CiAgICAgICAgICBzdGF0dXMgPSB6bGliX2RlZmxhdGUuZGVmbGF0ZShzdHJtLCBfbW9kZSk7CiAgICAgICAgICBpZiAoc3RhdHVzICE9PSBaX1NUUkVBTV9FTkQgJiYgc3RhdHVzICE9PSBaX09LKSB7CiAgICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgICAgdGhpcy5lbmRlZCA9IHRydWU7CiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCB8fCBzdHJtLmF2YWlsX2luID09PSAwICYmIChfbW9kZSA9PT0gWl9GSU5JU0ggfHwgX21vZGUgPT09IFpfU1lOQ19GTFVTSDIpKSB7CiAgICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMudG8gPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgICAgdGhpcy5vbkRhdGEoc3RyaW5ncy5idWYyYmluc3RyaW5nKHV0aWxzLnNocmlua0J1ZihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCkpKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICB0aGlzLm9uRGF0YSh1dGlscy5zaHJpbmtCdWYoc3RybS5vdXRwdXQsIHN0cm0ubmV4dF9vdXQpKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKChzdHJtLmF2YWlsX2luID4gMCB8fCBzdHJtLmF2YWlsX291dCA9PT0gMCkgJiYgc3RhdHVzICE9PSBaX1NUUkVBTV9FTkQpOwogICAgICAgIGlmIChfbW9kZSA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlRW5kKHRoaXMuc3RybSk7CiAgICAgICAgICB0aGlzLm9uRW5kKHN0YXR1cyk7CiAgICAgICAgICB0aGlzLmVuZGVkID0gdHJ1ZTsKICAgICAgICAgIHJldHVybiBzdGF0dXMgPT09IFpfT0s7CiAgICAgICAgfQogICAgICAgIGlmIChfbW9kZSA9PT0gWl9TWU5DX0ZMVVNIMikgewogICAgICAgICAgdGhpcy5vbkVuZChaX09LKTsKICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gMDsKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgfTsKICAgICAgRGVmbGF0ZS5wcm90b3R5cGUub25EYXRhID0gZnVuY3Rpb24oY2h1bmspIHsKICAgICAgICB0aGlzLmNodW5rcy5wdXNoKGNodW5rKTsKICAgICAgfTsKICAgICAgRGVmbGF0ZS5wcm90b3R5cGUub25FbmQgPSBmdW5jdGlvbihzdGF0dXMpIHsKICAgICAgICBpZiAoc3RhdHVzID09PSBaX09LKSB7CiAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLnRvID09PSAic3RyaW5nIikgewogICAgICAgICAgICB0aGlzLnJlc3VsdCA9IHRoaXMuY2h1bmtzLmpvaW4oIiIpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdGhpcy5yZXN1bHQgPSB1dGlscy5mbGF0dGVuQ2h1bmtzKHRoaXMuY2h1bmtzKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgdGhpcy5jaHVua3MgPSBbXTsKICAgICAgICB0aGlzLmVyciA9IHN0YXR1czsKICAgICAgICB0aGlzLm1zZyA9IHRoaXMuc3RybS5tc2c7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGUoaW5wdXQsIG9wdGlvbnMpIHsKICAgICAgICB2YXIgZGVmbGF0b3IgPSBuZXcgRGVmbGF0ZShvcHRpb25zKTsKICAgICAgICBkZWZsYXRvci5wdXNoKGlucHV0LCB0cnVlKTsKICAgICAgICBpZ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CQUQgPSAzMDsKICAgICAgdmFyIFRZUEUgPSAxMjsKICAgICAgbW9kdWxlMi5leHBvcnRzID0gZnVuY3Rpb24gaW5mbGF0ZV9mYXN0KHN0cm0sIHN0YXJ0KSB7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIHZhciBfaW47CiAgICAgICAgdmFyIGxhc3Q7CiAgICAgICAgdmFyIF9vdXQ7CiAgICAgICAgdmFyIGJlZzsKICAgICAgICB2YXIgZW5kOwogICAgICAgIHZhciBkbWF4OwogICAgICAgIHZhciB3c2l6ZTsKICAgICAgICB2YXIgd2hhdmU7CiAgICAgICAgdmFyIHduZXh0OwogICAgICAgIHZhciBzX3dpbmRvdzsKICAgICAgICB2YXIgaG9sZDsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgbGNvZGU7CiAgICAgICAgdmFyIGRjb2RlOwogICAgICAgIHZhciBsbWFzazsKICAgICAgICB2YXIgZG1hc2s7CiAgICAgICAgdmFyIGhlcmU7CiAgICAgICAgdmFyIG9wOwogICAgICAgIHZhciBsZW47CiAgICAgICAgdmFyIGRpc3Q7CiAgICAgICAgdmFyIGZyb207CiAgICAgICAgdmFyIGZyb21fc291cmNlOwogICAgICAgIHZhciBpbnB1dCwgb3V0cHV0OwogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBfaW4gPSBzdHJtLm5leHRfaW47CiAgICAgICAgaW5wdXQgPSBzdHJtLmlucHV0OwogICAgICAgIGxhc3QgPSBfaW4gKyAoc3RybS5hdmFpbF9pbiAtIDUpOwogICAgICAgIF9vdXQgPSBzdHJtLm5leHRfb3V0OwogICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgIGJlZyA9IF9vdXQgLSAoc3RhcnQgLSBzdHJtLmF2YWlsX291dCk7CiAgICAgICAgZW5kID0gX291dCArIChzdHJtLmF2YWlsX291dCAtIDI1Nyk7CiAgICAgICAgZG1heCA9IHN0YXRlLmRtYXg7CiAgICAgICAgd3NpemUgPSBzdGF0ZS53c2l6ZTsKICAgICAgICB3aGF2ZSA9IHN0YXRlLndoYXZlOwogICAgICAgIHduZXh0ID0gc3RhdGUud25leHQ7CiAgICAgICAgc193aW5kb3cgPSBzdGF0ZS53aW5kb3c7CiAgICAgICAgaG9sZCA9IHN0YXRlLmhvbGQ7CiAgICAgICAgYml0cyA9IHN0YXRlLmJpdHM7CiAgICAgICAgbGNvZGUgPSBzdGF0ZS5sZW5jb2RlOwogICAgICAgIGRjb2RlID0gc3RhdGUuZGlzdGNvZGU7CiAgICAgICAgbG1hc2sgPSAoMSA8PCBzdGF0ZS5sZW5iaXRzKSAtIDE7CiAgICAgICAgZG1hc2sgPSAoMSA8PCBzdGF0ZS5kaXN0Yml0cykgLSAxOwogICAgICAgIHRvcDoKICAgICAgICAgIGRvIHsKICAgICAgICAgICAgaWYgKGJpdHMgPCAxNSkgewogICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGhlcmUgPSBsY29kZVtob2xkICYgbG1hc2tdOwogICAgICAgICAgICBkb2xlbjoKICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgIG9wID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICBiaXRzIC09IG9wOwogICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgIGlmIChvcCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAob3AgJiAxNikgewogICAgICAgICAgICAgICAgICBsZW4gPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgIG9wICY9IDE1OwogICAgICAgICAgICAgICAgICBpZiAob3ApIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBsZW4gKz0gaG9sZCAmICgxIDw8IG9wKSAtIDE7CiAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IG9wOwogICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gb3A7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGJpdHMgPCAxNSkgewogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBkY29kZVtob2xkICYgZG1hc2tdOwogICAgICAgICAgICAgICAgICBkb2Rpc3Q6CiAgICAgICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgICAgICBvcCA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IG9wOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgIG9wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgICBpZiAob3AgJiAxNikgewogICAgICAgICAgICAgICAgICAgICAgICBkaXN0ID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgICAgICBvcCAmPSAxNTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiaXRzIDwgb3ApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3QgKz0gaG9sZCAmICgxIDw8IG9wKSAtIDE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXN0ID4gZG1heCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgdG9vIGZhciBiYWNrIjsKICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgIG9wID0gX291dCAtIGJlZzsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpc3QgPiBvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIG9wID0gZGlzdCAtIG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA+IHdoYXZlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuc2FuZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBzX3dpbmRvdzsKICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod25leHQgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gKz0gd3NpemUgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gb3V0cHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAod25leHQgPCBvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSArPSB3c2l6ZSArIHduZXh0IC0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcCAtPSB3bmV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHduZXh0IDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3AgPSB3bmV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tICs9IHduZXh0IC0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob3AgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGxlbiA+IDIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSAzOwogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuID4gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gMzsKICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlIChsZW4gPiAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbiA+IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoKG9wICYgNjQpID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGhlcmUgPSBkY29kZVsoaGVyZSAmIDY1NTM1KSArIChob2xkICYgKDEgPDwgb3ApIC0gMSldOwogICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZSBkb2Rpc3Q7CiAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIGNvZGUiOwogICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0b3A7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKChvcCAmIDY0KSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBoZXJlID0gbGNvZGVbKGhlcmUgJiA2NTUzNSkgKyAoaG9sZCAmICgxIDw8IG9wKSAtIDEpXTsKICAgICAgICAgICAgICAgICAgY29udGludWUgZG9sZW47CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG9wICYgMzIpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEU7CiAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgbGl0ZXJhbC9sZW5ndGggY29kZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgIH0gd2hpbGUgKF9pbiA8IGxhc3QgJiYgX291dCA8IGVuZCk7CiAgICAgICAgbGVuID0gYml0cyA+PiAzOwogICAgICAgIF9pbiAtPSBsZW47CiAgICAgICAgYml0cyAtPSBsZW4gPDwgMzsKICAgICAgICBob2xkICY9ICgxIDw8IGJpdHMpIC0gMTsKICAgICAgICBzdHJtLm5leHRfaW4gPSBfaW47CiAgICAgICAgc3RybS5uZXh0X291dCA9IF9vdXQ7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IF9pbiA8IGxhc3QgPyA1ICsgKGxhc3QgLSBfaW4pIDogNSAtIChfaW4gLSBsYXN0KTsKICAgICAgICBzdHJtLmF2YWlsX291dCA9IF9vdXQgPCBlbmQgPyAyNTcgKyAoZW5kIC0gX291dCkgOiAyNTcgLSAoX291dCAtIGVuZCk7CiAgICAgICAgc3RhdGUuaG9sZCA9IGhvbGQ7CiAgICAgICAgc3RhdGUuYml0cyA9IGJpdHM7CiAgICAgICAgcmV0dXJuOwogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvaW5mdHJlZXMuanMKICB2YXIgcmVxdWlyZV9pbmZ0cmVlcyA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9pbmZ0cmVlcy5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIHZhciB1dGlscyA9IHJlcXVpcmVfY29tbW9uKCk7CiAgICAgIHZhciBNQVhCSVRTID0gMTU7CiAgICAgIHZhciBFTk9VR0hfTEVOUyA9IDg1MjsKICAgICAgdmFyIEVOT1VHSF9ESVNUUyA9IDU5MjsKICAgICAgdmFyIENPREVTID0gMDsKICAgICAgdmFyIExFTlMgPSAxOwogICAgICB2YXIgRElTVFMgPSAyOwogICAgICB2YXIgbGJhc2UgPSBbCiAgICAgICAgMywKICAgICAgICA0LAogICAgICAgIDUsCiAgICAgICAgNiwKICAgICAgICA3LAogICAgICAgIDgsCiAgICAgICAgOSwKICAgICAgICAxMCwKICAgICAgICAxMSwKICAgICAgICAxMywKICAgICAgICAxNSwKICAgICAgICAxNywKICAgICAgICAxOSwKICAgICAgICAyMywKICAgICAgICAyNywKICAgICAgICAzMSwKICAgICAgICAzNSwKICAgICAgICA0MywKICAgICAgICA1MSwKICAgICAgICA1OSwKICAgICAgICA2NywKICAgICAgICA4MywKICAgICAgICA5OSwKICAgICAgICAxMTUsCiAgICAgICAgMTMxLAogICAgICAgIDE2MywKICAgICAgICAxOTUsCiAgICAgICAgMjI3LAogICAgICAgIDI1OCwKICAgICAgICAwLAogICAgICAgIDAKICAgICAgXTsKICAgICAgdmFyIGxleHQgPSBbCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMTYsCiAgICAgICAgNzIsCiAgICAgICAgNzgKICAgICAgXTsKICAgICAgdmFyIGRiYXNlID0gWwogICAgICAgIDEsCiAgICAgICAgMiwKICAgICAgICAzLAogICAgICAgIDQsCiAgICAgICAgNSwKICAgICAgICA3LAogICAgICAgIDksCiAgICAgICAgMTMsCiAgICAgICAgMTcsCiAgICAgICAgMjUsCiAgICAgICAgMzMsCiAgICAgICAgNDksCiAgICAgICAgNjUsCiAgICAgICAgOTcsCiAgICAgICAgMTI5LAogICAgICAgIDE5MywKICAgICAgICAyNTcsCiAgICAgICAgMzg1LAogICAgICAgIDUxMywKICAgICAgICA3NjksCiAgICAgICAgMTAyNSwKICAgICAgICAxNTM3LAogICAgICAgIDIwNDksCiAgICAgICAgMzA3MywKICAgICAgICA0MDk3LAogICAgICAgIDYxNDUsCiAgICAgICAgODE5MywKICAgICAgICAxMjI4OSwKICAgICAgICAxNjM4NSwKICAgICAgICAyNDU3NywKICAgICAgICAwLAogICAgICAgIDAKICAgICAgXTsKICAgICAgdmFyIGRleHQgPSBbCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjIsCiAgICAgICAgMjIsCiAgICAgICAgMjMsCiAgICAgICAgMjMsCiAgICAgICAgMjQsCiAgICAgICAgMjQsCiAgICAgICAgMjUsCiAgICAgICAgMjUsCiAgICAgICAgMjYsCiAgICAgICAgMjYsCiAgICAgICAgMjcsCiAgICAgICAgMjcsCiAgICAgICAgMjgsCiAgICAgICAgMjgsCiAgICAgICAgMjksCiAgICAgICAgMjksCiAgICAgICAgNjQsCiAgICAgICAgNjQKICAgICAgXTsKICAgICAgbW9kdWxlMi5leHBvcnRzID0gZnVuY3Rpb24gaW5mbGF0ZV90YWJsZSh0eXBlLCBsZW5zLCBsZW5zX2luZGV4LCBjb2RlcywgdGFibGUsIHRhYmxlX2luZGV4LCB3b3JrLCBvcHRzKSB7CiAgICAgICAgdmFyIGJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgdmFyIGxlbiA9IDA7CiAgICAgICAgdmFyIHN5bSA9IDA7CiAgICAgICAgdmFyIG1pbiA9IDAsIG1heCA9IDA7CiAgICAgICAgdmFyIHJvb3QyID0gMDsKICAgICAgICB2YXIgY3VyciA9IDA7CiAgICAgICAgdmFyIGRyb3AgPSAwOwogICAgICAgIHZhciBsZWZ0ID0gMDsKICAgICAgICB2YXIgdXNlZCA9IDA7CiAgICAgICAgdmFyIGh1ZmYgPSAwOwogICAgICAgIHZhciBpbmNyOwogICAgICAgIHZhciBmaWxsOwogICAgICAgIHZhciBsb3c7CiAgICAgICAgdmFyIG1hc2s7CiAgICAgICAgdmFyIG5leHQ7CiAgICAgICAgdmFyIGJhc2UgPSBudWxsOwogICAgICAgIHZhciBiYXNlX2luZGV4ID0gMDsKICAgICAgICB2YXIgZW5kOwogICAgICAgIHZhciBjb3VudCA9IG5ldyB1dGlscy5CdWYxNihNQVhCSVRTICsgMSk7CiAgICAgICAgdmFyIG9mZnMgPSBuZXcgdXRpbHMuQnVmMTYoTUFYQklUUyArIDEpOwogICAgICAgIHZhciBleHRyYSA9IG51bGw7CiAgICAgICAgdmFyIGV4dHJhX2luZGV4ID0gMDsKICAgICAgICB2YXIgaGVyZV9iaXRzLCBoZXJlX29wLCBoZXJlX3ZhbDsKICAgICAgICBmb3IgKGxlbiA9IDA7IGxlbiA8PSBNQVhCSVRTOyBsZW4rKykgewogICAgICAgICAgY291bnRbbGVuXSA9IDA7CiAgICAgICAgfQogICAgICAgIGZvciAoc3ltID0gMDsgc3ltIDwgY29kZXM7IHN5bSsrKSB7CiAgICAgICAgICBjb3VudFtsZW5zW2xlbnNfaW5kZXggKyBzeW1dXSsrOwogICAgICAgIH0KICAgICAgICByb290MiA9IGJpdHM7CiAgICAgICAgZm9yIChtYXggPSBNQVhCSVRTOyBtYXggPj0gMTsgbWF4LS0pIHsKICAgICAgICAgIGlmIChjb3VudFttYXhdICE9PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocm9vdDIgPiBtYXgpIHsKICAgICAgICAgIHJvb3QyID0gbWF4OwogICAgICAgIH0KICAgICAgICBpZiAobWF4ID09PSAwKSB7CiAgICAgICAgICB0YWJsZVt0YWJsZV9pbmRleCsrXSA9IDEgPDwgMjQgfCA2NCA8PCAxNiB8IDA7CiAgICAgICAgICB0YWJsZVt0YWJsZV9pbmRleCsrXSA9IDEgPDwgMjQgfCA2NCA8PCAxNiB8IDA7CiAgICAgICAgICBvcHRzLmJpdHMgPSAxOwogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgICAgIGZvciAobWluID0gMTsgbWluIDwgbWF4OyBtaW4rKykgewogICAgICAgICAgaWYgKGNvdW50W21pbl0gIT09IDApIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChyb290MiA8IG1pbikgewogICAgICAgICAgcm9vdDIgPSBtaW47CiAgICAgICAgfQogICAgICAgIGxlZnQgPSAxOwogICAgICAgIGZvciAobGVuID0gMTsgbGVuIDw9IE1BWEJJVFM7IGxlbisrKSB7CiAgICAgICAgICBsZWZ0IDw8PSAxOwogICAgICAgICAgbGVmdCAtPSBjb3VudFtsZW5dOwogICAgICAgICAgaWYgKGxlZnQgPCAwKSB7CiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKGxlZnQgPiAwICYmICh0eXBlID09PSBDT0RFUyB8fCBtYXggIT09IDEpKSB7CiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIG9mZnNbMV0gPSAwOwogICAgICAgIGZvciAobGVuID0gMTsgbGVuIDwgTUFYQklUUzsgbGVuKyspIHsKICAgICAgICAgIG9mZnNbbGVuICsgMV0gPSBvZmZzW2xlbl0gKyBjb3VudFtsZW5dOwogICAgICAgIH0KICAgICAgICBmb3IgKHN5bSA9IDA7IHN5bSA8IGNvZGVzOyBzeW0rKykgewogICAgICAgICAgaWYgKGxlbnNbbGVuc19pbmRleCArIHN5bV0gIT09IDApIHsKICAgICAgICAgICAgd29ya1tvZmZzW2xlbnNbbGVuc19pbmRleCArIHN5bV1dKytdID0gc3ltOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAodHlwZSA9PT0gQ09ERVMpIHsKICAgICAgICAgIGJhc2UgPSBleHRyYSA9IHdvcms7CiAgICAgICAgICBlbmQgPSAxOTsKICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09IExFTlMpIHsKICAgICAgICAgIGJhc2UgPSBsYmFzZTsKICAgICAgICAgIGJhc2VfaW5kZXggLT0gMjU3OwogICAgICAgICAgZXh0cmEgPSBsZXh0OwogICAgICAgICAgZXh0cmFfaW5kZXggLT0gMjU3OwogICAgICAgICAgZW5kID0gMjU2OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBiYXNlID0gZGJhc2U7CiAgICAgICAgICBleHRyYSA9IGRleHQ7CiAgICAgICAgICBlbmQgPSAtMTsKICAgICAgICB9CiAgICAgICAgaHVmZiA9IDA7CiAgICAgICAgc3ltID0gMDsKICAgICAgICBsZW4gPSBtaW47CiAgICAgICAgbmV4dCA9IHRhYmxlX2luZGV4OwogICAgICAgIGN1cnIgPSByb290MjsKICAgICAgICBkcm9wID0gMDsKICAgICAgICBsb3cgPSAtMTsKICAgICAgICB1c2VkID0gMSA8PCByb290MjsKICAgICAgICBtYXNrID0gdXNlZCAtIDE7CiAgICAgICAgaWYgKHR5cGUgPT09IExFTlMgJiYgdXNlZCA+IEVOT1VHSF9MRU5TIHx8IHR5cGUgPT09IERJU1RTICYmIHVzZWQgPiBFTk9VR0hfRElTVFMpIHsKICAgICAgICAgIHJldHVybiAxOwogICAgICAgIH0KICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGhlcmVfYml0cyA9IGxlbiAtIGRyb3A7CiAgICAgICAgICBpZiAod29ya1tzeW1dIDwgZW5kKSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSAwOwogICAgICAgICAgICBoZXJlX3ZhbCA9IHdvcmtbc3ltXTsKICAgICAgICAgIH0gZWxzZSBpZiAod29ya1tzeW1dID4gZW5kKSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSBleHRyYVtleHRyYV9pbmRleCArIHdvcmtbc3ltXV07CiAgICAgICAgICAgIGhlcmVfdmFsID0gYmFzZVtiYXNlX2luZGV4ICsgd29ya1tzeW1dXTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSAzMiArIDY0OwogICAgICAgICAgICBoZXJlX3ZhbCA9IDA7CiAgICAgICAgICB9CiAgICAgICAgICBpbmNyID0gMSA8PCBsZW4gLSBkcm9wOwogICAgICAgICAgZmlsbCA9IDEgPDwgY3VycjsKICAgICAgICAgIG1pbiA9IGZpbGw7CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIGZpbGwgLT0gaW5jcjsKICAgICAgICAgICAgdGFibGVbbmV4dCArIChodWZmID4+IGRyb3ApICsgZmlsbF0gPSBoZXJlX2JpdHMgPDwgMjQgfCBoZXJlX29wIDw8IDE2IHwgaGVyZV92YWwgfCAwOwogICAgICAgICAgfSB3aGlsZSAoZmlsbCAhPT0gMCk7CiAgICAgICAgICBpbmNyID0gMSA8PCBsZW4gLSAxOwogICAgICAgICAgd2hpbGUgKGh1ZmYgJiBpbmNyKSB7CiAgICAgICAgICAgIGluY3IgPj49IDE7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoaW5jciAhPT0gMCkgewogICAgICAgICAgICBodWZmICY9IGluY3IgLSAxOwogICAgICAgICAgICBodWZmICs9IGluY3I7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBodWZmID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIHN5bSsrOwogICAgICAgICAgaWYgKC0tY291bnRbbGVuXSA9PT0gMCkgewogICAgICAgICAgICBpZiAobGVuID09PSBtYXgpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZW4gPSBsZW5zW2xlbnNfaW5kZXggKyB3b3JrW3N5bV1dOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGxlbiA+IHJvb3QyICYmIChodWZmICYgbWFzaykgIT09IGxvdykgewogICAgICAgICAgICBpZiAoZHJvcCA9PT0gMCkgewogICAgICAgICAgICAgIGRyb3AgPSByb290MjsKICAgICAgICAgICAgfQogICAgICAgICAgICBuZXh0ICs9IG1pbjsKICAgICAgICAgICAgY3VyciA9IGxlbiAtIGRyb3A7CiAgICAgICAgICAgIGxlZnQgPSAxIDw8IGN1cnI7CiAgICAgICAgICAgIHdoaWxlIChjdXJyICsgZHJvcCA8IG1heCkgewogICAgICAgICAgICAgIGxlZnQgLT0gY291bnRbY3VyciArIGRyb3BdOwogICAgICAgICAgICAgIGlmIChsZWZ0IDw9IDApIHsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBjdXJyKys7CiAgICAgICAgICAgICAgbGVmdCA8PD0gMTsKICAgICAgICAgICAgfQogICAgICAgICAgICB1c2VkICs9IDEgPDwgY3VycjsKICAgICAgICAgICAgaWYgKHR5cGUgPT09IExFTlMgJiYgdXNlZCA+IEVOT1VHSF9MRU5TIHx8IHR5cGUgPT09IERJU1RTICYmIHVzZWQgPiBFTk9VR0hfRElTVFMpIHsKICAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBsb3cgPSBodWZmICYgbWFzazsKICAgICAgICAgICAgdGFibGVbbG93XSA9IHJvb3QyIDw8IDI0IHwgY3VyciA8PCAxNiB8IG5leHQgLSB0YWJsZV9pbmRleCB8IDA7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChodWZmICE9PSAwKSB7CiAgICAgICAgICB0YWJsZVtuZXh0ICsgaHVmZl0gPSBsZW4gLSBkcm9wIDw8IDI0IHwgNjQgPDwgMTYgfCAwOwogICAgICAgIH0KICAgICAgICBvcHRzLmJpdHMgPSByb290MjsKICAgICAgICByZXR1cm4gMDsKICAgICAgfTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2luZmxhdGUuanMKICB2YXIgcmVxdWlyZV9pbmZsYXRlID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2luZmxhdGUuanMiKGV4cG9ydHMyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICB2YXIgdXRpbHMgPSByZXF1aXJlX2NvbW1vbigpOwogICAgICB2YXIgYWRsZXIzMiA9IHJlcXVpcmVfYWRsZXIzMigpOwogICAgICB2YXIgY3JjMzIgPSByZXF1aXJlX2NyYzMyKCk7CiAgICAgIHZhciBpbmZsYXRlX2Zhc3QgPSByZXF1aXJlX2luZmZhc3QoKTsKICAgICAgdmFyIGluZmxhdGVfdGFibGUgPSByZXF1aXJlX2luZnRyZWVzKCk7CiAgICAgIHZhciBDT0RFUyA9IDA7CiAgICAgIHZhciBMRU5TID0gMTsKICAgICAgdmFyIERJU1RTID0gMjsKICAgICAgdmFyIFpfRklOSVNIID0gNDsKICAgICAgdmFyIFpfQkxPQ0sgPSA1OwogICAgICB2YXIgWl9UUkVFUyA9IDY7CiAgICAgIHZhciBaX09LID0gMDsKICAgICAgdmFyIFpfU1RSRUFNX0VORCA9IDE7CiAgICAgIHZhciBaX05FRURfRElDVCA9IDI7CiAgICAgIHZhciBaX1NUUkVBTV9FUlJPUiA9IC0yOwogICAgICB2YXIgWl9EQVRBX0VSUk9SID0gLTM7CiAgICAgIHZhciBaX01FTV9FUlJPUiA9IC00OwogICAgICB2YXIgWl9CVUZfRVJST1IgPSAtNTsKICAgICAgdmFyIFpfREVGTEFURUQgPSA4OwogICAgICB2YXIgSEVBRCA9IDE7CiAgICAgIHZhciBGTEFHUyA9IDI7CiAgICAgIHZhciBUSU1FID0gMzsKICAgICAgdmFyIE9TID0gNDsKICAgICAgdmFyIEVYTEVOID0gNTsKICAgICAgdmFyIEVYVFJBID0gNjsKICAgICAgdmFyIE5BTUUgPSA3OwogICAgICB2YXIgQ09NTUVOVCA9IDg7CiAgICAgIHZhciBIQ1JDID0gOTsKICAgICAgdmFyIERJQ1RJRCA9IDEwOwogICAgICB2YXIgRElDVCA9IDExOwogICAgICB2YXIgVFlQRSA9IDEyOwogICAgICB2YXIgVFlQRURPID0gMTM7CiAgICAgIHZhciBTVE9SRUQgPSAxNDsKICAgICAgdmFyIENPUFlfID0gMTU7CiAgICAgIHZhciBDT1BZID0gMTY7CiAgICAgIHZhciBUQUJMRSA9IDE3OwogICAgICB2YXIgTEVOTEVOUyA9IDE4OwogICAgICB2YXIgQ09ERUxFTlMgPSAxOTsKICAgICAgdmFyIExFTl8gPSAyMDsKICAgICAgdmFyIExFTiA9IDIxOwogICAgICB2YXIgTEVORVhUID0gMjI7CiAgICAgIHZhciBESVNUID0gMjM7CiAgICAgIHZhciBESVNURVhUID0gMjQ7CiAgICAgIHZhciBNQVRDSCA9IDI1OwogICAgICB2YXIgTElUID0gMjY7CiAgICAgIHZhciBDSEVDSyA9IDI3OwogICAgICB2YXIgTEVOR1RIID0gMjg7CiAgICAgIHZhciBET05FID0gMjk7CiAgICAgIHZhciBCQUQgPSAzMDsKICAgICAgdmFyIE1FTSA9IDMxOwogICAgICB2YXIgU1lOQyA9IDMyOwogICAgICB2YXIgRU5PVUdIX0xFTlMgPSA4NTI7CiAgICAgIHZhciBFTk9VR0hfRElTVFMgPSA1OTI7CiAgICAgIHZhciBNQVhfV0JJVFMgPSAxNTsKICAgICAgdmFyIERFRl9XQklUUyA9IE1BWF9XQklUUzsKICAgICAgZnVuY3Rpb24genN3YXAzMihxKSB7CiAgICAgICAgcmV0dXJuIChxID4+PiAyNCAmIDI1NSkgKyAocSA+Pj4gOCAmIDY1MjgwKSArICgocSAmIDY1MjgwKSA8PCA4KSArICgocSAmIDI1NSkgPDwgMjQpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIEluZmxhdGVTdGF0ZSgpIHsKICAgICAgICB0aGlzLm1vZGUgPSAwOwogICAgICAgIHRoaXMubGFzdCA9IGZhbHNlOwogICAgICAgIHRoaXMud3JhcCA9IDA7CiAgICAgICAgdGhpcy5oYXZlZGljdCA9IGZhbHNlOwogICAgICAgIHRoaXMuZmxhZ3MgPSAwOwogICAgICAgIHRoaXMuZG1heCA9IDA7CiAgICAgICAgdGhpcy5jaGVjayA9IDA7CiAgICAgICAgdGhpcy50b3RhbCA9IDA7CiAgICAgICAgdGhpcy5oZWFkID0gbnVsbDsKICAgICAgICB0aGlzLndiaXRzID0gMDsKICAgICAgICB0aGlzLndzaXplID0gMDsKICAgICAgICB0aGlzLndoYXZlID0gMDsKICAgICAgICB0aGlzLnduZXh0ID0gMDsKICAgICAgICB0aGlzLndpbmRvdyA9IG51bGw7CiAgICAgICAgdGhpcy5ob2xkID0gMDsKICAgICAgICB0aGlzLmJpdHMgPSAwOwogICAgICAgIHRoaXMubGVuZ3RoID0gMDsKICAgICAgICB0aGlzLm9mZnNldCA9IDA7CiAgICAgICAgdGhpcy5leHRyYSA9IDA7CiAgICAgICAgdGhpcy5sZW5jb2RlID0gbnVsbDsKICAgICAgICB0aGlzLmRpc3Rjb2RlID0gbnVsbDsKICAgICAgICB0aGlzLmxlbmJpdHMgPSAwOwogICAgICAgIHRoaXMuZGlzdGJpdHMgPSAwOwogICAgICAgIHRoaXMubmNvZGUgPSAwOwogICAgICAgIHRoaXMubmxlbiA9IDA7CiAgICAgICAgdGhpcy5uZGlzdCA9IDA7CiAgICAgICAgdGhpcy5oYXZlID0gMDsKICAgICAgICB0aGlzLm5leHQgPSBudWxsOwogICAgICAgIHRoaXMubGVucyA9IG5ldyB1dGlscy5CdWYxNigzMjApOwogICAgICAgIHRoaXMud29yayA9IG5ldyB1dGlscy5CdWYxNigyODgpOwogICAgICAgIHRoaXMubGVuZHluID0gbnVsbDsKICAgICAgICB0aGlzLmRpc3RkeW4gPSBudWxsOwogICAgICAgIHRoaXMuc2FuZSA9IDA7CiAgICAgICAgdGhpcy5iYWNrID0gMDsKICAgICAgICB0aGlzLndhcyA9IDA7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZVJlc2V0S2VlcChzdHJtKSB7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgIC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W5mbGF0ZVJlc2V0S2VlcChzdHJtKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlUmVzZXQyKHN0cm0sIHdpbmRvd0JpdHMpIHsKICAgICAgICB2YXIgd3JhcDsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBpZiAod2luZG93Qml0cyA8IDApIHsKICAgICAgICAgIHdyYXAgPSAwOwogICAgICAgICAgd2luZG93Qml0cyA9IC13aW5kb3dCaXRzOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB3cmFwID0gKHdpbmRvd0JpdHMgPj4gNCkgKyAxOwogICAgICAgICAgaWYgKHdpbmRvd0JpdHMgPCA0OCkgewogICAgICAgICAgICB3aW5kb3dCaXRzICY9IDE1OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAod2luZG93Qml0cyAmJiAod2luZG93Qml0cyA8IDggfHwgd2luZG93Qml0cyA+IDE1KSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhdGUud2luZG93ICE9PSBudWxsICYmIHN0YXRlLndiaXRzICE9PSB3aW5kb3dCaXRzKSB7CiAgICAgICAgICBzdGF0ZS53aW5kb3cgPSBudWxsOwogICAgICAgIH0KICAgICAgICBzdGF0ZS53cmFwID0gd3JhcDsKICAgICAgICBzdGF0ZS53Yml0cyA9IHdpbmRvd0JpdHM7CiAgICAgICAgcmV0dXJuIGluZmxhdGVSZXNldChzdHJtKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlSW5pdDIoc3RybSwgd2luZG93Qml0cykgewogICAgICAgIHZhciByZXQ7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIGlmICghc3RybSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZSA9IG5ldyBJbmZsYXRlU3RhdGUoKTsKICAgICAgICBzdHJtLnN0YXRlID0gc3RhdGU7CiAgICAgICAgc3RhdGUud2luZG93ID0gbnVsbDsKICAgICAgICByZXQgPSBpbmZsYXRlUmVzZXQyKHN0cm0sIHdpbmRvd0JpdHMpOwogICAgICAgIGlmIChyZXQgIT09IFpfT0spIHsKICAgICAgICAgIHN0cm0uc3RhdGUgPSBudWxsOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmV0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVJbml0KHN0cm0pIHsKICAgICAgICByZXR1cm4gaW5mbGF0ZUluaXQyKHN0cm0sIERFRl9XQklUUyk7CiAgICAgIH0KICAgICAgdmFyIHZpcmdpbiA9IHRydWU7CiAgICAgIHZhciBsZW5maXg7CiAgICAgIHZhciBkaXN0Zml4OwogICAgICBmdW5jdGlvbiBmaXhlZHRhYmxlcyhzdGF0ZSkgewogICAgICAgIGlmICh2aXJnaW4pIHsKICAgICAgICAgIHZhciBzeW07CiAgICAgICAgICBsZW5maXggPSBuZXcgdXRpbHMuQnVmMzIoNTEyKTsKICAgICAgICAgIGRpc3RmaXggPSBuZXcgdXRpbHMuQnVmMzIoMzIpOwogICAgICAgICAgc3ltID0gMDsKICAgICAgICAgIHdoaWxlIChzeW0gPCAxNDQpIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA4OwogICAgICAgICAgfQogICAgICAgICAgd2hpbGUgKHN5bSA8IDI1NikgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDk7CiAgICAgICAgICB9CiAgICAgICAgICB3aGlsZSAoc3ltIDwgMjgwKSB7CiAgICAgICAgICAgIHN0YXRlLmxlbnNbc3ltKytdID0gNzsKICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzeW0gPCAyODgpIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA4OwogICAgICAgICAgfQogICAgICAgICAgaW5mbGF0ZV90YWJsZShMRU5TLCBzdGF0ZS5sZW5zLCAwLCAyODgsIGxlbmZpeCwgMCwgc3RhdGUud29yaywgeyBiaXRzOiA5IH0pOwogICAgICAgICAgc3ltID0gMDsKICAgICAgICAgIHdoaWxlIChzeW0gPCAzMikgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDU7CiAgICAgICAgICB9CiAgICAgICAgICBpbmZsYXRlX3RhYmxlKERJU1RTLCBzdGF0ZS5sZW5zLCAwLCAzMiwgZGlzdGZpeCwgMCwgc3RhdGUud29yaywgeyBiaXRzOiA1IH0pOwogICAgICAgICAgdmlyZ2luID0gZmFsc2U7CiAgICAgICAgfQogICAgICAgIHN0YXRlLmxlbmNvZGUgPSBsZW5maXg7CiAgICAgICAgc3RhdGUubGVuYml0cyA9IDk7CiAgICAgICAgc3RhdGUuZGlzdGNvZGUgPSBkaXN0Zml4OwogICAgICAgIHN0YXRlLmRpc3RiaXRzID0gNTsKICAgICAgfQogICAgICBmdW5jdGlvbiB1cGRhdGV3aW5kb3coc3RybSwgc3JjLCBlbmQsIGNvcHkpIHsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS53aW5kb3cgPT09IG51bGwpIHsKICAgICAgICAgIHN0YXRlLndzaXplID0gMSA8PCBzdGF0ZS53Yml0czsKICAgICAgICAgIHN0YXRlLnduZXh0ID0gMDsKICAgICAgICAgIHN0YXRlLndoYXZlID0gMDsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG5ldyB1dGlscy5CdWY4KHN0YXRlLndzaXplKTsKICAgICAgICB9CiAgICAgICAgaWYgKGNvcHkgPj0gc3RhdGUud3NpemUpIHsKICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0YXRlLndpbmRvdywgc3JjLCBlbmQgLSBzdGF0ZS53c2l6ZSwgc3RhdGUud3NpemUsIDApOwogICAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgICAgc3RhdGUud2hhdmUgPSBzdGF0ZS53c2l6ZTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZGlzdCA9IHN0YXRlLndzaXplIC0gc3RhdGUud25leHQ7CiAgICAgICAgICBpZiAoZGlzdCA+IGNvcHkpIHsKICAgICAgICAgICAgZGlzdCA9IGNvcHk7CiAgICAgICAgICB9CiAgICAgICAgICB1dGlscy5hcnJheVNldChzdGF0ZS53aW5kb3csIHNyYywgZW5kIC0gY29weSwgZGlzdCwgc3RhdGUud25leHQpOwogICAgICAgICAgY29weSAtPSBkaXN0OwogICAgICAgICAgaWYgKGNvcHkpIHsKICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUud2luZG93LCBzcmMsIGVuZCAtIGNvcHksIGNvcHksIDApOwogICAgICAgICAgICBzdGF0ZS53bmV4dCA9IGNvcHk7CiAgICAgICAgICAgIHN0YXRlLndoYXZlID0gc3RhdGUud3NpemU7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzdGF0ZS53bmV4dCArPSBkaXN0OwogICAgICAgICAgICBpZiAoc3RhdGUud25leHQgPT09IHN0YXRlLndzaXplKSB7CiAgICAgICAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzdGF0ZS53aGF2ZSA8IHN0YXRlLndzaXplKSB7CiAgICAgICAgICAgICAgc3RhdGUud2hhdmUgKz0gZGlzdDsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlKHN0cm0sIGZsdXNoKSB7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIHZhciBpbnB1dCwgb3V0cHV0OwogICAgICAgIHZhciBuZXh0OwogICAgICAgIHZhciBwdXQ7CiAgICAgICAgdmFyIGhhdmUsIGxlZnQ7CiAgICAgICAgdmFyIGhvbGQ7CiAgICAgICAgdmFyIGJpdHM7CiAgICAgICAgdmFyIF9pbiwgX291dDsKICAgICAgICB2YXIgY29weTsKICAgICAgICB2YXIgZnJvbTsKICAgICAgICB2YXIgZnJvbV9zb3VyY2U7CiAgICAgICAgdmFyIGhlcmUgPSAwOwogICAgICAgIHZhciBoZXJlX2JpdHMsIGhlcmVfb3AsIGhlcmVfdmFsOwogICAgICAgIHZhciBsYXN0X2JpdHMsIGxhc3Rfb3AsIGxhc3RfdmFsOwogICAgICAgIHZhciBsZW47CiAgICAgICAgdmFyIHJldDsKICAgICAgICB2YXIgaGJ1ZiA9IG5ldyB1dGlscy5CdWY4KDQpOwogICAgICAgIHZhciBvcHRzOwogICAgICAgIHZhciBuOwogICAgICAgIHZhciBvcmRlciA9IFsxNiwgMTcsIDE4LCAwLCA4LCA3LCA5LCA2LCAxMCwgNSwgMTEsIDQsIDEyLCAzLCAxMywgMiwgMTQsIDEsIDE1XTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUgfHwgIXN0cm0ub3V0cHV0IHx8ICFzdHJtLmlucHV0ICYmIHN0cm0uYXZhaWxfaW4gIT09IDApIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS5tb2RlID09PSBUWVBFKSB7CiAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRURPOwogICAgICAgIH0KICAgICAgICBwdXQgPSBzdHJtLm5leHRfb3V0OwogICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgIGxlZnQgPSBzdHJtLmF2YWlsX291dDsKICAgICAgICBuZXh0ID0gc3RybS5uZXh0X2luOwogICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICBoYXZlID0gc3RybS5hdmFpbF9pbjsKICAgICAgICBob2xkID0gc3RhdGUuaG9sZDsKICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICBfaW4gPSBoYXZlOwogICAgICAgIF9vdXQgPSBsZWZ0OwogICAgICAgIHJldCA9IFpfT0s7CiAgICAgICAgaW5mX2xlYXZlOgogICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgIHN3aXRjaCAoc3RhdGUubW9kZSkgewogICAgICAgICAgICAgIGNhc2UgSEVBRDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFRE87CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUud3JhcCAmIDIgJiYgaG9sZCA9PT0gMzU2MTUpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSAwOwogICAgICAgICAgICAgICAgICBoYnVmWzBdID0gaG9sZCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGhidWYsIDIsIDApOwogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBGTEFHUzsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5mbGFncyA9IDA7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmRvbmUgPSBmYWxzZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICghKHN0YXRlLndyYXAgJiAxKSB8fCAoKChob2xkICYgMjU1KSA8PCA4KSArIChob2xkID4+IDgpKSAlIDMxKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImluY29ycmVjdCBoZWFkZXIgY2hlY2siOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgoaG9sZCAmIDE1KSAhPT0gWl9ERUZMQVRFRCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJ1bmtub3duIGNvbXByZXNzaW9uIG1ldGhvZCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IDQ7CiAgICAgICAgICAgICAgICBiaXRzIC09IDQ7CiAgICAgICAgICAgICAgICBsZW4gPSAoaG9sZCAmIDE1KSArIDg7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUud2JpdHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgc3RhdGUud2JpdHMgPSBsZW47CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGxlbiA+IHN0YXRlLndiaXRzKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgd2luZG93IHNpemUiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmRtYXggPSAxIDw8IGxlbjsKICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDE7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gaG9sZCAmIDUxMiA/IERJQ1RJRCA6IFRZUEU7CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBGTEFHUzoKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZmxhZ3MgPSBob2xkOwogICAgICAgICAgICAgICAgaWYgKChzdGF0ZS5mbGFncyAmIDI1NSkgIT09IFpfREVGTEFURUQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAidW5rbm93biBjb21wcmVzc2lvbiBtZXRob2QiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDU3MzQ0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInVua25vd24gaGVhZGVyIGZsYWdzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC50ZXh0ID0gaG9sZCA+PiA4ICYgMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICBoYnVmWzBdID0gaG9sZCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGhidWYsIDIsIDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUSU1FOwogICAgICAgICAgICAgIGNhc2UgVElNRToKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC50aW1lID0gaG9sZDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICBoYnVmWzBdID0gaG9sZCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhidWZbMl0gPSBob2xkID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlszXSA9IGhvbGQgPj4+IDI0ICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyKHN0YXRlLmNoZWNrLCBoYnVmLCA0LCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gT1M7CiAgICAgICAgICAgICAgY2FzZSBPUzoKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC54ZmxhZ3MgPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLm9zID0gaG9sZCA+PiA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEVYTEVOOwogICAgICAgICAgICAgIGNhc2UgRVhMRU46CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAxMDI0KSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5leHRyYV9sZW4gPSBob2xkOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhidWZbMV0gPSBob2xkID4+PiA4ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGhidWYsIDIsIDApOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBFWFRSQTsKICAgICAgICAgICAgICBjYXNlIEVYVFJBOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMTAyNCkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IGhhdmUpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5ID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSkgewogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgICAgICBsZW4gPSBzdGF0ZS5oZWFkLmV4dHJhX2xlbiAtIHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgIGlmICghc3RhdGUuaGVhZC5leHRyYSkgewogICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhID0gbmV3IEFycmF5KHN0YXRlLmhlYWQuZXh0cmFfbGVuKTsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0YXRlLmhlYWQuZXh0cmEsIGlucHV0LCBuZXh0LCBjb3B5LCBsZW4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGlucHV0LCBjb3B5LCBuZXh0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZSAtPSBjb3B5OwogICAgICAgICAgICAgICAgICAgIG5leHQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IE5BTUU7CiAgICAgICAgICAgICAgY2FzZSBOQU1FOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMjA0OCkgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBjb3B5ID0gMDsKICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgIGxlbiA9IGlucHV0W25leHQgKyBjb3B5KytdOwogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkICYmIGxlbiAmJiBzdGF0ZS5sZW5ndGggPCA2NTUzNikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5uYW1lICs9IFN0cmluZy5mcm9tQ2hhckNvZGUobGVuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiAmJiBjb3B5IDwgaGF2ZSk7CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGlucHV0LCBjb3B5LCBuZXh0KTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIG5leHQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgaWYgKGxlbikgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQubmFtZSA9IG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPTU1FTlQ7CiAgICAgICAgICAgICAgY2FzZSBDT01NRU5UOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNDA5NikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBjb3B5ID0gMDsKICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgIGxlbiA9IGlucHV0W25leHQgKyBjb3B5KytdOwogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkICYmIGxlbiAmJiBzdGF0ZS5sZW5ndGggPCA2NTUzNikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5jb21tZW50ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUobGVuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiAmJiBjb3B5IDwgaGF2ZSk7CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGlucHV0LCBjb3B5LCBuZXh0KTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIG5leHQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgaWYgKGxlbikgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuY29tbWVudCA9IG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gSENSQzsKICAgICAgICAgICAgICBjYXNlIEhDUkM6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhvbGQgIT09IChzdGF0ZS5jaGVjayAmIDY1NTM1KSkgewogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImhlYWRlciBjcmMgbWlzbWF0Y2giOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5oY3JjID0gc3RhdGUuZmxhZ3MgPj4gOSAmIDE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZG9uZSA9IHRydWU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEU7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIERJQ1RJRDoKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0genN3YXAzMihob2xkKTsKICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRElDVDsKICAgICAgICAgICAgICBjYXNlIERJQ1Q6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZWRpY3QgPT09IDApIHsKICAgICAgICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBsZWZ0OwogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaG9sZCA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgICAgICAgICAgICByZXR1cm4gWl9ORUVEX0RJQ1Q7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSAxOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEU7CiAgICAgICAgICAgICAgY2FzZSBUWVBFOgogICAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX0JMT0NLIHx8IGZsdXNoID09PSBaX1RSRUVTKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBjYXNlIFRZUEVETzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5sYXN0KSB7CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBiaXRzICYgNzsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBiaXRzICYgNzsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENIRUNLOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMykgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sYXN0ID0gaG9sZCAmIDE7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gMTsKICAgICAgICAgICAgICAgIGJpdHMgLT0gMTsKICAgICAgICAgICAgICAgIHN3aXRjaCAoaG9sZCAmIDMpIHsKICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBTVE9SRUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICBmaXhlZHRhYmxlcyhzdGF0ZSk7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTl87CiAgICAgICAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX1RSRUVTKSB7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gMjsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gMjsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVEFCTEU7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGJsb2NrIHR5cGUiOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gMjsKICAgICAgICAgICAgICAgIGJpdHMgLT0gMjsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgU1RPUkVEOgogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgYml0cyAtPSBiaXRzICYgNzsKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKChob2xkICYgNjU1MzUpICE9PSAoaG9sZCA+Pj4gMTYgXiA2NTUzNSkpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBzdG9yZWQgYmxvY2sgbGVuZ3RocyI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoID0gaG9sZCAmIDY1NTM1OwogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT1BZXzsKICAgICAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9UUkVFUykgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgY2FzZSBDT1BZXzoKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT1BZOwogICAgICAgICAgICAgIGNhc2UgQ09QWToKICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICBpZiAoY29weSkgewogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IGhhdmUpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5ID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IGxlZnQpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5ID0gbGVmdDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB1dGlscy5hcnJheVNldChvdXRwdXQsIGlucHV0LCBuZXh0LCBjb3B5LCBwdXQpOwogICAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIG5leHQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgbGVmdCAtPSBjb3B5OwogICAgICAgICAgICAgICAgICBwdXQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEU7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIFRBQkxFOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNCkgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5ubGVuID0gKGhvbGQgJiAzMSkgKyAyNTc7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNTsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNTsKICAgICAgICAgICAgICAgIHN0YXRlLm5kaXN0ID0gKGhvbGQgJiAzMSkgKyAxOwogICAgICAgICAgICAgICAgaG9sZCA+Pj49IDU7CiAgICAgICAgICAgICAgICBiaXRzIC09IDU7CiAgICAgICAgICAgICAgICBzdGF0ZS5uY29kZSA9IChob2xkICYgMTUpICsgNDsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA0OwogICAgICAgICAgICAgICAgYml0cyAtPSA0OwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLm5sZW4gPiAyODYgfHwgc3RhdGUubmRpc3QgPiAzMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJ0b28gbWFueSBsZW5ndGggb3IgZGlzdGFuY2Ugc3ltYm9scyI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuaGF2ZSA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOTEVOUzsKICAgICAgICAgICAgICBjYXNlIExFTkxFTlM6CiAgICAgICAgICAgICAgICB3aGlsZSAoc3RhdGUuaGF2ZSA8IHN0YXRlLm5jb2RlKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMykgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUubGVuc1tvcmRlcltzdGF0ZS5oYXZlKytdXSA9IGhvbGQgJiA3OwogICAgICAgICAgICAgICAgICBob2xkID4+Pj0gMzsKICAgICAgICAgICAgICAgICAgYml0cyAtPSAzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKHN0YXRlLmhhdmUgPCAxOSkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW29yZGVyW3N0YXRlLmhhdmUrK11dID0gMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmNvZGUgPSBzdGF0ZS5sZW5keW47CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5iaXRzID0gNzsKICAgICAgICAgICAgICAgIG9wdHMgPSB7IGJpdHM6IHN0YXRlLmxlbmJpdHMgfTsKICAgICAgICAgICAgICAgIHJldCA9IGluZmxhdGVfdGFibGUoQ09ERVMsIHN0YXRlLmxlbnMsIDAsIDE5LCBzdGF0ZS5sZW5jb2RlLCAwLCBzdGF0ZS53b3JrLCBvcHRzKTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgICAgICAgICBpZiAocmV0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgY29kZSBsZW5ndGhzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuaGF2ZSA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ09ERUxFTlM7CiAgICAgICAgICAgICAgY2FzZSBDT0RFTEVOUzoKICAgICAgICAgICAgICAgIHdoaWxlIChzdGF0ZS5oYXZlIDwgc3RhdGUubmxlbiArIHN0YXRlLm5kaXN0KSB7CiAgICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5sZW5jb2RlW2hvbGQgJiAoMSA8PCBzdGF0ZS5sZW5iaXRzKSAtIDFdOwogICAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgICBoZXJlX3ZhbCA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgICBpZiAoaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChoZXJlX3ZhbCA8IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBoZXJlX3ZhbDsKICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGVyZV92YWwgPT09IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgMjsKICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGJpdCBsZW5ndGggcmVwZWF0IjsKICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICBsZW4gPSBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUgLSAxXTsKICAgICAgICAgICAgICAgICAgICAgIGNvcHkgPSAzICsgKGhvbGQgJiAzKTsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaGVyZV92YWwgPT09IDE3KSB7CiAgICAgICAgICAgICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgMzsKICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBsZW4gPSAwOwogICAgICAgICAgICAgICAgICAgICAgY29weSA9IDMgKyAoaG9sZCAmIDcpOwogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IDM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IDM7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyA3OwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICBjb3B5ID0gMTEgKyAoaG9sZCAmIDEyNyk7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gNzsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gNzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhhdmUgKyBjb3B5ID4gc3RhdGUubmxlbiArIHN0YXRlLm5kaXN0KSB7CiAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGJpdCBsZW5ndGggcmVwZWF0IjsKICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGNvcHktLSkgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUubGVuc1tzdGF0ZS5oYXZlKytdID0gbGVuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IEJBRCkgewogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5sZW5zWzI1Nl0gPT09IDApIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBjb2RlIC0tIG1pc3NpbmcgZW5kLW9mLWJsb2NrIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5iaXRzID0gOTsKICAgICAgICAgICAgICAgIG9wdHMgPSB7IGJpdHM6IHN0YXRlLmxlbmJpdHMgfTsKICAgICAgICAgICAgICAgIHJldCA9IGluZmxhdGVfdGFibGUoTEVOUywgc3RhdGUubGVucywgMCwgc3RhdGUubmxlbiwgc3RhdGUubGVuY29kZSwgMCwgc3RhdGUud29yaywgb3B0cyk7CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5iaXRzID0gb3B0cy5iaXRzOwogICAgICAgICAgICAgICAgaWYgKHJldCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGxpdGVyYWwvbGVuZ3RocyBzZXQiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmRpc3RiaXRzID0gNjsKICAgICAgICAgICAgICAgIHN0YXRlLmRpc3Rjb2RlID0gc3RhdGUuZGlzdGR5bjsKICAgICAgICAgICAgICAgIG9wdHMgPSB7IGJpdHM6IHN0YXRlLmRpc3RiaXRzIH07CiAgICAgICAgICAgICAgICByZXQgPSBpbmZsYXRlX3RhYmxlKERJU1RTLCBzdGF0ZS5sZW5zLCBzdGF0ZS5ubGVuLCBzdGF0ZS5uZGlzdCwgc3RhdGUuZGlzdGNvZGUsIDAsIHN0YXRlLndvcmssIG9wdHMpOwogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgICAgICAgICBpZiAocmV0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2VzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTl87CiAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGNhc2UgTEVOXzoKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU47CiAgICAgICAgICAgICAgY2FzZSBMRU46CiAgICAgICAgICAgICAgICBpZiAoaGF2ZSA+PSA2ICYmIGxlZnQgPj0gMjU4KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSBwdXQ7CiAgICAgICAgICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gbGVmdDsKICAgICAgICAgICAgICAgICAgc3RybS5uZXh0X2luID0gbmV4dDsKICAgICAgICAgICAgICAgICAgc3RybS5hdmFpbF9pbiA9IGhhdmU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhvbGQgPSBob2xkOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iaXRzID0gYml0czsKICAgICAgICAgICAgICAgICAgaW5mbGF0ZV9mYXN0KHN0cm0sIF9vdXQpOwogICAgICAgICAgICAgICAgICBwdXQgPSBzdHJtLm5leHRfb3V0OwogICAgICAgICAgICAgICAgICBvdXRwdXQgPSBzdHJtLm91dHB1dDsKICAgICAgICAgICAgICAgICAgbGVmdCA9IHN0cm0uYXZhaWxfb3V0OwogICAgICAgICAgICAgICAgICBuZXh0ID0gc3RybS5uZXh0X2luOwogICAgICAgICAgICAgICAgICBpbnB1dCA9IHN0cm0uaW5wdXQ7CiAgICAgICAgICAgICAgICAgIGhhdmUgPSBzdHJtLmF2YWlsX2luOwogICAgICAgICAgICAgICAgICBob2xkID0gc3RhdGUuaG9sZDsKICAgICAgICAgICAgICAgICAgYml0cyA9IHN0YXRlLmJpdHM7CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5tb2RlID09PSBUWVBFKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuYmFjayA9IC0xOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuYmFjayA9IDA7CiAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgaGVyZSA9IHN0YXRlLmxlbmNvZGVbaG9sZCAmICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICBoZXJlX29wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICBpZiAoaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCAmJiAoaGVyZV9vcCAmIDI0MCkgPT09IDApIHsKICAgICAgICAgICAgICAgICAgbGFzdF9iaXRzID0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICBsYXN0X29wID0gaGVyZV9vcDsKICAgICAgICAgICAgICAgICAgbGFzdF92YWwgPSBoZXJlX3ZhbDsKICAgICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgICAgaGVyZSA9IHN0YXRlLmxlbmNvZGVbbGFzdF92YWwgKyAoKGhvbGQgJiAoMSA8PCBsYXN0X2JpdHMgKyBsYXN0X29wKSAtIDEpID4+IGxhc3RfYml0cyldOwogICAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgICBoZXJlX3ZhbCA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgICBpZiAobGFzdF9iaXRzICsgaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgLT0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IGxhc3RfYml0czsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTElUOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYgMzIpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuYmFjayA9IC0xOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCAmIDY0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgbGl0ZXJhbC9sZW5ndGggY29kZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZXh0cmEgPSBoZXJlX29wICYgMTU7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVORVhUOwogICAgICAgICAgICAgIGNhc2UgTEVORVhUOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmV4dHJhKSB7CiAgICAgICAgICAgICAgICAgIG4gPSBzdGF0ZS5leHRyYTsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggKz0gaG9sZCAmICgxIDw8IHN0YXRlLmV4dHJhKSAtIDE7CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBzdGF0ZS5leHRyYTsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBzdGF0ZS5leHRyYTsKICAgICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBzdGF0ZS5leHRyYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLndhcyA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESVNUOwogICAgICAgICAgICAgIGNhc2UgRElTVDoKICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUuZGlzdGNvZGVbaG9sZCAmICgxIDw8IHN0YXRlLmRpc3RiaXRzKSAtIDFdOwogICAgICAgICAgICAgICAgICBoZXJlX2JpdHMgPSBoZXJlID4+PiAyNDsKICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICBoZXJlX3ZhbCA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgaWYgKGhlcmVfYml0cyA8PSBiaXRzKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKChoZXJlX29wICYgMjQwKSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBsYXN0X2JpdHMgPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgIGxhc3Rfb3AgPSBoZXJlX29wOwogICAgICAgICAgICAgICAgICBsYXN0X3ZhbCA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUuZGlzdGNvZGVbbGFzdF92YWwgKyAoKGhvbGQgJiAoMSA8PCBsYXN0X2JpdHMgKyBsYXN0X29wKSAtIDEpID4+IGxhc3RfYml0cyldOwogICAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgICBoZXJlX3ZhbCA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgICBpZiAobGFzdF9iaXRzICsgaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgLT0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IGxhc3RfYml0czsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgaWYgKGhlcmVfb3AgJiA2NCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIGNvZGUiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm9mZnNldCA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgc3RhdGUuZXh0cmEgPSBoZXJlX29wICYgMTU7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRElTVEVYVDsKICAgICAgICAgICAgICBjYXNlIERJU1RFWFQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZXh0cmEpIHsKICAgICAgICAgICAgICAgICAgbiA9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHN0YXRlLm9mZnNldCArPSBob2xkICYgKDEgPDwgc3RhdGUuZXh0cmEpIC0gMTsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBiaXRzIC09IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLm9mZnNldCA+IHN0YXRlLmRtYXgpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2siOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBNQVRDSDsKICAgICAgICAgICAgICBjYXNlIE1BVENIOgogICAgICAgICAgICAgICAgaWYgKGxlZnQgPT09IDApIHsKICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgY29weSA9IF9vdXQgLSBsZWZ0OwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLm9mZnNldCA+IGNvcHkpIHsKICAgICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLm9mZnNldCAtIGNvcHk7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gc3RhdGUud2hhdmUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuc2FuZSkgewogICAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2siOwogICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IHN0YXRlLnduZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgY29weSAtPSBzdGF0ZS53bmV4dDsKICAgICAgICAgICAgICAgICAgICBmcm9tID0gc3RhdGUud3NpemUgLSBjb3B5OwogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGZyb20gPSBzdGF0ZS53bmV4dCAtIGNvcHk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGNvcHkgPiBzdGF0ZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5ID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gc3RhdGUud2luZG93OwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7CiAgICAgICAgICAgICAgICAgIGZyb20gPSBwdXQgLSBzdGF0ZS5vZmZzZXQ7CiAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoY29weSA+IGxlZnQpIHsKICAgICAgICAgICAgICAgICAgY29weSA9IGxlZnQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBsZWZ0IC09IGNvcHk7CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgb3V0cHV0W3B1dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICB9IHdoaWxlICgtLWNvcHkpOwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBMSVQ6CiAgICAgICAgICAgICAgICBpZiAobGVmdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBvdXRwdXRbcHV0KytdID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgbGVmdC0tOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTjsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgQ0hFQ0s6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUud3JhcCkgewogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDMyKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgfD0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBfb3V0IC09IGxlZnQ7CiAgICAgICAgICAgICAgICAgIHN0cm0udG90YWxfb3V0ICs9IF9vdXQ7CiAgICAgICAgICAgICAgICAgIHN0YXRlLnRvdGFsICs9IF9vdXQ7CiAgICAgICAgICAgICAgICAgIGlmIChfb3V0KSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0gc3RhdGUuZmxhZ3MgPyBjcmMzMihzdGF0ZS5jaGVjaywgb3V0cHV0LCBfb3V0LCBwdXQgLSBfb3V0KSA6IGFkbGVyMzIoc3RhdGUuY2hlY2ssIG91dHB1dCwgX291dCwgcHV0IC0gX291dCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgX291dCA9IGxlZnQ7CiAgICAgICAgICAgICAgICAgIGlmICgoc3RhdGUuZmxhZ3MgPyBob2xkIDogenN3YXAzMihob2xkKSkgIT09IHN0YXRlLmNoZWNrKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGRhdGEgY2hlY2siOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTkdUSDsKICAgICAgICAgICAgICBjYXNlIExFTkdUSDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwICYmIHN0YXRlLmZsYWdzKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChob2xkICE9PSAoc3RhdGUudG90YWwgJiA0Mjk0OTY3Mjk1KSkgewogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImluY29ycmVjdCBsZW5ndGggY2hlY2siOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IERPTkU7CiAgICAgICAgICAgICAgY2FzZSBET05FOgogICAgICAgICAgICAgICAgcmV0ID0gWl9TVFJFQU1fRU5EOwogICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgIGNhc2UgQkFEOgogICAgICAgICAgICAgICAgcmV0ID0gWl9EQVRBX0VSUk9SOwogICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgIGNhc2UgTUVNOgogICAgICAgICAgICAgICAgcmV0dXJuIFpfTUVNX0VSUk9SOwogICAgICAgICAgICAgIGNhc2UgU1lOQzoKICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICBzdHJtLmF2YWlsX291dCA9IGxlZnQ7CiAgICAgICAgc3RybS5uZXh0X2luID0gbmV4dDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTsKICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICBzdGF0ZS5iaXRzID0gYml0czsKICAgICAgICBpZiAoc3RhdGUud3NpemUgfHwgX291dCAhPT0gc3RybS5hdmFpbF9vdXQgJiYgc3RhdGUubW9kZSA8IEJBRCAmJiAoc3RhdGUubW9kZSA8IENIRUNLIHx8IGZsdXNoICE9PSBaX0ZJTklTSCkpIHsKICAgICAgICAgIGlmICh1cGRhdGV3aW5kb3coc3RybSwgc3RybS5vdXRwdXQsIHN0cm0ubmV4dF9vdXQsIF9vdXQgLSBzdHJtLmF2YWlsX291dCkpIHsKICAgICAgICAgICAgc3RhdGUubW9kZSA9IE1FTTsKICAgICAgICAgICAgcmV0dXJuIFpfTUVNX0VSUk9SOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBfaW4gLT0gc3RybS5hdmFpbF9pbjsKICAgICAgICBfb3V0IC09IHN0cm0uYXZhaWxfb3V0OwogICAgICAgIHN0cm0udG90YWxfaW4gKz0gX2luOwogICAgICAgIHN0cm0udG90YWxfb3V0ICs9IF9vdXQ7CiAgICAgICAgc3RhdGUudG90YWwgKz0gX291dDsKICAgICAgICBpZiAoc3RhdGUud3JhcCAmJiBfb3V0KSB7CiAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSBzdGF0ZS5mbGFncyA/IGNyYzMyKHN0YXRlLmNoZWNrLCBvdXRwdXQsIF9vdXQsIHN0cm0ubmV4dF9vdXQgLSBfb3V0KSA6IGFkbGVyMzIoc3RhdGUuY2hlY2ssIG91dHB1dCwgX291dCwgc3RybS5uZXh0X291dCAtIF9vdXQpOwogICAgICAgIH0KICAgICAgICBzdHJtLmRhdGFfdHlwZSA9IHN0YXRlLmJpdHMgKyAoc3RhdGUubGFzdCA/IDY0IDogMCkgKyAoc3RhdGUubW9kZSA9PT0gVFlQRSA/IDEyOCA6IDApICsgKHN0YXRlLm1vZGUgPT09IExFTl8gfHwgc3RhdGUubW9kZSA9PT0gQ09QWV8gPyAyNTYgOiAwKTsKICAgICAgICBpZiAoKF9pbiA9PT0gMCAmJiBfb3V0ID09PSAwIHx8IGZsdXNoID09PSBaX0ZJTklTSCkgJiYgcmV0ID09PSBaX09LKSB7CiAgICAgICAgICByZXQgPSBaX0JVRl9FUlJPUjsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlRW5kKHN0cm0pIHsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgdmFyIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBpZiAoc3RhdGUud2luZG93KSB7CiAgICAgICAgICBzdGF0ZS53aW5kb3cgPSBudWxsOwogICAgICAgIH0KICAgICAgICBzdHJtLnN0YXRlID0gbnVsbDsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlR2V0SGVhZGVyKHN0cm0sIGhlYWQpIHsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBpZiAoKHN0YXRlLndyYXAgJiAyKSA9PT0gMCkgewogICAgICAgICAgcmV0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lMi5leHBvcnRzID0gewogICAgICAgIFpfTk9fRkxVU0g6IDAsCiAgICAgICAgWl9QQVJUSUFMX0ZMVVNIOiAxLAogICAgICAgIFpfU1lOQ19GTFVTSDogMiwKICAgICAgICBaX0ZVTExfRkxVU0g6IDMsCiAgICAgICAgWl9GSU5JU0g6IDQsCiAgICAgICAgWl9CTE9DSzogNSwKICAgICAgICBaX1RSRUVTOiA2LAogICAgICAgIFpfT0s6IDAsCiAgICAgICAgWl9TVFJFQU1fRU5EOiAxLAogICAgICAgIFpfTkVFRF9ESUNUOiAyLAogICAgICAgIFpfRVJSTk86IC0xLAogICAgICAgIFpfU1RSRUFNX0VSUk9SOiAtMiwKICAgICAgICBaX0RBVEFfRVJST1I6IC0zLAogICAgICAgIFpfQlVGX0VSUk9SOiAtNSwKICAgICAgICBaX05PX0NPTVBSRVNTSU9OOiAwLAogICAgICAgIFpfQkVTVF9TUEVFRDogMSwKICAgICAgICBaX0JFU1RfQ09NUFJFU1NJT046IDksCiAgICAgICAgWl9ERUZBVUxUX0NPTVBSRVNTSU9OOiAtMSwKICAgICAgICBaX0ZJTFRFUkVEOiAxLAogICAgICAgIFpfSFVGRk1BTl9PTkxZOiAyLAogICAgICAgIFpfUkxFOiAzLAogICAgICAgIFpfRklYRUQ6IDQsCiAgICAgICAgWl9ERUZBVUxUX1NUUkFURUdZOiAwLAogICAgICAgIFpfQklOQVJZOiAwLAogICAgICAgIFpfVEVYVDogMSwKICAgICAgICBaX1VOS05PV046IDIsCiAgICAgICAgWl9ERUZMQVRFRDogOAogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvZ3poZWFkZXIuanMKICB2YXIgcmVxdWlyZV9nemhlYWRlciA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFr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zKCk7CiAgICAgIHZhciBaU3RyZWFtID0gcmVxdWlyZV96c3RyZWFtKCk7CiAgICAgIHZhciBHWmhlYWRlciA9IHJlcXVpcmVfZ3poZWFkZXIoKTsKICAgICAgdmFyIHRvU3RyaW5nID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZzsKICAgICAgZnVuY3Rpb24gSW5mbGF0ZTIob3B0aW9ucykgewogICAgICAgIGlmICghKHRoaXMgaW5zdGFuY2VvZiBJbmZsYXRlMikpCiAgICAgICAgICByZXR1cm4gbmV3IEluZmxhdGUyKG9wdGlvbnMpOwogICAgICAgIHRoaXMub3B0aW9ucyA9IHV0aWxzLmFzc2lnbih7CiAgICAgICAgICBjaHVua1NpemU6IDE2Mzg0LAogICAgICAgICAgd2luZG93Qml0czogMCwKICAgICAgICAgIHRvOiAiIgogICAgICAgIH0sIG9wdGlvbnMgfHwge30pOwogICAgICAgIHZhciBvcHQgPSB0aGlzLm9wdGlvbnM7CiAgICAgICAgaWYgKG9wdC5yYXcgJiYgb3B0LndpbmRvd0JpdHMgPj0gMCAmJiBvcHQud2luZG93Qml0cyA8IDE2KSB7CiAgICAgICAgICBvcHQud2luZG93Qml0cyA9IC1vcHQud2luZG93Qml0czsKICAgICAgICAgIGlmIChvcHQud2luZG93Qml0cyA9PT0gMCkgewogICAgICAgICAgICBvcHQud2luZG93Qml0cyA9IC0xNTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKG9wdC53aW5kb3dCaXRzID49IDAgJiYgb3B0LndpbmRvd0JpdHMgPCAxNiAmJiAhKG9wdGlvbnMgJiYgb3B0aW9ucy53aW5kb3dCaXRzKSkgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgKz0gMzI7CiAgICAgICAgfQogICAgICAgIGlmIChvcHQud2luZG93Qml0cyA+IDE1ICYmIG9wdC53aW5kb3dCaXRzIDwgNDgpIHsKICAgICAgICAgIGlmICgob3B0LndpbmRvd0JpdHMgJiAxNSkgPT09IDApIHsKIC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sYXRlU2V0RGljdGlvbmFyeSh0aGlzLnN0cm0sIG9wdC5kaWN0aW9uYXJ5KTsKICAgICAgICAgICAgaWYgKHN0YXR1cyAhPT0gYy5aX09LKSB7CiAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKG1zZ1tzdGF0dXNdKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBJbmZsYXRlMi5wcm90b3R5cGUucHVzaCA9IGZ1bmN0aW9uKGRhdGEsIG1vZGUpIHsKICAgICAgICB2YXIgc3RybSA9IHRoaXMuc3RybTsKICAgICAgICB2YXIgY2h1bmtTaXplID0gdGhpcy5vcHRpb25zLmNodW5rU2l6ZTsKICAgICAgICB2YXIgZGljdGlvbmFyeSA9IHRoaXMub3B0aW9ucy5kaWN0aW9uYXJ5OwogICAgICAgIHZhciBzdGF0dXMsIF9tb2RlOwogICAgICAgIHZhciBuZXh0X291dF91dGY4LCB0YWlsLCB1dGY4c3RyOwogICAgICAgIHZhciBhbGxvd0J1ZkVycm9yID0gZmFsc2U7CiAgICAgICAgaWYgKHRoaXMuZW5kZWQpIHsKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICB9CiAgICAgICAgX21vZGUgPSBtb2RlID09PSB+fm1vZGUgPyBtb2RlIDogbW9kZSA9PT0gdHJ1ZSA/IGMuWl9GSU5JU0ggOiBjLlpfTk9fRkxVU0g7CiAgICAgICAgaWYgKHR5cGVvZiBkYXRhID09PSAic3RyaW5nIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IHN0cmluZ3MuYmluc3RyaW5nMmJ1ZihkYXRhKTsKICAgICAgICB9IGVsc2UgaWYgKHRvU3RyaW5nLmNhbGwoZGF0YSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgIHN0cm0uaW5wdXQgPSBuZXcgVWludDhBcnJheShkYXRhKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RybS5pbnB1dCA9IGRhdGE7CiAgICAgICAgfQogICAgICAgIHN0cm0ubmV4dF9pbiA9IDA7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IHN0cm0uaW5wdXQubGVuZ3RoOwogICAgICAgIGRvIHsKICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBzdHJtLm91dHB1dCA9IG5ldyB1dGlscy5CdWY4KGNodW5rU2l6ZSk7CiAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSAwOwogICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGNodW5rU2l6ZTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfaW5mbGF0ZS5pbmZsYXRlKHN0cm0sIGMuWl9OT19GTFVTSCk7CiAgICAgICAgICBpZiAoc3RhdHVzID09PSBjLlpfTkVFRF9ESUNUICYmIGRpY3Rpb25hcnkpIHsKICAgICAgICAgICAgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGVTZXREaWN0aW9uYXJ5KHRoaXMuc3RybSwgZGljdGlvbmFyeSk7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc3RhdHVzID09PSBjLlpfQlVGX0VSUk9SICYmIGFsbG93QnVmRXJyb3IgPT09IHRydWUpIHsKICAgICAgICAgICAgc3RhdHVzID0gYy5aX09LOwogICAgICAgICAgICBhbGxvd0J1ZkVycm9yID0gZmFsc2U7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc3RhdHVzICE9PSBjLlpfU1RSRUFNX0VORCAmJiBzdGF0dXMgIT09IGMuWl9PSykgewogICAgICAgICAgICB0aGlzLm9uRW5kKHN0YXR1cyk7CiAgICAgICAgICAgIHRoaXMuZW5kZWQgPSB0cnVlOwogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc3RybS5uZXh0X291dCkgewogICAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDAgfHwgc3RhdHVzID09PSBjLlpfU1RSRUFNX0VORCB8fCBzdHJtLmF2YWlsX2luID09PSAwICYmIChfbW9kZSA9PT0gYy5aX0ZJTklTSCB8fCBfbW9kZSA9PT0gYy5aX1NZTkNfRkxVU0gpKSB7CiAgICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICAgIG5leHRfb3V0X3V0ZjggPSBzdHJpbmdzLnV0Zjhib3JkZXIoc3RybS5vdXRwdXQsIHN0cm0ubmV4dF9vdXQpOwogICAgICAgICAgICAgICAgdGFpbCA9IHN0cm0ubmV4dF9vdXQgLSBuZXh0X291dF91dGY4OwogICAgICAgICAgICAgICAgdXRmOHN0ciA9IHN0cmluZ3MuYnVmMnN0cmluZyhzdHJtLm91dHB1dCwgbmV4dF9vdXRfdXRmOCk7CiAgICAgICAgICAgICAgICBzdHJtLm5leHRfb3V0ID0gdGFpbDsKICAgICAgICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gY2h1bmtTaXplIC0gdGFpbDsKICAgICAgICAgICAgICAgIGlmICh0YWlsKSB7CiAgICAgICAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0cm0ub3V0cHV0LCBzdHJtLm91dHB1dCwgbmV4dF9vdXRfdXRmOCwgdGFpbCwgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0aGlzLm9uRGF0YSh1dGY4c3RyKTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdGhpcy5vbkRhdGEodXRpbHMuc2hyaW5rQnVmKHN0cm0ub3V0cHV0LCBzdHJtLm5leHRfb3V0KSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc3RybS5hdmFpbF9pbiA9PT0gMCAmJiBzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBhbGxvd0J1ZkVycm9yID0gdHJ1ZTsKICAgICAgICAgIH0KICAgICAgICB9IHdoaWxlICgoc3RybS5hdmFpbF9pbiA+IDAgfHwgc3RybS5hdmFpbF9vdXQgPT09IDApICYmIHN0YXR1cyAhPT0gYy5aX1NUUkVBTV9FTkQpOwogICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9TVFJFQU1fRU5EKSB7CiAgICAgICAgICBfbW9kZSA9IGMuWl9GSU5JU0g7CiAgICAgICAgfQogICAgICAgIGlmIChfbW9kZSA9PT0gYy5aX0ZJTklTSCkgewogICAgICAgICAgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGVFbmQodGhpcy5zdHJtKTsKICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgIHRoaXMuZW5kZWQgPSB0cnVlOwogICAgICAgICAgcmV0dXJuIHN0YXR1cyA9PT0gYy5aX09LOwogICAgICAgIH0KICAgICAgICBpZiAoX21vZGUgPT09IGMuWl9TWU5DX0ZMVVNIKSB7CiAgICAgICAgICB0aGlzLm9uRW5kKGMuWl9PSyk7CiAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IDA7CiAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgIH07CiAgICAgIEluZmxhdGUyLnByb3RvdHlwZS5vbkRhdGEgPSBmdW5jdGlvbihjaHVuaykgewogICAgICAgIHRoaXMuY2h1bmtzLnB1c2goY2h1bmspOwogICAgICB9OwogICAgICBJbmZsYXRlMi5wcm90b3R5cGUub25FbmQgPSBmdW5jdGlvbihzdGF0dXMpIHsKICAgICAgICBpZiAoc3RhdHVzID09PSBjLlpfT0spIHsKICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMudG8gPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdGhpcy5jaHVua3Muam9pbigiIik7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aGlzLnJlc3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rb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vaW5kZXguanMiKGV4cG9ydHMyLCBtb2R1bGUyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICB2YXIgYXNzaWduID0gcmVxdWlyZV9jb21tb24oKS5hc3NpZ247CiAgICAgIHZhciBkZWZsYXRlID0gcmVxdWlyZV9kZWZsYXRlMigpOwogICAgICB2YXIgaW5mbGF0ZSA9IHJlcXVpcmVfaW5mbGF0ZTIoKTsKICAgICAgdmFyIGNvbnN0YW50cyA9IHJlcXVpcmVfY29uc3RhbnRzKCk7CiAgICAgIHZhciBwYWtvID0ge307CiAgICAgIGFzc2lnbihwYWtvLCBkZWZsYXRlLCBpbmZsYXRlLCBjb25zdGFudHMpOwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBwYWtvOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vbG9uZ0A0LjAuMC9ub2RlX21vZHVsZXMvbG9uZy9zcmMvbG9uZy5qcwogIHZhciByZXF1aXJlX2xvbmcgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vbG9uZ0A0LjAuMC9ub2RlX21vZHVsZXMvbG9uZy9zcmMvbG9uZy5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBMb25nNDsKICAgICAgdmFyIHdhc20gPSBudWxsOwogICAgICB0cnkgewogICAgICAgIHdhc20gPSBuZXcgV2ViQXNzZW1ibHkuSW5zdGFuY2UobmV3IFdlYkFzc2VtYmx5Lk1vZHVsZShuZXcgVWludDhBcnJheShbCiAgICAgICAgICAwLAogICAgICAgICAgOTcsCiAgICAgICAgICAxMTUsCiAgICAgICAgICAxMDksCiAgICAgICAgICAxLAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEzLAogICAgICAgICAgMiwKICAgICAgICAgIDk2LAogICAgICAgICAgMCwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICA5NiwKICAgICAgICAgIDQsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxLAogICAgICAgICAgMTI3LAogICAgICAgICAgMywKICAgICAgICAgIDcsCiAgICAgICAgICA2LAogICAgICAgICAgMCwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgNiwKICAgICAgICAgIDYsCiAgICAgICAgICAxLAogICAgICAgICAgMTI3LAogICAgICAgICAgMSwKICAgICAgICAgIDY1LAogICAgICAgICAgMCwKICAgICAgICAgIDExLAogICAgICAgICAgNywKICAgICAgICAgIDUwLAogICAgICAgICAgNiwKICAgICAgICAgIDMsCiAgICAgICAgICAxMDksCiAgICAgICAgICAxMTcsCiAgICAgICAgICAxMDgsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDUsCiAgICAgICAgICAxMDAsCiAgICAgICAgICAxMDUsCiAgICAgICAgICAxMTgsCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNSwKICAgICAgICAgIDAsCiAgICAgICAgICAyLAogICAgICAgICAgNSwKICAgICAgICAgIDEwMCwKICAgICAgICAgIDEwNSwKICAgICAgICAgIDExOCwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE3LAogICAgICAgICAgMCwKICAgICAgICAgIDMsCiAgICAgICAgICA1LAogICAgICAgICAgMTE0LAogICAgICAgICAgMTAxLAogICAgICAgICAgMTA5LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMTUsCiAgICAgICAgICAwLAogICAgICAgICAgNCwKICAgICAgICAgIDUsCiAgICAgICAgICAxMTQsCiAgICAgICAgICAxMDEsCiAgICAgICAgICAxMDksCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNywKICAgICAgICAgIDAsCiAgICAgICAgICA1LAogICAgICAgICAgOCwKICAgICAgICAgIDEwMywKICAgICAgICAgIDEwMSwKICAgICAgICAgIDExNiwKICAgICAgICAgIDk1LAogICAgICAgICAgMTA0LAogICAgICAgICAgMTA1LAogICAgICAgICAgMTAzLAogICAgICAgICAgMTA0LAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAxMCwKICAgICAgICAgIDE5MSwKICAgICAgICAgIDEsCiAgICAgICAgICA2LAogICAgICAgICAgNCwKICAgICAgICAgIDAsCiAgICAgICAgICAzNSwKICAgICAgICAgIDAsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyNywKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyOCwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyOSwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEzMCwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMQogICAgICAgIF0pKSwge30pLmV4cG9ydHM7CiAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgfQogICAgICBmdW5jdGlvbiBMb25nNChsb3csIGhpZ2gsIHVuc2lnbmVkKSB7CiAgICAgICAgdGhpcy5sb3cgPSBsb3cgfCAwOwogICAgICAgIHRoaXMuaGlnaCA9IGhpZ2ggfCAwOwogICAgICAgIHRoaXMudW5zaWduZWQgPSAhIXVuc2lnbmVkOwogICAgICB9CiAgICAgIExvbmc0LnByb3RvdHlwZS5fX2lzTG9uZ19fOwogICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoTG9uZzQucHJvdG90eXBlLCAiX19pc0xvbmdfXyIsIHsgdmFsdWU6IHRydWUgfSk7CiAgICAgIGZ1bmN0aW9uIGlzTG9uZyhvYmopIHsKICAgICAgICByZXR1cm4gKG9iaiAmJiBvYmpbIl9faXNMb25nX18iXSkgPT09IHRydWU7CiAgICAgIH0KICAgICAgTG9uZzQuaXNMb25nID0gaXNMb25nOwogICAgICB2YXIgSU5UX0NBQ0hFID0ge307CiAgICAgIHZhciBVSU5UX0NBQ0hFID0ge307CiAgICAgIGZ1bmN0aW9uIGZyb21JbnQodmFsdWUsIHVuc2lnbmVkKSB7CiAgICAgICAgdmFyIG9iaiwgY2FjaGVkT2JqLCBjYWNoZTsKICAgICAgICBpZiAodW5zaWduZWQpIHsKICAgICAgICAgIHZhbHVlID4+Pj0gMDsKICAgICAgICAgIGlmIChjYWNoZSA9IDAgPD0gdmFsdWUgJiYgdmFsdWUgPCAyNTYpIHsKICAgICAgICAgICAgY2FjaGVkT2JqID0gVUlOVF9DQUNIRVt2YWx1ZV07CiAgICAgICAgICAgIGlmIChjYWNoZWRPYmopCiAgICAgICAgICAgICAgcmV0dXJuIGNhY2hlZE9iajsKICAgICAgICAgIH0KICAgICAgICAgIG9iaiA9IGZyb21CaXRzKHZhbHVlLCAodmFsdWUgfCAwKSA8IDAgPyAtMSA6IDAsIHRydWUpOwogICAgICAgICAgaWYgKGNhY2hlKQogICAgICAgICAgICBVSU5UX0NBQ0hFW3ZhbHVlXSA9IG9iajsKICAgICAgICAgIHJldHVybiBvYmo7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHZhbHVlIHw9IDA7CiAgICAgICAgICBpZiAoY2FjaGUgPSAtMTI4IDw9IHZhbHVlICYmIHZhbHVlIDwgMTI4KSB7CiAgICAgICAgICAgIGNhY2hlZE9iaiA9IElOVF9DQUNIRVt2YWx1ZV07CiAgICAgICAgICAgIGlmIChjYWNoZWRPYmopCiAgICAgICAgICAgICAgcmV0dXJuIGNhY2hlZE9iajsKICAgICAgICAgIH0KICAgICAgICAgIG9iaiA9IGZyb21CaXRzKHZhbHVlLCB2YWx1ZSA8IDAgPyAtMSA6IDAsIGZhbHNlKTsKICAgICAgICAgIGlmIChjYWNoZSkKICAgICAgICAgICAgSU5UX0NBQ0hFW3ZhbHVlXSA9IG9iajsKICAgICAgICAgIHJldHVybiBvYmo7CiAgICAgICAgfQogICAgICB9CiAgICAgIExvbmc0LmZyb21JbnQgPSBmcm9tSW50OwogICAgICBmdW5jdGlvbiBmcm9tTnVtYmVyKHZhbHVlLCB1bnNpZ25lZCkgewogICAgICAgIGlmIChpc05hTih2YWx1ZSkpCiAgICAgICAgICByZXR1cm4gdW5zaWduZWQgPyBVWkVSTyA6IFpFUk87CiAgICAgICAgaWYgKHVuc2lnbmVkKSB7CiAgICAgICAgICBpZiAodmFsdWUgPCAwKQogICAgICAgICAgICByZXR1cm4gVVpFUk87CiAgICAgICAgICBpZiAodmFsdWUgPj0gVFdPX1BXUl82NF9EQkwpCiAgICAgICAgICAgIHJldHVybiBNQVhfVU5TSUdORURfVkFMVUU7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGlmICh2YWx1ZSA8PSAtVFdPX1BXUl82M19EQkwpCiAgICAgICAgICAgIHJldHVybiBNSU5fVkFMVUU7CiAgICAgICAgICBpZiAodmFsdWUgKyAxID49IFRXT19QV1JfNjNfREJMKQogICAgICAgICAgICByZXR1cm4gTUFYX1ZBTFVFOwogICAgICAgIH0KICAgICAgICBpZiAodmFsdWUgPCAwKQogICAgICAgICAgcmV0dXJuIGZyb21OdW1iZXIoLXZhbHVlLCB1bnNpZ25lZCkubmVnKCk7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHZhbHVlICUgVFdPX1BXUl8zMl9EQkwgfCAwLCB2YWx1ZSAvIFRXT19QV1JfMzJfREJMIHwgMCwgdW5zaWduZWQpOwogICAgICB9CiAgICAgIExvbmc0LmZyb21OdW1iZXIgPSBmcm9tTnVtYmVyOwogICAgICBmdW5jdGlvbiBmcm9tQml0cyhsb3dCaXRzLCBoaWdoQml0cywgdW5zaWduZWQpIHsKICAgICAgICByZXR1cm4gbmV3IExvbmc0KGxvd0JpdHMsIGhpZ2hCaXRzLCB1bnNpZ25lZCk7CiAgICAgIH0KICAgICAgTG9uZzQuZnJvbUJpdHMgPSBmcm9tQml0czsKICAgICAgdmFyIHBvd19kYmwgPSBNYXRoLnBvdzsKICAgICAgZnVuY3Rpb24gZnJvbVN0cmluZyhzdHIsIHVuc2lnbmVkLCByYWRpeCkgewogICAgICAgIGlmIChzdHIubGVuZ3RoID09PSAwKQogICAgICAgICAgdGhyb3cgRXJyb3IoImVtcHR5IHN0cmluZyIpOwogICAgICAgIGlmIChzdHIgPT09ICJOYU4iIHx8IHN0ciA9PT0gIkluZmluaXR5IiB8fCBzdHIgPT09ICIrSW5maW5pdHkiIHx8IHN0ciA9PT0gIi1JbmZpbml0eSIpCiAgICAgICAgICByZXR1cm4gWkVSTzsKICAgICAgICBpZiAodHlwZW9mIHVuc2lnbmVkID09PSAibnVtYmVyIikgewogICAgICAgICAgcmFkaXggPSB1bnNpZ25lZCwgdW5zaWduZWQgPSBmYWxzZTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdW5zaWduZWQgPSAhIXVuc2lnbmVkOwogICAgICAgIH0KICAgICAgICByYWRpeCA9IHJhZGl4IHx8IDEwOwogICAgICAgIGlmIChyYWRpeCA8IDIgfHwgMzYgPCByYWRpeCkKICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoInJhZGl4Iik7CiAgICAgICAgdmFyIHA7CiAgICAgICAgaWYgKChwID0gc3RyLmluZGV4T2YoIi0iKSkgPiAwKQogICAgICAgICAgdGhyb3cgRXJyb3IoImludGVyaW9yIGh5cGhlbiIpOwogICAgICAgIGVsc2UgaWYgKHAgPT09IDApIHsKICAgICAgICAgIHJldHVybiBmcm9tU3RyaW5nKHN0ci5zdWJzdHJpbmcoMSksIHVuc2lnbmVkLCByYWRpeCkubmVnKCk7CiAgICAgICAgfQogICAgICAgIHZhciByYWRpeFRvUG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIDgpKTsKICAgICAgICB2YXIgcmVzdWx0ID0gWkVSTzsKICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkgKz0gOCkgewogICAgICAgICAgdmFyIHNpemUgPSBNYXRoLm1pbig4LCBzdHIubGVuZ3RoIC0gaSksIHZhbHVlID0gcGFyc2VJbnQoc3RyLnN1YnN0cmluZyhpLCBpICsgc2l6ZSksIHJhZGl4KTsKICAgICAgICAgIGlmIChzaXplIDwgOCkgewogICAgICAgICAgICB2YXIgcG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIHNpemUpKTsKICAgICAgICAgICAgcmVzdWx0ID0gcmVzdWx0Lm11bChwb3dlcikuYWRkKGZyb21OdW1iZXIodmFsdWUpKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJlc3VsdCA9IHJ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mN0aW9uIHRvTnVtYmVyMigpIHsKICAgICAgICBpZiAodGhpcy51bnNpZ25lZCkKICAgICAgICAgIHJldHVybiAodGhpcy5oaWdoID4+PiAwKSAqIFRXT19QV1JfMzJfREJMICsgKHRoaXMubG93ID4+PiAwKTsKICAgICAgICByZXR1cm4gdGhpcy5oaWdoICogVFdPX1BXUl8zMl9EQkwgKyAodGhpcy5sb3cgPj4+IDApOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gdG9TdHJpbmcocmFkaXgpIHsKICAgICAgICByYWRpeCA9IHJhZGl4IHx8IDEwOwogICAgICAgIGlmIChyYWRpeCA8IDIgfHwgMzYgPCByYWRpeCkKICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoInJhZGl4Iik7CiAgICAgICAgaWYgKHRoaXMuaXNaZXJvKCkpCiAgICAgICAgICByZXR1cm4gIjAiOwogICAgICAgIGlmICh0aGlzLmlzTmVnYXRpdmUoKSkgewogICAgICAgICAgaWYgKHRoaXMuZXEoTUlOX1ZBTFVFKSkgewogICAgICAgICAgICB2YXIgcmFkaXhMb25nID0gZnJvbU51bWJlcihyYWRpeCksIGRpdiA9IHRoaXMuZGl2KHJhZGl4TG9uZyksIHJlbTEgPSBkaXYubXVsKHJhZGl4TG9uZykuc3ViKHRoaXMpOwogICAgICAgICAgICByZXR1cm4gZGl2LnRvU3RyaW5nKHJhZGl4KSArIHJlbTEudG9JbnQoKS50b1N0cmluZyhyYWRpeCk7CiAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgcmV0dXJuICItIiArIHRoaXMubmVnKCkudG9TdHJpbmcocmFkaXgpOwogICAgICAgIH0KICAgICAgICB2YXIgcmFkaXhUb1Bvd2VyID0gZnJvbU51bWJlcihwb3dfZGJsKHJhZGl4LCA2KSwgdGhpcy51bnNpZ25lZCksIHJlbSA9IHRoaXM7CiAgICAgICAgdmFyIHJlc3VsdCA9ICIiOwogICAgICAgIHdoaWxlICh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gfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5pc0V2ZW4gPSBmdW5jdGlvbiBpc0V2ZW4oKSB7CiAgICAgICAgcmV0dXJuICh0aGlzLmxvdyAmIDEpID09PSAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmVxdWFscyA9IGZ1bmN0aW9uIGVxdWFscyhvdGhlcikgewogICAgICAgIGlmICghaXNMb25nKG90aGVyKSkKICAgICAgICAgIG90aGVyID0gZnJvbVZhbHVlKG90aGVyKTsKICAgICAgICBpZiAodGhpcy51bnNpZ25lZCAhPT0gb3RoZXIudW5zaWduZWQgJiYgdGhpcy5oaWdoID4+PiAzMSA9PT0gMSAmJiBvdGhlci5oaWdoID4+PiAzMSA9PT0gMSkKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICByZXR1cm4gdGhpcy5oaWdoID09PSBvdGhlci5oaWdoICYmIHRoaXMubG93ID09PSBvdGhlci5sb3c7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZXEgPSBMb25nUHJvdG90eXBlLmVxdWFsczsKICAgICAgTG9uZ1Byb3RvdHlwZS5ub3RFcXVhbHMgPSBmdW5jdGlvbiBub3RFcXVhbHMob3RoZXIpIHsKICAgICAgICByZXR1cm4gIXRoaXMuZXEob3RoZXIpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLm5lcSA9IExvbmdQcm90b3R5cGUubm90RXF1YWxzOwogICAgICBMb25nUHJvdG90eXBlLm5lID0gTG9uZ1Byb3RvdHlwZS5ub3RFcXVhbHM7CiAgICAgIExvbmdQcm90b3R5cGUubGVzc1RoYW4gPSBmdW5jdGlvbiBsZXNzVGhhbihvdGhlcikgewogICAgICAgIHJldHVybiB0aGlzLmNvbXAob3RoZXIpIDwgMDsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5sdCA9IExvbmdQcm90b3R5cGUubGVzc1RoYW47CiAgICAgIExvbmdQcm90b3R5cGUubGVzc1RoYW5PckVxdWFs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1Byb3RvdHlwZS5tdWx0aXBseSA9IGZ1bmN0aW9uIG11bHRpcGx5KG11bHRpcGxpZXIpIHsKICAgICAgICBpZiAodGhpcy5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiBaRVJPOwogICAgICAgIGlmICghaXNMb25nKG11bHRpcGxpZXIpKQogICAgICAgICAgbXVsdGlwbGllciA9IGZyb21WYWx1ZShtdWx0aXBsaWVyKTsKICAgICAgICBpZiAod2FzbSkgewogICAgICAgICAgdmFyIGxvdyA9IHdhc20ubXVsKHRoaXMubG93LCB0aGlzLmhpZ2gsIG11bHRpcGxpZXIubG93LCBtdWx0aXBsaWVyLmhpZ2gpOwogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKGxvdywgd2FzbS5nZXRfaGlnaCgpLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICB9CiAgICAgICAgaWYgKG11bHRpcGxpZXIuaXNaZXJvKCkpCiAgICAgICAgICByZXR1cm4gWkVSTzsKICAgICAgICBpZiAodGhpcy5lcShNSU5fVkFMVUUpKQogICAgICAgICAgcmV0dXJuIG11bHRpcGxpZXIuaXNPZGQoKSA/IE1JTl9WQUxVRSA6IFpFUk87CiAgICAgICAgaWYgKG11bHRpcGxpZXIuZXEoTUlOX1ZBTFVFKSkKICAgICAgICAgIHJldHVybiB0aGlzLmlzT2RkKCkgPyBNSU5fVkFMVUUgOiBaRVJPOwogICAgICAgIGlmICh0aGlzLmlzTmVnYXRpdmUoKSkgewogICAgICAgICAgaWYgKG11bHRpcGxpZXIuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgICByZXR1cm4gdGhpcy5uZWcoKS5tdWwobXVsdGlwbGllci5uZWcoKSk7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiB0aGlzLm5lZygpLm11bChtdWx0aXBsaWVyKS5uZWcoKTsKICAgICAgICB9IGVsc2UgaWYgKG11bHRpcGxpZXIuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgcmV0dXJuIHRoa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LmhpZ2gpOwogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKGxvdywgd2FzbS5nZXRfaGlnaCgpLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICB9CiAgICAgICAgaWYgKHRoaXMuaXNaZXJvKCkpCiAgICAgICAgICByZXR1cm4gdGhpcy51bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICB2YXIgYXBwcm94LCByZW0sIHJlczsKICAgICAgICBpZiAoIXRoaXMudW5zaWduZWQpIHsKICAgICAgICAgIGlmICh0aGlzLmVxKE1JTl9WQUxVRSkpIHsKICAgICAgICAgICAgaWYgKGRpdmlzb3IuZXEoT05FKSB8fCBkaXZpc29yLmVxKE5FR19PTkUpKQogICAgICAgICAgICAgIHJldHVybiBNSU5fVkFMVUU7CiAgICAgICAgICAgIGVsc2UgaWYgKGRpdmlzb3IuZXEoTUlOX1ZBTFVFKSkKICAgICAgICAgICAgICByZXR1cm4gT05FOwogICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICB2YXIgaGFsZlRoaXMgPSB0aGlzLnNocigxKTsKICAgICAgICAgICAgICBhcHByb3ggPSBoYWxmVGhpcy5kaXYoZGl2aXNvcikuc2hsKDEpOwogICAgICAgICAgICAgIGlmIChhcHByb3guZXEoWkVSTykpIHsKICAgICAgICAgICAgICAgIHJldHVybiBkaXZpc29yLmlzTmVnYXRpdmUoKSA/IE9ORSA6IE5FR19PTkU7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJlbSA9IHRoaXMuc3ViKGRpdmlzb3IubXVsKGFwcHJveCkpOwogICAgICAgICAgICAgICAgcmVzID0gYXBwcm94LmFkZChyZW0uZGl2KGRpdmlzb3IpKTsKICAgICAgICAgICAgICAgIHJldHVybiByZXM7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgaWYgKGRpdmlzb3IuZXEoTUlOX1ZBTFVFKSkKICAgICAgICAgICAgcmV0dXJuIHRoaXMudW5zaWduZWQgPyBVWkVSTyA6IFpFUk87CiAgICAgICAgICBpZiAodGhpcy5pc05lZ2F0aXZlKCkpIHsKICAgICAgICAgICAgaWYgKGRpdmlzb3IuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgICAgIHJldHVybiB0aGlzLm5lZygpLmRpdihkaXZpc29yLm5lZygpKTsKICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkuZGl2KGRpdmlzb3IpLm5lZygpOwogICAgICAgICAgfSBlbHNlIGlmIChkaXZpc29yLmlzTmVnYXRpdmUoKSkKICAgICAgICAgICAgcmV0dXJuIHRoaXMuZGl2KGRpdmlzb3IubmVnKCkpLm5lZygpOwogICAgICAgICAgcmVzID0gWkVSTzsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKCFkaXZpc29yLnVuc2lnbmVkKQogICAgICAgICAgICBkaXZpc29yID0gZGl2aXNvci50b1Vuc2lnbmVkKCk7CiAgICAgICAgICBpZiAoZGl2aXNvci5ndCh0aGlzKSkKICAgICAgICAgICAgcmV0dXJuIFVaRVJPOwogICAgICAgICAgaWYgKGRpdmlzb3IuZ3QodGhpcy5zaHJ1KDEpKSkKICAgICAgICAgICAgcmV0dXJuIFVPTkU7CiAgICAgICAgICByZXMgPSBVWkVSTzsKICAgICAgICB9CiAgICAgICAgcmVtID0gdGhpczsKICAgICAgICB3aGlsZSAocmVtLmd0ZShkaXZpc29yKSkgewogICAgICAgICAgYXBwcm94ID0gTWF0aC5tYXgoMSwgTWF0aC5mbG9vcihyZW0udG9OdW1iZXIoKSAvIGRpdmlzb3IudG9OdW1iZXIoKSkpOwogICAgICAgICAgdmFyIGxvZzIgPSBNYXRoLmNlaWwoTWF0aC5sb2coYXBwcm94KSAvIE1hdGguTE4yKSwgZGVsdGEgPSBsb2cyIDw9IDQ4ID8gMSA6IHBvd19kYmwoMiwgbG9nMiAtIDQ4KSwgYXBwcm94UmVzID0gZnJvbU51bWJlcihhcHByb3gpLCBhcHByb3hSZW0gPSBhcHByb3hSZXMubXVsKGRpdmlzb3IpOwogICAgICAgICAgd2hpbGUgKGFwcHJveFJlbS5pc05lZ2F0aXZlKCkgfHwgYXBwcm94UmVtLmd0KHJlbSkpIHsKICAgICAgICAgICAgYXBwcm94IC09IGRlbHRhOwogICAgICAgICAgICBhcHByb3hSZXMgPSBmcm9tTnVtYmVyKGFwcHJveCwgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgICAgIGFwcHJveFJlbSA9IGFwcHJveFJlcy5tdWwoZGl2aXNvcik7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYXBwcm94UmVzLmlzWmVybygpKQogICAgICAgICAgICBhcHByb3hSZXMgPSBPTkU7CiAgICAgICAgICByZXMgPSByZXMuYWRkKGFwcHJveFJlcyk7CiAgICAgICAgICByZW0gPSByZW0uc3ViKGFwcHJveFJlbSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZGl2ID0gTG9uZ1Byb3RvdHlwZS5kaXZpZGU7CiAgICAgIExvbmdQcm90b3R5cGUubW9kdWxvID0gZnVuY3Rpb24gbW9kdWxvKGRpdmlzb3IpIHsKICAgICAgICBpZiAoIWlzTG9uZyhkaXZpc29yKSkKICAgICAgICAgIGRpdmlzb3IgPSBmcm9tVmFsdWUoZGl2aXNvcik7CiAgICAgICAgaWYgKHdhc20pIHsKICAgICAgICAgIHZhciBsb3cgPSAodGhpcy51bnNpZ25lZCA/IHdhc20ucmVtX3UgOiB3YXNtLnJlbV9zKSh0aGlzLmxvdywgdGhpcy5oaWdoLCBkaXZpc29yLmxvdywgZGl2aXNvci5oaWdoKTsKICAgICAgICAgIHJldHVybiBmcm9tQml0cyhsb3csIHdhc20uZ2V0X2hpZ2goKSwgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0aGlzLnN1Yih0aGlzLmRpdihkaXZpc29yKS5tdWwoZGl2aXNvcik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gICAgIExvbmdQcm90b3R5cGUuc2hpZnRMZWZ0ID0gZnVuY3Rpb24gc2hpZnRMZWZ0KG51bUJpdHMpIHsKICAgICAgICBpZiAoaXNMb25nKG51bUJpdHMpKQogICAgICAgICAgbnVtQml0cyA9IG51bUJpdHMudG9JbnQoKTsKICAgICAgICBpZiAoKG51bUJpdHMgJj0gNjMpID09PSAwKQogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgZWxzZSBpZiAobnVtQml0cyA8IDMyKQogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IDw8IG51bUJpdHMsIHRoaXMuaGlnaCA8PCBudW1CaXRzIHwgdGhpcy5sb3cgPj4+IDMyIC0gbnVtQml0cywgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgZWxzZQogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKDAsIHRoaXMubG93IDw8IG51bUJpdHMgLSAzMiwgdGhpcy51bnNpZ25lZCk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuc2hsID0gTG9uZ1Byb3RvdHlwZS5zaGlmdExlZnQ7CiAgICAgIExvbmdQcm90b3R5cGUuc2hpZnRSaWdodCA9IGZ1bmN0aW9uIHNoaWZ0UmlnaHQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIGlmICgobnVtQml0cyAmPSA2MykgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNlIGlmIChudW1CaXRzIDwgMzIpCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgPj4+IG51bUJpdHMgfCB0aGlzLmhpZ2ggPDwgMzIgLSBudW1CaXRzLCB0aGlzLmhpZ2ggPj4gbnVtQml0cywgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgZWxzZQogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMuaGlnaCA+PiBudW1CaXRzIC0gMzIsIHRoaXMuaGlnaCA+PSAwID8gMCA6IC0xLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaHIgPSBMb25nUHJvdG90eXBlLnNoaWZ0UmlnaHQ7CiAgICAgIExvbmdQcm90b3R5cGUuc2hpZnRSaWdodFVuc2lnbmVkID0gZnVuY3Rpb24gc2hpZnRSaWdodFVuc2lnbmVkKG51bUJpdHMpIHsKICAgICAgICBpZiAoaXNMb25nKG51bUJpdHMpKQogICAgICAgICAgbnVtQml0cyA9IG51bUJpdHMudG9JbnQoKTsKICAgICAgICBudW1CaXRzICY9IDYzOwogICAgICAgIGlmIChudW1CaXRzID09PSAwKQogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgZWxzZSB7CiAgICAgICAgICB2YXIgaGlnaCA9IHRoaXMuaGlnaDsKICAgICAgICAgIGlmIChudW1CaXRzIDwgMzIpIHsKICAgICAgICAgICAgdmFyIGxvdyA9IHRoaXMubG93OwogICAgICAgICAgICByZXR1cm4gZnJvbUJpdHMobG93ID4+PiBudW1CaXRzIHwgaGlnaCA8PCAzMiAtIG51bUJpdHMsIGhpZ2ggPj4+IG51bUJpdHMsIHRoaXMudW5zaWduZWQpOwogICAgICAgICAgfSBlbHNlIGlmIChudW1CaXRzID09PSAzMikKICAgICAgICAgICAgcmV0dXJuIGZyb21CaXRzKGhpZ2gsIDAsIHRoaXMudW5zaWduZWQpOwogICAgICAgICAgZWxzZQogICAgICAgICAgICByZXR1cm4gZnJvbUJpdHMoaGlnaCA+Pj4gbnVtQml0cyAtIDMyLCAwLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuc2hydSA9IExvbmdQcm90b3R5cGUuc2hpZnRSaWdodFVuc2lnbmVkOwogICAgICBMb25nUHJvdG90eXBlLnNocl91ID0gTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0VW5zaWduZWQ7CiAgICAgIExvbmdQcm90b3R5cGUudG9TaWduZWQgPSBmdW5jdGlvbiB0b1NpZ25lZCgpIHsKICAgICAgICBpZiAoIXRoaXMudW5zaWduZWQpCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3csIHRoaXMuaGlnaCwgZmFsc2UpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLnRvVW5zaWduZWQgPSBmdW5jdGlvbiB0b1Vuc2lnbmVkKCkgewogICAgICAgIGlmICh0aGlzLnVuc2lnbmVkKQogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93LCB0aGlzLmhpZ2gsIHRydWUpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLnRvQnl0ZXMgPSBmdW5jdGlvbiB0b0J5dGVzKGxlKSB7CiAgICAgICAgcmV0dXJuIGxlID8gdGhpcy50b0J5dGVzTEUoKSA6IHRoaXMudG9CeXRlc0JFKCk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9CeXRlc0xFID0gZnVuY3Rpb24gdG9CeXRlc0xFKCkgewogICAgICAgIHZhciBoaSA9IHRoaXMuaGlnaCwgbG8gPSB0aGlzLmxvdzsKICAgICAgICByZXR1cm4gWwogICAgICAgICAgbG8gJiAyNTUsCiAgICAgICAgICBsbyA+Pj4gOCAmIDI1NSwKICAgICAgICAgIGxvID4+PiAxNiAmIDI1NSwKICAgICAgICAgIGxvID4+PiAyNCwKICAgICAgICAgIGhpICYgMjU1LAogICAgICAgICAgaGkgPj4+IDggJiAyNTUsCiAgICAgICAgICBoaSA+Pj4gMTYgJiAyNTUsCiAgICAgICAgICBoaSA+Pj4gMjQKICAgICAgICBdOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLnRvQnl0ZXNCRSA9IGZ1bmN0aW9uIHRvQnl0ZXNCRSgpIHsK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ICAgICBleHBvcnRzMi5leHRlbmRTZXJpYWxpemVyID0gZXh0ZW5kU2VyaWFsaXplcjsKICAgICAgdmFyIERlZmF1bHRFcnJvclNlcmlhbGl6ZXIgPSB7CiAgICAgICAgZGVzZXJpYWxpemUobWVzc2FnZSkgewogICAgICAgICAgcmV0dXJuIE9iamVjdC5hc3NpZ24oRXJyb3IobWVzc2FnZS5tZXNzYWdlKSwgewogICAgICAgICAgICBuYW1lOiBtZXNzYWdlLm5hbWUsCiAgICAgICAgICAgIHN0YWNrOiBtZXNzYWdlLnN0YWNrCiAgICAgICAgICB9KTsKICAgICAgICB9LAogICAgICAgIHNlcmlhbGl6ZShlcnJvcikgewogICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgX19lcnJvcl9tYXJrZXI6ICIkJGVycm9yIiwKICAgICAgICAgICAgbWVzc2FnZTogZXJyb3IubWVzc2FnZSwKICAgICAgICAgICAgbmFtZTogZXJyb3IubmFtZSwKICAgICAgICAgICAgc3RhY2s6IGVycm9yLnN0YWNrCiAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgfTsKICAgICAgdmFyIGlzU2VyaWFsaXplZEVycm9yID0gKHRoaW5nKSA9PiB0aGluZyAmJiB0eXBlb2YgdGhpbmcgPT09ICJvYmplY3QiICYmICJfX2Vycm9yX21hcmtlciIgaW4gdGhpbmcgJiYgdGhpbmcuX19lcnJvcl9tYXJrZXIgPT09ICIkJGVycm9yIjsKICAgICAgZXhwb3J0czIuRGVmYXVsdFNlcmlhbGl6ZXIgPSB7CiAgICAgICAgZGVzZXJpYWxpemUobWVzc2FnZSkgewogICAgICAgICAgaWYgKGlzU2VyaWFsaXplZEVycm9yKG1lc3NhZ2UpKSB7CiAgICAgICAgICAgIHJldHVybiBEZWZhdWx0RXJyb3JTZXJpYWxpemVyLmRlc2VyaWFsaXplKG1lc3NhZ2UpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIG1lc3NhZ2U7CiAgICAgICAgIC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9mIHRoaW5nICE9PSAib2JqZWN0IikKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpc1RyYW5zZmVyRGVzY3JpcHRvcih0aGluZykgewogICAgICAgIHJldHVybiB0aGluZyAmJiB0eXBlb2YgdGhpbmcgPT09ICJvYmplY3QiICYmIHRoaW5nW3N5bWJvbHNfMS4kdHJhbnNmZXJhYmxlXTsKICAgICAgfQogICAgICBleHBvcnRzMi5pc1RyYW5zZmVyRGVzY3JpcHRvciA9IGlzVHJhbnNmZXJEZXNjcmlwdG9yOwogICAgICBmdW5jdGlvbiBUcmFuc2ZlcjIocGF5bG9hZCwgdHJhbnNmZXJhYmxlcykgewogICAgICAgIGlmICghdHJhbnNmZXJhYmxlcykgewogICAgICAgICAgaWYgKCFpc1RyYW5zZmVyYWJsZShwYXlsb2FkKSkKICAgICAgICAgICAgdGhyb3cgRXJyb3IoKTsKICAgICAgICAgIHRyYW5zZmVyYWJsZXMgPSBbcGF5bG9hZF07CiAgICAgICAgfQogICAgICAgIHJldHVybiB7CiAgICAgICAgICBbc3ltYm9sc18xLiR0cmFuc2ZlcmFibGVdOiB0cnVlLAogICAgICAgICAgc2VuZDogcGF5bG9hZCwKICAgICAgICAgIHRyYW5zZmVyYWJsZXMKICAgICAgICB9OwogICAgICB9CiAgICAgIGV4cG9ydHMyLlRyYW5zZmVyID0gVHJhbnNmZXIyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vdGhyZWFkc0AxLjcuMC9ub2RlX21vZHVsZXMvdGhyZWFkcy9kaXN0L3R5cGVzL21lc3NhZ2VzLmpzCiAgdmFyIHJlcXVpcmVfbWVzc2FnZXMyID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3RocmVhZHNAMS43LjAvbm9kZV9tb2R1bGVzL3RocmVhZHMvZGlzdC90eXBlcy9tZXNzYWdlcy5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NlIHN0cmljdCI7CiAgICAgIHZhciBfX2F3YWl0ZXIgPSBleHBvcnRzMiAmJiBleHBvcnRzMi5fX2F3YWl0ZXIgfHwgZnVuY3Rpb24odGhpc0FyZywgX2FyZ3VtZW50cywgUCwgZ2VuZXJhdG9yKSB7CiAgICAgICAgZnVuY3Rpb24gYWRvcHQodmFsdWUpIHsKICAgICAgICAgIHJldHVybiB2YWx1ZSBpbnN0YW5jZW9mIFAgPyB2YWx1ZSA6IG5ldyBQKGZ1bmN0aW9uKHJlc29sdmUpIHsKICAgICAgICAgICAgcmVzb2x2ZSh2YWx1ZSk7CiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgIGZ1bmN0aW9uIGZ1bGZpbGxlZCh2YWx1ZSkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgIHN0ZXAoZ2VuZXJhdG9yLm5leHQodmFsdWUpKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgIHJlamVjdChlKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gcmVqZWN0ZWQodmFsdWUpIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgcmVqZWN0KGUpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgewogICAgICAgICAgICByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsKICAgICAgICAgIH0KICAgICAgICAgIHN0ZXAo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B1dCwgaW5pdDIpOwogICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgaWYgKGAke2V9YC5pbmNsdWRlcygiRmFpbGVkIHRvIGZldGNoIikpIHsKICAgICAgICAgIGNvbnNvbGUud2FybihgZ2VuZXJpYy1maWxlaGFuZGxlOiByZWZldGNoaW5nICR7aW5wdXR9IHRvIGF0dGVtcHQgdG8gd29yayBhcm91bmQgY2hyb21lIENPUlMgaGVhZGVyIGNhY2hpbmcgYnVnYCk7CiAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IHRoaXMuZmV0Y2hJbXBsZW1lbnRhdGlvbihpbnB1dCwgewogICAgICAgICAgICAuLi5pbml0MiwKICAgICAgICAgICAgY2FjaGU6ICJyZWxvYWQiCiAgICAgICAgICB9KTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdGhyb3cgZTsKICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIHJlc3BvbnNlOwogICAgfQogICAgYXN5bmMgcmVhZChidWZmZXIsIG9mZnNldCA9IDAsIGxlbmd0aCwgcG9zaXRpb24gPSAwLCBvcHRzID0ge30pIHsKICAgICAgY29uc3QgeyBoZWFkZXJzID0ge30sIHNpZ25hbCwgb3ZlcnJpZGVzID0ge30gfSA9IG9wdHM7CiAgICAgIGlmIChsZW5ndGggPCBJbmZpbml0eSkgewogICAgICAgIGhlYWRlcnMucmFuZ2UgPSBgYnl0ZXM9JHtwb3NpdGlvbn0tJHtwb3NpdGlvbiArIGxlbmd0aH1gOwogICAgICB9IGVsc2UgaWYgKGxlbmd0aCA9PT0gSW5maW5pdHkgJiYgcG9zaXRpb24gIT09IDApIHsKICAgICAgICBoZWFkZXJzLnJhbmdlID0gYGJ5dGVzPSR7cG9zaXRpb259LWA7CiAgICAgIH0KICAgICAgY29uc3QgYXJncyA9IHsKICAgICAgICAuLi50aGlzLmJhc2VPdmVycmlkZXMsCiAgICAgICAgLi4ub3ZlcnJpZGVzLAogICAgICAgIGhlYWRlcnM6IHsKIC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1hdGNoWzFdLCAxMCkgfTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHsgYnl0ZXNSZWFkOiBieXRlc0NvcGllZCwgYnVmZmVyIH07CiAgICAgIH0KICAgICAgaWYgKHJlc3BvbnNlLnN0YXR1cyA9PT0gMjAwKSB7CiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCIke3RoaXMudXJsfSBmZXRjaCByZXR1cm5lZCBzdGF0dXMgMjAwLCBleHBlY3RlZCAyMDYiKTsKICAgICAgfQogICAgICB0aHJvdyBuZXcgRXJyb3IoYEhUVFAgJHtyZXNwb25zZS5zdGF0dXN9IGZldGNoaW5nICR7dGhpcy51cmx9YCk7CiAgICB9CiAgICBhc3luYyByZWFkRmlsZShvcHRpb25zID0ge30pIHsKICAgICAgbGV0IGVuY29kaW5nOwogICAgICBsZXQgb3B0czsKICAgICAgaWYgKHR5cGVvZiBvcHRpb25zID09PSAic3RyaW5nIikgewogICAgICAgIGVuY29kaW5nID0gb3B0aW9uczsKICAgICAgICBvcHRzID0ge307CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZW5jb2RpbmcgPSBvcHRpb25zLmVuY29kaW5nOwogICAgICAgIG9wdHMgPSBvcHRpb25zOwogICAgICAgIGRlbGV0ZSBvcHRzLmVuY29kaW5nOwogICAgICB9CiAgICAgIGNvbnN0IHsgaGVhZGVycyA9IHt9LCBzaWduYWwsIG92ZXJyaWRlcyA9IHt9IH0gPSBvcHRzOwogICAgICBjb25zdCBhcmdzID0gewogICAgICAgIGhlYWRlcnMsCiAgICAgICAgbWV0aG9kOiAiR0VUIiwKICAgICAgICByZWRpcmVjdDogImZvbGxvdyIsCiAgICAgICAgbW9kZTogImNvcnMiLAogICAgICAgIHNpZ25hbCwKICAgICAgICAuLi50aGlzLmJhc2VPdmVycmlkZXMsCiAgICAgICAgLi4ub3ZlcnJpZGVzCiAgICAgIH07CiAgICAgIGNvbnN0IHJlc3BvbnNlID0gYXdhaXQgdGhpcy5mZXRjaCh0aGl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d2VzdCkgewogICAgY29uc3QgbWVyZ2VkQ2h1bmtzID0gW107CiAgICBsZXQgbGFzdENodW5rID0gbnVsbDsKICAgIGlmIChjaHVua3MubGVuZ3RoID09PSAwKSB7CiAgICAgIHJldHVybiBjaHVua3M7CiAgICB9CiAgICBjaHVua3Muc29ydChmdW5jdGlvbihjMCwgYzEpIHsKICAgICAgY29uc3QgZGlmID0gYzAubWludi5ibG9ja1Bvc2l0aW9uIC0gYzEubWludi5ibG9ja1Bvc2l0aW9uOwogICAgICBpZiAoZGlmICE9PSAwKSB7CiAgICAgICAgcmV0dXJuIGRpZjsKICAgICAgfSBlbHNlIHsKICAgICAgICByZXR1cm4gYzAubWludi5kYXRhUG9zaXRpb24gLSBjMS5taW52LmRhdGFQb3NpdGlvbjsKICAgICAgfQogICAgfSk7CiAgICBjaHVua3MuZm9yRWFjaCgoY2h1bmspID0+IHsKICAgICAgaWYgKCFsb3dlc3QgfHwgY2h1bmsubWF4di5jb21wYXJlVG8obG93ZXN0KSA+IDApIHsKICAgICAgICBpZiAobGFzdENodW5rID09PSBudWxsKSB7CiAgICAgICAgICBtZXJnZWRDaHVua3MucHVzaChjaHVuayk7CiAgICAgICAgICBsYXN0Q2h1bmsgPSBjaHVuazsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKGNhbk1lcmdlQmxvY2tzKGxhc3RDaHVuaywgY2h1bmspKSB7CiAgICAgICAgICAgIGlmIChjaHVuay5tYXh2LmNvbXBhcmVUbyhsYXN0Q2h1bmsubWF4dikgPiAwKSB7CiAgICAgICAgICAgICAgbGFzdENodW5rLm1heHYgPSBjaHVuay5tYXh2OwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBtZXJnZWRDaHVua3MucHVzaChjaHVuayk7CiAgICAgICAgICAgIGxhc3RDaHVuayA9IGNodW5rOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgfSk7CiAgICByZXR1cm4gbWVyZ2VkQ2h1bm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YmluID09PSBtYXhCaW5OdW1iZXIgKyAxKSB7CiAgICAgICAgICAgIGNvbnN0IGNodW5rQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgICAgICBpZiAoY2h1bmtDb3VudCA9PT0gMikgewogICAgICAgICAgICAgIHN0YXRzID0gdGhpcy5wYXJzZVBzZXVkb0JpbihieXRlcywgY3Vyck9mZnNldCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNiAqIGNodW5rQ291bnQ7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjb25zdCBjaHVua0NvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCk7CiAgICAgICAgICAgIGN1cnJPZmZzZXQgKz0gNDsKICAgICAgICAgICAgY29uc3QgY2h1bmtzID0gbmV3IEFycmF5KGNodW5rQ291bnQpOwogICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGNodW5rQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgICAgIGNvbnN0IHUgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQpOwogICAgICAgICAgICAgIGNvbnN0IHYgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQgKyA4KTsKICAgICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDE2OwogICAgICAgICAgICAgIGZpcnN0RGF0YUxpbmUgPSB0aGlzLl9maW5kRmlyc3REYXRhKGZpcnN0RGF0YUxpbmUsIHUpOwogICAgICAgICAgICAgIGNodW5rc1trXSA9IG5ldyBDaHVuayh1LCB2LCBiaW4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGJpbkluZGV4W2Jpbl0gPSBjaHVua3M7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNvbnN0IGxpbmVhckNvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCk7CiAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgIGNvbnN0IGxpbmVhckluZGV4ID0gbmV3IEFycmF5KGxpbmVhckNvdW50KTsKICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGxpbmVhckNvdW50OyBrICs9IDEpIHsKICAgICAgICAgIGxpbmVhckluZGV4W2tdID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0KTsKICAgICAgICAgIGN1cnJPZmZzZXQgKz0gODsKICAgICAgICAgIGZpcnN0RGF0YUxpbmUgPSB0aGlzLl9maW5kRmlyc3REYXRhKGZpcnN0RGF0YUxpbmUsIGxpbmVhckluZGV4W2tdKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHsgYmluSW5kZXgsIGxpbmVhckluZGV4LCBzdGF0cyB9OwogICAgICB9KTsKICAgICAgcmV0dXJuIHsKICAgICAgICBpbmRpY2VzLAogICAgICAgIG1ldGFDaGFyLAogICAgICAgIG1heEJpbk51bWJlciwKICAgICAgICBtYXhSZWZMZW5ndGgsCiAgICAgICAgc2tpcExpbmVzLAogICAgICAgIGZpcnN0RGF0YUxpbmUsCiAgICAgICAgY29sdW1uTnVtYmVycywKICAgICAgICBjb29yZGluYXRlVHlwZSwKICAgICAgICBmb3JtYXQsCiAgICAgICAgcmVmSWRUb05hbWUsCiAgICAgICAgcmVmTmFtZVRvSWQsCiAgICAgICAgbWF4QmxvY2tTaXplOiAxIDw8IDE2CiAgICAgIH07CiAgICB9CiAgICBwYXJzZVBzZXVkb0JpbihieXRlcywgb2Zmc2V0KSB7CiAgICAgIGNvbnN0IGxpbmVDb3VudCA9IGxvbmdUb051bWJlcihpbXBvcnRfbG9uZzIuZGVmYXVsdC5mcm9tQnl0ZXNMRShieXRlcy5zbGljZShvZmZzZXQgKyAxNiwgb2Zmc2V0ICsgMjQpLCB0cnVlKSk7CiAgICAgIHJldHVybiB7IGxpbmVDb3VudCB9OwogICAgfQogICA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RleERhdGEucmVmTmFtZVRvSWRbcmVmTmFtZV07CiAgICAgIGNvbnN0IGJhID0gaW5kZXhEYXRhLmluZGljZXNbcmVmSWRdOwogICAgICBpZiAoIWJhKSB7CiAgICAgICAgcmV0dXJuIFtdOwogICAgICB9CiAgICAgIGNvbnN0IG1pbk9mZnNldCA9IGJhLmxpbmVhckluZGV4Lmxlbmd0aCA/IGJhLmxpbmVhckluZGV4W21pbiA+PiBUQURfTElEWF9TSElGVCA+PSBiYS5saW5lYXJJbmRleC5sZW5ndGggPyBiYS5saW5lYXJJbmRleC5sZW5ndGggLSAxIDogbWluID4+IFRBRF9MSURYX1NISUZUXSA6IG5ldyBWaXJ0dWFsT2Zmc2V0KDAsIDApOwogICAgICBpZiAoIW1pbk9mZnNldCkgewogICAgICAgIGNvbnNvbGUud2FybigicXVlcnlpbmcgb3V0c2lkZSBvZiBwb3NzaWJsZSB0YWJpeCByYW5nZSIpOwogICAgICB9CiAgICAgIGNvbnN0IG92ZXJsYXBwaW5nQmlucyA9IHJlZzJiaW5zKG1pbiwgbWF4KTsKICAgICAgY29uc3QgY2h1bmtzID0gW107CiAgICAgIGZvciAoY29uc3QgW3N0YXJ0LCBlbmRdIG9mIG92ZXJsYXBwaW5nQmlucykgewogICAgICAgIGZvciAobGV0IGJpbiA9IHN0YXJ0OyBiaW4gPD0gZW5kOyBiaW4rKykgewogICAgICAgICAgaWYgKGJhLmJpbkluZGV4W2Jpbl0pIHsKICAgICAgICAgICAgY29uc3QgYmluQ2h1bmtzID0gYmEuYmluSW5kZXhbYmluXTsKICAgICAgICAgICAgZm9yIChsZXQgYyA9IDA7IGMgPCBiaW5DaHVua3MubGVuZ3RoOyArK2MpIHsKICAgICAgICAgICAgICBjaHVua3MucHVzaChuZXcgQ2h1bmsoYmluQ2h1bmtzW2NdLm1pbnYsIGJpbkNodW5rc1tjXS5tYXh2LCBiaW4pKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBjb25zdCBuaW50diA9IGJhLmxpbmVhckluZGV4Lmxlbmd0aDsKICAgICAgbGV0IGxvd2VzdCA9IG51bGw7CiAgICAgIGNvbnN0IG1pbkxpbiA9IE1hdGgubWluKG1pbiA+PiAxNCwgbmludHYgLSAxKTsKICAgICAgY29uc3QgbWF4TGluID0gTWF0aC5taW4obWF4ID4+IDE0LCBuaW50diAtIDEpOwogICAgICBmb3IgKGxldCBpID0gbWluTGluOyBpIDw9IG1heExpbjsgKytpKSB7CiAgICAgICAgY29uc3QgdnAgPSBiYS5saW5lYXJJbmRleFtpXTsKICAgICAgICBpZiAodnApIHsKICAgICAgICAgIGlmICghbG93ZXN0IHx8IHZwLmNvbXBhcmVUbyhsb3dlc3QpIDwgMCkgewogICAgICAgICAgICBsb3dlc3QgPSB2cDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIG9wdGltaXplQ2h1bmtzKGNodW5rcywgbG93ZXN0KTsKICAgIH0KICB9OwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vQGdtb2QrdGFiaXhAMS41LjExL25vZGVfbW9kdWxlcy9AZ21vZC90YWJpeC9lc20vY3NpLmpzCiAgaW5pdF9idWZmZXJfc2hpbSgpOwogIHZhciBpbXBvcnRfbG9uZzMgPSBfX3RvTW9kdWxlKHJlcXVpcmVfbG9uZygpKTsKICB2YXIgQ1NJMV9NQUdJQyA9IDIxNTgyNjU5OwogIHZhciBDU0kyX01BR0lDID0gMzgzNTk4NzU7CiAgZnVuY3Rpb24gbHNoaWZ0KG51bSwgYml0cykgewogICAgcmV0dXJuIG51bSAqIDIgKiogYml0czsKICB9CiAgZnVuY3Rpb24gcnNoaWZ0KG51bSwgYml0cykgewogICAgcmV0dXJuIE1hdGguZmxvb3IobnVtIC8gMiAqKiBiaXRzKTsKICB9CiAgdmFyIENTSSA9IGNsYXNzIGV4dGVuZHMgSW5kZXhGaWxlIHsKICAgIGNvbnN0cnVjdG9yKGFyZ3MpIHsKICAgICAgc3VwZXIoYXJncyk7CiAgICAgIHRoaXMubWF4QmluTnVtYmVyID0gMDsKICAgICAgdGhpcy5kZXB0aCA9IDA7CiAgICAgIHRoaXMubWluU2hpZnQgPSAwOwogICAgfQogICAgYXN5bmMgbGluZUNvdW50KHJlZk5hbWUsIG9wdHMgPSB7fSkgewogICAgICBjb25zdCBpbmRleERhdGEgPSBhd2FpdCB0aGlzLnBhcnNlKG9wdHMpOwogICAgICBpZiAoIWluZGV4RGF0YSkgewogICAgICAgIHJldHVybiAtMTsKICAgICAgfQogICAgICBjb25zdCByZWZJZCA9IGluZGV4RGF0YS5yZWZOYW1lVG9JZFtyZWZOYW1lXTsKICAgICAgY29uc3QgaWR4ID0gaW5kZXhEYXRhLmluZGljZXNbcmVmSWRdOwogICAgICBpZiAoIWlkeCkgewogICAgICAgIHJldHVybiAtMTsKICAgICAgfQogICAgICBjb25zdCB7IHN0YXRzIH0gPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmIChzdGF0cykgewogICAgICAgIHJldHVybiBzdGF0cy5saW5lQ291bnQ7CiAgICAgIH0KICAgICAgcmV0dXJuIC0xOwogICAgfQogICAgYXN5bmMgaW5kZXhDb3YoKSB7CiAgICAgIHRocm93IG5ldyBFcnJvcigiQ1NJIGluZGV4ZXMgZG8gbm90IHN1cHBvcnQgaW5kZXhjb3YiKTsKICAgIH0KICAgIHBhcnNlQXV4RGF0YShieXRlcywgb2Zmc2V0KSB7CiAgICAgIGNvbnN0IGZvcm1hdEZsYWdzID0gYnl0ZXMucmVhZEludDMyTEUob2Zmc2V0KTsKICAgICAgY29uc3QgY29vcmRpbmF0ZVR5cGUgPSBmb3JtYXRGbGFncyAmIDY1NTM2ID8gInplcm8tYmFzZWQtaGFsZi1vcGVuIiA6ICIxLWJhc2VkLWNsb3NlZCI7CiAgICAgIGNvbnN0IGZvcm1hdCA9IHsgMDogImdlbmVyaWMiLCAxOiAiU0FNIiwgMjogIlZDRiIgfVtmb3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ZXcgQXJyYXkocmVmQ291bnQpLmZpbGwoMCkubWFwKCgpID0+IHsKICAgICAgICBjb25zdCBiaW5Db3VudCA9IGJ5dGVzLnJlYWRJbnQzMkxFKGN1cnJPZmZzZXQpOwogICAgICAgIGN1cnJPZmZzZXQgKz0gNDsKICAgICAgICBjb25zdCBiaW5JbmRleCA9IHt9OwogICAgICAgIGxldCBzdGF0czsKICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGJpbkNvdW50OyBqICs9IDEpIHsKICAgICAgICAgIGNvbnN0IGJpbiA9IGJ5dGVzLnJlYWRVSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgIGlmIChiaW4gPiB0aGlzLm1heEJpbk51bWJlcikgewogICAgICAgICAgICBzdGF0cyA9IHRoaXMucGFyc2VQc2V1ZG9CaW4oYnl0ZXMsIGN1cnJPZmZzZXQgKyA0KTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSA0ICsgOCArIDQgKyAxNiArIDE2OwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgY29uc3QgbG9mZnNldCA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCArIDQpOwogICAgICAgICAgICBmaXJzdERhdGFMaW5lID0gdGhpcy5fZmluZEZpcnN0RGF0YShmaXJzdERhdGFMaW5lLCBsb2Zmc2V0KTsKICAgICAgICAgICAgY29uc3QgY2h1bmtDb3VudCA9IGJ5dGVzLnJlYWRJbnQzMkxFKGN1cnJPZmZzZXQgKyAxMik7CiAgICAgICAgICAgIGN1cnJPZmZzZXQgKz0gMTY7CiAgICAgICAgICAgIGNvbnN0IGNodW5rcyA9IG5ldyBBcnJheShjaHVua0NvdW50KTsKICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBjaHVua0NvdW50OyBrICs9IDEpIHsKICAgICAgICAgICAgICBjb25zdCB1ID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgICBjb25zdCB2ID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0ICsgOCk7CiAgICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNjsKICAgICAgICAgICAgICBjaHVua3Nba10gPSBuZXcgQ2h1bmsodSwgdiwgYmluKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBiaW5JbmRleFtiaW5dID0gY2h1bmtzOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4geyBiaW5JbmRleCwgc3RhdHMgfTsKICAgICAgfSk7CiAgICAgIHJldHVybiB7CiAgICAgICAgLi4uYXV4LAogICAgICAgIGNzaTogdHJ1ZSwKICAgICAgICByZWZDb3VudCwKICAgICAgICBtYXhCbG9ja1NpemU6IDEgPDwgMTYsCiAgICAgICAgZmlyc3REYXRhTGluZSwKICAgICAgICBjc2lWZXJzaW9uLAogICAgICAgIGluZGljZXMsCiAgICAgICAgZGVwdGg6IHRoaXMuZGVwdGgsCiAgICAgICAgbWF4QmluTnVtYmVyOiB0aGlzLm1heEJpbk51bWJlciwKICAgICAgICBtYXhSZWZMZW5ndGgKICAgICAgfTsKICAgIH0KICAgIHBhcnNlUHNldWRvQmluKGJ5dGVzLCBvZmZzZXQpIHsKICAgICAgY29uc3QgbGluZUNvdW50ID0gbG9uZ1RvTnVtYmVyKGltcG9ydF9sb25nMy5kZWZhdWx0LmZyb21CeXRlc0xFKGJ5dGVzLnNsaWNlKG9mZnNldCArIDI4LCBvZmZzZXQgKyAzNiksIHRydWUpKTsKICAgICAgcmV0dXJuIHsgbGluZUNvdW50IH07CiAgICB9CiAgICBhc3luYyBibG9ja3NGb3JSYW5nZShyZWZOYW1lLCBtaW4sIG1heCwgb3B0cyA9IHt9KSB7CiAgICAgIGlmIChtaW4gPCAwKSB7CiAgICAgICAgbWluID0gMDsKICAgICAgfQogICAgICBjb25zdCBpbmRleERhdGEgPSBhd2FpdCB0aGlzLnBhcnNlKG9wdHMpOwogICAgICBpZiAoIWluZGV4RGF0YSkgewogICAgICAgIHJldHVybiBbXTsKICAgICAgfQogICAgICBjb25zdCByZWZJZCA9IGluZGV4RGF0YS5yZWZOYW1lVG9JZFtyZWZOYW1lXTsKICAgICAgY29uc3QgYmEgPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmICghYmEpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3Qgb3ZlcmxhcHBpbmdCaW5zID0gdGhpcy5yZWcyYmlucyhtaW4sIG1heCk7CiAgICAgIGNvbnN0IGNodW5rcyA9IFtdOwogICAgICBmb3IgKGNvbnN0IFtzdGFydCwgZW5kXSBvZiBvdmVybGFwcGluZ0JpbnMpIHsKICAgICAgICBmb3IgKGxldCBiaW4gPSBzdGFydDsgYmluIDw9IGVuZDsgYmluKyspIHsKICAgICAgICAgIGlmIChiYS5iaW5JbmRleFtiaW5dKSB7CiAgICAgICAgICAgIGNvbnN0IGJpbkNodW5rcyA9IGJhLmJpbkluZGV4W2Jpbl07CiAgICAgICAgICAgIGZvciAobGV0IGMgPSAwOyBjIDwgYmluQ2h1bmtzLmxlbmd0aDsgKytjKSB7CiAgICAgICAgICAgICAgY2h1bmtzLnB1c2gobmV3IENodW5rKGJpbkNodW5rc1tjXS5taW52LCBiaW5DaHVua3NbY10ubWF4diwgYmluKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIG9wdGltaXplQ2h1bmtzKGNodW5rcywgbmV3IFZpcnR1YWxPZmZzZXQoMCwgMCkpOwogICAgfQogICAgcmVnMmJpbnMoYmVnLCBlbmQpIHsKICAgICAgYmVnIC09IDE7CiAgICAgIGlmIChiZWcgPCAxKSB7CiAgICAgICAgYmVnID0gMTsKICAgICAgfQogICAgICBpZiAoZW5kID4gMiAqKiA1MCkgewogICAgICAgIGVuZCA9IDIgKiogMzQ7CiAgICAgIH0KICAgICAgZW5kIC09IDE7CiAgICAgIGxldCBsID0gM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cy5yZWFkQ2h1bmsoYXJncywgeyBzaWduYWwgfSkKICAgICAgfSk7CiAgICB9CiAgICBhc3luYyBnZXRMaW5lcyhyZWZOYW1lLCBzdGFydCwgZW5kLCBvcHRzKSB7CiAgICAgIGxldCBzaWduYWw7CiAgICAgIGxldCBvcHRpb25zID0ge307CiAgICAgIGxldCBjYWxsYmFjazsKICAgICAgaWYgKHR5cGVvZiBvcHRzID09PSAidW5kZWZpbmVkIikgewogICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoImxpbmUgY2FsbGJhY2sgbXVzdCBiZSBwcm92aWRlZCIpOwogICAgICB9CiAgICAgIGlmICh0eXBlb2Ygb3B0cyA9PT0gImZ1bmN0aW9uIikgewogICAgICAgIGNhbGxiYWNrID0gb3B0czsKICAgICAgfSBlbHNlIHsKICAgICAgICBvcHRpb25zID0gb3B0czsKICAgICAgICBjYWxsYmFjayA9IG9wdHMubGluZUNhbGxiYWNrOwogICAgICB9CiAgICAgIGlmIChyZWZOYW1lID09PSB2b2lkIDApIHsKICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJtdXN0IHByb3ZpZGUgYSByZWZlcmVuY2Ugc2VxdWVuY2UgbmFtZSIpOwogICAgICB9CiAgICAgIGlmICghY2FsbGJhY2spIHsKICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJsaW5lIGNhbGxiYWNrIG11c3QgYmUgcHJvdmlkZWQiKTsKICAgICAgfQogICAgICBjb25zdCBtZXRhZGF0YSA9IGF3YWl0IHRoaXMuaW5kZXguZ2V0TWV0YWRhdGEob3B0aW9ucyk7CiAgICAgIGNoZWNrQWJvcnRTaWduYWwoc2lnbmFsKTsKICAgICAgaWYgKCFzdGFydCkgewogICAgICAgIHN0YXJ0ID0gMDsKICAgICAgfQogICAgICBpZiAoIWVuZCkgewogICAgICAgIGVuZCA9IG1ldGFkYXRhLm1heFJlZkxlbmd0aDsKICAgICAgfQogICAgICBpZiAoIShzdGFydCA8PSBlbmQpKSB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hY2hlLmdldChjLnRvU3RyaW5nKCksIGMpOwogICAgICAgIGNoZWNrQWJvcnRTaWduYWwoc2lnbmFsKTsKICAgICAgICBsZXQgYmxvY2tTdGFydCA9IDA7CiAgICAgICAgbGV0IHBvcyA9IDA7CiAgICAgICAgd2hpbGUgKGJsb2NrU3RhcnQgPCBidWZmZXIubGVuZ3RoKSB7CiAgICAgICAgICBjb25zdCBuID0gYnVmZmVyLmluZGV4T2YoIlxuIiwgYmxvY2tTdGFydCk7CiAgICAgICAgICBpZiAobiA9PT0gLTEpIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgICBjb25zdCBiID0gYnVmZmVyLnNsaWNlKGJsb2NrU3RhcnQsIG4pOwogICAgICAgICAgY29uc3QgbGluZSA9IChkZWNvZGVyID09PSBudWxsIHx8IGRlY29kZXIgPT09IHZvaWQgMCA/IHZvaWQgMCA6IGRlY29kZXIuZGVjb2RlKGIpKSB8fCBiLnRvU3RyaW5nKCk7CiAgICAgICAgICBpZiAoZHBvc2l0aW9ucykgewogICAgICAgICAgICB3aGlsZSAoYmxvY2tTdGFydCArIGMubWludi5kYXRhUG9zaXRpb24gPj0gZHBvc2l0aW9uc1twb3MrK10pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBwb3MtLTsKICAgICAgICAgIH0KICAgICAgICAgIGNvbnN0IHsgc3RhcnRDb29yZGluYXRlLCBvdmVybGFwcyB9ID0gdGhpcy5jaGVja0xpbmUobWV0YWRhdGEsIHJlZk5hbWUsIHN0YXJ0LCBlbmQsIGxpbmUpOwogICAgICAgICAgaWYgKHByZXZpb3VzU3RhcnRDb29yZGluYXRlICE9PSB2b2lkIDAgJiYgc3RhcnRDb29yZGluYXRlICE9PSB2b2lkIDAgJiYgcHJldmlvdXNTdGFydENvb3JkaW5hdGUgPiBzdGFydENvb3JkaW5hdGUpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBMaW5lcyBub3Qgc29ydGVkIGJ5IHN0YXJ0IGNvb3JkaW5hdGUgKCR7cHJldmlvdXNTdGFydENvb3JkaW5hdGV9ID4gJHtzdGFydENvb3JkaW5hdGV9KSwgdGhpcyBmaWxlIGlzIG5vdCB1c2FibGUgd2l0aCBUYWJpeC5gKTsKICAgICAgICAgIH0KICAgICAgICAgIHByZXZpb3VzU3RhcnRDb29yZGluYXRlID0gc3RhcnRDb29yZGluYXRlOwogICAgICAgICAgaWYgKG92ZXJsYXBzKSB7CiAgICAgICAgICAgIGNhbGxiYWNrKGxpbmUudHJpbSgpLCBjcG9zaXRpb25zW3Bvc10gKiAoMSA8PCA4KSArIChibG9ja1N0YXJ0IC0gZHBvc2l0aW9uc1twb3NdKSArIGMubWludi5kYXRhUG9zaXRpb24gKyAxKTsKICAgICAgICAgIH0gZWxzZSBpZiAoc3RhcnRDb29yZGluYXRlICE9PSB2b2lkIDAgJiYgc3RhcnRDb29yZGluYXRlID49IGVuZCkgewogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodGhpcy55aWVsZFRpbWUgJiYgbGFzdCAtIERhdGUubm93KCkgPiB0aGlzLnlpZWxkVGltZSkgewogICAgICAgICAgICBsYXN0ID0gRGF0ZS5ub3coKTsKICAgICAgICAgICAgY2hlY2tBYm9ydFNpZ25hbChzaWduYWwpOwogICAgICAgICAgICBhd2FpdCB0aW1lb3V0KDEpOwogICAgICAgICAgfQogICAgICAgICAgYmxvY2tTdGFydCA9IG4gKyAxOwogICAgICAgIH0KICAgICAgfQogICAgfQogICAgYXN5bmMgZ2V0TWV0YWRhdGEob3B0cyA9IHt9KSB7CiAgICAgIHJldHVybiB0aGlzLmluZGV4LmdldE1ldGFkYXRhKG9wdHMpOwogICAgfQogICAgYXN5bmMgZ2V0SGVhZGVyQnVmZmVyKG9wdHMgPSB7fSkgewogICAgICBjb25zdCB7IGZpcnN0RGF0YUxpbmUsIG1ldGFDaGFyLCBtYXhCbG9ja1NpemUgfSA9IGF3YWl0IHRoaX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ikgewogICAgICAgIGVuZCA9IDg7CiAgICAgIH0KICAgICAgY29uc3QgbWF4Q29sdW1uID0gTWF0aC5tYXgocmVmLCBzdGFydCwgZW5kKTsKICAgICAgbGV0IGN1cnJlbnRDb2x1bW5OdW1iZXIgPSAxOwogICAgICBsZXQgY3VycmVudENvbHVtblN0YXJ0ID0gMDsKICAgICAgbGV0IHJlZlNlcSA9ICIiOwogICAgICBsZXQgc3RhcnRDb29yZGluYXRlID0gLUluZmluaXR5OwogICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpbmUubGVuZ3RoICsgMTsgaSArPSAxKSB7CiAgICAgICAgaWYgKGxpbmVbaV0gPT09ICIJIiB8fCBpID09PSBsaW5lLmxlbmd0aCkgewogICAgICAgICAgaWYgKGN1cnJlbnRDb2x1bW5OdW1iZXIgPT09IHJlZikgewogICAgICAgICAgICBpZiAodGhpcy5yZW5hbWVSZWZTZXEobGluZS5zbGljZShjdXJyZW50Q29sdW1uU3RhcnQsIGkpKSAhPT0gcmVnaW9uUmVmTmFtZSkgewogICAgICAgICAgICAgIHJldHVybiB7IG92ZXJsYXBzOiBmYWxzZSB9OwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cnJlbnRDb2x1bW5OdW1iZXIgPT09IHN0YXJ0KSB7CiAgICAgICAgICAgIHN0YXJ0Q29vcmRpbmF0ZSA9IHBhcnNlSW50KGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKSwgMTApOwogICAgICAgICAgICBpZiAoY29vcmRpbmF0ZVR5cGUgPT09ICIxLWJhc2VkLWNsb3NlZCIpIHsKICAgICAgICAgICAgICBzdGFydENvb3JkaW5hdGUgLT0gMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoc3RhcnRDb29yZGluYXRlID49IHJlZ2lvbkVuZCkgewogICAgICAgICAgICAgIHJldHVybiB7IHN0YXJ0Q29vcmRpbmF0ZSwgb3ZlcmxhcHM6IGZhbHNlIH07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGVuZCA9PT0gMCB8fCBlbmQgPT09IHN0YXJ0KSB7CiAgICAgICAgICAgICAgaWYgKHN0YXJ0Q29vcmRpbmF0ZSArIDEgPD0gcmVnaW9uU3RhcnQpIHsKICAgICAgICAgICAgICAgIHJldHVybiB7IHN0YXJ0Q29vcmRpbmF0ZSwgb3ZlcmxhcHM6IGZhbHNlIH07CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgaWYgKGZvcm1hdCA9PT0gIlZDRiIgJiYgY3VycmVudENvbHVtbk51bWJlciA9PT0gNCkgewogICAgICAgICAgICByZWZTZXEgPSBsaW5lLnNsaWNlKGN1cnJlbnRDb2x1bW5TdGFydCwgaSk7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cnJlbnRDb2x1bW5OdW1iZXIgPT09IGVuZCkgewogICAgICAgICAgICBsZXQgZW5kQ29vcmRpbmF0ZTsKICAgICAgICAgICAgaWYgKGZvcm1hdCA9PT0gIlZDRiIpIHsKICAgICAgICAgICAgICBlbmRDb29yZGluYXRlID0gdGhpcy5fZ2V0VmNmRW5kKHN0YXJ0Q29vcmRpbmF0ZSwgcmVmU2VxLCBsaW5lLnNsaWNlKGN1cnJlbnRDb2x1bW5TdGFydCwgaSkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGVuZENvb3JkaW5hdGUgPSBwYXJzZUludChsaW5lLnNsaWNlKGN1cnJlbnRDb2x1bW5TdGFydCwgaSksIDEwKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoZW5kQ29vcmRpbmF0ZSA8PSByZWdpb25TdGFydCkgewogICAgICAgICAgICAgIHJldHVybiB7IG92ZXJsYXBzOiBmYWxzZSB9OwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBjdXJyZW50Q29sdW1uU3RhcnQgPSBpICsgMTsKICAgICAgICAgIGN1cnJlbnRDb2x1bW5OdW1iZXIgKz0gMTsKICAgICAgICAgIGlmIChjdXJyZW50Q29sdW1uTnVtYmVyID4gbWF4Q29sdW1uKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4geyBzdGFydENvb3JkaW5hdGUsIG92ZXJsYXBzOiB0cnVlIH07CiAgICB9CiAgICBfZ2V0VmNmRW5kKHN0YXJ0Q29vcmRpbmF0ZSwgcmVmU2VxLCBpbmZvKSB7CiAgICAgIGxldCBlbmRDb29yZGluYXRlID0gc3RhcnRDb29yZGluYXRlICsgcmVmU2VxLmxlbmd0aDsKICAgICAgY29uc3QgaXNUUkEgPSBpbmZvLmluZGV4T2YoIlNWVFlQRT1UUkEiKSAhPT0gLTE7CiAgICAgIGlmIChpbmZvWzBdICE9PSAiLiIgJiYgIWlzVFJBKSB7CiAgICAgICAgbGV0IHByZXZDaGFyID0gIjsiOwogICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgaW5mby5sZW5ndGg7IGogKz0gMSkgewogICAgICAgICAgaWYgKHByZXZDaGFyID09PSAiOyIgJiYgaW5mby5zbGljZShqLCBqICsgNCkgPT09ICJFTkQ9IikgewogICAgICAgICAgICBsZXQgdmFsdWVFbmQgPSBpbmZvLmluZGV4T2YoIjsiLCBqKTsKICAgICAgICAgICAgaWYgKHZhbHVlRW5kID09PSAtMSkgewogICAgICAgICAgICAgIHZhbHVlRW5kID0gaW5mby5sZW5ndGg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZW5kQ29vcmRpbmF0ZSA9IHBhcnNlSW50KGluZm8uc2xpY2UoaiArIDQsIHZhbHVlRW5kKSwgMTApOwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICAgIHByZXZDaGFyID0gaW5mb1tqXTsKICAgICAgICB9CiAgICAgIH0gZWxzZSBpZiAoaXNUUkEpIHsKICAgICAgICByZXR1cm4gc3RhcnRDb29yZGluYXRlICsgMTsKICAgICAgfQ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ICAgICBBRjogewogICAgICAgIE51bWJlcjogIkEiLAogICAgICAgIFR5cGU6ICJGbG9hdCIsCiAgICAgICAgRGVzY3JpcHRpb246ICJBbGxlbGUgZnJlcXVlbmN5IGZvciBlYWNoIEFMVCBhbGxlbGUgaW4gdGhlIHNhbWUgb3JkZXIgYXMgbGlzdGVkIChlc3RpbWF0ZWQgZnJvbSBwcmltYXJ5IGRhdGEsIG5vdCBjYWxsZWQgZ2Vub3R5cGVzKSIKICAgICAgfSwKICAgICAgQU46IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiVG90YWwgbnVtYmVyIG9mIGFsbGVsZXMgaW4gY2FsbGVkIGdlbm90eXBlcyIKICAgICAgfSwKICAgICAgQlE6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkZsb2F0IiwKICAgICAgICBEZXNjcmlwdGlvbjogIlJNUyBiYXNlIHF1YWxpdHkiCiAgICAgIH0sCiAgICAgIENJR0FSOiB7CiAgICAgICAgTnVtYmVyOiAxLAogICAgICAgIFR5cGU6ICJGbG9hdCIsCiAgICAgICAgRGVzY3JpcHRpb246ICJDaWdhciBzdHJpbmcgZGVzY3JpYmluZyBob3cgdG8gYWxpZ24gYW4gYWx0ZXJuYXRlIGFsbGVsZSB0byB0aGUgcmVmZXJlbmNlIGFsbGVsZSIKICAgICAgfSwKICAgICAgREI6IHsKICAgICAgICBOdW1iZXI6IDAsCiAgICAgICAgVHlwZTogIkZsYWciLAogICAgICAgIERlc2NyaXB0aW9uOiAiZGJTTlAgbWVtYmVyc2hpcCIKICAgICAgfSwKICAgICAgRFA6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiY29tYmluZWQgZGVwdGggYWNyb3NzIHNhbXBsZXMiCiAgICAgIH0sCiAgICAgIEVORDogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJFbmQgcG9zaXRpb24gKGZvciB1c2Ugd2l0aCBzeW1ib2xpYyBhbGxlbGVzKSIKICAgICAgfSwKICAgICAgSDI6IHsKICAgICAgICBOdW1iZXI6IDAsCiAgICAgICAgVHlwZTogIkZsYWciLAogICAgICAgIERlc2NyaXB0aW9uOiAiSGFwTWFwMiBtZW1iZXJzaGlwIgogICAgICB9LAogICAgICBIMzogewogICAgICAgIE51bWJlcjogMCwKICAgICAgICBUeXBlOiAiRmxhZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICJIYXBNYXAzIG1lbWJlcnNoaXAiCiAgICAgIH0sCiAgICAgIE1ROiB7CiAgICAgICAgTnVtYmVyOiAxLAogICAgICAgIFR5cGU6IG51bGwsCiAgICAgICAgRGVzY3JpcHRpb246ICJSTVMgbWFwcGluZyBxdWFsaXR5IgogICAgICB9LAogICAgICBNUTA6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiTnVtYmVyIG9mIE1BUFEgPT0gMCByZWFkcyIKICAgICAgfSwKICAgICAgTlM6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiTnVtYmVyIG9mIHNhbXBsZXMgd2l0aCBkYXRhIgogICAgICB9LAogICAgICBTQjogewogICAgICAgIE51bWJlcjogNCwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJTdHJhbmQgYmlhcyIKICAgICAgfSwKICAgICAgU09NQVRJQzogewogICAgICAgIE51bWJlcjogMCwKICAgICAgICBUeXBlOiAiRmxhZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICJTb21hdGljIG11dGF0aW9uIChmb3IgY2FuY2VyIGdlbm9taWNzKSIKICAgICAgfSwKICAgICAgVkFMSURBVEVEOiB7CiAgICAgICAgTnVtYmVyOiAwLAogICAgICAgIFR5cGU6ICJGbGFnIiwKICAgICAgICBEZXNjcmlwdGlvbjogIlZhbGlkYXRlZCBieSBmb2xsb3ctdXAgZXhwZXJpbWVudCIKICAgICAgfSwKICAgICAgIjEwMDBHIjogewogICAgICAgIE51bWJlcjogMCwKICAgICAgICBUeXBlOiAiRmxhZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICIxMDAwIEdlbm9tZXMgbWVtYmVyc2hpcCIKICAgICAgfSwKICAgICAgSU1QUkVDSVNFOiB7CiAgICAgICAgTnVtYmVyOiAwLAogICAgICAgIFR5cGU6ICJGbGFnIiwKICAgICAgICBEZXNjcmlwdGlvbjogIkltcHJlY2lzZSBzdHJ1Y3R1cmFsIHZhcmlhdGlvbiIKICAgICAgfSwKICAgICAgTk9WRUw6IHsKICAgICAgICBOdW1iZXI6IDAsCiAgICAgICAgVHlwZTogIkZsYWciLAogICAgICAgIERlc2NyaXB0aW9uOiAiSW5kaWNhdGVzIGEgbm92ZWwgc3RydWN0dXJhbCB2YXJpYXRpb24iCiAgICAgIH0sCiAgICAgIFNWVFlQRTogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIlR5cGUgb2Ygc3RydWN0dXJhbCB2YXJpYW50IgogICAgICB9LAogICAgICBTVkxFTjogewogICAgICAgIE51bWJlcjogbnVsbCwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJEaWZmZXJlbmNlIGluIGxlbmd0aCBiZXR3ZWVuIFJFRiBhbmQgQUxUIGFsbGVsZXMiCiAgICAgIH0sCiAgICAgIENJUE9TOiB7CiAgICAgICAgTnVtYmVyOiAyLAogICAgICAgIFR5cGU6ICJJbnRlZ2VyIiwKICAgICAgICBEZXNjcmlwdGlvbjogIkNvbmZpZGVuY2UgaW50ZXJ2YWwgYXJvdW5kIFBPUyBmb3IgaW1wcmVjaXNlIHZhcmlhbnRzIgogICAgICB9LAogICAgICBDSUVORDogewogICAgICAgIE51bWJlcjogMiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJDb25maWRlbmNlIGludGVydmFsIGFyb3VuZCBFTkQgZm9yIGltcHJlY2lzZSB2YXJpYW50cyIKICAgICAgfSwKICAgICAgSE9NTEVOOiB7CiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiTGVuZ3RoIG9mIGJhc2UgcGFpciBpZGVudGljYWwgbWljcm8taG9tb2xvZ3kgYXQgZXZlbnQgYnJlYWtwb2ludHMiCiAgICAgIH0sCiAgICAgIEhPTVNFUTogewogICAgICAgIFR5cGU6ICJTdHJpbmciLAogICAgICAgIERlc2NyaXB0aW9uOiAiU2VxdWVuY2Ugb2YgYmFzZSBwYWlyIGlkZW50aWNhbCBtaWNyby1ob21vbG9neSBhdCBldmVudCBicmVha3BvaW50cyIKICAgICAgfSwKICAgICAgQktQVElEOiB7CiAgICAgICAgVHlwZTogIlN0cmluZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICJJRCBvZiB0aGUgYXNzZW1ibGVkIGFsdGVybmF0ZSBhbGxlbGUgaW4gdGhlIGFzc2VtYmx5IGZpbGUiCiAgICAgIH0sCiAgICAgIE1FSU5GTzogewogICAgICAgIE51bWJlcjogNCwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIk1vYmlsZSBlbGVtZW50IGluZm8gb2YgdGhlIGZvcm0gTkFNRSxTVEFSVCxFTkQsUE9MQVJJVFkiCiAgICAgIH0sCiAgICAgIE1FVFJBTlM6IHsKICAgICAgICBOdW1iZXI6IDQsCiAgICAgICAgVHlwZTogIlN0cmluZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICJNb2JpbGUgZWxlbWVudCB0cmFuc2R1Y3Rpb24gaW5mbyBvZiB0aGUgZm9ybSBDSFIsU1RBUlQsRU5ELFBPTEFSSVRZIgogICAgICB9LAogICAgICBER1ZJRDogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIklEIG9mIHRoaXMgZWxlbWVudCBpbiBEYXRhYmFzZSBvZiBHZW5vbWljIFZhcmlhdGlvbiIKICAgICAgfSwKICAgICAgREJWQVJJRDogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIklEIG9mIHRoaXMgZWxlbWVudCBpbiBEQlZBUiIKICAgICAgfSwKICAgICAgREJSSVBJRDogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIklEIG9mIHRoaXMgZWxlbWVudCBpbiBEQlJJUCIKICAgICAgfSwKICAgICAgTUFURUlEOiB7CiAgICAgICAgTnVtYmVyOiBudWxsLAogICAgICAgIFR5cGU6ICJTdHJpbmciLAogICAgICAgIERlc2NyaXB0aW9uOiAiSUQgb2YgbWF0ZSBicmVha2VuZHMiCiAgICAgIH0sCiAgICAgIFBBUklEOiB7CiAgICAgICAgTnVtYmVyOiAxLAogICAgICAgIFR5cGU6ICJTdHJpbmciLAogICAgICAgIERlc2NyaXB0aW9uOiAiSUQgb2YgcGFydG5lciBicmVha2VuZCIKICAgICAgfSwKICAgICAgRVZFTlQ6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIlN0cmluZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICJJRCBvZiBldmVudCBhc3NvY2lhdGVkIHRvIGJyZWFrZW5kIgogICAgICB9LAogICAgICBDSUxFTjogewogICAgICAgIE51bWJlcjogMiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJDb25maWRlbmNlIGludGVydmFsIGFyb3VuZCB0aGUgaW5zZXJ0ZWQgbWF0ZXJpYWwgYmV0d2VlbiBicmVha2VuZCIKICAgICAgfSwKICAgICAgRFBBREo6IHsgVHlwZTogIkludGVnZXIiLCBEZXNjcmlwdGlvbjogIlJlYWQgRGVwdGggb2YgYWRqYWNlbmN5IiB9LAogICAgICBDTjogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJDb3B5IG51bWJlciBvZiBzZWdtZW50IGNvbnRhaW5pbmcgYnJlYWtlbmQiCiAgICAgIH0sCiAgICAgIENOQURKOiB7CiAgICAgICAgTnVtYmVyOiBudWxsLAogICAgICAgIFR5cGU6ICJJbnRlZ2VyIiwKICAgICAgICBEZXNjcmlwdGlvbjogIkNvcHkgbnVtYmVyIG9mIGFkamFjZW5jeSIKICAgICAgfSwKICAgICAgQ0lDTjogewogICAgICAgIE51bWJlcjogMiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJDb25maWRlbmNlIGludGVydmFsIGFyb3VuZCBjb3B5IG51bWJlciBmb3IgdGhlIHNlZ21lbnQiCiAgICAgIH0sCiAgICAgIENJQ05BREo6IHsKICAgICAgICBOdW1iZXI6IG51bGwsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiQ29uZmlkZW5jZSBpbnRlcnZhbCBhcm91bmQgY29weSBudW1iZXIgZm9yIHRoZSBhZGphY2VuY3kiCiAgICAgIH0KICAgIH0sCiAgICBHZW5vdHlwZUZpZWxkczogewogICAgICBBRDogewogICAgICAgIE51bWJlcjogIlIiLAogICAgICAgIFR5cGU6ICJJbnRlZ2VyIiwKICAgICAgICBEZXNjcmlwdGlvbjogIlJlYWQgZGVwdGggZm9yIGVhY2ggYWxsZWxlIgogICAgICB9LAogICAgICBBREY6IHsKICAgICAgICBOdW1iZXI6ICJSIiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJSZWFkIGRlcHRoIGZvciBlYWNoIGFsbGVsZSBvbiB0aGUgZm9yd2FyZCBzdHJhbmQiCiAgICAgIH0sCiAgICAgIEFEUjogewogICAgICAgIE51bWJlcjogIlIiLAogICAgICAgIFR5cGU6ICJJbnRlZ2VyIiwKICAgICAgICBEZXNjcmlwdGlvbjogIlJlYWQgZGVwdGggZm9yIGVhY2ggYWxsZWxlIG9uIHRoZSByZXZlcnNlIHN0cmFuZCIKICAgICAgfSwKICAgICAgRFA6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiUmVhZCBkZXB0aCIKICAgICAgfSwKICAgICAgRUM6IHsKICAgICAgICBOdW1iZXI6ICJBIiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJFeHBlY3RlZCBhbHRlcm5hdGUgYWxsZWxlIGNvdW50cyIKICAgICAgfSwKICAgICAgRlQ6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIlN0cmluZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICdGaWx0ZXIgaW5kaWNhdGluZyBpZiB0aGlzIGdlbm90eXBlIHdhcyAiY2FsbGVkIicKICAgICAgfSwKICAgICAgR0w6IHsKICAgICAgICBOdW1iZXI6ICJHIiwKICAgICAgICBUeXBlOiAiRmxvYXQiLAogICAgICAgIERlc2NyaXB0aW9uOiAiR2Vub3R5cGUgbGlrZWxpaG9vZHMiCiAgICAgIH0sCiAgICAgIEdQOiB7CiAgICAgICAgTnVtYmVyOiAiRyIsCiAgICAgICAgVHlwZTogIkZsb2F0IiwKICAgICAgICBEZXNjcmlwdGlvbjogIkdlbm90eXBlIHBvc3RlcmlvciBwcm9iYWJpbGl0aWVzIgogICAgICB9LAogICAgICBHUTogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJDb25kaXRpb25hbCBnZW5vdHlwZSBxdWFsaXR5IgogICAgICB9LAogICAgICBHVDogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIkdlbm90eXBlIgogICAgICB9LAogICAgICBIUTogewogICAgICAgIE51bWJlcjogMiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJIYXBsb3R5cGUgcXVhbGl0eSIKICAgICAgfSwKICAgICAgTVE6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiUk1TIG1hcHBpbmcgcXVhbGl0eSIKICAgICAgfSwKICAgICAgUEw6IHsKICAgICAgICBOdW1iZXI6ICJHIiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJQaHJlZC1zY2FsZWQgZ2Vub3R5cGUgbGlrZWxpaG9vZHMgcm91bmRlZCB0byB0aGUgY2xvc2VzdCBpbnRlZ2VyIgogICAgICB9LAogICAgICBQUTogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJQaGFzaW5nIHF1YWxpdHkiCiAgICAgIH0sCiAgICAgIFBTOiB7CiAgICAgICAgTnVtYmVyOiAxLAogICAgICAgIFR5cGU6ICJJbnRlZ2VyIiwKICAgICAgICBEZXNjcmlwdGlvbjogIlBoYXNlIHNldCIKICAgICAgfQogICAgfSwKICAgIEFsdFR5cGVzOiB7CiAgICAgIERFTDogewogICAgICAgIERlc2NyaXB0aW9uOiAiRGVsZXRpb24gcmVsYXRpdmUg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LnNwbGl0KCI6IikuZmlsdGVyKChmKSA9PiBmKS5mb3JFYWNoKCh2YWwsIGluZGV4MikgPT4gewogICAgICAgICAgICBsZXQgdGhpc1ZhbHVlOwogICAgICAgICAgICBpZiAodmFsID09PSAiIiB8fCB2YWwgPT09ICIuIiB8fCB2YWwgPT09IHZvaWQgMCkgewogICAgICAgICAgICAgIHRoaXNWYWx1ZSA9IG51bGw7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgY29uc3QgZW50cmllcyA9IHZhbC5zcGxpdCgiLCIpLm1hcCgoZW50KSA9PiBlbnQgPT09ICIuIiA/IG51bGwgOiBlbnQpOwogICAgICAgICAgICAgIGNvbnN0IHZhbHVlVHlwZSA9IHRoaXMuZ2V0TWV0YWRhdGEoIkZPUk1BVCIsIGZvcm1hdEtleXNbaW5kZXgyXSwgIlR5cGUiKTsKICAgICAgICAgICAgICBpZiAodmFsdWVUeXBlID09PSAiSW50ZWdlciIgfHwgdmFsdWVUeXBlID09PSAiRmxvYXQiKSB7CiAgICAgICAgICAgICAgICB0aGlzVmFsdWUgPSBlbnRyaWVzLm1hcCgodmFsMikgPT4gdmFsMiA/ICt2YWwyIDogdmFsMik7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHRoaXNWYWx1ZSA9IGVudHJpZXM7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGdlbm90eXBlc1tzYW1wbGVdW2Zvcm1hdEtleXNbaW5kZXgyXV0gPSB0aGlzVmFsdWU7CiAgICAgICAgICB9LCB7fSk7CiAgICAgICAgfSk7CiAgICAgIH0KICAgICAgcmV0dXJuIGdlbm90eXBlczsKICAgIH0KICAgIF9wYXJzZU1ldGFkYXRhKGxpbmUpIHsKICAgICAgY29uc3QgbWF0Y2ggPSBsaW5lLnRyaW0oKS5tYXRjaCgvXiMjKC4rPyk9KC4qKS8pOwogICAgICBpZiAoIW1hdGNoKSB7CiAgICAgICAg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mFsdWU7CiAgICAgICAgICAgIGN1cnJLZXkgPSAiIjsKICAgICAgICAgICAgY3VyclZhbHVlID0gIiI7CiAgICAgICAgICAgIHN0YXRlID0gMTsKICAgICAgICAgIH0gZWxzZSBpZiAoc3RyW2ldID09PSAnIicpIHsKICAgICAgICAgICAgc3RhdGUgPSAzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgY3VyclZhbHVlICs9IHN0cltpXTsKICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgaWYgKHN0YXRlID09PSAzKSB7CiAgICAgICAgICBpZiAoc3RyW2ldICE9PSAnIicpIHsKICAgICAgICAgICAgY3VyclZhbHVlICs9IHN0cltpXTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHN0YXRlID0gMjsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgaWYgKHN0YXRlID09PSAyIHx8IHN0YXRlID09PSAzKSB7CiAgICAgICAgZGF0YVtjdXJyS2V5XSA9IGN1cnJWYWx1ZTsKICAgICAgfSBlbHNlIGlmIChzdGF0ZSA9PT0gMSkgewogICAgICAgIGRhdGFbY3VycktleV0gPSBudWxsOwogICAgICB9CiAgICAgIHJldHVybiBkYXRhOwogICAgfQogICAgcGFyc2VMaW5lKGxpbmUpIHsKICAgICAgbGluZSA9IGxpbmUudHJpbSgpOwogICAgICBpZiAoIWxpbmUubGVuZ3RoKSB7CiAgICAgICAgcmV0dXJuIHZvaWQgMDsKICAgICAgfQogICAgICBjb25zdCBwYXJzZXIgPSB0aGlzOwogICAgICBsZXQgY3VyckNoYXIgPSAwOwogICAgICBmb3IgKGxldCBjdXJyRmllbGQgPSAwOyBjdXJyQ2hhciA8IGxpbmUubGVuZ3RoOyBjdXJyQ2hhciArPSAxKSB7CiAgICAgICAgaWYgKGxpbmVbY3VyckNoYXJdID09PSAiCSIpIHsKICAgICAgICAgIGN1cnJGaWVsZCArPSAxOwogICAgICAgIH0KICAgICAgICBpZiAoY3VyckZpZWxkID09PSA5KSB7CiAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgIH0KICAgICAgY29uc3QgZmllbGRzID0gbGluZS5zdWJzdHIoMCwgY3VyckNoYXIpLnNwbGl0KCIJIik7CiAgICAgIGNvbnN0IHJlc3QgPSBsaW5lLnN1YnN0cihjdXJyQ2hhciArIDEpOwogICAgICBjb25zdCBbQ0hST00sIFBPUywgSUQsIFJFRiwgQUxULCBRVUFMLCBGSUxURVJdID0gZmllbGRzOwogICAgICBjb25zdCBjaHJvbSA9IENIUk9NOwogICAgICBjb25zdCBwb3MgPSArUE9TOwogICAgICBjb25zdCBpZCA9IElEID09PSAiLiIgPyBudWxsIDogSUQuc3BsaXQoIjsiKTsKICAgICAgY29uc3QgcmVmID0gUkVGOwogICAgICBjb25zdCBhbHQgPSBBTFQgPT09ICIuIiA/IG51bGwgOiBBTFQuc3BsaXQoIiwiKTsKICAgICAgY29uc3QgcXVhbCA9IFFVQUwgPT09ICIuIiA/IG51bGwgOiArUVVBTDsKICAgICAgY29uc3QgZmlsdGVyID0gRklMVEVSID09PSAiLiIgPyBudWxsIDogRklMVEVSLnNwbGl0KCI7Iik7CiAgICAgIGlmICh0aGlzLnN0cmljdCAmJiBmaWVsZHNbN10gPT09IHZvaWQgMCkgewogICAgICAgIHRocm93IG5ldyBFcnJvcigibm8gSU5GTyBmaWVsZCBzcGVjaWZpZWQsIG11c3QgY29udGFpbiBhdCBsZWFzdCBhICcuJyAodHVybiBvZmYgc3RyaWN0IG1vZGUgdG8gYWxsb3cpIik7CiAgICAgIH0KICAgICAgY29uc3QgaW5mbyA9IGZpZWxkc1s3XSA9PT0gdm9pZCAwIHx8IGZpZWxkc1s3XSA9PT0gIi4iID8ge30gOiB0aGlzLl9wYXJzZUtleVZhbHVlKGZpZWxkc1s3XSk7CiAgICAgIE9iamVjdC5rZXlzKGluZm8pLmZvckVhY2goKGtleSkgPT4gewogICAgICAgIGxldCBpdGVtczsKICAgICAgICBpZiAoaW5mb1trZXldKSB7CiAgICAgICAgICBpdGVtcyA9IGluZm9ba2V5XS5zcGxpdCgiLCIpLm1hcCgodmFsKSA9PiB2YWwgPT09ICIuIiA/IG51bGwgOiB2YWwpLm1hcCgoZikgPT4gZiA/IGRlY29kZVVSSUNvbXBvbmVudE5vVGhyb3coZikgOiBmKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaXRlbXMgPSBpbmZvW2tleV07CiAgICAgICAgfQogICAgICAgIGNvbnN0IGl0ZW1UeXBlID0gdGhpcy5nZXRNZXRhZGF0YSgiSU5GTyIsIGtleSwgIlR5cGUiKTsKICAgICAgICBpZiAoaXRlbVR5cGUpIHsKICAgICAgICAgIGlmIChpdGVtVHlwZSA9PT0gIkludGVnZXIiIHx8IGl0ZW1UeXBlID09PSAiRmxvYXQiKSB7CiAgICAgICAgICAgIGl0ZW1zID0gaXRlbXMubWFwKCh2YWwpID0+IHsKICAgICAgICAgICAgICBpZiAodmFsID09PSBudWxsKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcmV0dXJuIE51bWJlcih2YWwpOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0gZWxzZSBpZiAoaXRlbVR5cGUgPT09ICJGbGFnIikgewogICAgICAgICAgICBpZiAoaW5mb1trZXldKSB7CiAgICAgICAgICAgICAgY29uc29sZS53YXJuKGBJbmZvIGZpZWxkICR7a2V5fSBpcyBhIEZsYWcgYW5kIHNob3VsZCBub3QgaGF2ZSBhIHZhbHVlIChnb3QgdmFsdWUgJHtpbmZvW2tleV19KWApOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGl0ZW1zID0gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpbmZvW2tleV0gPSBpdGVtczsKICAgICAgfSk7CiAgICAgIGNvbnN0IHZhcmlhbnQgPSBuZXcgVmFyaWFudCh7CiAgICAgICAgQ0hST006IGNocm9tLAogICAgICAgIFBPUzogcG9zLAogICAgICAgIEFMVDogYWx0LAogICAgICAgIElORk86IGluZm8sCiAgICAgICAgUkVGOiByZWYsCiAgICAgICAgRklMVEVSOiBmaWx0ZXIgJiYgZmlsdGVyLmxlbmd0aCA9PT0gMSAmJiBmaWx0ZXJbMF0gPT09ICJQQVNTIiA/ICJQQVNTIiA6IGZpbHRlciwKICAgICAgICBJRDogaWQsCiAgICAgICAgUVVBTDogcXVhbAogICAgICB9KTsKICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHZhcmlhbnQsICJTQU1QTEVTIiwgewogICAgICAgIGdldCgpIHsKICAgICAgICAgIGNvbnN0IHNhbXBsZXMgPSBwYXJzZXIuX3BhcnNlR2Vub3R5cGVzKGZpZWxkc1s4XSwgcmVzdCk7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgIlNBTVBMRVMiLCB7CiAgICAgICAgICAgIHZhbHVlOiBzYW1wbGVzLAogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlCiAgICAgICAgICB9KTsKICAgICAgICAgIHJldHVybiBzYW1wbGVzOwogICAgICAgIH0sCiAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgIH0pOwogICAgICByZXR1cm4gdmFyaWFudDsKICAgIH0KICB9OwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vQGdtb2QrdmNmQDUuMC4xMC9ub2RlX21vZHVsZXMvQGdtb2QvdmNmL2VzbS9pbmRleC5qcwogIHZhciBlc21fZGVmYXVsdCA9IFZDRjsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3RocmVhZHNAMS43LjAvbm9kZV9tb2R1bGVzL3RocmVhZHMvd29ya2VyLm1qcwogIGluaXRfYnVmZmVyX3NoaW0oKTsKICB2YXIgaW1wb3J0X3dvcmtlciA9IF9fdG9Nb2R1bGUocmVxdWlyZV93b3JrZXIoKSk7CiAgdmFyIGV4cG9zZSA9IGlt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AgaWYgKGYubGVuZ3RoID09PSAxKSB7CiAgICAgIGRlbHRhID0gKGQsIHgpID0+IGYoZCkgLSB4OwogICAgICBjb21wYXJlID0gYXNjZW5kaW5nQ29tcGFyYXRvcihmKTsKICAgIH0KICAgIGZ1bmN0aW9uIGxlZnQoYSwgeCwgbG8sIGhpKSB7CiAgICAgIGlmIChsbyA9PSBudWxsKQogICAgICAgIGxvID0gMDsKICAgICAgaWYgKGhpID09IG51bGwpCiAgICAgICAgaGkgPSBhLmxlbmd0aDsKICAgICAgd2hpbGUgKGxvIDwgaGkpIHsKICAgICAgICBjb25zdCBtaWQgPSBsbyArIGhpID4+PiAxOwogICAgICAgIGlmIChjb21wYXJlKGFbbWlkXSwgeCkgPCAwKQogICAgICAgICAgbG8gPSBtaWQgKyAxOwogICAgICAgIGVsc2UKICAgICAgICAgIGhpID0gbWlkOwogICAgICB9CiAgICAgIHJldHVybiBsbzsKICAgIH0KICAgIGZ1bmN0aW9uIHJpZ2h0KGEsIHgsIGxvLCBoaSkgewogICAgICBpZiAobG8gPT0gbnVsbCkKICAgICAgICBsbyA9IDA7CiAgICAgIGlmIChoaSA9PSBudWxsKQogICAgICAgIGhpID0gYS5sZW5ndGg7CiAgICAgIHdoaWxlIChsbyA8IGhpKSB7CiAgICAgICAgY29uc3QgbWlkID0gbG8gKyBoaSA+Pj4gMTsKICAgICAgICBpZiAoY29tcGFyZShhW21pZF0sIHgpID4gMCkKICAgICAgICAgIGhpID0gbWlkOwogICAgICAgIGVsc2UKICAgICAgICAgIGxvID0gbWlkICsgMTsKICAgICAgfQogICAgICByZXR1cm4gbG87CiAgICB9CiAgICBmdW5jdGlvbiBjZW50ZXIoYSwgeCwgbG8sIGhpKSB7CiAgICAgIGlmIChsbyA9PSBudWxsKQogICAgICAgIGxvID0gMDsKICAgICAgaWYgKGhpID09IG51bGwpCiAgICAgICAgaGkgPSBhLmxlbmd0aDsKICAgICAgY29uc3QgaSA9IGxlZnQoYSwgeCwgbG8sIGhpIC0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aCA9PT0gYWx0Lmxlbmd0aCkKICAgICAgcmV0dXJuICJzdWJzdGl0dXRpb24iOwogICAgaWYgKHJlZi5sZW5ndGggPiBhbHQubGVuZ3RoKQogICAgICByZXR1cm4gImRlbGV0aW9uIjsKICAgIGlmIChyZWYubGVuZ3RoIDwgYWx0Lmxlbmd0aCkKICAgICAgcmV0dXJuICJpbnNlcnRpb24iOwogICAgcmV0dXJuICJ1bmtub3duIjsKICB9OwogIHZhciBnZXRTdWJzdGl0dXRpb25UeXBlID0gKHJlZiwgYWx0KSA9PiB7CiAgICBzd2l0Y2ggKHJlZiArIGFsdCkgewogICAgICBjYXNlICJDQSI6CiAgICAgIGNhc2UgIkdUIjoKICAgICAgICByZXR1cm4gIkM+QSI7CiAgICAgIGNhc2UgIkNHIjoKICAgICAgY2FzZSAiR0MiOgogICAgICAgIHJldHVybiAiQz5HIjsKICAgICAgY2FzZSAiQ1QiOgogICAgICBjYXNlICJHQSI6CiAgICAgICAgcmV0dXJuICJDPlQiOwogICAgICBjYXNlICJUQSI6CiAgICAgIGNhc2UgIkFUIjoKICAgICAgICByZXR1cm4gIlQ+QSI7CiAgICAgIGNhc2UgIlRDIjoKICAgICAgY2FzZSAiQUciOgogICAgICAgIHJldHVybiAiVD5DIjsKICAgICAgY2FzZSAiVEciOgogICAgICBjYXNlICJBQyI6CiAgICAgICAgcmV0dXJuICJUPkciOwogICAgICBkZWZhdWx0OgogICAgICAgIHJldHVybiAidW5rbm93biI7CiAgICB9CiAgfTsKICBmdW5jdGlvbiByZWNvcmRUb1RpbGUodmNmUmVjb3JkLCBjaHJQb3MsIHByZXZBYnNQb3MpIHsKICAgIGNvbnN0IGFic1BvcyA9IGNoclBvcyArIHZjZlJlY29yZC5QT1MgKyAxOwogICAgbGV0IEFMVDsKICAgIGlmIChBcnJheS5pc0FycmF5KHZjZlJlY29yZC5BTFQpICYmIHZjZlJlY29yZC5BTFQubGVuZ3RoID4gMCkgewogICAgICBBTFQgPSB2Y2ZSZWNvc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NlcigpOwogICAgICBsZXQgY3VyTWluWCA9IG1pblg7CiAgICAgIGNvbnN0IHsgY2hyb21MZW5ndGhzLCBjdW1Qb3NpdGlvbnMgfSA9IHNvdXJjZS5jaHJvbUluZm87CiAgICAgIGNvbnN0IHJlY29yZFByb21pc2VzID0gW107CiAgICAgIGZvciAoY29uc3QgY3VtUG9zIG9mIGN1bVBvc2l0aW9ucykgewogICAgICAgIGNvbnN0IGNocm9tTmFtZSA9IGN1bVBvcy5jaHI7CiAgICAgICAgY29uc3QgY2hyb21TdGFydCA9IGN1bVBvcy5wb3M7CiAgICAgICAgY29uc3QgY2hyb21FbmQgPSBjdW1Qb3MucG9zICsgY2hyb21MZW5ndGhzW2Nocm9tTmFtZV07CiAgICAgICAgbGV0IHN0YXJ0UG9zLCBlbmRQb3M7CiAgICAgICAgaWYgKGNocm9tU3RhcnQgPiBjdXJNaW5YIHx8IGN1ck1pblggPj0gY2hyb21FbmQpIHsKICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgIH0KICAgICAgICBsZXQgcHJldlBPUzsKICAgICAgICBjb25zdCB0aWxlc1Byb21pc2UgPSBuZXcgUHJvbWlzZSgocmVzb2x2ZSkgPT4gewogICAgICAgICAgY29uc3QgdGlsZXMgPSBbXTsKICAgICAgICAgIGNvbnN0IGxpbmVDYWxsYmFjayA9IChsaW5lKSA9PiB7CiAgICAgICAgICAgIGNvbnN0IHZjZlJlY29yZCA9IHBhcnNlci5wYXJzZUxpbmUobGluZSk7CiAgICAgICAgICAgIGNvbnN0IHZjZlRpbGUgPSByZWNvcmRUb1RpbGUodmNmUmVjb3JkLCBjaHJvbVN0YXJ0LCBwcmV2UE9TKTsKICAgICAgICAgICAgcHJldlBPUyA9IHZjZlRpbGUuUE9TOwogICAgICAgICAgICB0aWxlcy5wdXNoKHZjZlRpbGUpOwogICAgICAgICAgfTsKICAgICAgICAgIGlmIChtYXhYID4gY2hyb21FbmQpIHsKICAgICAgICAgICAgc3RhcnRQb3MgPSBjdXJ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mNlZCwKICAgIHRpbGUsCiAgICBnZXRUYWJ1bGFyRGF0YQogIH07CiAgZXhwb3NlKHRpbGVGdW5jdGlvbnMpOwp9KSgpOwovKiEKICogVGhlIGJ1ZmZlciBtb2R1bGUgZnJvbSBub2RlLmpzLCBmb3IgdGhlIGJyb3dzZXIuCiAqCiAqIEBhdXRob3IgICBGZXJvc3MgQWJvdWtoYWRpamVoIDxodHRwczovL2Zlcm9zcy5vcmc+CiAqIEBsaWNlbnNlICBNSVQKICovCi8qISBpZWVlNzU0LiBCU0QtMy1DbGF1c2UgTGljZW5zZS4gRmVyb3NzIEFib3VraGFkaWplaCA8aHR0cHM6Ly9mZXJvc3Mub3JnL29wZW5zb3VyY2U+ICovCi8qKgogKiBAbGljZW5zZQogKiBMb2Rhc2ggKEN1c3RvbSBCdWlsZCkgPGh0dHBzOi8vbG9kYXNoLmNvbS8+CiAqIEJ1aWxkOiBgbG9kYXNoIG1vZHVsYXJpemUgZXhwb3J0cz0iZXMiIC1vIC4vYAogKiBDb3B5cmlnaHQgT3BlbkpTIEZvdW5kYXRpb24gYW5kIG90aGVyIGNvbnRyaWJ1dG9ycyA8aHR0cHM6Ly9vcGVuanNmLm9yZy8+CiAqIFJlbGVhc2VkIHVuZGVyIE1JVCBsaWNlbnNlIDxodHRwczovL2xvZGFzaC5jb20vbGljZW5zZT4KICogQmFzZWQgb24gVW5kZXJzY29yZS5qcyAxLjguMyA8aHR0cDovL3VuZGVyc2NvcmVqcy5vcmcvTElDRU5TRT4KICogQ29weXJpZ2h0IEplcmVteSBBc2hrZW5hcywgRG9jdW1lbnRDbG91ZCBhbmQgSW52ZXN0aWdhdGl2ZSBSZXBvcnRlcnMgJiBFZGl0b3JzCiAqLwo="; +const blob$2 = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs$2)], { type: "text/javascript;charset=utf-8" }); +function Worker$3() { + const objURL = blob$2 && (window.URL || window.webkitURL).createObjectURL(blob$2); + try { + return objURL ? new Worker(objURL) : new Worker("data:application/javascript;base64," + encodedJs$2, { type: "module" }); + } finally { + objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL); + } +} +const DEBOUNCE_TIME$2 = 200; +class VcfDataFetcher { + constructor(HGC, config2) { + __publicField(this, "dataConfig", {}); + // required for higlass + __publicField(this, "uid"); + __publicField(this, "prevRequestTime"); + __publicField(this, "track"); + __publicField(this, "toFetch"); + __publicField(this, "fetchTimeout"); + __publicField(this, "worker"); + this.uid = HGC.libraries.slugid.nice(); + this.prevRequestTime = 0; + this.toFetch = /* @__PURE__ */ new Set(); + const { url, indexUrl, assembly, ...options } = config2; + this.worker = spawn(new Worker$3()).then(async (worker) => { + const chromSizes = Object.entries(computeChromSizes(assembly).size); + await worker.init(this.uid, { url, indexUrl }, chromSizes, options); + return worker; + }); + } + /* + * Collect Tileset Information, such as tile size and genomic positions + */ + async tilesetInfo(callback) { + (await this.worker).tilesetInfo(this.uid).then(callback); + } + fetchTilesDebounced(receivedTiles, tileIds) { + this.track.drawLoadingCue(); + tileIds.forEach((tileId) => this.toFetch.add(tileId)); + if (this.fetchTimeout) { + clearTimeout(this.fetchTimeout); + } + this.fetchTimeout = setTimeout(() => { + this.sendFetch(receivedTiles, [...this.toFetch]); + this.toFetch.clear(); + }, DEBOUNCE_TIME$2); + } + async sendFetch(receivedTiles, tileIds) { + (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles); + } + async getTabularData(tileIds) { + const buf = await (await this.worker).getTabularData(this.uid, tileIds); + return JSON.parse(new TextDecoder().decode(buf)); + } +} +__publicField(VcfDataFetcher, "config", { type: "vcf" }); +const BigInt32 = BigInt(32); +function getBigInt64(dataView, byteOffset, littleEndian) { + const littleEndianMask = Number(!!littleEndian); + const bigEndianMask = Number(!littleEndian); + return BigInt(dataView.getInt32(byteOffset, littleEndian) * bigEndianMask + dataView.getInt32(byteOffset + 4, littleEndian) * littleEndianMask) << BigInt32 | BigInt(dataView.getUint32(byteOffset, littleEndian) * littleEndianMask + dataView.getUint32(byteOffset + 4, littleEndian) * bigEndianMask); +} +function getBigUint64(dataView, byteOffset, littleEndian) { + const a = dataView.getUint32(byteOffset, littleEndian); + const b = dataView.getUint32(byteOffset + 4, littleEndian); + const littleEndianMask = Number(!!littleEndian); + const bigEndianMask = Number(!littleEndian); + return BigInt(a * bigEndianMask + b * littleEndianMask) << BigInt32 | BigInt(a * littleEndianMask + b * bigEndianMask); +} +function setBigInt64(dataView, byteOffset, value, littleEndian) { + const hi = Number(value >> BigInt32); + const lo = Number(value & BigInt(4294967295)); + if (littleEndian) { + dataView.setInt32(byteOffset + 4, hi, littleEndian); + dataView.setUint32(byteOffset, lo, littleEndian); + } else { + dataView.setInt32(byteOffset, hi, littleEndian); + dataView.setUint32(byteOffset + 4, lo, littleEndian); + } +} +function setBigUint64(dataView, byteOffset, value, littleEndian) { + const hi = Number(value >> BigInt32); + const lo = Number(value & BigInt(4294967295)); + if (littleEndian) { + dataView.setUint32(byteOffset + 4, hi, littleEndian); + dataView.setUint32(byteOffset, lo, littleEndian); + } else { + dataView.setUint32(byteOffset, hi, littleEndian); + dataView.setUint32(byteOffset + 4, lo, littleEndian); + } +} +if (!("getBigInt64" in DataView)) { + DataView.prototype.getBigInt64 = function(byteOffset, littleEndian) { + return getBigInt64(this, byteOffset, littleEndian); + }; +} +if (!("getBigUint64" in DataView)) { + DataView.prototype.getBigUint64 = function(byteOffset, littleEndian) { + return getBigUint64(this, byteOffset, littleEndian); + }; +} +if (!("setBigInt64" in DataView)) { + DataView.prototype.setBigInt64 = function(byteOffset, value, littleEndian) { + setBigInt64(this, byteOffset, value, littleEndian); + }; +} +if (!("setBigUint64" in DataView)) { + DataView.prototype.setBigUint64 = function(byteOffset, value, littleEndian) { + setBigUint64(this, byteOffset, value, littleEndian); + }; +} +class Context { + constructor(importPath, useContextVariables) { + this.code = ""; + this.scopes = [["vars"]]; + this.bitFields = []; + this.tmpVariableCount = 0; + this.references = /* @__PURE__ */ new Map(); + this.imports = []; + this.reverseImports = /* @__PURE__ */ new Map(); + this.useContextVariables = false; + this.importPath = importPath; + this.useContextVariables = useContextVariables; + } + generateVariable(name2) { + const scopes = [...this.scopes[this.scopes.length - 1]]; + if (name2) { + scopes.push(name2); + } + return scopes.join("."); + } + generateOption(val) { + switch (typeof val) { + case "number": + return val.toString(); + case "string": + return this.generateVariable(val); + case "function": + return `${this.addImport(val)}.call(${this.generateVariable()}, vars)`; + } + } + generateError(err2) { + this.pushCode(`throw new Error(${err2});`); + } + generateTmpVariable() { + return "$tmp" + this.tmpVariableCount++; + } + pushCode(code) { + this.code += code + "\n"; + } + pushPath(name2) { + if (name2) { + this.scopes[this.scopes.length - 1].push(name2); + } + } + popPath(name2) { + if (name2) { + this.scopes[this.scopes.length - 1].pop(); + } + } + pushScope(name2) { + this.scopes.push([name2]); + } + popScope() { + this.scopes.pop(); + } + addImport(im) { + if (!this.importPath) + return `(${im})`; + let id = this.reverseImports.get(im); + if (!id) { + id = this.imports.push(im) - 1; + this.reverseImports.set(im, id); + } + return `${this.importPath}[${id}]`; + } + addReference(alias) { + if (!this.references.has(alias)) { + this.references.set(alias, { resolved: false, requested: false }); + } + } + markResolved(alias) { + const reference = this.references.get(alias); + if (reference) { + reference.resolved = true; + } + } + markRequested(aliasList) { + aliasList.forEach((alias) => { + const reference = this.references.get(alias); + if (reference) { + reference.requested = true; + } + }); + } + getUnresolvedReferences() { + return Array.from(this.references).filter(([_, reference]) => !reference.resolved && !reference.requested).map(([alias, _]) => alias); + } +} +const aliasRegistry = /* @__PURE__ */ new Map(); +const FUNCTION_PREFIX = "___parser_"; +const PRIMITIVE_SIZES = { + uint8: 1, + uint16le: 2, + uint16be: 2, + uint32le: 4, + uint32be: 4, + int8: 1, + int16le: 2, + int16be: 2, + int32le: 4, + int32be: 4, + int64be: 8, + int64le: 8, + uint64be: 8, + uint64le: 8, + floatle: 4, + floatbe: 4, + doublele: 8, + doublebe: 8 +}; +const PRIMITIVE_NAMES = { + uint8: "Uint8", + uint16le: "Uint16", + uint16be: "Uint16", + uint32le: "Uint32", + uint32be: "Uint32", + int8: "Int8", + int16le: "Int16", + int16be: "Int16", + int32le: "Int32", + int32be: "Int32", + int64be: "BigInt64", + int64le: "BigInt64", + uint64be: "BigUint64", + uint64le: "BigUint64", + floatle: "Float32", + floatbe: "Float32", + doublele: "Float64", + doublebe: "Float64" +}; +const PRIMITIVE_LITTLE_ENDIANS = { + uint8: false, + uint16le: true, + uint16be: false, + uint32le: true, + uint32be: false, + int8: false, + int16le: true, + int16be: false, + int32le: true, + int32be: false, + int64be: false, + int64le: true, + uint64be: false, + uint64le: true, + floatle: true, + floatbe: false, + doublele: true, + doublebe: false +}; +class Parser { + constructor() { + this.varName = ""; + this.type = ""; + this.options = {}; + this.endian = "be"; + this.useContextVariables = false; + } + static start() { + return new Parser(); + } + primitiveGenerateN(type, ctx) { + const typeName = PRIMITIVE_NAMES[type]; + const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type]; + ctx.pushCode(`${ctx.generateVariable(this.varName)} = dataView.get${typeName}(offset, ${littleEndian});`); + ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`); + } + primitiveN(type, varName, options) { + return this.setNextParser(type, varName, options); + } + useThisEndian(type) { + return type + this.endian.toLowerCase(); + } + uint8(varName, options = {}) { + return this.primitiveN("uint8", varName, options); + } + uint16(varName, options = {}) { + return this.primitiveN(this.useThisEndian("uint16"), varName, options); + } + uint16le(varName, options = {}) { + return this.primitiveN("uint16le", varName, options); + } + uint16be(varName, options = {}) { + return this.primitiveN("uint16be", varName, options); + } + uint32(varName, options = {}) { + return this.primitiveN(this.useThisEndian("uint32"), varName, options); + } + uint32le(varName, options = {}) { + return this.primitiveN("uint32le", varName, options); + } + uint32be(varName, options = {}) { + return this.primitiveN("uint32be", varName, options); + } + int8(varName, options = {}) { + return this.primitiveN("int8", varName, options); + } + int16(varName, options = {}) { + return this.primitiveN(this.useThisEndian("int16"), varName, options); + } + int16le(varName, options = {}) { + return this.primitiveN("int16le", varName, options); + } + int16be(varName, options = {}) { + return this.primitiveN("int16be", varName, options); + } + int32(varName, options = {}) { + return this.primitiveN(this.useThisEndian("int32"), varName, options); + } + int32le(varName, options = {}) { + return this.primitiveN("int32le", varName, options); + } + int32be(varName, options = {}) { + return this.primitiveN("int32be", varName, options); + } + bigIntVersionCheck() { + if (!DataView.prototype.getBigInt64) + throw new Error("BigInt64 is unsupported on this runtime"); + } + int64(varName, options = {}) { + this.bigIntVersionCheck(); + return this.primitiveN(this.useThisEndian("int64"), varName, options); + } + int64be(varName, options = {}) { + this.bigIntVersionCheck(); + return this.primitiveN("int64be", varName, options); + } + int64le(varName, options = {}) { + this.bigIntVersionCheck(); + return this.primitiveN("int64le", varName, options); + } + uint64(varName, options = {}) { + this.bigIntVersionCheck(); + return this.primitiveN(this.useThisEndian("uint64"), varName, options); + } + uint64be(varName, options = {}) { + this.bigIntVersionCheck(); + return this.primitiveN("uint64be", varName, options); + } + uint64le(varName, options = {}) { + this.bigIntVersionCheck(); + return this.primitiveN("uint64le", varName, options); + } + floatle(varName, options = {}) { + return this.primitiveN("floatle", varName, options); + } + floatbe(varName, options = {}) { + return this.primitiveN("floatbe", varName, options); + } + doublele(varName, options = {}) { + return this.primitiveN("doublele", varName, options); + } + doublebe(varName, options = {}) { + return this.primitiveN("doublebe", varName, options); + } + bitN(size, varName, options) { + options.length = size; + return this.setNextParser("bit", varName, options); + } + bit1(varName, options = {}) { + return this.bitN(1, varName, options); + } + bit2(varName, options = {}) { + return this.bitN(2, varName, options); + } + bit3(varName, options = {}) { + return this.bitN(3, varName, options); + } + bit4(varName, options = {}) { + return this.bitN(4, varName, options); + } + bit5(varName, options = {}) { + return this.bitN(5, varName, options); + } + bit6(varName, options = {}) { + return this.bitN(6, varName, options); + } + bit7(varName, options = {}) { + return this.bitN(7, varName, options); + } + bit8(varName, options = {}) { + return this.bitN(8, varName, options); + } + bit9(varName, options = {}) { + return this.bitN(9, varName, options); + } + bit10(varName, options = {}) { + return this.bitN(10, varName, options); + } + bit11(varName, options = {}) { + return this.bitN(11, varName, options); + } + bit12(varName, options = {}) { + return this.bitN(12, varName, options); + } + bit13(varName, options = {}) { + return this.bitN(13, varName, options); + } + bit14(varName, options = {}) { + return this.bitN(14, varName, options); + } + bit15(varName, options = {}) { + return this.bitN(15, varName, options); + } + bit16(varName, options = {}) { + return this.bitN(16, varName, options); + } + bit17(varName, options = {}) { + return this.bitN(17, varName, options); + } + bit18(varName, options = {}) { + return this.bitN(18, varName, options); + } + bit19(varName, options = {}) { + return this.bitN(19, varName, options); + } + bit20(varName, options = {}) { + return this.bitN(20, varName, options); + } + bit21(varName, options = {}) { + return this.bitN(21, varName, options); + } + bit22(varName, options = {}) { + return this.bitN(22, varName, options); + } + bit23(varName, options = {}) { + return this.bitN(23, varName, options); + } + bit24(varName, options = {}) { + return this.bitN(24, varName, options); + } + bit25(varName, options = {}) { + return this.bitN(25, varName, options); + } + bit26(varName, options = {}) { + return this.bitN(26, varName, options); + } + bit27(varName, options = {}) { + return this.bitN(27, varName, options); + } + bit28(varName, options = {}) { + return this.bitN(28, varName, options); + } + bit29(varName, options = {}) { + return this.bitN(29, varName, options); + } + bit30(varName, options = {}) { + return this.bitN(30, varName, options); + } + bit31(varName, options = {}) { + return this.bitN(31, varName, options); + } + bit32(varName, options = {}) { + return this.bitN(32, varName, options); + } + namely(alias) { + aliasRegistry.set(alias, this); + this.alias = alias; + return this; + } + skip(length, options = {}) { + return this.seek(length, options); + } + seek(relOffset, options = {}) { + if (options.assert) { + throw new Error("assert option on seek is not allowed."); + } + return this.setNextParser("seek", "", { length: relOffset }); + } + string(varName, options) { + if (!options.zeroTerminated && !options.length && !options.greedy) { + throw new Error("One of length, zeroTerminated, or greedy must be defined for string."); + } + if ((options.zeroTerminated || options.length) && options.greedy) { + throw new Error("greedy is mutually exclusive with length and zeroTerminated for string."); + } + if (options.stripNull && !(options.length || options.greedy)) { + throw new Error("length or greedy must be defined if stripNull is enabled."); + } + options.encoding = options.encoding || "utf8"; + return this.setNextParser("string", varName, options); + } + buffer(varName, options) { + if (!options.length && !options.readUntil) { + throw new Error("length or readUntil must be defined for buffer."); + } + return this.setNextParser("buffer", varName, options); + } + wrapped(varName, options) { + if (typeof options !== "object" && typeof varName === "object") { + options = varName; + varName = ""; + } + if (!options || !options.wrapper || !options.type) { + throw new Error("Both wrapper and type must be defined for wrapped."); + } + if (!options.length && !options.readUntil) { + throw new Error("length or readUntil must be defined for wrapped."); + } + return this.setNextParser("wrapper", varName, options); + } + array(varName, options) { + if (!options.readUntil && !options.length && !options.lengthInBytes) { + throw new Error("One of readUntil, length and lengthInBytes must be defined for array."); + } + if (!options.type) { + throw new Error("type is required for array."); + } + if (typeof options.type === "string" && !aliasRegistry.has(options.type) && !(options.type in PRIMITIVE_SIZES)) { + throw new Error(`Array element type "${options.type}" is unkown.`); + } + return this.setNextParser("array", varName, options); + } + choice(varName, options) { + if (typeof options !== "object" && typeof varName === "object") { + options = varName; + varName = ""; + } + if (!options) { + throw new Error("tag and choices are are required for choice."); + } + if (!options.tag) { + throw new Error("tag is requird for choice."); + } + if (!options.choices) { + throw new Error("choices is required for choice."); + } + for (const keyString in options.choices) { + const key = parseInt(keyString, 10); + const value = options.choices[key]; + if (isNaN(key)) { + throw new Error(`Choice key "${keyString}" is not a number.`); + } + if (typeof value === "string" && !aliasRegistry.has(value) && !(value in PRIMITIVE_SIZES)) { + throw new Error(`Choice type "${value}" is unkown.`); + } + } + return this.setNextParser("choice", varName, options); + } + nest(varName, options) { + if (typeof options !== "object" && typeof varName === "object") { + options = varName; + varName = ""; + } + if (!options || !options.type) { + throw new Error("type is required for nest."); + } + if (!(options.type instanceof Parser) && !aliasRegistry.has(options.type)) { + throw new Error("type must be a known parser name or a Parser object."); + } + if (!(options.type instanceof Parser) && !varName) { + throw new Error("type must be a Parser object if the variable name is omitted."); + } + return this.setNextParser("nest", varName, options); + } + pointer(varName, options) { + if (!options.offset) { + throw new Error("offset is required for pointer."); + } + if (!options.type) { + throw new Error("type is required for pointer."); + } + if (typeof options.type === "string" && !(options.type in PRIMITIVE_SIZES) && !aliasRegistry.has(options.type)) { + throw new Error(`Pointer type "${options.type}" is unkown.`); + } + return this.setNextParser("pointer", varName, options); + } + saveOffset(varName, options = {}) { + return this.setNextParser("saveOffset", varName, options); + } + endianness(endianness) { + switch (endianness.toLowerCase()) { + case "little": + this.endian = "le"; + break; + case "big": + this.endian = "be"; + break; + default: + throw new Error('endianness must be one of "little" or "big"'); + } + return this; + } + endianess(endianess) { + return this.endianness(endianess); + } + useContextVars(useContextVariables = true) { + this.useContextVariables = useContextVariables; + return this; + } + create(constructorFn) { + if (!(constructorFn instanceof Function)) { + throw new Error("Constructor must be a Function object."); + } + this.constructorFn = constructorFn; + return this; + } + getContext(importPath) { + const ctx = new Context(importPath, this.useContextVariables); + ctx.pushCode("var dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);"); + if (!this.alias) { + this.addRawCode(ctx); + } else { + this.addAliasedCode(ctx); + ctx.pushCode(`return ${FUNCTION_PREFIX + this.alias}(0).result;`); + } + return ctx; + } + getCode() { + const importPath = "imports"; + return this.getContext(importPath).code; + } + addRawCode(ctx) { + ctx.pushCode("var offset = 0;"); + ctx.pushCode(`var vars = ${this.constructorFn ? "new constructorFn()" : "{}"};`); + ctx.pushCode("vars.$parent = null;"); + ctx.pushCode("vars.$root = vars;"); + this.generate(ctx); + this.resolveReferences(ctx); + ctx.pushCode("delete vars.$parent;"); + ctx.pushCode("delete vars.$root;"); + ctx.pushCode("return vars;"); + } + addAliasedCode(ctx) { + ctx.pushCode(`function ${FUNCTION_PREFIX + this.alias}(offset, context) {`); + ctx.pushCode(`var vars = ${this.constructorFn ? "new constructorFn()" : "{}"};`); + ctx.pushCode("var ctx = Object.assign({$parent: null, $root: vars}, context || {});"); + ctx.pushCode(`vars = Object.assign(vars, ctx);`); + this.generate(ctx); + ctx.markResolved(this.alias); + this.resolveReferences(ctx); + ctx.pushCode("Object.keys(ctx).forEach(function (item) { delete vars[item]; });"); + ctx.pushCode("return { offset: offset, result: vars };"); + ctx.pushCode("}"); + return ctx; + } + resolveReferences(ctx) { + const references = ctx.getUnresolvedReferences(); + ctx.markRequested(references); + references.forEach((alias) => { + var _a; + (_a = aliasRegistry.get(alias)) === null || _a === void 0 ? void 0 : _a.addAliasedCode(ctx); + }); + } + compile() { + const importPath = "imports"; + const ctx = this.getContext(importPath); + this.compiled = new Function(importPath, "TextDecoder", `return function (buffer, constructorFn) { ${ctx.code} };`)(ctx.imports, TextDecoder); + } + sizeOf() { + let size = NaN; + if (Object.keys(PRIMITIVE_SIZES).indexOf(this.type) >= 0) { + size = PRIMITIVE_SIZES[this.type]; + } else if (this.type === "string" && typeof this.options.length === "number") { + size = this.options.length; + } else if (this.type === "buffer" && typeof this.options.length === "number") { + size = this.options.length; + } else if (this.type === "array" && typeof this.options.length === "number") { + let elementSize = NaN; + if (typeof this.options.type === "string") { + elementSize = PRIMITIVE_SIZES[this.options.type]; + } else if (this.options.type instanceof Parser) { + elementSize = this.options.type.sizeOf(); + } + size = this.options.length * elementSize; + } else if (this.type === "seek") { + size = this.options.length; + } else if (this.type === "nest") { + size = this.options.type.sizeOf(); + } else if (!this.type) { + size = 0; + } + if (this.next) { + size += this.next.sizeOf(); + } + return size; + } + // Follow the parser chain till the root and start parsing from there + parse(buffer) { + if (!this.compiled) { + this.compile(); + } + return this.compiled(buffer, this.constructorFn); + } + setNextParser(type, varName, options) { + const parser = new Parser(); + parser.type = type; + parser.varName = varName; + parser.options = options; + parser.endian = this.endian; + if (this.head) { + this.head.next = parser; + } else { + this.next = parser; + } + this.head = parser; + return this; + } + // Call code generator for this parser + generate(ctx) { + if (this.type) { + switch (this.type) { + case "uint8": + case "uint16le": + case "uint16be": + case "uint32le": + case "uint32be": + case "int8": + case "int16le": + case "int16be": + case "int32le": + case "int32be": + case "int64be": + case "int64le": + case "uint64be": + case "uint64le": + case "floatle": + case "floatbe": + case "doublele": + case "doublebe": + this.primitiveGenerateN(this.type, ctx); + break; + case "bit": + this.generateBit(ctx); + break; + case "string": + this.generateString(ctx); + break; + case "buffer": + this.generateBuffer(ctx); + break; + case "seek": + this.generateSeek(ctx); + break; + case "nest": + this.generateNest(ctx); + break; + case "array": + this.generateArray(ctx); + break; + case "choice": + this.generateChoice(ctx); + break; + case "pointer": + this.generatePointer(ctx); + break; + case "saveOffset": + this.generateSaveOffset(ctx); + break; + case "wrapper": + this.generateWrapper(ctx); + break; + } + if (this.type !== "bit") + this.generateAssert(ctx); + } + const varName = ctx.generateVariable(this.varName); + if (this.options.formatter && this.type !== "bit") { + this.generateFormatter(ctx, varName, this.options.formatter); + } + return this.generateNext(ctx); + } + generateAssert(ctx) { + if (!this.options.assert) { + return; + } + const varName = ctx.generateVariable(this.varName); + switch (typeof this.options.assert) { + case "function": + { + const func = ctx.addImport(this.options.assert); + ctx.pushCode(`if (!${func}.call(vars, ${varName})) {`); + } + break; + case "number": + ctx.pushCode(`if (${this.options.assert} !== ${varName}) {`); + break; + case "string": + ctx.pushCode(`if (${JSON.stringify(this.options.assert)} !== ${varName}) {`); + break; + default: + throw new Error("assert option must be a string, number or a function."); + } + ctx.generateError(`"Assertion error: ${varName} is " + ${JSON.stringify(this.options.assert.toString())}`); + ctx.pushCode("}"); + } + // Recursively call code generators and append results + generateNext(ctx) { + if (this.next) { + ctx = this.next.generate(ctx); + } + return ctx; + } + generateBit(ctx) { + const parser = JSON.parse(JSON.stringify(this)); + parser.options = this.options; + parser.generateAssert = this.generateAssert.bind(this); + parser.generateFormatter = this.generateFormatter.bind(this); + parser.varName = ctx.generateVariable(parser.varName); + ctx.bitFields.push(parser); + if (!this.next || this.next && ["bit", "nest"].indexOf(this.next.type) < 0) { + const val = ctx.generateTmpVariable(); + ctx.pushCode(`var ${val} = 0;`); + const getMaxBits = (from = 0) => { + let sum3 = 0; + for (let i = from; i < ctx.bitFields.length; i++) { + const length = ctx.bitFields[i].options.length; + if (sum3 + length > 32) + break; + sum3 += length; + } + return sum3; + }; + const getBytes = (sum3) => { + if (sum3 <= 8) { + ctx.pushCode(`${val} = dataView.getUint8(offset);`); + sum3 = 8; + } else if (sum3 <= 16) { + ctx.pushCode(`${val} = dataView.getUint16(offset);`); + sum3 = 16; + } else if (sum3 <= 24) { + ctx.pushCode(`${val} = (dataView.getUint16(offset) << 8) | dataView.getUint8(offset + 2);`); + sum3 = 24; + } else { + ctx.pushCode(`${val} = dataView.getUint32(offset);`); + sum3 = 32; + } + ctx.pushCode(`offset += ${sum3 / 8};`); + return sum3; + }; + let bitOffset = 0; + const isBigEndian = this.endian === "be"; + let sum2 = 0; + let rem = 0; + ctx.bitFields.forEach((parser2, i) => { + let length = parser2.options.length; + if (length > rem) { + if (rem) { + const mask2 = -1 >>> 32 - rem; + ctx.pushCode(`${parser2.varName} = (${val} & 0x${mask2.toString(16)}) << ${length - rem};`); + length -= rem; + } + bitOffset = 0; + rem = sum2 = getBytes(getMaxBits(i) - rem); + } + const offset = isBigEndian ? sum2 - bitOffset - length : bitOffset; + const mask = -1 >>> 32 - length; + ctx.pushCode(`${parser2.varName} ${length < parser2.options.length ? "|=" : "="} ${val} >> ${offset} & 0x${mask.toString(16)};`); + if (parser2.options.length === 32) { + ctx.pushCode(`${parser2.varName} >>>= 0`); + } + if (parser2.options.assert) { + parser2.generateAssert(ctx); + } + if (parser2.options.formatter) { + parser2.generateFormatter(ctx, parser2.varName, parser2.options.formatter); + } + bitOffset += length; + rem -= length; + }); + ctx.bitFields = []; + } + } + generateSeek(ctx) { + const length = ctx.generateOption(this.options.length); + ctx.pushCode(`offset += ${length};`); + } + generateString(ctx) { + const name2 = ctx.generateVariable(this.varName); + const start = ctx.generateTmpVariable(); + const encoding = this.options.encoding; + const isHex = encoding.toLowerCase() === "hex"; + const toHex = 'b => b.toString(16).padStart(2, "0")'; + if (this.options.length && this.options.zeroTerminated) { + const len = this.options.length; + ctx.pushCode(`var ${start} = offset;`); + ctx.pushCode(`while(dataView.getUint8(offset++) !== 0 && offset - ${start} < ${len});`); + const end = `offset - ${start} < ${len} ? offset - 1 : offset`; + ctx.pushCode(isHex ? `${name2} = Array.from(buffer.subarray(${start}, ${end}), ${toHex}).join('');` : `${name2} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, ${end}));`); + } else if (this.options.length) { + const len = ctx.generateOption(this.options.length); + ctx.pushCode(isHex ? `${name2} = Array.from(buffer.subarray(offset, offset + ${len}), ${toHex}).join('');` : `${name2} = new TextDecoder('${encoding}').decode(buffer.subarray(offset, offset + ${len}));`); + ctx.pushCode(`offset += ${len};`); + } else if (this.options.zeroTerminated) { + ctx.pushCode(`var ${start} = offset;`); + ctx.pushCode("while(dataView.getUint8(offset++) !== 0);"); + ctx.pushCode(isHex ? `${name2} = Array.from(buffer.subarray(${start}, offset - 1), ${toHex}).join('');` : `${name2} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, offset - 1));`); + } else if (this.options.greedy) { + ctx.pushCode(`var ${start} = offset;`); + ctx.pushCode("while(buffer.length > offset++);"); + ctx.pushCode(isHex ? `${name2} = Array.from(buffer.subarray(${start}, offset), ${toHex}).join('');` : `${name2} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, offset));`); + } + if (this.options.stripNull) { + ctx.pushCode(`${name2} = ${name2}.replace(/\\x00+$/g, '')`); + } + } + generateBuffer(ctx) { + const varName = ctx.generateVariable(this.varName); + if (typeof this.options.readUntil === "function") { + const pred = this.options.readUntil; + const start = ctx.generateTmpVariable(); + const cur = ctx.generateTmpVariable(); + ctx.pushCode(`var ${start} = offset;`); + ctx.pushCode(`var ${cur} = 0;`); + ctx.pushCode(`while (offset < buffer.length) {`); + ctx.pushCode(`${cur} = dataView.getUint8(offset);`); + const func = ctx.addImport(pred); + ctx.pushCode(`if (${func}.call(${ctx.generateVariable()}, ${cur}, buffer.subarray(offset))) break;`); + ctx.pushCode(`offset += 1;`); + ctx.pushCode(`}`); + ctx.pushCode(`${varName} = buffer.subarray(${start}, offset);`); + } else if (this.options.readUntil === "eof") { + ctx.pushCode(`${varName} = buffer.subarray(offset);`); + } else { + const len = ctx.generateOption(this.options.length); + ctx.pushCode(`${varName} = buffer.subarray(offset, offset + ${len});`); + ctx.pushCode(`offset += ${len};`); + } + if (this.options.clone) { + ctx.pushCode(`${varName} = buffer.constructor.from(${varName});`); + } + } + generateArray(ctx) { + const length = ctx.generateOption(this.options.length); + const lengthInBytes = ctx.generateOption(this.options.lengthInBytes); + const type = this.options.type; + const counter = ctx.generateTmpVariable(); + const lhs = ctx.generateVariable(this.varName); + const item = ctx.generateTmpVariable(); + const key = this.options.key; + const isHash = typeof key === "string"; + if (isHash) { + ctx.pushCode(`${lhs} = {};`); + } else { + ctx.pushCode(`${lhs} = [];`); + } + if (typeof this.options.readUntil === "function") { + ctx.pushCode("do {"); + } else if (this.options.readUntil === "eof") { + ctx.pushCode(`for (var ${counter} = 0; offset < buffer.length; ${counter}++) {`); + } else if (lengthInBytes !== void 0) { + ctx.pushCode(`for (var ${counter} = offset + ${lengthInBytes}; offset < ${counter}; ) {`); + } else { + ctx.pushCode(`for (var ${counter} = ${length}; ${counter} > 0; ${counter}--) {`); + } + if (typeof type === "string") { + if (!aliasRegistry.get(type)) { + const typeName = PRIMITIVE_NAMES[type]; + const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type]; + ctx.pushCode(`var ${item} = dataView.get${typeName}(offset, ${littleEndian});`); + ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`); + } else { + const tempVar = ctx.generateTmpVariable(); + ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + type}(offset, {`); + if (ctx.useContextVariables) { + const parentVar = ctx.generateVariable(); + ctx.pushCode(`$parent: ${parentVar},`); + ctx.pushCode(`$root: ${parentVar}.$root,`); + if (!this.options.readUntil && lengthInBytes === void 0) { + ctx.pushCode(`$index: ${length} - ${counter},`); + } + } + ctx.pushCode(`});`); + ctx.pushCode(`var ${item} = ${tempVar}.result; offset = ${tempVar}.offset;`); + if (type !== this.alias) + ctx.addReference(type); + } + } else if (type instanceof Parser) { + ctx.pushCode(`var ${item} = {};`); + const parentVar = ctx.generateVariable(); + ctx.pushScope(item); + if (ctx.useContextVariables) { + ctx.pushCode(`${item}.$parent = ${parentVar};`); + ctx.pushCode(`${item}.$root = ${parentVar}.$root;`); + if (!this.options.readUntil && lengthInBytes === void 0) { + ctx.pushCode(`${item}.$index = ${length} - ${counter};`); + } + } + type.generate(ctx); + if (ctx.useContextVariables) { + ctx.pushCode(`delete ${item}.$parent;`); + ctx.pushCode(`delete ${item}.$root;`); + ctx.pushCode(`delete ${item}.$index;`); + } + ctx.popScope(); + } + if (isHash) { + ctx.pushCode(`${lhs}[${item}.${key}] = ${item};`); + } else { + ctx.pushCode(`${lhs}.push(${item});`); + } + ctx.pushCode("}"); + if (typeof this.options.readUntil === "function") { + const pred = this.options.readUntil; + const func = ctx.addImport(pred); + ctx.pushCode(`while (!${func}.call(${ctx.generateVariable()}, ${item}, buffer.subarray(offset)));`); + } + } + generateChoiceCase(ctx, varName, type) { + if (typeof type === "string") { + const varName2 = ctx.generateVariable(this.varName); + if (!aliasRegistry.has(type)) { + const typeName = PRIMITIVE_NAMES[type]; + const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type]; + ctx.pushCode(`${varName2} = dataView.get${typeName}(offset, ${littleEndian});`); + ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]}`); + } else { + const tempVar = ctx.generateTmpVariable(); + ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + type}(offset, {`); + if (ctx.useContextVariables) { + ctx.pushCode(`$parent: ${varName2}.$parent,`); + ctx.pushCode(`$root: ${varName2}.$root,`); + } + ctx.pushCode(`});`); + ctx.pushCode(`${varName2} = ${tempVar}.result; offset = ${tempVar}.offset;`); + if (type !== this.alias) + ctx.addReference(type); + } + } else if (type instanceof Parser) { + ctx.pushPath(varName); + type.generate(ctx); + ctx.popPath(varName); + } + } + generateChoice(ctx) { + const tag = ctx.generateOption(this.options.tag); + const nestVar = ctx.generateVariable(this.varName); + if (this.varName) { + ctx.pushCode(`${nestVar} = {};`); + if (ctx.useContextVariables) { + const parentVar = ctx.generateVariable(); + ctx.pushCode(`${nestVar}.$parent = ${parentVar};`); + ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`); + } + } + ctx.pushCode(`switch(${tag}) {`); + for (const tagString in this.options.choices) { + const tag2 = parseInt(tagString, 10); + const type = this.options.choices[tag2]; + ctx.pushCode(`case ${tag2}:`); + this.generateChoiceCase(ctx, this.varName, type); + ctx.pushCode("break;"); + } + ctx.pushCode("default:"); + if (this.options.defaultChoice) { + this.generateChoiceCase(ctx, this.varName, this.options.defaultChoice); + } else { + ctx.generateError(`"Met undefined tag value " + ${tag} + " at choice"`); + } + ctx.pushCode("}"); + if (this.varName && ctx.useContextVariables) { + ctx.pushCode(`delete ${nestVar}.$parent;`); + ctx.pushCode(`delete ${nestVar}.$root;`); + } + } + generateNest(ctx) { + const nestVar = ctx.generateVariable(this.varName); + if (this.options.type instanceof Parser) { + if (this.varName) { + ctx.pushCode(`${nestVar} = {};`); + if (ctx.useContextVariables) { + const parentVar = ctx.generateVariable(); + ctx.pushCode(`${nestVar}.$parent = ${parentVar};`); + ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`); + } + } + ctx.pushPath(this.varName); + this.options.type.generate(ctx); + ctx.popPath(this.varName); + if (this.varName && ctx.useContextVariables) { + if (ctx.useContextVariables) { + ctx.pushCode(`delete ${nestVar}.$parent;`); + ctx.pushCode(`delete ${nestVar}.$root;`); + } + } + } else if (aliasRegistry.has(this.options.type)) { + const tempVar = ctx.generateTmpVariable(); + ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + this.options.type}(offset, {`); + if (ctx.useContextVariables) { + const parentVar = ctx.generateVariable(); + ctx.pushCode(`$parent: ${parentVar},`); + ctx.pushCode(`$root: ${parentVar}.$root,`); + } + ctx.pushCode(`});`); + ctx.pushCode(`${nestVar} = ${tempVar}.result; offset = ${tempVar}.offset;`); + if (this.options.type !== this.alias) { + ctx.addReference(this.options.type); + } + } + } + generateWrapper(ctx) { + const wrapperVar = ctx.generateVariable(this.varName); + const wrappedBuf = ctx.generateTmpVariable(); + if (typeof this.options.readUntil === "function") { + const pred = this.options.readUntil; + const start = ctx.generateTmpVariable(); + const cur = ctx.generateTmpVariable(); + ctx.pushCode(`var ${start} = offset;`); + ctx.pushCode(`var ${cur} = 0;`); + ctx.pushCode(`while (offset < buffer.length) {`); + ctx.pushCode(`${cur} = dataView.getUint8(offset);`); + const func2 = ctx.addImport(pred); + ctx.pushCode(`if (${func2}.call(${ctx.generateVariable()}, ${cur}, buffer.subarray(offset))) break;`); + ctx.pushCode(`offset += 1;`); + ctx.pushCode(`}`); + ctx.pushCode(`${wrappedBuf} = buffer.subarray(${start}, offset);`); + } else if (this.options.readUntil === "eof") { + ctx.pushCode(`${wrappedBuf} = buffer.subarray(offset);`); + } else { + const len = ctx.generateOption(this.options.length); + ctx.pushCode(`${wrappedBuf} = buffer.subarray(offset, offset + ${len});`); + ctx.pushCode(`offset += ${len};`); + } + if (this.options.clone) { + ctx.pushCode(`${wrappedBuf} = buffer.constructor.from(${wrappedBuf});`); + } + const tempBuf = ctx.generateTmpVariable(); + const tempOff = ctx.generateTmpVariable(); + const tempView = ctx.generateTmpVariable(); + const func = ctx.addImport(this.options.wrapper); + ctx.pushCode(`${wrappedBuf} = ${func}.call(this, ${wrappedBuf}).subarray(0);`); + ctx.pushCode(`var ${tempBuf} = buffer;`); + ctx.pushCode(`var ${tempOff} = offset;`); + ctx.pushCode(`var ${tempView} = dataView;`); + ctx.pushCode(`buffer = ${wrappedBuf};`); + ctx.pushCode(`offset = 0;`); + ctx.pushCode(`dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);`); + if (this.options.type instanceof Parser) { + if (this.varName) { + ctx.pushCode(`${wrapperVar} = {};`); + } + ctx.pushPath(this.varName); + this.options.type.generate(ctx); + ctx.popPath(this.varName); + } else if (aliasRegistry.has(this.options.type)) { + const tempVar = ctx.generateTmpVariable(); + ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + this.options.type}(0);`); + ctx.pushCode(`${wrapperVar} = ${tempVar}.result;`); + if (this.options.type !== this.alias) { + ctx.addReference(this.options.type); + } + } + ctx.pushCode(`buffer = ${tempBuf};`); + ctx.pushCode(`dataView = ${tempView};`); + ctx.pushCode(`offset = ${tempOff};`); + } + generateFormatter(ctx, varName, formatter) { + if (typeof formatter === "function") { + const func = ctx.addImport(formatter); + ctx.pushCode(`${varName} = ${func}.call(${ctx.generateVariable()}, ${varName});`); + } + } + generatePointer(ctx) { + const type = this.options.type; + const offset = ctx.generateOption(this.options.offset); + const tempVar = ctx.generateTmpVariable(); + const nestVar = ctx.generateVariable(this.varName); + ctx.pushCode(`var ${tempVar} = offset;`); + ctx.pushCode(`offset = ${offset};`); + if (this.options.type instanceof Parser) { + ctx.pushCode(`${nestVar} = {};`); + if (ctx.useContextVariables) { + const parentVar = ctx.generateVariable(); + ctx.pushCode(`${nestVar}.$parent = ${parentVar};`); + ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`); + } + ctx.pushPath(this.varName); + this.options.type.generate(ctx); + ctx.popPath(this.varName); + if (ctx.useContextVariables) { + ctx.pushCode(`delete ${nestVar}.$parent;`); + ctx.pushCode(`delete ${nestVar}.$root;`); + } + } else if (aliasRegistry.has(this.options.type)) { + const tempVar2 = ctx.generateTmpVariable(); + ctx.pushCode(`var ${tempVar2} = ${FUNCTION_PREFIX + this.options.type}(offset, {`); + if (ctx.useContextVariables) { + const parentVar = ctx.generateVariable(); + ctx.pushCode(`$parent: ${parentVar},`); + ctx.pushCode(`$root: ${parentVar}.$root,`); + } + ctx.pushCode(`});`); + ctx.pushCode(`${nestVar} = ${tempVar2}.result; offset = ${tempVar2}.offset;`); + if (this.options.type !== this.alias) { + ctx.addReference(this.options.type); + } + } else if (Object.keys(PRIMITIVE_SIZES).indexOf(this.options.type) >= 0) { + const typeName = PRIMITIVE_NAMES[type]; + const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type]; + ctx.pushCode(`${nestVar} = dataView.get${typeName}(offset, ${littleEndian});`); + ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`); + } + ctx.pushCode(`offset = ${tempVar};`); + } + generateSaveOffset(ctx) { + const varName = ctx.generateVariable(this.varName); + ctx.pushCode(`${varName} = offset`); + } +} +var esm = {}; +var AbortablePromiseCache$1 = {}; +var abortcontrollerPonyfill = {}; +var cjsPonyfill = {}; +Object.defineProperty(cjsPonyfill, "__esModule", { value: true }); +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) + _defineProperties(Constructor.prototype, protoProps); + if (staticProps) + _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; +} +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) + _setPrototypeOf(subClass, superClass); +} +function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) { + return o2.__proto__ || Object.getPrototypeOf(o2); + }; + return _getPrototypeOf(o); +} +function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) { + o2.__proto__ = p2; + return o2; + }; + return _setPrototypeOf(o, p); +} +function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) + return false; + if (Reflect.construct.sham) + return false; + if (typeof Proxy === "function") + return true; + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { + })); + return true; + } catch (e) { + return false; + } +} +function _assertThisInitialized(self2) { + if (self2 === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + return self2; +} +function _possibleConstructorReturn(self2, call) { + if (call && (typeof call === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + return _assertThisInitialized(self2); +} +function _createSuper(Derived) { + var hasNativeReflectConstruct = _isNativeReflectConstruct(); + return function _createSuperInternal() { + var Super = _getPrototypeOf(Derived), result; + if (hasNativeReflectConstruct) { + var NewTarget = _getPrototypeOf(this).constructor; + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + return _possibleConstructorReturn(this, result); + }; +} +function _superPropBase(object, property) { + while (!Object.prototype.hasOwnProperty.call(object, property)) { + object = _getPrototypeOf(object); + if (object === null) + break; + } + return object; +} +function _get() { + if (typeof Reflect !== "undefined" && Reflect.get) { + _get = Reflect.get.bind(); + } else { + _get = function _get2(target, property, receiver) { + var base = _superPropBase(target, property); + if (!base) + return; + var desc = Object.getOwnPropertyDescriptor(base, property); + if (desc.get) { + return desc.get.call(arguments.length < 3 ? target : receiver); + } + return desc.value; + }; + } + return _get.apply(this, arguments); +} +var Emitter = /* @__PURE__ */ function() { + function Emitter2() { + _classCallCheck(this, Emitter2); + Object.defineProperty(this, "listeners", { + value: {}, + writable: true, + configurable: true + }); + } + _createClass(Emitter2, [{ + key: "addEventListener", + value: function addEventListener(type, callback, options) { + if (!(type in this.listeners)) { + this.listeners[type] = []; + } + this.listeners[type].push({ + callback, + options + }); + } + }, { + key: "removeEventListener", + value: function removeEventListener(type, callback) { + if (!(type in this.listeners)) { + return; + } + var stack = this.listeners[type]; + for (var i = 0, l = stack.length; i < l; i++) { + if (stack[i].callback === callback) { + stack.splice(i, 1); + return; + } + } + } + }, { + key: "dispatchEvent", + value: function dispatchEvent(event) { + if (!(event.type in this.listeners)) { + return; + } + var stack = this.listeners[event.type]; + var stackToCall = stack.slice(); + for (var i = 0, l = stackToCall.length; i < l; i++) { + var listener = stackToCall[i]; + try { + listener.callback.call(this, event); + } catch (e) { + Promise.resolve().then(function() { + throw e; + }); + } + if (listener.options && listener.options.once) { + this.removeEventListener(event.type, listener.callback); + } + } + return !event.defaultPrevented; + } + }]); + return Emitter2; +}(); +var AbortSignal$1 = /* @__PURE__ */ function(_Emitter) { + _inherits(AbortSignal2, _Emitter); + var _super = _createSuper(AbortSignal2); + function AbortSignal2() { + var _this; + _classCallCheck(this, AbortSignal2); + _this = _super.call(this); + if (!_this.listeners) { + Emitter.call(_assertThisInitialized(_this)); + } + Object.defineProperty(_assertThisInitialized(_this), "aborted", { + value: false, + writable: true, + configurable: true + }); + Object.defineProperty(_assertThisInitialized(_this), "onabort", { + value: null, + writable: true, + configurable: true + }); + Object.defineProperty(_assertThisInitialized(_this), "reason", { + value: void 0, + writable: true, + configurable: true + }); + return _this; + } + _createClass(AbortSignal2, [{ + key: "toString", + value: function toString2() { + return "[object AbortSignal]"; + } + }, { + key: "dispatchEvent", + value: function dispatchEvent(event) { + if (event.type === "abort") { + this.aborted = true; + if (typeof this.onabort === "function") { + this.onabort.call(this, event); + } + } + _get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event); + } + }]); + return AbortSignal2; +}(Emitter); +var AbortController$1 = /* @__PURE__ */ function() { + function AbortController2() { + _classCallCheck(this, AbortController2); + Object.defineProperty(this, "signal", { + value: new AbortSignal$1(), + writable: true, + configurable: true + }); + } + _createClass(AbortController2, [{ + key: "abort", + value: function abort(reason) { + var event; + try { + event = new Event("abort"); + } catch (e) { + if (typeof document !== "undefined") { + if (!document.createEvent) { + event = document.createEventObject(); + event.type = "abort"; + } else { + event = document.createEvent("Event"); + event.initEvent("abort", false, false); + } + } else { + event = { + type: "abort", + bubbles: false, + cancelable: false + }; + } + } + var signalReason = reason; + if (signalReason === void 0) { + if (typeof document === "undefined") { + signalReason = new Error("This operation was aborted"); + signalReason.name = "AbortError"; + } else { + try { + signalReason = new DOMException("signal is aborted without reason"); + } catch (err2) { + signalReason = new Error("This operation was aborted"); + signalReason.name = "AbortError"; + } + } + } + this.signal.reason = signalReason; + this.signal.dispatchEvent(event); + } + }, { + key: "toString", + value: function toString2() { + return "[object AbortController]"; + } + }]); + return AbortController2; +}(); +if (typeof Symbol !== "undefined" && Symbol.toStringTag) { + AbortController$1.prototype[Symbol.toStringTag] = "AbortController"; + AbortSignal$1.prototype[Symbol.toStringTag] = "AbortSignal"; +} +function polyfillNeeded(self2) { + if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) { + console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"); + return true; + } + return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController; +} +function abortableFetchDecorator(patchTargets) { + if ("function" === typeof patchTargets) { + patchTargets = { + fetch: patchTargets + }; + } + var _patchTargets = patchTargets, fetch = _patchTargets.fetch, _patchTargets$Request = _patchTargets.Request, NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request, NativeAbortController = _patchTargets.AbortController, _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL, __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE; + if (!polyfillNeeded({ + fetch, + Request: NativeRequest, + AbortController: NativeAbortController, + __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL + })) { + return { + fetch, + Request + }; + } + var Request = NativeRequest; + if (Request && !Request.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) { + Request = function Request2(input, init2) { + var signal; + if (init2 && init2.signal) { + signal = init2.signal; + delete init2.signal; + } + var request = new NativeRequest(input, init2); + if (signal) { + Object.defineProperty(request, "signal", { + writable: false, + enumerable: false, + configurable: true, + value: signal + }); + } + return request; + }; + Request.prototype = NativeRequest.prototype; + } + var realFetch = fetch; + var abortableFetch = function abortableFetch2(input, init2) { + var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0; + if (signal) { + var abortError; + try { + abortError = new DOMException("Aborted", "AbortError"); + } catch (err2) { + abortError = new Error("Aborted"); + abortError.name = "AbortError"; + } + if (signal.aborted) { + return Promise.reject(abortError); + } + var cancellation = new Promise(function(_, reject) { + signal.addEventListener("abort", function() { + return reject(abortError); + }, { + once: true + }); + }); + if (init2 && init2.signal) { + delete init2.signal; + } + return Promise.race([cancellation, realFetch(input, init2)]); + } + return realFetch(input, init2); + }; + return { + fetch: abortableFetch, + Request + }; +} +cjsPonyfill.AbortController = AbortController$1; +cjsPonyfill.AbortSignal = AbortSignal$1; +cjsPonyfill.abortableFetch = abortableFetchDecorator; +Object.defineProperty(abortcontrollerPonyfill, "__esModule", { value: true }); +abortcontrollerPonyfill.AbortSignal = abortcontrollerPonyfill.AbortController = void 0; +const cjs_ponyfill_1 = cjsPonyfill; +var getGlobal = function() { + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof commonjsGlobal !== "undefined") { + return commonjsGlobal; + } + throw new Error("unable to locate global object"); +}; +let AbortController = typeof getGlobal().AbortController === "undefined" ? cjs_ponyfill_1.AbortController : getGlobal().AbortController; +abortcontrollerPonyfill.AbortController = AbortController; +let AbortSignal = typeof getGlobal().AbortController === "undefined" ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal; +abortcontrollerPonyfill.AbortSignal = AbortSignal; +var AggregateAbortController$1 = {}; +Object.defineProperty(AggregateAbortController$1, "__esModule", { value: true }); +const abortcontroller_ponyfill_1$1 = abortcontrollerPonyfill; +class NullSignal { +} +class AggregateAbortController { + constructor() { + this.signals = /* @__PURE__ */ new Set(); + this.abortController = new abortcontroller_ponyfill_1$1.AbortController(); + } + /** + * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy, + * will be treated as a null-signal, and this abortcontroller will no + * longer be abortable. + */ + //@ts-ignore + addSignal(signal = new NullSignal()) { + if (this.signal.aborted) { + throw new Error("cannot add a signal, already aborted!"); + } + this.signals.add(signal); + if (signal.aborted) { + this.handleAborted(signal); + } else if (typeof signal.addEventListener === "function") { + signal.addEventListener("abort", () => { + this.handleAborted(signal); + }); + } + } + handleAborted(signal) { + this.signals.delete(signal); + if (this.signals.size === 0) { + this.abortController.abort(); + } + } + get signal() { + return this.abortController.signal; + } + abort() { + this.abortController.abort(); + } +} +AggregateAbortController$1.default = AggregateAbortController; +var AggregateStatusReporter$1 = {}; +Object.defineProperty(AggregateStatusReporter$1, "__esModule", { value: true }); +class AggregateStatusReporter { + constructor() { + this.callbacks = /* @__PURE__ */ new Set(); + } + addCallback(callback = () => { + }) { + this.callbacks.add(callback); + callback(this.currentMessage); + } + callback(message) { + this.currentMessage = message; + this.callbacks.forEach((elt) => { + elt(message); + }); + } +} +AggregateStatusReporter$1.default = AggregateStatusReporter; +var __importDefault$1 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; +}; +Object.defineProperty(AbortablePromiseCache$1, "__esModule", { value: true }); +const abortcontroller_ponyfill_1 = abortcontrollerPonyfill; +const AggregateAbortController_1 = __importDefault$1(AggregateAbortController$1); +const AggregateStatusReporter_1 = __importDefault$1(AggregateStatusReporter$1); +class AbortablePromiseCache { + constructor({ fill, cache }) { + if (typeof fill !== "function") { + throw new TypeError("must pass a fill function"); + } + if (typeof cache !== "object") { + throw new TypeError("must pass a cache object"); + } + if (typeof cache.get !== "function" || typeof cache.set !== "function" || typeof cache.delete !== "function") { + throw new TypeError("cache must implement get(key), set(key, val), and and delete(key)"); + } + this.cache = cache; + this.fillCallback = fill; + } + static isAbortException(exception) { + return ( + // DOMException + exception.name === "AbortError" || // standard-ish non-DOM abort exception + //@ts-ignore + exception.code === "ERR_ABORTED" || // stringified DOMException + exception.message === "AbortError: aborted" || // stringified standard-ish exception + exception.message === "Error: aborted" + ); + } + evict(key, entry) { + if (this.cache.get(key) === entry) { + this.cache.delete(key); + } + } + fill(key, data, signal, statusCallback) { + const aborter = new AggregateAbortController_1.default(); + const statusReporter = new AggregateStatusReporter_1.default(); + statusReporter.addCallback(statusCallback); + const newEntry = { + aborter, + promise: this.fillCallback(data, aborter.signal, (message) => { + statusReporter.callback(message); + }), + settled: false, + statusReporter, + get aborted() { + return this.aborter.signal.aborted; + } + }; + newEntry.aborter.addSignal(signal); + newEntry.aborter.signal.addEventListener("abort", () => { + if (!newEntry.settled) { + this.evict(key, newEntry); + } + }); + newEntry.promise.then(() => { + newEntry.settled = true; + }, () => { + newEntry.settled = true; + this.evict(key, newEntry); + }).catch((e) => { + console.error(e); + throw e; + }); + this.cache.set(key, newEntry); + } + static checkSinglePromise(promise, signal) { + function checkForSingleAbort() { + if (signal && signal.aborted) { + throw Object.assign(new Error("aborted"), { code: "ERR_ABORTED" }); + } + } + return promise.then((result) => { + checkForSingleAbort(); + return result; + }, (error) => { + checkForSingleAbort(); + throw error; + }); + } + has(key) { + return this.cache.has(key); + } + /** + * Callback for getting status of the pending async + * + * @callback statusCallback + * @param {any} status, current status string or message object + */ + /** + * @param {any} key cache key to use for this request + * @param {any} data data passed as the first argument to the fill callback + * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request + * @param {statusCallback} a callback to get the current status of a pending async operation + */ + get(key, data, signal, statusCallback) { + if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) { + throw new TypeError("second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?"); + } + const cacheEntry = this.cache.get(key); + if (cacheEntry) { + if (cacheEntry.aborted && !cacheEntry.settled) { + this.evict(key, cacheEntry); + return this.get(key, data, signal, statusCallback); + } + if (cacheEntry.settled) { + return cacheEntry.promise; + } + cacheEntry.aborter.addSignal(signal); + cacheEntry.statusReporter.addCallback(statusCallback); + return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal); + } + this.fill(key, data, signal, statusCallback); + return AbortablePromiseCache.checkSinglePromise( + //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix- + //eslint-disable-next-line @typescript-eslint/no-non-null-assertion + this.cache.get(key).promise, + signal + ); + } + /** + * delete the given entry from the cache. if it exists and its fill request has + * not yet settled, the fill will be signaled to abort. + * + * @param {any} key + */ + delete(key) { + const cachedEntry = this.cache.get(key); + if (cachedEntry) { + if (!cachedEntry.settled) { + cachedEntry.aborter.abort(); + } + this.cache.delete(key); + } + } + /** + * Clear all requests from the cache. Aborts any that have not settled. + * @returns {number} count of entries deleted + */ + clear() { + const keyIter = this.cache.keys(); + let deleteCount = 0; + for (let result = keyIter.next(); !result.done; result = keyIter.next()) { + this.delete(result.value); + deleteCount += 1; + } + return deleteCount; + } +} +AbortablePromiseCache$1.default = AbortablePromiseCache; +var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; +}; +Object.defineProperty(esm, "__esModule", { value: true }); +const AbortablePromiseCache_1 = __importDefault(AbortablePromiseCache$1); +var _default = esm.default = AbortablePromiseCache_1.default; +class Range { + constructor(arg1, arg2) { + this.ranges = arguments.length === 2 ? [{ min: arg1, max: arg2 }] : 0 in arg1 ? Object.assign({}, arg1) : [arg1]; + } + min() { + return this.ranges[0].min; + } + max() { + return this.ranges[this.ranges.length - 1].max; + } + contains(pos) { + for (let s = 0; s < this.ranges.length; s += 1) { + const r = this.ranges[s]; + if (r.min <= pos && r.max >= pos) { + return true; + } + } + return false; + } + isContiguous() { + return this.ranges.length > 1; + } + getRanges() { + return this.ranges.map((r) => new Range(r.min, r.max)); + } + toString() { + return this.ranges.map((r) => `[${r.min}-${r.max}]`).join(","); + } + union(s1) { + const ranges = this.getRanges().concat(s1.getRanges()).sort(this.rangeOrder); + const oranges = []; + let current = ranges[0]; + for (let i = 1; i < ranges.length; i += 1) { + const nxt = ranges[i]; + if (nxt.min() > current.max() + 1) { + oranges.push(current); + current = nxt; + } else if (nxt.max() > current.max()) { + current = new Range(current.min(), nxt.max()); + } + } + oranges.push(current); + if (oranges.length === 1) { + return oranges[0]; + } + return new Range(oranges); + } + intersection(arg) { + let s0 = this; + let s1 = arg; + const r0 = this.ranges(); + const r1 = s1.ranges(); + const l0 = r0.length; + const l1 = r1.length; + let i0 = 0; + let i1 = 0; + const or = []; + while (i0 < l0 && i1 < l1) { + s0 = r0[i0]; + s1 = r1[i1]; + const lapMin = Math.max(s0.min(), s1.min()); + const lapMax = Math.min(s0.max(), s1.max()); + if (lapMax >= lapMin) { + or.push(new Range(lapMin, lapMax)); + } + if (s0.max() > s1.max()) { + i1 += 1; + } else { + i0 += 1; + } + } + if (or.length === 0) { + throw new Error("found range of length 0"); + } + if (or.length === 1) { + return or[0]; + } + return new Range(or); + } + coverage() { + let tot = 0; + const rl = this.ranges(); + for (let ri = 0; ri < rl.length; ri += 1) { + const r = rl[ri]; + tot += r.max() - r.min() + 1; + } + return tot; + } + rangeOrder(tmpa, tmpb) { + let a = tmpa; + let b = tmpb; + if (arguments.length < 2) { + b = a; + a = this; + } + if (a.min() < b.min()) { + return -1; + } + if (a.min() > b.min()) { + return 1; + } + if (a.max() < b.max()) { + return -1; + } + if (b.max() > a.max()) { + return 1; + } + return 0; + } +} +/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */ +const Z_FIXED$1 = 4; +const Z_BINARY = 0; +const Z_TEXT = 1; +const Z_UNKNOWN$1 = 2; +function zero$1(buf) { + let len = buf.length; + while (--len >= 0) { + buf[len] = 0; + } +} +const STORED_BLOCK = 0; +const STATIC_TREES = 1; +const DYN_TREES = 2; +const MIN_MATCH$1 = 3; +const MAX_MATCH$1 = 258; +const LENGTH_CODES$1 = 29; +const LITERALS$1 = 256; +const L_CODES$1 = LITERALS$1 + 1 + LENGTH_CODES$1; +const D_CODES$1 = 30; +const BL_CODES$1 = 19; +const HEAP_SIZE$1 = 2 * L_CODES$1 + 1; +const MAX_BITS$1 = 15; +const Buf_size = 16; +const MAX_BL_BITS = 7; +const END_BLOCK = 256; +const REP_3_6 = 16; +const REPZ_3_10 = 17; +const REPZ_11_138 = 18; +const extra_lbits = ( + /* extra bits for each length code */ + new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]) +); +const extra_dbits = ( + /* extra bits for each distance code */ + new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]) +); +const extra_blbits = ( + /* extra bits for each bit length code */ + new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]) +); +const bl_order = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); +const DIST_CODE_LEN = 512; +const static_ltree = new Array((L_CODES$1 + 2) * 2); +zero$1(static_ltree); +const static_dtree = new Array(D_CODES$1 * 2); +zero$1(static_dtree); +const _dist_code = new Array(DIST_CODE_LEN); +zero$1(_dist_code); +const _length_code = new Array(MAX_MATCH$1 - MIN_MATCH$1 + 1); +zero$1(_length_code); +const base_length = new Array(LENGTH_CODES$1); +zero$1(base_length); +const base_dist = new Array(D_CODES$1); +zero$1(base_dist); +function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { + this.static_tree = static_tree; + this.extra_bits = extra_bits; + this.extra_base = extra_base; + this.elems = elems; + this.max_length = max_length; + this.has_stree = static_tree && static_tree.length; +} +let static_l_desc; +let static_d_desc; +let static_bl_desc; +function TreeDesc(dyn_tree, stat_desc) { + this.dyn_tree = dyn_tree; + this.max_code = 0; + this.stat_desc = stat_desc; +} +const d_code = (dist) => { + return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; +}; +const put_short = (s, w) => { + s.pending_buf[s.pending++] = w & 255; + s.pending_buf[s.pending++] = w >>> 8 & 255; +}; +const send_bits = (s, value, length) => { + if (s.bi_valid > Buf_size - length) { + s.bi_buf |= value << s.bi_valid & 65535; + put_short(s, s.bi_buf); + s.bi_buf = value >> Buf_size - s.bi_valid; + s.bi_valid += length - Buf_size; + } else { + s.bi_buf |= value << s.bi_valid & 65535; + s.bi_valid += length; + } +}; +const send_code = (s, c, tree) => { + send_bits( + s, + tree[c * 2], + tree[c * 2 + 1] + /*.Len*/ + ); +}; +const bi_reverse = (code, len) => { + let res = 0; + do { + res |= code & 1; + code >>>= 1; + res <<= 1; + } while (--len > 0); + return res >>> 1; +}; +const bi_flush = (s) => { + if (s.bi_valid === 16) { + put_short(s, s.bi_buf); + s.bi_buf = 0; + s.bi_valid = 0; + } else if (s.bi_valid >= 8) { + s.pending_buf[s.pending++] = s.bi_buf & 255; + s.bi_buf >>= 8; + s.bi_valid -= 8; + } +}; +const gen_bitlen = (s, desc) => { + const tree = desc.dyn_tree; + const max_code = desc.max_code; + const stree = desc.stat_desc.static_tree; + const has_stree = desc.stat_desc.has_stree; + const extra = desc.stat_desc.extra_bits; + const base = desc.stat_desc.extra_base; + const max_length = desc.stat_desc.max_length; + let h; + let n, m2; + let bits; + let xbits; + let f; + let overflow = 0; + for (bits = 0; bits <= MAX_BITS$1; bits++) { + s.bl_count[bits] = 0; + } + tree[s.heap[s.heap_max] * 2 + 1] = 0; + for (h = s.heap_max + 1; h < HEAP_SIZE$1; h++) { + n = s.heap[h]; + bits = tree[tree[n * 2 + 1] * 2 + 1] + 1; + if (bits > max_length) { + bits = max_length; + overflow++; + } + tree[n * 2 + 1] = bits; + if (n > max_code) { + continue; + } + s.bl_count[bits]++; + xbits = 0; + if (n >= base) { + xbits = extra[n - base]; + } + f = tree[n * 2]; + s.opt_len += f * (bits + xbits); + if (has_stree) { + s.static_len += f * (stree[n * 2 + 1] + xbits); + } + } + if (overflow === 0) { + return; + } + do { + bits = max_length - 1; + while (s.bl_count[bits] === 0) { + bits--; + } + s.bl_count[bits]--; + s.bl_count[bits + 1] += 2; + s.bl_count[max_length]--; + overflow -= 2; + } while (overflow > 0); + for (bits = max_length; bits !== 0; bits--) { + n = s.bl_count[bits]; + while (n !== 0) { + m2 = s.heap[--h]; + if (m2 > max_code) { + continue; + } + if (tree[m2 * 2 + 1] !== bits) { + s.opt_len += (bits - tree[m2 * 2 + 1]) * tree[m2 * 2]; + tree[m2 * 2 + 1] = bits; + } + n--; + } + } +}; +const gen_codes = (tree, max_code, bl_count) => { + const next_code = new Array(MAX_BITS$1 + 1); + let code = 0; + let bits; + let n; + for (bits = 1; bits <= MAX_BITS$1; bits++) { + code = code + bl_count[bits - 1] << 1; + next_code[bits] = code; + } + for (n = 0; n <= max_code; n++) { + let len = tree[n * 2 + 1]; + if (len === 0) { + continue; + } + tree[n * 2] = bi_reverse(next_code[len]++, len); + } +}; +const tr_static_init = () => { + let n; + let bits; + let length; + let code; + let dist; + const bl_count = new Array(MAX_BITS$1 + 1); + length = 0; + for (code = 0; code < LENGTH_CODES$1 - 1; code++) { + base_length[code] = length; + for (n = 0; n < 1 << extra_lbits[code]; n++) { + _length_code[length++] = code; + } + } + _length_code[length - 1] = code; + dist = 0; + for (code = 0; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < 1 << extra_dbits[code]; n++) { + _dist_code[dist++] = code; + } + } + dist >>= 7; + for (; code < D_CODES$1; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < 1 << extra_dbits[code] - 7; n++) { + _dist_code[256 + dist++] = code; + } + } + for (bits = 0; bits <= MAX_BITS$1; bits++) { + bl_count[bits] = 0; + } + n = 0; + while (n <= 143) { + static_ltree[n * 2 + 1] = 8; + n++; + bl_count[8]++; + } + while (n <= 255) { + static_ltree[n * 2 + 1] = 9; + n++; + bl_count[9]++; + } + while (n <= 279) { + static_ltree[n * 2 + 1] = 7; + n++; + bl_count[7]++; + } + while (n <= 287) { + static_ltree[n * 2 + 1] = 8; + n++; + bl_count[8]++; + } + gen_codes(static_ltree, L_CODES$1 + 1, bl_count); + for (n = 0; n < D_CODES$1; n++) { + static_dtree[n * 2 + 1] = 5; + static_dtree[n * 2] = bi_reverse(n, 5); + } + static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS$1 + 1, L_CODES$1, MAX_BITS$1); + static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES$1, MAX_BITS$1); + static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES$1, MAX_BL_BITS); +}; +const init_block = (s) => { + let n; + for (n = 0; n < L_CODES$1; n++) { + s.dyn_ltree[n * 2] = 0; + } + for (n = 0; n < D_CODES$1; n++) { + s.dyn_dtree[n * 2] = 0; + } + for (n = 0; n < BL_CODES$1; n++) { + s.bl_tree[n * 2] = 0; + } + s.dyn_ltree[END_BLOCK * 2] = 1; + s.opt_len = s.static_len = 0; + s.sym_next = s.matches = 0; +}; +const bi_windup = (s) => { + if (s.bi_valid > 8) { + put_short(s, s.bi_buf); + } else if (s.bi_valid > 0) { + s.pending_buf[s.pending++] = s.bi_buf; + } + s.bi_buf = 0; + s.bi_valid = 0; +}; +const smaller = (tree, n, m2, depth) => { + const _n2 = n * 2; + const _m2 = m2 * 2; + return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m2]; +}; +const pqdownheap = (s, tree, k) => { + const v = s.heap[k]; + let j = k << 1; + while (j <= s.heap_len) { + if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { + j++; + } + if (smaller(tree, v, s.heap[j], s.depth)) { + break; + } + s.heap[k] = s.heap[j]; + k = j; + j <<= 1; + } + s.heap[k] = v; +}; +const compress_block = (s, ltree, dtree) => { + let dist; + let lc; + let sx = 0; + let code; + let extra; + if (s.sym_next !== 0) { + do { + dist = s.pending_buf[s.sym_buf + sx++] & 255; + dist += (s.pending_buf[s.sym_buf + sx++] & 255) << 8; + lc = s.pending_buf[s.sym_buf + sx++]; + if (dist === 0) { + send_code(s, lc, ltree); + } else { + code = _length_code[lc]; + send_code(s, code + LITERALS$1 + 1, ltree); + extra = extra_lbits[code]; + if (extra !== 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); + } + dist--; + code = d_code(dist); + send_code(s, code, dtree); + extra = extra_dbits[code]; + if (extra !== 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); + } + } + } while (sx < s.sym_next); + } + send_code(s, END_BLOCK, ltree); +}; +const build_tree = (s, desc) => { + const tree = desc.dyn_tree; + const stree = desc.stat_desc.static_tree; + const has_stree = desc.stat_desc.has_stree; + const elems = desc.stat_desc.elems; + let n, m2; + let max_code = -1; + let node; + s.heap_len = 0; + s.heap_max = HEAP_SIZE$1; + for (n = 0; n < elems; n++) { + if (tree[n * 2] !== 0) { + s.heap[++s.heap_len] = max_code = n; + s.depth[n] = 0; + } else { + tree[n * 2 + 1] = 0; + } + } + while (s.heap_len < 2) { + node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0; + tree[node * 2] = 1; + s.depth[node] = 0; + s.opt_len--; + if (has_stree) { + s.static_len -= stree[node * 2 + 1]; + } + } + desc.max_code = max_code; + for (n = s.heap_len >> 1; n >= 1; n--) { + pqdownheap(s, tree, n); + } + node = elems; + do { + n = s.heap[ + 1 + /*SMALLEST*/ + ]; + s.heap[ + 1 + /*SMALLEST*/ + ] = s.heap[s.heap_len--]; + pqdownheap( + s, + tree, + 1 + /*SMALLEST*/ + ); + m2 = s.heap[ + 1 + /*SMALLEST*/ + ]; + s.heap[--s.heap_max] = n; + s.heap[--s.heap_max] = m2; + tree[node * 2] = tree[n * 2] + tree[m2 * 2]; + s.depth[node] = (s.depth[n] >= s.depth[m2] ? s.depth[n] : s.depth[m2]) + 1; + tree[n * 2 + 1] = tree[m2 * 2 + 1] = node; + s.heap[ + 1 + /*SMALLEST*/ + ] = node++; + pqdownheap( + s, + tree, + 1 + /*SMALLEST*/ + ); + } while (s.heap_len >= 2); + s.heap[--s.heap_max] = s.heap[ + 1 + /*SMALLEST*/ + ]; + gen_bitlen(s, desc); + gen_codes(tree, max_code, s.bl_count); +}; +const scan_tree = (s, tree, max_code) => { + let n; + let prevlen = -1; + let curlen; + let nextlen = tree[0 * 2 + 1]; + let count = 0; + let max_count = 7; + let min_count = 4; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + tree[(max_code + 1) * 2 + 1] = 65535; + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]; + if (++count < max_count && curlen === nextlen) { + continue; + } else if (count < min_count) { + s.bl_tree[curlen * 2] += count; + } else if (curlen !== 0) { + if (curlen !== prevlen) { + s.bl_tree[curlen * 2]++; + } + s.bl_tree[REP_3_6 * 2]++; + } else if (count <= 10) { + s.bl_tree[REPZ_3_10 * 2]++; + } else { + s.bl_tree[REPZ_11_138 * 2]++; + } + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + } else { + max_count = 7; + min_count = 4; + } + } +}; +const send_tree = (s, tree, max_code) => { + let n; + let prevlen = -1; + let curlen; + let nextlen = tree[0 * 2 + 1]; + let count = 0; + let max_count = 7; + let min_count = 4; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]; + if (++count < max_count && curlen === nextlen) { + continue; + } else if (count < min_count) { + do { + send_code(s, curlen, s.bl_tree); + } while (--count !== 0); + } else if (curlen !== 0) { + if (curlen !== prevlen) { + send_code(s, curlen, s.bl_tree); + count--; + } + send_code(s, REP_3_6, s.bl_tree); + send_bits(s, count - 3, 2); + } else if (count <= 10) { + send_code(s, REPZ_3_10, s.bl_tree); + send_bits(s, count - 3, 3); + } else { + send_code(s, REPZ_11_138, s.bl_tree); + send_bits(s, count - 11, 7); + } + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + } else { + max_count = 7; + min_count = 4; + } + } +}; +const build_bl_tree = (s) => { + let max_blindex; + scan_tree(s, s.dyn_ltree, s.l_desc.max_code); + scan_tree(s, s.dyn_dtree, s.d_desc.max_code); + build_tree(s, s.bl_desc); + for (max_blindex = BL_CODES$1 - 1; max_blindex >= 3; max_blindex--) { + if (s.bl_tree[bl_order[max_blindex] * 2 + 1] !== 0) { + break; + } + } + s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; + return max_blindex; +}; +const send_all_trees = (s, lcodes, dcodes, blcodes) => { + let rank2; + send_bits(s, lcodes - 257, 5); + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); + for (rank2 = 0; rank2 < blcodes; rank2++) { + send_bits(s, s.bl_tree[bl_order[rank2] * 2 + 1], 3); + } + send_tree(s, s.dyn_ltree, lcodes - 1); + send_tree(s, s.dyn_dtree, dcodes - 1); +}; +const detect_data_type = (s) => { + let block_mask = 4093624447; + let n; + for (n = 0; n <= 31; n++, block_mask >>>= 1) { + if (block_mask & 1 && s.dyn_ltree[n * 2] !== 0) { + return Z_BINARY; + } + } + if (s.dyn_ltree[9 * 2] !== 0 || s.dyn_ltree[10 * 2] !== 0 || s.dyn_ltree[13 * 2] !== 0) { + return Z_TEXT; + } + for (n = 32; n < LITERALS$1; n++) { + if (s.dyn_ltree[n * 2] !== 0) { + return Z_TEXT; + } + } + return Z_BINARY; +}; +let static_init_done = false; +const _tr_init$1 = (s) => { + if (!static_init_done) { + tr_static_init(); + static_init_done = true; + } + s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); + s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); + s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); + s.bi_buf = 0; + s.bi_valid = 0; + init_block(s); +}; +const _tr_stored_block$1 = (s, buf, stored_len, last) => { + send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); + bi_windup(s); + put_short(s, stored_len); + put_short(s, ~stored_len); + if (stored_len) { + s.pending_buf.set(s.window.subarray(buf, buf + stored_len), s.pending); + } + s.pending += stored_len; +}; +const _tr_align$1 = (s) => { + send_bits(s, STATIC_TREES << 1, 3); + send_code(s, END_BLOCK, static_ltree); + bi_flush(s); +}; +const _tr_flush_block$1 = (s, buf, stored_len, last) => { + let opt_lenb, static_lenb; + let max_blindex = 0; + if (s.level > 0) { + if (s.strm.data_type === Z_UNKNOWN$1) { + s.strm.data_type = detect_data_type(s); + } + build_tree(s, s.l_desc); + build_tree(s, s.d_desc); + max_blindex = build_bl_tree(s); + opt_lenb = s.opt_len + 3 + 7 >>> 3; + static_lenb = s.static_len + 3 + 7 >>> 3; + if (static_lenb <= opt_lenb) { + opt_lenb = static_lenb; + } + } else { + opt_lenb = static_lenb = stored_len + 5; + } + if (stored_len + 4 <= opt_lenb && buf !== -1) { + _tr_stored_block$1(s, buf, stored_len, last); + } else if (s.strategy === Z_FIXED$1 || static_lenb === opt_lenb) { + send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); + compress_block(s, static_ltree, static_dtree); + } else { + send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); + send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); + compress_block(s, s.dyn_ltree, s.dyn_dtree); + } + init_block(s); + if (last) { + bi_windup(s); + } +}; +const _tr_tally$1 = (s, dist, lc) => { + s.pending_buf[s.sym_buf + s.sym_next++] = dist; + s.pending_buf[s.sym_buf + s.sym_next++] = dist >> 8; + s.pending_buf[s.sym_buf + s.sym_next++] = lc; + if (dist === 0) { + s.dyn_ltree[lc * 2]++; + } else { + s.matches++; + dist--; + s.dyn_ltree[(_length_code[lc] + LITERALS$1 + 1) * 2]++; + s.dyn_dtree[d_code(dist) * 2]++; + } + return s.sym_next === s.sym_end; +}; +var _tr_init_1 = _tr_init$1; +var _tr_stored_block_1 = _tr_stored_block$1; +var _tr_flush_block_1 = _tr_flush_block$1; +var _tr_tally_1 = _tr_tally$1; +var _tr_align_1 = _tr_align$1; +var trees = { + _tr_init: _tr_init_1, + _tr_stored_block: _tr_stored_block_1, + _tr_flush_block: _tr_flush_block_1, + _tr_tally: _tr_tally_1, + _tr_align: _tr_align_1 +}; +const adler32 = (adler, buf, len, pos) => { + let s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n = 0; + while (len !== 0) { + n = len > 2e3 ? 2e3 : len; + len -= n; + do { + s1 = s1 + buf[pos++] | 0; + s2 = s2 + s1 | 0; + } while (--n); + s1 %= 65521; + s2 %= 65521; + } + return s1 | s2 << 16 | 0; +}; +var adler32_1 = adler32; +const makeTable = () => { + let c, table = []; + for (var n = 0; n < 256; n++) { + c = n; + for (var k = 0; k < 8; k++) { + c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1; + } + table[n] = c; + } + return table; +}; +const crcTable = new Uint32Array(makeTable()); +const crc32 = (crc, buf, len, pos) => { + const t = crcTable; + const end = pos + len; + crc ^= -1; + for (let i = pos; i < end; i++) { + crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 255]; + } + return crc ^ -1; +}; +var crc32_1 = crc32; +var messages = { + 2: "need dictionary", + /* Z_NEED_DICT 2 */ + 1: "stream end", + /* Z_STREAM_END 1 */ + 0: "", + /* Z_OK 0 */ + "-1": "file error", + /* Z_ERRNO (-1) */ + "-2": "stream error", + /* Z_STREAM_ERROR (-2) */ + "-3": "data error", + /* Z_DATA_ERROR (-3) */ + "-4": "insufficient memory", + /* Z_MEM_ERROR (-4) */ + "-5": "buffer error", + /* Z_BUF_ERROR (-5) */ + "-6": "incompatible version" + /* Z_VERSION_ERROR (-6) */ +}; +var constants$2 = { + /* Allowed flush values; see deflate() and inflate() below for details */ + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_TREES: 6, + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + //Z_VERSION_ERROR: -6, + /* compression levels */ + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + /* Possible values of the data_type field (though see inflate()) */ + Z_BINARY: 0, + Z_TEXT: 1, + //Z_ASCII: 1, // = Z_TEXT (deprecated) + Z_UNKNOWN: 2, + /* The deflate compression method */ + Z_DEFLATED: 8 + //Z_NULL: null // Use -1 or null inline, depending on var type +}; +const { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = trees; +const { + Z_NO_FLUSH: Z_NO_FLUSH$2, + Z_PARTIAL_FLUSH, + Z_FULL_FLUSH: Z_FULL_FLUSH$1, + Z_FINISH: Z_FINISH$3, + Z_BLOCK: Z_BLOCK$1, + Z_OK: Z_OK$3, + Z_STREAM_END: Z_STREAM_END$3, + Z_STREAM_ERROR: Z_STREAM_ERROR$2, + Z_DATA_ERROR: Z_DATA_ERROR$2, + Z_BUF_ERROR: Z_BUF_ERROR$1, + Z_DEFAULT_COMPRESSION: Z_DEFAULT_COMPRESSION$1, + Z_FILTERED, + Z_HUFFMAN_ONLY, + Z_RLE, + Z_FIXED, + Z_DEFAULT_STRATEGY: Z_DEFAULT_STRATEGY$1, + Z_UNKNOWN, + Z_DEFLATED: Z_DEFLATED$2 +} = constants$2; +const MAX_MEM_LEVEL = 9; +const MAX_WBITS$1 = 15; +const DEF_MEM_LEVEL = 8; +const LENGTH_CODES = 29; +const LITERALS = 256; +const L_CODES = LITERALS + 1 + LENGTH_CODES; +const D_CODES = 30; +const BL_CODES = 19; +const HEAP_SIZE = 2 * L_CODES + 1; +const MAX_BITS = 15; +const MIN_MATCH = 3; +const MAX_MATCH = 258; +const MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1; +const PRESET_DICT = 32; +const INIT_STATE = 42; +const GZIP_STATE = 57; +const EXTRA_STATE = 69; +const NAME_STATE = 73; +const COMMENT_STATE = 91; +const HCRC_STATE = 103; +const BUSY_STATE = 113; +const FINISH_STATE = 666; +const BS_NEED_MORE = 1; +const BS_BLOCK_DONE = 2; +const BS_FINISH_STARTED = 3; +const BS_FINISH_DONE = 4; +const OS_CODE = 3; +const err = (strm, errorCode) => { + strm.msg = messages[errorCode]; + return errorCode; +}; +const rank = (f) => { + return f * 2 - (f > 4 ? 9 : 0); +}; +const zero = (buf) => { + let len = buf.length; + while (--len >= 0) { + buf[len] = 0; + } +}; +const slide_hash = (s) => { + let n, m2; + let p; + let wsize = s.w_size; + n = s.hash_size; + p = n; + do { + m2 = s.head[--p]; + s.head[p] = m2 >= wsize ? m2 - wsize : 0; + } while (--n); + n = wsize; + p = n; + do { + m2 = s.prev[--p]; + s.prev[p] = m2 >= wsize ? m2 - wsize : 0; + } while (--n); +}; +let HASH_ZLIB = (s, prev, data) => (prev << s.hash_shift ^ data) & s.hash_mask; +let HASH = HASH_ZLIB; +const flush_pending = (strm) => { + const s = strm.state; + let len = s.pending; + if (len > strm.avail_out) { + len = strm.avail_out; + } + if (len === 0) { + return; + } + strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out); + strm.next_out += len; + s.pending_out += len; + strm.total_out += len; + strm.avail_out -= len; + s.pending -= len; + if (s.pending === 0) { + s.pending_out = 0; + } +}; +const flush_block_only = (s, last) => { + _tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last); + s.block_start = s.strstart; + flush_pending(s.strm); +}; +const put_byte = (s, b) => { + s.pending_buf[s.pending++] = b; +}; +const putShortMSB = (s, b) => { + s.pending_buf[s.pending++] = b >>> 8 & 255; + s.pending_buf[s.pending++] = b & 255; +}; +const read_buf = (strm, buf, start, size) => { + let len = strm.avail_in; + if (len > size) { + len = size; + } + if (len === 0) { + return 0; + } + strm.avail_in -= len; + buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start); + if (strm.state.wrap === 1) { + strm.adler = adler32_1(strm.adler, buf, len, start); + } else if (strm.state.wrap === 2) { + strm.adler = crc32_1(strm.adler, buf, len, start); + } + strm.next_in += len; + strm.total_in += len; + return len; +}; +const longest_match = (s, cur_match) => { + let chain_length = s.max_chain_length; + let scan = s.strstart; + let match; + let len; + let best_len = s.prev_length; + let nice_match = s.nice_match; + const limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0; + const _win = s.window; + const wmask = s.w_mask; + const prev = s.prev; + const strend = s.strstart + MAX_MATCH; + let scan_end1 = _win[scan + best_len - 1]; + let scan_end = _win[scan + best_len]; + if (s.prev_length >= s.good_match) { + chain_length >>= 2; + } + if (nice_match > s.lookahead) { + nice_match = s.lookahead; + } + do { + match = cur_match; + if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) { + continue; + } + scan += 2; + match++; + do { + } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend); + len = MAX_MATCH - (strend - scan); + scan = strend - MAX_MATCH; + if (len > best_len) { + s.match_start = cur_match; + best_len = len; + if (len >= nice_match) { + break; + } + scan_end1 = _win[scan + best_len - 1]; + scan_end = _win[scan + best_len]; + } + } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); + if (best_len <= s.lookahead) { + return best_len; + } + return s.lookahead; +}; +const fill_window = (s) => { + const _w_size = s.w_size; + let n, more, str; + do { + more = s.window_size - s.lookahead - s.strstart; + if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { + s.window.set(s.window.subarray(_w_size, _w_size + _w_size - more), 0); + s.match_start -= _w_size; + s.strstart -= _w_size; + s.block_start -= _w_size; + if (s.insert > s.strstart) { + s.insert = s.strstart; + } + slide_hash(s); + more += _w_size; + } + if (s.strm.avail_in === 0) { + break; + } + n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); + s.lookahead += n; + if (s.lookahead + s.insert >= MIN_MATCH) { + str = s.strstart - s.insert; + s.ins_h = s.window[str]; + s.ins_h = HASH(s, s.ins_h, s.window[str + 1]); + while (s.insert) { + s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]); + s.prev[str & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = str; + str++; + s.insert--; + if (s.lookahead + s.insert < MIN_MATCH) { + break; + } + } + } + } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); +}; +const deflate_stored = (s, flush) => { + let min_block = s.pending_buf_size - 5 > s.w_size ? s.w_size : s.pending_buf_size - 5; + let len, left, have, last = 0; + let used = s.strm.avail_in; + do { + len = 65535; + have = s.bi_valid + 42 >> 3; + if (s.strm.avail_out < have) { + break; + } + have = s.strm.avail_out - have; + left = s.strstart - s.block_start; + if (len > left + s.strm.avail_in) { + len = left + s.strm.avail_in; + } + if (len > have) { + len = have; + } + if (len < min_block && (len === 0 && flush !== Z_FINISH$3 || flush === Z_NO_FLUSH$2 || len !== left + s.strm.avail_in)) { + break; + } + last = flush === Z_FINISH$3 && len === left + s.strm.avail_in ? 1 : 0; + _tr_stored_block(s, 0, 0, last); + s.pending_buf[s.pending - 4] = len; + s.pending_buf[s.pending - 3] = len >> 8; + s.pending_buf[s.pending - 2] = ~len; + s.pending_buf[s.pending - 1] = ~len >> 8; + flush_pending(s.strm); + if (left) { + if (left > len) { + left = len; + } + s.strm.output.set(s.window.subarray(s.block_start, s.block_start + left), s.strm.next_out); + s.strm.next_out += left; + s.strm.avail_out -= left; + s.strm.total_out += left; + s.block_start += left; + len -= left; + } + if (len) { + read_buf(s.strm, s.strm.output, s.strm.next_out, len); + s.strm.next_out += len; + s.strm.avail_out -= len; + s.strm.total_out += len; + } + } while (last === 0); + used -= s.strm.avail_in; + if (used) { + if (used >= s.w_size) { + s.matches = 2; + s.window.set(s.strm.input.subarray(s.strm.next_in - s.w_size, s.strm.next_in), 0); + s.strstart = s.w_size; + s.insert = s.strstart; + } else { + if (s.window_size - s.strstart <= used) { + s.strstart -= s.w_size; + s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0); + if (s.matches < 2) { + s.matches++; + } + if (s.insert > s.strstart) { + s.insert = s.strstart; + } + } + s.window.set(s.strm.input.subarray(s.strm.next_in - used, s.strm.next_in), s.strstart); + s.strstart += used; + s.insert += used > s.w_size - s.insert ? s.w_size - s.insert : used; + } + s.block_start = s.strstart; + } + if (s.high_water < s.strstart) { + s.high_water = s.strstart; + } + if (last) { + return BS_FINISH_DONE; + } + if (flush !== Z_NO_FLUSH$2 && flush !== Z_FINISH$3 && s.strm.avail_in === 0 && s.strstart === s.block_start) { + return BS_BLOCK_DONE; + } + have = s.window_size - s.strstart; + if (s.strm.avail_in > have && s.block_start >= s.w_size) { + s.block_start -= s.w_size; + s.strstart -= s.w_size; + s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0); + if (s.matches < 2) { + s.matches++; + } + have += s.w_size; + if (s.insert > s.strstart) { + s.insert = s.strstart; + } + } + if (have > s.strm.avail_in) { + have = s.strm.avail_in; + } + if (have) { + read_buf(s.strm, s.window, s.strstart, have); + s.strstart += have; + s.insert += have > s.w_size - s.insert ? s.w_size - s.insert : have; + } + if (s.high_water < s.strstart) { + s.high_water = s.strstart; + } + have = s.bi_valid + 42 >> 3; + have = s.pending_buf_size - have > 65535 ? 65535 : s.pending_buf_size - have; + min_block = have > s.w_size ? s.w_size : have; + left = s.strstart - s.block_start; + if (left >= min_block || (left || flush === Z_FINISH$3) && flush !== Z_NO_FLUSH$2 && s.strm.avail_in === 0 && left <= have) { + len = left > have ? have : left; + last = flush === Z_FINISH$3 && s.strm.avail_in === 0 && len === left ? 1 : 0; + _tr_stored_block(s, s.block_start, len, last); + s.block_start += len; + flush_pending(s.strm); + } + return last ? BS_FINISH_STARTED : BS_NEED_MORE; +}; +const deflate_fast = (s, flush) => { + let hash_head; + let bflush; + for (; ; ) { + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; + } + } + hash_head = 0; + if (s.lookahead >= MIN_MATCH) { + s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]); + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + } + if (hash_head !== 0 && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { + s.match_length = longest_match(s, hash_head); + } + if (s.match_length >= MIN_MATCH) { + bflush = _tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); + s.lookahead -= s.match_length; + if (s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) { + s.match_length--; + do { + s.strstart++; + s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]); + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + } while (--s.match_length !== 0); + s.strstart++; + } else { + s.strstart += s.match_length; + s.match_length = 0; + s.ins_h = s.window[s.strstart]; + s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]); + } + } else { + bflush = _tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + } + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + } + s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; + if (flush === Z_FINISH$3) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; + } + if (s.sym_next) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + return BS_BLOCK_DONE; +}; +const deflate_slow = (s, flush) => { + let hash_head; + let bflush; + let max_insert; + for (; ; ) { + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; + } + } + hash_head = 0; + if (s.lookahead >= MIN_MATCH) { + s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]); + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + } + s.prev_length = s.match_length; + s.prev_match = s.match_start; + s.match_length = MIN_MATCH - 1; + if (hash_head !== 0 && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { + s.match_length = longest_match(s, hash_head); + if (s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096)) { + s.match_length = MIN_MATCH - 1; + } + } + if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { + max_insert = s.strstart + s.lookahead - MIN_MATCH; + bflush = _tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); + s.lookahead -= s.prev_length - 1; + s.prev_length -= 2; + do { + if (++s.strstart <= max_insert) { + s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]); + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + } + } while (--s.prev_length !== 0); + s.match_available = 0; + s.match_length = MIN_MATCH - 1; + s.strstart++; + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + } else if (s.match_available) { + bflush = _tr_tally(s, 0, s.window[s.strstart - 1]); + if (bflush) { + flush_block_only(s, false); + } + s.strstart++; + s.lookahead--; + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } else { + s.match_available = 1; + s.strstart++; + s.lookahead--; + } + } + if (s.match_available) { + bflush = _tr_tally(s, 0, s.window[s.strstart - 1]); + s.match_available = 0; + } + s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; + if (flush === Z_FINISH$3) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; + } + if (s.sym_next) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + return BS_BLOCK_DONE; +}; +const deflate_rle = (s, flush) => { + let bflush; + let prev; + let scan, strend; + const _win = s.window; + for (; ; ) { + if (s.lookahead <= MAX_MATCH) { + fill_window(s); + if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH$2) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; + } + } + s.match_length = 0; + if (s.lookahead >= MIN_MATCH && s.strstart > 0) { + scan = s.strstart - 1; + prev = _win[scan]; + if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { + strend = s.strstart + MAX_MATCH; + do { + } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend); + s.match_length = MAX_MATCH - (strend - scan); + if (s.match_length > s.lookahead) { + s.match_length = s.lookahead; + } + } + } + if (s.match_length >= MIN_MATCH) { + bflush = _tr_tally(s, 1, s.match_length - MIN_MATCH); + s.lookahead -= s.match_length; + s.strstart += s.match_length; + s.match_length = 0; + } else { + bflush = _tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + } + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + } + s.insert = 0; + if (flush === Z_FINISH$3) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; + } + if (s.sym_next) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + return BS_BLOCK_DONE; +}; +const deflate_huff = (s, flush) => { + let bflush; + for (; ; ) { + if (s.lookahead === 0) { + fill_window(s); + if (s.lookahead === 0) { + if (flush === Z_NO_FLUSH$2) { + return BS_NEED_MORE; + } + break; + } + } + s.match_length = 0; + bflush = _tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + if (bflush) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + } + s.insert = 0; + if (flush === Z_FINISH$3) { + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + return BS_FINISH_DONE; + } + if (s.sym_next) { + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } + return BS_BLOCK_DONE; +}; +function Config(good_length, max_lazy, nice_length, max_chain, func) { + this.good_length = good_length; + this.max_lazy = max_lazy; + this.nice_length = nice_length; + this.max_chain = max_chain; + this.func = func; +} +const configuration_table = [ + /* good lazy nice chain */ + new Config(0, 0, 0, 0, deflate_stored), + /* 0 store only */ + new Config(4, 4, 8, 4, deflate_fast), + /* 1 max speed, no lazy matches */ + new Config(4, 5, 16, 8, deflate_fast), + /* 2 */ + new Config(4, 6, 32, 32, deflate_fast), + /* 3 */ + new Config(4, 4, 16, 16, deflate_slow), + /* 4 lazy matches */ + new Config(8, 16, 32, 32, deflate_slow), + /* 5 */ + new Config(8, 16, 128, 128, deflate_slow), + /* 6 */ + new Config(8, 32, 128, 256, deflate_slow), + /* 7 */ + new Config(32, 128, 258, 1024, deflate_slow), + /* 8 */ + new Config(32, 258, 258, 4096, deflate_slow) + /* 9 max compression */ +]; +const lm_init = (s) => { + s.window_size = 2 * s.w_size; + zero(s.head); + s.max_lazy_match = configuration_table[s.level].max_lazy; + s.good_match = configuration_table[s.level].good_length; + s.nice_match = configuration_table[s.level].nice_length; + s.max_chain_length = configuration_table[s.level].max_chain; + s.strstart = 0; + s.block_start = 0; + s.lookahead = 0; + s.insert = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + s.ins_h = 0; +}; +function DeflateState() { + this.strm = null; + this.status = 0; + this.pending_buf = null; + this.pending_buf_size = 0; + this.pending_out = 0; + this.pending = 0; + this.wrap = 0; + this.gzhead = null; + this.gzindex = 0; + this.method = Z_DEFLATED$2; + this.last_flush = -1; + this.w_size = 0; + this.w_bits = 0; + this.w_mask = 0; + this.window = null; + this.window_size = 0; + this.prev = null; + this.head = null; + this.ins_h = 0; + this.hash_size = 0; + this.hash_bits = 0; + this.hash_mask = 0; + this.hash_shift = 0; + this.block_start = 0; + this.match_length = 0; + this.prev_match = 0; + this.match_available = 0; + this.strstart = 0; + this.match_start = 0; + this.lookahead = 0; + this.prev_length = 0; + this.max_chain_length = 0; + this.max_lazy_match = 0; + this.level = 0; + this.strategy = 0; + this.good_match = 0; + this.nice_match = 0; + this.dyn_ltree = new Uint16Array(HEAP_SIZE * 2); + this.dyn_dtree = new Uint16Array((2 * D_CODES + 1) * 2); + this.bl_tree = new Uint16Array((2 * BL_CODES + 1) * 2); + zero(this.dyn_ltree); + zero(this.dyn_dtree); + zero(this.bl_tree); + this.l_desc = null; + this.d_desc = null; + this.bl_desc = null; + this.bl_count = new Uint16Array(MAX_BITS + 1); + this.heap = new Uint16Array(2 * L_CODES + 1); + zero(this.heap); + this.heap_len = 0; + this.heap_max = 0; + this.depth = new Uint16Array(2 * L_CODES + 1); + zero(this.depth); + this.sym_buf = 0; + this.lit_bufsize = 0; + this.sym_next = 0; + this.sym_end = 0; + this.opt_len = 0; + this.static_len = 0; + this.matches = 0; + this.insert = 0; + this.bi_buf = 0; + this.bi_valid = 0; +} +const deflateStateCheck = (strm) => { + if (!strm) { + return 1; + } + const s = strm.state; + if (!s || s.strm !== strm || s.status !== INIT_STATE && //#ifdef GZIP + s.status !== GZIP_STATE && //#endif + s.status !== EXTRA_STATE && s.status !== NAME_STATE && s.status !== COMMENT_STATE && s.status !== HCRC_STATE && s.status !== BUSY_STATE && s.status !== FINISH_STATE) { + return 1; + } + return 0; +}; +const deflateResetKeep = (strm) => { + if (deflateStateCheck(strm)) { + return err(strm, Z_STREAM_ERROR$2); + } + strm.total_in = strm.total_out = 0; + strm.data_type = Z_UNKNOWN; + const s = strm.state; + s.pending = 0; + s.pending_out = 0; + if (s.wrap < 0) { + s.wrap = -s.wrap; + } + s.status = //#ifdef GZIP + s.wrap === 2 ? GZIP_STATE : ( + //#endif + s.wrap ? INIT_STATE : BUSY_STATE + ); + strm.adler = s.wrap === 2 ? 0 : 1; + s.last_flush = -2; + _tr_init(s); + return Z_OK$3; +}; +const deflateReset = (strm) => { + const ret = deflateResetKeep(strm); + if (ret === Z_OK$3) { + lm_init(strm.state); + } + return ret; +}; +const deflateSetHeader = (strm, head) => { + if (deflateStateCheck(strm) || strm.state.wrap !== 2) { + return Z_STREAM_ERROR$2; + } + strm.state.gzhead = head; + return Z_OK$3; +}; +const deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => { + if (!strm) { + return Z_STREAM_ERROR$2; + } + let wrap = 1; + if (level === Z_DEFAULT_COMPRESSION$1) { + level = 6; + } + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } else if (windowBits > 15) { + wrap = 2; + windowBits -= 16; + } + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED$2 || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED || windowBits === 8 && wrap !== 1) { + return err(strm, Z_STREAM_ERROR$2); + } + if (windowBits === 8) { + windowBits = 9; + } + const s = new DeflateState(); + strm.state = s; + s.strm = strm; + s.status = INIT_STATE; + s.wrap = wrap; + s.gzhead = null; + s.w_bits = windowBits; + s.w_size = 1 << s.w_bits; + s.w_mask = s.w_size - 1; + s.hash_bits = memLevel + 7; + s.hash_size = 1 << s.hash_bits; + s.hash_mask = s.hash_size - 1; + s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); + s.window = new Uint8Array(s.w_size * 2); + s.head = new Uint16Array(s.hash_size); + s.prev = new Uint16Array(s.w_size); + s.lit_bufsize = 1 << memLevel + 6; + s.pending_buf_size = s.lit_bufsize * 4; + s.pending_buf = new Uint8Array(s.pending_buf_size); + s.sym_buf = s.lit_bufsize; + s.sym_end = (s.lit_bufsize - 1) * 3; + s.level = level; + s.strategy = strategy; + s.method = method; + return deflateReset(strm); +}; +const deflateInit = (strm, level) => { + return deflateInit2(strm, level, Z_DEFLATED$2, MAX_WBITS$1, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY$1); +}; +const deflate$2 = (strm, flush) => { + if (deflateStateCheck(strm) || flush > Z_BLOCK$1 || flush < 0) { + return strm ? err(strm, Z_STREAM_ERROR$2) : Z_STREAM_ERROR$2; + } + const s = strm.state; + if (!strm.output || strm.avail_in !== 0 && !strm.input || s.status === FINISH_STATE && flush !== Z_FINISH$3) { + return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR$1 : Z_STREAM_ERROR$2); + } + const old_flush = s.last_flush; + s.last_flush = flush; + if (s.pending !== 0) { + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; + return Z_OK$3; + } + } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH$3) { + return err(strm, Z_BUF_ERROR$1); + } + if (s.status === FINISH_STATE && strm.avail_in !== 0) { + return err(strm, Z_BUF_ERROR$1); + } + if (s.status === INIT_STATE && s.wrap === 0) { + s.status = BUSY_STATE; + } + if (s.status === INIT_STATE) { + let header = Z_DEFLATED$2 + (s.w_bits - 8 << 4) << 8; + let level_flags = -1; + if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { + level_flags = 0; + } else if (s.level < 6) { + level_flags = 1; + } else if (s.level === 6) { + level_flags = 2; + } else { + level_flags = 3; + } + header |= level_flags << 6; + if (s.strstart !== 0) { + header |= PRESET_DICT; + } + header += 31 - header % 31; + putShortMSB(s, header); + if (s.strstart !== 0) { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 65535); + } + strm.adler = 1; + s.status = BUSY_STATE; + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK$3; + } + } + if (s.status === GZIP_STATE) { + strm.adler = 0; + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (!s.gzhead) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); + put_byte(s, OS_CODE); + s.status = BUSY_STATE; + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK$3; + } + } else { + put_byte( + s, + (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16) + ); + put_byte(s, s.gzhead.time & 255); + put_byte(s, s.gzhead.time >> 8 & 255); + put_byte(s, s.gzhead.time >> 16 & 255); + put_byte(s, s.gzhead.time >> 24 & 255); + put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); + put_byte(s, s.gzhead.os & 255); + if (s.gzhead.extra && s.gzhead.extra.length) { + put_byte(s, s.gzhead.extra.length & 255); + put_byte(s, s.gzhead.extra.length >> 8 & 255); + } + if (s.gzhead.hcrc) { + strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending, 0); + } + s.gzindex = 0; + s.status = EXTRA_STATE; + } + } + if (s.status === EXTRA_STATE) { + if (s.gzhead.extra) { + let beg = s.pending; + let left = (s.gzhead.extra.length & 65535) - s.gzindex; + while (s.pending + left > s.pending_buf_size) { + let copy = s.pending_buf_size - s.pending; + s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex + copy), s.pending); + s.pending = s.pending_buf_size; + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); + } + s.gzindex += copy; + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK$3; + } + beg = 0; + left -= copy; + } + let gzhead_extra = new Uint8Array(s.gzhead.extra); + s.pending_buf.set(gzhead_extra.subarray(s.gzindex, s.gzindex + left), s.pending); + s.pending += left; + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); + } + s.gzindex = 0; + } + s.status = NAME_STATE; + } + if (s.status === NAME_STATE) { + if (s.gzhead.name) { + let beg = s.pending; + let val; + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK$3; + } + beg = 0; + } + if (s.gzindex < s.gzhead.name.length) { + val = s.gzhead.name.charCodeAt(s.gzindex++) & 255; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); + } + s.gzindex = 0; + } + s.status = COMMENT_STATE; + } + if (s.status === COMMENT_STATE) { + if (s.gzhead.comment) { + let beg = s.pending; + let val; + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK$3; + } + beg = 0; + } + if (s.gzindex < s.gzhead.comment.length) { + val = s.gzhead.comment.charCodeAt(s.gzindex++) & 255; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); + } + } + s.status = HCRC_STATE; + } + if (s.status === HCRC_STATE) { + if (s.gzhead.hcrc) { + if (s.pending + 2 > s.pending_buf_size) { + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK$3; + } + } + put_byte(s, strm.adler & 255); + put_byte(s, strm.adler >> 8 & 255); + strm.adler = 0; + } + s.status = BUSY_STATE; + flush_pending(strm); + if (s.pending !== 0) { + s.last_flush = -1; + return Z_OK$3; + } + } + if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH$2 && s.status !== FINISH_STATE) { + let bstate = s.level === 0 ? deflate_stored(s, flush) : s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush); + if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { + s.status = FINISH_STATE; + } + if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { + if (strm.avail_out === 0) { + s.last_flush = -1; + } + return Z_OK$3; + } + if (bstate === BS_BLOCK_DONE) { + if (flush === Z_PARTIAL_FLUSH) { + _tr_align(s); + } else if (flush !== Z_BLOCK$1) { + _tr_stored_block(s, 0, 0, false); + if (flush === Z_FULL_FLUSH$1) { + zero(s.head); + if (s.lookahead === 0) { + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + } + } + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; + return Z_OK$3; + } + } + } + if (flush !== Z_FINISH$3) { + return Z_OK$3; + } + if (s.wrap <= 0) { + return Z_STREAM_END$3; + } + if (s.wrap === 2) { + put_byte(s, strm.adler & 255); + put_byte(s, strm.adler >> 8 & 255); + put_byte(s, strm.adler >> 16 & 255); + put_byte(s, strm.adler >> 24 & 255); + put_byte(s, strm.total_in & 255); + put_byte(s, strm.total_in >> 8 & 255); + put_byte(s, strm.total_in >> 16 & 255); + put_byte(s, strm.total_in >> 24 & 255); + } else { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 65535); + } + flush_pending(strm); + if (s.wrap > 0) { + s.wrap = -s.wrap; + } + return s.pending !== 0 ? Z_OK$3 : Z_STREAM_END$3; +}; +const deflateEnd = (strm) => { + if (deflateStateCheck(strm)) { + return Z_STREAM_ERROR$2; + } + const status = strm.state.status; + strm.state = null; + return status === BUSY_STATE ? err(strm, Z_DATA_ERROR$2) : Z_OK$3; +}; +const deflateSetDictionary = (strm, dictionary) => { + let dictLength = dictionary.length; + if (deflateStateCheck(strm)) { + return Z_STREAM_ERROR$2; + } + const s = strm.state; + const wrap = s.wrap; + if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) { + return Z_STREAM_ERROR$2; + } + if (wrap === 1) { + strm.adler = adler32_1(strm.adler, dictionary, dictLength, 0); + } + s.wrap = 0; + if (dictLength >= s.w_size) { + if (wrap === 0) { + zero(s.head); + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + let tmpDict = new Uint8Array(s.w_size); + tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0); + dictionary = tmpDict; + dictLength = s.w_size; + } + const avail = strm.avail_in; + const next = strm.next_in; + const input = strm.input; + strm.avail_in = dictLength; + strm.next_in = 0; + strm.input = dictionary; + fill_window(s); + while (s.lookahead >= MIN_MATCH) { + let str = s.strstart; + let n = s.lookahead - (MIN_MATCH - 1); + do { + s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]); + s.prev[str & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = str; + str++; + } while (--n); + s.strstart = str; + s.lookahead = MIN_MATCH - 1; + fill_window(s); + } + s.strstart += s.lookahead; + s.block_start = s.strstart; + s.insert = s.lookahead; + s.lookahead = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + strm.next_in = next; + strm.input = input; + strm.avail_in = avail; + s.wrap = wrap; + return Z_OK$3; +}; +var deflateInit_1 = deflateInit; +var deflateInit2_1 = deflateInit2; +var deflateReset_1 = deflateReset; +var deflateResetKeep_1 = deflateResetKeep; +var deflateSetHeader_1 = deflateSetHeader; +var deflate_2$1 = deflate$2; +var deflateEnd_1 = deflateEnd; +var deflateSetDictionary_1 = deflateSetDictionary; +var deflateInfo = "pako deflate (from Nodeca project)"; +var deflate_1$2 = { + deflateInit: deflateInit_1, + deflateInit2: deflateInit2_1, + deflateReset: deflateReset_1, + deflateResetKeep: deflateResetKeep_1, + deflateSetHeader: deflateSetHeader_1, + deflate: deflate_2$1, + deflateEnd: deflateEnd_1, + deflateSetDictionary: deflateSetDictionary_1, + deflateInfo +}; +const _has = (obj, key) => { + return Object.prototype.hasOwnProperty.call(obj, key); +}; +var assign = function(obj) { + const sources = Array.prototype.slice.call(arguments, 1); + while (sources.length) { + const source = sources.shift(); + if (!source) { + continue; + } + if (typeof source !== "object") { + throw new TypeError(source + "must be non-object"); + } + for (const p in source) { + if (_has(source, p)) { + obj[p] = source[p]; + } + } + } + return obj; +}; +var flattenChunks = (chunks) => { + let len = 0; + for (let i = 0, l = chunks.length; i < l; i++) { + len += chunks[i].length; + } + const result = new Uint8Array(len); + for (let i = 0, pos = 0, l = chunks.length; i < l; i++) { + let chunk = chunks[i]; + result.set(chunk, pos); + pos += chunk.length; + } + return result; +}; +var common = { + assign, + flattenChunks +}; +let STR_APPLY_UIA_OK = true; +try { + String.fromCharCode.apply(null, new Uint8Array(1)); +} catch (__) { + STR_APPLY_UIA_OK = false; +} +const _utf8len = new Uint8Array(256); +for (let q = 0; q < 256; q++) { + _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1; +} +_utf8len[254] = _utf8len[254] = 1; +var string2buf = (str) => { + if (typeof TextEncoder === "function" && TextEncoder.prototype.encode) { + return new TextEncoder().encode(str); + } + let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 64512) === 55296 && m_pos + 1 < str_len) { + c2 = str.charCodeAt(m_pos + 1); + if ((c2 & 64512) === 56320) { + c = 65536 + (c - 55296 << 10) + (c2 - 56320); + m_pos++; + } + } + buf_len += c < 128 ? 1 : c < 2048 ? 2 : c < 65536 ? 3 : 4; + } + buf = new Uint8Array(buf_len); + for (i = 0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 64512) === 55296 && m_pos + 1 < str_len) { + c2 = str.charCodeAt(m_pos + 1); + if ((c2 & 64512) === 56320) { + c = 65536 + (c - 55296 << 10) + (c2 - 56320); + m_pos++; + } + } + if (c < 128) { + buf[i++] = c; + } else if (c < 2048) { + buf[i++] = 192 | c >>> 6; + buf[i++] = 128 | c & 63; + } else if (c < 65536) { + buf[i++] = 224 | c >>> 12; + buf[i++] = 128 | c >>> 6 & 63; + buf[i++] = 128 | c & 63; + } else { + buf[i++] = 240 | c >>> 18; + buf[i++] = 128 | c >>> 12 & 63; + buf[i++] = 128 | c >>> 6 & 63; + buf[i++] = 128 | c & 63; + } + } + return buf; +}; +const buf2binstring = (buf, len) => { + if (len < 65534) { + if (buf.subarray && STR_APPLY_UIA_OK) { + return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len)); + } + } + let result = ""; + for (let i = 0; i < len; i++) { + result += String.fromCharCode(buf[i]); + } + return result; +}; +var buf2string = (buf, max2) => { + const len = max2 || buf.length; + if (typeof TextDecoder === "function" && TextDecoder.prototype.decode) { + return new TextDecoder().decode(buf.subarray(0, max2)); + } + let i, out; + const utf16buf = new Array(len * 2); + for (out = 0, i = 0; i < len; ) { + let c = buf[i++]; + if (c < 128) { + utf16buf[out++] = c; + continue; + } + let c_len = _utf8len[c]; + if (c_len > 4) { + utf16buf[out++] = 65533; + i += c_len - 1; + continue; + } + c &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7; + while (c_len > 1 && i < len) { + c = c << 6 | buf[i++] & 63; + c_len--; + } + if (c_len > 1) { + utf16buf[out++] = 65533; + continue; + } + if (c < 65536) { + utf16buf[out++] = c; + } else { + c -= 65536; + utf16buf[out++] = 55296 | c >> 10 & 1023; + utf16buf[out++] = 56320 | c & 1023; + } + } + return buf2binstring(utf16buf, out); +}; +var utf8border = (buf, max2) => { + max2 = max2 || buf.length; + if (max2 > buf.length) { + max2 = buf.length; + } + let pos = max2 - 1; + while (pos >= 0 && (buf[pos] & 192) === 128) { + pos--; + } + if (pos < 0) { + return max2; + } + if (pos === 0) { + return max2; + } + return pos + _utf8len[buf[pos]] > max2 ? pos : max2; +}; +var strings = { + string2buf, + buf2string, + utf8border +}; +function ZStream() { + this.input = null; + this.next_in = 0; + this.avail_in = 0; + this.total_in = 0; + this.output = null; + this.next_out = 0; + this.avail_out = 0; + this.total_out = 0; + this.msg = ""; + this.state = null; + this.data_type = 2; + this.adler = 0; +} +var zstream = ZStream; +const toString$1 = Object.prototype.toString; +const { + Z_NO_FLUSH: Z_NO_FLUSH$1, + Z_SYNC_FLUSH, + Z_FULL_FLUSH, + Z_FINISH: Z_FINISH$2, + Z_OK: Z_OK$2, + Z_STREAM_END: Z_STREAM_END$2, + Z_DEFAULT_COMPRESSION, + Z_DEFAULT_STRATEGY, + Z_DEFLATED: Z_DEFLATED$1 +} = constants$2; +function Deflate$1(options) { + this.options = common.assign({ + level: Z_DEFAULT_COMPRESSION, + method: Z_DEFLATED$1, + chunkSize: 16384, + windowBits: 15, + memLevel: 8, + strategy: Z_DEFAULT_STRATEGY + }, options || {}); + let opt = this.options; + if (opt.raw && opt.windowBits > 0) { + opt.windowBits = -opt.windowBits; + } else if (opt.gzip && opt.windowBits > 0 && opt.windowBits < 16) { + opt.windowBits += 16; + } + this.err = 0; + this.msg = ""; + this.ended = false; + this.chunks = []; + this.strm = new zstream(); + this.strm.avail_out = 0; + let status = deflate_1$2.deflateInit2( + this.strm, + opt.level, + opt.method, + opt.windowBits, + opt.memLevel, + opt.strategy + ); + if (status !== Z_OK$2) { + throw new Error(messages[status]); + } + if (opt.header) { + deflate_1$2.deflateSetHeader(this.strm, opt.header); + } + if (opt.dictionary) { + let dict; + if (typeof opt.dictionary === "string") { + dict = strings.string2buf(opt.dictionary); + } else if (toString$1.call(opt.dictionary) === "[object ArrayBuffer]") { + dict = new Uint8Array(opt.dictionary); + } else { + dict = opt.dictionary; + } + status = deflate_1$2.deflateSetDictionary(this.strm, dict); + if (status !== Z_OK$2) { + throw new Error(messages[status]); + } + this._dict_set = true; + } +} +Deflate$1.prototype.push = function(data, flush_mode) { + const strm = this.strm; + const chunkSize = this.options.chunkSize; + let status, _flush_mode; + if (this.ended) { + return false; + } + if (flush_mode === ~~flush_mode) + _flush_mode = flush_mode; + else + _flush_mode = flush_mode === true ? Z_FINISH$2 : Z_NO_FLUSH$1; + if (typeof data === "string") { + strm.input = strings.string2buf(data); + } else if (toString$1.call(data) === "[object ArrayBuffer]") { + strm.input = new Uint8Array(data); + } else { + strm.input = data; + } + strm.next_in = 0; + strm.avail_in = strm.input.length; + for (; ; ) { + if (strm.avail_out === 0) { + strm.output = new Uint8Array(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH) && strm.avail_out <= 6) { + this.onData(strm.output.subarray(0, strm.next_out)); + strm.avail_out = 0; + continue; + } + status = deflate_1$2.deflate(strm, _flush_mode); + if (status === Z_STREAM_END$2) { + if (strm.next_out > 0) { + this.onData(strm.output.subarray(0, strm.next_out)); + } + status = deflate_1$2.deflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return status === Z_OK$2; + } + if (strm.avail_out === 0) { + this.onData(strm.output); + continue; + } + if (_flush_mode > 0 && strm.next_out > 0) { + this.onData(strm.output.subarray(0, strm.next_out)); + strm.avail_out = 0; + continue; + } + if (strm.avail_in === 0) + break; + } + return true; +}; +Deflate$1.prototype.onData = function(chunk) { + this.chunks.push(chunk); +}; +Deflate$1.prototype.onEnd = function(status) { + if (status === Z_OK$2) { + this.result = common.flattenChunks(this.chunks); + } + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; +}; +const BAD$1 = 16209; +const TYPE$1 = 16191; +var inffast = function inflate_fast(strm, start) { + let _in; + let last; + let _out; + let beg; + let end; + let dmax; + let wsize; + let whave; + let wnext; + let s_window; + let hold; + let bits; + let lcode; + let dcode; + let lmask; + let dmask; + let here; + let op; + let len; + let dist; + let from; + let from_source; + let input, output; + const state = strm.state; + _in = strm.next_in; + input = strm.input; + last = _in + (strm.avail_in - 5); + _out = strm.next_out; + output = strm.output; + beg = _out - (start - strm.avail_out); + end = _out + (strm.avail_out - 257); + dmax = state.dmax; + wsize = state.wsize; + whave = state.whave; + wnext = state.wnext; + s_window = state.window; + hold = state.hold; + bits = state.bits; + lcode = state.lencode; + dcode = state.distcode; + lmask = (1 << state.lenbits) - 1; + dmask = (1 << state.distbits) - 1; + top: + do { + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = lcode[hold & lmask]; + dolen: + for (; ; ) { + op = here >>> 24; + hold >>>= op; + bits -= op; + op = here >>> 16 & 255; + if (op === 0) { + output[_out++] = here & 65535; + } else if (op & 16) { + len = here & 65535; + op &= 15; + if (op) { + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + len += hold & (1 << op) - 1; + hold >>>= op; + bits -= op; + } + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = dcode[hold & dmask]; + dodist: + for (; ; ) { + op = here >>> 24; + hold >>>= op; + bits -= op; + op = here >>> 16 & 255; + if (op & 16) { + dist = here & 65535; + op &= 15; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + } + dist += hold & (1 << op) - 1; + if (dist > dmax) { + strm.msg = "invalid distance too far back"; + state.mode = BAD$1; + break top; + } + hold >>>= op; + bits -= op; + op = _out - beg; + if (dist > op) { + op = dist - op; + if (op > whave) { + if (state.sane) { + strm.msg = "invalid distance too far back"; + state.mode = BAD$1; + break top; + } + } + from = 0; + from_source = s_window; + if (wnext === 0) { + from += wsize - op; + if (op < len) { + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; + from_source = output; + } + } else if (wnext < op) { + from += wsize + wnext - op; + op -= wnext; + if (op < len) { + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = 0; + if (wnext < len) { + op = wnext; + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; + from_source = output; + } + } + } else { + from += wnext - op; + if (op < len) { + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; + from_source = output; + } + } + while (len > 2) { + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + len -= 3; + } + if (len) { + output[_out++] = from_source[from++]; + if (len > 1) { + output[_out++] = from_source[from++]; + } + } + } else { + from = _out - dist; + do { + output[_out++] = output[from++]; + output[_out++] = output[from++]; + output[_out++] = output[from++]; + len -= 3; + } while (len > 2); + if (len) { + output[_out++] = output[from++]; + if (len > 1) { + output[_out++] = output[from++]; + } + } + } + } else if ((op & 64) === 0) { + here = dcode[(here & 65535) + (hold & (1 << op) - 1)]; + continue dodist; + } else { + strm.msg = "invalid distance code"; + state.mode = BAD$1; + break top; + } + break; + } + } else if ((op & 64) === 0) { + here = lcode[(here & 65535) + (hold & (1 << op) - 1)]; + continue dolen; + } else if (op & 32) { + state.mode = TYPE$1; + break top; + } else { + strm.msg = "invalid literal/length code"; + state.mode = BAD$1; + break top; + } + break; + } + } while (_in < last && _out < end); + len = bits >> 3; + _in -= len; + bits -= len << 3; + hold &= (1 << bits) - 1; + strm.next_in = _in; + strm.next_out = _out; + strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last); + strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end); + state.hold = hold; + state.bits = bits; + return; +}; +const MAXBITS = 15; +const ENOUGH_LENS$1 = 852; +const ENOUGH_DISTS$1 = 592; +const CODES$1 = 0; +const LENS$1 = 1; +const DISTS$1 = 2; +const lbase = new Uint16Array([ + /* Length codes 257..285 base */ + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 13, + 15, + 17, + 19, + 23, + 27, + 31, + 35, + 43, + 51, + 59, + 67, + 83, + 99, + 115, + 131, + 163, + 195, + 227, + 258, + 0, + 0 +]); +const lext = new Uint8Array([ + /* Length codes 257..285 extra */ + 16, + 16, + 16, + 16, + 16, + 16, + 16, + 16, + 17, + 17, + 17, + 17, + 18, + 18, + 18, + 18, + 19, + 19, + 19, + 19, + 20, + 20, + 20, + 20, + 21, + 21, + 21, + 21, + 16, + 72, + 78 +]); +const dbase = new Uint16Array([ + /* Distance codes 0..29 base */ + 1, + 2, + 3, + 4, + 5, + 7, + 9, + 13, + 17, + 25, + 33, + 49, + 65, + 97, + 129, + 193, + 257, + 385, + 513, + 769, + 1025, + 1537, + 2049, + 3073, + 4097, + 6145, + 8193, + 12289, + 16385, + 24577, + 0, + 0 +]); +const dext = new Uint8Array([ + /* Distance codes 0..29 extra */ + 16, + 16, + 16, + 16, + 17, + 17, + 18, + 18, + 19, + 19, + 20, + 20, + 21, + 21, + 22, + 22, + 23, + 23, + 24, + 24, + 25, + 25, + 26, + 26, + 27, + 27, + 28, + 28, + 29, + 29, + 64, + 64 +]); +const inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) => { + const bits = opts.bits; + let len = 0; + let sym = 0; + let min2 = 0, max2 = 0; + let root = 0; + let curr = 0; + let drop = 0; + let left = 0; + let used = 0; + let huff = 0; + let incr; + let fill; + let low; + let mask; + let next; + let base = null; + let match; + const count = new Uint16Array(MAXBITS + 1); + const offs = new Uint16Array(MAXBITS + 1); + let extra = null; + let here_bits, here_op, here_val; + for (len = 0; len <= MAXBITS; len++) { + count[len] = 0; + } + for (sym = 0; sym < codes; sym++) { + count[lens[lens_index + sym]]++; + } + root = bits; + for (max2 = MAXBITS; max2 >= 1; max2--) { + if (count[max2] !== 0) { + break; + } + } + if (root > max2) { + root = max2; + } + if (max2 === 0) { + table[table_index++] = 1 << 24 | 64 << 16 | 0; + table[table_index++] = 1 << 24 | 64 << 16 | 0; + opts.bits = 1; + return 0; + } + for (min2 = 1; min2 < max2; min2++) { + if (count[min2] !== 0) { + break; + } + } + if (root < min2) { + root = min2; + } + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) { + return -1; + } + } + if (left > 0 && (type === CODES$1 || max2 !== 1)) { + return -1; + } + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) { + offs[len + 1] = offs[len] + count[len]; + } + for (sym = 0; sym < codes; sym++) { + if (lens[lens_index + sym] !== 0) { + work[offs[lens[lens_index + sym]]++] = sym; + } + } + if (type === CODES$1) { + base = extra = work; + match = 20; + } else if (type === LENS$1) { + base = lbase; + extra = lext; + match = 257; + } else { + base = dbase; + extra = dext; + match = 0; + } + huff = 0; + sym = 0; + len = min2; + next = table_index; + curr = root; + drop = 0; + low = -1; + used = 1 << root; + mask = used - 1; + if (type === LENS$1 && used > ENOUGH_LENS$1 || type === DISTS$1 && used > ENOUGH_DISTS$1) { + return 1; + } + for (; ; ) { + here_bits = len - drop; + if (work[sym] + 1 < match) { + here_op = 0; + here_val = work[sym]; + } else if (work[sym] >= match) { + here_op = extra[work[sym] - match]; + here_val = base[work[sym] - match]; + } else { + here_op = 32 + 64; + here_val = 0; + } + incr = 1 << len - drop; + fill = 1 << curr; + min2 = fill; + do { + fill -= incr; + table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0; + } while (fill !== 0); + incr = 1 << len - 1; + while (huff & incr) { + incr >>= 1; + } + if (incr !== 0) { + huff &= incr - 1; + huff += incr; + } else { + huff = 0; + } + sym++; + if (--count[len] === 0) { + if (len === max2) { + break; + } + len = lens[lens_index + work[sym]]; + } + if (len > root && (huff & mask) !== low) { + if (drop === 0) { + drop = root; + } + next += min2; + curr = len - drop; + left = 1 << curr; + while (curr + drop < max2) { + left -= count[curr + drop]; + if (left <= 0) { + break; + } + curr++; + left <<= 1; + } + used += 1 << curr; + if (type === LENS$1 && used > ENOUGH_LENS$1 || type === DISTS$1 && used > ENOUGH_DISTS$1) { + return 1; + } + low = huff & mask; + table[low] = root << 24 | curr << 16 | next - table_index | 0; + } + } + if (huff !== 0) { + table[next + huff] = len - drop << 24 | 64 << 16 | 0; + } + opts.bits = root; + return 0; +}; +var inftrees = inflate_table; +const CODES = 0; +const LENS = 1; +const DISTS = 2; +const { + Z_FINISH: Z_FINISH$1, + Z_BLOCK, + Z_TREES, + Z_OK: Z_OK$1, + Z_STREAM_END: Z_STREAM_END$1, + Z_NEED_DICT: Z_NEED_DICT$1, + Z_STREAM_ERROR: Z_STREAM_ERROR$1, + Z_DATA_ERROR: Z_DATA_ERROR$1, + Z_MEM_ERROR: Z_MEM_ERROR$1, + Z_BUF_ERROR, + Z_DEFLATED +} = constants$2; +const HEAD = 16180; +const FLAGS = 16181; +const TIME = 16182; +const OS = 16183; +const EXLEN = 16184; +const EXTRA = 16185; +const NAME = 16186; +const COMMENT = 16187; +const HCRC = 16188; +const DICTID = 16189; +const DICT = 16190; +const TYPE = 16191; +const TYPEDO = 16192; +const STORED = 16193; +const COPY_ = 16194; +const COPY = 16195; +const TABLE = 16196; +const LENLENS = 16197; +const CODELENS = 16198; +const LEN_ = 16199; +const LEN = 16200; +const LENEXT = 16201; +const DIST = 16202; +const DISTEXT = 16203; +const MATCH = 16204; +const LIT = 16205; +const CHECK = 16206; +const LENGTH = 16207; +const DONE = 16208; +const BAD = 16209; +const MEM = 16210; +const SYNC = 16211; +const ENOUGH_LENS = 852; +const ENOUGH_DISTS = 592; +const MAX_WBITS = 15; +const DEF_WBITS = MAX_WBITS; +const zswap32 = (q) => { + return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24); +}; +function InflateState() { + this.strm = null; + this.mode = 0; + this.last = false; + this.wrap = 0; + this.havedict = false; + this.flags = 0; + this.dmax = 0; + this.check = 0; + this.total = 0; + this.head = null; + this.wbits = 0; + this.wsize = 0; + this.whave = 0; + this.wnext = 0; + this.window = null; + this.hold = 0; + this.bits = 0; + this.length = 0; + this.offset = 0; + this.extra = 0; + this.lencode = null; + this.distcode = null; + this.lenbits = 0; + this.distbits = 0; + this.ncode = 0; + this.nlen = 0; + this.ndist = 0; + this.have = 0; + this.next = null; + this.lens = new Uint16Array(320); + this.work = new Uint16Array(288); + this.lendyn = null; + this.distdyn = null; + this.sane = 0; + this.back = 0; + this.was = 0; +} +const inflateStateCheck = (strm) => { + if (!strm) { + return 1; + } + const state = strm.state; + if (!state || state.strm !== strm || state.mode < HEAD || state.mode > SYNC) { + return 1; + } + return 0; +}; +const inflateResetKeep = (strm) => { + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR$1; + } + const state = strm.state; + strm.total_in = strm.total_out = state.total = 0; + strm.msg = ""; + if (state.wrap) { + strm.adler = state.wrap & 1; + } + state.mode = HEAD; + state.last = 0; + state.havedict = 0; + state.flags = -1; + state.dmax = 32768; + state.head = null; + state.hold = 0; + state.bits = 0; + state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS); + state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS); + state.sane = 1; + state.back = -1; + return Z_OK$1; +}; +const inflateReset = (strm) => { + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR$1; + } + const state = strm.state; + state.wsize = 0; + state.whave = 0; + state.wnext = 0; + return inflateResetKeep(strm); +}; +const inflateReset2 = (strm, windowBits) => { + let wrap; + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR$1; + } + const state = strm.state; + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } else { + wrap = (windowBits >> 4) + 5; + if (windowBits < 48) { + windowBits &= 15; + } + } + if (windowBits && (windowBits < 8 || windowBits > 15)) { + return Z_STREAM_ERROR$1; + } + if (state.window !== null && state.wbits !== windowBits) { + state.window = null; + } + state.wrap = wrap; + state.wbits = windowBits; + return inflateReset(strm); +}; +const inflateInit2 = (strm, windowBits) => { + if (!strm) { + return Z_STREAM_ERROR$1; + } + const state = new InflateState(); + strm.state = state; + state.strm = strm; + state.window = null; + state.mode = HEAD; + const ret = inflateReset2(strm, windowBits); + if (ret !== Z_OK$1) { + strm.state = null; + } + return ret; +}; +const inflateInit = (strm) => { + return inflateInit2(strm, DEF_WBITS); +}; +let virgin = true; +let lenfix, distfix; +const fixedtables = (state) => { + if (virgin) { + lenfix = new Int32Array(512); + distfix = new Int32Array(32); + let sym = 0; + while (sym < 144) { + state.lens[sym++] = 8; + } + while (sym < 256) { + state.lens[sym++] = 9; + } + while (sym < 280) { + state.lens[sym++] = 7; + } + while (sym < 288) { + state.lens[sym++] = 8; + } + inftrees(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); + sym = 0; + while (sym < 32) { + state.lens[sym++] = 5; + } + inftrees(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); + virgin = false; + } + state.lencode = lenfix; + state.lenbits = 9; + state.distcode = distfix; + state.distbits = 5; +}; +const updatewindow = (strm, src, end, copy) => { + let dist; + const state = strm.state; + if (state.window === null) { + state.wsize = 1 << state.wbits; + state.wnext = 0; + state.whave = 0; + state.window = new Uint8Array(state.wsize); + } + if (copy >= state.wsize) { + state.window.set(src.subarray(end - state.wsize, end), 0); + state.wnext = 0; + state.whave = state.wsize; + } else { + dist = state.wsize - state.wnext; + if (dist > copy) { + dist = copy; + } + state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext); + copy -= dist; + if (copy) { + state.window.set(src.subarray(end - copy, end), 0); + state.wnext = copy; + state.whave = state.wsize; + } else { + state.wnext += dist; + if (state.wnext === state.wsize) { + state.wnext = 0; + } + if (state.whave < state.wsize) { + state.whave += dist; + } + } + } + return 0; +}; +const inflate$2 = (strm, flush) => { + let state; + let input, output; + let next; + let put; + let have, left; + let hold; + let bits; + let _in, _out; + let copy; + let from; + let from_source; + let here = 0; + let here_bits, here_op, here_val; + let last_bits, last_op, last_val; + let len; + let ret; + const hbuf = new Uint8Array(4); + let opts; + let n; + const order = ( + /* permutation of code lengths */ + new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]) + ); + if (inflateStateCheck(strm) || !strm.output || !strm.input && strm.avail_in !== 0) { + return Z_STREAM_ERROR$1; + } + state = strm.state; + if (state.mode === TYPE) { + state.mode = TYPEDO; + } + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + _in = have; + _out = left; + ret = Z_OK$1; + inf_leave: + for (; ; ) { + switch (state.mode) { + case HEAD: + if (state.wrap === 0) { + state.mode = TYPEDO; + break; + } + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (state.wrap & 2 && hold === 35615) { + if (state.wbits === 0) { + state.wbits = 15; + } + state.check = 0; + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state.check = crc32_1(state.check, hbuf, 2, 0); + hold = 0; + bits = 0; + state.mode = FLAGS; + break; + } + if (state.head) { + state.head.done = false; + } + if (!(state.wrap & 1) || /* check if zlib header allowed */ + (((hold & 255) << 8) + (hold >> 8)) % 31) { + strm.msg = "incorrect header check"; + state.mode = BAD; + break; + } + if ((hold & 15) !== Z_DEFLATED) { + strm.msg = "unknown compression method"; + state.mode = BAD; + break; + } + hold >>>= 4; + bits -= 4; + len = (hold & 15) + 8; + if (state.wbits === 0) { + state.wbits = len; + } + if (len > 15 || len > state.wbits) { + strm.msg = "invalid window size"; + state.mode = BAD; + break; + } + state.dmax = 1 << state.wbits; + state.flags = 0; + strm.adler = state.check = 1; + state.mode = hold & 512 ? DICTID : TYPE; + hold = 0; + bits = 0; + break; + case FLAGS: + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state.flags = hold; + if ((state.flags & 255) !== Z_DEFLATED) { + strm.msg = "unknown compression method"; + state.mode = BAD; + break; + } + if (state.flags & 57344) { + strm.msg = "unknown header flags set"; + state.mode = BAD; + break; + } + if (state.head) { + state.head.text = hold >> 8 & 1; + } + if (state.flags & 512 && state.wrap & 4) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state.check = crc32_1(state.check, hbuf, 2, 0); + } + hold = 0; + bits = 0; + state.mode = TIME; + case TIME: + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (state.head) { + state.head.time = hold; + } + if (state.flags & 512 && state.wrap & 4) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + hbuf[2] = hold >>> 16 & 255; + hbuf[3] = hold >>> 24 & 255; + state.check = crc32_1(state.check, hbuf, 4, 0); + } + hold = 0; + bits = 0; + state.mode = OS; + case OS: + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (state.head) { + state.head.xflags = hold & 255; + state.head.os = hold >> 8; + } + if (state.flags & 512 && state.wrap & 4) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state.check = crc32_1(state.check, hbuf, 2, 0); + } + hold = 0; + bits = 0; + state.mode = EXLEN; + case EXLEN: + if (state.flags & 1024) { + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state.length = hold; + if (state.head) { + state.head.extra_len = hold; + } + if (state.flags & 512 && state.wrap & 4) { + hbuf[0] = hold & 255; + hbuf[1] = hold >>> 8 & 255; + state.check = crc32_1(state.check, hbuf, 2, 0); + } + hold = 0; + bits = 0; + } else if (state.head) { + state.head.extra = null; + } + state.mode = EXTRA; + case EXTRA: + if (state.flags & 1024) { + copy = state.length; + if (copy > have) { + copy = have; + } + if (copy) { + if (state.head) { + len = state.head.extra_len - state.length; + if (!state.head.extra) { + state.head.extra = new Uint8Array(state.head.extra_len); + } + state.head.extra.set( + input.subarray( + next, + // extra field is limited to 65536 bytes + // - no need for additional size check + next + copy + ), + /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ + len + ); + } + if (state.flags & 512 && state.wrap & 4) { + state.check = crc32_1(state.check, input, copy, next); + } + have -= copy; + next += copy; + state.length -= copy; + } + if (state.length) { + break inf_leave; + } + } + state.length = 0; + state.mode = NAME; + case NAME: + if (state.flags & 2048) { + if (have === 0) { + break inf_leave; + } + copy = 0; + do { + len = input[next + copy++]; + if (state.head && len && state.length < 65536) { + state.head.name += String.fromCharCode(len); + } + } while (len && copy < have); + if (state.flags & 512 && state.wrap & 4) { + state.check = crc32_1(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { + break inf_leave; + } + } else if (state.head) { + state.head.name = null; + } + state.length = 0; + state.mode = COMMENT; + case COMMENT: + if (state.flags & 4096) { + if (have === 0) { + break inf_leave; + } + copy = 0; + do { + len = input[next + copy++]; + if (state.head && len && state.length < 65536) { + state.head.comment += String.fromCharCode(len); + } + } while (len && copy < have); + if (state.flags & 512 && state.wrap & 4) { + state.check = crc32_1(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { + break inf_leave; + } + } else if (state.head) { + state.head.comment = null; + } + state.mode = HCRC; + case HCRC: + if (state.flags & 512) { + while (bits < 16) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (state.wrap & 4 && hold !== (state.check & 65535)) { + strm.msg = "header crc mismatch"; + state.mode = BAD; + break; + } + hold = 0; + bits = 0; + } + if (state.head) { + state.head.hcrc = state.flags >> 9 & 1; + state.head.done = true; + } + strm.adler = state.check = 0; + state.mode = TYPE; + break; + case DICTID: + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + strm.adler = state.check = zswap32(hold); + hold = 0; + bits = 0; + state.mode = DICT; + case DICT: + if (state.havedict === 0) { + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + return Z_NEED_DICT$1; + } + strm.adler = state.check = 1; + state.mode = TYPE; + case TYPE: + if (flush === Z_BLOCK || flush === Z_TREES) { + break inf_leave; + } + case TYPEDO: + if (state.last) { + hold >>>= bits & 7; + bits -= bits & 7; + state.mode = CHECK; + break; + } + while (bits < 3) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state.last = hold & 1; + hold >>>= 1; + bits -= 1; + switch (hold & 3) { + case 0: + state.mode = STORED; + break; + case 1: + fixedtables(state); + state.mode = LEN_; + if (flush === Z_TREES) { + hold >>>= 2; + bits -= 2; + break inf_leave; + } + break; + case 2: + state.mode = TABLE; + break; + case 3: + strm.msg = "invalid block type"; + state.mode = BAD; + } + hold >>>= 2; + bits -= 2; + break; + case STORED: + hold >>>= bits & 7; + bits -= bits & 7; + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if ((hold & 65535) !== (hold >>> 16 ^ 65535)) { + strm.msg = "invalid stored block lengths"; + state.mode = BAD; + break; + } + state.length = hold & 65535; + hold = 0; + bits = 0; + state.mode = COPY_; + if (flush === Z_TREES) { + break inf_leave; + } + case COPY_: + state.mode = COPY; + case COPY: + copy = state.length; + if (copy) { + if (copy > have) { + copy = have; + } + if (copy > left) { + copy = left; + } + if (copy === 0) { + break inf_leave; + } + output.set(input.subarray(next, next + copy), put); + have -= copy; + next += copy; + left -= copy; + put += copy; + state.length -= copy; + break; + } + state.mode = TYPE; + break; + case TABLE: + while (bits < 14) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state.nlen = (hold & 31) + 257; + hold >>>= 5; + bits -= 5; + state.ndist = (hold & 31) + 1; + hold >>>= 5; + bits -= 5; + state.ncode = (hold & 15) + 4; + hold >>>= 4; + bits -= 4; + if (state.nlen > 286 || state.ndist > 30) { + strm.msg = "too many length or distance symbols"; + state.mode = BAD; + break; + } + state.have = 0; + state.mode = LENLENS; + case LENLENS: + while (state.have < state.ncode) { + while (bits < 3) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state.lens[order[state.have++]] = hold & 7; + hold >>>= 3; + bits -= 3; + } + while (state.have < 19) { + state.lens[order[state.have++]] = 0; + } + state.lencode = state.lendyn; + state.lenbits = 7; + opts = { bits: state.lenbits }; + ret = inftrees(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); + state.lenbits = opts.bits; + if (ret) { + strm.msg = "invalid code lengths set"; + state.mode = BAD; + break; + } + state.have = 0; + state.mode = CODELENS; + case CODELENS: + while (state.have < state.nlen + state.ndist) { + for (; ; ) { + here = state.lencode[hold & (1 << state.lenbits) - 1]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (here_val < 16) { + hold >>>= here_bits; + bits -= here_bits; + state.lens[state.have++] = here_val; + } else { + if (here_val === 16) { + n = here_bits + 2; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + hold >>>= here_bits; + bits -= here_bits; + if (state.have === 0) { + strm.msg = "invalid bit length repeat"; + state.mode = BAD; + break; + } + len = state.lens[state.have - 1]; + copy = 3 + (hold & 3); + hold >>>= 2; + bits -= 2; + } else if (here_val === 17) { + n = here_bits + 3; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + hold >>>= here_bits; + bits -= here_bits; + len = 0; + copy = 3 + (hold & 7); + hold >>>= 3; + bits -= 3; + } else { + n = here_bits + 7; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + hold >>>= here_bits; + bits -= here_bits; + len = 0; + copy = 11 + (hold & 127); + hold >>>= 7; + bits -= 7; + } + if (state.have + copy > state.nlen + state.ndist) { + strm.msg = "invalid bit length repeat"; + state.mode = BAD; + break; + } + while (copy--) { + state.lens[state.have++] = len; + } + } + } + if (state.mode === BAD) { + break; + } + if (state.lens[256] === 0) { + strm.msg = "invalid code -- missing end-of-block"; + state.mode = BAD; + break; + } + state.lenbits = 9; + opts = { bits: state.lenbits }; + ret = inftrees(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); + state.lenbits = opts.bits; + if (ret) { + strm.msg = "invalid literal/lengths set"; + state.mode = BAD; + break; + } + state.distbits = 6; + state.distcode = state.distdyn; + opts = { bits: state.distbits }; + ret = inftrees(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); + state.distbits = opts.bits; + if (ret) { + strm.msg = "invalid distances set"; + state.mode = BAD; + break; + } + state.mode = LEN_; + if (flush === Z_TREES) { + break inf_leave; + } + case LEN_: + state.mode = LEN; + case LEN: + if (have >= 6 && left >= 258) { + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + inffast(strm, _out); + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + if (state.mode === TYPE) { + state.back = -1; + } + break; + } + state.back = 0; + for (; ; ) { + here = state.lencode[hold & (1 << state.lenbits) - 1]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (here_op && (here_op & 240) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (; ; ) { + here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (last_bits + here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + hold >>>= last_bits; + bits -= last_bits; + state.back += last_bits; + } + hold >>>= here_bits; + bits -= here_bits; + state.back += here_bits; + state.length = here_val; + if (here_op === 0) { + state.mode = LIT; + break; + } + if (here_op & 32) { + state.back = -1; + state.mode = TYPE; + break; + } + if (here_op & 64) { + strm.msg = "invalid literal/length code"; + state.mode = BAD; + break; + } + state.extra = here_op & 15; + state.mode = LENEXT; + case LENEXT: + if (state.extra) { + n = state.extra; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state.length += hold & (1 << state.extra) - 1; + hold >>>= state.extra; + bits -= state.extra; + state.back += state.extra; + } + state.was = state.length; + state.mode = DIST; + case DIST: + for (; ; ) { + here = state.distcode[hold & (1 << state.distbits) - 1]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if ((here_op & 240) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (; ; ) { + here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; + here_bits = here >>> 24; + here_op = here >>> 16 & 255; + here_val = here & 65535; + if (last_bits + here_bits <= bits) { + break; + } + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + hold >>>= last_bits; + bits -= last_bits; + state.back += last_bits; + } + hold >>>= here_bits; + bits -= here_bits; + state.back += here_bits; + if (here_op & 64) { + strm.msg = "invalid distance code"; + state.mode = BAD; + break; + } + state.offset = here_val; + state.extra = here_op & 15; + state.mode = DISTEXT; + case DISTEXT: + if (state.extra) { + n = state.extra; + while (bits < n) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + state.offset += hold & (1 << state.extra) - 1; + hold >>>= state.extra; + bits -= state.extra; + state.back += state.extra; + } + if (state.offset > state.dmax) { + strm.msg = "invalid distance too far back"; + state.mode = BAD; + break; + } + state.mode = MATCH; + case MATCH: + if (left === 0) { + break inf_leave; + } + copy = _out - left; + if (state.offset > copy) { + copy = state.offset - copy; + if (copy > state.whave) { + if (state.sane) { + strm.msg = "invalid distance too far back"; + state.mode = BAD; + break; + } + } + if (copy > state.wnext) { + copy -= state.wnext; + from = state.wsize - copy; + } else { + from = state.wnext - copy; + } + if (copy > state.length) { + copy = state.length; + } + from_source = state.window; + } else { + from_source = output; + from = put - state.offset; + copy = state.length; + } + if (copy > left) { + copy = left; + } + left -= copy; + state.length -= copy; + do { + output[put++] = from_source[from++]; + } while (--copy); + if (state.length === 0) { + state.mode = LEN; + } + break; + case LIT: + if (left === 0) { + break inf_leave; + } + output[put++] = state.length; + left--; + state.mode = LEN; + break; + case CHECK: + if (state.wrap) { + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold |= input[next++] << bits; + bits += 8; + } + _out -= left; + strm.total_out += _out; + state.total += _out; + if (state.wrap & 4 && _out) { + strm.adler = state.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/ + state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out); + } + _out = left; + if (state.wrap & 4 && (state.flags ? hold : zswap32(hold)) !== state.check) { + strm.msg = "incorrect data check"; + state.mode = BAD; + break; + } + hold = 0; + bits = 0; + } + state.mode = LENGTH; + case LENGTH: + if (state.wrap && state.flags) { + while (bits < 32) { + if (have === 0) { + break inf_leave; + } + have--; + hold += input[next++] << bits; + bits += 8; + } + if (state.wrap & 4 && hold !== (state.total & 4294967295)) { + strm.msg = "incorrect length check"; + state.mode = BAD; + break; + } + hold = 0; + bits = 0; + } + state.mode = DONE; + case DONE: + ret = Z_STREAM_END$1; + break inf_leave; + case BAD: + ret = Z_DATA_ERROR$1; + break inf_leave; + case MEM: + return Z_MEM_ERROR$1; + case SYNC: + default: + return Z_STREAM_ERROR$1; + } + } + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH$1)) { + if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) + ; + } + _in -= strm.avail_in; + _out -= strm.avail_out; + strm.total_in += _in; + strm.total_out += _out; + state.total += _out; + if (state.wrap & 4 && _out) { + strm.adler = state.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/ + state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out); + } + strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); + if ((_in === 0 && _out === 0 || flush === Z_FINISH$1) && ret === Z_OK$1) { + ret = Z_BUF_ERROR; + } + return ret; +}; +const inflateEnd = (strm) => { + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR$1; + } + let state = strm.state; + if (state.window) { + state.window = null; + } + strm.state = null; + return Z_OK$1; +}; +const inflateGetHeader = (strm, head) => { + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR$1; + } + const state = strm.state; + if ((state.wrap & 2) === 0) { + return Z_STREAM_ERROR$1; + } + state.head = head; + head.done = false; + return Z_OK$1; +}; +const inflateSetDictionary = (strm, dictionary) => { + const dictLength = dictionary.length; + let state; + let dictid; + let ret; + if (inflateStateCheck(strm)) { + return Z_STREAM_ERROR$1; + } + state = strm.state; + if (state.wrap !== 0 && state.mode !== DICT) { + return Z_STREAM_ERROR$1; + } + if (state.mode === DICT) { + dictid = 1; + dictid = adler32_1(dictid, dictionary, dictLength, 0); + if (dictid !== state.check) { + return Z_DATA_ERROR$1; + } + } + ret = updatewindow(strm, dictionary, dictLength, dictLength); + if (ret) { + state.mode = MEM; + return Z_MEM_ERROR$1; + } + state.havedict = 1; + return Z_OK$1; +}; +var inflateReset_1 = inflateReset; +var inflateReset2_1 = inflateReset2; +var inflateResetKeep_1 = inflateResetKeep; +var inflateInit_1 = inflateInit; +var inflateInit2_1 = inflateInit2; +var inflate_2$1 = inflate$2; +var inflateEnd_1 = inflateEnd; +var inflateGetHeader_1 = inflateGetHeader; +var inflateSetDictionary_1 = inflateSetDictionary; +var inflateInfo = "pako inflate (from Nodeca project)"; +var inflate_1$2 = { + inflateReset: inflateReset_1, + inflateReset2: inflateReset2_1, + inflateResetKeep: inflateResetKeep_1, + inflateInit: inflateInit_1, + inflateInit2: inflateInit2_1, + inflate: inflate_2$1, + inflateEnd: inflateEnd_1, + inflateGetHeader: inflateGetHeader_1, + inflateSetDictionary: inflateSetDictionary_1, + inflateInfo +}; +function GZheader() { + this.text = 0; + this.time = 0; + this.xflags = 0; + this.os = 0; + this.extra = null; + this.extra_len = 0; + this.name = ""; + this.comment = ""; + this.hcrc = 0; + this.done = false; +} +var gzheader = GZheader; +const toString$2 = Object.prototype.toString; +const { + Z_NO_FLUSH, + Z_FINISH, + Z_OK, + Z_STREAM_END, + Z_NEED_DICT, + Z_STREAM_ERROR, + Z_DATA_ERROR, + Z_MEM_ERROR +} = constants$2; +function Inflate$1(options) { + this.options = common.assign({ + chunkSize: 1024 * 64, + windowBits: 15, + to: "" + }, options || {}); + const opt = this.options; + if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) { + opt.windowBits = -opt.windowBits; + if (opt.windowBits === 0) { + opt.windowBits = -15; + } + } + if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) { + opt.windowBits += 32; + } + if (opt.windowBits > 15 && opt.windowBits < 48) { + if ((opt.windowBits & 15) === 0) { + opt.windowBits |= 15; + } + } + this.err = 0; + this.msg = ""; + this.ended = false; + this.chunks = []; + this.strm = new zstream(); + this.strm.avail_out = 0; + let status = inflate_1$2.inflateInit2( + this.strm, + opt.windowBits + ); + if (status !== Z_OK) { + throw new Error(messages[status]); + } + this.header = new gzheader(); + inflate_1$2.inflateGetHeader(this.strm, this.header); + if (opt.dictionary) { + if (typeof opt.dictionary === "string") { + opt.dictionary = strings.string2buf(opt.dictionary); + } else if (toString$2.call(opt.dictionary) === "[object ArrayBuffer]") { + opt.dictionary = new Uint8Array(opt.dictionary); + } + if (opt.raw) { + status = inflate_1$2.inflateSetDictionary(this.strm, opt.dictionary); + if (status !== Z_OK) { + throw new Error(messages[status]); + } + } + } +} +Inflate$1.prototype.push = function(data, flush_mode) { + const strm = this.strm; + const chunkSize = this.options.chunkSize; + const dictionary = this.options.dictionary; + let status, _flush_mode, last_avail_out; + if (this.ended) + return false; + if (flush_mode === ~~flush_mode) + _flush_mode = flush_mode; + else + _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH; + if (toString$2.call(data) === "[object ArrayBuffer]") { + strm.input = new Uint8Array(data); + } else { + strm.input = data; + } + strm.next_in = 0; + strm.avail_in = strm.input.length; + for (; ; ) { + if (strm.avail_out === 0) { + strm.output = new Uint8Array(chunkSize); + strm.next_out = 0; + strm.avail_out = chunkSize; + } + status = inflate_1$2.inflate(strm, _flush_mode); + if (status === Z_NEED_DICT && dictionary) { + status = inflate_1$2.inflateSetDictionary(strm, dictionary); + if (status === Z_OK) { + status = inflate_1$2.inflate(strm, _flush_mode); + } else if (status === Z_DATA_ERROR) { + status = Z_NEED_DICT; + } + } + while (strm.avail_in > 0 && status === Z_STREAM_END && strm.state.wrap > 0 && data[strm.next_in] !== 0) { + inflate_1$2.inflateReset(strm); + status = inflate_1$2.inflate(strm, _flush_mode); + } + switch (status) { + case Z_STREAM_ERROR: + case Z_DATA_ERROR: + case Z_NEED_DICT: + case Z_MEM_ERROR: + this.onEnd(status); + this.ended = true; + return false; + } + last_avail_out = strm.avail_out; + if (strm.next_out) { + if (strm.avail_out === 0 || status === Z_STREAM_END) { + if (this.options.to === "string") { + let next_out_utf8 = strings.utf8border(strm.output, strm.next_out); + let tail = strm.next_out - next_out_utf8; + let utf8str = strings.buf2string(strm.output, next_out_utf8); + strm.next_out = tail; + strm.avail_out = chunkSize - tail; + if (tail) + strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0); + this.onData(utf8str); + } else { + this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out)); + } + } + } + if (status === Z_OK && last_avail_out === 0) + continue; + if (status === Z_STREAM_END) { + status = inflate_1$2.inflateEnd(this.strm); + this.onEnd(status); + this.ended = true; + return true; + } + if (strm.avail_in === 0) + break; + } + return true; +}; +Inflate$1.prototype.onData = function(chunk) { + this.chunks.push(chunk); +}; +Inflate$1.prototype.onEnd = function(status) { + if (status === Z_OK) { + if (this.options.to === "string") { + this.result = this.chunks.join(""); + } else { + this.result = common.flattenChunks(this.chunks); + } + } + this.chunks = []; + this.err = status; + this.msg = this.strm.msg; +}; +function inflate$1(input, options) { + const inflator = new Inflate$1(options); + inflator.push(input); + if (inflator.err) + throw inflator.msg || messages[inflator.err]; + return inflator.result; +} +function inflateRaw$1(input, options) { + options = options || {}; + options.raw = true; + return inflate$1(input, options); +} +var Inflate_1$1 = Inflate$1; +var inflate_2 = inflate$1; +var inflateRaw_1$1 = inflateRaw$1; +var ungzip$1 = inflate$1; +var constants = constants$2; +var inflate_1$1 = { + Inflate: Inflate_1$1, + inflate: inflate_2, + inflateRaw: inflateRaw_1$1, + ungzip: ungzip$1, + constants +}; +const { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1; +var inflateRaw_1 = inflateRaw; +function unzip(input) { + return inflateRaw_1(input.subarray(2)); +} +class AbortError extends Error { + constructor(message) { + super(message); + this.code = "ERR_ABORTED"; + } +} +function groupBlocks(blocks) { + blocks.sort((b0, b1) => Number(b0.offset) - Number(b1.offset)); + const blockGroups = []; + let lastBlock; + let lastBlockEnd; + for (let i = 0; i < blocks.length; i += 1) { + if (lastBlock && lastBlockEnd && Number(blocks[i].offset) - lastBlockEnd <= 2e3) { + lastBlock.length = BigInt(Number(lastBlock.length) + Number(blocks[i].length) - lastBlockEnd + Number(blocks[i].offset)); + lastBlock.blocks.push(blocks[i]); + } else { + blockGroups.push(lastBlock = { + blocks: [blocks[i]], + length: blocks[i].length, + offset: blocks[i].offset + }); + } + lastBlockEnd = Number(lastBlock.offset) + Number(lastBlock.length); + } + return blockGroups; +} +function checkAbortSignal(signal) { + if (!signal) { + return; + } + if (signal.aborted) { + if (typeof DOMException !== "undefined") { + throw new DOMException("aborted", "AbortError"); + } else { + const e = new AbortError("aborted"); + e.code = "ERR_ABORTED"; + throw e; + } + } +} +const BIG_WIG_TYPE_GRAPH = 1; +const BIG_WIG_TYPE_VSTEP = 2; +const BIG_WIG_TYPE_FSTEP = 3; +function coordFilter(s1, e1, s2, e2) { + return s1 < e2 && e1 >= s2; +} +function getParsers$1(isBigEndian) { + const le = isBigEndian ? "big" : "little"; + const summaryParser = new Parser().endianess(le).uint32("chromId").uint32("start").uint32("end").uint32("validCnt").floatle("minScore").floatle("maxScore").floatle("sumData").floatle("sumSqData").saveOffset("offset"); + const leafParser = new Parser().endianess(le).uint8("isLeaf").skip(1).uint16("cnt").choice({ + tag: "isLeaf", + choices: { + 1: new Parser().endianess(le).array("blocksToFetch", { + length: "cnt", + type: new Parser().endianess(le).uint32("startChrom").uint32("startBase").uint32("endChrom").uint32("endBase").uint64("blockOffset").uint64("blockSize").saveOffset("offset") + }), + 0: new Parser().array("recurOffsets", { + length: "cnt", + type: new Parser().endianess(le).uint32("startChrom").uint32("startBase").uint32("endChrom").uint32("endBase").uint64("blockOffset").saveOffset("offset") + }) + } + }); + const bigBedParser = new Parser().endianess(le).uint32("chromId").int32("start").int32("end").string("rest", { + zeroTerminated: true + }).saveOffset("offset"); + const bigWigParser = new Parser().endianess(le).skip(4).int32("blockStart").skip(4).uint32("itemStep").uint32("itemSpan").uint8("blockType").skip(1).uint16("itemCount").choice({ + tag: "blockType", + choices: { + [BIG_WIG_TYPE_FSTEP]: new Parser().array("items", { + length: "itemCount", + type: new Parser().floatle("score") + }), + [BIG_WIG_TYPE_VSTEP]: new Parser().array("items", { + length: "itemCount", + type: new Parser().endianess(le).int32("start").floatle("score") + }), + [BIG_WIG_TYPE_GRAPH]: new Parser().array("items", { + length: "itemCount", + type: new Parser().endianess(le).int32("start").int32("end").floatle("score") + }) + } + }); + return { + bigWigParser, + bigBedParser, + summaryParser, + leafParser + }; +} +class BlockView { + constructor(bbi, refsByName, cirTreeOffset, isBigEndian, isCompressed, blockType) { + this.bbi = bbi; + this.refsByName = refsByName; + this.cirTreeOffset = cirTreeOffset; + this.isBigEndian = isBigEndian; + this.isCompressed = isCompressed; + this.blockType = blockType; + this.featureCache = new _default({ + cache: new QuickLRU({ maxSize: 1e3 }), + fill: async (requestData, signal) => { + const len = Number(requestData.length); + const off = Number(requestData.offset); + const { buffer } = await this.bbi.read(Buffer2.alloc(len), 0, len, off, { + signal + }); + return buffer; + } + }); + if (!(cirTreeOffset >= 0)) { + throw new Error("invalid cirTreeOffset!"); + } + const parsers = getParsers$1(isBigEndian); + this.leafParser = parsers.leafParser; + this.bigBedParser = parsers.bigBedParser; + } + async readWigData(chrName, start, end, observer, opts) { + try { + const { refsByName, bbi, cirTreeOffset, isBigEndian } = this; + const chrId = refsByName[chrName]; + if (chrId === void 0) { + observer.complete(); + } + const request = { chrId, start, end }; + if (!this.cirTreePromise) { + this.cirTreePromise = bbi.read(Buffer2.alloc(48), 0, 48, Number(cirTreeOffset), opts); + } + const { buffer } = await this.cirTreePromise; + const cirBlockSize = isBigEndian ? buffer.readUInt32BE(4) : buffer.readUInt32LE(4); + let blocksToFetch = []; + let outstanding = 0; + const cirFobRecur2 = (cirBlockData, offset, level) => { + try { + const data = cirBlockData.subarray(offset); + const p = this.leafParser.parse(data); + if (p.blocksToFetch) { + blocksToFetch = blocksToFetch.concat(p.blocksToFetch.filter(filterFeats).map((l) => ({ + offset: l.blockOffset, + length: l.blockSize + }))); + } + if (p.recurOffsets) { + const recurOffsets = p.recurOffsets.filter(filterFeats).map((l) => Number(l.blockOffset)); + if (recurOffsets.length > 0) { + cirFobRecur(recurOffsets, level + 1); + } + } + } catch (e) { + observer.error(e); + } + }; + const filterFeats = (b) => { + const { startChrom, startBase, endChrom, endBase } = b; + return (startChrom < chrId || startChrom === chrId && startBase <= end) && (endChrom > chrId || endChrom === chrId && endBase >= start); + }; + const cirFobStartFetch = async (off, fr, level) => { + try { + const length = fr.max() - fr.min(); + const offset = fr.min(); + const resultBuffer = await this.featureCache.get(`${length}_${offset}`, { length, offset }, opts.signal); + for (let i = 0; i < off.length; i += 1) { + if (fr.contains(off[i])) { + cirFobRecur2(resultBuffer, off[i] - offset, level); + outstanding -= 1; + if (outstanding === 0) { + this.readFeatures(observer, blocksToFetch, { ...opts, request }); + } + } + } + } catch (e) { + observer.error(e); + } + }; + const cirFobRecur = (offset, level) => { + try { + outstanding += offset.length; + const maxCirBlockSpan = 4 + Number(cirBlockSize) * 32; + let spans = new Range(offset[0], offset[0] + maxCirBlockSpan); + for (let i = 1; i < offset.length; i += 1) { + const blockSpan = new Range(offset[i], offset[i] + maxCirBlockSpan); + spans = spans.union(blockSpan); + } + spans.getRanges().map((fr) => cirFobStartFetch(offset, fr, level)); + } catch (e) { + observer.error(e); + } + }; + return cirFobRecur([Number(cirTreeOffset) + 48], 1); + } catch (e) { + observer.error(e); + } + } + parseSummaryBlock(buffer, startOffset, request) { + const features = []; + let offset = startOffset; + const dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length); + while (offset < buffer.byteLength) { + const chromId = dataView.getUint32(offset, true); + offset += 4; + const start = dataView.getUint32(offset, true); + offset += 4; + const end = dataView.getUint32(offset, true); + offset += 4; + const validCnt = dataView.getUint32(offset, true); + offset += 4; + const minScore = dataView.getFloat32(offset, true); + offset += 4; + const maxScore = dataView.getFloat32(offset, true); + offset += 4; + const sumData = dataView.getFloat32(offset, true); + offset += 4; + offset += 4; + if (request ? chromId === request.chrId && coordFilter(start, end, request.start, request.end) : true) { + features.push({ + start, + end, + maxScore, + minScore, + summary: true, + score: sumData / (validCnt || 1) + }); + } + } + return features; + } + parseBigBedBlock(data, startOffset, offset, request) { + const items = []; + let currOffset = startOffset; + while (currOffset < data.byteLength) { + const res = this.bigBedParser.parse(data.subarray(currOffset)); + items.push({ ...res, uniqueId: `bb-${offset + currOffset}` }); + currOffset += res.offset; + } + return request ? items.filter((f) => coordFilter(f.start, f.end, request.start, request.end)) : items; + } + parseBigWigBlock(buffer, startOffset, request) { + const b = buffer.subarray(startOffset); + const dataView = new DataView(b.buffer, b.byteOffset, b.length); + let offset = 0; + offset += 4; + const blockStart = dataView.getInt32(offset, true); + offset += 8; + const itemStep = dataView.getUint32(offset, true); + offset += 4; + const itemSpan = dataView.getUint32(offset, true); + offset += 4; + const blockType = dataView.getUint8(offset); + offset += 2; + const itemCount = dataView.getUint16(offset, true); + offset += 2; + const items = new Array(itemCount); + switch (blockType) { + case 1: + for (let i = 0; i < itemCount; i++) { + const start = dataView.getInt32(offset, true); + offset += 4; + const end = dataView.getInt32(offset, true); + offset += 4; + const score = dataView.getFloat32(offset, true); + offset += 4; + items[i] = { start, end, score }; + } + break; + case 2: + for (let i = 0; i < itemCount; i++) { + const start = dataView.getInt32(offset, true); + offset += 4; + const score = dataView.getFloat32(offset, true); + offset += 4; + items[i] = { score, start, end: start + itemSpan }; + } + break; + case 3: + for (let i = 0; i < itemCount; i++) { + const score = dataView.getFloat32(offset, true); + offset += 4; + const start = blockStart + i * itemStep; + items[i] = { score, start, end: start + itemSpan }; + } + break; + } + return request ? items.filter((f) => coordFilter(f.start, f.end, request.start, request.end)) : items; + } + async readFeatures(observer, blocks, opts = {}) { + try { + const { blockType, isCompressed } = this; + const { signal, request } = opts; + const blockGroupsToFetch = groupBlocks(blocks); + checkAbortSignal(signal); + await Promise.all(blockGroupsToFetch.map(async (blockGroup) => { + checkAbortSignal(signal); + const { length, offset } = blockGroup; + const data = await this.featureCache.get(`${length}_${offset}`, blockGroup, signal); + blockGroup.blocks.forEach((block) => { + checkAbortSignal(signal); + let blockOffset = Number(block.offset) - Number(blockGroup.offset); + let resultData = data; + if (isCompressed) { + resultData = unzip(data.subarray(blockOffset)); + blockOffset = 0; + } + checkAbortSignal(signal); + switch (blockType) { + case "summary": + observer.next(this.parseSummaryBlock(resultData, blockOffset, request)); + break; + case "bigwig": + observer.next(this.parseBigWigBlock(resultData, blockOffset, request)); + break; + case "bigbed": + observer.next(this.parseBigBedBlock(resultData, blockOffset, Number(block.offset) * (1 << 8), request)); + break; + default: + console.warn(`Don't know what to do with ${blockType}`); + } + }); + })); + observer.complete(); + } catch (e) { + observer.error(e); + } + } +} +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) + if (Object.prototype.hasOwnProperty.call(b2, p)) + d2[p] = b2[p]; + }; + return extendStatics(d, b); +}; +function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} +function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m2 = s && o[s], i = 0; + if (m2) + return m2.call(o); + if (o && typeof o.length === "number") + return { + next: function() { + if (o && i >= o.length) + o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} +function __read(o, n) { + var m2 = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m2) + return o; + var i = m2.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) + ar.push(r.value); + } catch (error) { + e = { error }; + } finally { + try { + if (r && !r.done && (m2 = i["return"])) + m2.call(i); + } finally { + if (e) + throw e.error; + } + } + return ar; +} +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) + for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} +typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; +function isFunction(value) { + return typeof value === "function"; +} +function createErrorClass(createImpl) { + var _super = function(instance) { + Error.call(instance); + instance.stack = new Error().stack; + }; + var ctorFunc = createImpl(_super); + ctorFunc.prototype = Object.create(Error.prototype); + ctorFunc.prototype.constructor = ctorFunc; + return ctorFunc; +} +var UnsubscriptionError = createErrorClass(function(_super) { + return function UnsubscriptionErrorImpl(errors) { + _super(this); + this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err2, i) { + return i + 1 + ") " + err2.toString(); + }).join("\n ") : ""; + this.name = "UnsubscriptionError"; + this.errors = errors; + }; +}); +function arrRemove(arr, item) { + if (arr) { + var index = arr.indexOf(item); + 0 <= index && arr.splice(index, 1); + } +} +var Subscription = function() { + function Subscription2(initialTeardown) { + this.initialTeardown = initialTeardown; + this.closed = false; + this._parentage = null; + this._finalizers = null; + } + Subscription2.prototype.unsubscribe = function() { + var e_1, _a, e_2, _b; + var errors; + if (!this.closed) { + this.closed = true; + var _parentage = this._parentage; + if (_parentage) { + this._parentage = null; + if (Array.isArray(_parentage)) { + try { + for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) { + var parent_1 = _parentage_1_1.value; + parent_1.remove(this); + } + } catch (e_1_1) { + e_1 = { error: e_1_1 }; + } finally { + try { + if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) + _a.call(_parentage_1); + } finally { + if (e_1) + throw e_1.error; + } + } + } else { + _parentage.remove(this); + } + } + var initialFinalizer = this.initialTeardown; + if (isFunction(initialFinalizer)) { + try { + initialFinalizer(); + } catch (e) { + errors = e instanceof UnsubscriptionError ? e.errors : [e]; + } + } + var _finalizers = this._finalizers; + if (_finalizers) { + this._finalizers = null; + try { + for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) { + var finalizer = _finalizers_1_1.value; + try { + execFinalizer(finalizer); + } catch (err2) { + errors = errors !== null && errors !== void 0 ? errors : []; + if (err2 instanceof UnsubscriptionError) { + errors = __spreadArray(__spreadArray([], __read(errors)), __read(err2.errors)); + } else { + errors.push(err2); + } + } + } + } catch (e_2_1) { + e_2 = { error: e_2_1 }; + } finally { + try { + if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) + _b.call(_finalizers_1); + } finally { + if (e_2) + throw e_2.error; + } + } + } + if (errors) { + throw new UnsubscriptionError(errors); + } + } + }; + Subscription2.prototype.add = function(teardown) { + var _a; + if (teardown && teardown !== this) { + if (this.closed) { + execFinalizer(teardown); + } else { + if (teardown instanceof Subscription2) { + if (teardown.closed || teardown._hasParent(this)) { + return; + } + teardown._addParent(this); + } + (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown); + } + } + }; + Subscription2.prototype._hasParent = function(parent) { + var _parentage = this._parentage; + return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent); + }; + Subscription2.prototype._addParent = function(parent) { + var _parentage = this._parentage; + this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent; + }; + Subscription2.prototype._removeParent = function(parent) { + var _parentage = this._parentage; + if (_parentage === parent) { + this._parentage = null; + } else if (Array.isArray(_parentage)) { + arrRemove(_parentage, parent); + } + }; + Subscription2.prototype.remove = function(teardown) { + var _finalizers = this._finalizers; + _finalizers && arrRemove(_finalizers, teardown); + if (teardown instanceof Subscription2) { + teardown._removeParent(this); + } + }; + Subscription2.EMPTY = function() { + var empty = new Subscription2(); + empty.closed = true; + return empty; + }(); + return Subscription2; +}(); +Subscription.EMPTY; +function isSubscription(value) { + return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe); +} +function execFinalizer(finalizer) { + if (isFunction(finalizer)) { + finalizer(); + } else { + finalizer.unsubscribe(); + } +} +var config$2 = { + onUnhandledError: null, + onStoppedNotification: null, + Promise: void 0, + useDeprecatedSynchronousErrorHandling: false, + useDeprecatedNextContext: false +}; +var timeoutProvider = { + setTimeout: function(handler, timeout) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var delegate = timeoutProvider.delegate; + if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) { + return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args))); + } + return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args))); + }, + clearTimeout: function(handle) { + var delegate = timeoutProvider.delegate; + return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle); + }, + delegate: void 0 +}; +function reportUnhandledError(err2) { + timeoutProvider.setTimeout(function() { + { + throw err2; + } + }); +} +function noop() { +} +function errorContext(cb) { + { + cb(); + } +} +var Subscriber = function(_super) { + __extends(Subscriber2, _super); + function Subscriber2(destination) { + var _this = _super.call(this) || this; + _this.isStopped = false; + if (destination) { + _this.destination = destination; + if (isSubscription(destination)) { + destination.add(_this); + } + } else { + _this.destination = EMPTY_OBSERVER; + } + return _this; + } + Subscriber2.create = function(next, error, complete) { + return new SafeSubscriber(next, error, complete); + }; + Subscriber2.prototype.next = function(value) { + if (this.isStopped) + ; + else { + this._next(value); + } + }; + Subscriber2.prototype.error = function(err2) { + if (this.isStopped) + ; + else { + this.isStopped = true; + this._error(err2); + } + }; + Subscriber2.prototype.complete = function() { + if (this.isStopped) + ; + else { + this.isStopped = true; + this._complete(); + } + }; + Subscriber2.prototype.unsubscribe = function() { + if (!this.closed) { + this.isStopped = true; + _super.prototype.unsubscribe.call(this); + this.destination = null; + } + }; + Subscriber2.prototype._next = function(value) { + this.destination.next(value); + }; + Subscriber2.prototype._error = function(err2) { + try { + this.destination.error(err2); + } finally { + this.unsubscribe(); + } + }; + Subscriber2.prototype._complete = function() { + try { + this.destination.complete(); + } finally { + this.unsubscribe(); + } + }; + return Subscriber2; +}(Subscription); +var _bind = Function.prototype.bind; +function bind(fn, thisArg) { + return _bind.call(fn, thisArg); +} +var ConsumerObserver = function() { + function ConsumerObserver2(partialObserver) { + this.partialObserver = partialObserver; + } + ConsumerObserver2.prototype.next = function(value) { + var partialObserver = this.partialObserver; + if (partialObserver.next) { + try { + partialObserver.next(value); + } catch (error) { + handleUnhandledError(error); + } + } + }; + ConsumerObserver2.prototype.error = function(err2) { + var partialObserver = this.partialObserver; + if (partialObserver.error) { + try { + partialObserver.error(err2); + } catch (error) { + handleUnhandledError(error); + } + } else { + handleUnhandledError(err2); + } + }; + ConsumerObserver2.prototype.complete = function() { + var partialObserver = this.partialObserver; + if (partialObserver.complete) { + try { + partialObserver.complete(); + } catch (error) { + handleUnhandledError(error); + } + } + }; + return ConsumerObserver2; +}(); +var SafeSubscriber = function(_super) { + __extends(SafeSubscriber2, _super); + function SafeSubscriber2(observerOrNext, error, complete) { + var _this = _super.call(this) || this; + var partialObserver; + if (isFunction(observerOrNext) || !observerOrNext) { + partialObserver = { + next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0, + error: error !== null && error !== void 0 ? error : void 0, + complete: complete !== null && complete !== void 0 ? complete : void 0 + }; + } else { + var context_1; + if (_this && config$2.useDeprecatedNextContext) { + context_1 = Object.create(observerOrNext); + context_1.unsubscribe = function() { + return _this.unsubscribe(); + }; + partialObserver = { + next: observerOrNext.next && bind(observerOrNext.next, context_1), + error: observerOrNext.error && bind(observerOrNext.error, context_1), + complete: observerOrNext.complete && bind(observerOrNext.complete, context_1) + }; + } else { + partialObserver = observerOrNext; + } + } + _this.destination = new ConsumerObserver(partialObserver); + return _this; + } + return SafeSubscriber2; +}(Subscriber); +function handleUnhandledError(error) { + { + reportUnhandledError(error); + } +} +function defaultErrorHandler(err2) { + throw err2; +} +var EMPTY_OBSERVER = { + closed: true, + next: noop, + error: defaultErrorHandler, + complete: noop +}; +var observable = function() { + return typeof Symbol === "function" && Symbol.observable || "@@observable"; +}(); +function identity(x) { + return x; +} +function pipeFromArray(fns) { + if (fns.length === 0) { + return identity; + } + if (fns.length === 1) { + return fns[0]; + } + return function piped(input) { + return fns.reduce(function(prev, fn) { + return fn(prev); + }, input); + }; +} +var Observable = function() { + function Observable2(subscribe2) { + if (subscribe2) { + this._subscribe = subscribe2; + } + } + Observable2.prototype.lift = function(operator) { + var observable2 = new Observable2(); + observable2.source = this; + observable2.operator = operator; + return observable2; + }; + Observable2.prototype.subscribe = function(observerOrNext, error, complete) { + var _this = this; + var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete); + errorContext(function() { + var _a = _this, operator = _a.operator, source = _a.source; + subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber)); + }); + return subscriber; + }; + Observable2.prototype._trySubscribe = function(sink) { + try { + return this._subscribe(sink); + } catch (err2) { + sink.error(err2); + } + }; + Observable2.prototype.forEach = function(next, promiseCtor) { + var _this = this; + promiseCtor = getPromiseCtor(promiseCtor); + return new promiseCtor(function(resolve, reject) { + var subscriber = new SafeSubscriber({ + next: function(value) { + try { + next(value); + } catch (err2) { + reject(err2); + subscriber.unsubscribe(); + } + }, + error: reject, + complete: resolve + }); + _this.subscribe(subscriber); + }); + }; + Observable2.prototype._subscribe = function(subscriber) { + var _a; + return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber); + }; + Observable2.prototype[observable] = function() { + return this; + }; + Observable2.prototype.pipe = function() { + var operations = []; + for (var _i = 0; _i < arguments.length; _i++) { + operations[_i] = arguments[_i]; + } + return pipeFromArray(operations)(this); + }; + Observable2.prototype.toPromise = function(promiseCtor) { + var _this = this; + promiseCtor = getPromiseCtor(promiseCtor); + return new promiseCtor(function(resolve, reject) { + var value; + _this.subscribe(function(x) { + return value = x; + }, function(err2) { + return reject(err2); + }, function() { + return resolve(value); + }); + }); + }; + Observable2.create = function(subscribe2) { + return new Observable2(subscribe2); + }; + return Observable2; +}(); +function getPromiseCtor(promiseCtor) { + var _a; + return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config$2.Promise) !== null && _a !== void 0 ? _a : Promise; +} +function isObserver(value) { + return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete); +} +function isSubscriber(value) { + return value && value instanceof Subscriber || isObserver(value) && isSubscription(value); +} +function hasLift(source) { + return isFunction(source === null || source === void 0 ? void 0 : source.lift); +} +function operate(init2) { + return function(source) { + if (hasLift(source)) { + return source.lift(function(liftedSource) { + try { + return init2(liftedSource, this); + } catch (err2) { + this.error(err2); + } + }); + } + throw new TypeError("Unable to lift unknown Observable type"); + }; +} +function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) { + return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize); +} +var OperatorSubscriber = function(_super) { + __extends(OperatorSubscriber2, _super); + function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) { + var _this = _super.call(this, destination) || this; + _this.onFinalize = onFinalize; + _this.shouldUnsubscribe = shouldUnsubscribe; + _this._next = onNext ? function(value) { + try { + onNext(value); + } catch (err2) { + destination.error(err2); + } + } : _super.prototype._next; + _this._error = onError ? function(err2) { + try { + onError(err2); + } catch (err3) { + destination.error(err3); + } finally { + this.unsubscribe(); + } + } : _super.prototype._error; + _this._complete = onComplete ? function() { + try { + onComplete(); + } catch (err2) { + destination.error(err2); + } finally { + this.unsubscribe(); + } + } : _super.prototype._complete; + return _this; + } + OperatorSubscriber2.prototype.unsubscribe = function() { + var _a; + if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { + var closed_1 = this.closed; + _super.prototype.unsubscribe.call(this); + !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this)); + } + }; + return OperatorSubscriber2; +}(Subscriber); +var EmptyError = createErrorClass(function(_super) { + return function EmptyErrorImpl() { + _super(this); + this.name = "EmptyError"; + this.message = "no elements in sequence"; + }; +}); +function firstValueFrom(source, config2) { + var hasConfig = typeof config2 === "object"; + return new Promise(function(resolve, reject) { + var subscriber = new SafeSubscriber({ + next: function(value) { + resolve(value); + subscriber.unsubscribe(); + }, + error: reject, + complete: function() { + if (hasConfig) { + resolve(config2.defaultValue); + } else { + reject(new EmptyError()); + } + } + }); + source.subscribe(subscriber); + }); +} +function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) { + return function(source, subscriber) { + var hasState = hasSeed; + var state = seed; + var index = 0; + source.subscribe(createOperatorSubscriber(subscriber, function(value) { + var i = index++; + state = hasState ? accumulator(state, value, i) : (hasState = true, value); + emitOnNext && subscriber.next(state); + }, emitBeforeComplete && function() { + hasState && subscriber.next(state); + subscriber.complete(); + })); + }; +} +function reduce(accumulator, seed) { + return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true)); +} +var arrReducer = function(arr, value) { + return arr.push(value), arr; +}; +function toArray() { + return operate(function(source, subscriber) { + reduce(arrReducer, [])(source).subscribe(subscriber); + }); +} +const BIG_WIG_MAGIC = -2003829722; +const BIG_BED_MAGIC = -2021002517; +function toString(arr) { + return new TextDecoder().decode(arr); +} +function getParsers(isBE) { + const le = isBE ? "big" : "little"; + const headerParser = new Parser().endianess(le).int32("magic").uint16("version").uint16("numZoomLevels").uint64("chromTreeOffset").uint64("unzoomedDataOffset").uint64("unzoomedIndexOffset").uint16("fieldCount").uint16("definedFieldCount").uint64("asOffset").uint64("totalSummaryOffset").uint32("uncompressBufSize").uint64("extHeaderOffset").array("zoomLevels", { + length: "numZoomLevels", + type: new Parser().endianess(le).uint32("reductionLevel").uint32("reserved").uint64("dataOffset").uint64("indexOffset") + }); + const totalSummaryParser = new Parser().endianess(le).uint64("basesCovered").doublele("scoreMin").doublele("scoreMax").doublele("scoreSum").doublele("scoreSumSquares"); + const chromTreeParser = new Parser().endianess(le).uint32("magic").uint32("blockSize").uint32("keySize").uint32("valSize").uint64("itemCount"); + const isLeafNode = new Parser().endianess(le).uint8("isLeafNode").skip(1).uint16("cnt").saveOffset("offset"); + return { + chromTreeParser, + totalSummaryParser, + headerParser, + isLeafNode + }; +} +class BBI { + /* fetch and parse header information from a bigwig or bigbed file + * @param abortSignal - abort the operation, can be null + * @return a Header object + */ + getHeader(opts = {}) { + const options = "aborted" in opts ? { signal: opts } : opts; + if (!this.headerP) { + this.headerP = this._getHeader(options).catch((e) => { + this.headerP = void 0; + throw e; + }); + } + return this.headerP; + } + /* + * @param filehandle - a filehandle from generic-filehandle or implementing something similar to the node10 fs.promises API + * @param path - a Local file path as a string + * @param url - a URL string + * @param renameRefSeqs - an optional method to rename the internal reference sequences using a mapping function + */ + constructor(options = {}) { + const { filehandle, renameRefSeqs = (s) => s, path, url } = options; + this.renameRefSeqs = renameRefSeqs; + if (filehandle) { + this.bbi = filehandle; + } else if (url) { + this.bbi = new RemoteFile$1(url); + } else if (path) { + this.bbi = new LocalFile(path); + } else { + throw new Error("no file given"); + } + } + async _getHeader(opts) { + const header = await this._getMainHeader(opts); + const chroms = await this._readChromTree(header, opts); + return { ...header, ...chroms }; + } + async _getMainHeader(opts, requestSize = 2e3) { + const { buffer } = await this.bbi.read(Buffer2.alloc(requestSize), 0, requestSize, 0, opts); + const isBigEndian = this._isBigEndian(buffer); + const ret = getParsers(isBigEndian); + const header = ret.headerParser.parse(buffer); + const { magic, asOffset, totalSummaryOffset } = header; + header.fileType = magic === BIG_BED_MAGIC ? "bigbed" : "bigwig"; + if (asOffset > requestSize || totalSummaryOffset > requestSize) { + return this._getMainHeader(opts, requestSize * 2); + } + if (asOffset) { + const off = Number(header.asOffset); + header.autoSql = toString(buffer.subarray(off, buffer.indexOf(0, off))); + } + if (header.totalSummaryOffset > requestSize) { + return this._getMainHeader(opts, requestSize * 2); + } + if (header.totalSummaryOffset) { + const tail = buffer.subarray(Number(header.totalSummaryOffset)); + const sum2 = ret.totalSummaryParser.parse(tail); + header.totalSummary = { ...sum2, basesCovered: Number(sum2.basesCovered) }; + } + return { ...header, isBigEndian }; + } + _isBigEndian(buffer) { + let ret = buffer.readInt32LE(0); + if (ret === BIG_WIG_MAGIC || ret === BIG_BED_MAGIC) { + return false; + } + ret = buffer.readInt32BE(0); + if (ret === BIG_WIG_MAGIC || ret === BIG_BED_MAGIC) { + return true; + } + throw new Error("not a BigWig/BigBed file"); + } + // todo: add progress if long running + async _readChromTree(header, opts) { + const isBE = header.isBigEndian; + const le = isBE ? "big" : "little"; + const refsByNumber = []; + const refsByName = {}; + let unzoomedDataOffset = Number(header.unzoomedDataOffset); + const chromTreeOffset = Number(header.chromTreeOffset); + while (unzoomedDataOffset % 4 !== 0) { + unzoomedDataOffset += 1; + } + const off = unzoomedDataOffset - chromTreeOffset; + const { buffer } = await this.bbi.read(Buffer2.alloc(off), 0, off, Number(chromTreeOffset), opts); + const p = getParsers(isBE); + const { keySize } = p.chromTreeParser.parse(buffer); + const leafNodeParser = new Parser().endianess(le).string("key", { stripNull: true, length: keySize }).uint32("refId").uint32("refSize").saveOffset("offset"); + const nonleafNodeParser = new Parser().endianess(le).skip(keySize).uint64("childOffset").saveOffset("offset"); + const rootNodeOffset = 32; + const bptReadNode = async (currentOffset) => { + let offset = currentOffset; + if (offset >= buffer.length) { + throw new Error("reading beyond end of buffer"); + } + const ret = p.isLeafNode.parse(buffer.subarray(offset)); + const { isLeafNode, cnt } = ret; + offset += ret.offset; + if (isLeafNode) { + for (let n = 0; n < cnt; n += 1) { + const leafRet = leafNodeParser.parse(buffer.subarray(offset)); + offset += leafRet.offset; + const { key, refId, refSize } = leafRet; + const refRec = { name: key, id: refId, length: refSize }; + refsByName[this.renameRefSeqs(key)] = refId; + refsByNumber[refId] = refRec; + } + } else { + const nextNodes = []; + for (let n = 0; n < cnt; n += 1) { + const nonleafRet = nonleafNodeParser.parse(buffer.subarray(offset)); + const { childOffset } = nonleafRet; + offset += nonleafRet.offset; + nextNodes.push(bptReadNode(Number(childOffset) - Number(chromTreeOffset))); + } + await Promise.all(nextNodes); + } + }; + await bptReadNode(rootNodeOffset); + return { + refsByName, + refsByNumber + }; + } + /* + * fetches the "unzoomed" view of the bigwig data. this is the default for bigbed + * @param abortSignal - a signal to optionally abort this operation + */ + async getUnzoomedView(opts) { + const { unzoomedIndexOffset, refsByName, uncompressBufSize, isBigEndian, fileType } = await this.getHeader(opts); + return new BlockView(this.bbi, refsByName, unzoomedIndexOffset, isBigEndian, uncompressBufSize > 0, fileType); + } + /** + * Gets features from a BigWig file + * + * @param refName - The chromosome name + * @param start - The start of a region + * @param end - The end of a region + * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) or scale used to infer the zoomLevel to use + */ + async getFeatureStream(refName, start, end, opts = { + scale: 1 + }) { + await this.getHeader(opts); + const chrName = this.renameRefSeqs(refName); + let view; + if (opts.basesPerSpan) { + view = await this.getView(1 / opts.basesPerSpan, opts); + } else if (opts.scale) { + view = await this.getView(opts.scale, opts); + } else { + view = await this.getView(1, opts); + } + if (!view) { + throw new Error("unable to get block view for data"); + } + return new Observable((observer) => { + view.readWigData(chrName, start, end, observer, opts); + }); + } + async getFeatures(refName, start, end, opts = { + scale: 1 + }) { + const ob = await this.getFeatureStream(refName, start, end, opts); + const ret = await firstValueFrom(ob.pipe(toArray())); + return ret.flat(); + } +} +class BigWig extends BBI { + /** + * Retrieves a BlockView of a specific zoomLevel + * + * @param scale - number + * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) or scale used to infer the zoomLevel to use + */ + async getView(scale, opts) { + const { zoomLevels, refsByName, fileSize, isBigEndian, uncompressBufSize } = await this.getHeader(opts); + const basesPerPx = 1 / scale; + let maxLevel = zoomLevels.length; + if (!fileSize) { + maxLevel -= 1; + } + for (let i = maxLevel; i >= 0; i -= 1) { + const zh = zoomLevels[i]; + if (zh && zh.reductionLevel <= 2 * basesPerPx) { + const indexOffset = Number(zh.indexOffset); + return new BlockView(this.bbi, refsByName, indexOffset, isBigEndian, uncompressBufSize > 0, "summary"); + } + } + return this.getUnzoomedView(opts); + } +} +function BigWigDataFetcher(HGC, dataConfig) { + if (!new.target) { + throw new Error('Uncaught TypeError: Class constructor cannot be invoked without "new"'); + } + const cls = class BigWigDataFetcherClass { + constructor() { + __publicField(this, "dataConfig"); + __publicField(this, "bwFileHeader"); + __publicField(this, "bwFile"); + __publicField(this, "TILE_SIZE"); + __publicField(this, "errorTxt"); + __publicField(this, "dataPromises"); + __publicField(this, "chromSizes"); + __publicField(this, "assembly"); + __publicField(this, "tilesetInfoLoading"); + this.dataConfig = dataConfig; + this.assembly = this.dataConfig.assembly; + this.bwFileHeader = null; + this.bwFile = null; + this.TILE_SIZE = 1024; + this.errorTxt = ""; + this.dataPromises = []; + const chromosomeSizes = computeChromSizes(this.assembly).size; + const chromosomeCumPositions = []; + const chromosomePositions = {}; + let prevEndPosition = 0; + Object.keys(computeChromSizes(this.assembly).size).forEach((chrStr, i) => { + const positionInfo = { + id: i, + chr: chrStr, + pos: prevEndPosition + }; + chromosomeCumPositions.push(positionInfo); + chromosomePositions[chrStr] = positionInfo; + prevEndPosition += computeChromSizes(this.assembly).size[chrStr]; + }); + this.chromSizes = { + chrToAbs: (chrom, chromPos) => this.chromSizes.chrPositions[chrom].pos + chromPos, + cumPositions: chromosomeCumPositions, + chrPositions: chromosomePositions, + totalLength: prevEndPosition, + chromLengths: chromosomeSizes + }; + this.dataPromises.push(this.loadBBI(dataConfig)); + } + async loadBBI(dataConfig2) { + if (dataConfig2.url) { + this.bwFile = new BigWig({ + filehandle: new RemoteFile(dataConfig2.url, { overrides: dataConfig2.urlFetchOptions }) + }); + return this.bwFile.getHeader().then((h) => { + this.bwFileHeader = h; + }); + } else { + console.error('Please enter a "url" field to the data config'); + return null; + } + } + tilesetInfo(callback) { + this.tilesetInfoLoading = true; + return Promise.all(this.dataPromises).then(() => { + this.tilesetInfoLoading = false; + const totalLength = this.chromSizes.totalLength; + const retVal = { + tile_size: this.TILE_SIZE, + max_zoom: Math.ceil(Math.log(totalLength / this.TILE_SIZE) / Math.log(2)), + max_width: 2 ** Math.ceil(Math.log(totalLength) / Math.log(2)), + min_pos: [0], + max_pos: [totalLength] + }; + if (callback) { + callback(retVal); + } + return retVal; + }).catch((err2) => { + this.tilesetInfoLoading = false; + console.error(err2); + if (callback) { + callback({ + error: `Error parsing bigwig: ${err2}` + }); + } + return null; + }); + } + fetchTilesDebounced(receivedTiles, tileIds) { + const tiles = {}; + const validTileIds = []; + const tilePromises = []; + for (const tileId of tileIds) { + const parts = tileId.split("."); + const z = parseInt(parts[0], 10); + const x = parseInt(parts[1], 10); + if (Number.isNaN(x) || Number.isNaN(z)) { + console.warn("Invalid tile zoom or position:", z, x); + continue; + } + validTileIds.push(tileId); + tilePromises.push(this.tile(z, x)); + } + Promise.all(tilePromises).then((values) => { + for (let i = 0; i < values.length; i++) { + const validTileId = validTileIds[i]; + tiles[validTileId] = values[i]; + tiles[validTileId].tilePositionId = validTileId; + } + receivedTiles(tiles); + }); + return tiles; + } + async tile(z, x) { + const tsInfo = await this.tilesetInfo(); + const tileWidth = +tsInfo.max_width / 2 ** +z; + const recordPromises = []; + const tile = { + tilePos: [x], + tileId: `bigwig.${z}.${x}`, + zoomLevel: z + }; + const minXOriginal = tsInfo.min_pos[0] + x * tileWidth; + let minX = minXOriginal; + const maxX = tsInfo.min_pos[0] + (x + 1) * tileWidth; + const basesPerPixel = this.determineScale(minX, maxX); + const basesPerBin = (maxX - minX) / this.TILE_SIZE; + const binStarts = []; + for (let i = 0; i < this.TILE_SIZE; i++) { + binStarts.push(minX + i * basesPerBin); + } + const { chromLengths, cumPositions } = this.chromSizes; + cumPositions.forEach((cumPos) => { + const chromName = cumPos.chr; + const chromStart = cumPos.pos; + const chromEnd = cumPos.pos + chromLengths[chromName]; + let startPos, endPos; + if (chromStart <= minX && minX < chromEnd) { + if (maxX > chromEnd) { + startPos = minX - chromStart; + endPos = chromEnd - chromStart; + recordPromises.push( + this.bwFile.getFeatures(chromName, startPos, endPos, { + scale: 1 / basesPerPixel + }).then((values) => { + values.forEach((v) => { + v["startAbs"] = HGC.utils.chrToAbs(chromName, v.start, this.chromSizes); + v["endAbs"] = HGC.utils.chrToAbs(chromName, v.end, this.chromSizes); + }); + return values; + }) + ); + minX = chromEnd; + } else { + startPos = Math.floor(minX - chromStart); + endPos = Math.ceil(maxX - chromStart); + if (!this.bwFile) + return; + recordPromises.push( + this.bwFile.getFeatures(chromName, startPos, endPos, { + scale: 1 / basesPerPixel + }).then((values) => { + values.forEach((v) => { + v["startAbs"] = HGC.utils.chrToAbs(chromName, v.start, this.chromSizes); + v["endAbs"] = HGC.utils.chrToAbs(chromName, v.end, this.chromSizes); + }); + return values; + }) + ); + return; + } + } + }); + return Promise.all(recordPromises).then((v) => { + const values = v.flat(); + const dense = []; + for (let i = 0; i < this.TILE_SIZE; i++) { + dense.push(null); + } + binStarts.forEach((curStart, index) => { + if (curStart < minXOriginal || curStart > maxX) { + return; + } + const filtered = values.filter((v2) => { + return curStart >= v2.startAbs && curStart < v2.endAbs; + }).map((v2) => v2.score); + dense[index] = filtered.length > 0 ? filtered[0] : null; + }); + const dde = new HGC.utils.DenseDataExtrema1D(dense); + tile.min_value = Math.min(...dense); + tile.max_value = Math.max(...dense); + tile.dense = dense; + tile.denseDataExtrema = dde; + tile.minNonZero = dde.minNonZeroInTile; + tile.maxNonZero = dde.maxNonZeroInTile; + return tile; + }); + } + // We never want to request more than 1024 * 20 elements from the file. + determineScale(minX, maxX) { + const reductionLevels = [1]; + const numRequestedElements = maxX - minX; + if (!this.bwFileHeader) { + throw Error("no bigwig header"); + } + this.bwFileHeader.zoomLevels.forEach((z) => { + reductionLevels.push(z.reductionLevel); + }); + let level; + reductionLevels.forEach((rl) => { + if (level) + return; + const numElementsFromFile = numRequestedElements / rl; + if (numElementsFromFile <= this.TILE_SIZE * 20) { + level = rl; + } + }); + return level || reductionLevels.slice(-1)[0]; + } + }; + return new cls(); +} +BigWigDataFetcher.config = { + type: "bigwig" +}; +function filterData(filter, data) { + const { field, not } = filter; + let output = Array.from(data); + if (IsOneOfFilter(filter)) { + const { oneOf } = filter; + output = output.filter((d) => { + return not ? oneOf.indexOf(d[field]) === -1 : oneOf.indexOf(d[field]) !== -1; + }); + } else if (IsRangeFilter(filter)) { + const { inRange } = filter; + output = output.filter((d) => { + const value = +d[field]; + return not ? !(inRange[0] <= value && value <= inRange[1]) : inRange[0] <= value && value <= inRange[1]; + }); + } else if (IsIncludeFilter(filter)) { + const { include } = filter; + output = output.filter((d) => { + return not ? `${d[field]}`.includes(include) : !`${d[field]}`.includes(include); + }); + } + return output; +} +function concatString(concat, data) { + const { fields, separator, newField } = concat; + let output = Array.from(data); + output = output.map((d) => { + const strs = fields.map((f) => d[f]); + d[newField] = strs.join(separator); + return d; + }); + return output; +} +function replaceString(_, data) { + const { field, replace, newField } = _; + let output = Array.from(data); + output = output.map((d) => { + d[newField] = d[field]; + replace.forEach((r) => { + const { from, to } = r; + d[newField] = d[newField].toString().replaceAll(from, to); + }); + return d; + }); + return output; +} +function calculateData(log, data) { + const { field, base, newField } = log; + let output = Array.from(data); + output = output.map((d) => { + if (+d[field]) { + if (base === "e") { + d[newField != null ? newField : field] = Math.log(+d[field]); + } else { + d[newField != null ? newField : field] = Math.log(+d[field]) / Math.log(base != null ? base : 10); + } + } + return d; + }); + return output; +} +function calculateGenomicLength(_, data) { + const { startField, endField, newField } = _; + const output = Array.from(data); + output.forEach((d) => { + const s = d[startField]; + const e = d[endField]; + if (!s || !e) { + return; + } + d[newField] = Math.abs(+e - +s); + }); + return output; +} +function inferSvType(_, data) { + const { firstBp, secondBp, newField } = _; + const output = Array.from(data); + const [DUP, TRA, DEL, t2tINV, h2hINV] = ["DUP", "TRA", "DEL", "t2tINV", "h2hINV"]; + output.forEach((d) => { + const chr1 = d[firstBp.chrField]; + const chr2 = d[secondBp.chrField]; + if (chr1 !== chr2) { + d[newField] = TRA; + return; + } + let pos1 = d[firstBp.posField]; + let pos2 = d[secondBp.posField]; + let strand1 = d[firstBp.strandField]; + let strand2 = d[secondBp.strandField]; + if (pos1 > pos2) { + const _pos = pos1; + const _strand = strand1; + pos1 = pos2; + strand1 = strand2; + pos2 = _pos; + strand2 = _strand; + } + switch (`${strand1}${strand2}`) { + case "+-": + d[newField] = DEL; + break; + case "--": + d[newField] = t2tINV; + break; + case "++": + d[newField] = h2hINV; + break; + case "-+": + d[newField] = DUP; + break; + default: + d[newField] = "unknown"; + } + }); + return output; +} +function aggregateCoverage(_, data, scale) { + const { startField, endField, newField, groupField } = _; + const coverage = {}; + const binSize = 1; + data.forEach((d) => { + const curStart = scale(d[startField]); + const curEnd = scale(d[endField]); + const group2 = groupField ? d[groupField] : "__NO_GROUP__"; + const adjustedStart = Math.floor(curStart); + for (let i = adjustedStart; i < curEnd; i += binSize) { + if (!coverage[group2]) { + coverage[group2] = {}; + } + if (!coverage[group2][i]) { + coverage[group2][i] = 0; + } + coverage[group2][i]++; + } + }); + const output = Object.entries(coverage).flatMap((group2) => { + const [groupName, coverageRecords] = group2; + return Object.entries(coverageRecords).map((entry) => { + const [key, value] = entry; + return { + [startField]: scale.invert(+key), + [endField]: scale.invert(+key + binSize), + [newField != null ? newField : "coverage"]: value, + [groupField != null ? groupField : "group"]: groupName + }; + }); + }); + return output; +} +function displace(t, data, scale) { + const { boundingBox, method, newField } = t; + const { startField, endField, groupField } = boundingBox; + let paddingInBp = 0; + if (boundingBox.padding && scale && !boundingBox.isPaddingBP) { + paddingInBp = Math.abs(scale.invert(boundingBox.padding) - scale.invert(0)); + } else if (boundingBox.padding && boundingBox.isPaddingBP) { + paddingInBp = boundingBox.padding; + } + const base = Array.from(data); + if (base && base.length > 0) { + if (!Object.keys(base[0]).find((d) => d === startField) || !Object.keys(base[0]).find((d) => d === endField)) { + return base; + } + } + if (method === "pile") { + const { maxRows } = t; + const occupiedSpaceInRows = {}; + const sorted = base.sort((a, b) => a[startField] - b[startField]); + sorted.forEach((d) => { + const start = +d[startField] - paddingInBp; + const end = +d[endField] + paddingInBp; + const group2 = groupField ? d[groupField] : "__NO_GROUP__"; + if (!occupiedSpaceInRows[group2]) { + occupiedSpaceInRows[group2] = []; + } + let rowIndex = occupiedSpaceInRows[group2].findIndex((d2) => { + if (end < d2.start) { + d2.start = start; + return true; + } else if (d2.end < start) { + d2.end = end; + return true; + } + return false; + }); + if (rowIndex === -1) { + occupiedSpaceInRows[group2].push({ start, end }); + rowIndex = occupiedSpaceInRows[group2].length - 1; + } + d[newField] = `${maxRows && maxRows <= rowIndex ? maxRows - 1 : rowIndex}`; + }); + } else if (method === "spread") { + const boundingBoxes = []; + base.sort((a, b) => a[startField] - b[startField]).forEach((d) => { + let start = d[startField] - paddingInBp; + let end = d[endField] + paddingInBp; + let overlapped = boundingBoxes.filter( + (box) => box.start === start && end === box.end || box.start < start && start < box.end || box.start < end && end < box.end || start < box.start && box.end < end + ); + if (overlapped.length > 0) { + let trial = 0; + do { + overlapped = boundingBoxes.filter( + (box) => box.start === start && end === box.end || box.start < start && start < box.end || box.start < end && end < box.end || start < box.start && box.end < end + ); + if (overlapped.length > 0) { + if (trial % 2 === 0) { + start += paddingInBp * trial; + end += paddingInBp * trial; + } else { + start -= paddingInBp * trial; + end -= paddingInBp * trial; + } + } + trial++; + } while (overlapped.length > 0 && trial < 1e3); + } + d[`${newField}Start`] = `${start + paddingInBp}`; + d[`${newField}Etart`] = `${end - paddingInBp}`; + boundingBoxes.push({ start, end }); + }); + } + return base; +} +function splitExon(split, data, assembly = "hg38") { + const { separator, fields, flag } = split; + let output = Array.from(data); + output = output.map((d) => { + const newRows = []; + fields.forEach((f) => { + const { field, type, newField, chrField } = f; + const splitted = d[field].toString().split(separator); + splitted.forEach((s, i) => { + let newValue = s; + if (type === "genomic") { + newValue = computeChromSizes(assembly).interval[d[chrField]][0] + +s; + } + if (!newRows[i]) { + newRows[i] = Object.assign(JSON.parse(JSON.stringify(d)), { + [newField]: newValue, + [flag.field]: flag.value + }); + } else { + newRows[i][newField] = newValue; + } + }); + }); + return [d, ...newRows]; + }).reduce((a, b) => a.concat(b), []); + return output; +} +function parseSubJSON(_, data) { + const { field, genomicField, baseGenomicField, genomicLengthField } = _; + let output = Array.from(data); + output = output.map((d) => { + let newRows = JSON.parse(d[field]); + newRows = newRows.map((row) => { + var _a, _b; + if (row[genomicField] && d[baseGenomicField]) { + row[`${genomicField}_start`] = +row[genomicField] + +d[baseGenomicField]; + row[`${genomicField}_end`] = +row[genomicField] + +d[baseGenomicField] + +row[genomicLengthField]; + } + return Object.assign(JSON.parse(JSON.stringify(d)), { + ...row, + [`${genomicField}_start`]: row[`${genomicField}_start`], + [`${genomicField}_end`]: row[`${genomicField}_end`], + type: (_b = (_a = row.type) != null ? _a : row.variant) != null ? _b : null, + isParsedRow: "yes" + }); + }); + return [d, ...newRows]; + }).reduce((a, b) => a.concat(b), []); + return output; +} +function aggregateData(spec, data) { + if (getChannelKeysByAggregateFnc(spec).length === 0) { + return data; + } + const nChannelKeys = getChannelKeysByType(spec, "nominal"); + if (nChannelKeys.length !== 1) { + console.warn("Currently, we only support aggregating datasets with single nominal field."); + return data; + } + const nFieldSpec = spec[nChannelKeys[0]]; + if (!IsChannelDeep(nFieldSpec)) { + return data; + } + const nField = nFieldSpec.field; + if (!nField) { + return data; + } + const qChannelKeys = [...getChannelKeysByType(spec, "quantitative"), ...getChannelKeysByType(spec, "genomic")]; + const aggregated = []; + const uniqueCategories = Array.from(new Set(data.map((d) => d[nField]))); + let failed = false; + uniqueCategories.forEach((c) => { + const datum = {}; + datum[nField] = c; + qChannelKeys.forEach((q) => { + const qFieldSpec = spec[q]; + if (!IsChannelDeep(qFieldSpec)) { + failed = true; + return; + } + const { field: qField } = qFieldSpec; + if (!qField || !("aggregate" in qFieldSpec)) { + failed = true; + return; + } + datum[qField] = qFieldSpec.aggregate === "max" ? Math.max(...data.filter((d) => d[nField] === c).map((d) => +d[qField])) : Math.min(...data.filter((d) => d[nField] === c).map((d) => +d[qField])); + }); + aggregated.push(datum); + }); + return !failed ? aggregated : data; +} +class CsvDataFetcherClass { + constructor(dataConfig) { + /** + * Fetches CSV file from url, parses it, and sets this.#parsedData + */ + __privateAdd(this, _fetchCsv); + /** + * Function passed into DSV parser to process each row + * @param row An object which contains the row information. The keys are the column names + * @param genomicFieldsToConvert From data config + * @param chromosomeField From data config + * @param genomicFields From data config + * @returns The processed row + */ + __privateAdd(this, _processCsvRow); + /** + * Calculates the cumulative chromosome position based on the chromosome name and position + * @param chromName A string, the name of the chromosome + * @param chromPosition A string, the position within the chromosome + */ + __privateAdd(this, _calcCumulativePos); + /** + * Called by this.tilesetInfo() to call a callback function with tileset info. + */ + __privateAdd(this, _generateTilesetInfo); + /** + * Creates an object to associate a tile position with the corresponding data + * @param z An integer, the z coordinate of the tile + * @param x An integer, the x coordinate of the tile + * @param y An integer, the y coordinate of the tile + * @returns A promise of an object with tile coordinates and data + */ + __privateAdd(this, _tile); + /** + * This function calculates chromosome position and size based on the assembly (this.#assembly) + * @returns An object containing chromosome information and a way to calculate absolute position + */ + __privateAdd(this, _generateChomSizeInfo); + __publicField(this, "dataConfig"); + // @ts-ignore + __publicField(this, "tilesetInfoLoading"); + // Used in TiledPixiTrack + __privateAdd(this, _dataPromise, void 0); + __privateAdd(this, _chromSizes, void 0); + __privateAdd(this, _parsedData, void 0); + // Either set in the constructor or in #fetchCsv() + __privateAdd(this, _assembly, void 0); + __privateAdd(this, _filter, void 0); + __privateAdd(this, _file, void 0); + this.dataConfig = dataConfig; + this.tilesetInfoLoading = false; + __privateSet(this, _assembly, this.dataConfig.assembly); + __privateSet(this, _filter, this.dataConfig.filter); + if (!dataConfig.url) { + console.error("Please provide the `url` of the data"); + } + const { urlFetchOptions, url } = dataConfig; + __privateSet(this, _file, new RemoteFile(url, { overrides: urlFetchOptions })); + __privateSet(this, _chromSizes, __privateMethod(this, _generateChomSizeInfo, generateChomSizeInfo_fn).call(this)); + __privateSet(this, _dataPromise, __privateMethod(this, _fetchCsv, fetchCsv_fn).call(this)); + } + /** + * Called in TiledPixiTrack + */ + tilesetInfo(callback) { + if (!__privateGet(this, _dataPromise)) { + return; + } + this.tilesetInfoLoading = true; + return __privateGet(this, _dataPromise).then(() => __privateMethod(this, _generateTilesetInfo, generateTilesetInfo_fn).call(this, callback)).catch((err2) => { + this.tilesetInfoLoading = false; + console.error("[Gosling Data Fetcher] Error parsing data:", err2); + }); + } + /** + * Called in TiledPixiTrack. + * @param receivedTiles A function from TiledPixiTrack which takes in all the loaded tiles + * @param tileIds An array of tile IDs. Ex. ['1.0', '1.1'] + */ + fetchTilesDebounced(receivedTiles, tileIds) { + const tiles = {}; + const validTileIds = []; + const tilePromises = []; + for (const tileId of tileIds) { + const parts = tileId.split("."); + const z = parseInt(parts[0], 10); + const x = parseInt(parts[1], 10); + const y = parseInt(parts[2], 10); + if (Number.isNaN(x) || Number.isNaN(z)) { + console.warn("[Gosling Data Fetcher] Invalid tile zoom or position:", z, x, y); + continue; + } + validTileIds.push(tileId); + tilePromises.push(__privateMethod(this, _tile, tile_fn).call(this, z, x, y)); + } + Promise.all(tilePromises).then((tileInfo) => { + tileInfo.forEach((tileInfo2, i) => { + if (tileInfo2) { + const validTileId = validTileIds[i]; + tiles[validTileId] = tileInfo2; + tiles[validTileId].tilePositionId = validTileId; + } + }); + receivedTiles(tiles); + }); + } +} +_dataPromise = new WeakMap(); +_chromSizes = new WeakMap(); +_parsedData = new WeakMap(); +_assembly = new WeakMap(); +_filter = new WeakMap(); +_file = new WeakMap(); +_fetchCsv = new WeakSet(); +fetchCsv_fn = async function() { + var _a, _b; + const { chromosomeField, genomicFields, headerNames, longToWideId, genomicFieldsToConvert } = this.dataConfig; + const separator = (_a = this.dataConfig.separator) != null ? _a : ","; + try { + const buffer = await __privateGet(this, _file).readFile(); + const text = buffer.toString(); + const textWithHeader = headerNames ? `${headerNames.join(separator)} +${text}` : text; + const parsedCSV = dsvFormat(separator).parse( + textWithHeader, + (row) => __privateMethod(this, _processCsvRow, processCsvRow_fn).call(this, row, genomicFieldsToConvert, chromosomeField, genomicFields) + ); + if (longToWideId && ((_b = parsedCSV[0]) == null ? void 0 : _b[longToWideId])) { + const columnNames = Object.keys(parsedCSV[0]); + const newJson = {}; + parsedCSV.forEach((row) => { + if (!newJson[row[longToWideId]]) { + newJson[row[longToWideId]] = JSON.parse(JSON.stringify(row)); + } else { + columnNames.forEach((colName) => { + newJson[row[longToWideId]][`${colName}_2`] = row[colName]; + }); + } + }); + __privateSet(this, _parsedData, Object.keys(newJson).map((k_3) => newJson[k_3])); + } else { + __privateSet(this, _parsedData, parsedCSV); + } + } catch (error) { + console.error("[Gosling Data Fetcher] Error fetching data", error); + } +}; +_processCsvRow = new WeakSet(); +processCsvRow_fn = function(row, genomicFieldsToConvert, chromosomeField, genomicFields) { + try { + if (genomicFieldsToConvert) { + genomicFieldsToConvert.forEach((chromMap) => { + const genomicFields_1 = chromMap.genomicFields; + const chromName = row[chromMap.chromosomeField]; + genomicFields_1.forEach((positionCol) => { + const chromPosition = row[positionCol]; + row[positionCol] = String(__privateMethod(this, _calcCumulativePos, calcCumulativePos_fn).call(this, chromName, chromPosition)); + }); + }); + } else if (chromosomeField && genomicFields) { + genomicFields.forEach((positionCol_1) => { + const chromPosition_1 = row[positionCol_1]; + const chromName_1 = row[chromosomeField]; + row[positionCol_1] = String(__privateMethod(this, _calcCumulativePos, calcCumulativePos_fn).call(this, chromName_1, chromPosition_1)); + }); + } + return row; + } catch (e) { + return void 0; + } +}; +_calcCumulativePos = new WeakSet(); +calcCumulativePos_fn = function(chromName, chromPosition) { + if (__privateGet(this, _assembly) !== "unknown") { + const chrName = sanitizeChrName(chromName, __privateGet(this, _assembly), this.dataConfig.chromosomePrefix); + return computeChromSizes(__privateGet(this, _assembly)).interval[chrName][0] + +chromPosition; + } else { + return chromPosition; + } +}; +_generateTilesetInfo = new WeakSet(); +generateTilesetInfo_fn = function(callback) { + this.tilesetInfoLoading = false; + const TILE_SIZE = 1024; + const totalLength = __privateGet(this, _chromSizes).totalLength; + const retVal = { + tile_size: TILE_SIZE, + max_zoom: Math.ceil(Math.log(totalLength / TILE_SIZE) / Math.log(2)), + max_width: totalLength, + min_pos: [0, 0], + max_pos: [totalLength, totalLength] + }; + if (callback) { + callback(retVal); + } + return retVal; +}; +_tile = new WeakSet(); +tile_fn = async function(z, x, y) { + var _a, _b; + const tilesetInfo = await this.tilesetInfo(); + if (!tilesetInfo) + return; + const tileWidth = +tilesetInfo.max_width / 2 ** +z; + const minX = tilesetInfo.min_pos[0] + x * tileWidth; + const maxX = tilesetInfo.min_pos[0] + (x + 1) * tileWidth; + let tabularData = filterUsingGenoPos(__privateGet(this, _parsedData), [minX, maxX], this.dataConfig); + (_a = __privateGet(this, _filter)) == null ? void 0 : _a.forEach((f) => { + tabularData = filterData(f, tabularData); + }); + const sizeLimit = (_b = this.dataConfig.sampleLength) != null ? _b : 1e3; + return { + // sample the data to make it managable for visualization components + tabularData: tabularData.length > sizeLimit ? sampleSize(tabularData, sizeLimit) : tabularData, + server: null, + tilePos: [x, y], + zoomLevel: z + }; +}; +_generateChomSizeInfo = new WeakSet(); +generateChomSizeInfo_fn = function() { + const chromosomeSizes = computeChromSizes(__privateGet(this, _assembly)).size; + const chromosomeCumPositions = []; + const chromosomePositions = {}; + let prevEndPosition = 0; + Object.keys(chromosomeSizes).forEach((chrStr, i) => { + const positionInfo = { + id: i, + chr: chrStr, + pos: prevEndPosition + }; + chromosomeCumPositions.push(positionInfo); + chromosomePositions[chrStr] = positionInfo; + prevEndPosition += chromosomeSizes[chrStr]; + }); + return { + chrToAbs: (chrom, chromPos) => __privateGet(this, _chromSizes).chrPositions[chrom].pos + chromPos, + cumPositions: chromosomeCumPositions, + chrPositions: chromosomePositions, + totalLength: prevEndPosition, + chromLengths: chromosomeSizes + }; +}; +function CsvDataFetcher(_HGC, dataConfig, _pubsub) { + if (!new.target) { + throw new Error('Uncaught TypeError: Class constructor cannot be invoked without "new"'); + } + return new CsvDataFetcherClass(dataConfig); +} +CsvDataFetcher.config = { + type: "csv" +}; +function JsonDataFetcher(HGC, ...args) { + if (!new.target) { + throw new Error('Uncaught TypeError: Class constructor cannot be invoked without "new"'); + } + class JsonDataFetcherClass { + constructor(params) { + __publicField(this, "dataConfig"); + // @ts-ignore + __publicField(this, "tilesetInfoLoading"); + __publicField(this, "chromSizes"); + __publicField(this, "values"); + __publicField(this, "assembly"); + const [dataConfig] = params; + this.dataConfig = dataConfig; + this.tilesetInfoLoading = false; + this.assembly = this.dataConfig.assembly; + if (!dataConfig.values) { + console.error("Please provide `values` of the JSON data"); + return; + } + const chromosomeSizes = computeChromSizes(this.assembly).size; + const chromosomeCumPositions = []; + const chromosomePositions = {}; + let prevEndPosition = 0; + Object.keys(computeChromSizes(this.assembly).size).forEach((chrStr, i) => { + const positionInfo = { + id: i, + chr: chrStr, + pos: prevEndPosition + }; + chromosomeCumPositions.push(positionInfo); + chromosomePositions[chrStr] = positionInfo; + prevEndPosition += computeChromSizes(this.assembly).size[chrStr]; + }); + this.chromSizes = { + chrToAbs: (chrom, chromPos) => this.chromSizes.chrPositions[chrom].pos + chromPos, + cumPositions: chromosomeCumPositions, + chrPositions: chromosomePositions, + totalLength: prevEndPosition, + chromLengths: chromosomeSizes + }; + const { chromosomeField, genomicFields, genomicFieldsToConvert } = this.dataConfig; + this.values = dataConfig.values.map((row) => { + try { + if (genomicFieldsToConvert) { + genomicFieldsToConvert.forEach((chromMap) => { + const genomicFields2 = chromMap.genomicFields; + const chromName = sanitizeChrName(row[chromMap.chromosomeField], this.assembly); + genomicFields2.forEach((positionCol) => { + const chromPosition = row[positionCol]; + row[positionCol] = String(this.chromSizes.chrToAbs(chromName, chromPosition)); + }); + }); + } else if (chromosomeField && genomicFields) { + genomicFields.forEach((positionCol) => { + const chromPosition = row[positionCol]; + const chromName = sanitizeChrName(row[chromosomeField], this.assembly); + row[positionCol] = String(this.chromSizes.chrToAbs(chromName, chromPosition)); + }); + } + return row; + } catch (e) { + return void 0; + } + }); + } + tilesetInfo(callback) { + this.tilesetInfoLoading = false; + const TILE_SIZE = 1024; + const totalLength = this.chromSizes.totalLength; + const retVal = { + tile_size: TILE_SIZE, + max_zoom: Math.ceil(Math.log(totalLength / TILE_SIZE) / Math.log(2)), + max_width: totalLength, + min_pos: [0, 0], + max_pos: [totalLength, totalLength] + }; + if (callback) { + callback(retVal); + } + return retVal; + } + fetchTilesDebounced(receivedTiles, tileIds) { + const tiles = {}; + const validTileIds = []; + const tilePromises = []; + for (const tileId of tileIds) { + const parts = tileId.split("."); + const z = parseInt(parts[0], 10); + const x = parseInt(parts[1], 10); + const y = parseInt(parts[2], 10); + if (Number.isNaN(x) || Number.isNaN(z)) { + console.warn("[Gosling Data Fetcher] Invalid tile zoom or position:", z, x, y); + continue; + } + validTileIds.push(tileId); + tilePromises.push(this.tile(z, x, y)); + } + Promise.all(tilePromises).then((values) => { + values.forEach((value, i) => { + const validTileId = validTileIds[i]; + tiles[validTileId] = value; + tiles[validTileId].tilePositionId = validTileId; + }); + receivedTiles(tiles); + }); + return tiles; + } + tile(z, x, y) { + var _a; + const tsInfo = this.tilesetInfo(); + const tileWidth = +tsInfo.max_width / 2 ** +z; + const minX = tsInfo.min_pos[0] + x * tileWidth; + const maxX = tsInfo.min_pos[0] + (x + 1) * tileWidth; + let tabularData = filterUsingGenoPos(this.values, [minX, maxX], this.dataConfig); + const sizeLimit = (_a = this.dataConfig.sampleLength) != null ? _a : 1e3; + if (sizeLimit < tabularData.length) { + tabularData = this.dataConfig.sampleType === "first" ? tabularData.slice(0, sizeLimit) : sampleSize(tabularData, sizeLimit); + } + return { + tabularData, + server: null, + tilePos: [x, y], + zoomLevel: z + }; + } + } + return new JsonDataFetcherClass(args); +} +JsonDataFetcher.config = { + type: "json" +}; +const encodedJs$1 = "KCgpID0+IHsKICB2YXIgX19jcmVhdGUgPSBPYmplY3QuY3JlYXRlOwogIHZhciBfX2RlZlByb3AgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiAgdmFyIF9fZ2V0T3duUHJvcERlc2MgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOwogIHZhciBfX2dldE93blByb3BOYW1lcyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzOwogIHZhciBfX2dldFByb3RvT2YgPSBPYmplY3QuZ2V0UHJvdG90eXBlT2Y7CiAgdmFyIF9faGFzT3duUHJvcCA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHk7CiAgdmFyIF9fbWFya0FzTW9kdWxlID0gKHRhcmdldCkgPT4gX19kZWZQcm9wKHRhcmdldCwgIl9fZXNNb2R1bGUiLCB7IHZhbHVlOiB0cnVlIH0pOwogIHZhciBfX2VzbSA9IChmbiwgcmVzKSA9PiBmdW5jdGlvbiBfX2luaXQoKSB7CiAgICByZXR1cm4gZm4gJiYgKHJlcyA9ICgwLCBmbltPYmplY3Qua2V5cyhmbilbMF1dKShmbiA9IDApKSwgcmVzOwogIH07CiAgdmFyIF9fY29tbW9uSlMgPSAoY2IsIG1vZCkgPT4gZnVuY3Rpb24gX19yZXF1aXJlKCkgewogICAgcmV0dXJuIG1vZCB8fCAoMCwgY2JbT2JqZWN0LmtleXMoY2IpWzBdXSkoKG1vZCA9IHsgZXhwb3J0czoge30gfSkuZXhwb3J0cywgbW9kKSwgbW9kLmV4cG9ydHM7CiAgfTsKICB2YXIgX19leHBvcnQgPSAodGFyZ2V0LCBhbGwpID0+IHsKICAgIF9fbWFya0FzTW9kdWxlKHRhcmdldCk7CiAgICBmb3Ig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29kZUF0KGkyKV0gPDwgMTAgfCByZXZMb29rdXBbYjY0LmNoYXJDb2RlQXQoaTIgKyAxKV0gPDwgNCB8IHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpMiArIDIpXSA+PiAyOwogICAgICAgICAgYXJyW2N1ckJ5dGUrK10gPSB0bXAgPj4gOCAmIDI1NTsKICAgICAgICAgIGFycltjdXJCeXRlKytdID0gdG1wICYgMjU1OwogICAgICAgIH0KICAgICAgICByZXR1cm4gYXJyOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHRyaXBsZXRUb0Jhc2U2NChudW0pIHsKICAgICAgICByZXR1cm4gbG9va3VwW251bSA+PiAxOCAmIDYzXSArIGxvb2t1cFtudW0gPj4gMTIgJiA2M10gKyBsb29rdXBbbnVtID4+IDYgJiA2M10gKyBsb29rdXBbbnVtICYgNjNdOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGVuY29kZUNodW5rKHVpbnQ4LCBzdGFydCwgZW5kKSB7CiAgICAgICAgdmFyIHRtcDsKICAgICAgICB2YXIgb3V0cHV0ID0gW107CiAgICAgICAgZm9yICh2YXIgaTIgPSBzdGFydDsgaTIgPCBlbmQ7IGkyICs9IDMpIHsKICAgICAgICAgIHRtcCA9ICh1aW50OFtpMl0gPDwgMTYgJiAxNjcxMTY4MCkgKyAodWludDhbaTIgKyAxXSA8PCA4ICYgNjUyODApICsgKHVpbnQ4W2kyICsgMl0gJiAyNTUpOwogICAgICAgICAgb3V0cHV0LnB1c2godHJpcGxldFRvQmFzZTY0KHRtcCkpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gb3V0cHV0LmpvaW4oIiIpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZyb21CeXRlQXJyYXkodWludDgpIHsKICAgICAgICB2YXIgdG1wOwogICAgICAgIHZhciBsZW4yID0gdWludDgubGVuZ3RoOwogICAgICAgIHZhciBleHRyYUJ5dGVzID0gbGVuMiAlIDM7CiAgICAgICAgdmFyIHBhcnRzID0gW107CiAgICAgICAgdmFyIG1heENodW5rTGVuZ3RoID0gMTYzODM7CiAgICAgICAgZm9yICh2YXIgaTIgPSAwLCBsZW4yMiA9IGxlbjIgLSBleHRyYUJ5dGVzOyBpMiA8IGxlbjIyOyBpMiArPSBtYXhDaHVua0xlbmd0aCkgewogICAgICAgICAgcGFydHMucHVzaChlbmNvZGVDaHVuayh1aW50OCwgaTIsIGkyICsgbWF4Q2h1bmtMZW5ndGggPiBsZW4yMiA/IGxlbjIyIDogaTIgKyBtYXhDaHVua0xlbmd0aCkpOwogICAgICAgIH0KICAgICAgICBpZiAoZXh0cmFCeXRlcyA9PT0gMSkgewogICAgICAgICAgdG1wID0gdWludDhbbGVuMiAtIDFdOwogICAgICAgICAgcGFydHMucHVzaChsb29rdXBbdG1wID4+IDJdICsgbG9va3VwW3RtcCA8PCA0ICYgNjNdICsgIj09Iik7CiAgICAgICAgfSBlbHNlIGlmIChleHRyYUJ5dGVzID09PSAyKSB7CiAgICAgICAgICB0bXAgPSAodWludDhbbGVuMiAtIDJdIDw8IDgpICsgdWludDhbbGVuMiAtIDFdOwogICAgICAgICAgcGFydHMucHVzaChsb29rdXBbdG1wID4+IDEwXSArIGxvb2t1cFt0bXAgPj4gNCAmIDYzXSArIGxvb2t1cFt0bXAgPDwgMiAmIDYzXSArICI9Iik7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwYXJ0cy5qb2luKCIiKTsKICAgICAgfQogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vaWVlZTc1NEAxLjIuMS9ub2RlX21vZHVsZXMvaWVlZTc1NC9pbmRleC5qcwogIHZhciByZXF1aXJlX2llZWU3NTQgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vaWVlZTc1NEAxLjIuMS9ub2RlX21vZHVsZXMvaWVlZTc1NC9pbmRleC5qcyIoZXhwb3J0czIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICBleHBvcnRzMi5yZWFkID0gZnVuY3Rpb24oYnVmZmVyLCBvZmZzZXQsIGlzTEUsIG1MZW4sIG5CeXRlcykgewogICAgICAgIHZhciBlLCBtOwogICAgICAgIHZhciBlTGVuID0gbkJ5dGVzICogOCAtIG1MZW4gLSAxOwogICAgICAgIHZhciBlTWF4ID0gKDEgPDwgZUxlbikgLSAxOwogICAgICAgIHZhciBlQmlhcyA9IGVNYXggPj4gMTsKICAgICAgICB2YXIgbkJpdHMgPSAtNzsKICAgICAgICB2YXIgaSA9IGlzTEUgPyBuQnl0ZXMgLSAxIDogMDsKICAgICAgICB2YXIgZCA9IGlzTEUgPyAtMSA6IDE7CiAgICAgICAgdmFyIHMgPSBidWZmZXJbb2Zmc2V0ICsgaV07CiAgICAgICAgaSArPSBkOwogICAgICAgIGUgPSBzICYgKDEgPDwgLW5CaXRzKSAtIDE7CiAgICAgICAgcyA+Pj0gLW5CaXRzOwogICAgICAgIG5CaXRzICs9IGVMZW47CiAgICAgICAgZm9yICg7IG5CaXRzID4gMDsgZSA9IGUgKiAyNTYgKyBidWZmZXJbb2Zmc2V0ICsgaV0sIGkgKz0gZCwgbkJpdHMgLT0gOCkgewogICAgICAgIH0KICAgICAgICBtID0gZSAmICgxIDw8IC1uQml0cykgLSAxOwogICAgICAgIGUgPj49IC1uQml0czsKICAgICAgICBuQml0cyArPSBtTGVuOwogICAgICAgIGZvciAoOyBuQml0cyA+IDA7IG0gPSBtICogMjU2ICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9IGQsIG5CaXRzIC09IDgpIHsKICAgICAgICB9CiAgICAgICAgaWYgKGUgPT09IDApIHsKICAgICAgICAgIGUgPSAxIC0gZUJpYXM7CiAgICAgICAgfSBlbHNlIGlmIChlID09PSBlTWF4KSB7CiAgICAgICAgICByZXR1cm4gbSA/IE5hTiA6IChzID8gLTEgOiAxKSAqIEluZmluaXR5OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBtID0gbSArIE1hdGgucG93KDIsIG1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AgICBpZiAoZSArIGVCaWFzID49IDEpIHsKICAgICAgICAgICAgdmFsdWUgKz0gcnQgLyBjOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdmFsdWUgKz0gcnQgKiBNYXRoLnBvdygyLCAxIC0gZUJpYXMpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHZhbHVlICogYyA+PSAyKSB7CiAgICAgICAgICAgIGUrKzsKICAgICAgICAgICAgYyAvPSAyOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGUgKyBlQmlhcyA+PSBlTWF4KSB7CiAgICAgICAgICAgIG0gPSAwOwogICAgICAgICAgICBlID0gZU1heDsKICAgICAgICAgIH0gZWxzZSBpZiAoZSArIGVCaWFzID49IDEpIHsKICAgICAgICAgICAgbSA9ICh2YWx1ZSAqIGMgLSAxKSAqIE1hdGgucG93KDIsIG1MZW4pOwogICAgICAgICAgICBlID0gZSArIGVCaWFzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbSA9IHZhbHVlICogTWF0aC5wb3coMiwgZUJpYXMgLSAxKSAqIE1hdGgucG93KDIsIG1MZW4pOwogICAgICAgICAgICBlID0gMDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZm9yICg7IG1MZW4gPj0gODsgYnVmZmVyW29mZnNldCArIGldID0gbSAmIDI1NSwgaSArPSBkLCBtIC89IDI1NiwgbUxlbiAtPSA4KSB7CiAgICAgICAgfQogICAgICAgIGUgPSBlIDw8IG1MZW4gfCBtOwogICAgICAgIGVMZW4gKz0gbUxlbjsKICAgICAgICBmb3IgKDsgZUxlbiA+IDA7IGJ1ZmZlcltvZmZzZXQgKyBpXSA9IGUgJiAyNTUsIGkgKz0gZCwgZSAvPSAyNTYsIGVMZW4gLT0gOCkgewogICAgICAgIH0KICAgICAgICBidWZmZXJbb2Zmc2V0ICsgaSAtIGRdIHw9IHMgKiAxMjg7CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlc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mVycm9yKCJUaGlzIGJyb3dzZXIgbGFja3MgdHlwZWQgYXJyYXkgKFVpbnQ4QXJyYXkpIHN1cHBvcnQgd2hpY2ggaXMgcmVxdWlyZWQgYnkgYGJ1ZmZlcmAgdjUueC4gVXNlIGBidWZmZXJgIHY0LnggaWYgeW91IHJlcXVpcmUgb2xkIGJyb3dzZXIgc3VwcG9ydC4iKTsKICAgICAgfQogICAgICBmdW5jdGlvbiB0eXBlZEFycmF5U3VwcG9ydCgpIHsKICAgICAgICB0cnkgewogICAgICAgICAgY29uc3QgYXJyID0gbmV3IFVpbnQ4QXJyYXkoMSk7CiAgICAgICAgICBjb25zdCBwcm90byA9IHsgZm9vOiBmdW5jdGlvbigpIHsKICAgICAgICAgICAgcmV0dXJuIDQyOwogICAgICAgICAgfSB9OwogICAgICAgICAgT2JqZWN0LnNldFByb3RvdHlwZU9mKHByb3RvLCBVaW50OEFycmF5LnByb3RvdHlwZSk7CiAgICAgICAgICBPYmplY3Quc2V0UHJvdG90eXBlT2YoYXJyLCBwcm90byk7CiAgICAgICAgICByZXR1cm4gYXJyLmZvbygpID09PSA0MjsKICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICB9CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShCdWZmZXIxMC5wcm90b3R5cGUsICJwYXJlbnQiLCB7CiAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkgewogICAgICAgICAgaWYgKCFCdWZmZXIxMC5pc0J1ZmZlcih0aGlzKSkKICAgICAgICAgICAgcmV0dXJuIHZvaWQgMDsKICAgICAgICAgIHJldHVybiB0aGlzLmJ1ZmZlcjsKICAgICAgICB9CiAgICAgIH0pOwogICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoQnVmZmVyMTAucHJvdG90eXBlLCAib2Zmc2V0IiwgewogICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHsKICAgICAgICAgIGlmICghQnVmZmVyMTAuaXNCdWZmZXIodGhpcykpCiAgICAgICAgICAgIHJldHVybiB2b2lkIDA7CiAgICAgICAgICByZXR1cm4gdGhpcy5ieXRlT2Zmc2V0OwogICAgICAgIH0KICAgICAgfSk7CiAgICAgIGZ1bmN0aW9uIGNyZWF0ZUJ1ZmZlcihsZW5ndGgpIHsKICAgICAgICBpZiAobGVuZ3RoID4gS19NQVhfTEVOR1RIKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcignVGhlIHZhbHVlICInICsgbGVuZ3RoICsgJyIgaXMgaW52YWxpZCBmb3Igb3B0aW9uICJzaXplIicpOwogICAgICAgIH0KICAgICAgICBjb25zdCBidWYgPSBuZXcgVWludDhBcnJheShsZW5ndGgpOwogICAgICAgIE9iamVjdC5zZXRQcm90b3R5cGVPZihidWYsIEJ1ZmZlcjEwLnByb3RvdHlwZSk7CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfQogICAgICBmdW5jdGlvbiBCdWZmZXIxMChhcmcsIGVuY29kaW5nT3JPZmZzZXQsIGxlbmd0aCkgewogICAgICAgIGlmICh0eXBlb2YgYXJnID09PSAibnVtYmVyIikgewogICAgICAgICAgaWYgKHR5cGVvZiBlbmNvZGluZ09yT2Zmc2V0ID09PSAic3RyaW5nIikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdUaGUgInN0cmluZyIgYXJndW1lbnQgbXVzdCBiZSBvZiB0eXBlIHN0cmluZy4gUmVjZWl2ZWQgdHlwZSBudW1iZXInKTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBhbGxvY1Vuc2FmZShhcmcpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gZnJvbShhcmcsIGVuY29kaW5nT3JPZmZzZXQsIGxlbmd0aCk7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucG9vbFNpemUg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gY3JlYXRlQnVmZmVyKGxlbmd0aCk7CiAgICAgICAgY29uc3QgYWN0dWFsID0gYnVmLndyaXRlKHN0cmluZywgZW5jb2RpbmcpOwogICAgICAgIGlmIChhY3R1YWwgIT09IGxlbmd0aCkgewogICAgICAgICAgYnVmID0gYnVmLnNsaWNlKDAsIGFjdHVhbCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBidWY7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZnJvbUFycmF5TGlrZShhcnJheSkgewogICAgICAgIGNvbnN0IGxlbmd0aCA9IGFycmF5Lmxlbmd0aCA8IDAgPyAwIDogY2hlY2tlZChhcnJheS5sZW5ndGgpIHwgMDsKICAgICAgICBjb25zdCBidWYgPSBjcmVhdGVCdWZmZXIobGVuZ3RoKTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgaSArPSAxKSB7CiAgICAgICAgICBidWZbaV0gPSBhcnJheVtpXSAmIDI1NTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfQogICAgICBmdW5jdGlvbiBmcm9tQXJyYXlWaWV3KGFycmF5VmlldykgewogICAgICAgIGlmIChpc0luc3RhbmNlKGFycmF5VmlldywgVWludDhBcnJheSkpIHsKICAgICAgICAgIGNvbnN0IGNvcHkgPSBuZXcgVWludDhBcnJheShhcnJheVZpZXcpOwogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUJ1ZmZlcihjb3B5LmJ1ZmZlciwgY29weS5ieXRlT2Zmc2V0LCBjb3B5LmJ5dGVMZW5ndGgpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gZnJvbUFycmF5TGlrZShhcnJheVZpZXcpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZyb21BcnJheUJ1ZmZlcihhcnJheSwgYnl0ZU9mZnNldCwgbGVuZ3RoKSB7CiAgICAgICAgaWYgKGJ5dGVPZmZzZXQgPCAwIHx8IGFycmF5LmJ5dGVMZW5ndGggPCBieX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ICAgICAgb2JqLmNvcHkoYnVmLCAwLCAwLCBsZW4pOwogICAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai5sZW5ndGggIT09IHZvaWQgMCkgewogICAgICAgICAgaWYgKHR5cGVvZiBvYmoubGVuZ3RoICE9PSAibnVtYmVyIiB8fCBudW1iZXJJc05hTihvYmoubGVuZ3RoKSkgewogICAgICAgICAgICByZXR1cm4gY3JlYXRlQnVmZmVyKDApOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUxpa2Uob2JqKTsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai50eXBlID09PSAiQnVmZmVyIiAmJiBBcnJheS5pc0FycmF5KG9iai5kYXRhKSkgewogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUxpa2Uob2JqLmRhdGEpOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBjaGVja2VkKGxlbmd0aCkgewogICAgICAgIGlmIChsZW5ndGggPj0gS19NQVhfTEVOR1RIKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigiQXR0ZW1wdCB0byBhbGxvY2F0ZSBCdWZmZXIgbGFyZ2VyIHRoYW4gbWF4aW11bSBzaXplOiAweCIgKyBLX01BWF9MRU5HVEgudG9TdHJpbmcoMTYpICsgIiBieXRlcyIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gbGVuZ3RoIHwgMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBTbG93QnVmZmVyKGxlbmd0aCkgewogICAgICAgIGlmICgrbGVuZ3RoICE9IGxlbmd0aCkgewogICAgICAgICAgbGVuZ3RoID0gMDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJ1ZmZlcjEwLmFsbG9jKCtsZW5ndGgpOwogICAgICB9CiAgICAgIEJ1ZmZlcjEwLmlzQnVmZmVyID0gZnVuY3Rpb24gaXNCdWZmZXIyKGIpIHsKICAgICAgICByZXR1cm4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ICAgcmV0dXJuIDA7CiAgICAgIH07CiAgICAgIEJ1ZmZlcjEwLmlzRW5jb2RpbmcgPSBmdW5jdGlvbiBpc0VuY29kaW5nKGVuY29kaW5nKSB7CiAgICAgICAgc3dpdGNoIChTdHJpbmcoZW5jb2RpbmcpLnRvTG93ZXJDYXNlKCkpIHsKICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgIGNhc2UgInV0Zi04IjoKICAgICAgICAgIGNhc2UgImFzY2lpIjoKICAgICAgICAgIGNhc2UgImxhdGluMSI6CiAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgY2FzZSAidWNzLTIiOgogICAgICAgICAgY2FzZSAidXRmMTZsZSI6CiAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgfTsKICAgICAgQnVmZmVyMTAuY29uY2F0ID0gZnVuY3Rpb24gY29uY2F0KGxpc3QsIGxlbmd0aCkgewogICAgICAgIGlmICghQXJyYXkuaXNBcnJheShsaXN0KSkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignImxpc3QiIGFyZ3VtZW50IG11c3QgYmUgYW4gQXJyYXkgb2YgQnVmZmVycycpOwogICAgICAgIH0KICAgICAgICBpZiAobGlzdC5sZW5ndGggPT09IDApIHsKICAgICAgICAgIHJldHVybiBCdWZmZXIxMC5hbGxvYygwKTsKICAgICAgICB9CiAgICAgICAgbGV0IGk7CiAgICAgICAgaWYgKGxlbmd0aCA9PT0gdm9pZCAwKSB7CiAgICAgICAgICBsZW5ndGggPSAwOwogICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyArK2kpIHsKICAgICAgICAgICAgbGVuZ3RoICs9IGxpc3RbaV0ubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb25zdCBidWZmZXIgPSBCdWZmZXIxMC5hbGxvY1Vuc2FmZShsZW5ndGgpOwogICAgICAgIGxldCBwb3MgPSAwOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgKytpKSB7CiAgICAgICAgICBsZXQgYnVmID0gbGlzdFtpXTsKICAgICAgICAgIGlmIChpc0luc3RhbmNlKGJ1ZiwgVWludDhBcnJheSkpIHsKICAgICAgICAgICAgaWYgKHBvcyArIGJ1Zi5sZW5ndGggPiBidWZmZXIubGVuZ3RoKSB7CiAgICAgICAgICAgICAgaWYgKCFCdWZmZXIxMC5pc0J1ZmZlcihidWYpKQogICAgICAgICAgICAgICAgYnVmID0gQnVmZmVyMTAuZnJvbShidWYpOwogICAgICAgICAgICAgIGJ1Zi5jb3B5KGJ1ZmZlciwgcG9zKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBVaW50OEFycmF5LnByb3RvdHlwZS5zZXQuY2FsbChidWZmZXIsIGJ1ZiwgcG9zKTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIGlmICghQnVmZmVyMTAuaXNCdWZmZXIoYnVmKSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCcibGlzdCIgYXJndW1lbnQgbXVzdCBiZSBhbiBBcnJheSBvZiBCdWZmZXJzJyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBidWYuY29weShidWZmZXIsIHBvcyk7CiAgICAgICAgICB9CiAgICAgICAgICBwb3MgKz0gYnVmLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZmZlcjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gYnl0ZUxlbmd0aChzdHJpbmcsIGVuY29kaW5nKSB7CiAgICAgICAgaWYgKEJ1ZmZlcjEwLmlzQnVmZmVyKHN0cmluZykpIHsKICAgICAgICAgIHJldHVybiBzdHJpbmcubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoQXJyYXlCdWZmZXIuaXNWaWV3KHN0cmluZykgfHwgaXNJbnN0YW5jZShzdHJpbmcsIEFycmF5QnVmZmVyKSkgewogICAgICAgICAgcmV0dXJuIHN0cmluZy5ieXRlTGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAodHlwZW9mIHN0cmluZyAhPT0gInN0cmluZyIpIHsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1RoZSAic3RyaW5nIiBhcmd1bWVudCBtdXN0IGJlIG9uZSBvZiB0eXBlIHN0cmluZywgQnVmZmVyLCBvciBBcnJheUJ1ZmZlci4gUmVjZWl2ZWQgdHlwZSAnICsgdHlwZW9mIHN0cmluZyk7CiAgICAgICAgfQogICAgICAgIGNvbnN0IGxlbiA9IHN0cmluZy5sZW5ndGg7CiAgICAgICAgY29uc3QgbXVzdE1hdGNoID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgYXJndW1lbnRzWzJdID09PSB0cnVlOwogICAgICAgIGlmICghbXVzdE1hdGNoICYmIGxlbiA9PT0gMCkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIGxldCBsb3dlcmVkQ2FzZSA9IGZhbHNlOwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgc3dpdGNoIChlbmNvZGluZykgewogICAgICAgICAgICBjYXNlICJhc2NpaSI6CiAgICAgICAgICAgIGNhc2UgImxhdGluMSI6CiAgICAgICAgICAgIGNhc2UgImJpbmFyeSI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbjsKICAgICAgICAgICAgY2FzZSAidXRmOCI6CiAgICAgICAgICAgIGNhc2UgInV0Zi04IjoKICAgICAgICAgICAgICByZXR1cm4gdXRmOFRvQnl0ZXMoc3RyaW5nKS5sZW5ndGg7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbiAqIDI7CiAgICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbiA+Pj4gMTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0VG9CeXRlcyhzdHJpbmcpLmxlbmd0aDsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpIHsKICAgICAgICAgICAgICAgIHJldHVybiBtdXN0TWF0Y2ggPyAtMSA6IHV0ZjhUb0J5dGVzKHN0cmluZykubGVuZ3RoOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBlbmNvZGluZyA9ICgiIiArIGVuY29kaW5nKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgIGxvd2VyZWRDYXNlID0gdHJ1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgQnVmZmVyMTAuYnl0ZUxlbmd0aCA9IGJ5dGVMZW5ndGg7CiAgICAgIGZ1bmN0aW9uIHNsb3dUb1N0cmluZyhlbmNvZGluZywgc3RhcnQsIGVuZCkgewogICAgICAgIGxldCBsb3dlcmVkQ2FzZSA9IGZhbHNlOwogICAgICAgIGlmIChzdGFydCA9PT0gdm9pZCAwIHx8IHN0YXJ0IDwgMCkgewogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPiB0aGlzLmxlbmd0aCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kID09PSB2b2lkIDAgfHwgZW5kID4gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kIDw9IDApIHsKICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICB9CiAgICAgICAgZW5kID4+Pj0gMDsKICAgICAgICBzdGFydCA+Pj49IDA7CiAgICAgICAgaWYgKGVuZCA8PSBzdGFydCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoIWVuY29kaW5nKQogICAgICAgICAgZW5jb2RpbmcgPSAidXRmOCI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gaGV4U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICAgIHJldHVybiBhc2NpaVNsaWNlKHRoaXMsIHN0YXJ0LCBlbmQpOwogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBsYXRpbjFTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjE2bGVTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgICAgIGVuY29kaW5nID0gKGVuY29kaW5nICsgIiIpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgbG93ZXJlZENhc2UgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBCdWZmZXIxMC5wcm90b3R5cGUuX2lzQnVmZmVyID0gdHJ1ZTsKICAgICAgZnVuY3Rpb24gc3dhcChiLCBuLCBtKSB7CiAgICAgICAgY29uc3QgaSA9IGJbbl07CiAgICAgICAgYltuXSA9IGJbbV07CiAgICAgICAgYlttXSA9IGk7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXAxNiA9IGZ1bmN0aW9uIHN3YXAxNigpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgMiAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiAxNi1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDIpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDEpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXAzMiA9IGZ1bmN0aW9uIHN3YXAzMigpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgNCAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiAzMi1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDQpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDMpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMSwgaSArIDIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXA2NCA9IGZ1bmN0aW9uIHN3YXA2NCgpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgOCAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiA2NC1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDgpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDcpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMSwgaSArIDYpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMiwgaSArIDUpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMywgaSArIDQpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gdG9TdHJpbmcoKSB7CiAgICAgICAgY29uc3QgbGVuZ3RoID0gdGhpcy5sZW5ndGg7CiAgICAgICAgaWYgKGxlbmd0aCA9PT0gMCkKICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PT0gMCkKICAgICAgICAgIHJldHVybiB1dGY4U2xpY2UodGhpcywgMCwgbGVuZ3RoKTsKICAgICAgICByZXR1cm4gc2xvd1RvU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SB0aGlzRW5kICYmIHN0YXJ0ID49IGVuZCkgewogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgICAgIGlmICh0aGlzU3RhcnQgPj0gdGhpc0VuZCkgewogICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPj0gZW5kKSB7CiAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgc3RhcnQgPj4+PSAwOwogICAgICAgIGVuZCA+Pj49IDA7CiAgICAgICAgdGhpc1N0YXJ0ID4+Pj0gMDsKICAgICAgICB0aGlzRW5kID4+Pj0gMDsKICAgICAgICBpZiAodGhpcyA9PT0gdGFyZ2V0KQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgbGV0IHggPSB0aGlzRW5kIC0gdGhpc1N0YXJ0OwogICAgICAgIGxldCB5ID0gZW5kIC0gc3RhcnQ7CiAgICAgICAgY29uc3QgbGVuID0gTWF0aC5taW4oeCwgeSk7CiAgICAgICAgY29uc3QgdGhpc0NvcHkgPSB0aGlzLnNsaWNlKHRoaXNTdGFydCwgdGhpc0VuZCk7CiAgICAgICAgY29uc3QgdGFyZ2V0Q29weSA9IHRhcmdldC5zbGljZShzdGFydCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbjsgKytpKSB7CiAgICAgICAgICBpZiAodGhpc0NvcHlbaV0gIT09IHRhcmdldENvcHlbaV0pIHsKICAgICAgICAgICAgeCA9IHRoaXNDb3B5W2ldOwogICAgICAgICAgICB5ID0gdGFyZ2V0Q29weVtpXTsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICh4IDwgeSkKICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICBpZiAoeSA8IHgpCiAgICAgICAgICByZXR1cm4gMTsKICAgICAgICByZXR1cm4gMDsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gYmlkaXJlY3Rpb25hbE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AgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICB2YWwgPSBCdWZmZXIxMC5mcm9tKHZhbCwgZW5jb2RpbmcpOwogICAgICAgIH0KICAgICAgICBpZiAoQnVmZmVyMTAuaXNCdWZmZXIodmFsKSkgewogICAgICAgICAgaWYgKHZhbC5sZW5ndGggPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGFycmF5SW5kZXhPZihidWZmZXIsIHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcik7CiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgdmFsID0gdmFsICYgMjU1OwogICAgICAgICAgaWYgKHR5cGVvZiBVaW50OEFycmF5LnByb3RvdHlwZS5pbmRleE9mID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIGlmIChkaXIpIHsKICAgICAgICAgICAgICByZXR1cm4gVWludDhBcnJheS5wcm90b3R5cGUuaW5kZXhPZi5jYWxsKGJ1ZmZlciwgdmFsLCBieXRlT2Zmc2V0KTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICByZXR1cm4gVWludDhBcnJheS5wcm90b3R5cGUubGFzdEluZGV4T2YuY2FsbChidWZmZXIsIHZhbCwgYnl0ZU9mZnNldCk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBhcnJheUluZGV4T2YoYnVmZmVyLCBbdmFsXSwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcik7CiAgICAgICAgfQogICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoInZhbCBtdXN0IGJlIHN0cmluZywgbnVtYmVyIG9yIEJ1ZmZlciIpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGFycmF5SW5kZXhPZihhcnIsIHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcikgewogICAgICAgIGxldCBpbmRleFNpemUgPSAxOwogICAgICAgIGxldCBhcnJMZW5ndGggPSBhcnIubGVuZ3RoOwogICAgICAgIGxldCB2YWxMZW5ndGggPSB2YWwubGVuZ3RoOwogICAgICAgIGlmIChlbmNvZGluZyAhPT0gdm9pZCAwKSB7CiAgICAgICAgICBlbmNvZGluZyA9IFN0cmluZyhlbmNvZGluZykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgIGlmIChlbmNvZGluZyA9PT0gInVjczIiIHx8IGVuY29kaW5nID09PSAidWNzLTIiIHx8IGVuY29kaW5nID09PSAidXRmMTZsZSIgfHwgZW5jb2RpbmcgPT09ICJ1dGYtMTZsZSIpIHsKICAgICAgICAgICAgaWYgKGFyci5sZW5ndGggPCAyIHx8IHZhbC5sZW5ndGggPCAyKSB7CiAgICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGluZGV4U2l6ZSA9IDI7CiAgICAgICAgICAgIGFyckxlbmd0aCAvPSAyOwogICAgICAgICAgICB2YWxMZW5ndGggLz0gMjsKICAgICAgICAgICAgYnl0ZU9mZnNldCAvPSAyOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiByZWFkKGJ1ZiwgaTIpIHsKICAgICAgICAgIGlmIChpbmRleFNpemUgPT09IDEpIHsKICAgICAgICAgICAgcmV0dXJuIGJ1ZltpMl07CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gYnVmLnJlYWRVSW50MTZCRShpMiAqIGluZGV4U2l6ZSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGxldCBpOwogICAgICAgIGlmIChkaXIpIHsKICAgICAgICAgIGxldCBmb3VuZEluZGV4ID0gLTE7CiAgICAgICAgICBmb3IgKGkgPSBieXRlT2Zmc2V0OyBpIDwgYXJyTGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgaWYgKHJlYWQoYXJyLCBpKSA9PT0gcmVhZCh2YWwsIGZvdW5kSW5kZXggPT09IC0xID8gMCA6IGkgLSBmb3VuZEluZGV4KSkgewogICAgICAgICAgICAgIGlmIChmb3VuZEluZGV4ID09PSAtMSkKICAgICAgICAgICAgICAgIGZvdW5kSW5kZXggPSBpOwogICAgICAgICAgICAgIGlmIChpIC0gZm91bmRJbmRleCArIDEgPT09IHZhbExlbmd0aCkKICAgICAgICAgICAgICAgIHJldHVybiBmb3VuZEluZGV4ICogaW5kZXhTaXplOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGlmIChmb3VuZEluZGV4ICE9PSAtMSkKICAgICAgICAgICAgICAgIGkgLT0gaSAtIGZvdW5kSW5kZXg7CiAgICAgICAgICAgICAgZm91bmRJbmRleCA9IC0xOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGlmIChieXRlT2Zmc2V0ICsgdmFsTGVuZ3RoID4gYXJyTGVuZ3RoKQogICAgICAgICAgICBieXRlT2Zmc2V0ID0gYXJyTGVuZ3RoIC0gdmFsTGVuZ3RoOwogICAgICAgICAgZm9yIChpID0gYnl0ZU9mZnNldDsgaSA+PSAwOyBpLS0pIHsKICAgICAgICAgICAgbGV0IGZvdW5kID0gdHJ1ZTsKICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCB2YWxMZW5ndGg7IGorKykgewogICAgICAgICAgICAgIGlmIChyZWFkKGFyciwgaSArIGopICE9PSByZWFkKHZhbCwgaikpIHsKICAgICAgICAgICAgICAgIGZvdW5kID0gZmFsc2U7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGZvdW5kKQogICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gLTE7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLmluY2x1ZGVzID0gZnVuY3Rpb24gaW5jbHVkZXModmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiB0aGlzLmluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgIT09IC0xOwogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUuaW5kZXhPZiA9IGZ1bmN0aW9uIGluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBiaWRpcmVjdGlvbmFsSW5kZXhPZih0aGlzLCB2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nLCB0cnVlKTsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLmxhc3RJbmRleE9mID0gZnVuY3Rpb24gbGFzdEluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBiaWRpcmVjdGlvbmFsSW5kZXhPZih0aGlzLCB2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nLCBmYWxzZSk7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGhleFdyaXRlKGJ1Ziwgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCkgewogICAgICAgIG9mZnNldCA9IE51bWJlcihvZmZzZXQpIHx8IDA7CiAgICAgICAgY29uc3QgcmVtYWluaW5nID0gYnVmLmxlbmd0aCAtIG9mZnNldDsKICAgICAgICBpZiAoIWxlbmd0aCkgewogICAgICAgICAgbGVuZ3RoID0gcmVtYWluaW5nOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBsZW5ndGggPSBOdW1iZXIobGVuZ3RoKTsKICAgICAgICAgIGlmIChsZW5ndGggPiByZW1haW5pbmcpIHsKICAgICAgICAgICAgbGVuZ3RoID0gcmVtYWluaW5nOwogICAgICAgICAgfQogICAgICAgIH0K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V0LCBsZW5ndGgpIHsKICAgICAgICByZXR1cm4gYmxpdEJ1ZmZlcih1dGYxNmxlVG9CeXRlcyhzdHJpbmcsIGJ1Zi5sZW5ndGggLSBvZmZzZXQpLCBidWYsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgfQogICAgICBCdWZmZXIxMC5wcm90b3R5cGUud3JpdGUgPSBmdW5jdGlvbiB3cml0ZShzdHJpbmcsIG9mZnNldCwgbGVuZ3RoLCBlbmNvZGluZykgewogICAgICAgIGlmIChvZmZzZXQgPT09IHZvaWQgMCkgewogICAgICAgICAgZW5jb2RpbmcgPSAidXRmOCI7CiAgICAgICAgICBsZW5ndGggPSB0aGlzLmxlbmd0aDsKICAgICAgICAgIG9mZnNldCA9IDA7CiAgICAgICAgfSBlbHNlIGlmIChsZW5ndGggPT09IHZvaWQgMCAmJiB0eXBlb2Ygb2Zmc2V0ID09PSAic3RyaW5nIikgewogICAgICAgICAgZW5jb2RpbmcgPSBvZmZzZXQ7CiAgICAgICAgICBsZW5ndGggPSB0aGlzLmxlbmd0aDsKICAgICAgICAgIG9mZnNldCA9IDA7CiAgICAgICAgfSBlbHNlIGlmIChpc0Zpbml0ZShvZmZzZXQpKSB7CiAgICAgICAgICBvZmZzZXQgPSBvZmZzZXQgPj4+IDA7CiAgICAgICAgICBpZiAoaXNGaW5pdGUobGVuZ3RoKSkgewogICAgICAgICAgICBsZW5ndGggPSBsZW5ndGggPj4+IDA7CiAgICAgICAgICAgIGlmIChlbmNvZGluZyA9PT0gdm9pZCAwKQogICAgICAgICAgICAgIGVuY29kaW5nID0gInV0ZjgiOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgZW5jb2RpbmcgPSBsZW5ndGg7CiAgICAgICAgICAgIGxlbmd0aCA9IHZvaWQgMDsKICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIud3JpdGUoc3RyaW5nLCBlbmNvZGluZywgb2Zmc2V0WywgbGVuZ3RoXSkgaXMgbm8gbG9uZ2VyIHN1cHBvcnRlZCIpOwogICAgICAgIH0KICAgICAgICBjb25zdCByZW1haW5pbmcgPSB0aGlzLmxlbmd0aCAtIG9mZnNldDsKICAgICAgICBpZiAobGVuZ3RoID09PSB2b2lkIDAgfHwgbGVuZ3RoID4gcmVtYWluaW5nKQogICAgICAgICAgbGVuZ3RoID0gcmVtYWluaW5nOwogICAgICAgIGlmIChzdHJpbmcubGVuZ3RoID4gMCAmJiAobGVuZ3RoIDwgMCB8fCBvZmZzZXQgPCAwKSB8fCBvZmZzZXQgPiB0aGlzLmxlbmd0aCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkF0dGVtcHQgdG8gd3JpdGUgb3V0c2lkZSBidWZmZXIgYm91bmRzIik7CiAgICAgICAgfQogICAgICAgIGlmICghZW5jb2RpbmcpCiAgICAgICAgICBlbmNvZGluZyA9ICJ1dGY4IjsKICAgICAgICBsZXQgbG93ZXJlZENhc2UgPSBmYWxzZTsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gaGV4V3JpdGUodGhpcywgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCk7CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBhc2NpaVdyaXRlKHRoaXMsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpOwogICAgICAgICAgICBjYXNlICJiYXNlNjQiOgogICAgICAgICAgICAgIHJldHVybiBiYXNlNjRXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgY2FzZSAidWNzMiI6CiAgICAgICAgICAgIGNhc2UgInVjcy0yIjoKICAgICAgICAgICAgY2FzZSAidXRmMTZsZSI6CiAgICAgICAgICAgIGNhc2UgInV0Zi0xNmxlIjoKICAgICAgICAgICAgICByZXR1cm4gdWNzMldyaXRlKHRoaXMsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgIGlmIChsb3dlcmVkQ2FzZSkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoIlVua25vd24gZW5jb2Rpbmc6ICIgKyBlbmNvZGluZyk7CiAgICAgICAgICAgICAgZW5jb2RpbmcgPSAoIiIgKyBlbmNvZGluZykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICBsb3dlcmVkQ2FzZSA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUudG9KU09OID0gZnVuY3Rpb24gdG9KU09OKCkgewogICAgICAgIHJldHVybiB7CiAgICAgICAgICB0eXBlOiAiQnVmZmVyIiwKICAgICAgICAgIGRhdGE6IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKHRoaXMuX2FyciB8fCB0aGlzLCAwKQogICAgICAgIH07CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGJhc2U2NFNsaWNlKGJ1Ziwgc3RhcnQsIGVuZCkgewogICAgICAgIGlmIChzdGFydCA9PT0gMCAmJiBlbmQgPT09IGJ1Zi5sZW5ndGgpIHsKICAgICAgICAgIHJldHVybiBiYXNlNjQuZnJvbUJ5dGVBcnJheShidWYpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICByZXR1cm4gYmFzZTY0LmZyb21CeXRlQX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IHNlY29uZEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAxMjcpIHsKICAgICAgICAgICAgICAgICAgICBjb2RlUG9pbnQgPSB0ZW1wQ29kZVBvaW50OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICBzZWNvbmRCeXRlID0gYnVmW2kgKyAxXTsKICAgICAgICAgICAgICAgIHRoaXJkQnl0ZSA9IGJ1ZltpICsgMl07CiAgICAgICAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAxOTIpID09PSAxMjggJiYgKHRoaXJkQnl0ZSAmIDE5MikgPT09IDEyOCkgewogICAgICAgICAgICAgICAgICB0ZW1wQ29kZVBvaW50ID0gKGZpcnN0Qnl0ZSAmIDE1KSA8PCAxMiB8IChzZWNvbmRCeXRlICYgNjMpIDw8IDYgfCB0aGlyZEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAyMDQ3ICYmICh0ZW1wQ29kZVBvaW50IDwgNTUyOTYgfHwgdGVtcENvZGVQb2ludCA+IDU3MzQzKSkgewogICAgICAgICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgIHNlY29uZEJ5dGUgPSBidWZbaSArIDFdOwogICAgICAgICAgICAgICAgdGhpcmRCeXRlID0gYnVmW2kgKyAyXTsKICAgICAgICAgICAgICAgIGZvdXJ0aEJ5dGUgPSBidWZbaSArIDNdOwogICAgICAgICAgICAgICAgaWYgKChzZWNvbmRCeXRlICYgMTkyKSA9PT0gMTI4ICYmICh0aGlyZEJ5dGUgJiAxOTIpID09PSAxMjggJiYgKGZvdXJ0aEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAxNSkgPDwgMTggfCAoc2Vjb25kQnl0ZSAmIDYzKSA8PCAxMiB8ICh0aGlyZEJ5dGUgJiA2MykgPDwgNiB8IGZvdXJ0aEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiA2NTUzNSAmJiB0ZW1wQ29kZVBvaW50IDwgMTExNDExMikgewogICAgICAgICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKGNvZGVQb2ludCA9PT0gbnVsbCkgewogICAgICAgICAgICBjb2RlUG9pbnQgPSA2NTUzMzsKICAgICAgICAgICAgYnl0ZXNQZXJTZXF1ZW5jZSA9IDE7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA+IDY1NTM1KSB7CiAgICAgICAgICAgIGNvZGVQb2ludCAtPSA2NTUzNjsKICAgICAgICAgICAgcmVzLnB1c2goY29kZVBvaW50ID4+PiAxMCAmIDEwMjMgfCA1NTI5Nik7CiAgICAgICAgICAgIGNvZGVQb2ludCA9IDU2MzIwIHwgY29kZVBvaW50ICYgMTAyMzsKICAgICAgICAgIH0KICAgICAgICAgIHJlcy5wdXNoKGNvZGVQb2ludCk7CiAgICAgICAgICBpICs9IGJ5dGVzUGVyU2VxdWVuY2U7CiAgICAgICAgfQogICAgICAgIHJldHVybiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkocmVzKTsKICAgICAgfQogICAgICB2YXIgTUFYX0FSR1VNRU5UU19MRU5HVEggPSA0MDk2OwogICAgICBmdW5jdGlvbiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkoY29kZVBvaW50cykgewogICAgICAgIGNvbnN0IGxlbiA9IGNvZGVQb2ludHMubGVuZ3RoOwogICAgICAgIGlmIChsZW4gPD0gTUFYX0FSR1VNRU5UU19MRU5HVEgpIHsKICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cyk7CiAgICAgICAgfQogICAgICAgIGxldCByZXMgPSAiIjsKICAgICAgICBsZXQgaSA9IDA7CiAgICAgICAgd2hpbGUgKGkgPCBsZW4pIHsKICAgICAgICAgIHJlcyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cy5zbGljZShpLCBpICs9IE1BWF9BUkdVTUVOVFNfTEVOR1RIKSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYXNjaWlTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldICYgMTI3KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBsYXRpbjFTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBoZXhTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBjb25zdCBsZW4gPSBidWYubGVuZ3RoOwogICAgICAgIGlmICghc3RhcnQgfHwgc3RhcnQgPCAwKQogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIGlmICghZW5kIHx8IGVuZCA8IDAgfHwgZW5kID4gbGVuKQogICAgICAgICAgZW5kID0gbGVuOwogICAgICAgIGxldCBvdXQgPSAiIjsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgb3V0ICs9IGhleFNsaWNlTG9va3VwVGFibGVbYnVmW2ldXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG91dDsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNmxlU2xpY2UoYnVmLCBzdGFydCwgZW5kKSB7CiAgICAgICAgY29uc3QgYnl0ZXMgPSBidWYuc2xpY2Uoc3RhcnQsIGVuZCk7CiAgICAgICAgbGV0IHJlcyA9ICIiOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYnl0ZXMubGVuZ3RoIC0gMTsgaSArPSAyKSB7CiAgICAgICAgICByZXMgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShieXRlc1tpXSArIGJ5dGVzW2kgKyAxXSAqIDI1Nik7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnNsaWNlID0gZnVuY3Rpb24gc2xpY2Uoc3RhcnQsIGVuZCkgewogICAgICAgIGNvbnN0IGxlbiA9IHRoaXMubGVuZ3RoOwogICAgICAgIHN0YXJ0ID0gfn5zdGFydDsKICAgICAgICBlbmQgPSBlbmQgPT09IHZvaWQgMCA/IGxlbiA6IH5+ZW5kOwogICAgICAgIGlmIChzdGFydCA8IDApIHsKICAgICAgICAgIHN0YXJ0ICs9IGxlbjsKICAgICAgICAgIGl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ytdID0gaGk7CiAgICAgICAgaGkgPSBoaSA+PiA4OwogICAgICAgIGJ1ZltvZmZzZXQrK10gPSBoaTsKICAgICAgICBoaSA9IGhpID4+IDg7CiAgICAgICAgYnVmW29mZnNldCsrXSA9IGhpOwogICAgICAgIHJldHVybiBvZmZzZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gd3J0QmlnVUludDY0QkUoYnVmLCB2YWx1ZSwgb2Zmc2V0LCBtaW4sIG1heCkgewogICAgICAgIGNoZWNrSW50QkkodmFsdWUsIG1pbiwgbWF4LCBidWYsIG9mZnNldCwgNyk7CiAgICAgICAgbGV0IGxvID0gTnVtYmVyKHZhbHVlICYgQmlnSW50KDQyOTQ5NjcyOTUpKTsKICAgICAgICBidWZbb2Zmc2V0ICsgN10gPSBsbzsKICAgICAgICBsbyA9IGxvID4+IDg7CiAgICAgICAgYnVmW29mZnNldCArIDZdID0gbG87CiAgICAgICAgbG8gPSBsbyA+PiA4OwogICAgICAgIGJ1ZltvZmZzZXQgKyA1XSA9IGxvOwogICAgICAgIGxvID0gbG8gPj4gODsKICAgICAgICBidWZbb2Zmc2V0ICsgNF0gPSBsbzsKICAgICAgICBsZXQgaGkgPSBOdW1iZXIodmFsdWUgPj4gQmlnSW50KDMyKSAmIEJpZ0ludCg0Mjk0OTY3Mjk1KSk7CiAgICAgICAgYnVmW29mZnNldCArIDNdID0gaGk7CiAgICAgICAgaGkgPSBoaSA+PiA4OwogICAgICAgIGJ1ZltvZmZzZXQgKyAyXSA9IGhpOwogICAgICAgIGhpID0gaGkgPj4gODsKICAgICAgICBidWZbb2Zmc2V0ICsgMV0gPSBoaTsKICAgICAgICBoaSA9IGhpID4+IDg7CiAgICAgICAgYnVmW29mZnNldF0gPSBoaTsKICAgICAgICByZXR1cm4gb2Zmc2V0ICsgODsKICAgICAgfQogICAgICBCdWZmZXIxMC5wcm90b3R5cGUud3JpdGVCaWdVSW50NjRMRSA9IGRlZmluZUJpZ0ludE1ldGhvZChmdW5jdG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ID09PSAic3RyaW5nIikgewogICAgICAgICAgICBlbmNvZGluZyA9IGVuZDsKICAgICAgICAgICAgZW5kID0gdGhpcy5sZW5ndGg7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoZW5jb2RpbmcgIT09IHZvaWQgMCAmJiB0eXBlb2YgZW5jb2RpbmcgIT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoImVuY29kaW5nIG11c3QgYmUgYSBzdHJpbmciKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0eXBlb2YgZW5jb2RpbmcgPT09ICJzdHJpbmciICYmICFCdWZmZXIxMC5pc0VuY29kaW5nKGVuY29kaW5nKSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHZhbC5sZW5ndGggPT09IDEpIHsKICAgICAgICAgICAgY29uc3QgY29kZSA9IHZhbC5jaGFyQ29kZUF0KDApOwogICAgICAgICAgICBpZiAoZW5jb2RpbmcgPT09ICJ1dGY4IiAmJiBjb2RlIDwgMTI4IHx8IGVuY29kaW5nID09PSAibGF0aW4xIikgewogICAgICAgICAgICAgIHZhbCA9IGNvZGU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiB2YWwgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICB2YWwgPSB2YWwgJiAyNTU7CiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsID09PSAiYm9vbGVhbiIpIHsKICAgICAgICAgIHZhbCA9IE51bWJlcih2YWwpOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPCAwIHx8IHRoaXMubGVuZ3RoIDwgc3RhcnQgfHwgdGhpcy5sZW5ndGggPCBlbmQpIHsKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJPdXQgb2YgcmFuZ2UgaW5kZXgiKTsKICAgICAgICB9CiAgICAgICAgaWYgKGVuZCA8PSBzdGFydCkgewogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgfQogICAgICAgIHN0YXJ0ID0gc3RhcnQgPj4+IDA7CiAgICAgICAgZW5kID0gZW5kID09PSB2b2lkIDAgPyB0aGlzLmxlbmd0aCA6IGVuZCA+Pj4gMDsKICAgICAgICBpZiAoIXZhbCkKICAgICAgICAgIHZhbCA9IDA7CiAgICAgICAgbGV0IGk7CiAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICBmb3IgKGkgPSBzdGFydDsgaSA8IGVuZDsgKytpKSB7CiAgICAgICAgICAgIHRoaXNbaV0gPSB2YWw7CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGNvbnN0IGJ5dGVzID0gQnVmZmVyMTAuaXNCdWZmZXIodmFsKSA/IHZhbCA6IEJ1ZmZlcjEwLmZyb20odmFsLCBlbmNvZGluZyk7CiAgICAgICAgICBjb25zdCBsZW4gPSBieXRlcy5sZW5ndGg7CiAgICAgICAgICBpZiAobGVuID09PSAwKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1RoZSB2YWx1ZSAiJyArIHZhbCArICciIGlzIGludmFsaWQgZm9yIGFyZ3VtZW50ICJ2YWx1ZSInKTsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBlbmQgLSBzdGFydDsgKytpKSB7CiAgICAgICAgICAgIHRoaXNbaSArIHN0YXJ0XSA9IGJ5dGVzW2kgJSBsZW5dOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgdmFyIGVycm9ycyA9IHt9OwogICAgICBmdW5jdGlvbiBFKHN5bSwgZ2V0TWVzc2FnZSwgQmFzZSkgewogICAgICAgIGVycm9yc1tzeW1dID0gY2xhc3MgTm9kZUVycm9yIGV4dGVuZHMgQmFzZSB7CiAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgc3VwZXIoKTsKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJtZXNzYWdlIiwgewogICAgICAgICAgICAgIHZhbHVlOiBnZXRNZXNzYWdlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyksCiAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB0aGlzLm5hbWUgPSBgJHt0aGlzLm5hbWV9IFske3N5bX1dYDsKICAgICAgICAgICAgdGhpcy5zdGFjazsKICAgICAgICAgICAgZGVsZXRlIHRoaXMubmFtZTsKICAgICAgICAgIH0KICAgICAgICAgIGdldCBjb2RlKCkgewogICAgICAgICAgICByZXR1cm4gc3ltOwogICAgICAgICAgfQogICAgICAgICAgc2V0IGNvZGUodmFsdWUpIHsKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJjb2RlIiwgewogICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICAgIHZhbHVlLAogICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgIH0pOwogICAgICAgICAgfQogICAgICAgICAgdG9TdHJpbmcoKSB7CiAgICAgICAgICAgIHJldHVybiBgJHt0aGlzLm5hbWV9IFske3N5bX1dOiAke3RoaXMubWVzc2FnZX1gOwogICAgICAgICAgfQogICAgICAgIH07CiAgICAgIH0KICAgICAgRSgiRVJSX0JVRkZFUl9PVVRfT0ZfQk9VTkRTIiwgZnVuY3Rpb24obmFtZSkgewogICAgICAgIGlmIChuYW1lKSB7CiAgICAgICAgICByZXR1cm4gYCR7bmFtZX0gaX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gPyAibiIgOiAiIjsKICAgICAgICAgIGxldCByYW5nZTsKICAgICAgICAgIGlmIChieXRlTGVuZ3RoMiA+IDMpIHsKICAgICAgICAgICAgaWYgKG1pbiA9PT0gMCB8fCBtaW4gPT09IEJpZ0ludCgwKSkgewogICAgICAgICAgICAgIHJhbmdlID0gYD49IDAke259IGFuZCA8IDIke259ICoqICR7KGJ5dGVMZW5ndGgyICsgMSkgKiA4fSR7bn1gOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHJhbmdlID0gYD49IC0oMiR7bn0gKiogJHsoYnl0ZUxlbmd0aDIgKyAxKSAqIDggLSAxfSR7bn0pIGFuZCA8IDIgKiogJHsoYnl0ZUxlbmd0aDIgKyAxKSAqIDggLSAxfSR7bn1gOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByYW5nZSA9IGA+PSAke21pbn0ke259IGFuZCA8PSAke21heH0ke259YDsKICAgICAgICAgIH0KICAgICAgICAgIHRocm93IG5ldyBlcnJvcnMuRVJSX09VVF9PRl9SQU5HRSgidmFsdWUiLCByYW5nZSwgdmFsdWUpOwogICAgICAgIH0KICAgICAgICBjaGVja0JvdW5kcyhidWYsIG9mZnNldCwgYnl0ZUxlbmd0aDIpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHZhbGlkYXRlTnVtYmVyKHZhbHVlLCBuYW1lKSB7CiAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSAhPT0gIm51bWJlciIpIHsKICAgICAgICAgIHRocm93IG5ldyBlcnJvcnMuRVJSX0lOVkFMSURfQVJHX1RZUEUobmFtZSwgIm51bWJlciIsIHZhbHVlKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYm91bmRzRXJyb3IodmFsdWUsIGxlbmd0aCwgdHlwZSkgewogICAgICAgIGlmIChNYXRoLmZsb29yKHZhbHVlKSAhPT0gdmFsdWUpIHsKICAgICAgICAgIHZhbGlkYXRlTnVtYmV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BbXTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgKytpKSB7CiAgICAgICAgICBjb2RlUG9pbnQgPSBzdHJpbmcuY2hhckNvZGVBdChpKTsKICAgICAgICAgIGlmIChjb2RlUG9pbnQgPiA1NTI5NSAmJiBjb2RlUG9pbnQgPCA1NzM0NCkgewogICAgICAgICAgICBpZiAoIWxlYWRTdXJyb2dhdGUpIHsKICAgICAgICAgICAgICBpZiAoY29kZVBvaW50ID4gNTYzMTkpIHsKICAgICAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkKICAgICAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgIH0gZWxzZSBpZiAoaSArIDEgPT09IGxlbmd0aCkgewogICAgICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgICAgICBieXRlcy5wdXNoKDIzOSwgMTkxLCAxODkpOwogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGxlYWRTdXJyb2dhdGUgPSBjb2RlUG9pbnQ7CiAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGNvZGVQb2ludCA8IDU2MzIwKSB7CiAgICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50OwogICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGNvZGVQb2ludCA9IChsZWFkU3Vycm9nYXRlIC0gNTUyOTYgPDwgMTAgfCBjb2RlUG9pbnQgLSA1NjMyMCkgKyA2NTUzNjsKICAgICAgICAgIH0gZWxzZSBpZiAobGVhZFN1cnJvZ2F0ZSkgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpCiAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgIH0KICAgICAgICAgIGxlYWRTdXJyb2dhdGUgPSBudWxsOwogICAgICAgICAgaWYgKGNvZGVQb2ludCA8IDEyOCkgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDEpIDwgMCkKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgYnl0ZXMucHVzaChjb2RlUG9pbnQpOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPCAyMDQ4KSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMikgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiA2IHwgMTkyLCBjb2RlUG9pbnQgJiA2MyB8IDEyOCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA8IDY1NTM2KSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiAxMiB8IDIyNCwgY29kZVBvaW50ID4+IDYgJiA2MyB8IDEyOCwgY29kZVBvaW50ICYgNjMgfCAxMjgpOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPCAxMTE0MTEyKSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gNCkgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiAxOCB8IDI0MCwgY29kZVBvaW50ID4+IDEyICYgNjMgfCAxMjgsIGNvZGVQb2ludCA+PiA2ICYgNjMgfCAxMjgsIGNvZGVQb2ludCAmIDYzIHwgMTI4KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigiSW52YWxpZCBjb2RlIHBvaW50Iik7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBieXRlczsKICAgICAgfQogICAgICBmdW5jdGlvbiBhc2NpaVRvQnl0ZXMoc3RyKSB7CiAgICAgICAgY29uc3QgYnl0ZUFycmF5ID0gW107CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBzdHIubGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGJ5dGVBcnJheS5wdXNoKHN0ci5jaGFyQ29kZUF0KGkpICYgMjU1KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ5dGVBcnJheTsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNmxlVG9CeXRlcyhzdHIsIHVuaXRzKSB7CiAgICAgICAgbGV0IGMsIGhpLCBsbzsKICAgICAgICBjb25zdCBieXRlQXJyYXkgPSBbXTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0ci5sZW5ndGg7ICsraSkgewogICAgICAgICAgaWYgKCh1bml0cyAtPSAyKSA8IDApCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgYyA9IHN0ci5jaGFyQ29kZUF0KGkpOwogICAgICAgICAgaGkgPSBjID4+IDg7CiAgICAgICAgICBsbyA9IGMgJSAyNTY7CiAgICAgICAgICBieXRlQXJyYXkucHVzaChsbyk7CiAgICAgICAgICBieXRlQXJyYXkucHVzaChoaSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBieXRlQXJyYXk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYmFzZTY0VG9CeXRlcyhzdHIpIHsKICAgICAgICByZXR1cm4gYmFzZTY0LnRvQnl0ZUFycmF5KGJhc2U2NGNsZWFuKHN0cikpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJsaXRCdWZmZXIoc3JjLCBkc3QsIG9mZnNldCwgbGVuZ3RoKSB7CiAgICAgICAgbGV0IGk7CiAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbmd0aDsgKytpKSB7CiAgICAgICAgICBpZiAoaSArIG9mZnNldCA+PSBkc3QubGVuZ3RoIHx8IGkgPj0gc3JjLmxlbmd0aCkKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBkc3RbaSArIG9mZnNldF0gPSBzcmNbaV07CiAgICAgICAgfQogICAgICAgIHJldHVybiBpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGlzSW5zdGFuY2Uob2JqLCB0eXBlKSB7CiAgICAgICAgcmV0dXJuIG9iaiBpbnN0YW5jZW9mIHR5cGUgfHwgb2JqICE9IG51bGwgJiYgb2JqLmNvbnN0cnVjdG9yICE9IG51bGwgJiYgb2JqLmNvbnN0cnVjdG9yLm5hbWUgIT0gbnVsbCAmJiBvYmouY29uc3RydWN0b3IubmFtZSA9PT0gdHlwZS5uYW1lOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIG51bWJlcklzTmFOKG9iaikgewogICAgICAgIHJldHVybiBvYmogIT09IG9iajsKICAgICAgfQogICAgICB2YXIgaGV4U2xpY2VMb29rdXBUYWJsZSA9IGZ1bmN0aW9uKCkgewogICAgICAgIGNvbnN0IGFscGhhYmV0ID0gIjAxMjM0NTY3ODlhYmNkZWYiOwogICAgICAgIGNvbnN0IHRhYmxlID0gbmV3IEFycmF5KDI1Nik7CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCAxNjsgKytpKSB7CiAgICAgICAgICBjb25zdCBpMTYgPSBpICogMTY7CiAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IDE2OyArK2opIHsKICAgICAgICAgICAgdGFibGVbaTE2ICsgal0gPSBhbHBoYWJldFtpXSArIGFscGhhYmV0W2pdOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gdGFibGU7CiAgICAgIH0oKTsKICAgICAgZnVuY3Rpb24gZGVmaW5lQmlnSW50TWV0aG9kKGZuKSB7CiAgICA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gICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pOwogICAgICAgIHJldHVybiBDb25zdHJ1Y3RvcjsKICAgICAgfQogICAgICBmdW5jdGlvbiBfaW5oZXJpdHMoc3ViQ2xhc3MsIHN1cGVyQ2xhc3MpIHsKICAgICAgICBpZiAodHlwZW9mIHN1cGVyQ2xhc3MgIT09ICJmdW5jdGlvbiIgJiYgc3VwZXJDbGFzcyAhPT0gbnVsbCkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiU3VwZXIgZXhwcmVzc2lvbiBtdXN0IGVpdGhlciBiZSBudWxsIG9yIGEgZnVuY3Rpb24iKTsKICAgICAgICB9CiAgICAgICAgc3ViQ2xhc3MucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShzdXBlckNsYXNzICYmIHN1cGVyQ2xhc3MucHJvdG90eXBlLCB7CiAgICAgICAgICBjb25zdHJ1Y3RvcjogewogICAgICAgICAgICB2YWx1ZTogc3ViQ2xhc3MsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlLAogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoc3ViQ2xhc3MsICJwcm90b3R5cGUiLCB7CiAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KTsKICAgICAgICBpZiAoc3VwZXJDbGFzcykKICAgICAgICAgIF9zZXRQcm90b3R5cGVPZihzdWJDbGFzcywgc3VwZXJDbGFzcyk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mKG8pIHsKICAgICAgICBfZ2V0UHJvdG90eXBlT2YgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgPyBPYmplY3QuZ2V0UHJvdG90eXBlT2YuYmluZCgpIDogZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mMihvMikgewogICAgICAgICAgcmV0dXJuIG8yLl9fcHJvdG9fXyB8fCBPYmplY3QuZ2V0UHJvdG90eXBlT2YobzIpOwogICAgICAgIH07CiAgICAgICAgcmV0dXJuIF9nZXRQcm90b3R5cGVPZihvKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YobywgcCkgewogICAgICAgIF9zZXRQcm90b3R5cGVPZiA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiA/IE9iamVjdC5zZXRQcm90b3R5cGVPZi5iaW5kKCkgOiBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YyKG8yLCBwMikgewogICAgICAgICAgbzIuX19wcm90b19fID0gcDI7CiAgICAgICAgICByZXR1cm4gbzI7CiAgICAgICAgfTsKICAgICAgICByZXR1cm4gX3NldFByb3RvdHlwZU9mKG8sIHApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9pc05hdGl2ZVJlZmxlY3RDb25zdHJ1Y3QoKSB7CiAgICAgICAgaWYgKHR5cGVvZiBSZWZsZWN0ID09PSAidW5kZWZpbmVkIiB8fCAhUmVmbGVjdC5jb25zdHJ1Y3QpCiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKFJlZmxlY3QuY29uc3RydWN0LnNoYW0pCiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKHR5cGVvZiBQcm94eSA9PT0gImZ1bmN0aW9uIikKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIHRyeSB7CiAgICAgICAgICBCb29sZWFuLnByb3RvdHlwZS52YWx1ZU9mLmNhbGwoUmVmbGVjdC5jb25zdHJ1Y3QoQm9vbGVhbiwgW10sIGZ1bmN0aW9uKCkgewogICAgICAgICAgfSkpOwogICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBfYXNzZXJ0VGhpc0luaXRpYW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RoaXMpLmNvbnN0cnVjdG9yOwogICAgICAgICAgICByZXN1bHQgPSBSZWZsZWN0LmNvbnN0cnVjdChTdXBlciwgYXJndW1lbnRzLCBOZXdUYXJnZXQpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmVzdWx0ID0gU3VwZXIuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBfcG9zc2libGVDb25zdHJ1Y3RvclJldHVybih0aGlzLCByZXN1bHQpOwogICAgICAgIH07CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX3N1cGVyUHJvcEJhc2Uob2JqZWN0LCBwcm9wZXJ0eSkgewogICAgICAgIHdoaWxlICghT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwgcHJvcGVydHkpKSB7CiAgICAgICAgICBvYmplY3QgPSBfZ2V0UHJvdG90eXBlT2Yob2JqZWN0KTsKICAgICAgICAgIGlmIChvYmplY3QgPT09IG51bGwpCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICByZXR1cm4gb2JqZWN0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9nZXQoKSB7CiAgICAgICAgaWYgKHR5cGVvZiBSZWZsZWN0ICE9PSAidW5kZWZpbmVkIiAmJiBSZWZsZWN0LmdldCkgewogICAgICAgICAgX2dldCA9IFJlZmxlY3QuZ2V0LmJpbmQoKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgX2dldCA9IGZ1bmN0aW9uIF9nZXQyKHRhcmdldCwgcHJvcGVydHksIHJlY2VpdmVyKSB7CiAgICAgICAgICAgIHZhciBiYXNlID0gX3N1cGVyUHJvcEJhc2UodGFyZ2V0LCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmICghYmFzZSkKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIHZhciBkZXNjID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihiYXNlLCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmIChkZXNjLmdldCkgewogICAgICAgICAgICAgIHJldHVybiBkZXNjLmdldC5jYWxsKGFyZ3VtZW50cy5sZW5ndGggPCAzID8gdGFyZ2V0IDogcmVjZWl2ZXIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBkZXNjLnZhbHVlOwogICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIF9nZXQuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgfQogICAgICB2YXIgRW1pdHRlciA9IC8qIEBfX1BVUkVfXyAqLyBmdW5jdGlvbigpIHsKICAgICAgICBmdW5jdGlvbiBFbWl0dGVyMigpIHsKICAgICAgICAgIF9jbGFzc0NhbGxDaGVjayh0aGlzLCBFbWl0dGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgImxpc3RlbmVycyIsIHsKICAgICAgICAgICAgdmFsdWU6IHt9LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEVtaXR0ZXIyLCBbewogICAgICAgICAga2V5OiAiYWRkRXZlbnRMaXN0ZW5lciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWRkRXZlbnRMaXN0ZW5lcih0eXBlLCBjYWxsYmFjaywgb3B0aW9ucykgewogICAgICAgICAgICBpZiAoISh0eXBlIGluIHRoaXMubGlzdGVuZXJzKSkgewogICAgICAgICAgICAgIHRoaXMubGlzdGVuZXJzW3R5cGVdID0gW107CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5saXN0ZW5lcnNbdHlwZV0ucHVzaCh7CiAgICAgICAgICAgICAgY2FsbGJhY2ssCiAgICAgICAgICAgICAgb3B0aW9ucwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJyZW1vdmVFdmVudExpc3RlbmVyIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiByZW1vdmVFdmVudExpc3RlbmVyKHR5cGUsIGNhbGxiYWNrKSB7CiAgICAgICAgICAgIGlmICghKHR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW3R5cGVdOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIGlmIChzdGFja1tpXS5jYWxsYmFjayA9PT0gY2FsbGJhY2spIHsKICAgICAgICAgICAgICAgIHN0YWNrLnNwbGljZShpLCAxKTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJkaXNwYXRjaEV2ZW50IiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBkaXNwYXRjaEV2ZW50KGV2ZW50KSB7CiAgICAgICAgICAgIGlmICghKGV2ZW50LnR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW2V2ZW50LnR5cGVdOwogICAgICAgICAgICB2YXIgc3RhY2tUb0NhbGwgPSBzdGFjay5zbGljZSgpOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrVG9DYWxsLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIHZhciBsaXN0ZW5lciA9IHN0YWNrVG9DYWxsW2ldOwogICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBsaXN0ZW5lci5jYWxsYmFjay5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBQcm9taXNlLnJlc29sdmUoKS50aGVuKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChsaXN0ZW5lci5vcHRpb25zICYmIGxpc3RlbmVyLm9wdGlvbnMub25jZSkgewogICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVFdmVudExpc3RlbmVyKGV2ZW50LnR5cGUsIGxpc3RlbmVyLmNhbGxiYWNrKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuICFldmVudC5kZWZhdWx0UHJldmVudGVkOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gRW1pdHRlcjI7CiAgICAgIH0oKTsKICAgICAgdmFyIEFib3J0U2lnbmFsID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKF9FbWl0dGVyKSB7CiAgICAgICAgX2luaGVyaXRzKEFib3J0U2lnbmFsMiwgX0VtaXR0ZXIpOwogICAgICAgIHZhciBfc3VwZXIgPSBfY3JlYXRlU3VwZXIoQWJvcnRTaWduYWwyKTsKICAgICAgICBmdW5jdGlvbiBBYm9ydFNpZ25hbDIoKSB7CiAgICAgICAgICB2YXIgX3RoaXM7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRTaWduYWwyKTsKICAgICAgICAgIF90aGlzID0gX3N1cGVyLmNhbGwodGhpcyk7CiAgICAgICAgICBpZiAoIV90aGlzLmxpc3RlbmVycykgewogICAgICAgICAgICBFbWl0dGVyLmNhbGwoX2Fzc2VydFRoaXNJbml0aWFsaXplZChfdGhpcykpOwogICAgICAgICAgfQogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KF9hc3NlcnRUaGlzSW5pdGlhbGl6ZWQoX3RoaXMpLCAiYWJvcnRlZCIsIHsKICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgIm9uYWJvcnQiLCB7CiAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgInJlYXNvbiIsIHsKICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgICByZXR1cm4gX3RoaXM7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhBYm9ydFNpZ25hbDIsIFt7CiAgICAgICAgICBrZXk6ICJ0b1N0cmluZyIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gdG9TdHJpbmcoKSB7CiAgICAgICAgICAgIHJldHVybiAiW29iamVjdCBBYm9ydFNpZ25hbF0iOwogICAgICAgICAgfQogICAgICAgIH0sIHsKICAgICAgICAgIGtleTogImRpc3BhdGNoRXZlbnQiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGRpc3BhdGNoRXZlbnQoZXZlbnQpIHsKICAgICAgICAgICAgaWYgKGV2ZW50LnR5cGUgPT09ICJhYm9ydCIpIHsKICAgICAgICAgICAgICB0aGlzLmFib3J0ZWQgPSB0cnVlOwogICAgICAgICAgICAgIGlmICh0eXBlb2YgdGhpcy5vbmFib3J0ID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICB0aGlzLm9uYWJvcnQuY2FsbCh0aGlzLCBldmVudCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIF9nZXQoX2dldFByb3RvdHlwZU9mKEFib3J0U2lnbmFsMi5wcm90b3R5cGUpLCAiZGlzcGF0Y2hFdmVudCIsIHRoaXMpLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gQWJvcnRTaWduYWwyOwogICAgICB9KEVtaXR0ZXIpOwogICAgICB2YXIgQWJvcnRDb250cm9sbGVyID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKCkgewogICAgICAgIGZ1bmN0aW9uIEFib3J0Q29udHJvbGxlcjIoKSB7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRDb250cm9sbGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgInNpZ25hbCIsIHsKICAgICAgICAgICAgdmFsdWU6IG5ldyBBYm9ydFNpZ25hbCgpLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEFib3J0Q29udHJvbGxlcjIsIFt7CiAgICAgICAgICBrZXk6ICJhYm9ydCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWJvcnQocmVhc29uKSB7CiAgICAgICAgICAgIHZhciBldmVudDsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBldmVudCA9IG5ldyBFdmVudCgiYWJvcnQiKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgIGlmICh0eXBlb2YgZG9jdW1lbnQgIT09ICJ1bmRlZmluZWQiKSB7CiAgICAgICAgICAgICAgICBpZiAoIWRvY3VtZW50LmNyZWF0ZUV2ZW50KSB7CiAgICAgICAgICAgICAgICAgIGV2ZW50ID0gZG9jdW1lbnQuY3JlYXRlRXZlbnRPYmplY3QoKTsKICAgICAgICAgICAgICAgICAgZXZlbnQudHlwZSA9ICJhYm9ydCI7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBldmVudCA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCJFdmVudCIpOwogICAgICAgICAgICAgICAgICBldmVudC5pbml0RXZlbnQoImFib3J0IiwgZmFsc2UsIGZhbHNlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZXZlbnQgPSB7CiAgICAgICAgICAgICAgICAgIHR5cGU6ICJhYm9ydCIsCiAgICAgICAgICAgICAgICAgIGJ1YmJsZXM6IGZhbHNlLAogICAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHNpZ25hbFJlYXNvbiA9IHJlYXNvbjsKICAgICAgICAgICAgaWYgKHNpZ25hbFJlYXNvbiA9PT0gdm9pZCAwKSB7CiAgICAgICAgICAgICAgaWYgKHR5cGVvZiBkb2N1bWVudCA9PT0gInVuZGVmaW5lZCIpIHsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbi5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24gPSBuZXcgRE9NRXhjZXB0aW9uKCJzaWduYWwgaXMgYWJvcnRlZCB3aXRob3V0IHJlYXNvbiIpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgICAgc2lnbmFsUmVhc29uLm5hbWUgPSAiQWJvcnRFcnJvciI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMuc2lnbmFsLnJlYXNvbiA9IHNpZ25hbFJlYXNvbjsKICAgICAgICAgICAgdGhpcy5zaWduYWwuZGlzcGF0Y2hFdmVudChldmVudCk7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAidG9TdHJpbmciLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIHRvU3RyaW5nKCkgewogICAgICAgICAgICByZXR1cm4gIltvYmplY3QgQWJvcnRDb250cm9sbGVyXSI7CiAgICAgICAgICB9CiAgICAgICAgfV0pOwogICAgICAgIHJldHVybiBBYm9ydENvbnRyb2xsZXIyOwogICAgICB9KCk7CiAgICAgIGlmICh0eXBlb2YgU3ltYm9sICE9PSAidW5kZWZpbmVkIiAmJiBTeW1ib2wudG9TdHJpbmdUYWcpIHsKICAgICAgICBBYm9ydENvbnRyb2xsZXIucHJvdG90eXBlW1N5bWJvbC50b1N0cmluZ1RhZ10gPSAiQWJvcnRDb250cm9sbGVyIjsKICAgICAgICBBYm9ydFNpZ25hbC5wcm90b3R5cGVbU3ltYm9sLnRvU3RyaW5nVGFnXSA9ICJBYm9ydFNpZ25hbCI7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcG9seWZpbGxOZWVkZWQoc2VsZjIpIHsKICAgICAgICBpZiAoc2VsZjIu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nB1dCwgaW5pdDIpOwogICAgICAgICAgICBpZiAoc2lnbmFsKSB7CiAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHJlcXVlc3QsICJzaWduYWwiLCB7CiAgICAgICAgICAgICAgICB3cml0YWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICAgIHZhbHVlOiBzaWduYWwKICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmVxdWVzdDsKICAgICAgICAgIH07CiAgICAgICAgICBSZXF1ZXN0LnByb3RvdHlwZSA9IE5hdGl2ZVJlcXVlc3QucHJvdG90eXBlOwogICAgICAgIH0KICAgICAgICB2YXIgcmVhbEZldGNoID0gZmV0Y2g7CiAgICAgICAgdmFyIGFib3J0YWJsZUZldGNoID0gZnVuY3Rpb24gYWJvcnRhYmxlRmV0Y2gyKGlucHV0LCBpbml0MikgewogICAgICAgICAgdmFyIHNpZ25hbCA9IFJlcXVlc3QgJiYgUmVxdWVzdC5wcm90b3R5cGUuaXNQcm90b3R5cGVPZihpbnB1dCkgPyBpbnB1dC5zaWduYWwgOiBpbml0MiA/IGluaXQyLnNpZ25hbCA6IHZvaWQgMDsKICAgICAgICAgIGlmIChzaWduYWwpIHsKICAgICAgICAgICAgdmFyIGFib3J0RXJyb3I7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgYWJvcnRFcnJvciA9IG5ldyBET01FeGNlcHRpb24oIkFib3J0ZWQiLCAiQWJvcnRFcnJvciIpOwogICAgICAgICAgICB9IGNhdGNoIChlcnIpIHsKICAgICAgICAgICAgICBhYm9ydEVycm9yID0gbmV3IEVycm9yKCJBYm9ydGVkIik7CiAgICAgICAgICAgICAgYWJvcnRFcnJvci5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzaWduYWwuYWJvcnRlZCkgewogICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChhYm9ydEVycm9yKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgY2FuY2VsbGF0aW9uID0gbmV3IFByb21pc2UoZnVuY3Rpb24oXywgcmVqZWN0KSB7CiAgICAgICAgICAgICAgc2lnbmFsLmFkZEV2ZW50TGlzdGVuZXIoImFib3J0IiwgZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gcmVqZWN0KGFib3J0RXJyb3IpOwogICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIG9uY2U6IHRydWUKICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGlmIChpbml0MiAmJiBpbml0Mi5zaWduYWwpIHsKICAgICAgICAgICAgICBkZWxldGUgaW5pdDIuc2lnbmFsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJhY2UoW2NhbmNlbGxhdGlvbiwgcmVhbEZldGNoKGlucHV0LCBpbml0MildKTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiByZWFsRmV0Y2goaW5wdXQsIGluaXQyKTsKICAgICAgICB9OwogICAgICAgIHJldHVybiB7CiAgICAgICAgICBmZXRjaDogYWJvcnRhYmxlRmV0Y2gsCiAgICAgICAgICBSZXF1ZXN0CiAgICAgICAgfTsKICAgICAgfQogICAgICBleHBvcnRzMi5BYm9ydENvbnRyb2xsZXIgPSBBYm9ydENvbnRyb2xsZXI7CiAgICAgIGV4cG9ydHMyLkFib3J0U2lnbmFsID0gQWJvcnRTaWduYWw7CiAgICAgIGV4cG9ydHMyLmFib3J0YWJsZUZldGNoID0gYWJvcnRhYmxlRmV0Y2hEZWNvcmF0b3I7CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9hYm9ydGFibGUtcHJvbWlzZS1jYW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ydGNvbnRyb2xsZXJfcG9ueWZpbGxfMSA9IHJlcXVpcmVfYWJvcnRjb250cm9sbGVyX3BvbnlmaWxsKCk7CiAgICAgIHZhciBOdWxsU2lnbmFsID0gY2xhc3MgewogICAgICB9OwogICAgICB2YXIgQWdncmVnYXRlQWJvcnRDb250cm9sbGVyID0gY2xhc3MgewogICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgdGhpcy5zaWduYWxzID0gbmV3IFNldCgpOwogICAgICAgICAgdGhpcy5hYm9ydENvbnRyb2xsZXIgPSBuZXcgYWJvcnRjb250cm9sbGVyX3BvbnlmaWxsXzEuQWJvcnRDb250cm9sbGVyKCk7CiAgICAgICAgfQogICAgICAgIGFkZFNpZ25hbChzaWduYWwgPSBuZXcgTnVsbFNpZ25hbCgpKSB7CiAgICAgICAgICBpZiAodGhpcy5zaWduYWwuYWJvcnRlZCkgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoImNhbm5vdCBhZGQgYSBzaWduYWwsIGFscmVhZHkgYWJvcnRlZCEiKTsKICAgICAgICAgIH0KICAgICAgICAgIHRoaXMuc2lnbmFscy5hZGQoc2lnbmFsKTsKICAgICAgICAgIGlmIChzaWduYWwuYWJvcnRlZCkgewogICAgICAgICAgICB0aGlzLmhhbmRsZUFib3J0ZWQoc2lnbmFsKTsKICAgICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIHNpZ25hbC5hZGRFdmVudExpc3RlbmVyID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIHNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsICgpID0+IHsKICAgICAgICAgICAgICB0aGlzLmhhbmRsZUFib3J0ZWQoc2lnbmFsKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGhhbmRsZUFib3J0ZWQoc2lnbmFsKSB7CiAgICAgICAgICB0aGlzLnNpZ25hbHMuZGVsZXRlKHNpZ25hbCk7CiAgICA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AgICAgICAgIGNvbnN0IG5ld0VudHJ5ID0gewogICAgICAgICAgICBhYm9ydGVyLAogICAgICAgICAgICBwcm9taXNlOiB0aGlzLmZpbGxDYWxsYmFjayhkYXRhLCBhYm9ydGVyLnNpZ25hbCwgKG1lc3NhZ2UpID0+IHsKICAgICAgICAgICAgICBzdGF0dXNSZXBvcnRlci5jYWxsYmFjayhtZXNzYWdlKTsKICAgICAgICAgICAgfSksCiAgICAgICAgICAgIHNldHRsZWQ6IGZhbHNlLAogICAgICAgICAgICBzdGF0dXNSZXBvcnRlciwKICAgICAgICAgICAgZ2V0IGFib3J0ZWQoKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYWJvcnRlci5zaWduYWwuYWJvcnRlZDsKICAgICAgICAgICAgfQogICAgICAgICAgfTsKICAgICAgICAgIG5ld0VudHJ5LmFib3J0ZXIuYWRkU2lnbmFsKHNpZ25hbCk7CiAgICAgICAgICBuZXdFbnRyeS5hYm9ydGVyLnNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsICgpID0+IHsKICAgICAgICAgICAgaWYgKCFuZXdFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgdGhpcy5ldmljdChrZXksIG5ld0VudHJ5KTsKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgICBuZXdFbnRyeS5wcm9taXNlLnRoZW4oKCkgPT4gewogICAgICAgICAgICBuZXdFbnRyeS5zZXR0bGVkID0gdHJ1ZTsKICAgICAgICAgIH0sICgpID0+IHsKICAgICAgICAgICAgbmV3RW50cnkuc2V0dGxlZCA9IHRydWU7CiAgICAgICAgICAgIHRoaXMuZXZpY3Qoa2V5LCBuZXdFbnRyeSk7CiAgICAgICAgICB9KS5jYXRjaCgoZSkgPT4gewogICAgICAgICAgICBjb25zb2xlLmVycm9yKGUpOwogICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgfSk7CiAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIG5ld0VudHJ5KTsKICAgICAgICB9CiAgICAgICAgc3RhdGljIGNoZWNrU2luZ2xlUHJvbWlzZShwcm9taXNlLCBzaWduYWwpIHsKICAgICAgICAgIGZ1bmN0aW9uIGNoZWNrRm9yU2luZ2xlQWJvcnQoKSB7CiAgICAgICAgICAgIGlmIChzaWduYWwgJiYgc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICB0aHJvdyBPYmplY3QuYXNzaWduKG5ldyBFcnJvcigiYWJvcnRlZCIpLCB7IGNvZGU6ICJFUlJfQUJPUlRFRCIgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBwcm9taXNlLnRoZW4oKHJlc3VsdCkgPT4gewogICAgICAgICAgICBjaGVja0ZvclNpbmdsZUFib3J0KCk7CiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICAgICB9LCAoZXJyb3IpID0+IHsKICAgICAgICAgICAgY2hlY2tGb3JTaW5nbGVBYm9ydCgpOwogICAgICAgICAgICB0aHJvdyBlcnJvcjsKICAgICAgICAgIH0pOwogICAgICAgIH0KICAgICAgICBoYXMoa2V5KSB7CiAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5oYXMoa2V5KTsKICAgICAgICB9CiAgICAgICAgZ2V0KGtleSwgZGF0YSwgc2lnbmFsLCBzdGF0dXNDYWxsYmFjaykgewogICAgICAgICAgaWYgKCFzaWduYWwgJiYgZGF0YSBpbnN0YW5jZW9mIGFib3J0Y29udHJvbGxlcl9wb255ZmlsbF8xLkFib3J0U2lnbmFsKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoInNlY29uZCBnZXQgYXJndW1lbnQgYXBwZWFycyB0byBiZSBhbiBBYm9ydFNpZ25hbCwgcGVyaGFwcyB5b3UgbWVhbnQgdG8gcGFzcyBgbnVsbGAgZm9yIHRoZSBmaWxsIGRhdGE/Iik7CiAgICAgICAgICB9CiAgICAgICAgICBjb25z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ID0gb3B0aW9ucy5tYXhTaXplOwogICAgICAgICAgdGhpcy5jYWNoZSA9IG5ldyBNYXAoKTsKICAgICAgICAgIHRoaXMub2xkQ2FjaGUgPSBuZXcgTWFwKCk7CiAgICAgICAgICB0aGlzLl9zaXplID0gMDsKICAgICAgICB9CiAgICAgICAgX3NldChrZXksIHZhbHVlKSB7CiAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIHZhbHVlKTsKICAgICAgICAgIHRoaXMuX3NpemUrKzsKICAgICAgICAgIGlmICh0aGlzLl9zaXplID49IHRoaXMubWF4U2l6ZSkgewogICAgICAgICAgICB0aGlzLl9zaXplID0gMDsKICAgICAgICAgICAgdGhpcy5vbGRDYWNoZSA9IHRoaXMuY2FjaGU7CiAgICAgICAgICAgIHRoaXMuY2FjaGUgPSBuZXcgTWFwKCk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGdldChrZXkpIHsKICAgICAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLmNhY2hlLmdldChrZXkpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHRoaXMub2xkQ2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgY29uc3QgdmFsdWUgPSB0aGlzLm9sZENhY2hlLmdldChrZXkpOwogICAgICAgICAgICB0aGlzLm9sZENhY2hlLmRlbGV0ZShrZXkpOwogICAgICAgICAgICB0aGlzLl9zZXQoa2V5LCB2YWx1ZSk7CiAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgc2V0KGtleSwgdmFsdWUpIHsKICAgICAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHRoaXMuY2FjaGUuc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdGhpcy5fc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgfQogICAgICAgIGhhcyhrZXkpIHsKICAgICAgICAgIHJldHVybiB0aGlzLmNhY2hlLmhhcyhrZXkpIHx8IHRoaXMub2xkQ2FjaGUuaGFzKGtleSk7CiAgICAgICAgfQogICAgICAgIHBlZWsoa2V5KSB7CiAgICAgICAgICBpZiAodGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5nZXQoa2V5KTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0aGlzLm9sZENhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLm9sZENhY2hlLmdldChrZXkpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkZWxldGUoa2V5KSB7CiAgICAgICAgICBjb25zdCBkZWxldGVkID0gdGhpcy5jYWNoZS5kZWxldGUoa2V5KTsKICAgICAgICAgIGlmIChkZWxldGVkKSB7CiAgICAgICAgICAgIHRoaXMuX3NpemUtLTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiB0aGlzLm9sZENhY2hlLmRlbGV0ZShrZXkpIHx8IGRlbGV0ZWQ7CiAgICAgICAgfQogICAgICAgIGNsZWFyKCkgewogICAgICAgICAgdGhpcy5jYWNoZS5jbGVhcigpOwogICAgICAgICAgdGhpcy5vbGRDYWNoZS5jbGVhcigpOwogICAgICAgICAgdGhpcy5fc2l6ZSA9IDA7CiAgICAgICAgfQogICAgICAgICprZXlzKCkgewogICAgICAgICAgZm9yIChjb25zdCBba2V5XSBvZiB0aGlzKSB7CiAgICAgICAgICAgIHlpZWxkIGtleTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgKnZhbHVlcygpIHsKICAgICAgICAgIGZvciAoY29uc3QgWywgdmFsdWVdIG9mIHRoaXMpIHsKICAgICAgICAgICAgeWllbGQgdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICA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ZSIoKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi91dGlscy9jb21tb24uanMKICB2YXIgcmVxdWlyZV9jb21tb24gPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3V0aWxzL2NvbW1vbi5qcyIoZXhwb3J0czIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIHZhciBUWVBFRF9PSyA9IHR5cGVvZiBVaW50OEFycmF5ICE9PSAidW5kZWZpbmVkIiAmJiB0eXBlb2YgVWludDE2QXJyYXkgIT09ICJ1bmRlZmluZWQiICYmIHR5cGVvZiBJbnQzMkFycmF5ICE9PSAidW5kZWZpbmVkIjsKICAgICAgZnVuY3Rpb24gX2hhcyhvYmosIGtleSkgewogICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwob2JqLCBrZXkpOwogICAgICB9CiAgICAgIGV4cG9ydHMyLmFzc2lnbiA9IGZ1bmN0aW9uKG9iaikgewogICAgICAgIHZhciBzb3VyY2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKTsKICAgICAgICB3aGlsZSAoc291cmNlcy5sZW5ndGgpIHsKICAgICAgICAgIHZhciBzb3VyY2UgPSBzb3VyY2VzLnNoaWZ0KCk7CiAgICAgICAgICBpZiAoIXNvdXJjZSkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0eXBlb2Ygc291cmNlICE9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKHNvdXJjZSArICJtdXN0IGJlIG5vbi1vYmplY3QiKTsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAodmFyIHAgaW4gc291cmNlKSB7CiAgICAgICAgICAgIGlmIChfaGFzKHNvdXJjZSwgcCkpIHsKICAgICAgICAgICAgICBvYmpbcF0gPSBzb3VyY2VbcF07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIG9iajsKICAgICAgfTsKICAgICAgZXhwb3J0czIuc2hyaW5rQnVmID0gZnVuY3Rpb24oYnVmLCBzaXplKSB7CiAgICAgICAgaWYgKGJ1Zi5sZW5ndGggPT09IHNpemUpIHsKICAgICAgICAgIHJldHVybiBidWY7CiAgICAgICAgfQogICAgICAgIGlmIChidWYuc3ViYXJyYXkpIHsKICAgICAgICAgIHJldHVybiBidWYuc3ViYXJyYXkoMCwgc2l6ZSk7CiAgICAgICAgfQogICAgICAgIGJ1Zi5sZW5ndGggPSBzaXplOwogICAgICAgIHJldHVybiBidWY7CiAgICAgIH07CiAgICAgIHZhciBmblR5cGVkID0gewogICAgICAgIGFycmF5U2V0OiBmdW5jdGlvbihkZXN0LCBzcmMsIHNyY19vZmZzLCBsZW4sIGRlc3Rfb2ZmcykgewogICAgICAgICAgaWYgKHNyYy5zdWJhcnJheSAmJiBkZXN0LnN1YmFycmF5KSB7CiAgICAgICAgICAgIGRlc3Quc2V0KHNyYy5zdWJhcnJheShzcmNfb2Zmcywgc3JjX29mZnMgKyBsZW4pLCBkZXN0X29mZnMpOwogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICB9CiAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgICAgIGRlc3RbZGVzdF9vZmZzICsgaV0gPSBzcmNbc3JjX29mZnMgKyBpXTsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIGZsYXR0ZW5DaHVua3M6IGZ1bmN0aW9uKGNodW5rcykgewogICAgICAgICAgdmFyIGksIGwsIGxlbiwgcG9zLCBjaHVuaywgcmVzdWx0OwogICAgICAgICAgbGVuID0gMDsKICAgICAgICAgIGZvciAoaSA9IDAsIGwgPSBjaHVua3MubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgICAgIGxlbiArPSBjaHVua3NbaV0ubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgICAgcmVzdWx0ID0gbmV3IFVpbnQ4QXJyYXkobGVuKTsKICAgICAgICAgIHBvcyA9IDA7CiAgICAgICAgICBmb3IgKGkgPSAwLCBsID0gY2h1bmtzLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICBjaHVuayA9IGNodW5rc1tpXTsKICAgICAgICAgICAgcmVzdWx0LnNldChjaHVuaywgcG9zKTsKICAgICAgICAgICAgcG9zICs9IGNodW5rLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICAgfQogICAgICB9OwogICAgICB2YXIgZm5VbnR5cGVkID0gewogICAgICAgIGFycmF5U2V0OiBmdW5jdGlvbihkZXN0LCBzcmMsIHNyY19vZmZzLCBsZW4sIGRlc3Rfb2ZmcykgewogICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgICBkZXN0W2Rlc3Rfb2ZmcyArIGldID0gc3JjW3NyY19vZmZzICsgaV07CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBmbGF0dGVuQ2h1bmtzOiBmdW5jdGlvbihjaHVua3MpIHsKICAgICAgICAgIHJldHVybiBbXS5jb25jYXQuYXBwbHkoW10sIGNodW5rcyk7CiAgICAgICAgfQogICAgICB9OwogICAgICBleHBvcnRzMi5zZXRUeXBlZCA9IGZ1bmN0aW9uKG9uKSB7CiAgICAgICAgaWYgKG9uKSB7CiAgICAgICAgICBleHBvcnRzMi5CdWY4ID0gVWludDhBcnJheTsKICAgICAgICAgIGV4cG9ydHMyLkJ1ZjE2ID0gVWludDE2QXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5CdWYzMiA9IEludDMyQXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5hc3NpZ24oZXhwb3J0czIsIGZuVHlwZWQpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBleHBvcnRzMi5CdWY4ID0gQXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5CdWYxNiA9IEFycmF5OwogICAgICAgICAgZXhwb3J0czIuQnVmMzIgPSBBcnJheTsKICAgICAgICAgIGV4cG9ydHMyLmFzc2lnbihleHBvcnRzMiwgZm5VbnR5cGVkKTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLnNldFR5cGVkKFRZUEVEX09LKTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL3RyZWVzLmpzCiAgdmFyIHJlcXVpcmVfdHJlZXMgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvdHJlZXMuanMiKGV4cG9ydHMyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICB2YXIgdXRpbHMgPSByZXF1aXJlX2NvbW1vbigpOwogICAgICB2YXIgWl9GSVhFRCA9IDQ7CiAgICAgIHZhciBaX0JJTkFSWSA9IDA7CiAgICAgIHZhciBaX1RFWFQgPSAxOwogICAgICB2YXIgWl9VTktOT1dOID0gMjsKICAgICAgZnVuY3Rpb24gemVybyhidWYpIHsKICAgICAgICB2YXIgbGVuID0gYnVmLmxlbmd0aDsKICAgICAgICB3aGlsZSAoLS1sZW4gPj0gMCkgewogICAgICAgICAgYnVmW2xlbl0gPSAwOwogICAgICAgIH0KICAgICAgfQogICAgICB2YXIgU1RPUkVEX0JMT0NLID0gMDsKICAgIC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J1ZiB8PSB2YWx1ZSA8PCBzLmJpX3ZhbGlkICYgNjU1MzU7CiAgICAgICAgICBzLmJpX3ZhbGlkICs9IGxlbmd0aDsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2VuZF9jb2RlKHMsIGMsIHRyZWUpIHsKICAgICAgICBzZW5kX2JpdHMocywgdHJlZVtjICogMl0sIHRyZWVbYyAqIDIgKyAxXSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYmlfcmV2ZXJzZShjb2RlLCBsZW4pIHsKICAgICAgICB2YXIgcmVzID0gMDsKICAgICAgICBkbyB7CiAgICAgICAgICByZXMgfD0gY29kZSAmIDE7CiAgICAgICAgICBjb2RlID4+Pj0gMTsKICAgICAgICAgIHJlcyA8PD0gMTsKICAgICAgICB9IHdoaWxlICgtLWxlbiA+IDApOwogICAgICAgIHJldHVybiByZXMgPj4+IDE7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYmlfZmx1c2gocykgewogICAgICAgIGlmIChzLmJpX3ZhbGlkID09PSAxNikgewogICAgICAgICAgcHV0X3Nob3J0KHMsIHMuYmlfYnVmKTsKICAgICAgICAgIHMuYmlfYnVmID0gMDsKICAgICAgICAgIHMuYmlfdmFsaWQgPSAwOwogICAgICAgIH0gZWxzZSBpZiAocy5iaV92YWxpZCA+PSA4KSB7CiAgICAgICAgICBzLnBlbmRpbmdfYnVmW3MucGVuZGluZysrXSA9IHMuYmlfYnVmICYgMjU1OwogICAgICAgICAgcy5iaV9idWYgPj49IDg7CiAgICAgICAgICBzLmJpX3ZhbGlkIC09IDg7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGdlbl9iaXRsZW4ocywgZGVzYykgewogICAgICAgIHZhciB0cmVlID0gZGVzYy5keW5fdHJlZTsKICAgICAgICB2YXIgbWF4X2NvZGUgPSBkZXNjLm1heF9jb2RlOwogICAgICAgIHZhciBzdHJlZSA9IGRlc2Muc3RhdF9kZXNjLnN0YXRpY190cmVlOwogICAgICAgIHZhciBoYXNfc3RyZWUgPSBkZXNjLnN0YXRfZGVzYy5oYXNfc3RyZWU7CiAgICAgICAgdmFyIGV4dHJhID0gZGVzYy5zdGF0X2Rlc2MuZXh0cmFfYml0czsKICAgICAgICB2YXIgYmFzZSA9IGRlc2Muc3RhdF9kZXNjLmV4dHJhX2Jhc2U7CiAgICAgICAgdmFyIG1heF9sZW5ndGggPSBkZXNjLnN0YXRfZGVzYy5tYXhfbGVuZ3RoOwogICAgICAgIHZhciBoOwogICAgICAgIHZhciBuLCBtOwogICAgICAgIHZhciBiaXRzOwogICAgICAgIHZhciB4Yml0czsKICAgICAgICB2YXIgZjsKICAgICAgICB2YXIgb3ZlcmZsb3cgPSAwOwogICAgICAgIGZvciAoYml0cyA9IDA7IGJpdHMgPD0gTUFYX0JJVFM7IGJpdHMrKykgewogICAgICAgICAgcy5ibF9jb3VudFtiaXRzXSA9IDA7CiAgICAgICAgfQogICAgICAgIHRyZWVbcy5oZWFwW3MuaGVhcF9tYXhdICogMiArIDFdID0gMDsKICAgICAgICBmb3IgKGggPSBzLmhlYXBfbWF4ICsgMTsgaCA8IEhFQVBfU0laRTsgaCsrKSB7CiAgICAgICAgICBuID0gcy5oZWFwW2hdOwogICAgICAgICAgYml0cyA9IHRyZWVbdHJlZVtuICogMiArIDFdICogMiArIDFdICsgMTsKICAgICAgICAgIGlmIChiaXRzID4gbWF4X2xlbmd0aCkgewogICAgICAgICAgICBiaXRzID0gbWF4X2xlbmd0aDsKICAgICAgICAgICAgb3ZlcmZsb3crKzsKICAgICAgICAgIH0KICAgICAgICAgIHRyZWVbbiAqIDIgKyAxXSA9IGJpdHM7CiAgICAgICAgICBpZiAobiA+IG1heF9jb2RlKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgcy5ibF9jb3VudFtiaXRzXSsrOwogICAgICAgICAgeGJpdHMgPSAwOwogICAgICAgICAgaWYgKG4gPj0gYmFzZSkgewogICAgICAgICAgICB4Yml0cyA9IGV4dHJhW24gLSBiYXNlXTsKICAgICAgICAgIH0KICAgICAgICAgIGYgPSB0cmVlW24gKiAyXTsKICAgICAgICAgIHMub3B0X2xlbiArPSBmICogKGJpdHMgKyB4Yml0cyk7CiAgICAgICAgICBpZiAoaGFzX3N0cmVlKSB7CiAgICAgICAgICAgIHMuc3RhdGljX2xlbiArPSBmICogKHN0cmVlW24gKiAyICsgMV0gKyB4Yml0cyk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChvdmVyZmxvdyA9PT0gMCkgewogICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICBkbyB7CiAgICAgICAgICBiaXRzID0gbWF4X2xlbmd0aCAtIDE7CiAgICAgICAgICB3aGlsZSAocy5ibF9jb3VudFtiaXRzXSA9PT0gMCkgewogICAgICAgICAgICBiaXRzLS07CiAgICAgICAgICB9CiAgICAgICAgICBzLmJsX2NvdW50W2JpdHNdLS07CiAgICAgICAgICBzLmJsX2NvdW50W2JpdHMgKyAxXSArPSAyOwogICAgICAgICAgcy5ibF9jb3VudFttYXhfbGVuZ3RoXS0tOwogICAgICAgICAgb3ZlcmZsb3cgLT0gMjsKICAgICAgICB9IHdoaWxlIChvdmVyZmxvdyA+IDApOwogICAgICAgIGZvciAoYml0cyA9IG1heF9sZW5ndGg7IGJpdHMgIT09IDA7IGJpdHMtLSkgewogICAgICAgICAgbiA9IHMuYmxfY291bnRbYml0c107CiAgICAgICAgICB3aGlsZSAobiAhPT0gMCkgewogICAgICAgICAgICBtID0gcy5oZWFwWy0taF07CiAgICAgICAgICAgIGlmIChtID4gbWF4X2NvZGUpIHsKICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodHJlZVttICogMiArIDFdICE9PSBiaXRzKSB7CiAgICAgICAgICAgICAgcy5vcHRfbGVuICs9IChiaXRzIC0gdHJlZVttICogMiArIDFdKSAqIHRyZWVbbSAqIDJdOwogICAgICAgICAgICAgIHRyZWVbbSAqIDIgKyAxXSA9IGJpdHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbi0tOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBnZW5fY29kZXModHJlZSwgbWF4X2NvZGUsIGJsX2NvdW50KSB7CiAgICAgICAgdmFyIG5leHRfY29kZSA9IG5ldyBBcnJheShNQVhfQklUUyArIDEpOwogICAgICAgIHZhciBjb2RlID0gMDsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgbjsKICAgICAgICBmb3IgKGJpdHMgPSAxOyBiaXRzIDw9IE1BWF9CSVRTOyBiaXRzKyspIHsKICAgICAgICAgIG5leHRfY29kZVtiaXRzXSA9IGNvZGUgPSBjb2RlICsgYmxfY291bnRbYml0cyAtIDFdIDw8IDE7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDA7IG4gPD0gbWF4X2NvZGU7IG4rKykgewogICAgICAgICAgdmFyIGxlbiA9IHRyZWVbbiAqIDIgKyAxXTsKICAgICAgICAgIGlmIChsZW4gPT09IDApIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICB0cmVlW24gKiAyXSA9IGJpX3JldmVyc2UobmV4dF9jb2RlW2xlbl0rKywgbGVuKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdHJfc3RhdGljX2luaXQoKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIGJpdHM7CiAgICAgICAgdmFyIGxlbmd0aDsKICAgICAgICB2YXIgY29kZTsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgYmxfY291bnQgPSBuZXcgQXJyYXkoTUFYX0JJVFMgKyAxKTsKICAgICAgICBsZW5ndGggPSAwOwogICAgICAgIGZvciAoY29kZSA9IDA7IGNvZGUgPCBMRU5HVEhfQ09ERVMgLSAxOyBjb2RlKyspIHsKICAgICAgICAgIGJhc2VfbGVuZ3RoW2NvZGVdID0gbGVuZ3RoOwogICAgICAgICAgZm9yIChuID0gMDsgbiA8IDEgPDwgZXh0cmFfbGJpdHNbY29kZV07IG4rKykgewogICAgICAgICAgICBfbGVuZ3RoX2NvZGVbbGVuZ3RoKytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgX2xlbmd0aF9jb2RlW2xlbmd0aCAtIDFdID0gY29kZTsKICAgICAgICBkaXN0ID0gMDsKICAgICAgICBmb3IgKGNvZGUgPSAwOyBjb2RlIDwgMTY7IGNvZGUrKykgewogICAgICAgICAgYmFzZV9kaXN0W2NvZGVdID0gZGlzdDsKICAgICAgICAgIGZvciAobiA9IDA7IG4gPCAxIDw8IGV4dHJhX2RiaXRzW2NvZGVdOyBuKyspIHsKICAgICAgICAgICAgX2Rpc3RfY29kZVtkaXN0KytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZGlzdCA+Pj0gNzsKICAgICAgICBmb3IgKDsgY29kZSA8IERfQ09ERVM7IGNvZGUrKykgewogICAgICAgICAgYmFzZV9kaXN0W2NvZGVdID0gZGlzdCA8PCA3OwogICAgICAgICAgZm9yIChuID0gMDsgbiA8IDEgPDwgZXh0cmFfZGJpdHNbY29kZV0gLSA3OyBuKyspIHsKICAgICAgICAgICAgX2Rpc3RfY29kZVsyNTYgKyBkaXN0KytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZm9yIChiaXRzID0gMDsgYml0cyA8PSBNQVhfQklUUzsgYml0cysrKSB7CiAgICAgICAgICBibF9jb3VudFtiaXRzXSA9IDA7CiAgICAgICAgfQogICAgICAgIG4gPSAwOwogICAgICAgIHdoaWxlIChuIDw9IDE0MykgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA4OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbOF0rKzsKICAgICAgICB9CiAgICAgICAgd2hpbGUgKG4gPD0gMjU1KSB7CiAgICAgICAgICBzdGF0aWNfbHRyZWVbbiAqIDIgKyAxXSA9IDk7CiAgICAgICAgICBuKys7CiAgICAgICAgICBibF9jb3VudFs5XSsrOwogICAgICAgIH0KICAgICAgICB3aGlsZSAobiA8PSAyNzkpIHsKICAgICAgICAgIHN0YXRpY19sdHJlZVtuICogMiArIDFdID0gNzsKICAgICAgICAgIG4rKzsKICAgICAgICAgIGJsX2NvdW50WzddKys7CiAgICAgICAgfQogICAgICAgIHdoaWxlIChuIDw9IDI4NykgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA4OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbOF0rKzsKICAgICAgICB9CiAgICAgICAgZ2VuX2NvZGVzKHN0YXRpY19sdHJlZSwgTF9DT0RFUyArIDEsIGJsX2NvdW50KTsKICAgICAgICBmb3IgKG4gPSAwOyBuIDwgRF9DT0RFUzsgbisrKSB7CiAgICAgICAgICBzdGF0aWNfZHRyZWVbbiAqIDIgKyAxXSA9IDU7CiAgICAgICAgICBzdGF0aWNfZHRyZWVbbiAqIDJdID0gYmlfcmV2ZXJzZShuLCA1KTsKICAgICAgICB9CiAgICAgICAgc3RhdGljX2xfZGVzYyA9IG5ldyBTdGF0aWNUcmVlRGVzYyhzdGF0aWNfbHRyZWUsIGV4dHJhX2xiaXRzLCBMSVRFUkFMUyArIDEsIExfQ09ERVMsIE1BWF9CSVRTKTsKICAgICAgICBzdGF0aWNfZF9kZXNjID0gbmV3IFN0YXRpY1RyZWVEZXNjKHN0YXRpY19kdHJlZSwgZXh0cmFfZGJpdHMsIDAsIERfQ09ERVMsIE1BWF9CSVRTKTsKICAgICAgICBzdGF0aWNfYmxfZGVzYyA9IG5ldyBTdGF0aWNUcmVlRGVzYyhuZXcgQXJyYXkoMCksIGV4dHJhX2JsYml0cywgMCwgQkxfQ09ERVMsIE1BWF9CTF9CSVRTKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbml0X2Jsb2NrKHMpIHsKICAgICAgICB2YXIgbjsKICAgICAgICBmb3IgKG4gPSAwOyBuIDwgTF9DT0RFUzsgbisrKSB7CiAgICAgICAgICBzLmR5bl9sdHJlZVtuICogMl0gPSAwOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAwOyBuIDwgRF9DT0RFUzsgbisrKSB7CiAgICAgICAgICBzLmR5bl9kdHJlZVtuICogMl0gPSAwOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAwOyBuIDwgQkxfQ09ERVM7IG4rKykgewogICAgICAgICAgcy5ibF90cmVlW24gKiAyXSA9IDA7CiAgICAgICAgfQogICAgICAgIHMuZHluX2x0cmVlW0VORF9CTE9DSyAqIDJdID0gMTsKICAgICAgICBzLm9wdF9sZW4gPSBzLnN0YXRpY19sZW4gPSAwOwogICAgICAgIHMubGFzdF9saXQgPSBzLm1hdGNoZXMgPSAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJpX3dpbmR1cChzKSB7CiAgICAgICAgaWYgKHMuYmlfdmFsaWQgPiA4KSB7CiAgICAgICAgICBwdXRfc2hvcnQocywgcy5iaV9idWYpOwogICAgICAgIH0gZWxzZSBpZiAocy5iaV92YWxpZCA+IDApIHsKICAgICAgICAgIHMucGVuZGluZ19idWZbcy5wZW5kaW5nKytdID0gcy5iaV9idWY7CiAgICAgICAgfQogICAgICAgIHMuYmlfYnVmID0gMDsKICAgICAgICBzLmJpX3ZhbGlkID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBjb3B5X2Jsb2NrKHMsIGJ1ZiwgbGVuLCBoZWFkZXIpIHsKICAgICAgICBiaV93aW5kdXAocyk7CiAgICAgICAgaWYgKGhlYWRlcikgewogICAgICAgICAgcHV0X3Nob3J0KHMsIGxlbik7CiAgICAgICAgICBwdXRfc2hvcnQocywgfmxlbik7CiAgICAgICAgfQogICAgICAgIHV0aWxzLmFycmF5U2V0KHMucGVuZGluZ19idWYsIHMud2luZG93LCBidWYsIGxlbiwgcy5wZW5kaW5nKTsKICAgICAgICBzLnBlbmRpbmcgKz0gbGVuOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNtYWxsZXIodHJlZSwgbiwgbSwgZGVwdGgpIHsKICAgICAgICB2YXIgX24yID0gbiAqIDI7CiAgICAgICAgdmFyIF9tMiA9IG0gKiAyOwogICAgICAgIHJldHVybiB0cmVlW19uMl0gPCB0cmVlW19tMl0gfHwgdHJlZVtfbjJdID09PSB0cmVlW19tMl0gJiYgZGVwdGhbbl0gPD0gZGVwdGhbbV07CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcHFkb3duaGVhcChzLCB0cmVlLCBrKSB7CiAgICAgICAgdmFyIHYgPSBzLmhlYXBba107CiAgICAgICAgdmFyIGogPSBrIDw8IDE7CiAgICAgICAgd2hpbGUgKGogPD0gcy5oZWFwX2xlbikgewogICAgICAgICAgaWYgKGogPCBzLmhlYXBfbGVuICYmIHNtYWxsZXIodHJlZSwgcy5oZWFwW2ogKyAxXSwgcy5oZWFwW2pdLCBzLmRlcHRoKSkgewogICAgICAgICAgICBqKys7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc21hbGxlcih0cmVlLCB2LCBzLmhlYXBbal0sIHMuZGVwdGgpKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgcy5oZWFwW2tdID0gcy5oZWFwW2pdOwogICAgICAgICAgayA9IGo7CiAgICAgICAgICBqIDw8PSAxOwogICAgICAgIH0KICAgICAgICBzLmhlYXBba10gPSB2OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGNvbXByZXNzX2Jsb2NrKHMsIGx0cmVlLCBkdHJlZSkgewogICAgICAgIHZhciBkaXN0OwogICAgICAgIHZhciBsYzsKICAgICAgICB2YXIgbHggPSAwOwogICAgICAgIHZhciBjb2RlOwogICAgICAgIHZhciBleHRyYTsKICAgICAgICBpZiAocy5sYXN0X2xpdCAhPT0gMCkgewogICAgICAgICAgZG8gewogICAgICAgICAgICBkaXN0ID0gcy5wZW5kaW5nX2J1ZltzLmRfYnVmICsgbHggKiAyXSA8PCA4IHwgcy5wZW5kaW5nX2J1ZltzLmRfYnVmICsgbHggKiAyICsgMV07CiAgICAgICAgICAgIGxjID0gcy5wZW5kaW5nX2J1ZltzLmxfYnVmICsgbHhdOwogICAgICAgICAgICBseCsrOwogICAgICAgICAgICBpZiAoZGlzdCA9PT0gMCkgewogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBsYywgbHRyZWUpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGNvZGUgPSBfbGVuZ3RoX2NvZGVbbGNdOwogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjb2RlICsgTElURVJBTFMgKyAxLCBsdHJlZSk7CiAgICAgICAgICAgICAgZXh0cmEgPSBleHRyYV9sYml0c1tjb2RlXTsKICAgICAgICAgICAgICBpZiAoZXh0cmEgIT09IDApIHsKICAgICAgICAgICAgICAgIGxjIC09IGJhc2VfbGVuZ3RoW2NvZGVdOwogICAgICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGxjLCBleHRyYSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGRpc3QtLTsKICAgICAgICAgICAgICBjb2RlID0gZF9jb2RlKGRpc3QpOwogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjb2RlLCBkdHJlZSk7CiAgICAgICAgICAgICAgZXh0cmEgPSBleHRyYV9kYml0c1tjb2RlXTsKICAgICAgICAgICAgICBpZiAoZXh0cmEgIT09IDApIHsKICAgICAgICAgICAgICAgIGRpc3QgLT0gYmFzZV9kaXN0W2NvZGVdOwogICAgICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGRpc3QsIGV4dHJhKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gd2hpbGUgKGx4IDwgcy5sYXN0X2xpdCk7CiAgICAgICAgfQogICAgICAgIHNlbmRfY29kZShzLCBFTkRfQkxPQ0ssIGx0cmVlKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBidWlsZF90cmVlKHMsIGRlc2MpIHsKICAgICAgICB2YXIgdHJlZSA9IGRlc2MuZHluX3RyZWU7CiAgICAgICAgdmFyIHN0cmVlID0gZGVzYy5zdGF0X2Rlc2Muc3RhdGljX3RyZWU7CiAgICAgICAgdmFyIGhhc19zdHJlZSA9IGRlc2Muc3RhdF9kZXNjLmhhc19zdHJlZTsKICAgICAgICB2YXIgZWxlbXMgPSBkZXNjLnN0YXRfZGVzYy5lbGVtczsKICAgICAgICB2YXIgbiwgbTsKICAgICAgICB2YXIgbWF4X2NvZGUgPSAtMTsKICAgICAgICB2YXIgbm9kZTsKICAgICAgICBzLmhlYXBfbGVuID0gMDsKICAgICAgICBzLmhlYXBfbWF4ID0gSEVBUF9TSVpFOwogICAgICAgIGZvciAobiA9IDA7IG4gPCBlbGVtczsgbisrKSB7CiAgICAgICAgICBpZiAodHJlZVtuICogMl0gIT09IDApIHsKICAgICAgICAgICAgcy5oZWFwWysrcy5oZWFwX2xlbl0gPSBtYXhfY29kZSA9IG47CiAgICAgICAgICAgIHMuZGVwdGhbbl0gPSAwOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdHJlZVtuICogMiArIDFdID0gMDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgd2hpbGUgKHMuaGVhcF9sZW4gPCAyKSB7CiAgICAgICAgICBub2RlID0gcy5oZWFwWysrcy5oZWFwX2xlbl0gPSBtYXhfY29kZSA8IDIgPyArK21heF9jb2RlIDogMDsKICAgICAgICAgIHRyZWVbbm9kZSAqIDJdID0gMTsKICAgICAgICAgIHMuZGVwdGhbbm9kZV0gPSAwOwogICAgICAgICAgcy5vcHRfbGVuLS07CiAgICAgICAgICBpZiAoaGFzX3N0cmVlKSB7CiAgICAgICAgICAgIHMuc3RhdGljX2xlbiAtPSBzdHJlZVtub2RlICogMiArIDFdOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkZXNjLm1heF9jb2RlID0gbWF4X2NvZGU7CiAgICAgICAgZm9yIChuID0gcy5oZWFwX2xlbiA+PiAxOyBuID49IDE7IG4tLSkgewogICAgICAgICAgcHFkb3duaGVhcChzLCB0cmVlLCBuKTsKICAgICAgICB9CiAgICAgICAgbm9kZSA9IGVsZW1zOwogICAgICAgIGRvIHsKICAgICAgICAgIG4gPSBzLmhlYXBbMV07CiAgICAgICAgICBzLmhlYXBbMV0gPSBzLmhlYXBbcy5oZWFwX2xlbi0tXTsKICAgICAgICAgIHBxZG93bmhlYXAocywgdHJlZSwgMSk7CiAgICAgICAgICBtID0gcy5oZWFwWzFdOwogICAgICAgICAgcy5oZWFwWy0tcy5oZWFwX21heF0gPSBuOwogICAgICAgICAgcy5oZWFwWy0tcy5oZWFwX21heF0gPSBtOwogICAgICAgICAgdHJlZVtub2RlICogMl0gPSB0cmVlW24gKiAyXSArIHRyZWVbbSAqIDJdOwogICAgICAgICAgcy5kZXB0aFtub2RlXSA9IChzLmRlcHRoW25dID49IHMuZGVwdGhbbV0gPyBzLmRlcHRoW25dIDogcy5kZXB0aFttXSkgKyAxOwogICAgICAgICAgdHJlZVtuICogMiArIDFdID0gdHJlZVttICogMiArIDFdID0gbm9kZTsKICAgICAgICAgIHMuaGVhcFsxXSA9IG5vZGUrKzsKICAgICAgICAgIHBxZG93bmhlYXAocywgdHJlZSwgMSk7CiAgICAgICAgfSB3aGlsZSAocy5oZWFwX2xlbiA+PSAyKTsKICAgICAgICBzLmhlYXBbLS1zLmhlYXBfbWF4XSA9IHMuaGVhcFsxXTsKICAgICAgICBnZW5fYml0bGVuKHMsIGRlc2MpOwogICAgICAgIGdlbl9jb2Rlcyh0cmVlLCBtYXhfY29kZSwgcy5ibF9jb3VudCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2Nhbl90cmVlKHMsIHRyZWUsIG1heF9jb2RlKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIHByZXZsZW4gPSAtMTsKICAgICAgICB2YXIgY3VybGVuOwogICAgICAgIHZhciBuZXh0bGVuID0gdHJlZVswICogMiArIDFdOwogICAgICAgIHZhciBjb3VudCA9IDA7CiAgICAgICAgdmFyIG1heF9jb3VudCA9IDc7CiAgICAgICAgdmFyIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgIG1heF9jb3VudCA9IDEzODsKICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgfQogICAgICAgIHRyZWVbKG1heF9jb2RlICsgMSkgKiAyICsgMV0gPSA2NTUzNTsKICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IG1heF9jb2RlOyBuKyspIHsKICAgICAgICAgIGN1cmxlbiA9IG5leHRsZW47CiAgICAgICAgICBuZXh0bGVuID0gdHJlZVsobiArIDEpICogMiArIDFdOwogICAgICAgICAgaWYgKCsrY291bnQgPCBtYXhfY291bnQgJiYgY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkgewogICAgICAgICAgICBzLmJsX3RyZWVbY3VybGVuICogMl0gKz0gY291bnQ7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiAhPT0gMCkgewogICAgICAgICAgICBpZiAoY3VybGVuICE9PSBwcmV2bGVuKSB7CiAgICAgICAgICAgICAgcy5ibF90cmVlW2N1cmxlbiAqIDJdKys7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcy5ibF90cmVlW1JFUF8zXzYgKiAyXSsrOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkgewogICAgICAgICAgICBzLmJsX3RyZWVbUkVQWl8zXzEwICogMl0rKzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuYmxfdHJlZVtSRVBaXzExXzEzOCAqIDJdKys7CiAgICAgICAgICB9CiAgICAgICAgICBjb3VudCA9IDA7CiAgICAgICAgICBwcmV2bGVuID0gY3VybGVuOwogICAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gMTM4OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIGlmIChjdXJsZW4gPT09IG5leHRsZW4pIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNjsKICAgICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDc7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNlbmRfdHJlZShzLCB0cmVlLCBtYXhfY29kZSkgewogICAgICAgIHZhciBuOwogICAgICAgIHZhciBwcmV2bGVuID0gLTE7CiAgICAgICAgdmFyIGN1cmxlbjsKICAgICAgICB2YXIgbmV4dGxlbiA9IHRyZWVbMCAqIDIgKyAxXTsKICAgICAgICB2YXIgY291bnQgPSAwOwogICAgICAgIHZhciBtYXhfY291bnQgPSA3OwogICAgICAgIHZhciBtaW5fY291bnQgPSA0OwogICAgICAgIGlmIChuZXh0bGVuID09PSAwKSB7CiAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IG1heF9jb2RlOyBuKyspIHsKICAgICAgICAgIGN1cmxlbiA9IG5leHRsZW47CiAgICAgICAgICBuZXh0bGVuID0gdHJlZVsobiArIDEpICogMiArIDFdOwogICAgICAgICAgaWYgKCsrY291bnQgPCBtYXhfY291bnQgJiYgY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkgewogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGN1cmxlbiwgcy5ibF90cmVlKTsKICAgICAgICAgICAgfSB3aGlsZSAoLS1jb3VudCAhPT0gMCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiAhPT0gMCkgewogICAgICAgICAgICBpZiAoY3VybGVuICE9PSBwcmV2bGVuKSB7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGN1cmxlbiwgcy5ibF90cmVlKTsKICAgICAgICAgICAgICBjb3VudC0tOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNlbmRfY29kZShzLCBSRVBfM182LCBzLmJsX3RyZWUpOwogICAgICAgICAgICBzZW5kX2JpdHMocywgY291bnQgLSAzLCAyKTsKICAgICAgICAgIH0gZWxzZSBpZiAoY291bnQgPD0gMTApIHsKICAgICAgICAgICAgc2VuZF9jb2RlKHMsIFJFUFpfM18xMCwgcy5ibF90cmVlKTsKICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGNvdW50IC0gMywgMyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzZW5kX2NvZGUocywgUkVQWl8xMV8xMzgsIHMuYmxfdHJlZSk7CiAgICAgICAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDExLCA3KTsKICAgICAgICAgIH0KICAgICAgICAgIGNvdW50ID0gMDsKICAgICAgICAgIHByZXZsZW4gPSBjdXJsZW47CiAgICAgICAgICBpZiAobmV4dGxlbiA9PT0gMCkgewogICAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiA9PT0gbmV4dGxlbikgewogICAgICAgICAgICBtYXhfY291bnQgPSA2OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNzsKICAgICAgICAgICAgbWluX2NvdW50ID0gNDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYnVpbGRfYmxfdHJlZShzKSB7CiAgICAgICAgdmFyIG1heF9ibGluZGV4OwogICAgICAgIHNjYW5fdHJlZShzLCBzLmR5bl9sdHJlZSwgcy5sX2Rlc2MubWF4X2NvZGUpOwogICAgICAgIHNjYW5fdHJlZShzLCBzLmR5bl9kdHJlZSwgcy5kX2Rlc2MubWF4X2NvZGUpOwogICAgICAgIGJ1aWxkX3RyZWUocywgcy5ibF9kZXNjKTsKICAgICAgICBmb3IgKG1heF9ibGluZGV4ID0gQkxfQ09ERVMgLSAxOyBtYXhfYmxpbmRleCA+PSAzOyBtYXhfYmxpbmRleC0tKSB7CiAgICAgICAgICBpZiAocy5ibF90cmVlW2JsX29yZGVyW21heF9ibGluZGV4XSAqIDIgKyAxXSAhPT0gMCkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5vcHRfbGVuICs9IDMgKiAobWF4X2JsaW5kZXggKyAxKSArIDUgKyA1ICsgNDsKICAgICAgICByZXR1cm4gbWF4X2JsaW5kZXg7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2VuZF9hbGxfdHJlZXMocywgbGNvZGVzLCBkY29kZXMsIGJsY29kZXMpIHsKICAgICAgICB2YXIgcmFuazsKICAgICAgICBzZW5kX2JpdHMocywgbGNvZGVzIC0gMjU3LCA1KTsKICAgICAgICBzZW5kX2JpdHMocywgZGNvZGVzIC0gMSwgNSk7CiAgICAgICAgc2VuZF9iaXRzKHMsIGJsY29kZXMgLSA0LCA0KTsKICAgICAgICBmb3IgKHJhbmsgPSAwOyByYW5rIDwgYmxjb2RlczsgcmFuaysrKSB7CiAgICAgICAgICBzZW5kX2JpdHMocywgcy5ibF90cmVlW2JsX29yZGVyW3JhbmtdICogMiArIDFdLCAzKTsKICAgICAgICB9CiAgICAgICAgc2VuZF90cmVlKHMsIHMuZHluX2x0cmVlLCBsY29kZXMgLSAxKTsKICAgICAgICBzZW5kX3RyZWUocywgcy5keW5fZHRyZWUsIGRjb2RlcyAtIDEpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRldGVjdF9kYXRhX3R5cGUocykgewogICAgICAgIHZhciBibGFja19tYXNrID0gNDA5MzYyNDQ0NzsKICAgICAgICB2YXIgbjsKICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IDMxOyBuKyssIGJsYWNrX21hc2sgPj4+PSAxKSB7CiAgICAgICAgICBpZiAoYmxhY2tfbWFzayAmIDEgJiYgcy5keW5fbHRyZWVbbiAqIDJdICE9PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBaX0JJTkFSWTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuZHluX2x0cmVlWzkgKiAyXSAhPT0gMCB8fCBzLmR5bl9sdHJlZVsxMCAqIDJdICE9PSAwIHx8IHMuZHluX2x0cmVlWzEzICogMl0gIT09IDApIHsKICAgICAgICAgIHJldHVybiBaX1RFWFQ7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDMyOyBuIDwgTElURVJBTFM7IG4rKykgewogICAgICAgICAgaWYgKHMuZHluX2x0cmVlW24gKiAyXSAhPT0gMCkgewogICAgICAgICAgICByZXR1cm4gWl9URVhUOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gWl9CSU5BUlk7CiAgICAgIH0KICAgICAgdmFyIHN0YXRpY19pbml0X2RvbmUgPSBmYWxzZTsKICAgICAgZnVuY3Rpb24gX3RyX2luaXQocykgewogICAgICAgIGlmICghc3RhdGljX2luaXRfZG9uZSkgewogICAgICAgICAgdHJfc3RhdGljX2luaXQoKTsKICAgICAgICAgIHN0YXRpY19pbml0X2RvbmUgPSB0cnVlOwogICAgICAgIH0KICAgICAgICBzLmxfZGVzYyA9IG5ldyBUcmVlRGVzYyhzLmR5bl9sdHJlZSwgc3RhdGljX2xfZGVzYyk7CiAgICAgICAgcy5kX2Rlc2MgPSBuZXcgVHJlZ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AgICBpbml0X2Jsb2NrKHMpOwogICAgICAgIGlmIChsYXN0KSB7CiAgICAgICAgICBiaV93aW5kdXAocyk7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIF90cl90YWxseShzLCBkaXN0LCBsYykgewogICAgICAgIHMucGVuZGluZ19idWZbcy5kX2J1ZiArIHMubGFzdF9saXQgKiAyXSA9IGRpc3QgPj4+IDggJiAyNTU7CiAgICAgICAgcy5wZW5kaW5nX2J1ZltzLmRfYnVmICsgcy5sYXN0X2xpdCAqIDIgKyAxXSA9IGRpc3QgJiAyNTU7CiAgICAgICAgcy5wZW5kaW5nX2J1ZltzLmxfYnVmICsgcy5sYXN0X2xpdF0gPSBsYyAmIDI1NTsKICAgICAgICBzLmxhc3RfbGl0Kys7CiAgICAgICAgaWYgKGRpc3QgPT09IDApIHsKICAgICAgICAgIHMuZHluX2x0cmVlW2xjICogMl0rKzsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgcy5tYXRjaGVzKys7CiAgICAgICAgICBkaXN0LS07CiAgICAgICAgICBzLmR5bl9sdHJlZVsoX2xlbmd0aF9jb2RlW2xjXSArIExJVEVSQUxTICsgMSkgKiAyXSsrOwogICAgICAgICAgcy5keW5fZHRyZWVbZF9jb2RlKGRpc3QpICogMl0rKzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHMubGFzdF9saXQgPT09IHMubGl0X2J1ZnNpemUgLSAxOwogICAgICB9CiAgICAgIGV4cG9ydHMyLl90cl9pbml0ID0gX3RyX2luaXQ7CiAgICAgIGV4cG9ydHMyLl90cl9zdG9yZWRfYmxvY2sgPSBfdHJfc3RvcmVkX2Jsb2NrOwogICAgICBleHBvcnRzMi5fdHJfZmx1c2hfYmxvY2sgPSBfdHJfZmx1c2hfYmxvY2s7CiAgICAgIGV4cG9ydHMyLl90cl90YWxseSA9IF90cl90YWxseTsKICAgICAgZXhwb3J0czIuX3RyX2FsaWduID0gX3RyX2FsaWduOwogICAgfQogIH0pOwoKIC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tvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9jcmMzMi5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIGZ1bmN0aW9uIG1ha2VUYWJsZSgpIHsKICAgICAgICB2YXIgYywgdGFibGUgPSBbXTsKICAgICAgICBmb3IgKHZhciBuID0gMDsgbiA8IDI1NjsgbisrKSB7CiAgICAgICAgICBjID0gbjsKICAgICAgICAgIGZvciAodmFyIGsgPSAwOyBrIDwgODsgaysrKSB7CiAgICAgICAgICAgIGMgPSBjICYgMSA/IDM5ODgyOTIzODQgXiBjID4+PiAxIDogYyA+Pj4gMTsKICAgICAgICAgIH0KICAgICAgICAgIHRhYmxlW25dID0gYzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRhYmxlOwogICAgICB9CiAgICAgIHZhciBjcmNUYWJsZSA9IG1ha2VUYWJsZSgpOwogICAgICBmdW5jdGlvbiBjcmMzMihjcmMsIGJ1ZiwgbGVuLCBwb3MpIHsKICAgICAgICB2YXIgdCA9IGNyY1RhYmxlLCBlbmQgPSBwb3MgKyBsZW47CiAgICAgICAgY3JjIF49IC0xOwogICAgICAgIGZvciAodmFyIGkgPSBwb3M7IGkgPCBlbmQ7IGkrKykgewogICAgICAgICAgY3JjID0gY3JjID4+PiA4IF4gdFsoY3JjIF4gYnVmW2ldKSAmIDI1NV07CiAgICAgICAgfQogICAgICAgIHJldHVybiBjcmMgXiAtMTsKICAgICAgfQogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBjcmMzMjsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL21lc3NhZ2VzLmpzCiAgdmFyIHJlcXVpcmVfbWVzc2FnZXMgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvbWVzc2FnZXMuanMiKGV4cG9ydHMyLCBtb2R1bGUyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSB7CiAgICAgICAgMjogIm5lZWQgZGljdGlvbmFyeSIsCiAgICAgICAgMTogInN0cmVhbSBlbmQiLAogICAgICAgIDA6ICIiLAogICAgICAgICItMSI6ICJmaWxlIGVycm9yIiwKICAgICAgICAiLTIiOiAic3RyZWFtIGVycm9yIiwKICAgICAgICAiLTMiOiAiZGF0YSBlcnJvciIsCiAgICAgICAgIi00IjogImluc3VmZmljaWVudCBtZW1vcnkiLAogICAgICAgICItNSI6ICJidWZmZXIgZXJyb3IiLAogICAgICAgICItNiI6ICJpbmNvbXBhdGlibGUgdmVyc2lvbiIKICAgICAgfTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2RlZmxhdGUuanMKICB2YXIgcmVxdWlyZV9kZWZsYXRlID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2RlZmxhdGUuanMiKGV4cG9ydHMyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICB2YXIgdXRpbHMgPSByZXF1aXJlX2NvbW1vbigpOwogICAgICB2YXIgdHJlZXMgPSByZXF1aXJlX3RyZWVzKCk7CiAgICAgIHZhciBhZGxlcjMyID0gcmVxdWlyZV9hZGxlcjMyKCk7CiAgICAgIHZhciBjcmMzMiA9IHJlcXVpcmVfY3JjMzIoKTsKICAgICAgdmFyIG1zZyA9IHJlc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AgICAgIHZhciBNQVhfTUFUQ0ggPSAyNTg7CiAgICAgIHZhciBNSU5fTE9PS0FIRUFEID0gTUFYX01BVENIICsgTUlOX01BVENIICsgMTsKICAgICAgdmFyIFBSRVNFVF9ESUNUID0gMzI7CiAgICAgIHZhciBJTklUX1NUQVRFID0gNDI7CiAgICAgIHZhciBFWFRSQV9TVEFURSA9IDY5OwogICAgICB2YXIgTkFNRV9TVEFURSA9IDczOwogICAgICB2YXIgQ09NTUVOVF9TVEFURSA9IDkxOwogICAgICB2YXIgSENSQ19TVEFURSA9IDEwMzsKICAgICAgdmFyIEJVU1lfU1RBVEUgPSAxMTM7CiAgICAgIHZhciBGSU5JU0hfU1RBVEUgPSA2NjY7CiAgICAgIHZhciBCU19ORUVEX01PUkUgPSAxOwogICAgICB2YXIgQlNfQkxPQ0tfRE9ORSA9IDI7CiAgICAgIHZhciBCU19GSU5JU0hfU1RBUlRFRCA9IDM7CiAgICAgIHZhciBCU19GSU5JU0hfRE9ORSA9IDQ7CiAgICAgIHZhciBPU19DT0RFID0gMzsKICAgICAgZnVuY3Rpb24gZXJyKHN0cm0sIGVycm9yQ29kZSkgewogICAgICAgIHN0cm0ubXNnID0gbXNnW2Vycm9yQ29kZV07CiAgICAgICAgcmV0dXJuIGVycm9yQ29kZTsKICAgICAgfQogICAgICBmdW5jdGlvbiByYW5rKGYpIHsKICAgICAgICByZXR1cm4gKGYgPDwgMSkgLSAoZiA+IDQgPyA5IDogMCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gemVybyhidWYpIHsKICAgICAgICB2YXIgbGVuID0gYnVmLmxlbmd0aDsKICAgICAgICB3aGlsZSAoLS1sZW4gPj0gMCkgewogICAgICAgICAgYnVmW2xlbl0gPSAwOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBmbHVzaF9wZW5kaW5nKHN0cm0pIHsKICAgICAgICB2YXIgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgdmFyIGxlbiA9IHMucGVuZG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sKICAgICAgICB2YXIgbmljZV9tYXRjaCA9IHMubmljZV9tYXRjaDsKICAgICAgICB2YXIgbGltaXQgPSBzLnN0cnN0YXJ0ID4gcy53X3NpemUgLSBNSU5fTE9PS0FIRUFEID8gcy5zdHJzdGFydCAtIChzLndfc2l6ZSAtIE1JTl9MT09LQUhFQUQpIDogMDsKICAgICAgICB2YXIgX3dpbiA9IHMud2luZG93OwogICAgICAgIHZhciB3bWFzayA9IHMud19tYXNrOwogICAgICAgIHZhciBwcmV2ID0gcy5wcmV2OwogICAgICAgIHZhciBzdHJlbmQgPSBzLnN0cnN0YXJ0ICsgTUFYX01BVENIOwogICAgICAgIHZhciBzY2FuX2VuZDEgPSBfd2luW3NjYW4gKyBiZXN0X2xlbiAtIDFdOwogICAgICAgIHZhciBzY2FuX2VuZCA9IF93aW5bc2NhbiArIGJlc3RfbGVuXTsKICAgICAgICBpZiAocy5wcmV2X2xlbmd0aCA+PSBzLmdvb2RfbWF0Y2gpIHsKICAgICAgICAgIGNoYWluX2xlbmd0aCA+Pj0gMjsKICAgICAgICB9CiAgICAgICAgaWYgKG5pY2VfbWF0Y2ggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgbmljZV9tYXRjaCA9IHMubG9va2FoZWFkOwogICAgICAgIH0KICAgICAgICBkbyB7CiAgICAgICAgICBtYXRjaCA9IGN1cl9tYXRjaDsKICAgICAgICAgIGlmIChfd2luW21hdGNoICsgYmVzdF9sZW5dICE9PSBzY2FuX2VuZCB8fCBfd2luW21hdGNoICsgYmVzdF9sZW4gLSAxXSAhPT0gc2Nhbl9lbmQxIHx8IF93aW5bbWF0Y2hdICE9PSBfd2luW3NjYW5dIHx8IF93aW5bKyttYXRjaF0gIT09IF93aW5bc2NhbiArIDFdKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgc2NhbiArPSAyOwogICAgICAgICAgbWF0Y2grKzsKICAgICAgICAgIGRvIHsKICAgICAgICAgIH0gd2hpbGUgKF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgc2NhbiA8IHN0cmVuZCk7CiAgICAgICAgICBsZW4gPSBNQVhfTUFUQ0ggLSAoc3RyZW5kIC0gc2Nhbik7CiAgICAgICAgICBzY2FuID0gc3RyZW5kIC0gTUFYX01BVENIOwogICAgICAgICAgaWYgKGxlbiA+IGJlc3RfbGVuKSB7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgPSBjdXJfbWF0Y2g7CiAgICAgICAgICAgIGJlc3RfbGVuID0gbGVuOwogICAgICAgICAgICBpZiAobGVuID49IG5pY2VfbWF0Y2gpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBzY2FuX2VuZDEgPSBfd2luW3NjYW4gKyBiZXN0X2xlbiAtIDFdOwogICAgICAgICAgICBzY2FuX2VuZCA9IF93aW5bc2NhbiArIGJlc3RfbGVuXTsKICAgICAgICAgIH0KICAgICAgICB9IHdoaWxlICgoY3VyX21hdGNoID0gcHJldltjdXJfbWF0Y2ggJiB3bWFza10pID4gbGltaXQgJiYgLS1jaGFpbl9sZW5ndGggIT09IDApOwogICAgICAgIGlmIChiZXN0X2xlbiA8PSBzLmxvb2thaGVhZCkgewogICAgICAgICAgcmV0dXJuIGJlc3RfbGVuOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcy5sb29rYWhlYWQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZmlsbF93aW5kb3cocykgewogICAgICAgIHZhciBfd19zaXplID0gcy53X3NpemU7CiAgICAgICAgdmFyIHAsIG4sIG0sIG1vcmUsIHN0cjsKICAgICAgICBkbyB7CiAgICAgICAgICBtb3JlID0gcy53aW5kb3dfc2l6ZSAtIHMubG9va2FoZWFkIC0gcy5zdHJzdGFydDsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID49IF93X3NpemUgKyAoX3dfc2l6ZSAtIE1JTl9MT09LQUhFQUQpKSB7CiAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHMud2luZG93LCBzLndpbmRvdywgX3dfc2l6ZSwgX3dfc2l6ZSwgMCk7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgLT0gX3dfc2l6ZTsKICAgICAgICAgICAgcy5zdHJzdGFydCAtPSBfd19zaXplOwogICAgICAgICAgICBzLmJsb2NrX3N0YXJ0IC09IF93X3NpemU7CiAgICAgICAgICAgIG4gPSBzLmhhc2hfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5oZWFkWy0tcF07CiAgICAgICAgICAgICAgcy5oZWFkW3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBuID0gX3dfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5wcmV2Wy0tcF07CiAgICAgICAgICAgICAgcy5wcmV2W3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBtb3JlICs9IF93X3NpemU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX2luID09PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgbiA9IHJlYWRfYnVmKHMuc3RybSwgcy53aW5kb3csIHMuc3Ryc3RhcnQgKyBzLmxvb2thaGVhZCwgbW9yZSk7CiAgICAgICAgICBzLmxvb2thaGVhZCArPSBuOwogICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHN0ciA9IHMuc3Ryc3RhcnQgLSBzLmluc2VydDsKICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3N0cl07CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzdHIgKyAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgd2hpbGUgKHMuaW5zZXJ0KSB7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3N0ciArIE1JTl9NQVRDSCAtIDFdKSAmIHMuaGFzaF9tYXNrOwogICAgICAgICAgICAgIHMucHJldltzdHIgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gc3RyOwogICAgICAgICAgICAgIHN0cisrOwogICAgICAgICAgICAgIHMuaW5zZXJ0LS07CiAgICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPCBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBzLnN0cm0uYXZhaWxfaW4gIT09IDApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVfc3RvcmVkKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIG1heF9ibG9ja19zaXplID0gNjU1MzU7CiAgICAgICAgaWYgKG1heF9ibG9ja19zaXplID4gcy5wZW5kaW5nX2J1Zl9zaXplIC0gNSkgewogICAgICAgICAgbWF4X2Jsb2NrX3NpemUgPSBzLnBlbmRpbmdfYnVmX3NpemUgLSA1OwogICAgICAgIH0KICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8PSAxKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDAgJiYgZmx1c2ggPT09IFpfTk9fRkxVU0gpIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBzLnN0cnN0YXJ0ICs9IHMubG9va2FoZWFkOwogICAgICAgICAgcy5sb29rYWhlYWQgPSAwOwogICAgICAgICAgdmFyIG1heF9zdGFydCA9IHMuYmxvY2tfc3RhcnQgKyBtYXhfYmxvY2tfc2l6ZTsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID09PSAwIHx8IHMuc3Ryc3RhcnQgPj0gbWF4X3N0YXJ0KSB7CiAgICAgICAgICAgIHMubG9va2FoZWFkID0gcy5zdHJzdGFydCAtIG1heF9zdGFydDsKICAgICAgICAgICAgcy5zdHJzdGFydCA9IG1heF9zdGFydDsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgLSBzLmJsb2NrX3N0YXJ0ID49IHMud19zaXplIC0gTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5zdHJzdGFydCA+IHMuYmxvY2tfc3RhcnQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX2Zhc3QocywgZmx1c2gpIHsKICAgICAgICB2YXIgaGFzaF9oZWFkOwogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEICYmIGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDApIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaGFzaF9oZWFkID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgaGFzaF9oZWFkID0gcy5wcmV2W3Muc3Ryc3RhcnQgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoaGFzaF9oZWFkICE9PSAwICYmIHMuc3Ryc3RhcnQgLSBoYXNoX2hlYWQgPD0gcy53X3NpemUgLSBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gbG9uZ2VzdF9tYXRjaChzLCBoYXNoX2hlYWQpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHMubWF0Y2hfbGVuZ3RoID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICBiZmx1c2ggPSB0cmVlcy5fdHJfdGFsbHkocywgcy5zdHJzdGFydCAtIHMubWF0Y2hfc3RhcnQsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA8PSBzLm1heF9sYXp5X21hdGNoICYmIHMubG9va2FoZWFkID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoLS07CiAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9IHdoaWxlICgtLXMubWF0Y2hfbGVuZ3RoICE9PSAwKTsKICAgICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcy5zdHJzdGFydCArPSBzLm1hdGNoX2xlbmd0aDsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3Muc3Ryc3RhcnRdOwogICAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IHMuc3Ryc3RhcnQgPCBNSU5fTUFUQ0ggLSAxID8gcy5zdHJzdGFydCA6IE1JTl9NQVRDSCAtIDE7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9zbG93KHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGhhc2hfaGVhZDsKICAgICAgICB2YXIgYmZsdXNoOwogICAgICAgIHZhciBtYXhfaW5zZXJ0OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORU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iA0MDk2KSkgewogICAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gTUlOX01BVENIIC0gMTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMucHJldl9sZW5ndGggPj0gTUlOX01BVENIICYmIHMubWF0Y2hfbGVuZ3RoIDw9IHMucHJldl9sZW5ndGgpIHsKICAgICAgICAgICAgbWF4X2luc2VydCA9IHMuc3Ryc3RhcnQgKyBzLmxvb2thaGVhZCAtIE1JTl9NQVRDSDsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIHMuc3Ryc3RhcnQgLSAxIC0gcy5wcmV2X21hdGNoLCBzLnByZXZfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5wcmV2X2xlbmd0aCAtIDE7CiAgICAgICAgICAgIHMucHJldl9sZW5ndGggLT0gMjsKICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgIGlmICgrK3Muc3Ryc3RhcnQgPD0gbWF4X2luc2VydCkgewogICAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gd2hpbGUgKC0tcy5wcmV2X2xlbmd0aCAhPT0gMCk7CiAgICAgICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMDsKICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAocy5tYXRjaF9hdmFpbGFibGUpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5tYXRjaF9hdmFpbGFibGUgPSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLm1hdGNoX2F2YWlsYWJsZSkgewogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICBzLm1hdGNoX2F2YWlsYWJsZSA9IDA7CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gcy5zdHJzdGFydCA8IE1JTl9NQVRDSCAtIDEgPyBzLnN0cnN0YXJ0IDogTUlOX01BVENIIC0gMTsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5sYXN0X2xpdCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gQlNfQkxPQ0tfRE9ORTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX3JsZShzLCBmbHVzaCkgewogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgdmFyIHByZXY7CiAgICAgICAgdmFyIHNjYW4sIHN0cmVuZDsKICAgICAgICB2YXIgX3dpbiA9IHMud2luZG93OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0ggJiYgcy5zdHJzdGFydCA+IDApIHsKICAgICAgICAgICAgc2NhbiA9IHMuc3Ryc3RhcnQgLSAxOwogICAgICAgICAgICBwcmV2ID0gX3dpbltzY2FuXTsKICAgICAgICAgICAgaWYgKHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dKSB7CiAgICAgICAgICAgICAgc3RyZW5kID0gcy5zdHJzdGFydCArIE1BWF9NQVRDSDsKICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgfSB3aGlsZSAocHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBzY2FuIDwgc3RyZW5kKTsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IE1BWF9NQVRDSCAtIChzdHJlbmQgLSBzY2FuKTsKICAgICAgICAgICAgICBpZiAocy5tYXRjaF9sZW5ndGggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBzLmxvb2thaGVhZDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDEsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgKz0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IDA7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9odWZmKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGJmbHVzaDsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSAwOwogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnRdKTsKICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgIGlmIChmbHVzaCA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgdHJ1ZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX1NUQVJURUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX0RPTkU7CiAgICAgICAgfQogICAgICAgIGlmIChzLmxhc3RfbGl0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19v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nX2J1Zl9zaXplID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmcgPSAwOwogICAgICAgIHRoaXMud3JhcCA9IDA7CiAgICAgICAgdGhpcy5nemhlYWQgPSBudWxsOwogICAgICAgIHRoaXMuZ3ppbmRleCA9IDA7CiAgICAgICAgdGhpcy5tZXRob2QgPSBaX0RFRkxBVEVEOwogICAgICAgIHRoaXMubGFzdF9mbHVzaCA9IC0xOwogICAgICAgIHRoaXMud19zaXplID0gMDsKICAgICAgICB0aGlzLndfYml0cyA9IDA7CiAgICAgICAgdGhpcy53X21hc2sgPSAwOwogICAgICAgIHRoaXMud2luZG93ID0gbnVsbDsKICAgICAgICB0aGlzLndpbmRvd19zaXplID0gMDsKICAgICAgICB0aGlzLnByZXYgPSBudWxsOwogICAgICAgIHRoaXMuaGVhZCA9IG51bGw7CiAgICAgICAgdGhpcy5pbnNfaCA9IDA7CiAgICAgICAgdGhpcy5oYXNoX3NpemUgPSAwOwogICAgICAgIHRoaXMuaGFzaF9iaXRzID0gMDsKICAgICAgICB0aGlzLmhhc2hfbWFzayA9IDA7CiAgICAgICAgdGhpcy5oYXNoX3NoaWZ0ID0gMDsKICAgICAgICB0aGlzLmJsb2NrX3N0YXJ0ID0gMDsKICAgICAgICB0aGlzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgdGhpcy5wcmV2X21hdGNoID0gMDsKICAgICAgICB0aGlzLm1hdGNoX2F2YWlsYWJsZSA9IDA7CiAgICAgICAgdGhpcy5zdHJzdGFydCA9IDA7CiAgICAgICAgdGhpcy5tYXRjaF9zdGFydCA9IDA7CiAgICAgICAgdGhpcy5sb29rYWhlYWQgPSAwOwogICAgICAgIHRoaXMucHJldl9sZW5ndGggPSAwOwogICAgICAgIHRoaXMubWF4X2NoYWluX2xlbmd0aCA9IDA7CiAgICAgICAgdGhpcy5tYXhfbGF6eV9tYXRjaCA9IDA7CiAgICAgICAgdGhpcy5sZXZlbCA9IDA7CiAgICAgICAgdGhpcy5zdHJhdGVneSA9IDA7CiAgICAgICAgdGhpcy5nb29kX21hdGNoID0gMDsKICAgICAgICB0aGlzLm5pY2VfbWF0Y2ggPSAwOwogICAgICAgIHRoaXMuZHluX2x0cmVlID0gbmV3IHV0aWxzLkJ1ZjE2KEhFQVBfU0laRSAqIDIpOwogICAgICAgIHRoaXMuZHluX2R0cmVlID0gbmV3IHV0aWxzLkJ1ZjE2KCgyICogRF9DT0RFUyArIDEpICogMik7CiAgICAgICAgdGhpcy5ibF90cmVlID0gbmV3IHV0aWxzLkJ1ZjE2KCgyICogQkxfQ09ERVMgKyAxKSAqIDIpOwogICAgICAgIHplcm8odGhpcy5keW5fbHRyZWUpOwogICAgICAgIHplcm8odGhpcy5keW5fZHRyZWUpOwogICAgICAgIHplcm8odGhpcy5ibF90cmVlKTsKICAgICAgICB0aGlzLmxfZGVzYyA9IG51bGw7CiAgICAgICAgdGhpcy5kX2Rlc2MgPSBudWxsOwogICAgICAgIHRoaXMuYmxfZGVzYyA9IG51bGw7CiAgICAgICAgdGhpcy5ibF9jb3VudCA9IG5ldyB1dGlscy5CdWYxNihNQVhfQklUUyArIDEpOwogICAgICAgIHRoaXMuaGVhcCA9IG5ldyB1dGlscy5CdWYxNigyICogTF9DT0RFUyArIDEpOwogICAgICAgIHplcm8odGhpcy5oZWFwKTsKICAgICAgICB0aGlzLmhlYXBfbGVuID0gMDsKICAgICAgICB0aGlzLmhlYXBfbWF4ID0gMDsKICAgICAgICB0aGlzLmRlcHRoID0gbmV3IHV0aWxzLkJ1ZjE2KDIgKiBMX0NPREVTICsgMSk7CiAgICAgICAgemVybyh0aGlzLmRlcHRoKTsKICAgICAgICB0aGlzLmxfYnVmID0gMDsKICAgICAgICB0aGlzLmxpdF9idWZzaXplID0gMDsKICAgICAgICB0aGlzLmxhc3RfbGl0ID0gMDsKICAgICAgICB0aGlzLmRfYnVmID0gMDsKICAgICAgICB0aGlzLm9wdF9sZW4gPSAwOwogICAgICAgIHRoaXMuc3RhdGljX2xlbiA9IDA7CiAgICAgICAgdGhpcy5tYXRjaGVzID0gMDsKICAgICAgICB0aGlzLmluc2VydCA9IDA7CiAgICAgICAgdGhpcy5iaV9idWYgPSAwOwogICAgICAgIHRoaXMuYmlfdmFsaWQgPSAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVSZXNldEtlZXAoc3RybSkgewogICAgICAgIHZhciBzOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBaX1NUUkVBTV9FUlJPUik7CiAgICAgICAgfQogICAgICAgIHN0cm0udG90YWxfaW4gPSBzdHJtLnRvdGFsX291dCA9IDA7CiAgICAgICAgc3RybS5kYXRhX3R5cGUgPSBaX1VOS05PV047CiAgICAgICAgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgcy5wZW5kaW5nID0gMDsKICAgICAgICBzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICBpZiAocy53cmFwIDwgMCkgewogICAgICAgICAgcy53cmFwID0gLXMud3JhcDsKICAgICAgICB9CiAgICAgICAgcy5zdGF0dXMgPSBzLndyYXAgPyBJTklUX1NUQVRFIDogQlVTWV9TVEFURTsKICAgICAgICBzdHJtLmFkbGVyID0gcy53cmFwID09PSAyID8gMCA6IDE7CiAgICAgICAgcy5sYXN0X2ZsdXNoID0gWl9OT19GTFVTSDsKICAgICAgICB0cmVlcy5fdHJfaW5pdChzKTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlUmVzZXQoc3RybSkgewogICAgICAgIHZhciByZXQgPSBkZWZsYXRlUmVzZXRLZWVwKHN0cm0pOwogICAgICAgIGlmIChyZXQgPT09IFpfT0spIHsKICAgICAgICAgIGxtX2luaXQoc3RybS5zdGF0ZSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH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5IHx8IHN0cmF0ZWd5IDwgMCB8fCBzdHJhdGVneSA+IFpfRklYRUQpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBpZiAod2luZG93Qml0cyA9PT0gOCkgewogICAgICAgICAgd2luZG93Qml0cyA9IDk7CiAgICAgICAgfQogICAgICAgIHZhciBzID0gbmV3IERlZmxhdGVTdGF0ZSgpOwogICAgICAgIHN0cm0uc3RhdGUgPSBzOwogICAgICAgIHMuc3RybSA9IHN0cm07CiAgICAgICAgcy53cmFwID0gd3JhcDsKICAgICAgICBzLmd6aGVhZCA9IG51bGw7CiAgICAgICAgcy53X2JpdHMgPSB3aW5kb3dCaXRzOwogICAgICAgIHMud19zaXplID0gMSA8PCBzLndfYml0czsKICAgICAgICBzLndfbWFzayA9IHMud19zaXplIC0gMTsKICAgICAgICBzLmhhc2hfYml0cyA9IG1lbUxldmVsICsgNzsKICAgICAgICBzLmhhc2hfc2l6ZSA9IDEgPDwgcy5oYXNoX2JpdHM7CiAgICAgICAgcy5oYXNoX21hc2sgPSBzLmhhc2hfc2l6ZSAtIDE7CiAgICAgICAgcy5oYXNoX3NoaWZ0ID0gfn4oKHMuaGFzaF9iaXRzICsgTUlOX01BVENIIC0gMSkgLyBNSU5fTUFUQ0gpOwogICAgICAgIHMud2luZG93ID0gbmV3IHV0aWxzLkJ1Zjgocy53X3NpemUgKiAyKTsKICAgICAgICBzLmhlYWQgPSBuZXcgdXRpbHMuQnVmMTYocy5oYXNoX3NpemUpOwogICAgICAgIHMucHJldiA9IG5ldyB1dGlscy5CdWYxNihzLndfc2l6ZSk7CiAgICAgICAgcy5saXRfYnVmc2l6ZSA9IDEgPDwgbWVtTGV2ZWwgKyA2OwogICAgICAgIHMucGVuZGluZ19idWZfc2l6ZSA9IHMubGl0X2J1ZnNpemUgKiA0OwogICAgICAgIHMucGVuZGluZ19idWYgPSBuZXcgdXRpbHMuQnVmOChzLnBlb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AgIH0KICAgICAgICBzLnN0cm0gPSBzdHJtOwogICAgICAgIG9sZF9mbHVzaCA9IHMubGFzdF9mbHVzaDsKICAgICAgICBzLmxhc3RfZmx1c2ggPSBmbHVzaDsKICAgICAgICBpZiAocy5zdGF0dXMgPT09IElOSVRfU1RBVEUpIHsKICAgICAgICAgIGlmIChzLndyYXAgPT09IDIpIHsKICAgICAgICAgICAgc3RybS5hZGxlciA9IDA7CiAgICAgICAgICAgIHB1dF9ieXRlKHMsIDMxKTsKICAgICAgICAgICAgcHV0X2J5dGUocywgMTM5KTsKICAgICAgICAgICAgcHV0X2J5dGUocywgOCk7CiAgICAgICAgICAgIGlmICghcy5nemhlYWQpIHsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgT1NfQ09ERSk7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50ZXh0ID8gMSA6IDApICsgKHMuZ3poZWFkLmhjcmMgPyAyIDogMCkgKyAoIXMuZ3poZWFkLmV4dHJhID8gMCA6IDQpICsgKCFzLmd6aGVhZC5uYW1lID8gMCA6IDgpICsgKCFzLmd6aGVhZC5jb21tZW50ID8gMCA6IDE2KSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSA+PiA4ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDE2ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDI0ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQub3MgJiAyNTUpOwogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5leHRyYSAmJiBzLmd6aGVhZC5leHRyYS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLmV4dHJhLmxlbmd0aCAmIDI1NSk7CiAgICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYS5sZW5ndGggPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjKSB7CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nLCAwKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcy5nemluZGV4ID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEVYVFJBX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB2YXIgaGVhZGVyID0gWl9ERUZMQVRFRCArIChzLndfYml0cyAtIDggPDwgNCkgPDwgODsKICAgICAgICAgICAgdmFyIGxldmVsX2ZsYWdzID0gLTE7CiAgICAgICAgICAgIGlmIChzLnN0cmF0ZWd5ID49IFpfSFVGRk1BTl9PTkxZIHx8IHMubGV2ZWwgPCAyKSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAwOwogICAgICAgICAgICB9IGVsc2UgaWYgKHMubGV2ZWwgPCA2KSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAxOwogICAgICAgICAgICB9IGVsc2UgaWYgKHMubGV2ZWwgPT09IDYpIHsKICAgICAgICAgICAgICBsZXZlbF9mbGFncyA9IDI7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAzOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGhlYWRlciB8PSBsZXZlbF9mbGFncyA8PCA2OwogICAgICAgICAgICBpZiAocy5zdHJzdGFydCAhPT0gMCkgewogICAgICAgICAgICAgIGhlYWRlciB8PSBQUkVTRVRfRElDVDsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXIgKz0gMzEgLSBoZWFkZXIgJSAzMTsKICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBoZWFkZXIpOwogICAgICAgICAgICBpZiAocy5zdHJzdGFydCAhPT0gMCkgewogICAgICAgICAgICAgIHB1dFNob3J0TVNCKHMsIHN0cm0uYWRsZXIgPj4+IDE2KTsKICAgICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBzdHJtLmFkbGVyICYgNjU1MzUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHN0cm0uYWRsZXIgPSAxOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5zdGF0dXMgPT09IEVYVFJBX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuZXh0cmEpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICB3aGlsZSAocy5nemluZGV4IDwgKHMuZ3poZWFkLmV4dHJhLmxlbmd0aCAmIDY1NTM1KSkgewogICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMihzdHJtLmFkbGVyLCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmcgLSBiZWcsIGJlZyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYVtzLmd6aW5kZXhdICYgMjU1KTsKICAgICAgICAgICAgICBzLmd6aW5kZXgrKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPT09IHMuZ3poZWFkLmV4dHJhLmxlbmd0aCkgewogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBOQU1FX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IE5BTUVfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gTkFNRV9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLm5hbWUpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgICAgdmFsID0gMTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPCBzLmd6aGVhZC5uYW1lLmxlbmd0aCkgewogICAgICAgICAgICAgICAgdmFsID0gcy5nemhlYWQubmFtZS5jaGFyQ29kZUF0KHMuZ3ppbmRleCsrKSAmIDI1NTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdmFsID0gMDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgdmFsKTsKICAgICAgICAgICAgfSB3aGlsZSAodmFsICE9PSAwKTsKICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodmFsID09PSAwKSB7CiAgICAgICAgICAgICAgcy5nemluZGV4ID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IENPTU1FTlRfU1RBVEU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuc3RhdHVzID0gQ09NTUVOVF9TVEFURTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBDT01NRU5UX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuY29tbWVudCkgewogICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgICB2YWwgPSAxOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHMuZ3ppbmRleCA8IHMuZ3poZWFkLmNvbW1lbnQubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICB2YWwgPSBzLmd6aGVhZC5jb21tZW50LmNoYXJDb2RlQXQocy5nemluZGV4KyspICYgMjU1OwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB2YWwgPSAwOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwdXRfYnl0ZShzLCB2YWwpOwogICAgICAgICAgICB9IHdoaWxlICh2YWwgIT09IDApOwogICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh2YWwgPT09IDApIHsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEhDUkNfU1RBVEU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuc3RhdHVzID0gSENSQ19TVEFURTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBIQ1JDX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYykgewogICAgICAgICAgICBpZiAocy5wZW5kaW5nICsgMiA+IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMucGVuZGluZyArIDIgPD0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciA+PiA4ICYgMjU1KTsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEJVU1lfU1RBVEU7CiAgICAgICAgICAgIH0KICAg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lNfRklOSVNIX0RPTkUpIHsKICAgICAgICAgICAgcy5zdGF0dXMgPSBGSU5JU0hfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYnN0YXRlID09PSBCU19ORUVEX01PUkUgfHwgYnN0YXRlID09PSBCU19GSU5JU0hfU1RBUlRFRCkgewogICAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICBzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChic3RhdGUgPT09IEJTX0JMT0NLX0RPTkUpIHsKICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX1BBUlRJQUxfRkxVU0gpIHsKICAgICAgICAgICAgICB0cmVlcy5fdHJfYWxpZ24ocyk7CiAgICAgICAgICAgIH0gZWxzZSBpZiAoZmx1c2ggIT09IFpfQkxPQ0spIHsKICAgICAgICAgICAgICB0cmVlcy5fdHJfc3RvcmVkX2Jsb2NrKHMsIDAsIDAsIGZhbHNlKTsKICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfRlVMTF9GTFVTSCkgewogICAgICAgICAgICAgICAgemVybyhzLmhlYWQpOwogICAgICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHMuc3Ryc3RhcnQgPSAwOwogICAgICAgICAgICAgICAgICBzLmJsb2NrX3N0YXJ0ID0gMDsKICAgICAgICAgICAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICBzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoZmx1c2ggIT09IFpfRklOSVNIKSB7CiAgICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKHMud3JhcCA8PSAwKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRU5EOwogICAgICAgIH0KICAgICAgICBpZiAocy53cmFwID09PSAyKSB7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgPj4gOCAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyID4+IDE2ICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgPj4gMjQgJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLnRvdGFsX2luID4+IDggJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiA+PiAxNiAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLnRvdGFsX2luID4+IDI0ICYgMjU1KTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgcHV0U2hvcnRNU0Iocywgc3RybS5hZGxlciA+Pj4gMTYpOwogICAgICAgICAgcHV0U2hvcnRNU0Iocywgc3RybS5hZGxlciAmIDY1NTM1KTsKICAgICAgICB9CiAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICBpZiAocy53cmFwID4gMCkgewogICAgICAgICAgcy53cmFwID0gLXMud3JhcDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHMucGVuZGluZyAhPT0gMCA/IFpfT0sgOiBaX1NUUkVBTV9FTkQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZG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ICB3cmFwID0gcy53cmFwOwogICAgICAgIGlmICh3cmFwID09PSAyIHx8IHdyYXAgPT09IDEgJiYgcy5zdGF0dXMgIT09IElOSVRfU1RBVEUgfHwgcy5sb29rYWhlYWQpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgaWYgKHdyYXAgPT09IDEpIHsKICAgICAgICAgIHN0cm0uYWRsZXIgPSBhZGxlcjMyKHN0cm0uYWRsZXIsIGRpY3Rpb25hcnksIGRpY3RMZW5ndGgsIDApOwogICAgICAgIH0KICAgICAgICBzLndyYXAgPSAwOwogICAgICAgIGlmIChkaWN0TGVuZ3RoID49IHMud19zaXplKSB7CiAgICAgICAgICBpZiAod3JhcCA9PT0gMCkgewogICAgICAgICAgICB6ZXJvKHMuaGVhZCk7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgPSAwOwogICAgICAgICAgICBzLmJsb2NrX3N0YXJ0ID0gMDsKICAgICAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgICAgfQogICAgICAgICAgdG1wRGljdCA9IG5ldyB1dGlscy5CdWY4KHMud19zaXplKTsKICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHRtcERpY3QsIGRpY3Rpb25hcnksIGRpY3RMZW5ndGggLSBzLndfc2l6ZSwgcy53X3NpemUsIDApOwogICAgICAgICAgZGljdGlvbmFyeSA9IHRtcERpY3Q7CiAgICAgICAgICBkaWN0TGVuZ3RoID0gcy53X3NpemU7CiAgICAgICAgfQogICAgICAgIGF2YWlsID0gc3RybS5hdmFpbF9pbjsKICAgICAgICBuZXh0ID0gc3RybS5uZXh0X2luOwogICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gZGljdExlbmd0aDsKICAgICAgICBzdHJtLm5leHRfaW4gPSAwOwogICAgICAgIHN0cm0uaW5wdXQgPSBkaWN0aW9uYXJ5OwogICAgICAgIGZpbGxfd2luZG93KHM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gKyAoYzIgLSA1NjMyMCk7CiAgICAgICAgICAgICAgbV9wb3MrKzsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgYnVmX2xlbiArPSBjIDwgMTI4ID8gMSA6IGMgPCAyMDQ4ID8gMiA6IGMgPCA2NTUzNiA/IDMgOiA0OwogICAgICAgIH0KICAgICAgICBidWYgPSBuZXcgdXRpbHMuQnVmOChidWZfbGVuKTsKICAgICAgICBmb3IgKGkgPSAwLCBtX3BvcyA9IDA7IGkgPCBidWZfbGVuOyBtX3BvcysrKSB7CiAgICAgICAgICBjID0gc3RyLmNoYXJDb2RlQXQobV9wb3MpOwogICAgICAgICAgaWYgKChjICYgNjQ1MTIpID09PSA1NTI5NiAmJiBtX3BvcyArIDEgPCBzdHJfbGVuKSB7CiAgICAgICAgICAgIGMyID0gc3RyLmNoYXJDb2RlQXQobV9wb3MgKyAxKTsKICAgICAgICAgICAgaWYgKChjMiAmIDY0NTEyKSA9PT0gNTYzMjApIHsKICAgICAgICAgICAgICBjID0gNjU1MzYgKyAoYyAtIDU1Mjk2IDw8IDEwKSArIChjMiAtIDU2MzIwKTsKICAgICAgICAgICAgICBtX3BvcysrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDEyOCkgewogICAgICAgICAgICBidWZbaSsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCAyMDQ4KSB7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTkyIHwgYyA+Pj4gNjsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCA2NTUzNikgewogICAgICAgICAgICBidWZbaSsrXSA9IDIyNCB8IGMgPj4+IDEyOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDYgJiA2MzsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBidWZbaSsrXSA9IDI0MCB8IGMgPj4+IDE4OwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDEyICYgNjM7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTI4IHwgYyA+Pj4gNiAmIDYzOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgJiA2MzsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gYnVmMmJpbnN0cmluZyhidWYsIGxlbikgewogICAgICAgIGlmIChsZW4gPCA2NTUzNCkgewogICAgICAgICAgaWYgKGJ1Zi5zdWJhcnJheSAmJiBTVFJfQVBQTFlfVUlBX09LIHx8ICFidWYuc3ViYXJyYXkgJiYgU1RSX0FQUExZX09LKSB7CiAgICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KG51bGwsIHV0aWxzLnNocmlua0J1ZihidWYsIGxlbikpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB2YXIgcmVzdWx0ID0gIiI7CiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgcmVzdWx0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgfQogICAgICBleHBvcnRzMi5idWYyYmluc3RyaW5nID0gZnVuY3Rpb24oYnVmKSB7CiAgICAgICAgcmV0dXJuIGJ1ZjJiaW5zdHJpbmcoYnVmLCBidWYubGVuZ3RoKTsKICAgICAgfTsKICAgICAgZXhwb3J0czIuYmluc3RyaW5nMmJ1ZiA9IGZ1bmN0aW9uKHN0cikgewogICAgICAgIHZhciBidWYgPSBuZXcgdXRpbHMuQnVmOChzdHIubGVuZ3RoKTsKICAgICAgICBmb3IgKHZhciBpID0gMCwgbGVuID0gYnVmLmxlbmd0aDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgICBidWZbaV0gPSBzdHIuY2hhckNvZGVBdChpKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfTsKICAgICAgZXhwb3J0czIuYnVmMnN0cmluZyA9IGZ1bmN0aW9uKGJ1ZiwgbWF4KSB7CiAgICAgICAgdmFyIGksIG91dCwgYywgY19sZW47CiAgICAgICAgdmFyIGxlbiA9IG1heCB8fCBidWYubGVuZ3RoOwogICAgICAgIHZhciB1dGYxNmJ1ZiA9IG5ldyBBcnJheShsZW4gKiAyKTsKICAgICAgICBmb3IgKG91dCA9IDAsIGkgPSAwOyBpIDwgbGVuOyApIHsKICAgICAgICAgIGMgPSBidWZbaSsrXTsKICAgICAgICAgIGlmIChjIDwgMTI4KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgY19sZW4gPSBfdXRmOGxlbltjXTsKICAgICAgICAgIGlmIChjX2xlbiA+IDQpIHsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNjU1MzM7CiAgICAgICAgICAgIGkgKz0gY19sZW4gLSAxOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGMgJj0gY19sZW4gPT09IDIgPyAzMSA6IGNfbGVuID09PSAzID8gMTUgOiA3OwogICAgICAgICAgd2hpbGUgKGNfbGVuID4gMSAmJiBpIDwgbGVuKSB7CiAgICAgICAgICAgIGMgPSBjIDw8IDYgfCBidWZbaSsrXSAmIDYzOwogICAgICAgICAgICBjX2xlbi0tOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGNfbGVuID4gMSkgewogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA2NTUzMzsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDY1NTM2KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjIC09IDY1NTM2OwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NTI5NiB8IGMgPj4gMTAgJiAxMDIzOwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NjMyMCB8IGMgJiAxMDIzOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gYnVmMmJpbnN0cmluZyh1dGYxNmJ1Ziwgb3V0KTsKICAgICAgfTsKICAgICAgZXhwb3J0czIudXRmOGJvcmRlciA9IGZ1bmN0aW9uKGJ1ZiwgbWF4KSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBtYXggPSBtYXggfHwgYnVmLmxlbmd0aDsKICAgICAgICBpZiAobWF4ID4gYnVmLmxlbmd0aCkgewogICAgICAgICAgbWF4ID0gYnVmLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgcG9zID0gbWF4IC0gMTsKICAgICAgICB3aGlsZSAocG9zID49IDAgJiYgKGJ1Zltwb3NdICYgMTkyKSA9PT0gMTI4KSB7CiAgICAgICAgICBwb3MtLTsKICAgICAgICB9CiAgICAgICAgaWYgKHBvcyA8IDApIHsKICAgICAgICAgIHJldHVybiBtYXg7CiAgICAgICAgfQogICAgICAgIGlmIChwb3MgPT09IDApIHsKICAgICAgICAgIHJldHVybiBtYXg7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwb3MgKyBfdXRmOGxlbltidWZbcG9zXV0gPiBtYXggPyBwb3MgOiBtYXg7CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi96c3RyZWFtLmpzCiAgdmFyIHJlcXVpcmVfenN0cmVhbSA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5w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gICB2YXIgc3RyaW5ncyA9IHJlcXVpcmVfc3RyaW5ncygpOwogICAgICB2YXIgbXNnID0gcmVxdWlyZV9tZXNzYWdlcygpOwogICAgICB2YXIgWlN0cmVhbSA9IHJlcXVpcmVfenN0cmVhbSgpOwogICAgICB2YXIgdG9TdHJpbmcgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nOwogICAgICB2YXIgWl9OT19GTFVTSCA9IDA7CiAgICAgIHZhciBaX0ZJTklTSCA9IDQ7CiAgICAgIHZhciBaX09LID0gMDsKICAgICAgdmFyIFpfU1RSRUFNX0VORCA9IDE7CiAgICAgIHZhciBaX1NZTkNfRkxVU0gyID0gMjsKICAgICAgdmFyIFpfREVGQVVMVF9DT01QUkVTU0lPTiA9IC0xOwogICAgICB2YXIgWl9ERUZBVUxUX1NUUkFURUdZID0gMDsKICAgICAgdmFyIFpfREVGTEFURUQgPSA4OwogICAgICBmdW5jdGlvbiBEZWZsYXRlKG9wdGlvbnMpIHsKICAgICAgICBpZiAoISh0aGlzIGluc3RhbmNlb2YgRGVmbGF0ZSkpCiAgICAgICAgICByZXR1cm4gbmV3IERlZmxhdGUob3B0aW9ucyk7CiAgICAgICAgdGhpcy5vcHRpb25zID0gdXRpbHMuYXNzaWduKHsKICAgICAgICAgIGxldmVsOiBaX0RFRkFVTFRfQ09NUFJFU1NJT04sCiAgICAgICAgICBtZXRob2Q6IFpfREVGTEFURUQsCiAgICAgICAgICBjaHVua1NpemU6IDE2Mzg0LAogICAgICAgICAgd2luZG93Qml0czogMTUsCiAgICAgICAgICBtZW1MZXZlbDogOCwKICAgICAgICAgIHN0cmF0ZWd5OiBaX0RFRkFVTFRfU1RSQVRFR1ksCiAgICAgICAgICB0bzogIiIKICAgICAgICB9LCBvcHRpb25zIHx8IHt9KTsKICAgICAgICB2YXIgb3B0ID0gdGhpcy5vcHRpb25zOwogICAgICAgIGlmIChvcHQucmF3ICYmIG9wdC53aW5kb3dCaXRzID4gMCkgewogICAgICAgICAgb3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ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgICAgZGljdCA9IG5ldyBVaW50OEFycmF5KG9wdC5kaWN0aW9uYXJ5KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGRpY3QgPSBvcHQuZGljdGlvbmFyeTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlU2V0RGljdGlvbmFyeSh0aGlzLnN0cm0sIGRpY3QpOwogICAgICAgICAgaWYgKHN0YXR1cyAhPT0gWl9PSykgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IobXNnW3N0YXR1c10pOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5fZGljdF9zZXQgPSB0cnVlOwogICAgICAgIH0KICAgICAgfQogICAgICBEZWZsYXRlLnByb3RvdHlwZS5wdXNoID0gZnVuY3Rpb24oZGF0YSwgbW9kZSkgewogICAgICAgIHZhciBzdHJtID0gdGhpcy5zdHJtOwogICAgICAgIHZhciBjaHVua1NpemUgPSB0aGlzLm9wdGlvbnMuY2h1bmtTaXplOwogICAgICAgIHZhciBzdGF0dXMsIF9tb2RlOwogICAgICAgIGlmICh0aGlzLmVuZGVkKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICAgIF9tb2RlID0gbW9kZSA9PT0gfn5tb2RlID8gbW9kZSA6IG1vZGUgPT09IHRydWUgPyBaX0ZJTklTSCA6IFpfTk9fRkxVU0g7CiAgICAgICAgaWYgKHR5cGVvZiBkYXRhID09PSAic3RyaW5nIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IHN0cmluZ3Muc3RyaW5nMmJ1ZihkYXRhKTsKICAgICAgICB9IGVsc2UgaWYgKHRvU3RyaW5nLmNhbGwoZGF0YSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgIHN0cm0uaW5wdXQgPSBuZXcgVWludDhBcnJheShkYXRhKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RybS5pbnB1dCA9IGRhdGE7CiAgICAgICAgfQogICAgICAgIHN0cm0ubmV4dF9pbiA9IDA7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IHN0cm0uaW5wdXQubGVuZ3RoOwogICAgICAgIGRvIHsKICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBzdHJtLm91dHB1dCA9IG5ldyB1dGlscy5CdWY4KGNodW5rU2l6ZSk7CiAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSAwOwogICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGNodW5rU2l6ZTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlKHN0cm0sIF9tb2RlKTsKICAgICAgICAgIGlmIChzdGF0dXMgIT09IFpfU1RSRUFNX0VORCAmJiBzdGF0dXMgIT09IFpfT0spIHsKICAgICAgICAgICAgdGhpcy5vbkVuZChzdGF0dXMpOwogICAgICAgICAgICB0aGlzLmVuZGVkID0gdHJ1ZTsKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwIHx8IHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgKF9tb2RlID09PSBaX0ZJTklTSCB8fCBfbW9kZSA9PT0gWl9TWU5DX0ZMVVNIMikpIHsKICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICB0aGlzLm9uRGF0YShzdHJpbmdzLmJ1ZjJiaW5zdHJpbmcodXRpbHMuc2hyaW5rQnVmKHN0cm0ub3V0cHV0LCBzdHJtLm5leHRfb3V0KSkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0aWxzLnNocmlua0J1ZihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCkpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSB3aGlsZSAoKHN0cm0uYXZhaWxfaW4gPiAwIHx8IHN0cm0uYXZhaWxfb3V0ID09PSAwKSAmJiBzdGF0dXMgIT09IFpfU1RSRUFNX0VORCk7CiAgICAgICAgaWYgKF9tb2RlID09PSBaX0ZJTklTSCkgewogICAgICAgICAgc3RhdHVzID0gemxpYl9kZWZsYXRlLmRlZmxhdGVFbmQodGhpcy5zdHJtKTsKICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgIHRoaXMuZW5kZWQgPSB0cnVlOwogICAgICAgICAgcmV0dXJuIHN0YXR1cyA9PT0gWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBaX1NZTkNfRkxVU0gyKSB7CiAgICAgICAgICB0aGlzLm9uRW5kKFpfT0spOwogICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSAwOwogICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0cnVlOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkRhdGEgPSBmdW5jdGlvbihjaHVuaykgewogICAgICAgIHRoaXMuY2h1bmtzLnB1c2goY2h1bmspOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkVuZCA9IGZ1bmN0aW9uKHN0YXR1cykgewogICAgICAgIGlmIChzdGF0dXMgPT09IFpfT0spIHsKICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMudG8gPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdGhpcy5jaHVua3Muam9pbigiIik7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aGlzLnJlc3VsdCA9IHV0aWxzLmZsYXR0ZW5DaHVua3ModGhpcy5jaHVua3MpOwogICAgICAgICAgfQogICAgICAgIH0K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HVsZXMvcGFrby9saWIvemxpYi9pbmZmYXN0LmpzCiAgdmFyIHJlcXVpcmVfaW5mZmFzdCA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9pbmZmYXN0LmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIEJBRCA9IDMwOwogICAgICB2YXIgVFlQRSA9IDEyOwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBmdW5jdGlvbiBpbmZsYXRlX2Zhc3Qoc3RybSwgc3RhcnQpIHsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgdmFyIF9pbjsKICAgICAgICB2YXIgbGFzdDsKICAgICAgICB2YXIgX291dDsKICAgICAgICB2YXIgYmVnOwogICAgICAgIHZhciBlbmQ7CiAgICAgICAgdmFyIGRtYXg7CiAgICAgICAgdmFyIHdzaXplOwogICAgICAgIHZhciB3aGF2ZTsKICAgICAgICB2YXIgd25leHQ7CiAgICAgICAgdmFyIHNfd2luZG93OwogICAgICAgIHZhciBob2xkOwogICAgICAgIHZhciBiaXRzOwogICAgICAgIHZhciBsY29kZTsKICAgICAgICB2YXIgZGNvZGU7CiAgICAgICAgdmFyIGxtYXNrOwogICAgICAgIHZhciBkbWFzazsKICAgICAgICB2YXIgaGVyZTsKICAgICAgICB2YXIgb3A7CiAgICAgICAgdmFyIGxlbjsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgZnJvbTsKICAgICAgICB2YXIgZnJvbV9zb3VyY2U7CiAgICAgICAgdmFyIGlucHV0LCBvdXRwdXQ7CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIF9pbiA9IHN0cm0ubmV4dF9pbjsKICAgICAgICBpbnB1dCA9IHN0cm0uaW5wdXQ7CiAgICAgICAgbGFzdCA9IF9pbiArIChzdHJtLmF2YWlsX2luIC0gNSk7CiAgICAgICAgX291dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgb3V0cHV0ID0gc3RybS5vdXRwdXQ7CiAgICAgICAgYmVnID0gX291dCAtIChzdGFydCAtIHN0cm0uYXZhaWxfb3V0KTsKICAgICAgICBlbmQgPSBfb3V0ICsgKHN0cm0uYXZhaWxfb3V0IC0gMjU3KTsKICAgICAgICBkbWF4ID0gc3RhdGUuZG1heDsKICAgICAgICB3c2l6ZSA9IHN0YXRlLndzaXplOwogICAgICAgIHdoYXZlID0gc3RhdGUud2hhdmU7CiAgICAgICAgd25leHQgPSBzdGF0ZS53bmV4dDsKICAgICAgICBzX3dpbmRvdyA9IHN0YXRlLndpbmRvdzsKICAgICAgICBob2xkID0gc3RhdGUuaG9sZDsKICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICBsY29kZSA9IHN0YXRlLmxlbmNvZGU7CiAgICAgICAgZGNvZGUgPSBzdGF0ZS5kaXN0Y29kZTsKICAgICAgICBsbWFzayA9ICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMTsKICAgICAgICBkbWFzayA9ICgxIDw8IHN0YXRlLmRpc3RiaXRzKSAtIDE7CiAgICAgICAgdG9wOgogICAgICAgICAgZG8gewogICAgICAgICAgICBpZiAoYml0cyA8IDE1KSB7CiAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaGVyZSA9IGxjb2RlW2hvbGQgJiBsbWFza107CiAgICAgICAgICAgIGRvbGVuOgogICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAyNDsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgIGJpdHMgLT0gb3A7CiAgICAgICAgICAgICAgICBvcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgaWYgKG9wID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChvcCAmIDE2KSB7CiAgICAgICAgICAgICAgICAgIGxlbiA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgb3AgJj0gMTU7CiAgICAgICAgICAgICAgICAgIGlmIChvcCkgewogICAgICAgICAgICAgICAgICAgIGlmIChiaXRzIDwgb3ApIHsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGxlbiArPSBob2xkICYgKDEgPDwgb3ApIC0gMTsKICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IDE1KSB7CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGVyZSA9IGRjb2RlW2hvbGQgJiBkbWFza107CiAgICAgICAgICAgICAgICAgIGRvZGlzdDoKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICAgIG9wID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCAmIDE2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3QgPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgICAgICAgIG9wICY9IDE1OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZGlzdCArPSBob2xkICYgKDEgPDwgb3ApIC0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpc3QgPiBkbWF4KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2siOwogICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgb3AgPSBfb3V0IC0gYmVnOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGlzdCA+IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgb3AgPSBkaXN0IC0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wID4gd2hhdmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgdG9vIGZhciBiYWNrIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IHNfd2luZG93OwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3bmV4dCA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSArPSB3c2l6ZSAtIG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wIDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh3bmV4dCA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tICs9IHdzaXplICsgd25leHQgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wIC09IHduZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wIDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod25leHQgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcCA9IHduZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gb3V0cHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gKz0gd25leHQgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gb3V0cHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAobGVuID4gMikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IDM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4gPiAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSAzOwogICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiA+IDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuID4gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgob3AgJiA2NCkgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgaGVyZSA9IGRjb2RlWyhoZXJlICYgNjU1MzUpICsgKGhvbGQgJiAoMSA8PCBvcCkgLSAxKV07CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlIGRvZGlzdDsKICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgY29kZSI7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoKG9wICYgNjQpID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBsY29kZVsoaGVyZSAmIDY1NTM1KSArIChob2xkICYgKDEgPDwgb3ApIC0gMSldOwogICAgICAgICAgICAgICAgICBjb250aW51ZSBkb2xlbjsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAob3AgJiAzMikgewogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgfQogICAgICAgICAgfSB3aGlsZSAoX2luIDwgbGFzdCAmJiBfb3V0IDwgZW5kKTsKICAgICAgICBsZW4gPSBiaXRzID4+IDM7CiAgICAgICAgX2luIC09IGxlbjsKICAgICAgICBiaXRzIC09IGxlbiA8PCAzOwogICAgICAgIGhvbGQgJj0gKDEgPDwgYml0cykgLSAxOwogICAgICAgIHN0cm0ubmV4dF9pbiA9IF9pbjsKICAgICAgICBzdHJtLm5leHRfb3V0ID0gX291dDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gX2luIDwgbGFzdCA/IDUgKyAobGFzdCAtIF9pbikgOiA1IC0gKF9pbiAtIGxhc3QpOwogICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gX291dCA8IGVuZCA/IDI1NyArIChlbmQgLSBfb3V0KSA6IDI1NyAtIChfb3V0IC0gZW5kKTsKICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICBzdGF0ZS5iaXRzID0gYml0czsKICAgICAgICByZXR1cm47CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9pbmZ0cmVlcy5qcwogIHZhciByZXF1aXJlX2luZnRyZWVzID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2luZnRyZWVzLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIHV0aWxzID0gcmVxdWlyZV9jb21tb24oKTsKICAgICAgdmFyIE1BWEJJVFMgPSAxNTsKICAgICAgdmFyIEVOT1VHSF9MRU5TID0gODUyOwogICAgICB2YXIgRU5PVUdIX0RJU1RTID0gNTkyOwogICAgICB2YXIgQ09ERVMgPSAwOwogICAgICB2YXIgTEVOUyA9IDE7CiAgICAgIHZhciBESVNUUyA9IDI7CiAgICAgIHZhciBsYmFzZSA9IFsKICAgICAgICAzLAogICAgICAgIDQsCiAgICAgICAgNSwKICAgICAgICA2LAogICAgICAgIDcsCiAgICAgICAgOCwKICAgICAgICA5LAogICAgICAgIDEwLAogICAgICAgIDExLAogICAgICAgIDEzLAogICAgICAgIDE1LAogICAgICAgIDE3LAogICAgICAgIDE5LAogICAgICAgIDIzLAogICAgICAgIDI3LAogICAgICAgIDMxLAogICAgICAgIDM1LAogICAgICAgIDQzLAogICAgICAgIDUxLAogICAgICAgIDU5LAogICAgICAgIDY3LAogICAgICAgIDgzLAogICAgICAgIDk5LAogICAgICAgIDExNSwKICAgICAgICAxMzEsCiAgICAgICAgMTYzLAogICAgICAgIDE5NSwKICAgICAgICAyMjcsCiAgICAgICAgMjU4LAogICAgICAgIDAsCiAgICAgICAgMAogICAgICBdOwogICAgICB2YXIgbGV4dCA9IFsKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAxNiwKICAgICAgICA3MiwKICAgICAgICA3OAogICAgICBdOwogICAgICB2YXIgZGJhc2UgPSBbCiAgICAgICAgMSwKICAgICAgICAyLAogICAgICAgIDMsCiAgICAgICAgNCwKICAgICAgICA1LAogICAgICAgIDcsCiAgICAgICAgOSwKICAgICAgICAxMywKICAgICAgICAxNywKICAgICAgICAyNSwKICAgICAgICAzMywKICAgICAgICA0OSwKICAgICAgICA2NSwKICAgICAgICA5NywKICAgICAgICAxMjksCiAgICAgICAgMTkzLAogICAgICAgIDI1NywKICAgICAgICAzODUsCiAgICAgICAgNTEzLAogICAgICAgIDc2OSwKICAgICAgICAxMDI1LAogICAgICAgIDE1MzcsCiAgICAgICAgMjA0OSwKICAgICAgICAzMDczLAogICAgICAgIDQwOTcsCiAgICAgICAgNjE0NSwKICAgICAgICA4MTkzLAogICAgICAgIDEyMjg5LAogICAgICAgIDE2Mzg1LAogICAgICAgIDI0NTc3LAogICAgICAgIDAsCiAgICAgICAgMAogICAgICBdOwogICAgICB2YXIgZGV4dCA9IFsKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMiwKICAgICAgICAyMiwKICAgICAgICAyMywKICAgICAgICAyMywKICAgICAgICAyNCwKICAgICAgICAyNCwKICAgICAgICAyNSwKICAgICAgICAyNSwKICAgICAgICAyNiwKICAgICAgICAyNiwKICAgICAgICAyNywKICAgICAgICAyNywKICAgICAgICAyOCwKICAgICAgICAyOCwKICAgICAgICAyOSwKICAgICAgICAyOSwKICAgICAgICA2NCwKICAgICAgICA2NAogICAgICBdOwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBmdW5jdGlvbiBpbmZsYXRlX3RhYmxlKHR5cGUsIGxlbnMsIGxlbnNfaW5kZXgsIGNvZGVzLCB0YWJsZSwgdGFibGVfaW5kZXgsIHdvcmssIG9wdHMpIHsKICAgICAgICB2YXIgYml0cyA9IG9wdHMuYml0czsKICAgICAgICB2YXIgbGVuID0gMDsKICAgICAgICB2YXIgc3ltID0gMDsKICAgICAgICB2YXIgbWluID0gMCwgbWF4ID0gMDsKICAgICAgICB2YXIgcm9vdDIgPSAwOwogICAgICAgIHZhciBjdXJyID0gMDsKICAgICAgICB2YXIgZHJvcCA9IDA7CiAgICAgICAgdmFyIGxlZnQgPSAwOwogICAgICAgIHZhciB1c2VkID0gMDsKICAgICAgICB2YXIgaHVmZiA9IDA7CiAgICAgICAgdmFyIGluY3I7CiAgICAgICAgdmFyIGZpbGw7CiAgICAgICAgdmFyIGxvdzsKICAgICAgICB2YXIgbWFzazsKICAgICAgICB2YXIgbmV4dDsKICAgICAgICB2YXIgYmFzZSA9IG51bGw7CiAgICAgICAgdmFyIGJhc2VfaW5kZXggPSAwOwogICAgICAgIHZhciBlbmQ7CiAgICAgICAgdmFyIGNvdW50ID0gbmV3IHV0aWxzLkJ1ZjE2KE1BWEJJVFMgKyAxKTsKICAgICAgICB2YXIgb2ZmcyA9IG5ldyB1dGlscy5CdWYxNihNQVhCSVRTICsgMSk7CiAgICAgICAgdmFyIGV4dHJhID0gbnVsbDsKICAgICAgICB2YXIgZXh0cmFfaW5kZXggPSAwOwogICAgICAgIHZhciBoZXJlX2JpdHMsIGhlcmVfb3AsIGhlcmVfdmFsOwogICAgICAgIGZvciAobGVuID0gMDsgbGVuIDw9IE1BWEJJVFM7IGxlbisrKSB7CiAgICAgICAgICBjb3VudFtsZW5dID0gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChzeW0gPSAwOyBzeW0gPCBjb2Rlczsgc3ltKyspIHsKICAgICAgICAgIGNvdW50W2xlbnNbbGVuc19pbmRleCArIHN5bV1dKys7CiAgICAgICAgfQogICAgICAgIHJvb3QyID0gYml0czsKICAgICAgICBmb3IgKG1heCA9IE1BWEJJVFM7IG1heCA+PSAxOyBtYXgtLSkgewogICAgICAgICAgaWYgKGNvdW50W21heF0gIT09IDApIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChyb290MiA+IG1heCkgewogICAgICAgICAgcm9vdDIgPSBtYXg7CiAgICAgICAgfQogICAgICAgIGlmIChtYXggPT09IDApIHsKICAgICAgICAgIHRhYmxlW3RhYmxlX2luZGV4KytdID0gMSA8PCAyNCB8IDY0IDw8IDE2IHwgMDsKICAgICAgICAgIHRhYmxlW3RhYmxlX2luZGV4KytdID0gMSA8PCAyNCB8IDY0IDw8IDE2IHwgMDsKICAgICAgICAgIG9wdHMuYml0cyA9IDE7CiAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChtaW4gPSAxOyBtaW4gPCBtYXg7IG1pbisrKSB7CiAgICAgICAgICBpZiAoY291bnRbbWluXSAhPT0gMCkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvb3QyIDwgbWluKSB7CiAgICAgICAgICByb290MiA9IG1pbjsKICAgICAgICB9CiAgICAgICAgbGVmdCA9IDE7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPD0gTUFYQklUUzsgbGVuKyspIHsKICAgICAgICAgIGxlZnQgPDw9IDE7CiAgICAgICAgICBsZWZ0IC09IGNvdW50W2xlbl07CiAgICAgICAgICBpZiAobGVmdCA8IDApIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAobGVmdCA+IDAgJiYgKHR5cGUgPT09IENPREVTIHx8IG1heCAhPT0gMSkpIHsKICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgb2Zmc1sxXSA9IDA7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPCBNQVhCSVRTOyBsZW4rKykgewogICAgICAgICAgb2Zmc1tsZW4gKyAxXSA9IG9mZnNbbGVuXSArIGNvdW50W2xlbl07CiAgICAgICAgfQogICAgICAgIGZvciAoc3ltID0gMDsgc3ltIDwgY29kZXM7IHN5bSsrKSB7CiAgICAgICAgICBpZiAobGVuc1tsZW5zX2luZGV4ICsgc3ltXSAhPT0gMCkgewogICAgICAgICAgICB3b3JrW29mZnNbbGVuc1tsZW5zX2luZGV4ICsgc3ltXV0rK10gPSBzeW07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICh0eXBlID09PSBDT0RFUykgewogICAgICAgICAgYmFzZSA9IGV4dHJhID0gd29yazsKICAgICAgICAgIGVuZCA9IDE5OwogICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PT0gTEVOUykgewogICAgICAgICAgYmFzZSA9IGxiYXNlOwogICAgICAgICAgYmFzZV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBleHRyYSA9IGxleHQ7CiAgICAgICAgICBleHRyYV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBlbmQgPSAyNTY7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGJhc2UgPSBkYmFzZTsKICAgICAgICAgIGV4dHJhID0gZGV4dDsKICAgICAgICAgIGVuZCA9IC0xOwogICAgICAgIH0KICAgICAgICBodWZmID0gMDsKICAgICAgICBzeW0gPSAwOwogICAgICAgIGxlbiA9IG1pbjsKICAgICAgICBuZXh0ID0gdGFibGVfaW5kZXg7CiAgICAgICAgY3VyciA9IHJvb3QyOwogICAgICAgIGRyb3AgPSAwOwogICAgICAgIGxvdyA9IC0xOwogICAgICAgIHVzZWQgPSAxIDw8IHJvb3QyOwogICAgICAgIG1hc2sgPSB1c2VkIC0gMTsKICAgICAgICBpZiAodHlwZSA9PT0gTEVOUyAmJiB1c2VkID4gRU5PVUdIX0xFTlMgfHwgdHlwZSA9PT0gRElTVFMgJiYgdXNlZCA+IEVOT1VHSF9ESVNUUykgewogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaGVyZV9iaXRzID0gbGVuIC0gZHJvcDsKICAgICAgICAgIGlmICh3b3JrW3N5bV0gPCBlbmQpIHsKICAgICAgICAgICAgaGVyZV9vcCA9IDA7CiAgICAgICAgICAgIGhlcmVfdmFsID0gd29ya1tzeW1dOwogICAgICAgICAgfSBlbHNlIGlmICh3b3JrW3N5bV0gPiBlbmQpIHsKICAgICAgICAgICAgaGVyZV9vcCA9IGV4dHJhW2V4dHJhX2luZGV4ICsgd29ya1tzeW1dXTsKICAgICAgICAgICAgaGVyZV92YWwgPSBiYXNlW2Jhc2VfaW5kZXggKyB3b3JrW3N5bV1dOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgaGVyZV9vcCA9IDMyICsgNjQ7CiAgICAgICAgICAgIGhlcmVfdmFsID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIGluY3IgPSAxIDw8IGxlbiAtIGRyb3A7CiAgICAgICAgICBmaWxsID0gMSA8PCBjdXJyOwogICAgICAgICAgbWluID0gZmlsbDsKICAgICAgICAgIGRvIHsKICAgICAgICAgICAgZmlsbCAtPSBpbmNyOwogICAgICAgICAgICB0YWJsZVtuZXh0ICsgKGh1ZmYgPj4gZHJvcCkgKyBmaWxsXSA9IGhlcmVfYml0cyA8PCAyNCB8IGhlcmVfb3AgPDwgMTYgfCBoZXJlX3ZhbCB8IDA7CiAgICAgICAgICB9IHdoaWxlIChmaWxsICE9PSAwKTsKICAgICAgICAgIGluY3IgPSAxIDw8IGxlbiAtIDE7CiAgICAgICAgICB3aGlsZSAoaHVmZiAmIGluY3IpIHsKICAgICAgICAgICAgaW5jciA+Pj0gMTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChpbmNyICE9PSAwKSB7CiAgICAgICAgICAgIGh1ZmYgJj0gaW5jciAtIDE7CiAgICAgICAgICAgIGh1ZmYgKz0gaW5jcjsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGh1ZmYgPSAwOwogICAgICAgICAgfQogICAgICAgICAgc3ltKys7CiAgICAgICAgICBpZiAoLS1jb3VudFtsZW5dID09PSAwKSB7CiAgICAgICAgICAgIGlmIChsZW4gPT09IG1heCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxlbiA9IGxlbnNbbGVuc19pbmRleCArIHdvcmtbc3ltXV07CiAgICAgICAgICB9CiAgICAgICAgICBpZiAobGVuID4gcm9vdDIgJiYgKGh1ZmYgJiBtYXNrKSAhPT0gbG93KSB7CiAgICAgICAgICAgIGlmIChkcm9wID09PSAwKSB7CiAgICAgICAgICAgICAgZHJvcCA9IHJvb3QyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG5leHQgKz0gbWluOwogICAgICAgICAgICBjdXJyID0gbGVuIC0gZHJvcDsKICAgICAgICAgICAgbGVmdCA9IDEgPDwgY3VycjsKICAgICAgICAgICAgd2hpbGUgKGN1cnIgKyBkcm9wIDwgbWF4KSB7CiAgICAgICAgICAgICAgbGVmdCAtPSBjb3VudFtjdXJyICsgZHJvcF07CiAgICAgICAgICAgICAgaWYgKGxlZnQgPD0gMCkgewogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGN1cnIrKzsKICAgICAgICAgICAgICBsZWZ0IDw8PSAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHVzZWQgKz0gMSA8PCBjdXJyOwogICAgICAgICAgICBpZiAodHlwZSA9PT0gTEVOUyAmJiB1c2VkID4gRU5PVUdIX0xFTlMgfHwgdHlwZSA9PT0gRElTVFMgJiYgdXNlZCA+IEVOT1VHSF9ESVNUUykgewogICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxvdyA9IGh1ZmYgJiBtYXNrOwogICAgICAgICAgICB0YWJsZVtsb3ddID0gcm9vdDIgPDwgMjQgfCBjdXJyIDw8IDE2IHwgbmV4dCAtIHRhYmxlX2luZGV4IHwgMDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKGh1ZmYgIT09IDApIHsKICAgICAgICAgIHRhYmxlW25leHQgKyBodWZmXSA9IGxlbiAtIGRyb3AgPDwgMjQgfCA2NCA8PCAxNiB8IDA7CiAgICAgICAgfQogICAgICAgIG9wdHMuYml0cyA9IHJvb3QyOwogICAgICAgIHJldHVybiAwOwogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28v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ogICAgICB2YXIgRVhUUkEgPSA2OwogICAgICB2YXIgTkFNRSA9IDc7CiAgICAgIHZhciBDT01NRU5UID0gODsKICAgICAgdmFyIEhDUkMgPSA5OwogICAgICB2YXIgRElDVElEID0gMTA7CiAgICAgIHZhciBESUNUID0gMTE7CiAgICAgIHZhciBUWVBFID0gMTI7CiAgICAgIHZhciBUWVBFRE8gPSAxMzsKICAgICAgdmFyIFNUT1JFRCA9IDE0OwogICAgICB2YXIgQ09QWV8gPSAxNTsKICAgICAgdmFyIENPUFkgPSAxNjsKICAgICAgdmFyIFRBQkxFID0gMTc7CiAgICAgIHZhciBMRU5MRU5TID0gMTg7CiAgICAgIHZhciBDT0RFTEVOUyA9IDE5OwogICAgICB2YXIgTEVOXyA9IDIwOwogICAgICB2YXIgTEVOID0gMjE7CiAgICAgIHZhciBMRU5FWFQgPSAyMjsKICAgICAgdmFyIERJU1QgPSAyMzsKICAgICAgdmFyIERJU1RFWFQgPSAyNDsKICAgICAgdmFyIE1BVENIID0gMjU7CiAgICAgIHZhciBMSVQgPSAyNjsKICAgICAgdmFyIENIRUNLID0gMjc7CiAgICAgIHZhciBMRU5HVEggPSAyODsKICAgICAgdmFyIERPTkUgPSAyOTsKICAgICAgdmFyIEJBRCA9IDMwOwogICAgICB2YXIgTUVNID0gMzE7CiAgICAgIHZhciBTWU5DID0gMzI7CiAgICAgIHZhciBFTk9VR0hfTEVOUyA9IDg1MjsKICAgICAgdmFyIEVOT1VHSF9ESVNUUyA9IDU5MjsKICAgICAgdmFyIE1BWF9XQklUUyA9IDE1OwogICAgICB2YXIgREVGX1dCSVRTID0gTUFYX1dCSVRTOwogICAgICBmdW5jdGlvbiB6c3dhcDMyKHEpIHsKICAgICAgICByZXR1cm4gKHEgPj4+IDI0ICYgMjU1KSArIChxID4+PiA4ICYgNjUyODApICsgKChxICYgNjUyODApIDw8IDgpICsgKChxICYgMjU1KSA8PCAyNCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gSW5mbGF0ZVN0YXRlKCkgewogICAgICAgIHRoaXMubW9kZSA9IDA7CiAgICAgICAgdGhpcy5sYXN0ID0gZmFsc2U7CiAgICAgICAgdGhpcy53cmFwID0gMDsKICAgICAgICB0aGlzLmhhdmVkaWN0ID0gZmFsc2U7CiAgICAgICAgdGhpcy5mbGFncyA9IDA7CiAgICAgICAgdGhpcy5kbWF4ID0gMDsKICAgICAgICB0aGlzLmNoZWNrID0gMDsKICAgICAgICB0aGlzLnRvdGFsID0gMDsKICAgICAgICB0aGlzLmhlYWQgPSBudWxsOwogICAgICAgIHRoaXMud2JpdHMgPSAwOwogICAgICAgIHRoaXMud3NpemUgPSAwOwogICAgICAgIHRoaXMud2hhdmUgPSAwOwogICAgICAgIHRoaXMud25leHQgPSAwOwogICAgICAgIHRoaXMud2luZG93ID0gbnVsbDsKICAgICAgICB0aGlzLmhvbGQgPSAwOwogICAgICAgIHRoaXMuYml0cyA9IDA7CiAgICAgICAgdGhpcy5sZW5ndGggPSAwOwogICAgICAgIHRoaXMub2Zmc2V0ID0gMDsKICAgICAgICB0aGlzLmV4dHJhID0gMDsKICAgICAgICB0aGlzLmxlbmNvZGUgPSBudWxsOwogICAgICAgIHRoaXMuZGlzdGNvZGUgPSBudWxsOwogICAgICAgIHRoaXMubGVuYml0cyA9IDA7CiAgICAgICAgdGhpcy5kaXN0Yml0cyA9IDA7CiAgICAgICAgdGhpcy5uY29kZSA9IDA7CiAgICAgICAgdGhpcy5ubGVuID0gMDsKICAgICAgICB0aGlzLm5kaXN0ID0gMDsKICAgICAgICB0aGlzLmhhdmUgPSAwOwogICAgICAgIHRoaXMubmV4dCA9IG51bGw7CiAgICAgICAgdGhpcy5sZW5zID0gbmV3IHV0aWxzLkJ1ZjE2KDMyMCk7CiAgICAgICAgdGhpcy53b3JrID0gbmV3IHV0aWxzLkJ1ZjE2KDI4OCk7CiAgICAgICAgdGhpcy5sZW5keW4gPSBudWxsOwogICAgICAgIHRoaXMuZGlzdGR5biA9IG51bGw7CiAgICAgICAgdGhpcy5zYW5lID0gMDsKICAgICAgICB0aGlzLmJhY2sgPSAwOwogICAgICAgIHRoaXMud2FzID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlUmVzZXRLZWVwKHN0cm0pIHsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBzdHJtLnRvdGFsX2luID0gc3RybS50b3RhbF9vdXQgPSBzdGF0ZS50b3RhbCA9IDA7CiAgICAgICAgc3RybS5tc2cgPSAiIjsKICAgICAgICBpZiAoc3RhdGUud3JhcCkgewogICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLndyYXAgJiAxOwogICAgICAgIH0KICAgICAgICBzdGF0ZS5tb2RlID0gSEVBRDsKICAgICAgICBzdGF0ZS5sYXN0ID0gMDsKICAgICAgICBzdGF0ZS5oYXZlZGljdCA9IDA7CiAgICAgICAgc3RhdGUuZG1heCA9IDMyNzY4OwogICAgICAgIHN0YXRlLmhlYWQgPSBudWxsOwogICAgICAgIHN0YXRlLmhvbGQgPSAwOwogICAgICAgIHN0YXRlLmJpdHMgPSAwOwogICAgICAgIHN0YXRlLmxlbmNvZGUgPSBzdGF0ZS5sZW5keW4gPSBuZXcgdXRpbHMuQnVmMzIoRU5PVUdIX0xFTlMpOwogICAgICAgIHN0YXRlLmRpc3Rjb2RlID0gc3RhdGUuZGlzdGR5biA9IG5ldyB1dGlscy5CdWYzMihFTk9VR0hfRElTVFMpOwogICAgICAgIHN0YXRlLnNhbmUgPSAxOwogICAgICAgIHN0YXRlLmJhY2sgPSAtMTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlUmVzZXQoc3RybSkgewogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIHN0YXRlLndzaXplID0gMDsKICAgICAgICBzdGF0ZS53aGF2ZSA9IDA7CiAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgIHJldHVybiBpbmZsYXRlUmVzZXRLZWVwKHN0cm0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVSZXNldDIoc3RybSwgd2luZG93Qml0cykgewogICAgICAgIHZhciB3cmFwOwogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICh3aW5kb3dCaXRzIDwgMCkgewogICAgICAgICAgd3JhcCA9IDA7CiAgICAgICAgICB3aW5kb3dCaXRzID0gLXdpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHdyYXAgPSAod2luZG93Qml0cyA+PiA0KSArIDE7CiAgICAgICAgICBpZiAod2luZG93Qml0cyA8IDQ4KSB7CiAgICAgICAgICAgIHdpbmRvd0JpdHMgJj0gMTU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICh3aW5kb3dCaXRzICYmICh3aW5kb3dCaXRzIDwgOCB8fCB3aW5kb3dCaXRzID4gMTUpKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdGF0ZS53aW5kb3cgIT09IG51bGwgJiYgc3RhdGUud2JpdHMgIT09IHdpbmRvd0JpdHMpIHsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHN0YXRlLndyYXAgPSB3cmFwOwogICAgICAgIHN0YXRlLndiaXRzID0gd2luZG93Qml0czsKICAgICAgICByZXR1cm4gaW5mbGF0ZVJlc2V0KHN0cm0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVJbml0MihzdHJtLCB3aW5kb3dCaXRzKSB7CiAgICAgICAgdmFyIHJldDsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgaWYgKCFzdHJtKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gbmV3IEluZmxhdGVTdGF0ZSgpOwogICAgICAgIHN0cm0uc3RhdGUgPSBzdGF0ZTsKICAgICAgICBzdGF0ZS53aW5kb3cgPSBudWxsOwogICAgICAgIHJldCA9IGluZmxhdGVSZXNldDIoc3RybSwgd2luZG93Qml0cyk7CiAgICAgICAgaWYgKHJldCAhPT0gWl9PSykgewogICAgICAgICAgc3RybS5zdGF0ZSA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZUluaXQoc3RybSkgewogICAgICAgIHJldHVybiBpbmZsYXRlSW5pdDIoc3RybSwgREVGX1dCSVRTKTsKICAgICAgfQogICAgICB2YXIgdmlyZ2luID0gdHJ1ZTsKICAgICAgdmFyIGxlbmZpeDsKICAgICAgdmFyIGRpc3RmaXg7CiAgICAgIGZ1bmN0aW9uIGZpeGVkdGFibGVzKHN0YXRlKSB7CiAgICAgICAgaWYgKHZpcmdpbikgewogICAgICAgICAgdmFyIHN5bTsKICAgICAgICAgIGxlbmZpeCA9IG5ldyB1dGlscy5CdWYzMig1MTIpOwogICAgICAgICAgZGlzdGZpeCA9IG5ldyB1dGlscy5CdWYzMigzMik7CiAgICAgICAgICBzeW0gPSAwOwogICAgICAgICAgd2hpbGUgKHN5bSA8IDE0NCkgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDg7CiAgICAgICAgICB9CiAgICAgICAgICB3aGlsZSAoc3ltIDwgMjU2KSB7CiAgICAgICAgICAgIHN0YXRlLmxlbnNbc3ltKytdID0gOTsKICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzeW0gPCAyODApIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA3OwogICAgICAgICAgfQogICAgICAgICAgd2hpbGUgKHN5bSA8IDI4OCkgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDg7CiAgICAgICAgICB9CiAgICAgICAgICBpbmZsYXRlX3RhYmxlKExFTlMsIHN0YXRlLmxlbnMsIDAsIDI4OCwgbGVuZml4LCAwLCBzdGF0ZS53b3JrLCB7IGJpdHM6IDkgfSk7CiAgICAgICAgICBzeW0gPSAwOwogICAgICAgICAgd2hpbGUgKHN5bSA8IDMyKSB7CiAgICAgICAgICAgIHN0YXRlLmxlbnNbc3ltKytdID0gNTsKICAgICAgICAgIH0KICAgICAgICAgIGluZmxhdGVfdGFibGUoRElTVFMsIHN0YXRlLmxlbnMsIDAsIDMyLCBkaXN0Zml4LCAwLCBzdGF0ZS53b3JrLCB7IGJpdHM6IDUgfSk7CiAgICAgICAgICB2aXJnaW4gPSBmYWxzZTsKICAgICAgICB9CiAgICAgICAgc3RhdGUubGVuY29kZSA9IGxlbmZpeDsKICAgICAgICBzdGF0ZS5sZW5iaXRzID0gOTsKICAgICAgICBzdGF0ZS5kaXN0Y29kZSA9IGRpc3RmaXg7CiAgICAgICAgc3RhdGUuZGlzdGJpdHMgPSA1OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHVwZGF0ZXdpbmRvdyhzdHJtLCBzcmMsIGVuZCwgY29weSkgewogICAgICAgIHZhciBkaXN0OwogICAgICAgIHZhciBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgaWYgKHN0YXRlLndpbmRvdyA9PT0gbnVsbCkgewogICAgICAgICAgc3RhdGUud3NpemUgPSAxIDw8IHN0YXRlLndiaXRzOwogICAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgICAgc3RhdGUud2hhdmUgPSAwOwogICAgICAgICAgc3RhdGUud2luZG93ID0gbmV3IHV0aWxzLkJ1Zjgoc3RhdGUud3NpemUpOwogICAgICAgIH0KICAgICAgICBpZiAoY29weSA+PSBzdGF0ZS53c2l6ZSkgewogICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUud2luZG93LCBzcmMsIGVuZCAtIHN0YXRlLndzaXplLCBzdGF0ZS53c2l6ZSwgMCk7CiAgICAgICAgICBzdGF0ZS53bmV4dCA9IDA7CiAgICAgICAgICBzdGF0ZS53aGF2ZSA9IHN0YXRlLndzaXplOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBkaXN0ID0gc3RhdGUud3NpemUgLSBzdGF0ZS53bmV4dDsKICAgICAgICAgIGlmIChkaXN0ID4gY29weSkgewogICAgICAgICAgICBkaXN0ID0gY29weTsKICAgICAgICAgIH0KICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0YXRlLndpbmRvdywgc3JjLCBlbmQgLSBjb3B5LCBkaXN0LCBzdGF0ZS53bmV4dCk7CiAgICAgICAgICBjb3B5IC09IGRpc3Q7CiAgICAgICAgICBpZiAoY29weSkgewogICAgICAgICAgICB1dGlscy5hcnJheVNldChzdGF0ZS53aW5kb3csIHNyYywgZW5kIC0gY29weSwgY29weSwgMCk7CiAgICAgICAgICAgIHN0YXRlLnduZXh0ID0gY29weTsKICAgICAgICAgICAgc3RhdGUud2hhdmUgPSBzdGF0ZS53c2l6ZTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHN0YXRlLnduZXh0ICs9IGRpc3Q7CiAgICAgICAgICAgIGlmIChzdGF0ZS53bmV4dCA9PT0gc3RhdGUud3NpemUpIHsKICAgICAgICAgICAgICBzdGF0ZS53bmV4dCA9IDA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHN0YXRlLndoYXZlIDwgc3RhdGUud3NpemUpIHsKICAgICAgICAgICAgICBzdGF0ZS53aGF2ZSArPSBkaXN0OwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGUoc3RybSwgZmx1c2gpIHsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgdmFyIGlucHV0LCBvdXRwdXQ7CiAgICAgICAgdmFyIG5leHQ7CiAgICAgICAgdmFyIHB1dDsKICAgICAgICB2YXIgaGF2ZSwgbGVmdDsKICAgICAgICB2YXIgaG9sZDsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgX2luLCBfb3V0OwogICAgICAgIHZhciBjb3B5OwogICAgICAgIHZhciBmcm9tOwogICAgICAgIHZhciBmcm9tX3NvdXJjZTsKICAgICAgICB2YXIgaGVyZSA9IDA7CiAgICAgICAgdmFyIGhlcmVfYml0cywgaGVyZV9vcCwgaGVyZV92YWw7CiAgICAgICAgdmFyIGxhc3RfYml0cywgbGFzdF9vcCwgbGFzdF92YWw7CiAgICAgICAgdmFyIGxlbjsKICAgICAgICB2YXIgcmV0OwogICAgICAgIHZhciBoYnVmID0gbmV3IHV0aWxzLkJ1ZjgoNCk7CiAgICAgICAgdmFyIG9wdHM7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIG9yZGVyID0gWzE2LCAxNywgMTgsIDAsIDgsIDcsIDksIDYsIDEwLCA1LCAxMSwgNCwgMTIsIDMsIDEzLCAyLCAxNCwgMSwgMTVdOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSB8fCAhc3RybS5vdXRwdXQgfHwgIXN0cm0uaW5wdXQgJiYgc3RybS5hdmFpbF9pbiAhPT0gMCkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IFRZUEUpIHsKICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFRE87CiAgICAgICAgfQogICAgICAgIHB1dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgb3V0cHV0ID0gc3RybS5vdXRwdXQ7CiAgICAgICAgbGVmdCA9IHN0cm0uYXZhaWxfb3V0OwogICAgICAgIG5leHQgPSBzdHJtLm5leHRfaW47CiAgICAgICAgaW5wdXQgPSBzdHJtLmlucHV0OwogICAgICAgIGhhdmUgPSBzdHJtLmF2YWlsX2luOwogICAgICAgIGhvbGQgPSBzdGF0ZS5ob2xkOwogICAgICAgIGJpdHMgPSBzdGF0ZS5iaXRzOwogICAgICAgIF9pbiA9IGhhdmU7CiAgICAgICAgX291dCA9IGxlZnQ7CiAgICAgICAgcmV0ID0gWl9PSzsKICAgICAgICBpbmZfbGVhdmU6CiAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgc3dpdGNoIChzdGF0ZS5tb2RlKSB7CiAgICAgICAgICAgICAgY2FzZSBIRUFEOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLndyYXAgPT09IDApIHsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEVETzsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwICYgMiAmJiBob2xkID09PSAzNTYxNSkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IDA7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEZMQUdTOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmZsYWdzID0gMDsKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZG9uZSA9IGZhbHNlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCEoc3RhdGUud3JhcCAmIDEpIHx8ICgoKGhvbGQgJiAyNTUpIDw8IDgpICsgKGhvbGQgPj4gOCkpICUgMzEpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGhlYWRlciBjaGVjayI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKChob2xkICYgMTUpICE9PSBaX0RFRkxBVEVEKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInVua25vd24gY29tcHJlc3Npb24gbWV0aG9kIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNDsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNDsKICAgICAgICAgICAgICAgIGxlbiA9IChob2xkICYgMTUpICsgODsKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53Yml0cyA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS53Yml0cyA9IGxlbjsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobGVuID4gc3RhdGUud2JpdHMpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCB3aW5kb3cgc2l6ZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZG1heCA9IDEgPDwgbGVuOwogICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0gMTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBob2xkICYgNTEyID8gRElDVElEIDogVFlQRTsKICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIEZMQUdTOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5mbGFncyA9IGhvbGQ7CiAgICAgICAgICAgICAgICBpZiAoKHN0YXRlLmZsYWdzICYgMjU1KSAhPT0gWl9ERUZMQVRFRCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJ1bmtub3duIGNvbXByZXNzaW9uIG1ldGhvZCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTczNDQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAidW5rbm93biBoZWFkZXIgZmxhZ3Mgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnRleHQgPSBob2xkID4+IDggJiAxOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRJTUU7CiAgICAgICAgICAgICAgY2FzZSBUSU1FOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnRpbWUgPSBob2xkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsyXSA9IGhvbGQgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzNdID0gaG9sZCA+Pj4gMjQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGhidWYsIDQsIDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBPUzsKICAgICAgICAgICAgICBjYXNlIE9TOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnhmbGFncyA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQub3MgPSBob2xkID4+IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhidWZbMV0gPSBob2xkID4+PiA4ICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyKHN0YXRlLmNoZWNrLCBoYnVmLCAyLCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRVhMRU47CiAgICAgICAgICAgICAgY2FzZSBFWExFTjoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDEwMjQpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoID0gaG9sZDsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhX2xlbiA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEVYVFJBOwogICAgICAgICAgICAgIGNhc2UgRVhUUkE6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAxMDI0KSB7CiAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmhlYWQuZXh0cmFfbGVuIC0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgaWYgKCFzdGF0ZS5oZWFkLmV4dHJhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBuZXcgQXJyYXkoc3RhdGUuaGVhZC5leHRyYV9sZW4pOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUuaGVhZC5leHRyYSwgaW5wdXQsIG5leHQsIGNvcHksIGxlbik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCAtPSBjb3B5OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTkFNRTsKICAgICAgICAgICAgICBjYXNlIE5BTUU6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAyMDQ4KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGNvcHkgPSAwOwogICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgbGVuID0gaW5wdXRbbmV4dCArIGNvcHkrK107CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQgJiYgbGVuICYmIHN0YXRlLmxlbmd0aCA8IDY1NTM2KSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLm5hbWUgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShsZW4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobGVuICYmIGNvcHkgPCBoYXZlKTsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5uYW1lID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ09NTUVOVDsKICAgICAgICAgICAgICBjYXNlIENPTU1FTlQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA0MDk2KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGNvcHkgPSAwOwogICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgbGVuID0gaW5wdXRbbmV4dCArIGNvcHkrK107CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQgJiYgbGVuICYmIHN0YXRlLmxlbmd0aCA8IDY1NTM2KSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmNvbW1lbnQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShsZW4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobGVuICYmIGNvcHkgPCBoYXZlKTsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5jb21tZW50ID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBIQ1JDOwogICAgICAgICAgICAgIGNhc2UgSENSQzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaG9sZCAhPT0gKHN0YXRlLmNoZWNrICYgNjU1MzUpKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaGVhZGVyIGNyYyBtaXNtYXRjaCI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmhjcmMgPSBzdGF0ZS5mbGFncyA+PiA5ICYgMTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5kb25lID0gdHJ1ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgRElDVElEOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSB6c3dhcDMyKGhvbGQpOwogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESUNUOwogICAgICAgICAgICAgIGNhc2UgRElDVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlZGljdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfb3V0ID0gcHV0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGxlZnQ7CiAgICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9pbiA9IG5leHQ7CiAgICAgICAgICAgICAgICAgIHN0cm0uYXZhaWxfaW4gPSBoYXZlOwogICAgICAgICAgICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICAgICAgICAgICAgc3RhdGUuYml0cyA9IGJpdHM7CiAgICAgICAgICAgICAgICAgIHJldHVybiBaX05FRURfRElDVDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDE7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICBjYXNlIFRZUEU6CiAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfQkxPQ0sgfHwgZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGNhc2UgVFlQRURPOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxhc3QpIHsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ0hFQ0s7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxhc3QgPSBob2xkICYgMTsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAxOwogICAgICAgICAgICAgICAgYml0cyAtPSAxOwogICAgICAgICAgICAgICAgc3dpdGNoIChob2xkICYgMykgewogICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFNUT1JFRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgIGZpeGVkdGFibGVzKHN0YXRlKTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUQUJMRTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYmxvY2sgdHlwZSI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBTVE9SRUQ6CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gYml0cyAmIDc7CiAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhvbGQgJiA2NTUzNSkgIT09IChob2xkID4+PiAxNiBeIDY1NTM1KSkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIHN0b3JlZCBibG9jayBsZW5ndGhzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBob2xkICYgNjU1MzU7CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFlfOwogICAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX1RSRUVTKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBjYXNlIENPUFlfOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFk7CiAgICAgICAgICAgICAgY2FzZSBDT1BZOgogICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBsZWZ0OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KG91dHB1dCwgaW5wdXQsIG5leHQsIGNvcHksIHB1dCk7CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBsZWZ0IC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIHB1dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgVEFCTEU6CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE0KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm5sZW4gPSAoaG9sZCAmIDMxKSArIDI1NzsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA1OwogICAgICAgICAgICAgICAgYml0cyAtPSA1OwogICAgICAgICAgICAgICAgc3RhdGUubmRpc3QgPSAoaG9sZCAmIDMxKSArIDE7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNTsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNTsKICAgICAgICAgICAgICAgIHN0YXRlLm5jb2RlID0gKGhvbGQgJiAxNSkgKyA0OwogICAgICAgICAgICAgICAgaG9sZCA+Pj49IDQ7CiAgICAgICAgICAgICAgICBiaXRzIC09IDQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubmxlbiA+IDI4NiB8fCBzdGF0ZS5uZGlzdCA+IDMwKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInRvbyBtYW55IGxlbmd0aCBvciBkaXN0YW5jZSBzeW1ib2xzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5MRU5TOwogICAgICAgICAgICAgIGNhc2UgTEVOTEVOUzoKICAgICAgICAgICAgICAgIHdoaWxlIChzdGF0ZS5oYXZlIDwgc3RhdGUubmNvZGUpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW29yZGVyW3N0YXRlLmhhdmUrK11dID0gaG9sZCAmIDc7CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAzOwogICAgICAgICAgICAgICAgICBiaXRzIC09IDM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB3aGlsZSAoc3RhdGUuaGF2ZSA8IDE5KSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbb3JkZXJbc3RhdGUuaGF2ZSsrXV0gPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubGVuY29kZSA9IHN0YXRlLmxlbmR5bjsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA3OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShDT0RFUywgc3RhdGUubGVucywgMCwgMTksIHN0YXRlLmxlbmNvZGUsIDAsIHN0YXRlLndvcmssIG9wdHMpOwogICAgICAgICAgICAgICAgc3RhdGUubGVuYml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBjb2RlIGxlbmd0aHMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT0RFTEVOUzsKICAgICAgICAgICAgICBjYXNlIENPREVMRU5TOgogICAgICAgICAgICAgICAgd2hpbGUgKHN0YXRlLmhhdmUgPCBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgICAgaGVyZSA9IHN0YXRlLmxlbmNvZGVbaG9sZCAmICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhlcmVfdmFsIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSsrXSA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX3ZhbCA9PT0gMTYpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAyOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgY29weSA9IDMgKyAoaG9sZCAmIDMpOwogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IDI7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IDI7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChoZXJlX3ZhbCA9PT0gMTcpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAzOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICBjb3B5ID0gMyArIChob2xkICYgNyk7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gMzsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gMzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgbiA9IGhlcmVfYml0cyArIDc7CiAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgICAgbGVuID0gMDsKICAgICAgICAgICAgICAgICAgICAgIGNvcHkgPSAxMSArIChob2xkICYgMTI3KTsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA3OwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSA3OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSArIGNvcHkgPiBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB3aGlsZSAoY29weS0tKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBsZW47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubW9kZSA9PT0gQkFEKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxlbnNbMjU2XSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGNvZGUgLS0gbWlzc2luZyBlbmQtb2YtYmxvY2siOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA5OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShMRU5TLCBzdGF0ZS5sZW5zLCAwLCBzdGF0ZS5ubGVuLCBzdGF0ZS5sZW5jb2RlLCAwLCBzdGF0ZS53b3JrLCBvcHRzKTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgICAgICAgICBpZiAocmV0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgbGl0ZXJhbC9sZW5ndGhzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGJpdHMgPSA2OwogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGNvZGUgPSBzdGF0ZS5kaXN0ZHluOwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUuZGlzdGJpdHMgfTsKICAgICAgICAgICAgICAgIHJldCA9IGluZmxhdGVfdGFibGUoRElTVFMsIHN0YXRlLmxlbnMsIHN0YXRlLm5sZW4sIHN0YXRlLm5kaXN0LCBzdGF0ZS5kaXN0Y29kZSwgMCwgc3RhdGUud29yaywgb3B0cyk7CiAgICAgICAgICAgICAgICBzdGF0ZS5kaXN0Yml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZXMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9UUkVFUykgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgY2FzZSBMRU5fOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTjsKICAgICAgICAgICAgICBjYXNlIExFTjoKICAgICAgICAgICAgICAgIGlmIChoYXZlID49IDYgJiYgbGVmdCA+PSAyNTgpIHsKICAgICAgICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBsZWZ0OwogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaG9sZCA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgICAgICAgICAgICBpbmZsYXRlX2Zhc3Qoc3RybSwgX291dCk7CiAgICAgICAgICAgICAgICAgIHB1dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgICAgICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgICAgICAgICAgICBsZWZ0ID0gc3RybS5hdmFpbF9vdXQ7CiAgICAgICAgICAgICAgICAgIG5leHQgPSBzdHJtLm5leHRfaW47CiAgICAgICAgICAgICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICAgICAgICAgICAgaGF2ZSA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgICAgICAgICAgIGhvbGQgPSBzdGF0ZS5ob2xkOwogICAgICAgICAgICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IFRZUEUpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gMDsKICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtob2xkICYgKDEgPDwgc3RhdGUubGVuYml0cykgLSAxXTsKICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGVyZV92YWwgPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYmIChoZXJlX29wICYgMjQwKSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBsYXN0X2JpdHMgPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgIGxhc3Rfb3AgPSBoZXJlX29wOwogICAgICAgICAgICAgICAgICBsYXN0X3ZhbCA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBoZXJlX3ZhbDsKICAgICAgICAgICAgICAgIGlmIChoZXJlX29wID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMSVQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGhlcmVfb3AgJiAzMikgewogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYgNjQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5FWFQ7CiAgICAgICAgICAgICAgY2FzZSBMRU5FWFQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZXh0cmEpIHsKICAgICAgICAgICAgICAgICAgbiA9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCArPSBob2xkICYgKDEgPDwgc3RhdGUuZXh0cmEpIC0gMTsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBiaXRzIC09IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUud2FzID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IERJU1Q7CiAgICAgICAgICAgICAgY2FzZSBESVNUOgogICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtob2xkICYgKDEgPDwgc3RhdGUuZGlzdGJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICBoZXJlX29wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICBpZiAoaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhlcmVfb3AgJiAyNDApID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGxhc3RfYml0cyA9IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgbGFzdF9vcCA9IGhlcmVfb3A7CiAgICAgICAgICAgICAgICAgIGxhc3RfdmFsID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCAmIDY0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgY29kZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESVNURVhUOwogICAgICAgICAgICAgIGNhc2UgRElTVEVYVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5leHRyYSkgewogICAgICAgICAgICAgICAgICBuID0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ICs9IGhvbGQgJiAoMSA8PCBzdGF0ZS5leHRyYSkgLSAxOwogICAgICAgICAgICAgICAgICBob2xkID4+Pj0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIGJpdHMgLT0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gc3RhdGUuZG1heCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IE1BVENIOwogICAgICAgICAgICAgIGNhc2UgTUFUQ0g6CiAgICAgICAgICAgICAgICBpZiAobGVmdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjb3B5ID0gX291dCAtIGxlZnQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gY29weSkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gc3RhdGUub2Zmc2V0IC0gY29weTsKICAgICAgICAgICAgICAgICAgaWYgKGNvcHkgPiBzdGF0ZS53aGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gc3RhdGUud25leHQpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5IC09IHN0YXRlLnduZXh0OwogICAgICAgICAgICAgICAgICAgIGZyb20gPSBzdGF0ZS53c2l6ZSAtIGNvcHk7CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZnJvbSA9IHN0YXRlLnduZXh0IC0gY29weTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IHN0YXRlLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBzdGF0ZS53aW5kb3c7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgZnJvbSA9IHB1dCAtIHN0YXRlLm9mZnNldDsKICAgICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gbGVmdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGxlZnQgLT0gY29weTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCAtPSBjb3B5OwogICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICBvdXRwdXRbcHV0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tY29weSk7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIExJVDoKICAgICAgICAgICAgICAgIGlmIChsZWZ0ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG91dHB1dFtwdXQrK10gPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICBsZWZ0LS07CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBDSEVDSzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCB8PSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIF9vdXQgLT0gbGVmdDsKICAgICAgICAgICAgICAgICAgc3RybS50b3RhbF9vdXQgKz0gX291dDsKICAgICAgICAgICAgICAgICAgc3RhdGUudG90YWwgKz0gX291dDsKICAgICAgICAgICAgICAgICAgaWYgKF9vdXQpIHsKICAgICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSBzdGF0ZS5mbGFncyA/IGNyYzMyKHN0YXRlLmNoZWNrLCBvdXRwdXQsIF9vdXQsIHB1dCAtIF9vdXQpIDogYWRsZXIzMihzdGF0ZS5jaGVjaywgb3V0cHV0LCBfb3V0LCBwdXQgLSBfb3V0KTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBfb3V0ID0gbGVmdDsKICAgICAgICAgICAgICAgICAgaWYgKChzdGF0ZS5mbGFncyA/IGhvbGQgOiB6c3dhcDMyKGhvbGQpKSAhPT0gc3RhdGUuY2hlY2spIHsKICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbmNvcnJlY3QgZGF0YSBjaGVjayI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOR1RIOwogICAgICAgICAgICAgIGNhc2UgTEVOR1RIOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLndyYXAgJiYgc3RhdGUuZmxhZ3MpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhvbGQgIT09IChzdGF0ZS50b3RhbCAmIDQyOTQ5NjcyOTUpKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGxlbmd0aCBjaGVjayI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRE9ORTsKICAgICAgICAgICAgICBjYXNlIERPTkU6CiAgICAgICAgICAgICAgICByZXQgPSBaX1NUUkVBTV9FTkQ7CiAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgY2FzZSBCQUQ6CiAgICAgICAgICAgICAgICByZXQgPSBaX0RBVEFfRVJST1I7CiAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgY2FzZSBNRU06CiAgICAgICAgICAgICAgICByZXR1cm4gWl9NRU1fRVJST1I7CiAgICAgICAgICAgICAgY2FzZSBTWU5DOgogICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICBzdHJtLm5leHRfb3V0ID0gcHV0OwogICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gbGVmdDsKICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0OwogICAgICAgIHN0cm0uYXZhaWxfaW4gPSBoYXZlOwogICAgICAgIHN0YXRlLmhvbGQgPSBob2xkOwogICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgIGlmIChzdGF0ZS53c2l6ZSB8fCBfb3V0ICE9PSBzdHJtLmF2YWlsX291dCAmJiBzdGF0ZS5tb2RlIDwgQkFEICYmIChzdGF0ZS5tb2RlIDwgQ0hFQ0sgfHwgZmx1c2ggIT09IFpfRklOSVNIKSkgewogICAgICAgICAgaWYgKHVwZGF0ZXdpbmRvdyhzdHJtLCBzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCwgX291dCAtIHN0cm0uYXZhaWxfb3V0KSkgewogICAgICAgICAgICBzdGF0ZS5tb2RlID0gTUVNOwogICAgICAgICAgICByZXR1cm4gWl9NRU1fRVJST1I7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIF9pbiAtPSBzdHJtLmF2YWlsX2luOwogICAgICAgIF9vdXQgLT0gc3RybS5hdmFpbF9vdXQ7CiAgICAgICAgc3RybS50b3RhbF9pbiArPSBfaW47CiAgICAgICAgc3RybS50b3RhbF9vdXQgKz0gX291dDsKICAgICAgICBzdGF0ZS50b3RhbCArPSBfb3V0OwogICAgICAgIGlmIChzdGF0ZS53cmFwICYmIF9vdXQpIHsKICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IHN0YXRlLmZsYWdzID8gY3JjMzIoc3RhdGUuY2hlY2ssIG91dHB1dCwgX291dCwgc3RybS5uZXh0X291dCAtIF9vdXQpIDogYWRsZXIzMihzdGF0ZS5jaGVjaywgb3V0cHV0LCBfb3V0LCBzdHJtLm5leHRfb3V0IC0gX291dCk7CiAgICAgICAgfQogICAgICAgIHN0cm0uZGF0YV90eXBlID0gc3RhdGUuYml0cyArIChzdGF0ZS5sYXN0ID8gNjQgOiAwKSArIChzdGF0ZS5tb2RlID09PSBUWVBFID8gMTI4IDogMCkgKyAoc3RhdGUubW9kZSA9PT0gTEVOXyB8fCBzdGF0ZS5tb2RlID09PSBDT1BZXyA/IDI1NiA6IDApOwogICAgICAgIGlmICgoX2luID09PSAwICYmIF9vdXQgPT09IDAgfHwgZmx1c2ggPT09IFpfRklOSVNIKSAmJiByZXQgPT09IFpfT0spIHsKICAgICAgICAgIHJldCA9IFpfQlVGX0VSUk9SOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmV0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVFbmQoc3RybSkgewogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICB2YXIgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS53aW5kb3cpIHsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHN0cm0uc3RhdGUgPSBudWxsOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVHZXRIZWFkZXIoc3RybSwgaGVhZCkgewogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICgoc3RhdGUud3JhcCAmIDIpID09PSAwKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlLmhlYWQgPSBoZWFkOwogICAgICAgIGhlYWQuZG9uZSA9IGZhbHNlOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVTZXREaWN0aW9uYXJ5KHN0cm0sIGRpY3Rpb25hcnkpIHsKICAgICAgICB2YXIgZGljdExlbmd0aCA9IGRpY3Rpb25hcnkubGVuZ3RoOwogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICB2YXIgZGljdGlkOwogICAgICAgIHZhciByZXQ7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBpZiAoc3RhdGUud3JhcCAhPT0gMCAmJiBzdGF0ZS5tb2RlICE9PSBESUNUKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdGF0ZS5tb2RlID09PSBESUNUKSB7CiAgICAgICAgICBkaWN0aWQgPSAxOwogICAgICAgICAgZGljdGlkID0gYWRsZXIzMihkaWN0aWQsIGRpY3Rpb25hcnksIGR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zLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2NvbnN0YW50cy5qcwogIHZhciByZXF1aXJlX2NvbnN0YW50cyA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9jb25zdGFudHMuanMiKGV4cG9ydHMyLCBtb2R1bGUyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSB7CiAgICAgICAgWl9OT19GTFVTSDogMCwKICAgICAgICBaX1BBUlRJQUxfRkxVU0g6IDEsCiAgICAgICAgWl9TWU5DX0ZMVVNIOiAyLAogICAgICAgIFpfRlVMTF9GTFVTSDogMywKICAgICAgICBaX0ZJTklTSDogNCwKICAgICAgICBaX0JMT0NLOiA1LAogICAgICAgIFpfVFJFRVM6IDYsCiAgICAgICAgWl9PSzogMCwKICAgICAgICBaX1NUUkVBTV9FTkQ6IDEsCiAgICAgICAgWl9ORUVEX0RJQ1Q6IDIsCiAgICAgICAgWl9FUlJOTzogLTEsCiAgICAgICAgWl9TVFJFQU1fRVJST1I6IC0yLAogICAgICAgIFpfREFUQV9FUlJPUjogLTMsCiAgICAgICAgWl9CVUZfRVJST1I6IC01LAogICAgICAgIFpfTk9fQ09NUFJFU1NJT046IDAsCiAgICAgICAgWl9CRVNUX1NQRUVEOiAxLAogICAgICAgIFpfQkVTVF9DT01QUkVTU0lPTjogOSwKICAgICAgICBaX0RFRkFVTFRfQ09NUFJFU1NJT046IC0xLAogICAgICAgIFpfRklMVEVSRUQ6IDEsCiAgICAgICAgWl9IVUZGTUFOX09OTFk6IDIsCiAgICAgICAgWl9STEU6IDMsCiAgICAgICAgWl9GSVhFRDogNCwKICAgICAgICBaX0RFRkFVTFRfU1RSQVRFR1k6IDAsCiAgICAgICAgWl9CS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Bha28vbGliL2luZmxhdGUuanMiKGV4cG9ydHMyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICB2YXIgemxpYl9pbmZsYXRlID0gcmVxdWlyZV9pbmZsYXRlKCk7CiAgICAgIHZhciB1dGlscyA9IHJlcXVpcmVfY29tbW9uKCk7CiAgICAgIHZhciBzdHJpbmdzID0gcmVxdWlyZV9zdHJpbmdzKCk7CiAgICAgIHZhciBjID0gcmVxdWlyZV9jb25zdGFudHMoKTsKICAgICAgdmFyIG1zZyA9IHJlcXVpcmVfbWVzc2FnZXMoKTsKICAgICAgdmFyIFpTdHJlYW0gPSByZXF1aXJlX3pzdHJlYW0oKTsKICAgICAgdmFyIEdaaGVhZGVyID0gcmVxdWlyZV9nemhlYWRlcigpOwogICAgICB2YXIgdG9TdHJpbmcgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nOwogICAgICBmdW5jdGlvbiBJbmZsYXRlMihvcHRpb25zKSB7CiAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIEluZmxhdGUyKSkKICAgICAgICAgIHJldHVybiBuZXcgSW5mbGF0ZTIob3B0aW9ucyk7CiAgICAgICAgdGhpcy5vcHRpb25zID0gdXRpbHMuYXNzaWduKHsKICAgICAgICAgIGNodW5rU2l6ZTogMTYzODQsCiAgICAgICAgICB3aW5kb3dCaXRzOiAwLAogICAgICAgICAgdG86ICIiCiAgICAgICAgfSwgb3B0aW9ucyB8fCB7fSk7CiAgICAgICAgdmFyIG9wdCA9IHRoaXMub3B0aW9uczsKICAgICAgICBpZiAob3B0LnJhdyAmJiBvcHQud2luZG93Qml0cyA+PSAwICYmIG9wdC53aW5kb3dCaXRzIDwgMTYpIHsKICAgICAgICAgIG9wdC53aW5kb3dCaXRzID0gLW9wdC53aW5kb3dCaXRzOwogICAgICAgICAgaWYgKG9wdC53aW5kb3dCaXRzID09PSAwKSB7CiAgICAgICAgICAgIG9wdC53aW5kb3dCaXRzID0gLTE1OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAob3B0LndpbmRvd0JpdHMgPj0gMCAmJiBvcHQud2luZG93Qml0cyA8IDE2ICYmICEob3B0aW9ucyAmJiBvcHRpb25zLndpbmRvd0JpdHMpKSB7CiAgICAgICAgICBvcHQud2luZG93Qml0cyArPSAzMjsKICAgICAgICB9CiAgICAgICAgaWYgKG9wdC53aW5kb3dCaXRzID4gMTUgJiYgb3B0LndpbmRvd0JpdHMgPCA0OCkgewogICAgICAgICAgaWYgKChvcHQud2luZG93Qml0cyAmIDE1KSA9PT0gMCkgewogICAgICAgICAgICBvcHQud2luZG93Qml0cyB8PSAxNTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgdGhpcy5lcnIgPSAwOwogICAgICAgIHRoaXMubXNnID0gIiI7CiAgICAgICAgdGhpcy5lbmRlZCA9IGZhbHNlOwogICAgICAgIHRoaXMuY2h1bmtzID0gW107CiAgICAgICAgdGhpcy5zdHJtID0gbmV3IFpTdHJlYW0oKTsKICAgICAgICB0aGlzLnN0cm0uYXZhaWxfb3V0ID0gMDsKICAgICAgICB2YXIgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGVJbml0Mih0aGlzLnN0cm0sIG9wdC53aW5kb3dCaXRzKTsKICAgICAgICBpZiAoc3RhdHVzICE9PSBjLlpfT0spIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcihtc2dbc3RhdHVzXSk7CiAgICAgICAgfQogICAgICAgIHRoaXMuaGVhZGVyID0gbmV3IEdaaGVhZGVyKCk7CiAgICAgICAgemxpYl9pbmZsYXRlLmluZmxhdGVHZXRIZWFkZXIodGhpcy5zdHJtLCB0aGlzLmhlYWRlcik7CiAgICAgICAgaWYgKG9wdC5kaWN0aW9uYXJ5KSB7CiAgICAgICAgICBpZiAodHlwZW9mIG9wdC5kaWN0aW9uYXJ5ID09PSAic3RyaW5nIikgewogICAgICAgICAgICBvcHQuZGljd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TklTSCA6IGMuWl9OT19GTFVTSDsKICAgICAgICBpZiAodHlwZW9mIGRhdGEgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICBzdHJtLmlucHV0ID0gc3RyaW5ncy5iaW5zdHJpbmcyYnVmKGRhdGEpOwogICAgICAgIH0gZWxzZSBpZiAodG9TdHJpbmcuY2FsbChkYXRhKSA9PT0gIltvYmplY3QgQXJyYXlCdWZmZXJdIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IG5ldyBVaW50OEFycmF5KGRhdGEpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBzdHJtLmlucHV0ID0gZGF0YTsKICAgICAgICB9CiAgICAgICAgc3RybS5uZXh0X2luID0gMDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gc3RybS5pbnB1dC5sZW5ndGg7CiAgICAgICAgZG8gewogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHN0cm0ub3V0cHV0ID0gbmV3IHV0aWxzLkJ1ZjgoY2h1bmtTaXplKTsKICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IDA7CiAgICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gY2h1bmtTaXplOwogICAgICAgICAgfQogICAgICAgICAgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGUoc3RybSwgYy5aX05PX0ZMVVNIKTsKICAgICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9ORUVEX0RJQ1QgJiYgZGljdGlvbmFyeSkgewogICAgICAgICAgICBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZVNldERpY3Rpb25hcnkodGhpcy5zdHJtLCBkaWN0aW9uYXJ5KTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9CVUZfRVJST1IgJiYgYWxsb3dCdWZFcnJvciA9PT0gdHJ1ZSkgewogICAgICAgICAgICBzdGF0dXMgPSBjLlpfT0s7CiAgICAgICAgICAgIGFsbG93QnVmRXJyb3IgPSBmYWxzZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdGF0dXMgIT09IGMuWl9TVFJFQU1fRU5EICYmIHN0YXR1cyAhPT0gYy5aX09LKSB7CiAgICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgICAgdGhpcy5lbmRlZCA9IHRydWU7CiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdHJtLm5leHRfb3V0KSB7CiAgICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCB8fCBzdGF0dXMgPT09IGMuWl9TVFJFQU1fRU5EIHx8IHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgKF9tb2RlID09PSBjLlpfRklOSVNIIHx8IF9tb2RlID09PSBjLlpfU1lOQ19GTFVTSCkpIHsKICAgICAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLnRvID09PSAic3RyaW5nIikgewogICAgICAgICAgICAgICAgbmV4dF9vdXRfdXRmOCA9IHN0cmluZ3MudXRmOGJvcmRlcihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCk7CiAgICAgICAgICAgICAgICB0YWlsID0gc3RybS5uZXh0X291dCAtIG5leHRfb3V0X3V0Zjg7CiAgICAgICAgICAgICAgICB1dGY4c3RyID0gc3RyaW5ncy5idWYyc3RyaW5nKHN0cm0ub3V0cHV0LCBuZXh0X291dF91dGY4KTsKICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSB0YWlsOwogICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBjaHVua1NpemUgLSB0YWlsOwogICAgICAgICAgICAgICAgaWYgKHRhaWwpIHsKICAgICAgICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RybS5vdXRwdXQsIHN0cm0ub3V0cHV0LCBuZXh0X291dF91dGY4LCB0YWlsLCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0ZjhzdHIpOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0aGlzLm9uRGF0YSh1dGlscy5zaHJpbmtCdWYoc3RybS5vdXRwdXQsIHN0cm0ubmV4dF9vdXQpKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdHJtLmF2YWlsX2luID09PSAwICYmIHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIGFsbG93QnVmRXJyb3IgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKChzdHJtLmF2YWlsX2luID4gMCB8fCBzdHJtLmF2YWlsX291dCA9PT0gMCkgJiYgc3RhdHVzICE9PSBjLlpfU1RSRUFNX0VORCk7CiAgICAgICAgaWYgKHN0YXR1cyA9PT0gYy5aX1NUUkVBTV9FTkQpIHsKICAgICAgICAgIF9tb2RlID0gYy5aX0ZJTklTSDsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBjLlpfRklOSVNIKSB7CiAgICAgICAgICBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZUVuZCh0aGlzLnN0cm0pOwogICAgICAgICAgdGhpcy5vbkVuZChzdGF0dXMpOwogICAgICAgICAgdGhpcy5lbmRlZCA9IHRydWU7CiAgICAgICAgICByZXR1cm4gc3RhdHVzID09PSBjLlpfT0s7CiAgICAgICAgfQogICAgICAgIGlmIChfbW9kZSA9PT0gYy5aX1NZTkNfRkxVU0gpIHsKICAgICAgICAgIHRoaXMub25FbmQoYy5aX09LKTsKICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gMDsKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgfTsKICAgICAgSW5mbGF0ZTIucHJvdG90eXBlLm9uRGF0YSA9IGZ1bmN0aW9uKGNodW5rKSB7CiAgICAgICAgdGhpcy5jaHVua3MucHVzaChjaHVuayk7CiAgICAgIH07CiAgICAgIEluZmxhdGUyLnByb3RvdHlwZS5vbkVuZCA9IGZ1bmN0aW9uKHN0YXR1cykgewogICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9PSykgewogICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgdGhpcy5yZXN1bHQgPSB0aGlzLmNodW5rcy5qb2luKCIiKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdXRpbHMuZmxhdHRlbkNodW5rcyh0aGlzLmNodW5rcyk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHRoaXMuY2h1bmtzID0gW107CiAgICAgICAgdGhpcy5lcnIgPSBzdGF0dXM7CiAgICAgICAgdGhpcy5tc2cgPSB0aGlzLnN0cm0ubXNnOwogICAgICB9OwogICAgICBmdW5jdGlvbiBpbmZsYXRlKGlucHV0LCBvcHRpb25zKSB7CiAgICAgICAgdmFyIGluZmxhdG9yID0gbmV3IEluZmxhdGUyKG9wdGlvbnMpOwogICAgICAgIGluZmxhdG9yLnB1c2goaW5wdXQsIHRydWUpOwogICAgICAgIGlmIChpbmZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IGluZmxhdG9yLm1zZyB8fCBtc2dbaW5mbGF0b3IuZXJyXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGluZmxhdG9yLnJlc3VsdDsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlUmF3KGlucHV0LCBvcHRpb25zKSB7CiAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307CiAgICAgICAgb3B0aW9ucy5yYXcgPSB0cnVlOwogICAgICAgIHJldHVybiBpbmZsYXRlKGlucHV0LCBvcHRpb25zKTsKICAgICAgfQogICAgICBleHBvcnRzMi5JbmZsYXRlID0gSW5mbGF0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mZlcl9zaGltKCk7CiAgICAgIG1vZHVsZTIuZXhwb3J0cyA9IExvbmc0OwogICAgICB2YXIgd2FzbSA9IG51bGw7CiAgICAgIHRyeSB7CiAgICAgICAgd2FzbSA9IG5ldyBXZWJBc3NlbWJseS5JbnN0YW5jZShuZXcgV2ViQXNzZW1ibHkuTW9kdWxlKG5ldyBVaW50OEFycmF5KFsKICAgICAgICAgIDAsCiAgICAgICAgICA5NywKICAgICAgICAgIDExNSwKICAgICAgICAgIDEwOSwKICAgICAgICAgIDEsCiAgICAgICAgICAwLAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAxLAogICAgICAgICAgMTMsCiAgICAgICAgICAyLAogICAgICAgICAgOTYsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNywKICAgICAgICAgIDk2LAogICAgICAgICAgNCwKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAzLAogICAgICAgICAgNywKICAgICAgICAgIDYsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICA2LAogICAgICAgICAgNiwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxLAogICAgICAgICAgNjUsCiAgICAgICAgICAwLAogICAgICAgICAgMTEsCiAgICAgICAgICA3LAogICAgICAgICAgNTAsCiAgICAgICAgICA2LAogICAgICAgICAgMywKICAgICAgICAgIDEwOSwKICAgICAgICAgIDExNywKICAgICAgICAgIDEwOCwKICAgICAgICAgIDAsCiAgICAgICAgICAxLAogICAgICAgICAgNSwKICAgICAgICAgIDEwMCwKICAgICAgICAgIDEwNSwKICAgICAgICAgIDExOCwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE1LAogICAgICAgICAgMCwKICAgICAgICAgIDIsCiAgICAgICAgICA1LAogICAgICAgICAgMTAwLAogICAgICAgICAgMTA1LAogICAgICAgICAgMTE4LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMTcsCiAgICAgICAgICAwLAogICAgICAgICAgMywKICAgICAgICAgIDUsCiAgICAgICAgICAxMTQsCiAgICAgICAgICAxMDEsCiAgICAgICAgICAxMDksCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNSwKICAgICAgICAgIDAsCiAgICAgICAgICA0LAogICAgICAgICAgNSwKICAgICAgICAgIDExNCwKICAgICAgICAgIDEwMSwKICAgICAgICAgIDEwOSwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE3LAogICAgICAgICAgMCwKICAgICAgICAgIDUsCiAgICAgICAgICA4LAogICAgICAgICAgMTAzLAogICAgICAgICAgMTAxLAogICAgICAgICAgMTE2LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMDQsCiAgICAgICAgICAxMDUsCiAgICAgICAgICAxMDMsCiAgICAgICAgICAxMDQsCiAgICAgICAgICAwLAogICAgICAgICAgMCwKICAgICAgICAgIDEwLAogICAgICAgICAgMTkxLAogICAgICAgICAgMSwKICAgICAgICAgIDYsCiAgICAgICAgICA0LAogICAgICAgICAgMCwKICAgICAgICAgIDM1LAogICAgICAgICAgMCwKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI2LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI3LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI4LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI5LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTMwLAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExCiAgICAgICAgXSkpLCB7fSkuZXhwb3J0czsKICAgICAgfSBjYXRjaCAoZSkgewogICAgICB9CiAgICAgIGZ1bmN0aW9uIExvbmc0KGxvdywgaGlnaCwgdW5zaWduZWQpIHsKICAgICAgICB0aGlzLmxvdyA9IGxvdyB8IDA7CiAgICAgICAgdGhpcy5oaWdoID0gaGlnaCB8IDA7CiAgICAgICAgdGhpcy51bnNpZ25lZCA9ICEhdW5zaWduZWQ7CiAgICAgIH0KICAgICAgTG9uZzQucHJvdG90eXBlLl9faXNMb25nX187CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShMb25nNC5wcm90b3R5cGUsICJfX2lzTG9uZ19fIiwgeyB2YWx1ZTogdHJ1ZSB9KTsKICAgICAgZnVuY3Rpb24gaXNMb25nKG9iaikgewogICAgICAgIHJldHVybiAob2JqICYmIG9ialsiX19pc0xvbmdfXyJdKSA9PT0gdHJ1ZTsKICAgICAgfQogICAgICBMb25nNC5pc0xvbmcgPSBpc0xvbmc7CiAgICAgIHZhciBJTlRfQ0FDSEUgPSB7fTsKICAgICAgdmFyIFVJTlRfQ0FDSEUgPSB7fTsKICAgICAgZnVuY3Rpb24gZnJvbUludCh2YWx1ZSwgdW5zaWduZWQpIHsKICAgICAgICB2YXIgb2JqLCBjYWNoZWRPYmosIGNhY2hlOwogICAgICAgIGlmICh1bnNpZ25lZCkgewogICAgICAgICAgdmFsdWUgPj4+PSAwOwogICAgICAgICAgaWYgKGNhY2hlID0gMCA8PSB2YWx1ZSAmJiB2YWx1ZSA8IDI1NikgewogICAgICAgICAgICBjYWNoZWRPYmogPSBVSU5UX0NBQ0hFW3ZhbHVlXTsKICAgICAgICAgICAgaWYgKGNhY2hlZE9iaikKICAgICAgICAgICAgICByZXR1cm4gY2FjaGVkT2JqOwogICAgICAgICAgfQogICAgICAgICAgb2JqID0gZnJvbUJpdHModmFsdWUsICh2YWx1ZSB8IDApIDwgMCA/IC0xIDogMCwgdHJ1ZSk7CiAgICAgICAgICBpZiAoY2FjaGUpCiAgICAgICAgICAgIFVJTlRfQ0FDSEVbdmFsdWVdID0gb2JqOwogICAgICAgICAgcmV0dXJuIG9iajsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdmFsdWUgfD0gMDsKICAgICAgICAgIGlmIChjYWNoZSA9IC0xMjggPD0gdmFsdWUgJiYgdmFsdWUgPCAxMjgpIHsKICAgICAgICAgICAgY2FjaGVkT2JqID0gSU5UX0NBQ0hFW3ZhbHVlXTsKICAgICAgICAgICAgaWYgKGNhY2hlZE9iaikKICAgICAgICAgICAgICByZXR1cm4gY2FjaGVkT2JqOwogICAgICAgICAgfQogICAgICAgICAgb2JqID0gZnJvbUJpdHModmFsdWUsIHZhbHVlIDwgMCA/IC0xIDogMCwgZmFsc2UpOwogICAgICAgICAgaWYgKGNhY2hlKQogICAgICAgICAgICBJTlRfQ0FDSEVbdmFsdWVdID0gb2JqOwogICAgICAgICAgcmV0dXJuIG9iajsKICAgICAgICB9CiAgICAgIH0KICAgICAgTG9uZzQuZnJvbUludCA9IGZyb21JbnQ7CiAgICAgIGZ1bmN0aW9uIGZyb21OdW1iZXIodmFsdWUsIHVuc2lnbmVkKSB7CiAgICAgICAgaWYgKGlzTmFOKHZhbHVlKSkKICAgICAgICAgIHJldHVybiB1bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICBpZiAodW5zaWduZWQpIHsKICAgICAgICAgIGlmICh2YWx1ZSA8IDApCiAgICAgICAgICAgIHJldHVybiBVWkVSTzsKICAgICAgICAgIGlmICh2YWx1ZSA+PSBUV09fUFdSXzY0X0RCTCkKICAgICAgICAgICAgcmV0dXJuIE1BWF9VTlNJR05FRF9WQUxVRTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKHZhbHVlIDw9IC1UV09fUFdSXzYzX0RCTCkKICAgICAgICAgICAgcmV0dXJuIE1JTl9WQUxVRTsKICAgICAgICAgIGlmICh2YWx1ZSArIDEgPj0gVFdPX1BXUl82M19EQkwpCiAgICAgICAgICAgIHJldHVybiBNQVhfVkFMVUU7CiAgICAgICAgfQogICAgICAgIGlmICh2YWx1ZSA8IDApCiAgICAgICAgICByZXR1cm4gZnJvbU51bWJlcigtdmFsdWUsIHVuc2lnbmVkKS5uZWcoKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModmFsdWUgJSBUV09fUFdSXzMyX0RCTCB8IDAsIHZhbHVlIC8gVFdPX1BXUl8zMl9EQkwgfCAwLCB1bnNpZ25lZCk7CiAgICAgIH0KICAgICAgTG9uZzQuZnJvbU51bWJlciA9IGZyb21OdW1iZXI7CiAgICAgIGZ1bmN0aW9uIGZyb21CaXRzKGxvd0JpdHMsIGhpZ2hCaXRzLCB1bnNpZ25lZCkgewogICAgICAgIHJldHVybiBuZXcgTG9uZzQobG93Qml0cywgaGlnaEJpdHMsIHVuc2lnbmVkKTsKICAgICAgfQogICAgICBMb25nNC5mcm9tQml0cyA9IGZyb21CaXRzOwogICAgICB2YXIgcG93X2RibCA9IE1hdGgucG93OwogICAgICBmdW5jdGlvbiBmcm9tU3RyaW5nKHN0ciwgdW5zaWduZWQsIHJhZGl4KSB7CiAgICAgICAgaWYgKHN0ci5sZW5ndGggPT09IDApCiAgICAgICAgICB0aHJvdyBFcnJvcigiZW1wdHkgc3RyaW5nIik7CiAgICAgICAgaWYgKHN0ciA9PT0gIk5hTiIgfHwgc3RyID09PSAiSW5maW5pdHkiIHx8IHN0ciA9PT0gIitJbmZpbml0eSIgfHwgc3RyID09PSAiLUluZmluaXR5IikKICAgICAgICAgIHJldHVybiBaRVJPOwogICAgICAgIGlmICh0eXBlb2YgdW5zaWduZWQgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICByYWRpeCA9IHVuc2lnbmVkLCB1bnNpZ25lZCA9IGZhbHNlOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB1bnNpZ25lZCA9ICEhdW5zaWduZWQ7CiAgICAgICAgfQogICAgICAgIHJhZGl4ID0gcmFkaXggfHwgMTA7CiAgICAgICAgaWYgKHJhZGl4IDwgMiB8fCAzNiA8IHJhZGl4KQogICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcigicmFkaXgiKTsKICAgICAgICB2YXIgcDsKICAgICAgICBpZiAoKHAgPSBzdHIuaW5kZXhPZigiLSIpKSA+IDApCiAgICAgICAgICB0aHJvdyBFcnJvcigiaW50ZXJpb3IgaHlwaGVuIik7CiAgICAgICAgZWxzZSBpZiAocCA9PT0gMCkgewogICAgICAgICAgcmV0dXJuIGZyb21TdHJpbmcoc3RyLnN1YnN0cmluZygxKSwgdW5zaWduZWQsIHJhZGl4KS5uZWcoKTsKICAgICAgICB9CiAgICAgICAgdmFyIHJhZGl4VG9Qb3dlciA9IGZyb21OdW1iZXIocG93X2RibChyYWRpeCwgOCkpOwogICAgICAgIHZhciByZXN1bHQgPSBaRVJPOwogICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSArPSA4KSB7CiAgICAgICAgICB2YXIgc2l6ZSA9IE1hdGgubWluKDgsIHN0ci5sZW5ndGggLSBpKSwgdmFsdWUgPSBwYXJzZUludChzdHIuc3Vic3RyaW5nKGksIGkgKyBzaXplKSwgcmFkaXgpOwogICAgICAgICAgaWYgKHNpemUgPCA4KSB7CiAgICAgICAgICAgIHZhciBwb3dlciA9IGZyb21OdW1iZXIocG93X2RibChyYWRpeCwgc2l6ZSkpOwogICAgICAgICAgICByZXN1bHQgPSByZXN1bHQubXVsKHBvd2VyKS5hZGQoZnJvbU51bWJlcih2YWx1ZSkpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmVzdWx0ID0gcmVzdWx0Lm11bChyYWRpeFRvUG93ZXIpOwogICAgICAgICAgICByZXN1bHQgPSByZXN1bHQuYWRkKGZyb21OdW1iZXIodmFsdWUpKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmVzdWx0LnVuc2lnbmVkID0gdW5zaWduZWQ7CiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgfQogICAgICBMb25nNC5mcm9tU3RyaW5nID0gZnJvbVN0cmluZzsKICAgICAgZnVuY3Rpb24gZnJvbVZhbHVlKHZhbCwgdW5zaWduZWQpIHsKICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gIm51bWJlciIpCiAgICAgICAgICByZXR1cm4gZnJvbU51bWJlcih2YWwsIHVuc2lnbmVkKTsKICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gInN0cmluZyIpCiAgICAgICAgICByZXR1cm4gZnJvbVN0cmluZyh2YWwsIHVuc2lnbmVkKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModmFsLmxvdywgdmFsLmhpZ2gsIHR5cGVvZiB1bnNpZ25lZCA9PT0gImJvb2xlYW4iID8gdW5zaWduZWQgOiB2YWwudW5zaWduZWQpOwogICAgICB9CiAgICAgIExvbmc0LmZyb21WYWx1ZSA9IGZyb21WYWx1ZTsKICAgICAgdmFyIFRXT19QV1JfMTZfREJMID0gMSA8PCAxNjsKICAgICAgdmFyIFRXT19QV1JfMjRfREJMID0gMSA8PCAy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VkFMVUU7CiAgICAgIHZhciBMb25nUHJvdG90eXBlID0gTG9uZzQucHJvdG90eXBlOwogICAgICBMb25nUHJvdG90eXBlLnRvSW50ID0gZnVuY3Rpb24gdG9JbnQoKSB7CiAgICAgICAgcmV0dXJuIHRoaXMudW5zaWduZWQgPyB0aGlzLmxvdyA+Pj4gMCA6IHRoaXMubG93OwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLnRvTnVtYmVyID0gZnVuY3Rpb24gdG9OdW1iZXIyKCkgewogICAgICAgIGlmICh0aGlzLnVuc2lnbmVkKQogICAgICAgICAgcmV0dXJuICh0aGlzLmhpZ2ggPj4+IDApICogVFdPX1BXUl8zMl9EQkwgKyAodGhpcy5sb3cgPj4+IDApOwogICAgICAgIHJldHVybiB0aGlzLmhpZ2ggKiBUV09fUFdSXzMyX0RCTCArICh0aGlzLmxvdyA+Pj4gMCk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZyhyYWRpeCkgewogICAgICAgIHJhZGl4ID0gcmFkaXggfHwgMTA7CiAgICAgICAgaWYgKHJhZGl4IDwgMiB8fCAzNiA8IHJhZGl4KQogICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcigicmFkaXgiKTsKICAgICAgICBpZiAodGhpcy5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiAiMCI7CiAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKSB7CiAgICAgICAgICBpZiAodGhpcy5lcShNSU5fVkFMVUUpKSB7CiAgICAgICAgICAgIHZhciByYWRpeExvbmcgPSBmcm9tTnVtYmVyKHJhZGl4KSwgZGl2ID0gdGhpcy5kaXYocmFkaXhMb25nKSwgcmVtMSA9IGRpdi5tdWwocmFkaXhMb25nKS5zdWIodGhpcyk7CiAgICAgICAgICAgIHJldHVybiBkaXYudG9TdHJpbmcocmFkaXgpICsgcmVtMS50b0ludCgpLnRvU3RyaW5nKHJhZGl4KTsKICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICByZXR1cm4gIi0iICsgdGhpcy5uZWcoKS50b1N0cmluZyhyYWRpeCk7CiAgICAgICAgfQogICAgICAgIHZhciByYWRpeFRvUG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIDYpLCB0aGlzLnVuc2lnbmVkKSwgcmVtID0gdGhpczsKICAgICAgICB2YXIgcmVzdWx0ID0gIiI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHZhciByZW1EaXYgPSByZW0uZGl2KHJhZGl4VG9Qb3dlciksIGludHZhbCA9IHJlbS5zdWIocmVtRGl2Lm11bChyYWRpeFRvUG93ZXIpKS50b0ludCgpID4+PiAwLCBkaWdpdHMgPSBpbnR2YWwudG9TdHJpbmcocmFkaXgpOwogICAgICAgICAgcmVtID0gcmVtRGl2OwogICAgICAgICAgaWYgKHJlbS5pc1plcm8oKSkKICAgICAgICAgICAgcmV0dXJuIGRpZ2l0cyArIHJlc3VsdDsKICAgICAgICAgIGVsc2UgewogICAgICAgICAgICB3aGlsZSAoZGlnaXRzLmxlbmd0aCA8IDYpCiAgICAgICAgICAgICAgZGlnaXRzID0gIjAiICsgZGlnaXRzOwogICAgICAgICAgICByZXN1bHQgPSAiIiArIGRpZ2l0cyArIHJlc3VsdDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0SGlnaEJpdHMgPSBmdW5jdGlvbiBnZXRIaWdoQml0cygpIHsKICAgICAgICByZXR1cm4gdGhpcy5oaWdoOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmdldEhpZ2hCaXRzVW5zaWduZWQgPSBmdW5jdGlvbiBnZXRIaWdoQml0c1Vuc2lnbmVkKCkgewogICAgICAgIHJldHVybiB0aGlzLmhpZ2ggPj4+IDA7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0TG93Qml0cyA9IGZ1bmN0aW9uIGdldExvd0JpdHMoKSB7CiAgICAgICAgcmV0dXJuIHRoaXMubG93OwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmdldExvd0JpdHNVbnNpZ25lZCA9IGZ1bmN0aW9uIGdldExvd0JpdHNVbnNpZ25lZCgpIHsKICAgICAgICByZXR1cm4gdGhpcy5sb3cgPj4+IDA7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0TnVtQml0c0FicyA9IGZ1bmN0aW9uIGdldE51bUJpdHNBYnMoKSB7CiAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgcmV0dXJuIHRoaXMuZXEoTUlOX1ZBTFVFKSA/IDY0IDogdGhpcy5uZWcoKS5nZXROdW1CaXRzQWJzKCk7CiAgICAgICAgdmFyIHZhbCA9IHRoaXMuaGlnaCAhPSAwID8gdGhpcy5oaWdoIDogdGhpcy5sb3c7CiAgICAgICAgZm9yICh2YXIgYml0ID0gMzE7IGJpdCA+IDA7IGJpdC0tKQogICAgICAgICAgaWYgKCh2YWwgJiAxIDw8IGJpdCkgIT0gMCkKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgcmV0dXJuIHRoaXMuaGlnaCAhPSAwID8gYml0ICsgMzMgOiBiaXQgKyAxOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzWmVybyA9IGZ1bmN0aW9uIGlzWmVybygpIHsKICAgICAgICByZXR1cm4gdGhpcy5oaWdoID09PSAwICYmIHRoaXMubG93ID09PSAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmVxeiA9IExvbmdQcm90b3R5cGUuaXNaZXJvOwogICAgICBMb25nUHJvdG90eXBlLmlzTmVnYXRpdmUgPSBmdW5jdGlvbiBpc05lZ2F0aXZlKCkgewogICAgICAgIHJldHVybiAhdGhpcy51bnNpZ25lZCAmJiB0aGlzLmhpZ2ggPCAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzUG9zaXRpdmUgPSBmdW5jdGlvbiBpc1Bvc2l0aXZlKCkgewogICAgICAgIHJldHVybiB0aGlzLnVuc2lnbmVkIHx8IHRoaXMuaGlnaCA+PSAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzT2RkID0gZnVuY3Rpb24gaXNPZGQoKSB7CiAgICAgICAgcmV0dXJuICh0aGlzLmxvdyAmIDEpID09PSAxOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzRXZlbiA9IGZ1bmN0aW9uIGlzRXZlbigpIHsKICAgICAgICByZXR1cm4gKHRoaXMubG93ICYgMSkgPT09IDA7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZXF1YWxzID0gZnVuY3Rpb24gZXF1YWxzKG90aGVyKSB7CiAgICAgICAgaWYgKCFpc0xvbmcob3RoZXIpKQogICAgICAgICAgb3RoZXIgPSBmcm9tVmFsdWUob3RoZXIpOwogICAgICAgIGlmICh0aGlzLnVuc2lnbmVkICE9PSBvdGhlci51bnNpZ25lZCAmJiB0aGlzLmhpZ2ggPj4+IDMxID09PSAxICYmIG90aGVyLmhpZ2ggPj4+IDMxID09PSAxKQogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIHJldHVybiB0aGlzLmhpZ2ggPT09IG90aGVyLmhpZ2ggJiYgdGhpcy5sb3cgPT09IG90aGVyLmxvdzsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5lcSA9IExvbmdQcm90b3R5cGUuZXF1YWxzOwogICAgICBMb25nUHJvdG90eXBlLm5vdEVxdWFscyA9IGZ1bmN0aW9uIG5vdEVxdWFscyhvdGhlcikgewogICAgICAgIHJldHVybiAhdGhpcy5lcShvdGhlcik7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUubmVxID0gTG9uZ1Byb3RvdHlwZS5ub3RFcXVhbHM7CiAgICAgIExvbmdQcm90b3R5cGUubmUgPSBMb25nUHJvdG90eXBlLm5vdEVxdWFsczsKICAgICA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gICAgICAgaWYgKCFpc0xvbmcoc3VidHJhaGVuZCkpCiAgICAgICAgICBzdWJ0cmFoZW5kID0gZnJvbVZhbHVlKHN1YnRyYWhlbmQpOwogICAgICAgIHJldHVybiB0aGlzLmFkZChzdWJ0cmFoZW5kLm5lZygpKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zdWIgPSBMb25nUHJvdG90eXBlLnN1YnRyYWN0OwogICAgICBMb25nUHJvdG90eXBlLm11bHRpcGx5ID0gZnVuY3Rpb24gbXVsdGlwbHkobXVsdGlwbGllcikgewogICAgICAgIGlmICh0aGlzLmlzWmVybygpKQogICAgICAgICAgcmV0dXJuIFpFUk87CiAgICAgICAgaWYgKCFpc0xvbmcobXVsdGlwbGllcikpCiAgICAgICAgICBtdWx0aXBsaWVyID0gZnJvbVZhbHVlKG11bHRpcGxpZXIpOwogICAgICAgIGlmICh3YXNtKSB7CiAgICAgICAgICB2YXIgbG93ID0gd2FzbS5tdWwodGhpcy5sb3csIHRoaXMuaGlnaCwgbXVsdGlwbGllci5sb3csIG11bHRpcGxpZXIuaGlnaCk7CiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMobG93LCB3YXNtLmdldF9oaWdoKCksIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgICBpZiAobXVsdGlwbGllci5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiBaRVJPOwogICAgICAgIGlmICh0aGlzLmVxKE1JTl9WQUxVRSkpCiAgICAgICAgICByZXR1cm4gbXVsdGlwbGllci5pc09kZCgpID8gTUlOX1ZBTFVFIDogWkVSTzsKICAgICAgICBpZiAobXVsdGlwbGllci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgcmV0dXJuIHRoaXMuaXNPZGQoKSA/IE1JTl9WQUxVRSA6IFpFUk87CiAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKSB7CiAgICAgICAgICBpZiAobXVsdGlwbGllci5pc05lZ2F0aXZlKCkpCiAgIC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PT09IC0xICYmIGRpdmlzb3IuaGlnaCA9PT0gLTEpIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICB9CiAgICAgICAgICB2YXIgbG93ID0gKHRoaXMudW5zaWduZWQgPyB3YXNtLmRpdl91IDogd2FzbS5kaXZfcykodGhpcy5sb3csIHRoaXMuaGlnaCwgZGl2aXNvci5sb3csIGRpdmlzb3IuaGlnaCk7CiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMobG93LCB3YXNtLmdldF9oaWdoKCksIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiB0aGlzLnVuc2lnbmVkID8gVVpFUk8gOiBaRVJPOwogICAgICAgIHZhciBhcHByb3gsIHJlbSwgcmVzOwogICAgICAgIGlmICghdGhpcy51bnNpZ25lZCkgewogICAgICAgICAgaWYgKHRoaXMuZXEoTUlOX1ZBTFVFKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5lcShPTkUpIHx8IGRpdmlzb3IuZXEoTkVHX09ORSkpCiAgICAgICAgICAgICAgcmV0dXJuIE1JTl9WQUxVRTsKICAgICAgICAgICAgZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICAgIHJldHVybiBPTkU7CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgIHZhciBoYWxmVGhpcyA9IHRoaXMuc2hyKDEpOwogICAgICAgICAgICAgIGFwcHJveCA9IGhhbGZUaGlzLmRpdihkaXZpc29yKS5zaGwoMSk7CiAgICAgICAgICAgICAgaWYgKGFwcHJveC5lcShaRVJPKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGRpdmlzb3IuaXNOZWdhdGl2ZSgpID8gT05FIDogTkVHX09ORTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmVtID0gdGhpcy5zdWIoZGl2aXNvci5tdWwoYXBwcm94KSk7CiAgICAgICAgICAgICAgICByZXMgPSBhcHByb3guYWRkKHJlbS5kaXYoZGl2aXNvcikpOwogICAgICAgICAgICAgICAgcmV0dXJuIHJlczsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICByZXR1cm4gdGhpcy51bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICAgIGlmICh0aGlzLmlzTmVnYXRpdmUoKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkuZGl2KGRpdmlzb3IubmVnKCkpOwogICAgICAgICAgICByZXR1cm4gdGhpcy5uZWcoKS5kaXYoZGl2aXNvcikubmVnKCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGRpdmlzb3IuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgICByZXR1cm4gdGhpcy5kaXYoZGl2aXNvci5uZWcoKSkubmVnKCk7CiAgICAgICAgICByZXMgPSBaRVJPOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAoIWRpdmlzb3IudW5zaWduZWQpCiAgICAgICAgICAgIGRpdmlzb3IgPSBkaXZpc29yLnRvVW5zaWduZWQoKTsKICAgICAgICAgIGlmIChkaXZpc29yLmd0KHRoaXMpKQogICAgICAgICAgICByZXR1cm4gVVpFUk87CiAgICAgICAgICBpZiAoZGl2aXNvci5ndCh0aGlzLnNocnUoMSkpKQogICAgICAgICAgICByZXR1cm4gVU9ORTsKICAgICAgICAgIHJlcyA9IFVaRVJPOwogICAgICAgIH0KICAgICAgICByZW0gPSB0aGlzOwogICAgICAgIHdoaWxlIChyZW0uZ3RlKGRpdmlzb3IpKSB7CiAgICAgICAgICBhcHByb3ggPSBNYXRoLm1heCgxLCBNYXRoLmZsb29yKHJlbS50b051bWJlcigpIC8gZGl2aXNvci50b051bWJlcigpKSk7CiAgICAgICAgICB2YXIgbG9nMiA9IE1hdGguY2VpbChNYXRoLmxvZyhhcHByb3gpIC8gTWF0aC5MTjIpLCBkZWx0YSA9IGxvZzIgPD0gNDggPyAxIDogcG93X2RibCgyLCBsb2cyIC0gNDgpLCBhcHByb3hSZXMgPSBmcm9tTnVtYmVyKGFwcHJveCksIGFwcHJveFJlbSA9IGFwcHJveFJlcy5tdWwoZGl2aXNvcik7CiAgICAgICAgICB3aGlsZSAoYXBwcm94UmVtLmlzTmVnYXRpdmUoKSB8fCBhcHByb3hSZW0uZ3QocmVtKSkgewogICAgICAgICAgICBhcHByb3ggLT0gZGVsdGE7CiAgICAgICAgICAgIGFwcHJveFJlcyA9IGZyb21OdW1iZXIoYXBwcm94LCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICAgICAgYXBwcm94UmVtID0gYXBwcm94UmVzLm11bChkaXZpc29yKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChhcHByb3hSZXMuaXNaZXJvKCkpCiAgICAgICAgICAgIGFwcHJveFJlcyA9IE9ORTsKICAgICAgICAgIHJlcyA9IHJlcy5hZGQoYXBwcm94UmVzKTsKICAgICAgICAgIHJlbSA9IHJlbS5zdWIoYXBwcm94UmVtKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlczsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5kaXYgPSBMb25nUHJvdG90eXBlLmRpdmlkZTsKICAgICAgTG9uZ1Byb3RvdHlwZS5tb2R1bG8gPSBmdW5jdGlvbiBtb2R1bG8oZGl2aXNvcikgewogICAgICAgIGlmICghaXNMb25nKGRpdmlzb3IpKQogICAgICAgICAgZGl2aXNvciA9IGZyb21WYWx1ZShkaXZpc29yKTsKICAgICAgICBpZiAod2FzbSkgewogICAgICAgICAgdmFyIGxvdyA9ICh0aGlzLnVuc2lnbmVkID8gd2FzbS5yZW1fdSA6IHdhc20ucmVtX3MpKHRoaXMubG93LCB0aGlzLmhpZ2gsIGRpdmlzb3IubG93LCBkaXZpc29yLmhpZ2gpOwogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKGxvdywgd2FzbS5nZXRfaGlnaCgpLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXMuc3ViKHRoaXMuZGl2KGRpdmlzb3IpLm11bChkaXZpc29yKSk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUubW9kID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUucmVtID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUubm90ID0gZnVuY3Rpb24gbm90KCkgewogICAgICAgIHJldHVybiBmcm9tQml0cyh+dGhpcy5sb3csIH50aGlzLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmFuZCA9IGZ1bmN0aW9uIGFuZChvdGhlcikgewogICAgICAgIGlmICghaXNMb25nKG90aGVyKSkKICAgICAgICAgIG90aGVyID0gZnJvbVZhbHVlKG90aGVyKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgJiBvdGhlci5sb3csIHRoaXMuaGlnaCAmIG90aGVyLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLm9yID0gZnVuY3Rpb24gb3Iob3RoZXIpIHsKICAgICAgICBpZiAoIWlzTG9uZyhvdGhlcikpCiAgICAgICAgICBvdGhlciA9IGZyb21WYWx1ZShvdGhlcik7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IHwgb3RoZXIubG93LCB0aGlzLmhpZ2ggfCBvdGhlci5oaWdoLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS54b3IgPSBmdW5jdGlvbiB4b3Iob3RoZXIpIHsKICAgICAgICBpZiAoIWlzTG9uZyhvdGhlcikpCiAgICAgICAgICBvdGhlciA9IGZyb21WYWx1ZShvdGhlcik7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IF4gb3RoZXIubG93LCB0aGlzLmhpZ2ggXiBvdGhlci5oaWdoLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdExlZnQgPSBmdW5jdGlvbiBzaGlmdExlZnQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIGlmICgobnVtQml0cyAmPSA2MykgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNlIGlmIChudW1CaXRzIDwgMzIpCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgPDwgbnVtQml0cywgdGhpcy5oaWdoIDw8IG51bUJpdHMgfCB0aGlzLmxvdyA+Pj4gMzIgLSBudW1CaXRzLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICBlbHNlCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMoMCwgdGhpcy5sb3cgPDwgbnVtQml0cyAtIDMyLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGwgPSBMb25nUHJvdG90eXBlLnNoaWZ0TGVmdDsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0ID0gZnVuY3Rpb24gc2hpZnRSaWdodChudW1CaXRzKSB7CiAgICAgICAgaWYgKGlzTG9uZyhudW1CaXRzKSkKICAgICAgICAgIG51bUJpdHMgPSBudW1CaXRzLnRvSW50KCk7CiAgICAgICAgaWYgKChudW1CaXRzICY9IDYzKSA9PT0gMCkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKG51bUJpdHMgPCAzMikKICAgICAgICAgIHJldHVybiBmcm9tQml0cyh0aGlzLmxvdyA+Pj4gbnVtQml0cyB8IHRoaXMuaGlnaCA8PCAzMiAtIG51bUJpdHMsIHRoaXMuaGlnaCA+PiBudW1CaXRzLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICBlbHNlCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5oaWdoID4+IG51bUJpdHMgLSAzMiwgdGhpcy5oaWdoID49IDAgPyAwIDogLTEsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLnNociA9IExvbmdQcm90b3R5cGUuc2hpZnRSaWdodDsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0VW5zaWduZWQgPSBmdW5jdGlvbiBzaGlmdFJpZ2h0VW5zaWduZWQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIG51bUJpdHMgJj0gNjM7CiAgICAgICAgaWYgKG51bUJpdHMgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNlIHsKICAgICAgICAgIHZhciBoaWdoID0gdGhpcy5oaWdoOwogICAgICAgICAgaWYgKG51bUJpdHMgPCAzMikgewogICAgICAgICAgICB2YXIgbG93ID0gdGhpcy5sb3c7CiAgICAgICAgICAgIHJldHVybiBmcm9tQml0cyhsb3cgPj4+IG51bUJpdHMgfCBoaWdoIDw8IDMyIC0gbnVtQml0cywgaGlnaCA+Pj4gbnVtQml0cywgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgICB9IGVsc2UgaWYgKG51bUJpdHMgPT09IDMyKQogICAgICAgICAgICByZXR1cm4gZnJvbUJpdHMoaGlnaCwgMCwgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiBmcm9tQml0cyhoaWdoID4+PiBudW1CaXRzIC0gMzIs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ZW5lcnM7CiAgICAgIH0KICAgICAgRXZlbnRFbWl0dGVyLnByb3RvdHlwZS5nZXRNYXhMaXN0ZW5lcnMgPSBmdW5jdGlvbiBnZXRNYXhMaXN0ZW5lcnMoKSB7CiAgICAgICAgcmV0dXJuIF9nZXRNYXhMaXN0ZW5lcnModGhpcyk7CiAgICAgIH07CiAgICAgIEV2ZW50RW1pdHRlci5wcm90b3R5cGUuZW1pdCA9IGZ1bmN0aW9uIGVtaXQodHlwZSkgewogICAgICAgIHZhciBhcmdzID0gW107CiAgICAgICAgZm9yICh2YXIgaSA9IDE7IGkgPCBhcmd1bWVudHMubGVuZ3RoOyBpKyspCiAgICAgICAgICBhcmdzLnB1c2goYXJndW1lbnRzW2ldKTsKICAgICAgICB2YXIgZG9FcnJvciA9IHR5cGUgPT09ICJlcnJvciI7CiAgICAgICAgdmFyIGV2ZW50cyA9IHRoaXMuX2V2ZW50czsKICAgICAgICBpZiAoZXZlbnRzICE9PSB2b2lkIDApCiAgICAgICAgICBkb0Vycm9yID0gZG9FcnJvciAmJiBldmVudHMuZXJyb3IgPT09IHZvaWQgMDsKICAgICAgICBlbHNlIGlmICghZG9FcnJvcikKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICBpZiAoZG9FcnJvcikgewogICAgICAgICAgdmFyIGVyOwogICAgICAgICAgaWYgKGFyZ3MubGVuZ3RoID4gMCkKICAgICAgICAgICAgZXIgPSBhcmdzWzBdOwogICAgICAgICAgaWYgKGVyIGluc3RhbmNlb2YgRXJyb3IpIHsKICAgICAgICAgICAgdGhyb3cgZXI7CiAgICAgICAgICB9CiAgICAgICAgICB2YXIgZXJyID0gbmV3IEVycm9yKCJVbmhhbmRsZWQgZXJyb3IuIiArIChlciA/ICIgKCIgKyBlci5tZXNzYWdlICsgIikiIDogIiIpKTsKICAgICAgICAgIGVyci5jb250ZXh0ID0gZXI7CiAgICAgICAgICB0aHJvdyBlcnI7CiAgICAgICAgfQogICAgICAgIHZhciBoYW5kbGVy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W50RW1pdHRlci5wcm90b3R5cGUucmVtb3ZlTGlzdGVuZXIgPSBmdW5jdGlvbiByZW1vdmVMaXN0ZW5lcih0eXBlLCBsaXN0ZW5lcikgewogICAgICAgIHZhciBsaXN0LCBldmVudHMsIHBvc2l0aW9uLCBpLCBvcmlnaW5hbExpc3RlbmVyOwogICAgICAgIGNoZWNrTGlzdGVuZXIobGlzdGVuZXIpOwogICAgICAgIGV2ZW50cyA9IHRoaXMuX2V2ZW50czsKICAgICAgICBpZiAoZXZlbnRzID09PSB2b2lkIDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBsaXN0ID0gZXZlbnRzW3R5cGVdOwogICAgICAgIGlmIChsaXN0ID09PSB2b2lkIDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBpZiAobGlzdCA9PT0gbGlzdGVuZXIgfHwgbGlzdC5saXN0ZW5lciA9PT0gbGlzdGVuZXIpIHsKICAgICAgICAgIGlmICgtLXRoaXMuX2V2ZW50c0NvdW50ID09PSAwKQogICAgICAgICAgICB0aGlzLl9ldmVudHMgPSBPYmplY3QuY3JlYXRlKG51bGwpOwogICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGRlbGV0ZSBldmVudHNbdHlwZV07CiAgICAgICAgICAgIGlmIChldmVudHMucmVtb3ZlTGlzdGVuZXIpCiAgICAgICAgICAgICAgdGhpcy5lbWl0KCJyZW1vdmVMaXN0ZW5lciIsIHR5cGUsIGxpc3QubGlzdGVuZXIgfHwgbGlzdGVuZXIpOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIGxpc3QgIT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgIHBvc2l0aW9uID0gLTE7CiAgICAgICAgICBmb3IgKGkgPSBsaXN0Lmxlbmd0aCAtIDE7IGkgPj0gMDsgaS0tKSB7CiAgICAgICAgICAgIGlmIChsaXN0W2ldID09PSBsaXN0ZW5lciB8fCBsaXN0W2ldLmxpc3RlbmVyID09PSBsaXN0ZW5lcikgewogICAgICAgICAgICAgIG9yaWdpbmFsTGlzdGVuZXIgPSBsaXN0W2ldLmxpc3RlbmVyOwogICAgICAgICAgICAgIHBvc2l0aW9uID0gaTsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHBvc2l0aW9uIDwgMCkKICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICBpZiAocG9zaXRpb24gPT09IDApCiAgICAgICAgICAgIGxpc3Quc2hpZnQoKTsKICAgICAgICAgIGVsc2UgewogICAgICAgICAgICBzcGxpY2VPbmUobGlzdCwgcG9zaXRpb24pOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGxpc3QubGVuZ3RoID09PSAxKQogICAgICAgICAgICBldmVudHNbdHlwZV0gPSBsaXN0WzBdOwogICAgICAgICAgaWYgKGV2ZW50cy5yZW1vdmVMaXN0ZW5lciAhPT0gdm9pZCAwKQogICAgICAgICAgICB0aGlzLmVtaXQoInJlbW92ZUxpc3RlbmVyIiwgdHlwZSwgb3JpZ2luYWxMaXN0ZW5lciB8fCBsaXN0ZW5lcik7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9OwogICAgICBFdmVudEVtaXR0ZXIucHJvdG90eXBlLm9mZiA9IEV2ZW50RW1pdHRlci5wcm90b3R5cGUucmVtb3ZlTGlzdGVuZXI7CiAgICAgIEV2ZW50RW1pdHRlci5wcm90b3R5cGUucmVtb3ZlQWxsTGlzdGVuZXJzID0gZnVuY3Rpb24gcmVtb3ZlQWxsTGlzdGVuZXJzKHR5cGUpIHsKICAgICAgICB2YXIgbGlzdGVuZXJzLCBldmVudHMsIGk7CiAgICAgICAgZXZlbnRzID0gdGhpcy5fZXZlbnRzOwogICAgICAgIGlmIChldmVudHMgPT09IHZvaWQgMCkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGlmIChldmVudHMucmVtb3ZlTGlzdGVuZXIgPT09IHZvaWQgMCkgewogICAgICAgICAgaWYgKGFyZ3VtZW50cy5sZW5ndGggPT09IDApIHsKICAgICAgICAgICAgdGhpcy5fZXZlbnRzID0gT2JqZWN0LmNyZWF0ZShudWxsKTsKICAgICAgICAgICAgdGhpcy5fZXZlbnRzQ291bnQgPSAwOwogICAgICAgICAgfSBlbHNlIGlmIChldmVudHNbdHlwZV0gIT09IHZvaWQgMCkgewogICAgICAgICAgICBpZiAoLS10aGlzLl9ldmVudHNDb3VudCA9PT0gMCkKICAgICAgICAgICAgICB0aGlzLl9ldmVudHMgPSBPYmplY3QuY3JlYXRlKG51bGwpOwogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgZGVsZXRlIGV2ZW50c1t0eXBlXTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIH0KICAgICAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgdmFyIGtleXMyID0gT2JqZWN0LmtleXMoZXZlbnRzKTsKICAgICAgICAgIHZhciBrZXk7CiAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwga2V5czIubGVuZ3RoOyArK2kpIHsKICAgICAgICAgICAga2V5ID0ga2V5czJbaV07CiAgICAgICAgICAgIGlmIChrZXkgPT09ICJyZW1vdmVMaXN0ZW5lciIpCiAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIHRoaXMucmVtb3ZlQWxsTGlzdGVuZXJzKGtleSk7CiAgICAgICAgICB9CiAgICAgICAgICB0aGlzLnJlbW92ZUFsbExpc3RlbmVycygicmVtb3ZlTGlzdGVuZXIiKTsKICAgICAgICAgIHRoaXMuX2V2ZW50cyA9IE9iamVjdC5jcmVhdGUobnVsbCk7CiAgICAgICAgICB0aGlzLl9ldmVudHNDb3VudCA9IDA7CiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICB9CiAgICAgICAgbGlzdGVuZXJzID0gZXZlbnRzW3R5cGVdOwogICAgICAgI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9saXN0ZW5lcnModGhpcywgdHlwZSwgdHJ1ZSk7CiAgICAgIH07CiAgICAgIEV2ZW50RW1pdHRlci5wcm90b3R5cGUucmF3TGlzdGVuZXJzID0gZnVuY3Rpb24gcmF3TGlzdGVuZXJzKHR5cGUpIHsKICAgICAgICByZXR1cm4gX2xpc3RlbmVycyh0aGlzLCB0eXBlLCBmYWxzZSk7CiAgICAgIH07CiAgICAgIEV2ZW50RW1pdHRlci5saXN0ZW5lckNvdW50ID0gZnVuY3Rpb24oZW1pdHRlciwgdHlwZSkgewogICAgICAgIGlmICh0eXBlb2YgZW1pdHRlci5saXN0ZW5lckNvdW50ID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICByZXR1cm4gZW1pdHRlci5saXN0ZW5lckNvdW50KHR5cGUpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICByZXR1cm4gbGlzdGVuZXJDb3VudC5jYWxsKGVtaXR0ZXIsIHR5cGUpOwogICAgICAgIH0KICAgICAgfTsKICAgICAgRXZlbnRFbWl0dGVyLnByb3RvdHlwZS5saXN0ZW5lckNvdW50ID0gbGlzdGVuZXJDb3VudDsKICAgICAgZnVuY3Rpb24gbGlzdGVuZXJDb3VudCh0eXBlKSB7CiAgICAgICAgdmFyIGV2ZW50cyA9IHRoaXMuX2V2ZW50czsKICAgICAgICBpZiAoZXZlbnRzICE9PSB2b2lkIDApIHsKICAgICAgICAgIHZhciBldmxpc3RlbmVyID0gZXZlbnRzW3R5cGVdOwogICAgICAgICAgaWYgKHR5cGVvZiBldmxpc3RlbmVyID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgfSBlbHNlIGlmIChldmxpc3RlbmVyICE9PSB2b2lkIDApIHsKICAgICAgICAgICAgcmV0dXJuIGV2bGlzdGVuZXIubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gMDsKICAgICAgfQogICAgICBFdmVudEVtaXR0ZXIucHJvdG90eXBlLmV2ZW50TmFtZXMgPSBmdW5jdGlvbiBldmVudE5hbWVzKCkgewogICAgICAgIHJldHVybiB0aGlzLl9ldmVudHNDb3VudCA+IDAgPyBSZWZsZWN0T3duS2V5cyh0aGlzLl9ldmVudHMpIDogW107CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGFycmF5Q2xvbmUoYXJyLCBuKSB7CiAgICAgICAgdmFyIGNvcHkgPSBuZXcgQXJyYXkobik7CiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBuOyArK2kpCiAgICAgICAgICBjb3B5W2ldID0gYXJyW2ldOwogICAgICAgIHJldHVybiBjb3B5OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNwbGljZU9uZShsaXN0LCBpbmRleCkgewogICAgICAgIGZvciAoOyBpbmRleCArIDEgPCBsaXN0Lmxlbmd0aDsgaW5kZXgrKykKICAgICAgICAgIGxpc3RbaW5kZXhdID0gbGlzdFtpbmRleCArIDFdOwogICAgICAgIGxpc3QucG9wKCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdW53cmFwTGlzdGVuZXJzKGFycikgewogICAgICAgIHZhciByZXQgPSBuZXcgQXJyYXkoYXJyLmxlbmd0aCk7CiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCByZXQubGVuZ3RoOyArK2kpIHsKICAgICAgICAgIHJldFtpXSA9IGFycltpXS5saXN0ZW5lciB8fCBhcnJbaV07CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gb25jZShlbWl0dGVyLCBuYW1lKSB7CiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKGZ1bmN0aW9uKHJlc29sdmUsIHJlamVjdCkgewogICAgICAgICAgZnVuY3Rpb24gZXJyb3JMaXN0ZW5lcihlcnIpIHsKICAgICAgICAgICAgZW1pdHRlci5yZW1vdmVMaXN0ZW5lcihuYW1lLCByZXNvbHZlcik7CiAgICAgICAgICAg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HsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICBpZiAodHlwZW9mIE9iamVjdC5jcmVhdGUgPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICBtb2R1bGUyLmV4cG9ydHMgPSBmdW5jdGlvbiBpbmhlcml0cyhjdG9yLCBzdXBlckN0b3IpIHsKICAgICAgICAgIGlmIChzdXBlckN0b3IpIHsKICAgICAgICAgICAgY3Rvci5zdXBlcl8gPSBzdXBlckN0b3I7CiAgICAgICAgICAgIGN0b3IucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShzdXBlckN0b3IucHJvdG90eXBlLCB7CiAgICAgICAgICAgICAgY29uc3RydWN0b3I6IHsKICAgICAgICAgICAgICAgIHZhbHVlOiBjdG9yLAogICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgfSBlbHNlIHsKICAgICAgICBtb2R1bGUyLmV4cG9ydHMgPSBmdW5jdGlvbiBpbmhlcml0cyhjdG9yLCBzdXBlckN0b3IpIHsKICAgICAgICAgIGlmIChzdXBlckN0b3IpIHsKICAgICAgICAgICAgY3Rvci5zdXBlcl8gPSBzdXBlckN0b3I7CiAgICAgICAgICAgIHZhciBUZW1wQ3RvciA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICB9OwogICAgICAgICAgICBUZW1wQ3Rvci5wcm90b3R5cGUgPSBzdXBlckN0b3IucHJvdG90eXBlOwogICAgICAgICAgICBjdG9yLnByb3RvdHlwZSA9IG5ldyBUZW1wQ3RvcigpOwogICAgICAgICAgICBjdG9yLnByb3RvdHlwZS5jb25zdHJ1Y3RvciA9IGN0b3I7CiAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgfQogICAgfQ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mdW5jdGlvbiBCdWZmZXJMaXN0KCkgewogICAgICAgICAgX2NsYXNzQ2FsbENoZWNrKHRoaXMsIEJ1ZmZlckxpc3QpOwogICAgICAgICAgdGhpcy5oZWFkID0gbnVsbDsKICAgICAgICAgIHRoaXMudGFpbCA9IG51bGw7CiAgICAgICAgICB0aGlzLmxlbmd0aCA9IDA7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhCdWZmZXJMaXN0LCBbewogICAgICAgICAga2V5OiAicHVzaCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gcHVzaCh2KSB7CiAgICAgICAgICAgIHZhciBlbnRyeSA9IHsKICAgICAgICAgICAgICBkYXRhOiB2LAogICAgICAgICAgICAgIG5leHQ6IG51bGwKICAgICAgICAgICAgfTsKICAgICAgICAgICAgaWYgKHRoaXMubGVuZ3RoID4gMCkKICAgICAgICAgICAgICB0aGlzLnRhaWwubmV4dCA9IGVudHJ5OwogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgdGhpcy5oZWFkID0gZW50cnk7CiAgICAgICAgICAgIHRoaXMudGFpbCA9IGVudHJ5OwogICAgICAgICAgICArK3RoaXMubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgIH0sIHsKICAgICAgICAgIGtleTogInVuc2hpZnQiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIHVuc2hpZnQodikgewogICAgICAgICAgICB2YXIgZW50cnkgPSB7CiAgICAgICAgICAgICAgZGF0YTogdiwKICAgICAgICAgICAgICBuZXh0OiB0aGlzLmhlYWQKICAgICAgICAgICAgfTsKICAgICAgICAgICAgaWYgKHRoaXMubGVuZ3RoID09PSAwKQogICAgICAgICAgICAgIHRoaXMudGFpbCA9IGVudHJ5OwogICAgICAgICAgICB0aGlzLmhlYWQgPSBlbnRyeTsKICAgICAgICAgICAgKyt0aGlzLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJzaGlmdCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gc2hpZnQoKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmxlbmd0aCA9PT0gMCkKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIHZhciByZXQgPSB0aGlzLmhlYWQuZGF0YTsKICAgICAgICAgICAgaWYgKHRoaXMubGVuZ3RoID09PSAxKQogICAgICAgICAgICAgIHRoaXMuaGVhZCA9IHRoaXMudGFpbCA9IG51bGw7CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICB0aGlzLmhlYWQgPSB0aGlzLmhlYWQubmV4dDsKICAgICAgICAgICAgLS10aGlzLmxlbmd0aDsKICAgICAgICAgICAgcmV0dXJuIHJldDsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJjbGVhciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gY2xlYXIoKSB7CiAgICAgICAgICAgIHRoaXMuaGVhZCA9IHRoaXMudGFpbCA9IG51bGw7CiAgICAgICAgICAgIHRoaXMubGVuZ3RoID0gMDsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJqb2luIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBqb2luKHMpIHsKICAgICAgICAgICAgaWYgKHRoaXMubGVuZ3RoID09PSAwKQogICAgICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICAgICAgdmFyIHAgPSB0aGlzLmhlYWQ7CiAgICAgICAgICAgIHZhciByZXQgPSAiIiArIHAuZGF0YTsKICAgICAgICAgICAgd2hpbGUgKHAgPSBwLm5leHQpCiAgICAgICAgICAgICAgcmV0ICs9IHMgKyBwLmRhdGE7CiAgICAgICAgICAgIHJldHVybiByZXQ7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAiY29uY2F0IiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBjb25jYXQobikgewogICAgICAgICAgICBpZiAodGhpcy5sZW5ndGggPT09IDApCiAgICAgICAgICAgICAgcmV0dXJuIEJ1ZmZlcjEwLmFsbG9jKDApOwogICAgICAgICAgICB2YXIgcmV0ID0gQnVmZmVyMTAuYWxsb2NVbnNhZmUobiA+Pj4gMCk7CiAgICAgICAgICAgIHZhciBwID0gdGhpcy5oZWFkOwogICAgICAgICAgICB2YXIgaSA9IDA7CiAgICAgICAgICAgIHdoaWxlIChwKSB7CiAgICAgICAgICAgICAgY29weUJ1ZmZlcihwLmRhdGEsIHJldCwgaSk7CiAgICAgICAgICAgICAgaSArPSBwLmRhdGEubGVuZ3RoOwogICAgICAgICAgICAgIHAgPSBwLm5leHQ7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJldDsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJjb25zdW1lIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBjb25zdW1lKG4sIGhhc1N0cmluZ3MpIHsKICAgICAgICAgICAgdmFyIHJldDsKICAgICAgICAgICAgaWYgKG4gPCB0aGlzLmhlYWQuZGF0YS5sZW5ndGgpIHsKICAgICAgICAgICAgICByZXQgPSB0aGlzLmhlYWQuZGF0YS5zbGljZSgwLCBuKTsKICAgICAgICAgICAgICB0aGlzLmhlYWQuZGF0YSA9IHRoaXMuaGVhZC5kYXRhLnNsaWNlKG4pOwogICAgICAgICAgICB9IGVsc2UgaWYgKG4gPT09IHRoaXMuaGVhZC5kYXRhLmxlbmd0aCkgewogICAgICAgICAgICAgIHJldCA9IHRoaXMuc2hpZnQoKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICByZXQgPSBoYXNTdHJpbmdzID8gdGhpcy5fZ2V0U3RyaW5nKG4pIDogdGhpcy5fZ2V0QnVmZmVyKG4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiByZXQ7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAiZmlyc3QiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGZpcnN0KCkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5oZWFkLmRhdGE7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAiX2dldFN0cmluZyIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gX2dldFN0cmluZyhuKSB7CiAgICAgICAgICAgIHZhciBwID0gdGhpcy5oZWFkOwogICAgICAgICAgICB2YXIgYyA9IDE7CiAgICAgICAgICAgIHZhciByZXQgPSBwLmRhdGE7CiAgICAgICAgICAgIG4gLT0gcmV0Lmxlbmd0aDsKICAgICAgICAgICAgd2hpbGUgKHAgPSBwLm5leHQpIHsKICAgICAgICAgICAgICB2YXIgc3RyID0gcC5kYXRhOwogICAgICAgICAgICAgIHZhciBuYiA9IG4gPiBzdHIubGVuZ3RoID8gc3RyLmxlbmd0aCA6IG47CiAgICAgICAgICAgICAgaWYgKG5iID09PSBzdHIubGVuZ3RoKQogICAgICAgICAgICAgICAgcmV0ICs9IHN0cjsKICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICByZXQgKz0gc3RyLnNsaWNlKDAsIG4pOwogICAgICAgICAgICAgIG4gLT0gbmI7CiAgICAgICAgICAgICAgaWYgKG4gPT09IDApIHsKICAgICAgICAgICAgICAgIGlmIChuYiA9PT0gc3RyLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICArK2M7CiAgICAgICAgICAgICAgICAgIGlmIChwLm5leHQpCiAgICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkID0gcC5uZXh0OwogICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkID0gdGhpcy50YWlsID0gbnVsbDsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHRoaXMuaGVhZCA9IHA7CiAgICAgICAgICAgICAgICAgIHAuZGF0YSA9IHN0ci5zbGljZShuYik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgKytjOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMubGVuZ3RoIC09IGM7CiAgICAgICAgICAgIHJldHVybiByZXQ7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAiX2dldEJ1ZmZlciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gX2dldEJ1ZmZlcihuKSB7CiAgICAgICAgICAgIHZhciByZXQgPSBCdWZmZXIxMC5hbGxvY1Vuc2FmZShuKTsKICAgICAgICAgICAgdmFyIHAgPSB0aGlzLmhlYWQ7CiAgICAgICAgICAgIHZhciBjID0gMTsKICAgICAgICAgICAgcC5kYXRhLmNvcHkocmV0KTsKICAgICAgICAgICAgbiAtPSBwLmRhdGEubGVuZ3RoOwogICAgICAgICAgICB3aGlsZSAocCA9IHAubmV4dCkgewogICAgICAgICAgICAgIHZhciBidWYgPSBwLmRhdGE7CiAgICAgICAgICAgICAgdmFyIG5iID0gbiA+IGJ1Zi5sZW5ndGggPyBidWYubGVuZ3RoIDogbjsKICAgICAgICAgICAgICBidWYuY29weShyZXQsIHJldC5sZW5ndGggLSBuLCAwLCBuYik7CiAgICAgICAgICAgICAgbiAtPSBuYjsKICAgICAgICAgICAgICBpZiAobiA9PT0gMCkgewogICAgICAgICAgICAgICAgaWYgKG5iID09PSBidWYubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICsrYzsKICAgICAgICAgICAgICAgICAgaWYgKHAubmV4dCkKICAgICAgICAgICAgICAgICAgICB0aGlzLmhlYWQgPSBwLm5leHQ7CiAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICB0aGlzLmhlYWQgPSB0aGlzLnRhaWwgPSBudWxsOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkID0gcDsKICAgICAgICAgICAgICAgICAgcC5kYXRhID0gYnVmLnNsaWNlKG5iKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICArK2M7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5sZW5ndGggLT0gYzsKICAgICAgICAgICAgcmV0dXJuIHJldDsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6IGN1c3RvbSwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiB2YWx1ZShfLCBvcHRpb25zKSB7CiAgICAgICAgICAgIHJldHVybiBpbnNwZWN0KHRoaXMsIF9vYmplY3RTcHJlYWQoX29iamVjdFNwcmVhZCh7fSwgb3B0aW9ucyksIHt9LCB7CiAgICAgICAgICAgICAgZGVwdGg6IDAsCiAgICAgICAgICAgICAgY3VzdG9tSW5zcGVjdDogZmFsc2UKICAgICAgICAgICAgfSkpOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gQnVmZmVyTGlzdDsKICAgICAgfSgpOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcmVhZGFibGUtc3RyZWFtQDMuNi4yL25vZGVfbW9kdWxlcy9yZWFkYWJsZS1zdHJlYW0vbGliL2ludGVybmFsL3N0cmVhbXMvZGVzdHJveS5qcwogIHZhciByZXF1aXJlX2Rlc3Ryb3kgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcmVhZGFibGUtc3RyZWFtQDMuNi4yL25vZGVfbW9kdWxlcy9yZWFkYWJsZS1zdHJlYW0vbGliL2ludGVybmFsL3N0cmVhbXMvZGVzdHJveS5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIGZ1bmN0aW9uIGRlc3Ryb3koZXJyLCBjYikgewogICAgICAgIHZhciBfdGhpcyA9IHRoaXM7CiAgICAgICAgdmFyIHJlYWRhYmxlRGVzdHJveWVkID0gdGhpcy5fcmVhZGFibGVTdGF0ZSAmJiB0aGlzLl9yZWFkYWJsZVN0YXRlLmRlc3Ryb3llZDsKICAgICAgICB2YXIgd3JpdGFibGVEZXN0cm95ZWQgPSB0aGlzLl93cml0YWJsZVN0YXRlICYmIHRoaXMuX3dyaXRhYmxlU3RhdGUuZGVzdHJveWVkOwogICAgICAgIGlmIChyZWFkYWJsZURlc3Ryb3llZCB8fCB3cml0YWJsZURlc3Ryb3llZCkgewogICAgICAgICAgaWYgKGNiKSB7CiAgICAgICAgICAgIGNiKGVycik7CiAgICAgICAgICB9IGVsc2UgaWYgKGVycikgewogICAgICAgICAgICBpZiAoIXRoaXMuX3dyaXRhYmxlU3RhdGUpIHsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVtaXRFcnJvck5ULCB0aGlzLCBlcnIpOwogICAgICAgICAgICB9IGVsc2UgaWYgKCF0aGlzLl93cml0YWJsZVN0YXRlLmVycm9yRW1pdHRlZCkgewogICAgICAgICAgICAgIHRoaXMuX3dyaXRhYmxlU3RhdGUuZXJyb3JFbWl0dGVkID0gdHJ1ZTsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVtaXRFcnJvck5ULCB0aGlzLCBlcnIpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICB9CiAgICAgICAgaWYgKHRoaXMuX3JlYWRhYmxlU3RhdGUpIHsKICAgICAgICAgIHRoaXMuX3JlYWRhYmxlU3RhdGUuZGVzdHJveWVkID0gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgaWYgKHRoaXMuX3dyaXRhYmxlU3RhdGUpIHsKICAgICAgICAgIHRoaXMuX3dyaXRhYmxlU3RhdGUuZGVzdHJveWVkID0gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgdGhpcy5fZGVzdHJveShlcnIgfHwgbnVsbCwgZnVuY3Rpb24oZXJyMikgewogICAgICAgICAgaWYgKCFjYiAmJiBlcnIyKSB7CiAgICAgICAgICAgIGlmICghX3RoaXMuX3dyaXRhYmxlU3RhdGUpIHsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVtaXRFcnJvckFuZENsb3NlTlQsIF90aGlzLCBlcnIyKTsKICAgICAgICAgICAgfSBlbHNlIGlmICghX3RoaXMuX3dyaXRhYmxlU3RhdGUuZXJyb3JFbWl0dGVkKSB7CiAgICAgICAgICAgICAgX3RoaXMuX3dyaXRhYmxlU3RhdGUuZXJyb3JFbWl0dGVkID0gdHJ1ZTsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVtaXRFcnJvckFuZENsb3NlTlQsIF90aGlzLCBlcnIyKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVtaXRDbG9zZU5ULCBfdGhpcyk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoY2IpIHsKICAgICAgICAgICAgcHJvY2Vzcy5uZXh0VGljayhlbWl0Q2xvc2VOVCwgX3RoaXMpOwogICAgICAgICAgICBjYihlcnIyKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHByb2Nlc3MubmV4dFRpY2soZW1pdENsb3NlTlQsIF90aGlzKTsKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfQogICAgICBmdW5jdGlvbiBlbWl0RXJyb3JBbmRDbG9zZU5UKHNlbGYyLCBlcnIpIHsKICAgICAgICBlbWl0RXJyb3JOVChzZWxmMiwgZXJyKTsKICAgICAgICBlbWl0Q2xvc2VOVChzZWxmMik7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZW1pdENsb3NlTlQoc2VsZjIpIHsKICAgICAgICBpZiAoc2VsZjIuX3dyaXRh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NMb29zZShzdWJDbGFzcywgc3VwZXJDbGFzcykgewogICAgICAgIHN1YkNsYXNzLnByb3RvdHlwZSA9IE9iamVjdC5jcmVhdGUoc3VwZXJDbGFzcy5wcm90b3R5cGUpOwogICAgICAgIHN1YkNsYXNzLnByb3RvdHlwZS5jb25zdHJ1Y3RvciA9IHN1YkNsYXNzOwogICAgICAgIHN1YkNsYXNzLl9fcHJvdG9fXyA9IHN1cGVyQ2xhc3M7CiAgICAgIH0KICAgICAgdmFyIGNvZGVzID0ge307CiAgICAgIGZ1bmN0aW9uIGNyZWF0ZUVycm9yVHlwZShjb2RlLCBtZXNzYWdlLCBCYXNlKSB7CiAgICAgICAgaWYgKCFCYXNlKSB7CiAgICAgICAgICBCYXNlID0gRXJyb3I7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIGdldE1lc3NhZ2UoYXJnMSwgYXJnMiwgYXJnMykgewogICAgICAgICAgaWYgKHR5cGVvZiBtZXNzYWdlID09PSAic3RyaW5nIikgewogICAgICAgICAgICByZXR1cm4gbWVzc2FnZTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiBtZXNzYWdlKGFyZzEsIGFyZzIsIGFyZzMpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB2YXIgTm9kZUVycm9yID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKF9CYXNlKSB7CiAgICAgICAgICBfaW5oZXJpdHNMb29zZShOb2RlRXJyb3IyLCBfQmFzZSk7CiAgICAgICAgICBmdW5jdGlvbiBOb2RlRXJyb3IyKGFyZzEsIGFyZzIsIGFyZzMpIHsKICAgICAgICAgICAgcmV0dXJuIF9CYXNlLmNhbGwodGhpcywgZ2V0TWVzc2FnZShhcmcxLCBhcmcyLCBhcmczKSkgfHwgdGhpczsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBOb2RlRXJyb3IyOwogICAgICAgIH0oQmFzZSk7CiAgICAgICAgTm9kZUVycm9yLnByb3RvdHlwZS5uYW1lID0gQmFzZS5uYW1lOwogICAgICAgIE5vZGVFcnJvci5wcm90b3R5cGUuY29kZSA9IGNvZGU7CiAgICAgICAgY29kZXNbY29kZV0gPSBOb2RlRXJyb3I7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gb25lT2YoZXhwZWN0ZWQsIHRoaW5nKSB7CiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZXhwZWN0ZWQpKSB7CiAgICAgICAgICB2YXIgbGVuID0gZXhwZWN0ZWQubGVuZ3RoOwogICAgICAgICAgZXhwZWN0ZWQgPSBleHBlY3RlZC5tYXAoZnVuY3Rpb24oaSkgewogICAgICAgICAgICByZXR1cm4gU3RyaW5nKGkpOwogICAgICAgICAgfSk7CiAgICAgICAgICBpZiAobGVuID4gMikgewogICAgICAgICAgICByZXR1cm4gIm9uZSBvZiAiLmNvbmNhdCh0aGluZywgIiAiKS5jb25jYXQoZXhwZWN0ZWQuc2xpY2UoMCwgbGVuIC0gMSkuam9pbigiLCAiKSwgIiwgb3IgIikgKyBleHBlY3RlZFtsZW4gLSAxXTsKICAgICAgICAgIH0gZWxzZSBpZiAobGVuID09PSAyKSB7CiAgICAgICAgICAgIHJldHVybiAib25lIG9mICIuY29uY2F0KHRoaW5nLCAiICIpLmNvbmNhdChleHBlY3RlZFswXSwgIiBvciAiKS5jb25jYXQoZXhwZWN0ZWRbMV0pOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuICJvZiAiLmNvbmNhdCh0aGluZywgIiAiKS5jb25jYXQoZXhwZWN0ZWRbMF0pOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICByZXR1cm4gIm9mICIuY29uY2F0KHRoaW5nLCAiICIpLmNvbmNhdChTdHJpbmcoZXhwZWN0ZWQpKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc3RhcnRzV2l0aChzdHIsIHNlYXJjaCwgcG9zKSB7CiAgICAgICAgcmV0d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wZWN0ZWQsIGFjdHVhbCkgewogICAgICAgIHZhciBkZXRlcm1pbmVyOwogICAgICAgIGlmICh0eXBlb2YgZXhwZWN0ZWQgPT09ICJzdHJpbmciICYmIHN0YXJ0c1dpdGgoZXhwZWN0ZWQsICJub3QgIikpIHsKICAgICAgICAgIGRldGVybWluZXIgPSAibXVzdCBub3QgYmUiOwogICAgICAgICAgZXhwZWN0ZWQgPSBleHBlY3RlZC5yZXBsYWNlKC9ebm90IC8sICIiKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZGV0ZXJtaW5lciA9ICJtdXN0IGJlIjsKICAgICAgICB9CiAgICAgICAgdmFyIG1zZzsKICAgICAgICBpZiAoZW5kc1dpdGgobmFtZSwgIiBhcmd1bWVudCIpKSB7CiAgICAgICAgICBtc2cgPSAiVGhlICIuY29uY2F0KG5hbWUsICIgIikuY29uY2F0KGRldGVybWluZXIsICIgIikuY29uY2F0KG9uZU9mKGV4cGVjdGVkLCAidHlwZSIpKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdmFyIHR5cGUgPSBpbmNsdWRlcyhuYW1lLCAiLiIpID8gInByb3BlcnR5IiA6ICJhcmd1bWVudCI7CiAgICAgICAgICBtc2cgPSAnVGhlICInLmNvbmNhdChuYW1lLCAnIiAnKS5jb25jYXQodHlwZSwgIiAiKS5jb25jYXQoZGV0ZXJtaW5lciwgIiAiKS5jb25jYXQob25lT2YoZXhwZWN0ZWQsICJ0eXBlIikpOwogICAgICAgIH0KICAgICAgICBtc2cgKz0gIi4gUmVjZWl2ZWQgdHlwZSAiLmNvbmNhdCh0eXBlb2YgYWN0dWFsKTsKICAgICAgICByZXR1cm4gbXNnOwogICAgICB9LCBUeXBlRXJyb3IpOwogICAgICBjcmVhdGVFcnJvclR5cGUoIkVSUl9TVFJFQU1fUFVTSF9BRlRFUl9FT0YiLCAic3RyZWFtLnB1c2goKSBhZnRlciBFT0YiKTsKICAgICAgY3JlYXRlRXJyb3JUeXBlKCJFUlJfTU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2FybmVkID0gZmFsc2U7CiAgICAgICAgZnVuY3Rpb24gZGVwcmVjYXRlZCgpIHsKICAgICAgICAgIGlmICghd2FybmVkKSB7CiAgICAgICAgICAgIGlmIChjb25maWcoInRocm93RGVwcmVjYXRpb24iKSkgewogICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihtc2cpOwogICAgICAgICAgICB9IGVsc2UgaWYgKGNvbmZpZygidHJhY2VEZXByZWNhdGlvbiIpKSB7CiAgICAgICAgICAgICAgY29uc29sZS50cmFjZShtc2cpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGNvbnNvbGUud2Fybihtc2cpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHdhcm5lZCA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gZm4uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGRlcHJlY2F0ZWQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gY29uZmlnKG5hbWUpIHsKICAgICAgICB0cnkgewogICAgICAgICAgaWYgKCFnbG9iYWwubG9jYWxTdG9yYWdlKQogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfSBjYXRjaCAoXykgewogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgICB2YXIgdmFsID0gZ2xvYmFsLmxvY2FsU3RvcmFnZVtuYW1lXTsKICAgICAgICBpZiAodmFsID09IG51bGwpCiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgcmV0dXJuIFN0cmluZyh2YWwpLnRvTG93ZXJDYXNlKCkgPT09ICJ0cnVlIjsKICAgICAgfQogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcmVhZGFibGUtc3RyZWFtQDMuNi4yL25vZGVfbW9kdWxlcy9yZWFkYWJsZS1zdHJlYW0vbGliL19zdHJlYW1fd3JpdGFibGUuanMKICB2YXIgcmVx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ICAgICAgIH0KICAgICAgICBpZiAodHlwZW9mIGVuY29kaW5nID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICBjYiA9IGVuY29kaW5nOwogICAgICAgICAgZW5jb2RpbmcgPSBudWxsOwogICAgICAgIH0KICAgICAgICBpZiAoaXNCdWYpCiAgICAgICAgICBlbmNvZGluZyA9ICJidWZmZXIiOwogICAgICAgIGVsc2UgaWYgKCFlbmNvZGluZykKICAgICAgICAgIGVuY29kaW5nID0gc3RhdGUuZGVmYXVsdEVuY29kaW5nOwogICAgICAgIGlmICh0eXBlb2YgY2IgIT09ICJmdW5jdGlvbiIpCiAgICAgICAgICBjYiA9IG5vcDsKICAgICAgICBpZiAoc3RhdGUuZW5kaW5nKQogICAgICAgICAgd3JpdGVBZnRlckVuZCh0aGlzLCBjYik7CiAgICAgICAgZWxzZSBpZiAoaXNCdWYgfHwgdmFsaWRDaHVuayh0aGlzLCBzdGF0ZSwgY2h1bmssIGNiKSkgewogICAgICAgICAgc3RhdGUucGVuZGluZ2NiKys7CiAgICAgICAgICByZXQgPSB3cml0ZU9yQnVmZmVyKHRoaXMsIHN0YXRlLCBpc0J1ZiwgY2h1bmssIGVuY29kaW5nLCBjYik7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH07CiAgICAgIFdyaXRhYmxlLnByb3RvdHlwZS5jb3JrID0gZnVuY3Rpb24oKSB7CiAgICAgICAgdGhpcy5fd3JpdGFibGVTdGF0ZS5jb3JrZWQrKzsKICAgICAgfTsKICAgICAgV3JpdGFibGUucHJvdG90eXBlLnVuY29yayA9IGZ1bmN0aW9uKCkgewogICAgICAgIHZhciBzdGF0ZSA9IHRoaXMuX3dyaXRhYmxlU3RhdGU7CiAgICAgICAgaWYgKHN0YXRlLmNvcmtlZCkgewogICAgICAgICAgc3RhdGUuY29ya2VkLS07CiAgICAgICAgICBpZiAoIXN0YXRlLndyaXRpbmcgJiYgIXN0YXRlLmNvcmtlZCAmJiAhc3RhdGUu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bmcpIHsKICAgICAgICBpZiAoIXN0YXRlLm9iamVjdE1vZGUgJiYgc3RhdGUuZGVjb2RlU3RyaW5ncyAhPT0gZmFsc2UgJiYgdHlwZW9mIGNodW5rID09PSAic3RyaW5nIikgewogICAgICAgICAgY2h1bmsgPSBCdWZmZXIxMC5mcm9tKGNodW5rLCBlbmNvZGluZyk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBjaHVuazsKICAgICAgfQogICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoV3JpdGFibGUucHJvdG90eXBlLCAid3JpdGFibGVIaWdoV2F0ZXJNYXJrIiwgewogICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgIGdldDogZnVuY3Rpb24gZ2V0KCkgewogICAgICAgICAgcmV0dXJuIHRoaXMuX3dyaXRhYmxlU3RhdGUuaGlnaFdhdGVyTWFyazsKICAgICAgICB9CiAgICAgIH0pOwogICAgICBmdW5jdGlvbiB3cml0ZU9yQnVmZmVyKHN0cmVhbSwgc3RhdGUsIGlzQnVmLCBjaHVuaywgZW5jb2RpbmcsIGNiKSB7CiAgICAgICAgaWYgKCFpc0J1ZikgewogICAgICAgICAgdmFyIG5ld0NodW5rID0gZGVjb2RlQ2h1bmsoc3RhdGUsIGNodW5rLCBlbmNvZGluZyk7CiAgICAgICAgICBpZiAoY2h1bmsgIT09IG5ld0NodW5rKSB7CiAgICAgICAgICAgIGlzQnVmID0gdHJ1ZTsKICAgICAgICAgICAgZW5jb2RpbmcgPSAiYnVmZmVyIjsKICAgICAgICAgICAgY2h1bmsgPSBuZXdDaHVuazsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgdmFyIGxlbiA9IHN0YXRlLm9iamVjdE1vZGUgPyAxIDogY2h1bmsubGVuZ3RoOwogICAgICAgIHN0YXRlLmxlbmd0aCArPSBsZW47CiAgICAgICAgdmFyIHJldCA9IHN0YXRlLmxlbmd0aCA8IHN0YXRlLmhpZ2hXYXRlck1hcms7CiAgICAgICAgaW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Ryb3llZCkKICAgICAgICAgIHN0YXRlLm9ud3JpdGUobmV3IEVSUl9TVFJFQU1fREVTVFJPWUVEKCJ3cml0ZSIpKTsKICAgICAgICBlbHNlIGlmICh3cml0ZXYpCiAgICAgICAgICBzdHJlYW0uX3dyaXRldihjaHVuaywgc3RhdGUub253cml0ZSk7CiAgICAgICAgZWxzZQogICAgICAgICAgc3RyZWFtLl93cml0ZShjaHVuaywgZW5jb2RpbmcsIHN0YXRlLm9ud3JpdGUpOwogICAgICAgIHN0YXRlLnN5bmMgPSBmYWxzZTsKICAgICAgfQogICAgICBmdW5jdGlvbiBvbndyaXRlRXJyb3Ioc3RyZWFtLCBzdGF0ZSwgc3luYywgZXIsIGNiKSB7CiAgICAgICAgLS1zdGF0ZS5wZW5kaW5nY2I7CiAgICAgICAgaWYgKHN5bmMpIHsKICAgICAgICAgIHByb2Nlc3MubmV4dFRpY2soY2IsIGVyKTsKICAgICAgICAgIHByb2Nlc3MubmV4dFRpY2soZmluaXNoTWF5YmUsIHN0cmVhbSwgc3RhdGUpOwogICAgICAgICAgc3RyZWFtLl93cml0YWJsZVN0YXRlLmVycm9yRW1pdHRlZCA9IHRydWU7CiAgICAgICAgICBlcnJvck9yRGVzdHJveShzdHJlYW0sIGVyKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgY2IoZXIpOwogICAgICAgICAgc3RyZWFtLl93cml0YWJsZVN0YXRlLmVycm9yRW1pdHRlZCA9IHRydWU7CiAgICAgICAgICBlcnJvck9yRGVzdHJveShzdHJlYW0sIGVyKTsKICAgICAgICAgIGZpbmlzaE1heWJlKHN0cmVhbSwgc3RhdGUpOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBvbndyaXRlU3RhdGVVcGRhdGUoc3RhdGUpIHsKICAgICAgICBzdGF0ZS53cml0aW5nID0gZmFsc2U7CiAgICAgICAgc3RhdGUud3JpdGVjYiA9IG51bGw7CiAgICAgICAgc3RhdGUubGVuZ3RoIC09IHN0YXRl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AgICAgICAgICAgIGVudHJ5ID0gZW50cnkubmV4dDsKICAgICAgICAgICAgc3RhdGUuYnVmZmVyZWRSZXF1ZXN0Q291bnQtLTsKICAgICAgICAgICAgaWYgKHN0YXRlLndyaXRpbmcpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKGVudHJ5ID09PSBudWxsKQogICAgICAgICAgICBzdGF0ZS5sYXN0QnVmZmVyZWRSZXF1ZXN0ID0gbnVsbDsKICAgICAgICB9CiAgICAgICAgc3RhdGUuYnVmZmVyZWRSZXF1ZXN0ID0gZW50cnk7CiAgICAgICAgc3RhdGUuYnVmZmVyUHJvY2Vzc2luZyA9IGZhbHNlOwogICAgICB9CiAgICAgIFdyaXRhYmxlLnByb3RvdHlwZS5fd3JpdGUgPSBmdW5jdGlvbihjaHVuaywgZW5jb2RpbmcsIGNiKSB7CiAgICAgICAgY2IobmV3IEVSUl9NRVRIT0RfTk9UX0lNUExFTUVOVEVEKCJfd3JpdGUoKSIpKTsKICAgICAgfTsKICAgICAgV3JpdGFibGUucHJvdG90eXBlLl93cml0ZXYgPSBudWxsOwogICAgICBXcml0YWJsZS5wcm90b3R5cGUuZW5kID0gZnVuY3Rpb24oY2h1bmssIGVuY29kaW5nLCBjYikgewogICAgICAgIHZhciBzdGF0ZSA9IHRoaXMuX3dyaXRhYmxlU3RhdGU7CiAgICAgICAgaWYgKHR5cGVvZiBjaHVuayA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgY2IgPSBjaHVuazsKICAgICAgICAgIGNodW5rID0gbnVsbDsKICAgICAgICAgIGVuY29kaW5nID0gbnVsbDsKICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBlbmNvZGluZyA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgY2IgPSBlbmNvZGluZzsKICAgICAgICAgIGVuY29kaW5nID0gbnVsbDsKICAgICAgICB9CiAgICAgICAgaWYgKGNodW5rICE9PSBudWxsICYmIGNodW5rICE9PSB2b2lkIDApCiAgICAgICAgICB0aGlzLndyaXRlKGNodW5rLCBlbmNvZGluZyk7CiAgICAgICAgaWYgKHN0YXRlLmNvcmtlZCkgewogICAgICAgICAgc3RhdGUuY29ya2VkID0gMTsKICAgICAgICAgIHRoaXMudW5jb3JrKCk7CiAgICAgICAgfQogICAgICAgIGlmICghc3RhdGUuZW5kaW5nKQogICAgICAgICAgZW5kV3JpdGFibGUodGhpcywgc3RhdGUsIGNiKTsKICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFdyaXRhYmxlLnByb3RvdHlwZSwgIndyaXRhYmxlTGVuZ3RoIiwgewogICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgIGdldDogZnVuY3Rpb24gZ2V0KCkgewogICAgICAgICAgcmV0dXJuIHRoaXMuX3dyaXRhYmxlU3RhdGUubGVuZ3RoOwogICAgICAgIH0KICAgICAgfSk7CiAgICAgIGZ1bmN0aW9uIG5lZWRGaW5pc2goc3RhdGUpIHsKICAgICAgICByZXR1cm4gc3RhdGUuZW5kaW5nICYmIHN0YXRlLmxlbmd0aCA9PT0gMCAmJiBzdGF0ZS5idWZmZXJlZFJlcXVlc3QgPT09IG51bGwgJiYgIXN0YXRlLmZpbmlzaGVkICYmICFzdGF0ZS53cml0aW5nOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGNhbGxGaW5hbChzdHJlYW0sIHN0YXRlKSB7CiAgICAgICAgc3RyZWFtLl9maW5hbChmdW5jdGlvbihlcnIpIHsKICAgICAgICAgIHN0YXRlLnBlbmRpbmdjYi0tOwogICAgICAgICAgaWYgKGVycikgewogICAgICAgICAgICBlcnJvck9yRGVzdHJveShzdHJlYW0sIGVycik7CiAgICAgICAgICB9CiAgICAgICAgICBzdGF0ZS5wcmVmaW5pc2hlZCA9IHRydWU7CiAgICAgICAgICBzdHJlYW0uZW1pdCgicHJlZmluaXNoIik7CiAgICAgICAgICBmaW5pc2hNYXliZShzdHJlYW0sIHN0YXRlKTsKICAgICAgICB9KTsKICAgICAgfQogICAgICBmdW5jdGlvbiBwcmVmaW5pc2goc3RyZWFtLCBzdGF0ZSkgewogICAgICAgIGlmICghc3RhdGUucHJlZmluaXNoZWQgJiYgIXN0YXRlLmZpbmFsQ2FsbGVkKSB7CiAgICAgICAgICBpZiAodHlwZW9mIHN0cmVhbS5fZmluYWwgPT09ICJmdW5jdGlvbiIgJiYgIXN0YXRlLmRlc3Ryb3llZCkgewogICAgICAgICAgICBzdGF0ZS5wZW5kaW5nY2IrKzsKICAgICAgICAgICAgc3RhdGUuZmluYWxDYWxsZWQgPSB0cnVlOwogICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGNhbGxGaW5hbCwgc3RyZWFtLCBzdGF0ZSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzdGF0ZS5wcmVmaW5pc2hlZCA9IHRydWU7CiAgICAgICAgICAgIHN0cmVhbS5lbWl0KCJwcmVmaW5pc2giKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZmluaXNoTWF5YmUoc3RyZWFtLCBzdGF0ZSkgewogICAgICAgIHZhciBuZWVkID0gbmVlZEZpbmlzaChzdGF0ZSk7CiAgICAgICAgaWYgKG5lZWQpIHsKICAgICAgICAgIHByZWZpbmlzaChzdHJlYW0sIHN0YXRlKTsKICAgICAgICAgIGlmIChzdGF0ZS5wZW5kaW5nY2IgPT09IDApIHsKICAgICAgICAgICAgc3RhdGUuZmluaXNoZWQgPSB0cnVlOwogICAgICAgICAgICBzdHJlYW0uZW1pdCgiZmluaXNoIik7CiAgICAgICAgICAgIGlmIChzdGF0ZS5hdXRvRGVzdHJveSkgewogICAgICAgICAgICAgIHZhciByU3RhdGUgPSBzdHJlYW0uX3JlYWRhYmxlU3RhdGU7CiAgICAgICAgICAgICAgaWYgKCFyU3RhdGUgfHwgclN0YXRlLmF1dG9EZXN0cm95ICYmIHJTdGF0ZS5lbmRFbWl0dGVkKSB7CiAgICAgICAgICAgICAgICBzdHJlYW0uZGVzdHJveSgpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gbmVlZDsKICAgICAgfQogICAgICBmdW5jdGlvbiBlbmRXcml0YWJsZShzdHJlYW0sIHN0YXRlLCBjYikgewogICAgICAgIHN0YXRlLmVuZGluZyA9IHRydWU7CiAgICAgICAgZmluaXNoTWF5YmUoc3RyZWFtLCBzdGF0ZSk7CiAgICAgICAgaWYgKGNiKSB7CiAgICAgICAgICBpZiAoc3RhdGUuZmluaXNoZWQpCiAgICAgICAgICAgIHByb2Nlc3MubmV4dFRpY2soY2IpOwogICAgICAgICAgZWxzZQogICAgICAgICAgICBzdHJlYW0ub25jZSgiZmluaXNoIiwgY2IpOwogICAgICAgIH0KICAgICAgICBzdGF0ZS5lbmRlZCA9IHRydWU7CiAgICAgICAgc3RyZWFtLndyaXRhYmxlID0gZmFsc2U7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gb25Db3JrZWRGaW5pc2goY29ya1JlcSwgc3RhdGUsIGVycikgewogICAgICAgIHZhciBlbnRyeSA9IGNvcmtSZXEuZW50cnk7CiAgICAgICAgY29ya1JlcS5lbnRyeSA9IG51bGw7CiAgICAgICAgd2hpbGUgKGVudHJ5KSB7CiAgICAgICAgICB2YXIgY2IgPSBlbnRyeS5jYWxsYmFjazsKICAgICAgICAgIHN0YXRlLnBlbmRpbmdjYi0tOwogICAgICAgICAgY2IoZXJyKTsKICAgICAgICAgIGVudHJ5ID0gZW50cnkubmV4dDsKICAgICAgICB9CiAgICAgICAgc3RhdGUuY29ya2VkUmVxdWVzdHNGcmVlLm5leHQgPSBjb3JrUmVxOwogICAgICB9CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShXcml0YWJsZS5wcm90b3R5cGUsICJkZXN0cm95ZWQiLCB7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iwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIG9iamVjdEtleXMgPSBPYmplY3Qua2V5cyB8fCBmdW5jdGlvbihvYmopIHsKICAgICAgICB2YXIga2V5czMgPSBbXTsKICAgICAgICBmb3IgKHZhciBrZXkgaW4gb2JqKQogICAgICAgICAga2V5czMucHVzaChrZXkpOwogICAgICAgIHJldHVybiBrZXlzMzsKICAgICAgfTsKICAgICAgbW9kdWxlMi5leHBvcnRzID0gRHVwbGV4OwogICAgICB2YXIgUmVhZGFibGUgPSByZXF1aXJlX3N0cmVhbV9yZWFkYWJsZSgpOwogICAgICB2YXIgV3JpdGFibGUgPSByZXF1aXJlX3N0cmVhbV93cml0YWJsZSgpOwogICAgICByZXF1aXJlX2luaGVyaXRzX2Jyb3dzZXIoKShEdXBsZXgsIFJlYWRhYmxlKTsKICAgICAgewogICAgICAgIGtleXMyID0gb2JqZWN0S2V5cyhXcml0YWJsZS5wcm90b3R5cGUpOwogICAgICAgIGZvciAodiA9IDA7IHYgPCBrZXlzMi5sZW5ndGg7IHYrKykgewogICAgICAgICAgbWV0aG9kID0ga2V5czJbdl07CiAgICAgICAgICBpZiAoIUR1cGxleC5wcm90b3R5cGVbbWV0aG9kXSkKICAgICAgICAgICAgRHVwbGV4LnByb3RvdHlwZVttZXRob2RdID0gV3JpdGFibGUucHJvdG90eXBlW21ldGhvZF07CiAgICAgICAgfQogICAgICB9CiAgICAgIHZhciBrZXlzMjsKICAgICAgdmFyIG1ldGhvZDsKICAgICAgdmFyIHY7CiAgICAgIGZ1bmN0aW9uIER1cGxleChvcHRpb25zKSB7CiAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIER1cGxleCkpCiAgICAgICAgICByZXR1cm4gbmV3IER1cGxleChvcHRpb25zKTsKICAgICAgICBSZWFkYWJsZS5jYWxsKHRoaXMsIG9wdGlvbnMpOwogICAgICAgIFdyaXR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MC5pc0VuY29kaW5nIHx8IGZ1bmN0aW9uKGVuY29kaW5nKSB7CiAgICAgICAgZW5jb2RpbmcgPSAiIiArIGVuY29kaW5nOwogICAgICAgIHN3aXRjaCAoZW5jb2RpbmcgJiYgZW5jb2RpbmcudG9Mb3dlckNhc2UoKSkgewogICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgY2FzZSAidXRmLTgiOgogICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgY2FzZSAiYmluYXJ5IjoKICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICBjYXNlICJ1Y3MyIjoKICAgICAgICAgIGNhc2UgInVjcy0yIjoKICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgY2FzZSAidXRmLTE2bGUiOgogICAgICAgICAgY2FzZSAicmF3IjoKICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICB9OwogICAgICBmdW5jdGlvbiBfbm9ybWFsaXplRW5jb2RpbmcoZW5jKSB7CiAgICAgICAgaWYgKCFlbmMpCiAgICAgICAgICByZXR1cm4gInV0ZjgiOwogICAgICAgIHZhciByZXRyaWVkOwogICAgICAgIHdoaWxlICh0cnVlKSB7CiAgICAgICAgICBzd2l0Y2ggKGVuYykgewogICAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgICAgY2FzZSAidXRmLTgiOgogICAgICAgICAgICAgIHJldHVybiAidXRmOCI7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuICJ1dGYxNmxlIjsKICAgICAgICAgICAgY2FzZSAibGF0aW4xIjoKICAgICAgICAgICAgY2FzZSAiYmluYXJ5IjoKICAgICAgICAgICAgICByZXR1cm4gImxhdGluMSI7CiAgICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICAgIGNhc2UgImFzY2lpIjoKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gZW5jOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgIGlmIChyZXRyaWVkKQogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgIGVuYyA9ICgiIiArIGVuYykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICByZXRyaWVkID0gdHJ1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gbm9ybWFsaXplRW5jb2RpbmcoZW5jKSB7CiAgICAgICAgdmFyIG5lbmMgPSBfbm9ybWFsaXplRW5jb2RpbmcoZW5jKTsKICAgICAgICBpZiAodHlwZW9mIG5lbmMgIT09ICJzdHJpbmciICYmIChCdWZmZXIxMC5pc0VuY29kaW5nID09PSBpc0VuY29kaW5nIHx8ICFpc0VuY29kaW5nKGVuYykpKQogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jKTsKICAgICAgICByZXR1cm4gbmVuYyB8fCBlbmM7CiAgICAgIH0KICAgICAgZXhwb3J0czIuU3RyaW5nRGVjb2RlciA9IFN0cmluZ0RlY29kZXI7CiAgICAgIGZ1bmN0aW9uIFN0cmluZ0RlY29kZXIoZW5jb2RpbmcpIHsKICAgICAgICB0aGlzLmVuY29kaW5nID0gbm9ybWFsaXplRW5jb2RpbmcoZW5jb2RpbmcpOwogICAgICAgIHZhciBuYjsKICAgICAgICBzd2l0Y2ggKHRoaXMuZW5jb2RpbmcpIHsKICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICB0aGlzLnRleHQgPSB1dGYxNlRleHQ7CiAgICAgICAgICAgIHRoaXMuZW5kID0gdXRmMTZFbmQ7CiAgICAgICAgICAgIG5iID0gNDsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgICAgdGhpcy5maWxsTGFzdCA9IHV0ZjhGaWxsTGFzdDsKICAgICAgICAgICAgbmIgPSA0OwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICAgIHRoaXMudGV4dCA9IGJhc2U2NFRleHQ7CiAgICAgICAgICAgIHRoaXMuZW5kID0gYmFzZTY0RW5kOwogICAgICAgICAgICBuYiA9IDM7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgdGhpcy53cml0ZSA9IHNpbXBsZVdyaXRlOwogICAgICAgICAgICB0aGlzLmVuZCA9IHNpbXBsZUVuZDsKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICB0aGlzLmxhc3ROZWVkID0gMDsKICAgICAgICB0aGlzLmxhc3RUb3RhbCA9IDA7CiAgICAgICAgdGhpcy5sYXN0Q2hhciA9IEJ1ZmZlcjEwLmFsbG9jVW5zYWZlKG5iKTsKICAgICAgfQogICAgICBTdHJpbmdEZWNvZGVyLnByb3RvdHlwZS53cml0ZSA9IGZ1bmN0aW9uKGJ1ZikgewogICAgICAgIGlmIChidWYubGVuZ3RoID09PSAwKQogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIHZhciByOwogICAgICAgIHZhciBpOwogICAgICAgIGlmICh0aGlzLmxhc3ROZWVkKSB7CiAgICAgICAgICByID0gdGhpcy5maWxsTGFzdChidWYpOwogICAgICAgICAgaWYgKHIgPT09IHZvaWQgMCkKICAgICAgICAgICAgcmV0dXJuICIiOwogICAgICAgICAgaSA9IHRoaXMubGFzdE5lZWQ7CiAgICAgICAgICB0aGlzLmxhc3ROZWVkID0gMDsKICAgICAgICB9IGVsc2Ug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UgaWYgKGJ5dGUgPj4gMyA9PT0gMzApCiAgICAgICAgICByZXR1cm4gNDsKICAgICAgICByZXR1cm4gYnl0ZSA+PiA2ID09PSAyID8gLTEgOiAtMjsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGY4Q2hlY2tJbmNvbXBsZXRlKHNlbGYyLCBidWYsIGkpIHsKICAgICAgICB2YXIgaiA9IGJ1Zi5sZW5ndGggLSAxOwogICAgICAgIGlmIChqIDwgaSkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIHZhciBuYiA9IHV0ZjhDaGVja0J5dGUoYnVmW2pdKTsKICAgICAgICBpZiAobmIgPj0gMCkgewogICAgICAgICAgaWYgKG5iID4gMCkKICAgICAgICAgICAgc2VsZjIubGFzdE5lZWQgPSBuYiAtIDE7CiAgICAgICAgICByZXR1cm4gbmI7CiAgICAgICAgfQogICAgICAgIGlmICgtLWogPCBpIHx8IG5iID09PSAtMikKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIG5iID0gdXRmOENoZWNrQnl0ZShidWZbal0pOwogICAgICAgIGlmIChuYiA+PSAwKSB7CiAgICAgICAgICBpZiAobmIgPiAwKQogICAgICAgICAgICBzZWxmMi5sYXN0TmVlZCA9IG5iIC0gMjsKICAgICAgICAgIHJldHVybiBuYjsKICAgICAgICB9CiAgICAgICAgaWYgKC0taiA8IGkgfHwgbmIgPT09IC0yKQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgbmIgPSB1dGY4Q2hlY2tCeXRlKGJ1ZltqXSk7CiAgICAgICAgaWYgKG5iID49IDApIHsKICAgICAgICAgIGlmIChuYiA+IDApIHsKICAgICAgICAgICAgaWYgKG5iID09PSAyKQogICAgICAgICAgICAgIG5iID0gMDsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgIHNlbGYyLmxhc3ROZWVkID0gbmIgLSAzOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIG5iOwogICAgICAgIH0KICAgICAgICByZXR1cm4gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGY4Q2hlY2tFeHRyYUJ5dGVzKHNlbGYyLCBidWYsIHApIHsKICAgICAgICBpZiAoKGJ1ZlswXSAmIDE5MikgIT09IDEyOCkgewogICAgICAgICAgc2VsZjIubGFzdE5lZWQgPSAwOwogICAgICAgICAgcmV0dXJuICJcdUZGRkQiOwogICAgICAgIH0KICAgICAgICBpZiAoc2VsZjIubGFzdE5lZWQgPiAxICYmIGJ1Zi5sZW5ndGggPiAxKSB7CiAgICAgICAgICBpZiAoKGJ1ZlsxXSAmIDE5MikgIT09IDEyOCkgewogICAgICAgICAgICBzZWxmMi5sYXN0TmVlZCA9IDE7CiAgICAgICAgICAgIHJldHVybiAiXHVGRkZEIjsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzZWxmMi5sYXN0TmVlZCA+IDIgJiYgYnVmLmxlbmd0aCA+IDIpIHsKICAgICAgICAgICAgaWYgKChidWZbMl0gJiAxOTIpICE9PSAxMjgpIHsKICAgICAgICAgICAgICBzZWxmMi5sYXN0TmVlZCA9IDI7CiAgICAgICAgICAgICAgcmV0dXJuICJcdUZGRkQiOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIHV0ZjhGaWxsTGFzdChidWYpIHsKICAgICAgICB2YXIgcCA9IHRoaXMubGFzdFRvdGFsIC0gdGhpcy5sYXN0TmVlZDsKICAgICAgICB2YXIgciA9IHV0ZjhDaGVja0V4dHJhQnl0ZXModGhpcywgYnVmLCBwKTsKICAgICAgICBpZiAociAhPT0gdm9pZCAwKQogICAgICAgICAgcmV0dXJuIHI7CiAgICAgICAgaWYgKHRoaXMubGFzdE5lZWQgPD0gYnVmLmxlbmd0aCkgewogICAgICAgICAgYnVmLmNvcHkodGhpcy5sYXN0Q2hhciwgcCwgMCwgdGhpcy5sYXN0TmVlZCk7CiAgICAgICAgICByZXR1cm4gdGhpcy5sYXN0Q2hhci50b1N0cmluZyh0a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AxKTsKICAgICAgICAgICAgaWYgKGMgPj0gNTUyOTYgJiYgYyA8PSA1NjMxOSkgewogICAgICAgICAgICAgIHRoaXMubGFzdE5lZWQgPSAyOwogICAgICAgICAgICAgIHRoaXMubGFzdFRvdGFsID0gNDsKICAgICAgICAgICAgICB0aGlzLmxhc3RDaGFyWzBdID0gYnVmW2J1Zi5sZW5ndGggLSAyXTsKICAgICAgICAgICAgICB0aGlzLmxhc3RDaGFyWzFdID0gYnVmW2J1Zi5sZW5ndGggLSAxXTsKICAgICAgICAgICAgICByZXR1cm4gci5zbGljZSgwLCAtMSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiByOwogICAgICAgIH0KICAgICAgICB0aGlzLmxhc3ROZWVkID0gMTsKICAgICAgICB0aGlzLmxhc3RUb3RhbCA9IDI7CiAgICAgICAgdGhpcy5sYXN0Q2hhclswXSA9IGJ1ZltidWYubGVuZ3RoIC0gMV07CiAgICAgICAgcmV0dXJuIGJ1Zi50b1N0cmluZygidXRmMTZsZSIsIGksIGJ1Zi5sZW5ndGggLSAxKTsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNkVuZChidWYpIHsKICAgICAgICB2YXIgciA9IGJ1ZiAmJiBidWYubGVuZ3RoID8gdGhpcy53cml0ZShidWYpIDogIiI7CiAgICAgICAgaWYgKHRoaXMubGFzdE5lZWQpIHsKICAgICAgICAgIHZhciBlbmQgPSB0aGlzLmxhc3RUb3RhbCAtIHRoaXMubGFzdE5lZWQ7CiAgICAgICAgICByZXR1cm4gciArIHRoaXMubGFzdENoYXIudG9TdHJpbmcoInV0ZjE2bGUiLCAwLCBlbmQpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcjsKICAgICAgfQogICAgICBmdW5jdGlvbiBiYXNlNjRUZXh0KGJ1ZiwgaSkgewogICAgICAgIHZhciBuID0gKGJ1Zi5sZW5ndGggLSBpKSAlIDM7CiAgICAgICAgaWYgKG4gPT09IDApCiAgICAgIC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GVyICYmIHR5cGVvZiBzdHJlYW0uYWJvcnQgPT09ICJmdW5jdGlvbiI7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZW9zKHN0cmVhbSwgb3B0cywgY2FsbGJhY2spIHsKICAgICAgICBpZiAodHlwZW9mIG9wdHMgPT09ICJmdW5jdGlvbiIpCiAgICAgICAgICByZXR1cm4gZW9zKHN0cmVhbSwgbnVsbCwgb3B0cyk7CiAgICAgICAgaWYgKCFvcHRzKQogICAgICAgICAgb3B0cyA9IHt9OwogICAgICAgIGNhbGxiYWNrID0gb25jZShjYWxsYmFjayB8fCBub29wKTsKICAgICAgICB2YXIgcmVhZGFibGUgPSBvcHRzLnJlYWRhYmxlIHx8IG9wdHMucmVhZGFibGUgIT09IGZhbHNlICYmIHN0cmVhbS5yZWFkYWJsZTsKICAgICAgICB2YXIgd3JpdGFibGUgPSBvcHRzLndyaXRhYmxlIHx8IG9wdHMud3JpdGFibGUgIT09IGZhbHNlICYmIHN0cmVhbS53cml0YWJsZTsKICAgICAgICB2YXIgb25sZWdhY3lmaW5pc2ggPSBmdW5jdGlvbiBvbmxlZ2FjeWZpbmlzaDIoKSB7CiAgICAgICAgICBpZiAoIXN0cmVhbS53cml0YWJsZSkKICAgICAgICAgICAgb25maW5pc2goKTsKICAgICAgICB9OwogICAgICAgIHZhciB3cml0YWJsZUVuZGVkID0gc3RyZWFtLl93cml0YWJsZVN0YXRlICYmIHN0cmVhbS5fd3JpdGFibGVTdGF0ZS5maW5pc2hlZDsKICAgICAgICB2YXIgb25maW5pc2ggPSBmdW5jdGlvbiBvbmZpbmlzaDIoKSB7CiAgICAgICAgICB3cml0YWJsZSA9IGZhbHNlOwogICAgICAgICAgd3JpdGFibGVFbmRlZCA9IHRydWU7CiAgICAgICAgICBpZiAoIXJlYWRhYmxlKQogICAgICAgICAgICBjYWxsYmFjay5jYWxsKHN0cmVhbSk7CiAgICAgICAgfTsKICAgICAgICB2YXIgcmVhZGFibGVFbmRlZCA9IHN0cmVhbS5fcmVhZGFibGVTdGF0ZSAmJiBzdHJlYW0uX3JlYWRhYmxlU3RhdGUuZW5kRW1pdHRlZDsKICAgICAgICB2YXIgb25lbmQgPSBmdW5jdGlvbiBvbmVuZDIoKSB7CiAgICAgICAgICByZWFkYWJsZSA9IGZhbHNlOwogICAgICAgICAgcmVhZGFibGVFbmRlZCA9IHRydWU7CiAgICAgICAgICBpZiAoIXdyaXRhYmxlKQogICAgICAgICAgICBjYWxsYmFjay5jYWxsKHN0cmVhbSk7CiAgICAgICAgfTsKICAgICAgICB2YXIgb25lcnJvciA9IGZ1bmN0aW9uIG9uZXJyb3IyKGVycikgewogICAgICAgICAgY2FsbGJhY2suY2FsbChzdHJlYW0sIGVycik7CiAgICAgICAgfTsKICAgICAgICB2YXIgb25jbG9zZSA9IGZ1bmN0aW9uIG9uY2xvc2UyKCkgewogICAgICAgICAgdmFyIGVycjsKICAgICAgICAgIGlmIChyZWFkYWJsZSAmJiAhcmVhZGFibGVFbmRlZCkgewogICAgICAgICAgICBpZiAoIXN0cmVhbS5fcmVhZGFibGVTdGF0ZSB8fCAhc3RyZWFtLl9yZWFkYWJsZVN0YXRlLmVuZGVkKQogICAgICAgICAgICAgIGVyciA9IG5ldyBFUlJfU1RSRUFNX1BSRU1BVFVSRV9DTE9TRSgpOwogICAgICAgICAgICByZXR1cm4gY2FsbGJhY2suY2FsbChzdHJlYW0sIGVycik7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAod3JpdGFibGUgJiYgIXdyaXRhYmxlRW5kZWQpIHsKICAgICAgICAgICAgaWYgKCFzdHJlYW0uX3dyaXRhYmxlU3RhdGUgfHwgIXN0cmVhbS5fd3JpdGFibGVTdGF0ZS5lbmRlZCkKICAgICAgICAgICAgICBlcnIgPSBuZXcgRVJSX1NUUkVBTV9QUkVNQVRVUkVfQ0xPU0UoKTsKICAgICAgICAgICAgcmV0dXJuIGNhbGxiYWNrLmNhbGwoc3RyZWFtLCBlcnIpOwogICAgICAgICAgfQogICAgIC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InVzZSBzdHJpY3QiOwogICAgICB2YXIgX09iamVjdCRzZXRQcm90b3R5cGVPOwogICAgICBmdW5jdGlvbiBfZGVmaW5lUHJvcGVydHkob2JqLCBrZXksIHZhbHVlKSB7CiAgICAgICAga2V5ID0gX3RvUHJvcGVydHlLZXkoa2V5KTsKICAgICAgICBpZiAoa2V5IGluIG9iaikgewogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KG9iaiwga2V5LCB7IHZhbHVlLCBlbnVtZXJhYmxlOiB0cnVlLCBjb25maWd1cmFibGU6IHRydWUsIHdyaXRhYmxlOiB0cnVlIH0pOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBvYmpba2V5XSA9IHZhbHVlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gb2JqOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF90b1Byb3BlcnR5S2V5KGFyZykgewogICAgICAgIHZhciBrZXkgPSBfdG9QcmltaXRpdmUoYXJnLCAic3RyaW5nIik7CiAgICAgICAgcmV0dXJuIHR5cGVvZiBrZXkgPT09ICJzeW1ib2wiID8ga2V5IDogU3RyaW5nKGtleSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX3RvUHJpbWl0aXZlKGlucHV0LCBoaW50KSB7CiAgICAgICAgaWYgKHR5cGVvZiBpbnB1dCAhPT0gIm9iamVjdCIgfHwgaW5wdXQgPT09IG51bGwpCiAgICAgICAgICByZXR1cm4gaW5wdXQ7CiAgICAgICAgdmFyIHByaW0gPSBpbnB1dFtTeW1ib2wudG9QcmltaXRpdmVdOwogICAgICAgIGlmIChwcmltICE9PSB2b2lkIDApIHsKICAgICAgICAgIHZhciByZXMgPSBwcmltLmNhbGwoaW5wdXQsIGhpbnQgfHwgImRlZmF1bHQiKTsKICAgICAgICAgIGlmICh0eXBlb2YgcmVzICE9PSAib2JqZWN0IikKICAgICAgICAgICAgcmV0dXJuIHJlczsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoIkBAdG9QcmltaXRpdmUgbXVzdCByZXR1cm4gYSBwcmltaXRpdmUgdmFsdWUuIik7CiAgICAgICAgfQogICAgICAgIHJldHVybiAoaGludCA9PT0gInN0cmluZyIgPyBTdHJpbmcgOiBOdW1iZXIpKGlucHV0KTsKICAgICAgfQogICAgICB2YXIgZmluaXNoZWQgPSByZXF1aXJlX2VuZF9vZl9zdHJlYW0oKTsKICAgICAgdmFyIGtMYXN0UmVzb2x2ZSA9IFN5bWJvbCgibGFzdFJlc29sdmUiKTsKICAgICAgdmFyIGtMYXN0UmVqZWN0ID0gU3ltYm9sKCJsYXN0UmVqZWN0Iik7CiAgICAgIHZhciBrRXJyb3IgPSBTeW1ib2woImVycm9yIik7CiAgICAgIHZhciBrRW5kZWQgPSBTeW1ib2woImVuZGVkIik7CiAgICAgIHZhciBrTGFzdFByb21pc2UgPSBTeW1ib2woImxhc3RQcm9taXNlIik7CiAgICAgIHZhciBrSGFuZGxlUHJvbWlzZSA9IFN5bWJvbCgiaGFuZGxlUHJvbWlzZSIpOwogICAgICB2YXIga1N0cmVhbSA9IFN5bWJvbCgic3RyZWFtIik7CiAgICAgIGZ1bmN0aW9uIGNyZWF0ZUl0ZXJSZXN1bHQodmFsdWUsIGRvbmUpIHsKICAgICAgICByZXR1cm4gewogICAgICAgICAgdmFsdWUsCiAgICAgICAgICBkb25lCiAgICAgICAgfTsKICAgICAgfQogICAgICBmdW5jdGlvbiByZWFkQW5kUmVzb2x2ZShpdGVyKSB7CiAgICAgICAgdmFyIHJlc29sdmUgPSBpdGVyW2tMYXN0UmVzb2x2ZV07CiAgICAgICAgaWYgKHJlc29sdmUgIT09IG51bGwpIHsKICAgICAgICAgIHZhciBkYXRhID0gaXRlcltrU3RyZWFtXS5yZWFkKCk7CiAgICAgICAgICBpZiAoZGF0YSAhPT0gbnVsbCkgewogICAgICAgICAgICBpdGVyW2tMYXN0UHJvbWlzZV0gPSBudWxsOwogICAgICAgICAgICBpdGVyW2tMYXN0UmVzb2x2ZV0gPSBudWxsOwogICAgICAgICAgICBpdGVyW2tMYXN0UmVqZWN0XSA9IG51bGw7CiAgICAgICAgICAgIHJlc29sdmUoY3JlYXRlSXRlclJlc3VsdChkYXRhLCBmYWxzZSkpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBvblJlYWRhYmxlKGl0ZXIpIHsKICAgICAgICBwcm9jZXNzLm5leHRUaWNrKHJlYWRBbmRSZXNvbHZlLCBpdGVyKTsKICAgICAgfQogICAgICBmdW5jdGlvbiB3cmFwRm9yTmV4dChsYXN0UHJvbWlzZSwgaXRlcikgewogICAgICAgIHJldHVybiBmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgIGxhc3RQcm9taXNlLnRoZW4oZnVuY3Rpb24oKSB7CiAgICAgICAgICAgIGlmIChpdGVyW2tFbmRlZF0pIHsKICAgICAgICAgICAgICByZXNvbHZlKGNyZWF0ZUl0ZXJSZXN1bHQodm9pZCAwLCB0cnVlKSk7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGl0ZXJba0hhbmRsZVByb21pc2VdKHJlc29sdmUsIHJlamVjdCk7CiAgICAgICAgICB9LCByZWplY3QpOwogICAgICAgIH07CiAgICAgIH0KICAgICAgdmFyIEFzeW5jSXRlcmF0b3JQcm90b3R5cGUgPSBPYmplY3QuZ2V0UHJvdG90eXBlT2YoZnVuY3Rpb24oKSB7CiAgICAgIH0pOwogICAgICB2YXIgUmVhZGFibGVTdHJlYW1Bc3luY0l0ZXJhdG9yUHJvdG90eXBlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mKChfT2JqZWN0JHNldFByb3RvdHlwZU8gPSB7CiAgICAgICAgZ2V0IHN0cmVhbSgpIHsKICAgICAgICAgIHJldHVybiB0aGlzW2tTdHJlYW1dOwogICAgICAgIH0sCiAgICAgICAgbmV4dDogZnVuY3Rpb24gbmV4dCgpIHsKICAgICAgICAgIHZhciBfdGhpcyA9IHRoaXM7CiAgICAgICAgICB2YXIgZXJyb3IgPSB0aGlzW2tFcnJvcl07CiAgICAgICAgICBpZiAoZXJyb3IgIT09IG51bGwpIHsKICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KGVycm9yKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0aGlzW2tFbmRlZF0pIHsKICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShjcmVhdGVJdGVyUmVzdWx0KHZvaWQgMCwgdHJ1ZSkpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHRoaXNba1N0cmVhbV0uZGVzdHJveWVkKSB7CiAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgaWYgKF90aGlzW2tFcnJvcl0pIHsKICAgICAgICAgICAgICAgICAgcmVqZWN0KF90aGlzW2tFcnJvcl0pOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgcmVzb2x2ZShjcmVhdGVJdGVyUmVzdWx0KHZvaWQgMCwgdHJ1ZSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICAgIHZhciBsYXN0UHJvbWlzZSA9IHRoaXNba0xhc3RQcm9taXNlXTsKICAgICAgICAgIHZhciBwcm9taXNlOwogICAgICAgICAgaWYgKGxhc3RQcm9taXNlKSB7CiAgICAgICAgICAgIHByb21pc2UgPSBuZXcgUHJvbWlzZSh3cmFwRm9yTmV4dChsYXN0UHJvbWlzZSwgdGhpcykpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdmFyIGRhdGEgPSB0aGlzW2tTdHJlYW1dLnJlYWQoKTsKICAgICAgICAgICAgaWYgKGRhdGEgIT09IG51bGwpIHsKICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKGNyZWF0ZUl0ZXJSZXN1bHQoZGF0YSwgZmFsc2UpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBwcm9taXNlID0gbmV3IFByb21pc2UodGhpc1trSGFuZGxlUHJvbWlzZV0pOwogICAgICAgICAgfQogICAgICAgICAgdGhpc1trTGFzdFByb21pc2VdID0gcHJvbWlzZTsKICAgICAgICAgIHJldHVybiBwcm9taXNlOwogICAgICAgIH0KICAgICAgfSwgX2RlZmluZVByb3BlcnR5KF9PYmplY3Qkc2V0UHJvdG90eXBlTywgU3ltYm9sLmFzeW5jSXRlcmF0b3IsIGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9KSwgX2RlZmluZVByb3BlcnR5KF9PYmplY3Qkc2V0UHJvdG90eXBlTywgInJldHVybiIsIGZ1bmN0aW9uIF9yZXR1cm4oKSB7CiAgICAgICAgdmFyIF90aGlzMiA9IHRoaXM7CiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKGZ1bmN0aW9uKHJlc29sdmUsIHJlamVjdCkgewogICAgICAgICAgX3RoaXMyW2tTdHJlYW1dLmRlc3Ryb3kobnVsbCwgZnVuY3Rpb24oZXJyKSB7CiAgICAgICAgICAgIGlmIChlcnIpIHsKICAgICAgICAgICAgICByZWplY3QoZXJyKTsKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmVzb2x2ZShjcmVhdGVJdGVyUmVzdWx0KHZvaWQgMCwgdHJ1ZSkpOwogICAgICAgICAgfSk7CiAgICAgICAgfSk7CiAgICAgIH0pLCBfT2JqZWN0JHNldFByb3RvdHlwZU8pLCBBc3luY0l0ZXJhdG9yUHJvdG90eXBlKTsKICAgICAgdmFyIGNyZWF0ZVJlYWRhYmxlU3RyZWFtQXN5bmNJdGVyYXRvciA9IGZ1bmN0aW9uIGNyZWF0ZVJlYWRhYmxlU3RyZWFtQXN5bmNJdGVyYXRvcjIoc3RyZWFtKSB7CiAgICAgICAgdmFyIF9PYmplY3QkY3JlYXRlOwogICAgICAgIHZhciBpdGVyYXRvciA9IE9iamVjdC5jcmVhdGUoUmVhZGFibGVTdHJlYW1Bc3luY0l0ZXJhdG9yUHJvdG90eXBlLCAoX09iamVjdCRjcmVhdGUgPSB7fSwgX2RlZmluZVByb3BlcnR5KF9PYmplY3QkY3JlYXRlLCBrU3RyZWFtLCB7CiAgICAgICAgICB2YWx1ZTogc3RyZWFtLAogICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9KSwgX2RlZmluZVByb3BlcnR5KF9PYmplY3QkY3JlYXRlLCBrTGFzdFJlc29sdmUsIHsKICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9KSwgX2RlZmluZVByb3BlcnR5KF9PYmplY3QkY3JlYXRlLCBrTGFzdFJlamVjdCwgewogICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH0pLCBfZGVmaW5lUHJvcGVydHkoX09iamVjdCRjcmVhdGUsIGtFcnJvciwgewogICAgICAgICAgdmFsdWU6IG51bGwsCiAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgIH0pLCBfZGVmaW5lUHJvcGVydHkoX09iamVjdCRjcmVhdGUsIGtFbmRlZCwgewogICAgICAgICAgdmFsdWU6IHN0cmVhbS5fcmVhZGFibGVTdGF0ZS5lbmRFbWl0dGVkLAogICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9KSwgX2RlZmluZVByb3BlcnR5KF9PYmplY3QkY3JlYXRlLCBrSGFuZGxlUHJvbWlzZSwgewogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIHZhbHVlKHJlc29sdmUsIHJlamVjdCkgewogICAgICAgICAgICB2YXIgZGF0YSA9IGl0ZXJhdG9yW2tTdHJlYW1dLnJlYWQoKTsKICAgICAgICAgICAgaWYgKGRhdGEpIHsKICAgICAgICAgICAgICBpdGVyYXRvcltrTGFzdFByb21pc2VdID0gbnVsbDsKICAgICAgICAgICAgICBpdGVyYXRvcltrTGFzdFJlc29sdmVdID0gbnVsbDsKICAgICAgICAgICAgICBpdGVyYXRvcltrTGFzdFJlamVjdF0gPSBudWxsOwogICAgICAgICAgICAgIHJlc29sdmUoY3JlYXRlSXRlclJlc3VsdChkYXRhLCBmYWxzZSkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGl0ZXJhdG9yW2tMYXN0UmVzb2x2ZV0gPSByZXNvbHZlOwogICAgICAgICAgICAgIGl0ZXJhdG9yW2tMYXN0UmVqZWN0XSA9IHJlamVjdDsKICAgICAgICAgICAgfQogICAgICAgICAgfSwKICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfSksIF9PYmplY3QkY3JlYXRlKSk7CiAgICAgICAgaXRlcmF0b3Jba0xhc3RQcm9taXNlXSA9IG51bGw7CiAgICAgICAgZmluaXNoZWQoc3RyZWFtLCBmdW5jdGlvbihlcnIpIHsKICAgICAgICAgIGlmIChlcnIgJiYgZXJyLmNvZGUgIT09ICJFUlJfU1RSRUFNX1BSRU1BVFVSRV9DTE9TRSIpIHsKICAgICAgICAgICAgdmFyIHJlamVjdCA9IGl0ZXJhdG9yW2tMYXN0UmVqZWN0XTsKICAgICAgICAgICAgaWYgKHJlamVjdCAhPT0gbnVsbCkgewogICAgICAgICAgICAgIGl0ZXJhdG9yW2tMYXN0UHJvbWlzZV0gPSBudWxsOwogICAgICAgICAgICAgIGl0ZXJhdG9yW2tMYXN0UmVzb2x2ZV0gPSBudWxsOwogICAgICAgICAgICAgIGl0ZXJhdG9yW2tMYXN0UmVqZWN0XSA9IG51bGw7CiAgICAgICAgICAgICAgcmVqZWN0KGVycik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaXRlcmF0b3Jba0Vyc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gICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiB0aGlzLl9yZWFkYWJsZVN0YXRlLmRlc3Ryb3llZDsKICAgICAgICB9LAogICAgICAgIHNldDogZnVuY3Rpb24gc2V0KHZhbHVlKSB7CiAgICAgICAgICBpZiAoIXRoaXMuX3JlYWRhYmxlU3RhdGUpIHsKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5fcmVhZGFibGVTdGF0ZS5kZXN0cm95ZWQgPSB2YWx1ZTsKICAgICAgICB9CiAgICAgIH0pOwogICAgICBSZWFkYWJsZS5wcm90b3R5cGUuZGVzdHJveSA9IGRlc3Ryb3lJbXBsLmRlc3Ryb3k7CiAgICAgIFJlYWRhYmxlLnByb3RvdHlwZS5fdW5kZXN0cm95ID0gZGVzdHJveUltcGwudW5kZXN0cm95OwogICAgICBSZWFkYWJsZS5wcm90b3R5cGUuX2Rlc3Ryb3kgPSBmdW5jdGlvbihlcnIsIGNiKSB7CiAgICAgICAgY2IoZXJyKTsKICAgICAgfTsKICAgICAgUmVhZGFibGUucHJvdG90eXBlLnB1c2ggPSBmdW5jdGlvbihjaHVuaywgZW5jb2RpbmcpIHsKICAgICAgICB2YXIgc3RhdGUgPSB0aGlzLl9yZWFkYWJsZVN0YXRlOwogICAgICAgIHZhciBza2lwQ2h1bmtDaGVjazsKICAgICAgICBpZiAoIXN0YXRlLm9iamVjdE1vZGUpIHsKICAgICAgICAgIGlmICh0eXBlb2YgY2h1bmsgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIGVuY29kaW5nID0gZW5jb2RpbmcgfHwgc3RhdGUuZGVmYXVsdEVuY29kaW5nOwogICAgICAgICAgICBpZiAoZW5jb2RpbmcgIT09IHN0YXRlLmVuY29kaW5nKSB7CiAgICAgICAgICAgICAgY2h1bmsgPSBCdWZmZXIxMC5mcm9tKGNodW5rLCBlbmNvZGluZyk7CiAgICAgICAgICAgICAgZW5jb2RpbmcgPSAiIjsKICAgICAgICAgICAgfQogICAgICAgICAgICBza2lwQ2h1bmtDaGVjayA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHNraXBDaHVua0NoZWNrID0gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlYWRhYmxlQWRkQ2h1bmsodGhpcywgY2h1bmssIGVuY29kaW5nLCBmYWxzZSwgc2tpcENodW5rQ2hlY2spOwogICAgICB9OwogICAgICBSZWFkYWJsZS5wcm90b3R5cGUudW5zaGlmdCA9IGZ1bmN0aW9uKGNodW5rKSB7CiAgICAgICAgcmV0dXJuIHJlYWRhYmxlQWRkQ2h1bmsodGhpcywgY2h1bmssIG51bGwsIHRydWUsIGZhbHNlKTsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gcmVhZGFibGVBZGRDaHVuayhzdHJlYW0sIGNodW5rLCBlbmNvZGluZywgYWRkVG9Gcm9udCwgc2tpcENodW5rQ2hlY2spIHsKICAgICAgICBkZWJ1ZygicmVhZGFibGVBZGRDaHVuayIsIGNodW5rKTsKICAgICAgICB2YXIgc3RhdGUgPSBzdHJlYW0uX3JlYWRhYmxlU3RhdGU7CiAgICAgICAgaWYgKGNodW5rID09PSBudWxsKSB7CiAgICAgICAgICBzdGF0ZS5yZWFkaW5nID0gZmFsc2U7CiAgICAgICAgICBvbkVvZkNodW5rKHN0cmVhbSwgc3RhdGUpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB2YXIgZXI7CiAgICAgICAgICBpZiAoIXNraXBDaHVua0NoZWNrKQogICAgICAgICAgICBlciA9IGNodW5rSW52YWxpZChzdGF0ZSwgY2h1bmspOwogICAgICAgICAgaWYgKGVyKSB7CiAgICAgICAgICAgIGVycm9yT3JEZXN0cm95KHN0cmVhbSwgZXIpOwogICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5vYmplY3RNb2RlIHx8IGNodW5rICYmIGNodW5rLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgaWYgKHR5cGVvZiBjaHVuayAhPT0gInN0cmluZyIgJiYgIXN0YXRlLm9iamVjdE1vZGUgJiYgT2JqZWN0LmdldFByb3RvdHlwZU9mKGNodW5rKSAhPT0gQnVmZmVyMTAucHJvdG90eXBlKSB7CiAgICAgICAgICAgICAgY2h1bmsgPSBfdWludDhBcnJheVRvQnVmZmVyKGNodW5rKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoYWRkVG9Gcm9udCkgewogICAgICAgICAgICAgIGlmIChzdGF0ZS5lbmRFbWl0dGVkKQogICAgICAgICAgICAgICAgZXJyb3JPckRlc3Ryb3koc3RyZWFtLCBuZXcgRVJSX1NUUkVBTV9VTlNISUZUX0FGVEVSX0VORF9FVkVOVCgpKTsKICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICBhZGRDaHVuayhzdHJlYW0sIHN0YXRlLCBjaHVuaywgdHJ1ZSk7CiAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RhdGUuZW5kZWQpIHsKICAgICAgICAgICAgICBlcnJvck9yRGVzdHJveShzdHJlYW0sIG5ldyBFUlJfU1RSRUFNX1BVU0hfQUZURVJfRU9GKCkpOwogICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmRlc3Ryb3llZCkgewogICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBzdGF0ZS5yZWFkaW5nID0gZmFsc2U7CiAgICAgICAgICAgICAgaWYgKHN0YXRlLmRlY29kZXIgJiYgIWVuY29kaW5nKSB7CiAgICAgICAgICAgICAgICBjaHVuayA9IHN0YXRlLmRlY29kZXIud3JpdGUoY2h1bmspOwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLm9iamVjdE1vZGUgfHwgY2h1bmsubGVuZ3RoICE9PSAwKQogICAgICAgICAgICAgICAgICBhZGRDaHVuayhzdHJlYW0sIHN0YXRlLCBjaHVuaywgZmFsc2UpOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICBtYXliZVJlYWRNb3JlKHN0cmVhbSwgc3RhdGUpOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBhZGRDaHVuayhzdHJlYW0sIHN0YXRlLCBjaHVuaywgZmFsc2UpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIGlmICghYWRkVG9Gcm9udCkgewogICAgICAgICAgICBzdGF0ZS5yZWFkaW5nID0gZmFsc2U7CiAgICAgICAgICAgIG1heWJlUmVhZE1vcmUoc3RyZWFtLCBzdGF0ZSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiAhc3RhdGUuZW5kZWQgJiYgKHN0YXRlLmxlbmd0aCA8IHN0YXRlLmhpZ2hXYXRlck1hcmsgfHwgc3RhdGUubGVuZ3RoID09PSAwKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBhZGRDaHVuayhzdHJlYW0sIHN0YXRlLCBjaHVuaywgYWRkVG9Gcm9udCkgewogICAgICAgIGlmIChzdGF0ZS5mbG93aW5nICYmIHN0YXRlLmxlbmd0aCA9PT0gMCAmJiAhc3RhdGUuc3luYykgewogICAgICAgICAgc3RhdGUuYXdhaXREcmFpbiA9IDA7CiAgICAgICAgICBzdHJlYW0uZW1pdCgiZGF0YSIsIGNodW5rKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RhdGUubGVuZ3RoICs9IHN0YXRlLm9iamVjdE1vZGUgPyAxIDogY2h1bmsubGVuZ3RoOwogICAgICAgICAgaWYgKGFkZFRvRnJvbnQpCiAgICAgICAgICAgIHN0YXRlLmJ1ZmZlci51bnNoaWZ0KGNodW5rKTsKICAgICAgICAgIGVsc2UKICAgICAgICAgICAgc3RhdGUuYnVmZmVyLnB1c2goY2h1bmspOwogICAgICAgICAgaWYgKHN0YXRlLm5lZWRSZWFkYWJsZSkKICAgICAgICA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GlzLl9yZWFkYWJsZVN0YXRlLmJ1ZmZlci5oZWFkOwogICAgICAgIHZhciBjb250ZW50ID0gIiI7CiAgICAgICAgd2hpbGUgKHAgIT09IG51bGwpIHsKICAgICAgICAgIGNvbnRlbnQgKz0gZGVjb2RlcjIud3JpdGUocC5kYXRhKTsKICAgICAgICAgIHAgPSBwLm5leHQ7CiAgICAgICAgfQogICAgICAgIHRoaXMuX3JlYWRhYmxlU3RhdGUuYnVmZmVyLmNsZWFyKCk7CiAgICAgICAgaWYgKGNvbnRlbnQgIT09ICIiKQogICAgICAgICAgdGhpcy5fcmVhZGFibGVTdGF0ZS5idWZmZXIucHVzaChjb250ZW50KTsKICAgICAgICB0aGlzLl9yZWFkYWJsZVN0YXRlLmxlbmd0aCA9IGNvbnRlbnQubGVuZ3RoOwogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9OwogICAgICB2YXIgTUFYX0hXTSA9IDEwNzM3NDE4MjQ7CiAgICAgIGZ1bmN0aW9uIGNvbXB1dGVOZXdIaWdoV2F0ZXJNYXJrKG4pIHsKICAgICAgICBpZiAobiA+PSBNQVhfSFdNKSB7CiAgICAgICAgICBuID0gTUFYX0hXTTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgbi0tOwogICAgICAgICAgbiB8PSBuID4+PiAxOwogICAgICAgICAgbiB8PSBuID4+PiAyOwogICAgICAgICAgbiB8PSBuID4+PiA0OwogICAgICAgICAgbiB8PSBuID4+PiA4OwogICAgICAgICAgbiB8PSBuID4+PiAxNjsKICAgICAgICAgIG4rKzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG47CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaG93TXVjaFRvUmVhZChuLCBzdGF0ZSkgewogICAgICAgIGlmIChuIDw9IDAgfHwgc3RhdGUubGVuZ3RoID09PSAwICYmIHN0YXRlLmVuZGVkKQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgaWYgKHN0YXRlLm9iamVjdE1vZGUpCiAgICAgIC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kgewogICAgICAgICAgZGVidWcoInJlYWQ6IGVtaXRSZWFkYWJsZSIsIHN0YXRlLmxlbmd0aCwgc3RhdGUuZW5kZWQpOwogICAgICAgICAgaWYgKHN0YXRlLmxlbmd0aCA9PT0gMCAmJiBzdGF0ZS5lbmRlZCkKICAgICAgICAgICAgZW5kUmVhZGFibGUodGhpcyk7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIGVtaXRSZWFkYWJsZSh0aGlzKTsKICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgIH0KICAgICAgICBuID0gaG93TXVjaFRvUmVhZChuLCBzdGF0ZSk7CiAgICAgICAgaWYgKG4gPT09IDAgJiYgc3RhdGUuZW5kZWQpIHsKICAgICAgICAgIGlmIChzdGF0ZS5sZW5ndGggPT09IDApCiAgICAgICAgICAgIGVuZFJlYWRhYmxlKHRoaXMpOwogICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgfQogICAgICAgIHZhciBkb1JlYWQgPSBzdGF0ZS5uZWVkUmVhZGFibGU7CiAgICAgICAgZGVidWcoIm5lZWQgcmVhZGFibGUiLCBkb1JlYWQpOwogICAgICAgIGlmIChzdGF0ZS5sZW5ndGggPT09IDAgfHwgc3RhdGUubGVuZ3RoIC0gbiA8IHN0YXRlLmhpZ2hXYXRlck1hcmspIHsKICAgICAgICAgIGRvUmVhZCA9IHRydWU7CiAgICAgICAgICBkZWJ1ZygibGVuZ3RoIGxlc3MgdGhhbiB3YXRlcm1hcmsiLCBkb1JlYWQpOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhdGUuZW5kZWQgfHwgc3RhdGUucmVhZGluZykgewogICAgICAgICAgZG9SZWFkID0gZmFsc2U7CiAgICAgICAgICBkZWJ1ZygicmVhZGluZyBvciBlbmRlZCIsIGRvUmVhZCk7CiAgICAgICAgfSBlbHNlIGlmIChkb1JlYWQpIHsKICAgICAgICAgIGRlYnVnKCJkbyByZWFkIik7CiAgICAgICAgICBzdGF0ZS5yZWFkaW5nID0gdHJ1ZTsKICAgICAgICAgIHN0YXRlLnN5bmMgPSB0cnVlOwogICAgICAgICAgaWYgKHN0YXRlLmxlbmd0aCA9PT0gMCkKICAgICAgICAgICAgc3RhdGUubmVlZFJlYWRhYmxlID0gdHJ1ZTsKICAgICAgICAgIHRoaXMuX3JlYWQoc3RhdGUuaGlnaFdhdGVyTWFyayk7CiAgICAgICAgICBzdGF0ZS5zeW5jID0gZmFsc2U7CiAgICAgICAgICBpZiAoIXN0YXRlLnJlYWRpbmcpCiAgICAgICAgICAgIG4gPSBob3dNdWNoVG9SZWFkKG5PcmlnLCBzdGF0ZSk7CiAgICAgICAgfQogICAgICAgIHZhciByZXQ7CiAgICAgICAgaWYgKG4gPiAwKQogICAgICAgICAgcmV0ID0gZnJvbUxpc3Qobiwgc3RhdGUpOwogICAgICAgIGVsc2UKICAgICAgICAgIHJldCA9IG51bGw7CiAgICAgICAgaWYgKHJldCA9PT0gbnVsbCkgewogICAgICAgICAgc3RhdGUubmVlZFJlYWRhYmxlID0gc3RhdGUubGVuZ3RoIDw9IHN0YXRlLmhpZ2hXYXRlck1hcms7CiAgICAgICAgICBuID0gMDsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RhdGUubGVuZ3RoIC09IG47CiAgICAgICAgICBzdGF0ZS5hd2FpdERyYWluID0gMDsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXRlLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgaWYgKCFzdGF0ZS5lbmRlZCkKICAgICAgICAgICAgc3RhdGUubmVlZFJlYWRhYmxlID0gdHJ1ZTsKICAgICAgICAgIGlmIChuT3JpZyAhPT0gbiAmJiBzdGF0ZS5lbmRlZCkKICAgICAgICAgICAgZW5kUmVhZGFibGUodGhpcyk7CiAgICAgICAgfQogICAgICAgIGlmIChyZXQgIT09IG51bGwpCiAgICAgICAgICB0aGlzLmVtaXQoImRhdGEiLCByZXQpOwogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH07CiAgICAgIG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YXRlLnBpcGVzLnB1c2goZGVzdCk7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICBzdGF0ZS5waXBlc0NvdW50ICs9IDE7CiAgICAgICAgZGVidWcoInBpcGUgY291bnQ9JWQgb3B0cz0laiIsIHN0YXRlLnBpcGVzQ291bnQsIHBpcGVPcHRzKTsKICAgICAgICB2YXIgZG9FbmQgPSAoIXBpcGVPcHRzIHx8IHBpcGVPcHRzLmVuZCAhPT0gZmFsc2UpICYmIGRlc3QgIT09IHByb2Nlc3Muc3Rkb3V0ICYmIGRlc3QgIT09IHByb2Nlc3Muc3RkZXJyOwogICAgICAgIHZhciBlbmRGbiA9IGRvRW5kID8gb25lbmQgOiB1bnBpcGU7CiAgICAgICAgaWYgKHN0YXRlLmVuZEVtaXR0ZWQpCiAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVuZEZuKTsKICAgICAgICBlbHNlCiAgICAgICAgICBzcmMub25jZSgiZW5kIiwgZW5kRm4pOwogICAgICAgIGRlc3Qub24oInVucGlwZSIsIG9udW5waXBlKTsKICAgICAgICBmdW5jdGlvbiBvbnVucGlwZShyZWFkYWJsZSwgdW5waXBlSW5mbykgewogICAgICAgICAgZGVidWcoIm9udW5waXBlIik7CiAgICAgICAgICBpZiAocmVhZGFibGUgPT09IHNyYykgewogICAgICAgICAgICBpZiAodW5waXBlSW5mbyAmJiB1bnBpcGVJbmZvLmhhc1VucGlwZWQgPT09IGZhbHNlKSB7CiAgICAgICAgICAgICAgdW5waXBlSW5mby5oYXNVbnBpcGVkID0gdHJ1ZTsKICAgICAgICAgICAgICBjbGVhbnVwKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gb25lbmQoKSB7CiAgICAgICAgICBkZWJ1Zygib25lbmQiKTsKICAgICAgICAgIGRlc3QuZW5kKCk7CiAgICAgICAgfQogICAgICAgIHZhciBvbmRyYWluID0gcGlwZU9uRHJhaW4o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gICBpZiAocmV0ID09PSBmYWxzZSkgewogICAgICAgICAgICBpZiAoKHN0YXRlLnBpcGVzQ291bnQgPT09IDEgJiYgc3RhdGUucGlwZXMgPT09IGRlc3QgfHwgc3RhdGUucGlwZXNDb3VudCA+IDEgJiYgaW5kZXhPZihzdGF0ZS5waXBlcywgZGVzdCkgIT09IC0xKSAmJiAhY2xlYW5lZFVwKSB7CiAgICAgICAgICAgICAgZGVidWcoImZhbHNlIHdyaXRlIHJlc3BvbnNlLCBwYXVzZSIsIHN0YXRlLmF3YWl0RHJhaW4pOwogICAgICAgICAgICAgIHN0YXRlLmF3YWl0RHJhaW4rKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBzcmMucGF1c2UoKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gb25lcnJvcihlcikgewogICAgICAgICAgZGVidWcoIm9uZXJyb3IiLCBlcik7CiAgICAgICAgICB1bnBpcGUoKTsKICAgICAgICAgIGRlc3QucmVtb3ZlTGlzdGVuZXIoImVycm9yIiwgb25lcnJvcik7CiAgICAgICAgICBpZiAoRUVsaXN0ZW5lckNvdW50KGRlc3QsICJlcnJvciIpID09PSAwKQogICAgICAgICAgICBlcnJvck9yRGVzdHJveShkZXN0LCBlcik7CiAgICAgICAgfQogICAgICAgIHByZXBlbmRMaXN0ZW5lcihkZXN0LCAiZXJyb3IiLCBvbmVycm9yKTsKICAgICAgICBmdW5jdGlvbiBvbmNsb3NlKCkgewogICAgICAgICAgZGVzdC5yZW1vdmVMaXN0ZW5lcigiZmluaXNoIiwgb25maW5pc2gpOwogICAgICAgICAgdW5waXBlKCk7CiAgICAgICAgfQogICAgICAgIGRlc3Qub25jZSgiY2xvc2UiLCBvbmNsb3NlKTsKICAgICAgICBmdW5jdGlvbiBvbmZpbmlzaCgpIHsKICAgICAgICAgIGRlYnVnKCJvbmZpbmlzaCIpOwogICAgICAgICAgZGVzdC5yZW1vdmVMaXN0ZW5lcigiY2xvc2UiLCBvbmNsb3NlKTsKICAgICAgICAgIHVucGlwZSgpOwogICAgICAgIH0KICAgICAgICBkZXN0Lm9uY2UoImZpbmlzaCIsIG9uZmluaXNoKTsKICAgICAgICBmdW5jdGlvbiB1bnBpcGUoKSB7CiAgICAgICAgICBkZWJ1ZygidW5waXBlIik7CiAgICAgICAgICBzcmMudW5waXBlKGRlc3QpOwogICAgICAgIH0KICAgICAgICBkZXN0LmVtaXQoInBpcGUiLCBzcmMpOwogICAgICAgIGlmICghc3RhdGUuZmxvd2luZykgewogICAgICAgICAgZGVidWcoInBpcGUgcmVzdW1lIik7CiAgICAgICAgICBzcmMucmVzdW1lKCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBkZXN0OwogICAgICB9OwogICAgICBmdW5jdGlvbiBwaXBlT25EcmFpbihzcmMpIHsKICAgICAgICByZXR1cm4gZnVuY3Rpb24gcGlwZU9uRHJhaW5GdW5jdGlvblJlc3VsdCgpIHsKICAgICAgICAgIHZhciBzdGF0ZSA9IHNyYy5fcmVhZGFibGVTdGF0ZTsKICAgICAgICAgIGRlYnVnKCJwaXBlT25EcmFpbiIsIHN0YXRlLmF3YWl0RHJhaW4pOwogICAgICAgICAgaWYgKHN0YXRlLmF3YWl0RHJhaW4pCiAgICAgICAgICAgIHN0YXRlLmF3YWl0RHJhaW4tLTsKICAgICAgICAgIGlmIChzdGF0ZS5hd2FpdERyYWluID09PSAwICYmIEVFbGlzdGVuZXJDb3VudChzcmMsICJkYXRhIikpIHsKICAgICAgICAgICAgc3RhdGUuZmxvd2luZyA9IHRydWU7CiAgICAgICAgICAgIGZsb3coc3JjKTsKICAgICAgICAgIH0KICAgICAgICB9OwogICAgICB9CiAgICAgIFJlYWRhYmxlLnByb3RvdHlwZS51bnBpcGUgPSBmdW5jdGlvbihkZXN0KSB7CiAgICAgICAgdmFyIHN0YXRlID0gdGhpcy5fcmVhZGFibGVTdGF0ZTsKICAgICAgICB2YXIgdW5waXBlSW5mbyA9IHsKICAgICAgICAgIGhhc1VucGlwZWQ6IGZhbHNlCiAgICAgICAgfTsKICAgICAgICBpZiAoc3RhdGUucGlwZXNDb3VudCA9PT0gMCkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGlmIChzdGF0ZS5waXBlc0NvdW50ID09PSAxKSB7CiAgICAgICAgICBpZiAoZGVzdCAmJiBkZXN0ICE9PSBzdGF0ZS5waXBlcykKICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICBpZiAoIWRlc3QpCiAgICAgICAgICAgIGRlc3QgPSBzdGF0ZS5waXBlczsKICAgICAgICAgIHN0YXRlLnBpcGVzID0gbnVsbDsKICAgICAgICAgIHN0YXRlLnBpcGVzQ291bnQgPSAwOwogICAgICAgICAgc3RhdGUuZmxvd2luZyA9IGZhbHNlOwogICAgICAgICAgaWYgKGRlc3QpCiAgICAgICAgICAgIGRlc3QuZW1pdCgidW5waXBlIiwgdGhpcywgdW5waXBlSW5mbyk7CiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICB9CiAgICAgICAgaWYgKCFkZXN0KSB7CiAgICAgICAgICB2YXIgZGVzdHMgPSBzdGF0ZS5waXBlczsKICAgICAgICAgIHZhciBsZW4gPSBzdGF0ZS5waXBlc0NvdW50OwogICAgICAgICAgc3RhdGUucGlwZXMgPSBudWxsOwogICAgICAgICAgc3RhdGUucGlwZXNDb3VudCA9IDA7CiAgICAgICAgICBzdGF0ZS5mbG93aW5nID0gZmFsc2U7CiAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbjsgaSsrKQogICAgICAgICAgICBkZXN0c1tpXS5lbWl0KCJ1bnBpcGUiLCB0aGlzLCB7CiAgICAgICAgICAgICAgaGFzVW5waXBlZDogZmFsc2UKICAgICAgICAgICAgfSk7CiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICB9CiAgICAgICAgdmFyIGluZGV4ID0gaW5kZXhPZihzdGF0ZS5waXBlcywgZGVzdCk7CiAgICAgICAgaWYgKGluZGV4ID09PSAtMSkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIHN0YXRlLnBpcGVzLnNwbGljZShpbmRleCwgMSk7CiAgICAgICAgc3RhdGUucGlwZXNDb3VudCAtPSAxOwogICAgICAgIGlmIChzdGF0ZS5waXBlc0NvdW50ID09PSAxKQogICAgICAgICAgc3RhdGUucGlwZXMgPSBzdGF0ZS5waXBlc1swXTsKICAgICAgICBkZXN0LmVtaXQoInVucGlwZSIsIHRoaXMsIHVucGlwZUluZm8pOwogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9OwogICAgICBSZWFkYWJsZS5wcm90b3R5cGUub24gPSBmdW5jdGlvbihldiwgZm4pIHsKICAgICAgICB2YXIgcmVzID0gU3RyZWFtLnByb3RvdHlwZS5vbi5jYWxsKHRoaXMsIGV2LCBmbik7CiAgICAgICAgdmFyIHN0YXRlID0gdGhpcy5fcmVhZGFibGVTdGF0ZTsKICAgICAgICBpZiAoZXYgPT09ICJkYXRhIikgewogICAgICAgICAgc3RhdGUucmVhZGFibGVMaXN0ZW5pbmcgPSB0aGlzLmxpc3RlbmVyQ291bnQoInJlYWRhYmxlIikgPiAwOwogICAgICAgICAgaWYgKHN0YXRlLmZsb3dpbmcgIT09IGZhbHNlKQogICAgICAgICAgICB0aGlzLnJlc3VtZSgpOwogICAgICAgIH0gZWxzZSBpZiAoZXYgPT09ICJyZWFkYWJsZSIpIHsKICAgICAgICAgIGlmICghc3RhdGUuZW5kRW1pdHRlZCAmJiAhc3RhdGUucmVhZGFibGVMaXN0ZW5pbmcpIHsKICAgICAgICAgICAgc3RhdGUucmVhZGFibGVMaXN0ZW5pbmcgPSBzdGF0ZS5uZWVkUmVhZGFibGUgPSB0cnVlOwogICAgICAgICAgICBzdGF0ZS5mbG93aW5nID0gZmFsc2U7CiAgICAgICAgICAgIHN0YXRlLmVtaXR0ZWRSZWFkYWJsZSA9IGZhbHNlOwogICAgICAgICAgICBkZWJ1Zygib24gcmVhZGFibGUiLCBzdGF0ZS5sZW5ndGgsIHN0YXRlLnJlYWRpbmcpOwogICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoKSB7CiAgICAgICAgICAgICAgZW1pdFJlYWRhYmxlKHRoaXMpOwogICAgICAgICAgICB9IGVsc2UgaWYgKCFzdGF0ZS5yZWFkaW5nKSB7CiAgICAgICAgICAgICAgcHJvY2Vzcy5uZXh0VGljayhuUmVhZGluZ05leHRUaWNrLCB0aGlzKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gcmVzOwogICAgICB9OwogICAgICBSZWFkYWJsZS5wcm90b3R5cGUuYWRkTGlzdGVuZXIgPSBSZWFkYWJsZS5wcm90b3R5cGUub247CiAgICAgIFJlYWRhYmxlLnByb3RvdHlwZS5yZW1vdmVMaXN0ZW5lciA9IGZ1bmN0aW9uKGV2LCBmbikgewogICAgICAgIHZhciByZXMgPSBTdHJlYW0ucHJvdG90eXBlLnJlbW92ZUxpc3RlbmVyLmNhbGwodGhpcywgZXYsIGZuKTsKICAgICAgICBpZiAoZXYgPT09ICJyZWFkYWJsZSIpIHsKICAgICAgICAgIHByb2Nlc3MubmV4dFRpY2sodXBkYXRlUmVhZGFibGVMaXN0ZW5pbmcsIHRoaXMpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmVzOwogICAgICB9OwogICAgICBSZWFkYWJsZS5wcm90b3R5cGUucmVtb3ZlQWxsTGlzdGVuZXJzID0gZnVuY3Rpb24oZXYpIHsKICAgICAgICB2YXIgcmVzID0gU3RyZWFtLnByb3RvdHlwZS5yZW1vdmVBbGxMaXN0ZW5lcnMuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICBpZiAoZXYgPT09ICJyZWFkYWJsZSIgfHwgZXYgPT09IHZvaWQgMCkgewogICAgICAgICAgcHJvY2Vzcy5uZXh0VGljayh1cGRhdGVSZWFkYWJsZUxpc3RlbmluZywgdGhpcyk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBy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RhdGUgPSBzdHJlYW0uX3JlYWRhYmxlU3RhdGU7CiAgICAgICAgZGVidWcoImZsb3ciLCBzdGF0ZS5mbG93aW5nKTsKICAgICAgICB3aGlsZSAoc3RhdGUuZmxvd2luZyAmJiBzdHJlYW0ucmVhZCgpICE9PSBudWxsKQogICAgICAgICAgOwogICAgICB9CiAgICAgIFJlYWRhYmxlLnByb3RvdHlwZS53cmFwID0gZnVuY3Rpb24oc3RyZWFtKSB7CiAgICAgICAgdmFyIF90aGlzID0gdGhpczsKICAgICAgICB2YXIgc3RhdGUgPSB0aGlzLl9yZWFkYWJsZVN0YXRlOwogICAgICAgIHZhciBwYXVzZWQgPSBmYWxzZTsKICAgICAgICBzdHJlYW0ub24oImVuZCIsIGZ1bmN0aW9uKCkgewogICAgICAgICAgZGVidWcoIndyYXBwZWQgZW5kIik7CiAgICAgICAgICBpZiAoc3RhdGUuZGVjb2RlciAmJiAhc3RhdGUuZW5kZWQpIHsKICAgICAgICAgICAgdmFyIGNodW5rID0gc3RhdGUuZGVjb2Rlci5lbmQoKTsKICAgICAgICAgICAgaWYgKGNodW5rICYmIGNodW5rLmxlbmd0aCkKICAgICAgICAgICAgICBfdGhpcy5wdXNoKGNodW5rKTsKICAgICAgICAgIH0KICAgICAgICAgIF90aGlzLnB1c2gobnVsbCk7CiAgICAgICAgfSk7CiAgICAgICAgc3RyZWFtLm9uKCJkYXRhIiwgZnVuY3Rpb24oY2h1bmspIHsKICAgICAgICAgIGRlYnVnKCJ3cmFwcGVkIGRhdGEiKTsKICAgICAgICAgIGlmIChzdGF0ZS5kZWNvZGVyKQogICAgICAgICAgICBjaHVuayA9IHN0YXRlLmRlY29kZXIud3JpdGUoY2h1bmspOwogICAgICAgICAgaWYgKHN0YXRlLm9iamVjdE1vZGUgJiYgKGNodW5rID09PSBudWxsIHx8IGNodW5rID09PSB2b2lkIDApKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICBlbHNlIGlmICghc3RhdGUub2JqZWN0TW9kZSAmJiAoIWNodW5rIHx8ICFjaHVuay5sZW5ndGgpKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICB2YXIgcmV0ID0gX3RoaXMucHVzaChjaHVuayk7CiAgICAgICAgICBpZiAoIXJldCkgewogICAgICAgICAgICBwYXVzZWQgPSB0cnVlOwogICAgICAgICAgICBzdHJlYW0ucGF1c2UoKTsKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICBmb3IgKHZhciBpIGluIHN0cmVhbSkgewogICAgICAgICAgaWYgKHRoaXNbaV0gPT09IHZvaWQgMCAmJiB0eXBlb2Ygc3RyZWFtW2ldID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIHRoaXNbaV0gPSBmdW5jdGlvbiBtZXRob2RXcmFwKG1ldGhvZCkgewogICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiBtZXRob2RXcmFwUmV0dXJuRnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gc3RyZWFtW21ldGhvZF0uYXBwbHkoc3RyZWFtLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0oaSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwga1Byb3h5RXZlbnRzLmxlbmd0aDsgbisrKSB7CiAgICAgICAgICBzdHJlYW0ub24oa1Byb3h5RXZlbnRzW25dLCB0aGlzLmVtaXQuYmluZCh0aGlzLCBrUHJveHlFdmVudHNbbl0pKTsKICAgICAgICB9CiAgICAgICAgdGhpcy5fcmVhZCA9IGZ1bmN0aW9uKG4yKSB7CiAgICAgICAgICBkZWJ1Zygid3JhcHBlZCBfcmVhZCIsIG4yKTsKICAgICAgICAgIGlmIChwYXVzZWQpIHsKICAgICAgICAgICAgcGF1c2VkID0gZmFsc2U7CiAgICAgICAgICAgIHN0cmVhbS5yZXN1bWUoKTsKICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIHJldHVybiB0aGl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QTEVfQ0FMTEJBQ0soKSk7CiAgICAgICAgfQogICAgICAgIHRzLndyaXRlY2h1bmsgPSBudWxsOwogICAgICAgIHRzLndyaXRlY2IgPSBudWxsOwogICAgICAgIGlmIChkYXRhICE9IG51bGwpCiAgICAgICAgICB0aGlzLnB1c2goZGF0YSk7CiAgICAgICAgY2IoZXIpOwogICAgICAgIHZhciBycyA9IHRoaXMuX3JlYWRhYmxlU3RhdGU7CiAgICAgICAgcnMucmVhZGluZyA9IGZhbHNlOwogICAgICAgIGlmIChycy5uZWVkUmVhZGFibGUgfHwgcnMubGVuZ3RoIDwgcnMuaGlnaFdhdGVyTWFyaykgewogICAgICAgICAgdGhpcy5fcmVhZChycy5oaWdoV2F0ZXJNYXJrKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gVHJhbnNmb3JtMihvcHRpb25zKSB7CiAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFRyYW5zZm9ybTIpKQogICAgICAgICAgcmV0dXJuIG5ldyBUcmFuc2Zvcm0yKG9wdGlvbnMpOwogICAgICAgIER1cGxleC5jYWxsKHRoaXMsIG9wdGlvbnMpOwogICAgICAgIHRoaXMuX3RyYW5zZm9ybVN0YXRlID0gewogICAgICAgICAgYWZ0ZXJUcmFuc2Zvcm06IGFmdGVyVHJhbnNmb3JtLmJpbmQodGhpcyksCiAgICAgICAgICBuZWVkVHJhbnNmb3JtOiBmYWxzZSwKICAgICAgICAgIHRyYW5zZm9ybWluZzogZmFsc2UsCiAgICAgICAgICB3cml0ZWNiOiBudWxsLAogICAgICAgICAgd3JpdGVjaHVuazogbnVsbCwKICAgICAgICAgIHdyaXRlZW5jb2Rpbmc6IG51bGwKICAgICAgICB9OwogICAgICAgIHRoaXMuX3JlYWRhYmxlU3RhdGUubmVlZFJlYWRhYmxlID0gdHJ1ZTsKICAgICAgICB0aGlzLl9yZWFkYWJsZVN0YXRlLnN5bmMgPSBmYWxzZTsKICAgICAgICBpZiAob3B0aW9ucykgewogICAgICAgICAgaWYgKHR5cGVvZiBvcHRpb25zLnRyYW5zZm9ybSA9PT0gImZ1bmN0aW9uIikKICAgICAgICAgICAgdGhpcy5fdHJhbnNmb3JtID0gb3B0aW9ucy50cmFuc2Zvcm07CiAgICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMuZmx1c2ggPT09ICJmdW5jdGlvbiIpCiAgICAgICAgICAgIHRoaXMuX2ZsdXNoID0gb3B0aW9ucy5mbHVzaDsKICAgICAgICB9CiAgICAgICAgdGhpcy5vbigicHJlZmluaXNoIiwgcHJlZmluaXNoKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBwcmVmaW5pc2goKSB7CiAgICAgICAgdmFyIF90aGlzID0gdGhpczsKICAgICAgICBpZiAodHlwZW9mIHRoaXMuX2ZsdXNoID09PSAiZnVuY3Rpb24iICYmICF0aGlzLl9yZWFkYWJsZVN0YXRlLmRlc3Ryb3llZCkgewogICAgICAgICAgdGhpcy5fZmx1c2goZnVuY3Rpb24oZXIsIGRhdGEpIHsKICAgICAgICAgICAgZG9uZShfdGhpcywgZXIsIGRhdGEpOwogICAgICAgICAgfSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGRvbmUodGhpcywgbnVsbCwgbnVsbCk7CiAgICAgICAgfQogICAgICB9CiAgICAgIFRyYW5zZm9ybTIucHJvdG90eXBlLnB1c2ggPSBmdW5jdGlvbihjaHVuaywgZW5jb2RpbmcpIHsKICAgICAgICB0aGlzLl90cmFuc2Zvcm1TdGF0ZS5uZWVkVHJhbnNmb3JtID0gZmFsc2U7CiAgICAgICAgcmV0dXJuIER1cGxleC5wcm90b3R5cGUucHVzaC5jYWxsKHRoaXMsIGNodW5rLCBlbmNvZGluZyk7CiAgICAgIH07CiAgICAgIFRyYW5zZm9ybTIucHJvdG90eXBlLl90cmFuc2Zvcm0gPSBmdW5jdGlvbihjaHVuaywgZW5jb2RpbmcsIGNiKSB7CiAgICAgICAgY2IobmV3IEVSUl9NRVRIT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9vZl9zdHJlYW0oKTsKICAgICAgICBlb3Moc3RyZWFtLCB7CiAgICAgICAgICByZWFkYWJsZTogcmVhZGluZywKICAgICAgICAgIHdyaXRhYmxlOiB3cml0aW5nCiAgICAgICAgfSwgZnVuY3Rpb24oZXJyKSB7CiAgICAgICAgICBpZiAoZXJyKQogICAgICAgICAgICByZXR1cm4gY2FsbGJhY2soZXJyKTsKICAgICAgICAgIGNsb3NlZCA9IHRydWU7CiAgICAgICAgICBjYWxsYmFjaygpOwogICAgICAgIH0pOwogICAgICAgIHZhciBkZXN0cm95ZWQgPSBmYWxzZTsKICAgICAgICByZXR1cm4gZnVuY3Rpb24oZXJyKSB7CiAgICAgICAgICBpZiAoY2xvc2VkKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICBpZiAoZGVzdHJveWVkKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICBkZXN0cm95ZWQgPSB0cnVlOwogICAgICAgICAgaWYgKGlzUmVxdWVzdChzdHJlYW0pKQogICAgICAgICAgICByZXR1cm4gc3RyZWFtLmFib3J0KCk7CiAgICAgICAgICBpZiAodHlwZW9mIHN0cmVhbS5kZXN0cm95ID09PSAiZnVuY3Rpb24iKQogICAgICAgICAgICByZXR1cm4gc3RyZWFtLmRlc3Ryb3koKTsKICAgICAgICAgIGNhbGxiYWNrKGVyciB8fCBuZXcgRVJSX1NUUkVBTV9ERVNUUk9ZRUQoInBpcGUiKSk7CiAgICAgICAgfTsKICAgICAgfQogICAgICBmdW5jdGlvbiBjYWxsKGZuKSB7CiAgICAgICAgZm4oKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBwaXBlKGZyb20sIHRvKSB7CiAgICAgICAgcmV0dXJuIGZyb20ucGlwZSh0byk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcG9wQ2FsbGJhY2soc3RyZWFtcykgewogICAgICAgIGlmICghc3RyZWFtcy5sZW5ndGgpCiAgICAgICAgICByZXR1cm4gbm9vcDsKICAgICAgICBpZiAodHlwZW9mIHN0cmVhbXNbc3RyZWFtcy5sZW5ndGggLSAxXSAhPT0gImZ1bmN0aW9uIikKICAgICAgICAgIHJldHVybiBub29wOwogICAgICAgIHJldHVybiBzdHJlYW1zLnBvcCgpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHBpcGVsaW5lKCkgewogICAgICAgIGZvciAodmFyIF9sZW4gPSBhcmd1bWVudHMubGVuZ3RoLCBzdHJlYW1zID0gbmV3IEFycmF5KF9sZW4pLCBfa2V5ID0gMDsgX2tleSA8IF9sZW47IF9rZXkrKykgewogICAgICAgICAgc3RyZWFtc1tfa2V5XSA9IGFyZ3VtZW50c1tfa2V5XTsKICAgICAgICB9CiAgICAgICAgdmFyIGNhbGxiYWNrID0gcG9wQ2FsbGJhY2soc3RyZWFtcyk7CiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoc3RyZWFtc1swXSkpCiAgICAgICAgICBzdHJlYW1zID0gc3RyZWFtc1swXTsKICAgICAgICBpZiAoc3RyZWFtcy5sZW5ndGggPCAyKSB7CiAgICAgICAgICB0aHJvdyBuZXcgRVJSX01JU1NJTkdfQVJHUygic3RyZWFtcyIpOwogICAgICAgIH0KICAgICAgICB2YXIgZXJyb3I7CiAgICAgICAgdmFyIGRlc3Ryb3lzID0gc3RyZWFtcy5tYXAoZnVuY3Rpb24oc3RyZWFtLCBpKSB7CiAgICAgICAgICB2YXIgcmVhZGluZyA9IGkgPCBzdHJlYW1zLmxlbmd0aCAtIDE7CiAgICAgICAgICB2YXIgd3JpdGluZyA9IGkgPiAwOwogICAgICAgICAgcmV0dXJuIGRlc3Ryb3llcihzdHJlYW0sIHJlYWRpbmcsIHdyaXRpbmcsIGZ1bmN0aW9uKGVycikgewogICAgICAgICAgICBpZiAoIWVycm9yKQogICAgICAgICAgICAgIGVycm9yID0gZXJyOwogICAgICAgICAgICBpZiAoZXJyKQogICAgICAgICAgICAgIGRlc3Ryb3lzLmZvckVhY2goY2FsbCk7CiAgICAgICAgICAgIGlmI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NlLm9uKCJjbG9zZSIsIG9uY2xvc2UpOwogICAgICAgIH0KICAgICAgICB2YXIgZGlkT25FbmQgPSBmYWxzZTsKICAgICAgICBmdW5jdGlvbiBvbmVuZCgpIHsKICAgICAgICAgIGlmIChkaWRPbkVuZCkKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgZGlkT25FbmQgPSB0cnVlOwogICAgICAgICAgZGVzdC5lbmQoKTsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gb25jbG9zZSgpIHsKICAgICAgICAgIGlmIChkaWRPbkVuZCkKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgZGlkT25FbmQgPSB0cnVlOwogICAgICAgICAgaWYgKHR5cGVvZiBkZXN0LmRlc3Ryb3kgPT09ICJmdW5jdGlvbiIpCiAgICAgICAgICAgIGRlc3QuZGVzdHJveSgpOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBvbmVycm9yKGVyKSB7CiAgICAgICAgICBjbGVhbnVwKCk7CiAgICAgICAgICBpZiAoRUUubGlzdGVuZXJDb3VudCh0aGlzLCAiZXJyb3IiKSA9PT0gMCkgewogICAgICAgICAgICB0aHJvdyBlcjsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgc291cmNlLm9uKCJlcnJvciIsIG9uZXJyb3IpOwogICAgICAgIGRlc3Qub24oImVycm9yIiwgb25lcnJvcik7CiAgICAgICAgZnVuY3Rpb24gY2xlYW51cCgpIHsKICAgICAgICAgIHNvdXJjZS5yZW1vdmVMaXN0ZW5lcigiZGF0YSIsIG9uZGF0YSk7CiAgICAgICAgICBkZXN0LnJlbW92ZUxpc3RlbmVyKCJkcmFpbiIsIG9uZHJhaW4pOwogICAgICAgICAgc291cmNlLnJlbW92ZUxpc3RlbmVyKCJlbmQiLCBvbmVuZCk7CiAgICAgICAgICBzb3VyY2UucmVtb3ZlTGlzdGVuZXIoImNsb3NlIiwgb25jbG9zZSk7CiAgICAgICAgICBzb3VyY2UucmVtb3ZlTGl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JpYWxpemVyID0gZXh0ZW5kLnNlcmlhbGl6ZS5iaW5kKGV4dGVuZCk7CiAgICAgICAgcmV0dXJuIHsKICAgICAgICAgIGRlc2VyaWFsaXplKG1lc3NhZ2UpIHsKICAgICAgICAgICAgcmV0dXJuIGltcGxlbWVudGF0aW9uLmRlc2VyaWFsaXplKG1lc3NhZ2UsIGZhbGxiYWNrRGVzZXJpYWxpemVyKTsKICAgICAgICAgIH0sCiAgICAgICAgICBzZXJpYWxpemUoaW5wdXQpIHsKICAgICAgICAgICAgcmV0dXJuIGltcGxlbWVudGF0aW9uLnNlcmlhbGl6ZShpbnB1dCwgZmFsbGJhY2tTZXJpYWxpemVyKTsKICAgICAgICAgIH0KICAgICAgICB9OwogICAgICB9CiAgICAgIGV4cG9ydHMyLmV4dGVuZFNlcmlhbGl6ZXIgPSBleHRlbmRTZXJpYWxpemVyOwogICAgICB2YXIgRGVmYXVsdEVycm9yU2VyaWFsaXplciA9IHsKICAgICAgICBkZXNlcmlhbGl6ZShtZXNzYWdlKSB7CiAgICAgICAgICByZXR1cm4gT2JqZWN0LmFzc2lnbihFcnJvcihtZXNzYWdlLm1lc3NhZ2UpLCB7CiAgICAgICAgICAgIG5hbWU6IG1lc3NhZ2UubmFtZSwKICAgICAgICAgICAgc3RhY2s6IG1lc3NhZ2Uuc3RhY2sKICAgICAgICAgIH0pOwogICAgICAgIH0sCiAgICAgICAgc2VyaWFsaXplKGVycm9yKSB7CiAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICBfX2Vycm9yX21hcmtlcjogIiQkZXJyb3IiLAogICAgICAgICAgICBtZXNzYWdlOiBlcnJvci5tZXNzYWdlLAogICAgICAgICAgICBuYW1lOiBlcnJvci5uYW1lLAogICAgICAgICAgICBzdGFjazogZXJyb3Iuc3RhY2sKICAgICAgICAgIH07CiAgICAgICAgfQogICAgICB9OwogICAgICB2YXIgaXNTZXJpYWxpemVkRXJyb3IgPSAodGhpbmcpID0+IHRoaW5nICYmIHR5cGVvZiB0aGluZyA9PT0gIm9iamVjdCIgJiYgIl9fZXJyb3JfbWFya2VyIiBpbiB0aGluZyAmJiB0aGluZy5fX2Vycm9yX21hcmtlciA9PT0gIiQkZXJyb3IiOwogICAgICBleHBvcnRzMi5EZWZhdWx0U2VyaWFsaXplciA9IHsKICAgICAgICBkZXNlcmlhbGl6ZShtZXNzYWdlKSB7CiAgICAgICAgICBpZiAoaXNTZXJpYWxpemVkRXJyb3IobWVzc2FnZSkpIHsKICAgICAgICAgICAgcmV0dXJuIERlZmF1bHRFcnJvclNlcmlhbGl6ZXIuZGVzZXJpYWxpemUobWVzc2FnZSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gbWVzc2FnZTsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIHNlcmlhbGl6ZShpbnB1dCkgewogICAgICAgICAgaWYgKGlucHV0IGluc3RhbmNlb2YgRXJyb3IpIHsKICAgICAgICAgICAgcmV0dXJuIERlZmF1bHRFcnJvclNlcmlhbGl6ZXIuc2VyaWFsaXplKGlucHV0KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiBpbnB1dDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS90aHJlYWRzQDEuNy4wL25vZGVfbW9kdWxlcy90aHJlYWRzL2Rpc3QvY29tbW9uLmpzCiAgdmFyIHJlcXVpcmVfY29tbW9uMiA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS90aHJlYWRzQDEuNy4wL25vZGVfbW9kdWxlcy90aHJlYWRzL2Rpc3QvY29tbW9uLmpzIihleHBvcnRzMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGV4cG9ydHMyLCAiX19lc01vZHVsZSIsIH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tbW9uXzEuc2VyaWFsaXplKHZhbHVlKSksIChlcnJvcikgPT4gewogICAgICAgICAgICAgIHBvc3RKb2JFcnJvck1lc3NhZ2Uoam9iVUlELCBjb21tb25fMS5zZXJpYWxpemUoZXJyb3IpKTsKICAgICAgICAgICAgICBhY3RpdmVTdWJzY3JpcHRpb25zLmRlbGV0ZShqb2JVSUQpOwogICAgICAgICAgICB9LCAoKSA9PiB7CiAgICAgICAgICAgICAgcG9zdEpvYlJlc3VsdE1lc3NhZ2Uoam9iVUlELCB0cnVlKTsKICAgICAgICAgICAgICBhY3RpdmVTdWJzY3JpcHRpb25zLmRlbGV0ZShqb2JVSUQpOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgYWN0aXZlU3Vic2NyaXB0aW9ucy5zZXQoam9iVUlELCBzdWJzY3JpcHRpb24pOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBjb25zdCByZXN1bHQgPSB5aWVsZCBzeW5jUmVzdWx0OwogICAgICAgICAgICAgIHBvc3RKb2JSZXN1bHRNZXNzYWdlKGpvYlVJRCwgdHJ1ZSwgY29tbW9uXzEuc2VyaWFsaXplKHJlc3VsdCkpOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgIHBvc3RKb2JFcnJvck1lc3NhZ2Uoam9iVUlELCBjb21tb25fMS5zZXJpYWxpemUoZXJyb3IpKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGV4cG9zZTIoZXhwb3NlZCkgewogICAgICAgIGlmICghaW1wbGVtZW50YXRpb25fMS5kZWZhdWx0LmlzV29ya2VyUnVudGltZSgpKSB7CiAgICAgICAgICB0aHJvdyBFcnJvcigiZXhwb3NlKCkgY2FsbGVkIGluIHRoZSBtYXN0ZXIgdGhyZWFkLiIpOwogICAgICAgIH0KICAgICAgICBpZiAoZXhwb3NlQ2FsbGVk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b3NlZFttZXNzYWdlRGF0YS5tZXRob2RdLCBtZXNzYWdlRGF0YS5hcmdzLm1hcChjb21tb25fMS5kZXNlcmlhbGl6ZSkpOwogICAgICAgICAgICB9CiAgICAgICAgICB9KTsKICAgICAgICAgIGNvbnN0IG1ldGhvZE5hbWVzID0gT2JqZWN0LmtleXMoZXhwb3NlZCkuZmlsdGVyKChrZXkpID0+IHR5cGVvZiBleHBvc2VkW2tleV0gPT09ICJmdW5jdGlvbiIpOwogICAgICAgICAgcG9zdE1vZHVsZUluaXRNZXNzYWdlKG1ldGhvZE5hbWVzKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdGhyb3cgRXJyb3IoYEludmFsaWQgYXJndW1lbnQgcGFzc2VkIHRvIGV4cG9zZSgpLiBFeHBlY3RlZCBhIGZ1bmN0aW9uIG9yIGFuIG9iamVjdCwgZ290OiAke2V4cG9zZWR9YCk7CiAgICAgICAgfQogICAgICAgIGltcGxlbWVudGF0aW9uXzEuZGVmYXVsdC5zdWJzY3JpYmVUb01hc3Rlck1lc3NhZ2VzKChtZXNzYWdlRGF0YSkgPT4gewogICAgICAgICAgaWYgKGlzTWFzdGVySm9iQ2FuY2VsTWVzc2FnZShtZXNzYWdlRGF0YSkpIHsKICAgICAgICAgICAgY29uc3Qgam9iVUlEID0gbWVzc2FnZURhdGEudWlkOwogICAgICAgICAgICBjb25zdCBzdWJzY3JpcHRpb24gPSBhY3RpdmVTdWJzY3JpcHRpb25zLmdldChqb2JVSUQpOwogICAgICAgICAgICBpZiAoc3Vic2NyaXB0aW9uKSB7CiAgICAgICAgICAgICAgc3Vic2NyaXB0aW9uLnVuc3Vic2NyaWJlKCk7CiAgICAgICAgICAgICAgYWN0aXZlU3Vic2NyaXB0aW9ucy5kZWxldGUoam9iVUlEKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0pOwogICAgICB9CiAgICAgIGV4cG9ydHMyLmV4cG9zZSA9IGV4cG9zZTI7CiAgICAgIGlmICh0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biA9IDAsIG9wdHMgPSB7fSkgewogICAgICBjb25zdCB7IGhlYWRlcnMgPSB7fSwgc2lnbmFsLCBvdmVycmlkZXMgPSB7fSB9ID0gb3B0czsKICAgICAgaWYgKGxlbmd0aCA8IEluZmluaXR5KSB7CiAgICAgICAgaGVhZGVycy5yYW5nZSA9IGBieXRlcz0ke3Bvc2l0aW9ufS0ke3Bvc2l0aW9uICsgbGVuZ3RofWA7CiAgICAgIH0gZWxzZSBpZiAobGVuZ3RoID09PSBJbmZpbml0eSAmJiBwb3NpdGlvbiAhPT0gMCkgewogICAgICAgIGhlYWRlcnMucmFuZ2UgPSBgYnl0ZXM9JHtwb3NpdGlvbn0tYDsKICAgICAgfQogICAgICBjb25zdCBhcmdzID0gewogICAgICAgIC4uLnRoaXMuYmFzZU92ZXJyaWRlcywKICAgICAgICAuLi5vdmVycmlkZXMsCiAgICAgICAgaGVhZGVyczogewogICAgICAgICAgLi4uaGVhZGVycywKICAgICAgICAgIC4uLm92ZXJyaWRlcy5oZWFkZXJzLAogICAgICAgICAgLi4udGhpcy5iYXNlT3ZlcnJpZGVzLmhlYWRlcnMKICAgICAgICB9LAogICAgICAgIG1ldGhvZDogIkdFVCIsCiAgICAgICAgcmVkaXJlY3Q6ICJmb2xsb3ciLAogICAgICAgIG1vZGU6ICJjb3JzIiwKICAgICAgICBzaWduYWwKICAgICAgfTsKICAgICAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCB0aGlzLmZldGNoKHRoaXMudXJsLCBhcmdzKTsKICAgICAgaWYgKCFyZXNwb25zZS5vaykgewogICAgICAgIHRocm93IG5ldyBFcnJvcihgSFRUUCAke3Jlc3BvbnNlLnN0YXR1c30gJHtyZXNwb25zZS5zdGF0dXNUZXh0fSAke3RoaXMudXJsfWApOwogICAgICB9CiAgICAgIGlmIChyZXNwb25zZS5zdGF0dXMgPT09IDIwMCAmJiBwb3NpdGlvbiA9PT0gMCB8fCByZXNwb25zZS5zdGF0dXMgPT09IDIwNikgewogICA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IHsKICAgICAgICBlbmNvZGluZyA9IG9wdGlvbnMuZW5jb2Rpbmc7CiAgICAgICAgb3B0cyA9IG9wdGlvbnM7CiAgICAgICAgZGVsZXRlIG9wdHMuZW5jb2Rpbmc7CiAgICAgIH0KICAgICAgY29uc3QgeyBoZWFkZXJzID0ge30sIHNpZ25hbCwgb3ZlcnJpZGVzID0ge30gfSA9IG9wdHM7CiAgICAgIGNvbnN0IGFyZ3MgPSB7CiAgICAgICAgaGVhZGVycywKICAgICAgICBtZXRob2Q6ICJHRVQiLAogICAgICAgIHJlZGlyZWN0OiAiZm9sbG93IiwKICAgICAgICBtb2RlOiAiY29ycyIsCiAgICAgICAgc2lnbmFsLAogICAgICAgIC4uLnRoaXMuYmFzZU92ZXJyaWRlcywKICAgICAgICAuLi5vdmVycmlkZXMKICAgICAgfTsKICAgICAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCB0aGlzLmZldGNoKHRoaXMudXJsLCBhcmdzKTsKICAgICAgaWYgKCFyZXNwb25zZSkgewogICAgICAgIHRocm93IG5ldyBFcnJvcigiZ2VuZXJpYy1maWxlaGFuZGxlIGZhaWxlZCB0byBmZXRjaCIpOwogICAgICB9CiAgICAgIGlmIChyZXNwb25zZS5zdGF0dXMgIT09IDIwMCkgewogICAgICAgIHRocm93IE9iamVjdC5hc3NpZ24obmV3IEVycm9yKGBIVFRQICR7cmVzcG9uc2Uuc3RhdHVzfSBmZXRjaGluZyAke3RoaXMudXJsfWApLCB7CiAgICAgICAgICBzdGF0dXM6IHJlc3BvbnNlLnN0YXR1cwogICAgICAgIH0pOwogICAgICB9CiAgICAgIGlmIChlbmNvZGluZyA9PT0gInV0ZjgiKSB7CiAgICAgICAgcmV0dXJuIHJlc3BvbnNlLnRleHQoKTsKICAgICAgfQogICAgICBpZiAoZW5jb2RpbmcpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYHVuc3VwcG9ydGVkIGVuY29kaW5nOiAke2VuY29kaW5nfWApOwogICAgICB9Ci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pdGlvbnMgPSBbXTsKICAgICAgY29uc3QgZHBvc2l0aW9ucyA9IFtdOwogICAgICBsZXQgdG90YWxTaXplID0gMDsKICAgICAgbGV0IGkgPSAwOwogICAgICBkbyB7CiAgICAgICAgY29uc3QgcmVtYWluaW5nSW5wdXQgPSBpbnB1dERhdGEuc3ViYXJyYXkoY3BvcyAtIG1pbnYuYmxvY2tQb3NpdGlvbik7CiAgICAgICAgY29uc3QgaW5mbGF0b3IgPSBuZXcgaW1wb3J0X3Bha28uSW5mbGF0ZSgpOwogICAgICAgICh7IHN0cm0gfSA9IGluZmxhdG9yKTsKICAgICAgICBpbmZsYXRvci5wdXNoKHJlbWFpbmluZ0lucHV0LCBpbXBvcnRfcGFrby5aX1NZTkNfRkxVU0gpOwogICAgICAgIGlmIChpbmZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcihpbmZsYXRvci5tc2cpOwogICAgICAgIH0KICAgICAgICBjb25zdCBidWZmZXIyID0gaW5mbGF0b3IucmVzdWx0OwogICAgICAgIGNodW5rcy5wdXNoKGJ1ZmZlcjIpOwogICAgICAgIGxldCBsZW4gPSBidWZmZXIyLmxlbmd0aDsKICAgICAgICBjcG9zaXRpb25zLnB1c2goY3Bvcyk7CiAgICAgICAgZHBvc2l0aW9ucy5wdXNoKGRwb3MpOwogICAgICAgIGlmIChjaHVua3MubGVuZ3RoID09PSAxICYmIG1pbnYuZGF0YVBvc2l0aW9uKSB7CiAgICAgICAgICBjaHVua3NbMF0gPSBjaHVua3NbMF0uc3ViYXJyYXkobWludi5kYXRhUG9zaXRpb24pOwogICAgICAgICAgbGVuID0gY2h1bmtzWzBdLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgY29uc3Qgb3JpZ0Nwb3MgPSBjcG9zOwogICAgICAgIGNwb3MgKz0gc3RybS5uZXh0X2luOwogICAgICAgIGRwb3MgKz0gbGVuOwogICAgICAgIGlmIChvcmlnQ3BvcyA+PSBtYXh2LmJsb2NrUG9z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3IiKTsKICAgICAgfSBlbHNlIHsKICAgICAgICBjb25zdCBlID0gbmV3IEFib3J0RXJyb3IoImFib3J0ZWQiKTsKICAgICAgICBlLmNvZGUgPSAiRVJSX0FCT1JURUQiOwogICAgICAgIHRocm93IGU7CiAgICAgIH0KICAgIH0KICB9CiAgZnVuY3Rpb24gY2FuTWVyZ2VCbG9ja3MoY2h1bmsxLCBjaHVuazIpIHsKICAgIHJldHVybiBjaHVuazIubWludi5ibG9ja1Bvc2l0aW9uIC0gY2h1bmsxLm1heHYuYmxvY2tQb3NpdGlvbiA8IDY1ZTMgJiYgY2h1bmsyLm1heHYuYmxvY2tQb3NpdGlvbiAtIGNodW5rMS5taW52LmJsb2NrUG9zaXRpb24gPCA1ZTY7CiAgfQogIGZ1bmN0aW9uIG9wdGltaXplQ2h1bmtzKGNodW5rcywgbG93ZXN0KSB7CiAgICBjb25zdCBtZXJnZWRDaHVua3MgPSBbXTsKICAgIGxldCBsYXN0Q2h1bmsgPSBudWxsOwogICAgaWYgKGNodW5rcy5sZW5ndGggPT09IDApIHsKICAgICAgcmV0dXJuIGNodW5rczsKICAgIH0KICAgIGNodW5rcy5zb3J0KGZ1bmN0aW9uKGMwLCBjMSkgewogICAgICBjb25zdCBkaWYgPSBjMC5taW52LmJsb2NrUG9zaXRpb24gLSBjMS5taW52LmJsb2NrUG9zaXRpb247CiAgICAgIGlmIChkaWYgIT09IDApIHsKICAgICAgICByZXR1cm4gZGlmOwogICAgICB9IGVsc2UgewogICAgICAgIHJldHVybiBjMC5taW52LmRhdGFQb3NpdGlvbiAtIGMxLm1pbnYuZGF0YVBvc2l0aW9uOwogICAgICB9CiAgICB9KTsKICAgIGNodW5rcy5mb3JFYWNoKChjaHVuaykgPT4gewogICAgICBpZiAoIWxvd2VzdCB8fCBjaHVuay5tYXh2LmNvbXBhcmVUbyhsb3dlc3QpID4gMCkgewogICAgICAgIGlmIChsYXN0Q2h1bmsgPT09IG51bGwpIHsKICAgICAgICAgIG1lcmdlZEN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XQpOwogICAgICAgIGN1cnJPZmZzZXQgKz0gNDsKICAgICAgICBjb25zdCBiaW5JbmRleCA9IHt9OwogICAgICAgIGxldCBzdGF0czsKICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGJpbkNvdW50OyBqICs9IDEpIHsKICAgICAgICAgIGNvbnN0IGJpbiA9IGJ5dGVzLnJlYWRVSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgIGN1cnJPZmZzZXQgKz0gNDsKICAgICAgICAgIGlmIChiaW4gPiBtYXhCaW5OdW1iZXIgKyAxKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigidGFiaXggaW5kZXggY29udGFpbnMgdG9vIG1hbnkgYmlucywgcGxlYXNlIHVzZSBhIENTSSBpbmRleCIpOwogICAgICAgICAgfSBlbHNlIGlmIChiaW4gPT09IG1heEJpbk51bWJlciArIDEpIHsKICAgICAgICAgICAgY29uc3QgY2h1bmtDb3VudCA9IGJ5dGVzLnJlYWRJbnQzMkxFKGN1cnJPZmZzZXQpOwogICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDQ7CiAgICAgICAgICAgIGlmIChjaHVua0NvdW50ID09PSAyKSB7CiAgICAgICAgICAgICAgc3RhdHMgPSB0aGlzLnBhcnNlUHNldWRvQmluKGJ5dGVzLCBjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDE2ICogY2h1bmtDb3VudDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGNvbnN0IGNodW5rQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgICAgICBjb25zdCBjaHVua3MgPSBuZXcgQXJyYXkoY2h1bmtDb3VudCk7CiAgICAgICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgY2h1bmtDb3VudDsgayArPSAxKSB7CiAgICAgICAgICAgICAgY29uc3QgdSA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCk7CiAgICAgICAgICAgICAgY29uc3QgdiA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCArIDgpOwogICAgICAgICAgICAgIGN1cnJPZmZzZXQgKz0gMTY7CiAgICAgICAgICAgICAgZmlyc3REYXRhTGluZSA9IHRoaXMuX2ZpbmRGaXJzdERhdGEoZmlyc3REYXRhTGluZSwgdSk7CiAgICAgICAgICAgICAgY2h1bmtzW2tdID0gbmV3IENodW5rKHUsIHYsIGJpbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYmluSW5kZXhbYmluXSA9IGNodW5rczsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgY29uc3QgbGluZWFyQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICBjdXJyT2Zmc2V0ICs9IDQ7CiAgICAgICAgY29uc3QgbGluZWFySW5kZXggPSBuZXcgQXJyYXkobGluZWFyQ291bnQpOwogICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgbGluZWFyQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgbGluZWFySW5kZXhba10gPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQpOwogICAgICAgICAgY3Vyck9mZnNldCArPSA4OwogICAgICAgICAgZmlyc3REYXRhTGluZSA9IHRoaXMuX2ZpbmRGaXJzdERhdGEoZmlyc3REYXRhTGluZSwgbGluZWFySW5kZXhba10pOwogICAgICAgIH0KICAgICAgICByZXR1cm4geyBiaW5JbmRleCwgbGluZWFySW5kZXgsIHN0YXRzIH07CiAgICAgIH0pOwogICAgICByZXR1cm4gewogICAgICAgIGluZGljZXMsCiAgICAgICAgbWV0YUNoYXIsCiAgICAgICAgbWF4QmluTnVtYmVyLAogICAgICAgIG1heFJlZkxlbmd0aCwKICAgICAgICBza2lwTGluZXMsCiAgICAgICAgZmlyc3REYXRhTGluZSw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BjdXJyTmFtZVN0YXJ0ID0gaSArIDE7CiAgICAgICAgICBjdXJyUmVmSWQgKz0gMTsKICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIHsgcmVmTmFtZVRvSWQsIHJlZklkVG9OYW1lIH07CiAgICB9CiAgICBhc3luYyBibG9ja3NGb3JSYW5nZShyZWZOYW1lLCBtaW4sIG1heCwgb3B0cyA9IHt9KSB7CiAgICAgIGlmIChtaW4gPCAwKSB7CiAgICAgICAgbWluID0gMDsKICAgICAgfQogICAgICBjb25zdCBpbmRleERhdGEgPSBhd2FpdCB0aGlzLnBhcnNlKG9wdHMpOwogICAgICBpZiAoIWluZGV4RGF0YSkgewogICAgICAgIHJldHVybiBbXTsKICAgICAgfQogICAgICBjb25zdCByZWZJZCA9IGluZGV4RGF0YS5yZWZOYW1lVG9JZFtyZWZOYW1lXTsKICAgICAgY29uc3QgYmEgPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmICghYmEpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3QgbWluT2Zmc2V0ID0gYmEubGluZWFySW5kZXgubGVuZ3RoID8gYmEubGluZWFySW5kZXhbbWluID4+IFRBRF9MSURYX1NISUZUID49IGJhLmxpbmVhckluZGV4Lmxlbmd0aCA/IGJhLmxpbmVhckluZGV4Lmxlbmd0aCAtIDEgOiBtaW4gPj4gVEFEX0xJRFhfU0hJRlRdIDogbmV3IFZpcnR1YWxPZmZzZXQoMCwgMCk7CiAgICAgIGlmICghbWluT2Zmc2V0KSB7CiAgICAgICAgY29uc29sZS53YXJuKCJxdWVyeWluZyBvdXRzaWRlIG9mIHBvc3NpYmxlIHRhYml4IHJhbmdlIik7CiAgICAgIH0KICAgICAgY29uc3Qgb3ZlcmxhcHBpbmdCaW5zID0gcmVnMmJpbnMobWluLCBtYXgpOwogICAgICBjb25zdCBjaHVua3MgPSBbXTsKICAgICAgZm9yIChjb25zdCBbc3RhcnQsIGVuZF0gb2Ygb3ZlcmxhcHBpbmdCaW5zKSB7CiAgICAgICAgZm9yIChsZXQgYmluID0gc3RhcnQ7IGJpbiA8PSBlbmQ7IGJpbisrKSB7CiAgICAgICAgICBpZiAoYmEuYmluSW5kZXhbYmluXSkgewogICAgICAgICAgICBjb25zdCBiaW5DaHVua3MgPSBiYS5iaW5JbmRleFtiaW5dOwogICAgICAgICAgICBmb3IgKGxldCBjID0gMDsgYyA8IGJpbkNodW5rcy5sZW5ndGg7ICsrYykgewogICAgICAgICAgICAgIGNodW5rcy5wdXNoKG5ldyBDaHVuayhiaW5DaHVua3NbY10ubWludiwgYmluQ2h1bmtzW2NdLm1heHYsIGJpbikpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGNvbnN0IG5pbnR2ID0gYmEubGluZWFySW5kZXgubGVuZ3RoOwogICAgICBsZXQgbG93ZXN0ID0gbnVsbDsKICAgICAgY29uc3QgbWluTGluID0gTWF0aC5taW4obWluID4+IDE0LCBuaW50diAtIDEpOwogICAgICBjb25zdCBtYXhMaW4gPSBNYXRoLm1pbihtYXggPj4gMTQsIG5pbnR2IC0gMSk7CiAgICAgIGZvciAobGV0IGkgPSBtaW5MaW47IGkgPD0gbWF4TGluOyArK2kpIHsKICAgICAgICBjb25zdCB2cCA9IGJhLmxpbmVhckluZGV4W2ldOwogICAgICAgIGlmICh2cCkgewogICAgICAgICAgaWYgKCFsb3dlc3QgfHwgdnAuY29tcGFyZVRvKGxvd2VzdCkgPCAwKSB7CiAgICAgICAgICAgIGxvd2VzdCA9IHZwOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gb3B0aW1pemVDaHVua3MoY2h1bmtzLCBsb3dlc3QpOwogICAgfQogIH07CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9AZ21vZCt0YWJpeEAxLjUuMTEvbm9kZV9tb2R1bGVzL0BnbW9kL3RhYml4L2VzbS9jc2kuanMKICBp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iAgICAgICAgICAgIGZpcnN0RGF0YUxpbmUgPSB0aGlzLl9maW5kRmlyc3REYXRhKGZpcnN0RGF0YUxpbmUsIGxvZmZzZXQpOwogICAgICAgICAgICBjb25zdCBjaHVua0NvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCArIDEyKTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNjsKICAgICAgICAgICAgY29uc3QgY2h1bmtzID0gbmV3IEFycmF5KGNodW5rQ291bnQpOwogICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGNodW5rQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgICAgIGNvbnN0IHUgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQpOwogICAgICAgICAgICAgIGNvbnN0IHYgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQgKyA4KTsKICAgICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDE2OwogICAgICAgICAgICAgIGNodW5rc1trXSA9IG5ldyBDaHVuayh1LCB2LCBiaW4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGJpbkluZGV4W2Jpbl0gPSBjaHVua3M7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiB7IGJpbkluZGV4LCBzdGF0cyB9OwogICAgICB9KTsKICAgICAgcmV0dXJuIHsKICAgICAgICAuLi5hdXgsCiAgICAgICAgY3NpOiB0cnVlLAogICAgICAgIHJlZkNvdW50LAogICAgICAgIG1heEJsb2NrU2l6ZTogMSA8PCAxNiwKICAgICAgICBmaXJzdERhdGFMaW5lLAogICAgICAgIGNzaVZlcnNpb24sCiAgICAgICAgaW5kaWNlcywKICAgICAgICBkZXB0aDogdGhpcy5kZXB0aCwKICAgICAgICBtYXhCaW5OdW1iZXI6IHRoaXMubWF4QmluTnVtYmVyLAogICAgICAgIG1heFJlZkxlbmd0aAogICAgICB9OwogICAgfQogICAgcGFyc2VQc2V1ZG9Ca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AgICAgICBjaHVua3MucHVzaChuZXcgQ2h1bmsoYmluQ2h1bmtzW2NdLm1pbnYsIGJpbkNodW5rc1tjXS5tYXh2LCBiaW4pKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gb3B0aW1pemVDaHVua3MoY2h1bmtzLCBuZXcgVmlydHVhbE9mZnNldCgwLCAwKSk7CiAgICB9CiAgICByZWcyYmlucyhiZWcsIGVuZCkgewogICAgICBiZWcgLT0gMTsKICAgICAgaWYgKGJlZyA8IDEpIHsKICAgICAgICBiZWcgPSAxOwogICAgICB9CiAgICAgIGlmIChlbmQgPiAyICoqIDUwKSB7CiAgICAgICAgZW5kID0gMiAqKiAzNDsKICAgICAgfQogICAgICBlbmQgLT0gMTsKICAgICAgbGV0IGwgPSAwOwogICAgICBsZXQgdCA9IDA7CiAgICAgIGxldCBzID0gdGhpcy5taW5TaGlmdCArIHRoaXMuZGVwdGggKiAzOwogICAgICBjb25zdCBiaW5zID0gW107CiAgICAgIGZvciAoOyBsIDw9IHRoaXMuZGVwdGg7IHMgLT0gMywgdCArPSBsc2hpZnQoMSwgbCAqIDMpLCBsICs9IDEpIHsKICAgICAgICBjb25zdCBiID0gdCArIHJzaGlmdChiZWcsIHMpOwogICAgICAgIGNvbnN0IGUgPSB0ICsgcnNoaWZ0KGVuZCwgcyk7CiAgICAgICAgaWYgKGUgLSBiICsgYmlucy5sZW5ndGggPiB0aGlzLm1heEJpbk51bWJlcikgewogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBxdWVyeSAke2JlZ30tJHtlbmR9IGlzIHRvbyBsYXJnZSBmb3IgY3VycmVudCBiaW5uaW5nIHNjaGVtZSAoc2hpZnQgJHt0aGlzLm1pblNoaWZ0fSwgZGVwdGggJHt0aGlzLmRlcHRofSksIHRyeSBhIHNtYWxsZXIgcXVlcnkgb3IgYSBjb2Fyc2VyIGluZGV4IGJpbm5pbmcgc2NoZW1lYCk7CiAgICAg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F0YSwgcmVnaW9uUmVmTmFtZSwgcmVnaW9uU3RhcnQsIHJlZ2lvbkVuZCwgbGluZSkgewogICAgICBjb25zdCB7IGNvbHVtbk51bWJlcnMsIG1ldGFDaGFyLCBjb29yZGluYXRlVHlwZSwgZm9ybWF0IH0gPSBtZXRhZGF0YTsKICAgICAgaWYgKGxpbmUuY2hhckF0KDApID09PSBtZXRhQ2hhcikgewogICAgICAgIHJldHVybiB7IG92ZXJsYXBzOiBmYWxzZSB9OwogICAgICB9CiAgICAgIGxldCB7IHJlZiwgc3RhcnQsIGVuZCB9ID0gY29sdW1uTnVtYmVyczsKICAgICAgaWYgKCFyZWYpIHsKICAgICAgICByZWYgPSAwOwogICAgICB9CiAgICAgIGlmICghc3RhcnQpIHsKICAgICAgICBzdGFydCA9IDA7CiAgICAgIH0KICAgICAgaWYgKCFlbmQpIHsKICAgICAgICBlbmQgPSAwOwogICAgICB9CiAgICAgIGlmIChmb3JtYXQgPT09ICJWQ0YiKSB7CiAgICAgICAgZW5kID0gODsKICAgICAgfQogICAgICBjb25zdCBtYXhDb2x1bW4gPSBNYXRoLm1heChyZWYsIHN0YXJ0LCBlbmQpOwogICAgICBsZXQgY3VycmVudENvbHVtbk51bWJlciA9IDE7CiAgICAgIGxldCBjdXJyZW50Q29sdW1uU3RhcnQgPSAwOwogICAgICBsZXQgcmVmU2VxID0gIiI7CiAgICAgIGxldCBzdGFydENvb3JkaW5hdGUgPSAtSW5maW5pdHk7CiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGluZS5sZW5ndGggKyAxOyBpICs9IDEpIHsKICAgICAgICBpZiAobGluZVtpXSA9PT0gIgkiIHx8IGkgPT09IGxpbmUubGVuZ3RoKSB7CiAgICAgICAgICBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gcmVmKSB7CiAgICAgICAgICAgIGlmICh0aGlzLnJlbmFtZVJlZlNlcShsaW5lLnNsaWNlKGN1cnJlbnRDb2x1bW5TdGFydCwgaSkpICE9PSByZWdpb25SZWZOYW1lKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHsgb3ZlcmxhcHM6IGZhbHNlIH07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gc3RhcnQpIHsKICAgICAgICAgICAgc3RhcnRDb29yZGluYXRlID0gcGFyc2VJbnQobGluZS5zbGljZShjdXJyZW50Q29sdW1uU3RhcnQsIGkpLCAxMCk7CiAgICAgICAgICAgIGlmIChjb29yZGluYXRlVHlwZSA9PT0gIjEtYmFzZWQtY2xvc2VkIikgewogICAgICAgICAgICAgIHN0YXJ0Q29vcmRpbmF0ZSAtPSAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzdGFydENvb3JkaW5hdGUgPj0gcmVnaW9uRW5kKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHsgc3RhcnRDb29yZGluYXRlLCBvdmVybGFwczogZmFsc2UgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoZW5kID09PSAwIHx8IGVuZCA9PT0gc3RhcnQpIHsKICAgICAgICAgICAgICBpZiAoc3RhcnRDb29yZGluYXRlICsgMSA8PSByZWdpb25TdGFydCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHsgc3RhcnRDb29yZGluYXRlLCBvdmVybGFwczogZmFsc2UgfTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoZm9ybWF0ID09PSAiVkNGIiAmJiBjdXJyZW50Q29sdW1uTnVtYmVyID09PSA0KSB7CiAgICAgICAgICAgIHJlZlNlcSA9IGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKTsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gZW5kKSB7CiAgICAgICAgICAgIGxldCBlbmRDb29yZGluYXRlOwogICAgICAgICAgICBpZiAoZm9ybWF0ID09PSAiVkNGIikgewog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AgICAgICAgICBpZiAocHJldkNoYXIgPT09ICI7IiAmJiBpbmZvLnNsaWNlKGosIGogKyA0KSA9PT0gIkVORD0iKSB7CiAgICAgICAgICAgIGxldCB2YWx1ZUVuZCA9IGluZm8uaW5kZXhPZigiOyIsIGopOwogICAgICAgICAgICBpZiAodmFsdWVFbmQgPT09IC0xKSB7CiAgICAgICAgICAgICAgdmFsdWVFbmQgPSBpbmZvLmxlbmd0aDsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbmRDb29yZGluYXRlID0gcGFyc2VJbnQoaW5mby5zbGljZShqICsgNCwgdmFsdWVFbmQpLCAxMCk7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgcHJldkNoYXIgPSBpbmZvW2pdOwogICAgICAgIH0KICAgICAgfSBlbHNlIGlmIChpc1RSQSkgewogICAgICAgIHJldHVybiBzdGFydENvb3JkaW5hdGUgKyAxOwogICAgICB9CiAgICAgIHJldHVybiBlbmRDb29yZGluYXRlOwogICAgfQogICAgYXN5bmMgbGluZUNvdW50KHJlZk5hbWUsIG9wdHMgPSB7fSkgewogICAgICByZXR1cm4gdGhpcy5pbmRleC5saW5lQ291bnQocmVmTmFtZSwgb3B0cyk7CiAgICB9CiAgICBhc3luYyBfcmVhZFJlZ2lvbihwb3MsIHNpemUsIG9wdHMgPSB7fSkgewogICAgICBjb25zdCBiID0gaW1wb3J0X2J1ZmZlcjcuQnVmZmVyLmFsbG9jKHNpemUpOwogICAgICBjb25zdCB7IGJ5dGVzUmVhZCwgYnVmZmVyIH0gPSBhd2FpdCB0aGlzLmZpbGVoYW5kbGUucmVhZChiLCAwLCBzaXplLCBwb3MsIG9wdHMpOwogICAgICByZXR1cm4gYnVmZmVyLnNsaWNlKDAsIGJ5dGVzUmVhZCk7CiAgICB9CiAgICBhc3luYyByZWFkQ2h1bmsoYywgb3B0cyA9IHt9KSB7CiAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCB0aGlzLl9yZWFkUmVna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ICAgcmV0dXJuIHsKICAgICAgICAuLi5wYXJzZWQsCiAgICAgICAgc2VxX2lkOiBjWzBdLAogICAgICAgIHN0YXJ0OiBjWzFdICYmIGNbMV0ucmVwbGFjZSgvXEQvZywgIiIpLAogICAgICAgIGVuZDogY1syXSAmJiBjWzJdLnJlcGxhY2UoL1xEL2csICIiKQogICAgICB9OwogICAgfSBlbHNlIGlmIChuYW1lID09PSAiZ2Vub21lLWJ1aWxkIikgewogICAgICBjb25zdCBbc291cmNlLCBidWlsZE5hbWVdID0gY29udGVudHMuc3BsaXQoL1xzKy8sIDIpOwogICAgICByZXR1cm4gewogICAgICAgIC4uLnBhcnNlZCwKICAgICAgICBzb3VyY2UsCiAgICAgICAgYnVpbGROYW1lCiAgICAgIH07CiAgICB9CiAgICByZXR1cm4gcGFyc2VkOwogIH0KICBmdW5jdGlvbiBmb3JtYXRBdHRyaWJ1dGVzKGF0dHJzKSB7CiAgICBjb25zdCBhdHRyT3JkZXIgPSBbXTsKICAgIE9iamVjdC5lbnRyaWVzKGF0dHJzKS5mb3JFYWNoKChbdGFnLCB2YWxdKSA9PiB7CiAgICAgIGlmICghdmFsKQogICAgICAgIHJldHVybjsKICAgICAgbGV0IHZhbHN0cmluZzsKICAgICAgaWYgKHZhbC5oYXNPd25Qcm9wZXJ0eSgidG9TdHJpbmciKSkgewogICAgICAgIHZhbHN0cmluZyA9IGVzY2FwZSh2YWwudG9TdHJpbmcoKSk7CiAgICAgIH0gZWxzZSBpZiAoQXJyYXkuaXNBcnJheSh2YWwpKSB7CiAgICAgICAgdmFsc3RyaW5nID0gdmFsLm1hcChlc2NhcGUpLmpvaW4oIiwiKTsKICAgICAgfSBlbHNlIHsKICAgICAgICB2YWxzdHJpbmcgPSBlc2NhcGUodmFsKTsKICAgICAgfQogICAgICBhdHRyT3JkZXIucHVzaChgJHtlc2NhcGUodGFnKX09JHt2YWxzdHJpbmd9YCk7CiAgICB9KTsKICAgIHJldHVybiBhdHRyT3JkZXIubGVuZ3R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uX2VtaXRJdGVtKFtmZWF0dXJlTGluZV0pOwogICAgICAgIHJldHVybjsKICAgICAgfQogICAgICBsZXQgZmVhdHVyZSA9IHZvaWQgMDsKICAgICAgaWRzLmZvckVhY2goKGlkKSA9PiB7CiAgICAgICAgY29uc3QgZXhpc3RpbmcgPSB0aGlzLl91bmRlckNvbnN0cnVjdGlvbkJ5SWRbaWRdOwogICAgICAgIGlmIChleGlzdGluZykgewogICAgICAgICAgaWYgKGV4aXN0aW5nW2V4aXN0aW5nLmxlbmd0aCAtIDFdLnR5cGUgIT09IGZlYXR1cmVMaW5lLnR5cGUpIHsKICAgICAgICAgICAgdGhpcy5fcGFyc2VFcnJvcihgbXVsdGktbGluZSBmZWF0dXJlICIke2lkfSIgaGFzIGluY29uc2lzdGVudCB0eXBlczogIiR7ZmVhdHVyZUxpbmUudHlwZX0iLCAiJHtleGlzdGluZ1tleGlzdGluZy5sZW5ndGggLSAxXS50eXBlfSJgKTsKICAgICAgICAgIH0KICAgICAgICAgIGV4aXN0aW5nLnB1c2goZmVhdHVyZUxpbmUpOwogICAgICAgICAgZmVhdHVyZSA9IGV4aXN0aW5nOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBmZWF0dXJlID0gW2ZlYXR1cmVMaW5lXTsKICAgICAgICAgIHRoaXMuX2VuZm9yY2VCdWZmZXJTaXplTGltaXQoMSk7CiAgICAgICAgICBpZiAoIXBhcmVudHMubGVuZ3RoICYmICFkZXJpdmVzLmxlbmd0aCkgewogICAgICAgICAgICB0aGlzLl91bmRlckNvbnN0cnVjdGlvblRvcExldmVsLnB1c2goZmVhdHVyZSk7CiAgICAgICAgICB9CiAgICAgICAgICB0aGlzLl91bmRlckNvbnN0cnVjdGlvbkJ5SWRbaWRdID0gZmVhdHVyZTsKICAgICAgICAgIHRoaXMuX3Jlc29sdmVSZWZlcmVuY2VzVG8oZmVhdHVyZSwgaWQpOwogICAgICAgIH0KICAgICAgfSk7CiAgICAgIHRoaXMuX3Jlc29sdmV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ICAgICAgIGNvbnN0IHJldHVyblZhbCA9IHN1Yk9ialtzbG90Ml0gfHwgZmFsc2U7CiAgICAgICAgc3ViT2JqW3Nsb3QyXSA9IHRydWU7CiAgICAgICAgcmV0dXJuIHJldHVyblZhbDsKICAgICAgfQogICAgICByZWZlcmVuY2VzLlBhcmVudC5mb3JFYWNoKCh0b0lkKSA9PiB7CiAgICAgICAgY29uc3Qgb3RoZXJGZWF0dXJlID0gdGhpcy5fdW5kZXJDb25zdHJ1Y3Rpb25CeUlkW3RvSWRdOwogICAgICAgIGlmIChvdGhlckZlYXR1cmUpIHsKICAgICAgICAgIGNvbnN0IHBuYW1lID0gY29udGFpbmVyQXR0cmlidXRlcy5QYXJlbnQ7CiAgICAgICAgICBpZiAoIWlkcy5maWx0ZXIoKGlkKSA9PiBwb3N0U2V0KHRoaXMuX2NvbXBsZXRlZFJlZmVyZW5jZXMsIGlkLCBgUGFyZW50LCR7dG9JZH1gKSkubGVuZ3RoKSB7CiAgICAgICAgICAgIG90aGVyRmVhdHVyZS5mb3JFYWNoKChsb2NhdGlvbikgPT4gewogICAgICAgICAgICAgIGxvY2F0aW9uW3BuYW1lXS5wdXNoKGZlYXR1cmUpOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgbGV0IHJlZiA9IHRoaXMuX3VuZGVyQ29uc3RydWN0aW9uT3JwaGFuc1t0b0lkXTsKICAgICAgICAgIGlmICghcmVmKSB7CiAgICAgICAgICAgIHJlZiA9IHsKICAgICAgICAgICAgICBQYXJlbnQ6IFtdLAogICAgICAgICAgICAgIERlcml2ZXNfZnJvbTogW10KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdGhpcy5fdW5kZXJDb25zdHJ1Y3Rpb25PcnBoYW5zW3RvSWRdID0gcmVmOwogICAgICAgICAgfQogICAgICAgICAgcmVmLlBhcmVudC5wdXNoKGZlYXR1cmUpOwogICAgICAgIH0KICAgICAgfSk7CiAgICAgIHJlZmVyZW5jZXMuRGVyaXZlc19mcm9tLmZvckVhY2goKHRvSWQpID0+IHsKICAgICAgICBjb25zdCBvdGhlckZlYXR1cmUgPSB0aGlzLl91bmRlckNvbnN0cnVjdGlvbkJ5SWRbdG9JZF07CiAgICAgICAgaWYgKG90aGVyRmVhdHVyZSkgewogICAgICAgICAgY29uc3QgcG5hbWUgPSBjb250YWluZXJBdHRyaWJ1dGVzLkRlcml2ZXNfZnJvbTsKICAgICAgICAgIGlmICghaWRzLmZpbHRlcigoaWQpID0+IHBvc3RTZXQodGhpcy5fY29tcGxldGVkUmVmZXJlbmNlcywgaWQsIGBEZXJpdmVzX2Zyb20sJHt0b0lkfWApKS5sZW5ndGgpIHsKICAgICAgICAgICAgb3RoZXJGZWF0dXJlLmZvckVhY2goKGxvY2F0aW9uKSA9PiB7CiAgICAgICAgICAgICAgbG9jYXRpb25bcG5hbWVdLnB1c2goZmVhdHVyZSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBsZXQgcmVmID0gdGhpcy5fdW5kZXJDb25zdHJ1Y3Rpb25PcnBoYW5zW3RvSWRdOwogICAgICAgICAgaWYgKCFyZWYpIHsKICAgICAgICAgICAgcmVmID0gewogICAgICAgICAgICAgIFBhcmVudDogW10sCiAgICAgICAgICAgICAgRGVyaXZlc19mcm9tOiBbXQogICAgICAgICAgICB9OwogICAgICAgICAgICB0aGlzLl91bmRlckNvbnN0cnVjdGlvbk9ycGhhbnNbdG9JZF0gPSByZWY7CiAgICAgICAgICB9CiAgICAgICAgICByZWYuRGVyaXZlc19mcm9tLnB1c2goZmVhdHVyZSk7CiAgICAgICAgfQogICAgICB9KTsKICAgIH0KICB9OwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vQGdtb2QrZ2ZmQDEuMy4wL25vZGVfbW9kdWxlcy9AZ21vZC9nZmYvZXNtL2FwaS5qcwogIGZ1bmN0aW9uIF9jYWxsYmFjayhjYWxsYmFja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5rICYmICF0aGlzLmZhc3RhTW9kZSkgewogICAgICAgIHRoaXMucHVzaCgiIyNGQVNUQVxuIik7CiAgICAgICAgdGhpcy5mYXN0YU1vZGUgPSB0cnVlOwogICAgICB9CiAgICAgIGlmIChBcnJheS5pc0FycmF5KGNodW5rKSkKICAgICAgICBzdHIgPSBjaHVuay5tYXAoZm9ybWF0SXRlbSkuam9pbigiIik7CiAgICAgIGVsc2UKICAgICAgICBzdHIgPSBmb3JtYXRJdGVtKGNodW5rKTsKICAgICAgdGhpcy5wdXNoKHN0cik7CiAgICAgIGlmICh0aGlzLmxpbmVzU2luY2VMYXN0U3luY01hcmsgPj0gdGhpcy5taW5MaW5lc0JldHdlZW5TeW5jTWFya3MpIHsKICAgICAgICB0aGlzLnB1c2goIiMjI1xuIik7CiAgICAgICAgdGhpcy5saW5lc1NpbmNlTGFzdFN5bmNNYXJrID0gMDsKICAgICAgfSBlbHNlIHsKICAgICAgICBsZXQgY291bnQgPSAwOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSArPSAxKSB7CiAgICAgICAgICBpZiAoc3RyW2ldID09PSAiXG4iKQogICAgICAgICAgICBjb3VudCArPSAxOwogICAgICAgIH0KICAgICAgICB0aGlzLmxpbmVzU2luY2VMYXN0U3luY01hcmsgKz0gY291bnQ7CiAgICAgIH0KICAgICAgdGhpcy5oYXZlV2VFbWl0dGVkRGF0YSA9IHRydWU7CiAgICAgIF9jYWxsYmFjayhjYWxsYmFjayk7CiAgICB9CiAgfTsKICBmdW5jdGlvbiBmb3JtYXRTdHJlYW0ob3B0aW9ucyA9IHt9KSB7CiAgICByZXR1cm4gbmV3IEZvcm1hdHRpbmdUcmFuc2Zvcm0ob3B0aW9ucyk7CiAgfQogIGZ1bmN0aW9uIGZvcm1hdEZpbGUoc3RyZWFtLCB3cml0ZVN0cmVhbSwgb3B0aW9ucyA9IHt9KSB7CiAgICBjb25zdCBuZXdPcHRpb25zID0gewogICAgICBpb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8gKyBoaSA+Pj4gMTsKICAgICAgICBpZiAoY29tcGFyZShhW21pZF0sIHgpIDwgMCkKICAgICAgICAgIGxvID0gbWlkICsgMTsKICAgICAgICBlbHNlCiAgICAgICAgICBoaSA9IG1pZDsKICAgICAgfQogICAgICByZXR1cm4gbG87CiAgICB9CiAgICBmdW5jdGlvbiByaWdodChhLCB4LCBsbywgaGkpIHsKICAgICAgaWYgKGxvID09IG51bGwpCiAgICAgICAgbG8gPSAwOwogICAgICBpZiAoaGkgPT0gbnVsbCkKICAgICAgICBoaSA9IGEubGVuZ3RoOwogICAgICB3aGlsZSAobG8gPCBoaSkgewogICAgICAgIGNvbnN0IG1pZCA9IGxvICsgaGkgPj4+IDE7CiAgICAgICAgaWYgKGNvbXBhcmUoYVttaWRdLCB4KSA+IDApCiAgICAgICAgICBoaSA9IG1pZDsKICAgICAgICBlbHNlCiAgICAgICAgICBsbyA9IG1pZCArIDE7CiAgICAgIH0KICAgICAgcmV0dXJuIGxvOwogICAgfQogICAgZnVuY3Rpb24gY2VudGVyKGEsIHgsIGxvLCBoaSkgewogICAgICBpZiAobG8gPT0gbnVsbCkKICAgICAgICBsbyA9IDA7CiAgICAgIGlmIChoaSA9PSBudWxsKQogICAgICAgIGhpID0gYS5sZW5ndGg7CiAgICAgIGNvbnN0IGkgPSBsZWZ0KGEsIHgsIGxvLCBoaSAtIDEpOwogICAgICByZXR1cm4gaSA+IGxvICYmIGRlbHRhKGFbaSAtIDFdLCB4KSA+IC1kZWx0YShhW2ldLCB4KSA/IGkgLSAxIDogaTsKICAgIH0KICAgIHJldHVybiB7IGxlZnQsIGNlbnRlciwgcmlnaHQgfTsKICB9CiAgZnVuY3Rpb24gYXNjZW5kaW5nQ29tcGFyYXRvcihmKSB7CiAgICByZXR1cm4gKGQsIHgpID0+IGFzY2VuZGluZ19kZWZhdWx0KGYoZCksIHgpOwogIH0KCiAgLy8gc3JjL2RhdGEtZmV0Y2hlcnMvdXRpbHMudHMKICB2YXIgRGF0YVN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Mgb2YgY3VtUG9zaXRpb25zKSB7CiAgICAgICAgICBjb25zdCBjaHJvbU5hbWUgPSBjdW1Qb3MuY2hyOwogICAgICAgICAgY291bnRQcm9taXNlcy5wdXNoKHRoaXMudGJpLmxpbmVDb3VudChjaHJvbU5hbWUpKTsKICAgICAgICB9CiAgICAgICAgY29uc3QgY291bnRzID0gYXdhaXQgUHJvbWlzZS5hbGwoY291bnRQcm9taXNlcyk7CiAgICAgICAgY29uc3QgdG90YWxfY291bnRzID0gY291bnRzLnJlZHVjZSgoYWNjLCBjdXIpID0+IGFjYyArIGN1ciwgMCk7CiAgICAgICAgdGhpcy4jbl9mZWF0dXJlcyA9IHRvdGFsX2NvdW50czsKICAgICAgfQogICAgICByZXR1cm4gdGhpcy4jbl9mZWF0dXJlczsKICAgIH0KICAgICNnZXRMaW5lUHJvbWlzZXMobWluWCwgbWF4WCkgewogICAgICBjb25zdCBzb3VyY2UgPSBkYXRhU291cmNlcy5nZXQodGhpcy4jdWlkKTsKICAgICAgbGV0IGN1ck1pblggPSBtaW5YOwogICAgICBjb25zdCB7IGNocm9tTGVuZ3RocywgY3VtUG9zaXRpb25zIH0gPSBzb3VyY2UuY2hyb21JbmZvOwogICAgICBjb25zdCBsaW5lUHJvbWlzZXMgPSBbXTsKICAgICAgY29uc3QgTUFYX0ZFQVRVUkVTID0gNWU1OwogICAgICBjb25zdCBNQVhfV0lORE9XID0gNGU2OwogICAgICBpZiAodGhpcy4jbl9mZWF0dXJlcyAmJiB0aGlzLiNuX2ZlYXR1cmVzID4gTUFYX0ZFQVRVUkVTICYmIG1heFggLSBtaW5YID4gTUFYX1dJTkRPVykgewogICAgICAgIGNvbnN0IGRpZmYgPSBtYXhYIC0gbWluWDsKICAgICAgICBjb25zdCB3aW5kb3dTaXplID0gNWU0OwogICAgICAgIGNvbnN0IG5fc2FtcGxlcyA9IDEwMDsKICAgICAgICBjb25zdCB0b3RhbEJpbnMgPSBNYXRoLmZsb29yKGRpZmYgLyB3aW5kb3dTaXplKTsKICAgICAgICBjb25zdCBzZWxlY3RlZEJpbnMgPSBtYWtlUmFuZG9tU29ydGVkQXJyYXkobl9zYW1wbGVzLCB0b3RhbEJpbnMpOwogICAgICAgIGNvbnN0IGJpbkxpbmVzID0gc2VsZWN0ZWRCaW5zLm1hcCgoYmluKSA9PiB7CiAgICAgICAgICBjb25zdCBiaW5TdGFydCA9IG1pblggKyBiaW4gKiB3aW5kb3dTaXplOwogICAgICAgICAgY29uc3QgYmluRW5kID0gYmluU3RhcnQgKyB3aW5kb3dTaXplOwogICAgICAgICAgcmV0dXJuIHRoaXMuI2dldExpbmVQcm9taXNlcyhiaW5TdGFydCwgYmluRW5kKTsKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gYmluTGluZXMuZmxhdCgpOwogICAgICB9CiAgICAgIGZvciAoY29uc3QgY3VtUG9zIG9mIGN1bVBvc2l0aW9ucykgewogICAgICAgIGNvbnN0IGNocm9tTmFtZSA9IGN1bVBvcy5jaHI7CiAgICAgICAgY29uc3QgY2hyb21TdGFydCA9IGN1bVBvcy5wb3M7CiAgICAgICAgY29uc3QgY2hyb21FbmQgPSBjdW1Qb3MucG9zICsgY2hyb21MZW5ndGhzW2Nocm9tTmFtZV07CiAgICAgICAgbGV0IHN0YXJ0UG9zLCBlbmRQb3M7CiAgICAgICAgaWYgKGNocm9tU3RhcnQgPiBjdXJNaW5YIHx8IGN1ck1pblggPj0gY2hyb21FbmQpIHsKICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgIH0KICAgICAgICBjb25zdCBsaW5lUHJvbWlzZSA9IG5ldyBQcm9taXNlKChyZXNvbHZlKSA9PiB7CiAgICAgICAgICBjb25zdCBsaW5lcyA9IFtdOwogICAgICAgICAgY29uc3QgbGluZUNhbGxiYWNrID0gKGxpbmUpID0+IHsKICAgICAgICAgICAgbGluZXMucHVzaChsaW5lKTsKICAgICAgICAgIH07CiAgICAgICAgICBpZiAobWF4WCA+IGNocm9tRW5kKSB7CiAgICAgICAgIC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A9IHRpbGVzMi5tYXAoKHRpbGUyKSA9PiB7CiAgICAgICAgICAgIGNvbnN0IGF0dHJpYnV0ZXMgPSB0aWxlMi5hdHRyaWJ1dGVzOwogICAgICAgICAgICBjb25zdCBjbGVhbkF0dCA9IHt9OwogICAgICAgICAgICBhdHRyaWJ1dGVzVG9GaWVsZHMuZm9yRWFjaCgoYXR0TWFwKSA9PiB7CiAgICAgICAgICAgICAgY29uc3QgYXR0TmFtZSA9IGF0dE1hcC5hdHRyaWJ1dGU7CiAgICAgICAgICAgICAgY29uc3QgYXR0RGVmYXVsdCA9IGF0dE1hcC5kZWZhdWx0VmFsdWU7CiAgICAgICAgICAgICAgaWYgKGF0dHJpYnV0ZXMgPT0gbnVsbCB8fCAhKGF0dE5hbWUgaW4gYXR0cmlidXRlcykgfHwgIUFycmF5LmlzQXJyYXkoYXR0cmlidXRlc1thdHROYW1lXSkpCiAgICAgICAgICAgICAgICBjbGVhbkF0dFthdHROYW1lXSA9IGF0dERlZmF1bHQ7CiAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICBjb25zdCBhdHRWYWwgPSBhdHRyaWJ1dGVzW2F0dE5hbWVdOwogICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoYXR0VmFsKSkgewogICAgICAgICAgICAgICAgICBjbGVhbkF0dFthdHROYW1lXSA9IGF0dFZhbC5sZW5ndGggPT0gMSA/IGF0dFZhbFswXSA6IGF0dFZhbC5qb2luKCIsIik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgcmV0dXJuIHsgLi4udGlsZTIsIC4uLmNsZWFuQXR0IH07CiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRpbGVzMjsKICAgICAgfQogICAgICBjb25zdCBsaW5lUHJvbWlzZXMgPSB0aGlzLiNnZXRMaW5lUHJvbWlzZXMobWluWCwgbWF4WCk7CiAgICAgIGNvb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HsKICAgIGNvbnN0IHRpbGVzID0ge307CiAgICBjb25zdCB2YWxpZFRpbGVJZHMgPSBbXTsKICAgIGNvbnN0IHRpbGVQcm9taXNlcyA9IFtdOwogICAgZm9yIChjb25zdCB0aWxlSWQgb2YgdGlsZUlkcykgewogICAgICBjb25zdCBwYXJ0cyA9IHRpbGVJZC5zcGxpdCgiLiIpOwogICAgICBjb25zdCB6ID0gcGFyc2VJbnQocGFydHNbMF0sIDEwKTsKICAgICAgY29uc3QgeCA9IHBhcnNlSW50KHBhcnRzWzFdLCAxMCk7CiAgICAgIGlmIChOdW1iZXIuaXNOYU4oeCkgfHwgTnVtYmVyLmlzTmFOKHopKSB7CiAgICAgICAgY29uc29sZS53YXJuKCJJbnZhbGlkIHRpbGUgem9vbSBvciBwb3NpdGlvbjoiLCB6LCB4KTsKICAgICAgICBjb250aW51ZTsKICAgICAgfQogICAgICB2YWxpZFRpbGVJZHMucHVzaCh0aWxlSWQpOwogICAgICB0aWxlUHJvbWlzZXMucHVzaCh0aWxlKHVpZCwgeiwgeCkpOwogICAgfQogICAgcmV0dXJuIFByb21pc2UuYWxsKHRpbGVQcm9taXNlcykudGhlbigodmFsdWVzMikgPT4gewogICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHZhbHVlczIubGVuZ3RoOyBpKyspIHsKICAgICAgICBjb25zdCB2YWxpZFRpbGVJZCA9IHZhbGlkVGlsZUlkc1tpXTsKICAgICAgICB0aWxlc1t2YWxpZFRpbGVJZF0gPSB7IHRpbGVQb3NpdGlvbklkOiB2YWxpZFRpbGVJZCB9OwogICAgICB9CiAgICAgIHJldHVybiB0aWxlczsKICAgIH0pOwogIH07CiAgdmFyIGdldFRhYnVsYXJEYXRhID0gKHVpZCwgdGlsZUlkcykgPT4gewogICAgY29uc3QgZGF0YSA9IFtdOwogICAgdGlsZUlkcy5mb3JFYWNoKCh0aWxlSWQpID0+IHsKICAgICAgY29uc3QgcGFydHMgPSB0aWxlSWQuc3BsaXQoIi4iKTsKIC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ZW5zZS4gRmVyb3NzIEFib3VraGFkaWplaCA8aHR0cHM6Ly9mZXJvc3Mub3JnL29wZW5zb3VyY2U+ICovCi8qKgogKiBAbGljZW5zZQogKiBMb2Rhc2ggKEN1c3RvbSBCdWlsZCkgPGh0dHBzOi8vbG9kYXNoLmNvbS8+CiAqIEJ1aWxkOiBgbG9kYXNoIG1vZHVsYXJpemUgZXhwb3J0cz0iZXMiIC1vIC4vYAogKiBDb3B5cmlnaHQgT3BlbkpTIEZvdW5kYXRpb24gYW5kIG90aGVyIGNvbnRyaWJ1dG9ycyA8aHR0cHM6Ly9vcGVuanNmLm9yZy8+CiAqIFJlbGVhc2VkIHVuZGVyIE1JVCBsaWNlbnNlIDxodHRwczovL2xvZGFzaC5jb20vbGljZW5zZT4KICogQmFzZWQgb24gVW5kZXJzY29yZS5qcyAxLjguMyA8aHR0cDovL3VuZGVyc2NvcmVqcy5vcmcvTElDRU5TRT4KICogQ29weXJpZ2h0IEplcmVteSBBc2hrZW5hcywgRG9jdW1lbnRDbG91ZCBhbmQgSW52ZXN0aWdhdGl2ZSBSZXBvcnRlcnMgJiBFZGl0b3JzCiAqLwo="; +const blob$1 = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs$1)], { type: "text/javascript;charset=utf-8" }); +function Worker$2() { + const objURL = blob$1 && (window.URL || window.webkitURL).createObjectURL(blob$1); + try { + return objURL ? new Worker(objURL) : new Worker("data:application/javascript;base64," + encodedJs$1, { type: "module" }); + } finally { + objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL); + } +} +const DEBOUNCE_TIME$1 = 200; +class GffDataFetcher { + constructor(HGC, config2) { + __publicField(this, "dataConfig", {}); + // required for higlass + __publicField(this, "uid"); + __publicField(this, "prevRequestTime"); + __publicField(this, "track"); + __publicField(this, "toFetch"); + __publicField(this, "fetchTimeout"); + __publicField(this, "worker"); + this.uid = HGC.libraries.slugid.nice(); + this.prevRequestTime = 0; + this.toFetch = /* @__PURE__ */ new Set(); + const { url, indexUrl, assembly, ...options } = config2; + this.worker = spawn(new Worker$2()).then(async (worker) => { + const chromSizes = Object.entries(computeChromSizes(assembly).size); + await worker.init(this.uid, { url, indexUrl }, chromSizes, options); + return worker; + }); + } + /* + * Collect Tileset Information, such as tile size and genomic positions + */ + async tilesetInfo(callback) { + (await this.worker).tilesetInfo(this.uid).then(callback); + } + fetchTilesDebounced(receivedTiles, tileIds) { + this.track.drawLoadingCue(); + tileIds.forEach((tileId) => this.toFetch.add(tileId)); + if (this.fetchTimeout) { + clearTimeout(this.fetchTimeout); + } + this.fetchTimeout = setTimeout(() => { + this.sendFetch(receivedTiles, [...this.toFetch]); + this.toFetch.clear(); + }, DEBOUNCE_TIME$1); + } + async sendFetch(receivedTiles, tileIds) { + (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles); + } + async getTabularData(tileIds) { + const buf = await (await this.worker).getTabularData(this.uid, tileIds); + const parsed = JSON.parse(new TextDecoder().decode(buf)); + return parsed; + } +} +__publicField(GffDataFetcher, "config", { type: "gff" }); +const encodedJs = "KCgpID0+IHsKICB2YXIgX19jcmVhdGUgPSBPYmplY3QuY3JlYXRlOwogIHZhciBfX2RlZlByb3AgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiAgdmFyIF9fZ2V0T3duUHJvcERlc2MgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOwogIHZhciBfX2dldE93blByb3BOYW1lcyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzOwogIHZhciBfX2dldFByb3RvT2YgPSBPYmplY3QuZ2V0UHJvdG90eXBlT2Y7CiAgdmFyIF9faGFzT3duUHJvcCA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHk7CiAgdmFyIF9fbWFya0FzTW9kdWxlID0gKHRhcmdldCkgPT4gX19kZWZQcm9wKHRhcmdldCwgIl9fZXNNb2R1bGUiLCB7IHZhbHVlOiB0cnVlIH0pOwogIHZhciBfX2VzbSA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YgMjU1OwogICAgICAgICAgYXJyW2N1ckJ5dGUrK10gPSB0bXAgPj4gOCAmIDI1NTsKICAgICAgICAgIGFycltjdXJCeXRlKytdID0gdG1wICYgMjU1OwogICAgICAgIH0KICAgICAgICBpZiAocGxhY2VIb2xkZXJzTGVuID09PSAyKSB7CiAgICAgICAgICB0bXAgPSByZXZMb29rdXBbYjY0LmNoYXJDb2RlQXQoaTIpXSA8PCAyIHwgcmV2TG9va3VwW2I2NC5jaGFyQ29kZUF0KGkyICsgMSldID4+IDQ7CiAgICAgICAgICBhcnJbY3VyQnl0ZSsrXSA9IHRtcCAmIDI1NTsKICAgICAgICB9CiAgICAgICAgaWYgKHBsYWNlSG9sZGVyc0xlbiA9PT0gMSkgewogICAgICAgICAgdG1wID0gcmV2TG9va3VwW2I2NC5jaGFyQ29kZUF0KGkyKV0gPDwgMTAgfCByZXZMb29rdXBbYjY0LmNoYXJDb2RlQXQoaTIgKyAxKV0gPDwgNCB8IHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpMiArIDIpXSA+PiAyOwogICAgICAgICAgYXJyW2N1ckJ5dGUrK10gPSB0bXAgPj4gOCAmIDI1NTsKICAgICAgICAgIGFycltjdXJCeXRlKytdID0gdG1wICYgMjU1OwogICAgICAgIH0KICAgICAgICByZXR1cm4gYXJyOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHRyaXBsZXRUb0Jhc2U2NChudW0pIHsKICAgICAgICByZXR1cm4gbG9va3VwW251bSA+PiAxOCAmIDYzXSArIGxvb2t1cFtudW0gPj4gMTIgJiA2M10gKyBsb29rdXBbbnVtID4+IDYgJiA2M10gKyBsb29rdXBbbnVtICYgNjNdOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGVuY29kZUNodW5rKHVpbnQ4LCBzdGFydCwgZW5kKSB7CiAgICAgICAgdmFyIHRtcDsKICAgICAgICB2YXIgb3V0cHV0ID0gW107CiAgICAgICAgZm9yICh2YXIgaTIgPSBzdGFydDsgaTIgPCBlbmQ7IGkyICs9IDMpIHsKICAgICAgICAgIHRtcCA9ICh1aW50OFtpMl0gPDwgMTYgJiAxNjcxMTY4MCkgKyAodWludDhbaTIgKyAxXSA8PCA4ICYgNjUyODApICsgKHVpbnQ4W2kyICsgMl0gJiAyNTUpOwogICAgICAgICAgb3V0cHV0LnB1c2godHJpcGxldFRvQmFzZTY0KHRtcCkpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gb3V0cHV0LmpvaW4oIiIpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZyb21CeXRlQXJyYXkodWludDgpIHsKICAgICAgICB2YXIgdG1wOwogICAgICAgIHZhciBsZW4yID0gdWludDgubGVuZ3RoOwogICAgICAgIHZhciBleHRyYUJ5dGVzID0gbGVuMiAlIDM7CiAgICAgICAgdmFyIHBhcnRzID0gW107CiAgICAgICAgdmFyIG1heENodW5rTGVuZ3RoID0gMTYzODM7CiAgICAgICAgZm9yICh2YXIgaTIgPSAwLCBsZW4yMiA9IGxlbjIgLSBleHRyYUJ5dGVzOyBpMiA8IGxlbjIyOyBpMiArPSBtYXhDaHVua0xlbmd0aCkgewogICAgICAgICAgcGFydHMucHVzaChlbmNvZGVDaHVuayh1aW50OCwgaTIsIGkyICsgbWF4Q2h1bmtMZW5ndGggPiBsZW4yMiA/IGxlbjIyIDogaTIgKyBtYXhDaHVua0xlbmd0aCkpOwogICAgICAgIH0KICAgICAgICBpZiAoZXh0cmFCeXRlcyA9PT0gMSkgewogICAgICAgICAgdG1wID0gdWludDhbbGVuMiAtIDFdOwogICAgICAgICAgcGFydHMucHVzaChsb29rdXBbdG1wID4+IDJdICsgbG9va3VwW3RtcCA8PCA0ICYgNjNdICsgIj09Iik7CiAgICAgICAgfSBlbHNlIGlmIChleHRyYUJ5dGVzID09PSAyKSB7CiAgICAgICAgICB0bXAgPSAodWludDhbbGVuMiAtIDJdIDw8IDgpICsgdWludDhbbGVuMiAtIDFdOwogICAgICAgICAgcGFydHMucHVzaChsb29rdXBbdG1wID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gewogICAgICAgIH0KICAgICAgICBtID0gZSAmICgxIDw8IC1uQml0cykgLSAxOwogICAgICAgIGUgPj49IC1uQml0czsKICAgICAgICBuQml0cyArPSBtTGVuOwogICAgICAgIGZvciAoOyBuQml0cyA+IDA7IG0gPSBtICogMjU2ICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9IGQsIG5CaXRzIC09IDgpIHsKICAgICAgICB9CiAgICAgICAgaWYgKGUgPT09IDApIHsKICAgICAgICAgIGUgPSAxIC0gZUJpYXM7CiAgICAgICAgfSBlbHNlIGlmIChlID09PSBlTWF4KSB7CiAgICAgICAgICByZXR1cm4gbSA/IE5hTiA6IChzID8gLTEgOiAxKSAqIEluZmluaXR5OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBtID0gbSArIE1hdGgucG93KDIsIG1MZW4pOwogICAgICAgICAgZSA9IGUgLSBlQmlhczsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIChzID8gLTEgOiAxKSAqIG0gKiBNYXRoLnBvdygyLCBlIC0gbUxlbik7CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLndyaXRlID0gZnVuY3Rpb24oYnVmZmVyLCB2YWx1ZSwgb2Zmc2V0LCBpc0xFLCBtTGVuLCBuQnl0ZXMpIHsKICAgICAgICB2YXIgZSwgbSwgYzsKICAgICAgICB2YXIgZUxlbiA9IG5CeXRlcyAqIDggLSBtTGVuIC0gMTsKICAgICAgICB2YXIgZU1heCA9ICgxIDw8IGVMZW4pIC0gMTsKICAgICAgICB2YXIgZUJpYXMgPSBlTWF4ID4+IDE7CiAgICAgICAgdmFyIHJ0ID0gbUxlbiA9PT0gMjMgPyBNYXRoLnBvdygyLCAtMjQpIC0gTWF0aC5wb3coMiwgLTc3KSA6IDA7CiAgICAgICAgdmFyIGkgPSBpc0xFID8gMCA6IG5CeXRlcyAtIDE7CiAgICAgICAgdmFyIGQgPSBpc0xFID8gMSA6IC0xOwogICAgICAgIHZhciBzID0gdmFsdWUgPCAwIHx8IHZhbHVlID09PSAwICYmIDEgLyB2YWx1ZSA8IDAgPyAxIDogMDsKICAgICAgICB2YWx1ZSA9IE1hdGguYWJzKHZhbHVlKTsKICAgICAgICBpZiAoaXNOYU4odmFsdWUpIHx8IHZhbHVlID09PSBJbmZpbml0eSkgewogICAgICAgICAgbSA9IGlzTmFOKHZhbHVlKSA/IDEgOiAwOwogICAgICAgICAgZSA9IGVNYXg7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGUgPSBNYXRoLmZsb29yKE1hdGgubG9nKHZhbHVlKSAvIE1hdGguTE4yKTsKICAgICAgICAgIGlmICh2YWx1ZSAqIChjID0gTWF0aC5wb3coMiwgLWUpKSA8IDEpIHsKICAgICAgICAgICAgZS0tOwogICAgICAgICAgICBjICo9IDI7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoZSArIGVCaWFzID49IDEpIHsKICAgICAgICAgICAgdmFsdWUgKz0gcnQgLyBjOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdmFsdWUgKz0gcnQgKiBNYXRoLnBvdygyLCAxIC0gZUJpYXMpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHZhbHVlICogYyA+PSAyKSB7CiAgICAgICAgICAgIGUrKzsKICAgICAgICAgICAgYyAvPSAyOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGUgKyBlQmlhcyA+PSBlTWF4KSB7CiAgICAgICAgICAgIG0gPSAwOwogICAgICAgICAgICBlID0gZU1heDsKICAgICAgICAgIH0gZWxzZSBpZiAoZSArIGVCaWFzID49IDEpIHsKICAgICAgICAgICAgbSA9ICh2YWx1ZSAqIGMgLSAxKSAqIE1hdGgucG93KDIsIG1MZW4pOwogICAgICAgICAgICBlID0gZSArIGVCaWFzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbSA9IHZhbHVlICogTWF0aC5wb3coMiwgZUJpYXMgLSAxKSAqIE1hdGgucG93KDIsIG1MZW4pOwogICAgICAgICAgICBlID0gMDsKICAg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AgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICB9CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShCdWZmZXIxMC5wcm90b3R5cGUsICJwYXJlbnQiLCB7CiAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkgewogICAgICAgICAgaWYgKCFCdWZmZXIxMC5pc0J1ZmZlcih0aGlzKSkKICAgICAgICAgICAgcmV0dXJuIHZvaWQgMDsKICAgICAgICAgIHJldHVybiB0aGlzLmJ1ZmZlcjsKICAgICAgICB9CiAgICAgIH0pOwogICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoQnVmZmVyMTAucHJvdG90eXBlLCAib2Zmc2V0IiwgewogICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHsKICAgICAgICAgIGlmICghQnVmZmVyMTAuaXNCdWZmZXIodGhpcykpCiAgICAgICAgICAgIHJldHVybiB2b2lkIDA7CiAgICAgICAgICByZXR1cm4gdGhpcy5ieXRlT2Zmc2V0OwogICAgICAgIH0KICAgICAgfSk7CiAgICAgIGZ1bmN0aW9uIGNyZWF0ZUJ1ZmZlcihsZW5ndGgpIHsKICAgICAgICBpZiAobGVuZ3RoID4gS19NQVhfTEVOR1RIKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcignVGhlIHZhbHVlICInICsgbGVuZ3RoICsgJyIgaXMgaW52YWxpZCBmb3Igb3B0aW9uICJzaXplIicpOwogICAgICAgIH0KICAgICAgICBjb25zdCBidWYgPSBuZXcgVWludDhBcnJheShsZW5ndGgpOwogICAgICAgIE9iamVjdC5zZXRQcm90b3R5cGVPZihidWYsIEJ1ZmZlcjEwLnByb3RvdHlwZSk7CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfQogICAgICBmdW5jdGlvbiBCdWZmZXIxMChhcmcsIGVuY29kaW5nT3JPZmZzZXQsIGxlbmd0aCkgewogICAgICAgIGlmICh0eXBlb2YgYXJnID09PSAibnVtYmVyIikgewogICAgICAgICAgaWYgKHR5cGVvZiBlbmNvZGluZ09yT2Zmc2V0ID09PSAic3RyaW5nIikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdUaGUgInN0cmluZyIgYXJndW1lbnQgbXVzdCBiZSBvZiB0eXBlIHN0cmluZy4gUmVjZWl2ZWQgdHlwZSBudW1iZXInKTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBhbGxvY1Vuc2FmZShhcmcpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gZnJvbShhcmcsIGVuY29kaW5nT3JPZmZzZXQsIGxlbmd0aCk7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucG9vbFNpemUgPSA4MTkyOwogICAgICBmdW5jdGlvbiBmcm9tKHZhbHVlLCBlbmNvZGluZ09yT2Zmc2V0LCBsZW5ndGgpIHsKICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09PSAic3RyaW5nIikgewogICAgICAgICAgcmV0dXJuIGZyb21TdHJpbmcodmFsdWUsIGVuY29kaW5nT3JPZmZzZXQpOwogICAgICAgIH0KICAgICAgICBpZiAoQXJyYXlCdWZmZXIuaXNWaWV3KHZhbHVlKSkgewogICAgICAgICAgcmV0dXJuIGZyb21BcnJheVZpZXcodmFsdWUpOwogICAgICAgIH0KICAgICAgICBpZiAodmFsdWUgPT0gbnVsbCkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiVGhlIGZpcnN0IGFyZ3VtZW50IG11c3QgYmUgb25lIG9mIHR5cGUgc3RyaW5nLCBCdWZmZXIsIEFycmF5QnVmZmVyLCBBcnJheSwgb3IgQXJyYXktbGlrZSBPYmplY3QuIFJlY2VpdmVkIHR5cGUgIiArIHR5cGVvZiB2YWx1ZSk7CiAgICAgICAgfQogICAgICAgIGlmIChpc0luc3RhbmNlKHZhbHVlLCBBcnJheUJ1Zm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AgICB9OwogICAgICBmdW5jdGlvbiBmcm9tU3RyaW5nKHN0cmluZywgZW5jb2RpbmcpIHsKICAgICAgICBpZiAodHlwZW9mIGVuY29kaW5nICE9PSAic3RyaW5nIiB8fCBlbmNvZGluZyA9PT0gIiIpIHsKICAgICAgICAgIGVuY29kaW5nID0gInV0ZjgiOwogICAgICAgIH0KICAgICAgICBpZiAoIUJ1ZmZlcjEwLmlzRW5jb2RpbmcoZW5jb2RpbmcpKSB7CiAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgIH0KICAgICAgICBjb25zdCBsZW5ndGggPSBieXRlTGVuZ3RoKHN0cmluZywgZW5jb2RpbmcpIHwgMDsKICAgICAgICBsZXQgYnVmID0gY3JlYXRlQnVmZmVyKGxlbmd0aCk7CiAgICAgICAgY29uc3QgYWN0dWFsID0gYnVmLndyaXRlKHN0cmluZywgZW5jb2RpbmcpOwogICAgICAgIGlmIChhY3R1YWwgIT09IGxlbmd0aCkgewogICAgICAgICAgYnVmID0gYnVmLnNsaWNlKDAsIGFjdHVhbCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBidWY7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZnJvbUFycmF5TGlrZShhcnJheSkgewogICAgICAgIGNvbnN0IGxlbmd0aCA9IGFycmF5Lmxlbmd0aCA8IDAgPyAwIDogY2hlY2tlZChhcnJheS5sZW5ndGgpIHwgMDsKICAgICAgICBjb25zdCBidWYgPSBjcmVhdGVCdWZmZXIobGVuZ3RoKTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgaSArPSAxKSB7CiAgICAgICAgICBidWZbaV0gPSBhcnJheVtpXSAmIDI1NTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfQogICAgICBmdW5jdGlvbiBmcm9tQXJyYXlWaWV3KGFycmF5VmlldykgewogICAgICAgI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nl0ZU9mZnNldCwgbGVuZ3RoKTsKICAgICAgICB9CiAgICAgICAgT2JqZWN0LnNldFByb3RvdHlwZU9mKGJ1ZiwgQnVmZmVyMTAucHJvdG90eXBlKTsKICAgICAgICByZXR1cm4gYnVmOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZyb21PYmplY3Qob2JqKSB7CiAgICAgICAgaWYgKEJ1ZmZlcjEwLmlzQnVmZmVyKG9iaikpIHsKICAgICAgICAgIGNvbnN0IGxlbiA9IGNoZWNrZWQob2JqLmxlbmd0aCkgfCAwOwogICAgICAgICAgY29uc3QgYnVmID0gY3JlYXRlQnVmZmVyKGxlbik7CiAgICAgICAgICBpZiAoYnVmLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gYnVmOwogICAgICAgICAgfQogICAgICAgICAgb2JqLmNvcHkoYnVmLCAwLCAwLCBsZW4pOwogICAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai5sZW5ndGggIT09IHZvaWQgMCkgewogICAgICAgICAgaWYgKHR5cGVvZiBvYmoubGVuZ3RoICE9PSAibnVtYmVyIiB8fCBudW1iZXJJc05hTihvYmoubGVuZ3RoKSkgewogICAgICAgICAgICByZXR1cm4gY3JlYXRlQnVmZmVyKDApOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUxpa2Uob2JqKTsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai50eXBlID09PSAiQnVmZmVyIiAmJiBBcnJheS5pc0FycmF5KG9iai5kYXRhKSkgewogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUxpa2Uob2JqLmRhdGEpOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBjaGVja2VkKGxlbmd0aCkgewogICAgICAgIGlmIChsZW5ndGggPj0gS19NQVhfTEVOR1RIKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigiQXR0ZW1wdCB0byBhbG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ICAgICAgfQogICAgICAgIGlmIChhID09PSBiKQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgbGV0IHggPSBhLmxlbmd0aDsKICAgICAgICBsZXQgeSA9IGIubGVuZ3RoOwogICAgICAgIGZvciAobGV0IGkgPSAwLCBsZW4gPSBNYXRoLm1pbih4LCB5KTsgaSA8IGxlbjsgKytpKSB7CiAgICAgICAgICBpZiAoYVtpXSAhPT0gYltpXSkgewogICAgICAgICAgICB4ID0gYVtpXTsKICAgICAgICAgICAgeSA9IGJbaV07CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoeCA8IHkpCiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHkgPCB4KQogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgcmV0dXJuIDA7CiAgICAgIH07CiAgICAgIEJ1ZmZlcjEwLmlzRW5jb2RpbmcgPSBmdW5jdGlvbiBpc0VuY29kaW5nKGVuY29kaW5nKSB7CiAgICAgICAgc3dpdGNoIChTdHJpbmcoZW5jb2RpbmcpLnRvTG93ZXJDYXNlKCkpIHsKICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgIGNhc2UgInV0Zi04IjoKICAgICAgICAgIGNhc2UgImFzY2lpIjoKICAgICAgICAgIGNhc2UgImxhdGluMSI6CiAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgY2FzZSAidWNzLTIiOgogICAgICAgICAgY2FzZSAidXRmMTZsZSI6CiAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgfTsKICAgICAgQnVmZmVyMTAuY29uY2F0ID0gZnVuY3Rpb24gY29uY2F0KGxpc3QsIGxlbmd0aCkgewogICAgICAgIGlmICghQXJyYXkuaXNBcnJheShsaXN0KSkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignImxpc3QiIGFyZ3VtZW50IG11c3QgYmUgYW4gQXJyYXkgb2YgQnVmZmVycycpOwogICAgICAgIH0KICAgICAgICBpZiAobGlzdC5sZW5ndGggPT09IDApIHsKICAgICAgICAgIHJldHVybiBCdWZmZXIxMC5hbGxvYygwKTsKICAgICAgICB9CiAgICAgICAgbGV0IGk7CiAgICAgICAgaWYgKGxlbmd0aCA9PT0gdm9pZCAwKSB7CiAgICAgICAgICBsZW5ndGggPSAwOwogICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyArK2kpIHsKICAgICAgICAgICAgbGVuZ3RoICs9IGxpc3RbaV0ubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb25zdCBidWZmZXIgPSBCdWZmZXIxMC5hbGxvY1Vuc2FmZShsZW5ndGgpOwogICAgICAgIGxldCBwb3MgPSAwOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgKytpKSB7CiAgICAgICAgICBsZXQgYnVmID0gbGlzdFtpXTsKICAgICAgICAgIGlmIChpc0luc3RhbmNlKGJ1ZiwgVWludDhBcnJheSkpIHsKICAgICAgICAgICAgaWYgKHBvcyArIGJ1Zi5sZW5ndGggPiBidWZmZXIubGVuZ3RoKSB7CiAgICAgICAgICAgICAgaWYgKCFCdWZmZXIxMC5pc0J1ZmZlcihidWYpKQogICAgICAgICAgICAgICAgYnVmID0gQnVmZmVyMTAuZnJvbShidWYpOwogICAgICAgICAgICAgIGJ1Zi5jb3B5KGJ1ZmZlciwgcG9zKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBVaW50OEFycmF5LnByb3RvdHlwZS5zZXQuY2FsbChidWZmZXIsIGJ1ZiwgcG9zKTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIGlmICghQnVmZmVyMTAuaXNCdWZmZXIoYnVmKSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCcibGlzdCIgYXJndW1lbnQgbXVzdCBiZSBhbiBBcnJheSBvZiBCdWZmZXJzJyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBidWYuY29weShidWZmZXIsIHBvcyk7CiAgICAgICAgICB9CiAgICAgICAgICBwb3MgKz0gYnVmLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZmZlcjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gYnl0ZUxlbmd0aChzdHJpbmcsIGVuY29kaW5nKSB7CiAgICAgICAgaWYgKEJ1ZmZlcjEwLmlzQnVmZmVyKHN0cmluZykpIHsKICAgICAgICAgIHJldHVybiBzdHJpbmcubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoQXJyYXlCdWZmZXIuaXNWaWV3KHN0cmluZykgfHwgaXNJbnN0YW5jZShzdHJpbmcsIEFycmF5QnVmZmVyKSkgewogICAgICAgICAgcmV0dXJuIHN0cmluZy5ieXRlTGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAodHlwZW9mIHN0cmluZyAhPT0gInN0cmluZyIpIHsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1RoZSAic3RyaW5nIiBhcmd1bWVudCBtdXN0IGJlIG9uZSBvZiB0eXBlIHN0cmluZywgQnVmZmVyLCBvciBBcnJheUJ1ZmZlci4gUmVjZWl2ZWQgdHlwZSAnICsgdHlwZW9mIHN0cmluZyk7CiAgICAgICAgfQogICAgICAgIGNvbnN0IGxlbiA9IHN0cmluZy5sZW5ndGg7CiAgICAgICAgY29uc3QgbXVzdE1hdGNoID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgYXJndW1lbnRzWzJdID09PSB0cnVlOwogICAgICAgIGlmICghbXVzdE1hdGNoICYmIGxlbiA9PT0gMCkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIGxldCBsb3dlcmVkQ2FzZSA9IGZhbHNlOwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgc3dpdGNoIChlbmNvZGluZykgewogICAgICAgICAgICBjYXNlICJhc2NpaSI6CiAgICAgICAgICAgIGNhc2UgImxhdGluMSI6CiAgICAgICAgICAgIGNhc2UgImJpbmFyeSI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbjsKICAgICAgICAgICAgY2FzZSAidXRmOCI6CiAgICAgICAgICAgIGNhc2UgInV0Zi04IjoKICAgICAgICAgICAgICByZXR1cm4gdXRmOFRvQnl0ZXMoc3RyaW5nKS5sZW5ndGg7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbiAqIDI7CiAgICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbiA+Pj4gMTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0VG9CeXRlcyhzdHJpbmcpLmxlbmd0aDsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpIHsKICAgICAgICAgICAgICAgIHJldHVybiBtdXN0TWF0Y2ggPyAtMSA6IHV0ZjhUb0J5dGVzKHN0cmluZykubGVuZ3RoOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBlbmNvZGluZyA9ICgiIiArIGVuY29kaW5nKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgIGxvd2VyZWRDYXNlID0gdHJ1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgQnVmZmVyMTAuYnl0ZUxlbmd0aCA9IGJ5dGVMZW5ndGg7CiAgICAgIGZ1bmN0aW9uIHNsb3dUb1N0cmluZyhlbmNvZGluZywgc3RhcnQsIGVuZCkgewogICAgICAgIGxldCBsb3dlcmVkQ2FzZSA9IGZhbHNlOwogICAgICAgIGlmIChzdGFydCA9PT0gdm9pZCAwIHx8IHN0YXJ0IDwgMCkgewogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPiB0aGlzLmxlbmd0aCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kID09PSB2b2lkIDAgfHwgZW5kID4gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kIDw9IDApIHsKICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICB9CiAgICAgICAgZW5kID4+Pj0gMDsKICAgICAgICBzdGFydCA+Pj49IDA7CiAgICAgICAgaWYgKGVuZCA8PSBzdGFydCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoIWVuY29kaW5nKQogICAgICAgICAgZW5jb2RpbmcgPSAidXRmOCI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gaGV4U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICAgIHJldHVybiBhc2NpaVNsaWNlKHRoaXMsIHN0YXJ0LCBlbmQpOwogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBsYXRpbjFTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjE2bGVTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgICAgIGVuY29kaW5nID0gKGVuY29kaW5nICsgIiIpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgbG93ZXJlZENhc2UgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBCdWZmZXIxMC5wcm90b3R5cGUuX2lzQnVmZmVyID0gdHJ1ZTsKICAgICAgZnVuY3Rpb24gc3dhcChiLCBuLCBtKSB7CiAgICAgICAgY29uc3QgaSA9IGJbbl07CiAgICAgICAgYltuXSA9IGJbbV07CiAgICAgICAgYlttXSA9IGk7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXAxNiA9IGZ1bmN0aW9uIHN3YXAxNigpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgMiAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiAxNi1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDIpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDEpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXAzMiA9IGZ1bmN0aW9uIHN3YXAzMigpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgNCAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiAzMi1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDQpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDMpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMSwgaSArIDIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXA2NCA9IGZ1bmN0aW9uIHN3YXA2NCgpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgOCAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiA2NC1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDgpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDcpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMSwgaSArIDYpOwogICA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bmd0aCA6IDA7CiAgICAgICAgfQogICAgICAgIGlmICh0aGlzU3RhcnQgPT09IHZvaWQgMCkgewogICAgICAgICAgdGhpc1N0YXJ0ID0gMDsKICAgICAgICB9CiAgICAgICAgaWYgKHRoaXNFbmQgPT09IHZvaWQgMCkgewogICAgICAgICAgdGhpc0VuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPCAwIHx8IGVuZCA+IHRhcmdldC5sZW5ndGggfHwgdGhpc1N0YXJ0IDwgMCB8fCB0aGlzRW5kID4gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJvdXQgb2YgcmFuZ2UgaW5kZXgiKTsKICAgICAgICB9CiAgICAgICAgaWYgKHRoaXNTdGFydCA+PSB0aGlzRW5kICYmIHN0YXJ0ID49IGVuZCkgewogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgICAgIGlmICh0aGlzU3RhcnQgPj0gdGhpc0VuZCkgewogICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPj0gZW5kKSB7CiAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgc3RhcnQgPj4+PSAwOwogICAgICAgIGVuZCA+Pj49IDA7CiAgICAgICAgdGhpc1N0YXJ0ID4+Pj0gMDsKICAgICAgICB0aGlzRW5kID4+Pj0gMDsKICAgICAgICBpZiAodGhpcyA9PT0gdGFyZ2V0KQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgbGV0IHggPSB0aGlzRW5kIC0gdGhpc1N0YXJ0OwogICAgICAgIGxldCB5ID0gZW5kIC0gc3RhcnQ7CiAgICAgICAgY29uc3QgbGVuID0gTWF0aC5taW4oeCwgeSk7CiAgICAgICAgY29uc3QgdGhpc0NvcHkgPSB0aGlzLnNsaWNlKHRoaXNTdGFydCwgdGhpc0VuZCk7CiAgICAgICAgY29uc3QgdGF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lyID8gMCA6IGJ1ZmZlci5sZW5ndGggLSAxOwogICAgICAgIH0KICAgICAgICBpZiAoYnl0ZU9mZnNldCA8IDApCiAgICAgICAgICBieXRlT2Zmc2V0ID0gYnVmZmVyLmxlbmd0aCArIGJ5dGVPZmZzZXQ7CiAgICAgICAgaWYgKGJ5dGVPZmZzZXQgPj0gYnVmZmVyLmxlbmd0aCkgewogICAgICAgICAgaWYgKGRpcikKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgZWxzZQogICAgICAgICAgICBieXRlT2Zmc2V0ID0gYnVmZmVyLmxlbmd0aCAtIDE7CiAgICAgICAgfSBlbHNlIGlmIChieXRlT2Zmc2V0IDwgMCkgewogICAgICAgICAgaWYgKGRpcikKICAgICAgICAgICAgYnl0ZU9mZnNldCA9IDA7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICB2YWwgPSBCdWZmZXIxMC5mcm9tKHZhbCwgZW5jb2RpbmcpOwogICAgICAgIH0KICAgICAgICBpZiAoQnVmZmVyMTAuaXNCdWZmZXIodmFsKSkgewogICAgICAgICAgaWYgKHZhbC5sZW5ndGggPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGFycmF5SW5kZXhPZihidWZmZXIsIHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcik7CiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgdmFsID0gdmFsICYgMjU1OwogICAgICAgICAgaWYgKHR5cGVvZiBVaW50OEFycmF5LnByb3RvdHlwZS5pbmRleE9mID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIGlmIChkaXIpIHsKICAgICAgICAgICAgICByZXR1cm4gVWludDhBcnJheS5wcm90b3R5cGUuaW5kZXhPZi5jYWxsKGJ1ZmZlciwgdmFsLCBieXRlT2Zmc2V0KTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICByZXR1cm4gVWludDhBcnJheS5wcm90b3R5cGUubGFzdEluZGV4T2YuY2FsbChidWZmZXIsIHZhbCwgYnl0ZU9mZnNldCk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBhcnJheUluZGV4T2YoYnVmZmVyLCBbdmFsXSwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcik7CiAgICAgICAgfQogICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoInZhbCBtdXN0IGJlIHN0cmluZywgbnVtYmVyIG9yIEJ1ZmZlciIpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGFycmF5SW5kZXhPZihhcnIsIHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcikgewogICAgICAgIGxldCBpbmRleFNpemUgPSAxOwogICAgICAgIGxldCBhcnJMZW5ndGggPSBhcnIubGVuZ3RoOwogICAgICAgIGxldCB2YWxMZW5ndGggPSB2YWwubGVuZ3RoOwogICAgICAgIGlmIChlbmNvZGluZyAhPT0gdm9pZCAwKSB7CiAgICAgICAgICBlbmNvZGluZyA9IFN0cmluZyhlbmNvZGluZykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgIGlmIChlbmNvZGluZyA9PT0gInVjczIiIHx8IGVuY29kaW5nID09PSAidWNzLTIiIHx8IGVuY29kaW5nID09PSAidXRmMTZsZSIgfHwgZW5jb2RpbmcgPT09ICJ1dGYtMTZsZSIpIHsKICAgICAgICAgICAgaWYgKGFyci5sZW5ndGggPCAyIHx8IHZhbC5sZW5ndGggPCAyKSB7CiAgICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGluZGV4U2l6ZSA9IDI7CiAgICAgICAgICAgIGFyckxlbmd0aCAvPSAyOwogICAgICAgICAgICB2YWxMZW5ndGggLz0gMjsKICAgICAgICAgICAgYnl0ZU9mZnNldCAvPSAyOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiByZWFkKGJ1ZiwgaTIpIHsKICAgICAgICAgIGlmIChpbmRleFNpemUgPT09IDEpIHsKICAgICAgICAgICAgcmV0dXJuIGJ1ZltpMl07CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gYnVmLnJlYWRVSW50MTZCRShpMiAqIGluZGV4U2l6ZSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGxldCBpOwogICAgICAgIGlmIChkaXIpIHsKICAgICAgICAgIGxldCBmb3VuZEluZGV4ID0gLTE7CiAgICAgICAgICBmb3IgKGkgPSBieXRlT2Zmc2V0OyBpIDwgYXJyTGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgaWYgKHJlYWQoYXJyLCBpKSA9PT0gcmVhZCh2YWwsIGZvdW5kSW5kZXggPT09IC0xID8gMCA6IGkgLSBmb3VuZEluZGV4KSkgewogICAgICAgICAgICAgIGlmIChmb3VuZEluZGV4ID09PSAtMSkKICAgICAgICAgICAgICAgIGZvdW5kSW5kZXggPSBpOwogICAgICAgICAgICAgIGlmIChpIC0gZm91bmRJbmRleCArIDEgPT09IHZhbExlbmd0aCkKICAgICAgICAgICAgICAgIHJldHVybiBmb3VuZEluZGV4ICogaW5kZXhTaXplOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGlmIChmb3VuZEluZGV4ICE9PSAtMSkKICAgICAgICAgICAgICAgIGkgLT0gaSAtIGZvdW5kSW5kZXg7CiAgICAgICAgICAgICAgZm91bmRJbmRleCA9IC0xOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGlmIChieXRlT2Zmc2V0ICsgdmFsTGVuZ3RoID4gYXJyTGVuZ3RoKQogICAgICAgICAgICBieXRlT2Zmc2V0ID0gYXJyTGVuZ3RoIC0gdmFsTGVuZ3RoOwogICAgICAgICAgZm9yIChpID0gYnl0ZU9mZnNldDsgaSA+PSAwOyBpLS0pIHsKICAgICAgICAgICAgbGV0IGZvdW5kID0gdHJ1ZTsKICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCB2YWxMZW5ndGg7IGorKykgewogICAgICAgICAgICAgIGlmIChyZWFkKGFyciwgaSArIGopICE9PSByZWFkKHZhbCwgaikpIHsKICAgICAgICAgICAgICAgIGZvdW5kID0gZmFsc2U7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGZvdW5kKQogICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gLTE7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLmluY2x1ZGVzID0gZnVuY3Rpb24gaW5jbHVkZXModmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiB0aGlzLmluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgIT09IC0xOwogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUuaW5kZXhPZiA9IGZ1bmN0aW9uIGluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBiaWRpcmVjdGlvbmFsSW5kZXhPZih0aGlzLCB2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nLCB0cnVlKTsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLmxhc3RJbmRleE9mID0gZnVuY3Rpb24gbGFzdEluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBiaWRpcmVjdGlvbmFsSW5kZXhPZih0aGlzLCB2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nLCBmYWxzZSk7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGhleFdyaXRlKGJ1Ziwgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCkgewogICAgICAgIG9mZnNldCA9IE51bWJlcihvZmZzZXQpIHx8IDA7CiAgICAgICAgY29uc3QgcmVtYWluaW5nID0gYnVmLmxlbmd0aCAtIG9mZnNldDsKICAgICAgICBpZiAoIWxlbmd0aCkgewogICAgICAgICAgbGVuZ3RoID0gcmVtYWluaW5nOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBsZW5ndGggPSBOdW1iZXIobGVuZ3RoKTsKICAgICAgICAgIGlmIChsZW5ndGggPiByZW1haW5pbmcpIHsKICAgICAgICAgICAgbGVuZ3RoID0gcmVtYWluaW5nOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb25zdCBzdHJMZW4gPSBzdHJpbmcubGVuZ3RoOwogICAgICAgIGlmIChsZW5ndGggPiBzdHJMZW4gLyAyKSB7CiAgICAgICAgICBsZW5ndGggPSBzdHJMZW4gLyAyOwogICAgICAgIH0KICAgICAgICBsZXQgaTsKICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGNvbnN0IHBhcnNlZCA9IHBhcnNlSW50KHN0cmluZy5zdWJzdHIoaSAqIDIsIDIpLCAxNik7CiAgICAgICAgICBpZiAobnVtYmVySXNOYU4ocGFyc2VkKSkKICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICBidWZbb2Zmc2V0ICsgaV0gPSBwYXJzZWQ7CiAgICAgICAgfQogICAgICAgIHJldHVybiBpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHV0ZjhXcml0ZShidWYsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpIHsKICAgICAgICByZXR1cm4gYmxpdEJ1ZmZlcih1dGY4VG9CeXRlcyhzdHJpbmcsIGJ1Zi5sZW5ndGggLSBvZmZzZXQpLCBidWYsIG9mZn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ZShvZmZzZXQpKSB7CiAgICAgICAgICBvZmZzZXQgPSBvZmZzZXQgPj4+IDA7CiAgICAgICAgICBpZiAoaXNGaW5pdGUobGVuZ3RoKSkgewogICAgICAgICAgICBsZW5ndGggPSBsZW5ndGggPj4+IDA7CiAgICAgICAgICAgIGlmIChlbmNvZGluZyA9PT0gdm9pZCAwKQogICAgICAgICAgICAgIGVuY29kaW5nID0gInV0ZjgiOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgZW5jb2RpbmcgPSBsZW5ndGg7CiAgICAgICAgICAgIGxlbmd0aCA9IHZvaWQgMDsKICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIud3JpdGUoc3RyaW5nLCBlbmNvZGluZywgb2Zmc2V0WywgbGVuZ3RoXSkgaXMgbm8gbG9uZ2VyIHN1cHBvcnRlZCIpOwogICAgICAgIH0KICAgICAgICBjb25zdCByZW1haW5pbmcgPSB0aGlzLmxlbmd0aCAtIG9mZnNldDsKICAgICAgICBpZiAobGVuZ3RoID09PSB2b2lkIDAgfHwgbGVuZ3RoID4gcmVtYWluaW5nKQogICAgICAgICAgbGVuZ3RoID0gcmVtYWluaW5nOwogICAgICAgIGlmIChzdHJpbmcubGVuZ3RoID4gMCAmJiAobGVuZ3RoIDwgMCB8fCBvZmZzZXQgPCAwKSB8fCBvZmZzZXQgPiB0aGlzLmxlbmd0aCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkF0dGVtcHQgdG8gd3JpdGUgb3V0c2lkZSBidWZmZXIgYm91bmRzIik7CiAgICAgICAgfQogICAgICAgIGlmICghZW5jb2RpbmcpCiAgICAgICAgICBlbmNvZGluZyA9ICJ1dGY4IjsKICAgICAgICBsZXQgbG93ZXJlZENhc2UgPSBmYWxzZTsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gaGV4V3JpdGUodGhpcywgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCk7CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBhc2NpaVdyaXRlKHRoaXMsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpOwogICAgICAgICAgICBjYXNlICJiYXNlNjQiOgogICAgICAgICAgICAgIHJldHVybiBiYXNlNjRXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgY2FzZSAidWNzMiI6CiAgICAgICAgICAgIGNhc2UgInVjcy0yIjoKICAgICAgICAgICAgY2FzZSAidXRmMTZsZSI6CiAgICAgICAgICAgIGNhc2UgInV0Zi0xNmxlIjoKICAgICAgICAgICAgICByZXR1cm4gdWNzMldyaXRlKHRoaXMsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgIGlmIChsb3dlcmVkQ2FzZSkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoIlVua25vd24gZW5jb2Rpbmc6ICIgKyBlbmNvZGluZyk7CiAgICAgICAgICAgICAgZW5jb2RpbmcgPSAoIiIgKyBlbmNvZGluZykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICBsb3dlcmVkQ2FzZSA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cG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pbnQ7CiAgICAgICAgICAgIHN3aXRjaCAoYnl0ZXNQZXJTZXF1ZW5jZSkgewogICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgIGlmIChmaXJzdEJ5dGUgPCAxMjgpIHsKICAgICAgICAgICAgICAgICAgY29kZVBvaW50ID0gZmlyc3RCeXRlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgc2Vjb25kQnl0ZSA9IGJ1ZltpICsgMV07CiAgICAgICAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAzMSkgPDwgNiB8IHNlY29uZEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAxMjcpIHsKICAgICAgICAgICAgICAgICAgICBjb2RlUG9pbnQgPSB0ZW1wQ29kZVBvaW50OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICBzZWNvbmRCeXRlID0gYnVmW2kgKyAxXTsKICAgICAgICAgICAgICAgIHRoaXJkQnl0ZSA9IGJ1ZltpICsgMl07CiAgICAgICAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAxOTIpID09PSAxMjggJiYgKHRoaXJkQnl0ZSAmIDE5MikgPT09IDEyOCkgewogICAgICAgICAgICAgICAgICB0ZW1wQ29kZVBvaW50ID0gKGZpcnN0Qnl0ZSAmIDE1KSA8PCAxMiB8IChzZWNvbmRCeXRlICYgNjMpIDw8IDYgfCB0aGlyZEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAyMDQ3ICYmICh0ZW1wQ29kZVBvaW50IDwgNTUyOTYgfHwgdGVtcENvZGVQb2ludCA+IDU3MzQzKSkgewogICAgICAgICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgIHNlY29uZEJ5dGUgPSBidWZbaSArIDFdOwogICAgICAgICAgICAgICAgdGhpcmRCeXRlID0gYnVmW2kgKyAyXTsKICAgICAgICAgICAgICAgIGZvdXJ0aEJ5dGUgPSBidWZbaSArIDNdOwogICAgICAgICAgICAgICAgaWYgKChzZWNvbmRCeXRlICYgMTkyKSA9PT0gMTI4ICYmICh0aGlyZEJ5dGUgJiAxOTIpID09PSAxMjggJiYgKGZvdXJ0aEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAxNSkgPDwgMTggfCAoc2Vjb25kQnl0ZSAmIDYzKSA8PCAxMiB8ICh0aGlyZEJ5dGUgJiA2MykgPDwgNiB8IGZvdXJ0aEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiA2NTUzNSAmJiB0ZW1wQ29kZVBvaW50IDwgMTExNDExMikgewogICAgICAgICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKGNvZGVQb2ludCA9PT0gbnVsbCkgewogICAgICAgICAgICBjb2RlUG9pbnQgPSA2NTUzMzsKICAgICAgICAgICAgYnl0ZXNQZXJTZXF1ZW5jZSA9IDE7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA+IDY1NTM1KSB7CiAgICAgICAgICAgIGNvZGVQb2ludCAtPSA2NTUzNjsKICAgICAgICAgICAgcmVzLnB1c2goY29kZVBvaW50ID4+PiAxMCAmIDEwMjMgfCA1NTI5Nik7CiAgICAgICAgICAgIGNvZGVQb2ludCA9IDU2MzIwIHwgY29kZVBvaW50ICYgMTAyMzsKICAgICAgICAgIH0KICAgICAgICAgIHJlcy5wdXNoKGNvZGVQb2ludCk7CiAgICAgICAgICBpICs9IGJ5dGVzUGVyU2VxdWVuY2U7CiAgICAgICAgfQogICAgICAgIHJldHVybiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkocmVzKTsKICAgICAgfQogICAgICB2YXIgTUFYX0FSR1VNRU5UU19MRU5HVEggPSA0MDk2OwogICAgICBmdW5jdGlvbiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkoY29kZVBvaW50cykgewogICAgICAgIGNvbnN0IGxlbiA9IGNvZGVQb2ludHMubGVuZ3RoOwogICAgICAgIGlmIChsZW4gPD0gTUFYX0FSR1VNRU5UU19MRU5HVEgpIHsKICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cyk7CiAgICAgICAgfQogICAgICAgIGxldCByZXMgPSAiIjsKICAgICAgICBsZXQgaSA9IDA7CiAgICAgICAgd2hpbGUgKGkgPCBsZW4pIHsKICAgICAgICAgIHJlcyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cy5zbGljZShpLCBpICs9IE1BWF9BUkdVTUVOVFNfTEVOR1RIKSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYXNjaWlTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldICYgMTI3KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBsYXRpbjFTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBoZXhTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBjb25zdCBsZW4gPSBidWYubGVuZ3RoOwogICAgICAgIGlmICghc3RhcnQgfHwgc3RhcnQgPCAwKQogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIGlmICghZW5kIHx8IGVuZCA8IDAgfHwgZW5kID4gbGVuKQogICAgICAgICAgZW5kID0gbGVuOwogICAgICAgIGxldCBvdXQgPSAiIjsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgb3V0ICs9IGhleFNsaWNlTG9va3VwVGFibGVbYnVmW2ldXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG91dDsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNmxlU2xpY2UoYnVmLCBzdGFydCwgZW5kKSB7CiAgICAgICAgY29uc3QgYnl0ZXMgPSBidWYuc2xpY2Uoc3RhcnQsIGVuZCk7CiAgICAgICAgbGV0IHJlcyA9ICIiOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYnl0ZXMubGVuZ3RoIC0gMTsgaSArPSAyKSB7CiAgICAgICAgICByZXMgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShieXRlc1tpXSArIGJ5dGVzW2kgKyAxXSAqIDI1Nik7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnNsaWNlID0gZnVuY3Rpb24gc2xpY2Uoc3RhcnQsIGVuZCkgewogICAgICAgIGNvbnN0IGxlbiA9IHRoaXMubGVuZ3RoOwogICAgICAgIHN0YXJ0ID0gfn5zdGFydDsKICAgICAgICBlbmQgPSBlbmQgPT09IHZvaWQgMCA/IGxlbiA6IH5+ZW5kOwogICAgICAgIGlmIChzdGFydCA8IDApIHsKICAgICAgICAgIHN0YXJ0ICs9IGxlbjsKICAgICAgICAgIGlmIChzdGFydCA8IDApCiAgICAgICAgICAgIHN0YXJ0ID0gMDsKICAgICAgICB9IGVsc2UgaWYgKHN0YXJ0ID4gbGVuKSB7CiAgICAgICAgICBzdGFydCA9IGxlbjsKICAgICAgICB9CiAgICAgICAgaWYgKGVuZCA8IDApIHsKICAgICAgICAgIGVuZCArPSBsZW47CiAgICAgICAgICBpZiAoZW5kIDwgMCkKICAgICAgICAgICAgZW5kID0gMDsKICAgICAgICB9IGVsc2UgaWYgKGVuZCA+IGxlbikgewogICAgICAgICAgZW5kID0gbGVuOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kIDwgc3RhcnQpCiAgICAgICAgICBlbmQgPSBzdGFydDsKICAgICAgICBjb25zdCBuZXdCdWYgPSB0aGlzLnN1YmFycmF5KHN0YXJ0LCBlbmQpOwogICAgICAgIE9iamVjdC5zZXRQcm90b3R5cGVPZihuZXdCdWYsIEJ1ZmZlcjEwLnByb3RvdHlwZSk7CiAgICAgICAgcmV0dXJuIG5ld0J1ZjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gY2hlY2tPZmZzZXQob2Zmc2V0LCBleHQsIGxlbmd0aCkgewogICAgICAgIGlm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cy5sZW5ndGgpOwogICAgICAgIGxldCB2YWwgPSB0aGlzW29mZnNldF07CiAgICAgICAgbGV0IG11bCA9IDE7CiAgICAgICAgbGV0IGkgPSAwOwogICAgICAgIHdoaWxlICgrK2kgPCBieXRlTGVuZ3RoMiAmJiAobXVsICo9IDI1NikpIHsKICAgICAgICAgIHZhbCArPSB0aGlzW29mZnNldCArIGldICogbXVsOwogICAgICAgIH0KICAgICAgICBtdWwgKj0gMTI4OwogICAgICAgIGlmICh2YWwgPj0gbXVsKQogICAgICAgICAgdmFsIC09IE1hdGgucG93KDIsIDggKiBieXRlTGVuZ3RoMik7CiAgICAgICAgcmV0dXJuIHZhbDsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnJlYWRJbnRCRSA9IGZ1bmN0aW9uIHJlYWRJbnRCRShvZmZzZXQsIGJ5dGVMZW5ndGgyLCBub0Fzc2VydCkgewogICAgICAgIG9mZnNldCA9IG9mZnNldCA+Pj4gMDsKICAgICAgICBieXRlTGVuZ3RoMiA9IGJ5dGVMZW5ndGgyID4+PiAwOwogICAgICAgIGlmICghbm9Bc3NlcnQpCiAgICAgICAgICBjaGVja09mZnNldChvZmZzZXQsIGJ5dGVMZW5ndGgyLCB0aGlzLmxlbmd0aCk7CiAgICAgICAgbGV0IGkgPSBieXRlTGVuZ3RoMjsKICAgICAgICBsZXQgbXVsID0gMTsKICAgICAgICBsZXQgdmFsID0gdGhpc1tvZmZzZXQgKyAtLWldOwogICAgICAgIHdoaWxlIChpID4gMCAmJiAobXVsICo9IDI1NikpIHsKICAgICAgICAgIHZhbCArPSB0aGlzW29mZnNldCArIC0taV0gKiBtdWw7CiAgICAgICAgfQogICAgICAgIG11bCAqPSAxMjg7CiAgICAgICAgaWYgKHZhbCA+PSBtdWwpCiAgICAgICAgICB2YWwgLT0gTWF0aC5wb3coMiwgOCAqIGJ5dGVMZW5ndGgyKTsKICAgICAgICByZXR1cm4gdmFsOwogICAgICB9OwogICAgICBCdWZmZX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1iZXIodmFsdWUgJiBCaWdJbnQoNDI5NDk2NzI5NSkpOwogICAgICAgIGJ1ZltvZmZzZXQrK10gPSBsbzsKICAgICAgICBsbyA9IGxvID4+IDg7CiAgICAgICAgYnVmW29mZnNldCsrXSA9IGxvOwogICAgICAgIGxvID0gbG8gPj4gODsKICAgICAgICBidWZbb2Zmc2V0KytdID0gbG87CiAgICAgICAgbG8gPSBsbyA+PiA4OwogICAgICAgIGJ1ZltvZmZzZXQrK10gPSBsbzsKICAgICAgICBsZXQgaGkgPSBOdW1iZXIodmFsdWUgPj4gQmlnSW50KDMyKSAmIEJpZ0ludCg0Mjk0OTY3Mjk1KSk7CiAgICAgICAgYnVmW29mZnNldCsrXSA9IGhpOwogICAgICAgIGhpID0gaGkgPj4gODsKICAgICAgICBidWZbb2Zmc2V0KytdID0gaGk7CiAgICAgICAgaGkgPSBoaSA+PiA4OwogICAgICAgIGJ1ZltvZmZzZXQrK10gPSBoaTsKICAgICAgICBoaSA9IGhpID4+IDg7CiAgICAgICAgYnVmW29mZnNldCsrXSA9IGhpOwogICAgICAgIHJldHVybiBvZmZzZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gd3J0QmlnVUludDY0QkUoYnVmLCB2YWx1ZSwgb2Zmc2V0LCBtaW4sIG1heCkgewogICAgICAgIGNoZWNrSW50QkkodmFsdWUsIG1pbiwgbWF4LCBidWYsIG9mZnNldCwgNyk7CiAgICAgICAgbGV0IGxvID0gTnVtYmVyKHZhbHVlICYgQmlnSW50KDQyOTQ5NjcyOTUpKTsKICAgICAgICBidWZbb2Zmc2V0ICsgN10gPSBsbzsKICAgICAgICBsbyA9IGxvID4+IDg7CiAgICAgICAgYnVmW29mZnNldCArIDZdID0gbG87CiAgICAgICAgbG8gPSBsbyA+PiA4OwogICAgICAgIGJ1ZltvZmZzZXQgKyA1XSA9IGxvOwogICAgICAgIGxvID0gbG8gPj4gODsKICAgICAgICBidWZbb2Zmc2V0ICsgNF0gPSBsbzsKICAgICAgIC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nN1YmFycmF5KHN0YXJ0LCBlbmQpLCB0YXJnZXRTdGFydCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBsZW47CiAgICAgIH07CiAgICAgIEJ1ZmZlcjEwLnByb3RvdHlwZS5maWxsID0gZnVuY3Rpb24gZmlsbCh2YWwsIHN0YXJ0LCBlbmQsIGVuY29kaW5nKSB7CiAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICBpZiAodHlwZW9mIHN0YXJ0ID09PSAic3RyaW5nIikgewogICAgICAgICAgICBlbmNvZGluZyA9IHN0YXJ0OwogICAgICAgICAgICBzdGFydCA9IDA7CiAgICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgZW5kID09PSAic3RyaW5nIikgewogICAgICAgICAgICBlbmNvZGluZyA9IGVuZDsKICAgICAgICAgICAgZW5kID0gdGhpcy5sZW5ndGg7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoZW5jb2RpbmcgIT09IHZvaWQgMCAmJiB0eXBlb2YgZW5jb2RpbmcgIT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoImVuY29kaW5nIG11c3QgYmUgYSBzdHJpbmciKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0eXBlb2YgZW5jb2RpbmcgPT09ICJzdHJpbmciICYmICFCdWZmZXIxMC5pc0VuY29kaW5nKGVuY29kaW5nKSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHZhbC5sZW5ndGggPT09IDEpIHsKICAgICAgICAgICAgY29uc3QgY29kZSA9IHZhbC5jaGFyQ29kZUF0KDApOwogICAgICAgICAgICBpZiAoZW5jb2RpbmcgPT09ICJ1dGY4IiAmJiBjb2RlIDwgMTI4IHx8IGVuY29kaW5nID09PSAibGF0aW4xIikgewogICAgICAgICAgICAgIHZhbCA9IGNvZGU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiB2YWwgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICB2YWwgPSB2YWwgJiAyNTU7CiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsID09PSAiYm9vbGVhbiIpIHsKICAgICAgICAgIHZhbCA9IE51bWJlcih2YWwpOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPCAwIHx8IHRoaXMubGVuZ3RoIDwgc3RhcnQgfHwgdGhpcy5sZW5ndGggPCBlbmQpIHsKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJPdXQgb2YgcmFuZ2UgaW5kZXgiKTsKICAgICAgICB9CiAgICAgICAgaWYgKGVuZCA8PSBzdGFydCkgewogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgfQogICAgICAgIHN0YXJ0ID0gc3RhcnQgPj4+IDA7CiAgICAgICAgZW5kID0gZW5kID09PSB2b2lkIDAgPyB0aGlzLmxlbmd0aCA6IGVuZCA+Pj4gMDsKICAgICAgICBpZiAoIXZhbCkKICAgICAgICAgIHZhbCA9IDA7CiAgICAgICAgbGV0IGk7CiAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICBmb3IgKGkgPSBzdGFydDsgaSA8IGVuZDsgKytpKSB7CiAgICAgICAgICAgIHRoaXNbaV0gPSB2YWw7CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGNvbnN0IGJ5dGVzID0gQnVmZmVyMTAuaXNCdWZmZXIodmFsKSA/IHZhbCA6IEJ1ZmZlcjEwLmZyb20odmFsLCBlbmNvZGluZyk7CiAgICAgICAgICBjb25zdCBsZW4gPSBieXRlcy5sZW5ndGg7CiAgICAgICAgICBpZiAobGVuID09PSAwKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1RoZSB2YWx1ZSAiJyArIHZhbCArICciIGlzIGludmFsaWQgZm9yIGFyZ3VtZW50ICJ2YWx1ZSInKTsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBlbmQgLSBzdGFydDsgKytpKSB7CiAgICAgICAgICAgIHRoaXNbaSArIHN0YXJ0XSA9IGJ5dGVzW2kgJSBsZW5dOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgdmFyIGVycm9ycyA9IHt9OwogICAgICBmdW5jdGlvbiBFKHN5bSwgZ2V0TWVzc2FnZSwgQmFzZSkgewogICAgICAgIGVycm9yc1tzeW1dID0gY2xhc3MgTm9kZUVycm9yIGV4dGVuZHMgQmFzZSB7CiAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgc3VwZXIoKTsKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJtZXNzYWdlIiwgewogICAgICAgICAgICAgIHZhbHVlOiBnZXRNZXNzYWdlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyksCiAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB0aGlzLm5hbWUgPSBgJHt0aGlzLm5hbWV9IFske3N5bX1dYDsKICAgICAgICAgICAgdGhpcy5zdGFjazsKICAgICAgICAgICAgZGVsZXRlIHRoaXMubmFtZTsKICAgICAgICAgIH0KICAgICAgICAgIGdldCBjb2RlKCkgewogICAgICAgICAgICByZXR1cm4gc3ltOwogICAgICAgICAgfQogICAgICAgICAgc2V0IGNvZGUodmFsdWUpIHsKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJjb2RlIiwgewogIC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tYmVyKG9mZnNldCwgIm9mZnNldCIpOwogICAgICAgIGlmIChidWZbb2Zmc2V0XSA9PT0gdm9pZCAwIHx8IGJ1ZltvZmZzZXQgKyBieXRlTGVuZ3RoMl0gPT09IHZvaWQgMCkgewogICAgICAgICAgYm91bmRzRXJyb3Iob2Zmc2V0LCBidWYubGVuZ3RoIC0gKGJ5dGVMZW5ndGgyICsgMSkpOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBjaGVja0ludEJJKHZhbHVlLCBtaW4sIG1heCwgYnVmLCBvZmZzZXQsIGJ5dGVMZW5ndGgyKSB7CiAgICAgICAgaWYgKHZhbHVlID4gbWF4IHx8IHZhbHVlIDwgbWluKSB7CiAgICAgICAgICBjb25zdCBuID0gdHlwZW9mIG1pbiA9PT0gImJpZ2ludCIgPyAibiIgOiAiIjsKICAgICAgICAgIGxldCByYW5nZTsKICAgICAgICAgIGlmIChieXRlTGVuZ3RoMiA+IDMpIHsKICAgICAgICAgICAgaWYgKG1pbiA9PT0gMCB8fCBtaW4gPT09IEJpZ0ludCgwKSkgewogICAgICAgICAgICAgIHJhbmdlID0gYD49IDAke259IGFuZCA8IDIke259ICoqICR7KGJ5dGVMZW5ndGgyICsgMSkgKiA4fSR7bn1gOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHJhbmdlID0gYD49IC0oMiR7bn0gKiogJHsoYnl0ZUxlbmd0aDIgKyAxKSAqIDggLSAxfSR7bn0pIGFuZCA8IDIgKiogJHsoYnl0ZUxlbmd0aDIgKyAxKSAqIDggLSAxfSR7bn1gOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByYW5nZSA9IGA+PSAke21pbn0ke259IGFuZCA8PSAke21heH0ke259YDsKICAgICAgICAgIH0KICAgICAgICAgIHRocm93IG5ldyBlcnJvcnMuRVJSX09VVF9PRl9SQU5HRSgidmFsdWUiLCByYW5nZSwgdmFsdWUpOwogICAgICAgIH0KICAgICAg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7CiAgICAgICAgaWYgKHN0ci5sZW5ndGggPCAyKQogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIHdoaWxlIChzdHIubGVuZ3RoICUgNCAhPT0gMCkgewogICAgICAgICAgc3RyID0gc3RyICsgIj0iOwogICAgICAgIH0KICAgICAgICByZXR1cm4gc3RyOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHV0ZjhUb0J5dGVzKHN0cmluZywgdW5pdHMpIHsKICAgICAgICB1bml0cyA9IHVuaXRzIHx8IEluZmluaXR5OwogICAgICAgIGxldCBjb2RlUG9pbnQ7CiAgICAgICAgY29uc3QgbGVuZ3RoID0gc3RyaW5nLmxlbmd0aDsKICAgICAgICBsZXQgbGVhZFN1cnJvZ2F0ZSA9IG51bGw7CiAgICAgICAgY29uc3QgYnl0ZXMgPSBbXTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgKytpKSB7CiAgICAgICAgICBjb2RlUG9pbnQgPSBzdHJpbmcuY2hhckNvZGVBdChpKTsKICAgICAgICAgIGlmIChjb2RlUG9pbnQgPiA1NTI5NSAmJiBjb2RlUG9pbnQgPCA1NzM0NCkgewogICAgICAgICAgICBpZiAoIWxlYWRTdXJyb2dhdGUpIHsKICAgICAgICAgICAgICBpZiAoY29kZVBvaW50ID4gNTYzMTkpIHsKICAgICAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkKICAgICAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgIH0gZWxzZSBpZiAoaSArIDEgPT09IGxlbmd0aCkgewogICAgICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgICAgICBieXRlcy5wdXNoKDIzOSwgMTkxLCAxODkpOwogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGxlYWRTdXJyb2dhdGUgPSBjb2RlUG9pbnQ7CiAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGNvZGVQb2ludCA8IDU2MzIwKSB7CiAgICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50OwogICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGNvZGVQb2ludCA9IChsZWFkU3Vycm9nYXRlIC0gNTUyOTYgPDwgMTAgfCBjb2RlUG9pbnQgLSA1NjMyMCkgKyA2NTUzNjsKICAgICAgICAgIH0gZWxzZSBpZiAobGVhZFN1cnJvZ2F0ZSkgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpCiAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgIH0KICAgICAgICAgIGxlYWRTdXJyb2dhdGUgPSBudWxsOwogICAgICAgICAgaWYgKGNvZGVQb2ludCA8IDEyOCkgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDEpIDwgMCkKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgYnl0ZXMucHVzaChjb2RlUG9pbnQpOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPCAyMDQ4KSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMikgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiA2IHwgMTkyLCBjb2RlUG9pbnQgJiA2MyB8IDEyOCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA8IDY1NTM2KSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiAxMiB8IDIyNCwgY29kZVBvaW50ID4+IDYgJiA2MyB8IDEyOCwgY29kZVBvaW50ICYgNjMgfCAxMjgpOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPCAxMTE0MTEyKSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gNCkgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiAxOCB8IDI0MCwgY29kZVBvaW50ID4+IDEyICYgNjMgfCAxMjgsIGNvZGVQb2ludCA+PiA2ICYgNjMgfCAxMjgsIGNvZGVQb2ludCAmIDYzIHwgMTI4KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigiSW52YWxpZCBjb2RlIHBvaW50Iik7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBieXRlczsKICAgICAgfQogICAgICBmdW5jdGlvbiBhc2NpaVRvQnl0ZXMoc3RyKSB7CiAgICAgICAgY29uc3QgYnl0ZUFycmF5ID0gW107CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBzdHIubGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGJ5dGVBcnJheS5wdXNoKHN0ci5jaGFyQ29kZUF0KGkpICYgMjU1KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ5dGVBcnJheTsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNmxlVG9CeXRlcyhzdHIsIHVuaXRzKSB7CiAgICAgICAgbGV0IGMsIGhpLCBsbzsKICAgICAgICBjb25zdCBieXRlQXJyYXkgPSBbXTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0ci5sZW5ndGg7ICsraSkgewogICAgICAgICAgaWYgKCh1bml0cyAtPSAyKSA8IDApCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgYyA9IHN0ci5jaGFyQ29kZUF0KGkpOwogICAgICAgICAgaGkgPSBjID4+IDg7CiAgICAgICAgICBsbyA9IGMgJSAyNTY7CiAgICAgICAgICBieXRlQXJyYXkucHVzaChsbyk7CiAgICAgICAgICBieXRlQXJyYXkucHVzaChoaSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBieXRlQXJyYXk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYmFzZTY0VG9CeXRlcyhzdHIpIHsKICAgICAgICByZXR1cm4gYmFzZTY0LnRvQnl0ZUFycmF5KGJhc2U2NGNsZWFuKHN0cikpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJsaXRCdWZmZXIoc3JjLCBkc3QsIG9mZnNldCwgbGVuZ3RoKSB7CiAgICAgICAgbGV0IGk7CiAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbmd0aDsgKytpKSB7CiAgICAgICAgICBpZiAoaSArIG9mZnNldCA+PSBkc3QubGVuZ3RoIHx8IGkgPj0gc3JjLmxlbmd0aCkKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBkc3RbaSArIG9mZnNldF0gPSBzcmNbaV07CiAgICAgICAgfQogICAgICAgIHJldHVybiBpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGlzSW5zdGFuY2Uob2JqLCB0eXBlKSB7CiAgICAgICAgcmV0dXJuIG9iaiBpbnN0YW5jZW9mIHR5cGUgfHwgb2JqICE9IG51bGwgJiYgb2JqLmNvbnN0cnVjdG9yICE9IG51bGwgJiYgb2JqLmNvbnN0cnVjdG9yLm5hbWUgIT0gbnVsbCAmJiBvYmouY29uc3RydWN0b3IubmFtZSA9PT0gdHlwZS5uYW1lOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIG51bWJlcklzTmFOKG9iaikgewogICAgICAgIHJldHVybiBvYmogIT09IG9iajsKICAgICAgfQogICAgICB2YXIgaGV4U2xpY2VMb29rdXBUYWJsZSA9IGZ1bmN0aW9uKCkgewogICAgICAgIGNvbnN0IGFscGhhYmV0ID0gIjAxMjM0NTY3ODlhYmNkZWYiOwogICAgICAgIGNvbnN0IHRhYmxlID0gbmV3IEFycmF5KDI1Nik7CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCAxNjsgKytpKSB7CiAgICAgICAgICBjb25zdCBpMTYgPSBpICogMTY7CiAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IDE2OyArK2opIHsKICAgICAgICAgICAgdGFibGVbaTE2ICsgal0gPSBhbHBoYWJldFtpXSArIGFscGhhYmV0W2pdOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gdGFibGU7CiAgICAgIH0oKTsKICAgICAgZnVuY3Rpb24gZGVmaW5lQmlnSW50TWV0aG9kKGZuKSB7CiAgICAgICAgcmV0dXJuIHR5cGVvZiBCaWdJbnQgPT09ICJ1bmRlZmluZWQiID8gQnVmZmVyQmlnSW50Tm90RGVmaW5lZCA6IGZuOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIEJ1ZmZlckJpZ0ludE5vdERlZmluZWQoKSB7CiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJCaWdJbnQgbm90IHN1cHBvcnRlZCIpOwogICAgICB9CiAgICB9CiAgfSk7CgogIC8vIHNyYy9hbGlhcy9idWZmZXItc2hpbS5qcwogIHZhciBpbXBvcnRfYnVmZmVyOwogIHZhciBpbml0X2J1ZmZlcl9zaGltID0gX19lc20oewogICAgInNyYy9hbGlhcy9idWZmZXItc2hpbS5qcyIoKSB7CiAgICAgIGltcG9ydF9idWZmZXIgPSBfX3RvTW9kdWxlKHJlcXVpcmVfYnVmZmVyKCkpOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vYWJvcnRjb250cm9sbGVyLXBvbHlmaWxsQDEuNy41L25vZGVfbW9kdWxlcy9hYm9ydGNvbnRyb2xsZXItcG9seWZpbGwvZGlzdC9janMtcG9ueWZpbGwuanMKICB2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AgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoc3ViQ2xhc3MsICJwcm90b3R5cGUiLCB7CiAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KTsKICAgICAgICBpZiAoc3VwZXJDbGFzcykKICAgICAgICAgIF9zZXRQcm90b3R5cGVPZihzdWJDbGFzcywgc3VwZXJDbGFzcyk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mKG8pIHsKICAgICAgICBfZ2V0UHJvdG90eXBlT2YgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgPyBPYmplY3QuZ2V0UHJvdG90eXBlT2YuYmluZCgpIDogZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mMihvMikgewogICAgICAgICAgcmV0dXJuIG8yLl9fcHJvdG9fXyB8fCBPYmplY3QuZ2V0UHJvdG90eXBlT2YobzIpOwogICAgICAgIH07CiAgICAgICAgcmV0dXJuIF9nZXRQcm90b3R5cGVPZihvKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YobywgcCkgewogICAgICAgIF9zZXRQcm90b3R5cGVPZiA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiA/IE9iamVjdC5zZXRQcm90b3R5cGVPZi5iaW5kKCkgOiBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YyKG8yLCBwMikgewogICAgICAgICAgbzIuX19wcm90b19fID0gcDI7CiAgICAgICAgICByZXR1cm4gbzI7CiAgICAgICAgfTsKICAgICAgICByZXR1cm4gX3NldFByb3RvdHlwZU9mKG8sIHApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9pc05hdGl2ZVJlZmxlY3RDb25zdHJ1Y3QoKSB7CiAgICAgICAgaWYgKHR5cGVvZiBSZWZsZWN0ID09PSAidW5kZWZpbmVkIiB8fCAhUmVmbGVjdC5jb25zdHJ1Y3QpCiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKFJlZmxlY3QuY29uc3RydWN0LnNoYW0pCiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKHR5cGVvZiBQcm94eSA9PT0gImZ1bmN0aW9uIikKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIHRyeSB7CiAgICAgICAgICBCb29sZWFuLnByb3RvdHlwZS52YWx1ZU9mLmNhbGwoUmVmbGVjdC5jb25zdHJ1Y3QoQm9vbGVhbiwgW10sIGZ1bmN0aW9uKCkgewogICAgICAgICAgfSkpOwogICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBfYXNzZXJ0VGhpc0luaXRpYWxpemVkKHNlbGYyKSB7CiAgICAgICAgaWYgKHNlbGYyID09PSB2b2lkIDApIHsKICAgICAgICAgIHRocm93IG5ldyBSZWZlcmVuY2VFcnJvcigidGhpcyBoYXNuJ3QgYmVlbiBpbml0aWFsaXNlZCAtIHN1cGVyKCkgaGFzbid0IGJlZW4gY2FsbGVkIik7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzZWxmMjsKICAgICAgfQogICAgICBmdW5jdGlvbiBfcG9zc2libGVDb25zdHJ1Y3RvclJldHVybihzZWxmMiwgY2FsbCkgewogICAgICAgIGlmIChjYWxsICYmICh0eXBlb2YgY2FsbCA9PT0gIm9iamVjdCIgfHwgdHlwZW9mIGNhbGwgPT09ICJmdW5jdGlvbiIpKSB7CiAgICAgICAgICByZXR1cm4gY2FsbDsKICAgICAgICB9IGVsc2UgaWYgKGNhbGwgIT09IHZvaWQgMCkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiRGVyaXZlZCBjb25zdHJ1Y3RvcnMgbWF5IG9ubHkgcmV0dXJuIG9iamVjdCBvciB1bmRlZmluZWQiKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIF9h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AgICAgIGZ1bmN0aW9uIF9nZXQoKSB7CiAgICAgICAgaWYgKHR5cGVvZiBSZWZsZWN0ICE9PSAidW5kZWZpbmVkIiAmJiBSZWZsZWN0LmdldCkgewogICAgICAgICAgX2dldCA9IFJlZmxlY3QuZ2V0LmJpbmQoKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgX2dldCA9IGZ1bmN0aW9uIF9nZXQyKHRhcmdldCwgcHJvcGVydHksIHJlY2VpdmVyKSB7CiAgICAgICAgICAgIHZhciBiYXNlID0gX3N1cGVyUHJvcEJhc2UodGFyZ2V0LCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmICghYmFzZSkKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIHZhciBkZXNjID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihiYXNlLCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmIChkZXNjLmdldCkgewogICAgICAgICAgICAgIHJldHVybiBkZXNjLmdldC5jYWxsKGFyZ3VtZW50cy5sZW5ndGggPCAzID8gdGFyZ2V0IDogcmVjZWl2ZXIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBkZXNjLnZhbHVlOwogICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIF9nZXQuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgfQogICAgICB2YXIgRW1pdHRlciA9IC8qIEBfX1BVUkVfXyAqLyBmdW5jdGlvbigpIHsKICAgICAgICBmdW5jdGlvbiBFbWl0dGVyMigpIHsKICAgICAgICAgIF9jbGFzc0NhbGxDaGVjayh0aGlzLCBFbWl0dGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgImxpc3RlbmVycyIsIHsKICAgICAgICAgICAgdmFsdWU6IHt9LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEVtaXR0ZXIyLCBbewogICAgICAgICAga2V5OiAiYWRkRXZlbnRMaXN0ZW5lciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWRkRXZlbnRMaXN0ZW5lcih0eXBlLCBjYWxsYmFjaywgb3B0aW9ucykgewogICAgICAgICAgICBpZiAoISh0eXBlIGluIHRoaXMubGlzdGVuZXJzKSkgewogICAgICAgICAgICAgIHRoaXMubGlzdGVuZXJzW3R5cGVdID0gW107CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5saXN0ZW5lcnNbdHlwZV0ucHVzaCh7CiAgICAgICAgICAgICAgY2FsbGJhY2ssCiAgICAgICAgICAgICAgb3B0aW9ucwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJyZW1vdmVFdmVudExpc3RlbmVyIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiByZW1vdmVFdmVudExpc3RlbmVyKHR5cGUsIGNhbGxiYWNrKSB7CiAgICAgICAgICAgIGlmICghKHR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW3R5cGVdOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIGlmIChzdGFja1tpXS5jYWxsYmFjayA9PT0gY2FsbGJhY2spIHsKICAgICAgICAgICAgICAgIHN0YWNrLnNwbGljZShpLCAxKTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJkaXNwYXRjaEV2ZW50IiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBkaXNwYXRjaEV2ZW50KGV2ZW50KSB7CiAgICAgICAgICAgIGlmICghKGV2ZW50LnR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW2V2ZW50LnR5cGVdOwogICAgICAgICAgICB2YXIgc3RhY2tUb0NhbGwgPSBzdGFjay5zbGljZSgpOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrVG9DYWxsLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIHZhciBsaXN0ZW5lciA9IHN0YWNrVG9DYWxsW2ldOwogICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBsaXN0ZW5lci5jYWxsYmFjay5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBQcm9taXNlLnJlc29sdmUoKS50aGVuKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChsaXN0ZW5lci5vcHRpb25zICYmIGxpc3RlbmVyLm9wdGlvbnMub25jZSkgewogICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVFdmVudExpc3RlbmVyKGV2ZW50LnR5cGUsIGxpc3RlbmVyLmNhbGxiYWNrKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuICFldmVudC5kZWZhdWx0UHJldmVudGVkOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gRW1pdHRlcjI7CiAgICAgIH0oKTsKICAgICAgdmFyIEFib3J0U2lnbmFsID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKF9FbWl0dGVyKSB7CiAgICAgICAgX2luaGVyaXRzKEFib3J0U2lnbmFsMiwgX0VtaXR0ZXIpOwogICAgICAgIHZhciBfc3VwZXIgPSBfY3JlYXRlU3VwZXIoQWJvcnRTaWduYWwyKTsKICAgICAgICBmdW5jdGlvbiBBYm9ydFNpZ25hbDIoKSB7CiAgICAgICAgICB2YXIgX3RoaXM7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRTaWduYWwyKTsKICAgICAgICAgIF90aGlzID0gX3N1cGVyLmNhbGwodGhpcyk7CiAgICAgICAgICBpZiAoIV90aGlzLmxpc3RlbmVycykgewogICAgICAgICAgICBFbWl0dGVyLmNhbGwoX2Fzc2VydFRoaXNJbml0aWFsaXplZChfdGhpcykpOwogICAgICAgICAgfQogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KF9hc3NlcnRUaGlzSW5pdGlhbGl6ZWQoX3RoaXMpLCAiYWJvcnRlZCIsIHsKICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgIm9uYWJvcnQiLCB7CiAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgInJlYXNvbiIsIHsKICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgICByZXR1cm4gX3RoaXM7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhBYm9ydFNpZ25hbDIsIFt7CiAgICAgICAgICBrZXk6ICJ0b1N0cmluZyIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gdG9TdHJpbmcoKSB7CiAgICAgICAgICAgIHJldHVybiAiW29iamVjdCBBYm9ydFNpZ25hbF0iOwogICAgICAgICAgfQogICAgICAgIH0sIHsKICAgICAgICAgIGtleTogImRpc3BhdGNoRXZlbnQiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGRpc3BhdGNoRXZlbnQoZXZlbnQpIHsKICAgICAgICAgICAgaWYgKGV2ZW50LnR5cGUgPT09ICJhYm9ydCIpIHsKICAgICAgICAgICAgICB0aGlzLmFib3J0ZWQgPSB0cnVlOwogICAgICAgICAgICAgIGlmICh0eXBlb2YgdGhpcy5vbmFib3J0ID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICB0aGlzLm9uYWJvcnQuY2FsbCh0aGlzLCBldmVudCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIF9nZXQoX2dldFByb3RvdHlwZU9mKEFib3J0U2lnbmFsMi5wcm90b3R5cGUpLCAiZGlzcGF0Y2hFdmVudCIsIHRoaXMpLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gQWJvcnRTaWduYWwyOwogICAgICB9KEVtaXR0ZXIpOwogICAgICB2YXIgQWJvcnRDb250cm9sbGVyID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKCkgewogICAgICAgIGZ1bmN0aW9uIEFib3J0Q29udHJvbGxlcjIoKSB7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRDb250cm9sbGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgInNpZ25hbCIsIHsKICAgICAgICAgICAgdmFsdWU6IG5ldyBBYm9ydFNpZ25hbCgpLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEFib3J0Q29udHJvbGxlcjIsIFt7CiAgICAgICAgICBrZXk6ICJhYm9ydCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWJvcnQocmVhc29uKSB7CiAgICAgICAgICAgIHZhciBldmVudDsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBldmVudCA9IG5ldyBFdmVudCgiYWJvcnQiKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgIGlmICh0eXBlb2YgZG9jdW1lbnQgIT09ICJ1bmRlZmluZWQiKSB7CiAgICAgICAgICAgICAgICBpZiAoIWRvY3VtZW50LmNyZWF0ZUV2ZW50KSB7CiAgICAgICAgICAgICAgICAgIGV2ZW50ID0gZG9jdW1lbnQuY3JlYXRlRXZlbnRPYmplY3QoKTsKICAgICAgICAgICAgICAgICAgZXZlbnQudHlwZSA9ICJhYm9ydCI7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBldmVudCA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCJFdmVudCIpOwogICAgICAgICAgICAgICAgICBldmVudC5pbml0RXZlbnQoImFib3J0IiwgZmFsc2UsIGZhbHNlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZXZlbnQgPSB7CiAgICAgICAgICAgICAgICAgIHR5cGU6ICJhYm9ydCIsCiAgICAgICAgICAgICAgICAgIGJ1YmJsZXM6IGZhbHNlLAogICAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHNpZ25hbFJlYXNvbiA9IHJlYXNvbjsKICAgICAgICAgICAgaWYgKHNpZ25hbFJlYXNvbiA9PT0gdm9pZCAwKSB7CiAgICAgICAgICAgICAgaWYgKHR5cGVvZiBkb2N1bWVudCA9PT0gInVuZGVmaW5lZCIpIHsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbi5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24gPSBuZXcgRE9NRXhjZXB0aW9uKCJzaWduYWwgaXMgYWJvcnRlZCB3aXRob3V0IHJlYXNvbiIpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgICAgc2lnbmFsUmVhc29uLm5hbWUgPSAiQWJvcnRFcnJvciI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMuc2lnbmFsLnJlYXNvbiA9IHNpZ25hbFJlYXNvbjsKICAgICAgICAgICAgdGhpcy5zaWduYWwuZGlzcGF0Y2hFdmVudChldmVudCk7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAidG9TdHJpbmciLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIHRvU3RyaW5nKCkgewogICAgICAgICAgICByZXR1cm4gIltvYmplY3QgQWJvcnRDb250cm9sbGVyX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ICYmICFSZXF1ZXN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eSgic2lnbmFsIikgfHwgX19GT1JDRV9JTlNUQUxMX0FCT1JUQ09OVFJPTExFUl9QT0xZRklMTCkgewogICAgICAgICAgUmVxdWVzdCA9IGZ1bmN0aW9uIFJlcXVlc3QyKGlucHV0LCBpbml0MikgewogICAgICAgICAgICB2YXIgc2lnbmFsOwogICAgICAgICAgICBpZiAoaW5pdDIgJiYgaW5pdDIuc2lnbmFsKSB7CiAgICAgICAgICAgICAgc2lnbmFsID0gaW5pdDIuc2lnbmFsOwogICAgICAgICAgICAgIGRlbGV0ZSBpbml0Mi5zaWduYWw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHJlcXVlc3QgPSBuZXcgTmF0aXZlUmVxdWVzdChpbnB1dCwgaW5pdDIpOwogICAgICAgICAgICBpZiAoc2lnbmFsKSB7CiAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHJlcXVlc3QsICJzaWduYWwiLCB7CiAgICAgICAgICAgICAgICB3cml0YWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICAgIHZhbHVlOiBzaWduYWwKICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmVxdWVzdDsKICAgICAgICAgIH07CiAgICAgICAgICBSZXF1ZXN0LnByb3RvdHlwZSA9IE5hdGl2ZVJlcXVlc3QucHJvdG90eXBlOwogICAgICAgIH0KICAgICAgICB2YXIgcmVhbEZldGNoID0gZmV0Y2g7CiAgICAgICAgdmFyIGFib3J0YWJsZUZldGNoID0gZnVuY3Rpb24gYWJvcnRhYmxlRmV0Y2gyKGlucHV0LCBpbml0MikgewogICAgICAgICAgdmFyIHNpZ25hbCA9IFJlcXVlc3QgJiYgUmVxdWVzdC5wcm90b3R5cGUuaXNQcm90b3R5cGVPZihpbnB1dCkgPyBpbnB1dC5zaWduYWwgOiBpbml0MiA/IGluaXQyLnNpZ25hbCA6IHZvaWQgMDsKICAgICAgICAgIGlmIChzaWduYWwpIHsKICAgICAgICAgICAgdmFyIGFib3J0RXJyb3I7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgYWJvcnRFcnJvciA9IG5ldyBET01FeGNlcHRpb24oIkFib3J0ZWQiLCAiQWJvcnRFcnJvciIpOwogICAgICAgICAgICB9IGNhdGNoIChlcnIpIHsKICAgICAgICAgICAgICBhYm9ydEVycm9yID0gbmV3IEVycm9yKCJBYm9ydGVkIik7CiAgICAgICAgICAgICAgYWJvcnRFcnJvci5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzaWduYWwuYWJvcnRlZCkgewogICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChhYm9ydEVycm9yKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgY2FuY2VsbGF0aW9uID0gbmV3IFByb21pc2UoZnVuY3Rpb24oXywgcmVqZWN0KSB7CiAgICAgICAgICAgICAgc2lnbmFsLmFkZEV2ZW50TGlzdGVuZXIoImFib3J0IiwgZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gcmVqZWN0KGFib3J0RXJyb3IpOwogICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIG9uY2U6IHRydWUKICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGlmIChpbml0MiAmJiBpbml0Mi5zaWduYWwpIHsKICAgICAgICAgICAgICBkZWxldGUgaW5pdDIuc2lnbmFsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJhY2UoW2NhbmNlbGxhdGlvbiwgcmVhbEZldGNoKGlucHV0LCBpbml0MildKTsKICAgICAgICAgIH0KICA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gIGlmICh0aGlzLmNhY2hlLmdldChrZXkpID09PSBlbnRyeSkgewogICAgICAgICAgICB0aGlzLmNhY2hlLmRlbGV0ZShrZXkpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmaWxsKGtleSwgZGF0YSwgc2lnbmFsLCBzdGF0dXNDYWxsYmFjaykgewogICAgICAgICAgY29uc3QgYWJvcnRlciA9IG5ldyBBZ2dyZWdhdGVBYm9ydENvbnRyb2xsZXJfMS5kZWZhdWx0KCk7CiAgICAgICAgICBjb25zdCBzdGF0dXNSZXBvcnRlciA9IG5ldyBBZ2dyZWdhdGVTdGF0dXNSZXBvcnRlcl8xLmRlZmF1bHQoKTsKICAgICAgICAgIHN0YXR1c1JlcG9ydGVyLmFkZENhbGxiYWNrKHN0YXR1c0NhbGxiYWNrKTsKICAgICAgICAgIGNvbnN0IG5ld0VudHJ5ID0gewogICAgICAgICAgICBhYm9ydGVyLAogICAgICAgICAgICBwcm9taXNlOiB0aGlzLmZpbGxDYWxsYmFjayhkYXRhLCBhYm9ydGVyLnNpZ25hbCwgKG1lc3NhZ2UpID0+IHsKICAgICAgICAgICAgICBzdGF0dXNSZXBvcnRlci5jYWxsYmFjayhtZXNzYWdlKTsKICAgICAgICAgICAgfSksCiAgICAgICAgICAgIHNldHRsZWQ6IGZhbHNlLAogICAgICAgICAgICBzdGF0dXNSZXBvcnRlciwKICAgICAgICAgICAgZ2V0IGFib3J0ZWQoKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYWJvcnRlci5zaWduYWwuYWJvcnRlZDsKICAgICAgICAgICAgfQogICAgICAgICAgfTsKICAgICAgICAgIG5ld0VudHJ5LmFib3J0ZXIuYWRkU2lnbmFsKHNpZ25hbCk7CiAgICAgICAgICBuZXdFbnRyeS5hYm9ydGVyLnNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsICgpID0+IHsKICAgICAgICAgICAgaWYgKCFuZXdFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgdGhpcy5ldmljdChrZXksIG5ld0VudHJ5KTsKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgICBuZXdFbnRyeS5wcm9taXNlLnRoZW4oKCkgPT4gewogICAgICAgICAgICBuZXdFbnRyeS5zZXR0bGVkID0gdHJ1ZTsKICAgICAgICAgIH0sICgpID0+IHsKICAgICAgICAgICAgbmV3RW50cnkuc2V0dGxlZCA9IHRydWU7CiAgICAgICAgICAgIHRoaXMuZXZpY3Qoa2V5LCBuZXdFbnRyeSk7CiAgICAgICAgICB9KS5jYXRjaCgoZSkgPT4gewogICAgICAgICAgICBjb25zb2xlLmVycm9yKGUpOwogICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgfSk7CiAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIG5ld0VudHJ5KTsKICAgICAgICB9CiAgICAgICAgc3RhdGljIGNoZWNrU2luZ2xlUHJvbWlzZShwcm9taXNlLCBzaWduYWwpIHsKICAgICAgICAgIGZ1bmN0aW9uIGNoZWNrRm9yU2luZ2xlQWJvcnQoKSB7CiAgICAgICAgICAgIGlmIChzaWduYWwgJiYgc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICB0aHJvdyBPYmplY3QuYXNzaWduKG5ldyBFcnJvcigiYWJvcnRlZCIpLCB7IGNvZGU6ICJFUlJfQUJPUlRFRCIgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBwcm9taXNlLnRoZW4oKHJlc3VsdCkgPT4gewogICAgICAgICAgICBjaGVja0ZvclNpbmdsZUFib3J0KCk7CiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICAgICB9LCAoZXJyb3IpID0+IHsKICAgICAgICAgICAgY2hlY2tGb3JTaW5nbGVBYm9ydCgpOwogICAgICAgICAgICB0aHJvdyBlcnJvcjsKICAgICAgICAgIH0pOwogICAgICAgIH0KICAgICAgICBoYXMoa2V5KSB7CiA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NhY2hlMi5jaGVja1NpbmdsZVByb21pc2UoY2FjaGVFbnRyeS5wcm9taXNlLCBzaWduYWwpOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5maWxsKGtleSwgZGF0YSwgc2lnbmFsLCBzdGF0dXNDYWxsYmFjayk7CiAgICAgICAgICByZXR1cm4gQWJvcnRhYmxlUHJvbWlzZUNhY2hlMi5jaGVja1NpbmdsZVByb21pc2UodGhpcy5jYWNoZS5nZXQoa2V5KS5wcm9taXNlLCBzaWduYWwpOwogICAgICAgIH0KICAgICAgICBkZWxldGUoa2V5KSB7CiAgICAgICAgICBjb25zdCBjYWNoZWRFbnRyeSA9IHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICBpZiAoY2FjaGVkRW50cnkpIHsKICAgICAgICAgICAgaWYgKCFjYWNoZWRFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgY2FjaGVkRW50cnkuYWJvcnRlci5hYm9ydCgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMuY2FjaGUuZGVsZXRlKGtleSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNsZWFyKCkgewogICAgICAgICAgY29uc3Qga2V5SXRlciA9IHRoaXMuY2FjaGUua2V5cygpOwogICAgICAgICAgbGV0IGRlbGV0ZUNvdW50ID0gMDsKICAgICAgICAgIGZvciAobGV0IHJlc3VsdCA9IGtleUl0ZXIubmV4dCgpOyAhcmVzdWx0LmRvbmU7IHJlc3VsdCA9IGtleUl0ZXIubmV4dCgpKSB7CiAgICAgICAgICAgIHRoaXMuZGVsZXRlKHJlc3VsdC52YWx1ZSk7CiAgICAgICAgICAgIGRlbGV0ZUNvdW50ICs9IDE7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gZGVsZXRlQ291bnQ7CiAgICAgICAgfQogICAgICB9OwogICAgICBleHBvcnRzMi5kZWZhdWx0ID0gQWJvcnRhYmxlUHJvbWlzZUNhY2hlMjsKICAgIH0KIC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9xdWljay1scnVANC4wLjEvbm9kZV9tb2R1bGVzL3F1aWNrLWxydS9pbmRleC5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIHZhciBRdWlja0xSVSA9IGNsYXNzIHsKICAgICAgICBjb25zdHJ1Y3RvcihvcHRpb25zID0ge30pIHsKICAgICAgICAgIGlmICghKG9wdGlvbnMubWF4U2l6ZSAmJiBvcHRpb25zLm1heFNpemUgPiAwKSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJgbWF4U2l6ZWAgbXVzdCBiZSBhIG51bWJlciBncmVhdGVyIHRoYW4gMCIpOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5tYXhTaXplID0gb3B0aW9ucy5tYXhTaXplOwogICAgICAgICAgdGhpcy5jYWNoZSA9IG5ldyBNYXAoKTsKICAgICAgICAgIHRoaXMub2xkQ2FjaGUgPSBuZXcgTWFwKCk7CiAgICAgICAgICB0aGlzLl9zaXplID0gMDsKICAgICAgICB9CiAgICAgICAgX3NldChrZXksIHZhbHVlKSB7CiAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIHZhbHVlKTsKICAgICAgICAgIHRoaXMuX3NpemUrKzsKICAgICAgICAgIGlmICh0aGlzLl9zaXplID49IHRoaXMubWF4U2l6ZSkgewogICAgICAgICAgICB0aGlzLl9zaXplID0gMDsKICAgICAgICAgICAgdGhpcy5vbGRDYWNoZSA9IHRoaXMuY2FjaGU7CiAgICAgICAgICAgIHRoaXMuY2FjaGUgPSBuZXcgTWFwKCk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGdldChrZXkpIHsKICAgICAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLmNhY2hlLmdldChrZXkpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHRoaXMub2xkQ2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgY29uc3QgdmFsdWUgPSB0aGlzLm9sZENhY2hlLmdldChrZXkpOwogICAgICAgICAgICB0aGlzLm9sZENhY2hlLmRlbGV0ZShrZXkpOwogICAgICAgICAgICB0aGlzLl9zZXQoa2V5LCB2YWx1ZSk7CiAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgc2V0KGtleSwgdmFsdWUpIHsKICAgICAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHRoaXMuY2FjaGUuc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdGhpcy5fc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgfQogICAgICAgIGhhcyhrZXkpIHsKICAgICAgICAgIHJldHVybiB0aGlzLmNhY2hlLmhhcyhrZXkpIHx8IHRoaXMub2xkQ2FjaGUuaGFzKGtleSk7CiAgICAgICAgfQogICAgICAgIHBlZWsoa2V5KSB7CiAgICAgICAgICBpZiAodGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5nZXQoa2V5KTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0aGlzLm9sZENhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLm9sZENhY2hlLmdldChrZXkpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkZWxldGUoa2V5KSB7CiAgICAgICAgICBjb25zdCBkZWxldGVkID0gdGhpcy5jYWNoZS5kZWxldGUoa2V5KTsKICAgICAgICAgIGlmIChkZWxldGVkKSB7CiAgICAgICAgICAgIHRoaXMuX3NpemUtLTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiB0aGlzLm9sZENhY2hlLmRlbGV0ZShrZXkpIHx8IGRlbGV0ZWQ7CiAgICAgICAgfQogICAgICAgIGNsZWFyKCkgewogICAgICAgICAgdGhpcy5jYWNoZS5jbGVhcigpOwogICAgICAgICAgdGhpcy5vbGRDYWNoZS5jbGVhcigpOwogICAgICAgICAgdGhpcy5fc2l6ZSA9IDA7CiAgICAgICAgfQogICAgICAgICprZXlzKCkgewogICAgICAgICAgZm9yIChjb25zdCBba2V5XSBvZiB0aGlzKSB7CiAgICAgICAgICAgIHlpZWxkIGtleTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgKnZhbHVlcygpIHsKICAgICAgICAgIGZvciAoY29uc3QgWywgdmFsdWVdIG9mIHRoaXMpIHsKICAgICAgICAgICAgeWllbGQgdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgICpbU3ltYm9sLml0ZXJhdG9yXSgpIHsKICAgICAgICAgIGZvciAoY29uc3QgaXRlbSBvZiB0aGlzLmNhY2hlKSB7CiAgICAgICAgICAgIHlpZWxkIGl0ZW07CiAgICAgICAgICB9CiAgICAgICAgICBmb3IgKGNvbnN0IGl0ZW0gb2YgdGhpcy5vbGRDYWNoZSkgewogICAgICAgICAgICBjb25zdCBba2V5XSA9IGl0ZW07CiAgICAgICAgICAgIGlmICghdGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICAgIHlpZWxkIGl0ZW07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZ2V0IHNpemUoKSB7CiAgICAgICAgICBsZXQgb2xkQ2FjaGVTaXplID0gMDsKICAgICAgICAgIGZvciAoY29uc3Qga2V5IG9mIHRoaXMub2xkQ2FjaGUua2V5cygpKSB7CiAgICAgICAgICAgIGlmICghdGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICAgIG9sZENhY2hlU2l6ZSsrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gdGhpcy5fc2l6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5LmNhbGwob2JqLCBrZXkpOwogICAgICB9CiAgICAgIGV4cG9ydHMyLmFzc2lnbiA9IGZ1bmN0aW9uKG9iaikgewogICAgICAgIHZhciBzb3VyY2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKTsKICAgICAgICB3aGlsZSAoc291cmNlcy5sZW5ndGgpIHsKICAgICAgICAgIHZhciBzb3VyY2UgPSBzb3VyY2VzLnNoaWZ0KCk7CiAgICAgICAgICBpZiAoIXNvdXJjZSkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0eXBlb2Ygc291cmNlICE9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKHNvdXJjZSArICJtdXN0IGJlIG5vbi1vYmplY3QiKTsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAodmFyIHAgaW4gc291cmNlKSB7CiAgICAgICAgICAgIGlmIChfaGFzKHNvdXJjZSwgcCkpIHsKICAgICAgICAgICAgICBvYmpbcF0gPSBzb3VyY2VbcF07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIG9iajsKICAgICAgfTsKICAgICAgZXhwb3J0czIuc2hyaW5rQnVmID0gZnVuY3Rpb24oYnVmLCBzaXplKSB7CiAgICAgICAgaWYgKGJ1Zi5sZW5ndGggPT09IHNpemUpIHsKICAgICAgICAgIHJldHVybiBidWY7CiAgICAgICAgfQogICAgICAgIGlmIChidWYuc3ViYXJyYXkpIHsKICAgICAgICAgIHJldHVybiBidWYuc3ViYXJyYXkoMCwgc2l6ZSk7CiAgICAgICAgfQogICAgICAgIGJ1Zi5sZW5ndGggPSBzaXplOwogICAgICAgIHJldHVybiBidWY7CiAgICAgIH07CiAgICAgIHZhciBmblR5cGVkID0gewogICAgICAgIGFycmF5U2V0OiBmdW5jdGlvbihkZXN0LCBzcmMsIHNyY19vZmZzLCBsZW4sIGRlc3Rfb2ZmcykgewogICAgICAgICAgaWYgKHNyYy5zdWJhcnJheSAmJiBkZXN0LnN1YmFycmF5KSB7CiAgICAgICAgICAgIGRlc3Quc2V0KHNyYy5zdWJhcnJheShzcmNfb2Zmcywgc3JjX29mZnMgKyBsZW4pLCBkZXN0X29mZnMpOwogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICB9CiAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgICAgIGRlc3RbZGVzdF9vZmZzICsgaV0gPSBzcmNbc3JjX29mZnMgKyBpXTsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIGZsYXR0ZW5DaHVua3M6IGZ1bmN0aW9uKGNodW5rcykgewogICAgICAgICAgdmFyIGksIGwsIGxlbiwgcG9zLCBjaHVuaywgcmVzdWx0OwogICAgICAgICAgbGVuID0gMDsKICAgICAgICAgIGZvciAoaSA9IDAsIGwgPSBjaHVua3MubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgICAgIGxlbiArPSBjaHVua3NbaV0ubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgICAgcmVzdWx0ID0gbmV3IFVpbnQ4QXJyYXkobGVuKTsKICAgICAgICAgIHBvcyA9IDA7CiAgICAgICAgICBmb3IgKGkgPSAwLCBsID0gY2h1bmtzLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICBjaHVuayA9IGNodW5rc1tpXTsKICAgICAgICAgICAgcmVzdWx0LnNldChjaHVuaywgcG9zKTsKICAgICAgICAgICAgcG9zICs9IGNodW5rLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICAgfQogICAgICB9OwogICAgICB2YXIgZm5VbnR5cGVkID0gewogICAgICAgIGFycmF5U2V0OiBmdW5jdGlvbihkZXN0LCBzcmMsIHNyY19vZmZzLCBsZW4sIGRlc3Rfb2ZmcykgewogICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgICBkZXN0W2Rlc3Rfb2ZmcyArIGldID0gc3JjW3NyY19vZmZzICsgaV07CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBmbGF0dGVuQ2h1bmtzOiBmdW5jdGlvbihjaHVua3MpIHsKICAgICAgICAgIHJldHVybiBbXS5jb25jYXQuYXBwbHkoW10sIGNodW5rcyk7CiAgICAgICAgfQogICAgICB9OwogICAgICBleHBvcnRzMi5zZXRUeXBlZCA9IGZ1bmN0aW9uKG9uKSB7CiAgICAgICAgaWYgKG9uKSB7CiAgICAgICAgICBleHBvcnRzMi5CdWY4ID0gVWludDhBcnJheTsKICAgICAgICAgIGV4cG9ydHMyLkJ1ZjE2ID0gVWludDE2QXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5CdWYzMiA9IEludDMyQXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5hc3NpZ24oZXhwb3J0czIsIGZuVHlwZWQpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBleHBvcnRzMi5CdWY4ID0gQXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5CdWYxNiA9IEFycmF5OwogICAgICAgICAgZXhwb3J0czIuQnVmMzIgPSBBcnJheTsKICAgICAgICAgIGV4cG9ydHMyLmFzc2lnbihleHBvcnRzMiwgZm5VbnR5cGVkKTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLnNldFR5cGVkKFRZUEVEX09LKTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL3RyZWVzLmpzCiAgdmFyIHJlcXVpcmVfdHJlZXMgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvdHJlZXMuanMiKGV4cG9ydHMyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICB2YXIgdXRpbHMgPSByZXF1aXJlX2NvbW1vbigpOwogICAgICB2YXIgWl9GSVhFRCA9IDQ7CiAgICAgIHZhciBaX0JJTkFSWSA9IDA7CiAgICAgIHZhciBaX1RFWFQgPSAxOwogICAgICB2YXIgWl9VTktOT1dOID0gMjsKICAgICAgZnVuY3Rpb24gemVybyhidWYpIHsKICAgICAgICB2YXIgbGVuID0gYnVmLmxlbmd0aDsKICAgICAgICB3aGlsZSAoLS1sZW4gPj0gMCkgewogICAgICAgICAgYnVmW2xlbl0gPSAwOwogICAgICAgIH0KICAgICAgfQogICAgICB2YXIgU1RPUkVEX0JMT0NLID0gMDsKICAgICAgdmFyIFNUQVRJQ19UUkVFUyA9IDE7CiAgICAgIHZhciBEWU5fVFJFRVMgPSAyOwogICAgICB2YXIgTUlOX01BVENIID0gMzsKICAgICAgdmFyIE1BWF9NQVRDSCA9IDI1ODsKICAgICAgdmFyIExFTkdUSF9DT0RFUyA9IDI5OwogICAgICB2YXIgTElURVJBTFMgPSAyNTY7CiAgICAgIHZhciBMX0NPREVTID0gTElURVJBTFMgKyAxICsgTEVOR1RIX0NPREVTOwogICAgICB2YXIgRF9DT0RFUyA9IDMwOwogICAgICB2YXIgQkxfQ09ERVMgPSAxOTsKICAgICAgdmFyIEhFQVBfU0laRSA9IDIgKiBMX0NPREVTICsgMTsKICAgICAgdmFyIE1BWF9CSVRTID0gMTU7CiAgICAgIHZhciBCdWZfc2l6ZSA9IDE2OwogICAgICB2YXIgTUFYX0JMX0JJVFMgPSA3OwogICAgICB2YXIgRU5EX0JMT0NLID0gMjU2OwogICAgICB2YXIgUkVQXzNfNiA9IDE2OwogICAgICB2YXIgUkVQWl8zXzEwID0gMTc7CiAgICAgIHZhciBSRVBaXzExXzEzOCA9IDE4OwogICAgICB2YXIgZXh0cmFfbGJpdHMgPSB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YnVmID0gMDsKICAgICAgICAgIHMuYmlfdmFsaWQgPSAwOwogICAgICAgIH0gZWxzZSBpZiAocy5iaV92YWxpZCA+PSA4KSB7CiAgICAgICAgICBzLnBlbmRpbmdfYnVmW3MucGVuZGluZysrXSA9IHMuYmlfYnVmICYgMjU1OwogICAgICAgICAgcy5iaV9idWYgPj49IDg7CiAgICAgICAgICBzLmJpX3ZhbGlkIC09IDg7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGdlbl9iaXRsZW4ocywgZGVzYykgewogICAgICAgIHZhciB0cmVlID0gZGVzYy5keW5fdHJlZTsKICAgICAgICB2YXIgbWF4X2NvZGUgPSBkZXNjLm1heF9jb2RlOwogICAgICAgIHZhciBzdHJlZSA9IGRlc2Muc3RhdF9kZXNjLnN0YXRpY190cmVlOwogICAgICAgIHZhciBoYXNfc3RyZWUgPSBkZXNjLnN0YXRfZGVzYy5oYXNfc3RyZWU7CiAgICAgICAgdmFyIGV4dHJhID0gZGVzYy5zdGF0X2Rlc2MuZXh0cmFfYml0czsKICAgICAgICB2YXIgYmFzZSA9IGRlc2Muc3RhdF9kZXNjLmV4dHJhX2Jhc2U7CiAgICAgICAgdmFyIG1heF9sZW5ndGggPSBkZXNjLnN0YXRfZGVzYy5tYXhfbGVuZ3RoOwogICAgICAgIHZhciBoOwogICAgICAgIHZhciBuLCBtOwogICAgICAgIHZhciBiaXRzOwogICAgICAgIHZhciB4Yml0czsKICAgICAgICB2YXIgZjsKICAgICAgICB2YXIgb3ZlcmZsb3cgPSAwOwogICAgICAgIGZvciAoYml0cyA9IDA7IGJpdHMgPD0gTUFYX0JJVFM7IGJpdHMrKykgewogICAgICAgICAgcy5ibF9jb3VudFtiaXRzXSA9IDA7CiAgICAgICAgfQogICAgICAgIHRyZWVbcy5oZWFwW3MuaGVhcF9tYXhdICogMiArIDFdID0gMDsKICAgICAgICBmb3IgKGggPSBzLmhlYXBfbWF4ICsgMTsgaCA8IEhFQVBfU0laRTsgaCsrKSB7CiAgICAgICAgICBuID0gcy5oZWFwW2hdOwogICAgICAgICAgYml0cyA9IHRyZWVbdHJlZVtuICogMiArIDFdICogMiArIDFdICsgMTsKICAgICAgICAgIGlmIChiaXRzID4gbWF4X2xlbmd0aCkgewogICAgICAgICAgICBiaXRzID0gbWF4X2xlbmd0aDsKICAgICAgICAgICAgb3ZlcmZsb3crKzsKICAgICAgICAgIH0KICAgICAgICAgIHRyZWVbbiAqIDIgKyAxXSA9IGJpdHM7CiAgICAgICAgICBpZiAobiA+IG1heF9jb2RlKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgcy5ibF9jb3VudFtiaXRzXSsrOwogICAgICAgICAgeGJpdHMgPSAwOwogICAgICAgICAgaWYgKG4gPj0gYmFzZSkgewogICAgICAgICAgICB4Yml0cyA9IGV4dHJhW24gLSBiYXNlXTsKICAgICAgICAgIH0KICAgICAgICAgIGYgPSB0cmVlW24gKiAyXTsKICAgICAgICAgIHMub3B0X2xlbiArPSBmICogKGJpdHMgKyB4Yml0cyk7CiAgICAgICAgICBpZiAoaGFzX3N0cmVlKSB7CiAgICAgICAgICAgIHMuc3RhdGljX2xlbiArPSBmICogKHN0cmVlW24gKiAyICsgMV0gKyB4Yml0cyk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChvdmVyZmxvdyA9PT0gMCkgewogICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICBkbyB7CiAgICAgICAgICBiaXRzID0gbWF4X2xlbmd0aCAtIDE7CiAgICAgICAgICB3aGlsZSAocy5ibF9jb3VudFtiaXRzXSA9PT0gMCkgewogICAgICAgICAgICBiaXRzLS07CiAgICAgICAgICB9CiAgICAgICAgICBzLmJsX2NvdW50W2JpdHNdLS07CiAgICAgICAgICBzLmJsX2NvdW50W2JpdHMgKyAxXSArPSAyOwogICAgICAgICAgcy5ibF9jb3VudFttYXhfbGVuZ3RoXS0tOwogICAgICAgICAgb3ZlcmZsb3cgLT0gMjsKICAgICAgICB9IHdoaWxlIChvdmVyZmxvdyA+IDApOwogICAgICAgIGZvciAoYml0cyA9IG1heF9sZW5ndGg7IGJpdHMgIT09IDA7IGJpdHMtLSkgewogICAgICAgICAgbiA9IHMuYmxfY291bnRbYml0c107CiAgICAgICAgICB3aGlsZSAobiAhPT0gMCkgewogICAgICAgICAgICBtID0gcy5oZWFwWy0taF07CiAgICAgICAgICAgIGlmIChtID4gbWF4X2NvZGUpIHsKICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodHJlZVttICogMiArIDFdICE9PSBiaXRzKSB7CiAgICAgICAgICAgICAgcy5vcHRfbGVuICs9IChiaXRzIC0gdHJlZVttICogMiArIDFdKSAqIHRyZWVbbSAqIDJdOwogICAgICAgICAgICAgIHRyZWVbbSAqIDIgKyAxXSA9IGJpdHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbi0tOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBnZW5fY29kZXModHJlZSwgbWF4X2NvZGUsIGJsX2NvdW50KSB7CiAgICAgICAgdmFyIG5leHRfY29kZSA9IG5ldyBBcnJheShNQVhfQklUUyArIDEpOwogICAgICAgIHZhciBjb2RlID0gMDsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgbjsKICAgICAgICBmb3IgKGJpdHMgPSAxOyBiaXRzIDw9IE1BWF9CSVRTOyBiaXRzKyspIHsKICAgICAgICAgIG5leHRfY29kZVtiaXRzXSA9IGNvZGUgPSBjb2RlICsgYmxfY291bnRbYml0cyAtIDFdIDw8IDE7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDA7IG4gPD0gbWF4X2NvZGU7IG4rKykgewogICAgICAgICAgdmFyIGxlbiA9IHRyZWVbbiAqIDIgKyAxXTsKICAgICAgICAgIGlmIChsZW4gPT09IDApIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICB0cmVlW24gKiAyXSA9IGJpX3JldmVyc2UobmV4dF9jb2RlW2xlbl0rKywgbGVuKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdHJfc3RhdGljX2luaXQoKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIGJpdHM7CiAgICAgICAgdmFyIGxlbmd0aDsKICAgICAgICB2YXIgY29kZTsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgYmxfY291bnQgPSBuZXcgQXJyYXkoTUFYX0JJVFMgKyAxKTsKICAgICAgICBsZW5ndGggPSAwOwogICAgICAgIGZvciAoY29kZSA9IDA7IGNvZGUgPCBMRU5HVEhfQ09ERVMgLSAxOyBjb2RlKyspIHsKICAgICAgICAgIGJhc2VfbGVuZ3RoW2NvZGVdID0gbGVuZ3RoOwogICAgICAgICAgZm9yIChuID0gMDsgbiA8IDEgPDwgZXh0cmFfbGJpdHNbY29kZV07IG4rKykgewogICAgICAgICAgICBfbGVuZ3RoX2NvZGVbbGVuZ3RoKytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgX2xlbmd0aF9jb2RlW2xlbmd0aCAtIDFdID0gY29kZTsKICAgICAgICBkaXN0ID0gMDsKICAgICAgICBmb3IgKGNvZGUgPSAwOyBjb2RlIDwgMTY7IGNvZGUrKykgewogICAgICAgICAgYmFzZV9kaXN0W2NvZGVdID0gZGlzdDsKICAgICAgICAgIGZvciAobiA9IDA7IG4gPCAxIDw8IGV4dHJhX2RiaXRzW2NvZGVdOyBuKyspIHsKICAgICAgICAgICAgX2Rpc3RfY29kZVtkaXN0KytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZGlzdCA+Pj0gNzsKICAgICAgICBmb3IgKDsgY29kZSA8IERfQ09ERVM7IGNvZGUrKykgewogICAgICAgICAgYmFzZV9kaXN0W2NvZGVdID0gZGlzdCA8PCA3OwogICAgICAgICAgZm9yIChuID0gMDsgbiA8IDEgPDwgZXh0cmFfZGJpdHNbY29kZV0gLSA3OyBuKyspIHsKICAgICAgICAgICAgX2Rpc3RfY29kZVsyNTYgKyBkaXN0KytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZm9yIChiaXRzID0gMDsgYml0cyA8PSBNQVhfQklUUzsgYml0cysrKSB7CiAgICAgICAgICBibF9jb3VudFtiaXRzXSA9IDA7CiAgICAgICAgfQogICAgICAgIG4gPSAwOwogICAgICAgIHdoaWxlIChuIDw9IDE0MykgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA4OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbOF0rKzsKICAgICAgICB9CiAgICAgICAgd2hpbGUgKG4gPD0gMjU1KSB7CiAgICAgICAgICBzdGF0aWNfbHRyZWVbbiAqIDIgKyAxXSA9IDk7CiAgICAgICAgICBuKys7CiAgICAgICAgICBibF9jb3VudFs5XSsrOwogICAgICAgIH0KICAgICAgICB3aGlsZSAobiA8PSAyNzkpIHsKICAgICAgICAgIHN0YXRpY19sdHJlZVtuICogMiArIDFdID0gNzsKICAgICAgICAgIG4rKzsKICAgICAgICAgIGJsX2NvdW50WzddKys7CiAgICAgICAgfQogICAgICAgIHdoaWxlIChuIDw9IDI4NykgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA4OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbOF0rKzsKICAgICAgICB9CiAgICAgICAgZ2VuX2NvZGVzKHN0YXRpY19sdHJlZSwgTF9DT0RFUyArIDEsIGJsX2NvdW50KTsKICAgICAgICBmb3IgKG4gPSAwOyBuIDwgRF9DT0RFUzsgbisrKSB7CiAgICAgICAgICBzdGF0aWNfZHRyZWVbbiAqIDIgKyAxXSA9IDU7CiAgICAgICAgICBzdGF0aWNfZHRyZWVbbiAqIDJdID0gYmlfcmV2ZXJzZShuLCA1KTsKICAgICAgICB9CiA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aV92YWxpZCA+IDApIHsKICAgICAgICAgIHMucGVuZGluZ19idWZbcy5wZW5kaW5nKytdID0gcy5iaV9idWY7CiAgICAgICAgfQogICAgICAgIHMuYmlfYnVmID0gMDsKICAgICAgICBzLmJpX3ZhbGlkID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBjb3B5X2Jsb2NrKHMsIGJ1ZiwgbGVuLCBoZWFkZXIpIHsKICAgICAgICBiaV93aW5kdXAocyk7CiAgICAgICAgaWYgKGhlYWRlcikgewogICAgICAgICAgcHV0X3Nob3J0KHMsIGxlbik7CiAgICAgICAgICBwdXRfc2hvcnQocywgfmxlbik7CiAgICAgICAgfQogICAgICAgIHV0aWxzLmFycmF5U2V0KHMucGVuZGluZ19idWYsIHMud2luZG93LCBidWYsIGxlbiwgcy5wZW5kaW5nKTsKICAgICAgICBzLnBlbmRpbmcgKz0gbGVuOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNtYWxsZXIodHJlZSwgbiwgbSwgZGVwdGgpIHsKICAgICAgICB2YXIgX24yID0gbiAqIDI7CiAgICAgICAgdmFyIF9tMiA9IG0gKiAyOwogICAgICAgIHJldHVybiB0cmVlW19uMl0gPCB0cmVlW19tMl0gfHwgdHJlZVtfbjJdID09PSB0cmVlW19tMl0gJiYgZGVwdGhbbl0gPD0gZGVwdGhbbV07CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcHFkb3duaGVhcChzLCB0cmVlLCBrKSB7CiAgICAgICAgdmFyIHYgPSBzLmhlYXBba107CiAgICAgICAgdmFyIGogPSBrIDw8IDE7CiAgICAgICAgd2hpbGUgKGogPD0gcy5oZWFwX2xlbikgewogICAgICAgICAgaWYgKGogPCBzLmhlYXBfbGVuICYmIHNtYWxsZXIodHJlZSwgcy5oZWFwW2ogKyAxXSwgcy5oZWFwW2pdLCBzLmRlcHRoKSkgewogICAgICAgICAgICBqKys7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc21hbGxlcih0cmVlLCB2LCBzLmhlYXBbal0sIHMuZGVwdGgpKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgcy5oZWFwW2tdID0gcy5oZWFwW2pdOwogICAgICAgICAgayA9IGo7CiAgICAgICAgICBqIDw8PSAxOwogICAgICAgIH0KICAgICAgICBzLmhlYXBba10gPSB2OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGNvbXByZXNzX2Jsb2NrKHMsIGx0cmVlLCBkdHJlZSkgewogICAgICAgIHZhciBkaXN0OwogICAgICAgIHZhciBsYzsKICAgICAgICB2YXIgbHggPSAwOwogICAgICAgIHZhciBjb2RlOwogICAgICAgIHZhciBleHRyYTsKICAgICAgICBpZiAocy5sYXN0X2xpdCAhPT0gMCkgewogICAgICAgICAgZG8gewogICAgICAgICAgICBkaXN0ID0gcy5wZW5kaW5nX2J1ZltzLmRfYnVmICsgbHggKiAyXSA8PCA4IHwgcy5wZW5kaW5nX2J1ZltzLmRfYnVmICsgbHggKiAyICsgMV07CiAgICAgICAgICAgIGxjID0gcy5wZW5kaW5nX2J1ZltzLmxfYnVmICsgbHhdOwogICAgICAgICAgICBseCsrOwogICAgICAgICAgICBpZiAoZGlzdCA9PT0gMCkgewogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBsYywgbHRyZWUpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGNvZGUgPSBfbGVuZ3RoX2NvZGVbbGNdOwogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjb2RlICsgTElURVJBTFMgKyAxLCBsdHJlZSk7CiAgICAgICAgICAgICAgZXh0cmEgPSBleHRyYV9sYml0c1tjb2RlXTsKICAgICAgICAgICAgICBpZiAoZXh0cmEgIT09IDApIHsKICAgICAgICAgICAgICAgIGxjIC09IGJhc2VfbGVuZ3RoW2NvZGVdOwogICAgICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGxjLCBleHRyYSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGRpc3QtLTsKICAgICAgICAgICAgICBjb2RlID0gZF9jb2RlKGRpc3QpOwogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjb2RlLCBkdHJlZSk7CiAgICAgICAgICAgICAgZXh0cmEgPSBleHRyYV9kYml0c1tjb2RlXTsKICAgICAgICAgICAgICBpZiAoZXh0cmEgIT09IDApIHsKICAgICAgICAgICAgICAgIGRpc3QgLT0gYmFzZV9kaXN0W2NvZGVdOwogICAgICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGRpc3QsIGV4dHJhKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gd2hpbGUgKGx4IDwgcy5sYXN0X2xpdCk7CiAgICAgICAgfQogICAgICAgIHNlbmRfY29kZShzLCBFTkRfQkxPQ0ssIGx0cmVlKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBidWlsZF90cmVlKHMsIGRlc2MpIHsKICAgICAgICB2YXIgdHJlZSA9IGRlc2MuZHluX3RyZWU7CiAgICAgICAgdmFyIHN0cmVlID0gZGVzYy5zdGF0X2Rlc2Muc3RhdGljX3RyZWU7CiAgICAgICAgdmFyIGhhc19zdHJlZSA9IGRlc2Muc3RhdF9kZXNjLmhhc19zdHJlZTsKICAgICAgICB2YXIgZWxlbXMgPSBkZXNjLnN0YXRfZGVzYy5lbGVtczsKICAgICAgICB2YXIgbiwgbTsKICAgICAgICB2YXIgbWF4X2NvZGUgPSAtMTsKICAgICAgICB2YXIgbm9kZTsKICAgICAgICBzLmhlYXBfbGVuID0gMDsKICAgICAgICBzLmhlYXBfbWF4ID0gSEVBUF9TSVpFOwogICAgICAgIGZvciAobiA9IDA7IG4gPCBlbGVtczsgbisrKSB7CiAgICAgICAgICBpZiAodHJlZVtuICogMl0gIT09IDApIHsKICAgICAgICAgICAgcy5oZWFwWysrcy5oZWFwX2xlbl0gPSBtYXhfY29kZSA9IG47CiAgICAgICAgICAgIHMuZGVwdGhbbl0gPSAwOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdHJlZVtuICogMiArIDFdID0gMDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgd2hpbGUgKHMuaGVhcF9sZW4gPCAyKSB7CiAgICAgICAgICBub2RlID0gcy5oZWFwWysrcy5oZWFwX2xlbl0gPSBtYXhfY29kZSA8IDIgPyArK21heF9jb2RlIDogMDsKICAgICAgICAgIHRyZWVbbm9kZSAqIDJdID0gMTsKICAgICAgICAgIHMuZGVwdGhbbm9kZV0gPSAwOwogICAgICAgICAgcy5vcHRfbGVuLS07CiAgICAgICAgICBpZiAoaGFzX3N0cmVlKSB7CiAgICAgICAgICAgIHMuc3RhdGljX2xlbiAtPSBzdHJlZVtub2RlICogMiArIDFdOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkZXNjLm1heF9jb2RlID0gbWF4X2NvZGU7CiAgICAgICAgZm9yIChuID0gcy5oZWFwX2xlbiA+PiAxOyBuID49IDE7IG4tLSkgewogICAgICAgICAgcHFkb3duaGVhcChzLCB0cmVlLCBuKTsKICAgICAgICB9CiAgICAgICAgbm9kZSA9IGVsZW1zOwogICAgICAgIGRvIHsKICAgICAgICAgIG4gPSBzLmhlYXBbMV07CiAgICAgICAgICBzLmhlYXBbMV0gPSBzLmhlYXBbcy5oZWFwX2xlbi0tXTsKICAgICAgICAgIHBxZG93bmhlYXAocywgdHJlZSwgMSk7CiAgICAgICAgICBtID0gcy5oZWFwWzFdOwogICAgICAgICAgcy5oZWFwWy0tcy5oZWFwX21heF0gPSBuOwogICAgICAgICAgcy5oZWFwWy0tcy5oZWFwX21heF0gPSBtOwogICAgICAgICAgdHJlZVtub2RlICogMl0gPSB0cmVlW24gKiAyXSArIHRyZWVbbSAqIDJdOwogICAgICAgICAgcy5kZXB0aFtub2RlXSA9IChzLmRlcHRoW25dID49IHMuZGVwdGhbbV0gPyBzLmRlcHRoW25dIDogcy5kZXB0aFttXSkgKyAxOwogICAgICAgICAgdHJlZVtuICogMiArIDFdID0gdHJlZVttICogMiArIDFdID0gbm9kZTsKICAgICAgICAgIHMuaGVhcFsxXSA9IG5vZGUrKzsKICAgICAgICAgIHBxZG93bmhlYXAocywgdHJlZSwgMSk7CiAgICAgICAgfSB3aGlsZSAocy5oZWFwX2xlbiA+PSAyKTsKICAgICAgICBzLmhlYXBbLS1zLmhlYXBfbWF4XSA9IHMuaGVhcFsxXTsKICAgICAgICBnZW5fYml0bGVuKHMsIGRlc2MpOwogICAgICAgIGdlbl9jb2Rlcyh0cmVlLCBtYXhfY29kZSwgcy5ibF9jb3VudCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2Nhbl90cmVlKHMsIHRyZWUsIG1heF9jb2RlKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIHByZXZsZW4gPSAtMTsKICAgICAgICB2YXIgY3VybGVuOwogICAgICAgIHZhciBuZXh0bGVuID0gdHJlZVswICogMiArIDFdOwogICAgICAgIHZhciBjb3VudCA9IDA7CiAgICAgICAgdmFyIG1heF9jb3VudCA9IDc7CiAgICAgICAgdmFyIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgIG1heF9jb3VudCA9IDEzODsKICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgfQogICAgICAgIHRyZWVbKG1heF9jb2RlICsgMSkgKiAyICsgMV0gPSA2NTUzNTsKICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IG1heF9jb2RlOyBuKyspIHsKICAgICAgICAgIGN1cmxlbiA9IG5leHRsZW47CiAgICAgICAgICBuZXh0bGVuID0gdHJlZVsobiArIDEpICogMiArIDFdOwogICAgICAgICAgaWYgKCsrY291bnQgPCBtYXhfY291bnQgJiYgY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkgewogICAgICAgICAgICBzLmJsX3RyZWVbY3VybGVuICogMl0gKz0gY291bnQ7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiAhPT0gMCkgewogICAgICAgICAgICBpZiAoY3VybGVuICE9PSBwcmV2bGVuKSB7CiAgICAgICAgICAgICAgcy5ibF90cmVlW2N1cmxlbiAqIDJdKys7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcy5ibF90cmVlW1JFUF8zXzYgKiAyXSsrOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkgewogICAgICAgICAgICBzLmJsX3RyZWVbUkVQWl8zXzEwICogMl0rKzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuYmxfdHJlZVtSRVBaXzExXzEzOCAqIDJdKys7CiAgICAgICAgICB9CiAgICAgICAgICBjb3VudCA9IDA7CiAgICAgICAgICBwcmV2bGVuID0gY3VybGVuOwogICAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gMTM4OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIGlmIChjdXJsZW4gPT09IG5leHRsZW4pIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNjsKICAgICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDc7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNlbmRfdHJlZShzLCB0cmVlLCBtYXhfY29kZSkgewogICAgICAgIHZhciBuOwogICAgICAgIHZhciBwcmV2bGVuID0gLTE7CiAgICAgICAgdmFyIGN1cmxlbjsKICAgICAgICB2YXIgbmV4dGxlbiA9IHRyZWVbMCAqIDIgKyAxXTsKICAgICAgICB2YXIgY291bnQgPSAwOwogICAgICAgIHZhciBtYXhfY291bnQgPSA3OwogICAgICAgIHZhciBtaW5fY291bnQgPSA0OwogICAgICAgIGlmIChuZXh0bGVuID09PSAwKSB7CiAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IG1heF9jb2RlOyBuKyspIHsKICAgICAgICAgIGN1cmxlbiA9IG5leHRsZW47CiAgICAgICAgICBuZXh0bGVuID0gdHJlZVsobiArIDEpICogMiArIDFdOwogICAgICAgICAgaWYgKCsrY291bnQgPCBtYXhfY291bnQgJiYgY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkgewogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGN1cmxlbiwgcy5ibF90cmVlKTsKICAgICAgICAgICAgfSB3aGlsZSAoLS1jb3VudCAhPT0gMCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiAhPT0gMCkgewogICAgICAgICAgICBpZiAoY3VybGVuICE9PSBwcmV2bGVuKSB7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGN1cmxlbiwgcy5ibF90cmVlKTsKICAgICAgICAgICAgICBjb3VudC0tOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNlbmRfY29kZShzLCBSRVBfM182LCBzLmJsX3RyZWUpOwogICAgICAgICAgICBzZW5kX2JpdHMocywgY291bnQgLSAzLCAyKTsKICAgICAgICAgIH0gZWxzZSBpZiAoY291bnQgPD0gMTApIHsKICAgICAgICAgICAgc2VuZF9jb2RlKHMsIFJFUFpfM18xMCwgcy5ibF90cmVlKTsKICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGNvdW50IC0gMywgMyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzZW5kX2NvZGUocywgUkVQWl8xMV8xMzgsIHMuYmxfdHJlZSk7CiAgICAgICAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDExLCA3KTsKICAgICAgICAgIH0KICAgICAgICAgIGNvdW50ID0gMDsKICAgICAgICAgIHByZXZsZW4gPSBjdXJsZW47CiAgICAgICAgICBpZiAobmV4dGxlbiA9PT0gMCkgewogICAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiA9PT0gbmV4dGxlbikgewogICAgICAgICAgICBtYXhfY291bnQgPSA2OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNzsKICAgICAgICAgICAgbWluX2NvdW50ID0gNDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYnVpbGRfYmxfdHJlZShzKSB7CiAgICAgICAgdmFyIG1heF9ibGluZGV4OwogICAgICAgIHNjYW5fdHJlZShzLCBzLmR5bl9sdHJlZSwgcy5sX2Rlc2MubWF4X2NvZGUpOwogICAgICAgIHNjYW5fdHJlZShzLCBzLmR5bl9kdHJlZSwgcy5kX2Rlc2MubWF4X2NvZGUpOwogICAgICAgIGJ1aWxkX3RyZWUocywgcy5ibF9kZXNjKTsKICAgICAgICBmb3IgKG1heF9ibGluZGV4ID0gQkxfQ09ERVMgLSAxOyBtYXhfYmxpbmRleCA+PSAzOyBtYXhfYmxpbmRleC0tKSB7CiAgICAgICAgICBpZiAocy5ibF90cmVlW2JsX29yZGVyW21heF9ibGluZGV4XSAqIDIgKyAxXSAhPT0gMCkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5vcHRfbGVuICs9IDMgKiAobWF4X2JsaW5kZXggKyAxKSArIDUgKyA1ICsgNDsKICAgICAgICByZXR1cm4gbWF4X2JsaW5kZXg7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2VuZF9hbGxfdHJlZXMocywgbGNvZGVzLCBkY29kZXMsIGJsY29kZXMpIHsKICAgICAgICB2YXIgcmFuazsKICAgICAgICBzZW5kX2JpdHMocywgbGNvZGVzIC0gMjU3LCA1KTsKICAgICAgICBzZW5kX2JpdHMocywgZGNvZGVzIC0gMSwgNSk7CiAgICAgICAgc2VuZF9iaXRzKHMsIGJsY29kZXMgLSA0LCA0KTsKICAgICAgICBmb3IgKHJhbmsgPSAwOyByYW5rIDwgYmxjb2RlczsgcmFuaysrKSB7CiAgICAgICAgICBzZW5kX2JpdHMocywgcy5ibF90cmVlW2JsX29yZGVyW3JhbmtdICogMiArIDFdLCAzKTsKICAgICAgICB9CiAgICAgICAgc2VuZF90cmVlKHMsIHMuZHluX2x0cmVlLCBsY29kZXMgLSAxKTsKICAgICAgICBzZW5kX3RyZWUocywgcy5keW5fZHRyZWUsIGRjb2RlcyAtIDEpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRldGVjdF9kYXRhX3R5cGUocykgewogICAgICAgIHZhciBibGFja19tYXNrID0gNDA5MzYyNDQ0NzsKICAgICAgICB2YXIgbjsKICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IDMxOyBuKyssIGJsYWNrX21hc2sgPj4+PSAxKSB7CiAgICAgICAgICBpZiAoYmxhY2tfbWFzayAmIDEgJiYgcy5keW5fbHRyZWVbbiAqIDJdICE9PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBaX0JJTkFSWTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuZHluX2x0cmVlWzkgKiAyXSAhPT0gMCB8fCBzLmR5bl9sdHJlZVsxMCAqIDJdICE9PSAwIHx8IHMuZHluX2x0cmVlWzEzICogMl0gIT09IDApIHsKICAgICAgICAgIHJldHVybiBaX1RFWFQ7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDMyOyBuIDwgTElURVJBTFM7IG4rKykgewogICAgICAgICAgaWYgKHMuZHluX2x0cmVlW24gKiAyXSAhPT0gMCkgewogICAgICAgICAgICByZXR1cm4gWl9URVhUOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gWl9CSU5BUlk7CiAgICAgIH0KICAgICAgdmFyIHN0YXRpY19pbml0X2RvbmUgPSBmYWxzZTsKICAgICAgZnVuY3Rpb24gX3RyX2luaXQocykgewogICAgICAgIGlmICghc3RhdGljX2luaXRfZG9uZSkgewogICAgICAgICAgdHJfc3RhdGljX2luaXQoKTsKICAgICAgICAgIHN0YXRpY19pbml0X2RvbmUgPSB0cnVlOwogICAgICAgIH0KICAgICAgICBzLmxfZGVzYyA9IG5ldyBUcmVlRGVzYyhzLmR5bl9sdHJlZSwgc3RhdGljX2xfZGVzYyk7CiAgICAgICAgcy5kX2Rlc2MgPSBuZXcgVHJlZURlc2Mocy5keW5fZHRyZWUsIHN0YXRpY19kX2Rlc2MpOwogICAgICAgIHMuYmxfZGVzYyA9IG5ldyBUcmVlRGVzYyhzLmJsX3RyZWUsIHN0YXRpY19ibF9kZXNjKTsKICAgICAgICBzLmJpX2J1ZiA9IDA7CiAgICAgICAgcy5iaV92YWxpZCA9IDA7CiAgICAgICAgaW5pdF9ibG9jayhzKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfdHJfc3RvcmVkX2Jsb2NrKHMsIGJ1Ziwgc3RvcmVkX2xlbiwgbGFzdCkgewogICAgICAgIHNlbmRfYml0cyhzLCAoU1RPUkVEX0JMT0NLIDw8IDEpICsgKGxhc3QgPyAxIDogMCksIDMpOwogICAgICAgIGNvcHlfYmxvY2socywgYnVmLCBzdG9yZWRfbGVuLCB0cnVlKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfdHJfYWxpZ24ocykgewogICAgICAgIHNlbmRfYml0cyhzLCBTVEFUSUNfVFJFRVMgPDwgMSwgMyk7CiAgICAgICAgc2VuZF9jb2RlKHMsIEVORF9CTE9DSywgc3RhdGljX2x0cmVlKTsKICAgICAgICBiaV9mbHVzaChzKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfdHJfZmx1c2hfYmxvY2socywgYnVmLCBzdG9yZWRfbGVuLCBsYXN0KSB7CiAgICAgICAgdmFyIG9wdF9sZW5iLCBzdGF0aWNfbGVuYjsKICAgICAgICB2YXIgbWF4X2JsaW5kZXggPSAwOwogICAgICAgIGlmIChzLmxldmVsID4gMCkgewogICAgICAgICAgaWYgKHMuc3RybS5kYXRhX3R5cGUgPT09IFpfVU5LTk9XTikgewogICAgICAgICAgICBzLnN0cm0uZGF0YV90eXBlID0gZGV0ZWN0X2RhdGFfdHlwZShzKTsKICAgICAgICAgIH0KICAgICAgICAgIGJ1aWxkX3RyZWUocywgcy5sX2Rlc2MpOwogICAgICAgICAgYnVpbGRfdHJlZShzLCBzLmRfZGVzYyk7CiAgICAgICAgICBtYXhfYmxpbmRleCA9IGJ1aWxkX2JsX3RyZWUocyk7CiAgICAgICAgICBvcHRfbGVuYiA9IHMub3B0X2xlbiArIDMgKyA3ID4+PiAzOwogICAgICAgICAgc3RhdGljX2xlbmIgPSBzLnN0YXRpY19sZW4gKyAzICsgNyA+Pj4gMzsKICAgICAgICAgIGlmIChzdGF0aWNfbGVuYiA8PSBvcHRfbGVuYikgewogICAgICAgICAgICBvcHRfbGVuYiA9IHN0YXRpY19sZW5iOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBvcHRfbGVuYiA9IHN0YXRpY19sZW5iID0gc3RvcmVkX2xlbiArIDU7CiAgICAgICAgfQogICAgICAgIGlmIChzdG9yZWRfbGVuICsgNCA8PSBvcHRfbGVuYiAmJiBidWYgIT09IC0xKSB7CiAgICAgICAgICBfdHJfc3RvcmVkX2Jsb2NrKHMsIGJ1Ziwgc3RvcmVkX2xlbiwgbGFzdCk7CiAgICAgICAgfSBlbHNlIGlmIChzLnN0cmF0ZWd5ID09PSBaX0ZJWEVEIHx8IHN0YXRpY19sZW5iID09PSBvcHRfbGVuYikgewogICAgICAgICAgc2VuZF9iaXRzKHMsIChTVEFUSUNfVFJFRVMgPDwgMSkgKyAobGFzdCA/IDEgOiAwKSwgMyk7CiAgICAgICAgICBjb21wcmVzc19ibG9jayhzLCBzdGF0aWNfbHRyZWUsIHN0YXRpY19kdHJlZSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHNlbmRfYml0cyhzLCAoRFlOX1RSRUVTIDw8IDEpICsgKGxhc3QgPyAxIDogMCksIDMpOwogICAgICAgICAgc2VuZF9hbGxfdHJlZXMocywgcy5sX2Rlc2MubWF4X2NvZGUgKyAxLCBzLmRfZGVzYy5tYXhfY29kZSArIDEsIG1heF9ibGluZGV4ICsgMSk7CiAgICAgICAgICBjb21wcmVzc19ibG9jayhzLCBzLmR5bl9sdHJlZSwgcy5keW5fZHRyZWUpOwogICAgICAgIH0KICAgICAgICBpbml0X2Jsb2NrKHMpOwogICAgICAgIGlmIChsYXN0KSB7CiAgICAgICAgICBiaV93aW5kdXAocyk7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIF90cl90YWxseShzLCBkaXN0LCBsYykgewogICAgICAgIHMucGVuZGluZ19idWZbcy5kX2J1ZiArIHMubGFzdF9saXQgKiAyXSA9IGRpc3QgPj4+IDggJiAyNTU7CiAgICAgICAgcy5wZW5kaW5nX2J1ZltzLmRfYnVmICsgcy5sYXN0X2xpdCAqIDIgKyAxXSA9IGRpc3QgJiAyNTU7CiAgICAgICAgcy5wZW5kaW5nX2J1ZltzLmxfYnVmICsgcy5sYXN0X2xpdF0gPSBsYyAmIDI1NTsKICAgICAgICBzLmxhc3RfbGl0Kys7CiAgICAgICAgaWYgKGRpc3QgPT09IDApIHsKICAgICAgICAgIHMuZHluX2x0cmVlW2xjICogMl0rKzsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgcy5tYXRjaGVzKys7CiAgICAgICAgICBkaXN0LS07CiAgICAgICAgICBzLmR5bl9sdHJlZVsoX2xlbmd0aF9jb2RlW2xjXSArIExJVEVSQUxTICsgMS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SArIGJ1Zltwb3MrK10gfCAwOwogICAgICAgICAgICBzMiA9IHMyICsgczEgfCAwOwogICAgICAgICAgfSB3aGlsZSAoLS1uKTsKICAgICAgICAgIHMxICU9IDY1NTIxOwogICAgICAgICAgczIgJT0gNjU1MjE7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzMSB8IHMyIDw8IDE2IHwgMDsKICAgICAgfQogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBhZGxlcjMyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvY3JjMzIuanMKICB2YXIgcmVxdWlyZV9jcmMzMiA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9jcmMzMi5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIGZ1bmN0aW9uIG1ha2VUYWJsZSgpIHsKICAgICAgICB2YXIgYywgdGFibGUgPSBbXTsKICAgICAgICBmb3IgKHZhciBuID0gMDsgbiA8IDI1NjsgbisrKSB7CiAgICAgICAgICBjID0gbjsKICAgICAgICAgIGZvciAodmFyIGsgPSAwOyBrIDwgODsgaysrKSB7CiAgICAgICAgICAgIGMgPSBjICYgMSA/IDM5ODgyOTIzODQgXiBjID4+PiAxIDogYyA+Pj4gMTsKICAgICAgICAgIH0KICAgICAgICAgIHRhYmxlW25dID0gYzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRhYmxlOwogICAgICB9CiAgICAgIHZhciBjcmNUYWJsZSA9IG1ha2VUYWJsZSgpOwogICAgICBmdW5jdGlvbiBjcmMzMihjcmMsIGJ1ZiwgbGVuLCBwb3MpIHsKICAgICAgICB2YXIgdCA9IGNyY1RhYmxlLCBlbmQgPSBwb3MgKyBsZW47CiAgICAgICAgY3JjIF49IC0xOwogICAgICAgIGZvciAodmFyIGkgPSBwb3M7IGkgPCBlbmQ7IGkrKykgewogICAgICAgICAgY3JjID0gY3JjID4+PiA4IF4gdFsoY3JjIF4gYnVmW2ldKSAmIDI1NV07CiAgICAgICAgfQogICAgICAgIHJldHVybiBjcmMgXiAtMTsKICAgICAgfQogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBjcmMzMjsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL21lc3NhZ2VzLmpzCiAgdmFyIHJlcXVpcmVfbWVzc2FnZXMgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvbWVzc2FnZXMuanMiKGV4cG9ydHMyLCBtb2R1bGUyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSB7CiAgICAgICAgMjogIm5lZWQgZGljdGlvbmFyeSIsCiAgICAgICAgMTogInN0cmVhbSBlbmQiLAogICAgICAgIDA6ICIiLAogICAgICAgICItMSI6ICJmaWxlIGVycm9yIiwKICAgICAgICAiLTIiOiAic3RyZWFtIGVycm9yIiwKICAgICAgICAiLTMiOiAiZGF0YSBlcnJvciIsCiAgICAgICAgIi00IjogImluc3VmZmljaWVudCBtZW1vcnkiLAogICAgICAgICItNSI6ICJidWZmZXIgZXJyb3IiLAogICAgICAgICItNiI6ICJpbmNvbXBhdGlibGUgdmVyc2lvbiIKICAgICAgfTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2RlZm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0ubXNnID0gbXNnW2Vycm9yQ29kZV07CiAgICAgICAgcmV0dXJuIGVycm9yQ29kZTsKICAgICAgfQogICAgICBmdW5jdGlvbiByYW5rKGYpIHsKICAgICAgICByZXR1cm4gKGYgPDwgMSkgLSAoZiA+IDQgPyA5IDogMCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gemVybyhidWYpIHsKICAgICAgICB2YXIgbGVuID0gYnVmLmxlbmd0aDsKICAgICAgICB3aGlsZSAoLS1sZW4gPj0gMCkgewogICAgICAgICAgYnVmW2xlbl0gPSAwOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBmbHVzaF9wZW5kaW5nKHN0cm0pIHsKICAgICAgICB2YXIgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgdmFyIGxlbiA9IHMucGVuZGluZzsKICAgICAgICBpZiAobGVuID4gc3RybS5hdmFpbF9vdXQpIHsKICAgICAgICAgIGxlbiA9IHN0cm0uYXZhaWxfb3V0OwogICAgICAgIH0KICAgICAgICBpZiAobGVuID09PSAwKSB7CiAgICAgICAgICByZXR1cm47CiAgICAgICAgfQogICAgICAgIHV0aWxzLmFycmF5U2V0KHN0cm0ub3V0cHV0LCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmdfb3V0LCBsZW4sIHN0cm0ubmV4dF9vdXQpOwogICAgICAgIHN0cm0ubmV4dF9vdXQgKz0gbGVuOwogICAgICAgIHMucGVuZGluZ19vdXQgKz0gbGVuOwogICAgICAgIHN0cm0udG90YWxfb3V0ICs9IGxlbjsKICAgICAgICBzdHJtLmF2YWlsX291dCAtPSBsZW47CiAgICAgICAgcy5wZW5kaW5nIC09IGxlbjsKICAgICAgICBpZiAocy5wZW5kaW5nID09PSAwKSB7CiAgICAgICAgICBzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZmx1c2hfYmxvY2tfb25seShzLCBsYXN0KSB7CiAgICAgICAgdHJlZXMuX3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ICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgYnVmLCBsZW4sIHN0YXJ0KTsKICAgICAgICB9CiAgICAgICAgc3RybS5uZXh0X2luICs9IGxlbjsKICAgICAgICBzdHJtLnRvdGFsX2luICs9IGxlbjsKICAgICAgICByZXR1cm4gbGVuOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGxvbmdlc3RfbWF0Y2gocywgY3VyX21hdGNoKSB7CiAgICAgICAgdmFyIGNoYWluX2xlbmd0aCA9IHMubWF4X2NoYWluX2xlbmd0aDsKICAgICAgICB2YXIgc2NhbiA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgdmFyIG1hdGNoOwogICAgICAgIHZhciBsZW47CiAgICAgICAgdmFyIGJlc3RfbGVuID0gcy5wcmV2X2xlbmd0aDsKICAgICAgICB2YXIgbmljZV9tYXRjaCA9IHMubmljZV9tYXRjaDsKICAgICAgICB2YXIgbGltaXQgPSBzLnN0cnN0YXJ0ID4gcy53X3NpemUgLSBNSU5fTE9PS0FIRUFEID8gcy5zdHJzdGFydCAtIChzLndfc2l6ZSAtIE1JTl9MT09LQUhFQUQpIDogMDsKICAgICAgICB2YXIgX3dpbiA9IHMud2luZG93OwogICAgICAgIHZhciB3bWFzayA9IHMud19tYXNrOwogICAgICAgIHZhciBwcmV2ID0gcy5wcmV2OwogICAgICAgIHZhciBzdHJlbmQgPSBzLnN0cnN0YXJ0ICsgTUFYX01BVENIOwogICAgICAgIHZhciBzY2FuX2VuZDEgPSBfd2luW3NjYW4gKyBiZXN0X2xlbiAtIDFdOwogICAgICAgIHZhciBzY2FuX2VuZCA9IF93aW5bc2NhbiArIGJlc3RfbGVuXTsKICAgICAgICBpZiAocy5wcmV2X2xlbmd0aCA+PSBzLmdvb2RfbWF0Y2gpIHsKICAgICAgICAgIGNoYWluX2xlbmd0aCA+Pj0gMjsKICAgICAgICB9CiAgICAgICAgaWYgKG5pY2VfbWF0Y2ggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgbmljZV9tYXRjaCA9IHMubG9va2FoZWFkOwogICAgICAgIH0KICAgICAgICBkbyB7CiAgICAgICAgICBtYXRjaCA9IGN1cl9tYXRjaDsKICAgICAgICAgIGlmIChfd2luW21hdGNoICsgYmVzdF9sZW5dICE9PSBzY2FuX2VuZCB8fCBfd2luW21hdGNoICsgYmVzdF9sZW4gLSAxXSAhPT0gc2Nhbl9lbmQxIHx8IF93aW5bbWF0Y2hdICE9PSBfd2luW3NjYW5dIHx8IF93aW5bKyttYXRjaF0gIT09IF93aW5bc2NhbiArIDFdKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgc2NhbiArPSAyOwogICAgICAgICAgbWF0Y2grKzsKICAgICAgICAgIGRvIHsKICAgICAgICAgIH0gd2hpbGUgKF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgc2NhbiA8IHN0cmVuZCk7CiAgICAgICAgICBsZW4gPSBNQVhfTUFUQ0ggLSAoc3RyZW5kIC0gc2Nhbik7CiAgICAgICAgICBzY2FuID0gc3RyZW5kIC0gTUFYX01BVENIOwogICAgICAgICAgaWYgKGxlbiA+IGJlc3RfbGVuKSB7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgPSBjdXJfbWF0Y2g7CiAgICAgICAgICAgIGJlc3RfbGVuID0gbGVuOwogICAgICAgICAgICBpZiAobGVuID49IG5pY2VfbWF0Y2gpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBzY2FuX2VuZDEgPSBfd2luW3NjYW4gKyBiZXN0X2xlbiAtIDFdOwogICAgICAgICAgICBzY2FuX2VuZCA9IF93aW5bc2NhbiArIGJlc3RfbGVuXTsKICAgICAgICAgIH0KICAgICAgICB9IHdoaWxlICgoY3VyX21hdGNoID0gcHJldltjdXJfbWF0Y2ggJiB3bWFza10pID4gbGltaXQgJiYgLS1jaGFpbl9sZW5ndGggIT09IDApOwogICAgICAgIGlmIChiZXN0X2xlbiA8PSBzLmxvb2thaGVhZCkgewogICAgICAgICAgcmV0dXJuIGJlc3RfbGVuOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcy5sb29rYWhlYWQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZmlsbF93aW5kb3cocykgewogICAgICAgIHZhciBfd19zaXplID0gcy53X3NpemU7CiAgICAgICAgdmFyIHAsIG4sIG0sIG1vcmUsIHN0cjsKICAgICAgICBkbyB7CiAgICAgICAgICBtb3JlID0gcy53aW5kb3dfc2l6ZSAtIHMubG9va2FoZWFkIC0gcy5zdHJzdGFydDsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID49IF93X3NpemUgKyAoX3dfc2l6ZSAtIE1JTl9MT09LQUhFQUQpKSB7CiAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHMud2luZG93LCBzLndpbmRvdywgX3dfc2l6ZSwgX3dfc2l6ZSwgMCk7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgLT0gX3dfc2l6ZTsKICAgICAgICAgICAgcy5zdHJzdGFydCAtPSBfd19zaXplOwogICAgICAgICAgICBzLmJsb2NrX3N0YXJ0IC09IF93X3NpemU7CiAgICAgICAgICAgIG4gPSBzLmhhc2hfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5oZWFkWy0tcF07CiAgICAgICAgICAgICAgcy5oZWFkW3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBuID0gX3dfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5wcmV2Wy0tcF07CiAgICAgICAgICAgICAgcy5wcmV2W3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBtb3JlICs9IF93X3NpemU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX2luID09PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgbiA9IHJlYWRfYnVmKHMuc3RybSwgcy53aW5kb3csIHMuc3Ryc3RhcnQgKyBzLmxvb2thaGVhZCwgbW9yZSk7CiAgICAgICAgICBzLmxvb2thaGVhZCArPSBuOwogICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHN0ciA9IHMuc3Ryc3RhcnQgLSBzLmluc2VydDsKICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3N0cl07CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzdHIgKyAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgd2hpbGUgKHMuaW5zZXJ0KSB7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3N0ciArIE1JTl9NQVRDSCAtIDFdKSAmIHMuaGFzaF9tYXNrOwogICAgICAgICAgICAgIHMucHJldltzdHIgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gc3RyOwogICAgICAgICAgICAgIHN0cisrOwogICAgICAgICAgICAgIHMuaW5zZXJ0LS07CiAgICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPCBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBzLnN0cm0uYXZhaWxfaW4gIT09IDApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVfc3RvcmVkKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIG1heF9ibG9ja19zaXplID0gNjU1MzU7CiAgICAgICAgaWYgKG1heF9ibG9ja19zaXplID4gcy5wZW5kaW5nX2J1Zl9zaXplIC0gNSkgewogICAgICAgICAgbWF4X2Jsb2NrX3NpemUgPSBzLnBlbmRpbmdfYnVmX3NpemUgLSA1OwogICAgICAgIH0KICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8PSAxKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDAgJiYgZmx1c2ggPT09IFpfTk9fRkxVU0gpIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBzLnN0cnN0YXJ0ICs9IHMubG9va2FoZWFkOwogICAgICAgICAgcy5sb29rYWhlYWQgPSAwOwogICAgICAgICAgdmFyIG1heF9zdGFydCA9IHMuYmxvY2tfc3RhcnQgKyBtYXhfYmxvY2tfc2l6ZTsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID09PSAwIHx8IHMuc3Ryc3RhcnQgPj0gbWF4X3N0YXJ0KSB7CiAgICAgICAgICAgIHMubG9va2FoZWFkID0gcy5zdHJzdGFydCAtIG1heF9zdGFydDsKICAgICAgICAgICAgcy5zdHJzdGFydCA9IG1heF9zdGFydDsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgLSBzLmJsb2NrX3N0YXJ0ID49IHMud19zaXplIC0gTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5zdHJzdGFydCA+IHMuYmxvY2tfc3RhcnQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX2Zhc3QocywgZmx1c2gpIHsKICAgICAgICB2YXIgaGFzaF9oZWFkOwogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEICYmIGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDApIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaGFzaF9oZWFkID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgaGFzaF9oZWFkID0gcy5wcmV2W3Muc3Ryc3RhcnQgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoaGFzaF9oZWFkICE9PSAwICYmIHMuc3Ryc3RhcnQgLSBoYXNoX2hlYWQgPD0gcy53X3NpemUgLSBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gbG9uZ2VzdF9tYXRjaChzLCBoYXNoX2hlYWQpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHMubWF0Y2hfbGVuZ3RoID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICBiZmx1c2ggPSB0cmVlcy5fdHJfdGFsbHkocywgcy5zdHJzdGFydCAtIHMubWF0Y2hfc3RhcnQsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA8PSBzLm1heF9sYXp5X21hdGNoICYmIHMubG9va2FoZWFkID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoLS07CiAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9IHdoaWxlICgtLXMubWF0Y2hfbGVuZ3RoICE9PSAwKTsKICAgICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcy5zdHJzdGFydCArPSBzLm1hdGNoX2xlbmd0aDsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3Muc3Ryc3RhcnRdOwogICAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IHMuc3Ryc3RhcnQgPCBNSU5fTUFUQ0ggLSAxID8gcy5zdHJzdGFydCA6IE1JTl9NQVRDSCAtIDE7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9zbG93KHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGhhc2hfaGVhZDsKICAgICAgICB2YXIgYmZsdXNoOwogICAgICAgIHZhciBtYXhfaW5zZXJ0OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGhhc2hfaGVhZCA9IDA7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgTUlOX01BVENIIC0gMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICBzLmhlYWRbcy5pbnNfaF0gPSBzLnN0cnN0YXJ0OwogICAgICAgICAgfQogICAgICAgICAgcy5wcmV2X2xlbmd0aCA9IHMubWF0Y2hfbGVuZ3RoOwogICAgICAgICAgcy5wcmV2X21hdGNoID0gcy5tYXRjaF9zdGFydDsKICAgICAgICAgIHMubWF0Y2hfbGV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FzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gd2hpbGUgKC0tcy5wcmV2X2xlbmd0aCAhPT0gMCk7CiAgICAgICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMDsKICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAocy5tYXRjaF9hdmFpbGFibGUpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5tYXRjaF9hdmFpbGFibGUgPSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLm1hdGNoX2F2YWlsYWJsZSkgewogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICBzLm1hdGNoX2F2YWlsYWJsZSA9IDA7CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gcy5zdHJzdGFydCA8IE1JTl9NQVRDSCAtIDEgPyBzLnN0cnN0YXJ0IDogTUlOX01BVENIIC0gMTsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5sYXN0X2xpdCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gQlNfQkxPQ0tfRE9ORTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX3JsZShzLCBmbHVzaCkgewogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgdmFyIHByZXY7CiAgICAgICAgdmFyIHNjYW4sIHN0cmVuZDsKICAgICAgICB2YXIgX3dpbiA9IHMud2luZG93OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0ggJiYgcy5zdHJzdGFydCA+IDApIHsKICAgICAgICAgICAgc2NhbiA9IHMuc3Ryc3RhcnQgLSAxOwogICAgICAgICAgICBwcmV2ID0gX3dpbltzY2FuXTsKICAgICAgICAgICAgaWYgKHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dKSB7CiAgICAgICAgICAgICAgc3RyZW5kID0gcy5zdHJzdGFydCArIE1BWF9NQVRDSDsKICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgfSB3aGlsZSAocHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBzY2FuIDwgc3RyZW5kKTsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IE1BWF9NQVRDSCAtIChzdHJlbmQgLSBzY2FuKTsKICAgICAgICAgICAgICBpZiAocy5tYXRjaF9sZW5ndGggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBzLmxvb2thaGVhZDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDEsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgKz0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IDA7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9odWZmKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGJmbHVzaDsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSAwOwogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnRdKTsKICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgIGlmIChmbHVzaCA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgdHJ1ZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX1NUQVJURUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX0RPTkU7CiAgICAgICAgfQogICAgICAgIGlmIChzLmxhc3RfbGl0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBCU19CTE9DS19ET05FOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIENvbmZpZyhnb29kX2xlbmd0aCwgbWF4X2xhenksIG5pY2VfbGVuZ3RoLCBtYXhfY2hhaW4sIGZ1bmMpIHsKICAgICAgICB0aGlzLmdvb2RfbGVuZ3RoID0gZ29vZF9sZW5ndGg7CiAgICAgICAgdGhpcy5tYXhfbGF6eSA9IG1heF9sYXp5OwogICAgICAgIHRoaXMubmljZV9sZW5ndGggPSBuaWNlX2xlbmd0aDsKICAgICAgICB0aGlzLm1heF9jaGFpbiA9IG1heF9jaGFpbjsKICAgICAgICB0aGlzLmZ1bmMgPSBmdW5jOwogICAgICB9CiAgICAgIHZhciBjb25maWd1cmF0aW9uX3RhYmxlOwogICAgICBjb25maWd1cmF0aW9uX3RhYmxlID0gWwogICAgICAgIG5ldyBDb25maWcoMCwgMCwgMCwgMCwgZGV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AgICAgcy5zdHJzdGFydCA9IDA7CiAgICAgICAgcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgcy5sb29rYWhlYWQgPSAwOwogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IHMucHJldl9sZW5ndGggPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMDsKICAgICAgICBzLmluc19oID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBEZWZsYXRlU3RhdGUoKSB7CiAgICAgICAgdGhpcy5zdHJtID0gbnVsbDsKICAgICAgICB0aGlzLnN0YXR1cyA9IDA7CiAgICAgICAgdGhpcy5wZW5kaW5nX2J1ZiA9IG51bGw7CiAgICAgICAgdGhpcy5wZW5kaW5nX2J1Zl9zaXplID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmcgPSAwOwogICAgICAgIHRoaXMud3JhcCA9IDA7CiAgICAgICAgdGhpcy5nemhlYWQgPSBudWxsOwogICAgICAgIHRoaXMuZ3ppbmRleCA9IDA7CiAgICAgICAgdGhpcy5tZXRob2QgPSBaX0RFRkxBVEVEOwogICAgICAgIHRoaXMubGFzdF9mbHVzaCA9IC0xOwogICAgICAgIHRoaXMud19zaXplID0gMDsKICAgICAgICB0aGlzLndfYml0cyA9IDA7CiAgICAgICAgdGhpcy53X21hc2sgPSAwOwogICAgICAgIHRoaXMud2luZG93ID0gbnVsbDsKICAgICAgICB0aGlzLndpbmRvd19zaXplID0gMDsKICAgICAgICB0aGlzLnByZXYgPSBudWxsOwogICAgICAgIHRoaXMuaGVhZCA9IG51bGw7CiAgICAgICAgdGhpcy5pbnNfaCA9IDA7CiAgICAgICAgdGhpcy5oYXNoX3NpemUgPSAwOwogICAgICAgIHRoaXMuaGFzaF9iaXRzID0gMDsKICAgICAgICB0aGlzLmhhc2hfbWFzayA9IDA7CiAgICAg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QVhfQklUUyArIDEpOwogICAgICAgIHRoaXMuaGVhcCA9IG5ldyB1dGlscy5CdWYxNigyICogTF9DT0RFUyArIDEpOwogICAgICAgIHplcm8odGhpcy5oZWFwKTsKICAgICAgICB0aGlzLmhlYXBfbGVuID0gMDsKICAgICAgICB0aGlzLmhlYXBfbWF4ID0gMDsKICAgICAgICB0aGlzLmRlcHRoID0gbmV3IHV0aWxzLkJ1ZjE2KDIgKiBMX0NPREVTICsgMSk7CiAgICAgICAgemVybyh0aGlzLmRlcHRoKTsKICAgICAgICB0aGlzLmxfYnVmID0gMDsKICAgICAgICB0aGlzLmxpdF9idWZzaXplID0gMDsKICAgICAgICB0aGlzLmxhc3RfbGl0ID0gMDsKICAgICAgICB0aGlzLmRfYnVmID0gMDsKICAgICAgICB0aGlzLm9wdF9sZW4gPSAwOwogICAgICAgIHRoaXMuc3RhdGljX2xlbiA9IDA7CiAgICAgICAgdGhpcy5tYXRjaGVzID0gMDsKICAgICAgICB0aGlzLmluc2VydCA9IDA7CiAgICAgICAgdGhpcy5iaV9idWYgPSAwOwogICAgICAgIHRoaXMuYmlfdmFsaWQgPSAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVSZXNldEtlZXAoc3RybSkgewogICAgICAgIHZhciBzOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBaX1NUUkVBTV9FUlJPUik7CiAgICAgICAgfQogICAgICAgIHN0cm0udG90YWxfaW4gPSBzdHJtLnRvdGFsX291dCA9IDA7CiAgICAgICAgc3RybS5kYXRhX3R5cGUgPSBaX1VOS05PV047CiAgICAgICAgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgcy5wZW5kaW5nID0gMDsKICAgICAgICBzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICBpZiAocy53cmFwIDwgMCkgewogICAgICAgICAgcy53cmFwID0gLXMud3JhcDsKICAgICAgICB9CiAgICAgICAgcy5zdGF0dXMgPSBzLndyYXAgPyBJTklUX1NUQVRFIDogQlVTWV9TVEFURTsKICAgICAgICBzdHJtLmFkbGVyID0gcy53cmFwID09PSAyID8gMCA6IDE7CiAgICAgICAgcy5sYXN0X2ZsdXNoID0gWl9OT19GTFVTSDsKICAgICAgICB0cmVlcy5fdHJfaW5pdChzKTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlUmVzZXQoc3RybSkgewogICAgICAgIHZhciByZXQgPSBkZWZsYXRlUmVzZXRLZWVwKHN0cm0pOwogICAgICAgIGlmIChyZXQgPT09IFpfT0spIHsKICAgICAgICAgIGxtX2luaXQoc3RybS5zdGF0ZSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZVNldEhlYWRlcihzdHJtLCBoZWFkKSB7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdHJtLnN0YXRlLndyYXAgIT09IDIpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RybS5zdGF0ZS5nemhlYWQgPSBoZWFkOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVJbml0MihzdHJtLCBsZXZlbCwgbWV0aG9kLCB3aW5kb3dCaXRzLCBtZW1MZXZlbCwgc3RyYXRlZ3kpIHsKICAgICAgICBpZiAoIXN0cm0pIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgdmFyIHdyYXAgPSAxOwogICAgICAgIGlmIChsZXZlbCA9PT0gWl9ERUZBVUxUX0NPTVBSRVNTSU9OKSB7CiAgICAgICAgICBsZXZlbCA9IDY7CiAgICAgICAgfQogICAgICAgIGlmICh3aW5kb3dCaXRzIDwgMCkgewogICAgICAgICAgd3JhcCA9IDA7CiAgICAgICAgICB3aW5kb3dCaXRzID0gLXdpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIGlmICh3aW5kb3dCaXRzID4gMTUpIHsKICAgICAgICAgIHdyYXAgPSAyOwogICAgICAgICAgd2luZG93Qml0cyAtPSAxNjsKICAgICAgICB9CiAgICAgICAgaWYgKG1lbUxldmVsIDwgMSB8fCBtZW1MZXZlbCA+IE1BWF9NRU1fTEVWRUwgfHwgbWV0aG9kICE9PSBaX0RFRkxBVEVEIHx8IHdpbmRvd0JpdHMgPCA4IHx8IHdpbmRvd0JpdHMgPiAxNSB8fCBsZXZlbCA8IDAgfHwgbGV2ZWwgPiA5IHx8IHN0cmF0ZWd5IDwgMCB8fCBzdHJhdGVneSA+IFpfRklYRUQpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBpZiAod2luZG93Qml0cyA9PT0gOCkgewogICAgICAgICAgd2luZG93Qml0cyA9IDk7CiAgICAgICAgfQogICAgICAgIHZhciBzID0gbmV3IERlZmxhdGVTdGF0ZSgpOwogICAgICAgIHN0cm0uc3RhdGUgPSBzOwogICAgICAgIHMuc3RybSA9IHN0cm07CiAgICAgICAgcy53cmFwID0gd3JhcDsKICAgICAgICBzLmd6aGVhZCA9IG51bGw7CiAgICAgICAgcy53X2JpdHMgPSB3aW5kb3dCaXRzOwogICAgICAgIHMud19zaXplID0gMSA8PCBzLndfYml0czsKICAgICAgICBzLndfbWFzayA9IHMud19zaXplIC0gMTsKICAgICAgICBzLmhhc2hfYml0cyA9IG1lbUxldmVsICsgNzsKICAgICAgICBzLmhhc2hfc2l6ZSA9IDEgPDwgcy5oYXNoX2JpdHM7CiAgICAgICAgcy5oYXNoX21hc2sgPSBzLmhhc2hfc2l6ZSAtIDE7CiAgIC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dGUgfHwgZmx1c2ggPiBaX0JMT0NLIHx8IGZsdXNoIDwgMCkgewogICAgICAgICAgcmV0dXJuIHN0cm0gPyBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpIDogWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHMgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICghc3RybS5vdXRwdXQgfHwgIXN0cm0uaW5wdXQgJiYgc3RybS5hdmFpbF9pbiAhPT0gMCB8fCBzLnN0YXR1cyA9PT0gRklOSVNIX1NUQVRFICYmIGZsdXNoICE9PSBaX0ZJTklTSCkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBzdHJtLmF2YWlsX291dCA9PT0gMCA/IFpfQlVGX0VSUk9SIDogWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBzLnN0cm0gPSBzdHJtOwogICAgICAgIG9sZF9mbHVzaCA9IHMubGFzdF9mbHVzaDsKICAgICAgICBzLmxhc3RfZmx1c2ggPSBmbHVzaDsKICAgICAgICBpZiAocy5zdGF0dXMgPT09IElOSVRfU1RBVEUpIHsKICAgICAgICAgIGlmIChzLndyYXAgPT09IDIpIHsKICAgICAgICAgICAgc3RybS5hZGxlciA9IDA7CiAgICAgICAgICAgIHB1dF9ieXRlKHMsIDMxKTsKICAgICAgICAgICAgcHV0X2J5dGUocywgMTM5KTsKICAgICAgICAgICAgcHV0X2J5dGUocywgOCk7CiAgICAgICAgICAgIGlmICghcy5nemhlYWQpIHsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgT1NfQ09ERSk7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50ZXh0ID8gMSA6IDApICsgKHMuZ3poZWFkLmhjcmMgPyAyIDogMCkgKyAoIXMuZ3poZWFkLmV4dHJhID8gMCA6IDQpICsgKCFzLmd6aGVhZC5uYW1lID8gMCA6IDgpICsgKCFzLmd6aGVhZC5jb21tZW50ID8gMCA6IDE2KSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSA+PiA4ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDE2ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDI0ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQub3MgJiAyNTUpOwogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5leHRyYSAmJiBzLmd6aGVhZC5leHRyYS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLmV4dHJhLmxlbmd0aCAmIDI1NSk7CiAgICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYS5sZW5ndGggPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjKSB7CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nLCAwKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcy5nemluZGV4ID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEVYVFJBX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB2YXIgaGVhZGVyID0gWl9ERUZMQVRFRCArIChzLndfYml0cyAtIDggPDwgNCkgPDwgODsKICAgICAgICAgICAgdmFyIGxldmVsX2ZsYWdzID0gLTE7CiAgICAgICAgICAgIGlmIChzLnN0cmF0ZWd5ID49IFpfSFVGRk1BTl9PTkxZIHx8IHMubGV2ZWwgPCAyKSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAwOwogICAgICAgICAgICB9IGVsc2UgaWYgKHMubGV2ZWwgPCA2KSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAxOwogICAgICAgICAgICB9IGVsc2UgaWYgKHMubGV2ZWwgPT09IDYpIHsKICAgICAgICAgICAgICBsZXZlbF9mbGFncyA9IDI7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAzOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGhlYWRlciB8PSBsZXZlbF9mbGFncyA8PCA2OwogICAgICAgICAgICBpZiAocy5zdHJzdGFydCAhPT0gMCkgewogICAgICAgICAgICAgIGhlYWRlciB8PSBQUkVTRVRfRElDVDsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXIgKz0gMzEgLSBoZWFkZXIgJSAzMTsKICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBoZWFkZXIpOwogICAgICAgICAgICBpZiAocy5zdHJzdGFydCAhPT0gMCkgewogICAgICAgICAgICAgIHB1dFNob3J0TVNCKHMsIHN0cm0uYWRsZXIgPj4+IDE2KTsKICAgICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBzdHJtLmFkbGVyICYgNjU1MzUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHN0cm0uYWRsZXIgPSAxOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5zdGF0dXMgPT09IEVYVFJBX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuZXh0cmEpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICB3aGlsZSAocy5nemluZGV4IDwgKHMuZ3poZWFkLmV4dHJhLmxlbmd0aCAmIDY1NTM1KSkgewogICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMihzdHJtLmFkbGVyLCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmcgLSBiZWcsIGJlZyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYVtzLmd6aW5kZXhdICYgMjU1KTsKICAgICAgICAgICAgICBzLmd6aW5kZXgrKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPT09IHMuZ3poZWFkLmV4dHJhLmxlbmd0aCkgewogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBOQU1FX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IE5BTUVfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gTkFNRV9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLm5hbWUpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgICAgdmFsID0gMTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPCBzLmd6aGVhZC5uYW1lLmxlbmd0aCkgewogICAgICAgICAgICAgICAgdmFsID0gcy5nemhlYWQubmFtZS5jaGFyQ29kZUF0KHMuZ3ppbmRleCsrKSAmIDI1NTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdmFsID0gMDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgdmFsKTsKICAgICAgICAgICAgfSB3aGlsZSAodmFsICE9PSAwKTsKICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodmFsID09PSAwKSB7CiAgICAgICAgICAgICAgcy5nemluZGV4ID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IENPTU1FTlRfU1RBVEU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuc3RhdHVzID0gQ09NTUVOVF9TVEFURTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBDT01NRU5UX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuY29tbWVudCkgewogICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgICB2YWwgPSAxOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHMuZ3ppbmRleCA8IHMuZ3poZWFkLmNvbW1lbnQubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICB2YWwgPSBzLmd6aGVhZC5jb21tZW50LmNoYXJDb2RlQXQocy5nemluZGV4KyspICYgMjU1OwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB2YWwgPSAwOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwdXRfYnl0ZShzLCB2YWwpOwogICAgICAgICAgICB9IHdoaWxlICh2YWwgIT09IDApOwogICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh2YWwgPT09IDApIHsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEhDUkNfU1RBVEU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuc3RhdHVzID0gSENSQ19TVEFURTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBIQ1JDX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYykgewogICAgICAgICAgICBpZiAocy5wZW5kaW5nICsgMiA+IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMucGVuZGluZyArIDIgPD0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciA+PiA4ICYgMjU1KTsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEJVU1lfU1RBVEU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuc3RhdHVzID0gQlVTWV9TVEFURTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMucGVuZGluZyAhPT0gMCkgewogICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIGlmIChzdHJtLmF2YWlsX2luID09PSAwICYmIHJhbmsoZmx1c2gpIDw9IHJhbmsob2xkX2ZsdXNoKSAmJiBmbHVzaCAhPT0gWl9GSU5JU0gpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9CVUZfRVJST1IpOwogICAgICAgIH0KICAgICAgICBpZiAocy5zdGF0dXMgPT09IEZJTklTSF9TVEFURSAmJiBzdHJtLmF2YWlsX2luICE9PSAwKSB7CiAgICAgICAgICByZXR1cm4gZXJyKHN0cm0sIFpfQlVGX0VSUk9SKTsKICAgICAgICB9CiAgICAg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FpfRlVMTF9GTFVTSCkgewogICAgICAgICAgICAgICAgemVybyhzLmhlYWQpOwogICAgICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHMuc3Ryc3RhcnQgPSAwOwogICAgICAgICAgICAgICAgICBzLmJsb2NrX3N0YXJ0ID0gMDsKICAgICAgICAgICAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICBzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoZmx1c2ggIT09IFpfRklOSVNIKSB7CiAgICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKHMud3JhcCA8PSAwKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRU5EOwogICAgICAgIH0KICAgICAgICBpZiAocy53cmFwID09PSAyKSB7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgPj4gOCAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyID4+IDE2ICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgPj4gMjQgJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLnRvdGFsX2luID4+IDggJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiA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FpfT0s7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZVNldERpY3Rpb25hcnkoc3RybSwgZGljdGlvbmFyeSkgewogICAgICAgIHZhciBkaWN0TGVuZ3RoID0gZGljdGlvbmFyeS5sZW5ndGg7CiAgICAgICAgdmFyIHM7CiAgICAgICAgdmFyIHN0ciwgbjsKICAgICAgICB2YXIgd3JhcDsKICAgICAgICB2YXIgYXZhaWw7CiAgICAgICAgdmFyIG5leHQ7CiAgICAgICAgdmFyIGlucHV0OwogICAgICAgIHZhciB0bXBEaWN0OwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzID0gc3RybS5zdGF0ZTsKICAgICAgICB3cmFwID0gcy53cmFwOwogICAgICAgIGlmICh3cmFwID09PSAyIHx8IHdyYXAgPT09IDEgJiYgcy5zdGF0dXMgIT09IElOSVRfU1RBVEUgfHwgcy5sb29rYWhlYWQpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgaWYgKHdyYXAgPT09IDEpIHsKICAgICAgICAgIHN0cm0uYWRsZXIgPSBhZGxlcjMyKHN0cm0uYWRsZXIsIGRpY3Rpb25hcnksIGRpY3RMZW5ndGgsIDApOwogICAgICAgIH0KICAgICAgICBzLndyYXAgPSAwOwogICAgICAgIGlmIChkaWN0TGVuZ3RoID49IHMud19zaXplKSB7CiAgICAgICAgICBpZiAod3JhcCA9PT0gMCkgewogICAgICAgICAgICB6ZXJvKHMuaGVhZCk7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgPSAwOwogICAgICAgICAgICBzLmJsb2NrX3N0YXJ0ID0gMDsKICAgICAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgICAgfQogICAgICAgICAgdG1wRGljdCA9IG5ldyB1dGlscy5CdWY4KHMud19zaXplKTsKICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHRtcERpY3QsIGRpY3Rpb25hcnksIGRpY3RMZW5ndGggLSBzLndfc2l6ZSwgcy53X3NpemUsIDApOwogICAgICAgICAgZGljdGlvbmFyeSA9IHRtcERpY3Q7CiAgICAgICAgICBkaWN0TGVuZ3RoID0gcy53X3NpemU7CiAgICAgICAgfQogICAgICAgIGF2YWlsID0gc3RybS5hdmFpbF9pbjsKICAgICAgICBuZXh0ID0gc3RybS5uZXh0X2luOwogICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gZGljdExlbmd0aDsKICAgICAgICBzdHJtLm5leHRfaW4gPSAwOwogICAgICAgIHN0cm0uaW5wdXQgPSBkaWN0aW9uYXJ5OwogICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgIHdoaWxlIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgIHN0ciA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICBuID0gcy5sb29rYWhlYWQgLSAoTUlOX01BVENIIC0gMSk7CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzdHIgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgcy5wcmV2W3N0ciAmIHMud19tYXNrXSA9IHMuaGVhZFtzLmluc19oXTsKICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gc3RyOwogICAgICAgICAgICBzdHIrKzsKICAgICAgICAgIH0gd2hpbGUgKC0tbik7CiAgICAgICAgICBzLnN0cnN0YXJ0ID0gc3RyOwogICAgICAgICAgcy5sb29rYWhlYWQgPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgICAgZmlsbF93aW5kb3cocyk7CiAgICAgICAgfQogICAgICAgIHMuc3Ryc3RhcnQgKz0gcy5sb29rYWhlYW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ysrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDEyOCkgewogICAgICAgICAgICBidWZbaSsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCAyMDQ4KSB7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTkyIHwgYyA+Pj4gNjsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCA2NTUzNikgewogICAgICAgICAgICBidWZbaSsrXSA9IDIyNCB8IGMgPj4+IDEyOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDYgJiA2MzsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBidWZbaSsrXSA9IDI0MCB8IGMgPj4+IDE4OwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDEyICYgNjM7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTI4IHwgYyA+Pj4gNiAmIDYzOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgJiA2MzsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gYnVmMmJpbnN0cmluZyhidWYsIGxlbikgewogICAgICAgIGlmIChsZW4gPCA2NTUzNCkgewogICAgICAgICAgaWYgKGJ1Zi5zdWJhcnJheSAmJiBTVFJfQVBQTFlfVUlBX09LIHx8ICFidWYuc3ViYXJyYXkgJiYgU1RSX0FQUExZX09LKSB7CiAgICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KG51bGwsIHV0aWxzLnNocmlua0J1ZihidWYsIGxlbikpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB2YXIgcmVzdWx0ID0gIiI7CiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgcmVzdWx0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgfQogICAgICBleHBvcnRzMi5idWYyYmluc3RyaW5nID0gZnVuY3Rpb24oYnVmKSB7CiAgICAgICAgcmV0dXJuIGJ1ZjJiaW5zdHJpbmcoYnVmLCBidWYubGVuZ3RoKTsKICAgICAgfTsKICAgICAgZXhwb3J0czIuYmluc3RyaW5nMmJ1ZiA9IGZ1bmN0aW9uKHN0cikgewogICAgICAgIHZhciBidWYgPSBuZXcgdXRpbHMuQnVmOChzdHIubGVuZ3RoKTsKICAgICAgICBmb3IgKHZhciBpID0gMCwgbGVuID0gYnVmLmxlbmd0aDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgICBidWZbaV0gPSBzdHIuY2hhckNvZGVBdChpKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfTsKICAgICAgZXhwb3J0czIuYnVmMnN0cmluZyA9IGZ1bmN0aW9uKGJ1ZiwgbWF4KSB7CiAgICAgICAgdmFyIGksIG91dCwgYywgY19sZW47CiAgICAgICAgdmFyIGxlbiA9IG1heCB8fCBidWYubGVuZ3RoOwogICAgICAgIHZhciB1dGYxNmJ1ZiA9IG5ldyBBcnJheShsZW4gKiAyKTsKICAgICAgICBmb3IgKG91dCA9IDAsIGkgPSAwOyBpIDwgbGVuOyApIHsKICAgICAgICAgIGMgPSBidWZbaSsrXTsKICAgICAgICAgIGlmIChjIDwgMTI4KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgY19sZW4gPSBfdXRmOGxlbltjXTsKICAgICAgICAgIGlmIChjX2xlbiA+IDQpIHsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNjU1MzM7CiAgICAgICAgICAgIGkgKz0gY19sZW4gLSAxOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGMgJj0gY19sZW4gPT09IDIgPyAzMSA6IGNfbGVuID09PSAzID8gMTUgOiA3OwogICAgICAgICAgd2hpbGUgKGNfbGVuID4gMSAmJiBpIDwgbGVuKSB7CiAgICAgICAgICAgIGMgPSBjIDw8IDYgfCBidWZbaSsrXSAmIDYzOwogICAgICAgICAgICBjX2xlbi0tOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGNfbGVuID4gMSkgewogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA2NTUzMzsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDY1NTM2KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjIC09IDY1NTM2OwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NTI5NiB8IGMgPj4gMTAgJiAxMDIzOwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NjMyMCB8IGMgJiAxMDIzOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gYnVmMmJpbnN0cmluZyh1dGYxNmJ1Ziwgb3V0KTsKICAgICAgfTsKICAgICAgZXhwb3J0czIudXRmOGJvcmRlciA9IGZ1bmN0aW9uKGJ1ZiwgbWF4KSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBtYXggPSBtYXggfHwgYnVmLmxlbmd0aDsKICAgICAgICBpZiAobWF4ID4gYnVmLmxlbmd0aCkgewogICAgICAgICAgbWF4ID0gYnVmLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgcG9zID0gbWF4IC0gMTsKICAgICAgICB3aGlsZSAocG9zID49IDAgJiYgKGJ1Zltwb3NdICYgMTkyKSA9PT0gMTI4KSB7CiAgICAgICAgICBwb3MtLTsKICAgICAgICB9CiAgICAgICAgaWYgKHBvcyA8IDApIHsKICAgICAgICAgIHJldHVybiBtYXg7CiAgICAgICAgfQogICAgICAgIGlmIChwb3MgPT09IDApIHsKICAgICAgICAgIHJldHVybiBtYXg7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwb3MgKyBfdXRmOGxlbltidWZbcG9zXV0gPiBtYXggPyBwb3MgOiBtYXg7CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi96c3RyZWFtLmpzCiAgdmFyIHJlcXVpcmVfenN0cmVhbSA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi96c3RyZWFtLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgZnVuY3Rpb24gWlN0cmVhbSgpIHsKICAgICAgICB0aGlzLmlucHV0ID0gbnVsbDsKICAgICAgICB0aGlzLm5leHRfaW4gPSAwOwogICAgICAgIHRoaXMuYXZhaWxfaW4gPSAwOwogICAgICAgIHRoaXMudG90YWxfaW4gPSAwOwogICAgICAgIHRoaXMub3V0cHV0ID0gbnVsbDsKICAgICAgICB0aGlzLm5leHRfb3V0ID0gMDsKICAgICAgICB0aGlzLmF2YWlsX291dCA9IDA7CiAgICAgICAgdGhpcy50b3RhbF9vdXQgPSAwOwogICAgICAgIHRoaXMubXNnID0gIiI7CiAgICAgICAgdGhpcy5zdGF0ZSA9IG51bGw7CiAgICAgICAgdGhpcy5kYXRhX3R5cGUgPSAyOwogICAgICAgIHRoaXMuYWRsZXIgPSAwOwogICAgICB9CiAgICAgIG1vZHVsZTIuZXhwb3J0cyA9IFp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iAgICAgICAgdGhpcy5vcHRpb25zID0gdXRpbHMuYXNzaWduKHsKICAgICAgICAgIGxldmVsOiBaX0RFRkFVTFRfQ09NUFJFU1NJT04sCiAgICAgICAgICBtZXRob2Q6IFpfREVGTEFURUQsCiAgICAgICAgICBjaHVua1NpemU6IDE2Mzg0LAogICAgICAgICAgd2luZG93Qml0czogMTUsCiAgICAgICAgICBtZW1MZXZlbDogOCwKICAgICAgICAgIHN0cmF0ZWd5OiBaX0RFRkFVTFRfU1RSQVRFR1ksCiAgICAgICAgICB0bzogIiIKICAgICAgICB9LCBvcHRpb25zIHx8IHt9KTsKICAgICAgICB2YXIgb3B0ID0gdGhpcy5vcHRpb25zOwogICAgICAgIGlmIChvcHQucmF3ICYmIG9wdC53aW5kb3dCaXRzID4gMCkgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgPSAtb3B0LndpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIGlmIChvcHQuZ3ppcCAmJiBvcHQud2luZG93Qml0cyA+IDAgJiYgb3B0LndpbmRvd0JpdHMgPCAxNikgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgKz0gMTY7CiAgICAgICAgfQogICAgICAgIHRoaXMuZXJyID0gMDsKICAgICAgICB0aGlzLm1zZyA9ICIiOwogICAgICAgIHRoaXMuZW5kZWQgPSBmYWxzZTsKICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAgICAgIHRoaXMuc3RybSA9IG5ldyBaU3RyZWFtKCk7CiAgICAgICAgdGhpcy5zdHJtLmF2YWlsX291dCA9IDA7CiAgICAgICAgdmFyIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlSW5pdDIodGhpcy5zdHJtLCBvcHQubGV2ZWwsIG9wdC5tZXRob2QsIG9wdC53aW5kb3dCaXRzLCBvcHQubWVtTGV2ZWwsIG9wdC5zdHJhdGVneSk7CiAgICAgICAgaWYgKHN0YXR1cyAhPT0gWl9PSykgewogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKG1zZ1tzdGF0dXNdKTsKICAgICAgICB9CiAgICAgICAgaWYgKG9wdC5oZWFkZXIpIHsKICAgICAgICAgIHpsaWJfZGVmbGF0ZS5kZWZsYXRlU2V0SGVhZGVyKHRoaXMuc3RybSwgb3B0LmhlYWRlcik7CiAgICAgICAgfQogICAgICAgIGlmIChvcHQuZGljdGlvbmFyeSkgewogICAgICAgICAgdmFyIGRpY3Q7CiAgICAgICAgICBpZiAodHlwZW9mIG9wdC5kaWN0aW9uYXJ5ID09PSAic3RyaW5nIikgewogICAgICAgICAgICBkaWN0ID0gc3RyaW5ncy5zdHJpbmcyYnVmKG9wdC5kaWN0aW9uYXJ5KTsKICAgICAgICAgIH0gZWxzZSBpZiAodG9TdHJpbmcuY2FsbChvcHQuZGljdGlvbmFyeSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgICAgZGljdCA9IG5ldyBVaW50OEFycmF5KG9wdC5kaWN0aW9uYXJ5KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGRpY3QgPSBvcHQuZGljdGlvbmFyeTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlU2V0RGljdGlvbmFyeSh0aGlzLnN0cm0sIGRpY3QpOwogICAgICAgICAgaWYgKHN0YXR1cyAhPT0gWl9PSykgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IobXNnW3N0YXR1c10pOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5fZGljdF9zZXQgPSB0cnVlOwogICAgICAgIH0KICAgICAgfQogICAgICBEZWZsYXRlLnByb3RvdHlwZS5wdXNoID0gZnVuY3Rpb24oZGF0YSwgbW9kZSkgewogICAgICAgIHZhciBzdHJtID0gdGhpcy5zdHJtOwogICAgICAgIHZhciBjaHVua1NpemUgPSB0aGlzLm9wdGlvbnMuY2h1bmtTaXplOwogICAgICAgIHZhciBzdGF0dXMsIF9tb2RlOwogICAgICAgIGlmICh0aGlzLmVuZGVkKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICAgIF9tb2RlID0gbW9kZSA9PT0gfn5tb2RlID8gbW9kZSA6IG1vZGUgPT09IHRydWUgPyBaX0ZJTklTSCA6IFpfTk9fRkxVU0g7CiAgICAgICAgaWYgKHR5cGVvZiBkYXRhID09PSAic3RyaW5nIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IHN0cmluZ3Muc3RyaW5nMmJ1ZihkYXRhKTsKICAgICAgICB9IGVsc2UgaWYgKHRvU3RyaW5nLmNhbGwoZGF0YSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgIHN0cm0uaW5wdXQgPSBuZXcgVWludDhBcnJheShkYXRhKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RybS5pbnB1dCA9IGRhdGE7CiAgICAgICAgfQogICAgICAgIHN0cm0ubmV4dF9pbiA9IDA7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IHN0cm0uaW5wdXQubGVuZ3RoOwogICAgICAgIGRvIHsKICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBzdHJtLm91dHB1dCA9IG5ldyB1dGlscy5CdWY4KGNodW5rU2l6ZSk7CiAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSAwOwogICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGNodW5rU2l6ZTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlKHN0cm0sIF9tb2RlKTsKICAgICAgICAgIGlmIChzdGF0dXMgIT09IFpfU1RSRUFNX0VORCAmJiBzdGF0dXMgIT09IFpfT0spIHsKICAgICAgICAgICAgdGhpcy5vbkVuZChzdGF0dXMpOwogICAgICAgICAgICB0aGlzLmVuZGVkID0gdHJ1ZTsKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwIHx8IHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgKF9tb2RlID09PSBaX0ZJTklTSCB8fCBfbW9kZSA9PT0gWl9TWU5DX0ZMVVNIMikpIHsKICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICB0aGlzLm9uRGF0YShzdHJpbmdzLmJ1ZjJiaW5zdHJpbmcodXRpbHMuc2hyaW5rQnVmKHN0cm0ub3V0cHV0LCBzdHJtLm5leHRfb3V0KSkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0aWxzLnNocmlua0J1ZihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCkpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSB3aGlsZSAoKHN0cm0uYXZhaWxfaW4gPiAwIHx8IHN0cm0uYXZhaWxfb3V0ID09PSAwKSAmJiBzdGF0dXMgIT09IFpfU1RSRUFNX0VORCk7CiAgICAgICAgaWYgKF9tb2RlID09PSBaX0ZJTklTSCkgewogICAgICAgICAgc3RhdHVzID0gemxpYl9kZWZsYXRlLmRlZmxhdGVFbmQodGhpcy5zdHJtKTsKICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgIHRoaXMuZW5kZWQgPSB0cnVlOwogICAgICAgICAgcmV0dXJuIHN0YXR1cyA9PT0gWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBaX1NZTkNfRkxVU0gyKSB7CiAgICAgICAgICB0aGlzLm9uRW5kKFpfT0spOwogICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSAwOwogICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0cnVlOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkRhdGEgPSBmdW5jdGlvbihjaHVuaykgewogICAgICAgIHRoaXMuY2h1bmtzLnB1c2goY2h1bmspOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkVuZCA9IGZ1bmN0aW9uKHN0YXR1cykgewogICAgICAgIGlmIChzdGF0dXMgPT09IFpfT0spIHsKICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMudG8gPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdGhpcy5jaHVua3Muam9pbigiIik7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aGlzLnJlc3VsdCA9IHV0aWxzLmZsYXR0ZW5DaHVua3ModGhpcy5jaHVua3MpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAgICAgIHRoaXMuZXJyID0gc3RhdHVzOwogICAgICAgIHRoaXMubXNnID0gdGhpcy5zdHJtLm1zZzsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gZGVmbGF0ZShpbnB1dCwgb3B0aW9ucykgewogICAgICAgIHZhciBkZWZsYXRvciA9IG5ldyBEZWZsYXRlKG9wdGlvbnMpOwogICAgICAgIGRlZmxhdG9yLnB1c2goaW5wdXQsIHRydWUpOwogICAgICAgIGlmIChkZWZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IGRlZmxhdG9yLm1zZyB8fCBtc2dbZGVmbGF0b3IuZXJyXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGRlZmxhdG9yLnJlc3VsdDsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlUmF3KGlucHV0LCBvcHRpb25zKSB7CiAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307CiAgICAgICAgb3B0aW9ucy5yYXcgPSB0cnVlOwogICAgICAgIHJldHVybiBkZWZsYXRlKGlucHV0LCBvcHRpb25zKTsKICAgICAgfQogICAgIC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gICAgdmFyIHNfd2luZG93OwogICAgICAgIHZhciBob2xkOwogICAgICAgIHZhciBiaXRzOwogICAgICAgIHZhciBsY29kZTsKICAgICAgICB2YXIgZGNvZGU7CiAgICAgICAgdmFyIGxtYXNrOwogICAgICAgIHZhciBkbWFzazsKICAgICAgICB2YXIgaGVyZTsKICAgICAgICB2YXIgb3A7CiAgICAgICAgdmFyIGxlbjsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgZnJvbTsKICAgICAgICB2YXIgZnJvbV9zb3VyY2U7CiAgICAgICAgdmFyIGlucHV0LCBvdXRwdXQ7CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIF9pbiA9IHN0cm0ubmV4dF9pbjsKICAgICAgICBpbnB1dCA9IHN0cm0uaW5wdXQ7CiAgICAgICAgbGFzdCA9IF9pbiArIChzdHJtLmF2YWlsX2luIC0gNSk7CiAgICAgICAgX291dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgb3V0cHV0ID0gc3RybS5vdXRwdXQ7CiAgICAgICAgYmVnID0gX291dCAtIChzdGFydCAtIHN0cm0uYXZhaWxfb3V0KTsKICAgICAgICBlbmQgPSBfb3V0ICsgKHN0cm0uYXZhaWxfb3V0IC0gMjU3KTsKICAgICAgICBkbWF4ID0gc3RhdGUuZG1heDsKICAgICAgICB3c2l6ZSA9IHN0YXRlLndzaXplOwogICAgICAgIHdoYXZlID0gc3RhdGUud2hhdmU7CiAgICAgICAgd25leHQgPSBzdGF0ZS53bmV4dDsKICAgICAgICBzX3dpbmRvdyA9IHN0YXRlLndpbmRvdzsKICAgICAgICBob2xkID0gc3RhdGUuaG9sZDsKICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICBsY29kZSA9IHN0YXRlLmxlbmNvZGU7CiAgICAgICAgZGNvZGUgPSBzdGF0ZS5kaXN0Y29kZTsKICAgICAgICBsbWFzayA9ICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMTsKICAgICAgICBkbWFzayA9ICgxIDw8IHN0YXRlLmRpc3RiaXRzKSAtIDE7CiAgICAgICAgdG9wOgogICAgICAgICAgZG8gewogICAgICAgICAgICBpZiAoYml0cyA8IDE1KSB7CiAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaGVyZSA9IGxjb2RlW2hvbGQgJiBsbWFza107CiAgICAgICAgICAgIGRvbGVuOgogICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAyNDsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgIGJpdHMgLT0gb3A7CiAgICAgICAgICAgICAgICBvcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgaWYgKG9wID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChvcCAmIDE2KSB7CiAgICAgICAgICAgICAgICAgIGxlbiA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgb3AgJj0gMTU7CiAgICAgICAgICAgICAgICAgIGlmIChvcCkgewogICAgICAgICAgICAgICAgICAgIGlmIChiaXRzIDwgb3ApIHsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGxlbiArPSBob2xkICYgKDEgPDwgb3ApIC0gMTsKICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IDE1KSB7CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGVyZSA9IGRjb2RlW2hvbGQgJiBkbWFza107CiAgICAgICAgICAgICAgICAgIGRvZGlzdDoKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICAgIG9wID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCAmIDE2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3QgPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgICAgICAgIG9wICY9IDE1OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZGlzdCArPSBob2xkICYgKDEgPDwgb3ApIC0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpc3QgPiBkbWF4KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2siOwogICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgb3AgPSBfb3V0IC0gYmVnOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGlzdCA+IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgb3AgPSBkaXN0IC0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wID4gd2hhdmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgdG9vIGZhciBiYWNrIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IHNfd2luZG93OwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3bmV4dCA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSArPSB3c2l6ZSAtIG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wIDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh3bmV4dCA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tICs9IHdzaXplICsgd25leHQgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wIC09IHduZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wIDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod25leHQgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcCA9IHduZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gb3V0cHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gKz0gd25leHQgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gb3V0cHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAobGVuID4gMikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IDM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4gPiAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSAzOwogICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiA+IDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuID4gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgob3AgJiA2NCkgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgaGVyZSA9IGRjb2RlWyhoZXJlICYgNjU1MzUpICsgKGhvbGQgJiAoMSA8PCBvcCkgLSAxKV07CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlIGRvZGlzdDsKICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgY29kZSI7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoKG9wICYgNjQpID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBsY29kZVsoaGVyZSAmIDY1NTM1KSArIChob2xkICYgKDEgPDwgb3ApIC0gMSldOwogICAgICAgICAgICAgICAgICBjb250aW51ZSBkb2xlbjsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAob3AgJiAzMikgewogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgfQogICAgICAgICAgfSB3aGlsZSAoX2luIDwgbGFzdCAmJiBfb3V0IDwgZW5kKTsKICAgICAgICBsZW4gPSBiaXRzID4+IDM7CiAgICAgICAgX2luIC09IGxlbjsKICAgICAgICBiaXRzIC09IGxlbiA8PCAzOwogICAgICAgIGhvbGQgJj0gKDEgPDwgYml0cykgLSAxOwogICAgICAgIHN0cm0ubmV4dF9pbiA9IF9pbjsKICAgICAgICBzdHJtLm5leHRfb3V0ID0gX291dDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gX2luIDwgbGFzdCA/IDUgKyAobGFzdCAtIF9pbikgOiA1IC0gKF9pbiAtIGxhc3QpOwogICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gX291dCA8IGVuZCA/IDI1NyArIChlbmQgLSBfb3V0KSA6IDI1NyAtIChfb3V0IC0gZW5kKTsKICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICBzdGF0ZS5iaXRzID0gYml0czsKICAgICAgICByZXR1cm47CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9pbmZ0cmVlcy5qcwogIHZhciByZXF1aXJlX2luZnRyZWVzID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2luZnRyZWVzLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIHV0aWxzID0gcmVxdWlyZV9jb21tb24oKTsKICAgICAgdmFyIE1BWEJJVFMgPSAxNTsKICAgICAgdmFyIEVOT1VHSF9MRU5TID0gODUyOwogICAgICB2YXIgRU5PVUdIX0RJU1RTID0gNTkyOwogICAgICB2YXIgQ09ERVMgPSAwOwogICAgICB2YXIgTEVOUyA9IDE7CiAgICAgIHZhciBESVNUUyA9IDI7CiAgICAgIHZhciBsYmFzZSA9IFsKICAgICAgICAzLAogICAgICAgIDQsCiAgICAgICAgNSwKICAgICAgICA2LAogICAgICAgIDcsCiAgICAgICAgOCwKICAgICAgICA5LAogICAgICAgIDEwLAogICAgICAgIDExLAogICAgICAgIDEzLAogICAgICAgIDE1LAogICAgICAgIDE3LAogICAgICAgIDE5LAogICAgICAgIDIzLAogICAgICAgIDI3LAogICAgICAgIDMxLAogICAgICAgIDM1LAogICAgICAgIDQzLAogICAgICAgIDUxLAogICAgICAgIDU5LAogICAgICAgIDY3LAogICAgICAgIDgzLAogICAgICAgIDk5LAogICAgICAgIDExNSwKICAgICAgICAxMzEsCiAgICAgICAgMTYzLAogICAgICAgIDE5NSwKICAgICAgICAyMjcsCiAgICAgICAgMjU4LAogICAgICAgIDAsCiAgICAgICAgMAogICAgICBdOwogICAgICB2YXIgbGV4dCA9IFsKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAxNiwKICAgICAgICA3MiwKICAgICAgICA3OAogICAgICBdOwogICAgICB2YXIgZGJhc2UgPSBbCiAgICAgICAgMSwKICAgICAgICAyLAogICAgICAgIDMsCiAgICAgICAgNCwKICAgICAgICA1LAogICAgICAgIDcsCiAgICAgICAgOSwKICAgICAgICAxMywKICAgICAgICAxNywKICAgICAgICAyNSwKICAgICAgICAzMywKICAgICAgICA0OSwKICAgICAgICA2NSwKICAgICAgICA5NywKICAgICAgICAxMjksCiAgICAgICAgMTkzLAogICAgICAgIDI1NywKICAgICAgICAzODUsCiAgICAgICAgNTEzLAogICAgICAgIDc2OSwKICAgICAgICAxMDI1LAogICAgICAgIDE1MzcsCiAgICAgICAgMjA0OSwKICAgICAgICAzMDczLAogICAgICAgIDQwOTcsCiAgICAgICAgNjE0NSwKICAgICAgICA4MTkzLAogICAgICAgIDEyMjg5LAogICAgICAgIDE2Mzg1LAogICAgICAgIDI0NTc3LAogICAgICAgIDAsCiAgICAgICAgMAogICAgICBdOwogICAgICB2YXIgZGV4dCA9IFsKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMiwKICAgICAgICAyMiwKICAgICAgICAyMywKICAgICAgICAyMywKICAgICAgICAyNCwKICAgICAgICAyNCwKICAgICAgICAyNSwKICAgICAgICAyNSwKICAgICAgICAyNiwKICAgICAgICAyNiwKICAgICAgICAyNywKICAgICAgICAyNywKICAgICAgICAyOCwKICAgICAgICAyOCwKICAgICAgICAyOSwKICAgICAgICAyOSwKICAgICAgICA2NCwKICAgICAgICA2NAogICAgICBdOwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBmdW5jdGlvbiBpbmZsYXRlX3RhYmxlKHR5cGUsIGxlbnMsIGxlbnNfaW5kZXgsIGNvZGVzLCB0YWJsZSwgdGFibGVfaW5kZXgsIHdvcmssIG9wdHMpIHsKICAgICAgICB2YXIgYml0cyA9IG9wdHMuYml0czsKICAgICAgICB2YXIgbGVuID0gMDsKICAgICAgICB2YXIgc3ltID0gMDsKICAgICAgICB2YXIgbWluID0gMCwgbWF4ID0gMDsKICAgICAgICB2YXIgcm9vdDIgPSAwOwogICAgICAgIHZhciBjdXJyID0gMDsKICAgICAgICB2YXIgZHJvcCA9IDA7CiAgICAgICAgdmFyIGxlZnQgPSAwOwogICAgICAgIHZhciB1c2VkID0gMDsKICAgICAgICB2YXIgaHVmZiA9IDA7CiAgICAgICAgdmFyIGluY3I7CiAgICAgICAgdmFyIGZpbGw7CiAgICAgICAgdmFyIGxvdzsKICAgICAgICB2YXIgbWFzazsKICAgICAgICB2YXIgbmV4dDsKICAgICAgICB2YXIgYmFzZSA9IG51bGw7CiAgICAgICAgdmFyIGJhc2VfaW5kZXggPSAwOwogICAgICAgIHZhciBlbmQ7CiAgICAgICAgdmFyIGNvdW50ID0gbmV3IHV0aWxzLkJ1ZjE2KE1BWEJJVFMgKyAxKTsKICAgICAgICB2YXIgb2ZmcyA9IG5ldyB1dGlscy5CdWYxNihNQVhCSVRTICsgMSk7CiAgICAgICAgdmFyIGV4dHJhID0gbnVsbDsKICAgICAgICB2YXIgZXh0cmFfaW5kZXggPSAwOwogICAgICAgIHZhciBoZXJlX2JpdHMsIGhlcmVfb3AsIGhlcmVfdmFsOwogICAgICAgIGZvciAobGVuID0gMDsgbGVuIDw9IE1BWEJJVFM7IGxlbisrKSB7CiAgICAgICAgICBjb3VudFtsZW5dID0gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChzeW0gPSAwOyBzeW0gPCBjb2Rlczsgc3ltKyspIHsKICAgICAgICAgIGNvdW50W2xlbnNbbGVuc19pbmRleCArIHN5bV1dKys7CiAgICAgICAgfQogICAgICAgIHJvb3QyID0gYml0czsKICAgICAgICBmb3IgKG1heCA9IE1BWEJJVFM7IG1heCA+PSAxOyBtYXgtLSkgewogICAgICAgICAgaWYgKGNvdW50W21heF0gIT09IDApIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChyb290MiA+IG1heCkgewogICAgICAgICAgcm9vdDIgPSBtYXg7CiAgICAgICAgfQogICAgICAgIGlmIChtYXggPT09IDApIHsKICAgICAgICAgIHRhYmxlW3RhYmxlX2luZGV4KytdID0gMSA8PCAyNCB8IDY0IDw8IDE2IHwgMDsKICAgICAgICAgIHRhYmxlW3RhYmxlX2luZGV4KytdID0gMSA8PCAyNCB8IDY0IDw8IDE2IHwgMDsKICAgICAgICAgIG9wdHMuYml0cyA9IDE7CiAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChtaW4gPSAxOyBtaW4gPCBtYXg7IG1pbisrKSB7CiAgICAgICAgICBpZiAoY291bnRbbWluXSAhPT0gMCkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvb3QyIDwgbWluKSB7CiAgICAgICAgICByb290MiA9IG1pbjsKICAgICAgICB9CiAgICAgICAgbGVmdCA9IDE7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPD0gTUFYQklUUzsgbGVuKyspIHsKICAgICAgICAgIGxlZnQgPDw9IDE7CiAgICAgICAgICBsZWZ0IC09IGNvdW50W2xlbl07CiAgICAgICAgICBpZiAobGVmdCA8IDApIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAobGVmdCA+IDAgJiYgKHR5cGUgPT09IENPREVTIHx8IG1heCAhPT0gMSkpIHsKICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgb2Zmc1sxXSA9IDA7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPCBNQVhCSVRTOyBsZW4rKykgewogICAgICAgICAgb2Zmc1tsZW4gKyAxXSA9IG9mZnNbbGVuXSArIGNvdW50W2xlbl07CiAgICAgICAgfQogICAgICAgIGZvciAoc3ltID0gMDsgc3ltIDwgY29kZXM7IHN5bSsrKSB7CiAgICAgICAgICBpZiAobGVuc1tsZW5zX2luZGV4ICsgc3ltXSAhPT0gMCkgewogICAgICAgICAgICB3b3JrW29mZnNbbGVuc1tsZW5zX2luZGV4ICsgc3ltXV0rK10gPSBzeW07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICh0eXBlID09PSBDT0RFUykgewogICAgICAgICAgYmFzZSA9IGV4dHJhID0gd29yazsKICAgICAgICAgIGVuZCA9IDE5OwogICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PT0gTEVOUykgewogICAgICAgICAgYmFzZSA9IGxiYXNlOwogICAgICAgICAgYmFzZV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBleHRyYSA9IGxleHQ7CiAgICAgICAgICBleHRyYV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBlbmQgPSAyNTY7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGJhc2UgPSBkYmFzZTsKICAgICAgICAgIGV4dHJhID0gZGV4dDsKICAgICAgICAgIGVuZCA9IC0xOwogICAgICAgIH0KICAgICAgICBodWZmID0gMDsKICAgICAgICBzeW0gPSAwOwogICAgICAgIGxlbiA9IG1pbjsKICAgICAgICBuZXh0ID0gdGFibGVfaW5kZXg7CiAgICAgICAgY3VyciA9IHJvb3QyOwogICAgICAgIGRyb3AgPSAwOwogICAgICAgIGxvdyA9IC0xOwogICAgICAgIHVzZWQgPSAxIDw8IHJvb3QyOwogICAgICAgIG1hc2sgPSB1c2VkIC0gMTsKICAgICAgICBpZiAodHlwZSA9PT0gTEVOUyAmJiB1c2VkID4gRU5PVUdIX0xFTlMgfHwgdHlwZSA9PT0gRElTVFMgJiYgdXNlZCA+IEVOT1VHSF9ESVNUUykgewogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaGVyZV9iaXRzID0gbGVuIC0gZHJvcDsKICAgICAgICAgIGlmICh3b3JrW3N5bV0gPCBlbmQpIHsKICAgICAgICAgICAgaGVyZV9vcCA9IDA7CiAgICAgICAgICAgIGhlcmVfdmFsID0gd29ya1tzeW1dOwogICAgICAgICAgfSBlbHNlIGlmICh3b3JrW3N5bV0gPiBlbmQpIHsKICAgICAgICAgICAgaGVyZV9vcCA9IGV4dHJhW2V4dHJhX2luZGV4ICsgd29ya1tzeW1dXTsKICAgICAgICAgICAgaGVyZV92YWwgPSBiYXNlW2Jhc2VfaW5kZXggKyB3b3JrW3N5bV1dOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgaGVyZV9vcCA9IDMyICsgNjQ7CiAgICAgICAgICAgIGhlcmVfdmFsID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIGluY3IgPSAxIDw8IGxlbiAtIGRyb3A7CiAgICAgICAgICBmaWxsID0gMSA8PCBjdXJyOwogICAgICAgICAgbWluID0gZmlsbDsKICAgICAgICAgIGRvIHsKICAgICAgICAgICAgZmlsbCAtPSBpbmNyOwogICAgICAgICAgICB0YWJsZVtuZXh0ICsgKGh1ZmYgPj4gZHJvcCkgKyBmaWxsXSA9IGhlcmVfYml0cyA8PCAyNCB8IGhlcmVfb3AgPDwgMTYgfCBoZXJlX3ZhbCB8IDA7CiAgICAgICAgICB9IHdoaWxlIChmaWxsICE9PSAwKTsKICAgICAgICAgIGluY3IgPSAxIDw8IGxlbiAtIDE7CiAgICAgICAgICB3aGlsZSAoaHVmZiAmIGluY3IpIHsKICAgICAgICAgICAgaW5jciA+Pj0gMTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChpbmNyICE9PSAwKSB7CiAgICAgICAgICAgIGh1ZmYgJj0gaW5jciAtIDE7CiAgICAgICAgICAgIGh1ZmYgKz0gaW5jcjsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGh1ZmYgPSAwOwogICAgICAgICAgfQogICAgICAgICAgc3ltKys7CiAgICAgICAgICBpZiAoLS1jb3VudFtsZW5dID09PSAwKSB7CiAgICAgICAgICAgIGlmIChsZW4gPT09IG1heCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxlbiA9IGxlbnNbbGVuc19pbmRleCArIHdvcmtbc3ltXV07CiAgICAgICAgICB9CiAgICAgICAgICBpZiAobGVuID4gcm9vdDIgJiYgKGh1ZmYgJiBtYXNrKSAhPT0gbG93KSB7CiAgICAgICAgICAgIGlmIChkcm9wID09PSAwKSB7CiAgICAgICAgICAgICAgZHJvcCA9IHJvb3QyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG5leHQgKz0gbWluOwogICAgICAgICAgICBjdXJyID0gbGVuIC0gZHJvcDsKICAgICAgICAgICAgbGVmdCA9IDEgPDwgY3VycjsKICAgICAgICAgICAgd2hpbGUgKGN1cnIgKyBkcm9wIDwgbWF4KSB7CiAgICAgICAgICAgICAgbGVmdCAtPSBjb3VudFtjdXJyICsgZHJvcF07CiAgICAgICAgICAgICAgaWYgKGxlZnQgPD0gMCkgewogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGN1cnIrKzsKICAgICAgICAgICAgICBsZWZ0IDw8PSAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHVzZWQgKz0gMSA8PCBjdXJyOwogICAgICAgICAgICBpZiAodHlwZSA9PT0gTEVOUyAmJiB1c2VkID4gRU5PVUdIX0xFTlMgfHwgdHlwZSA9PT0gRElTVFMgJiYgdXNlZCA+IEVOT1VHSF9ESVNUUykgewogICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9Ci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A9IDU7CiAgICAgIHZhciBaX1RSRUVTID0gNjsKICAgICAgdmFyIFpfT0sgPSAwOwogICAgICB2YXIgWl9TVFJFQU1fRU5EID0gMTsKICAgICAgdmFyIFpfTkVFRF9ESUNUID0gMjsKICAgICAgdmFyIFpfU1RSRUFNX0VSUk9SID0gLTI7CiAgICAgIHZhciBaX0RBVEFfRVJST1IgPSAtMzsKICAgICAgdmFyIFpfTUVNX0VSUk9SID0gLTQ7CiAgICAgIHZhciBaX0JVRl9FUlJPUiA9IC01OwogICAgICB2YXIgWl9ERUZMQVRFRCA9IDg7CiAgICAgIHZhciBIRUFEID0gMTsKICAgICAgdmFyIEZMQUdTID0gMjsKICAgICAgdmFyIFRJTUUgPSAzOwogICAgICB2YXIgT1MgPSA0OwogICAgICB2YXIgRVhMRU4gPSA1OwogICAgICB2YXIgRVhUUkEgPSA2OwogICAgICB2YXIgTkFNRSA9IDc7CiAgICAgIHZhciBDT01NRU5UID0gODsKICAgICAgdmFyIEhDUkMgPSA5OwogICAgICB2YXIgRElDVElEID0gMTA7CiAgICAgIHZhciBESUNUID0gMTE7CiAgICAgIHZhciBUWVBFID0gMTI7CiAgICAgIHZhciBUWVBFRE8gPSAxMzsKICAgICAgdmFyIFNUT1JFRCA9IDE0OwogICAgICB2YXIgQ09QWV8gPSAxNTsKICAgICAgdmFyIENPUFkgPSAxNjsKICAgICAgdmFyIFRBQkxFID0gMTc7CiAgICAgIHZhciBMRU5MRU5TID0gMTg7CiAgICAgIHZhciBDT0RFTEVOUyA9IDE5OwogICAgICB2YXIgTEVOXyA9IDIwOwogICAgICB2YXIgTEVOID0gMjE7CiAgICAgIHZhciBMRU5FWFQgPSAyMjsKICAgICAgdmFyIERJU1QgPSAyMzsKICAgICAgdmFyIERJU1RFWFQgPSAyNDsKICAgICAgdmFyIE1BVENIID0gMjU7CiAgICAgIHZhciBMSVQgPSAyNjsKICAgICAgdmFyIENIRUNLID0gMjc7CiAgICAgIHZhciBMRU5HVEggPSAyODsKICAgICAgdmFyIERPTkUgPSAyOTsKICAgICAgdmFyIEJBRCA9IDMwOwogICAgICB2YXIgTUVNID0gMzE7CiAgICAgIHZhciBTWU5DID0gMzI7CiAgICAgIHZhciBFTk9VR0hfTEVOUyA9IDg1MjsKICAgICAgdmFyIEVOT1VHSF9ESVNUUyA9IDU5MjsKICAgICAgdmFyIE1BWF9XQklUUyA9IDE1OwogICAgICB2YXIgREVGX1dCSVRTID0gTUFYX1dCSVRTOwogICAgICBmdW5jdGlvbiB6c3dhcDMyKHEpIHsKICAgICAgICByZXR1cm4gKHEgPj4+IDI0ICYgMjU1KSArIChxID4+PiA4ICYgNjUyODApICsgKChxICYgNjUyODApIDw8IDgpICsgKChxICYgMjU1KSA8PCAyNCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gSW5mbGF0ZVN0YXRlKCkgewogICAgICAgIHRoaXMubW9kZSA9IDA7CiAgICAgICAgdGhpcy5sYXN0ID0gZmFsc2U7CiAgICAgICAgdGhpcy53cmFwID0gMDsKICAgICAgICB0aGlzLmhhdmVkaWN0ID0gZmFsc2U7CiAgICAgICAgdGhpcy5mbGFncyA9IDA7CiAgICAgICAgdGhpcy5kbWF4ID0gMDsKICAgICAgICB0aGlzLmNoZWNrID0gMDsKICAgICAgICB0aGlzLnRvdGFsID0gMDsKICAgICAgICB0aGlzLmhlYWQgPSBudWxsOwogICAgICAgIHRoaXMud2JpdHMgPSAwOwogICAgICAgIHRoaXMud3NpemUgPSAwOwogICAgICAgIHRoaXMud2hhdmUgPSAwOwogICAgICAgIHRoaXMud25leHQgPSAwOwogICAgICAgIHRoaXMud2luZG93ID0gbnVsbDsKICAgICAgICB0aGlzLmhvbGQgPSAwOwogICAgICAgIHRoaXMuYml0cyA9IDA7CiAgICAgICAgdGhpcy5sZW5ndGggPSAwOwogICAgICAgIHRoaXMub2Zmc2V0ID0gMDsKICAgICAgICB0aGlzLmV4dHJhID0gMDsKICAgICAgICB0aGlzLmxlbmNvZGUgPSBudWxsOwogICAgICAgIHRoaXMuZGlzdGNvZGUgPSBudWxsOwogICAgICAgIHRoaXMubGVuYml0cyA9IDA7CiAgICAgICAgdGhpcy5kaXN0Yml0cyA9IDA7CiAgICAgICAgdGhpcy5uY29kZSA9IDA7CiAgICAgICAgdGhpcy5ubGVuID0gMDsKICAgICAgICB0aGlzLm5kaXN0ID0gMDsKICAgICAgICB0aGlzLmhhdmUgPSAwOwogICAgICAgIHRoaXMubmV4dCA9IG51bGw7CiAgICAgICAgdGhpcy5sZW5zID0gbmV3IHV0aWxzLkJ1ZjE2KDMyMCk7CiAgICAgICAgdGhpcy53b3JrID0gbmV3IHV0aWxzLkJ1ZjE2KDI4OCk7CiAgICAgICAgdGhpcy5sZW5keW4gPSBudWxsOwogICAgICAgIHRoaXMuZGlzdGR5biA9IG51bGw7CiAgICAgICAgdGhpcy5zYW5lID0gMDsKICAgICAgICB0aGlzLmJhY2sgPSAwOwogICAgICAgIHRoaXMud2FzID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlUmVzZXRLZWVwKHN0cm0pIHsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBzdHJtLnRvdGFsX2luID0gc3RybS50b3RhbF9vdXQgPSBzdGF0ZS50b3RhbCA9IDA7CiAgICAgICAgc3RybS5tc2cgPSAiIjsKICAgICAgICBpZiAoc3RhdGUud3JhcCkgewogICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLndyYXAgJiAxOwogICAgICAgIH0KICAgICAgICBzdGF0ZS5tb2RlID0gSEVBRDsKICAgICAgICBzdGF0ZS5sYXN0ID0gMDsKICAgICAgICBzdGF0ZS5oYXZlZGljdCA9IDA7CiAgICAgICAgc3RhdGUuZG1heCA9IDMyNzY4OwogICAgICAgIHN0YXRlLmhlYWQgPSBudWxsOwogICAgICAgIHN0YXRlLmhvbGQgPSAwOwogICAgICAgIHN0YXRlLmJpdHMgPSAwOwogICAgICAgIHN0YXRlLmxlbmNvZGUgPSBzdGF0ZS5sZW5keW4gPSBuZXcgdXRpbHMuQnVmMzIoRU5PVUdIX0xFTlMpOwogICAgICAgIHN0YXRlLmRpc3Rjb2RlID0gc3RhdGUuZGlzdGR5biA9IG5ldyB1dGlscy5CdWYzMihFTk9VR0hfRElTVFMpOwogICAgICAgIHN0YXRlLnNhbmUgPSAxOwogICAgICAgIHN0YXRlLmJhY2sgPSAtMTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlUmVzZXQoc3RybSkgewogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIHN0YXRlLndzaXplID0gMDsKICAgICAgICBzdGF0ZS53aGF2ZSA9IDA7CiAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgIHJldHVybiBpbmZsYXRlUmVzZXRLZWVwKHN0cm0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVSZXNldDIoc3RybSwgd2luZG93Qml0cykgewogICAgICAgIHZhciB3cmFwOwogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICh3aW5kb3dCaXRzIDwgMCkgewogICAgICAgICAgd3JhcCA9IDA7CiAgICAgICAgICB3aW5kb3dCaXRzID0gLXdpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHdyYXAgPSAod2luZG93Qml0cyA+PiA0KSArIDE7CiAgICAgICAgICBpZiAod2luZG93Qml0cyA8IDQ4KSB7CiAgICAgICAgICAgIHdpbmRvd0JpdHMgJj0gMTU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICh3aW5kb3dCaXRzICYmICh3aW5kb3dCaXRzIDwgOCB8fCB3aW5kb3dCaXRzID4gMTUpKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdGF0ZS53aW5kb3cgIT09IG51bGwgJiYgc3RhdGUud2JpdHMgIT09IHdpbmRvd0JpdHMpIHsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHN0YXRlLndyYXAgPSB3cmFwOwogICAgICAgIHN0YXRlLndiaXRzID0gd2luZG93Qml0czsKICAgICAgICByZXR1cm4gaW5mbGF0ZVJlc2V0KHN0cm0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVJbml0MihzdHJtLCB3aW5kb3dCaXRzKSB7CiAgICAgICAgdmFyIHJldDsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgaWYgKCFzdHJtKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gbmV3IEluZmxhdGVTdGF0ZSgpOwogICAgICAgIHN0cm0uc3RhdGUgPSBzdGF0ZTsKICAgICAgICBzdGF0ZS53aW5kb3cgPSBudWxsOwogICAgICAgIHJldCA9IGluZmxhdGVSZXNldDIoc3RybSwgd2luZG93Qml0cyk7CiAgICAgICAgaWYgKHJldCAhPT0gWl9PSykgewogICAgICAgICAgc3RybS5zdGF0ZSA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZUluaXQoc3RybSkgewogICAgICAgIHJldHVybiBpbmZsYXRlSW5pdDIoc3RybSwgREVGX1dCSVRTKTsKICAgICAgfQogICAgICB2YXIgdmlyZ2luID0gdHJ1ZTsKICAgICAgdmFyIGxlbmZpeDsKICAgICAgdmFyIGRpc3RmaXg7CiAgICAgIGZ1bmN0aW9uIGZpeGVkdGFibGVzKHN0YXRlKSB7CiAgICAgICAgaWYgKHZpcmdpbikgewogICAgICAgICAgdmFyIHN5bTsKICAgICAgICAgIGxlbmZpeCA9IG5ldyB1dGlscy5CdWYzMig1MTIpOwogICAgICAgICAgZGlzdGZpeCA9IG5ldyB1dGlscy5CdWYzMigzMik7CiAgICAgICAgICBzeW0gPSAwOwogICAgICAgICAgd2hpbGUgKHN5bSA8IDE0NCkgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDg7CiAgICAgICAgICB9CiAgICAgICAgICB3aGlsZSAoc3ltIDwgMjU2KSB7CiAgICAgICAgICAgIHN0YXRlLmxlbnNbc3ltKytdID0gOTsKICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzeW0gPCAyODApIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA3OwogICAgICAgICAgfQogICAgICAgICAgd2hpbGUgKHN5bSA8IDI4OCkgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDg7CiAgICAgICAgICB9CiAgICAgICAgICBpbmZsYXRlX3RhYmxlKExFTlMsIHN0YXRlLmxlbnMsIDAsIDI4OCwgbGVuZml4LCAwLCBzdGF0ZS53b3JrLCB7IGJpdHM6IDkgfSk7CiAgICAgICAgICBzeW0gPSAwOwogICAgICAgICAgd2hpbGUgKHN5bSA8IDMyKSB7CiAgICAgICAgICAgIHN0YXRlLmxlbnNbc3ltKytdID0gNTsKICAgICAgICAgIH0KICAgICAgICAgIGluZmxhdGVfdGFibGUoRElTVFMsIHN0YXRlLmxlbnMsIDAsIDMyLCBkaXN0Zml4LCAwLCBzdGF0ZS53b3JrLCB7IGJpdHM6IDUgfSk7CiAgICAgICAgICB2aXJnaW4gPSBmYWxzZTsKICAgICAgICB9CiAgICAgICAgc3RhdGUubGVuY29kZSA9IGxlbmZpeDsKICAgICAgICBzdGF0ZS5sZW5iaXRzID0gOTsKICAgICAgICBzdGF0ZS5kaXN0Y29kZSA9IGRpc3RmaXg7CiAgICAgICAgc3RhdGUuZGlzdGJpdHMgPSA1OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHVwZGF0ZXdpbmRvdyhzdHJtLCBzcmMsIGVuZCwgY29weSkgewogICAgICAgIHZhciBkaXN0OwogICAgICAgIHZhciBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgaWYgKHN0YXRlLndpbmRvdyA9PT0gbnVsbCkgewogICAgICAgICAgc3RhdGUud3NpemUgPSAxIDw8IHN0YXRlLndiaXRzOwogICAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgICAgc3RhdGUud2hhdmUgPSAwOwogICAgICAgICAgc3RhdGUud2luZG93ID0gbmV3IHV0aWxzLkJ1Zjgoc3RhdGUud3NpemUpOwogICAgICAgIH0KICAgICAgICBpZiAoY29weSA+PSBzdGF0ZS53c2l6ZSkgewogICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUud2luZG93LCBzcmMsIGVuZCAtIHN0YXRlLndzaXplLCBzdGF0ZS53c2l6ZSwgMCk7CiAgICAgICAgICBzdGF0ZS53bmV4dCA9IDA7CiAgICAgICAgICBzdGF0ZS53aGF2ZSA9IHN0YXRlLndzaXplOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBkaXN0ID0gc3RhdGUud3NpemUgLSBzdGF0ZS53bmV4dDsKICAgICAgICAgIGlmIChkaXN0ID4gY29weSkgewogICAgICAgICAgICBkaXN0ID0gY29weTsKICAgICAgICAgIH0KICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0YXRlLndpbmRvdywgc3JjLCBlbmQgLSBjb3B5LCBkaXN0LCBzdGF0ZS53bmV4dCk7CiAgICAgICAgICBjb3B5IC09IGRpc3Q7CiAgICAgICAgICBpZiAoY29weSkgewogICAgICAgICAgICB1dGlscy5hcnJheVNldChzdGF0ZS53aW5kb3csIHNyYywgZW5kIC0gY29weSwgY29weSwgMCk7CiAgICAgICAgICAgIHN0YXRlLnduZXh0ID0gY29weTsKICAgICAgICAgICAgc3RhdGUud2hhdmUgPSBzdGF0ZS53c2l6ZTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHN0YXRlLnduZXh0ICs9IGRpc3Q7CiAgICAgICAgICAgIGlmIChzdGF0ZS53bmV4dCA9PT0gc3RhdGUud3NpemUpIHsKICAgICAgICAgICAgICBzdGF0ZS53bmV4dCA9IDA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHN0YXRlLndoYXZlIDwgc3RhdGUud3NpemUpIHsKICAgICAgICAgICAgICBzdGF0ZS53aGF2ZSArPSBkaXN0OwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGUoc3RybSwgZmx1c2gpIHsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgdmFyIGlucHV0LCBvdXRwdXQ7CiAgICAgICAgdmFyIG5leHQ7CiAgICAgICAgdmFyIHB1dDsKICAgICAgICB2YXIgaGF2ZSwgbGVmdDsKICAgICAgICB2YXIgaG9sZDsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgX2luLCBfb3V0OwogICAgICAgIHZhciBjb3B5OwogICAgICAgIHZhciBmcm9tOwogICAgICAgIHZhciBmcm9tX3NvdXJjZTsKICAgICAgICB2YXIgaGVyZSA9IDA7CiAgICAgICAgdmFyIGhlcmVfYml0cywgaGVyZV9vcCwgaGVyZV92YWw7CiAgICAgICAgdmFyIGxhc3RfYml0cywgbGFzdF9vcCwgbGFzdF92YWw7CiA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KHN0YXRlLndyYXAgPT09IDApIHsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEVETzsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwICYgMiAmJiBob2xkID09PSAzNTYxNSkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IDA7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEZMQUdTOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmZsYWdzID0gMDsKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZG9uZSA9IGZhbHNlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCEoc3RhdGUud3JhcCAmIDEpIHx8ICgoKGhvbGQgJiAyNTUpIDw8IDgpICsgKGhvbGQgPj4gOCkpICUgMzEpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGhlYWRlciBjaGVjayI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKChob2xkICYgMTUpICE9PSBaX0RFRkxBVEVEKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInVua25vd24gY29tcHJlc3Npb24gbWV0aG9kIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNDsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNDsKICAgICAgICAgICAgICAgIGxlbiA9IChob2xkICYgMTUpICsgODsKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53Yml0cyA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS53Yml0cyA9IGxlbjsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobGVuID4gc3RhdGUud2JpdHMpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCB3aW5kb3cgc2l6ZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZG1heCA9IDEgPDwgbGVuOwogICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0gMTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBob2xkICYgNTEyID8gRElDVElEIDogVFlQRTsKICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIEZMQUdTOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5mbGFncyA9IGhvbGQ7CiAgICAgICAgICAgICAgICBpZiAoKHN0YXRlLmZsYWdzICYgMjU1KSAhPT0gWl9ERUZMQVRFRCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJ1bmtub3duIGNvbXByZXNzaW9uIG1ldGhvZCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTczNDQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAidW5rbm93biBoZWFkZXIgZmxhZ3Mgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnRleHQgPSBob2xkID4+IDggJiAxOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRJTUU7CiAgICAgICAgICAgICAgY2FzZSBUSU1FOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnRpbWUgPSBob2xkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsyXSA9IGhvbGQgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzNdID0gaG9sZCA+Pj4gMjQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGhidWYsIDQsIDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBPUzsKICAgICAgICAgICAgICBjYXNlIE9TOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnhmbGFncyA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQub3MgPSBob2xkID4+IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhidWZbMV0gPSBob2xkID4+PiA4ICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyKHN0YXRlLmNoZWNrLCBoYnVmLCAyLCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRVhMRU47CiAgICAgICAgICAgICAgY2FzZSBFWExFTjoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDEwMjQpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoID0gaG9sZDsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhX2xlbiA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEVYVFJBOwogICAgICAgICAgICAgIGNhc2UgRVhUUkE6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAxMDI0KSB7CiAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmhlYWQuZXh0cmFfbGVuIC0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgaWYgKCFzdGF0ZS5oZWFkLmV4dHJhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBuZXcgQXJyYXkoc3RhdGUuaGVhZC5leHRyYV9sZW4pOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUuaGVhZC5leHRyYSwgaW5wdXQsIG5leHQsIGNvcHksIGxlbik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCAtPSBjb3B5OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTkFNRTsKICAgICAgICAgICAgICBjYXNlIE5BTUU6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAyMDQ4KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGNvcHkgPSAwOwogICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgbGVuID0gaW5wdXRbbmV4dCArIGNvcHkrK107CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQgJiYgbGVuICYmIHN0YXRlLmxlbmd0aCA8IDY1NTM2KSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLm5hbWUgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShsZW4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobGVuICYmIGNvcHkgPCBoYXZlKTsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5uYW1lID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ09NTUVOVDsKICAgICAgICAgICAgICBjYXNlIENPTU1FTlQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA0MDk2KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGNvcHkgPSAwOwogICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgbGVuID0gaW5wdXRbbmV4dCArIGNvcHkrK107CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQgJiYgbGVuICYmIHN0YXRlLmxlbmd0aCA8IDY1NTM2KSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmNvbW1lbnQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShsZW4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobGVuICYmIGNvcHkgPCBoYXZlKTsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5jb21tZW50ID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBIQ1JDOwogICAgICAgICAgICAgIGNhc2UgSENSQzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaG9sZCAhPT0gKHN0YXRlLmNoZWNrICYgNjU1MzUpKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaGVhZGVyIGNyYyBtaXNtYXRjaCI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmhjcmMgPSBzdGF0ZS5mbGFncyA+PiA5ICYgMTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5kb25lID0gdHJ1ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgRElDVElEOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSB6c3dhcDMyKGhvbGQpOwogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESUNUOwogICAgICAgICAgICAgIGNhc2UgRElDVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlZGljdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfb3V0ID0gcHV0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGxlZnQ7CiAgICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9pbiA9IG5leHQ7CiAgICAgICAgICAgICAgICAgIHN0cm0uYXZhaWxfaW4gPSBoYXZlOwogICAgICAgICAgICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICAgICAgICAgICAgc3RhdGUuYml0cyA9IGJpdHM7CiAgICAgICAgICAgICAgICAgIHJldHVybiBaX05FRURfRElDVDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDE7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICBjYXNlIFRZUEU6CiAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfQkxPQ0sgfHwgZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGNhc2UgVFlQRURPOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxhc3QpIHsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ0hFQ0s7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxhc3QgPSBob2xkICYgMTsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAxOwogICAgICAgICAgICAgICAgYml0cyAtPSAxOwogICAgICAgICAgICAgICAgc3dpdGNoIChob2xkICYgMykgewogICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFNUT1JFRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgIGZpeGVkdGFibGVzKHN0YXRlKTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUQUJMRTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYmxvY2sgdHlwZSI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBTVE9SRUQ6CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gYml0cyAmIDc7CiAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhvbGQgJiA2NTUzNSkgIT09IChob2xkID4+PiAxNiBeIDY1NTM1KSkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIHN0b3JlZCBibG9jayBsZW5ndGhzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBob2xkICYgNjU1MzU7CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFlfOwogICAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX1RSRUVTKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBjYXNlIENPUFlfOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFk7CiAgICAgICAgICAgICAgY2FzZSBDT1BZOgogICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBsZWZ0OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KG91dHB1dCwgaW5wdXQsIG5leHQsIGNvcHksIHB1dCk7CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBsZWZ0IC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIHB1dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgVEFCTEU6CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE0KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm5sZW4gPSAoaG9sZCAmIDMxKSArIDI1NzsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA1OwogICAgICAgICAgICAgICAgYml0cyAtPSA1OwogICAgICAgICAgICAgICAgc3RhdGUubmRpc3QgPSAoaG9sZCAmIDMxKSArIDE7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNTsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNTsKICAgICAgICAgICAgICAgIHN0YXRlLm5jb2RlID0gKGhvbGQgJiAxNSkgKyA0OwogICAgICAgICAgICAgICAgaG9sZCA+Pj49IDQ7CiAgICAgICAgICAgICAgICBiaXRzIC09IDQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubmxlbiA+IDI4NiB8fCBzdGF0ZS5uZGlzdCA+IDMwKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInRvbyBtYW55IGxlbmd0aCBvciBkaXN0YW5jZSBzeW1ib2xzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5MRU5TOwogICAgICAgICAgICAgIGNhc2UgTEVOTEVOUzoKICAgICAgICAgICAgICAgIHdoaWxlIChzdGF0ZS5oYXZlIDwgc3RhdGUubmNvZGUpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW29yZGVyW3N0YXRlLmhhdmUrK11dID0gaG9sZCAmIDc7CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAzOwogICAgICAgICAgICAgICAgICBiaXRzIC09IDM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB3aGlsZSAoc3RhdGUuaGF2ZSA8IDE5KSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbb3JkZXJbc3RhdGUuaGF2ZSsrXV0gPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubGVuY29kZSA9IHN0YXRlLmxlbmR5bjsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA3OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShDT0RFUywgc3RhdGUubGVucywgMCwgMTksIHN0YXRlLmxlbmNvZGUsIDAsIHN0YXRlLndvcmssIG9wdHMpOwogICAgICAgICAgICAgICAgc3RhdGUubGVuYml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBjb2RlIGxlbmd0aHMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT0RFTEVOUzsKICAgICAgICAgICAgICBjYXNlIENPREVMRU5TOgogICAgICAgICAgICAgICAgd2hpbGUgKHN0YXRlLmhhdmUgPCBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgICAgaGVyZSA9IHN0YXRlLmxlbmNvZGVbaG9sZCAmICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhlcmVfdmFsIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSsrXSA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX3ZhbCA9PT0gMTYpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAyOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgY29weSA9IDMgKyAoaG9sZCAmIDMpOwogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IDI7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IDI7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChoZXJlX3ZhbCA9PT0gMTcpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAzOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICBjb3B5ID0gMyArIChob2xkICYgNyk7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gMzsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gMzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgbiA9IGhlcmVfYml0cyArIDc7CiAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgICAgbGVuID0gMDsKICAgICAgICAgICAgICAgICAgICAgIGNvcHkgPSAxMSArIChob2xkICYgMTI3KTsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA3OwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSA3OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSArIGNvcHkgPiBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB3aGlsZSAoY29weS0tKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBsZW47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubW9kZSA9PT0gQkFEKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxlbnNbMjU2XSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGNvZGUgLS0gbWlzc2luZyBlbmQtb2YtYmxvY2siOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA5OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShMRU5TLCBzdGF0ZS5sZW5zLCAwLCBzdGF0ZS5ubGVuLCBzdGF0ZS5sZW5jb2RlLCAwLCBzdGF0ZS53b3JrLCBvcHRzKTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgICAgICAgICBpZiAocmV0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgbGl0ZXJhbC9sZW5ndGhzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGJpdHMgPSA2OwogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGNvZGUgPSBzdGF0ZS5kaXN0ZHluOwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUuZGlzdGJpdHMgfTsKICAgICAgICAgICAgICAgIHJldCA9IGluZmxhdGVfdGFibGUoRElTVFMsIHN0YXRlLmxlbnMsIHN0YXRlLm5sZW4sIHN0YXRlLm5kaXN0LCBzdGF0ZS5kaXN0Y29kZSwgMCwgc3RhdGUud29yaywgb3B0cyk7CiAgICAgICAgICAgICAgICBzdGF0ZS5kaXN0Yml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZXMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9UUkVFUykgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgY2FzZSBMRU5fOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTjsKICAgICAgICAgICAgICBjYXNlIExFTjoKICAgICAgICAgICAgICAgIGlmIChoYXZlID49IDYgJiYgbGVmdCA+PSAyNTgpIHsKICAgICAgICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBsZWZ0OwogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaG9sZCA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgICAgICAgICAgICBpbmZsYXRlX2Zhc3Qoc3RybSwgX291dCk7CiAgICAgICAgICAgICAgICAgIHB1dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgICAgICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgICAgICAgICAgICBsZWZ0ID0gc3RybS5hdmFpbF9vdXQ7CiAgICAgICAgICAgICAgICAgIG5leHQgPSBzdHJtLm5leHRfaW47CiAgICAgICAgICAgICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICAgICAgICAgICAgaGF2ZSA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgICAgICAgICAgIGhvbGQgPSBzdGF0ZS5ob2xkOwogICAgICAgICAgICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IFRZUEUpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gMDsKICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtob2xkICYgKDEgPDwgc3RhdGUubGVuYml0cykgLSAxXTsKICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGVyZV92YWwgPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYmIChoZXJlX29wICYgMjQwKSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBsYXN0X2JpdHMgPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgIGxhc3Rfb3AgPSBoZXJlX29wOwogICAgICAgICAgICAgICAgICBsYXN0X3ZhbCA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBoZXJlX3ZhbDsKICAgICAgICAgICAgICAgIGlmIChoZXJlX29wID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMSVQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGhlcmVfb3AgJiAzMikgewogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYgNjQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5FWFQ7CiAgICAgICAgICAgICAgY2FzZSBMRU5FWFQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZXh0cmEpIHsKICAgICAgICAgICAgICAgICAgbiA9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCArPSBob2xkICYgKDEgPDwgc3RhdGUuZXh0cmEpIC0gMTsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBiaXRzIC09IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUud2FzID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IERJU1Q7CiAgICAgICAgICAgICAgY2FzZSBESVNUOgogICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtob2xkICYgKDEgPDwgc3RhdGUuZGlzdGJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICBoZXJlX29wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICBpZiAoaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhlcmVfb3AgJiAyNDApID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGxhc3RfYml0cyA9IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgbGFzdF9vcCA9IGhlcmVfb3A7CiAgICAgICAgICAgICAgICAgIGxhc3RfdmFsID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCAmIDY0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgY29kZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESVNURVhUOwogICAgICAgICAgICAgIGNhc2UgRElTVEVYVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5leHRyYSkgewogICAgICAgICAgICAgICAgICBuID0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ICs9IGhvbGQgJiAoMSA8PCBzdGF0ZS5leHRyYSkgLSAxOwogICAgICAgICAgICAgICAgICBob2xkID4+Pj0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIGJpdHMgLT0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gc3RhdGUuZG1heCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IE1BVENIOwogICAgICAgICAgICAgIGNhc2UgTUFUQ0g6CiAgICAgICAgICAgICAgICBpZiAobGVmdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjb3B5ID0gX291dCAtIGxlZnQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gY29weSkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gc3RhdGUub2Zmc2V0IC0gY29weTsKICAgICAgICAgICAgICAgICAgaWYgKGNvcHkgPiBzdGF0ZS53aGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gc3RhdGUud25leHQpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5IC09IHN0YXRlLnduZXh0OwogICAgICAgICAgICAgICAgICAgIGZyb20gPSBzdGF0ZS53c2l6ZSAtIGNvcHk7CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZnJvbSA9IHN0YXRlLnduZXh0IC0gY29weTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IHN0YXRlLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBzdGF0ZS53aW5kb3c7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgZnJvbSA9IHB1dCAtIHN0YXRlLm9mZnNldDsKICAgICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gbGVmdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGxlZnQgLT0gY29weTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCAtPSBjb3B5OwogICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICBvdXRwdXRbcHV0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tY29weSk7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIExJVDoKICAgICAgICAgICAgICAgIGlmIChsZWZ0ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG91dHB1dFtwdXQrK10gPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICBsZWZ0LS07CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBDSEVDSzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCB8PSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIF9vdXQgLT0gbGVmdDsKICAgICAgICAgICAgICAgICAgc3RybS50b3RhbF9vdXQgKz0gX291dDsKICAgICAgICAgICAgICAgICAgc3RhdGUudG90YWwgKz0gX291dDsKICAgICAgICAgICAgICAgICAgaWYgKF9vdXQpIHsKICAgICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSBzdGF0ZS5mbGFncyA/IGNyYzMyKHN0YXRlLmNoZWNrLCBvdXRwdXQsIF9vdXQsIHB1dCAtIF9vdXQpIDogYWRsZXIzMihzdGF0ZS5jaGVjaywgb3V0cHV0LCBfb3V0LCBwdXQgLSBfb3V0KTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBfb3V0ID0gbGVmdDsKICAgICAgICAgICAgICAgICAgaWYgKChzdGF0ZS5mbGFncyA/IGhvbGQgOiB6c3dhcDMyKGhvbGQpKSAhPT0gc3RhdGUuY2hlY2spIHsKICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbmNvcnJlY3QgZGF0YSBjaGVjayI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOR1RIOwogICAgICAgICAgICAgIGNhc2UgTEVOR1RIOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLndyYXAgJiYgc3RhdGUuZmxhZ3MpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhvbGQgIT09IChzdGF0ZS50b3RhbCAmIDQyOTQ5NjcyOTUpKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGxlbmd0aCBjaGVjayI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRE9ORTsKICAgICAgICAgICAgICBjYXNlIERPTkU6CiAgICAgICAgICAgICAgICByZXQgPSBaX1NUUkVBTV9FTkQ7CiAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgY2FzZSBCQUQ6CiAgICAgICAgICAgICAgICByZXQgPSBaX0RBVEFfRVJST1I7CiAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgY2FzZSBNRU06CiAgICAgICAgICAgICAgICByZXR1cm4gWl9NRU1fRVJST1I7CiAgICAgICAgICAgICAgY2FzZSBTWU5DOgogICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICBzdHJtLm5leHRfb3V0ID0gcHV0OwogICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gbGVmdDsKICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0OwogICAgICAgIHN0cm0uYXZhaWxfaW4gPSBoYXZlOwogICAgICAgIHN0YXRlLmhvbGQgPSB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AgICAgIGlmICgoX2luID09PSAwICYmIF9vdXQgPT09IDAgfHwgZmx1c2ggPT09IFpfRklOSVNIKSAmJiByZXQgPT09IFpfT0spIHsKICAgICAgICAgIHJldCA9IFpfQlVGX0VSUk9SOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmV0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVFbmQoc3RybSkgewogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICB2YXIgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS53aW5kb3cpIHsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHN0cm0uc3RhdGUgPSBudWxsOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVHZXRIZWFkZXIoc3RybSwgaGVhZCkgewogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICgoc3RhdGUud3JhcCAmIDIpID09PSAwKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlLmhlYWQgPSBoZWFkOwogICAgICAgIGhlYWQuZG9uZSA9IGZhbHNlOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVTZXREaWN0aW9uYXJ5KHN0cm0sIGRpY3Rpb25hcnkpIHsKICAgICAgICB2YXIgZGljdExlbmd0aCA9IGRpY3Rpb25hcnkubGVuZ3RoOwogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICB2YXIgZGljdGlkOwogICAgICAgIHZhciByZXQ7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBpZiAoc3RhdGUud3JhcCAhPT0gMCAmJiBzdGF0ZS5tb2RlICE9PSBESUNUKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdGF0ZS5tb2RlID09PSBESUNUKSB7CiAgICAgICAgICBkaWN0aWQgPSAxOwogICAgICAgICAgZGljdGlkID0gYWRsZXIzMihkaWN0aWQsIGRpY3Rpb25hcnksIGRpY3RMZW5ndGgsIDApOwogICAgICAgICAgaWYgKGRpY3RpZCAhPT0gc3RhdGUuY2hlY2spIHsKICAgICAgICAgICAgcmV0dXJuIFpfREFUQV9FUlJPUjsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0ID0gdXBkYXRld2luZG93KHN0cm0sIGRpY3Rpb25hcnksIGRpY3RMZW5ndGgsIGRpY3RMZW5ndGgpOwogICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgIHN0YXRlLm1vZGUgPSBNRU07CiAgICAgICAgICByZXR1cm4gWl9NRU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlLmhhdmVkaWN0ID0gMTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBleHBvcnRzMi5pbmZsYXRlUmVzZXQgPSBpbmZsYXRlUmVzZXQ7CiAgICAgIGV4cG9ydHMyLmluZmxhdGVSZXNldDIgPSBpbmZsYXRlUmVzZXQyOwogICAgICBleHBvcnRzMi5pbmZsYXRlUmVzZXRLZWVwID0gaW5mbGF0ZVJlc2V0S2VlcDsKICAgICAgZXhwb3J0czIuaW5mbGF0ZUluaXQgPSBpbmZ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CiAgICAgICAgWl9FUlJOTzogLTEsCiAgICAgICAgWl9TVFJFQU1fRVJST1I6IC0yLAogICAgICAgIFpfREFUQV9FUlJPUjogLTMsCiAgICAgICAgWl9CVUZfRVJST1I6IC01LAogICAgICAgIFpfTk9fQ09NUFJFU1NJT046IDAsCiAgICAgICAgWl9CRVNUX1NQRUVEOiAxLAogICAgICAgIFpfQkVTVF9DT01QUkVTU0lPTjogOSwKICAgICAgICBaX0RFRkFVTFRfQ09NUFJFU1NJT046IC0xLAogICAgICAgIFpfRklMVEVSRUQ6IDEsCiAgICAgICAgWl9IVUZGTUFOX09OTFk6IDIsCiAgICAgICAgWl9STEU6IDMsCiAgICAgICAgWl9GSVhFRDogNCwKICAgICAgICBaX0RFRkFVTFRfU1RSQVRFR1k6IDAsCiAgICAgICAgWl9CSU5BUlk6IDAsCiAgICAgICAgWl9URVhUOiAxLAogICAgICAgIFpfVU5LTk9XTjogMiwKICAgICAgICBaX0RFRkxBVEVEOiA4CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9nemhlYWRlci5qcwogIHZhciByZXF1aXJlX2d6aGVhZGVyID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2d6aGVhZGVyLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgZnVuY3Rpb24gR1poZWFkZXIoKSB7CiAgICAgICAgdGhpcy50ZXh0ID0gMDsKICAgICAgICB0aGlzLnRpbWUgPSAwOwogICAgICAgIHRoaXMueGZsYWdzID0gMDsKICAgICAgICB0aGlzLm9zID0gMDsKICAgICAgICB0aGlzLmV4dHJhID0gbnVsbDsKICAgIC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5mbGF0ZTIob3B0aW9ucyk7CiAgICAgICAgdGhpcy5vcHRpb25zID0gdXRpbHMuYXNzaWduKHsKICAgICAgICAgIGNodW5rU2l6ZTogMTYzODQsCiAgICAgICAgICB3aW5kb3dCaXRzOiAwLAogICAgICAgICAgdG86ICIiCiAgICAgICAgfSwgb3B0aW9ucyB8fCB7fSk7CiAgICAgICAgdmFyIG9wdCA9IHRoaXMub3B0aW9uczsKICAgICAgICBpZiAob3B0LnJhdyAmJiBvcHQud2luZG93Qml0cyA+PSAwICYmIG9wdC53aW5kb3dCaXRzIDwgMTYpIHsKICAgICAgICAgIG9wdC53aW5kb3dCaXRzID0gLW9wdC53aW5kb3dCaXRzOwogICAgICAgICAgaWYgKG9wdC53aW5kb3dCaXRzID09PSAwKSB7CiAgICAgICAgICAgIG9wdC53aW5kb3dCaXRzID0gLTE1OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAob3B0LndpbmRvd0JpdHMgPj0gMCAmJiBvcHQud2luZG93Qml0cyA8IDE2ICYmICEob3B0aW9ucyAmJiBvcHRpb25zLndpbmRvd0JpdHMpKSB7CiAgICAgICAgICBvcHQud2luZG93Qml0cyArPSAzMjsKICAgICAgICB9CiAgICAgICAgaWYgKG9wdC53aW5kb3dCaXRzID4gMTUgJiYgb3B0LndpbmRvd0JpdHMgPCA0OCkgewogICAgICAgICAgaWYgKChvcHQud2luZG93Qml0cyAmIDE1KSA9PT0gMCkgewogICAgICAgICAgICBvcHQud2luZG93Qml0cyB8PSAxNTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgdGhpcy5lcnIgPSAwOwogICAgICAgIHRoaXMubXNnID0gIiI7CiAgICAgICAgdGhpcy5lbmRlZCA9IGZhbHNlOwogICAgICAgIHRoaXMuY2h1bmtzID0gW107CiAgICAgICAgdGhpcy5zdHJtID0gbmV3IFpTdHJlYW0oKTsKICAgICAgICB0aGlzLnN0cm0uYXZhaWxfb3V0ID0gMDsKICAgICAgICB2YXIgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGVJbml0Mih0aGlzLnN0cm0sIG9wdC53aW5kb3dCaXRzKTsKICAgICAgICBpZiAoc3RhdHVzICE9PSBjLlpfT0spIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcihtc2dbc3RhdHVzXSk7CiAgICAgICAgfQogICAgICAgIHRoaXMuaGVhZGVyID0gbmV3IEdaaGVhZGVyKCk7CiAgICAgICAgemxpYl9pbmZsYXRlLmluZmxhdGVHZXRIZWFkZXIodGhpcy5zdHJtLCB0aGlzLmhlYWRlcik7CiAgICAgICAgaWYgKG9wdC5kaWN0aW9uYXJ5KSB7CiAgICAgICAgICBpZiAodHlwZW9mIG9wdC5kaWN0aW9uYXJ5ID09PSAic3RyaW5nIikgewogICAgICAgICAgICBvcHQuZGljdGlvbmFyeSA9IHN0cmluZ3Muc3RyaW5nMmJ1ZihvcHQuZGljdGlvbmFyeSk7CiAgICAgICAgICB9IGVsc2UgaWYgKHRvU3RyaW5nLmNhbGwob3B0LmRpY3Rpb25hcnkpID09PSAiW29iamVjdCBBcnJheUJ1ZmZlcl0iKSB7CiAgICAgICAgICAgIG9wdC5kaWN0aW9uYXJ5ID0gbmV3IFVpbnQ4QXJyYXkob3B0LmRpY3Rpb25hcnkpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKG9wdC5yYXcpIHsKICAgICAgICAgICAgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGVTZXREaWN0aW9uYXJ5KHRoaXMuc3RybSwgb3B0LmRpY3Rpb25hcnkpOwogICAgICAgICAgICBpZiAoc3RhdHVzICE9PSBjLlpfT0spIHsKICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IobXNnW3N0YXR1c10pOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIEluZmxhdGUyLnByb3RvdHlwZS5wdXNoID0gZnVuY3Rpb24oZGF0YSwgbW9kZSkgewogICAgICAgIHZhciBzdHJtID0gdGhpcy5zdHJtOwogICAgICAgIHZhciBjaHVua1NpemUgPSB0aGlzLm9wdGlvbnMuY2h1bmtTaXplOwogICAgICAgIHZhciBkaWN0aW9uYXJ5ID0gdGhpcy5vcHRpb25zLmRpY3Rpb25hcnk7CiAgICAgICAgdmFyIHN0YXR1cywgX21vZGU7CiAgICAgICAgdmFyIG5leHRfb3V0X3V0ZjgsIHRhaWwsIHV0ZjhzdHI7CiAgICAgICAgdmFyIGFsbG93QnVmRXJyb3IgPSBmYWxzZTsKICAgICAgICBpZiAodGhpcy5lbmRlZCkgewogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgICBfbW9kZSA9IG1vZGUgPT09IH5+bW9kZSA/IG1vZGUgOiBtb2RlID09PSB0cnVlID8gYy5aX0ZJTklTSCA6IGMuWl9OT19GTFVTSDsKICAgICAgICBpZiAodHlwZW9mIGRhdGEgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICBzdHJtLmlucHV0ID0gc3RyaW5ncy5iaW5zdHJpbmcyYnVmKGRhdGEpOwogICAgICAgIH0gZWxzZSBpZiAodG9TdHJpbmcuY2FsbChkYXRhKSA9PT0gIltvYmplY3QgQXJyYXlCdWZmZXJdIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IG5ldyBVaW50OEFycmF5KGRhdGEpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBzdHJtLmlucHV0ID0gZGF0YTsKICAgICAgICB9CiAgICAgICAgc3RybS5uZXh0X2luID0gMDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gc3RybS5pbnB1dC5sZW5ndGg7CiAgICAgICAgZG8gewogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHN0cm0ub3V0cHV0ID0gbmV3IHV0aWxzLkJ1ZjgoY2h1bmtTaXplKTsKICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IDA7CiAgICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gY2h1bmtTaXplOwogICAgICAgICAgfQogICAgICAgICAgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGUoc3RybSwgYy5aX05PX0ZMVVNIKTsKICAgICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9ORUVEX0RJQ1QgJiYgZGljdGlvbmFyeSkgewogICAgICAgICAgICBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZVNldERpY3Rpb25hcnkodGhpcy5zdHJtLCBkaWN0aW9uYXJ5KTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9CVUZfRVJST1IgJiYgYWxsb3dCdWZFcnJvciA9PT0gdHJ1ZSkgewogICAgICAgICAgICBzdGF0dXMgPSBjLlpfT0s7CiAgICAgICAgICAgIGFsbG93QnVmRXJyb3IgPSBmYWxzZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdGF0dXMgIT09IGMuWl9TVFJFQU1fRU5EICYmIHN0YXR1cyAhPT0gYy5aX09LKSB7CiAgICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgICAgdGhpcy5lbmRlZCA9IHRydWU7CiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdHJtLm5leHRfb3V0KSB7CiAgICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCB8fCBzdGF0dXMgPT09IGMuWl9TVFJFQU1fRU5EIHx8IHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgKF9tb2RlID09PSBjLlpfRklOSVNIIHx8IF9tb2RlID09PSBjLlpfU1lOQ19GTFVTSCkpIHsKICAgICAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLnRvID09PSAic3RyaW5nIikgewogICAgICAgICAgICAgICAgbmV4dF9vdXRfdXRmOCA9IHN0cmluZ3MudXRmOGJvcmRlcihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCk7CiAgICAgICAgICAgICAgICB0YWlsID0gc3RybS5uZXh0X291dCAtIG5leHRfb3V0X3V0Zjg7CiAgICAgICAgICAgICAgICB1dGY4c3RyID0gc3RyaW5ncy5idWYyc3RyaW5nKHN0cm0ub3V0cHV0LCBuZXh0X291dF91dGY4KTsKICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSB0YWlsOwogICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBjaHVua1NpemUgLSB0YWlsOwogICAgICAgICAgICAgICAgaWYgKHRhaWwpIHsKICAgICAgICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RybS5vdXRwdXQsIHN0cm0ub3V0cHV0LCBuZXh0X291dF91dGY4LCB0YWlsLCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0ZjhzdHIpOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0aGlzLm9uRGF0YSh1dGlscy5zaHJpbmtCdWYoc3RybS5vdXRwdXQsIHN0cm0ubmV4dF9vdXQpKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdHJtLmF2YWlsX2luID09PSAwICYmIHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIGFsbG93QnVmRXJyb3IgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKChzdHJtLmF2YWlsX2luID4gMCB8fCBzdHJtLmF2YWlsX291dCA9PT0gMCkgJiYgc3RhdHVzICE9PSBjLlpfU1RSRUFNX0VORCk7CiAgICAgICAgaWYgKHN0YXR1cyA9PT0gYy5aX1NUUkVBTV9FTkQpIHsKICAgICAgICAgIF9tb2RlID0gYy5aX0ZJTklTSDsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBjLlpfRklOSVNIKSB7CiAgICAgICAgICBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZUVuZCh0aGlzLnN0cm0pOwogICAgICAgICAgdGhpcy5vbkVuZChzdGF0dXMpOwogICAgICAgICAgdGhpcy5lbmRlZCA9IHRydWU7CiAgICAgICAgICByZXR1cm4gc3RhdHVzID09PSBjLlpfT0s7CiAgICAgICAgfQogICAgICAgIGlmIChfbW9kZSA9PT0gYy5aX1NZTkNfRkxVU0gpIHsKICAgICAgICAgIHRoaXMub25FbmQoYy5aX09LKTsKICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gMDsKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgfTsKICAgICAgSW5mbGF0ZTIucHJvdG90eXBlLm9uRGF0YSA9IGZ1bmN0aW9uKGNodW5rKSB7CiAgICAgICAgdGhpcy5jaHVua3MucHVzaChjaHVuayk7CiAgICAgIH07CiAgICAgIEluZmxhdGUyLnByb3RvdHlwZS5vbkVuZCA9IGZ1bmN0aW9uKHN0YXR1cykgewogICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9PSykgewogICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgdGhpcy5yZXN1bHQgPSB0aGlzLmNodW5rcy5qb2luKCIiKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdXRpbHMuZmxhdHRlbkNodW5rcyh0aGlzLmNodW5rcyk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHRoaXMuY2h1bmtzID0gW107CiAgICAgICAgdGhpcy5lcnIgPSBzdGF0dXM7CiAgICAgICAgdGhpcy5tc2cgPSB0aGlzLnN0cm0ubXNnOwogICAgICB9OwogICAgICBmdW5jdGlvbiBpbmZsYXRlKGlucHV0LCBvcHRpb25zKSB7CiAgICAgICAgdmFyIGluZmxhdG9yID0gbmV3IEluZmxhdGUyKG9wdGlvb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29uc3RhbnRzID0gcmVxdWlyZV9jb25zdGFudHMoKTsKICAgICAgdmFyIHBha28gPSB7fTsKICAgICAgYXNzaWduKHBha28sIGRlZmxhdGUsIGluZmxhdGUsIGNvbnN0YW50cyk7CiAgICAgIG1vZHVsZTIuZXhwb3J0cyA9IHBha287CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9sb25nQDQuMC4wL25vZGVfbW9kdWxlcy9sb25nL3NyYy9sb25nLmpzCiAgdmFyIHJlcXVpcmVfbG9uZyA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9sb25nQDQuMC4wL25vZGVfbW9kdWxlcy9sb25nL3NyYy9sb25nLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgIG1vZHVsZTIuZXhwb3J0cyA9IExvbmc0OwogICAgICB2YXIgd2FzbSA9IG51bGw7CiAgICAgIHRyeSB7CiAgICAgICAgd2FzbSA9IG5ldyBXZWJBc3NlbWJseS5JbnN0YW5jZShuZXcgV2ViQXNzZW1ibHkuTW9kdWxlKG5ldyBVaW50OEFycmF5KFsKICAgICAgICAgIDAsCiAgICAgICAgICA5NywKICAgICAgICAgIDExNSwKICAgICAgICAgIDEwOSwKICAgICAgICAgIDEsCiAgICAgICAgICAwLAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAxLAogICAgICAgICAgMTMsCiAgICAgICAgICAyLAogICAgICAgICAgOTYsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNywKICAgICAgICAgIDk2LAogICAgICAgICAgNCwKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAzLAogICAgICAgICAgNywKICAgICAgICAgIDYsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICA2LAogICAgICAgICAgNiwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxLAogICAgICAgICAgNjUsCiAgICAgICAgICAwLAogICAgICAgICAgMTEsCiAgICAgICAgICA3LAogICAgICAgICAgNTAsCiAgICAgICAgICA2LAogICAgICAgICAgMywKICAgICAgICAgIDEwOSwKICAgICAgICAgIDExNywKICAgICAgICAgIDEwOCwKICAgICAgICAgIDAsCiAgICAgICAgICAxLAogICAgICAgICAgNSwKICAgICAgICAgIDEwMCwKICAgICAgICAgIDEwNSwKICAgICAgICAgIDExOCwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE1LAogICAgICAgICAgMCwKICAgICAgICAgIDIsCiAgICAgICAgICA1LAogICAgICAgICAgMTAwLAogICAgICAgICAgMTA1LAogICAgICAgICAgMTE4LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMTcsCiAgICAgICAgICAwLAogICAgICAgICAgMywKICAgICAgICAgIDUsCiAgICAgICAgICAxMTQsCiAgICAgICAgICAxMDEsCiAgICAgICAgICAxMDksCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNSwKICAgICAgICAgIDAsCiAgICAgICAgICA0LAogICAgICAgICAgNSwKICAgICAgICAgIDExNCwKICAgICAgICAgIDEwMSwKICAgICAgICAgIDEwOSwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE3LAogICAgICAgICAgMCwKICAgICAgICAgIDUsCiAgICAgICAgICA4LAogICAgICAgICAgMTAzLAogICAgICAgICAgMTAxLAogICAgICAgICAgMTE2LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMDQsCiAgICAgICAgICAxMDUsCiAgICAgICAgICAxMDMsCiAgICAgICAgICAxMDQsCiAgICAgICAgICAwLAogICAgICAgICAgMCwKICAgICAgICAgIDEwLAogICAgICAgICAgMTkxLAogICAgICAgICAgMSwKICAgICAgICAgIDYsCiAgICAgICAgICA0LAogICAgICAgICAgMCwKICAgICAgICAgIDM1LAogICAgICAgICAgMCwKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI2LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI3LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI4LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI5LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTMwLAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExCiAgICAgICAgXSkpLCB7fSkuZXhwb3J0czsKICAgICAgfSBjYXRjaCAoZSkgewogICAgICB9CiAgICAgIGZ1bmN0aW9uIExvbmc0KGxvdywgaGlnaCwgdW5zaWduZWQpIHsKICAgICAgICB0aGlzLmxvdyA9IGxvdyB8IDA7CiAgICAgICAgdGhpcy5oaWdoID0gaGlnaCB8IDA7CiAgICAgICAgdGhpcy51bnNpZ25lZCA9ICEhdW5zaWduZWQ7CiAgICAgIH0KICAgICAgTG9uZzQucHJvdG90eXBlLl9faXNMb25nX187CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShMb25nNC5wcm90b3R5cGUsICJfX2lzTG9uZ19fIiwgeyB2YWx1ZTogdHJ1ZSB9KTsKICAgICAgZnVuY3Rpb24gaXNMb25nKG9iaikgewogICAgICAgIHJldHVybiAob2JqICYmIG9ialsiX19pc0xvbmdfXyJdKSA9PT0gdHJ1ZTsKICAgICAgfQogICAgICBMb25nNC5pc0xvbmcgPSBpc0xvbmc7CiAgICAgIHZhciBJTlRfQ0FDSEUgPSB7fTsKICAgICAgdmFyIFVJTlRfQ0FDSEUgPSB7fTsKICAgICAgZnVuY3Rpb24gZnJvbUludCh2YWx1ZSwgdW5zaWduZWQpIHsKICAgICAgICB2YXIgb2JqLCBjYWNoZWRPYmosIGNhY2hlOwogICAgICAgIGlmICh1bnNpZ25lZCkgewogICAgICAgICAgdmFsdWUgPj4+PSAwOwogICAgICAgICAgaWYgKGNhY2hlID0gMCA8PSB2YWx1ZSAmJiB2YWx1ZSA8IDI1NikgewogICAgICAgICAgICBjYWNoZWRPYmogPSBVSU5UX0NBQ0hFW3ZhbHVlXTsKICAgICAgICAgICAgaWYgKGNhY2hlZE9iaikKICAgICAgICAgICAgICByZXR1cm4gY2FjaGVkT2JqOwogICAgICAgICAgfQogICAgICAgICAgb2JqID0gZnJvbUJpdHModmFsdWUsICh2YWx1ZSB8IDApIDwgMCA/IC0xIDogMCwgdHJ1ZSk7CiAgICAgICAgICBpZiAoY2FjaGUpCiAgICAgICAgICAgIFVJTlRfQ0FDSEVbdmFsdWVdID0gb2JqOwogICAgICAgICAgcmV0dXJuIG9iajsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdmFsdWUgfD0gMDsKICAgICAgICAgIGlmIChjYWNoZSA9IC0xMjggPD0gdmFsdWUgJiYgdmFsdWUgPCAxMjgpIHsKICAgICAgICAgICAgY2FjaGVkT2JqID0gSU5UX0NBQ0hFW3ZhbHVlXTsKICAgICAgICAgICAgaWYgKGNhY2hlZE9iaikKICAgICAgICAgICAgICByZXR1cm4gY2FjaGVkT2JqOwogICAgICAgICAgfQogICAgICAgICAgb2JqID0gZnJvbUJpdHModmFsdWUsIHZhbHVlIDwgMCA/IC0xIDogMCwgZmFsc2UpOwogICAgICAgICAgaWYgKGNhY2hlKQogICAgICAgICAgICBJTlRfQ0FDSEVbdmFsdWVdID0gb2JqOwogICAgICAgICAgcmV0dXJuIG9iajsKICAgICAgICB9CiAgICAgIH0KICAgICAgTG9uZzQuZnJvbUludCA9IGZyb21JbnQ7CiAgICAgIGZ1bmN0aW9uIGZyb21OdW1iZXIodmFsdWUsIHVuc2lnbmVkKSB7CiAgICAgICAgaWYgKGlzTmFOKHZhbHVlKSkKICAgICAgICAgIHJldHVybiB1bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICBpZiAodW5zaWduZWQpIHsKICAgICAgICAgIGlmICh2YWx1ZSA8IDApCiAgICAgICAgICAgIHJldHVybiBVWkVSTzsKICAgICAgICAgIGlmICh2YWx1ZSA+PSBUV09fUFdSXzY0X0RCTCkKICAgICAgICAgICAgcmV0dXJuIE1BWF9VTlNJR05FRF9WQUxVRTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKHZhbHVlIDw9IC1UV09fUFdSXzYzX0RCTCkKICAgICAgICAgICAgcmV0dXJuIE1JTl9WQUxVRTsKICAgICAgICAgIGlmICh2YWx1ZSArIDEgPj0gVFdPX1BXUl82M19EQkwpCiAgICAgICAgICAgIHJldHVybiBNQVhfVkFMVUU7CiAgICAgICAgfQogICAgICAgIGlmICh2YWx1ZSA8IDApCiAgICAgICAgICByZXR1cm4gZnJvbU51bWJlcigtdmFsdWUsIHVuc2lnbmVkKS5uZWcoKTsKICAgICAgICByZX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pKSA+IDApCiAgICAgICAgICB0aHJvdyBFcnJvcigiaW50ZXJpb3IgaHlwaGVuIik7CiAgICAgICAgZWxzZSBpZiAocCA9PT0gMCkgewogICAgICAgICAgcmV0dXJuIGZyb21TdHJpbmcoc3RyLnN1YnN0cmluZygxKSwgdW5zaWduZWQsIHJhZGl4KS5uZWcoKTsKICAgICAgICB9CiAgICAgICAgdmFyIHJhZGl4VG9Qb3dlciA9IGZyb21OdW1iZXIocG93X2RibChyYWRpeCwgOCkpOwogICAgICAgIHZhciByZXN1bHQgPSBaRVJPOwogICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSArPSA4KSB7CiAgICAgICAgICB2YXIgc2l6ZSA9IE1hdGgubWluKDgsIHN0ci5sZW5ndGggLSBpKSwgdmFsdWUgPSBwYXJzZUludChzdHIuc3Vic3RyaW5nKGksIGkgKyBzaXplKSwgcmFkaXgpOwogICAgICAgICAgaWYgKHNpemUgPCA4KSB7CiAgICAgICAgICAgIHZhciBwb3dlciA9IGZyb21OdW1iZXIocG93X2RibChyYWRpeCwgc2l6ZSkpOwogICAgICAgICAgICByZXN1bHQgPSByZXN1bHQubXVsKHBvd2VyKS5hZGQoZnJvbU51bWJlcih2YWx1ZSkpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmVzdWx0ID0gcmVzdWx0Lm11bChyYWRpeFRvUG93ZXIpOwogICAgICAgICAgICByZXN1bHQgPSByZXN1bHQuYWRkKGZyb21OdW1iZXIodmFsdWUpKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmVzdWx0LnVuc2lnbmVkID0gdW5zaWduZWQ7CiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgfQogICAgICBMb25nNC5mcm9tU3RyaW5nID0gZnJvbVN0cmluZzsKICAgICAgZnVuY3Rpb24gZnJvbVZhbHVlKHZhbCwgdW5zaWduZWQpIHsKICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gIm51bWJlciIpCiAgICAgICAgICByZXR1cm4gZnJvbU51bWJlcih2YWwsIHVuc2lnbmVkKTsKICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gInN0cmluZyIpCiAgICAgICAgICByZXR1cm4gZnJvbVN0cmluZyh2YWwsIHVuc2lnbmVkKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModmFsLmxvdywgdmFsLmhpZ2gsIHR5cGVvZiB1bnNpZ25lZCA9PT0gImJvb2xlYW4iID8gdW5zaWduZWQgOiB2YWwudW5zaWduZWQpOwogICAgICB9CiAgICAgIExvbmc0LmZyb21WYWx1ZSA9IGZyb21WYWx1ZTsKICAgICAgdmFyIFRXT19QV1JfMTZfREJMID0gMSA8PCAxNjsKICAgICAgdmFyIFRXT19QV1JfMjRfREJMID0gMSA8PCAyNDsKICAgICAgdmFyIFRXT19QV1JfMzJfREJMID0gVFdPX1BXUl8xNl9EQkwgKiBUV09fUFdSXzE2X0RCTDsKICAgICAgdmFyIFRXT19QV1JfNjRfREJMID0gVFdPX1BXUl8zMl9EQkwgKiBUV09fUFdSXzMyX0RCTDsKICAgICAgdmFyIFRXT19QV1JfNjNfREJMID0gVFdPX1BXUl82NF9EQkwgLyAyOwogICAgICB2YXIgVFdPX1BXUl8yNCA9IGZyb21JbnQoVFdPX1BXUl8yNF9EQkwpOwogICAgICB2YXIgWkVSTyA9IGZyb21JbnQoMCk7CiAgICAgIExvbmc0LlpFUk8gPSBaRVJPOwogICAgICB2YXIgVVpFUk8gPSBmcm9tSW50KDAsIHRydWUpOwogICAgICBMb25nNC5VWkVSTyA9IFVaRVJPOwogICAgICB2YXIgT05FID0gZnJvbUludCgxKTsKICAgICAgTG9uZzQuT05FID0gT05FOwogICAgICB2YXIgVU9ORSA9IGZyb21JbnQoMSwgdHJ1ZSk7CiAgICAgIExvbmc0LlVPTkUgPSBVT05FOwogICAgICB2YXIgTkVHX09ORSA9IGZyb21JbnQoLTEpOwogICAgICBMb25nNC5ORUdfT05FID0gT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CAzNiA8IHJhZGl4KQogICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcigicmFkaXgiKTsKICAgICAgICBpZiAodGhpcy5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiAiMCI7CiAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKSB7CiAgICAgICAgICBpZiAodGhpcy5lcShNSU5fVkFMVUUpKSB7CiAgICAgICAgICAgIHZhciByYWRpeExvbmcgPSBmcm9tTnVtYmVyKHJhZGl4KSwgZGl2ID0gdGhpcy5kaXYocmFkaXhMb25nKSwgcmVtMSA9IGRpdi5tdWwocmFkaXhMb25nKS5zdWIodGhpcyk7CiAgICAgICAgICAgIHJldHVybiBkaXYudG9TdHJpbmcocmFkaXgpICsgcmVtMS50b0ludCgpLnRvU3RyaW5nKHJhZGl4KTsKICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICByZXR1cm4gIi0iICsgdGhpcy5uZWcoKS50b1N0cmluZyhyYWRpeCk7CiAgICAgICAgfQogICAgICAgIHZhciByYWRpeFRvUG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIDYpLCB0aGlzLnVuc2lnbmVkKSwgcmVtID0gdGhpczsKICAgICAgICB2YXIgcmVzdWx0ID0gIiI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHZhciByZW1EaXYgPSByZW0uZGl2KHJhZGl4VG9Qb3dlciksIGludHZhbCA9IHJlbS5zdWIocmVtRGl2Lm11bChyYWRpeFRvUG93ZXIpKS50b0ludCgpID4+PiAwLCBkaWdpdHMgPSBpbnR2YWwudG9TdHJpbmcocmFkaXgpOwogICAgICAgICAgcmVtID0gcmVtRGl2OwogICAgICAgICAgaWYgKHJlbS5pc1plcm8oKSkKICAgICAgICAgICAgcmV0dXJuIGRpZ2l0cyArIHJlc3VsdDsKICAgICAgICAgIGVsc2UgewogICAgICAgICAgICB3aGlsZSAoZGlnaXRzLmxlbmd0aCA8IDYpCiAgICAgICAgIC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ICAgICAgcmV0dXJuIHRoaXMuaGlnaCAhPSAwID8gYml0ICsgMzMgOiBiaXQgKyAxOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzWmVybyA9IGZ1bmN0aW9uIGlzWmVybygpIHsKICAgICAgICByZXR1cm4gdGhpcy5oaWdoID09PSAwICYmIHRoaXMubG93ID09PSAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmVxeiA9IExvbmdQcm90b3R5cGUuaXNaZXJvOwogICAgICBMb25nUHJvdG90eXBlLmlzTmVnYXRpdmUgPSBmdW5jdGlvbiBpc05lZ2F0aXZlKCkgewogICAgICAgIHJldHVybiAhdGhpcy51bnNpZ25lZCAmJiB0aGlzLmhpZ2ggPCAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzUG9zaXRpdmUgPSBmdW5jdGlvbiBpc1Bvc2l0aXZlKCkgewogICAgICAgIHJldHVybiB0aGlzLnVuc2lnbmVkIHx8IHRoaXMuaGlnaCA+PSAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzT2RkID0gZnVuY3Rpb24gaXNPZGQoKSB7CiAgICAgICAgcmV0dXJuICh0aGlzLmxvdyAmIDEpID09PSAxOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzRXZlbiA9IGZ1bmN0aW9uIGlzRXZlbigpIHsKICAgICAgICByZXR1cm4gKHRoaXMubG93ICYgMSkgPT09IDA7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZXF1YWxzID0gZnVuY3Rpb24gZXF1YWxzKG90aGVyKSB7CiAgICAgICAgaWYgKCFpc0xvbmcob3RoZXIpKQogICAgICAgICAgb3RoZXIgPSBmcm9tVmFsdWUob3RoZXIpOwogICAgICAgIGlmICh0aGlzLnVuc2lnbmVkICE9PSBvdGhlci51bnNpZ25lZCAmJiB0aGlzLmhpZ2ggPj4+IDMxID09PSAxICYmIG90aGVyLmhpZ2ggPj4+IDMxID09PSAxKQogICAgICAg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93LCB3YXNtLmdldF9oaWdoKCksIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgICBpZiAobXVsdGlwbGllci5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiBaRVJPOwogICAgICAgIGlmICh0aGlzLmVxKE1JTl9WQUxVRSkpCiAgICAgICAgICByZXR1cm4gbXVsdGlwbGllci5pc09kZCgpID8gTUlOX1ZBTFVFIDogWkVSTzsKICAgICAgICBpZiAobXVsdGlwbGllci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgcmV0dXJuIHRoaXMuaXNPZGQoKSA/IE1JTl9WQUxVRSA6IFpFUk87CiAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKSB7CiAgICAgICAgICBpZiAobXVsdGlwbGllci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICAgIHJldHVybiB0aGlzLm5lZygpLm11bChtdWx0aXBsaWVyLm5lZygpKTsKICAgICAgICAgIGVsc2UKICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkubXVsKG11bHRpcGxpZXIpLm5lZygpOwogICAgICAgIH0gZWxzZSBpZiAobXVsdGlwbGllci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICByZXR1cm4gdGhpcy5tdWwobXVsdGlwbGllci5uZWcoKSkubmVnKCk7CiAgICAgICAgaWYgKHRoaXMubHQoVFdPX1BXUl8yNCkgJiYgbXVsdGlwbGllci5sdChUV09fUFdSXzI0KSkKICAgICAgICAgIHJldHVybiBmcm9tTnVtYmVyKHRoaXMudG9OdW1iZXIoKSAqIG11bHRpcGxpZXIudG9OdW1iZXIoKSwgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgdmFyIGE0OCA9IHRoaXMuaGlnaCA+Pj4gMTY7CiAgICAgICAgdmFyIGEzMiA9IHRoaXMuaGlnaCAmIDY1NTM1OwogICAgICAgIHZhciBhMTYgPSB0aGlzLmxvdyA+Pj4gMTY7CiAgICAgICAgdmFyIGEwMCA9IHRoaXMubG93ICYgN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AgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5tdWwgPSBMb25nUHJvdG90eXBlLm11bHRpcGx5OwogICAgICBMb25nUHJvdG90eXBlLmRpdmlkZSA9IGZ1bmN0aW9uIGRpdmlkZShkaXZpc29yKSB7CiAgICAgICAgaWYgKCFpc0xvbmcoZGl2aXNvcikpCiAgICAgICAgICBkaXZpc29yID0gZnJvbVZhbHVlKGRpdmlzb3IpOwogICAgICAgIGlmIChkaXZpc29yLmlzWmVybygpKQogICAgICAgICAgdGhyb3cgRXJyb3IoImRpdmlzaW9uIGJ5IHplcm8iKTsKICAgICAgICBpZiAod2FzbSkgewogICAgICAgICAgaWYgKCF0aGlzLnVuc2lnbmVkICYmIHRoaXMuaGlnaCA9PT0gLTIxNDc0ODM2NDggJiYgZGl2aXNvci5sb3cgPT09IC0xICYmIGRpdmlzb3IuaGlnaCA9PT0gLTEpIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICB9CiAgICAgICAgICB2YXIgbG93ID0gKHRoaXMudW5zaWduZWQgPyB3YXNtLmRpdl91IDogd2FzbS5kaXZfcykodGhpcy5sb3csIHRoaXMuaGlnaCwgZGl2aXNvci5sb3csIGRpdmlzb3IuaGlnaCk7CiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMobG93LCB3YXNtLmdldF9oaWdoKCksIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiB0aGlzLnVuc2lnbmVkID8gVVpFUk8gOiBaRVJPOwogICAgICAgIHZhciBhcHByb3gsIHJlbSwgcmVzOwogICAgICAgIGlmICghdGhpcy51bnNpZ25lZCkgewogICAgICAgICAgaWYgKHRoaXMuZXEoTUlOX1ZBTFVFKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5lcShPTkUpIHx8IGRpdmlzb3IuZXEoTkVHX09ORSkpCiAgICAgICAgICAgICAgcmV0dXJuIE1JTl9WQUxVRTsKICAgICAgICAgICAgZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICAgIHJldHVybiBPTkU7CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgIHZhciBoYWxmVGhpcyA9IHRoaXMuc2hyKDEpOwogICAgICAgICAgICAgIGFwcHJveCA9IGhhbGZUaGlzLmRpdihkaXZpc29yKS5zaGwoMSk7CiAgICAgICAgICAgICAgaWYgKGFwcHJveC5lcShaRVJPKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGRpdmlzb3IuaXNOZWdhdGl2ZSgpID8gT05FIDogTkVHX09ORTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmVtID0gdGhpcy5zdWIoZGl2aXNvci5tdWwoYXBwcm94KSk7CiAgICAgICAgICAgICAgICByZXMgPSBhcHByb3guYWRkKHJlbS5kaXYoZGl2aXNvcikpOwogICAgICAgICAgICAgICAgcmV0dXJuIHJlczsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICByZXR1cm4gdGhpcy51bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICAgIGlmICh0aGlzLmlzTmVnYXRpdmUoKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkuZGl2KGRpdmlzb3IubmVnKCkpOwogICAgICAgICAgICByZXR1cm4gdGhpcy5uZWcoKS5kaXYoZGl2aXNvcikubmVnKCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGRpdmlzb3IuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgICByZXR1cm4gdGhpcy5kaXYoZGl2aXNvci5uZWcoKSkubmVnKCk7CiAgICAgICAgICByZXMgPSBaRVJPOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAoIWRpdmlzb3IudW5zaWduZWQpCiAgICAgICAgICAgIGRpdmlzb3IgPSBkaXZpc29yLnRvVW5zaWduZWQoKTsKICAgICAgICAgIGlmIChkaXZpc29yLmd0KHRoaXMpKQogICAgICAgICAgICByZXR1cm4gVVpFUk87CiAgICAgICAgICBpZiAoZGl2aXNvci5ndCh0aGlzLnNocnUoMSkpKQogICAgICAgICAgICByZXR1cm4gVU9ORTsKICAgICAgICAgIHJlcyA9IFVaRVJPOwogICAgICAgIH0KICAgICAgICByZW0gPSB0aGlzOwogICAgICAgIHdoaWxlIChyZW0uZ3RlKGRpdmlzb3IpKSB7CiAgICAgICAgICBhcHByb3ggPSBNYXRoLm1heCgxLCBNYXRoLmZsb29yKHJlbS50b051bWJlcigpIC8gZGl2aXNvci50b051bWJlcigpKSk7CiAgICAgICAgICB2YXIgbG9nMiA9IE1hdGguY2VpbChNYXRoLmxvZyhhcHByb3gpIC8gTWF0aC5MTjIpLCBkZWx0YSA9IGxvZzIgPD0gNDggPyAxIDogcG93X2RibCgyLCBsb2cyIC0gNDgpLCBhcHByb3hSZXMgPSBmcm9tTnVtYmVyKGFwcHJveCksIGFwcHJveFJlbSA9IGFwcHJveFJlcy5tdWwoZGl2aXNvcik7CiAgICAgICAgICB3aGlsZSAoYXBwcm94UmVtLmlzTmVnYXRpdmUoKSB8fCBhcHByb3hSZW0uZ3QocmVtKSkgewogICAgICAgICAgICBhcHByb3ggLT0gZGVsdGE7CiAgICAgICAgICAgIGFwcHJveFJlcyA9IGZyb21OdW1iZXIoYXBwcm94LCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICAgICAgYXBwcm94UmVtID0gYXBwcm94UmVzLm11bChkaXZpc29yKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChhcHByb3hSZXMuaXNaZXJvKCkpCiAgICAgICAgICAgIGFwcHJveFJlcyA9IE9ORTsKICAgICAgICAgIHJlcyA9IHJlcy5hZGQoYXBwcm94UmVzKTsKICAgICAgICAgIHJlbSA9IHJlbS5zdWIoYXBwcm94UmVtKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlczsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5kaXYgPSBMb25nUHJvdG90eXBlLmRpdmlkZTsKICAgICAgTG9uZ1Byb3RvdHlwZS5tb2R1bG8gPSBmdW5jdGlvbiBtb2R1bG8oZGl2aXNvcikgewogICAgICAgIGlmICghaXNMb25nKGRpdmlzb3IpKQogICAgICAgICAgZGl2aXNvciA9IGZyb21WYWx1ZShkaXZpc29yKTsKICAgICAgICBpZiAod2FzbSkgewogICAgICAgICAgdmFyIGxvdyA9ICh0aGlzLnVuc2lnbmVkID8gd2FzbS5yZW1fdSA6IHdhc20ucmVtX3MpKHRoaXMubG93LCB0aGlzLmhpZ2gsIGRpdmlzb3IubG93LCBkaXZpc29yLmhpZ2gpOwogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKGxvdywgd2FzbS5nZXRfaGlnaCgpLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXMuc3ViKHRoaXMuZGl2KGRpdmlzb3IpLm11bChkaXZpc29yKSk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUubW9kID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUucmVtID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUubm90ID0gZnVuY3Rpb24gbm90KCkgewogICAgICAgIHJldHVybiBmcm9tQml0cyh+dGhpcy5sb3csIH50aGlzLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmFuZCA9IGZ1bmN0aW9uIGFuZChvdGhlcikgewogICAgICAgIGlmICghaXNMb25nKG90aGVyKSkKICAgICAgICAgIG90aGVyID0gZnJvbVZhbHVlKG90aGVyKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgJiBvdGhlci5sb3csIHRoaXMuaGlnaCAmIG90aGVyLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLm9yID0gZnVuY3Rpb24gb3Iob3RoZXIpIHsKICAgICAgICBpZiAoIWlzTG9uZyhvdGhlcikpCiAgICAgICAgICBvdGhlciA9IGZyb21WYWx1ZShvdGhlcik7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IHwgb3RoZXIubG93LCB0aGlzLmhpZ2ggfCBvdGhlci5oaWdoLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS54b3IgPSBmdW5jdGlvbiB4b3Iob3RoZXIpIHsKICAgICAgICBpZiAoIWlzTG9uZyhvdGhlcikpCiAgICAgICAgICBvdGhlciA9IGZyb21WYWx1ZShvdGhlcik7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IF4gb3RoZXIubG93LCB0aGlzLmhpZ2ggXiBvdGhlci5oaWdoLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdExlZnQgPSBmdW5jdGlvbiBzaGlmdExlZnQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIGlmICgobnVtQml0cyAmPSA2MykgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNlIGlmIChudW1CaXRzIDwgMzIpCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgPDwgbnVtQml0cywgdGhpcy5oaWdoIDw8IG51bUJpdHMgfCB0aGlzLmxvdyA+Pj4gMzIgLSBudW1CaXRzLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICBlbHNlCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMoMCwgdGhpcy5sb3cgPDwgbnVtQml0cyAtIDMyLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGwgPSBMb25nUHJvdG90eXBlLnNoaWZ0TGVmdDsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0ID0gZnVuY3Rpb24gc2hpZnRSaWdodChudW1CaXRzKSB7CiAgICAgICAgaWYgKGlzTG9uZyhudW1CaXRzKSkKICAgICAgICAgIG51bUJpdHMgPSBudW1CaXRzLnRvSW50KCk7CiAgICAgICAgaWYgKChudW1CaXRzICY9IDYzKSA9PT0gMCkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKG51bUJpdHMgPCAzMikKICAgICAgICAgIHJldHVybiBmcm9tQml0cyh0aGlzLmxvdyA+Pj4gbnVtQml0cyB8IHRoaXMuaGlnaCA8PCAzMiAtIG51bUJpdHMsIHRoaXMuaGlnaCA+PiBudW1CaXRzLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICBlbHNlCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5oaWdoID4+IG51bUJpdHMgLSAzMiwgdGhpcy5oaWdoID49IDAgPyAwIDogLTEsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLnNociA9IExvbmdQcm90b3R5cGUuc2hpZnRSaWdodDsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0VW5zaWduZWQgPSBmdW5jdGlvbiBzaGlmdFJpZ2h0VW5zaWduZWQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIG51bUJpdHMgJj0gNjM7CiAgICAgICAgaWYgKG51bUJpdHMgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNl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AgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9CeXRlcyA9IGZ1bmN0aW9uIHRvQnl0ZXMobGUpIHsKICAgICAgICByZXR1cm4gbGUgPyB0aGlzLnRvQnl0ZXNMRSgpIDogdGhpcy50b0J5dGVzQkUoKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS50b0J5dGVzTEUgPSBmdW5jdGlvbiB0b0J5dGVzTEUoKSB7CiAgICAgICAgdmFyIGhpID0gdGhpcy5oaWdoLCBsbyA9IHRoaXMubG93OwogICAgICAgIHJldHVybiBbCiAgICAgICAgICBsbyAmIDI1NSwKICAgICAgICAgIGxvID4+PiA4ICYgMjU1LAogICAgICAgICAgbG8gPj4+IDE2ICYgMjU1LAogICAgICAgICAgbG8gPj4+IDI0LAogICAgICAgICAgaGkgJiAyNTUsCiAgICAgICAgICBoaSA+Pj4gOCAmIDI1NSwKICAgICAgICAgIGhpID4+PiAxNiAmIDI1NSwKICAgICAgICAgIGhpID4+PiAyNAogICAgICAgIF07CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9CeXRlc0JFID0gZnVuY3Rpb24gdG9CeXRlc0JFKCkgewogICAgICAgIHZhciBoaSA9IHRoaXMuaGlnaCwgbG8gPSB0aGlzLmxvdzsKICAgICAgICByZXR1cm4gWwogICAgICAgICAgaGkgPj4+IDI0LAogICAgICAgICAgaGkgPj4+IDE2ICYgMjU1LAogICAgICAgICAgaGkgPj4+IDggJiAyNTUsCiAgICAgICAgICBoaSAmIDI1NSwKICAgICAgICAgIGxvID4+PiAyNCwKICAgICAgICAgIGxvID4+PiAxNiAmIDI1NSwKICAgICAgICAgIGxvID4+PiA4ICYgMjU1LAogICAgICAgICAgbG8gJiAyNTUKICAgICAgICBdOwogICAgICB9OwogICAgICBMb25nNC5mcm9tQnl0ZXMgPSBmdW5jdGlvbiBmcm9tQnl0ZXMyKGJ5dGVzLCB1bnNpZ25lZCwgbGUpIHsKICAgICAgICByZXR1cm4gbGUgP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iLAogICAgICAgICAgICBtZXNzYWdlOiBlcnJvci5tZXNzYWdlLAogICAgICAgICAgICBuYW1lOiBlcnJvci5uYW1lLAogICAgICAgICAgICBzdGFjazogZXJyb3Iuc3RhY2sKICAgICAgICAgIH07CiAgICAgICAgfQogICAgICB9OwogICAgICB2YXIgaXNTZXJpYWxpemVkRXJyb3IgPSAodGhpbmcpID0+IHRoaW5nICYmIHR5cGVvZiB0aGluZyA9PT0gIm9iamVjdCIgJiYgIl9fZXJyb3JfbWFya2VyIiBpbiB0aGluZyAmJiB0aGluZy5fX2Vycm9yX21hcmtlciA9PT0gIiQkZXJyb3IiOwogICAgICBleHBvcnRzMi5EZWZhdWx0U2VyaWFsaXplciA9IHsKICAgICAgICBkZXNlcmlhbGl6ZShtZXNzYWdlKSB7CiAgICAgICAgICBpZiAoaXNTZXJpYWxpemVkRXJyb3IobWVzc2FnZSkpIHsKICAgICAgICAgICAgcmV0dXJuIERlZmF1bHRFcnJvclNlcmlhbGl6ZXIuZGVzZXJpYWxpemUobWVzc2FnZSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gbWVzc2FnZTsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIHNlcmlhbGl6ZShpbnB1dCkgewogICAgICAgICAgaWYgKGlucHV0IGluc3RhbmNlb2YgRXJyb3IpIHsKICAgICAgICAgICAgcmV0dXJuIERlZmF1bHRFcnJvclNlcmlhbGl6ZXIuc2VyaWFsaXplKGlucHV0KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiBpbnB1dDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS90aHJlYWRzQDEuNy4wL25vZGVfbW9kdWxlcy90aHJlYWRzL2Rpc3QvY29tbW9uLmpzCiAgdmFyIHJlcXVpcmVfY29tbW9uMiA9IF9fY29tbW9uSlMoewogICAgIm5vZGVf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UsIHJlamVjdCkgewogICAgICAgICAgZnVuY3Rpb24gZnVsZmlsbGVkKHZhbHVlKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgcmVqZWN0KGUpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgIHN0ZXAoZ2VuZXJhdG9yWyJ0aHJvdyJdKHZhbHVlKSk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICByZWplY3QoZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGZ1bmN0aW9uIHN0ZXAocmVzdWx0KSB7CiAgICAgICAgICAgIHJlc3VsdC5kb25lID8gcmVzb2x2ZShyZXN1bHQudmFsdWUpIDogYWRvcHQocmVzdWx0LnZhbHVlKS50aGVuKGZ1bGZpbGxlZCwgcmVqZWN0ZWQpOwogICAgICAgICAgfQogICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOwogICAgICAgIH0pOwogICAgICB9OwogICAgICB2YXIgX19pbXBvcnREZWZhdWx0ID0gZXhwb3J0czIgJiYgZXhwb3J0czIuX19pbXBvcnREZWZhdWx0IHx8IGZ1bmN0aW9uKG1vZCkgewogICAgICAgIHJldHVybiBtb2QgJiYgbW9kLl9fZXNNb2R1bGUgPyBtb2QgOiB7ICJkZWZhdWx0IjogbW9kIH07CiAgICAgIH07CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShleHBvcnRzMiwgIl9fZXNNb2R1bGUiLCB7IHZhbHVlOiB0cnVlIH0pOwogICAgICBleHB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NvbnN0IGluaXRNZXNzYWdlID0gewogICAgICAgICAgdHlwZTogbWVzc2FnZXNfMS5Xb3JrZXJNZXNzYWdlVHlwZS5pbml0LAogICAgICAgICAgZXhwb3NlZDogewogICAgICAgICAgICB0eXBlOiAiZnVuY3Rpb24iCiAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBpbXBsZW1lbnRhdGlvbl8xLmRlZmF1bHQucG9zdE1lc3NhZ2VUb01hc3Rlcihpbml0TWVzc2FnZSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcG9zdE1vZHVsZUluaXRNZXNzYWdlKG1ldGhvZE5hbWVzKSB7CiAgICAgICAgY29uc3QgaW5pdE1lc3NhZ2UgPSB7CiAgICAgICAgICB0eXBlOiBtZXNzYWdlc18xLldvcmtlck1lc3NhZ2VUeXBlLmluaXQsCiAgICAgICAgICBleHBvc2VkOiB7CiAgICAgICAgICAgIHR5cGU6ICJtb2R1bGUiLAogICAgICAgICAgICBtZXRob2RzOiBtZXRob2ROYW1lcwogICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgaW1wbGVtZW50YXRpb25fMS5kZWZhdWx0LnBvc3RNZXNzYWdlVG9NYXN0ZXIoaW5pdE1lc3NhZ2UpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHBvc3RKb2JFcnJvck1lc3NhZ2UodWlkLCByYXdFcnJvcikgewogICAgICAgIGNvbnN0IHsgcGF5bG9hZDogZXJyb3IsIHRyYW5zZmVyYWJsZXMgfSA9IGRlY29uc3RydWN0VHJhbnNmZXIocmF3RXJyb3IpOwogICAgICAgIGNvbnN0IGVycm9yTWVzc2FnZSA9IHsKICAgICAgICAgIHR5cGU6IG1lc3NhZ2VzXzEuV29ya2VyTWVzc2FnZVR5cGUuZXJyb3IsCiAgICAgICAgICB1aWQsCiAgICAgICAgICBlcnJvcjogY29tbW9uXzEuc2VyaWFsaXplKGVycm9yKQogICAgICAgIH07CiAgICAgICAgaW1wbGVtZW50YXRpb25fMS5kZW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KGpvYlVJRCwgcmVzdWx0VHlwZSk7CiAgICAgICAgICBpZiAoaXNPYnNlcnZhYmxlKHN5bmNSZXN1bHQpKSB7CiAgICAgICAgICAgIGNvbnN0IHN1YnNjcmlwdGlvbiA9IHN5bmNSZXN1bHQuc3Vic2NyaWJlKCh2YWx1ZSkgPT4gcG9zdEpvYlJlc3VsdE1lc3NhZ2Uoam9iVUlELCBmYWxzZSwgY29tbW9uXzEuc2VyaWFsaXplKHZhbHVlKSksIChlcnJvcikgPT4gewogICAgICAgICAgICAgIHBvc3RKb2JFcnJvck1lc3NhZ2Uoam9iVUlELCBjb21tb25fMS5zZXJpYWxpemUoZXJyb3IpKTsKICAgICAgICAgICAgICBhY3RpdmVTdWJzY3JpcHRpb25zLmRlbGV0ZShqb2JVSUQpOwogICAgICAgICAgICB9LCAoKSA9PiB7CiAgICAgICAgICAgICAgcG9zdEpvYlJlc3VsdE1lc3NhZ2Uoam9iVUlELCB0cnVlKTsKICAgICAgICAgICAgICBhY3RpdmVTdWJzY3JpcHRpb25zLmRlbGV0ZShqb2JVSUQpOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgYWN0aXZlU3Vic2NyaXB0aW9ucy5zZXQoam9iVUlELCBzdWJzY3JpcHRpb24pOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBjb25zdCByZXN1bHQgPSB5aWVsZCBzeW5jUmVzdWx0OwogICAgICAgICAgICAgIHBvc3RKb2JSZXN1bHRNZXNzYWdlKGpvYlVJRCwgdHJ1ZSwgY29tbW9uXzEuc2VyaWFsaXplKHJlc3VsdCkpOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgIHBvc3RKb2JFcnJvck1lc3NhZ2Uoam9iVUlELCBjb21tb25fMS5zZXJpYWxpemUoZXJyb3IpKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9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HsKICAgICAgICAgICAgcmV0dXJuICJcXHgwIiArIGhleChjaCk7CiAgICAgICAgICB9KS5yZXBsYWNlKC9bXHgxMC1ceDFGXHg3Ri1ceDlGXS9nLCBmdW5jdGlvbihjaCkgewogICAgICAgICAgICByZXR1cm4gIlxceCIgKyBoZXgoY2gpOwogICAgICAgICAgfSk7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIGNsYXNzRXNjYXBlKHMpIHsKICAgICAgICAgIHJldHVybiBzLnJlcGxhY2UoL1xcL2csICJcXFxcIikucmVwbGFjZSgvXF0vZywgIlxcXSIpLnJlcGxhY2UoL1xeL2csICJcXF4iKS5yZXBsYWNlKC8tL2csICJcXC0iKS5yZXBsYWNlKC9cMC9nLCAiXFwwIikucmVwbGFjZSgvXHQvZywgIlxcdCIpLnJlcGxhY2UoL1xuL2csICJcXG4iKS5yZXBsYWNlKC9cci9nLCAiXFxyIikucmVwbGFjZSgvW1x4MDAtXHgwRl0vZywgZnVuY3Rpb24oY2gpIHsKICAgICAgICAgICAgcmV0dXJuICJcXHgwIiArIGhleChjaCk7CiAgICAgICAgICB9KS5yZXBsYWNlKC9bXHgxMC1ceDFGXHg3Ri1ceDlGXS9nLCBmdW5jdGlvbihjaCkgewogICAgICAgICAgICByZXR1cm4gIlxceCIgKyBoZXgoY2gpOwogICAgICAgICAgfSk7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIGRlc2NyaWJlRXhwZWN0YXRpb24oZXhwZWN0YXRpb24pIHsKICAgICAgICAgIHJldHVybiBERVNDUklCRV9FWFBFQ1RBVElPTl9GTlNbZXhwZWN0YXRpb24udHlwZV0oZXhwZWN0YXRpb24pOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBkZXNjcmliZUV4cGVjdGVkKGV4cGVjdGVkMikgewogICAgICAgICAgdmFyIGRlc2NyaXB0aW9ucyA9IG5ldyBBcnJheShleHBlY3RlZDIubGVuZ3RoKSwgaSwgajsKICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBleHBlY3RlZDIubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgZGVzY3JpcHRpb25zW2ldID0gZGVzY3JpYmVFeHBlY3RhdGlvbihleHBlY3RlZDJbaV0pOwogICAgICAgICAgfQogICAgICAgICAgZGVzY3JpcHRpb25zLnNvcnQoKTsKICAgICAgICAgIGlmIChkZXNjcmlwdGlvbnMubGVuZ3RoID4gMCkgewogICAgICAgICAgICBmb3IgKGkgPSAxLCBqID0gMTsgaSA8IGRlc2NyaXB0aW9ucy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgIGlmIChkZXNjcmlwdGlvbnNbaSAtIDFdICE9PSBkZXNjcmlwdGlvbnNbaV0pIHsKICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uc1tqXSA9IGRlc2NyaXB0aW9uc1tpXTsKICAgICAgICAgICAgICAgIGorKzsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZGVzY3JpcHRpb25zLmxlbmd0aCA9IGo7CiAgICAgICAgICB9CiAgICAgICAgICBzd2l0Y2ggKGRlc2NyaXB0aW9ucy5sZW5ndGgpIHsKICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgIHJldHVybiBkZXNjcmlwdGlvbnNbMF07CiAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICByZXR1cm4gZGVzY3JpcHRpb25zWzBdICsgIiBvciAiICsgZGVzY3JpcHRpb25zWzFdOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgIHJldHVybiBkZXNjcmlwdGlvbnMuc2xpY2UoMCwgLTEpLmpvaW4oIiwgIikgKyAiLCBvciAiICsgZGVzY3JpcHRpb25zW2Rlc2NyaXB0aW9ucy5sZW5ndGggLSAxXTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gZGVzY3JpYmVGb3VuZChmb3VuZDIpIHsKICAgICAgICAgIHJldHVybiBmb3VuZDIgPyAn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R1cm4geyB0eXBlOiAib3RoZXIiLCBkZXNjcmlwdGlvbiB9OwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckY29tcHV0ZVBvc0RldGFpbHMocG9zKSB7CiAgICAgICAgICB2YXIgZGV0YWlscyA9IHBlZyRwb3NEZXRhaWxzQ2FjaGVbcG9zXSwgcDsKICAgICAgICAgIGlmIChkZXRhaWxzKSB7CiAgICAgICAgICAgIHJldHVybiBkZXRhaWxzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcCA9IHBvcyAtIDE7CiAgICAgICAgICAgIHdoaWxlICghcGVnJHBvc0RldGFpbHNDYWNoZVtwXSkgewogICAgICAgICAgICAgIHAtLTsKICAgICAgICAgICAgfQogICAgICAgICAgICBkZXRhaWxzID0gcGVnJHBvc0RldGFpbHNDYWNoZVtwXTsKICAgICAgICAgICAgZGV0YWlscyA9IHsKICAgICAgICAgICAgICBsaW5lOiBkZXRhaWxzLmxpbmUsCiAgICAgICAgICAgICAgY29sdW1uOiBkZXRhaWxzLmNvbHVtbgogICAgICAgICAgICB9OwogICAgICAgICAgICB3aGlsZSAocCA8IHBvcykgewogICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHApID09PSAxMCkgewogICAgICAgICAgICAgICAgZGV0YWlscy5saW5lKys7CiAgICAgICAgICAgICAgICBkZXRhaWxzLmNvbHVtbiA9IDE7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGRldGFpbHMuY29sdW1uKys7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHArKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBwZWckcG9zRGV0YWlsc0NhY2hlW3Bvc10gPSBkZXRhaWxzOwogICAgICAgICAgICByZXR1cm4gZGV0YWlsczsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJGNvbXB1dGVMb2NhdGlvbihzdGFydFBvcywgZW5kUG9zKSB7CiAgICAgICAgICB2YXIgc3RhcnRQb3NEZXRhaWxzID0gcGVnJGNvbXB1dGVQb3NEZXRhaWxzKHN0YXJ0UG9zKSwgZW5kUG9zRGV0YWlscyA9IHBlZyRjb21wdXRlUG9zRGV0YWlscyhlbmRQb3MpOwogICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgc3RhcnQ6IHsKICAgICAgICAgICAgICBvZmZzZXQ6IHN0YXJ0UG9zLAogICAgICAgICAgICAgIGxpbmU6IHN0YXJ0UG9zRGV0YWlscy5saW5lLAogICAgICAgICAgICAgIGNvbHVtbjogc3RhcnRQb3NEZXRhaWxzLmNvbHVtbgogICAgICAgICAgICB9LAogICAgICAgICAgICBlbmQ6IHsKICAgICAgICAgICAgICBvZmZzZXQ6IGVuZFBvcywKICAgICAgICAgICAgICBsaW5lOiBlbmRQb3NEZXRhaWxzLmxpbmUsCiAgICAgICAgICAgICAgY29sdW1uOiBlbmRQb3NEZXRhaWxzLmNvbHVtbgogICAgICAgICAgICB9CiAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckZmFpbChleHBlY3RlZDIpIHsKICAgICAgICAgIGlmIChwZWckY3VyclBvcyA8IHBlZyRtYXhGYWlsUG9zKSB7CiAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChwZWckY3VyclBvcyA+IHBlZyRtYXhGYWlsUG9zKSB7CiAgICAgICAgICAgIHBlZyRtYXhGYWlsUG9zID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICAgIHBlZyRtYXhGYWlsRXhwZWN0ZWQgPSBbXTsKICAgICAgICAgIH0KICAgICAgICAgIHBlZyRtYXhGYWlsRXhwZWN0ZWQucHVzaChleHBlY3RlZDIpOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckYnVpbGRTaW1wbGVFcnJvcihtZXNzYWdlLCBsb2NhdGlvbjIpIHsKICAgICAgICAgIHJldHVybiBuZXcgcGVnJFN5bnRheEVycm9yKG1lc3NhZ2UsIG51bGwsIG51bGwsIGxvY2F0aW9uMik7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRidWlsZFN0cnVjdHVyZWRFcnJvcihleHBlY3RlZDIsIGZvdW5kLCBsb2NhdGlvbjIpIHsKICAgICAgICAgIHJldHVybiBuZXcgcGVnJFN5bnRheEVycm9yKHBlZyRTeW50YXhFcnJvci5idWlsZE1lc3NhZ2UoZXhwZWN0ZWQyLCBmb3VuZCksIGV4cGVjdGVkMiwgZm91bmQsIGxvY2F0aW9uMik7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWRlY2xhcmF0aW9uKCkgewogICAgICAgICAgdmFyIHMwLCBzMSwgczIsIHMzLCBzNCwgczUsIHM2LCBzNywgczgsIHM5LCBzMTAsIHMxMSwgczEyLCBzMTM7CiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgczEgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczIgPSBwZWckcGFyc2VkZWNsYXJlVHlwZSgpOwogICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIHM0ID0gcGVnJHBhcnNlZGVjbGFyZU5hbWUoKTsKICAgICAgICAgICAgICAgIGlmIChzNCAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICBzNSA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICAgICAgaWYgKHM1ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgczYgPSBwZWckcGFyc2Vjb21tZW50KCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHM2ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICBzNyA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICAgICAgICAgIGlmIChzNyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDQwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgczggPSBwZWckYzA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzOCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHM4ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgczkgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHM5ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMTAgPSBwZWckcGFyc2VmaWVsZExpc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMTAgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczExID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczExICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA0MSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEyID0gcGVnJGMyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEyID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMxMiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEzID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMxMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEgPSBwZWckYzQoczIsIHM0LCBzNiwgczEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBzMDsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJHBhcnNlZGVjbGFyZVR5cGUoKSB7CiAgICAgICAgICB2YXIgczA7CiAgICAgICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCA2KSA9PT0gcGVnJGM1KSB7CiAgICAgICAgICAgIHMwID0gcGVnJGM1OwogICAgICAgICAgICBwZWckY3VyclBvcyArPSA2OwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM2KTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDYpID09PSBwZWckYzcpIHsKICAgICAgICAgICAgICBzMCA9IHBlZyRjNzsKICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSA2OwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzgpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCA1KSA9PT0gcGVnJGM5KSB7CiAgICAgICAgICAgICAgICBzMCA9IHBlZyRjOTsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zICs9IDU7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMxMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWRlY2xhcmVOYW1lKCkgewogICAgICAgICAgdmFyIHMwLCBzMSwgczIsIHMzOwogICAgICAgICAgczAgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczAgPSBwZWckY3VyclBvczsKICAgICAgICAgICAgczEgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIHMyID0gcGVnJHBhcnNlaW5kZXhUeXBlKCk7CiAgICAgICAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICBzMSA9IFtzMSwgczJdOwogICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczAgPSBwZWckY3VyclBvczsKICAgICAgICAgICAgICBzMSA9IHBlZyRwYXJzZW5hbWUoKTsKICAgICAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDQpID09PSBwZWckYzExKSB7CiAgICAgICAgICAgICAgICAgIHMyID0gcGVnJGMxMTsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNDsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHMyID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMTIpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgczEgPSBbczEsIHMyXTsKICAgICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgICAgICAgczEgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgczIgPSBwZWckcGFyc2VpbmRleFR5cGUoKTsKICAgICAgICAgICAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgNCkgPT09IHBlZyRjMTEpIHsKICAgICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJGMxMTsKICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zICs9IDQ7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMxMik7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgczEgPSBbczEsIHMyLCBzM107CiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHMwOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckcGFyc2VpbmRleFR5cGUoKSB7CiAgICAgICAgICB2YXIgczA7CiAgICAgICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCA3KSA9PT0gcGVnJGMxMykgewogICAgICAgICAgICBzMCA9IHBlZyRjMTM7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zICs9IDc7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzE0KTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDUpID09PSBwZWckYzE1KSB7CiAgICAgICAgICAgICAgczAgPSBwZWckYzE1OwogICAgICAgICAgICAgIHBlZyRjdXJyUG9zICs9IDU7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMTYpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCA2KSA9PT0gcGVnJGMxNykgewogICAgICAgICAgICAgICAgczAgPSBwZWckYzE3OwogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNjsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzE4KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBzMDsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJHBhcnNlY29tbWVudCgpIHsKICAgICAgICAgIHZhciBzMDsKICAgICAgICAgIHMwID0gcGVnJHBhcnNlbm9uUXVvdGVkU3RyaW5nKCk7CiAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczAgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWZpZWxkTGlzdCgpIHsKICAgICAgICAgIHZhciBzMCwgczEsIHMyLCBzMywgczQsIHM1LCBzNjsKICAgICAgICAgIHMwID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICBzMSA9IHBlZyRwYXJzZWZpZWxkKCk7CiAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczIgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgIGlmIChzMiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIHMzID0gW107CiAgICAgICAgICAgICAgczQgPSBwZWckY3VyclBvczsKICAgICAgICAgICAgICBzNSA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICBpZiAoczUgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIHM2ID0gcGVnJHBhcnNlZmllbGQoKTsKICAgICAgICAgICAgICAgIGlmIChzNiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzNDsKICAgICAgICAgICAgICAgICAgczUgPSBwZWckYzE5KHMxLCBzNik7CiAgICAgICAgICAgICAgICAgIHM0ID0gczU7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHM0OwogICAgICAgICAgICAgICAgICBzNCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczQ7CiAgICAgICAgICAgICAgICBzNCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHdoaWxlIChzNCAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgczMucHVzaChzNCk7CiAgICAgICAgICAgICAgICBzNCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgICAgICAgczUgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICBpZiAoczUgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgczYgPSBwZWckcGFyc2VmaWVsZCgpOwogICAgICAgICAgICAgICAgICBpZiAoczYgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzNDsKICAgICAgICAgICAgICAgICAgICBzNSA9IHBlZyRjMTkoczEsIHM2KTsKICAgICAgICAgICAgICAgICAgICBzNCA9IHM1OwogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczQ7CiAgICAgICAgICAgICAgICAgICAgczQgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHM0OwogICAgICAgICAgICAgICAgICBzNCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgczQgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICBpZiAoczQgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMxID0gcGVnJGMyMChzMSwgczMpOwogICAgICAgICAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHMwOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckcGFyc2Vjb21tZW50U3RhcnQoKSB7CiAgICAgICAgICB2YXIgczA7CiAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDM1KSB7CiAgICAgICAgICAgIHMwID0gcGVnJGMyMTsKICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMjIpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWludGVybmFsQ29tbWVudCgpIHsKICAgICAgICAgIHZhciBzMCwgczEsIHMyLCBzMywgczQ7CiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgczEgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczIgPSBwZWckcGFyc2Vjb21tZW50U3RhcnQoKTsKICAgICAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2Vub25RdW90ZWRTdHJpbmcoKTsKICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIHM0ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgaWYgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgIHMxID0gW3MxLCBzMiwgczMsIHM0XTsKICAgICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBzMDsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJHBhcnNlZmllbGQoKSB7CiAgICAgICAgICB2YXIgczAsIHMxLCBzMiwgczMsIHM0LCBzNSwgczYsIHM3LCBzOCwgczksIHMxMCwgczExLCBzMTIsIHMxMzsKICAgICAgICAgIHMwID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICBzMSA9IHBlZyRwYXJzZWZpZWxkVHlwZSgpOwogICAgICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIHMyID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZW5hbWUoKTsKICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIHM0ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgaWYgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHBlZyRjdXJyUG9zKSA9PT0gNTkpIHsKICAgICAgICAgICAgICAgICAgICBzNSA9IHBlZyRjMjM7CiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBzNSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMyNCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzNSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgIHM2ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgIGlmIChzNiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgczcgPSBwZWckcGFyc2Vjb21tZW50KCk7CiAgICAgICAgICAgICAgICAgICAgICBpZiAoczcgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgIHMxID0gcGVnJGMyNShzMSwgczMsIHM3KTsKICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgICBzMSA9IHBlZyRwYXJzZWZpZWxkVHlwZSgpOwogICAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBzMiA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHBlZyRjdXJyUG9zKSA9PT0gOTEpIHsKICAgICAgICAgICAgICAgICAgczMgPSBwZWckYzI2OwogICAgICAgICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMyNyk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICBzNCA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICAgICAgaWYgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgczUgPSBwZWckcGFyc2VmaWVsZFNpemUoKTsKICAgICAgICAgICAgICAgICAgICBpZiAoczUgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgIHM2ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgaWYgKHM2ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHBlZyRjdXJyUG9zKSA9PT0gOTMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzNyA9IHBlZyRjMjg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzNyA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMyOSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzNyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIHM4ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzOCAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgczkgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczkgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEwID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczEwICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA1OSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczExID0gcGVnJGMyMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMxMSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMjQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczExICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMTIgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczEyICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMxMyA9IHBlZyRwYXJzZWNvbW1lbnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMxMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRzYXZlZFBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMxID0gcGVnJGMzMChzMSwgczUsIHM5LCBzMTMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gczE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczAgPSBwZWckY3VyclBvczsKICAgICAgICAgICAgICBzMSA9IHBlZyRwYXJzZWZpZWxkVHlwZSgpOwogICAgICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgczIgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA0MCkgewogICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJGMwOwogICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgIHM0ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgIGlmIChzNCAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgczUgPSBwZWckcGFyc2VmaWVsZFZhbHVlcygpOwogICAgICAgICAgICAgICAgICAgICAgaWYgKHM1ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHM2ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoczYgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDQxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzNyA9IHBlZyRjMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHM3ID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHM3ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzOCA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzOCAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzOSA9IHBlZyRwYXJzZW5hbWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHM5ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEwID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMTAgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHBlZyRjdXJyUG9zKSA9PT0gNTkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczExID0gcGVnJGMyMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMxMSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzI0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMxMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMTIgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMTIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMTMgPSBwZWckcGFyc2Vjb21tZW50KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMxMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRjMzEoczEsIHM1LCBzOSwgczEzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gczE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgczAgPSBwZWckcGFyc2VpbnRlcm5hbENvbW1lbnQoKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBzMDsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJHBhcnNlZmllbGRWYWx1ZXMoKSB7CiAgICAgICAgICB2YXIgczAsIHMxLCBzMiwgczMsIHM0LCBzNSwgczY7CiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgczEgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczIgPSBbXTsKICAgICAgICAgICAgczMgPSBwZWckY3VyclBvczsKICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA0NCkgewogICAgICAgICAgICAgIHM0ID0gcGVnJGMzMjsKICAgICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHM0ID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzMzKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczUgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgaWYgKHM1ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICBzNiA9IHBlZyRwYXJzZW5hbWUoKTsKICAgICAgICAgICAgICAgIGlmIChzNiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMzsKICAgICAgICAgICAgICAgICAgczQgPSBwZWckYzE5KHMxLCBzNik7CiAgICAgICAgICAgICAgICAgIHMzID0gczQ7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMzOwogICAgICAgICAgICAgICAgICBzMyA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczM7CiAgICAgICAgICAgICAgICBzMyA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczM7CiAgICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHdoaWxlIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIHMyLnB1c2goczMpOwogICAgICAgICAgICAgIHMzID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA0NCkgewogICAgICAgICAgICAgICAgczQgPSBwZWckYzMyOwogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgczQgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzMzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICBzNSA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICAgIGlmIChzNSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICBzNiA9IHBlZyRwYXJzZW5hbWUoKTsKICAgICAgICAgICAgICAgICAgaWYgKHM2ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczM7CiAgICAgICAgICAgICAgICAgICAgczQgPSBwZWckYzE5KHMxLCBzNik7CiAgICAgICAgICAgICAgICAgICAgczMgPSBzNDsKICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMzOwogICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMzsKICAgICAgICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMzOwogICAgICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMDsKICAgICAgICAgICAgICBzMSA9IHBlZyRjMzQoczEsIHMyKTsKICAgICAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWZpZWxkVHlwZSgpIHsKICAgICAgICAgIHZhciBzMCwgczEsIHMyLCBzMzsKICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDMpID09PSBwZWckYzM1KSB7CiAgICAgICAgICAgIHMwID0gcGVnJGMzNTsKICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gMzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMzYpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgNCkgPT09IHBlZyRjMzcpIHsKICAgICAgICAgICAgICBzMCA9IHBlZyRjMzc7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNDsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMzOCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDUpID09PSBwZWckYzM5KSB7CiAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMzk7CiAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSA1OwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDYpID09PSBwZWckYzQxKSB7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJGM0MTsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNjsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNDIpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgNCkgPT09IHBlZyRjNDMpIHsKICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNDM7CiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNDsKICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM0NCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDUpID09PSBwZWckYzQ1KSB7CiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNDU7CiAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSA1OwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNDYpOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDUpID09PSBwZWckYzQ3KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJGM0NzsKICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNTsKICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNDgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgNCkgPT09IHBlZyRjNDkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNDk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNDsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM1MCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDYpID09PSBwZWckYzUxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSA2OwogICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNTIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDcpID09PSBwZWckYzUzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJGM1MzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNTQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgNCkgPT09IHBlZyRjNTUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNTU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM1Nik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDYpID09PSBwZWckYzU3KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNTc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSA2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNTgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDYpID09PSBwZWckYzU5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJGM1OTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNjApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgMykgPT09IHBlZyRjNjEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNjE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM2Mik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEgPSBwZWckcGFyc2VkZWNsYXJlVHlwZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczIgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2VkZWNsYXJlTmFtZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNjMoczEsIHMzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWZpZWxkU2l6ZSgpIHsKICAgICAgICAgIHZhciBzMDsKICAgICAgICAgIHMwID0gcGVnJHBhcnNlbnVtYmVyKCk7CiAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczAgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZW5hbWUoKSB7CiAgICAgICAgICB2YXIgczAsIHMxLCBzMiwgczMsIHM0OwogICAgICAgICAgczAgPSBwZWckY3VyclBvczsKICAgICAgICAgIHMxID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICBpZiAocGVnJGM2NC50ZXN0KGlucHV0LmNoYXJBdChwZWckY3VyclBvcykpKSB7CiAgICAgICAgICAgIHMyID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMyID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNjUpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczMgPSBbXTsKICAgICAgICAgICAgaWYgKHBlZyRjNjYudGVzdChpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpKSkgewogICAgICAgICAgICAgIHM0ID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHM0ID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzY3KTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgd2hpbGUgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczMucHVzaChzNCk7CiAgICAgICAgICAgICAgaWYgKHBlZyRjNjYudGVzdChpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpKSkgewogICAgICAgICAgICAgICAgczQgPSBpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpOwogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgczQgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzY3KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMzICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczIgPSBbczIsIHMzXTsKICAgICAgICAgICAgICBzMSA9IHMyOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczE7CiAgICAgICAgICAgICAgczEgPSBwZWckRkFJTEVEOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBwZWckY3VyclBvcyA9IHMxOwogICAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczA7CiAgICAgICAgICAgIHMxID0gcGVnJGM2OChzMSk7CiAgICAgICAgICB9CiAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgcmV0dXJuIHMwOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckcGFyc2VxdW90ZWRTdHJpbmcoKSB7CiAgICAgICAgICB2YXIgczAsIHMxLCBzMiwgczM7CiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSAzNCkgewogICAgICAgICAgICBzMSA9IHBlZyRjNjk7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzcwKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIHMyID0gW107CiAgICAgICAgICAgIGlmIChwZWckYzcxLnRlc3QoaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKSkpIHsKICAgICAgICAgICAgICBzMyA9IGlucHV0LmNoYXJBdChwZWckY3VyclBvcyk7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBzMyA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM3Mik7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHdoaWxlIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIHMyLnB1c2goczMpOwogICAgICAgICAgICAgIGlmIChwZWckYzcxLnRlc3QoaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKSkpIHsKICAgICAgICAgICAgICAgIHMzID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHMzID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM3Mik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzMiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHBlZyRjdXJyUG9zKSA9PT0gMzQpIHsKICAgICAgICAgICAgICAgIHMzID0gcGVnJGM2OTsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHMzID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM3MCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczA7CiAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNzMoczIpOwogICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBzMDsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJHBhcnNlbm9uUXVvdGVkU3RyaW5nKCkgewogICAgICAgICAgdmFyIHMwLCBzMSwgczI7CiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgczEgPSBbXTsKICAgICAgICAgIGlmIChwZWckYzc0LnRlc3QoaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKSkpIHsKICAgICAgICAgICAgczIgPSBpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpOwogICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgczIgPSBwZWckRkFJTEVEOwogICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM3NSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzMiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICBzMS5wdXNoKHMyKTsKICAgICAgICAgICAgaWYgKHBlZyRjNzQudGVzdChpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpKSkgewogICAgICAgICAgICAgIHMyID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHMyID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzc1KTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMDsKICAgICAgICAgICAgczEgPSBwZWckYzc2KHMxKTsKICAgICAgICAgIH0KICAgICAgICAgIHMwID0gczE7CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZW51bWJlcigpIHsKICAgICAgICAgIHZhciBzMCwgczEsIHMyLCBzMzsKICAgICAgICAgIHBlZyRzaWxlbnRGYWlscysrOwogICAgICAgICAgczAgPSBwZWckY3VyclBvczsKICAgICAgICAgIHMxID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIHMyID0gW107CiAgICAgICAgICAgIGlmIChwZWckYzc4LnRlc3QoaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKSkpIHsKICAgICAgICAgICAgICBzMyA9IGlucHV0LmNoYXJBdChwZWckY3VyclBvcyk7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBzMyA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM3OSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIHdoaWxlIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgczIucHVzaChzMyk7CiAgICAgICAgICAgICAgICBpZiAocGVnJGM3OC50ZXN0KGlucHV0LmNoYXJBdChwZWckY3VyclBvcykpKSB7CiAgICAgICAgICAgICAgICAgIHMzID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHMzID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNzkpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHMyID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMDsKICAgICAgICAgICAgICBzMSA9IHBlZyRjODAoKTsKICAgICAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICB9CiAgICAgICAgICBwZWckc2lsZW50RmFpbHMtLTsKICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzc3KTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHMwOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckcGFyc2VfKCkgewogICAgICAgICAgdmFyIHMwLCBzMTsKICAgICAgICAgIHBlZyRzaWxlbnRGYWlscysrOwogICAgICAgICAgczAgPSBbXTsKICAgICAgICAgIGlmIChwZWckYzgyLnRlc3QoaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKSkpIHsKICAgICAgICAgICAgczEgPSBpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpOwogICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgczEgPSBwZWckRkFJTEVEOwogICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM4Myk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICBzMC5wdXNoKHMxKTsKICAgICAgICAgICAgaWYgKHBlZyRjODIudGVzdChpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpKSkgewogICAgICAgICAgICAgIHMxID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHMxID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzgzKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHBlZyRzaWxlbnRGYWlscy0tOwogICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIHMxID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjODEpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIHBlZyRyZXN1bHQgPSBwZWckc3RhcnRSdWxlRnVuY3Rpb24oKTsKICAgICAgICBpZiAocGVnJHJlc3VsdCAhPT0gcGVnJEZBSUxFRCAmJiBwZWckY3VyclBvcyA9PT0gaW5wdXQubGVuZ3RoKSB7CiAgICAgICAgICByZXR1cm4gcGVnJHJlc3VsdDsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKH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byBmZXRjaCIpOwogICAgICB9CiAgICAgIGlmIChyZXNwb25zZS5zdGF0dXMgIT09IDIwMCkgewogICAgICAgIHRocm93IE9iamVjdC5hc3NpZ24obmV3IEVycm9yKGBIVFRQICR7cmVzcG9uc2Uuc3RhdHVzfSBmZXRjaGluZyAke3RoaXMudXJsfWApLCB7CiAgICAgICAgICBzdGF0dXM6IHJlc3BvbnNlLnN0YXR1cwogICAgICAgIH0pOwogICAgICB9CiAgICAgIGlmIChlbmNvZGluZyA9PT0gInV0ZjgiKSB7CiAgICAgICAgcmV0dXJuIHJlc3BvbnNlLnRleHQoKTsKICAgICAgfQogICAgICBpZiAoZW5jb2RpbmcpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYHVuc3VwcG9ydGVkIGVuY29kaW5nOiAke2VuY29kaW5nfWApOwogICAgICB9CiAgICAgIHJldHVybiB0aGlzLmdldEJ1ZmZlckZyb21SZXNwb25zZShyZXNwb25zZSk7CiAgICB9CiAgICBhc3luYyBzdGF0KCkgewogICAgICBpZiAoIXRoaXMuX3N0YXQpIHsKICAgICAgICBjb25zdCBidWYgPSBpbXBvcnRfYnVmZmVyMi5CdWZmZXIuYWxsb2NVbnNhZmUoMTApOwogICAgICAgIGF3YWl0IHRoaXMucmVhZChidWYsIDAsIDEwLCAwKTsKICAgICAgICBpZiAoIXRoaXMuX3N0YXQpIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgdW5hYmxlIHRvIGRldGVybWluZSBzaXplIG9mIGZpbGUgYXQgJHt0aGlzLnVybH1gKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIHRoaXMuX3N0YXQ7CiAgICB9CiAgICBhc3luYyBjbG9zZSgpIHsKICAgICAgcmV0dXJuOwogICAgfQogIH07CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9nZW5lcmljLWZpbGVoYW5kbGVAMy4xLjEvbm9kZV9tb2R1bGVzL2dlbmVyaWMtZmlsZWhhbmRsZS9lc20v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GNoZWNrLykpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoInByb2JsZW0gZGVjb21wcmVzc2luZyBibG9jazogaW5jb3JyZWN0IGd6aXAgaGVhZGVyIGNoZWNrIik7CiAgICAgIH0KICAgICAgdGhyb3cgZTsKICAgIH0KICB9CiAgYXN5bmMgZnVuY3Rpb24gdW56aXBDaHVua1NsaWNlKGlucHV0RGF0YSwgY2h1bmspIHsKICAgIHRyeSB7CiAgICAgIGxldCBzdHJtOwogICAgICBjb25zdCB7IG1pbnYsIG1heHYgfSA9IGNodW5rOwogICAgICBsZXQgY3BvcyA9IG1pbnYuYmxvY2tQb3NpdGlvbjsKICAgICAgbGV0IGRwb3MgPSBtaW52LmRhdGFQb3NpdGlvbjsKICAgICAgY29uc3QgY2h1bmtzID0gW107CiAgICAgIGNvbnN0IGNwb3NpdGlvbnMgPSBbXTsKICAgICAgY29uc3QgZHBvc2l0aW9ucyA9IFtdOwogICAgICBsZXQgdG90YWxTaXplID0gMDsKICAgICAgbGV0IGkgPSAwOwogICAgICBkbyB7CiAgICAgICAgY29uc3QgcmVtYWluaW5nSW5wdXQgPSBpbnB1dERhdGEuc3ViYXJyYXkoY3BvcyAtIG1pbnYuYmxvY2tQb3NpdGlvbik7CiAgICAgICAgY29uc3QgaW5mbGF0b3IgPSBuZXcgaW1wb3J0X3Bha28uSW5mbGF0ZSgpOwogICAgICAgICh7IHN0cm0gfSA9IGluZmxhdG9yKTsKICAgICAgICBpbmZsYXRvci5wdXNoKHJlbWFpbmluZ0lucHV0LCBpbXBvcnRfcGFrby5aX1NZTkNfRkxVU0gpOwogICAgICAgIGlmIChpbmZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcihpbmZsYXRvci5tc2cpOwogICAgICAgIH0KICAgICAgICBjb25zdCBidWZmZXIyID0gaW5mbGF0b3IucmVzdWx0OwogICAgICAgIGNodW5rcy5wdXNoKGJ1ZmZlcjIpOwogICAgICAgIGxldCBsZW4gPS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5rcy5zb3J0KGZ1bmN0aW9uKGMwLCBjMSkgewogICAgICBjb25zdCBkaWYgPSBjMC5taW52LmJsb2NrUG9zaXRpb24gLSBjMS5taW52LmJsb2NrUG9zaXRpb247CiAgICAgIGlmIChkaWYgIT09IDApIHsKICAgICAgICByZXR1cm4gZGlmOwogICAgICB9IGVsc2UgewogICAgICAgIHJldHVybiBjMC5taW52LmRhdGFQb3NpdGlvbiAtIGMxLm1pbnYuZGF0YVBvc2l0aW9uOwogICAgICB9CiAgICB9KTsKICAgIGNodW5rcy5mb3JFYWNoKChjaHVuaykgPT4gewogICAgICBpZiAoIWxvd2VzdCB8fCBjaHVuay5tYXh2LmNvbXBhcmVUbyhsb3dlc3QpID4gMCkgewogICAgICAgIGlmIChsYXN0Q2h1bmsgPT09IG51bGwpIHsKICAgICAgICAgIG1lcmdlZENodW5rcy5wdXNoKGNodW5rKTsKICAgICAgICAgIGxhc3RDaHVuayA9IGNodW5rOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAoY2FuTWVyZ2VCbG9ja3MobGFzdENodW5rLCBjaHVuaykpIHsKICAgICAgICAgICAgaWYgKGNodW5rLm1heHYuY29tcGFyZVRvKGxhc3RDaHVuay5tYXh2KSA+IDApIHsKICAgICAgICAgICAgICBsYXN0Q2h1bmsubWF4diA9IGNodW5rLm1heHY7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIG1lcmdlZENodW5rcy5wdXNoKGNodW5rKTsKICAgICAgICAgICAgbGFzdENodW5rID0gY2h1bms7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9KTsKICAgIHJldHVybiBtZXJnZWRDaHVua3M7CiAgfQoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vQGdtb2QrdGFiaXhAMS41LjExL25vZGVfbW9kdWxlcy9AZ21vZC90YWJpeC9lc20vdGJpLmpzCiAgaW5pdF9idWZmZXJfc2hpbSgpOwogIHZhciBpbXBvcn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N1cnJlbnRGZGwuY29tcGFyZVRvKHZpcnR1YWxPZmZzZXQpID4gMCA/IHZpcnR1YWxPZmZzZXQgOiBjdXJyZW50RmRsOwogICAgICB9IGVsc2UgewogICAgICAgIHJldHVybiB2aXJ0dWFsT2Zmc2V0OwogICAgICB9CiAgICB9CiAgICBhc3luYyBwYXJzZShvcHRzID0ge30pIHsKICAgICAgaWYgKCF0aGlzLnBhcnNlUCkgewogICAgICAgIHRoaXMucGFyc2VQID0gdGhpcy5fcGFyc2Uob3B0cykuY2F0Y2goKGUpID0+IHsKICAgICAgICAgIHRoaXMucGFyc2VQID0gdm9pZCAwOwogICAgICAgICAgdGhyb3cgZTsKICAgICAgICB9KTsKICAgICAgfQogICAgICByZXR1cm4gdGhpcy5wYXJzZVA7CiAgICB9CiAgICBhc3luYyBoYXNSZWZTZXEoc2VxSWQsIG9wdHMgPSB7fSkgewogICAgICByZXR1cm4gISEoKGF3YWl0IHRoaXMucGFyc2Uob3B0cykpLmluZGljZXNbc2VxSWRdIHx8IHt9KS5iaW5JbmRleDsKICAgIH0KICB9OwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vQGdtb2QrdGFiaXhAMS41LjExL25vZGVfbW9kdWxlcy9AZ21vZC90YWJpeC9lc20vdGJpLmpzCiAgdmFyIFRCSV9NQUdJQyA9IDIxNTc4MzI0OwogIHZhciBUQURfTElEWF9TSElGVCA9IDE0OwogIGZ1bmN0aW9uIHJlZzJiaW5zKGJlZywgZW5kKSB7CiAgICBiZWcgKz0gMTsKICAgIGVuZCAtPSAxOwogICAgcmV0dXJuIFsKICAgICAgWzAsIDBdLAogICAgICBbMSArIChiZWcgPj4gMjYpLCAxICsgKGVuZCA+PiAyNildLAogICAgICBbOSArIChiZWcgPj4gMjMpLCA5ICsgKGVuZCA+PiAyMyldLAogICAgICBbNzMgKyAoYmVnID4+IDIwKSwgNzMgKyAoZW5kID4+IDIwKV0sCiAgICAgIFs1ODUgKyAoYmVnID4+IDE3KSwgNTg1ICsgKGVuZCA+PiAxNyldLAogICAgICBbNDY4MSArIChiZWcgPj4gMTQpLCA0NjgxICsgKGVuZCA+PiAxNCldCiAgICBdOwogIH0KICB2YXIgVGFiaXhJbmRleCA9IGNsYXNzIGV4dGVuZHMgSW5kZXhGaWxlIHsKICAgIGFzeW5jIGxpbmVDb3VudChyZWZOYW1lLCBvcHRzID0ge30pIHsKICAgICAgY29uc3QgaW5kZXhEYXRhID0gYXdhaXQgdGhpcy5wYXJzZShvcHRzKTsKICAgICAgaWYgKCFpbmRleERhdGEpIHsKICAgICAgICByZXR1cm4gLTE7CiAgICAgIH0KICAgICAgY29uc3QgcmVmSWQgPSBpbmRleERhdGEucmVmTmFtZVRvSWRbcmVmTmFtZV07CiAgICAgIGNvbnN0IGlkeCA9IGluZGV4RGF0YS5pbmRpY2VzW3JlZklkXTsKICAgICAgaWYgKCFpZHgpIHsKICAgICAgICByZXR1cm4gLTE7CiAgICAgIH0KICAgICAgY29uc3QgeyBzdGF0cyB9ID0gaW5kZXhEYXRhLmluZGljZXNbcmVmSWRdOwogICAgICBpZiAoc3RhdHMpIHsKICAgICAgICByZXR1cm4gc3RhdHMubGluZUNvdW50OwogICAgICB9CiAgICAgIHJldHVybiAtMTsKICAgIH0KICAgIGFzeW5jIF9wYXJzZShvcHRzID0ge30pIHsKICAgICAgY29uc3QgYnVmID0gYXdhaXQgdGhpcy5maWxlaGFuZGxlLnJlYWRGaWxlKG9wdHMpOwogICAgICBjb25zdCBieXRlcyA9IGF3YWl0IHVuemlwKGJ1Zik7CiAgICAgIGNoZWNrQWJvcnRTaWduYWwob3B0cy5zaWduYWwpOwogICAgICBpZiAoYnl0ZXMucmVhZFVJbnQzMkxFKDApICE9PSBUQklfTUFHSUMpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoIk5vdCBhIFRCSSBmaWxlIik7CiAgICAgIH0KICAgICAgY29uc3QgcmVmQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRSg0KTsKICAgICAgY29uc3Q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IChjaHVua0NvdW50ID09PSAyKSB7CiAgICAgICAgICAgICAgc3RhdHMgPSB0aGlzLnBhcnNlUHNldWRvQmluKGJ5dGVzLCBjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDE2ICogY2h1bmtDb3VudDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGNvbnN0IGNodW5rQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgICAgICBjb25zdCBjaHVua3MgPSBuZXcgQXJyYXkoY2h1bmtDb3VudCk7CiAgICAgICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgY2h1bmtDb3VudDsgayArPSAxKSB7CiAgICAgICAgICAgICAgY29uc3QgdSA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCk7CiAgICAgICAgICAgICAgY29uc3QgdiA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCArIDgpOwogICAgICAgICAgICAgIGN1cnJPZmZzZXQgKz0gMTY7CiAgICAgICAgICAgICAgZmlyc3REYXRhTGluZSA9IHRoaXMuX2ZpbmRGaXJzdERhdGEoZmlyc3REYXRhTGluZSwgdSk7CiAgICAgICAgICAgICAgY2h1bmtzW2tdID0gbmV3IENodW5rKHUsIHYsIGJpbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYmluSW5kZXhbYmluXSA9IGNodW5rczsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgY29uc3QgbGluZWFyQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICBjdXJyT2Zmc2V0ICs9IDQ7CiAgICAgICAgY29uc3QgbGluZWFySW5kZXggPSBuZXcgQXJyYXkobGluZWFyQ291bnQpOwogICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgbGluZWFyQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgbGluZWFySW5kZXhba10gPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQpOwogICAgICAgICAgY3Vyck9mZnNldCArPSA4OwogICAgICAgICAgZmlyc3REYXRhTGluZSA9IHRoaXMuX2ZpbmRGaXJzdERhdGEoZmlyc3REYXRhTGluZSwgbGluZWFySW5kZXhba10pOwogICAgICAgIH0KICAgICAgICByZXR1cm4geyBiaW5JbmRleCwgbGluZWFySW5kZXgsIHN0YXRzIH07CiAgICAgIH0pOwogICAgICByZXR1cm4gewogICAgICAgIGluZGljZXMsCiAgICAgICAgbWV0YUNoYXIsCiAgICAgICAgbWF4QmluTnVtYmVyLAogICAgICAgIG1heFJlZkxlbmd0aCwKICAgICAgICBza2lwTGluZXMsCiAgICAgICAgZmlyc3REYXRhTGluZSwKICAgICAgICBjb2x1bW5OdW1iZXJzLAogICAgICAgIGNvb3JkaW5hdGVUeXBlLAogICAgICAgIGZvcm1hdCwKICAgICAgICByZWZJZFRvTmFtZSwKICAgICAgICByZWZOYW1lVG9JZCwKICAgICAgICBtYXhCbG9ja1NpemU6IDEgPDwgMTYKICAgICAgfTsKICAgIH0KICAgIHBhcnNlUHNldWRvQmluKGJ5dGVzLCBvZmZzZXQpIHsKICAgICAgY29uc3QgbGluZUNvdW50ID0gbG9uZ1RvTnVtYmVyKGltcG9ydF9sb25nMi5kZWZhdWx0LmZyb21CeXRlc0xFKGJ5dGVzLnNsaWNlKG9mZnNldCArIDE2LCBvZmZzZXQgKyAyNCksIHRydWUpKTsKICAgICAgcmV0dXJuIHsgbGluZUNvdW50IH07CiAgICB9CiAgICBfcGFyc2VOYW1lQnl0ZXMobmFtZXNCeXRlcykgewogICAgICBsZXQgY3VyclJlZklkID0gMDsKICAgICAgbGV0IGN1cnJOYW1lU3RhcnQgPSAwOwogICAgICBjb25zdCByZWZJZFRvTmFtZSA9IFtdOwogICAgICBjb25zdCByZWZOYW1lVG9JZCA9IHt9OwogICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG5hbWVzQnl0ZXMubGVuZ3RoOyBpICs9IDEpIHsKICAgICAgICBpZiAoIW5hbWVzQnl0ZXNbaV0pIHsKICAgICAgICAgIGlmIChjdXJyTmFtZVN0YXJ0IDwgaSkgewogICAgICAgICAgICBsZXQgcmVmTmFtZSA9IG5hbWVzQnl0ZXMudG9TdHJpbmcoInV0ZjgiLCBjdXJyTmFtZVN0YXJ0LCBpKTsKICAgICAgICAgICAgcmVmTmFtZSA9IHRoaXMucmVuYW1lUmVmU2VxKHJlZk5hbWUpOwogICAgICAgICAgICByZWZJZFRvTmFtZVtjdXJyUmVmSWRdID0gcmVmTmFtZTsKICAgICAgICAgICAgcmVmTmFtZVRvSWRbcmVmTmFtZV0gPSBjdXJyUmVmSWQ7CiAgICAgICAgICB9CiAgICAgICAgICBjdXJyTmFtZVN0YXJ0ID0gaSArIDE7CiAgICAgICAgICBjdXJyUmVmSWQgKz0gMTsKICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIHsgcmVmTmFtZVRvSWQsIHJlZklkVG9OYW1lIH07CiAgICB9CiAgICBhc3luYyBibG9ja3NGb3JSYW5nZShyZWZOYW1lLCBtaW4sIG1heCwgb3B0cyA9IHt9KSB7CiAgICAgIGlmIChtaW4gPCAwKSB7CiAgICAgICAgbWluID0gMDsKICAgICAgfQogICAgICBjb25zdCBpbmRleERhdGEgPSBhd2FpdCB0aGlzLnBhcnNlKG9wdHMpOwogICAgICBpZiAoIWluZGV4RGF0YSkgewogICAgICAgIHJldHVybiBbXTsKICAgICAgfQogICAgICBjb25zdCByZWZJZCA9IGluZGV4RGF0YS5yZWZOYW1lVG9JZFtyZWZOYW1lXTsKICAgICAgY29uc3QgYmEgPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmICghYmEpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3QgbWluT2Zmc2V0ID0gYmEubGluZWFySW5kZXgubGVuZ3RoID8gYmEubGluZWFySW5kZXhbbWluID4+IFRBRF9MSURYX1NISUZUID49IGJhLmxpbmVhckluZGV4Lmxlbmd0aCA/IGJhLmxpbmVhckluZGV4Lmxlbmd0aCAtIDEgOiBtaW4gPj4gVEFEX0xJRFhfU0hJRlRdIDogbmV3IFZpcnR1YWxPZmZzZXQoMCwgMCk7CiAgICAgIGlmICghbWluT2Zmc2V0KSB7CiAgICAgICAgY29uc29sZS53YXJuKCJxdWVyeWluZyBvdXRzaWRlIG9mIHBvc3NpYmxlIHRhYml4IHJhbmdlIik7CiAgICAgIH0KICAgICAgY29uc3Qgb3ZlcmxhcHBpbmdCaW5zID0gcmVnMmJpbnMobWluLCBtYXgpOwogICAgICBjb25zdCBjaHVua3MgPSBbXTsKICAgICAgZm9yIChjb25zdCBbc3RhcnQsIGVuZF0gb2Ygb3ZlcmxhcHBpbmdCaW5zKSB7CiAgICAgICAgZm9yIChsZXQgYmluID0gc3RhcnQ7IGJpbiA8PSBlbmQ7IGJpbisrKSB7CiAgICAgICAgICBpZiAoYmEuYmluSW5kZXhbYmluXSkgewogICAgICAgICAgICBjb25zdCBiaW5DaHVua3MgPSBiYS5iaW5JbmRleFtiaW5dOwogICAgICAgICAgICBmb3IgKGxldCBjID0gMDsgYyA8IGJpbkNodW5rcy5sZW5ndGg7ICsrYykgewogICAgICAgICAgICAgIGNodW5rcy5wdXNoKG5ldyBDaHVuayhiaW5DaHVua3NbY10ubWludiwgYmluQ2h1bmtzW2NdLm1heHYsIGJpbikpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGNvbnN0IG5pbnR2ID0gYmEubGluZWFySW5kZXgubGVuZ3RoOwogICAgICBsZXQgbG93ZXN0ID0gbnVsbDsKICAgICAgY29uc3QgbWluTGluID0gTWF0aC5taW4obWluID4+IDE0LCBuaW50diAtIDEpOwogICAgICBjb25zdCBtYXhMaW4gPSBNYXRoLm1pbihtYXggPj4gMTQsIG5pbnR2IC0gMSk7CiAgICAgIGZvciAobGV0IGkgPSBtaW5MaW47IGkgPD0gbWF4TGluOyArK2kpIHsKICAgICAgICBjb25zdCB2cCA9IGJhLmxpbmVhckluZGV4W2ldOwogICAgICAgIGlmICh2cCkgewogICAgICAgICAgaWYgKCFsb3dlc3QgfHwgdnAuY29tcGFyZVRvKGxvd2VzdCkgPCAwKSB7CiAgICAgICAgICAgIGxvd2VzdCA9IHZwOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gb3B0aW1pemVDaHVua3MoY2h1bmtzLCBsb3dlc3QpOwogICAgfQogIH07CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9AZ21vZCt0YWJpeEAxLjUuMTEvbm9kZV9tb2R1bGVzL0BnbW9kL3RhYml4L2VzbS9jc2kuanMKICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgdmFyIGltcG9ydF9sb25nMyA9IF9fdG9Nb2R1bGUocmVxdWlyZV9sb25nKCkpOwogIHZhciBDU0kxX01BR0lDID0gMjE1ODI2NTk7CiAgdmFyIENTSTJfTUFHSUMgPSAzODM1OTg3NTsKICBmdW5jdGlvbiBsc2hpZnQobnVtLCBiaXRzKSB7CiAgICByZXR1cm4gbnVtICogMiAqKiBiaXRzOwogIH0KICBmdW5jdGlvbiByc2hpZnQobnVtLCBiaXRzKSB7CiAgICByZXR1cm4gTWF0aC5mbG9vcihudW0gLyAyICoqIGJpdHMpOwogIH0KICB2YXIgQ1NJID0gY2xhc3MgZXh0ZW5kcyBJbmRleEZpbGUgewogICAgY29uc3RydWN0b3IoYXJncykgewogICAgICBzdXBlcihhcmdzKTsKICAgICAgdGhpcy5tYXhCaW5OdW1iZXIgPSAwOwogICAgICB0aGlzLmRlcHRoID0gMDsKICAgICAgdGhpcy5taW5TaGlmdCA9IDA7CiAgICB9CiAgICBhc3luYyBsaW5lQ291bnQocmVmTmFtZSwgb3B0cyA9IHt9KSB7CiAgICAgIGNvbnN0IGlu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ID0ge307CiAgICAgICAgbGV0IHN0YXRzOwogICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgYmluQ291bnQ7IGogKz0gMSkgewogICAgICAgICAgY29uc3QgYmluID0gYnl0ZXMucmVhZFVJbnQzMkxFKGN1cnJPZmZzZXQpOwogICAgICAgICAgaWYgKGJpbiA+IHRoaXMubWF4QmluTnVtYmVyKSB7CiAgICAgICAgICAgIHN0YXRzID0gdGhpcy5wYXJzZVBzZXVkb0JpbihieXRlcywgY3Vyck9mZnNldCArIDQpOwogICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDQgKyA4ICsgNCArIDE2ICsgMTY7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjb25zdCBsb2Zmc2V0ID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0ICsgNCk7CiAgICAgICAgICAgIGZpcnN0RGF0YUxpbmUgPSB0aGlzLl9maW5kRmlyc3REYXRhKGZpcnN0RGF0YUxpbmUsIGxvZmZzZXQpOwogICAgICAgICAgICBjb25zdCBjaHVua0NvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCArIDEyKTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNjsKICAgICAgICAgICAgY29uc3QgY2h1bmtzID0gbmV3IEFycmF5KGNodW5rQ291bnQpOwogICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGNodW5rQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgICAgIGNvbnN0IHUgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQpOwogICAgICAgICAgICAgIGNvbnN0IHYgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQgKyA4KTsKICAgICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDE2OwogICAgICAgICAgICAgIGNodW5rc1trXSA9IG5ldyBDaHVuayh1LCB2LCBiaW4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGJpbkluZGV4W2Jpbl0gPSBjaHVua3M7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiB7IGJpbkluZGV4LCBzdGF0cyB9OwogICAgICB9KTsKICAgICAgcmV0dXJuIHsKICAgICAgICAuLi5hdXgsCiAgICAgICAgY3NpOiB0cnVlLAogICAgICAgIHJlZkNvdW50LAogICAgICAgIG1heEJsb2NrU2l6ZTogMSA8PCAxNiwKICAgICAgICBmaXJzdERhdGFMaW5lLAogICAgICAgIGNzaVZlcnNpb24sCiAgICAgICAgaW5kaWNlcywKICAgICAgICBkZXB0aDogdGhpcy5kZXB0aCwKICAgICAgICBtYXhCaW5OdW1iZXI6IHRoaXMubWF4QmluTnVtYmVyLAogICAgICAgIG1heFJlZkxlbmd0aAogICAgICB9OwogICAgfQogICAgcGFyc2VQc2V1ZG9CaW4oYnl0ZXMsIG9mZnNldCkgewogICAgICBjb25zdCBsaW5lQ291bnQgPSBsb25nVG9OdW1iZXIoaW1wb3J0X2xvbmczLmRlZmF1bHQuZnJvbUJ5dGVzTEUoYnl0ZXMuc2xpY2Uob2Zmc2V0ICsgMjgsIG9mZnNldCArIDM2KSwgdHJ1ZSkpOwogICAgICByZXR1cm4geyBsaW5lQ291bnQgfTsKICAgIH0KICAgIGFzeW5jIGJsb2Nrc0ZvclJhbmdlKHJlZk5hbWUsIG1pbiwgbWF4LCBvcHRzID0ge30pIHsKICAgICAgaWYgKG1pbiA8IDApIHsKICAgICAgICBtaW4gPSAwOwogICAgICB9CiAgICAgIGNvbnN0IGluZGV4RGF0YSA9IGF3YWl0IHRoaXMucGFyc2Uob3B0cyk7CiAgICAgIGlmICghaW5kZXhEYXRhKSB7CiAgICAgICAgcmV0dXJuIFtdOwogICAgICB9CiAgICAgIGNvbnN0IHJlZklkID0gaW5kZXhEYXRhLnJlZk5hbWVUb0lkW3JlZk5hbWVdOwogICAgICBjb25zdCBiYSA9IGluZGV4RGF0YS5pbmRpY2VzW3JlZklkXTsKICAgICAgaWYgKCFiYSkgewogICAgICAgIHJldHVybiBbXTsKICAgICAgfQogICAgICBjb25zdCBvdmVybGFwcGluZ0JpbnMgPSB0aGlzLnJlZzJiaW5zKG1pbiwgbWF4KTsKICAgICAgY29uc3QgY2h1bmtzID0gW107CiAgICAgIGZvciAoY29uc3QgW3N0YXJ0LCBlbmRdIG9mIG92ZXJsYXBwaW5nQmlucykgewogICAgICAgIGZvciAobGV0IGJpbiA9IHN0YXJ0OyBiaW4gPD0gZW5kOyBiaW4rKykgewogICAgICAgICAgaWYgKGJhLmJpbkluZGV4W2Jpbl0pIHsKICAgICAgICAgICAgY29uc3QgYmluQ2h1bmtzID0gYmEuYmluSW5kZXhbYmluXTsKICAgICAgICAgICAgZm9yIChsZXQgYyA9IDA7IGMgPCBiaW5DaHVua3MubGVuZ3RoOyArK2MpIHsKICAgICAgICAgICAgICBjaHVua3MucHVzaChuZXcgQ2h1bmsoYmluQ2h1bmtzW2NdLm1pbnYsIGJpbkNodW5rc1tjXS5tYXh2LCBiaW4pKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gb3B0aW1pemVDaHVua3MoY2h1bmtzLCBuZXcgVmlydHVhbE9mZnNldCgwLCAwKSk7CiAgICB9CiAgICByZWcyYmlucyhiZWcsIGVuZCkgewogICAgICBiZWcgLT0gMTsKICAgICAgaWYgKGJlZyA8IDEpIHsKICAgICAgICBiZWcgPSAxOwogICAgICB9CiAgICAgIGlmIChlbmQgPiAyICoqIDUwKSB7CiAgICAgICAgZW5kID0gMiAqKiAzNDsKICAgICAgfQogICAgICBlbmQgLT0gMTsKICAgICAgbGV0IGwgPSAwOwogICAgICBsZXQgdCA9IDA7CiAgICAgIGxldCBzID0gdGhpcy5taW5TaGlmdCArIHRoaXMuZGVwdGggKiAzOwogICAgICBjb25zdCBiaW5zID0gW107CiAgICAgIGZvciAoOyBsIDw9IHRoaXMuZGVwdGg7IHMgLT0gMywgdCArPSBsc2hpZn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GUgaXMgbm90IHVzYWJsZSB3aXRoIFRhYml4LmApOwogICAgICAgICAgfQogICAgICAgICAgcHJldmlvdXNTdGFydENvb3JkaW5hdGUgPSBzdGFydENvb3JkaW5hdGU7CiAgICAgICAgICBpZiAob3ZlcmxhcHMpIHsKICAgICAgICAgICAgY2FsbGJhY2sobGluZS50cmltKCksIGNwb3NpdGlvbnNbcG9zXSAqICgxIDw8IDgpICsgKGJsb2NrU3RhcnQgLSBkcG9zaXRpb25zW3Bvc10pICsgYy5taW52LmRhdGFQb3NpdGlvbiArIDEpOwogICAgICAgICAgfSBlbHNlIGlmIChzdGFydENvb3JkaW5hdGUgIT09IHZvaWQgMCAmJiBzdGFydENvb3JkaW5hdGUgPj0gZW5kKSB7CiAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0aGlzLnlpZWxkVGltZSAmJiBsYXN0IC0gRGF0ZS5ub3coKSA+IHRoaXMueWllbGRUaW1lKSB7CiAgICAgICAgICAgIGxhc3QgPSBEYXRlLm5vdygpOwogICAgICAgICAgICBjaGVja0Fib3J0U2lnbmFsKHNpZ25hbCk7CiAgICAgICAgICAgIGF3YWl0IHRpbWVvdXQoMSk7CiAgICAgICAgICB9CiAgICAgICAgICBibG9ja1N0YXJ0ID0gbiArIDE7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICBhc3luYyBnZXRNZXRhZGF0YShvcHRzID0ge30pIHsKICAgICAgcmV0dXJuIHRoaXMuaW5kZXguZ2V0TWV0YWRhdGEob3B0cyk7CiAgICB9CiAgICBhc3luYyBnZXRIZWFkZXJCdWZmZXIob3B0cyA9IHt9KSB7CiAgICAgIGNvbnN0IHsgZmlyc3REYXRhTGluZSwgbWV0YUNoYXIsIG1heEJsb2NrU2l6ZSB9ID0gYXdhaXQgdGhpcy5nZXRNZXRhZGF0YShvcHRzKTsKICAgICAgY2hlY2tBYm9ydFNpZ25hbChvcHRzLnNpZ25hbCk7CiAgICAgIGNvbnN0IG1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LCBlbmQpOwogICAgICBsZXQgY3VycmVudENvbHVtbk51bWJlciA9IDE7CiAgICAgIGxldCBjdXJyZW50Q29sdW1uU3RhcnQgPSAwOwogICAgICBsZXQgcmVmU2VxID0gIiI7CiAgICAgIGxldCBzdGFydENvb3JkaW5hdGUgPSAtSW5maW5pdHk7CiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGluZS5sZW5ndGggKyAxOyBpICs9IDEpIHsKICAgICAgICBpZiAobGluZVtpXSA9PT0gIgkiIHx8IGkgPT09IGxpbmUubGVuZ3RoKSB7CiAgICAgICAgICBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gcmVmKSB7CiAgICAgICAgICAgIGlmICh0aGlzLnJlbmFtZVJlZlNlcShsaW5lLnNsaWNlKGN1cnJlbnRDb2x1bW5TdGFydCwgaSkpICE9PSByZWdpb25SZWZOYW1lKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHsgb3ZlcmxhcHM6IGZhbHNlIH07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gc3RhcnQpIHsKICAgICAgICAgICAgc3RhcnRDb29yZGluYXRlID0gcGFyc2VJbnQobGluZS5zbGljZShjdXJyZW50Q29sdW1uU3RhcnQsIGkpLCAxMCk7CiAgICAgICAgICAgIGlmIChjb29yZGluYXRlVHlwZSA9PT0gIjEtYmFzZWQtY2xvc2VkIikgewogICAgICAgICAgICAgIHN0YXJ0Q29vcmRpbmF0ZSAtPSAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzdGFydENvb3JkaW5hdGUgPj0gcmVnaW9uRW5kKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHsgc3RhcnRDb29yZGluYXRlLCBvdmVybGFwczogZmFsc2UgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoZW5kID09PSAwIHx8IGVuZCA9PT0gc3RhcnQpIHsKICAgICAgICAgICAgICBpZiAoc3RhcnRDb29yZGluYXRlICsgMSA8PSByZWdpb25TdGFydCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHsgc3RhcnRDb29yZGluYXRlLCBvdmVybGFwczogZmFsc2UgfTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoZm9ybWF0ID09PSAiVkNGIiAmJiBjdXJyZW50Q29sdW1uTnVtYmVyID09PSA0KSB7CiAgICAgICAgICAgIHJlZlNlcSA9IGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKTsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gZW5kKSB7CiAgICAgICAgICAgIGxldCBlbmRDb29yZGluYXRlOwogICAgICAgICAgICBpZiAoZm9ybWF0ID09PSAiVkNGIikgewogICAgICAgICAgICAgIGVuZENvb3JkaW5hdGUgPSB0aGlzLl9nZXRWY2ZFbmQoc3RhcnRDb29yZGluYXRlLCByZWZTZXEsIGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKSk7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgZW5kQ29vcmRpbmF0ZSA9IHBhcnNlSW50KGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKSwgMTApOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChlbmRDb29yZGluYXRlIDw9IHJlZ2lvblN0YXJ0KSB7CiAgICAgICAgICAgICAgcmV0dXJuIHsgb3ZlcmxhcHM6IGZhbHNlIH07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGN1cnJlbnRDb2x1bW5TdGFydCA9IGkgKyAxOwogICAgICAgICAgY3VycmVudENvbHVtbk51bWJlciArPSAxOwogICAgICAgICAgaWYgKGN1cnJlbnRDb2x1bW5OdW1iZXIgPiBtYXhDb2x1bW4pIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIHJldHVybiB7IHN0YXJ0Q29vcmRpbmF0ZSwgb3ZlcmxhcHM6IHRydWUgfTsKICAgIH0KICAgIF9nZXRWY2ZFbmQoc3RhcnRDb29yZGluYXRlLCByZWZTZXEsIGluZm8pIHsKICAgICAgbGV0IGVuZENvb3JkaW5hdGUgPSBzdGFydENvb3JkaW5hdGUgKyByZWZTZXEubGVuZ3RoOwogICAgICBjb25zdCBpc1RSQSA9IGluZm8uaW5kZXhPZigiU1ZUWVBFPVRSQSIpICE9PSAtMTsKICAgICAgaWYgKGluZm9bMF0gIT09ICIuIiAmJiAhaXNUUkEpIHsKICAgICAgICBsZXQgcHJldkNoYXIgPSAiOyI7CiAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBpbmZvLmxlbmd0aDsgaiArPSAxKSB7CiAgICAgICAgICBpZiAocHJldkNoYXIgPT09ICI7IiAmJiBpbmZvLnNsaWNlKGosIGogKyA0KSA9PT0gIkVORD0iKSB7CiAgICAgICAgICAgIGxldCB2YWx1ZUVuZCA9IGluZm8uaW5kZXhPZigiOyIsIGopOwogICAgICAgICAgICBpZiAodmFsdWVFbmQgPT09IC0xKSB7CiAgICAgICAgICAgICAgdmFsdWVFbmQgPSBpbmZvLmxlbmd0aDsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbmRDb29yZGluYXRlID0gcGFyc2VJbnQoaW5mby5zbGljZShqICsgNCwgdmFsdWVFbmQpLCAxMCk7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgcHJldkNoYXIgPSBpbmZvW2pdOwogICAgICAgIH0KICAgICAgfSBlbHNlIGlmIChpc1RSQSkgewogICAgICAgIHJldHVybiBzdGFydENvb3JkaW5hdGUgKyAxOwogICAgICB9CiAgICAgIHJldHVybiBlbmRDb29yZGluYXRlOwogICAgfQogICAgYXN5bmMgbGluZUNvdW50KHJlZk5hbWUsIG9wdHMgPSB7fSkgewogICAgICByZXR1cm4gdG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A9PSBudWxsKQogICAgICAgIGxvID0gMDsKICAgICAgaWYgKGhpID09IG51bGwpCiAgICAgICAgaGkgPSBhLmxlbmd0aDsKICAgICAgd2hpbGUgKGxvIDwgaGkpIHsKICAgICAgICBjb25zdCBtaWQgPSBsbyArIGhpID4+PiAxOwogICAgICAgIGlmIChjb21wYXJlKGFbbWlkXSwgeCkgPCAwKQogICAgICAgICAgbG8gPSBtaWQgKyAxOwogICAgICAgIGVsc2UKICAgICAgICAgIGhpID0gbWlkOwogICAgICB9CiAgICAgIHJldHVybiBsbzsKICAgIH0KICAgIGZ1bmN0aW9uIHJpZ2h0KGEsIHgsIGxvLCBoaSkgewogICAgICBpZiAobG8gPT0gbnVsbCkKICAgICAgICBsbyA9IDA7CiAgICAgIGlmIChoaSA9PSBudWxsKQogICAgICAgIGhpID0gYS5sZW5ndGg7CiAgICAgIHdoaWxlIChsbyA8IGhpKSB7CiAgICAgICAgY29uc3QgbWlkID0gbG8gKyBoaSA+Pj4gMTsKICAgICAgICBpZiAoY29tcGFyZShhW21pZF0sIHgpID4gMCkKICAgICAgICAgIGhpID0gbWlkOwogICAgICAgIGVsc2UKICAgICAgICAgIGxvID0gbWlkICsgMTsKICAgICAgfQogICAgICByZXR1cm4gbG87CiAgICB9CiAgICBmdW5jdGlvbiBjZW50ZXIoYSwgeCwgbG8sIGhpKSB7CiAgICAgIGlmIChsbyA9PSBudWxsKQogICAgICAgIGxvID0gMDsKICAgICAgaWYgKGhpID09IG51bGwpCiAgICAgICAgaGkgPSBhLmxlbmd0aDsKICAgICAgY29uc3QgaSA9IGxlZnQoYSwgeCwgbG8sIGhpIC0gMSk7CiAgICAgIHJldHVybiBpID4gbG8gJiYgZGVsdGEoYVtpIC0gMV0sIHgpID4gLWRlbHRhKGFbaV0sIHgpID8gaSAtIDEgOiBpOwogICAgfQogICAgcmV0dXJuIHsgbGVmdCwgY2VudGVyLCByaWdodCB9OwogIH0KICBmdW5jdGlvbiBhc2NlbmRpbmdDb21wYXJhd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x8IHRoaXMuYXR0ZW1wdERlZmF1bHRCZWQgJiYgaXNCZWQxMkxpa2UoZmllbGRzKSkgewogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXV0b1NxbC5maWVsZHMubGVuZ3RoOyBpKyspIHsKICAgICAgICAgIGNvbnN0IGF1dG9GaWVsZCA9IGF1dG9TcWwuZmllbGRzW2ldOwogICAgICAgICAgbGV0IGNvbHVtblZhbCA9IGZpZWxkc1tpXTsKICAgICAgICAgIGNvbnN0IHsgaXNOdW1lcmljLCBpc0FycmF5OiBpc0FycmF5MiwgYXJyYXlJc051bWVyaWMsIG5hbWUgfSA9IGF1dG9GaWVsZDsKICAgICAgICAgIGlmIChjb2x1bW5WYWwgPT09IG51bGwgfHwgY29sdW1uVmFsID09PSB2b2lkIDApIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoY29sdW1uVmFsICE9PSAiLiIpIHsKICAgICAgICAgICAgaWYgKGlzTnVtZXJpYykgewogICAgICAgICAgICAgIGNvbnN0IG51bSA9IE51bWJlcihjb2x1bW5WYWwpOwogICAgICAgICAgICAgIGNvbHVtblZhbCA9IE51bWJlci5pc05hTihudW0pID8gY29sdW1uVmFsIDogbnVtOwogICAgICAgICAgICB9IGVsc2UgaWYgKGlzQXJyYXkyKSB7CiAgICAgICAgICAgICAgY29sdW1uVmFsID0gY29sdW1uVmFsLnNwbGl0KCIsIik7CiAgICAgICAgICAgICAgaWYgKGNvbHVtblZhbFtjb2x1bW5WYWwubGVuZ3RoIC0gMV0gPT09ICIiKSB7CiAgICAgICAgICAgICAgICBjb2x1bW5WYWwucG9wKCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChhcnJheUlzTnVtZXJpYykgewogICAgICAgICAgICAgICAgY29sdW1uVmFsID0gY29sdW1uVmFsLm1hcCgoc3RyKSA9PiBOdW1iZXIoc3RyKSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICA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ucygpIH0gOiB2b2lkIDA7CiAgICAgICAgdGhpcy4jcGFyc2VyID0gbmV3IGJlZF9wYXJzZXJfZGVmYXVsdChvcHQpOwogICAgICB9CiAgICAgIHJldHVybiB0aGlzLiNwYXJzZXI7CiAgICB9CiAgICBhc3luYyAjY2FsY05Db2x1bW5zKCkgewogICAgICBjb25zdCBzb3VyY2UgPSBkYXRhU291cmNlcy5nZXQodGhpcy4jdWlkKTsKICAgICAgY29uc3QgeyBjaHJvbUxlbmd0aHMsIGN1bVBvc2l0aW9ucyB9ID0gc291cmNlLmNocm9tSW5mbzsKICAgICAgbGV0IG5fY29scyA9IDA7CiAgICAgIGZvciAoY29uc3QgY3VtUG9zIG9mIGN1bVBvc2l0aW9ucykgewogICAgICAgIGNvbnN0IGNocm9tTmFtZSA9IGN1bVBvcy5jaHI7CiAgICAgICAgY29uc3QgY2hyb21TdGFydCA9IGN1bVBvcy5wb3M7CiAgICAgICAgY29uc3QgY2hyb21FbmQgPSBjdW1Qb3MucG9zICsgY2hyb21MZW5ndGhzW2Nocm9tTmFtZV07CiAgICAgICAgbl9jb2xzID0gYXdhaXQgbmV3IFByb21pc2UoKHJlc29sdmUpID0+IHsKICAgICAgICAgIHNvdXJjZS5maWxlLnRiaS5nZXRMaW5lcyhjaHJvbU5hbWUsIGNocm9tU3RhcnQsIGNocm9tRW5kLCAobGluZSkgPT4gewogICAgICAgICAgICByZXNvbHZlKGxpbmUuc3BsaXQoIgkiKS5sZW5ndGgpOwogICAgICAgICAgfSk7CiAgICAgICAgfSk7CiAgICAgICAgaWYgKG5fY29scyA+IDApCiAgICAgICAgICBicmVhazsKICAgICAgfQogICAgICByZXR1cm4gbl9jb2xzOwogICAgfQogICAgYXN5bmMgZ2V0VGlsZURhdGEobWluWCwgbWF4WCkgewogICAgICBjb25zdCBzb3VyY2UgPSBkYXRhU291cmNlcy5nZXQodGhpcy4jdWlkKTsKICAgICAgY29uc3QgcGFyc2VyMiA9IGF3YWl0IHRoaXMuZ2V0UGFyc2VyKCk7CiAgICAgIGxldCBjdXJNaW5YID0gbWluWDsKICAgICAgY29uc3QgeyBjaHJvbUxlbmd0aHMsIGN1bVBvc2l0aW9ucyB9ID0gc291cmNlLmNocm9tSW5mbzsKICAgICAgY29uc3QgYWxsVGlsZXMgPSBbXTsKICAgICAgZm9yIChjb25zdCBjdW1Qb3Mgb2YgY3VtUG9zaXRpb25zKSB7CiAgICAgICAgY29uc3QgY2hyb21OYW1lID0gY3VtUG9zLmNocjsKICAgICAgICBjb25zdCBjaHJvbVN0YXJ0ID0gY3VtUG9zLnBvczsKICAgICAgICBjb25zdCBjaHJvbUVuZCA9IGN1bVBvcy5wb3MgKyBjaHJvbUxlbmd0aHNbY2hyb21OYW1lXTsKICAgICAgICBsZXQgc3RhcnRQb3MsIGVuZFBvczsKICAgICAgICBpZiAoY2hyb21TdGFydCA+IGN1ck1pblggfHwgY3VyTWluWCA+PSBjaHJvbUVuZCkgewogICAgICAgICAgY29udGludWU7CiAgICAgICAgfQogICAgICAgIGNvbnN0IHRpbGVzUHJvbWlzZSA9IG5ldyBQcm9taXNlKChyZXNvbHZlKSA9PiB7CiAgICAgICAgICBjb25zdCB0aWxlcyA9IFtdOwogICAgICAgICAgY29uc3QgbGluZUNhbGxiYWNrID0gKGxpbmUpID0+IHsKICAgICAgICAgICAgY29uc3QgYmVkVGlsZSA9IHBhcnNlcjIucGFyc2VMaW5lKGxpbmUsIGNocm9tU3RhcnQpOwogICAgICAgICAgICB0aWxlcy5wdXNoKGJlZFRpbGUpOwogICAgICAgICAgfTsKICAgICAgICAgIGlmIChtYXhYID4gY2hyb21FbmQpIHsKICAgICAgICAgICAgc3RhcnRQb3MgPSBjdXJNaW5YIC0gY2hyb21TdGFydDsKICAgICAgICAgICAgZW5kUG9zID0gY2hyb21FbmQgLSBjaHJvbVN0YXJ0OwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgc3RhcnRQb3MgPSBNYXRoLmZsb29yKGN1ck1pblggLSBjaHJv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m9taXNlcyA9IFtdOwogICAgZm9yIChjb25zdCB0aWxlSWQgb2YgdGlsZUlkcykgewogICAgICBjb25zdCBwYXJ0cyA9IHRpbGVJZC5zcGxpdCgiLiIpOwogICAgICBjb25zdCB6ID0gcGFyc2VJbnQocGFydHNbMF0sIDEwKTsKICAgICAgY29uc3QgeCA9IHBhcnNlSW50KHBhcnRzWzFdLCAxMCk7CiAgICAgIGlmIChOdW1iZXIuaXNOYU4oeCkgfHwgTnVtYmVyLmlzTmFOKHopKSB7CiAgICAgICAgY29uc29sZS53YXJuKCJJbnZhbGlkIHRpbGUgem9vbSBvciBwb3NpdGlvbjoiLCB6LCB4KTsKICAgICAgICBjb250aW51ZTsKICAgICAgfQogICAgICB2YWxpZFRpbGVJZHMucHVzaCh0aWxlSWQpOwogICAgICB0aWxlUHJvbWlzZXMucHVzaCh0aWxlKHVpZCwgeiwgeCkpOwogICAgfQogICAgcmV0dXJuIFByb21pc2UuYWxsKHRpbGVQcm9taXNlcykudGhlbigodmFsdWVzMikgPT4gewogICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHZhbHVlczIubGVuZ3RoOyBpKyspIHsKICAgICAgICBjb25zdCB2YWxpZFRpbGVJZCA9IHZhbGlkVGlsZUlkc1tpXTsKICAgICAgICB0aWxlc1t2YWxpZFRpbGVJZF0gPSB7IHRpbGVQb3NpdGlvbklkOiB2YWxpZFRpbGVJZCB9OwogICAgICB9CiAgICAgIHJldHVybiB0aWxlczsKICAgIH0pOwogIH07CiAgdmFyIGdldFRhYnVsYXJEYXRhID0gKHVpZCwgdGlsZUlkcykgPT4gewogICAgY29uc3QgZGF0YSA9IFtdOwogICAgdGlsZUlkcy5mb3JFYWNoKCh0aWxlSWQpID0+IHsKICAgICAgY29uc3QgcGFydHMgPSB0aWxlSWQuc3BsaXQoIi4iKTsKICAgICAgY29uc3QgeiA9IHBhcnNlSW50KHBhcnRzWzBdLCAxMCk7CiAgICAgIGNvbnN0IHggPSBwYXJzZUludChwYXJ0c1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ZWU3NTQuIEJTRC0zLUNsYXVzZSBMaWNlbnNlLiBGZXJvc3MgQWJvdWtoYWRpamVoIDxodHRwczovL2Zlcm9zcy5vcmcvb3BlbnNvdXJjZT4gKi8KLyoqCiAqIEBsaWNlbnNlCiAqIExvZGFzaCAoQ3VzdG9tIEJ1aWxkKSA8aHR0cHM6Ly9sb2Rhc2guY29tLz4KICogQnVpbGQ6IGBsb2Rhc2ggbW9kdWxhcml6ZSBleHBvcnRzPSJlcyIgLW8gLi9gCiAqIENvcHlyaWdodCBPcGVuSlMgRm91bmRhdGlvbiBhbmQgb3RoZXIgY29udHJpYnV0b3JzIDxodHRwczovL29wZW5qc2Yub3JnLz4KICogUmVsZWFzZWQgdW5kZXIgTUlUIGxpY2Vuc2UgPGh0dHBzOi8vbG9kYXNoLmNvbS9saWNlbnNlPgogKiBCYXNlZCBvbiBVbmRlcnNjb3JlLmpzIDEuOC4zIDxodHRwOi8vdW5kZXJzY29yZWpzLm9yZy9MSUNFTlNFPgogKiBDb3B5cmlnaHQgSmVyZW15IEFzaGtlbmFzLCBEb2N1bWVudENsb3VkIGFuZCBJbnZlc3RpZ2F0aXZlIFJlcG9ydGVycyAmIEVkaXRvcnMKICovCg=="; +const blob = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs)], { type: "text/javascript;charset=utf-8" }); +function Worker$1() { + const objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob); + try { + return objURL ? new Worker(objURL) : new Worker("data:application/javascript;base64," + encodedJs, { type: "module" }); + } finally { + objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL); + } +} +const DEBOUNCE_TIME = 200; +class BedDataFetcher { + constructor(HGC, config2) { + __publicField(this, "dataConfig", {}); + // required for higlass + __publicField(this, "uid"); + __publicField(this, "prevRequestTime"); + __publicField(this, "track"); + __publicField(this, "toFetch"); + __publicField(this, "fetchTimeout"); + __publicField(this, "worker"); + this.uid = HGC.libraries.slugid.nice(); + this.prevRequestTime = 0; + this.toFetch = /* @__PURE__ */ new Set(); + const { url, indexUrl, assembly, ...options } = config2; + this.worker = spawn(new Worker$1()).then(async (worker) => { + const chromSizes = Object.entries(computeChromSizes(assembly).size); + await worker.init(this.uid, { url, indexUrl }, chromSizes, options); + return worker; + }); + } + /* + * Collect Tileset Information, such as tile size and genomic positions + */ + async tilesetInfo(callback) { + (await this.worker).tilesetInfo(this.uid).then(callback); + } + fetchTilesDebounced(receivedTiles, tileIds) { + this.track.drawLoadingCue(); + tileIds.forEach((tileId) => this.toFetch.add(tileId)); + if (this.fetchTimeout) { + clearTimeout(this.fetchTimeout); + } + this.fetchTimeout = setTimeout(() => { + this.sendFetch(receivedTiles, [...this.toFetch]); + this.toFetch.clear(); + }, DEBOUNCE_TIME); + } + async sendFetch(receivedTiles, tileIds) { + (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles); + } + /** + * Called by GoslingTrack. This is how the track gets data + * @param tileIds The position of the tile + * @returns A promise to the BedTiles + */ + async getTabularData(tileIds) { + const buf = await (await this.worker).getTabularData(this.uid, tileIds); + const parsed = JSON.parse(new TextDecoder().decode(buf)); + return parsed; + } +} +__publicField(BedDataFetcher, "config", { type: "bed" }); +const dataFetchers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + BamDataFetcher, + BedDataFetcher, + BigWigDataFetcher, + CsvDataFetcher, + GffDataFetcher, + JsonDataFetcher, + VcfDataFetcher +}, Symbol.toStringTag, { value: "Module" })); +const GOSLING_DATA_ROW_UID_FIELD = "gosling-data-row-uid"; +function getTabularData(spec, data) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p; + const tabularData = []; + if (!IsDataDeepTileset(spec.data)) { + console.warn("No data is specified"); + return; + } + if (spec.data.type === "vector" || spec.data.type === "bigwig") { + if (!("dense" in data)) { + return; + } + const bin = (_a = spec.data.binSize) != null ? _a : 1; + const numericValues = data.dense; + const numOfGenomicPositions = data.tileSize; + const tileUnitSize = data.tileWidth / data.tileSize; + const valueName = (_b = spec.data.value) != null ? _b : "value"; + const columnName = (_c = spec.data.column) != null ? _c : "position"; + const startName = (_d = spec.data.start) != null ? _d : "start"; + const endName = (_e = spec.data.end) != null ? _e : "end"; + const minValueName = `${valueName}_min`; + const maxValueName = `${valueName}_max`; + const agg = (_f = spec.data.aggregation) != null ? _f : "mean"; + let cumVal = 0; + let minVal = Number.MAX_SAFE_INTEGER; + let maxVal = Number.MIN_SAFE_INTEGER; + let binStart = Number.MIN_SAFE_INTEGER; + let binEnd = Number.MAX_SAFE_INTEGER; + Array.from(Array(numOfGenomicPositions).keys()).forEach((g, j) => { + if (bin === 1) { + const value = numericValues[j] / (agg === "mean" ? tileUnitSize : 1); + tabularData.push({ + [valueName]: value, + [columnName]: data.tileX + (j + 0.5) * tileUnitSize, + [startName]: data.tileX + j * tileUnitSize, + [endName]: data.tileX + (j + 1) * tileUnitSize, + [minValueName]: value, + [maxValueName]: value + }); + } else { + if (j % bin === 0) { + cumVal = minVal = maxVal = numericValues[j]; + binStart = j; + binEnd = j + bin; + } else if (j % bin === bin - 1) { + tabularData.push({ + [valueName]: cumVal / bin / (agg === "mean" ? tileUnitSize : 1), + [columnName]: data.tileX + (binStart + bin / 2) * tileUnitSize, + [startName]: data.tileX + binStart * tileUnitSize, + [endName]: data.tileX + binEnd * tileUnitSize, + [minValueName]: minVal, + [maxValueName]: maxVal + }); + } else if (j === numOfGenomicPositions - 1) { + const smallBin = numOfGenomicPositions % bin; + const correctedBinEnd = binStart + smallBin; + tabularData.push({ + [valueName]: cumVal / smallBin / (agg === "mean" ? tileUnitSize : 1), + [columnName]: data.tileX + (binStart + smallBin / 2) * tileUnitSize, + [startName]: data.tileX + binStart * tileUnitSize, + [endName]: data.tileX + correctedBinEnd * tileUnitSize, + [minValueName]: minVal, + [maxValueName]: maxVal + }); + } else { + cumVal += numericValues[j]; + if (minVal > numericValues[j]) + minVal = numericValues[j]; + if (maxVal < numericValues[j]) + maxVal = numericValues[j]; + } + } + }); + } else if (spec.data.type === "multivec") { + if (!("dense" in data) || data.shape === void 0) { + return; + } + const bin = (_g = spec.data.binSize) != null ? _g : 1; + const numOfTotalCategories = data.shape[0]; + const categories = (_h = spec.data.categories) != null ? _h : [...Array(numOfTotalCategories).keys()]; + const numericValues = data.dense; + const numOfGenomicPositions = data.shape[1]; + const tileUnitSize = data.tileWidth / data.tileSize; + const rowName = (_i = spec.data.row) != null ? _i : "category"; + const valueName = (_j = spec.data.value) != null ? _j : "value"; + const columnName = (_k = spec.data.column) != null ? _k : "position"; + const startName = (_l = spec.data.start) != null ? _l : "start"; + const endName = (_m = spec.data.end) != null ? _m : "end"; + const minValueName = `${valueName}_min`; + const maxValueName = `${valueName}_max`; + const agg = (_n = spec.data.aggregation) != null ? _n : "mean"; + categories.forEach((c, i) => { + let cumVal = 0; + let binStart = Number.MIN_SAFE_INTEGER; + let binEnd = Number.MAX_SAFE_INTEGER; + let minVal = Number.MAX_SAFE_INTEGER; + let maxVal = Number.MIN_SAFE_INTEGER; + Array.from(Array(numOfGenomicPositions).keys()).forEach((g, j) => { + if (bin === 1) { + const value = numericValues[numOfGenomicPositions * i + j] / (agg === "mean" ? tileUnitSize : 1); + tabularData.push({ + [rowName]: c, + [valueName]: value, + [columnName]: data.tileX + (j + 0.5) * tileUnitSize, + [startName]: data.tileX + j * tileUnitSize, + [endName]: data.tileX + (j + 1) * tileUnitSize, + [minValueName]: value, + [maxValueName]: value + }); + } else { + if (j % bin === 0) { + cumVal = minVal = maxVal = numericValues[numOfGenomicPositions * i + j]; + binStart = j; + binEnd = j + bin; + } else if (j % bin === bin - 1) { + tabularData.push({ + [rowName]: c, + [valueName]: agg === "mean" ? cumVal / bin / tileUnitSize : cumVal, + [columnName]: data.tileX + (binStart + bin / 2) * tileUnitSize, + [startName]: data.tileX + binStart * tileUnitSize, + [endName]: data.tileX + binEnd * tileUnitSize, + [minValueName]: minVal, + [maxValueName]: maxVal + }); + } else if (j === numOfGenomicPositions - 1) { + const smallBin = numOfGenomicPositions % bin; + const correctedBinEnd = binStart + smallBin; + tabularData.push({ + [rowName]: c, + [valueName]: agg === "mean" ? cumVal / smallBin / tileUnitSize : cumVal, + [columnName]: data.tileX + (binStart + smallBin / 2) * tileUnitSize, + [startName]: data.tileX + binStart * tileUnitSize, + [endName]: data.tileX + correctedBinEnd * tileUnitSize, + [minValueName]: minVal, + [maxValueName]: maxVal + }); + } else { + const value = numericValues[numOfGenomicPositions * i + j]; + cumVal += value; + if (minVal > value) + minVal = value; + if (maxVal < value) + maxVal = value; + } + } + }); + }); + } else if (spec.data.type === "matrix") { + if (!("dense" in data) || typeof data.tileY === "undefined" || typeof data.tileHeight === "undefined") { + return; + } + const numBins = Math.sqrt(data.dense.length); + const { tileX, tileY, tileWidth, tileHeight } = data; + const numericValues = data.dense; + const tileXUnitSize = tileWidth / numBins; + const tileYUnitSize = tileHeight / numBins; + const columnField = (_o = spec.data.column) != null ? _o : "x"; + const rowField = (_p = spec.data.row) != null ? _p : "y"; + const aggSize = 16; + for (let i = 0; i < numericValues.length / aggSize; i++) { + const aggLen = Math.sqrt(aggSize); + const xIndex = i * aggLen % numBins; + const yIndex = Math.floor(i * aggLen / numBins) * aggLen; + let value = NaN; + for (let c = 0; c < aggLen; c++) { + for (let r = 0; r < aggLen; r++) { + const curVal = numericValues[(yIndex + r) * numBins + (xIndex + c)]; + if (!isNaN(+curVal)) { + if (isNaN(value)) { + value = 0; + } + value += curVal; + } + } + } + if (isNaN(value)) { + continue; + } + const xs = tileX + xIndex * tileXUnitSize; + const xe = tileX + (xIndex + aggLen) * tileXUnitSize; + const ys = tileY + yIndex * tileYUnitSize; + const ye = tileY + (yIndex + aggLen) * tileYUnitSize; + const x = (xs + xe) / 2; + const y = (ys + ye) / 2; + tabularData.push({ + value, + [columnField]: x, + [`${columnField}s`]: xs, + [`${columnField}e`]: xe, + [rowField]: y, + [`${rowField}s`]: ys, + [`${rowField}e`]: ye + }); + } + } else if (spec.data.type === "beddb") { + if (!data.sparse) { + return; + } + const { genomicFields, exonIntervalFields, valueFields } = spec.data; + data.sparse.forEach((d, i) => { + const { chrOffset, fields } = d; + const datum = {}; + datum[GOSLING_DATA_ROW_UID_FIELD] = `${i}`; + genomicFields.forEach((g) => { + datum[g.name] = +fields[g.index] + chrOffset; + }); + valueFields == null ? void 0 : valueFields.forEach((v) => { + datum[v.name] = v.type === "quantitative" ? +fields[v.index] : fields[v.index]; + }); + tabularData.push({ + ...datum, + type: "gene" + // this should be described in the spec + }); + if (exonIntervalFields) { + const [exonStartField, exonEndField] = exonIntervalFields; + const exonStartStrs = fields[exonStartField.index].split(","); + const exonEndStrs = fields[exonEndField.index].split(","); + exonStartStrs.forEach((es, i2) => { + const ee = exonEndStrs[i2]; + tabularData.push({ + ...datum, + [exonStartField.name]: +es + chrOffset, + [exonEndField.name]: +ee + chrOffset, + type: "exon" + }); + if (i2 + 1 < exonStartStrs.length) { + const nextEs = exonStartStrs[i2 + 1]; + tabularData.push({ + ...datum, + [exonStartField.name]: +ee + chrOffset, + [exonEndField.name]: +nextEs + chrOffset, + type: "intron" + }); + } + }); + } + }); + } + return tabularData; +} +const $ref = "#/definitions/HiGlassSpec"; +const $schema = "http://json-schema.org/draft-07/schema#"; +const definitions = { + Assembly: { + anyOf: [ + { + "const": "hg38", + type: "string" + }, + { + "const": "hg19", + type: "string" + }, + { + "const": "hg18", + type: "string" + }, + { + "const": "hg17", + type: "string" + }, + { + "const": "hg16", + type: "string" + }, + { + "const": "mm10", + type: "string" + }, + { + "const": "mm9", + type: "string" + }, + { + "const": "unknown", + type: "string" + }, + { + $ref: "#/definitions/ChromSizes" + } + ] + }, + ChromSizes: { + description: 'Custom chromosome sizes, e.g., [["foo", 1000], ["bar", 300], ["baz", 240]]', + items: { + items: [ + { + type: "string" + }, + { + type: "number" + } + ], + maxItems: 2, + minItems: 2, + type: "array" + }, + type: "array" + }, + CombinedTrack: { + additionalProperties: false, + properties: { + contents: { + items: { + $ref: "#/definitions/Track" + }, + type: "array" + }, + height: { + type: "number" + }, + options: {}, + position: { + type: "string" + }, + type: { + "const": "combined", + type: "string" + }, + uid: { + type: "string" + }, + width: { + type: "number" + } + }, + required: [ + "type", + "contents" + ], + type: "object" + }, + Data: { + additionalProperties: false, + properties: { + assembly: { + $ref: "#/definitions/Assembly" + }, + children: { + items: {}, + type: "array" + }, + filter: { + items: { + $ref: "#/definitions/FilterTransform" + }, + type: "array" + }, + indexUrl: { + type: "string" + }, + indexUrlFetchOptions: { + $ref: "#/definitions/RequestInit" + }, + tiles: {}, + tilesetInfo: {}, + type: { + type: "string" + }, + url: { + type: "string" + }, + urlFetchOptions: { + $ref: "#/definitions/RequestInit" + } + }, + type: "object" + }, + EnumTrack: { + additionalProperties: false, + properties: { + chromInfoPath: { + type: "string" + }, + data: { + $ref: "#/definitions/Data" + }, + fromViewUid: { + type: [ + "null", + "string" + ] + }, + height: { + type: "number" + }, + options: {}, + server: { + type: "string" + }, + tilesetUid: { + type: "string" + }, + type: { + $ref: "#/definitions/EnumTrackType" + }, + uid: { + type: "string" + }, + width: { + type: "number" + }, + x: { + type: "number" + }, + y: { + type: "number" + } + }, + required: [ + "type" + ], + type: "object" + }, + EnumTrackType: { + "enum": [ + "heatmap", + "2d-annotations", + "2d-chromosome-annotations", + "2d-chromosome-grid", + "2d-chromosome-labels", + "2d-rectangle-domains", + "2d-tiles", + "arrowhead-domains", + "bedlike", + "cross-rule", + "dummy", + "horizontal-1d-annotations", + "horizontal-1d-heatmap", + "horizontal-1d-tiles", + "horizontal-1d-value-interval", + "horizontal-2d-rectangle-domains", + "horizontal-bar", + "horizontal-chromosome-grid", + "horizontal-chromosome-labels", + "horizontal-divergent-bar", + "horizontal-gene-annotations", + "horizontal-heatmap", + "horizontal-line", + "horizontal-multivec", + "horizontal-point", + "horizontal-rule", + "horizontal-vector-heatmap", + "image-tiles", + "left-axis", + "left-stacked-interval", + "mapbox-tiles", + "osm-2d-tile-ids", + "osm-tiles", + "raster-tiles", + "simple-svg", + "square-markers", + "top-axis", + "top-stacked-interval", + "vertical-1d-annotations", + "vertical-1d-heatmap", + "vertical-1d-tiles", + "vertical-1d-value-interval", + "vertical-2d-rectangle-domains", + "vertical-bar", + "vertical-bedlike", + "vertical-chromosome-grid", + "vertical-chromosome-labels", + "vertical-gene-annotations", + "vertical-heatmap", + "vertical-line", + "vertical-multivec", + "vertical-point", + "vertical-rule", + "vertical-vector-heatmap", + "viewport-projection-center", + "viewport-projection-horizontal", + "viewport-projection-vertical", + "gosling-track", + "gosling-2d-track", + "axis-track", + "text", + "dummy-track" + ], + type: "string" + }, + FilterTransform: { + anyOf: [ + { + $ref: "#/definitions/OneOfFilter" + }, + { + $ref: "#/definitions/RangeFilter" + }, + { + $ref: "#/definitions/IncludeFilter" + } + ] + }, + GenericLocks: { + additionalProperties: false, + properties: { + locksByViewUid: { + $ref: "#/definitions/LocksByViewUid" + }, + locksDict: {} + }, + required: [ + "locksByViewUid", + "locksDict" + ], + type: "object" + }, + GenomePositionSearchBox: { + additionalProperties: false, + properties: { + autocompleteId: { + type: "string" + }, + autocompleteServer: { + type: "string" + }, + chromInfoId: { + type: "string" + }, + chromInfoServer: { + type: "string" + }, + visible: { + type: "boolean" + } + }, + required: [ + "chromInfoId", + "chromInfoServer" + ], + type: "object" + }, + HeatmapTrack: { + additionalProperties: false, + properties: { + data: { + $ref: "#/definitions/Data" + }, + height: { + type: "number" + }, + options: {}, + position: { + type: "string" + }, + server: { + type: "string" + }, + tilesetUid: { + type: "string" + }, + type: { + "const": "heatmap", + type: "string" + }, + uid: { + type: "string" + }, + width: { + type: "number" + } + }, + required: [ + "type" + ], + type: "object" + }, + HiGlassSpec: { + additionalProperties: false, + properties: { + chromInfoPath: { + type: "string" + }, + compactLayout: { + type: "boolean" + }, + editable: { + type: "boolean" + }, + exportViewUrl: { + type: "string" + }, + locationLocks: { + $ref: "#/definitions/GenericLocks" + }, + trackSourceServers: { + items: { + type: "string" + }, + type: "array" + }, + tracksEditable: { + type: "boolean" + }, + valueScaleLocks: { + $ref: "#/definitions/ValueScaleLocks" + }, + viewEditable: { + type: "boolean" + }, + views: { + items: { + $ref: "#/definitions/View" + }, + type: "array" + }, + zoomFixed: { + type: "boolean" + }, + zoomLocks: { + $ref: "#/definitions/GenericLocks" + } + }, + required: [ + "views", + "zoomLocks", + "locationLocks" + ], + type: "object" + }, + IncludeFilter: { + additionalProperties: false, + properties: { + field: { + description: "A filter is applied based on the values of the specified data field", + type: "string" + }, + include: { + description: "Check whether the value includes a substring.", + type: "string" + }, + not: { + description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', + type: "boolean" + }, + type: { + "const": "filter", + type: "string" + } + }, + required: [ + "field", + "include", + "type" + ], + type: "object" + }, + IndependentViewportProjectionTrack: { + additionalProperties: false, + properties: { + fromViewUid: { + type: "null" + }, + options: {}, + projectionXDomain: { + items: { + type: "number" + }, + type: "array" + }, + projectionYDomain: { + items: { + type: "number" + }, + type: "array" + }, + transforms: { + items: {}, + type: "array" + }, + type: { + "enum": [ + "viewport-projection-horizontal", + "viewport-projection-vertical", + "viewport-projection-center" + ], + type: "string" + }, + uid: { + type: "string" + }, + width: { + type: "number" + }, + x: { + type: "number" + }, + y: { + type: "number" + } + }, + required: [ + "type" + ], + type: "object" + }, + Layout: { + additionalProperties: false, + properties: { + h: { + type: "number" + }, + w: { + type: "number" + }, + x: { + type: "number" + }, + y: { + type: "number" + } + }, + required: [ + "h", + "w", + "x", + "y" + ], + type: "object" + }, + LocksByViewUid: { + additionalProperties: { + type: "string" + }, + type: "object" + }, + OneOfFilter: { + additionalProperties: false, + properties: { + field: { + description: "A filter is applied based on the values of the specified data field", + type: "string" + }, + not: { + description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', + type: "boolean" + }, + oneOf: { + description: "Check whether the value is an element in the provided list.", + items: { + type: [ + "string", + "number", + "null" + ] + }, + type: "array" + }, + type: { + "const": "filter", + type: "string" + } + }, + required: [ + "field", + "oneOf", + "type" + ], + type: "object" + }, + Overlay: { + additionalProperties: false, + properties: { + chromInfoPath: { + type: "string" + }, + includes: { + items: {}, + type: "array" + }, + options: { + $ref: "#/definitions/OverlayOptions" + }, + type: { + type: "string" + }, + uid: { + type: "string" + } + }, + type: "object" + }, + OverlayOptions: { + additionalProperties: false, + properties: { + extent: { + items: {}, + type: "array" + }, + fill: { + type: "string" + }, + fillOpacity: { + type: "number" + }, + minWidth: { + type: "number" + }, + outline: { + type: "string" + }, + outlineOpacity: { + type: "number" + }, + outlinePos: { + anyOf: [ + { + items: {}, + type: "array" + }, + { + type: "string" + } + ] + }, + outlineWidth: { + type: "number" + }, + stroke: { + type: "string" + }, + strokeOpacity: { + type: "number" + }, + strokePos: { + anyOf: [ + { + items: {}, + type: "array" + }, + { + type: "string" + } + ] + }, + strokeWidth: { + type: "number" + } + }, + type: "object" + }, + RangeFilter: { + additionalProperties: false, + properties: { + field: { + description: "A filter is applied based on the values of the specified data field", + type: "string" + }, + inRange: { + description: "Check whether the value is in a number range.", + items: { + type: "number" + }, + type: "array" + }, + not: { + description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', + type: "boolean" + }, + type: { + "const": "filter", + type: "string" + } + }, + required: [ + "field", + "inRange", + "type" + ], + type: "object" + }, + RequestInit: { + additionalProperties: false, + properties: { + headers: { + type: "object" + } + }, + type: "object" + }, + Track: { + anyOf: [ + { + $ref: "#/definitions/HeatmapTrack" + }, + { + $ref: "#/definitions/CombinedTrack" + }, + { + $ref: "#/definitions/IndependentViewportProjectionTrack" + }, + { + $ref: "#/definitions/EnumTrack" + } + ] + }, + Tracks: { + additionalProperties: false, + properties: { + bottom: { + items: { + $ref: "#/definitions/Track" + }, + type: "array" + }, + center: { + items: { + $ref: "#/definitions/Track" + }, + type: "array" + }, + gallery: { + items: { + $ref: "#/definitions/Track" + }, + type: "array" + }, + left: { + items: { + $ref: "#/definitions/Track" + }, + type: "array" + }, + right: { + items: { + $ref: "#/definitions/Track" + }, + type: "array" + }, + top: { + items: { + $ref: "#/definitions/Track" + }, + type: "array" + }, + whole: { + items: { + $ref: "#/definitions/Track" + }, + type: "array" + } + }, + required: [ + "top", + "left", + "center", + "right", + "bottom", + "gallery", + "whole" + ], + type: "object" + }, + ValueScaleLocks: { + additionalProperties: false, + properties: { + locksByViewUid: { + $ref: "#/definitions/LocksByViewUid" + }, + locksDict: {} + }, + required: [ + "locksByViewUid" + ], + type: "object" + }, + View: { + additionalProperties: false, + properties: { + autocompleteSource: { + type: "string" + }, + chromInfoPath: { + type: "string" + }, + genomePositionSearchBox: { + $ref: "#/definitions/GenomePositionSearchBox" + }, + genomePositionSearchBoxVisible: { + type: "boolean" + }, + initialXDomain: { + items: { + type: "number" + }, + type: "array" + }, + initialYDomain: { + items: { + type: "number" + }, + type: "array" + }, + layout: { + $ref: "#/definitions/Layout" + }, + overlays: { + items: { + $ref: "#/definitions/Overlay" + }, + type: "array" + }, + selectionView: { + type: "boolean" + }, + tracks: { + $ref: "#/definitions/Tracks" + }, + uid: { + type: "string" + }, + zoomFixed: { + type: "boolean" + }, + zoomLimits: { + items: { + type: [ + "number", + "null" + ] + }, + maxItems: 2, + minItems: 2, + type: "array" + } + }, + required: [ + "tracks", + "layout" + ], + type: "object" + } +}; +const HiGlassSchema = { + $ref, + $schema, + definitions +}; +function getNumericDomain(domain, assembly) { + const chromInterval = computeChromSizes(assembly).interval; + if ("chromosome" in domain) { + const isThereChr = Object.keys(chromInterval).find((chr) => chr === domain.chromosome); + if (!isThereChr) { + return; + } + } + if (IsDomainChr(domain)) { + return [chromInterval[domain.chromosome][0] + 1, chromInterval[domain.chromosome][1]]; + } else if (IsDomainInterval(domain)) { + return domain.interval; + } else if (IsDomainChrInterval(domain)) { + const chrStart = chromInterval[domain.chromosome][0]; + const [start, end] = domain.interval; + return [chrStart + start, chrStart + end]; + } +} +function shareScaleAcrossTracks(trackModels, force) { + const globalDomain = {}; + const channelKeys = SUPPORTED_CHANNELS; + trackModels.forEach((model) => { + channelKeys.forEach((channelKey) => { + const channel = model.spec()[channelKey]; + if (!IsChannelDeep(channel) || channel.domain === void 0) { + return; + } + const { domain, type } = channel; + if (type === "quantitative") { + const numericDomain = Array.from(domain); + if (!globalDomain[channelKey]) { + globalDomain[channelKey] = numericDomain; + } else { + const channelGlobalDomain = globalDomain[channelKey]; + if (channelGlobalDomain[0] > numericDomain[0]) { + channelGlobalDomain[0] = numericDomain[0]; + } + if (channelGlobalDomain[1] < numericDomain[1]) { + channelGlobalDomain[1] = numericDomain[1]; + } + } + } else if (type === "nominal") { + const nominalDomain = Array.from(domain); + if (!globalDomain[channelKey]) { + globalDomain[channelKey] = nominalDomain; + } else { + globalDomain[channelKey] = Array.from( + /* @__PURE__ */ new Set([...globalDomain[channelKey], ...nominalDomain]) + ); + } + } + }); + }); + trackModels.forEach((model) => { + channelKeys.forEach((channelKey) => { + const channel = model.spec()[channelKey]; + if (IsChannelDeep(channel) && channel.type === "genomic") + return; + model.setChannelDomain(channelKey, globalDomain[channelKey], force); + model.generateScales(); + }); + model.updateChannelValue(); + }); +} +const example = { + compactLayout: false, + trackSourceServers: ["https://server.gosling-lang.org/api/v1/"], + views: [ + { + genomePositionSearchBoxVisible: false, + genomePositionSearchBox: { + autocompleteServer: "https://higlass.io/api/v1", + autocompleteId: "P0PLbQMwTYGy-5uPIQid7A", + chromInfoServer: "https://higlass.io/api/v1", + chromInfoId: "hg38" + }, + layout: { x: 0, y: 0, w: 6.4, h: 600 }, + tracks: { + top: [], + left: [ + { + type: "combined", + width: 130, + height: 600, + contents: [ + { + type: "gosling-track", + server: "https://server.gosling-lang.org/api/v1/", + tilesetUid: "cistrome-multivec", + width: 130, + height: 600, + options: { + showMousePosition: true, + mousePositionColor: "#000000", + fontSize: 24, + labelPosition: "none", + labelShowResolution: false, + labelColor: "black", + labelBackgroundColor: "white", + labelTextOpacity: 1, + labelLeftMargin: 1, + labelTopMargin: 1, + labelRightMargin: 0, + labelBottomMargin: 0, + backgroundColor: "transparent", + spec: { + spacing: 10, + orientation: "vertical", + assembly: "hg38", + layout: "linear", + static: false, + xDomain: { interval: [0, 1e9] }, + centerRadius: 0.3, + xOffset: 0, + yOffset: 0, + style: { outlineWidth: 0.5 }, + data: { + url: "https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec", + type: "multivec", + row: "sample", + column: "position", + value: "peak", + categories: ["sample 1", "sample 2", "sample 3", "sample 4"], + binSize: 4 + }, + mark: "rect", + x: { + field: "start", + type: "genomic", + axis: "left", + domain: { interval: [0, 1e9] }, + linkingId: "7f94b74e-25ec-4e67-8c75-3dc0f1b0d6bd" + }, + xe: { field: "end", type: "genomic" }, + row: { + field: "sample", + type: "nominal", + legend: true + }, + color: { + field: "peak", + type: "quantitative", + legend: true + }, + tooltip: [ + { + field: "start", + type: "genomic", + alt: "Start Position" + }, + { + field: "end", + type: "genomic", + alt: "End Position" + }, + { + field: "peak", + type: "quantitative", + alt: "Value", + format: ".2" + }, + { field: "sample", type: "nominal", alt: "Sample" } + ], + width: 160, + height: 600, + overlayOnPreviousTrack: false + }, + theme: { + base: "light", + root: { + background: "white", + titleColor: "black", + titleBackgroundColor: "transparent", + titleFontSize: 18, + titleFontFamily: "Arial", + titleAlign: "left", + titleFontWeight: "bold", + subtitleColor: "gray", + subtitleBackgroundColor: "transparent", + subtitleFontSize: 16, + subtitleFontFamily: "Arial", + subtitleFontWeight: "normal", + subtitleAlign: "left", + mousePositionColor: "#000000" + }, + track: { + background: "transparent", + alternatingBackground: "transparent", + titleColor: "black", + titleBackground: "white", + titleFontSize: 24, + titleAlign: "left", + outline: "black", + outlineWidth: 1 + }, + legend: { + position: "top", + background: "white", + backgroundOpacity: 0.7, + labelColor: "black", + labelFontSize: 12, + labelFontWeight: "normal", + labelFontFamily: "Arial", + backgroundStroke: "#DBDBDB", + tickColor: "black" + }, + axis: { + tickColor: "black", + labelColor: "black", + labelFontSize: 12, + labelFontWeight: "normal", + labelFontFamily: "Arial", + baselineColor: "black", + gridColor: "#E3E3E3", + gridStrokeWidth: 1, + gridStrokeType: "solid", + gridStrokeDash: [4, 4] + }, + markCommon: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + point: { + color: "#E79F00", + size: 3, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + rect: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + triangle: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + area: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + line: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + bar: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + rule: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 1, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + link: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 1, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + text: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6], + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + color: "gray", + size: 1, + stroke: "black", + strokeWidth: 1, + opacity: 0.3, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + } + } + } + } + ] + }, + { + uid: "15483511-f6fb-11eb-914b-976b6ecda162", + type: "axis-track", + chromInfoPath: "https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes", + options: { + layout: "linear", + outerRadius: null, + width: 160, + height: 600, + theme: { + base: "light", + root: { + background: "white", + titleColor: "black", + titleBackgroundColor: "transparent", + titleFontSize: 18, + titleFontFamily: "Arial", + titleAlign: "left", + titleFontWeight: "bold", + subtitleColor: "gray", + subtitleBackgroundColor: "transparent", + subtitleFontSize: 16, + subtitleFontFamily: "Arial", + subtitleFontWeight: "normal", + subtitleAlign: "left", + mousePositionColor: "#000000" + }, + track: { + background: "transparent", + alternatingBackground: "transparent", + titleColor: "black", + titleBackground: "white", + titleFontSize: 24, + titleAlign: "left", + outline: "black", + outlineWidth: 1 + }, + legend: { + position: "top", + background: "white", + backgroundOpacity: 0.7, + labelColor: "black", + labelFontSize: 12, + labelFontWeight: "normal", + labelFontFamily: "Arial", + backgroundStroke: "#DBDBDB", + tickColor: "black" + }, + axis: { + tickColor: "black", + labelColor: "black", + labelFontSize: 12, + labelFontWeight: "normal", + labelFontFamily: "Arial", + baselineColor: "black", + gridColor: "#E3E3E3", + gridStrokeWidth: 1, + gridStrokeType: "solid", + gridStrokeDash: [4, 4] + }, + markCommon: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + point: { + color: "#E79F00", + size: 3, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + rect: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + triangle: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + area: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + line: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + bar: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + rule: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 1, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + link: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 1, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + text: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6], + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + color: "gray", + size: 1, + stroke: "black", + strokeWidth: 1, + opacity: 0.3, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + } + }, + assembly: "hg38", + stroke: "transparent", + color: "black", + fontSize: 12, + fontFamily: "Arial", + fontWeight: "normal", + tickColor: "black", + tickFormat: "plain", + tickPositions: "even", + reverseOrientation: false + }, + width: 30 + } + ], + center: [], + right: [], + bottom: [], + gallery: [], + whole: [] + }, + initialXDomain: [0, 1e9], + initialYDomain: [0, 1e9], + zoomFixed: false, + zoomLimits: [1, null], + uid: "15483510-f6fb-11eb-914b-976b6ecda162", + chromInfoPath: "https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes" + }, + { + genomePositionSearchBoxVisible: false, + genomePositionSearchBox: { + autocompleteServer: "https://higlass.io/api/v1", + autocompleteId: "P0PLbQMwTYGy-5uPIQid7A", + chromInfoServer: "https://higlass.io/api/v1", + chromInfoId: "hg38" + }, + layout: { x: 6.8, y: 0, w: 5.2, h: 600 }, + tracks: { + top: [], + left: [ + { + type: "combined", + width: 130, + height: 600, + contents: [ + { + type: "gosling-track", + server: "https://server.gosling-lang.org/api/v1/", + tilesetUid: "cistrome-multivec", + width: 130, + height: 600, + options: { + showMousePosition: true, + mousePositionColor: "#000000", + fontSize: 24, + labelPosition: "none", + labelShowResolution: false, + labelColor: "black", + labelBackgroundColor: "white", + labelTextOpacity: 1, + labelLeftMargin: 1, + labelTopMargin: 1, + labelRightMargin: 0, + labelBottomMargin: 0, + backgroundColor: "transparent", + spec: { + spacing: 10, + orientation: "vertical", + assembly: "hg38", + layout: "linear", + static: false, + xDomain: { interval: [0, 1e9] }, + centerRadius: 0.3, + xOffset: 0, + yOffset: 0, + style: { outlineWidth: 0.5 }, + data: { + url: "https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec", + type: "multivec", + row: "sample", + column: "position", + value: "peak", + categories: ["sample 1", "sample 2", "sample 3", "sample 4"], + binSize: 4 + }, + mark: "rect", + x: { + field: "start", + type: "genomic", + domain: { interval: [0, 1e9] }, + linkingId: "7f94b74e-25ec-4e67-8c75-3dc0f1b0d6bd" + }, + xe: { field: "end", type: "genomic" }, + row: { + field: "sample", + type: "nominal", + legend: true + }, + color: { + field: "peak", + type: "quantitative", + legend: true + }, + tooltip: [ + { + field: "start", + type: "genomic", + alt: "Start Position" + }, + { + field: "end", + type: "genomic", + alt: "End Position" + }, + { + field: "peak", + type: "quantitative", + alt: "Value", + format: ".2" + }, + { field: "sample", type: "nominal", alt: "Sample" } + ], + width: 130, + height: 600 + }, + theme: { + base: "light", + root: { + background: "white", + titleColor: "black", + titleBackgroundColor: "transparent", + titleFontSize: 18, + titleFontFamily: "Arial", + titleAlign: "left", + titleFontWeight: "bold", + subtitleColor: "gray", + subtitleBackgroundColor: "transparent", + subtitleFontSize: 16, + subtitleFontFamily: "Arial", + subtitleFontWeight: "normal", + subtitleAlign: "left", + mousePositionColor: "#000000" + }, + track: { + background: "transparent", + alternatingBackground: "transparent", + titleColor: "black", + titleBackground: "white", + titleFontSize: 24, + titleAlign: "left", + outline: "black", + outlineWidth: 1 + }, + legend: { + position: "top", + background: "white", + backgroundOpacity: 0.7, + labelColor: "black", + labelFontSize: 12, + labelFontWeight: "normal", + labelFontFamily: "Arial", + backgroundStroke: "#DBDBDB", + tickColor: "black" + }, + axis: { + tickColor: "black", + labelColor: "black", + labelFontSize: 12, + labelFontWeight: "normal", + labelFontFamily: "Arial", + baselineColor: "black", + gridColor: "#E3E3E3", + gridStrokeWidth: 1, + gridStrokeType: "solid", + gridStrokeDash: [4, 4] + }, + markCommon: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + point: { + color: "#E79F00", + size: 3, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + rect: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + triangle: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + area: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + line: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + bar: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + rule: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 1, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + link: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 1, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + }, + text: { + color: "#E79F00", + size: 1, + stroke: "black", + strokeWidth: 0, + opacity: 1, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6], + textAnchor: "middle", + textFontWeight: "normal" + }, + brush: { + color: "gray", + size: 1, + stroke: "black", + strokeWidth: 1, + opacity: 0.3, + nominalColorRange: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + ], + quantitativeSizeRange: [2, 6] + } + } + } + } + ] + } + ], + center: [], + right: [], + bottom: [], + gallery: [], + whole: [] + }, + initialXDomain: [0, 1e9], + initialYDomain: [0, 1e9], + zoomFixed: false, + zoomLimits: [1, null], + uid: "154b1b40-f6fb-11eb-914b-976b6ecda162" + } + ], + zoomLocks: { locksByViewUid: {}, locksDict: {} }, + locationLocks: { locksByViewUid: {}, locksDict: {} }, + editable: false, + chromInfoPath: "https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes" +}; +const HIGLASS_AXIS_SIZE = 30; +const getViewTemplate = (assembly) => { + return { + genomePositionSearchBoxVisible: false, + genomePositionSearchBox: { + autocompleteServer: "https://higlass.io/api/v1", + autocompleteId: getAutoCompleteId(assembly), + chromInfoServer: "https://higlass.io/api/v1", + chromInfoId: assembly != null ? assembly : "hg38" + }, + layout: { w: 12, h: 12, x: 0, y: 0 }, + tracks: { + top: [], + left: [], + center: [], + right: [], + bottom: [], + gallery: [], + whole: [] + }, + initialXDomain: [0, computeChromSizes(assembly).total], + initialYDomain: [0, computeChromSizes(assembly).total], + zoomFixed: false + }; +}; +class HiGlassModel { + constructor() { + __publicField(this, "assembly"); + __publicField(this, "orientation"); + __publicField(this, "hg"); + this.assembly = "hg38"; + this.hg = { + compactLayout: false, + trackSourceServers: [], + views: [], + zoomLocks: { + locksByViewUid: {}, + locksDict: {} + }, + locationLocks: { + locksByViewUid: {}, + locksDict: {} + } + }; + this.setEditable(false); + } + spec() { + return this.hg; + } + setViewOrientation(orientation) { + this.orientation = orientation; + return this; + } + addDefaultView(uid, assembly) { + this.hg.views.push(JSON.parse(JSON.stringify({ ...getViewTemplate(assembly), uid }))); + return this; + } + setAssembly(assembly) { + this.assembly = assembly; + this.setChromInfoPath(computeChromSizes(this.assembly).path); + return this; + } + getAssembly() { + return this.assembly; + } + setTextTrack(width, height, text, textColor = "black", fontSize = 14, fontWeight = "normal", align = "left", backgroundColor = "transparent", fontFamily = "Arial") { + var _a; + if (this.getLastView()) { + (_a = this.getLastView().tracks.top) == null ? void 0 : _a.push({ + type: "text", + width, + height, + options: { + backgroundColor, + textColor, + fontSize, + fontWeight, + fontFamily, + offsetY: 0, + // offset from the top of the track + align, + text + } + }); + } + return this; + } + /** + * Add a dummy track to the last view + * @param track + */ + setDummyTrack(track) { + var _a; + if (this.getLastView()) { + (_a = this.getLastView().tracks.top) == null ? void 0 : _a.push({ + type: "dummy-track", + width: track.width, + height: track.height, + options: { + width: track.width, + height: track.height, + title: track.title, + ...track.style + } + }); + } + return this; + } + addBrush(layout, viewId, theme, fromViewUid, style) { + var _a, _b, _c, _d, _e, _f; + if (!fromViewUid) + return; + (_f = this.getView(viewId)) == null ? void 0 : _f.tracks.whole.push({ + // type: 'viewport-projection-center', + type: layout === "circular" ? "brush-track" : "viewport-projection-horizontal", + uid: uuid(), + fromViewUid, + options: { + projectionFillColor: (_a = style == null ? void 0 : style.color) != null ? _a : theme.brush.color, + projectionStrokeColor: (_b = style == null ? void 0 : style.stroke) != null ? _b : theme.brush.stroke, + projectionFillOpacity: (_c = style == null ? void 0 : style.opacity) != null ? _c : theme.brush.opacity, + projectionStrokeOpacity: (_d = style == null ? void 0 : style.opacity) != null ? _d : theme.brush.opacity, + strokeWidth: (_e = style == null ? void 0 : style.strokeWidth) != null ? _e : theme.brush.strokeWidth, + startAngle: style == null ? void 0 : style.startAngle, + endAngle: style == null ? void 0 : style.endAngle, + innerRadius: style == null ? void 0 : style.innerRadius, + outerRadius: style == null ? void 0 : style.outerRadius + } + }); + return this; + } + getLastView() { + return this.hg.views[this.hg.views.length - 1]; + } + getMainTrackPosition() { + return this.orientation === "vertical" ? "left" : "center"; + } + /** + * Get the last view that renders any visualization, so skiping empty tracks. + */ + getLastVisView() { + const vs = this.hg.views.filter((v) => { + var _a, _b; + return ((_b = (_a = v.tracks[this.getMainTrackPosition()]) == null ? void 0 : _a[0]) == null ? void 0 : _b.type) === "combined"; + }); + return vs[vs.length - 1]; + } + getView(viewId) { + return this.hg.views.find((d) => d.uid === viewId); + } + validateSpec(silence = false) { + return validateSpec(HiGlassSchema, this.spec(), silence).state === "success"; + } + setDomain(xDomain, yDomain) { + if (xDomain) { + this.getLastView().initialXDomain = getNumericDomain(xDomain, this.getAssembly()); + } + if (yDomain) { + this.getLastView().initialYDomain = getNumericDomain(yDomain, this.getAssembly()); + } + return this; + } + /** + * This is a hacky function that adjust x domain to properly show vertical tracks. + * + * In HiGlass, the range of vertical tracks is affected by a center track. For example, if a center track is small, the vertical tracks become small as well. + * Currently, the actual size of center track for vertical gosling tracks is `1px`. So, we re-scale the x domain so that gosling's vertical tracks properly use the entire height of a view. + * @param orientation + * @param width + * @returns + */ + adjustDomain(orientation = "horizontal", width, height) { + if (orientation !== "vertical") { + return this; + } + const domain = this.getLastView().initialXDomain; + if (!domain) { + return this; + } + const [start, end] = domain; + const size = end - start; + const center = (start + end) / 2; + this.getLastView().initialXDomain = [ + center - size / width / 2 / height * width, + center + size / width / 2 / height * width + ]; + return this; + } + /** + * Allow a zoom interaction? + */ + setZoomFixed(zoomFixed) { + this.getLastView().zoomFixed = zoomFixed; + return this; + } + /** + * Set limits of zoom levels in base pairs. + */ + setZoomLimits(zoomLimits) { + this.getLastView().zoomLimits = zoomLimits; + return this; + } + setLayout(layout) { + this.getLastView().layout = layout; + return this; + } + setEditable(editable) { + this.hg.editable = editable; + return this; + } + setChromInfoPath(chromInfoPath) { + if (this.getLastView()) { + this.getLastView().chromInfoPath = chromInfoPath; + } + this.hg.chromInfoPath = chromInfoPath; + return this; + } + addTrackSourceServers(trackSourceServers) { + var _a, _b; + if (trackSourceServers && ((_a = this.hg.trackSourceServers) == null ? void 0 : _a.indexOf(trackSourceServers)) === -1) + (_b = this.hg.trackSourceServers) == null ? void 0 : _b.push(trackSourceServers); + return this; + } + setMainTrack(track) { + var _a; + if (!this.getLastView()) + return this; + this.getLastView().tracks[this.getMainTrackPosition()] = [ + { + type: "combined", + uid: `${(_a = track.uid) != null ? _a : uuid()}-${this.getMainTrackPosition()}-combined`, + // !! Hacky, but it is important to subtract 1px. Currently, HiGlass does not well handle a case where a center track is zero width (e.g., linking between views that contain zero-width center tracks). + // https://github.com/higlass/higlass/pull/1041 + width: track.width - 1, + height: track.height, + contents: [track] + } + ]; + return this; + } + addTrackToCombined(track) { + var _a; + if (!this.getLastVisView()) + return this; + (_a = this.getLastVisView().tracks[this.getMainTrackPosition()][0]) == null ? void 0 : _a.contents.push(track); + return this; + } + setAxisTrack(position, type = "regular", options) { + if (!this.hg.views) + return this; + const widthOrHeight = position === "left" || position === "right" ? "width" : "height"; + const axisTrackTemplate = { + // uid: options.id ?? uuid(), // TODO: turning this on makes some tick labels hidden + type: "axis-track", + chromInfoPath: this.hg.chromInfoPath, + options: { + ...options, + assembly: this.getAssembly(), + stroke: "transparent", + // text outline + color: options.theme.axis.labelColor, + labelMargin: options.theme.axis.labelMargin, + excludeChrPrefix: options.theme.axis.labelExcludeChrPrefix, + fontSize: options.theme.axis.labelFontSize, + fontFamily: options.theme.axis.labelFontFamily, + fontWeight: options.theme.axis.labelFontWeight, + tickColor: options.theme.axis.tickColor, + tickFormat: type === "narrower" ? "si" : "plain", + tickPositions: type === "regular" ? "even" : "ends", + reverseOrientation: position === "bottom" || position === "right" ? true : false + } + }; + if (options.layout === "circular") { + this.addTrackToCombined({ + ...axisTrackTemplate, + options: { ...axisTrackTemplate.options, layout: "circular" } + }); + } else { + const axisTrack = { ...axisTrackTemplate, [widthOrHeight]: HIGLASS_AXIS_SIZE }; + if (position === "left") { + if (this.getLastView().tracks.left.filter((d) => d.type === "axis-track").length !== 0) { + return this; + } + this.getLastView().tracks.left = insertItemToArray(this.getLastView().tracks.left, 0, axisTrack); + } else if (position === "right") { + if (this.getLastView().tracks.right.filter((d) => d.type === "axis-track").length !== 0) { + return this; + } + this.getLastView().tracks.right.push(axisTrack); + } else { + if (this.getLastView().tracks[position].filter((d) => d.type === "axis-track").length !== 0) { + return this; + } + this.getLastView().tracks[position].push(axisTrack); + } + } + return this; + } + setExampleHiglassViewConfig() { + this.hg = example; + } +} +function logicalComparison(value, op, ref, transitionPadding) { + const padding = transitionPadding && transitionPadding !== 0 ? transitionPadding : void 0; + let alpha = 0; + switch (op) { + case "less-than": + case "LT": + case "lt": + alpha = ref > value ? padding ? (ref - value) / padding : 1 : 0; + break; + case "less-than-or-equal-to": + case "LTET": + case "ltet": + alpha = ref >= value ? padding ? (ref - value) / padding : 1 : 0; + break; + case "greater-than": + case "GT": + case "gt": + alpha = ref < value ? padding ? (value - ref) / padding : 1 : 0; + break; + case "greater-than-or-equal-to": + case "GTET": + case "gtet": + alpha = ref <= value ? padding ? (value - ref) / padding : 1 : 0; + break; + } + return Math.max(Math.min(1, alpha), 0); +} +const CHANNEL_DEFAULTS = { + // https://mikemol.github.io/technique/colorblind/2018/02/11/color-safe-palette.html + NOMINAL_COLOR: [ + "#E79F00", + "#029F73", + "#0072B2", + "#CB7AA7", + "#D45E00", + "#57B4E9", + "#EFE441" + /*'#000000'*/ + ], + // https://colorcet.holoviz.org/user_guide/Categorical.html + NOMINAL_COLOR_EXTENDED: [ + "#d60000", + "#018700", + "#b500ff", + "#05acc6", + "#97ff00", + "#ffa52f", + "#ff8ec8", + "#79525e", + "#00fdcf", + "#afa5ff", + "#93ac83", + "#9a6900", + "#366962", + "#d3008c", + "#fdf490", + "#c86e66", + "#9ee2ff", + "#00c846", + "#a877ac", + "#b8ba01", + "#f4bfb1", + "#ff28fd", + "#f2cdff", + "#009e7c", + "#ff6200", + "#56642a", + "#953f1f", + "#90318e", + "#ff3464", + "#a0e491", + "#8c9ab1", + "#829026", + "#ae083f", + "#77c6ba", + "#bc9157", + "#e48eff", + "#72b8ff", + "#c6a5c1", + "#ff9070", + "#d3c37c", + "#bceddb", + "#6b8567", + "#916e56", + "#f9ff00", + "#bac1df", + "#ac567c", + "#ffcd03", + "#ff49b1", + "#c15603", + "#5d8c90", + "#c144bc", + "#00753f", + "#ba6efd", + "#00d493", + "#00ff75", + "#49a150", + "#cc9790", + "#00ebed", + "#db7e01", + "#f77589", + "#b89500", + "#c84248", + "#00cff9", + "#755726", + "#85d401", + "#ebffd4", + "#a77b87", + "#db72c8", + "#cae256", + "#8abf5d", + "#a1216b", + "#855b89", + "#89bacf", + "#ffbad6", + "#b6cfaa", + "#97414d", + "#67aa00", + "#fde1b1", + "#ff3628", + "#80793d", + "#d6e8ff", + "#a795c6", + "#7ea59a", + "#d182a3", + "#54823b", + "#e6a872", + "#9cffff", + "#da5480", + "#05b3aa", + "#ffaaf6", + "#d1afef", + "#da015d", + "#ac1a13", + "#60b385", + "#d442fd", + "#acaa59", + "#fb9ca7", + "#b3723b", + "#f26952", + "#aed1d4", + "#9affc3", + "#dbb333", + "#eb01c3", + "#9900c4", + "#cfff9e", + "#a55949", + "#3b6d01", + "#008579", + "#959167", + "#89dbb3", + "#6d7400", + "#aa5dca", + "#07ef00", + "#804f3d", + "#d88052", + "#ffc862", + "#b8009e", + "#99acdd", + "#904f00", + "#8c4470", + "#4f6e52", + "#ff8734", + "#c68ecd", + "#d4e29e", + "#b1826d", + "#9cfb75", + "#56dd77", + "#f90087", + "#a1cdff", + "#13cad1", + "#118e54", + "#d154a5", + "#00dfc3", + "#a3832f", + "#77975b", + "#baaa80", + "#70a3af", + "#d6fbff", + "#e8013a", + "#d84621", + "#ff82ed", + "#b63862", + "#b6cd72", + "#97626b", + "#897490", + "#00a316", + "#00f4a1", + "#bf90f2", + "#89e4d8", + "#a34d95", + "#6e5d00", + "#8cc68e", + "#95aa2a", + "#c672dd", + "#b33b01", + "#d69a36", + "#dfacb6", + "#009aa0", + "#599000", + "#97bca8", + "#ac8ca8", + "#dad4ff", + "#547c72", + "#00ba69", + "#ffc38e", + "#b800d4", + "#dfcf5b", + "#629a7b", + "#bfedbc", + "#c1bdfd", + "#80d3dd", + "#e2857e", + "#f9eb4d", + "#bf6d82", + "#caff4f", + "#ef72aa", + "#ed67ff", + "#9946ae", + "#6d6942", + "#e25660", + "#dd662d", + "#9cdb5d", + "#e29ccf", + "#b87500", + "#c6002d", + "#dfbcda", + "#59b5df", + "#ff59da", + "#38c1a1", + "#9e698c", + "#acaac8", + "#95622f", + "#b55662", + "#2b7e60", + "#b1e400", + "#eda590", + "#95fde2", + "#ff548e", + "#bd6ea1", + "#aa3b36", + "#d8cf00", + "#aa80cd", + "#a08052", + "#e100e8", + "#c35b3d", + "#b53a85", + "#8c7700", + "#dbbc95", + "#529e93", + "#afbc82", + "#91b5b6", + "#a75423", + "#ffd4ef", + "#79ae6b", + "#5db54b", + "#80fb9a", + "#48ffef", + "#979548", + "#9387a7", + "#31d400", + "#6ee956", + "#b6d4eb", + "#705470", + "#f2db8a", + "#aad4c1", + "#7ecdf2", + "#89ba00", + "#64b6ba", + "#ffb500", + "#c38285", + "#caaa5e", + "#647748", + "#59e2ff", + "#df4dcd", + "#e9ff79", + "#bc66b8", + "#c395a5", + "#64c674", + "#d19570", + "#70cf4f", + "#aa6e66", + "#9c60a5", + "#00b800", + "#e299b3", + "#bc006b", + "#b3e8ef", + "#cdbfe4", + "#77a342", + "#856277", + "#568e5b", + "#9eafc4", + "#e82fa0", + "#247c2a", + "#826723", + "#bfbc4d", + "#ddd3a5" + ], + QUANTITATIVE_COLOR: "viridis", + SIZE: 3, + SIZE_RANGE: [2, 6] +}; +function getTheme(theme = "light") { + if (typeof theme === "string") { + if (isThereTheme(theme)) { + return getTheme$1(theme); + } else { + return getTheme$1("light"); + } + } else { + let baseSpec = JSON.parse(JSON.stringify(getTheme$1("light"))); + if (isThereTheme(theme.base)) { + baseSpec = getTheme$1(theme.base); + } + Object.keys(baseSpec).forEach((k) => { + if (theme[k] && k !== "base") { + baseSpec[k] = Object.assign( + JSON.parse(JSON.stringify(baseSpec[k])), + JSON.parse(JSON.stringify(theme[k])) + ); + } + }); + return baseSpec; + } +} +class GoslingTrackModel { + constructor(spec, data, theme) { + __publicField(this, "id"); + __publicField(this, "theme"); + /* spec */ + __publicField(this, "specOriginal"); + // original spec of users + __publicField(this, "specComplete"); + // processed spec, being used in visualizations + /* data */ + __publicField(this, "dataAggregated"); + /* channel scales */ + __publicField(this, "channelScales"); + /* mouse events */ + __publicField(this, "mouseEventModel"); + this.id = uuid(); + this.theme = theme != null ? theme : getTheme(); + this.dataAggregated = data; + this.specOriginal = spec; + this.specComplete = spec; + this.channelScales = {}; + this.mouseEventModel = new MouseEventModel(); + const validity = this.validateSpec(); + if (!validity.valid) { + console.warn("Gosling specification is not valid!", validity.errorMessages); + return; + } + this.generateCompleteSpec(this.specComplete); + this.flipRanges(this.specComplete); + this.generateScales(); + this.dataAggregated = aggregateData(this.spec(), this.dataAggregated); + } + getId() { + return this.id; + } + originalSpec() { + return this.specOriginal; + } + spec() { + return this.specComplete; + } + data() { + return this.dataAggregated; + } + getMouseEventModel() { + return this.mouseEventModel; + } + /** + * Fill the missing options with default values or with the values calculated based on the data. + */ + generateCompleteSpec(spec) { + if (!spec.width || !spec.height) { + console.warn("Size of track is not determined yet."); + return; + } + if (spec.orientation === "vertical") { + const width = spec.width; + spec.width = spec.height; + spec.height = width; + } + const xOrY = this.getGenomicChannelKey(); + let isAxisShown = false; + if (xOrY === "x") { + isAxisShown = IsChannelDeep(spec.x) && spec.x.axis !== void 0 && spec.x.axis !== "none"; + } + if (xOrY === "y") { + isAxisShown = IsChannelDeep(spec.y) && spec.y.axis !== void 0 && spec.y.axis !== "none"; + } + if (spec.layout !== "circular") { + if (IsChannelDeep(spec.x) && spec.x.axis !== void 0 && spec.x.axis !== "none") { + spec.height -= HIGLASS_AXIS_SIZE; + } + } else { + if (xOrY === "x" && isAxisShown && IsChannelDeep(spec.x) && spec.x.axis === "top") { + spec["outerRadius"] = spec["outerRadius"] - HIGLASS_AXIS_SIZE; + } else if (xOrY === "x" && isAxisShown && IsChannelDeep(spec.x) && spec.x.axis === "bottom") { + spec["innerRadius"] = spec["innerRadius"] + HIGLASS_AXIS_SIZE; + } + } + SUPPORTED_CHANNELS.forEach((channelKey) => { + const channel = spec[channelKey]; + if (IsChannelDeep(channel) && !("zeroBaseline" in channel) && channel.type === "quantitative") { + channel.zeroBaseline = true; + } + }); + this.addScaleMaterials(spec); + } + /** + * TODO: This is experimental. For bar charts, for example, additional care should be taken to correctly flip the visual marks. + * Flip the y scales when `flip` options is used. + */ + flipRanges(spec) { + if (IsChannelDeep(spec.y) && spec.y.flip && Array.isArray(spec.y.range)) { + spec.y.range = spec.y.range.reverse(); + } + } + /** + * Find an axis channel that is encoded with genomic coordinate and return the key (e.g., 'x'). + * `undefined` if not found. + */ + getGenomicChannelKey() { + return getGenomicChannelKeyFromTrack(this.spec()); + } + /** + * Find a genomic field from the track specification. + * `undefined` if not found. + */ + getGenomicChannel() { + return getGenomicChannelFromTrack(this.spec()); + } + /** + * Replace a domain with a new one in the complete spec(s) if the original spec does not define the domain. + * A domain is replaced only when the channel is bound with data (i.e., `ChannelDeep`). + */ + setChannelDomain(channelKey, domain, force) { + const channelRaw = this.originalSpec()[channelKey]; + if (!force && IsChannelDeep(channelRaw) && channelRaw.domain !== void 0) { + return; + } + const channel = this.specComplete[channelKey]; + if (IsChannelDeep(channel)) { + channel.domain = domain; + } + } + /** + * Update default constant values by looking up other channels' scales. + */ + updateChannelValue() { + if (this.originalSpec().y === void 0) { + const y = this.spec().y; + const rowCategories = this.getChannelDomainArray("row"); + if (y && IsChannelValue(y) && rowCategories && this.spec().mark !== "withinLink") { + y.value = this.spec().height / rowCategories.length / 2; + } + } + } + /** + * Get the encoded value using the scales already constructed. + */ + encodedValue(channelKey, value) { + var _a; + if (channelKey === "text" && value !== void 0) { + return `${+value ? ~~value : value}`; + } + const channel = this.spec()[channelKey]; + const channelFieldType = IsChannelDeep(channel) ? channel.type : IsChannelValue(channel) ? "constant" : void 0; + if (!channelFieldType) { + return void 0; + } + if (channelFieldType === "constant") { + return this.channelScales[channelKey](); + } + if (value === void 0) { + return void 0; + } + if (value === null) { + if (channelFieldType === "quantitative") { + value = 0; + } else if (channelFieldType === "nominal") { + value = "null"; + } + } + if (typeof this.channelScales[channelKey] !== "function") { + return void 0; + } + switch (channelKey) { + case "x": + case "y": + case "x1": + case "y1": + case "xe": + case "ye": + case "x1e": + if (channelFieldType === "quantitative" || channelFieldType === "genomic") { + return this.channelScales[channelKey](value); + } + if (channelFieldType === "nominal") { + return this.channelScales[channelKey](value); + } + break; + case "stroke": + case "color": + if (channelFieldType === "quantitative") { + const s = this.channelScales[channelKey].copy(); + const d = s.domain(); + const e = d[1] - d[0]; + const so = Array.from((_a = channel.scaleOffset) != null ? _a : [0, 1]); + return s.domain([d[0] + e * so.sort()[0], d[0] + e * so.sort()[1]])(value); + } + if (channelFieldType === "nominal") { + return this.channelScales[channelKey](value); + } + break; + case "size": + if (channelFieldType === "quantitative") { + return this.channelScales[channelKey](value); + } + if (channelFieldType === "nominal") { + return this.channelScales[channelKey](value); + } + break; + case "row": + if (channelFieldType === "nominal") { + return this.channelScales[channelKey](value); + } + break; + case "strokeWidth": + case "opacity": + if (channelFieldType === "quantitative") { + return this.channelScales[channelKey](value); + } + break; + default: + console.warn(`${channelKey} is not supported for encoding values, so returning a undefined value`); + return void 0; + } + } + trackVisibility(currentStage) { + const spec = this.spec(); + if (!spec.visibility || spec.visibility.length === 0 || spec.visibility.filter((d) => d.target === "track").length === 0) { + return true; + } + let visibility = true; + spec.visibility.filter((d) => d.target === "track").forEach((d) => { + const { operation, measure, threshold } = d; + let compareValue; + if (measure === "zoomLevel") { + compareValue = currentStage[measure]; + } else { + compareValue = spec[measure]; + } + if (compareValue !== void 0) { + visibility = visibility && logicalComparison(compareValue, operation, threshold) === 1; + } + }); + return visibility; + } + /** + * Check whether the visual mark should be visible or not. + * Return 0 (invisible) only when the predefined condition is correct. + */ + markVisibility(datum, metrics) { + const spec = this.spec(); + if (!spec.visibility || spec.visibility.length === 0 || spec.visibility.filter((d) => d.target === "mark").length === 0) { + return 1; + } + let visibility = 1; + spec.visibility.filter((d) => d.target === "mark").forEach((d) => { + const { operation, threshold, conditionPadding, transitionPadding, measure } = d; + const padding = conditionPadding != null ? conditionPadding : 0; + const mark = spec.mark; + let newVisibility = 1; + if (mark === "text" && threshold === "|xe-x|" && measure === "width") { + const xe = this.encodedPIXIProperty("xe", datum); + const x = this.encodedPIXIProperty("x", datum); + if (xe !== void 0 && (metrics == null ? void 0 : metrics.width)) { + newVisibility = logicalComparison( + metrics.width + padding, + operation, + Math.abs(xe - x), + transitionPadding + ); + } + } else if (measure === "width" && typeof threshold === "number" && (metrics == null ? void 0 : metrics.width)) { + newVisibility = logicalComparison(metrics.width + padding, operation, threshold, transitionPadding); + } else if (measure === "zoomLevel" && typeof threshold === "number" && (metrics == null ? void 0 : metrics.zoomLevel)) { + newVisibility = logicalComparison(metrics.zoomLevel, operation, threshold, transitionPadding); + } + if (visibility > newVisibility) { + visibility = newVisibility; + } + }); + return visibility; + } + /** + * + */ + visualPropertyByChannel(channelKey, datum) { + const value = datum !== void 0 ? getValueUsingChannel(datum, this.spec()[channelKey]) : void 0; + return this.encodedValue(channelKey, value); + } + /** + * Retrieve an encoded visual property of a visual mark. + */ + encodedPIXIProperty(propertyKey, datum, additionalInfo) { + const mark = this.spec().mark; + if ([ + "text", + "color", + "row", + "stroke", + "opacity", + "strokeWidth", + "x", + "y", + "xe", + "x1", + "x1e", + "ye", + "size" + ].includes(propertyKey)) { + return this.visualPropertyByChannel(propertyKey, datum); + } + switch (mark) { + case "bar": + return barProperty(this, propertyKey, datum, additionalInfo); + case "point": + case "text": + return pointProperty(this, propertyKey, datum); + case "rect": + return rectProperty(this, propertyKey, datum, additionalInfo); + default: + return void 0; + } + } + // TODO: better organize this, perhaps, by combining several if statements + /** + * Set missing `range`, `domain`, and/or `value` of each channel by looking into data. + */ + addScaleMaterials(spec) { + const data = this.data(); + const genomicChannel = this.getGenomicChannel(); + if (!genomicChannel || !genomicChannel.field) { + console.warn("Genomic field is not provided in the specification"); + return; + } + if (typeof spec.width === "undefined" || typeof spec.height === "undefined") { + console.warn("Track size is not determined yet"); + return; + } + SUPPORTED_CHANNELS.forEach((channelKey) => { + var _a, _b, _c, _d; + const channel = spec[channelKey]; + if (IsStackedChannel(spec, channelKey) && IsChannelDeep(channel)) { + const pivotedData = group(data, (d) => d[genomicChannel.field]); + const xKeys = [...pivotedData.keys()]; + if (!channel.domain) { + const min$1 = "zeroBaseline" in channel && channel.zeroBaseline ? 0 : min( + xKeys.map( + (d) => sum( + pivotedData.get(d).map( + (_d2) => channel.field ? _d2[channel.field] : void 0 + ) + ) + ) + ); + const max$1 = max( + xKeys.map( + (d) => sum( + pivotedData.get(d).map( + (_d2) => channel.field ? _d2[channel.field] : void 0 + ) + ) + ) + ); + channel.domain = [min$1, max$1]; + } + if (!channel.range) { + const rowChannel = spec.row; + const rowField = IsChannelDeep(rowChannel) ? rowChannel.field : void 0; + const rowCategories = (_a = this.getChannelDomainArray("row")) != null ? _a : rowField ? Array.from(new Set(data.map((d) => d[rowField]))) : [1]; + const rowHeight = spec.height / rowCategories.length; + switch (channelKey) { + case "x": + channel.range = [0, spec.width]; + break; + case "y": + channel.range = [0, rowHeight]; + break; + } + } + } else { + const rowChannel = spec.row; + const rowField = IsChannelDeep(rowChannel) ? rowChannel.field : void 0; + const rowCategories = (_b = this.getChannelDomainArray("row")) != null ? _b : rowField ? Array.from(new Set(data.map((d) => d[rowField]))) : [1]; + const rowHeight = spec.height / rowCategories.length; + if (!channel) { + let value; + switch (channelKey) { + case "x": + value = spec.width / 2; + break; + case "y": + if (spec.mark === "withinLink") + value = rowHeight; + else + value = rowHeight / 2; + break; + case "size": + if (spec.mark === "line") + value = this.theme.line.size; + else if (spec.mark === "bar") + value = void 0; + else if (spec.mark === "rect") + value = void 0; + else if (spec.mark === "triangleRight") + value = void 0; + else if (spec.mark === "triangleLeft") + value = void 0; + else if (spec.mark === "triangleBottom") + value = void 0; + else if (spec.stretch && spec.mark === "point" && IsChannelDeep(spec.x) && IsChannelDeep(spec.xe)) + value = void 0; + else if (spec.mark === "text") + value = 12; + else + value = this.theme.point.size; + break; + case "color": + value = this.theme.markCommon.color; + break; + case "row": + value = 0; + break; + case "stroke": + if (spec.mark === "text") + value = this.theme.text.stroke; + else + value = this.theme.markCommon.stroke; + break; + case "strokeWidth": + if (spec.mark === "rule") + value = this.theme.rule.strokeWidth; + else if (spec.mark === "withinLink" || spec.mark === "betweenLink") + value = this.theme.link.strokeWidth; + else if (spec.mark === "text") + value = this.theme.text.strokeWidth; + else + value = this.theme.markCommon.strokeWidth; + break; + case "opacity": + value = this.theme.markCommon.opacity; + break; + case "text": + value = ""; + break; + } + if (typeof value !== "undefined") { + spec[channelKey] = { value }; + } + } else if (IsChannelDeep(channel) && (channel.type === "quantitative" || channel.type === "genomic")) { + if (channel.domain === void 0) { + const min$1 = "zeroBaseline" in channel && channel.zeroBaseline ? 0 : (_c = min(data.map((d) => +d[channel.field]))) != null ? _c : 0; + const max$1 = (_d = max(data.map((d) => +d[channel.field]))) != null ? _d : 0; + channel.domain = [min$1, max$1]; + } else if (channel.type === "genomic" && !IsDomainArray(channel.domain)) { + channel.domain = getNumericDomain(channel.domain); + } + if ((channelKey === "color" || channelKey === "stroke") && channel.type === "quantitative" && !channel.scaleOffset) { + channel.scaleOffset = [0, 1]; + } + if (!channel.range) { + let range; + switch (channelKey) { + case "x": + case "xe": + case "x1": + case "x1e": + range = [0, spec.width]; + break; + case "y": + case "ye": + range = [0, rowHeight]; + break; + case "color": + case "stroke": + range = CHANNEL_DEFAULTS.QUANTITATIVE_COLOR; + break; + case "size": + range = this.theme.markCommon.quantitativeSizeRange; + break; + case "strokeWidth": + range = [1, 3]; + break; + case "opacity": + range = [0, 1]; + break; + } + if (range) { + channel.range = range; + } + } + } else if (IsChannelDeep(channel) && channel.type === "nominal") { + if (channel.domain === void 0) { + channel.domain = Array.from( + new Set(data.map((d) => { + var _a2; + return (_a2 = d[channel.field]) != null ? _a2 : "null"; + })) + ); + } + if (!channel.range) { + let startSize = 2; + let range; + switch (channelKey) { + case "x": + case "xe": + range = [0, spec.width]; + break; + case "y": + case "ye": + range = [rowHeight, 0]; + break; + case "color": + case "stroke": + range = this.theme.markCommon.nominalColorRange; + break; + case "row": + range = [0, spec.height]; + break; + case "size": + range = channel.domain.map(() => startSize++); + break; + } + if (range) { + channel.range = range; + } + } + } + } + }); + [ + ["x", "xe"], + ["y", "ye"] + ].forEach((pair) => { + const [k1, k2] = pair; + const c1 = spec[k1], c2 = spec[k2]; + if (IsChannelDeep(c1) && IsChannelDeep(c2) && c1.type === c2.type && c1.domain && c2.domain && Array.isArray(c1.domain) && Array.isArray(c2.domain)) { + if (c1.type === "genomic" || c1.type === "quantitative") { + const min$1 = min([c1.domain[0], c2.domain[0]]); + const max$1 = max([c1.domain[1], c2.domain[1]]); + c1.domain = c2.domain = [min$1, max$1]; + } else if (c1.type === "nominal") { + const range = Array.from(/* @__PURE__ */ new Set([...c1.domain, ...c2.domain])); + c1.range = c2.range = range; + } + } + }); + } + /** + * Store the scale of individual visual channels based on the `complete` spec. + */ + generateScales() { + const spec = this.spec(); + SUPPORTED_CHANNELS.forEach((channelKey) => { + const channel = spec[channelKey]; + if (IsChannelValue(channel)) { + this.channelScales[channelKey] = () => channel.value; + } else if (IsChannelDeep(channel)) { + if (channelKey === "text") { + return; + } + const domain = channel.domain; + const range = channel.range; + if (domain === void 0 || range === void 0) { + return; + } + if (channel.type === "quantitative" || channel.type === "genomic") { + switch (channelKey) { + case "x": + case "x1": + case "xe": + case "x1e": + case "y": + case "ye": + case "size": + case "opacity": + case "strokeWidth": + this.channelScales[channelKey] = scaleLinear().domain(domain).range(range); + break; + case "color": + case "stroke": + let interpolate = interpolateViridis; + if (Object.keys(PREDEFINED_COLOR_STR_MAP).includes(range)) { + interpolate = PREDEFINED_COLOR_STR_MAP[range]; + } + this.channelScales[channelKey] = scaleSequential(interpolate).domain( + domain + ); + break; + } + } else if (channel.type === "nominal") { + switch (channelKey) { + case "x": + case "xe": + case "y": + case "ye": + case "row": + this.channelScales[channelKey] = scaleBand().domain(domain).range(range); + break; + case "size": + this.channelScales[channelKey] = scaleOrdinal().domain(domain).range(range); + break; + case "color": + case "stroke": + this.channelScales[channelKey] = scaleOrdinal(range).domain(domain); + break; + } + } + } + }); + } + /** + * Return the scale of a visual channel. + * `undefined` if we do not have the scale. + */ + getChannelScale(channelKey) { + return this.channelScales[channelKey]; + } + /** + * Set a new scale for a certain channel. Usually called to replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher. + */ + setChannelScale(channelKey, scale) { + this.channelScales[channelKey] = scale; + } + /** + * Return whether to show y-axis. + */ + isShowYAxis() { + const spec = this.spec(); + const yDomain = this.getChannelDomainArray("y"); + const yRange = this.getChannelRangeArray("y"); + return IsChannelDeep(spec.y) && spec.y.axis !== "none" && spec.y.type === "quantitative" && !!yDomain && !!yRange; + } + /** + * Return the domain of a visual channel. + * `undefined` if we do not have domain in array. + */ + getChannelDomainArray(channelKey) { + const c = this.spec()[channelKey]; + return IsChannelDeep(c) && IsDomainArray(c.domain) ? c.domain : void 0; + } + /** + * Return the range of a visual channel. + * `undefined` if we do not have domain in array. + */ + getChannelRangeArray(channelKey) { + const c = this.spec()[channelKey]; + return IsChannelDeep(c) && IsRangeArray(c.range) ? c.range : void 0; + } + /** + * Validate the original spec. + */ + validateSpec() { + return validateTrack(this.originalSpec()); + } +} +function publish(name2, data) { + PubSub$1.publish(name2, data); +} +function subscribe(name2, callback) { + PubSub$1.subscribe(name2, callback); +} +function unsubscribe(name2) { + PubSub$1.unsubscribe(name2); +} +const DEFAULT_MOUSE_EVENT_STYLE = { + stroke: "black", + strokeWidth: 1, + strokeOpacity: 1, + color: "none", + opacity: 1, + arrange: "front" +}; +function initProcessedTileInfo() { + return { goslingModels: [], tabularData: [], skipRendering: false }; +} +const config$1 = { + type: "gosling-track", + datatype: ["multivec", "epilogos"], + orientation: "1d-horizontal", + // @ts-expect-error missing default spec + defaultOptions: { + // TODO: Are any of these used? + // labelPosition: 'none', + // labelColor: 'black', + // labelTextOpacity: 0.4, + // trackBorderWidth: 0, + // trackBorderColor: 'black', + // backgroundColor: 'white', + // barBorder: false, + // sortLargestOnTop: true, + // axisPositionHorizontal: 'left', + theme: getTheme$1("light") + } +}; +const factory$1 = (HGC, context, options) => { + var _assembly2, _processedTileInfo, _mouseDownX, _mouseDownY, _isRangeBrushActivated, _gBrush, _loadingTextStyleObj, _loadingTextBg, _loadingText, _tilesToId, tilesToId_fn, _binsPerTile, binsPerTile_get, _generateTabularData, generateTabularData_fn, _onMouseDown, onMouseDown_fn, _onMouseMove, onMouseMove_fn, _onMouseUp, onMouseUp_fn, _onMouseOut, onMouseOut_fn, _getElementsWithinMouse, getElementsWithinMouse_fn, _publishTrackEvents, publishTrackEvents_fn, _onRangeBrush, onRangeBrush_fn, _highlightMarks, highlightMarks_fn, _publishOnNewTrack, publishOnNewTrack_fn, _hasStretchableGraphics, hasStretchableGraphics_fn, _isTooStretched, isTooStretched_fn; + const { tileProxy } = HGC.services; + const { BarTrack } = HGC.tracks; + const loadingTextStyle = getTextStyle({ color: "black", size: 12 }); + const _GoslingTrackClass = class _GoslingTrackClass extends BarTrack { + /* * + * + * Constructor + * + * */ + constructor() { + var _a, _b, _c, _d, _e, _f; + super(context, options); + __privateAdd(this, _binsPerTile); + /** + * Construct tabular data from a higlass tileset and a gosling track model. + */ + __privateAdd(this, _generateTabularData); + /* * + * + * Mouse methods + * + * */ + __privateAdd(this, _onMouseDown); + __privateAdd(this, _onMouseMove); + __privateAdd(this, _onMouseUp); + __privateAdd(this, _onMouseOut); + /** + * From all tiles and overlaid tracks, collect element(s) that are withing a mouse position. + */ + __privateAdd(this, _getElementsWithinMouse); + /** + * Call track events (e.g., `trackClick` or `trackMouseOver`) based on a mouse position and the track display area. + */ + __privateAdd(this, _publishTrackEvents); + __privateAdd(this, _onRangeBrush); + /** + * Highlight marks that are either mouse overed or selected. + */ + __privateAdd(this, _highlightMarks); + /** + * Javscript subscription API methods (besides for mouse) + */ + /** + * Publishes track information. Triggered when track gets created + */ + __privateAdd(this, _publishOnNewTrack); + /** + * Used in drawTile() + * Checks if the track has marks which are stretchable. Stretching + * is not supported for circular layouts or 2D tracks + */ + __privateAdd(this, _hasStretchableGraphics); + /** + * Used in drawTile() + * Checks if the tile Graphic is too stretched. If so, it returns true. + * @param stretchFactor The factor by which the tile is stretched + * @returns True if the tile is too stretched, false otherwise + */ + __privateAdd(this, _isTooStretched); + /* * + * + * Properties + * + * */ + __publicField(this, "tileSize"); + __publicField(this, "mRangeBrush"); + __privateAdd(this, _assembly2, void 0); + // Used to get the relative genomic position + __privateAdd(this, _processedTileInfo, void 0); + __publicField(this, "firstDraw", true); + // False if draw has been called once already. Used with onNewTrack API. Public because used in draw() + // Used in mark/legend.ts + __publicField(this, "gLegend", HGC.libraries.d3Selection.select(context.svgElement).append("g")); + __publicField(this, "displayedLegends", []); + // Store the color legends added so far so that we can avoid overlaps and redundancy + // Used in mark/text.ts + __publicField(this, "textGraphics", []); + __publicField(this, "textsBeingUsed", 0); + // Mouse fields + __publicField(this, "pMouseHover", new HGC.libraries.PIXI.Graphics()); + __publicField(this, "pMouseSelection", new HGC.libraries.PIXI.Graphics()); + __privateAdd(this, _mouseDownX, 0); + __privateAdd(this, _mouseDownY, 0); + __privateAdd(this, _isRangeBrushActivated, false); + __privateAdd(this, _gBrush, HGC.libraries.d3Selection.select(context.svgElement).append("g")); + __privateAdd(this, _loadingTextStyleObj, new HGC.libraries.PIXI.TextStyle(loadingTextStyle)); + __privateAdd(this, _loadingTextBg, new HGC.libraries.PIXI.Graphics()); + __privateAdd(this, _loadingText, new HGC.libraries.PIXI.Text("", loadingTextStyle)); + __publicField(this, "prevVisibleAndFetchedTiles"); + __publicField(this, "resolvedTracks"); + __publicField(this, "hideMousePosition"); + context.dataFetcher.track = this; + __privateSet(this, _processedTileInfo, {}); + __privateSet(this, _assembly2, this.options.spec.assembly); + if ("overlay" in this.options.spec) { + this.options.spec.overlay = this.options.spec._overlay.map((o) => { + return { ...o, _renderingId: uuid() }; + }); + } else { + this.options.spec._renderingId = uuid(); + } + this.fetchedTiles = {}; + this.tileSize = (_b = (_a = this.tilesetInfo) == null ? void 0 : _a.tile_size) != null ? _b : 1024; + const { valid, errorMessages } = validateTrack(this.options.spec); + if (!valid) { + console.warn("The specification of the following track is invalid", errorMessages, this.options.spec); + } + this.pMain.addChild(this.pMouseHover); + this.pMain.addChild(this.pMouseSelection); + this.pMask.interactive = true; + this.mRangeBrush = new LinearBrushModel(__privateGet(this, _gBrush), HGC.libraries, (_c = this.options.spec.style) == null ? void 0 : _c.brush); + this.mRangeBrush.on("brush", __privateMethod(this, _onRangeBrush, onRangeBrush_fn).bind(this)); + this.pMask.on("mousedown", (e) => { + const { x, y } = e.data.getLocalPosition(this.pMain); + __privateMethod(this, _onMouseDown, onMouseDown_fn).call(this, x, y, e.data.originalEvent.altKey); + }); + this.pMask.on("mouseup", (e) => { + const { x, y } = e.data.getLocalPosition(this.pMain); + __privateMethod(this, _onMouseUp, onMouseUp_fn).call(this, x, y); + }); + this.pMask.on("mousemove", (e) => { + const { x } = e.data.getLocalPosition(this.pMain); + __privateMethod(this, _onMouseMove, onMouseMove_fn).call(this, x); + }); + this.pMask.on("mouseout", __privateMethod(this, _onMouseOut, onMouseOut_fn).bind(this)); + this.flipText = this.options.spec.orientation === "vertical"; + if (this.hideMousePosition) { + this.hideMousePosition(); + this.hideMousePosition = void 0; + } + if (((_d = this.options) == null ? void 0 : _d.showMousePosition) && !this.hideMousePosition) { + this.hideMousePosition = HGC.utils.showMousePosition( + this, + Is2DTrack(this.getResolvedTracks()[0]), + this.isShowGlobalMousePosition() + ); + } + this.pLabel.removeChild(this.trackNotFoundText); + __privateGet(this, _loadingText).anchor.x = 1; + __privateGet(this, _loadingText).anchor.y = 1; + this.pLabel.addChild(__privateGet(this, _loadingTextBg)); + this.pLabel.addChild(__privateGet(this, _loadingText)); + HGC.libraries.PIXI.GRAPHICS_CURVES.adaptive = (_f = (_e = this.options.spec.style) == null ? void 0 : _e.enableSmoothPath) != null ? _f : false; + if (HGC.libraries.PIXI.GRAPHICS_CURVES.adaptive) { + HGC.libraries.PIXI.GRAPHICS_CURVES.maxLength = 1; + HGC.libraries.PIXI.GRAPHICS_CURVES.maxSegments = 2048 * 10; + } + } + /* * + * + * Rendering Cycle Methods + * + * */ + /** + * Draw all tiles from the bottom. Called from TiledPixiTrack constructor, so all methods called must be + * public. https://github.com/higlass/higlass/blob/387a03e877dcfa4c2cfeabc0869375b58c0b362d/app/scripts/TiledPixiTrack.js#L216 + * Overrides draw() in BarTrack. + * This means some class properties can be still `undefined`. + */ + draw() { + var _a, _b; + this.clearMouseEventData(); + this.textsBeingUsed = 0; + (_a = this.pMouseHover) == null ? void 0 : _a.clear(); + const processTilesAndDraw = () => { + const isBamDataFetcher = this.dataFetcher instanceof BamDataFetcher; + this.processAllTiles(isBamDataFetcher); + super.draw(); + this.prevVisibleAndFetchedTiles = this.visibleAndFetchedTiles(); + }; + if (isTabularDataFetcher(this.dataFetcher) && !isEqual(this.visibleAndFetchedTiles(), this.prevVisibleAndFetchedTiles)) { + this.updateTileAsync(this.dataFetcher, processTilesAndDraw); + } else { + processTilesAndDraw(); + } + (_b = this.mRangeBrush) == null ? void 0 : _b.drawBrush(true); + if (this.firstDraw) { + __privateMethod(this, _publishOnNewTrack, publishOnNewTrack_fn).call(this); + this.firstDraw = false; + } + } + /* + * Do whatever is necessary before rendering a new tile. This function is called from `receivedTiles()`. + * Overrides initTile in BarTrack + * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/HorizontalLine1DPixiTrack.js#L50) + */ + initTile(tile) { + this.drawTile(tile); + } + updateTile() { + } + // Never mind about this function for the simplicity. + renderTile() { + } + // Never mind about this function for the simplicity. + /** + * Display a tile upon receiving a new one or when explicitly called by a developer, e.g., calling + * `this.draw()`. Overrides drawTile in BarTrack + */ + drawTile(tile) { + var _a, _b; + const tileInfo = __privateGet(this, _processedTileInfo)[tile.tileId]; + if (!tileInfo) { + return; + } + if (!tile.drawnAtScale) { + tile.drawnAtScale = this._xScale.copy(); + } + const [graphicsXScale, graphicsXPos] = this.getXScaleAndOffset(tile.drawnAtScale); + const isFirstRender = graphicsXScale === 1; + if (!__privateMethod(this, _isTooStretched, isTooStretched_fn).call(this, graphicsXScale) && __privateMethod(this, _hasStretchableGraphics, hasStretchableGraphics_fn).call(this) && !isFirstRender) { + tile.graphics.scale.x = graphicsXScale; + tile.graphics.position.x = graphicsXPos; + return; + } + tile.drawnAtScale = this._xScale.copy(); + (_a = tile.graphics) == null ? void 0 : _a.clear(); + (_b = tile.graphics) == null ? void 0 : _b.removeChildren(); + this.pBackground.clear(); + this.pBackground.removeChildren(); + this.pBorder.clear(); + this.pBorder.removeChildren(); + this.displayedLegends = []; + tileInfo.goslingModels.forEach((model) => { + const trackWidth = this.dimensions[0]; + const zoomLevel = this._xScale.invert(trackWidth) - this._xScale.invert(0); + if (!model.trackVisibility({ zoomLevel })) { + return; + } + drawPreEmbellishment(HGC, this, tile, model, this.options.theme); + drawMark(HGC, this, tile, model); + drawPostEmbellishment(HGC, this, tile, model, this.options.theme); + }); + this.forceDraw(); + } + /** + * Render this track again using a new option when a user changed the option. Overrides rerender in BarTrack. + */ + rerender(newOptions) { + this.options = newOptions; + if (this.options.spec.layout === "circular") { + this.mRangeBrush.remove(); + } + this.getResolvedTracks(true); + this.clearMouseEventData(); + this.textsBeingUsed = 0; + this.processAllTiles(true); + this.draw(); + this.forceDraw(); + } + /** + * Clears MouseEventModel from each GoslingTrackModel. Must be a public method because it is called from draw() + */ + clearMouseEventData() { + this.visibleAndFetchedGoslingModels().forEach((model) => model.getMouseEventModel().clear()); + } + /** + * Collect all gosling models that correspond to the tiles that are both visible and fetched. + */ + visibleAndFetchedGoslingModels() { + return this.visibleAndFetchedTiles().flatMap( + (tile) => { + var _a, _b; + return (_b = (_a = __privateGet(this, _processedTileInfo)[tile.tileId]) == null ? void 0 : _a.goslingModels) != null ? _b : []; + } + ); + } + /** + * End of the rendering cycle. This function is called when the track is removed entirely. + */ + remove() { + super.remove(); + if (this.gLegend) { + this.gLegend.remove(); + this.gLegend = void 0; + } + this.mRangeBrush.remove(); + } + /* + * Rerender all tiles when track size is changed. Overrides method in TiledPixiTrack + * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/PixiTrack.js#L186). + */ + setDimensions(newDimensions) { + super.setDimensions(newDimensions); + this.mRangeBrush.setSize(newDimensions[1]); + } + /** + * Record new position. + */ + setPosition(newPosition) { + super.setPosition(newPosition); + [this.pMain.position.x, this.pMain.position.y] = this.position; + this.mRangeBrush.setOffset(...newPosition); + } + /** + * A function to redraw this track. Typically called when an asynchronous event occurs (i.e. tiles loaded) + * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/TiledPixiTrack.js#L71) + */ + forceDraw() { + this.animate(); + } + /** + * Called when location or zoom level has been changed by click-and-drag interaction + * (https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/HorizontalLine1DPixiTrack.js#L215) + * For brushing, refer to https://github.com/higlass/higlass/blob/caf230b5ee41168ea491572618612ac0cc804e5a/app/scripts/HeatmapTiledPixiTrack.js#L1493 + */ + zoomed(newXScale, newYScale) { + const range = this.mRangeBrush.getRange(); + this.mRangeBrush.updateRange( + range ? [newXScale(this._xScale.invert(range[0])), newXScale(this._xScale.invert(range[1]))] : null + ); + this.xScale(newXScale); + this.yScale(newYScale); + this.refreshTiles(); + this.draw(); + this.forceDraw(); + const genomicRange = newXScale.domain().map((absPos) => getRelativeGenomicPosition(absPos, __privateGet(this, _assembly2), true)); + publish("location", { + id: context.viewUid, + genomicRange + }); + } + /** + * This is how the mask gets drawn. Overrides method in PixiTrack. + * Compared to the method in PixiTrack, this method draws a circular mask when the layout is circular. + * @param position + * @param dimensions + */ + setMask(position, dimensions) { + this.pMask.clear(); + this.pMask.beginFill(); + if (this.options.spec.layout === "circular") { + const [x, y] = this.position; + const [width, height] = this.dimensions; + const cx = x + width / 2; + const cy = y + height / 2; + const outerRadius = this.options.spec.outerRadius; + this.pMask.drawCircle(cx, cy, outerRadius); + } else { + this.pMask.drawRect(position[0], position[1], dimensions[0], dimensions[1]); + } + this.pMask.endFill(); + } + /* * + * + * Tile and data processing methods + * + * */ + /** + * Gets all tiles and generates tabular data and GoslingTrackModels for each tile. Called by this.draw(), so + * this method must be public. + * @param force if true then tabular data gets regenerated + */ + processAllTiles(force = false) { + var _a, _b; + this.tileSize = (_b = (_a = this.tilesetInfo) == null ? void 0 : _a.tile_size) != null ? _b : 1024; + const tiles = this.visibleAndFetchedTiles(); + tiles.forEach((tile) => __privateMethod(this, _generateTabularData, generateTabularData_fn).call(this, tile, force)); + this.combineAllTilesIfNeeded(); + const models = tiles.flatMap((tile) => this.transformDataAndCreateModels(tile)); + shareScaleAcrossTracks(models); + const flatTileData = [].concat(...models.map((d) => d.data())); + if (flatTileData.length !== 0) { + this.options.siblingIds.forEach((id) => publish("rawData", { id, data: flatTileData })); + } + } + /** + * This is currently for testing the new way of rendering visual elements. Called by this.draw() + */ + async updateTileAsync(tabularDataFetcher, callback) { + if (!this.tilesetInfo) + return; + const tiles = this.visibleAndFetchedTiles(); + const tabularData = await tabularDataFetcher.getTabularData(Object.values(tiles).map((x) => x.remoteId)); + const tilesetInfo = this.tilesetInfo; + tiles.forEach((tile, i) => { + if (i === 0) { + const [refTile] = HGC.utils.trackUtils.calculate1DVisibleTiles(tilesetInfo, this._xScale); + tile.tileData.zoomLevel = refTile[0]; + tile.tileData.tilePos = [refTile[1], refTile[1]]; + tile.tileData.tabularData = tabularData; + } else { + tile.tileData.tabularData = []; + } + }); + callback(); + } + /** + * Overrides method in Tiled1DPixiTrack. It is called in the constructor, `super(context, options)`. + * So be aware to use defined variables. + */ + calculateVisibleTiles() { + var _a, _b, _c, _d, _e; + if (!this.tilesetInfo) + return; + if (isTabularDataFetcher(this.dataFetcher)) { + const tiles = HGC.utils.trackUtils.calculate1DVisibleTiles(this.tilesetInfo, this._xScale); + const maxTileWith = (_b = (_a = this.tilesetInfo.max_tile_width) != null ? _a : this.dataFetcher.MAX_TILE_WIDTH) != null ? _b : Number.MAX_SAFE_INTEGER; + for (const tile of tiles) { + const { tileWidth } = this.getTilePosAndDimensions(tile[0], [tile[1], tile[1]]); + this.forceDraw(); + if (tileWidth > maxTileWith) { + return; + } + } + this.setVisibleTiles(tiles); + } else { + if (!this.tilesetInfo) { + return; + } + const zoomLevel = this.calculateZoomLevel(); + if ("resolutions" in this.tilesetInfo) { + const sortedResolutions = this.tilesetInfo.resolutions.map((x) => +x).sort((a, b) => b - a); + const xTiles = tileProxy.calculateTilesFromResolution( + sortedResolutions[zoomLevel], + this._xScale, + this.tilesetInfo.min_pos[0], + this.tilesetInfo.max_pos[0] + ); + let yTiles; + if (Is2DTrack(this.getResolvedTracks()[0])) { + yTiles = tileProxy.calculateTilesFromResolution( + sortedResolutions[zoomLevel], + this._yScale, + this.tilesetInfo.min_pos[0], + this.tilesetInfo.max_pos[0] + ); + } + const tiles = __privateMethod(_c = _GoslingTrackClass, _tilesToId, tilesToId_fn).call(_c, xTiles, yTiles, zoomLevel); + this.setVisibleTiles(tiles); + } else { + const xTiles = tileProxy.calculateTiles( + zoomLevel, + this.relevantScale(), + this.tilesetInfo.min_pos[0], + this.tilesetInfo.max_pos[0], + this.tilesetInfo.max_zoom, + this.tilesetInfo.max_width + ); + let yTiles; + if (Is2DTrack(this.getResolvedTracks()[0])) { + yTiles = tileProxy.calculateTiles( + zoomLevel, + this._yScale, + this.tilesetInfo.min_pos[1], + this.tilesetInfo.max_pos[1], + this.tilesetInfo.max_zoom, + // @ts-expect-error what is max_width1? + (_d = this.tilesetInfo.max_width1) != null ? _d : this.tilesetInfo.max_width + ); + } + const tiles = __privateMethod(_e = _GoslingTrackClass, _tilesToId, tilesToId_fn).call(_e, xTiles, yTiles, zoomLevel); + this.setVisibleTiles(tiles); + } + } + } + /** + * Get the tile's position in its coordinate system. Overrides method in Tiled1DPixiTrack. + */ + getTilePosAndDimensions(zoomLevel, tilePos) { + if (!this.tilesetInfo) { + throw Error("tilesetInfo not parsed"); + } + if ("resolutions" in this.tilesetInfo) { + const sortedResolutions = this.tilesetInfo.resolutions.map((x) => +x).sort((a, b) => b - a); + const chosenResolution = sortedResolutions[zoomLevel]; + const [xTilePos, yTilePos] = tilePos; + const tileWidth = chosenResolution * __privateGet(this, _binsPerTile, binsPerTile_get); + const tileHeight = tileWidth; + const tileX = tileWidth * xTilePos; + const tileY = tileHeight * yTilePos; + return { + tileX, + tileY, + tileWidth, + tileHeight + }; + } else { + const [xTilePos, yTilePos] = tilePos; + const minX = this.tilesetInfo.min_pos[0]; + const minY = this.tilesetInfo.min_pos[1]; + const tileWidth = this.tilesetInfo.max_width / 2 ** zoomLevel; + const tileHeight = this.tilesetInfo.max_width / 2 ** zoomLevel; + const tileX = minX + xTilePos * tileWidth; + const tileY = minY + yTilePos * tileHeight; + return { + tileX, + tileY, + tileWidth, + tileHeight + }; + } + } + /** + * Gets the indices of the visible data a tile. Overrides method in Tiled1DPixiTrack + */ + getIndicesOfVisibleDataInTile(tile) { + const visible = this._xScale.range(); + if (!this.tilesetInfo || !tile.tileData.tilePos || !("dense" in tile.tileData)) { + return [0, 0]; + } + const { tileX, tileWidth } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos); + const tileXScale = HGC.libraries.d3Scale.scaleLinear().domain([0, __privateGet(this, _binsPerTile, binsPerTile_get)]).range([tileX, tileX + tileWidth]); + const start = Math.max(0, Math.round(tileXScale.invert(this._xScale.invert(visible[0])))); + const end = Math.min( + tile.tileData.dense.length, + Math.round(tileXScale.invert(this._xScale.invert(visible[1]))) + ); + return [start, end]; + } + /** + * Overrides method in TiledPixiTrack + * @param loadedTiles + */ + receivedTiles(loadedTiles) { + super.receivedTiles(loadedTiles); + isTabularDataFetcher(this.dataFetcher) && this.drawLoadingCue(); + } + /** + * Overrides method in TiledPixiTrack + */ + removeOldTiles() { + super.removeOldTiles(); + isTabularDataFetcher(this.dataFetcher) && this.drawLoadingCue(); + } + /** + * Combile multiple tiles into the last tile. + * This is sometimes necessary, for example, when applying a displacement algorithm to all tiles at once. + * Called by this.processAllTiles() so this method needs to be public. + */ + combineAllTilesIfNeeded() { + var _a, _b, _c; + if (!this.shouldCombineTiles()) + return; + const tiles = this.visibleAndFetchedTiles(); + if (!tiles || tiles.length <= 1) { + return; + } + this.tileSize = ((_b = (_a = this.tilesetInfo) == null ? void 0 : _a.tile_size) != null ? _b : 1024) * tiles.length; + let merged = []; + tiles.forEach((tile, i) => { + const tileInfo = __privateGet(this, _processedTileInfo)[tile.tileId]; + if (tileInfo) { + merged = [...merged, ...tileInfo.tabularData]; + tileInfo.skipRendering = i !== 0; + } + }); + const firstTileInfo = __privateGet(this, _processedTileInfo)[tiles[0].tileId]; + firstTileInfo.tabularData = merged; + if ((_c = firstTileInfo.tabularData[0]) == null ? void 0 : _c.uid) { + firstTileInfo.tabularData = uniqBy(firstTileInfo.tabularData, "uid"); + } + } + /** + * Check whether tiles should be merged. Needs to be public since called by combineAllTilesIfNeeded() + */ + shouldCombineTiles() { + const includesDisplaceTransform = hasDataTransform(this.options.spec, "displace"); + const hasDenseTiles = () => { + const tiles = this.visibleAndFetchedTiles(); + return tiles.length >= 1 && "dense" in tiles[0].tileData; + }; + const isBamDataFetcher = this.dataFetcher instanceof BamDataFetcher; + return includesDisplaceTransform && !hasDenseTiles() && !isBamDataFetcher; + } + /** + * Creates an array of SingleTracks if there are overlaid tracks. + * This method cannot be private because it is called by functions which are called by super.draw(); + */ + getResolvedTracks(forceUpdate = false) { + if (forceUpdate || !this.resolvedTracks) { + const tracks = resolveSuperposedTracks(this.options.spec).filter((t) => t.mark !== "brush"); + tracks.forEach((track) => { + if ("values" in track.data) { + track.data.values = []; + } + }); + this.resolvedTracks = tracks; + } + return this.resolvedTracks; + } + /** + * Apply data transformation to each of the overlaid tracks and generate GoslingTrackModels. + */ + transformDataAndCreateModels(tile) { + const tileInfo = __privateGet(this, _processedTileInfo)[tile.tileId]; + if (!tileInfo || tileInfo.skipRendering) { + return []; + } + tileInfo.goslingModels = []; + const resolvedTracks = this.getResolvedTracks(); + resolvedTracks.forEach((resolvedSpec) => { + var _a; + let tabularDataTransformed = Array.from(tileInfo.tabularData); + (_a = resolvedSpec.dataTransform) == null ? void 0 : _a.forEach((t) => { + switch (t.type) { + case "filter": + tabularDataTransformed = filterData(t, tabularDataTransformed); + break; + case "concat": + tabularDataTransformed = concatString(t, tabularDataTransformed); + break; + case "replace": + tabularDataTransformed = replaceString(t, tabularDataTransformed); + break; + case "log": + tabularDataTransformed = calculateData(t, tabularDataTransformed); + break; + case "exonSplit": + tabularDataTransformed = splitExon(t, tabularDataTransformed, resolvedSpec.assembly); + break; + case "genomicLength": + tabularDataTransformed = calculateGenomicLength(t, tabularDataTransformed); + break; + case "svType": + tabularDataTransformed = inferSvType(t, tabularDataTransformed); + break; + case "coverage": + tabularDataTransformed = aggregateCoverage(t, tabularDataTransformed, this._xScale.copy()); + break; + case "subjson": + tabularDataTransformed = parseSubJSON(t, tabularDataTransformed); + break; + case "displace": + tabularDataTransformed = displace(t, tabularDataTransformed, this._xScale.copy()); + break; + } + }); + try { + if (PubSub) { + const NUM_OF_ROWS_IN_PREVIEW = 100; + const numOrRows = tabularDataTransformed.length; + PubSub.publish("data-preview", { + id: context.viewUid, + // TODO: Do we need the stringified version? Stringify of large JSON data is very slow. + dataConfig: JSON.stringify({ data: resolvedSpec.data }), + data: NUM_OF_ROWS_IN_PREVIEW > numOrRows ? tabularDataTransformed : sampleSize(tabularDataTransformed, NUM_OF_ROWS_IN_PREVIEW) + // ... + }); + } + } catch (e) { + } + const [trackWidth, trackHeight] = this.dimensions; + const axisSize = IsXAxis(resolvedSpec) ? HIGLASS_AXIS_SIZE : 0; + const [w, h] = [trackWidth, trackHeight + axisSize]; + const circularFactor = Math.min(w, h) / Math.min(resolvedSpec.width, resolvedSpec.height); + if (resolvedSpec.innerRadius) { + resolvedSpec.innerRadius = resolvedSpec.innerRadius * circularFactor; + } + if (resolvedSpec.outerRadius) { + resolvedSpec.outerRadius = resolvedSpec.outerRadius * circularFactor; + } + resolvedSpec.width = w; + resolvedSpec.height = h; + const model = new GoslingTrackModel(resolvedSpec, tabularDataTransformed, this.options.theme); + tileInfo.goslingModels.push(model); + }); + return tileInfo.goslingModels; + } + // set in HorizontalTiled1DPixiTrack + /** + * Overrides method in HorizontalLine1DPixiTrack + */ + getMouseOverHtml(mouseX, mouseY) { + var _a, _b, _c, _d, _e; + __privateMethod(this, _publishTrackEvents, publishTrackEvents_fn).call(this, "trackMouseOver", mouseX, mouseY); + if (__privateGet(this, _isRangeBrushActivated)) { + return ""; + } + if (!this.tilesetInfo) { + return ""; + } + this.pMouseHover.clear(); + const genomicPosition = getRelativeGenomicPosition(Math.floor(this._xScale.invert(mouseX)), __privateGet(this, _assembly2)); + const capturedElements = __privateMethod(this, _getElementsWithinMouse, getElementsWithinMouse_fn).call(this, mouseX, mouseY); + if (capturedElements.length !== 0) { + document.body.style.cursor = "pointer"; + } else { + document.body.style.cursor = "default"; + } + if (capturedElements.length !== 0) { + const mouseEvents = (_a = this.options.spec.experimental) == null ? void 0 : _a.mouseEvents; + const mouseOverEnabled = !!mouseEvents || IsMouseEventsDeep(mouseEvents) && !!mouseEvents.mouseOver; + if (mouseOverEnabled) { + const g = this.pMouseHover; + if (((_c = (_b = this.options.spec.style) == null ? void 0 : _b.mouseOver) == null ? void 0 : _c.arrange) !== "behind") { + this.pMain.removeChild(g); + this.pMain.addChild(g); + } + __privateMethod(this, _highlightMarks, highlightMarks_fn).call(this, g, capturedElements, Object.assign({}, DEFAULT_MOUSE_EVENT_STYLE, (_d = this.options.spec.style) == null ? void 0 : _d.mouseOver)); + publish("mouseOver", { + id: context.viewUid, + genomicPosition, + data: capturedElements.map((d) => d.value) + }); + } + const models = this.visibleAndFetchedGoslingModels(); + const firstTooltipSpec = (_e = models.find((m2) => { + var _a2; + return m2.spec().tooltip && ((_a2 = m2.spec().tooltip) == null ? void 0 : _a2.length) !== 0; + })) == null ? void 0 : _e.spec().tooltip; + if (firstTooltipSpec) { + let content = firstTooltipSpec.map((d) => { + var _a2; + const rawValue = capturedElements[0].value[d.field]; + let value = rawValue; + if (d.type === "quantitative" && d.format) { + value = HGC.libraries.d3Format.format(d.format)(+rawValue); + } else if (d.type === "genomic") { + const { chromosome, position } = getRelativeGenomicPosition(+rawValue, __privateGet(this, _assembly2)); + value = `${chromosome}:${HGC.libraries.d3Format.format(",")(position)}`; + } + return `${(_a2 = d.alt) != null ? _a2 : d.field}${value}`; + }).join(""); + content = `${content}
`; + if (capturedElements.length > 1) { + content += `
${capturedElements.length - 1} Additional Selections...
`; + } + return `
${content}
`; + } + } + return ""; + } + /* * + * + * Other misc methods and overrides + * + * */ + /** + * Returns the minimum in the visible area (not visible tiles). + * Overrides method in Tiled1DPixiTrack + */ + minVisibleValue() { + return 0; + } + /** + * Returns the maximum in the visible area (not visible tiles). + * Overrides method in Tiled1DPixiTrack. + */ + maxVisibleValue() { + return 0; + } + /** + * Overrides method in PixiTrack. SVG export is not supported. + */ + exportSVG() { + throw new Error("exportSVG() not supported for gosling-track"); + } + /** + * Show visual cue during waiting for visualizations being rendered. Also called by data fetchers + */ + drawLoadingCue() { + if (this.fetching.size) { + const margin = 6; + const text = `Fetching... ${Array.from(this.fetching).join(" ")}`; + __privateGet(this, _loadingText).text = text; + __privateGet(this, _loadingText).x = this.position[0] + this.dimensions[0] - margin / 2; + __privateGet(this, _loadingText).y = this.position[1] + this.dimensions[1] - margin / 2; + const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, __privateGet(this, _loadingTextStyleObj)); + const { width: w, height: h } = metric; + __privateGet(this, _loadingTextBg).clear(); + __privateGet(this, _loadingTextBg).lineStyle(1, colorToHex("grey"), 1, 0.5); + __privateGet(this, _loadingTextBg).beginFill(colorToHex("white"), 0.8); + __privateGet(this, _loadingTextBg).drawRect( + this.position[0] + this.dimensions[0] - w - margin - 1, + this.position[1] + this.dimensions[1] - h - margin - 1, + w + margin, + h + margin + ); + __privateGet(this, _loadingText).visible = true; + __privateGet(this, _loadingTextBg).visible = true; + } else { + __privateGet(this, _loadingText).visible = false; + __privateGet(this, _loadingTextBg).visible = false; + } + } + /** + * Called in legend.ts + */ + updateScaleOffsetFromOriginalSpec(_renderingId, scaleOffset, channelKey) { + this.getResolvedTracks().map((spec) => { + if (spec._renderingId === _renderingId) { + const channel = spec[channelKey]; + if (IsChannelDeep(channel)) { + channel.scaleOffset = scaleOffset; + } + } + }); + } + /** + * Called in legend.ts + */ + shareScaleOffsetAcrossTracksAndTiles(scaleOffset, channelKey) { + const models = this.visibleAndFetchedGoslingModels(); + models.forEach((d) => { + const channel = d.spec()[channelKey]; + if (IsChannelDeep(channel)) { + channel.scaleOffset = scaleOffset; + } + const channelOriginal = d.originalSpec()[channelKey]; + if (IsChannelDeep(channelOriginal)) { + channelOriginal.scaleOffset = scaleOffset; + } + }); + } + }; + _assembly2 = new WeakMap(); + _processedTileInfo = new WeakMap(); + _mouseDownX = new WeakMap(); + _mouseDownY = new WeakMap(); + _isRangeBrushActivated = new WeakMap(); + _gBrush = new WeakMap(); + _loadingTextStyleObj = new WeakMap(); + _loadingTextBg = new WeakMap(); + _loadingText = new WeakMap(); + _tilesToId = new WeakSet(); + tilesToId_fn = function(xTiles, yTiles, zoomLevel) { + if (!yTiles) { + return xTiles.map((x) => [zoomLevel, x]); + } + const tiles = []; + xTiles.forEach((x) => yTiles.forEach((y) => tiles.push([zoomLevel, x, y]))); + return tiles; + }; + _binsPerTile = new WeakSet(); + binsPerTile_get = function() { + let maybeValue; + if (this.tilesetInfo) { + maybeValue = "bins_per_dimension" in this.tilesetInfo ? this.tilesetInfo.bins_per_dimension : this.tilesetInfo.tile_size; + } + return maybeValue != null ? maybeValue : 256; + }; + _generateTabularData = new WeakSet(); + generateTabularData_fn = function(tile, force = false) { + if (__privateGet(this, _processedTileInfo)[tile.tileId] && !force) { + return; + } + if (!tile.tileData.tilePos) { + return; + } + const tileInfo = initProcessedTileInfo(); + const resolvedTracks = this.getResolvedTracks(); + if (resolvedTracks.length === 0) { + return []; + } + const firstResolvedTrack = resolvedTracks[0]; + if ("tabularData" in tile.tileData) { + tileInfo.tabularData = tile.tileData.tabularData; + } else { + const { tileX, tileY, tileWidth, tileHeight } = this.getTilePosAndDimensions( + tile.tileData.zoomLevel, + tile.tileData.tilePos + ); + const sparse = "length" in tile.tileData ? Array.from(tile.tileData) : []; + const extendedTileData = Object.assign({}, tile.tileData, { + sparse, + tileX, + tileY, + tileWidth, + tileHeight, + tileSize: this.tileSize + }); + const tabularData = getTabularData(firstResolvedTrack, extendedTileData); + if (tabularData) { + tileInfo.tabularData = tabularData; + } + } + __privateGet(this, _processedTileInfo)[tile.tileId] = tileInfo; + }; + _onMouseDown = new WeakSet(); + onMouseDown_fn = function(mouseX, mouseY, isAltPressed) { + var _a; + __privateSet(this, _mouseDownX, mouseX); + __privateSet(this, _mouseDownY, mouseY); + const mouseEvents = (_a = this.options.spec.experimental) == null ? void 0 : _a.mouseEvents; + const rangeSelectEnabled = !!mouseEvents || IsMouseEventsDeep(mouseEvents) && !!mouseEvents.rangeSelect; + __privateSet(this, _isRangeBrushActivated, rangeSelectEnabled && isAltPressed); + this.pMouseHover.clear(); + }; + _onMouseMove = new WeakSet(); + onMouseMove_fn = function(mouseX) { + if (this.options.spec.layout === "circular") { + return; + } + if (__privateGet(this, _isRangeBrushActivated)) { + this.mRangeBrush.updateRange([mouseX, __privateGet(this, _mouseDownX)]).drawBrush().visible().disable(); + } + }; + _onMouseUp = new WeakSet(); + onMouseUp_fn = function(mouseX, mouseY) { + var _a; + __privateMethod(this, _publishTrackEvents, publishTrackEvents_fn).call(this, "trackClick", mouseX, mouseY); + const mouseEvents = (_a = this.options.spec.experimental) == null ? void 0 : _a.mouseEvents; + const clickEnabled = !!mouseEvents || IsMouseEventsDeep(mouseEvents) && !!mouseEvents.click; + const isDrag = Math.sqrt((__privateGet(this, _mouseDownX) - mouseX) ** 2 + (__privateGet(this, _mouseDownY) - mouseY) ** 2) > 1; + if (!__privateGet(this, _isRangeBrushActivated) && !isDrag) { + this.mRangeBrush.clear(); + this.pMouseSelection.clear(); + } else { + this.mRangeBrush.enable(); + } + __privateSet(this, _isRangeBrushActivated, false); + if (!this.tilesetInfo) { + return; + } + if (!isDrag && clickEnabled) { + const genomicPosition = getRelativeGenomicPosition( + Math.floor(this._xScale.invert(mouseX)), + __privateGet(this, _assembly2) + ); + const capturedElements = __privateMethod(this, _getElementsWithinMouse, getElementsWithinMouse_fn).call(this, mouseX, mouseY); + if (capturedElements.length !== 0) { + this.options.siblingIds.forEach( + (id) => publish("click", { + id, + genomicPosition, + data: capturedElements.map((d) => d.value) + }) + ); + } + } + }; + _onMouseOut = new WeakSet(); + onMouseOut_fn = function() { + __privateSet(this, _isRangeBrushActivated, false); + document.body.style.cursor = "default"; + this.pMouseHover.clear(); + }; + _getElementsWithinMouse = new WeakSet(); + getElementsWithinMouse_fn = function(mouseX, mouseY) { + var _a; + const models = this.visibleAndFetchedGoslingModels(); + const mouseEvents = (_a = this.options.spec.experimental) == null ? void 0 : _a.mouseEvents; + const multiHovering = IsMouseEventsDeep(mouseEvents) && mouseEvents.enableMouseOverOnMultipleMarks; + const idField = IsMouseEventsDeep(mouseEvents) && mouseEvents.groupMarksByField; + const mergedCapturedElements = models.map((model) => model.getMouseEventModel().findAll(mouseX, mouseY, true)).flat(); + if (!multiHovering) { + mergedCapturedElements.splice(1, mergedCapturedElements.length - 1); + } + if (mergedCapturedElements.length !== 0 && idField) { + const source = Array.from(mergedCapturedElements); + models.forEach((model) => { + const siblings = model.getMouseEventModel().getSiblings(source, idField); + mergedCapturedElements.push(...siblings); + }); + } + return mergedCapturedElements; + }; + _publishTrackEvents = new WeakSet(); + publishTrackEvents_fn = function(eventType, mouseX, mouseY) { + const [x, y] = this.position; + const [width, height] = this.dimensions; + if (this.options.spec.layout === "circular") { + const cx = x + width / 2; + const cy = y + height / 2; + const innerRadius = this.options.spec.innerRadius; + const outerRadius = this.options.spec.outerRadius; + const startAngle = this.options.spec.startAngle; + const endAngle = this.options.spec.endAngle; + if (isPointInsideDonutSlice( + [mouseX, mouseY], + [width / 2, height / 2], + [innerRadius, outerRadius], + [startAngle, endAngle] + )) { + publish(eventType, { + id: context.viewUid, + spec: this.options.spec, + shape: { x, y, width, height, cx, cy, innerRadius, outerRadius, startAngle, endAngle } + }); + } + } else { + publish(eventType, { + id: context.viewUid, + spec: this.options.spec, + shape: { x, y, width, height } + }); + } + }; + _onRangeBrush = new WeakSet(); + onRangeBrush_fn = function(range, skipApiTrigger = false) { + var _a, _b, _c, _d; + this.pMouseSelection.clear(); + if (range === null) { + if (!skipApiTrigger) { + publish("rangeSelect", { id: context.viewUid, genomicRange: null, data: [] }); + } + return; + } + const models = this.visibleAndFetchedGoslingModels(); + const [startX, endX] = range; + let capturedElements = models.map((model) => model.getMouseEventModel().findAllWithinRange(startX, endX, true)).flat(); + const mouseEvents = (_a = this.options.spec.experimental) == null ? void 0 : _a.mouseEvents; + const idField = IsMouseEventsDeep(mouseEvents) && mouseEvents.groupMarksByField; + if (capturedElements.length !== 0 && idField) { + models.forEach((model) => { + const siblings = model.getMouseEventModel().getSiblings(capturedElements, idField); + const siblingIds = Array.from(new Set(siblings.map((d) => d.value[idField]))); + capturedElements = capturedElements.filter((d) => siblingIds.indexOf(d.value[idField]) === -1); + }); + } + if (capturedElements.length !== 0) { + const g = this.pMouseSelection; + if (((_c = (_b = this.options.spec.style) == null ? void 0 : _b.select) == null ? void 0 : _c.arrange) !== "behind") { + this.pMain.removeChild(g); + this.pMain.addChild(g); + } + __privateMethod(this, _highlightMarks, highlightMarks_fn).call(this, g, capturedElements, Object.assign({}, DEFAULT_MOUSE_EVENT_STYLE, (_d = this.options.spec.style) == null ? void 0 : _d.select)); + } + if (!skipApiTrigger) { + const genomicRange = [ + getRelativeGenomicPosition(Math.floor(this._xScale.invert(startX)), __privateGet(this, _assembly2)), + getRelativeGenomicPosition(Math.floor(this._xScale.invert(endX)), __privateGet(this, _assembly2)) + ]; + publish("rangeSelect", { + id: context.viewUid, + genomicRange, + data: capturedElements.map((d) => d.value) + }); + } + this.forceDraw(); + }; + _highlightMarks = new WeakSet(); + highlightMarks_fn = function(g, marks, style) { + g.lineStyle( + style.strokeWidth, + colorToHex(style.stroke), + style.strokeOpacity, + // alpha + 0.5 + // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) + ); + g.beginFill(colorToHex(style.color), style.color === "none" ? 0 : style.opacity); + marks.forEach((d) => { + if (d.type === "point") { + const [x, y, r = 3] = d.polygon; + g.drawCircle(x, y, r); + } else if (d.type === "line") { + g.moveTo(d.polygon[0], d.polygon[1]); + flatArrayToPairArray(d.polygon).map((d2) => g.lineTo(d2[0], d2[1])); + } else { + g.drawPolygon(d.polygon); + } + }); + }; + _publishOnNewTrack = new WeakSet(); + publishOnNewTrack_fn = function() { + publish("onNewTrack", { + id: context.viewUid + }); + }; + _hasStretchableGraphics = new WeakSet(); + hasStretchableGraphics_fn = function() { + var _a, _b; + const hasStretchOption = (_a = this.options.spec.experimental) == null ? void 0 : _a.stretchGraphics; + if (hasStretchOption === true) { + return true; + } else if (hasStretchOption === false) { + return false; + } + const isFirstTrack1D = !Is2DTrack(this.getResolvedTracks()[0]); + const isNotCircularLayout = this.options.spec.layout !== "circular"; + const stretchableMarks = ["bar", "line", "rect", "area"]; + const hasStretchableMark = this.getResolvedTracks().reduce( + (acc, spec) => acc && stretchableMarks.includes(spec.mark), + true + ); + const noMouseInteractions = !((_b = this.options.spec.experimental) == null ? void 0 : _b.mouseEvents); + return isFirstTrack1D && isNotCircularLayout && hasStretchableMark && noMouseInteractions; + }; + _isTooStretched = new WeakSet(); + isTooStretched_fn = function(stretchFactor) { + var _a, _b; + const defaultThreshold = 1.5; + const threshold = (_b = (_a = this.options.spec.experimental) == null ? void 0 : _a.stretchGraphicsThreshold) != null ? _b : defaultThreshold; + return stretchFactor > threshold || stretchFactor < 1 / threshold; + }; + /** + * Convert tile positions to tile IDs + */ + __privateAdd(_GoslingTrackClass, _tilesToId); + let GoslingTrackClass = _GoslingTrackClass; + return new GoslingTrackClass(); +}; +const GoslingTrack = createPluginTrack(config$1, factory$1); +const config = { + type: "dummy-track", + defaultOptions: { + height: 0, + // default height gets set in when spec is preprocessed + width: 0, + // default width gets set in when spec is preprocessed + title: "", + background: "#fff", + textFontSize: 12, + textFontWeight: "normal", + textStroke: "#000", + textStrokeWidth: 0.1, + outline: "#fff" + } +}; +const factory = (HGC, context, options) => { + var _drawBackground, drawBackground_fn, _drawText, drawText_fn; + const { SVGTrack } = HGC.tracks; + class DummyTrackClass extends SVGTrack { + constructor() { + super(context, options); + __privateAdd(this, _drawBackground); + /** + * Draws the title of the dummy track + */ + __privateAdd(this, _drawText); + __privateMethod(this, _drawBackground, drawBackground_fn).call(this); + __privateMethod(this, _drawText, drawText_fn).call(this); + publish("onNewTrack", { + id: context.viewUid + }); + } + } + _drawBackground = new WeakSet(); + drawBackground_fn = function() { + this.gMain.append("rect").attr("fill", options.background).attr("x", 0).attr("y", 0).attr("width", options.width).attr("height", options.height).style("stroke", options.outline); + }; + _drawText = new WeakSet(); + drawText_fn = function() { + this.gMain.append("text").attr("x", options.width / 2).attr("y", (options.height + options.textFontSize) / 2).style("text-anchor", "middle").style("font-size", `${options.textFontSize}px`).style("font-weight", options.textFontWeight).style("stroke", options.textStroke).style("stroke-width", options.textStrokeWidth).text(options.title); + }; + return new DummyTrackClass(); +}; +const DummyTrack = createPluginTrack(config, factory); +let once = false; +function init() { + if (once) + return; + higlassRegister({ + name: "GoslingTrack", + track: GoslingTrack, + config: GoslingTrack.config + }); + higlassRegister({ + name: "Gosling2DTrack", + track: GoslingTrack, + config: { + ...GoslingTrack.config, + type: "gosling-2d-track", + orientation: "2d" + } + }); + higlassRegister({ + name: "AxisTrack", + track: AxisTrack, + config: AxisTrack.config + }); + higlassRegister({ + name: "TextTrack", + track: TextTrack, + config: TextTrack.config + }); + higlassRegister({ + name: "BrushTrack", + track: BrushTrack, + config: BrushTrack.config + }); + higlassRegister({ + name: "DummyTrack", + track: DummyTrack, + config: DummyTrack.config + }); + for (const dataFetcher of Object.values(dataFetchers)) { + const { config: config2 } = dataFetcher; + higlassRegister({ dataFetcher, config: config2 }, { pluginType: "dataFetcher" }); + } + once = true; +} +function getBoundingBox(trackInfos) { + let width = 0; + let height = 0; + trackInfos.forEach((_) => { + const w = _.boundingBox.x + _.boundingBox.width; + const h = _.boundingBox.y + _.boundingBox.height; + if (height < h) { + height = h; + } + if (width < w) { + width = w; + } + }); + return { width, height }; +} +function getRelativeTrackInfo(spec, theme) { + var _a, _b; + let trackInfos = []; + traverseAndCollectTrackInfo(spec, trackInfos); + const size = getBoundingBox(trackInfos); + if (spec.title || spec.subtitle) { + const titleHeight = (spec.title ? ((_a = theme.root.titleFontSize) != null ? _a : 18) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM : 0) + (spec.subtitle ? ((_b = theme.root.subtitleFontSize) != null ? _b : 14) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM : 0); + const marginBottom = 4; + size.height += titleHeight + marginBottom; + size.height = size.height + (8 - size.height % 8); + trackInfos.forEach((_) => { + _.boundingBox.y += titleHeight + marginBottom; + }); + trackInfos = [ + { + track: getTextTrack({ width: size.width, height: titleHeight }, spec.title, spec.subtitle), + boundingBox: { x: 0, y: 0, width: size.width, height: titleHeight }, + layout: { x: 0, y: 0, w: 12, h: titleHeight / size.height * 12 } + }, + ...trackInfos + ]; + } else { + size.height = size.height + (8 - size.height % 8); + } + const pixelPreciseMarginPadding = !(typeof spec.responsiveSize !== "object" ? spec.responsiveSize : spec.responsiveSize.height); + trackInfos.forEach((_) => { + _.layout.x = _.boundingBox.x / size.width * 12; + _.layout.w = _.boundingBox.width / size.width * 12; + _.layout.y = pixelPreciseMarginPadding ? _.boundingBox.y : _.boundingBox.y / size.height * 12; + _.layout.h = pixelPreciseMarginPadding ? _.boundingBox.height : _.boundingBox.height / size.height * 12; + }); + return { trackInfos, size }; +} +function traverseAndCollectTrackInfo(spec, output, dx = 0, dy = 0, circularRootNotFound = true) { + let cumWidth = 0; + let cumHeight = 0; + let allChildCircularLayout = true; + let traversedAtLeastOnce = false; + traverseTracksAndViews(spec, (tv) => { + traversedAtLeastOnce = true; + if (tv.layout !== "circular") { + allChildCircularLayout = false; + } + }); + let noChildConcatArrangement = true; + traverseViewArrangements(spec, (a) => { + if (a.arrangement === "vertical" || a.arrangement === "horizontal") { + noChildConcatArrangement = false; + } + }); + const isThisCircularRoot = circularRootNotFound && allChildCircularLayout && traversedAtLeastOnce && noChildConcatArrangement && ("views" in spec && (spec.arrangement === "parallel" || spec.arrangement === "serial") || "tracks" in spec); + const numTracksBeforeInsert = output.length; + if ("tracks" in spec) { + const tracks = spec.tracks; + if (spec.orientation === "vertical") { + cumHeight = Math.max(...tracks.map((d) => d.height)); + tracks.forEach((track, i, array) => { + if (getNumOfXAxes([track]) === 1) { + track.width += HIGLASS_AXIS_SIZE; + } + track.height = cumHeight; + output.push({ + track, + boundingBox: { + x: dx + cumWidth, + y: dy, + width: track.width, + height: cumHeight + }, + layout: { x: 0, y: 0, w: 0, h: 0 } + // Just put a dummy info here, this should be added after entire bounding box has been determined + }); + if (array[i + 1] && array[i + 1].overlayOnPreviousTrack) + ; + else { + cumWidth += track.width; + if (i !== array.length - 1) { + cumWidth += spec.spacing !== void 0 ? spec.spacing : 0; + } + } + }); + } else { + cumWidth = Math.max(...tracks.map((d) => d.width)); + tracks.forEach((track, i, array) => { + if (getNumOfXAxes([track]) === 1) { + track.height += HIGLASS_AXIS_SIZE; + } + const singleTrack = resolveSuperposedTracks(track); + if (singleTrack.length > 0 && Is2DTrack(singleTrack[0]) && getNumOfYAxes([track]) === 1) { + cumWidth += HIGLASS_AXIS_SIZE; + } + track.width = cumWidth; + output.push({ + track, + boundingBox: { + x: dx, + y: dy + cumHeight, + width: cumWidth, + height: track.height + }, + layout: { x: 0, y: 0, w: 0, h: 0 } + // Just put a dummy info here, this should be added after entire bounding box has been determined + }); + if (array[i + 1] && array[i + 1].overlayOnPreviousTrack) + ; + else { + cumHeight += track.height; + if (i !== array.length - 1) { + cumHeight += spec.spacing !== void 0 ? spec.spacing : 0; + } + } + }); + } + } else { + if (spec.arrangement === "parallel" || spec.arrangement === "vertical") { + const spacing = spec.spacing !== void 0 ? spec.spacing : DEFAULT_VIEW_SPACING; + spec.views.forEach((v, i, array) => { + var _a, _b, _c, _d, _e; + const viewBB = traverseAndCollectTrackInfo( + v, + output, + dx + ((_a = v.xOffset) != null ? _a : 0), + dy + ((_b = v.yOffset) != null ? _b : 0) + cumHeight, + !isThisCircularRoot && circularRootNotFound + ); + if (cumWidth < ((_c = v.xOffset) != null ? _c : 0) + viewBB.width) { + cumWidth = ((_d = v.xOffset) != null ? _d : 0) + viewBB.width; + } + if (i !== array.length - 1) { + cumHeight += spacing; + } + cumHeight += ((_e = v.yOffset) != null ? _e : 0) + viewBB.height; + }); + } else if (spec.arrangement === "serial" || spec.arrangement === "horizontal") { + spec.views.forEach((v, i, array) => { + var _a, _b, _c, _d, _e; + const spacing = spec.spacing !== void 0 ? spec.spacing : DEFAULT_VIEW_SPACING; + const viewBB = traverseAndCollectTrackInfo( + v, + output, + dx + ((_a = v.xOffset) != null ? _a : 0) + cumWidth, + dy + ((_b = v.yOffset) != null ? _b : 0), + !isThisCircularRoot && circularRootNotFound + ); + if (cumHeight < ((_c = v.xOffset) != null ? _c : 0) + viewBB.height) { + cumHeight = ((_d = v.xOffset) != null ? _d : 0) + viewBB.height; + } + if (i !== array.length - 1) { + cumWidth += spacing; + } + cumWidth += ((_e = v.xOffset) != null ? _e : 0) + viewBB.width; + }); + } + } + if (isThisCircularRoot) { + const cTracks = output.slice(numTracksBeforeInsert); + const ifMultipleViews = "views" in spec && (spec.arrangement === "parallel" || spec.arrangement === "serial") && spec.views.length > 1; + const SPACING = spec.spacing !== void 0 ? spec.spacing : DEFAULT_VIEW_SPACING; + const PADDING = DEFAULT_CIRCULAR_VIEW_PADDING; + const INNER_RADIUS = spec.centerRadius !== void 0 ? spec.centerRadius : DEFAULT_INNER_RADIUS_PROP; + const TOTAL_RADIUS = cumWidth / 2 + PADDING; + const TOTAL_RING_SIZE = TOTAL_RADIUS * (1 - INNER_RADIUS); + cTracks.forEach((t, i) => { + var _a, _b; + if (IsDummyTrack(t.track)) { + return; + } + t.track.layout = "circular"; + t.track.outerRadius = TOTAL_RADIUS - PADDING - (t.boundingBox.y - dy) / cumHeight * TOTAL_RING_SIZE; + t.track.innerRadius = TOTAL_RADIUS - PADDING - (t.boundingBox.y + t.boundingBox.height - dy) / cumHeight * TOTAL_RING_SIZE; + const spacingAngle = SPACING / cumWidth * 360; + t.track.startAngle = spacingAngle + (t.boundingBox.x - dx) / cumWidth * (cumWidth - SPACING) / cumWidth * 360; + t.track.endAngle = (t.boundingBox.x + t.boundingBox.width - dx) / cumWidth * (cumWidth - SPACING) / cumWidth * 360; + t.boundingBox.x = dx + ((_a = t.track.xOffset) != null ? _a : 0); + t.boundingBox.y = dy + ((_b = t.track.yOffset) != null ? _b : 0); + t.boundingBox.height = t.track.height = t.boundingBox.width = t.track.width = TOTAL_RADIUS * 2; + if (i !== 0) { + t.track.overlayOnPreviousTrack = true; + } + if (ifMultipleViews) { + if (IsOverlaidTrack(t.track)) { + t.track._overlay = t.track._overlay.filter((o) => o.mark !== "brush"); + } + } + }); + cumHeight = TOTAL_RADIUS * 2; + } + spec._assignedWidth = cumWidth; + spec._assignedHeight = cumHeight; + return { x: dx, y: dy, width: cumWidth, height: cumHeight }; +} +function getNumOfXAxes(tracks) { + return tracks.filter((t) => IsXAxis(t)).length; +} +function getNumOfYAxes(tracks) { + return tracks.filter((t) => IsYAxis(t)).length; +} +const getTextTrack = (size, title, subtitle) => { + return JSON.parse( + JSON.stringify({ + mark: "header", + width: size.width, + height: size.height, + title, + subtitle + }) + ); +}; +function parseServerAndTilesetUidFromUrl(url) { + if (!url.includes("tileset_info/?d=") || !url.includes("https:") && !url.includes("http:")) { + return { server: void 0, tilesetUid: void 0 }; + } + const server = url.split("tileset_info/?d=")[0]; + const tilesetUid = url.split("tileset_info/?d=")[1]; + return { server, tilesetUid }; +} +function goslingToHiGlass(hgModel, gosTrack, bb, layout, theme, idMapper, urlToFetchOptions) { + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o; + if (IsDummyTrack(gosTrack)) { + hgModel.addDefaultView(gosTrack.id).setDummyTrack(gosTrack).setLayout(layout); + return hgModel; + } + const resolvedSpecs = resolveSuperposedTracks(gosTrack); + const firstResolvedSpec = resolvedSpecs[0]; + const trackId = (_a = firstResolvedSpec.id) != null ? _a : uuid(); + if (!firstResolvedSpec.id) { + firstResolvedSpec.id = trackId; + } + resolvedSpecs.forEach((spec) => { + if (spec.id) { + idMapper.addMapping(spec.id, trackId); + } + }); + const assembly = firstResolvedSpec.assembly; + if (IsDataDeep(firstResolvedSpec.data)) { + let server, tilesetUid; + if (IsDataDeepTileset(firstResolvedSpec.data)) { + const parsed = parseServerAndTilesetUidFromUrl(firstResolvedSpec.data.url); + server = parsed.server; + tilesetUid = parsed.tilesetUid; + } + const genomicChannel = getGenomicChannelFromTrack(firstResolvedSpec); + const genomicChannelKey = getGenomicChannelKeyFromTrack(firstResolvedSpec); + const isXGenomic = genomicChannelKey === "x" || genomicChannelKey === "xe"; + const xDomain = isXGenomic && IsChannelDeep(genomicChannel) ? genomicChannel.domain : void 0; + const yDomain = Is2DTrack(firstResolvedSpec) && IsChannelDeep(firstResolvedSpec.y) ? firstResolvedSpec.y.domain : void 0; + const width = bb.width - (firstResolvedSpec.layout !== "circular" && firstResolvedSpec.orientation === "vertical" && IsXAxis(firstResolvedSpec) ? HIGLASS_AXIS_SIZE : 0); + const height = bb.height - (firstResolvedSpec.layout !== "circular" && firstResolvedSpec.orientation === "horizontal" && IsXAxis(firstResolvedSpec) ? HIGLASS_AXIS_SIZE : 0); + const hgTrack = { + uid: `${trackId}-track`, + // This is being used to cache the visualization + type: Is2DTrack(firstResolvedSpec) ? "gosling-2d-track" : "gosling-track", + server, + tilesetUid, + width, + height, + options: { + id: trackId, + siblingIds: idMapper.getSiblingGoslingIds(trackId), + /* Mouse hover position */ + showMousePosition: firstResolvedSpec.layout === "circular" ? false : theme.root.showMousePosition, + // show mouse position only for linear tracks // TODO: or vertical + mousePositionColor: theme.root.mousePositionColor, + /* Track title */ + name: firstResolvedSpec.layout === "linear" ? firstResolvedSpec.title : " ", + labelPosition: firstResolvedSpec.title ? theme.track.titleAlign === "left" ? "topLeft" : "topRight" : "none", + labelShowResolution: false, + labelColor: theme.track.titleColor, + labelBackgroundColor: theme.track.titleBackground, + labelBackgroundOpacity: 0.5, + // TODO: Support `theme.track.titleBackgroundOpacity` + labelTextOpacity: 1, + labelLeftMargin: 1, + labelTopMargin: 1, + labelRightMargin: 0, + labelBottomMargin: 0, + // TODO: Use this eventually + // trackBorderWidth: firstResolvedSpec.style?.outlineWidth ?? 3, + // trackBorderColor: firstResolvedSpec.style?.outline ?? '#DBDBDB', + /* Others */ + backgroundColor: "transparent", + // in this way, we can superpose multiple tracks + spec: { ...gosTrack }, + theme + } + }; + if (firstResolvedSpec.data && IsDataDeep(firstResolvedSpec.data) && (firstResolvedSpec.data.type === "csv" || firstResolvedSpec.data.type === "json" || firstResolvedSpec.data.type === "bigwig" || firstResolvedSpec.data.type === "bam" || firstResolvedSpec.data.type === "vcf" || firstResolvedSpec.data.type === "gff" || firstResolvedSpec.data.type === "bed" || // TODO: This is a hack to enable custom data fetchers + firstResolvedSpec.data.useCustomDataFetcher)) { + const getFieldName = (c) => { + const cDef = firstResolvedSpec[c]; + return cDef && IsChannelDeep(cDef) ? cDef.field : void 0; + }; + const xFields = { + x: getFieldName("x"), + xe: getFieldName("xe"), + x1: getFieldName("x1"), + x1e: getFieldName("x1e") + }; + const urlFetchOptions = "url" in firstResolvedSpec.data && (urlToFetchOptions == null ? void 0 : urlToFetchOptions[firstResolvedSpec.data.url]) || {}; + const indexUrlFetchOptions = "indexUrl" in firstResolvedSpec.data && (urlToFetchOptions == null ? void 0 : urlToFetchOptions[firstResolvedSpec.data.indexUrl]) || {}; + hgTrack.data = { + ...firstResolvedSpec.data, + ...xFields, + urlFetchOptions, + indexUrlFetchOptions, + // Additionally, add assembly, otherwise, a default genome build is used + assembly + // TODO: should look all sub tracks' `dataTransform` and apply OR operation. + // Add a data transformation spec so that the fetcher can properly sample datasets + // filter: (firstResolvedSpec as any).dataTransform?.filter((f: DataTransform) => f.type === 'filter') + }; + } + if (IsHiGlassMatrix(firstResolvedSpec)) { + hgTrack.type = "heatmap"; + const colorStr = IsChannelDeep(firstResolvedSpec.color) && typeof firstResolvedSpec.color.range === "string" ? firstResolvedSpec.color.range : "viridis"; + hgTrack.options.colorRange = getHiGlassColorRange(colorStr); + hgTrack.options.trackBorderWidth = (_c = (_b = firstResolvedSpec.style) == null ? void 0 : _b.outlineWidth) != null ? _c : theme.track.outlineWidth; + hgTrack.options.trackBorderColor = (_e = (_d = firstResolvedSpec.style) == null ? void 0 : _d.outline) != null ? _e : theme.track.outline; + hgTrack.options.extent = (_g = (_f = firstResolvedSpec.style) == null ? void 0 : _f.matrixExtent) != null ? _g : "full"; + hgTrack.options.colorbarPosition = ((_h = firstResolvedSpec.color) == null ? void 0 : _h.legend) ? hgTrack.options.extent === "lower-left" ? "bottomLeft" : "topRight" : "hidden"; + } + if (firstResolvedSpec.overlayOnPreviousTrack) { + hgModel.setViewOrientation(firstResolvedSpec.orientation).addTrackToCombined(hgTrack); + } else { + hgModel.setViewOrientation(firstResolvedSpec.orientation).setAssembly(assembly).addDefaultView(trackId, assembly).setDomain(xDomain, yDomain != null ? yDomain : xDomain).adjustDomain(firstResolvedSpec.orientation, width, height).setMainTrack(hgTrack).addTrackSourceServers(server).setZoomFixed(firstResolvedSpec.static === true).setZoomLimits((_i = firstResolvedSpec.zoomLimits) != null ? _i : [1, null]).setLayout(layout); + } + const getAxisNarrowType = (c, orientation = "horizontal", width2, height2) => { + const narrowSizeThreshold = 400; + const narrowerSizeThreshold = 200; + if (orientation === "horizontal") { + if (c === "x" && width2 <= narrowerSizeThreshold || c === "y" && height2 <= narrowerSizeThreshold) { + return "narrower"; + } else if (c === "x" && width2 <= narrowSizeThreshold || c === "y" && height2 <= narrowSizeThreshold) { + return "narrow"; + } else { + return "regular"; + } + } else { + if (c === "x" && height2 <= narrowerSizeThreshold || c === "y" && width2 <= narrowerSizeThreshold) { + return "narrower"; + } else if (c === "x" && height2 <= narrowSizeThreshold || c === "y" && width2 <= narrowSizeThreshold) { + return "narrow"; + } else { + return "regular"; + } + } + }; + ["x", "y"].forEach((c) => { + const channel = firstResolvedSpec[c]; + if (IsChannelDeep(channel) && "axis" in channel && channel.axis && channel.axis !== "none" && channel.type === "genomic") { + const narrowType = getAxisNarrowType(c, gosTrack.orientation, bb.width, bb.height); + hgModel.setAxisTrack(channel.axis, narrowType, { + id: `${trackId}-${channel.axis}-axis`, + layout: firstResolvedSpec.layout, + innerRadius: channel.axis === "top" ? firstResolvedSpec.outerRadius - HIGLASS_AXIS_SIZE : firstResolvedSpec.innerRadius, + outerRadius: channel.axis === "top" ? firstResolvedSpec.outerRadius : firstResolvedSpec.innerRadius + HIGLASS_AXIS_SIZE, + width: firstResolvedSpec.width, + height: firstResolvedSpec.height, + startAngle: firstResolvedSpec.startAngle, + endAngle: firstResolvedSpec.endAngle, + theme + }); + } + }); + hgModel.validateSpec(true); + } else if (firstResolvedSpec.mark === "header") { + hgModel.addDefaultView(`${trackId}-title`).setLayout(layout); + if (typeof firstResolvedSpec.title === "string") { + hgModel.setTextTrack( + bb.width, + ((_j = theme.root.titleFontSize) != null ? _j : 18) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM, + firstResolvedSpec.title, + theme.root.titleColor, + (_k = theme.root.titleFontSize) != null ? _k : 18, + theme.root.titleFontWeight, + theme.root.titleAlign, + theme.root.titleBackgroundColor, + (_l = theme.root.titleFontFamily) != null ? _l : DEFAULT_TEXT_STYLE.fontFamily + ); + } + if (typeof firstResolvedSpec.subtitle === "string") { + hgModel.setTextTrack( + bb.width, + // TODO: better way to safely get the value when undefined? + ((_m = theme.root.subtitleFontSize) != null ? _m : 14) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM, + firstResolvedSpec.subtitle, + theme.root.subtitleColor, + (_n = theme.root.subtitleFontSize) != null ? _n : 14, + theme.root.subtitleFontWeight, + theme.root.subtitleAlign, + theme.root.subtitleBackgroundColor, + (_o = theme.root.subtitleFontFamily) != null ? _o : DEFAULT_TEXT_STYLE.fontFamily + ); + } + } + return hgModel; +} +function getLinkingInfo(hgModel) { + const linkingInfo = []; + hgModel.spec().views.forEach((v) => { + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o; + const hgViewId = v.uid; + let spec = ( + /* TODO: */ + (_e = (_d = (_c = (_b = (_a = v.tracks.center) == null ? void 0 : _a[0]) == null ? void 0 : _b.contents) == null ? void 0 : _c[0]) == null ? void 0 : _d.options) == null ? void 0 : _e.spec + ); + if (!spec) { + spec = /* TODO: */ + (_j = (_i = (_h = (_g = (_f = v.tracks.left) == null ? void 0 : _f[0]) == null ? void 0 : _g.contents) == null ? void 0 : _h[0]) == null ? void 0 : _i.options) == null ? void 0 : _j.spec; + if (!spec) { + spec = /* TODO: */ + (_o = (_n = (_m = (_l = (_k = v.tracks.left) == null ? void 0 : _k[1]) == null ? void 0 : _l.contents) == null ? void 0 : _m[0]) == null ? void 0 : _n.options) == null ? void 0 : _o.spec; + } + } + if (!hgViewId || !spec) + return; + const resolved = resolveSuperposedTracks(spec); + resolved.forEach((spec2) => { + SUPPORTED_CHANNELS.forEach((cKey) => { + var _a2, _b2, _c2, _d2; + const channel = spec2[cKey]; + if (IsChannelDeep(channel) && "linkingId" in channel && channel.linkingId) { + linkingInfo.push({ + layout: spec2.layout === "circular" ? "circular" : "linear", + hgViewId, + linkId: channel.linkingId, + isBrush: spec2.mark === "brush", + style: { + color: (_a2 = spec2.color) == null ? void 0 : _a2.value, + stroke: (_b2 = spec2.stroke) == null ? void 0 : _b2.value, + strokeWidth: (_c2 = spec2.strokeWidth) == null ? void 0 : _c2.value, + opacity: (_d2 = spec2.opacity) == null ? void 0 : _d2.value, + startAngle: spec2.startAngle, + endAngle: spec2.endAngle, + innerRadius: spec2.innerRadius, + outerRadius: spec2.outerRadius + } + }); + return; + } + }); + }); + }); + return linkingInfo; +} +class GoslingToHiGlassIdMapper { + constructor() { + /** A mapping table between Gosling track IDs to HiGlass view IDs */ + __privateAdd(this, _table, {}); + } + addMapping(gtId, hvId) { + if (__privateGet(this, _table)[gtId] && __privateGet(this, _table)[gtId] !== hvId) { + console.warn(`The track ID ${gtId} already exists but overwriting with a different ID.`); + } + __privateGet(this, _table)[gtId] = hvId; + } + getTable() { + return __privateGet(this, _table); + } + getGoslingIds() { + return Object.keys(__privateGet(this, _table)); + } + getHiGlassId(gtId) { + return __privateGet(this, _table)[gtId]; + } + /** + * Get IDs of Gosling tracks that became the same HiGlass view. + * @param HiGlassId + * @returns + */ + getSiblingGoslingIds(HiGlassId) { + return Object.entries(__privateGet(this, _table)).filter(([, hvId]) => hvId === HiGlassId).map(([gtId]) => gtId); + } +} +_table = new WeakMap(); +function getViewIds(spec) { + const viewIds = /* @__PURE__ */ new Set(); + if (spec.id) { + viewIds.add(spec.id); + } + traverseTracksAndViews(spec, (subSpec) => { + if ("views" in subSpec || "tracks" in subSpec) { + if (subSpec.id) { + viewIds.add(subSpec.id); + } + } + }); + return Array.from(viewIds); +} +function getTrackIds(spec) { + const trackIds = /* @__PURE__ */ new Set(); + traverseTracksAndViews(spec, (subSpec) => { + if (!("views" in subSpec) && !("tracks" in subSpec)) { + if (subSpec.id) { + trackIds.add(subSpec.id); + } + } + }); + return Array.from(trackIds); +} +function getInternalSpecById(spec, id) { + let internalSpec; + if (spec.id === id) { + internalSpec = spec; + } + traverseTracksAndViews(spec, (subSpec) => { + if (subSpec.id === id) { + internalSpec = subSpec; + } + }); + return internalSpec; +} +function getViewApiData(spec, tracks) { + return getViewIds(spec).map((viewId) => { + const internalSpec = getInternalSpecById(spec, viewId); + const trackIds = getTrackIds(internalSpec); + const bb = { + x: Number.MAX_SAFE_INTEGER, + y: Number.MAX_SAFE_INTEGER, + xe: -Number.MAX_SAFE_INTEGER, + ye: -Number.MAX_SAFE_INTEGER + }; + trackIds.map((trackId) => tracks.find((t) => t.id === trackId)).forEach((track) => { + if (!track) + return; + const { shape } = track; + if (bb.x > shape.x) { + bb.x = shape.x; + } + if (bb.y > shape.y) { + bb.y = shape.y; + } + if (bb.xe < shape.x + shape.width) { + bb.xe = shape.x + shape.width; + } + if (bb.ye < shape.y + shape.height) { + bb.ye = shape.y + shape.height; + } + }); + return { + id: viewId, + spec: internalSpec, + shape: { ...bb, width: bb.xe - bb.x, height: bb.ye - bb.y } + }; + }); +} +function renderHiGlass(spec, trackInfos, callback, theme, urlToFetchOptions) { + if (trackInfos.length === 0) { + return; + } + const hgModel = new HiGlassModel(); + const idMapper = new GoslingToHiGlassIdMapper(); + trackInfos.forEach((tb) => { + const { track, boundingBox: bb, layout } = tb; + goslingToHiGlass(hgModel, track, bb, layout, theme, idMapper, urlToFetchOptions); + }); + const linkingInfos = getLinkingInfo(hgModel); + linkingInfos.filter((d) => d.isBrush).forEach((info) => { + var _a; + hgModel.addBrush( + info.layout, + info.hgViewId, + theme, + (_a = linkingInfos.find((d) => !d.isBrush && d.linkId === info.linkId)) == null ? void 0 : _a.hgViewId, + info.style + ); + }); + linkingInfos.filter((d) => !d.isBrush).forEach((d) => { + hgModel.spec().zoomLocks.locksByViewUid[d.hgViewId] = d.linkId; + hgModel.spec().locationLocks.locksByViewUid[d.hgViewId] = d.linkId; + }); + const uniqueLinkIds = Array.from(new Set(linkingInfos.map((d) => d.linkId))); + uniqueLinkIds.forEach((linkId) => { + hgModel.spec().zoomLocks.locksDict[linkId] = { uid: linkId }; + hgModel.spec().locationLocks.locksDict[linkId] = { uid: linkId }; + linkingInfos.filter((d) => !d.isBrush).filter((d) => d.linkId === linkId).forEach((d) => { + hgModel.spec().zoomLocks.locksDict[linkId][d.hgViewId] = [1246253105e-1, 1246253105e-1, 249250.621]; + hgModel.spec().locationLocks.locksDict[linkId][d.hgViewId] = [1246253105e-1, 1246253105e-1, 249250.621]; + }); + }); + const tracks = trackInfos.map((d) => { + return { + id: d.track.id, + spec: d.track, + shape: d.track.layout === "linear" || IsDummyTrack(d.track) ? d.boundingBox : { + ...d.boundingBox, + cx: d.boundingBox.x + d.boundingBox.width / 2, + cy: d.boundingBox.y + d.boundingBox.height / 2, + innerRadius: d.track.innerRadius, + outerRadius: d.track.outerRadius, + startAngle: d.track.startAngle, + endAngle: d.track.endAngle + } + }; + }); + const views = getViewApiData(spec, tracks); + const tracksAndViews = [ + ...tracks.map((d) => ({ ...d, type: "track" })), + ...views.map((d) => ({ ...d, type: "view" })) + ]; + callback(hgModel.spec(), getBoundingBox(trackInfos), spec, tracksAndViews, idMapper.getTable()); +} +function manageResponsiveSpecs(spec, wFactor, hFactor, parentWidth, parentHeight) { + if (typeof spec._assignedWidth === "undefined" || typeof spec._assignedHeight === "undefined") { + console.warn("Responsive spec cannot be used when width and height of a view is not determined yet."); + return false; + } + let replaced = false; + const { responsiveSpec } = spec; + const width = spec._assignedWidth * wFactor; + const height = spec._assignedHeight * hFactor; + const dimensions = { width, height, aspectRatio: width / height }; + const parentDimensions = { width: parentWidth, height: parentHeight, aspectRatio: parentWidth / parentHeight }; + if (responsiveSpec) { + responsiveSpec.forEach((specAndCondition) => { + const { spec: alternativeSpec, selectivity } = specAndCondition; + if (isSelectResponsiveSpec(selectivity, dimensions, parentDimensions) && !replaced) { + Object.keys(alternativeSpec).forEach((k) => { + spec[k] = alternativeSpec[k]; + }); + delete spec.responsiveSpec; + replaced = true; + return; + } + }); + } + if ("views" in spec) { + spec.views.forEach((view) => { + replaced = manageResponsiveSpecs(view, wFactor, hFactor, parentWidth, parentHeight) || replaced; + }); + } + return replaced; +} +function isSelectResponsiveSpec(conditions, assignedDimensions, parentDimensions) { + if (conditions.length === 0) + return false; + let isSelect = true; + conditions.forEach((condition) => { + const { measure, operation, threshold, target } = condition; + isSelect = isSelect && logicalComparison( + (target === "container" ? parentDimensions : assignedDimensions)[measure], + operation, + threshold + ) === 1; + }); + return isSelect; +} +function compile(spec, callback, templates, theme, containerStatus, urlToFetchOptions) { + var _a, _b; + const specCopy = JSON.parse(JSON.stringify(spec)); + overrideDataTemplates(specCopy); + replaceTrackTemplates(specCopy, templates); + traverseToFixSpecDownstream(specCopy); + const trackInfosAndSize = getRelativeTrackInfo(specCopy, theme); + let { trackInfos } = trackInfosAndSize; + const { size } = trackInfosAndSize; + const isResponsiveWidth = typeof spec.responsiveSize === "object" && ((_a = spec.responsiveSize) == null ? void 0 : _a.width) || spec.responsiveSize; + const isResponsiveHeight = typeof spec.responsiveSize === "object" && ((_b = spec.responsiveSize) == null ? void 0 : _b.height) || spec.responsiveSize; + const wFactor = isResponsiveWidth && containerStatus.containerSize ? containerStatus.containerSize.width / size.width : 1; + const hFactor = isResponsiveHeight && containerStatus.containerSize ? containerStatus.containerSize.height / size.height : 1; + const pWidth = containerStatus.containerParentSize ? containerStatus.containerParentSize.width : Number.MAX_SAFE_INTEGER; + const pHeight = containerStatus.containerParentSize ? containerStatus.containerParentSize.height : Number.MAX_SAFE_INTEGER; + const replaced = manageResponsiveSpecs(specCopy, wFactor, hFactor, pWidth, pHeight); + if (replaced) { + traverseToFixSpecDownstream(specCopy); + trackInfos = getRelativeTrackInfo(specCopy, theme).trackInfos; + } + publish("specProcessed", { + id: specCopy.id, + spec: specCopy + }); + renderHiGlass(specCopy, trackInfos, callback, theme, urlToFetchOptions); +} +init(); +const HiGlassComponentWrapper = forwardRef( + (props, ref) => { + var _a; + const [wrapperDivId, setWrapperDivId] = useState((_a = props.id) != null ? _a : uuid()); + useEffect(() => { + var _a2; + setWrapperDivId((_a2 = props.id) != null ? _a2 : uuid()); + }, [props.id]); + const viewConfig = props.viewConfig || {}; + const pixelPreciseMarginPadding = false; + const higlassComponent = useMemo( + () => /* @__PURE__ */ React.createElement( + HiGlassComponent, + { + ref, + options: { + // This uses `rowHeight: 1` in react-grid-layout, allowing to set height precisely. + // Since using this disallows responsive resizing of track heights in HiGlass, + // we need to use this only when users do not want to use responsive height. + // (See https://github.com/higlass/higlass/blob/2a3786e13c2415a52abc1227f75512f128e784a0/app/scripts/HiGlassComponent.js#L2199) + pixelPreciseMarginPadding, + containerPaddingX: 0, + containerPaddingY: 0, + viewMarginTop: 0, + viewMarginBottom: 0, + viewMarginLeft: 0, + viewMarginRight: 0, + viewPaddingTop: 0, + viewPaddingBottom: 0, + viewPaddingLeft: 0, + viewPaddingRight: 0, + sizeMode: "bounded", + rangeSelectionOnAlt: true + // this allows switching between `selection` and `zoom&pan` mode + }, + viewConfig + } + ), + [viewConfig, pixelPreciseMarginPadding] + ); + const { + padding = 60, + margin = 0, + border = "none", + background, + alt = "Gosling visualization" + } = props.options || {}; + return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement( + "div", + { + id: wrapperDivId, + className: `gosling-component ${props.className || ""}`, + style: { + position: "relative", + padding, + margin, + border, + background, + width: props.options.responsiveWidth ? `calc(100% - ${padding * 2}px)` : props.size.width, + height: props.options.responsiveHeight ? `calc(100% - ${padding * 2}px)` : props.size.height, + textAlign: "left" + }, + "aria-label": alt, + role: "graphics-document", + "aria-roledescription": "visualization" + }, + /* @__PURE__ */ React.createElement( + "div", + { + key: JSON.stringify(viewConfig), + id: "higlass-wrapper", + className: "higlass-wrapper", + style: { + position: "relative", + display: "block", + background, + margin: 0, + padding: 0, + // non-zero padding acts unexpectedly w/ HiGlassComponent + width: props.options.responsiveWidth ? "100%" : props.size.width, + height: props.options.responsiveHeight ? "100%" : props.size.height + } + }, + higlassComponent + ) + )); + } +); +HiGlassComponentWrapper.displayName = "HiGlassComponentWrapper"; +function createApi(hg, hgSpec, tracksAndViews, theme, idTable) { + const idTableCopy = structuredClone(idTable); + const getHgViewId = (trackId) => { + const viewId = idTableCopy[trackId]; + if (!viewId) { + console.warn(`Unable to find the track ID, named ${trackId}.`); + } + return viewId != null ? viewId : trackId; + }; + const getTrackIds2 = () => { + return Object.keys(idTableCopy); + }; + const getTracksAndViews = () => { + return [...tracksAndViews]; + }; + const getTracks = () => { + return [...getTracksAndViews().filter((d) => d.type === "track")]; + }; + const getTrack = (trackId) => { + const trackInfoFound = getTracks().find((d) => d.id === trackId); + if (!trackInfoFound) { + console.warn(`[getTrack()] Unable to find a track using the ID (${trackId})`); + } + return trackInfoFound; + }; + const getViews = () => { + return [...getTracksAndViews().filter((d) => d.type === "view")]; + }; + const getView = (viewId) => { + const view = getViews().find((d) => d.id === viewId); + if (!view) { + console.warn(`Unable to find a view with the ID of ${viewId}`); + } + return view; + }; + const getCanvas = (options) => { + var _a, _b; + const resolution = (_a = options == null ? void 0 : options.resolution) != null ? _a : 4; + const transparentBackground = (_b = options == null ? void 0 : options.transparentBackground) != null ? _b : false; + const renderer = hg.pixiRenderer; + const renderTexture = PIXI.RenderTexture.create({ + width: renderer.width / 2, + height: renderer.height / 2, + resolution + }); + renderer.render(hg.pixiStage, renderTexture); + const canvas = renderer.plugins.extract.canvas(renderTexture); + const canvasWithBg = document.createElement("canvas"); + canvasWithBg.width = canvas.width; + canvasWithBg.height = canvas.height; + const ctx = canvasWithBg.getContext("2d"); + if (!transparentBackground) { + ctx.fillStyle = theme.root.background; + ctx.fillRect(0, 0, canvasWithBg.width, canvasWithBg.height); + } + ctx.drawImage(canvas, 0, 0); + return { + canvas: canvasWithBg, + resolution, + canvasWidth: canvas.width, + canvasHeight: canvas.height + }; + }; + return { + subscribe, + unsubscribe, + zoomTo: (trackId, position, padding = 0, duration = 1e3) => { + var _a; + const assembly = (_a = getTrack(trackId)) == null ? void 0 : _a.spec.assembly; + const manager = GenomicPositionHelper.fromString(position); + const absCoordinates = manager.toAbsoluteCoordinates(assembly, padding); + const hgViewId = getHgViewId(trackId); + hg.api.zoomTo(hgViewId, ...absCoordinates, ...absCoordinates, duration); + }, + zoomToExtent: (trackId, duration = 1e3) => { + var _a; + const assembly = (_a = getTrack(trackId)) == null ? void 0 : _a.spec.assembly; + const [start, end] = [0, computeChromSizes(assembly).total]; + const hgViewId = getHgViewId(trackId); + hg.api.zoomTo(hgViewId, start, end, start, end, duration); + }, + zoomToGene: (trackId, gene, padding = 0, duration = 1e3) => { + const hgViewId = getHgViewId(trackId); + hg.api.zoomToGene(hgViewId, gene, padding, duration); + }, + suggestGene: (trackId, keyword, callback) => { + const hgViewId = getHgViewId(trackId); + hg.api.suggestGene(hgViewId, keyword, callback); + }, + getTrackIds: getTrackIds2, + getTracksAndViews, + getTracks, + getTrack, + getView, + getViews, + getCanvas, + exportPng: (transparentBackground) => { + const { canvas } = getCanvas({ resolution: 4, transparentBackground }); + canvas.toBlob((blob2) => { + const a = document.createElement("a"); + document.body.append(a); + a.download = "gosling-visualization"; + a.href = URL.createObjectURL(blob2); + a.click(); + a.remove(); + }, "image/png"); + }, + exportPdf: async (transparentBackground) => { + const { jsPDF } = await import("jspdf"); + const { canvas } = getCanvas({ resolution: 4, transparentBackground }); + const imgData = canvas.toDataURL("image/jpeg", 1); + const pdf = new jsPDF({ + orientation: canvas.width < canvas.height ? "p" : "l", + unit: "pt", + format: [canvas.width, canvas.height] + }); + pdf.addImage(imgData, "JPEG", 0, 0, canvas.width, canvas.height); + pdf.save("gosling-visualization.pdf"); + } + }; +} +function omitDeep(spec, omitKeys) { + return cloneDeepWith(spec, (value) => { + if (isObject(value)) { + omitKeys.forEach((key) => { + delete value[key]; + }); + } + }); +} +const preverseZoomStatus = (newSpec, prevSpec) => { + newSpec.views.forEach((view) => { + var _a, _b, _c; + const viewUid = view.uid; + const isNewView = !prevSpec.views.find((v) => v.uid === viewUid); + if (isNewView) { + const { locksByViewUid } = newSpec.zoomLocks; + const lockUid = locksByViewUid[viewUid]; + const linkedViewUid = (_a = Object.entries(locksByViewUid).find(([_, uid]) => _ && uid === lockUid)) == null ? void 0 : _a[0]; + const linkedViewExistedPrev = !!prevSpec.views.find((v) => v.uid === linkedViewUid); + if (linkedViewUid && linkedViewExistedPrev) { + view.initialXDomain = (_b = prevSpec.views.find((v) => v.uid === linkedViewUid)) == null ? void 0 : _b.initialXDomain; + view.initialYDomain = (_c = prevSpec.views.find((v) => v.uid === linkedViewUid)) == null ? void 0 : _c.initialYDomain; + } + } + }); +}; +const DELAY_FOR_CONTAINER_RESIZE_BEFORE_RERENDER = 300; +const GoslingComponent = forwardRef((props, ref) => { + var _a, _b, _c; + const [viewConfig, setViewConfig] = useState(); + const [size, setSize] = useState({ width: 200, height: 200 }); + const wrapperSize = useRef(); + const wrapperParentSize = useRef(); + const prevSpec = useRef(); + const tracksAndViews = useRef([]); + const idTable = useRef({}); + const hgRef = useRef(null); + const theme = getTheme(props.theme || "light"); + const wrapperDivId = (_a = props.id) != null ? _a : uuid(); + const publishOnNewView = (currentTracksAndViews) => { + const prevViews = tracksAndViews.current.filter((data) => data.type == "view"); + const currentViews = currentTracksAndViews.filter((data) => data.type == "view"); + const prevViewIds = new Set(prevViews.map((data) => data.id)); + const newViews = currentViews.filter((view) => !prevViewIds.has(view.id)); + newViews.forEach((view) => { + publish("onNewView", { id: view.id }); + }); + }; + useImperativeHandle( + ref, + () => { + const hgApi = refAsReadonlyProxy(hgRef); + const visUnits = refAsReadonlyProxy(tracksAndViews); + const api = createApi(hgApi, viewConfig, visUnits, theme, idTable.current); + return { api, hgApi }; + }, + [viewConfig, theme] + ); + const compile$1 = useCallback(() => { + if (props.spec) { + const valid = validateGoslingSpec(props.spec); + if (valid.state === "error") { + console.warn("Gosling spec is not valid. Please refer to the console message."); + return; + } + compile( + props.spec, + (newHiGlassSpec, newSize, newGoslingSpec, newTracksAndViews, newIdTable) => { + var _a2, _b2; + if (prevSpec.current && isEqual(omitDeep(prevSpec.current, ["linkingId"]), omitDeep(newGoslingSpec, ["linkingId"]))) { + return; + } + (_a2 = props.compiled) == null ? void 0 : _a2.call(props, props.spec, newHiGlassSpec, { _processedSpec: newGoslingSpec }); + setSize(newSize); + const isMountedOnce = typeof viewConfig !== "undefined"; + if (((_b2 = props.experimental) == null ? void 0 : _b2.reactive) && isMountedOnce) { + setTimeout(() => { + var _a3, _b3; + preverseZoomStatus( + newHiGlassSpec, + (_a3 = hgRef.current) == null ? void 0 : _a3.api.getViewConfig() + ); + (_b3 = hgRef.current) == null ? void 0 : _b3.api.setViewConfig(newHiGlassSpec); + }, DELAY_FOR_CONTAINER_RESIZE_BEFORE_RERENDER); + } else { + setViewConfig(newHiGlassSpec); + } + publishOnNewView(newTracksAndViews); + prevSpec.current = newGoslingSpec; + tracksAndViews.current = newTracksAndViews; + idTable.current = newIdTable; + }, + [...GoslingTemplates], + // TODO: allow user definitions + theme, + { + containerSize: wrapperSize.current, + containerParentSize: wrapperParentSize.current + }, + props.urlToFetchOptions + ); + } + }, [props.spec, theme]); + useEffect(() => { + var _a2; + if (!((_a2 = props.spec) == null ? void 0 : _a2.responsiveSize)) + return; + const containerElement = document.getElementById(wrapperDivId); + if (!containerElement) + return; + const resizer = new ResizeSensor(containerElement, (newSize) => { + if (!wrapperSize.current || wrapperSize.current.height !== newSize.height || wrapperSize.current.width !== newSize.width) { + wrapperSize.current = newSize; + compile$1(); + } + }); + const parentElement = containerElement.parentElement; + if (!parentElement) + return; + const parentResizer = new ResizeSensor(parentElement, (newSize) => { + if (!wrapperParentSize.current || wrapperParentSize.current.height !== newSize.height || wrapperParentSize.current.width !== newSize.width) { + wrapperParentSize.current = newSize; + compile$1(); + } + }); + return () => { + resizer.detach(); + parentResizer.detach(); + }; + }); + useEffect(() => { + compile$1(); + }, [props.spec, theme]); + const responsiveHeight = typeof ((_b = props.spec) == null ? void 0 : _b.responsiveSize) !== "object" ? (_c = props.spec) == null ? void 0 : _c.responsiveSize : props.spec.responsiveSize.height; + const higlassComponent = useMemo( + () => { + var _a2, _b2, _c2; + return /* @__PURE__ */ React.createElement( + HiGlassComponentWrapper, + { + ref: hgRef, + viewConfig, + size, + id: wrapperDivId, + className: props.className, + options: { + padding: props.padding, + border: props.border, + margin: props.margin, + responsiveWidth: typeof ((_a2 = props.spec) == null ? void 0 : _a2.responsiveSize) !== "object" ? (_b2 = props.spec) == null ? void 0 : _b2.responsiveSize : props.spec.responsiveSize.width, + responsiveHeight, + background: theme.root.background, + alt: (_c2 = props.spec) == null ? void 0 : _c2.description + } + } + ); + }, + [viewConfig, size, theme, responsiveHeight] + ); + return higlassComponent; +}); +GoslingComponent.displayName = "GoslingComponent"; +function refAsReadonlyProxy(ref) { + return new Proxy({}, { + get(_target, prop, reciever) { + if (!ref.current) + throw Error("ref is not set!"); + return Reflect.get(ref.current, prop, reciever); + } + }); +} +var createRoot; +var m = require$$0; +if (process.env.NODE_ENV === "production") { + createRoot = m.createRoot; + m.hydrateRoot; +} else { + var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + createRoot = function(c, o) { + i.usingClientEntryPoint = true; + try { + return m.createRoot(c, o); + } finally { + i.usingClientEntryPoint = false; + } + }; +} +const MAX_TRIES = 20; +const INTERVAL = 200; +const launchHiglass = (element, viewConfig, size, opts) => { + const ref = React.createRef(); + const component = React.createElement(HiGlassComponentWrapper, { + ref, + viewConfig, + size, + id: opts.id, + className: opts.className, + options: opts + }); + createRoot(element).render(component); + return new Promise((resolve, reject) => { + let tries = 0; + const poll = setInterval(() => { + if (ref && ref.current) { + clearInterval(poll); + resolve(ref.current); + } + if (tries >= MAX_TRIES) { + reject(new Error("Failed to initialize HiGlassApi.")); + } + tries++; + }, INTERVAL); + }); +}; +function embed(element, spec, opts = {}) { + return new Promise((resolve, reject) => { + var _a, _b; + const valid = validateGoslingSpec(spec); + if (valid.state === "error") { + reject(new Error("Gosling spec is not valid. Please refer to the console message.")); + } + const theme = getTheme(opts.theme || "light"); + const options = { + ...opts, + background: theme.root.background, + alt: (_b = (_a = opts.alt) != null ? _a : spec.description) != null ? _b : "Gosling visualization" + }; + compile( + spec, + async (hsSpec, size, _, trackInfos, idTable) => { + const hg = await launchHiglass(element, hsSpec, size, options); + const api = createApi(hg, hsSpec, trackInfos, theme, idTable); + resolve(api); + }, + [...GoslingTemplates], + theme, + {}, + // TODO: properly specify this + opts.urlToFetchOptions + ); + }); +} +export { + GoslingComponent, + GoslingSchema, + GoslingTemplates, + theme_schema as ThemeSchema, + Themes, + compile, + embed, + getTheme$1 as getTheme, + init, + isThereTheme, + name, + validateGoslingSpec, + version +}; +//# sourceMappingURL=gosling.js.map diff --git a/dist/gosling.js.map b/dist/gosling.js.map new file mode 100644 index 00000000..8f24ec12 --- /dev/null +++ b/dist/gosling.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gosling.js","sources":["../src/gosling-schema/validate.ts","../src/core/utils/template.ts","../src/gosling-theme/light.ts","../src/gosling-theme/dark.ts","../src/gosling-theme/warm.ts","../src/gosling-theme/ggplot.ts","../src/gosling-theme/igv.ts","../src/gosling-theme/ensembl.ts","../src/gosling-theme/jbrowse.ts","../src/gosling-theme/ucsc.ts","../src/gosling-theme/washu.ts","../src/gosling-theme/excel.ts","../src/gosling-theme/google.ts","../src/gosling-theme/index.ts","../src/core/utils/define-plugin-track.ts","../src/tracks/gosling-genomic-axis/axis-track.ts","../src/tracks/gosling-brush/brush-track.ts","../src/tracks/gosling-brush/linear-brush-model.ts","../src/tracks/gosling-track/gosling-mouse-event/polygon.ts","../src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.ts","../src/data-fetchers/bam/bam-data-fetcher.ts","../src/data-fetchers/vcf/vcf-data-fetcher.ts","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/bigint-polyfill/pure.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/bigint-polyfill/polyfill.js","../node_modules/.pnpm/binary-parser@2.2.1/node_modules/binary-parser/dist/esm/binary_parser.mjs","../node_modules/.pnpm/abortcontroller-polyfill@1.7.5/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/abortcontroller-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateAbortController.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateStatusReporter.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AbortablePromiseCache.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/index.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/range.js","../node_modules/.pnpm/pako@2.1.0/node_modules/pako/dist/pako.esm.mjs","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/unzip-pako.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/util.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/blockView.js","../node_modules/.pnpm/tslib@2.6.2/node_modules/tslib/tslib.es6.mjs","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isFunction.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Subscription.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/config.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/noop.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/errorContext.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Subscriber.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/symbol/observable.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/identity.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/pipe.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Observable.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/lift.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/EmptyError.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/firstValueFrom.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/scanInternals.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/reduce.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/toArray.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/bbi.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/bigwig.js","../src/data-fetchers/bigwig/bigwig-data-fetcher.ts","../src/core/utils/data-transform.ts","../src/data-fetchers/csv/csv-data-fetcher.ts","../src/data-fetchers/json/json-data-fetcher.ts","../src/data-fetchers/gff/gff-data-fetcher.ts","../src/data-fetchers/bed/bed-data-fetcher.ts","../src/tracks/gosling-track/data-abstraction.ts","../src/core/utils/scales.ts","../src/core/example/hg-view-config-1.ts","../src/compiler/higlass-model.ts","../src/core/utils/semantic-zoom.ts","../src/core/channel/index.ts","../src/core/utils/theme.ts","../src/tracks/gosling-track/gosling-track-model.ts","../src/api/pubsub.ts","../src/tracks/gosling-track/gosling-track.ts","../src/tracks/dummy-track/dummy-track.ts","../src/core/init.ts","../src/compiler/bounding-box.ts","../src/core/utils/index.ts","../src/compiler/gosling-to-higlass.ts","../src/core/utils/linking.ts","../src/api/track-and-view-ids.ts","../src/api/api-data.ts","../src/compiler/create-higlass-models.ts","../src/compiler/responsive.ts","../src/compiler/compile.ts","../src/core/higlass-component-wrapper.tsx","../src/api/api.ts","../src/core/utils/omit-deep.ts","../src/core/utils/higlass-zoom-config.ts","../src/core/gosling-component.tsx","../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/client.js","../src/core/gosling-embed.ts"],"sourcesContent":["import Ajv from 'ajv';\nimport type { SingleTrack, ChannelDeep, ChannelTypes, OverlaidTrack, Track } from './gosling.schema';\nimport { IsChannelDeep } from './gosling.schema.guards';\nimport { resolveSuperposedTracks } from '../core/utils/overlay';\nimport GoslingSchema from './gosling.schema.json';\n\nexport interface Validity {\n message: string;\n state: 'success' | 'warn' | 'error';\n details?: string;\n}\n\nexport function validateGoslingSpec(spec: any): Validity {\n return validateSpec(GoslingSchema, spec);\n}\n\n/**\n *\n */\nexport function validateSpec(schema: any, spec: any, silence = false): Validity {\n const validate = new Ajv({ extendRefs: true }).compile(schema);\n const valid = validate(spec);\n\n let message = '';\n let details = '';\n\n if (validate.errors) {\n details = JSON.stringify(validate.errors, null, 2);\n\n if (!silence) {\n console.warn(details);\n }\n\n message = '⚠️ Some properties are incorrectly used.';\n }\n\n return { state: valid ? 'success' : 'warn', message, details };\n}\n\nexport function validateTrack(track: Track) {\n let valid = true;\n const errorMessages: string[] = [];\n\n const resolvedTrack = resolveSuperposedTracks(track);\n\n resolvedTrack.forEach(spec => {\n // Validate with json schema\n // ...\n\n // Additionally, validate the schema with the aspects that cannot be validated by the json schema\n if (!getGenomicChannelFromTrack(spec) && spec.mark !== 'brush' && spec.mark !== 'rule') {\n // as an exception, brush and rule can encode no genomic data\n errorMessages.push('genomic type is not encoded to either a x- or y- axis');\n // EXPERIMENTAL: we are removing this rule in our spec.\n valid = false;\n }\n\n // combination of visual mark and channel\n const color = spec.color;\n if (spec.mark === 'line' && IsChannelDeep(color) && color.type === 'quantitative') {\n errorMessages.push('`line` mark cannot be used with `quantitative` value');\n valid = false;\n }\n\n /**\n * Linking\n */\n // are the linking used for same visual channels (do not work betwee `x` and `size`)\n });\n\n return { valid, errorMessages };\n}\n\n/**\n * Find an axis channel that is encoded with genomic coordinate.\n * `undefined` if not found.\n */\nexport function getGenomicChannelFromTrack(track: SingleTrack | OverlaidTrack): ChannelDeep | undefined {\n // we do not support using two genomic coordinates yet\n let genomicChannel: ChannelDeep | undefined = undefined;\n ['x', 'y', 'xe', 'ye', 'x1', 'y1', 'x1e', 'y1e'].reverse().forEach(channelType => {\n const channel = track[channelType as keyof typeof ChannelTypes];\n if (IsChannelDeep(channel) && channel.type === 'genomic') {\n genomicChannel = channel;\n }\n });\n return genomicChannel;\n}\n\n/**\n * Find an axis channel that is encoded with genomic coordinate and return 'x' or 'y'.\n * `undefined` if not found.\n */\nexport function getGenomicChannelKeyFromTrack(\n track: SingleTrack | OverlaidTrack\n): 'x' | 'xe' | 'y' | 'ye' | 'x1' | 'y1' | 'x1e' | 'y1e' | undefined {\n // we do not support using two genomic coordinates yet\n let genomicChannelKey: string | undefined = undefined;\n ['x', 'xe', 'y', 'ye', 'x1', 'y1', 'x1e', 'y1e'].reverse().forEach(channelKey => {\n const channel = track[channelKey as keyof typeof ChannelTypes];\n if (IsChannelDeep(channel) && channel.type === 'genomic') {\n genomicChannelKey = channelKey;\n }\n });\n return genomicChannelKey;\n}\n","import type {\n CustomChannelDef,\n DataTransform,\n DataTransformWithBase,\n GoslingSpec,\n OverlaidTracks,\n TemplateTrackDef,\n TemplateTrackMappingDef,\n Track\n} from '@gosling-lang/gosling-schema';\nimport { IsTemplateTrack } from '@gosling-lang/gosling-schema';\nimport { traverseTracks } from '../../compiler/spec-preprocess';\n\n/**\n * Track templates officially supported by Gosling.js.\n */\nexport const GoslingTemplates: TemplateTrackDef[] = [\n {\n name: 'gene',\n channels: [\n { name: 'startPosition', type: 'genomic', required: true },\n { name: 'endPosition', type: 'genomic', required: true },\n { name: 'strandColor', type: 'nominal', required: true },\n { name: 'strandRow', type: 'nominal', required: true },\n { name: 'opacity', type: 'value', required: false },\n { name: 'geneHeight', type: 'value', required: false },\n { name: 'geneLabel', type: 'nominal', required: true },\n { name: 'geneLabelColor', type: 'nominal', required: true },\n { name: 'geneLabelFontSize', type: 'value', required: false },\n { name: 'geneLabelStroke', type: 'value', required: false },\n { name: 'geneLabelStrokeThickness', type: 'value', required: false },\n { name: 'geneLabelOpacity', type: 'value', required: false },\n { name: 'type', type: 'nominal', required: true } // either 'gene' or 'exon'\n ],\n mapping: [\n {\n dataTransform: [\n { type: 'filter', base: 'type', oneOf: ['gene'] },\n { type: 'filter', base: 'strandColor', oneOf: ['-'] }\n ],\n mark: 'triangleLeft',\n x: { base: 'startPosition', type: 'genomic' },\n size: { base: 'geneHeight', value: 12 },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'strandColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 0.4 },\n style: { align: 'right' }\n },\n {\n dataTransform: [\n { type: 'filter', base: 'type', oneOf: ['gene'] },\n { type: 'filter', base: 'strandColor', oneOf: ['+'] }\n ],\n mark: 'triangleRight',\n x: { base: 'endPosition', type: 'genomic' },\n size: { base: 'geneHeight', value: 12 },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'strandColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 0.4 },\n style: { align: 'left' }\n },\n {\n dataTransform: [{ type: 'filter', base: 'type', oneOf: ['exon'] }],\n mark: 'rect',\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n size: { base: 'geneHeight', value: 12 },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'strandColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 0.4 }\n },\n {\n dataTransform: [\n { type: 'filter', base: 'type', oneOf: ['gene'] },\n { type: 'filter', base: 'strandColor', oneOf: ['+'] }\n ],\n mark: 'rect',\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'strandColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 0.4 },\n size: { value: 3 }\n // style: {\n // linePattern: { type: 'triangleRight', size: 5 }\n // }\n },\n {\n dataTransform: [\n { type: 'filter', base: 'type', oneOf: ['gene'] },\n { type: 'filter', base: 'strandColor', oneOf: ['-'] }\n ],\n mark: 'rect',\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'strandColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 0.4 },\n size: { value: 3 }\n // style: {\n // linePattern: { type: 'triangleLeft', size: 5 }\n // }\n },\n {\n dataTransform: [{ type: 'filter', base: 'type', oneOf: ['gene'] }],\n mark: 'text',\n text: { base: 'geneLabel', type: 'nominal' }, // TODO: add dy here\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'geneLabelColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 1 },\n size: { base: 'geneLabelFontSize', value: 18 },\n stroke: { base: 'geneLabelStroke', value: 'white' },\n strokeWidth: { base: 'geneLabelStrokeThickness', value: 2 },\n // TODO: how to redefine style from the users' side? (e.g., dy: -30)\n visibility: [\n {\n operation: 'less-than',\n measure: 'width',\n threshold: '|xe-x|',\n transitionPadding: 10,\n target: 'mark'\n }\n ]\n }\n ]\n },\n {\n name: 'ideogram',\n channels: [\n { name: 'startPosition', type: 'genomic', required: true },\n { name: 'endPosition', type: 'genomic', required: true },\n { name: 'chrHeight', type: 'value', required: false }, // https://eweitz.github.io/ideogram/\n { name: 'name', type: 'nominal', required: true },\n { name: 'stainBackgroundColor', type: 'nominal', required: true },\n { name: 'stainLabelColor', type: 'nominal', required: true },\n { name: 'stainStroke', type: 'value', required: false },\n { name: 'stainStrokeWidth', type: 'value', required: false }\n ],\n mapping: [\n {\n mark: 'rect',\n dataTransform: [{ type: 'filter', base: 'stainBackgroundColor', oneOf: ['acen'], not: true }],\n color: {\n base: 'stainBackgroundColor',\n type: 'nominal',\n domain: ['gneg', 'gpos25', 'gpos50', 'gpos75', 'gpos100', 'gvar', 'acen'],\n range: ['white', 'lightgray', 'gray', 'gray', 'black', '#7B9CC8', '#DC4542']\n },\n size: { base: 'chrHeight', value: 18 },\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n stroke: { base: 'stainStroke', value: 'gray' },\n strokeWidth: { base: 'stainStrokeWidth', value: 0.3 }\n },\n {\n mark: 'triangleRight',\n dataTransform: [\n { type: 'filter', base: 'stainBackgroundColor', oneOf: ['acen'] },\n { type: 'filter', base: 'name', include: 'q' }\n ],\n color: {\n base: 'stainBackgroundColor',\n type: 'nominal',\n domain: ['gneg', 'gpos25', 'gpos50', 'gpos75', 'gpos100', 'gvar', 'acen'],\n range: ['white', 'lightgray', 'gray', 'gray', 'black', '#7B9CC8', '#DC4542']\n },\n size: { base: 'chrHeight', value: 18 },\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n stroke: { base: 'stainStroke', value: 'gray' },\n strokeWidth: { base: 'stainStrokeWidth', value: 0.3 }\n },\n {\n mark: 'triangleLeft',\n dataTransform: [\n { type: 'filter', base: 'stainBackgroundColor', oneOf: ['acen'] },\n { type: 'filter', base: 'name', include: 'p' }\n ],\n color: {\n base: 'stainBackgroundColor',\n type: 'nominal',\n domain: ['gneg', 'gpos25', 'gpos50', 'gpos75', 'gpos100', 'gvar', 'acen'],\n range: ['white', 'lightgray', 'gray', 'gray', 'black', '#7B9CC8', '#DC4542']\n },\n size: { base: 'chrHeight', value: 18 },\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n stroke: { base: 'stainStroke', value: 'gray' },\n strokeWidth: { base: 'stainStrokeWidth', value: 0.3 }\n },\n {\n mark: 'text',\n dataTransform: [{ type: 'filter', base: 'stainLabelColor', oneOf: ['acen'], not: true }],\n color: {\n base: 'stainLabelColor',\n type: 'nominal',\n domain: ['gneg', 'gpos25', 'gpos50', 'gpos75', 'gpos100', 'gvar'],\n range: ['black', 'black', 'black', 'black', 'white', 'black']\n },\n text: { base: 'name', type: 'nominal' },\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n visibility: [\n {\n operation: 'less-than',\n measure: 'width',\n threshold: '|xe-x|',\n transitionPadding: 10,\n target: 'mark'\n }\n ]\n }\n ]\n },\n {\n name: 'sequence',\n channels: [\n { name: 'startPosition', type: 'genomic', required: true },\n { name: 'endPosition', type: 'genomic', required: true },\n { name: 'barLength', type: 'quantitative', required: true },\n { name: 'baseBackground', type: 'nominal', required: true },\n { name: 'baseLabelColor', type: 'nominal', required: true },\n { name: 'baseLabelFontSize', type: 'value', required: false }\n ],\n mapping: [\n {\n mark: 'bar',\n // x: { base: 'position', type: 'genomic' },\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n y: { base: 'barLength', type: 'quantitative', axis: 'none' },\n color: { base: 'baseBackground', type: 'nominal', domain: ['A', 'T', 'G', 'C'] }\n },\n {\n dataTransform: [{ type: 'filter', base: 'barLength', oneOf: [0], not: true }],\n mark: 'text',\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n color: { base: 'baseLabelColor', type: 'nominal', domain: ['A', 'T', 'G', 'C'], range: ['white'] },\n text: { base: 'baseBackground', type: 'nominal' },\n size: { base: 'baseLabelFontSize', value: 18 },\n visibility: [\n {\n operation: 'less-than',\n measure: 'width',\n threshold: '|xe-x|',\n transitionPadding: 30,\n target: 'mark'\n },\n {\n operation: 'LT',\n measure: 'zoomLevel',\n threshold: 10,\n target: 'track'\n }\n ]\n }\n ]\n }\n];\n\n/**\n * Replace track templetes to low-level gosling specs.\n * @param spec\n */\nexport function replaceTrackTemplates(spec: GoslingSpec, templates: TemplateTrackDef[]) {\n traverseTracks(spec, (t, i, ts) => {\n if (!IsTemplateTrack(t)) {\n // If this is not a template track, no point to replace templates.\n return;\n }\n\n const { template: name } = t;\n const templateDef = templates.find(d => d.name === name);\n\n /* Validation */\n if (!templateDef) {\n // No idea what this template is, so set a flag and remove it from the spec when compiling.\n t._invalidTrack = true;\n console.warn(`There is no track template named '${name}'`);\n return;\n }\n\n let isValid = true;\n templateDef.channels.forEach((d: CustomChannelDef) => {\n if (d.required && (!t.encoding || !(d.name in t.encoding))) {\n // Required channels are not defined\n isValid = false;\n console.warn(`A template spec ('${name}') does not contain a required channel, ${d.name}`);\n }\n });\n\n if (!isValid) {\n // The template spec is not valid for given template definition\n t._invalidTrack = true;\n return;\n }\n\n /* conversion */\n const viewBase = JSON.parse(JSON.stringify(t));\n if ('encoding' in viewBase) {\n delete viewBase.encoding;\n }\n const convertedView: OverlaidTracks = {\n ...viewBase,\n alignment: 'overlay',\n tracks: [],\n width: t.width ?? 100,\n height: t.height ?? 100\n };\n templateDef.mapping.forEach((singleTrackMappingDef: TemplateTrackMappingDef) => {\n // Set required properties\n const convertedTrack: Partial = {\n data: t.data,\n mark: singleTrackMappingDef.mark\n };\n\n // Handle data transform\n const { dataTransform } = singleTrackMappingDef;\n if (dataTransform) {\n const newDataTransform: DataTransform[] = [];\n dataTransform.map((dataTramsformMap: DataTransformWithBase) => {\n const baseChannelName = dataTramsformMap.base;\n if (\n baseChannelName &&\n t.encoding &&\n baseChannelName in t.encoding &&\n 'field' in t.encoding[baseChannelName]\n ) {\n delete dataTramsformMap.base;\n (dataTramsformMap as any).field = (t.encoding[baseChannelName] as any).field;\n newDataTransform.push(dataTramsformMap as DataTransform);\n } else {\n // TODO: JUST ADD?\n }\n });\n }\n\n // Handle encoding\n const encodingSpec = t.encoding;\n if (!encodingSpec) {\n // This means we do not need to override anything, so use default encodings\n Object.keys(singleTrackMappingDef)\n .filter(k => k !== 'mark')\n .forEach(channelKey => {\n // Iterate all channels\n const channelMap = JSON.parse(JSON.stringify((singleTrackMappingDef as any)[channelKey]));\n if ('base' in channelMap) {\n delete channelMap.base;\n }\n // @ts-ignore\n convertedTrack[channelKey as keyof TemplateTrackMappingDef] = channelMap;\n });\n } else {\n Object.keys(singleTrackMappingDef)\n .filter(k => k !== 'mark')\n .forEach(channelKey => {\n // Iterate all channels\n const channelMap = JSON.parse(JSON.stringify((singleTrackMappingDef as any)[channelKey]));\n if ('base' in channelMap) {\n const baseChannelName = channelMap.base;\n if (baseChannelName in encodingSpec) {\n // This means we need to override a user's spec for this channel\n const base = JSON.parse(JSON.stringify(encodingSpec[baseChannelName]));\n delete channelMap.base;\n const newChannelSpec = Object.assign(channelMap, JSON.parse(JSON.stringify(base)));\n convertedTrack[channelKey as keyof TemplateTrackMappingDef] = newChannelSpec;\n } else {\n // This means a user did not specify a optional custom channel, so just remove a `base` property.\n delete channelMap.base;\n convertedTrack[channelKey as keyof TemplateTrackMappingDef] = channelMap;\n }\n } else {\n // This means we use encoding that is constant.\n convertedTrack[channelKey as keyof TemplateTrackMappingDef] = channelMap;\n }\n });\n }\n\n convertedView.tracks.push(convertedTrack);\n });\n\n ts[i] = convertedView;\n });\n\n // DEBUG\n // console.log('After replaceTrackTemplates()', JSON.parse(JSON.stringify(spec)));\n}\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#E79F00', '#029F73', '#0072B2', '#CB7AA7', '#D45E00', '#57B4E9', '#EFE441' /*'#000000'*/];\n\nconst LightThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const light: ThemeDeep = {\n base: 'light',\n\n root: {\n background: 'white',\n titleColor: 'black',\n titleBackgroundColor: 'transparent',\n titleFontSize: 18,\n titleFontFamily: 'Arial',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n subtitleColor: 'gray',\n subtitleBackgroundColor: 'transparent',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleFontWeight: 'normal',\n subtitleAlign: 'left',\n showMousePosition: true,\n mousePositionColor: '#000000'\n },\n\n track: {\n background: 'transparent',\n alternatingBackground: 'transparent',\n titleColor: 'black',\n titleBackground: 'white',\n titleFontSize: 24,\n titleAlign: 'left',\n outline: 'black',\n outlineWidth: 1\n },\n\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: '#DBDBDB',\n tickColor: 'black'\n },\n\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n labelMargin: 5,\n labelExcludeChrPrefix: false,\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n baselineColor: 'black',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1,\n gridStrokeType: 'solid',\n gridStrokeDash: [4, 4]\n },\n\n markCommon: {\n ...LightThemeMarkCommonStyle\n },\n point: {\n ...LightThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...LightThemeMarkCommonStyle\n },\n triangle: {\n ...LightThemeMarkCommonStyle\n },\n area: {\n ...LightThemeMarkCommonStyle\n },\n line: {\n ...LightThemeMarkCommonStyle\n },\n bar: {\n ...LightThemeMarkCommonStyle\n },\n rule: {\n ...LightThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...LightThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...LightThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...LightThemeMarkCommonStyle,\n color: 'gray',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#E79F00', '#029F73', '#0072B2', '#CB7AA7', '#D45E00', '#57B4E9', '#EFE441' /*'#000000'*/];\n\nconst LightThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nconst DarkThemeMarkCommonStyle = { ...LightThemeMarkCommonStyle, stroke: 'white' };\n\nexport const dark: ThemeDeep = {\n base: 'dark',\n\n root: {\n background: 'black',\n titleColor: 'white',\n titleBackgroundColor: 'transparent',\n titleFontSize: 18,\n titleFontFamily: 'Arial',\n titleAlign: 'middle',\n titleFontWeight: 'bold',\n subtitleColor: 'lightgray',\n subtitleBackgroundColor: 'transparent',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleAlign: 'middle',\n subtitleFontWeight: 'normal',\n showMousePosition: true,\n mousePositionColor: '#FFFFFF'\n },\n\n track: {\n background: 'transparent',\n alternatingBackground: 'transparent',\n titleColor: 'white',\n titleBackground: 'black',\n titleFontSize: 18,\n titleAlign: 'left',\n outline: 'white',\n outlineWidth: 1\n },\n legend: {\n position: 'right',\n background: 'black',\n backgroundOpacity: 0.7,\n labelColor: 'white',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: '#DBDBDB',\n tickColor: 'white'\n },\n axis: {\n tickColor: 'white',\n labelMargin: 5,\n labelExcludeChrPrefix: false,\n labelColor: 'white',\n labelFontSize: 10,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n baselineColor: 'white',\n gridColor: 'gray',\n gridStrokeWidth: 1,\n gridStrokeType: 'solid',\n gridStrokeDash: [4, 4]\n },\n\n markCommon: {\n ...DarkThemeMarkCommonStyle\n },\n point: {\n ...DarkThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...DarkThemeMarkCommonStyle\n },\n triangle: {\n ...DarkThemeMarkCommonStyle\n },\n area: {\n ...DarkThemeMarkCommonStyle\n },\n line: {\n ...DarkThemeMarkCommonStyle\n },\n bar: {\n ...DarkThemeMarkCommonStyle\n },\n rule: {\n ...DarkThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...DarkThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...DarkThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...DarkThemeMarkCommonStyle,\n color: 'lightgray',\n opacity: 0.3,\n stroke: 'white',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#D19000', '#008F67', '#005F96', '#B86E97', '#B55100', '#4793BF', '#C9C03'];\n\nconst WarmThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: '#3C3C3C',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const warm: ThemeDeep = {\n base: 'warm',\n\n root: {\n background: '#FFF8E8',\n titleColor: '#3C3C3C',\n subtitleColor: 'gray',\n showMousePosition: true,\n mousePositionColor: '#3C3C3C'\n },\n\n track: {\n titleColor: '#3C3C3C',\n titleBackground: '#FFF8E8',\n outline: '#3C3C3C',\n outlineWidth: 1\n },\n\n legend: {\n background: '#FFF8E8',\n backgroundOpacity: 0.7,\n labelColor: '#3C3C3C',\n backgroundStroke: '#3C3C3C',\n tickColor: '3C3C3C'\n },\n\n axis: {\n tickColor: '#3C3C3C',\n labelColor: '#3C3C3C',\n baselineColor: '#3C3C3C',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1\n },\n\n markCommon: {\n ...WarmThemeMarkCommonStyle\n },\n point: {\n ...WarmThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...WarmThemeMarkCommonStyle\n },\n triangle: {\n ...WarmThemeMarkCommonStyle\n },\n area: {\n ...WarmThemeMarkCommonStyle\n },\n line: {\n ...WarmThemeMarkCommonStyle\n },\n bar: {\n ...WarmThemeMarkCommonStyle\n },\n rule: {\n ...WarmThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...WarmThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...WarmThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...WarmThemeMarkCommonStyle,\n color: 'lightgray',\n opacity: 0.3,\n stroke: '#3C3C3C',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#F66A62', '#05B230', '#5692FF', '#D764D6', '#86E9D4', '#6E6AD7', '#FFFB00'];\n\nconst GgplotThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const ggplot: ThemeDeep = {\n base: 'ggplot',\n\n root: {\n background: 'white',\n titleColor: 'black',\n titleFontSize: 18,\n titleFontFamily: 'Helvetica',\n titleAlign: 'middle',\n titleFontWeight: 'bold',\n titleBackgroundColor: 'white',\n subtitleColor: 'gray',\n subtitleFontSize: 14,\n subtitleFontFamily: 'Helvetica',\n subtitleAlign: 'middle',\n subtitleFontWeight: 'light',\n subtitleBackgroundColor: 'white',\n showMousePosition: true,\n mousePositionColor: 'black'\n },\n\n track: {\n background: '#e8e8e8',\n alternatingBackground: '#d1d1d1',\n titleColor: 'black',\n titleBackground: 'white',\n //titleFontSize:'',\n //titleAlign:'',\n outline: 'black',\n outlineWidth: 2\n },\n\n legend: {\n position: 'right',\n background: '#e8e8e8',\n backgroundOpacity: 1,\n labelColor: 'black',\n backgroundStroke: '#e8e8e8',\n tickColor: 'white'\n //,labelFontSize: '',\n //labelFontWeight: '',\n //labelFontFamily: ''\n },\n\n axis: {\n tickColor: 'white',\n labelColor: 'black',\n //labelFontSize: '',\n //labelFontWeight: '',\n //labelFontFamily: '',\n baselineColor: '#e8e8e8',\n gridColor: 'white',\n gridStrokeWidth: 2\n //,gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...GgplotThemeMarkCommonStyle\n },\n point: {\n ...GgplotThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...GgplotThemeMarkCommonStyle\n },\n triangle: {\n ...GgplotThemeMarkCommonStyle\n },\n area: {\n ...GgplotThemeMarkCommonStyle\n },\n line: {\n ...GgplotThemeMarkCommonStyle\n },\n bar: {\n ...GgplotThemeMarkCommonStyle\n },\n rule: {\n ...GgplotThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...GgplotThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...GgplotThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'bold'\n },\n brush: {\n ...GgplotThemeMarkCommonStyle,\n color: 'black',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#37E649', '#ED2D44', '#AEAFEA', '#EBAEAE', '#CE7B3D', '#8743E0', '#5233F0'];\n\nconst IGVThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const igv: ThemeDeep = {\n base: 'igv',\n\n root: {\n background: 'white',\n titleColor: 'white',\n //titleFontSize:'',\n //titleFontFamily:'',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n titleBackgroundColor: '#5f5f5f',\n subtitleColor: '#3b3b3b',\n //subtitleFontSize:'',\n //subtitleFontFamily:'',\n subtitleAlign: 'left',\n subtitleFontWeight: 'bold',\n subtitleBackgroundColor: '#c4c4c4',\n showMousePosition: true,\n mousePositionColor: 'black'\n },\n\n track: {\n background: 'white',\n alternatingBackground: '#e8e8e8',\n titleColor: 'white',\n titleBackground: '#5F5F5F',\n //titleFontSize:'',\n //titleAlign:'',\n outline: '#5F5F5F',\n outlineWidth: 1\n },\n\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 1,\n labelColor: 'black',\n //labelFontSize: '',\n //labelFontWeight: '',\n //labelFontFamily: '',\n backgroundStroke: 'black',\n tickColor: 'black'\n },\n\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n //labelFontSize: '',\n //labelFontWeight: '',\n //labelFontFamily: '',\n //baselineColor: '#E6E6E6',\n baselineColor: 'white',\n gridColor: 'transparent',\n gridStrokeWidth: 0\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...IGVThemeMarkCommonStyle\n },\n point: {\n ...IGVThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...IGVThemeMarkCommonStyle\n },\n triangle: {\n ...IGVThemeMarkCommonStyle\n },\n area: {\n ...IGVThemeMarkCommonStyle\n },\n line: {\n ...IGVThemeMarkCommonStyle\n },\n bar: {\n ...IGVThemeMarkCommonStyle\n },\n rule: {\n ...IGVThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...IGVThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...IGVThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'bold'\n },\n brush: {\n ...IGVThemeMarkCommonStyle,\n color: 'white',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = [\n '#CD9B1D',\n '#8A668B',\n '#40E0D0',\n '#FF6969',\n '#666666',\n '#FAC902',\n '#FE0000',\n '#CC96CD',\n '#D9D9D9' /*'#000000'*/\n];\n\nconst EnsemblThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const ensembl: ThemeDeep = {\n base: 'ensembl',\n\n root: {\n background: 'white',\n titleColor: '#494949',\n titleFontSize: 24,\n titleFontFamily: 'GGX88',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n titleBackgroundColor: 'white',\n subtitleColor: 'white',\n subtitleFontSize: 19,\n subtitleFontFamily: 'GGX88',\n subtitleAlign: 'left',\n subtitleFontWeight: 'normal',\n subtitleBackgroundColor: '#7B8BAF',\n mousePositionColor: '#FE0000',\n showMousePosition: true\n },\n\n track: {\n background: 'white',\n alternatingBackground: '#fffdf7',\n titleColor: 'black',\n titleBackground: 'white',\n titleAlign: 'left',\n outline: '#7B8BAF',\n outlineWidth: 2\n },\n\n legend: {\n tickColor: 'black',\n labelColor: 'black',\n //labelFontSize: ,\n labelFontWeight: 'normal',\n labelFontFamily: 'GGX88',\n background: 'white',\n backgroundOpacity: 2,\n backgroundStroke: 'lightgray'\n },\n\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n //labelFontSize: ,\n //labelFontWeight: '',\n labelFontFamily: 'GGX88',\n baselineColor: 'black',\n gridColor: '#7B8BAF',\n gridStrokeWidth: 2\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...EnsemblThemeMarkCommonStyle\n },\n point: {\n ...EnsemblThemeMarkCommonStyle,\n /*color: NOMINAL_COLOR[0],\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n size: 3\n },\n rect: {\n ...EnsemblThemeMarkCommonStyle\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n },\n triangle: {\n ...EnsemblThemeMarkCommonStyle\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n },\n area: {\n ...EnsemblThemeMarkCommonStyle\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n },\n line: {\n ...EnsemblThemeMarkCommonStyle\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n },\n bar: {\n ...EnsemblThemeMarkCommonStyle\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n },\n rule: {\n ...EnsemblThemeMarkCommonStyle,\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n strokeWidth: 1\n },\n link: {\n ...EnsemblThemeMarkCommonStyle,\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n strokeWidth: 1\n },\n text: {\n ...EnsemblThemeMarkCommonStyle,\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...EnsemblThemeMarkCommonStyle,\n /*size: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n color: 'gray',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#3A62FE', '#F85353', '#3A62FE', '#F85353', '#DCA326', '#03BF06', '#BABABA' /*'#000000'*/];\n\nconst JBrowseThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const jbrowse: ThemeDeep = {\n base: 'jbrowse',\n\n root: {\n background: 'white',\n titleColor: 'white',\n titleFontSize: 20,\n titleFontFamily: 'Roboto',\n titleAlign: 'middle',\n titleFontWeight: 'normal',\n titleBackgroundColor: '#0b243f',\n subtitleColor: 'white',\n subtitleFontSize: 18,\n subtitleFontFamily: 'Roboto',\n subtitleAlign: 'middle',\n subtitleFontWeight: 'normal',\n subtitleBackgroundColor: '#732162',\n showMousePosition: true,\n mousePositionColor: '#000000'\n },\n\n track: {\n background: 'white',\n alternatingBackground: 'white',\n //titleFontSize:'',\n titleAlign: 'middle',\n titleColor: 'white',\n titleBackground: '#0B243F',\n outline: 'black',\n outlineWidth: 1\n },\n\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: '#DCA326',\n //labelFontSize: '',\n labelFontWeight: 'bold',\n labelFontFamily: 'Roboto',\n backgroundStroke: '#black',\n tickColor: 'black'\n },\n\n axis: {\n tickColor: 'black',\n labelColor: '#DCA326',\n //labelFontSize: '',\n labelFontWeight: 'bold',\n labelFontFamily: 'Roboto',\n baselineColor: 'black',\n gridColor: '#c5d5d9',\n gridStrokeWidth: 1 //,\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...JBrowseThemeMarkCommonStyle\n },\n point: {\n ...JBrowseThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...JBrowseThemeMarkCommonStyle\n },\n triangle: {\n ...JBrowseThemeMarkCommonStyle\n },\n area: {\n ...JBrowseThemeMarkCommonStyle\n },\n line: {\n ...JBrowseThemeMarkCommonStyle\n },\n bar: {\n ...JBrowseThemeMarkCommonStyle\n },\n rule: {\n ...JBrowseThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...JBrowseThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...JBrowseThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...JBrowseThemeMarkCommonStyle,\n color: '#c5d5d9',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = [\n '#3A5FCD',\n '#FFA54E',\n '#8FBC8F',\n '#B6709B',\n '#EE6A50',\n '#CCB79E',\n '#DADA8F',\n '#00CDCC',\n '#EED5D2',\n '#CD8EDD',\n '#9ACD31',\n '#D1BEA8',\n '#FFB6C0' /*'#000000'*/\n];\n\nconst UCSCThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const ucsc: ThemeDeep = {\n base: 'ucsc',\n\n root: {\n background: 'white',\n titleColor: 'white',\n titleFontSize: 22,\n //titleFontFamily:'',\n titleAlign: 'middle',\n titleFontWeight: 'bold',\n titleBackgroundColor: '#00457c',\n subtitleColor: 'black',\n //subtitleFontSize:'',\n //subtitleFontFamily:'',\n subtitleAlign: 'middle',\n subtitleFontWeight: 'bold',\n subtitleBackgroundColor: 'white',\n showMousePosition: true,\n mousePositionColor: '#FE0000'\n },\n\n track: {\n background: 'white',\n alternatingBackground: '#e3f7fc',\n titleColor: '#3A5FCD',\n titleBackground: 'white',\n //titleFontSize:'',\n //titleAlign:'',\n outline: 'black',\n outlineWidth: 1\n },\n\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: 'black',\n //labelFontSize: '',\n labelFontWeight: 'bold',\n //labelFontFamily: '',\n backgroundStroke: '#DBDBDB',\n tickColor: 'black'\n },\n\n axis: {\n tickColor: 'black',\n labelColor: '#3A5FCD',\n //labelFontSize: '',\n labelFontWeight: 'bold',\n //labelFontFamily: '',\n baselineColor: 'black',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1 //,\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...UCSCThemeMarkCommonStyle\n },\n point: {\n ...UCSCThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...UCSCThemeMarkCommonStyle\n },\n triangle: {\n ...UCSCThemeMarkCommonStyle\n },\n area: {\n ...UCSCThemeMarkCommonStyle\n },\n line: {\n ...UCSCThemeMarkCommonStyle\n },\n bar: {\n ...UCSCThemeMarkCommonStyle\n },\n rule: {\n ...UCSCThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...UCSCThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...UCSCThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...UCSCThemeMarkCommonStyle,\n color: 'gray',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = [\n '#6E12AC',\n '#15C250',\n '#E70FB1',\n '#FF8E55',\n '#A3B8F3',\n '#DE5E59',\n '#77AAAA',\n '#F5CCCA' /*'#000000'*/\n];\n\nconst WashUThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const washu: ThemeDeep = {\n base: 'washu',\n\n root: {\n background: 'white',\n titleColor: 'gray',\n //titleFontSize:16,\n //titleFontFamily:'',\n titleAlign: 'left',\n titleFontWeight: 'normal',\n titleBackgroundColor: 'white',\n subtitleColor: 'lightgray',\n //subtitleFontSize:12,\n //subtitleFontFamily:'',\n subtitleAlign: 'left',\n subtitleFontWeight: 'light',\n subtitleBackgroundColor: 'white',\n showMousePosition: true,\n mousePositionColor: '#000000'\n },\n\n track: {\n background: 'white',\n //alternatingBackground:'',\n titleColor: 'gray',\n titleBackground: 'white',\n //titleFontSize:'',\n titleAlign: 'left',\n outline: 'gray',\n outlineWidth: 1\n },\n\n legend: {\n background: 'white',\n backgroundOpacity: 0.5,\n labelColor: 'gray',\n //labelFontSize: '',\n labelFontWeight: 'light',\n //labelFontFamily: '',\n backgroundStroke: '#DBDBDB',\n tickColor: 'gray'\n },\n\n axis: {\n tickColor: 'lightgray',\n labelColor: 'gray',\n //labelFontSize: '',\n labelFontWeight: 'light',\n //labelFontFamily: '',\n baselineColor: 'gray',\n gridColor: 'transparent',\n gridStrokeWidth: 0 //,\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...WashUThemeMarkCommonStyle\n },\n point: {\n ...WashUThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...WashUThemeMarkCommonStyle\n },\n triangle: {\n ...WashUThemeMarkCommonStyle\n },\n area: {\n ...WashUThemeMarkCommonStyle\n },\n line: {\n ...WashUThemeMarkCommonStyle\n },\n bar: {\n ...WashUThemeMarkCommonStyle\n },\n rule: {\n ...WashUThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...WashUThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...WashUThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...WashUThemeMarkCommonStyle,\n color: 'gray',\n opacity: 0.3,\n stroke: 'gray',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = [\n '#ED7D31',\n '#4472C4',\n '#FFC207',\n '#76AE4F',\n '#9E480E',\n '#A5A5A5',\n '#4472C4',\n '#264378',\n '#76AE4F',\n '#5B9CD5' /*'#000000'*/\n];\n\nconst ExcelThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: '#5A5A5A',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const excel: ThemeDeep = {\n base: 'excel',\n\n root: {\n background: 'white',\n titleColor: '#5A5A5A',\n titleFontSize: 30,\n titleFontFamily: 'Calibri',\n titleAlign: 'middle',\n titleFontWeight: 'bold',\n titleBackgroundColor: 'white',\n subtitleColor: '#5A5A5A',\n subtitleFontSize: 22,\n subtitleFontFamily: 'Calibri',\n subtitleAlign: 'middle',\n subtitleFontWeight: 'bold',\n subtitleBackgroundColor: 'white',\n showMousePosition: true,\n mousePositionColor: '#000000'\n },\n\n track: {\n background: 'white',\n alternatingBackground: '#f5f5f5',\n titleColor: '#5A5A5A',\n titleBackground: 'white',\n //titleFontSize:'',\n //titleAlign:'',\n outline: '#5A5A5A',\n outlineWidth: 1\n },\n\n legend: {\n position: 'right',\n tickColor: '#5A5A5A',\n labelColor: '#5A5A5A',\n labelFontSize: 12,\n labelFontWeight: 'bold',\n labelFontFamily: 'Calibri',\n background: 'white',\n backgroundOpacity: 0.7,\n backgroundStroke: '#5A5A5A'\n },\n\n axis: {\n tickColor: '#5A5A5A',\n labelColor: '#5A5A5A',\n //labelFontSize: '',\n //labelFontWeight: '',\n labelFontFamily: 'Calibri',\n baselineColor: '#5A5A5A',\n gridColor: '#5A5A5A',\n gridStrokeWidth: 1\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...ExcelThemeMarkCommonStyle\n },\n point: {\n ...ExcelThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...ExcelThemeMarkCommonStyle\n },\n triangle: {\n ...ExcelThemeMarkCommonStyle\n },\n area: {\n ...ExcelThemeMarkCommonStyle\n },\n line: {\n ...ExcelThemeMarkCommonStyle\n },\n bar: {\n ...ExcelThemeMarkCommonStyle\n },\n rule: {\n ...ExcelThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...ExcelThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...ExcelThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...ExcelThemeMarkCommonStyle,\n color: '#5A5A5A',\n opacity: 0.3,\n stroke: '#5A5A5A',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#4185f4', '#DB4437', '#F4B400', '#0D9D58', '#AA30C3', '#FF6E02', '#CBC74C' /*'#000000'*/];\n\nconst GoogleThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 2,\n stroke: 'black',\n strokeWidth: 0.3,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const google: ThemeDeep = {\n base: 'google',\n\n root: {\n background: 'white',\n titleColor: '#454545',\n titleFontSize: 20,\n titleFontFamily: 'Arial',\n titleAlign: 'left',\n titleFontWeight: 'normal',\n titleBackgroundColor: 'white',\n subtitleColor: '#7d7d7d',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleAlign: 'left',\n subtitleFontWeight: 'light',\n subtitleBackgroundColor: 'white',\n showMousePosition: true,\n mousePositionColor: '#000000'\n },\n\n track: {\n background: 'white',\n alternatingBackground: '#f5f5f5',\n titleColor: '#e8e8e8',\n titleBackground: 'white',\n titleFontSize: 12,\n titleAlign: 'left',\n outline: 'black',\n outlineWidth: 1\n },\n\n legend: {\n position: 'right',\n background: 'white',\n backgroundOpacity: 1,\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: 'black',\n tickColor: 'black'\n },\n\n axis: {\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n tickColor: 'black',\n labelColor: 'black',\n baselineColor: 'black',\n gridColor: 'black',\n gridStrokeWidth: 1 //,\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...GoogleThemeMarkCommonStyle\n },\n point: {\n ...GoogleThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...GoogleThemeMarkCommonStyle\n },\n triangle: {\n ...GoogleThemeMarkCommonStyle\n },\n area: {\n ...GoogleThemeMarkCommonStyle\n },\n line: {\n ...GoogleThemeMarkCommonStyle\n },\n bar: {\n ...GoogleThemeMarkCommonStyle\n },\n rule: {\n ...GoogleThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...GoogleThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...GoogleThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...GoogleThemeMarkCommonStyle,\n color: '#999999',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 0.7\n }\n};\n","// Individual Themes\n// Based on https://github.com/gosling-lang/gosling.js/blob/58121b0d536e34c02cea9b2c046cc9efa734fe94/src/core/utils/theme.ts#L5\nimport { light } from './light';\nimport { dark } from './dark';\nimport { warm } from './warm';\nimport { ggplot } from './ggplot';\nimport { igv } from './igv';\nimport { ensembl } from './ensembl';\nimport { jbrowse } from './jbrowse';\nimport { ucsc } from './ucsc';\nimport { washu } from './washu';\nimport { excel } from './excel';\nimport { google } from './google';\n\nexport const Themes = {\n light,\n dark,\n warm,\n ggplot,\n igv,\n ensembl,\n jbrowse,\n ucsc,\n washu,\n excel,\n google\n};\n\nexport function isThereTheme(key: string) {\n return Object.keys(Themes).indexOf(key) !== -1;\n}\n\nexport function getTheme(key: string) {\n return isThereTheme(key) ? (Themes as any)[key] : Themes['light'];\n}\n","import type * as HiGlass from '@higlass/types';\n\nexport type PluginTrackFactory = (\n HGC: HiGlass.HGC,\n context: HiGlass.Context,\n options: Options\n) => HiGlass.Track;\n\ntype AsConstructor = T extends (...args: infer Args) => infer Ret ? { new (...args: Args): Ret } : never;\n\ntype PluginTrack = AsConstructor> & {\n config: HiGlass.TrackConfig;\n};\n\nexport type TrackConfig = Omit, 'availableOptions'>;\n\nexport function createPluginTrack(\n config: TrackConfig,\n factory: PluginTrackFactory\n) {\n function Track(...args: Parameters) {\n if (!new.target) {\n throw new Error('Uncaught TypeError: Class constructor cannot be invoked without \"new\"');\n }\n return factory(...args);\n }\n Track.config = {\n ...config,\n availableOptions: Object.keys(config.defaultOptions ?? {})\n };\n return Track as unknown as PluginTrack & {\n config: {\n // code above ensures this field is always defined when using the plugin.\n availableOptions: (keyof Options)[];\n };\n };\n}\n","// This plugin track is based on higlass/HorizontalChromosomeLabels\n// https://github.com/higlass/higlass/blob/83dc4fddb33582ef3c26b608c04a81e8f33c7f5f/app/scripts/HorizontalChromosomeLabels.js\n\nimport type * as PIXI from 'pixi.js';\nimport RBush from 'rbush';\nimport { scaleLinear } from 'd3-scale';\nimport { format, precisionPrefix, formatPrefix } from 'd3-format';\nimport { computeChromSizes } from '../../core/utils/assembly';\nimport { cartesianToPolar } from '../../core/utils/polar';\nimport { getTextStyle } from '../../core/utils/text-style';\nimport { createPluginTrack } from '../../core/utils/define-plugin-track';\n\nimport type { TextStyle } from '../../core/utils/text-style';\nimport type { PluginTrackFactory, TrackConfig } from '../../core/utils/define-plugin-track';\nimport type { Assembly } from '@gosling-lang/gosling-schema';\n\nconst TICK_WIDTH = 200;\nconst TICK_HEIGHT = 6;\nconst TICK_TEXT_SEPARATION = 2;\nconst TICK_COLOR = 0x777777;\n\ntype AxisTrackOptions = {\n innerRadius: number;\n outerRadius: number;\n startAngle: number;\n endAngle: number;\n width: number;\n height: number;\n layout: 'linear' | 'circular';\n labelMargin: number;\n excludeChrPrefix: boolean;\n labelPosition: string;\n labelColor: string;\n labelTextOpacity: number;\n trackBorderWidth: number;\n trackBorderColor: string;\n tickPositions: 'even' | 'ends';\n fontSize: number;\n fontFamily: string; // 'Arial',\n fontWeight: NonNullable;\n color: string;\n stroke: string;\n backgroundColor: string;\n showMousePosition: boolean;\n tickColor: number;\n tickFormat?: string;\n assembly?: Assembly;\n reverseOrientation?: boolean;\n};\ntype TickLabelInfo = {\n importance: number;\n text: PIXI.Text;\n rope?: PIXI.SimpleRope;\n};\ntype TickLine = [number, number, number, number];\ntype TickText = PIXI.Text & { hashValue: number; tickLine?: TickLine };\ntype ChrPosInfo = { chr: string; pos: number };\ntype ChromInfo = {\n chrPositions: Record;\n chromLengths: Record;\n cumPositions: ChrPosInfo[];\n};\n\n// TODO: Change the icon\nconst icon =\n ' ';\n\nconst config: TrackConfig = {\n type: 'axis-track',\n datatype: ['multivec', 'epilogos'],\n local: false,\n orientation: '1d-horizontal',\n thumbnail: new DOMParser().parseFromString(icon, 'text/xml').documentElement,\n defaultOptions: {\n innerRadius: 340,\n outerRadius: 310,\n startAngle: 0,\n endAngle: 360,\n width: 700,\n height: 700,\n layout: 'linear',\n labelMargin: 5,\n excludeChrPrefix: false,\n labelPosition: 'none',\n labelColor: 'black',\n labelTextOpacity: 0.4,\n trackBorderWidth: 0,\n trackBorderColor: 'black',\n tickPositions: 'even',\n fontSize: 12,\n fontFamily: 'sans-serif', // 'Arial',\n fontWeight: 'normal',\n color: '#808080',\n stroke: '#ffffff',\n backgroundColor: 'transparent',\n showMousePosition: false,\n tickColor: TICK_COLOR\n }\n};\n\nconst factory: PluginTrackFactory = (HGC, context, options) => {\n const { absToChr, colorToHex, pixiTextToSvg, svgLine, showMousePosition } = HGC.utils;\n\n function createTickText(text: string, style: Partial): TickText {\n return Object.assign(new HGC.libraries.PIXI.Text(text, style), { hashValue: Math.random() });\n }\n\n class AxisTrackClass extends HGC.tracks.PixiTrack {\n allTexts: TickLabelInfo[];\n searchField: null;\n chromInfo: ChromInfo;\n dataConfig: Record;\n pTicksCircular: PIXI.Graphics;\n pTicks: PIXI.Graphics | null;\n gTicks: Record;\n tickTexts: Record;\n\n isShowGlobalMousePosition: () => boolean;\n\n pixiTextConfig: ReturnType;\n stroke: number;\n\n tickWidth: number;\n tickHeight: number;\n tickTextSeparation: number;\n tickColor: number;\n\n animate: () => void;\n\n hideMousePosition?: ReturnType;\n\n gBoundTicks?: PIXI.Graphics;\n leftBoundTick?: TickText;\n rightBoundTick?: TickText;\n\n is2d?: boolean;\n texts?: TickText[];\n\n constructor() {\n super(context, options);\n const { dataConfig, animate, chromInfoPath, isShowGlobalMousePosition } = context;\n\n this.searchField = null;\n this.dataConfig = dataConfig;\n\n this.allTexts = [];\n\n this.pTicksCircular = new HGC.libraries.PIXI.Graphics();\n this.pTicks = new HGC.libraries.PIXI.Graphics();\n this.pMain.addChild(this.pTicks);\n this.pMain.addChild(this.pTicksCircular);\n\n this.gTicks = {};\n this.tickTexts = {};\n\n this.options = options;\n this.isShowGlobalMousePosition = isShowGlobalMousePosition;\n\n this.pixiTextConfig = getTextStyle({\n size: +this.options.fontSize,\n fontFamily: this.options.fontFamily,\n fontWeight: this.options.fontWeight,\n color: this.options.color,\n stroke: this.options.stroke,\n strokeThickness: 2\n });\n this.stroke = colorToHex(this.pixiTextConfig.stroke);\n\n // text objects to use if the tick style is \"bounds\", meaning\n // we only draw two ticks on the left and the right of the screen\n\n this.tickWidth = TICK_WIDTH;\n this.tickHeight = TICK_HEIGHT;\n this.tickTextSeparation = TICK_TEXT_SEPARATION;\n this.tickColor = colorToHex(this.options.tickColor);\n\n this.animate = animate;\n\n this.pubSubs = [];\n\n if (this.options.showMousePosition && !this.hideMousePosition) {\n this.hideMousePosition = showMousePosition(this, this.is2d, this.isShowGlobalMousePosition());\n }\n\n let chromSizesPath = chromInfoPath;\n\n if (!chromSizesPath) {\n chromSizesPath = `${dataConfig.server}/chrom-sizes/?id=${dataConfig.tilesetUid}`;\n }\n\n // Example:\n // chrPositions: {\n // chr1: { chr: \"chr1\", pos: 0 },\n // chr2: { chr: \"chr2\", pos: 1000 },\n // },\n // chromLengths: {\n // chr1: 1000,\n // chr2: 1000\n // },\n // cumPositions: [\n // { chr: \"chr1\", pos: 0 },\n // { chr: \"chr2\", pos: 1000 },\n // ]\n\n const assembly = this.options.assembly;\n const chrPositions: { [k: string]: ChrPosInfo } = {};\n const chromLengths: { [k: string]: number } = { ...computeChromSizes(assembly).size };\n const cumPositions: ChrPosInfo[] = [];\n\n Object.keys(computeChromSizes(assembly).size).forEach(k => {\n chrPositions[k] = { chr: k, pos: computeChromSizes(assembly).size[k] };\n });\n\n Object.keys(computeChromSizes(assembly).interval).forEach(k => {\n cumPositions.push({ chr: k, pos: computeChromSizes(assembly).interval[k][0] });\n });\n\n this.chromInfo = { chrPositions, chromLengths, cumPositions };\n\n this.rerender(this.options, true);\n this.draw();\n this.animate();\n }\n\n initBoundsTicks() {\n if (this.pTicks) {\n this.pMain.removeChild(this.pTicks);\n this.pTicks = null;\n }\n\n if (!this.gBoundTicks) {\n this.gBoundTicks = new HGC.libraries.PIXI.Graphics();\n\n this.leftBoundTick = createTickText('', this.pixiTextConfig);\n this.rightBoundTick = createTickText('', this.pixiTextConfig);\n\n this.gBoundTicks.addChild(this.leftBoundTick);\n this.gBoundTicks.addChild(this.rightBoundTick);\n\n this.pMain.addChild(this.gBoundTicks);\n }\n\n this.texts = [];\n }\n\n initChromLabels() {\n if (!this.chromInfo) return;\n\n if (this.gBoundTicks) {\n this.pMain.removeChild(this.gBoundTicks);\n this.gBoundTicks = undefined;\n }\n\n if (!this.pTicks) {\n this.pTicks = new HGC.libraries.PIXI.Graphics();\n this.pMain.addChild(this.pTicks);\n }\n\n this.texts = [];\n this.pTicks.removeChildren();\n\n this.chromInfo.cumPositions.forEach((info: any) => {\n const chromName = info.chr;\n this.gTicks[chromName] = new HGC.libraries.PIXI.Graphics();\n\n // create the array that will store tick TEXT objects\n if (!this.tickTexts[chromName]) this.tickTexts[chromName] = [];\n\n // Give each PIXI text object a random hash so that some get hidden when there's overlaps\n const chromNameText = this.options.excludeChrPrefix ? chromName.replace('chr', '') : chromName;\n const text = createTickText(chromNameText, this.pixiTextConfig);\n\n this.pTicks?.addChild(text);\n this.pTicks?.addChild(this.gTicks[chromName]);\n\n this.texts?.push(text);\n });\n }\n\n rerender(options: any, force: boolean) {\n const strOptions = JSON.stringify(options);\n\n if (!force && strOptions === this.prevOptions) return;\n\n this.prevOptions = strOptions;\n this.options = options;\n\n this.pixiTextConfig.fontSize = +this.options.fontSize\n ? (`${+this.options.fontSize}px` as const)\n : this.pixiTextConfig.fontSize;\n this.pixiTextConfig.fill = this.options.color || this.pixiTextConfig.fill;\n this.pixiTextConfig.stroke = this.options.stroke || this.pixiTextConfig.stroke;\n this.stroke = colorToHex(this.pixiTextConfig.stroke as string);\n\n this.tickColor = this.options.tickColor ? colorToHex(this.options.tickColor) : TICK_COLOR;\n\n if (this.options.tickPositions === 'ends' && this.options.layout !== 'circular') {\n this.initBoundsTicks();\n } else {\n this.initChromLabels();\n }\n\n super.rerender(options, force);\n\n if (this.options.showMousePosition && !this.hideMousePosition) {\n this.hideMousePosition = showMousePosition(this, this.is2d, this.isShowGlobalMousePosition());\n }\n\n if (!this.options.showMousePosition && this.hideMousePosition) {\n this.hideMousePosition();\n this.hideMousePosition = undefined;\n }\n }\n\n formatTick(pos: number) {\n if (isNaN(pos)) {\n // the value is not proper, so early return\n return 'null';\n }\n\n const domain = this._xScale.domain();\n\n const viewWidth = domain[1] - domain[0];\n\n const p = precisionPrefix(pos, viewWidth);\n\n const fPlain = format(',');\n const fPrecision = formatPrefix(`,.${p}`, viewWidth);\n let f = fPlain;\n\n if (this.options.tickFormat === 'si') {\n f = fPrecision;\n } else if (this.options.tickFormat === 'plain') {\n f = fPlain;\n } else if (this.options.tickPositions === 'ends') {\n // if no format is specified but tickPositions are at 'ends'\n // then use precision format\n f = fPrecision;\n }\n\n return f(pos);\n }\n\n /** Show two labels at the end of both left and right sides */\n drawBoundsTicks(x1: ReturnType, x2: ReturnType) {\n if (!this.gBoundTicks || !this.leftBoundTick || !this.rightBoundTick) return;\n const graphics = this.gBoundTicks;\n graphics.clear();\n graphics.lineStyle(1, 0);\n\n // determine the stard and end positions of tick lines along the vertical axis\n const lineYStart = this.options.reverseOrientation ? 0 : this.dimensions[1];\n const lineYEnd = this.options.reverseOrientation ? this.tickHeight : this.dimensions[1] - this.tickHeight;\n\n // left tick\n // line is offset by one because it's right on the edge of the\n // visible region and we want to get the full width\n graphics.moveTo(1, lineYStart);\n graphics.lineTo(1, lineYEnd);\n\n // right tick\n graphics.moveTo(this.dimensions[0] - 1, lineYStart);\n graphics.lineTo(this.dimensions[0] - 1, lineYEnd);\n\n // we want to control the precision of the tick labels\n // so that we don't end up with labels like 15.123131M\n this.leftBoundTick.x = 0;\n this.leftBoundTick.y = this.options.reverseOrientation\n ? lineYEnd + this.tickTextSeparation\n : lineYEnd - this.tickTextSeparation;\n this.leftBoundTick.text =\n this.options.assembly === 'unknown'\n ? `${this.formatTick(x1[1])}`\n : `${x1[0]}: ${this.formatTick(x1[1])}`;\n this.leftBoundTick.anchor.y = this.options.reverseOrientation ? 0 : 1;\n\n this.rightBoundTick.x = this.dimensions[0];\n this.rightBoundTick.text =\n this.options.assembly === 'unknown'\n ? `${this.formatTick(x2[1])}`\n : `${x2[0]}: ${this.formatTick(x2[1])}`;\n this.rightBoundTick.y = this.options.reverseOrientation\n ? lineYEnd + this.tickTextSeparation\n : lineYEnd - this.tickTextSeparation;\n this.rightBoundTick.anchor.y = this.options.reverseOrientation ? 0 : 1;\n\n this.rightBoundTick.anchor.x = 1;\n\n if (this.flipText) {\n // this means this track is displayed vertically, so update the anchor and scale of labels to make them readable!\n this.leftBoundTick.scale.x = -1;\n this.leftBoundTick.anchor.x = 1;\n this.rightBoundTick.scale.x = -1;\n this.rightBoundTick.anchor.x = 0;\n }\n\n // line is offset by one because it's right on the edge of the visible region and we want to get the full width\n this.leftBoundTick.tickLine = [1, this.dimensions[1], 1, this.dimensions[1] - this.tickHeight];\n this.rightBoundTick.tickLine = [\n this.dimensions[0] - 1,\n this.dimensions[1],\n this.dimensions[0] - 1,\n this.dimensions[1] - this.tickHeight\n ];\n\n this.tickTexts = {};\n this.tickTexts.all = [this.leftBoundTick, this.rightBoundTick];\n // this.rightBoundTick\n }\n\n drawTicks(cumPos: { chr: string; pos: number }) {\n const graphics = this.gTicks[cumPos.chr];\n\n graphics.visible = true;\n\n // clear graphics *and* ticktexts otherwise the two are out of sync!\n graphics.clear();\n\n const chromLen = +this.chromInfo.chromLengths[cumPos.chr];\n\n const vpLeft = Math.max(this._xScale(cumPos.pos), 0);\n const vpRight = Math.min(this._xScale(cumPos.pos + chromLen), this.dimensions[0]);\n\n const numTicks = (vpRight - vpLeft) / this.tickWidth;\n\n // what is the domain of this chromosome that is visible?\n const xScale = scaleLinear()\n .domain([\n Math.max(1, this._xScale.invert(0) - cumPos.pos),\n Math.min(chromLen, this._xScale.invert(this.dimensions[0]) - cumPos.pos)\n ])\n .range([vpLeft, vpRight]);\n\n // calculate a certain number of ticks\n const ticks = xScale.ticks(numTicks).filter(tick => Number.isInteger(tick));\n\n // not sure why we're separating these out by chromosome, but ok\n const tickTexts = this.tickTexts[cumPos.chr];\n\n const tickHeight = this.tickHeight;\n\n const xPadding = 0;\n\n let yPadding = tickHeight + this.tickTextSeparation;\n\n if (this.options.reverseOrientation) {\n yPadding = this.dimensions[1] - yPadding;\n }\n\n // these two loops reuse existing text objects so that we're not constantly recreating texts that already exist\n while (tickTexts.length < ticks.length) {\n const newText = createTickText('', this.pixiTextConfig);\n tickTexts.push(newText);\n this.gTicks[cumPos.chr].addChild(newText);\n }\n\n while (tickTexts.length > ticks.length) {\n const text = tickTexts.pop();\n this.gTicks[cumPos.chr].removeChild(text!);\n }\n\n let i = 0;\n while (i < ticks.length) {\n tickTexts[i].visible = true;\n\n tickTexts[i].anchor.x = 0.5;\n tickTexts[i].anchor.y =\n this.options.layout === 'circular' ? 0 : this.options.reverseOrientation ? 0 : 1;\n\n if (this.flipText) tickTexts[i].scale.x = -1;\n\n const chrText = this.options.assembly === 'unknown' ? '' : `${cumPos.chr}: `;\n tickTexts[i].text = ticks[i] === 0 ? `${chrText}1` : `${chrText}${this.formatTick(ticks[i])}`;\n\n const x = this._xScale(cumPos.pos + ticks[i]);\n\n // show the tick text labels\n if (this.options.layout === 'circular') {\n const rope = this.addCurvedText(tickTexts[i], x + xPadding);\n rope && this.pTicksCircular.addChild(rope);\n } else {\n tickTexts[i].x = x + xPadding;\n tickTexts[i].y = this.dimensions[1] - yPadding;\n\n // store the position of the tick line so that it can be used in the export function\n // TODO:\n tickTexts[i].tickLine = [x - 1, this.dimensions[1], x - 1, this.dimensions[1] - tickHeight - 1];\n\n // draw outline\n const lineYStart = this.options.reverseOrientation ? 0 : this.dimensions[1];\n const lineYEnd = this.options.reverseOrientation ? tickHeight : this.dimensions[1] - tickHeight;\n // graphics.lineStyle(1, this.stroke);\n // graphics.moveTo(x - 1, lineYStart);\n // graphics.lineTo(x - 1, lineYEnd - 1);\n // graphics.lineTo(x + 1, lineYEnd - 1);\n // graphics.lineTo(x + 1, lineYStart);\n\n // draw the vertical tick lines\n graphics.lineStyle(1, this.tickColor);\n graphics.moveTo(x, lineYStart);\n graphics.lineTo(x, lineYEnd);\n }\n\n i += 1;\n }\n\n if (this.options.layout === 'circular') i = 0;\n while (i < tickTexts.length) {\n // we don't need this text so we'll turn it off for now\n tickTexts[i].visible = false;\n\n i += 1;\n }\n\n return ticks.length;\n }\n\n addCurvedText(textObj: PIXI.Text, cx: number) {\n const [width, height] = this.dimensions;\n const { startAngle, endAngle } = this.options;\n const factor = Math.min(width, height) / Math.min(this.options.width, this.options.height);\n const innerRadius = this.options.innerRadius * factor;\n const outerRadius = this.options.outerRadius * factor;\n\n const r = (outerRadius + innerRadius) / 2.0;\n const centerPos = cartesianToPolar(cx, width, r, width / 2.0, height / 2.0, startAngle, endAngle);\n textObj.x = centerPos.x;\n textObj.y = centerPos.y;\n\n textObj.resolution = 4;\n const txtStyle = new HGC.libraries.PIXI.TextStyle(this.pixiTextConfig);\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(textObj.text, txtStyle);\n\n // scale the width of text label so that its width is the same when converted into circular form\n const tw = ((metric.width / (2 * r * Math.PI)) * width * 360) / (endAngle - startAngle);\n let [minX, maxX] = [cx - tw / 2.0, cx + tw / 2.0];\n\n // make sure not to place the label on the origin\n if (minX < 0) {\n const gap = -minX;\n minX = 0;\n maxX += gap;\n } else if (maxX > width) {\n const gap = maxX - width;\n maxX = width;\n minX -= gap;\n }\n\n const ropePoints: PIXI.Point[] = [];\n const baseR = innerRadius + metric.height / 2.0 + 3;\n for (let i = maxX; i >= minX; i -= tw / 10.0) {\n const p = cartesianToPolar(i, width, baseR, width / 2.0, height / 2.0, startAngle, endAngle);\n ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y));\n }\n\n if (ropePoints.length === 0) {\n return undefined;\n }\n\n // @ts-expect-error missing argument\n textObj.updateText();\n const rope = new HGC.libraries.PIXI.SimpleRope(textObj.texture, ropePoints);\n return rope;\n }\n\n draw() {\n this.allTexts = [];\n\n if (!this.texts) return;\n\n const x1 = absToChr(this._xScale.domain()[0], this.chromInfo);\n const x2 = absToChr(this._xScale.domain()[1], this.chromInfo);\n\n if (!x1 || !x2) {\n console.warn('Empty chromInfo:', this.dataConfig, this.chromInfo);\n return;\n }\n\n if (this.options.tickPositions === 'ends' && this.options.layout !== 'circular') {\n // We only support linear layouts for this.\n if (!this.gBoundTicks) return;\n\n this.gBoundTicks.visible = true;\n\n this.drawBoundsTicks(x1, x2);\n\n return;\n }\n\n if (!this.pTicks) {\n // options.tickPositiosn was probably just changed to 'even' and initChromLabels hasn't been called yet\n return;\n }\n\n const circular = this.options.layout === 'circular';\n\n for (let i = 0; i < this.texts.length; i++) {\n this.texts[i].visible = false;\n this.gTicks[this.chromInfo.cumPositions[i].chr].visible = false;\n }\n\n let yPadding = this.tickHeight + this.tickTextSeparation;\n\n if (this.options.reverseOrientation) {\n yPadding = this.dimensions[1] - yPadding;\n }\n\n // hide all the chromosome labels in preparation for drawing new ones\n Object.keys(this.chromInfo.chrPositions).forEach(chrom => {\n if (this.tickTexts[chrom]) {\n this.tickTexts[chrom].forEach((tick: any) => {\n tick.visible = false;\n });\n }\n });\n\n /* tslint:disable */\n this.pTicksCircular.removeChildren();\n\n // iterate over each chromosome\n for (let i = x1[3]; i <= x2[3]; i++) {\n const xCumPos = this.chromInfo.cumPositions[i];\n\n const midX = xCumPos.pos + this.chromInfo.chromLengths[xCumPos.chr] / 2;\n\n const viewportMidX = this._xScale(midX);\n\n // This is ONLY the bare chromosome name. Not the tick label!\n const chrText = this.texts[i];\n\n chrText.anchor.x = 0.5;\n chrText.anchor.y = circular ? 0.5 : this.options.reverseOrientation ? 0 : 1;\n\n let rope: PIXI.SimpleRope | undefined;\n if (circular) {\n rope = this.addCurvedText(chrText, viewportMidX);\n if (rope) {\n this.pTicksCircular.addChild(rope);\n }\n } else {\n chrText.x = viewportMidX;\n chrText.y = this.dimensions[1] - yPadding;\n }\n\n chrText.updateTransform();\n\n if (this.flipText) chrText.scale.x = -1;\n\n const numTicksDrawn = this.drawTicks(xCumPos);\n\n // only show chromsome labels if there's no ticks drawn\n if (!circular) {\n chrText.visible = numTicksDrawn <= 0;\n } else {\n if (numTicksDrawn > 0) {\n rope && this.pTicksCircular.removeChild(rope);\n }\n }\n\n this.allTexts.push({\n importance: chrText.hashValue,\n text: chrText,\n rope\n });\n }\n /* tslint:enable */\n\n // define the edge chromosome which are visible\n this.hideOverlaps(this.allTexts);\n }\n\n hideOverlaps(allTexts: TickLabelInfo[]) {\n const tree = new RBush<{ minX: number; minY: number; maxX: number; maxY: number }>();\n\n // using bounding boxes of the text objects, calculate overlaps\n allTexts\n .sort((a, b) => b.importance - a.importance)\n .forEach(({ text, rope }: any) => {\n text.updateTransform();\n const b = text.getBounds();\n const m = this.options.labelMargin;\n const boxWithMargin = {\n minX: b.x - m,\n minY: b.y - m,\n maxX: b.x + b.width + m * 2,\n maxY: b.y + b.height + m * 2\n };\n if (m < 0 || !tree.collides(boxWithMargin)) {\n // if not overlapping, add a new boundingbox\n tree.insert(boxWithMargin);\n } else {\n // if overlapping, hide text labels\n text.visible = false;\n if (this.options.layout === 'circular' && rope) {\n this.pTicksCircular.removeChild(rope);\n }\n }\n });\n }\n\n setPosition(newPosition: [number, number]) {\n super.setPosition(newPosition);\n\n [this.pMain.position.x, this.pMain.position.y] = this.position;\n }\n\n zoomed(newXScale: any, newYScale: any) {\n const domainValues = [...newXScale.domain(), ...newYScale.domain()];\n if (domainValues.filter(d => isNaN(d)).length !== 0) {\n // we received an invalid scale somehow\n // console.warn('');\n return;\n }\n\n this.xScale(newXScale);\n this.yScale(newYScale);\n\n this.draw();\n }\n\n exportSVG(): [HTMLElement, HTMLElement] {\n let track = null;\n let base = null;\n\n // @ts-expect-error always true because it's defined on HGC.tracks.PixiTrack\n if (super.exportSVG) {\n [base, track] = super.exportSVG();\n } else {\n base = document.createElement('g');\n track = base;\n }\n base.setAttribute('class', 'chromosome-labels');\n\n const output = document.createElement('g');\n track.appendChild(output);\n\n output.setAttribute('transform', `translate(${this.position[0]},${this.position[1]})`);\n\n this.allTexts\n .filter(text => text.text.visible)\n .forEach(text => {\n const g = pixiTextToSvg(text.text);\n output.appendChild(g);\n });\n\n Object.values(this.tickTexts).forEach(texts => {\n texts\n .filter(x => x.visible)\n .forEach(text => {\n if (!text.tickLine) return;\n\n let g = pixiTextToSvg(text);\n output.appendChild(g);\n g = svgLine(\n text.x,\n this.options.reverseOrientation ? 0 : this.dimensions[1],\n text.x,\n this.options.reverseOrientation ? this.tickHeight : this.dimensions[1] - this.tickHeight,\n 1,\n this.tickColor\n );\n\n const line = document.createElement('line');\n\n line.setAttribute('x1', String(text.tickLine[0]));\n line.setAttribute('y1', String(text.tickLine[1]));\n line.setAttribute('x2', String(text.tickLine[2]));\n line.setAttribute('y2', String(text.tickLine[3]));\n line.setAttribute('style', 'stroke: grey');\n\n output.appendChild(g);\n output.appendChild(line);\n });\n });\n\n return [base, track];\n }\n }\n return new AxisTrackClass();\n};\n\nexport default createPluginTrack(config, factory);\n","import { arc as d3arc } from 'd3-shape';\nimport type { SubjectPosition, D3DragEvent } from 'd3-drag';\nimport { RADIAN_GAP, valueToRadian } from '../../core/utils/polar';\nimport { uuid } from '../../core/utils/uuid';\n\ntype CircularBrushData = {\n type: 'brush' | 'start' | 'end';\n startAngle: number;\n endAngle: number;\n cursor: string;\n};\n\nfunction BrushTrack(HGC: any, ...args: any[]): any {\n if (!new.target) {\n throw new Error('Uncaught TypeError: Class constructor cannot be invoked without \"new\"');\n }\n\n class BrushTrackClass extends HGC.tracks.SVGTrack {\n public circularBrushData: CircularBrushData[];\n public prevExtent: [number, number];\n\n constructor(params: any[]) {\n super(...params); // context, options\n\n const [context, options] = params;\n const { registerViewportChanged, removeViewportChanged, setDomainsCallback } = context;\n\n this.uid = uuid();\n this.options = options;\n\n // Is there actually a linked from view? Or is this projection \"independent\"?\n this.hasFromView = !context.projectionXDomain;\n\n this.removeViewportChanged = removeViewportChanged;\n this.setDomainsCallback = setDomainsCallback;\n\n this.viewportXDomain = this.hasFromView ? null : context.projectionXDomain;\n this.viewportYDomain = this.hasFromView ? null : [0, 0];\n\n this.prevExtent = [0, 0];\n this.RR = 0.02; // radian angle of resizers on the both sides\n\n const extent: [number, number] = [0, Math.PI * 1.7];\n this.circularBrushData = this.getBrushData(extent);\n\n this.brush = d3arc()\n .innerRadius(this.options.innerRadius ?? 100)\n .outerRadius(this.options.outerRadius ?? 200);\n\n this.gBrush = this.gMain\n .append('g')\n .attr('id', `brush-${this.uid}`)\n .selectAll('.brush')\n .data(this.circularBrushData)\n .enter()\n .append('path')\n .attr('class', 'brush')\n .attr('d', this.brush)\n .attr('fill', this.options.projectionFillColor)\n .attr('stroke', this.options.projectionStrokeColor)\n // Let's hide left and right resizer\n .attr('fill-opacity', (d: CircularBrushData) =>\n d.type === 'brush' ? this.options.projectionFillOpacity : 0\n )\n .attr('stroke-opacity', (d: CircularBrushData) =>\n d.type === 'brush' ? this.options.projectionStrokeOpacity : 0\n )\n .attr('stroke-width', this.options.strokeWidth)\n .style('pointer-events', 'all')\n .style('cursor', (d: CircularBrushData) => d.cursor)\n .call(this.dragged());\n\n // the viewport will call this.viewportChanged immediately upon hearing registerViewportChanged\n registerViewportChanged(this.uid, this.viewportChanged.bind(this));\n\n this.draw();\n }\n\n /**\n * Get information for circular brush for given extent of angle.\n */\n getBrushData(extent: [number, number]): CircularBrushData[] {\n return [\n {\n type: 'brush',\n startAngle: extent[0],\n endAngle: extent[1],\n cursor: 'grab'\n },\n {\n type: 'start',\n startAngle: extent[0],\n endAngle: extent[0] + this.RR,\n cursor: 'move'\n },\n {\n type: 'end',\n startAngle: extent[1] - this.RR,\n endAngle: extent[1],\n cursor: 'move'\n }\n ];\n }\n\n cropExtent(extent: [number, number]): [number, number] {\n let [s, e] = extent;\n\n let round = 0;\n while (s > Math.PI * 2 || e > Math.PI * 2 || s < 0 || e < 0) {\n if (round++ > 10) {\n // this shifting process should be done in a single round, so reaching here shouldn't happen.\n break;\n }\n\n if (s > Math.PI * 2 || e > Math.PI * 2) {\n s -= Math.PI * 2;\n e -= Math.PI * 2;\n } else if (s < 0 || e < 0) {\n s += Math.PI * 2;\n e += Math.PI * 2;\n }\n }\n return ([s, e] as number[]).sort((a, b) => a - b) as [number, number];\n }\n\n /**\n * Update the position and size of brush.\n */\n updateBrush(extent: [number, number]) {\n let [s, e] = extent;\n\n if (\n (s <= RADIAN_GAP && e <= RADIAN_GAP) ||\n (s >= Math.PI * 2 - RADIAN_GAP && e >= Math.PI * 2 - RADIAN_GAP)\n ) {\n // this means [s, e] is entirely out of the visible area, so simply hide the brush\n this.gBrush.attr('visibility', 'hidden');\n return;\n }\n\n // crop angles if they are out of the visible area\n if (s < RADIAN_GAP) {\n s = RADIAN_GAP;\n }\n if (s > Math.PI * 2 - RADIAN_GAP) {\n s = Math.PI * 2 - RADIAN_GAP;\n }\n if (e < RADIAN_GAP) {\n e = RADIAN_GAP;\n }\n if (e > Math.PI * 2 - RADIAN_GAP) {\n e = Math.PI * 2 - RADIAN_GAP;\n }\n\n this.circularBrushData = this.getBrushData(extent);\n this.gBrush.data(this.circularBrushData).attr('d', this.brush).attr('visibility', 'visible');\n }\n\n /**\n * Function to call upon hearing click event on the brush\n */\n dragged() {\n const start = (event: D3DragEvent) => {\n this.startEvent = event.sourceEvent;\n this.prevExtent = [this.circularBrushData[0].startAngle, this.circularBrushData[0].endAngle];\n };\n\n const drag = (event: D3DragEvent, d: CircularBrushData) => {\n const [x, y] = this.position;\n const [w, h] = this.dimensions;\n const endEvent = event.sourceEvent;\n\n // adjust the position\n const startX = this.startEvent.layerX - x;\n const startY = this.startEvent.layerY - y;\n const endX = endEvent.layerX - x;\n const endY = endEvent.layerY - y;\n\n // calculate the radian difference from the drag event\n // rotate the origin +90 degree so that it is positioned on the 12 O'clock\n const radDiff =\n // radian of the start position\n Math.atan2(startX - w / 2.0, startY - h / 2.0) -\n // radian of the current position\n Math.atan2(endX - w / 2.0, endY - h / 2.0);\n\n // previous extent of brush\n let [s, e] = this.prevExtent;\n\n if (d.type === 'brush') {\n s = s + radDiff;\n e = e + radDiff;\n\n if (s < RADIAN_GAP || Math.PI * 2 - RADIAN_GAP < e) {\n // This means [s, e] contains the origin, i.e., 12 O'clock\n const sto = RADIAN_GAP - s;\n const eto = e - (Math.PI * 2 - RADIAN_GAP);\n\n if (sto > eto) {\n // Place the brush on the right side of the origin\n e += sto;\n s += sto;\n } else {\n // Place the brush on the left side of the origin\n s -= eto;\n e -= eto;\n }\n }\n } else if (d.type === 'start') {\n s = s + radDiff;\n } else if (d.type === 'end') {\n e = e + radDiff;\n }\n\n [s, e] = this.cropExtent([s, e]);\n\n if (!this._xScale || !this._yScale) {\n return;\n }\n\n const scale = (this.options.endAngle - this.options.startAngle) / 360;\n const offsetedS = s - (this.options.startAngle / 360) * Math.PI * 2;\n const offsetedE = e - (this.options.startAngle / 360) * Math.PI * 2;\n const xDomain = [\n this._xScale.invert(w - (w * offsetedE) / (Math.PI * 2 * scale)),\n this._xScale.invert(w - (w * offsetedS) / (Math.PI * 2 * scale))\n ];\n\n const yDomain = this.viewportYDomain;\n\n if (!this.hasFromView) {\n this.viewportXDomain = xDomain;\n }\n\n this.setDomainsCallback(xDomain, yDomain);\n\n this.updateBrush([s, e]);\n };\n\n return HGC.libraries.d3Drag.drag().on('start', start).on('drag', drag);\n }\n\n draw() {\n if (!this._xScale || !this.yScale) {\n return;\n }\n\n if (!this.viewportXDomain || !this.viewportYDomain) {\n return;\n }\n\n const x0 = this._xScale(this.viewportXDomain[0]);\n const x1 = this._xScale(this.viewportXDomain[1]);\n\n const [w] = this.dimensions;\n let e = valueToRadian(x0, w, this.options.startAngle, this.options.endAngle) + Math.PI / 2.0;\n let s = valueToRadian(x1, w, this.options.startAngle, this.options.endAngle) + Math.PI / 2.0;\n\n [s, e] = this.cropExtent([s, e]);\n\n this.updateBrush([s, e]);\n }\n\n viewportChanged(viewportXScale: any, viewportYScale: any) {\n const viewportXDomain = viewportXScale.domain();\n const viewportYDomain = viewportYScale.domain();\n\n this.viewportXDomain = viewportXDomain;\n this.viewportYDomain = viewportYDomain;\n\n this.draw();\n }\n\n remove() {\n // remove the event handler that updates this viewport tracker\n this.removeViewportChanged(this.uid);\n\n super.remove();\n }\n\n rerender() {\n // !!! TODO: when does this called?\n }\n\n zoomed(newXScale: any, newYScale: any) {\n this.xScale(newXScale);\n this.yScale(newYScale);\n\n this.draw();\n }\n\n setPosition(newPosition: any) {\n super.setPosition(newPosition);\n\n this.draw();\n }\n\n setDimensions(newDimensions: any) {\n super.setDimensions(newDimensions);\n\n // change the position\n this.gBrush.attr('transform', `translate(${newDimensions[0] / 2.0},${newDimensions[1] / 2.0})`);\n\n this.draw();\n }\n }\n\n return new BrushTrackClass(args);\n}\n\n// TODO: Change the icon\nconst icon =\n ' ';\n\n// TODO:\n// default\nBrushTrack.config = {\n type: 'brush-track',\n datatype: ['projection'],\n local: false, // TODO:\n projection: true,\n orientation: '2d',\n thumbnail: new DOMParser().parseFromString(icon, 'text/xml').documentElement,\n availableOptions: [\n 'innerRadius',\n 'outerRadius',\n 'startAngle',\n 'endAngle',\n 'axisPositionHorizontal',\n 'projectionFillColor',\n 'projectionStrokeColor',\n 'projectionFillOpacity',\n 'projectionStrokeOpacity',\n 'strokeWidth'\n ],\n defaultOptions: {\n innerRadius: 100,\n outerRadius: 200,\n startAngle: 0,\n endAngle: 360,\n axisPositionHorizontal: 'left',\n projectionFillColor: '#777',\n projectionStrokeColor: '#777',\n projectionFillOpacity: 0.3,\n projectionStrokeOpacity: 0.7,\n strokeWidth: 1\n }\n};\n\nexport default BrushTrack;\n","import { createNanoEvents, type Emitter } from 'nanoevents';\nimport type * as D3Selection from 'd3-selection';\nimport type * as D3Drag from 'd3-drag';\nimport type { EventStyle } from '@gosling-lang/gosling-schema';\n\nconst HIDDEN_BRUSH_EDGE_SIZE = 3;\n\ninterface Interval {\n start: number;\n end: number;\n}\n\ntype LinearBrushData = [\n { type: 'body'; cursor: 'grab' } & Interval,\n { type: 'start'; cursor: 'ew-resize' } & Interval,\n { type: 'end'; cursor: 'ew-resize' } & Interval\n];\n\ninterface LinearBrushEvents {\n brush: (range: [number, number] | null, skipApiTrigger: boolean) => void;\n}\n\n// default styles for brush\nconst BRUSH_STYLE_DEFAULT: Required> = {\n color: '#777',\n stroke: '#777',\n strokeWidth: 1,\n strokeOpacity: 0.7,\n opacity: 0.3\n};\n\n/**\n * A model to manage 1D brush graphics and its data.\n */\nexport class LinearBrushModel {\n /* graphical elements */\n private brushSelection: D3Selection.Selection;\n private readonly style: Required>;\n\n /* data */\n private range: [number, number] | null;\n private data: LinearBrushData;\n\n /* drag */\n private startEvent: D3Drag.D3DragEvent['sourceEvent'];\n private prevExtent: [number, number] | null;\n\n /* visual parameters */\n private offset: [number, number];\n private size: number; // fixed size of one-dimension of a brush (e.g., height)\n\n /* External libraries that we re-use from HiGlass */\n private externals: {\n d3Selection: typeof D3Selection;\n d3Drag: typeof D3Drag;\n };\n\n private emitter: Emitter;\n\n constructor(\n selection: D3Selection.Selection,\n hgLibraries: any,\n style: EventStyle = {}\n ) {\n this.emitter = createNanoEvents();\n this.range = null;\n this.prevExtent = [0, 0];\n this.data = this.rangeToData(0, 0);\n\n this.offset = [0, 0];\n this.size = 0;\n\n this.externals = {\n d3Selection: hgLibraries.d3Selection,\n d3Drag: hgLibraries.d3Drag\n };\n\n this.style = Object.assign({}, BRUSH_STYLE_DEFAULT, style);\n\n this.brushSelection = selection\n .selectAll('.genomic-range-brush')\n .data(this.data)\n .enter()\n .append('rect')\n .attr('class', 'genomic-range-brush')\n .call(this.onDrag());\n }\n\n public getRange() {\n return this.range;\n }\n\n public setSize(size: number) {\n this.size = size;\n return this;\n }\n\n /**\n * Update the left and top offsets for drawing the brush.\n */\n public setOffset(offsetX: number, offsetY: number) {\n this.offset = [offsetX, offsetY];\n return this;\n }\n\n /**\n * Update brush data based on the positions of two edges.\n */\n public updateRange(range: [number, number] | null) {\n if (range) {\n this.range = [Math.min(...range), Math.max(...range)];\n this.data = this.rangeToData(...this.range);\n } else {\n this.range = null;\n }\n return this;\n }\n\n /**\n * Update the brush using the internal range value. By default,\n * This function calls a render function from gosling-track.\n */\n public drawBrush(skipApiTrigger = false) {\n const [x, y] = this.offset;\n const height = this.size;\n const getWidth = (d: LinearBrushData[number]) => Math.abs(d.end - d.start); // the start and end can be minus values\n this.brushSelection\n .data(this.data)\n .attr('transform', d => `translate(${x + d.start}, ${y + 1})`)\n .attr('width', d => `${getWidth(d)}px`)\n .attr('height', `${height - 2}px`)\n .attr('fill', this.style.color)\n .attr('stroke', this.style.stroke)\n .attr('stroke-width', `${this.style.strokeWidth}px`)\n .attr('fill-opacity', d => (d.type === 'body' ? this.style.opacity : 0))\n .attr('stroke-opacity', d => (d.type === 'body' ? this.style.strokeOpacity : 0))\n .attr('cursor', d => d.cursor);\n\n this.emitter.emit('brush', this.getRange(), skipApiTrigger);\n return this;\n }\n\n public enable() {\n this.brushSelection.attr('pointer-events', 'all');\n return this;\n }\n\n public disable() {\n this.brushSelection.attr('pointer-events', 'none');\n return this;\n }\n\n public visible() {\n this.brushSelection.attr('visibility', 'visible');\n return this;\n }\n\n public hidden() {\n this.brushSelection.attr('visibility', 'hidden');\n return this;\n }\n\n public clear() {\n this.updateRange(null).drawBrush().hidden().disable();\n return this;\n }\n\n public remove() {\n this.brushSelection.remove();\n return this;\n }\n\n /**\n * Based on the extent values, generate a JSON object for the brush.\n */\n private rangeToData(start: number, end: number): LinearBrushData {\n return [\n {\n type: 'body',\n cursor: 'grab',\n start,\n end\n },\n {\n type: 'start',\n cursor: 'ew-resize',\n start: start - HIDDEN_BRUSH_EDGE_SIZE,\n end: start\n },\n {\n type: 'end',\n cursor: 'ew-resize',\n start: end,\n end: end + HIDDEN_BRUSH_EDGE_SIZE\n }\n ];\n }\n\n private onDrag() {\n const started = (event: D3Drag.D3DragEvent) => {\n this.startEvent = event.sourceEvent;\n this.prevExtent = this.range;\n };\n\n const dragged = (\n event: D3Drag.D3DragEvent,\n d: LinearBrushData[number]\n ) => {\n const delta = event.sourceEvent.layerX - this.startEvent.layerX;\n\n // previous extent of brush\n let [s, e]: [number, number] = this.prevExtent ?? [0, 0];\n\n if (d.type === 'body') {\n s += delta;\n e += delta;\n } else if (d.type === 'start') {\n s += delta;\n } else if (d.type === 'end') {\n e += delta;\n }\n\n this.updateRange([s, e]).drawBrush();\n };\n\n return this.externals.d3Drag\n .drag()\n .on('start', started)\n .on('drag', dragged);\n }\n\n on(event: E, callback: LinearBrushEvents[E]) {\n this.emitter.on(event, callback);\n }\n}\n","import { pointsToDegree } from '../../../core/utils/polar';\n\n/**\n * @param point Tuple of the form `[x,y]` to be tested.\n * @param center Tuple of the form `[x,y]` that correspond to the center of an arc.\n * @param radius The inner and outer radius of the arc.\n * @param angle The start and end angle the arc in the range of [0, 360]. Anticlockwise, starting from 12 o'clock.\n * @returns If `true` point lies within the arc, i.e., the slice of the donut.\n */\nexport const isPointInsideDonutSlice: (\n point: [number, number],\n center: [number, number],\n radius: [number, number],\n angle: [number, number]\n) => boolean = ([x, y], [cx, cy], [innerRadius, outerRadius], [startAngle, endAngle]) => {\n const dist = Math.sqrt((x - cx) ** 2 + (y - cy) ** 2);\n if (dist < innerRadius || outerRadius < dist) {\n // Out of the given radius range\n return false;\n }\n const degree = pointsToDegree(x, y, cx, cy);\n if (degree < startAngle || endAngle < degree) {\n // Out of the given angle range\n return false;\n }\n return true;\n};\n\n/**\n * @param point Tuple of the form `[x,y]` to be tested.\n * @param point2 Tuple of the form `[x,y]` to be tested.\n * @param radius A radius of the second point.\n * @returns If `true` point lies within the point.\n */\nexport const isPointNearPoint: (point: [number, number], point2: number[], radius?: number) => boolean = (\n [x1, y1],\n [x2, y2],\n radius = 5\n) => {\n return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) < radius;\n};\n\n/**\n * @param range Tuple of the form `[x1,x2]` to be tested.\n * @param point A value x to be tested.\n * @returns If `true` point lies within the point.\n */\nexport const isPointInsideRange: (range: [number, number], x: number) => boolean = ([x1, x2], x) => {\n return x1 <= x && x <= x2;\n};\n\n/**\n * @param range Tuple of the form `[x1,x2]` to be tested.\n * @param x A value x to be tested.\n * @param radius A radius of the point.\n * @returns If `true` point lies within the point.\n */\nexport const isCircleWithinRange: (range: [number, number], x: number, radius?: number) => boolean = (\n range,\n x,\n radius = 5\n) => {\n return isPointInsideRange(range, x - radius) && isPointInsideRange(range, x + radius);\n};\n\n/**\n * @param point Tuple of the form `[x1,x2]` to be tested.\n * @param path 1D list of vertices defining the line segments.\n * @return If `true` point lies within the polygon.\n */\nexport const isAllPointsWithinRange: (range: [number, number], path: number[]) => boolean = (range, path) => {\n return path.filter((_, i) => i % 2 === 0).every(x => isPointInsideRange(range, x));\n};\n\n/**\n * From: https://www.geeksforgeeks.org/minimum-distance-from-a-point-to-the-line-segment-using-vectors/\n * @param point Tuple of the form `[x,y]` to be tested.\n * @param path 1D list of vertices defining the line segments.\n * @param dist A threshold distance for test.\n * @return If `true` point lies within the polygon.\n */\nexport const isPointNearLine: (point: [number, number], path: number[], dist?: number) => boolean = (\n [x, y],\n path,\n dist = 5\n) => {\n let x1;\n let y1;\n let x2;\n let y2;\n let isWithin = false;\n for (let i = 0; i < path.length - 2; i += 2) {\n x1 = path[i];\n y1 = path[i + 1];\n x2 = path[i + 2];\n y2 = path[i + 3];\n\n const AB = [x2 - x1, y2 - y1];\n const BE = [x - x2, y - y2];\n const AE = [x - x1, y - y1];\n\n // Variables to store dot product\n const AB_BE = AB[0] * BE[0] + AB[1] * BE[1];\n const AB_AE = AB[0] * AE[0] + AB[1] * AE[1];\n\n let actDist = 0;\n if (AB_BE > 0) {\n actDist = Math.sqrt((y - y2) ** 2 + (x - x2) ** 2);\n } else if (AB_AE < 0) {\n actDist = Math.sqrt((y - y1) ** 2 + (x - x1) ** 2);\n } else {\n actDist = Math.abs(AB[0] * AE[1] - AB[1] * AE[0]) / Math.sqrt(AB[0] ** 2 + AB[1] ** 2);\n }\n if (actDist < dist) {\n isWithin = true;\n }\n }\n return isWithin;\n};\n\n/**\n * Adopted from\n * https://github.com/flekschas/utils\n * https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html\n * @param point Tuple of the form `[x,y]` to be tested.\n * @param polygon 1D list of vertices defining the polygon.\n * @return If `true` point lies within the polygon.\n */\nexport const isPointInPolygon: (point: [number, number], polygon: number[]) => boolean = ([x, y], polygon) => {\n let x1;\n let y1;\n let x2;\n let y2;\n let isWithin = false;\n for (let i = 0, j = polygon.length - 2; i < polygon.length; i += 2) {\n x1 = polygon[i];\n y1 = polygon[i + 1];\n x2 = polygon[j];\n y2 = polygon[j + 1];\n if (y1 > y !== y2 > y && x < ((x2 - x1) * (y - y1)) / (y2 - y1) + x1) {\n isWithin = !isWithin;\n }\n j = i;\n }\n return isWithin;\n};\n","import type { Datum } from '@gosling-lang/gosling-schema';\nimport {\n isAllPointsWithinRange,\n isPointInPolygon,\n isPointNearLine,\n isPointNearPoint,\n isCircleWithinRange\n} from './polygon';\nimport { uuid } from '../../../core/utils/uuid';\n\nexport type MouseEventData = PointEventData | LineEventData | PolygonEventData;\n\ninterface CommonEventData {\n uid: string;\n value: Datum;\n}\n\ninterface PointEventData extends CommonEventData {\n type: 'point';\n polygon: [number, number, number]; // [x, y, radius]\n}\n\ninterface LineEventData extends CommonEventData {\n type: 'line';\n polygon: number[]; // [x1, y1, x2, y2, ...]\n}\n\ninterface PolygonEventData extends CommonEventData {\n type: 'polygon';\n polygon: number[]; // [x1, y1, x2, y2, ...]\n}\n\n/**\n * A model to manage mouse events.\n */\nexport class MouseEventModel {\n // main data that this model manage\n private data: MouseEventData[];\n\n constructor() {\n this.data = [];\n }\n\n /**\n * Access the number of mouse events stored.\n */\n public size() {\n return this.data.length;\n }\n\n /**\n * Add a new mouse event that is polygon-based.\n */\n public addPolygonBasedEvent(value: Datum, polygon: number[]) {\n this.data.push({ uid: uuid(), type: 'polygon', value, polygon });\n }\n\n /**\n * Add a new mouse event that is point-based.\n */\n public addPointBasedEvent(value: Datum, pointAndRadius: [number, number, number]) {\n this.data.push({ uid: uuid(), type: 'point', value, polygon: pointAndRadius });\n }\n\n /**\n * Add a new mouse event that is line-based.\n */\n public addLineBasedEvent(value: Datum, path: number[]) {\n this.data.push({ uid: uuid(), type: 'line', value, polygon: path });\n }\n\n /**\n * Make the data array empty.\n */\n public clear() {\n this.data = [];\n }\n\n /**\n * Find the first event data that is within the mouse position.\n */\n public find(x: number, y: number, reverse = false) {\n const _ = Array.from(this.data);\n if (reverse) _.reverse();\n return _.find(d => this.isMouseWithin(d, x, y));\n }\n\n /**\n * Find all event data that is within the mouse position.\n */\n public findAll(x: number, y: number, reverse = false) {\n const _ = Array.from(this.data);\n if (reverse) _.reverse();\n return _.filter(d => this.isMouseWithin(d, x, y));\n }\n\n /**\n * Find all event data that matches the id values in the source and return them.\n */\n public getSiblings(source: MouseEventData[], idField: string) {\n const siblings: MouseEventData[] = [];\n const sourceUids = Array.from(new Set(source.map(d => d.uid)));\n source.forEach(s => {\n const id = s.value[idField];\n if (id) {\n siblings.push(...this.data.filter(_ => _.value[idField] === id && sourceUids.indexOf(_.uid) === -1));\n }\n });\n return siblings;\n }\n\n /**\n * Test if a mouse position is within a given object.\n */\n public isMouseWithin(data: MouseEventData, x: number, y: number) {\n switch (data.type) {\n case 'point':\n return isPointNearPoint([x, y], data.polygon);\n case 'line':\n return isPointNearLine([x, y], data.polygon);\n case 'polygon':\n default:\n return isPointInPolygon([x, y], data.polygon);\n }\n }\n\n /**\n * Find all event data that is within the range along the x-axis.\n */\n public findAllWithinRange(x1: number, x2: number, reverse = false) {\n const _ = Array.from(this.data);\n if (reverse) _.reverse();\n return _.filter(d => this.isWithinRange(d, x1, x2));\n }\n\n /**\n * Test if a given object is within an 1D range.\n */\n public isWithinRange(data: MouseEventData, x1: number, x2: number) {\n switch (data.type) {\n case 'point':\n return isCircleWithinRange([x1, x2], data.polygon[0], data.polygon[2]);\n case 'line':\n case 'polygon':\n default:\n return isAllPointsWithinRange([x1, x2], data.polygon);\n }\n }\n}\n","/*\n * This code is based on the following repo:\n * https://github.com/higlass/higlass-pileup\n */\nimport { spawn } from 'threads';\nimport Worker from './bam-worker.ts?worker&inline';\n\nimport type { BamData, Assembly } from '@gosling-lang/gosling-schema';\nimport type { ModuleThread } from 'threads';\nimport type { WorkerApi, TilesetInfo, Tiles, Segment, Junction, SegmentWithMate } from './bam-worker';\nimport { computeChromSizes } from '../../core/utils/assembly';\nimport type { TabularDataFetcher } from '../utils';\n\nconst DEBOUNCE_TIME = 200;\n\ntype InferTileType = Config['extractJunction'] extends true\n ? Junction\n : Config['loadMates'] extends true\n ? SegmentWithMate\n : Segment;\n\nclass BamDataFetcher implements TabularDataFetcher> {\n static config = { type: 'bam' };\n dataConfig = {}; // required for higlass\n uid: string;\n fetchTimeout?: ReturnType;\n toFetch: Set;\n\n MAX_TILE_WIDTH = 2e4 as const;\n\n private worker: Promise>;\n\n // This is set by us but is accessed in `fetchTilesDebounced`\n track?: {\n fetching: { delete(id: string): void };\n };\n\n constructor(HGC: import('@higlass/types').HGC, config: Config & { assembly: Assembly }) {\n this.uid = HGC.libraries.slugid.nice();\n this.toFetch = new Set();\n const { url, indexUrl, assembly, ...options } = config;\n this.worker = spawn(new Worker()).then(async worker => {\n const chromSizes = Object.entries(computeChromSizes(assembly).size);\n await worker.init(this.uid, { url, indexUrl }, chromSizes, options);\n return worker;\n });\n }\n\n /*\n * Collect Tileset Information, such as tile size and genomic positions\n */\n async tilesetInfo(callback: (info: TilesetInfo) => void) {\n (await this.worker).tilesetInfo(this.uid).then(callback);\n }\n\n fetchTilesDebounced(receivedTiles: (tiles: Tiles) => void, tileIds: string[]) {\n const { toFetch } = this;\n\n const thisZoomLevel = tileIds[0].split('.')[0]; // Example of tileIds: [\"3.0\", \"3.1\"]\n const toFetchZoomLevel = toFetch.size ? [...toFetch][0].split('.')[0] : null;\n\n if (thisZoomLevel !== toFetchZoomLevel) {\n for (const tileId of this.toFetch) {\n this.track?.fetching.delete(tileId);\n }\n this.toFetch.clear();\n }\n\n tileIds.forEach(x => this.toFetch.add(x));\n\n if (this.fetchTimeout) {\n clearTimeout(this.fetchTimeout);\n }\n\n this.fetchTimeout = setTimeout(() => {\n this.sendFetch(receivedTiles, [...this.toFetch]);\n this.toFetch.clear();\n }, DEBOUNCE_TIME);\n }\n\n async sendFetch(receivedTiles: (tiles: Tiles) => void, tileIds: string[]) {\n (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles);\n }\n\n async getTabularData(tileIds: string[]): Promise[]> {\n const buf = await (await this.worker).getTabularData(this.uid, tileIds);\n return JSON.parse(new TextDecoder().decode(buf));\n }\n}\n\nexport default BamDataFetcher;\n","/*\n * This document is heavily based on the following repo by @alexander-veit:\n * https://github.com/dbmi-bgm/higlass-sv/blob/main/src/sv-fetcher.js\n */\nimport { spawn } from 'threads';\nimport Worker from './vcf-worker.ts?worker&inline';\n\nimport { computeChromSizes } from '../../core/utils/assembly';\n\nimport type { ModuleThread } from 'threads';\nimport type { Assembly, VcfData } from '@gosling-lang/gosling-schema';\nimport type { WorkerApi, TilesetInfo } from './vcf-worker';\nimport type { TabularDataFetcher } from '../utils';\nimport { getSubstitutionType, getMutationType } from './utils';\n\nconst DEBOUNCE_TIME = 200;\n\n// const MAX_TILES = 20;\n// https://github.com/GMOD/vcf-js/blob/c4a9cbad3ba5a3f0d1c817d685213f111bf9de9b/src/parse.ts#L284-L291\nexport type VcfRecord = {\n CHROM: string;\n POS: number;\n ID: null | string[];\n REF: string;\n ALT: null | string[];\n QUAL: null | number;\n FILTER: null | string;\n INFO: Record;\n};\n\nexport type VcfTile = Omit & {\n ALT: string | undefined;\n MUTTYPE: ReturnType;\n SUBTYPE: ReturnType;\n INFO: string;\n ORIGINALPOS: number;\n POS: number;\n POSEND: number;\n DISTPREV: number | null;\n DISTPREVLOGE: number | null;\n} & { [infoKey: string]: any };\n\nclass VcfDataFetcher implements TabularDataFetcher {\n static config = { type: 'vcf' };\n dataConfig = {}; // required for higlass\n uid: string;\n prevRequestTime: number;\n track?: any;\n\n private toFetch: Set;\n private fetchTimeout?: ReturnType;\n private worker: Promise>;\n\n constructor(HGC: import('@higlass/types').HGC, config: VcfData & { assembly: Assembly }) {\n this.uid = HGC.libraries.slugid.nice();\n this.prevRequestTime = 0;\n this.toFetch = new Set();\n const { url, indexUrl, assembly, ...options } = config;\n this.worker = spawn(new Worker()).then(async worker => {\n const chromSizes = Object.entries(computeChromSizes(assembly).size);\n await worker.init(this.uid, { url, indexUrl }, chromSizes, options);\n return worker;\n });\n }\n\n /*\n * Collect Tileset Information, such as tile size and genomic positions\n */\n async tilesetInfo(callback: (info: TilesetInfo) => void) {\n (await this.worker).tilesetInfo(this.uid).then(callback);\n }\n\n fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n this.track.drawLoadingCue();\n\n tileIds.forEach(tileId => this.toFetch.add(tileId));\n\n if (this.fetchTimeout) {\n clearTimeout(this.fetchTimeout);\n }\n\n this.fetchTimeout = setTimeout(() => {\n this.sendFetch(receivedTiles, [...this.toFetch]);\n this.toFetch.clear();\n }, DEBOUNCE_TIME);\n }\n\n async sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles);\n }\n\n async getTabularData(tileIds: string[]): Promise {\n const buf = await (await this.worker).getTabularData(this.uid, tileIds);\n return JSON.parse(new TextDecoder().decode(buf));\n }\n}\n\nexport default VcfDataFetcher;\n","const BigInt32 = BigInt(32);\nexport function getBigInt64(dataView, byteOffset, littleEndian) {\n const littleEndianMask = Number(!!littleEndian);\n const bigEndianMask = Number(!littleEndian);\n return ((BigInt(dataView.getInt32(byteOffset, littleEndian) * bigEndianMask +\n dataView.getInt32(byteOffset + 4, littleEndian) * littleEndianMask) <<\n BigInt32) |\n BigInt(dataView.getUint32(byteOffset, littleEndian) * littleEndianMask +\n dataView.getUint32(byteOffset + 4, littleEndian) * bigEndianMask));\n}\nexport function getBigUint64(dataView, byteOffset, littleEndian) {\n const a = dataView.getUint32(byteOffset, littleEndian);\n const b = dataView.getUint32(byteOffset + 4, littleEndian);\n const littleEndianMask = Number(!!littleEndian);\n const bigEndianMask = Number(!littleEndian);\n // This branch-less optimization is 77x faster than normal ternary operator.\n // and only 3% slower than native implementation\n // https://jsbench.me/p8kyhg1eqv/1\n return ((BigInt(a * bigEndianMask + b * littleEndianMask) << BigInt32) |\n BigInt(a * littleEndianMask + b * bigEndianMask));\n}\nexport function setBigInt64(dataView, byteOffset, value, littleEndian) {\n const hi = Number(value >> BigInt32);\n const lo = Number(value & BigInt(0xffffffff));\n if (littleEndian) {\n dataView.setInt32(byteOffset + 4, hi, littleEndian);\n dataView.setUint32(byteOffset, lo, littleEndian);\n }\n else {\n dataView.setInt32(byteOffset, hi, littleEndian);\n dataView.setUint32(byteOffset + 4, lo, littleEndian);\n }\n}\nexport function setBigUint64(dataView, byteOffset, value, littleEndian) {\n const hi = Number(value >> BigInt32);\n const lo = Number(value & BigInt(0xffffffff));\n if (littleEndian) {\n dataView.setUint32(byteOffset + 4, hi, littleEndian);\n dataView.setUint32(byteOffset, lo, littleEndian);\n }\n else {\n dataView.setUint32(byteOffset, hi, littleEndian);\n dataView.setUint32(byteOffset + 4, lo, littleEndian);\n }\n}\n//# sourceMappingURL=pure.js.map","import { getBigInt64, getBigUint64, setBigInt64, setBigUint64 } from './pure';\nif (!('getBigInt64' in DataView)) {\n DataView.prototype.getBigInt64 = function (byteOffset, littleEndian) {\n return getBigInt64(this, byteOffset, littleEndian);\n };\n}\nif (!('getBigUint64' in DataView)) {\n DataView.prototype.getBigUint64 = function (byteOffset, littleEndian) {\n return getBigUint64(this, byteOffset, littleEndian);\n };\n}\nif (!('setBigInt64' in DataView)) {\n DataView.prototype.setBigInt64 = function (byteOffset, value, littleEndian) {\n setBigInt64(this, byteOffset, value, littleEndian);\n };\n}\nif (!('setBigUint64' in DataView)) {\n DataView.prototype.setBigUint64 = function (byteOffset, value, littleEndian) {\n setBigUint64(this, byteOffset, value, littleEndian);\n };\n}\n//# sourceMappingURL=polyfill.js.map","class Context {\n constructor(importPath, useContextVariables) {\n this.code = \"\";\n this.scopes = [[\"vars\"]];\n this.bitFields = [];\n this.tmpVariableCount = 0;\n this.references = new Map();\n this.imports = [];\n this.reverseImports = new Map();\n this.useContextVariables = false;\n this.importPath = importPath;\n this.useContextVariables = useContextVariables;\n }\n generateVariable(name) {\n const scopes = [...this.scopes[this.scopes.length - 1]];\n if (name) {\n scopes.push(name);\n }\n return scopes.join(\".\");\n }\n generateOption(val) {\n switch (typeof val) {\n case \"number\":\n return val.toString();\n case \"string\":\n return this.generateVariable(val);\n case \"function\":\n return `${this.addImport(val)}.call(${this.generateVariable()}, vars)`;\n }\n }\n generateError(err) {\n this.pushCode(`throw new Error(${err});`);\n }\n generateTmpVariable() {\n return \"$tmp\" + this.tmpVariableCount++;\n }\n pushCode(code) {\n this.code += code + \"\\n\";\n }\n pushPath(name) {\n if (name) {\n this.scopes[this.scopes.length - 1].push(name);\n }\n }\n popPath(name) {\n if (name) {\n this.scopes[this.scopes.length - 1].pop();\n }\n }\n pushScope(name) {\n this.scopes.push([name]);\n }\n popScope() {\n this.scopes.pop();\n }\n addImport(im) {\n if (!this.importPath)\n return `(${im})`;\n let id = this.reverseImports.get(im);\n if (!id) {\n id = this.imports.push(im) - 1;\n this.reverseImports.set(im, id);\n }\n return `${this.importPath}[${id}]`;\n }\n addReference(alias) {\n if (!this.references.has(alias)) {\n this.references.set(alias, { resolved: false, requested: false });\n }\n }\n markResolved(alias) {\n const reference = this.references.get(alias);\n if (reference) {\n reference.resolved = true;\n }\n }\n markRequested(aliasList) {\n aliasList.forEach((alias) => {\n const reference = this.references.get(alias);\n if (reference) {\n reference.requested = true;\n }\n });\n }\n getUnresolvedReferences() {\n return Array.from(this.references)\n .filter(([_, reference]) => !reference.resolved && !reference.requested)\n .map(([alias, _]) => alias);\n }\n}\nconst aliasRegistry = new Map();\nconst FUNCTION_PREFIX = \"___parser_\";\nconst PRIMITIVE_SIZES = {\n uint8: 1,\n uint16le: 2,\n uint16be: 2,\n uint32le: 4,\n uint32be: 4,\n int8: 1,\n int16le: 2,\n int16be: 2,\n int32le: 4,\n int32be: 4,\n int64be: 8,\n int64le: 8,\n uint64be: 8,\n uint64le: 8,\n floatle: 4,\n floatbe: 4,\n doublele: 8,\n doublebe: 8,\n};\nconst PRIMITIVE_NAMES = {\n uint8: \"Uint8\",\n uint16le: \"Uint16\",\n uint16be: \"Uint16\",\n uint32le: \"Uint32\",\n uint32be: \"Uint32\",\n int8: \"Int8\",\n int16le: \"Int16\",\n int16be: \"Int16\",\n int32le: \"Int32\",\n int32be: \"Int32\",\n int64be: \"BigInt64\",\n int64le: \"BigInt64\",\n uint64be: \"BigUint64\",\n uint64le: \"BigUint64\",\n floatle: \"Float32\",\n floatbe: \"Float32\",\n doublele: \"Float64\",\n doublebe: \"Float64\",\n};\nconst PRIMITIVE_LITTLE_ENDIANS = {\n uint8: false,\n uint16le: true,\n uint16be: false,\n uint32le: true,\n uint32be: false,\n int8: false,\n int16le: true,\n int16be: false,\n int32le: true,\n int32be: false,\n int64be: false,\n int64le: true,\n uint64be: false,\n uint64le: true,\n floatle: true,\n floatbe: false,\n doublele: true,\n doublebe: false,\n};\nexport class Parser {\n constructor() {\n this.varName = \"\";\n this.type = \"\";\n this.options = {};\n this.endian = \"be\";\n this.useContextVariables = false;\n }\n static start() {\n return new Parser();\n }\n primitiveGenerateN(type, ctx) {\n const typeName = PRIMITIVE_NAMES[type];\n const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type];\n ctx.pushCode(`${ctx.generateVariable(this.varName)} = dataView.get${typeName}(offset, ${littleEndian});`);\n ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`);\n }\n primitiveN(type, varName, options) {\n return this.setNextParser(type, varName, options);\n }\n useThisEndian(type) {\n return (type + this.endian.toLowerCase());\n }\n uint8(varName, options = {}) {\n return this.primitiveN(\"uint8\", varName, options);\n }\n uint16(varName, options = {}) {\n return this.primitiveN(this.useThisEndian(\"uint16\"), varName, options);\n }\n uint16le(varName, options = {}) {\n return this.primitiveN(\"uint16le\", varName, options);\n }\n uint16be(varName, options = {}) {\n return this.primitiveN(\"uint16be\", varName, options);\n }\n uint32(varName, options = {}) {\n return this.primitiveN(this.useThisEndian(\"uint32\"), varName, options);\n }\n uint32le(varName, options = {}) {\n return this.primitiveN(\"uint32le\", varName, options);\n }\n uint32be(varName, options = {}) {\n return this.primitiveN(\"uint32be\", varName, options);\n }\n int8(varName, options = {}) {\n return this.primitiveN(\"int8\", varName, options);\n }\n int16(varName, options = {}) {\n return this.primitiveN(this.useThisEndian(\"int16\"), varName, options);\n }\n int16le(varName, options = {}) {\n return this.primitiveN(\"int16le\", varName, options);\n }\n int16be(varName, options = {}) {\n return this.primitiveN(\"int16be\", varName, options);\n }\n int32(varName, options = {}) {\n return this.primitiveN(this.useThisEndian(\"int32\"), varName, options);\n }\n int32le(varName, options = {}) {\n return this.primitiveN(\"int32le\", varName, options);\n }\n int32be(varName, options = {}) {\n return this.primitiveN(\"int32be\", varName, options);\n }\n bigIntVersionCheck() {\n if (!DataView.prototype.getBigInt64)\n throw new Error(\"BigInt64 is unsupported on this runtime\");\n }\n int64(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(this.useThisEndian(\"int64\"), varName, options);\n }\n int64be(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(\"int64be\", varName, options);\n }\n int64le(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(\"int64le\", varName, options);\n }\n uint64(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(this.useThisEndian(\"uint64\"), varName, options);\n }\n uint64be(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(\"uint64be\", varName, options);\n }\n uint64le(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(\"uint64le\", varName, options);\n }\n floatle(varName, options = {}) {\n return this.primitiveN(\"floatle\", varName, options);\n }\n floatbe(varName, options = {}) {\n return this.primitiveN(\"floatbe\", varName, options);\n }\n doublele(varName, options = {}) {\n return this.primitiveN(\"doublele\", varName, options);\n }\n doublebe(varName, options = {}) {\n return this.primitiveN(\"doublebe\", varName, options);\n }\n bitN(size, varName, options) {\n options.length = size;\n return this.setNextParser(\"bit\", varName, options);\n }\n bit1(varName, options = {}) {\n return this.bitN(1, varName, options);\n }\n bit2(varName, options = {}) {\n return this.bitN(2, varName, options);\n }\n bit3(varName, options = {}) {\n return this.bitN(3, varName, options);\n }\n bit4(varName, options = {}) {\n return this.bitN(4, varName, options);\n }\n bit5(varName, options = {}) {\n return this.bitN(5, varName, options);\n }\n bit6(varName, options = {}) {\n return this.bitN(6, varName, options);\n }\n bit7(varName, options = {}) {\n return this.bitN(7, varName, options);\n }\n bit8(varName, options = {}) {\n return this.bitN(8, varName, options);\n }\n bit9(varName, options = {}) {\n return this.bitN(9, varName, options);\n }\n bit10(varName, options = {}) {\n return this.bitN(10, varName, options);\n }\n bit11(varName, options = {}) {\n return this.bitN(11, varName, options);\n }\n bit12(varName, options = {}) {\n return this.bitN(12, varName, options);\n }\n bit13(varName, options = {}) {\n return this.bitN(13, varName, options);\n }\n bit14(varName, options = {}) {\n return this.bitN(14, varName, options);\n }\n bit15(varName, options = {}) {\n return this.bitN(15, varName, options);\n }\n bit16(varName, options = {}) {\n return this.bitN(16, varName, options);\n }\n bit17(varName, options = {}) {\n return this.bitN(17, varName, options);\n }\n bit18(varName, options = {}) {\n return this.bitN(18, varName, options);\n }\n bit19(varName, options = {}) {\n return this.bitN(19, varName, options);\n }\n bit20(varName, options = {}) {\n return this.bitN(20, varName, options);\n }\n bit21(varName, options = {}) {\n return this.bitN(21, varName, options);\n }\n bit22(varName, options = {}) {\n return this.bitN(22, varName, options);\n }\n bit23(varName, options = {}) {\n return this.bitN(23, varName, options);\n }\n bit24(varName, options = {}) {\n return this.bitN(24, varName, options);\n }\n bit25(varName, options = {}) {\n return this.bitN(25, varName, options);\n }\n bit26(varName, options = {}) {\n return this.bitN(26, varName, options);\n }\n bit27(varName, options = {}) {\n return this.bitN(27, varName, options);\n }\n bit28(varName, options = {}) {\n return this.bitN(28, varName, options);\n }\n bit29(varName, options = {}) {\n return this.bitN(29, varName, options);\n }\n bit30(varName, options = {}) {\n return this.bitN(30, varName, options);\n }\n bit31(varName, options = {}) {\n return this.bitN(31, varName, options);\n }\n bit32(varName, options = {}) {\n return this.bitN(32, varName, options);\n }\n namely(alias) {\n aliasRegistry.set(alias, this);\n this.alias = alias;\n return this;\n }\n skip(length, options = {}) {\n return this.seek(length, options);\n }\n seek(relOffset, options = {}) {\n if (options.assert) {\n throw new Error(\"assert option on seek is not allowed.\");\n }\n return this.setNextParser(\"seek\", \"\", { length: relOffset });\n }\n string(varName, options) {\n if (!options.zeroTerminated && !options.length && !options.greedy) {\n throw new Error(\"One of length, zeroTerminated, or greedy must be defined for string.\");\n }\n if ((options.zeroTerminated || options.length) && options.greedy) {\n throw new Error(\"greedy is mutually exclusive with length and zeroTerminated for string.\");\n }\n if (options.stripNull && !(options.length || options.greedy)) {\n throw new Error(\"length or greedy must be defined if stripNull is enabled.\");\n }\n options.encoding = options.encoding || \"utf8\";\n return this.setNextParser(\"string\", varName, options);\n }\n buffer(varName, options) {\n if (!options.length && !options.readUntil) {\n throw new Error(\"length or readUntil must be defined for buffer.\");\n }\n return this.setNextParser(\"buffer\", varName, options);\n }\n wrapped(varName, options) {\n if (typeof options !== \"object\" && typeof varName === \"object\") {\n options = varName;\n varName = \"\";\n }\n if (!options || !options.wrapper || !options.type) {\n throw new Error(\"Both wrapper and type must be defined for wrapped.\");\n }\n if (!options.length && !options.readUntil) {\n throw new Error(\"length or readUntil must be defined for wrapped.\");\n }\n return this.setNextParser(\"wrapper\", varName, options);\n }\n array(varName, options) {\n if (!options.readUntil && !options.length && !options.lengthInBytes) {\n throw new Error(\"One of readUntil, length and lengthInBytes must be defined for array.\");\n }\n if (!options.type) {\n throw new Error(\"type is required for array.\");\n }\n if (typeof options.type === \"string\" &&\n !aliasRegistry.has(options.type) &&\n !(options.type in PRIMITIVE_SIZES)) {\n throw new Error(`Array element type \"${options.type}\" is unkown.`);\n }\n return this.setNextParser(\"array\", varName, options);\n }\n choice(varName, options) {\n if (typeof options !== \"object\" && typeof varName === \"object\") {\n options = varName;\n varName = \"\";\n }\n if (!options) {\n throw new Error(\"tag and choices are are required for choice.\");\n }\n if (!options.tag) {\n throw new Error(\"tag is requird for choice.\");\n }\n if (!options.choices) {\n throw new Error(\"choices is required for choice.\");\n }\n for (const keyString in options.choices) {\n const key = parseInt(keyString, 10);\n const value = options.choices[key];\n if (isNaN(key)) {\n throw new Error(`Choice key \"${keyString}\" is not a number.`);\n }\n if (typeof value === \"string\" &&\n !aliasRegistry.has(value) &&\n !(value in PRIMITIVE_SIZES)) {\n throw new Error(`Choice type \"${value}\" is unkown.`);\n }\n }\n return this.setNextParser(\"choice\", varName, options);\n }\n nest(varName, options) {\n if (typeof options !== \"object\" && typeof varName === \"object\") {\n options = varName;\n varName = \"\";\n }\n if (!options || !options.type) {\n throw new Error(\"type is required for nest.\");\n }\n if (!(options.type instanceof Parser) && !aliasRegistry.has(options.type)) {\n throw new Error(\"type must be a known parser name or a Parser object.\");\n }\n if (!(options.type instanceof Parser) && !varName) {\n throw new Error(\"type must be a Parser object if the variable name is omitted.\");\n }\n return this.setNextParser(\"nest\", varName, options);\n }\n pointer(varName, options) {\n if (!options.offset) {\n throw new Error(\"offset is required for pointer.\");\n }\n if (!options.type) {\n throw new Error(\"type is required for pointer.\");\n }\n if (typeof options.type === \"string\" &&\n !(options.type in PRIMITIVE_SIZES) &&\n !aliasRegistry.has(options.type)) {\n throw new Error(`Pointer type \"${options.type}\" is unkown.`);\n }\n return this.setNextParser(\"pointer\", varName, options);\n }\n saveOffset(varName, options = {}) {\n return this.setNextParser(\"saveOffset\", varName, options);\n }\n endianness(endianness) {\n switch (endianness.toLowerCase()) {\n case \"little\":\n this.endian = \"le\";\n break;\n case \"big\":\n this.endian = \"be\";\n break;\n default:\n throw new Error('endianness must be one of \"little\" or \"big\"');\n }\n return this;\n }\n endianess(endianess) {\n return this.endianness(endianess);\n }\n useContextVars(useContextVariables = true) {\n this.useContextVariables = useContextVariables;\n return this;\n }\n create(constructorFn) {\n if (!(constructorFn instanceof Function)) {\n throw new Error(\"Constructor must be a Function object.\");\n }\n this.constructorFn = constructorFn;\n return this;\n }\n getContext(importPath) {\n const ctx = new Context(importPath, this.useContextVariables);\n ctx.pushCode(\"var dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);\");\n if (!this.alias) {\n this.addRawCode(ctx);\n }\n else {\n this.addAliasedCode(ctx);\n ctx.pushCode(`return ${FUNCTION_PREFIX + this.alias}(0).result;`);\n }\n return ctx;\n }\n getCode() {\n const importPath = \"imports\";\n return this.getContext(importPath).code;\n }\n addRawCode(ctx) {\n ctx.pushCode(\"var offset = 0;\");\n ctx.pushCode(`var vars = ${this.constructorFn ? \"new constructorFn()\" : \"{}\"};`);\n ctx.pushCode(\"vars.$parent = null;\");\n ctx.pushCode(\"vars.$root = vars;\");\n this.generate(ctx);\n this.resolveReferences(ctx);\n ctx.pushCode(\"delete vars.$parent;\");\n ctx.pushCode(\"delete vars.$root;\");\n ctx.pushCode(\"return vars;\");\n }\n addAliasedCode(ctx) {\n ctx.pushCode(`function ${FUNCTION_PREFIX + this.alias}(offset, context) {`);\n ctx.pushCode(`var vars = ${this.constructorFn ? \"new constructorFn()\" : \"{}\"};`);\n ctx.pushCode(\"var ctx = Object.assign({$parent: null, $root: vars}, context || {});\");\n ctx.pushCode(`vars = Object.assign(vars, ctx);`);\n this.generate(ctx);\n ctx.markResolved(this.alias);\n this.resolveReferences(ctx);\n ctx.pushCode(\"Object.keys(ctx).forEach(function (item) { delete vars[item]; });\");\n ctx.pushCode(\"return { offset: offset, result: vars };\");\n ctx.pushCode(\"}\");\n return ctx;\n }\n resolveReferences(ctx) {\n const references = ctx.getUnresolvedReferences();\n ctx.markRequested(references);\n references.forEach((alias) => {\n var _a;\n (_a = aliasRegistry.get(alias)) === null || _a === void 0 ? void 0 : _a.addAliasedCode(ctx);\n });\n }\n compile() {\n const importPath = \"imports\";\n const ctx = this.getContext(importPath);\n this.compiled = new Function(importPath, \"TextDecoder\", `return function (buffer, constructorFn) { ${ctx.code} };`)(ctx.imports, TextDecoder);\n }\n sizeOf() {\n let size = NaN;\n if (Object.keys(PRIMITIVE_SIZES).indexOf(this.type) >= 0) {\n size = PRIMITIVE_SIZES[this.type];\n // if this is a fixed length string\n }\n else if (this.type === \"string\" &&\n typeof this.options.length === \"number\") {\n size = this.options.length;\n // if this is a fixed length buffer\n }\n else if (this.type === \"buffer\" &&\n typeof this.options.length === \"number\") {\n size = this.options.length;\n // if this is a fixed length array\n }\n else if (this.type === \"array\" &&\n typeof this.options.length === \"number\") {\n let elementSize = NaN;\n if (typeof this.options.type === \"string\") {\n elementSize = PRIMITIVE_SIZES[this.options.type];\n }\n else if (this.options.type instanceof Parser) {\n elementSize = this.options.type.sizeOf();\n }\n size = this.options.length * elementSize;\n // if this a skip\n }\n else if (this.type === \"seek\") {\n size = this.options.length;\n // if this is a nested parser\n }\n else if (this.type === \"nest\") {\n size = this.options.type.sizeOf();\n }\n else if (!this.type) {\n size = 0;\n }\n if (this.next) {\n size += this.next.sizeOf();\n }\n return size;\n }\n // Follow the parser chain till the root and start parsing from there\n parse(buffer) {\n if (!this.compiled) {\n this.compile();\n }\n return this.compiled(buffer, this.constructorFn);\n }\n setNextParser(type, varName, options) {\n const parser = new Parser();\n parser.type = type;\n parser.varName = varName;\n parser.options = options;\n parser.endian = this.endian;\n if (this.head) {\n this.head.next = parser;\n }\n else {\n this.next = parser;\n }\n this.head = parser;\n return this;\n }\n // Call code generator for this parser\n generate(ctx) {\n if (this.type) {\n switch (this.type) {\n case \"uint8\":\n case \"uint16le\":\n case \"uint16be\":\n case \"uint32le\":\n case \"uint32be\":\n case \"int8\":\n case \"int16le\":\n case \"int16be\":\n case \"int32le\":\n case \"int32be\":\n case \"int64be\":\n case \"int64le\":\n case \"uint64be\":\n case \"uint64le\":\n case \"floatle\":\n case \"floatbe\":\n case \"doublele\":\n case \"doublebe\":\n this.primitiveGenerateN(this.type, ctx);\n break;\n case \"bit\":\n this.generateBit(ctx);\n break;\n case \"string\":\n this.generateString(ctx);\n break;\n case \"buffer\":\n this.generateBuffer(ctx);\n break;\n case \"seek\":\n this.generateSeek(ctx);\n break;\n case \"nest\":\n this.generateNest(ctx);\n break;\n case \"array\":\n this.generateArray(ctx);\n break;\n case \"choice\":\n this.generateChoice(ctx);\n break;\n case \"pointer\":\n this.generatePointer(ctx);\n break;\n case \"saveOffset\":\n this.generateSaveOffset(ctx);\n break;\n case \"wrapper\":\n this.generateWrapper(ctx);\n break;\n }\n if (this.type !== \"bit\")\n this.generateAssert(ctx);\n }\n const varName = ctx.generateVariable(this.varName);\n if (this.options.formatter && this.type !== \"bit\") {\n this.generateFormatter(ctx, varName, this.options.formatter);\n }\n return this.generateNext(ctx);\n }\n generateAssert(ctx) {\n if (!this.options.assert) {\n return;\n }\n const varName = ctx.generateVariable(this.varName);\n switch (typeof this.options.assert) {\n case \"function\":\n {\n const func = ctx.addImport(this.options.assert);\n ctx.pushCode(`if (!${func}.call(vars, ${varName})) {`);\n }\n break;\n case \"number\":\n ctx.pushCode(`if (${this.options.assert} !== ${varName}) {`);\n break;\n case \"string\":\n ctx.pushCode(`if (${JSON.stringify(this.options.assert)} !== ${varName}) {`);\n break;\n default:\n throw new Error(\"assert option must be a string, number or a function.\");\n }\n ctx.generateError(`\"Assertion error: ${varName} is \" + ${JSON.stringify(this.options.assert.toString())}`);\n ctx.pushCode(\"}\");\n }\n // Recursively call code generators and append results\n generateNext(ctx) {\n if (this.next) {\n ctx = this.next.generate(ctx);\n }\n return ctx;\n }\n generateBit(ctx) {\n // TODO find better method to handle nested bit fields\n const parser = JSON.parse(JSON.stringify(this));\n parser.options = this.options;\n parser.generateAssert = this.generateAssert.bind(this);\n parser.generateFormatter = this.generateFormatter.bind(this);\n parser.varName = ctx.generateVariable(parser.varName);\n ctx.bitFields.push(parser);\n if (!this.next ||\n (this.next && [\"bit\", \"nest\"].indexOf(this.next.type) < 0)) {\n const val = ctx.generateTmpVariable();\n ctx.pushCode(`var ${val} = 0;`);\n const getMaxBits = (from = 0) => {\n let sum = 0;\n for (let i = from; i < ctx.bitFields.length; i++) {\n const length = ctx.bitFields[i].options.length;\n if (sum + length > 32)\n break;\n sum += length;\n }\n return sum;\n };\n const getBytes = (sum) => {\n if (sum <= 8) {\n ctx.pushCode(`${val} = dataView.getUint8(offset);`);\n sum = 8;\n }\n else if (sum <= 16) {\n ctx.pushCode(`${val} = dataView.getUint16(offset);`);\n sum = 16;\n }\n else if (sum <= 24) {\n ctx.pushCode(`${val} = (dataView.getUint16(offset) << 8) | dataView.getUint8(offset + 2);`);\n sum = 24;\n }\n else {\n ctx.pushCode(`${val} = dataView.getUint32(offset);`);\n sum = 32;\n }\n ctx.pushCode(`offset += ${sum / 8};`);\n return sum;\n };\n let bitOffset = 0;\n const isBigEndian = this.endian === \"be\";\n let sum = 0;\n let rem = 0;\n ctx.bitFields.forEach((parser, i) => {\n let length = parser.options.length;\n if (length > rem) {\n if (rem) {\n const mask = -1 >>> (32 - rem);\n ctx.pushCode(`${parser.varName} = (${val} & 0x${mask.toString(16)}) << ${length - rem};`);\n length -= rem;\n }\n bitOffset = 0;\n rem = sum = getBytes(getMaxBits(i) - rem);\n }\n const offset = isBigEndian ? sum - bitOffset - length : bitOffset;\n const mask = -1 >>> (32 - length);\n ctx.pushCode(`${parser.varName} ${length < parser.options.length ? \"|=\" : \"=\"} ${val} >> ${offset} & 0x${mask.toString(16)};`);\n // Ensure value is unsigned\n if (parser.options.length === 32) {\n ctx.pushCode(`${parser.varName} >>>= 0`);\n }\n if (parser.options.assert) {\n parser.generateAssert(ctx);\n }\n if (parser.options.formatter) {\n parser.generateFormatter(ctx, parser.varName, parser.options.formatter);\n }\n bitOffset += length;\n rem -= length;\n });\n ctx.bitFields = [];\n }\n }\n generateSeek(ctx) {\n const length = ctx.generateOption(this.options.length);\n ctx.pushCode(`offset += ${length};`);\n }\n generateString(ctx) {\n const name = ctx.generateVariable(this.varName);\n const start = ctx.generateTmpVariable();\n const encoding = this.options.encoding;\n const isHex = encoding.toLowerCase() === \"hex\";\n const toHex = 'b => b.toString(16).padStart(2, \"0\")';\n if (this.options.length && this.options.zeroTerminated) {\n const len = this.options.length;\n ctx.pushCode(`var ${start} = offset;`);\n ctx.pushCode(`while(dataView.getUint8(offset++) !== 0 && offset - ${start} < ${len});`);\n const end = `offset - ${start} < ${len} ? offset - 1 : offset`;\n ctx.pushCode(isHex\n ? `${name} = Array.from(buffer.subarray(${start}, ${end}), ${toHex}).join('');`\n : `${name} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, ${end}));`);\n }\n else if (this.options.length) {\n const len = ctx.generateOption(this.options.length);\n ctx.pushCode(isHex\n ? `${name} = Array.from(buffer.subarray(offset, offset + ${len}), ${toHex}).join('');`\n : `${name} = new TextDecoder('${encoding}').decode(buffer.subarray(offset, offset + ${len}));`);\n ctx.pushCode(`offset += ${len};`);\n }\n else if (this.options.zeroTerminated) {\n ctx.pushCode(`var ${start} = offset;`);\n ctx.pushCode(\"while(dataView.getUint8(offset++) !== 0);\");\n ctx.pushCode(isHex\n ? `${name} = Array.from(buffer.subarray(${start}, offset - 1), ${toHex}).join('');`\n : `${name} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, offset - 1));`);\n }\n else if (this.options.greedy) {\n ctx.pushCode(`var ${start} = offset;`);\n ctx.pushCode(\"while(buffer.length > offset++);\");\n ctx.pushCode(isHex\n ? `${name} = Array.from(buffer.subarray(${start}, offset), ${toHex}).join('');`\n : `${name} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, offset));`);\n }\n if (this.options.stripNull) {\n ctx.pushCode(`${name} = ${name}.replace(/\\\\x00+$/g, '')`);\n }\n }\n generateBuffer(ctx) {\n const varName = ctx.generateVariable(this.varName);\n if (typeof this.options.readUntil === \"function\") {\n const pred = this.options.readUntil;\n const start = ctx.generateTmpVariable();\n const cur = ctx.generateTmpVariable();\n ctx.pushCode(`var ${start} = offset;`);\n ctx.pushCode(`var ${cur} = 0;`);\n ctx.pushCode(`while (offset < buffer.length) {`);\n ctx.pushCode(`${cur} = dataView.getUint8(offset);`);\n const func = ctx.addImport(pred);\n ctx.pushCode(`if (${func}.call(${ctx.generateVariable()}, ${cur}, buffer.subarray(offset))) break;`);\n ctx.pushCode(`offset += 1;`);\n ctx.pushCode(`}`);\n ctx.pushCode(`${varName} = buffer.subarray(${start}, offset);`);\n }\n else if (this.options.readUntil === \"eof\") {\n ctx.pushCode(`${varName} = buffer.subarray(offset);`);\n }\n else {\n const len = ctx.generateOption(this.options.length);\n ctx.pushCode(`${varName} = buffer.subarray(offset, offset + ${len});`);\n ctx.pushCode(`offset += ${len};`);\n }\n if (this.options.clone) {\n ctx.pushCode(`${varName} = buffer.constructor.from(${varName});`);\n }\n }\n generateArray(ctx) {\n const length = ctx.generateOption(this.options.length);\n const lengthInBytes = ctx.generateOption(this.options.lengthInBytes);\n const type = this.options.type;\n const counter = ctx.generateTmpVariable();\n const lhs = ctx.generateVariable(this.varName);\n const item = ctx.generateTmpVariable();\n const key = this.options.key;\n const isHash = typeof key === \"string\";\n if (isHash) {\n ctx.pushCode(`${lhs} = {};`);\n }\n else {\n ctx.pushCode(`${lhs} = [];`);\n }\n if (typeof this.options.readUntil === \"function\") {\n ctx.pushCode(\"do {\");\n }\n else if (this.options.readUntil === \"eof\") {\n ctx.pushCode(`for (var ${counter} = 0; offset < buffer.length; ${counter}++) {`);\n }\n else if (lengthInBytes !== undefined) {\n ctx.pushCode(`for (var ${counter} = offset + ${lengthInBytes}; offset < ${counter}; ) {`);\n }\n else {\n ctx.pushCode(`for (var ${counter} = ${length}; ${counter} > 0; ${counter}--) {`);\n }\n if (typeof type === \"string\") {\n if (!aliasRegistry.get(type)) {\n const typeName = PRIMITIVE_NAMES[type];\n const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type];\n ctx.pushCode(`var ${item} = dataView.get${typeName}(offset, ${littleEndian});`);\n ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`);\n }\n else {\n const tempVar = ctx.generateTmpVariable();\n ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + type}(offset, {`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`$parent: ${parentVar},`);\n ctx.pushCode(`$root: ${parentVar}.$root,`);\n if (!this.options.readUntil && lengthInBytes === undefined) {\n ctx.pushCode(`$index: ${length} - ${counter},`);\n }\n }\n ctx.pushCode(`});`);\n ctx.pushCode(`var ${item} = ${tempVar}.result; offset = ${tempVar}.offset;`);\n if (type !== this.alias)\n ctx.addReference(type);\n }\n }\n else if (type instanceof Parser) {\n ctx.pushCode(`var ${item} = {};`);\n const parentVar = ctx.generateVariable();\n ctx.pushScope(item);\n if (ctx.useContextVariables) {\n ctx.pushCode(`${item}.$parent = ${parentVar};`);\n ctx.pushCode(`${item}.$root = ${parentVar}.$root;`);\n if (!this.options.readUntil && lengthInBytes === undefined) {\n ctx.pushCode(`${item}.$index = ${length} - ${counter};`);\n }\n }\n type.generate(ctx);\n if (ctx.useContextVariables) {\n ctx.pushCode(`delete ${item}.$parent;`);\n ctx.pushCode(`delete ${item}.$root;`);\n ctx.pushCode(`delete ${item}.$index;`);\n }\n ctx.popScope();\n }\n if (isHash) {\n ctx.pushCode(`${lhs}[${item}.${key}] = ${item};`);\n }\n else {\n ctx.pushCode(`${lhs}.push(${item});`);\n }\n ctx.pushCode(\"}\");\n if (typeof this.options.readUntil === \"function\") {\n const pred = this.options.readUntil;\n const func = ctx.addImport(pred);\n ctx.pushCode(`while (!${func}.call(${ctx.generateVariable()}, ${item}, buffer.subarray(offset)));`);\n }\n }\n generateChoiceCase(ctx, varName, type) {\n if (typeof type === \"string\") {\n const varName = ctx.generateVariable(this.varName);\n if (!aliasRegistry.has(type)) {\n const typeName = PRIMITIVE_NAMES[type];\n const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type];\n ctx.pushCode(`${varName} = dataView.get${typeName}(offset, ${littleEndian});`);\n ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]}`);\n }\n else {\n const tempVar = ctx.generateTmpVariable();\n ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + type}(offset, {`);\n if (ctx.useContextVariables) {\n ctx.pushCode(`$parent: ${varName}.$parent,`);\n ctx.pushCode(`$root: ${varName}.$root,`);\n }\n ctx.pushCode(`});`);\n ctx.pushCode(`${varName} = ${tempVar}.result; offset = ${tempVar}.offset;`);\n if (type !== this.alias)\n ctx.addReference(type);\n }\n }\n else if (type instanceof Parser) {\n ctx.pushPath(varName);\n type.generate(ctx);\n ctx.popPath(varName);\n }\n }\n generateChoice(ctx) {\n const tag = ctx.generateOption(this.options.tag);\n const nestVar = ctx.generateVariable(this.varName);\n if (this.varName) {\n ctx.pushCode(`${nestVar} = {};`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`${nestVar}.$parent = ${parentVar};`);\n ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`);\n }\n }\n ctx.pushCode(`switch(${tag}) {`);\n for (const tagString in this.options.choices) {\n const tag = parseInt(tagString, 10);\n const type = this.options.choices[tag];\n ctx.pushCode(`case ${tag}:`);\n this.generateChoiceCase(ctx, this.varName, type);\n ctx.pushCode(\"break;\");\n }\n ctx.pushCode(\"default:\");\n if (this.options.defaultChoice) {\n this.generateChoiceCase(ctx, this.varName, this.options.defaultChoice);\n }\n else {\n ctx.generateError(`\"Met undefined tag value \" + ${tag} + \" at choice\"`);\n }\n ctx.pushCode(\"}\");\n if (this.varName && ctx.useContextVariables) {\n ctx.pushCode(`delete ${nestVar}.$parent;`);\n ctx.pushCode(`delete ${nestVar}.$root;`);\n }\n }\n generateNest(ctx) {\n const nestVar = ctx.generateVariable(this.varName);\n if (this.options.type instanceof Parser) {\n if (this.varName) {\n ctx.pushCode(`${nestVar} = {};`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`${nestVar}.$parent = ${parentVar};`);\n ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`);\n }\n }\n ctx.pushPath(this.varName);\n this.options.type.generate(ctx);\n ctx.popPath(this.varName);\n if (this.varName && ctx.useContextVariables) {\n if (ctx.useContextVariables) {\n ctx.pushCode(`delete ${nestVar}.$parent;`);\n ctx.pushCode(`delete ${nestVar}.$root;`);\n }\n }\n }\n else if (aliasRegistry.has(this.options.type)) {\n const tempVar = ctx.generateTmpVariable();\n ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + this.options.type}(offset, {`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`$parent: ${parentVar},`);\n ctx.pushCode(`$root: ${parentVar}.$root,`);\n }\n ctx.pushCode(`});`);\n ctx.pushCode(`${nestVar} = ${tempVar}.result; offset = ${tempVar}.offset;`);\n if (this.options.type !== this.alias) {\n ctx.addReference(this.options.type);\n }\n }\n }\n generateWrapper(ctx) {\n const wrapperVar = ctx.generateVariable(this.varName);\n const wrappedBuf = ctx.generateTmpVariable();\n if (typeof this.options.readUntil === \"function\") {\n const pred = this.options.readUntil;\n const start = ctx.generateTmpVariable();\n const cur = ctx.generateTmpVariable();\n ctx.pushCode(`var ${start} = offset;`);\n ctx.pushCode(`var ${cur} = 0;`);\n ctx.pushCode(`while (offset < buffer.length) {`);\n ctx.pushCode(`${cur} = dataView.getUint8(offset);`);\n const func = ctx.addImport(pred);\n ctx.pushCode(`if (${func}.call(${ctx.generateVariable()}, ${cur}, buffer.subarray(offset))) break;`);\n ctx.pushCode(`offset += 1;`);\n ctx.pushCode(`}`);\n ctx.pushCode(`${wrappedBuf} = buffer.subarray(${start}, offset);`);\n }\n else if (this.options.readUntil === \"eof\") {\n ctx.pushCode(`${wrappedBuf} = buffer.subarray(offset);`);\n }\n else {\n const len = ctx.generateOption(this.options.length);\n ctx.pushCode(`${wrappedBuf} = buffer.subarray(offset, offset + ${len});`);\n ctx.pushCode(`offset += ${len};`);\n }\n if (this.options.clone) {\n ctx.pushCode(`${wrappedBuf} = buffer.constructor.from(${wrappedBuf});`);\n }\n const tempBuf = ctx.generateTmpVariable();\n const tempOff = ctx.generateTmpVariable();\n const tempView = ctx.generateTmpVariable();\n const func = ctx.addImport(this.options.wrapper);\n ctx.pushCode(`${wrappedBuf} = ${func}.call(this, ${wrappedBuf}).subarray(0);`);\n ctx.pushCode(`var ${tempBuf} = buffer;`);\n ctx.pushCode(`var ${tempOff} = offset;`);\n ctx.pushCode(`var ${tempView} = dataView;`);\n ctx.pushCode(`buffer = ${wrappedBuf};`);\n ctx.pushCode(`offset = 0;`);\n ctx.pushCode(`dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);`);\n if (this.options.type instanceof Parser) {\n if (this.varName) {\n ctx.pushCode(`${wrapperVar} = {};`);\n }\n ctx.pushPath(this.varName);\n this.options.type.generate(ctx);\n ctx.popPath(this.varName);\n }\n else if (aliasRegistry.has(this.options.type)) {\n const tempVar = ctx.generateTmpVariable();\n ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + this.options.type}(0);`);\n ctx.pushCode(`${wrapperVar} = ${tempVar}.result;`);\n if (this.options.type !== this.alias) {\n ctx.addReference(this.options.type);\n }\n }\n ctx.pushCode(`buffer = ${tempBuf};`);\n ctx.pushCode(`dataView = ${tempView};`);\n ctx.pushCode(`offset = ${tempOff};`);\n }\n generateFormatter(ctx, varName, formatter) {\n if (typeof formatter === \"function\") {\n const func = ctx.addImport(formatter);\n ctx.pushCode(`${varName} = ${func}.call(${ctx.generateVariable()}, ${varName});`);\n }\n }\n generatePointer(ctx) {\n const type = this.options.type;\n const offset = ctx.generateOption(this.options.offset);\n const tempVar = ctx.generateTmpVariable();\n const nestVar = ctx.generateVariable(this.varName);\n // Save current offset\n ctx.pushCode(`var ${tempVar} = offset;`);\n // Move offset\n ctx.pushCode(`offset = ${offset};`);\n if (this.options.type instanceof Parser) {\n ctx.pushCode(`${nestVar} = {};`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`${nestVar}.$parent = ${parentVar};`);\n ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`);\n }\n ctx.pushPath(this.varName);\n this.options.type.generate(ctx);\n ctx.popPath(this.varName);\n if (ctx.useContextVariables) {\n ctx.pushCode(`delete ${nestVar}.$parent;`);\n ctx.pushCode(`delete ${nestVar}.$root;`);\n }\n }\n else if (aliasRegistry.has(this.options.type)) {\n const tempVar = ctx.generateTmpVariable();\n ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + this.options.type}(offset, {`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`$parent: ${parentVar},`);\n ctx.pushCode(`$root: ${parentVar}.$root,`);\n }\n ctx.pushCode(`});`);\n ctx.pushCode(`${nestVar} = ${tempVar}.result; offset = ${tempVar}.offset;`);\n if (this.options.type !== this.alias) {\n ctx.addReference(this.options.type);\n }\n }\n else if (Object.keys(PRIMITIVE_SIZES).indexOf(this.options.type) >= 0) {\n const typeName = PRIMITIVE_NAMES[type];\n const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type];\n ctx.pushCode(`${nestVar} = dataView.get${typeName}(offset, ${littleEndian});`);\n ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`);\n }\n // Restore offset\n ctx.pushCode(`offset = ${tempVar};`);\n }\n generateSaveOffset(ctx) {\n const varName = ctx.generateVariable(this.varName);\n ctx.pushCode(`${varName} = offset`);\n }\n}\n//# sourceMappingURL=binary_parser.js.map","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get.apply(this, arguments);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'reason', {\n value: undefined,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort(reason) {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n var signalReason = reason;\n\n if (signalReason === undefined) {\n if (typeof document === 'undefined') {\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n } else {\n try {\n signalReason = new DOMException('signal is aborted without reason');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n }\n }\n }\n\n this.signal.reason = signalReason;\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","\"use strict\";\n/* eslint-disable */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbortSignal = exports.AbortController = void 0;\nconst cjs_ponyfill_1 = require(\"abortcontroller-polyfill/dist/cjs-ponyfill\");\nvar getGlobal = function () {\n // the only reliable means to get the global object is\n // `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n};\n//@ts-ignore\nlet AbortController = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortController : getGlobal().AbortController;\nexports.AbortController = AbortController;\n//@ts-ignore\nlet AbortSignal = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal;\nexports.AbortSignal = AbortSignal;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nclass NullSignal {\n}\n/**\n * aggregates a number of abort signals, will only fire the aggregated\n * abort if all of the input signals have been aborted\n */\nclass AggregateAbortController {\n constructor() {\n this.signals = new Set();\n this.abortController = new abortcontroller_ponyfill_1.AbortController();\n }\n /**\n * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy,\n * will be treated as a null-signal, and this abortcontroller will no\n * longer be abortable.\n */\n //@ts-ignore\n addSignal(signal = new NullSignal()) {\n if (this.signal.aborted) {\n throw new Error('cannot add a signal, already aborted!');\n }\n // note that a NullSignal will never fire, so if we\n // have one this thing will never actually abort\n this.signals.add(signal);\n if (signal.aborted) {\n // handle the abort immediately if it is already aborted\n // for some reason\n this.handleAborted(signal);\n }\n else if (typeof signal.addEventListener === 'function') {\n signal.addEventListener('abort', () => {\n this.handleAborted(signal);\n });\n }\n }\n handleAborted(signal) {\n this.signals.delete(signal);\n if (this.signals.size === 0) {\n this.abortController.abort();\n }\n }\n get signal() {\n return this.abortController.signal;\n }\n abort() {\n this.abortController.abort();\n }\n}\nexports.default = AggregateAbortController;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass AggregateStatusReporter {\n constructor() {\n this.callbacks = new Set();\n }\n addCallback(callback = () => { }) {\n this.callbacks.add(callback);\n callback(this.currentMessage);\n }\n callback(message) {\n this.currentMessage = message;\n this.callbacks.forEach(elt => {\n elt(message);\n });\n }\n}\nexports.default = AggregateStatusReporter;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nconst AggregateAbortController_1 = __importDefault(require(\"./AggregateAbortController\"));\nconst AggregateStatusReporter_1 = __importDefault(require(\"./AggregateStatusReporter\"));\nclass AbortablePromiseCache {\n constructor({ fill, cache, }) {\n if (typeof fill !== 'function') {\n throw new TypeError('must pass a fill function');\n }\n if (typeof cache !== 'object') {\n throw new TypeError('must pass a cache object');\n }\n if (typeof cache.get !== 'function' ||\n typeof cache.set !== 'function' ||\n typeof cache.delete !== 'function') {\n throw new TypeError('cache must implement get(key), set(key, val), and and delete(key)');\n }\n this.cache = cache;\n this.fillCallback = fill;\n }\n static isAbortException(exception) {\n return (\n // DOMException\n exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n //@ts-ignore\n exception.code === 'ERR_ABORTED' ||\n // stringified DOMException\n exception.message === 'AbortError: aborted' ||\n // stringified standard-ish exception\n exception.message === 'Error: aborted');\n }\n evict(key, entry) {\n if (this.cache.get(key) === entry) {\n this.cache.delete(key);\n }\n }\n fill(key, data, signal, statusCallback) {\n const aborter = new AggregateAbortController_1.default();\n const statusReporter = new AggregateStatusReporter_1.default();\n statusReporter.addCallback(statusCallback);\n const newEntry = {\n aborter: aborter,\n promise: this.fillCallback(data, aborter.signal, (message) => {\n statusReporter.callback(message);\n }),\n settled: false,\n statusReporter,\n get aborted() {\n return this.aborter.signal.aborted;\n },\n };\n newEntry.aborter.addSignal(signal);\n // remove the fill from the cache when its abortcontroller fires, if still in there\n newEntry.aborter.signal.addEventListener('abort', () => {\n if (!newEntry.settled) {\n this.evict(key, newEntry);\n }\n });\n // chain off the cached promise to record when it settles\n newEntry.promise\n .then(() => {\n newEntry.settled = true;\n }, () => {\n newEntry.settled = true;\n // if the fill throws an error (including abort) and is still in the cache, remove it\n this.evict(key, newEntry);\n })\n .catch(e => {\n // this will only be reached if there is some kind of\n // bad bug in this library\n console.error(e);\n throw e;\n });\n this.cache.set(key, newEntry);\n }\n static checkSinglePromise(promise, signal) {\n // check just this signal for having been aborted, and abort the\n // promise if it was, regardless of what happened with the cached\n // response\n function checkForSingleAbort() {\n if (signal && signal.aborted) {\n throw Object.assign(new Error('aborted'), { code: 'ERR_ABORTED' });\n }\n }\n return promise.then(result => {\n checkForSingleAbort();\n return result;\n }, error => {\n checkForSingleAbort();\n throw error;\n });\n }\n has(key) {\n return this.cache.has(key);\n }\n /**\n * Callback for getting status of the pending async\n *\n * @callback statusCallback\n * @param {any} status, current status string or message object\n */\n /**\n * @param {any} key cache key to use for this request\n * @param {any} data data passed as the first argument to the fill callback\n * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request\n * @param {statusCallback} a callback to get the current status of a pending async operation\n */\n get(key, data, signal, statusCallback) {\n if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) {\n throw new TypeError('second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?');\n }\n const cacheEntry = this.cache.get(key);\n if (cacheEntry) {\n if (cacheEntry.aborted && !cacheEntry.settled) {\n // if it's aborted but has not realized it yet, evict it and redispatch\n this.evict(key, cacheEntry);\n return this.get(key, data, signal, statusCallback);\n }\n if (cacheEntry.settled) {\n // too late to abort, just return it\n return cacheEntry.promise;\n }\n // request is in-flight, add this signal to its list of signals,\n // or if there is no signal, the aborter will become non-abortable\n cacheEntry.aborter.addSignal(signal);\n cacheEntry.statusReporter.addCallback(statusCallback);\n return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal);\n }\n // if we got here, it is not in the cache. fill.\n this.fill(key, data, signal, statusCallback);\n return AbortablePromiseCache.checkSinglePromise(\n //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-\n //eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.cache.get(key).promise, signal);\n }\n /**\n * delete the given entry from the cache. if it exists and its fill request has\n * not yet settled, the fill will be signaled to abort.\n *\n * @param {any} key\n */\n delete(key) {\n const cachedEntry = this.cache.get(key);\n if (cachedEntry) {\n if (!cachedEntry.settled) {\n cachedEntry.aborter.abort();\n }\n this.cache.delete(key);\n }\n }\n /**\n * Clear all requests from the cache. Aborts any that have not settled.\n * @returns {number} count of entries deleted\n */\n clear() {\n // iterate without needing regenerator-runtime\n const keyIter = this.cache.keys();\n let deleteCount = 0;\n for (let result = keyIter.next(); !result.done; result = keyIter.next()) {\n this.delete(result.value);\n deleteCount += 1;\n }\n return deleteCount;\n }\n}\nexports.default = AbortablePromiseCache;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst AbortablePromiseCache_1 = __importDefault(require(\"./AbortablePromiseCache\"));\nexports.default = AbortablePromiseCache_1.default;\n","/* eslint prefer-rest-params:0, no-nested-ternary:0 */\n/**\n * Adapted from a combination of Range and _Compound in the\n * Dalliance Genome Explorer, (c) Thomas Down 2006-2010.\n */\nexport default class Range {\n constructor(arg1, arg2) {\n this.ranges =\n arguments.length === 2\n ? [{ min: arg1, max: arg2 }]\n : 0 in arg1\n ? Object.assign({}, arg1)\n : [arg1];\n }\n min() {\n return this.ranges[0].min;\n }\n max() {\n return this.ranges[this.ranges.length - 1].max;\n }\n contains(pos) {\n for (let s = 0; s < this.ranges.length; s += 1) {\n const r = this.ranges[s];\n if (r.min <= pos && r.max >= pos) {\n return true;\n }\n }\n return false;\n }\n isContiguous() {\n return this.ranges.length > 1;\n }\n getRanges() {\n return this.ranges.map((r) => new Range(r.min, r.max));\n }\n toString() {\n return this.ranges.map((r) => `[${r.min}-${r.max}]`).join(',');\n }\n union(s1) {\n const ranges = this.getRanges().concat(s1.getRanges()).sort(this.rangeOrder);\n const oranges = [];\n let current = ranges[0];\n for (let i = 1; i < ranges.length; i += 1) {\n const nxt = ranges[i];\n if (nxt.min() > current.max() + 1) {\n oranges.push(current);\n current = nxt;\n }\n else if (nxt.max() > current.max()) {\n current = new Range(current.min(), nxt.max());\n }\n }\n oranges.push(current);\n if (oranges.length === 1) {\n return oranges[0];\n }\n return new Range(oranges);\n }\n intersection(arg) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let s0 = this;\n let s1 = arg;\n const r0 = this.ranges();\n const r1 = s1.ranges();\n const l0 = r0.length;\n const l1 = r1.length;\n let i0 = 0;\n let i1 = 0;\n const or = [];\n while (i0 < l0 && i1 < l1) {\n s0 = r0[i0];\n s1 = r1[i1];\n const lapMin = Math.max(s0.min(), s1.min());\n const lapMax = Math.min(s0.max(), s1.max());\n if (lapMax >= lapMin) {\n or.push(new Range(lapMin, lapMax));\n }\n if (s0.max() > s1.max()) {\n i1 += 1;\n }\n else {\n i0 += 1;\n }\n }\n if (or.length === 0) {\n throw new Error('found range of length 0');\n }\n if (or.length === 1) {\n return or[0];\n }\n return new Range(or);\n }\n coverage() {\n let tot = 0;\n const rl = this.ranges();\n for (let ri = 0; ri < rl.length; ri += 1) {\n const r = rl[ri];\n tot += r.max() - r.min() + 1;\n }\n return tot;\n }\n rangeOrder(tmpa, tmpb) {\n let a = tmpa;\n let b = tmpb;\n if (arguments.length < 2) {\n b = a;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n a = this;\n }\n if (a.min() < b.min()) {\n return -1;\n }\n if (a.min() > b.min()) {\n return 1;\n }\n if (a.max() < b.max()) {\n return -1;\n }\n if (b.max() > a.max()) {\n return 1;\n }\n return 0;\n }\n}\n//# sourceMappingURL=range.js.map","\n/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//const Z_FILTERED = 1;\n//const Z_HUFFMAN_ONLY = 2;\n//const Z_RLE = 3;\nconst Z_FIXED$1 = 4;\n//const Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nconst Z_BINARY = 0;\nconst Z_TEXT = 1;\n//const Z_ASCII = 1; // = Z_TEXT\nconst Z_UNKNOWN$1 = 2;\n\n/*============================================================================*/\n\n\nfunction zero$1(buf) { let len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nconst STORED_BLOCK = 0;\nconst STATIC_TREES = 1;\nconst DYN_TREES = 2;\n/* The three kinds of block type */\n\nconst MIN_MATCH$1 = 3;\nconst MAX_MATCH$1 = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nconst LENGTH_CODES$1 = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nconst LITERALS$1 = 256;\n/* number of literal bytes 0..255 */\n\nconst L_CODES$1 = LITERALS$1 + 1 + LENGTH_CODES$1;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nconst D_CODES$1 = 30;\n/* number of distance codes */\n\nconst BL_CODES$1 = 19;\n/* number of codes used to transfer the bit lengths */\n\nconst HEAP_SIZE$1 = 2 * L_CODES$1 + 1;\n/* maximum heap size */\n\nconst MAX_BITS$1 = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nconst Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nconst MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nconst END_BLOCK = 256;\n/* end of block literal code */\n\nconst REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nconst REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nconst REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nconst extra_lbits = /* extra bits for each length code */\n new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]);\n\nconst extra_dbits = /* extra bits for each distance code */\n new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]);\n\nconst extra_blbits = /* extra bits for each bit length code */\n new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]);\n\nconst bl_order =\n new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nconst DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nconst static_ltree = new Array((L_CODES$1 + 2) * 2);\nzero$1(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nconst static_dtree = new Array(D_CODES$1 * 2);\nzero$1(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nconst _dist_code = new Array(DIST_CODE_LEN);\nzero$1(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nconst _length_code = new Array(MAX_MATCH$1 - MIN_MATCH$1 + 1);\nzero$1(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nconst base_length = new Array(LENGTH_CODES$1);\nzero$1(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nconst base_dist = new Array(D_CODES$1);\nzero$1(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nlet static_l_desc;\nlet static_d_desc;\nlet static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nconst d_code = (dist) => {\n\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n};\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nconst put_short = (s, w) => {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n};\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nconst send_bits = (s, value, length) => {\n\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n};\n\n\nconst send_code = (s, c, tree) => {\n\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n};\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nconst bi_reverse = (code, len) => {\n\n let res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n};\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nconst bi_flush = (s) => {\n\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n};\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nconst gen_bitlen = (s, desc) => {\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n\n const tree = desc.dyn_tree;\n const max_code = desc.max_code;\n const stree = desc.stat_desc.static_tree;\n const has_stree = desc.stat_desc.has_stree;\n const extra = desc.stat_desc.extra_bits;\n const base = desc.stat_desc.extra_base;\n const max_length = desc.stat_desc.max_length;\n let h; /* heap index */\n let n, m; /* iterate over the tree elements */\n let bits; /* bit length */\n let xbits; /* extra bits */\n let f; /* frequency */\n let overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS$1; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE$1; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Tracev((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Tracev((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n};\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nconst gen_codes = (tree, max_code, bl_count) => {\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n\n const next_code = new Array(MAX_BITS$1 + 1); /* next code value for each bit length */\n let code = 0; /* running code value */\n let bits; /* bit index */\n let n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS$1; bits++) {\n code = (code + bl_count[bits - 1]) << 1;\n next_code[bits] = code;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< {\n\n let n; /* iterates over tree elements */\n let bits; /* bit counter */\n let length; /* length value */\n let code; /* code value */\n let dist; /* distance index */\n const bl_count = new Array(MAX_BITS$1 + 1);\n /* number of codes at each bit length for an optimal tree */\n\n // do check in _tr_init()\n //if (static_init_done) return;\n\n /* For some embedded targets, global variables are not initialized: */\n/*#ifdef NO_INIT_GLOBAL_POINTERS\n static_l_desc.static_tree = static_ltree;\n static_l_desc.extra_bits = extra_lbits;\n static_d_desc.static_tree = static_dtree;\n static_d_desc.extra_bits = extra_dbits;\n static_bl_desc.extra_bits = extra_blbits;\n#endif*/\n\n /* Initialize the mapping length (0..255) -> length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES$1 - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES$1; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS$1; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES$1 + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES$1; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS$1 + 1, L_CODES$1, MAX_BITS$1);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES$1, MAX_BITS$1);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES$1, MAX_BL_BITS);\n\n //static_init_done = true;\n};\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nconst init_block = (s) => {\n\n let n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES$1; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES$1; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES$1; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.sym_next = s.matches = 0;\n};\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nconst bi_windup = (s) =>\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n};\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nconst smaller = (tree, n, m, depth) => {\n\n const _n2 = n * 2;\n const _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n};\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nconst pqdownheap = (s, tree, k) => {\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n\n const v = s.heap[k];\n let j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n};\n\n\n// inlined manually\n// const SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nconst compress_block = (s, ltree, dtree) => {\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n\n let dist; /* distance of matched string */\n let lc; /* match length or unmatched char (if dist == 0) */\n let sx = 0; /* running index in sym_buf */\n let code; /* the code to send */\n let extra; /* number of extra bits to send */\n\n if (s.sym_next !== 0) {\n do {\n dist = s.pending_buf[s.sym_buf + sx++] & 0xff;\n dist += (s.pending_buf[s.sym_buf + sx++] & 0xff) << 8;\n lc = s.pending_buf[s.sym_buf + sx++];\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS$1 + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and sym_buf is ok: */\n //Assert(s->pending < s->lit_bufsize + sx, \"pendingBuf overflow\");\n\n } while (sx < s.sym_next);\n }\n\n send_code(s, END_BLOCK, ltree);\n};\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nconst build_tree = (s, desc) => {\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n\n const tree = desc.dyn_tree;\n const stree = desc.stat_desc.static_tree;\n const has_stree = desc.stat_desc.has_stree;\n const elems = desc.stat_desc.elems;\n let n, m; /* iterate over heap elements */\n let max_code = -1; /* largest code with non zero frequency */\n let node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE$1;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n};\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nconst scan_tree = (s, tree, max_code) => {\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n\n let n; /* iterates over all tree elements */\n let prevlen = -1; /* last emitted length */\n let curlen; /* length of current code */\n\n let nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n let count = 0; /* repeat count of the current code */\n let max_count = 7; /* max repeat count */\n let min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n};\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nconst send_tree = (s, tree, max_code) => {\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n\n let n; /* iterates over all tree elements */\n let prevlen = -1; /* last emitted length */\n let curlen; /* length of current code */\n\n let nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n let count = 0; /* repeat count of the current code */\n let max_count = 7; /* max repeat count */\n let min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n};\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nconst build_bl_tree = (s) => {\n\n let max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES$1 - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n};\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nconst send_all_trees = (s, lcodes, dcodes, blcodes) => {\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n\n let rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n};\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"block list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"allow list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nconst detect_data_type = (s) => {\n /* block_mask is the bit mask of block-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n let block_mask = 0xf3ffc07f;\n let n;\n\n /* Check for non-textual (\"block-listed\") bytes. */\n for (n = 0; n <= 31; n++, block_mask >>>= 1) {\n if ((block_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"allow-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS$1; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"block-listed\" or \"allow-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n};\n\n\nlet static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nconst _tr_init$1 = (s) =>\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n};\n\n\n/* ===========================================================================\n * Send a stored block\n */\nconst _tr_stored_block$1 = (s, buf, stored_len, last) => {\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n bi_windup(s); /* align on byte boundary */\n put_short(s, stored_len);\n put_short(s, ~stored_len);\n if (stored_len) {\n s.pending_buf.set(s.window.subarray(buf, buf + stored_len), s.pending);\n }\n s.pending += stored_len;\n};\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nconst _tr_align$1 = (s) => {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n};\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and write out the encoded block.\n */\nconst _tr_flush_block$1 = (s, buf, stored_len, last) => {\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n\n let opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n let max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN$1) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->sym_next / 3));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block$1(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED$1 || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n};\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nconst _tr_tally$1 = (s, dist, lc) => {\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n\n s.pending_buf[s.sym_buf + s.sym_next++] = dist;\n s.pending_buf[s.sym_buf + s.sym_next++] = dist >> 8;\n s.pending_buf[s.sym_buf + s.sym_next++] = lc;\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS$1 + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n return (s.sym_next === s.sym_end);\n};\n\nvar _tr_init_1 = _tr_init$1;\nvar _tr_stored_block_1 = _tr_stored_block$1;\nvar _tr_flush_block_1 = _tr_flush_block$1;\nvar _tr_tally_1 = _tr_tally$1;\nvar _tr_align_1 = _tr_align$1;\n\nvar trees = {\n\t_tr_init: _tr_init_1,\n\t_tr_stored_block: _tr_stored_block_1,\n\t_tr_flush_block: _tr_flush_block_1,\n\t_tr_tally: _tr_tally_1,\n\t_tr_align: _tr_align_1\n};\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst adler32 = (adler, buf, len, pos) => {\n let s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n};\n\n\nvar adler32_1 = adler32;\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nconst makeTable = () => {\n let c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n};\n\n// Create table on load. Just 255 signed longs. Not a problem.\nconst crcTable = new Uint32Array(makeTable());\n\n\nconst crc32 = (crc, buf, len, pos) => {\n const t = crcTable;\n const end = pos + len;\n\n crc ^= -1;\n\n for (let i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n};\n\n\nvar crc32_1 = crc32;\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar messages = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar constants$2 = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = trees;\n\n\n\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH: Z_NO_FLUSH$2, Z_PARTIAL_FLUSH, Z_FULL_FLUSH: Z_FULL_FLUSH$1, Z_FINISH: Z_FINISH$3, Z_BLOCK: Z_BLOCK$1,\n Z_OK: Z_OK$3, Z_STREAM_END: Z_STREAM_END$3, Z_STREAM_ERROR: Z_STREAM_ERROR$2, Z_DATA_ERROR: Z_DATA_ERROR$2, Z_BUF_ERROR: Z_BUF_ERROR$1,\n Z_DEFAULT_COMPRESSION: Z_DEFAULT_COMPRESSION$1,\n Z_FILTERED, Z_HUFFMAN_ONLY, Z_RLE, Z_FIXED, Z_DEFAULT_STRATEGY: Z_DEFAULT_STRATEGY$1,\n Z_UNKNOWN,\n Z_DEFLATED: Z_DEFLATED$2\n} = constants$2;\n\n/*============================================================================*/\n\n\nconst MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nconst MAX_WBITS$1 = 15;\n/* 32K LZ77 window */\nconst DEF_MEM_LEVEL = 8;\n\n\nconst LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nconst LITERALS = 256;\n/* number of literal bytes 0..255 */\nconst L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nconst D_CODES = 30;\n/* number of distance codes */\nconst BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nconst HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nconst MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nconst MIN_MATCH = 3;\nconst MAX_MATCH = 258;\nconst MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nconst PRESET_DICT = 0x20;\n\nconst INIT_STATE = 42; /* zlib header -> BUSY_STATE */\n//#ifdef GZIP\nconst GZIP_STATE = 57; /* gzip header -> BUSY_STATE | EXTRA_STATE */\n//#endif\nconst EXTRA_STATE = 69; /* gzip extra block -> NAME_STATE */\nconst NAME_STATE = 73; /* gzip file name -> COMMENT_STATE */\nconst COMMENT_STATE = 91; /* gzip comment -> HCRC_STATE */\nconst HCRC_STATE = 103; /* gzip header CRC -> BUSY_STATE */\nconst BUSY_STATE = 113; /* deflate -> FINISH_STATE */\nconst FINISH_STATE = 666; /* stream complete */\n\nconst BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nconst BS_BLOCK_DONE = 2; /* block flush performed */\nconst BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nconst BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nconst OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nconst err = (strm, errorCode) => {\n strm.msg = messages[errorCode];\n return errorCode;\n};\n\nconst rank = (f) => {\n return ((f) * 2) - ((f) > 4 ? 9 : 0);\n};\n\nconst zero = (buf) => {\n let len = buf.length; while (--len >= 0) { buf[len] = 0; }\n};\n\n/* ===========================================================================\n * Slide the hash table when sliding the window down (could be avoided with 32\n * bit values at the expense of memory usage). We slide even when level == 0 to\n * keep the hash table consistent if we switch back to level > 0 later.\n */\nconst slide_hash = (s) => {\n let n, m;\n let p;\n let wsize = s.w_size;\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= wsize ? m - wsize : 0);\n } while (--n);\n n = wsize;\n//#ifndef FASTEST\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= wsize ? m - wsize : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n//#endif\n};\n\n/* eslint-disable new-cap */\nlet HASH_ZLIB = (s, prev, data) => ((prev << s.hash_shift) ^ data) & s.hash_mask;\n// This hash causes less collisions, https://github.com/nodeca/pako/issues/135\n// But breaks binary compatibility\n//let HASH_FAST = (s, prev, data) => ((prev << 8) + (prev >> 8) + (data << 4)) & s.hash_mask;\nlet HASH = HASH_ZLIB;\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output, except for\n * some deflate_stored() output, goes through this function so some\n * applications may wish to modify it to avoid allocating a large\n * strm->next_out buffer and copying into it. (See also read_buf()).\n */\nconst flush_pending = (strm) => {\n const s = strm.state;\n\n //_tr_flush_bits(s);\n let len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n};\n\n\nconst flush_block_only = (s, last) => {\n _tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n};\n\n\nconst put_byte = (s, b) => {\n s.pending_buf[s.pending++] = b;\n};\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nconst putShortMSB = (s, b) => {\n\n // put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n};\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nconst read_buf = (strm, buf, start, size) => {\n\n let len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32_1(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32_1(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n};\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nconst longest_match = (s, cur_match) => {\n\n let chain_length = s.max_chain_length; /* max hash chain length */\n let scan = s.strstart; /* current string */\n let match; /* matched string */\n let len; /* length of current match */\n let best_len = s.prev_length; /* best match length so far */\n let nice_match = s.nice_match; /* stop if match long enough */\n const limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n const _win = s.window; // shortcut\n\n const wmask = s.w_mask;\n const prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n const strend = s.strstart + MAX_MATCH;\n let scan_end1 = _win[scan + best_len - 1];\n let scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n};\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nconst fill_window = (s) => {\n\n const _w_size = s.w_size;\n let n, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n s.window.set(s.window.subarray(_w_size, _w_size + _w_size - more), 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n if (s.insert > s.strstart) {\n s.insert = s.strstart;\n }\n slide_hash(s);\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + 1]);\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// const curr = s.strstart + s.lookahead;\n// let init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n};\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n *\n * In case deflateParams() is used to later switch to a non-zero compression\n * level, s->matches (otherwise unused when storing) keeps track of the number\n * of hash table slides to perform. If s->matches is 1, then one hash table\n * slide will be done when switching. If s->matches is 2, the maximum value\n * allowed here, then the hash table will be cleared, since two or more slides\n * is the same as a clear.\n *\n * deflate_stored() is written to minimize the number of times an input byte is\n * copied. It is most efficient with large input and output buffers, which\n * maximizes the opportunites to have a single copy from next_in to next_out.\n */\nconst deflate_stored = (s, flush) => {\n\n /* Smallest worthy block size when not flushing or finishing. By default\n * this is 32K. This can be as small as 507 bytes for memLevel == 1. For\n * large input and output buffers, the stored block size will be larger.\n */\n let min_block = s.pending_buf_size - 5 > s.w_size ? s.w_size : s.pending_buf_size - 5;\n\n /* Copy as many min_block or larger stored blocks directly to next_out as\n * possible. If flushing, copy the remaining available input to next_out as\n * stored blocks, if there is enough space.\n */\n let len, left, have, last = 0;\n let used = s.strm.avail_in;\n do {\n /* Set len to the maximum size block that we can copy directly with the\n * available input data and output space. Set left to how much of that\n * would be copied from what's left in the window.\n */\n len = 65535/* MAX_STORED */; /* maximum deflate stored block length */\n have = (s.bi_valid + 42) >> 3; /* number of header bytes */\n if (s.strm.avail_out < have) { /* need room for header */\n break;\n }\n /* maximum stored block length that will fit in avail_out: */\n have = s.strm.avail_out - have;\n left = s.strstart - s.block_start; /* bytes left in window */\n if (len > left + s.strm.avail_in) {\n len = left + s.strm.avail_in; /* limit len to the input */\n }\n if (len > have) {\n len = have; /* limit len to the output */\n }\n\n /* If the stored block would be less than min_block in length, or if\n * unable to copy all of the available input when flushing, then try\n * copying to the window and the pending buffer instead. Also don't\n * write an empty block when flushing -- deflate() does that.\n */\n if (len < min_block && ((len === 0 && flush !== Z_FINISH$3) ||\n flush === Z_NO_FLUSH$2 ||\n len !== left + s.strm.avail_in)) {\n break;\n }\n\n /* Make a dummy stored block in pending to get the header bytes,\n * including any pending bits. This also updates the debugging counts.\n */\n last = flush === Z_FINISH$3 && len === left + s.strm.avail_in ? 1 : 0;\n _tr_stored_block(s, 0, 0, last);\n\n /* Replace the lengths in the dummy stored block with len. */\n s.pending_buf[s.pending - 4] = len;\n s.pending_buf[s.pending - 3] = len >> 8;\n s.pending_buf[s.pending - 2] = ~len;\n s.pending_buf[s.pending - 1] = ~len >> 8;\n\n /* Write the stored block header bytes. */\n flush_pending(s.strm);\n\n//#ifdef ZLIB_DEBUG\n// /* Update debugging counts for the data about to be copied. */\n// s->compressed_len += len << 3;\n// s->bits_sent += len << 3;\n//#endif\n\n /* Copy uncompressed bytes from the window to next_out. */\n if (left) {\n if (left > len) {\n left = len;\n }\n //zmemcpy(s->strm->next_out, s->window + s->block_start, left);\n s.strm.output.set(s.window.subarray(s.block_start, s.block_start + left), s.strm.next_out);\n s.strm.next_out += left;\n s.strm.avail_out -= left;\n s.strm.total_out += left;\n s.block_start += left;\n len -= left;\n }\n\n /* Copy uncompressed bytes directly from next_in to next_out, updating\n * the check value.\n */\n if (len) {\n read_buf(s.strm, s.strm.output, s.strm.next_out, len);\n s.strm.next_out += len;\n s.strm.avail_out -= len;\n s.strm.total_out += len;\n }\n } while (last === 0);\n\n /* Update the sliding window with the last s->w_size bytes of the copied\n * data, or append all of the copied data to the existing window if less\n * than s->w_size bytes were copied. Also update the number of bytes to\n * insert in the hash tables, in the event that deflateParams() switches to\n * a non-zero compression level.\n */\n used -= s.strm.avail_in; /* number of input bytes directly copied */\n if (used) {\n /* If any input was used, then no unused input remains in the window,\n * therefore s->block_start == s->strstart.\n */\n if (used >= s.w_size) { /* supplant the previous history */\n s.matches = 2; /* clear hash */\n //zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size);\n s.window.set(s.strm.input.subarray(s.strm.next_in - s.w_size, s.strm.next_in), 0);\n s.strstart = s.w_size;\n s.insert = s.strstart;\n }\n else {\n if (s.window_size - s.strstart <= used) {\n /* Slide the window down. */\n s.strstart -= s.w_size;\n //zmemcpy(s->window, s->window + s->w_size, s->strstart);\n s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0);\n if (s.matches < 2) {\n s.matches++; /* add a pending slide_hash() */\n }\n if (s.insert > s.strstart) {\n s.insert = s.strstart;\n }\n }\n //zmemcpy(s->window + s->strstart, s->strm->next_in - used, used);\n s.window.set(s.strm.input.subarray(s.strm.next_in - used, s.strm.next_in), s.strstart);\n s.strstart += used;\n s.insert += used > s.w_size - s.insert ? s.w_size - s.insert : used;\n }\n s.block_start = s.strstart;\n }\n if (s.high_water < s.strstart) {\n s.high_water = s.strstart;\n }\n\n /* If the last block was written to next_out, then done. */\n if (last) {\n return BS_FINISH_DONE;\n }\n\n /* If flushing and all input has been consumed, then done. */\n if (flush !== Z_NO_FLUSH$2 && flush !== Z_FINISH$3 &&\n s.strm.avail_in === 0 && s.strstart === s.block_start) {\n return BS_BLOCK_DONE;\n }\n\n /* Fill the window with any remaining input. */\n have = s.window_size - s.strstart;\n if (s.strm.avail_in > have && s.block_start >= s.w_size) {\n /* Slide the window down. */\n s.block_start -= s.w_size;\n s.strstart -= s.w_size;\n //zmemcpy(s->window, s->window + s->w_size, s->strstart);\n s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0);\n if (s.matches < 2) {\n s.matches++; /* add a pending slide_hash() */\n }\n have += s.w_size; /* more space now */\n if (s.insert > s.strstart) {\n s.insert = s.strstart;\n }\n }\n if (have > s.strm.avail_in) {\n have = s.strm.avail_in;\n }\n if (have) {\n read_buf(s.strm, s.window, s.strstart, have);\n s.strstart += have;\n s.insert += have > s.w_size - s.insert ? s.w_size - s.insert : have;\n }\n if (s.high_water < s.strstart) {\n s.high_water = s.strstart;\n }\n\n /* There was not enough avail_out to write a complete worthy or flushed\n * stored block to next_out. Write a stored block to pending instead, if we\n * have enough input for a worthy block, or if flushing and there is enough\n * room for the remaining input as a stored block in the pending buffer.\n */\n have = (s.bi_valid + 42) >> 3; /* number of header bytes */\n /* maximum stored block length that will fit in pending: */\n have = s.pending_buf_size - have > 65535/* MAX_STORED */ ? 65535/* MAX_STORED */ : s.pending_buf_size - have;\n min_block = have > s.w_size ? s.w_size : have;\n left = s.strstart - s.block_start;\n if (left >= min_block ||\n ((left || flush === Z_FINISH$3) && flush !== Z_NO_FLUSH$2 &&\n s.strm.avail_in === 0 && left <= have)) {\n len = left > have ? have : left;\n last = flush === Z_FINISH$3 && s.strm.avail_in === 0 &&\n len === left ? 1 : 0;\n _tr_stored_block(s, s.block_start, len, last);\n s.block_start += len;\n flush_pending(s.strm);\n }\n\n /* We've done all we can with the available input and output. */\n return last ? BS_FINISH_STARTED : BS_NEED_MORE;\n};\n\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nconst deflate_fast = (s, flush) => {\n\n let hash_head; /* head of the hash chain */\n let bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = _tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]);\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.sym_next) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nconst deflate_slow = (s, flush) => {\n\n let hash_head; /* head of hash chain */\n let bflush; /* set if current block must be flushed */\n\n let max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = _tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.sym_next) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n};\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nconst deflate_rle = (s, flush) => {\n\n let bflush; /* set if current block must be flushed */\n let prev; /* byte at distance one to match */\n let scan, strend; /* scan goes up to strend for length of run */\n\n const _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = _tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.sym_next) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nconst deflate_huff = (s, flush) => {\n\n let bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.sym_next) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nconst configuration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nconst lm_init = (s) => {\n\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n};\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED$2; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new Uint16Array(HEAP_SIZE * 2);\n this.dyn_dtree = new Uint16Array((2 * D_CODES + 1) * 2);\n this.bl_tree = new Uint16Array((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new Uint16Array(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new Uint16Array(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new Uint16Array(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.sym_buf = 0; /* buffer for distances and literals/lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.sym_next = 0; /* running index in sym_buf */\n this.sym_end = 0; /* symbol table full when sym_next reaches this */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\n/* =========================================================================\n * Check for a valid deflate stream state. Return 0 if ok, 1 if not.\n */\nconst deflateStateCheck = (strm) => {\n\n if (!strm) {\n return 1;\n }\n const s = strm.state;\n if (!s || s.strm !== strm || (s.status !== INIT_STATE &&\n//#ifdef GZIP\n s.status !== GZIP_STATE &&\n//#endif\n s.status !== EXTRA_STATE &&\n s.status !== NAME_STATE &&\n s.status !== COMMENT_STATE &&\n s.status !== HCRC_STATE &&\n s.status !== BUSY_STATE &&\n s.status !== FINISH_STATE)) {\n return 1;\n }\n return 0;\n};\n\n\nconst deflateResetKeep = (strm) => {\n\n if (deflateStateCheck(strm)) {\n return err(strm, Z_STREAM_ERROR$2);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n const s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status =\n//#ifdef GZIP\n s.wrap === 2 ? GZIP_STATE :\n//#endif\n s.wrap ? INIT_STATE : BUSY_STATE;\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = -2;\n _tr_init(s);\n return Z_OK$3;\n};\n\n\nconst deflateReset = (strm) => {\n\n const ret = deflateResetKeep(strm);\n if (ret === Z_OK$3) {\n lm_init(strm.state);\n }\n return ret;\n};\n\n\nconst deflateSetHeader = (strm, head) => {\n\n if (deflateStateCheck(strm) || strm.state.wrap !== 2) {\n return Z_STREAM_ERROR$2;\n }\n strm.state.gzhead = head;\n return Z_OK$3;\n};\n\n\nconst deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => {\n\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR$2;\n }\n let wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION$1) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED$2 ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED || (windowBits === 8 && wrap !== 1)) {\n return err(strm, Z_STREAM_ERROR$2);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n const s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n s.status = INIT_STATE; /* to pass state test in deflateReset() */\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new Uint8Array(s.w_size * 2);\n s.head = new Uint16Array(s.hash_size);\n s.prev = new Uint16Array(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n /* We overlay pending_buf and sym_buf. This works since the average size\n * for length/distance pairs over any compressed block is assured to be 31\n * bits or less.\n *\n * Analysis: The longest fixed codes are a length code of 8 bits plus 5\n * extra bits, for lengths 131 to 257. The longest fixed distance codes are\n * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest\n * possible fixed-codes length/distance pair is then 31 bits total.\n *\n * sym_buf starts one-fourth of the way into pending_buf. So there are\n * three bytes in sym_buf for every four bytes in pending_buf. Each symbol\n * in sym_buf is three bytes -- two for the distance and one for the\n * literal/length. As each symbol is consumed, the pointer to the next\n * sym_buf value to read moves forward three bytes. From that symbol, up to\n * 31 bits are written to pending_buf. The closest the written pending_buf\n * bits gets to the next sym_buf symbol to read is just before the last\n * code is written. At that time, 31*(n-2) bits have been written, just\n * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at\n * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1\n * symbols are written.) The closest the writing gets to what is unread is\n * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and\n * can range from 128 to 32768.\n *\n * Therefore, at a minimum, there are 142 bits of space between what is\n * written and what is read in the overlain buffers, so the symbols cannot\n * be overwritten by the compressed data. That space is actually 139 bits,\n * due to the three-bit fixed-code block header.\n *\n * That covers the case where either Z_FIXED is specified, forcing fixed\n * codes, or when the use of fixed codes is chosen, because that choice\n * results in a smaller compressed block than dynamic codes. That latter\n * condition then assures that the above analysis also covers all dynamic\n * blocks. A dynamic-code block will only be chosen to be emitted if it has\n * fewer bits than a fixed-code block would for the same set of symbols.\n * Therefore its average symbol length is assured to be less than 31. So\n * the compressed data for a dynamic block also cannot overwrite the\n * symbols from which it is being constructed.\n */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n s.pending_buf = new Uint8Array(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->sym_buf = s->pending_buf + s->lit_bufsize;\n s.sym_buf = s.lit_bufsize;\n\n //s->sym_end = (s->lit_bufsize - 1) * 3;\n s.sym_end = (s.lit_bufsize - 1) * 3;\n /* We avoid equality with lit_bufsize*3 because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n};\n\nconst deflateInit = (strm, level) => {\n\n return deflateInit2(strm, level, Z_DEFLATED$2, MAX_WBITS$1, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY$1);\n};\n\n\n/* ========================================================================= */\nconst deflate$2 = (strm, flush) => {\n\n if (deflateStateCheck(strm) || flush > Z_BLOCK$1 || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR$2) : Z_STREAM_ERROR$2;\n }\n\n const s = strm.state;\n\n if (!strm.output ||\n (strm.avail_in !== 0 && !strm.input) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH$3)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR$1 : Z_STREAM_ERROR$2);\n }\n\n const old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK$3;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH$3) {\n return err(strm, Z_BUF_ERROR$1);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR$1);\n }\n\n /* Write the header */\n if (s.status === INIT_STATE && s.wrap === 0) {\n s.status = BUSY_STATE;\n }\n if (s.status === INIT_STATE) {\n /* zlib header */\n let header = (Z_DEFLATED$2 + ((s.w_bits - 8) << 4)) << 8;\n let level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n\n /* Compression must start with an empty pending buffer */\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n }\n//#ifdef GZIP\n if (s.status === GZIP_STATE) {\n /* gzip header */\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n\n /* Compression must start with an empty pending buffer */\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n let beg = s.pending; /* start of bytes to update crc */\n let left = (s.gzhead.extra.length & 0xffff) - s.gzindex;\n while (s.pending + left > s.pending_buf_size) {\n let copy = s.pending_buf_size - s.pending;\n // zmemcpy(s.pending_buf + s.pending,\n // s.gzhead.extra + s.gzindex, copy);\n s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex + copy), s.pending);\n s.pending = s.pending_buf_size;\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n s.gzindex += copy;\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n beg = 0;\n left -= copy;\n }\n // JS specific: s.gzhead.extra may be TypedArray or Array for backward compatibility\n // TypedArray.slice and TypedArray.from don't exist in IE10-IE11\n let gzhead_extra = new Uint8Array(s.gzhead.extra);\n // zmemcpy(s->pending_buf + s->pending,\n // s->gzhead->extra + s->gzindex, left);\n s.pending_buf.set(gzhead_extra.subarray(s.gzindex, s.gzindex + left), s.pending);\n s.pending += left;\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n s.gzindex = 0;\n }\n s.status = NAME_STATE;\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n let beg = s.pending; /* start of bytes to update crc */\n let val;\n do {\n if (s.pending === s.pending_buf_size) {\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n beg = 0;\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n s.gzindex = 0;\n }\n s.status = COMMENT_STATE;\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n let beg = s.pending; /* start of bytes to update crc */\n let val;\n do {\n if (s.pending === s.pending_buf_size) {\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n beg = 0;\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n }\n s.status = HCRC_STATE;\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n }\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n }\n s.status = BUSY_STATE;\n\n /* Compression must start with an empty pending buffer */\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n }\n//#endif\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH$2 && s.status !== FINISH_STATE)) {\n let bstate = s.level === 0 ? deflate_stored(s, flush) :\n s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :\n s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush);\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK$3;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n _tr_align(s);\n }\n else if (flush !== Z_BLOCK$1) { /* FULL_FLUSH or SYNC_FLUSH */\n\n _tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH$1) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK$3;\n }\n }\n }\n\n if (flush !== Z_FINISH$3) { return Z_OK$3; }\n if (s.wrap <= 0) { return Z_STREAM_END$3; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK$3 : Z_STREAM_END$3;\n};\n\n\nconst deflateEnd = (strm) => {\n\n if (deflateStateCheck(strm)) {\n return Z_STREAM_ERROR$2;\n }\n\n const status = strm.state.status;\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR$2) : Z_OK$3;\n};\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nconst deflateSetDictionary = (strm, dictionary) => {\n\n let dictLength = dictionary.length;\n\n if (deflateStateCheck(strm)) {\n return Z_STREAM_ERROR$2;\n }\n\n const s = strm.state;\n const wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR$2;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32_1(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n let tmpDict = new Uint8Array(s.w_size);\n tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n const avail = strm.avail_in;\n const next = strm.next_in;\n const input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n let str = s.strstart;\n let n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK$3;\n};\n\n\nvar deflateInit_1 = deflateInit;\nvar deflateInit2_1 = deflateInit2;\nvar deflateReset_1 = deflateReset;\nvar deflateResetKeep_1 = deflateResetKeep;\nvar deflateSetHeader_1 = deflateSetHeader;\nvar deflate_2$1 = deflate$2;\nvar deflateEnd_1 = deflateEnd;\nvar deflateSetDictionary_1 = deflateSetDictionary;\nvar deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nmodule.exports.deflateBound = deflateBound;\nmodule.exports.deflateCopy = deflateCopy;\nmodule.exports.deflateGetDictionary = deflateGetDictionary;\nmodule.exports.deflateParams = deflateParams;\nmodule.exports.deflatePending = deflatePending;\nmodule.exports.deflatePrime = deflatePrime;\nmodule.exports.deflateTune = deflateTune;\n*/\n\nvar deflate_1$2 = {\n\tdeflateInit: deflateInit_1,\n\tdeflateInit2: deflateInit2_1,\n\tdeflateReset: deflateReset_1,\n\tdeflateResetKeep: deflateResetKeep_1,\n\tdeflateSetHeader: deflateSetHeader_1,\n\tdeflate: deflate_2$1,\n\tdeflateEnd: deflateEnd_1,\n\tdeflateSetDictionary: deflateSetDictionary_1,\n\tdeflateInfo: deflateInfo\n};\n\nconst _has = (obj, key) => {\n return Object.prototype.hasOwnProperty.call(obj, key);\n};\n\nvar assign = function (obj /*from1, from2, from3, ...*/) {\n const sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n const source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (const p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// Join array of chunks to single array.\nvar flattenChunks = (chunks) => {\n // calculate data length\n let len = 0;\n\n for (let i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n const result = new Uint8Array(len);\n\n for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {\n let chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n};\n\nvar common = {\n\tassign: assign,\n\tflattenChunks: flattenChunks\n};\n\n// String encode/decode helpers\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nlet STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nconst _utf8len = new Uint8Array(256);\nfor (let q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nvar string2buf = (str) => {\n if (typeof TextEncoder === 'function' && TextEncoder.prototype.encode) {\n return new TextEncoder().encode(str);\n }\n\n let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new Uint8Array(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper\nconst buf2binstring = (buf, len) => {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if (buf.subarray && STR_APPLY_UIA_OK) {\n return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));\n }\n }\n\n let result = '';\n for (let i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n};\n\n\n// convert array to string\nvar buf2string = (buf, max) => {\n const len = max || buf.length;\n\n if (typeof TextDecoder === 'function' && TextDecoder.prototype.decode) {\n return new TextDecoder().decode(buf.subarray(0, max));\n }\n\n let i, out;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n const utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n let c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n let c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nvar utf8border = (buf, max) => {\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n let pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n\nvar strings = {\n\tstring2buf: string2buf,\n\tbuf2string: buf2string,\n\tutf8border: utf8border\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nvar zstream = ZStream;\n\nconst toString$1 = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH: Z_NO_FLUSH$1, Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH: Z_FINISH$2,\n Z_OK: Z_OK$2, Z_STREAM_END: Z_STREAM_END$2,\n Z_DEFAULT_COMPRESSION,\n Z_DEFAULT_STRATEGY,\n Z_DEFLATED: Z_DEFLATED$1\n} = constants$2;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * , chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate$1(options) {\n this.options = common.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED$1,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY\n }, options || {});\n\n let opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new zstream();\n this.strm.avail_out = 0;\n\n let status = deflate_1$2.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK$2) {\n throw new Error(messages[status]);\n }\n\n if (opt.header) {\n deflate_1$2.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n let dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString$1.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = deflate_1$2.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK$2) {\n throw new Error(messages[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must\n * have `flush_mode` Z_FINISH (or `true`). That will flush internal pending\n * buffers and call [[Deflate#onEnd]].\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate$1.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n let status, _flush_mode;\n\n if (this.ended) { return false; }\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH$2 : Z_NO_FLUSH$1;\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString$1.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n // Make sure avail_out > 6 to avoid repeating markers\n if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH) && strm.avail_out <= 6) {\n this.onData(strm.output.subarray(0, strm.next_out));\n strm.avail_out = 0;\n continue;\n }\n\n status = deflate_1$2.deflate(strm, _flush_mode);\n\n // Ended => flush and finish\n if (status === Z_STREAM_END$2) {\n if (strm.next_out > 0) {\n this.onData(strm.output.subarray(0, strm.next_out));\n }\n status = deflate_1$2.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK$2;\n }\n\n // Flush if out buffer full\n if (strm.avail_out === 0) {\n this.onData(strm.output);\n continue;\n }\n\n // Flush if requested and has data\n if (_flush_mode > 0 && strm.next_out > 0) {\n this.onData(strm.output.subarray(0, strm.next_out));\n strm.avail_out = 0;\n continue;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array): output data.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate$1.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate$1.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK$2) {\n this.result = common.flattenChunks(this.chunks);\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array\n * - data (Uint8Array|ArrayBuffer|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const data = new Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate$1(input, options) {\n const deflator = new Deflate$1(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || messages[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array\n * - data (Uint8Array|ArrayBuffer|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw$1(input, options) {\n options = options || {};\n options.raw = true;\n return deflate$1(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array\n * - data (Uint8Array|ArrayBuffer|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip$1(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate$1(input, options);\n}\n\n\nvar Deflate_1$1 = Deflate$1;\nvar deflate_2 = deflate$1;\nvar deflateRaw_1$1 = deflateRaw$1;\nvar gzip_1$1 = gzip$1;\nvar constants$1 = constants$2;\n\nvar deflate_1$1 = {\n\tDeflate: Deflate_1$1,\n\tdeflate: deflate_2,\n\tdeflateRaw: deflateRaw_1$1,\n\tgzip: gzip_1$1,\n\tconstants: constants$1\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nconst BAD$1 = 16209; /* got a data error -- remain here until reset */\nconst TYPE$1 = 16191; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nvar inffast = function inflate_fast(strm, start) {\n let _in; /* local strm.input */\n let last; /* have enough input while in < last */\n let _out; /* local strm.output */\n let beg; /* inflate()'s initial strm.output */\n let end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n let dmax; /* maximum distance from zlib header */\n//#endif\n let wsize; /* window size or zero if not using window */\n let whave; /* valid bytes in the window */\n let wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n let s_window; /* allocated sliding window, if wsize != 0 */\n let hold; /* local strm.hold */\n let bits; /* local strm.bits */\n let lcode; /* local strm.lencode */\n let dcode; /* local strm.distcode */\n let lmask; /* mask for first level of length codes */\n let dmask; /* mask for first level of distance codes */\n let here; /* retrieved table entry */\n let op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n let len; /* match length, unused bytes */\n let dist; /* match distance */\n let from; /* where to copy match from */\n let from_source;\n\n\n let input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n const state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE$1;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst MAXBITS = 15;\nconst ENOUGH_LENS$1 = 852;\nconst ENOUGH_DISTS$1 = 592;\n//const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nconst CODES$1 = 0;\nconst LENS$1 = 1;\nconst DISTS$1 = 2;\n\nconst lbase = new Uint16Array([ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n]);\n\nconst lext = new Uint8Array([ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n]);\n\nconst dbase = new Uint16Array([ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n]);\n\nconst dext = new Uint8Array([ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n]);\n\nconst inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) =>\n{\n const bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n let len = 0; /* a code's length in bits */\n let sym = 0; /* index of code symbols */\n let min = 0, max = 0; /* minimum and maximum code lengths */\n let root = 0; /* number of index bits for root table */\n let curr = 0; /* number of index bits for current table */\n let drop = 0; /* code bits to drop for sub-table */\n let left = 0; /* number of prefix codes available */\n let used = 0; /* code entries in table used */\n let huff = 0; /* Huffman code */\n let incr; /* for incrementing code, index */\n let fill; /* index for replicating entries */\n let low; /* low bits for current root entry */\n let mask; /* mask for low root bits */\n let next; /* next available space in table */\n let base = null; /* base value table to use */\n// let shoextra; /* extra bits table to use */\n let match; /* use base and extra for symbol >= match */\n const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n let extra = null;\n\n let here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES$1 || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES$1) {\n base = extra = work; /* dummy value--not used */\n match = 20;\n\n } else if (type === LENS$1) {\n base = lbase;\n extra = lext;\n match = 257;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n match = 0;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] + 1 < match) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] >= match) {\n here_op = extra[work[sym] - match];\n here_val = base[work[sym] - match];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n\n\nvar inftrees = inflate_table;\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n\n\n\n\n\nconst CODES = 0;\nconst LENS = 1;\nconst DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_FINISH: Z_FINISH$1, Z_BLOCK, Z_TREES,\n Z_OK: Z_OK$1, Z_STREAM_END: Z_STREAM_END$1, Z_NEED_DICT: Z_NEED_DICT$1, Z_STREAM_ERROR: Z_STREAM_ERROR$1, Z_DATA_ERROR: Z_DATA_ERROR$1, Z_MEM_ERROR: Z_MEM_ERROR$1, Z_BUF_ERROR,\n Z_DEFLATED\n} = constants$2;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nconst HEAD = 16180; /* i: waiting for magic header */\nconst FLAGS = 16181; /* i: waiting for method and flags (gzip) */\nconst TIME = 16182; /* i: waiting for modification time (gzip) */\nconst OS = 16183; /* i: waiting for extra flags and operating system (gzip) */\nconst EXLEN = 16184; /* i: waiting for extra length (gzip) */\nconst EXTRA = 16185; /* i: waiting for extra bytes (gzip) */\nconst NAME = 16186; /* i: waiting for end of file name (gzip) */\nconst COMMENT = 16187; /* i: waiting for end of comment (gzip) */\nconst HCRC = 16188; /* i: waiting for header crc (gzip) */\nconst DICTID = 16189; /* i: waiting for dictionary check value */\nconst DICT = 16190; /* waiting for inflateSetDictionary() call */\nconst TYPE = 16191; /* i: waiting for type bits, including last-flag bit */\nconst TYPEDO = 16192; /* i: same, but skip check to exit inflate on new block */\nconst STORED = 16193; /* i: waiting for stored size (length and complement) */\nconst COPY_ = 16194; /* i/o: same as COPY below, but only first time in */\nconst COPY = 16195; /* i/o: waiting for input or output to copy stored block */\nconst TABLE = 16196; /* i: waiting for dynamic block table lengths */\nconst LENLENS = 16197; /* i: waiting for code length code lengths */\nconst CODELENS = 16198; /* i: waiting for length/lit and distance code lengths */\nconst LEN_ = 16199; /* i: same as LEN below, but only first time in */\nconst LEN = 16200; /* i: waiting for length/lit/eob code */\nconst LENEXT = 16201; /* i: waiting for length extra bits */\nconst DIST = 16202; /* i: waiting for distance code */\nconst DISTEXT = 16203; /* i: waiting for distance extra bits */\nconst MATCH = 16204; /* o: waiting for output space to copy string */\nconst LIT = 16205; /* o: waiting for output space to write literal */\nconst CHECK = 16206; /* i: waiting for 32-bit check value */\nconst LENGTH = 16207; /* i: waiting for 32-bit length (gzip) */\nconst DONE = 16208; /* finished check, done -- remain here until reset */\nconst BAD = 16209; /* got a data error -- remain here until reset */\nconst MEM = 16210; /* got an inflate() memory error -- remain here until reset */\nconst SYNC = 16211; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nconst ENOUGH_LENS = 852;\nconst ENOUGH_DISTS = 592;\n//const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nconst MAX_WBITS = 15;\n/* 32K LZ77 window */\nconst DEF_WBITS = MAX_WBITS;\n\n\nconst zswap32 = (q) => {\n\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n};\n\n\nfunction InflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip,\n bit 2 true to validate check value */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib), or\n -1 if raw or no header yet */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new Uint16Array(320); /* temporary storage for code lengths */\n this.work = new Uint16Array(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new Int32Array(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\n\nconst inflateStateCheck = (strm) => {\n\n if (!strm) {\n return 1;\n }\n const state = strm.state;\n if (!state || state.strm !== strm ||\n state.mode < HEAD || state.mode > SYNC) {\n return 1;\n }\n return 0;\n};\n\n\nconst inflateResetKeep = (strm) => {\n\n if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.flags = -1;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS);\n state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK$1;\n};\n\n\nconst inflateReset = (strm) => {\n\n if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n};\n\n\nconst inflateReset2 = (strm, windowBits) => {\n let wrap;\n\n /* get the state */\n if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 5;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR$1;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n};\n\n\nconst inflateInit2 = (strm, windowBits) => {\n\n if (!strm) { return Z_STREAM_ERROR$1; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n const state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.strm = strm;\n state.window = null/*Z_NULL*/;\n state.mode = HEAD; /* to pass state test in inflateReset2() */\n const ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK$1) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n};\n\n\nconst inflateInit = (strm) => {\n\n return inflateInit2(strm, DEF_WBITS);\n};\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nlet virgin = true;\n\nlet lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\n\nconst fixedtables = (state) => {\n\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n lenfix = new Int32Array(512);\n distfix = new Int32Array(32);\n\n /* literal/length table */\n let sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inftrees(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inftrees(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n};\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nconst updatewindow = (strm, src, end, copy) => {\n\n let dist;\n const state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new Uint8Array(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n state.window.set(src.subarray(end - state.wsize, end), 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n state.window.set(src.subarray(end - copy, end), 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n};\n\n\nconst inflate$2 = (strm, flush) => {\n\n let state;\n let input, output; // input/output buffers\n let next; /* next input INDEX */\n let put; /* next output INDEX */\n let have, left; /* available input and output */\n let hold; /* bit buffer */\n let bits; /* bits in bit buffer */\n let _in, _out; /* save starting available input and output */\n let copy; /* number of stored or match bytes to copy */\n let from; /* where to copy match bytes from */\n let from_source;\n let here = 0; /* current decoding table entry */\n let here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //let last; /* parent table entry */\n let last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n let len; /* length to copy for repeats, bits to drop */\n let ret; /* return code */\n const hbuf = new Uint8Array(4); /* buffer for gzip header crc calculation */\n let opts;\n\n let n; // temporary variable for NEED_BITS\n\n const order = /* permutation of code lengths */\n new Uint8Array([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]);\n\n\n if (inflateStateCheck(strm) || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR$1;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK$1;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n if (state.wbits === 0) {\n state.wbits = 15;\n }\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n if (len > 15 || len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n\n // !!! pako patch. Force use `options.windowBits` if passed.\n // Required to always use max window size by default.\n state.dmax = 1 << state.wbits;\n //state.dmax = 1 << len;\n\n state.flags = 0; /* indicate zlib header */\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32_1(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Uint8Array(state.head.extra_len);\n }\n state.head.extra.set(\n input.subarray(\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n next + copy\n ),\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 4) && hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT$1;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n output.set(input.subarray(next, next + copy), put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inftrees(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inftrees(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inftrees(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inffast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if ((state.wrap & 4) && _out) {\n strm.adler = state.check =\n /*UPDATE_CHECK(state.check, put - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.wrap & 4) && (state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 4) && hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END$1;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR$1;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR$1;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR$1;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH$1))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) ;\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if ((state.wrap & 4) && _out) {\n strm.adler = state.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH$1) && ret === Z_OK$1) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n};\n\n\nconst inflateEnd = (strm) => {\n\n if (inflateStateCheck(strm)) {\n return Z_STREAM_ERROR$1;\n }\n\n let state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK$1;\n};\n\n\nconst inflateGetHeader = (strm, head) => {\n\n /* check state */\n if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR$1; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK$1;\n};\n\n\nconst inflateSetDictionary = (strm, dictionary) => {\n const dictLength = dictionary.length;\n\n let state;\n let dictid;\n let ret;\n\n /* check state */\n if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR$1;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32_1(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR$1;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR$1;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK$1;\n};\n\n\nvar inflateReset_1 = inflateReset;\nvar inflateReset2_1 = inflateReset2;\nvar inflateResetKeep_1 = inflateResetKeep;\nvar inflateInit_1 = inflateInit;\nvar inflateInit2_1 = inflateInit2;\nvar inflate_2$1 = inflate$2;\nvar inflateEnd_1 = inflateEnd;\nvar inflateGetHeader_1 = inflateGetHeader;\nvar inflateSetDictionary_1 = inflateSetDictionary;\nvar inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nmodule.exports.inflateCodesUsed = inflateCodesUsed;\nmodule.exports.inflateCopy = inflateCopy;\nmodule.exports.inflateGetDictionary = inflateGetDictionary;\nmodule.exports.inflateMark = inflateMark;\nmodule.exports.inflatePrime = inflatePrime;\nmodule.exports.inflateSync = inflateSync;\nmodule.exports.inflateSyncPoint = inflateSyncPoint;\nmodule.exports.inflateUndermine = inflateUndermine;\nmodule.exports.inflateValidate = inflateValidate;\n*/\n\nvar inflate_1$2 = {\n\tinflateReset: inflateReset_1,\n\tinflateReset2: inflateReset2_1,\n\tinflateResetKeep: inflateResetKeep_1,\n\tinflateInit: inflateInit_1,\n\tinflateInit2: inflateInit2_1,\n\tinflate: inflate_2$1,\n\tinflateEnd: inflateEnd_1,\n\tinflateGetHeader: inflateGetHeader_1,\n\tinflateSetDictionary: inflateSetDictionary_1,\n\tinflateInfo: inflateInfo\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nvar gzheader = GZheader;\n\nconst toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH, Z_FINISH,\n Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR\n} = constants$2;\n\n/* ===========================================================================*/\n\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * const chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate$1(options) {\n this.options = common.assign({\n chunkSize: 1024 * 64,\n windowBits: 15,\n to: ''\n }, options || {});\n\n const opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new zstream();\n this.strm.avail_out = 0;\n\n let status = inflate_1$2.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n\n this.header = new gzheader();\n\n inflate_1$2.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = inflate_1$2.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer): input data\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE\n * flush modes. See constants. Skipped or `false` means Z_NO_FLUSH,\n * `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. If end of stream detected,\n * [[Inflate#onEnd]] will be called.\n *\n * `flush_mode` is not needed for normal operation, because end of stream\n * detected automatically. You may try to use it for advanced things, but\n * this functionality was not tested.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate$1.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n const dictionary = this.options.dictionary;\n let status, _flush_mode, last_avail_out;\n\n if (this.ended) return false;\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;\n\n // Convert data if needed\n if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = inflate_1$2.inflate(strm, _flush_mode);\n\n if (status === Z_NEED_DICT && dictionary) {\n status = inflate_1$2.inflateSetDictionary(strm, dictionary);\n\n if (status === Z_OK) {\n status = inflate_1$2.inflate(strm, _flush_mode);\n } else if (status === Z_DATA_ERROR) {\n // Replace code with more verbose\n status = Z_NEED_DICT;\n }\n }\n\n // Skip snyc markers if more data follows and not raw mode\n while (strm.avail_in > 0 &&\n status === Z_STREAM_END &&\n strm.state.wrap > 0 &&\n data[strm.next_in] !== 0)\n {\n inflate_1$2.inflateReset(strm);\n status = inflate_1$2.inflate(strm, _flush_mode);\n }\n\n switch (status) {\n case Z_STREAM_ERROR:\n case Z_DATA_ERROR:\n case Z_NEED_DICT:\n case Z_MEM_ERROR:\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n // Remember real `avail_out` value, because we may patch out buffer content\n // to align utf8 strings boundaries.\n last_avail_out = strm.avail_out;\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === Z_STREAM_END) {\n\n if (this.options.to === 'string') {\n\n let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n let tail = strm.next_out - next_out_utf8;\n let utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail & realign counters\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);\n\n this.onData(utf8str);\n\n } else {\n this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));\n }\n }\n }\n\n // Must repeat iteration if out buffer is full\n if (status === Z_OK && last_avail_out === 0) continue;\n\n // Finalize if end of stream reached.\n if (status === Z_STREAM_END) {\n status = inflate_1$2.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return true;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|String): output data. When string output requested,\n * each chunk will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate$1.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate$1.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = common.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|String\n * - data (Uint8Array|ArrayBuffer): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako');\n * const input = pako.deflate(new Uint8Array([1,2,3,4,5,6,7,8,9]));\n * let output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err) {\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate$1(input, options) {\n const inflator = new Inflate$1(options);\n\n inflator.push(input);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) throw inflator.msg || messages[inflator.err];\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|String\n * - data (Uint8Array|ArrayBuffer): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw$1(input, options) {\n options = options || {};\n options.raw = true;\n return inflate$1(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|String\n * - data (Uint8Array|ArrayBuffer): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nvar Inflate_1$1 = Inflate$1;\nvar inflate_2 = inflate$1;\nvar inflateRaw_1$1 = inflateRaw$1;\nvar ungzip$1 = inflate$1;\nvar constants = constants$2;\n\nvar inflate_1$1 = {\n\tInflate: Inflate_1$1,\n\tinflate: inflate_2,\n\tinflateRaw: inflateRaw_1$1,\n\tungzip: ungzip$1,\n\tconstants: constants\n};\n\nconst { Deflate, deflate, deflateRaw, gzip } = deflate_1$1;\n\nconst { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1;\n\n\n\nvar Deflate_1 = Deflate;\nvar deflate_1 = deflate;\nvar deflateRaw_1 = deflateRaw;\nvar gzip_1 = gzip;\nvar Inflate_1 = Inflate;\nvar inflate_1 = inflate;\nvar inflateRaw_1 = inflateRaw;\nvar ungzip_1 = ungzip;\nvar constants_1 = constants$2;\n\nvar pako = {\n\tDeflate: Deflate_1,\n\tdeflate: deflate_1,\n\tdeflateRaw: deflateRaw_1,\n\tgzip: gzip_1,\n\tInflate: Inflate_1,\n\tinflate: inflate_1,\n\tinflateRaw: inflateRaw_1,\n\tungzip: ungzip_1,\n\tconstants: constants_1\n};\n\nexport { Deflate_1 as Deflate, Inflate_1 as Inflate, constants_1 as constants, pako as default, deflate_1 as deflate, deflateRaw_1 as deflateRaw, gzip_1 as gzip, inflate_1 as inflate, inflateRaw_1 as inflateRaw, ungzip_1 as ungzip };\n","import { inflateRaw } from 'pako';\nexport function unzip(input) {\n return inflateRaw(input.subarray(2));\n}\n//# sourceMappingURL=unzip-pako.js.map","/* eslint no-bitwise: [\"error\", { \"allow\": [\"|\"] }] */\nexport class AbortError extends Error {\n constructor(message) {\n super(message);\n this.code = 'ERR_ABORTED';\n }\n}\n// sort blocks by file offset and\n// group blocks that are within 2KB of eachother\nexport function groupBlocks(blocks) {\n blocks.sort((b0, b1) => Number(b0.offset) - Number(b1.offset));\n const blockGroups = [];\n let lastBlock;\n let lastBlockEnd;\n for (let i = 0; i < blocks.length; i += 1) {\n if (lastBlock &&\n lastBlockEnd &&\n Number(blocks[i].offset) - lastBlockEnd <= 2000) {\n lastBlock.length = BigInt(Number(lastBlock.length) +\n Number(blocks[i].length) -\n lastBlockEnd +\n Number(blocks[i].offset));\n lastBlock.blocks.push(blocks[i]);\n }\n else {\n blockGroups.push((lastBlock = {\n blocks: [blocks[i]],\n length: blocks[i].length,\n offset: blocks[i].offset,\n }));\n }\n lastBlockEnd = Number(lastBlock.offset) + Number(lastBlock.length);\n }\n return blockGroups;\n}\n/**\n * Properly check if the given AbortSignal is aborted.\n * Per the standard, if the signal reads as aborted,\n * this function throws either a DOMException AbortError, or a regular error\n * with a `code` attribute set to `ERR_ABORTED`.\n *\n * For convenience, passing `undefined` is a no-op\n *\n * @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute\n * @returns nothing\n */\nexport function checkAbortSignal(signal) {\n if (!signal) {\n return;\n }\n if (signal.aborted) {\n // console.log('bam aborted!')\n if (typeof DOMException !== 'undefined') {\n throw new DOMException('aborted', 'AbortError');\n }\n else {\n const e = new AbortError('aborted');\n e.code = 'ERR_ABORTED';\n throw e;\n }\n }\n}\n/**\n * Skips to the next tick, then runs `checkAbortSignal`.\n * Await this to inside an otherwise synchronous loop to\n * provide a place to break when an abort signal is received.\n * @param {AbortSignal} signal\n */\nexport async function abortBreakPoint(signal) {\n await Promise.resolve();\n checkAbortSignal(signal);\n}\n//# sourceMappingURL=util.js.map","import { Buffer } from 'buffer';\nimport { Parser } from 'binary-parser';\nimport AbortablePromiseCache from 'abortable-promise-cache';\nimport QuickLRU from 'quick-lru';\n// locals\nimport Range from './range';\nimport { unzip } from './unzip';\nimport { groupBlocks, checkAbortSignal } from './util';\nconst BIG_WIG_TYPE_GRAPH = 1;\nconst BIG_WIG_TYPE_VSTEP = 2;\nconst BIG_WIG_TYPE_FSTEP = 3;\nfunction coordFilter(s1, e1, s2, e2) {\n return s1 < e2 && e1 >= s2;\n}\nfunction getParsers(isBigEndian) {\n const le = isBigEndian ? 'big' : 'little';\n const summaryParser = new Parser()\n .endianess(le)\n .uint32('chromId')\n .uint32('start')\n .uint32('end')\n .uint32('validCnt')\n .floatle('minScore')\n .floatle('maxScore')\n .floatle('sumData')\n .floatle('sumSqData')\n .saveOffset('offset');\n const leafParser = new Parser()\n .endianess(le)\n .uint8('isLeaf')\n .skip(1)\n .uint16('cnt')\n .choice({\n tag: 'isLeaf',\n choices: {\n 1: new Parser().endianess(le).array('blocksToFetch', {\n length: 'cnt',\n type: new Parser()\n .endianess(le)\n .uint32('startChrom')\n .uint32('startBase')\n .uint32('endChrom')\n .uint32('endBase')\n .uint64('blockOffset')\n .uint64('blockSize')\n .saveOffset('offset'),\n }),\n 0: new Parser().array('recurOffsets', {\n length: 'cnt',\n type: new Parser()\n .endianess(le)\n .uint32('startChrom')\n .uint32('startBase')\n .uint32('endChrom')\n .uint32('endBase')\n .uint64('blockOffset')\n .saveOffset('offset'),\n }),\n },\n });\n const bigBedParser = new Parser()\n .endianess(le)\n .uint32('chromId')\n .int32('start')\n .int32('end')\n .string('rest', {\n zeroTerminated: true,\n })\n .saveOffset('offset');\n const bigWigParser = new Parser()\n .endianess(le)\n .skip(4)\n .int32('blockStart')\n .skip(4)\n .uint32('itemStep')\n .uint32('itemSpan')\n .uint8('blockType')\n .skip(1)\n .uint16('itemCount')\n .choice({\n tag: 'blockType',\n choices: {\n [BIG_WIG_TYPE_FSTEP]: new Parser().array('items', {\n length: 'itemCount',\n type: new Parser().floatle('score'),\n }),\n [BIG_WIG_TYPE_VSTEP]: new Parser().array('items', {\n length: 'itemCount',\n type: new Parser().endianess(le).int32('start').floatle('score'),\n }),\n [BIG_WIG_TYPE_GRAPH]: new Parser().array('items', {\n length: 'itemCount',\n type: new Parser()\n .endianess(le)\n .int32('start')\n .int32('end')\n .floatle('score'),\n }),\n },\n });\n return {\n bigWigParser,\n bigBedParser,\n summaryParser,\n leafParser,\n };\n}\n/**\n * View into a subset of the data in a BigWig file.\n *\n * Adapted by Robert Buels and Colin Diesh from bigwig.js in the Dalliance Genome\n * Explorer by Thomas Down.\n * @constructs\n */\nexport class BlockView {\n constructor(bbi, refsByName, cirTreeOffset, isBigEndian, isCompressed, blockType) {\n this.bbi = bbi;\n this.refsByName = refsByName;\n this.cirTreeOffset = cirTreeOffset;\n this.isBigEndian = isBigEndian;\n this.isCompressed = isCompressed;\n this.blockType = blockType;\n this.featureCache = new AbortablePromiseCache({\n cache: new QuickLRU({ maxSize: 1000 }),\n fill: async (requestData, signal) => {\n const len = Number(requestData.length);\n const off = Number(requestData.offset);\n const { buffer } = await this.bbi.read(Buffer.alloc(len), 0, len, off, {\n signal,\n });\n return buffer;\n },\n });\n if (!(cirTreeOffset >= 0)) {\n throw new Error('invalid cirTreeOffset!');\n }\n const parsers = getParsers(isBigEndian);\n this.leafParser = parsers.leafParser;\n this.bigBedParser = parsers.bigBedParser;\n }\n async readWigData(chrName, start, end, observer, opts) {\n try {\n const { refsByName, bbi, cirTreeOffset, isBigEndian } = this;\n const chrId = refsByName[chrName];\n if (chrId === undefined) {\n observer.complete();\n }\n const request = { chrId, start, end };\n if (!this.cirTreePromise) {\n this.cirTreePromise = bbi.read(Buffer.alloc(48), 0, 48, Number(cirTreeOffset), opts);\n }\n const { buffer } = await this.cirTreePromise;\n const cirBlockSize = isBigEndian\n ? buffer.readUInt32BE(4)\n : buffer.readUInt32LE(4);\n let blocksToFetch = [];\n let outstanding = 0;\n const cirFobRecur2 = (cirBlockData, offset, level) => {\n try {\n const data = cirBlockData.subarray(offset);\n const p = this.leafParser.parse(data);\n if (p.blocksToFetch) {\n blocksToFetch = blocksToFetch.concat(p.blocksToFetch\n .filter(filterFeats)\n .map((l) => ({\n offset: l.blockOffset,\n length: l.blockSize,\n })));\n }\n if (p.recurOffsets) {\n const recurOffsets = p.recurOffsets\n .filter(filterFeats)\n .map(l => Number(l.blockOffset));\n if (recurOffsets.length > 0) {\n cirFobRecur(recurOffsets, level + 1);\n }\n }\n }\n catch (e) {\n observer.error(e);\n }\n };\n const filterFeats = (b) => {\n const { startChrom, startBase, endChrom, endBase } = b;\n return ((startChrom < chrId || (startChrom === chrId && startBase <= end)) &&\n (endChrom > chrId || (endChrom === chrId && endBase >= start)));\n };\n const cirFobStartFetch = async (off, fr, level) => {\n try {\n const length = fr.max() - fr.min();\n const offset = fr.min();\n const resultBuffer = await this.featureCache.get(`${length}_${offset}`, { length, offset }, opts.signal);\n for (let i = 0; i < off.length; i += 1) {\n if (fr.contains(off[i])) {\n cirFobRecur2(resultBuffer, off[i] - offset, level);\n outstanding -= 1;\n if (outstanding === 0) {\n this.readFeatures(observer, blocksToFetch, { ...opts, request });\n }\n }\n }\n }\n catch (e) {\n observer.error(e);\n }\n };\n const cirFobRecur = (offset, level) => {\n try {\n outstanding += offset.length;\n const maxCirBlockSpan = 4 + Number(cirBlockSize) * 32; // Upper bound on size, based on a completely full leaf node.\n let spans = new Range(offset[0], offset[0] + maxCirBlockSpan);\n for (let i = 1; i < offset.length; i += 1) {\n const blockSpan = new Range(offset[i], offset[i] + maxCirBlockSpan);\n spans = spans.union(blockSpan);\n }\n spans.getRanges().map(fr => cirFobStartFetch(offset, fr, level));\n }\n catch (e) {\n observer.error(e);\n }\n };\n return cirFobRecur([Number(cirTreeOffset) + 48], 1);\n }\n catch (e) {\n observer.error(e);\n }\n }\n parseSummaryBlock(buffer, startOffset, request) {\n const features = [];\n let offset = startOffset;\n const dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);\n while (offset < buffer.byteLength) {\n // this was extracted from looking at the runtime code generated by\n // binary-parser\n const chromId = dataView.getUint32(offset, true);\n offset += 4;\n const start = dataView.getUint32(offset, true);\n offset += 4;\n const end = dataView.getUint32(offset, true);\n offset += 4;\n const validCnt = dataView.getUint32(offset, true);\n offset += 4;\n const minScore = dataView.getFloat32(offset, true);\n offset += 4;\n const maxScore = dataView.getFloat32(offset, true);\n offset += 4;\n const sumData = dataView.getFloat32(offset, true);\n offset += 4;\n // unused\n // const sumSqData = dataView.getFloat32(offset, true)\n offset += 4;\n if (request\n ? chromId === request.chrId &&\n coordFilter(start, end, request.start, request.end)\n : true) {\n features.push({\n start,\n end,\n maxScore,\n minScore,\n summary: true,\n score: sumData / (validCnt || 1),\n });\n }\n }\n return features;\n }\n parseBigBedBlock(data, startOffset, offset, request) {\n const items = [];\n let currOffset = startOffset;\n while (currOffset < data.byteLength) {\n const res = this.bigBedParser.parse(data.subarray(currOffset));\n items.push({ ...res, uniqueId: `bb-${offset + currOffset}` });\n currOffset += res.offset;\n }\n return request\n ? items.filter((f) => coordFilter(f.start, f.end, request.start, request.end))\n : items;\n }\n parseBigWigBlock(buffer, startOffset, request) {\n const b = buffer.subarray(startOffset);\n const dataView = new DataView(b.buffer, b.byteOffset, b.length);\n let offset = 0;\n offset += 4;\n const blockStart = dataView.getInt32(offset, true);\n offset += 8;\n const itemStep = dataView.getUint32(offset, true);\n offset += 4;\n const itemSpan = dataView.getUint32(offset, true);\n offset += 4;\n const blockType = dataView.getUint8(offset);\n offset += 2;\n const itemCount = dataView.getUint16(offset, true);\n offset += 2;\n const items = new Array(itemCount);\n switch (blockType) {\n case 1:\n for (let i = 0; i < itemCount; i++) {\n const start = dataView.getInt32(offset, true);\n offset += 4;\n const end = dataView.getInt32(offset, true);\n offset += 4;\n const score = dataView.getFloat32(offset, true);\n offset += 4;\n items[i] = { start, end, score };\n }\n break;\n case 2:\n for (let i = 0; i < itemCount; i++) {\n const start = dataView.getInt32(offset, true);\n offset += 4;\n const score = dataView.getFloat32(offset, true);\n offset += 4;\n items[i] = { score, start, end: start + itemSpan };\n }\n break;\n case 3:\n for (let i = 0; i < itemCount; i++) {\n const score = dataView.getFloat32(offset, true);\n offset += 4;\n const start = blockStart + i * itemStep;\n items[i] = { score, start, end: start + itemSpan };\n }\n break;\n }\n return request\n ? items.filter((f) => coordFilter(f.start, f.end, request.start, request.end))\n : items;\n }\n async readFeatures(observer, blocks, opts = {}) {\n try {\n const { blockType, isCompressed } = this;\n const { signal, request } = opts;\n const blockGroupsToFetch = groupBlocks(blocks);\n checkAbortSignal(signal);\n await Promise.all(blockGroupsToFetch.map(async (blockGroup) => {\n checkAbortSignal(signal);\n const { length, offset } = blockGroup;\n const data = await this.featureCache.get(`${length}_${offset}`, blockGroup, signal);\n blockGroup.blocks.forEach(block => {\n checkAbortSignal(signal);\n let blockOffset = Number(block.offset) - Number(blockGroup.offset);\n let resultData = data;\n if (isCompressed) {\n resultData = unzip(data.subarray(blockOffset));\n blockOffset = 0;\n }\n checkAbortSignal(signal);\n switch (blockType) {\n case 'summary':\n observer.next(this.parseSummaryBlock(resultData, blockOffset, request));\n break;\n case 'bigwig':\n observer.next(this.parseBigWigBlock(resultData, blockOffset, request));\n break;\n case 'bigbed':\n observer.next(this.parseBigBedBlock(resultData, blockOffset, Number(block.offset) * (1 << 8), request));\n break;\n default:\n console.warn(`Don't know what to do with ${blockType}`);\n }\n });\n }));\n observer.complete();\n }\n catch (e) {\n observer.error(e);\n }\n }\n}\n//# sourceMappingURL=blockView.js.map","/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n function next() {\n while (env.stack.length) {\n var rec = env.stack.pop();\n try {\n var result = rec.dispose && rec.dispose.call(rec.value);\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n catch (e) {\n fail(e);\n }\n }\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n};\n","export function isFunction(value) {\n return typeof value === 'function';\n}\n//# sourceMappingURL=isFunction.js.map","export function createErrorClass(createImpl) {\n var _super = function (instance) {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n var ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n//# sourceMappingURL=createErrorClass.js.map","import { createErrorClass } from './createErrorClass';\nexport var UnsubscriptionError = createErrorClass(function (_super) {\n return function UnsubscriptionErrorImpl(errors) {\n _super(this);\n this.message = errors\n ? errors.length + \" errors occurred during unsubscription:\\n\" + errors.map(function (err, i) { return i + 1 + \") \" + err.toString(); }).join('\\n ')\n : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n };\n});\n//# sourceMappingURL=UnsubscriptionError.js.map","export function arrRemove(arr, item) {\n if (arr) {\n var index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n//# sourceMappingURL=arrRemove.js.map","import { __read, __spreadArray, __values } from \"tslib\";\nimport { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { arrRemove } from './util/arrRemove';\nvar Subscription = (function () {\n function Subscription(initialTeardown) {\n this.initialTeardown = initialTeardown;\n this.closed = false;\n this._parentage = null;\n this._finalizers = null;\n }\n Subscription.prototype.unsubscribe = function () {\n var e_1, _a, e_2, _b;\n var errors;\n if (!this.closed) {\n this.closed = true;\n var _parentage = this._parentage;\n if (_parentage) {\n this._parentage = null;\n if (Array.isArray(_parentage)) {\n try {\n for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {\n var parent_1 = _parentage_1_1.value;\n parent_1.remove(this);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n }\n else {\n _parentage.remove(this);\n }\n }\n var initialFinalizer = this.initialTeardown;\n if (isFunction(initialFinalizer)) {\n try {\n initialFinalizer();\n }\n catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\n }\n }\n var _finalizers = this._finalizers;\n if (_finalizers) {\n this._finalizers = null;\n try {\n for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {\n var finalizer = _finalizers_1_1.value;\n try {\n execFinalizer(finalizer);\n }\n catch (err) {\n errors = errors !== null && errors !== void 0 ? errors : [];\n if (err instanceof UnsubscriptionError) {\n errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));\n }\n else {\n errors.push(err);\n }\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n }\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n };\n Subscription.prototype.add = function (teardown) {\n var _a;\n if (teardown && teardown !== this) {\n if (this.closed) {\n execFinalizer(teardown);\n }\n else {\n if (teardown instanceof Subscription) {\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);\n }\n }\n };\n Subscription.prototype._hasParent = function (parent) {\n var _parentage = this._parentage;\n return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));\n };\n Subscription.prototype._addParent = function (parent) {\n var _parentage = this._parentage;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n };\n Subscription.prototype._removeParent = function (parent) {\n var _parentage = this._parentage;\n if (_parentage === parent) {\n this._parentage = null;\n }\n else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n };\n Subscription.prototype.remove = function (teardown) {\n var _finalizers = this._finalizers;\n _finalizers && arrRemove(_finalizers, teardown);\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n };\n Subscription.EMPTY = (function () {\n var empty = new Subscription();\n empty.closed = true;\n return empty;\n })();\n return Subscription;\n}());\nexport { Subscription };\nexport var EMPTY_SUBSCRIPTION = Subscription.EMPTY;\nexport function isSubscription(value) {\n return (value instanceof Subscription ||\n (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));\n}\nfunction execFinalizer(finalizer) {\n if (isFunction(finalizer)) {\n finalizer();\n }\n else {\n finalizer.unsubscribe();\n }\n}\n//# sourceMappingURL=Subscription.js.map","export var config = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false,\n};\n//# sourceMappingURL=config.js.map","import { __read, __spreadArray } from \"tslib\";\nexport var timeoutProvider = {\n setTimeout: function (handler, timeout) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n var delegate = timeoutProvider.delegate;\n if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {\n return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));\n }\n return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));\n },\n clearTimeout: function (handle) {\n var delegate = timeoutProvider.delegate;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);\n },\n delegate: undefined,\n};\n//# sourceMappingURL=timeoutProvider.js.map","import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\nexport function reportUnhandledError(err) {\n timeoutProvider.setTimeout(function () {\n var onUnhandledError = config.onUnhandledError;\n if (onUnhandledError) {\n onUnhandledError(err);\n }\n else {\n throw err;\n }\n });\n}\n//# sourceMappingURL=reportUnhandledError.js.map","export function noop() { }\n//# sourceMappingURL=noop.js.map","import { config } from '../config';\nvar context = null;\nexport function errorContext(cb) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n var isRoot = !context;\n if (isRoot) {\n context = { errorThrown: false, error: null };\n }\n cb();\n if (isRoot) {\n var _a = context, errorThrown = _a.errorThrown, error = _a.error;\n context = null;\n if (errorThrown) {\n throw error;\n }\n }\n }\n else {\n cb();\n }\n}\nexport function captureError(err) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n//# sourceMappingURL=errorContext.js.map","import { __extends } from \"tslib\";\nimport { isFunction } from './util/isFunction';\nimport { isSubscription, Subscription } from './Subscription';\nimport { config } from './config';\nimport { reportUnhandledError } from './util/reportUnhandledError';\nimport { noop } from './util/noop';\nimport { nextNotification, errorNotification, COMPLETE_NOTIFICATION } from './NotificationFactories';\nimport { timeoutProvider } from './scheduler/timeoutProvider';\nimport { captureError } from './util/errorContext';\nvar Subscriber = (function (_super) {\n __extends(Subscriber, _super);\n function Subscriber(destination) {\n var _this = _super.call(this) || this;\n _this.isStopped = false;\n if (destination) {\n _this.destination = destination;\n if (isSubscription(destination)) {\n destination.add(_this);\n }\n }\n else {\n _this.destination = EMPTY_OBSERVER;\n }\n return _this;\n }\n Subscriber.create = function (next, error, complete) {\n return new SafeSubscriber(next, error, complete);\n };\n Subscriber.prototype.next = function (value) {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n }\n else {\n this._next(value);\n }\n };\n Subscriber.prototype.error = function (err) {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n }\n else {\n this.isStopped = true;\n this._error(err);\n }\n };\n Subscriber.prototype.complete = function () {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n }\n else {\n this.isStopped = true;\n this._complete();\n }\n };\n Subscriber.prototype.unsubscribe = function () {\n if (!this.closed) {\n this.isStopped = true;\n _super.prototype.unsubscribe.call(this);\n this.destination = null;\n }\n };\n Subscriber.prototype._next = function (value) {\n this.destination.next(value);\n };\n Subscriber.prototype._error = function (err) {\n try {\n this.destination.error(err);\n }\n finally {\n this.unsubscribe();\n }\n };\n Subscriber.prototype._complete = function () {\n try {\n this.destination.complete();\n }\n finally {\n this.unsubscribe();\n }\n };\n return Subscriber;\n}(Subscription));\nexport { Subscriber };\nvar _bind = Function.prototype.bind;\nfunction bind(fn, thisArg) {\n return _bind.call(fn, thisArg);\n}\nvar ConsumerObserver = (function () {\n function ConsumerObserver(partialObserver) {\n this.partialObserver = partialObserver;\n }\n ConsumerObserver.prototype.next = function (value) {\n var partialObserver = this.partialObserver;\n if (partialObserver.next) {\n try {\n partialObserver.next(value);\n }\n catch (error) {\n handleUnhandledError(error);\n }\n }\n };\n ConsumerObserver.prototype.error = function (err) {\n var partialObserver = this.partialObserver;\n if (partialObserver.error) {\n try {\n partialObserver.error(err);\n }\n catch (error) {\n handleUnhandledError(error);\n }\n }\n else {\n handleUnhandledError(err);\n }\n };\n ConsumerObserver.prototype.complete = function () {\n var partialObserver = this.partialObserver;\n if (partialObserver.complete) {\n try {\n partialObserver.complete();\n }\n catch (error) {\n handleUnhandledError(error);\n }\n }\n };\n return ConsumerObserver;\n}());\nvar SafeSubscriber = (function (_super) {\n __extends(SafeSubscriber, _super);\n function SafeSubscriber(observerOrNext, error, complete) {\n var _this = _super.call(this) || this;\n var partialObserver;\n if (isFunction(observerOrNext) || !observerOrNext) {\n partialObserver = {\n next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),\n error: error !== null && error !== void 0 ? error : undefined,\n complete: complete !== null && complete !== void 0 ? complete : undefined,\n };\n }\n else {\n var context_1;\n if (_this && config.useDeprecatedNextContext) {\n context_1 = Object.create(observerOrNext);\n context_1.unsubscribe = function () { return _this.unsubscribe(); };\n partialObserver = {\n next: observerOrNext.next && bind(observerOrNext.next, context_1),\n error: observerOrNext.error && bind(observerOrNext.error, context_1),\n complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),\n };\n }\n else {\n partialObserver = observerOrNext;\n }\n }\n _this.destination = new ConsumerObserver(partialObserver);\n return _this;\n }\n return SafeSubscriber;\n}(Subscriber));\nexport { SafeSubscriber };\nfunction handleUnhandledError(error) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(error);\n }\n else {\n reportUnhandledError(error);\n }\n}\nfunction defaultErrorHandler(err) {\n throw err;\n}\nfunction handleStoppedNotification(notification, subscriber) {\n var onStoppedNotification = config.onStoppedNotification;\n onStoppedNotification && timeoutProvider.setTimeout(function () { return onStoppedNotification(notification, subscriber); });\n}\nexport var EMPTY_OBSERVER = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop,\n};\n//# sourceMappingURL=Subscriber.js.map","export var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();\n//# sourceMappingURL=observable.js.map","export function identity(x) {\n return x;\n}\n//# sourceMappingURL=identity.js.map","import { identity } from './identity';\nexport function pipe() {\n var fns = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n fns[_i] = arguments[_i];\n }\n return pipeFromArray(fns);\n}\nexport function pipeFromArray(fns) {\n if (fns.length === 0) {\n return identity;\n }\n if (fns.length === 1) {\n return fns[0];\n }\n return function piped(input) {\n return fns.reduce(function (prev, fn) { return fn(prev); }, input);\n };\n}\n//# sourceMappingURL=pipe.js.map","import { SafeSubscriber, Subscriber } from './Subscriber';\nimport { isSubscription } from './Subscription';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nimport { isFunction } from './util/isFunction';\nimport { errorContext } from './util/errorContext';\nvar Observable = (function () {\n function Observable(subscribe) {\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n Observable.prototype.lift = function (operator) {\n var observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n };\n Observable.prototype.subscribe = function (observerOrNext, error, complete) {\n var _this = this;\n var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);\n errorContext(function () {\n var _a = _this, operator = _a.operator, source = _a.source;\n subscriber.add(operator\n ?\n operator.call(subscriber, source)\n : source\n ?\n _this._subscribe(subscriber)\n :\n _this._trySubscribe(subscriber));\n });\n return subscriber;\n };\n Observable.prototype._trySubscribe = function (sink) {\n try {\n return this._subscribe(sink);\n }\n catch (err) {\n sink.error(err);\n }\n };\n Observable.prototype.forEach = function (next, promiseCtor) {\n var _this = this;\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor(function (resolve, reject) {\n var subscriber = new SafeSubscriber({\n next: function (value) {\n try {\n next(value);\n }\n catch (err) {\n reject(err);\n subscriber.unsubscribe();\n }\n },\n error: reject,\n complete: resolve,\n });\n _this.subscribe(subscriber);\n });\n };\n Observable.prototype._subscribe = function (subscriber) {\n var _a;\n return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);\n };\n Observable.prototype[Symbol_observable] = function () {\n return this;\n };\n Observable.prototype.pipe = function () {\n var operations = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n operations[_i] = arguments[_i];\n }\n return pipeFromArray(operations)(this);\n };\n Observable.prototype.toPromise = function (promiseCtor) {\n var _this = this;\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor(function (resolve, reject) {\n var value;\n _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });\n });\n };\n Observable.create = function (subscribe) {\n return new Observable(subscribe);\n };\n return Observable;\n}());\nexport { Observable };\nfunction getPromiseCtor(promiseCtor) {\n var _a;\n return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;\n}\nfunction isObserver(value) {\n return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);\n}\nfunction isSubscriber(value) {\n return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));\n}\n//# sourceMappingURL=Observable.js.map","import { isFunction } from './isFunction';\nexport function hasLift(source) {\n return isFunction(source === null || source === void 0 ? void 0 : source.lift);\n}\nexport function operate(init) {\n return function (source) {\n if (hasLift(source)) {\n return source.lift(function (liftedSource) {\n try {\n return init(liftedSource, this);\n }\n catch (err) {\n this.error(err);\n }\n });\n }\n throw new TypeError('Unable to lift unknown Observable type');\n };\n}\n//# sourceMappingURL=lift.js.map","import { __extends } from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nexport function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {\n return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);\n}\nvar OperatorSubscriber = (function (_super) {\n __extends(OperatorSubscriber, _super);\n function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {\n var _this = _super.call(this, destination) || this;\n _this.onFinalize = onFinalize;\n _this.shouldUnsubscribe = shouldUnsubscribe;\n _this._next = onNext\n ? function (value) {\n try {\n onNext(value);\n }\n catch (err) {\n destination.error(err);\n }\n }\n : _super.prototype._next;\n _this._error = onError\n ? function (err) {\n try {\n onError(err);\n }\n catch (err) {\n destination.error(err);\n }\n finally {\n this.unsubscribe();\n }\n }\n : _super.prototype._error;\n _this._complete = onComplete\n ? function () {\n try {\n onComplete();\n }\n catch (err) {\n destination.error(err);\n }\n finally {\n this.unsubscribe();\n }\n }\n : _super.prototype._complete;\n return _this;\n }\n OperatorSubscriber.prototype.unsubscribe = function () {\n var _a;\n if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {\n var closed_1 = this.closed;\n _super.prototype.unsubscribe.call(this);\n !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));\n }\n };\n return OperatorSubscriber;\n}(Subscriber));\nexport { OperatorSubscriber };\n//# sourceMappingURL=OperatorSubscriber.js.map","import { createErrorClass } from './createErrorClass';\nexport var EmptyError = createErrorClass(function (_super) { return function EmptyErrorImpl() {\n _super(this);\n this.name = 'EmptyError';\n this.message = 'no elements in sequence';\n}; });\n//# sourceMappingURL=EmptyError.js.map","import { EmptyError } from './util/EmptyError';\nimport { SafeSubscriber } from './Subscriber';\nexport function firstValueFrom(source, config) {\n var hasConfig = typeof config === 'object';\n return new Promise(function (resolve, reject) {\n var subscriber = new SafeSubscriber({\n next: function (value) {\n resolve(value);\n subscriber.unsubscribe();\n },\n error: reject,\n complete: function () {\n if (hasConfig) {\n resolve(config.defaultValue);\n }\n else {\n reject(new EmptyError());\n }\n },\n });\n source.subscribe(subscriber);\n });\n}\n//# sourceMappingURL=firstValueFrom.js.map","import { createOperatorSubscriber } from './OperatorSubscriber';\nexport function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {\n return function (source, subscriber) {\n var hasState = hasSeed;\n var state = seed;\n var index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, function (value) {\n var i = index++;\n state = hasState\n ?\n accumulator(state, value, i)\n :\n ((hasState = true), value);\n emitOnNext && subscriber.next(state);\n }, emitBeforeComplete &&\n (function () {\n hasState && subscriber.next(state);\n subscriber.complete();\n })));\n };\n}\n//# sourceMappingURL=scanInternals.js.map","import { scanInternals } from './scanInternals';\nimport { operate } from '../util/lift';\nexport function reduce(accumulator, seed) {\n return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true));\n}\n//# sourceMappingURL=reduce.js.map","import { reduce } from './reduce';\nimport { operate } from '../util/lift';\nvar arrReducer = function (arr, value) { return (arr.push(value), arr); };\nexport function toArray() {\n return operate(function (source, subscriber) {\n reduce(arrReducer, [])(source).subscribe(subscriber);\n });\n}\n//# sourceMappingURL=toArray.js.map","import { Buffer } from 'buffer';\nimport { Parser } from 'binary-parser';\nimport { LocalFile, RemoteFile } from 'generic-filehandle';\nimport { firstValueFrom, Observable } from 'rxjs';\nimport { toArray } from 'rxjs/operators';\nimport { BlockView } from './blockView';\nconst BIG_WIG_MAGIC = -2003829722;\nconst BIG_BED_MAGIC = -2021002517;\nfunction toString(arr) {\n return new TextDecoder().decode(arr);\n}\n/* get the compiled parsers for different sections of the bigwig file\n *\n * @param isBE - is big endian, typically false\n * @return an object with compiled parsers\n */\nfunction getParsers(isBE) {\n const le = isBE ? 'big' : 'little';\n const headerParser = new Parser()\n .endianess(le)\n .int32('magic')\n .uint16('version')\n .uint16('numZoomLevels')\n .uint64('chromTreeOffset')\n .uint64('unzoomedDataOffset')\n .uint64('unzoomedIndexOffset')\n .uint16('fieldCount')\n .uint16('definedFieldCount')\n .uint64('asOffset') // autoSql offset, used in bigbed\n .uint64('totalSummaryOffset')\n .uint32('uncompressBufSize')\n .uint64('extHeaderOffset') // name index offset, used in bigbed\n .array('zoomLevels', {\n length: 'numZoomLevels',\n type: new Parser()\n .endianess(le)\n .uint32('reductionLevel')\n .uint32('reserved')\n .uint64('dataOffset')\n .uint64('indexOffset'),\n });\n const totalSummaryParser = new Parser()\n .endianess(le)\n .uint64('basesCovered')\n .doublele('scoreMin')\n .doublele('scoreMax')\n .doublele('scoreSum')\n .doublele('scoreSumSquares');\n const chromTreeParser = new Parser()\n .endianess(le)\n .uint32('magic')\n .uint32('blockSize')\n .uint32('keySize')\n .uint32('valSize')\n .uint64('itemCount');\n const isLeafNode = new Parser()\n .endianess(le)\n .uint8('isLeafNode')\n .skip(1)\n .uint16('cnt')\n .saveOffset('offset');\n return {\n chromTreeParser,\n totalSummaryParser,\n headerParser,\n isLeafNode,\n };\n}\nexport class BBI {\n /* fetch and parse header information from a bigwig or bigbed file\n * @param abortSignal - abort the operation, can be null\n * @return a Header object\n */\n getHeader(opts = {}) {\n const options = 'aborted' in opts ? { signal: opts } : opts;\n if (!this.headerP) {\n this.headerP = this._getHeader(options).catch(e => {\n this.headerP = undefined;\n throw e;\n });\n }\n return this.headerP;\n }\n /*\n * @param filehandle - a filehandle from generic-filehandle or implementing something similar to the node10 fs.promises API\n * @param path - a Local file path as a string\n * @param url - a URL string\n * @param renameRefSeqs - an optional method to rename the internal reference sequences using a mapping function\n */\n constructor(options = {}) {\n const { filehandle, renameRefSeqs = s => s, path, url } = options;\n this.renameRefSeqs = renameRefSeqs;\n if (filehandle) {\n this.bbi = filehandle;\n }\n else if (url) {\n this.bbi = new RemoteFile(url);\n }\n else if (path) {\n this.bbi = new LocalFile(path);\n }\n else {\n throw new Error('no file given');\n }\n }\n async _getHeader(opts) {\n const header = await this._getMainHeader(opts);\n const chroms = await this._readChromTree(header, opts);\n return { ...header, ...chroms };\n }\n async _getMainHeader(opts, requestSize = 2000) {\n const { buffer } = await this.bbi.read(Buffer.alloc(requestSize), 0, requestSize, 0, opts);\n const isBigEndian = this._isBigEndian(buffer);\n const ret = getParsers(isBigEndian);\n const header = ret.headerParser.parse(buffer);\n const { magic, asOffset, totalSummaryOffset } = header;\n header.fileType = magic === BIG_BED_MAGIC ? 'bigbed' : 'bigwig';\n if (asOffset > requestSize || totalSummaryOffset > requestSize) {\n return this._getMainHeader(opts, requestSize * 2);\n }\n if (asOffset) {\n const off = Number(header.asOffset);\n header.autoSql = toString(buffer.subarray(off, buffer.indexOf(0, off)));\n }\n if (header.totalSummaryOffset > requestSize) {\n return this._getMainHeader(opts, requestSize * 2);\n }\n if (header.totalSummaryOffset) {\n const tail = buffer.subarray(Number(header.totalSummaryOffset));\n const sum = ret.totalSummaryParser.parse(tail);\n header.totalSummary = { ...sum, basesCovered: Number(sum.basesCovered) };\n }\n return { ...header, isBigEndian };\n }\n _isBigEndian(buffer) {\n let ret = buffer.readInt32LE(0);\n if (ret === BIG_WIG_MAGIC || ret === BIG_BED_MAGIC) {\n return false;\n }\n ret = buffer.readInt32BE(0);\n if (ret === BIG_WIG_MAGIC || ret === BIG_BED_MAGIC) {\n return true;\n }\n throw new Error('not a BigWig/BigBed file');\n }\n // todo: add progress if long running\n async _readChromTree(header, opts) {\n const isBE = header.isBigEndian;\n const le = isBE ? 'big' : 'little';\n const refsByNumber = [];\n const refsByName = {};\n let unzoomedDataOffset = Number(header.unzoomedDataOffset);\n const chromTreeOffset = Number(header.chromTreeOffset);\n while (unzoomedDataOffset % 4 !== 0) {\n unzoomedDataOffset += 1;\n }\n const off = unzoomedDataOffset - chromTreeOffset;\n const { buffer } = await this.bbi.read(Buffer.alloc(off), 0, off, Number(chromTreeOffset), opts);\n const p = getParsers(isBE);\n const { keySize } = p.chromTreeParser.parse(buffer);\n const leafNodeParser = new Parser()\n .endianess(le)\n .string('key', { stripNull: true, length: keySize })\n .uint32('refId')\n .uint32('refSize')\n .saveOffset('offset');\n const nonleafNodeParser = new Parser()\n .endianess(le)\n .skip(keySize)\n .uint64('childOffset')\n .saveOffset('offset');\n const rootNodeOffset = 32;\n const bptReadNode = async (currentOffset) => {\n let offset = currentOffset;\n if (offset >= buffer.length) {\n throw new Error('reading beyond end of buffer');\n }\n const ret = p.isLeafNode.parse(buffer.subarray(offset));\n const { isLeafNode, cnt } = ret;\n offset += ret.offset;\n if (isLeafNode) {\n for (let n = 0; n < cnt; n += 1) {\n const leafRet = leafNodeParser.parse(buffer.subarray(offset));\n offset += leafRet.offset;\n const { key, refId, refSize } = leafRet;\n const refRec = { name: key, id: refId, length: refSize };\n refsByName[this.renameRefSeqs(key)] = refId;\n refsByNumber[refId] = refRec;\n }\n }\n else {\n // parse index node\n const nextNodes = [];\n for (let n = 0; n < cnt; n += 1) {\n const nonleafRet = nonleafNodeParser.parse(buffer.subarray(offset));\n const { childOffset } = nonleafRet;\n offset += nonleafRet.offset;\n nextNodes.push(bptReadNode(Number(childOffset) - Number(chromTreeOffset)));\n }\n await Promise.all(nextNodes);\n }\n };\n await bptReadNode(rootNodeOffset);\n return {\n refsByName,\n refsByNumber,\n };\n }\n /*\n * fetches the \"unzoomed\" view of the bigwig data. this is the default for bigbed\n * @param abortSignal - a signal to optionally abort this operation\n */\n async getUnzoomedView(opts) {\n const { unzoomedIndexOffset, refsByName, uncompressBufSize, isBigEndian, fileType, } = await this.getHeader(opts);\n return new BlockView(this.bbi, refsByName, unzoomedIndexOffset, isBigEndian, uncompressBufSize > 0, fileType);\n }\n /**\n * Gets features from a BigWig file\n *\n * @param refName - The chromosome name\n * @param start - The start of a region\n * @param end - The end of a region\n * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) or scale used to infer the zoomLevel to use\n */\n async getFeatureStream(refName, start, end, opts = {\n scale: 1,\n }) {\n await this.getHeader(opts);\n const chrName = this.renameRefSeqs(refName);\n let view;\n if (opts.basesPerSpan) {\n view = await this.getView(1 / opts.basesPerSpan, opts);\n }\n else if (opts.scale) {\n view = await this.getView(opts.scale, opts);\n }\n else {\n view = await this.getView(1, opts);\n }\n if (!view) {\n throw new Error('unable to get block view for data');\n }\n return new Observable((observer) => {\n view.readWigData(chrName, start, end, observer, opts);\n });\n }\n async getFeatures(refName, start, end, opts = {\n scale: 1,\n }) {\n const ob = await this.getFeatureStream(refName, start, end, opts);\n const ret = await firstValueFrom(ob.pipe(toArray()));\n return ret.flat();\n }\n}\n//# sourceMappingURL=bbi.js.map","import { BlockView } from './blockView';\nimport { BBI } from './bbi';\nexport class BigWig extends BBI {\n /**\n * Retrieves a BlockView of a specific zoomLevel\n *\n * @param scale - number\n * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) or scale used to infer the zoomLevel to use\n */\n async getView(scale, opts) {\n const { zoomLevels, refsByName, fileSize, isBigEndian, uncompressBufSize } = await this.getHeader(opts);\n const basesPerPx = 1 / scale;\n let maxLevel = zoomLevels.length;\n if (!fileSize) {\n // if we don't know the file size, we can't fetch the highest zoom level :-(\n maxLevel -= 1;\n }\n for (let i = maxLevel; i >= 0; i -= 1) {\n const zh = zoomLevels[i];\n if (zh && zh.reductionLevel <= 2 * basesPerPx) {\n const indexOffset = Number(zh.indexOffset);\n return new BlockView(this.bbi, refsByName, indexOffset, isBigEndian, uncompressBufSize > 0, 'summary');\n }\n }\n return this.getUnzoomedView(opts);\n }\n}\n//# sourceMappingURL=bigwig.js.map","/*\n * This code is based on the following repo:\n * https://github.com/higlass/higlass-bigwig-datafetcher/blob/main/src/BigwigDataFetcher.js\n */\nimport { BigWig } from '@gmod/bbi';\nimport type { Assembly, BigWigData } from '@gosling-lang/gosling-schema';\nimport { computeChromSizes } from '../../core/utils/assembly';\nimport { type CommonDataConfig, RemoteFile } from '../utils';\n\nimport type { Feature } from '@gmod/bbi';\nimport type { ChromInfo, TilesetInfo } from '@higlass/types';\n\ntype BigWigDataConfig = BigWigData & CommonDataConfig;\n\ntype Tile = {\n tilePos: [number];\n tileId: string;\n zoomLevel: number;\n min_value: number;\n max_value: number;\n dense: (number | null)[];\n denseDataExtrema: InstanceType;\n minNonZero: number;\n maxNonZero: number;\n};\n\ntype BigWigHeader = {\n zoomLevels: { reductionLevel: number }[];\n};\n\ntype ExtendedFeature = Feature & { startAbs: number; endAbs: number };\n\nfunction BigWigDataFetcher(HGC: import('@higlass/types').HGC, dataConfig: BigWigDataConfig) {\n if (!new.target) {\n throw new Error('Uncaught TypeError: Class constructor cannot be invoked without \"new\"');\n }\n\n const cls = class BigWigDataFetcherClass {\n dataConfig: typeof dataConfig;\n bwFileHeader: BigWigHeader | null;\n bwFile: BigWig | null;\n TILE_SIZE: number;\n errorTxt: string;\n dataPromises: Promise[];\n chromSizes: ChromInfo & { chrToAbs: (name: string, pos: number) => number };\n assembly?: Assembly;\n tilesetInfoLoading?: boolean;\n\n constructor() {\n this.dataConfig = dataConfig;\n this.assembly = this.dataConfig.assembly;\n this.bwFileHeader = null;\n this.bwFile = null;\n this.TILE_SIZE = 1024;\n\n this.errorTxt = '';\n this.dataPromises = [];\n\n // Prepare chromosome interval information\n const chromosomeSizes = computeChromSizes(this.assembly).size;\n\n const chromosomeCumPositions: ChromInfo['cumPositions'] = [];\n const chromosomePositions: Record = {};\n let prevEndPosition = 0;\n\n Object.keys(computeChromSizes(this.assembly).size).forEach((chrStr, i) => {\n const positionInfo = {\n id: i,\n chr: chrStr,\n pos: prevEndPosition\n };\n\n chromosomeCumPositions.push(positionInfo);\n chromosomePositions[chrStr] = positionInfo;\n\n prevEndPosition += computeChromSizes(this.assembly).size[chrStr];\n });\n this.chromSizes = {\n chrToAbs: (chrom, chromPos) => this.chromSizes.chrPositions[chrom].pos + chromPos,\n cumPositions: chromosomeCumPositions,\n chrPositions: chromosomePositions,\n totalLength: prevEndPosition,\n chromLengths: chromosomeSizes\n };\n\n this.dataPromises.push(this.loadBBI(dataConfig));\n }\n\n async loadBBI(dataConfig: BigWigDataConfig) {\n if (dataConfig.url) {\n this.bwFile = new BigWig({\n filehandle: new RemoteFile(dataConfig.url, { overrides: dataConfig.urlFetchOptions })\n });\n return this.bwFile.getHeader().then((h: BigWigHeader) => {\n this.bwFileHeader = h;\n });\n } else {\n console.error('Please enter a \"url\" field to the data config');\n return null;\n }\n }\n\n tilesetInfo(callback?: (info: TilesetInfo | { error: string }) => void) {\n this.tilesetInfoLoading = true;\n\n return Promise.all(this.dataPromises)\n .then(() => {\n this.tilesetInfoLoading = false;\n\n const totalLength = this.chromSizes.totalLength;\n\n const retVal = {\n tile_size: this.TILE_SIZE,\n max_zoom: Math.ceil(Math.log(totalLength / this.TILE_SIZE) / Math.log(2)),\n max_width: 2 ** Math.ceil(Math.log(totalLength) / Math.log(2)),\n min_pos: [0],\n max_pos: [totalLength]\n };\n\n if (callback) {\n callback(retVal);\n }\n\n return retVal;\n })\n .catch(err => {\n this.tilesetInfoLoading = false;\n\n console.error(err);\n\n if (callback) {\n callback({\n error: `Error parsing bigwig: ${err}`\n });\n }\n return null;\n });\n }\n\n fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n const tiles: Record = {};\n const validTileIds: string[] = [];\n const tilePromises = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('Invalid tile zoom or position:', z, x);\n continue;\n }\n\n validTileIds.push(tileId);\n tilePromises.push(this.tile(z, x));\n }\n\n Promise.all(tilePromises).then(values => {\n for (let i = 0; i < values.length; i++) {\n const validTileId = validTileIds[i];\n tiles[validTileId] = values[i];\n tiles[validTileId].tilePositionId = validTileId;\n }\n\n receivedTiles(tiles);\n });\n // tiles = tileResponseToData(tiles, null, tileIds);\n return tiles;\n }\n\n async tile(z: number, x: number) {\n const tsInfo = (await this.tilesetInfo())!;\n const tileWidth = +tsInfo.max_width / 2 ** +z;\n\n const recordPromises: Promise[] = [];\n\n const tile: Partial = {\n tilePos: [x],\n tileId: `bigwig.${z}.${x}`,\n zoomLevel: z\n };\n\n // get the bounds of the tile\n const minXOriginal = tsInfo.min_pos[0] + x * tileWidth;\n let minX = minXOriginal;\n const maxX = tsInfo.min_pos[0] + (x + 1) * tileWidth;\n\n const basesPerPixel = this.determineScale(minX, maxX);\n const basesPerBin = (maxX - minX) / this.TILE_SIZE;\n\n const binStarts: number[] = [];\n for (let i = 0; i < this.TILE_SIZE; i++) {\n binStarts.push(minX + i * basesPerBin);\n }\n\n const { chromLengths, cumPositions } = this.chromSizes;\n\n cumPositions.forEach(cumPos => {\n const chromName = cumPos.chr;\n const chromStart = cumPos.pos;\n const chromEnd = cumPos.pos + chromLengths[chromName];\n\n let startPos, endPos;\n\n if (chromStart <= minX && minX < chromEnd) {\n // start of the visible region is within this chromosome\n\n if (maxX > chromEnd) {\n // the visible region extends beyond the end of this chromosome\n // fetch from the start until the end of the chromosome\n startPos = minX - chromStart;\n endPos = chromEnd - chromStart;\n recordPromises.push(\n this.bwFile!.getFeatures(chromName, startPos, endPos, {\n scale: 1 / basesPerPixel\n }).then(values => {\n values.forEach((v: Feature & { startAbs?: number; endAbs?: number }) => {\n v['startAbs'] = HGC.utils.chrToAbs(chromName, v.start, this.chromSizes);\n v['endAbs'] = HGC.utils.chrToAbs(chromName, v.end, this.chromSizes);\n });\n return values as (Feature & { startAbs: number; endAbs: number })[];\n })\n );\n\n minX = chromEnd;\n } else {\n startPos = Math.floor(minX - chromStart);\n endPos = Math.ceil(maxX - chromStart);\n if (!this.bwFile) return;\n recordPromises.push(\n this.bwFile\n .getFeatures(chromName, startPos, endPos, {\n scale: 1 / basesPerPixel\n })\n .then(values => {\n values.forEach((v: Feature & { startAbs?: number; endAbs?: number }) => {\n v['startAbs'] = HGC.utils.chrToAbs(chromName, v.start, this.chromSizes);\n v['endAbs'] = HGC.utils.chrToAbs(chromName, v.end, this.chromSizes);\n });\n return values as (Feature & { startAbs: number; endAbs: number })[];\n })\n );\n return;\n }\n }\n });\n\n return Promise.all(recordPromises).then(v => {\n const values = v.flat();\n\n const dense: (number | null)[] = [];\n for (let i = 0; i < this.TILE_SIZE; i++) {\n dense.push(null);\n }\n\n // Currently we use the same binning strategy in all cases (basesPerBin =>< basesPerBinInFile)\n binStarts.forEach((curStart, index) => {\n if (curStart < minXOriginal || curStart > maxX) {\n return;\n }\n const filtered = values\n .filter(v => {\n return curStart >= v.startAbs && curStart < v.endAbs;\n })\n .map(v => v.score);\n dense[index] = filtered.length > 0 ? filtered[0] : null;\n });\n\n const dde = new HGC.utils.DenseDataExtrema1D(dense);\n // @ts-expect-error Math.min() allows `null` but results in min\n tile.min_value = Math.min(...dense);\n // @ts-expect-error Math.max() allows `null` but results in min\n tile.max_value = Math.max(...dense);\n tile.dense = dense;\n tile.denseDataExtrema = dde;\n tile.minNonZero = dde.minNonZeroInTile;\n tile.maxNonZero = dde.maxNonZeroInTile;\n return tile as Tile;\n });\n }\n\n // We never want to request more than 1024 * 20 elements from the file.\n determineScale(minX: number, maxX: number) {\n const reductionLevels = [1];\n const numRequestedElements = maxX - minX;\n\n if (!this.bwFileHeader) {\n throw Error('no bigwig header');\n }\n\n this.bwFileHeader.zoomLevels.forEach(z => {\n reductionLevels.push(z.reductionLevel);\n });\n\n let level: number | undefined;\n reductionLevels.forEach(rl => {\n if (level) return; // we found one\n\n const numElementsFromFile = numRequestedElements / rl;\n if (numElementsFromFile <= this.TILE_SIZE * 20) {\n level = rl;\n }\n });\n\n // return the highest reductionLevel, if we could not find anything better\n return level || reductionLevels.slice(-1)[0];\n }\n };\n\n return new cls();\n}\n\nBigWigDataFetcher.config = {\n type: 'bigwig'\n};\n\nexport default BigWigDataFetcher;\n","import type * as d3 from 'd3';\nimport type {\n SingleTrack,\n Datum,\n FilterTransform,\n LogTransform,\n ExonSplitTransform,\n Assembly,\n StrConcatTransform,\n StrReplaceTransform,\n GenomicLengthTransform,\n SvTypeTransform,\n CoverageTransform,\n DisplaceTransform,\n JsonParseTransform\n} from '@gosling-lang/gosling-schema';\nimport {\n getChannelKeysByAggregateFnc,\n getChannelKeysByType,\n IsChannelDeep,\n IsIncludeFilter,\n IsOneOfFilter,\n IsRangeFilter\n} from '@gosling-lang/gosling-schema';\nimport { computeChromSizes } from './assembly';\n// import Logging from './log';\n\n/**\n * Apply filter\n */\nexport function filterData(filter: FilterTransform, data: Datum[]): Datum[] {\n const { field, not } = filter;\n\n let output: Datum[] = Array.from(data);\n if (IsOneOfFilter(filter)) {\n const { oneOf } = filter;\n output = output.filter((d: Datum) => {\n return not ? (oneOf as any[]).indexOf(d[field]) === -1 : (oneOf as any[]).indexOf(d[field]) !== -1;\n });\n } else if (IsRangeFilter(filter)) {\n const { inRange } = filter;\n output = output.filter((d: Datum) => {\n const value = +d[field];\n return not ? !(inRange[0] <= value && value <= inRange[1]) : inRange[0] <= value && value <= inRange[1];\n });\n } else if (IsIncludeFilter(filter)) {\n const { include } = filter;\n output = output.filter((d: Datum) => {\n return not ? `${d[field]}`.includes(include) : !`${d[field]}`.includes(include);\n });\n }\n return output;\n}\n\n/**\n * Calculate new data, like log transformation.\n */\nexport function concatString(concat: StrConcatTransform, data: Datum[]): Datum[] {\n const { fields, separator, newField } = concat;\n\n let output: Datum[] = Array.from(data);\n output = output.map(d => {\n const strs = fields.map(f => d[f]);\n d[newField] = strs.join(separator);\n return d;\n });\n return output;\n}\n\nexport function replaceString(_: StrReplaceTransform, data: Datum[]): Datum[] {\n const { field, replace, newField } = _;\n\n let output: Datum[] = Array.from(data);\n output = output.map(d => {\n d[newField] = d[field]; // copy original string\n replace.forEach(r => {\n const { from, to } = r;\n d[newField] = d[newField].toString().replaceAll(from, to);\n });\n return d;\n });\n return output;\n}\n\n/**\n * Calculate new data, like log transformation.\n */\nexport function calculateData(log: LogTransform, data: Datum[]): Datum[] {\n const { field, base, newField } = log;\n\n let output: Datum[] = Array.from(data);\n output = output.map(d => {\n if (+d[field]) {\n if (base === 'e') {\n d[newField ?? field] = Math.log(+d[field]);\n } else {\n d[newField ?? field] = Math.log(+d[field]) / Math.log(base ?? 10);\n }\n }\n return d;\n });\n return output;\n}\n\n/**\n * Calculate genomic length using two genomic fields.\n */\nexport function calculateGenomicLength(_: GenomicLengthTransform, data: Datum[]): Datum[] {\n const { startField, endField, newField } = _;\n const output = Array.from(data);\n output.forEach(d => {\n const s = d[startField];\n const e = d[endField];\n if (!s || !e) {\n // such field does not exist, so skip this row\n // console.warn(`[Genomic Length] startField or endField (${s} or ${e}) does not exist.`);\n return;\n }\n d[newField] = Math.abs(+e - +s);\n });\n return output;\n}\n\n/*\n * Infer SV types (i.e., one of DUP, TRA, DEL, t2tINV, h2hINV).\n */\nexport function inferSvType(_: SvTypeTransform, data: Datum[]): Datum[] {\n const { firstBp, secondBp, newField } = _;\n const output = Array.from(data);\n const [DUP, TRA, DEL, t2tINV, h2hINV] = ['DUP', 'TRA', 'DEL', 't2tINV', 'h2hINV'];\n\n output.forEach(d => {\n const chr1 = d[firstBp.chrField];\n const chr2 = d[secondBp.chrField];\n\n if (chr1 !== chr2) {\n d[newField] = TRA;\n return;\n }\n\n let pos1 = d[firstBp.posField];\n let pos2 = d[secondBp.posField];\n let strand1 = d[firstBp.strandField];\n let strand2 = d[secondBp.strandField];\n\n if (pos1 > pos2) {\n // need to sort first\n const _pos = pos1;\n const _strand = strand1;\n pos1 = pos2;\n strand1 = strand2;\n pos2 = _pos;\n strand2 = _strand;\n }\n\n switch (`${strand1}${strand2}`) {\n case '+-':\n d[newField] = DEL;\n break;\n case '--':\n d[newField] = t2tINV;\n break;\n case '++':\n d[newField] = h2hINV;\n break;\n case '-+':\n d[newField] = DUP;\n break;\n default:\n d[newField] = 'unknown';\n }\n });\n return output;\n}\n\n/**\n * Aggregate data rows and calculate coverage of reads.\n */\nexport function aggregateCoverage(\n _: CoverageTransform,\n data: Datum[],\n scale: d3.ScaleContinuousNumeric\n): Datum[] {\n // Logging.recordTime('aggregateCoverage');\n\n const { startField, endField, newField, groupField } = _;\n\n const coverage: { [group: string]: { [position: string]: number } } = {};\n\n // Calculate coverage by one pixel.\n const binSize = 1;\n data.forEach(d => {\n const curStart = scale(d[startField] as number);\n const curEnd = scale(d[endField] as number);\n const group = groupField ? d[groupField] : '__NO_GROUP__';\n\n const adjustedStart = Math.floor(curStart);\n for (let i = adjustedStart; i < curEnd; i += binSize) {\n if (!coverage[group]) {\n coverage[group] = {};\n }\n if (!coverage[group][i]) {\n coverage[group][i] = 0;\n }\n coverage[group][i]++;\n }\n });\n\n const output = Object.entries(coverage).flatMap(group => {\n const [groupName, coverageRecords] = group;\n return Object.entries(coverageRecords).map(entry => {\n const [key, value] = entry;\n return {\n [startField]: scale.invert(+key),\n [endField]: scale.invert(+key + binSize),\n [newField ?? 'coverage']: value,\n [groupField ?? 'group']: groupName\n };\n });\n });\n\n // console.log(coverage);\n // Logging.printTime('aggregateCoverage');\n return output;\n}\n\n/**\n * Mark displacement transform furnctions.\n * @param t An object that contains data transformation spec.\n * @param data An array of objects that contain data.\n * @param scale A d3's linear scale that map between data-level values to screen-level values (px).\n * @returns\n */\nexport function displace(\n t: DisplaceTransform,\n data: Datum[],\n scale: d3.ScaleContinuousNumeric\n): Datum[] {\n const { boundingBox, method, newField } = t;\n const { startField, endField, groupField } = boundingBox;\n\n let paddingInBp = 0;\n if (boundingBox.padding && scale && !boundingBox.isPaddingBP) {\n paddingInBp = Math.abs(scale.invert(boundingBox.padding) - scale.invert(0));\n } else if (boundingBox.padding && boundingBox.isPaddingBP) {\n paddingInBp = boundingBox.padding;\n }\n\n // Check whether we have sufficient information.\n const base = Array.from(data);\n if (base && base.length > 0) {\n if (!Object.keys(base[0]).find(d => d === startField) || !Object.keys(base[0]).find(d => d === endField)) {\n // We did not find the fields from the data, so exit here.\n return base;\n }\n }\n\n if (method === 'pile') {\n // This piling algorithm is heavily based on\n // https://github.com/higlass/higlass-pileup/blob/8538a34c6d884c28455d6178377ee1ea2c2c90ae/src/bam-fetcher-worker.js#L626\n const { maxRows } = t;\n const occupiedSpaceInRows: { [group: string]: { start: number; end: number }[] } = {};\n\n const sorted = base.sort((a: Datum, b: Datum) => (a[startField] as number) - (b[startField] as number));\n\n sorted.forEach((d: Datum) => {\n const start = +d[startField] - paddingInBp;\n const end = +d[endField] + paddingInBp;\n\n // Create object if none\n const group = groupField ? d[groupField] : '__NO_GROUP__';\n if (!occupiedSpaceInRows[group]) {\n occupiedSpaceInRows[group] = [];\n }\n\n // Find a row to place this segment\n let rowIndex = occupiedSpaceInRows[group].findIndex(d => {\n // Find a space and update the occupancy info.\n if (end < d.start) {\n d.start = start;\n return true;\n } else if (d.end < start) {\n d.end = end;\n return true;\n }\n return false;\n });\n\n if (rowIndex === -1) {\n // We did not find sufficient space from the existing rows, so add a new row.\n occupiedSpaceInRows[group].push({ start, end });\n rowIndex = occupiedSpaceInRows[group].length - 1;\n }\n\n d[newField] = `${maxRows && maxRows <= rowIndex ? maxRows - 1 : rowIndex}`;\n });\n } else if (method === 'spread') {\n const boundingBoxes: { start: number; end: number }[] = [];\n\n base.sort((a: Datum, b: Datum) => (a[startField] as number) - (b[startField] as number)).forEach((d: Datum) => {\n let start = (d[startField] as number) - paddingInBp;\n let end = (d[endField] as number) + paddingInBp;\n\n let overlapped = boundingBoxes.filter(\n box =>\n (box.start === start && end === box.end) ||\n (box.start < start && start < box.end) ||\n (box.start < end && end < box.end) ||\n (start < box.start && box.end < end)\n );\n\n if (overlapped.length > 0) {\n let trial = 0;\n do {\n overlapped = boundingBoxes.filter(\n box =>\n (box.start === start && end === box.end) ||\n (box.start < start && start < box.end) ||\n (box.start < end && end < box.end) ||\n (start < box.start && box.end < end)\n );\n if (overlapped.length > 0) {\n if (trial % 2 === 0) {\n start += paddingInBp * trial;\n end += paddingInBp * trial;\n } else {\n start -= paddingInBp * trial;\n end -= paddingInBp * trial;\n }\n }\n trial++;\n // TODO: do not go outside of a tile.\n } while (overlapped.length > 0 && trial < 1000);\n }\n\n d[`${newField}Start`] = `${start + paddingInBp}`;\n d[`${newField}Etart`] = `${end - paddingInBp}`;\n\n boundingBoxes.push({ start, end });\n });\n }\n\n // Logging.printTime('displace()');\n return base;\n}\n\nexport function splitExon(split: ExonSplitTransform, data: Datum[], assembly: Assembly = 'hg38'): Datum[] {\n const { separator, fields, flag } = split;\n let output: Datum[] = Array.from(data);\n output = output\n .map((d: Datum) => {\n const newRows: Datum[] = [];\n\n fields.forEach(f => {\n const { field, type, newField, chrField } = f;\n const splitted = d[field].toString().split(separator);\n\n splitted.forEach((s, i) => {\n let newValue: string | number = s;\n if (type === 'genomic') {\n newValue = computeChromSizes(assembly).interval[d[chrField]][0] + +s;\n }\n if (!newRows[i]) {\n // No row exist, so create one.\n newRows[i] = Object.assign(JSON.parse(JSON.stringify(d)), {\n [newField]: newValue,\n [flag.field]: flag.value\n });\n } else {\n newRows[i][newField] = newValue;\n }\n });\n });\n return [d, ...newRows];\n })\n .reduce((a, b) => a.concat(b), []);\n return output;\n}\n\n// TODO: Get this data from the fetcher as a default with a flag variable.\nexport function parseSubJSON(_: JsonParseTransform, data: Datum[]): Datum[] {\n const { field, genomicField, baseGenomicField, genomicLengthField } = _;\n let output: Datum[] = Array.from(data);\n output = output\n .map((d: Datum) => {\n let newRows: Datum[] = JSON.parse(d[field] as string);\n\n newRows = newRows.map(row => {\n if (row[genomicField] && d[baseGenomicField]) {\n row[`${genomicField}_start`] = +row[genomicField] + +d[baseGenomicField];\n row[`${genomicField}_end`] = +row[genomicField] + +d[baseGenomicField] + +row[genomicLengthField];\n }\n\n return Object.assign(JSON.parse(JSON.stringify(d)), {\n ...row,\n [`${genomicField}_start`]: row[`${genomicField}_start`],\n [`${genomicField}_end`]: row[`${genomicField}_end`],\n type: row.type ?? row.variant ?? null,\n isParsedRow: 'yes'\n });\n });\n\n return [d, ...newRows];\n })\n .reduce((a, b) => a.concat(b), []);\n return output;\n}\n\n/**\n * Experimental! Only support one category supported yet.\n */\nexport function aggregateData(spec: SingleTrack, data: Datum[]): Datum[] {\n if (getChannelKeysByAggregateFnc(spec).length === 0) {\n // we do not have aggregated fields\n return data;\n }\n\n const nChannelKeys = getChannelKeysByType(spec, 'nominal');\n\n if (nChannelKeys.length !== 1) {\n console.warn('Currently, we only support aggregating datasets with single nominal field.');\n return data;\n }\n\n const nFieldSpec = spec[nChannelKeys[0]];\n if (!IsChannelDeep(nFieldSpec)) {\n // this shouldn't be reached\n return data;\n }\n\n const nField = nFieldSpec.field;\n if (!nField) {\n // this shouldn't be reached\n return data;\n }\n\n const qChannelKeys = [...getChannelKeysByType(spec, 'quantitative'), ...getChannelKeysByType(spec, 'genomic')];\n const aggregated: { [k: string]: number | string }[] = [];\n\n const uniqueCategories = Array.from(new Set(data.map(d => d[nField])));\n\n let failed = false;\n uniqueCategories.forEach(c => {\n const datum: { [k: string]: string | number } = {};\n\n datum[nField] = c;\n\n // for each quantitative fields\n qChannelKeys.forEach(q => {\n const qFieldSpec = spec[q];\n if (!IsChannelDeep(qFieldSpec)) {\n // this shouldn't be reached\n failed = true;\n return;\n }\n\n const { field: qField } = qFieldSpec;\n if (!qField || !('aggregate' in qFieldSpec)) {\n // this shouldn't be reached\n failed = true;\n return;\n }\n\n datum[qField] =\n qFieldSpec.aggregate === 'max'\n ? Math.max(...data.filter(d => d[nField] === c).map(d => +d[qField]))\n : Math.min(...data.filter(d => d[nField] === c).map(d => +d[qField]));\n });\n\n aggregated.push(datum);\n });\n\n // set aggregated data only if we successfully generated it\n return !failed ? aggregated : data;\n}\n","import { dsvFormat as d3dsvFormat, type DSVRowString } from 'd3-dsv';\nimport { computeChromSizes } from '../../core/utils/assembly';\nimport { sampleSize } from 'lodash-es';\nimport type { Assembly, CsvData, FilterTransform, Datum } from '@gosling-lang/gosling-schema';\nimport { filterData } from '../../core/utils/data-transform';\nimport { type CommonDataConfig, filterUsingGenoPos, sanitizeChrName, RemoteFile } from '../utils';\n\ntype CsvDataConfig = CsvData & CommonDataConfig & { filter?: FilterTransform[] };\n\ninterface ChromSizes {\n chrToAbs: (chrom: string, chromPos: number) => number;\n cumPositions: { id: number; chr: string; pos: number }[];\n chrPositions: { [k: string]: { id: number; chr: string; pos: number } };\n totalLength: number;\n chromLengths: { [k: string]: number };\n}\n\n/**\n * Used in #tile() to associate tile coordinates with data\n */\ninterface TileInfo {\n tabularData: Datum[];\n server: null;\n tilePos: number[];\n zoomLevel: number;\n tilePositionId?: string;\n}\n/**\n * This is what all the tile information eventually gets organized into.\n */\nexport interface LoadedTiles {\n [tilePositionId: string]: TileInfo;\n}\n\n/**\n * Used in #generateTilesetInfo()\n */\ninterface TilesetInfo {\n tile_size: number;\n max_zoom: number;\n max_width: number;\n min_pos: number[];\n max_pos: number[];\n}\n\nexport class CsvDataFetcherClass {\n dataConfig: CsvDataConfig;\n // @ts-ignore\n tilesetInfoLoading: boolean; // Used in TiledPixiTrack\n\n #dataPromise: Promise | undefined;\n #chromSizes: ChromSizes;\n #parsedData!: DSVRowString[]; // Either set in the constructor or in #fetchCsv()\n #assembly: Assembly;\n #filter: FilterTransform[] | undefined;\n #file: RemoteFile;\n\n constructor(dataConfig: CsvDataConfig) {\n this.dataConfig = dataConfig;\n this.tilesetInfoLoading = false;\n this.#assembly = this.dataConfig.assembly;\n this.#filter = this.dataConfig.filter;\n\n if (!dataConfig.url) {\n console.error('Please provide the `url` of the data');\n }\n\n // Use any headers for this particular URL\n const { urlFetchOptions, url } = dataConfig;\n this.#file = new RemoteFile(url, { overrides: urlFetchOptions });\n\n this.#chromSizes = this.#generateChomSizeInfo();\n this.#dataPromise = this.#fetchCsv();\n }\n\n /**\n * Fetches CSV file from url, parses it, and sets this.#parsedData\n */\n async #fetchCsv(): Promise {\n const { chromosomeField, genomicFields, headerNames, longToWideId, genomicFieldsToConvert } = this.dataConfig;\n\n const separator = this.dataConfig.separator ?? ',';\n\n try {\n const buffer = await this.#file.readFile();\n const text = buffer.toString();\n const textWithHeader = headerNames ? `${headerNames.join(separator)}\\n${text}` : text;\n\n const parsedCSV = d3dsvFormat(separator).parse(textWithHeader, (row: DSVRowString) =>\n this.#processCsvRow(row, genomicFieldsToConvert, chromosomeField, genomicFields)\n );\n\n if (longToWideId && parsedCSV[0]?.[longToWideId]) {\n // rows having identical IDs are juxtaposed horizontally\n const columnNames = Object.keys(parsedCSV[0]);\n const newJson: { [k: string]: DSVRowString } = {};\n parsedCSV.forEach(row => {\n if (!newJson[row[longToWideId] as string]) {\n newJson[row[longToWideId] as string] = JSON.parse(JSON.stringify(row));\n } else {\n columnNames.forEach(colName => {\n newJson[row[longToWideId] as string][`${colName}_2`] = row[colName];\n });\n }\n });\n this.#parsedData = Object.keys(newJson).map(k_3 => newJson[k_3]);\n } else {\n this.#parsedData = parsedCSV;\n }\n } catch (error) {\n console.error('[Gosling Data Fetcher] Error fetching data', error);\n }\n }\n\n /**\n * Function passed into DSV parser to process each row\n * @param row An object which contains the row information. The keys are the column names\n * @param genomicFieldsToConvert From data config\n * @param chromosomeField From data config\n * @param genomicFields From data config\n * @returns The processed row\n */\n #processCsvRow(\n row: DSVRowString,\n genomicFieldsToConvert: CsvData['genomicFieldsToConvert'],\n chromosomeField: CsvData['chromosomeField'],\n genomicFields: CsvData['genomicFields']\n ) {\n try {\n if (genomicFieldsToConvert) {\n // This spec is used when multiple chromosomes are stored in a single row\n genomicFieldsToConvert.forEach(chromMap => {\n const genomicFields_1 = chromMap.genomicFields;\n const chromName = row[chromMap.chromosomeField] as string;\n\n genomicFields_1.forEach((positionCol: string) => {\n const chromPosition = row[positionCol] as string;\n row[positionCol] = String(this.#calcCumulativePos(chromName, chromPosition));\n });\n });\n } else if (chromosomeField && genomicFields) {\n genomicFields.forEach((positionCol_1: string) => {\n const chromPosition_1 = row[positionCol_1] as string;\n const chromName_1 = row[chromosomeField] as string;\n row[positionCol_1] = String(this.#calcCumulativePos(chromName_1, chromPosition_1));\n });\n }\n return row;\n } catch {\n // skip the rows that had errors in them\n return undefined;\n }\n }\n\n /**\n * Calculates the cumulative chromosome position based on the chromosome name and position\n * @param chromName A string, the name of the chromosome\n * @param chromPosition A string, the position within the chromosome\n */\n #calcCumulativePos(chromName: string, chromPosition: string) {\n if (this.#assembly !== 'unknown') {\n // This means we need to use the relative position considering the start position of individual chr.\n const chrName = sanitizeChrName(chromName, this.#assembly, this.dataConfig.chromosomePrefix);\n return computeChromSizes(this.#assembly).interval[chrName][0] + +chromPosition;\n } else {\n return chromPosition;\n }\n }\n /**\n * Called in TiledPixiTrack\n */\n tilesetInfo(callback?: (tilesetInto: TilesetInfo) => void): Promise | undefined {\n if (!this.#dataPromise) {\n // data promise is not prepared yet\n return;\n }\n\n this.tilesetInfoLoading = true;\n\n return this.#dataPromise\n .then(() => this.#generateTilesetInfo(callback))\n .catch(err => {\n this.tilesetInfoLoading = false;\n console.error('[Gosling Data Fetcher] Error parsing data:', err);\n });\n }\n /**\n * Called by this.tilesetInfo() to call a callback function with tileset info.\n */\n #generateTilesetInfo(callback?: (tilesetInfo: TilesetInfo) => void): TilesetInfo {\n this.tilesetInfoLoading = false;\n\n const TILE_SIZE = 1024;\n const totalLength = this.#chromSizes.totalLength;\n const retVal = {\n tile_size: TILE_SIZE,\n max_zoom: Math.ceil(Math.log(totalLength / TILE_SIZE) / Math.log(2)),\n max_width: totalLength,\n min_pos: [0, 0],\n max_pos: [totalLength, totalLength]\n };\n\n if (callback) {\n callback(retVal);\n }\n\n return retVal;\n }\n /**\n * Called in TiledPixiTrack.\n * @param receivedTiles A function from TiledPixiTrack which takes in all the loaded tiles\n * @param tileIds An array of tile IDs. Ex. ['1.0', '1.1']\n */\n fetchTilesDebounced(receivedTiles: (loadedTiles: LoadedTiles) => void, tileIds: string[]): void {\n const tiles: LoadedTiles = {};\n\n const validTileIds: string[] = [];\n const tilePromises = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n const y = parseInt(parts[2], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('[Gosling Data Fetcher] Invalid tile zoom or position:', z, x, y);\n continue;\n }\n\n validTileIds.push(tileId);\n tilePromises.push(this.#tile(z, x, y));\n }\n\n Promise.all(tilePromises).then(tileInfo => {\n tileInfo.forEach((tileInfo, i) => {\n if (tileInfo) {\n const validTileId = validTileIds[i];\n tiles[validTileId] = tileInfo;\n tiles[validTileId].tilePositionId = validTileId;\n }\n });\n receivedTiles(tiles);\n });\n }\n /**\n * Creates an object to associate a tile position with the corresponding data\n * @param z An integer, the z coordinate of the tile\n * @param x An integer, the x coordinate of the tile\n * @param y An integer, the y coordinate of the tile\n * @returns A promise of an object with tile coordinates and data\n */\n async #tile(z: number, x: number, y: number): Promise {\n const tilesetInfo = await this.tilesetInfo();\n if (!tilesetInfo) return;\n\n const tileWidth = +tilesetInfo.max_width / 2 ** +z;\n\n // get the bounds of the tile\n const minX = tilesetInfo.min_pos[0] + x * tileWidth;\n const maxX = tilesetInfo.min_pos[0] + (x + 1) * tileWidth;\n\n // filter the data so that only the visible data is sent to tracks\n let tabularData = filterUsingGenoPos(this.#parsedData as Datum[], [minX, maxX], this.dataConfig);\n\n // filter data based on the `DataTransform` spec\n this.#filter?.forEach(f => {\n tabularData = filterData(f, tabularData);\n });\n\n const sizeLimit = this.dataConfig.sampleLength ?? 1000;\n return {\n // sample the data to make it managable for visualization components\n tabularData: tabularData.length > sizeLimit ? sampleSize(tabularData, sizeLimit) : tabularData,\n server: null,\n tilePos: [x, y],\n zoomLevel: z\n };\n }\n\n /**\n * This function calculates chromosome position and size based on the assembly (this.#assembly)\n * @returns An object containing chromosome information and a way to calculate absolute position\n */\n #generateChomSizeInfo(): ChromSizes {\n // Prepare chromosome interval information\n const chromosomeSizes: { [k: string]: number } = computeChromSizes(this.#assembly).size;\n const chromosomeCumPositions: { id: number; chr: string; pos: number }[] = [];\n const chromosomePositions: { [k: string]: { id: number; chr: string; pos: number } } = {};\n let prevEndPosition = 0;\n\n Object.keys(chromosomeSizes).forEach((chrStr, i) => {\n const positionInfo = {\n id: i,\n chr: chrStr,\n pos: prevEndPosition\n };\n\n chromosomeCumPositions.push(positionInfo);\n chromosomePositions[chrStr] = positionInfo;\n\n prevEndPosition += chromosomeSizes[chrStr];\n });\n\n return {\n chrToAbs: (chrom: string, chromPos: number) => this.#chromSizes.chrPositions[chrom].pos + chromPos,\n cumPositions: chromosomeCumPositions,\n chrPositions: chromosomePositions,\n totalLength: prevEndPosition,\n chromLengths: chromosomeSizes\n };\n }\n}\n\n/**\n * HiGlass data fetcher specific for Gosling which ultimately will accept any types of data other than CSV files.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction CsvDataFetcher(\n _HGC: import('@higlass/types').HGC,\n dataConfig: CsvDataConfig,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _pubsub: Record\n): CsvDataFetcherClass {\n if (!new.target) {\n throw new Error('Uncaught TypeError: Class constructor cannot be invoked without \"new\"');\n }\n\n return new CsvDataFetcherClass(dataConfig);\n}\n\nCsvDataFetcher.config = {\n type: 'csv'\n};\n\nexport default CsvDataFetcher;\n","import { computeChromSizes } from '../../core/utils/assembly';\nimport { sampleSize } from 'lodash-es';\nimport type { Assembly, JsonData } from '@gosling-lang/gosling-schema';\nimport { type CommonDataConfig, filterUsingGenoPos, sanitizeChrName } from '../utils';\n\ntype CsvDataConfig = JsonData & CommonDataConfig;\n\n/**\n * HiGlass data fetcher specific for Gosling which ultimately will accept any types of data other than JSON values.\n */\nfunction JsonDataFetcher(HGC: any, ...args: any): any {\n if (!new.target) {\n throw new Error('Uncaught TypeError: Class constructor cannot be invoked without \"new\"');\n }\n\n class JsonDataFetcherClass {\n private dataConfig: CsvDataConfig;\n // @ts-ignore\n private tilesetInfoLoading: boolean;\n private chromSizes: any;\n private values: any;\n private assembly: Assembly;\n\n constructor(params: any[]) {\n const [dataConfig] = params;\n this.dataConfig = dataConfig;\n this.tilesetInfoLoading = false;\n this.assembly = this.dataConfig.assembly;\n\n if (!dataConfig.values) {\n console.error('Please provide `values` of the JSON data');\n return;\n }\n\n // Prepare chromosome interval information\n const chromosomeSizes: { [k: string]: number } = computeChromSizes(this.assembly).size;\n const chromosomeCumPositions: { id: number; chr: string; pos: number }[] = [];\n const chromosomePositions: { [k: string]: { id: number; chr: string; pos: number } } = {};\n let prevEndPosition = 0;\n\n Object.keys(computeChromSizes(this.assembly).size).forEach((chrStr, i) => {\n const positionInfo = {\n id: i,\n chr: chrStr,\n pos: prevEndPosition\n };\n\n chromosomeCumPositions.push(positionInfo);\n chromosomePositions[chrStr] = positionInfo;\n\n prevEndPosition += computeChromSizes(this.assembly).size[chrStr];\n });\n this.chromSizes = {\n chrToAbs: (chrom: string, chromPos: number) => this.chromSizes.chrPositions[chrom].pos + chromPos,\n cumPositions: chromosomeCumPositions,\n chrPositions: chromosomePositions,\n totalLength: prevEndPosition,\n chromLengths: chromosomeSizes\n };\n\n const { chromosomeField, genomicFields, genomicFieldsToConvert } = this.dataConfig;\n this.values = dataConfig.values.map((row: any) => {\n try {\n if (genomicFieldsToConvert) {\n // This spec is used when multiple chromosomes are stored in a single row\n genomicFieldsToConvert.forEach(chromMap => {\n const genomicFields = chromMap.genomicFields;\n const chromName = sanitizeChrName(row[chromMap.chromosomeField], this.assembly) as string;\n\n genomicFields.forEach((positionCol: string) => {\n const chromPosition = row[positionCol] as string;\n row[positionCol] = String(this.chromSizes.chrToAbs(chromName, chromPosition));\n });\n });\n } else if (chromosomeField && genomicFields) {\n genomicFields.forEach((positionCol: string) => {\n const chromPosition = row[positionCol] as string;\n const chromName = sanitizeChrName(row[chromosomeField], this.assembly) as string;\n row[positionCol] = String(this.chromSizes.chrToAbs(chromName, chromPosition));\n });\n }\n return row;\n } catch {\n // skip the rows that had errors in them\n return undefined;\n }\n });\n }\n\n tilesetInfo(callback?: any) {\n this.tilesetInfoLoading = false;\n\n const TILE_SIZE = 1024;\n const totalLength = this.chromSizes.totalLength;\n const retVal = {\n tile_size: TILE_SIZE,\n max_zoom: Math.ceil(Math.log(totalLength / TILE_SIZE) / Math.log(2)),\n max_width: totalLength,\n min_pos: [0, 0],\n max_pos: [totalLength, totalLength]\n };\n\n if (callback) {\n callback(retVal);\n }\n\n return retVal;\n }\n\n fetchTilesDebounced(receivedTiles: any, tileIds: any) {\n const tiles: { [k: string]: any } = {};\n\n const validTileIds: any[] = [];\n const tilePromises = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n const y = parseInt(parts[2], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('[Gosling Data Fetcher] Invalid tile zoom or position:', z, x, y);\n continue;\n }\n\n validTileIds.push(tileId);\n tilePromises.push(this.tile(z, x, y));\n }\n\n Promise.all(tilePromises).then(values => {\n values.forEach((value, i) => {\n const validTileId = validTileIds[i];\n tiles[validTileId] = value;\n tiles[validTileId].tilePositionId = validTileId;\n });\n receivedTiles(tiles);\n });\n\n return tiles;\n }\n\n tile(z: any, x: any, y: any) {\n const tsInfo = this.tilesetInfo();\n const tileWidth = +tsInfo.max_width / 2 ** +z;\n\n // get the bounds of the tile\n const minX = tsInfo.min_pos[0] + x * tileWidth;\n const maxX = tsInfo.min_pos[0] + (x + 1) * tileWidth;\n\n // filter the data so that visible data is sent to tracks\n let tabularData = filterUsingGenoPos(this.values, [minX, maxX], this.dataConfig);\n\n // sample the data to make it managable for visualization components\n const sizeLimit = this.dataConfig.sampleLength ?? 1000;\n if (sizeLimit < tabularData.length) {\n // TODO: allow to provide sampling method which incorporates order of JSON array (similar to tabularData.slice(0, sizeLimit))\n tabularData =\n this.dataConfig.sampleType === 'first'\n ? tabularData.slice(0, sizeLimit)\n : sampleSize(tabularData, sizeLimit);\n }\n\n return {\n tabularData,\n server: null,\n tilePos: [x, y],\n zoomLevel: z\n };\n }\n }\n\n return new JsonDataFetcherClass(args);\n}\n\nJsonDataFetcher.config = {\n type: 'json'\n};\n\nexport default JsonDataFetcher;\n","/*\n * The GFF data fetcher is based heavily on the BED and VCF data fetchers\n */\nimport { spawn } from 'threads';\nimport Worker from './gff-worker.ts?worker&inline';\n\nimport { computeChromSizes } from '../../core/utils/assembly';\n\nimport type { ModuleThread } from 'threads';\nimport type { Assembly, GffData } from '@gosling-lang/gosling-schema';\nimport type { WorkerApi, TilesetInfo, GffTile, EmptyTile } from './gff-worker';\nimport type { TabularDataFetcher } from '../utils';\n\nconst DEBOUNCE_TIME = 200;\n\nexport type GFFDataConfig = GffData & { assembly: Assembly };\n\nclass GffDataFetcher implements TabularDataFetcher {\n static config = { type: 'gff' };\n dataConfig = {}; // required for higlass\n uid: string;\n prevRequestTime: number;\n track?: any;\n\n private toFetch: Set;\n private fetchTimeout?: ReturnType;\n private worker: Promise>;\n\n constructor(HGC: import('@higlass/types').HGC, config: GFFDataConfig) {\n this.uid = HGC.libraries.slugid.nice();\n this.prevRequestTime = 0;\n this.toFetch = new Set();\n const { url, indexUrl, assembly, ...options } = config;\n this.worker = spawn(new Worker()).then(async worker => {\n const chromSizes = Object.entries(computeChromSizes(assembly).size);\n await worker.init(this.uid, { url, indexUrl }, chromSizes, options);\n return worker;\n });\n }\n\n /*\n * Collect Tileset Information, such as tile size and genomic positions\n */\n async tilesetInfo(callback: (info: TilesetInfo) => void) {\n (await this.worker).tilesetInfo(this.uid).then(callback);\n }\n\n fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n this.track.drawLoadingCue();\n\n tileIds.forEach(tileId => this.toFetch.add(tileId));\n\n if (this.fetchTimeout) {\n clearTimeout(this.fetchTimeout);\n }\n\n this.fetchTimeout = setTimeout(() => {\n this.sendFetch(receivedTiles, [...this.toFetch]);\n this.toFetch.clear();\n }, DEBOUNCE_TIME);\n }\n\n async sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles);\n }\n\n async getTabularData(tileIds: string[]): Promise {\n const buf = await (await this.worker).getTabularData(this.uid, tileIds);\n const parsed = JSON.parse(new TextDecoder().decode(buf));\n return parsed;\n }\n}\n\nexport default GffDataFetcher;\n","/*\n * This document is heavily based on the following repo by @alexander-veit:\n * https://github.com/dbmi-bgm/higlass-sv/blob/main/src/sv-fetcher.js\n */\nimport { spawn } from 'threads';\nimport Worker from './bed-worker.ts?worker&inline';\n\nimport { computeChromSizes } from '../../core/utils/assembly';\n\nimport type { ModuleThread } from 'threads';\nimport type { Assembly, BedData } from '@gosling-lang/gosling-schema';\nimport type { WorkerApi, TilesetInfo } from './bed-worker';\nimport type { BedTile, EmptyTile } from './bed-worker';\nimport type { TabularDataFetcher } from '../utils';\n\nconst DEBOUNCE_TIME = 200;\n\nexport type BedDataConfig = BedData & { assembly: Assembly };\n\nclass BedDataFetcher implements TabularDataFetcher {\n static config = { type: 'bed' };\n dataConfig = {}; // required for higlass\n uid: string;\n prevRequestTime: number;\n track?: any;\n\n private toFetch: Set;\n private fetchTimeout?: ReturnType;\n private worker: Promise>;\n\n constructor(HGC: import('@higlass/types').HGC, config: BedDataConfig) {\n this.uid = HGC.libraries.slugid.nice();\n this.prevRequestTime = 0;\n this.toFetch = new Set();\n const { url, indexUrl, assembly, ...options } = config;\n this.worker = spawn(new Worker()).then(async worker => {\n const chromSizes = Object.entries(computeChromSizes(assembly).size);\n await worker.init(this.uid, { url, indexUrl }, chromSizes, options);\n return worker;\n });\n }\n\n /*\n * Collect Tileset Information, such as tile size and genomic positions\n */\n async tilesetInfo(callback: (info: TilesetInfo) => void) {\n (await this.worker).tilesetInfo(this.uid).then(callback);\n }\n\n fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n this.track.drawLoadingCue();\n\n tileIds.forEach(tileId => this.toFetch.add(tileId));\n\n if (this.fetchTimeout) {\n clearTimeout(this.fetchTimeout);\n }\n\n this.fetchTimeout = setTimeout(() => {\n this.sendFetch(receivedTiles, [...this.toFetch]);\n this.toFetch.clear();\n }, DEBOUNCE_TIME);\n }\n\n async sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles);\n }\n /**\n * Called by GoslingTrack. This is how the track gets data\n * @param tileIds The position of the tile\n * @returns A promise to the BedTiles\n */\n async getTabularData(tileIds: string[]): Promise {\n const buf = await (await this.worker).getTabularData(this.uid, tileIds);\n const parsed = JSON.parse(new TextDecoder().decode(buf));\n return parsed;\n }\n}\n\nexport default BedDataFetcher;\n","import type { SparseTile, TileData } from '@higlass/services';\nimport type { Datum, SingleTrack } from '@gosling-lang/gosling-schema';\nimport { IsDataDeepTileset } from '@gosling-lang/gosling-schema';\n\nexport const GOSLING_DATA_ROW_UID_FIELD = 'gosling-data-row-uid';\n\n/**\n * Convert genomic data formats to common tabular formats for given tile.\n */\nexport function getTabularData(\n spec: SingleTrack,\n data: TileData & {\n sparse?: Array;\n shape?: [number, number];\n tileX: number;\n tileWidth: number;\n tileSize: number;\n tileY?: number; // used for matrix\n tileHeight?: number; // used for matrix\n }\n) {\n const tabularData: Datum[] = [];\n\n if (!IsDataDeepTileset(spec.data)) {\n console.warn('No data is specified');\n return;\n }\n\n if (spec.data.type === 'vector' || spec.data.type === 'bigwig') {\n if (!('dense' in data)) {\n // we did not get sufficient data.\n return;\n }\n\n const bin = spec.data.binSize ?? 1;\n\n const numericValues = data.dense;\n const numOfGenomicPositions = data.tileSize;\n const tileUnitSize = data.tileWidth / data.tileSize;\n\n const valueName = spec.data.value ?? 'value';\n const columnName = spec.data.column ?? 'position';\n const startName = spec.data.start ?? 'start';\n const endName = spec.data.end ?? 'end';\n\n // additional columns with different aggregation functions\n const minValueName = `${valueName}_min`;\n const maxValueName = `${valueName}_max`;\n\n // user's aggregation function\n const agg = spec.data.aggregation ?? 'mean';\n\n // convert data to a visualization-friendly format\n let cumVal = 0;\n let minVal = Number.MAX_SAFE_INTEGER;\n let maxVal = Number.MIN_SAFE_INTEGER;\n let binStart = Number.MIN_SAFE_INTEGER;\n let binEnd = Number.MAX_SAFE_INTEGER;\n Array.from(Array(numOfGenomicPositions).keys()).forEach((g: number, j: number) => {\n // add individual rows\n if (bin === 1) {\n const value = numericValues[j] / (agg === 'mean' ? tileUnitSize : 1);\n tabularData.push({\n [valueName]: value,\n [columnName]: data.tileX + (j + 0.5) * tileUnitSize,\n [startName]: data.tileX + j * tileUnitSize,\n [endName]: data.tileX + (j + 1) * tileUnitSize,\n [minValueName]: value,\n [maxValueName]: value\n });\n } else {\n // bin the data considering the `binSize` option\n if (j % bin === 0) {\n // Start storing information for this bin\n cumVal = minVal = maxVal = numericValues[j];\n binStart = j;\n binEnd = j + bin;\n } else if (j % bin === bin - 1) {\n // Add a row using the cumulative value\n tabularData.push({\n [valueName]: cumVal / bin / (agg === 'mean' ? tileUnitSize : 1),\n [columnName]: data.tileX + (binStart + bin / 2.0) * tileUnitSize,\n [startName]: data.tileX + binStart * tileUnitSize,\n [endName]: data.tileX + binEnd * tileUnitSize,\n [minValueName]: minVal,\n [maxValueName]: maxVal\n });\n } else if (j === numOfGenomicPositions - 1) {\n // Manage the remainders. Just add them as a single row.\n const smallBin = numOfGenomicPositions % bin;\n const correctedBinEnd = binStart + smallBin;\n tabularData.push({\n [valueName]: cumVal / smallBin / (agg === 'mean' ? tileUnitSize : 1),\n [columnName]: data.tileX + (binStart + smallBin / 2.0) * tileUnitSize,\n [startName]: data.tileX + binStart * tileUnitSize,\n [endName]: data.tileX + correctedBinEnd * tileUnitSize,\n [minValueName]: minVal,\n [maxValueName]: maxVal\n });\n } else {\n // Add a current value\n cumVal += numericValues[j];\n if (minVal > numericValues[j]) minVal = numericValues[j];\n if (maxVal < numericValues[j]) maxVal = numericValues[j];\n }\n }\n });\n } else if (spec.data.type === 'multivec') {\n if (!('dense' in data) || data.shape === undefined) {\n // we did not get sufficient data.\n return;\n }\n\n const bin = spec.data.binSize ?? 1;\n\n const numOfTotalCategories = data.shape[0];\n const categories: any = spec.data.categories ?? [...Array(numOfTotalCategories).keys()];\n const numericValues = data.dense;\n const numOfGenomicPositions = data.shape[1];\n const tileUnitSize = data.tileWidth / data.tileSize;\n\n const rowName = spec.data.row ?? 'category';\n const valueName = spec.data.value ?? 'value';\n const columnName = spec.data.column ?? 'position';\n const startName = spec.data.start ?? 'start';\n const endName = spec.data.end ?? 'end';\n\n // additional columns with different aggregation functions\n const minValueName = `${valueName}_min`;\n const maxValueName = `${valueName}_max`;\n\n // user's aggregation function\n const agg = spec.data.aggregation ?? 'mean';\n\n // convert data to a visualization-friendly format\n categories.forEach((c: string, i: number) => {\n let cumVal = 0;\n let binStart = Number.MIN_SAFE_INTEGER;\n let binEnd = Number.MAX_SAFE_INTEGER;\n let minVal = Number.MAX_SAFE_INTEGER;\n let maxVal = Number.MIN_SAFE_INTEGER;\n Array.from(Array(numOfGenomicPositions).keys()).forEach((g: number, j: number) => {\n // add individual rows\n if (bin === 1) {\n const value = numericValues[numOfGenomicPositions * i + j] / (agg === 'mean' ? tileUnitSize : 1);\n tabularData.push({\n [rowName]: c,\n [valueName]: value,\n [columnName]: data.tileX + (j + 0.5) * tileUnitSize,\n [startName]: data.tileX + j * tileUnitSize,\n [endName]: data.tileX + (j + 1) * tileUnitSize,\n [minValueName]: value,\n [maxValueName]: value\n });\n } else {\n if (j % bin === 0) {\n // Start storing information for this bin\n cumVal = minVal = maxVal = numericValues[numOfGenomicPositions * i + j];\n binStart = j;\n binEnd = j + bin;\n } else if (j % bin === bin - 1) {\n // Add a row using the cumulative value\n\n tabularData.push({\n [rowName]: c,\n [valueName]: agg === 'mean' ? cumVal / bin / tileUnitSize : cumVal,\n [columnName]: data.tileX + (binStart + bin / 2.0) * tileUnitSize,\n [startName]: data.tileX + binStart * tileUnitSize,\n [endName]: data.tileX + binEnd * tileUnitSize,\n [minValueName]: minVal,\n [maxValueName]: maxVal\n });\n } else if (j === numOfGenomicPositions - 1) {\n // Manage the remainders. Just add them as a single row.\n const smallBin = numOfGenomicPositions % bin;\n const correctedBinEnd = binStart + smallBin;\n tabularData.push({\n [rowName]: c,\n [valueName]: agg === 'mean' ? cumVal / smallBin / tileUnitSize : cumVal,\n [columnName]: data.tileX + (binStart + smallBin / 2.0) * tileUnitSize,\n [startName]: data.tileX + binStart * tileUnitSize,\n [endName]: data.tileX + correctedBinEnd * tileUnitSize,\n [minValueName]: minVal,\n [maxValueName]: maxVal\n });\n } else {\n // Add a current value\n const value = numericValues[numOfGenomicPositions * i + j];\n cumVal += value;\n if (minVal > value) minVal = value;\n if (maxVal < value) maxVal = value;\n }\n }\n });\n });\n } else if (spec.data.type === 'matrix') {\n if (!('dense' in data) || typeof data.tileY === 'undefined' || typeof data.tileHeight === 'undefined') {\n // we do not have sufficient data.\n return;\n }\n\n // width and height of the tile\n const numBins = Math.sqrt(data.dense.length);\n\n const { tileX, tileY, tileWidth, tileHeight } = data;\n const numericValues = data.dense;\n\n const tileXUnitSize = tileWidth / numBins;\n const tileYUnitSize = tileHeight / numBins;\n const columnField = spec.data.column ?? 'x';\n const rowField = spec.data.row ?? 'y';\n\n // TODO: a way to improve rendering performance?\n // For the rendering performance, we aggregate cells so that we draw smaller number of marks.\n const aggSize = 16; // assuming that # of cells can be divided by binSize, which is mostly 256 or 1024\n for (let i = 0; i < numericValues.length / aggSize; i++) {\n const aggLen = Math.sqrt(aggSize);\n const xIndex = (i * aggLen) % numBins;\n const yIndex = Math.floor((i * aggLen) / numBins) * aggLen;\n\n // Being xIndex and yIndex the top-let origin, aggregate 4 x 4 cells\n let value = NaN;\n for (let c = 0; c < aggLen; c++) {\n for (let r = 0; r < aggLen; r++) {\n const curVal = numericValues[(yIndex + r) * numBins + (xIndex + c)];\n // If the current value is NaN, we do not need to do anything\n if (!isNaN(+curVal)) {\n // If the cumulative value is still NaN, which is the default value,\n // set that to zero so that we are able to add a value\n if (isNaN(value)) {\n value = 0;\n }\n value += curVal;\n }\n }\n }\n\n if (isNaN(value)) {\n // this means all values for this bin is NaN, hence a missing value\n continue;\n }\n\n const xs = tileX + xIndex * tileXUnitSize;\n const xe = tileX + (xIndex + aggLen) * tileXUnitSize;\n const ys = tileY + yIndex * tileYUnitSize;\n const ye = tileY + (yIndex + aggLen) * tileYUnitSize;\n const x = (xs + xe) / 2.0;\n const y = (ys + ye) / 2.0;\n tabularData.push({\n value,\n [columnField]: x,\n [`${columnField}s`]: xs,\n [`${columnField}e`]: xe,\n [rowField]: y,\n [`${rowField}s`]: ys,\n [`${rowField}e`]: ye\n });\n }\n } else if (spec.data.type === 'beddb') {\n if (!data.sparse) {\n // we did not get sufficient data.\n return;\n }\n\n const { genomicFields, exonIntervalFields, valueFields } = spec.data;\n\n data.sparse.forEach((d, i) => {\n const { chrOffset, fields } = d;\n\n const datum: { [k: string]: number | string } = {};\n\n datum[GOSLING_DATA_ROW_UID_FIELD] = `${i}`;\n\n genomicFields.forEach(g => {\n datum[g.name] = +fields[g.index] + chrOffset;\n });\n\n // values\n valueFields?.forEach(v => {\n datum[v.name] = v.type === 'quantitative' ? +fields[v.index] : fields[v.index];\n });\n\n tabularData.push({\n ...datum,\n type: 'gene' // this should be described in the spec\n });\n\n if (exonIntervalFields) {\n const [exonStartField, exonEndField] = exonIntervalFields;\n const exonStartStrs = (fields[exonStartField.index] as string).split(',');\n const exonEndStrs = (fields[exonEndField.index] as string).split(',');\n\n exonStartStrs.forEach((es, i) => {\n const ee = exonEndStrs[i];\n\n // exon\n tabularData.push({\n ...datum,\n [exonStartField.name]: +es + chrOffset,\n [exonEndField.name]: +ee + chrOffset,\n type: 'exon'\n });\n\n // intron\n if (i + 1 < exonStartStrs.length) {\n const nextEs = exonStartStrs[i + 1];\n tabularData.push({\n ...datum,\n [exonStartField.name]: +ee + chrOffset,\n [exonEndField.name]: +nextEs + chrOffset,\n type: 'intron'\n });\n }\n });\n }\n });\n }\n\n /// DEBUG\n // console.log(tabularData);\n\n return tabularData;\n}\n","import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Assembly, Domain } from '@gosling-lang/gosling-schema';\nimport { SUPPORTED_CHANNELS } from '../mark';\nimport { IsDomainChr, IsDomainInterval, IsDomainChrInterval, IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport { computeChromSizes } from './assembly';\n\n/**\n * Get a numeric domain based on a domain specification.\n * For example, domain: { chromosome: 'chr1', interval: [1, 300,000] } => domain: [1, 300,000]\n */\nexport function getNumericDomain(domain: Domain, assembly?: Assembly) {\n const chromInterval = computeChromSizes(assembly).interval;\n if ('chromosome' in domain) {\n const isThereChr = Object.keys(chromInterval).find(chr => chr === domain.chromosome);\n if (!isThereChr) {\n // Did not find the chromosome, so return early.\n return;\n }\n }\n if (IsDomainChr(domain)) {\n return [chromInterval[domain.chromosome][0] + 1, chromInterval[domain.chromosome][1]];\n } else if (IsDomainInterval(domain)) {\n return domain.interval;\n } else if (IsDomainChrInterval(domain)) {\n const chrStart = chromInterval[domain.chromosome][0];\n const [start, end] = domain.interval;\n return [chrStart + start, chrStart + end];\n }\n}\n\n// TODO: IMPORTANT: when panning the tiles, the extent only becomes larger\n/**\n * Use a shared scale (i.e., `domain`) across multiple gosling tracks.\n */\nexport function shareScaleAcrossTracks(trackModels: GoslingTrackModel[], force?: boolean) {\n // we update the spec with a global domain\n const globalDomain: { [k: string]: number[] | string[] } = {};\n const channelKeys = SUPPORTED_CHANNELS;\n\n // generate global domains\n trackModels.forEach(model => {\n channelKeys.forEach(channelKey => {\n const channel = model.spec()[channelKey];\n if (!IsChannelDeep(channel) || channel.domain === undefined) {\n return;\n }\n\n const { domain, type } = channel;\n\n if (type === 'quantitative') {\n const numericDomain: number[] = Array.from(domain as number[]);\n if (!globalDomain[channelKey]) {\n globalDomain[channelKey] = numericDomain;\n } else {\n const channelGlobalDomain = globalDomain[channelKey] as number[];\n\n if (channelGlobalDomain[0] > numericDomain[0]) {\n // min\n channelGlobalDomain[0] = numericDomain[0];\n }\n if (channelGlobalDomain[1] < numericDomain[1]) {\n // max\n channelGlobalDomain[1] = numericDomain[1];\n }\n }\n } else if (type === 'nominal') {\n const nominalDomain: string[] = Array.from(domain as string[]);\n if (!globalDomain[channelKey]) {\n globalDomain[channelKey] = nominalDomain;\n } else {\n globalDomain[channelKey] = Array.from(\n new Set([...globalDomain[channelKey], ...nominalDomain])\n ) as string[];\n }\n }\n });\n });\n\n // replace the domain and update scales\n trackModels.forEach(model => {\n channelKeys.forEach(channelKey => {\n const channel = model.spec()[channelKey];\n if (IsChannelDeep(channel) && channel.type === 'genomic') return;\n model.setChannelDomain(channelKey, globalDomain[channelKey], force);\n model.generateScales();\n });\n\n // update constant default values using the updated scales\n model.updateChannelValue();\n });\n}\n","const example = {\n compactLayout: false,\n trackSourceServers: ['https://server.gosling-lang.org/api/v1/'],\n views: [\n {\n genomePositionSearchBoxVisible: false,\n genomePositionSearchBox: {\n autocompleteServer: 'https://higlass.io/api/v1',\n autocompleteId: 'P0PLbQMwTYGy-5uPIQid7A',\n chromInfoServer: 'https://higlass.io/api/v1',\n chromInfoId: 'hg38'\n },\n layout: { x: 0, y: 0, w: 6.4, h: 600 },\n tracks: {\n top: [],\n left: [\n {\n type: 'combined',\n width: 130,\n height: 600,\n contents: [\n {\n type: 'gosling-track',\n server: 'https://server.gosling-lang.org/api/v1/',\n tilesetUid: 'cistrome-multivec',\n width: 130,\n height: 600,\n options: {\n showMousePosition: true,\n mousePositionColor: '#000000',\n fontSize: 24,\n labelPosition: 'none',\n labelShowResolution: false,\n labelColor: 'black',\n labelBackgroundColor: 'white',\n labelTextOpacity: 1,\n labelLeftMargin: 1,\n labelTopMargin: 1,\n labelRightMargin: 0,\n labelBottomMargin: 0,\n backgroundColor: 'transparent',\n spec: {\n spacing: 10,\n orientation: 'vertical',\n assembly: 'hg38',\n layout: 'linear',\n static: false,\n xDomain: { interval: [0, 1000000000] },\n centerRadius: 0.3,\n xOffset: 0,\n yOffset: 0,\n style: { outlineWidth: 0.5 },\n data: {\n url: 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec',\n type: 'multivec',\n row: 'sample',\n column: 'position',\n value: 'peak',\n categories: ['sample 1', 'sample 2', 'sample 3', 'sample 4'],\n binSize: 4\n },\n mark: 'rect',\n x: {\n field: 'start',\n type: 'genomic',\n axis: 'left',\n domain: { interval: [0, 1000000000] },\n linkingId: '7f94b74e-25ec-4e67-8c75-3dc0f1b0d6bd'\n },\n xe: { field: 'end', type: 'genomic' },\n row: {\n field: 'sample',\n type: 'nominal',\n legend: true\n },\n color: {\n field: 'peak',\n type: 'quantitative',\n legend: true\n },\n tooltip: [\n {\n field: 'start',\n type: 'genomic',\n alt: 'Start Position'\n },\n {\n field: 'end',\n type: 'genomic',\n alt: 'End Position'\n },\n {\n field: 'peak',\n type: 'quantitative',\n alt: 'Value',\n format: '.2'\n },\n { field: 'sample', type: 'nominal', alt: 'Sample' }\n ],\n width: 160,\n height: 600,\n overlayOnPreviousTrack: false\n },\n theme: {\n base: 'light',\n root: {\n background: 'white',\n titleColor: 'black',\n titleBackgroundColor: 'transparent',\n titleFontSize: 18,\n titleFontFamily: 'Arial',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n subtitleColor: 'gray',\n subtitleBackgroundColor: 'transparent',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleFontWeight: 'normal',\n subtitleAlign: 'left',\n mousePositionColor: '#000000'\n },\n track: {\n background: 'transparent',\n alternatingBackground: 'transparent',\n titleColor: 'black',\n titleBackground: 'white',\n titleFontSize: 24,\n titleAlign: 'left',\n outline: 'black',\n outlineWidth: 1\n },\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: '#DBDBDB',\n tickColor: 'black'\n },\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n baselineColor: 'black',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1,\n gridStrokeType: 'solid',\n gridStrokeDash: [4, 4]\n },\n markCommon: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n point: {\n color: '#E79F00',\n size: 3,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rect: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n triangle: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n area: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n line: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n bar: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rule: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n link: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n text: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6],\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n color: 'gray',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 0.3,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n }\n }\n }\n }\n ]\n },\n {\n uid: '15483511-f6fb-11eb-914b-976b6ecda162',\n type: 'axis-track',\n chromInfoPath: 'https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes',\n options: {\n layout: 'linear',\n outerRadius: null,\n width: 160,\n height: 600,\n theme: {\n base: 'light',\n root: {\n background: 'white',\n titleColor: 'black',\n titleBackgroundColor: 'transparent',\n titleFontSize: 18,\n titleFontFamily: 'Arial',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n subtitleColor: 'gray',\n subtitleBackgroundColor: 'transparent',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleFontWeight: 'normal',\n subtitleAlign: 'left',\n mousePositionColor: '#000000'\n },\n track: {\n background: 'transparent',\n alternatingBackground: 'transparent',\n titleColor: 'black',\n titleBackground: 'white',\n titleFontSize: 24,\n titleAlign: 'left',\n outline: 'black',\n outlineWidth: 1\n },\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: '#DBDBDB',\n tickColor: 'black'\n },\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n baselineColor: 'black',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1,\n gridStrokeType: 'solid',\n gridStrokeDash: [4, 4]\n },\n markCommon: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n point: {\n color: '#E79F00',\n size: 3,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rect: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n triangle: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n area: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n line: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n bar: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rule: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n link: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n text: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6],\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n color: 'gray',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 0.3,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n }\n },\n assembly: 'hg38',\n stroke: 'transparent',\n color: 'black',\n fontSize: 12,\n fontFamily: 'Arial',\n fontWeight: 'normal',\n tickColor: 'black',\n tickFormat: 'plain',\n tickPositions: 'even',\n reverseOrientation: false\n },\n width: 30\n }\n ],\n center: [],\n right: [],\n bottom: [],\n gallery: [],\n whole: []\n },\n initialXDomain: [0, 1000000000],\n initialYDomain: [0, 1000000000],\n zoomFixed: false,\n zoomLimits: [1, null],\n uid: '15483510-f6fb-11eb-914b-976b6ecda162',\n chromInfoPath: 'https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes'\n },\n {\n genomePositionSearchBoxVisible: false,\n genomePositionSearchBox: {\n autocompleteServer: 'https://higlass.io/api/v1',\n autocompleteId: 'P0PLbQMwTYGy-5uPIQid7A',\n chromInfoServer: 'https://higlass.io/api/v1',\n chromInfoId: 'hg38'\n },\n layout: { x: 6.8, y: 0, w: 5.2, h: 600 },\n tracks: {\n top: [],\n left: [\n {\n type: 'combined',\n width: 130,\n height: 600,\n contents: [\n {\n type: 'gosling-track',\n server: 'https://server.gosling-lang.org/api/v1/',\n tilesetUid: 'cistrome-multivec',\n width: 130,\n height: 600,\n options: {\n showMousePosition: true,\n mousePositionColor: '#000000',\n fontSize: 24,\n labelPosition: 'none',\n labelShowResolution: false,\n labelColor: 'black',\n labelBackgroundColor: 'white',\n labelTextOpacity: 1,\n labelLeftMargin: 1,\n labelTopMargin: 1,\n labelRightMargin: 0,\n labelBottomMargin: 0,\n backgroundColor: 'transparent',\n spec: {\n spacing: 10,\n orientation: 'vertical',\n assembly: 'hg38',\n layout: 'linear',\n static: false,\n xDomain: { interval: [0, 1000000000] },\n centerRadius: 0.3,\n xOffset: 0,\n yOffset: 0,\n style: { outlineWidth: 0.5 },\n data: {\n url: 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec',\n type: 'multivec',\n row: 'sample',\n column: 'position',\n value: 'peak',\n categories: ['sample 1', 'sample 2', 'sample 3', 'sample 4'],\n binSize: 4\n },\n mark: 'rect',\n x: {\n field: 'start',\n type: 'genomic',\n domain: { interval: [0, 1000000000] },\n linkingId: '7f94b74e-25ec-4e67-8c75-3dc0f1b0d6bd'\n },\n xe: { field: 'end', type: 'genomic' },\n row: {\n field: 'sample',\n type: 'nominal',\n legend: true\n },\n color: {\n field: 'peak',\n type: 'quantitative',\n legend: true\n },\n tooltip: [\n {\n field: 'start',\n type: 'genomic',\n alt: 'Start Position'\n },\n {\n field: 'end',\n type: 'genomic',\n alt: 'End Position'\n },\n {\n field: 'peak',\n type: 'quantitative',\n alt: 'Value',\n format: '.2'\n },\n { field: 'sample', type: 'nominal', alt: 'Sample' }\n ],\n width: 130,\n height: 600\n },\n theme: {\n base: 'light',\n root: {\n background: 'white',\n titleColor: 'black',\n titleBackgroundColor: 'transparent',\n titleFontSize: 18,\n titleFontFamily: 'Arial',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n subtitleColor: 'gray',\n subtitleBackgroundColor: 'transparent',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleFontWeight: 'normal',\n subtitleAlign: 'left',\n mousePositionColor: '#000000'\n },\n track: {\n background: 'transparent',\n alternatingBackground: 'transparent',\n titleColor: 'black',\n titleBackground: 'white',\n titleFontSize: 24,\n titleAlign: 'left',\n outline: 'black',\n outlineWidth: 1\n },\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: '#DBDBDB',\n tickColor: 'black'\n },\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n baselineColor: 'black',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1,\n gridStrokeType: 'solid',\n gridStrokeDash: [4, 4]\n },\n markCommon: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n point: {\n color: '#E79F00',\n size: 3,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rect: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n triangle: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n area: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n line: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n bar: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rule: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n link: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n text: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6],\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n color: 'gray',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 0.3,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n }\n }\n }\n }\n ]\n }\n ],\n center: [],\n right: [],\n bottom: [],\n gallery: [],\n whole: []\n },\n initialXDomain: [0, 1000000000],\n initialYDomain: [0, 1000000000],\n zoomFixed: false,\n zoomLimits: [1, null],\n uid: '154b1b40-f6fb-11eb-914b-976b6ecda162'\n }\n ],\n zoomLocks: { locksByViewUid: {}, locksDict: {} },\n locationLocks: { locksByViewUid: {}, locksDict: {} },\n editable: false,\n chromInfoPath: 'https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes'\n};\n\nexport default example;\n","import type { HiGlassSpec, Track } from '@gosling-lang/higlass-schema';\nimport { HiGlassSchema } from '@gosling-lang/higlass-schema';\nimport type { Assembly, AxisPosition, Domain, DummyTrack, Orientation, ZoomLimits } from '@gosling-lang/gosling-schema';\nimport { getNumericDomain } from '../core/utils/scales';\nimport type { RelativePosition } from './bounding-box';\nimport { validateSpec } from '@gosling-lang/gosling-schema';\nimport { getAutoCompleteId, computeChromSizes } from '../core/utils/assembly';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\nimport exampleHg from '../core/example/hg-view-config-1';\nimport { insertItemToArray } from '../core/utils/array';\nimport { uuid } from '../core/utils/uuid';\n\nexport const HIGLASS_AXIS_SIZE = 30;\n\nconst getViewTemplate = (assembly?: Assembly) => {\n return {\n genomePositionSearchBoxVisible: false,\n genomePositionSearchBox: {\n autocompleteServer: 'https://higlass.io/api/v1',\n autocompleteId: getAutoCompleteId(assembly),\n chromInfoServer: 'https://higlass.io/api/v1',\n chromInfoId: assembly ?? 'hg38'\n },\n layout: { w: 12, h: 12, x: 0, y: 0 },\n tracks: {\n top: [],\n left: [],\n center: [],\n right: [],\n bottom: [],\n gallery: [],\n whole: []\n },\n initialXDomain: [0, computeChromSizes(assembly).total],\n initialYDomain: [0, computeChromSizes(assembly).total],\n zoomFixed: false\n };\n};\n\n/**\n * Model for managing the HiGlass view config.\n * We are currently only using a center track with additional tracks for axes in a single view.\n */\nexport class HiGlassModel {\n private assembly?: Assembly;\n private orientation?: Orientation;\n private hg: HiGlassSpec;\n constructor() {\n this.assembly = 'hg38';\n this.hg = {\n compactLayout: false,\n trackSourceServers: [],\n views: [],\n zoomLocks: {\n locksByViewUid: {},\n locksDict: {}\n },\n locationLocks: {\n locksByViewUid: {},\n locksDict: {}\n }\n };\n\n // Add default specs.\n this.setEditable(false);\n }\n\n public spec(): Readonly {\n return this.hg;\n }\n\n public setViewOrientation(orientation?: Orientation) {\n this.orientation = orientation;\n return this;\n }\n\n public addDefaultView(uid: string, assembly?: Assembly) {\n this.hg.views.push(JSON.parse(JSON.stringify({ ...getViewTemplate(assembly), uid })));\n return this;\n }\n\n public setAssembly(assembly?: Assembly) {\n this.assembly = assembly;\n this.setChromInfoPath(computeChromSizes(this.assembly).path);\n return this;\n }\n\n public getAssembly() {\n return this.assembly;\n }\n\n public setTextTrack(\n width: number,\n height: number,\n text: string,\n textColor = 'black',\n fontSize = 14,\n fontWeight = 'normal',\n align = 'left',\n backgroundColor = 'transparent',\n fontFamily = 'Arial'\n ) {\n if (this.getLastView()) {\n this.getLastView().tracks.top?.push({\n type: 'text',\n width,\n height,\n options: {\n backgroundColor,\n textColor,\n fontSize,\n fontWeight,\n fontFamily,\n offsetY: 0, // offset from the top of the track\n align,\n text\n }\n });\n }\n return this;\n }\n\n /**\n * Add a dummy track to the last view\n * @param track\n */\n public setDummyTrack(track: DummyTrack) {\n if (this.getLastView()) {\n this.getLastView().tracks.top?.push({\n type: 'dummy-track',\n width: track.width,\n height: track.height,\n options: {\n width: track.width,\n height: track.height,\n title: track.title,\n ...track.style\n }\n });\n }\n return this;\n }\n\n public addBrush(\n layout: 'circular' | 'linear',\n viewId: string,\n theme: Required,\n fromViewUid?: string,\n style?: {\n color?: string;\n stroke?: string;\n opacity?: string;\n strokeWidth?: number;\n startAngle?: number;\n endAngle?: number;\n innerRadius?: number;\n outerRadius?: number;\n }\n ) {\n if (!fromViewUid) return;\n\n // we could do this to either a `whole` track or a `center` track with `combined`\n (this.getView(viewId) as any)?.tracks.whole.push({\n // type: 'viewport-projection-center',\n type: layout === 'circular' ? 'brush-track' : 'viewport-projection-horizontal',\n uid: uuid(),\n fromViewUid,\n options: {\n projectionFillColor: style?.color ?? theme.brush.color,\n projectionStrokeColor: style?.stroke ?? theme.brush.stroke,\n projectionFillOpacity: style?.opacity ?? theme.brush.opacity,\n projectionStrokeOpacity: style?.opacity ?? theme.brush.opacity,\n strokeWidth: style?.strokeWidth ?? theme.brush.strokeWidth,\n startAngle: style?.startAngle,\n endAngle: style?.endAngle,\n innerRadius: style?.innerRadius,\n outerRadius: style?.outerRadius\n }\n });\n return this;\n }\n\n public getLastView() {\n return this.hg.views[this.hg.views.length - 1];\n }\n\n public getMainTrackPosition() {\n return this.orientation === 'vertical' ? 'left' : 'center';\n }\n\n /**\n * Get the last view that renders any visualization, so skiping empty tracks.\n */\n public getLastVisView() {\n const vs = this.hg.views.filter(v => (v.tracks as any)[this.getMainTrackPosition()]?.[0]?.type === 'combined');\n return vs[vs.length - 1];\n }\n\n public getView(viewId: string) {\n return this.hg.views.find(d => d.uid === viewId);\n }\n\n public validateSpec(silence = false) {\n return validateSpec(HiGlassSchema, this.spec(), silence).state === 'success';\n }\n\n public setDomain(xDomain: Domain | undefined, yDomain: Domain | undefined) {\n if (xDomain) {\n this.getLastView().initialXDomain = getNumericDomain(xDomain, this.getAssembly());\n }\n if (yDomain) {\n this.getLastView().initialYDomain = getNumericDomain(yDomain, this.getAssembly());\n }\n return this;\n }\n\n /**\n * This is a hacky function that adjust x domain to properly show vertical tracks.\n *\n * In HiGlass, the range of vertical tracks is affected by a center track. For example, if a center track is small, the vertical tracks become small as well.\n * Currently, the actual size of center track for vertical gosling tracks is `1px`. So, we re-scale the x domain so that gosling's vertical tracks properly use the entire height of a view.\n * @param orientation\n * @param width\n * @returns\n */\n public adjustDomain(orientation: Orientation = 'horizontal', width: number, height: number) {\n if (orientation !== 'vertical') {\n return this;\n }\n\n const domain = this.getLastView().initialXDomain;\n if (!domain) {\n return this;\n }\n\n const [start, end] = domain;\n const size = end - start;\n const center = (start + end) / 2.0;\n this.getLastView().initialXDomain = [\n center - (size / width / 2 / height) * width,\n center + (size / width / 2 / height) * width\n ];\n return this;\n }\n\n /**\n * Allow a zoom interaction?\n */\n public setZoomFixed(zoomFixed: boolean) {\n this.getLastView().zoomFixed = zoomFixed;\n return this;\n }\n\n /**\n * Set limits of zoom levels in base pairs.\n */\n public setZoomLimits(zoomLimits: ZoomLimits) {\n this.getLastView().zoomLimits = zoomLimits;\n return this;\n }\n\n public setLayout(layout: RelativePosition) {\n this.getLastView().layout = layout;\n return this;\n }\n\n private setEditable(editable: boolean | undefined) {\n this.hg.editable = editable;\n return this;\n }\n\n private setChromInfoPath(chromInfoPath: string | undefined) {\n if (this.getLastView()) {\n this.getLastView().chromInfoPath = chromInfoPath;\n }\n this.hg.chromInfoPath = chromInfoPath;\n return this;\n }\n\n public addTrackSourceServers(trackSourceServers: string | undefined) {\n if (trackSourceServers && this.hg.trackSourceServers?.indexOf(trackSourceServers) === -1)\n this.hg.trackSourceServers?.push(trackSourceServers);\n return this;\n }\n\n public setMainTrack(track: Track) {\n if (!this.getLastView()) return this;\n this.getLastView().tracks[this.getMainTrackPosition()] = [\n {\n type: 'combined',\n uid: `${track.uid ?? uuid()}-${this.getMainTrackPosition()}-combined`,\n // !! Hacky, but it is important to subtract 1px. Currently, HiGlass does not well handle a case where a center track is zero width (e.g., linking between views that contain zero-width center tracks).\n // https://github.com/higlass/higlass/pull/1041\n width: (track as any).width - 1,\n height: (track as any).height,\n contents: [track]\n }\n ];\n return this;\n }\n\n public addTrackToCombined(track: Track) {\n if (!this.getLastVisView()) return this;\n (this.getLastVisView() as any).tracks[this.getMainTrackPosition()][0]?.contents.push(track);\n return this;\n }\n\n public setAxisTrack(\n position: Exclude,\n type: 'regular' | 'narrow' | 'narrower' = 'regular',\n options: {\n id?: string;\n layout?: 'circular' | 'linear';\n innerRadius?: number;\n outerRadius?: number;\n width?: number;\n height?: number;\n startAngle?: number;\n endAngle?: number;\n theme: Required;\n }\n ) {\n if (!this.hg.views) return this;\n\n const widthOrHeight = position === 'left' || position === 'right' ? 'width' : 'height';\n const axisTrackTemplate: Track = {\n // uid: options.id ?? uuid(), // TODO: turning this on makes some tick labels hidden\n type: 'axis-track',\n chromInfoPath: this.hg.chromInfoPath,\n options: {\n ...options,\n assembly: this.getAssembly(),\n stroke: 'transparent', // text outline\n color: options.theme.axis.labelColor,\n labelMargin: options.theme.axis.labelMargin,\n excludeChrPrefix: options.theme.axis.labelExcludeChrPrefix,\n fontSize: options.theme.axis.labelFontSize,\n fontFamily: options.theme.axis.labelFontFamily,\n fontWeight: options.theme.axis.labelFontWeight,\n tickColor: options.theme.axis.tickColor,\n tickFormat: type === 'narrower' ? 'si' : 'plain',\n tickPositions: type === 'regular' ? 'even' : 'ends',\n reverseOrientation: position === 'bottom' || position === 'right' ? true : false\n }\n };\n if (options.layout === 'circular') {\n // circular axis: superpose an axis track on top of the `center` track\n this.addTrackToCombined({\n ...axisTrackTemplate,\n options: { ...axisTrackTemplate.options, layout: 'circular' }\n });\n } else {\n // linear axis: place an axis track on the top, left, bottom, or right\n const axisTrack = { ...axisTrackTemplate, [widthOrHeight]: HIGLASS_AXIS_SIZE };\n\n if (position === 'left') {\n // In vertical tracks, the main track has been already inserted into `left`, so put axis on the first index to show it on the left.\n if (this.getLastView().tracks.left.filter(d => d.type === 'axis-track').length !== 0) {\n // we already have an axis\n return this;\n }\n this.getLastView().tracks.left = insertItemToArray(this.getLastView().tracks.left, 0, axisTrack);\n } else if (position === 'right') {\n if (this.getLastView().tracks.right.filter(d => d.type === 'axis-track').length !== 0) {\n // we already have an axis\n return this;\n }\n this.getLastView().tracks.right.push(axisTrack);\n } else {\n if (this.getLastView().tracks[position].filter(d => d.type === 'axis-track').length !== 0) {\n // we already have an axis\n return this;\n }\n this.getLastView().tracks[position].push(axisTrack);\n }\n }\n return this;\n }\n\n public setExampleHiglassViewConfig() {\n this.hg = exampleHg as any;\n }\n}\n","import type { LogicalOperation } from '@gosling-lang/gosling-schema';\n\nexport function getMaxZoomLevel() {\n // TODO: How to correctly calculate maxZoomLevel?\n const TILE_SIZE = 256;\n const totalLength = 4795370;\n return Math.ceil(Math.log(totalLength / TILE_SIZE) / Math.log(2));\n}\n\n/**\n * Perform logical operation between a target and a reference value.\n * If the condition is `true`, return `1`.\n */\nexport function logicalComparison(\n value: number,\n op: LogicalOperation,\n ref: number,\n transitionPadding?: number\n): number {\n const padding = transitionPadding && transitionPadding !== 0 ? transitionPadding : undefined;\n let alpha = 0;\n switch (op) {\n case 'less-than':\n case 'LT':\n case 'lt':\n alpha = ref > value ? (padding ? (ref - value) / padding : 1) : 0;\n break;\n case 'less-than-or-equal-to':\n case 'LTET':\n case 'ltet':\n alpha = ref >= value ? (padding ? (ref - value) / padding : 1) : 0;\n break;\n case 'greater-than':\n case 'GT':\n case 'gt':\n alpha = ref < value ? (padding ? (value - ref) / padding : 1) : 0;\n break;\n case 'greater-than-or-equal-to':\n case 'GTET':\n case 'gtet':\n alpha = ref <= value ? (padding ? (value - ref) / padding : 1) : 0;\n break;\n }\n\n // make sure to return a value in [0, 1]\n return Math.max(Math.min(1, alpha), 0);\n}\n","// TODO: make mark-specific default\nexport const CHANNEL_DEFAULTS = {\n // https://mikemol.github.io/technique/colorblind/2018/02/11/color-safe-palette.html\n NOMINAL_COLOR: ['#E79F00', '#029F73', '#0072B2', '#CB7AA7', '#D45E00', '#57B4E9', '#EFE441' /*'#000000'*/],\n // https://colorcet.holoviz.org/user_guide/Categorical.html\n NOMINAL_COLOR_EXTENDED: [\n '#d60000',\n '#018700',\n '#b500ff',\n '#05acc6',\n '#97ff00',\n '#ffa52f',\n '#ff8ec8',\n '#79525e',\n '#00fdcf',\n '#afa5ff',\n '#93ac83',\n '#9a6900',\n '#366962',\n '#d3008c',\n '#fdf490',\n '#c86e66',\n '#9ee2ff',\n '#00c846',\n '#a877ac',\n '#b8ba01',\n '#f4bfb1',\n '#ff28fd',\n '#f2cdff',\n '#009e7c',\n '#ff6200',\n '#56642a',\n '#953f1f',\n '#90318e',\n '#ff3464',\n '#a0e491',\n '#8c9ab1',\n '#829026',\n '#ae083f',\n '#77c6ba',\n '#bc9157',\n '#e48eff',\n '#72b8ff',\n '#c6a5c1',\n '#ff9070',\n '#d3c37c',\n '#bceddb',\n '#6b8567',\n '#916e56',\n '#f9ff00',\n '#bac1df',\n '#ac567c',\n '#ffcd03',\n '#ff49b1',\n '#c15603',\n '#5d8c90',\n '#c144bc',\n '#00753f',\n '#ba6efd',\n '#00d493',\n '#00ff75',\n '#49a150',\n '#cc9790',\n '#00ebed',\n '#db7e01',\n '#f77589',\n '#b89500',\n '#c84248',\n '#00cff9',\n '#755726',\n '#85d401',\n '#ebffd4',\n '#a77b87',\n '#db72c8',\n '#cae256',\n '#8abf5d',\n '#a1216b',\n '#855b89',\n '#89bacf',\n '#ffbad6',\n '#b6cfaa',\n '#97414d',\n '#67aa00',\n '#fde1b1',\n '#ff3628',\n '#80793d',\n '#d6e8ff',\n '#a795c6',\n '#7ea59a',\n '#d182a3',\n '#54823b',\n '#e6a872',\n '#9cffff',\n '#da5480',\n '#05b3aa',\n '#ffaaf6',\n '#d1afef',\n '#da015d',\n '#ac1a13',\n '#60b385',\n '#d442fd',\n '#acaa59',\n '#fb9ca7',\n '#b3723b',\n '#f26952',\n '#aed1d4',\n '#9affc3',\n '#dbb333',\n '#eb01c3',\n '#9900c4',\n '#cfff9e',\n '#a55949',\n '#3b6d01',\n '#008579',\n '#959167',\n '#89dbb3',\n '#6d7400',\n '#aa5dca',\n '#07ef00',\n '#804f3d',\n '#d88052',\n '#ffc862',\n '#b8009e',\n '#99acdd',\n '#904f00',\n '#8c4470',\n '#4f6e52',\n '#ff8734',\n '#c68ecd',\n '#d4e29e',\n '#b1826d',\n '#9cfb75',\n '#56dd77',\n '#f90087',\n '#a1cdff',\n '#13cad1',\n '#118e54',\n '#d154a5',\n '#00dfc3',\n '#a3832f',\n '#77975b',\n '#baaa80',\n '#70a3af',\n '#d6fbff',\n '#e8013a',\n '#d84621',\n '#ff82ed',\n '#b63862',\n '#b6cd72',\n '#97626b',\n '#897490',\n '#00a316',\n '#00f4a1',\n '#bf90f2',\n '#89e4d8',\n '#a34d95',\n '#6e5d00',\n '#8cc68e',\n '#95aa2a',\n '#c672dd',\n '#b33b01',\n '#d69a36',\n '#dfacb6',\n '#009aa0',\n '#599000',\n '#97bca8',\n '#ac8ca8',\n '#dad4ff',\n '#547c72',\n '#00ba69',\n '#ffc38e',\n '#b800d4',\n '#dfcf5b',\n '#629a7b',\n '#bfedbc',\n '#c1bdfd',\n '#80d3dd',\n '#e2857e',\n '#f9eb4d',\n '#bf6d82',\n '#caff4f',\n '#ef72aa',\n '#ed67ff',\n '#9946ae',\n '#6d6942',\n '#e25660',\n '#dd662d',\n '#9cdb5d',\n '#e29ccf',\n '#b87500',\n '#c6002d',\n '#dfbcda',\n '#59b5df',\n '#ff59da',\n '#38c1a1',\n '#9e698c',\n '#acaac8',\n '#95622f',\n '#b55662',\n '#2b7e60',\n '#b1e400',\n '#eda590',\n '#95fde2',\n '#ff548e',\n '#bd6ea1',\n '#aa3b36',\n '#d8cf00',\n '#aa80cd',\n '#a08052',\n '#e100e8',\n '#c35b3d',\n '#b53a85',\n '#8c7700',\n '#dbbc95',\n '#529e93',\n '#afbc82',\n '#91b5b6',\n '#a75423',\n '#ffd4ef',\n '#79ae6b',\n '#5db54b',\n '#80fb9a',\n '#48ffef',\n '#979548',\n '#9387a7',\n '#31d400',\n '#6ee956',\n '#b6d4eb',\n '#705470',\n '#f2db8a',\n '#aad4c1',\n '#7ecdf2',\n '#89ba00',\n '#64b6ba',\n '#ffb500',\n '#c38285',\n '#caaa5e',\n '#647748',\n '#59e2ff',\n '#df4dcd',\n '#e9ff79',\n '#bc66b8',\n '#c395a5',\n '#64c674',\n '#d19570',\n '#70cf4f',\n '#aa6e66',\n '#9c60a5',\n '#00b800',\n '#e299b3',\n '#bc006b',\n '#b3e8ef',\n '#cdbfe4',\n '#77a342',\n '#856277',\n '#568e5b',\n '#9eafc4',\n '#e82fa0',\n '#247c2a',\n '#826723',\n '#bfbc4d',\n '#ddd3a5'\n ],\n QUANTITATIVE_COLOR: 'viridis',\n SIZE: 3,\n SIZE_RANGE: [2, 6]\n};\n","import { isThereTheme, getTheme as _getTheme } from '@gosling-lang/gosling-theme';\n\n/* ----------------------------- THEME ----------------------------- */\nexport type Theme = ThemeType | ThemeDeep;\nexport type ThemeType =\n | 'light'\n | 'dark'\n | 'warm'\n | 'ggplot'\n | 'igv'\n | 'ensembl'\n | 'jbrowse'\n | 'ucsc'\n | 'washu'\n | 'excel'\n | 'google';\n// export type ThemType = keyof typeof Themes;\n// Above line leads to `TypeError: Invalid value used as weak map key` error, due to cyclic dependency.\n// So, instead hard-coding the list as workaround\n// Refer to https://github.com/vega/ts-json-schema-generator/issues/1727\n\nexport interface ThemeDeep {\n base: ThemeType;\n\n root?: RootStyle;\n track?: TrackStyle;\n legend?: LegendStyle;\n axis?: AxisStyle;\n\n // Mark-Specific Styles\n markCommon?: MarkStyle;\n point?: MarkStyle;\n rect?: MarkStyle;\n triangle?: MarkStyle;\n area?: MarkStyle;\n line?: MarkStyle;\n bar?: MarkStyle;\n rule?: MarkStyle;\n link?: MarkStyle;\n brush?: MarkStyle;\n text?: MarkStyle & {\n textFontWeight?: 'bold' | 'normal';\n textAnchor?: 'start' | 'middle' | 'end';\n };\n}\n\n// TODO: Better way to implement deep `Required` type instead of having two separate interfaces, i.e., CompleteThemeDeep and ThemeDeep\nexport interface CompleteThemeDeep {\n base: Required;\n\n root: Required;\n track: Required;\n legend: Required;\n axis: Required;\n\n // Mark-Specific\n markCommon: Required;\n point: Required;\n rect: Required;\n triangle: Required;\n area: Required;\n line: Required;\n bar: Required;\n rule: Required;\n link: Required;\n brush: Required;\n text: Required &\n Required<{\n textFontWeight?: 'bold' | 'normal';\n textAnchor?: 'start' | 'middle' | 'end';\n }>;\n}\n\nexport interface RootStyle {\n background?: string;\n titleColor?: string;\n titleFontSize?: number;\n titleFontFamily?: string;\n titleAlign?: 'left' | 'middle' | 'right';\n titleFontWeight?: 'bold' | 'normal' | 'light';\n titleBackgroundColor?: string;\n subtitleColor?: string;\n subtitleFontSize?: number;\n subtitleFontFamily?: string;\n subtitleAlign?: 'left' | 'middle' | 'right';\n subtitleFontWeight?: 'bold' | 'normal' | 'light';\n subtitleBackgroundColor?: string;\n showMousePosition?: boolean;\n mousePositionColor?: string;\n}\n\nexport interface TrackStyle {\n background?: string;\n alternatingBackground?: string; // used to fill all even rows\n titleColor?: string;\n titleBackground?: string;\n titleFontSize?: number;\n titleAlign?: 'left' | 'middle' | 'right';\n outline?: string;\n outlineWidth?: number;\n // ...\n}\n\nexport interface LegendStyle {\n position?: 'top' | 'right'; // TODO: support bottom and left, and even all corners (e.g., top-left, bottom-right, etc)\n tickColor?: string;\n labelColor?: string;\n labelFontSize?: number;\n labelFontWeight?: 'bold' | 'normal' | 'light';\n labelFontFamily?: string;\n background?: string;\n backgroundOpacity?: number;\n backgroundStroke?: string;\n // ...\n}\n\nexport interface AxisStyle {\n tickColor?: string;\n /**\n * The margin around labels for calculating visual overlaps between labels.\n * This is mainly used for determining the visibility of axis labels.\n * `0` if no margin to use. Negative values (`-1`) for showing all labels even if they overlap.\n */\n labelMargin?: number;\n /**\n * If `true`, labels of genomics axes excludes the chromosome prefix (e.g., `chr1` -> `1`).\n */\n labelExcludeChrPrefix?: boolean;\n labelColor?: string;\n labelFontSize?: number;\n labelFontWeight?: 'bold' | 'normal' | 'light';\n labelFontFamily?: string;\n baselineColor?: string;\n gridColor?: string;\n gridStrokeWidth?: number;\n gridStrokeType?: 'solid' | 'dashed';\n gridStrokeDash?: [number, number];\n // ...\n}\n\nexport interface MarkStyle {\n color?: string;\n size?: number;\n stroke?: string;\n strokeWidth?: number;\n opacity?: number;\n\n nominalColorRange?: string[];\n quantitativeSizeRange?: [number, number];\n // ...\n}\n\n// TODO: Instead of calling this function everytime, create a JSON object and use it throughout the project.\nexport function getTheme(theme: Theme = 'light'): Required {\n if (typeof theme === 'string') {\n if (isThereTheme(theme)) {\n return _getTheme(theme);\n } else {\n return _getTheme('light');\n }\n } else {\n // Iterate all keys to override from base\n let baseSpec = JSON.parse(JSON.stringify(_getTheme('light')));\n if (isThereTheme(theme.base)) {\n baseSpec = _getTheme(theme.base);\n }\n // Override defaults from `base`\n Object.keys(baseSpec).forEach(k => {\n if ((theme as any)[k] && k !== 'base') {\n baseSpec[k] = Object.assign(\n JSON.parse(JSON.stringify(baseSpec[k])),\n JSON.parse(JSON.stringify((theme as any)[k]))\n );\n }\n });\n return baseSpec;\n }\n}\n","import type {\n ChannelDeep,\n PredefinedColors,\n ChannelTypes,\n ChannelValue,\n SingleTrack,\n Channel,\n Color,\n Stroke\n} from '@gosling-lang/gosling-schema';\nimport { validateTrack, getGenomicChannelFromTrack, getGenomicChannelKeyFromTrack } from '@gosling-lang/gosling-schema';\nimport {\n type ScaleLinear,\n scaleLinear,\n type ScaleOrdinal,\n scaleOrdinal,\n type ScaleBand,\n scaleBand,\n type ScaleSequential,\n scaleSequential\n} from 'd3-scale';\nimport { interpolateViridis } from 'd3-scale-chromatic';\nimport { min as d3min, max as d3max, sum as d3sum, group } from 'd3-array';\nimport { HIGLASS_AXIS_SIZE } from '../../compiler/higlass-model';\nimport { SUPPORTED_CHANNELS } from '../../core/mark';\nimport type { PIXIVisualProperty } from '../../core/visual-property.schema';\nimport { rectProperty } from '../../core/mark/rect';\nimport { pointProperty } from '../../core/mark/point';\nimport { barProperty } from '../../core/mark/bar';\nimport { getNumericDomain } from '../../core/utils/scales';\nimport { logicalComparison } from '../../core/utils/semantic-zoom';\nimport { aggregateData } from '../../core/utils/data-transform';\nimport {\n IsChannelDeep,\n IsChannelValue,\n getValueUsingChannel,\n IsStackedChannel,\n IsDomainArray,\n PREDEFINED_COLOR_STR_MAP,\n IsRangeArray\n} from '@gosling-lang/gosling-schema';\nimport { CHANNEL_DEFAULTS } from '../../core/channel';\nimport { type CompleteThemeDeep, getTheme } from '../../core/utils/theme';\nimport { uuid } from '../../core/utils/uuid';\nimport { MouseEventModel } from '../gosling-track/gosling-mouse-event';\n\nexport type ScaleType =\n | ScaleLinear\n | ScaleOrdinal\n | ScaleBand\n | ScaleSequential\n | (() => string | number); // constant value\n\nexport class GoslingTrackModel {\n private id: string;\n\n private theme: Required;\n\n /* spec */\n private specOriginal: SingleTrack; // original spec of users\n private specComplete: SingleTrack; // processed spec, being used in visualizations\n\n /* data */\n private dataAggregated: { [k: string]: number | string }[];\n\n /* channel scales */\n private channelScales: {\n [channel: string]: ScaleType;\n };\n\n /* mouse events */\n private mouseEventModel: MouseEventModel;\n\n constructor(spec: SingleTrack, data: { [k: string]: number | string }[], theme: Required) {\n this.id = uuid();\n\n this.theme = theme ?? getTheme();\n\n this.dataAggregated = data;\n\n this.specOriginal = spec;\n this.specComplete = spec;\n\n this.channelScales = {};\n\n this.mouseEventModel = new MouseEventModel();\n\n const validity = this.validateSpec();\n if (!validity.valid) {\n console.warn('Gosling specification is not valid!', validity.errorMessages);\n return;\n }\n\n // fill missing options\n this.generateCompleteSpec(this.specComplete);\n\n this.flipRanges(this.specComplete);\n\n // generate scales based on domains and ranges\n this.generateScales();\n\n this.dataAggregated = aggregateData(this.spec(), this.dataAggregated);\n\n // Add default specs.\n // ...\n\n // DEBUG\n // console.log('corrected track', this.spec());\n }\n\n public getId(): string {\n return this.id;\n }\n\n public originalSpec(): SingleTrack {\n return this.specOriginal;\n }\n\n public spec(): SingleTrack {\n return this.specComplete;\n }\n\n public data(): { [k: string]: number | string }[] {\n return this.dataAggregated;\n }\n\n public getMouseEventModel(): MouseEventModel {\n return this.mouseEventModel;\n }\n\n /**\n * Fill the missing options with default values or with the values calculated based on the data.\n */\n private generateCompleteSpec(spec: SingleTrack) {\n if (!spec.width || !spec.height) {\n // This shouldn't be reached.\n console.warn('Size of track is not determined yet.');\n return;\n }\n\n // If this is vertical track, switch them.\n if (spec.orientation === 'vertical') {\n const width = spec.width;\n spec.width = spec.height;\n spec.height = width;\n }\n\n // If axis presents, reserve a space to show axis\n const xOrY = this.getGenomicChannelKey();\n let isAxisShown = false;\n if (xOrY === 'x') {\n isAxisShown = IsChannelDeep(spec.x) && spec.x.axis !== undefined && spec.x.axis !== 'none';\n }\n if (xOrY === 'y') {\n isAxisShown = IsChannelDeep(spec.y) && spec.y.axis !== undefined && spec.y.axis !== 'none';\n }\n if (spec.layout !== 'circular') {\n if (IsChannelDeep(spec.x) && spec.x.axis !== undefined && spec.x.axis !== 'none') {\n // for linear layouts, prepare a horizontal or vertical space for the axis\n // we already switched the width and height in vertical tracks, so use `height`\n spec.height -= HIGLASS_AXIS_SIZE;\n }\n // TODO: consider 2D\n } else {\n // for circular layouts, prepare a space in radius for the axis\n if (xOrY === 'x' && isAxisShown && IsChannelDeep(spec.x) && spec.x.axis === 'top') {\n spec['outerRadius'] = ((spec['outerRadius'] as number) - HIGLASS_AXIS_SIZE) as number;\n } else if (xOrY === 'x' && isAxisShown && IsChannelDeep(spec.x) && spec.x.axis === 'bottom') {\n spec['innerRadius'] = ((spec['innerRadius'] as number) + HIGLASS_AXIS_SIZE) as number;\n }\n }\n\n // zero baseline\n SUPPORTED_CHANNELS.forEach(channelKey => {\n const channel = spec[channelKey];\n if (IsChannelDeep(channel) && !('zeroBaseline' in channel) && channel.type === 'quantitative') {\n (channel as any).zeroBaseline = true;\n }\n });\n\n this.addScaleMaterials(spec);\n }\n\n /**\n * TODO: This is experimental. For bar charts, for example, additional care should be taken to correctly flip the visual marks.\n * Flip the y scales when `flip` options is used.\n */\n private flipRanges(spec: SingleTrack) {\n if (IsChannelDeep(spec.y) && spec.y.flip && Array.isArray(spec.y.range)) {\n spec.y.range = spec.y.range.reverse();\n }\n }\n\n /**\n * Find an axis channel that is encoded with genomic coordinate and return the key (e.g., 'x').\n * `undefined` if not found.\n */\n public getGenomicChannelKey(): 'x' | 'xe' | 'y' | 'ye' | 'x1' | 'x1e' | 'y1' | 'y1e' | undefined {\n return getGenomicChannelKeyFromTrack(this.spec());\n }\n /**\n * Find a genomic field from the track specification.\n * `undefined` if not found.\n */\n public getGenomicChannel(): ChannelDeep | undefined {\n return getGenomicChannelFromTrack(this.spec());\n }\n\n /**\n * Replace a domain with a new one in the complete spec(s) if the original spec does not define the domain.\n * A domain is replaced only when the channel is bound with data (i.e., `ChannelDeep`).\n */\n public setChannelDomain(channelKey: keyof typeof ChannelTypes, domain: string[] | number[], force?: boolean) {\n const channelRaw = this.originalSpec()[channelKey];\n if (!force && IsChannelDeep(channelRaw) && channelRaw.domain !== undefined) {\n // if domain is provided in the original spec, we do not replace the domain in the complete spec(s)\n return;\n }\n const channel = this.specComplete[channelKey];\n if (IsChannelDeep(channel)) {\n channel.domain = domain;\n }\n }\n\n /**\n * Update default constant values by looking up other channels' scales.\n */\n public updateChannelValue() {\n if (this.originalSpec().y === undefined) {\n const y = this.spec().y;\n const rowCategories = this.getChannelDomainArray('row');\n if (y && IsChannelValue(y) && rowCategories && this.spec().mark !== 'withinLink') {\n y.value = (this.spec().height as number) / rowCategories.length / 2.0;\n }\n }\n }\n\n /**\n * Get the encoded value using the scales already constructed.\n */\n public encodedValue(channelKey: keyof typeof ChannelTypes, value?: number | string) {\n if (channelKey === 'text' && value !== undefined) {\n return `${+value ? ~~value : value}`;\n // TODO: Better formatting?\n // return `${+value ? (+value - ~~value) > 0 ? (+value).toExponential(1) : ~~value : value}`;\n }\n\n const channel = this.spec()[channelKey];\n const channelFieldType = IsChannelDeep(channel)\n ? channel.type\n : IsChannelValue(channel)\n ? 'constant'\n : undefined;\n\n if (!channelFieldType) {\n // Shouldn't be reached. Channel should be either encoded with data or a constant value.\n return undefined;\n }\n\n if (channelFieldType === 'constant') {\n // Just return the constant value.\n return (this.channelScales[channelKey] as () => number | string)();\n }\n\n if (value === undefined) {\n // Value is undefined, so returning undefined.\n return undefined;\n }\n\n if (value === null) {\n if (channelFieldType === 'quantitative') {\n value = 0;\n } else if (channelFieldType === 'nominal') {\n value = 'null';\n }\n }\n\n if (typeof this.channelScales[channelKey] !== 'function') {\n // Scale is undefined, so returning undefined.\n return undefined;\n }\n\n // The type of a channel scale is determined by a { channel type, field type } pair\n switch (channelKey) {\n case 'x':\n case 'y':\n case 'x1':\n case 'y1':\n case 'xe':\n case 'ye':\n case 'x1e':\n if (channelFieldType === 'quantitative' || channelFieldType === 'genomic') {\n return (this.channelScales[channelKey] as ScaleLinear)(value as number);\n }\n if (channelFieldType === 'nominal') {\n return (this.channelScales[channelKey] as ScaleBand)(value as string);\n }\n break;\n case 'stroke':\n case 'color':\n if (channelFieldType === 'quantitative') {\n const s = (this.channelScales[channelKey] as ScaleSequential).copy();\n const d = s.domain();\n const e = d[1] - d[0];\n const so = Array.from((channel as Color).scaleOffset ?? [0, 1]);\n return s.domain([d[0] + e * so.sort()[0], d[0] + e * so.sort()[1]])(value as number);\n }\n if (channelFieldType === 'nominal') {\n return (this.channelScales[channelKey] as ScaleOrdinal)(value as string);\n }\n /* genomic is not supported */\n break;\n case 'size':\n if (channelFieldType === 'quantitative') {\n return (this.channelScales[channelKey] as ScaleLinear)(value as number);\n }\n if (channelFieldType === 'nominal') {\n return (this.channelScales[channelKey] as ScaleOrdinal)(value as string);\n }\n /* genomic is not supported */\n break;\n case 'row':\n /* quantitative is not supported */\n if (channelFieldType === 'nominal') {\n return (this.channelScales[channelKey] as ScaleBand)(value as string);\n }\n /* genomic is not supported */\n break;\n case 'strokeWidth':\n case 'opacity':\n if (channelFieldType === 'quantitative') {\n return (this.channelScales[channelKey] as ScaleLinear)(value as number);\n }\n /* nominal is not supported */\n /* genomic is not supported */\n break;\n default:\n console.warn(`${channelKey} is not supported for encoding values, so returning a undefined value`);\n return undefined;\n }\n }\n\n public trackVisibility(currentStage: { zoomLevel?: number }): boolean {\n const spec = this.spec();\n if (\n !spec.visibility ||\n spec.visibility.length === 0 ||\n spec.visibility.filter(d => d.target === 'track').length === 0\n ) {\n // if condition is not defined, just show them.\n return true;\n }\n\n // We are using a logical operation AND, so if unless all options are `true`, we hide this track.\n let visibility = true;\n spec.visibility\n .filter(d => d.target === 'track')\n .forEach(d => {\n const { operation, measure, threshold } = d;\n\n let compareValue: number | undefined;\n\n if (measure === 'zoomLevel') {\n compareValue = currentStage[measure];\n } else {\n compareValue = spec[measure];\n }\n\n if (compareValue !== undefined) {\n // compare only when the measure is suggested\n visibility = visibility && logicalComparison(compareValue, operation, threshold as number) === 1;\n }\n });\n return visibility;\n }\n\n /**\n * Check whether the visual mark should be visible or not.\n * Return 0 (invisible) only when the predefined condition is correct.\n */\n public markVisibility(datum: { [k: string]: string | number }, metrics?: any): number {\n const spec = this.spec();\n if (\n !spec.visibility ||\n spec.visibility.length === 0 ||\n spec.visibility.filter(d => d.target === 'mark').length === 0\n ) {\n // if condition is not defined, just show them.\n return 1;\n }\n\n let visibility = 1;\n\n // Find the lowest visibility\n spec.visibility\n .filter(d => d.target === 'mark')\n .forEach(d => {\n const { operation, threshold, conditionPadding, transitionPadding, measure } = d;\n\n const padding = conditionPadding ?? 0;\n const mark = spec.mark;\n\n let newVisibility = 1;\n\n if (mark === 'text' && threshold === '|xe-x|' && measure === 'width') {\n // compare between the actual width and the |xe-x|\n const xe = this.encodedPIXIProperty('xe', datum);\n const x = this.encodedPIXIProperty('x', datum);\n\n if (xe !== undefined && metrics?.width) {\n newVisibility = logicalComparison(\n metrics.width + padding,\n operation,\n Math.abs(xe - x),\n transitionPadding\n );\n }\n } else if (measure === 'width' && typeof threshold === 'number' && metrics?.width) {\n // compare between the actual width and the constant width that user specified\n newVisibility = logicalComparison(metrics.width + padding, operation, threshold, transitionPadding);\n } else if (measure === 'zoomLevel' && typeof threshold === 'number' && metrics?.zoomLevel) {\n newVisibility = logicalComparison(metrics.zoomLevel, operation, threshold, transitionPadding);\n }\n\n // Update only if the upcoming one is smaller\n if (visibility > newVisibility) {\n visibility = newVisibility;\n }\n });\n return visibility;\n }\n\n /**\n *\n */\n public visualPropertyByChannel(channelKey: keyof typeof ChannelTypes, datum?: { [k: string]: string | number }) {\n const value = datum !== undefined ? getValueUsingChannel(datum, this.spec()[channelKey] as Channel) : undefined; // Is this safe enough?\n return this.encodedValue(channelKey, value);\n }\n\n /**\n * Retrieve an encoded visual property of a visual mark.\n */\n public encodedPIXIProperty(\n propertyKey: PIXIVisualProperty,\n datum?: { [k: string]: string | number },\n additionalInfo?: any\n ) {\n const mark = this.spec().mark;\n\n // common visual properties, not specific to visual marks\n if (\n [\n 'text',\n 'color',\n 'row',\n 'stroke',\n 'opacity',\n 'strokeWidth',\n 'x',\n 'y',\n 'xe',\n 'x1',\n 'x1e',\n 'ye',\n 'size'\n ].includes(propertyKey)\n ) {\n return this.visualPropertyByChannel(propertyKey as any, datum);\n }\n\n switch (mark) {\n case 'bar':\n return barProperty(this, propertyKey, datum, additionalInfo);\n case 'point':\n case 'text':\n return pointProperty(this, propertyKey, datum);\n case 'rect':\n return rectProperty(this, propertyKey, datum, additionalInfo);\n default:\n // Mark type that is not supported yet\n return undefined;\n }\n }\n\n // TODO: better organize this, perhaps, by combining several if statements\n /**\n * Set missing `range`, `domain`, and/or `value` of each channel by looking into data.\n */\n public addScaleMaterials(spec: SingleTrack) {\n const data = this.data();\n\n const genomicChannel = this.getGenomicChannel();\n if (!genomicChannel || !genomicChannel.field) {\n console.warn('Genomic field is not provided in the specification');\n // EXPERIMENTAL: we are removing this rule in our spec.\n return;\n }\n\n if (typeof spec.width === 'undefined' || typeof spec.height === 'undefined') {\n console.warn('Track size is not determined yet');\n return;\n }\n\n // const WARN_MSG = (c: string, t: string) =>\n // `The channel key and type pair {${c}, ${t}} is not supported when generating channel scales`;\n\n SUPPORTED_CHANNELS.forEach(channelKey => {\n const channel = spec[channelKey];\n\n if (IsStackedChannel(spec, channelKey) && IsChannelDeep(channel)) {\n // we need to group data before calculating scales because marks are going to be stacked\n // (spec as any /* TODO: select more accurately */).x\n const pivotedData = group(data, d => d[genomicChannel.field as string]);\n const xKeys = [...pivotedData.keys()];\n\n if (!channel.domain) {\n // TODO: consider data ranges in negative values\n const min =\n 'zeroBaseline' in channel && channel.zeroBaseline\n ? 0\n : d3min(\n xKeys.map(d =>\n d3sum(\n (pivotedData.get(d) as any).map((_d: any) =>\n channel.field ? _d[channel.field] : undefined\n )\n )\n ) as number[]\n );\n const max = d3max(\n xKeys.map(d =>\n d3sum(\n (pivotedData.get(d) as any).map((_d: any) =>\n channel.field ? _d[channel.field] : undefined\n )\n )\n ) as number[]\n );\n channel.domain = [min, max] as [number, number]; // TODO: what if data ranges in negative values\n }\n\n if (!channel.range) {\n const rowChannel = spec.row;\n const rowField = IsChannelDeep(rowChannel) ? rowChannel.field : undefined;\n const rowCategories =\n this.getChannelDomainArray('row') ??\n (rowField ? Array.from(new Set(data.map(d => d[rowField as string]))) : [1]);\n const rowHeight = (spec.height as number) / rowCategories.length;\n\n // `channel` here is either `x` or `y` because they only can ba stacked\n switch (channelKey) {\n case 'x':\n channel.range = [0, spec.width] as [number, number]; // TODO: not considering vertical direction tracks\n break;\n case 'y':\n channel.range = [0, rowHeight];\n break;\n }\n }\n } else {\n const rowChannel = spec.row;\n const rowField = IsChannelDeep(rowChannel) ? rowChannel.field : undefined;\n const rowCategories =\n this.getChannelDomainArray('row') ??\n (rowField ? Array.from(new Set(data.map(d => d[rowField as string]))) : [1]);\n const rowHeight = (spec.height as number) / rowCategories.length;\n\n if (!channel) {\n // this means the channel is entirely missing in the specification, so we add a default value\n let value;\n switch (channelKey) {\n case 'x':\n value = (spec.width as number) / 2.0;\n break;\n case 'y':\n if (spec.mark === 'withinLink') value = rowHeight;\n else value = rowHeight / 2.0;\n break;\n case 'size':\n if (spec.mark === 'line') value = this.theme.line.size;\n else if (spec.mark === 'bar') value = undefined;\n else if (spec.mark === 'rect') value = undefined;\n else if (spec.mark === 'triangleRight') value = undefined;\n else if (spec.mark === 'triangleLeft') value = undefined;\n else if (spec.mark === 'triangleBottom') value = undefined;\n // Points in this case are stretched from `x` to `xe`\n else if (\n spec.stretch &&\n spec.mark === 'point' &&\n IsChannelDeep(spec.x) &&\n IsChannelDeep(spec.xe)\n )\n value = undefined;\n else if (spec.mark === 'text') value = 12;\n else value = this.theme.point.size;\n break;\n case 'color':\n value = this.theme.markCommon.color;\n break;\n case 'row':\n value = 0;\n break;\n case 'stroke':\n // !! TODO: These should be based on themes\n if (spec.mark === 'text') value = this.theme.text.stroke;\n else value = this.theme.markCommon.stroke;\n break;\n case 'strokeWidth':\n if (spec.mark === 'rule') value = this.theme.rule.strokeWidth;\n else if (spec.mark === 'withinLink' || spec.mark === 'betweenLink')\n value = this.theme.link.strokeWidth;\n else if (spec.mark === 'text') value = this.theme.text.strokeWidth;\n else value = this.theme.markCommon.strokeWidth;\n break;\n case 'opacity':\n value = this.theme.markCommon.opacity;\n break;\n case 'text':\n value = '';\n break;\n default:\n // console.warn(WARN_MSG(channelKey, 'value'));\n }\n if (typeof value !== 'undefined') {\n spec[channelKey] = { value } as ChannelValue;\n }\n } else if (IsChannelDeep(channel) && (channel.type === 'quantitative' || channel.type === 'genomic')) {\n if (channel.domain === undefined) {\n const min =\n 'zeroBaseline' in channel && channel.zeroBaseline\n ? 0\n : (d3min(data.map(d => +d[channel.field as string]) as number[]) as number) ?? 0;\n const max = (d3max(data.map(d => +d[channel.field as string]) as number[]) as number) ?? 0;\n channel.domain = [min, max]; // TODO: what if data ranges in negative values\n } else if (channel.type === 'genomic' && !IsDomainArray(channel.domain)) {\n channel.domain = getNumericDomain(channel.domain);\n }\n\n if (\n (channelKey === 'color' || channelKey === 'stroke') &&\n channel.type === 'quantitative' &&\n !(channel as Color).scaleOffset\n ) {\n (channel as Color | Stroke).scaleOffset = [0, 1];\n }\n\n if (!channel.range) {\n let range;\n switch (channelKey) {\n case 'x':\n case 'xe':\n case 'x1':\n case 'x1e':\n range = [0, spec.width];\n break;\n case 'y':\n case 'ye':\n range = [0, rowHeight];\n break;\n case 'color':\n case 'stroke':\n range = CHANNEL_DEFAULTS.QUANTITATIVE_COLOR as PredefinedColors;\n break;\n case 'size':\n range = this.theme.markCommon.quantitativeSizeRange;\n break;\n case 'strokeWidth':\n range = [1, 3];\n break;\n case 'opacity':\n range = [0, 1];\n break;\n default:\n // console.warn(WARN_MSG(channelKey, channel.type));\n break;\n }\n if (range) {\n channel.range = range as PredefinedColors | number[];\n }\n }\n } else if (IsChannelDeep(channel) && channel.type === 'nominal') {\n if (channel.domain === undefined) {\n channel.domain = Array.from(\n new Set(data.map(d => d[channel.field as string] ?? 'null'))\n ) as string[];\n }\n if (!channel.range) {\n let startSize = 2;\n let range;\n switch (channelKey) {\n case 'x':\n case 'xe':\n range = [0, spec.width];\n break;\n case 'y':\n case 'ye':\n range = [rowHeight, 0]; // reversed because the origin is on the top\n break;\n case 'color':\n case 'stroke':\n range = this.theme.markCommon.nominalColorRange;\n break;\n case 'row':\n range = [0, spec.height];\n break;\n case 'size':\n range = (channel.domain as number[]).map(() => startSize++);\n break;\n default:\n // console.warn(WARN_MSG(channelKey, channel.type));\n break;\n }\n if (range) {\n channel.range = range as number[] | string[];\n }\n }\n }\n }\n });\n\n /* Merge domains of neighbor channels (e.g., x and xe) */\n [\n ['x', 'xe'],\n ['y', 'ye']\n ].forEach(pair => {\n const [k1, k2] = pair as [keyof typeof ChannelTypes, keyof typeof ChannelTypes];\n const c1 = spec[k1],\n c2 = spec[k2];\n if (\n IsChannelDeep(c1) &&\n IsChannelDeep(c2) &&\n c1.type === c2.type &&\n c1.domain &&\n c2.domain &&\n Array.isArray(c1.domain) &&\n Array.isArray(c2.domain)\n ) {\n if (c1.type === 'genomic' || c1.type === 'quantitative') {\n const min = d3min([c1.domain[0] as number, c2.domain[0] as number]) as number;\n const max = d3max([c1.domain[1] as number, c2.domain[1] as number]) as number;\n c1.domain = c2.domain = [min, max];\n } else if (c1.type === 'nominal') {\n const range = Array.from(new Set([...c1.domain, ...c2.domain])) as string[];\n c1.range = c2.range = range;\n }\n }\n });\n }\n\n /**\n * Store the scale of individual visual channels based on the `complete` spec.\n */\n public generateScales() {\n const spec = this.spec();\n\n /// DEBUG\n // console.log(spec);\n //\n\n SUPPORTED_CHANNELS.forEach(channelKey => {\n const channel = spec[channelKey];\n\n if (IsChannelValue(channel)) {\n this.channelScales[channelKey] = () => channel.value;\n } else if (IsChannelDeep(channel)) {\n if (channelKey === 'text') {\n // We do not generate scales for 'text' marks.\n return;\n }\n\n const domain = channel.domain;\n const range = channel.range;\n\n if (domain === undefined || range === undefined) {\n // we do not have sufficient info to generate scales\n return;\n }\n\n if (channel.type === 'quantitative' || channel.type === 'genomic') {\n switch (channelKey) {\n case 'x':\n case 'x1':\n case 'xe':\n case 'x1e':\n case 'y':\n case 'ye':\n case 'size':\n case 'opacity':\n case 'strokeWidth':\n this.channelScales[channelKey] = scaleLinear()\n .domain(domain as [number, number])\n .range(range as [number, number]);\n break;\n case 'color':\n case 'stroke':\n let interpolate = interpolateViridis;\n if (Object.keys(PREDEFINED_COLOR_STR_MAP).includes(range as string)) {\n interpolate = PREDEFINED_COLOR_STR_MAP[range as string];\n }\n this.channelScales[channelKey] = scaleSequential(interpolate).domain(\n domain as [number, number]\n );\n break;\n default:\n break;\n // console.warn('Not supported channel for calculating scales');\n }\n } else if (channel.type === 'nominal') {\n switch (channelKey) {\n case 'x':\n case 'xe':\n case 'y':\n case 'ye':\n case 'row':\n this.channelScales[channelKey] = scaleBand()\n .domain(domain as string[])\n .range(range as [number, number]);\n break;\n case 'size':\n this.channelScales[channelKey] = scaleOrdinal()\n .domain(domain as string[])\n .range(range as number[]);\n break;\n case 'color':\n case 'stroke':\n this.channelScales[channelKey] = scaleOrdinal(range as string[]).domain(domain as string[]);\n break;\n default:\n break;\n // console.warn('Not supported channel for calculating scales');\n }\n }\n }\n });\n }\n\n /**\n * Return the scale of a visual channel.\n * `undefined` if we do not have the scale.\n */\n public getChannelScale(channelKey: keyof typeof ChannelTypes) {\n return this.channelScales[channelKey];\n }\n\n /**\n * Set a new scale for a certain channel. Usually called to replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher.\n */\n public setChannelScale(channelKey: keyof typeof ChannelTypes, scale: ScaleType) {\n this.channelScales[channelKey] = scale;\n }\n\n /**\n * Return whether to show y-axis.\n */\n public isShowYAxis(): boolean {\n const spec = this.spec();\n const yDomain = this.getChannelDomainArray('y');\n const yRange = this.getChannelRangeArray('y');\n return (\n IsChannelDeep(spec.y) && spec.y.axis !== 'none' && spec.y.type === 'quantitative' && !!yDomain && !!yRange\n );\n }\n\n /**\n * Return the domain of a visual channel.\n * `undefined` if we do not have domain in array.\n */\n public getChannelDomainArray(channelKey: keyof typeof ChannelTypes): string[] | number[] | undefined {\n const c = this.spec()[channelKey];\n return IsChannelDeep(c) && IsDomainArray(c.domain) ? c.domain : undefined;\n }\n\n /**\n * Return the range of a visual channel.\n * `undefined` if we do not have domain in array.\n */\n public getChannelRangeArray(channelKey: keyof typeof ChannelTypes): string[] | number[] | undefined {\n const c = this.spec()[channelKey];\n return IsChannelDeep(c) && IsRangeArray(c.range) ? c.range : undefined;\n }\n\n /**\n * Validate the original spec.\n */\n public validateSpec(): { valid: boolean; errorMessages: string[] } {\n return validateTrack(this.originalSpec());\n }\n}\n","import type { _EventMap } from '@gosling-lang/gosling-schema';\nimport PubSub from 'pubsub-js';\n\ntype EventName = keyof _EventMap;\n\nexport function publish(name: Name, data: _EventMap[Name]): void {\n PubSub.publish(name, data);\n}\n\nexport function subscribe(\n name: Name,\n callback: (msg: string, data: _EventMap[Name]) => void\n): void {\n PubSub.subscribe(name, callback);\n}\n\nexport function unsubscribe(name: EventName): void {\n PubSub.unsubscribe(name);\n}\n","import type * as PIXI from 'pixi.js';\nimport { isEqual, sampleSize, uniqBy } from 'lodash-es';\nimport type { ScaleLinear } from 'd3-scale';\nimport type {\n SingleTrack,\n OverlaidTrack,\n Datum,\n EventStyle,\n GenomicPosition,\n Assembly,\n ValueExtent,\n Range\n} from '@gosling-lang/gosling-schema';\nimport { type MouseEventData, isPointInsideDonutSlice } from '../gosling-track/gosling-mouse-event';\nimport { BamDataFetcher, type TabularDataFetcher } from '@data-fetchers';\nimport type { Tile as _Tile, TileData, TileDataBase } from '@higlass/services';\nimport { LinearBrushModel } from '@gosling-lang/gosling-brush';\nimport { getTheme } from '@gosling-lang/gosling-theme';\nimport { getTabularData } from './data-abstraction';\n\nimport type { CompleteThemeDeep } from '../../core/utils/theme';\nimport { drawMark, drawPostEmbellishment, drawPreEmbellishment } from '../../core/mark';\nimport { GoslingTrackModel } from './gosling-track-model';\nimport { validateTrack } from '@gosling-lang/gosling-schema';\nimport { shareScaleAcrossTracks } from '../../core/utils/scales';\nimport { resolveSuperposedTracks } from '../../core/utils/overlay';\nimport colorToHex from '../../core/utils/color-to-hex';\nimport {\n aggregateCoverage,\n calculateData,\n concatString,\n displace,\n filterData,\n calculateGenomicLength,\n parseSubJSON,\n replaceString,\n splitExon,\n inferSvType\n} from '../../core/utils/data-transform';\nimport { publish } from '../../api/pubsub';\nimport { getRelativeGenomicPosition } from '../../core/utils/assembly';\nimport { getTextStyle } from '../../core/utils/text-style';\nimport {\n Is2DTrack,\n IsChannelDeep,\n IsMouseEventsDeep,\n IsXAxis,\n isTabularDataFetcher,\n hasDataTransform\n} from '@gosling-lang/gosling-schema';\nimport { HIGLASS_AXIS_SIZE } from '../../compiler/higlass-model';\nimport { flatArrayToPairArray } from '../../core/utils/array';\nimport { createPluginTrack, type PluginTrackFactory, type TrackConfig } from '../../core/utils/define-plugin-track';\nimport { uuid } from '../../core/utils/uuid';\n\n// Set `true` to print in what order each function is called\nexport const PRINT_RENDERING_CYCLE = false;\n\n// For using libraries, refer to https://github.com/higlass/higlass/blob/f82c0a4f7b2ab1c145091166b0457638934b15f3/app/scripts/configs/available-for-plugins.js\n// `getTilePosAndDimensions()` definition: https://github.com/higlass/higlass/blob/1e1146409c7d7c7014505dd80d5af3e9357c77b6/app/scripts/Tiled1DPixiTrack.js#L133\n// Refer to the following already supported graphics:\n// https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/PixiTrack.js#L115\n\nconst DEFAULT_MOUSE_EVENT_STYLE: Required = {\n stroke: 'black',\n strokeWidth: 1,\n strokeOpacity: 1,\n color: 'none',\n opacity: 1,\n arrange: 'front'\n};\n\ninterface GoslingTrackOptions {\n /**\n * Track ID specified by users\n */\n id: string;\n /**\n * Track IDs that are superposed with this track, containing the id of this track itself\n */\n siblingIds: string[];\n spec: SingleTrack | OverlaidTrack;\n theme: CompleteThemeDeep;\n showMousePosition?: boolean;\n}\n\n/** Tile data used in Gosling data fetchers */\ninterface TabularTileData extends TileDataBase {\n tabularData: Datum[];\n}\n\n/** Mutated type of `Tile` that includes Gosling's tile data, i.e., tabular tile data */\nexport interface Tile extends Omit<_Tile, 'tileData'> {\n tileData: TileData | TabularTileData;\n}\n\ninterface ProcessedTileInfo {\n /** Single tile can contain multiple gosling models if multiple tracks are superposed */\n goslingModels: GoslingTrackModel[];\n tabularData: Datum[];\n /** Flag variable that indicate that rendering of this tile should be skipped */\n skipRendering: boolean;\n}\n\n/** Information about the rendered color legend */\nexport interface DisplayedLegend {\n domain: ValueExtent;\n range: Range;\n}\n\nfunction initProcessedTileInfo(): ProcessedTileInfo {\n return { goslingModels: [], tabularData: [], skipRendering: false };\n}\n\nconst config: TrackConfig = {\n type: 'gosling-track',\n datatype: ['multivec', 'epilogos'],\n orientation: '1d-horizontal',\n // @ts-expect-error missing default spec\n defaultOptions: {\n // TODO: Are any of these used?\n // labelPosition: 'none',\n // labelColor: 'black',\n // labelTextOpacity: 0.4,\n // trackBorderWidth: 0,\n // trackBorderColor: 'black',\n // backgroundColor: 'white',\n // barBorder: false,\n // sortLargestOnTop: true,\n // axisPositionHorizontal: 'left',\n theme: getTheme('light')\n }\n};\n\nconst factory: PluginTrackFactory = (HGC, context, options) => {\n // Services\n const { tileProxy } = HGC.services;\n const { BarTrack } = HGC.tracks;\n\n /* Custom loading label */\n const loadingTextStyle = getTextStyle({ color: 'black', size: 12 });\n\n /**\n * The main plugin track in Gosling. This is a versetile plugin track for HiGlass which relies on GoslingTrackModel\n * to keep track of mouse event and channel scales.\n */\n class GoslingTrackClass extends BarTrack {\n /* *\n *\n * Properties\n *\n * */\n\n tileSize: number;\n mRangeBrush: LinearBrushModel;\n #assembly?: Assembly; // Used to get the relative genomic position\n #processedTileInfo: Record;\n firstDraw = true; // False if draw has been called once already. Used with onNewTrack API. Public because used in draw()\n // Used in mark/legend.ts\n gLegend? = HGC.libraries.d3Selection.select(context.svgElement).append('g');\n displayedLegends: DisplayedLegend[] = []; // Store the color legends added so far so that we can avoid overlaps and redundancy\n // Used in mark/text.ts\n textGraphics: unknown[] = [];\n textsBeingUsed = 0;\n // Mouse fields\n pMouseHover = new HGC.libraries.PIXI.Graphics();\n pMouseSelection = new HGC.libraries.PIXI.Graphics();\n #mouseDownX = 0;\n #mouseDownY = 0;\n #isRangeBrushActivated = false;\n #gBrush = HGC.libraries.d3Selection.select(context.svgElement).append('g');\n #loadingTextStyleObj = new HGC.libraries.PIXI.TextStyle(loadingTextStyle);\n #loadingTextBg = new HGC.libraries.PIXI.Graphics();\n #loadingText = new HGC.libraries.PIXI.Text('', loadingTextStyle);\n prevVisibleAndFetchedTiles?: Tile[];\n resolvedTracks: SingleTrack[] | undefined;\n\n /* *\n *\n * Constructor\n *\n * */\n\n constructor() {\n super(context, options);\n\n context.dataFetcher.track = this;\n this.#processedTileInfo = {};\n this.#assembly = this.options.spec.assembly;\n\n // Add unique IDs to each of the overlaid tracks that will be rendered independently.\n if ('overlay' in this.options.spec) {\n this.options.spec.overlay = (this.options.spec as OverlaidTrack)._overlay.map(o => {\n return { ...o, _renderingId: uuid() };\n });\n } else {\n this.options.spec._renderingId = uuid();\n }\n\n this.fetchedTiles = {};\n this.tileSize = this.tilesetInfo?.tile_size ?? 1024;\n\n const { valid, errorMessages } = validateTrack(this.options.spec);\n\n if (!valid) {\n console.warn('The specification of the following track is invalid', errorMessages, this.options.spec);\n }\n\n // Graphics for highlighting visual elements under the cursor\n this.pMain.addChild(this.pMouseHover);\n this.pMain.addChild(this.pMouseSelection);\n\n // Enable click event\n this.pMask.interactive = true;\n this.mRangeBrush = new LinearBrushModel(this.#gBrush, HGC.libraries, this.options.spec.style?.brush);\n this.mRangeBrush.on('brush', this.#onRangeBrush.bind(this));\n\n this.pMask.on('mousedown', (e: PIXI.InteractionEvent) => {\n const { x, y } = e.data.getLocalPosition(this.pMain);\n this.#onMouseDown(x, y, e.data.originalEvent.altKey);\n });\n this.pMask.on('mouseup', (e: PIXI.InteractionEvent) => {\n const { x, y } = e.data.getLocalPosition(this.pMain);\n this.#onMouseUp(x, y);\n });\n this.pMask.on('mousemove', (e: PIXI.InteractionEvent) => {\n const { x } = e.data.getLocalPosition(this.pMain);\n this.#onMouseMove(x);\n });\n this.pMask.on('mouseout', this.#onMouseOut.bind(this));\n this.flipText = this.options.spec.orientation === 'vertical';\n\n // Remove a mouse graphic if created by a parent, and draw ourselves.\n // See https://github.com/higlass/higlass/blob/38f0c4415f0595c3b9d685a754d6661dc9612f7c/app/scripts/utils/show-mouse-position.js#L28\n if (this.hideMousePosition) {\n this.hideMousePosition();\n this.hideMousePosition = undefined;\n }\n if (this.options?.showMousePosition && !this.hideMousePosition) {\n this.hideMousePosition = HGC.utils.showMousePosition(\n this,\n Is2DTrack(this.getResolvedTracks()[0]),\n this.isShowGlobalMousePosition()\n );\n }\n\n // We do not use HiGlass' trackNotFoundText\n this.pLabel.removeChild(this.trackNotFoundText);\n\n this.#loadingText.anchor.x = 1;\n this.#loadingText.anchor.y = 1;\n this.pLabel.addChild(this.#loadingTextBg);\n this.pLabel.addChild(this.#loadingText);\n\n // This improves the arc/link rendering performance\n HGC.libraries.PIXI.GRAPHICS_CURVES.adaptive = this.options.spec.style?.enableSmoothPath ?? false;\n if (HGC.libraries.PIXI.GRAPHICS_CURVES.adaptive) {\n HGC.libraries.PIXI.GRAPHICS_CURVES.maxLength = 1;\n HGC.libraries.PIXI.GRAPHICS_CURVES.maxSegments = 2048 * 10;\n }\n }\n\n /* *\n *\n * Rendering Cycle Methods\n *\n * */\n\n /**\n * Draw all tiles from the bottom. Called from TiledPixiTrack constructor, so all methods called must be\n * public. https://github.com/higlass/higlass/blob/387a03e877dcfa4c2cfeabc0869375b58c0b362d/app/scripts/TiledPixiTrack.js#L216\n * Overrides draw() in BarTrack.\n * This means some class properties can be still `undefined`.\n */\n override draw() {\n if (PRINT_RENDERING_CYCLE) console.warn('draw()');\n this.clearMouseEventData();\n this.textsBeingUsed = 0;\n this.pMouseHover?.clear();\n\n const processTilesAndDraw = () => {\n // Should we force to process all tiles?\n // For BAM, yes, since all tiles are stored in a single tile and visible tiles had been changed.\n const isBamDataFetcher = this.dataFetcher instanceof BamDataFetcher;\n\n // Preprocess all tiles at once so that we can share scales across tiles.\n this.processAllTiles(isBamDataFetcher);\n\n // This function calls `drawTile` on each tile.\n super.draw();\n\n // Record tiles so that we ignore loading same tiles again\n this.prevVisibleAndFetchedTiles = this.visibleAndFetchedTiles();\n };\n\n if (\n isTabularDataFetcher(this.dataFetcher) &&\n !isEqual(this.visibleAndFetchedTiles(), this.prevVisibleAndFetchedTiles)\n ) {\n this.updateTileAsync(this.dataFetcher as TabularDataFetcher, processTilesAndDraw);\n } else {\n processTilesAndDraw();\n }\n\n // Based on the updated marks, update range selection\n this.mRangeBrush?.drawBrush(true);\n // Publish onNewTrack if this is the first draw\n if (this.firstDraw) {\n this.#publishOnNewTrack();\n this.firstDraw = false;\n }\n }\n\n /*\n * Do whatever is necessary before rendering a new tile. This function is called from `receivedTiles()`.\n * Overrides initTile in BarTrack\n * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/HorizontalLine1DPixiTrack.js#L50)\n */\n override initTile(tile: Tile) {\n if (PRINT_RENDERING_CYCLE) console.warn('initTile(tile)');\n // Since `super.initTile(tile)` prints warning, we call `drawTile` ourselves without calling\n // `super.initTile(tile)`.\n this.drawTile(tile);\n }\n\n override updateTile(/* tile: Tile */) {} // Never mind about this function for the simplicity.\n override renderTile(/* tile: Tile */) {} // Never mind about this function for the simplicity.\n\n /**\n * Display a tile upon receiving a new one or when explicitly called by a developer, e.g., calling\n * `this.draw()`. Overrides drawTile in BarTrack\n */\n override drawTile(tile: Tile) {\n if (PRINT_RENDERING_CYCLE) console.warn('drawTile(tile)');\n\n /**\n * If we don't have info about the tile, we can't draw anything.\n */\n const tileInfo = this.#processedTileInfo[tile.tileId];\n if (!tileInfo) {\n // We do not have a track model prepared to visualize\n return;\n }\n\n /**\n * Add a copy of the track scale to the tile. The tile needs its own scale because we will use it to\n * determine how much the tile has been stretched (if we are stretching the graphics)\n */\n if (!tile.drawnAtScale) {\n // This is the first time this tile is being drawn\n tile.drawnAtScale = this._xScale.copy();\n }\n\n /**\n * For certain types of marks and layouts (linear), we can stretch the graphics to avoid redrawing\n * This is much more performant than redrawing everything at every frame\n */\n const [graphicsXScale, graphicsXPos] = this.getXScaleAndOffset(tile.drawnAtScale);\n const isFirstRender = graphicsXScale === 1; // The graphicsXScale is 1 if first time the tile is being drawn\n if (!this.#isTooStretched(graphicsXScale) && this.#hasStretchableGraphics() && !isFirstRender) {\n // Stretch the graphics\n tile.graphics.scale.x = graphicsXScale;\n tile.graphics.position.x = graphicsXPos;\n return;\n }\n\n /**\n * If we can't stretch the graphics, we need to redraw everything!\n */\n\n // We need the tile scale to match the scale of the track\n tile.drawnAtScale = this._xScale.copy();\n // Clear the graphics and redraw everything\n tile.graphics?.clear();\n tile.graphics?.removeChildren();\n\n // This is only to render embellishments only once.\n // TODO: Instead of rendering and removing for every tiles, render pBorder only once\n this.pBackground.clear();\n this.pBackground.removeChildren();\n this.pBorder.clear();\n this.pBorder.removeChildren();\n this.displayedLegends = [];\n\n // Because a single tile contains one track or multiple tracks overlaid, we draw marks and embellishments\n // for each GoslingTrackModel\n tileInfo.goslingModels.forEach((model: GoslingTrackModel) => {\n // check visibility condition\n const trackWidth = this.dimensions[0];\n const zoomLevel = this._xScale.invert(trackWidth) - this._xScale.invert(0);\n\n if (!model.trackVisibility({ zoomLevel })) {\n return;\n }\n drawPreEmbellishment(HGC, this, tile, model, this.options.theme);\n drawMark(HGC, this, tile, model);\n drawPostEmbellishment(HGC, this, tile, model, this.options.theme);\n });\n\n this.forceDraw();\n }\n\n /**\n * Render this track again using a new option when a user changed the option. Overrides rerender in BarTrack.\n */\n override rerender(newOptions: GoslingTrackOptions) {\n if (PRINT_RENDERING_CYCLE) console.warn('rerender(options)');\n this.options = newOptions;\n\n if (this.options.spec.layout === 'circular') {\n // TODO (May-27-2022): remove the following line when we support a circular brush.\n // If the spec is changed to use the circular layout, we remove the current linear brush\n // because circular brush is not supported.\n this.mRangeBrush.remove();\n }\n this.getResolvedTracks(true); // force update\n this.clearMouseEventData();\n this.textsBeingUsed = 0;\n\n this.processAllTiles(true);\n this.draw();\n this.forceDraw();\n }\n /**\n * Clears MouseEventModel from each GoslingTrackModel. Must be a public method because it is called from draw()\n */\n clearMouseEventData() {\n this.visibleAndFetchedGoslingModels().forEach(model => model.getMouseEventModel().clear());\n }\n /**\n * Collect all gosling models that correspond to the tiles that are both visible and fetched.\n */\n visibleAndFetchedGoslingModels() {\n return this.visibleAndFetchedTiles().flatMap(\n tile => this.#processedTileInfo[tile.tileId]?.goslingModels ?? []\n );\n }\n\n /**\n * End of the rendering cycle. This function is called when the track is removed entirely.\n */\n override remove() {\n super.remove();\n\n if (this.gLegend) {\n this.gLegend.remove();\n this.gLegend = undefined;\n }\n this.mRangeBrush.remove();\n }\n /*\n * Rerender all tiles when track size is changed. Overrides method in TiledPixiTrack\n * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/PixiTrack.js#L186).\n */\n override setDimensions(newDimensions: [number, number]) {\n if (PRINT_RENDERING_CYCLE) console.warn('setDimensions()');\n\n super.setDimensions(newDimensions); // This simply updates `this._xScale` and `this._yScale`\n\n this.mRangeBrush.setSize(newDimensions[1]);\n }\n\n /**\n * Record new position.\n */\n override setPosition(newPosition: [number, number]) {\n super.setPosition(newPosition); // This simply changes `this.position`\n\n [this.pMain.position.x, this.pMain.position.y] = this.position;\n\n this.mRangeBrush.setOffset(...newPosition);\n }\n\n /**\n * A function to redraw this track. Typically called when an asynchronous event occurs (i.e. tiles loaded)\n * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/TiledPixiTrack.js#L71)\n */\n forceDraw() {\n this.animate();\n }\n\n /**\n * Called when location or zoom level has been changed by click-and-drag interaction\n * (https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/HorizontalLine1DPixiTrack.js#L215)\n * For brushing, refer to https://github.com/higlass/higlass/blob/caf230b5ee41168ea491572618612ac0cc804e5a/app/scripts/HeatmapTiledPixiTrack.js#L1493\n */\n override zoomed(newXScale: ScaleLinear, newYScale: ScaleLinear) {\n if (PRINT_RENDERING_CYCLE) console.warn('zoomed()');\n\n const range = this.mRangeBrush.getRange();\n this.mRangeBrush.updateRange(\n range ? [newXScale(this._xScale.invert(range[0])), newXScale(this._xScale.invert(range[1]))] : null\n );\n\n this.xScale(newXScale);\n this.yScale(newYScale);\n\n this.refreshTiles();\n this.draw();\n this.forceDraw();\n\n // Publish the new genomic axis domain\n const genomicRange = newXScale\n .domain()\n .map(absPos => getRelativeGenomicPosition(absPos, this.#assembly, true)) as [\n GenomicPosition,\n GenomicPosition\n ];\n publish('location', {\n id: context.viewUid,\n genomicRange: genomicRange\n });\n }\n\n /**\n * This is how the mask gets drawn. Overrides method in PixiTrack.\n * Compared to the method in PixiTrack, this method draws a circular mask when the layout is circular.\n * @param position\n * @param dimensions\n */\n override setMask(position: [number, number], dimensions: [number, number]) {\n this.pMask.clear();\n this.pMask.beginFill();\n\n if (this.options.spec.layout === 'circular') {\n /**\n * If the layout is circular, we want the mask to be circular as well.\n * Circular layout have multiple tracks on top of each other so if the mask is not circular, click\n * events will be triggered only on the top track.\n */\n const [x, y] = this.position;\n const [width, height] = this.dimensions;\n const cx = x + width / 2.0;\n const cy = y + height / 2.0;\n const outerRadius = this.options.spec.outerRadius!;\n this.pMask.drawCircle(cx, cy, outerRadius);\n } else {\n // Normal rectangular mask. This is what is done in PixiTrack\n this.pMask.drawRect(position[0], position[1], dimensions[0], dimensions[1]);\n }\n this.pMask.endFill();\n }\n\n /* *\n *\n * Tile and data processing methods\n *\n * */\n\n /**\n * Gets all tiles and generates tabular data and GoslingTrackModels for each tile. Called by this.draw(), so\n * this method must be public.\n * @param force if true then tabular data gets regenerated\n */\n processAllTiles(force = false) {\n this.tileSize = this.tilesetInfo?.tile_size ?? 1024;\n\n const tiles = this.visibleAndFetchedTiles();\n\n // generated tabular data\n tiles.forEach(tile => this.#generateTabularData(tile, force));\n\n // combine tabular data to the first tile if needed\n this.combineAllTilesIfNeeded();\n\n // apply data transforms to the tabular data and generate track models\n const models = tiles.flatMap(tile => this.transformDataAndCreateModels(tile));\n\n shareScaleAcrossTracks(models);\n\n const flatTileData = ([] as Datum[]).concat(...models.map(d => d.data()));\n if (flatTileData.length !== 0) {\n this.options.siblingIds.forEach(id => publish('rawData', { id, data: flatTileData }));\n }\n }\n\n /**\n * This is currently for testing the new way of rendering visual elements. Called by this.draw()\n */\n async updateTileAsync(tabularDataFetcher: TabularDataFetcher, callback: () => void) {\n if (!this.tilesetInfo) return;\n\n const tiles = this.visibleAndFetchedTiles();\n const tabularData = await tabularDataFetcher.getTabularData(Object.values(tiles).map(x => x.remoteId));\n const tilesetInfo = this.tilesetInfo;\n tiles.forEach((tile, i) => {\n if (i === 0) {\n const [refTile] = HGC.utils.trackUtils.calculate1DVisibleTiles(tilesetInfo, this._xScale);\n tile.tileData.zoomLevel = refTile[0];\n tile.tileData.tilePos = [refTile[1], refTile[1]];\n (tile.tileData as TabularTileData).tabularData = tabularData;\n } else {\n (tile.tileData as TabularTileData).tabularData = [];\n }\n });\n\n callback();\n }\n\n /**\n * Overrides method in Tiled1DPixiTrack. It is called in the constructor, `super(context, options)`.\n * So be aware to use defined variables.\n */\n override calculateVisibleTiles() {\n if (!this.tilesetInfo) return;\n if (isTabularDataFetcher(this.dataFetcher)) {\n const tiles = HGC.utils.trackUtils.calculate1DVisibleTiles(this.tilesetInfo, this._xScale);\n const maxTileWith =\n this.tilesetInfo.max_tile_width ?? this.dataFetcher.MAX_TILE_WIDTH ?? Number.MAX_SAFE_INTEGER;\n\n for (const tile of tiles) {\n const { tileWidth } = this.getTilePosAndDimensions(tile[0], [tile[1], tile[1]]);\n this.forceDraw();\n if (tileWidth > maxTileWith) {\n return;\n }\n }\n\n this.setVisibleTiles(tiles);\n } else {\n if (!this.tilesetInfo) {\n // if we don't know anything about this dataset, no point in trying to get tiles\n return;\n }\n\n // calculate the zoom level given the scales and the data bounds\n const zoomLevel = this.calculateZoomLevel();\n\n if ('resolutions' in this.tilesetInfo) {\n const sortedResolutions = this.tilesetInfo.resolutions\n .map((x: number) => +x)\n .sort((a: number, b: number) => b - a);\n\n const xTiles = tileProxy.calculateTilesFromResolution(\n sortedResolutions[zoomLevel],\n this._xScale,\n this.tilesetInfo.min_pos[0],\n this.tilesetInfo.max_pos[0]\n );\n\n let yTiles: number[] | undefined;\n if (Is2DTrack(this.getResolvedTracks()[0])) {\n // it makes sense only when the y-axis is being used for a genomic field\n yTiles = tileProxy.calculateTilesFromResolution(\n sortedResolutions[zoomLevel],\n this._yScale,\n this.tilesetInfo.min_pos[0],\n this.tilesetInfo.max_pos[0]\n );\n }\n\n const tiles = GoslingTrackClass.#tilesToId(xTiles, yTiles, zoomLevel);\n\n this.setVisibleTiles(tiles);\n } else {\n const xTiles = tileProxy.calculateTiles(\n zoomLevel,\n this.relevantScale(),\n this.tilesetInfo.min_pos[0],\n this.tilesetInfo.max_pos[0],\n this.tilesetInfo.max_zoom,\n this.tilesetInfo.max_width\n );\n\n let yTiles: number[] | undefined;\n if (Is2DTrack(this.getResolvedTracks()[0])) {\n // it makes sense only when the y-axis is being used for a genomic field\n yTiles = tileProxy.calculateTiles(\n zoomLevel,\n this._yScale,\n this.tilesetInfo.min_pos[1],\n this.tilesetInfo.max_pos[1],\n this.tilesetInfo.max_zoom,\n // @ts-expect-error what is max_width1?\n this.tilesetInfo.max_width1 ?? this.tilesetInfo.max_width\n );\n }\n\n const tiles = GoslingTrackClass.#tilesToId(xTiles, yTiles, zoomLevel);\n this.setVisibleTiles(tiles);\n }\n }\n }\n /**\n * Convert tile positions to tile IDs\n */\n static #tilesToId(\n xTiles: number[],\n yTiles: number[] | undefined,\n zoomLevel: number\n ): [number, number][] | [number, number, number][] {\n if (!yTiles) {\n // this means only the `x` axis is being used\n return xTiles.map(x => [zoomLevel, x]);\n }\n // this means both `x` and `y` axes are being used together\n const tiles: [number, number, number][] = [];\n xTiles.forEach(x => yTiles.forEach(y => tiles.push([zoomLevel, x, y])));\n return tiles;\n }\n\n /**\n * Get the tile's position in its coordinate system. Overrides method in Tiled1DPixiTrack.\n */\n override getTilePosAndDimensions(zoomLevel: number, tilePos: [number, number]) {\n if (!this.tilesetInfo) {\n throw Error('tilesetInfo not parsed');\n }\n\n if ('resolutions' in this.tilesetInfo) {\n const sortedResolutions = this.tilesetInfo.resolutions\n .map((x: number) => +x)\n .sort((a: number, b: number) => b - a);\n\n // A resolution specifies the number of BP per bin\n const chosenResolution = sortedResolutions[zoomLevel];\n\n const [xTilePos, yTilePos] = tilePos;\n\n const tileWidth = chosenResolution * this.#binsPerTile;\n const tileHeight = tileWidth;\n\n const tileX = tileWidth * xTilePos;\n const tileY = tileHeight * yTilePos;\n\n return {\n tileX,\n tileY,\n tileWidth,\n tileHeight\n };\n } else {\n const [xTilePos, yTilePos] = tilePos;\n\n const minX = this.tilesetInfo.min_pos[0];\n\n const minY = this.tilesetInfo.min_pos[1];\n\n const tileWidth = this.tilesetInfo.max_width / 2 ** zoomLevel;\n const tileHeight = this.tilesetInfo.max_width / 2 ** zoomLevel;\n\n const tileX = minX + xTilePos * tileWidth;\n const tileY = minY + yTilePos * tileHeight;\n\n return {\n tileX,\n tileY,\n tileWidth,\n tileHeight\n };\n }\n }\n get #binsPerTile() {\n let maybeValue: number | undefined;\n if (this.tilesetInfo) {\n maybeValue =\n 'bins_per_dimension' in this.tilesetInfo\n ? this.tilesetInfo.bins_per_dimension\n : this.tilesetInfo.tile_size;\n }\n return maybeValue ?? 256;\n }\n\n /**\n * Gets the indices of the visible data a tile. Overrides method in Tiled1DPixiTrack\n */\n override getIndicesOfVisibleDataInTile(tile: Tile): [number, number] {\n const visible = this._xScale.range();\n\n if (!this.tilesetInfo || !tile.tileData.tilePos || !('dense' in tile.tileData)) {\n return [0, 0];\n }\n\n const { tileX, tileWidth } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos);\n\n const tileXScale = HGC.libraries.d3Scale\n .scaleLinear()\n .domain([0, this.#binsPerTile])\n .range([tileX, tileX + tileWidth]);\n\n const start = Math.max(0, Math.round(tileXScale.invert(this._xScale.invert(visible[0]))));\n const end = Math.min(\n tile.tileData.dense.length,\n Math.round(tileXScale.invert(this._xScale.invert(visible[1])))\n );\n\n return [start, end];\n }\n\n /**\n * Overrides method in TiledPixiTrack\n * @param loadedTiles\n */\n override receivedTiles(loadedTiles: Record) {\n // https://github.com/higlass/higlass/blob/38f0c4415f0595c3b9d685a754d6661dc9612f7c/app/scripts/TiledPixiTrack.js#L637\n super.receivedTiles(loadedTiles);\n // some items in this.fetching are removed\n isTabularDataFetcher(this.dataFetcher) && this.drawLoadingCue();\n }\n\n /**\n * Overrides method in TiledPixiTrack\n */\n override removeOldTiles() {\n super.removeOldTiles(); // some items are added to this.fetching\n isTabularDataFetcher(this.dataFetcher) && this.drawLoadingCue();\n }\n\n /**\n * Combile multiple tiles into the last tile.\n * This is sometimes necessary, for example, when applying a displacement algorithm to all tiles at once.\n * Called by this.processAllTiles() so this method needs to be public.\n */\n combineAllTilesIfNeeded() {\n if (!this.shouldCombineTiles()) return;\n\n const tiles = this.visibleAndFetchedTiles();\n\n if (!tiles || tiles.length <= 1) {\n // Does not make sense to combine tiles\n return;\n }\n\n // Increase the size of tiles by length\n this.tileSize = (this.tilesetInfo?.tile_size ?? 1024) * tiles.length;\n\n let merged: Datum[] = [];\n\n tiles.forEach((tile, i) => {\n const tileInfo = this.#processedTileInfo[tile.tileId];\n if (tileInfo) {\n // Combine data\n merged = [...merged, ...tileInfo.tabularData];\n\n // Since we merge the data to the first one, skip rendering the rest\n tileInfo.skipRendering = i !== 0;\n }\n });\n\n const firstTileInfo = this.#processedTileInfo[tiles[0].tileId];\n firstTileInfo.tabularData = merged;\n\n // Remove duplicated if any. Sparse tiles can have duplications.\n if (firstTileInfo.tabularData[0]?.uid) {\n firstTileInfo.tabularData = uniqBy(firstTileInfo.tabularData, 'uid');\n }\n }\n /**\n * Check whether tiles should be merged. Needs to be public since called by combineAllTilesIfNeeded()\n */\n shouldCombineTiles() {\n const includesDisplaceTransform = hasDataTransform(this.options.spec, 'displace');\n // we do not need to combine dense tiles (from multivec, vector, matrix)\n const hasDenseTiles = () => {\n const tiles = this.visibleAndFetchedTiles();\n return tiles.length >= 1 && 'dense' in tiles[0].tileData;\n };\n // BAM data fetcher already combines the datasets;\n const isBamDataFetcher = this.dataFetcher instanceof BamDataFetcher;\n return includesDisplaceTransform && !hasDenseTiles() && !isBamDataFetcher;\n }\n\n /**\n * Creates an array of SingleTracks if there are overlaid tracks.\n * This method cannot be private because it is called by functions which are called by super.draw();\n */\n getResolvedTracks(forceUpdate = false) {\n if (forceUpdate || !this.resolvedTracks) {\n const tracks = resolveSuperposedTracks(this.options.spec).filter(t => t.mark !== 'brush');\n // We will never need to access the values field in the data spec. It can be quite large which can degrade performance so we remove it.\n tracks.forEach(track => {\n if ('values' in track.data) {\n track.data.values = [];\n }\n });\n this.resolvedTracks = tracks;\n }\n // Brushes are drawn by another plugin track.\n\n return this.resolvedTracks;\n }\n\n /**\n * Construct tabular data from a higlass tileset and a gosling track model.\n */\n #generateTabularData(tile: Tile, force = false) {\n if (this.#processedTileInfo[tile.tileId] && !force) {\n // we do not need to re-construct tabular data\n return;\n }\n\n if (!tile.tileData.tilePos) {\n // we do not have this information ready yet, i.e., cannot calculate `tileX`\n return;\n }\n\n const tileInfo = initProcessedTileInfo();\n const resolvedTracks = this.getResolvedTracks();\n\n if (resolvedTracks.length === 0) {\n // we do not have enough track to display\n return [];\n }\n\n /* Create tabular data */\n // The data spec is identical in all overlaid tracks, so we only need the first one.\n const firstResolvedTrack = resolvedTracks[0];\n\n if ('tabularData' in tile.tileData) {\n // some data fetchers directly generates `tabularData`\n tileInfo.tabularData = tile.tileData.tabularData;\n } else {\n // generate tabular data\n const { tileX, tileY, tileWidth, tileHeight } = this.getTilePosAndDimensions(\n tile.tileData.zoomLevel,\n tile.tileData.tilePos\n );\n\n const sparse = 'length' in tile.tileData ? Array.from(tile.tileData) : [];\n\n const extendedTileData = Object.assign({}, tile.tileData, {\n sparse,\n tileX,\n tileY,\n tileWidth,\n tileHeight,\n tileSize: this.tileSize\n });\n\n const tabularData = getTabularData(firstResolvedTrack, extendedTileData);\n if (tabularData) {\n tileInfo.tabularData = tabularData;\n }\n }\n\n this.#processedTileInfo[tile.tileId] = tileInfo;\n }\n\n /**\n * Apply data transformation to each of the overlaid tracks and generate GoslingTrackModels.\n */\n transformDataAndCreateModels(tile: Tile) {\n const tileInfo = this.#processedTileInfo[tile.tileId];\n\n if (!tileInfo || tileInfo.skipRendering) {\n // this probably means the tile data has been merged to another tile\n // so, no need to create track models\n return [];\n }\n\n // clear the array first\n tileInfo.goslingModels = [];\n\n const resolvedTracks = this.getResolvedTracks();\n resolvedTracks.forEach(resolvedSpec => {\n let tabularDataTransformed = Array.from(tileInfo.tabularData);\n resolvedSpec.dataTransform?.forEach(t => {\n switch (t.type) {\n case 'filter':\n tabularDataTransformed = filterData(t, tabularDataTransformed);\n break;\n case 'concat':\n tabularDataTransformed = concatString(t, tabularDataTransformed);\n break;\n case 'replace':\n tabularDataTransformed = replaceString(t, tabularDataTransformed);\n break;\n case 'log':\n tabularDataTransformed = calculateData(t, tabularDataTransformed);\n break;\n case 'exonSplit':\n tabularDataTransformed = splitExon(t, tabularDataTransformed, resolvedSpec.assembly);\n break;\n case 'genomicLength':\n tabularDataTransformed = calculateGenomicLength(t, tabularDataTransformed);\n break;\n case 'svType':\n tabularDataTransformed = inferSvType(t, tabularDataTransformed);\n break;\n case 'coverage':\n tabularDataTransformed = aggregateCoverage(t, tabularDataTransformed, this._xScale.copy());\n break;\n case 'subjson':\n tabularDataTransformed = parseSubJSON(t, tabularDataTransformed);\n break;\n case 'displace':\n tabularDataTransformed = displace(t, tabularDataTransformed, this._xScale.copy());\n break;\n }\n });\n\n // TODO: Remove the following block entirely and use the `rawData` API in the Editor (June-02-2022)\n // Send data preview to the editor so that it can be shown to users.\n try {\n if (PubSub) {\n const NUM_OF_ROWS_IN_PREVIEW = 100;\n const numOrRows = tabularDataTransformed.length;\n PubSub.publish('data-preview', {\n id: context.viewUid,\n // TODO: Do we need the stringified version? Stringify of large JSON data is very slow.\n dataConfig: JSON.stringify({ data: resolvedSpec.data }),\n data:\n NUM_OF_ROWS_IN_PREVIEW > numOrRows\n ? tabularDataTransformed\n : sampleSize(tabularDataTransformed, NUM_OF_ROWS_IN_PREVIEW)\n // ...\n });\n }\n } catch (e) {\n // ..\n }\n\n // Replace width and height information with the actual values for responsive encoding\n const [trackWidth, trackHeight] = this.dimensions; // actual size of a track\n const axisSize = IsXAxis(resolvedSpec) ? HIGLASS_AXIS_SIZE : 0; // Why the axis size must be added here?\n const [w, h] = [trackWidth, trackHeight + axisSize];\n const circularFactor = Math.min(w, h) / Math.min(resolvedSpec.width!, resolvedSpec.height!);\n if (resolvedSpec.innerRadius) {\n resolvedSpec.innerRadius = resolvedSpec.innerRadius * circularFactor;\n }\n if (resolvedSpec.outerRadius) {\n resolvedSpec.outerRadius = resolvedSpec.outerRadius * circularFactor;\n }\n resolvedSpec.width = w;\n resolvedSpec.height = h;\n\n // Construct separate gosling models for individual tiles\n const model = new GoslingTrackModel(resolvedSpec, tabularDataTransformed, this.options.theme);\n\n // Add a track model to the tile object\n tileInfo.goslingModels.push(model);\n });\n\n return tileInfo.goslingModels;\n }\n\n /* *\n *\n * Mouse methods\n *\n * */\n\n #onMouseDown(mouseX: number, mouseY: number, isAltPressed: boolean) {\n // Record these so that we do not triger click event when dragged.\n this.#mouseDownX = mouseX;\n this.#mouseDownY = mouseY;\n\n // Determine whether to activate a range brush\n const mouseEvents = this.options.spec.experimental?.mouseEvents;\n const rangeSelectEnabled = !!mouseEvents || (IsMouseEventsDeep(mouseEvents) && !!mouseEvents.rangeSelect);\n this.#isRangeBrushActivated = rangeSelectEnabled && isAltPressed;\n\n this.pMouseHover.clear();\n }\n\n #onMouseMove(mouseX: number) {\n if (this.options.spec.layout === 'circular') {\n // TODO: We do not yet support range selection on circular tracks\n return;\n }\n\n if (this.#isRangeBrushActivated) {\n this.mRangeBrush.updateRange([mouseX, this.#mouseDownX]).drawBrush().visible().disable();\n }\n }\n\n #onMouseUp(mouseX: number, mouseY: number) {\n // `trackClick` API\n this.#publishTrackEvents('trackClick', mouseX, mouseY);\n\n const mouseEvents = this.options.spec.experimental?.mouseEvents;\n const clickEnabled = !!mouseEvents || (IsMouseEventsDeep(mouseEvents) && !!mouseEvents.click);\n const isDrag = Math.sqrt((this.#mouseDownX - mouseX) ** 2 + (this.#mouseDownY - mouseY) ** 2) > 1;\n\n if (!this.#isRangeBrushActivated && !isDrag) {\n // Clicking outside the brush should remove the brush and the selection.\n this.mRangeBrush.clear();\n this.pMouseSelection.clear();\n } else {\n // Dragging ended, so enable adjusting the range brush\n this.mRangeBrush.enable();\n }\n\n this.#isRangeBrushActivated = false;\n\n if (!this.tilesetInfo) {\n // Do not have enough information\n return;\n }\n\n // `click` API\n if (!isDrag && clickEnabled) {\n // Identify the current position\n const genomicPosition = getRelativeGenomicPosition(\n Math.floor(this._xScale.invert(mouseX)),\n this.#assembly\n );\n\n // Get elements within mouse\n const capturedElements = this.#getElementsWithinMouse(mouseX, mouseY);\n\n if (capturedElements.length !== 0) {\n this.options.siblingIds.forEach(id =>\n publish('click', {\n id,\n genomicPosition,\n data: capturedElements.map(d => d.value)\n })\n );\n }\n }\n }\n\n #onMouseOut() {\n this.#isRangeBrushActivated = false;\n document.body.style.cursor = 'default';\n this.pMouseHover.clear();\n }\n\n /**\n * From all tiles and overlaid tracks, collect element(s) that are withing a mouse position.\n */\n #getElementsWithinMouse(mouseX: number, mouseY: number) {\n const models = this.visibleAndFetchedGoslingModels();\n\n // TODO: `Omit` this properties in the schema of individual overlaid tracks.\n // These should be defined only once for a group of overlaid traks (09-May-2022)\n // See https://github.com/gosling-lang/gosling.js/issues/677\n const mouseEvents = this.options.spec.experimental?.mouseEvents;\n const multiHovering = IsMouseEventsDeep(mouseEvents) && mouseEvents.enableMouseOverOnMultipleMarks;\n const idField = IsMouseEventsDeep(mouseEvents) && mouseEvents.groupMarksByField;\n\n // Collect all mouse event data from tiles and overlaid tracks\n const mergedCapturedElements: MouseEventData[] = models\n .map(model => model.getMouseEventModel().findAll(mouseX, mouseY, true))\n .flat();\n\n if (!multiHovering) {\n // Select only one on the top of a cursor\n mergedCapturedElements.splice(1, mergedCapturedElements.length - 1);\n }\n\n // Iterate again to select sibling marks (e.g., entire glyphs)\n if (mergedCapturedElements.length !== 0 && idField) {\n const source = Array.from(mergedCapturedElements);\n models.forEach(model => {\n const siblings = model.getMouseEventModel().getSiblings(source, idField);\n mergedCapturedElements.push(...siblings);\n });\n }\n\n return mergedCapturedElements;\n }\n\n /**\n * Call track events (e.g., `trackClick` or `trackMouseOver`) based on a mouse position and the track display area.\n */\n #publishTrackEvents(eventType: 'trackClick' | 'trackMouseOver', mouseX: number, mouseY: number) {\n const [x, y] = this.position;\n const [width, height] = this.dimensions;\n if (this.options.spec.layout === 'circular') {\n const cx = x + width / 2.0;\n const cy = y + height / 2.0;\n const innerRadius = this.options.spec.innerRadius!;\n const outerRadius = this.options.spec.outerRadius!;\n const startAngle = this.options.spec.startAngle!;\n const endAngle = this.options.spec.endAngle!;\n // Call the API function only when the mouse is positioned directly on the track display area\n if (\n isPointInsideDonutSlice(\n [mouseX, mouseY],\n [width / 2.0, height / 2.0],\n [innerRadius, outerRadius],\n [startAngle, endAngle]\n )\n ) {\n publish(eventType, {\n id: context.viewUid,\n spec: this.options.spec,\n shape: { x, y, width, height, cx, cy, innerRadius, outerRadius, startAngle, endAngle }\n });\n }\n } else {\n publish(eventType, {\n id: context.viewUid,\n spec: this.options.spec,\n shape: { x, y, width, height }\n });\n }\n }\n\n #onRangeBrush(range: [number, number] | null, skipApiTrigger = false) {\n this.pMouseSelection.clear();\n\n if (range === null) {\n // brush just removed\n if (!skipApiTrigger) {\n publish('rangeSelect', { id: context.viewUid, genomicRange: null, data: [] });\n }\n return;\n }\n\n const models = this.visibleAndFetchedGoslingModels();\n const [startX, endX] = range;\n\n // Collect all mouse event data from tiles and overlaid tracks\n let capturedElements: MouseEventData[] = models\n .map(model => model.getMouseEventModel().findAllWithinRange(startX, endX, true))\n .flat();\n\n // Deselect marks if their siblings are not selected.\n // e.g., if only one exon is selected in a gene, we do not select it.\n const mouseEvents = this.options.spec.experimental?.mouseEvents;\n const idField = IsMouseEventsDeep(mouseEvents) && mouseEvents.groupMarksByField;\n if (capturedElements.length !== 0 && idField) {\n models.forEach(model => {\n const siblings = model.getMouseEventModel().getSiblings(capturedElements, idField);\n const siblingIds = Array.from(new Set(siblings.map(d => d.value[idField])));\n capturedElements = capturedElements.filter(d => siblingIds.indexOf(d.value[idField]) === -1);\n });\n }\n\n if (capturedElements.length !== 0) {\n // selection effect graphics\n const g = this.pMouseSelection;\n\n if (this.options.spec.style?.select?.arrange !== 'behind') {\n // place on the top\n this.pMain.removeChild(g);\n this.pMain.addChild(g);\n }\n\n this.#highlightMarks(\n g,\n capturedElements,\n Object.assign({}, DEFAULT_MOUSE_EVENT_STYLE, this.options.spec.style?.select)\n );\n }\n\n /* API call */\n if (!skipApiTrigger) {\n const genomicRange: [GenomicPosition, GenomicPosition] = [\n getRelativeGenomicPosition(Math.floor(this._xScale.invert(startX)), this.#assembly),\n getRelativeGenomicPosition(Math.floor(this._xScale.invert(endX)), this.#assembly)\n ];\n\n publish('rangeSelect', {\n id: context.viewUid,\n genomicRange,\n data: capturedElements.map(d => d.value)\n });\n }\n\n this.forceDraw();\n }\n\n /**\n * Highlight marks that are either mouse overed or selected.\n */\n #highlightMarks(\n g: PIXI.Graphics,\n marks: MouseEventData[],\n style: {\n stroke: string;\n strokeWidth: number;\n strokeOpacity: number;\n color: string;\n opacity: number;\n }\n ) {\n g.lineStyle(\n style.strokeWidth,\n colorToHex(style.stroke),\n style.strokeOpacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex(style.color), style.color === 'none' ? 0 : style.opacity);\n\n marks.forEach(d => {\n if (d.type === 'point') {\n const [x, y, r = 3] = d.polygon;\n g.drawCircle(x, y, r);\n } else if (d.type === 'line') {\n g.moveTo(d.polygon[0], d.polygon[1]);\n flatArrayToPairArray(d.polygon).map(d => g.lineTo(d[0], d[1]));\n } else {\n g.drawPolygon(d.polygon);\n }\n });\n }\n\n hideMousePosition?: () => void; // set in HorizontalTiled1DPixiTrack\n\n /**\n * Overrides method in HorizontalLine1DPixiTrack\n */\n override getMouseOverHtml(mouseX: number, mouseY: number) {\n // `trackMouseOver` API\n this.#publishTrackEvents('trackMouseOver', mouseX, mouseY);\n\n if (this.#isRangeBrushActivated) {\n // In the middle of drawing range brush.\n return '';\n }\n\n if (!this.tilesetInfo) {\n // Do not have enough information\n return '';\n }\n\n this.pMouseHover.clear();\n\n // Current position\n const genomicPosition = getRelativeGenomicPosition(Math.floor(this._xScale.invert(mouseX)), this.#assembly);\n\n // Get elements within mouse\n const capturedElements = this.#getElementsWithinMouse(mouseX, mouseY);\n\n // Change cursor\n // https://developer.mozilla.org/en-US/docs/Web/CSS/cursor\n if (capturedElements.length !== 0) {\n document.body.style.cursor = 'pointer';\n } else {\n document.body.style.cursor = 'default';\n }\n\n if (capturedElements.length !== 0) {\n const mouseEvents = this.options.spec.experimental?.mouseEvents;\n const mouseOverEnabled = !!mouseEvents || (IsMouseEventsDeep(mouseEvents) && !!mouseEvents.mouseOver);\n if (mouseOverEnabled) {\n // Display mouse over effects\n const g = this.pMouseHover;\n\n if (this.options.spec.style?.mouseOver?.arrange !== 'behind') {\n // place on the top\n this.pMain.removeChild(g);\n this.pMain.addChild(g);\n }\n\n this.#highlightMarks(\n g,\n capturedElements,\n Object.assign({}, DEFAULT_MOUSE_EVENT_STYLE, this.options.spec.style?.mouseOver)\n );\n\n // API call\n publish('mouseOver', {\n id: context.viewUid,\n genomicPosition,\n data: capturedElements.map(d => d.value)\n });\n }\n\n // Display a tooltip\n const models = this.visibleAndFetchedGoslingModels();\n\n const firstTooltipSpec = models\n .find(m => m.spec().tooltip && m.spec().tooltip?.length !== 0)\n ?.spec().tooltip;\n\n if (firstTooltipSpec) {\n let content = firstTooltipSpec\n .map(d => {\n const rawValue = capturedElements[0].value[d.field];\n let value = rawValue;\n if (d.type === 'quantitative' && d.format) {\n value = HGC.libraries.d3Format.format(d.format)(+rawValue);\n } else if (d.type === 'genomic') {\n // e.g., chr1:204,133\n const { chromosome, position } = getRelativeGenomicPosition(+rawValue, this.#assembly);\n value = `${chromosome}:${HGC.libraries.d3Format.format(',')(position)}`;\n }\n\n return (\n '' +\n `${d.alt ?? d.field}` +\n `${value}` +\n ''\n );\n })\n .join('');\n\n content = `${content}
`;\n if (capturedElements.length > 1) {\n content +=\n `
` +\n `${capturedElements.length - 1} Additional Selections...` +\n '
';\n }\n return `
${content}
`;\n }\n }\n return '';\n }\n\n /**\n * Javscript subscription API methods (besides for mouse)\n */\n\n /**\n * Publishes track information. Triggered when track gets created\n */\n #publishOnNewTrack() {\n publish('onNewTrack', {\n id: context.viewUid\n });\n }\n\n /* *\n *\n * Other misc methods and overrides\n *\n * */\n\n /**\n * Returns the minimum in the visible area (not visible tiles).\n * Overrides method in Tiled1DPixiTrack\n */\n override minVisibleValue() {\n return 0;\n }\n\n /**\n * Returns the maximum in the visible area (not visible tiles).\n * Overrides method in Tiled1DPixiTrack.\n */\n override maxVisibleValue() {\n return 0;\n }\n /**\n * Overrides method in PixiTrack. SVG export is not supported.\n */\n override exportSVG(): never {\n throw new Error('exportSVG() not supported for gosling-track');\n }\n\n /**\n * Show visual cue during waiting for visualizations being rendered. Also called by data fetchers\n */\n drawLoadingCue() {\n if (this.fetching.size) {\n const margin = 6;\n\n const text = `Fetching... ${Array.from(this.fetching).join(' ')}`;\n this.#loadingText.text = text;\n this.#loadingText.x = this.position[0] + this.dimensions[0] - margin / 2.0;\n this.#loadingText.y = this.position[1] + this.dimensions[1] - margin / 2.0;\n\n // Show background\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, this.#loadingTextStyleObj);\n const { width: w, height: h } = metric;\n\n this.#loadingTextBg.clear();\n this.#loadingTextBg.lineStyle(1, colorToHex('grey'), 1, 0.5);\n this.#loadingTextBg.beginFill(colorToHex('white'), 0.8);\n this.#loadingTextBg.drawRect(\n this.position[0] + this.dimensions[0] - w - margin - 1,\n this.position[1] + this.dimensions[1] - h - margin - 1,\n w + margin,\n h + margin\n );\n\n this.#loadingText.visible = true;\n this.#loadingTextBg.visible = true;\n } else {\n this.#loadingText.visible = false;\n this.#loadingTextBg.visible = false;\n }\n }\n\n /**\n * Called in legend.ts\n */\n updateScaleOffsetFromOriginalSpec(\n _renderingId: string,\n scaleOffset: [number, number],\n channelKey: 'color' | 'stroke'\n ) {\n this.getResolvedTracks().map(spec => {\n if (spec._renderingId === _renderingId) {\n const channel = spec[channelKey];\n if (IsChannelDeep(channel)) {\n channel.scaleOffset = scaleOffset;\n }\n }\n });\n }\n\n /**\n * Called in legend.ts\n */\n shareScaleOffsetAcrossTracksAndTiles(scaleOffset: [number, number], channelKey: 'color' | 'stroke') {\n const models = this.visibleAndFetchedGoslingModels();\n models.forEach(d => {\n const channel = d.spec()[channelKey];\n if (IsChannelDeep(channel)) {\n channel.scaleOffset = scaleOffset;\n }\n const channelOriginal = d.originalSpec()[channelKey];\n if (IsChannelDeep(channelOriginal)) {\n channelOriginal.scaleOffset = scaleOffset;\n }\n });\n }\n\n /**\n * Used in drawTile()\n * Checks if the track has marks which are stretchable. Stretching\n * is not supported for circular layouts or 2D tracks\n */\n #hasStretchableGraphics() {\n const hasStretchOption = this.options.spec.experimental?.stretchGraphics;\n if (hasStretchOption === true) {\n return true;\n } else if (hasStretchOption === false) {\n return false;\n }\n // The default behavior is that we stretch when stretching looks acceptable\n const isFirstTrack1D = !Is2DTrack(this.getResolvedTracks()[0]);\n const isNotCircularLayout = this.options.spec.layout !== 'circular';\n const stretchableMarks = ['bar', 'line', 'rect', 'area'];\n const hasStretchableMark = this.getResolvedTracks().reduce(\n (acc, spec) => acc && stretchableMarks.includes(spec.mark),\n true\n );\n const noMouseInteractions = !this.options.spec.experimental?.mouseEvents;\n\n return isFirstTrack1D && isNotCircularLayout && hasStretchableMark && noMouseInteractions;\n }\n\n /**\n * Used in drawTile()\n * Checks if the tile Graphic is too stretched. If so, it returns true.\n * @param stretchFactor The factor by which the tile is stretched\n * @returns True if the tile is too stretched, false otherwise\n */\n #isTooStretched(stretchFactor: number) {\n const defaultThreshold = 1.5;\n const threshold = this.options.spec.experimental?.stretchGraphicsThreshold ?? defaultThreshold;\n return stretchFactor > threshold || stretchFactor < 1 / threshold;\n }\n }\n return new GoslingTrackClass();\n};\n\nexport default createPluginTrack(config, factory);\n","import { createPluginTrack, type PluginTrackFactory, type TrackConfig } from '../../core/utils/define-plugin-track';\nimport { publish } from '../../api/pubsub';\nimport { type DummyTrackStyle } from '@gosling-lang/gosling-schema';\n\ninterface DummyTrackOptions extends DummyTrackStyle {\n title: string;\n height: number;\n width: number;\n}\n\nconst config: TrackConfig = {\n type: 'dummy-track',\n defaultOptions: {\n height: 0, // default height gets set in when spec is preprocessed\n width: 0, // default width gets set in when spec is preprocessed\n title: '',\n background: '#fff',\n textFontSize: 12,\n textFontWeight: 'normal',\n textStroke: '#000',\n textStrokeWidth: 0.1,\n outline: '#fff'\n }\n};\n\nconst factory: PluginTrackFactory = (HGC, context, options) => {\n // Services\n const { SVGTrack } = HGC.tracks;\n\n class DummyTrackClass extends SVGTrack {\n constructor() {\n super(context, options);\n this.#drawBackground();\n this.#drawText();\n publish('onNewTrack', {\n id: context.viewUid\n });\n }\n\n #drawBackground() {\n this.gMain\n .append('rect')\n .attr('fill', options.background)\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', options.width)\n .attr('height', options.height)\n .style('stroke', options.outline);\n }\n /**\n * Draws the title of the dummy track\n */\n #drawText() {\n this.gMain\n .append('text')\n .attr('x', options.width / 2)\n .attr('y', (options.height + options.textFontSize!) / 2)\n .style('text-anchor', 'middle')\n .style('font-size', `${options.textFontSize}px`)\n .style('font-weight', options.textFontWeight)\n .style('stroke', options.textStroke)\n .style('stroke-width', options.textStrokeWidth)\n .text(options.title);\n }\n }\n\n return new DummyTrackClass();\n};\n\nexport default createPluginTrack(config, factory);\n","// @ts-ignore\nimport higlassRegister from 'higlass-register';\n// @ts-ignore\nimport { TextTrack } from 'higlass-text';\nimport { AxisTrack } from '@gosling-lang/gosling-genomic-axis';\nimport { BrushTrack } from '@gosling-lang/gosling-brush';\nimport { GoslingTrack } from '@gosling-lang/gosling-track';\nimport { DummyTrack } from '@gosling-lang/dummy-track';\nimport * as dataFetchers from '@data-fetchers';\n\nlet once = false;\n\n/**\n * Register plugin tracks and data fetchers to HiGlass. This is necessary for the first time before using Gosling.js.\n */\nexport function init() {\n if (once) return;\n\n /**\n * Register a linear Gosling.js track to HiGlassComponent\n */\n higlassRegister({\n name: 'GoslingTrack',\n track: GoslingTrack,\n config: GoslingTrack.config\n });\n\n /**\n * Register a 2D Gosling.js track to HiGlassComponent\n */\n higlassRegister({\n name: 'Gosling2DTrack',\n track: GoslingTrack,\n config: {\n ...GoslingTrack.config,\n type: 'gosling-2d-track',\n orientation: '2d'\n }\n });\n\n /**\n * Register an axis plugin track to HiGlassComponent\n */\n higlassRegister({\n name: 'AxisTrack',\n track: AxisTrack,\n config: AxisTrack.config\n });\n\n /**\n * Register a higlass-text plugin track to HiGlassComponent\n */\n higlassRegister({\n name: 'TextTrack',\n track: TextTrack,\n config: TextTrack.config\n });\n\n /**\n * Register a brush plugin track to HiGlassComponent\n */\n higlassRegister({\n name: 'BrushTrack',\n track: BrushTrack,\n config: BrushTrack.config\n });\n\n /**\n * Register a dummy plugin track to HiGlassComponent\n */\n higlassRegister({\n name: 'DummyTrack',\n track: DummyTrack,\n config: DummyTrack.config\n });\n\n /**\n * Register data fetchers to HiGlassComponent\n */\n for (const dataFetcher of Object.values(dataFetchers)) {\n const { config } = dataFetcher;\n higlassRegister({ dataFetcher, config }, { pluginType: 'dataFetcher' });\n }\n\n once = true;\n}\n","import type { MultipleViews, CommonViewDef, GoslingSpec, Track, SingleView } from '@gosling-lang/gosling-schema';\nimport { Is2DTrack, IsDummyTrack, IsOverlaidTrack, IsXAxis, IsYAxis } from '@gosling-lang/gosling-schema';\nimport { HIGLASS_AXIS_SIZE } from './higlass-model';\nimport {\n DEFAULT_CIRCULAR_VIEW_PADDING,\n DEFAULT_INNER_RADIUS_PROP,\n DEFAULT_VIEW_SPACING,\n DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM\n} from './defaults';\nimport { resolveSuperposedTracks } from '../core/utils/overlay';\nimport { traverseTracksAndViews, traverseViewArrangements } from './spec-preprocess';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\n\nexport interface Size {\n width: number;\n height: number;\n}\n\n/**\n * Position information of each track.\n */\nexport interface BoundingBox extends Size {\n x: number;\n y: number;\n}\n\n/**\n * Relative positioning of views, used in HiGlass view configs as `layout`.\n */\nexport interface RelativePosition {\n w: number;\n h: number;\n x: number;\n y: number;\n}\n\n/**\n * Track information for its arrangement.\n */\nexport interface TrackInfo {\n track: Track;\n boundingBox: BoundingBox;\n layout: RelativePosition;\n}\n\n/**\n * Return the size of entire visualization.\n * @param trackInfos\n */\nexport function getBoundingBox(trackInfos: TrackInfo[]) {\n let width = 0;\n let height = 0;\n\n trackInfos.forEach(_ => {\n const w = _.boundingBox.x + _.boundingBox.width;\n const h = _.boundingBox.y + _.boundingBox.height;\n if (height < h) {\n height = h;\n }\n if (width < w) {\n width = w;\n }\n });\n\n return { width, height };\n}\n\n/**\n * Collect information of individual tracks including their size/position and specs\n * @param spec\n */\nexport function getRelativeTrackInfo(\n spec: GoslingSpec,\n theme: CompleteThemeDeep\n): {\n trackInfos: TrackInfo[];\n size: { width: number; height: number };\n} {\n let trackInfos: TrackInfo[] = [] as TrackInfo[];\n\n // Collect track information including spec, bounding boxes, and RGL' `layout`.\n traverseAndCollectTrackInfo(spec, trackInfos); // RGL parameter (`layout`) is not deteremined yet since we do not know the entire size of vis yet.\n // Get the size of entire visualization.\n const size = getBoundingBox(trackInfos);\n\n // Titles\n if (spec.title || spec.subtitle) {\n // If title and/or subtitle presents, offset the y position by title/subtitle size\n const titleHeight =\n (spec.title ? (theme.root.titleFontSize ?? 18) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM : 0) +\n (spec.subtitle ? (theme.root.subtitleFontSize ?? 14) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM : 0);\n const marginBottom = 4;\n\n size.height += titleHeight + marginBottom;\n\n // !! The total height should be multiples of 8. Refer to `getBoundingBox()`\n size.height = size.height + (8 - (size.height % 8));\n\n // Offset all non-title tracks.\n trackInfos.forEach(_ => {\n _.boundingBox.y += titleHeight + marginBottom;\n });\n\n // Add a title track.\n trackInfos = [\n {\n track: getTextTrack({ width: size.width, height: titleHeight }, spec.title, spec.subtitle),\n boundingBox: { x: 0, y: 0, width: size.width, height: titleHeight },\n layout: { x: 0, y: 0, w: 12, h: (titleHeight / size.height) * 12.0 }\n },\n ...trackInfos\n ];\n } else {\n // !! The total height should be multiples of 8. Refer to `getBoundingBox()`\n size.height = size.height + (8 - (size.height % 8));\n }\n\n const pixelPreciseMarginPadding = !(typeof spec.responsiveSize !== 'object'\n ? spec.responsiveSize\n : spec.responsiveSize.height);\n\n // Calculate `layout`s for React Grid Layout (RGL).\n trackInfos.forEach(_ => {\n _.layout.x = (_.boundingBox.x / size.width) * 12;\n _.layout.w = (_.boundingBox.width / size.width) * 12;\n // If we set `pixelPreciseMarginPadding` `true`, we need to use actual values for `y` and `height`\n _.layout.y = pixelPreciseMarginPadding ? _.boundingBox.y : (_.boundingBox.y / size.height) * 12;\n _.layout.h = pixelPreciseMarginPadding ? _.boundingBox.height : (_.boundingBox.height / size.height) * 12;\n });\n\n return { trackInfos, size };\n}\n\n/**\n * Visit all tracks and views in the Gosling spec to collect information of individual tracks, including their size, position, and spec.\n * @param spec\n * @param output\n * @param dx\n * @param dy\n * @param forceWidth\n * @param forceHeight\n * @param circularRootNotFound\n */\nfunction traverseAndCollectTrackInfo(\n spec: GoslingSpec | SingleView,\n output: TrackInfo[],\n dx = 0,\n dy = 0,\n circularRootNotFound = true // A flag variable to find a root level of circular tracks/views\n) {\n let cumWidth = 0;\n let cumHeight = 0;\n\n /* Parameters to determine if we need to combine all the children to show as a single circular visualization */\n let allChildCircularLayout = true;\n let traversedAtLeastOnce = false;\n traverseTracksAndViews(spec, (tv: CommonViewDef) => {\n traversedAtLeastOnce = true;\n if (tv.layout !== 'circular') {\n allChildCircularLayout = false;\n }\n });\n\n let noChildConcatArrangement = true; // if v/hconcat is being used by children, circular visualizations should be adjacently placed.\n traverseViewArrangements(spec, (a: MultipleViews) => {\n if (a.arrangement === 'vertical' || a.arrangement === 'horizontal') {\n noChildConcatArrangement = false;\n }\n });\n\n const isThisCircularRoot =\n circularRootNotFound &&\n allChildCircularLayout &&\n traversedAtLeastOnce &&\n noChildConcatArrangement &&\n (('views' in spec && (spec.arrangement === 'parallel' || spec.arrangement === 'serial')) || 'tracks' in spec);\n\n const numTracksBeforeInsert = output.length;\n\n if ('tracks' in spec) {\n // following `traverseToFixSpecDownstream`, the width and height of each track are gaurenteed to be defined\n const tracks = spec.tracks as (Track & { width: number; height: number })[];\n\n if (spec.orientation === 'vertical') {\n // This is a vertical view, so use the largest `height` of the tracks for this view.\n cumHeight = Math.max(...tracks.map(d => d.height));\n tracks.forEach((track, i, array) => {\n if (getNumOfXAxes([track]) === 1) {\n track.width += HIGLASS_AXIS_SIZE;\n }\n\n track.height = cumHeight;\n\n output.push({\n track,\n boundingBox: {\n x: dx + cumWidth,\n y: dy,\n width: track.width,\n height: cumHeight\n },\n layout: { x: 0, y: 0, w: 0, h: 0 } // Just put a dummy info here, this should be added after entire bounding box has been determined\n });\n\n if (array[i + 1] && array[i + 1].overlayOnPreviousTrack) {\n // do not add a height\n } else {\n cumWidth += track.width;\n if (i !== array.length - 1) {\n cumWidth += spec.spacing !== undefined ? spec.spacing : 0;\n }\n }\n });\n } else {\n // This is a horizontal view, so use the largest `width` for this view.\n cumWidth = Math.max(...tracks.map(d => d.width)); //forceWidth ? forceWidth : spec.tracks[0]?.width;\n tracks.forEach((track, i, array) => {\n // let scaledHeight = track.height;\n\n if (getNumOfXAxes([track]) === 1) {\n track.height += HIGLASS_AXIS_SIZE;\n }\n const singleTrack = resolveSuperposedTracks(track);\n if (singleTrack.length > 0 && Is2DTrack(singleTrack[0]) && getNumOfYAxes([track]) === 1) {\n // If this is a 2D track (e.g., matrix), we need to reserve a space for the y-axis track\n cumWidth += HIGLASS_AXIS_SIZE;\n }\n\n track.width = cumWidth;\n\n output.push({\n track,\n boundingBox: {\n x: dx,\n y: dy + cumHeight,\n width: cumWidth,\n height: track.height\n },\n layout: { x: 0, y: 0, w: 0, h: 0 } // Just put a dummy info here, this should be added after entire bounding box has been determined\n });\n\n if (array[i + 1] && array[i + 1].overlayOnPreviousTrack) {\n // do not add a height\n } else {\n cumHeight += track.height;\n if (i !== array.length - 1) {\n cumHeight += spec.spacing !== undefined ? spec.spacing : 0;\n }\n }\n });\n }\n } else {\n // We did not reach a track definition, so continue traversing.\n\n // We first calculate position and size of each view and track by considering it as if it uses a linear layout\n if (spec.arrangement === 'parallel' || spec.arrangement === 'vertical') {\n const spacing = spec.spacing !== undefined ? spec.spacing : DEFAULT_VIEW_SPACING;\n\n spec.views.forEach((v, i, array) => {\n const viewBB = traverseAndCollectTrackInfo(\n v,\n output,\n dx + (v.xOffset ?? 0),\n dy + (v.yOffset ?? 0) + cumHeight,\n !isThisCircularRoot && circularRootNotFound\n );\n\n if (cumWidth < (v.xOffset ?? 0) + viewBB.width) {\n cumWidth = (v.xOffset ?? 0) + viewBB.width;\n }\n if (i !== array.length - 1) {\n cumHeight += spacing;\n }\n cumHeight += (v.yOffset ?? 0) + viewBB.height;\n });\n } else if (spec.arrangement === 'serial' || spec.arrangement === 'horizontal') {\n spec.views.forEach((v, i, array) => {\n const spacing = spec.spacing !== undefined ? spec.spacing : DEFAULT_VIEW_SPACING;\n\n // If so, we do not want to put large between-gap.\n // spacing *= (spec.arrangement === 'serial' && spec.layout === 'circular' ? 0.2 : 1);\n\n const viewBB = traverseAndCollectTrackInfo(\n v,\n output,\n dx + (v.xOffset ?? 0) + cumWidth,\n dy + (v.yOffset ?? 0),\n !isThisCircularRoot && circularRootNotFound\n );\n\n if (cumHeight < (v.xOffset ?? 0) + viewBB.height) {\n cumHeight = (v.xOffset ?? 0) + viewBB.height;\n }\n if (i !== array.length - 1) {\n cumWidth += spacing;\n }\n cumWidth += (v.xOffset ?? 0) + viewBB.width;\n });\n }\n }\n\n // If this is a root view that uses a circular layout, use the posiiton and size of views/tracks to calculate circular-specific parameters, such as outer/inner radius and start/end angle\n if (isThisCircularRoot) {\n const cTracks = output.slice(numTracksBeforeInsert);\n const ifMultipleViews =\n 'views' in spec &&\n (spec.arrangement === 'parallel' || spec.arrangement === 'serial') &&\n spec.views.length > 1;\n\n const SPACING = spec.spacing !== undefined ? spec.spacing : DEFAULT_VIEW_SPACING;\n const PADDING = DEFAULT_CIRCULAR_VIEW_PADDING;\n const INNER_RADIUS = spec.centerRadius !== undefined ? spec.centerRadius : DEFAULT_INNER_RADIUS_PROP;\n const TOTAL_RADIUS = cumWidth / 2.0 + PADDING; // (cumWidth + cumHeight) / 2.0 / 2.0;\n const TOTAL_RING_SIZE = TOTAL_RADIUS * (1 - INNER_RADIUS);\n\n // const numXAxes = getNumOfXAxes(cTracks.map(info => info.track));\n\n cTracks.forEach((t, i) => {\n // at this time, circular dummy tracks are not supported, so we don't do anything here\n if (IsDummyTrack(t.track)) {\n return;\n }\n t.track.layout = 'circular';\n\n t.track.outerRadius = TOTAL_RADIUS - PADDING - ((t.boundingBox.y - dy) / cumHeight) * TOTAL_RING_SIZE;\n t.track.innerRadius =\n TOTAL_RADIUS - PADDING - ((t.boundingBox.y + t.boundingBox.height - dy) / cumHeight) * TOTAL_RING_SIZE;\n\n // in circular layouts, we place spacing in the origin as well\n const spacingAngle = (SPACING / cumWidth) * 360;\n\n // !!! Multiplying by (cumWidth - SPACING) / cumWidth) to rescale to exclude SPACING\n t.track.startAngle =\n spacingAngle + ((((t.boundingBox.x - dx) / cumWidth) * (cumWidth - SPACING)) / cumWidth) * 360;\n t.track.endAngle =\n ((((t.boundingBox.x + t.boundingBox.width - dx) / cumWidth) * (cumWidth - SPACING)) / cumWidth) * 360;\n // t.track.startAngle = ((t.boundingBox.x - dx) / cumWidth) * 360;\n // t.track.endAngle = ((t.boundingBox.x + t.boundingBox.width - dx) / cumWidth) * 360;\n\n t.boundingBox.x = dx + (t.track.xOffset ?? 0);\n t.boundingBox.y = dy + (t.track.yOffset ?? 0);\n\n // Circular tracks share the same size and position since technically these tracks are being overlaid on top of the others\n t.boundingBox.height = t.track.height = t.boundingBox.width = t.track.width = TOTAL_RADIUS * 2;\n\n if (i !== 0) {\n t.track.overlayOnPreviousTrack = true;\n }\n\n // !!! As circular tracks are not well supported now when parallelized or serialized, we do not support brush for now.\n if (ifMultipleViews) {\n if (IsOverlaidTrack(t.track)) {\n t.track._overlay = t.track._overlay.filter(o => o.mark !== 'brush');\n }\n }\n });\n\n cumHeight = TOTAL_RADIUS * 2;\n }\n\n // DEBUG\n // console.log(output);\n\n // Record assigned sizes of this view so that we can determine whether to use alternative responsive spec\n spec._assignedWidth = cumWidth;\n spec._assignedHeight = cumHeight;\n\n return { x: dx, y: dy, width: cumWidth, height: cumHeight };\n}\n\nexport function getNumOfXAxes(tracks: Track[]): number {\n return tracks.filter(t => IsXAxis(t)).length;\n}\n\nexport function getNumOfYAxes(tracks: Track[]): number {\n return tracks.filter(t => IsYAxis(t)).length;\n}\n\n/**\n * Get a spec for a title track.\n * @param size\n * @param title\n * @param subtitle\n */\nconst getTextTrack = (size: Size, title?: string, subtitle?: string) => {\n return JSON.parse(\n JSON.stringify({\n mark: 'header',\n width: size.width,\n height: size.height,\n title,\n subtitle\n })\n ) as Track;\n};\n","export function validTilesetUrl(url: string) {\n if (!url.includes('tileset_info/?d=') || (!url.includes('https:') && !url.includes('http:'))) {\n return false;\n }\n return true;\n}\n\nexport function parseServerAndTilesetUidFromUrl(url: string) {\n if (!url.includes('tileset_info/?d=') || (!url.includes('https:') && !url.includes('http:'))) {\n // TODO: Add regular expression to validate the format.\n // console.warn(`Data url format is incorrect:${url}`);\n return { server: undefined, tilesetUid: undefined };\n }\n\n const server = url.split('tileset_info/?d=')[0];\n const tilesetUid = url.split('tileset_info/?d=')[1];\n return { server, tilesetUid };\n}\n","import type { Track as HiGlassTrack } from '@gosling-lang/higlass-schema';\nimport { HiGlassModel, HIGLASS_AXIS_SIZE } from './higlass-model';\nimport { parseServerAndTilesetUidFromUrl } from '../core/utils';\nimport type { Track, Domain } from '@gosling-lang/gosling-schema';\nimport type { BoundingBox, RelativePosition } from './bounding-box';\nimport { resolveSuperposedTracks } from '../core/utils/overlay';\nimport { getGenomicChannelKeyFromTrack, getGenomicChannelFromTrack } from '../gosling-schema/validate';\nimport {\n IsDataDeep,\n IsChannelDeep,\n IsDataDeepTileset,\n Is2DTrack,\n IsXAxis,\n IsHiGlassMatrix,\n getHiGlassColorRange,\n IsDummyTrack\n} from '@gosling-lang/gosling-schema';\nimport { DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM } from './defaults';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\nimport { DEFAULT_TEXT_STYLE } from '../core/utils/text-style';\nimport type { GoslingToHiGlassIdMapper } from '../api/track-and-view-ids';\nimport type { UrlToFetchOptions } from '../core/gosling-component';\nimport { uuid } from '../core/utils/uuid';\n\n/**\n * Convert a gosling track into a HiGlass view and add it into a higlass model.\n */\nexport function goslingToHiGlass(\n hgModel: HiGlassModel,\n gosTrack: Track,\n bb: BoundingBox,\n layout: RelativePosition,\n theme: Required,\n idMapper: GoslingToHiGlassIdMapper,\n urlToFetchOptions?: UrlToFetchOptions\n): HiGlassModel {\n // TODO: check whether there are multiple track.data across superposed tracks\n // ...\n\n // Adds the dummy track to the HiGlass spec\n if (IsDummyTrack(gosTrack)) {\n hgModel.addDefaultView(gosTrack.id!).setDummyTrack(gosTrack).setLayout(layout);\n return hgModel;\n }\n // we only look into the first resolved spec to get information, such as size of the track\n const resolvedSpecs = resolveSuperposedTracks(gosTrack);\n const firstResolvedSpec = resolvedSpecs[0];\n\n // If missing, create a unique track ID that will be used as HiGlass view ID for caching\n const trackId = firstResolvedSpec.id ?? uuid();\n if (!firstResolvedSpec.id) {\n firstResolvedSpec.id = trackId;\n }\n\n // Store the mapping between Gosling track ID and HiGlass view ID so that any lost track IDs\n // can be recovered and used for JS APIs.\n resolvedSpecs.forEach(spec => {\n // if `id` is not defined, no need to store it in the table\n if (spec.id) {\n idMapper.addMapping(spec.id, trackId);\n }\n });\n\n const assembly = firstResolvedSpec.assembly;\n\n if (IsDataDeep(firstResolvedSpec.data)) {\n let server, tilesetUid;\n\n if (IsDataDeepTileset(firstResolvedSpec.data)) {\n const parsed = parseServerAndTilesetUidFromUrl(firstResolvedSpec.data.url);\n server = parsed.server;\n tilesetUid = parsed.tilesetUid;\n }\n\n const genomicChannel = getGenomicChannelFromTrack(firstResolvedSpec);\n const genomicChannelKey = getGenomicChannelKeyFromTrack(firstResolvedSpec);\n const isXGenomic = genomicChannelKey === 'x' || genomicChannelKey === 'xe';\n const xDomain = isXGenomic && IsChannelDeep(genomicChannel) ? (genomicChannel.domain as Domain) : undefined;\n const yDomain =\n Is2DTrack(firstResolvedSpec) && IsChannelDeep(firstResolvedSpec.y)\n ? (firstResolvedSpec.y.domain as Domain)\n : undefined;\n const width =\n bb.width -\n (firstResolvedSpec.layout !== 'circular' &&\n firstResolvedSpec.orientation === 'vertical' &&\n IsXAxis(firstResolvedSpec)\n ? HIGLASS_AXIS_SIZE\n : 0);\n const height =\n bb.height -\n (firstResolvedSpec.layout !== 'circular' &&\n firstResolvedSpec.orientation === 'horizontal' &&\n IsXAxis(firstResolvedSpec)\n ? HIGLASS_AXIS_SIZE\n : 0);\n const hgTrack: HiGlassTrack = {\n uid: `${trackId}-track`, // This is being used to cache the visualization\n type: Is2DTrack(firstResolvedSpec) ? 'gosling-2d-track' : 'gosling-track',\n server,\n tilesetUid,\n width,\n height,\n options: {\n id: trackId,\n siblingIds: idMapper.getSiblingGoslingIds(trackId),\n /* Mouse hover position */\n showMousePosition: firstResolvedSpec.layout === 'circular' ? false : theme.root.showMousePosition, // show mouse position only for linear tracks // TODO: or vertical\n mousePositionColor: theme.root.mousePositionColor,\n /* Track title */\n name: firstResolvedSpec.layout === 'linear' ? firstResolvedSpec.title : ' ',\n labelPosition: firstResolvedSpec.title\n ? theme.track.titleAlign === 'left'\n ? 'topLeft'\n : 'topRight'\n : 'none',\n labelShowResolution: false,\n labelColor: theme.track.titleColor,\n labelBackgroundColor: theme.track.titleBackground,\n labelBackgroundOpacity: 0.5, // TODO: Support `theme.track.titleBackgroundOpacity`\n labelTextOpacity: 1,\n labelLeftMargin: 1,\n labelTopMargin: 1,\n labelRightMargin: 0,\n labelBottomMargin: 0,\n // TODO: Use this eventually\n // trackBorderWidth: firstResolvedSpec.style?.outlineWidth ?? 3,\n // trackBorderColor: firstResolvedSpec.style?.outline ?? '#DBDBDB',\n /* Others */\n backgroundColor: 'transparent', // in this way, we can superpose multiple tracks\n spec: { ...gosTrack },\n theme\n }\n };\n\n if (\n firstResolvedSpec.data &&\n IsDataDeep(firstResolvedSpec.data) &&\n (firstResolvedSpec.data.type === 'csv' ||\n firstResolvedSpec.data.type === 'json' ||\n firstResolvedSpec.data.type === 'bigwig' ||\n firstResolvedSpec.data.type === 'bam' ||\n firstResolvedSpec.data.type === 'vcf' ||\n firstResolvedSpec.data.type === 'gff' ||\n firstResolvedSpec.data.type === 'bed' ||\n // TODO: This is a hack to enable custom data fetchers\n (firstResolvedSpec.data as any).useCustomDataFetcher)\n ) {\n const getFieldName = (c: 'x' | 'xe' | 'x1' | 'x1e') => {\n const cDef = firstResolvedSpec[c];\n return cDef && IsChannelDeep(cDef) ? cDef.field : undefined;\n };\n const xFields = {\n x: getFieldName('x'),\n xe: getFieldName('xe'),\n x1: getFieldName('x1'),\n x1e: getFieldName('x1e')\n } as const;\n\n // Check whether there are any URL specific fetch options\n const urlFetchOptions =\n ('url' in firstResolvedSpec.data && urlToFetchOptions?.[firstResolvedSpec.data.url]) || {};\n const indexUrlFetchOptions =\n ('indexUrl' in firstResolvedSpec.data && urlToFetchOptions?.[firstResolvedSpec.data.indexUrl]) || {};\n\n // This object will be passed to the data fetchers\n hgTrack.data = {\n ...firstResolvedSpec.data,\n ...xFields,\n urlFetchOptions,\n indexUrlFetchOptions,\n // Additionally, add assembly, otherwise, a default genome build is used\n assembly\n // TODO: should look all sub tracks' `dataTransform` and apply OR operation.\n // Add a data transformation spec so that the fetcher can properly sample datasets\n // filter: (firstResolvedSpec as any).dataTransform?.filter((f: DataTransform) => f.type === 'filter')\n };\n }\n\n // We use higlass 'heatmap' track instead of 'gosling-track' for rendering performance.\n // HiGlass is really well-optimized for matrix visualization, and rendering it in Gosling\n // instead makes the zooming interaction slow.\n // See https://github.com/gosling-lang/gosling.js/pull/612#discussion_r771623844\n if (IsHiGlassMatrix(firstResolvedSpec)) {\n // By changing the track type, HiGlass uses its native heatmap track\n hgTrack.type = 'heatmap';\n const colorStr =\n IsChannelDeep(firstResolvedSpec.color) && typeof firstResolvedSpec.color.range === 'string'\n ? firstResolvedSpec.color.range\n : 'viridis';\n hgTrack.options.colorRange = getHiGlassColorRange(colorStr);\n hgTrack.options.trackBorderWidth = firstResolvedSpec.style?.outlineWidth ?? theme.track.outlineWidth;\n hgTrack.options.trackBorderColor = firstResolvedSpec.style?.outline ?? theme.track.outline;\n hgTrack.options.extent = firstResolvedSpec.style?.matrixExtent ?? 'full';\n hgTrack.options.colorbarPosition = (firstResolvedSpec.color as any)?.legend\n ? hgTrack.options.extent === 'lower-left'\n ? 'bottomLeft'\n : 'topRight'\n : 'hidden';\n }\n\n if (firstResolvedSpec.overlayOnPreviousTrack) {\n hgModel\n .setViewOrientation(firstResolvedSpec.orientation) // TODO: Orientation should be assigned to 'individual' views\n .addTrackToCombined(hgTrack);\n } else {\n hgModel\n .setViewOrientation(firstResolvedSpec.orientation) // TODO: Orientation should be assigned to 'individual' views\n .setAssembly(assembly) // TODO: Assembly should be assigned to 'individual' views\n .addDefaultView(trackId, assembly)\n .setDomain(xDomain, yDomain ?? xDomain)\n .adjustDomain(firstResolvedSpec.orientation, width, height)\n .setMainTrack(hgTrack)\n .addTrackSourceServers(server)\n .setZoomFixed(firstResolvedSpec.static === true)\n .setZoomLimits(firstResolvedSpec.zoomLimits ?? [1, null])\n .setLayout(layout);\n }\n\n // determine the compactness type of an axis considering the size of a track\n const getAxisNarrowType = (\n c: 'x' | 'y',\n orientation: 'horizontal' | 'vertical' = 'horizontal',\n width: number,\n height: number\n ) => {\n const narrowSizeThreshold = 400;\n const narrowerSizeThreshold = 200;\n\n if (orientation === 'horizontal') {\n if ((c === 'x' && width <= narrowerSizeThreshold) || (c === 'y' && height <= narrowerSizeThreshold)) {\n return 'narrower';\n } else if (\n (c === 'x' && width <= narrowSizeThreshold) ||\n (c === 'y' && height <= narrowSizeThreshold)\n ) {\n return 'narrow';\n } else {\n return 'regular';\n }\n } else {\n if ((c === 'x' && height <= narrowerSizeThreshold) || (c === 'y' && width <= narrowerSizeThreshold)) {\n return 'narrower';\n } else if (\n (c === 'x' && height <= narrowSizeThreshold) ||\n (c === 'y' && width <= narrowSizeThreshold)\n ) {\n return 'narrow';\n } else {\n return 'regular';\n }\n }\n };\n\n // check whether to show axis\n ['x', 'y'].forEach(c => {\n const channel = (firstResolvedSpec as any)[c];\n if (\n IsChannelDeep(channel) &&\n 'axis' in channel &&\n channel.axis &&\n channel.axis !== 'none' &&\n channel.type === 'genomic'\n ) {\n const narrowType = getAxisNarrowType(c as any, gosTrack.orientation, bb.width, bb.height);\n hgModel.setAxisTrack(channel.axis, narrowType, {\n id: `${trackId}-${channel.axis}-axis`,\n layout: firstResolvedSpec.layout,\n innerRadius:\n channel.axis === 'top'\n ? (firstResolvedSpec.outerRadius as number) - HIGLASS_AXIS_SIZE\n : firstResolvedSpec.innerRadius,\n outerRadius:\n channel.axis === 'top'\n ? firstResolvedSpec.outerRadius\n : (firstResolvedSpec.innerRadius as number) + HIGLASS_AXIS_SIZE,\n width: firstResolvedSpec.width,\n height: firstResolvedSpec.height,\n startAngle: firstResolvedSpec.startAngle,\n endAngle: firstResolvedSpec.endAngle,\n theme\n });\n }\n });\n\n hgModel.validateSpec(true);\n } else if (firstResolvedSpec.mark === 'header') {\n // `text` tracks are used to show title and subtitle of the views\n hgModel.addDefaultView(`${trackId}-title`).setLayout(layout);\n if (typeof firstResolvedSpec.title === 'string') {\n hgModel.setTextTrack(\n bb.width,\n (theme.root.titleFontSize ?? 18) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM,\n firstResolvedSpec.title,\n theme.root.titleColor,\n theme.root.titleFontSize ?? 18,\n theme.root.titleFontWeight,\n theme.root.titleAlign,\n theme.root.titleBackgroundColor,\n theme.root.titleFontFamily ?? DEFAULT_TEXT_STYLE.fontFamily\n );\n }\n if (typeof firstResolvedSpec.subtitle === 'string') {\n hgModel.setTextTrack(\n bb.width,\n // TODO: better way to safely get the value when undefined?\n (theme.root.subtitleFontSize ?? 14) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM,\n firstResolvedSpec.subtitle,\n theme.root.subtitleColor,\n theme.root.subtitleFontSize ?? 14,\n theme.root.subtitleFontWeight,\n theme.root.subtitleAlign,\n theme.root.subtitleBackgroundColor,\n theme.root.subtitleFontFamily ?? DEFAULT_TEXT_STYLE.fontFamily\n );\n }\n }\n\n // Uncomment the following code to test with specific HiGlass viewConfig\n // hgModel.setExampleHiglassViewConfig();\n\n return hgModel;\n}\n","import { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport type { HiGlassModel } from '../../compiler/higlass-model';\nimport { SUPPORTED_CHANNELS } from '../mark';\nimport { resolveSuperposedTracks } from './overlay';\n\n/**\n *\n */\nexport function getLinkingInfo(hgModel: HiGlassModel) {\n const linkingInfo: {\n layout: 'circular' | 'linear';\n hgViewId: string;\n linkId: string;\n isBrush: boolean;\n style: any;\n }[] = [];\n\n hgModel.spec().views.forEach(v => {\n const hgViewId = v.uid;\n\n // TODO: Better way to get view specifications?\n // Get spec of a view\n let spec = /* TODO: */ (v.tracks as any).center?.[0]?.contents?.[0]?.options?.spec;\n\n if (!spec) {\n // This means the orientation of this view is vertical, and spec might be positioned on the left\n spec = /* TODO: */ (v.tracks as any).left?.[0]?.contents?.[0]?.options?.spec;\n if (!spec) {\n // in case the first one is the axis track\n spec = /* TODO: */ (v.tracks as any).left?.[1]?.contents?.[0]?.options?.spec;\n }\n }\n\n if (!hgViewId || !spec) return;\n\n const resolved = resolveSuperposedTracks(spec);\n\n resolved.forEach(spec => {\n SUPPORTED_CHANNELS.forEach(cKey => {\n const channel = spec[cKey];\n\n if (IsChannelDeep(channel) && 'linkingId' in channel && channel.linkingId) {\n linkingInfo.push({\n layout: spec.layout === 'circular' ? 'circular' : 'linear',\n hgViewId,\n linkId: channel.linkingId,\n isBrush: spec.mark === 'brush',\n style: {\n color: (spec as any).color?.value,\n stroke: (spec as any).stroke?.value,\n strokeWidth: (spec as any).strokeWidth?.value,\n opacity: (spec as any).opacity?.value,\n startAngle: spec.startAngle,\n endAngle: spec.endAngle,\n innerRadius: spec.innerRadius,\n outerRadius: spec.outerRadius\n }\n });\n return;\n }\n });\n });\n });\n return linkingInfo;\n}\n","import type { CommonTrackDef, CommonViewDef, GoslingSpec, PartialTrack, View } from '@gosling-lang/gosling-schema';\nimport { traverseTracksAndViews } from '../compiler/spec-preprocess';\n\n/**\n * A table that maps Gosling track IDs to HiGlass view IDs.\n */\nexport type IdTable = Record;\n\n/**\n * Manage IDs of Gosling tracks and compiled HiGlass views.\n * The HiGlass view IDs correspond to the \"UIDs\" of HiGlass *views*,\n * which are used for calling HiGlass APIs internally in Gosling.js.\n * It is 1:1 or N:1 mapping between Gosling tracks IDs and HiGlass views IDs.\n * https://docs.higlass.io/view_config.html#uids\n */\nexport class GoslingToHiGlassIdMapper {\n /** A mapping table between Gosling track IDs to HiGlass view IDs */\n #table: IdTable = {};\n\n addMapping(gtId: string, hvId: string) {\n if (this.#table[gtId] && this.#table[gtId] !== hvId) {\n console.warn(`The track ID ${gtId} already exists but overwriting with a different ID.`);\n }\n this.#table[gtId] = hvId;\n }\n getTable() {\n return this.#table;\n }\n getGoslingIds() {\n return Object.keys(this.#table);\n }\n getHiGlassId(gtId: string) {\n return this.#table[gtId];\n }\n /**\n * Get IDs of Gosling tracks that became the same HiGlass view.\n * @param HiGlassId\n * @returns\n */\n getSiblingGoslingIds(HiGlassId: string) {\n return Object.entries(this.#table)\n .filter(([, hvId]) => hvId === HiGlassId)\n .map(([gtId]) => gtId);\n }\n}\n\n/**\n * Find all unique IDs of 'views' in a Gosling spec and return them as an array.\n * @param spec\n * @returns\n */\nexport function getViewIds(spec: GoslingSpec | View | PartialTrack) {\n const viewIds = new Set();\n if (spec.id) {\n // root view\n viewIds.add(spec.id);\n }\n traverseTracksAndViews(spec, subSpec => {\n if ('views' in subSpec || 'tracks' in subSpec) {\n // encountered a view\n if (subSpec.id) {\n // found a valid view id\n viewIds.add(subSpec.id);\n }\n }\n });\n return Array.from(viewIds);\n}\n\n/**\n * Find all unique IDs of 'tracks' in a Gosling spec and return them as an array.\n * @param spec\n * @returns\n */\nexport function getTrackIds(spec: GoslingSpec | View | PartialTrack) {\n const trackIds = new Set();\n traverseTracksAndViews(spec, subSpec => {\n if (!('views' in subSpec) && !('tracks' in subSpec)) {\n // encountered a track\n if (subSpec.id) {\n // found a valid track id\n trackIds.add(subSpec.id);\n }\n }\n });\n return Array.from(trackIds);\n}\n\n/**\n * Get an internal spec using an ID of a track or a view. `undefined` if unfound.\n * @param spec\n * @returns\n */\nexport function getInternalSpecById(spec: GoslingSpec | View | PartialTrack, id: string) {\n let internalSpec: CommonViewDef | CommonTrackDef | undefined;\n if (spec.id === id) {\n // root view\n internalSpec = spec;\n }\n traverseTracksAndViews(spec, subSpec => {\n if (subSpec.id === id) {\n internalSpec = subSpec;\n }\n });\n return internalSpec;\n}\n","import type { GoslingSpec, PartialTrack, TrackApiData, View } from '@gosling-lang/gosling-schema';\nimport { getInternalSpecById, getTrackIds, getViewIds } from '../api/track-and-view-ids';\n\n/**\n * This collect information of views by referring to the track information.\n * The information includes the bounding box of tracks.\n * @param spec\n * @param tracks\n * @returns\n */\nexport function getViewApiData(spec: GoslingSpec, tracks: TrackApiData[]) {\n return getViewIds(spec).map(viewId => {\n const internalSpec = getInternalSpecById(spec, viewId);\n const trackIds = getTrackIds(internalSpec as View | PartialTrack);\n const bb = {\n x: Number.MAX_SAFE_INTEGER,\n y: Number.MAX_SAFE_INTEGER,\n xe: -Number.MAX_SAFE_INTEGER,\n ye: -Number.MAX_SAFE_INTEGER\n };\n trackIds\n .map(trackId => tracks.find(t => t.id === trackId))\n .forEach(track => {\n if (!track) return;\n const { shape } = track;\n if (bb.x > shape.x) {\n bb.x = shape.x;\n }\n if (bb.y > shape.y) {\n bb.y = shape.y;\n }\n if (bb.xe < shape.x + shape.width) {\n bb.xe = shape.x + shape.width;\n }\n if (bb.ye < shape.y + shape.height) {\n bb.ye = shape.y + shape.height;\n }\n });\n return {\n id: viewId,\n spec: internalSpec as View,\n shape: { ...bb, width: bb.xe - bb.x, height: bb.ye - bb.y }\n };\n });\n}\n","import { getBoundingBox, type TrackInfo } from './bounding-box';\nimport { goslingToHiGlass } from './gosling-to-higlass';\nimport { HiGlassModel } from './higlass-model';\nimport { getLinkingInfo } from '../core/utils/linking';\nimport type {\n GoslingSpec,\n OverlaidTrack,\n SingleTrack,\n TrackApiData,\n VisUnitApiData,\n ViewApiData\n} from '@gosling-lang/gosling-schema';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\nimport type { CompileCallback } from './compile';\nimport type { UrlToFetchOptions } from 'src/core/gosling-component';\nimport { getViewApiData } from '../api/api-data';\nimport { GoslingToHiGlassIdMapper } from '../api/track-and-view-ids';\nimport { IsDummyTrack } from '@gosling-lang/gosling-schema';\n\nexport function renderHiGlass(\n spec: GoslingSpec,\n trackInfos: TrackInfo[],\n callback: CompileCallback,\n theme: CompleteThemeDeep,\n urlToFetchOptions?: UrlToFetchOptions\n) {\n if (trackInfos.length === 0) {\n // no tracks to render\n return;\n }\n\n // HiGlass model\n const hgModel = new HiGlassModel();\n\n // A mapping table between Gosling track IDs and HiGlass view IDs\n const idMapper = new GoslingToHiGlassIdMapper();\n\n /* Update the HiGlass model by iterating tracks */\n trackInfos.forEach(tb => {\n const { track, boundingBox: bb, layout } = tb;\n goslingToHiGlass(hgModel, track, bb, layout, theme, idMapper, urlToFetchOptions);\n });\n\n /* Add linking information to the HiGlass model */\n const linkingInfos = getLinkingInfo(hgModel);\n\n // Brushing\n // (between a view with `brush` and a view having the same linking name)\n linkingInfos\n .filter(d => d.isBrush)\n .forEach(info => {\n hgModel.addBrush(\n info.layout,\n info.hgViewId,\n theme,\n linkingInfos.find(d => !d.isBrush && d.linkId === info.linkId)?.hgViewId,\n info.style\n );\n });\n\n // location/zoom lock information\n // fill `locksByViewUid`\n linkingInfos\n .filter(d => !d.isBrush)\n .forEach(d => {\n hgModel.spec().zoomLocks.locksByViewUid[d.hgViewId] = d.linkId;\n hgModel.spec().locationLocks.locksByViewUid[d.hgViewId] = d.linkId;\n });\n\n // fill `locksDict`\n const uniqueLinkIds = Array.from(new Set(linkingInfos.map(d => d.linkId)));\n\n uniqueLinkIds.forEach(linkId => {\n hgModel.spec().zoomLocks.locksDict[linkId] = { uid: linkId };\n hgModel.spec().locationLocks.locksDict[linkId] = { uid: linkId };\n\n linkingInfos\n .filter(d => !d.isBrush)\n .filter(d => d.linkId === linkId)\n .forEach(d => {\n hgModel.spec().zoomLocks.locksDict[linkId][d.hgViewId] = [124625310.5, 124625310.5, 249250.621];\n hgModel.spec().locationLocks.locksDict[linkId][d.hgViewId] = [124625310.5, 124625310.5, 249250.621];\n });\n });\n\n const tracks: TrackApiData[] = trackInfos.map(d => {\n return {\n id: d.track.id!,\n spec: d.track as SingleTrack | OverlaidTrack,\n shape:\n d.track.layout === 'linear' || IsDummyTrack(d.track) // Dummy track is always linear\n ? d.boundingBox\n : {\n ...d.boundingBox,\n cx: d.boundingBox.x + d.boundingBox.width / 2.0,\n cy: d.boundingBox.y + d.boundingBox.height / 2.0,\n innerRadius: d.track.innerRadius!,\n outerRadius: d.track.outerRadius!,\n startAngle: d.track.startAngle!,\n endAngle: d.track.endAngle!\n }\n };\n });\n\n // Get the view information needed to support JS APIs (e.g., providing view bounding boxes)\n const views: ViewApiData[] = getViewApiData(spec, tracks);\n\n // Merge the tracks and views\n const tracksAndViews = [\n ...tracks.map(d => ({ ...d, type: 'track' } as VisUnitApiData)),\n ...views.map(d => ({ ...d, type: 'view' } as VisUnitApiData))\n ];\n\n callback(hgModel.spec(), getBoundingBox(trackInfos), spec, tracksAndViews, idMapper.getTable());\n}\n","import type { GoslingSpec, SelectivityCondition, SingleView } from '@gosling-lang/gosling-schema';\nimport { logicalComparison } from '../core/utils/semantic-zoom';\n\nexport function manageResponsiveSpecs(\n spec: GoslingSpec | SingleView,\n wFactor: number,\n hFactor: number,\n parentWidth: number,\n parentHeight: number\n): boolean {\n if (typeof spec._assignedWidth === 'undefined' || typeof spec._assignedHeight === 'undefined') {\n console.warn('Responsive spec cannot be used when width and height of a view is not determined yet.');\n return false;\n }\n\n let replaced = false;\n\n const { responsiveSpec } = spec;\n\n const width = spec._assignedWidth * wFactor;\n const height = spec._assignedHeight * hFactor;\n const dimensions = { width, height, aspectRatio: width / height };\n const parentDimensions = { width: parentWidth, height: parentHeight, aspectRatio: parentWidth / parentHeight };\n\n // Check whether any alternative specs fullfil the condition\n if (responsiveSpec) {\n // TODO: Specify types for `specAndCondition`\n responsiveSpec.forEach((specAndCondition: any) => {\n const { spec: alternativeSpec, selectivity } = specAndCondition;\n\n if (isSelectResponsiveSpec(selectivity, dimensions, parentDimensions) && !replaced) {\n // Override this alternative spec in this view\n Object.keys(alternativeSpec).forEach(k => {\n (spec as any)[k] = (alternativeSpec as any)[k];\n });\n delete spec.responsiveSpec;\n\n replaced = true;\n\n // now that we replaced a spec already, get out of this scope.\n return;\n }\n });\n }\n\n if ('views' in spec) {\n // This means we need to go deeper\n spec.views.forEach(view => {\n replaced = manageResponsiveSpecs(view, wFactor, hFactor, parentWidth, parentHeight) || replaced;\n });\n }\n\n return replaced;\n}\n\n/**\n * Test if given conditions are all `true`.\n * @param conditions\n * @param assignedDimensions\n * @returns\n */\nfunction isSelectResponsiveSpec(\n conditions: SelectivityCondition[],\n assignedDimensions: { width: number; height: number; aspectRatio: number },\n parentDimensions: { width: number; height: number; aspectRatio: number }\n): boolean {\n if (conditions.length === 0) return false;\n\n let isSelect = true;\n\n conditions.forEach(condition => {\n const { measure, operation, threshold, target } = condition;\n isSelect =\n isSelect &&\n logicalComparison(\n (target === 'container' ? parentDimensions : assignedDimensions)[measure],\n operation,\n threshold\n ) === 1;\n });\n\n return isSelect;\n}\n","import type { GoslingSpec, TemplateTrackDef, VisUnitApiData } from '@gosling-lang/gosling-schema';\nimport type { HiGlassSpec } from '@gosling-lang/higlass-schema';\nimport { traverseToFixSpecDownstream, overrideDataTemplates } from './spec-preprocess';\nimport { replaceTrackTemplates } from '../core/utils/template';\nimport { getRelativeTrackInfo, type Size } from './bounding-box';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\nimport type { UrlToFetchOptions } from 'src/core/gosling-component';\nimport { renderHiGlass as createHiGlassModels } from './create-higlass-models';\nimport { manageResponsiveSpecs } from './responsive';\nimport type { IdTable } from '../api/track-and-view-ids';\nimport { publish } from '../api/pubsub';\n\n/** The callback function called everytime after the spec has been compiled */\nexport type CompileCallback = (\n hg: HiGlassSpec,\n size: Size,\n gs: GoslingSpec,\n tracksAndViews: VisUnitApiData[],\n idTable: IdTable\n) => void;\n\nexport function compile(\n spec: GoslingSpec,\n callback: CompileCallback,\n templates: TemplateTrackDef[],\n theme: Required,\n containerStatus: {\n containerSize?: { width: number; height: number };\n containerParentSize?: { width: number; height: number };\n },\n urlToFetchOptions?: UrlToFetchOptions\n) {\n // Make sure to keep the original spec as-is\n const specCopy = JSON.parse(JSON.stringify(spec));\n\n // Override default visual encoding (i.e., `DataTrack` => `BasicSingleTrack`)\n overrideDataTemplates(specCopy);\n\n // Replace track templates with raw gosling specs (i.e., `TemplateTrack` => `SingleTrack | OverlaidTrack`)\n replaceTrackTemplates(specCopy, templates);\n\n // Fix track specs by looking into the root-level spec\n traverseToFixSpecDownstream(specCopy);\n\n // Generate arrangement data\n const trackInfosAndSize = getRelativeTrackInfo(specCopy, theme);\n let { trackInfos } = trackInfosAndSize;\n const { size } = trackInfosAndSize;\n\n // Handle responsive specs, either remove them or replace original specs w/ them\n const isResponsiveWidth =\n (typeof spec.responsiveSize === 'object' && spec.responsiveSize?.width) || spec.responsiveSize;\n const isResponsiveHeight =\n (typeof spec.responsiveSize === 'object' && spec.responsiveSize?.height) || spec.responsiveSize;\n const wFactor =\n isResponsiveWidth && containerStatus.containerSize ? containerStatus.containerSize.width / size.width : 1;\n const hFactor =\n isResponsiveHeight && containerStatus.containerSize ? containerStatus.containerSize.height / size.height : 1;\n const pWidth = containerStatus.containerParentSize\n ? containerStatus.containerParentSize.width\n : Number.MAX_SAFE_INTEGER;\n const pHeight = containerStatus.containerParentSize\n ? containerStatus.containerParentSize.height\n : Number.MAX_SAFE_INTEGER;\n const replaced = manageResponsiveSpecs(specCopy, wFactor, hFactor, pWidth, pHeight);\n\n // Do the downstream-fix and track arrangement again using the updated spec\n if (replaced) {\n traverseToFixSpecDownstream(specCopy);\n trackInfos = getRelativeTrackInfo(specCopy, theme).trackInfos;\n }\n\n // publish the fixed spec\n // used for alt-gosling\n publish('specProcessed', {\n id: specCopy.id,\n spec: specCopy\n });\n\n // Make HiGlass models for individual tracks\n createHiGlassModels(specCopy, trackInfos, callback, theme, urlToFetchOptions);\n}\n","/* eslint-disable react/prop-types */\nimport type * as PIXI from 'pixi.js';\nimport React, { useEffect, useState, forwardRef, useMemo } from 'react';\n\nimport * as gosling from '..';\n// @ts-ignore\nimport { HiGlassComponent } from 'higlass';\nimport type { HiGlassSpec } from '@gosling-lang/higlass-schema';\nimport { uuid } from '../core/utils/uuid';\n\n/**\n * Register plugin tracks and data fetchers to HiGlass. This is necessary for the first time before using Gosling.\n */\ngosling.init();\n\n// TODO: Complete the API\nexport type HiGlassApi = {\n api: Record;\n pixiRenderer: PIXI.Renderer;\n pixiStage: PIXI.IRenderableObject;\n};\n\nexport interface HiGlassComponentWrapperProps {\n size: { width: number; height: number };\n viewConfig?: HiGlassSpec;\n options: {\n padding?: number;\n margin?: number;\n border?: string;\n background?: string;\n responsiveWidth?: boolean;\n responsiveHeight?: boolean;\n alt?: string;\n };\n id?: string;\n className?: string;\n}\n\nexport const HiGlassComponentWrapper = forwardRef(\n (props, ref) => {\n // div `id` and `className` for detailed customization\n const [wrapperDivId, setWrapperDivId] = useState(props.id ?? uuid());\n useEffect(() => {\n setWrapperDivId(props.id ?? uuid());\n }, [props.id]);\n\n const viewConfig = props.viewConfig || {};\n const pixelPreciseMarginPadding = false; // !props.options.responsiveHeight;\n const higlassComponent = useMemo(\n () => (\n \n ),\n [viewConfig, pixelPreciseMarginPadding]\n );\n\n // Styling\n const {\n padding = 60,\n margin = 0,\n border = 'none',\n background,\n alt = 'Gosling visualization'\n } = props.options || {};\n return (\n <>\n \n {\n // PubSub.publish('gosling.click', {\n // mouseX: e.pageX - (document.getElementById('higlass-wrapper')?.offsetLeft ?? 0),\n // mouseY: e.pageY - (document.getElementById('higlass-wrapper')?.offsetTop ?? 0)\n // });\n // }}\n >\n {higlassComponent}\n \n \n \n );\n }\n);\n\nHiGlassComponentWrapper.displayName = 'HiGlassComponentWrapper';\n","import * as PIXI from 'pixi.js';\nimport type { TrackApiData, VisUnitApiData, ViewApiData } from '@gosling-lang/gosling-schema';\nimport type { HiGlassSpec } from '@gosling-lang/higlass-schema';\nimport type { HiGlassApi } from '../core/higlass-component-wrapper';\nimport { subscribe, unsubscribe } from './pubsub';\nimport { computeChromSizes, GenomicPositionHelper } from '../core/utils/assembly';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\nimport type { IdTable } from './track-and-view-ids';\n\n/**\n * Information of suggested genes.\n */\ninterface GeneSuggestion {\n geneName: string; // gene symbol\n score: number; // higher score means suggested gene is more likely to match the searched keyword\n chr: string; // chromosome name\n txStart: number; // absolute genomic position assuming chromosomes are concat end-to-end\n txEnd: number; // absolute genomic position assuming chromosomes are concat end-to-end\n}\n\nexport interface GoslingApi {\n subscribe: typeof subscribe;\n unsubscribe: typeof unsubscribe;\n zoomTo(viewId: string, position: string, padding?: number, duration?: number): void;\n zoomToExtent(viewId: string, duration?: number): void;\n zoomToGene(viewId: string, gene: string, padding?: number, duration?: number): void;\n suggestGene(viewId: string, keyword: string, callback: (suggestions: GeneSuggestion[]) => void): void;\n getTracksAndViews(): VisUnitApiData[];\n /**\n * Get an array of all available track IDs that are either specified by users or auto-generated by the compiler.\n * This can be used to call other API functions, e.g., `getTrack('track-1')`.\n */\n getTrackIds(): string[];\n getTracks(): TrackApiData[];\n getTrack(trackId: string): TrackApiData | undefined;\n getViews(): ViewApiData[];\n getView(viewId: string): ViewApiData | undefined;\n exportPng(transparentBackground?: boolean): void;\n exportPdf(transparentBackground?: boolean): void;\n getCanvas(options?: { resolution?: number; transparentBackground?: boolean }): {\n canvas: HTMLCanvasElement;\n canvasWidth: number;\n canvasHeight: number;\n resolution: number;\n };\n}\n\nexport function createApi(\n hg: Readonly,\n hgSpec: HiGlassSpec | undefined,\n tracksAndViews: readonly VisUnitApiData[],\n theme: Required,\n idTable: Readonly\n): GoslingApi {\n const idTableCopy = structuredClone(idTable);\n /**\n * Get the HiGlass view ID from the Gosling track ID.\n */\n const getHgViewId = (trackId: string) => {\n const viewId = idTableCopy[trackId];\n if (!viewId) {\n console.warn(`Unable to find the track ID, named ${trackId}.`);\n }\n return viewId ?? trackId;\n };\n const getTrackIds = () => {\n return Object.keys(idTableCopy);\n };\n const getTracksAndViews = () => {\n return [...tracksAndViews];\n };\n const getTracks = () => {\n return [...getTracksAndViews().filter(d => d.type === 'track')] as TrackApiData[];\n };\n const getTrack = (trackId: string) => {\n const trackInfoFound = getTracks().find(d => d.id === trackId);\n if (!trackInfoFound) {\n console.warn(`[getTrack()] Unable to find a track using the ID (${trackId})`);\n }\n return trackInfoFound;\n };\n const getViews = () => {\n return [...getTracksAndViews().filter(d => d.type === 'view')] as ViewApiData[];\n };\n const getView = (viewId: string) => {\n const view = getViews().find(d => d.id === viewId);\n if (!view) {\n console.warn(`Unable to find a view with the ID of ${viewId}`);\n }\n return view;\n };\n const getCanvas: GoslingApi['getCanvas'] = options => {\n const resolution = options?.resolution ?? 4;\n const transparentBackground = options?.transparentBackground ?? false;\n\n const renderer = hg.pixiRenderer;\n const renderTexture = PIXI.RenderTexture.create({\n width: renderer.width / 2,\n height: renderer.height / 2,\n resolution\n });\n\n renderer.render(hg.pixiStage, renderTexture);\n\n const canvas = renderer.plugins.extract.canvas(renderTexture);\n\n // Set background color for the given theme in the gosling spec\n // Otherwise, it is transparent\n const canvasWithBg = document.createElement('canvas') as HTMLCanvasElement;\n canvasWithBg.width = canvas.width;\n canvasWithBg.height = canvas.height;\n\n const ctx = canvasWithBg.getContext('2d')!;\n if (!transparentBackground) {\n ctx.fillStyle = theme.root.background;\n ctx.fillRect(0, 0, canvasWithBg.width, canvasWithBg.height);\n }\n ctx.drawImage(canvas, 0, 0);\n\n return {\n canvas: canvasWithBg,\n resolution,\n canvasWidth: canvas.width,\n canvasHeight: canvas.height\n };\n };\n return {\n subscribe,\n unsubscribe,\n zoomTo: (trackId, position, padding = 0, duration = 1000) => {\n // Accepted input: 'chr1' or 'chr1:1-1000'\n const assembly = getTrack(trackId)?.spec.assembly;\n const manager = GenomicPositionHelper.fromString(position);\n const absCoordinates = manager.toAbsoluteCoordinates(assembly, padding);\n const hgViewId = getHgViewId(trackId);\n hg.api.zoomTo(hgViewId, ...absCoordinates, ...absCoordinates, duration);\n },\n zoomToExtent: (trackId, duration = 1000) => {\n const assembly = getTrack(trackId)?.spec.assembly;\n const [start, end] = [0, computeChromSizes(assembly).total];\n const hgViewId = getHgViewId(trackId);\n hg.api.zoomTo(hgViewId, start, end, start, end, duration);\n },\n zoomToGene: (trackId, gene, padding = 0, duration = 1000) => {\n const hgViewId = getHgViewId(trackId);\n hg.api.zoomToGene(hgViewId, gene, padding, duration);\n },\n suggestGene: (trackId: string, keyword: string, callback: (suggestions: GeneSuggestion[]) => void) => {\n const hgViewId = getHgViewId(trackId);\n hg.api.suggestGene(hgViewId, keyword, callback);\n },\n getTrackIds,\n getTracksAndViews,\n getTracks,\n getTrack,\n getView,\n getViews,\n getCanvas,\n exportPng: transparentBackground => {\n const { canvas } = getCanvas({ resolution: 4, transparentBackground });\n canvas.toBlob(blob => {\n const a = document.createElement('a');\n document.body.append(a);\n a.download = 'gosling-visualization';\n a.href = URL.createObjectURL(blob!);\n a.click();\n a.remove();\n }, 'image/png');\n },\n exportPdf: async transparentBackground => {\n const { jsPDF } = await import('jspdf');\n const { canvas } = getCanvas({ resolution: 4, transparentBackground });\n const imgData = canvas.toDataURL('image/jpeg', 1);\n const pdf = new jsPDF({\n orientation: canvas.width < canvas.height ? 'p' : 'l',\n unit: 'pt',\n format: [canvas.width, canvas.height]\n });\n pdf.addImage(imgData, 'JPEG', 0, 0, canvas.width, canvas.height);\n pdf.save('gosling-visualization.pdf');\n }\n };\n}\n","import type { GoslingSpec } from '@gosling-lang/gosling-schema';\nimport { cloneDeepWith } from 'lodash-es';\nimport { isObject } from '@gosling-lang/gosling-schema';\n\nexport function omitDeep(spec: GoslingSpec, omitKeys: string[]) {\n return cloneDeepWith(spec, (value: unknown) => {\n if (isObject(value)) {\n omitKeys.forEach(key => {\n delete value[key];\n });\n }\n });\n}\n","import type { HiGlassSpec } from '@gosling-lang/higlass-schema';\n\n/**\n * This makes sure that all the current zooming status is preserved when new tracks are added\n */\nexport const preverseZoomStatus = (newSpec: HiGlassSpec, prevSpec: HiGlassSpec) => {\n newSpec.views.forEach(view => {\n const viewUid = view.uid!;\n const isNewView = !prevSpec.views.find(v => v.uid === viewUid);\n if (isNewView) {\n // if this view is linked with another view, we need to preverse the current zooming status of this view from the linked view\n // Otherwise, all the views that is linked with this view will be reset to the original zooming position\n const { locksByViewUid } = newSpec.zoomLocks;\n const lockUid = locksByViewUid[viewUid];\n const linkedViewUid = Object.entries(locksByViewUid).find(([_, uid]) => _ && uid === lockUid)?.[0];\n // Only if the linked view existed in the previous spec, we copy the zooming status\n const linkedViewExistedPrev = !!prevSpec.views.find(v => v.uid === linkedViewUid);\n if (linkedViewUid && linkedViewExistedPrev) {\n // We found a linked view, so copy the current zooming status\n view.initialXDomain = prevSpec.views.find(v => v.uid === linkedViewUid)?.initialXDomain;\n view.initialYDomain = prevSpec.views.find(v => v.uid === linkedViewUid)?.initialYDomain;\n }\n }\n });\n};\n","/* eslint-disable react/prop-types */\nimport { type HiGlassApi, HiGlassComponentWrapper } from './higlass-component-wrapper';\nimport type { TemplateTrackDef, VisUnitApiData } from '@gosling-lang/gosling-schema';\nimport type { RequestInit } from '@gosling-lang/higlass-schema';\nimport React, { useState, useEffect, useMemo, useRef, forwardRef, useCallback, useImperativeHandle } from 'react';\nimport { ResizeSensor } from 'css-element-queries';\nimport * as gosling from '..';\nimport { getTheme, type Theme } from './utils/theme';\nimport { createApi, type GoslingApi } from '../api/api';\nimport { GoslingTemplates } from '..';\nimport { omitDeep } from './utils/omit-deep';\nimport { isEqual } from 'lodash-es';\nimport { publish } from '../api/pubsub';\nimport type { IdTable } from '../api/track-and-view-ids';\nimport { preverseZoomStatus } from './utils/higlass-zoom-config';\nimport { uuid } from '../core/utils/uuid';\n\n// Before rerendering, wait for a few time so that HiGlass container is resized already.\n// If HiGlass is rendered and then the container resizes, the viewport position changes, unmatching `xDomain` specified by users.\nconst DELAY_FOR_CONTAINER_RESIZE_BEFORE_RERENDER = 300;\n\n/** Matches URLs to specific fetch options so that datafetchers have access URL specific fetch options */\nexport interface UrlToFetchOptions {\n [url: string]: RequestInit;\n}\ntype CompiledCallbackFn = (\n goslingSpec: gosling.GoslingSpec,\n higlassSpec: gosling.HiGlassSpec,\n _additionalData: { _processedSpec: gosling.GoslingSpec }\n) => void\n\ninterface GoslingCompProps {\n spec?: gosling.GoslingSpec;\n compiled?: CompiledCallbackFn;\n padding?: number;\n margin?: number;\n border?: string;\n id?: string;\n className?: string;\n theme?: Theme;\n templates?: TemplateTrackDef[];\n urlToFetchOptions?: UrlToFetchOptions;\n experimental?: {\n reactive?: boolean;\n };\n}\n\nexport type GoslingRef = {\n api: GoslingApi;\n hgApi: HiGlassApi;\n};\n\nexport const GoslingComponent = forwardRef((props, ref) => {\n const [viewConfig, setViewConfig] = useState();\n const [size, setSize] = useState({ width: 200, height: 200 });\n const wrapperSize = useRef();\n const wrapperParentSize = useRef();\n const prevSpec = useRef();\n const tracksAndViews = useRef([]);\n /** A mapping table that connects between Gosling track IDs to corresponding HiGlas view IDs */\n const idTable = useRef({});\n\n // HiGlass API\n // https://dev.to/wojciechmatuszewski/mutable-and-immutable-useref-semantics-with-react-typescript-30c9\n const hgRef = useRef(null);\n\n const theme = getTheme(props.theme || 'light');\n const wrapperDivId = props.id ?? uuid();\n\n /**\n * Publishes event if there is a new view added\n * @param currentTracksAndViews newly retrieved tracks and views from compile() callback\n */\n const publishOnNewView = (currentTracksAndViews: VisUnitApiData[]) => {\n // Compare the previous and current views to figure out the difference\n const prevViews = tracksAndViews.current.filter(data => data.type == 'view');\n const currentViews = currentTracksAndViews.filter(data => data.type == 'view');\n const prevViewIds = new Set(prevViews.map(data => data.id));\n const newViews = currentViews.filter(view => !prevViewIds.has(view.id));\n // Publish if there are any new changes\n newViews.forEach(view => {\n publish('onNewView', { id: view.id });\n });\n };\n\n // Gosling APIs\n useImperativeHandle(\n ref,\n () => {\n const hgApi = refAsReadonlyProxy(hgRef);\n const visUnits = refAsReadonlyProxy(tracksAndViews);\n const api = createApi(hgApi, viewConfig, visUnits, theme, idTable.current);\n return { api, hgApi };\n },\n [viewConfig, theme]\n );\n\n // TODO: add a `force` parameter since changing `linkingId` might not update vis\n const compile = useCallback(() => {\n if (props.spec) {\n const valid = gosling.validateGoslingSpec(props.spec);\n\n if (valid.state === 'error') {\n console.warn('Gosling spec is not valid. Please refer to the console message.');\n return;\n }\n\n gosling.compile(\n props.spec,\n (newHiGlassSpec, newSize, newGoslingSpec, newTracksAndViews, newIdTable) => {\n // TODO: `linkingId` should be updated\n // We may not want to re-render this\n if (\n prevSpec.current &&\n isEqual(omitDeep(prevSpec.current, ['linkingId']), omitDeep(newGoslingSpec, ['linkingId']))\n ) {\n return;\n }\n\n // If a callback function is provided, return compiled information.\n props.compiled?.(props.spec!, newHiGlassSpec, { _processedSpec: newGoslingSpec });\n\n // Change the size of wrapper `
` elements\n setSize(newSize);\n\n // Update the compiled view config\n const isMountedOnce = typeof viewConfig !== 'undefined';\n if (props.experimental?.reactive && isMountedOnce) {\n // Use API to update visualization.\n setTimeout(() => {\n preverseZoomStatus(\n newHiGlassSpec,\n hgRef.current?.api.getViewConfig() as gosling.HiGlassSpec\n );\n hgRef.current?.api.setViewConfig(newHiGlassSpec);\n }, DELAY_FOR_CONTAINER_RESIZE_BEFORE_RERENDER);\n } else {\n // Mount `HiGlassComponent` using this view config.\n setViewConfig(newHiGlassSpec);\n }\n publishOnNewView(newTracksAndViews);\n prevSpec.current = newGoslingSpec;\n tracksAndViews.current = newTracksAndViews;\n idTable.current = newIdTable;\n },\n [...GoslingTemplates], // TODO: allow user definitions\n theme,\n {\n containerSize: wrapperSize.current,\n containerParentSize: wrapperParentSize.current\n },\n props.urlToFetchOptions\n );\n }\n }, [props.spec, theme]);\n\n // TODO: If not necessary, do not update `wrapperSize` (i.e., when responsiveSize is not set)\n useEffect(() => {\n if (!props.spec?.responsiveSize) return;\n\n const containerElement = document.getElementById(wrapperDivId);\n if (!containerElement) return;\n\n const resizer = new ResizeSensor(containerElement, newSize => {\n if (\n !wrapperSize.current ||\n wrapperSize.current.height !== newSize.height ||\n wrapperSize.current.width !== newSize.width\n ) {\n wrapperSize.current = newSize;\n compile();\n }\n });\n\n const parentElement = containerElement.parentElement;\n if (!parentElement) return;\n\n const parentResizer = new ResizeSensor(parentElement, newSize => {\n if (\n !wrapperParentSize.current ||\n wrapperParentSize.current.height !== newSize.height ||\n wrapperParentSize.current.width !== newSize.width\n ) {\n wrapperParentSize.current = newSize;\n compile();\n }\n });\n\n return () => {\n resizer.detach();\n parentResizer.detach();\n };\n });\n\n useEffect(() => {\n compile();\n }, [props.spec, theme]);\n\n const responsiveHeight =\n typeof props.spec?.responsiveSize !== 'object' ? props.spec?.responsiveSize : props.spec.responsiveSize.height;\n\n // HiGlass component should be mounted only once\n const higlassComponent = useMemo(\n () => (\n \n ),\n [viewConfig, size, theme, responsiveHeight]\n );\n\n return higlassComponent;\n});\n\nGoslingComponent.displayName = 'GoslingComponent';\n\n/** Wraps the `.current` property of a React.RefObject as a readonly object. */\nfunction refAsReadonlyProxy(ref: React.RefObject): Readonly {\n // Readonly because because we only implement `get`.\n return new Proxy({} as Readonly, {\n get(_target, prop, reciever) {\n if (!ref.current) throw Error('ref is not set!');\n return Reflect.get(ref.current, prop, reciever);\n }\n });\n}\n","'use strict';\n\nvar m = require('react-dom');\nif (process.env.NODE_ENV === 'production') {\n exports.createRoot = m.createRoot;\n exports.hydrateRoot = m.hydrateRoot;\n} else {\n var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n exports.createRoot = function(c, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.createRoot(c, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n exports.hydrateRoot = function(c, h, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.hydrateRoot(c, h, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n}\n","import React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport type { GoslingSpec } from '@gosling-lang/gosling-schema';\nimport type { HiGlassSpec } from '@gosling-lang/higlass-schema';\n\nimport { validateGoslingSpec } from '@gosling-lang/gosling-schema';\nimport { compile } from '../compiler/compile';\nimport type { UrlToFetchOptions } from './gosling-component';\nimport { getTheme, type Theme } from './utils/theme';\nimport { GoslingTemplates } from './utils/template';\nimport { type GoslingApi, createApi } from '../api/api';\n\nimport {\n type HiGlassApi,\n HiGlassComponentWrapper,\n type HiGlassComponentWrapperProps\n} from './higlass-component-wrapper';\n\nexport type GoslingEmbedOptions = Omit & {\n id?: string;\n className?: string;\n theme?: Theme;\n urlToFetchOptions?: UrlToFetchOptions;\n};\n\nconst MAX_TRIES = 20;\nconst INTERVAL = 200; // ms\n\n// https://github.com/higlass/higlass/blob/0299ae1229fb57e0ca8da31dff58003c3e5bf1cf/app/scripts/hglib.js#L37A\nconst launchHiglass = (\n element: HTMLElement,\n viewConfig: HiGlassSpec,\n size: { width: number; height: number },\n opts: GoslingEmbedOptions & { background: string }\n): Promise => {\n const ref = React.createRef();\n const component = React.createElement(HiGlassComponentWrapper, {\n ref,\n viewConfig,\n size,\n id: opts.id,\n className: opts.className,\n options: opts\n });\n\n createRoot(element).render(component);\n\n // For some reason our wrapper component fails to initialize the provided `ref`\n // immediately like `hglib.launch()`. This is a work-around to poll `ref`\n // until it is initialized by our wrapper. We return a promise for the API once\n // it is defined or raise an error.\n // https://github.com/gosling-lang/gosling.js/pull/456#discussion_r687861694\n return new Promise((resolve, reject) => {\n let tries = 0;\n const poll = setInterval(() => {\n if (ref && ref.current) {\n clearInterval(poll);\n resolve(ref.current);\n }\n if (tries >= MAX_TRIES) {\n reject(new Error('Failed to initialize HiGlassApi.'));\n }\n tries++;\n }, INTERVAL);\n });\n};\n\n/**\n * Embed a Gosling component to a given HTMLElement.\n * @param element\n * @param spec\n */\nexport function embed(element: HTMLElement, spec: GoslingSpec, opts: GoslingEmbedOptions = {}) {\n return new Promise((resolve, reject) => {\n const valid = validateGoslingSpec(spec);\n\n if (valid.state === 'error') {\n reject(new Error('Gosling spec is not valid. Please refer to the console message.'));\n }\n\n const theme = getTheme(opts.theme || 'light');\n const options = {\n ...opts,\n background: theme.root.background,\n alt: opts.alt ?? spec.description ?? 'Gosling visualization'\n };\n\n compile(\n spec,\n async (hsSpec, size, _, trackInfos, idTable) => {\n const hg = await launchHiglass(element, hsSpec, size, options);\n const api = createApi(hg, hsSpec, trackInfos, theme, idTable);\n resolve(api);\n },\n [...GoslingTemplates],\n theme,\n {}, // TODO: properly specify this\n opts.urlToFetchOptions\n );\n });\n}\n"],"names":["name","NOMINAL_COLOR","LightThemeMarkCommonStyle","getTheme","config","factory","icon","colorToHex","options","m","d3arc","DEBOUNCE_TIME","Worker","err","sum","parser","mask","varName","tag","func","tempVar","_getPrototypeOf","o","_setPrototypeOf","p","self","_get","Emitter","AbortSignal","toString","AbortController","Request","init","abortableFetch","require$$0","global","AggregateAbortController_1","abortcontroller_ponyfill_1","AggregateStatusReporter_1","__importDefault","this","AbortablePromiseCache_1","require$$1","require$$2","rank","max","min","inflateRaw","getParsers","AbortablePromiseCache","Buffer","d","b","Subscription","Subscriber","ConsumerObserver","SafeSubscriber","Observable","subscribe","observable","Symbol_observable","OperatorSubscriber","RemoteFile","dataConfig","v","group","tileInfo","d3dsvFormat","genomicFields","i","exampleHg","_getTheme","d3min","d3sum","_d","d3max","_a","PubSub","_assembly","width","height","spec","createHiGlassModels","gosling.init","getTrackIds","blob","compile","gosling.validateGoslingSpec","gosling.compile","_b","_c"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,oBAAoB;AAAA,EACpB,MAAM;AAAA,EACN,YAAY,CAAC,GAAG,CAAC;AACrB;ACjHgB,SAAA,SAAS,QAAe,SAAsC;AACtE,MAAA,OAAO,UAAU,UAAU;AACvB,QAAA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AM,KAAK,MAAM,cAAc,SAAS,QAAQ,MAAM,OAAO;AAC7D,cAAM,MAAM,UAAU,IAAI,QAAQ,YAAY,OAAO,OAAO;AAC5D,gBAAQ,GAAG;AAAA,MACf;AAAA,MACA,CAAC,GAAG,gBAAgB;AAAA,MACpB;AAAA,MACA,CAAC;AAAA;AAAA,MACD,KAAK;AAAA,IAAA;AAAA,EACT,CACH;AACL;","x_google_ignoreList":[22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,93]} \ No newline at end of file diff --git a/dist/src/alias/buffer-shim.d.ts b/dist/src/alias/buffer-shim.d.ts new file mode 100644 index 00000000..e2646b22 --- /dev/null +++ b/dist/src/alias/buffer-shim.d.ts @@ -0,0 +1,2 @@ +export { Buffer } from "buffer/"; +//# sourceMappingURL=buffer-shim.d.ts.map \ No newline at end of file diff --git a/dist/src/alias/buffer-shim.d.ts.map b/dist/src/alias/buffer-shim.d.ts.map new file mode 100644 index 00000000..3cae5752 --- /dev/null +++ b/dist/src/alias/buffer-shim.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"buffer-shim.d.ts","sourceRoot":"","sources":["../../../src/alias/buffer-shim.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/src/alias/zlib.d.ts b/dist/src/alias/zlib.d.ts new file mode 100644 index 00000000..a01bbd05 --- /dev/null +++ b/dist/src/alias/zlib.d.ts @@ -0,0 +1,8 @@ +/// +import { Buffer } from 'buffer'; +export declare function inflateSync(src: Uint8Array): Buffer; +declare const _default: { + inflateSync: typeof inflateSync; +}; +export default _default; +//# sourceMappingURL=zlib.d.ts.map \ No newline at end of file diff --git a/dist/src/alias/zlib.d.ts.map b/dist/src/alias/zlib.d.ts.map new file mode 100644 index 00000000..ce50ab1f --- /dev/null +++ b/dist/src/alias/zlib.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"zlib.d.ts","sourceRoot":"","sources":["../../../src/alias/zlib.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,UAE1C;;;;AAED,wBAA+B"} \ No newline at end of file diff --git a/dist/src/api/api-data.d.ts b/dist/src/api/api-data.d.ts new file mode 100644 index 00000000..d072c62f --- /dev/null +++ b/dist/src/api/api-data.d.ts @@ -0,0 +1,21 @@ +import type { GoslingSpec, TrackApiData, View } from '@gosling-lang/gosling-schema'; +/** + * This collect information of views by referring to the track information. + * The information includes the bounding box of tracks. + * @param spec + * @param tracks + * @returns + */ +export declare function getViewApiData(spec: GoslingSpec, tracks: TrackApiData[]): { + id: string; + spec: View; + shape: { + width: number; + height: number; + x: number; + y: number; + xe: number; + ye: number; + }; +}[]; +//# sourceMappingURL=api-data.d.ts.map \ No newline at end of file diff --git a/dist/src/api/api-data.d.ts.map b/dist/src/api/api-data.d.ts.map new file mode 100644 index 00000000..59c02102 --- /dev/null +++ b/dist/src/api/api-data.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api-data.d.ts","sourceRoot":"","sources":["../../../src/api/api-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAgB,YAAY,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGlG;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE;;;;;;;;;;;IAkCvE"} \ No newline at end of file diff --git a/dist/src/api/api.d.ts b/dist/src/api/api.d.ts new file mode 100644 index 00000000..7caccc86 --- /dev/null +++ b/dist/src/api/api.d.ts @@ -0,0 +1,48 @@ +import type { TrackApiData, VisUnitApiData, ViewApiData } from '@gosling-lang/gosling-schema'; +import type { HiGlassSpec } from '@gosling-lang/higlass-schema'; +import type { HiGlassApi } from '../core/higlass-component-wrapper'; +import { subscribe, unsubscribe } from './pubsub'; +import type { CompleteThemeDeep } from '../core/utils/theme'; +import type { IdTable } from './track-and-view-ids'; +/** + * Information of suggested genes. + */ +interface GeneSuggestion { + geneName: string; + score: number; + chr: string; + txStart: number; + txEnd: number; +} +export interface GoslingApi { + subscribe: typeof subscribe; + unsubscribe: typeof unsubscribe; + zoomTo(viewId: string, position: string, padding?: number, duration?: number): void; + zoomToExtent(viewId: string, duration?: number): void; + zoomToGene(viewId: string, gene: string, padding?: number, duration?: number): void; + suggestGene(viewId: string, keyword: string, callback: (suggestions: GeneSuggestion[]) => void): void; + getTracksAndViews(): VisUnitApiData[]; + /** + * Get an array of all available track IDs that are either specified by users or auto-generated by the compiler. + * This can be used to call other API functions, e.g., `getTrack('track-1')`. + */ + getTrackIds(): string[]; + getTracks(): TrackApiData[]; + getTrack(trackId: string): TrackApiData | undefined; + getViews(): ViewApiData[]; + getView(viewId: string): ViewApiData | undefined; + exportPng(transparentBackground?: boolean): void; + exportPdf(transparentBackground?: boolean): void; + getCanvas(options?: { + resolution?: number; + transparentBackground?: boolean; + }): { + canvas: HTMLCanvasElement; + canvasWidth: number; + canvasHeight: number; + resolution: number; + }; +} +export declare function createApi(hg: Readonly, hgSpec: HiGlassSpec | undefined, tracksAndViews: readonly VisUnitApiData[], theme: Required, idTable: Readonly): GoslingApi; +export {}; +//# sourceMappingURL=api.d.ts.map \ No newline at end of file diff --git a/dist/src/api/api.d.ts.map b/dist/src/api/api.d.ts.map new file mode 100644 index 00000000..efb70671 --- /dev/null +++ b/dist/src/api/api.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api/api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,SAAS,EAA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AC;IACjD,SAAS,CAAC,qBAAqB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACjD,SAAS,CAAC,qBAAqB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACjD,SAAS,CAAC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG;QAC3E,MAAM,EAAE,iBAAiB,CAAC;QAC1B,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL;AAED,wBAAgB,SAAS,CACrB,EAAE,EAAE,QAAQ,CAAC,UAAU,CAAC,EACxB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,cAAc,EAAE,SAAS,cAAc,EAAE,EACzC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAClC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAC3B,UAAU,CAiIZ"} \ No newline at end of file diff --git a/dist/src/api/pubsub.d.ts b/dist/src/api/pubsub.d.ts new file mode 100644 index 00000000..ca315eaa --- /dev/null +++ b/dist/src/api/pubsub.d.ts @@ -0,0 +1,7 @@ +import type { _EventMap } from '@gosling-lang/gosling-schema'; +type EventName = keyof _EventMap; +export declare function publish(name: Name, data: _EventMap[Name]): void; +export declare function subscribe(name: Name, callback: (msg: string, data: _EventMap[Name]) => void): void; +export declare function unsubscribe(name: EventName): void; +export {}; +//# sourceMappingURL=pubsub.d.ts.map \ No newline at end of file diff --git a/dist/src/api/pubsub.d.ts.map b/dist/src/api/pubsub.d.ts.map new file mode 100644 index 00000000..36330ea8 --- /dev/null +++ b/dist/src/api/pubsub.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pubsub.d.ts","sourceRoot":"","sources":["../../../src/api/pubsub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D,KAAK,SAAS,GAAG,MAAM,SAAS,CAAC;AAEjC,wBAAgB,OAAO,CAAC,IAAI,SAAS,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAEvF;AAED,wBAAgB,SAAS,CAAC,IAAI,SAAS,SAAS,EAC5C,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,GACvD,IAAI,CAEN;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAEjD"} \ No newline at end of file diff --git a/dist/src/api/track-and-view-ids.d.ts b/dist/src/api/track-and-view-ids.d.ts new file mode 100644 index 00000000..1eac64b8 --- /dev/null +++ b/dist/src/api/track-and-view-ids.d.ts @@ -0,0 +1,44 @@ +import type { CommonTrackDef, CommonViewDef, GoslingSpec, PartialTrack, View } from '@gosling-lang/gosling-schema'; +/** + * A table that maps Gosling track IDs to HiGlass view IDs. + */ +export type IdTable = Record; +/** + * Manage IDs of Gosling tracks and compiled HiGlass views. + * The HiGlass view IDs correspond to the "UIDs" of HiGlass *views*, + * which are used for calling HiGlass APIs internally in Gosling.js. + * It is 1:1 or N:1 mapping between Gosling tracks IDs and HiGlass views IDs. + * https://docs.higlass.io/view_config.html#uids + */ +export declare class GoslingToHiGlassIdMapper { + #private; + addMapping(gtId: string, hvId: string): void; + getTable(): IdTable; + getGoslingIds(): string[]; + getHiGlassId(gtId: string): string; + /** + * Get IDs of Gosling tracks that became the same HiGlass view. + * @param HiGlassId + * @returns + */ + getSiblingGoslingIds(HiGlassId: string): string[]; +} +/** + * Find all unique IDs of 'views' in a Gosling spec and return them as an array. + * @param spec + * @returns + */ +export declare function getViewIds(spec: GoslingSpec | View | PartialTrack): string[]; +/** + * Find all unique IDs of 'tracks' in a Gosling spec and return them as an array. + * @param spec + * @returns + */ +export declare function getTrackIds(spec: GoslingSpec | View | PartialTrack): string[]; +/** + * Get an internal spec using an ID of a track or a view. `undefined` if unfound. + * @param spec + * @returns + */ +export declare function getInternalSpecById(spec: GoslingSpec | View | PartialTrack, id: string): CommonViewDef | CommonTrackDef | undefined; +//# sourceMappingURL=track-and-view-ids.d.ts.map \ No newline at end of file diff --git a/dist/src/api/track-and-view-ids.d.ts.map b/dist/src/api/track-and-view-ids.d.ts.map new file mode 100644 index 00000000..49d6c419 --- /dev/null +++ b/dist/src/api/track-and-view-ids.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"track-and-view-ids.d.ts","sourceRoot":"","sources":["../../../src/api/track-and-view-ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGnH;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7C;;;;;;GAMG;AACH,qBAAa,wBAAwB;;IAIjC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAMrC,QAAQ;IAGR,aAAa;IAGb,YAAY,CAAC,IAAI,EAAE,MAAM;IAGzB;;;;OAIG;IACH,oBAAoB,CAAC,SAAS,EAAE,MAAM;CAKzC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,YAAY,YAgBjE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,YAAY,YAYlE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,YAAY,EAAE,EAAE,EAAE,MAAM,8CAYtF"} \ No newline at end of file diff --git a/dist/src/compiler/bounding-box.d.ts b/dist/src/compiler/bounding-box.d.ts new file mode 100644 index 00000000..0e899ddb --- /dev/null +++ b/dist/src/compiler/bounding-box.d.ts @@ -0,0 +1,52 @@ +import type { GoslingSpec, Track } from '@gosling-lang/gosling-schema'; +import type { CompleteThemeDeep } from '../core/utils/theme'; +export interface Size { + width: number; + height: number; +} +/** + * Position information of each track. + */ +export interface BoundingBox extends Size { + x: number; + y: number; +} +/** + * Relative positioning of views, used in HiGlass view configs as `layout`. + */ +export interface RelativePosition { + w: number; + h: number; + x: number; + y: number; +} +/** + * Track information for its arrangement. + */ +export interface TrackInfo { + track: Track; + boundingBox: BoundingBox; + layout: RelativePosition; +} +/** + * Return the size of entire visualization. + * @param trackInfos + */ +export declare function getBoundingBox(trackInfos: TrackInfo[]): { + width: number; + height: number; +}; +/** + * Collect information of individual tracks including their size/position and specs + * @param spec + */ +export declare function getRelativeTrackInfo(spec: GoslingSpec, theme: CompleteThemeDeep): { + trackInfos: TrackInfo[]; + size: { + width: number; + height: number; + }; +}; +export declare function getNumOfXAxes(tracks: Track[]): number; +export declare function getNumOfYAxes(tracks: Track[]): number; +//# sourceMappingURL=bounding-box.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/bounding-box.d.ts.map b/dist/src/compiler/bounding-box.d.ts.map new file mode 100644 index 00000000..00fcd916 --- /dev/null +++ b/dist/src/compiler/bounding-box.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bounding-box.d.ts","sourceRoot":"","sources":["../../../src/compiler/bounding-box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgC,WAAW,EAAE,KAAK,EAAc,MAAM,8BAA8B,CAAC;AAWjH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,WAAW,IAAI;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,IAAI;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,SAAS,EAAE;;;EAgBrD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,iBAAiB,GACzB;IACC,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,CAsDA;AA+OD,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAErD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAErD"} \ No newline at end of file diff --git a/dist/src/compiler/compile.d.ts b/dist/src/compiler/compile.d.ts new file mode 100644 index 00000000..f6afd98b --- /dev/null +++ b/dist/src/compiler/compile.d.ts @@ -0,0 +1,19 @@ +import type { GoslingSpec, TemplateTrackDef, VisUnitApiData } from '@gosling-lang/gosling-schema'; +import type { HiGlassSpec } from '@gosling-lang/higlass-schema'; +import { type Size } from './bounding-box'; +import type { CompleteThemeDeep } from '../core/utils/theme'; +import type { UrlToFetchOptions } from 'src/core/gosling-component'; +import type { IdTable } from '../api/track-and-view-ids'; +/** The callback function called everytime after the spec has been compiled */ +export type CompileCallback = (hg: HiGlassSpec, size: Size, gs: GoslingSpec, tracksAndViews: VisUnitApiData[], idTable: IdTable) => void; +export declare function compile(spec: GoslingSpec, callback: CompileCallback, templates: TemplateTrackDef[], theme: Required, containerStatus: { + containerSize?: { + width: number; + height: number; + }; + containerParentSize?: { + width: number; + height: number; + }; +}, urlToFetchOptions?: UrlToFetchOptions): void; +//# sourceMappingURL=compile.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/compile.d.ts.map b/dist/src/compiler/compile.d.ts.map new file mode 100644 index 00000000..78ba69ee --- /dev/null +++ b/dist/src/compiler/compile.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/compiler/compile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGhE,OAAO,EAAwB,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGzD,8EAA8E;AAC9E,MAAM,MAAM,eAAe,GAAG,CAC1B,EAAE,EAAE,WAAW,EACf,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,WAAW,EACf,cAAc,EAAE,cAAc,EAAE,EAChC,OAAO,EAAE,OAAO,KACf,IAAI,CAAC;AAEV,wBAAgB,OAAO,CACnB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,gBAAgB,EAAE,EAC7B,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAClC,eAAe,EAAE;IACb,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,mBAAmB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3D,EACD,iBAAiB,CAAC,EAAE,iBAAiB,QAmDxC"} \ No newline at end of file diff --git a/dist/src/compiler/create-higlass-models.d.ts b/dist/src/compiler/create-higlass-models.d.ts new file mode 100644 index 00000000..5733aa21 --- /dev/null +++ b/dist/src/compiler/create-higlass-models.d.ts @@ -0,0 +1,7 @@ +import { type TrackInfo } from './bounding-box'; +import type { GoslingSpec } from '@gosling-lang/gosling-schema'; +import type { CompleteThemeDeep } from '../core/utils/theme'; +import type { CompileCallback } from './compile'; +import type { UrlToFetchOptions } from 'src/core/gosling-component'; +export declare function renderHiGlass(spec: GoslingSpec, trackInfos: TrackInfo[], callback: CompileCallback, theme: CompleteThemeDeep, urlToFetchOptions?: UrlToFetchOptions): void; +//# sourceMappingURL=create-higlass-models.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/create-higlass-models.d.ts.map b/dist/src/compiler/create-higlass-models.d.ts.map new file mode 100644 index 00000000..7bf93c6c --- /dev/null +++ b/dist/src/compiler/create-higlass-models.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"create-higlass-models.d.ts","sourceRoot":"","sources":["../../../src/compiler/create-higlass-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhE,OAAO,KAAK,EACR,WAAW,EAMd,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAKpE,wBAAgB,aAAa,CACzB,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,SAAS,EAAE,EACvB,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,iBAAiB,EACxB,iBAAiB,CAAC,EAAE,iBAAiB,QA0FxC"} \ No newline at end of file diff --git a/dist/src/compiler/defaults.d.ts b/dist/src/compiler/defaults.d.ts new file mode 100644 index 00000000..3cc273d8 --- /dev/null +++ b/dist/src/compiler/defaults.d.ts @@ -0,0 +1,14 @@ +export declare const DEFAULT_VISUAL_PROPERTIES: { + opacity: number; +}; +export declare const DEFAULT_TITLE_HEIGHT = 20; +export declare const DEFAULT_SUBTITLE_HEIGHT = 20; +export declare const DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM = 6; +export declare const DEFAULT_TRACK_HEIGHT_LINEAR = 130; +export declare const DEFAULT_TRACK_WIDTH_LINEAR = 600; +export declare const DEFAULT_TRACK_SIZE_2D = 600; +export declare const DEFAULT_VIEW_SPACING = 10; +export declare const DEFAULT_INNER_RADIUS_PROP = 0.3; +export declare const DEFAULT_CIRCULAR_VIEW_PADDING = 0; +export declare const DEFAULT_BACKUP_COLOR = "gray"; +//# sourceMappingURL=defaults.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/defaults.d.ts.map b/dist/src/compiler/defaults.d.ts.map new file mode 100644 index 00000000..3bf068da --- /dev/null +++ b/dist/src/compiler/defaults.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/compiler/defaults.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB;;CAErC,CAAC;AAEF,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,wCAAwC,IAAI,CAAC;AAG1D,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAGzC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAGvC,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAG7C,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAG/C,eAAO,MAAM,oBAAoB,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/src/compiler/gosling-to-higlass.d.ts b/dist/src/compiler/gosling-to-higlass.d.ts new file mode 100644 index 00000000..b54be16e --- /dev/null +++ b/dist/src/compiler/gosling-to-higlass.d.ts @@ -0,0 +1,11 @@ +import { HiGlassModel } from './higlass-model'; +import type { Track } from '@gosling-lang/gosling-schema'; +import type { BoundingBox, RelativePosition } from './bounding-box'; +import type { CompleteThemeDeep } from '../core/utils/theme'; +import type { GoslingToHiGlassIdMapper } from '../api/track-and-view-ids'; +import type { UrlToFetchOptions } from '../core/gosling-component'; +/** + * Convert a gosling track into a HiGlass view and add it into a higlass model. + */ +export declare function goslingToHiGlass(hgModel: HiGlassModel, gosTrack: Track, bb: BoundingBox, layout: RelativePosition, theme: Required, idMapper: GoslingToHiGlassIdMapper, urlToFetchOptions?: UrlToFetchOptions): HiGlassModel; +//# sourceMappingURL=gosling-to-higlass.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/gosling-to-higlass.d.ts.map b/dist/src/compiler/gosling-to-higlass.d.ts.map new file mode 100644 index 00000000..07cd64cc --- /dev/null +++ b/dist/src/compiler/gosling-to-higlass.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gosling-to-higlass.d.ts","sourceRoot":"","sources":["../../../src/compiler/gosling-to-higlass.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAqB,MAAM,iBAAiB,CAAC;AAElE,OAAO,KAAK,EAAE,KAAK,EAAU,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAcpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,KAAK,EACf,EAAE,EAAE,WAAW,EACf,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAClC,QAAQ,EAAE,wBAAwB,EAClC,iBAAiB,CAAC,EAAE,iBAAiB,GACtC,YAAY,CA+Rd"} \ No newline at end of file diff --git a/dist/src/compiler/higlass-model.d.ts b/dist/src/compiler/higlass-model.d.ts new file mode 100644 index 00000000..f0758262 --- /dev/null +++ b/dist/src/compiler/higlass-model.d.ts @@ -0,0 +1,82 @@ +import type { HiGlassSpec, Track } from '@gosling-lang/higlass-schema'; +import type { Assembly, AxisPosition, Domain, DummyTrack, Orientation, ZoomLimits } from '@gosling-lang/gosling-schema'; +import type { RelativePosition } from './bounding-box'; +import type { CompleteThemeDeep } from '../core/utils/theme'; +export declare const HIGLASS_AXIS_SIZE = 30; +/** + * Model for managing the HiGlass view config. + * We are currently only using a center track with additional tracks for axes in a single view. + */ +export declare class HiGlassModel { + private assembly?; + private orientation?; + private hg; + constructor(); + spec(): Readonly; + setViewOrientation(orientation?: Orientation): this; + addDefaultView(uid: string, assembly?: Assembly): this; + setAssembly(assembly?: Assembly): this; + getAssembly(): Assembly | undefined; + setTextTrack(width: number, height: number, text: string, textColor?: string, fontSize?: number, fontWeight?: string, align?: string, backgroundColor?: string, fontFamily?: string): this; + /** + * Add a dummy track to the last view + * @param track + */ + setDummyTrack(track: DummyTrack): this; + addBrush(layout: 'circular' | 'linear', viewId: string, theme: Required, fromViewUid?: string, style?: { + color?: string; + stroke?: string; + opacity?: string; + strokeWidth?: number; + startAngle?: number; + endAngle?: number; + innerRadius?: number; + outerRadius?: number; + }): this | undefined; + getLastView(): import("@gosling-lang/higlass-schema").View; + getMainTrackPosition(): "left" | "center"; + /** + * Get the last view that renders any visualization, so skiping empty tracks. + */ + getLastVisView(): import("@gosling-lang/higlass-schema").View; + getView(viewId: string): import("@gosling-lang/higlass-schema").View | undefined; + validateSpec(silence?: boolean): boolean; + setDomain(xDomain: Domain | undefined, yDomain: Domain | undefined): this; + /** + * This is a hacky function that adjust x domain to properly show vertical tracks. + * + * In HiGlass, the range of vertical tracks is affected by a center track. For example, if a center track is small, the vertical tracks become small as well. + * Currently, the actual size of center track for vertical gosling tracks is `1px`. So, we re-scale the x domain so that gosling's vertical tracks properly use the entire height of a view. + * @param orientation + * @param width + * @returns + */ + adjustDomain(orientation: Orientation | undefined, width: number, height: number): this; + /** + * Allow a zoom interaction? + */ + setZoomFixed(zoomFixed: boolean): this; + /** + * Set limits of zoom levels in base pairs. + */ + setZoomLimits(zoomLimits: ZoomLimits): this; + setLayout(layout: RelativePosition): this; + private setEditable; + private setChromInfoPath; + addTrackSourceServers(trackSourceServers: string | undefined): this; + setMainTrack(track: Track): this; + addTrackToCombined(track: Track): this; + setAxisTrack(position: Exclude, type: "regular" | "narrow" | "narrower" | undefined, options: { + id?: string; + layout?: 'circular' | 'linear'; + innerRadius?: number; + outerRadius?: number; + width?: number; + height?: number; + startAngle?: number; + endAngle?: number; + theme: Required; + }): this; + setExampleHiglassViewConfig(): void; +} +//# sourceMappingURL=higlass-model.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/higlass-model.d.ts.map b/dist/src/compiler/higlass-model.d.ts.map new file mode 100644 index 00000000..80908b59 --- /dev/null +++ b/dist/src/compiler/higlass-model.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"higlass-model.d.ts","sourceRoot":"","sources":["../../../src/compiler/higlass-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAExH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,KAAK,EAAE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MAAM;IAItB,YAAY,CAAC,OAAO,UAAQ;IAI5B,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS;IAUzE;;;;;;;;OAQG;IACI,YAAY,CAAC,WAAW,yBAA4B,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAoB1F;;OAEG;IACI,YAAY,CAAC,SAAS,EAAE,OAAO;IAKtC;;OAEG;IACI,aAAa,CAAC,UAAU,EAAE,UAAU;IAKpC,SAAS,CAAC,MAAM,EAAE,gBAAgB;IAKzC,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,gBAAgB;IAQjB,qBAAqB,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS;IAM5D,YAAY,CAAC,KAAK,EAAE,KAAK;IAgBzB,kBAAkB,CAAC,KAAK,EAAE,KAAK;IAM/B,YAAY,CACf,QAAQ,EAAE,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,EACvC,IAAI,+CAA+C,EACnD,OAAO,EAAE;QACL,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;QAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KACtC;IA2DE,2BAA2B;CAGrC"} \ No newline at end of file diff --git a/dist/src/compiler/responsive.d.ts b/dist/src/compiler/responsive.d.ts new file mode 100644 index 00000000..0524d2a6 --- /dev/null +++ b/dist/src/compiler/responsive.d.ts @@ -0,0 +1,3 @@ +import type { GoslingSpec, SingleView } from '@gosling-lang/gosling-schema'; +export declare function manageResponsiveSpecs(spec: GoslingSpec | SingleView, wFactor: number, hFactor: number, parentWidth: number, parentHeight: number): boolean; +//# sourceMappingURL=responsive.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/responsive.d.ts.map b/dist/src/compiler/responsive.d.ts.map new file mode 100644 index 00000000..1105b33b --- /dev/null +++ b/dist/src/compiler/responsive.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../../src/compiler/responsive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAwB,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAGlG,wBAAgB,qBAAqB,CACjC,IAAI,EAAE,WAAW,GAAG,UAAU,EAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACrB,OAAO,CA4CT"} \ No newline at end of file diff --git a/dist/src/compiler/spec-preprocess.d.ts b/dist/src/compiler/spec-preprocess.d.ts new file mode 100644 index 00000000..5f80a26c --- /dev/null +++ b/dist/src/compiler/spec-preprocess.d.ts @@ -0,0 +1,43 @@ +import type { SingleTrack, GoslingSpec, View, SingleView, Track, PartialTrack, CommonTrackDef, CommonViewDef, MultipleViews } from '@gosling-lang/gosling-schema'; +/** + * Traverse individual tracks and call the callback function to read and/or update the track definition. + * @param spec + * @param callback + */ +export declare function traverseTracks(spec: GoslingSpec | View | PartialTrack, callback: (t: Partial, i: number, ts: Partial[]) => void): void; +/** + * Traverse individual tracks and views and call the callback function to read and/or update the common definition of views and tracks. + * @param spec + * @param callback + */ +export declare function traverseTracksAndViews(spec: GoslingSpec | View | PartialTrack, callback: (tv: CommonViewDef | CommonTrackDef) => void): void; +/** + * Traverse individual view arrangements and call the callback function to read and/or update the arrangement information. + * @param spec + * @param callback + */ +export declare function traverseViewArrangements(spec: GoslingSpec, callback: (tv: MultipleViews) => void): void; +/** + * This convert the nested track definitions into a flat array. + * @param spec + */ +export declare function convertToFlatTracks(spec: SingleView): Track[]; +/** + * Traverse views and tracks to use parents's properties if missing. + * @param spec + * @param callback + */ +export declare function traverseToFixSpecDownstream(spec: GoslingSpec | SingleView, parentDef?: CommonViewDef | MultipleViews): void; +/** + * Get an encoding template for the `higlass-vector` data type. + * @param column + * @param value + */ +export declare function getVectorTemplate(column: string, value: string): SingleTrack; +export declare function getMultivecTemplate(row: string, column: string, value: string, categories: string[] | undefined): SingleTrack; +/** + * Override default visual encoding in each track for given data type. + * @param spec + */ +export declare function overrideDataTemplates(spec: GoslingSpec): void; +//# sourceMappingURL=spec-preprocess.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/spec-preprocess.d.ts.map b/dist/src/compiler/spec-preprocess.d.ts.map new file mode 100644 index 00000000..3b504a48 --- /dev/null +++ b/dist/src/compiler/spec-preprocess.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"spec-preprocess.d.ts","sourceRoot":"","sources":["../../../src/compiler/spec-preprocess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EACX,WAAW,EACX,IAAI,EACJ,UAAU,EACV,KAAK,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EAEhB,MAAM,8BAA8B,CAAC;AAuBtC;;;;GAIG;AACH,wBAAgB,cAAc,CAC1B,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,YAAY,EACvC,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,QAUzE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,YAAY,EACvC,QAAQ,EAAE,CAAC,EAAE,EAAE,aAAa,GAAG,cAAc,KAAK,IAAI,QAazD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,aAAa,KAAK,IAAI,QAShG;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,KAAK,EAAE,CAuC7D;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,EAAE,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,QAiUpH;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAc5E;AAED,wBAAgB,mBAAmB,CAC/B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,GACjC,WAAW,CAmCb;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,QAmCtD"} \ No newline at end of file diff --git a/dist/src/core/channel/index.d.ts b/dist/src/core/channel/index.d.ts new file mode 100644 index 00000000..acfaffef --- /dev/null +++ b/dist/src/core/channel/index.d.ts @@ -0,0 +1,8 @@ +export declare const CHANNEL_DEFAULTS: { + NOMINAL_COLOR: string[]; + NOMINAL_COLOR_EXTENDED: string[]; + QUANTITATIVE_COLOR: string; + SIZE: number; + SIZE_RANGE: number[]; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/core/channel/index.d.ts.map b/dist/src/core/channel/index.d.ts.map new file mode 100644 index 00000000..1ac2a6ad --- /dev/null +++ b/dist/src/core/channel/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/channel/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB;;;;;;CAyQ5B,CAAC"} \ No newline at end of file diff --git a/dist/src/core/example/hg-view-config-1.d.ts b/dist/src/core/example/hg-view-config-1.d.ts new file mode 100644 index 00000000..b5e8f435 --- /dev/null +++ b/dist/src/core/example/hg-view-config-1.d.ts @@ -0,0 +1,736 @@ +declare const example: { + compactLayout: boolean; + trackSourceServers: string[]; + views: ({ + genomePositionSearchBoxVisible: boolean; + genomePositionSearchBox: { + autocompleteServer: string; + autocompleteId: string; + chromInfoServer: string; + chromInfoId: string; + }; + layout: { + x: number; + y: number; + w: number; + h: number; + }; + tracks: { + top: never[]; + left: ({ + type: string; + width: number; + height: number; + contents: { + type: string; + server: string; + tilesetUid: string; + width: number; + height: number; + options: { + showMousePosition: boolean; + mousePositionColor: string; + fontSize: number; + labelPosition: string; + labelShowResolution: boolean; + labelColor: string; + labelBackgroundColor: string; + labelTextOpacity: number; + labelLeftMargin: number; + labelTopMargin: number; + labelRightMargin: number; + labelBottomMargin: number; + backgroundColor: string; + spec: { + spacing: number; + orientation: string; + assembly: string; + layout: string; + static: boolean; + xDomain: { + interval: number[]; + }; + centerRadius: number; + xOffset: number; + yOffset: number; + style: { + outlineWidth: number; + }; + data: { + url: string; + type: string; + row: string; + column: string; + value: string; + categories: string[]; + binSize: number; + }; + mark: string; + x: { + field: string; + type: string; + axis: string; + domain: { + interval: number[]; + }; + linkingId: string; + }; + xe: { + field: string; + type: string; + }; + row: { + field: string; + type: string; + legend: boolean; + }; + color: { + field: string; + type: string; + legend: boolean; + }; + tooltip: ({ + field: string; + type: string; + alt: string; + format?: undefined; + } | { + field: string; + type: string; + alt: string; + format: string; + })[]; + width: number; + height: number; + overlayOnPreviousTrack: boolean; + }; + theme: { + base: string; + root: { + background: string; + titleColor: string; + titleBackgroundColor: string; + titleFontSize: number; + titleFontFamily: string; + titleAlign: string; + titleFontWeight: string; + subtitleColor: string; + subtitleBackgroundColor: string; + subtitleFontSize: number; + subtitleFontFamily: string; + subtitleFontWeight: string; + subtitleAlign: string; + mousePositionColor: string; + }; + track: { + background: string; + alternatingBackground: string; + titleColor: string; + titleBackground: string; + titleFontSize: number; + titleAlign: string; + outline: string; + outlineWidth: number; + }; + legend: { + position: string; + background: string; + backgroundOpacity: number; + labelColor: string; + labelFontSize: number; + labelFontWeight: string; + labelFontFamily: string; + backgroundStroke: string; + tickColor: string; + }; + axis: { + tickColor: string; + labelColor: string; + labelFontSize: number; + labelFontWeight: string; + labelFontFamily: string; + baselineColor: string; + gridColor: string; + gridStrokeWidth: number; + gridStrokeType: string; + gridStrokeDash: number[]; + }; + markCommon: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + point: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + rect: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + triangle: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + area: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + line: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + bar: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + rule: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + link: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + text: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + textAnchor: string; + textFontWeight: string; + }; + brush: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + }; + }; + }[]; + uid?: undefined; + chromInfoPath?: undefined; + options?: undefined; + } | { + uid: string; + type: string; + chromInfoPath: string; + options: { + layout: string; + outerRadius: null; + width: number; + height: number; + theme: { + base: string; + root: { + background: string; + titleColor: string; + titleBackgroundColor: string; + titleFontSize: number; + titleFontFamily: string; + titleAlign: string; + titleFontWeight: string; + subtitleColor: string; + subtitleBackgroundColor: string; + subtitleFontSize: number; + subtitleFontFamily: string; + subtitleFontWeight: string; + subtitleAlign: string; + mousePositionColor: string; + }; + track: { + background: string; + alternatingBackground: string; + titleColor: string; + titleBackground: string; + titleFontSize: number; + titleAlign: string; + outline: string; + outlineWidth: number; + }; + legend: { + position: string; + background: string; + backgroundOpacity: number; + labelColor: string; + labelFontSize: number; + labelFontWeight: string; + labelFontFamily: string; + backgroundStroke: string; + tickColor: string; + }; + axis: { + tickColor: string; + labelColor: string; + labelFontSize: number; + labelFontWeight: string; + labelFontFamily: string; + baselineColor: string; + gridColor: string; + gridStrokeWidth: number; + gridStrokeType: string; + gridStrokeDash: number[]; + }; + markCommon: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + point: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + rect: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + triangle: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + area: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + line: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + bar: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + rule: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + link: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + text: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + textAnchor: string; + textFontWeight: string; + }; + brush: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + }; + assembly: string; + stroke: string; + color: string; + fontSize: number; + fontFamily: string; + fontWeight: string; + tickColor: string; + tickFormat: string; + tickPositions: string; + reverseOrientation: boolean; + }; + width: number; + height?: undefined; + contents?: undefined; + })[]; + center: never[]; + right: never[]; + bottom: never[]; + gallery: never[]; + whole: never[]; + }; + initialXDomain: number[]; + initialYDomain: number[]; + zoomFixed: boolean; + zoomLimits: (number | null)[]; + uid: string; + chromInfoPath: string; + } | { + genomePositionSearchBoxVisible: boolean; + genomePositionSearchBox: { + autocompleteServer: string; + autocompleteId: string; + chromInfoServer: string; + chromInfoId: string; + }; + layout: { + x: number; + y: number; + w: number; + h: number; + }; + tracks: { + top: never[]; + left: { + type: string; + width: number; + height: number; + contents: { + type: string; + server: string; + tilesetUid: string; + width: number; + height: number; + options: { + showMousePosition: boolean; + mousePositionColor: string; + fontSize: number; + labelPosition: string; + labelShowResolution: boolean; + labelColor: string; + labelBackgroundColor: string; + labelTextOpacity: number; + labelLeftMargin: number; + labelTopMargin: number; + labelRightMargin: number; + labelBottomMargin: number; + backgroundColor: string; + spec: { + spacing: number; + orientation: string; + assembly: string; + layout: string; + static: boolean; + xDomain: { + interval: number[]; + }; + centerRadius: number; + xOffset: number; + yOffset: number; + style: { + outlineWidth: number; + }; + data: { + url: string; + type: string; + row: string; + column: string; + value: string; + categories: string[]; + binSize: number; + }; + mark: string; + x: { + field: string; + type: string; + domain: { + interval: number[]; + }; + linkingId: string; + }; + xe: { + field: string; + type: string; + }; + row: { + field: string; + type: string; + legend: boolean; + }; + color: { + field: string; + type: string; + legend: boolean; + }; + tooltip: ({ + field: string; + type: string; + alt: string; + format?: undefined; + } | { + field: string; + type: string; + alt: string; + format: string; + })[]; + width: number; + height: number; + }; + theme: { + base: string; + root: { + background: string; + titleColor: string; + titleBackgroundColor: string; + titleFontSize: number; + titleFontFamily: string; + titleAlign: string; + titleFontWeight: string; + subtitleColor: string; + subtitleBackgroundColor: string; + subtitleFontSize: number; + subtitleFontFamily: string; + subtitleFontWeight: string; + subtitleAlign: string; + mousePositionColor: string; + }; + track: { + background: string; + alternatingBackground: string; + titleColor: string; + titleBackground: string; + titleFontSize: number; + titleAlign: string; + outline: string; + outlineWidth: number; + }; + legend: { + position: string; + background: string; + backgroundOpacity: number; + labelColor: string; + labelFontSize: number; + labelFontWeight: string; + labelFontFamily: string; + backgroundStroke: string; + tickColor: string; + }; + axis: { + tickColor: string; + labelColor: string; + labelFontSize: number; + labelFontWeight: string; + labelFontFamily: string; + baselineColor: string; + gridColor: string; + gridStrokeWidth: number; + gridStrokeType: string; + gridStrokeDash: number[]; + }; + markCommon: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + point: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + rect: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + triangle: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + area: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + line: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + bar: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + rule: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + link: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + text: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + textAnchor: string; + textFontWeight: string; + }; + brush: { + color: string; + size: number; + stroke: string; + strokeWidth: number; + opacity: number; + nominalColorRange: string[]; + quantitativeSizeRange: number[]; + }; + }; + }; + }[]; + }[]; + center: never[]; + right: never[]; + bottom: never[]; + gallery: never[]; + whole: never[]; + }; + initialXDomain: number[]; + initialYDomain: number[]; + zoomFixed: boolean; + zoomLimits: (number | null)[]; + uid: string; + chromInfoPath?: undefined; + })[]; + zoomLocks: { + locksByViewUid: {}; + locksDict: {}; + }; + locationLocks: { + locksByViewUid: {}; + locksDict: {}; + }; + editable: boolean; + chromInfoPath: string; +}; +export default example; +//# sourceMappingURL=hg-view-config-1.d.ts.map \ No newline at end of file diff --git a/dist/src/core/example/hg-view-config-1.d.ts.map b/dist/src/core/example/hg-view-config-1.d.ts.map new file mode 100644 index 00000000..2205d6ba --- /dev/null +++ b/dist/src/core/example/hg-view-config-1.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hg-view-config-1.d.ts","sourceRoot":"","sources":["../../../../src/core/example/hg-view-config-1.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAy9BZ,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/dist/src/core/gosling-component.d.ts b/dist/src/core/gosling-component.d.ts new file mode 100644 index 00000000..e6eae139 --- /dev/null +++ b/dist/src/core/gosling-component.d.ts @@ -0,0 +1,36 @@ +import { type HiGlassApi } from './higlass-component-wrapper'; +import type { TemplateTrackDef } from '@gosling-lang/gosling-schema'; +import type { RequestInit } from '@gosling-lang/higlass-schema'; +import React from 'react'; +import * as gosling from '..'; +import { type Theme } from './utils/theme'; +import { type GoslingApi } from '../api/api'; +/** Matches URLs to specific fetch options so that datafetchers have access URL specific fetch options */ +export interface UrlToFetchOptions { + [url: string]: RequestInit; +} +type CompiledCallbackFn = (goslingSpec: gosling.GoslingSpec, higlassSpec: gosling.HiGlassSpec, _additionalData: { + _processedSpec: gosling.GoslingSpec; +}) => void; +interface GoslingCompProps { + spec?: gosling.GoslingSpec; + compiled?: CompiledCallbackFn; + padding?: number; + margin?: number; + border?: string; + id?: string; + className?: string; + theme?: Theme; + templates?: TemplateTrackDef[]; + urlToFetchOptions?: UrlToFetchOptions; + experimental?: { + reactive?: boolean; + }; +} +export type GoslingRef = { + api: GoslingApi; + hgApi: HiGlassApi; +}; +export declare const GoslingComponent: React.ForwardRefExoticComponent>; +export {}; +//# sourceMappingURL=gosling-component.d.ts.map \ No newline at end of file diff --git a/dist/src/core/gosling-component.d.ts.map b/dist/src/core/gosling-component.d.ts.map new file mode 100644 index 00000000..2fa57c89 --- /dev/null +++ b/dist/src/core/gosling-component.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gosling-component.d.ts","sourceRoot":"","sources":["../../../src/core/gosling-component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAA2B,MAAM,6BAA6B,CAAC;AACvF,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,8BAA8B,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAA6F,MAAM,OAAO,CAAC;AAElH,OAAO,KAAK,OAAO,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAY,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAaxD,yGAAyG;AACzG,MAAM,WAAW,iBAAiB;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;CAC9B;AACD,KAAK,kBAAkB,GAAG,CACtB,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,eAAe,EAAE;IAAE,cAAc,EAAE,OAAO,CAAC,WAAW,CAAA;CAAE,KACvD,IAAI,CAAA;AAET,UAAU,gBAAgB;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,YAAY,CAAC,EAAE;QACX,QAAQ,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;CACL;AAED,MAAM,MAAM,UAAU,GAAG;IACrB,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,6FAgL3B,CAAC"} \ No newline at end of file diff --git a/dist/src/core/gosling-embed.d.ts b/dist/src/core/gosling-embed.d.ts new file mode 100644 index 00000000..418fc93c --- /dev/null +++ b/dist/src/core/gosling-embed.d.ts @@ -0,0 +1,18 @@ +import type { GoslingSpec } from '@gosling-lang/gosling-schema'; +import type { UrlToFetchOptions } from './gosling-component'; +import { type Theme } from './utils/theme'; +import { type GoslingApi } from '../api/api'; +import { type HiGlassComponentWrapperProps } from './higlass-component-wrapper'; +export type GoslingEmbedOptions = Omit & { + id?: string; + className?: string; + theme?: Theme; + urlToFetchOptions?: UrlToFetchOptions; +}; +/** + * Embed a Gosling component to a given HTMLElement. + * @param element + * @param spec + */ +export declare function embed(element: HTMLElement, spec: GoslingSpec, opts?: GoslingEmbedOptions): Promise; +//# sourceMappingURL=gosling-embed.d.ts.map \ No newline at end of file diff --git a/dist/src/core/gosling-embed.d.ts.map b/dist/src/core/gosling-embed.d.ts.map new file mode 100644 index 00000000..a9f8eddf --- /dev/null +++ b/dist/src/core/gosling-embed.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gosling-embed.d.ts","sourceRoot":"","sources":["../../../src/core/gosling-embed.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAKhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAY,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,KAAK,UAAU,EAAa,MAAM,YAAY,CAAC;AAExD,OAAO,EAGH,KAAK,4BAA4B,EACpC,MAAM,6BAA6B,CAAC;AAErC,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,4BAA4B,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC,GAAG;IAC5F,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACzC,CAAC;AA4CF;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,GAAE,mBAAwB,uBA4B5F"} \ No newline at end of file diff --git a/dist/src/core/higlass-component-wrapper.d.ts b/dist/src/core/higlass-component-wrapper.d.ts new file mode 100644 index 00000000..4bb24976 --- /dev/null +++ b/dist/src/core/higlass-component-wrapper.d.ts @@ -0,0 +1,28 @@ +import type * as PIXI from 'pixi.js'; +import React from 'react'; +import type { HiGlassSpec } from '@gosling-lang/higlass-schema'; +export type HiGlassApi = { + api: Record; + pixiRenderer: PIXI.Renderer; + pixiStage: PIXI.IRenderableObject; +}; +export interface HiGlassComponentWrapperProps { + size: { + width: number; + height: number; + }; + viewConfig?: HiGlassSpec; + options: { + padding?: number; + margin?: number; + border?: string; + background?: string; + responsiveWidth?: boolean; + responsiveHeight?: boolean; + alt?: string; + }; + id?: string; + className?: string; +} +export declare const HiGlassComponentWrapper: React.ForwardRefExoticComponent>; +//# sourceMappingURL=higlass-component-wrapper.d.ts.map \ No newline at end of file diff --git a/dist/src/core/higlass-component-wrapper.d.ts.map b/dist/src/core/higlass-component-wrapper.d.ts.map new file mode 100644 index 00000000..7ad2beca --- /dev/null +++ b/dist/src/core/higlass-component-wrapper.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"higlass-component-wrapper.d.ts","sourceRoot":"","sources":["../../../src/core/higlass-component-wrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAShE,MAAM,MAAM,UAAU,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzB,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC;IAC5B,SAAS,EAAE,IAAI,CAAC,iBAAiB,CAAC;CACrC,CAAC;AAEF,MAAM,WAAW,4BAA4B;IACzC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE;QACL,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,uBAAuB,6GA6FnC,CAAC"} \ No newline at end of file diff --git a/dist/src/core/init.d.ts b/dist/src/core/init.d.ts new file mode 100644 index 00000000..ff7afe6f --- /dev/null +++ b/dist/src/core/init.d.ts @@ -0,0 +1,5 @@ +/** + * Register plugin tracks and data fetchers to HiGlass. This is necessary for the first time before using Gosling.js. + */ +export declare function init(): void; +//# sourceMappingURL=init.d.ts.map \ No newline at end of file diff --git a/dist/src/core/init.d.ts.map b/dist/src/core/init.d.ts.map new file mode 100644 index 00000000..a5b4fa5c --- /dev/null +++ b/dist/src/core/init.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/core/init.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,wBAAgB,IAAI,SAsEnB"} \ No newline at end of file diff --git a/dist/src/core/mark/area.d.ts b/dist/src/core/mark/area.d.ts new file mode 100644 index 00000000..b401ad76 --- /dev/null +++ b/dist/src/core/mark/area.d.ts @@ -0,0 +1,7 @@ +import type { Tile } from '@gosling-lang/gosling-track'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +/** + * Draw area marks + */ +export declare function drawArea(HGC: import('@higlass/types').HGC, track: any, tile: Tile, model: GoslingTrackModel): void; +//# sourceMappingURL=area.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/area.d.ts.map b/dist/src/core/mark/area.d.ts.map new file mode 100644 index 00000000..bd91d6a2 --- /dev/null +++ b/dist/src/core/mark/area.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"area.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/area.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAKxF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QAmS3G"} \ No newline at end of file diff --git a/dist/src/core/mark/axis.d.ts b/dist/src/core/mark/axis.d.ts new file mode 100644 index 00000000..ffaf8ebe --- /dev/null +++ b/dist/src/core/mark/axis.d.ts @@ -0,0 +1,16 @@ +import type { Tile } from '@gosling-lang/gosling-track'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { CompleteThemeDeep } from '../utils/theme'; +/** + * Draw linear scale Y axis + */ +export declare function drawLinearYAxis(HGC: { + libraries: { + PIXI: typeof import('pixi.js'); + }; +}, trackInfo: any, _tile: unknown, model: GoslingTrackModel, theme: Required): void; +/** + * Draw linear scale Y axis + */ +export declare function drawCircularYAxis(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel, theme: Required): void; +//# sourceMappingURL=axis.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/axis.d.ts.map b/dist/src/core/mark/axis.d.ts.map new file mode 100644 index 00000000..9b0c1be0 --- /dev/null +++ b/dist/src/core/mark/axis.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/axis.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAQxD;;GAEG;AACH,wBAAgB,eAAe,CAC3B,GAAG,EAAE;IAAE,SAAS,EAAE;QAAE,IAAI,EAAE,cAAc,SAAS,CAAC,CAAA;KAAE,CAAA;CAAE,EACtD,SAAS,EAAE,GAAG,EACd,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QA6HrC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EACjC,SAAS,EAAE,GAAG,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAoMrC"} \ No newline at end of file diff --git a/dist/src/core/mark/background.d.ts b/dist/src/core/mark/background.d.ts new file mode 100644 index 00000000..1224a311 --- /dev/null +++ b/dist/src/core/mark/background.d.ts @@ -0,0 +1,4 @@ +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { CompleteThemeDeep } from '../utils/theme'; +export declare function drawBackground(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; +//# sourceMappingURL=background.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/background.d.ts.map b/dist/src/core/mark/background.d.ts.map new file mode 100644 index 00000000..69d60a1c --- /dev/null +++ b/dist/src/core/mark/background.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/background.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,wBAAgB,cAAc,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QA4DvG"} \ No newline at end of file diff --git a/dist/src/core/mark/bar.d.ts b/dist/src/core/mark/bar.d.ts new file mode 100644 index 00000000..d2e0da25 --- /dev/null +++ b/dist/src/core/mark/bar.d.ts @@ -0,0 +1,11 @@ +import type { Tile } from '@gosling-lang/gosling-track'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { PIXIVisualProperty } from '../visual-property.schema'; +export declare function drawBar(track: any, tile: Tile, model: GoslingTrackModel): void; +export declare function barProperty(gm: GoslingTrackModel, propertyKey: PIXIVisualProperty, datum?: { + [k: string]: string | number; +}, additionalInfo?: { + tileUnitWidth?: number; + markWidth?: number; +}): any; +//# sourceMappingURL=bar.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/bar.d.ts.map b/dist/src/core/mark/bar.d.ts.map new file mode 100644 index 00000000..6b895c21 --- /dev/null +++ b/dist/src/core/mark/bar.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/bar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAExF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAKpE,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QAqNvE;AAED,wBAAgB,WAAW,CACvB,EAAE,EAAE,iBAAiB,EACrB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,CAAC,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,EACxC,cAAc,CAAC,EAAE;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,OAiBJ"} \ No newline at end of file diff --git a/dist/src/core/mark/betweenLink.d.ts b/dist/src/core/mark/betweenLink.d.ts new file mode 100644 index 00000000..996fa687 --- /dev/null +++ b/dist/src/core/mark/betweenLink.d.ts @@ -0,0 +1,4 @@ +import type * as PIXI from 'pixi.js'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +export declare function drawBetweenLink(g: PIXI.Graphics, trackInfo: any, model: GoslingTrackModel): void; +//# sourceMappingURL=betweenLink.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/betweenLink.d.ts.map b/dist/src/core/mark/betweenLink.d.ts.map new file mode 100644 index 00000000..fb525521 --- /dev/null +++ b/dist/src/core/mark/betweenLink.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"betweenLink.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/betweenLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAOxF,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,QAiOzF"} \ No newline at end of file diff --git a/dist/src/core/mark/grid.d.ts b/dist/src/core/mark/grid.d.ts new file mode 100644 index 00000000..5ce1963e --- /dev/null +++ b/dist/src/core/mark/grid.d.ts @@ -0,0 +1,6 @@ +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { CompleteThemeDeep } from '../utils/theme'; +export declare function drawGrid(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; +export declare function drawRowGrid(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; +export declare function drawYGridQuantitative(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; +//# sourceMappingURL=grid.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/grid.d.ts.map b/dist/src/core/mark/grid.d.ts.map new file mode 100644 index 00000000..6a6a843f --- /dev/null +++ b/dist/src/core/mark/grid.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/grid.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAKxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,wBAAgB,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAGjG;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAgFpG;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAgH9G"} \ No newline at end of file diff --git a/dist/src/core/mark/index.d.ts b/dist/src/core/mark/index.d.ts new file mode 100644 index 00000000..1a1c12a3 --- /dev/null +++ b/dist/src/core/mark/index.d.ts @@ -0,0 +1,22 @@ +import type { Tile } from '@gosling-lang/gosling-track'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { ChannelTypes } from '@gosling-lang/gosling-schema'; +import type { CompleteThemeDeep } from '../utils/theme'; +/** + * Visual channels currently supported for visual encoding. + */ +export declare const SUPPORTED_CHANNELS: (keyof typeof ChannelTypes)[]; +export declare const RESOLUTION = 4; +/** + * Draw a track based on the track specification in a Gosling grammar. + */ +export declare function drawMark(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel): void; +/** + * Draw chart embellishments before rendering marks. + */ +export declare function drawPreEmbellishment(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel, theme: Required): void; +/** + * Draw chart embellishments after rendering marks. + */ +export declare function drawPostEmbellishment(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel, theme: Required): void; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/index.d.ts.map b/dist/src/core/mark/index.d.ts.map new file mode 100644 index 00000000..de7ecc99 --- /dev/null +++ b/dist/src/core/mark/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAMxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAYjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,CAAC,MAAM,OAAO,YAAY,CAAC,EAmB3D,CAAC;AAEF,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QAmE/G;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EACjC,SAAS,EAAE,GAAG,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAyBrC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACjC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EACjC,SAAS,EAAE,GAAG,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QA0BrC"} \ No newline at end of file diff --git a/dist/src/core/mark/legend.d.ts b/dist/src/core/mark/legend.d.ts new file mode 100644 index 00000000..0de18b8d --- /dev/null +++ b/dist/src/core/mark/legend.d.ts @@ -0,0 +1,20 @@ +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { CompleteThemeDeep } from '../utils/theme'; +type Libraries = Pick; +type LegendOffset = { + offsetRight: number; +}; +export declare function drawColorLegend(HGC: { + libraries: Libraries; +}, trackInfo: any, _tile: unknown, model: GoslingTrackModel, theme: Required): void; +export declare function drawColorLegendQuantitative(HGC: { + libraries: Libraries; +}, trackInfo: any, _tile: unknown, model: GoslingTrackModel, theme: Required, channelKey: 'color' | 'stroke', offset: LegendOffset): void; +export declare function drawColorLegendCategories(HGC: { + libraries: Libraries; +}, track: any, _tile: unknown, tm: GoslingTrackModel, theme: Required): void; +export declare function drawRowLegend(HGC: { + libraries: Libraries; +}, trackInfo: any, _tile: unknown, tm: GoslingTrackModel, theme: Required): void; +export {}; +//# sourceMappingURL=legend.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/legend.d.ts.map b/dist/src/core/mark/legend.d.ts.map new file mode 100644 index 00000000..9f319f7a --- /dev/null +++ b/dist/src/core/mark/legend.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/legend.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAOxD,KAAK,SAAS,GAAG,IAAI,CAAC,cAAc,oBAAoB,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAC;AAE9F,KAAK,YAAY,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5C,wBAAgB,eAAe,CAC3B,GAAG,EAAE;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,EAC7B,SAAS,EAAE,GAAG,EACd,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QA8BrC;AAED,wBAAgB,2BAA2B,CACvC,GAAG,EAAE;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,EAC7B,SAAS,EAAE,GAAG,EACd,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAClC,UAAU,EAAE,OAAO,GAAG,QAAQ,EAC9B,MAAM,EAAE,YAAY,QAuOvB;AAED,wBAAgB,yBAAyB,CACrC,GAAG,EAAE;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,EAC7B,KAAK,EAAE,GAAG,EACV,KAAK,EAAE,OAAO,EACd,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAmKrC;AAED,wBAAgB,aAAa,CACzB,GAAG,EAAE;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,EAC7B,SAAS,EAAE,GAAG,EACd,KAAK,EAAE,OAAO,EACd,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAmErC"} \ No newline at end of file diff --git a/dist/src/core/mark/line.d.ts b/dist/src/core/mark/line.d.ts new file mode 100644 index 00000000..43740dd5 --- /dev/null +++ b/dist/src/core/mark/line.d.ts @@ -0,0 +1,4 @@ +import type * as PIXI from 'pixi.js'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +export declare function drawLine(g: PIXI.Graphics, model: GoslingTrackModel, trackWidth: number, trackHeight: number): void; +//# sourceMappingURL=line.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/line.d.ts.map b/dist/src/core/mark/line.d.ts.map new file mode 100644 index 00000000..fdce93ab --- /dev/null +++ b/dist/src/core/mark/line.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/line.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAMxF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QA6F3G"} \ No newline at end of file diff --git a/dist/src/core/mark/outline-circular.d.ts b/dist/src/core/mark/outline-circular.d.ts new file mode 100644 index 00000000..163bf6f1 --- /dev/null +++ b/dist/src/core/mark/outline-circular.d.ts @@ -0,0 +1,4 @@ +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { CompleteThemeDeep } from '../utils/theme'; +export declare function drawCircularOutlines(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; +//# sourceMappingURL=outline-circular.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/outline-circular.d.ts.map b/dist/src/core/mark/outline-circular.d.ts.map new file mode 100644 index 00000000..e405e297 --- /dev/null +++ b/dist/src/core/mark/outline-circular.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"outline-circular.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/outline-circular.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAIxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QA2F7G"} \ No newline at end of file diff --git a/dist/src/core/mark/outline.d.ts b/dist/src/core/mark/outline.d.ts new file mode 100644 index 00000000..751a9724 --- /dev/null +++ b/dist/src/core/mark/outline.d.ts @@ -0,0 +1,12 @@ +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { CompleteThemeDeep } from '../utils/theme'; +export declare const TITLE_STYLE: { + fontSize: string; + fontFamily: string; + fontWeight: string; + fill: string; + background: string; + lineJoin: string; +}; +export declare function drawChartOutlines(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; +//# sourceMappingURL=outline.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/outline.d.ts.map b/dist/src/core/mark/outline.d.ts.map new file mode 100644 index 00000000..f84e0441 --- /dev/null +++ b/dist/src/core/mark/outline.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"outline.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/outline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAwE1G"} \ No newline at end of file diff --git a/dist/src/core/mark/point.d.ts b/dist/src/core/mark/point.d.ts new file mode 100644 index 00000000..06ebac14 --- /dev/null +++ b/dist/src/core/mark/point.d.ts @@ -0,0 +1,8 @@ +import type * as PIXI from 'pixi.js'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { PIXIVisualProperty } from '../visual-property.schema'; +export declare function drawPoint(track: any, g: PIXI.Graphics, model: GoslingTrackModel): void; +export declare function pointProperty(model: GoslingTrackModel, propertyKey: PIXIVisualProperty, datum?: { + [k: string]: string | number; +}): any; +//# sourceMappingURL=point.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/point.d.ts.map b/dist/src/core/mark/point.d.ts.map new file mode 100644 index 00000000..fa2c556a --- /dev/null +++ b/dist/src/core/mark/point.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/point.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAKxF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,iBAAiB,QAiF/E;AAED,wBAAgB,aAAa,CACzB,KAAK,EAAE,iBAAiB,EACxB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,CAAC,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,OAoB3C"} \ No newline at end of file diff --git a/dist/src/core/mark/rect.d.ts b/dist/src/core/mark/rect.d.ts new file mode 100644 index 00000000..200d982d --- /dev/null +++ b/dist/src/core/mark/rect.d.ts @@ -0,0 +1,11 @@ +import type { Tile } from '@gosling-lang/gosling-track'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { PIXIVisualProperty } from '../visual-property.schema'; +export declare function drawRect(HGC: import('@higlass/types').HGC, track: any, tile: Tile, model: GoslingTrackModel): void; +export declare function rectProperty(gm: GoslingTrackModel, propertyKey: PIXIVisualProperty, datum?: { + [k: string]: string | number; +}, additionalInfo?: { + markHeight?: number; + markWidth?: number; +}): any; +//# sourceMappingURL=rect.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/rect.d.ts.map b/dist/src/core/mark/rect.d.ts.map new file mode 100644 index 00000000..7efc1e84 --- /dev/null +++ b/dist/src/core/mark/rect.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/rect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAExF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAIpE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QAwH3G;AAED,wBAAgB,YAAY,CACxB,EAAE,EAAE,iBAAiB,EACrB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,CAAC,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,EACxC,cAAc,CAAC,EAAE;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,OAqBJ"} \ No newline at end of file diff --git a/dist/src/core/mark/rule.d.ts b/dist/src/core/mark/rule.d.ts new file mode 100644 index 00000000..2c6c9c4f --- /dev/null +++ b/dist/src/core/mark/rule.d.ts @@ -0,0 +1,4 @@ +import type { Tile } from '@gosling-lang/gosling-track'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +export declare function drawRule(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel): void; +//# sourceMappingURL=rule.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/rule.d.ts.map b/dist/src/core/mark/rule.d.ts.map new file mode 100644 index 00000000..302134ae --- /dev/null +++ b/dist/src/core/mark/rule.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAKxF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QAqN/G"} \ No newline at end of file diff --git a/dist/src/core/mark/text.d.ts b/dist/src/core/mark/text.d.ts new file mode 100644 index 00000000..22545966 --- /dev/null +++ b/dist/src/core/mark/text.d.ts @@ -0,0 +1,14 @@ +import type { Tile } from '@gosling-lang/gosling-track'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +export declare const TEXT_STYLE_GLOBAL: { + readonly fontSize: "12px"; + readonly fontFamily: "sans-serif"; + readonly fontWeight: "normal"; + readonly fill: "black"; + readonly background: "white"; + readonly lineJoin: "round"; + readonly stroke: "#ffffff"; + readonly strokeThickness: 0; +}; +export declare function drawText(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel): void; +//# sourceMappingURL=text.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/text.d.ts.map b/dist/src/core/mark/text.d.ts.map new file mode 100644 index 00000000..615683b4 --- /dev/null +++ b/dist/src/core/mark/text.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAMxF,eAAO,MAAM,iBAAiB;;;;;;;;;CASpB,CAAC;AAEX,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QA8S/G"} \ No newline at end of file diff --git a/dist/src/core/mark/title.d.ts b/dist/src/core/mark/title.d.ts new file mode 100644 index 00000000..d7f335a6 --- /dev/null +++ b/dist/src/core/mark/title.d.ts @@ -0,0 +1,5 @@ +import type { Tile } from '@gosling-lang/gosling-track'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { CompleteThemeDeep } from '../utils/theme'; +export declare function drawCircularTitle(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel, theme: Required): void; +//# sourceMappingURL=title.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/title.d.ts.map b/dist/src/core/mark/title.d.ts.map new file mode 100644 index 00000000..570d7737 --- /dev/null +++ b/dist/src/core/mark/title.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/title.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,wBAAgB,iBAAiB,CAC7B,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EACjC,SAAS,EAAE,GAAG,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAgFrC"} \ No newline at end of file diff --git a/dist/src/core/mark/triangle.d.ts b/dist/src/core/mark/triangle.d.ts new file mode 100644 index 00000000..da239f4d --- /dev/null +++ b/dist/src/core/mark/triangle.d.ts @@ -0,0 +1,4 @@ +import type * as PIXI from 'pixi.js'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +export declare function drawTriangle(g: PIXI.Graphics, model: GoslingTrackModel, trackWidth: number, trackHeight: number): void; +//# sourceMappingURL=triangle.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/triangle.d.ts.map b/dist/src/core/mark/triangle.d.ts.map new file mode 100644 index 00000000..549517b3 --- /dev/null +++ b/dist/src/core/mark/triangle.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"triangle.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/triangle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAMxF,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAuJ/G"} \ No newline at end of file diff --git a/dist/src/core/mark/withinLink.d.ts b/dist/src/core/mark/withinLink.d.ts new file mode 100644 index 00000000..eb4497d9 --- /dev/null +++ b/dist/src/core/mark/withinLink.d.ts @@ -0,0 +1,4 @@ +import type * as PIXI from 'pixi.js'; +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +export declare function drawWithinLink(g: PIXI.Graphics, trackInfo: any, model: GoslingTrackModel): void; +//# sourceMappingURL=withinLink.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/withinLink.d.ts.map b/dist/src/core/mark/withinLink.d.ts.map new file mode 100644 index 00000000..1cf14fd6 --- /dev/null +++ b/dist/src/core/mark/withinLink.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"withinLink.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/withinLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAOxF,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,QA+WxF"} \ No newline at end of file diff --git a/dist/src/core/utils/array.d.ts b/dist/src/core/utils/array.d.ts new file mode 100644 index 00000000..cbffc43c --- /dev/null +++ b/dist/src/core/utils/array.d.ts @@ -0,0 +1,44 @@ +/** + * Repeat elements in the array until its size becomes to `targetLength`. + */ +export declare function arrayRepeat(base: T[], targetLength: number): T[]; +/** + * Insert item to an array and return it. + * @param array Array to be updated. + * @param index Index of array to insert new item. + * @param item Item to be inserted. + * @returns Updated array. + */ +export declare function insertItemToArray(array: T[], index: number, item: T): T[]; +/** + * Insert item to an array and return it. + * @param array Array to be updated. + * @param index Index of array to change item. + * @param item Item to be inserted. + * @returns Updated array. + */ +export declare function modifyItemInArray(array: T[], index: number, item: T): T[]; +/** + * Remove item from an array stored in a certain index. + * @param array Array to be updated. + * @param index Index of an item to be removed. + * @returns Updated array. + */ +export declare function removeItemFromArray(array: T[], index: number): T[]; +/** + * Convert 1D array into 2D array where each pair of elements are grouped. + * @param array Array to be used. + * @returns Updated array. + */ +export declare function flatArrayToPairArray(array: T[]): [T, T][]; +/** + * Check if all elements in an array satisfy a type guard. + * @param array Array to check + * @param is Type guard to check each element + */ +export declare function isEvery(array: any[], is: (x: Arr[number]) => x is T): array is T[]; +/** Check if all elements in an array are numbers. */ +export declare function isNumberArray(array: any[]): array is number[]; +/** Check if all elements in an array are strings. */ +export declare function isStringArray(array: any[]): array is string[]; +//# sourceMappingURL=array.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/array.d.ts.map b/dist/src/core/utils/array.d.ts.map new file mode 100644 index 00000000..ed7536c3 --- /dev/null +++ b/dist/src/core/utils/array.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/array.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC,EAAE,CAUnE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAE5E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAE5E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE,CAErE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAM5D;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,SAAS,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,EAAE,CAExG;AAED,qDAAqD;AACrD,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,MAAM,EAAE,CAE7D;AAED,qDAAqD;AACrD,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,MAAM,EAAE,CAE7D"} \ No newline at end of file diff --git a/dist/src/core/utils/assembly.d.ts b/dist/src/core/utils/assembly.d.ts new file mode 100644 index 00000000..ac28051d --- /dev/null +++ b/dist/src/core/utils/assembly.d.ts @@ -0,0 +1,61 @@ +import type { Assembly, GenomicPosition } from '@gosling-lang/gosling-schema'; +export interface ChromSize { + size: { + [chr: string]: number; + }; + interval: { + [chr: string]: [number, number]; + }; + total: number; + path: string; +} +/** + * Get relative chromosome position (e.g., `100` => `{ chromosome: 'chr1', position: 100 }`) + * @param absPos number which is the absolute chromosome position + * @param assembly the assembly used to calculate which chromosome position + * @param returnWithinAssembly If true, then if the absolute position is before the first chromosome, it returns the + * first position of the first chromosome. If the absolute position is after the last chromosome, it returns the last + * position of the last chromosome + * @returns the genomic position of the absPos + */ +export declare function getRelativeGenomicPosition(absPos: number, assembly?: Assembly, returnWithinAssembly?: boolean): GenomicPosition; +/** + * Get chromosome sizes. + * @param assembly (default: 'hg38') + */ +export declare function computeChromSizes(assembly?: Assembly): ChromSize; +/** + * Some presets of auto-complete IDs (`autocompleteId`) to search for genes using the HiGlass server. + */ +export declare function getAutoCompleteId(assembly?: Assembly): "OHJakQICQD6gTD7skx4EWA" | "QDutvmyiSrec5nX4pA5WGQ" | "GUm5aBiLRCyz2PsBea7Yzg" | "P0PLbQMwTYGy-5uPIQid7A"; +/** + * Calculate cumulative interval of each chromosome. + */ +export declare function getChromInterval(chromSize: { + [k: string]: number; +}): { + [k: string]: [number, number]; +}; +/** + * Calculate total size of entire chromosomes. + */ +export declare function getChromTotalSize(chromSize: { + [k: string]: number; +}): number; +export declare function parseGenomicPosition(position: string): { + chromosome: string; + start?: number; + end?: number; +}; +/** + * A class that consistently manage and convert genomics positions. + */ +export declare class GenomicPositionHelper { + chromosome: string; + start?: number | undefined; + end?: number | undefined; + constructor(chromosome: string, start?: number | undefined, end?: number | undefined); + static fromString(str: string): GenomicPositionHelper; + toAbsoluteCoordinates(assembly?: Assembly, padding?: number): [number, number]; +} +//# sourceMappingURL=assembly.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/assembly.d.ts.map b/dist/src/core/utils/assembly.d.ts.map new file mode 100644 index 00000000..f80c1692 --- /dev/null +++ b/dist/src/core/utils/assembly.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"assembly.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/assembly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAc,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAW1F,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAChC,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACtC,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,QAAQ,EACnB,oBAAoB,UAAQ,GAC7B,eAAe,CA+BjB;AAYD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAgBhE;AAuDD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,QAAQ,6GAYpD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE;;EASlE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,UAEnE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAU3G;AAED;;GAEG;AACH,qBAAa,qBAAqB;IACX,UAAU,EAAE,MAAM;IAAS,KAAK,CAAC;IAAiB,GAAG,CAAC;gBAAtD,UAAU,EAAE,MAAM,EAAS,KAAK,CAAC,oBAAQ,EAAS,GAAG,CAAC,oBAAQ;IACjF,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,qBAAqB,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,SAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CAe5E"} \ No newline at end of file diff --git a/dist/src/core/utils/chrom-size.d.ts b/dist/src/core/utils/chrom-size.d.ts new file mode 100644 index 00000000..2b043939 --- /dev/null +++ b/dist/src/core/utils/chrom-size.d.ts @@ -0,0 +1,184 @@ +export declare const CHROM_SIZE_HG38: { + chr1: number; + chr2: number; + chr3: number; + chr4: number; + chr5: number; + chr6: number; + chr7: number; + chr8: number; + chr9: number; + chr10: number; + chr11: number; + chr12: number; + chr13: number; + chr14: number; + chr15: number; + chr16: number; + chr17: number; + chr18: number; + chr19: number; + chr20: number; + chr21: number; + chr22: number; + chrX: number; + chrY: number; +}; +export declare const CHROM_SIZE_HG19: { + chr1: number; + chr2: number; + chr3: number; + chr4: number; + chr5: number; + chr6: number; + chr7: number; + chr8: number; + chr9: number; + chr10: number; + chr11: number; + chr12: number; + chr13: number; + chr14: number; + chr15: number; + chr16: number; + chr17: number; + chr18: number; + chr19: number; + chr20: number; + chr21: number; + chr22: number; + chrX: number; + chrY: number; + chrM: number; +}; +export declare const CHROM_SIZE_HG18: { + chr1: number; + chr2: number; + chr3: number; + chr4: number; + chr5: number; + chr6: number; + chr7: number; + chr8: number; + chr9: number; + chr10: number; + chr11: number; + chr12: number; + chr13: number; + chr14: number; + chr15: number; + chr16: number; + chr17: number; + chr18: number; + chr19: number; + chr20: number; + chr21: number; + chr22: number; + chrX: number; + chrY: number; + chrM: number; +}; +export declare const CHROM_SIZE_HG17: { + chr1: number; + chr2: number; + chr3: number; + chr4: number; + chr5: number; + chr6: number; + chr7: number; + chr8: number; + chr9: number; + chr10: number; + chr11: number; + chr12: number; + chr13: number; + chr14: number; + chr15: number; + chr16: number; + chr17: number; + chr18: number; + chr19: number; + chr20: number; + chr21: number; + chr22: number; + chrX: number; + chrY: number; + chrM: number; +}; +export declare const CHROM_SIZE_HG16: { + chr1: number; + chr2: number; + chr3: number; + chr4: number; + chr5: number; + chr6: number; + chr7: number; + chr8: number; + chr9: number; + chr10: number; + chr11: number; + chr12: number; + chr13: number; + chr14: number; + chr15: number; + chr16: number; + chr17: number; + chr18: number; + chr19: number; + chr20: number; + chr21: number; + chr22: number; + chrX: number; + chrY: number; + chrM: number; +}; +export declare const CHROM_SIZE_MM10: { + chr1: number; + chr2: number; + chr3: number; + chr4: number; + chr5: number; + chr6: number; + chr7: number; + chr8: number; + chr9: number; + chr10: number; + chr11: number; + chr12: number; + chr13: number; + chr14: number; + chr15: number; + chr16: number; + chr17: number; + chr18: number; + chr19: number; + chrX: number; + chrY: number; + chrM: number; +}; +export declare const CHROM_SIZE_MM9: { + chr1: number; + chr2: number; + chr3: number; + chr4: number; + chr5: number; + chr6: number; + chr7: number; + chr8: number; + chr9: number; + chr10: number; + chr11: number; + chr12: number; + chr13: number; + chr14: number; + chr15: number; + chr16: number; + chr17: number; + chr18: number; + chr19: number; + chrX: number; + chrY: number; + chrM: number; +}; +export type Chromosome = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | 'X' | 'Y' | 'M' | 'chr1' | 'chr2' | 'chr3' | 'chr4' | 'chr5' | 'chr6' | 'chr7' | 'chr8' | 'chr9' | 'chr10' | 'chr11' | 'chr12' | 'chr13' | 'chr14' | 'chr15' | 'chr16' | 'chr17' | 'chr18' | 'chr19' | 'chr20' | 'chr21' | 'chr22' | 'chrX' | 'chrY' | 'chrM'; +//# sourceMappingURL=chrom-size.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/chrom-size.d.ts.map b/dist/src/core/utils/chrom-size.d.ts.map new file mode 100644 index 00000000..9235c872 --- /dev/null +++ b/dist/src/core/utils/chrom-size.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"chrom-size.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/chrom-size.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;CAyB3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;CAuB3B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;CAuB1B,CAAC;AAEF,MAAM,MAAM,UAAU,GAChB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,GAAG,GACH,GAAG,GACH,GAAG,GACH,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,CAAC"} \ No newline at end of file diff --git a/dist/src/core/utils/color-to-hex.d.ts b/dist/src/core/utils/color-to-hex.d.ts new file mode 100644 index 00000000..9819781a --- /dev/null +++ b/dist/src/core/utils/color-to-hex.d.ts @@ -0,0 +1,6 @@ +/** + * Convert a regular color value (e.g. 'red', '#FF0000', 'rgb(255,0,0)') to a hex value which is legible by PIXI. + */ +declare const colorToHex: (colorStr: string) => number; +export default colorToHex; +//# sourceMappingURL=color-to-hex.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/color-to-hex.d.ts.map b/dist/src/core/utils/color-to-hex.d.ts.map new file mode 100644 index 00000000..9675e779 --- /dev/null +++ b/dist/src/core/utils/color-to-hex.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"color-to-hex.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/color-to-hex.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,QAAA,MAAM,UAAU,aAAc,MAAM,WASnC,CAAC;AAEF,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/src/core/utils/data-transform.d.ts b/dist/src/core/utils/data-transform.d.ts new file mode 100644 index 00000000..df5eddc3 --- /dev/null +++ b/dist/src/core/utils/data-transform.d.ts @@ -0,0 +1,39 @@ +import type * as d3 from 'd3'; +import type { SingleTrack, Datum, FilterTransform, LogTransform, ExonSplitTransform, Assembly, StrConcatTransform, StrReplaceTransform, GenomicLengthTransform, SvTypeTransform, CoverageTransform, DisplaceTransform, JsonParseTransform } from '@gosling-lang/gosling-schema'; +/** + * Apply filter + */ +export declare function filterData(filter: FilterTransform, data: Datum[]): Datum[]; +/** + * Calculate new data, like log transformation. + */ +export declare function concatString(concat: StrConcatTransform, data: Datum[]): Datum[]; +export declare function replaceString(_: StrReplaceTransform, data: Datum[]): Datum[]; +/** + * Calculate new data, like log transformation. + */ +export declare function calculateData(log: LogTransform, data: Datum[]): Datum[]; +/** + * Calculate genomic length using two genomic fields. + */ +export declare function calculateGenomicLength(_: GenomicLengthTransform, data: Datum[]): Datum[]; +export declare function inferSvType(_: SvTypeTransform, data: Datum[]): Datum[]; +/** + * Aggregate data rows and calculate coverage of reads. + */ +export declare function aggregateCoverage(_: CoverageTransform, data: Datum[], scale: d3.ScaleContinuousNumeric): Datum[]; +/** + * Mark displacement transform furnctions. + * @param t An object that contains data transformation spec. + * @param data An array of objects that contain data. + * @param scale A d3's linear scale that map between data-level values to screen-level values (px). + * @returns + */ +export declare function displace(t: DisplaceTransform, data: Datum[], scale: d3.ScaleContinuousNumeric): Datum[]; +export declare function splitExon(split: ExonSplitTransform, data: Datum[], assembly?: Assembly): Datum[]; +export declare function parseSubJSON(_: JsonParseTransform, data: Datum[]): Datum[]; +/** + * Experimental! Only support one category supported yet. + */ +export declare function aggregateData(spec: SingleTrack, data: Datum[]): Datum[]; +//# sourceMappingURL=data-transform.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/data-transform.d.ts.map b/dist/src/core/utils/data-transform.d.ts.map new file mode 100644 index 00000000..692699f9 --- /dev/null +++ b/dist/src/core/utils/data-transform.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/data-transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,KAAK,EACR,WAAW,EACX,KAAK,EACL,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EACrB,MAAM,8BAA8B,CAAC;AAYtC;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAsB1E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAU/E;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAa5E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAevE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAcxF;AAKD,wBAAgB,WAAW,CAAC,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CA+CtE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,CAAC,EAAE,iBAAiB,EACpB,IAAI,EAAE,KAAK,EAAE,EACb,KAAK,EAAE,EAAE,CAAC,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,GACjD,KAAK,EAAE,CA0CT;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACpB,CAAC,EAAE,iBAAiB,EACpB,IAAI,EAAE,KAAK,EAAE,EACb,KAAK,EAAE,EAAE,CAAC,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,GACjD,KAAK,EAAE,CA2GT;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,QAAQ,GAAE,QAAiB,GAAG,KAAK,EAAE,CA+BxG;AAGD,wBAAgB,YAAY,CAAC,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CA0B1E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CA+DvE"} \ No newline at end of file diff --git a/dist/src/core/utils/define-plugin-track.d.ts b/dist/src/core/utils/define-plugin-track.d.ts new file mode 100644 index 00000000..353fdcb9 --- /dev/null +++ b/dist/src/core/utils/define-plugin-track.d.ts @@ -0,0 +1,11 @@ +import type * as HiGlass from '@higlass/types'; +export type PluginTrackFactory = (HGC: HiGlass.HGC, context: HiGlass.Context, options: Options) => HiGlass.Track; +export type TrackConfig = Omit, 'availableOptions'>; +export declare function createPluginTrack(config: TrackConfig, factory: PluginTrackFactory): (new (HGC: HiGlass.HGC, context: HiGlass.Context, options: Options) => HiGlass.Track) & { + config: HiGlass.TrackConfig; +} & { + config: { + availableOptions: (keyof Options)[]; + }; +}; +//# sourceMappingURL=define-plugin-track.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/define-plugin-track.d.ts.map b/dist/src/core/utils/define-plugin-track.d.ts.map new file mode 100644 index 00000000..8ba55b55 --- /dev/null +++ b/dist/src/core/utils/define-plugin-track.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"define-plugin-track.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/define-plugin-track.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,kBAAkB,CAAC,IAAI,EAAE,OAAO,IAAI,CAC5C,GAAG,EAAE,OAAO,CAAC,GAAG,EAChB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EACvC,OAAO,EAAE,OAAO,KACf,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAQ5B,MAAM,MAAM,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAE1F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAC3C,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,EAC5B,OAAO,EAAE,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC;;;YAa9B;QAEJ,gBAAgB,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC;KACvC;EAER"} \ No newline at end of file diff --git a/dist/src/core/utils/higlass-zoom-config.d.ts b/dist/src/core/utils/higlass-zoom-config.d.ts new file mode 100644 index 00000000..a4ecc28f --- /dev/null +++ b/dist/src/core/utils/higlass-zoom-config.d.ts @@ -0,0 +1,6 @@ +import type { HiGlassSpec } from '@gosling-lang/higlass-schema'; +/** + * This makes sure that all the current zooming status is preserved when new tracks are added + */ +export declare const preverseZoomStatus: (newSpec: HiGlassSpec, prevSpec: HiGlassSpec) => void; +//# sourceMappingURL=higlass-zoom-config.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/higlass-zoom-config.d.ts.map b/dist/src/core/utils/higlass-zoom-config.d.ts.map new file mode 100644 index 00000000..669589aa --- /dev/null +++ b/dist/src/core/utils/higlass-zoom-config.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"higlass-zoom-config.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/higlass-zoom-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,kBAAkB,YAAa,WAAW,YAAY,WAAW,SAmB7E,CAAC"} \ No newline at end of file diff --git a/dist/src/core/utils/index.d.ts b/dist/src/core/utils/index.d.ts new file mode 100644 index 00000000..3612e4ed --- /dev/null +++ b/dist/src/core/utils/index.d.ts @@ -0,0 +1,9 @@ +export declare function validTilesetUrl(url: string): boolean; +export declare function parseServerAndTilesetUidFromUrl(url: string): { + server: undefined; + tilesetUid: undefined; +} | { + server: string; + tilesetUid: string; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/index.d.ts.map b/dist/src/core/utils/index.d.ts.map new file mode 100644 index 00000000..e24ee89f --- /dev/null +++ b/dist/src/core/utils/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,WAK1C;AAED,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,MAAM;;;;;;EAU1D"} \ No newline at end of file diff --git a/dist/src/core/utils/linking.d.ts b/dist/src/core/utils/linking.d.ts new file mode 100644 index 00000000..9a181d84 --- /dev/null +++ b/dist/src/core/utils/linking.d.ts @@ -0,0 +1,12 @@ +import type { HiGlassModel } from '../../compiler/higlass-model'; +/** + * + */ +export declare function getLinkingInfo(hgModel: HiGlassModel): { + layout: 'circular' | 'linear'; + hgViewId: string; + linkId: string; + isBrush: boolean; + style: any; +}[]; +//# sourceMappingURL=linking.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/linking.d.ts.map b/dist/src/core/utils/linking.d.ts.map new file mode 100644 index 00000000..78756cab --- /dev/null +++ b/dist/src/core/utils/linking.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/linking.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAIjE;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY;YAEpC,UAAU,GAAG,QAAQ;cACnB,MAAM;YACR,MAAM;aACL,OAAO;WACT,GAAG;IAkDjB"} \ No newline at end of file diff --git a/dist/src/core/utils/omit-deep.d.ts b/dist/src/core/utils/omit-deep.d.ts new file mode 100644 index 00000000..6521f736 --- /dev/null +++ b/dist/src/core/utils/omit-deep.d.ts @@ -0,0 +1,3 @@ +import type { GoslingSpec } from '@gosling-lang/gosling-schema'; +export declare function omitDeep(spec: GoslingSpec, omitKeys: string[]): any; +//# sourceMappingURL=omit-deep.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/omit-deep.d.ts.map b/dist/src/core/utils/omit-deep.d.ts.map new file mode 100644 index 00000000..3faba406 --- /dev/null +++ b/dist/src/core/utils/omit-deep.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"omit-deep.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/omit-deep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAIhE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,OAQ7D"} \ No newline at end of file diff --git a/dist/src/core/utils/overlay.d.ts b/dist/src/core/utils/overlay.d.ts new file mode 100644 index 00000000..23d5ffce --- /dev/null +++ b/dist/src/core/utils/overlay.d.ts @@ -0,0 +1,13 @@ +import type { SingleTrack, Track, DataDeep } from '@gosling-lang/gosling-schema'; +/** + * Resolve superposed tracks into multiple track specifications. + * Some options are corrected to ensure the resolved tracks use consistent visual properties, such as the existence of the axis for genomic coordinates. + */ +export declare function resolveSuperposedTracks(track: Track): SingleTrack[]; +/** + * Spread overlaid tracks if they are assigned to different data/metadata. + * This process is necessary since we are passing over each track to HiGlass, and if a single track is mapped to multiple datastes, HiGlass cannot handle that. + */ +export declare function spreadTracksByData(tracks: Track[]): Track[]; +export declare function isIdenticalDataSpec(specs: (DataDeep | undefined)[]): boolean; +//# sourceMappingURL=overlay.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/overlay.d.ts.map b/dist/src/core/utils/overlay.d.ts.map new file mode 100644 index 00000000..5ae027a0 --- /dev/null +++ b/dist/src/core/utils/overlay.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/overlay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAER,WAAW,EAEX,KAAK,EAEL,QAAQ,EACX,MAAM,8BAA8B,CAAC;AAGtC;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,EAAE,CAiDnE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAgE3D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,CAAC,QAAQ,GAAG,SAAS,CAAC,EAAE,GAAG,OAAO,CAsB5E"} \ No newline at end of file diff --git a/dist/src/core/utils/polar.d.ts b/dist/src/core/utils/polar.d.ts new file mode 100644 index 00000000..2b73d015 --- /dev/null +++ b/dist/src/core/utils/polar.d.ts @@ -0,0 +1,19 @@ +export declare const RADIAN_GAP = 0; +/** + * Convert a value in a single-linear axis to a radian value. Anticlockwise, starts from 12 o'clock. + * v span from zero to `max`. + */ +export declare function valueToRadian(v: number, max: number, sa: number, ea: number, g?: number): number; +/** + * Convert a position in a cartesian system to a polar coordinate. + */ +export declare function cartesianToPolar(x: number, max: number, r: number, cx: number, cy: number, sa: number, ea: number): { + x: number; + y: number; +}; +export declare function positionToRadian(x: number, y: number, cx: number, cy: number): number; +/** + * Calculate a degree in the range of [0, 360) based on two points. Anticlockwise, starts from 12 o'clock. + */ +export declare function pointsToDegree(x: number, y: number, cx: number, cy: number): number; +//# sourceMappingURL=polar.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/polar.d.ts.map b/dist/src/core/utils/polar.d.ts.map new file mode 100644 index 00000000..9ae32dfc --- /dev/null +++ b/dist/src/core/utils/polar.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"polar.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/polar.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,UAMvF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;;;EAKjH;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAM5E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAE1E"} \ No newline at end of file diff --git a/dist/src/core/utils/position.d.ts b/dist/src/core/utils/position.d.ts new file mode 100644 index 00000000..fcd4f46b --- /dev/null +++ b/dist/src/core/utils/position.d.ts @@ -0,0 +1,19 @@ +export interface Dimension { + top: number; + left: number; + width: number; + height: number; +} +export type Padding = SurroundingSize; +export type Margin = SurroundingSize; +export interface SurroundingSize { + top: number; + bottom: number; + left: number; + right: number; +} +export interface Offset { + top: number; + left: number; +} +//# sourceMappingURL=position.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/position.d.ts.map b/dist/src/core/utils/position.d.ts.map new file mode 100644 index 00000000..c5702b8a --- /dev/null +++ b/dist/src/core/utils/position.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/position.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,MAAM,OAAO,GAAG,eAAe,CAAC;AACtC,MAAM,MAAM,MAAM,GAAG,eAAe,CAAC;AACrC,MAAM,WAAW,eAAe;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WAAW,MAAM;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CAChB"} \ No newline at end of file diff --git a/dist/src/core/utils/scales.d.ts b/dist/src/core/utils/scales.d.ts new file mode 100644 index 00000000..d7d8dc7d --- /dev/null +++ b/dist/src/core/utils/scales.d.ts @@ -0,0 +1,12 @@ +import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; +import type { Assembly, Domain } from '@gosling-lang/gosling-schema'; +/** + * Get a numeric domain based on a domain specification. + * For example, domain: { chromosome: 'chr1', interval: [1, 300,000] } => domain: [1, 300,000] + */ +export declare function getNumericDomain(domain: Domain, assembly?: Assembly): number[] | undefined; +/** + * Use a shared scale (i.e., `domain`) across multiple gosling tracks. + */ +export declare function shareScaleAcrossTracks(trackModels: GoslingTrackModel[], force?: boolean): void; +//# sourceMappingURL=scales.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/scales.d.ts.map b/dist/src/core/utils/scales.d.ts.map new file mode 100644 index 00000000..c05c31f2 --- /dev/null +++ b/dist/src/core/utils/scales.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/scales.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAKrE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,wBAkBnE;AAGD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,iBAAiB,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO,QAwDvF"} \ No newline at end of file diff --git a/dist/src/core/utils/semantic-zoom.d.ts b/dist/src/core/utils/semantic-zoom.d.ts new file mode 100644 index 00000000..60626af4 --- /dev/null +++ b/dist/src/core/utils/semantic-zoom.d.ts @@ -0,0 +1,8 @@ +import type { LogicalOperation } from '@gosling-lang/gosling-schema'; +export declare function getMaxZoomLevel(): number; +/** + * Perform logical operation between a target and a reference value. + * If the condition is `true`, return `1`. + */ +export declare function logicalComparison(value: number, op: LogicalOperation, ref: number, transitionPadding?: number): number; +//# sourceMappingURL=semantic-zoom.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/semantic-zoom.d.ts.map b/dist/src/core/utils/semantic-zoom.d.ts.map new file mode 100644 index 00000000..658d1131 --- /dev/null +++ b/dist/src/core/utils/semantic-zoom.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"semantic-zoom.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/semantic-zoom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,wBAAgB,eAAe,WAK9B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,gBAAgB,EACpB,GAAG,EAAE,MAAM,EACX,iBAAiB,CAAC,EAAE,MAAM,GAC3B,MAAM,CA4BR"} \ No newline at end of file diff --git a/dist/src/core/utils/style.d.ts b/dist/src/core/utils/style.d.ts new file mode 100644 index 00000000..0c778e64 --- /dev/null +++ b/dist/src/core/utils/style.d.ts @@ -0,0 +1,3 @@ +import type { Style } from '@gosling-lang/gosling-schema'; +export declare function getStyleOverridden(parent: Style | undefined, child: Style | undefined): any; +//# sourceMappingURL=style.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/style.d.ts.map b/dist/src/core/utils/style.d.ts.map new file mode 100644 index 00000000..c3c4ffa2 --- /dev/null +++ b/dist/src/core/utils/style.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAE1D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,OAIrF"} \ No newline at end of file diff --git a/dist/src/core/utils/template.d.ts b/dist/src/core/utils/template.d.ts new file mode 100644 index 00000000..e7c8d2fe --- /dev/null +++ b/dist/src/core/utils/template.d.ts @@ -0,0 +1,11 @@ +import type { GoslingSpec, TemplateTrackDef } from '@gosling-lang/gosling-schema'; +/** + * Track templates officially supported by Gosling.js. + */ +export declare const GoslingTemplates: TemplateTrackDef[]; +/** + * Replace track templetes to low-level gosling specs. + * @param spec + */ +export declare function replaceTrackTemplates(spec: GoslingSpec, templates: TemplateTrackDef[]): void; +//# sourceMappingURL=template.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/template.d.ts.map b/dist/src/core/utils/template.d.ts.map new file mode 100644 index 00000000..db5ab410 --- /dev/null +++ b/dist/src/core/utils/template.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIR,WAAW,EAEX,gBAAgB,EAGnB,MAAM,8BAA8B,CAAC;AAItC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,EAqP9C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,QA0HrF"} \ No newline at end of file diff --git a/dist/src/core/utils/text-style.d.ts b/dist/src/core/utils/text-style.d.ts new file mode 100644 index 00000000..a2f2fd5d --- /dev/null +++ b/dist/src/core/utils/text-style.d.ts @@ -0,0 +1,19 @@ +export type TextStyle = { + color?: string; + size?: number; + fontFamily?: string; + fontWeight?: 'bold' | 'normal' | 'light'; + stroke?: string; + strokeThickness?: number; +}; +export declare const DEFAULT_TEXT_STYLE: Required; +export declare function getTextStyle(style?: TextStyle): { + fontSize: `${number}px`; + fontFamily: string; + fontWeight: "bold" | "normal" | "lighter"; + fill: string; + lineJoin: "round"; + stroke: string; + strokeThickness: number; +}; +//# sourceMappingURL=text-style.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/text-style.d.ts.map b/dist/src/core/utils/text-style.d.ts.map new file mode 100644 index 00000000..1f51438c --- /dev/null +++ b/dist/src/core/utils/text-style.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"text-style.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/text-style.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,SAAS,CAOlD,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,GAAE,SAAc;;;;;;;;EAgBjD"} \ No newline at end of file diff --git a/dist/src/core/utils/theme.d.ts b/dist/src/core/utils/theme.d.ts new file mode 100644 index 00000000..bfad90f5 --- /dev/null +++ b/dist/src/core/utils/theme.d.ts @@ -0,0 +1,115 @@ +export type Theme = ThemeType | ThemeDeep; +export type ThemeType = 'light' | 'dark' | 'warm' | 'ggplot' | 'igv' | 'ensembl' | 'jbrowse' | 'ucsc' | 'washu' | 'excel' | 'google'; +export interface ThemeDeep { + base: ThemeType; + root?: RootStyle; + track?: TrackStyle; + legend?: LegendStyle; + axis?: AxisStyle; + markCommon?: MarkStyle; + point?: MarkStyle; + rect?: MarkStyle; + triangle?: MarkStyle; + area?: MarkStyle; + line?: MarkStyle; + bar?: MarkStyle; + rule?: MarkStyle; + link?: MarkStyle; + brush?: MarkStyle; + text?: MarkStyle & { + textFontWeight?: 'bold' | 'normal'; + textAnchor?: 'start' | 'middle' | 'end'; + }; +} +export interface CompleteThemeDeep { + base: Required; + root: Required; + track: Required; + legend: Required; + axis: Required; + markCommon: Required; + point: Required; + rect: Required; + triangle: Required; + area: Required; + line: Required; + bar: Required; + rule: Required; + link: Required; + brush: Required; + text: Required & Required<{ + textFontWeight?: 'bold' | 'normal'; + textAnchor?: 'start' | 'middle' | 'end'; + }>; +} +export interface RootStyle { + background?: string; + titleColor?: string; + titleFontSize?: number; + titleFontFamily?: string; + titleAlign?: 'left' | 'middle' | 'right'; + titleFontWeight?: 'bold' | 'normal' | 'light'; + titleBackgroundColor?: string; + subtitleColor?: string; + subtitleFontSize?: number; + subtitleFontFamily?: string; + subtitleAlign?: 'left' | 'middle' | 'right'; + subtitleFontWeight?: 'bold' | 'normal' | 'light'; + subtitleBackgroundColor?: string; + showMousePosition?: boolean; + mousePositionColor?: string; +} +export interface TrackStyle { + background?: string; + alternatingBackground?: string; + titleColor?: string; + titleBackground?: string; + titleFontSize?: number; + titleAlign?: 'left' | 'middle' | 'right'; + outline?: string; + outlineWidth?: number; +} +export interface LegendStyle { + position?: 'top' | 'right'; + tickColor?: string; + labelColor?: string; + labelFontSize?: number; + labelFontWeight?: 'bold' | 'normal' | 'light'; + labelFontFamily?: string; + background?: string; + backgroundOpacity?: number; + backgroundStroke?: string; +} +export interface AxisStyle { + tickColor?: string; + /** + * The margin around labels for calculating visual overlaps between labels. + * This is mainly used for determining the visibility of axis labels. + * `0` if no margin to use. Negative values (`-1`) for showing all labels even if they overlap. + */ + labelMargin?: number; + /** + * If `true`, labels of genomics axes excludes the chromosome prefix (e.g., `chr1` -> `1`). + */ + labelExcludeChrPrefix?: boolean; + labelColor?: string; + labelFontSize?: number; + labelFontWeight?: 'bold' | 'normal' | 'light'; + labelFontFamily?: string; + baselineColor?: string; + gridColor?: string; + gridStrokeWidth?: number; + gridStrokeType?: 'solid' | 'dashed'; + gridStrokeDash?: [number, number]; +} +export interface MarkStyle { + color?: string; + size?: number; + stroke?: string; + strokeWidth?: number; + opacity?: number; + nominalColorRange?: string[]; + quantitativeSizeRange?: [number, number]; +} +export declare function getTheme(theme?: Theme): Required; +//# sourceMappingURL=theme.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/theme.d.ts.map b/dist/src/core/utils/theme.d.ts.map new file mode 100644 index 00000000..13d86c3a --- /dev/null +++ b/dist/src/core/utils/theme.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/theme.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC;AAC1C,MAAM,MAAM,SAAS,GACf,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,KAAK,GACL,SAAS,GACT,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,CAAC;AAMf,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,SAAS,CAAC;IAEhB,IAAI,CAAC,EAAE,SAA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AAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAE5C;AAGD,wBAAgB,QAAQ,CAAC,KAAK,GAAE,KAAe,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAwB5E"} \ No newline at end of file diff --git a/dist/src/core/utils/uuid.d.ts b/dist/src/core/utils/uuid.d.ts new file mode 100644 index 00000000..904f8a96 --- /dev/null +++ b/dist/src/core/utils/uuid.d.ts @@ -0,0 +1,2 @@ +export declare function uuid(): string; +//# sourceMappingURL=uuid.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/uuid.d.ts.map b/dist/src/core/utils/uuid.d.ts.map new file mode 100644 index 00000000..d332c0b0 --- /dev/null +++ b/dist/src/core/utils/uuid.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/uuid.ts"],"names":[],"mappings":"AAKA,wBAAgB,IAAI,IAAI,MAAM,CAE7B"} \ No newline at end of file diff --git a/dist/src/core/visual-property.schema.d.ts b/dist/src/core/visual-property.schema.d.ts new file mode 100644 index 00000000..56d75047 --- /dev/null +++ b/dist/src/core/visual-property.schema.d.ts @@ -0,0 +1,2 @@ +export type PIXIVisualProperty = 'color' | 'row' | 'stroke' | 'strokeWidth' | 'opacity' | 'x' | 'xe' | 'x1' | 'x1e' | 'y' | 'ye' | 'size' | 'text' | 'x-center' | 'y-center' | 'p-size' | 'x-start' | 'height' | 'width'; +//# sourceMappingURL=visual-property.schema.d.ts.map \ No newline at end of file diff --git a/dist/src/core/visual-property.schema.d.ts.map b/dist/src/core/visual-property.schema.d.ts.map new file mode 100644 index 00000000..a3f37d07 --- /dev/null +++ b/dist/src/core/visual-property.schema.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"visual-property.schema.d.ts","sourceRoot":"","sources":["../../../src/core/visual-property.schema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAExB,OAAO,GACP,KAAK,GACL,QAAQ,GACR,aAAa,GACb,SAAS,GACT,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,GAAG,GACH,IAAI,GACJ,MAAM,GACN,MAAM,GAEN,UAAU,GACV,UAAU,GACV,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,OAAO,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts b/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts new file mode 100644 index 00000000..f8545f5b --- /dev/null +++ b/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts @@ -0,0 +1,29 @@ +import type { BamData, Assembly } from '@gosling-lang/gosling-schema'; +import type { TilesetInfo, Tiles, Segment, Junction, SegmentWithMate } from './bam-worker'; +import type { TabularDataFetcher } from '../utils'; +type InferTileType = Config['extractJunction'] extends true ? Junction : Config['loadMates'] extends true ? SegmentWithMate : Segment; +declare class BamDataFetcher implements TabularDataFetcher> { + static config: { + type: string; + }; + dataConfig: {}; + uid: string; + fetchTimeout?: ReturnType; + toFetch: Set; + MAX_TILE_WIDTH: 20000; + private worker; + track?: { + fetching: { + delete(id: string): void; + }; + }; + constructor(HGC: import('@higlass/types').HGC, config: Config & { + assembly: Assembly; + }); + tilesetInfo(callback: (info: TilesetInfo) => void): Promise; + fetchTilesDebounced(receivedTiles: (tiles: Tiles) => void, tileIds: string[]): void; + sendFetch(receivedTiles: (tiles: Tiles) => void, tileIds: string[]): Promise; + getTabularData(tileIds: string[]): Promise[]>; +} +export default BamDataFetcher; +//# sourceMappingURL=bam-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts.map b/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts.map new file mode 100644 index 00000000..3184b98a --- /dev/null +++ b/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bam-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/bam/bam-data-fetcher.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,KAAK,EAAa,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEtG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,KAAK,aAAa,CAAC,MAAM,SAAS,OAAO,IAAI,MAAM,CAAC,iBAAiB,CAAC,SAAS,IAAI,GAC7E,QAAQ,GACR,MAAM,CAAC,WAAW,CAAC,SAAS,IAAI,GAChC,eAAe,GACf,OAAO,CAAC;AAEd,cAAM,cAAc,CAAC,MAAM,SAAS,OAAO,CAAE,YAAW,kBAAkB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7F,MAAM,CAAC,MAAM;;MAAmB;IAChC,UAAU,KAAM;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;IAC7C,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAErB,cAAc,QAAgB;IAE9B,OAAO,CAAC,MAAM,CAAmC;IAGjD,KAAK,CAAC,EAAE;QACJ,QAAQ,EAAE;YAAE,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAC;KAC1C,CAAC;gBAEU,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,QAAQ,CAAA;KAAE;IAchF,WAAW,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI;IAIvD,mBAAmB,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAyBtE,SAAS,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAIlE,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;CAI5E;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/bam/bam-worker.d.ts b/dist/src/data-fetchers/bam/bam-worker.d.ts new file mode 100644 index 00000000..40ec64bd --- /dev/null +++ b/dist/src/data-fetchers/bam/bam-worker.d.ts @@ -0,0 +1,82 @@ +import type { BamRecord } from '@gmod/bam'; +import type { TilesetInfo } from '@higlass/types'; +import type { ChromSizes } from '@gosling-lang/gosling-schema'; +interface BamFileOptions { + loadMates: boolean; + maxInsertSize: number; + extractJunction: boolean; + junctionMinCoverage: number; + urlFetchOptions?: RequestInit; + indexUrlFetchOptions?: RequestInit; +} +type Substitution = { + pos: number; + length: number; + type: 'X' | 'I' | 'D' | 'N' | '=' | 'M' | 'S' | 'H'; + variant?: string; +}; +export type Segment = { + id: string; + name: string; + start: number; + end: number; + md: string; + chrName: string; + chrOffset: number; + cigar: string; + mapq: string; + strand: '+' | '-'; +}; +declare const bamRecordToJson: (bamRecord: BamRecord, chrName: string, chrOffset: number) => Segment & { + substitutions: Substitution[]; +}; +type JsonBamRecord = ReturnType; +/** + * Not like other data fetchers, the Bam Data Fetcher fetches all the tiles at once. + * @param uid + * @param tileIds + * @returns + */ +declare const fetchTilesDebounced: (uid: string, tileIds: string[]) => Promise>; +export type SegmentWithMate = Segment & { + mateIds: string[]; + foundMate: boolean; + insertSize: number; + largeInsertSize: boolean; + svType: string; + numMates: number; +}; +export type Junction = { + start: number; + end: number; + score: number; +}; +declare const tileFunctions: { + init: (uid: string, bam: { + url: string; + indexUrl: string; + }, chromSizes: ChromSizes, options?: Partial) => Promise; + tilesetInfo: (uid: string) => { + tile_size: number; + bins_per_dimension: number; + max_zoom: number; + max_width: number; + min_pos: number[]; + max_pos: number[]; + }; + fetchTilesDebounced: (uid: string, tileIds: string[]) => Promise>; + tile: (uid: string, z: number, x: number) => Promise; + getTabularData: (uid: string, tileIds: string[]) => import("threads").TransferDescriptor; +}; +export type WorkerApi = typeof tileFunctions; +export type { TilesetInfo }; +export type Tiles = Awaited>; +//# sourceMappingURL=bam-worker.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bam/bam-worker.d.ts.map b/dist/src/data-fetchers/bam/bam-worker.d.ts.map new file mode 100644 index 00000000..97881082 --- /dev/null +++ b/dist/src/data-fetchers/bam/bam-worker.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bam-worker.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/bam/bam-worker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI/D,UAAU,cAAc;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,oBAAoB,CAAC,EAAE,WAAW,CAAC;CACtC;AAkDD,KAAK,YAAY,GAAG;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACpD,OAAO,CA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K,MAAM,KAAK,MAAM,KAAG,QAAQ,aAAa,EAAE,CAAC;0BA4HnD,MAAM,WAAW,MAAM,EAAE;CA6IrD,CAAC;AAIF,MAAM,MAAM,SAAS,GAAG,OAAO,aAAa,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,CAAC;AAC5B,MAAM,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts b/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts new file mode 100644 index 00000000..230c824c --- /dev/null +++ b/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts @@ -0,0 +1,31 @@ +import type { Assembly, BedData } from '@gosling-lang/gosling-schema'; +import type { TilesetInfo } from './bed-worker'; +import type { BedTile, EmptyTile } from './bed-worker'; +import type { TabularDataFetcher } from '../utils'; +export type BedDataConfig = BedData & { + assembly: Assembly; +}; +declare class BedDataFetcher implements TabularDataFetcher { + static config: { + type: string; + }; + dataConfig: {}; + uid: string; + prevRequestTime: number; + track?: any; + private toFetch; + private fetchTimeout?; + private worker; + constructor(HGC: import('@higlass/types').HGC, config: BedDataConfig); + tilesetInfo(callback: (info: TilesetInfo) => void): Promise; + fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]): void; + sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]): Promise; + /** + * Called by GoslingTrack. This is how the track gets data + * @param tileIds The position of the tile + * @returns A promise to the BedTiles + */ + getTabularData(tileIds: string[]): Promise; +} +export default BedDataFetcher; +//# sourceMappingURL=bed-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts.map b/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts.map new file mode 100644 index 00000000..04765769 --- /dev/null +++ b/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bed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C"} \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-parser.d.ts b/dist/src/data-fetchers/bed/bed-parser.d.ts new file mode 100644 index 00000000..eae97339 --- /dev/null +++ b/dist/src/data-fetchers/bed/bed-parser.d.ts @@ -0,0 +1,28 @@ +import type { BedTile } from './bed-worker'; +/** + * A class to create a BED file parser + */ +declare class BedParser { + #private; + /** + * Constructor for BedParser + * @param customFields An array of strings, where each string is the name of a custom column + * @param n_columns A number which is the number of columns in the Bed File + */ + constructor(opt?: { + customFields: string[]; + n_columns: number; + }); + /** + * Parses a single BED file line + * @returns An object which contains the parsed data from the line + */ + parseLine(line: string, chromStart: number): BedTile; + /** + * Generates an autoSql schema for a BED file that has custom columns + * @returns A string which is the autoSql spec + */ + constructBedAutoSql(): string; +} +export default BedParser; +//# sourceMappingURL=bed-parser.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-parser.d.ts.map b/dist/src/data-fetchers/bed/bed-parser.d.ts.map new file mode 100644 index 00000000..84a74da1 --- /dev/null +++ b/dist/src/data-fetchers/bed/bed-parser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bed-parser.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/bed/bed-parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA2B5C;;GAEG;AACH,cAAM,SAAS;;IAKX;;;;OAIG;gBACS,GAAG,CAAC,EAAE;QAAE,YAAY,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAU/D;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAY1C;;;OAGG;IACH,mBAAmB;CA2DtB;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-worker.d.ts b/dist/src/data-fetchers/bed/bed-worker.d.ts new file mode 100644 index 00000000..6d37d54e --- /dev/null +++ b/dist/src/data-fetchers/bed/bed-worker.d.ts @@ -0,0 +1,50 @@ +import type { TilesetInfo } from '@higlass/types'; +import type { ChromSizes } from '@gosling-lang/gosling-schema'; +export type BedFileOptions = { + sampleLength: number; + customFields?: string[]; + urlFetchOptions?: RequestInit; + indexUrlFetchOptions?: RequestInit; +}; +/** + * All data stored in each BED file eventually transformed and put into this + */ +export interface BedTile { + chrom: string; + chromStart: number; + chromEnd: number; + name?: string; + score?: number; + strand?: string; + thickStart?: number; + thickEnd?: number; + itemRgb?: string; + blockCount?: number; + blockSizes?: number[]; + blockStarts?: number[]; + [customField: string]: string | number | number[] | undefined; +} +export interface EmptyTile { + tilePositionId: string; +} +declare function init(uid: string, bed: { + url: string; + indexUrl: string; +}, chromSizes: ChromSizes, options?: Partial): void; +declare const tileFunctions: { + init: typeof init; + tilesetInfo: (uid: string) => { + tile_size: number; + bins_per_dimension: number; + max_zoom: number; + max_width: number; + min_pos: number[]; + max_pos: number[]; + }; + fetchTilesDebounced: (uid: string, tileIds: string[]) => Promise>; + tile: (uid: string, z: number, x: number) => Promise; + getTabularData: (uid: string, tileIds: string[]) => import("threads").TransferDescriptor; +}; +export type WorkerApi = typeof tileFunctions; +export type { TilesetInfo }; +//# sourceMappingURL=bed-worker.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-worker.d.ts.map b/dist/src/data-fetchers/bed/bed-worker.d.ts.map new file mode 100644 index 00000000..7fb69998 --- /dev/null +++ b/dist/src/data-fetchers/bed/bed-worker.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bed-worker.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/bed/bed-worker.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK/D,MAAM,MAAM,cAAc,GAAG;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YA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No newline at end of file diff --git a/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts b/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts new file mode 100644 index 00000000..483a989b --- /dev/null +++ b/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts @@ -0,0 +1,56 @@ +import { BigWig } from '@gmod/bbi'; +import type { Assembly, BigWigData } from '@gosling-lang/gosling-schema'; +import { type CommonDataConfig } from '../utils'; +import type { ChromInfo, TilesetInfo } from '@higlass/types'; +type BigWigDataConfig = BigWigData & CommonDataConfig; +type Tile = { + tilePos: [number]; + tileId: string; + zoomLevel: number; + min_value: number; + max_value: number; + dense: (number | null)[]; + denseDataExtrema: InstanceType; + minNonZero: number; + maxNonZero: number; +}; +type BigWigHeader = { + zoomLevels: { + reductionLevel: number; + }[]; +}; +declare function BigWigDataFetcher(HGC: import('@higlass/types').HGC, dataConfig: BigWigDataConfig): { + dataConfig: typeof dataConfig; + bwFileHeader: BigWigHeader | null; + bwFile: BigWig | null; + TILE_SIZE: number; + errorTxt: string; + dataPromises: Promise[]; + chromSizes: ChromInfo & { + chrToAbs: (name: string, pos: number) => number; + }; + assembly?: Assembly | undefined; + tilesetInfoLoading?: boolean | undefined; + loadBBI(dataConfig: BigWigDataConfig): Promise; + tilesetInfo(callback?: ((info: TilesetInfo | { + error: string; + }) => void) | undefined): Promise<{ + tile_size: number; + max_zoom: number; + max_width: number; + min_pos: number[]; + max_pos: number[]; + } | null>; + fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]): Record; + tile(z: number, x: number): Promise; + determineScale(minX: number, maxX: number): number; +}; +declare namespace BigWigDataFetcher { + var config: { + type: string; + }; +} +export default BigWigDataFetcher; +//# sourceMappingURL=bigwig-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts.map b/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts.map new file mode 100644 index 00000000..e39d4ad0 --- /dev/null +++ b/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bigwig-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/bigwig/bigwig-data-fetcher.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EAAE,KAAK,gBAAgB,EAAc,MAAM,UAAU,CAAC;AAG7D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7D,KAAK,gBAAgB,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAEtD,KAAK,IAAI,GAAG;IACR,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IACzB,gBAAgB,EAAE,YAAY,CAAC,OAAO,gBAAgB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC5F,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,YAAY,GAAG;IAChB,UAAU,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC5C,CAAC;AAIF,iBAAS,iBAAiB,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,UAAU,EAAE,gBAAgB;gBAMtE,iBAAiB;kBACf,YAAY,GAAG,IAAI;YACzB,MAAM,GAAG,IAAI;eACV,MAAM;cACP,MAAM;kBACF,QAAQ,OAAO,CAAC,EAAE;;yBACmB,MAAM,OAAO,MAAM,KAAK,MAAM;;;;wBA4CvD,gBAAgB;mCAcZ,WAAW,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;;;;;;+CAqC3B,OAAO,MAAM,EAAE,IAAI,CAAC,KAAK,IAAI,WAAW,MAAM,EAAE;;;YAgC7E,MAAM,KAAK,MAAM;yBAgHV,MAAM,QAAQ,MAAM;EA4BhD;kBAvRQ,iBAAiB;;;;;AA6R1B,eAAe,iBAAiB,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts b/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts new file mode 100644 index 00000000..c088e6dd --- /dev/null +++ b/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts @@ -0,0 +1,58 @@ +import type { CsvData, FilterTransform, Datum } from '@gosling-lang/gosling-schema'; +import { type CommonDataConfig } from '../utils'; +type CsvDataConfig = CsvData & CommonDataConfig & { + filter?: FilterTransform[]; +}; +/** + * Used in #tile() to associate tile coordinates with data + */ +interface TileInfo { + tabularData: Datum[]; + server: null; + tilePos: number[]; + zoomLevel: number; + tilePositionId?: string; +} +/** + * This is what all the tile information eventually gets organized into. + */ +export interface LoadedTiles { + [tilePositionId: string]: TileInfo; +} +/** + * Used in #generateTilesetInfo() + */ +interface TilesetInfo { + tile_size: number; + max_zoom: number; + max_width: number; + min_pos: number[]; + max_pos: number[]; +} +export declare class CsvDataFetcherClass { + #private; + dataConfig: CsvDataConfig; + tilesetInfoLoading: boolean; + constructor(dataConfig: CsvDataConfig); + /** + * Called in TiledPixiTrack + */ + tilesetInfo(callback?: (tilesetInto: TilesetInfo) => void): Promise | undefined; + /** + * Called in TiledPixiTrack. + * @param receivedTiles A function from TiledPixiTrack which takes in all the loaded tiles + * @param tileIds An array of tile IDs. Ex. ['1.0', '1.1'] + */ + fetchTilesDebounced(receivedTiles: (loadedTiles: LoadedTiles) => void, tileIds: string[]): void; +} +/** + * HiGlass data fetcher specific for Gosling which ultimately will accept any types of data other than CSV files. + */ +declare function CsvDataFetcher(_HGC: import('@higlass/types').HGC, dataConfig: CsvDataConfig, _pubsub: Record): CsvDataFetcherClass; +declare namespace CsvDataFetcher { + var config: { + type: string; + }; +} +export default CsvDataFetcher; +//# sourceMappingURL=csv-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts.map b/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts.map new file mode 100644 index 00000000..e0d6a94d --- /dev/null +++ b/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"csv-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/csv/csv-data-fetcher.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAY,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAE9F,OAAO,EAAE,KAAK,gBAAgB,EAAmD,MAAM,UAAU,CAAC;AAElG,KAAK,aAAa,GAAG,OAAO,GAAG,gBAAgB,GAAG;IAAE,MAAM,CAAC,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAUjF;;GAEG;AACH,UAAU,QAAQ;IACd,WAAW,EAAE,KAAK,EAAE,CAAC;IACrB,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AACD;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,CAAC,cAAc,EAAE,MAAM,GAAG,QAAQ,CAAC;CACtC;AAED;;GAEG;AACH,UAAU,WAAW;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,qBAAa,mBAAmB;;IAC5B,UAAU,EAAE,aAAa,CAAC;IAE1B,kBAAkB,EAAE,OAAO,CAAC;gBAShB,UAAU,EAAE,aAAa;IA+GrC;;OAEG;IACH,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,SAAS;IAqCnG;;;;OAIG;IACH,mBAAmB,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;CAmGlG;AAED;;GAEG;AAEH,iBAAS,cAAc,CACnB,IAAI,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAClC,UAAU,EAAE,aAAa,EAEzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC7B,mBAAmB,CAMrB;kBAXQ,cAAc;;;;;AAiBvB,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts b/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts new file mode 100644 index 00000000..15b2e0b0 --- /dev/null +++ b/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts @@ -0,0 +1,25 @@ +import type { Assembly, GffData } from '@gosling-lang/gosling-schema'; +import type { TilesetInfo, GffTile, EmptyTile } from './gff-worker'; +import type { TabularDataFetcher } from '../utils'; +export type GFFDataConfig = GffData & { + assembly: Assembly; +}; +declare class GffDataFetcher implements TabularDataFetcher { + static config: { + type: string; + }; + dataConfig: {}; + uid: string; + prevRequestTime: number; + track?: any; + private toFetch; + private fetchTimeout?; + private worker; + constructor(HGC: import('@higlass/types').HGC, config: GFFDataConfig); + tilesetInfo(callback: (info: TilesetInfo) => void): Promise; + fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]): void; + sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]): Promise; + getTabularData(tileIds: string[]): Promise; +} +export default GffDataFetcher; +//# sourceMappingURL=gff-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts.map b/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts.map new file mode 100644 index 00000000..c97af03e --- /dev/null +++ b/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gff-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/gff/gff-data-fetcher.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAa,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE7D,cAAM,cAAe,YAAW,kBAAkB,CAAC,OAAO,CAAC;IACvD,MAAM,CAAC,MAAM;;MAAmB;IAChC,UAAU,KAAM;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,YAAY,CAAC,CAAgC;IACrD,OAAO,CAAC,MAAM,CAAmC;gBAErC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa;IAe9D,WAAW,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI;IAIvD,mBAAmB,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAe1F,SAAS,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAItF,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAK9D;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/gff-worker.d.ts b/dist/src/data-fetchers/gff/gff-worker.d.ts new file mode 100644 index 00000000..bb51b4f8 --- /dev/null +++ b/dist/src/data-fetchers/gff/gff-worker.d.ts @@ -0,0 +1,39 @@ +import type { GFF3FeatureLineWithRefs } from '@gmod/gff'; +import type { TilesetInfo } from '@higlass/types'; +import type { ChromSizes } from '@gosling-lang/gosling-schema'; +export type GffFileOptions = { + sampleLength: number; + attributesToFields?: { + attribute: string; + defaultValue: string; + }[]; + urlFetchOptions?: RequestInit; + indexUrlFetchOptions?: RequestInit; +}; +export interface GffTile extends GFF3FeatureLineWithRefs { + attribute?: string; +} +export interface EmptyTile { + tilePositionId: string; +} +declare function init(uid: string, bed: { + url: string; + indexUrl: string; +}, chromSizes: ChromSizes, options?: Partial): void; +declare const tileFunctions: { + init: typeof init; + tilesetInfo: (uid: string) => { + tile_size: number; + bins_per_dimension: number; + max_zoom: number; + max_width: number; + min_pos: number[]; + max_pos: number[]; + }; + fetchTilesDebounced: (uid: string, tileIds: string[]) => Promise>; + tile: (uid: string, z: number, x: number) => Promise; + getTabularData: (uid: string, tileIds: string[]) => import("threads").TransferDescriptor; +}; +export type WorkerApi = typeof tileFunctions; +export type { TilesetInfo }; +//# sourceMappingURL=gff-worker.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/gff-worker.d.ts.map b/dist/src/data-fetchers/gff/gff-worker.d.ts.map new file mode 100644 index 00000000..78f67b9f --- /dev/null +++ b/dist/src/data-fetchers/gff/gff-worker.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gff-worker.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/gff/gff-worker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAA6B,MAAM,WAAW,CAAC;AAGpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI/D,MAAM,MAAM,cAAc,GAAG;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnE,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,oBAAoB,CAAC,EAAE,WAAW,CAAC;CACtC,CAAC;AAEF,MAAM,WAAW,OAAQ,SAAQ,uBAAuB;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACtB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAyOD,iBAAS,IAAI,CACT,GAAG,EAAE,MAAM,EACX,GAAG,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EACtC,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM,QAWxC;AAsFD,QAAA,MAAM,aAAa;;uBApFO,MAAM;;;;;;;;+BA8BQ,MAAM,WAAW,MAAM,EAAE;gBApBxC,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,QAAQ,IAAI,EAAE,CAAC;0BAoD1C,MAAM,WAAW,MAAM,EAAE;CA4BrD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,aAAa,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/utils.d.ts b/dist/src/data-fetchers/gff/utils.d.ts new file mode 100644 index 00000000..29e15ccd --- /dev/null +++ b/dist/src/data-fetchers/gff/utils.d.ts @@ -0,0 +1,10 @@ +import type { GFF3Feature, GFF3Sequence } from '@gmod/gff'; +/** + * Type guard for GFF3Feature + * @param entry An element from GFF.parseStringSync() return value + * @returns True if type is GFF3Feature + */ +export declare function isGFF3Feature(entry: GFF3Feature | GFF3Sequence): entry is GFF3Feature; +/** Returns an array of the unique values sampled n times between 0 and maxValue */ +export declare function makeRandomSortedArray(n: number, maxValue: number): number[]; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/utils.d.ts.map b/dist/src/data-fetchers/gff/utils.d.ts.map new file mode 100644 index 00000000..d0e4317f --- /dev/null +++ b/dist/src/data-fetchers/gff/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/gff/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC3D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,GAAG,KAAK,IAAI,WAAW,CAErF;AAED,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,YAQhE"} \ No newline at end of file diff --git a/dist/src/data-fetchers/index.d.ts b/dist/src/data-fetchers/index.d.ts new file mode 100644 index 00000000..914c4855 --- /dev/null +++ b/dist/src/data-fetchers/index.d.ts @@ -0,0 +1,9 @@ +export { default as BamDataFetcher } from './bam/bam-data-fetcher'; +export { default as VcfDataFetcher } from './vcf/vcf-data-fetcher'; +export { default as BigWigDataFetcher } from './bigwig/bigwig-data-fetcher'; +export { default as CsvDataFetcher } from './csv/csv-data-fetcher'; +export { default as JsonDataFetcher } from './json/json-data-fetcher'; +export { default as GffDataFetcher } from './gff/gff-data-fetcher'; +export { default as BedDataFetcher } from './bed/bed-data-fetcher'; +export { type TabularDataFetcher } from './utils'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/index.d.ts.map b/dist/src/data-fetchers/index.d.ts.map new file mode 100644 index 00000000..81a018c6 --- /dev/null +++ b/dist/src/data-fetchers/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data-fetchers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/json/json-data-fetcher.d.ts b/dist/src/data-fetchers/json/json-data-fetcher.d.ts new file mode 100644 index 00000000..91bab2ef --- /dev/null +++ b/dist/src/data-fetchers/json/json-data-fetcher.d.ts @@ -0,0 +1,11 @@ +/** + * HiGlass data fetcher specific for Gosling which ultimately will accept any types of data other than JSON values. + */ +declare function JsonDataFetcher(HGC: any, ...args: any): any; +declare namespace JsonDataFetcher { + var config: { + type: string; + }; +} +export default JsonDataFetcher; +//# sourceMappingURL=json-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/json/json-data-fetcher.d.ts.map b/dist/src/data-fetchers/json/json-data-fetcher.d.ts.map new file mode 100644 index 00000000..50c700c7 --- /dev/null +++ b/dist/src/data-fetchers/json/json-data-fetcher.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"json-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/json/json-data-fetcher.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,iBAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,GAAG,CAmKpD;kBAnKQ,eAAe;;;;;AAyKxB,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/utils.d.ts b/dist/src/data-fetchers/utils.d.ts new file mode 100644 index 00000000..3c3b93c5 --- /dev/null +++ b/dist/src/data-fetchers/utils.d.ts @@ -0,0 +1,54 @@ +import { RemoteFile as _RemoteFile } from 'generic-filehandle'; +import type * as HiGlass from '@higlass/types'; +import type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema'; +export type CommonDataConfig = { + assembly: Assembly; + x?: string; + xe?: string; + x1?: string; + x1e?: string; + urlFetchOptions?: RequestInit; +}; +export declare class DataSource { + file: File; + options: Options; + chromInfo: ExtendedChromInfo; + tilesetInfo: ReturnType; + constructor(file: File, chromSizes: ChromSizes, options: Options); +} +/** + * Filter data before sending to a track considering the visible genomic area in the track. + * TODO(2022-Jul-13): Consider genomic `y` channels as well. + */ +export declare function filterUsingGenoPos(data: Datum[], [minX, maxX]: [number, number], config: Omit): Datum[]; +declare const absToChr: (absPosition: number, chromInfo: HiGlass.ChromInfo) => readonly [string, number, number, number] | null; +/** + * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`. + * @param chrName A chromosome name to be sanitized + * @param assembly A genome assembly of the data + * @param chromosomePrefix A prefix string that can be replaced to 'chr' + * @returns + */ +export declare function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string): string; +export type ExtendedChromInfo = HiGlass.ChromInfo & { + absToChr(absPos: number): ReturnType | null; + chrToAbs(chr: [name: string, pos: number]): number | null; +}; +export declare function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize?: number): { + tile_size: number; + bins_per_dimension: number; + max_zoom: number; + max_width: number; + min_pos: number[]; + max_pos: number[]; +}; +export declare function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo; +export declare class RemoteFile extends _RemoteFile { + read: _RemoteFile['read']; +} +export interface TabularDataFetcher { + getTabularData(tileIds: string[]): Promise; + MAX_TILE_WIDTH?: number; +} +export {}; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/utils.d.ts.map b/dist/src/data-fetchers/utils.d.ts.map new file mode 100644 index 00000000..4d5309fa --- /dev/null +++ b/dist/src/data-fetchers/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/data-fetchers/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAEhF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,WAAW,CAAC;CACjC,CAAC;AAEF,qBAAa,UAAU,CAAC,IAAI,EAAE,OAAO;IAId,IAAI,EAAE,IAAI;IAAiC,OAAO,EAAE,OAAO;IAH9E,SAAS,EAAE,iBAAiB,CAAC;IAC7B,WAAW,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;gBAEtC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAS,OAAO,EAAE,OAAO;CAIjF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAC9B,IAAI,EAAE,KAAK,EAAE,EACb,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,WAoB7C;AAOD,QAAA,MAAM,QAAQ,gBAAiB,MAAM,aAAa,QAAQ,SAAS,qDA4BlE,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,CAAC,EAAE,MAAM,UAe7F;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,SAAS,GAAG;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,GAAG,IAAI,CAAC;IAC7D,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;CAC7D,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,iBAAiB,EAAE,QAAQ,SAAO;;;;;;;EASrF;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,iBAAiB,CAqB7E;AAED,qBAAa,UAAW,SAAQ,WAAW;IAGhC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAsD9B;CACL;AAED,MAAM,WAAW,kBAAkB,CAAC,IAAI;IACpC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B"} \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/utils.d.ts b/dist/src/data-fetchers/vcf/utils.d.ts new file mode 100644 index 00000000..bb61ad19 --- /dev/null +++ b/dist/src/data-fetchers/vcf/utils.d.ts @@ -0,0 +1,11 @@ +import type { VcfRecord, VcfTile } from './vcf-data-fetcher'; +export declare const getMutationType: (ref: string, alt?: string) => "unknown" | "substitution" | "deletion" | "insertion"; +export declare const getSubstitutionType: (ref: string, alt?: string) => "unknown" | "C>A" | "C>G" | "C>T" | "T>A" | "T>C" | "T>G"; +/** + * Convert a VCF record to a tile data + * @param vcfRecord A row of a VCF files loaded + * @param chrPos Cumulative start position of a chromosome + * @param prevAbsPos Previous position of a point mutation for calculating 'distance to previous' + */ +export declare function recordToTile(vcfRecord: VcfRecord, chrPos: number, prevAbsPos?: number): VcfTile; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/utils.d.ts.map b/dist/src/data-fetchers/vcf/utils.d.ts.map new file mode 100644 index 00000000..f6bf057e --- /dev/null +++ b/dist/src/data-fetchers/vcf/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/vcf/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7D,eAAO,MAAM,eAAe,QAAS,MAAM,QAAQ,MAAM,0DAMxD,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAS,MAAM,QAAQ,MAAM,8DAuB5D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,WAuCrF"} \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts b/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts new file mode 100644 index 00000000..aa2485bb --- /dev/null +++ b/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts @@ -0,0 +1,48 @@ +import type { Assembly, VcfData } from '@gosling-lang/gosling-schema'; +import type { TilesetInfo } from './vcf-worker'; +import type { TabularDataFetcher } from '../utils'; +import { getSubstitutionType, getMutationType } from './utils'; +export type VcfRecord = { + CHROM: string; + POS: number; + ID: null | string[]; + REF: string; + ALT: null | string[]; + QUAL: null | number; + FILTER: null | string; + INFO: Record; +}; +export type VcfTile = Omit & { + ALT: string | undefined; + MUTTYPE: ReturnType; + SUBTYPE: ReturnType; + INFO: string; + ORIGINALPOS: number; + POS: number; + POSEND: number; + DISTPREV: number | null; + DISTPREVLOGE: number | null; +} & { + [infoKey: string]: any; +}; +declare class VcfDataFetcher implements TabularDataFetcher { + static config: { + type: string; + }; + dataConfig: {}; + uid: string; + prevRequestTime: number; + track?: any; + private toFetch; + private fetchTimeout?; + private worker; + constructor(HGC: import('@higlass/types').HGC, config: VcfData & { + assembly: Assembly; + }); + tilesetInfo(callback: (info: TilesetInfo) => void): Promise; + fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]): void; + sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]): Promise; + getTabularData(tileIds: string[]): Promise; +} +export default VcfDataFetcher; +//# sourceMappingURL=vcf-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts.map b/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts.map new file mode 100644 index 00000000..72686cdb --- /dev/null +++ b/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"vcf-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/vcf/vcf-data-fetcher.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAM/D,MAAM,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mC;gBAErC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAG;QAAE,QAAQ,EAAE,QAAQ,CAAA;KAAE;IAejF,WAAW,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI;IAIvD,mBAAmB,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAexF,SAAS,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAIpF,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAI9D;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/vcf-worker.d.ts b/dist/src/data-fetchers/vcf/vcf-worker.d.ts new file mode 100644 index 00000000..953b87b8 --- /dev/null +++ b/dist/src/data-fetchers/vcf/vcf-worker.d.ts @@ -0,0 +1,29 @@ +import type { TilesetInfo } from '@higlass/types'; +import type { ChromSizes } from '@gosling-lang/gosling-schema'; +import type { VcfTile } from './vcf-data-fetcher'; +type VcfFileOptions = { + sampleLength: number; + urlFetchOptions?: RequestInit; + indexUrlFetchOptions?: RequestInit; +}; +declare function init(uid: string, vcf: { + url: string; + indexUrl: string; +}, chromSizes: ChromSizes, options?: Partial): void; +declare const tileFunctions: { + init: typeof init; + tilesetInfo: (uid: string) => { + tile_size: number; + bins_per_dimension: number; + max_zoom: number; + max_width: number; + min_pos: number[]; + max_pos: number[]; + }; + fetchTilesDebounced: (uid: string, tileIds: string[]) => Promise>; + tile: (uid: string, z: number, x: number) => Promise; + getTabularData: (uid: string, tileIds: string[]) => import("threads").TransferDescriptor; +}; +export type WorkerApi = typeof tileFunctions; +export type { TilesetInfo }; +//# sourceMappingURL=vcf-worker.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/vcf-worker.d.ts.map b/dist/src/data-fetchers/vcf/vcf-worker.d.ts.map new file mode 100644 index 00000000..0f00cfc3 --- /dev/null +++ b/dist/src/data-fetchers/vcf/vcf-worker.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"vcf-worker.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/vcf/vcf-worker.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAMlD,KAAK,cAAc,GAAG;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,oBAAoB,CAAC,EAAE,WAAW,CAAC;CACtC,CAAC;AAiHF,iBAAS,IAAI,CACT,GAAG,EAAE,MAAM,EACX,GAAG,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EACtC,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM,QAWxC;AA0FD,QAAA,MAAM,aAAa;;uBAxFO,MAAM;;;;;;;;+BA6BQ,MAAM,WAAW,MAAM,EAAE;gBAnBxC,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,QAAQ,OAAO,EAAE,CAAC;0BA+C7C,MAAM,WAAW,MAAM,EAAE;CAqCrD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,aAAa,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/src/exported-utils.d.ts b/dist/src/exported-utils.d.ts new file mode 100644 index 00000000..0fb68f0e --- /dev/null +++ b/dist/src/exported-utils.d.ts @@ -0,0 +1,5 @@ +export { getRelativeGenomicPosition, computeChromSizes, getChromInterval, getChromTotalSize, parseGenomicPosition } from './core/utils/assembly'; +export { sanitizeChrName } from './data-fetchers/utils'; +export { convertToFlatTracks as _convertToFlatTracks } from './compiler/spec-preprocess'; +export { spreadTracksByData as _spreadTracksByData } from './core/utils/overlay'; +//# sourceMappingURL=exported-utils.d.ts.map \ No newline at end of file diff --git a/dist/src/exported-utils.d.ts.map b/dist/src/exported-utils.d.ts.map new file mode 100644 index 00000000..4cb5aca8 --- /dev/null +++ b/dist/src/exported-utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"exported-utils.d.ts","sourceRoot":"","sources":["../../src/exported-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,mBAAmB,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACzF,OAAO,EAAE,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-schema/gosling.schema.d.ts b/dist/src/gosling-schema/gosling.schema.d.ts new file mode 100644 index 00000000..5c23ab29 --- /dev/null +++ b/dist/src/gosling-schema/gosling.schema.d.ts @@ -0,0 +1,1229 @@ +export type GoslingSpec = (RootSpecWithSingleView & ResponsiveSpecOfSingleView) | (RootSpecWithMultipleViews & ResponsiveSpecOfMultipleViews); +export type ResponsiveSize = boolean | { + width?: boolean; + height?: boolean; +}; +export type RootSpecWithSingleView = SingleView & { + title?: string; + subtitle?: string; + description?: string; + /** Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false` */ + responsiveSize?: ResponsiveSize; +}; +export interface RootSpecWithMultipleViews extends MultipleViews { + title?: string; + subtitle?: string; + description?: string; + /** Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false` */ + responsiveSize?: ResponsiveSize; +} +export type View = SingleView | (MultipleViews & ResponsiveSpecOfMultipleViews); +export type SingleView = (OverlaidTracks | StackedTracks | FlatTracks) & ResponsiveSpecOfSingleView; +export type SelectivityCondition = { + operation: LogicalOperation; + /** + * Does the condition applied to the visualization itself or its container? __Default__: `'self'` + */ + target?: 'self' | 'container'; + measure: 'width' | 'height' | 'aspectRatio'; + /** Threshold in the unit of pixels. */ + threshold: number; +}; +export type ResponsiveSpecOfSingleView = { + responsiveSpec?: { + spec: Partial; + selectivity: SelectivityCondition[]; + }[]; +}; +export interface FlatTracks extends CommonViewDef { + tracks: Track[]; +} +export type PartialTrack = Partial; +export interface StackedTracks extends CommonViewDef, Partial { + alignment?: 'stack'; + tracks: (PartialTrack | OverlaidTracks)[]; +} +export interface OverlaidTracks extends CommonViewDef, Partial { + alignment: 'overlay'; + tracks: PartialTrack[]; +} +export interface MultipleViews extends CommonViewDef { + /** + * Specify how multiple views are arranged. + */ + arrangement?: 'parallel' | 'serial' | 'horizontal' | 'vertical'; + /** An array of view specifications */ + views: Array; + /** Internal: Used for responsive spec */ + _assignedWidth?: number; + _assignedHeight?: number; +} +export type ResponsiveSpecOfMultipleViews = { + responsiveSpec?: { + spec: Partial; + selectivity: SelectivityCondition[]; + }[]; +}; +export type Layout = 'linear' | 'circular'; +export type Orientation = 'horizontal' | 'vertical'; +/** Custom chromosome sizes, e.g., [["foo", 1000], ["bar", 300], ["baz", 240]] */ +export type ChromSizes = [string, number][]; +export type Assembly = 'hg38' | 'hg19' | 'hg18' | 'hg17' | 'hg16' | 'mm10' | 'mm9' | 'unknown' | ChromSizes; +export type ZoomLimits = [number | null, number | null]; +export interface CommonViewDef { + /** The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view */ + id?: string; + /** Specify the layout type of all tracks. */ + layout?: Layout; + /** Specify the orientation. */ + orientation?: Orientation; + /** + * The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. + * The effect of this property depends on where on the spec you specify the `spacing`. + * + * In a linear layout, this value is used in pixels, + * while in a circular layout, this value is used relative to the height of the tracks or views. + */ + spacing?: number; + /** Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), + * __Default:__ `false`. + */ + static?: boolean; + zoomLimits?: ZoomLimits; + /** Specify the x offset of views in the unit of pixels */ + xOffset?: number; + /** Specify the y offset of views in the unit of pixels */ + yOffset?: number; + /** + * A string that specifies the genome builds to use. + * Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`. + * + * __Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels. + */ + assembly?: Assembly; + /** Specify the visible region of genomic x-axis */ + xDomain?: DomainInterval | DomainChrInterval | DomainChr; + /** Specify the visible region of genomic y-axis */ + yDomain?: DomainInterval | DomainChrInterval | DomainChr; + /** Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views) */ + linkingId?: string; + /** not supported */ + xAxis?: AxisPosition; + /** + * Proportion of the radius of the center white space. + * + * __Default:__ `0.3` + * @Range [0, 1] + */ + centerRadius?: number; + /** + * Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. + * Will be overwritten by the style of children elements (e.g., view, track). + */ + style?: Style; + /** Internal: Used for responsive spec */ + _assignedWidth?: number; + _assignedHeight?: number; +} +export type Track = SingleTrack | OverlaidTrack | DataTrack | TemplateTrack | DummyTrack; +export interface CommonTrackDef extends CommonViewDef { + /** Assigned to `uid` in a HiGlass view config, used for API and caching. */ + id?: string; + /** If defined, will show the textual label on the left-top corner of a track. */ + title?: string; + subtitle?: string; + /** Specify the track width in pixels. */ + width?: number; + /** Specify the track height in pixels. */ + height?: number; + overlayOnPreviousTrack?: boolean; + /** + * Specify the outer radius of tracks when `{"layout": "circular"}`. + */ + outerRadius?: number; + /** + * Specify the inner radius of tracks when (`{"layout": "circular"}`). + */ + innerRadius?: number; + /** + * Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`). + */ + startAngle?: number; + /** + * Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`). + */ + endAngle?: number; + /** internal */ + _renderingId?: string; + /** internal */ + _invalidTrack?: boolean; + /** internal */ + prerelease?: {}; +} +/** + * Partial specification of `BasicSingleTrack` to use default visual encoding predefined by data type. + */ +export interface DataTrack extends CommonTrackDef { + data: DataDeep; +} +/** + * A placeholder track. In contrast to other tracks, this track does not display any data. Instead it provides + * empty space for third party tools to display their data on top of. + */ +export interface DummyTrack extends Pick { + /** Used to specify the dummy track */ + type: 'dummy-track'; + /** Text that gets shown on the DummyTrack */ + title?: string; + /** Defines how the track is styled */ + style?: DummyTrackStyle; + /** Only linear layout are supported at this time */ + layout?: 'linear'; + static?: true; + /** Unused property for DummyTrack */ + zoomLimits?: [null, null]; + /** No assemblies can be associated with a dummy track */ + assembly?: 'unknown'; +} +export interface DummyTrackStyle { + /** Background color of the track */ + background?: string; + /** Color of the outline of the track */ + outline?: string; + /** Specify the font size of the title */ + textFontSize?: number; + /** Specify the font weight of the title. */ + textFontWeight?: 'bold' | 'normal'; + /** Specify the stroke color of title. */ + textStroke?: string; + /** Specify the stroke width of the title. */ + textStrokeWidth?: number; +} +export type Mark = 'point' | 'line' | 'area' | 'bar' | 'rect' | 'text' | 'withinLink' | 'betweenLink' | 'rule' | 'triangleLeft' | 'triangleRight' | 'triangleBottom' | 'brush' | 'header'; +interface CommonEventData { + /** Source visualization ID, i.e., `track.id` */ + id: string; + /** Values in a JSON array that represent data after data transformation */ + data: Datum[]; +} +interface SpecEventData { + /** Source visualization ID, i.e., `track.id` */ + id: string; + /** Gosling spec */ + spec: GoslingSpec; +} +export interface GenomicPosition { + chromosome: string; + position: number; +} +interface OnNewTrackEventData { + /** Source visualization ID, i.e., `track.id` */ + id: string; +} +interface OnNewViewEventData { + /** Source visualization ID, i.e., `track.id` */ + id: string; +} +interface PointMouseEventData extends CommonEventData { + /** A genomic coordinate, e.g., `chr1:100,000`. */ + genomicPosition: GenomicPosition; +} +interface RangeMouseEventData extends CommonEventData { + /** Start and end genomic coordinates. Null if a range is deselected. */ + genomicRange: [GenomicPosition, GenomicPosition] | null; +} +/** + * Data about the genomic range of a track + */ +interface LocationEventData extends Omit { + genomicRange: [GenomicPosition, GenomicPosition]; +} +/** + * The visual parameters that determine the shape of a linear track or a view. + * Origin is the left top corner. + */ +export interface BoundingBox { + x: number; + y: number; + width: number; + height: number; +} +/** The visual parameters that determine the shape of a circular track */ +interface CircularTrackShape { + cx: number; + cy: number; + innerRadius: number; + outerRadius: number; + /** The first angle in the range of [0, 360]. The origin is 12 o'clock. Anticlockwise. */ + startAngle: number; + /** The second angle in the range of [0, 360]. The origin is 12 o'clock. Anticlockwise. */ + endAngle: number; +} +/** + * The information of a view exposed to users through JS API. + */ +export type ViewApiData = { + /** ID of a source view, i.e., `view.id` */ + id: string; + /** Expanded view specification processed by the Gosling compiler, e.g., default properties filled in. */ + spec: View; + /** The shape of the source view */ + shape: BoundingBox; +}; +/** The information for a track mouse event */ +export type TrackApiData = { + /** ID of a source track, i.e., `track.id` */ + id: string; + /** Expanded track specification processed by the Gosling compiler, e.g., default properties filled in. */ + spec: SingleTrack | OverlaidTrack; + /** The shape of the source track */ + shape: BoundingBox | (BoundingBox & CircularTrackShape); +}; +/** The API data of tracks or views */ +export type VisUnitApiData = ({ + type: 'view'; +} & ViewApiData) | ({ + type: 'track'; +} & TrackApiData); +export type _EventMap = { + mouseOver: PointMouseEventData; + click: PointMouseEventData; + rangeSelect: RangeMouseEventData; + rawData: CommonEventData; + specProcessed: SpecEventData; + trackMouseOver: TrackApiData; + trackClick: TrackApiData; + onNewTrack: OnNewTrackEventData; + onNewView: OnNewViewEventData; + location: LocationEventData; +}; +/** Options for determining mouse events in detail, e.g., turning on specific events only */ +export type MouseEventsDeep = { + /** Whether to enable mouseover events. */ + mouseOver?: boolean; + /** Whether to enable click events. */ + click?: boolean; + /** Whether to send range selection events. */ + rangeSelect?: boolean; + /** Group marks using keys in a data field. This affects how a set of marks are highlighted/selected by interaction. __Default__: `undefined` */ + groupMarksByField?: string; + /** Determine whether all marks underneath the mouse point should be affected by mouse over. __Default__: `false` */ + enableMouseOverOnMultipleMarks?: boolean; +}; +export type SingleTrack = SingleTrackBase & Encoding; +interface SingleTrackBase extends CommonTrackDef { + data: DataDeep; + dataTransform?: DataTransform[]; + tooltip?: Tooltip[]; + experimental?: { + mouseEvents?: boolean | MouseEventsDeep; + /** + * Render visual marks with less smooth curves to increase rendering performance. + * Only supported for `elliptical` `linkStyle` `withinLink` currently. + * @default false + */ + performanceMode?: boolean; + /** + * Performance rendering option. + * By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve + * rendering performance. No marks will be stretched in circular layouts. + * + * When this option is set to true, all marks will be stretched when zooming in/out. + * When this option is set to false, all marks will be rerendered when zooming in/out. + * + */ + stretchGraphics?: boolean; + /** + * Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic + * will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will + * be rerendered. This is to prevent the graphics from being stretched too much. + * @default 1.5 + */ + stretchGraphicsThreshold?: number; + }; + mark: Mark; + displacement?: Displacement; + visibility?: VisibilityCondition[]; + flipY?: boolean; + baselineY?: number; + stretch?: boolean; + overrideTemplate?: boolean; +} +export interface Encoding { + x?: X | ChannelValue; + y?: Y | ChannelValue; + xe?: X | ChannelValue; + ye?: Y | ChannelValue; + x1?: X | ChannelValue; + y1?: Y | ChannelValue; + x1e?: X | ChannelValue; + y1e?: Y | ChannelValue; + row?: Row | ChannelValue; + color?: Color | ChannelValue; + size?: Size | ChannelValue; + text?: Text | ChannelValue; + stroke?: Stroke | ChannelValue; + strokeWidth?: StrokeWidth | ChannelValue; + opacity?: Opacity | ChannelValue; +} +export interface Tooltip { + /** Specifiy a data field whose value will show in the tooltip. */ + field: string; + /** Type of the data field. */ + type: FieldType; + /** Name of the data field for showing in the tooltip. Will use the field name if not specified. */ + alt?: string; + /** format of the data value. */ + format?: string; +} +export interface Displacement { + type: DisplacementType; + padding?: number; +} +export type DisplacementType = 'pile' | 'spread'; +/** + * Superposing multiple tracks. + */ +export type OverlaidTrack = Partial & { + _overlay: Partial>[]; +}; +/** + * The styles defined here will be applied to the target marks of mouse events, such as a point mark after the user clicks on it. + */ +export interface EventStyle { + /** color of the marks when mouse events are triggered */ + color?: string; + /** stroke color of the marks when mouse events are triggered */ + stroke?: string; + /** stroke width of the marks when mouse events are triggered */ + strokeWidth?: number; + strokeOpacity?: number; + /** opacity of the marks when mouse events are triggered */ + opacity?: number; + /** Show event effects behind or in front of marks. */ + arrange?: 'behind' | 'front'; +} +export interface Style { + background?: string; + backgroundOpacity?: number; + outline?: string; + outlineWidth?: number; + /** + * Whether to enable smooth paths when drawing curves. + * + * __Default__: `false` + */ + enableSmoothPath?: boolean; + /** + * Specify the pattern of dashes and gaps for `rule` marks. + */ + dashed?: [number, number]; + /** + * Specify the pattern of dashes and gaps for `rule` marks. + */ + linePattern?: { + type: 'triangleLeft' | 'triangleRight'; + size: number; + }; + /** + * Specify the curve of `rule` marks. + */ + curve?: 'top' | 'bottom' | 'left' | 'right'; + /** + * Specify the alignment of marks. + * This property is currently only supported for `triangle` marks. + */ + align?: 'left' | 'right'; + /** + * Offset the position of marks in x direction. + * This property is currently only supported for `text` marks + */ + dx?: number; + /** + * Offset the position of marks in y direction. + * This property is currently only supported for `text` marks. + */ + dy?: number; + /** + * The style of `withinLink` and `betweenLink` marks. __Default__: `'circular'` + * `'elliptical'` will be used as a default option. + */ + linkStyle?: 'elliptical' | 'circular' | 'straight'; + /** + * The minimum height of `withinLink` and `betweenLink` marks. Unit is a percentagle. __Default__: `0.5` + * @Range [0, 1] + */ + linkMinHeight?: number; + /** + * Whether to show vertical lines that connect to the baseline (axis) when `y` and `ye` are both used. __Default__: `false` + */ + withinLinkVerticalLines?: boolean; + /** + * Specify whether to show legend in a single horizontal line? + */ + inlineLegend?: boolean; + /** + * If defined, show legend title on the top or left + */ + legendTitle?: string; + /** + * Specify the font size of `text` marks. + * Can also be specified using the `size` channel option of `text` marks. + */ + textFontSize?: number; + /** + * Specify the stroke of `text` marks. + * Can also be specified using the `stroke` channel option of `text` marks. + */ + textStroke?: string; + /** + * Specify the stroke width of `text` marks. + * Can also be specified using the `strokeWidth` channel option of `text` marks. + */ + textStrokeWidth?: number; + /** Specify the font weight of `text` marks. */ + textFontWeight?: 'bold' | 'normal'; + /** Specify the alignment of `text` marks to a given point. + */ + textAnchor?: 'start' | 'middle' | 'end'; + /** Specify the connetion type of `betweenLink` marks. + * + * __Default__: `"corner"` + */ + linkConnectionType?: 'straight' | 'curve' | 'corner'; + /** + * Determine to show only one side of the diagonal in a HiGlass matrix. __Default__: `"full"` + */ + matrixExtent?: 'full' | 'upper-right' | 'lower-left'; + /** + * Customize visual effects of `mouseOver` events on marks. + */ + mouseOver?: EventStyle; + /** + * Customize visual effects of `rangeSelect` events on marks . + */ + select?: EventStyle; + /** + * Customize the style of the brush mark in the `rangeSelect` mouse event. + */ + brush?: Omit; +} +export type VisibilityCondition = SizeVisibilityCondition | ZoomLevelVisibilityCondition; +interface CommonVisibilityCondition { + /** + * A string that specifies the logical operation to conduct between `threshold` and the `measure` of `target`. + * Support + * + * - greater than : "greater-than", "gt", "GT" + * + * - less than : "less-than", "lt", "LT" + * + * - greater than or equal to : "greater-than-or-equal-to", "gtet", "GTET" + * + * - less than or equal to : "less-than-or-equal-to", "ltet", "LTET" + */ + operation: LogicalOperation; + /** + * Specify the buffer size (in pixel) of width or height when calculating the visibility. + * + * __Default__: `0` + */ + conditionPadding?: number; + /** + * Specify the buffer size (in pixel) of width or height for smooth transition. + * + * __Default__: `0` + */ + transitionPadding?: number; +} +export interface SizeVisibilityCondition extends CommonVisibilityCondition { + /** + * Target specifies the object that you want to compare with the threshold. + */ + target: 'track' | 'mark'; + /** + * Specify which aspect of the `target` will be compared to the `threshold`. + */ + measure: 'width' | 'height'; + /** + * Specify the threshold as one of: + * + * - A number representing a fixed threshold in the unit of pixels; + * + * - `"|xe-x|"`, using the distance between `xe` and `x` as threshold + */ + threshold: number | '|xe-x|'; +} +export interface ZoomLevelVisibilityCondition extends CommonVisibilityCondition { + /** + * Target specifies the object that you want to compare with the threshold. + */ + target: 'track' | 'mark'; + /** + * Specify which aspect of the `target` will be compared to the `threshold`. + */ + measure: 'zoomLevel'; + /** + * Set a threshold in the unit of base pairs (bp) + */ + threshold: number; +} +export type LogicalOperation = 'less-than' | 'lt' | 'LT' | 'greater-than' | 'gt' | 'GT' | 'less-than-or-equal-to' | 'ltet' | 'LTET' | 'greater-than-or-equal-to' | 'gtet' | 'GTET'; +export declare const ChannelTypes: { + readonly x: "x"; + readonly y: "y"; + readonly xe: "xe"; + readonly ye: "ye"; + readonly x1: "x1"; + readonly y1: "y1"; + readonly x1e: "x1e"; + readonly y1e: "y1e"; + readonly color: "color"; + readonly row: "row"; + readonly opacity: "opacity"; + readonly stroke: "stroke"; + readonly strokeWidth: "strokeWidth"; + readonly size: "size"; + readonly text: "text"; +}; +export type ChannelType = keyof typeof ChannelTypes | string; +export type Channel = ChannelDeep | ChannelValue; +export interface AxisCommon { + /** Name of the data field. */ + field?: string; + /** Specify the data type. */ + type?: 'quantitative' | 'nominal' | 'genomic'; + /** Values of the data */ + domain?: ValueExtent | GenomicDomain; + /** Values of the visual channel. */ + range?: ValueExtent; + /** Specify where should the axis be put */ + axis?: AxisPosition; + /** Whether to display legend. __Default__: `false` */ + legend?: boolean; + /** Users need to assign a unique linkingId for [linking views](/docs/user-interaction#linking-views) and [Brushing and Linking](/docs/user-interaction#brushing-and-linking) */ + linkingId?: string; + /** Specify how to aggregate data. __Default__: `undefined` */ + aggregate?: Aggregate; + /** Whether to display grid. __Default__: `false` */ + grid?: boolean; +} +export interface X extends AxisCommon { + type?: 'genomic'; + domain?: GenomicDomain; +} +export interface Y extends AxisCommon { + /** Custom baseline of the y-axis. __Default__: `0` */ + baseline?: string | number; + /** Specify whether to use zero baseline. __Default__: `true` */ + zeroBaseline?: boolean; + /** Whether to flip the y-axis. This is done by inverting the `range` property. __Default__: `false` */ + flip?: boolean; +} +export interface ChannelDeepCommon { + /** Name of the data field */ + field?: string; + /** Specify the data type */ + type?: 'quantitative' | 'nominal' | 'genomic'; + /** Values of the data */ + domain?: ValueExtent; + /** Ranges of visual channel values */ + range?: ValueExtent | Range; +} +export interface Row extends ChannelDeepCommon { + type?: 'nominal'; + domain?: ValueExtent; + /** Determine the start and end position of rendering area of this track along vertical axis. __Default__: `[0, height]` */ + range?: ValueExtent; + /** Whether to display legend. __Default__: `false` */ + legend?: boolean; + /** Determines the size of inner white spaces on the top and bottom of individiual rows. __Default__: `0` */ + padding?: number; + /** Whether to display grid. __Default__: `false` */ + grid?: boolean; + /** Clip row when the actual y value exceeds the max value of the y scale. Used only for bar marks at the moment. __Default__: `true` */ + clip?: boolean; +} +export interface Color extends ChannelDeepCommon { + type?: 'quantitative' | 'nominal'; + domain?: ValueExtent; + /** Determine the colors that should be bound to data value. Default properties are determined considering the field type. */ + range?: Range; + /** Title of the legend. __Default__: `undefined` */ + title?: string; + /** Whether to display legend. __Default__: `false` */ + legend?: boolean; + scale?: 'linear' | 'log'; + /** Whether to use offset of the domain proportionally. This is bound to brushes on the color legend. __Default__: `[0, 1]` */ + scaleOffset?: [number, number]; +} +export interface Stroke extends ChannelDeepCommon { + type?: 'quantitative' | 'nominal'; + domain?: ValueExtent; + range?: Range; + /** Title of the legend. __Default__: `undefined` */ + title?: string; + /** Whether to display legend. __Default__: `false` */ + legend?: boolean; + /** Whether to use offset of the domain proportionally. This is bound to brushes on the color legend. __Default__: `[0, 1]` */ + scaleOffset?: [number, number]; +} +export interface StrokeWidth extends ChannelDeepCommon { + type?: 'quantitative' | 'nominal'; + domain?: ValueExtent; + range?: ValueExtent; +} +export interface Size extends ChannelDeepCommon { + type?: 'quantitative' | 'nominal'; + domain?: ValueExtent; + range?: ValueExtent; + /** not supported: Whether to display legend. __Default__: `false` */ + legend?: boolean; +} +export interface Opacity extends ChannelDeepCommon { + type?: 'quantitative' | 'nominal'; + domain?: ValueExtent; + range?: ValueExtent; +} +export interface Text extends Omit { + type?: 'quantitative' | 'nominal'; + domain?: string[]; + range?: string[]; +} +export type ChannelDeep = X | Y | Row | Color | Size | Stroke | StrokeWidth | Opacity | Text; +export interface ChannelValue { + /** Assign a constant value for a visual channel. */ + value: number | string; +} +export type AxisPosition = 'none' | 'top' | 'bottom' | 'left' | 'right'; +export type FieldType = 'genomic' | 'nominal' | 'quantitative'; +export type ValueExtent = string[] | number[]; +export type GenomicDomain = DomainInterval | DomainChrInterval | DomainChr; +export type Domain = ValueExtent | GenomicDomain; +export type Range = ValueExtent | PredefinedColors; +export type PredefinedColors = 'viridis' | 'grey' | 'spectral' | 'warm' | 'cividis' | 'bupu' | 'rdbu' | 'hot' | 'pink'; +export interface DomainChr { + chromosome: string; +} +export interface DomainChrInterval { + /** If specified, only showing a certain interval in a chromosome. */ + chromosome: string; + interval: [number, number]; +} +export interface DomainInterval { + /** Show a certain interval within entire chromosome */ + interval: [number, number]; +} +export type Aggregate = 'max' | 'min' | 'mean' | 'bin' | 'count'; +export type BinAggregate = 'mean' | 'sum'; +export type DataDeep = JsonData | CsvData | BedData | BigWigData | MultivecData | BeddbData | VectorData | MatrixData | BamData | VcfData | GffData; +/** Values in the form of JSON. */ +export interface Datum { + [k: string]: number | string; +} +/** + * The JSON data format allows users to include data directly in the Gosling's JSON specification. + */ +export interface JsonData { + /** + * Define data type. + */ + type: 'json'; + /** Values in the form of JSON. */ + values: Datum[]; + /** Specify the name of chromosome data fields. */ + chromosomeField?: string; + /** Specify the name of genomic data fields. */ + genomicFields?: string[]; + /** Specify the number of rows loaded from the URL. + * + * __Default:__ `1000` + */ + sampleLength?: number; + /** + * Specify the way of sampling from the data if the number of rows to show exceeds `sampleLength`. + * + * __Default:__ `random` + */ + sampleType?: 'first' | 'random'; + /** experimental */ + genomicFieldsToConvert?: { + chromosomeField: string; + genomicFields: string[]; + }[]; +} +/** + * BED file format + */ +export interface BedData { + type: 'bed'; + /** + * Specify the URL address of the data file. + */ + url: string; + /** + * Specify the URL address of the data file index. + */ + indexUrl: string; + /** + * An array of strings, where each string is the name of a non-standard field in the BED file. + * If there are `n` custom fields, we assume that the last `n` columns of the BED file correspond to the custom fields. + */ + customFields?: string[]; + /** + * Specify the number of rows loaded from the URL. + * + * __Default:__ `1000` + */ + sampleLength?: number; +} +/** + * Any small enough tabular data files, such as tsv, csv, BED, BEDPE, and GFF, can be loaded using "csv" data specification. + */ +export interface CsvData { + type: 'csv'; + /** + * Specify the URL address of the data file. + */ + url: string; + /** + * Specify file separator, __Default:__ ',' + */ + separator?: string; + /** + * Specify the name of chromosome data fields. + */ + chromosomeField?: string; + /** + * Specify the name of genomic data fields. + */ + genomicFields?: string[]; + /** + * Specify the number of rows loaded from the URL. + * + * __Default:__ `1000` + */ + sampleLength?: number; + /** + * Specify the names of data fields if a CSV file does not contain a header. + */ + headerNames?: string[]; + /** + * Specify the chromosome prefix if chromosomes are denoted using a prefix besides "chr" or a number + */ + chromosomePrefix?: string; + /** + * experimental + */ + longToWideId?: string; + /** + * experimental + */ + genomicFieldsToConvert?: { + chromosomeField: string; + genomicFields: string[]; + }[]; +} +/** + * Two-dimensional quantitative values, + * one axis for genomic coordinate and the other for different samples, can be converted into HiGlass' `"multivec"` data. + * For example, multiple BigWig files can be converted into a single multivec file. + * You can also convert sequence data (FASTA) into this format where rows will be different nucleotide bases (e.g., A, T, G, C) + * and quantitative values represent the frequency. Find out more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#multivec-files). + */ +export interface MultivecData { + type: 'multivec'; + /** + * Specify the URL address of the data file. + */ + url: string; + /** + * Assign a field name of the middle position of genomic intervals. __Default__: `"position"` + */ + column?: string; + /** + * Assign a field name of samples. __Default__: `"category"` + */ + row?: string; + /** + * Assign a field name of quantitative values. __Default__: `"value"` + */ + value?: string; + /** + * assign names of individual samples. + */ + categories?: string[]; + /** + * Assign a field name of the start position of genomic intervals. __Default__: `"start"` + */ + start?: string; + /** + * Assign a field name of the end position of genomic intervals. __Default__: `"end"` + */ + end?: string; + /** + * Binning the genomic interval in tiles (unit size: 256). + */ + binSize?: number; + /** Determine aggregation function to apply within bins. __Default__: `"mean"` */ + aggregation?: BinAggregate; +} +export interface BigWigData { + type: 'bigwig'; + /** + * Specify the URL address of the data file. + */ + url: string; + /** + * Assign a field name of the middle position of genomic intervals. __Default__: `"position"` + */ + column?: string; + /** + * Assign a field name of quantitative values. __Default__: `"value"` + */ + value?: string; + /** + * Assign a field name of the start position of genomic intervals. __Default__: `"start"` + */ + start?: string; + /** + * Assign a field name of the end position of genomic intervals. __Default__: `"end"` + */ + end?: string; + /** + * Binning the genomic interval in tiles (unit size: 256). + */ + binSize?: number; + /** Determine aggregation function to apply within bins. __Default__: `"mean"` */ + aggregation?: BinAggregate; +} +/** + * One-dimensional quantitative values along genomic position (e.g., bigwig) can be converted into HiGlass' `"vector"` format data. + * Find out more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#bigwig-files). + */ +export interface VectorData { + type: 'vector'; + /** + * Specify the URL address of the data file. + */ + url: string; + /** Assign a field name of the middle position of genomic intervals. __Default__: `"position"` */ + column?: string; + /** Assign a field name of quantitative values. __Default__: `"value"` */ + value?: string; + /** Assign a field name of the start position of genomic intervals. __Default__: `"start"` */ + start?: string; + /** Assign a field name of the end position of genomic intervals. __Default__: `"end"` */ + end?: string; + /** Binning the genomic interval in tiles (unit size: 256). */ + binSize?: number; + /** Determine aggregation function to apply within bins. __Default__: `"mean"` */ + aggregation?: BinAggregate; +} +/** + * Regular BED or similar files can be pre-aggregated for the scalable data exploration. + * Find our more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#bed-files). + */ +export interface BeddbData { + type: 'beddb'; + /** Specify the URL address of the data file. */ + url: string; + /** Specify the name of genomic data fields. */ + genomicFields: { + index: number; + name: string; + }[]; + /** Specify the column indexes, field names, and field types. */ + valueFields?: { + index: number; + name: string; + type: 'nominal' | 'quantitative'; + }[]; + /** experimental */ + exonIntervalFields?: [{ + index: number; + name: string; + }, { + index: number; + name: string; + }]; +} +/** + * Binary Alignment Map (BAM) is the comprehensive raw data of genome sequencing; + * it consists of the lossless, compressed binary representation of the Sequence Alignment Map-files. + */ +export interface BamData { + type: 'bam'; + /** URL link to the BAM data file */ + url: string; + /** URL link to the index file of the BAM file */ + indexUrl: string; + /** Load mates that are located in the same chromosome. __Default__: `false` */ + loadMates?: boolean; + /** Determine whether to extract exon-to-exon junctions. __Default__: `false` */ + extractJunction?: boolean; + /** Determine the threshold of coverage when extracting exon-to-exon junctions. __Default__: `1` */ + junctionMinCoverage?: number; + /** Determines the threshold of insert sizes for determining the structural variants. __Default__: `5000` */ + maxInsertSize?: number; +} +/** + * Generic Feature Format Version 3 (GFF3) format data. It parses files that follow the + * [GFF3 specification](https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md). + */ +export interface GffData { + type: 'gff'; + /** URL link to the GFF file */ + url: string; + /** URL link to the tabix index file */ + indexUrl: string; + /** The maximum number of samples to be shown on the track. Samples are uniformly randomly selected so that this + * threshold is not exceeded. __Default:__ `1000` */ + sampleLength?: number; + /** + * Specifies which attributes to include as a fields. + * GFF files have an "attributes" column which contains a list of attributes which are each tag-value pairs (`tag=value`). + * This option allows for specific attributes to be accessible as a field. For example, if you have an attribute called + * "gene_name" and you want label features on your track using those values, you can use this option so that you can use + * `"field": "gene_name"` in the schema. + * + * If there is a single `value` corresponding to the `tag`, Gosling will parse that value as a string. If there are + * multiple `value`s corresponding to a `tag`, Gosling will parse it as a comma-separated list string. If a feature + * does not have a particular attribute, then the attribute value will be set to the `defaultValue`. + */ + attributesToFields?: { + attribute: string; + defaultValue: string; + }[]; +} +/** + * The Variant Call Format (VCF). + */ +export interface VcfData { + type: 'vcf'; + /** URL link to the VCF file */ + url: string; + /** URL link to the tabix index file */ + indexUrl: string; + /** The maximum number of rows to be loaded from the URL. __Default:__ `1000` */ + sampleLength?: number; +} +export interface MatrixData { + type: 'matrix'; + /** URL link to the matrix data file */ + url: string; + /** The name of the first genomic field. __Default__: `x` */ + column?: string; + /** The name of the first genomic field. __Default__: `y` */ + row?: string; + /** The name of the value field. __Default__: `value` */ + value?: string; + /** Determine the number of nearby cells to aggregate. __Default__: `1` */ + binSize?: number; +} +export type DataTransform = FilterTransform | StrConcatTransform | StrReplaceTransform | LogTransform | DisplaceTransform | ExonSplitTransform | GenomicLengthTransform | SvTypeTransform | CoverageTransform | JsonParseTransform; +export type FilterTransform = OneOfFilter | RangeFilter | IncludeFilter; +interface CommonFilterTransform { + type: 'filter'; + /** A filter is applied based on the values of the specified data field */ + field: string; + /** + * when `{"not": true}`, apply a NOT logical operation to the filter. + * + * __Default:__ `false` */ + not?: boolean; +} +export interface RangeFilter extends CommonFilterTransform { + /** Check whether the value is in a number range. */ + inRange: number[]; +} +export interface IncludeFilter extends CommonFilterTransform { + /** Check whether the value includes a substring. */ + include: string; +} +export interface OneOfFilter extends CommonFilterTransform { + /** Check whether the value is an element in the provided list. */ + oneOf: (string | number | null)[]; +} +export interface ComparisonFilter extends CommonFilterTransform { + /** + * The second field to compare the value with. + */ + field2: string; + /** + * A logical operation to apply between two fields. + */ + operation: LogicalOperation; + not: undefined; +} +export type LogBase = number | 'e'; +export interface LogTransform { + type: 'log'; + field: string; + /** If not specified, 10 is used. */ + base?: LogBase; + /** If specified, store transformed values in a new field. */ + newField?: string; +} +export interface StrConcatTransform { + type: 'concat'; + fields: string[]; + newField: string; + separator: string; +} +export interface StrReplaceTransform { + type: 'replace'; + field: string; + newField: string; + replace: { + from: string; + to: string; + }[]; +} +export interface DisplaceTransform { + type: 'displace'; + boundingBox: { + /** The name of a quantitative field that represents the start position. */ + startField: string; + /** The name of a quantitative field that represents the end position. */ + endField: string; + /** The padding around visual lements. Either px or bp */ + padding?: number; + /** Whether to consider `padding` as the bp length. */ + isPaddingBP?: boolean; + /** The name of a nominal field to group rows by in prior to piling-up. */ + groupField?: string; + }; + /** A string that specifies the type of displacement. */ + method: DisplacementType; + newField: string; + /** Specify maximum rows to be generated (default has no limit). */ + maxRows?: number; +} +export interface ExonSplitTransform { + type: 'exonSplit'; + separator: string; + flag: { + field: string; + value: number | string; + }; + fields: { + field: string; + type: FieldType; + newField: string; + chrField: string; + }[]; +} +/** + * Calculate genomic length using two genomic fields + */ +export interface GenomicLengthTransform { + type: 'genomicLength'; + startField: string; + endField: string; + newField: string; +} +/** + * Based on the BEDPE, infer SV types. + * SV types are specified as one of the following strings: DUP, TRA, DEL, t2tINV, h2hINV. + */ +type BpFields = { + chrField: string; + posField: string; + strandField: string; +}; +export interface SvTypeTransform { + type: 'svType'; + firstBp: BpFields; + secondBp: BpFields; + newField: string; +} +/** + * Aggregate rows and calculate coverage + */ +export interface CoverageTransform { + type: 'coverage'; + startField: string; + endField: string; + newField?: string; + /** The name of a nominal field to group rows by in prior to piling-up */ + groupField?: string; +} +/** + * Parse JSON Object Array and append vertically + */ +export interface JsonParseTransform { + type: 'subjson'; + /** The field that contains the JSON object array. */ + field: string; + /** Base genomic position when parsing relative position. */ + baseGenomicField: string; + /** Relative genomic position to parse. */ + genomicField: string; + /** Length of genomic interval. */ + genomicLengthField: string; +} +/** + * Template specification that will be internally converted into `SingleTrack` for rendering. + */ +export interface TemplateTrack extends CommonTrackDef { + template: string; + data: DataDeep; + encoding?: { + [k: string]: Channel; + }; +} +/** + * Definition of Track Templates. + */ +export interface TemplateTrackDef { + name: string; + channels: CustomChannelDef[]; + mapping: TemplateTrackMappingDef[]; +} +/** + * Definition of custom channels used in a track template. + */ +export interface CustomChannelDef { + name: string; + type: FieldType | 'value'; + required?: boolean; +} +export type DataTransformWithBase = Partial & { + base?: string; +}; +/** + * This is based on `SingleTrack` but the differences are only the type of channels + * which additionally have `base` properties to override properties from a template spec + * and remove of certain properties (e.g., `data`) + */ +export type TemplateTrackMappingDef = Omit & { + dataTransform?: DataTransformWithBase[]; + tooltip?: Tooltip[]; + mark: Mark; + x?: ChannelWithBase; + y?: ChannelWithBase; + xe?: ChannelWithBase; + ye?: ChannelWithBase; + x1?: ChannelWithBase; + y1?: ChannelWithBase; + x1e?: ChannelWithBase; + y1e?: ChannelWithBase; + row?: ChannelWithBase; + color?: ChannelWithBase; + size?: ChannelWithBase; + text?: ChannelWithBase; + stroke?: ChannelWithBase; + strokeWidth?: ChannelWithBase; + opacity?: ChannelWithBase; + displacement?: Displacement; + visibility?: VisibilityCondition[]; + flipY?: boolean; + stretch?: boolean; + overrideTemplate?: boolean; +}; +export type ChannelWithBase = Channel & { + base?: string; +}; +export {}; +//# sourceMappingURL=gosling.schema.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-schema/gosling.schema.d.ts.map b/dist/src/gosling-schema/gosling.schema.d.ts.map new file mode 100644 index 00000000..62bb6c54 --- /dev/null +++ b/dist/src/gosling-schema/gosling.schema.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gosling.schema.d.ts","sourceRoot":"","sources":["../../../src/gosling-schema/gosling.schema.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GACjB,CAAC,sBAAsB,GAAG,0BAA0B,CAAC,GACrD,CAAC,yBAAyB,GAAG,6BAA6B,CAAC,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7E,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iHAAiH;IACjH,cAAc,CAAC,EAAE,cAAc,CAAC;CACnC,CAAC;AAEF,MAAM,WAAW,yBAA0B,SAAQ,aAAa;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAA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AEtB,GAAG,CAAC,EAAE,eAAe,CAAC;IAEtB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,IAAI,CAAC,EAAE,eAAe,CAAC;IAEvB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,OAAO,CAAC,EAAE,eAAe,CAAC;IAG1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAG5B,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAInC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-schema/gosling.schema.guards.d.ts b/dist/src/gosling-schema/gosling.schema.guards.d.ts new file mode 100644 index 00000000..b7f5a759 --- /dev/null +++ b/dist/src/gosling-schema/gosling.schema.guards.d.ts @@ -0,0 +1,81 @@ +import type { ChannelDeep, ChannelValue, DataDeep, Datum, DomainChr, DomainInterval, DomainChrInterval, Style, Track, SingleTrack, OverlaidTrack, ChannelTypes, Channel, FieldType, Domain, FilterTransform, OneOfFilter, RangeFilter, IncludeFilter, BeddbData, MultivecData, MatrixData, VectorData, DataTrack, BigWigData, SingleView, FlatTracks, OverlaidTracks, StackedTracks, BamData, Range, TemplateTrack, MouseEventsDeep, DataTransform, DummyTrack } from './gosling.schema'; +import type { TabularDataFetcher } from '@data-fetchers'; +export declare const PREDEFINED_COLOR_STR_MAP: { + [k: string]: (t: number) => string; +}; +export declare function isObject(x: unknown): x is Record; +export declare function isTabularDataFetcher(dataFetcher: unknown): dataFetcher is TabularDataFetcher; +export declare function hasDataTransform(spec: SingleTrack | OverlaidTrack, type: DataTransform['type']): boolean; +/** + * This returns an array of color strings that can be assigned to HiGlass' option, `colorRange` + */ +export declare function getHiGlassColorRange(colorStr?: string, step?: number): string[]; +export declare function IsFlatTracks(_: SingleView): _ is FlatTracks; +export declare function IsOverlaidTracks(_: SingleView): _ is OverlaidTracks; +export declare function IsStackedTracks(_: SingleView): _ is StackedTracks; +export declare function IsDataTrack(_: Track): _ is DataTrack; +export declare function IsDummyTrack(_: Track): _ is DummyTrack; +export declare function IsDataTemplate(_: Partial): boolean; +export declare function IsDataDeep(data: DataDeep | Datum[]): data is DataDeep; +export declare function IsDomainFlat(domain: Domain): domain is string[] | number[]; +export declare function IsDomainChr(domain: Domain): domain is DomainChr; +export declare function IsDomainInterval(domain: Domain): domain is DomainInterval; +export declare function IsDomainChrInterval(domain: Domain): domain is DomainChrInterval; +export declare function IsTrackStyle(track: Style | undefined): track is Style; +export declare function IsSingleTrack(track: Track): track is SingleTrack; +export declare function IsOverlaidTrack(track: Partial): track is OverlaidTrack; +export declare function IsTemplateTrack(track: Partial): track is TemplateTrack; +/** + * Is this a vertical rule, i.e., y genomic axis? + */ +export declare function IsVerticalRule(track: Track): boolean; +/** + * Is this 2D track, i.e., two genomic axes? + */ +export declare function Is2DTrack(track: Track): boolean; +/** + * Do we want to use HiGlass matrix track (i.e., 'heatmap') to rendering the given visualization? + */ +export declare function IsHiGlassMatrix(track: SingleTrack): false | ChannelValue | import("./gosling.schema").Y | undefined; +export declare function IsChannelValue(channel: ChannelDeep | ChannelValue | undefined | 'none'): channel is ChannelValue; +export declare function IsDataDeepTileset(_: DataDeep | undefined): _ is BeddbData | VectorData | MultivecData | BigWigData | BamData | MatrixData; +/** + * Checks if a channel is of type ChannelDeep + */ +export declare function IsChannelDeep(channel: ChannelDeep | ChannelValue | undefined): channel is ChannelDeep; +export declare function IsOneOfFilter(_: FilterTransform): _ is OneOfFilter; +export declare function IsRangeFilter(_: FilterTransform): _ is RangeFilter; +export declare function IsIncludeFilter(_: FilterTransform): _ is IncludeFilter; +/** + * Check whether domain is in array shape. + */ +export declare function IsDomainArray(domain?: Domain): domain is string[] | number[]; +/** + * Check whether range is in array shape. + */ +export declare function IsRangeArray(range?: Range): range is string[] | number[]; +/** + * Check whether visual marks can be stacked on top of each other. + */ +export declare function IsStackedMark(track: SingleTrack): boolean; +/** + * Check whether visual marks in this channel are stacked on top of each other. + * For example, `area` marks with a `quantitative` `y` channel are being stacked. + */ +export declare function IsStackedChannel(track: SingleTrack, channelKey: keyof typeof ChannelTypes): boolean; +/** + * Retreive value using a `channel`. + * `undefined` if unable to retreive the value. + */ +export declare function getValueUsingChannel(datum: { + [k: string]: string | number; +}, channel: Channel): string | number | undefined; +export declare function getChannelKeysByAggregateFnc(spec: SingleTrack): ("x" | "y" | "xe" | "ye" | "x1" | "y1" | "x1e" | "y1e" | "row" | "color" | "size" | "text" | "stroke" | "strokeWidth" | "opacity")[]; +/** + * Get channel keys by a field type. + */ +export declare function getChannelKeysByType(spec: SingleTrack, t: FieldType): ("x" | "y" | "xe" | "ye" | "x1" | "y1" | "x1e" | "y1e" | "row" | "color" | "size" | "text" | "stroke" | "strokeWidth" | "opacity")[]; +export declare function IsXAxis(_: Track): boolean; +export declare function IsYAxis(_: Track): boolean; +export declare function IsMouseEventsDeep(_?: boolean | MouseEventsDeep): _ is MouseEventsDeep; +//# sourceMappingURL=gosling.schema.guards.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-schema/gosling.schema.guards.d.ts.map b/dist/src/gosling-schema/gosling.schema.guards.d.ts.map new file mode 100644 index 00000000..5abd4691 --- /dev/null +++ b/dist/src/gosling-schema/gosling.schema.guards.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gosling.schema.guards.d.ts","sourceRoot":"","sources":["../../../src/gosling-schema/gosling.schema.guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,KAAK,EACL,WAAW,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AAID,wBAAgB,iBAAiB,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,eAAe,GAAG,CAAC,IAAI,eAAe,CAErF"} \ No newline at end of file diff --git a/dist/src/gosling-schema/index.d.ts b/dist/src/gosling-schema/index.d.ts new file mode 100644 index 00000000..b6a7830b --- /dev/null +++ b/dist/src/gosling-schema/index.d.ts @@ -0,0 +1,6 @@ +export * from './gosling.schema'; +export * from './gosling.schema.guards'; +export * from './validate'; +export { default as ThemeSchema } from './theme.schema.json'; +export { default as GoslingSchema } from './gosling.schema.json'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-schema/index.d.ts.map b/dist/src/gosling-schema/index.d.ts.map new file mode 100644 index 00000000..281dc4d7 --- /dev/null +++ b/dist/src/gosling-schema/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gosling-schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-schema/validate.d.ts b/dist/src/gosling-schema/validate.d.ts new file mode 100644 index 00000000..e3481f5f --- /dev/null +++ b/dist/src/gosling-schema/validate.d.ts @@ -0,0 +1,26 @@ +import type { SingleTrack, ChannelDeep, OverlaidTrack, Track } from './gosling.schema'; +export interface Validity { + message: string; + state: 'success' | 'warn' | 'error'; + details?: string; +} +export declare function validateGoslingSpec(spec: any): Validity; +/** + * + */ +export declare function validateSpec(schema: any, spec: any, silence?: boolean): Validity; +export declare function validateTrack(track: Track): { + valid: boolean; + errorMessages: string[]; +}; +/** + * Find an axis channel that is encoded with genomic coordinate. + * `undefined` if not found. + */ +export declare function getGenomicChannelFromTrack(track: SingleTrack | OverlaidTrack): ChannelDeep | undefined; +/** + * Find an axis channel that is encoded with genomic coordinate and return 'x' or 'y'. + * `undefined` if not found. + */ +export declare function getGenomicChannelKeyFromTrack(track: SingleTrack | OverlaidTrack): 'x' | 'xe' | 'y' | 'ye' | 'x1' | 'y1' | 'x1e' | 'y1e' | undefined; +//# sourceMappingURL=validate.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-schema/validate.d.ts.map b/dist/src/gosling-schema/validate.d.ts.map new file mode 100644 index 00000000..a92951d3 --- /dev/null +++ b/dist/src/gosling-schema/validate.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/gosling-schema/validate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAgB,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAKrG,MAAM,WAAW,QAAQ;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,GAAG,QAAQ,CAEvD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,UAAQ,GAAG,QAAQ,CAkB9E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK;;;EAgCzC;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAUtG;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CACzC,KAAK,EAAE,WAAW,GAAG,aAAa,GACnC,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAUnE"} \ No newline at end of file diff --git a/dist/src/gosling-theme/dark.d.ts b/dist/src/gosling-theme/dark.d.ts new file mode 100644 index 00000000..bb053b70 --- /dev/null +++ b/dist/src/gosling-theme/dark.d.ts @@ -0,0 +1,3 @@ +import type { ThemeDeep } from 'src/core/utils/theme'; +export declare const dark: ThemeDeep; +//# sourceMappingURL=dark.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/dark.d.ts.map b/dist/src/gosling-theme/dark.d.ts.map new file mode 100644 index 00000000..fe2bd41f --- /dev/null +++ b/dist/src/gosling-theme/dark.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/dark.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAgBtD,eAAO,MAAM,IAAI,EAAE,SAmGlB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/ensembl.d.ts b/dist/src/gosling-theme/ensembl.d.ts new file mode 100644 index 00000000..90acf0a3 --- /dev/null +++ b/dist/src/gosling-theme/ensembl.d.ts @@ -0,0 +1,3 @@ +import type { ThemeDeep } from 'src/core/utils/theme'; +export declare const ensembl: ThemeDeep; +//# sourceMappingURL=ensembl.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/ensembl.d.ts.map b/dist/src/gosling-theme/ensembl.d.ts.map new file mode 100644 index 00000000..2aabfd58 --- /dev/null +++ b/dist/src/gosling-theme/ensembl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ensembl.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/ensembl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAwBtD,eAAO,MAAM,OAAO,EAAE,SAgKrB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/excel.d.ts b/dist/src/gosling-theme/excel.d.ts new file mode 100644 index 00000000..49d58267 --- /dev/null +++ b/dist/src/gosling-theme/excel.d.ts @@ -0,0 +1,3 @@ +import type { ThemeDeep } from 'src/core/utils/theme'; +export declare const excel: ThemeDeep; +//# sourceMappingURL=excel.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/excel.d.ts.map b/dist/src/gosling-theme/excel.d.ts.map new file mode 100644 index 00000000..1f726da7 --- /dev/null +++ b/dist/src/gosling-theme/excel.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"excel.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/excel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAyBtD,eAAO,MAAM,KAAK,EAAE,SAmGnB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/ggplot.d.ts b/dist/src/gosling-theme/ggplot.d.ts new file mode 100644 index 00000000..e8636bc3 --- /dev/null +++ b/dist/src/gosling-theme/ggplot.d.ts @@ -0,0 +1,3 @@ +import type { ThemeDeep } from 'src/core/utils/theme'; +export declare const ggplot: ThemeDeep; +//# sourceMappingURL=ggplot.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/ggplot.d.ts.map b/dist/src/gosling-theme/ggplot.d.ts.map new file mode 100644 index 00000000..e65be9cc --- /dev/null +++ b/dist/src/gosling-theme/ggplot.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ggplot.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/ggplot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,MAAM,EAAE,SAmGpB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/google.d.ts b/dist/src/gosling-theme/google.d.ts new file mode 100644 index 00000000..223a718a --- /dev/null +++ b/dist/src/gosling-theme/google.d.ts @@ -0,0 +1,3 @@ +import type { ThemeDeep } from 'src/core/utils/theme'; +export declare const google: ThemeDeep; +//# sourceMappingURL=google.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/google.d.ts.map b/dist/src/gosling-theme/google.d.ts.map new file mode 100644 index 00000000..cf1b16bc --- /dev/null +++ b/dist/src/gosling-theme/google.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/google.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,MAAM,EAAE,SAmGpB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/igv.d.ts b/dist/src/gosling-theme/igv.d.ts new file mode 100644 index 00000000..392ac7a9 --- /dev/null +++ b/dist/src/gosling-theme/igv.d.ts @@ -0,0 +1,3 @@ +import type { ThemeDeep } from 'src/core/utils/theme'; +export declare const igv: ThemeDeep; +//# sourceMappingURL=igv.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/igv.d.ts.map b/dist/src/gosling-theme/igv.d.ts.map new file mode 100644 index 00000000..701f0b65 --- /dev/null +++ b/dist/src/gosling-theme/igv.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"igv.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/igv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,GAAG,EAAE,SAoGjB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/index.d.ts b/dist/src/gosling-theme/index.d.ts new file mode 100644 index 00000000..f5f53619 --- /dev/null +++ b/dist/src/gosling-theme/index.d.ts @@ -0,0 +1,16 @@ +export declare const Themes: { + light: import("../core/utils/theme").ThemeDeep; + dark: import("../core/utils/theme").ThemeDeep; + warm: import("../core/utils/theme").ThemeDeep; + ggplot: import("../core/utils/theme").ThemeDeep; + igv: import("../core/utils/theme").ThemeDeep; + ensembl: import("../core/utils/theme").ThemeDeep; + jbrowse: import("../core/utils/theme").ThemeDeep; + ucsc: import("../core/utils/theme").ThemeDeep; + washu: import("../core/utils/theme").ThemeDeep; + excel: import("../core/utils/theme").ThemeDeep; + google: import("../core/utils/theme").ThemeDeep; +}; +export declare function isThereTheme(key: string): boolean; +export declare function getTheme(key: string): any; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/index.d.ts.map b/dist/src/gosling-theme/index.d.ts.map new file mode 100644 index 00000000..513c55a0 --- /dev/null +++ b/dist/src/gosling-theme/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/index.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,MAAM;;;;;;;;;;;;CAYlB,CAAC;AAEF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,WAEvC;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,OAEnC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/jbrowse.d.ts b/dist/src/gosling-theme/jbrowse.d.ts new file mode 100644 index 00000000..640df38b --- /dev/null +++ b/dist/src/gosling-theme/jbrowse.d.ts @@ -0,0 +1,3 @@ +import type { ThemeDeep } from 'src/core/utils/theme'; +export declare const jbrowse: ThemeDeep; +//# sourceMappingURL=jbrowse.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/jbrowse.d.ts.map b/dist/src/gosling-theme/jbrowse.d.ts.map new file mode 100644 index 00000000..e9ab5cfe --- /dev/null +++ b/dist/src/gosling-theme/jbrowse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"jbrowse.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/jbrowse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,OAAO,EAAE,SAmGrB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/light.d.ts b/dist/src/gosling-theme/light.d.ts new file mode 100644 index 00000000..47064394 --- /dev/null +++ b/dist/src/gosling-theme/light.d.ts @@ -0,0 +1,3 @@ +import type { ThemeDeep } from 'src/core/utils/theme'; +export declare const light: ThemeDeep; +//# sourceMappingURL=light.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/light.d.ts.map b/dist/src/gosling-theme/light.d.ts.map new file mode 100644 index 00000000..b82b62ae --- /dev/null +++ b/dist/src/gosling-theme/light.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/light.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,KAAK,EAAE,SAqGnB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/test.d.ts b/dist/src/gosling-theme/test.d.ts new file mode 100644 index 00000000..37265f0f --- /dev/null +++ b/dist/src/gosling-theme/test.d.ts @@ -0,0 +1,16 @@ +export declare const test: { + base: string; + root: { + background: string; + }; + axis: { + baselineColor: string; + tickColor: string; + labelColor: string; + gridColor: string; + }; + point: { + size: number; + }; +}; +//# sourceMappingURL=test.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/test.d.ts.map b/dist/src/gosling-theme/test.d.ts.map new file mode 100644 index 00000000..433e75d4 --- /dev/null +++ b/dist/src/gosling-theme/test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/test.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;CAchB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/ucsc.d.ts b/dist/src/gosling-theme/ucsc.d.ts new file mode 100644 index 00000000..38772808 --- /dev/null +++ b/dist/src/gosling-theme/ucsc.d.ts @@ -0,0 +1,3 @@ +import type { ThemeDeep } from 'src/core/utils/theme'; +export declare const ucsc: ThemeDeep; +//# sourceMappingURL=ucsc.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/ucsc.d.ts.map b/dist/src/gosling-theme/ucsc.d.ts.map new file mode 100644 index 00000000..9030febb --- /dev/null +++ b/dist/src/gosling-theme/ucsc.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ucsc.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/ucsc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA4BtD,eAAO,MAAM,IAAI,EAAE,SAmGlB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/warm.d.ts b/dist/src/gosling-theme/warm.d.ts new file mode 100644 index 00000000..1fd97810 --- /dev/null +++ b/dist/src/gosling-theme/warm.d.ts @@ -0,0 +1,3 @@ +import type { ThemeDeep } from 'src/core/utils/theme'; +export declare const warm: ThemeDeep; +//# sourceMappingURL=warm.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/warm.d.ts.map b/dist/src/gosling-theme/warm.d.ts.map new file mode 100644 index 00000000..0e1819df --- /dev/null +++ b/dist/src/gosling-theme/warm.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"warm.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/warm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,IAAI,EAAE,SA4ElB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/washu.d.ts b/dist/src/gosling-theme/washu.d.ts new file mode 100644 index 00000000..11c9abe9 --- /dev/null +++ b/dist/src/gosling-theme/washu.d.ts @@ -0,0 +1,3 @@ +import type { ThemeDeep } from 'src/core/utils/theme'; +export declare const washu: ThemeDeep; +//# sourceMappingURL=washu.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/washu.d.ts.map b/dist/src/gosling-theme/washu.d.ts.map new file mode 100644 index 00000000..7991ac9c --- /dev/null +++ b/dist/src/gosling-theme/washu.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"washu.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/washu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAuBtD,eAAO,MAAM,KAAK,EAAE,SAkGnB,CAAC"} \ No newline at end of file diff --git a/dist/src/higlass-schema/higlass.schema.d.ts b/dist/src/higlass-schema/higlass.schema.d.ts new file mode 100644 index 00000000..8fb86e9d --- /dev/null +++ b/dist/src/higlass-schema/higlass.schema.d.ts @@ -0,0 +1,148 @@ +import type { Assembly, FilterTransform } from '@gosling-lang/gosling-schema'; +export interface HiGlassSpec { + editable?: boolean; + zoomFixed?: boolean; + viewEditable?: boolean; + tracksEditable?: boolean; + compactLayout?: boolean; + trackSourceServers?: string[]; + exportViewUrl?: string; + chromInfoPath?: string; + views: View[]; + zoomLocks: GenericLocks; + locationLocks: GenericLocks; + valueScaleLocks?: ValueScaleLocks; +} +export interface View { + uid?: string; + initialXDomain?: number[]; + initialYDomain?: number[]; + zoomLimits?: [number | null, number | null]; + autocompleteSource?: string; + genomePositionSearchBox?: GenomePositionSearchBox; + genomePositionSearchBoxVisible?: boolean; + chromInfoPath?: string; + tracks: Tracks; + layout: Layout; + overlays?: Overlay[]; + selectionView?: boolean; + zoomFixed?: boolean; +} +export interface GenomePositionSearchBox { + chromInfoId: string; + chromInfoServer: string; + autocompleteId?: string; + autocompleteServer?: string; + visible?: boolean; +} +export interface Tracks { + top: Track[]; + left: Track[]; + center: Track[]; + right: Track[]; + bottom: Track[]; + gallery: Track[]; + whole: Track[]; +} +export type Track = HeatmapTrack | CombinedTrack | IndependentViewportProjectionTrack | EnumTrack; +export interface HeatmapTrack { + type: 'heatmap'; + uid?: string; + data?: Data; + server?: string; + tilesetUid?: string; + position?: string; + width?: number; + height?: number; + options?: any; +} +export interface CombinedTrack { + type: 'combined'; + contents: Track[]; + uid?: string; + width?: number; + height?: number; + position?: string; + options?: any; +} +export interface IndependentViewportProjectionTrack { + type: 'viewport-projection-horizontal' | 'viewport-projection-vertical' | 'viewport-projection-center'; + uid?: string; + fromViewUid?: null; + projectionXDomain?: number[]; + projectionYDomain?: number[]; + transforms?: any[]; + width?: number; + x?: number; + y?: number; + options?: any; +} +export interface EnumTrack { + type: EnumTrackType; + uid?: string; + server?: string; + tilesetUid?: string; + chromInfoPath?: string; + data?: Data; + fromViewUid?: null | string; + width?: number; + height?: number; + x?: number; + y?: number; + options?: any; +} +export interface Data { + type?: string; + children?: any[]; + tiles?: any; + tilesetInfo?: any; + url?: string; + assembly?: Assembly; + urlFetchOptions?: RequestInit; + indexUrl?: string; + indexUrlFetchOptions?: RequestInit; + filter?: FilterTransform[]; +} +export interface RequestInit { + headers?: Record; +} +export interface Overlay { + uid?: string; + type?: string; + chromInfoPath?: string; + includes?: any[]; + options?: OverlayOptions; +} +export interface OverlayOptions { + extent?: any[]; + fill?: string; + fillOpacity?: number; + minWidth?: number; + outline?: string; + outlineOpacity?: number; + outlinePos?: any[] | string; + outlineWidth?: number; + stroke?: string; + strokeOpacity?: number; + strokePos?: any[] | string; + strokeWidth?: number; +} +export interface Layout { + h: number; + w: number; + x: number; + y: number; +} +export interface GenericLocks { + locksByViewUid: LocksByViewUid; + locksDict: any; +} +export interface LocksByViewUid { + [k: string]: string; +} +export interface ValueScaleLocks { + locksByViewUid: LocksByViewUid; + locksDict?: any; +} +export type EnumTrackType = 'heatmap' | '2d-annotations' | '2d-chromosome-annotations' | '2d-chromosome-grid' | '2d-chromosome-labels' | '2d-rectangle-domains' | '2d-tiles' | 'arrowhead-domains' | 'bedlike' | 'cross-rule' | 'dummy' | 'horizontal-1d-annotations' | 'horizontal-1d-heatmap' | 'horizontal-1d-tiles' | 'horizontal-1d-value-interval' | 'horizontal-2d-rectangle-domains' | 'horizontal-bar' | 'horizontal-chromosome-grid' | 'horizontal-chromosome-labels' | 'horizontal-divergent-bar' | 'horizontal-gene-annotations' | 'horizontal-heatmap' | 'horizontal-line' | 'horizontal-multivec' | 'horizontal-point' | 'horizontal-rule' | 'horizontal-vector-heatmap' | 'image-tiles' | 'left-axis' | 'left-stacked-interval' | 'mapbox-tiles' | 'osm-2d-tile-ids' | 'osm-tiles' | 'raster-tiles' | 'simple-svg' | 'square-markers' | 'top-axis' | 'top-stacked-interval' | 'vertical-1d-annotations' | 'vertical-1d-heatmap' | 'vertical-1d-tiles' | 'vertical-1d-value-interval' | 'vertical-2d-rectangle-domains' | 'vertical-bar' | 'vertical-bedlike' | 'vertical-chromosome-grid' | 'vertical-chromosome-labels' | 'vertical-gene-annotations' | 'vertical-heatmap' | 'vertical-line' | 'vertical-multivec' | 'vertical-point' | 'vertical-rule' | 'vertical-vector-heatmap' | 'viewport-projection-center' | 'viewport-projection-horizontal' | 'viewport-projection-vertical' | 'gosling-track' | 'gosling-2d-track' | 'axis-track' | 'text' | 'dummy-track'; +//# sourceMappingURL=higlass.schema.d.ts.map \ No newline at end of file diff --git a/dist/src/higlass-schema/higlass.schema.d.ts.map b/dist/src/higlass-schema/higlass.schema.d.ts.map new file mode 100644 index 00000000..0e8a7436 --- /dev/null +++ b/dist/src/higlass-schema/higlass.schema.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"higlass.schema.d.ts","sourceRoot":"","sources":["../../../src/higlass-schema/higlass.schema.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAK9E,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,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ACd,YAAY,GACZ,gBAAgB,GAChB,UAAU,GACV,sBAAsB,GACtB,yBAAyB,GACzB,qBAAqB,GACrB,mBAAmB,GACnB,4BAA4B,GAC5B,+BAA+B,GAC/B,cAAc,GACd,kBAAkB,GAClB,0BAA0B,GAC1B,4BAA4B,GAC5B,2BAA2B,GAC3B,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,gBAAgB,GAChB,eAAe,GACf,yBAAyB,GACzB,4BAA4B,GAC5B,gCAAgC,GAChC,8BAA8B,GAE9B,eAAe,GACf,kBAAkB,GAClB,YAAY,GACZ,MAAM,GACN,aAAa,CAAC"} \ No newline at end of file diff --git a/dist/src/higlass-schema/index.d.ts b/dist/src/higlass-schema/index.d.ts new file mode 100644 index 00000000..3bac49a4 --- /dev/null +++ b/dist/src/higlass-schema/index.d.ts @@ -0,0 +1,3 @@ +export * from './higlass.schema'; +export { default as HiGlassSchema } from './higlass.schema.json'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/higlass-schema/index.d.ts.map b/dist/src/higlass-schema/index.d.ts.map new file mode 100644 index 00000000..cf47a642 --- /dev/null +++ b/dist/src/higlass-schema/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/higlass-schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC"} \ No newline at end of file diff --git a/dist/src/index.d.ts b/dist/src/index.d.ts new file mode 100644 index 00000000..a020c5dd --- /dev/null +++ b/dist/src/index.d.ts @@ -0,0 +1,15 @@ +export { name, version } from '../package.json'; +import { GoslingSchema, ThemeSchema } from '@gosling-lang/gosling-schema'; +export { GoslingSchema, ThemeSchema }; +export type { GoslingSpec, TemplateTrackDef } from '@gosling-lang/gosling-schema'; +export type { HiGlassSpec } from '@gosling-lang/higlass-schema'; +export { GoslingTemplates } from './core/utils/template'; +export type { Theme } from './core/utils/theme'; +export { Themes, isThereTheme, getTheme } from '@gosling-lang/gosling-theme'; +export { init } from './core/init'; +export { compile } from './compiler/compile'; +export { validateGoslingSpec } from '@gosling-lang/gosling-schema'; +export { GoslingComponent } from './core/gosling-component'; +export type { GoslingRef } from './core/gosling-component'; +export { embed } from './core/gosling-embed'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/index.d.ts.map b/dist/src/index.d.ts.map new file mode 100644 index 00000000..ca672083 --- /dev/null +++ b/dist/src/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAClF,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/dummy-track/dummy-track.d.ts b/dist/src/tracks/dummy-track/dummy-track.d.ts new file mode 100644 index 00000000..98ee8977 --- /dev/null +++ b/dist/src/tracks/dummy-track/dummy-track.d.ts @@ -0,0 +1,16 @@ +/// +import { type DummyTrackStyle } from '@gosling-lang/gosling-schema'; +interface DummyTrackOptions extends DummyTrackStyle { + title: string; + height: number; + width: number; +} +declare const _default: (new (HGC: import("@higlass/types").HGC, context: import("@higlass/tracks").Context, options: DummyTrackOptions) => import("@higlass/tracks").Track) & { + config: import("@higlass/tracks").TrackConfig; +} & { + config: { + availableOptions: (keyof DummyTrackOptions)[]; + }; +}; +export default _default; +//# sourceMappingURL=dummy-track.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/dummy-track/dummy-track.d.ts.map b/dist/src/tracks/dummy-track/dummy-track.d.ts.map new file mode 100644 index 00000000..085cea88 --- /dev/null +++ b/dist/src/tracks/dummy-track/dummy-track.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"dummy-track.d.ts","sourceRoot":"","sources":["../../../../src/tracks/dummy-track/dummy-track.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,UAAU,iBAAkB,SAAQ,eAAe;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB;;;;;;;;AA6DD,wBAAkD"} \ No newline at end of file diff --git a/dist/src/tracks/dummy-track/index.d.ts b/dist/src/tracks/dummy-track/index.d.ts new file mode 100644 index 00000000..7b38bb88 --- /dev/null +++ b/dist/src/tracks/dummy-track/index.d.ts @@ -0,0 +1,2 @@ +export { default as DummyTrack } from './dummy-track'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/dummy-track/index.d.ts.map b/dist/src/tracks/dummy-track/index.d.ts.map new file mode 100644 index 00000000..ee8f729f --- /dev/null +++ b/dist/src/tracks/dummy-track/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tracks/dummy-track/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/brush-track.d.ts b/dist/src/tracks/gosling-brush/brush-track.d.ts new file mode 100644 index 00000000..a205a2dc --- /dev/null +++ b/dist/src/tracks/gosling-brush/brush-track.d.ts @@ -0,0 +1,26 @@ +declare function BrushTrack(HGC: any, ...args: any[]): any; +declare namespace BrushTrack { + var config: { + type: string; + datatype: string[]; + local: boolean; + projection: boolean; + orientation: string; + thumbnail: HTMLElement; + availableOptions: string[]; + defaultOptions: { + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + axisPositionHorizontal: string; + projectionFillColor: string; + projectionStrokeColor: string; + projectionFillOpacity: number; + projectionStrokeOpacity: number; + strokeWidth: number; + }; + }; +} +export default BrushTrack; +//# sourceMappingURL=brush-track.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/brush-track.d.ts.map b/dist/src/tracks/gosling-brush/brush-track.d.ts.map new file mode 100644 index 00000000..f1f645ea --- /dev/null +++ b/dist/src/tracks/gosling-brush/brush-track.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"brush-track.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-brush/brush-track.ts"],"names":[],"mappings":"AAYA,iBAAS,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAwSjD;kBAxSQ,UAAU;;;;;;;;;;;;;;;;;;;;;;;AAiVnB,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/index.d.ts b/dist/src/tracks/gosling-brush/index.d.ts new file mode 100644 index 00000000..cd9f49c0 --- /dev/null +++ b/dist/src/tracks/gosling-brush/index.d.ts @@ -0,0 +1,3 @@ +export { default as BrushTrack } from './brush-track'; +export { LinearBrushModel } from './linear-brush-model'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/index.d.ts.map b/dist/src/tracks/gosling-brush/index.d.ts.map new file mode 100644 index 00000000..835fc935 --- /dev/null +++ b/dist/src/tracks/gosling-brush/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-brush/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/linear-brush-model.d.ts b/dist/src/tracks/gosling-brush/linear-brush-model.d.ts new file mode 100644 index 00000000..9076bb70 --- /dev/null +++ b/dist/src/tracks/gosling-brush/linear-brush-model.d.ts @@ -0,0 +1,50 @@ +import type * as D3Selection from 'd3-selection'; +import type { EventStyle } from '@gosling-lang/gosling-schema'; +interface LinearBrushEvents { + brush: (range: [number, number] | null, skipApiTrigger: boolean) => void; +} +/** + * A model to manage 1D brush graphics and its data. + */ +export declare class LinearBrushModel { + private brushSelection; + private readonly style; + private range; + private data; + private startEvent; + private prevExtent; + private offset; + private size; + private externals; + private emitter; + constructor(selection: D3Selection.Selection, hgLibraries: any, style?: EventStyle); + getRange(): [number, number] | null; + setSize(size: number): this; + /** + * Update the left and top offsets for drawing the brush. + */ + setOffset(offsetX: number, offsetY: number): this; + /** + * Update brush data based on the positions of two edges. + */ + updateRange(range: [number, number] | null): this; + /** + * Update the brush using the internal range value. By default, + * This function calls a render function from gosling-track. + */ + drawBrush(skipApiTrigger?: boolean): this; + enable(): this; + disable(): this; + visible(): this; + hidden(): this; + clear(): this; + remove(): this; + /** + * Based on the extent values, generate a JSON object for the brush. + */ + private rangeToData; + private onDrag; + on(event: E, callback: LinearBrushEvents[E]): void; +} +export {}; +//# sourceMappingURL=linear-brush-model.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/linear-brush-model.d.ts.map b/dist/src/tracks/gosling-brush/linear-brush-model.d.ts.map new file mode 100644 index 00000000..1f539ce2 --- /dev/null +++ b/dist/src/tracks/gosling-brush/linear-brush-model.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"linear-brush-model.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-brush/linear-brush-model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,WAAW,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAe/D,UAAU,iBAAiB;IACvB,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAAE,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5E;AAWD;;GAEG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,cAAc,CAAmF;IACzG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwC;IAG9D,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,IAAI,CAAkB;IAG9B,OAAO,CAAC,UAAU,CAAiG;IACnH,OAAO,CAAC,UAAU,CAA0B;IAG5C,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,IAAI,CAAS;IAGrB,OAAO,CAAC,SAAS,CAGf;IAEF,OAAO,CAAC,OAAO,CAA6B;gBAGxC,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,EACrE,WAAW,EAAE,GAAG,EAChB,KAAK,GAAE,UAAe;IA0BnB,QAAQ;IAIR,OAAO,CAAC,IAAI,EAAE,MAAM;IAK3B;;OAEG;IACI,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAKjD;;OAEG;IACI,WAAW,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAUjD;;;OAGG;IACI,SAAS,CAAC,cAAc,UAAQ;IAoBhC,MAAM;IAKN,OAAO;IAKP,OAAO;IAKP,MAAM;IAKN,KAAK;IAKL,MAAM;IAKb;;OAEG;IACH,OAAO,CAAC,WAAW;IAuBnB,OAAO,CAAC,MAAM;IAiCd,EAAE,CAAC,CAAC,SAAS,MAAM,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC;CAGjF"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts b/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts new file mode 100644 index 00000000..e46458a7 --- /dev/null +++ b/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts @@ -0,0 +1,40 @@ +/// +import type { TextStyle } from '../../core/utils/text-style'; +import type { Assembly } from '@gosling-lang/gosling-schema'; +type AxisTrackOptions = { + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + width: number; + height: number; + layout: 'linear' | 'circular'; + labelMargin: number; + excludeChrPrefix: boolean; + labelPosition: string; + labelColor: string; + labelTextOpacity: number; + trackBorderWidth: number; + trackBorderColor: string; + tickPositions: 'even' | 'ends'; + fontSize: number; + fontFamily: string; + fontWeight: NonNullable; + color: string; + stroke: string; + backgroundColor: string; + showMousePosition: boolean; + tickColor: number; + tickFormat?: string; + assembly?: Assembly; + reverseOrientation?: boolean; +}; +declare const _default: (new (HGC: import("@higlass/types").HGC, context: import("@higlass/tracks").Context, options: AxisTrackOptions) => import("@higlass/tracks").Track) & { + config: import("@higlass/tracks").TrackConfig; +} & { + config: { + availableOptions: (keyof AxisTrackOptions)[]; + }; +}; +export default _default; +//# sourceMappingURL=axis-track.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts.map b/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts.map new file mode 100644 index 00000000..8062b1dd --- /dev/null +++ b/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"axis-track.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-genomic-axis/axis-track.ts"],"names":[],"mappings":";AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAO7D,KAAK,gBAAgB,GAAG;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;;;;;;;;AA6tBF,wBAAkD"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-genomic-axis/index.d.ts b/dist/src/tracks/gosling-genomic-axis/index.d.ts new file mode 100644 index 00000000..e13c44d1 --- /dev/null +++ b/dist/src/tracks/gosling-genomic-axis/index.d.ts @@ -0,0 +1,3 @@ +import AxisTrack from './axis-track'; +export { AxisTrack }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-genomic-axis/index.d.ts.map b/dist/src/tracks/gosling-genomic-axis/index.d.ts.map new file mode 100644 index 00000000..61cfd841 --- /dev/null +++ b/dist/src/tracks/gosling-genomic-axis/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-genomic-axis/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/data-abstraction.d.ts b/dist/src/tracks/gosling-track/data-abstraction.d.ts new file mode 100644 index 00000000..78fd80e3 --- /dev/null +++ b/dist/src/tracks/gosling-track/data-abstraction.d.ts @@ -0,0 +1,16 @@ +import type { SparseTile, TileData } from '@higlass/services'; +import type { Datum, SingleTrack } from '@gosling-lang/gosling-schema'; +export declare const GOSLING_DATA_ROW_UID_FIELD = "gosling-data-row-uid"; +/** + * Convert genomic data formats to common tabular formats for given tile. + */ +export declare function getTabularData(spec: SingleTrack, data: TileData & { + sparse?: Array; + shape?: [number, number]; + tileX: number; + tileWidth: number; + tileSize: number; + tileY?: number; + tileHeight?: number; +}): Datum[] | undefined; +//# sourceMappingURL=data-abstraction.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/data-abstraction.d.ts.map b/dist/src/tracks/gosling-track/data-abstraction.d.ts.map new file mode 100644 index 00000000..63bf2a67 --- /dev/null +++ b/dist/src/tracks/gosling-track/data-abstraction.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"data-abstraction.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-track/data-abstraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGvE,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;AAEjE;;GAEG;AACH,wBAAgB,cAAc,CAC1B,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,QAAQ,GAAG;IACb,MAAM,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,uBA+SJ"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts b/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts new file mode 100644 index 00000000..9a425752 --- /dev/null +++ b/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts @@ -0,0 +1,3 @@ +export { type MouseEventData, MouseEventModel } from './mouse-event-model'; +export { isPointInsideDonutSlice } from './polygon'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts.map b/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts.map new file mode 100644 index 00000000..295f94cf --- /dev/null +++ b/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tracks/gosling-track/gosling-mouse-event/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts b/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts new file mode 100644 index 00000000..6b086e82 --- /dev/null +++ b/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts @@ -0,0 +1,71 @@ +import type { Datum } from '@gosling-lang/gosling-schema'; +export type MouseEventData = PointEventData | LineEventData | PolygonEventData; +interface CommonEventData { + uid: string; + value: Datum; +} +interface PointEventData extends CommonEventData { + type: 'point'; + polygon: [number, number, number]; +} +interface LineEventData extends CommonEventData { + type: 'line'; + polygon: number[]; +} +interface PolygonEventData extends CommonEventData { + type: 'polygon'; + polygon: number[]; +} +/** + * A model to manage mouse events. + */ +export declare class MouseEventModel { + private data; + constructor(); + /** + * Access the number of mouse events stored. + */ + size(): number; + /** + * Add a new mouse event that is polygon-based. + */ + addPolygonBasedEvent(value: Datum, polygon: number[]): void; + /** + * Add a new mouse event that is point-based. + */ + addPointBasedEvent(value: Datum, pointAndRadius: [number, number, number]): void; + /** + * Add a new mouse event that is line-based. + */ + addLineBasedEvent(value: Datum, path: number[]): void; + /** + * Make the data array empty. + */ + clear(): void; + /** + * Find the first event data that is within the mouse position. + */ + find(x: number, y: number, reverse?: boolean): MouseEventData | undefined; + /** + * Find all event data that is within the mouse position. + */ + findAll(x: number, y: number, reverse?: boolean): MouseEventData[]; + /** + * Find all event data that matches the id values in the source and return them. + */ + getSiblings(source: MouseEventData[], idField: string): MouseEventData[]; + /** + * Test if a mouse position is within a given object. + */ + isMouseWithin(data: MouseEventData, x: number, y: number): boolean; + /** + * Find all event data that is within the range along the x-axis. + */ + findAllWithinRange(x1: number, x2: number, reverse?: boolean): MouseEventData[]; + /** + * Test if a given object is within an 1D range. + */ + isWithinRange(data: MouseEventData, x1: number, x2: number): boolean; +} +export {}; +//# sourceMappingURL=mouse-event-model.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts.map b/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts.map new file mode 100644 index 00000000..116189f3 --- /dev/null +++ b/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mouse-event-model.d.ts","sourceRoot":"","sources":["../../../../../src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAU1D,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAE/E,UAAU,eAAe;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;CAChB;AAED,UAAU,cAAe,SAAQ,eAAe;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,UAAU,aAAc,SAAQ,eAAe;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,UAAU,gBAAiB,SAAQ,eAAe;IAC9C,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,IAAI,CAAmB;;IAM/B;;OAEG;IACI,IAAI;IAIX;;OAEG;IACI,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE;IAI3D;;OAEG;IACI,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAIhF;;OAEG;IACI,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE;IAIrD;;OAEG;IACI,KAAK;IAIZ;;OAEG;IACI,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,UAAQ;IAMjD;;OAEG;IACI,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,UAAQ;IAMpD;;OAEG;IACI,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,MAAM;IAY5D;;OAEG;IACI,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAY/D;;OAEG;IACI,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,UAAQ;IAMjE;;OAEG;IACI,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;CAUpE"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts b/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts new file mode 100644 index 00000000..c7108999 --- /dev/null +++ b/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts @@ -0,0 +1,52 @@ +/** + * @param point Tuple of the form `[x,y]` to be tested. + * @param center Tuple of the form `[x,y]` that correspond to the center of an arc. + * @param radius The inner and outer radius of the arc. + * @param angle The start and end angle the arc in the range of [0, 360]. Anticlockwise, starting from 12 o'clock. + * @returns If `true` point lies within the arc, i.e., the slice of the donut. + */ +export declare const isPointInsideDonutSlice: (point: [number, number], center: [number, number], radius: [number, number], angle: [number, number]) => boolean; +/** + * @param point Tuple of the form `[x,y]` to be tested. + * @param point2 Tuple of the form `[x,y]` to be tested. + * @param radius A radius of the second point. + * @returns If `true` point lies within the point. + */ +export declare const isPointNearPoint: (point: [number, number], point2: number[], radius?: number) => boolean; +/** + * @param range Tuple of the form `[x1,x2]` to be tested. + * @param point A value x to be tested. + * @returns If `true` point lies within the point. + */ +export declare const isPointInsideRange: (range: [number, number], x: number) => boolean; +/** + * @param range Tuple of the form `[x1,x2]` to be tested. + * @param x A value x to be tested. + * @param radius A radius of the point. + * @returns If `true` point lies within the point. + */ +export declare const isCircleWithinRange: (range: [number, number], x: number, radius?: number) => boolean; +/** + * @param point Tuple of the form `[x1,x2]` to be tested. + * @param path 1D list of vertices defining the line segments. + * @return If `true` point lies within the polygon. + */ +export declare const isAllPointsWithinRange: (range: [number, number], path: number[]) => boolean; +/** + * From: https://www.geeksforgeeks.org/minimum-distance-from-a-point-to-the-line-segment-using-vectors/ + * @param point Tuple of the form `[x,y]` to be tested. + * @param path 1D list of vertices defining the line segments. + * @param dist A threshold distance for test. + * @return If `true` point lies within the polygon. + */ +export declare const isPointNearLine: (point: [number, number], path: number[], dist?: number) => boolean; +/** + * Adopted from + * https://github.com/flekschas/utils + * https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html + * @param point Tuple of the form `[x,y]` to be tested. + * @param polygon 1D list of vertices defining the polygon. + * @return If `true` point lies within the polygon. + */ +export declare const isPointInPolygon: (point: [number, number], polygon: number[]) => boolean; +//# sourceMappingURL=polygon.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts.map b/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts.map new file mode 100644 index 00000000..e17c0bb3 --- /dev/null +++ b/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../../../src/tracks/gosling-track/gosling-mouse-event/polygon.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,CAClC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EACvB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EACxB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EACxB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,OAYJ,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAM9F,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,OAExE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAM1F,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAEjF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAqCzF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,OAiB9E,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-track-model.d.ts b/dist/src/tracks/gosling-track/gosling-track-model.d.ts new file mode 100644 index 00000000..82a0a70f --- /dev/null +++ b/dist/src/tracks/gosling-track/gosling-track-model.d.ts @@ -0,0 +1,118 @@ +import type { ChannelDeep, ChannelTypes, SingleTrack } from '@gosling-lang/gosling-schema'; +import { type ScaleLinear, type ScaleOrdinal, type ScaleBand, type ScaleSequential } from 'd3-scale'; +import type { PIXIVisualProperty } from '../../core/visual-property.schema'; +import { type CompleteThemeDeep } from '../../core/utils/theme'; +import { MouseEventModel } from '../gosling-track/gosling-mouse-event'; +export type ScaleType = ScaleLinear | ScaleOrdinal | ScaleBand | ScaleSequential | (() => string | number); +export declare class GoslingTrackModel { + private id; + private theme; + private specOriginal; + private specComplete; + private dataAggregated; + private channelScales; + private mouseEventModel; + constructor(spec: SingleTrack, data: { + [k: string]: number | string; + }[], theme: Required); + getId(): string; + originalSpec(): SingleTrack; + spec(): SingleTrack; + data(): { + [k: string]: number | string; + }[]; + getMouseEventModel(): MouseEventModel; + /** + * Fill the missing options with default values or with the values calculated based on the data. + */ + private generateCompleteSpec; + /** + * TODO: This is experimental. For bar charts, for example, additional care should be taken to correctly flip the visual marks. + * Flip the y scales when `flip` options is used. + */ + private flipRanges; + /** + * Find an axis channel that is encoded with genomic coordinate and return the key (e.g., 'x'). + * `undefined` if not found. + */ + getGenomicChannelKey(): 'x' | 'xe' | 'y' | 'ye' | 'x1' | 'x1e' | 'y1' | 'y1e' | undefined; + /** + * Find a genomic field from the track specification. + * `undefined` if not found. + */ + getGenomicChannel(): ChannelDeep | undefined; + /** + * Replace a domain with a new one in the complete spec(s) if the original spec does not define the domain. + * A domain is replaced only when the channel is bound with data (i.e., `ChannelDeep`). + */ + setChannelDomain(channelKey: keyof typeof ChannelTypes, domain: string[] | number[], force?: boolean): void; + /** + * Update default constant values by looking up other channels' scales. + */ + updateChannelValue(): void; + /** + * Get the encoded value using the scales already constructed. + */ + encodedValue(channelKey: keyof typeof ChannelTypes, value?: number | string): any; + trackVisibility(currentStage: { + zoomLevel?: number; + }): boolean; + /** + * Check whether the visual mark should be visible or not. + * Return 0 (invisible) only when the predefined condition is correct. + */ + markVisibility(datum: { + [k: string]: string | number; + }, metrics?: any): number; + /** + * + */ + visualPropertyByChannel(channelKey: keyof typeof ChannelTypes, datum?: { + [k: string]: string | number; + }): any; + /** + * Retrieve an encoded visual property of a visual mark. + */ + encodedPIXIProperty(propertyKey: PIXIVisualProperty, datum?: { + [k: string]: string | number; + }, additionalInfo?: any): any; + /** + * Set missing `range`, `domain`, and/or `value` of each channel by looking into data. + */ + addScaleMaterials(spec: SingleTrack): void; + /** + * Store the scale of individual visual channels based on the `complete` spec. + */ + generateScales(): void; + /** + * Return the scale of a visual channel. + * `undefined` if we do not have the scale. + */ + getChannelScale(channelKey: keyof typeof ChannelTypes): ScaleType; + /** + * Set a new scale for a certain channel. Usually called to replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher. + */ + setChannelScale(channelKey: keyof typeof ChannelTypes, scale: ScaleType): void; + /** + * Return whether to show y-axis. + */ + isShowYAxis(): boolean; + /** + * Return the domain of a visual channel. + * `undefined` if we do not have domain in array. + */ + getChannelDomainArray(channelKey: keyof typeof ChannelTypes): string[] | number[] | undefined; + /** + * Return the range of a visual channel. + * `undefined` if we do not have domain in array. + */ + getChannelRangeArray(channelKey: keyof typeof ChannelTypes): string[] | number[] | undefined; + /** + * Validate the original spec. + */ + validateSpec(): { + valid: boolean; + errorMessages: string[]; + }; +} +//# sourceMappingURL=gosling-track-model.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-track-model.d.ts.map b/dist/src/tracks/gosling-track/gosling-track-model.d.ts.map new file mode 100644 index 00000000..ea30bd2e --- /dev/null +++ b/dist/src/tracks/gosling-track/gosling-track-model.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gosling-track-model.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-track/gosling-track-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EAEX,YAAY,EAEZ,WAAW,EAId,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACH,KAAK,WAAW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AGG;IACI,qBAAqB,CAAC,UAAU,EAAE,MAAM,OAAO,YAAY,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS;IAKpG;;;OAGG;IACI,oBAAoB,CAAC,UAAU,EAAE,MAAM,OAAO,YAAY,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS;IAKnG;;OAEG;IACI,YAAY,IAAI;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,MAAM,EAAE,CAAA;KAAE;CAGrE"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-track.d.ts b/dist/src/tracks/gosling-track/gosling-track.d.ts new file mode 100644 index 00000000..9f511802 --- /dev/null +++ b/dist/src/tracks/gosling-track/gosling-track.d.ts @@ -0,0 +1,40 @@ +/// +import type { SingleTrack, OverlaidTrack, Datum, ValueExtent, Range } from '@gosling-lang/gosling-schema'; +import type { Tile as _Tile, TileData, TileDataBase } from '@higlass/services'; +import type { CompleteThemeDeep } from '../../core/utils/theme'; +export declare const PRINT_RENDERING_CYCLE = false; +interface GoslingTrackOptions { + /** + * Track ID specified by users + */ + id: string; + /** + * Track IDs that are superposed with this track, containing the id of this track itself + */ + siblingIds: string[]; + spec: SingleTrack | OverlaidTrack; + theme: CompleteThemeDeep; + showMousePosition?: boolean; +} +/** Tile data used in Gosling data fetchers */ +interface TabularTileData extends TileDataBase { + tabularData: Datum[]; +} +/** Mutated type of `Tile` that includes Gosling's tile data, i.e., tabular tile data */ +export interface Tile extends Omit<_Tile, 'tileData'> { + tileData: TileData | TabularTileData; +} +/** Information about the rendered color legend */ +export interface DisplayedLegend { + domain: ValueExtent; + range: Range; +} +declare const _default: (new (HGC: import("@higlass/types").HGC, context: import("@higlass/tracks").Context, options: GoslingTrackOptions) => import("@higlass/tracks").Track) & { + config: import("@higlass/tracks").TrackConfig; +} & { + config: { + availableOptions: (keyof GoslingTrackOptions)[]; + }; +}; +export default _default; +//# sourceMappingURL=gosling-track.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-track.d.ts.map b/dist/src/tracks/gosling-track/gosling-track.d.ts.map new file mode 100644 index 00000000..89cf9124 --- /dev/null +++ b/dist/src/tracks/gosling-track/gosling-track.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"gosling-track.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-track/gosling-track.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EACR,WAAW,EACX,aAAa,EACb,KAAK,EAIL,WAAW,EACX,KAAK,EACR,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAK/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAoChE,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAgB3C,UAAU,mBAAmB;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,WAAW,GAAG,aAAa,CAAC;IAClC,KAAK,EAAE,iBAAiB,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,8CAA8C;AAC9C,UAAU,eAAgB,SAAQ,YAAY;IAC1C,WAAW,EAAE,KAAK,EAAE,CAAC;CACxB;AAED,wFAAwF;AACxF,MAAM,WAAW,IAAK,SAAQ,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC;IACjD,QAAQ,EAAE,QAAQ,GAAG,eAAe,CAAC;CACxC;AAUD,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC5B,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;CAChB;;;;;;;;AA65CD,wBAAkD"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/index.d.ts b/dist/src/tracks/gosling-track/index.d.ts new file mode 100644 index 00000000..6a97cc4b --- /dev/null +++ b/dist/src/tracks/gosling-track/index.d.ts @@ -0,0 +1,2 @@ +export { default as GoslingTrack, type Tile, type DisplayedLegend } from './gosling-track'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/index.d.ts.map b/dist/src/tracks/gosling-track/index.d.ts.map new file mode 100644 index 00000000..0ceaf867 --- /dev/null +++ b/dist/src/tracks/gosling-track/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-track/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/dist/utils.js b/dist/utils.js new file mode 100644 index 00000000..3a8ccf7c --- /dev/null +++ b/dist/utils.js @@ -0,0 +1,20 @@ +import { ae, af, c, ab, ac, N, ad, s } from "./exported-utils-c80467e4.js"; +import "d3-array"; +import "generic-filehandle"; +import "pixi.js"; +import "d3-color"; +import "bezier-js"; +import "d3-scale"; +import "lodash-es"; +import "d3-scale-chromatic"; +export { + ae as _convertToFlatTracks, + af as _spreadTracksByData, + c as computeChromSizes, + ab as getChromInterval, + ac as getChromTotalSize, + N as getRelativeGenomicPosition, + ad as parseGenomicPosition, + s as sanitizeChrName +}; +//# sourceMappingURL=utils.js.map diff --git a/dist/utils.js.map b/dist/utils.js.map new file mode 100644 index 00000000..3c9735f7 --- /dev/null +++ b/dist/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"} \ No newline at end of file diff --git a/package.json b/package.json index 0689de7a..c8b3bac5 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,6 @@ "format": "eslint src/ editor/ --fix && prettier 'editor/**/*.css' --write", "schema": "node scripts/generate-schemas.mjs", "version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md", - "prepare": "echo 'dummy prepare since prepack has no dev dependencies'", - "prepack": "npm run build", "knip": "knip --config knip.config.json", "e2e": "playwright test", "preinstall": "npx only-allow pnpm" From 5cfdd971ea61f4d6d79c7d266711a470fc404be9 Mon Sep 17 00:00:00 2001 From: Michael Puehringer Date: Tue, 9 Jan 2024 09:12:46 +0100 Subject: [PATCH 3/8] Remove preinstall --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index c8b3bac5..8e435f9f 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,7 @@ "schema": "node scripts/generate-schemas.mjs", "version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md", "knip": "knip --config knip.config.json", - "e2e": "playwright test", - "preinstall": "npx only-allow pnpm" + "e2e": "playwright test" }, "peerDependencies": { "pixi.js": "^6.3.0", From 2a2e05b9bc7520556e69396d4b699da9c12f69b9 Mon Sep 17 00:00:00 2001 From: Michael Puehringer Date: Tue, 9 Jan 2024 09:15:22 +0100 Subject: [PATCH 4/8] Remove pnpm package manager --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 8e435f9f..00fdfb9b 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "main": "dist/gosling.js", "module": "dist/gosling.js", "types": "dist/src/index.d.ts", - "packageManager": "pnpm@8.6.11", "files": [ "dist" ], From 6d79edcac9e669d34648c2df775d07a688e9db25 Mon Sep 17 00:00:00 2001 From: Michael Puehringer Date: Tue, 9 Jan 2024 09:20:26 +0100 Subject: [PATCH 5/8] Remove pnpm-lock.yaml --- pnpm-lock.yaml | 7546 ------------------------------------------------ 1 file changed, 7546 deletions(-) delete mode 100644 pnpm-lock.yaml diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml deleted file mode 100644 index 04ae65c3..00000000 --- a/pnpm-lock.yaml +++ /dev/null @@ -1,7546 +0,0 @@ -lockfileVersion: '6.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -overrides: - slugid: ^3.0.0 - -dependencies: - '@gmod/bam': - specifier: ^1.1.18 - version: 1.1.18 - '@gmod/bbi': - specifier: ^3.0.1 - version: 3.0.1 - '@gmod/bed': - specifier: ^2.1.2 - version: 2.1.2 - '@gmod/gff': - specifier: ^1.3.0 - version: 1.3.0 - '@gmod/tabix': - specifier: ^1.5.6 - version: 1.5.11 - '@gmod/vcf': - specifier: ^5.0.10 - version: 5.0.10 - allotment: - specifier: ^1.19.0 - version: 1.19.3(react-dom@18.2.0)(react@18.2.0) - bezier-js: - specifier: 4.0.3 - version: 4.0.3 - buffer: - specifier: ^6.0.3 - version: 6.0.3 - css-element-queries: - specifier: ^1.2.3 - version: 1.2.3 - d3-array: - specifier: ^2.5.1 - version: 2.12.1 - d3-color: - specifier: ^2.0.0 - version: 2.0.0 - d3-dsv: - specifier: ^2.0.0 - version: 2.0.0 - d3-format: - specifier: ^3.1.0 - version: 3.1.0 - d3-scale: - specifier: ^3.2.1 - version: 3.2.1 - d3-scale-chromatic: - specifier: ^2.0.0 - version: 2.0.0 - d3-shape: - specifier: ^2.0.0 - version: 2.1.0 - events: - specifier: ^3.3.0 - version: 3.3.0 - fflate: - specifier: ^0.7.1 - version: 0.7.4 - generic-filehandle: - specifier: ^3.0.1 - version: 3.1.1 - higlass: - specifier: ^1.13.3 - version: 1.13.3(pixi.js@6.5.10)(react-dom@18.2.0)(react@18.2.0) - higlass-register: - specifier: ^0.3.0 - version: 0.3.0 - higlass-text: - specifier: ^0.1.1 - version: 0.1.6 - json-stringify-pretty-compact: - specifier: ^2.0.0 - version: 2.0.0 - jspdf: - specifier: ^2.3.1 - version: 2.5.1 - lodash-es: - specifier: ^4.17.21 - version: 4.17.21 - monaco-editor: - specifier: ^0.27.0 - version: 0.27.0 - nanoevents: - specifier: ^7.0.1 - version: 7.0.1 - pubsub-js: - specifier: ^1.9.3 - version: 1.9.4 - quick-lru: - specifier: ^6.1.1 - version: 6.1.2 - rbush: - specifier: ^3.0.1 - version: 3.0.1 - stream-browserify: - specifier: ^3.0.0 - version: 3.0.0 - threads: - specifier: ^1.6.4 - version: 1.7.0 - -devDependencies: - '@playwright/test': - specifier: ^1.39.0 - version: 1.40.1 - '@types/bezier-js': - specifier: ^4.1.0 - version: 4.1.0 - '@types/d3': - specifier: ^7.4.3 - version: 7.4.3 - '@types/d3-array': - specifier: ^3.2.1 - version: 3.2.1 - '@types/d3-color': - specifier: ^3.1.3 - version: 3.1.3 - '@types/d3-drag': - specifier: ^2.0.0 - version: 2.0.0 - '@types/d3-dsv': - specifier: ^3.0.1 - version: 3.0.1 - '@types/d3-format': - specifier: ^3.0.4 - version: 3.0.4 - '@types/d3-scale': - specifier: ^4.0.8 - version: 4.0.8 - '@types/d3-scale-chromatic': - specifier: ^3.0.3 - version: 3.0.3 - '@types/d3-selection': - specifier: ^2.0.0 - version: 2.0.0 - '@types/d3-shape': - specifier: ^3.1.6 - version: 3.1.6 - '@types/lodash-es': - specifier: ^4.17.5 - version: 4.17.5 - '@types/node': - specifier: ^18.6.2 - version: 18.6.2 - '@types/pixelmatch': - specifier: ^5.2.5 - version: 5.2.6 - '@types/pngjs': - specifier: ^6.0.3 - version: 6.0.4 - '@types/pubsub-js': - specifier: ^1.8.2 - version: 1.8.2 - '@types/rbush': - specifier: ^3.0.0 - version: 3.0.0 - '@types/react': - specifier: ^18.2.0 - version: 18.2.0 - '@types/react-dom': - specifier: ^18.2.0 - version: 18.2.0 - '@types/react-resize-detector': - specifier: ^4.2.0 - version: 4.2.0 - '@types/react-router-dom': - specifier: ^5.1.6 - version: 5.3.3 - '@typescript-eslint/eslint-plugin': - specifier: ^5.56.0 - version: 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.19.0)(typescript@5.0.2) - '@typescript-eslint/parser': - specifier: ^5.56.0 - version: 5.62.0(eslint@8.19.0)(typescript@5.0.2) - '@vitejs/plugin-react': - specifier: ^4.1.0 - version: 4.1.0(vite@4.4.11) - '@vitest/coverage-v8': - specifier: ^0.34.6 - version: 0.34.6(vitest@0.34.6) - ajv: - specifier: ^6.12.2 - version: 6.12.6 - c8: - specifier: ^7.11.2 - version: 7.14.0 - conventional-changelog-cli: - specifier: ^2.1.1 - version: 2.2.2 - d3-drag: - specifier: ^2.0.0 - version: 2.0.0 - d3-selection: - specifier: ^2.0.0 - version: 2.0.0 - esbuild: - specifier: ^0.12.25 - version: 0.12.29 - eslint: - specifier: ^8.19.0 - version: 8.19.0 - eslint-config-prettier: - specifier: ^8.5.0 - version: 8.10.0(eslint@8.19.0) - eslint-plugin-jsx-a11y: - specifier: ^6.7.1 - version: 6.7.1(eslint@8.19.0) - eslint-plugin-prettier: - specifier: ^4.2.1 - version: 4.2.1(eslint-config-prettier@8.10.0)(eslint@8.19.0)(prettier@2.8.8) - eslint-plugin-react: - specifier: ^7.30.1 - version: 7.33.2(eslint@8.19.0) - fetch-jsonp: - specifier: ^1.1.3 - version: 1.3.0 - jsdom: - specifier: ^19.0.0 - version: 19.0.0 - jsoncrush: - specifier: ^1.1.6 - version: 1.1.8 - knip: - specifier: ^2.30.0 - version: 2.30.0 - npm-run-all: - specifier: ^4.1.5 - version: 4.1.5 - pixelmatch: - specifier: ^5.3.0 - version: 5.3.0 - pixi.js: - specifier: ^6.3.0 - version: 6.5.10 - pngjs: - specifier: ^7.0.0 - version: 7.0.0 - prettier: - specifier: ^2.0.5 - version: 2.8.8 - react: - specifier: ^18.2.0 - version: 18.2.0 - react-dom: - specifier: ^18.2.0 - version: 18.2.0(react@18.2.0) - react-markdown: - specifier: ^5.0.3 - version: 5.0.3(@types/react@18.2.0)(react@18.2.0) - react-monaco-editor: - specifier: ^0.45.0 - version: 0.45.0(@types/react@18.2.0)(react@18.2.0) - react-resize-detector: - specifier: ^4.2.3 - version: 4.2.3(react-dom@18.2.0)(react@18.2.0) - react-router-dom: - specifier: ^5.2.0 - version: 5.3.4(react@18.2.0) - remark-gfm: - specifier: ^1.0.0 - version: 1.0.0 - safe-stable-stringify: - specifier: ^2.4.3 - version: 2.4.3 - strip-json-comments: - specifier: ^3.1.1 - version: 3.1.1 - ts-json-schema-generator: - specifier: ^1.0.0 - version: 1.0.0 - typescript: - specifier: ^5.0.2 - version: 5.0.2 - vite: - specifier: ^4.4.11 - version: 4.4.11(@types/node@18.6.2) - vitest: - specifier: ^0.34.6 - version: 0.34.6(jsdom@19.0.0) - vitest-canvas-mock: - specifier: ^0.3.3 - version: 0.3.3(vitest@0.34.6) - -packages: - - /@aashutoshrathi/word-wrap@1.2.6: - resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==} - engines: {node: '>=0.10.0'} - dev: true - - /@ampproject/remapping@2.2.1: - resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==} - engines: {node: '>=6.0.0'} - dependencies: - '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.20 - dev: true - - /@babel/code-frame@7.23.5: - resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/highlight': 7.23.4 - chalk: 2.4.2 - dev: true - - /@babel/compat-data@7.23.5: - resolution: {integrity: sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/core@7.23.5: - resolution: {integrity: sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g==} - engines: {node: '>=6.9.0'} - dependencies: - '@ampproject/remapping': 2.2.1 - '@babel/code-frame': 7.23.5 - '@babel/generator': 7.23.5 - '@babel/helper-compilation-targets': 7.22.15 - '@babel/helper-module-transforms': 7.23.3(@babel/core@7.23.5) - '@babel/helpers': 7.23.5 - '@babel/parser': 7.23.5 - '@babel/template': 7.22.15 - '@babel/traverse': 7.23.5 - '@babel/types': 7.23.5 - convert-source-map: 2.0.0 - debug: 4.3.4 - gensync: 1.0.0-beta.2 - json5: 2.2.3 - semver: 6.3.1 - transitivePeerDependencies: - - supports-color - dev: true - - /@babel/generator@7.23.5: - resolution: {integrity: sha512-BPssCHrBD+0YrxviOa3QzpqwhNIXKEtOa2jQrm4FlmkC2apYgRnQcmPWiGZDlGxiNtltnUFolMe8497Esry+jA==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - '@jridgewell/gen-mapping': 0.3.3 - '@jridgewell/trace-mapping': 0.3.20 - jsesc: 2.5.2 - dev: true - - /@babel/helper-compilation-targets@7.22.15: - resolution: {integrity: sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/compat-data': 7.23.5 - '@babel/helper-validator-option': 7.23.5 - browserslist: 4.22.2 - lru-cache: 5.1.1 - semver: 6.3.1 - dev: true - - /@babel/helper-environment-visitor@7.22.20: - resolution: {integrity: sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/helper-function-name@7.23.0: - resolution: {integrity: sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/template': 7.22.15 - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-hoist-variables@7.22.5: - resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-module-imports@7.22.15: - resolution: {integrity: sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-module-transforms@7.23.3(@babel/core@7.23.5): - resolution: {integrity: sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - dependencies: - '@babel/core': 7.23.5 - '@babel/helper-environment-visitor': 7.22.20 - '@babel/helper-module-imports': 7.22.15 - '@babel/helper-simple-access': 7.22.5 - '@babel/helper-split-export-declaration': 7.22.6 - '@babel/helper-validator-identifier': 7.22.20 - dev: true - - /@babel/helper-plugin-utils@7.22.5: - resolution: {integrity: sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/helper-simple-access@7.22.5: - resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-split-export-declaration@7.22.6: - resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/helper-string-parser@7.23.4: - resolution: {integrity: sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/helper-validator-identifier@7.22.20: - resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/helper-validator-option@7.23.5: - resolution: {integrity: sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==} - engines: {node: '>=6.9.0'} - dev: true - - /@babel/helpers@7.23.5: - resolution: {integrity: sha512-oO7us8FzTEsG3U6ag9MfdF1iA/7Z6dz+MtFhifZk8C8o453rGJFFWUP1t+ULM9TUIAzC9uxXEiXjOiVMyd7QPg==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/template': 7.22.15 - '@babel/traverse': 7.23.5 - '@babel/types': 7.23.5 - transitivePeerDependencies: - - supports-color - dev: true - - /@babel/highlight@7.23.4: - resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/helper-validator-identifier': 7.22.20 - chalk: 2.4.2 - js-tokens: 4.0.0 - dev: true - - /@babel/parser@7.23.5: - resolution: {integrity: sha512-hOOqoiNXrmGdFbhgCzu6GiURxUgM27Xwd/aPuu8RfHEZPBzL1Z54okAHAQjXfcQNwvrlkAmAp4SlRTZ45vlthQ==} - engines: {node: '>=6.0.0'} - hasBin: true - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@babel/plugin-transform-react-jsx-self@7.23.3(@babel/core@7.23.5): - resolution: {integrity: sha512-qXRvbeKDSfwnlJnanVRp0SfuWE5DQhwQr5xtLBzp56Wabyo+4CMosF6Kfp+eOD/4FYpql64XVJ2W0pVLlJZxOQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.23.5 - '@babel/helper-plugin-utils': 7.22.5 - dev: true - - /@babel/plugin-transform-react-jsx-source@7.23.3(@babel/core@7.23.5): - resolution: {integrity: sha512-91RS0MDnAWDNvGC6Wio5XYkyWI39FMFO+JK9+4AlgaTH+yWwVTsw7/sn6LK0lH7c5F+TFkpv/3LfCJ1Ydwof/g==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - dependencies: - '@babel/core': 7.23.5 - '@babel/helper-plugin-utils': 7.22.5 - dev: true - - /@babel/runtime@7.23.5: - resolution: {integrity: sha512-NdUTHcPe4C99WxPub+K9l9tK5/lV4UXIoaHSYgzco9BCyjKAAwzdBI+wWtYqHt7LJdbo74ZjRPJgzVweq1sz0w==} - engines: {node: '>=6.9.0'} - dependencies: - regenerator-runtime: 0.14.0 - - /@babel/template@7.22.15: - resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/code-frame': 7.23.5 - '@babel/parser': 7.23.5 - '@babel/types': 7.23.5 - dev: true - - /@babel/traverse@7.23.5: - resolution: {integrity: sha512-czx7Xy5a6sapWWRx61m1Ke1Ra4vczu1mCTtJam5zRTBOonfdJ+S/B6HYmGYu3fJtr8GGET3si6IhgWVBhJ/m8w==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/code-frame': 7.23.5 - '@babel/generator': 7.23.5 - '@babel/helper-environment-visitor': 7.22.20 - '@babel/helper-function-name': 7.23.0 - '@babel/helper-hoist-variables': 7.22.5 - '@babel/helper-split-export-declaration': 7.22.6 - '@babel/parser': 7.23.5 - '@babel/types': 7.23.5 - debug: 4.3.4 - globals: 11.12.0 - transitivePeerDependencies: - - supports-color - dev: true - - /@babel/types@7.23.5: - resolution: {integrity: sha512-ON5kSOJwVO6xXVRTvOI0eOnWe7VdUcIpsovGo9U/Br4Ie4UVFQTboO2cYnDhAGU6Fp+UxSiT+pMft0SMHfuq6w==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/helper-string-parser': 7.23.4 - '@babel/helper-validator-identifier': 7.22.20 - to-fast-properties: 2.0.0 - dev: true - - /@bcoe/v8-coverage@0.2.3: - resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} - dev: true - - /@ericcornelissen/bash-parser@0.5.2: - resolution: {integrity: sha512-4pIMTa1nEFfMXitv7oaNEWOdM+zpOZavesa5GaiWTgda6Zk32CFGxjUp/iIaN0PwgUW1yTq/fztSjbpE8SLGZQ==} - engines: {node: '>=4'} - dependencies: - array-last: 1.3.0 - babylon: 6.18.0 - compose-function: 3.0.3 - deep-freeze: 0.0.1 - filter-iterator: 0.0.1 - filter-obj: 1.1.0 - has-own-property: 0.1.0 - identity-function: 1.0.0 - is-iterable: 1.1.1 - iterable-lookahead: 1.0.0 - lodash.curry: 4.1.1 - magic-string: 0.16.0 - map-obj: 2.0.0 - object-pairs: 0.1.0 - object-values: 1.0.0 - reverse-arguments: 1.0.0 - shell-quote-word: 1.0.1 - to-pascal-case: 1.0.0 - unescape-js: 1.1.4 - dev: true - - /@esbuild/android-arm64@0.18.20: - resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} - engines: {node: '>=12'} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/android-arm@0.18.20: - resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} - engines: {node: '>=12'} - cpu: [arm] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/android-x64@0.18.20: - resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@esbuild/darwin-arm64@0.18.20: - resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@esbuild/darwin-x64@0.18.20: - resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@esbuild/freebsd-arm64@0.18.20: - resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/freebsd-x64@0.18.20: - resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-arm64@0.18.20: - resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-arm@0.18.20: - resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-ia32@0.18.20: - resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-loong64@0.18.20: - resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} - engines: {node: '>=12'} - cpu: [loong64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-mips64el@0.18.20: - resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-ppc64@0.18.20: - resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-riscv64@0.18.20: - resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-s390x@0.18.20: - resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/linux-x64@0.18.20: - resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/netbsd-x64@0.18.20: - resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/openbsd-x64@0.18.20: - resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/sunos-x64@0.18.20: - resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-arm64@0.18.20: - resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-ia32@0.18.20: - resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@esbuild/win32-x64@0.18.20: - resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@eslint-community/eslint-utils@4.4.0(eslint@8.19.0): - resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - dependencies: - eslint: 8.19.0 - eslint-visitor-keys: 3.4.3 - dev: true - - /@eslint-community/regexpp@4.10.0: - resolution: {integrity: sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==} - engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - dev: true - - /@eslint/eslintrc@1.4.1: - resolution: {integrity: sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - ajv: 6.12.6 - debug: 4.3.4 - espree: 9.6.1 - globals: 13.23.0 - ignore: 5.3.0 - import-fresh: 3.3.0 - js-yaml: 4.1.0 - minimatch: 3.1.2 - strip-json-comments: 3.1.1 - transitivePeerDependencies: - - supports-color - dev: true - - /@gmod/bam@1.1.18: - resolution: {integrity: sha512-2Sn4zLV7DKYyrmYbNJRMchKGfhfIVm6LZEl2h7MSuGmAEtGfa1RBVOfG8Cu6VDC+lIFrgS4ys4vUFFxaWaxgSQ==} - engines: {node: '>=6'} - dependencies: - '@gmod/bgzf-filehandle': 1.4.7 - abortable-promise-cache: 1.5.0 - buffer-crc32: 0.2.13 - cross-fetch: 3.1.8 - generic-filehandle: 3.1.1 - long: 4.0.0 - object.entries-ponyfill: 1.0.1 - quick-lru: 2.0.0 - transitivePeerDependencies: - - encoding - dev: false - - /@gmod/bbi@3.0.1: - resolution: {integrity: sha512-DjvRj/qPPWBSjEjgVsadQmmWBK+EmtYr9xLZ4y7IsnuuHiE+sDgbnSA51OKiKNGLM3srydq22pynNLqswB1XjQ==} - engines: {node: '>=6'} - dependencies: - abortable-promise-cache: 1.5.0 - binary-parser: 2.2.1 - generic-filehandle: 3.1.1 - pako: 2.1.0 - quick-lru: 4.0.1 - rxjs: 7.8.1 - dev: false - - /@gmod/bed@2.1.2: - resolution: {integrity: sha512-LnCmA+jb0xfbSWO7isi1dVvqbQi8Icqaj8FeUcnCc8t4jiNe1eFoe1YU8Chn7a8EDGFqS06kMNpO1vodO+q4IA==} - engines: {node: '>=6'} - dev: false - - /@gmod/bgzf-filehandle@1.4.7: - resolution: {integrity: sha512-f/oXwWwsBe4nYN82mQ+Sz++/zH6EOyBCRqxFdv04SBkreQvilf3cql6F8ZAMMBq1f/abzBc0U0zJIMF9CLM7QQ==} - engines: {node: '>=6'} - dependencies: - es6-promisify: 7.0.0 - generic-filehandle: 3.1.1 - long: 4.0.0 - pako: 1.0.11 - dev: false - - /@gmod/gff@1.3.0: - resolution: {integrity: sha512-OjEnQLR6iIcrau603blFfUkmnWGDVfOu/LQoJNa7TsvKnjWlHYPlvqb5h2IV7wI+zElDY648mQ9zrElt2uR80A==} - hasBin: true - dependencies: - stream-browserify: 3.0.0 - dev: false - - /@gmod/tabix@1.5.11: - resolution: {integrity: sha512-zYgivq8r9pSwNKbzAqHSSfRQ3KEe+oiTNhABJIW9kBqjiKW4m7ncqKhhcmxjG4afhJNUzBJ9Gt/w3grbG+Q5bA==} - engines: {node: '>=6'} - dependencies: - '@gmod/bgzf-filehandle': 1.4.7 - abortable-promise-cache: 1.5.0 - generic-filehandle: 3.1.1 - long: 4.0.0 - quick-lru: 4.0.1 - dev: false - - /@gmod/vcf@5.0.10: - resolution: {integrity: sha512-o7QuPcOeXlJpzwQaFmgojhNvJE4yB9fhrfVEDKpkDjV27pAqwMy89367vtXu4JfBFE9t4zZ6sQRkqYaJ+cIheg==} - engines: {node: '>=6'} - dev: false - - /@humanwhocodes/config-array@0.9.5: - resolution: {integrity: sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==} - engines: {node: '>=10.10.0'} - dependencies: - '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.4 - minimatch: 3.1.2 - transitivePeerDependencies: - - supports-color - dev: true - - /@humanwhocodes/object-schema@1.2.1: - resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} - dev: true - - /@hutson/parse-repository-url@3.0.2: - resolution: {integrity: sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==} - engines: {node: '>=6.9.0'} - dev: true - - /@icons/material@0.2.4(react@18.2.0): - resolution: {integrity: sha512-QPcGmICAPbGLGb6F/yNf/KzKqvFx8z5qx3D1yFqVAjoFmXK35EgyW+cJ57Te3CNsmzblwtzakLGFqHPqrfb4Tw==} - peerDependencies: - react: '*' - dependencies: - react: 18.2.0 - dev: false - - /@isaacs/cliui@8.0.2: - resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} - engines: {node: '>=12'} - dependencies: - string-width: 5.1.2 - string-width-cjs: /string-width@4.2.3 - strip-ansi: 7.1.0 - strip-ansi-cjs: /strip-ansi@6.0.1 - wrap-ansi: 8.1.0 - wrap-ansi-cjs: /wrap-ansi@7.0.0 - dev: true - - /@istanbuljs/schema@0.1.3: - resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} - engines: {node: '>=8'} - dev: true - - /@jest/schemas@29.6.3: - resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@sinclair/typebox': 0.27.8 - dev: true - - /@jridgewell/gen-mapping@0.3.3: - resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} - engines: {node: '>=6.0.0'} - dependencies: - '@jridgewell/set-array': 1.1.2 - '@jridgewell/sourcemap-codec': 1.4.15 - '@jridgewell/trace-mapping': 0.3.20 - dev: true - - /@jridgewell/resolve-uri@3.1.1: - resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} - engines: {node: '>=6.0.0'} - dev: true - - /@jridgewell/set-array@1.1.2: - resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} - engines: {node: '>=6.0.0'} - dev: true - - /@jridgewell/sourcemap-codec@1.4.15: - resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} - dev: true - - /@jridgewell/trace-mapping@0.3.20: - resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} - dependencies: - '@jridgewell/resolve-uri': 3.1.1 - '@jridgewell/sourcemap-codec': 1.4.15 - dev: true - - /@juggle/resize-observer@3.4.0: - resolution: {integrity: sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==} - dev: false - - /@nodelib/fs.scandir@2.1.5: - resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} - engines: {node: '>= 8'} - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - dev: true - - /@nodelib/fs.stat@2.0.5: - resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} - engines: {node: '>= 8'} - dev: true - - /@nodelib/fs.walk@1.2.8: - resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} - engines: {node: '>= 8'} - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.15.0 - dev: true - - /@npmcli/map-workspaces@3.0.4: - resolution: {integrity: sha512-Z0TbvXkRbacjFFLpVpV0e2mheCh+WzQpcqL+4xp49uNJOxOnIAPZyXtUxZ5Qn3QBTGKA11Exjd9a5411rBrhDg==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - dependencies: - '@npmcli/name-from-folder': 2.0.0 - glob: 10.3.10 - minimatch: 9.0.3 - read-package-json-fast: 3.0.2 - dev: true - - /@npmcli/name-from-folder@2.0.0: - resolution: {integrity: sha512-pwK+BfEBZJbKdNYpHHRTNBwBoqrN/iIMO0AiGvYsp3Hoaq0WbgGSWQR6SCldZovoDpY3yje5lkFUe6gsDgJ2vg==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - dev: true - - /@pixi/accessibility@6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-URrI1H+1kjjHSyhY1QXcUZ8S3omdVTrXg5y0gndtpOhIelErBTC9NWjJfw6s0Rlmv5+x5VAitQTgw9mRiatDgw==} - peerDependencies: - '@pixi/core': 6.5.10 - '@pixi/display': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/app@6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-VsNHLajZ5Dbc/Zrj7iWmIl3eu6Fec+afjW/NXXezD8Sp3nTDF0bv5F+GDgN/zSc2gqIvPHyundImT7hQGBDghg==} - peerDependencies: - '@pixi/core': 6.5.10 - '@pixi/display': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/compressed-textures@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/loaders@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-41NT5mkfam47DrkB8xMp3HUZDt7139JMB6rVNOmb3u2vm+2mdy9tzi5s9nN7bG9xgXlchxcFzytTURk+jwXVJA==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/loaders': 6.5.10 - '@pixi/settings': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/loaders': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/utils@6.5.10) - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/constants@6.5.10: - resolution: {integrity: sha512-PUF2Y9YISRu5eVrVVHhHCWpc/KmxQTg3UH8rIUs8UI9dCK41/wsPd3pEahzf7H47v7x1HCohVZcFO3XQc1bUDw==} - - /@pixi/core@6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-Gdzp5ENypyglvsh5Gv3teUZnZnmizo4xOsL+QqmWALdFlJXJwLJMVhKVThV/q/095XR6i4Ou54oshn+m4EkuFw==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/extensions': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/runner': 6.5.10 - '@pixi/settings': 6.5.10 - '@pixi/ticker': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/extensions': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/runner': 6.5.10 - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - '@pixi/ticker': 6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - '@types/offscreencanvas': 2019.7.3 - - /@pixi/display@6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-NxFdDDxlbH5fQkzGHraLGoTMucW9pVgXqQm13TSmkA3NWIi/SItHL4qT2SI8nmclT9Vid1VDEBCJFAbdeuQw1Q==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/settings': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/extensions@6.5.10: - resolution: {integrity: sha512-EIUGza+E+sCy3dupuIjvRK/WyVyfSzHb5XsxRaxNrPwvG1iIUIqNqZ3owLYCo4h17fJWrj/yXVufNNtUKQccWQ==} - - /@pixi/extract@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-hXFIc4EGs14GFfXAjT1+6mzopzCMWeXeai38/Yod3vuBXkkp8+ksen6kE09vTnB9l1IpcIaCM+XZEokuqoGX2A==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/filter-alpha@6.5.10(@pixi/core@6.5.10): - resolution: {integrity: sha512-GWHLJvY0QOIDRjVx0hdUff6nl/PePQg84i8XXPmANrvA+gJ/eSRTQRmQcdgInQfawENADB/oRqpcCct6IAcKpQ==} - peerDependencies: - '@pixi/core': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - - /@pixi/filter-blur@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/settings@6.5.10): - resolution: {integrity: sha512-LJsRocVOdM9hTzZKjP+jmkfoL1nrJi5XpR0ItgRN8fflOC7A7Ln4iPe7nukbbq3H7QhZSunbygMubbO6xhThZw==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/settings': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - - /@pixi/filter-color-matrix@6.5.10(@pixi/core@6.5.10): - resolution: {integrity: sha512-C2S44/EoWTrhqedLWOZTq9GZV5loEq1+MhyK9AUzEubWGMHhou1Juhn2mRZ7R6flKPCRQNKrXpStUwCAouud3Q==} - peerDependencies: - '@pixi/core': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - - /@pixi/filter-displacement@6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10): - resolution: {integrity: sha512-fbblMYyPX/hO3Tpoaa4tOBYxqp4TxjNrz6xyt15tKSVxWQElk+Tx98GJ+aaBoiHOKt8ezzHplStWoHG++JIv/w==} - peerDependencies: - '@pixi/core': 6.5.10 - '@pixi/math': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - - /@pixi/filter-fxaa@6.5.10(@pixi/core@6.5.10): - resolution: {integrity: sha512-wbHL9UtY3g7jTyvO8JaZks6DqV8AO5c96Hfu0zfndWBPs79Ul6/sq3LD2eE+yq5vK5T2R9Sr4s54ls1JT3Sppg==} - peerDependencies: - '@pixi/core': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - - /@pixi/filter-noise@6.5.10(@pixi/core@6.5.10): - resolution: {integrity: sha512-CX+/06NVaw3HsjipZVb7aemkca0TC8I6qfKI4lx2ugxS/6G6zkY5zqd8+nVSXW4DpUXB6eT0emwfRv6N00NvuA==} - peerDependencies: - '@pixi/core': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - - /@pixi/graphics@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-KPHGJ910fi8bRQQ+VcTIgrK+bKIm8yAQaZKPqMtm14HzHPGcES6HkgeNY1sd7m8J4aS9btm5wOSyFu0p5IzTpA==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/display': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/sprite': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/interaction@6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-v809pJmXA2B9dV/vdrDMUqJT+fBB/ARZli2YRmI2dPbEbkaYr8FNmxCAJnwT8o+ymTx044Ie820hn9tVrtMtfA==} - peerDependencies: - '@pixi/core': 6.5.10 - '@pixi/display': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/ticker': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/ticker': 6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/loaders@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-AuK7mXBmyVsDFL9DDFPB8sqP8fwQ2NOktvu98bQuJl0/p/UeK/0OAQnF3wcf3FeBv5YGXfNHL21c2DCisjKfTg==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/math@6.5.10: - resolution: {integrity: sha512-fxeu7ykVbMGxGV2S3qRTupHToeo1hdWBm8ihyURn3BMqJZe2SkZEECPd5RyvIuuNUtjRnmhkZRnF3Jsz2S+L0g==} - - /@pixi/mesh-extras@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/mesh@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-UCG7OOPPFeikrX09haCibCMR0jPQ4UJ+4HiYiAv/3dahq5eEzBx+yAwVtxcVCjonkTf/lu5SzmHdzpsbHLx5aw==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/mesh': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/mesh': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/mesh@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-tUNPsdp5/t/yRsCmfxIcufIfbQVzgAlMNgQ1igWOkSxzhB7vlEbZ8ZLLW5tQcNyM/r7Nhjz+RoB+RD+/BCtvlA==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/display': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/settings': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/mixin-cache-as-bitmap@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-HV4qPZt8R7uuPZf1XE5S0e3jbN4+/EqgAIkueIyK3Em+0IO1rCmIbzzYxFPxkElMUu5VvN1r4hXK846z9ITnhw==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/display': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/settings': 6.5.10 - '@pixi/sprite': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/mixin-get-child-by-name@6.5.10(@pixi/display@6.5.10): - resolution: {integrity: sha512-YYd9wjnI/4aKY0H5Ij413UppVZn3YE1No2CZrNevV6WbhylsJucowY3hJihtl9mxkpwtaUIyWMjmphkbOinbzA==} - peerDependencies: - '@pixi/display': 6.5.10 - dependencies: - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - - /@pixi/mixin-get-global-position@6.5.10(@pixi/display@6.5.10)(@pixi/math@6.5.10): - resolution: {integrity: sha512-A83gTZP9CdQAyrAvOZl1P707Q0QvIC0V8UnBAMd4GxuhMOXJtXVPCdmfPVXUrfoywgnH+/Bgimq5xhsXTf8Hzg==} - peerDependencies: - '@pixi/display': 6.5.10 - '@pixi/math': 6.5.10 - dependencies: - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - - /@pixi/particle-container@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-CCNAdYGzKoOc3FtK2kyWCNjygdHppeOEqqK189yhg3yRSsvby+HMms/cM6bLK/4Vf6mFoAy1na3w/oXpqTR2Ag==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/display': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/sprite': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/polyfill@6.5.10: - resolution: {integrity: sha512-KDTWyr285VvPM8GGTVIZAhmxGrOlTznUGK/9kWS3GtrogwLWn41S/86Yej1gYvotVyUomCcOok33Jzahb+vX1w==} - dependencies: - object-assign: 4.1.1 - promise-polyfill: 8.3.0 - - /@pixi/prepare@6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/graphics@6.5.10)(@pixi/settings@6.5.10)(@pixi/text@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-PHMApz/GPg7IX/7+2S98criN2+Mp+fgiKpojV9cnl0SlW2zMxfAHBBi8zik9rHBgjx8X6d6bR0MG1rPtb6vSxQ==} - peerDependencies: - '@pixi/core': 6.5.10 - '@pixi/display': 6.5.10 - '@pixi/graphics': 6.5.10 - '@pixi/settings': 6.5.10 - '@pixi/text': 6.5.10 - '@pixi/ticker': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/graphics': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - '@pixi/text': 6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) - '@pixi/ticker': 6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/runner@6.5.10: - resolution: {integrity: sha512-4HiHp6diCmigJT/DSbnqQP62OfWKmZB7zPWMdV1AEdr4YT1QxzXAW1wHg7dkoEfyTHqZKl0tm/zcqKq/iH7tMA==} - - /@pixi/settings@6.5.10(@pixi/constants@6.5.10): - resolution: {integrity: sha512-ypAS5L7pQ2Qb88yQK72bXtc7sD8OrtLWNXdZ/gnw5kwSWCFaOSoqhKqJCXrR5DQtN98+RQefwbEAmMvqobhFyw==} - peerDependencies: - '@pixi/constants': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - - /@pixi/sprite-animated@6.5.10(@pixi/core@6.5.10)(@pixi/sprite@6.5.10)(@pixi/ticker@6.5.10): - resolution: {integrity: sha512-x1kayucAqpVbNk+j+diC/7sQGQsAl6NCH1J2/EEaiQjlV3GOx1MXS9Tft1N1Y1y7otbg1XsnBd60/Yzcp05pxA==} - peerDependencies: - '@pixi/core': 6.5.10 - '@pixi/sprite': 6.5.10 - '@pixi/ticker': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/ticker': 6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/sprite-tiling@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-lDFcPuwExrdJhli+WmjPivChjeCG6NiRl36iQ8n2zVi/MYVv9qfKCA6IdU7HBWk1AZdsg6KUTpwfmVLUI+qz3w==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/display': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/sprite': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/sprite@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-UiK+8LgM9XQ/SBDKjRgZ8WggdOSlFRXqiWjEZVmNkiyU8HvXeFzWPRhpc8RR1zDwAUhZWKtMhF8X/ba9m+z2lg==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/display': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/settings': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/spritesheet@6.5.10(@pixi/core@6.5.10)(@pixi/loaders@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-7uOZ1cYyYtPb0ZEgXV1SZ8ujtluZNY0TL5z3+Qc8cgGGZK/MaWG7N6Wf+uR4BR2x8FLNwcyN5IjbQDKCpblrmg==} - peerDependencies: - '@pixi/core': 6.5.10 - '@pixi/loaders': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/loaders': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/text-bitmap@6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/loaders@6.5.10)(@pixi/math@6.5.10)(@pixi/mesh@6.5.10)(@pixi/settings@6.5.10)(@pixi/text@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-g/iFIMGp6Pfi0BvX6Ykp48Z6JXVgKOrc7UCIR9CM21wYcCiQGqtdFwstV236xk6/D8NToUtSOcifhtQ28dVTdQ==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10 - '@pixi/display': 6.5.10 - '@pixi/loaders': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/mesh': 6.5.10 - '@pixi/settings': 6.5.10 - '@pixi/text': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/loaders': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/mesh': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - '@pixi/text': 6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/text@6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10): - resolution: {integrity: sha512-ikwkonLJ+6QmEVW8Ji9fS5CjrKNbU4mHzYuwRQas/VJQuSWgd0myCcaw6ZbF1oSfQe70HgbNOR0sH8Q3Com0qg==} - peerDependencies: - '@pixi/core': 6.5.10 - '@pixi/math': 6.5.10 - '@pixi/settings': 6.5.10 - '@pixi/sprite': 6.5.10 - '@pixi/utils': 6.5.10 - dependencies: - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /@pixi/ticker@6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10): - resolution: {integrity: sha512-UqX1XYtzqFSirmTOy8QAK4Ccg4KkIZztrBdRPKwFSOEiKAJoGDCSBmyQBo/9aYQKGObbNnrJ7Hxv3/ucg3/1GA==} - peerDependencies: - '@pixi/extensions': 6.5.10 - '@pixi/settings': 6.5.10 - dependencies: - '@pixi/extensions': 6.5.10 - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - - /@pixi/utils@6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10): - resolution: {integrity: sha512-4f4qDMmAz9IoSAe08G2LAxUcEtG9jSdudfsMQT2MG+OpfToirboE6cNoO0KnLCvLzDVE/mfisiQ9uJbVA9Ssdw==} - peerDependencies: - '@pixi/constants': 6.5.10 - '@pixi/settings': 6.5.10 - dependencies: - '@pixi/constants': 6.5.10 - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - '@types/earcut': 2.1.4 - earcut: 2.2.4 - eventemitter3: 3.1.2 - url: 0.11.3 - - /@pkgjs/parseargs@0.11.0: - resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} - engines: {node: '>=14'} - requiresBuild: true - dev: true - optional: true - - /@playwright/test@1.40.1: - resolution: {integrity: sha512-EaaawMTOeEItCRvfmkI9v6rBkF1svM8wjl/YPRrg2N2Wmp+4qJYkWtJsbew1szfKKDm6fPLy4YAanBhIlf9dWw==} - engines: {node: '>=16'} - hasBin: true - dependencies: - playwright: 1.40.1 - dev: true - - /@sinclair/typebox@0.27.8: - resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} - dev: true - - /@snyk/github-codeowners@1.1.0: - resolution: {integrity: sha512-lGFf08pbkEac0NYgVf4hdANpAgApRjNByLXB+WBip3qj1iendOIyAwP2GKkKbQMNVy2r1xxDf0ssfWscoiC+Vw==} - engines: {node: '>=8.10'} - hasBin: true - dependencies: - commander: 4.1.1 - ignore: 5.3.0 - p-map: 4.0.0 - dev: true - - /@tootallnate/once@2.0.0: - resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} - engines: {node: '>= 10'} - dev: true - - /@types/babel__core@7.20.5: - resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} - dependencies: - '@babel/parser': 7.23.5 - '@babel/types': 7.23.5 - '@types/babel__generator': 7.6.7 - '@types/babel__template': 7.4.4 - '@types/babel__traverse': 7.20.4 - dev: true - - /@types/babel__generator@7.6.7: - resolution: {integrity: sha512-6Sfsq+EaaLrw4RmdFWE9Onp63TOUue71AWb4Gpa6JxzgTYtimbM086WnYTy2U67AofR++QKCo08ZP6pwx8YFHQ==} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@types/babel__template@7.4.4: - resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} - dependencies: - '@babel/parser': 7.23.5 - '@babel/types': 7.23.5 - dev: true - - /@types/babel__traverse@7.20.4: - resolution: {integrity: sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==} - dependencies: - '@babel/types': 7.23.5 - dev: true - - /@types/bezier-js@4.1.0: - resolution: {integrity: sha512-ElU16s8E6Pr6magp8ihwH1O8pbUJASbMND/qgUc9RsLmP3lMLHiDMRXdjtaObwW5GPtOVYOsXDUIhTIluT+yaw==} - dev: true - - /@types/chai-subset@1.3.5: - resolution: {integrity: sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==} - dependencies: - '@types/chai': 4.3.11 - dev: true - - /@types/chai@4.3.11: - resolution: {integrity: sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==} - dev: true - - /@types/d3-array@3.2.1: - resolution: {integrity: sha512-Y2Jn2idRrLzUfAKV2LyRImR+y4oa2AntrgID95SHJxuMUrkNXmanDSed71sRNZysveJVt1hLLemQZIady0FpEg==} - dev: true - - /@types/d3-axis@3.0.6: - resolution: {integrity: sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw==} - dependencies: - '@types/d3-selection': 2.0.0 - dev: true - - /@types/d3-brush@3.0.6: - resolution: {integrity: sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A==} - dependencies: - '@types/d3-selection': 2.0.0 - dev: true - - /@types/d3-chord@3.0.6: - resolution: {integrity: sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg==} - dev: true - - /@types/d3-color@3.1.3: - resolution: {integrity: sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==} - dev: true - - /@types/d3-contour@3.0.6: - resolution: {integrity: sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg==} - dependencies: - '@types/d3-array': 3.2.1 - '@types/geojson': 7946.0.13 - dev: true - - /@types/d3-delaunay@6.0.4: - resolution: {integrity: sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==} - dev: true - - /@types/d3-dispatch@3.0.6: - resolution: {integrity: sha512-4fvZhzMeeuBJYZXRXrRIQnvUYfyXwYmLsdiN7XXmVNQKKw1cM8a5WdID0g1hVFZDqT9ZqZEY5pD44p24VS7iZQ==} - dev: true - - /@types/d3-drag@2.0.0: - resolution: {integrity: sha512-VaUJPjbMnDn02tcRqsHLRAX5VjcRIzCjBfeXTLGe6QjMn5JccB5Cz4ztMRXMJfkbC45ovgJFWuj6DHvWMX1thA==} - dependencies: - '@types/d3-selection': 2.0.0 - dev: true - - /@types/d3-dsv@3.0.1: - resolution: {integrity: sha512-76pBHCMTvPLt44wFOieouXcGXWOF0AJCceUvaFkxSZEu4VDUdv93JfpMa6VGNFs01FHfuP4a5Ou68eRG1KBfTw==} - dev: true - - /@types/d3-ease@3.0.2: - resolution: {integrity: sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==} - dev: true - - /@types/d3-fetch@3.0.7: - resolution: {integrity: sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA==} - dependencies: - '@types/d3-dsv': 3.0.1 - dev: true - - /@types/d3-force@3.0.9: - resolution: {integrity: sha512-IKtvyFdb4Q0LWna6ymywQsEYjK/94SGhPrMfEr1TIc5OBeziTi+1jcCvttts8e0UWZIxpasjnQk9MNk/3iS+kA==} - dev: true - - /@types/d3-format@3.0.4: - resolution: {integrity: sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g==} - dev: true - - /@types/d3-geo@3.1.0: - resolution: {integrity: sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ==} - dependencies: - '@types/geojson': 7946.0.13 - dev: true - - /@types/d3-hierarchy@3.1.6: - resolution: {integrity: sha512-qlmD/8aMk5xGorUvTUWHCiumvgaUXYldYjNVOWtYoTYY/L+WwIEAmJxUmTgr9LoGNG0PPAOmqMDJVDPc7DOpPw==} - dev: true - - /@types/d3-interpolate@3.0.4: - resolution: {integrity: sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==} - dependencies: - '@types/d3-color': 3.1.3 - dev: true - - /@types/d3-path@3.0.2: - resolution: {integrity: sha512-WAIEVlOCdd/NKRYTsqCpOMHQHemKBEINf8YXMYOtXH0GA7SY0dqMB78P3Uhgfy+4X+/Mlw2wDtlETkN6kQUCMA==} - dev: true - - /@types/d3-polygon@3.0.2: - resolution: {integrity: sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA==} - dev: true - - /@types/d3-quadtree@3.0.6: - resolution: {integrity: sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg==} - dev: true - - /@types/d3-random@3.0.3: - resolution: {integrity: sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ==} - dev: true - - /@types/d3-scale-chromatic@3.0.3: - resolution: {integrity: sha512-laXM4+1o5ImZv3RpFAsTRn3TEkzqkytiOY0Dz0sq5cnd1dtNlk6sHLon4OvqaiJb28T0S/TdsBI3Sjsy+keJrw==} - dev: true - - /@types/d3-scale@4.0.8: - resolution: {integrity: sha512-gkK1VVTr5iNiYJ7vWDI+yUFFlszhNMtVeneJ6lUTKPjprsvLLI9/tgEGiXJOnlINJA8FyA88gfnQsHbybVZrYQ==} - dependencies: - '@types/d3-time': 3.0.3 - dev: true - - /@types/d3-selection@2.0.0: - resolution: {integrity: sha512-EF0lWZ4tg7oDFg4YQFlbOU3936e3a9UmoQ2IXlBy1+cv2c2Pv7knhKUzGlH5Hq2sF/KeDTH1amiRPey2rrLMQA==} - dev: true - - /@types/d3-shape@3.1.6: - resolution: {integrity: sha512-5KKk5aKGu2I+O6SONMYSNflgiP0WfZIQvVUMan50wHsLG1G94JlxEVnCpQARfTtzytuY0p/9PXXZb3I7giofIA==} - dependencies: - '@types/d3-path': 3.0.2 - dev: true - - /@types/d3-time-format@4.0.3: - resolution: {integrity: sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg==} - dev: true - - /@types/d3-time@3.0.3: - resolution: {integrity: sha512-2p6olUZ4w3s+07q3Tm2dbiMZy5pCDfYwtLXXHUnVzXgQlZ/OyPtUz6OL382BkOuGlLXqfT+wqv8Fw2v8/0geBw==} - dev: true - - /@types/d3-timer@3.0.2: - resolution: {integrity: sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==} - dev: true - - /@types/d3-transition@3.0.8: - resolution: {integrity: sha512-ew63aJfQ/ms7QQ4X7pk5NxQ9fZH/z+i24ZfJ6tJSfqxJMrYLiK01EAs2/Rtw/JreGUsS3pLPNV644qXFGnoZNQ==} - dependencies: - '@types/d3-selection': 2.0.0 - dev: true - - /@types/d3-zoom@3.0.8: - resolution: {integrity: sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw==} - dependencies: - '@types/d3-interpolate': 3.0.4 - '@types/d3-selection': 2.0.0 - dev: true - - /@types/d3@7.4.3: - resolution: {integrity: sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==} - dependencies: - '@types/d3-array': 3.2.1 - '@types/d3-axis': 3.0.6 - '@types/d3-brush': 3.0.6 - '@types/d3-chord': 3.0.6 - '@types/d3-color': 3.1.3 - '@types/d3-contour': 3.0.6 - '@types/d3-delaunay': 6.0.4 - '@types/d3-dispatch': 3.0.6 - '@types/d3-drag': 2.0.0 - '@types/d3-dsv': 3.0.1 - '@types/d3-ease': 3.0.2 - '@types/d3-fetch': 3.0.7 - '@types/d3-force': 3.0.9 - '@types/d3-format': 3.0.4 - '@types/d3-geo': 3.1.0 - '@types/d3-hierarchy': 3.1.6 - '@types/d3-interpolate': 3.0.4 - '@types/d3-path': 3.0.2 - '@types/d3-polygon': 3.0.2 - '@types/d3-quadtree': 3.0.6 - '@types/d3-random': 3.0.3 - '@types/d3-scale': 4.0.8 - '@types/d3-scale-chromatic': 3.0.3 - '@types/d3-selection': 2.0.0 - '@types/d3-shape': 3.1.6 - '@types/d3-time': 3.0.3 - '@types/d3-time-format': 4.0.3 - '@types/d3-timer': 3.0.2 - '@types/d3-transition': 3.0.8 - '@types/d3-zoom': 3.0.8 - dev: true - - /@types/earcut@2.1.4: - resolution: {integrity: sha512-qp3m9PPz4gULB9MhjGID7wpo3gJ4bTGXm7ltNDsmOvsPduTeHp8wSW9YckBj3mljeOh4F0m2z/0JKAALRKbmLQ==} - - /@types/geojson@7946.0.13: - resolution: {integrity: sha512-bmrNrgKMOhM3WsafmbGmC+6dsF2Z308vLFsQ3a/bT8X8Sv5clVYpPars/UPq+sAaJP+5OoLAYgwbkS5QEJdLUQ==} - dev: true - - /@types/history@4.7.11: - resolution: {integrity: sha512-qjDJRrmvBMiTx+jyLxvLfJU7UznFuokDv4f3WRuriHKERccVpFU+8XMQUAbDzoiJCsmexxRExQeMwwCdamSKDA==} - dev: true - - /@types/istanbul-lib-coverage@2.0.6: - resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} - dev: true - - /@types/json-schema@7.0.15: - resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - dev: true - - /@types/lodash-es@4.17.5: - resolution: {integrity: sha512-SHBoI8/0aoMQWAgUHMQ599VM6ZiSKg8sh/0cFqqlQQMyY9uEplc0ULU5yQNzcvdR4ZKa0ey8+vFmahuRbOCT1A==} - dependencies: - '@types/lodash': 4.14.202 - dev: true - - /@types/lodash@4.14.202: - resolution: {integrity: sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==} - dev: true - - /@types/mdast@3.0.15: - resolution: {integrity: sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==} - dependencies: - '@types/unist': 2.0.10 - dev: true - - /@types/minimist@1.2.5: - resolution: {integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==} - dev: true - - /@types/node@18.6.2: - resolution: {integrity: sha512-KcfkBq9H4PI6Vpu5B/KoPeuVDAbmi+2mDBqGPGUgoL7yXQtcWGu2vJWmmRkneWK3Rh0nIAX192Aa87AqKHYChQ==} - dev: true - - /@types/normalize-package-data@2.4.4: - resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} - dev: true - - /@types/offscreencanvas@2019.7.3: - resolution: {integrity: sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==} - - /@types/pixelmatch@5.2.6: - resolution: {integrity: sha512-wC83uexE5KGuUODn6zkm9gMzTwdY5L0chiK+VrKcDfEjzxh1uadlWTvOmAbCpnM9zx/Ww3f8uKlYQVnO/TrqVg==} - dependencies: - '@types/node': 18.6.2 - dev: true - - /@types/pngjs@6.0.4: - resolution: {integrity: sha512-atAK9xLKOnxiuArxcHovmnOUUGBZOQ3f0vCf43FnoKs6XnqiambT1kkJWmdo71IR+BoXSh+CueeFR0GfH3dTlQ==} - dependencies: - '@types/node': 18.6.2 - dev: true - - /@types/prop-types@15.7.11: - resolution: {integrity: sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==} - dev: true - - /@types/pubsub-js@1.8.2: - resolution: {integrity: sha512-cj3ZoAopr2ZmUYwRuXUiq48PlfNj5sBcUIkBnSJunfXlmf6y8o2kx4l70h1X1j0fR3IBorPrPM3B9SoyWwoqLg==} - dev: true - - /@types/raf@3.4.3: - resolution: {integrity: sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==} - requiresBuild: true - dev: false - optional: true - - /@types/rbush@3.0.0: - resolution: {integrity: sha512-W3ue/GYWXBOpkRm0VSoifrP3HV0Ni47aVJWvXyWMcbtpBy/l/K/smBRiJ+fI8f7shXRjZBiux+iJzYbh7VmcZg==} - dev: true - - /@types/react-dom@18.2.0: - resolution: {integrity: sha512-8yQrvS6sMpSwIovhPOwfyNf2Wz6v/B62LFSVYQ85+Rq3tLsBIG7rP5geMxaijTUxSkrO6RzN/IRuIAADYQsleA==} - dependencies: - '@types/react': 18.2.0 - dev: true - - /@types/react-resize-detector@4.2.0: - resolution: {integrity: sha512-y5PPThHUrBGxMhLDNn0BRWglKr84y+gQHvzkyKxF8aW3pox4IySC33V8AOu7ReS0JR1X1dKQgWeF8IOkGrbeBg==} - dependencies: - '@types/react': 18.2.0 - dev: true - - /@types/react-router-dom@5.3.3: - resolution: {integrity: sha512-kpqnYK4wcdm5UaWI3fLcELopqLrHgLqNsdpHauzlQktfkHL3npOSwtj1Uz9oKBAzs7lFtVkV8j83voAz2D8fhw==} - dependencies: - '@types/history': 4.7.11 - '@types/react': 18.2.0 - '@types/react-router': 5.1.20 - dev: true - - /@types/react-router@5.1.20: - resolution: {integrity: sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q==} - dependencies: - '@types/history': 4.7.11 - '@types/react': 18.2.0 - dev: true - - /@types/react@18.2.0: - resolution: {integrity: sha512-0FLj93y5USLHdnhIhABk83rm8XEGA7kH3cr+YUlvxoUGp1xNt/DINUMvqPxLyOQMzLmZe8i4RTHbvb8MC7NmrA==} - dependencies: - '@types/prop-types': 15.7.11 - '@types/scheduler': 0.16.8 - csstype: 3.1.2 - dev: true - - /@types/scheduler@0.16.8: - resolution: {integrity: sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==} - dev: true - - /@types/semver@7.5.6: - resolution: {integrity: sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==} - dev: true - - /@types/unist@2.0.10: - resolution: {integrity: sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==} - dev: true - - /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.19.0)(typescript@5.0.2): - resolution: {integrity: sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - '@typescript-eslint/parser': ^5.0.0 - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 5.62.0(eslint@8.19.0)(typescript@5.0.2) - '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/type-utils': 5.62.0(eslint@8.19.0)(typescript@5.0.2) - '@typescript-eslint/utils': 5.62.0(eslint@8.19.0)(typescript@5.0.2) - debug: 4.3.4 - eslint: 8.19.0 - graphemer: 1.4.0 - ignore: 5.3.0 - natural-compare-lite: 1.4.0 - semver: 7.5.4 - tsutils: 3.21.0(typescript@5.0.2) - typescript: 5.0.2 - transitivePeerDependencies: - - supports-color - dev: true - - /@typescript-eslint/parser@5.62.0(eslint@8.19.0)(typescript@5.0.2): - resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.0.2) - debug: 4.3.4 - eslint: 8.19.0 - typescript: 5.0.2 - transitivePeerDependencies: - - supports-color - dev: true - - /@typescript-eslint/scope-manager@5.62.0: - resolution: {integrity: sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/visitor-keys': 5.62.0 - dev: true - - /@typescript-eslint/type-utils@5.62.0(eslint@8.19.0)(typescript@5.0.2): - resolution: {integrity: sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: '*' - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.0.2) - '@typescript-eslint/utils': 5.62.0(eslint@8.19.0)(typescript@5.0.2) - debug: 4.3.4 - eslint: 8.19.0 - tsutils: 3.21.0(typescript@5.0.2) - typescript: 5.0.2 - transitivePeerDependencies: - - supports-color - dev: true - - /@typescript-eslint/types@5.62.0: - resolution: {integrity: sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true - - /@typescript-eslint/typescript-estree@5.62.0(typescript@5.0.2): - resolution: {integrity: sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/visitor-keys': 5.62.0 - debug: 4.3.4 - globby: 11.1.0 - is-glob: 4.0.3 - semver: 7.5.4 - tsutils: 3.21.0(typescript@5.0.2) - typescript: 5.0.2 - transitivePeerDependencies: - - supports-color - dev: true - - /@typescript-eslint/utils@5.62.0(eslint@8.19.0)(typescript@5.0.2): - resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.19.0) - '@types/json-schema': 7.0.15 - '@types/semver': 7.5.6 - '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.0.2) - eslint: 8.19.0 - eslint-scope: 5.1.1 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - - /@typescript-eslint/visitor-keys@5.62.0: - resolution: {integrity: sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - '@typescript-eslint/types': 5.62.0 - eslint-visitor-keys: 3.4.3 - dev: true - - /@vitejs/plugin-react@4.1.0(vite@4.4.11): - resolution: {integrity: sha512-rM0SqazU9iqPUraQ2JlIvReeaxOoRj6n+PzB1C0cBzIbd8qP336nC39/R9yPi3wVcah7E7j/kdU1uCUqMEU4OQ==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - vite: ^4.2.0 - dependencies: - '@babel/core': 7.23.5 - '@babel/plugin-transform-react-jsx-self': 7.23.3(@babel/core@7.23.5) - '@babel/plugin-transform-react-jsx-source': 7.23.3(@babel/core@7.23.5) - '@types/babel__core': 7.20.5 - react-refresh: 0.14.0 - vite: 4.4.11(@types/node@18.6.2) - transitivePeerDependencies: - - supports-color - dev: true - - /@vitest/coverage-v8@0.34.6(vitest@0.34.6): - resolution: {integrity: sha512-fivy/OK2d/EsJFoEoxHFEnNGTg+MmdZBAVK9Ka4qhXR2K3J0DS08vcGVwzDtXSuUMabLv4KtPcpSKkcMXFDViw==} - peerDependencies: - vitest: '>=0.32.0 <1' - dependencies: - '@ampproject/remapping': 2.2.1 - '@bcoe/v8-coverage': 0.2.3 - istanbul-lib-coverage: 3.2.2 - istanbul-lib-report: 3.0.1 - istanbul-lib-source-maps: 4.0.1 - istanbul-reports: 3.1.6 - magic-string: 0.30.5 - picocolors: 1.0.0 - std-env: 3.6.0 - test-exclude: 6.0.0 - v8-to-istanbul: 9.2.0 - vitest: 0.34.6(jsdom@19.0.0) - transitivePeerDependencies: - - supports-color - dev: true - - /@vitest/expect@0.34.6: - resolution: {integrity: sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==} - dependencies: - '@vitest/spy': 0.34.6 - '@vitest/utils': 0.34.6 - chai: 4.3.10 - dev: true - - /@vitest/runner@0.34.6: - resolution: {integrity: sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==} - dependencies: - '@vitest/utils': 0.34.6 - p-limit: 4.0.0 - pathe: 1.1.1 - dev: true - - /@vitest/snapshot@0.34.6: - resolution: {integrity: sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==} - dependencies: - magic-string: 0.30.5 - pathe: 1.1.1 - pretty-format: 29.7.0 - dev: true - - /@vitest/spy@0.34.6: - resolution: {integrity: sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==} - dependencies: - tinyspy: 2.2.0 - dev: true - - /@vitest/utils@0.34.6: - resolution: {integrity: sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==} - dependencies: - diff-sequences: 29.6.3 - loupe: 2.3.7 - pretty-format: 29.7.0 - dev: true - - /JSONStream@1.3.5: - resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} - hasBin: true - dependencies: - jsonparse: 1.3.1 - through: 2.3.8 - dev: true - - /abab@2.0.6: - resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} - deprecated: Use your platform's native atob() and btoa() methods instead - dev: true - - /abortable-promise-cache@1.5.0: - resolution: {integrity: sha512-S2FfvU1As7Fve6ObCEsuOiE22UR7k91ytM+m4bzG6eAf+fb4TOAVEGZGAzlRfCo7/bZamL9d3ZeXc08MPm3azA==} - engines: {node: '>=6'} - dependencies: - abortcontroller-polyfill: 1.7.5 - dev: false - - /abortcontroller-polyfill@1.7.5: - resolution: {integrity: sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==} - dev: false - - /acorn-globals@6.0.0: - resolution: {integrity: sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==} - dependencies: - acorn: 7.4.1 - acorn-walk: 7.2.0 - dev: true - - /acorn-jsx@5.3.2(acorn@8.11.2): - resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} - peerDependencies: - acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - dependencies: - acorn: 8.11.2 - dev: true - - /acorn-walk@7.2.0: - resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==} - engines: {node: '>=0.4.0'} - dev: true - - /acorn-walk@8.3.0: - resolution: {integrity: sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==} - engines: {node: '>=0.4.0'} - dev: true - - /acorn@7.4.1: - resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==} - engines: {node: '>=0.4.0'} - hasBin: true - dev: true - - /acorn@8.11.2: - resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} - engines: {node: '>=0.4.0'} - hasBin: true - dev: true - - /add-stream@1.0.0: - resolution: {integrity: sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ==} - dev: true - - /agent-base@6.0.2: - resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} - engines: {node: '>= 6.0.0'} - dependencies: - debug: 4.3.4 - transitivePeerDependencies: - - supports-color - dev: true - - /aggregate-error@3.1.0: - resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} - engines: {node: '>=8'} - dependencies: - clean-stack: 2.2.0 - indent-string: 4.0.0 - dev: true - - /ajv@6.12.6: - resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} - dependencies: - fast-deep-equal: 3.1.3 - fast-json-stable-stringify: 2.1.0 - json-schema-traverse: 0.4.1 - uri-js: 4.4.1 - - /allotment@1.19.3(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-StPCZLGPNG9KhXeNCrqTkIK09s7D6+8n0w754SRY8PUvDXFLLovrFFo4ubd82fytRWS5bFntsWA5SX4sODxuiw==} - peerDependencies: - react: ^17.0.0 || ^18.0.0 - react-dom: ^17.0.0 || ^18.0.0 - dependencies: - classnames: 2.3.2 - eventemitter3: 5.0.1 - lodash.clamp: 4.0.3 - lodash.debounce: 4.0.8 - lodash.isequal: 4.5.0 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - use-resize-observer: 9.1.0(react-dom@18.2.0)(react@18.2.0) - dev: false - - /ansi-regex@5.0.1: - resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} - engines: {node: '>=8'} - dev: true - - /ansi-regex@6.0.1: - resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} - engines: {node: '>=12'} - dev: true - - /ansi-styles@3.2.1: - resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} - engines: {node: '>=4'} - dependencies: - color-convert: 1.9.3 - dev: true - - /ansi-styles@4.3.0: - resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} - engines: {node: '>=8'} - dependencies: - color-convert: 2.0.1 - dev: true - - /ansi-styles@5.2.0: - resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} - engines: {node: '>=10'} - dev: true - - /ansi-styles@6.2.1: - resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} - engines: {node: '>=12'} - dev: true - - /argparse@2.0.1: - resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - dev: true - - /aria-query@5.3.0: - resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==} - dependencies: - dequal: 2.0.3 - dev: true - - /arity-n@1.0.4: - resolution: {integrity: sha512-fExL2kFDC1Q2DUOx3whE/9KoN66IzkY4b4zUHUBFM1ojEYjZZYDcUW3bek/ufGionX9giIKDC5redH2IlGqcQQ==} - dev: true - - /array-buffer-byte-length@1.0.0: - resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} - dependencies: - call-bind: 1.0.5 - is-array-buffer: 3.0.2 - dev: true - - /array-ify@1.0.0: - resolution: {integrity: sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==} - dev: true - - /array-includes@3.1.7: - resolution: {integrity: sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - get-intrinsic: 1.2.2 - is-string: 1.0.7 - dev: true - - /array-last@1.3.0: - resolution: {integrity: sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg==} - engines: {node: '>=0.10.0'} - dependencies: - is-number: 4.0.0 - dev: true - - /array-union@2.1.0: - resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} - engines: {node: '>=8'} - dev: true - - /array.prototype.flat@1.3.2: - resolution: {integrity: sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - es-shim-unscopables: 1.0.2 - dev: true - - /array.prototype.flatmap@1.3.2: - resolution: {integrity: sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - es-shim-unscopables: 1.0.2 - dev: true - - /array.prototype.tosorted@1.1.2: - resolution: {integrity: sha512-HuQCHOlk1Weat5jzStICBCd83NxiIMwqDg/dHEsoefabn/hJRj5pVdWcPUSpRrwhwxZOsQassMpgN/xRYFBMIg==} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - es-shim-unscopables: 1.0.2 - get-intrinsic: 1.2.2 - dev: true - - /arraybuffer.prototype.slice@1.0.2: - resolution: {integrity: sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==} - engines: {node: '>= 0.4'} - dependencies: - array-buffer-byte-length: 1.0.0 - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - get-intrinsic: 1.2.2 - is-array-buffer: 3.0.2 - is-shared-array-buffer: 1.0.2 - dev: true - - /arrify@1.0.1: - resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} - engines: {node: '>=0.10.0'} - dev: true - - /assertion-error@1.1.0: - resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} - dev: true - - /ast-types-flow@0.0.7: - resolution: {integrity: sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==} - dev: true - - /asynciterator.prototype@1.0.0: - resolution: {integrity: sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg==} - dependencies: - has-symbols: 1.0.3 - dev: true - - /asynckit@0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - dev: true - - /atob@2.1.2: - resolution: {integrity: sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==} - engines: {node: '>= 4.5.0'} - hasBin: true - dev: false - - /available-typed-arrays@1.0.5: - resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} - engines: {node: '>= 0.4'} - dev: true - - /axe-core@4.7.0: - resolution: {integrity: sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==} - engines: {node: '>=4'} - dev: true - - /axobject-query@3.2.1: - resolution: {integrity: sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==} - dependencies: - dequal: 2.0.3 - dev: true - - /babylon@6.18.0: - resolution: {integrity: sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==} - hasBin: true - dev: true - - /bail@1.0.5: - resolution: {integrity: sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==} - dev: true - - /balanced-match@1.0.2: - resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - dev: true - - /base64-arraybuffer@1.0.2: - resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==} - engines: {node: '>= 0.6.0'} - requiresBuild: true - dev: false - optional: true - - /base64-js@1.5.1: - resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - dev: false - - /bezier-js@4.0.3: - resolution: {integrity: sha512-w85AFcZ7EkszFgxuHYQ2/BI2G7H5bEotZD9vcg8+Hx4S8zF2odJBoFSFvGbcFDH5ScSxG27/IhW03SigVmkXNQ==} - dev: false - - /binary-parser@2.2.1: - resolution: {integrity: sha512-5ATpz/uPDgq5GgEDxTB4ouXCde7q2lqAQlSdBRQVl/AJnxmQmhIfyxJx+0MGu//D5rHQifkfGbWWlaysG0o9NA==} - engines: {node: '>=12'} - dev: false - - /bit-twiddle@1.0.2: - resolution: {integrity: sha512-B9UhK0DKFZhoTFcfvAzhqsjStvGJp9vYWf3+6SNTtdSQnvIgfkHbgHrg/e4+TH71N2GDu8tpmCVoyfrL1d7ntA==} - dev: false - - /box-intersect@1.0.2: - resolution: {integrity: sha512-yJeMwlmFPG1gIa7Rs/cGXeI6iOj6Qz5MG5PE61xLKpElUGzmJ4abm+qsLpzxKJFpsSDq742BQEocr8dI2t8Nxw==} - dependencies: - bit-twiddle: 1.0.2 - typedarray-pool: 1.2.0 - dev: false - - /brace-expansion@1.1.11: - resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} - dependencies: - balanced-match: 1.0.2 - concat-map: 0.0.1 - dev: true - - /brace-expansion@2.0.1: - resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} - dependencies: - balanced-match: 1.0.2 - dev: true - - /braces@3.0.2: - resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} - engines: {node: '>=8'} - dependencies: - fill-range: 7.0.1 - dev: true - - /browser-process-hrtime@1.0.0: - resolution: {integrity: sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==} - dev: true - - /browserslist@4.22.2: - resolution: {integrity: sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==} - engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} - hasBin: true - dependencies: - caniuse-lite: 1.0.30001566 - electron-to-chromium: 1.4.601 - node-releases: 2.0.14 - update-browserslist-db: 1.0.13(browserslist@4.22.2) - dev: true - - /btoa@1.2.1: - resolution: {integrity: sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==} - engines: {node: '>= 0.4.0'} - hasBin: true - dev: false - - /buffer-crc32@0.2.13: - resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} - dev: false - - /buffer@6.0.3: - resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} - dependencies: - base64-js: 1.5.1 - ieee754: 1.2.1 - dev: false - - /c8@7.14.0: - resolution: {integrity: sha512-i04rtkkcNcCf7zsQcSv/T9EbUn4RXQ6mropeMcjFOsQXQ0iGLAr/xT6TImQg4+U9hmNpN9XdvPkjUL1IzbgxJw==} - engines: {node: '>=10.12.0'} - hasBin: true - dependencies: - '@bcoe/v8-coverage': 0.2.3 - '@istanbuljs/schema': 0.1.3 - find-up: 5.0.0 - foreground-child: 2.0.0 - istanbul-lib-coverage: 3.2.2 - istanbul-lib-report: 3.0.1 - istanbul-reports: 3.1.6 - rimraf: 3.0.2 - test-exclude: 6.0.0 - v8-to-istanbul: 9.2.0 - yargs: 16.2.0 - yargs-parser: 20.2.9 - dev: true - - /cac@6.7.14: - resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} - engines: {node: '>=8'} - dev: true - - /call-bind@1.0.5: - resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} - dependencies: - function-bind: 1.1.2 - get-intrinsic: 1.2.2 - set-function-length: 1.1.1 - - /callsites@3.1.0: - resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} - engines: {node: '>=6'} - - /camelcase-keys@6.2.2: - resolution: {integrity: sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==} - engines: {node: '>=8'} - dependencies: - camelcase: 5.3.1 - map-obj: 4.3.0 - quick-lru: 4.0.1 - dev: true - - /camelcase@5.3.1: - resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} - engines: {node: '>=6'} - dev: true - - /caniuse-lite@1.0.30001566: - resolution: {integrity: sha512-ggIhCsTxmITBAMmK8yZjEhCO5/47jKXPu6Dha/wuCS4JePVL+3uiDEBuhu2aIoT+bqTOR8L76Ip1ARL9xYsEJA==} - dev: true - - /canvg@3.0.10: - resolution: {integrity: sha512-qwR2FRNO9NlzTeKIPIKpnTY6fqwuYSequ8Ru8c0YkYU7U0oW+hLUvWadLvAu1Rl72OMNiFhoLu4f8eUjQ7l/+Q==} - engines: {node: '>=10.0.0'} - requiresBuild: true - dependencies: - '@babel/runtime': 7.23.5 - '@types/raf': 3.4.3 - core-js: 3.33.3 - raf: 3.4.1 - regenerator-runtime: 0.13.11 - rgbcolor: 1.0.1 - stackblur-canvas: 2.6.0 - svg-pathdata: 6.0.3 - dev: false - optional: true - - /ccount@1.1.0: - resolution: {integrity: sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg==} - dev: true - - /chai@4.3.10: - resolution: {integrity: sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==} - engines: {node: '>=4'} - dependencies: - assertion-error: 1.1.0 - check-error: 1.0.3 - deep-eql: 4.1.3 - get-func-name: 2.0.2 - loupe: 2.3.7 - pathval: 1.1.1 - type-detect: 4.0.8 - dev: true - - /chalk@2.4.2: - resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} - engines: {node: '>=4'} - dependencies: - ansi-styles: 3.2.1 - escape-string-regexp: 1.0.5 - supports-color: 5.5.0 - dev: true - - /chalk@4.1.2: - resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} - engines: {node: '>=10'} - dependencies: - ansi-styles: 4.3.0 - supports-color: 7.2.0 - dev: true - - /chalk@5.3.0: - resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} - engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} - dev: true - - /character-entities-legacy@1.1.4: - resolution: {integrity: sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==} - dev: true - - /character-entities@1.2.4: - resolution: {integrity: sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==} - dev: true - - /character-reference-invalid@1.1.4: - resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==} - dev: true - - /check-error@1.0.3: - resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} - dependencies: - get-func-name: 2.0.2 - dev: true - - /classnames@2.3.2: - resolution: {integrity: sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==} - dev: false - - /clean-stack@2.2.0: - resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} - engines: {node: '>=6'} - dev: true - - /cliui@7.0.4: - resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} - dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - dev: true - - /clone@1.0.4: - resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} - engines: {node: '>=0.8'} - requiresBuild: true - dev: true - optional: true - - /clsx@1.2.1: - resolution: {integrity: sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==} - engines: {node: '>=6'} - dev: false - - /color-convert@1.9.3: - resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} - dependencies: - color-name: 1.1.3 - dev: true - - /color-convert@2.0.1: - resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} - engines: {node: '>=7.0.0'} - dependencies: - color-name: 1.1.4 - dev: true - - /color-name@1.1.3: - resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - dev: true - - /color-name@1.1.4: - resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - dev: true - - /combined-stream@1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} - dependencies: - delayed-stream: 1.0.0 - dev: true - - /commander@2.20.3: - resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} - dev: false - - /commander@4.1.1: - resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} - engines: {node: '>= 6'} - dev: true - - /commander@9.5.0: - resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} - engines: {node: ^12.20.0 || >=14} - dev: true - - /compare-func@2.0.0: - resolution: {integrity: sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==} - dependencies: - array-ify: 1.0.0 - dot-prop: 5.3.0 - dev: true - - /compose-function@3.0.3: - resolution: {integrity: sha512-xzhzTJ5eC+gmIzvZq+C3kCJHsp9os6tJkrigDRZclyGtOKINbZtE8n1Tzmeh32jW+BUDPbvZpibwvJHBLGMVwg==} - dependencies: - arity-n: 1.0.4 - dev: true - - /concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - dev: true - - /conventional-changelog-angular@5.0.13: - resolution: {integrity: sha512-i/gipMxs7s8L/QeuavPF2hLnJgH6pEZAttySB6aiQLWcX3puWDL3ACVmvBhJGxnAy52Qc15ua26BufY6KpmrVA==} - engines: {node: '>=10'} - dependencies: - compare-func: 2.0.0 - q: 1.5.1 - dev: true - - /conventional-changelog-atom@2.0.8: - resolution: {integrity: sha512-xo6v46icsFTK3bb7dY/8m2qvc8sZemRgdqLb/bjpBsH2UyOS8rKNTgcb5025Hri6IpANPApbXMg15QLb1LJpBw==} - engines: {node: '>=10'} - dependencies: - q: 1.5.1 - dev: true - - /conventional-changelog-cli@2.2.2: - resolution: {integrity: sha512-8grMV5Jo8S0kP3yoMeJxV2P5R6VJOqK72IiSV9t/4H5r/HiRqEBQ83bYGuz4Yzfdj4bjaAEhZN/FFbsFXr5bOA==} - engines: {node: '>=10'} - hasBin: true - dependencies: - add-stream: 1.0.0 - conventional-changelog: 3.1.25 - lodash: 4.17.21 - meow: 8.1.2 - tempfile: 3.0.0 - dev: true - - /conventional-changelog-codemirror@2.0.8: - resolution: {integrity: sha512-z5DAsn3uj1Vfp7po3gpt2Boc+Bdwmw2++ZHa5Ak9k0UKsYAO5mH1UBTN0qSCuJZREIhX6WU4E1p3IW2oRCNzQw==} - engines: {node: '>=10'} - dependencies: - q: 1.5.1 - dev: true - - /conventional-changelog-conventionalcommits@4.6.3: - resolution: {integrity: sha512-LTTQV4fwOM4oLPad317V/QNQ1FY4Hju5qeBIM1uTHbrnCE+Eg4CdRZ3gO2pUeR+tzWdp80M2j3qFFEDWVqOV4g==} - engines: {node: '>=10'} - dependencies: - compare-func: 2.0.0 - lodash: 4.17.21 - q: 1.5.1 - dev: true - - /conventional-changelog-core@4.2.4: - resolution: {integrity: sha512-gDVS+zVJHE2v4SLc6B0sLsPiloR0ygU7HaDW14aNJE1v4SlqJPILPl/aJC7YdtRE4CybBf8gDwObBvKha8Xlyg==} - engines: {node: '>=10'} - dependencies: - add-stream: 1.0.0 - conventional-changelog-writer: 5.0.1 - conventional-commits-parser: 3.2.4 - dateformat: 3.0.3 - get-pkg-repo: 4.2.1 - git-raw-commits: 2.0.11 - git-remote-origin-url: 2.0.0 - git-semver-tags: 4.1.1 - lodash: 4.17.21 - normalize-package-data: 3.0.3 - q: 1.5.1 - read-pkg: 3.0.0 - read-pkg-up: 3.0.0 - through2: 4.0.2 - dev: true - - /conventional-changelog-ember@2.0.9: - resolution: {integrity: sha512-ulzIReoZEvZCBDhcNYfDIsLTHzYHc7awh+eI44ZtV5cx6LVxLlVtEmcO+2/kGIHGtw+qVabJYjdI5cJOQgXh1A==} - engines: {node: '>=10'} - dependencies: - q: 1.5.1 - dev: true - - /conventional-changelog-eslint@3.0.9: - resolution: {integrity: sha512-6NpUCMgU8qmWmyAMSZO5NrRd7rTgErjrm4VASam2u5jrZS0n38V7Y9CzTtLT2qwz5xEChDR4BduoWIr8TfwvXA==} - engines: {node: '>=10'} - dependencies: - q: 1.5.1 - dev: true - - /conventional-changelog-express@2.0.6: - resolution: {integrity: sha512-SDez2f3iVJw6V563O3pRtNwXtQaSmEfTCaTBPCqn0oG0mfkq0rX4hHBq5P7De2MncoRixrALj3u3oQsNK+Q0pQ==} - engines: {node: '>=10'} - dependencies: - q: 1.5.1 - dev: true - - /conventional-changelog-jquery@3.0.11: - resolution: {integrity: sha512-x8AWz5/Td55F7+o/9LQ6cQIPwrCjfJQ5Zmfqi8thwUEKHstEn4kTIofXub7plf1xvFA2TqhZlq7fy5OmV6BOMw==} - engines: {node: '>=10'} - dependencies: - q: 1.5.1 - dev: true - - /conventional-changelog-jshint@2.0.9: - resolution: {integrity: sha512-wMLdaIzq6TNnMHMy31hql02OEQ8nCQfExw1SE0hYL5KvU+JCTuPaDO+7JiogGT2gJAxiUGATdtYYfh+nT+6riA==} - engines: {node: '>=10'} - dependencies: - compare-func: 2.0.0 - q: 1.5.1 - dev: true - - /conventional-changelog-preset-loader@2.3.4: - resolution: {integrity: sha512-GEKRWkrSAZeTq5+YjUZOYxdHq+ci4dNwHvpaBC3+ENalzFWuCWa9EZXSuZBpkr72sMdKB+1fyDV4takK1Lf58g==} - engines: {node: '>=10'} - dev: true - - /conventional-changelog-writer@5.0.1: - resolution: {integrity: sha512-5WsuKUfxW7suLblAbFnxAcrvf6r+0b7GvNaWUwUIk0bXMnENP/PEieGKVUQrjPqwPT4o3EPAASBXiY6iHooLOQ==} - engines: {node: '>=10'} - hasBin: true - dependencies: - conventional-commits-filter: 2.0.7 - dateformat: 3.0.3 - handlebars: 4.7.8 - json-stringify-safe: 5.0.1 - lodash: 4.17.21 - meow: 8.1.2 - semver: 6.3.1 - split: 1.0.1 - through2: 4.0.2 - dev: true - - /conventional-changelog@3.1.25: - resolution: {integrity: sha512-ryhi3fd1mKf3fSjbLXOfK2D06YwKNic1nC9mWqybBHdObPd8KJ2vjaXZfYj1U23t+V8T8n0d7gwnc9XbIdFbyQ==} - engines: {node: '>=10'} - dependencies: - conventional-changelog-angular: 5.0.13 - conventional-changelog-atom: 2.0.8 - conventional-changelog-codemirror: 2.0.8 - conventional-changelog-conventionalcommits: 4.6.3 - conventional-changelog-core: 4.2.4 - conventional-changelog-ember: 2.0.9 - conventional-changelog-eslint: 3.0.9 - conventional-changelog-express: 2.0.6 - conventional-changelog-jquery: 3.0.11 - conventional-changelog-jshint: 2.0.9 - conventional-changelog-preset-loader: 2.3.4 - dev: true - - /conventional-commits-filter@2.0.7: - resolution: {integrity: sha512-ASS9SamOP4TbCClsRHxIHXRfcGCnIoQqkvAzCSbZzTFLfcTqJVugB0agRgsEELsqaeWgsXv513eS116wnlSSPA==} - engines: {node: '>=10'} - dependencies: - lodash.ismatch: 4.4.0 - modify-values: 1.0.1 - dev: true - - /conventional-commits-parser@3.2.4: - resolution: {integrity: sha512-nK7sAtfi+QXbxHCYfhpZsfRtaitZLIA6889kFIouLvz6repszQDgxBu7wf2WbU+Dco7sAnNCJYERCwt54WPC2Q==} - engines: {node: '>=10'} - hasBin: true - dependencies: - JSONStream: 1.3.5 - is-text-path: 1.0.1 - lodash: 4.17.21 - meow: 8.1.2 - split2: 3.2.2 - through2: 4.0.2 - dev: true - - /convert-source-map@2.0.0: - resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} - dev: true - - /core-js@3.33.3: - resolution: {integrity: sha512-lo0kOocUlLKmm6kv/FswQL8zbkH7mVsLJ/FULClOhv8WRVmKLVcs6XPNQAzstfeJTCHMyButEwG+z1kHxHoDZw==} - requiresBuild: true - dev: false - optional: true - - /core-util-is@1.0.3: - resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} - dev: true - - /cross-fetch@3.1.8: - resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==} - dependencies: - node-fetch: 2.7.0 - transitivePeerDependencies: - - encoding - dev: false - - /cross-spawn@6.0.5: - resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==} - engines: {node: '>=4.8'} - dependencies: - nice-try: 1.0.5 - path-key: 2.0.1 - semver: 5.7.2 - shebang-command: 1.2.0 - which: 1.3.1 - dev: true - - /cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} - engines: {node: '>= 8'} - dependencies: - path-key: 3.1.1 - shebang-command: 2.0.0 - which: 2.0.2 - dev: true - - /css-element-queries@1.2.3: - resolution: {integrity: sha512-QK9uovYmKTsV2GXWQiMOByVNrLn2qz6m3P7vWpOR4IdD6I3iXoDw5qtgJEN3Xq7gIbdHVKvzHjdAtcl+4Arc4Q==} - dev: false - - /css-line-break@2.1.0: - resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==} - requiresBuild: true - dependencies: - utrie: 1.0.2 - dev: false - optional: true - - /cssfontparser@1.2.1: - resolution: {integrity: sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg==} - dev: true - - /cssom@0.3.8: - resolution: {integrity: sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==} - dev: true - - /cssom@0.5.0: - resolution: {integrity: sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==} - dev: true - - /cssstyle@2.3.0: - resolution: {integrity: sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==} - engines: {node: '>=8'} - dependencies: - cssom: 0.3.8 - dev: true - - /csstype@3.1.2: - resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} - dev: true - - /d3-array@2.12.1: - resolution: {integrity: sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==} - dependencies: - internmap: 1.0.1 - dev: false - - /d3-axis@2.1.0: - resolution: {integrity: sha512-z/G2TQMyuf0X3qP+Mh+2PimoJD41VOCjViJzT0BHeL/+JQAofkiWZbWxlwFGb1N8EN+Cl/CW+MUKbVzr1689Cw==} - dev: false - - /d3-brush@2.1.0: - resolution: {integrity: sha512-cHLLAFatBATyIKqZOkk/mDHUbzne2B3ZwxkzMHvFTCZCmLaXDpZRihQSn8UNXTkGD/3lb/W2sQz0etAftmHMJQ==} - dependencies: - d3-dispatch: 2.0.0 - d3-drag: 2.0.0 - d3-interpolate: 2.0.1 - d3-selection: 2.0.0 - d3-transition: 2.0.0(d3-selection@2.0.0) - dev: false - - /d3-collection@1.0.7: - resolution: {integrity: sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A==} - dev: false - - /d3-color@1.4.1: - resolution: {integrity: sha512-p2sTHSLCJI2QKunbGb7ocOh7DgTAn8IrLx21QRc/BSnodXM4sv6aLQlnfpvehFMLZEfBc6g9pH9SWQccFYfJ9Q==} - dev: false - - /d3-color@2.0.0: - resolution: {integrity: sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ==} - dev: false - - /d3-color@3.1.0: - resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==} - engines: {node: '>=12'} - dev: false - - /d3-dispatch@1.0.6: - resolution: {integrity: sha512-fVjoElzjhCEy+Hbn8KygnmMS7Or0a9sI2UzGwoB7cCtvI1XpVN9GpoYlnb3xt2YV66oXYb1fLJ8GMvP4hdU1RA==} - dev: false - - /d3-dispatch@2.0.0: - resolution: {integrity: sha512-S/m2VsXI7gAti2pBoLClFFTMOO1HTtT0j99AuXLoGFKO6deHDdnv6ZGTxSTTUTgO1zVcv82fCOtDjYK4EECmWA==} - - /d3-dispatch@3.0.1: - resolution: {integrity: sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==} - engines: {node: '>=12'} - dev: false - - /d3-drag@2.0.0: - resolution: {integrity: sha512-g9y9WbMnF5uqB9qKqwIIa/921RYWzlUDv9Jl1/yONQwxbOfszAWTCm8u7HOTgJgRDXiRZN56cHT9pd24dmXs8w==} - dependencies: - d3-dispatch: 2.0.0 - d3-selection: 2.0.0 - - /d3-drag@3.0.0: - resolution: {integrity: sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==} - engines: {node: '>=12'} - dependencies: - d3-dispatch: 3.0.1 - d3-selection: 3.0.0 - dev: false - - /d3-dsv@1.2.0: - resolution: {integrity: sha512-9yVlqvZcSOMhCYzniHE7EVUws7Fa1zgw+/EAV2BxJoG3ME19V6BQFBwI855XQDsxyOuG7NibqRMTtiF/Qup46g==} - hasBin: true - dependencies: - commander: 2.20.3 - iconv-lite: 0.4.24 - rw: 1.3.3 - dev: false - - /d3-dsv@2.0.0: - resolution: {integrity: sha512-E+Pn8UJYx9mViuIUkoc93gJGGYut6mSDKy2+XaPwccwkRGlR+LO97L2VCCRjQivTwLHkSnAJG7yo00BWY6QM+w==} - hasBin: true - dependencies: - commander: 2.20.3 - iconv-lite: 0.4.24 - rw: 1.3.3 - dev: false - - /d3-ease@2.0.0: - resolution: {integrity: sha512-68/n9JWarxXkOWMshcT5IcjbB+agblQUaIsbnXmrzejn2O82n3p2A9R2zEB9HIEFWKFwPAEDDN8gR0VdSAyyAQ==} - dev: false - - /d3-ease@3.0.1: - resolution: {integrity: sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==} - engines: {node: '>=12'} - dev: false - - /d3-format@1.4.5: - resolution: {integrity: sha512-J0piedu6Z8iB6TbIGfZgDzfXxUFN3qQRMofy2oPdXzQibYGqPB/9iMcxr/TGalU+2RsyDO+U4f33id8tbnSRMQ==} - dev: false - - /d3-format@2.0.0: - resolution: {integrity: sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA==} - dev: false - - /d3-format@3.1.0: - resolution: {integrity: sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==} - engines: {node: '>=12'} - dev: false - - /d3-geo@2.0.2: - resolution: {integrity: sha512-8pM1WGMLGFuhq9S+FpPURxic+gKzjluCD/CHTuUF3mXMeiCo0i6R0tO1s4+GArRFde96SLcW/kOFRjoAosPsFA==} - dependencies: - d3-array: 2.12.1 - dev: false - - /d3-interpolate@1.4.0: - resolution: {integrity: sha512-V9znK0zc3jOPV4VD2zZn0sDhZU3WAE2bmlxdIwwQPPzPjvyLkd8B3JUVdS1IDUFDkWZ72c9qnv1GK2ZagTZ8EA==} - dependencies: - d3-color: 1.4.1 - dev: false - - /d3-interpolate@2.0.1: - resolution: {integrity: sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ==} - dependencies: - d3-color: 2.0.0 - dev: false - - /d3-interpolate@3.0.1: - resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==} - engines: {node: '>=12'} - dependencies: - d3-color: 2.0.0 - dev: false - - /d3-path@2.0.0: - resolution: {integrity: sha512-ZwZQxKhBnv9yHaiWd6ZU4x5BtCQ7pXszEV9CU6kRgwIQVQGLMv1oiL4M+MK/n79sYzsj+gcgpPQSctJUsLN7fA==} - dev: false - - /d3-queue@3.0.7: - resolution: {integrity: sha512-2rs+6pNFKkrJhqe1rg5znw7dKJ7KZr62j9aLZfhondkrnz6U7VRmJj1UGcbD8MRc46c7H8m4SWhab8EalBQrkw==} - dev: false - - /d3-request@1.0.6: - resolution: {integrity: sha512-FJj8ySY6GYuAJHZMaCQ83xEYE4KbkPkmxZ3Hu6zA1xxG2GD+z6P+Lyp+zjdsHf0xEbp2xcluDI50rCS855EQ6w==} - dependencies: - d3-collection: 1.0.7 - d3-dispatch: 1.0.6 - d3-dsv: 1.2.0 - xmlhttprequest: 1.8.0 - dev: false - - /d3-scale-chromatic@2.0.0: - resolution: {integrity: sha512-LLqy7dJSL8yDy7NRmf6xSlsFZ6zYvJ4BcWFE4zBrOPnQERv9zj24ohnXKRbyi9YHnYV+HN1oEO3iFK971/gkzA==} - dependencies: - d3-color: 2.0.0 - d3-interpolate: 2.0.1 - dev: false - - /d3-scale@3.2.1: - resolution: {integrity: sha512-huz5byJO/6MPpz6Q8d4lg7GgSpTjIZW/l+1MQkzKfu2u8P6hjaXaStOpmyrD6ymKoW87d2QVFCKvSjLwjzx/rA==} - dependencies: - d3-array: 2.12.1 - d3-format: 1.4.5 - d3-interpolate: 1.4.0 - d3-time: 1.1.0 - d3-time-format: 2.3.0 - dev: false - - /d3-scale@4.0.2: - resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==} - engines: {node: '>=12'} - dependencies: - d3-array: 2.12.1 - d3-format: 3.1.0 - d3-interpolate: 3.0.1 - d3-time: 3.1.0 - d3-time-format: 4.1.0 - dev: false - - /d3-selection@2.0.0: - resolution: {integrity: sha512-XoGGqhLUN/W14NmaqcO/bb1nqjDAw5WtSYb2X8wiuQWvSZUsUVYsOSkOybUrNvcBjaywBdYPy03eXHMXjk9nZA==} - - /d3-selection@3.0.0: - resolution: {integrity: sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==} - engines: {node: '>=12'} - dev: false - - /d3-shape@2.1.0: - resolution: {integrity: sha512-PnjUqfM2PpskbSLTJvAzp2Wv4CZsnAgTfcVRTwW03QR3MkXF8Uo7B1y/lWkAsmbKwuecto++4NlsYcvYpXpTHA==} - dependencies: - d3-path: 2.0.0 - dev: false - - /d3-time-format@2.3.0: - resolution: {integrity: sha512-guv6b2H37s2Uq/GefleCDtbe0XZAuy7Wa49VGkPVPMfLL9qObgBST3lEHJBMUp8S7NdLQAGIvr2KXk8Hc98iKQ==} - dependencies: - d3-time: 1.1.0 - dev: false - - /d3-time-format@4.1.0: - resolution: {integrity: sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==} - engines: {node: '>=12'} - dependencies: - d3-time: 3.1.0 - dev: false - - /d3-time@1.1.0: - resolution: {integrity: sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA==} - dev: false - - /d3-time@3.1.0: - resolution: {integrity: sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==} - engines: {node: '>=12'} - dependencies: - d3-array: 2.12.1 - dev: false - - /d3-timer@2.0.0: - resolution: {integrity: sha512-TO4VLh0/420Y/9dO3+f9abDEFYeCUr2WZRlxJvbp4HPTQcSylXNiL6yZa9FIUvV1yRiFufl1bszTCLDqv9PWNA==} - dev: false - - /d3-timer@3.0.1: - resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==} - engines: {node: '>=12'} - dev: false - - /d3-transition@2.0.0(d3-selection@2.0.0): - resolution: {integrity: sha512-42ltAGgJesfQE3u9LuuBHNbGrI/AJjNL2OAUdclE70UE6Vy239GCBEYD38uBPoLeNsOhFStGpPI0BAOV+HMxog==} - peerDependencies: - d3-selection: '2' - dependencies: - d3-color: 2.0.0 - d3-dispatch: 2.0.0 - d3-ease: 2.0.0 - d3-interpolate: 2.0.1 - d3-selection: 2.0.0 - d3-timer: 2.0.0 - dev: false - - /d3-transition@3.0.1(d3-selection@2.0.0): - resolution: {integrity: sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==} - engines: {node: '>=12'} - peerDependencies: - d3-selection: 2 - 3 - dependencies: - d3-color: 3.1.0 - d3-dispatch: 3.0.1 - d3-ease: 3.0.1 - d3-interpolate: 3.0.1 - d3-selection: 2.0.0 - d3-timer: 3.0.1 - dev: false - - /d3-transition@3.0.1(d3-selection@3.0.0): - resolution: {integrity: sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==} - engines: {node: '>=12'} - peerDependencies: - d3-selection: 2 - 3 - dependencies: - d3-color: 3.1.0 - d3-dispatch: 3.0.1 - d3-ease: 3.0.1 - d3-interpolate: 3.0.1 - d3-selection: 3.0.0 - d3-timer: 3.0.1 - dev: false - - /d3-zoom@3.0.0: - resolution: {integrity: sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==} - engines: {node: '>=12'} - dependencies: - d3-dispatch: 3.0.1 - d3-drag: 3.0.0 - d3-interpolate: 3.0.1 - d3-selection: 3.0.0 - d3-transition: 3.0.1(d3-selection@3.0.0) - dev: false - - /damerau-levenshtein@1.0.8: - resolution: {integrity: sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==} - dev: true - - /dargs@7.0.0: - resolution: {integrity: sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==} - engines: {node: '>=8'} - dev: true - - /data-urls@3.0.2: - resolution: {integrity: sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==} - engines: {node: '>=12'} - dependencies: - abab: 2.0.6 - whatwg-mimetype: 3.0.0 - whatwg-url: 11.0.0 - dev: true - - /dateformat@3.0.3: - resolution: {integrity: sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==} - dev: true - - /debug@4.3.4: - resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - dependencies: - ms: 2.1.2 - - /decamelize-keys@1.1.1: - resolution: {integrity: sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==} - engines: {node: '>=0.10.0'} - dependencies: - decamelize: 1.2.0 - map-obj: 1.0.1 - dev: true - - /decamelize@1.2.0: - resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} - engines: {node: '>=0.10.0'} - dev: true - - /decimal.js@10.4.3: - resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} - dev: true - - /deep-eql@4.1.3: - resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} - engines: {node: '>=6'} - dependencies: - type-detect: 4.0.8 - dev: true - - /deep-freeze@0.0.1: - resolution: {integrity: sha512-Z+z8HiAvsGwmjqlphnHW5oz6yWlOwu6EQfFTjmeTWlDeda3FS2yv3jhq35TX/ewmsnqB+RX2IdsIOyjJCQN5tg==} - dev: true - - /deep-is@0.1.4: - resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} - dev: true - - /defaults@1.0.4: - resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} - requiresBuild: true - dependencies: - clone: 1.0.4 - dev: true - optional: true - - /define-data-property@1.1.1: - resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} - engines: {node: '>= 0.4'} - dependencies: - get-intrinsic: 1.2.2 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - - /define-properties@1.2.1: - resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} - engines: {node: '>= 0.4'} - dependencies: - define-data-property: 1.1.1 - has-property-descriptors: 1.0.1 - object-keys: 1.1.1 - dev: true - - /delayed-stream@1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} - dev: true - - /dequal@2.0.3: - resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} - engines: {node: '>=6'} - dev: true - - /diff-sequences@29.6.3: - resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dev: true - - /dir-glob@3.0.1: - resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} - engines: {node: '>=8'} - dependencies: - path-type: 4.0.0 - dev: true - - /doctrine@2.1.0: - resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} - engines: {node: '>=0.10.0'} - dependencies: - esutils: 2.0.3 - dev: true - - /doctrine@3.0.0: - resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} - engines: {node: '>=6.0.0'} - dependencies: - esutils: 2.0.3 - dev: true - - /dom-scroll-into-view@1.2.1: - resolution: {integrity: sha512-LwNVg3GJOprWDO+QhLL1Z9MMgWe/KAFLxVWKzjRTxNSPn8/LLDIfmuG71YHznXCqaqTjvHJDYO1MEAgX6XCNbQ==} - dev: false - - /dom-serializer@2.0.0: - resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==} - dependencies: - domelementtype: 2.3.0 - domhandler: 5.0.3 - entities: 4.5.0 - dev: true - - /domelementtype@2.3.0: - resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} - dev: true - - /domexception@4.0.0: - resolution: {integrity: sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==} - engines: {node: '>=12'} - deprecated: Use your platform's native DOMException instead - dependencies: - webidl-conversions: 7.0.0 - dev: true - - /domhandler@5.0.3: - resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} - engines: {node: '>= 4'} - dependencies: - domelementtype: 2.3.0 - dev: true - - /dompurify@2.4.7: - resolution: {integrity: sha512-kxxKlPEDa6Nc5WJi+qRgPbOAbgTpSULL+vI3NUXsZMlkJxTqYI9wg5ZTay2sFrdZRWHPWNi+EdAhcJf81WtoMQ==} - requiresBuild: true - dev: false - optional: true - - /domutils@3.1.0: - resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==} - dependencies: - dom-serializer: 2.0.0 - domelementtype: 2.3.0 - domhandler: 5.0.3 - dev: true - - /dot-prop@5.3.0: - resolution: {integrity: sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==} - engines: {node: '>=8'} - dependencies: - is-obj: 2.0.0 - dev: true - - /dup@1.0.0: - resolution: {integrity: sha512-Bz5jxMMC0wgp23Zm15ip1x8IhYRqJvF3nFC0UInJUDkN1z4uNPk9jTnfCUJXbOGiQ1JbXLQsiV41Fb+HXcj5BA==} - dev: false - - /earcut@2.2.4: - resolution: {integrity: sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==} - - /eastasianwidth@0.2.0: - resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - dev: true - - /easy-table@1.2.0: - resolution: {integrity: sha512-OFzVOv03YpvtcWGe5AayU5G2hgybsg3iqA6drU8UaoZyB9jLGMTrz9+asnLp/E+6qPh88yEI1gvyZFZ41dmgww==} - dependencies: - ansi-regex: 5.0.1 - optionalDependencies: - wcwidth: 1.0.1 - dev: true - - /electron-to-chromium@1.4.601: - resolution: {integrity: sha512-SpwUMDWe9tQu8JX5QCO1+p/hChAi9AE9UpoC3rcHVc+gdCGlbT3SGb5I1klgb952HRIyvt9wZhSz9bNBYz9swA==} - dev: true - - /emoji-regex@8.0.0: - resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - dev: true - - /emoji-regex@9.2.2: - resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} - dev: true - - /entities@4.5.0: - resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} - engines: {node: '>=0.12'} - dev: true - - /error-ex@1.3.2: - resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} - dependencies: - is-arrayish: 0.2.1 - dev: true - - /es-abstract@1.22.3: - resolution: {integrity: sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==} - engines: {node: '>= 0.4'} - dependencies: - array-buffer-byte-length: 1.0.0 - arraybuffer.prototype.slice: 1.0.2 - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - es-set-tostringtag: 2.0.2 - es-to-primitive: 1.2.1 - function.prototype.name: 1.1.6 - get-intrinsic: 1.2.2 - get-symbol-description: 1.0.0 - globalthis: 1.0.3 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - has-proto: 1.0.1 - has-symbols: 1.0.3 - hasown: 2.0.0 - internal-slot: 1.0.6 - is-array-buffer: 3.0.2 - is-callable: 1.2.7 - is-negative-zero: 2.0.2 - is-regex: 1.1.4 - is-shared-array-buffer: 1.0.2 - is-string: 1.0.7 - is-typed-array: 1.1.12 - is-weakref: 1.0.2 - object-inspect: 1.13.1 - object-keys: 1.1.1 - object.assign: 4.1.5 - regexp.prototype.flags: 1.5.1 - safe-array-concat: 1.0.1 - safe-regex-test: 1.0.0 - string.prototype.trim: 1.2.8 - string.prototype.trimend: 1.0.7 - string.prototype.trimstart: 1.0.7 - typed-array-buffer: 1.0.0 - typed-array-byte-length: 1.0.0 - typed-array-byte-offset: 1.0.0 - typed-array-length: 1.0.4 - unbox-primitive: 1.0.2 - which-typed-array: 1.1.13 - dev: true - - /es-iterator-helpers@1.0.15: - resolution: {integrity: sha512-GhoY8uYqd6iwUl2kgjTm4CZAf6oo5mHK7BPqx3rKgx893YSsy0LGHV6gfqqQvZt/8xM8xeOnfXBCfqclMKkJ5g==} - dependencies: - asynciterator.prototype: 1.0.0 - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - es-set-tostringtag: 2.0.2 - function-bind: 1.1.2 - get-intrinsic: 1.2.2 - globalthis: 1.0.3 - has-property-descriptors: 1.0.1 - has-proto: 1.0.1 - has-symbols: 1.0.3 - internal-slot: 1.0.6 - iterator.prototype: 1.1.2 - safe-array-concat: 1.0.1 - dev: true - - /es-set-tostringtag@2.0.2: - resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==} - engines: {node: '>= 0.4'} - dependencies: - get-intrinsic: 1.2.2 - has-tostringtag: 1.0.0 - hasown: 2.0.0 - dev: true - - /es-shim-unscopables@1.0.2: - resolution: {integrity: sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==} - dependencies: - hasown: 2.0.0 - dev: true - - /es-to-primitive@1.2.1: - resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} - engines: {node: '>= 0.4'} - dependencies: - is-callable: 1.2.7 - is-date-object: 1.0.5 - is-symbol: 1.0.4 - dev: true - - /es6-promisify@6.1.1: - resolution: {integrity: sha512-HBL8I3mIki5C1Cc9QjKUenHtnG0A5/xA8Q/AllRcfiwl2CZFXGK7ddBiCoRwAix4i2KxcQfjtIVcrVbB3vbmwg==} - dev: false - - /es6-promisify@7.0.0: - resolution: {integrity: sha512-ginqzK3J90Rd4/Yz7qRrqUeIpe3TwSXTPPZtPne7tGBPeAaQiU8qt4fpKApnxHcq1AwtUdHVg5P77x/yrggG8Q==} - engines: {node: '>=6'} - dev: false - - /esbuild@0.12.29: - resolution: {integrity: sha512-w/XuoBCSwepyiZtIRsKsetiLDUVGPVw1E/R3VTFSecIy8UR7Cq3SOtwKHJMFoVqqVG36aGkzh4e8BvpO1Fdc7g==} - hasBin: true - requiresBuild: true - dev: true - - /esbuild@0.18.20: - resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} - engines: {node: '>=12'} - hasBin: true - requiresBuild: true - optionalDependencies: - '@esbuild/android-arm': 0.18.20 - '@esbuild/android-arm64': 0.18.20 - '@esbuild/android-x64': 0.18.20 - '@esbuild/darwin-arm64': 0.18.20 - '@esbuild/darwin-x64': 0.18.20 - '@esbuild/freebsd-arm64': 0.18.20 - '@esbuild/freebsd-x64': 0.18.20 - '@esbuild/linux-arm': 0.18.20 - '@esbuild/linux-arm64': 0.18.20 - '@esbuild/linux-ia32': 0.18.20 - '@esbuild/linux-loong64': 0.18.20 - '@esbuild/linux-mips64el': 0.18.20 - '@esbuild/linux-ppc64': 0.18.20 - '@esbuild/linux-riscv64': 0.18.20 - '@esbuild/linux-s390x': 0.18.20 - '@esbuild/linux-x64': 0.18.20 - '@esbuild/netbsd-x64': 0.18.20 - '@esbuild/openbsd-x64': 0.18.20 - '@esbuild/sunos-x64': 0.18.20 - '@esbuild/win32-arm64': 0.18.20 - '@esbuild/win32-ia32': 0.18.20 - '@esbuild/win32-x64': 0.18.20 - dev: true - - /escalade@3.1.1: - resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} - engines: {node: '>=6'} - dev: true - - /escape-string-regexp@1.0.5: - resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} - engines: {node: '>=0.8.0'} - dev: true - - /escape-string-regexp@4.0.0: - resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} - engines: {node: '>=10'} - dev: true - - /escodegen@2.1.0: - resolution: {integrity: sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==} - engines: {node: '>=6.0'} - hasBin: true - dependencies: - esprima: 4.0.1 - estraverse: 5.3.0 - esutils: 2.0.3 - optionalDependencies: - source-map: 0.6.1 - dev: true - - /eslint-config-prettier@8.10.0(eslint@8.19.0): - resolution: {integrity: sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==} - hasBin: true - peerDependencies: - eslint: '>=7.0.0' - dependencies: - eslint: 8.19.0 - dev: true - - /eslint-plugin-jsx-a11y@6.7.1(eslint@8.19.0): - resolution: {integrity: sha512-63Bog4iIethyo8smBklORknVjB0T2dwB8Mr/hIC+fBS0uyHdYYpzM/Ed+YC8VxTjlXHEWFOdmgwcDn1U2L9VCA==} - engines: {node: '>=4.0'} - peerDependencies: - eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 - dependencies: - '@babel/runtime': 7.23.5 - aria-query: 5.3.0 - array-includes: 3.1.7 - array.prototype.flatmap: 1.3.2 - ast-types-flow: 0.0.7 - axe-core: 4.7.0 - axobject-query: 3.2.1 - damerau-levenshtein: 1.0.8 - emoji-regex: 9.2.2 - eslint: 8.19.0 - has: 1.0.4 - jsx-ast-utils: 3.3.5 - language-tags: 1.0.5 - minimatch: 3.1.2 - object.entries: 1.1.7 - object.fromentries: 2.0.7 - semver: 6.3.1 - dev: true - - /eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0)(eslint@8.19.0)(prettier@2.8.8): - resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} - engines: {node: '>=12.0.0'} - peerDependencies: - eslint: '>=7.28.0' - eslint-config-prettier: '*' - prettier: '>=2.0.0' - peerDependenciesMeta: - eslint-config-prettier: - optional: true - dependencies: - eslint: 8.19.0 - eslint-config-prettier: 8.10.0(eslint@8.19.0) - prettier: 2.8.8 - prettier-linter-helpers: 1.0.0 - dev: true - - /eslint-plugin-react@7.33.2(eslint@8.19.0): - resolution: {integrity: sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw==} - engines: {node: '>=4'} - peerDependencies: - eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 - dependencies: - array-includes: 3.1.7 - array.prototype.flatmap: 1.3.2 - array.prototype.tosorted: 1.1.2 - doctrine: 2.1.0 - es-iterator-helpers: 1.0.15 - eslint: 8.19.0 - estraverse: 5.3.0 - jsx-ast-utils: 3.3.5 - minimatch: 3.1.2 - object.entries: 1.1.7 - object.fromentries: 2.0.7 - object.hasown: 1.1.3 - object.values: 1.1.7 - prop-types: 15.8.1 - resolve: 2.0.0-next.5 - semver: 6.3.1 - string.prototype.matchall: 4.0.10 - dev: true - - /eslint-scope@5.1.1: - resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} - engines: {node: '>=8.0.0'} - dependencies: - esrecurse: 4.3.0 - estraverse: 4.3.0 - dev: true - - /eslint-scope@7.2.2: - resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - esrecurse: 4.3.0 - estraverse: 5.3.0 - dev: true - - /eslint-utils@3.0.0(eslint@8.19.0): - resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} - engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} - peerDependencies: - eslint: '>=5' - dependencies: - eslint: 8.19.0 - eslint-visitor-keys: 2.1.0 - dev: true - - /eslint-visitor-keys@2.1.0: - resolution: {integrity: sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==} - engines: {node: '>=10'} - dev: true - - /eslint-visitor-keys@3.4.3: - resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dev: true - - /eslint@8.19.0: - resolution: {integrity: sha512-SXOPj3x9VKvPe81TjjUJCYlV4oJjQw68Uek+AM0X4p+33dj2HY5bpTZOgnQHcG2eAm1mtCU9uNMnJi7exU/kYw==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - hasBin: true - dependencies: - '@eslint/eslintrc': 1.4.1 - '@humanwhocodes/config-array': 0.9.5 - ajv: 6.12.6 - chalk: 4.1.2 - cross-spawn: 7.0.3 - debug: 4.3.4 - doctrine: 3.0.0 - escape-string-regexp: 4.0.0 - eslint-scope: 7.2.2 - eslint-utils: 3.0.0(eslint@8.19.0) - eslint-visitor-keys: 3.4.3 - espree: 9.6.1 - esquery: 1.5.0 - esutils: 2.0.3 - fast-deep-equal: 3.1.3 - file-entry-cache: 6.0.1 - functional-red-black-tree: 1.0.1 - glob-parent: 6.0.2 - globals: 13.23.0 - ignore: 5.3.0 - import-fresh: 3.3.0 - imurmurhash: 0.1.4 - is-glob: 4.0.3 - js-yaml: 4.1.0 - json-stable-stringify-without-jsonify: 1.0.1 - levn: 0.4.1 - lodash.merge: 4.6.2 - minimatch: 3.1.2 - natural-compare: 1.4.0 - optionator: 0.9.3 - regexpp: 3.2.0 - strip-ansi: 6.0.1 - strip-json-comments: 3.1.1 - text-table: 0.2.0 - v8-compile-cache: 2.4.0 - transitivePeerDependencies: - - supports-color - dev: true - - /esm@3.2.25: - resolution: {integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==} - engines: {node: '>=6'} - requiresBuild: true - dev: false - optional: true - - /espree@9.6.1: - resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - dependencies: - acorn: 8.11.2 - acorn-jsx: 5.3.2(acorn@8.11.2) - eslint-visitor-keys: 3.4.3 - dev: true - - /esprima@4.0.1: - resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} - engines: {node: '>=4'} - hasBin: true - dev: true - - /esquery@1.5.0: - resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==} - engines: {node: '>=0.10'} - dependencies: - estraverse: 5.3.0 - dev: true - - /esrecurse@4.3.0: - resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} - engines: {node: '>=4.0'} - dependencies: - estraverse: 5.3.0 - dev: true - - /estraverse@4.3.0: - resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} - engines: {node: '>=4.0'} - dev: true - - /estraverse@5.3.0: - resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} - engines: {node: '>=4.0'} - dev: true - - /esutils@2.0.3: - resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} - engines: {node: '>=0.10.0'} - dev: true - - /eventemitter3@3.1.2: - resolution: {integrity: sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==} - - /eventemitter3@5.0.1: - resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} - dev: false - - /events@3.3.0: - resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} - engines: {node: '>=0.8.x'} - dev: false - - /extend@3.0.2: - resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} - dev: true - - /fast-deep-equal@3.1.3: - resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - - /fast-diff@1.3.0: - resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} - dev: true - - /fast-glob@3.3.2: - resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} - engines: {node: '>=8.6.0'} - dependencies: - '@nodelib/fs.stat': 2.0.5 - '@nodelib/fs.walk': 1.2.8 - glob-parent: 5.1.2 - merge2: 1.4.1 - micromatch: 4.0.5 - dev: true - - /fast-json-stable-stringify@2.1.0: - resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} - - /fast-levenshtein@2.0.6: - resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - dev: true - - /fastq@1.15.0: - resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} - dependencies: - reusify: 1.0.4 - dev: true - - /fetch-jsonp@1.3.0: - resolution: {integrity: sha512-hxCYGvmANEmpkHpeWY8Kawfa5Z1t2csTpIClIDG/0S92eALWHRU1RnGaj86Tf5Cc0QF+afSa4SQ4pFB2rFM5QA==} - dev: true - - /fflate@0.4.8: - resolution: {integrity: sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==} - dev: false - - /fflate@0.7.4: - resolution: {integrity: sha512-5u2V/CDW15QM1XbbgS+0DfPxVB+jUKhWEKuuFuHncbk3tEEqzmoXL+2KyOFuKGqOnmdIy0/davWF1CkuwtibCw==} - dev: false - - /file-entry-cache@6.0.1: - resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} - engines: {node: ^10.12.0 || >=12.0.0} - dependencies: - flat-cache: 3.2.0 - dev: true - - /fill-range@7.0.1: - resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} - engines: {node: '>=8'} - dependencies: - to-regex-range: 5.0.1 - dev: true - - /filter-iterator@0.0.1: - resolution: {integrity: sha512-v4lhL7Qa8XpbW3LN46CEnmhGk3eHZwxfNl5at20aEkreesht4YKb/Ba3BUIbnPhAC/r3dmu7ABaGk6MAvh2alA==} - dev: true - - /filter-obj@1.1.0: - resolution: {integrity: sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ==} - engines: {node: '>=0.10.0'} - dev: true - - /find-up@2.1.0: - resolution: {integrity: sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==} - engines: {node: '>=4'} - dependencies: - locate-path: 2.0.0 - dev: true - - /find-up@4.1.0: - resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} - engines: {node: '>=8'} - dependencies: - locate-path: 5.0.0 - path-exists: 4.0.0 - dev: true - - /find-up@5.0.0: - resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} - engines: {node: '>=10'} - dependencies: - locate-path: 6.0.0 - path-exists: 4.0.0 - dev: true - - /flat-cache@3.2.0: - resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} - engines: {node: ^10.12.0 || >=12.0.0} - dependencies: - flatted: 3.2.9 - keyv: 4.5.4 - rimraf: 3.0.2 - dev: true - - /flatted@3.2.9: - resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==} - dev: true - - /for-each@0.3.3: - resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} - dependencies: - is-callable: 1.2.7 - dev: true - - /foreground-child@2.0.0: - resolution: {integrity: sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==} - engines: {node: '>=8.0.0'} - dependencies: - cross-spawn: 7.0.3 - signal-exit: 3.0.7 - dev: true - - /foreground-child@3.1.1: - resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} - engines: {node: '>=14'} - dependencies: - cross-spawn: 7.0.3 - signal-exit: 4.1.0 - dev: true - - /form-data@4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} - engines: {node: '>= 6'} - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - dev: true - - /fs.realpath@1.0.0: - resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - dev: true - - /fsevents@2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /fsevents@2.3.3: - resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /function-bind@1.1.2: - resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - - /function.prototype.name@1.1.6: - resolution: {integrity: sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - functions-have-names: 1.2.3 - dev: true - - /functional-red-black-tree@1.0.1: - resolution: {integrity: sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==} - dev: true - - /functions-have-names@1.2.3: - resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} - dev: true - - /genbank-parser@1.2.4: - resolution: {integrity: sha512-r3pTgKHZx/rol90v2cezrNhfMhq3yHWCnBYyETNIJkvnJk+cwx/D/ZVgAy1SX8zwtnfvYQmFbqlpbh2f4t0h2w==} - dev: false - - /generic-filehandle@3.1.1: - resolution: {integrity: sha512-8fLkHgbnKlOWhJgPmvGm+0HclUkyCPM0WGZQOAWdebNsWbHZJi7pW/RAPp26fhqlVpgT5tHqVKWunf/r+HRoEw==} - engines: {node: '>=12'} - dependencies: - es6-promisify: 6.1.1 - dev: false - - /gensync@1.0.0-beta.2: - resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} - engines: {node: '>=6.9.0'} - dev: true - - /get-caller-file@2.0.5: - resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} - engines: {node: 6.* || 8.* || >= 10.*} - dev: true - - /get-func-name@2.0.2: - resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} - dev: true - - /get-intrinsic@1.2.2: - resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} - dependencies: - function-bind: 1.1.2 - has-proto: 1.0.1 - has-symbols: 1.0.3 - hasown: 2.0.0 - - /get-pkg-repo@4.2.1: - resolution: {integrity: sha512-2+QbHjFRfGB74v/pYWjd5OhU3TDIC2Gv/YKUTk/tCvAz0pkn/Mz6P3uByuBimLOcPvN2jYdScl3xGFSrx0jEcA==} - engines: {node: '>=6.9.0'} - hasBin: true - dependencies: - '@hutson/parse-repository-url': 3.0.2 - hosted-git-info: 4.1.0 - through2: 2.0.5 - yargs: 16.2.0 - dev: true - - /get-symbol-description@1.0.0: - resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - dev: true - - /git-raw-commits@2.0.11: - resolution: {integrity: sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A==} - engines: {node: '>=10'} - hasBin: true - dependencies: - dargs: 7.0.0 - lodash: 4.17.21 - meow: 8.1.2 - split2: 3.2.2 - through2: 4.0.2 - dev: true - - /git-remote-origin-url@2.0.0: - resolution: {integrity: sha512-eU+GGrZgccNJcsDH5LkXR3PB9M958hxc7sbA8DFJjrv9j4L2P/eZfKhM+QD6wyzpiv+b1BpK0XrYCxkovtjSLw==} - engines: {node: '>=4'} - dependencies: - gitconfiglocal: 1.0.0 - pify: 2.3.0 - dev: true - - /git-semver-tags@4.1.1: - resolution: {integrity: sha512-OWyMt5zBe7xFs8vglMmhM9lRQzCWL3WjHtxNNfJTMngGym7pC1kh8sP6jevfydJ6LP3ZvGxfb6ABYgPUM0mtsA==} - engines: {node: '>=10'} - hasBin: true - dependencies: - meow: 8.1.2 - semver: 6.3.1 - dev: true - - /gitconfiglocal@1.0.0: - resolution: {integrity: sha512-spLUXeTAVHxDtKsJc8FkFVgFtMdEN9qPGpL23VfSHx4fP4+Ds097IXLvymbnDH8FnmxX5Nr9bPw3A+AQ6mWEaQ==} - dependencies: - ini: 1.3.8 - dev: true - - /glob-parent@5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} - dependencies: - is-glob: 4.0.3 - dev: true - - /glob-parent@6.0.2: - resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} - engines: {node: '>=10.13.0'} - dependencies: - is-glob: 4.0.3 - dev: true - - /glob@10.3.10: - resolution: {integrity: sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==} - engines: {node: '>=16 || 14 >=14.17'} - hasBin: true - dependencies: - foreground-child: 3.1.1 - jackspeak: 2.3.6 - minimatch: 9.0.3 - minipass: 7.0.4 - path-scurry: 1.10.1 - dev: true - - /glob@7.2.3: - resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - dev: true - - /globals@11.12.0: - resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} - engines: {node: '>=4'} - dev: true - - /globals@13.23.0: - resolution: {integrity: sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==} - engines: {node: '>=8'} - dependencies: - type-fest: 0.20.2 - dev: true - - /globalthis@1.0.3: - resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==} - engines: {node: '>= 0.4'} - dependencies: - define-properties: 1.2.1 - dev: true - - /globby@11.1.0: - resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} - engines: {node: '>=10'} - dependencies: - array-union: 2.1.0 - dir-glob: 3.0.1 - fast-glob: 3.3.2 - ignore: 5.3.0 - merge2: 1.4.1 - slash: 3.0.0 - dev: true - - /globby@13.2.2: - resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - dir-glob: 3.0.1 - fast-glob: 3.3.2 - ignore: 5.3.0 - merge2: 1.4.1 - slash: 4.0.0 - dev: true - - /gopd@1.0.1: - resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} - dependencies: - get-intrinsic: 1.2.2 - - /graceful-fs@4.2.11: - resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - dev: true - - /graphemer@1.4.0: - resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} - dev: true - - /handlebars@4.7.8: - resolution: {integrity: sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==} - engines: {node: '>=0.4.7'} - hasBin: true - dependencies: - minimist: 1.2.8 - neo-async: 2.6.2 - source-map: 0.6.1 - wordwrap: 1.0.0 - optionalDependencies: - uglify-js: 3.17.4 - dev: true - - /hard-rejection@2.1.0: - resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==} - engines: {node: '>=6'} - dev: true - - /has-bigints@1.0.2: - resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} - dev: true - - /has-flag@3.0.0: - resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} - engines: {node: '>=4'} - dev: true - - /has-flag@4.0.0: - resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} - engines: {node: '>=8'} - dev: true - - /has-own-property@0.1.0: - resolution: {integrity: sha512-14qdBKoonU99XDhWcFKZTShK+QV47qU97u8zzoVo9cL5TZ3BmBHXogItSt9qJjR0KUMFRhcCW8uGIGl8nkl7Aw==} - dev: true - - /has-property-descriptors@1.0.1: - resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} - dependencies: - get-intrinsic: 1.2.2 - - /has-proto@1.0.1: - resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} - engines: {node: '>= 0.4'} - - /has-symbols@1.0.3: - resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} - engines: {node: '>= 0.4'} - - /has-tostringtag@1.0.0: - resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} - engines: {node: '>= 0.4'} - dependencies: - has-symbols: 1.0.3 - dev: true - - /has@1.0.4: - resolution: {integrity: sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==} - engines: {node: '>= 0.4.0'} - dev: true - - /hasown@2.0.0: - resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} - engines: {node: '>= 0.4'} - dependencies: - function-bind: 1.1.2 - - /higlass-register@0.3.0: - resolution: {integrity: sha512-D4I+ATxFuTn+Q6p8Y9rUa+X3b3cqMqhu9Tya6uHtvgV5cs39Mk7i6Z+7PMA8YuwQd5gLMSxCm2lCyWmxRVBQsQ==} - dev: false - - /higlass-text@0.1.6: - resolution: {integrity: sha512-sjAROJfE38bSP72XncPTBV4AeYRs50N85OqRXooEwXF5zKVssBv1EKrvls0ralnSQ1aZX74cB/hTskbI91iRng==} - dependencies: - d3-color: 3.1.0 - d3-scale: 4.0.2 - higlass-register: 0.3.0 - slugid: 3.2.0 - dev: false - - /higlass@1.13.3(pixi.js@6.5.10)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-aZ+Q+ClF1TTeV81ChuGSd5CHiVJf8+1c6w6/sXGAOonkGVQ54yuZpSYafMatKAjytM6/fwSaHs3uQT2xUEE2MA==} - engines: {node: '>=0.12.0'} - peerDependencies: - pixi.js: ^5.0.3 || ^6.5.2 - react: ^16.6.3 || ^17.0.0 || ^18.0.0 - react-dom: ^16.6.3 || ^17.0.0 || ^18.0.0 - dependencies: - ajv: 6.12.6 - box-intersect: 1.0.2 - buffer: 6.0.3 - clsx: 1.2.1 - css-element-queries: 1.2.3 - d3-array: 2.12.1 - d3-axis: 2.1.0 - d3-brush: 2.1.0 - d3-color: 2.0.0 - d3-drag: 2.0.0 - d3-dsv: 2.0.0 - d3-format: 2.0.0 - d3-geo: 2.0.2 - d3-queue: 3.0.7 - d3-request: 1.0.6 - d3-scale: 4.0.2 - d3-selection: 2.0.0 - d3-transition: 3.0.1(d3-selection@2.0.0) - d3-zoom: 3.0.0 - dom-scroll-into-view: 1.2.1 - genbank-parser: 1.2.4 - ndarray: 1.0.19 - pako: 1.0.11 - pixi.js: 6.5.10 - prismjs: 1.29.0 - prop-types: 15.8.1 - pub-sub-es: 2.1.1 - react: 18.2.0 - react-checkbox-tree: 1.8.0(react@18.2.0) - react-color: 2.19.3(react@18.2.0) - react-dom: 18.2.0(react@18.2.0) - react-grid-layout: 0.16.6(react-dom@18.2.0)(react@18.2.0) - react-simple-code-editor: 0.9.15(react-dom@18.2.0)(react@18.2.0) - react-sortable-hoc: 1.11.0(prop-types@15.8.1)(react-dom@18.2.0)(react@18.2.0) - reactcss: 1.2.3(react@18.2.0) - robust-point-in-polygon: 1.0.3 - slugid: 3.2.0 - url-parse: 1.5.10 - vkbeautify: 0.99.3 - dev: false - - /history@4.10.1: - resolution: {integrity: sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==} - dependencies: - '@babel/runtime': 7.23.5 - loose-envify: 1.4.0 - resolve-pathname: 3.0.0 - tiny-invariant: 1.3.1 - tiny-warning: 1.0.3 - value-equal: 1.0.1 - dev: true - - /hoist-non-react-statics@3.3.2: - resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==} - dependencies: - react-is: 16.13.1 - dev: true - - /hosted-git-info@2.8.9: - resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} - dev: true - - /hosted-git-info@4.1.0: - resolution: {integrity: sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==} - engines: {node: '>=10'} - dependencies: - lru-cache: 6.0.0 - dev: true - - /html-encoding-sniffer@3.0.0: - resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==} - engines: {node: '>=12'} - dependencies: - whatwg-encoding: 2.0.0 - dev: true - - /html-escaper@2.0.2: - resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} - dev: true - - /html-to-react@1.7.0(react@18.2.0): - resolution: {integrity: sha512-b5HTNaTGyOj5GGIMiWVr1k57egAZ/vGy0GGefnCQ1VW5hu9+eku8AXHtf2/DeD95cj/FKBKYa1J7SWBOX41yUQ==} - peerDependencies: - react: ^0.13.0 || ^0.14.0 || >=15 - dependencies: - domhandler: 5.0.3 - htmlparser2: 9.0.0 - lodash.camelcase: 4.3.0 - react: 18.2.0 - dev: true - - /html2canvas@1.4.1: - resolution: {integrity: sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==} - engines: {node: '>=8.0.0'} - requiresBuild: true - dependencies: - css-line-break: 2.1.0 - text-segmentation: 1.0.3 - dev: false - optional: true - - /htmlparser2@9.0.0: - resolution: {integrity: sha512-uxbSI98wmFT/G4P2zXx4OVx04qWUmyFPrD2/CNepa2Zo3GPNaCaaxElDgwUrwYWkK1nr9fft0Ya8dws8coDLLQ==} - dependencies: - domelementtype: 2.3.0 - domhandler: 5.0.3 - domutils: 3.1.0 - entities: 4.5.0 - dev: true - - /http-proxy-agent@5.0.0: - resolution: {integrity: sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==} - engines: {node: '>= 6'} - dependencies: - '@tootallnate/once': 2.0.0 - agent-base: 6.0.2 - debug: 4.3.4 - transitivePeerDependencies: - - supports-color - dev: true - - /https-proxy-agent@5.0.1: - resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} - engines: {node: '>= 6'} - dependencies: - agent-base: 6.0.2 - debug: 4.3.4 - transitivePeerDependencies: - - supports-color - dev: true - - /iconv-lite@0.4.24: - resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} - engines: {node: '>=0.10.0'} - dependencies: - safer-buffer: 2.1.2 - dev: false - - /iconv-lite@0.6.3: - resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} - engines: {node: '>=0.10.0'} - dependencies: - safer-buffer: 2.1.2 - dev: true - - /identity-function@1.0.0: - resolution: {integrity: sha512-kNrgUK0qI+9qLTBidsH85HjDLpZfrrS0ElquKKe/fJFdB3D7VeKdXXEvOPDUHSHOzdZKCAAaQIWWyp0l2yq6pw==} - dev: true - - /ieee754@1.2.1: - resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} - dev: false - - /ignore@5.3.0: - resolution: {integrity: sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==} - engines: {node: '>= 4'} - dev: true - - /import-fresh@3.3.0: - resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} - engines: {node: '>=6'} - dependencies: - parent-module: 1.0.1 - resolve-from: 4.0.0 - dev: true - - /imurmurhash@0.1.4: - resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} - engines: {node: '>=0.8.19'} - dev: true - - /indent-string@4.0.0: - resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} - engines: {node: '>=8'} - dev: true - - /inflight@1.0.6: - resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} - dependencies: - once: 1.4.0 - wrappy: 1.0.2 - dev: true - - /inherits@2.0.4: - resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - - /ini@1.3.8: - resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} - dev: true - - /internal-slot@1.0.6: - resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==} - engines: {node: '>= 0.4'} - dependencies: - get-intrinsic: 1.2.2 - hasown: 2.0.0 - side-channel: 1.0.4 - dev: true - - /internmap@1.0.1: - resolution: {integrity: sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==} - dev: false - - /invariant@2.2.4: - resolution: {integrity: sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==} - dependencies: - loose-envify: 1.4.0 - dev: false - - /iota-array@1.0.0: - resolution: {integrity: sha512-pZ2xT+LOHckCatGQ3DcG/a+QuEqvoxqkiL7tvE8nn3uuu+f6i1TtpB5/FtWFbxUuVr5PZCx8KskuGatbJDXOWA==} - dev: false - - /is-alphabetical@1.0.4: - resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==} - dev: true - - /is-alphanumerical@1.0.4: - resolution: {integrity: sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==} - dependencies: - is-alphabetical: 1.0.4 - is-decimal: 1.0.4 - dev: true - - /is-array-buffer@3.0.2: - resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - is-typed-array: 1.1.12 - dev: true - - /is-arrayish@0.2.1: - resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} - dev: true - - /is-async-function@2.0.0: - resolution: {integrity: sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==} - engines: {node: '>= 0.4'} - dependencies: - has-tostringtag: 1.0.0 - dev: true - - /is-bigint@1.0.4: - resolution: {integrity: sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==} - dependencies: - has-bigints: 1.0.2 - dev: true - - /is-boolean-object@1.1.2: - resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 - dev: true - - /is-buffer@1.1.6: - resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==} - dev: false - - /is-buffer@2.0.5: - resolution: {integrity: sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==} - engines: {node: '>=4'} - dev: true - - /is-callable@1.2.7: - resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} - engines: {node: '>= 0.4'} - dev: true - - /is-core-module@2.13.1: - resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} - dependencies: - hasown: 2.0.0 - dev: true - - /is-date-object@1.0.5: - resolution: {integrity: sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==} - engines: {node: '>= 0.4'} - dependencies: - has-tostringtag: 1.0.0 - dev: true - - /is-decimal@1.0.4: - resolution: {integrity: sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==} - dev: true - - /is-extglob@2.1.1: - resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} - engines: {node: '>=0.10.0'} - dev: true - - /is-finalizationregistry@1.0.2: - resolution: {integrity: sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==} - dependencies: - call-bind: 1.0.5 - dev: true - - /is-fullwidth-code-point@3.0.0: - resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} - engines: {node: '>=8'} - dev: true - - /is-generator-function@1.0.10: - resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} - engines: {node: '>= 0.4'} - dependencies: - has-tostringtag: 1.0.0 - dev: true - - /is-glob@4.0.3: - resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} - engines: {node: '>=0.10.0'} - dependencies: - is-extglob: 2.1.1 - dev: true - - /is-hexadecimal@1.0.4: - resolution: {integrity: sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==} - dev: true - - /is-iterable@1.1.1: - resolution: {integrity: sha512-EdOZCr0NsGE00Pot+x1ZFx9MJK3C6wy91geZpXwvwexDLJvA4nzYyZf7r+EIwSeVsOLDdBz7ATg9NqKTzuNYuQ==} - engines: {node: '>= 4'} - dev: true - - /is-map@2.0.2: - resolution: {integrity: sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==} - dev: true - - /is-negative-zero@2.0.2: - resolution: {integrity: sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==} - engines: {node: '>= 0.4'} - dev: true - - /is-number-object@1.0.7: - resolution: {integrity: sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==} - engines: {node: '>= 0.4'} - dependencies: - has-tostringtag: 1.0.0 - dev: true - - /is-number@4.0.0: - resolution: {integrity: sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==} - engines: {node: '>=0.10.0'} - dev: true - - /is-number@7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - dev: true - - /is-obj@2.0.0: - resolution: {integrity: sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==} - engines: {node: '>=8'} - dev: true - - /is-observable@2.1.0: - resolution: {integrity: sha512-DailKdLb0WU+xX8K5w7VsJhapwHLZ9jjmazqCJq4X12CTgqq73TKnbRcnSLuXYPOoLQgV5IrD7ePiX/h1vnkBw==} - engines: {node: '>=8'} - dev: false - - /is-plain-obj@1.1.0: - resolution: {integrity: sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==} - engines: {node: '>=0.10.0'} - dev: true - - /is-plain-obj@2.1.0: - resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} - engines: {node: '>=8'} - dev: true - - /is-potential-custom-element-name@1.0.1: - resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} - dev: true - - /is-regex@1.1.4: - resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 - dev: true - - /is-set@2.0.2: - resolution: {integrity: sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==} - dev: true - - /is-shared-array-buffer@1.0.2: - resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} - dependencies: - call-bind: 1.0.5 - dev: true - - /is-string@1.0.7: - resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} - engines: {node: '>= 0.4'} - dependencies: - has-tostringtag: 1.0.0 - dev: true - - /is-symbol@1.0.4: - resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} - engines: {node: '>= 0.4'} - dependencies: - has-symbols: 1.0.3 - dev: true - - /is-text-path@1.0.1: - resolution: {integrity: sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w==} - engines: {node: '>=0.10.0'} - dependencies: - text-extensions: 1.9.0 - dev: true - - /is-typed-array@1.1.12: - resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} - engines: {node: '>= 0.4'} - dependencies: - which-typed-array: 1.1.13 - dev: true - - /is-weakmap@2.0.1: - resolution: {integrity: sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==} - dev: true - - /is-weakref@1.0.2: - resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} - dependencies: - call-bind: 1.0.5 - dev: true - - /is-weakset@2.0.2: - resolution: {integrity: sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - dev: true - - /isarray@0.0.1: - resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==} - dev: true - - /isarray@1.0.0: - resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} - dev: true - - /isarray@2.0.5: - resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} - dev: true - - /isexe@2.0.0: - resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - dev: true - - /istanbul-lib-coverage@3.2.2: - resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} - engines: {node: '>=8'} - dev: true - - /istanbul-lib-report@3.0.1: - resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} - engines: {node: '>=10'} - dependencies: - istanbul-lib-coverage: 3.2.2 - make-dir: 4.0.0 - supports-color: 7.2.0 - dev: true - - /istanbul-lib-source-maps@4.0.1: - resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} - engines: {node: '>=10'} - dependencies: - debug: 4.3.4 - istanbul-lib-coverage: 3.2.2 - source-map: 0.6.1 - transitivePeerDependencies: - - supports-color - dev: true - - /istanbul-reports@3.1.6: - resolution: {integrity: sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==} - engines: {node: '>=8'} - dependencies: - html-escaper: 2.0.2 - istanbul-lib-report: 3.0.1 - dev: true - - /iterable-lookahead@1.0.0: - resolution: {integrity: sha512-hJnEP2Xk4+44DDwJqUQGdXal5VbyeWLaPyDl2AQc242Zr7iqz4DgpQOrEzglWVMGHMDCkguLHEKxd1+rOsmgSQ==} - engines: {node: '>=4'} - dev: true - - /iterator.prototype@1.1.2: - resolution: {integrity: sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==} - dependencies: - define-properties: 1.2.1 - get-intrinsic: 1.2.2 - has-symbols: 1.0.3 - reflect.getprototypeof: 1.0.4 - set-function-name: 2.0.1 - dev: true - - /jackspeak@2.3.6: - resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} - engines: {node: '>=14'} - dependencies: - '@isaacs/cliui': 8.0.2 - optionalDependencies: - '@pkgjs/parseargs': 0.11.0 - dev: true - - /jest-canvas-mock@2.5.2: - resolution: {integrity: sha512-vgnpPupjOL6+L5oJXzxTxFrlGEIbHdZqFU+LFNdtLxZ3lRDCl17FlTMM7IatoRQkrcyOTMlDinjUguqmQ6bR2A==} - dependencies: - cssfontparser: 1.2.1 - moo-color: 1.0.3 - dev: true - - /jiti@1.21.0: - resolution: {integrity: sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==} - hasBin: true - dev: true - - /js-tokens@4.0.0: - resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - - /js-yaml@4.1.0: - resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} - hasBin: true - dependencies: - argparse: 2.0.1 - dev: true - - /jsdom@19.0.0: - resolution: {integrity: sha512-RYAyjCbxy/vri/CfnjUWJQQtZ3LKlLnDqj+9XLNnJPgEGeirZs3hllKR20re8LUZ6o1b1X4Jat+Qd26zmP41+A==} - engines: {node: '>=12'} - peerDependencies: - canvas: ^2.5.0 - peerDependenciesMeta: - canvas: - optional: true - dependencies: - abab: 2.0.6 - acorn: 8.11.2 - acorn-globals: 6.0.0 - cssom: 0.5.0 - cssstyle: 2.3.0 - data-urls: 3.0.2 - decimal.js: 10.4.3 - domexception: 4.0.0 - escodegen: 2.1.0 - form-data: 4.0.0 - html-encoding-sniffer: 3.0.0 - http-proxy-agent: 5.0.0 - https-proxy-agent: 5.0.1 - is-potential-custom-element-name: 1.0.1 - nwsapi: 2.2.7 - parse5: 6.0.1 - saxes: 5.0.1 - symbol-tree: 3.2.4 - tough-cookie: 4.1.3 - w3c-hr-time: 1.0.2 - w3c-xmlserializer: 3.0.0 - webidl-conversions: 7.0.0 - whatwg-encoding: 2.0.0 - whatwg-mimetype: 3.0.0 - whatwg-url: 10.0.0 - ws: 8.14.2 - xml-name-validator: 4.0.0 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: true - - /jsesc@2.5.2: - resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} - engines: {node: '>=4'} - hasBin: true - dev: true - - /json-buffer@3.0.1: - resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} - dev: true - - /json-parse-better-errors@1.0.2: - resolution: {integrity: sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==} - dev: true - - /json-parse-even-better-errors@2.3.1: - resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} - dev: true - - /json-parse-even-better-errors@3.0.1: - resolution: {integrity: sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - dev: true - - /json-schema-traverse@0.4.1: - resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} - - /json-stable-stringify-without-jsonify@1.0.1: - resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} - dev: true - - /json-stringify-pretty-compact@2.0.0: - resolution: {integrity: sha512-WRitRfs6BGq4q8gTgOy4ek7iPFXjbra0H3PmDLKm2xnZ+Gh1HUhiKGgCZkSPNULlP7mvfu6FV/mOLhCarspADQ==} - dev: false - - /json-stringify-safe@5.0.1: - resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} - dev: true - - /json5@2.2.3: - resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} - engines: {node: '>=6'} - hasBin: true - dev: true - - /jsonc-parser@3.2.0: - resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==} - dev: true - - /jsoncrush@1.1.8: - resolution: {integrity: sha512-lvIMGzMUA0fjuqwNcxlTNRq2bibPZ9auqT/LyGdlR5hvydJtA/BasSgkx4qclqTKVeTidrJvsS/oVjlTCPQ4Nw==} - dev: true - - /jsonparse@1.3.1: - resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} - engines: {'0': node >= 0.2.0} - dev: true - - /jspdf@2.5.1: - resolution: {integrity: sha512-hXObxz7ZqoyhxET78+XR34Xu2qFGrJJ2I2bE5w4SM8eFaFEkW2xcGRVUss360fYelwRSid/jT078kbNvmoW0QA==} - dependencies: - '@babel/runtime': 7.23.5 - atob: 2.1.2 - btoa: 1.2.1 - fflate: 0.4.8 - optionalDependencies: - canvg: 3.0.10 - core-js: 3.33.3 - dompurify: 2.4.7 - html2canvas: 1.4.1 - dev: false - - /jsx-ast-utils@3.3.5: - resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==} - engines: {node: '>=4.0'} - dependencies: - array-includes: 3.1.7 - array.prototype.flat: 1.3.2 - object.assign: 4.1.5 - object.values: 1.1.7 - dev: true - - /keyv@4.5.4: - resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} - dependencies: - json-buffer: 3.0.1 - dev: true - - /kind-of@6.0.3: - resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} - engines: {node: '>=0.10.0'} - dev: true - - /knip@2.30.0: - resolution: {integrity: sha512-tMdBoe7pLMXDSZtQ/wlxbsNG6m4jWu5JmNBvuecJJtnEk+sIp3FNeonZgx6hnPHpORwMGEqEDtSNT2r92MH8Bw==} - engines: {node: '>=16.17.0 <17 || >=18.6.0'} - hasBin: true - dependencies: - '@ericcornelissen/bash-parser': 0.5.2 - '@npmcli/map-workspaces': 3.0.4 - '@snyk/github-codeowners': 1.1.0 - chalk: 5.3.0 - easy-table: 1.2.0 - fast-glob: 3.3.2 - globby: 13.2.2 - jiti: 1.21.0 - js-yaml: 4.1.0 - micromatch: 4.0.5 - minimist: 1.2.8 - pretty-ms: 8.0.0 - strip-json-comments: 5.0.1 - summary: 2.1.0 - typescript: 5.0.2 - zod: 3.22.4 - zod-validation-error: 1.5.0(zod@3.22.4) - dev: true - - /language-subtag-registry@0.3.22: - resolution: {integrity: sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w==} - dev: true - - /language-tags@1.0.5: - resolution: {integrity: sha512-qJhlO9cGXi6hBGKoxEG/sKZDAHD5Hnu9Hs4WbOY3pCWXDhw0N8x1NenNzm2EnNLkLkk7J2SdxAkDSbb6ftT+UQ==} - dependencies: - language-subtag-registry: 0.3.22 - dev: true - - /levn@0.4.1: - resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} - engines: {node: '>= 0.8.0'} - dependencies: - prelude-ls: 1.2.1 - type-check: 0.4.0 - dev: true - - /lines-and-columns@1.2.4: - resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - dev: true - - /load-json-file@4.0.0: - resolution: {integrity: sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==} - engines: {node: '>=4'} - dependencies: - graceful-fs: 4.2.11 - parse-json: 4.0.0 - pify: 3.0.0 - strip-bom: 3.0.0 - dev: true - - /local-pkg@0.4.3: - resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} - engines: {node: '>=14'} - dev: true - - /locate-path@2.0.0: - resolution: {integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==} - engines: {node: '>=4'} - dependencies: - p-locate: 2.0.0 - path-exists: 3.0.0 - dev: true - - /locate-path@5.0.0: - resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} - engines: {node: '>=8'} - dependencies: - p-locate: 4.1.0 - dev: true - - /locate-path@6.0.0: - resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} - engines: {node: '>=10'} - dependencies: - p-locate: 5.0.0 - dev: true - - /lodash-es@4.17.21: - resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} - - /lodash.camelcase@4.3.0: - resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} - dev: true - - /lodash.clamp@4.0.3: - resolution: {integrity: sha512-HvzRFWjtcguTW7yd8NJBshuNaCa8aqNFtnswdT7f/cMd/1YKy5Zzoq4W/Oxvnx9l7aeY258uSdDfM793+eLsVg==} - dev: false - - /lodash.curry@4.1.1: - resolution: {integrity: sha512-/u14pXGviLaweY5JI0IUzgzF2J6Ne8INyzAZjImcryjgkZ+ebruBxy2/JaOOkTqScddcYtakjhSaeemV8lR0tA==} - dev: true - - /lodash.debounce@4.0.8: - resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} - dev: false - - /lodash.isequal@4.5.0: - resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} - dev: false - - /lodash.ismatch@4.4.0: - resolution: {integrity: sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==} - dev: true - - /lodash.merge@4.6.2: - resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} - dev: true - - /lodash@4.17.21: - resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - - /long@4.0.0: - resolution: {integrity: sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==} - dev: false - - /longest-streak@2.0.4: - resolution: {integrity: sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==} - dev: true - - /loose-envify@1.4.0: - resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} - hasBin: true - dependencies: - js-tokens: 4.0.0 - - /loupe@2.3.7: - resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} - dependencies: - get-func-name: 2.0.2 - dev: true - - /lru-cache@10.1.0: - resolution: {integrity: sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==} - engines: {node: 14 || >=16.14} - dev: true - - /lru-cache@5.1.1: - resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} - dependencies: - yallist: 3.1.1 - dev: true - - /lru-cache@6.0.0: - resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} - engines: {node: '>=10'} - dependencies: - yallist: 4.0.0 - dev: true - - /magic-string@0.16.0: - resolution: {integrity: sha512-c4BEos3y6G2qO0B9X7K0FVLOPT9uGrjYwYRLFmDqyl5YMboUviyecnXWp94fJTSMwPw2/sf+CEYt5AGpmklkkQ==} - dependencies: - vlq: 0.2.3 - dev: true - - /magic-string@0.30.5: - resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} - engines: {node: '>=12'} - dependencies: - '@jridgewell/sourcemap-codec': 1.4.15 - dev: true - - /make-dir@4.0.0: - resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} - engines: {node: '>=10'} - dependencies: - semver: 7.5.4 - dev: true - - /map-obj@1.0.1: - resolution: {integrity: sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==} - engines: {node: '>=0.10.0'} - dev: true - - /map-obj@2.0.0: - resolution: {integrity: sha512-TzQSV2DiMYgoF5RycneKVUzIa9bQsj/B3tTgsE3dOGqlzHnGIDaC7XBE7grnA+8kZPnfqSGFe95VHc2oc0VFUQ==} - engines: {node: '>=4'} - dev: true - - /map-obj@4.3.0: - resolution: {integrity: sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==} - engines: {node: '>=8'} - dev: true - - /markdown-table@2.0.0: - resolution: {integrity: sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==} - dependencies: - repeat-string: 1.6.1 - dev: true - - /material-colors@1.2.6: - resolution: {integrity: sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg==} - dev: false - - /mdast-add-list-metadata@1.0.1: - resolution: {integrity: sha512-fB/VP4MJ0LaRsog7hGPxgOrSL3gE/2uEdZyDuSEnKCv/8IkYHiDkIQSbChiJoHyxZZXZ9bzckyRk+vNxFzh8rA==} - dependencies: - unist-util-visit-parents: 1.1.2 - dev: true - - /mdast-util-find-and-replace@1.1.1: - resolution: {integrity: sha512-9cKl33Y21lyckGzpSmEQnIDjEfeeWelN5s1kUW1LwdB0Fkuq2u+4GdqcGEygYxJE8GVqCl0741bYXHgamfWAZA==} - dependencies: - escape-string-regexp: 4.0.0 - unist-util-is: 4.1.0 - unist-util-visit-parents: 3.1.1 - dev: true - - /mdast-util-from-markdown@0.8.5: - resolution: {integrity: sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==} - dependencies: - '@types/mdast': 3.0.15 - mdast-util-to-string: 2.0.0 - micromark: 2.11.4 - parse-entities: 2.0.0 - unist-util-stringify-position: 2.0.3 - transitivePeerDependencies: - - supports-color - dev: true - - /mdast-util-gfm-autolink-literal@0.1.3: - resolution: {integrity: sha512-GjmLjWrXg1wqMIO9+ZsRik/s7PLwTaeCHVB7vRxUwLntZc8mzmTsLVr6HW1yLokcnhfURsn5zmSVdi3/xWWu1A==} - dependencies: - ccount: 1.1.0 - mdast-util-find-and-replace: 1.1.1 - micromark: 2.11.4 - transitivePeerDependencies: - - supports-color - dev: true - - /mdast-util-gfm-strikethrough@0.2.3: - resolution: {integrity: sha512-5OQLXpt6qdbttcDG/UxYY7Yjj3e8P7X16LzvpX8pIQPYJ/C2Z1qFGMmcw+1PZMUM3Z8wt8NRfYTvCni93mgsgA==} - dependencies: - mdast-util-to-markdown: 0.6.5 - dev: true - - /mdast-util-gfm-table@0.1.6: - resolution: {integrity: sha512-j4yDxQ66AJSBwGkbpFEp9uG/LS1tZV3P33fN1gkyRB2LoRL+RR3f76m0HPHaby6F4Z5xr9Fv1URmATlRRUIpRQ==} - dependencies: - markdown-table: 2.0.0 - mdast-util-to-markdown: 0.6.5 - dev: true - - /mdast-util-gfm-task-list-item@0.1.6: - resolution: {integrity: sha512-/d51FFIfPsSmCIRNp7E6pozM9z1GYPIkSy1urQ8s/o4TC22BZ7DqfHFWiqBD23bc7J3vV1Fc9O4QIHBlfuit8A==} - dependencies: - mdast-util-to-markdown: 0.6.5 - dev: true - - /mdast-util-gfm@0.1.2: - resolution: {integrity: sha512-NNkhDx/qYcuOWB7xHUGWZYVXvjPFFd6afg6/e2g+SV4r9q5XUcCbV4Wfa3DLYIiD+xAEZc6K4MGaE/m0KDcPwQ==} - dependencies: - mdast-util-gfm-autolink-literal: 0.1.3 - mdast-util-gfm-strikethrough: 0.2.3 - mdast-util-gfm-table: 0.1.6 - mdast-util-gfm-task-list-item: 0.1.6 - mdast-util-to-markdown: 0.6.5 - transitivePeerDependencies: - - supports-color - dev: true - - /mdast-util-to-markdown@0.6.5: - resolution: {integrity: sha512-XeV9sDE7ZlOQvs45C9UKMtfTcctcaj/pGwH8YLbMHoMOXNNCn2LsqVQOqrF1+/NU8lKDAqozme9SCXWyo9oAcQ==} - dependencies: - '@types/unist': 2.0.10 - longest-streak: 2.0.4 - mdast-util-to-string: 2.0.0 - parse-entities: 2.0.0 - repeat-string: 1.6.1 - zwitch: 1.0.5 - dev: true - - /mdast-util-to-string@2.0.0: - resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==} - dev: true - - /memorystream@0.3.1: - resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==} - engines: {node: '>= 0.10.0'} - dev: true - - /meow@8.1.2: - resolution: {integrity: sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==} - engines: {node: '>=10'} - dependencies: - '@types/minimist': 1.2.5 - camelcase-keys: 6.2.2 - decamelize-keys: 1.1.1 - hard-rejection: 2.1.0 - minimist-options: 4.1.0 - normalize-package-data: 3.0.3 - read-pkg-up: 7.0.1 - redent: 3.0.0 - trim-newlines: 3.0.1 - type-fest: 0.18.1 - yargs-parser: 20.2.9 - dev: true - - /merge2@1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} - dev: true - - /micromark-extension-gfm-autolink-literal@0.5.7: - resolution: {integrity: sha512-ePiDGH0/lhcngCe8FtH4ARFoxKTUelMp4L7Gg2pujYD5CSMb9PbblnyL+AAMud/SNMyusbS2XDSiPIRcQoNFAw==} - dependencies: - micromark: 2.11.4 - transitivePeerDependencies: - - supports-color - dev: true - - /micromark-extension-gfm-strikethrough@0.6.5: - resolution: {integrity: sha512-PpOKlgokpQRwUesRwWEp+fHjGGkZEejj83k9gU5iXCbDG+XBA92BqnRKYJdfqfkrRcZRgGuPuXb7DaK/DmxOhw==} - dependencies: - micromark: 2.11.4 - transitivePeerDependencies: - - supports-color - dev: true - - /micromark-extension-gfm-table@0.4.3: - resolution: {integrity: sha512-hVGvESPq0fk6ALWtomcwmgLvH8ZSVpcPjzi0AjPclB9FsVRgMtGZkUcpE0zgjOCFAznKepF4z3hX8z6e3HODdA==} - dependencies: - micromark: 2.11.4 - transitivePeerDependencies: - - supports-color - dev: true - - /micromark-extension-gfm-tagfilter@0.3.0: - resolution: {integrity: sha512-9GU0xBatryXifL//FJH+tAZ6i240xQuFrSL7mYi8f4oZSbc+NvXjkrHemeYP0+L4ZUT+Ptz3b95zhUZnMtoi/Q==} - dev: true - - /micromark-extension-gfm-task-list-item@0.3.3: - resolution: {integrity: sha512-0zvM5iSLKrc/NQl84pZSjGo66aTGd57C1idmlWmE87lkMcXrTxg1uXa/nXomxJytoje9trP0NDLvw4bZ/Z/XCQ==} - dependencies: - micromark: 2.11.4 - transitivePeerDependencies: - - supports-color - dev: true - - /micromark-extension-gfm@0.3.3: - resolution: {integrity: sha512-oVN4zv5/tAIA+l3GbMi7lWeYpJ14oQyJ3uEim20ktYFAcfX1x3LNlFGGlmrZHt7u9YlKExmyJdDGaTt6cMSR/A==} - dependencies: - micromark: 2.11.4 - micromark-extension-gfm-autolink-literal: 0.5.7 - micromark-extension-gfm-strikethrough: 0.6.5 - micromark-extension-gfm-table: 0.4.3 - micromark-extension-gfm-tagfilter: 0.3.0 - micromark-extension-gfm-task-list-item: 0.3.3 - transitivePeerDependencies: - - supports-color - dev: true - - /micromark@2.11.4: - resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==} - dependencies: - debug: 4.3.4 - parse-entities: 2.0.0 - transitivePeerDependencies: - - supports-color - dev: true - - /micromatch@4.0.5: - resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} - engines: {node: '>=8.6'} - dependencies: - braces: 3.0.2 - picomatch: 2.3.1 - dev: true - - /mime-db@1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - dev: true - - /mime-types@2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} - dependencies: - mime-db: 1.52.0 - dev: true - - /min-indent@1.0.1: - resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} - engines: {node: '>=4'} - dev: true - - /minimatch@3.1.2: - resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} - dependencies: - brace-expansion: 1.1.11 - dev: true - - /minimatch@9.0.3: - resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} - engines: {node: '>=16 || 14 >=14.17'} - dependencies: - brace-expansion: 2.0.1 - dev: true - - /minimist-options@4.1.0: - resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==} - engines: {node: '>= 6'} - dependencies: - arrify: 1.0.1 - is-plain-obj: 1.1.0 - kind-of: 6.0.3 - dev: true - - /minimist@1.2.8: - resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - dev: true - - /minipass@7.0.4: - resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} - engines: {node: '>=16 || 14 >=14.17'} - dev: true - - /mlly@1.4.2: - resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} - dependencies: - acorn: 8.11.2 - pathe: 1.1.1 - pkg-types: 1.0.3 - ufo: 1.3.2 - dev: true - - /modify-values@1.0.1: - resolution: {integrity: sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==} - engines: {node: '>=0.10.0'} - dev: true - - /monaco-editor@0.27.0: - resolution: {integrity: sha512-UhwP78Wb8w0ZSYoKXQNTV/0CHObp6NS3nCt51QfKE6sKyBo5PBsvuDOHoI2ooBakc6uIwByRLHVeT7+yXQe2fQ==} - - /moo-color@1.0.3: - resolution: {integrity: sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ==} - dependencies: - color-name: 1.1.4 - dev: true - - /ms@2.1.2: - resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - - /nanoevents@7.0.1: - resolution: {integrity: sha512-o6lpKiCxLeijK4hgsqfR6CNToPyRU3keKyyI6uwuHRvpRTbZ0wXw51WRgyldVugZqoJfkGFrjrIenYH3bfEO3Q==} - engines: {node: ^14.0.0 || ^16.0.0 || >=18.0.0} - dev: false - - /nanoid@3.3.7: - resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} - engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} - hasBin: true - - /natural-compare-lite@1.4.0: - resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} - dev: true - - /natural-compare@1.4.0: - resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - dev: true - - /ndarray@1.0.19: - resolution: {integrity: sha512-B4JHA4vdyZU30ELBw3g7/p9bZupyew5a7tX1Y/gGeF2hafrPaQZhgrGQfsvgfYbgdFZjYwuEcnaobeM/WMW+HQ==} - dependencies: - iota-array: 1.0.0 - is-buffer: 1.1.6 - dev: false - - /neo-async@2.6.2: - resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} - dev: true - - /nice-try@1.0.5: - resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==} - dev: true - - /node-fetch@2.7.0: - resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} - engines: {node: 4.x || >=6.0.0} - peerDependencies: - encoding: ^0.1.0 - peerDependenciesMeta: - encoding: - optional: true - dependencies: - whatwg-url: 5.0.0 - dev: false - - /node-releases@2.0.14: - resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} - dev: true - - /normalize-package-data@2.5.0: - resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} - dependencies: - hosted-git-info: 2.8.9 - resolve: 1.22.8 - semver: 5.7.2 - validate-npm-package-license: 3.0.4 - dev: true - - /normalize-package-data@3.0.3: - resolution: {integrity: sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==} - engines: {node: '>=10'} - dependencies: - hosted-git-info: 4.1.0 - is-core-module: 2.13.1 - semver: 7.5.4 - validate-npm-package-license: 3.0.4 - dev: true - - /npm-normalize-package-bin@3.0.1: - resolution: {integrity: sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - dev: true - - /npm-run-all@4.1.5: - resolution: {integrity: sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==} - engines: {node: '>= 4'} - hasBin: true - dependencies: - ansi-styles: 3.2.1 - chalk: 2.4.2 - cross-spawn: 6.0.5 - memorystream: 0.3.1 - minimatch: 3.1.2 - pidtree: 0.3.1 - read-pkg: 3.0.0 - shell-quote: 1.8.1 - string.prototype.padend: 3.1.5 - dev: true - - /nwsapi@2.2.7: - resolution: {integrity: sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==} - dev: true - - /object-assign@4.1.1: - resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} - engines: {node: '>=0.10.0'} - - /object-inspect@1.13.1: - resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} - - /object-keys@1.1.1: - resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} - engines: {node: '>= 0.4'} - dev: true - - /object-pairs@0.1.0: - resolution: {integrity: sha512-3ECr6K831I4xX/Mduxr9UC+HPOz/d6WKKYj9p4cmC8Lg8p7g8gitzsxNX5IWlSIgFWN/a4JgrJaoAMKn20oKwA==} - dev: true - - /object-values@1.0.0: - resolution: {integrity: sha512-+8hwcz/JnQ9EpLIXzN0Rs7DLsBpJNT/xYehtB/jU93tHYr5BFEO8E+JGQNOSqE7opVzz5cGksKFHt7uUJVLSjQ==} - engines: {node: '>=0.10.0'} - dev: true - - /object.assign@4.1.5: - resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - has-symbols: 1.0.3 - object-keys: 1.1.1 - dev: true - - /object.entries-ponyfill@1.0.1: - resolution: {integrity: sha512-j0ixssXc5GirDWhB2cLVPsOs9jx61G/iRndyMdToTsjMYY8BQmG1Ke6mwqXmpDiP8icye1YCR94NswNaa/yyzA==} - dev: false - - /object.entries@1.1.7: - resolution: {integrity: sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /object.fromentries@2.0.7: - resolution: {integrity: sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /object.hasown@1.1.3: - resolution: {integrity: sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA==} - dependencies: - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /object.values@1.1.7: - resolution: {integrity: sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /observable-fns@0.6.1: - resolution: {integrity: sha512-9gRK4+sRWzeN6AOewNBTLXir7Zl/i3GB6Yl26gK4flxz8BXVpD3kt8amREmWNb0mxYOGDotvE5a4N+PtGGKdkg==} - dev: false - - /once@1.4.0: - resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - dependencies: - wrappy: 1.0.2 - dev: true - - /optionator@0.9.3: - resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} - engines: {node: '>= 0.8.0'} - dependencies: - '@aashutoshrathi/word-wrap': 1.2.6 - deep-is: 0.1.4 - fast-levenshtein: 2.0.6 - levn: 0.4.1 - prelude-ls: 1.2.1 - type-check: 0.4.0 - dev: true - - /p-limit@1.3.0: - resolution: {integrity: sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==} - engines: {node: '>=4'} - dependencies: - p-try: 1.0.0 - dev: true - - /p-limit@2.3.0: - resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} - engines: {node: '>=6'} - dependencies: - p-try: 2.2.0 - dev: true - - /p-limit@3.1.0: - resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} - engines: {node: '>=10'} - dependencies: - yocto-queue: 0.1.0 - dev: true - - /p-limit@4.0.0: - resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - yocto-queue: 1.0.0 - dev: true - - /p-locate@2.0.0: - resolution: {integrity: sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==} - engines: {node: '>=4'} - dependencies: - p-limit: 1.3.0 - dev: true - - /p-locate@4.1.0: - resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} - engines: {node: '>=8'} - dependencies: - p-limit: 2.3.0 - dev: true - - /p-locate@5.0.0: - resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} - engines: {node: '>=10'} - dependencies: - p-limit: 3.1.0 - dev: true - - /p-map@4.0.0: - resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==} - engines: {node: '>=10'} - dependencies: - aggregate-error: 3.1.0 - dev: true - - /p-try@1.0.0: - resolution: {integrity: sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==} - engines: {node: '>=4'} - dev: true - - /p-try@2.2.0: - resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} - engines: {node: '>=6'} - dev: true - - /pako@1.0.11: - resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==} - dev: false - - /pako@2.1.0: - resolution: {integrity: sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==} - dev: false - - /parent-module@1.0.1: - resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} - engines: {node: '>=6'} - dependencies: - callsites: 3.1.0 - dev: true - - /parse-entities@2.0.0: - resolution: {integrity: sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==} - dependencies: - character-entities: 1.2.4 - character-entities-legacy: 1.1.4 - character-reference-invalid: 1.1.4 - is-alphanumerical: 1.0.4 - is-decimal: 1.0.4 - is-hexadecimal: 1.0.4 - dev: true - - /parse-json@4.0.0: - resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==} - engines: {node: '>=4'} - dependencies: - error-ex: 1.3.2 - json-parse-better-errors: 1.0.2 - dev: true - - /parse-json@5.2.0: - resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} - engines: {node: '>=8'} - dependencies: - '@babel/code-frame': 7.23.5 - error-ex: 1.3.2 - json-parse-even-better-errors: 2.3.1 - lines-and-columns: 1.2.4 - dev: true - - /parse-ms@3.0.0: - resolution: {integrity: sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==} - engines: {node: '>=12'} - dev: true - - /parse5@6.0.1: - resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} - dev: true - - /path-exists@3.0.0: - resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} - engines: {node: '>=4'} - dev: true - - /path-exists@4.0.0: - resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} - engines: {node: '>=8'} - dev: true - - /path-is-absolute@1.0.1: - resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} - engines: {node: '>=0.10.0'} - dev: true - - /path-key@2.0.1: - resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==} - engines: {node: '>=4'} - dev: true - - /path-key@3.1.1: - resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} - engines: {node: '>=8'} - dev: true - - /path-parse@1.0.7: - resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - dev: true - - /path-scurry@1.10.1: - resolution: {integrity: sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==} - engines: {node: '>=16 || 14 >=14.17'} - dependencies: - lru-cache: 10.1.0 - minipass: 7.0.4 - dev: true - - /path-to-regexp@1.8.0: - resolution: {integrity: sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==} - dependencies: - isarray: 0.0.1 - dev: true - - /path-type@3.0.0: - resolution: {integrity: sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==} - engines: {node: '>=4'} - dependencies: - pify: 3.0.0 - dev: true - - /path-type@4.0.0: - resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} - engines: {node: '>=8'} - dev: true - - /pathe@1.1.1: - resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} - dev: true - - /pathval@1.1.1: - resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} - dev: true - - /performance-now@2.1.0: - resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} - requiresBuild: true - dev: false - optional: true - - /picocolors@1.0.0: - resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} - dev: true - - /picomatch@2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} - engines: {node: '>=8.6'} - dev: true - - /pidtree@0.3.1: - resolution: {integrity: sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==} - engines: {node: '>=0.10'} - hasBin: true - dev: true - - /pify@2.3.0: - resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==} - engines: {node: '>=0.10.0'} - dev: true - - /pify@3.0.0: - resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==} - engines: {node: '>=4'} - dev: true - - /pixelmatch@5.3.0: - resolution: {integrity: sha512-o8mkY4E/+LNUf6LzX96ht6k6CEDi65k9G2rjMtBe9Oo+VPKSvl+0GKHuH/AlG+GA5LPG/i5hrekkxUc3s2HU+Q==} - hasBin: true - dependencies: - pngjs: 6.0.0 - dev: true - - /pixi.js@6.5.10: - resolution: {integrity: sha512-Z2mjeoISml2iuVwT1e/BQwERYM2yKoiR08ZdGrg8y5JjeuVptfTrve4DbPMRN/kEDodesgQZGV/pFv0fE9Q2SA==} - dependencies: - '@pixi/accessibility': 6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/utils@6.5.10) - '@pixi/app': 6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10) - '@pixi/compressed-textures': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/loaders@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/constants': 6.5.10 - '@pixi/core': 6.5.10(@pixi/constants@6.5.10)(@pixi/extensions@6.5.10)(@pixi/math@6.5.10)(@pixi/runner@6.5.10)(@pixi/settings@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/display': 6.5.10(@pixi/constants@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/extensions': 6.5.10 - '@pixi/extract': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10) - '@pixi/filter-alpha': 6.5.10(@pixi/core@6.5.10) - '@pixi/filter-blur': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/settings@6.5.10) - '@pixi/filter-color-matrix': 6.5.10(@pixi/core@6.5.10) - '@pixi/filter-displacement': 6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10) - '@pixi/filter-fxaa': 6.5.10(@pixi/core@6.5.10) - '@pixi/filter-noise': 6.5.10(@pixi/core@6.5.10) - '@pixi/graphics': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) - '@pixi/interaction': 6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/loaders': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/utils@6.5.10) - '@pixi/math': 6.5.10 - '@pixi/mesh': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/mesh-extras': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/mesh@6.5.10)(@pixi/utils@6.5.10) - '@pixi/mixin-cache-as-bitmap': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) - '@pixi/mixin-get-child-by-name': 6.5.10(@pixi/display@6.5.10) - '@pixi/mixin-get-global-position': 6.5.10(@pixi/display@6.5.10)(@pixi/math@6.5.10) - '@pixi/particle-container': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) - '@pixi/polyfill': 6.5.10 - '@pixi/prepare': 6.5.10(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/graphics@6.5.10)(@pixi/settings@6.5.10)(@pixi/text@6.5.10)(@pixi/ticker@6.5.10)(@pixi/utils@6.5.10) - '@pixi/runner': 6.5.10 - '@pixi/settings': 6.5.10(@pixi/constants@6.5.10) - '@pixi/sprite': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/utils@6.5.10) - '@pixi/sprite-animated': 6.5.10(@pixi/core@6.5.10)(@pixi/sprite@6.5.10)(@pixi/ticker@6.5.10) - '@pixi/sprite-tiling': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/math@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) - '@pixi/spritesheet': 6.5.10(@pixi/core@6.5.10)(@pixi/loaders@6.5.10)(@pixi/math@6.5.10)(@pixi/utils@6.5.10) - '@pixi/text': 6.5.10(@pixi/core@6.5.10)(@pixi/math@6.5.10)(@pixi/settings@6.5.10)(@pixi/sprite@6.5.10)(@pixi/utils@6.5.10) - '@pixi/text-bitmap': 6.5.10(@pixi/constants@6.5.10)(@pixi/core@6.5.10)(@pixi/display@6.5.10)(@pixi/loaders@6.5.10)(@pixi/math@6.5.10)(@pixi/mesh@6.5.10)(@pixi/settings@6.5.10)(@pixi/text@6.5.10)(@pixi/utils@6.5.10) - '@pixi/ticker': 6.5.10(@pixi/extensions@6.5.10)(@pixi/settings@6.5.10) - '@pixi/utils': 6.5.10(@pixi/constants@6.5.10)(@pixi/settings@6.5.10) - - /pkg-types@1.0.3: - resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} - dependencies: - jsonc-parser: 3.2.0 - mlly: 1.4.2 - pathe: 1.1.1 - dev: true - - /playwright-core@1.40.1: - resolution: {integrity: sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ==} - engines: {node: '>=16'} - hasBin: true - dev: true - - /playwright@1.40.1: - resolution: {integrity: sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==} - engines: {node: '>=16'} - hasBin: true - dependencies: - playwright-core: 1.40.1 - optionalDependencies: - fsevents: 2.3.2 - dev: true - - /pngjs@6.0.0: - resolution: {integrity: sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==} - engines: {node: '>=12.13.0'} - dev: true - - /pngjs@7.0.0: - resolution: {integrity: sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==} - engines: {node: '>=14.19.0'} - dev: true - - /postcss@8.4.32: - resolution: {integrity: sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==} - engines: {node: ^10 || ^12 || >=14} - dependencies: - nanoid: 3.3.7 - picocolors: 1.0.0 - source-map-js: 1.0.2 - dev: true - - /prelude-ls@1.2.1: - resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} - engines: {node: '>= 0.8.0'} - dev: true - - /prettier-linter-helpers@1.0.0: - resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} - engines: {node: '>=6.0.0'} - dependencies: - fast-diff: 1.3.0 - dev: true - - /prettier@2.8.8: - resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} - engines: {node: '>=10.13.0'} - hasBin: true - dev: true - - /pretty-format@29.7.0: - resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/schemas': 29.6.3 - ansi-styles: 5.2.0 - react-is: 18.2.0 - dev: true - - /pretty-ms@8.0.0: - resolution: {integrity: sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==} - engines: {node: '>=14.16'} - dependencies: - parse-ms: 3.0.0 - dev: true - - /prismjs@1.29.0: - resolution: {integrity: sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==} - engines: {node: '>=6'} - dev: false - - /process-nextick-args@2.0.1: - resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} - dev: true - - /promise-polyfill@8.3.0: - resolution: {integrity: sha512-H5oELycFml5yto/atYqmjyigJoAo3+OXwolYiH7OfQuYlAqhxNvTfiNMbV9hsC6Yp83yE5r2KTVmtrG6R9i6Pg==} - - /prop-types@15.8.1: - resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} - dependencies: - loose-envify: 1.4.0 - object-assign: 4.1.1 - react-is: 16.13.1 - - /psl@1.9.0: - resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} - dev: true - - /pub-sub-es@2.1.1: - resolution: {integrity: sha512-qOnqlAvQ26hTK0GdieSGC991oDrN0x6W2XacvU5zbarVAWGvKt+esEl3UOXxBY23vE5Vgs1InmmVH3HDanjrPQ==} - dev: false - - /pubsub-js@1.9.4: - resolution: {integrity: sha512-hJYpaDvPH4w8ZX/0Fdf9ma1AwRgU353GfbaVfPjfJQf1KxZ2iHaHl3fAUw1qlJIR5dr4F3RzjGaWohYUEyoh7A==} - dev: false - - /punycode@1.4.1: - resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==} - - /punycode@2.3.1: - resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} - engines: {node: '>=6'} - - /q@1.5.1: - resolution: {integrity: sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==} - engines: {node: '>=0.6.0', teleport: '>=0.2.0'} - dev: true - - /qs@6.11.2: - resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} - engines: {node: '>=0.6'} - dependencies: - side-channel: 1.0.4 - - /querystringify@2.2.0: - resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} - - /queue-microtask@1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - dev: true - - /quick-lru@2.0.0: - resolution: {integrity: sha512-DqOtZziv7lDjEyuqyVQacRciAwMCEjTNrLYCHYEIIgjcE/tLEpBF82hiDIwCjRnEL9/hY2GJxA0T8ZvYvVVSSA==} - engines: {node: '>=6'} - dev: false - - /quick-lru@4.0.1: - resolution: {integrity: sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==} - engines: {node: '>=8'} - - /quick-lru@6.1.2: - resolution: {integrity: sha512-AAFUA5O1d83pIHEhJwWCq/RQcRukCkn/NSm2QsTEMle5f2hP0ChI2+3Xb051PZCkLryI/Ir1MVKviT2FIloaTQ==} - engines: {node: '>=12'} - dev: false - - /quickselect@2.0.0: - resolution: {integrity: sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==} - dev: false - - /raf-schd@4.0.3: - resolution: {integrity: sha512-tQkJl2GRWh83ui2DiPTJz9wEiMN20syf+5oKfB03yYP7ioZcJwsIK8FjrtLwH1m7C7e+Tt2yYBlrOpdT+dyeIQ==} - dev: true - - /raf@3.4.1: - resolution: {integrity: sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==} - requiresBuild: true - dependencies: - performance-now: 2.1.0 - dev: false - optional: true - - /rbush@3.0.1: - resolution: {integrity: sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==} - dependencies: - quickselect: 2.0.0 - dev: false - - /react-checkbox-tree@1.8.0(react@18.2.0): - resolution: {integrity: sha512-ufC4aorihOvjLpvY1beab2hjVLGZbDTFRzw62foG0+th+KX7e/sdmWu/nD1ZS/U5Yr0rWGwedGH5GOtR0IkUXw==} - peerDependencies: - react: ^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 - dependencies: - classnames: 2.3.2 - lodash: 4.17.21 - nanoid: 3.3.7 - prop-types: 15.8.1 - react: 18.2.0 - dev: false - - /react-color@2.19.3(react@18.2.0): - resolution: {integrity: sha512-LEeGE/ZzNLIsFWa1TMe8y5VYqr7bibneWmvJwm1pCn/eNmrabWDh659JSPn9BuaMpEfU83WTOJfnCcjDZwNQTA==} - peerDependencies: - react: '*' - dependencies: - '@icons/material': 0.2.4(react@18.2.0) - lodash: 4.17.21 - lodash-es: 4.17.21 - material-colors: 1.2.6 - prop-types: 15.8.1 - react: 18.2.0 - reactcss: 1.2.3(react@18.2.0) - tinycolor2: 1.6.0 - dev: false - - /react-dom@18.2.0(react@18.2.0): - resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} - peerDependencies: - react: ^18.2.0 - dependencies: - loose-envify: 1.4.0 - react: 18.2.0 - scheduler: 0.23.0 - - /react-draggable@3.3.2(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-oaz8a6enjbPtx5qb0oDWxtDNuybOylvto1QLydsXgKmwT7e3GXC2eMVDwEMIUYJIFqVG72XpOv673UuuAq6LhA==} - peerDependencies: - react: '>= 16.3.0' - react-dom: '>= 16.3.0' - dependencies: - classnames: 2.3.2 - prop-types: 15.8.1 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - dev: false - - /react-draggable@4.4.6(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-LtY5Xw1zTPqHkVmtM3X8MUOxNDOUhv/khTgBgrUvwaS064bwVvxT+q5El0uUFNx5IEPKXuRejr7UqLwBIg5pdw==} - peerDependencies: - react: '>= 16.3.0' - react-dom: '>= 16.3.0' - dependencies: - clsx: 1.2.1 - prop-types: 15.8.1 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - dev: false - - /react-grid-layout@0.16.6(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-h2EsYgsqcESLJeevQSJsEKp8hhh+phOlXDJoMhlV2e7T3VWQL+S6iCF3iD/LK19r4oyRyOMDEir0KV+eLXrAyw==} - dependencies: - classnames: 2.3.2 - lodash.isequal: 4.5.0 - prop-types: 15.8.1 - react-draggable: 3.3.2(react-dom@18.2.0)(react@18.2.0) - react-resizable: 1.11.1(react-dom@18.2.0)(react@18.2.0) - transitivePeerDependencies: - - react - - react-dom - dev: false - - /react-is@16.13.1: - resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} - - /react-is@18.2.0: - resolution: {integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==} - dev: true - - /react-markdown@5.0.3(@types/react@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-jDWOc1AvWn0WahpjW6NK64mtx6cwjM4iSsLHJPNBqoAgGOVoIdJMqaKX4++plhOtdd4JksdqzlDibgPx6B/M2w==} - peerDependencies: - '@types/react': '>=16' - react: '>=16' - dependencies: - '@types/mdast': 3.0.15 - '@types/react': 18.2.0 - '@types/unist': 2.0.10 - html-to-react: 1.7.0(react@18.2.0) - mdast-add-list-metadata: 1.0.1 - prop-types: 15.8.1 - react: 18.2.0 - react-is: 16.13.1 - remark-parse: 9.0.0 - unified: 9.2.2 - unist-util-visit: 2.0.3 - xtend: 4.0.2 - transitivePeerDependencies: - - supports-color - dev: true - - /react-monaco-editor@0.45.0(@types/react@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-QgAFXdXm5e9QRCnjFBt5fHqmUWL2qIMHZuZSLR6rU9E3Bbo2pQO7FSqgVmB5trc5U+hs7KdIWVoWIOzQvZMu3w==} - peerDependencies: - '@types/react': ^17.x - react: ^17.x - dependencies: - '@types/react': 18.2.0 - monaco-editor: 0.27.0 - prop-types: 15.8.1 - react: 18.2.0 - dev: true - - /react-refresh@0.14.0: - resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==} - engines: {node: '>=0.10.0'} - dev: true - - /react-resizable@1.11.1(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-S70gbLaAYqjuAd49utRHibtHLrHXInh7GuOR+6OO6RO6uleQfuBnWmZjRABfqNEx3C3Z6VPLg0/0uOYFrkfu9Q==} - peerDependencies: - react: 0.14.x || 15.x || 16.x || 17.x - react-dom: 0.14.x || 15.x || 16.x || 17.x - dependencies: - prop-types: 15.8.1 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - react-draggable: 4.4.6(react-dom@18.2.0)(react@18.2.0) - dev: false - - /react-resize-detector@4.2.3(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-4AeS6lxdz2KOgDZaOVt1duoDHrbYwSrUX32KeM9j6t9ISyRphoJbTRCMS1aPFxZHFqcCGLT1gMl3lEcSWZNW0A==} - peerDependencies: - react: ^16.0.0 - react-dom: ^16.0.0 - dependencies: - lodash: 4.17.21 - lodash-es: 4.17.21 - prop-types: 15.8.1 - raf-schd: 4.0.3 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - resize-observer-polyfill: 1.5.1 - dev: true - - /react-router-dom@5.3.4(react@18.2.0): - resolution: {integrity: sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ==} - peerDependencies: - react: '>=15' - dependencies: - '@babel/runtime': 7.23.5 - history: 4.10.1 - loose-envify: 1.4.0 - prop-types: 15.8.1 - react: 18.2.0 - react-router: 5.3.4(react@18.2.0) - tiny-invariant: 1.3.1 - tiny-warning: 1.0.3 - dev: true - - /react-router@5.3.4(react@18.2.0): - resolution: {integrity: sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA==} - peerDependencies: - react: '>=15' - dependencies: - '@babel/runtime': 7.23.5 - history: 4.10.1 - hoist-non-react-statics: 3.3.2 - loose-envify: 1.4.0 - path-to-regexp: 1.8.0 - prop-types: 15.8.1 - react: 18.2.0 - react-is: 16.13.1 - tiny-invariant: 1.3.1 - tiny-warning: 1.0.3 - dev: true - - /react-simple-code-editor@0.9.15(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-M8iKgjBTBZK92tZYgOEfMuR7c3zZ0q0v3QYllSxIPx3SU+w003VofH50txXQSBTu92pSOm2tidON1HbQ1l8BDA==} - peerDependencies: - react: ^16.0.0 - react-dom: ^16.0.0 - dependencies: - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - dev: false - - /react-sortable-hoc@1.11.0(prop-types@15.8.1)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-v1CDCvdfoR3zLGNp6qsBa4J1BWMEVH25+UKxF/RvQRh+mrB+emqtVHMgZ+WreUiKJoEaiwYoScaueIKhMVBHUg==} - peerDependencies: - prop-types: ^15.5.7 - react: ^0.14.0 || ^15.0.0 || ^16.0.0 - react-dom: ^0.14.0 || ^15.0.0 || ^16.0.0 - dependencies: - '@babel/runtime': 7.23.5 - invariant: 2.2.4 - prop-types: 15.8.1 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - dev: false - - /react@18.2.0: - resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} - engines: {node: '>=0.10.0'} - dependencies: - loose-envify: 1.4.0 - - /reactcss@1.2.3(react@18.2.0): - resolution: {integrity: sha512-KiwVUcFu1RErkI97ywr8nvx8dNOpT03rbnma0SSalTYjkrPYaEajR4a/MRt6DZ46K6arDRbWMNHF+xH7G7n/8A==} - peerDependencies: - react: '*' - dependencies: - lodash: 4.17.21 - react: 18.2.0 - dev: false - - /read-package-json-fast@3.0.2: - resolution: {integrity: sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - dependencies: - json-parse-even-better-errors: 3.0.1 - npm-normalize-package-bin: 3.0.1 - dev: true - - /read-pkg-up@3.0.0: - resolution: {integrity: sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw==} - engines: {node: '>=4'} - dependencies: - find-up: 2.1.0 - read-pkg: 3.0.0 - dev: true - - /read-pkg-up@7.0.1: - resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==} - engines: {node: '>=8'} - dependencies: - find-up: 4.1.0 - read-pkg: 5.2.0 - type-fest: 0.8.1 - dev: true - - /read-pkg@3.0.0: - resolution: {integrity: sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==} - engines: {node: '>=4'} - dependencies: - load-json-file: 4.0.0 - normalize-package-data: 2.5.0 - path-type: 3.0.0 - dev: true - - /read-pkg@5.2.0: - resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==} - engines: {node: '>=8'} - dependencies: - '@types/normalize-package-data': 2.4.4 - normalize-package-data: 2.5.0 - parse-json: 5.2.0 - type-fest: 0.6.0 - dev: true - - /readable-stream@2.3.8: - resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} - dependencies: - core-util-is: 1.0.3 - inherits: 2.0.4 - isarray: 1.0.0 - process-nextick-args: 2.0.1 - safe-buffer: 5.1.2 - string_decoder: 1.1.1 - util-deprecate: 1.0.2 - dev: true - - /readable-stream@3.6.2: - resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} - engines: {node: '>= 6'} - dependencies: - inherits: 2.0.4 - string_decoder: 1.3.0 - util-deprecate: 1.0.2 - - /redent@3.0.0: - resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} - engines: {node: '>=8'} - dependencies: - indent-string: 4.0.0 - strip-indent: 3.0.0 - dev: true - - /reflect.getprototypeof@1.0.4: - resolution: {integrity: sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - get-intrinsic: 1.2.2 - globalthis: 1.0.3 - which-builtin-type: 1.1.3 - dev: true - - /regenerator-runtime@0.13.11: - resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==} - requiresBuild: true - dev: false - optional: true - - /regenerator-runtime@0.14.0: - resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==} - - /regexp.prototype.flags@1.5.1: - resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - set-function-name: 2.0.1 - dev: true - - /regexpp@3.2.0: - resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==} - engines: {node: '>=8'} - dev: true - - /remark-gfm@1.0.0: - resolution: {integrity: sha512-KfexHJCiqvrdBZVbQ6RopMZGwaXz6wFJEfByIuEwGf0arvITHjiKKZ1dpXujjH9KZdm1//XJQwgfnJ3lmXaDPA==} - dependencies: - mdast-util-gfm: 0.1.2 - micromark-extension-gfm: 0.3.3 - transitivePeerDependencies: - - supports-color - dev: true - - /remark-parse@9.0.0: - resolution: {integrity: sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==} - dependencies: - mdast-util-from-markdown: 0.8.5 - transitivePeerDependencies: - - supports-color - dev: true - - /repeat-string@1.6.1: - resolution: {integrity: sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==} - engines: {node: '>=0.10'} - dev: true - - /require-directory@2.1.1: - resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} - engines: {node: '>=0.10.0'} - dev: true - - /requires-port@1.0.0: - resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} - - /resize-observer-polyfill@1.5.1: - resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==} - dev: true - - /resolve-from@4.0.0: - resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} - engines: {node: '>=4'} - dev: true - - /resolve-pathname@3.0.0: - resolution: {integrity: sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==} - dev: true - - /resolve@1.22.8: - resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} - hasBin: true - dependencies: - is-core-module: 2.13.1 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - dev: true - - /resolve@2.0.0-next.5: - resolution: {integrity: sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==} - hasBin: true - dependencies: - is-core-module: 2.13.1 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - dev: true - - /reusify@1.0.4: - resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - dev: true - - /reverse-arguments@1.0.0: - resolution: {integrity: sha512-/x8uIPdTafBqakK0TmPNJzgkLP+3H+yxpUJhCQHsLBg1rYEVNR2D8BRYNWQhVBjyOd7oo1dZRVzIkwMY2oqfYQ==} - dev: true - - /rgbcolor@1.0.1: - resolution: {integrity: sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==} - engines: {node: '>= 0.8.15'} - requiresBuild: true - dev: false - optional: true - - /rimraf@3.0.2: - resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} - hasBin: true - dependencies: - glob: 7.2.3 - dev: true - - /robust-orientation@1.2.1: - resolution: {integrity: sha512-FuTptgKwY6iNuU15nrIJDLjXzCChWB+T4AvksRtwPS/WZ3HuP1CElCm1t+OBfgQKfWbtZIawip+61k7+buRKAg==} - dependencies: - robust-scale: 1.0.2 - robust-subtract: 1.0.0 - robust-sum: 1.0.0 - two-product: 1.0.2 - dev: false - - /robust-point-in-polygon@1.0.3: - resolution: {integrity: sha512-pPzz7AevOOcPYnFv4Vs5L0C7BKOq6C/TfAw5EUE58CylbjGiPyMjAnPLzzSuPZ2zftUGwWbmLWPOjPOz61tAcA==} - dependencies: - robust-orientation: 1.2.1 - dev: false - - /robust-scale@1.0.2: - resolution: {integrity: sha512-jBR91a/vomMAzazwpsPTPeuTPPmWBacwA+WYGNKcRGSh6xweuQ2ZbjRZ4v792/bZOhRKXRiQH0F48AvuajY0tQ==} - dependencies: - two-product: 1.0.2 - two-sum: 1.0.0 - dev: false - - /robust-subtract@1.0.0: - resolution: {integrity: sha512-xhKUno+Rl+trmxAIVwjQMiVdpF5llxytozXJOdoT4eTIqmqsndQqFb1A0oiW3sZGlhMRhOi6pAD4MF1YYW6o/A==} - dev: false - - /robust-sum@1.0.0: - resolution: {integrity: sha512-AvLExwpaqUqD1uwLU6MwzzfRdaI6VEZsyvQ3IAQ0ZJ08v1H+DTyqskrf2ZJyh0BDduFVLN7H04Zmc+qTiahhAw==} - dev: false - - /rollup@3.29.4: - resolution: {integrity: sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==} - engines: {node: '>=14.18.0', npm: '>=8.0.0'} - hasBin: true - optionalDependencies: - fsevents: 2.3.3 - dev: true - - /run-parallel@1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - dependencies: - queue-microtask: 1.2.3 - dev: true - - /rw@1.3.3: - resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==} - dev: false - - /rxjs@7.8.1: - resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} - dependencies: - tslib: 2.6.2 - dev: false - - /safe-array-concat@1.0.1: - resolution: {integrity: sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==} - engines: {node: '>=0.4'} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - has-symbols: 1.0.3 - isarray: 2.0.5 - dev: true - - /safe-buffer@5.1.2: - resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} - dev: true - - /safe-buffer@5.2.1: - resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - - /safe-regex-test@1.0.0: - resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - is-regex: 1.1.4 - dev: true - - /safe-stable-stringify@2.4.3: - resolution: {integrity: sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==} - engines: {node: '>=10'} - dev: true - - /safer-buffer@2.1.2: - resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - - /saxes@5.0.1: - resolution: {integrity: sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==} - engines: {node: '>=10'} - dependencies: - xmlchars: 2.2.0 - dev: true - - /scheduler@0.23.0: - resolution: {integrity: sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==} - dependencies: - loose-envify: 1.4.0 - - /semver@5.7.2: - resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==} - hasBin: true - dev: true - - /semver@6.3.1: - resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} - hasBin: true - dev: true - - /semver@7.5.4: - resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} - engines: {node: '>=10'} - hasBin: true - dependencies: - lru-cache: 6.0.0 - dev: true - - /set-function-length@1.1.1: - resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} - engines: {node: '>= 0.4'} - dependencies: - define-data-property: 1.1.1 - get-intrinsic: 1.2.2 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - - /set-function-name@2.0.1: - resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} - engines: {node: '>= 0.4'} - dependencies: - define-data-property: 1.1.1 - functions-have-names: 1.2.3 - has-property-descriptors: 1.0.1 - dev: true - - /shebang-command@1.2.0: - resolution: {integrity: sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==} - engines: {node: '>=0.10.0'} - dependencies: - shebang-regex: 1.0.0 - dev: true - - /shebang-command@2.0.0: - resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} - engines: {node: '>=8'} - dependencies: - shebang-regex: 3.0.0 - dev: true - - /shebang-regex@1.0.0: - resolution: {integrity: sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==} - engines: {node: '>=0.10.0'} - dev: true - - /shebang-regex@3.0.0: - resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} - engines: {node: '>=8'} - dev: true - - /shell-quote-word@1.0.1: - resolution: {integrity: sha512-lT297f1WLAdq0A4O+AknIFRP6kkiI3s8C913eJ0XqBxJbZPGWUNkRQk2u8zk4bEAjUJ5i+fSLwB6z1HzeT+DEg==} - dev: true - - /shell-quote@1.8.1: - resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} - dev: true - - /side-channel@1.0.4: - resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - object-inspect: 1.13.1 - - /siginfo@2.0.0: - resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} - dev: true - - /signal-exit@3.0.7: - resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} - dev: true - - /signal-exit@4.1.0: - resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} - engines: {node: '>=14'} - dev: true - - /slash@3.0.0: - resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} - engines: {node: '>=8'} - dev: true - - /slash@4.0.0: - resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} - engines: {node: '>=12'} - dev: true - - /slugid@3.2.0: - resolution: {integrity: sha512-f0vZb6VyjUdZG5kaxd9CNpfhy+eUUTC8RnbDolC3ZLjYa7n5AdPkQnqnIjmoZYoPS9dWMOXQdoBREAGQqdZb9A==} - engines: {node: '>=6.0'} - dependencies: - uuid: 8.3.2 - dev: false - - /source-map-js@1.0.2: - resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} - engines: {node: '>=0.10.0'} - dev: true - - /source-map@0.6.1: - resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} - engines: {node: '>=0.10.0'} - dev: true - - /spdx-correct@3.2.0: - resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==} - dependencies: - spdx-expression-parse: 3.0.1 - spdx-license-ids: 3.0.16 - dev: true - - /spdx-exceptions@2.3.0: - resolution: {integrity: sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==} - dev: true - - /spdx-expression-parse@3.0.1: - resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==} - dependencies: - spdx-exceptions: 2.3.0 - spdx-license-ids: 3.0.16 - dev: true - - /spdx-license-ids@3.0.16: - resolution: {integrity: sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==} - dev: true - - /split2@3.2.2: - resolution: {integrity: sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==} - dependencies: - readable-stream: 3.6.2 - dev: true - - /split@1.0.1: - resolution: {integrity: sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==} - dependencies: - through: 2.3.8 - dev: true - - /stackback@0.0.2: - resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} - dev: true - - /stackblur-canvas@2.6.0: - resolution: {integrity: sha512-8S1aIA+UoF6erJYnglGPug6MaHYGo1Ot7h5fuXx4fUPvcvQfcdw2o/ppCse63+eZf8PPidSu4v1JnmEVtEDnpg==} - engines: {node: '>=0.1.14'} - requiresBuild: true - dev: false - optional: true - - /std-env@3.6.0: - resolution: {integrity: sha512-aFZ19IgVmhdB2uX599ve2kE6BIE3YMnQ6Gp6BURhW/oIzpXGKr878TQfAQZn1+i0Flcc/UKUy1gOlcfaUBCryg==} - dev: true - - /stream-browserify@3.0.0: - resolution: {integrity: sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==} - dependencies: - inherits: 2.0.4 - readable-stream: 3.6.2 - dev: false - - /string-width@4.2.3: - resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} - engines: {node: '>=8'} - dependencies: - emoji-regex: 8.0.0 - is-fullwidth-code-point: 3.0.0 - strip-ansi: 6.0.1 - dev: true - - /string-width@5.1.2: - resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} - engines: {node: '>=12'} - dependencies: - eastasianwidth: 0.2.0 - emoji-regex: 9.2.2 - strip-ansi: 7.1.0 - dev: true - - /string.fromcodepoint@0.2.1: - resolution: {integrity: sha512-n69H31OnxSGSZyZbgBlvYIXlrMhJQ0dQAX1js1QDhpaUH6zmU3QYlj07bCwCNlPOu3oRXIubGPl2gDGnHsiCqg==} - dev: true - - /string.prototype.matchall@4.0.10: - resolution: {integrity: sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ==} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - get-intrinsic: 1.2.2 - has-symbols: 1.0.3 - internal-slot: 1.0.6 - regexp.prototype.flags: 1.5.1 - set-function-name: 2.0.1 - side-channel: 1.0.4 - dev: true - - /string.prototype.padend@3.1.5: - resolution: {integrity: sha512-DOB27b/2UTTD+4myKUFh+/fXWcu/UDyASIXfg+7VzoCNNGOfWvoyU/x5pvVHr++ztyt/oSYI1BcWBBG/hmlNjA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /string.prototype.trim@1.2.8: - resolution: {integrity: sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /string.prototype.trimend@1.0.7: - resolution: {integrity: sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /string.prototype.trimstart@1.0.7: - resolution: {integrity: sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /string_decoder@1.1.1: - resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} - dependencies: - safe-buffer: 5.1.2 - dev: true - - /string_decoder@1.3.0: - resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} - dependencies: - safe-buffer: 5.2.1 - - /strip-ansi@6.0.1: - resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} - engines: {node: '>=8'} - dependencies: - ansi-regex: 5.0.1 - dev: true - - /strip-ansi@7.1.0: - resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} - engines: {node: '>=12'} - dependencies: - ansi-regex: 6.0.1 - dev: true - - /strip-bom@3.0.0: - resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} - engines: {node: '>=4'} - dev: true - - /strip-indent@3.0.0: - resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==} - engines: {node: '>=8'} - dependencies: - min-indent: 1.0.1 - dev: true - - /strip-json-comments@3.1.1: - resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} - engines: {node: '>=8'} - dev: true - - /strip-json-comments@5.0.1: - resolution: {integrity: sha512-0fk9zBqO67Nq5M/m45qHCJxylV/DhBlIOVExqgOMiCCrzrhU6tCibRXNqE3jwJLftzE9SNuZtYbpzcO+i9FiKw==} - engines: {node: '>=14.16'} - dev: true - - /strip-literal@1.3.0: - resolution: {integrity: sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==} - dependencies: - acorn: 8.11.2 - dev: true - - /summary@2.1.0: - resolution: {integrity: sha512-nMIjMrd5Z2nuB2RZCKJfFMjgS3fygbeyGk9PxPPaJR1RIcyN9yn4A63Isovzm3ZtQuEkLBVgMdPup8UeLH7aQw==} - dev: true - - /supports-color@5.5.0: - resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} - engines: {node: '>=4'} - dependencies: - has-flag: 3.0.0 - dev: true - - /supports-color@7.2.0: - resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} - engines: {node: '>=8'} - dependencies: - has-flag: 4.0.0 - dev: true - - /supports-preserve-symlinks-flag@1.0.0: - resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} - engines: {node: '>= 0.4'} - dev: true - - /svg-pathdata@6.0.3: - resolution: {integrity: sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==} - engines: {node: '>=12.0.0'} - requiresBuild: true - dev: false - optional: true - - /symbol-tree@3.2.4: - resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} - dev: true - - /temp-dir@2.0.0: - resolution: {integrity: sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==} - engines: {node: '>=8'} - dev: true - - /tempfile@3.0.0: - resolution: {integrity: sha512-uNFCg478XovRi85iD42egu+eSFUmmka750Jy7L5tfHI5hQKKtbPnxaSaXAbBqCDYrw3wx4tXjKwci4/QmsZJxw==} - engines: {node: '>=8'} - dependencies: - temp-dir: 2.0.0 - uuid: 3.4.0 - dev: true - - /test-exclude@6.0.0: - resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} - engines: {node: '>=8'} - dependencies: - '@istanbuljs/schema': 0.1.3 - glob: 7.2.3 - minimatch: 3.1.2 - dev: true - - /text-extensions@1.9.0: - resolution: {integrity: sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==} - engines: {node: '>=0.10'} - dev: true - - /text-segmentation@1.0.3: - resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==} - requiresBuild: true - dependencies: - utrie: 1.0.2 - dev: false - optional: true - - /text-table@0.2.0: - resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - dev: true - - /threads@1.7.0: - resolution: {integrity: sha512-Mx5NBSHX3sQYR6iI9VYbgHKBLisyB+xROCBGjjWm1O9wb9vfLxdaGtmT/KCjUqMsSNW6nERzCW3T6H43LqjDZQ==} - dependencies: - callsites: 3.1.0 - debug: 4.3.4 - is-observable: 2.1.0 - observable-fns: 0.6.1 - optionalDependencies: - tiny-worker: 2.3.0 - transitivePeerDependencies: - - supports-color - dev: false - - /through2@2.0.5: - resolution: {integrity: sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==} - dependencies: - readable-stream: 2.3.8 - xtend: 4.0.2 - dev: true - - /through2@4.0.2: - resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==} - dependencies: - readable-stream: 3.6.2 - dev: true - - /through@2.3.8: - resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} - dev: true - - /tiny-invariant@1.3.1: - resolution: {integrity: sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw==} - dev: true - - /tiny-warning@1.0.3: - resolution: {integrity: sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==} - dev: true - - /tiny-worker@2.3.0: - resolution: {integrity: sha512-pJ70wq5EAqTAEl9IkGzA+fN0836rycEuz2Cn6yeZ6FRzlVS5IDOkFHpIoEsksPRQV34GDqXm65+OlnZqUSyK2g==} - requiresBuild: true - dependencies: - esm: 3.2.25 - dev: false - optional: true - - /tinybench@2.5.1: - resolution: {integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==} - dev: true - - /tinycolor2@1.6.0: - resolution: {integrity: sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==} - dev: false - - /tinypool@0.7.0: - resolution: {integrity: sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==} - engines: {node: '>=14.0.0'} - dev: true - - /tinyspy@2.2.0: - resolution: {integrity: sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==} - engines: {node: '>=14.0.0'} - dev: true - - /to-fast-properties@2.0.0: - resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} - engines: {node: '>=4'} - dev: true - - /to-no-case@1.0.2: - resolution: {integrity: sha512-Z3g735FxuZY8rodxV4gH7LxClE4H0hTIyHNIHdk+vpQxjLm0cwnKXq/OFVZ76SOQmto7txVcwSCwkU5kqp+FKg==} - dev: true - - /to-pascal-case@1.0.0: - resolution: {integrity: sha512-QGMWHqM6xPrcQW57S23c5/3BbYb0Tbe9p+ur98ckRnGDwD4wbbtDiYI38CfmMKNB5Iv0REjs5SNDntTwvDxzZA==} - dependencies: - to-space-case: 1.0.0 - dev: true - - /to-regex-range@5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - dependencies: - is-number: 7.0.0 - dev: true - - /to-space-case@1.0.0: - resolution: {integrity: sha512-rLdvwXZ39VOn1IxGL3V6ZstoTbwLRckQmn/U8ZDLuWwIXNpuZDhQ3AiRUlhTbOXFVE9C+dR51wM0CBDhk31VcA==} - dependencies: - to-no-case: 1.0.2 - dev: true - - /tough-cookie@4.1.3: - resolution: {integrity: sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==} - engines: {node: '>=6'} - dependencies: - psl: 1.9.0 - punycode: 2.3.1 - universalify: 0.2.0 - url-parse: 1.5.10 - dev: true - - /tr46@0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - dev: false - - /tr46@3.0.0: - resolution: {integrity: sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==} - engines: {node: '>=12'} - dependencies: - punycode: 2.3.1 - dev: true - - /trim-newlines@3.0.1: - resolution: {integrity: sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==} - engines: {node: '>=8'} - dev: true - - /trough@1.0.5: - resolution: {integrity: sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==} - dev: true - - /ts-json-schema-generator@1.0.0: - resolution: {integrity: sha512-F5VofsyMhNSXKII32NDS8/Ur8o2K3Sh5i/U2ke3UgCKf26ybgm2cZeT2x7VJPl1trML/9QLzz/82l0mvzmb3Vw==} - engines: {node: '>=10.0.0'} - hasBin: true - dependencies: - '@types/json-schema': 7.0.15 - commander: 9.5.0 - glob: 7.2.3 - json5: 2.2.3 - safe-stable-stringify: 2.4.3 - typescript: 4.6.4 - dev: true - - /tslib@1.14.1: - resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} - dev: true - - /tslib@2.6.2: - resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - dev: false - - /tsutils@3.21.0(typescript@5.0.2): - resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} - engines: {node: '>= 6'} - peerDependencies: - typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' - dependencies: - tslib: 1.14.1 - typescript: 5.0.2 - dev: true - - /two-product@1.0.2: - resolution: {integrity: sha512-vOyrqmeYvzjToVM08iU52OFocWT6eB/I5LUWYnxeAPGXAhAxXYU/Yr/R2uY5/5n4bvJQL9AQulIuxpIsMoT8XQ==} - dev: false - - /two-sum@1.0.0: - resolution: {integrity: sha512-phP48e8AawgsNUjEY2WvoIWqdie8PoiDZGxTDv70LDr01uX5wLEQbOgSP7Z/B6+SW5oLtbe8qaYX2fKJs3CGTw==} - dev: false - - /type-check@0.4.0: - resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} - engines: {node: '>= 0.8.0'} - dependencies: - prelude-ls: 1.2.1 - dev: true - - /type-detect@4.0.8: - resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} - engines: {node: '>=4'} - dev: true - - /type-fest@0.18.1: - resolution: {integrity: sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==} - engines: {node: '>=10'} - dev: true - - /type-fest@0.20.2: - resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} - engines: {node: '>=10'} - dev: true - - /type-fest@0.6.0: - resolution: {integrity: sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==} - engines: {node: '>=8'} - dev: true - - /type-fest@0.8.1: - resolution: {integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==} - engines: {node: '>=8'} - dev: true - - /typed-array-buffer@1.0.0: - resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - is-typed-array: 1.1.12 - dev: true - - /typed-array-byte-length@1.0.0: - resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - for-each: 0.3.3 - has-proto: 1.0.1 - is-typed-array: 1.1.12 - dev: true - - /typed-array-byte-offset@1.0.0: - resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} - engines: {node: '>= 0.4'} - dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - for-each: 0.3.3 - has-proto: 1.0.1 - is-typed-array: 1.1.12 - dev: true - - /typed-array-length@1.0.4: - resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==} - dependencies: - call-bind: 1.0.5 - for-each: 0.3.3 - is-typed-array: 1.1.12 - dev: true - - /typedarray-pool@1.2.0: - resolution: {integrity: sha512-YTSQbzX43yvtpfRtIDAYygoYtgT+Rpjuxy9iOpczrjpXLgGoyG7aS5USJXV2d3nn8uHTeb9rXDvzS27zUg5KYQ==} - dependencies: - bit-twiddle: 1.0.2 - dup: 1.0.0 - dev: false - - /typescript@4.6.4: - resolution: {integrity: sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==} - engines: {node: '>=4.2.0'} - hasBin: true - dev: true - - /typescript@5.0.2: - resolution: {integrity: sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==} - engines: {node: '>=12.20'} - hasBin: true - dev: true - - /ufo@1.3.2: - resolution: {integrity: sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==} - dev: true - - /uglify-js@3.17.4: - resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==} - engines: {node: '>=0.8.0'} - hasBin: true - requiresBuild: true - dev: true - optional: true - - /unbox-primitive@1.0.2: - resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} - dependencies: - call-bind: 1.0.5 - has-bigints: 1.0.2 - has-symbols: 1.0.3 - which-boxed-primitive: 1.0.2 - dev: true - - /unescape-js@1.1.4: - resolution: {integrity: sha512-42SD8NOQEhdYntEiUQdYq/1V/YHwr1HLwlHuTJB5InVVdOSbgI6xu8jK5q65yIzuFCfczzyDF/7hbGzVbyCw0g==} - dependencies: - string.fromcodepoint: 0.2.1 - dev: true - - /unified@9.2.2: - resolution: {integrity: sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==} - dependencies: - '@types/unist': 2.0.10 - bail: 1.0.5 - extend: 3.0.2 - is-buffer: 2.0.5 - is-plain-obj: 2.1.0 - trough: 1.0.5 - vfile: 4.2.1 - dev: true - - /unist-util-is@4.1.0: - resolution: {integrity: sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg==} - dev: true - - /unist-util-stringify-position@2.0.3: - resolution: {integrity: sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==} - dependencies: - '@types/unist': 2.0.10 - dev: true - - /unist-util-visit-parents@1.1.2: - resolution: {integrity: sha512-yvo+MMLjEwdc3RhhPYSximset7rwjMrdt9E41Smmvg25UQIenzrN83cRnF1JMzoMi9zZOQeYXHSDf7p+IQkW3Q==} - dev: true - - /unist-util-visit-parents@3.1.1: - resolution: {integrity: sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==} - dependencies: - '@types/unist': 2.0.10 - unist-util-is: 4.1.0 - dev: true - - /unist-util-visit@2.0.3: - resolution: {integrity: sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==} - dependencies: - '@types/unist': 2.0.10 - unist-util-is: 4.1.0 - unist-util-visit-parents: 3.1.1 - dev: true - - /universalify@0.2.0: - resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} - engines: {node: '>= 4.0.0'} - dev: true - - /update-browserslist-db@1.0.13(browserslist@4.22.2): - resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} - hasBin: true - peerDependencies: - browserslist: '>= 4.21.0' - dependencies: - browserslist: 4.22.2 - escalade: 3.1.1 - picocolors: 1.0.0 - dev: true - - /uri-js@4.4.1: - resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - dependencies: - punycode: 2.3.1 - - /url-parse@1.5.10: - resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} - dependencies: - querystringify: 2.2.0 - requires-port: 1.0.0 - - /url@0.11.3: - resolution: {integrity: sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==} - dependencies: - punycode: 1.4.1 - qs: 6.11.2 - - /use-resize-observer@9.1.0(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-R25VqO9Wb3asSD4eqtcxk8sJalvIOYBqS8MNZlpDSQ4l4xMQxC/J7Id9HoTqPq8FwULIn0PVW+OAqF2dyYbjow==} - peerDependencies: - react: 16.8.0 - 18 - react-dom: 16.8.0 - 18 - dependencies: - '@juggle/resize-observer': 3.4.0 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - dev: false - - /util-deprecate@1.0.2: - resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - - /utrie@1.0.2: - resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==} - requiresBuild: true - dependencies: - base64-arraybuffer: 1.0.2 - dev: false - optional: true - - /uuid@3.4.0: - resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==} - deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. - hasBin: true - dev: true - - /uuid@8.3.2: - resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} - hasBin: true - dev: false - - /v8-compile-cache@2.4.0: - resolution: {integrity: sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==} - dev: true - - /v8-to-istanbul@9.2.0: - resolution: {integrity: sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==} - engines: {node: '>=10.12.0'} - dependencies: - '@jridgewell/trace-mapping': 0.3.20 - '@types/istanbul-lib-coverage': 2.0.6 - convert-source-map: 2.0.0 - dev: true - - /validate-npm-package-license@3.0.4: - resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} - dependencies: - spdx-correct: 3.2.0 - spdx-expression-parse: 3.0.1 - dev: true - - /value-equal@1.0.1: - resolution: {integrity: sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==} - dev: true - - /vfile-message@2.0.4: - resolution: {integrity: sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==} - dependencies: - '@types/unist': 2.0.10 - unist-util-stringify-position: 2.0.3 - dev: true - - /vfile@4.2.1: - resolution: {integrity: sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==} - dependencies: - '@types/unist': 2.0.10 - is-buffer: 2.0.5 - unist-util-stringify-position: 2.0.3 - vfile-message: 2.0.4 - dev: true - - /vite-node@0.34.6(@types/node@18.6.2): - resolution: {integrity: sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==} - engines: {node: '>=v14.18.0'} - hasBin: true - dependencies: - cac: 6.7.14 - debug: 4.3.4 - mlly: 1.4.2 - pathe: 1.1.1 - picocolors: 1.0.0 - vite: 4.4.11(@types/node@18.6.2) - transitivePeerDependencies: - - '@types/node' - - less - - lightningcss - - sass - - stylus - - sugarss - - supports-color - - terser - dev: true - - /vite@4.4.11(@types/node@18.6.2): - resolution: {integrity: sha512-ksNZJlkcU9b0lBwAGZGGaZHCMqHsc8OpgtoYhsQ4/I2v5cnpmmmqe5pM4nv/4Hn6G/2GhTdj0DhZh2e+Er1q5A==} - engines: {node: ^14.18.0 || >=16.0.0} - hasBin: true - peerDependencies: - '@types/node': '>= 14' - less: '*' - lightningcss: ^1.21.0 - sass: '*' - stylus: '*' - sugarss: '*' - terser: ^5.4.0 - peerDependenciesMeta: - '@types/node': - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - dependencies: - '@types/node': 18.6.2 - esbuild: 0.18.20 - postcss: 8.4.32 - rollup: 3.29.4 - optionalDependencies: - fsevents: 2.3.3 - dev: true - - /vitest-canvas-mock@0.3.3(vitest@0.34.6): - resolution: {integrity: sha512-3P968tYBpqYyzzOaVtqnmYjqbe13576/fkjbDEJSfQAkHtC5/UjuRHOhFEN/ZV5HVZIkaROBUWgazDKJ+Ibw+Q==} - peerDependencies: - vitest: '*' - dependencies: - jest-canvas-mock: 2.5.2 - vitest: 0.34.6(jsdom@19.0.0) - dev: true - - /vitest@0.34.6(jsdom@19.0.0): - resolution: {integrity: sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==} - engines: {node: '>=v14.18.0'} - hasBin: true - peerDependencies: - '@edge-runtime/vm': '*' - '@vitest/browser': '*' - '@vitest/ui': '*' - happy-dom: '*' - jsdom: '*' - playwright: '*' - safaridriver: '*' - webdriverio: '*' - peerDependenciesMeta: - '@edge-runtime/vm': - optional: true - '@vitest/browser': - optional: true - '@vitest/ui': - optional: true - happy-dom: - optional: true - jsdom: - optional: true - playwright: - optional: true - safaridriver: - optional: true - webdriverio: - optional: true - dependencies: - '@types/chai': 4.3.11 - '@types/chai-subset': 1.3.5 - '@types/node': 18.6.2 - '@vitest/expect': 0.34.6 - '@vitest/runner': 0.34.6 - '@vitest/snapshot': 0.34.6 - '@vitest/spy': 0.34.6 - '@vitest/utils': 0.34.6 - acorn: 8.11.2 - acorn-walk: 8.3.0 - cac: 6.7.14 - chai: 4.3.10 - debug: 4.3.4 - jsdom: 19.0.0 - local-pkg: 0.4.3 - magic-string: 0.30.5 - pathe: 1.1.1 - picocolors: 1.0.0 - std-env: 3.6.0 - strip-literal: 1.3.0 - tinybench: 2.5.1 - tinypool: 0.7.0 - vite: 4.4.11(@types/node@18.6.2) - vite-node: 0.34.6(@types/node@18.6.2) - why-is-node-running: 2.2.2 - transitivePeerDependencies: - - less - - lightningcss - - sass - - stylus - - sugarss - - supports-color - - terser - dev: true - - /vkbeautify@0.99.3: - resolution: {integrity: sha512-2ozZEFfmVvQcHWoHLNuiKlUfDKlhh4KGsy54U0UrlLMR1SO+XKAIDqBxtBwHgNrekurlJwE8A9K6L49T78ZQ9Q==} - dev: false - - /vlq@0.2.3: - resolution: {integrity: sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==} - dev: true - - /w3c-hr-time@1.0.2: - resolution: {integrity: sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==} - deprecated: Use your platform's native performance.now() and performance.timeOrigin. - dependencies: - browser-process-hrtime: 1.0.0 - dev: true - - /w3c-xmlserializer@3.0.0: - resolution: {integrity: sha512-3WFqGEgSXIyGhOmAFtlicJNMjEps8b1MG31NCA0/vOF9+nKMUW1ckhi9cnNHmf88Rzw5V+dwIwsm2C7X8k9aQg==} - engines: {node: '>=12'} - dependencies: - xml-name-validator: 4.0.0 - dev: true - - /wcwidth@1.0.1: - resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} - requiresBuild: true - dependencies: - defaults: 1.0.4 - dev: true - optional: true - - /webidl-conversions@3.0.1: - resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} - dev: false - - /webidl-conversions@7.0.0: - resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} - engines: {node: '>=12'} - dev: true - - /whatwg-encoding@2.0.0: - resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} - engines: {node: '>=12'} - dependencies: - iconv-lite: 0.6.3 - dev: true - - /whatwg-mimetype@3.0.0: - resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} - engines: {node: '>=12'} - dev: true - - /whatwg-url@10.0.0: - resolution: {integrity: sha512-CLxxCmdUby142H5FZzn4D8ikO1cmypvXVQktsgosNy4a4BHrDHeciBBGZhb0bNoR5/MltoCatso+vFjjGx8t0w==} - engines: {node: '>=12'} - dependencies: - tr46: 3.0.0 - webidl-conversions: 7.0.0 - dev: true - - /whatwg-url@11.0.0: - resolution: {integrity: sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==} - engines: {node: '>=12'} - dependencies: - tr46: 3.0.0 - webidl-conversions: 7.0.0 - dev: true - - /whatwg-url@5.0.0: - resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} - dependencies: - tr46: 0.0.3 - webidl-conversions: 3.0.1 - dev: false - - /which-boxed-primitive@1.0.2: - resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} - dependencies: - is-bigint: 1.0.4 - is-boolean-object: 1.1.2 - is-number-object: 1.0.7 - is-string: 1.0.7 - is-symbol: 1.0.4 - dev: true - - /which-builtin-type@1.1.3: - resolution: {integrity: sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw==} - engines: {node: '>= 0.4'} - dependencies: - function.prototype.name: 1.1.6 - has-tostringtag: 1.0.0 - is-async-function: 2.0.0 - is-date-object: 1.0.5 - is-finalizationregistry: 1.0.2 - is-generator-function: 1.0.10 - is-regex: 1.1.4 - is-weakref: 1.0.2 - isarray: 2.0.5 - which-boxed-primitive: 1.0.2 - which-collection: 1.0.1 - which-typed-array: 1.1.13 - dev: true - - /which-collection@1.0.1: - resolution: {integrity: sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==} - dependencies: - is-map: 2.0.2 - is-set: 2.0.2 - is-weakmap: 2.0.1 - is-weakset: 2.0.2 - dev: true - - /which-typed-array@1.1.13: - resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} - engines: {node: '>= 0.4'} - dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - for-each: 0.3.3 - gopd: 1.0.1 - has-tostringtag: 1.0.0 - dev: true - - /which@1.3.1: - resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} - hasBin: true - dependencies: - isexe: 2.0.0 - dev: true - - /which@2.0.2: - resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} - engines: {node: '>= 8'} - hasBin: true - dependencies: - isexe: 2.0.0 - dev: true - - /why-is-node-running@2.2.2: - resolution: {integrity: sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==} - engines: {node: '>=8'} - hasBin: true - dependencies: - siginfo: 2.0.0 - stackback: 0.0.2 - dev: true - - /wordwrap@1.0.0: - resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} - dev: true - - /wrap-ansi@7.0.0: - resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} - engines: {node: '>=10'} - dependencies: - ansi-styles: 4.3.0 - string-width: 4.2.3 - strip-ansi: 6.0.1 - dev: true - - /wrap-ansi@8.1.0: - resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} - engines: {node: '>=12'} - dependencies: - ansi-styles: 6.2.1 - string-width: 5.1.2 - strip-ansi: 7.1.0 - dev: true - - /wrappy@1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - dev: true - - /ws@8.14.2: - resolution: {integrity: sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - dev: true - - /xml-name-validator@4.0.0: - resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==} - engines: {node: '>=12'} - dev: true - - /xmlchars@2.2.0: - resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} - dev: true - - /xmlhttprequest@1.8.0: - resolution: {integrity: sha512-58Im/U0mlVBLM38NdZjHyhuMtCqa61469k2YP/AaPbvCoV9aQGUpbJBj1QRm2ytRiVQBD/fsw7L2bJGDVQswBA==} - engines: {node: '>=0.4.0'} - dev: false - - /xtend@4.0.2: - resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} - engines: {node: '>=0.4'} - dev: true - - /y18n@5.0.8: - resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} - engines: {node: '>=10'} - dev: true - - /yallist@3.1.1: - resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} - dev: true - - /yallist@4.0.0: - resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - dev: true - - /yargs-parser@20.2.9: - resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} - engines: {node: '>=10'} - dev: true - - /yargs@16.2.0: - resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} - engines: {node: '>=10'} - dependencies: - cliui: 7.0.4 - escalade: 3.1.1 - get-caller-file: 2.0.5 - require-directory: 2.1.1 - string-width: 4.2.3 - y18n: 5.0.8 - yargs-parser: 20.2.9 - dev: true - - /yocto-queue@0.1.0: - resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} - engines: {node: '>=10'} - dev: true - - /yocto-queue@1.0.0: - resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} - engines: {node: '>=12.20'} - dev: true - - /zod-validation-error@1.5.0(zod@3.22.4): - resolution: {integrity: sha512-/7eFkAI4qV0tcxMBB/3+d2c1P6jzzZYdYSlBuAklzMuCrJu5bzJfHS0yVAS87dRHVlhftd6RFJDIvv03JgkSbw==} - engines: {node: '>=16.0.0'} - peerDependencies: - zod: ^3.18.0 - dependencies: - zod: 3.22.4 - dev: true - - /zod@3.22.4: - resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} - dev: true - - /zwitch@1.0.5: - resolution: {integrity: sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==} - dev: true From 7f907f1f9fb9c7b5429ccd626d1b70c5c843527d Mon Sep 17 00:00:00 2001 From: Michael Puehringer Date: Tue, 9 Jan 2024 09:46:32 +0100 Subject: [PATCH 6/8] Remvoe dist again --- .gitignore | 2 +- dist/assets/bam-worker-fec5d05b.js.map | 1 - dist/assets/bed-worker-cb58a7c2.js.map | 1 - dist/assets/gff-worker-71adf8b0.js.map | 1 - dist/assets/vcf-worker-0bc0fe81.js.map | 1 - dist/exported-utils-c80467e4.js | 10042 ------ dist/exported-utils-c80467e4.js.map | 1 - dist/favicon.ico | Bin 2055 -> 0 bytes dist/gosling.js | 26774 ---------------- dist/gosling.js.map | 1 - dist/src/alias/buffer-shim.d.ts | 2 - dist/src/alias/buffer-shim.d.ts.map | 1 - dist/src/alias/zlib.d.ts | 8 - dist/src/alias/zlib.d.ts.map | 1 - dist/src/api/api-data.d.ts | 21 - dist/src/api/api-data.d.ts.map | 1 - dist/src/api/api.d.ts | 48 - dist/src/api/api.d.ts.map | 1 - dist/src/api/pubsub.d.ts | 7 - dist/src/api/pubsub.d.ts.map | 1 - dist/src/api/track-and-view-ids.d.ts | 44 - dist/src/api/track-and-view-ids.d.ts.map | 1 - dist/src/compiler/bounding-box.d.ts | 52 - dist/src/compiler/bounding-box.d.ts.map | 1 - dist/src/compiler/compile.d.ts | 19 - dist/src/compiler/compile.d.ts.map | 1 - dist/src/compiler/create-higlass-models.d.ts | 7 - .../compiler/create-higlass-models.d.ts.map | 1 - dist/src/compiler/defaults.d.ts | 14 - dist/src/compiler/defaults.d.ts.map | 1 - dist/src/compiler/gosling-to-higlass.d.ts | 11 - dist/src/compiler/gosling-to-higlass.d.ts.map | 1 - dist/src/compiler/higlass-model.d.ts | 82 - dist/src/compiler/higlass-model.d.ts.map | 1 - dist/src/compiler/responsive.d.ts | 3 - dist/src/compiler/responsive.d.ts.map | 1 - dist/src/compiler/spec-preprocess.d.ts | 43 - dist/src/compiler/spec-preprocess.d.ts.map | 1 - dist/src/core/channel/index.d.ts | 8 - dist/src/core/channel/index.d.ts.map | 1 - dist/src/core/example/hg-view-config-1.d.ts | 736 - .../core/example/hg-view-config-1.d.ts.map | 1 - dist/src/core/gosling-component.d.ts | 36 - dist/src/core/gosling-component.d.ts.map | 1 - dist/src/core/gosling-embed.d.ts | 18 - dist/src/core/gosling-embed.d.ts.map | 1 - dist/src/core/higlass-component-wrapper.d.ts | 28 - .../core/higlass-component-wrapper.d.ts.map | 1 - dist/src/core/init.d.ts | 5 - dist/src/core/init.d.ts.map | 1 - dist/src/core/mark/area.d.ts | 7 - dist/src/core/mark/area.d.ts.map | 1 - dist/src/core/mark/axis.d.ts | 16 - dist/src/core/mark/axis.d.ts.map | 1 - dist/src/core/mark/background.d.ts | 4 - dist/src/core/mark/background.d.ts.map | 1 - dist/src/core/mark/bar.d.ts | 11 - dist/src/core/mark/bar.d.ts.map | 1 - dist/src/core/mark/betweenLink.d.ts | 4 - dist/src/core/mark/betweenLink.d.ts.map | 1 - dist/src/core/mark/grid.d.ts | 6 - dist/src/core/mark/grid.d.ts.map | 1 - dist/src/core/mark/index.d.ts | 22 - dist/src/core/mark/index.d.ts.map | 1 - dist/src/core/mark/legend.d.ts | 20 - dist/src/core/mark/legend.d.ts.map | 1 - dist/src/core/mark/line.d.ts | 4 - dist/src/core/mark/line.d.ts.map | 1 - dist/src/core/mark/outline-circular.d.ts | 4 - dist/src/core/mark/outline-circular.d.ts.map | 1 - dist/src/core/mark/outline.d.ts | 12 - dist/src/core/mark/outline.d.ts.map | 1 - dist/src/core/mark/point.d.ts | 8 - dist/src/core/mark/point.d.ts.map | 1 - dist/src/core/mark/rect.d.ts | 11 - dist/src/core/mark/rect.d.ts.map | 1 - dist/src/core/mark/rule.d.ts | 4 - dist/src/core/mark/rule.d.ts.map | 1 - dist/src/core/mark/text.d.ts | 14 - dist/src/core/mark/text.d.ts.map | 1 - dist/src/core/mark/title.d.ts | 5 - dist/src/core/mark/title.d.ts.map | 1 - dist/src/core/mark/triangle.d.ts | 4 - dist/src/core/mark/triangle.d.ts.map | 1 - dist/src/core/mark/withinLink.d.ts | 4 - dist/src/core/mark/withinLink.d.ts.map | 1 - dist/src/core/utils/array.d.ts | 44 - dist/src/core/utils/array.d.ts.map | 1 - dist/src/core/utils/assembly.d.ts | 61 - dist/src/core/utils/assembly.d.ts.map | 1 - dist/src/core/utils/chrom-size.d.ts | 184 - dist/src/core/utils/chrom-size.d.ts.map | 1 - dist/src/core/utils/color-to-hex.d.ts | 6 - dist/src/core/utils/color-to-hex.d.ts.map | 1 - dist/src/core/utils/data-transform.d.ts | 39 - dist/src/core/utils/data-transform.d.ts.map | 1 - dist/src/core/utils/define-plugin-track.d.ts | 11 - .../core/utils/define-plugin-track.d.ts.map | 1 - dist/src/core/utils/higlass-zoom-config.d.ts | 6 - .../core/utils/higlass-zoom-config.d.ts.map | 1 - dist/src/core/utils/index.d.ts | 9 - dist/src/core/utils/index.d.ts.map | 1 - dist/src/core/utils/linking.d.ts | 12 - dist/src/core/utils/linking.d.ts.map | 1 - dist/src/core/utils/omit-deep.d.ts | 3 - dist/src/core/utils/omit-deep.d.ts.map | 1 - dist/src/core/utils/overlay.d.ts | 13 - dist/src/core/utils/overlay.d.ts.map | 1 - dist/src/core/utils/polar.d.ts | 19 - dist/src/core/utils/polar.d.ts.map | 1 - dist/src/core/utils/position.d.ts | 19 - dist/src/core/utils/position.d.ts.map | 1 - dist/src/core/utils/scales.d.ts | 12 - dist/src/core/utils/scales.d.ts.map | 1 - dist/src/core/utils/semantic-zoom.d.ts | 8 - dist/src/core/utils/semantic-zoom.d.ts.map | 1 - dist/src/core/utils/style.d.ts | 3 - dist/src/core/utils/style.d.ts.map | 1 - dist/src/core/utils/template.d.ts | 11 - dist/src/core/utils/template.d.ts.map | 1 - dist/src/core/utils/text-style.d.ts | 19 - dist/src/core/utils/text-style.d.ts.map | 1 - dist/src/core/utils/theme.d.ts | 115 - dist/src/core/utils/theme.d.ts.map | 1 - dist/src/core/utils/uuid.d.ts | 2 - dist/src/core/utils/uuid.d.ts.map | 1 - dist/src/core/visual-property.schema.d.ts | 2 - dist/src/core/visual-property.schema.d.ts.map | 1 - .../data-fetchers/bam/bam-data-fetcher.d.ts | 29 - .../bam/bam-data-fetcher.d.ts.map | 1 - dist/src/data-fetchers/bam/bam-worker.d.ts | 82 - .../src/data-fetchers/bam/bam-worker.d.ts.map | 1 - .../data-fetchers/bed/bed-data-fetcher.d.ts | 31 - .../bed/bed-data-fetcher.d.ts.map | 1 - dist/src/data-fetchers/bed/bed-parser.d.ts | 28 - .../src/data-fetchers/bed/bed-parser.d.ts.map | 1 - dist/src/data-fetchers/bed/bed-worker.d.ts | 50 - .../src/data-fetchers/bed/bed-worker.d.ts.map | 1 - .../bigwig/bigwig-data-fetcher.d.ts | 56 - .../bigwig/bigwig-data-fetcher.d.ts.map | 1 - .../data-fetchers/csv/csv-data-fetcher.d.ts | 58 - .../csv/csv-data-fetcher.d.ts.map | 1 - .../data-fetchers/gff/gff-data-fetcher.d.ts | 25 - .../gff/gff-data-fetcher.d.ts.map | 1 - dist/src/data-fetchers/gff/gff-worker.d.ts | 39 - .../src/data-fetchers/gff/gff-worker.d.ts.map | 1 - dist/src/data-fetchers/gff/utils.d.ts | 10 - dist/src/data-fetchers/gff/utils.d.ts.map | 1 - dist/src/data-fetchers/index.d.ts | 9 - dist/src/data-fetchers/index.d.ts.map | 1 - .../data-fetchers/json/json-data-fetcher.d.ts | 11 - .../json/json-data-fetcher.d.ts.map | 1 - dist/src/data-fetchers/utils.d.ts | 54 - dist/src/data-fetchers/utils.d.ts.map | 1 - dist/src/data-fetchers/vcf/utils.d.ts | 11 - dist/src/data-fetchers/vcf/utils.d.ts.map | 1 - .../data-fetchers/vcf/vcf-data-fetcher.d.ts | 48 - .../vcf/vcf-data-fetcher.d.ts.map | 1 - dist/src/data-fetchers/vcf/vcf-worker.d.ts | 29 - .../src/data-fetchers/vcf/vcf-worker.d.ts.map | 1 - dist/src/exported-utils.d.ts | 5 - dist/src/exported-utils.d.ts.map | 1 - dist/src/gosling-schema/gosling.schema.d.ts | 1229 - .../gosling-schema/gosling.schema.d.ts.map | 1 - .../gosling-schema/gosling.schema.guards.d.ts | 81 - .../gosling.schema.guards.d.ts.map | 1 - dist/src/gosling-schema/index.d.ts | 6 - dist/src/gosling-schema/index.d.ts.map | 1 - dist/src/gosling-schema/validate.d.ts | 26 - dist/src/gosling-schema/validate.d.ts.map | 1 - dist/src/gosling-theme/dark.d.ts | 3 - dist/src/gosling-theme/dark.d.ts.map | 1 - dist/src/gosling-theme/ensembl.d.ts | 3 - dist/src/gosling-theme/ensembl.d.ts.map | 1 - dist/src/gosling-theme/excel.d.ts | 3 - dist/src/gosling-theme/excel.d.ts.map | 1 - dist/src/gosling-theme/ggplot.d.ts | 3 - dist/src/gosling-theme/ggplot.d.ts.map | 1 - dist/src/gosling-theme/google.d.ts | 3 - dist/src/gosling-theme/google.d.ts.map | 1 - dist/src/gosling-theme/igv.d.ts | 3 - dist/src/gosling-theme/igv.d.ts.map | 1 - dist/src/gosling-theme/index.d.ts | 16 - dist/src/gosling-theme/index.d.ts.map | 1 - dist/src/gosling-theme/jbrowse.d.ts | 3 - dist/src/gosling-theme/jbrowse.d.ts.map | 1 - dist/src/gosling-theme/light.d.ts | 3 - dist/src/gosling-theme/light.d.ts.map | 1 - dist/src/gosling-theme/test.d.ts | 16 - dist/src/gosling-theme/test.d.ts.map | 1 - dist/src/gosling-theme/ucsc.d.ts | 3 - dist/src/gosling-theme/ucsc.d.ts.map | 1 - dist/src/gosling-theme/warm.d.ts | 3 - dist/src/gosling-theme/warm.d.ts.map | 1 - dist/src/gosling-theme/washu.d.ts | 3 - dist/src/gosling-theme/washu.d.ts.map | 1 - dist/src/higlass-schema/higlass.schema.d.ts | 148 - .../higlass-schema/higlass.schema.d.ts.map | 1 - dist/src/higlass-schema/index.d.ts | 3 - dist/src/higlass-schema/index.d.ts.map | 1 - dist/src/index.d.ts | 15 - dist/src/index.d.ts.map | 1 - dist/src/tracks/dummy-track/dummy-track.d.ts | 16 - .../tracks/dummy-track/dummy-track.d.ts.map | 1 - dist/src/tracks/dummy-track/index.d.ts | 2 - dist/src/tracks/dummy-track/index.d.ts.map | 1 - .../src/tracks/gosling-brush/brush-track.d.ts | 26 - .../tracks/gosling-brush/brush-track.d.ts.map | 1 - dist/src/tracks/gosling-brush/index.d.ts | 3 - dist/src/tracks/gosling-brush/index.d.ts.map | 1 - .../gosling-brush/linear-brush-model.d.ts | 50 - .../gosling-brush/linear-brush-model.d.ts.map | 1 - .../gosling-genomic-axis/axis-track.d.ts | 40 - .../gosling-genomic-axis/axis-track.d.ts.map | 1 - .../tracks/gosling-genomic-axis/index.d.ts | 3 - .../gosling-genomic-axis/index.d.ts.map | 1 - .../gosling-track/data-abstraction.d.ts | 16 - .../gosling-track/data-abstraction.d.ts.map | 1 - .../gosling-mouse-event/index.d.ts | 3 - .../gosling-mouse-event/index.d.ts.map | 1 - .../mouse-event-model.d.ts | 71 - .../mouse-event-model.d.ts.map | 1 - .../gosling-mouse-event/polygon.d.ts | 52 - .../gosling-mouse-event/polygon.d.ts.map | 1 - .../gosling-track/gosling-track-model.d.ts | 118 - .../gosling-track-model.d.ts.map | 1 - .../tracks/gosling-track/gosling-track.d.ts | 40 - .../gosling-track/gosling-track.d.ts.map | 1 - dist/src/tracks/gosling-track/index.d.ts | 2 - dist/src/tracks/gosling-track/index.d.ts.map | 1 - dist/utils.js | 20 - dist/utils.js.map | 1 - package.json | 3 + 233 files changed, 4 insertions(+), 41494 deletions(-) delete mode 100644 dist/assets/bam-worker-fec5d05b.js.map delete mode 100644 dist/assets/bed-worker-cb58a7c2.js.map delete mode 100644 dist/assets/gff-worker-71adf8b0.js.map delete mode 100644 dist/assets/vcf-worker-0bc0fe81.js.map delete mode 100644 dist/exported-utils-c80467e4.js delete mode 100644 dist/exported-utils-c80467e4.js.map delete mode 100644 dist/favicon.ico delete mode 100644 dist/gosling.js delete mode 100644 dist/gosling.js.map delete mode 100644 dist/src/alias/buffer-shim.d.ts delete mode 100644 dist/src/alias/buffer-shim.d.ts.map delete mode 100644 dist/src/alias/zlib.d.ts delete mode 100644 dist/src/alias/zlib.d.ts.map delete mode 100644 dist/src/api/api-data.d.ts delete mode 100644 dist/src/api/api-data.d.ts.map delete mode 100644 dist/src/api/api.d.ts delete mode 100644 dist/src/api/api.d.ts.map delete mode 100644 dist/src/api/pubsub.d.ts delete mode 100644 dist/src/api/pubsub.d.ts.map delete mode 100644 dist/src/api/track-and-view-ids.d.ts delete mode 100644 dist/src/api/track-and-view-ids.d.ts.map delete mode 100644 dist/src/compiler/bounding-box.d.ts delete mode 100644 dist/src/compiler/bounding-box.d.ts.map delete mode 100644 dist/src/compiler/compile.d.ts delete mode 100644 dist/src/compiler/compile.d.ts.map delete mode 100644 dist/src/compiler/create-higlass-models.d.ts delete mode 100644 dist/src/compiler/create-higlass-models.d.ts.map delete mode 100644 dist/src/compiler/defaults.d.ts delete mode 100644 dist/src/compiler/defaults.d.ts.map delete mode 100644 dist/src/compiler/gosling-to-higlass.d.ts delete mode 100644 dist/src/compiler/gosling-to-higlass.d.ts.map delete mode 100644 dist/src/compiler/higlass-model.d.ts delete mode 100644 dist/src/compiler/higlass-model.d.ts.map delete mode 100644 dist/src/compiler/responsive.d.ts delete mode 100644 dist/src/compiler/responsive.d.ts.map delete mode 100644 dist/src/compiler/spec-preprocess.d.ts delete mode 100644 dist/src/compiler/spec-preprocess.d.ts.map delete mode 100644 dist/src/core/channel/index.d.ts delete mode 100644 dist/src/core/channel/index.d.ts.map delete mode 100644 dist/src/core/example/hg-view-config-1.d.ts delete mode 100644 dist/src/core/example/hg-view-config-1.d.ts.map delete mode 100644 dist/src/core/gosling-component.d.ts delete mode 100644 dist/src/core/gosling-component.d.ts.map delete mode 100644 dist/src/core/gosling-embed.d.ts delete mode 100644 dist/src/core/gosling-embed.d.ts.map delete mode 100644 dist/src/core/higlass-component-wrapper.d.ts delete mode 100644 dist/src/core/higlass-component-wrapper.d.ts.map delete mode 100644 dist/src/core/init.d.ts delete mode 100644 dist/src/core/init.d.ts.map delete mode 100644 dist/src/core/mark/area.d.ts delete mode 100644 dist/src/core/mark/area.d.ts.map delete mode 100644 dist/src/core/mark/axis.d.ts delete mode 100644 dist/src/core/mark/axis.d.ts.map delete mode 100644 dist/src/core/mark/background.d.ts delete mode 100644 dist/src/core/mark/background.d.ts.map delete mode 100644 dist/src/core/mark/bar.d.ts delete mode 100644 dist/src/core/mark/bar.d.ts.map delete mode 100644 dist/src/core/mark/betweenLink.d.ts delete mode 100644 dist/src/core/mark/betweenLink.d.ts.map delete mode 100644 dist/src/core/mark/grid.d.ts delete mode 100644 dist/src/core/mark/grid.d.ts.map delete mode 100644 dist/src/core/mark/index.d.ts delete mode 100644 dist/src/core/mark/index.d.ts.map delete mode 100644 dist/src/core/mark/legend.d.ts delete mode 100644 dist/src/core/mark/legend.d.ts.map delete mode 100644 dist/src/core/mark/line.d.ts delete mode 100644 dist/src/core/mark/line.d.ts.map delete mode 100644 dist/src/core/mark/outline-circular.d.ts delete mode 100644 dist/src/core/mark/outline-circular.d.ts.map delete mode 100644 dist/src/core/mark/outline.d.ts delete mode 100644 dist/src/core/mark/outline.d.ts.map delete mode 100644 dist/src/core/mark/point.d.ts delete mode 100644 dist/src/core/mark/point.d.ts.map delete mode 100644 dist/src/core/mark/rect.d.ts delete mode 100644 dist/src/core/mark/rect.d.ts.map delete mode 100644 dist/src/core/mark/rule.d.ts delete mode 100644 dist/src/core/mark/rule.d.ts.map delete mode 100644 dist/src/core/mark/text.d.ts delete mode 100644 dist/src/core/mark/text.d.ts.map delete mode 100644 dist/src/core/mark/title.d.ts delete mode 100644 dist/src/core/mark/title.d.ts.map delete mode 100644 dist/src/core/mark/triangle.d.ts delete mode 100644 dist/src/core/mark/triangle.d.ts.map delete mode 100644 dist/src/core/mark/withinLink.d.ts delete mode 100644 dist/src/core/mark/withinLink.d.ts.map delete mode 100644 dist/src/core/utils/array.d.ts delete mode 100644 dist/src/core/utils/array.d.ts.map delete mode 100644 dist/src/core/utils/assembly.d.ts delete mode 100644 dist/src/core/utils/assembly.d.ts.map delete mode 100644 dist/src/core/utils/chrom-size.d.ts delete mode 100644 dist/src/core/utils/chrom-size.d.ts.map delete mode 100644 dist/src/core/utils/color-to-hex.d.ts delete mode 100644 dist/src/core/utils/color-to-hex.d.ts.map delete mode 100644 dist/src/core/utils/data-transform.d.ts delete mode 100644 dist/src/core/utils/data-transform.d.ts.map delete mode 100644 dist/src/core/utils/define-plugin-track.d.ts delete mode 100644 dist/src/core/utils/define-plugin-track.d.ts.map delete mode 100644 dist/src/core/utils/higlass-zoom-config.d.ts delete mode 100644 dist/src/core/utils/higlass-zoom-config.d.ts.map delete mode 100644 dist/src/core/utils/index.d.ts delete mode 100644 dist/src/core/utils/index.d.ts.map delete mode 100644 dist/src/core/utils/linking.d.ts delete mode 100644 dist/src/core/utils/linking.d.ts.map delete mode 100644 dist/src/core/utils/omit-deep.d.ts delete mode 100644 dist/src/core/utils/omit-deep.d.ts.map delete mode 100644 dist/src/core/utils/overlay.d.ts delete mode 100644 dist/src/core/utils/overlay.d.ts.map delete mode 100644 dist/src/core/utils/polar.d.ts delete mode 100644 dist/src/core/utils/polar.d.ts.map delete mode 100644 dist/src/core/utils/position.d.ts delete mode 100644 dist/src/core/utils/position.d.ts.map delete mode 100644 dist/src/core/utils/scales.d.ts delete mode 100644 dist/src/core/utils/scales.d.ts.map delete mode 100644 dist/src/core/utils/semantic-zoom.d.ts delete mode 100644 dist/src/core/utils/semantic-zoom.d.ts.map delete mode 100644 dist/src/core/utils/style.d.ts delete mode 100644 dist/src/core/utils/style.d.ts.map delete mode 100644 dist/src/core/utils/template.d.ts delete mode 100644 dist/src/core/utils/template.d.ts.map delete mode 100644 dist/src/core/utils/text-style.d.ts delete mode 100644 dist/src/core/utils/text-style.d.ts.map delete mode 100644 dist/src/core/utils/theme.d.ts delete mode 100644 dist/src/core/utils/theme.d.ts.map delete mode 100644 dist/src/core/utils/uuid.d.ts delete mode 100644 dist/src/core/utils/uuid.d.ts.map delete mode 100644 dist/src/core/visual-property.schema.d.ts delete mode 100644 dist/src/core/visual-property.schema.d.ts.map delete mode 100644 dist/src/data-fetchers/bam/bam-data-fetcher.d.ts delete mode 100644 dist/src/data-fetchers/bam/bam-data-fetcher.d.ts.map delete mode 100644 dist/src/data-fetchers/bam/bam-worker.d.ts delete mode 100644 dist/src/data-fetchers/bam/bam-worker.d.ts.map delete mode 100644 dist/src/data-fetchers/bed/bed-data-fetcher.d.ts delete mode 100644 dist/src/data-fetchers/bed/bed-data-fetcher.d.ts.map delete mode 100644 dist/src/data-fetchers/bed/bed-parser.d.ts delete mode 100644 dist/src/data-fetchers/bed/bed-parser.d.ts.map delete mode 100644 dist/src/data-fetchers/bed/bed-worker.d.ts delete mode 100644 dist/src/data-fetchers/bed/bed-worker.d.ts.map delete mode 100644 dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts delete mode 100644 dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts.map delete mode 100644 dist/src/data-fetchers/csv/csv-data-fetcher.d.ts delete mode 100644 dist/src/data-fetchers/csv/csv-data-fetcher.d.ts.map delete mode 100644 dist/src/data-fetchers/gff/gff-data-fetcher.d.ts delete mode 100644 dist/src/data-fetchers/gff/gff-data-fetcher.d.ts.map delete mode 100644 dist/src/data-fetchers/gff/gff-worker.d.ts delete mode 100644 dist/src/data-fetchers/gff/gff-worker.d.ts.map delete mode 100644 dist/src/data-fetchers/gff/utils.d.ts delete mode 100644 dist/src/data-fetchers/gff/utils.d.ts.map delete mode 100644 dist/src/data-fetchers/index.d.ts delete mode 100644 dist/src/data-fetchers/index.d.ts.map delete mode 100644 dist/src/data-fetchers/json/json-data-fetcher.d.ts delete mode 100644 dist/src/data-fetchers/json/json-data-fetcher.d.ts.map delete mode 100644 dist/src/data-fetchers/utils.d.ts delete mode 100644 dist/src/data-fetchers/utils.d.ts.map delete mode 100644 dist/src/data-fetchers/vcf/utils.d.ts delete mode 100644 dist/src/data-fetchers/vcf/utils.d.ts.map delete mode 100644 dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts delete mode 100644 dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts.map delete mode 100644 dist/src/data-fetchers/vcf/vcf-worker.d.ts delete mode 100644 dist/src/data-fetchers/vcf/vcf-worker.d.ts.map delete mode 100644 dist/src/exported-utils.d.ts delete mode 100644 dist/src/exported-utils.d.ts.map delete mode 100644 dist/src/gosling-schema/gosling.schema.d.ts delete mode 100644 dist/src/gosling-schema/gosling.schema.d.ts.map delete mode 100644 dist/src/gosling-schema/gosling.schema.guards.d.ts delete mode 100644 dist/src/gosling-schema/gosling.schema.guards.d.ts.map delete mode 100644 dist/src/gosling-schema/index.d.ts delete mode 100644 dist/src/gosling-schema/index.d.ts.map delete mode 100644 dist/src/gosling-schema/validate.d.ts delete mode 100644 dist/src/gosling-schema/validate.d.ts.map delete mode 100644 dist/src/gosling-theme/dark.d.ts delete mode 100644 dist/src/gosling-theme/dark.d.ts.map delete mode 100644 dist/src/gosling-theme/ensembl.d.ts delete mode 100644 dist/src/gosling-theme/ensembl.d.ts.map delete mode 100644 dist/src/gosling-theme/excel.d.ts delete mode 100644 dist/src/gosling-theme/excel.d.ts.map delete mode 100644 dist/src/gosling-theme/ggplot.d.ts delete mode 100644 dist/src/gosling-theme/ggplot.d.ts.map delete mode 100644 dist/src/gosling-theme/google.d.ts delete mode 100644 dist/src/gosling-theme/google.d.ts.map delete mode 100644 dist/src/gosling-theme/igv.d.ts delete mode 100644 dist/src/gosling-theme/igv.d.ts.map delete mode 100644 dist/src/gosling-theme/index.d.ts delete mode 100644 dist/src/gosling-theme/index.d.ts.map delete mode 100644 dist/src/gosling-theme/jbrowse.d.ts delete mode 100644 dist/src/gosling-theme/jbrowse.d.ts.map delete mode 100644 dist/src/gosling-theme/light.d.ts delete mode 100644 dist/src/gosling-theme/light.d.ts.map delete mode 100644 dist/src/gosling-theme/test.d.ts delete mode 100644 dist/src/gosling-theme/test.d.ts.map delete mode 100644 dist/src/gosling-theme/ucsc.d.ts delete mode 100644 dist/src/gosling-theme/ucsc.d.ts.map delete mode 100644 dist/src/gosling-theme/warm.d.ts delete mode 100644 dist/src/gosling-theme/warm.d.ts.map delete mode 100644 dist/src/gosling-theme/washu.d.ts delete mode 100644 dist/src/gosling-theme/washu.d.ts.map delete mode 100644 dist/src/higlass-schema/higlass.schema.d.ts delete mode 100644 dist/src/higlass-schema/higlass.schema.d.ts.map delete mode 100644 dist/src/higlass-schema/index.d.ts delete mode 100644 dist/src/higlass-schema/index.d.ts.map delete mode 100644 dist/src/index.d.ts delete mode 100644 dist/src/index.d.ts.map delete mode 100644 dist/src/tracks/dummy-track/dummy-track.d.ts delete mode 100644 dist/src/tracks/dummy-track/dummy-track.d.ts.map delete mode 100644 dist/src/tracks/dummy-track/index.d.ts delete mode 100644 dist/src/tracks/dummy-track/index.d.ts.map delete mode 100644 dist/src/tracks/gosling-brush/brush-track.d.ts delete mode 100644 dist/src/tracks/gosling-brush/brush-track.d.ts.map delete mode 100644 dist/src/tracks/gosling-brush/index.d.ts delete mode 100644 dist/src/tracks/gosling-brush/index.d.ts.map delete mode 100644 dist/src/tracks/gosling-brush/linear-brush-model.d.ts delete mode 100644 dist/src/tracks/gosling-brush/linear-brush-model.d.ts.map delete mode 100644 dist/src/tracks/gosling-genomic-axis/axis-track.d.ts delete mode 100644 dist/src/tracks/gosling-genomic-axis/axis-track.d.ts.map delete mode 100644 dist/src/tracks/gosling-genomic-axis/index.d.ts delete mode 100644 dist/src/tracks/gosling-genomic-axis/index.d.ts.map delete mode 100644 dist/src/tracks/gosling-track/data-abstraction.d.ts delete mode 100644 dist/src/tracks/gosling-track/data-abstraction.d.ts.map delete mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts delete mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts.map delete mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts delete mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts.map delete mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts delete mode 100644 dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts.map delete mode 100644 dist/src/tracks/gosling-track/gosling-track-model.d.ts delete mode 100644 dist/src/tracks/gosling-track/gosling-track-model.d.ts.map delete mode 100644 dist/src/tracks/gosling-track/gosling-track.d.ts delete mode 100644 dist/src/tracks/gosling-track/gosling-track.d.ts.map delete mode 100644 dist/src/tracks/gosling-track/index.d.ts delete mode 100644 dist/src/tracks/gosling-track/index.d.ts.map delete mode 100644 dist/utils.js delete mode 100644 dist/utils.js.map diff --git a/.gitignore b/.gitignore index d385dbcf..e8a96926 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /node_modules /coverage /build -# /dist Check in dist to allow installing from here +/dist /.pnp /lib /bin diff --git a/dist/assets/bam-worker-fec5d05b.js.map b/dist/assets/bam-worker-fec5d05b.js.map deleted file mode 100644 index 99d93395..00000000 --- a/dist/assets/bam-worker-fec5d05b.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bam-worker-fec5d05b.js","sources":["../node_modules/.pnpm/is-observable@2.1.0/node_modules/is-observable/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/serializers.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/common.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/symbols.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/transferable.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/types/messages.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/implementation.browser.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/worker.mjs","../node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/virtualOffset.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/chunk.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/indexFile.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/util.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/bai.js","../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js","../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js","../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js","../__vite-browser-external","../node_modules/.pnpm/generic-filehandle@3.1.1/node_modules/generic-filehandle/esm/remoteFile.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js","../node_modules/.pnpm/@gmod+bgzf-filehandle@1.4.7/node_modules/@gmod/bgzf-filehandle/esm/unzip-pako.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/csi.js","../node_modules/.pnpm/buffer-crc32@0.2.13/node_modules/buffer-crc32/index.js","../node_modules/.pnpm/object.entries-ponyfill@1.0.1/node_modules/object.entries-ponyfill/entries.js","../node_modules/.pnpm/object.entries-ponyfill@1.0.1/node_modules/object.entries-ponyfill/index.js","../node_modules/.pnpm/abortcontroller-polyfill@1.7.5/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/abortcontroller-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateAbortController.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateStatusReporter.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AbortablePromiseCache.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/index.js","../node_modules/.pnpm/quick-lru@2.0.0/node_modules/quick-lru/index.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/constants.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/record.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/sam.js","../node_modules/.pnpm/@gmod+bam@1.1.18/node_modules/@gmod/bam/esm/bamFile.js","../node_modules/.pnpm/cross-fetch@3.1.8/node_modules/cross-fetch/dist/browser-polyfill.js","../node_modules/.pnpm/quick-lru@6.1.2/node_modules/quick-lru/index.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/ascending.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/bisector.js","../src/data-fetchers/utils.ts","../src/data-fetchers/bam/bam-worker.ts"],"sourcesContent":["'use strict';\n\nmodule.exports = value => {\n\tif (!value) {\n\t\treturn false;\n\t}\n\n\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\tif (typeof Symbol.observable === 'symbol' && typeof value[Symbol.observable] === 'function') {\n\t\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\t\treturn value === value[Symbol.observable]();\n\t}\n\n\tif (typeof value['@@observable'] === 'function') {\n\t\treturn value === value['@@observable']();\n\t}\n\n\treturn false;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultSerializer = exports.extendSerializer = void 0;\nfunction extendSerializer(extend, implementation) {\n const fallbackDeserializer = extend.deserialize.bind(extend);\n const fallbackSerializer = extend.serialize.bind(extend);\n return {\n deserialize(message) {\n return implementation.deserialize(message, fallbackDeserializer);\n },\n serialize(input) {\n return implementation.serialize(input, fallbackSerializer);\n }\n };\n}\nexports.extendSerializer = extendSerializer;\nconst DefaultErrorSerializer = {\n deserialize(message) {\n return Object.assign(Error(message.message), {\n name: message.name,\n stack: message.stack\n });\n },\n serialize(error) {\n return {\n __error_marker: \"$$error\",\n message: error.message,\n name: error.name,\n stack: error.stack\n };\n }\n};\nconst isSerializedError = (thing) => thing && typeof thing === \"object\" && \"__error_marker\" in thing && thing.__error_marker === \"$$error\";\nexports.DefaultSerializer = {\n deserialize(message) {\n if (isSerializedError(message)) {\n return DefaultErrorSerializer.deserialize(message);\n }\n else {\n return message;\n }\n },\n serialize(input) {\n if (input instanceof Error) {\n return DefaultErrorSerializer.serialize(input);\n }\n else {\n return input;\n }\n }\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.serialize = exports.deserialize = exports.registerSerializer = void 0;\nconst serializers_1 = require(\"./serializers\");\nlet registeredSerializer = serializers_1.DefaultSerializer;\nfunction registerSerializer(serializer) {\n registeredSerializer = serializers_1.extendSerializer(registeredSerializer, serializer);\n}\nexports.registerSerializer = registerSerializer;\nfunction deserialize(message) {\n return registeredSerializer.deserialize(message);\n}\nexports.deserialize = deserialize;\nfunction serialize(input) {\n return registeredSerializer.serialize(input);\n}\nexports.serialize = serialize;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.$worker = exports.$transferable = exports.$terminate = exports.$events = exports.$errors = void 0;\nexports.$errors = Symbol(\"thread.errors\");\nexports.$events = Symbol(\"thread.events\");\nexports.$terminate = Symbol(\"thread.terminate\");\nexports.$transferable = Symbol(\"thread.transferable\");\nexports.$worker = Symbol(\"thread.worker\");\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Transfer = exports.isTransferDescriptor = void 0;\nconst symbols_1 = require(\"./symbols\");\nfunction isTransferable(thing) {\n if (!thing || typeof thing !== \"object\")\n return false;\n // Don't check too thoroughly, since the list of transferable things in JS might grow over time\n return true;\n}\nfunction isTransferDescriptor(thing) {\n return thing && typeof thing === \"object\" && thing[symbols_1.$transferable];\n}\nexports.isTransferDescriptor = isTransferDescriptor;\nfunction Transfer(payload, transferables) {\n if (!transferables) {\n if (!isTransferable(payload))\n throw Error();\n transferables = [payload];\n }\n return {\n [symbols_1.$transferable]: true,\n send: payload,\n transferables\n };\n}\nexports.Transfer = Transfer;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WorkerMessageType = exports.MasterMessageType = void 0;\n/////////////////////////////\n// Messages sent by master:\nvar MasterMessageType;\n(function (MasterMessageType) {\n MasterMessageType[\"cancel\"] = \"cancel\";\n MasterMessageType[\"run\"] = \"run\";\n})(MasterMessageType = exports.MasterMessageType || (exports.MasterMessageType = {}));\n////////////////////////////\n// Messages sent by worker:\nvar WorkerMessageType;\n(function (WorkerMessageType) {\n WorkerMessageType[\"error\"] = \"error\";\n WorkerMessageType[\"init\"] = \"init\";\n WorkerMessageType[\"result\"] = \"result\";\n WorkerMessageType[\"running\"] = \"running\";\n WorkerMessageType[\"uncaughtError\"] = \"uncaughtError\";\n})(WorkerMessageType = exports.WorkerMessageType || (exports.WorkerMessageType = {}));\n","\"use strict\";\n/// \n// tslint:disable no-shadowed-variable\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst isWorkerRuntime = function isWorkerRuntime() {\n const isWindowContext = typeof self !== \"undefined\" && typeof Window !== \"undefined\" && self instanceof Window;\n return typeof self !== \"undefined\" && self.postMessage && !isWindowContext ? true : false;\n};\nconst postMessageToMaster = function postMessageToMaster(data, transferList) {\n self.postMessage(data, transferList);\n};\nconst subscribeToMasterMessages = function subscribeToMasterMessages(onMessage) {\n const messageHandler = (messageEvent) => {\n onMessage(messageEvent.data);\n };\n const unsubscribe = () => {\n self.removeEventListener(\"message\", messageHandler);\n };\n self.addEventListener(\"message\", messageHandler);\n return unsubscribe;\n};\nexports.default = {\n isWorkerRuntime,\n postMessageToMaster,\n subscribeToMasterMessages\n};\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.expose = exports.isWorkerRuntime = exports.Transfer = exports.registerSerializer = void 0;\nconst is_observable_1 = __importDefault(require(\"is-observable\"));\nconst common_1 = require(\"../common\");\nconst transferable_1 = require(\"../transferable\");\nconst messages_1 = require(\"../types/messages\");\nconst implementation_1 = __importDefault(require(\"./implementation\"));\nvar common_2 = require(\"../common\");\nObject.defineProperty(exports, \"registerSerializer\", { enumerable: true, get: function () { return common_2.registerSerializer; } });\nvar transferable_2 = require(\"../transferable\");\nObject.defineProperty(exports, \"Transfer\", { enumerable: true, get: function () { return transferable_2.Transfer; } });\n/** Returns `true` if this code is currently running in a worker. */\nexports.isWorkerRuntime = implementation_1.default.isWorkerRuntime;\nlet exposeCalled = false;\nconst activeSubscriptions = new Map();\nconst isMasterJobCancelMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.cancel;\nconst isMasterJobRunMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.run;\n/**\n * There are issues with `is-observable` not recognizing zen-observable's instances.\n * We are using `observable-fns`, but it's based on zen-observable, too.\n */\nconst isObservable = (thing) => is_observable_1.default(thing) || isZenObservable(thing);\nfunction isZenObservable(thing) {\n return thing && typeof thing === \"object\" && typeof thing.subscribe === \"function\";\n}\nfunction deconstructTransfer(thing) {\n return transferable_1.isTransferDescriptor(thing)\n ? { payload: thing.send, transferables: thing.transferables }\n : { payload: thing, transferables: undefined };\n}\nfunction postFunctionInitMessage() {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"function\"\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postModuleInitMessage(methodNames) {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"module\",\n methods: methodNames\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postJobErrorMessage(uid, rawError) {\n const { payload: error, transferables } = deconstructTransfer(rawError);\n const errorMessage = {\n type: messages_1.WorkerMessageType.error,\n uid,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage, transferables);\n}\nfunction postJobResultMessage(uid, completed, resultValue) {\n const { payload, transferables } = deconstructTransfer(resultValue);\n const resultMessage = {\n type: messages_1.WorkerMessageType.result,\n uid,\n complete: completed ? true : undefined,\n payload\n };\n implementation_1.default.postMessageToMaster(resultMessage, transferables);\n}\nfunction postJobStartMessage(uid, resultType) {\n const startMessage = {\n type: messages_1.WorkerMessageType.running,\n uid,\n resultType\n };\n implementation_1.default.postMessageToMaster(startMessage);\n}\nfunction postUncaughtErrorMessage(error) {\n try {\n const errorMessage = {\n type: messages_1.WorkerMessageType.uncaughtError,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage);\n }\n catch (subError) {\n // tslint:disable-next-line no-console\n console.error(\"Not reporting uncaught error back to master thread as it \" +\n \"occured while reporting an uncaught error already.\" +\n \"\\nLatest error:\", subError, \"\\nOriginal error:\", error);\n }\n}\nfunction runFunction(jobUID, fn, args) {\n return __awaiter(this, void 0, void 0, function* () {\n let syncResult;\n try {\n syncResult = fn(...args);\n }\n catch (error) {\n return postJobErrorMessage(jobUID, error);\n }\n const resultType = isObservable(syncResult) ? \"observable\" : \"promise\";\n postJobStartMessage(jobUID, resultType);\n if (isObservable(syncResult)) {\n const subscription = syncResult.subscribe(value => postJobResultMessage(jobUID, false, common_1.serialize(value)), error => {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n activeSubscriptions.delete(jobUID);\n }, () => {\n postJobResultMessage(jobUID, true);\n activeSubscriptions.delete(jobUID);\n });\n activeSubscriptions.set(jobUID, subscription);\n }\n else {\n try {\n const result = yield syncResult;\n postJobResultMessage(jobUID, true, common_1.serialize(result));\n }\n catch (error) {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n }\n }\n });\n}\n/**\n * Expose a function or a module (an object whose values are functions)\n * to the main thread. Must be called exactly once in every worker thread\n * to signal its API to the main thread.\n *\n * @param exposed Function or object whose values are functions\n */\nfunction expose(exposed) {\n if (!implementation_1.default.isWorkerRuntime()) {\n throw Error(\"expose() called in the master thread.\");\n }\n if (exposeCalled) {\n throw Error(\"expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.\");\n }\n exposeCalled = true;\n if (typeof exposed === \"function\") {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && !messageData.method) {\n runFunction(messageData.uid, exposed, messageData.args.map(common_1.deserialize));\n }\n });\n postFunctionInitMessage();\n }\n else if (typeof exposed === \"object\" && exposed) {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && messageData.method) {\n runFunction(messageData.uid, exposed[messageData.method], messageData.args.map(common_1.deserialize));\n }\n });\n const methodNames = Object.keys(exposed).filter(key => typeof exposed[key] === \"function\");\n postModuleInitMessage(methodNames);\n }\n else {\n throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${exposed}`);\n }\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobCancelMessage(messageData)) {\n const jobUID = messageData.uid;\n const subscription = activeSubscriptions.get(jobUID);\n if (subscription) {\n subscription.unsubscribe();\n activeSubscriptions.delete(jobUID);\n }\n }\n });\n}\nexports.expose = expose;\nif (typeof self !== \"undefined\" && typeof self.addEventListener === \"function\" && implementation_1.default.isWorkerRuntime()) {\n self.addEventListener(\"error\", event => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(event.error || event), 250);\n });\n self.addEventListener(\"unhandledrejection\", event => {\n const error = event.reason;\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\nif (typeof process !== \"undefined\" && typeof process.on === \"function\" && implementation_1.default.isWorkerRuntime()) {\n process.on(\"uncaughtException\", (error) => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n });\n process.on(\"unhandledRejection\", (error) => {\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\n","import WorkerContext from \"./dist/worker/index.js\"\n\nexport const expose = WorkerContext.expose\nexport const registerSerializer = WorkerContext.registerSerializer\nexport const Transfer = WorkerContext.Transfer\n","module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n","export default class VirtualOffset {\n constructor(blockPosition, dataPosition) {\n this.blockPosition = blockPosition; // < offset of the compressed data block\n this.dataPosition = dataPosition; // < offset into the uncompressed data\n }\n toString() {\n return `${this.blockPosition}:${this.dataPosition}`;\n }\n compareTo(b) {\n return (this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition);\n }\n static min(...args) {\n let min;\n let i = 0;\n for (; !min; i += 1) {\n min = args[i];\n }\n for (; i < args.length; i += 1) {\n if (min.compareTo(args[i]) > 0) {\n min = args[i];\n }\n }\n return min;\n }\n}\nexport function fromBytes(bytes, offset = 0, bigendian = false) {\n if (bigendian) {\n throw new Error('big-endian virtual file offsets not implemented');\n }\n return new VirtualOffset(bytes[offset + 7] * 0x10000000000 +\n bytes[offset + 6] * 0x100000000 +\n bytes[offset + 5] * 0x1000000 +\n bytes[offset + 4] * 0x10000 +\n bytes[offset + 3] * 0x100 +\n bytes[offset + 2], (bytes[offset + 1] << 8) | bytes[offset]);\n}\n//# sourceMappingURL=virtualOffset.js.map","// little class representing a chunk in the index\nexport default class Chunk {\n /**\n * @param {VirtualOffset} minv\n * @param {VirtualOffset} maxv\n * @param {number} bin\n * @param {number} [fetchedSize]\n */\n constructor(minv, maxv, bin, fetchedSize = undefined) {\n this.minv = minv;\n this.maxv = maxv;\n this.bin = bin;\n this._fetchedSize = fetchedSize;\n }\n toUniqueString() {\n return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`;\n }\n toString() {\n return this.toUniqueString();\n }\n compareTo(b) {\n return (this.minv.compareTo(b.minv) ||\n this.maxv.compareTo(b.maxv) ||\n this.bin - b.bin);\n }\n fetchedSize() {\n if (this._fetchedSize !== undefined) {\n return this._fetchedSize;\n }\n return this.maxv.blockPosition + (1 << 16) - this.minv.blockPosition;\n }\n}\n//# sourceMappingURL=chunk.js.map","export default class IndexFile {\n /**\n * @param {filehandle} filehandle\n * @param {function} [renameRefSeqs]\n */\n constructor({ filehandle, renameRefSeq = (n) => n, }) {\n this.filehandle = filehandle;\n this.renameRefSeq = renameRefSeq;\n }\n _findFirstData(data, virtualOffset) {\n const currentFdl = data.firstDataLine;\n if (currentFdl) {\n data.firstDataLine =\n currentFdl.compareTo(virtualOffset) > 0 ? virtualOffset : currentFdl;\n }\n else {\n data.firstDataLine = virtualOffset;\n }\n }\n async parse(opts = {}) {\n if (!this.setupP) {\n this.setupP = this._parse(opts).catch(e => {\n this.setupP = undefined;\n throw e;\n });\n }\n return this.setupP;\n }\n async hasRefSeq(seqId, opts = {}) {\n return !!((await this.parse(opts)).indices[seqId] || {}).binIndex;\n }\n}\n//# sourceMappingURL=indexFile.js.map","export function timeout(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\nexport function longToNumber(long) {\n if (long.greaterThan(Number.MAX_SAFE_INTEGER) ||\n long.lessThan(Number.MIN_SAFE_INTEGER)) {\n throw new Error('integer overflow');\n }\n return long.toNumber();\n}\n/**\n * Properly check if the given AbortSignal is aborted.\n * Per the standard, if the signal reads as aborted,\n * this function throws either a DOMException AbortError, or a regular error\n * with a `code` attribute set to `ERR_ABORTED`.\n *\n * For convenience, passing `undefined` is a no-op\n *\n * @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute\n * @returns nothing\n */\nexport function checkAbortSignal(signal) {\n if (!signal) {\n return;\n }\n if (signal.aborted) {\n // console.log('bam aborted!')\n if (typeof DOMException !== 'undefined') {\n throw new DOMException('aborted', 'AbortError');\n }\n else {\n const e = new Error('aborted');\n //@ts-ignore\n e.code = 'ERR_ABORTED';\n throw e;\n }\n }\n}\n/**\n * Skips to the next tick, then runs `checkAbortSignal`.\n * Await this to inside an otherwise synchronous loop to\n * provide a place to break when an abort signal is received.\n * @param {AbortSignal} signal\n */\nexport async function abortBreakPoint(signal) {\n await Promise.resolve();\n checkAbortSignal(signal);\n}\nexport function canMergeBlocks(chunk1, chunk2) {\n return (chunk2.minv.blockPosition - chunk1.maxv.blockPosition < 65000 &&\n chunk2.maxv.blockPosition - chunk1.minv.blockPosition < 5000000);\n}\nexport function makeOpts(obj = {}) {\n return 'aborted' in obj ? { signal: obj } : obj;\n}\nexport function optimizeChunks(chunks, lowest) {\n const mergedChunks = [];\n let lastChunk = null;\n if (chunks.length === 0) {\n return chunks;\n }\n chunks.sort((c0, c1) => {\n const dif = c0.minv.blockPosition - c1.minv.blockPosition;\n if (dif !== 0) {\n return dif;\n }\n else {\n return c0.minv.dataPosition - c1.minv.dataPosition;\n }\n });\n chunks.forEach(chunk => {\n if (!lowest || chunk.maxv.compareTo(lowest) > 0) {\n if (lastChunk === null) {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n else {\n if (canMergeBlocks(lastChunk, chunk)) {\n if (chunk.maxv.compareTo(lastChunk.maxv) > 0) {\n lastChunk.maxv = chunk.maxv;\n }\n }\n else {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n }\n }\n });\n return mergedChunks;\n}\n//# sourceMappingURL=util.js.map","import Long from 'long';\nimport { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport IndexFile from './indexFile';\nimport { longToNumber, optimizeChunks } from './util';\nconst BAI_MAGIC = 21578050; // BAI\\1\nfunction roundDown(n, multiple) {\n return n - (n % multiple);\n}\nfunction roundUp(n, multiple) {\n return n - (n % multiple) + multiple;\n}\nexport default class BAI extends IndexFile {\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(Array.prototype.slice.call(bytes, offset + 16, offset + 24), true));\n return { lineCount };\n }\n async lineCount(refId, opts = {}) {\n const prom = await this.parse(opts);\n const index = prom.indices[refId];\n if (!index) {\n return -1;\n }\n const ret = index.stats || {};\n return ret.lineCount === undefined ? -1 : ret.lineCount;\n }\n fetchBai(opts = {}) {\n if (!this.baiP) {\n this.baiP = this.filehandle.readFile(opts).catch(e => {\n this.baiP = undefined;\n throw e;\n });\n }\n return this.baiP;\n }\n // fetch and parse the index\n async _parse() {\n const data = { bai: true, maxBlockSize: 1 << 16 };\n const bytes = await this.fetchBai();\n // check BAI magic numbers\n if (bytes.readUInt32LE(0) !== BAI_MAGIC) {\n throw new Error('Not a BAI file');\n }\n data.refCount = bytes.readInt32LE(4);\n const depth = 5;\n const binLimit = ((1 << ((depth + 1) * 3)) - 1) / 7;\n // read the indexes for each reference sequence\n data.indices = new Array(data.refCount);\n let currOffset = 8;\n for (let i = 0; i < data.refCount; i += 1) {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n let stats;\n currOffset += 4;\n const binIndex = {};\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n currOffset += 4;\n if (bin === binLimit + 1) {\n currOffset += 4;\n stats = this.parsePseudoBin(bytes, currOffset);\n currOffset += 32;\n }\n else if (bin > binLimit + 1) {\n throw new Error('bai index contains too many bins, please use CSI');\n }\n else {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n this._findFirstData(data, u);\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n const linearCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n // as we're going through the linear index, figure out\n // the smallest virtual offset in the indexes, which\n // tells us where the BAM header ends\n const linearIndex = new Array(linearCount);\n for (let k = 0; k < linearCount; k += 1) {\n linearIndex[k] = fromBytes(bytes, currOffset);\n currOffset += 8;\n this._findFirstData(data, linearIndex[k]);\n }\n data.indices[i] = { binIndex, linearIndex, stats };\n }\n return data;\n }\n async indexCov(seqId, start, end, opts = {}) {\n const v = 16384;\n const range = start !== undefined;\n const indexData = await this.parse(opts);\n const seqIdx = indexData.indices[seqId];\n if (!seqIdx) {\n return [];\n }\n const { linearIndex = [], stats } = seqIdx;\n if (!linearIndex.length) {\n return [];\n }\n const e = end !== undefined ? roundUp(end, v) : (linearIndex.length - 1) * v;\n const s = start !== undefined ? roundDown(start, v) : 0;\n let depths;\n if (range) {\n depths = new Array((e - s) / v);\n }\n else {\n depths = new Array(linearIndex.length - 1);\n }\n const totalSize = linearIndex[linearIndex.length - 1].blockPosition;\n if (e > (linearIndex.length - 1) * v) {\n throw new Error('query outside of range of linear index');\n }\n let currentPos = linearIndex[s / v].blockPosition;\n for (let i = s / v, j = 0; i < e / v; i++, j++) {\n depths[j] = {\n score: linearIndex[i + 1].blockPosition - currentPos,\n start: i * v,\n end: i * v + v,\n };\n currentPos = linearIndex[i + 1].blockPosition;\n }\n return depths.map(d => {\n return { ...d, score: (d.score * stats.lineCount) / totalSize };\n });\n }\n /**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n * @returns {Array[number]}\n */\n reg2bins(beg, end) {\n end -= 1;\n return [\n [0, 0],\n [1 + (beg >> 26), 1 + (end >> 26)],\n [9 + (beg >> 23), 9 + (end >> 23)],\n [73 + (beg >> 20), 73 + (end >> 20)],\n [585 + (beg >> 17), 585 + (end >> 17)],\n [4681 + (beg >> 14), 4681 + (end >> 14)],\n ];\n }\n async blocksForRange(refId, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n // List of bin #s that overlap min, max\n const overlappingBins = this.reg2bins(min, max);\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n // Use the linear index to find minimum file position of chunks that could\n // contain alignments in the region\n const nintv = ba.linearIndex.length;\n let lowest = null;\n const minLin = Math.min(min >> 14, nintv - 1);\n const maxLin = Math.min(max >> 14, nintv - 1);\n for (let i = minLin; i <= maxLin; ++i) {\n const vp = ba.linearIndex[i];\n if (vp) {\n if (!lowest || vp.compareTo(lowest) < 0) {\n lowest = vp;\n }\n }\n }\n return optimizeChunks(chunks, lowest);\n }\n}\n//# sourceMappingURL=bai.js.map","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","export default {}","import { Buffer } from 'buffer';\nexport default class RemoteFile {\n async getBufferFromResponse(response) {\n if (typeof response.buffer === 'function') {\n return response.buffer();\n }\n else if (typeof response.arrayBuffer === 'function') {\n const resp = await response.arrayBuffer();\n return Buffer.from(resp);\n }\n else {\n throw new TypeError('invalid HTTP response object, has no buffer method, and no arrayBuffer method');\n }\n }\n constructor(source, opts = {}) {\n this.baseOverrides = {};\n this.url = source;\n const fetch = opts.fetch || globalThis.fetch.bind(globalThis);\n if (!fetch) {\n throw new TypeError(`no fetch function supplied, and none found in global environment`);\n }\n if (opts.overrides) {\n this.baseOverrides = opts.overrides;\n }\n this.fetchImplementation = fetch;\n }\n async fetch(input, init) {\n let response;\n try {\n response = await this.fetchImplementation(input, init);\n }\n catch (e) {\n if (`${e}`.includes('Failed to fetch')) {\n // refetch to to help work around a chrome bug (discussed in\n // generic-filehandle issue #72) in which the chrome cache returns a\n // CORS error for content in its cache. see also\n // https://github.com/GMOD/jbrowse-components/pull/1511\n console.warn(`generic-filehandle: refetching ${input} to attempt to work around chrome CORS header caching bug`);\n response = await this.fetchImplementation(input, {\n ...init,\n cache: 'reload',\n });\n }\n else {\n throw e;\n }\n }\n return response;\n }\n async read(buffer, offset = 0, length, position = 0, opts = {}) {\n const { headers = {}, signal, overrides = {} } = opts;\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n }\n else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n ...this.baseOverrides.headers,\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n };\n const response = await this.fetch(this.url, args);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n if ((response.status === 200 && position === 0) ||\n response.status === 206) {\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n return { bytesRead: bytesCopied, buffer };\n }\n if (response.status === 200) {\n throw new Error('${this.url} fetch returned status 200, expected 206');\n }\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n }\n async readFile(options = {}) {\n let encoding;\n let opts;\n if (typeof options === 'string') {\n encoding = options;\n opts = {};\n }\n else {\n encoding = options.encoding;\n opts = options;\n delete opts.encoding;\n }\n const { headers = {}, signal, overrides = {} } = opts;\n const args = {\n headers,\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n ...this.baseOverrides,\n ...overrides,\n };\n const response = await this.fetch(this.url, args);\n if (!response) {\n throw new Error('generic-filehandle failed to fetch');\n }\n if (response.status !== 200) {\n throw Object.assign(new Error(`HTTP ${response.status} fetching ${this.url}`), {\n status: response.status,\n });\n }\n if (encoding === 'utf8') {\n return response.text();\n }\n if (encoding) {\n throw new Error(`unsupported encoding: ${encoding}`);\n }\n return this.getBufferFromResponse(response);\n }\n async stat() {\n if (!this._stat) {\n const buf = Buffer.allocUnsafe(10);\n await this.read(buf, 0, 10, 0);\n if (!this._stat) {\n throw new Error(`unable to determine size of file at ${this.url}`);\n }\n }\n return this._stat;\n }\n async close() {\n return;\n }\n}\n//# sourceMappingURL=remoteFile.js.map","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","import { Buffer } from 'buffer';\n//@ts-ignore\nimport { Z_SYNC_FLUSH, Inflate } from 'pako';\n// browserify-zlib, which is the zlib shim used by default in webpacked code,\n// does not properly uncompress bgzf chunks that contain more than\n// one bgzf block, so export an unzip function that uses pako directly\n// if we are running in a browser.\nasync function unzip(inputData) {\n try {\n let strm;\n let pos = 0;\n let i = 0;\n const chunks = [];\n let totalSize = 0;\n let inflator;\n do {\n const remainingInput = inputData.subarray(pos);\n inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n pos += strm.next_in;\n chunks[i] = inflator.result;\n totalSize += chunks[i].length;\n i += 1;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n return Buffer.from(result);\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to pakounzip, except it does extra counting\n// to return the positions of compressed and decompressed\n// data offsets\nasync function unzipChunk(inputData) {\n try {\n let strm;\n let cpos = 0;\n let dpos = 0;\n const blocks = [];\n const cpositions = [];\n const dpositions = [];\n do {\n const remainingInput = inputData.slice(cpos);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = Buffer.from(inflator.result);\n blocks.push(buffer);\n cpositions.push(cpos);\n dpositions.push(dpos);\n cpos += strm.next_in;\n dpos += buffer.length;\n } while (strm.avail_in);\n const buffer = Buffer.concat(blocks);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to unzipChunk above but slices (0,minv.dataPosition) and\n// (maxv.dataPosition,end) off\nasync function unzipChunkSlice(inputData, chunk) {\n try {\n let strm;\n const { minv, maxv } = chunk;\n let cpos = minv.blockPosition;\n let dpos = minv.dataPosition;\n const chunks = [];\n const cpositions = [];\n const dpositions = [];\n let totalSize = 0;\n let i = 0;\n do {\n const remainingInput = inputData.subarray(cpos - minv.blockPosition);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = inflator.result;\n chunks.push(buffer);\n let len = buffer.length;\n cpositions.push(cpos);\n dpositions.push(dpos);\n if (chunks.length === 1 && minv.dataPosition) {\n // this is the first chunk, trim it\n chunks[0] = chunks[0].subarray(minv.dataPosition);\n len = chunks[0].length;\n }\n const origCpos = cpos;\n cpos += strm.next_in;\n dpos += len;\n if (origCpos >= maxv.blockPosition) {\n // this is the last chunk, trim it and stop decompressing\n // note if it is the same block is minv it subtracts that already\n // trimmed part of the slice length\n chunks[i] = chunks[i].subarray(0, maxv.blockPosition === minv.blockPosition\n ? maxv.dataPosition - minv.dataPosition + 1\n : maxv.dataPosition + 1);\n cpositions.push(cpos);\n dpositions.push(dpos);\n totalSize += chunks[i].length;\n break;\n }\n totalSize += chunks[i].length;\n i++;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n const buffer = Buffer.from(result);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\nfunction nodeUnzip() {\n throw new Error('nodeUnzip not implemented.');\n}\nexport { unzip, unzipChunk, unzipChunkSlice, unzip as pakoUnzip, nodeUnzip };\n//# sourceMappingURL=unzip-pako.js.map","import Long from 'long';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { longToNumber, abortBreakPoint, optimizeChunks } from './util';\nimport IndexFile from './indexFile';\nconst CSI1_MAGIC = 21582659; // CSI\\1\nconst CSI2_MAGIC = 38359875; // CSI\\2\nfunction lshift(num, bits) {\n return num * 2 ** bits;\n}\nfunction rshift(num, bits) {\n return Math.floor(num / 2 ** bits);\n}\nexport default class CSI extends IndexFile {\n constructor(args) {\n super(args);\n this.maxBinNumber = 0;\n this.depth = 0;\n this.minShift = 0;\n }\n async lineCount(refId) {\n const indexData = await this.parse();\n if (!indexData) {\n return -1;\n }\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n async indexCov() {\n return [];\n }\n parseAuxData(bytes, offset, auxLength) {\n if (auxLength < 30) {\n return {};\n }\n const data = {};\n data.formatFlags = bytes.readInt32LE(offset);\n data.coordinateType =\n data.formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n data.format = { 0: 'generic', 1: 'SAM', 2: 'VCF' }[data.formatFlags & 0xf];\n if (!data.format) {\n throw new Error(`invalid Tabix preset format flags ${data.formatFlags}`);\n }\n data.columnNumbers = {\n ref: bytes.readInt32LE(offset + 4),\n start: bytes.readInt32LE(offset + 8),\n end: bytes.readInt32LE(offset + 12),\n };\n data.metaValue = bytes.readInt32LE(offset + 16);\n data.metaChar = data.metaValue ? String.fromCharCode(data.metaValue) : '';\n data.skipLines = bytes.readInt32LE(offset + 20);\n const nameSectionLength = bytes.readInt32LE(offset + 24);\n Object.assign(data, this._parseNameBytes(bytes.subarray(offset + 28, offset + 28 + nameSectionLength)));\n return data;\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n // fetch and parse the index\n async _parse(opts) {\n const data = { csi: true, maxBlockSize: 1 << 16 };\n const buffer = (await this.filehandle.readFile(opts));\n const bytes = await unzip(buffer);\n // check TBI magic numbers\n if (bytes.readUInt32LE(0) === CSI1_MAGIC) {\n data.csiVersion = 1;\n }\n else if (bytes.readUInt32LE(0) === CSI2_MAGIC) {\n data.csiVersion = 2;\n }\n else {\n throw new Error('Not a CSI file');\n // TODO: do we need to support big-endian CSI files?\n }\n this.minShift = bytes.readInt32LE(4);\n this.depth = bytes.readInt32LE(8);\n this.maxBinNumber = ((1 << ((this.depth + 1) * 3)) - 1) / 7;\n const auxLength = bytes.readInt32LE(12);\n if (auxLength) {\n Object.assign(data, this.parseAuxData(bytes, 16, auxLength));\n }\n data.refCount = bytes.readInt32LE(16 + auxLength);\n // read the indexes for each reference sequence\n data.indices = new Array(data.refCount);\n let currOffset = 16 + auxLength + 4;\n for (let i = 0; i < data.refCount; i += 1) {\n await abortBreakPoint(opts.signal);\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats; // < provided by parsing a pseudo-bin, if present\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n if (bin > this.maxBinNumber) {\n // this is a fake bin that actually has stats information\n // about the reference sequence in it\n stats = this.parsePseudoBin(bytes, currOffset + 4);\n currOffset += 4 + 8 + 4 + 16 + 16;\n }\n else {\n const loffset = fromBytes(bytes, currOffset + 4);\n this._findFirstData(data, loffset);\n const chunkCount = bytes.readInt32LE(currOffset + 12);\n currOffset += 16;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n // this._findFirstData(data, u)\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n data.indices[i] = { binIndex, stats };\n }\n return data;\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(Array.prototype.slice.call(bytes, offset + 28, offset + 36), true));\n return { lineCount };\n }\n async blocksForRange(refId, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n const ba = indexData === null || indexData === void 0 ? void 0 : indexData.indices[refId];\n if (!ba) {\n return [];\n }\n const overlappingBins = this.reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n return optimizeChunks(chunks, new VirtualOffset(0, 0));\n }\n /**\n * calculate the list of bins that may overlap with region [beg,end)\n * (zero-based half-open)\n */\n reg2bins(beg, end) {\n beg -= 1; // < convert to 1-based closed\n if (beg < 1) {\n beg = 1;\n }\n if (end > 2 ** 50) {\n end = 2 ** 34;\n } // 17 GiB ought to be enough for anybody\n end -= 1;\n let l = 0;\n let t = 0;\n let s = this.minShift + this.depth * 3;\n const bins = [];\n for (; l <= this.depth; s -= 3, t += lshift(1, l * 3), l += 1) {\n const b = t + rshift(beg, s);\n const e = t + rshift(end, s);\n if (e - b + bins.length > this.maxBinNumber) {\n throw new Error(`query ${beg}-${end} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);\n }\n bins.push([b, e]);\n }\n return bins;\n }\n}\n//# sourceMappingURL=csi.js.map","var Buffer = require('buffer').Buffer;\n\nvar CRC_TABLE = [\n 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,\n 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,\n 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,\n 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,\n 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,\n 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,\n 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,\n 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,\n 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,\n 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,\n 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,\n 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,\n 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,\n 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,\n 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,\n 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,\n 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,\n 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,\n 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,\n 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,\n 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,\n 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,\n 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,\n 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,\n 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,\n 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,\n 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,\n 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,\n 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,\n 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,\n 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,\n 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,\n 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,\n 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,\n 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,\n 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,\n 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,\n 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,\n 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,\n 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,\n 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,\n 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,\n 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,\n 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,\n 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,\n 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,\n 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,\n 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,\n 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,\n 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,\n 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,\n 0x2d02ef8d\n];\n\nif (typeof Int32Array !== 'undefined') {\n CRC_TABLE = new Int32Array(CRC_TABLE);\n}\n\nfunction ensureBuffer(input) {\n if (Buffer.isBuffer(input)) {\n return input;\n }\n\n var hasNewBufferAPI =\n typeof Buffer.alloc === \"function\" &&\n typeof Buffer.from === \"function\";\n\n if (typeof input === \"number\") {\n return hasNewBufferAPI ? Buffer.alloc(input) : new Buffer(input);\n }\n else if (typeof input === \"string\") {\n return hasNewBufferAPI ? Buffer.from(input) : new Buffer(input);\n }\n else {\n throw new Error(\"input must be buffer, number, or string, received \" +\n typeof input);\n }\n}\n\nfunction bufferizeInt(num) {\n var tmp = ensureBuffer(4);\n tmp.writeInt32BE(num, 0);\n return tmp;\n}\n\nfunction _crc32(buf, previous) {\n buf = ensureBuffer(buf);\n if (Buffer.isBuffer(previous)) {\n previous = previous.readUInt32BE(0);\n }\n var crc = ~~previous ^ -1;\n for (var n = 0; n < buf.length; n++) {\n crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8);\n }\n return (crc ^ -1);\n}\n\nfunction crc32() {\n return bufferizeInt(_crc32.apply(null, arguments));\n}\ncrc32.signed = function () {\n return _crc32.apply(null, arguments);\n};\ncrc32.unsigned = function () {\n return _crc32.apply(null, arguments) >>> 0;\n};\n\nmodule.exports = crc32;\n","'use strict'\n\nvar has = function (obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop) }\nvar isEnumerable = function (obj, prop) {\n return Object.prototype.propertyIsEnumerable.call(obj, prop)\n}\n\nfunction entries (obj) {\n if (obj == null) {\n throw new TypeError('Cannot convert undefined or null to object')\n }\n var pairs = []\n for (var key in obj) {\n if (has(obj, key) && isEnumerable(obj, key)) {\n pairs.push([key, obj[key]])\n }\n }\n return pairs\n}\n\nmodule.exports = entries\n","module.exports = typeof Object.entries === 'function' ? Object.entries : require('./entries')\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get.apply(this, arguments);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'reason', {\n value: undefined,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort(reason) {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n var signalReason = reason;\n\n if (signalReason === undefined) {\n if (typeof document === 'undefined') {\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n } else {\n try {\n signalReason = new DOMException('signal is aborted without reason');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n }\n }\n }\n\n this.signal.reason = signalReason;\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","\"use strict\";\n/* eslint-disable */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbortSignal = exports.AbortController = void 0;\nconst cjs_ponyfill_1 = require(\"abortcontroller-polyfill/dist/cjs-ponyfill\");\nvar getGlobal = function () {\n // the only reliable means to get the global object is\n // `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n};\n//@ts-ignore\nlet AbortController = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortController : getGlobal().AbortController;\nexports.AbortController = AbortController;\n//@ts-ignore\nlet AbortSignal = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal;\nexports.AbortSignal = AbortSignal;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nclass NullSignal {\n}\n/**\n * aggregates a number of abort signals, will only fire the aggregated\n * abort if all of the input signals have been aborted\n */\nclass AggregateAbortController {\n constructor() {\n this.signals = new Set();\n this.abortController = new abortcontroller_ponyfill_1.AbortController();\n }\n /**\n * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy,\n * will be treated as a null-signal, and this abortcontroller will no\n * longer be abortable.\n */\n //@ts-ignore\n addSignal(signal = new NullSignal()) {\n if (this.signal.aborted) {\n throw new Error('cannot add a signal, already aborted!');\n }\n // note that a NullSignal will never fire, so if we\n // have one this thing will never actually abort\n this.signals.add(signal);\n if (signal.aborted) {\n // handle the abort immediately if it is already aborted\n // for some reason\n this.handleAborted(signal);\n }\n else if (typeof signal.addEventListener === 'function') {\n signal.addEventListener('abort', () => {\n this.handleAborted(signal);\n });\n }\n }\n handleAborted(signal) {\n this.signals.delete(signal);\n if (this.signals.size === 0) {\n this.abortController.abort();\n }\n }\n get signal() {\n return this.abortController.signal;\n }\n abort() {\n this.abortController.abort();\n }\n}\nexports.default = AggregateAbortController;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass AggregateStatusReporter {\n constructor() {\n this.callbacks = new Set();\n }\n addCallback(callback = () => { }) {\n this.callbacks.add(callback);\n callback(this.currentMessage);\n }\n callback(message) {\n this.currentMessage = message;\n this.callbacks.forEach(elt => {\n elt(message);\n });\n }\n}\nexports.default = AggregateStatusReporter;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nconst AggregateAbortController_1 = __importDefault(require(\"./AggregateAbortController\"));\nconst AggregateStatusReporter_1 = __importDefault(require(\"./AggregateStatusReporter\"));\nclass AbortablePromiseCache {\n constructor({ fill, cache, }) {\n if (typeof fill !== 'function') {\n throw new TypeError('must pass a fill function');\n }\n if (typeof cache !== 'object') {\n throw new TypeError('must pass a cache object');\n }\n if (typeof cache.get !== 'function' ||\n typeof cache.set !== 'function' ||\n typeof cache.delete !== 'function') {\n throw new TypeError('cache must implement get(key), set(key, val), and and delete(key)');\n }\n this.cache = cache;\n this.fillCallback = fill;\n }\n static isAbortException(exception) {\n return (\n // DOMException\n exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n //@ts-ignore\n exception.code === 'ERR_ABORTED' ||\n // stringified DOMException\n exception.message === 'AbortError: aborted' ||\n // stringified standard-ish exception\n exception.message === 'Error: aborted');\n }\n evict(key, entry) {\n if (this.cache.get(key) === entry) {\n this.cache.delete(key);\n }\n }\n fill(key, data, signal, statusCallback) {\n const aborter = new AggregateAbortController_1.default();\n const statusReporter = new AggregateStatusReporter_1.default();\n statusReporter.addCallback(statusCallback);\n const newEntry = {\n aborter: aborter,\n promise: this.fillCallback(data, aborter.signal, (message) => {\n statusReporter.callback(message);\n }),\n settled: false,\n statusReporter,\n get aborted() {\n return this.aborter.signal.aborted;\n },\n };\n newEntry.aborter.addSignal(signal);\n // remove the fill from the cache when its abortcontroller fires, if still in there\n newEntry.aborter.signal.addEventListener('abort', () => {\n if (!newEntry.settled) {\n this.evict(key, newEntry);\n }\n });\n // chain off the cached promise to record when it settles\n newEntry.promise\n .then(() => {\n newEntry.settled = true;\n }, () => {\n newEntry.settled = true;\n // if the fill throws an error (including abort) and is still in the cache, remove it\n this.evict(key, newEntry);\n })\n .catch(e => {\n // this will only be reached if there is some kind of\n // bad bug in this library\n console.error(e);\n throw e;\n });\n this.cache.set(key, newEntry);\n }\n static checkSinglePromise(promise, signal) {\n // check just this signal for having been aborted, and abort the\n // promise if it was, regardless of what happened with the cached\n // response\n function checkForSingleAbort() {\n if (signal && signal.aborted) {\n throw Object.assign(new Error('aborted'), { code: 'ERR_ABORTED' });\n }\n }\n return promise.then(result => {\n checkForSingleAbort();\n return result;\n }, error => {\n checkForSingleAbort();\n throw error;\n });\n }\n has(key) {\n return this.cache.has(key);\n }\n /**\n * Callback for getting status of the pending async\n *\n * @callback statusCallback\n * @param {any} status, current status string or message object\n */\n /**\n * @param {any} key cache key to use for this request\n * @param {any} data data passed as the first argument to the fill callback\n * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request\n * @param {statusCallback} a callback to get the current status of a pending async operation\n */\n get(key, data, signal, statusCallback) {\n if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) {\n throw new TypeError('second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?');\n }\n const cacheEntry = this.cache.get(key);\n if (cacheEntry) {\n if (cacheEntry.aborted && !cacheEntry.settled) {\n // if it's aborted but has not realized it yet, evict it and redispatch\n this.evict(key, cacheEntry);\n return this.get(key, data, signal, statusCallback);\n }\n if (cacheEntry.settled) {\n // too late to abort, just return it\n return cacheEntry.promise;\n }\n // request is in-flight, add this signal to its list of signals,\n // or if there is no signal, the aborter will become non-abortable\n cacheEntry.aborter.addSignal(signal);\n cacheEntry.statusReporter.addCallback(statusCallback);\n return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal);\n }\n // if we got here, it is not in the cache. fill.\n this.fill(key, data, signal, statusCallback);\n return AbortablePromiseCache.checkSinglePromise(\n //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-\n //eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.cache.get(key).promise, signal);\n }\n /**\n * delete the given entry from the cache. if it exists and its fill request has\n * not yet settled, the fill will be signaled to abort.\n *\n * @param {any} key\n */\n delete(key) {\n const cachedEntry = this.cache.get(key);\n if (cachedEntry) {\n if (!cachedEntry.settled) {\n cachedEntry.aborter.abort();\n }\n this.cache.delete(key);\n }\n }\n /**\n * Clear all requests from the cache. Aborts any that have not settled.\n * @returns {number} count of entries deleted\n */\n clear() {\n // iterate without needing regenerator-runtime\n const keyIter = this.cache.keys();\n let deleteCount = 0;\n for (let result = keyIter.next(); !result.done; result = keyIter.next()) {\n this.delete(result.value);\n deleteCount += 1;\n }\n return deleteCount;\n }\n}\nexports.default = AbortablePromiseCache;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst AbortablePromiseCache_1 = __importDefault(require(\"./AbortablePromiseCache\"));\nexports.default = AbortablePromiseCache_1.default;\n","'use strict';\n\nclass QuickLRU {\n\tconstructor(options = {}) {\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst value = this.oldCache.get(key);\n\t\t\tthis._set(key, value);\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tset(key, value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, value);\n\t\t} else {\n\t\t\tthis._set(key, value);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\thas(key) {\n\t\treturn this.cache.has(key) || this.oldCache.has(key);\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this.oldCache.get(key);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tyield item;\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget size() {\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn this._size + oldCacheSize;\n\t}\n}\n\nmodule.exports = QuickLRU;\n","export default {\n // the read is paired in sequencing, no matter whether it is mapped in a pair\n BAM_FPAIRED: 1,\n // the read is mapped in a proper pair\n BAM_FPROPER_PAIR: 2,\n // the read itself is unmapped; conflictive with BAM_FPROPER_PAIR\n BAM_FUNMAP: 4,\n // the mate is unmapped\n BAM_FMUNMAP: 8,\n // the read is mapped to the reverse strand\n BAM_FREVERSE: 16,\n // the mate is mapped to the reverse strand\n BAM_FMREVERSE: 32,\n // this is read1\n BAM_FREAD1: 64,\n // this is read2\n BAM_FREAD2: 128,\n // not primary alignment\n BAM_FSECONDARY: 256,\n // QC failure\n BAM_FQCFAIL: 512,\n // optical or PCR duplicate\n BAM_FDUP: 1024,\n // supplementary alignment\n BAM_FSUPPLEMENTARY: 2048,\n};\n//# sourceMappingURL=constants.js.map","/* eslint-disable @typescript-eslint/no-empty-function */\nimport Constants from './constants';\nconst SEQRET_DECODER = '=ACMGRSVTWYHKDBN'.split('');\nconst CIGAR_DECODER = 'MIDNSHP=X???????'.split('');\n/**\n * Class of each BAM record returned by this API.\n */\nexport default class BamRecord {\n constructor(args) {\n this.data = {};\n this._tagList = [];\n this._allTagsParsed = false;\n const { bytes, fileOffset } = args;\n const { byteArray, start } = bytes;\n this.data = {};\n this.bytes = bytes;\n this._id = fileOffset;\n this._refID = byteArray.readInt32LE(start + 4);\n this.data.start = byteArray.readInt32LE(start + 8);\n this.flags = (byteArray.readInt32LE(start + 16) & 0xffff0000) >> 16;\n }\n get(field) {\n //@ts-ignore\n if (this[field]) {\n //@ts-ignore\n if (this.data[field]) {\n return this.data[field];\n }\n //@ts-ignore\n this.data[field] = this[field]();\n return this.data[field];\n }\n return this._get(field.toLowerCase());\n }\n end() {\n return this.get('start') + this.get('length_on_ref');\n }\n seq_id() {\n return this._refID;\n }\n // same as get(), except requires lower-case arguments. used\n // internally to save lots of calls to field.toLowerCase()\n _get(field) {\n if (field in this.data) {\n return this.data[field];\n }\n this.data[field] = this._parseTag(field);\n return this.data[field];\n }\n _tags() {\n this._parseAllTags();\n let tags = ['seq'];\n if (!this.isSegmentUnmapped()) {\n tags.push('start', 'end', 'strand', 'score', 'qual', 'MQ', 'CIGAR', 'length_on_ref', 'template_length');\n }\n if (this.isPaired()) {\n tags.push('next_segment_position', 'pair_orientation');\n }\n tags = tags.concat(this._tagList || []);\n Object.keys(this.data).forEach(k => {\n if (k[0] !== '_' && k !== 'next_seq_id') {\n tags.push(k);\n }\n });\n const seen = {};\n return tags.filter(t => {\n if ((t in this.data && this.data[t] === undefined) ||\n t === 'CG' ||\n t === 'cg') {\n return false;\n }\n const lt = t.toLowerCase();\n const s = seen[lt];\n seen[lt] = true;\n return !s;\n });\n }\n parent() {\n return undefined;\n }\n children() {\n return this.get('subfeatures');\n }\n id() {\n return this._id;\n }\n // special parsers\n /**\n * Mapping quality score.\n */\n mq() {\n const mq = (this.get('_bin_mq_nl') & 0xff00) >> 8;\n return mq === 255 ? undefined : mq;\n }\n score() {\n return this.get('mq');\n }\n qual() {\n var _a;\n return (_a = this.qualRaw()) === null || _a === void 0 ? void 0 : _a.join(' ');\n }\n qualRaw() {\n if (this.isSegmentUnmapped()) {\n return undefined;\n }\n const { start, byteArray } = this.bytes;\n const p = start +\n 36 +\n this.get('_l_read_name') +\n this.get('_n_cigar_op') * 4 +\n this.get('_seq_bytes');\n const lseq = this.get('seq_length');\n return byteArray.subarray(p, p + lseq);\n }\n strand() {\n return this.isReverseComplemented() ? -1 : 1;\n }\n multi_segment_next_segment_strand() {\n if (this.isMateUnmapped()) {\n return undefined;\n }\n return this.isMateReverseComplemented() ? -1 : 1;\n }\n name() {\n return this.get('_read_name');\n }\n _read_name() {\n const nl = this.get('_l_read_name');\n const { byteArray, start } = this.bytes;\n return byteArray.toString('ascii', start + 36, start + 36 + nl - 1);\n }\n /**\n * Get the value of a tag, parsing the tags as far as necessary.\n * Only called if we have not already parsed that field.\n */\n _parseTag(tagName) {\n // if all of the tags have been parsed and we're still being\n // called, we already know that we have no such tag, because\n // it would already have been cached.\n if (this._allTagsParsed) {\n return undefined;\n }\n const { byteArray, start } = this.bytes;\n let p = this._tagOffset ||\n start +\n 36 +\n this.get('_l_read_name') +\n this.get('_n_cigar_op') * 4 +\n this.get('_seq_bytes') +\n this.get('seq_length');\n const blockEnd = this.bytes.end;\n let lcTag;\n while (p < blockEnd && lcTag !== tagName) {\n const tag = String.fromCharCode(byteArray[p], byteArray[p + 1]);\n lcTag = tag.toLowerCase();\n const type = String.fromCharCode(byteArray[p + 2]);\n p += 3;\n let value;\n switch (type) {\n case 'A':\n value = String.fromCharCode(byteArray[p]);\n p += 1;\n break;\n case 'i':\n value = byteArray.readInt32LE(p);\n p += 4;\n break;\n case 'I':\n value = byteArray.readUInt32LE(p);\n p += 4;\n break;\n case 'c':\n value = byteArray.readInt8(p);\n p += 1;\n break;\n case 'C':\n value = byteArray.readUInt8(p);\n p += 1;\n break;\n case 's':\n value = byteArray.readInt16LE(p);\n p += 2;\n break;\n case 'S':\n value = byteArray.readUInt16LE(p);\n p += 2;\n break;\n case 'f':\n value = byteArray.readFloatLE(p);\n p += 4;\n break;\n case 'Z':\n case 'H':\n value = '';\n while (p <= blockEnd) {\n const cc = byteArray[p++];\n if (cc === 0) {\n break;\n }\n else {\n value += String.fromCharCode(cc);\n }\n }\n break;\n case 'B': {\n value = '';\n const cc = byteArray[p++];\n const Btype = String.fromCharCode(cc);\n const limit = byteArray.readInt32LE(p);\n p += 4;\n if (Btype === 'i') {\n if (tag === 'CG') {\n for (let k = 0; k < limit; k++) {\n const cigop = byteArray.readInt32LE(p);\n const lop = cigop >> 4;\n const op = CIGAR_DECODER[cigop & 0xf];\n value += lop + op;\n p += 4;\n }\n }\n else {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readInt32LE(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 4;\n }\n }\n }\n if (Btype === 'I') {\n if (tag === 'CG') {\n for (let k = 0; k < limit; k++) {\n const cigop = byteArray.readUInt32LE(p);\n const lop = cigop >> 4;\n const op = CIGAR_DECODER[cigop & 0xf];\n value += lop + op;\n p += 4;\n }\n }\n else {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readUInt32LE(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 4;\n }\n }\n }\n if (Btype === 's') {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readInt16LE(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 2;\n }\n }\n if (Btype === 'S') {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readUInt16LE(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 2;\n }\n }\n if (Btype === 'c') {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readInt8(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 1;\n }\n }\n if (Btype === 'C') {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readUInt8(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 1;\n }\n }\n if (Btype === 'f') {\n for (let k = 0; k < limit; k++) {\n value += byteArray.readFloatLE(p);\n if (k + 1 < limit) {\n value += ',';\n }\n p += 4;\n }\n }\n break;\n }\n default:\n console.warn(`Unknown BAM tag type '${type}', tags may be incomplete`);\n value = undefined;\n p = blockEnd; // stop parsing tags\n }\n this._tagOffset = p;\n this._tagList.push(tag);\n if (lcTag === tagName) {\n return value;\n }\n this.data[lcTag] = value;\n }\n this._allTagsParsed = true;\n return undefined;\n }\n _parseAllTags() {\n this._parseTag('');\n }\n _parseCigar(cigar) {\n return (\n //@ts-ignore\n cigar\n .match(/\\d+\\D/g)\n //@ts-ignore\n .map(op => [op.match(/\\D/)[0].toUpperCase(), parseInt(op, 10)]));\n }\n /**\n * @returns {boolean} true if the read is paired, regardless of whether both segments are mapped\n */\n isPaired() {\n return !!(this.flags & Constants.BAM_FPAIRED);\n }\n /** @returns {boolean} true if the read is paired, and both segments are mapped */\n isProperlyPaired() {\n return !!(this.flags & Constants.BAM_FPROPER_PAIR);\n }\n /** @returns {boolean} true if the read itself is unmapped; conflictive with isProperlyPaired */\n isSegmentUnmapped() {\n return !!(this.flags & Constants.BAM_FUNMAP);\n }\n /** @returns {boolean} true if the read itself is unmapped; conflictive with isProperlyPaired */\n isMateUnmapped() {\n return !!(this.flags & Constants.BAM_FMUNMAP);\n }\n /** @returns {boolean} true if the read is mapped to the reverse strand */\n isReverseComplemented() {\n return !!(this.flags & Constants.BAM_FREVERSE);\n }\n /** @returns {boolean} true if the mate is mapped to the reverse strand */\n isMateReverseComplemented() {\n return !!(this.flags & Constants.BAM_FMREVERSE);\n }\n /** @returns {boolean} true if this is read number 1 in a pair */\n isRead1() {\n return !!(this.flags & Constants.BAM_FREAD1);\n }\n /** @returns {boolean} true if this is read number 2 in a pair */\n isRead2() {\n return !!(this.flags & Constants.BAM_FREAD2);\n }\n /** @returns {boolean} true if this is a secondary alignment */\n isSecondary() {\n return !!(this.flags & Constants.BAM_FSECONDARY);\n }\n /** @returns {boolean} true if this read has failed QC checks */\n isFailedQc() {\n return !!(this.flags & Constants.BAM_FQCFAIL);\n }\n /** @returns {boolean} true if the read is an optical or PCR duplicate */\n isDuplicate() {\n return !!(this.flags & Constants.BAM_FDUP);\n }\n /** @returns {boolean} true if this is a supplementary alignment */\n isSupplementary() {\n return !!(this.flags & Constants.BAM_FSUPPLEMENTARY);\n }\n cigar() {\n if (this.isSegmentUnmapped()) {\n return undefined;\n }\n const { byteArray, start } = this.bytes;\n const numCigarOps = this.get('_n_cigar_op');\n let p = start + 36 + this.get('_l_read_name');\n const seqLen = this.get('seq_length');\n let cigar = '';\n let lref = 0;\n // check for CG tag by inspecting whether the CIGAR field\n // contains a clip that consumes entire seqLen\n let cigop = byteArray.readInt32LE(p);\n let lop = cigop >> 4;\n let op = CIGAR_DECODER[cigop & 0xf];\n if (op === 'S' && lop === seqLen) {\n // if there is a CG the second CIGAR field will\n // be a N tag the represents the length on ref\n p += 4;\n cigop = byteArray.readInt32LE(p);\n lop = cigop >> 4;\n op = CIGAR_DECODER[cigop & 0xf];\n if (op !== 'N') {\n console.warn('CG tag with no N tag');\n }\n this.data.length_on_ref = lop;\n return this.get('CG');\n }\n else {\n for (let c = 0; c < numCigarOps; ++c) {\n cigop = byteArray.readInt32LE(p);\n lop = cigop >> 4;\n op = CIGAR_DECODER[cigop & 0xf];\n cigar += lop + op;\n // soft clip, hard clip, and insertion don't count toward\n // the length on the reference\n if (op !== 'H' && op !== 'S' && op !== 'I') {\n lref += lop;\n }\n p += 4;\n }\n this.data.length_on_ref = lref;\n return cigar;\n }\n }\n _flags() { }\n length_on_ref() {\n if (this.data.length_on_ref) {\n return this.data.length_on_ref;\n }\n else {\n this.get('cigar'); // the length_on_ref is set as a side effect\n return this.data.length_on_ref;\n }\n }\n _n_cigar_op() {\n return this.get('_flag_nc') & 0xffff;\n }\n _l_read_name() {\n return this.get('_bin_mq_nl') & 0xff;\n }\n /**\n * number of bytes in the sequence field\n */\n _seq_bytes() {\n return (this.get('seq_length') + 1) >> 1;\n }\n getReadBases() {\n return this.seq();\n }\n seq() {\n const { byteArray, start } = this.bytes;\n const p = start + 36 + this.get('_l_read_name') + this.get('_n_cigar_op') * 4;\n const seqBytes = this.get('_seq_bytes');\n const len = this.get('seq_length');\n let buf = '';\n let i = 0;\n for (let j = 0; j < seqBytes; ++j) {\n const sb = byteArray[p + j];\n buf += SEQRET_DECODER[(sb & 0xf0) >> 4];\n i++;\n if (i < len) {\n buf += SEQRET_DECODER[sb & 0x0f];\n i++;\n }\n }\n return buf;\n }\n // adapted from igv.js\n getPairOrientation() {\n if (!this.isSegmentUnmapped() &&\n !this.isMateUnmapped() &&\n this._refID === this._next_refid()) {\n const s1 = this.isReverseComplemented() ? 'R' : 'F';\n const s2 = this.isMateReverseComplemented() ? 'R' : 'F';\n let o1 = ' ';\n let o2 = ' ';\n if (this.isRead1()) {\n o1 = '1';\n o2 = '2';\n }\n else if (this.isRead2()) {\n o1 = '2';\n o2 = '1';\n }\n const tmp = [];\n const isize = this.template_length();\n if (isize > 0) {\n tmp[0] = s1;\n tmp[1] = o1;\n tmp[2] = s2;\n tmp[3] = o2;\n }\n else {\n tmp[2] = s1;\n tmp[3] = o1;\n tmp[0] = s2;\n tmp[1] = o2;\n }\n return tmp.join('');\n }\n return null;\n }\n _bin_mq_nl() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 12);\n }\n _flag_nc() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 16);\n }\n seq_length() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 20);\n }\n _next_refid() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 24);\n }\n _next_pos() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 28);\n }\n template_length() {\n return this.bytes.byteArray.readInt32LE(this.bytes.start + 32);\n }\n toJSON() {\n const data = {};\n Object.keys(this).forEach(k => {\n if (k.charAt(0) === '_' || k === 'bytes') {\n return;\n }\n //@ts-ignore\n data[k] = this[k];\n });\n return data;\n }\n}\n//# sourceMappingURL=record.js.map","export function parseHeaderText(text) {\n const lines = text.split(/\\r?\\n/);\n const data = [];\n lines.forEach(line => {\n const [tag, ...fields] = line.split(/\\t/);\n const parsedFields = fields.map(f => {\n const [fieldTag, value] = f.split(':', 2);\n return { tag: fieldTag, value };\n });\n if (tag) {\n data.push({ tag: tag.substr(1), data: parsedFields });\n }\n });\n return data;\n}\n//# sourceMappingURL=sam.js.map","import crc32 from 'buffer-crc32';\nimport { unzip, unzipChunkSlice } from '@gmod/bgzf-filehandle';\nimport entries from 'object.entries-ponyfill';\nimport { LocalFile, RemoteFile } from 'generic-filehandle';\nimport AbortablePromiseCache from 'abortable-promise-cache';\nimport QuickLRU from 'quick-lru';\n//locals\nimport BAI from './bai';\nimport CSI from './csi';\nimport BAMFeature from './record';\nimport { parseHeaderText } from './sam';\nimport { abortBreakPoint, checkAbortSignal, timeout, makeOpts, } from './util';\nexport const BAM_MAGIC = 21840194;\nconst blockLen = 1 << 16;\nfunction flat(arr) {\n return [].concat(...arr);\n}\nasync function gen2array(gen) {\n const out = [];\n for await (const x of gen) {\n out.push(x);\n }\n return out;\n}\nexport default class BamFile {\n /**\n * @param {object} args\n * @param {string} [args.bamPath]\n * @param {FileHandle} [args.bamFilehandle]\n * @param {string} [args.baiPath]\n * @param {FileHandle} [args.baiFilehandle]\n */\n constructor({ bamFilehandle, bamPath, bamUrl, baiPath, baiFilehandle, baiUrl, csiPath, csiFilehandle, csiUrl, fetchSizeLimit, chunkSizeLimit, yieldThreadTime = 100, renameRefSeqs = n => n, }) {\n this.featureCache = new AbortablePromiseCache({\n //@ts-ignore\n cache: new QuickLRU({\n maxSize: 50,\n }),\n //@ts-ignore\n fill: async ({ chunk, opts }, signal) => {\n const { data, cpositions, dpositions } = await this._readChunk({\n chunk,\n opts: { ...opts, signal },\n });\n const feats = await this.readBamFeatures(data, cpositions, dpositions, chunk);\n return feats;\n },\n });\n this.renameRefSeq = renameRefSeqs;\n if (bamFilehandle) {\n this.bam = bamFilehandle;\n }\n else if (bamPath) {\n this.bam = new LocalFile(bamPath);\n }\n else if (bamUrl) {\n this.bam = new RemoteFile(bamUrl);\n }\n else {\n throw new Error('unable to initialize bam');\n }\n if (csiFilehandle) {\n this.index = new CSI({ filehandle: csiFilehandle });\n }\n else if (csiPath) {\n this.index = new CSI({ filehandle: new LocalFile(csiPath) });\n }\n else if (csiUrl) {\n this.index = new CSI({ filehandle: new RemoteFile(csiUrl) });\n }\n else if (baiFilehandle) {\n this.index = new BAI({ filehandle: baiFilehandle });\n }\n else if (baiPath) {\n this.index = new BAI({ filehandle: new LocalFile(baiPath) });\n }\n else if (baiUrl) {\n this.index = new BAI({ filehandle: new RemoteFile(baiUrl) });\n }\n else if (bamPath) {\n this.index = new BAI({ filehandle: new LocalFile(`${bamPath}.bai`) });\n }\n else if (bamUrl) {\n this.index = new BAI({ filehandle: new RemoteFile(`${bamUrl}.bai`) });\n }\n else {\n throw new Error('unable to infer index format');\n }\n this.fetchSizeLimit = fetchSizeLimit || 500000000; // 500MB\n this.chunkSizeLimit = chunkSizeLimit || 300000000; // 300MB\n this.yieldThreadTime = yieldThreadTime;\n }\n async getHeader(origOpts = {}) {\n const opts = makeOpts(origOpts);\n const indexData = await this.index.parse(opts);\n const ret = indexData.firstDataLine\n ? indexData.firstDataLine.blockPosition + 65535\n : undefined;\n let buffer;\n if (ret) {\n const res = await this.bam.read(Buffer.alloc(ret + blockLen), 0, ret + blockLen, 0, opts);\n const { bytesRead } = res;\n ({ buffer } = res);\n if (!bytesRead) {\n throw new Error('Error reading header');\n }\n if (bytesRead < ret) {\n buffer = buffer.subarray(0, bytesRead);\n }\n else {\n buffer = buffer.subarray(0, ret);\n }\n }\n else {\n buffer = (await this.bam.readFile(opts));\n }\n const uncba = await unzip(buffer);\n if (uncba.readInt32LE(0) !== BAM_MAGIC) {\n throw new Error('Not a BAM file');\n }\n const headLen = uncba.readInt32LE(4);\n this.header = uncba.toString('utf8', 8, 8 + headLen);\n const { chrToIndex, indexToChr } = await this._readRefSeqs(headLen + 8, 65535, opts);\n this.chrToIndex = chrToIndex;\n this.indexToChr = indexToChr;\n return parseHeaderText(this.header);\n }\n async getHeaderText(opts = {}) {\n await this.getHeader(opts);\n return this.header;\n }\n // the full length of the refseq block is not given in advance so this grabs\n // a chunk and doubles it if all refseqs haven't been processed\n async _readRefSeqs(start, refSeqBytes, opts = {}) {\n if (start > refSeqBytes) {\n return this._readRefSeqs(start, refSeqBytes * 2, opts);\n }\n const size = refSeqBytes + blockLen;\n const { bytesRead, buffer } = await this.bam.read(Buffer.alloc(size), 0, refSeqBytes, 0, opts);\n if (!bytesRead) {\n throw new Error('Error reading refseqs from header');\n }\n const uncba = await unzip(buffer.subarray(0, Math.min(bytesRead, refSeqBytes)));\n const nRef = uncba.readInt32LE(start);\n let p = start + 4;\n const chrToIndex = {};\n const indexToChr = [];\n for (let i = 0; i < nRef; i += 1) {\n const lName = uncba.readInt32LE(p);\n const refName = this.renameRefSeq(uncba.toString('utf8', p + 4, p + 4 + lName - 1));\n const lRef = uncba.readInt32LE(p + lName + 4);\n chrToIndex[refName] = i;\n indexToChr.push({ refName, length: lRef });\n p = p + 8 + lName;\n if (p > uncba.length) {\n console.warn(`BAM header is very big. Re-fetching ${refSeqBytes} bytes.`);\n return this._readRefSeqs(start, refSeqBytes * 2, opts);\n }\n }\n return { chrToIndex, indexToChr };\n }\n async getRecordsForRange(chr, min, max, opts = {\n viewAsPairs: false,\n pairAcrossChr: false,\n maxInsertSize: 200000,\n }) {\n return flat(await gen2array(this.streamRecordsForRange(chr, min, max, opts)));\n }\n async *streamRecordsForRange(chr, min, max, opts = {}) {\n const { signal } = opts;\n const chrId = this.chrToIndex && this.chrToIndex[chr];\n let chunks;\n if (!(chrId >= 0)) {\n chunks = [];\n }\n else {\n chunks = await this.index.blocksForRange(chrId, min - 1, max, opts);\n if (!chunks) {\n throw new Error('Error in index fetch');\n }\n }\n for (let i = 0; i < chunks.length; i += 1) {\n await abortBreakPoint(signal);\n const size = chunks[i].fetchedSize();\n if (size > this.chunkSizeLimit) {\n throw new Error(`Too many BAM features. BAM chunk size ${size} bytes exceeds chunkSizeLimit of ${this.chunkSizeLimit}`);\n }\n }\n const totalSize = chunks\n .map(s => s.fetchedSize())\n .reduce((a, b) => a + b, 0);\n if (totalSize > this.fetchSizeLimit) {\n throw new Error(`data size of ${totalSize.toLocaleString()} bytes exceeded fetch size limit of ${this.fetchSizeLimit.toLocaleString()} bytes`);\n }\n yield* this._fetchChunkFeatures(chunks, chrId, min, max, opts);\n }\n async *_fetchChunkFeatures(chunks, chrId, min, max, opts) {\n const { viewAsPairs = false } = opts;\n const feats = [];\n let done = false;\n for (let i = 0; i < chunks.length; i++) {\n const c = chunks[i];\n const records = (await this.featureCache.get(c.toString(), {\n chunk: c,\n opts,\n }, opts.signal));\n const recs = [];\n for (let i = 0; i < records.length; i += 1) {\n const feature = records[i];\n if (feature.seq_id() === chrId) {\n if (feature.get('start') >= max) {\n // past end of range, can stop iterating\n done = true;\n break;\n }\n else if (feature.get('end') >= min) {\n // must be in range\n recs.push(feature);\n }\n }\n }\n feats.push(recs);\n yield recs;\n if (done) {\n break;\n }\n }\n checkAbortSignal(opts.signal);\n if (viewAsPairs) {\n yield this.fetchPairs(chrId, feats, opts);\n }\n }\n async fetchPairs(chrId, feats, opts) {\n const { pairAcrossChr = false, maxInsertSize = 200000 } = opts;\n const unmatedPairs = {};\n const readIds = {};\n feats.map(ret => {\n const readNames = {};\n for (let i = 0; i < ret.length; i++) {\n const name = ret[i].name();\n const id = ret[i].id();\n if (!readNames[name]) {\n readNames[name] = 0;\n }\n readNames[name]++;\n readIds[id] = 1;\n }\n entries(readNames).forEach(([k, v]) => {\n if (v === 1) {\n unmatedPairs[k] = true;\n }\n });\n });\n const matePromises = [];\n feats.map(ret => {\n for (let i = 0; i < ret.length; i++) {\n const f = ret[i];\n const name = f.name();\n const start = f.get('start');\n const pnext = f._next_pos();\n const rnext = f._next_refid();\n if (unmatedPairs[name] &&\n (pairAcrossChr ||\n (rnext === chrId && Math.abs(start - pnext) < maxInsertSize))) {\n matePromises.push(this.index.blocksForRange(rnext, pnext, pnext + 1, opts));\n }\n }\n });\n // filter out duplicate chunks (the blocks are lists of chunks, blocks are\n // concatenated, then filter dup chunks)\n const mateChunks = flat(await Promise.all(matePromises))\n .sort()\n .filter((item, pos, ary) => !pos || item.toString() !== ary[pos - 1].toString());\n const mateTotalSize = mateChunks\n .map(s => s.fetchedSize())\n .reduce((a, b) => a + b, 0);\n if (mateTotalSize > this.fetchSizeLimit) {\n throw new Error(`data size of ${mateTotalSize.toLocaleString()} bytes exceeded fetch size limit of ${this.fetchSizeLimit.toLocaleString()} bytes`);\n }\n const mateFeatPromises = mateChunks.map(async (c) => {\n const { data, cpositions, dpositions, chunk } = await this._readChunk({\n chunk: c,\n opts,\n });\n const feats = await this.readBamFeatures(data, cpositions, dpositions, chunk);\n const mateRecs = [];\n for (let i = 0; i < feats.length; i += 1) {\n const feature = feats[i];\n if (unmatedPairs[feature.get('name')] && !readIds[feature.id()]) {\n mateRecs.push(feature);\n }\n }\n return mateRecs;\n });\n return flat(await Promise.all(mateFeatPromises));\n }\n async _readChunk({ chunk, opts }) {\n const size = chunk.fetchedSize();\n const { buffer, bytesRead } = await this.bam.read(Buffer.alloc(size), 0, size, chunk.minv.blockPosition, opts);\n const { buffer: data, cpositions, dpositions, } = await unzipChunkSlice(buffer.subarray(0, Math.min(bytesRead, size)), chunk);\n return { data, cpositions, dpositions, chunk };\n }\n async readBamFeatures(ba, cpositions, dpositions, chunk) {\n let blockStart = 0;\n const sink = [];\n let pos = 0;\n let last = +Date.now();\n while (blockStart + 4 < ba.length) {\n const blockSize = ba.readInt32LE(blockStart);\n const blockEnd = blockStart + 4 + blockSize - 1;\n // increment position to the current decompressed status\n if (dpositions) {\n while (blockStart + chunk.minv.dataPosition >= dpositions[pos++]) { }\n pos--;\n }\n // only try to read the feature if we have all the bytes for it\n if (blockEnd < ba.length) {\n const feature = new BAMFeature({\n bytes: {\n byteArray: ba,\n start: blockStart,\n end: blockEnd,\n },\n // the below results in an automatically calculated file-offset based ID\n // if the info for that is available, otherwise crc32 of the features\n //\n // cpositions[pos] refers to actual file offset of a bgzip block boundaries\n //\n // we multiply by (1 <<8) in order to make sure each block has a \"unique\"\n // address space so that data in that block could never overlap\n //\n // then the blockStart-dpositions is an uncompressed file offset from\n // that bgzip block boundary, and since the cpositions are multiplied by\n // (1 << 8) these uncompressed offsets get a unique space\n //\n // this has an extra chunk.minv.dataPosition added on because it blockStart\n // starts at 0 instead of chunk.minv.dataPosition\n //\n // the +1 is just to avoid any possible uniqueId 0 but this does not realistically happen\n fileOffset: cpositions\n ? cpositions[pos] * (1 << 8) +\n (blockStart - dpositions[pos]) +\n chunk.minv.dataPosition +\n 1\n : // must be slice, not subarray for buffer polyfill on web\n crc32.signed(ba.slice(blockStart, blockEnd)),\n });\n sink.push(feature);\n if (this.yieldThreadTime && +Date.now() - last > this.yieldThreadTime) {\n await timeout(1);\n last = +Date.now();\n }\n }\n blockStart = blockEnd + 1;\n }\n return sink;\n }\n async hasRefSeq(seqName) {\n const refId = this.chrToIndex && this.chrToIndex[seqName];\n return this.index.hasRefSeq(refId);\n }\n async lineCount(seqName) {\n const refId = this.chrToIndex && this.chrToIndex[seqName];\n return this.index.lineCount(refId);\n }\n async indexCov(seqName, start, end) {\n await this.index.parse();\n const seqId = this.chrToIndex && this.chrToIndex[seqName];\n return this.index.indexCov(seqId, start, end);\n }\n async blocksForRange(seqName, start, end, opts) {\n await this.index.parse();\n const seqId = this.chrToIndex && this.chrToIndex[seqName];\n return this.index.blocksForRange(seqId, start, end, opts);\n }\n}\n//# sourceMappingURL=bamFile.js.map","(function(self) {\n\nvar irrelevant = (function (exports) {\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n})({});\n})(typeof self !== 'undefined' ? self : this);\n","export default class QuickLRU extends Map {\n\tconstructor(options = {}) {\n\t\tsuper();\n\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tif (typeof options.maxAge === 'number' && options.maxAge === 0) {\n\t\t\tthrow new TypeError('`maxAge` must be a number greater than 0');\n\t\t}\n\n\t\t// TODO: Use private class fields when ESLint supports them.\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.maxAge = options.maxAge || Number.POSITIVE_INFINITY;\n\t\tthis.onEviction = options.onEviction;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t// TODO: Use private class methods when targeting Node.js 16.\n\t_emitEvictions(cache) {\n\t\tif (typeof this.onEviction !== 'function') {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const [key, item] of cache) {\n\t\t\tthis.onEviction(key, item.value);\n\t\t}\n\t}\n\n\t_deleteIfExpired(key, item) {\n\t\tif (typeof item.expiry === 'number' && item.expiry <= Date.now()) {\n\t\t\tif (typeof this.onEviction === 'function') {\n\t\t\t\tthis.onEviction(key, item.value);\n\t\t\t}\n\n\t\t\treturn this.delete(key);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t_getOrDeleteIfExpired(key, item) {\n\t\tconst deleted = this._deleteIfExpired(key, item);\n\t\tif (deleted === false) {\n\t\t\treturn item.value;\n\t\t}\n\t}\n\n\t_getItemValue(key, item) {\n\t\treturn item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;\n\t}\n\n\t_peek(key, cache) {\n\t\tconst item = cache.get(key);\n\n\t\treturn this._getItemValue(key, item);\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis._emitEvictions(this.oldCache);\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\t_moveToRecent(key, item) {\n\t\tthis.oldCache.delete(key);\n\t\tthis._set(key, item);\n\t}\n\n\t* _entriesAscending() {\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield item;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const item of this.cache) {\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\tconst item = this.cache.get(key);\n\n\t\t\treturn this._getItemValue(key, item);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst item = this.oldCache.get(key);\n\t\t\tif (this._deleteIfExpired(key, item) === false) {\n\t\t\t\tthis._moveToRecent(key, item);\n\t\t\t\treturn item.value;\n\t\t\t}\n\t\t}\n\t}\n\n\tset(key, value, {maxAge = this.maxAge} = {}) {\n\t\tconst expiry =\n\t\t\ttypeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY ?\n\t\t\t\tDate.now() + maxAge :\n\t\t\t\tundefined;\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, {\n\t\t\t\tvalue,\n\t\t\t\texpiry\n\t\t\t});\n\t\t} else {\n\t\t\tthis._set(key, {value, expiry});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\thas(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn !this._deleteIfExpired(key, this.cache.get(key));\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn !this._deleteIfExpired(key, this.oldCache.get(key));\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this._peek(key, this.cache);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this._peek(key, this.oldCache);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\tresize(newSize) {\n\t\tif (!(newSize && newSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tconst items = [...this._entriesAscending()];\n\t\tconst removeCount = items.length - newSize;\n\t\tif (removeCount < 0) {\n\t\t\tthis.cache = new Map(items);\n\t\t\tthis.oldCache = new Map();\n\t\t\tthis._size = items.length;\n\t\t} else {\n\t\t\tif (removeCount > 0) {\n\t\t\t\tthis._emitEvictions(items.slice(0, removeCount));\n\t\t\t}\n\n\t\t\tthis.oldCache = new Map(items.slice(removeCount));\n\t\t\tthis.cache = new Map();\n\t\t\tthis._size = 0;\n\t\t}\n\n\t\tthis.maxSize = newSize;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield [key, value.value];\n\t\t\t}\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield [key, value.value];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t* entriesDescending() {\n\t\tlet items = [...this.cache];\n\t\tfor (let i = items.length - 1; i >= 0; --i) {\n\t\t\tconst item = items[i];\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield [key, value.value];\n\t\t\t}\n\t\t}\n\n\t\titems = [...this.oldCache];\n\t\tfor (let i = items.length - 1; i >= 0; --i) {\n\t\t\tconst item = items[i];\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield [key, value.value];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t* entriesAscending() {\n\t\tfor (const [key, value] of this._entriesAscending()) {\n\t\t\tyield [key, value.value];\n\t\t}\n\t}\n\n\tget size() {\n\t\tif (!this._size) {\n\t\t\treturn this.oldCache.size;\n\t\t}\n\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn Math.min(this._size + oldCacheSize, this.maxSize);\n\t}\n\n\tentries() {\n\t\treturn this.entriesAscending();\n\t}\n\n\tforEach(callbackFunction, thisArgument = this) {\n\t\tfor (const [key, value] of this.entriesAscending()) {\n\t\t\tcallbackFunction.call(thisArgument, value, key, this);\n\t\t}\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn JSON.stringify([...this.entriesAscending()]);\n\t}\n}\n","export default function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import ascending from \"./ascending.js\";\n\nexport default function(f) {\n let delta = f;\n let compare = f;\n\n if (f.length === 1) {\n delta = (d, x) => f(d) - x;\n compare = ascendingComparator(f);\n }\n\n function left(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function right(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n\n function center(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction ascendingComparator(f) {\n return (d, x) => ascending(f(d), x);\n}\n","import { bisector } from 'd3-array';\nimport { RemoteFile as _RemoteFile } from 'generic-filehandle';\n\nimport type * as HiGlass from '@higlass/types';\nimport type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema';\n\nexport type CommonDataConfig = {\n assembly: Assembly;\n x?: string;\n xe?: string;\n x1?: string;\n x1e?: string;\n urlFetchOptions?: RequestInit;\n};\n\nexport class DataSource {\n chromInfo: ExtendedChromInfo;\n tilesetInfo: ReturnType;\n\n constructor(public file: File, chromSizes: ChromSizes, public options: Options) {\n this.chromInfo = sizesToChromInfo(chromSizes);\n this.tilesetInfo = tilesetInfoFromChromInfo(this.chromInfo);\n }\n}\n\n/**\n * Filter data before sending to a track considering the visible genomic area in the track.\n * TODO(2022-Jul-13): Consider genomic `y` channels as well.\n */\nexport function filterUsingGenoPos(\n data: Datum[],\n [minX, maxX]: [number, number],\n config: Omit\n) {\n const { x, xe, x1, x1e } = config;\n const definedXFields = [x, xe, x1, x1e].filter(f => f) as string[];\n return data.filter((d: Datum) => {\n if (definedXFields.length === 0) {\n // no filter applies\n return true;\n } else if (definedXFields.length === 1) {\n // filter based on one genomic position\n const value = +d[definedXFields[0]];\n return typeof value === 'number' && minX < value && value <= maxX;\n } else {\n // filter based on two genomic positions, i.e., check overlaps\n const values = definedXFields.map(f => +d[f]).filter(v => !isNaN(v));\n const minValue = Math.min(...values);\n const maxValue = Math.max(...values);\n return minX <= maxValue && minValue <= maxX;\n }\n });\n}\n\nconst chromInfoBisector = bisector((d: { pos: number }) => d.pos).left;\n\nconst chrToAbs = (chrom: string, chromPos: number, chromInfo: HiGlass.ChromInfo) =>\n chromInfo.chrPositions[chrom].pos + chromPos;\n\nconst absToChr = (absPosition: number, chromInfo: HiGlass.ChromInfo) => {\n if (!chromInfo || !chromInfo.cumPositions || !chromInfo.cumPositions.length) {\n return null;\n }\n\n let insertPoint = chromInfoBisector(chromInfo.cumPositions, absPosition);\n const lastChr = chromInfo.cumPositions[chromInfo.cumPositions.length - 1].chr;\n const lastLength = chromInfo.chromLengths[lastChr];\n\n // @ts-expect-error\n insertPoint -= insertPoint > 0 && 1;\n\n let chrPosition = Math.floor(absPosition - chromInfo.cumPositions[insertPoint].pos);\n let offset = 0;\n\n if (chrPosition < 0) {\n // before the start of the genome\n offset = chrPosition - 1;\n chrPosition = 1;\n }\n\n if (insertPoint === chromInfo.cumPositions.length - 1 && chrPosition > lastLength) {\n // beyond the last chromosome\n offset = chrPosition - lastLength;\n chrPosition = lastLength;\n }\n\n return [chromInfo.cumPositions[insertPoint].chr, chrPosition, offset, insertPoint] as const;\n};\n\n/**\n * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`.\n * @param chrName A chromosome name to be sanitized\n * @param assembly A genome assembly of the data\n * @param chromosomePrefix A prefix string that can be replaced to 'chr'\n * @returns\n */\nexport function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string) {\n if (Array.isArray(assembly)) {\n // this is a custom assembly, so use this as is\n return chrName;\n }\n\n // For assemblies in Gosling, we use the `chr` prefix consistently\n if (chromosomePrefix) {\n // `hs1` --> `chr1`\n chrName = chrName.replace(chromosomePrefix, 'chr');\n } else if (!chrName.includes('chr')) {\n // `1` --> `chr1`\n chrName = `chr${chrName}`;\n }\n return chrName;\n}\n\nexport type ExtendedChromInfo = HiGlass.ChromInfo & {\n absToChr(absPos: number): ReturnType | null;\n chrToAbs(chr: [name: string, pos: number]): number | null;\n};\n\nexport function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize = 1024) {\n return {\n tile_size: tileSize,\n bins_per_dimension: tileSize,\n max_zoom: Math.ceil(Math.log(chromInfo.totalLength / tileSize) / Math.log(2)),\n max_width: chromInfo.totalLength,\n min_pos: [0],\n max_pos: [chromInfo.totalLength]\n };\n}\n\nexport function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo {\n const info: HiGlass.ChromInfo = {\n cumPositions: [],\n chromLengths: {},\n chrPositions: {},\n totalLength: 0\n };\n\n sizes.forEach(([chr, length], i) => {\n const chrPosition = { id: i, chr, pos: info.totalLength };\n info.chrPositions[chr] = chrPosition;\n info.chromLengths[chr] = length;\n info.cumPositions.push(chrPosition);\n info.totalLength += length;\n });\n\n return {\n ...info,\n absToChr: absPos => (info.chrPositions ? absToChr(absPos, info) : null),\n chrToAbs: ([chrName, chrPos]) => (info.chrPositions ? chrToAbs(chrName, chrPos, info) : null)\n };\n}\n\nexport class RemoteFile extends _RemoteFile {\n // Overrides `read` to eagerly read 200 or 206 response\n // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162\n public read: _RemoteFile['read'] = async (\n buffer,\n offset = 0,\n length,\n position = 0,\n opts = {}\n ): Promise<{ bytesRead: number; buffer: Buffer }> => {\n const { headers = {}, signal, overrides = {} } = opts;\n\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n } else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n // @ts-expect-error private property\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n // @ts-expect-error private property\n ...this.baseOverrides.headers\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal\n };\n const response = await this.fetch(this.url, args);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n\n // Just read the response if it was successful.\n if (response.status === 200 || response.status === 206) {\n // @ts-expect-error private method\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n // @ts-expect-error private property\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n\n return { bytesRead: bytesCopied, buffer };\n }\n\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n };\n}\n\nexport interface TabularDataFetcher {\n getTabularData(tileIds: string[]): Promise;\n MAX_TILE_WIDTH?: number;\n}\n","// Adopted from https://github.com/higlass/higlass-pileup/blob/master/src/bam-fetcher-worker.js\nimport { expose, Transfer } from 'threads/worker';\nimport { BamFile as _BamFile } from '@gmod/bam';\nimport type { BamRecord } from '@gmod/bam';\nimport QuickLRU from 'quick-lru';\nimport type { TilesetInfo } from '@higlass/types';\n\nimport type { ChromSizes } from '@gosling-lang/gosling-schema';\n\nimport { DataSource, RemoteFile } from '../utils';\n\ninterface BamFileOptions {\n loadMates: boolean;\n maxInsertSize: number;\n extractJunction: boolean;\n junctionMinCoverage: number;\n urlFetchOptions?: RequestInit;\n indexUrlFetchOptions?: RequestInit;\n}\n\nfunction parseMD(mdString: string, useCounts: true): { type: string; length: number }[];\nfunction parseMD(mdString: string, useCounts: false): { pos: number; base: string; length: 1; bamSeqShift: number }[];\nfunction parseMD(mdString: string, useCounts: boolean) {\n let currPos = 0;\n let currNum = 0;\n let deletionEncountered = false;\n let bamSeqShift = 0;\n const substitutions = [];\n\n /* eslint-disable-next-line @typescript-eslint/prefer-for-of */\n for (let i = 0; i < mdString.length; i++) {\n if (mdString[i].match(/[0-9]/g)) {\n // a number, keep on going\n currNum = currNum * 10 + +mdString[i];\n deletionEncountered = false;\n } else if (mdString[i] === '^') {\n deletionEncountered = true;\n } else {\n currPos += currNum;\n\n if (useCounts) {\n substitutions.push({\n length: currNum,\n type: mdString[i]\n });\n } else if (deletionEncountered) {\n // Do nothing if there is a deletion and keep on going.\n // Note that there can be multiple deletions \"^ATC\"\n // Deletions are visualized using the CIGAR string\n // However, keep track of where in the bam seq we need to pull the variant.\n bamSeqShift -= 1;\n } else {\n substitutions.push({\n pos: currPos,\n base: mdString[i],\n length: 1,\n bamSeqShift\n });\n }\n\n currNum = 0;\n currPos += 1;\n }\n }\n\n return substitutions;\n}\n\ntype Substitution = {\n pos: number;\n length: number;\n type: 'X' | 'I' | 'D' | 'N' | '=' | 'M' | 'S' | 'H';\n variant?: string;\n};\n\nexport type Segment = {\n // if two segments have the same name but different id, they are paired reads.\n // https://github.com/GMOD/bam-js/blob/7a57d24b6aef08a1366cca86ba5092254c7a7f56/src/bamFile.ts#L386\n id: string;\n name: string;\n start: number;\n end: number;\n md: string;\n chrName: string;\n chrOffset: number;\n cigar: string;\n mapq: string;\n strand: '+' | '-';\n};\n\n/**\n * Gets an array of all substitutions in the segment\n * @param segment Current segment\n * @param seq Read sequence from bam file.\n */\nfunction getSubstitutions(segment: Segment, seq: string) {\n let substitutions: Substitution[] = [];\n let softClippingAtReadStart: null | { type: string; length: number } = null;\n\n if (segment.cigar) {\n const cigarSubs = parseMD(segment.cigar, true);\n let currPos = 0;\n\n for (const sub of cigarSubs) {\n if (sub.type === 'X') {\n // sequence mismatch, no need to do anything\n substitutions.push({\n pos: currPos,\n length: sub.length,\n type: 'X'\n });\n\n currPos += sub.length;\n } else if (sub.type === 'I') {\n substitutions.push({\n pos: currPos,\n length: sub.length,\n type: 'I'\n });\n } else if (sub.type === 'D') {\n substitutions.push({\n pos: currPos,\n length: sub.length,\n type: 'D'\n });\n currPos += sub.length;\n } else if (sub.type === 'N') {\n substitutions.push({\n pos: currPos,\n length: sub.length,\n type: 'N'\n });\n currPos += sub.length;\n } else if (sub.type === '=' || sub.type === 'M') {\n currPos += sub.length;\n } else {\n // console.log('skipping:', sub.type);\n }\n }\n\n const firstSub = cigarSubs[0];\n const lastSub = cigarSubs[cigarSubs.length - 1];\n\n // Soft clipping can happen at the beginning, at the end or both\n // positions are from the beginning of the read\n if (firstSub.type === 'S') {\n softClippingAtReadStart = firstSub;\n // soft clipping at the beginning\n substitutions.push({\n pos: -firstSub.length,\n type: 'S',\n length: firstSub.length\n });\n }\n // soft clipping at the end\n if (lastSub.type === 'S') {\n substitutions.push({\n pos: segment.end - segment.start,\n length: lastSub.length,\n type: 'S'\n });\n }\n\n // Hard clipping can happen at the beginning, at the end or both\n // positions are from the beginning of the read\n if (firstSub.type === 'H') {\n substitutions.push({\n pos: -firstSub.length,\n type: 'H',\n length: firstSub.length\n });\n }\n if (lastSub.type === 'H') {\n substitutions.push({\n pos: segment.end - segment.start,\n length: lastSub.length,\n type: 'H'\n });\n }\n }\n\n if (segment.md) {\n const mdSubstitutions = parseMD(segment.md, false);\n mdSubstitutions.forEach(function (substitution: (typeof mdSubstitutions)[number] & { variant?: string }) {\n let posStart = substitution['pos'] + substitution['bamSeqShift']!;\n let posEnd = posStart + substitution['length'];\n // When there is soft clipping at the beginning,\n // we need to shift the position where we read the variant from the sequence\n // not necessary when there is hard clipping\n if (softClippingAtReadStart !== null) {\n posStart += softClippingAtReadStart.length;\n posEnd += softClippingAtReadStart.length;\n }\n substitution['variant'] = seq.substring(posStart, posEnd);\n // @ts-expect-error\n delete substitution['bamSeqShift'];\n });\n // @ts-expect-error\n substitutions = mdSubstitutions.concat(substitutions);\n }\n\n return substitutions;\n}\n\n/////////////////////////////////////////////////////\n/// End Chrominfo\n/////////////////////////////////////////////////////\n\nconst bamRecordToJson = (bamRecord: BamRecord, chrName: string, chrOffset: number) => {\n const seq = bamRecord.get('seq');\n const segment: Segment = {\n // if two segments have the same name but different id, they are paired reads.\n // https://github.com/GMOD/bam-js/blob/7a57d24b6aef08a1366cca86ba5092254c7a7f56/src/bamFile.ts#L386\n // @ts-expect-error private field!!\n id: bamRecord._id,\n name: bamRecord.get('name'),\n // @ts-expect-error private field!!\n start: +bamRecord.data.start + 1 + chrOffset,\n // @ts-expect-error private field!!\n end: +bamRecord.data.end + 1 + chrOffset,\n md: bamRecord.get('MD'),\n chrName,\n chrOffset,\n cigar: bamRecord.get('cigar'),\n mapq: bamRecord.get('mq'),\n strand: bamRecord.get('strand') === 1 ? '+' : '-'\n };\n return Object.assign(segment, { substitutions: getSubstitutions(segment, seq) });\n};\n\ntype JsonBamRecord = ReturnType;\n\nclass BamFile extends _BamFile {\n headerPromise: ReturnType;\n constructor(...args: ConstructorParameters) {\n super(...args);\n this.headerPromise = this.getHeader();\n }\n static fromUrl(url: string, indexUrl: string, urlFetchOptions?: RequestInit, indexUrlFetchOptions?: RequestInit) {\n return new BamFile({\n bamFilehandle: new RemoteFile(url, { overrides: urlFetchOptions }),\n baiFilehandle: new RemoteFile(indexUrl, { overrides: indexUrlFetchOptions })\n });\n }\n getChromNames() {\n return this.indexToChr.map((v: { refName: string; length: number }) => v.refName);\n }\n}\n\n// indexed by dataset uuid\nconst dataSources: Map> = new Map();\n// indexed by bam url\nconst bamFileCache: Map = new Map();\nconst MAX_TILES = 20;\nconst tileValues = new QuickLRU({ maxSize: MAX_TILES });\n\nconst init = async (\n uid: string,\n bam: { url: string; indexUrl: string },\n chromSizes: ChromSizes,\n options: Partial = {}\n) => {\n if (!bamFileCache.has(bam.url)) {\n const bamFile = BamFile.fromUrl(bam.url, bam.indexUrl, options.urlFetchOptions, options.indexUrlFetchOptions);\n await bamFile.getHeader(); // reads bam/bai headers\n\n // Infer the correct chromosome names between 'chr1' and '1'\n const firstChromNameInHeader = bamFile.getChromNames()[0];\n if (firstChromNameInHeader) {\n const headerHasPrefix = firstChromNameInHeader.includes('chr');\n const specHasPrefix = chromSizes[0]?.[0].includes('chr');\n if (headerHasPrefix && !specHasPrefix) {\n chromSizes = chromSizes.map(([s, n]) => [`chr${s}`, n]);\n } else if (!headerHasPrefix && specHasPrefix) {\n chromSizes = chromSizes.map(([s, n]) => [s.replace('chr', ''), n]);\n }\n }\n bamFileCache.set(bam.url, bamFile);\n }\n const bamFile = bamFileCache.get(bam.url)!;\n const dataSource = new DataSource(bamFile, chromSizes, {\n loadMates: false,\n maxInsertSize: 5000,\n extractJunction: false,\n junctionMinCoverage: 1,\n ...options\n });\n dataSources.set(uid, dataSource);\n};\n\nconst tilesetInfo = (uid: string) => {\n return dataSources.get(uid)!.tilesetInfo;\n};\n\nconst tile = async (uid: string, z: number, x: number): Promise => {\n const MAX_TILE_WIDTH = 200000;\n const bam = dataSources.get(uid)!;\n\n const info = tilesetInfo(uid);\n\n if (!('max_width' in info)) {\n throw new Error('tilesetInfo does not include `max_width`, which is required for the Gosling BamDataFetcher.');\n }\n\n const tileWidth = +info.max_width / 2 ** +z;\n\n const recordPromises: Promise[] = [];\n\n if (tileWidth > MAX_TILE_WIDTH) {\n // this.errorTextText('Zoomed out too far for this track. Zoomin further to see reads');\n return new Promise(resolve => resolve([]));\n }\n\n // get the bounds of the tile\n let minX = info.min_pos[0] + x * tileWidth;\n const maxX = info.min_pos[0] + (x + 1) * tileWidth;\n\n const { chromLengths, cumPositions } = bam.chromInfo;\n\n const opt = {\n viewAsPairs: bam.options.loadMates\n // TODO: Turning this on results in \"too many requests error\"\n // https://github.com/gosling-lang/gosling.js/pull/556\n // pairAcrossChr: typeof loadMates === 'undefined' ? false : loadMates,\n };\n\n tileValues.set(`${uid}.${z}.${x}`, []);\n\n /* eslint-disable-next-line @typescript-eslint/prefer-for-of */\n for (let i = 0; i < cumPositions.length; i++) {\n const chromName = cumPositions[i].chr;\n const chromStart = cumPositions[i].pos;\n const chromEnd = cumPositions[i].pos + chromLengths[chromName];\n\n if (chromStart <= minX && minX < chromEnd) {\n // start of the visible region is within this chromosome\n\n if (maxX > chromEnd) {\n // the visible region extends beyond the end of this chromosome\n // fetch from the start until the end of the chromosome\n recordPromises.push(\n bam.file\n .getRecordsForRange(chromName, minX - chromStart, chromEnd - chromStart, opt)\n .then(records => {\n const mappedRecords = records.map(rec =>\n bamRecordToJson(rec, chromName, cumPositions[i].pos)\n );\n tileValues.set(\n `${uid}.${z}.${x}`,\n (tileValues.get(`${uid}.${z}.${x}`) as JsonBamRecord[]).concat(mappedRecords)\n );\n return [];\n // return mappedRecords;\n })\n );\n\n // continue onto the next chromosome\n minX = chromEnd;\n } else {\n const startPos = Math.floor(minX - chromStart);\n const endPos = Math.ceil(maxX - chromStart);\n // the end of the region is within this chromosome\n recordPromises.push(\n bam.file.getRecordsForRange(chromName, startPos, endPos, opt).then(records => {\n const mappedRecords = records.map(rec => bamRecordToJson(rec, chromName, cumPositions[i].pos));\n tileValues.set(\n `${uid}.${z}.${x}`,\n (tileValues.get(`${uid}.${z}.${x}`) as JsonBamRecord[]).concat(mappedRecords)\n );\n return [];\n })\n );\n // end the loop because we've retrieved the last chromosome\n break;\n }\n }\n }\n\n // flatten the array of promises so that it looks like we're getting one long list of value\n return Promise.all(recordPromises).then(values => {\n return values.flat();\n });\n};\n\n/**\n * Not like other data fetchers, the Bam Data Fetcher fetches all the tiles at once.\n * @param uid\n * @param tileIds\n * @returns\n */\nconst fetchTilesDebounced = async (uid: string, tileIds: string[]) => {\n const tiles: Record = {};\n const validTileIds: string[] = [];\n const tilePromises: Promise[] = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('Invalid tile zoom or position:', z, x);\n continue;\n }\n\n validTileIds.push(tileId);\n tilePromises.push(tile(uid, z, x));\n }\n\n return Promise.all(tilePromises).then(values => {\n values.forEach((d, i) => {\n const validTileId = validTileIds[i];\n tiles[validTileId] = Object.assign(d, { tilePositionId: validTileId });\n });\n return tiles;\n });\n};\n\nconst getTabularData = (uid: string, tileIds: string[]) => {\n const { options } = dataSources.get(uid)!;\n const allSegments: Record = {};\n\n for (const tileId of tileIds) {\n const tileValue = tileValues.get(`${uid}.${tileId}`);\n\n if (!tileValue) {\n continue;\n }\n\n if ('error' in tileValue) {\n throw new Error(tileValue.error);\n }\n\n for (const segment of tileValue) {\n allSegments[segment.id] = {\n ...segment,\n substitutions: JSON.stringify(segment.substitutions)\n };\n }\n }\n\n const segments = Object.values(allSegments);\n\n // find and set mate info when the `data.loadMates` flag is on.\n if (options.loadMates) {\n // TODO: avoid mutation?\n findMates(segments, options.maxInsertSize);\n }\n\n let output: Junction[] | SegmentWithMate[] | Segment[];\n if (options.extractJunction) {\n // Reference(ggsashimi): https://github.com/guigolab/ggsashimi/blob/d686d59b4e342b8f9dcd484f0af4831cc092e5de/ggsashimi.py#L136\n output = findJunctions(segments, options.junctionMinCoverage);\n } else {\n output = segments;\n }\n\n const buffer = new TextEncoder().encode(JSON.stringify(output)).buffer;\n return Transfer(buffer, [buffer]);\n};\n\nconst groupBy = (xs: readonly T[], key: K): Record =>\n xs.reduce((rv, x) => {\n // @ts-expect-error\n (rv[x[key]] = rv[x[key]] || []).push(x);\n return rv;\n }, {});\n\nexport type SegmentWithMate = Segment & {\n mateIds: string[];\n foundMate: boolean;\n insertSize: number;\n largeInsertSize: boolean;\n svType: string;\n numMates: number;\n};\n\nconst findMates = (segments: Segment[], maxInsertSize = 0) => {\n // @ts-expect-error This methods mutates this above aob\n const segmentsByReadName: Record = groupBy(segments, 'name');\n\n // Iterate entries and set information about mates\n Object.values(segmentsByReadName).forEach(segmentGroup => {\n if (segmentGroup.length === 2) {\n const read = segmentGroup[0];\n const mate = segmentGroup[1];\n read.mateIds = [mate.id];\n mate.mateIds = [read.id];\n // Additional info we want\n const [l, r] = [read, mate].sort((a, b) => +a.start - +b.start);\n const insertSize = Math.max(0, +r.start - +l.end);\n const largeInsertSize = insertSize >= maxInsertSize;\n\n let svType: string;\n if (!largeInsertSize) {\n svType = 'normal read';\n } else if (l.strand === '+' && r.strand === '-') {\n svType = 'deletion (+-)';\n } else if (l.strand === '+' && r.strand === '+') {\n svType = 'inversion (++)';\n } else if (l.strand === '-' && r.strand === '-') {\n svType = 'inversion (--)';\n } else if (l.strand === '-' && r.strand === '+') {\n svType = 'duplication (-+)';\n } else {\n svType = `(${l.strand}${r.strand})`;\n }\n\n // if(largeInsertSize) console.log(svType);\n [read, mate].forEach(d => {\n d.foundMate = true;\n d.insertSize = insertSize;\n d.largeInsertSize = largeInsertSize;\n d.svType = svType;\n d.numMates = 2;\n });\n } else {\n // We do not handle such cases for now\n segmentGroup.forEach(d => {\n d.mateIds = segmentGroup.filter(mate => mate.id !== d.id).map(mate => mate.id);\n d.foundMate = false;\n d.insertSize = -1;\n d.largeInsertSize = false;\n d.svType = segmentGroup.length === 1 ? 'mates not found within chromosome' : 'more than two mates';\n d.numMates = segmentGroup.length;\n });\n }\n });\n return segmentsByReadName;\n};\n\nexport type Junction = { start: number; end: number; score: number };\n\nconst findJunctions = (segments: { start: number; end: number; substitutions: string }[], minCoverage = 0) => {\n const junctions: Junction[] = [];\n segments.forEach(segment => {\n const substitutions: { pos: number; length: number }[] = JSON.parse(segment.substitutions);\n substitutions.forEach(sub => {\n const don = segment.start + sub.pos;\n const acc = segment.start + sub.pos + sub.length;\n if (segment.start < don && acc < segment.end) {\n const j = junctions.find(d => d.start === don && d.end === acc);\n if (j) {\n j.score += 1;\n } else {\n junctions.push({ start: don, end: acc, score: 1 });\n }\n }\n });\n });\n return junctions.filter(d => d.score >= minCoverage);\n};\n\nconst tileFunctions = {\n init,\n tilesetInfo,\n fetchTilesDebounced,\n tile,\n getTabularData\n};\n\nexpose(tileFunctions);\n\nexport type WorkerApi = typeof tileFunctions;\nexport type { TilesetInfo };\nexport type Tiles = Awaited>;\n"],"names":["common","require$$0","Transfer","isWorkerRuntime","postMessageToMaster","subscribeToMasterMessages","this","__importDefault","require$$1","require$$2","require$$3","require$$4","isObservable","expose","i","toString","fromBytes","long","Long","c","len","len2","buffer","ieee754","Buffer","fromString","byteLength","code","msg","init","utils","Z_FIXED","Z_UNKNOWN","zero","MIN_MATCH","MAX_MATCH","LENGTH_CODES","LITERALS","L_CODES","D_CODES","BL_CODES","HEAP_SIZE","MAX_BITS","rank","adler32","crc32","Z_NO_FLUSH","Z_FINISH","Z_BLOCK","Z_OK","Z_STREAM_END","Z_STREAM_ERROR","Z_DATA_ERROR","Z_BUF_ERROR","Z_DEFAULT_COMPRESSION","Z_DEFAULT_STRATEGY","Z_DEFLATED","MAX_WBITS","deflate","strings","c2","ZStream","BAD","TYPE","inflate_fast","ENOUGH_LENS","ENOUGH_DISTS","CODES","LENS","DISTS","inflate_table","q","inflate","constants","GZheader","require$$5","require$$6","Inflate","Z_SYNC_FLUSH","entries","_getPrototypeOf","o","_setPrototypeOf","p","self","_get","Emitter","AbortSignal","AbortController","err","Request","abortableFetch","global","AggregateAbortController_1","abortcontroller_ponyfill_1","AggregateStatusReporter_1","AbortablePromiseCache_1","QuickLRU","AbortablePromiseCache","RemoteFile","feats","BAMFeature","_RemoteFile","_BamFile","bamFile"],"mappings":";;;;;;;;;;;;;MAEA,eAAiB,WAAS;AACzB,QAAI,CAAC,OAAO;AACX,aAAO;AAAA,IACP;AAGD,QAAI,OAAO,OAAO,eAAe,YAAY,OAAO,MAAM,OAAO,UAAU,MAAM,YAAY;AAE5F,aAAO,UAAU,MAAM,OAAO,UAAU,EAAC;AAAA,IACzC;AAED,QAAI,OAAO,MAAM,cAAc,MAAM,YAAY;AAChD,aAAO,UAAU,MAAM,cAAc;IACrC;AAED,WAAO;AAAA,EACR;;;ACjBA,SAAO,eAAe,aAAS,cAAc,EAAE,OAAO,KAAI,CAAE;AAC5D,cAAA,oBAA4B,YAAA,mBAA2B;AACvD,WAAS,iBAAiB,QAAQ,gBAAgB;AAC9C,UAA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CAAW,YAAA;AACxB,YAAM,gBAAmD,KAAK,MAAM,QAAQ,aAAa;AACzF,oBAAc,QAAQ,CAAO,QAAA;AACnB,cAAA,MAAM,QAAQ,QAAQ,IAAI;AAChC,cAAM,MAAM,QAAQ,QAAQ,IAAI,MAAM,IAAI;AAC1C,YAAI,QAAQ,QAAQ,OAAO,MAAM,QAAQ,KAAK;AACpC,gBAAA,IAAI,UAAU,KAAK,CAAA,MAAK,EAAE,UAAU,OAAO,EAAE,QAAQ,GAAG;AAC9D,cAAI,GAAG;AACH,cAAE,SAAS;AAAA,UAAA,OACR;AACO,sBAAA,KAAK,EAAE,OAAO,KAAK,KAAK,KAAK,OAAO,GAAG;AAAA,UACrD;AAAA,QACJ;AAAA,MAAA,CACH;AAAA,IAAA,CACJ;AACD,WAAO,UAAU,OAAO,CAAK,MAAA,EAAE,SAAS,WAAW;AAAA,EACvD;AAEA,QAAM,gBAAgB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAEA,SAAO,aAAa;;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55]} \ No newline at end of file diff --git a/dist/assets/bed-worker-cb58a7c2.js.map b/dist/assets/bed-worker-cb58a7c2.js.map deleted file mode 100644 index c58dd21c..00000000 --- a/dist/assets/bed-worker-cb58a7c2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bed-worker-cb58a7c2.js","sources":["../node_modules/.pnpm/abortcontroller-polyfill@1.7.5/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/abortcontroller-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateAbortController.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateStatusReporter.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AbortablePromiseCache.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/index.js","../node_modules/.pnpm/quick-lru@4.0.1/node_modules/quick-lru/index.js","../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js","../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js","../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js","../__vite-browser-external","../node_modules/.pnpm/generic-filehandle@3.1.1/node_modules/generic-filehandle/esm/remoteFile.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js","../node_modules/.pnpm/@gmod+bgzf-filehandle@1.4.7/node_modules/@gmod/bgzf-filehandle/esm/unzip-pako.js","../node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/util.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/virtualOffset.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/chunk.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/indexFile.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tbi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/csi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tabixIndexedFile.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayMap.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toFinite.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toInteger.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copyArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIterateeCall.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseClamp.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseValues.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/values.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseRandom.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_shuffleSelf.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/sampleSize.js","../node_modules/.pnpm/is-observable@2.1.0/node_modules/is-observable/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/serializers.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/common.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/symbols.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/transferable.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/types/messages.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/implementation.browser.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/worker.mjs","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/ascending.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/bisector.js","../src/data-fetchers/utils.ts","../node_modules/.pnpm/@gmod+bed@2.1.2/node_modules/@gmod/bed/esm/autoSql.js","../node_modules/.pnpm/@gmod+bed@2.1.2/node_modules/@gmod/bed/esm/as/autoSqlSchemas.js","../node_modules/.pnpm/@gmod+bed@2.1.2/node_modules/@gmod/bed/esm/defaultTypes.js","../node_modules/.pnpm/@gmod+bed@2.1.2/node_modules/@gmod/bed/esm/util.js","../node_modules/.pnpm/@gmod+bed@2.1.2/node_modules/@gmod/bed/esm/parser.js","../src/data-fetchers/bed/bed-parser.ts","../src/data-fetchers/bed/bed-worker.ts"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get.apply(this, arguments);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'reason', {\n value: undefined,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort(reason) {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n var signalReason = reason;\n\n if (signalReason === undefined) {\n if (typeof document === 'undefined') {\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n } else {\n try {\n signalReason = new DOMException('signal is aborted without reason');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n }\n }\n }\n\n this.signal.reason = signalReason;\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","\"use strict\";\n/* eslint-disable */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbortSignal = exports.AbortController = void 0;\nconst cjs_ponyfill_1 = require(\"abortcontroller-polyfill/dist/cjs-ponyfill\");\nvar getGlobal = function () {\n // the only reliable means to get the global object is\n // `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n};\n//@ts-ignore\nlet AbortController = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortController : getGlobal().AbortController;\nexports.AbortController = AbortController;\n//@ts-ignore\nlet AbortSignal = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal;\nexports.AbortSignal = AbortSignal;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nclass NullSignal {\n}\n/**\n * aggregates a number of abort signals, will only fire the aggregated\n * abort if all of the input signals have been aborted\n */\nclass AggregateAbortController {\n constructor() {\n this.signals = new Set();\n this.abortController = new abortcontroller_ponyfill_1.AbortController();\n }\n /**\n * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy,\n * will be treated as a null-signal, and this abortcontroller will no\n * longer be abortable.\n */\n //@ts-ignore\n addSignal(signal = new NullSignal()) {\n if (this.signal.aborted) {\n throw new Error('cannot add a signal, already aborted!');\n }\n // note that a NullSignal will never fire, so if we\n // have one this thing will never actually abort\n this.signals.add(signal);\n if (signal.aborted) {\n // handle the abort immediately if it is already aborted\n // for some reason\n this.handleAborted(signal);\n }\n else if (typeof signal.addEventListener === 'function') {\n signal.addEventListener('abort', () => {\n this.handleAborted(signal);\n });\n }\n }\n handleAborted(signal) {\n this.signals.delete(signal);\n if (this.signals.size === 0) {\n this.abortController.abort();\n }\n }\n get signal() {\n return this.abortController.signal;\n }\n abort() {\n this.abortController.abort();\n }\n}\nexports.default = AggregateAbortController;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass AggregateStatusReporter {\n constructor() {\n this.callbacks = new Set();\n }\n addCallback(callback = () => { }) {\n this.callbacks.add(callback);\n callback(this.currentMessage);\n }\n callback(message) {\n this.currentMessage = message;\n this.callbacks.forEach(elt => {\n elt(message);\n });\n }\n}\nexports.default = AggregateStatusReporter;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nconst AggregateAbortController_1 = __importDefault(require(\"./AggregateAbortController\"));\nconst AggregateStatusReporter_1 = __importDefault(require(\"./AggregateStatusReporter\"));\nclass AbortablePromiseCache {\n constructor({ fill, cache, }) {\n if (typeof fill !== 'function') {\n throw new TypeError('must pass a fill function');\n }\n if (typeof cache !== 'object') {\n throw new TypeError('must pass a cache object');\n }\n if (typeof cache.get !== 'function' ||\n typeof cache.set !== 'function' ||\n typeof cache.delete !== 'function') {\n throw new TypeError('cache must implement get(key), set(key, val), and and delete(key)');\n }\n this.cache = cache;\n this.fillCallback = fill;\n }\n static isAbortException(exception) {\n return (\n // DOMException\n exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n //@ts-ignore\n exception.code === 'ERR_ABORTED' ||\n // stringified DOMException\n exception.message === 'AbortError: aborted' ||\n // stringified standard-ish exception\n exception.message === 'Error: aborted');\n }\n evict(key, entry) {\n if (this.cache.get(key) === entry) {\n this.cache.delete(key);\n }\n }\n fill(key, data, signal, statusCallback) {\n const aborter = new AggregateAbortController_1.default();\n const statusReporter = new AggregateStatusReporter_1.default();\n statusReporter.addCallback(statusCallback);\n const newEntry = {\n aborter: aborter,\n promise: this.fillCallback(data, aborter.signal, (message) => {\n statusReporter.callback(message);\n }),\n settled: false,\n statusReporter,\n get aborted() {\n return this.aborter.signal.aborted;\n },\n };\n newEntry.aborter.addSignal(signal);\n // remove the fill from the cache when its abortcontroller fires, if still in there\n newEntry.aborter.signal.addEventListener('abort', () => {\n if (!newEntry.settled) {\n this.evict(key, newEntry);\n }\n });\n // chain off the cached promise to record when it settles\n newEntry.promise\n .then(() => {\n newEntry.settled = true;\n }, () => {\n newEntry.settled = true;\n // if the fill throws an error (including abort) and is still in the cache, remove it\n this.evict(key, newEntry);\n })\n .catch(e => {\n // this will only be reached if there is some kind of\n // bad bug in this library\n console.error(e);\n throw e;\n });\n this.cache.set(key, newEntry);\n }\n static checkSinglePromise(promise, signal) {\n // check just this signal for having been aborted, and abort the\n // promise if it was, regardless of what happened with the cached\n // response\n function checkForSingleAbort() {\n if (signal && signal.aborted) {\n throw Object.assign(new Error('aborted'), { code: 'ERR_ABORTED' });\n }\n }\n return promise.then(result => {\n checkForSingleAbort();\n return result;\n }, error => {\n checkForSingleAbort();\n throw error;\n });\n }\n has(key) {\n return this.cache.has(key);\n }\n /**\n * Callback for getting status of the pending async\n *\n * @callback statusCallback\n * @param {any} status, current status string or message object\n */\n /**\n * @param {any} key cache key to use for this request\n * @param {any} data data passed as the first argument to the fill callback\n * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request\n * @param {statusCallback} a callback to get the current status of a pending async operation\n */\n get(key, data, signal, statusCallback) {\n if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) {\n throw new TypeError('second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?');\n }\n const cacheEntry = this.cache.get(key);\n if (cacheEntry) {\n if (cacheEntry.aborted && !cacheEntry.settled) {\n // if it's aborted but has not realized it yet, evict it and redispatch\n this.evict(key, cacheEntry);\n return this.get(key, data, signal, statusCallback);\n }\n if (cacheEntry.settled) {\n // too late to abort, just return it\n return cacheEntry.promise;\n }\n // request is in-flight, add this signal to its list of signals,\n // or if there is no signal, the aborter will become non-abortable\n cacheEntry.aborter.addSignal(signal);\n cacheEntry.statusReporter.addCallback(statusCallback);\n return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal);\n }\n // if we got here, it is not in the cache. fill.\n this.fill(key, data, signal, statusCallback);\n return AbortablePromiseCache.checkSinglePromise(\n //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-\n //eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.cache.get(key).promise, signal);\n }\n /**\n * delete the given entry from the cache. if it exists and its fill request has\n * not yet settled, the fill will be signaled to abort.\n *\n * @param {any} key\n */\n delete(key) {\n const cachedEntry = this.cache.get(key);\n if (cachedEntry) {\n if (!cachedEntry.settled) {\n cachedEntry.aborter.abort();\n }\n this.cache.delete(key);\n }\n }\n /**\n * Clear all requests from the cache. Aborts any that have not settled.\n * @returns {number} count of entries deleted\n */\n clear() {\n // iterate without needing regenerator-runtime\n const keyIter = this.cache.keys();\n let deleteCount = 0;\n for (let result = keyIter.next(); !result.done; result = keyIter.next()) {\n this.delete(result.value);\n deleteCount += 1;\n }\n return deleteCount;\n }\n}\nexports.default = AbortablePromiseCache;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst AbortablePromiseCache_1 = __importDefault(require(\"./AbortablePromiseCache\"));\nexports.default = AbortablePromiseCache_1.default;\n","'use strict';\n\nclass QuickLRU {\n\tconstructor(options = {}) {\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst value = this.oldCache.get(key);\n\t\t\tthis.oldCache.delete(key);\n\t\t\tthis._set(key, value);\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tset(key, value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, value);\n\t\t} else {\n\t\t\tthis._set(key, value);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\thas(key) {\n\t\treturn this.cache.has(key) || this.oldCache.has(key);\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this.oldCache.get(key);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tyield item;\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget size() {\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn this._size + oldCacheSize;\n\t}\n}\n\nmodule.exports = QuickLRU;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","export default {}","import { Buffer } from 'buffer';\nexport default class RemoteFile {\n async getBufferFromResponse(response) {\n if (typeof response.buffer === 'function') {\n return response.buffer();\n }\n else if (typeof response.arrayBuffer === 'function') {\n const resp = await response.arrayBuffer();\n return Buffer.from(resp);\n }\n else {\n throw new TypeError('invalid HTTP response object, has no buffer method, and no arrayBuffer method');\n }\n }\n constructor(source, opts = {}) {\n this.baseOverrides = {};\n this.url = source;\n const fetch = opts.fetch || globalThis.fetch.bind(globalThis);\n if (!fetch) {\n throw new TypeError(`no fetch function supplied, and none found in global environment`);\n }\n if (opts.overrides) {\n this.baseOverrides = opts.overrides;\n }\n this.fetchImplementation = fetch;\n }\n async fetch(input, init) {\n let response;\n try {\n response = await this.fetchImplementation(input, init);\n }\n catch (e) {\n if (`${e}`.includes('Failed to fetch')) {\n // refetch to to help work around a chrome bug (discussed in\n // generic-filehandle issue #72) in which the chrome cache returns a\n // CORS error for content in its cache. see also\n // https://github.com/GMOD/jbrowse-components/pull/1511\n console.warn(`generic-filehandle: refetching ${input} to attempt to work around chrome CORS header caching bug`);\n response = await this.fetchImplementation(input, {\n ...init,\n cache: 'reload',\n });\n }\n else {\n throw e;\n }\n }\n return response;\n }\n async read(buffer, offset = 0, length, position = 0, opts = {}) {\n const { headers = {}, signal, overrides = {} } = opts;\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n }\n else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n ...this.baseOverrides.headers,\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n };\n const response = await this.fetch(this.url, args);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n if ((response.status === 200 && position === 0) ||\n response.status === 206) {\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n return { bytesRead: bytesCopied, buffer };\n }\n if (response.status === 200) {\n throw new Error('${this.url} fetch returned status 200, expected 206');\n }\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n }\n async readFile(options = {}) {\n let encoding;\n let opts;\n if (typeof options === 'string') {\n encoding = options;\n opts = {};\n }\n else {\n encoding = options.encoding;\n opts = options;\n delete opts.encoding;\n }\n const { headers = {}, signal, overrides = {} } = opts;\n const args = {\n headers,\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n ...this.baseOverrides,\n ...overrides,\n };\n const response = await this.fetch(this.url, args);\n if (!response) {\n throw new Error('generic-filehandle failed to fetch');\n }\n if (response.status !== 200) {\n throw Object.assign(new Error(`HTTP ${response.status} fetching ${this.url}`), {\n status: response.status,\n });\n }\n if (encoding === 'utf8') {\n return response.text();\n }\n if (encoding) {\n throw new Error(`unsupported encoding: ${encoding}`);\n }\n return this.getBufferFromResponse(response);\n }\n async stat() {\n if (!this._stat) {\n const buf = Buffer.allocUnsafe(10);\n await this.read(buf, 0, 10, 0);\n if (!this._stat) {\n throw new Error(`unable to determine size of file at ${this.url}`);\n }\n }\n return this._stat;\n }\n async close() {\n return;\n }\n}\n//# sourceMappingURL=remoteFile.js.map","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","import { Buffer } from 'buffer';\n//@ts-ignore\nimport { Z_SYNC_FLUSH, Inflate } from 'pako';\n// browserify-zlib, which is the zlib shim used by default in webpacked code,\n// does not properly uncompress bgzf chunks that contain more than\n// one bgzf block, so export an unzip function that uses pako directly\n// if we are running in a browser.\nasync function unzip(inputData) {\n try {\n let strm;\n let pos = 0;\n let i = 0;\n const chunks = [];\n let totalSize = 0;\n let inflator;\n do {\n const remainingInput = inputData.subarray(pos);\n inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n pos += strm.next_in;\n chunks[i] = inflator.result;\n totalSize += chunks[i].length;\n i += 1;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n return Buffer.from(result);\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to pakounzip, except it does extra counting\n// to return the positions of compressed and decompressed\n// data offsets\nasync function unzipChunk(inputData) {\n try {\n let strm;\n let cpos = 0;\n let dpos = 0;\n const blocks = [];\n const cpositions = [];\n const dpositions = [];\n do {\n const remainingInput = inputData.slice(cpos);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = Buffer.from(inflator.result);\n blocks.push(buffer);\n cpositions.push(cpos);\n dpositions.push(dpos);\n cpos += strm.next_in;\n dpos += buffer.length;\n } while (strm.avail_in);\n const buffer = Buffer.concat(blocks);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to unzipChunk above but slices (0,minv.dataPosition) and\n// (maxv.dataPosition,end) off\nasync function unzipChunkSlice(inputData, chunk) {\n try {\n let strm;\n const { minv, maxv } = chunk;\n let cpos = minv.blockPosition;\n let dpos = minv.dataPosition;\n const chunks = [];\n const cpositions = [];\n const dpositions = [];\n let totalSize = 0;\n let i = 0;\n do {\n const remainingInput = inputData.subarray(cpos - minv.blockPosition);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = inflator.result;\n chunks.push(buffer);\n let len = buffer.length;\n cpositions.push(cpos);\n dpositions.push(dpos);\n if (chunks.length === 1 && minv.dataPosition) {\n // this is the first chunk, trim it\n chunks[0] = chunks[0].subarray(minv.dataPosition);\n len = chunks[0].length;\n }\n const origCpos = cpos;\n cpos += strm.next_in;\n dpos += len;\n if (origCpos >= maxv.blockPosition) {\n // this is the last chunk, trim it and stop decompressing\n // note if it is the same block is minv it subtracts that already\n // trimmed part of the slice length\n chunks[i] = chunks[i].subarray(0, maxv.blockPosition === minv.blockPosition\n ? maxv.dataPosition - minv.dataPosition + 1\n : maxv.dataPosition + 1);\n cpositions.push(cpos);\n dpositions.push(dpos);\n totalSize += chunks[i].length;\n break;\n }\n totalSize += chunks[i].length;\n i++;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n const buffer = Buffer.from(result);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\nfunction nodeUnzip() {\n throw new Error('nodeUnzip not implemented.');\n}\nexport { unzip, unzipChunk, unzipChunkSlice, unzip as pakoUnzip, nodeUnzip };\n//# sourceMappingURL=unzip-pako.js.map","module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n","export function longToNumber(long) {\n if (long.greaterThan(Number.MAX_SAFE_INTEGER) ||\n long.lessThan(Number.MIN_SAFE_INTEGER)) {\n throw new Error('integer overflow');\n }\n return long.toNumber();\n}\nclass AbortError extends Error {\n}\n/**\n * Properly check if the given AbortSignal is aborted.\n * Per the standard, if the signal reads as aborted,\n * this function throws either a DOMException AbortError, or a regular error\n * with a `code` attribute set to `ERR_ABORTED`.\n *\n * For convenience, passing `undefined` is a no-op\n *\n * @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute\n * @returns nothing\n */\nexport function checkAbortSignal(signal) {\n if (!signal) {\n return;\n }\n if (signal.aborted) {\n if (typeof DOMException !== 'undefined') {\n // eslint-disable-next-line no-undef\n throw new DOMException('aborted', 'AbortError');\n }\n else {\n const e = new AbortError('aborted');\n e.code = 'ERR_ABORTED';\n throw e;\n }\n }\n}\n/**\n * Skips to the next tick, then runs `checkAbortSignal`.\n * Await this to inside an otherwise synchronous loop to\n * provide a place to break when an abort signal is received.\n * @param {AbortSignal} signal\n */\nexport async function abortBreakPoint(signal) {\n await Promise.resolve();\n checkAbortSignal(signal);\n}\nexport function canMergeBlocks(chunk1, chunk2) {\n return (chunk2.minv.blockPosition - chunk1.maxv.blockPosition < 65000 &&\n chunk2.maxv.blockPosition - chunk1.minv.blockPosition < 5000000);\n}\nexport function optimizeChunks(chunks, lowest) {\n const mergedChunks = [];\n let lastChunk = null;\n if (chunks.length === 0) {\n return chunks;\n }\n chunks.sort(function (c0, c1) {\n const dif = c0.minv.blockPosition - c1.minv.blockPosition;\n if (dif !== 0) {\n return dif;\n }\n else {\n return c0.minv.dataPosition - c1.minv.dataPosition;\n }\n });\n chunks.forEach(chunk => {\n if (!lowest || chunk.maxv.compareTo(lowest) > 0) {\n if (lastChunk === null) {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n else {\n if (canMergeBlocks(lastChunk, chunk)) {\n if (chunk.maxv.compareTo(lastChunk.maxv) > 0) {\n lastChunk.maxv = chunk.maxv;\n }\n }\n else {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n }\n }\n });\n return mergedChunks;\n}\n//# sourceMappingURL=util.js.map","export default class VirtualOffset {\n constructor(blockPosition, dataPosition) {\n this.blockPosition = blockPosition; // < offset of the compressed data block\n this.dataPosition = dataPosition; // < offset into the uncompressed data\n }\n toString() {\n return `${this.blockPosition}:${this.dataPosition}`;\n }\n compareTo(b) {\n return (this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition);\n }\n static min(...args) {\n let min;\n let i = 0;\n for (; !min; i += 1) {\n min = args[i];\n }\n for (; i < args.length; i += 1) {\n if (min.compareTo(args[i]) > 0) {\n min = args[i];\n }\n }\n return min;\n }\n}\nexport function fromBytes(bytes, offset = 0, bigendian = false) {\n if (bigendian) {\n throw new Error('big-endian virtual file offsets not implemented');\n }\n return new VirtualOffset(bytes[offset + 7] * 0x10000000000 +\n bytes[offset + 6] * 0x100000000 +\n bytes[offset + 5] * 0x1000000 +\n bytes[offset + 4] * 0x10000 +\n bytes[offset + 3] * 0x100 +\n bytes[offset + 2], (bytes[offset + 1] << 8) | bytes[offset]);\n}\n//# sourceMappingURL=virtualOffset.js.map","// little class representing a chunk in the index\nexport default class Chunk {\n /**\n * @param {VirtualOffset} minv\n * @param {VirtualOffset} maxv\n * @param {number} bin\n * @param {number} [fetchedSize]\n */\n constructor(minv, maxv, bin, fetchedSize = undefined) {\n this.minv = minv;\n this.maxv = maxv;\n this.bin = bin;\n this._fetchedSize = fetchedSize;\n }\n toUniqueString() {\n return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`;\n }\n toString() {\n return this.toUniqueString();\n }\n compareTo(b) {\n return (this.minv.compareTo(b.minv) ||\n this.maxv.compareTo(b.maxv) ||\n this.bin - b.bin);\n }\n fetchedSize() {\n if (this._fetchedSize !== undefined) {\n return this._fetchedSize;\n }\n return this.maxv.blockPosition + (1 << 16) - this.minv.blockPosition;\n }\n}\n//# sourceMappingURL=chunk.js.map","export default class IndexFile {\n constructor({ filehandle, renameRefSeqs = (n) => n, }) {\n this.filehandle = filehandle;\n this.renameRefSeq = renameRefSeqs;\n }\n async getMetadata(opts = {}) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { indices, ...rest } = await this.parse(opts);\n return rest;\n }\n _findFirstData(currentFdl, virtualOffset) {\n if (currentFdl) {\n return currentFdl.compareTo(virtualOffset) > 0\n ? virtualOffset\n : currentFdl;\n }\n else {\n return virtualOffset;\n }\n }\n async parse(opts = {}) {\n if (!this.parseP) {\n this.parseP = this._parse(opts).catch(e => {\n this.parseP = undefined;\n throw e;\n });\n }\n return this.parseP;\n }\n async hasRefSeq(seqId, opts = {}) {\n return !!((await this.parse(opts)).indices[seqId] || {}).binIndex;\n }\n}\n//# sourceMappingURL=indexFile.js.map","import Long from 'long';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport { longToNumber, optimizeChunks, checkAbortSignal } from './util';\nimport IndexFile from './indexFile';\nconst TBI_MAGIC = 21578324; // TBI\\1\nconst TAD_LIDX_SHIFT = 14;\n/**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\nfunction reg2bins(beg, end) {\n beg += 1; // < convert to 1-based closed\n end -= 1;\n return [\n [0, 0],\n [1 + (beg >> 26), 1 + (end >> 26)],\n [9 + (beg >> 23), 9 + (end >> 23)],\n [73 + (beg >> 20), 73 + (end >> 20)],\n [585 + (beg >> 17), 585 + (end >> 17)],\n [4681 + (beg >> 14), 4681 + (end >> 14)],\n ];\n}\nexport default class TabixIndex extends IndexFile {\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const buf = await this.filehandle.readFile(opts);\n const bytes = await unzip(buf);\n checkAbortSignal(opts.signal);\n // check TBI magic numbers\n if (bytes.readUInt32LE(0) !== TBI_MAGIC /* \"TBI\\1\" */) {\n throw new Error('Not a TBI file');\n // TODO: do we need to support big-endian TBI files?\n }\n // number of reference sequences in the index\n const refCount = bytes.readInt32LE(4);\n const formatFlags = bytes.readInt32LE(8);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const formatOpts = {\n 0: 'generic',\n 1: 'SAM',\n 2: 'VCF',\n };\n const format = formatOpts[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(12),\n start: bytes.readInt32LE(16),\n end: bytes.readInt32LE(20),\n };\n const metaValue = bytes.readInt32LE(24);\n const depth = 5;\n const maxBinNumber = ((1 << ((depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (14 + depth * 3);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(28);\n // read sequence dictionary\n const nameSectionLength = bytes.readInt32LE(32);\n const { refNameToId, refIdToName } = this._parseNameBytes(bytes.slice(36, 36 + nameSectionLength));\n // read the indexes for each reference sequence\n let currOffset = 36 + nameSectionLength;\n let firstDataLine;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats;\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n currOffset += 4;\n if (bin > maxBinNumber + 1) {\n throw new Error('tabix index contains too many bins, please use a CSI index');\n }\n else if (bin === maxBinNumber + 1) {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n if (chunkCount === 2) {\n stats = this.parsePseudoBin(bytes, currOffset);\n }\n currOffset += 16 * chunkCount;\n }\n else {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n firstDataLine = this._findFirstData(firstDataLine, u);\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n // the linear index\n const linearCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const linearIndex = new Array(linearCount);\n for (let k = 0; k < linearCount; k += 1) {\n linearIndex[k] = fromBytes(bytes, currOffset);\n currOffset += 8;\n firstDataLine = this._findFirstData(firstDataLine, linearIndex[k]);\n }\n return { binIndex, linearIndex, stats };\n });\n return {\n indices,\n metaChar,\n maxBinNumber,\n maxRefLength,\n skipLines,\n firstDataLine,\n columnNumbers,\n coordinateType,\n format,\n refIdToName,\n refNameToId,\n maxBlockSize: 1 << 16,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 16, offset + 24), true));\n return { lineCount };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n const minOffset = ba.linearIndex.length\n ? ba.linearIndex[min >> TAD_LIDX_SHIFT >= ba.linearIndex.length\n ? ba.linearIndex.length - 1\n : min >> TAD_LIDX_SHIFT]\n : new VirtualOffset(0, 0);\n if (!minOffset) {\n console.warn('querying outside of possible tabix range');\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n // Use the linear index to find minimum file position of chunks that could\n // contain alignments in the region\n const nintv = ba.linearIndex.length;\n let lowest = null;\n const minLin = Math.min(min >> 14, nintv - 1);\n const maxLin = Math.min(max >> 14, nintv - 1);\n for (let i = minLin; i <= maxLin; ++i) {\n const vp = ba.linearIndex[i];\n if (vp) {\n if (!lowest || vp.compareTo(lowest) < 0) {\n lowest = vp;\n }\n }\n }\n return optimizeChunks(chunks, lowest);\n }\n}\n//# sourceMappingURL=tbi.js.map","import Long from 'long';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { longToNumber, optimizeChunks } from './util';\nimport IndexFile from './indexFile';\nconst CSI1_MAGIC = 21582659; // CSI\\1\nconst CSI2_MAGIC = 38359875; // CSI\\2\nfunction lshift(num, bits) {\n return num * 2 ** bits;\n}\nfunction rshift(num, bits) {\n return Math.floor(num / 2 ** bits);\n}\nexport default class CSI extends IndexFile {\n constructor(args) {\n super(args);\n this.maxBinNumber = 0;\n this.depth = 0;\n this.minShift = 0;\n }\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n async indexCov() {\n throw new Error('CSI indexes do not support indexcov');\n }\n parseAuxData(bytes, offset) {\n const formatFlags = bytes.readInt32LE(offset);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const format = { 0: 'generic', 1: 'SAM', 2: 'VCF' }[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(offset + 4),\n start: bytes.readInt32LE(offset + 8),\n end: bytes.readInt32LE(offset + 12),\n };\n const metaValue = bytes.readInt32LE(offset + 16);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(offset + 20);\n const nameSectionLength = bytes.readInt32LE(offset + 24);\n const { refIdToName, refNameToId } = this._parseNameBytes(bytes.slice(offset + 28, offset + 28 + nameSectionLength));\n return {\n refIdToName,\n refNameToId,\n skipLines,\n metaChar,\n columnNumbers,\n format,\n coordinateType,\n };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const bytes = await unzip((await this.filehandle.readFile(opts)));\n // check TBI magic numbers\n let csiVersion;\n if (bytes.readUInt32LE(0) === CSI1_MAGIC) {\n csiVersion = 1;\n }\n else if (bytes.readUInt32LE(0) === CSI2_MAGIC) {\n csiVersion = 2;\n }\n else {\n throw new Error('Not a CSI file');\n // TODO: do we need to support big-endian CSI files?\n }\n this.minShift = bytes.readInt32LE(4);\n this.depth = bytes.readInt32LE(8);\n this.maxBinNumber = ((1 << ((this.depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (this.minShift + this.depth * 3);\n const auxLength = bytes.readInt32LE(12);\n const aux = auxLength && auxLength >= 30\n ? this.parseAuxData(bytes, 16)\n : {\n refIdToName: [],\n refNameToId: {},\n metaChar: null,\n columnNumbers: { ref: 0, start: 1, end: 2 },\n coordinateType: 'zero-based-half-open',\n format: 'generic',\n };\n const refCount = bytes.readInt32LE(16 + auxLength);\n // read the indexes for each reference sequence\n let firstDataLine;\n let currOffset = 16 + auxLength + 4;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats; // < provided by parsing a pseudo-bin, if present\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n if (bin > this.maxBinNumber) {\n // this is a fake bin that actually has stats information\n // about the reference sequence in it\n stats = this.parsePseudoBin(bytes, currOffset + 4);\n currOffset += 4 + 8 + 4 + 16 + 16;\n }\n else {\n const loffset = fromBytes(bytes, currOffset + 4);\n firstDataLine = this._findFirstData(firstDataLine, loffset);\n const chunkCount = bytes.readInt32LE(currOffset + 12);\n currOffset += 16;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n // this._findFirstData(data, u)\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n return { binIndex, stats };\n });\n return {\n ...aux,\n csi: true,\n refCount,\n maxBlockSize: 1 << 16,\n firstDataLine,\n csiVersion,\n indices,\n depth: this.depth,\n maxBinNumber: this.maxBinNumber,\n maxRefLength,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 28, offset + 36), true));\n return { lineCount };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = this.reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n return optimizeChunks(chunks, new VirtualOffset(0, 0));\n }\n /**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\n reg2bins(beg, end) {\n beg -= 1; // < convert to 1-based closed\n if (beg < 1) {\n beg = 1;\n }\n if (end > 2 ** 50) {\n end = 2 ** 34;\n } // 17 GiB ought to be enough for anybody\n end -= 1;\n let l = 0;\n let t = 0;\n let s = this.minShift + this.depth * 3;\n const bins = [];\n for (; l <= this.depth; s -= 3, t += lshift(1, l * 3), l += 1) {\n const b = t + rshift(beg, s);\n const e = t + rshift(end, s);\n if (e - b + bins.length > this.maxBinNumber) {\n throw new Error(`query ${beg}-${end} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);\n }\n bins.push([b, e]);\n }\n return bins;\n }\n}\n//# sourceMappingURL=csi.js.map","import AbortablePromiseCache from 'abortable-promise-cache';\nimport LRU from 'quick-lru';\nimport { Buffer } from 'buffer';\nimport { LocalFile } from 'generic-filehandle';\nimport { unzip, unzipChunkSlice } from '@gmod/bgzf-filehandle';\nimport { checkAbortSignal } from './util';\nimport TBI from './tbi';\nimport CSI from './csi';\nconst decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8') : undefined;\nfunction timeout(time) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\nexport default class TabixIndexedFile {\n /**\n * @param {object} args\n * @param {string} [args.path]\n * @param {filehandle} [args.filehandle]\n * @param {string} [args.tbiPath]\n * @param {filehandle} [args.tbiFilehandle]\n * @param {string} [args.csiPath]\n * @param {filehandle} [args.csiFilehandle]\n * @param {number} [args.yieldTime] yield to main thread after N milliseconds if reading features is taking a long time to avoid hanging main thread\n * @param {function} [args.renameRefSeqs] optional function with sig `string => string` to transform\n * reference sequence names for the purpose of indexing and querying. note that the data that is returned is\n * not altered, just the names of the reference sequences that are used for querying.\n */\n constructor({ path, filehandle, tbiPath, tbiFilehandle, csiPath, csiFilehandle, yieldTime = 500, chunkSizeLimit = 50000000, renameRefSeqs = n => n, chunkCacheSize = 5 * 2 ** 20, }) {\n if (filehandle) {\n this.filehandle = filehandle;\n }\n else if (path) {\n this.filehandle = new LocalFile(path);\n }\n else {\n throw new TypeError('must provide either filehandle or path');\n }\n if (tbiFilehandle) {\n this.index = new TBI({\n filehandle: tbiFilehandle,\n renameRefSeqs,\n });\n }\n else if (csiFilehandle) {\n this.index = new CSI({\n filehandle: csiFilehandle,\n renameRefSeqs,\n });\n }\n else if (tbiPath) {\n this.index = new TBI({\n filehandle: new LocalFile(tbiPath),\n renameRefSeqs,\n });\n }\n else if (csiPath) {\n this.index = new CSI({\n filehandle: new LocalFile(csiPath),\n renameRefSeqs,\n });\n }\n else if (path) {\n this.index = new TBI({\n filehandle: new LocalFile(`${path}.tbi`),\n renameRefSeqs,\n });\n }\n else {\n throw new TypeError('must provide one of tbiFilehandle, tbiPath, csiFilehandle, or csiPath');\n }\n this.chunkSizeLimit = chunkSizeLimit;\n this.renameRefSeq = renameRefSeqs;\n this.yieldTime = yieldTime;\n this.chunkCache = new AbortablePromiseCache({\n cache: new LRU({ maxSize: Math.floor(chunkCacheSize / (1 << 16)) }),\n fill: (args, signal) => this.readChunk(args, { signal }),\n });\n }\n /**\n * @param refName name of the reference sequence\n * @param start start of the region (in 0-based half-open coordinates)\n * @param end end of the region (in 0-based half-open coordinates)\n * @param opts callback called for each line in the region. can also pass a object param containing obj.lineCallback, obj.signal, etc\n * @returns promise that is resolved when the whole read is finished, rejected on error\n */\n async getLines(refName, start, end, opts) {\n let signal;\n let options = {};\n let callback;\n if (typeof opts === 'undefined') {\n throw new TypeError('line callback must be provided');\n }\n if (typeof opts === 'function') {\n callback = opts;\n }\n else {\n options = opts;\n callback = opts.lineCallback;\n }\n if (refName === undefined) {\n throw new TypeError('must provide a reference sequence name');\n }\n if (!callback) {\n throw new TypeError('line callback must be provided');\n }\n const metadata = await this.index.getMetadata(options);\n checkAbortSignal(signal);\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = metadata.maxRefLength;\n }\n if (!(start <= end)) {\n throw new TypeError('invalid start and end coordinates. start must be less than or equal to end');\n }\n if (start === end) {\n return;\n }\n const chunks = await this.index.blocksForRange(refName, start, end, options);\n checkAbortSignal(signal);\n // check the chunks for any that are over the size limit. if\n // any are, don't fetch any of them\n for (let i = 0; i < chunks.length; i += 1) {\n const size = chunks[i].fetchedSize();\n if (size > this.chunkSizeLimit) {\n throw new Error(`Too much data. Chunk size ${size.toLocaleString()} bytes exceeds chunkSizeLimit of ${this.chunkSizeLimit.toLocaleString()}.`);\n }\n }\n // now go through each chunk and parse and filter the lines out of it\n let last = Date.now();\n for (let chunkNum = 0; chunkNum < chunks.length; chunkNum += 1) {\n let previousStartCoordinate;\n const c = chunks[chunkNum];\n const { buffer, cpositions, dpositions } = await this.chunkCache.get(c.toString(), c);\n checkAbortSignal(signal);\n let blockStart = 0;\n let pos = 0;\n while (blockStart < buffer.length) {\n const n = buffer.indexOf('\\n', blockStart);\n if (n === -1) {\n break;\n }\n const b = buffer.slice(blockStart, n);\n const line = (decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString();\n if (dpositions) {\n while (blockStart + c.minv.dataPosition >= dpositions[pos++]) { }\n pos--;\n }\n // filter the line for whether it is within the requested range\n const { startCoordinate, overlaps } = this.checkLine(metadata, refName, start, end, line);\n // do a small check just to make sure that the lines are really sorted\n // by start coordinate\n if (previousStartCoordinate !== undefined &&\n startCoordinate !== undefined &&\n previousStartCoordinate > startCoordinate) {\n throw new Error(`Lines not sorted by start coordinate (${previousStartCoordinate} > ${startCoordinate}), this file is not usable with Tabix.`);\n }\n previousStartCoordinate = startCoordinate;\n if (overlaps) {\n callback(line.trim(), \n // cpositions[pos] refers to actual file offset of a bgzip block boundaries\n //\n // we multiply by (1 <<8) in order to make sure each block has a \"unique\"\n // address space so that data in that block could never overlap\n //\n // then the blockStart-dpositions is an uncompressed file offset from\n // that bgzip block boundary, and since the cpositions are multiplied by\n // (1 << 8) these uncompressed offsets get a unique space\n cpositions[pos] * (1 << 8) +\n (blockStart - dpositions[pos]) +\n c.minv.dataPosition +\n 1);\n }\n else if (startCoordinate !== undefined && startCoordinate >= end) {\n // the lines were overlapping the region, but now have stopped, so\n // we must be at the end of the relevant data and we can stop\n // processing data now\n return;\n }\n // yield if we have emitted beyond the yield limit\n if (this.yieldTime && last - Date.now() > this.yieldTime) {\n last = Date.now();\n checkAbortSignal(signal);\n await timeout(1);\n }\n blockStart = n + 1;\n }\n }\n }\n async getMetadata(opts = {}) {\n return this.index.getMetadata(opts);\n }\n /**\n * get a buffer containing the \"header\" region of\n * the file, which are the bytes up to the first\n * non-meta line\n */\n async getHeaderBuffer(opts = {}) {\n const { firstDataLine, metaChar, maxBlockSize } = await this.getMetadata(opts);\n checkAbortSignal(opts.signal);\n const maxFetch = ((firstDataLine === null || firstDataLine === void 0 ? void 0 : firstDataLine.blockPosition) || 0) + maxBlockSize;\n // TODO: what if we don't have a firstDataLine, and the header\n // actually takes up more than one block? this case is not covered here\n let bytes = await this._readRegion(0, maxFetch, opts);\n checkAbortSignal(opts.signal);\n try {\n bytes = await unzip(bytes);\n }\n catch (e) {\n console.error(e);\n throw new Error(\n //@ts-ignore\n `error decompressing block ${e.code} at 0 (length ${maxFetch}) ${e}`);\n }\n // trim off lines after the last non-meta line\n if (metaChar) {\n // trim backward from the end\n let lastNewline = -1;\n const newlineByte = '\\n'.charCodeAt(0);\n const metaByte = metaChar.charCodeAt(0);\n for (let i = 0; i < bytes.length; i += 1) {\n if (i === lastNewline + 1 && bytes[i] !== metaByte) {\n break;\n }\n if (bytes[i] === newlineByte) {\n lastNewline = i;\n }\n }\n bytes = bytes.slice(0, lastNewline + 1);\n }\n return bytes;\n }\n /**\n * get a string containing the \"header\" region of the\n * file, is the portion up to the first non-meta line\n *\n * @returns {Promise} for a string\n */\n async getHeader(opts = {}) {\n const bytes = await this.getHeaderBuffer(opts);\n return bytes.toString('utf8');\n }\n /**\n * get an array of reference sequence names, in the order in which\n * they occur in the file. reference sequence renaming is not applied\n * to these names.\n */\n async getReferenceSequenceNames(opts = {}) {\n const metadata = await this.getMetadata(opts);\n return metadata.refIdToName;\n }\n /**\n * @param {object} metadata metadata object from the parsed index,\n * containing columnNumbers, metaChar, and format\n * @param {string} regionRefName\n * @param {number} regionStart region start coordinate (0-based-half-open)\n * @param {number} regionEnd region end coordinate (0-based-half-open)\n * @param {array[string]} line\n * @returns {object} like `{startCoordinate, overlaps}`. overlaps is boolean,\n * true if line is a data line that overlaps the given region\n */\n checkLine(metadata, regionRefName, regionStart, regionEnd, line) {\n const { columnNumbers, metaChar, coordinateType, format } = metadata;\n // skip meta lines\n if (line.charAt(0) === metaChar) {\n return { overlaps: false };\n }\n // check ref/start/end using column metadata from index\n let { ref, start, end } = columnNumbers;\n if (!ref) {\n ref = 0;\n }\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = 0;\n }\n if (format === 'VCF') {\n end = 8;\n }\n const maxColumn = Math.max(ref, start, end);\n // this code is kind of complex, but it is fairly fast.\n // basically, we want to avoid doing a split, because if the lines are really long\n // that could lead to us allocating a bunch of extra memory, which is slow\n let currentColumnNumber = 1; // cols are numbered starting at 1 in the index metadata\n let currentColumnStart = 0;\n let refSeq = '';\n let startCoordinate = -Infinity;\n for (let i = 0; i < line.length + 1; i += 1) {\n if (line[i] === '\\t' || i === line.length) {\n if (currentColumnNumber === ref) {\n if (this.renameRefSeq(line.slice(currentColumnStart, i)) !==\n regionRefName) {\n return { overlaps: false };\n }\n }\n else if (currentColumnNumber === start) {\n startCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n // we convert to 0-based-half-open\n if (coordinateType === '1-based-closed') {\n startCoordinate -= 1;\n }\n if (startCoordinate >= regionEnd) {\n return { startCoordinate, overlaps: false };\n }\n if (end === 0 || end === start) {\n // if we have no end, we assume the feature is 1 bp long\n if (startCoordinate + 1 <= regionStart) {\n return { startCoordinate, overlaps: false };\n }\n }\n }\n else if (format === 'VCF' && currentColumnNumber === 4) {\n refSeq = line.slice(currentColumnStart, i);\n }\n else if (currentColumnNumber === end) {\n let endCoordinate;\n // this will never match if there is no end column\n if (format === 'VCF') {\n endCoordinate = this._getVcfEnd(startCoordinate, refSeq, line.slice(currentColumnStart, i));\n }\n else {\n endCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n }\n if (endCoordinate <= regionStart) {\n return { overlaps: false };\n }\n }\n currentColumnStart = i + 1;\n currentColumnNumber += 1;\n if (currentColumnNumber > maxColumn) {\n break;\n }\n }\n }\n return { startCoordinate, overlaps: true };\n }\n _getVcfEnd(startCoordinate, refSeq, info) {\n let endCoordinate = startCoordinate + refSeq.length;\n // ignore TRA features as they specify CHR2 and END\n // as being on a different chromosome\n // if CHR2 is on the same chromosome, still ignore it\n // because there should be another pairwise feature\n // at the end of this one\n const isTRA = info.indexOf('SVTYPE=TRA') !== -1;\n if (info[0] !== '.' && !isTRA) {\n let prevChar = ';';\n for (let j = 0; j < info.length; j += 1) {\n if (prevChar === ';' && info.slice(j, j + 4) === 'END=') {\n let valueEnd = info.indexOf(';', j);\n if (valueEnd === -1) {\n valueEnd = info.length;\n }\n endCoordinate = parseInt(info.slice(j + 4, valueEnd), 10);\n break;\n }\n prevChar = info[j];\n }\n }\n else if (isTRA) {\n return startCoordinate + 1;\n }\n return endCoordinate;\n }\n /**\n * return the approximate number of data lines in the given reference sequence\n * @param refSeq reference sequence name\n * @returns number of data lines present on that reference sequence\n */\n async lineCount(refName, opts = {}) {\n return this.index.lineCount(refName, opts);\n }\n async _readRegion(pos, size, opts = {}) {\n const b = Buffer.alloc(size);\n const { bytesRead, buffer } = await this.filehandle.read(b, 0, size, pos, opts);\n return buffer.slice(0, bytesRead);\n }\n /**\n * read and uncompress the data in a chunk (composed of one or more\n * contiguous bgzip blocks) of the file\n */\n async readChunk(c, opts = {}) {\n // fetch the uncompressed data, uncompress carefully a block at a time,\n // and stop when done\n const data = await this._readRegion(c.minv.blockPosition, c.fetchedSize(), opts);\n try {\n return unzipChunkSlice(data, c);\n }\n catch (e) {\n throw new Error(`error decompressing c ${c.toString()} ${e}`);\n }\n }\n}\n//# sourceMappingURL=tabixIndexedFile.js.map","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import toNumber from './toNumber.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nexport default toFinite;\n","import toFinite from './toFinite.js';\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nexport default toInteger;\n","import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nexport default copyArray;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n","import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n","import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nexport default isIterateeCall;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n","import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n","import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n","import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n","import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n","import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n","import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n","import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n","import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n","/**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\nfunction baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n}\n\nexport default baseClamp;\n","import arrayMap from './_arrayMap.js';\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nexport default baseValues;\n","import baseValues from './_baseValues.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n}\n\nexport default values;\n","/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeFloor = Math.floor,\n nativeRandom = Math.random;\n\n/**\n * The base implementation of `_.random` without support for returning\n * floating-point numbers.\n *\n * @private\n * @param {number} lower The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the random number.\n */\nfunction baseRandom(lower, upper) {\n return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n}\n\nexport default baseRandom;\n","import baseRandom from './_baseRandom.js';\n\n/**\n * A specialized version of `_.shuffle` which mutates and sets the size of `array`.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @param {number} [size=array.length] The size of `array`.\n * @returns {Array} Returns `array`.\n */\nfunction shuffleSelf(array, size) {\n var index = -1,\n length = array.length,\n lastIndex = length - 1;\n\n size = size === undefined ? length : size;\n while (++index < size) {\n var rand = baseRandom(index, lastIndex),\n value = array[rand];\n\n array[rand] = array[index];\n array[index] = value;\n }\n array.length = size;\n return array;\n}\n\nexport default shuffleSelf;\n","import baseClamp from './_baseClamp.js';\nimport copyArray from './_copyArray.js';\nimport shuffleSelf from './_shuffleSelf.js';\n\n/**\n * A specialized version of `_.sampleSize` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction arraySampleSize(array, n) {\n return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));\n}\n\nexport default arraySampleSize;\n","import baseClamp from './_baseClamp.js';\nimport shuffleSelf from './_shuffleSelf.js';\nimport values from './values.js';\n\n/**\n * The base implementation of `_.sampleSize` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction baseSampleSize(collection, n) {\n var array = values(collection);\n return shuffleSelf(array, baseClamp(n, 0, array.length));\n}\n\nexport default baseSampleSize;\n","import arraySampleSize from './_arraySampleSize.js';\nimport baseSampleSize from './_baseSampleSize.js';\nimport isArray from './isArray.js';\nimport isIterateeCall from './_isIterateeCall.js';\nimport toInteger from './toInteger.js';\n\n/**\n * Gets `n` random elements at unique keys from `collection` up to the\n * size of `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @param {number} [n=1] The number of elements to sample.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the random elements.\n * @example\n *\n * _.sampleSize([1, 2, 3], 2);\n * // => [3, 1]\n *\n * _.sampleSize([1, 2, 3], 4);\n * // => [2, 3, 1]\n */\nfunction sampleSize(collection, n, guard) {\n if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n var func = isArray(collection) ? arraySampleSize : baseSampleSize;\n return func(collection, n);\n}\n\nexport default sampleSize;\n","'use strict';\n\nmodule.exports = value => {\n\tif (!value) {\n\t\treturn false;\n\t}\n\n\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\tif (typeof Symbol.observable === 'symbol' && typeof value[Symbol.observable] === 'function') {\n\t\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\t\treturn value === value[Symbol.observable]();\n\t}\n\n\tif (typeof value['@@observable'] === 'function') {\n\t\treturn value === value['@@observable']();\n\t}\n\n\treturn false;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultSerializer = exports.extendSerializer = void 0;\nfunction extendSerializer(extend, implementation) {\n const fallbackDeserializer = extend.deserialize.bind(extend);\n const fallbackSerializer = extend.serialize.bind(extend);\n return {\n deserialize(message) {\n return implementation.deserialize(message, fallbackDeserializer);\n },\n serialize(input) {\n return implementation.serialize(input, fallbackSerializer);\n }\n };\n}\nexports.extendSerializer = extendSerializer;\nconst DefaultErrorSerializer = {\n deserialize(message) {\n return Object.assign(Error(message.message), {\n name: message.name,\n stack: message.stack\n });\n },\n serialize(error) {\n return {\n __error_marker: \"$$error\",\n message: error.message,\n name: error.name,\n stack: error.stack\n };\n }\n};\nconst isSerializedError = (thing) => thing && typeof thing === \"object\" && \"__error_marker\" in thing && thing.__error_marker === \"$$error\";\nexports.DefaultSerializer = {\n deserialize(message) {\n if (isSerializedError(message)) {\n return DefaultErrorSerializer.deserialize(message);\n }\n else {\n return message;\n }\n },\n serialize(input) {\n if (input instanceof Error) {\n return DefaultErrorSerializer.serialize(input);\n }\n else {\n return input;\n }\n }\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.serialize = exports.deserialize = exports.registerSerializer = void 0;\nconst serializers_1 = require(\"./serializers\");\nlet registeredSerializer = serializers_1.DefaultSerializer;\nfunction registerSerializer(serializer) {\n registeredSerializer = serializers_1.extendSerializer(registeredSerializer, serializer);\n}\nexports.registerSerializer = registerSerializer;\nfunction deserialize(message) {\n return registeredSerializer.deserialize(message);\n}\nexports.deserialize = deserialize;\nfunction serialize(input) {\n return registeredSerializer.serialize(input);\n}\nexports.serialize = serialize;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.$worker = exports.$transferable = exports.$terminate = exports.$events = exports.$errors = void 0;\nexports.$errors = Symbol(\"thread.errors\");\nexports.$events = Symbol(\"thread.events\");\nexports.$terminate = Symbol(\"thread.terminate\");\nexports.$transferable = Symbol(\"thread.transferable\");\nexports.$worker = Symbol(\"thread.worker\");\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Transfer = exports.isTransferDescriptor = void 0;\nconst symbols_1 = require(\"./symbols\");\nfunction isTransferable(thing) {\n if (!thing || typeof thing !== \"object\")\n return false;\n // Don't check too thoroughly, since the list of transferable things in JS might grow over time\n return true;\n}\nfunction isTransferDescriptor(thing) {\n return thing && typeof thing === \"object\" && thing[symbols_1.$transferable];\n}\nexports.isTransferDescriptor = isTransferDescriptor;\nfunction Transfer(payload, transferables) {\n if (!transferables) {\n if (!isTransferable(payload))\n throw Error();\n transferables = [payload];\n }\n return {\n [symbols_1.$transferable]: true,\n send: payload,\n transferables\n };\n}\nexports.Transfer = Transfer;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WorkerMessageType = exports.MasterMessageType = void 0;\n/////////////////////////////\n// Messages sent by master:\nvar MasterMessageType;\n(function (MasterMessageType) {\n MasterMessageType[\"cancel\"] = \"cancel\";\n MasterMessageType[\"run\"] = \"run\";\n})(MasterMessageType = exports.MasterMessageType || (exports.MasterMessageType = {}));\n////////////////////////////\n// Messages sent by worker:\nvar WorkerMessageType;\n(function (WorkerMessageType) {\n WorkerMessageType[\"error\"] = \"error\";\n WorkerMessageType[\"init\"] = \"init\";\n WorkerMessageType[\"result\"] = \"result\";\n WorkerMessageType[\"running\"] = \"running\";\n WorkerMessageType[\"uncaughtError\"] = \"uncaughtError\";\n})(WorkerMessageType = exports.WorkerMessageType || (exports.WorkerMessageType = {}));\n","\"use strict\";\n/// \n// tslint:disable no-shadowed-variable\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst isWorkerRuntime = function isWorkerRuntime() {\n const isWindowContext = typeof self !== \"undefined\" && typeof Window !== \"undefined\" && self instanceof Window;\n return typeof self !== \"undefined\" && self.postMessage && !isWindowContext ? true : false;\n};\nconst postMessageToMaster = function postMessageToMaster(data, transferList) {\n self.postMessage(data, transferList);\n};\nconst subscribeToMasterMessages = function subscribeToMasterMessages(onMessage) {\n const messageHandler = (messageEvent) => {\n onMessage(messageEvent.data);\n };\n const unsubscribe = () => {\n self.removeEventListener(\"message\", messageHandler);\n };\n self.addEventListener(\"message\", messageHandler);\n return unsubscribe;\n};\nexports.default = {\n isWorkerRuntime,\n postMessageToMaster,\n subscribeToMasterMessages\n};\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.expose = exports.isWorkerRuntime = exports.Transfer = exports.registerSerializer = void 0;\nconst is_observable_1 = __importDefault(require(\"is-observable\"));\nconst common_1 = require(\"../common\");\nconst transferable_1 = require(\"../transferable\");\nconst messages_1 = require(\"../types/messages\");\nconst implementation_1 = __importDefault(require(\"./implementation\"));\nvar common_2 = require(\"../common\");\nObject.defineProperty(exports, \"registerSerializer\", { enumerable: true, get: function () { return common_2.registerSerializer; } });\nvar transferable_2 = require(\"../transferable\");\nObject.defineProperty(exports, \"Transfer\", { enumerable: true, get: function () { return transferable_2.Transfer; } });\n/** Returns `true` if this code is currently running in a worker. */\nexports.isWorkerRuntime = implementation_1.default.isWorkerRuntime;\nlet exposeCalled = false;\nconst activeSubscriptions = new Map();\nconst isMasterJobCancelMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.cancel;\nconst isMasterJobRunMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.run;\n/**\n * There are issues with `is-observable` not recognizing zen-observable's instances.\n * We are using `observable-fns`, but it's based on zen-observable, too.\n */\nconst isObservable = (thing) => is_observable_1.default(thing) || isZenObservable(thing);\nfunction isZenObservable(thing) {\n return thing && typeof thing === \"object\" && typeof thing.subscribe === \"function\";\n}\nfunction deconstructTransfer(thing) {\n return transferable_1.isTransferDescriptor(thing)\n ? { payload: thing.send, transferables: thing.transferables }\n : { payload: thing, transferables: undefined };\n}\nfunction postFunctionInitMessage() {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"function\"\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postModuleInitMessage(methodNames) {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"module\",\n methods: methodNames\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postJobErrorMessage(uid, rawError) {\n const { payload: error, transferables } = deconstructTransfer(rawError);\n const errorMessage = {\n type: messages_1.WorkerMessageType.error,\n uid,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage, transferables);\n}\nfunction postJobResultMessage(uid, completed, resultValue) {\n const { payload, transferables } = deconstructTransfer(resultValue);\n const resultMessage = {\n type: messages_1.WorkerMessageType.result,\n uid,\n complete: completed ? true : undefined,\n payload\n };\n implementation_1.default.postMessageToMaster(resultMessage, transferables);\n}\nfunction postJobStartMessage(uid, resultType) {\n const startMessage = {\n type: messages_1.WorkerMessageType.running,\n uid,\n resultType\n };\n implementation_1.default.postMessageToMaster(startMessage);\n}\nfunction postUncaughtErrorMessage(error) {\n try {\n const errorMessage = {\n type: messages_1.WorkerMessageType.uncaughtError,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage);\n }\n catch (subError) {\n // tslint:disable-next-line no-console\n console.error(\"Not reporting uncaught error back to master thread as it \" +\n \"occured while reporting an uncaught error already.\" +\n \"\\nLatest error:\", subError, \"\\nOriginal error:\", error);\n }\n}\nfunction runFunction(jobUID, fn, args) {\n return __awaiter(this, void 0, void 0, function* () {\n let syncResult;\n try {\n syncResult = fn(...args);\n }\n catch (error) {\n return postJobErrorMessage(jobUID, error);\n }\n const resultType = isObservable(syncResult) ? \"observable\" : \"promise\";\n postJobStartMessage(jobUID, resultType);\n if (isObservable(syncResult)) {\n const subscription = syncResult.subscribe(value => postJobResultMessage(jobUID, false, common_1.serialize(value)), error => {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n activeSubscriptions.delete(jobUID);\n }, () => {\n postJobResultMessage(jobUID, true);\n activeSubscriptions.delete(jobUID);\n });\n activeSubscriptions.set(jobUID, subscription);\n }\n else {\n try {\n const result = yield syncResult;\n postJobResultMessage(jobUID, true, common_1.serialize(result));\n }\n catch (error) {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n }\n }\n });\n}\n/**\n * Expose a function or a module (an object whose values are functions)\n * to the main thread. Must be called exactly once in every worker thread\n * to signal its API to the main thread.\n *\n * @param exposed Function or object whose values are functions\n */\nfunction expose(exposed) {\n if (!implementation_1.default.isWorkerRuntime()) {\n throw Error(\"expose() called in the master thread.\");\n }\n if (exposeCalled) {\n throw Error(\"expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.\");\n }\n exposeCalled = true;\n if (typeof exposed === \"function\") {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && !messageData.method) {\n runFunction(messageData.uid, exposed, messageData.args.map(common_1.deserialize));\n }\n });\n postFunctionInitMessage();\n }\n else if (typeof exposed === \"object\" && exposed) {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && messageData.method) {\n runFunction(messageData.uid, exposed[messageData.method], messageData.args.map(common_1.deserialize));\n }\n });\n const methodNames = Object.keys(exposed).filter(key => typeof exposed[key] === \"function\");\n postModuleInitMessage(methodNames);\n }\n else {\n throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${exposed}`);\n }\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobCancelMessage(messageData)) {\n const jobUID = messageData.uid;\n const subscription = activeSubscriptions.get(jobUID);\n if (subscription) {\n subscription.unsubscribe();\n activeSubscriptions.delete(jobUID);\n }\n }\n });\n}\nexports.expose = expose;\nif (typeof self !== \"undefined\" && typeof self.addEventListener === \"function\" && implementation_1.default.isWorkerRuntime()) {\n self.addEventListener(\"error\", event => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(event.error || event), 250);\n });\n self.addEventListener(\"unhandledrejection\", event => {\n const error = event.reason;\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\nif (typeof process !== \"undefined\" && typeof process.on === \"function\" && implementation_1.default.isWorkerRuntime()) {\n process.on(\"uncaughtException\", (error) => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n });\n process.on(\"unhandledRejection\", (error) => {\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\n","import WorkerContext from \"./dist/worker/index.js\"\n\nexport const expose = WorkerContext.expose\nexport const registerSerializer = WorkerContext.registerSerializer\nexport const Transfer = WorkerContext.Transfer\n","export default function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import ascending from \"./ascending.js\";\n\nexport default function(f) {\n let delta = f;\n let compare = f;\n\n if (f.length === 1) {\n delta = (d, x) => f(d) - x;\n compare = ascendingComparator(f);\n }\n\n function left(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function right(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n\n function center(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction ascendingComparator(f) {\n return (d, x) => ascending(f(d), x);\n}\n","import { bisector } from 'd3-array';\nimport { RemoteFile as _RemoteFile } from 'generic-filehandle';\n\nimport type * as HiGlass from '@higlass/types';\nimport type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema';\n\nexport type CommonDataConfig = {\n assembly: Assembly;\n x?: string;\n xe?: string;\n x1?: string;\n x1e?: string;\n urlFetchOptions?: RequestInit;\n};\n\nexport class DataSource {\n chromInfo: ExtendedChromInfo;\n tilesetInfo: ReturnType;\n\n constructor(public file: File, chromSizes: ChromSizes, public options: Options) {\n this.chromInfo = sizesToChromInfo(chromSizes);\n this.tilesetInfo = tilesetInfoFromChromInfo(this.chromInfo);\n }\n}\n\n/**\n * Filter data before sending to a track considering the visible genomic area in the track.\n * TODO(2022-Jul-13): Consider genomic `y` channels as well.\n */\nexport function filterUsingGenoPos(\n data: Datum[],\n [minX, maxX]: [number, number],\n config: Omit\n) {\n const { x, xe, x1, x1e } = config;\n const definedXFields = [x, xe, x1, x1e].filter(f => f) as string[];\n return data.filter((d: Datum) => {\n if (definedXFields.length === 0) {\n // no filter applies\n return true;\n } else if (definedXFields.length === 1) {\n // filter based on one genomic position\n const value = +d[definedXFields[0]];\n return typeof value === 'number' && minX < value && value <= maxX;\n } else {\n // filter based on two genomic positions, i.e., check overlaps\n const values = definedXFields.map(f => +d[f]).filter(v => !isNaN(v));\n const minValue = Math.min(...values);\n const maxValue = Math.max(...values);\n return minX <= maxValue && minValue <= maxX;\n }\n });\n}\n\nconst chromInfoBisector = bisector((d: { pos: number }) => d.pos).left;\n\nconst chrToAbs = (chrom: string, chromPos: number, chromInfo: HiGlass.ChromInfo) =>\n chromInfo.chrPositions[chrom].pos + chromPos;\n\nconst absToChr = (absPosition: number, chromInfo: HiGlass.ChromInfo) => {\n if (!chromInfo || !chromInfo.cumPositions || !chromInfo.cumPositions.length) {\n return null;\n }\n\n let insertPoint = chromInfoBisector(chromInfo.cumPositions, absPosition);\n const lastChr = chromInfo.cumPositions[chromInfo.cumPositions.length - 1].chr;\n const lastLength = chromInfo.chromLengths[lastChr];\n\n // @ts-expect-error\n insertPoint -= insertPoint > 0 && 1;\n\n let chrPosition = Math.floor(absPosition - chromInfo.cumPositions[insertPoint].pos);\n let offset = 0;\n\n if (chrPosition < 0) {\n // before the start of the genome\n offset = chrPosition - 1;\n chrPosition = 1;\n }\n\n if (insertPoint === chromInfo.cumPositions.length - 1 && chrPosition > lastLength) {\n // beyond the last chromosome\n offset = chrPosition - lastLength;\n chrPosition = lastLength;\n }\n\n return [chromInfo.cumPositions[insertPoint].chr, chrPosition, offset, insertPoint] as const;\n};\n\n/**\n * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`.\n * @param chrName A chromosome name to be sanitized\n * @param assembly A genome assembly of the data\n * @param chromosomePrefix A prefix string that can be replaced to 'chr'\n * @returns\n */\nexport function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string) {\n if (Array.isArray(assembly)) {\n // this is a custom assembly, so use this as is\n return chrName;\n }\n\n // For assemblies in Gosling, we use the `chr` prefix consistently\n if (chromosomePrefix) {\n // `hs1` --> `chr1`\n chrName = chrName.replace(chromosomePrefix, 'chr');\n } else if (!chrName.includes('chr')) {\n // `1` --> `chr1`\n chrName = `chr${chrName}`;\n }\n return chrName;\n}\n\nexport type ExtendedChromInfo = HiGlass.ChromInfo & {\n absToChr(absPos: number): ReturnType | null;\n chrToAbs(chr: [name: string, pos: number]): number | null;\n};\n\nexport function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize = 1024) {\n return {\n tile_size: tileSize,\n bins_per_dimension: tileSize,\n max_zoom: Math.ceil(Math.log(chromInfo.totalLength / tileSize) / Math.log(2)),\n max_width: chromInfo.totalLength,\n min_pos: [0],\n max_pos: [chromInfo.totalLength]\n };\n}\n\nexport function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo {\n const info: HiGlass.ChromInfo = {\n cumPositions: [],\n chromLengths: {},\n chrPositions: {},\n totalLength: 0\n };\n\n sizes.forEach(([chr, length], i) => {\n const chrPosition = { id: i, chr, pos: info.totalLength };\n info.chrPositions[chr] = chrPosition;\n info.chromLengths[chr] = length;\n info.cumPositions.push(chrPosition);\n info.totalLength += length;\n });\n\n return {\n ...info,\n absToChr: absPos => (info.chrPositions ? absToChr(absPos, info) : null),\n chrToAbs: ([chrName, chrPos]) => (info.chrPositions ? chrToAbs(chrName, chrPos, info) : null)\n };\n}\n\nexport class RemoteFile extends _RemoteFile {\n // Overrides `read` to eagerly read 200 or 206 response\n // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162\n public read: _RemoteFile['read'] = async (\n buffer,\n offset = 0,\n length,\n position = 0,\n opts = {}\n ): Promise<{ bytesRead: number; buffer: Buffer }> => {\n const { headers = {}, signal, overrides = {} } = opts;\n\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n } else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n // @ts-expect-error private property\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n // @ts-expect-error private property\n ...this.baseOverrides.headers\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal\n };\n const response = await this.fetch(this.url, args);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n\n // Just read the response if it was successful.\n if (response.status === 200 || response.status === 206) {\n // @ts-expect-error private method\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n // @ts-expect-error private property\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n\n return { bytesRead: bytesCopied, buffer };\n }\n\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n };\n}\n\nexport interface TabularDataFetcher {\n getTabularData(tileIds: string[]): Promise;\n MAX_TILE_WIDTH?: number;\n}\n","/*\n * Generated by PEG.js 0.10.0.\n *\n * http://pegjs.org/\n */\n\"use strict\";\nfunction peg$subclass(child, parent) {\n function ctor() { this.constructor = child; }\n ctor.prototype = parent.prototype;\n child.prototype = new ctor();\n}\nfunction peg$SyntaxError(message, expected, found, location) {\n this.message = message;\n this.expected = expected;\n this.found = found;\n this.location = location;\n this.name = \"SyntaxError\";\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, peg$SyntaxError);\n }\n}\npeg$subclass(peg$SyntaxError, Error);\npeg$SyntaxError.buildMessage = function (expected, found) {\n var DESCRIBE_EXPECTATION_FNS = {\n literal: function (expectation) {\n return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";\n },\n \"class\": function (expectation) {\n var escapedParts = \"\", i;\n for (i = 0; i < expectation.parts.length; i++) {\n escapedParts += expectation.parts[i] instanceof Array\n ? classEscape(expectation.parts[i][0]) + \"-\" + classEscape(expectation.parts[i][1])\n : classEscape(expectation.parts[i]);\n }\n return \"[\" + (expectation.inverted ? \"^\" : \"\") + escapedParts + \"]\";\n },\n any: function (expectation) {\n return \"any character\";\n },\n end: function (expectation) {\n return \"end of input\";\n },\n other: function (expectation) {\n return expectation.description;\n }\n };\n function hex(ch) {\n return ch.charCodeAt(0).toString(16).toUpperCase();\n }\n function literalEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function (ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function (ch) { return '\\\\x' + hex(ch); });\n }\n function classEscape(s) {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\^/g, '\\\\^')\n .replace(/-/g, '\\\\-')\n .replace(/\\0/g, '\\\\0')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/[\\x00-\\x0F]/g, function (ch) { return '\\\\x0' + hex(ch); })\n .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function (ch) { return '\\\\x' + hex(ch); });\n }\n function describeExpectation(expectation) {\n return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);\n }\n function describeExpected(expected) {\n var descriptions = new Array(expected.length), i, j;\n for (i = 0; i < expected.length; i++) {\n descriptions[i] = describeExpectation(expected[i]);\n }\n descriptions.sort();\n if (descriptions.length > 0) {\n for (i = 1, j = 1; i < descriptions.length; i++) {\n if (descriptions[i - 1] !== descriptions[i]) {\n descriptions[j] = descriptions[i];\n j++;\n }\n }\n descriptions.length = j;\n }\n switch (descriptions.length) {\n case 1:\n return descriptions[0];\n case 2:\n return descriptions[0] + \" or \" + descriptions[1];\n default:\n return descriptions.slice(0, -1).join(\", \")\n + \", or \"\n + descriptions[descriptions.length - 1];\n }\n }\n function describeFound(found) {\n return found ? \"\\\"\" + literalEscape(found) + \"\\\"\" : \"end of input\";\n }\n return \"Expected \" + describeExpected(expected) + \" but \" + describeFound(found) + \" found.\";\n};\nfunction peg$parse(input, options) {\n options = options !== void 0 ? options : {};\n var peg$FAILED = {}, peg$startRuleFunctions = { declaration: peg$parsedeclaration }, peg$startRuleFunction = peg$parsedeclaration, peg$c0 = \"(\", peg$c1 = peg$literalExpectation(\"(\", false), peg$c2 = \")\", peg$c3 = peg$literalExpectation(\")\", false), peg$c4 = function (type, name, comment, fields) { return { type, name, comment, fields }; }, peg$c5 = \"simple\", peg$c6 = peg$literalExpectation(\"simple\", false), peg$c7 = \"object\", peg$c8 = peg$literalExpectation(\"object\", false), peg$c9 = \"table\", peg$c10 = peg$literalExpectation(\"table\", false), peg$c11 = \"auto\", peg$c12 = peg$literalExpectation(\"auto\", false), peg$c13 = \"primary\", peg$c14 = peg$literalExpectation(\"primary\", false), peg$c15 = \"index\", peg$c16 = peg$literalExpectation(\"index\", false), peg$c17 = \"unique\", peg$c18 = peg$literalExpectation(\"unique\", false), peg$c19 = function (f1, w) { return w; }, peg$c20 = function (f1, fds) {\n if (f1.name) {\n fds.unshift(f1);\n }\n return fds;\n }, peg$c21 = \"#\", peg$c22 = peg$literalExpectation(\"#\", false), peg$c23 = \";\", peg$c24 = peg$literalExpectation(\";\", false), peg$c25 = function (type, name, comment) { return { type, name, comment }; }, peg$c26 = \"[\", peg$c27 = peg$literalExpectation(\"[\", false), peg$c28 = \"]\", peg$c29 = peg$literalExpectation(\"]\", false), peg$c30 = function (type, size, name, comment) { return { type, size, name, comment }; }, peg$c31 = function (type, vals, name, comment) { return { type, vals, name, comment }; }, peg$c32 = \",\", peg$c33 = peg$literalExpectation(\",\", false), peg$c34 = function (f1, fds) {\n fds.unshift(f1);\n return fds;\n }, peg$c35 = \"int\", peg$c36 = peg$literalExpectation(\"int\", false), peg$c37 = \"uint\", peg$c38 = peg$literalExpectation(\"uint\", false), peg$c39 = \"short\", peg$c40 = peg$literalExpectation(\"short\", false), peg$c41 = \"ushort\", peg$c42 = peg$literalExpectation(\"ushort\", false), peg$c43 = \"byte\", peg$c44 = peg$literalExpectation(\"byte\", false), peg$c45 = \"ubyte\", peg$c46 = peg$literalExpectation(\"ubyte\", false), peg$c47 = \"float\", peg$c48 = peg$literalExpectation(\"float\", false), peg$c49 = \"char\", peg$c50 = peg$literalExpectation(\"char\", false), peg$c51 = \"string\", peg$c52 = peg$literalExpectation(\"string\", false), peg$c53 = \"lstring\", peg$c54 = peg$literalExpectation(\"lstring\", false), peg$c55 = \"enum\", peg$c56 = peg$literalExpectation(\"enum\", false), peg$c57 = \"double\", peg$c58 = peg$literalExpectation(\"double\", false), peg$c59 = \"bigint\", peg$c60 = peg$literalExpectation(\"bigint\", false), peg$c61 = \"set\", peg$c62 = peg$literalExpectation(\"set\", false), peg$c63 = function (t, n) { return t + ' ' + n; }, peg$c64 = /^[a-zA-Z_]/, peg$c65 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"], \"_\"], false, false), peg$c66 = /^[a-zA-Z0-9_]/, peg$c67 = peg$classExpectation([[\"a\", \"z\"], [\"A\", \"Z\"], [\"0\", \"9\"], \"_\"], false, false), peg$c68 = function (t) { return text(); }, peg$c69 = \"\\\"\", peg$c70 = peg$literalExpectation(\"\\\"\", false), peg$c71 = /^[^\"]/, peg$c72 = peg$classExpectation([\"\\\"\"], true, false), peg$c73 = function (t) { return t.join(''); }, peg$c74 = /^[^\\n\\r]/, peg$c75 = peg$classExpectation([\"\\n\", \"\\r\"], true, false), peg$c76 = function (t) { return t.join('').replace(/^\"/, '').replace(/\"$/, ''); }, peg$c77 = peg$otherExpectation(\"integer\"), peg$c78 = /^[0-9]/, peg$c79 = peg$classExpectation([[\"0\", \"9\"]], false, false), peg$c80 = function () { return parseInt(text(), 10); }, peg$c81 = peg$otherExpectation(\"whitespace\"), peg$c82 = /^[ \\t\\n\\r]/, peg$c83 = peg$classExpectation([\" \", \"\\t\", \"\\n\", \"\\r\"], false, false), peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result;\n if (\"startRule\" in options) {\n if (!(options.startRule in peg$startRuleFunctions)) {\n throw new Error(\"Can't start parsing from rule \\\"\" + options.startRule + \"\\\".\");\n }\n peg$startRuleFunction = peg$startRuleFunctions[options.startRule];\n }\n function text() {\n return input.substring(peg$savedPos, peg$currPos);\n }\n function location() {\n return peg$computeLocation(peg$savedPos, peg$currPos);\n }\n function expected(description, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);\n throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);\n }\n function error(message, location) {\n location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);\n throw peg$buildSimpleError(message, location);\n }\n function peg$literalExpectation(text, ignoreCase) {\n return { type: \"literal\", text: text, ignoreCase: ignoreCase };\n }\n function peg$classExpectation(parts, inverted, ignoreCase) {\n return { type: \"class\", parts: parts, inverted: inverted, ignoreCase: ignoreCase };\n }\n function peg$anyExpectation() {\n return { type: \"any\" };\n }\n function peg$endExpectation() {\n return { type: \"end\" };\n }\n function peg$otherExpectation(description) {\n return { type: \"other\", description: description };\n }\n function peg$computePosDetails(pos) {\n var details = peg$posDetailsCache[pos], p;\n if (details) {\n return details;\n }\n else {\n p = pos - 1;\n while (!peg$posDetailsCache[p]) {\n p--;\n }\n details = peg$posDetailsCache[p];\n details = {\n line: details.line,\n column: details.column\n };\n while (p < pos) {\n if (input.charCodeAt(p) === 10) {\n details.line++;\n details.column = 1;\n }\n else {\n details.column++;\n }\n p++;\n }\n peg$posDetailsCache[pos] = details;\n return details;\n }\n }\n function peg$computeLocation(startPos, endPos) {\n var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos);\n return {\n start: {\n offset: startPos,\n line: startPosDetails.line,\n column: startPosDetails.column\n },\n end: {\n offset: endPos,\n line: endPosDetails.line,\n column: endPosDetails.column\n }\n };\n }\n function peg$fail(expected) {\n if (peg$currPos < peg$maxFailPos) {\n return;\n }\n if (peg$currPos > peg$maxFailPos) {\n peg$maxFailPos = peg$currPos;\n peg$maxFailExpected = [];\n }\n peg$maxFailExpected.push(expected);\n }\n function peg$buildSimpleError(message, location) {\n return new peg$SyntaxError(message, null, null, location);\n }\n function peg$buildStructuredError(expected, found, location) {\n return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);\n }\n function peg$parsedeclaration() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsedeclareType();\n if (s2 !== peg$FAILED) {\n s3 = peg$parse_();\n if (s3 !== peg$FAILED) {\n s4 = peg$parsedeclareName();\n if (s4 !== peg$FAILED) {\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsecomment();\n if (s6 !== peg$FAILED) {\n s7 = peg$parse_();\n if (s7 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 40) {\n s8 = peg$c0;\n peg$currPos++;\n }\n else {\n s8 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c1);\n }\n }\n if (s8 !== peg$FAILED) {\n s9 = peg$parse_();\n if (s9 !== peg$FAILED) {\n s10 = peg$parsefieldList();\n if (s10 !== peg$FAILED) {\n s11 = peg$parse_();\n if (s11 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s12 = peg$c2;\n peg$currPos++;\n }\n else {\n s12 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c3);\n }\n }\n if (s12 !== peg$FAILED) {\n s13 = peg$parse_();\n if (s13 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c4(s2, s4, s6, s10);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsedeclareType() {\n var s0;\n if (input.substr(peg$currPos, 6) === peg$c5) {\n s0 = peg$c5;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c6);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c7) {\n s0 = peg$c7;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c8);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c9) {\n s0 = peg$c9;\n peg$currPos += 5;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c10);\n }\n }\n }\n }\n return s0;\n }\n function peg$parsedeclareName() {\n var s0, s1, s2, s3;\n s0 = peg$parsename();\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsename();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseindexType();\n if (s2 !== peg$FAILED) {\n s1 = [s1, s2];\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsename();\n if (s1 !== peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c11) {\n s2 = peg$c11;\n peg$currPos += 4;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c12);\n }\n }\n if (s2 !== peg$FAILED) {\n s1 = [s1, s2];\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsename();\n if (s1 !== peg$FAILED) {\n s2 = peg$parseindexType();\n if (s2 !== peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c11) {\n s3 = peg$c11;\n peg$currPos += 4;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c12);\n }\n }\n if (s3 !== peg$FAILED) {\n s1 = [s1, s2, s3];\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n }\n return s0;\n }\n function peg$parseindexType() {\n var s0;\n if (input.substr(peg$currPos, 7) === peg$c13) {\n s0 = peg$c13;\n peg$currPos += 7;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c14);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c15) {\n s0 = peg$c15;\n peg$currPos += 5;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c16);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c17) {\n s0 = peg$c17;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c18);\n }\n }\n }\n }\n return s0;\n }\n function peg$parsecomment() {\n var s0;\n s0 = peg$parsenonQuotedString();\n if (s0 === peg$FAILED) {\n s0 = peg$parse_();\n }\n return s0;\n }\n function peg$parsefieldList() {\n var s0, s1, s2, s3, s4, s5, s6;\n s0 = peg$currPos;\n s1 = peg$parsefield();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = [];\n s4 = peg$currPos;\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsefield();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c19(s1, s6);\n s4 = s5;\n }\n else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n s4 = peg$currPos;\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsefield();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s4;\n s5 = peg$c19(s1, s6);\n s4 = s5;\n }\n else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s4;\n s4 = peg$FAILED;\n }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c20(s1, s3);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsecommentStart() {\n var s0;\n if (input.charCodeAt(peg$currPos) === 35) {\n s0 = peg$c21;\n peg$currPos++;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c22);\n }\n }\n return s0;\n }\n function peg$parseinternalComment() {\n var s0, s1, s2, s3, s4;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = peg$parsecommentStart();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsenonQuotedString();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s1 = [s1, s2, s3, s4];\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsefield() {\n var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;\n s0 = peg$currPos;\n s1 = peg$parsefieldType();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsename();\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s5 = peg$c23;\n peg$currPos++;\n }\n else {\n s5 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c24);\n }\n }\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n s7 = peg$parsecomment();\n if (s7 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c25(s1, s3, s7);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsefieldType();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 91) {\n s3 = peg$c26;\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c27);\n }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsefieldSize();\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 93) {\n s7 = peg$c28;\n peg$currPos++;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c29);\n }\n }\n if (s7 !== peg$FAILED) {\n s8 = peg$parse_();\n if (s8 !== peg$FAILED) {\n s9 = peg$parsename();\n if (s9 !== peg$FAILED) {\n s10 = peg$parse_();\n if (s10 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s11 = peg$c23;\n peg$currPos++;\n }\n else {\n s11 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c24);\n }\n }\n if (s11 !== peg$FAILED) {\n s12 = peg$parse_();\n if (s12 !== peg$FAILED) {\n s13 = peg$parsecomment();\n if (s13 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c30(s1, s5, s9, s13);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsefieldType();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 40) {\n s3 = peg$c0;\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c1);\n }\n }\n if (s3 !== peg$FAILED) {\n s4 = peg$parse_();\n if (s4 !== peg$FAILED) {\n s5 = peg$parsefieldValues();\n if (s5 !== peg$FAILED) {\n s6 = peg$parse_();\n if (s6 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 41) {\n s7 = peg$c2;\n peg$currPos++;\n }\n else {\n s7 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c3);\n }\n }\n if (s7 !== peg$FAILED) {\n s8 = peg$parse_();\n if (s8 !== peg$FAILED) {\n s9 = peg$parsename();\n if (s9 !== peg$FAILED) {\n s10 = peg$parse_();\n if (s10 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 59) {\n s11 = peg$c23;\n peg$currPos++;\n }\n else {\n s11 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c24);\n }\n }\n if (s11 !== peg$FAILED) {\n s12 = peg$parse_();\n if (s12 !== peg$FAILED) {\n s13 = peg$parsecomment();\n if (s13 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c31(s1, s5, s9, s13);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n if (s0 === peg$FAILED) {\n s0 = peg$parseinternalComment();\n }\n }\n }\n return s0;\n }\n function peg$parsefieldValues() {\n var s0, s1, s2, s3, s4, s5, s6;\n s0 = peg$currPos;\n s1 = peg$parsename();\n if (s1 !== peg$FAILED) {\n s2 = [];\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 44) {\n s4 = peg$c32;\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c33);\n }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsename();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c19(s1, s6);\n s3 = s4;\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n s3 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 44) {\n s4 = peg$c32;\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c33);\n }\n }\n if (s4 !== peg$FAILED) {\n s5 = peg$parse_();\n if (s5 !== peg$FAILED) {\n s6 = peg$parsename();\n if (s6 !== peg$FAILED) {\n peg$savedPos = s3;\n s4 = peg$c19(s1, s6);\n s3 = s4;\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s3;\n s3 = peg$FAILED;\n }\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c34(s1, s2);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsefieldType() {\n var s0, s1, s2, s3;\n if (input.substr(peg$currPos, 3) === peg$c35) {\n s0 = peg$c35;\n peg$currPos += 3;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c36);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c37) {\n s0 = peg$c37;\n peg$currPos += 4;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c38);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c39) {\n s0 = peg$c39;\n peg$currPos += 5;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c40);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c41) {\n s0 = peg$c41;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c42);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c43) {\n s0 = peg$c43;\n peg$currPos += 4;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c44);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c45) {\n s0 = peg$c45;\n peg$currPos += 5;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c46);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 5) === peg$c47) {\n s0 = peg$c47;\n peg$currPos += 5;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c48);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c49) {\n s0 = peg$c49;\n peg$currPos += 4;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c50);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c51) {\n s0 = peg$c51;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c52);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 7) === peg$c53) {\n s0 = peg$c53;\n peg$currPos += 7;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c54);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 4) === peg$c55) {\n s0 = peg$c55;\n peg$currPos += 4;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c56);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c57) {\n s0 = peg$c57;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c58);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 6) === peg$c59) {\n s0 = peg$c59;\n peg$currPos += 6;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c60);\n }\n }\n if (s0 === peg$FAILED) {\n if (input.substr(peg$currPos, 3) === peg$c61) {\n s0 = peg$c61;\n peg$currPos += 3;\n }\n else {\n s0 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c62);\n }\n }\n if (s0 === peg$FAILED) {\n s0 = peg$currPos;\n s1 = peg$parsedeclareType();\n if (s1 !== peg$FAILED) {\n s2 = peg$parse_();\n if (s2 !== peg$FAILED) {\n s3 = peg$parsedeclareName();\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c63(s1, s3);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return s0;\n }\n function peg$parsefieldSize() {\n var s0;\n s0 = peg$parsenumber();\n if (s0 === peg$FAILED) {\n s0 = peg$parsename();\n }\n return s0;\n }\n function peg$parsename() {\n var s0, s1, s2, s3, s4;\n s0 = peg$currPos;\n s1 = peg$currPos;\n if (peg$c64.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c65);\n }\n }\n if (s2 !== peg$FAILED) {\n s3 = [];\n if (peg$c66.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c67);\n }\n }\n while (s4 !== peg$FAILED) {\n s3.push(s4);\n if (peg$c66.test(input.charAt(peg$currPos))) {\n s4 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s4 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c67);\n }\n }\n }\n if (s3 !== peg$FAILED) {\n s2 = [s2, s3];\n s1 = s2;\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s1;\n s1 = peg$FAILED;\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c68(s1);\n }\n s0 = s1;\n return s0;\n }\n function peg$parsequotedString() {\n var s0, s1, s2, s3;\n s0 = peg$currPos;\n if (input.charCodeAt(peg$currPos) === 34) {\n s1 = peg$c69;\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c70);\n }\n }\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c71.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c72);\n }\n }\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c71.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c72);\n }\n }\n }\n if (s2 !== peg$FAILED) {\n if (input.charCodeAt(peg$currPos) === 34) {\n s3 = peg$c69;\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c70);\n }\n }\n if (s3 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c73(s2);\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n return s0;\n }\n function peg$parsenonQuotedString() {\n var s0, s1, s2;\n s0 = peg$currPos;\n s1 = [];\n if (peg$c74.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c75);\n }\n }\n while (s2 !== peg$FAILED) {\n s1.push(s2);\n if (peg$c74.test(input.charAt(peg$currPos))) {\n s2 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s2 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c75);\n }\n }\n }\n if (s1 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c76(s1);\n }\n s0 = s1;\n return s0;\n }\n function peg$parsenumber() {\n var s0, s1, s2, s3;\n peg$silentFails++;\n s0 = peg$currPos;\n s1 = peg$parse_();\n if (s1 !== peg$FAILED) {\n s2 = [];\n if (peg$c78.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c79);\n }\n }\n if (s3 !== peg$FAILED) {\n while (s3 !== peg$FAILED) {\n s2.push(s3);\n if (peg$c78.test(input.charAt(peg$currPos))) {\n s3 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s3 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c79);\n }\n }\n }\n }\n else {\n s2 = peg$FAILED;\n }\n if (s2 !== peg$FAILED) {\n peg$savedPos = s0;\n s1 = peg$c80();\n s0 = s1;\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n }\n else {\n peg$currPos = s0;\n s0 = peg$FAILED;\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c77);\n }\n }\n return s0;\n }\n function peg$parse_() {\n var s0, s1;\n peg$silentFails++;\n s0 = [];\n if (peg$c82.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c83);\n }\n }\n while (s1 !== peg$FAILED) {\n s0.push(s1);\n if (peg$c82.test(input.charAt(peg$currPos))) {\n s1 = input.charAt(peg$currPos);\n peg$currPos++;\n }\n else {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c83);\n }\n }\n }\n peg$silentFails--;\n if (s0 === peg$FAILED) {\n s1 = peg$FAILED;\n if (peg$silentFails === 0) {\n peg$fail(peg$c81);\n }\n }\n return s0;\n }\n peg$result = peg$startRuleFunction();\n if (peg$result !== peg$FAILED && peg$currPos === input.length) {\n return peg$result;\n }\n else {\n if (peg$result !== peg$FAILED && peg$currPos < input.length) {\n peg$fail(peg$endExpectation());\n }\n throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length\n ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)\n : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));\n }\n}\nmodule.exports = {\n SyntaxError: peg$SyntaxError,\n parse: peg$parse\n};\n//# sourceMappingURL=autoSql.js.map","export const bigChain = `table bigChain\n\"bigChain pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - for strand\"\n uint tSize; \"size of target sequence\"\n string qName; \"name of query sequence\"\n uint qSize; \"size of query sequence\"\n uint qStart; \"start of alignment on query sequence\"\n uint qEnd; \"end of alignment on query sequence\"\n uint chainScore; \"score from chain\"\n )`;\nexport const bigGenePred = `table bigGenePred\n\"bigGenePred gene models\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - for strand\"\n uint thickStart; \"Start of where display should be thick (start codon)\"\n uint thickEnd; \"End of where display should be thick (stop codon)\"\n uint reserved; \"RGB value (use R,G,B string in input file)\"\n int blockCount; \"Number of blocks\"\n int[blockCount] blockSizes; \"Comma separated list of block sizes\"\n int[blockCount] chromStarts; \"Start positions relative to chromStart\"\n string name2; \"Alternative/human readable name\"\n string cdsStartStat; \"Status of CDS start annotation (none, unknown, incomplete, or complete)\"\n string cdsEndStat; \"Status of CDS end annotation (none, unknown, incomplete, or complete)\"\n int[blockCount] exonFrames; \"Exon frame {0,1,2}, or -1 if no frame for exon\"\n string type; \"Transcript type\"\n string geneName; \"Primary identifier for gene\"\n string geneName2; \"Alternative/human readable gene name\"\n string geneType; \"Gene type\"\n )`;\nexport const bigInteract = `table interact\n\"interaction between two regions\"\n (\n string chrom; \"Chromosome (or contig, scaffold, etc.). For interchromosomal, use 2 records\"\n uint chromStart; \"Start position of lower region. For interchromosomal, set to chromStart of this region\"\n uint chromEnd; \"End position of upper region. For interchromosomal, set to chromEnd of this region\"\n string name; \"Name of item, for display. Usually 'sourceName/targetName/exp' or empty\"\n uint score; \"Score (0-1000)\"\n double value; \"Strength of interaction or other data value. Typically basis for score\"\n string exp; \"Experiment name (metadata for filtering). Use . if not applicable\"\n string color; \"Item color. Specified as r,g,b or hexadecimal #RRGGBB or html color name, as in //www.w3.org/TR/css3-color/#html4. Use 0 and spectrum setting to shade by score\"\n string sourceChrom; \"Chromosome of source region (directional) or lower region. For non-directional interchromosomal, chrom of this region.\"\n uint sourceStart; \"Start position in chromosome of source/lower/this region\"\n uint sourceEnd; \"End position in chromosome of source/lower/this region\"\n string sourceName; \"Identifier of source/lower/this region\"\n string sourceStrand; \"Orientation of source/lower/this region: + or -. Use . if not applicable\"\n string targetChrom; \"Chromosome of target region (directional) or upper region. For non-directional interchromosomal, chrom of other region\"\n uint targetStart; \"Start position in chromosome of target/upper/this region\"\n uint targetEnd; \"End position in chromosome of target/upper/this region\"\n string targetName; \"Identifier of target/upper/this region\"\n string targetStrand; \"Orientation of target/upper/this region: + or -. Use . if not applicable\"\n\n )`;\nexport const bigLink = `table bigLink\n\"bigLink pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint qStart; \"start of alignment on query sequence\"\n )`;\nexport const bigMaf = `table bedMaf\n\"Bed3 with MAF block\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n lstring mafBlock; \"MAF block\"\n )`;\nexport const bigNarrowPeak = `table bigNarrowPeak\n\"BED6+4 Peaks of signal enrichment based on pooled, normalized (interpreted) data.\"\n(\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name;\t \"Name given to a region (preferably unique). Use . if no name is assigned\"\n uint score; \"Indicates how dark the peak will be displayed in the browser (0-1000) \"\n char[1] strand; \"+ or - or . for unknown\"\n float signalValue; \"Measurement of average enrichment for the region\"\n float pValue; \"Statistical significance of signal value (-log10). Set to -1 if not used.\"\n float qValue; \"Statistical significance with multiple-test correction applied (FDR -log10). Set to -1 if not used.\"\n int peak; \"Point-source called for this peak; 0-based offset from chromStart. Set to -1 if no point-source called.\"\n)`;\nexport const bigPsl = `table bigPsl\n\"bigPsl pairwise alignment\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name or ID of item, ideally both human readable and unique\"\n uint score; \"Score (0-1000)\"\n char[1] strand; \"+ or - indicates whether the query aligns to the + or - strand on the reference\"\n uint thickStart; \"Start of where display should be thick (start codon)\"\n uint thickEnd; \"End of where display should be thick (stop codon)\"\n uint reserved; \"RGB value (use R,G,B string in input file)\"\n int blockCount; \"Number of blocks\"\n int[blockCount] blockSizes; \"Comma separated list of block sizes\"\n int[blockCount] chromStarts; \"Start positions relative to chromStart\"\n\n uint oChromStart;\"Start position in other chromosome\"\n uint oChromEnd; \"End position in other chromosome\"\n char[1] oStrand; \"+ or -, - means that psl was reversed into BED-compatible coordinates\"\n uint oChromSize; \"Size of other chromosome.\"\n int[blockCount] oChromStarts; \"Start positions relative to oChromStart or from oChromStart+oChromSize depending on strand\"\n\n lstring oSequence; \"Sequence on other chrom (or empty)\"\n string oCDS; \"CDS in NCBI format\"\n\n uint chromSize;\"Size of target chromosome\"\n\n uint match; \"Number of bases matched.\"\n uint misMatch; \" Number of bases that don't match \"\n uint repMatch; \" Number of bases that match but are part of repeats \"\n uint nCount; \" Number of 'N' bases \"\n uint seqType; \"0=empty, 1=nucleotide, 2=amino_acid\"\n )`;\nexport const defaultBedSchema = `table defaultBedSchema\n\"BED12\"\n (\n string chrom; \"The name of the chromosome (e.g. chr3, chrY, chr2_random) or scaffold (e.g. scaffold10671).\"\n uint chromStart; \"The starting position of the feature in the chromosome or scaffold. The first base in a chromosome is numbered 0.\"\n uint chromEnd; \"The ending position of the feature in the chromosome or scaffold. The chromEnd base is not included in the display of the feature. For example, the first 100 bases of a chromosome are defined as chromStart=0, chromEnd=100, and span the bases numbered 0-99.\"\n string name; \"Defines the name of the BED line.\"\n float score; \"Feature score, doesn't care about the 0-1000 limit as in bed\"\n char strand; \"Defines the strand. Either '.' (=no strand) or '+' or '-'\"\n uint thickStart; \"The starting position at which the feature is drawn thickly (for example, the start codon in gene displays). When there is no thick part, thickStart and thickEnd are usually set to the chromStart position.\"\n uint thickEnd; \"The ending position at which the feature is drawn thickly (for example the stop codon in gene displays).\"\n string itemRgb; \"An RGB value of the form R,G,B (e.g. 255,0,0). \"\n uint blockCount; \" The number of blocks (exons) in the BED line.\"\n uint[blockCount] blockSizes; \" A comma-separated list of the block sizes. The number of items in this list should correspond to blockCount.\"\n uint[blockCount] blockStarts; \"A comma-separated list of block starts. All of the blockStart positions should be calculated relative to chromStart. The number of items in this list should correspond to blockCount.\"\n )`;\nexport const mafFrames = `table mafFrames\n\"codon frame assignment for MAF components\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start range in chromosome\"\n uint chromEnd; \"End range in chromosome\"\n string src; \"Name of sequence source in MAF\"\n ubyte frame; \"frame (0,1,2) for first base(+) or last bast(-)\"\n char[1] strand; \"+ or -\"\n string name; \"Name of gene used to define frame\"\n int prevFramePos; \"target position of the previous base (in transcription direction) that continues this frame, or -1 if none, or frame not contiguous\"\n int nextFramePos; \"target position of the next base (in transcription direction) that continues this frame, or -1 if none, or frame not contiguous\"\n ubyte isExonStart; \"does this start the CDS portion of an exon?\"\n ubyte isExonEnd; \"does this end the CDS portion of an exon?\"\n )`;\nexport const mafSummary = `table mafSummary\n\"Positions and scores for alignment blocks\"\n (\n string chrom; \"Reference sequence chromosome or scaffold\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string src; \"Sequence name or database of alignment\"\n float score; \"Floating point score.\"\n char[1] leftStatus; \"Gap/break annotation for preceding block\"\n char[1] rightStatus; \"Gap/break annotation for following block\"\n )`;\n//# sourceMappingURL=autoSqlSchemas.js.map","import { parse } from './autoSql';\nimport * as types from './as/autoSqlSchemas';\nexport default Object.fromEntries(Object.entries(types).map(([key, val]) => [\n key,\n parse(val.trim()),\n]));\n//# sourceMappingURL=defaultTypes.js.map","/*\n * adds some type annotations to the autoSql schema\n * for numeric fields ['uint', 'int', 'float', 'long'] \"isNumeric\" is added\n * for array types \"isArray\" is added\n * for numeric array types \"isArray\" and \"arrayIsNumeric\" is set\n *\n * @param autoSql - an autoSql schema from the peg parser\n * @return autoSql with type annotations added\n */\nexport function detectTypes(autoSql) {\n const numericTypes = ['uint', 'int', 'float', 'long'];\n return {\n ...autoSql,\n fields: autoSql.fields.map(autoField => ({\n ...autoField,\n isArray: autoField.size && autoField.type !== 'char',\n arrayIsNumeric: autoField.size && numericTypes.includes(autoField.type),\n isNumeric: !autoField.size && numericTypes.includes(autoField.type),\n })),\n };\n}\n//# sourceMappingURL=util.js.map","import parser from './autoSql';\nimport types from './defaultTypes';\nimport { detectTypes } from './util';\nconst strandMap = { '.': 0, '-': -1, '+': 1 };\n// heuristic that a BED file is BED12 like...the number in col 10 is blockCount-like\nfunction isBed12Like(fields) {\n var _a;\n return (fields.length >= 12 &&\n !Number.isNaN(parseInt(fields[9], 10)) &&\n ((_a = fields[10]) === null || _a === void 0 ? void 0 : _a.split(',').filter(f => !!f).length) === parseInt(fields[9], 10));\n}\nexport default class BED {\n constructor(args = {}) {\n if (args.autoSql) {\n this.autoSql = detectTypes(parser.parse(args.autoSql));\n }\n else if (args.type) {\n if (!types[args.type]) {\n throw new Error('Type not found');\n }\n this.autoSql = detectTypes(types[args.type]);\n }\n else {\n this.autoSql = detectTypes(types.defaultBedSchema);\n this.attemptDefaultBed = true;\n }\n }\n /*\n * parses a line of text as a BED line with the loaded autoSql schema\n *\n * @param line - a BED line as tab delimited text or array\n * @param opts - supply opts.uniqueId\n * @return a object representing a feature\n */\n parseLine(line, opts = {}) {\n const { autoSql } = this;\n const { uniqueId } = opts;\n const fields = Array.isArray(line) ? line : line.split('\\t');\n let feature = {};\n if (!this.attemptDefaultBed ||\n (this.attemptDefaultBed && isBed12Like(fields))) {\n for (let i = 0; i < autoSql.fields.length; i++) {\n const autoField = autoSql.fields[i];\n let columnVal = fields[i];\n const { isNumeric, isArray, arrayIsNumeric, name } = autoField;\n if (columnVal === null || columnVal === undefined) {\n break;\n }\n if (columnVal !== '.') {\n if (isNumeric) {\n const num = Number(columnVal);\n columnVal = Number.isNaN(num) ? columnVal : num;\n }\n else if (isArray) {\n columnVal = columnVal.split(',');\n if (columnVal[columnVal.length - 1] === '') {\n columnVal.pop();\n }\n if (arrayIsNumeric) {\n columnVal = columnVal.map((str) => Number(str));\n }\n }\n feature[name] = columnVal;\n }\n }\n }\n else {\n const fieldNames = ['chrom', 'chromStart', 'chromEnd', 'name'];\n feature = Object.fromEntries(fields.map((f, i) => [fieldNames[i] || 'field' + i, f]));\n feature.chromStart = +feature.chromStart;\n feature.chromEnd = +feature.chromEnd;\n if (!Number.isNaN(Number.parseFloat(feature.field4))) {\n feature.score = +feature.field4;\n delete feature.field4;\n }\n if (feature.field5 === '+' || feature.field5 === '-') {\n feature.strand = feature.field5;\n delete feature.field5;\n }\n }\n if (uniqueId) {\n feature.uniqueId = uniqueId;\n }\n feature.strand = strandMap[feature.strand] || 0;\n feature.chrom = decodeURIComponent(feature.chrom);\n return feature;\n }\n}\n//# sourceMappingURL=parser.js.map","import BED from '@gmod/bed';\nimport type { BedTile } from './bed-worker';\n\n/**\n * Used in BedParser to associate column names with data types\n */\ntype FieldInfo = [type: string, fieldName: string];\n\n/**\n * From gmod/bed-js\n */\nconst DEFAULT_BED_SCHEMA = `table defaultBedSchema\n\"BED12\"\n (\n string chrom; \"The name of the chromosome (e.g. chr3, chrY, chr2_random) or scaffold (e.g. scaffold10671).\"\n uint chromStart; \"The starting position of the feature in the chromosome or scaffold. The first base in a chromosome is numbered 0.\"\n uint chromEnd; \"The ending position of the feature in the chromosome or scaffold. The chromEnd base is not included in the display of the feature. For example, the first 100 bases of a chromosome are defined as chromStart=0, chromEnd=100, and span the bases numbered 0-99.\"\n string name; \"Defines the name of the BED line.\"\n float score; \"Feature score, doesn't care about the 0-1000 limit as in bed\"\n char strand; \"Defines the strand. Either '.' (=no strand) or '+' or '-'\"\n uint thickStart; \"The starting position at which the feature is drawn thickly (for example, the start codon in gene displays). When there is no thick part, thickStart and thickEnd are usually set to the chromStart position.\"\n uint thickEnd; \"The ending position at which the feature is drawn thickly (for example the stop codon in gene displays).\"\n string itemRgb; \"An RGB value of the form R,G,B (e.g. 255,0,0). \"\n uint blockCount; \" The number of blocks (exons) in the BED line.\"\n uint[blockCount] blockSizes; \" A comma-separated list of the block sizes. The number of items in this list should correspond to blockCount.\"\n uint[blockCount] blockStarts; \"A comma-separated list of block starts. All of the blockStart positions should be calculated relative to chromStart. The number of items in this list should correspond to blockCount.\"\n )`;\n\n/**\n * A class to create a BED file parser\n */\nclass BedParser {\n #customFields?: string[];\n #n_columns?: number;\n #parser: BED;\n\n /**\n * Constructor for BedParser\n * @param customFields An array of strings, where each string is the name of a custom column\n * @param n_columns A number which is the number of columns in the Bed File\n */\n constructor(opt?: { customFields: string[]; n_columns: number }) {\n this.#customFields = opt?.customFields;\n this.#n_columns = opt?.n_columns;\n if (this.#customFields) {\n const customAutoSqlSchema = this.constructBedAutoSql();\n this.#parser = new BED({ autoSql: customAutoSqlSchema });\n } else {\n this.#parser = new BED({ autoSql: DEFAULT_BED_SCHEMA });\n }\n }\n /**\n * Parses a single BED file line\n * @returns An object which contains the parsed data from the line\n */\n parseLine(line: string, chromStart: number) {\n /** Helper function to calculate cumulative chromosome positions */\n function relativeToCumulative(pos: number, chromStart: number) {\n return chromStart + pos + 1;\n }\n const bedRecord: BedTile = this.#parser.parseLine(line) as BedTile;\n const fieldsToConvert = ['chromStart', 'chromEnd', 'thickEnd', 'thickStart'];\n fieldsToConvert.forEach(field => {\n if (bedRecord[field]) bedRecord[field] = relativeToCumulative(bedRecord[field] as number, chromStart);\n });\n return bedRecord;\n }\n /**\n * Generates an autoSql schema for a BED file that has custom columns\n * @returns A string which is the autoSql spec\n */\n constructBedAutoSql() {\n const AUTO_SQL_HEADER = `table customBedSchema\\n\"BED12\"\\n (\\n`;\n const AUTO_SQL_FOOTER = '\\n )';\n\n const autoSqlFields = this.#generateAutoSQLFields();\n return String.prototype.concat(AUTO_SQL_HEADER, autoSqlFields, AUTO_SQL_FOOTER);\n }\n /**\n * Generates the fields used in the autoSql schema. For custom column names.\n * @returns A string which is are the fields in the autoSql schema\n */\n #generateAutoSQLFields() {\n const BED12Fields: FieldInfo[] = [\n ['string', 'chrom'],\n ['uint', 'chromStart'],\n ['uint', 'chromEnd'],\n ['string', 'name'],\n ['float', 'score'],\n ['char', 'strand'],\n ['uint', 'thickStart'],\n ['uint', 'thickEnd'],\n ['string', 'itemRgb'],\n ['uint', 'blockCount'],\n ['uint[blockCount]', 'blockSizes'],\n ['uint[blockCount]', 'blockStarts']\n ];\n if (!this.#n_columns) throw new Error('Number of columns was not able to be determined');\n if (!this.#customFields) return ''; // This function should never be called if there are no custom fields\n const customFieldType = 'string';\n const customFieldsWithTypes = this.#customFields.map(column => [customFieldType, column] as FieldInfo);\n\n let allFields: FieldInfo[];\n const REQUIRED_COLS = 3;\n if (this.#n_columns > BED12Fields.length) {\n // BED12+m so we just want to concat on the extra fields.\n // But first we make sure that we have the expected number of columns.\n if (this.#n_columns !== BED12Fields.length + this.#customFields.length) {\n throw new Error(`BED file error: unexpected number of custom fields. Found ${this.#n_columns} columns \n which is different from the expected ${BED12Fields.length + this.#customFields.length}`);\n }\n allFields = BED12Fields.concat(customFieldsWithTypes);\n } else if (this.#n_columns >= REQUIRED_COLS + this.#customFields.length) {\n // BEDn or BEDn+. We make sure that the required columns are not removed when we do the slice.\n allFields = BED12Fields.slice(0, this.#n_columns - this.#customFields.length).concat(customFieldsWithTypes);\n } else {\n throw new Error(\n `Expected ${REQUIRED_COLS + this.#customFields.length} columns (${REQUIRED_COLS} required columns and ${\n this.#customFields.length\n } custom columns) but found ${this.#n_columns} columns`\n );\n }\n\n const fieldDescription = 'custom input'; // A genetic description to satisfy the autoSQL parser\n const autoSqlFields = allFields\n .map(fieldInfo => ` ${fieldInfo[0]} ${fieldInfo[1]}; \"${fieldDescription}\"`)\n .join('\\n');\n\n return autoSqlFields;\n }\n}\n\nexport default BedParser;\n","/*\n * This document is heavily based on the following repo by @alexander-veit:\n * https://github.com/dbmi-bgm/higlass-sv/blob/main/src/sv-fetcher-worker.js\n */\n\nimport { TabixIndexedFile } from '@gmod/tabix';\nimport { sampleSize } from 'lodash-es';\nimport { expose, Transfer } from 'threads/worker';\nimport type { TilesetInfo } from '@higlass/types';\n\nimport type { ChromSizes } from '@gosling-lang/gosling-schema';\n\nimport { DataSource, RemoteFile } from '../utils';\nimport BedParser from './bed-parser';\n\nexport type BedFileOptions = {\n sampleLength: number;\n customFields?: string[];\n urlFetchOptions?: RequestInit;\n indexUrlFetchOptions?: RequestInit;\n};\n\n/**\n * All data stored in each BED file eventually transformed and put into this\n */\nexport interface BedTile {\n chrom: string;\n chromStart: number;\n chromEnd: number;\n name?: string;\n score?: number;\n strand?: string;\n thickStart?: number;\n thickEnd?: number;\n itemRgb?: string;\n blockCount?: number;\n blockSizes?: number[];\n blockStarts?: number[];\n [customField: string]: string | number | number[] | undefined;\n}\n\nexport interface EmptyTile {\n tilePositionId: string;\n}\n\n/**\n * A class to represent a BED file. It takes care of setting up gmod/tabix.\n */\nclass BedFile {\n #parser?: BedParser;\n #customFields?: string[];\n #uid: string;\n\n constructor(public tbi: TabixIndexedFile, uid: string) {\n this.#uid = uid;\n }\n /**\n * Function to create an instance of BedFile\n * @param url A string which is the URL of the bed file\n * @param indexUrl A string which is the URL of the bed index file\n * @param uid A unique identifier for the worker\n * @param urlFetchOptions When the url is fetched, these options will be used\n * @param indexUrlFetchOptions When the index URL is fetched, these options will be used\n * @returns an instance of BedFile\n */\n static fromUrl(\n url: string,\n indexUrl: string,\n uid: string,\n urlFetchOptions?: RequestInit,\n indexUrlFetchOptions?: RequestInit\n ) {\n const tbi = new TabixIndexedFile({\n filehandle: new RemoteFile(url, { overrides: urlFetchOptions }),\n tbiFilehandle: new RemoteFile(indexUrl, { overrides: indexUrlFetchOptions })\n });\n return new BedFile(tbi, uid);\n }\n set customFields(custom: string[]) {\n this.#customFields = custom;\n }\n /**\n * Creates a parser. Parser cannot be created in the constructor because it relies on chromosome information\n * which gets created by DataSource\n * @returns A BED parser\n */\n async getParser() {\n if (!this.#parser) {\n const opt = this.#customFields\n ? { customFields: this.#customFields, n_columns: await this.#calcNColumns() }\n : undefined;\n this.#parser = new BedParser(opt);\n }\n return this.#parser;\n }\n /**\n * Function to calculate the number of columns in the BED file. Needed when custom column names are supplied\n * Relatively inefficient because the gmod/tabix API only has a way to retrieve lines based on genomic coordinates,\n * but I believe this is better than fetching the BED file itself because then it only has to be fetched and\n * unzipped once.\n * @returns\n */\n async #calcNColumns() {\n const source = dataSources.get(this.#uid)!;\n const { chromLengths, cumPositions } = source.chromInfo;\n let n_cols = 0;\n for (const cumPos of cumPositions) {\n const chromName = cumPos.chr;\n const chromStart = cumPos.pos;\n const chromEnd = cumPos.pos + chromLengths[chromName];\n n_cols = await new Promise(resolve => {\n source.file.tbi.getLines(chromName, chromStart, chromEnd, line => {\n resolve(line.split('\\t').length);\n });\n });\n if (n_cols > 0) break;\n }\n return n_cols;\n }\n /**\n * Retrieves data within a certain coordinate range\n * @param minX A number which is the minimum X boundary of the tile\n * @param maxX A number which is the maximum X boundary of the tile\n * @param callback A callback function which takes in parsed BED file data record\n * @returns A promise of array of promises which resolve when the data has been successfully retrieved\n */\n async getTileData(minX: number, maxX: number): Promise {\n const source = dataSources.get(this.#uid)!;\n const parser = await this.getParser();\n let curMinX = minX;\n const { chromLengths, cumPositions } = source.chromInfo;\n const allTiles: Promise[] = [];\n\n for (const cumPos of cumPositions) {\n const chromName = cumPos.chr;\n const chromStart = cumPos.pos;\n const chromEnd = cumPos.pos + chromLengths[chromName];\n let startPos, endPos;\n\n // Early break, rather than creating an nested if\n if (chromStart > curMinX || curMinX >= chromEnd) {\n continue;\n }\n\n const tilesPromise = new Promise(resolve => {\n const tiles: BedTile[] = [];\n const lineCallback = (line: string) => {\n const bedTile = parser.parseLine(line, chromStart);\n tiles.push(bedTile);\n };\n\n if (maxX > chromEnd) {\n startPos = curMinX - chromStart;\n endPos = chromEnd - chromStart;\n } else {\n startPos = Math.floor(curMinX - chromStart);\n endPos = Math.ceil(maxX - chromStart);\n }\n\n source.file.tbi.getLines(chromName, startPos, endPos, lineCallback).then(() => {\n resolve(tiles);\n });\n });\n\n allTiles.push(tilesPromise);\n\n if (maxX <= chromEnd) {\n continue;\n }\n\n curMinX = chromEnd;\n }\n\n const tileArrays = await Promise.all(allTiles);\n return tileArrays.flat();\n }\n}\n\n// promises indexed by urls\nconst bedFiles: Map = new Map();\n\n/**\n * Object to store tile data. Each key a string which contains the coordinates of the tile\n */\nconst tileValues: Record = {};\n/**\n * Maps from UID to Bed File info\n */\nconst dataSources: Map> = new Map();\n\nfunction init(\n uid: string,\n bed: { url: string; indexUrl: string },\n chromSizes: ChromSizes,\n options: Partial = {}\n) {\n let bedFile = bedFiles.get(bed.url);\n if (!bedFile) {\n bedFile = BedFile.fromUrl(bed.url, bed.indexUrl, uid, options.urlFetchOptions, options.indexUrlFetchOptions);\n if (options.customFields) bedFile.customFields = options.customFields;\n }\n const dataSource = new DataSource(bedFile, chromSizes, {\n sampleLength: 1000,\n ...options\n });\n dataSources.set(uid, dataSource);\n}\n\nconst tilesetInfo = (uid: string) => {\n return dataSources.get(uid)!.tilesetInfo;\n};\n\n/**\n * Updates `tileValues` with the data for a specific tile.\n * @param uid A string which is the unique identifier of the worker\n * @param z A number which is the z coordinate of the tile\n * @param x A number which is the x coordinate of the tile\n */\nconst tile = async (uid: string, z: number, x: number): Promise => {\n const source = dataSources.get(uid)!;\n // const parseLine = await source.file.getParser();\n\n const CACHE_KEY = `${uid}.${z}.${x}`;\n\n // TODO: Caching is needed\n // if (!tileValues[CACHE_KEY]) {\n tileValues[CACHE_KEY] = [];\n // }\n\n const tileWidth = +source.tilesetInfo.max_width / 2 ** +z;\n\n // get bounds of this tile\n const minX = source.tilesetInfo.min_pos[0] + x * tileWidth;\n const maxX = source.tilesetInfo.min_pos[0] + (x + 1) * tileWidth;\n\n tileValues[CACHE_KEY] = await source.file.getTileData(minX, maxX);\n\n return tileValues[CACHE_KEY];\n};\n\nconst fetchTilesDebounced = async (uid: string, tileIds: string[]) => {\n const tiles: Record = {};\n const validTileIds: string[] = [];\n const tilePromises: Promise[] = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('Invalid tile zoom or position:', z, x);\n continue;\n }\n validTileIds.push(tileId);\n tilePromises.push(tile(uid, z, x));\n }\n return Promise.all(tilePromises).then(values => {\n for (let i = 0; i < values.length; i++) {\n const validTileId = validTileIds[i];\n tiles[validTileId] = { tilePositionId: validTileId };\n }\n return tiles;\n });\n};\n\n/**\n * Sends the data fetcher data from `tileValues`\n * @param uid A string which is the unique identifier of the worker\n * @param tileIds An array of strings where each string identifies a tile with a particular coordinate\n * @returns A transferable buffer\n */\nconst getTabularData = (uid: string, tileIds: string[]) => {\n const data: BedTile[][] = [];\n\n tileIds.forEach(tileId => {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n const tileValue = tileValues[`${uid}.${z}.${x}`];\n\n if (!tileValue) {\n console.warn(`No tile data constructed (${tileId})`);\n }\n\n data.push(tileValue);\n });\n\n let output = Object.values(data).flat();\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const sampleLength = dataSources.get(uid)!.options.sampleLength;\n if (output.length >= sampleLength) {\n // TODO: we can make this more generic\n // priotize that mutations with closer each other are selected when sampling.\n output = sampleSize(output, sampleLength / 2.0);\n }\n\n const buffer = new TextEncoder().encode(JSON.stringify(output)).buffer;\n return Transfer(buffer, [buffer]);\n};\n\nconst tileFunctions = {\n init,\n tilesetInfo,\n fetchTilesDebounced,\n tile,\n getTabularData\n};\n\nexport type WorkerApi = typeof tileFunctions;\nexport type { TilesetInfo };\n\nexpose(tileFunctions);\n"],"names":["i","_getPrototypeOf","o","_setPrototypeOf","p","self","_get","Emitter","AbortSignal","toString","AbortController","err","Request","init","abortableFetch","require$$0","global","AggregateAbortController_1","abortcontroller_ponyfill_1","AggregateStatusReporter_1","__importDefault","this","AbortablePromiseCache_1","require$$1","require$$2","len","len2","buffer","c","ieee754","exports","Buffer","fromString","byteLength","isBuffer","code","msg","utils","Z_FIXED","Z_UNKNOWN","zero","MIN_MATCH","MAX_MATCH","LENGTH_CODES","LITERALS","L_CODES","D_CODES","BL_CODES","HEAP_SIZE","MAX_BITS","rank","adler32","crc32","messages","require$$3","require$$4","Z_NO_FLUSH","Z_FINISH","Z_BLOCK","Z_OK","Z_STREAM_END","Z_STREAM_ERROR","Z_DATA_ERROR","Z_BUF_ERROR","Z_DEFAULT_COMPRESSION","Z_DEFAULT_STRATEGY","Z_DEFLATED","MAX_WBITS","deflate","strings","c2","ZStream","BAD","TYPE","inflate_fast","ENOUGH_LENS","ENOUGH_DISTS","CODES","LENS","DISTS","inflate_table","root","q","inflate","constants","GZheader","require$$5","require$$6","Inflate","Z_SYNC_FLUSH","toNumber","fromBytes","long","Long","TBI","AbortablePromiseCache","freeGlobal","Symbol","objectProto","hasOwnProperty","nativeObjectToString","symToStringTag","funcTag","MAX_SAFE_INTEGER","argsTag","freeExports","freeModule","moduleExports","types","nodeUtil","isArray","isArguments","isTypedArray","nativeKeys","Transfer","isWorkerRuntime","postMessageToMaster","subscribeToMasterMessages","isObservable","expose","_RemoteFile","expected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;AAAA,IACA;AAAA,EACJ;AAKA,SAAO,aAAa;;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,95,96,97,98,99]} \ No newline at end of file diff --git a/dist/assets/gff-worker-71adf8b0.js.map b/dist/assets/gff-worker-71adf8b0.js.map deleted file mode 100644 index c4de6209..00000000 --- a/dist/assets/gff-worker-71adf8b0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gff-worker-71adf8b0.js","sources":["../node_modules/.pnpm/abortcontroller-polyfill@1.7.5/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/abortcontroller-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateAbortController.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateStatusReporter.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AbortablePromiseCache.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/index.js","../node_modules/.pnpm/quick-lru@4.0.1/node_modules/quick-lru/index.js","../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js","../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js","../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js","../__vite-browser-external","../node_modules/.pnpm/generic-filehandle@3.1.1/node_modules/generic-filehandle/esm/remoteFile.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js","../node_modules/.pnpm/@gmod+bgzf-filehandle@1.4.7/node_modules/@gmod/bgzf-filehandle/esm/unzip-pako.js","../node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/util.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/virtualOffset.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/chunk.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/indexFile.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tbi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/csi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tabixIndexedFile.js","../node_modules/.pnpm/events@3.3.0/node_modules/events/events.js","../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/stream-browser.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/buffer_list.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/destroy.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/errors-browser.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/state.js","../node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_writable.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_duplex.js","../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js","../node_modules/.pnpm/string_decoder@1.3.0/node_modules/string_decoder/lib/string_decoder.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/end-of-stream.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/async_iterator.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from-browser.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_readable.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_transform.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_passthrough.js","../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/pipeline.js","../node_modules/.pnpm/stream-browserify@3.0.0/node_modules/stream-browserify/index.js","../node_modules/.pnpm/@gmod+gff@1.3.0/node_modules/@gmod/gff/esm/util.js","../node_modules/.pnpm/@gmod+gff@1.3.0/node_modules/@gmod/gff/esm/parse.js","../node_modules/.pnpm/@gmod+gff@1.3.0/node_modules/@gmod/gff/esm/api.js","../node_modules/.pnpm/@gmod+gff@1.3.0/node_modules/@gmod/gff/esm/index.js","../node_modules/.pnpm/is-observable@2.1.0/node_modules/is-observable/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/serializers.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/common.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/symbols.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/transferable.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/types/messages.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/implementation.browser.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/worker.mjs","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayMap.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toFinite.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toInteger.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copyArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIterateeCall.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseClamp.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseValues.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/values.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseRandom.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_shuffleSelf.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/sampleSize.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/ascending.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/bisector.js","../src/data-fetchers/utils.ts","../src/data-fetchers/gff/utils.ts","../src/data-fetchers/gff/gff-worker.ts"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get.apply(this, arguments);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'reason', {\n value: undefined,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort(reason) {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n var signalReason = reason;\n\n if (signalReason === undefined) {\n if (typeof document === 'undefined') {\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n } else {\n try {\n signalReason = new DOMException('signal is aborted without reason');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n }\n }\n }\n\n this.signal.reason = signalReason;\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","\"use strict\";\n/* eslint-disable */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbortSignal = exports.AbortController = void 0;\nconst cjs_ponyfill_1 = require(\"abortcontroller-polyfill/dist/cjs-ponyfill\");\nvar getGlobal = function () {\n // the only reliable means to get the global object is\n // `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n};\n//@ts-ignore\nlet AbortController = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortController : getGlobal().AbortController;\nexports.AbortController = AbortController;\n//@ts-ignore\nlet AbortSignal = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal;\nexports.AbortSignal = AbortSignal;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nclass NullSignal {\n}\n/**\n * aggregates a number of abort signals, will only fire the aggregated\n * abort if all of the input signals have been aborted\n */\nclass AggregateAbortController {\n constructor() {\n this.signals = new Set();\n this.abortController = new abortcontroller_ponyfill_1.AbortController();\n }\n /**\n * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy,\n * will be treated as a null-signal, and this abortcontroller will no\n * longer be abortable.\n */\n //@ts-ignore\n addSignal(signal = new NullSignal()) {\n if (this.signal.aborted) {\n throw new Error('cannot add a signal, already aborted!');\n }\n // note that a NullSignal will never fire, so if we\n // have one this thing will never actually abort\n this.signals.add(signal);\n if (signal.aborted) {\n // handle the abort immediately if it is already aborted\n // for some reason\n this.handleAborted(signal);\n }\n else if (typeof signal.addEventListener === 'function') {\n signal.addEventListener('abort', () => {\n this.handleAborted(signal);\n });\n }\n }\n handleAborted(signal) {\n this.signals.delete(signal);\n if (this.signals.size === 0) {\n this.abortController.abort();\n }\n }\n get signal() {\n return this.abortController.signal;\n }\n abort() {\n this.abortController.abort();\n }\n}\nexports.default = AggregateAbortController;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass AggregateStatusReporter {\n constructor() {\n this.callbacks = new Set();\n }\n addCallback(callback = () => { }) {\n this.callbacks.add(callback);\n callback(this.currentMessage);\n }\n callback(message) {\n this.currentMessage = message;\n this.callbacks.forEach(elt => {\n elt(message);\n });\n }\n}\nexports.default = AggregateStatusReporter;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nconst AggregateAbortController_1 = __importDefault(require(\"./AggregateAbortController\"));\nconst AggregateStatusReporter_1 = __importDefault(require(\"./AggregateStatusReporter\"));\nclass AbortablePromiseCache {\n constructor({ fill, cache, }) {\n if (typeof fill !== 'function') {\n throw new TypeError('must pass a fill function');\n }\n if (typeof cache !== 'object') {\n throw new TypeError('must pass a cache object');\n }\n if (typeof cache.get !== 'function' ||\n typeof cache.set !== 'function' ||\n typeof cache.delete !== 'function') {\n throw new TypeError('cache must implement get(key), set(key, val), and and delete(key)');\n }\n this.cache = cache;\n this.fillCallback = fill;\n }\n static isAbortException(exception) {\n return (\n // DOMException\n exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n //@ts-ignore\n exception.code === 'ERR_ABORTED' ||\n // stringified DOMException\n exception.message === 'AbortError: aborted' ||\n // stringified standard-ish exception\n exception.message === 'Error: aborted');\n }\n evict(key, entry) {\n if (this.cache.get(key) === entry) {\n this.cache.delete(key);\n }\n }\n fill(key, data, signal, statusCallback) {\n const aborter = new AggregateAbortController_1.default();\n const statusReporter = new AggregateStatusReporter_1.default();\n statusReporter.addCallback(statusCallback);\n const newEntry = {\n aborter: aborter,\n promise: this.fillCallback(data, aborter.signal, (message) => {\n statusReporter.callback(message);\n }),\n settled: false,\n statusReporter,\n get aborted() {\n return this.aborter.signal.aborted;\n },\n };\n newEntry.aborter.addSignal(signal);\n // remove the fill from the cache when its abortcontroller fires, if still in there\n newEntry.aborter.signal.addEventListener('abort', () => {\n if (!newEntry.settled) {\n this.evict(key, newEntry);\n }\n });\n // chain off the cached promise to record when it settles\n newEntry.promise\n .then(() => {\n newEntry.settled = true;\n }, () => {\n newEntry.settled = true;\n // if the fill throws an error (including abort) and is still in the cache, remove it\n this.evict(key, newEntry);\n })\n .catch(e => {\n // this will only be reached if there is some kind of\n // bad bug in this library\n console.error(e);\n throw e;\n });\n this.cache.set(key, newEntry);\n }\n static checkSinglePromise(promise, signal) {\n // check just this signal for having been aborted, and abort the\n // promise if it was, regardless of what happened with the cached\n // response\n function checkForSingleAbort() {\n if (signal && signal.aborted) {\n throw Object.assign(new Error('aborted'), { code: 'ERR_ABORTED' });\n }\n }\n return promise.then(result => {\n checkForSingleAbort();\n return result;\n }, error => {\n checkForSingleAbort();\n throw error;\n });\n }\n has(key) {\n return this.cache.has(key);\n }\n /**\n * Callback for getting status of the pending async\n *\n * @callback statusCallback\n * @param {any} status, current status string or message object\n */\n /**\n * @param {any} key cache key to use for this request\n * @param {any} data data passed as the first argument to the fill callback\n * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request\n * @param {statusCallback} a callback to get the current status of a pending async operation\n */\n get(key, data, signal, statusCallback) {\n if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) {\n throw new TypeError('second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?');\n }\n const cacheEntry = this.cache.get(key);\n if (cacheEntry) {\n if (cacheEntry.aborted && !cacheEntry.settled) {\n // if it's aborted but has not realized it yet, evict it and redispatch\n this.evict(key, cacheEntry);\n return this.get(key, data, signal, statusCallback);\n }\n if (cacheEntry.settled) {\n // too late to abort, just return it\n return cacheEntry.promise;\n }\n // request is in-flight, add this signal to its list of signals,\n // or if there is no signal, the aborter will become non-abortable\n cacheEntry.aborter.addSignal(signal);\n cacheEntry.statusReporter.addCallback(statusCallback);\n return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal);\n }\n // if we got here, it is not in the cache. fill.\n this.fill(key, data, signal, statusCallback);\n return AbortablePromiseCache.checkSinglePromise(\n //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-\n //eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.cache.get(key).promise, signal);\n }\n /**\n * delete the given entry from the cache. if it exists and its fill request has\n * not yet settled, the fill will be signaled to abort.\n *\n * @param {any} key\n */\n delete(key) {\n const cachedEntry = this.cache.get(key);\n if (cachedEntry) {\n if (!cachedEntry.settled) {\n cachedEntry.aborter.abort();\n }\n this.cache.delete(key);\n }\n }\n /**\n * Clear all requests from the cache. Aborts any that have not settled.\n * @returns {number} count of entries deleted\n */\n clear() {\n // iterate without needing regenerator-runtime\n const keyIter = this.cache.keys();\n let deleteCount = 0;\n for (let result = keyIter.next(); !result.done; result = keyIter.next()) {\n this.delete(result.value);\n deleteCount += 1;\n }\n return deleteCount;\n }\n}\nexports.default = AbortablePromiseCache;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst AbortablePromiseCache_1 = __importDefault(require(\"./AbortablePromiseCache\"));\nexports.default = AbortablePromiseCache_1.default;\n","'use strict';\n\nclass QuickLRU {\n\tconstructor(options = {}) {\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst value = this.oldCache.get(key);\n\t\t\tthis.oldCache.delete(key);\n\t\t\tthis._set(key, value);\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tset(key, value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, value);\n\t\t} else {\n\t\t\tthis._set(key, value);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\thas(key) {\n\t\treturn this.cache.has(key) || this.oldCache.has(key);\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this.oldCache.get(key);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tyield item;\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget size() {\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn this._size + oldCacheSize;\n\t}\n}\n\nmodule.exports = QuickLRU;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","export default {}","import { Buffer } from 'buffer';\nexport default class RemoteFile {\n async getBufferFromResponse(response) {\n if (typeof response.buffer === 'function') {\n return response.buffer();\n }\n else if (typeof response.arrayBuffer === 'function') {\n const resp = await response.arrayBuffer();\n return Buffer.from(resp);\n }\n else {\n throw new TypeError('invalid HTTP response object, has no buffer method, and no arrayBuffer method');\n }\n }\n constructor(source, opts = {}) {\n this.baseOverrides = {};\n this.url = source;\n const fetch = opts.fetch || globalThis.fetch.bind(globalThis);\n if (!fetch) {\n throw new TypeError(`no fetch function supplied, and none found in global environment`);\n }\n if (opts.overrides) {\n this.baseOverrides = opts.overrides;\n }\n this.fetchImplementation = fetch;\n }\n async fetch(input, init) {\n let response;\n try {\n response = await this.fetchImplementation(input, init);\n }\n catch (e) {\n if (`${e}`.includes('Failed to fetch')) {\n // refetch to to help work around a chrome bug (discussed in\n // generic-filehandle issue #72) in which the chrome cache returns a\n // CORS error for content in its cache. see also\n // https://github.com/GMOD/jbrowse-components/pull/1511\n console.warn(`generic-filehandle: refetching ${input} to attempt to work around chrome CORS header caching bug`);\n response = await this.fetchImplementation(input, {\n ...init,\n cache: 'reload',\n });\n }\n else {\n throw e;\n }\n }\n return response;\n }\n async read(buffer, offset = 0, length, position = 0, opts = {}) {\n const { headers = {}, signal, overrides = {} } = opts;\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n }\n else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n ...this.baseOverrides.headers,\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n };\n const response = await this.fetch(this.url, args);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n if ((response.status === 200 && position === 0) ||\n response.status === 206) {\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n return { bytesRead: bytesCopied, buffer };\n }\n if (response.status === 200) {\n throw new Error('${this.url} fetch returned status 200, expected 206');\n }\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n }\n async readFile(options = {}) {\n let encoding;\n let opts;\n if (typeof options === 'string') {\n encoding = options;\n opts = {};\n }\n else {\n encoding = options.encoding;\n opts = options;\n delete opts.encoding;\n }\n const { headers = {}, signal, overrides = {} } = opts;\n const args = {\n headers,\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n ...this.baseOverrides,\n ...overrides,\n };\n const response = await this.fetch(this.url, args);\n if (!response) {\n throw new Error('generic-filehandle failed to fetch');\n }\n if (response.status !== 200) {\n throw Object.assign(new Error(`HTTP ${response.status} fetching ${this.url}`), {\n status: response.status,\n });\n }\n if (encoding === 'utf8') {\n return response.text();\n }\n if (encoding) {\n throw new Error(`unsupported encoding: ${encoding}`);\n }\n return this.getBufferFromResponse(response);\n }\n async stat() {\n if (!this._stat) {\n const buf = Buffer.allocUnsafe(10);\n await this.read(buf, 0, 10, 0);\n if (!this._stat) {\n throw new Error(`unable to determine size of file at ${this.url}`);\n }\n }\n return this._stat;\n }\n async close() {\n return;\n }\n}\n//# sourceMappingURL=remoteFile.js.map","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","import { Buffer } from 'buffer';\n//@ts-ignore\nimport { Z_SYNC_FLUSH, Inflate } from 'pako';\n// browserify-zlib, which is the zlib shim used by default in webpacked code,\n// does not properly uncompress bgzf chunks that contain more than\n// one bgzf block, so export an unzip function that uses pako directly\n// if we are running in a browser.\nasync function unzip(inputData) {\n try {\n let strm;\n let pos = 0;\n let i = 0;\n const chunks = [];\n let totalSize = 0;\n let inflator;\n do {\n const remainingInput = inputData.subarray(pos);\n inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n pos += strm.next_in;\n chunks[i] = inflator.result;\n totalSize += chunks[i].length;\n i += 1;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n return Buffer.from(result);\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to pakounzip, except it does extra counting\n// to return the positions of compressed and decompressed\n// data offsets\nasync function unzipChunk(inputData) {\n try {\n let strm;\n let cpos = 0;\n let dpos = 0;\n const blocks = [];\n const cpositions = [];\n const dpositions = [];\n do {\n const remainingInput = inputData.slice(cpos);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = Buffer.from(inflator.result);\n blocks.push(buffer);\n cpositions.push(cpos);\n dpositions.push(dpos);\n cpos += strm.next_in;\n dpos += buffer.length;\n } while (strm.avail_in);\n const buffer = Buffer.concat(blocks);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to unzipChunk above but slices (0,minv.dataPosition) and\n// (maxv.dataPosition,end) off\nasync function unzipChunkSlice(inputData, chunk) {\n try {\n let strm;\n const { minv, maxv } = chunk;\n let cpos = minv.blockPosition;\n let dpos = minv.dataPosition;\n const chunks = [];\n const cpositions = [];\n const dpositions = [];\n let totalSize = 0;\n let i = 0;\n do {\n const remainingInput = inputData.subarray(cpos - minv.blockPosition);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = inflator.result;\n chunks.push(buffer);\n let len = buffer.length;\n cpositions.push(cpos);\n dpositions.push(dpos);\n if (chunks.length === 1 && minv.dataPosition) {\n // this is the first chunk, trim it\n chunks[0] = chunks[0].subarray(minv.dataPosition);\n len = chunks[0].length;\n }\n const origCpos = cpos;\n cpos += strm.next_in;\n dpos += len;\n if (origCpos >= maxv.blockPosition) {\n // this is the last chunk, trim it and stop decompressing\n // note if it is the same block is minv it subtracts that already\n // trimmed part of the slice length\n chunks[i] = chunks[i].subarray(0, maxv.blockPosition === minv.blockPosition\n ? maxv.dataPosition - minv.dataPosition + 1\n : maxv.dataPosition + 1);\n cpositions.push(cpos);\n dpositions.push(dpos);\n totalSize += chunks[i].length;\n break;\n }\n totalSize += chunks[i].length;\n i++;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n const buffer = Buffer.from(result);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\nfunction nodeUnzip() {\n throw new Error('nodeUnzip not implemented.');\n}\nexport { unzip, unzipChunk, unzipChunkSlice, unzip as pakoUnzip, nodeUnzip };\n//# sourceMappingURL=unzip-pako.js.map","module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n","export function longToNumber(long) {\n if (long.greaterThan(Number.MAX_SAFE_INTEGER) ||\n long.lessThan(Number.MIN_SAFE_INTEGER)) {\n throw new Error('integer overflow');\n }\n return long.toNumber();\n}\nclass AbortError extends Error {\n}\n/**\n * Properly check if the given AbortSignal is aborted.\n * Per the standard, if the signal reads as aborted,\n * this function throws either a DOMException AbortError, or a regular error\n * with a `code` attribute set to `ERR_ABORTED`.\n *\n * For convenience, passing `undefined` is a no-op\n *\n * @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute\n * @returns nothing\n */\nexport function checkAbortSignal(signal) {\n if (!signal) {\n return;\n }\n if (signal.aborted) {\n if (typeof DOMException !== 'undefined') {\n // eslint-disable-next-line no-undef\n throw new DOMException('aborted', 'AbortError');\n }\n else {\n const e = new AbortError('aborted');\n e.code = 'ERR_ABORTED';\n throw e;\n }\n }\n}\n/**\n * Skips to the next tick, then runs `checkAbortSignal`.\n * Await this to inside an otherwise synchronous loop to\n * provide a place to break when an abort signal is received.\n * @param {AbortSignal} signal\n */\nexport async function abortBreakPoint(signal) {\n await Promise.resolve();\n checkAbortSignal(signal);\n}\nexport function canMergeBlocks(chunk1, chunk2) {\n return (chunk2.minv.blockPosition - chunk1.maxv.blockPosition < 65000 &&\n chunk2.maxv.blockPosition - chunk1.minv.blockPosition < 5000000);\n}\nexport function optimizeChunks(chunks, lowest) {\n const mergedChunks = [];\n let lastChunk = null;\n if (chunks.length === 0) {\n return chunks;\n }\n chunks.sort(function (c0, c1) {\n const dif = c0.minv.blockPosition - c1.minv.blockPosition;\n if (dif !== 0) {\n return dif;\n }\n else {\n return c0.minv.dataPosition - c1.minv.dataPosition;\n }\n });\n chunks.forEach(chunk => {\n if (!lowest || chunk.maxv.compareTo(lowest) > 0) {\n if (lastChunk === null) {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n else {\n if (canMergeBlocks(lastChunk, chunk)) {\n if (chunk.maxv.compareTo(lastChunk.maxv) > 0) {\n lastChunk.maxv = chunk.maxv;\n }\n }\n else {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n }\n }\n });\n return mergedChunks;\n}\n//# sourceMappingURL=util.js.map","export default class VirtualOffset {\n constructor(blockPosition, dataPosition) {\n this.blockPosition = blockPosition; // < offset of the compressed data block\n this.dataPosition = dataPosition; // < offset into the uncompressed data\n }\n toString() {\n return `${this.blockPosition}:${this.dataPosition}`;\n }\n compareTo(b) {\n return (this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition);\n }\n static min(...args) {\n let min;\n let i = 0;\n for (; !min; i += 1) {\n min = args[i];\n }\n for (; i < args.length; i += 1) {\n if (min.compareTo(args[i]) > 0) {\n min = args[i];\n }\n }\n return min;\n }\n}\nexport function fromBytes(bytes, offset = 0, bigendian = false) {\n if (bigendian) {\n throw new Error('big-endian virtual file offsets not implemented');\n }\n return new VirtualOffset(bytes[offset + 7] * 0x10000000000 +\n bytes[offset + 6] * 0x100000000 +\n bytes[offset + 5] * 0x1000000 +\n bytes[offset + 4] * 0x10000 +\n bytes[offset + 3] * 0x100 +\n bytes[offset + 2], (bytes[offset + 1] << 8) | bytes[offset]);\n}\n//# sourceMappingURL=virtualOffset.js.map","// little class representing a chunk in the index\nexport default class Chunk {\n /**\n * @param {VirtualOffset} minv\n * @param {VirtualOffset} maxv\n * @param {number} bin\n * @param {number} [fetchedSize]\n */\n constructor(minv, maxv, bin, fetchedSize = undefined) {\n this.minv = minv;\n this.maxv = maxv;\n this.bin = bin;\n this._fetchedSize = fetchedSize;\n }\n toUniqueString() {\n return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`;\n }\n toString() {\n return this.toUniqueString();\n }\n compareTo(b) {\n return (this.minv.compareTo(b.minv) ||\n this.maxv.compareTo(b.maxv) ||\n this.bin - b.bin);\n }\n fetchedSize() {\n if (this._fetchedSize !== undefined) {\n return this._fetchedSize;\n }\n return this.maxv.blockPosition + (1 << 16) - this.minv.blockPosition;\n }\n}\n//# sourceMappingURL=chunk.js.map","export default class IndexFile {\n constructor({ filehandle, renameRefSeqs = (n) => n, }) {\n this.filehandle = filehandle;\n this.renameRefSeq = renameRefSeqs;\n }\n async getMetadata(opts = {}) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { indices, ...rest } = await this.parse(opts);\n return rest;\n }\n _findFirstData(currentFdl, virtualOffset) {\n if (currentFdl) {\n return currentFdl.compareTo(virtualOffset) > 0\n ? virtualOffset\n : currentFdl;\n }\n else {\n return virtualOffset;\n }\n }\n async parse(opts = {}) {\n if (!this.parseP) {\n this.parseP = this._parse(opts).catch(e => {\n this.parseP = undefined;\n throw e;\n });\n }\n return this.parseP;\n }\n async hasRefSeq(seqId, opts = {}) {\n return !!((await this.parse(opts)).indices[seqId] || {}).binIndex;\n }\n}\n//# sourceMappingURL=indexFile.js.map","import Long from 'long';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport { longToNumber, optimizeChunks, checkAbortSignal } from './util';\nimport IndexFile from './indexFile';\nconst TBI_MAGIC = 21578324; // TBI\\1\nconst TAD_LIDX_SHIFT = 14;\n/**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\nfunction reg2bins(beg, end) {\n beg += 1; // < convert to 1-based closed\n end -= 1;\n return [\n [0, 0],\n [1 + (beg >> 26), 1 + (end >> 26)],\n [9 + (beg >> 23), 9 + (end >> 23)],\n [73 + (beg >> 20), 73 + (end >> 20)],\n [585 + (beg >> 17), 585 + (end >> 17)],\n [4681 + (beg >> 14), 4681 + (end >> 14)],\n ];\n}\nexport default class TabixIndex extends IndexFile {\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const buf = await this.filehandle.readFile(opts);\n const bytes = await unzip(buf);\n checkAbortSignal(opts.signal);\n // check TBI magic numbers\n if (bytes.readUInt32LE(0) !== TBI_MAGIC /* \"TBI\\1\" */) {\n throw new Error('Not a TBI file');\n // TODO: do we need to support big-endian TBI files?\n }\n // number of reference sequences in the index\n const refCount = bytes.readInt32LE(4);\n const formatFlags = bytes.readInt32LE(8);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const formatOpts = {\n 0: 'generic',\n 1: 'SAM',\n 2: 'VCF',\n };\n const format = formatOpts[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(12),\n start: bytes.readInt32LE(16),\n end: bytes.readInt32LE(20),\n };\n const metaValue = bytes.readInt32LE(24);\n const depth = 5;\n const maxBinNumber = ((1 << ((depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (14 + depth * 3);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(28);\n // read sequence dictionary\n const nameSectionLength = bytes.readInt32LE(32);\n const { refNameToId, refIdToName } = this._parseNameBytes(bytes.slice(36, 36 + nameSectionLength));\n // read the indexes for each reference sequence\n let currOffset = 36 + nameSectionLength;\n let firstDataLine;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats;\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n currOffset += 4;\n if (bin > maxBinNumber + 1) {\n throw new Error('tabix index contains too many bins, please use a CSI index');\n }\n else if (bin === maxBinNumber + 1) {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n if (chunkCount === 2) {\n stats = this.parsePseudoBin(bytes, currOffset);\n }\n currOffset += 16 * chunkCount;\n }\n else {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n firstDataLine = this._findFirstData(firstDataLine, u);\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n // the linear index\n const linearCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const linearIndex = new Array(linearCount);\n for (let k = 0; k < linearCount; k += 1) {\n linearIndex[k] = fromBytes(bytes, currOffset);\n currOffset += 8;\n firstDataLine = this._findFirstData(firstDataLine, linearIndex[k]);\n }\n return { binIndex, linearIndex, stats };\n });\n return {\n indices,\n metaChar,\n maxBinNumber,\n maxRefLength,\n skipLines,\n firstDataLine,\n columnNumbers,\n coordinateType,\n format,\n refIdToName,\n refNameToId,\n maxBlockSize: 1 << 16,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 16, offset + 24), true));\n return { lineCount };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n const minOffset = ba.linearIndex.length\n ? ba.linearIndex[min >> TAD_LIDX_SHIFT >= ba.linearIndex.length\n ? ba.linearIndex.length - 1\n : min >> TAD_LIDX_SHIFT]\n : new VirtualOffset(0, 0);\n if (!minOffset) {\n console.warn('querying outside of possible tabix range');\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n // Use the linear index to find minimum file position of chunks that could\n // contain alignments in the region\n const nintv = ba.linearIndex.length;\n let lowest = null;\n const minLin = Math.min(min >> 14, nintv - 1);\n const maxLin = Math.min(max >> 14, nintv - 1);\n for (let i = minLin; i <= maxLin; ++i) {\n const vp = ba.linearIndex[i];\n if (vp) {\n if (!lowest || vp.compareTo(lowest) < 0) {\n lowest = vp;\n }\n }\n }\n return optimizeChunks(chunks, lowest);\n }\n}\n//# sourceMappingURL=tbi.js.map","import Long from 'long';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { longToNumber, optimizeChunks } from './util';\nimport IndexFile from './indexFile';\nconst CSI1_MAGIC = 21582659; // CSI\\1\nconst CSI2_MAGIC = 38359875; // CSI\\2\nfunction lshift(num, bits) {\n return num * 2 ** bits;\n}\nfunction rshift(num, bits) {\n return Math.floor(num / 2 ** bits);\n}\nexport default class CSI extends IndexFile {\n constructor(args) {\n super(args);\n this.maxBinNumber = 0;\n this.depth = 0;\n this.minShift = 0;\n }\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n async indexCov() {\n throw new Error('CSI indexes do not support indexcov');\n }\n parseAuxData(bytes, offset) {\n const formatFlags = bytes.readInt32LE(offset);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const format = { 0: 'generic', 1: 'SAM', 2: 'VCF' }[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(offset + 4),\n start: bytes.readInt32LE(offset + 8),\n end: bytes.readInt32LE(offset + 12),\n };\n const metaValue = bytes.readInt32LE(offset + 16);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(offset + 20);\n const nameSectionLength = bytes.readInt32LE(offset + 24);\n const { refIdToName, refNameToId } = this._parseNameBytes(bytes.slice(offset + 28, offset + 28 + nameSectionLength));\n return {\n refIdToName,\n refNameToId,\n skipLines,\n metaChar,\n columnNumbers,\n format,\n coordinateType,\n };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const bytes = await unzip((await this.filehandle.readFile(opts)));\n // check TBI magic numbers\n let csiVersion;\n if (bytes.readUInt32LE(0) === CSI1_MAGIC) {\n csiVersion = 1;\n }\n else if (bytes.readUInt32LE(0) === CSI2_MAGIC) {\n csiVersion = 2;\n }\n else {\n throw new Error('Not a CSI file');\n // TODO: do we need to support big-endian CSI files?\n }\n this.minShift = bytes.readInt32LE(4);\n this.depth = bytes.readInt32LE(8);\n this.maxBinNumber = ((1 << ((this.depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (this.minShift + this.depth * 3);\n const auxLength = bytes.readInt32LE(12);\n const aux = auxLength && auxLength >= 30\n ? this.parseAuxData(bytes, 16)\n : {\n refIdToName: [],\n refNameToId: {},\n metaChar: null,\n columnNumbers: { ref: 0, start: 1, end: 2 },\n coordinateType: 'zero-based-half-open',\n format: 'generic',\n };\n const refCount = bytes.readInt32LE(16 + auxLength);\n // read the indexes for each reference sequence\n let firstDataLine;\n let currOffset = 16 + auxLength + 4;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats; // < provided by parsing a pseudo-bin, if present\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n if (bin > this.maxBinNumber) {\n // this is a fake bin that actually has stats information\n // about the reference sequence in it\n stats = this.parsePseudoBin(bytes, currOffset + 4);\n currOffset += 4 + 8 + 4 + 16 + 16;\n }\n else {\n const loffset = fromBytes(bytes, currOffset + 4);\n firstDataLine = this._findFirstData(firstDataLine, loffset);\n const chunkCount = bytes.readInt32LE(currOffset + 12);\n currOffset += 16;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n // this._findFirstData(data, u)\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n return { binIndex, stats };\n });\n return {\n ...aux,\n csi: true,\n refCount,\n maxBlockSize: 1 << 16,\n firstDataLine,\n csiVersion,\n indices,\n depth: this.depth,\n maxBinNumber: this.maxBinNumber,\n maxRefLength,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 28, offset + 36), true));\n return { lineCount };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = this.reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n return optimizeChunks(chunks, new VirtualOffset(0, 0));\n }\n /**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\n reg2bins(beg, end) {\n beg -= 1; // < convert to 1-based closed\n if (beg < 1) {\n beg = 1;\n }\n if (end > 2 ** 50) {\n end = 2 ** 34;\n } // 17 GiB ought to be enough for anybody\n end -= 1;\n let l = 0;\n let t = 0;\n let s = this.minShift + this.depth * 3;\n const bins = [];\n for (; l <= this.depth; s -= 3, t += lshift(1, l * 3), l += 1) {\n const b = t + rshift(beg, s);\n const e = t + rshift(end, s);\n if (e - b + bins.length > this.maxBinNumber) {\n throw new Error(`query ${beg}-${end} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);\n }\n bins.push([b, e]);\n }\n return bins;\n }\n}\n//# sourceMappingURL=csi.js.map","import AbortablePromiseCache from 'abortable-promise-cache';\nimport LRU from 'quick-lru';\nimport { Buffer } from 'buffer';\nimport { LocalFile } from 'generic-filehandle';\nimport { unzip, unzipChunkSlice } from '@gmod/bgzf-filehandle';\nimport { checkAbortSignal } from './util';\nimport TBI from './tbi';\nimport CSI from './csi';\nconst decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8') : undefined;\nfunction timeout(time) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\nexport default class TabixIndexedFile {\n /**\n * @param {object} args\n * @param {string} [args.path]\n * @param {filehandle} [args.filehandle]\n * @param {string} [args.tbiPath]\n * @param {filehandle} [args.tbiFilehandle]\n * @param {string} [args.csiPath]\n * @param {filehandle} [args.csiFilehandle]\n * @param {number} [args.yieldTime] yield to main thread after N milliseconds if reading features is taking a long time to avoid hanging main thread\n * @param {function} [args.renameRefSeqs] optional function with sig `string => string` to transform\n * reference sequence names for the purpose of indexing and querying. note that the data that is returned is\n * not altered, just the names of the reference sequences that are used for querying.\n */\n constructor({ path, filehandle, tbiPath, tbiFilehandle, csiPath, csiFilehandle, yieldTime = 500, chunkSizeLimit = 50000000, renameRefSeqs = n => n, chunkCacheSize = 5 * 2 ** 20, }) {\n if (filehandle) {\n this.filehandle = filehandle;\n }\n else if (path) {\n this.filehandle = new LocalFile(path);\n }\n else {\n throw new TypeError('must provide either filehandle or path');\n }\n if (tbiFilehandle) {\n this.index = new TBI({\n filehandle: tbiFilehandle,\n renameRefSeqs,\n });\n }\n else if (csiFilehandle) {\n this.index = new CSI({\n filehandle: csiFilehandle,\n renameRefSeqs,\n });\n }\n else if (tbiPath) {\n this.index = new TBI({\n filehandle: new LocalFile(tbiPath),\n renameRefSeqs,\n });\n }\n else if (csiPath) {\n this.index = new CSI({\n filehandle: new LocalFile(csiPath),\n renameRefSeqs,\n });\n }\n else if (path) {\n this.index = new TBI({\n filehandle: new LocalFile(`${path}.tbi`),\n renameRefSeqs,\n });\n }\n else {\n throw new TypeError('must provide one of tbiFilehandle, tbiPath, csiFilehandle, or csiPath');\n }\n this.chunkSizeLimit = chunkSizeLimit;\n this.renameRefSeq = renameRefSeqs;\n this.yieldTime = yieldTime;\n this.chunkCache = new AbortablePromiseCache({\n cache: new LRU({ maxSize: Math.floor(chunkCacheSize / (1 << 16)) }),\n fill: (args, signal) => this.readChunk(args, { signal }),\n });\n }\n /**\n * @param refName name of the reference sequence\n * @param start start of the region (in 0-based half-open coordinates)\n * @param end end of the region (in 0-based half-open coordinates)\n * @param opts callback called for each line in the region. can also pass a object param containing obj.lineCallback, obj.signal, etc\n * @returns promise that is resolved when the whole read is finished, rejected on error\n */\n async getLines(refName, start, end, opts) {\n let signal;\n let options = {};\n let callback;\n if (typeof opts === 'undefined') {\n throw new TypeError('line callback must be provided');\n }\n if (typeof opts === 'function') {\n callback = opts;\n }\n else {\n options = opts;\n callback = opts.lineCallback;\n }\n if (refName === undefined) {\n throw new TypeError('must provide a reference sequence name');\n }\n if (!callback) {\n throw new TypeError('line callback must be provided');\n }\n const metadata = await this.index.getMetadata(options);\n checkAbortSignal(signal);\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = metadata.maxRefLength;\n }\n if (!(start <= end)) {\n throw new TypeError('invalid start and end coordinates. start must be less than or equal to end');\n }\n if (start === end) {\n return;\n }\n const chunks = await this.index.blocksForRange(refName, start, end, options);\n checkAbortSignal(signal);\n // check the chunks for any that are over the size limit. if\n // any are, don't fetch any of them\n for (let i = 0; i < chunks.length; i += 1) {\n const size = chunks[i].fetchedSize();\n if (size > this.chunkSizeLimit) {\n throw new Error(`Too much data. Chunk size ${size.toLocaleString()} bytes exceeds chunkSizeLimit of ${this.chunkSizeLimit.toLocaleString()}.`);\n }\n }\n // now go through each chunk and parse and filter the lines out of it\n let last = Date.now();\n for (let chunkNum = 0; chunkNum < chunks.length; chunkNum += 1) {\n let previousStartCoordinate;\n const c = chunks[chunkNum];\n const { buffer, cpositions, dpositions } = await this.chunkCache.get(c.toString(), c);\n checkAbortSignal(signal);\n let blockStart = 0;\n let pos = 0;\n while (blockStart < buffer.length) {\n const n = buffer.indexOf('\\n', blockStart);\n if (n === -1) {\n break;\n }\n const b = buffer.slice(blockStart, n);\n const line = (decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString();\n if (dpositions) {\n while (blockStart + c.minv.dataPosition >= dpositions[pos++]) { }\n pos--;\n }\n // filter the line for whether it is within the requested range\n const { startCoordinate, overlaps } = this.checkLine(metadata, refName, start, end, line);\n // do a small check just to make sure that the lines are really sorted\n // by start coordinate\n if (previousStartCoordinate !== undefined &&\n startCoordinate !== undefined &&\n previousStartCoordinate > startCoordinate) {\n throw new Error(`Lines not sorted by start coordinate (${previousStartCoordinate} > ${startCoordinate}), this file is not usable with Tabix.`);\n }\n previousStartCoordinate = startCoordinate;\n if (overlaps) {\n callback(line.trim(), \n // cpositions[pos] refers to actual file offset of a bgzip block boundaries\n //\n // we multiply by (1 <<8) in order to make sure each block has a \"unique\"\n // address space so that data in that block could never overlap\n //\n // then the blockStart-dpositions is an uncompressed file offset from\n // that bgzip block boundary, and since the cpositions are multiplied by\n // (1 << 8) these uncompressed offsets get a unique space\n cpositions[pos] * (1 << 8) +\n (blockStart - dpositions[pos]) +\n c.minv.dataPosition +\n 1);\n }\n else if (startCoordinate !== undefined && startCoordinate >= end) {\n // the lines were overlapping the region, but now have stopped, so\n // we must be at the end of the relevant data and we can stop\n // processing data now\n return;\n }\n // yield if we have emitted beyond the yield limit\n if (this.yieldTime && last - Date.now() > this.yieldTime) {\n last = Date.now();\n checkAbortSignal(signal);\n await timeout(1);\n }\n blockStart = n + 1;\n }\n }\n }\n async getMetadata(opts = {}) {\n return this.index.getMetadata(opts);\n }\n /**\n * get a buffer containing the \"header\" region of\n * the file, which are the bytes up to the first\n * non-meta line\n */\n async getHeaderBuffer(opts = {}) {\n const { firstDataLine, metaChar, maxBlockSize } = await this.getMetadata(opts);\n checkAbortSignal(opts.signal);\n const maxFetch = ((firstDataLine === null || firstDataLine === void 0 ? void 0 : firstDataLine.blockPosition) || 0) + maxBlockSize;\n // TODO: what if we don't have a firstDataLine, and the header\n // actually takes up more than one block? this case is not covered here\n let bytes = await this._readRegion(0, maxFetch, opts);\n checkAbortSignal(opts.signal);\n try {\n bytes = await unzip(bytes);\n }\n catch (e) {\n console.error(e);\n throw new Error(\n //@ts-ignore\n `error decompressing block ${e.code} at 0 (length ${maxFetch}) ${e}`);\n }\n // trim off lines after the last non-meta line\n if (metaChar) {\n // trim backward from the end\n let lastNewline = -1;\n const newlineByte = '\\n'.charCodeAt(0);\n const metaByte = metaChar.charCodeAt(0);\n for (let i = 0; i < bytes.length; i += 1) {\n if (i === lastNewline + 1 && bytes[i] !== metaByte) {\n break;\n }\n if (bytes[i] === newlineByte) {\n lastNewline = i;\n }\n }\n bytes = bytes.slice(0, lastNewline + 1);\n }\n return bytes;\n }\n /**\n * get a string containing the \"header\" region of the\n * file, is the portion up to the first non-meta line\n *\n * @returns {Promise} for a string\n */\n async getHeader(opts = {}) {\n const bytes = await this.getHeaderBuffer(opts);\n return bytes.toString('utf8');\n }\n /**\n * get an array of reference sequence names, in the order in which\n * they occur in the file. reference sequence renaming is not applied\n * to these names.\n */\n async getReferenceSequenceNames(opts = {}) {\n const metadata = await this.getMetadata(opts);\n return metadata.refIdToName;\n }\n /**\n * @param {object} metadata metadata object from the parsed index,\n * containing columnNumbers, metaChar, and format\n * @param {string} regionRefName\n * @param {number} regionStart region start coordinate (0-based-half-open)\n * @param {number} regionEnd region end coordinate (0-based-half-open)\n * @param {array[string]} line\n * @returns {object} like `{startCoordinate, overlaps}`. overlaps is boolean,\n * true if line is a data line that overlaps the given region\n */\n checkLine(metadata, regionRefName, regionStart, regionEnd, line) {\n const { columnNumbers, metaChar, coordinateType, format } = metadata;\n // skip meta lines\n if (line.charAt(0) === metaChar) {\n return { overlaps: false };\n }\n // check ref/start/end using column metadata from index\n let { ref, start, end } = columnNumbers;\n if (!ref) {\n ref = 0;\n }\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = 0;\n }\n if (format === 'VCF') {\n end = 8;\n }\n const maxColumn = Math.max(ref, start, end);\n // this code is kind of complex, but it is fairly fast.\n // basically, we want to avoid doing a split, because if the lines are really long\n // that could lead to us allocating a bunch of extra memory, which is slow\n let currentColumnNumber = 1; // cols are numbered starting at 1 in the index metadata\n let currentColumnStart = 0;\n let refSeq = '';\n let startCoordinate = -Infinity;\n for (let i = 0; i < line.length + 1; i += 1) {\n if (line[i] === '\\t' || i === line.length) {\n if (currentColumnNumber === ref) {\n if (this.renameRefSeq(line.slice(currentColumnStart, i)) !==\n regionRefName) {\n return { overlaps: false };\n }\n }\n else if (currentColumnNumber === start) {\n startCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n // we convert to 0-based-half-open\n if (coordinateType === '1-based-closed') {\n startCoordinate -= 1;\n }\n if (startCoordinate >= regionEnd) {\n return { startCoordinate, overlaps: false };\n }\n if (end === 0 || end === start) {\n // if we have no end, we assume the feature is 1 bp long\n if (startCoordinate + 1 <= regionStart) {\n return { startCoordinate, overlaps: false };\n }\n }\n }\n else if (format === 'VCF' && currentColumnNumber === 4) {\n refSeq = line.slice(currentColumnStart, i);\n }\n else if (currentColumnNumber === end) {\n let endCoordinate;\n // this will never match if there is no end column\n if (format === 'VCF') {\n endCoordinate = this._getVcfEnd(startCoordinate, refSeq, line.slice(currentColumnStart, i));\n }\n else {\n endCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n }\n if (endCoordinate <= regionStart) {\n return { overlaps: false };\n }\n }\n currentColumnStart = i + 1;\n currentColumnNumber += 1;\n if (currentColumnNumber > maxColumn) {\n break;\n }\n }\n }\n return { startCoordinate, overlaps: true };\n }\n _getVcfEnd(startCoordinate, refSeq, info) {\n let endCoordinate = startCoordinate + refSeq.length;\n // ignore TRA features as they specify CHR2 and END\n // as being on a different chromosome\n // if CHR2 is on the same chromosome, still ignore it\n // because there should be another pairwise feature\n // at the end of this one\n const isTRA = info.indexOf('SVTYPE=TRA') !== -1;\n if (info[0] !== '.' && !isTRA) {\n let prevChar = ';';\n for (let j = 0; j < info.length; j += 1) {\n if (prevChar === ';' && info.slice(j, j + 4) === 'END=') {\n let valueEnd = info.indexOf(';', j);\n if (valueEnd === -1) {\n valueEnd = info.length;\n }\n endCoordinate = parseInt(info.slice(j + 4, valueEnd), 10);\n break;\n }\n prevChar = info[j];\n }\n }\n else if (isTRA) {\n return startCoordinate + 1;\n }\n return endCoordinate;\n }\n /**\n * return the approximate number of data lines in the given reference sequence\n * @param refSeq reference sequence name\n * @returns number of data lines present on that reference sequence\n */\n async lineCount(refName, opts = {}) {\n return this.index.lineCount(refName, opts);\n }\n async _readRegion(pos, size, opts = {}) {\n const b = Buffer.alloc(size);\n const { bytesRead, buffer } = await this.filehandle.read(b, 0, size, pos, opts);\n return buffer.slice(0, bytesRead);\n }\n /**\n * read and uncompress the data in a chunk (composed of one or more\n * contiguous bgzip blocks) of the file\n */\n async readChunk(c, opts = {}) {\n // fetch the uncompressed data, uncompress carefully a block at a time,\n // and stop when done\n const data = await this._readRegion(c.minv.blockPosition, c.fetchedSize(), opts);\n try {\n return unzipChunkSlice(data, c);\n }\n catch (e) {\n throw new Error(`error decompressing c ${c.toString()} ${e}`);\n }\n }\n}\n//# sourceMappingURL=tabixIndexedFile.js.map","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n","module.exports = require('events').EventEmitter;\n","'use strict';\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar _require = require('buffer'),\n Buffer = _require.Buffer;\nvar _require2 = require('util'),\n inspect = _require2.inspect;\nvar custom = inspect && inspect.custom || 'inspect';\nfunction copyBuffer(src, target, offset) {\n Buffer.prototype.copy.call(src, target, offset);\n}\nmodule.exports = /*#__PURE__*/function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n _createClass(BufferList, [{\n key: \"push\",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: \"unshift\",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: \"shift\",\n value: function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: \"join\",\n value: function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n while (p = p.next) ret += s + p.data;\n return ret;\n }\n }, {\n key: \"concat\",\n value: function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n }\n\n // Consumes a specified amount of bytes or characters from the buffered data.\n }, {\n key: \"consume\",\n value: function consume(n, hasStrings) {\n var ret;\n if (n < this.head.data.length) {\n // `slice` is the same for buffers and strings.\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n // First chunk is a perfect match.\n ret = this.shift();\n } else {\n // Result spans more than one buffer.\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n return ret;\n }\n }, {\n key: \"first\",\n value: function first() {\n return this.head.data;\n }\n\n // Consumes a specified amount of characters from the buffered data.\n }, {\n key: \"_getString\",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Consumes a specified amount of bytes from the buffered data.\n }, {\n key: \"_getBuffer\",\n value: function _getBuffer(n) {\n var ret = Buffer.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n this.length -= c;\n return ret;\n }\n\n // Make sure the linked list only shows the minimal necessary information.\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread(_objectSpread({}, options), {}, {\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n }));\n }\n }]);\n return BufferList;\n}();","'use strict';\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n return this;\n}\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};","'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar codes = {};\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inheritsLoose(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n\n return NodeError;\n }(Base);\n\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {\n return 'The value \"' + value + '\" is invalid for option \"' + name + '\"';\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n }\n\n msg += \". Received type \".concat(typeof actual);\n return msg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');\ncreateErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {\n return 'The ' + name + ' method is not implemented';\n});\ncreateErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');\ncreateErrorType('ERR_STREAM_DESTROYED', function (name) {\n return 'Cannot call ' + name + ' after a stream was destroyed';\n});\ncreateErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');\ncreateErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');\ncreateErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');\ncreateErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);\ncreateErrorType('ERR_UNKNOWN_ENCODING', function (arg) {\n return 'Unknown encoding: ' + arg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');\nmodule.exports.codes = codes;\n","'use strict';\n\nvar ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n return Math.floor(hwm);\n }\n\n // Default value\n return state.objectMode ? 16 : 16 * 1024;\n}\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};","\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\nmodule.exports = Writable;\n\n/* */\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n\n/**/\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\nvar Buffer = require('buffer').Buffer;\nvar OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\nvar destroyImpl = require('./internal/streams/destroy');\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nrequire('inherits')(Writable, Stream);\nfunction nop() {}\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'finish' (and potentially 'end')\n this.autoDestroy = !!options.autoDestroy;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex);\n\n // legacy.\n this.writable = true;\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END();\n // TODO: defer error events consistently everywhere, not just the cb\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n return true;\n}\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n return ret;\n}\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n if (entry === null) state.lastBufferedRequest = null;\n }\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\nWritable.prototype._writev = null;\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n errorOrDestroy(stream, err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n return need;\n}\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n\n // reuse the free corkReq.\n state.corkedRequestsFree.next = corkReq;\n}\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n};\n/**/\n\nmodule.exports = Duplex;\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\nrequire('inherits')(Duplex, Readable);\n{\n // Allow the keys array to be GC'ed.\n var keys = objectKeys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n process.nextTick(onEndNT, this);\n}\nfunction onEndNT(self) {\n self.end();\n}\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});","/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\n/**/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}","// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n\n'use strict';\n\nvar ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n callback.apply(this, args);\n };\n}\nfunction noop() {}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n var writableEnded = stream._writableState && stream._writableState.finished;\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n var onclose = function onclose() {\n var err;\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\nmodule.exports = eos;","'use strict';\n\nvar _Object$setPrototypeO;\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar finished = require('./end-of-stream');\nvar kLastResolve = Symbol('lastResolve');\nvar kLastReject = Symbol('lastReject');\nvar kError = Symbol('error');\nvar kEnded = Symbol('ended');\nvar kLastPromise = Symbol('lastPromise');\nvar kHandlePromise = Symbol('handlePromise');\nvar kStream = Symbol('stream');\nfunction createIterResult(value, done) {\n return {\n value: value,\n done: done\n };\n}\nfunction readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n if (resolve !== null) {\n var data = iter[kStream].read();\n // we defer if data is null\n // we can be expecting either 'end' or\n // 'error'\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n}\nfunction onReadable(iter) {\n // we wait for the next tick, because it might\n // emit an error with process.nextTick\n process.nextTick(readAndResolve, iter);\n}\nfunction wrapForNext(lastPromise, iter) {\n return function (resolve, reject) {\n lastPromise.then(function () {\n if (iter[kEnded]) {\n resolve(createIterResult(undefined, true));\n return;\n }\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n}\nvar AsyncIteratorPrototype = Object.getPrototypeOf(function () {});\nvar ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n next: function next() {\n var _this = this;\n // if we have detected an error in the meanwhile\n // reject straight away\n var error = this[kError];\n if (error !== null) {\n return Promise.reject(error);\n }\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(undefined, true));\n }\n if (this[kStream].destroyed) {\n // We need to defer via nextTick because if .destroy(err) is\n // called, the error will be emitted via nextTick, and\n // we cannot guarantee that there is no error lingering around\n // waiting to be emitted.\n return new Promise(function (resolve, reject) {\n process.nextTick(function () {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(undefined, true));\n }\n });\n });\n }\n\n // if we have multiple next() calls\n // we will wait for the previous Promise to finish\n // this logic is optimized to support for await loops,\n // where next() is only called once at a time\n var lastPromise = this[kLastPromise];\n var promise;\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n // fast path needed to support multiple this.push()\n // without triggering the next() queue\n var data = this[kStream].read();\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n promise = new Promise(this[kHandlePromise]);\n }\n this[kLastPromise] = promise;\n return promise;\n }\n}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {\n return this;\n}), _defineProperty(_Object$setPrototypeO, \"return\", function _return() {\n var _this2 = this;\n // destroy(err, cb) is a private API\n // we can guarantee we have that here, because we control the\n // Readable class this is attached to\n return new Promise(function (resolve, reject) {\n _this2[kStream].destroy(null, function (err) {\n if (err) {\n reject(err);\n return;\n }\n resolve(createIterResult(undefined, true));\n });\n });\n}), _Object$setPrototypeO), AsyncIteratorPrototype);\nvar createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {\n var _Object$create;\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function (err) {\n if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n var reject = iterator[kLastReject];\n // reject if we are waiting for data in the Promise\n // returned by next() and store the error\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n iterator[kError] = err;\n return;\n }\n var resolve = iterator[kLastResolve];\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(undefined, true));\n }\n iterator[kEnded] = true;\n });\n stream.on('readable', onReadable.bind(null, iterator));\n return iterator;\n};\nmodule.exports = createReadableStreamAsyncIterator;","module.exports = function () {\n throw new Error('Readable.from is not available in the browser')\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nmodule.exports = Readable;\n\n/**/\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n\n/**/\nvar EE = require('events').EventEmitter;\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\nvar Buffer = require('buffer').Buffer;\nvar OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/**/\nvar debugUtil = require('util');\nvar debug;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\nvar BufferList = require('./internal/streams/buffer_list');\nvar destroyImpl = require('./internal/streams/destroy');\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;\n\n// Lazy loaded to improve the startup performance.\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\nrequire('inherits')(Readable, Stream);\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true;\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = options.emitClose !== false;\n\n // Should .destroy() be called after 'end' (and potentially 'finish')\n this.autoDestroy = !!options.autoDestroy;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options);\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex);\n\n // legacy\n this.readable = true;\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n Stream.call(this);\n}\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n }\n\n // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n return er;\n}\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder;\n // If setEncoding(null), decoder.encoding equals utf8\n this._readableState.encoding = this._readableState.decoder.encoding;\n\n // Iterate over current buffer to convert already stored Buffers:\n var p = this._readableState.buffer.head;\n var content = '';\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n this._readableState.buffer.clear();\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n};\n\n// Don't raise the hwm > 1GB\nvar MAX_HWM = 0x40000000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n }\n\n // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n return dest;\n};\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0;\n\n // Try start flowing on next tick if stream isn't explicitly paused\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n return res;\n};\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true;\n\n // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n state.paused = false;\n return this;\n};\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n if (!state.reading) {\n stream.read(0);\n }\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n this._readableState.paused = true;\n return this;\n};\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null);\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n return this;\n};\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');\n }\n return createReadableStreamAsyncIterator(this);\n };\n}\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n});\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length);\n\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = require('./internal/streams/from');\n }\n return from(Readable, iterable, opts);\n };\n}\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\nvar _require$codes = require('../errors').codes,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\nvar Duplex = require('./_stream_duplex');\nrequire('inherits')(Transform, Duplex);\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null)\n // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\nfunction prefinish() {\n var _this = this;\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null)\n // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict';\n\nmodule.exports = PassThrough;\nvar Transform = require('./_stream_transform');\nrequire('inherits')(PassThrough, Transform);\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n Transform.call(this, options);\n}\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};","// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n\n'use strict';\n\nvar eos;\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n callback.apply(void 0, arguments);\n };\n}\nvar _require$codes = require('../../../errors').codes,\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\nfunction noop(err) {\n // Rethrow the error if it exists to avoid swallowing it\n if (err) throw err;\n}\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\nfunction destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on('close', function () {\n closed = true;\n });\n if (eos === undefined) eos = require('./end-of-stream');\n eos(stream, {\n readable: reading,\n writable: writing\n }, function (err) {\n if (err) return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function (err) {\n if (closed) return;\n if (destroyed) return;\n destroyed = true;\n\n // request.destroy just do .end - .abort is what we want\n if (isRequest(stream)) return stream.abort();\n if (typeof stream.destroy === 'function') return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED('pipe'));\n };\n}\nfunction call(fn) {\n fn();\n}\nfunction pipe(from, to) {\n return from.pipe(to);\n}\nfunction popCallback(streams) {\n if (!streams.length) return noop;\n if (typeof streams[streams.length - 1] !== 'function') return noop;\n return streams.pop();\n}\nfunction pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n var callback = popCallback(streams);\n if (Array.isArray(streams[0])) streams = streams[0];\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams');\n }\n var error;\n var destroys = streams.map(function (stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function (err) {\n if (!error) error = err;\n if (err) destroys.forEach(call);\n if (reading) return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n}\nmodule.exports = pipeline;","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = require('events').EventEmitter;\nvar inherits = require('inherits');\n\ninherits(Stream, EE);\nStream.Readable = require('readable-stream/lib/_stream_readable.js');\nStream.Writable = require('readable-stream/lib/_stream_writable.js');\nStream.Duplex = require('readable-stream/lib/_stream_duplex.js');\nStream.Transform = require('readable-stream/lib/_stream_transform.js');\nStream.PassThrough = require('readable-stream/lib/_stream_passthrough.js');\nStream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js')\nStream.pipeline = require('readable-stream/lib/internal/streams/pipeline.js')\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n","// Fast, low-level functions for parsing and formatting GFF3.\n// JavaScript port of Robert Buels's Bio::GFF3::LowLevel Perl module.\n/**\n * Unescape a string value used in a GFF3 attribute.\n *\n * @param stringVal - Escaped GFF3 string value\n * @returns An unescaped string value\n */\nexport function unescape(stringVal) {\n return stringVal.replace(/%([0-9A-Fa-f]{2})/g, (_match, seq) => String.fromCharCode(parseInt(seq, 16)));\n}\nfunction _escape(regex, s) {\n return String(s).replace(regex, (ch) => {\n const hex = ch.charCodeAt(0).toString(16).toUpperCase().padStart(2, '0');\n return `%${hex}`;\n });\n}\n/**\n * Escape a value for use in a GFF3 attribute value.\n *\n * @param rawVal - Raw GFF3 attribute value\n * @returns An escaped string value\n */\nexport function escape(rawVal) {\n return _escape(/[\\n;\\r\\t=%&,\\x00-\\x1f\\x7f-\\xff]/g, rawVal);\n}\n/**\n * Escape a value for use in a GFF3 column value.\n *\n * @param rawVal - Raw GFF3 column value\n * @returns An escaped column value\n */\nexport function escapeColumn(rawVal) {\n return _escape(/[\\n\\r\\t%\\x00-\\x1f\\x7f-\\xff]/g, rawVal);\n}\n/**\n * Parse the 9th column (attributes) of a GFF3 feature line.\n *\n * @param attrString - String of GFF3 9th column\n * @returns Parsed attributes\n */\nexport function parseAttributes(attrString) {\n if (!(attrString && attrString.length) || attrString === '.')\n return {};\n const attrs = {};\n attrString\n .replace(/\\r?\\n$/, '')\n .split(';')\n .forEach((a) => {\n const nv = a.split('=', 2);\n if (!(nv[1] && nv[1].length))\n return;\n nv[0] = nv[0].trim();\n let arec = attrs[nv[0].trim()];\n if (!arec) {\n arec = [];\n attrs[nv[0]] = arec;\n }\n arec.push(...nv[1]\n .split(',')\n .map((s) => s.trim())\n .map(unescape));\n });\n return attrs;\n}\n/**\n * Parse a GFF3 feature line\n *\n * @param line - GFF3 feature line\n * @returns The parsed feature\n */\nexport function parseFeature(line) {\n // split the line into columns and replace '.' with null in each column\n const f = line.split('\\t').map((a) => (a === '.' || a === '' ? null : a));\n // unescape only the ref, source, and type columns\n const parsed = {\n seq_id: f[0] && unescape(f[0]),\n source: f[1] && unescape(f[1]),\n type: f[2] && unescape(f[2]),\n start: f[3] === null ? null : parseInt(f[3], 10),\n end: f[4] === null ? null : parseInt(f[4], 10),\n score: f[5] === null ? null : parseFloat(f[5]),\n strand: f[6],\n phase: f[7],\n attributes: f[8] === null ? null : parseAttributes(f[8]),\n };\n return parsed;\n}\n/**\n * Parse a GFF3 directive line.\n *\n * @param line - GFF3 directive line\n * @returns The parsed directive\n */\nexport function parseDirective(line) {\n const match = /^\\s*##\\s*(\\S+)\\s*(.*)/.exec(line);\n if (!match)\n return null;\n const [, name] = match;\n let [, , contents] = match;\n const parsed = { directive: name };\n if (contents.length) {\n contents = contents.replace(/\\r?\\n$/, '');\n parsed.value = contents;\n }\n // do a little additional parsing for sequence-region and genome-build directives\n if (name === 'sequence-region') {\n const c = contents.split(/\\s+/, 3);\n return {\n ...parsed,\n seq_id: c[0],\n start: c[1] && c[1].replace(/\\D/g, ''),\n end: c[2] && c[2].replace(/\\D/g, ''),\n };\n }\n else if (name === 'genome-build') {\n const [source, buildName] = contents.split(/\\s+/, 2);\n return {\n ...parsed,\n source,\n buildName,\n };\n }\n return parsed;\n}\n/**\n * Format an attributes object into a string suitable for the 9th column of GFF3.\n *\n * @param attrs - Attributes\n * @returns GFF3 9th column string\n */\nexport function formatAttributes(attrs) {\n const attrOrder = [];\n Object.entries(attrs).forEach(([tag, val]) => {\n if (!val)\n return;\n let valstring;\n if (val.hasOwnProperty('toString')) {\n valstring = escape(val.toString());\n // } else if (Array.isArray(val.values)) {\n // valstring = val.values.map(escape).join(',')\n }\n else if (Array.isArray(val)) {\n valstring = val.map(escape).join(',');\n }\n else {\n valstring = escape(val);\n }\n attrOrder.push(`${escape(tag)}=${valstring}`);\n });\n return attrOrder.length ? attrOrder.join(';') : '.';\n}\nfunction _formatSingleFeature(f, seenFeature) {\n const attrString = f.attributes === null || f.attributes === undefined\n ? '.'\n : formatAttributes(f.attributes);\n const fields = [\n f.seq_id === null ? '.' : escapeColumn(f.seq_id),\n f.source === null ? '.' : escapeColumn(f.source),\n f.type === null ? '.' : escapeColumn(f.type),\n f.start === null ? '.' : escapeColumn(f.start),\n f.end === null ? '.' : escapeColumn(f.end),\n f.score === null ? '.' : escapeColumn(f.score),\n f.strand === null ? '.' : escapeColumn(f.strand),\n f.phase === null ? '.' : escapeColumn(f.phase),\n attrString,\n ];\n const formattedString = `${fields.join('\\t')}\\n`;\n // if we have already output this exact feature, skip it\n if (seenFeature[formattedString]) {\n return '';\n }\n seenFeature[formattedString] = true;\n return formattedString;\n}\nfunction _formatFeature(feature, seenFeature) {\n if (Array.isArray(feature)) {\n return feature.map((f) => _formatFeature(f, seenFeature)).join('');\n }\n const strings = [_formatSingleFeature(feature, seenFeature)];\n if (_isFeatureLineWithRefs(feature)) {\n strings.push(...feature.child_features.map((f) => _formatFeature(f, seenFeature)), ...feature.derived_features.map((f) => _formatFeature(f, seenFeature)));\n }\n return strings.join('');\n}\n/**\n * Format a feature object or array of feature objects into one or more lines of\n * GFF3.\n *\n * @param featureOrFeatures - A feature object or array of feature objects\n * @returns A string of one or more GFF3 lines\n */\nexport function formatFeature(featureOrFeatures) {\n const seen = {};\n return _formatFeature(featureOrFeatures, seen);\n}\n/**\n * Format a directive into a line of GFF3.\n *\n * @param directive - A directive object\n * @returns A directive line string\n */\nexport function formatDirective(directive) {\n let str = `##${directive.directive}`;\n if (directive.value)\n str += ` ${directive.value}`;\n str += '\\n';\n return str;\n}\n/**\n * Format a comment into a GFF3 comment.\n * Yes I know this is just adding a # and a newline.\n *\n * @param comment - A comment object\n * @returns A comment line string\n */\nexport function formatComment(comment) {\n return `# ${comment.comment}\\n`;\n}\n/**\n * Format a sequence object as FASTA\n *\n * @param seq - A sequence object\n * @returns Formatted single FASTA sequence string\n */\nexport function formatSequence(seq) {\n return `>${seq.id}${seq.description ? ` ${seq.description}` : ''}\\n${seq.sequence}\\n`;\n}\n/**\n * Format a directive, comment, sequence, or feature, or array of such items,\n * into one or more lines of GFF3.\n *\n * @param itemOrItems - A comment, sequence, or feature, or array of such items\n * @returns A formatted string or array of strings\n */\nexport function formatItem(itemOrItems) {\n function formatSingleItem(item) {\n if ('attributes' in item)\n return formatFeature(item);\n if ('directive' in item)\n return formatDirective(item);\n if ('sequence' in item)\n return formatSequence(item);\n if ('comment' in item)\n return formatComment(item);\n return '# (invalid item found during format)\\n';\n }\n if (Array.isArray(itemOrItems)) {\n return itemOrItems.map(formatSingleItem);\n }\n return formatSingleItem(itemOrItems);\n}\nfunction _isFeatureLineWithRefs(featureLine) {\n return (featureLine.child_features !== undefined &&\n featureLine.derived_features !== undefined);\n}\n//# sourceMappingURL=util.js.map","import * as GFF3 from './util';\nconst containerAttributes = {\n Parent: 'child_features',\n Derives_from: 'derived_features',\n};\nexport class FASTAParser {\n constructor(seqCallback) {\n this.seqCallback = seqCallback;\n this.currentSequence = undefined;\n }\n addLine(line) {\n const defMatch = /^>\\s*(\\S+)\\s*(.*)/.exec(line);\n if (defMatch) {\n this._flush();\n this.currentSequence = { id: defMatch[1], sequence: '' };\n if (defMatch[2])\n this.currentSequence.description = defMatch[2].trim();\n }\n else if (this.currentSequence && /\\S/.test(line)) {\n this.currentSequence.sequence += line.replace(/\\s/g, '');\n }\n }\n _flush() {\n if (this.currentSequence)\n this.seqCallback(this.currentSequence);\n }\n finish() {\n this._flush();\n }\n}\nexport default class Parser {\n constructor(args) {\n this.fastaParser = undefined;\n // if this is true, the parser ignores the\n // rest of the lines in the file. currently\n // set when the file switches over to FASTA\n this.eof = false;\n this.lineNumber = 0;\n // features that we have to keep on hand for now because they\n // might be referenced by something else\n this._underConstructionTopLevel = [];\n // index of the above by ID\n this._underConstructionById = {};\n this._completedReferences = {};\n // features that reference something we have not seen yet\n // structured as:\n // { 'some_id' : {\n // 'Parent' : [ orphans that have a Parent attr referencing it ],\n // 'Derives_from' : [ orphans that have a Derives_from attr referencing it ],\n // }\n // }\n this._underConstructionOrphans = {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const nullFunc = () => { };\n this.featureCallback = args.featureCallback || nullFunc;\n this.endCallback = args.endCallback || nullFunc;\n this.commentCallback = args.commentCallback || nullFunc;\n this.errorCallback = args.errorCallback || nullFunc;\n this.directiveCallback = args.directiveCallback || nullFunc;\n this.sequenceCallback = args.sequenceCallback || nullFunc;\n this.disableDerivesFromReferences =\n args.disableDerivesFromReferences || false;\n // number of lines to buffer\n this.bufferSize = args.bufferSize === undefined ? 1000 : args.bufferSize;\n }\n addLine(line) {\n // if we have transitioned to a fasta section, just delegate to that parser\n if (this.fastaParser) {\n this.fastaParser.addLine(line);\n return;\n }\n if (this.eof) {\n // otherwise, if we are done, ignore this line\n return;\n }\n this.lineNumber += 1;\n if (/^\\s*[^#\\s>]/.test(line)) {\n // feature line, most common case\n this._bufferLine(line);\n return;\n }\n const match = /^\\s*(#+)(.*)/.exec(line);\n if (match) {\n // directive or comment\n const [, hashsigns] = match;\n let [, , contents] = match;\n if (hashsigns.length === 3) {\n // sync directive, all forward-references are resolved.\n this._emitAllUnderConstructionFeatures();\n }\n else if (hashsigns.length === 2) {\n const directive = GFF3.parseDirective(line);\n if (directive) {\n if (directive.directive === 'FASTA') {\n this._emitAllUnderConstructionFeatures();\n this.eof = true;\n this.fastaParser = new FASTAParser(this.sequenceCallback);\n }\n else {\n this._emitItem(directive);\n }\n }\n }\n else {\n contents = contents.replace(/\\s*/, '');\n this._emitItem({ comment: contents });\n }\n }\n else if (/^\\s*$/.test(line)) {\n // blank line, do nothing\n }\n else if (/^\\s*>/.test(line)) {\n // implicit beginning of a FASTA section\n this._emitAllUnderConstructionFeatures();\n this.eof = true;\n this.fastaParser = new FASTAParser(this.sequenceCallback);\n this.fastaParser.addLine(line);\n }\n else {\n // it's a parse error\n const errLine = line.replace(/\\r?\\n?$/g, '');\n throw new Error(`GFF3 parse error. Cannot parse '${errLine}'.`);\n }\n }\n finish() {\n this._emitAllUnderConstructionFeatures();\n if (this.fastaParser)\n this.fastaParser.finish();\n this.endCallback();\n }\n _emitItem(i) {\n if (Array.isArray(i))\n this.featureCallback(i);\n else if ('directive' in i)\n this.directiveCallback(i);\n else if ('comment' in i)\n this.commentCallback(i);\n }\n _enforceBufferSizeLimit(additionalItemCount = 0) {\n const _unbufferItem = (item) => {\n if (item &&\n Array.isArray(item) &&\n item[0].attributes &&\n item[0].attributes.ID &&\n item[0].attributes.ID[0]) {\n const ids = item[0].attributes.ID;\n ids.forEach((id) => {\n delete this._underConstructionById[id];\n delete this._completedReferences[id];\n });\n item.forEach((i) => {\n if (i.child_features)\n i.child_features.forEach((c) => _unbufferItem(c));\n if (i.derived_features)\n i.derived_features.forEach((d) => _unbufferItem(d));\n });\n }\n };\n while (this._underConstructionTopLevel.length + additionalItemCount >\n this.bufferSize) {\n const item = this._underConstructionTopLevel.shift();\n if (item) {\n this._emitItem(item);\n _unbufferItem(item);\n }\n }\n }\n /**\n * return all under-construction features, called when we know\n * there will be no additional data to attach to them\n */\n _emitAllUnderConstructionFeatures() {\n this._underConstructionTopLevel.forEach(this._emitItem.bind(this));\n this._underConstructionTopLevel = [];\n this._underConstructionById = {};\n this._completedReferences = {};\n // if we have any orphans hanging around still, this is a\n // problem. die with a parse error\n if (Array.from(Object.values(this._underConstructionOrphans)).length) {\n throw new Error(`some features reference other features that do not exist in the file (or in the same '###' scope). ${Object.keys(this._underConstructionOrphans)}`);\n }\n }\n // do the right thing with a newly-parsed feature line\n _bufferLine(line) {\n var _a, _b, _c;\n const rawFeatureLine = GFF3.parseFeature(line);\n const featureLine = {\n ...rawFeatureLine,\n child_features: [],\n derived_features: [],\n };\n // featureLine._lineNumber = this.lineNumber //< debugging aid\n // NOTE: a feature is an arrayref of one or more feature lines.\n const ids = ((_a = featureLine.attributes) === null || _a === void 0 ? void 0 : _a.ID) || [];\n const parents = ((_b = featureLine.attributes) === null || _b === void 0 ? void 0 : _b.Parent) || [];\n const derives = this.disableDerivesFromReferences\n ? []\n : ((_c = featureLine.attributes) === null || _c === void 0 ? void 0 : _c.Derives_from) || [];\n if (!ids.length && !parents.length && !derives.length) {\n // if it has no IDs and does not refer to anything, we can just\n // output it\n this._emitItem([featureLine]);\n return;\n }\n let feature = undefined;\n ids.forEach((id) => {\n const existing = this._underConstructionById[id];\n if (existing) {\n // another location of the same feature\n if (existing[existing.length - 1].type !== featureLine.type) {\n this._parseError(`multi-line feature \"${id}\" has inconsistent types: \"${featureLine.type}\", \"${existing[existing.length - 1].type}\"`);\n }\n existing.push(featureLine);\n feature = existing;\n }\n else {\n // haven't seen it yet, so buffer it so we can attach\n // child features to it\n feature = [featureLine];\n this._enforceBufferSizeLimit(1);\n if (!parents.length && !derives.length) {\n this._underConstructionTopLevel.push(feature);\n }\n this._underConstructionById[id] = feature;\n // see if we have anything buffered that refers to it\n this._resolveReferencesTo(feature, id);\n }\n });\n // try to resolve all its references\n this._resolveReferencesFrom(feature || [featureLine], { Parent: parents, Derives_from: derives }, ids);\n }\n _resolveReferencesTo(feature, id) {\n const references = this._underConstructionOrphans[id];\n // references is of the form\n // {\n // 'Parent' : [ orphans that have a Parent attr referencing this feature ],\n // 'Derives_from' : [ orphans that have a Derives_from attr referencing this feature ],\n // }\n if (!references)\n return;\n feature.forEach((loc) => {\n loc.child_features.push(...references.Parent);\n });\n feature.forEach((loc) => {\n loc.derived_features.push(...references.Derives_from);\n });\n delete this._underConstructionOrphans[id];\n }\n _parseError(message) {\n this.eof = true;\n this.errorCallback(`${this.lineNumber}: ${message}`);\n }\n _resolveReferencesFrom(feature, references, ids) {\n // this is all a bit more awkward in javascript than it was in perl\n function postSet(obj, slot1, slot2) {\n let subObj = obj[slot1];\n if (!subObj) {\n subObj = {};\n obj[slot1] = subObj;\n }\n const returnVal = subObj[slot2] || false;\n subObj[slot2] = true;\n return returnVal;\n }\n references.Parent.forEach((toId) => {\n const otherFeature = this._underConstructionById[toId];\n if (otherFeature) {\n const pname = containerAttributes.Parent;\n if (!ids.filter((id) => postSet(this._completedReferences, id, `Parent,${toId}`)).length) {\n otherFeature.forEach((location) => {\n location[pname].push(feature);\n });\n }\n }\n else {\n let ref = this._underConstructionOrphans[toId];\n if (!ref) {\n ref = {\n Parent: [],\n Derives_from: [],\n };\n this._underConstructionOrphans[toId] = ref;\n }\n ref.Parent.push(feature);\n }\n });\n references.Derives_from.forEach((toId) => {\n const otherFeature = this._underConstructionById[toId];\n if (otherFeature) {\n const pname = containerAttributes.Derives_from;\n if (!ids.filter((id) => postSet(this._completedReferences, id, `Derives_from,${toId}`)).length) {\n otherFeature.forEach((location) => {\n location[pname].push(feature);\n });\n }\n }\n else {\n let ref = this._underConstructionOrphans[toId];\n if (!ref) {\n ref = {\n Parent: [],\n Derives_from: [],\n };\n this._underConstructionOrphans[toId] = ref;\n }\n ref.Derives_from.push(feature);\n }\n });\n }\n}\n//# sourceMappingURL=parse.js.map","import { Transform } from 'stream';\nimport { StringDecoder as Decoder } from 'string_decoder';\nimport Parser from './parse';\nimport { formatItem, formatSequence, } from './util';\n// call a callback on the next process tick if running in\n// an environment that supports it\nfunction _callback(callback) {\n if (process && process.nextTick)\n process.nextTick(callback);\n else\n callback();\n}\n// shared arg processing for the parse routines\nfunction _processParseOptions(options) {\n const out = {\n encoding: 'utf8',\n parseFeatures: true,\n parseDirectives: false,\n parseSequences: true,\n parseComments: false,\n bufferSize: 1000,\n disableDerivesFromReferences: false,\n ...options,\n };\n if (options.parseAll) {\n out.parseFeatures = true;\n out.parseDirectives = true;\n out.parseComments = true;\n out.parseSequences = true;\n }\n return out;\n}\nclass GFFTransform extends Transform {\n constructor(inputOptions = {}) {\n super({ objectMode: true });\n this.textBuffer = '';\n const options = _processParseOptions(inputOptions);\n this.encoding = inputOptions.encoding || 'utf8';\n this.decoder = new Decoder();\n const push = this.push.bind(this);\n this.parser = new Parser({\n featureCallback: options.parseFeatures ? push : undefined,\n directiveCallback: options.parseDirectives ? push : undefined,\n commentCallback: options.parseComments ? push : undefined,\n sequenceCallback: options.parseSequences ? push : undefined,\n errorCallback: (err) => this.emit('error', err),\n bufferSize: options.bufferSize,\n disableDerivesFromReferences: options.disableDerivesFromReferences,\n });\n }\n _addLine(data) {\n if (data) {\n this.parser.addLine(data);\n }\n }\n _nextText(buffer) {\n const pieces = (this.textBuffer + buffer).split(/\\r?\\n/);\n this.textBuffer = pieces.pop() || '';\n pieces.forEach((piece) => this._addLine(piece));\n }\n _transform(chunk, _encoding, callback) {\n this._nextText(this.decoder.write(chunk));\n _callback(callback);\n }\n _flush(callback) {\n if (this.decoder.end)\n this._nextText(this.decoder.end());\n if (this.textBuffer != null)\n this._addLine(this.textBuffer);\n this.parser.finish();\n _callback(callback);\n }\n}\n/**\n * Parse a stream of text data into a stream of feature, directive, comment,\n * an sequence objects.\n *\n * @param options - Parsing options\n * @returns stream (in objectMode) of parsed items\n */\nexport function parseStream(options = {}) {\n return new GFFTransform(options);\n}\nexport function parseStringSync(str, inputOptions = {}) {\n if (!str)\n return [];\n const options = _processParseOptions(inputOptions);\n const items = [];\n const push = items.push.bind(items);\n const parser = new Parser({\n featureCallback: options.parseFeatures ? push : undefined,\n directiveCallback: options.parseDirectives ? push : undefined,\n commentCallback: options.parseComments ? push : undefined,\n sequenceCallback: options.parseSequences ? push : undefined,\n disableDerivesFromReferences: options.disableDerivesFromReferences || false,\n bufferSize: Infinity,\n errorCallback: (err) => {\n throw err;\n },\n });\n str.split(/\\r?\\n/).forEach(parser.addLine.bind(parser));\n parser.finish();\n return items;\n}\n/**\n * Format an array of GFF3 items (features,directives,comments) into string of\n * GFF3. Does not insert synchronization (###) marks.\n *\n * @param items - Array of features, directives, comments and/or sequences\n * @returns the formatted GFF3\n */\nexport function formatSync(items) {\n // sort items into seq and other\n const other = [];\n const sequences = [];\n items.forEach((i) => {\n if ('sequence' in i)\n sequences.push(i);\n else\n other.push(i);\n });\n let str = other.map(formatItem).join('');\n if (sequences.length) {\n str += '##FASTA\\n';\n str += sequences.map(formatSequence).join('');\n }\n return str;\n}\nclass FormattingTransform extends Transform {\n constructor(options = {}) {\n super(Object.assign(options, { objectMode: true }));\n this.linesSinceLastSyncMark = 0;\n this.haveWeEmittedData = false;\n this.fastaMode = false;\n this.minLinesBetweenSyncMarks = options.minSyncLines || 100;\n this.insertVersionDirective = options.insertVersionDirective || false;\n }\n _transform(chunk, _encoding, callback) {\n // if we have not emitted anything yet, and this first\n // chunk is not a gff-version directive, emit one\n let str;\n if (!this.haveWeEmittedData && this.insertVersionDirective) {\n const thisChunk = Array.isArray(chunk) ? chunk[0] : chunk;\n if ('directive' in thisChunk) {\n if (thisChunk.directive !== 'gff-version') {\n this.push('##gff-version 3\\n');\n }\n }\n }\n // if it's a sequence chunk coming down, emit a FASTA directive and\n // change to FASTA mode\n if ('sequence' in chunk && !this.fastaMode) {\n this.push('##FASTA\\n');\n this.fastaMode = true;\n }\n if (Array.isArray(chunk))\n str = chunk.map(formatItem).join('');\n else\n str = formatItem(chunk);\n this.push(str);\n if (this.linesSinceLastSyncMark >= this.minLinesBetweenSyncMarks) {\n this.push('###\\n');\n this.linesSinceLastSyncMark = 0;\n }\n else {\n // count the number of newlines in this chunk\n let count = 0;\n for (let i = 0; i < str.length; i += 1) {\n if (str[i] === '\\n')\n count += 1;\n }\n this.linesSinceLastSyncMark += count;\n }\n this.haveWeEmittedData = true;\n _callback(callback);\n }\n}\n/**\n * Format a stream of features, directives, comments and/or sequences into a\n * stream of GFF3 text.\n *\n * Inserts synchronization (###) marks automatically.\n *\n * @param options - parser options\n */\nexport function formatStream(options = {}) {\n return new FormattingTransform(options);\n}\n/**\n * Format a stream of features, directives, comments and/or sequences into a\n * GFF3 file and write it to the filesystem.\n\n * Inserts synchronization (###) marks and a ##gff-version\n * directive automatically (if one is not already present).\n *\n * @param stream - the stream to write to the file\n * @param filename - the file path to write to\n * @param options - parser options\n * @returns promise for null that resolves when the stream has been written\n */\nexport function formatFile(stream, writeStream, options = {}) {\n const newOptions = {\n insertVersionDirective: true,\n ...options,\n };\n return new Promise((resolve, reject) => {\n stream\n .pipe(new FormattingTransform(newOptions))\n .on('end', () => resolve(null))\n .on('error', reject)\n .pipe(writeStream);\n });\n}\n//# sourceMappingURL=api.js.map","import { parseStream, parseStringSync, formatSync, formatStream, formatFile, } from './api';\nimport * as util from './util';\nexport default {\n parseStream,\n parseStringSync,\n formatSync,\n formatStream,\n formatFile,\n util,\n};\n//# sourceMappingURL=index.js.map","'use strict';\n\nmodule.exports = value => {\n\tif (!value) {\n\t\treturn false;\n\t}\n\n\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\tif (typeof Symbol.observable === 'symbol' && typeof value[Symbol.observable] === 'function') {\n\t\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\t\treturn value === value[Symbol.observable]();\n\t}\n\n\tif (typeof value['@@observable'] === 'function') {\n\t\treturn value === value['@@observable']();\n\t}\n\n\treturn false;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultSerializer = exports.extendSerializer = void 0;\nfunction extendSerializer(extend, implementation) {\n const fallbackDeserializer = extend.deserialize.bind(extend);\n const fallbackSerializer = extend.serialize.bind(extend);\n return {\n deserialize(message) {\n return implementation.deserialize(message, fallbackDeserializer);\n },\n serialize(input) {\n return implementation.serialize(input, fallbackSerializer);\n }\n };\n}\nexports.extendSerializer = extendSerializer;\nconst DefaultErrorSerializer = {\n deserialize(message) {\n return Object.assign(Error(message.message), {\n name: message.name,\n stack: message.stack\n });\n },\n serialize(error) {\n return {\n __error_marker: \"$$error\",\n message: error.message,\n name: error.name,\n stack: error.stack\n };\n }\n};\nconst isSerializedError = (thing) => thing && typeof thing === \"object\" && \"__error_marker\" in thing && thing.__error_marker === \"$$error\";\nexports.DefaultSerializer = {\n deserialize(message) {\n if (isSerializedError(message)) {\n return DefaultErrorSerializer.deserialize(message);\n }\n else {\n return message;\n }\n },\n serialize(input) {\n if (input instanceof Error) {\n return DefaultErrorSerializer.serialize(input);\n }\n else {\n return input;\n }\n }\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.serialize = exports.deserialize = exports.registerSerializer = void 0;\nconst serializers_1 = require(\"./serializers\");\nlet registeredSerializer = serializers_1.DefaultSerializer;\nfunction registerSerializer(serializer) {\n registeredSerializer = serializers_1.extendSerializer(registeredSerializer, serializer);\n}\nexports.registerSerializer = registerSerializer;\nfunction deserialize(message) {\n return registeredSerializer.deserialize(message);\n}\nexports.deserialize = deserialize;\nfunction serialize(input) {\n return registeredSerializer.serialize(input);\n}\nexports.serialize = serialize;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.$worker = exports.$transferable = exports.$terminate = exports.$events = exports.$errors = void 0;\nexports.$errors = Symbol(\"thread.errors\");\nexports.$events = Symbol(\"thread.events\");\nexports.$terminate = Symbol(\"thread.terminate\");\nexports.$transferable = Symbol(\"thread.transferable\");\nexports.$worker = Symbol(\"thread.worker\");\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Transfer = exports.isTransferDescriptor = void 0;\nconst symbols_1 = require(\"./symbols\");\nfunction isTransferable(thing) {\n if (!thing || typeof thing !== \"object\")\n return false;\n // Don't check too thoroughly, since the list of transferable things in JS might grow over time\n return true;\n}\nfunction isTransferDescriptor(thing) {\n return thing && typeof thing === \"object\" && thing[symbols_1.$transferable];\n}\nexports.isTransferDescriptor = isTransferDescriptor;\nfunction Transfer(payload, transferables) {\n if (!transferables) {\n if (!isTransferable(payload))\n throw Error();\n transferables = [payload];\n }\n return {\n [symbols_1.$transferable]: true,\n send: payload,\n transferables\n };\n}\nexports.Transfer = Transfer;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WorkerMessageType = exports.MasterMessageType = void 0;\n/////////////////////////////\n// Messages sent by master:\nvar MasterMessageType;\n(function (MasterMessageType) {\n MasterMessageType[\"cancel\"] = \"cancel\";\n MasterMessageType[\"run\"] = \"run\";\n})(MasterMessageType = exports.MasterMessageType || (exports.MasterMessageType = {}));\n////////////////////////////\n// Messages sent by worker:\nvar WorkerMessageType;\n(function (WorkerMessageType) {\n WorkerMessageType[\"error\"] = \"error\";\n WorkerMessageType[\"init\"] = \"init\";\n WorkerMessageType[\"result\"] = \"result\";\n WorkerMessageType[\"running\"] = \"running\";\n WorkerMessageType[\"uncaughtError\"] = \"uncaughtError\";\n})(WorkerMessageType = exports.WorkerMessageType || (exports.WorkerMessageType = {}));\n","\"use strict\";\n/// \n// tslint:disable no-shadowed-variable\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst isWorkerRuntime = function isWorkerRuntime() {\n const isWindowContext = typeof self !== \"undefined\" && typeof Window !== \"undefined\" && self instanceof Window;\n return typeof self !== \"undefined\" && self.postMessage && !isWindowContext ? true : false;\n};\nconst postMessageToMaster = function postMessageToMaster(data, transferList) {\n self.postMessage(data, transferList);\n};\nconst subscribeToMasterMessages = function subscribeToMasterMessages(onMessage) {\n const messageHandler = (messageEvent) => {\n onMessage(messageEvent.data);\n };\n const unsubscribe = () => {\n self.removeEventListener(\"message\", messageHandler);\n };\n self.addEventListener(\"message\", messageHandler);\n return unsubscribe;\n};\nexports.default = {\n isWorkerRuntime,\n postMessageToMaster,\n subscribeToMasterMessages\n};\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.expose = exports.isWorkerRuntime = exports.Transfer = exports.registerSerializer = void 0;\nconst is_observable_1 = __importDefault(require(\"is-observable\"));\nconst common_1 = require(\"../common\");\nconst transferable_1 = require(\"../transferable\");\nconst messages_1 = require(\"../types/messages\");\nconst implementation_1 = __importDefault(require(\"./implementation\"));\nvar common_2 = require(\"../common\");\nObject.defineProperty(exports, \"registerSerializer\", { enumerable: true, get: function () { return common_2.registerSerializer; } });\nvar transferable_2 = require(\"../transferable\");\nObject.defineProperty(exports, \"Transfer\", { enumerable: true, get: function () { return transferable_2.Transfer; } });\n/** Returns `true` if this code is currently running in a worker. */\nexports.isWorkerRuntime = implementation_1.default.isWorkerRuntime;\nlet exposeCalled = false;\nconst activeSubscriptions = new Map();\nconst isMasterJobCancelMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.cancel;\nconst isMasterJobRunMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.run;\n/**\n * There are issues with `is-observable` not recognizing zen-observable's instances.\n * We are using `observable-fns`, but it's based on zen-observable, too.\n */\nconst isObservable = (thing) => is_observable_1.default(thing) || isZenObservable(thing);\nfunction isZenObservable(thing) {\n return thing && typeof thing === \"object\" && typeof thing.subscribe === \"function\";\n}\nfunction deconstructTransfer(thing) {\n return transferable_1.isTransferDescriptor(thing)\n ? { payload: thing.send, transferables: thing.transferables }\n : { payload: thing, transferables: undefined };\n}\nfunction postFunctionInitMessage() {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"function\"\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postModuleInitMessage(methodNames) {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"module\",\n methods: methodNames\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postJobErrorMessage(uid, rawError) {\n const { payload: error, transferables } = deconstructTransfer(rawError);\n const errorMessage = {\n type: messages_1.WorkerMessageType.error,\n uid,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage, transferables);\n}\nfunction postJobResultMessage(uid, completed, resultValue) {\n const { payload, transferables } = deconstructTransfer(resultValue);\n const resultMessage = {\n type: messages_1.WorkerMessageType.result,\n uid,\n complete: completed ? true : undefined,\n payload\n };\n implementation_1.default.postMessageToMaster(resultMessage, transferables);\n}\nfunction postJobStartMessage(uid, resultType) {\n const startMessage = {\n type: messages_1.WorkerMessageType.running,\n uid,\n resultType\n };\n implementation_1.default.postMessageToMaster(startMessage);\n}\nfunction postUncaughtErrorMessage(error) {\n try {\n const errorMessage = {\n type: messages_1.WorkerMessageType.uncaughtError,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage);\n }\n catch (subError) {\n // tslint:disable-next-line no-console\n console.error(\"Not reporting uncaught error back to master thread as it \" +\n \"occured while reporting an uncaught error already.\" +\n \"\\nLatest error:\", subError, \"\\nOriginal error:\", error);\n }\n}\nfunction runFunction(jobUID, fn, args) {\n return __awaiter(this, void 0, void 0, function* () {\n let syncResult;\n try {\n syncResult = fn(...args);\n }\n catch (error) {\n return postJobErrorMessage(jobUID, error);\n }\n const resultType = isObservable(syncResult) ? \"observable\" : \"promise\";\n postJobStartMessage(jobUID, resultType);\n if (isObservable(syncResult)) {\n const subscription = syncResult.subscribe(value => postJobResultMessage(jobUID, false, common_1.serialize(value)), error => {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n activeSubscriptions.delete(jobUID);\n }, () => {\n postJobResultMessage(jobUID, true);\n activeSubscriptions.delete(jobUID);\n });\n activeSubscriptions.set(jobUID, subscription);\n }\n else {\n try {\n const result = yield syncResult;\n postJobResultMessage(jobUID, true, common_1.serialize(result));\n }\n catch (error) {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n }\n }\n });\n}\n/**\n * Expose a function or a module (an object whose values are functions)\n * to the main thread. Must be called exactly once in every worker thread\n * to signal its API to the main thread.\n *\n * @param exposed Function or object whose values are functions\n */\nfunction expose(exposed) {\n if (!implementation_1.default.isWorkerRuntime()) {\n throw Error(\"expose() called in the master thread.\");\n }\n if (exposeCalled) {\n throw Error(\"expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.\");\n }\n exposeCalled = true;\n if (typeof exposed === \"function\") {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && !messageData.method) {\n runFunction(messageData.uid, exposed, messageData.args.map(common_1.deserialize));\n }\n });\n postFunctionInitMessage();\n }\n else if (typeof exposed === \"object\" && exposed) {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && messageData.method) {\n runFunction(messageData.uid, exposed[messageData.method], messageData.args.map(common_1.deserialize));\n }\n });\n const methodNames = Object.keys(exposed).filter(key => typeof exposed[key] === \"function\");\n postModuleInitMessage(methodNames);\n }\n else {\n throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${exposed}`);\n }\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobCancelMessage(messageData)) {\n const jobUID = messageData.uid;\n const subscription = activeSubscriptions.get(jobUID);\n if (subscription) {\n subscription.unsubscribe();\n activeSubscriptions.delete(jobUID);\n }\n }\n });\n}\nexports.expose = expose;\nif (typeof self !== \"undefined\" && typeof self.addEventListener === \"function\" && implementation_1.default.isWorkerRuntime()) {\n self.addEventListener(\"error\", event => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(event.error || event), 250);\n });\n self.addEventListener(\"unhandledrejection\", event => {\n const error = event.reason;\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\nif (typeof process !== \"undefined\" && typeof process.on === \"function\" && implementation_1.default.isWorkerRuntime()) {\n process.on(\"uncaughtException\", (error) => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n });\n process.on(\"unhandledRejection\", (error) => {\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\n","import WorkerContext from \"./dist/worker/index.js\"\n\nexport const expose = WorkerContext.expose\nexport const registerSerializer = WorkerContext.registerSerializer\nexport const Transfer = WorkerContext.Transfer\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import toNumber from './toNumber.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nexport default toFinite;\n","import toFinite from './toFinite.js';\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nexport default toInteger;\n","import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nexport default copyArray;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n","import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n","import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nexport default isIterateeCall;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n","import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n","import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n","import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n","import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n","import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n","import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n","import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n","import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n","/**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\nfunction baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n}\n\nexport default baseClamp;\n","import arrayMap from './_arrayMap.js';\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nexport default baseValues;\n","import baseValues from './_baseValues.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n}\n\nexport default values;\n","/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeFloor = Math.floor,\n nativeRandom = Math.random;\n\n/**\n * The base implementation of `_.random` without support for returning\n * floating-point numbers.\n *\n * @private\n * @param {number} lower The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the random number.\n */\nfunction baseRandom(lower, upper) {\n return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n}\n\nexport default baseRandom;\n","import baseRandom from './_baseRandom.js';\n\n/**\n * A specialized version of `_.shuffle` which mutates and sets the size of `array`.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @param {number} [size=array.length] The size of `array`.\n * @returns {Array} Returns `array`.\n */\nfunction shuffleSelf(array, size) {\n var index = -1,\n length = array.length,\n lastIndex = length - 1;\n\n size = size === undefined ? length : size;\n while (++index < size) {\n var rand = baseRandom(index, lastIndex),\n value = array[rand];\n\n array[rand] = array[index];\n array[index] = value;\n }\n array.length = size;\n return array;\n}\n\nexport default shuffleSelf;\n","import baseClamp from './_baseClamp.js';\nimport copyArray from './_copyArray.js';\nimport shuffleSelf from './_shuffleSelf.js';\n\n/**\n * A specialized version of `_.sampleSize` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction arraySampleSize(array, n) {\n return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));\n}\n\nexport default arraySampleSize;\n","import baseClamp from './_baseClamp.js';\nimport shuffleSelf from './_shuffleSelf.js';\nimport values from './values.js';\n\n/**\n * The base implementation of `_.sampleSize` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction baseSampleSize(collection, n) {\n var array = values(collection);\n return shuffleSelf(array, baseClamp(n, 0, array.length));\n}\n\nexport default baseSampleSize;\n","import arraySampleSize from './_arraySampleSize.js';\nimport baseSampleSize from './_baseSampleSize.js';\nimport isArray from './isArray.js';\nimport isIterateeCall from './_isIterateeCall.js';\nimport toInteger from './toInteger.js';\n\n/**\n * Gets `n` random elements at unique keys from `collection` up to the\n * size of `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @param {number} [n=1] The number of elements to sample.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the random elements.\n * @example\n *\n * _.sampleSize([1, 2, 3], 2);\n * // => [3, 1]\n *\n * _.sampleSize([1, 2, 3], 4);\n * // => [2, 3, 1]\n */\nfunction sampleSize(collection, n, guard) {\n if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n var func = isArray(collection) ? arraySampleSize : baseSampleSize;\n return func(collection, n);\n}\n\nexport default sampleSize;\n","export default function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import ascending from \"./ascending.js\";\n\nexport default function(f) {\n let delta = f;\n let compare = f;\n\n if (f.length === 1) {\n delta = (d, x) => f(d) - x;\n compare = ascendingComparator(f);\n }\n\n function left(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function right(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n\n function center(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction ascendingComparator(f) {\n return (d, x) => ascending(f(d), x);\n}\n","import { bisector } from 'd3-array';\nimport { RemoteFile as _RemoteFile } from 'generic-filehandle';\n\nimport type * as HiGlass from '@higlass/types';\nimport type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema';\n\nexport type CommonDataConfig = {\n assembly: Assembly;\n x?: string;\n xe?: string;\n x1?: string;\n x1e?: string;\n urlFetchOptions?: RequestInit;\n};\n\nexport class DataSource {\n chromInfo: ExtendedChromInfo;\n tilesetInfo: ReturnType;\n\n constructor(public file: File, chromSizes: ChromSizes, public options: Options) {\n this.chromInfo = sizesToChromInfo(chromSizes);\n this.tilesetInfo = tilesetInfoFromChromInfo(this.chromInfo);\n }\n}\n\n/**\n * Filter data before sending to a track considering the visible genomic area in the track.\n * TODO(2022-Jul-13): Consider genomic `y` channels as well.\n */\nexport function filterUsingGenoPos(\n data: Datum[],\n [minX, maxX]: [number, number],\n config: Omit\n) {\n const { x, xe, x1, x1e } = config;\n const definedXFields = [x, xe, x1, x1e].filter(f => f) as string[];\n return data.filter((d: Datum) => {\n if (definedXFields.length === 0) {\n // no filter applies\n return true;\n } else if (definedXFields.length === 1) {\n // filter based on one genomic position\n const value = +d[definedXFields[0]];\n return typeof value === 'number' && minX < value && value <= maxX;\n } else {\n // filter based on two genomic positions, i.e., check overlaps\n const values = definedXFields.map(f => +d[f]).filter(v => !isNaN(v));\n const minValue = Math.min(...values);\n const maxValue = Math.max(...values);\n return minX <= maxValue && minValue <= maxX;\n }\n });\n}\n\nconst chromInfoBisector = bisector((d: { pos: number }) => d.pos).left;\n\nconst chrToAbs = (chrom: string, chromPos: number, chromInfo: HiGlass.ChromInfo) =>\n chromInfo.chrPositions[chrom].pos + chromPos;\n\nconst absToChr = (absPosition: number, chromInfo: HiGlass.ChromInfo) => {\n if (!chromInfo || !chromInfo.cumPositions || !chromInfo.cumPositions.length) {\n return null;\n }\n\n let insertPoint = chromInfoBisector(chromInfo.cumPositions, absPosition);\n const lastChr = chromInfo.cumPositions[chromInfo.cumPositions.length - 1].chr;\n const lastLength = chromInfo.chromLengths[lastChr];\n\n // @ts-expect-error\n insertPoint -= insertPoint > 0 && 1;\n\n let chrPosition = Math.floor(absPosition - chromInfo.cumPositions[insertPoint].pos);\n let offset = 0;\n\n if (chrPosition < 0) {\n // before the start of the genome\n offset = chrPosition - 1;\n chrPosition = 1;\n }\n\n if (insertPoint === chromInfo.cumPositions.length - 1 && chrPosition > lastLength) {\n // beyond the last chromosome\n offset = chrPosition - lastLength;\n chrPosition = lastLength;\n }\n\n return [chromInfo.cumPositions[insertPoint].chr, chrPosition, offset, insertPoint] as const;\n};\n\n/**\n * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`.\n * @param chrName A chromosome name to be sanitized\n * @param assembly A genome assembly of the data\n * @param chromosomePrefix A prefix string that can be replaced to 'chr'\n * @returns\n */\nexport function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string) {\n if (Array.isArray(assembly)) {\n // this is a custom assembly, so use this as is\n return chrName;\n }\n\n // For assemblies in Gosling, we use the `chr` prefix consistently\n if (chromosomePrefix) {\n // `hs1` --> `chr1`\n chrName = chrName.replace(chromosomePrefix, 'chr');\n } else if (!chrName.includes('chr')) {\n // `1` --> `chr1`\n chrName = `chr${chrName}`;\n }\n return chrName;\n}\n\nexport type ExtendedChromInfo = HiGlass.ChromInfo & {\n absToChr(absPos: number): ReturnType | null;\n chrToAbs(chr: [name: string, pos: number]): number | null;\n};\n\nexport function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize = 1024) {\n return {\n tile_size: tileSize,\n bins_per_dimension: tileSize,\n max_zoom: Math.ceil(Math.log(chromInfo.totalLength / tileSize) / Math.log(2)),\n max_width: chromInfo.totalLength,\n min_pos: [0],\n max_pos: [chromInfo.totalLength]\n };\n}\n\nexport function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo {\n const info: HiGlass.ChromInfo = {\n cumPositions: [],\n chromLengths: {},\n chrPositions: {},\n totalLength: 0\n };\n\n sizes.forEach(([chr, length], i) => {\n const chrPosition = { id: i, chr, pos: info.totalLength };\n info.chrPositions[chr] = chrPosition;\n info.chromLengths[chr] = length;\n info.cumPositions.push(chrPosition);\n info.totalLength += length;\n });\n\n return {\n ...info,\n absToChr: absPos => (info.chrPositions ? absToChr(absPos, info) : null),\n chrToAbs: ([chrName, chrPos]) => (info.chrPositions ? chrToAbs(chrName, chrPos, info) : null)\n };\n}\n\nexport class RemoteFile extends _RemoteFile {\n // Overrides `read` to eagerly read 200 or 206 response\n // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162\n public read: _RemoteFile['read'] = async (\n buffer,\n offset = 0,\n length,\n position = 0,\n opts = {}\n ): Promise<{ bytesRead: number; buffer: Buffer }> => {\n const { headers = {}, signal, overrides = {} } = opts;\n\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n } else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n // @ts-expect-error private property\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n // @ts-expect-error private property\n ...this.baseOverrides.headers\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal\n };\n const response = await this.fetch(this.url, args);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n\n // Just read the response if it was successful.\n if (response.status === 200 || response.status === 206) {\n // @ts-expect-error private method\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n // @ts-expect-error private property\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n\n return { bytesRead: bytesCopied, buffer };\n }\n\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n };\n}\n\nexport interface TabularDataFetcher {\n getTabularData(tileIds: string[]): Promise;\n MAX_TILE_WIDTH?: number;\n}\n","import type { GFF3Feature, GFF3Sequence } from '@gmod/gff';\n/**\n * Type guard for GFF3Feature\n * @param entry An element from GFF.parseStringSync() return value\n * @returns True if type is GFF3Feature\n */\nexport function isGFF3Feature(entry: GFF3Feature | GFF3Sequence): entry is GFF3Feature {\n return Array.isArray(entry as GFF3Feature);\n}\n\n/** Returns an array of the unique values sampled n times between 0 and maxValue */\nexport function makeRandomSortedArray(n: number, maxValue: number) {\n const randomArray = [];\n for (let i = 0; i < n; i++) {\n const randomNumber = Math.floor(Math.random() * (maxValue + 1));\n randomArray.push(randomNumber);\n }\n const sorted = randomArray.sort((a, b) => a - b);\n return [...new Set(sorted)];\n}\n","import { TabixIndexedFile } from '@gmod/tabix';\nimport GFF from '@gmod/gff';\nimport type { GFF3FeatureLineWithRefs, GFF3Feature, GFF3Sequence } from '@gmod/gff';\nimport { expose, Transfer } from 'threads/worker';\nimport { sampleSize } from 'lodash-es';\nimport type { TilesetInfo } from '@higlass/types';\nimport type { ChromSizes } from '@gosling-lang/gosling-schema';\nimport { DataSource, RemoteFile } from '../utils';\nimport { isGFF3Feature, makeRandomSortedArray } from './utils';\n\nexport type GffFileOptions = {\n sampleLength: number;\n attributesToFields?: { attribute: string; defaultValue: string }[];\n urlFetchOptions?: RequestInit;\n indexUrlFetchOptions?: RequestInit;\n};\n\nexport interface GffTile extends GFF3FeatureLineWithRefs {\n attribute?: string;\n}\n\nexport interface EmptyTile {\n tilePositionId: string;\n}\n\n/**\n * A class to represent a GFF file. It takes care of setting up gmod/tabix.\n */\nclass GffFile {\n #uid: string;\n tbi: TabixIndexedFile;\n #n_features?: number;\n\n constructor(tbi: TabixIndexedFile, uid: string) {\n this.tbi = tbi;\n this.#uid = uid;\n }\n /**\n * Function to create an instance of BedFile\n * @param url A string which is the URL of the bed file\n * @param indexUrl A string which is the URL of the bed index file\n * @param uid A unique identifier for the worker\n * @param urlFetchOptions When the url is fetched, these options will be used\n * @param indexUrlFetchOptions When the index URL is fetched, these options will be used\n * @returns an instance of BedFile\n */\n static fromUrl(\n url: string,\n indexUrl: string,\n uid: string,\n urlFetchOptions?: RequestInit,\n indexUrlFetchOptions?: RequestInit\n ): GffFile {\n const tbi = new TabixIndexedFile({\n filehandle: new RemoteFile(url, { overrides: urlFetchOptions }),\n tbiFilehandle: new RemoteFile(indexUrl, { overrides: indexUrlFetchOptions })\n });\n return new GffFile(tbi, uid);\n }\n /**\n * Calculates the total number of features in a file\n * @returns A number of the features in a file\n */\n async #getNumberFeatures() {\n if (!this.#n_features) {\n const source = dataSources.get(this.#uid)!;\n const { cumPositions } = source.chromInfo;\n const countPromises: Promise[] = [];\n for (const cumPos of cumPositions) {\n const chromName = cumPos.chr;\n countPromises.push(this.tbi.lineCount(chromName));\n }\n const counts = await Promise.all(countPromises);\n const total_counts = counts.reduce((acc, cur) => acc + cur, 0);\n this.#n_features = total_counts;\n }\n return this.#n_features;\n }\n /**\n * Retrieves the lines between a range of absolute genomic coordinates\n * @param minX the minimum absolute coordinate\n * @param maxX the maximum absolute coordinate\n * @returns A promise to an array of strings, where each string is a line from the GFF\n */\n #getLinePromises(minX: number, maxX: number): Promise[] {\n const source = dataSources.get(this.#uid)!;\n let curMinX = minX;\n const { chromLengths, cumPositions } = source.chromInfo;\n const linePromises: Promise[] = [];\n // This helps with the performance of viewing many features over a large genomic range\n // Strategy: Get features from randomly selected windows within the entire region\n // If the total number of features in the file is less than MAX_FEATURES, then we don't do this.\n const MAX_FEATURES = 500000; // if the number of features is less than this, we just get all the lines\n const MAX_WINDOW = 4000000; // if the maxX - minX is less than this, then we'll just get all the lines\n if (this.#n_features && this.#n_features > MAX_FEATURES && maxX - minX > MAX_WINDOW) {\n const diff = maxX - minX;\n const windowSize = 50000;\n const n_samples = 100;\n\n const totalBins = Math.floor(diff / windowSize);\n const selectedBins = makeRandomSortedArray(n_samples, totalBins);\n const binLines = selectedBins.map(bin => {\n const binStart = minX + bin * windowSize;\n const binEnd = binStart + windowSize;\n return this.#getLinePromises(binStart, binEnd);\n });\n return binLines.flat();\n }\n\n for (const cumPos of cumPositions) {\n const chromName = cumPos.chr;\n const chromStart = cumPos.pos;\n const chromEnd = cumPos.pos + chromLengths[chromName];\n let startPos, endPos;\n\n // Early break, rather than creating an nested if\n if (chromStart > curMinX || curMinX >= chromEnd) {\n continue;\n }\n\n // start of the visible region is within this chromosome\n const linePromise = new Promise(resolve => {\n const lines: string[] = [];\n const lineCallback = (line: string) => {\n lines.push(line);\n };\n\n if (maxX > chromEnd) {\n startPos = curMinX - chromStart;\n endPos = chromEnd - chromStart;\n } else {\n startPos = Math.floor(curMinX - chromStart);\n endPos = Math.ceil(maxX - chromStart);\n }\n\n this.tbi.getLines(chromName, startPos, endPos, lineCallback).then(() => {\n resolve(lines);\n });\n });\n\n linePromises.push(linePromise);\n\n if (maxX <= chromEnd) {\n continue;\n }\n\n curMinX = chromEnd;\n }\n return linePromises;\n }\n /**\n * Makes tiles for a given range of genomic positions\n * @param minX the minimum absolute coordinate\n * @param maxX the maximum absolute coordinate\n * @returns A promise to an array of GffTiles\n */\n async getTileData(minX: number, maxX: number): Promise {\n const source = dataSources.get(this.#uid)!;\n const sampleLength = source.options.sampleLength; // maximum number of features that can be shown\n const attributesToFields = source.options.attributesToFields;\n\n await this.#getNumberFeatures();\n /**\n * Function to filter out child features if there are too many features\n * @param lines an array of strings, where each string is a line from the GFF\n * @returns an array of strings, where each string is a line from the GFF\n */\n function filterLines(lines: string[]): string[] {\n // Keep only the non child lines\n const nonChildLines = lines.filter(line => {\n const lineColumns = line.split('\\t');\n const attributes = lineColumns[8]; // this is the attributes column\n return !attributes.includes('Parent=');\n });\n return sampleSize(nonChildLines, sampleLength);\n }\n\n /**\n * Function to reformat the output of GFF.parseStringSync() into tiles\n * @param parsed Output from GFF.parseStringSync()\n * @returns An array of GffTile\n */\n function parsedLinesToTiles(parsed: (GFF3Feature | GFF3Sequence)[]): GffTile[] {\n let tiles: GffTile[] = [];\n for (const line of parsed) {\n if (isGFF3Feature(line)) {\n for (const feature of line) {\n // make the start and end absolute\n if (feature.seq_id && feature.start)\n feature.start = source.chromInfo.chrToAbs([feature.seq_id, feature.start]);\n if (feature.seq_id && feature.end)\n feature.end = source.chromInfo.chrToAbs([feature.seq_id, feature.end]);\n tiles.push(feature);\n }\n }\n }\n // Add specific attributes to each tile if specified\n if (attributesToFields) {\n tiles = tiles.map(tile => {\n const attributes = tile.attributes;\n const cleanAtt: { [key: string]: unknown } = {};\n attributesToFields.forEach(attMap => {\n const attName = attMap.attribute;\n const attDefault = attMap.defaultValue;\n if (attributes == null || !(attName in attributes) || !Array.isArray(attributes[attName]))\n cleanAtt[attName] = attDefault;\n else {\n const attVal = attributes[attName];\n if (Array.isArray(attVal)) {\n // Join the array array if there is more than one element\n cleanAtt[attName] = attVal.length == 1 ? attVal[0] : attVal.join(',');\n }\n }\n });\n return { ...tile, ...cleanAtt };\n });\n }\n return tiles;\n }\n\n // First, we get the lines we want to parse and filter out the lines we don't want to parse\n const linePromises = this.#getLinePromises(minX, maxX);\n const allLines = (await Promise.all(linePromises)).flat();\n let linesToParse = [];\n if (allLines.length > sampleLength) {\n linesToParse = filterLines(allLines);\n } else {\n linesToParse = allLines;\n }\n // Second, we parse the lines using gmod/gff\n const parseOptions = {\n disableDerivesFromReferences: true,\n parseFeatures: true,\n parseComments: false,\n parseDirectives: false,\n parseSequences: false\n };\n const parsedLines = GFF.parseStringSync(linesToParse.join('\\n'), parseOptions);\n // Third, we reformat the parsed GFF into the expected tile format\n const tiles = parsedLinesToTiles(parsedLines);\n return tiles;\n }\n}\n\n// promises indexed by urls\nconst gffFiles: Map = new Map();\n\n/**\n * Object to store tile data. Each key a string which contains the coordinates of the tile\n */\nconst tileValues: Record = {};\n/**\n * Maps from UID to GFF File info\n */\nconst dataSources: Map> = new Map();\n\nfunction init(\n uid: string,\n bed: { url: string; indexUrl: string },\n chromSizes: ChromSizes,\n options: Partial = {}\n) {\n let gffFile = gffFiles.get(bed.url);\n if (!gffFile) {\n gffFile = GffFile.fromUrl(bed.url, bed.indexUrl, uid, options.urlFetchOptions, options.indexUrlFetchOptions);\n }\n const dataSource = new DataSource(gffFile, chromSizes, {\n sampleLength: 1000, // default sampleLength\n ...options\n });\n dataSources.set(uid, dataSource);\n}\n\nconst tilesetInfo = (uid: string) => {\n return dataSources.get(uid)!.tilesetInfo;\n};\n\n/**\n * Updates `tileValues` with the data for a specific tile.\n * @param uid A string which is the unique identifier of the worker\n * @param z A number which is the z coordinate of the tile\n * @param x A number which is the x coordinate of the tile\n */\nconst tile = async (uid: string, z: number, x: number): Promise => {\n const source = dataSources.get(uid)!;\n // const parseLine = await source.file.getParser();\n\n const CACHE_KEY = `${uid}.${z}.${x}`;\n\n // TODO: Caching is needed\n // if (!tileValues[CACHE_KEY]) {\n tileValues[CACHE_KEY] = [];\n // }\n\n const tileWidth = +source.tilesetInfo.max_width / 2 ** +z;\n\n // get bounds of this tile\n const minX = source.tilesetInfo.min_pos[0] + x * tileWidth;\n const maxX = source.tilesetInfo.min_pos[0] + (x + 1) * tileWidth;\n tileValues[CACHE_KEY] = await source.file.getTileData(minX, maxX);\n return [];\n};\n\nconst fetchTilesDebounced = async (uid: string, tileIds: string[]) => {\n const tiles: Record = {};\n const validTileIds: string[] = [];\n const tilePromises: Promise[] = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('Invalid tile zoom or position:', z, x);\n continue;\n }\n validTileIds.push(tileId);\n tilePromises.push(tile(uid, z, x));\n }\n return Promise.all(tilePromises).then(values => {\n for (let i = 0; i < values.length; i++) {\n const validTileId = validTileIds[i];\n tiles[validTileId] = { tilePositionId: validTileId };\n }\n return tiles;\n });\n};\n\n/**\n * Sends the data fetcher data from `tileValues`\n * @param uid A string which is the unique identifier of the worker\n * @param tileIds An array of strings where each string identifies a tile with a particular coordinate\n * @returns A transferable buffer\n */\nconst getTabularData = (uid: string, tileIds: string[]) => {\n const data: GffTile[][] = [];\n\n tileIds.forEach(tileId => {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n const tileValue = tileValues[`${uid}.${z}.${x}`];\n\n if (!tileValue) {\n console.warn(`No tile data constructed (${tileId})`);\n }\n\n data.push(tileValue);\n });\n const output = Object.values(data).flat();\n\n const buffer = new TextEncoder().encode(JSON.stringify(output)).buffer;\n return Transfer(buffer, [buffer]);\n};\n\nconst tileFunctions = {\n init,\n tilesetInfo,\n fetchTilesDebounced,\n tile,\n getTabularData\n};\n\nexport type WorkerApi = typeof tileFunctions;\nexport type { TilesetInfo };\n\nexpose(tileFunctions);\n"],"names":["i","_getPrototypeOf","o","_setPrototypeOf","p","self","_get","Emitter","AbortSignal","toString","AbortController","err","Request","init","abortableFetch","require$$0","global","AggregateAbortController_1","abortcontroller_ponyfill_1","AggregateStatusReporter_1","__importDefault","this","AbortablePromiseCache_1","require$$1","require$$2","len","len2","buffer","c","ieee754","exports","Buffer","fromString","byteLength","isBuffer","isEncoding","code","msg","utils","Z_FIXED","Z_UNKNOWN","zero","MIN_MATCH","MAX_MATCH","LENGTH_CODES","LITERALS","L_CODES","D_CODES","BL_CODES","HEAP_SIZE","MAX_BITS","rank","adler32","crc32","messages","require$$3","require$$4","Z_NO_FLUSH","Z_FINISH","Z_BLOCK","Z_OK","Z_STREAM_END","Z_STREAM_ERROR","Z_DATA_ERROR","Z_BUF_ERROR","Z_DEFAULT_COMPRESSION","Z_DEFAULT_STRATEGY","Z_DEFLATED","MAX_WBITS","deflate","strings","c2","ZStream","BAD","TYPE","inflate_fast","state","ENOUGH_LENS","ENOUGH_DISTS","CODES","LENS","DISTS","inflate_table","root","q","inflate","constants","GZheader","require$$5","require$$6","Inflate","Z_SYNC_FLUSH","toNumber","fromBytes","long","Long","TBI","AbortablePromiseCache","ReflectApply","ReflectOwnKeys","NumberIsNaN","eventsModule","events","once","keys","inherits_browserModule","inherits","symbols","_classCallCheck","_defineProperties","_createClass","NodeError","Stream","require$$7","realHasInstance","module","onlegacyfinish","onfinish","onend","onerror","onclose","onrequest","createReadableStreamAsyncIterator","EElistenerCount","debug","StringDecoder","require$$8","require$$9","require$$10","decoder","n","require$$11","require$$12","err2","GFF3.parseDirective","GFF3.parseFeature","Transform","Decoder","Transfer","isWorkerRuntime","postMessageToMaster","subscribeToMasterMessages","isObservable","expose","freeGlobal","Symbol","objectProto","hasOwnProperty","nativeObjectToString","symToStringTag","funcTag","MAX_SAFE_INTEGER","argsTag","freeExports","freeModule","moduleExports","nodeUtil","isArray","isArguments","isTypedArray","nativeKeys","_RemoteFile","tiles","tile","values"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAO,eAAe,aAAS,cAAc,EAAE,OAAO,KAAI,CAAE;AAE5D,WAAS,gBAAgB,UAAU,aAAa;AAC9C,QAAI,EAAE,oBAAoB,cAAc;AACtC,YAAM,IAAI,UAAU,mCAAmC;AAAA,IACxD;AAAA,EACH;AAEA,WAAS,kBAAkB,QAAQ,OAAO;AACxC,aAASA,KAAI,GAAGA,KAAI,MAAM,QAAQA,MAAK;AACrC,UAAI,aAAa,MAAMA,EAAC;AACxB,iB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,WAAW,IAAI,EAAE,gBAAgB,YAAY;AAAA,MACvD;AACO,aAAA;AAAA,IAAA,CACV;AAAA,EACL;AAQA,QAAM,iBAAiB,CAAC,KAAa,YAAsB;AACvD,UAAM,OAAoB,CAAA;AAE1B,YAAQ,QAAQ,CAAU,WAAA;AAChB,YAAA,QAAQ,OAAO,MAAM,GAAG;AAC9B,YAAM,IAAI,SAAS,MAAM,CAAC,GAAG,EAAE;AAC/B,YAAM,IAAI,SAAS,MAAM,CAAC,GAAG,EAAE;AAEzB,YAAA,YAAY,WAAW,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE;AAE/C,UAAI,CAAC,WAAW;AACJ,gBAAA,KAAK,6BAA6B,MAAM,GAAG;AAAA,MACvD;AAEA,WAAK,KAAK,SAAS;AAAA,IAAA,CACtB;AACD,UAAM,SAAS,OAAO,OAAO,IAAI,EAAE,KAAK;AAElC,UAAA2B,UAAS,IAAI,YAAY,EAAE,OAAO,KAAK,UAAU,MAAM,CAAC,EAAE;AAChE,WAAO,SAASA,SAAQ,CAACA,OAAM,CAAC;AAAA,EACpC;AAEA,QAAM,gBAAgB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAKA,SAAO,aAAa;;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117]} \ No newline at end of file diff --git a/dist/assets/vcf-worker-0bc0fe81.js.map b/dist/assets/vcf-worker-0bc0fe81.js.map deleted file mode 100644 index 36ef63fb..00000000 --- a/dist/assets/vcf-worker-0bc0fe81.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vcf-worker-0bc0fe81.js","sources":["../node_modules/.pnpm/abortcontroller-polyfill@1.7.5/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/abortcontroller-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateAbortController.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateStatusReporter.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AbortablePromiseCache.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/index.js","../node_modules/.pnpm/quick-lru@4.0.1/node_modules/quick-lru/index.js","../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js","../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js","../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js","../__vite-browser-external","../node_modules/.pnpm/generic-filehandle@3.1.1/node_modules/generic-filehandle/esm/remoteFile.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/common.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/trees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/adler32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/crc32.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/messages.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/utils/strings.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/zstream.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/deflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inffast.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inftrees.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/constants.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/zlib/gzheader.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/lib/inflate.js","../node_modules/.pnpm/pako@1.0.11/node_modules/pako/index.js","../node_modules/.pnpm/@gmod+bgzf-filehandle@1.4.7/node_modules/@gmod/bgzf-filehandle/esm/unzip-pako.js","../node_modules/.pnpm/long@4.0.0/node_modules/long/src/long.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/util.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/virtualOffset.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/chunk.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/indexFile.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tbi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/csi.js","../node_modules/.pnpm/@gmod+tabix@1.5.11/node_modules/@gmod/tabix/esm/tabixIndexedFile.js","../node_modules/.pnpm/@gmod+vcf@5.0.10/node_modules/@gmod/vcf/esm/vcfReserved.js","../node_modules/.pnpm/@gmod+vcf@5.0.10/node_modules/@gmod/vcf/esm/parse.js","../node_modules/.pnpm/is-observable@2.1.0/node_modules/is-observable/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/serializers.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/common.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/symbols.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/transferable.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/types/messages.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/implementation.browser.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/dist/worker/index.js","../node_modules/.pnpm/threads@1.7.0/node_modules/threads/worker.mjs","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayMap.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toFinite.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toInteger.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_copyArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIndex.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isLength.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayLike.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isIterateeCall.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isPrototype.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTimes.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArguments.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/stubFalse.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBuffer.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUnary.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nodeUtil.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isTypedArray.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayLikeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_overArg.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseKeys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseClamp.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseValues.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/values.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseRandom.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_shuffleSelf.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arraySampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSampleSize.js","../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/sampleSize.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/ascending.js","../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/bisector.js","../src/data-fetchers/utils.ts","../src/data-fetchers/vcf/utils.ts","../src/data-fetchers/vcf/vcf-worker.ts"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get.apply(this, arguments);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'reason', {\n value: undefined,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort(reason) {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n var signalReason = reason;\n\n if (signalReason === undefined) {\n if (typeof document === 'undefined') {\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n } else {\n try {\n signalReason = new DOMException('signal is aborted without reason');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n }\n }\n }\n\n this.signal.reason = signalReason;\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","\"use strict\";\n/* eslint-disable */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbortSignal = exports.AbortController = void 0;\nconst cjs_ponyfill_1 = require(\"abortcontroller-polyfill/dist/cjs-ponyfill\");\nvar getGlobal = function () {\n // the only reliable means to get the global object is\n // `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n};\n//@ts-ignore\nlet AbortController = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortController : getGlobal().AbortController;\nexports.AbortController = AbortController;\n//@ts-ignore\nlet AbortSignal = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal;\nexports.AbortSignal = AbortSignal;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nclass NullSignal {\n}\n/**\n * aggregates a number of abort signals, will only fire the aggregated\n * abort if all of the input signals have been aborted\n */\nclass AggregateAbortController {\n constructor() {\n this.signals = new Set();\n this.abortController = new abortcontroller_ponyfill_1.AbortController();\n }\n /**\n * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy,\n * will be treated as a null-signal, and this abortcontroller will no\n * longer be abortable.\n */\n //@ts-ignore\n addSignal(signal = new NullSignal()) {\n if (this.signal.aborted) {\n throw new Error('cannot add a signal, already aborted!');\n }\n // note that a NullSignal will never fire, so if we\n // have one this thing will never actually abort\n this.signals.add(signal);\n if (signal.aborted) {\n // handle the abort immediately if it is already aborted\n // for some reason\n this.handleAborted(signal);\n }\n else if (typeof signal.addEventListener === 'function') {\n signal.addEventListener('abort', () => {\n this.handleAborted(signal);\n });\n }\n }\n handleAborted(signal) {\n this.signals.delete(signal);\n if (this.signals.size === 0) {\n this.abortController.abort();\n }\n }\n get signal() {\n return this.abortController.signal;\n }\n abort() {\n this.abortController.abort();\n }\n}\nexports.default = AggregateAbortController;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass AggregateStatusReporter {\n constructor() {\n this.callbacks = new Set();\n }\n addCallback(callback = () => { }) {\n this.callbacks.add(callback);\n callback(this.currentMessage);\n }\n callback(message) {\n this.currentMessage = message;\n this.callbacks.forEach(elt => {\n elt(message);\n });\n }\n}\nexports.default = AggregateStatusReporter;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nconst AggregateAbortController_1 = __importDefault(require(\"./AggregateAbortController\"));\nconst AggregateStatusReporter_1 = __importDefault(require(\"./AggregateStatusReporter\"));\nclass AbortablePromiseCache {\n constructor({ fill, cache, }) {\n if (typeof fill !== 'function') {\n throw new TypeError('must pass a fill function');\n }\n if (typeof cache !== 'object') {\n throw new TypeError('must pass a cache object');\n }\n if (typeof cache.get !== 'function' ||\n typeof cache.set !== 'function' ||\n typeof cache.delete !== 'function') {\n throw new TypeError('cache must implement get(key), set(key, val), and and delete(key)');\n }\n this.cache = cache;\n this.fillCallback = fill;\n }\n static isAbortException(exception) {\n return (\n // DOMException\n exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n //@ts-ignore\n exception.code === 'ERR_ABORTED' ||\n // stringified DOMException\n exception.message === 'AbortError: aborted' ||\n // stringified standard-ish exception\n exception.message === 'Error: aborted');\n }\n evict(key, entry) {\n if (this.cache.get(key) === entry) {\n this.cache.delete(key);\n }\n }\n fill(key, data, signal, statusCallback) {\n const aborter = new AggregateAbortController_1.default();\n const statusReporter = new AggregateStatusReporter_1.default();\n statusReporter.addCallback(statusCallback);\n const newEntry = {\n aborter: aborter,\n promise: this.fillCallback(data, aborter.signal, (message) => {\n statusReporter.callback(message);\n }),\n settled: false,\n statusReporter,\n get aborted() {\n return this.aborter.signal.aborted;\n },\n };\n newEntry.aborter.addSignal(signal);\n // remove the fill from the cache when its abortcontroller fires, if still in there\n newEntry.aborter.signal.addEventListener('abort', () => {\n if (!newEntry.settled) {\n this.evict(key, newEntry);\n }\n });\n // chain off the cached promise to record when it settles\n newEntry.promise\n .then(() => {\n newEntry.settled = true;\n }, () => {\n newEntry.settled = true;\n // if the fill throws an error (including abort) and is still in the cache, remove it\n this.evict(key, newEntry);\n })\n .catch(e => {\n // this will only be reached if there is some kind of\n // bad bug in this library\n console.error(e);\n throw e;\n });\n this.cache.set(key, newEntry);\n }\n static checkSinglePromise(promise, signal) {\n // check just this signal for having been aborted, and abort the\n // promise if it was, regardless of what happened with the cached\n // response\n function checkForSingleAbort() {\n if (signal && signal.aborted) {\n throw Object.assign(new Error('aborted'), { code: 'ERR_ABORTED' });\n }\n }\n return promise.then(result => {\n checkForSingleAbort();\n return result;\n }, error => {\n checkForSingleAbort();\n throw error;\n });\n }\n has(key) {\n return this.cache.has(key);\n }\n /**\n * Callback for getting status of the pending async\n *\n * @callback statusCallback\n * @param {any} status, current status string or message object\n */\n /**\n * @param {any} key cache key to use for this request\n * @param {any} data data passed as the first argument to the fill callback\n * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request\n * @param {statusCallback} a callback to get the current status of a pending async operation\n */\n get(key, data, signal, statusCallback) {\n if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) {\n throw new TypeError('second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?');\n }\n const cacheEntry = this.cache.get(key);\n if (cacheEntry) {\n if (cacheEntry.aborted && !cacheEntry.settled) {\n // if it's aborted but has not realized it yet, evict it and redispatch\n this.evict(key, cacheEntry);\n return this.get(key, data, signal, statusCallback);\n }\n if (cacheEntry.settled) {\n // too late to abort, just return it\n return cacheEntry.promise;\n }\n // request is in-flight, add this signal to its list of signals,\n // or if there is no signal, the aborter will become non-abortable\n cacheEntry.aborter.addSignal(signal);\n cacheEntry.statusReporter.addCallback(statusCallback);\n return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal);\n }\n // if we got here, it is not in the cache. fill.\n this.fill(key, data, signal, statusCallback);\n return AbortablePromiseCache.checkSinglePromise(\n //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-\n //eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.cache.get(key).promise, signal);\n }\n /**\n * delete the given entry from the cache. if it exists and its fill request has\n * not yet settled, the fill will be signaled to abort.\n *\n * @param {any} key\n */\n delete(key) {\n const cachedEntry = this.cache.get(key);\n if (cachedEntry) {\n if (!cachedEntry.settled) {\n cachedEntry.aborter.abort();\n }\n this.cache.delete(key);\n }\n }\n /**\n * Clear all requests from the cache. Aborts any that have not settled.\n * @returns {number} count of entries deleted\n */\n clear() {\n // iterate without needing regenerator-runtime\n const keyIter = this.cache.keys();\n let deleteCount = 0;\n for (let result = keyIter.next(); !result.done; result = keyIter.next()) {\n this.delete(result.value);\n deleteCount += 1;\n }\n return deleteCount;\n }\n}\nexports.default = AbortablePromiseCache;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst AbortablePromiseCache_1 = __importDefault(require(\"./AbortablePromiseCache\"));\nexports.default = AbortablePromiseCache_1.default;\n","'use strict';\n\nclass QuickLRU {\n\tconstructor(options = {}) {\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst value = this.oldCache.get(key);\n\t\t\tthis.oldCache.delete(key);\n\t\t\tthis._set(key, value);\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tset(key, value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, value);\n\t\t} else {\n\t\t\tthis._set(key, value);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\thas(key) {\n\t\treturn this.cache.has(key) || this.oldCache.has(key);\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this.cache.get(key);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this.oldCache.get(key);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tyield item;\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget size() {\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn this._size + oldCacheSize;\n\t}\n}\n\nmodule.exports = QuickLRU;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","export default {}","import { Buffer } from 'buffer';\nexport default class RemoteFile {\n async getBufferFromResponse(response) {\n if (typeof response.buffer === 'function') {\n return response.buffer();\n }\n else if (typeof response.arrayBuffer === 'function') {\n const resp = await response.arrayBuffer();\n return Buffer.from(resp);\n }\n else {\n throw new TypeError('invalid HTTP response object, has no buffer method, and no arrayBuffer method');\n }\n }\n constructor(source, opts = {}) {\n this.baseOverrides = {};\n this.url = source;\n const fetch = opts.fetch || globalThis.fetch.bind(globalThis);\n if (!fetch) {\n throw new TypeError(`no fetch function supplied, and none found in global environment`);\n }\n if (opts.overrides) {\n this.baseOverrides = opts.overrides;\n }\n this.fetchImplementation = fetch;\n }\n async fetch(input, init) {\n let response;\n try {\n response = await this.fetchImplementation(input, init);\n }\n catch (e) {\n if (`${e}`.includes('Failed to fetch')) {\n // refetch to to help work around a chrome bug (discussed in\n // generic-filehandle issue #72) in which the chrome cache returns a\n // CORS error for content in its cache. see also\n // https://github.com/GMOD/jbrowse-components/pull/1511\n console.warn(`generic-filehandle: refetching ${input} to attempt to work around chrome CORS header caching bug`);\n response = await this.fetchImplementation(input, {\n ...init,\n cache: 'reload',\n });\n }\n else {\n throw e;\n }\n }\n return response;\n }\n async read(buffer, offset = 0, length, position = 0, opts = {}) {\n const { headers = {}, signal, overrides = {} } = opts;\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n }\n else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n ...this.baseOverrides.headers,\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n };\n const response = await this.fetch(this.url, args);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n if ((response.status === 200 && position === 0) ||\n response.status === 206) {\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n return { bytesRead: bytesCopied, buffer };\n }\n if (response.status === 200) {\n throw new Error('${this.url} fetch returned status 200, expected 206');\n }\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n }\n async readFile(options = {}) {\n let encoding;\n let opts;\n if (typeof options === 'string') {\n encoding = options;\n opts = {};\n }\n else {\n encoding = options.encoding;\n opts = options;\n delete opts.encoding;\n }\n const { headers = {}, signal, overrides = {} } = opts;\n const args = {\n headers,\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal,\n ...this.baseOverrides,\n ...overrides,\n };\n const response = await this.fetch(this.url, args);\n if (!response) {\n throw new Error('generic-filehandle failed to fetch');\n }\n if (response.status !== 200) {\n throw Object.assign(new Error(`HTTP ${response.status} fetching ${this.url}`), {\n status: response.status,\n });\n }\n if (encoding === 'utf8') {\n return response.text();\n }\n if (encoding) {\n throw new Error(`unsupported encoding: ${encoding}`);\n }\n return this.getBufferFromResponse(response);\n }\n async stat() {\n if (!this._stat) {\n const buf = Buffer.allocUnsafe(10);\n await this.read(buf, 0, 10, 0);\n if (!this._stat) {\n throw new Error(`unable to determine size of file at ${this.url}`);\n }\n }\n return this._stat;\n }\n async close() {\n return;\n }\n}\n//# sourceMappingURL=remoteFile.js.map","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","import { Buffer } from 'buffer';\n//@ts-ignore\nimport { Z_SYNC_FLUSH, Inflate } from 'pako';\n// browserify-zlib, which is the zlib shim used by default in webpacked code,\n// does not properly uncompress bgzf chunks that contain more than\n// one bgzf block, so export an unzip function that uses pako directly\n// if we are running in a browser.\nasync function unzip(inputData) {\n try {\n let strm;\n let pos = 0;\n let i = 0;\n const chunks = [];\n let totalSize = 0;\n let inflator;\n do {\n const remainingInput = inputData.subarray(pos);\n inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n pos += strm.next_in;\n chunks[i] = inflator.result;\n totalSize += chunks[i].length;\n i += 1;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n return Buffer.from(result);\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to pakounzip, except it does extra counting\n// to return the positions of compressed and decompressed\n// data offsets\nasync function unzipChunk(inputData) {\n try {\n let strm;\n let cpos = 0;\n let dpos = 0;\n const blocks = [];\n const cpositions = [];\n const dpositions = [];\n do {\n const remainingInput = inputData.slice(cpos);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = Buffer.from(inflator.result);\n blocks.push(buffer);\n cpositions.push(cpos);\n dpositions.push(dpos);\n cpos += strm.next_in;\n dpos += buffer.length;\n } while (strm.avail_in);\n const buffer = Buffer.concat(blocks);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\n// similar to unzipChunk above but slices (0,minv.dataPosition) and\n// (maxv.dataPosition,end) off\nasync function unzipChunkSlice(inputData, chunk) {\n try {\n let strm;\n const { minv, maxv } = chunk;\n let cpos = minv.blockPosition;\n let dpos = minv.dataPosition;\n const chunks = [];\n const cpositions = [];\n const dpositions = [];\n let totalSize = 0;\n let i = 0;\n do {\n const remainingInput = inputData.subarray(cpos - minv.blockPosition);\n const inflator = new Inflate();\n ({ strm } = inflator);\n inflator.push(remainingInput, Z_SYNC_FLUSH);\n if (inflator.err) {\n throw new Error(inflator.msg);\n }\n const buffer = inflator.result;\n chunks.push(buffer);\n let len = buffer.length;\n cpositions.push(cpos);\n dpositions.push(dpos);\n if (chunks.length === 1 && minv.dataPosition) {\n // this is the first chunk, trim it\n chunks[0] = chunks[0].subarray(minv.dataPosition);\n len = chunks[0].length;\n }\n const origCpos = cpos;\n cpos += strm.next_in;\n dpos += len;\n if (origCpos >= maxv.blockPosition) {\n // this is the last chunk, trim it and stop decompressing\n // note if it is the same block is minv it subtracts that already\n // trimmed part of the slice length\n chunks[i] = chunks[i].subarray(0, maxv.blockPosition === minv.blockPosition\n ? maxv.dataPosition - minv.dataPosition + 1\n : maxv.dataPosition + 1);\n cpositions.push(cpos);\n dpositions.push(dpos);\n totalSize += chunks[i].length;\n break;\n }\n totalSize += chunks[i].length;\n i++;\n } while (strm.avail_in);\n const result = new Uint8Array(totalSize);\n for (let i = 0, offset = 0; i < chunks.length; i++) {\n result.set(chunks[i], offset);\n offset += chunks[i].length;\n }\n const buffer = Buffer.from(result);\n return { buffer, cpositions, dpositions };\n }\n catch (e) {\n //cleanup error message\n if (`${e}`.match(/incorrect header check/)) {\n throw new Error('problem decompressing block: incorrect gzip header check');\n }\n throw e;\n }\n}\nfunction nodeUnzip() {\n throw new Error('nodeUnzip not implemented.');\n}\nexport { unzip, unzipChunk, unzipChunkSlice, unzip as pakoUnzip, nodeUnzip };\n//# sourceMappingURL=unzip-pako.js.map","module.exports = Long;\r\n\r\n/**\r\n * wasm optimizations, to do native i64 multiplication and divide\r\n */\r\nvar wasm = null;\r\n\r\ntry {\r\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\r\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\r\n ])), {}).exports;\r\n} catch (e) {\r\n // no wasm support :(\r\n}\r\n\r\n/**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @constructor\r\n */\r\nfunction Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n}\r\n\r\n// The internal representation of a long is the two given signed, 32-bit values.\r\n// We use 32-bit pieces because these are the size of integers on which\r\n// Javascript performs bit-operations. For operations like addition and\r\n// multiplication, we split each number into 16 bit pieces, which can easily be\r\n// multiplied within Javascript's floating-point representation without overflow\r\n// or change in sign.\r\n//\r\n// In the algorithms below, we frequently reduce the negative case to the\r\n// positive case by negating the input(s) and then post-processing the result.\r\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n// a positive number, it overflows back into a negative). Not handling this\r\n// case would often result in infinite recursion.\r\n//\r\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n// methods on which they depend.\r\n\r\n/**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\nLong.prototype.__isLong__;\r\n\r\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\r\n\r\n/**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\nfunction isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n}\r\n\r\n/**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\nLong.isLong = isLong;\r\n\r\n/**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar INT_CACHE = {};\r\n\r\n/**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\nvar UINT_CACHE = {};\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromInt = fromInt;\r\n\r\n/**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromNumber(value, unsigned) {\r\n if (isNaN(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromNumber = fromNumber;\r\n\r\n/**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n}\r\n\r\n/**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromBits = fromBits;\r\n\r\n/**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n/**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\nLong.fromString = fromString;\r\n\r\n/**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\nfunction fromValue(val, unsigned) {\r\n if (typeof val === 'number')\r\n return fromNumber(val, unsigned);\r\n if (typeof val === 'string')\r\n return fromString(val, unsigned);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\r\n}\r\n\r\n/**\r\n * Converts the specified value to a Long using the appropriate from* function for its type.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {!Long}\r\n */\r\nLong.fromValue = fromValue;\r\n\r\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n// no runtime penalty for these.\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_16_DBL = 1 << 16;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24_DBL = 1 << 24;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n/**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n/**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ZERO = fromInt(0);\r\n\r\n/**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\nLong.ZERO = ZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UZERO = fromInt(0, true);\r\n\r\n/**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\nLong.UZERO = UZERO;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar ONE = fromInt(1);\r\n\r\n/**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\nLong.ONE = ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar UONE = fromInt(1, true);\r\n\r\n/**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\nLong.UONE = UONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar NEG_ONE = fromInt(-1);\r\n\r\n/**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\nLong.NEG_ONE = NEG_ONE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n/**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_VALUE = MAX_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n/**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n/**\r\n * @type {!Long}\r\n * @inner\r\n */\r\nvar MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n/**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\nLong.MIN_VALUE = MIN_VALUE;\r\n\r\n/**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\nvar LongPrototype = Long.prototype;\r\n\r\n/**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\nLongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n};\r\n\r\n/**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\nLongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n};\r\n\r\n/**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\nLongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\nLongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n};\r\n\r\n/**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\nLongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n};\r\n\r\n/**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n};\r\n\r\n/**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eqz = LongPrototype.isZero;\r\n\r\n/**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\nLongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.eq = LongPrototype.equals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n};\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.neq = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ne = LongPrototype.notEquals;\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lt = LongPrototype.lessThan;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.le = LongPrototype.lessThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n};\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\r\n\r\n/**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n};\r\n\r\n/**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\nLongPrototype.comp = LongPrototype.compare;\r\n\r\n/**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n};\r\n\r\n/**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\nLongPrototype.neg = LongPrototype.negate;\r\n\r\n/**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\nLongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n};\r\n\r\n/**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\nLongPrototype.sub = LongPrototype.subtract;\r\n\r\n/**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = wasm.mul(this.low,\r\n this.high,\r\n multiplier.low,\r\n multiplier.high);\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\nLongPrototype.mul = LongPrototype.multiply;\r\n\r\n/**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n // guard against signed division overflow: the largest\r\n // negative number / -1 would be 1 larger than the largest\r\n // positive number, due to two's complement.\r\n if (!this.unsigned &&\r\n this.high === -0x80000000 &&\r\n divisor.low === -1 && divisor.high === -1) {\r\n // be consistent with non-wasm code path\r\n return this;\r\n }\r\n var low = (this.unsigned ? wasm.div_u : wasm.div_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n};\r\n\r\n/**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\nLongPrototype.div = LongPrototype.divide;\r\n\r\n/**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n\r\n // use wasm support if present\r\n if (wasm) {\r\n var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(\r\n this.low,\r\n this.high,\r\n divisor.low,\r\n divisor.high\r\n );\r\n return fromBits(low, wasm.get_high(), this.unsigned);\r\n }\r\n\r\n return this.sub(this.div(divisor).mul(divisor));\r\n};\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.mod = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\nLongPrototype.rem = LongPrototype.modulo;\r\n\r\n/**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\nLongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\nLongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n};\r\n\r\n/**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n};\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\r\n\r\n/**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\nLongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n};\r\n\r\n/**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\nLongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n};\r\n\r\n/**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.} Byte representation\r\n */\r\nLongPrototype.toBytes = function toBytes(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n};\r\n\r\n/**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.} Little endian byte representation\r\n */\r\nLongPrototype.toBytesLE = function toBytesLE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo >>> 16 & 0xff,\r\n lo >>> 24 ,\r\n hi & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi >>> 16 & 0xff,\r\n hi >>> 24\r\n ];\r\n};\r\n\r\n/**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.} Big endian byte representation\r\n */\r\nLongPrototype.toBytesBE = function toBytesBE() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n hi >>> 24 ,\r\n hi >>> 16 & 0xff,\r\n hi >>> 8 & 0xff,\r\n hi & 0xff,\r\n lo >>> 24 ,\r\n lo >>> 16 & 0xff,\r\n lo >>> 8 & 0xff,\r\n lo & 0xff\r\n ];\r\n};\r\n\r\n/**\r\n * Creates a Long from its byte representation.\r\n * @param {!Array.} bytes Byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\r\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\r\n};\r\n\r\n/**\r\n * Creates a Long from its little endian byte representation.\r\n * @param {!Array.} bytes Little endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\r\n return new Long(\r\n bytes[0] |\r\n bytes[1] << 8 |\r\n bytes[2] << 16 |\r\n bytes[3] << 24,\r\n bytes[4] |\r\n bytes[5] << 8 |\r\n bytes[6] << 16 |\r\n bytes[7] << 24,\r\n unsigned\r\n );\r\n};\r\n\r\n/**\r\n * Creates a Long from its big endian byte representation.\r\n * @param {!Array.} bytes Big endian byte representation\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\r\n * @returns {Long} The corresponding Long value\r\n */\r\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\r\n return new Long(\r\n bytes[4] << 24 |\r\n bytes[5] << 16 |\r\n bytes[6] << 8 |\r\n bytes[7],\r\n bytes[0] << 24 |\r\n bytes[1] << 16 |\r\n bytes[2] << 8 |\r\n bytes[3],\r\n unsigned\r\n );\r\n};\r\n","export function longToNumber(long) {\n if (long.greaterThan(Number.MAX_SAFE_INTEGER) ||\n long.lessThan(Number.MIN_SAFE_INTEGER)) {\n throw new Error('integer overflow');\n }\n return long.toNumber();\n}\nclass AbortError extends Error {\n}\n/**\n * Properly check if the given AbortSignal is aborted.\n * Per the standard, if the signal reads as aborted,\n * this function throws either a DOMException AbortError, or a regular error\n * with a `code` attribute set to `ERR_ABORTED`.\n *\n * For convenience, passing `undefined` is a no-op\n *\n * @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute\n * @returns nothing\n */\nexport function checkAbortSignal(signal) {\n if (!signal) {\n return;\n }\n if (signal.aborted) {\n if (typeof DOMException !== 'undefined') {\n // eslint-disable-next-line no-undef\n throw new DOMException('aborted', 'AbortError');\n }\n else {\n const e = new AbortError('aborted');\n e.code = 'ERR_ABORTED';\n throw e;\n }\n }\n}\n/**\n * Skips to the next tick, then runs `checkAbortSignal`.\n * Await this to inside an otherwise synchronous loop to\n * provide a place to break when an abort signal is received.\n * @param {AbortSignal} signal\n */\nexport async function abortBreakPoint(signal) {\n await Promise.resolve();\n checkAbortSignal(signal);\n}\nexport function canMergeBlocks(chunk1, chunk2) {\n return (chunk2.minv.blockPosition - chunk1.maxv.blockPosition < 65000 &&\n chunk2.maxv.blockPosition - chunk1.minv.blockPosition < 5000000);\n}\nexport function optimizeChunks(chunks, lowest) {\n const mergedChunks = [];\n let lastChunk = null;\n if (chunks.length === 0) {\n return chunks;\n }\n chunks.sort(function (c0, c1) {\n const dif = c0.minv.blockPosition - c1.minv.blockPosition;\n if (dif !== 0) {\n return dif;\n }\n else {\n return c0.minv.dataPosition - c1.minv.dataPosition;\n }\n });\n chunks.forEach(chunk => {\n if (!lowest || chunk.maxv.compareTo(lowest) > 0) {\n if (lastChunk === null) {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n else {\n if (canMergeBlocks(lastChunk, chunk)) {\n if (chunk.maxv.compareTo(lastChunk.maxv) > 0) {\n lastChunk.maxv = chunk.maxv;\n }\n }\n else {\n mergedChunks.push(chunk);\n lastChunk = chunk;\n }\n }\n }\n });\n return mergedChunks;\n}\n//# sourceMappingURL=util.js.map","export default class VirtualOffset {\n constructor(blockPosition, dataPosition) {\n this.blockPosition = blockPosition; // < offset of the compressed data block\n this.dataPosition = dataPosition; // < offset into the uncompressed data\n }\n toString() {\n return `${this.blockPosition}:${this.dataPosition}`;\n }\n compareTo(b) {\n return (this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition);\n }\n static min(...args) {\n let min;\n let i = 0;\n for (; !min; i += 1) {\n min = args[i];\n }\n for (; i < args.length; i += 1) {\n if (min.compareTo(args[i]) > 0) {\n min = args[i];\n }\n }\n return min;\n }\n}\nexport function fromBytes(bytes, offset = 0, bigendian = false) {\n if (bigendian) {\n throw new Error('big-endian virtual file offsets not implemented');\n }\n return new VirtualOffset(bytes[offset + 7] * 0x10000000000 +\n bytes[offset + 6] * 0x100000000 +\n bytes[offset + 5] * 0x1000000 +\n bytes[offset + 4] * 0x10000 +\n bytes[offset + 3] * 0x100 +\n bytes[offset + 2], (bytes[offset + 1] << 8) | bytes[offset]);\n}\n//# sourceMappingURL=virtualOffset.js.map","// little class representing a chunk in the index\nexport default class Chunk {\n /**\n * @param {VirtualOffset} minv\n * @param {VirtualOffset} maxv\n * @param {number} bin\n * @param {number} [fetchedSize]\n */\n constructor(minv, maxv, bin, fetchedSize = undefined) {\n this.minv = minv;\n this.maxv = maxv;\n this.bin = bin;\n this._fetchedSize = fetchedSize;\n }\n toUniqueString() {\n return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`;\n }\n toString() {\n return this.toUniqueString();\n }\n compareTo(b) {\n return (this.minv.compareTo(b.minv) ||\n this.maxv.compareTo(b.maxv) ||\n this.bin - b.bin);\n }\n fetchedSize() {\n if (this._fetchedSize !== undefined) {\n return this._fetchedSize;\n }\n return this.maxv.blockPosition + (1 << 16) - this.minv.blockPosition;\n }\n}\n//# sourceMappingURL=chunk.js.map","export default class IndexFile {\n constructor({ filehandle, renameRefSeqs = (n) => n, }) {\n this.filehandle = filehandle;\n this.renameRefSeq = renameRefSeqs;\n }\n async getMetadata(opts = {}) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { indices, ...rest } = await this.parse(opts);\n return rest;\n }\n _findFirstData(currentFdl, virtualOffset) {\n if (currentFdl) {\n return currentFdl.compareTo(virtualOffset) > 0\n ? virtualOffset\n : currentFdl;\n }\n else {\n return virtualOffset;\n }\n }\n async parse(opts = {}) {\n if (!this.parseP) {\n this.parseP = this._parse(opts).catch(e => {\n this.parseP = undefined;\n throw e;\n });\n }\n return this.parseP;\n }\n async hasRefSeq(seqId, opts = {}) {\n return !!((await this.parse(opts)).indices[seqId] || {}).binIndex;\n }\n}\n//# sourceMappingURL=indexFile.js.map","import Long from 'long';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport { longToNumber, optimizeChunks, checkAbortSignal } from './util';\nimport IndexFile from './indexFile';\nconst TBI_MAGIC = 21578324; // TBI\\1\nconst TAD_LIDX_SHIFT = 14;\n/**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\nfunction reg2bins(beg, end) {\n beg += 1; // < convert to 1-based closed\n end -= 1;\n return [\n [0, 0],\n [1 + (beg >> 26), 1 + (end >> 26)],\n [9 + (beg >> 23), 9 + (end >> 23)],\n [73 + (beg >> 20), 73 + (end >> 20)],\n [585 + (beg >> 17), 585 + (end >> 17)],\n [4681 + (beg >> 14), 4681 + (end >> 14)],\n ];\n}\nexport default class TabixIndex extends IndexFile {\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const buf = await this.filehandle.readFile(opts);\n const bytes = await unzip(buf);\n checkAbortSignal(opts.signal);\n // check TBI magic numbers\n if (bytes.readUInt32LE(0) !== TBI_MAGIC /* \"TBI\\1\" */) {\n throw new Error('Not a TBI file');\n // TODO: do we need to support big-endian TBI files?\n }\n // number of reference sequences in the index\n const refCount = bytes.readInt32LE(4);\n const formatFlags = bytes.readInt32LE(8);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const formatOpts = {\n 0: 'generic',\n 1: 'SAM',\n 2: 'VCF',\n };\n const format = formatOpts[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(12),\n start: bytes.readInt32LE(16),\n end: bytes.readInt32LE(20),\n };\n const metaValue = bytes.readInt32LE(24);\n const depth = 5;\n const maxBinNumber = ((1 << ((depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (14 + depth * 3);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(28);\n // read sequence dictionary\n const nameSectionLength = bytes.readInt32LE(32);\n const { refNameToId, refIdToName } = this._parseNameBytes(bytes.slice(36, 36 + nameSectionLength));\n // read the indexes for each reference sequence\n let currOffset = 36 + nameSectionLength;\n let firstDataLine;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats;\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n currOffset += 4;\n if (bin > maxBinNumber + 1) {\n throw new Error('tabix index contains too many bins, please use a CSI index');\n }\n else if (bin === maxBinNumber + 1) {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n if (chunkCount === 2) {\n stats = this.parsePseudoBin(bytes, currOffset);\n }\n currOffset += 16 * chunkCount;\n }\n else {\n const chunkCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n firstDataLine = this._findFirstData(firstDataLine, u);\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n // the linear index\n const linearCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const linearIndex = new Array(linearCount);\n for (let k = 0; k < linearCount; k += 1) {\n linearIndex[k] = fromBytes(bytes, currOffset);\n currOffset += 8;\n firstDataLine = this._findFirstData(firstDataLine, linearIndex[k]);\n }\n return { binIndex, linearIndex, stats };\n });\n return {\n indices,\n metaChar,\n maxBinNumber,\n maxRefLength,\n skipLines,\n firstDataLine,\n columnNumbers,\n coordinateType,\n format,\n refIdToName,\n refNameToId,\n maxBlockSize: 1 << 16,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 16, offset + 24), true));\n return { lineCount };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n const minOffset = ba.linearIndex.length\n ? ba.linearIndex[min >> TAD_LIDX_SHIFT >= ba.linearIndex.length\n ? ba.linearIndex.length - 1\n : min >> TAD_LIDX_SHIFT]\n : new VirtualOffset(0, 0);\n if (!minOffset) {\n console.warn('querying outside of possible tabix range');\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n // Use the linear index to find minimum file position of chunks that could\n // contain alignments in the region\n const nintv = ba.linearIndex.length;\n let lowest = null;\n const minLin = Math.min(min >> 14, nintv - 1);\n const maxLin = Math.min(max >> 14, nintv - 1);\n for (let i = minLin; i <= maxLin; ++i) {\n const vp = ba.linearIndex[i];\n if (vp) {\n if (!lowest || vp.compareTo(lowest) < 0) {\n lowest = vp;\n }\n }\n }\n return optimizeChunks(chunks, lowest);\n }\n}\n//# sourceMappingURL=tbi.js.map","import Long from 'long';\nimport { unzip } from '@gmod/bgzf-filehandle';\nimport VirtualOffset, { fromBytes } from './virtualOffset';\nimport Chunk from './chunk';\nimport { longToNumber, optimizeChunks } from './util';\nimport IndexFile from './indexFile';\nconst CSI1_MAGIC = 21582659; // CSI\\1\nconst CSI2_MAGIC = 38359875; // CSI\\2\nfunction lshift(num, bits) {\n return num * 2 ** bits;\n}\nfunction rshift(num, bits) {\n return Math.floor(num / 2 ** bits);\n}\nexport default class CSI extends IndexFile {\n constructor(args) {\n super(args);\n this.maxBinNumber = 0;\n this.depth = 0;\n this.minShift = 0;\n }\n async lineCount(refName, opts = {}) {\n const indexData = await this.parse(opts);\n if (!indexData) {\n return -1;\n }\n const refId = indexData.refNameToId[refName];\n const idx = indexData.indices[refId];\n if (!idx) {\n return -1;\n }\n const { stats } = indexData.indices[refId];\n if (stats) {\n return stats.lineCount;\n }\n return -1;\n }\n async indexCov() {\n throw new Error('CSI indexes do not support indexcov');\n }\n parseAuxData(bytes, offset) {\n const formatFlags = bytes.readInt32LE(offset);\n const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';\n const format = { 0: 'generic', 1: 'SAM', 2: 'VCF' }[formatFlags & 0xf];\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`);\n }\n const columnNumbers = {\n ref: bytes.readInt32LE(offset + 4),\n start: bytes.readInt32LE(offset + 8),\n end: bytes.readInt32LE(offset + 12),\n };\n const metaValue = bytes.readInt32LE(offset + 16);\n const metaChar = metaValue ? String.fromCharCode(metaValue) : null;\n const skipLines = bytes.readInt32LE(offset + 20);\n const nameSectionLength = bytes.readInt32LE(offset + 24);\n const { refIdToName, refNameToId } = this._parseNameBytes(bytes.slice(offset + 28, offset + 28 + nameSectionLength));\n return {\n refIdToName,\n refNameToId,\n skipLines,\n metaChar,\n columnNumbers,\n format,\n coordinateType,\n };\n }\n _parseNameBytes(namesBytes) {\n let currRefId = 0;\n let currNameStart = 0;\n const refIdToName = [];\n const refNameToId = {};\n for (let i = 0; i < namesBytes.length; i += 1) {\n if (!namesBytes[i]) {\n if (currNameStart < i) {\n let refName = namesBytes.toString('utf8', currNameStart, i);\n refName = this.renameRefSeq(refName);\n refIdToName[currRefId] = refName;\n refNameToId[refName] = currRefId;\n }\n currNameStart = i + 1;\n currRefId += 1;\n }\n }\n return { refNameToId, refIdToName };\n }\n // fetch and parse the index\n async _parse(opts = {}) {\n const bytes = await unzip((await this.filehandle.readFile(opts)));\n // check TBI magic numbers\n let csiVersion;\n if (bytes.readUInt32LE(0) === CSI1_MAGIC) {\n csiVersion = 1;\n }\n else if (bytes.readUInt32LE(0) === CSI2_MAGIC) {\n csiVersion = 2;\n }\n else {\n throw new Error('Not a CSI file');\n // TODO: do we need to support big-endian CSI files?\n }\n this.minShift = bytes.readInt32LE(4);\n this.depth = bytes.readInt32LE(8);\n this.maxBinNumber = ((1 << ((this.depth + 1) * 3)) - 1) / 7;\n const maxRefLength = 2 ** (this.minShift + this.depth * 3);\n const auxLength = bytes.readInt32LE(12);\n const aux = auxLength && auxLength >= 30\n ? this.parseAuxData(bytes, 16)\n : {\n refIdToName: [],\n refNameToId: {},\n metaChar: null,\n columnNumbers: { ref: 0, start: 1, end: 2 },\n coordinateType: 'zero-based-half-open',\n format: 'generic',\n };\n const refCount = bytes.readInt32LE(16 + auxLength);\n // read the indexes for each reference sequence\n let firstDataLine;\n let currOffset = 16 + auxLength + 4;\n const indices = new Array(refCount).fill(0).map(() => {\n // the binning index\n const binCount = bytes.readInt32LE(currOffset);\n currOffset += 4;\n const binIndex = {};\n let stats; // < provided by parsing a pseudo-bin, if present\n for (let j = 0; j < binCount; j += 1) {\n const bin = bytes.readUInt32LE(currOffset);\n if (bin > this.maxBinNumber) {\n // this is a fake bin that actually has stats information\n // about the reference sequence in it\n stats = this.parsePseudoBin(bytes, currOffset + 4);\n currOffset += 4 + 8 + 4 + 16 + 16;\n }\n else {\n const loffset = fromBytes(bytes, currOffset + 4);\n firstDataLine = this._findFirstData(firstDataLine, loffset);\n const chunkCount = bytes.readInt32LE(currOffset + 12);\n currOffset += 16;\n const chunks = new Array(chunkCount);\n for (let k = 0; k < chunkCount; k += 1) {\n const u = fromBytes(bytes, currOffset);\n const v = fromBytes(bytes, currOffset + 8);\n currOffset += 16;\n // this._findFirstData(data, u)\n chunks[k] = new Chunk(u, v, bin);\n }\n binIndex[bin] = chunks;\n }\n }\n return { binIndex, stats };\n });\n return {\n ...aux,\n csi: true,\n refCount,\n maxBlockSize: 1 << 16,\n firstDataLine,\n csiVersion,\n indices,\n depth: this.depth,\n maxBinNumber: this.maxBinNumber,\n maxRefLength,\n };\n }\n parsePseudoBin(bytes, offset) {\n const lineCount = longToNumber(Long.fromBytesLE(bytes.slice(offset + 28, offset + 36), true));\n return { lineCount };\n }\n async blocksForRange(refName, min, max, opts = {}) {\n if (min < 0) {\n min = 0;\n }\n const indexData = await this.parse(opts);\n if (!indexData) {\n return [];\n }\n const refId = indexData.refNameToId[refName];\n const ba = indexData.indices[refId];\n if (!ba) {\n return [];\n }\n // const { linearIndex, binIndex } = indexes\n const overlappingBins = this.reg2bins(min, max); // List of bin #s that overlap min, max\n const chunks = [];\n // Find chunks in overlapping bins. Leaf bins (< 4681) are not pruned\n for (const [start, end] of overlappingBins) {\n for (let bin = start; bin <= end; bin++) {\n if (ba.binIndex[bin]) {\n const binChunks = ba.binIndex[bin];\n for (let c = 0; c < binChunks.length; ++c) {\n chunks.push(new Chunk(binChunks[c].minv, binChunks[c].maxv, bin));\n }\n }\n }\n }\n return optimizeChunks(chunks, new VirtualOffset(0, 0));\n }\n /**\n * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)\n */\n reg2bins(beg, end) {\n beg -= 1; // < convert to 1-based closed\n if (beg < 1) {\n beg = 1;\n }\n if (end > 2 ** 50) {\n end = 2 ** 34;\n } // 17 GiB ought to be enough for anybody\n end -= 1;\n let l = 0;\n let t = 0;\n let s = this.minShift + this.depth * 3;\n const bins = [];\n for (; l <= this.depth; s -= 3, t += lshift(1, l * 3), l += 1) {\n const b = t + rshift(beg, s);\n const e = t + rshift(end, s);\n if (e - b + bins.length > this.maxBinNumber) {\n throw new Error(`query ${beg}-${end} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);\n }\n bins.push([b, e]);\n }\n return bins;\n }\n}\n//# sourceMappingURL=csi.js.map","import AbortablePromiseCache from 'abortable-promise-cache';\nimport LRU from 'quick-lru';\nimport { Buffer } from 'buffer';\nimport { LocalFile } from 'generic-filehandle';\nimport { unzip, unzipChunkSlice } from '@gmod/bgzf-filehandle';\nimport { checkAbortSignal } from './util';\nimport TBI from './tbi';\nimport CSI from './csi';\nconst decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8') : undefined;\nfunction timeout(time) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\nexport default class TabixIndexedFile {\n /**\n * @param {object} args\n * @param {string} [args.path]\n * @param {filehandle} [args.filehandle]\n * @param {string} [args.tbiPath]\n * @param {filehandle} [args.tbiFilehandle]\n * @param {string} [args.csiPath]\n * @param {filehandle} [args.csiFilehandle]\n * @param {number} [args.yieldTime] yield to main thread after N milliseconds if reading features is taking a long time to avoid hanging main thread\n * @param {function} [args.renameRefSeqs] optional function with sig `string => string` to transform\n * reference sequence names for the purpose of indexing and querying. note that the data that is returned is\n * not altered, just the names of the reference sequences that are used for querying.\n */\n constructor({ path, filehandle, tbiPath, tbiFilehandle, csiPath, csiFilehandle, yieldTime = 500, chunkSizeLimit = 50000000, renameRefSeqs = n => n, chunkCacheSize = 5 * 2 ** 20, }) {\n if (filehandle) {\n this.filehandle = filehandle;\n }\n else if (path) {\n this.filehandle = new LocalFile(path);\n }\n else {\n throw new TypeError('must provide either filehandle or path');\n }\n if (tbiFilehandle) {\n this.index = new TBI({\n filehandle: tbiFilehandle,\n renameRefSeqs,\n });\n }\n else if (csiFilehandle) {\n this.index = new CSI({\n filehandle: csiFilehandle,\n renameRefSeqs,\n });\n }\n else if (tbiPath) {\n this.index = new TBI({\n filehandle: new LocalFile(tbiPath),\n renameRefSeqs,\n });\n }\n else if (csiPath) {\n this.index = new CSI({\n filehandle: new LocalFile(csiPath),\n renameRefSeqs,\n });\n }\n else if (path) {\n this.index = new TBI({\n filehandle: new LocalFile(`${path}.tbi`),\n renameRefSeqs,\n });\n }\n else {\n throw new TypeError('must provide one of tbiFilehandle, tbiPath, csiFilehandle, or csiPath');\n }\n this.chunkSizeLimit = chunkSizeLimit;\n this.renameRefSeq = renameRefSeqs;\n this.yieldTime = yieldTime;\n this.chunkCache = new AbortablePromiseCache({\n cache: new LRU({ maxSize: Math.floor(chunkCacheSize / (1 << 16)) }),\n fill: (args, signal) => this.readChunk(args, { signal }),\n });\n }\n /**\n * @param refName name of the reference sequence\n * @param start start of the region (in 0-based half-open coordinates)\n * @param end end of the region (in 0-based half-open coordinates)\n * @param opts callback called for each line in the region. can also pass a object param containing obj.lineCallback, obj.signal, etc\n * @returns promise that is resolved when the whole read is finished, rejected on error\n */\n async getLines(refName, start, end, opts) {\n let signal;\n let options = {};\n let callback;\n if (typeof opts === 'undefined') {\n throw new TypeError('line callback must be provided');\n }\n if (typeof opts === 'function') {\n callback = opts;\n }\n else {\n options = opts;\n callback = opts.lineCallback;\n }\n if (refName === undefined) {\n throw new TypeError('must provide a reference sequence name');\n }\n if (!callback) {\n throw new TypeError('line callback must be provided');\n }\n const metadata = await this.index.getMetadata(options);\n checkAbortSignal(signal);\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = metadata.maxRefLength;\n }\n if (!(start <= end)) {\n throw new TypeError('invalid start and end coordinates. start must be less than or equal to end');\n }\n if (start === end) {\n return;\n }\n const chunks = await this.index.blocksForRange(refName, start, end, options);\n checkAbortSignal(signal);\n // check the chunks for any that are over the size limit. if\n // any are, don't fetch any of them\n for (let i = 0; i < chunks.length; i += 1) {\n const size = chunks[i].fetchedSize();\n if (size > this.chunkSizeLimit) {\n throw new Error(`Too much data. Chunk size ${size.toLocaleString()} bytes exceeds chunkSizeLimit of ${this.chunkSizeLimit.toLocaleString()}.`);\n }\n }\n // now go through each chunk and parse and filter the lines out of it\n let last = Date.now();\n for (let chunkNum = 0; chunkNum < chunks.length; chunkNum += 1) {\n let previousStartCoordinate;\n const c = chunks[chunkNum];\n const { buffer, cpositions, dpositions } = await this.chunkCache.get(c.toString(), c);\n checkAbortSignal(signal);\n let blockStart = 0;\n let pos = 0;\n while (blockStart < buffer.length) {\n const n = buffer.indexOf('\\n', blockStart);\n if (n === -1) {\n break;\n }\n const b = buffer.slice(blockStart, n);\n const line = (decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString();\n if (dpositions) {\n while (blockStart + c.minv.dataPosition >= dpositions[pos++]) { }\n pos--;\n }\n // filter the line for whether it is within the requested range\n const { startCoordinate, overlaps } = this.checkLine(metadata, refName, start, end, line);\n // do a small check just to make sure that the lines are really sorted\n // by start coordinate\n if (previousStartCoordinate !== undefined &&\n startCoordinate !== undefined &&\n previousStartCoordinate > startCoordinate) {\n throw new Error(`Lines not sorted by start coordinate (${previousStartCoordinate} > ${startCoordinate}), this file is not usable with Tabix.`);\n }\n previousStartCoordinate = startCoordinate;\n if (overlaps) {\n callback(line.trim(), \n // cpositions[pos] refers to actual file offset of a bgzip block boundaries\n //\n // we multiply by (1 <<8) in order to make sure each block has a \"unique\"\n // address space so that data in that block could never overlap\n //\n // then the blockStart-dpositions is an uncompressed file offset from\n // that bgzip block boundary, and since the cpositions are multiplied by\n // (1 << 8) these uncompressed offsets get a unique space\n cpositions[pos] * (1 << 8) +\n (blockStart - dpositions[pos]) +\n c.minv.dataPosition +\n 1);\n }\n else if (startCoordinate !== undefined && startCoordinate >= end) {\n // the lines were overlapping the region, but now have stopped, so\n // we must be at the end of the relevant data and we can stop\n // processing data now\n return;\n }\n // yield if we have emitted beyond the yield limit\n if (this.yieldTime && last - Date.now() > this.yieldTime) {\n last = Date.now();\n checkAbortSignal(signal);\n await timeout(1);\n }\n blockStart = n + 1;\n }\n }\n }\n async getMetadata(opts = {}) {\n return this.index.getMetadata(opts);\n }\n /**\n * get a buffer containing the \"header\" region of\n * the file, which are the bytes up to the first\n * non-meta line\n */\n async getHeaderBuffer(opts = {}) {\n const { firstDataLine, metaChar, maxBlockSize } = await this.getMetadata(opts);\n checkAbortSignal(opts.signal);\n const maxFetch = ((firstDataLine === null || firstDataLine === void 0 ? void 0 : firstDataLine.blockPosition) || 0) + maxBlockSize;\n // TODO: what if we don't have a firstDataLine, and the header\n // actually takes up more than one block? this case is not covered here\n let bytes = await this._readRegion(0, maxFetch, opts);\n checkAbortSignal(opts.signal);\n try {\n bytes = await unzip(bytes);\n }\n catch (e) {\n console.error(e);\n throw new Error(\n //@ts-ignore\n `error decompressing block ${e.code} at 0 (length ${maxFetch}) ${e}`);\n }\n // trim off lines after the last non-meta line\n if (metaChar) {\n // trim backward from the end\n let lastNewline = -1;\n const newlineByte = '\\n'.charCodeAt(0);\n const metaByte = metaChar.charCodeAt(0);\n for (let i = 0; i < bytes.length; i += 1) {\n if (i === lastNewline + 1 && bytes[i] !== metaByte) {\n break;\n }\n if (bytes[i] === newlineByte) {\n lastNewline = i;\n }\n }\n bytes = bytes.slice(0, lastNewline + 1);\n }\n return bytes;\n }\n /**\n * get a string containing the \"header\" region of the\n * file, is the portion up to the first non-meta line\n *\n * @returns {Promise} for a string\n */\n async getHeader(opts = {}) {\n const bytes = await this.getHeaderBuffer(opts);\n return bytes.toString('utf8');\n }\n /**\n * get an array of reference sequence names, in the order in which\n * they occur in the file. reference sequence renaming is not applied\n * to these names.\n */\n async getReferenceSequenceNames(opts = {}) {\n const metadata = await this.getMetadata(opts);\n return metadata.refIdToName;\n }\n /**\n * @param {object} metadata metadata object from the parsed index,\n * containing columnNumbers, metaChar, and format\n * @param {string} regionRefName\n * @param {number} regionStart region start coordinate (0-based-half-open)\n * @param {number} regionEnd region end coordinate (0-based-half-open)\n * @param {array[string]} line\n * @returns {object} like `{startCoordinate, overlaps}`. overlaps is boolean,\n * true if line is a data line that overlaps the given region\n */\n checkLine(metadata, regionRefName, regionStart, regionEnd, line) {\n const { columnNumbers, metaChar, coordinateType, format } = metadata;\n // skip meta lines\n if (line.charAt(0) === metaChar) {\n return { overlaps: false };\n }\n // check ref/start/end using column metadata from index\n let { ref, start, end } = columnNumbers;\n if (!ref) {\n ref = 0;\n }\n if (!start) {\n start = 0;\n }\n if (!end) {\n end = 0;\n }\n if (format === 'VCF') {\n end = 8;\n }\n const maxColumn = Math.max(ref, start, end);\n // this code is kind of complex, but it is fairly fast.\n // basically, we want to avoid doing a split, because if the lines are really long\n // that could lead to us allocating a bunch of extra memory, which is slow\n let currentColumnNumber = 1; // cols are numbered starting at 1 in the index metadata\n let currentColumnStart = 0;\n let refSeq = '';\n let startCoordinate = -Infinity;\n for (let i = 0; i < line.length + 1; i += 1) {\n if (line[i] === '\\t' || i === line.length) {\n if (currentColumnNumber === ref) {\n if (this.renameRefSeq(line.slice(currentColumnStart, i)) !==\n regionRefName) {\n return { overlaps: false };\n }\n }\n else if (currentColumnNumber === start) {\n startCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n // we convert to 0-based-half-open\n if (coordinateType === '1-based-closed') {\n startCoordinate -= 1;\n }\n if (startCoordinate >= regionEnd) {\n return { startCoordinate, overlaps: false };\n }\n if (end === 0 || end === start) {\n // if we have no end, we assume the feature is 1 bp long\n if (startCoordinate + 1 <= regionStart) {\n return { startCoordinate, overlaps: false };\n }\n }\n }\n else if (format === 'VCF' && currentColumnNumber === 4) {\n refSeq = line.slice(currentColumnStart, i);\n }\n else if (currentColumnNumber === end) {\n let endCoordinate;\n // this will never match if there is no end column\n if (format === 'VCF') {\n endCoordinate = this._getVcfEnd(startCoordinate, refSeq, line.slice(currentColumnStart, i));\n }\n else {\n endCoordinate = parseInt(line.slice(currentColumnStart, i), 10);\n }\n if (endCoordinate <= regionStart) {\n return { overlaps: false };\n }\n }\n currentColumnStart = i + 1;\n currentColumnNumber += 1;\n if (currentColumnNumber > maxColumn) {\n break;\n }\n }\n }\n return { startCoordinate, overlaps: true };\n }\n _getVcfEnd(startCoordinate, refSeq, info) {\n let endCoordinate = startCoordinate + refSeq.length;\n // ignore TRA features as they specify CHR2 and END\n // as being on a different chromosome\n // if CHR2 is on the same chromosome, still ignore it\n // because there should be another pairwise feature\n // at the end of this one\n const isTRA = info.indexOf('SVTYPE=TRA') !== -1;\n if (info[0] !== '.' && !isTRA) {\n let prevChar = ';';\n for (let j = 0; j < info.length; j += 1) {\n if (prevChar === ';' && info.slice(j, j + 4) === 'END=') {\n let valueEnd = info.indexOf(';', j);\n if (valueEnd === -1) {\n valueEnd = info.length;\n }\n endCoordinate = parseInt(info.slice(j + 4, valueEnd), 10);\n break;\n }\n prevChar = info[j];\n }\n }\n else if (isTRA) {\n return startCoordinate + 1;\n }\n return endCoordinate;\n }\n /**\n * return the approximate number of data lines in the given reference sequence\n * @param refSeq reference sequence name\n * @returns number of data lines present on that reference sequence\n */\n async lineCount(refName, opts = {}) {\n return this.index.lineCount(refName, opts);\n }\n async _readRegion(pos, size, opts = {}) {\n const b = Buffer.alloc(size);\n const { bytesRead, buffer } = await this.filehandle.read(b, 0, size, pos, opts);\n return buffer.slice(0, bytesRead);\n }\n /**\n * read and uncompress the data in a chunk (composed of one or more\n * contiguous bgzip blocks) of the file\n */\n async readChunk(c, opts = {}) {\n // fetch the uncompressed data, uncompress carefully a block at a time,\n // and stop when done\n const data = await this._readRegion(c.minv.blockPosition, c.fetchedSize(), opts);\n try {\n return unzipChunkSlice(data, c);\n }\n catch (e) {\n throw new Error(`error decompressing c ${c.toString()} ${e}`);\n }\n }\n}\n//# sourceMappingURL=tabixIndexedFile.js.map","export default {\n // INFO fields\n InfoFields: {\n // from the VCF4.3 spec, https://samtools.github.io/hts-specs/VCFv4.3.pdf\n AA: { Number: 1, Type: 'String', Description: 'Ancestral allele' },\n AC: {\n Number: 'A',\n Type: 'Integer',\n Description: 'Allele count in genotypes, for each ALT allele, in the same order as listed',\n },\n AD: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Total read depth for each allele',\n },\n ADF: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Read depth for each allele on the forward strand',\n },\n ADR: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Read depth for each allele on the reverse strand',\n },\n AF: {\n Number: 'A',\n Type: 'Float',\n Description: 'Allele frequency for each ALT allele in the same order as listed (estimated from primary data, not called genotypes)',\n },\n AN: {\n Number: 1,\n Type: 'Integer',\n Description: 'Total number of alleles in called genotypes',\n },\n BQ: {\n Number: 1,\n Type: 'Float',\n Description: 'RMS base quality',\n },\n CIGAR: {\n Number: 1,\n Type: 'Float',\n Description: 'Cigar string describing how to align an alternate allele to the reference allele',\n },\n DB: {\n Number: 0,\n Type: 'Flag',\n Description: 'dbSNP membership',\n },\n DP: {\n Number: 1,\n Type: 'Integer',\n Description: 'combined depth across samples',\n },\n END: {\n Number: 1,\n Type: 'Integer',\n Description: 'End position (for use with symbolic alleles)',\n },\n H2: {\n Number: 0,\n Type: 'Flag',\n Description: 'HapMap2 membership',\n },\n H3: {\n Number: 0,\n Type: 'Flag',\n Description: 'HapMap3 membership',\n },\n MQ: {\n Number: 1,\n Type: null,\n Description: 'RMS mapping quality',\n },\n MQ0: {\n Number: 1,\n Type: 'Integer',\n Description: 'Number of MAPQ == 0 reads',\n },\n NS: {\n Number: 1,\n Type: 'Integer',\n Description: 'Number of samples with data',\n },\n SB: {\n Number: 4,\n Type: 'Integer',\n Description: 'Strand bias',\n },\n SOMATIC: {\n Number: 0,\n Type: 'Flag',\n Description: 'Somatic mutation (for cancer genomics)',\n },\n VALIDATED: {\n Number: 0,\n Type: 'Flag',\n Description: 'Validated by follow-up experiment',\n },\n '1000G': {\n Number: 0,\n Type: 'Flag',\n Description: '1000 Genomes membership',\n },\n // specifically for structural variants\n IMPRECISE: {\n Number: 0,\n Type: 'Flag',\n Description: 'Imprecise structural variation',\n },\n NOVEL: {\n Number: 0,\n Type: 'Flag',\n Description: 'Indicates a novel structural variation',\n },\n // For precise variants, END is POS + length of REF allele - 1,\n // and the for imprecise variants the corresponding best estimate.\n SVTYPE: {\n Number: 1,\n Type: 'String',\n Description: 'Type of structural variant',\n },\n // Value should be one of DEL, INS, DUP, INV, CNV, BND. This key can\n // be derived from the REF/ALT fields but is useful for filtering.\n SVLEN: {\n Number: null,\n Type: 'Integer',\n Description: 'Difference in length between REF and ALT alleles',\n },\n // One value for each ALT allele. Longer ALT alleles (e.g. insertions)\n // have positive values, shorter ALT alleles (e.g. deletions)\n // have negative values.\n CIPOS: {\n Number: 2,\n Type: 'Integer',\n Description: 'Confidence interval around POS for imprecise variants',\n },\n CIEND: {\n Number: 2,\n Type: 'Integer',\n Description: 'Confidence interval around END for imprecise variants',\n },\n HOMLEN: {\n Type: 'Integer',\n Description: 'Length of base pair identical micro-homology at event breakpoints',\n },\n HOMSEQ: {\n Type: 'String',\n Description: 'Sequence of base pair identical micro-homology at event breakpoints',\n },\n BKPTID: {\n Type: 'String',\n Description: 'ID of the assembled alternate allele in the assembly file',\n },\n // For precise variants, the consensus sequence the alternate allele assembly\n // is derivable from the REF and ALT fields. However, the alternate allele\n // assembly file may contain additional information about the characteristics\n // of the alt allele contigs.\n MEINFO: {\n Number: 4,\n Type: 'String',\n Description: 'Mobile element info of the form NAME,START,END,POLARITY',\n },\n METRANS: {\n Number: 4,\n Type: 'String',\n Description: 'Mobile element transduction info of the form CHR,START,END,POLARITY',\n },\n DGVID: {\n Number: 1,\n Type: 'String',\n Description: 'ID of this element in Database of Genomic Variation',\n },\n DBVARID: {\n Number: 1,\n Type: 'String',\n Description: 'ID of this element in DBVAR',\n },\n DBRIPID: {\n Number: 1,\n Type: 'String',\n Description: 'ID of this element in DBRIP',\n },\n MATEID: {\n Number: null,\n Type: 'String',\n Description: 'ID of mate breakends',\n },\n PARID: {\n Number: 1,\n Type: 'String',\n Description: 'ID of partner breakend',\n },\n EVENT: {\n Number: 1,\n Type: 'String',\n Description: 'ID of event associated to breakend',\n },\n CILEN: {\n Number: 2,\n Type: 'Integer',\n Description: 'Confidence interval around the inserted material between breakend',\n },\n DPADJ: { Type: 'Integer', Description: 'Read Depth of adjacency' },\n CN: {\n Number: 1,\n Type: 'Integer',\n Description: 'Copy number of segment containing breakend',\n },\n CNADJ: {\n Number: null,\n Type: 'Integer',\n Description: 'Copy number of adjacency',\n },\n CICN: {\n Number: 2,\n Type: 'Integer',\n Description: 'Confidence interval around copy number for the segment',\n },\n CICNADJ: {\n Number: null,\n Type: 'Integer',\n Description: 'Confidence interval around copy number for the adjacency',\n },\n },\n // FORMAT fields\n GenotypeFields: {\n // from the VCF4.3 spec, https://samtools.github.io/hts-specs/VCFv4.3.pdf\n AD: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Read depth for each allele',\n },\n ADF: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Read depth for each allele on the forward strand',\n },\n ADR: {\n Number: 'R',\n Type: 'Integer',\n Description: 'Read depth for each allele on the reverse strand',\n },\n DP: {\n Number: 1,\n Type: 'Integer',\n Description: 'Read depth',\n },\n EC: {\n Number: 'A',\n Type: 'Integer',\n Description: 'Expected alternate allele counts',\n },\n FT: {\n Number: 1,\n Type: 'String',\n Description: 'Filter indicating if this genotype was \"called\"',\n },\n GL: {\n Number: 'G',\n Type: 'Float',\n Description: 'Genotype likelihoods',\n },\n GP: {\n Number: 'G',\n Type: 'Float',\n Description: 'Genotype posterior probabilities',\n },\n GQ: {\n Number: 1,\n Type: 'Integer',\n Description: 'Conditional genotype quality',\n },\n GT: {\n Number: 1,\n Type: 'String',\n Description: 'Genotype',\n },\n HQ: {\n Number: 2,\n Type: 'Integer',\n Description: 'Haplotype quality',\n },\n MQ: {\n Number: 1,\n Type: 'Integer',\n Description: 'RMS mapping quality',\n },\n PL: {\n Number: 'G',\n Type: 'Integer',\n Description: 'Phred-scaled genotype likelihoods rounded to the closest integer',\n },\n PQ: {\n Number: 1,\n Type: 'Integer',\n Description: 'Phasing quality',\n },\n PS: {\n Number: 1,\n Type: 'Integer',\n Description: 'Phase set',\n },\n },\n // ALT fields\n AltTypes: {\n DEL: {\n Description: 'Deletion relative to the reference',\n },\n INS: {\n Description: 'Insertion of novel sequence relative to the reference',\n },\n DUP: {\n Description: 'Region of elevated copy number relative to the reference',\n },\n INV: {\n Description: 'Inversion of reference sequence',\n },\n CNV: {\n Description: 'Copy number variable region (may be both deletion and duplication)',\n },\n 'DUP:TANDEM': {\n Description: 'Tandem duplication',\n },\n 'DEL:ME': {\n Description: 'Deletion of mobile element relative to the reference',\n },\n 'INS:ME': {\n Description: 'Insertion of a mobile element relative to the reference',\n },\n NON_REF: {\n Description: 'Represents any possible alternative allele at this location',\n },\n '*': {\n Description: 'Represents any possible alternative allele at this location',\n },\n },\n // FILTER fields\n FilterTypes: {\n PASS: {\n Description: 'Passed all filters',\n },\n },\n};\n//# sourceMappingURL=vcfReserved.js.map","import vcfReserved from './vcfReserved';\nfunction Variant(stuff) {\n //@ts-ignore\n Object.assign(this, stuff);\n}\nfunction decodeURIComponentNoThrow(uri) {\n try {\n return decodeURIComponent(uri);\n }\n catch (e) {\n // avoid throwing exception on a failure to decode URI component\n return uri;\n }\n}\n/**\n * Class representing a VCF parser, instantiated with the VCF header.\n * @param {object} args\n * @param {string} args.header - The VCF header. Supports both LF and CRLF\n * newlines.\n * @param {boolean} args.strict - Whether to parse in strict mode or not (default true)\n */\nexport default class VCF {\n constructor({ header = '', strict = true, }) {\n if (!header || !header.length) {\n throw new Error('empty header received');\n }\n const headerLines = header.split(/[\\r\\n]+/).filter(line => line);\n if (!headerLines.length) {\n throw new Error('no non-empty header lines specified');\n }\n this.strict = strict;\n this.metadata = JSON.parse(JSON.stringify({\n INFO: vcfReserved.InfoFields,\n FORMAT: vcfReserved.GenotypeFields,\n ALT: vcfReserved.AltTypes,\n FILTER: vcfReserved.FilterTypes,\n }));\n let lastLine;\n headerLines.forEach(line => {\n if (!line.startsWith('#')) {\n throw new Error(`Bad line in header:\\n${line}`);\n }\n else if (line.startsWith('##')) {\n this._parseMetadata(line);\n }\n else {\n lastLine = line;\n }\n });\n if (!lastLine) {\n throw new Error('No format line found in header');\n }\n const fields = lastLine.trim().split('\\t');\n const thisHeader = fields.slice(0, 8);\n const correctHeader = [\n '#CHROM',\n 'POS',\n 'ID',\n 'REF',\n 'ALT',\n 'QUAL',\n 'FILTER',\n 'INFO',\n ];\n if (fields.length < 8) {\n throw new Error(`VCF header missing columns:\\n${lastLine}`);\n }\n else if (thisHeader.length !== correctHeader.length ||\n !thisHeader.every((value, index) => value === correctHeader[index])) {\n throw new Error(`VCF column headers not correct:\\n${lastLine}`);\n }\n this.samples = fields.slice(9);\n }\n _parseGenotypes(format, prerest) {\n const rest = prerest.split('\\t');\n const genotypes = {};\n const formatKeys = format === null || format === void 0 ? void 0 : format.split(':');\n if (formatKeys) {\n this.samples.forEach((sample, index) => {\n genotypes[sample] = {};\n formatKeys.forEach(key => {\n genotypes[sample][key] = null;\n });\n rest[index]\n .split(':')\n .filter(f => f)\n .forEach((val, index) => {\n let thisValue;\n if (val === '' || val === '.' || val === undefined) {\n thisValue = null;\n }\n else {\n const entries = val\n .split(',')\n .map(ent => (ent === '.' ? null : ent));\n const valueType = this.getMetadata('FORMAT', formatKeys[index], 'Type');\n if (valueType === 'Integer' || valueType === 'Float') {\n thisValue = entries.map(val => (val ? +val : val));\n }\n else {\n thisValue = entries;\n }\n }\n genotypes[sample][formatKeys[index]] = thisValue;\n }, {});\n });\n }\n return genotypes;\n }\n /**\n * Parse a VCF metadata line (i.e. a line that starts with \"##\") and add its\n * properties to the object.\n * @param {string} line - A line from the VCF. Supports both LF and CRLF\n * newlines.\n */\n _parseMetadata(line) {\n const match = line.trim().match(/^##(.+?)=(.*)/);\n if (!match) {\n throw new Error(`Line is not a valid metadata line: ${line}`);\n }\n const [metaKey, metaVal] = match.slice(1, 3);\n if (metaVal.startsWith('<')) {\n if (!(metaKey in this.metadata)) {\n this.metadata[metaKey] = {};\n }\n const [id, keyVals] = this._parseStructuredMetaVal(metaVal);\n this.metadata[metaKey][id] = keyVals;\n }\n else {\n this.metadata[metaKey] = metaVal;\n }\n }\n /**\n * Parse a VCF header structured meta string (i.e. a meta value that starts\n * with \"$/g, ''), ',');\n const id = keyVals.ID;\n delete keyVals.ID;\n if ('Number' in keyVals) {\n if (!Number.isNaN(Number(keyVals.Number))) {\n keyVals.Number = Number(keyVals.Number);\n }\n }\n return [id, keyVals];\n }\n /**\n * Get metadata filtered by the elements in args. For example, can pass\n * ('INFO', 'DP') to only get info on an metadata tag that was like\n * \"##INFO=\"\n * @param {...string} args - List of metadata filter strings.\n *\n * @returns {any} An object, string, or number, depending on the filtering\n */\n getMetadata(...args) {\n let filteredMetadata = this.metadata;\n for (let i = 0; i < args.length; i += 1) {\n filteredMetadata = filteredMetadata[args[i]];\n if (!filteredMetadata) {\n return filteredMetadata;\n }\n }\n return filteredMetadata;\n }\n /**\n * Sometimes VCFs have key-value strings that allow the separator within\n * the value if it's in quotes, like:\n * 'ID=DB,Number=0,Type=Flag,Description=\"dbSNP membership, build 129\"'\n *\n * Parse this at a low level since we can't just split at \",\" (or whatever\n * separator). Above line would be parsed to:\n * {ID: 'DB', Number: '0', Type: 'Flag', Description: 'dbSNP membership, build 129'}\n * @param {string} str - Key-value pairs in a string\n * @param {string} [pairSeparator] - A string that separates sets of key-value\n * pairs\n *\n * @returns {object} An object containing the key-value pairs\n */\n _parseKeyValue(str, pairSeparator = ';') {\n const data = {};\n let currKey = '';\n let currValue = '';\n let state = 1; // states: 1: read key to = or pair sep, 2: read value to sep or quote, 3: read value to quote\n for (let i = 0; i < str.length; i += 1) {\n if (state === 1) {\n // read key to = or pair sep\n if (str[i] === '=') {\n state = 2;\n }\n else if (str[i] !== pairSeparator) {\n currKey += str[i];\n }\n else if (currValue === '') {\n data[currKey] = null;\n currKey = '';\n }\n }\n else if (state === 2) {\n // read value to pair sep or quote\n if (str[i] === pairSeparator) {\n data[currKey] = currValue;\n currKey = '';\n currValue = '';\n state = 1;\n }\n else if (str[i] === '\"') {\n state = 3;\n }\n else {\n currValue += str[i];\n }\n }\n else if (state === 3) {\n // read value to quote\n if (str[i] !== '\"') {\n currValue += str[i];\n }\n else {\n state = 2;\n }\n }\n }\n if (state === 2 || state === 3) {\n data[currKey] = currValue;\n }\n else if (state === 1) {\n data[currKey] = null;\n }\n return data;\n }\n /**\n * Parse a VCF line into an object like { CHROM POS ID REF ALT QUAL FILTER\n * INFO } with SAMPLES optionally included if present in the VCF\n * @param {string} line - A string of a line from a VCF. Supports both LF and\n * CRLF newlines.\n */\n parseLine(line) {\n // eslint-disable-next-line no-param-reassign\n line = line.trim();\n if (!line.length) {\n return undefined;\n }\n //@ts-ignore\n const parser = this; // so we can include this in lazy-property closure\n let currChar = 0;\n for (let currField = 0; currChar < line.length; currChar += 1) {\n if (line[currChar] === '\\t') {\n currField += 1;\n }\n if (currField === 9) {\n // reached genotypes, rest of fields are evaluated lazily\n break;\n }\n }\n const fields = line.substr(0, currChar).split('\\t');\n const rest = line.substr(currChar + 1);\n const [CHROM, POS, ID, REF, ALT, QUAL, FILTER] = fields;\n const chrom = CHROM;\n const pos = +POS;\n const id = ID === '.' ? null : ID.split(';');\n const ref = REF;\n const alt = ALT === '.' ? null : ALT.split(',');\n const qual = QUAL === '.' ? null : +QUAL;\n const filter = FILTER === '.' ? null : FILTER.split(';');\n if (this.strict && fields[7] === undefined) {\n throw new Error(\"no INFO field specified, must contain at least a '.' (turn off strict mode to allow)\");\n }\n const info = fields[7] === undefined || fields[7] === '.'\n ? {}\n : this._parseKeyValue(fields[7]);\n Object.keys(info).forEach(key => {\n let items;\n if (info[key]) {\n items = info[key]\n .split(',')\n .map(val => (val === '.' ? null : val))\n .map(f => (f ? decodeURIComponentNoThrow(f) : f));\n }\n else {\n // it will be falsy so just assign whatever is there\n items = info[key];\n }\n const itemType = this.getMetadata('INFO', key, 'Type');\n if (itemType) {\n if (itemType === 'Integer' || itemType === 'Float') {\n items = items.map((val) => {\n if (val === null) {\n return null;\n }\n return Number(val);\n });\n }\n else if (itemType === 'Flag') {\n if (info[key]) {\n // eslint-disable-next-line no-console\n console.warn(`Info field ${key} is a Flag and should not have a value (got value ${info[key]})`);\n }\n else {\n items = true;\n }\n }\n }\n info[key] = items;\n });\n //@ts-ignore\n const variant = new Variant({\n CHROM: chrom,\n POS: pos,\n ALT: alt,\n INFO: info,\n REF: ref,\n FILTER: filter && filter.length === 1 && filter[0] === 'PASS' ? 'PASS' : filter,\n ID: id,\n QUAL: qual,\n });\n Object.defineProperty(variant, 'SAMPLES', {\n get() {\n const samples = parser._parseGenotypes(fields[8], rest);\n Object.defineProperty(this, 'SAMPLES', {\n value: samples,\n configurable: false,\n });\n return samples;\n },\n configurable: true,\n });\n //@ts-ignore\n return variant;\n }\n}\n//# sourceMappingURL=parse.js.map","'use strict';\n\nmodule.exports = value => {\n\tif (!value) {\n\t\treturn false;\n\t}\n\n\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\tif (typeof Symbol.observable === 'symbol' && typeof value[Symbol.observable] === 'function') {\n\t\t// eslint-disable-next-line no-use-extend-native/no-use-extend-native\n\t\treturn value === value[Symbol.observable]();\n\t}\n\n\tif (typeof value['@@observable'] === 'function') {\n\t\treturn value === value['@@observable']();\n\t}\n\n\treturn false;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultSerializer = exports.extendSerializer = void 0;\nfunction extendSerializer(extend, implementation) {\n const fallbackDeserializer = extend.deserialize.bind(extend);\n const fallbackSerializer = extend.serialize.bind(extend);\n return {\n deserialize(message) {\n return implementation.deserialize(message, fallbackDeserializer);\n },\n serialize(input) {\n return implementation.serialize(input, fallbackSerializer);\n }\n };\n}\nexports.extendSerializer = extendSerializer;\nconst DefaultErrorSerializer = {\n deserialize(message) {\n return Object.assign(Error(message.message), {\n name: message.name,\n stack: message.stack\n });\n },\n serialize(error) {\n return {\n __error_marker: \"$$error\",\n message: error.message,\n name: error.name,\n stack: error.stack\n };\n }\n};\nconst isSerializedError = (thing) => thing && typeof thing === \"object\" && \"__error_marker\" in thing && thing.__error_marker === \"$$error\";\nexports.DefaultSerializer = {\n deserialize(message) {\n if (isSerializedError(message)) {\n return DefaultErrorSerializer.deserialize(message);\n }\n else {\n return message;\n }\n },\n serialize(input) {\n if (input instanceof Error) {\n return DefaultErrorSerializer.serialize(input);\n }\n else {\n return input;\n }\n }\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.serialize = exports.deserialize = exports.registerSerializer = void 0;\nconst serializers_1 = require(\"./serializers\");\nlet registeredSerializer = serializers_1.DefaultSerializer;\nfunction registerSerializer(serializer) {\n registeredSerializer = serializers_1.extendSerializer(registeredSerializer, serializer);\n}\nexports.registerSerializer = registerSerializer;\nfunction deserialize(message) {\n return registeredSerializer.deserialize(message);\n}\nexports.deserialize = deserialize;\nfunction serialize(input) {\n return registeredSerializer.serialize(input);\n}\nexports.serialize = serialize;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.$worker = exports.$transferable = exports.$terminate = exports.$events = exports.$errors = void 0;\nexports.$errors = Symbol(\"thread.errors\");\nexports.$events = Symbol(\"thread.events\");\nexports.$terminate = Symbol(\"thread.terminate\");\nexports.$transferable = Symbol(\"thread.transferable\");\nexports.$worker = Symbol(\"thread.worker\");\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Transfer = exports.isTransferDescriptor = void 0;\nconst symbols_1 = require(\"./symbols\");\nfunction isTransferable(thing) {\n if (!thing || typeof thing !== \"object\")\n return false;\n // Don't check too thoroughly, since the list of transferable things in JS might grow over time\n return true;\n}\nfunction isTransferDescriptor(thing) {\n return thing && typeof thing === \"object\" && thing[symbols_1.$transferable];\n}\nexports.isTransferDescriptor = isTransferDescriptor;\nfunction Transfer(payload, transferables) {\n if (!transferables) {\n if (!isTransferable(payload))\n throw Error();\n transferables = [payload];\n }\n return {\n [symbols_1.$transferable]: true,\n send: payload,\n transferables\n };\n}\nexports.Transfer = Transfer;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WorkerMessageType = exports.MasterMessageType = void 0;\n/////////////////////////////\n// Messages sent by master:\nvar MasterMessageType;\n(function (MasterMessageType) {\n MasterMessageType[\"cancel\"] = \"cancel\";\n MasterMessageType[\"run\"] = \"run\";\n})(MasterMessageType = exports.MasterMessageType || (exports.MasterMessageType = {}));\n////////////////////////////\n// Messages sent by worker:\nvar WorkerMessageType;\n(function (WorkerMessageType) {\n WorkerMessageType[\"error\"] = \"error\";\n WorkerMessageType[\"init\"] = \"init\";\n WorkerMessageType[\"result\"] = \"result\";\n WorkerMessageType[\"running\"] = \"running\";\n WorkerMessageType[\"uncaughtError\"] = \"uncaughtError\";\n})(WorkerMessageType = exports.WorkerMessageType || (exports.WorkerMessageType = {}));\n","\"use strict\";\n/// \n// tslint:disable no-shadowed-variable\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst isWorkerRuntime = function isWorkerRuntime() {\n const isWindowContext = typeof self !== \"undefined\" && typeof Window !== \"undefined\" && self instanceof Window;\n return typeof self !== \"undefined\" && self.postMessage && !isWindowContext ? true : false;\n};\nconst postMessageToMaster = function postMessageToMaster(data, transferList) {\n self.postMessage(data, transferList);\n};\nconst subscribeToMasterMessages = function subscribeToMasterMessages(onMessage) {\n const messageHandler = (messageEvent) => {\n onMessage(messageEvent.data);\n };\n const unsubscribe = () => {\n self.removeEventListener(\"message\", messageHandler);\n };\n self.addEventListener(\"message\", messageHandler);\n return unsubscribe;\n};\nexports.default = {\n isWorkerRuntime,\n postMessageToMaster,\n subscribeToMasterMessages\n};\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.expose = exports.isWorkerRuntime = exports.Transfer = exports.registerSerializer = void 0;\nconst is_observable_1 = __importDefault(require(\"is-observable\"));\nconst common_1 = require(\"../common\");\nconst transferable_1 = require(\"../transferable\");\nconst messages_1 = require(\"../types/messages\");\nconst implementation_1 = __importDefault(require(\"./implementation\"));\nvar common_2 = require(\"../common\");\nObject.defineProperty(exports, \"registerSerializer\", { enumerable: true, get: function () { return common_2.registerSerializer; } });\nvar transferable_2 = require(\"../transferable\");\nObject.defineProperty(exports, \"Transfer\", { enumerable: true, get: function () { return transferable_2.Transfer; } });\n/** Returns `true` if this code is currently running in a worker. */\nexports.isWorkerRuntime = implementation_1.default.isWorkerRuntime;\nlet exposeCalled = false;\nconst activeSubscriptions = new Map();\nconst isMasterJobCancelMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.cancel;\nconst isMasterJobRunMessage = (thing) => thing && thing.type === messages_1.MasterMessageType.run;\n/**\n * There are issues with `is-observable` not recognizing zen-observable's instances.\n * We are using `observable-fns`, but it's based on zen-observable, too.\n */\nconst isObservable = (thing) => is_observable_1.default(thing) || isZenObservable(thing);\nfunction isZenObservable(thing) {\n return thing && typeof thing === \"object\" && typeof thing.subscribe === \"function\";\n}\nfunction deconstructTransfer(thing) {\n return transferable_1.isTransferDescriptor(thing)\n ? { payload: thing.send, transferables: thing.transferables }\n : { payload: thing, transferables: undefined };\n}\nfunction postFunctionInitMessage() {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"function\"\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postModuleInitMessage(methodNames) {\n const initMessage = {\n type: messages_1.WorkerMessageType.init,\n exposed: {\n type: \"module\",\n methods: methodNames\n }\n };\n implementation_1.default.postMessageToMaster(initMessage);\n}\nfunction postJobErrorMessage(uid, rawError) {\n const { payload: error, transferables } = deconstructTransfer(rawError);\n const errorMessage = {\n type: messages_1.WorkerMessageType.error,\n uid,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage, transferables);\n}\nfunction postJobResultMessage(uid, completed, resultValue) {\n const { payload, transferables } = deconstructTransfer(resultValue);\n const resultMessage = {\n type: messages_1.WorkerMessageType.result,\n uid,\n complete: completed ? true : undefined,\n payload\n };\n implementation_1.default.postMessageToMaster(resultMessage, transferables);\n}\nfunction postJobStartMessage(uid, resultType) {\n const startMessage = {\n type: messages_1.WorkerMessageType.running,\n uid,\n resultType\n };\n implementation_1.default.postMessageToMaster(startMessage);\n}\nfunction postUncaughtErrorMessage(error) {\n try {\n const errorMessage = {\n type: messages_1.WorkerMessageType.uncaughtError,\n error: common_1.serialize(error)\n };\n implementation_1.default.postMessageToMaster(errorMessage);\n }\n catch (subError) {\n // tslint:disable-next-line no-console\n console.error(\"Not reporting uncaught error back to master thread as it \" +\n \"occured while reporting an uncaught error already.\" +\n \"\\nLatest error:\", subError, \"\\nOriginal error:\", error);\n }\n}\nfunction runFunction(jobUID, fn, args) {\n return __awaiter(this, void 0, void 0, function* () {\n let syncResult;\n try {\n syncResult = fn(...args);\n }\n catch (error) {\n return postJobErrorMessage(jobUID, error);\n }\n const resultType = isObservable(syncResult) ? \"observable\" : \"promise\";\n postJobStartMessage(jobUID, resultType);\n if (isObservable(syncResult)) {\n const subscription = syncResult.subscribe(value => postJobResultMessage(jobUID, false, common_1.serialize(value)), error => {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n activeSubscriptions.delete(jobUID);\n }, () => {\n postJobResultMessage(jobUID, true);\n activeSubscriptions.delete(jobUID);\n });\n activeSubscriptions.set(jobUID, subscription);\n }\n else {\n try {\n const result = yield syncResult;\n postJobResultMessage(jobUID, true, common_1.serialize(result));\n }\n catch (error) {\n postJobErrorMessage(jobUID, common_1.serialize(error));\n }\n }\n });\n}\n/**\n * Expose a function or a module (an object whose values are functions)\n * to the main thread. Must be called exactly once in every worker thread\n * to signal its API to the main thread.\n *\n * @param exposed Function or object whose values are functions\n */\nfunction expose(exposed) {\n if (!implementation_1.default.isWorkerRuntime()) {\n throw Error(\"expose() called in the master thread.\");\n }\n if (exposeCalled) {\n throw Error(\"expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.\");\n }\n exposeCalled = true;\n if (typeof exposed === \"function\") {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && !messageData.method) {\n runFunction(messageData.uid, exposed, messageData.args.map(common_1.deserialize));\n }\n });\n postFunctionInitMessage();\n }\n else if (typeof exposed === \"object\" && exposed) {\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobRunMessage(messageData) && messageData.method) {\n runFunction(messageData.uid, exposed[messageData.method], messageData.args.map(common_1.deserialize));\n }\n });\n const methodNames = Object.keys(exposed).filter(key => typeof exposed[key] === \"function\");\n postModuleInitMessage(methodNames);\n }\n else {\n throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${exposed}`);\n }\n implementation_1.default.subscribeToMasterMessages(messageData => {\n if (isMasterJobCancelMessage(messageData)) {\n const jobUID = messageData.uid;\n const subscription = activeSubscriptions.get(jobUID);\n if (subscription) {\n subscription.unsubscribe();\n activeSubscriptions.delete(jobUID);\n }\n }\n });\n}\nexports.expose = expose;\nif (typeof self !== \"undefined\" && typeof self.addEventListener === \"function\" && implementation_1.default.isWorkerRuntime()) {\n self.addEventListener(\"error\", event => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(event.error || event), 250);\n });\n self.addEventListener(\"unhandledrejection\", event => {\n const error = event.reason;\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\nif (typeof process !== \"undefined\" && typeof process.on === \"function\" && implementation_1.default.isWorkerRuntime()) {\n process.on(\"uncaughtException\", (error) => {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n });\n process.on(\"unhandledRejection\", (error) => {\n if (error && typeof error.message === \"string\") {\n // Post with some delay, so the master had some time to subscribe to messages\n setTimeout(() => postUncaughtErrorMessage(error), 250);\n }\n });\n}\n","import WorkerContext from \"./dist/worker/index.js\"\n\nexport const expose = WorkerContext.expose\nexport const registerSerializer = WorkerContext.registerSerializer\nexport const Transfer = WorkerContext.Transfer\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nexport default trimmedEndIndex;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nexport default baseTrim;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import toNumber from './toNumber.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nexport default toFinite;\n","import toFinite from './toFinite.js';\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nexport default toInteger;\n","import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nexport default copyArray;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n","import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n","import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nexport default isIterateeCall;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n","import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n","import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n","import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n","import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n","import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n","import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n","import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n","import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n","/**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\nfunction baseClamp(number, lower, upper) {\n if (number === number) {\n if (upper !== undefined) {\n number = number <= upper ? number : upper;\n }\n if (lower !== undefined) {\n number = number >= lower ? number : lower;\n }\n }\n return number;\n}\n\nexport default baseClamp;\n","import arrayMap from './_arrayMap.js';\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nexport default baseValues;\n","import baseValues from './_baseValues.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return object == null ? [] : baseValues(object, keys(object));\n}\n\nexport default values;\n","/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeFloor = Math.floor,\n nativeRandom = Math.random;\n\n/**\n * The base implementation of `_.random` without support for returning\n * floating-point numbers.\n *\n * @private\n * @param {number} lower The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the random number.\n */\nfunction baseRandom(lower, upper) {\n return lower + nativeFloor(nativeRandom() * (upper - lower + 1));\n}\n\nexport default baseRandom;\n","import baseRandom from './_baseRandom.js';\n\n/**\n * A specialized version of `_.shuffle` which mutates and sets the size of `array`.\n *\n * @private\n * @param {Array} array The array to shuffle.\n * @param {number} [size=array.length] The size of `array`.\n * @returns {Array} Returns `array`.\n */\nfunction shuffleSelf(array, size) {\n var index = -1,\n length = array.length,\n lastIndex = length - 1;\n\n size = size === undefined ? length : size;\n while (++index < size) {\n var rand = baseRandom(index, lastIndex),\n value = array[rand];\n\n array[rand] = array[index];\n array[index] = value;\n }\n array.length = size;\n return array;\n}\n\nexport default shuffleSelf;\n","import baseClamp from './_baseClamp.js';\nimport copyArray from './_copyArray.js';\nimport shuffleSelf from './_shuffleSelf.js';\n\n/**\n * A specialized version of `_.sampleSize` for arrays.\n *\n * @private\n * @param {Array} array The array to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction arraySampleSize(array, n) {\n return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));\n}\n\nexport default arraySampleSize;\n","import baseClamp from './_baseClamp.js';\nimport shuffleSelf from './_shuffleSelf.js';\nimport values from './values.js';\n\n/**\n * The base implementation of `_.sampleSize` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to sample.\n * @param {number} n The number of elements to sample.\n * @returns {Array} Returns the random elements.\n */\nfunction baseSampleSize(collection, n) {\n var array = values(collection);\n return shuffleSelf(array, baseClamp(n, 0, array.length));\n}\n\nexport default baseSampleSize;\n","import arraySampleSize from './_arraySampleSize.js';\nimport baseSampleSize from './_baseSampleSize.js';\nimport isArray from './isArray.js';\nimport isIterateeCall from './_isIterateeCall.js';\nimport toInteger from './toInteger.js';\n\n/**\n * Gets `n` random elements at unique keys from `collection` up to the\n * size of `collection`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to sample.\n * @param {number} [n=1] The number of elements to sample.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the random elements.\n * @example\n *\n * _.sampleSize([1, 2, 3], 2);\n * // => [3, 1]\n *\n * _.sampleSize([1, 2, 3], 4);\n * // => [2, 3, 1]\n */\nfunction sampleSize(collection, n, guard) {\n if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n var func = isArray(collection) ? arraySampleSize : baseSampleSize;\n return func(collection, n);\n}\n\nexport default sampleSize;\n","export default function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import ascending from \"./ascending.js\";\n\nexport default function(f) {\n let delta = f;\n let compare = f;\n\n if (f.length === 1) {\n delta = (d, x) => f(d) - x;\n compare = ascendingComparator(f);\n }\n\n function left(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function right(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n\n function center(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction ascendingComparator(f) {\n return (d, x) => ascending(f(d), x);\n}\n","import { bisector } from 'd3-array';\nimport { RemoteFile as _RemoteFile } from 'generic-filehandle';\n\nimport type * as HiGlass from '@higlass/types';\nimport type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema';\n\nexport type CommonDataConfig = {\n assembly: Assembly;\n x?: string;\n xe?: string;\n x1?: string;\n x1e?: string;\n urlFetchOptions?: RequestInit;\n};\n\nexport class DataSource {\n chromInfo: ExtendedChromInfo;\n tilesetInfo: ReturnType;\n\n constructor(public file: File, chromSizes: ChromSizes, public options: Options) {\n this.chromInfo = sizesToChromInfo(chromSizes);\n this.tilesetInfo = tilesetInfoFromChromInfo(this.chromInfo);\n }\n}\n\n/**\n * Filter data before sending to a track considering the visible genomic area in the track.\n * TODO(2022-Jul-13): Consider genomic `y` channels as well.\n */\nexport function filterUsingGenoPos(\n data: Datum[],\n [minX, maxX]: [number, number],\n config: Omit\n) {\n const { x, xe, x1, x1e } = config;\n const definedXFields = [x, xe, x1, x1e].filter(f => f) as string[];\n return data.filter((d: Datum) => {\n if (definedXFields.length === 0) {\n // no filter applies\n return true;\n } else if (definedXFields.length === 1) {\n // filter based on one genomic position\n const value = +d[definedXFields[0]];\n return typeof value === 'number' && minX < value && value <= maxX;\n } else {\n // filter based on two genomic positions, i.e., check overlaps\n const values = definedXFields.map(f => +d[f]).filter(v => !isNaN(v));\n const minValue = Math.min(...values);\n const maxValue = Math.max(...values);\n return minX <= maxValue && minValue <= maxX;\n }\n });\n}\n\nconst chromInfoBisector = bisector((d: { pos: number }) => d.pos).left;\n\nconst chrToAbs = (chrom: string, chromPos: number, chromInfo: HiGlass.ChromInfo) =>\n chromInfo.chrPositions[chrom].pos + chromPos;\n\nconst absToChr = (absPosition: number, chromInfo: HiGlass.ChromInfo) => {\n if (!chromInfo || !chromInfo.cumPositions || !chromInfo.cumPositions.length) {\n return null;\n }\n\n let insertPoint = chromInfoBisector(chromInfo.cumPositions, absPosition);\n const lastChr = chromInfo.cumPositions[chromInfo.cumPositions.length - 1].chr;\n const lastLength = chromInfo.chromLengths[lastChr];\n\n // @ts-expect-error\n insertPoint -= insertPoint > 0 && 1;\n\n let chrPosition = Math.floor(absPosition - chromInfo.cumPositions[insertPoint].pos);\n let offset = 0;\n\n if (chrPosition < 0) {\n // before the start of the genome\n offset = chrPosition - 1;\n chrPosition = 1;\n }\n\n if (insertPoint === chromInfo.cumPositions.length - 1 && chrPosition > lastLength) {\n // beyond the last chromosome\n offset = chrPosition - lastLength;\n chrPosition = lastLength;\n }\n\n return [chromInfo.cumPositions[insertPoint].chr, chrPosition, offset, insertPoint] as const;\n};\n\n/**\n * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`.\n * @param chrName A chromosome name to be sanitized\n * @param assembly A genome assembly of the data\n * @param chromosomePrefix A prefix string that can be replaced to 'chr'\n * @returns\n */\nexport function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string) {\n if (Array.isArray(assembly)) {\n // this is a custom assembly, so use this as is\n return chrName;\n }\n\n // For assemblies in Gosling, we use the `chr` prefix consistently\n if (chromosomePrefix) {\n // `hs1` --> `chr1`\n chrName = chrName.replace(chromosomePrefix, 'chr');\n } else if (!chrName.includes('chr')) {\n // `1` --> `chr1`\n chrName = `chr${chrName}`;\n }\n return chrName;\n}\n\nexport type ExtendedChromInfo = HiGlass.ChromInfo & {\n absToChr(absPos: number): ReturnType | null;\n chrToAbs(chr: [name: string, pos: number]): number | null;\n};\n\nexport function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize = 1024) {\n return {\n tile_size: tileSize,\n bins_per_dimension: tileSize,\n max_zoom: Math.ceil(Math.log(chromInfo.totalLength / tileSize) / Math.log(2)),\n max_width: chromInfo.totalLength,\n min_pos: [0],\n max_pos: [chromInfo.totalLength]\n };\n}\n\nexport function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo {\n const info: HiGlass.ChromInfo = {\n cumPositions: [],\n chromLengths: {},\n chrPositions: {},\n totalLength: 0\n };\n\n sizes.forEach(([chr, length], i) => {\n const chrPosition = { id: i, chr, pos: info.totalLength };\n info.chrPositions[chr] = chrPosition;\n info.chromLengths[chr] = length;\n info.cumPositions.push(chrPosition);\n info.totalLength += length;\n });\n\n return {\n ...info,\n absToChr: absPos => (info.chrPositions ? absToChr(absPos, info) : null),\n chrToAbs: ([chrName, chrPos]) => (info.chrPositions ? chrToAbs(chrName, chrPos, info) : null)\n };\n}\n\nexport class RemoteFile extends _RemoteFile {\n // Overrides `read` to eagerly read 200 or 206 response\n // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162\n public read: _RemoteFile['read'] = async (\n buffer,\n offset = 0,\n length,\n position = 0,\n opts = {}\n ): Promise<{ bytesRead: number; buffer: Buffer }> => {\n const { headers = {}, signal, overrides = {} } = opts;\n\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n } else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n // @ts-expect-error private property\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n // @ts-expect-error private property\n ...this.baseOverrides.headers\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal\n };\n const response = await this.fetch(this.url, args);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n\n // Just read the response if it was successful.\n if (response.status === 200 || response.status === 206) {\n // @ts-expect-error private method\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n // @ts-expect-error private property\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n\n return { bytesRead: bytesCopied, buffer };\n }\n\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n };\n}\n\nexport interface TabularDataFetcher {\n getTabularData(tileIds: string[]): Promise;\n MAX_TILE_WIDTH?: number;\n}\n","import type { VcfRecord, VcfTile } from './vcf-data-fetcher';\n\nexport const getMutationType = (ref: string, alt?: string) => {\n if (!alt) return 'unknown';\n if (ref.length === alt.length) return 'substitution';\n if (ref.length > alt.length) return 'deletion';\n if (ref.length < alt.length) return 'insertion';\n return 'unknown';\n};\n\nexport const getSubstitutionType = (ref: string, alt?: string) => {\n switch (ref + alt) {\n case 'CA':\n case 'GT':\n return 'C>A';\n case 'CG':\n case 'GC':\n return 'C>G';\n case 'CT':\n case 'GA':\n return 'C>T';\n case 'TA':\n case 'AT':\n return 'T>A';\n case 'TC':\n case 'AG':\n return 'T>C';\n case 'TG':\n case 'AC':\n return 'T>G';\n default:\n return 'unknown';\n }\n};\n\n/**\n * Convert a VCF record to a tile data\n * @param vcfRecord A row of a VCF files loaded\n * @param chrPos Cumulative start position of a chromosome\n * @param prevAbsPos Previous position of a point mutation for calculating 'distance to previous'\n */\nexport function recordToTile(vcfRecord: VcfRecord, chrPos: number, prevAbsPos?: number) {\n const absPos = chrPos + vcfRecord.POS + 1;\n\n let ALT: string | undefined;\n if (Array.isArray(vcfRecord.ALT) && vcfRecord.ALT.length > 0) {\n ALT = vcfRecord.ALT[0];\n }\n\n // Additionally inferred values\n const DISTPREV = !prevAbsPos ? null : absPos - prevAbsPos;\n const DISTPREVLOGE = !prevAbsPos ? null : Math.log(absPos - prevAbsPos);\n const MUTTYPE = getMutationType(vcfRecord.REF, ALT);\n const SUBTYPE = getSubstitutionType(vcfRecord.REF, ALT);\n const POSEND = absPos + vcfRecord.REF.length;\n\n // Create key values\n const data: VcfTile = {\n ...vcfRecord,\n ALT,\n MUTTYPE,\n SUBTYPE,\n INFO: JSON.stringify(vcfRecord.INFO),\n ORIGINALPOS: vcfRecord.POS,\n POS: absPos,\n POSEND,\n DISTPREV,\n DISTPREVLOGE\n };\n\n // Add optional INFO columns\n Object.keys(vcfRecord.INFO).forEach(key => {\n const val = vcfRecord.INFO[key];\n if (Array.isArray(val)) {\n data[key] = val.join(', ');\n } else {\n data[key] = val;\n }\n });\n return data;\n}\n","/*\n * This document is heavily based on the following repo by @alexander-veit:\n * https://github.com/dbmi-bgm/higlass-sv/blob/main/src/sv-fetcher-worker.js\n */\nimport { TabixIndexedFile } from '@gmod/tabix';\nimport VCF from '@gmod/vcf';\nimport { expose, Transfer } from 'threads/worker';\nimport { sampleSize } from 'lodash-es';\n\nimport { DataSource, RemoteFile } from '../utils';\n\nimport type { TilesetInfo } from '@higlass/types';\nimport type { ChromSizes } from '@gosling-lang/gosling-schema';\nimport type { VcfTile } from './vcf-data-fetcher';\nimport { recordToTile } from './utils';\n\n// promises indexed by urls\nconst vcfFiles: Map = new Map();\n\ntype VcfFileOptions = {\n sampleLength: number;\n urlFetchOptions?: RequestInit;\n indexUrlFetchOptions?: RequestInit;\n};\n\n/**\n * This is a class to represent a VCF file.\n */\nclass VcfFile {\n #parser?: VCF;\n #uid: string;\n constructor(public tbi: TabixIndexedFile, uid: string) {\n this.#uid = uid;\n }\n /**\n * Function to create an instance of VcfFile from URLs\n * @param url A string which is the URL of the bed file\n * @param indexUrl A string which is the URL of the bed index file\n * @param uid A unique identifier for the worker\n * @param urlFetchOptions\n * @param indexUrlFetchOptions\n * @returns an instance of VcfFile\n */\n static fromUrl(\n url: string,\n indexUrl: string,\n uid: string,\n urlFetchOptions?: RequestInit,\n indexUrlFetchOptions?: RequestInit\n ) {\n const tbi = new TabixIndexedFile({\n filehandle: new RemoteFile(url, { overrides: urlFetchOptions }),\n tbiFilehandle: new RemoteFile(indexUrl, { overrides: indexUrlFetchOptions })\n });\n return new VcfFile(tbi, uid);\n }\n /**\n * Creates the parser used for the VCF file.\n */\n async getParser() {\n if (!this.#parser) {\n const header = await this.tbi.getHeader();\n this.#parser = new VCF({ header });\n }\n return this.#parser;\n }\n /**\n * Retrieves data within a certain coordinate range\n * @param minX A number which is the minimum X boundary of the tile\n * @param maxX A number which is the maximum X boundary of the tile\n * @param callback A callback function which receives the VCF tile\n * @returns A promise of array of promises which resolve when the data has been successfully retrieved\n */\n async getTileData(minX: number, maxX: number): Promise {\n const source = dataSources.get(this.#uid)!;\n const parser = await this.getParser();\n\n let curMinX = minX;\n const { chromLengths, cumPositions } = source.chromInfo;\n const recordPromises: Promise[] = [];\n\n for (const cumPos of cumPositions) {\n const chromName = cumPos.chr;\n const chromStart = cumPos.pos;\n const chromEnd = cumPos.pos + chromLengths[chromName];\n let startPos, endPos;\n\n // Early break, rather than creating an nested if\n if (chromStart > curMinX || curMinX >= chromEnd) {\n continue;\n }\n\n // start of the visible region is within this chromosome\n let prevPOS: number | undefined;\n const tilesPromise = new Promise(resolve => {\n const tiles: VcfTile[] = [];\n const lineCallback = (line: string) => {\n const vcfRecord = parser.parseLine(line);\n const vcfTile = recordToTile(vcfRecord, chromStart, prevPOS);\n prevPOS = vcfTile.POS;\n tiles.push(vcfTile);\n };\n\n if (maxX > chromEnd) {\n startPos = curMinX - chromStart;\n endPos = chromEnd - chromStart;\n } else {\n startPos = Math.floor(curMinX - chromStart);\n endPos = Math.ceil(maxX - chromStart);\n }\n\n source.file.tbi.getLines(chromName, startPos, endPos, lineCallback).then(() => {\n resolve(tiles);\n });\n });\n\n recordPromises.push(tilesPromise);\n\n if (maxX <= chromEnd) {\n continue;\n }\n\n curMinX = chromEnd;\n }\n\n const tileArrays = await Promise.all(recordPromises);\n return tileArrays.flat();\n }\n}\n\n// promises indexed by url\nconst tileValues: Record = {}; // new LRU({ max: MAX_TILES });\n\n// const vcfData = [];\nconst dataSources: Map> = new Map();\n\nfunction init(\n uid: string,\n vcf: { url: string; indexUrl: string },\n chromSizes: ChromSizes,\n options: Partial = {}\n) {\n let vcfFile = vcfFiles.get(vcf.url);\n if (!vcfFile) {\n vcfFile = VcfFile.fromUrl(vcf.url, vcf.indexUrl, uid, options.urlFetchOptions, options.indexUrlFetchOptions);\n }\n const dataSource = new DataSource(vcfFile, chromSizes, {\n sampleLength: 1000,\n ...options\n });\n dataSources.set(uid, dataSource);\n}\n\nconst tilesetInfo = (uid: string) => {\n return dataSources.get(uid)!.tilesetInfo;\n};\n\n/**\n * Updates `tileValues` with the data for a specific tile.\n * @param uid A string which is the unique identifier of the worker\n * @param z A number which is the z coordinate of the tile\n * @param x A number which is the x coordinate of the tile\n */\nconst tile = async (uid: string, z: number, x: number): Promise => {\n const source = dataSources.get(uid)!;\n const CACHE_KEY = `${uid}.${z}.${x}`;\n\n // TODO: Caching is needed\n // if (!tileValues[CACHE_KEY]) {\n tileValues[CACHE_KEY] = [];\n // }\n const tileWidth = +source.tilesetInfo.max_width / 2 ** +z;\n\n // get bounds of this tile\n const minX = source.tilesetInfo.min_pos[0] + x * tileWidth;\n const maxX = source.tilesetInfo.min_pos[0] + (x + 1) * tileWidth;\n\n tileValues[CACHE_KEY] = await source.file.getTileData(minX, maxX);\n\n return tileValues[CACHE_KEY];\n};\n\nconst fetchTilesDebounced = async (uid: string, tileIds: string[]) => {\n const tiles: Record = {};\n const validTileIds: string[] = [];\n const tilePromises: Promise[] = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('Invalid tile zoom or position:', z, x);\n continue;\n }\n validTileIds.push(tileId);\n tilePromises.push(tile(uid, z, x));\n }\n return Promise.all(tilePromises).then(values => {\n for (let i = 0; i < values.length; i++) {\n const validTileId = validTileIds[i];\n // @ts-expect-error values is void, this should never happen.\n tiles[validTileId] = values[i];\n tiles[validTileId].tilePositionId = validTileId;\n }\n return tiles;\n });\n};\n\nconst getTabularData = (uid: string, tileIds: string[]) => {\n const data: VcfTile[][] = [];\n\n tileIds.forEach(tileId => {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n const tileValue = tileValues[`${uid}.${z}.${x}`];\n\n if (!tileValue) {\n console.warn(`No tile data constructed (${tileId})`);\n }\n\n data.push(tileValue);\n });\n\n let output = Object.values(data).flat();\n\n const sampleLength = dataSources.get(uid)!.options.sampleLength;\n if (output.length >= sampleLength) {\n // TODO: we can make this more generic\n // priotize that mutations with closer each other are selected when sampling.\n const highPriority = output.sort((a, b) => -(a.DISTPREV ?? 0) + (b.DISTPREV ?? 0)).slice(0, sampleLength / 2.0);\n output = sampleSize(output, sampleLength / 2.0).concat(highPriority);\n }\n\n const buffer = new TextEncoder().encode(JSON.stringify(output)).buffer;\n return Transfer(buffer, [buffer]);\n};\n\nconst tileFunctions = {\n init,\n tilesetInfo,\n fetchTilesDebounced,\n tile,\n getTabularData\n};\n\nexport type WorkerApi = typeof tileFunctions;\nexport type { TilesetInfo };\n\nexpose(tileFunctions);\n"],"names":["i","_getPrototypeOf","o","_setPrototypeOf","p","self","_get","Emitter","AbortSignal","toString","AbortController","err","Request","init","abortableFetch","require$$0","global","AggregateAbortController_1","abortcontroller_ponyfill_1","AggregateStatusReporter_1","__importDefault","this","AbortablePromiseCache_1","require$$1","require$$2","len","len2","buffer","c","ieee754","exports","Buffer","fromString","byteLength","isBuffer","code","msg","utils","Z_FIXED","Z_UNKNOWN","zero","MIN_MATCH","MAX_MATCH","LENGTH_CODES","LITERALS","L_CODES","D_CODES","BL_CODES","HEAP_SIZE","MAX_BITS","rank","adler32","crc32","messages","require$$3","require$$4","Z_NO_FLUSH","Z_FINISH","Z_BLOCK","Z_OK","Z_STREAM_END","Z_STREAM_ERROR","Z_DATA_ERROR","Z_BUF_ERROR","Z_DEFAULT_COMPRESSION","Z_DEFAULT_STRATEGY","Z_DEFLATED","MAX_WBITS","deflate","strings","c2","ZStream","BAD","TYPE","inflate_fast","ENOUGH_LENS","ENOUGH_DISTS","CODES","LENS","DISTS","inflate_table","root","q","inflate","constants","GZheader","require$$5","require$$6","Inflate","Z_SYNC_FLUSH","toNumber","fromBytes","long","Long","TBI","AbortablePromiseCache","index","val","Transfer","isWorkerRuntime","postMessageToMaster","subscribeToMasterMessages","isObservable","expose","freeGlobal","Symbol","objectProto","hasOwnProperty","nativeObjectToString","symToStringTag","funcTag","MAX_SAFE_INTEGER","argsTag","freeExports","freeModule","moduleExports","nodeUtil","isArray","isArguments","isTypedArray","nativeKeys","_RemoteFile","values"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAO,eAAe,aAAS,cAAc,EAAE,OAAO,KAAI,CAAE;AAE5D,WAAS,gBAAgB,UAAU,aAAa;AAC9C,QAAI,EAAE,oBAAoB,cAAc;AACtC,YAAM,IAAI,UAAU,mCAAmC;AAAA,IACxD;AAAA,EACH;AAEA,WAAS,kBAAkB,QAAQ,OAAO;AACxC,aAASA,KAAI,GAAGA,KAAI,MAAM,QAAQA,MAAK;AACrC,U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S,OAAO,OAAO,IAAI,EAAE,KAAK;AAEtC,UAAM,eAAe,YAAY,IAAI,GAAG,EAAG,QAAQ;AAC/C,QAAA,OAAO,UAAU,cAAc;AAG/B,YAAM,eAAe,OAAO,KAAK,CAAC,GAAG,MAAM;;AAAA,kBAAE,OAAE,aAAF,YAAc,OAAM,OAAE,aAAF,YAAc;AAAA,OAAE,EAAE,MAAM,GAAG,eAAe,CAAG;AAC9G,eAAS,WAAW,QAAQ,eAAe,CAAG,EAAE,OAAO,YAAY;AAAA,IACvE;AAEM,UAAA2B,UAAS,IAAI,YAAY,EAAE,OAAO,KAAK,UAAU,MAAM,CAAC,EAAE;AAChE,WAAO,SAASA,SAAQ,CAACA,OAAM,CAAC;AAAA,EACpC;AAEA,QAAM,gBAAgB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAKA,SAAO,aAAa;;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95]} \ No newline at end of file diff --git a/dist/exported-utils-c80467e4.js b/dist/exported-utils-c80467e4.js deleted file mode 100644 index e1501bfc..00000000 --- a/dist/exported-utils-c80467e4.js +++ /dev/null @@ -1,10042 +0,0 @@ -var __defProp = Object.defineProperty; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __publicField = (obj, key, value) => { - __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); - return value; -}; -import { group, max, min, bisector } from "d3-array"; -import { RemoteFile as RemoteFile$1 } from "generic-filehandle"; -import * as PIXI from "pixi.js"; -import { color } from "d3-color"; -import { Bezier } from "bezier-js"; -import { scaleLinear } from "d3-scale"; -import { isUndefined } from "lodash-es"; -import { interpolateViridis, interpolateGreys, interpolateWarm, interpolateSpectral, interpolateCividis, interpolateBuPu, interpolateRdBu, interpolateYlOrBr, interpolateRdPu } from "d3-scale-chromatic"; -const DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM = 6; -const DEFAULT_TRACK_HEIGHT_LINEAR = 130; -const DEFAULT_TRACK_WIDTH_LINEAR = 600; -const DEFAULT_TRACK_SIZE_2D = 600; -const DEFAULT_VIEW_SPACING = 10; -const DEFAULT_INNER_RADIUS_PROP = 0.3; -const DEFAULT_CIRCULAR_VIEW_PADDING = 0; -const DEFAULT_BACKUP_COLOR = "gray"; -const colorToHex = (colorStr) => { - let c = color(colorStr); - if (!c) { - c = color(DEFAULT_BACKUP_COLOR); - } - const hex = PIXI.utils.rgb2hex([c.rgb().r / 255, c.rgb().g / 255, c.rgb().b / 255]); - return hex; -}; -const RADIAN_GAP = 0; -function valueToRadian(v, max2, sa, ea, g) { - const safeVal = Math.max(Math.min(max2, v), 0); - const gap = g != null ? g : RADIAN_GAP; - const radExtent = (ea - sa) / 360 * Math.PI * 2 - gap * 2; - const radStart = sa / 360 * Math.PI * 2; - return -(radStart + safeVal / max2 * radExtent) - Math.PI / 2 - gap; -} -function cartesianToPolar(x, max2, r, cx, cy, sa, ea) { - return { - x: cx + r * Math.cos(valueToRadian(x, max2, sa, ea)), - y: cy + r * Math.sin(valueToRadian(x, max2, sa, ea)) - }; -} -function positionToRadian(x, y, cx, cy) { - if (cx <= x) { - return Math.atan((y - cy) / (x - cx)); - } else { - return Math.atan((y - cy) / (x - cx)) - Math.PI; - } -} -function pointsToDegree(x, y, cx, cy) { - return (Math.atan2(-(y - cy), x - cx) / Math.PI * 180 + 270) % 360; -} -function drawPoint(track, g, model) { - var _a, _b, _c, _d, _e; - const spec = model.spec(); - if (!spec.width || !spec.height) { - console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); - return; - } - const data2 = model.data(); - const [trackWidth, trackHeight] = track.dimensions; - const zoomLevel = model.getChannelScale("x").invert(trackWidth) - model.getChannelScale("x").invert(0); - const circular = spec.layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const tcx = trackWidth / 2; - const tcy = trackHeight / 2; - const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = trackHeight / rowCategories.length; - rowCategories.forEach((rowCategory) => { - const rowPosition = model.encodedValue("row", rowCategory); - data2.filter( - (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory - ).forEach((d) => { - const cx = model.encodedPIXIProperty("x-center", d); - const cy = model.encodedPIXIProperty("y-center", d); - const color2 = model.encodedPIXIProperty("color", d); - const radius = model.encodedPIXIProperty("p-size", d); - const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); - const stroke = model.encodedPIXIProperty("stroke", d); - const opacity = model.encodedPIXIProperty("opacity", d); - const alphaTransition = model.markVisibility(d, { width: radius, zoomLevel }); - const actualOpacity = Math.min(alphaTransition, opacity); - if (radius <= 0.1 || actualOpacity === 0 || cx + radius < 0 || cx - radius > trackWidth) { - return; - } - g.lineStyle( - strokeWidth, - colorToHex(stroke), - actualOpacity, - // alpha - 1 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - if (circular) { - const r = trackOuterRadius - (rowPosition + rowHeight - cy) / trackHeight * trackRingSize; - const pos = cartesianToPolar(cx, trackWidth, r, tcx, tcy, startAngle, endAngle); - g.beginFill(colorToHex(color2), actualOpacity); - g.drawCircle(pos.x, pos.y, radius); - model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, radius]); - } else { - g.beginFill(colorToHex(color2), actualOpacity); - g.drawCircle(cx, rowPosition + rowHeight - cy, radius); - model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - cy, radius]); - } - }); - }); -} -function pointProperty(model, propertyKey, datum) { - const xe = model.visualPropertyByChannel("xe", datum); - const x = model.visualPropertyByChannel("x", datum); - const size = model.visualPropertyByChannel("size", datum); - switch (propertyKey) { - case "x-center": - return xe ? (xe + x) / 2 : x; - case "y-center": { - const ye = model.visualPropertyByChannel("ye", datum); - const y = model.visualPropertyByChannel("y", datum); - return ye ? (ye + y) / 2 : y; - } - case "p-size": - return xe && model.spec().stretch ? (xe - x) / 2 : size; - default: - return void 0; - } -} -function drawLine(g, model, trackWidth, trackHeight) { - var _a, _b, _c, _d, _e, _f; - const spec = model.spec(); - if (!spec.width || !spec.height) { - console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); - return; - } - const data2 = model.data(); - const circular = spec.layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const trackCenterX = trackWidth / 2; - const trackCenterY = trackHeight / 2; - const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = trackHeight / rowCategories.length; - const colorCategories = (_f = model.getChannelDomainArray("color")) != null ? _f : ["___SINGLE_COLOR___"]; - rowCategories.forEach((rowCategory) => { - const rowPosition = model.encodedValue("row", rowCategory); - colorCategories.forEach((colorCategory) => { - data2.filter( - (d) => (!getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory) && (!getValueUsingChannel(d, spec.color) || getValueUsingChannel(d, spec.color) === colorCategory) - ).sort( - (d1, d2) => ( - // draw from the left to right - getValueUsingChannel(d1, spec.x) - getValueUsingChannel(d2, spec.x) - ) - ).forEach((d, i) => { - const cx = model.encodedPIXIProperty("x", d); - const y = model.encodedPIXIProperty("y", d); - const size = model.encodedPIXIProperty("size", d); - const color2 = model.encodedPIXIProperty("color", d); - const opacity = model.encodedPIXIProperty("opacity", d); - g.lineStyle( - size, - colorToHex(color2), - opacity, - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - if (circular) { - const r = trackOuterRadius - (rowPosition + rowHeight - y) / trackHeight * trackRingSize; - const pos = cartesianToPolar( - cx, - trackWidth, - r, - trackCenterX, - trackCenterY, - startAngle, - endAngle - ); - if (i === 0) { - g.moveTo(pos.x, pos.y); - } else { - g.lineTo(pos.x, pos.y); - } - model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, 1]); - } else { - if (i === 0) { - g.moveTo(cx, rowPosition + rowHeight - y); - } else { - g.lineTo(cx, rowPosition + rowHeight - y); - } - model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - y, 1]); - } - }); - }); - }); -} -function drawBar(track, tile, model) { - var _a, _b, _c, _d, _e, _f, _g; - const spec = model.spec(); - if (!spec.width || !spec.height) { - console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); - return; - } - const data2 = model.data(); - const [trackWidth, trackHeight] = track.dimensions; - const tileSize = track.tilesetInfo.tile_size; - const zoomLevel = model.getChannelScale("x").invert(trackWidth) - model.getChannelScale("x").invert(0); - const circular = spec.layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const cx = trackWidth / 2; - const cy = trackHeight / 2; - const xScale = model.getChannelScale("x"); - let tileUnitWidth; - if (tile.tileData.tilePos) { - const { tileX, tileWidth } = track.getTilePosAndDimensions( - tile.tileData.zoomLevel, - tile.tileData.tilePos, - tileSize - ); - tileUnitWidth = xScale(tileX + tileWidth / tileSize) - xScale(tileX); - } - const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = trackHeight / rowCategories.length; - const clipRow = !IsChannelDeep(spec.row) || IsChannelDeep(spec.row) && typeof spec.row.clip === "undefined" || spec.row.clip; - const baselineValue = IsChannelDeep(spec.y) ? (_f = spec.y) == null ? void 0 : _f.baseline : void 0; - const staticBaseY = (_g = model.encodedValue("y", baselineValue)) != null ? _g : 0; - const g = tile.graphics; - if (IsStackedMark(spec)) { - const genomicChannel = model.getGenomicChannel(); - if (!genomicChannel || !genomicChannel.field) { - console.warn("Genomic field is not provided in the specification"); - return; - } - const pivotedData = group(data2, (d) => d[genomicChannel.field]); - const xKeys = [...pivotedData.keys()]; - xKeys.forEach((k) => { - var _a2; - let prevYEnd = 0; - (_a2 = pivotedData.get(k)) == null ? void 0 : _a2.forEach((d) => { - const color2 = model.encodedPIXIProperty("color", d); - const stroke = model.encodedPIXIProperty("stroke", d); - const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); - const opacity = model.encodedPIXIProperty("opacity", d); - const y = model.encodedPIXIProperty("y", d); - const barWidth = model.encodedPIXIProperty("width", d, { tileUnitWidth }); - const xs = model.encodedPIXIProperty("x-start", d, { markWidth: barWidth }); - const xe = xs + barWidth; - const alphaTransition = model.markVisibility(d, { width: barWidth, zoomLevel }); - const actualOpacity = Math.min(alphaTransition, opacity); - if (actualOpacity === 0 || barWidth <= 0 || y <= 0) { - return; - } - g.lineStyle( - strokeWidth, - colorToHex(stroke), - actualOpacity, - 0 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - let polygonForMouseEvents = []; - if (circular) { - const farR = trackOuterRadius - (rowHeight - prevYEnd) / trackHeight * trackRingSize; - const nearR = trackOuterRadius - (rowHeight - y - prevYEnd) / trackHeight * trackRingSize; - const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle); - const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle); - const endRad = valueToRadian(xs + barWidth, trackWidth, startAngle, endAngle); - g.beginFill(colorToHex(color2), color2 === "none" ? 0 : actualOpacity); - g.moveTo(sPos.x, sPos.y); - g.arc(cx, cy, nearR, startRad, endRad, true); - g.arc(cx, cy, farR, endRad, startRad, false); - polygonForMouseEvents = Array.from(g.currentPath.points); - g.closePath(); - } else { - g.beginFill(colorToHex(color2), color2 === "none" ? 0 : actualOpacity); - g.drawRect(xs, rowHeight - y - prevYEnd, barWidth, y); - const ys = rowHeight - y - prevYEnd; - const ye = ys + y; - polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys]; - } - model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents); - prevYEnd += y; - }); - }); - } else { - rowCategories.forEach((rowCategory) => { - const rowPosition = model.encodedValue("row", rowCategory); - data2.filter((d) => { - const rowValue = getValueUsingChannel(d, spec.row); - return !rowValue || rowValue === rowCategory; - }).forEach((d) => { - const color2 = model.encodedPIXIProperty("color", d); - const stroke = model.encodedPIXIProperty("stroke", d); - const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); - const opacity = model.encodedPIXIProperty("opacity"); - let y = model.encodedPIXIProperty("y", d); - let ye = model.encodedPIXIProperty("ye", d); - if (typeof ye !== "undefined" && y > ye) { - [y, ye] = [ye, y]; - } - const barWidth = model.encodedPIXIProperty("width", d, { tileUnitWidth }); - const xs = model.encodedPIXIProperty("x-start", d, { markWidth: barWidth }); - const xe = xs + barWidth; - let ys; - if (typeof ye === "undefined") { - ys = rowPosition + rowHeight - staticBaseY - y; - ye = rowPosition + rowHeight - staticBaseY; - if (IsChannelDeep(spec.y) && spec.y.flip || spec.flipY) { - ye = ys; - ys = rowPosition; - } - } else { - ys = rowPosition + rowHeight - ye; - ye = rowPosition + rowHeight - y; - } - if (clipRow) { - ys = Math.max(rowPosition, ys); - ys = Math.min(ys, rowPosition + rowHeight); - ye = Math.max(rowPosition, ye); - ye = Math.min(ye, rowPosition + rowHeight); - } - const alphaTransition = model.markVisibility(d, { width: barWidth, zoomLevel }); - const actualOpacity = Math.min(alphaTransition, opacity); - if (actualOpacity === 0 || barWidth === 0 || ye - ys === 0) { - return; - } - g.lineStyle( - strokeWidth, - colorToHex(stroke), - actualOpacity, - 0 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - let polygonForMouseEvents = []; - if (circular) { - const farR = trackOuterRadius - ys / trackHeight * trackRingSize; - const nearR = trackOuterRadius - ye / trackHeight * trackRingSize; - const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle); - const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle); - const endRad = valueToRadian(xs + barWidth, trackWidth, startAngle, endAngle); - g.beginFill(colorToHex(color2), color2 === "none" ? 0 : actualOpacity); - g.moveTo(sPos.x, sPos.y); - g.arc(cx, cy, nearR, startRad, endRad, true); - g.arc(cx, cy, farR, endRad, startRad, false); - polygonForMouseEvents = Array.from(g.currentPath.points); - g.closePath(); - } else { - g.beginFill(colorToHex(color2), color2 === "none" ? 0 : actualOpacity); - g.drawRect(xs, ys, barWidth, ye - ys); - polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys]; - } - model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents); - }); - }); - } -} -function barProperty(gm, propertyKey, datum, additionalInfo) { - const x = gm.visualPropertyByChannel("x", datum); - const xe = gm.visualPropertyByChannel("xe", datum); - const size = gm.visualPropertyByChannel("size", datum); - switch (propertyKey) { - case "width": - return size != null ? size : xe ? xe - x : additionalInfo == null ? void 0 : additionalInfo.tileUnitWidth; - case "x-start": - if (!(additionalInfo == null ? void 0 : additionalInfo.markWidth)) { - return void 0; - } - return xe ? (x + xe - (additionalInfo == null ? void 0 : additionalInfo.markWidth)) / 2 : x - (additionalInfo == null ? void 0 : additionalInfo.markWidth) / 2; - default: - return void 0; - } -} -function drawArea(HGC, track, tile, model) { - var _a, _b, _c, _d, _e, _f; - const spec = model.spec(); - const data2 = model.data(); - const [trackWidth, trackHeight] = track.dimensions; - const circular = spec.layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const trackCenterX = trackWidth / 2; - const trackCenterY = trackHeight / 2; - const xScale = track._xScale; - const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = trackHeight / rowCategories.length; - const colorCategories = (_f = model.getChannelDomainArray("color")) != null ? _f : ["___SINGLE_COLOR___"]; - const constantOpacity = model.encodedPIXIProperty("opacity"); - const constantStrokeWidth = model.encodedPIXIProperty("strokeWidth"); - const constantStroke = model.encodedPIXIProperty("stroke"); - const graphics = tile.graphics; - if (IsStackedMark(spec)) { - const genomicChannel = model.getGenomicChannel(); - if (!genomicChannel || !genomicChannel.field) { - console.warn("Genomic field is not provided in the specification"); - return; - } - const pivotedData = group(data2, (d) => d[genomicChannel.field]); - const genomicPosCategories = [...pivotedData.keys()]; - graphics.lineStyle( - constantStrokeWidth, - colorToHex(constantStroke), - constantOpacity, - 1 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - const prevYEndByGPos = {}; - colorCategories.forEach((colorCategory) => { - const areaPointsTop = []; - const areaPointsBottom = []; - genomicPosCategories.forEach((genomicPosCategory, i, array) => { - var _a2, _b2; - (_b2 = (_a2 = pivotedData.get(genomicPosCategory)) == null ? void 0 : _a2.filter((d) => getValueUsingChannel(d, spec.color) === colorCategory)) == null ? void 0 : _b2.forEach((d) => { - const xValue = +genomicPosCategory; - const cx = xScale(xValue); - const cy = max([model.encodedPIXIProperty("y", d), 0]); - if (typeof prevYEndByGPos[genomicPosCategory] === "undefined") { - prevYEndByGPos[genomicPosCategory] = 0; - } - const ys = rowHeight - cy - prevYEndByGPos[genomicPosCategory]; - const ye = rowHeight - prevYEndByGPos[genomicPosCategory]; - if (circular) { - if (i === 0) { - const r = trackOuterRadius - rowHeight / trackHeight * trackRingSize; - const pos = cartesianToPolar( - cx, - trackWidth, - r, - trackCenterX, - trackCenterY, - startAngle, - endAngle - ); - areaPointsTop.push([pos.x, pos.y]); - areaPointsBottom.push([pos.x, pos.y]); - } - const rTop = trackOuterRadius - ys / trackHeight * trackRingSize; - const posTop = cartesianToPolar( - cx, - trackWidth, - rTop, - trackCenterX, - trackCenterY, - startAngle, - endAngle - ); - areaPointsTop.push([posTop.x, posTop.y]); - const rBot = trackOuterRadius - ye / trackHeight * trackRingSize; - const posBot = cartesianToPolar( - cx, - trackWidth, - rBot, - trackCenterX, - trackCenterY, - startAngle, - endAngle - ); - areaPointsBottom.push([posBot.x, posBot.y]); - if (i === array.length - 1) { - const r = trackOuterRadius - rowHeight / trackHeight * trackRingSize; - const pos = cartesianToPolar( - cx, - trackWidth, - r, - trackCenterX, - trackCenterY, - startAngle, - endAngle - ); - areaPointsTop.push([pos.x, pos.y]); - areaPointsBottom.push([pos.x, pos.y]); - } - model.getMouseEventModel().addPointBasedEvent(d, [posBot.x, posBot.y, 1]); - } else { - if (i === 0) { - areaPointsTop.push([cx, rowHeight]); - areaPointsBottom.push([cx, rowHeight]); - } - areaPointsTop.push([cx, ys]); - areaPointsBottom.push([cx, ye]); - if (i === array.length - 1) { - areaPointsTop.push([cx, rowHeight]); - areaPointsBottom.push([cx, rowHeight]); - } - model.getMouseEventModel().addPointBasedEvent(d, [cx, ys, 1]); - } - prevYEndByGPos[genomicPosCategory] += cy; - }); - }); - const color2 = model.encodedValue("color", colorCategory); - graphics.beginFill(colorToHex(color2), constantOpacity); - graphics.drawPolygon([ - ...areaPointsTop.reduce((a, b) => a.concat(b)), - ...areaPointsBottom.reverse().reduce((a, b) => a.concat(b)) - ]); - graphics.endFill(); - }); - } else { - rowCategories.forEach((rowCategory) => { - const rowPosition = model.encodedValue("row", rowCategory); - graphics.lineStyle( - constantStrokeWidth, - colorToHex(constantStroke), - constantOpacity, - 0 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - colorCategories.forEach((colorCategory) => { - const baselinePoints = []; - const areaPoints = []; - const baselineR = trackOuterRadius - (rowPosition + rowHeight) / trackHeight * trackRingSize; - let startX = 0; - data2.filter( - (d) => (typeof getValueUsingChannel(d, spec.row) === "undefined" || getValueUsingChannel(d, spec.row) === rowCategory) && (typeof getValueUsingChannel(d, spec.color) === "undefined" || getValueUsingChannel(d, spec.color) === colorCategory) - ).sort( - // should sort properly before visualizing it so that the path is correctly drawn - (a, b) => model.encodedPIXIProperty("x", a) - model.encodedPIXIProperty("x", b) - ).forEach((d, i, array) => { - const cy = min([max([model.encodedPIXIProperty("y", d), 0]), rowHeight]); - const cx = model.encodedPIXIProperty("x", d); - if (circular) { - const baselinePos = cartesianToPolar( - cx, - trackWidth, - baselineR, - trackCenterX, - trackCenterY, - startAngle, - endAngle - ); - baselinePoints.push([baselinePos.x, baselinePos.y]); - if (i === 0) { - areaPoints.push(baselinePos.x, baselinePos.y); - } - const r = trackOuterRadius - (rowPosition + rowHeight - cy) / trackHeight * trackRingSize; - const pos = cartesianToPolar( - cx, - trackWidth, - r, - trackCenterX, - trackCenterY, - startAngle, - endAngle - ); - areaPoints.push(pos.x, pos.y); - if (i === array.length - 1) { - const startR = trackOuterRadius - (rowPosition + rowHeight) / trackHeight * trackRingSize; - const curPos = cartesianToPolar( - cx, - trackWidth, - startR, - trackCenterX, - trackCenterY, - startAngle, - endAngle - ); - areaPoints.push(curPos.x, curPos.y); - } - model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, 1]); - } else { - if (i === 0) { - areaPoints.push(cx, rowPosition + rowHeight); - startX = cx; - } - areaPoints.push(cx, rowPosition + rowHeight - cy); - if (i === array.length - 1) { - areaPoints.push(cx, rowPosition + rowHeight); - areaPoints.push(startX, rowPosition + rowHeight); - } - model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - cy, 1]); - } - }); - if (circular && baselinePoints.length !== 0) { - areaPoints.push(...baselinePoints.reverse().reduce((a, b) => a.concat(b))); - } - const color2 = model.encodedValue("color", colorCategory); - graphics.beginFill(colorToHex(color2), constantOpacity); - graphics.drawPolygon(areaPoints); - graphics.endFill(); - }); - }); - } -} -function drawRect(HGC, track, tile, model) { - var _a, _b, _c, _d, _e, _f; - const spec = model.spec(); - const data2 = model.data(); - const [trackWidth, trackHeight] = track.dimensions; - const circular = spec.layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const cx = trackWidth / 2; - const cy = trackHeight / 2; - const xScale = track._xScale; - let tileUnitWidth; - if (tile.tileData.tilePos) { - const tileSize = track.tilesetInfo.tile_size; - const { tileX, tileWidth } = track.getTilePosAndDimensions( - tile.tileData.zoomLevel, - tile.tileData.tilePos, - // TODO: required parameter. Typing out `track` should address this issue. - tileSize - ); - tileUnitWidth = xScale(tileX + tileWidth / tileSize) - xScale(tileX); - } - const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = trackHeight / rowCategories.length; - const RPAD = IsChannelDeep(spec.row) && spec.row.padding ? spec.row.padding : 0; - const yCategories = (_f = model.getChannelDomainArray("y")) != null ? _f : ["___SINGLE_Y_POSITION___"]; - const cellHeight = rowHeight / yCategories.length - RPAD * 2; - const g = tile.graphics; - data2.forEach((d) => { - var _a2; - const rowPosition = model.encodedPIXIProperty("row", d) + RPAD; - const x = model.encodedPIXIProperty("x", d); - const color2 = model.encodedPIXIProperty("color", d); - const stroke = model.encodedPIXIProperty("stroke", d); - const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); - const opacity = model.encodedPIXIProperty("opacity", d); - const rectWidth = model.encodedPIXIProperty("width", d, { markWidth: tileUnitWidth }); - const rectHeight = model.encodedPIXIProperty("height", d, { markHeight: cellHeight }); - const y = model.encodedPIXIProperty("y", d); - const alphaTransition = model.markVisibility(d, { - width: rectWidth, - zoomLevel: track._xScale.invert(trackWidth) - track._xScale.invert(0) - }); - const actualOpacity = Math.min(alphaTransition, opacity); - if (actualOpacity === 0 || rectHeight === 0 || rectWidth <= 1e-4) { - return; - } - const [xs, xe, ys, ye] = [ - x, - x + rectWidth, - rowPosition + rowHeight - y - rectHeight / 2, - rowPosition + rowHeight - y + rectHeight / 2 - ]; - const absoluteHeight = (_a2 = model.visualPropertyByChannel("size", d)) != null ? _a2 : void 0; - g.lineStyle( - strokeWidth, - colorToHex(stroke), - actualOpacity, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - let polygonForMouseEvent = []; - if (circular) { - if (xe < 0 || trackWidth < xs) { - return; - } - let farR = trackOuterRadius - ys / trackHeight * trackRingSize; - let nearR = trackOuterRadius - ye / trackHeight * trackRingSize; - if (absoluteHeight) { - const midR = trackOuterRadius - (rowPosition + y) / trackHeight * trackRingSize; - farR = midR - absoluteHeight / 2; - nearR = midR + absoluteHeight / 2; - } - const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle); - const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle); - const endRad = valueToRadian(xe, trackWidth, startAngle, endAngle); - g.beginFill(colorToHex(color2 === "none" ? "white" : color2), color2 === "none" ? 0 : actualOpacity); - g.moveTo(sPos.x, sPos.y); - g.arc(cx, cy, nearR, startRad, endRad, true); - g.arc(cx, cy, farR, endRad, startRad, false); - polygonForMouseEvent = Array.from(g.currentPath.points); - g.closePath(); - } else { - g.beginFill(colorToHex(color2 === "none" ? "white" : color2), color2 === "none" ? 0 : actualOpacity); - g.drawRect(xs, ys, xe - xs, ye - ys); - polygonForMouseEvent = [xs, ys, xs, ye, xe, ye, xe, ys]; - } - model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvent); - }); -} -function rectProperty(gm, propertyKey, datum, additionalInfo) { - var _a; - switch (propertyKey) { - case "width": - const width = ( - // (1) size - gm.visualPropertyByChannel("xe", datum) ? gm.visualPropertyByChannel("xe", datum) - gm.visualPropertyByChannel("x", datum) : ( - // (2) unit mark height - additionalInfo == null ? void 0 : additionalInfo.markWidth - ) - ); - return width === 0 ? 0.1 : width; - case "height": - return ( - // (1) size - (_a = gm.visualPropertyByChannel("size", datum)) != null ? _a : ( - // (2) unit mark height - additionalInfo == null ? void 0 : additionalInfo.markHeight - ) - ); - default: - return void 0; - } -} -function drawTriangle(g, model, trackWidth, trackHeight) { - var _a, _b, _c, _d, _e, _f, _g; - const spec = model.spec(); - if (!spec.width || !spec.height) { - console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); - return; - } - const data2 = model.data(); - const zoomLevel = model.getChannelScale("x").invert(trackWidth) - model.getChannelScale("x").invert(0); - const circular = spec.layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const cx = trackWidth / 2; - const cy = trackHeight / 2; - const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = trackHeight / rowCategories.length; - const yCategories = (_f = model.getChannelDomainArray("y")) != null ? _f : ["___SINGLE_Y___"]; - const triHeight = (_g = model.encodedValue("size")) != null ? _g : circular ? trackRingSize / rowCategories.length / yCategories.length : rowHeight / yCategories.length; - rowCategories.forEach((rowCategory) => { - const rowPosition = model.encodedValue("row", rowCategory); - data2.filter( - (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory - ).forEach((d) => { - var _a2, _b2, _c2; - const x = model.encodedPIXIProperty("x", d); - const xe = model.encodedPIXIProperty("xe", d); - const markWidth = (_a2 = model.encodedPIXIProperty("size", d)) != null ? _a2 : xe === void 0 ? triHeight : xe - x; - const y = model.encodedPIXIProperty("y", d); - const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); - const stroke = model.encodedPIXIProperty("stroke", d); - const color2 = model.encodedPIXIProperty("color", d); - const opacity = model.encodedPIXIProperty("opacity", d); - let polygon = []; - if (circular) { - let x0 = x ? x : xe - markWidth; - let x1 = xe ? xe : x + markWidth; - let xm = (x0 + x1) / 2; - const rm = trackOuterRadius - (rowPosition + rowHeight - y) / trackHeight * trackRingSize; - const r0 = rm - triHeight / 2; - const r1 = rm + triHeight / 2; - if (((_b2 = spec.style) == null ? void 0 : _b2.align) === "right" && !xe) { - x0 -= markWidth; - x1 -= markWidth; - xm -= markWidth; - } - if (spec.mark === "triangleLeft") { - const p0 = cartesianToPolar(x1, trackWidth, r0, cx, cy, startAngle, endAngle); - const p1 = cartesianToPolar(x0, trackWidth, rm, cx, cy, startAngle, endAngle); - const p2 = cartesianToPolar(x1, trackWidth, r1, cx, cy, startAngle, endAngle); - const p3 = cartesianToPolar(x1, trackWidth, r0, cx, cy, startAngle, endAngle); - polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y]; - } else if (spec.mark === "triangleRight") { - const p0 = cartesianToPolar(x0, trackWidth, r0, cx, cy, startAngle, endAngle); - const p1 = cartesianToPolar(x1, trackWidth, rm, cx, cy, startAngle, endAngle); - const p2 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle); - const p3 = cartesianToPolar(x0, trackWidth, r0, cx, cy, startAngle, endAngle); - polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y]; - } else if (spec.mark === "triangleBottom") { - x0 = xm - markWidth / 2; - x1 = xm + markWidth / 2; - const p0 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle); - const p1 = cartesianToPolar(x1, trackWidth, r1, cx, cy, startAngle, endAngle); - const p2 = cartesianToPolar(xm, trackWidth, r0, cx, cy, startAngle, endAngle); - const p3 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle); - polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y]; - } - const alphaTransition = model.markVisibility(d, { width: x1 - x0, zoomLevel }); - const actualOpacity = Math.min(alphaTransition, opacity); - g.lineStyle( - strokeWidth, - colorToHex(stroke), - // too narrow triangle's stroke is becoming too sharp - x1 - x0 > 2 ? actualOpacity : 0, - // alpha - 0 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - g.beginFill(colorToHex(color2), actualOpacity); - g.drawPolygon(polygon); - g.endFill(); - } else { - let x0 = x ? x : xe - markWidth; - let x1 = xe ? xe : x + markWidth; - let xm = x0 + (x1 - x0) / 2; - const ym = rowPosition + rowHeight - y; - const y0 = rowPosition + rowHeight - y - triHeight / 2; - const y1 = rowPosition + rowHeight - y + triHeight / 2; - if (((_c2 = spec.style) == null ? void 0 : _c2.align) === "right" && !xe) { - x0 -= markWidth; - x1 -= markWidth; - xm -= markWidth; - } - polygon = { - triangleLeft: [x1, y0, x0, ym, x1, y1, x1, y0], - triangleRight: [x0, y0, x1, ym, x0, y1, x0, y0], - triangleBottom: [x0, y0, x1, y0, xm, y1, x0, y0] - }[spec.mark]; - const alphaTransition = model.markVisibility(d, { width: x1 - x0, zoomLevel }); - const actualOpacity = Math.min(alphaTransition, opacity); - g.lineStyle( - strokeWidth, - colorToHex(stroke), - // too narrow triangle's stroke is becoming too sharp - x1 - x0 > 2 ? actualOpacity : 0, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - g.beginFill(colorToHex(color2), actualOpacity); - g.drawPolygon(polygon); - g.endFill(); - } - model.getMouseEventModel().addPolygonBasedEvent(d, polygon); - }); - }); -} -const TEXT_STYLE_GLOBAL = { - fontSize: "12px", - fontFamily: "sans-serif", - // 'Arial', - fontWeight: "normal", - fill: "black", - background: "white", - lineJoin: "round", - stroke: "#ffffff", - strokeThickness: 0 -}; -function drawText(HGC, trackInfo, tile, model) { - var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j; - const spec = model.spec(); - const data2 = model.data(); - const [trackWidth, trackHeight] = trackInfo.dimensions; - const circular = spec.layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const tcx = trackWidth / 2; - const tcy = trackHeight / 2; - const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = trackHeight / rowCategories.length; - const dx = (_g = (_f = spec.style) == null ? void 0 : _f.dx) != null ? _g : 0; - const dy = (_i = (_h = spec.style) == null ? void 0 : _h.dy) != null ? _i : 0; - const textAnchor = !((_j = spec.style) == null ? void 0 : _j.textAnchor) ? "middle" : spec.style.textAnchor; - if (IsStackedMark(spec)) { - if (circular) { - return; - } - const rowGraphics = tile.graphics; - const genomicChannel = model.getGenomicChannel(); - if (!genomicChannel || !genomicChannel.field) { - console.warn("Genomic field is not provided in the specification"); - return; - } - const pivotedData = group(data2, (d) => d[genomicChannel.field]); - const xKeys = [...pivotedData.keys()]; - xKeys.forEach((k) => { - var _a2; - let prevYEnd = 0; - (_a2 = pivotedData.get(k)) == null ? void 0 : _a2.forEach((d) => { - var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2; - const text = model.encodedPIXIProperty("text", d); - const color2 = model.encodedPIXIProperty("color", d); - const x = model.encodedPIXIProperty("x", d) + dx; - const xe = model.encodedPIXIProperty("xe", d) + dx; - const cx = model.encodedPIXIProperty("x-center", d) + dx; - const y = model.encodedPIXIProperty("y", d) + dy; - const size = model.encodedPIXIProperty("size", d); - const stroke = model.encodedPIXIProperty("stroke", d); - const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); - const opacity = model.encodedPIXIProperty("opacity", d); - if (cx < 0 || cx > trackWidth) { - return; - } - if (trackInfo.textsBeingUsed > 1e3) { - return; - } - const localTextStyle = { - ...TEXT_STYLE_GLOBAL, - fontSize: size != null ? size : ((_a3 = spec.style) == null ? void 0 : _a3.textFontSize) ? `${(_b2 = spec.style) == null ? void 0 : _b2.textFontSize}px` : TEXT_STYLE_GLOBAL.fontSize, - stroke: (_d2 = stroke != null ? stroke : (_c2 = spec.style) == null ? void 0 : _c2.textStroke) != null ? _d2 : TEXT_STYLE_GLOBAL.stroke, - strokeThickness: (_f2 = strokeWidth != null ? strokeWidth : (_e2 = spec.style) == null ? void 0 : _e2.textStrokeWidth) != null ? _f2 : TEXT_STYLE_GLOBAL.strokeThickness, - fontWeight: (_h2 = (_g2 = spec.style) == null ? void 0 : _g2.textFontWeight) != null ? _h2 : TEXT_STYLE_GLOBAL.fontWeight - }; - const textStyleObj = new HGC.libraries.PIXI.TextStyle(localTextStyle); - let textGraphic; - if (trackInfo.textGraphics.length > trackInfo.textsBeingUsed) { - textGraphic = trackInfo.textGraphics[trackInfo.textsBeingUsed]; - textGraphic.style.fill = color2; - textGraphic.visible = true; - textGraphic.text = text; - textGraphic.alpha = 1; - } else { - textGraphic = new HGC.libraries.PIXI.Text(text, { - ...localTextStyle, - fill: color2 - }); - trackInfo.textGraphics.push(textGraphic); - } - const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, textStyleObj); - trackInfo.textsBeingUsed++; - const alphaTransition = model.markVisibility(d, { - ...metric, - zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0) - }); - const actualOpacity = Math.min(alphaTransition, opacity); - if (!text || actualOpacity === 0) { - trackInfo.textsBeingUsed--; - textGraphic.visible = false; - return; - } - textGraphic.alpha = actualOpacity; - textGraphic.resolution = 8; - textGraphic.updateText(); - textGraphic.texture.baseTexture.scaleMode = HGC.libraries.PIXI.SCALE_MODES.LINEAR; - const sprite = new HGC.libraries.PIXI.Sprite(textGraphic.texture); - sprite.x = x; - sprite.y = rowHeight - y - prevYEnd; - sprite.width = xe - x; - sprite.height = y; - rowGraphics.addChild(sprite); - prevYEnd += y; - }); - }); - } else { - rowCategories.forEach((rowCategory) => { - const rowGraphics = tile.graphics; - const rowPosition = model.encodedValue("row", rowCategory); - data2.filter( - (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory - ).forEach((d) => { - var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2; - const text = model.encodedPIXIProperty("text", d); - const color2 = model.encodedPIXIProperty("color", d); - const cx = model.encodedPIXIProperty("x-center", d) + dx; - const y = model.encodedPIXIProperty("y", d) + dy; - const size = model.encodedPIXIProperty("size", d); - const stroke = model.encodedPIXIProperty("stroke", d); - const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); - const opacity = model.encodedPIXIProperty("opacity", d); - if (cx < 0 || cx > trackWidth) { - return; - } - if (trackInfo.textsBeingUsed > 1e3) { - return; - } - const localTextStyle = { - ...TEXT_STYLE_GLOBAL, - fontSize: size != null ? size : ((_a2 = spec.style) == null ? void 0 : _a2.textFontSize) ? `${(_b2 = spec.style) == null ? void 0 : _b2.textFontSize}px` : TEXT_STYLE_GLOBAL.fontSize, - stroke: (_d2 = stroke != null ? stroke : (_c2 = spec.style) == null ? void 0 : _c2.textStroke) != null ? _d2 : TEXT_STYLE_GLOBAL.stroke, - strokeThickness: (_f2 = strokeWidth != null ? strokeWidth : (_e2 = spec.style) == null ? void 0 : _e2.textStrokeWidth) != null ? _f2 : TEXT_STYLE_GLOBAL.strokeThickness, - fontWeight: (_h2 = (_g2 = spec.style) == null ? void 0 : _g2.textFontWeight) != null ? _h2 : TEXT_STYLE_GLOBAL.fontWeight - }; - const textStyleObj = new HGC.libraries.PIXI.TextStyle(localTextStyle); - let textGraphic; - if (trackInfo.textGraphics.length > trackInfo.textsBeingUsed) { - textGraphic = trackInfo.textGraphics[trackInfo.textsBeingUsed]; - textGraphic.style.fill = color2; - textGraphic.visible = true; - textGraphic.text = text; - textGraphic.alpha = 1; - } else { - textGraphic = new HGC.libraries.PIXI.Text(text, { - ...localTextStyle, - fill: color2 - }); - trackInfo.textGraphics.push(textGraphic); - } - const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, textStyleObj); - trackInfo.textsBeingUsed++; - const alphaTransition = model.markVisibility(d, { - ...metric, - zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0) - }); - const actualOpacity = Math.min(alphaTransition, opacity); - if (!text || actualOpacity === 0) { - trackInfo.textsBeingUsed--; - textGraphic.visible = false; - return; - } - textGraphic.alpha = actualOpacity; - textGraphic.anchor.y = 0.5; - textGraphic.anchor.x = textAnchor === "middle" ? 0.5 : textAnchor === "start" ? 0 : 1; - let polygonForMouseEvents = []; - if (circular) { - const r = trackOuterRadius - (rowPosition + rowHeight - y) / trackHeight * trackRingSize; - const centerPos = cartesianToPolar(cx, trackWidth, r, tcx, tcy, startAngle, endAngle); - textGraphic.x = centerPos.x; - textGraphic.y = centerPos.y; - textGraphic.resolution = 4; - const tw = metric.width / (2 * r * Math.PI) * trackWidth; - let [minX, maxX] = [cx - tw / 2, cx + tw / 2]; - if (minX < 0) { - const gap = -minX; - minX = 0; - maxX += gap; - } else if (maxX > trackWidth) { - const gap = maxX - trackWidth; - maxX = trackWidth; - minX -= gap; - } - const ropePoints = []; - const eventPointsFar = []; - const eventPointsNear = []; - for (let i = maxX; i >= minX; i -= tw / 10) { - const p = cartesianToPolar(i, trackWidth, r, tcx, tcy, startAngle, endAngle); - ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y)); - const pFar = cartesianToPolar( - i, - trackWidth, - r + metric.height / 2, - tcx, - tcy, - startAngle, - endAngle - ); - const pNear = cartesianToPolar( - i, - trackWidth, - r - metric.height / 2, - tcx, - tcy, - startAngle, - endAngle - ); - eventPointsFar.push(pFar.x, pFar.y); - if (i === maxX) { - eventPointsNear.push(pFar.y, pFar.x); - } - eventPointsNear.push(pNear.y, pNear.x); - } - textGraphic.updateText(); - const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints); - rope.alpha = actualOpacity; - rowGraphics.addChild(rope); - eventPointsNear.reverse(); - polygonForMouseEvents = eventPointsFar.concat(eventPointsNear); - } else { - textGraphic.position.x = cx; - textGraphic.position.y = rowPosition + rowHeight - y; - rowGraphics.addChild(textGraphic); - const { height: h, width: w } = metric; - const ys = textGraphic.position.y - h / 2; - const ye = ys + h; - let xs = 0; - let xe = 0; - if (textAnchor === "start") { - xs = cx; - xe = cx + w; - } else if (textAnchor === "middle") { - xs = cx - w / 2; - xe = cx + w / 2; - } else { - xs = cx - w; - xe = cx; - } - polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys]; - } - model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents); - }); - }); - } -} -function drawRule(HGC, trackInfo, tile, model) { - var _a, _b, _c, _d, _e, _f, _g, _h; - const spec = model.spec(); - const data2 = model.data(); - const [trackWidth, trackHeight] = trackInfo.dimensions; - const circular = spec.layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const cx = trackWidth / 2; - const cy = trackHeight / 2; - const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = trackHeight / rowCategories.length; - const dashed = (_f = spec.style) == null ? void 0 : _f.dashed; - const linePattern = (_g = spec.style) == null ? void 0 : _g.linePattern; - const curved = (_h = spec.style) == null ? void 0 : _h.curve; - const g = tile.graphics; - rowCategories.forEach((rowCategory) => { - const rowPosition = model.encodedValue("row", rowCategory); - data2.filter( - (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory - ).forEach((d) => { - const x = model.encodedPIXIProperty("x", d); - const xe = model.encodedPIXIProperty("xe", d); - const y = model.encodedPIXIProperty("y", d); - const color2 = model.encodedPIXIProperty("color", d); - const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); - const opacity = model.encodedPIXIProperty("opacity", d); - const alphaTransition = model.markVisibility(d, { - width: xe - x, - zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0) - }); - const actualOpacity = Math.min(alphaTransition, opacity); - g.lineStyle( - strokeWidth, - colorToHex(color2), - actualOpacity, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - if (!xe && (!spec.y || !("field" in spec.y))) { - if (circular) { - return; - } else { - if (dashed) { - const [dashSize, gapSize] = dashed; - let curPos = 0; - do { - g.moveTo(x, curPos); - g.lineTo(x, curPos + dashSize); - curPos += dashSize + gapSize; - } while (curPos < trackHeight); - } else { - g.moveTo(x, 0); - g.lineTo(x, trackHeight); - } - } - } else if (!xe && y) { - if (circular) { - g.lineStyle( - strokeWidth, - colorToHex(color2), - 0, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - const midR = trackOuterRadius - (rowPosition + y) / trackHeight * trackRingSize; - const farR = midR + strokeWidth / 2; - const nearR = midR - strokeWidth / 2; - const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle); - const startRad = valueToRadian(0, trackWidth, startAngle, endAngle); - const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle); - g.beginFill(colorToHex(color2), actualOpacity); - g.moveTo(sPos.x, sPos.y); - g.arc(cx, cy, nearR, startRad, endRad, true); - g.arc(cx, cy, farR, endRad, startRad, false); - g.closePath(); - } else { - if (dashed) { - const [dashSize, gapSize] = dashed; - let curPos = 0; - do { - g.moveTo(curPos, rowPosition + rowHeight - y); - g.lineTo(curPos + dashSize, rowPosition + rowHeight - y); - curPos += dashSize + gapSize; - } while (curPos < trackWidth); - } else { - g.moveTo(0, rowPosition + rowHeight - y); - g.lineTo(trackWidth, rowPosition + rowHeight - y); - } - } - } else { - if (circular) { - if (strokeWidth === 0) { - return; - } - g.lineStyle( - strokeWidth, - colorToHex(color2), - 0, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - const midR = trackOuterRadius - (rowPosition + rowHeight - y) / trackHeight * trackRingSize; - const farR = midR + strokeWidth / 2; - const nearR = midR - strokeWidth / 2; - const sPos = cartesianToPolar(x, trackWidth, nearR, cx, cy, startAngle, endAngle); - const startRad = valueToRadian(x, trackWidth, startAngle, endAngle); - const endRad = valueToRadian(xe, trackWidth, startAngle, endAngle); - g.beginFill(colorToHex(color2), actualOpacity); - g.moveTo(sPos.x, sPos.y); - g.arc(cx, cy, nearR, startRad, endRad, true); - g.arc(cx, cy, farR, endRad, startRad, false); - g.closePath(); - } else if (dashed) { - const [dashSize, gapSize] = dashed; - let curPos = x; - do { - g.moveTo(curPos, rowPosition + rowHeight - y); - g.lineTo(curPos + dashSize, rowPosition + rowHeight - y); - curPos += dashSize + gapSize; - } while (curPos < xe); - } else { - if (curved === void 0) { - g.moveTo(x, rowPosition + rowHeight - y); - g.lineTo(xe, rowPosition + rowHeight - y); - } else if (curved === "top") { - const CURVE_HEIGHT = 2; - const xm = x + (xe - x) / 2; - g.moveTo(x, rowPosition + rowHeight - y + CURVE_HEIGHT / 2); - g.lineTo(xm, rowPosition + rowHeight - y - CURVE_HEIGHT / 2); - g.moveTo(xm, rowPosition + rowHeight - y - CURVE_HEIGHT / 2); - g.lineTo(xe, rowPosition + rowHeight - y + CURVE_HEIGHT / 2); - } - } - if (linePattern && curved === void 0 && !circular) { - const { type: pType, size: pSize } = linePattern; - let curPos = Math.max(x, 0); - g.lineStyle(0); - const PATTERN_GAP_SIZE = pSize * 2; - let count = 0; - while (curPos < Math.min(xe, trackWidth) && count < 100) { - const x0 = curPos; - const x1 = curPos + pSize; - const ym = rowPosition + rowHeight - y; - const y0 = ym - pSize / 2; - const y1 = ym + pSize / 2; - g.beginFill(colorToHex(color2), actualOpacity); - g.drawPolygon( - pType === "triangleLeft" ? [x1, y0, x0, ym, x1, y1, x1, y0] : [x0, y0, x1, ym, x0, y1, x0, y0] - ); - g.endFill(); - curPos += pSize + PATTERN_GAP_SIZE; - count++; - } - } - } - }); - }); -} -function drawWithinLink(g, trackInfo, model) { - var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j; - const spec = model.spec(); - if (!spec.width || !spec.height) { - console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); - return; - } - const data2 = model.data(); - const [trackWidth, trackHeight] = trackInfo.dimensions; - const circular = spec.layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const tcx = trackWidth / 2; - const tcy = trackHeight / 2; - const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = trackHeight / rowCategories.length; - const MIN_HEIGHT = (_g = (_f = spec.style) == null ? void 0 : _f.linkMinHeight) != null ? _g : 0.5; - const NUM_STEPS = ((_h = spec.experimental) == null ? void 0 : _h.performanceMode) ? 10 : 50; - const showVerticalLines = (_j = (_i = spec.style) == null ? void 0 : _i.withinLinkVerticalLines) != null ? _j : false; - rowCategories.forEach((rowCategory) => { - const rowPosition = model.encodedValue("row", rowCategory); - data2.filter( - (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory - ).forEach((d) => { - var _a2, _b2, _c2, _d2, _e2; - let x = model.encodedPIXIProperty("x", d); - let xe = model.encodedPIXIProperty("xe", d); - let x1 = model.encodedPIXIProperty("x1", d); - let x1e = model.encodedPIXIProperty("x1e", d); - const y = model.encodedPIXIProperty("y", d); - const ye = model.encodedPIXIProperty("ye", d); - const stroke = model.encodedPIXIProperty("stroke", d); - const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); - const color2 = model.encodedPIXIProperty("color", d); - const opacity = model.encodedPIXIProperty("opacity", d); - if (typeof xe !== "undefined") { - [x, xe] = [x, xe].sort((a, b) => a - b); - } - if (typeof x1 !== "undefined" && typeof x1e !== "undefined") { - [x1, x1e] = [x1, x1e].sort((a, b) => a - b); - } - const isRibbon = typeof xe !== "undefined" && typeof x1 !== "undefined" && typeof x1e !== "undefined" && // This means the strokeWidth of a band is too small, so we just need to draw a line instead - Math.abs(x - xe) > 0.1 && Math.abs(x1 - x1e) > 0.1; - if (!isRibbon && xe === void 0 && !Is2DTrack(spec)) { - if (x1 === void 0 && x1e === void 0) { - return; - } - xe = x1 !== void 0 ? x1 : x1e; - } - if (!isRibbon && Math.abs(x - xe) <= 0.1 && Math.abs(x1 - x1e) <= 0.1) { - x = (x + xe) / 2; - xe = (x1 + x1e) / 2; - } - g.lineStyle( - strokeWidth, - colorToHex(stroke), - opacity, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - const flipY = IsChannelDeep(spec.y) && spec.y.flip || spec.flipY; - const baseY = (_a2 = spec.baselineY) != null ? _a2 : rowPosition + (flipY ? 0 : rowHeight); - let pathForMouseEvent = []; - if (isRibbon) { - g.beginFill(color2 === "none" ? colorToHex("white") : colorToHex(color2), color2 === "none" ? 0 : opacity); - let [_x1, _x2, _x3, _x4] = [x, xe, x1, x1e]; - [_x1, _x2, _x3, _x4] = [_x1, _x2, _x3, _x4].sort((a, b) => a - b); - if (_x1 > trackWidth || _x4 < 0 || Math.abs(_x4 - _x1) < 0.5) { - return; - } - if (circular) { - if (_x1 < 0 || _x4 > trackWidth) { - return; - } - const r = trackOuterRadius - rowPosition / trackHeight * trackRingSize; - const posX = cartesianToPolar(_x1, trackWidth, r, tcx, tcy, startAngle, endAngle); - const posXE = cartesianToPolar(_x2, trackWidth, r, tcx, tcy, startAngle, endAngle); - const posX1 = cartesianToPolar(_x3, trackWidth, r, tcx, tcy, startAngle, endAngle); - const posX1E = cartesianToPolar(_x4, trackWidth, r, tcx, tcy, startAngle, endAngle); - g.moveTo(posX.x, posX.y); - g.bezierCurveTo(tcx, tcy, tcx, tcy, posX1E.x, posX1E.y); - g.arc( - tcx, - tcy, - trackOuterRadius, - positionToRadian(posX1E.x, posX1E.y, tcx, tcy), - positionToRadian(posX1.x, posX1.y, tcx, tcy), - false - ); - g.bezierCurveTo(tcx, tcy, tcx, tcy, posXE.x, posXE.y); - g.arc( - tcx, - tcy, - trackOuterRadius, - positionToRadian(posXE.x, posXE.y, tcx, tcy), - positionToRadian(posX.x, posX.y, tcx, tcy), - false - ); - pathForMouseEvent = Array.from(g.currentPath.points); - g.endFill(); - } else { - g.moveTo(_x1, baseY); - if (!((_b2 = spec.style) == null ? void 0 : _b2.linkStyle) || ((_c2 = spec.style) == null ? void 0 : _c2.linkStyle) === "circular") { - g.arc( - (_x1 + _x4) / 2, - // cx - baseY, - // cy - (_x4 - _x1) / 2, - // radius - -Math.PI, - // start angle - Math.PI, - // end angle - false - ); - g.arc((_x2 + _x3) / 2, baseY, (_x3 - _x2) / 2, Math.PI, -Math.PI, true); - pathForMouseEvent = Array.from(g.currentPath.points); - g.closePath(); - } else { - g.lineTo(_x3, rowPosition + rowHeight); - g.bezierCurveTo( - _x3 + (_x2 - _x3) / 3, - // rowPosition + (x1 - x), - rowPosition + rowHeight - (_x2 - _x3) / 2, - //Math.min(rowHeight - (x1 - x), (xe - x1) / 2.0), - _x3 + (_x2 - _x3) / 3 * 2, - // rowPosition + (x1 - x), - rowPosition + rowHeight - (_x2 - _x3) / 2, - //Math.min(rowHeight - (x1 - x), (xe - x1) / 2.0), - _x2, - rowPosition + rowHeight - ); - g.lineTo(_x4, rowPosition + rowHeight); - g.bezierCurveTo( - _x1 + (_x4 - _x1) / 3 * 2, - // rowPosition, - rowPosition + rowHeight - (_x4 - _x1) / 2, - //Math.min(rowHeight, (x1e - x) / 2.0), - _x1 + (_x4 - _x1) / 3, - // rowPosition, - rowPosition + rowHeight - (_x4 - _x1) / 2, - //Math.min(rowHeight, (x1e - x) / 2.0), - _x1, - rowPosition + rowHeight - ); - pathForMouseEvent = Array.from(g.currentPath.points); - g.endFill(); - } - } - model.getMouseEventModel().addPolygonBasedEvent(d, pathForMouseEvent); - } else { - const midX = (x + xe) / 2; - g.beginFill(colorToHex("white"), 0); - if (circular) { - if (x < 0 || xe > trackWidth) { - return; - } - if (((_d2 = spec.style) == null ? void 0 : _d2.linkStyle) === "straight") { - const r = trackOuterRadius - rowPosition / trackHeight * trackRingSize; - const posS = cartesianToPolar(x, trackWidth, r, tcx, tcy, startAngle, endAngle); - const posE = cartesianToPolar(xe, trackWidth, r, tcx, tcy, startAngle, endAngle); - const x12 = posS.x; - const y1 = posS.y; - const x4 = posE.x; - const y4 = posE.y; - g.moveTo(x12, y1); - g.lineTo(x4, y4); - const length = 100; - const eventPoints = Array.from({ length }, (d2, i) => { - return { - x: (x4 - x12) / (length - 1) * i + x12, - y: (y4 - y1) / (length - 1) * i + y1 - }; - }); - pathForMouseEvent = eventPoints.flatMap((d2) => [d2.x, d2.y]); - } else { - const r = trackOuterRadius - rowPosition / trackHeight * trackRingSize; - const posS = cartesianToPolar(x, trackWidth, r, tcx, tcy, startAngle, endAngle); - const posE = cartesianToPolar(xe, trackWidth, r, tcx, tcy, startAngle, endAngle); - const x12 = posS.x; - const y1 = posS.y; - const x2 = posS.x; - const y2 = posS.y; - const x3 = trackWidth / 2; - const y3 = trackHeight / 2; - const x4 = posE.x; - const y4 = posE.y; - g.moveTo(x12, y1); - const bezier = new Bezier(x12, y1, x2, y2, x3, y3, x4, y4); - const points = bezier.getLUT(14); - points.forEach((d2) => g.lineTo(d2.x, d2.y)); - const morePoints = bezier.getLUT(1e3); - pathForMouseEvent = morePoints.flatMap((d2) => [d2.x, d2.y]); - } - } else { - if (((_e2 = spec.style) == null ? void 0 : _e2.linkStyle) === "elliptical") { - if (!(0 <= x && x <= trackWidth) && !(0 <= xe && xe <= trackWidth)) { - return; - } - const points = []; - const isYSpecified = IsChannelDeep(spec.y); - for (let step = 0; step <= NUM_STEPS; step++) { - const theta = Math.PI * (step / NUM_STEPS); - const mx = (xe - x) / 2 * Math.cos(theta) + (x + xe) / 2; - let my = baseY - y * Math.sin(theta) * (isYSpecified ? 1 : Math.min(xe - x + trackWidth * MIN_HEIGHT, trackWidth) / trackWidth) * (flipY ? -1 : 1); - if (typeof y !== "undefined" && typeof ye !== "undefined") { - const linkHeight = Math.abs(ye - y); - const flipShape = ye > y; - my = y - linkHeight * Math.sin(theta) * (flipShape ? -1 : 1); - } - if (step === 0) { - if (showVerticalLines) { - const _y = flipY ? baseY - trackHeight : baseY; - g.moveTo(mx, _y); - points.push({ x: mx, y: _y }); - g.lineTo(mx, my); - } else { - g.moveTo(mx, my); - } - } else { - g.lineTo(mx, my); - } - points.push({ x: mx, y: my }); - if (step === NUM_STEPS && showVerticalLines) { - const _y = flipY ? baseY - trackHeight : baseY; - g.lineTo(mx, _y); - points.push({ x: mx, y: _y }); - } - } - pathForMouseEvent = points.flatMap((d2) => [d2.x, d2.y]); - } else { - if (xe < 0 || x > trackWidth) { - return; - } - g.arc(midX, baseY, (xe - x) / 2, -Math.PI, Math.PI); - pathForMouseEvent = Array.from(g.currentPath.points); - g.closePath(); - } - } - model.getMouseEventModel().addLineBasedEvent(d, pathForMouseEvent); - } - }); - }); -} -function insertItemToArray(array, index, item) { - return [...array.slice(0, index), item, ...array.slice(index)]; -} -function flatArrayToPairArray(array) { - const output = []; - for (let i = 0; i < array.length; i += 2) { - output.push([array[i], array[i + 1]]); - } - return output; -} -function isEvery(array, is) { - return array.every(is); -} -function isNumberArray(array) { - return isEvery(array, (x) => typeof x === "number"); -} -function isStringArray(array) { - return isEvery(array, (x) => typeof x === "string"); -} -function drawGrid(trackInfo, tm, theme) { - drawYGridQuantitative(trackInfo, tm, theme); - drawRowGrid(trackInfo, tm, theme); -} -function drawRowGrid(trackInfo, tm, theme) { - var _a, _b, _c, _d; - const spec = tm.spec(); - if (!IsChannelDeep(spec.row) || spec.row.grid !== true) { - return; - } - const [trackX, trackY] = trackInfo.position; - const [trackWidth, trackHeight] = trackInfo.dimensions; - const circular = tm.spec().layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const cx = trackWidth / 2; - const cy = trackHeight / 2; - const rowCategories = tm.getChannelDomainArray("row"); - if (!rowCategories) { - return; - } - const rowHeight = trackHeight / rowCategories.length; - if (circular && trackRingSize <= 20 || !circular && rowHeight <= 20) { - return; - } - const graphics = trackInfo.pBackground; - const strokeWidth = theme.axis.gridStrokeWidth; - rowCategories.forEach((rowCategory) => { - const rowPosition = tm.encodedValue("row", rowCategory); - if (!circular) { - graphics.lineStyle( - strokeWidth, - colorToHex(theme.axis.gridColor), - 1, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - const y = trackY + rowPosition + rowHeight / 2; - graphics.moveTo(trackX, y); - graphics.lineTo(trackX + trackWidth, y); - } else { - const y = rowPosition + rowHeight / 2; - const midR = trackOuterRadius - y / trackHeight * trackRingSize; - const farR = midR + strokeWidth / 2; - const nearR = midR - strokeWidth / 2; - const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle); - const startRad = valueToRadian(0, trackWidth, startAngle, endAngle); - const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle); - graphics.lineStyle( - strokeWidth, - colorToHex("black"), - 0, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - graphics.beginFill(colorToHex(theme.axis.gridColor), 1); - graphics.moveTo(trackX + sPos.x, trackY + sPos.y); - graphics.arc(trackX + cx, trackY + cy, nearR, startRad, endRad, true); - graphics.arc(trackX + cx, trackY + cy, farR, endRad, startRad, false); - graphics.closePath(); - } - }); -} -function drawYGridQuantitative(trackInfo, tm, theme) { - var _a, _b, _c, _d, _e; - const spec = tm.spec(); - if (!IsChannelDeep(spec.y) || spec.y.grid !== true) { - return; - } - const [trackX, trackY] = trackInfo.position; - const [trackWidth, trackHeight] = trackInfo.dimensions; - const startX = trackX; - const endX = trackX + trackWidth; - const circular = tm.spec().layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const cx = trackWidth / 2; - const cy = trackHeight / 2; - const rowCategories = (_e = tm.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = trackHeight / rowCategories.length; - if (!isStringArray(rowCategories)) { - return; - } - const scale = tm.getChannelScale("y"); - const domain = tm.getChannelDomainArray("y"); - if (!scale || !domain || !isNumberArray(domain)) { - return; - } - if (circular && rowHeight / trackHeight * trackRingSize <= 20 || !circular && rowHeight <= 20) { - return; - } - const graphics = trackInfo.pBackground; - const strokeWidth = theme.axis.gridStrokeWidth; - rowCategories.forEach((rowCategory) => { - const rowPosition = tm.encodedValue("row", rowCategory); - const assignedHeight = circular ? rowHeight / trackHeight * trackRingSize : rowHeight; - const tickCount = Math.max(Math.ceil(assignedHeight / 40), 1); - let ticks = scale.ticks(tickCount).filter((v) => domain[0] <= v && v <= domain[1]); - if (ticks.length === 1) { - ticks = scale.ticks(tickCount + 1).filter((v) => domain[0] <= v && v <= domain[1]); - } - if (!circular) { - graphics.lineStyle( - strokeWidth, - colorToHex(theme.axis.gridColor), - 1, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - ticks.forEach((value) => { - var _a2; - const y = trackY + rowPosition + rowHeight - scale(value); - if (theme.axis.gridStrokeType === "solid") { - graphics.moveTo(startX, y); - graphics.lineTo(endX, y); - } else if (theme.axis.gridStrokeType === "dashed") { - const [line, gap] = (_a2 = theme.axis.gridStrokeDash) != null ? _a2 : [1, 1]; - for (let i = startX; i < endX; i += line + gap) { - graphics.moveTo(i, y); - graphics.lineTo(i + line, y); - } - } - }); - } else { - ticks.forEach((value) => { - const y = scale(value); - const midR = trackOuterRadius - (rowPosition + rowHeight - y) / trackHeight * trackRingSize; - const farR = midR + strokeWidth / 2; - const nearR = midR - strokeWidth / 2; - const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle); - const startRad = valueToRadian(0, trackWidth, startAngle, endAngle); - const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle); - graphics.lineStyle( - strokeWidth, - colorToHex("black"), - 0, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - graphics.beginFill(colorToHex(theme.axis.gridColor), 1); - graphics.moveTo(trackX + sPos.x, trackY + sPos.y); - graphics.arc(trackX + cx, trackY + cy, nearR, startRad, endRad, true); - graphics.arc(trackX + cx, trackY + cy, farR, endRad, startRad, false); - graphics.closePath(); - }); - } - }); -} -const DEFAULT_TEXT_STYLE = { - color: "black", - size: 10, - fontFamily: "Arial", - fontWeight: "normal", - stroke: "#ffffff", - strokeThickness: 0 -}; -function getTextStyle(style = {}) { - const merged = { ...DEFAULT_TEXT_STYLE, ...style }; - const pixiTextStyle = { - fontSize: `${merged.size}px`, - fontFamily: merged.fontFamily, - fontWeight: merged.fontWeight === "light" ? "lighter" : merged.fontWeight, - fill: merged.color, - lineJoin: "round", - stroke: merged.stroke, - strokeThickness: merged.strokeThickness - }; - return pixiTextStyle; -} -function drawCircularTitle(HGC, trackInfo, tile, model, theme) { - var _a, _b, _c; - const spec = model.spec(); - const { title: title2 } = spec; - if (spec.layout !== "circular") { - return; - } - if (!title2) { - return; - } - const [tw, th] = trackInfo.dimensions; - const trackOuterRadius = (_a = spec.outerRadius) != null ? _a : 300; - const startAngle = (_b = spec.startAngle) != null ? _b : 0; - const endAngle = (_c = spec.endAngle) != null ? _c : 360; - const cx = tw / 2; - const cy = th / 2; - const g = tile.graphics; - const titleR = trackOuterRadius - 1; - const padding = 1; - const pos = cartesianToPolar(padding, tw, titleR, cx, cy, startAngle, endAngle); - const styleConfig = getTextStyle({ - color: theme.track.titleColor, - size: 12, - // `theme.track.titleFontSize` seems to use much larger fonts - fontFamily: theme.axis.labelFontFamily, - // TODO: support - fontWeight: theme.axis.labelFontWeight - // TODO: support - }); - const textGraphic = new HGC.libraries.PIXI.Text(title2, styleConfig); - textGraphic.anchor.x = 1; - textGraphic.anchor.y = 0.5; - textGraphic.position.x = pos.x; - textGraphic.position.y = pos.y; - textGraphic.resolution = 4; - const txtStyle = new HGC.libraries.PIXI.TextStyle(styleConfig); - const metric = HGC.libraries.PIXI.TextMetrics.measureText(textGraphic.text, txtStyle); - const txtWidth = metric.width / (2 * titleR * Math.PI) * tw * 360 / (endAngle - startAngle); - const scaledStartX = padding; - const scaledEndX = padding + txtWidth; - const ropePoints = []; - for (let i = scaledEndX; i >= scaledStartX; i -= txtWidth / 10) { - const p = cartesianToPolar(i, tw, titleR - metric.height / 2, cx, cy, startAngle, endAngle); - ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y)); - } - const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle); - const endRad = valueToRadian(scaledEndX + padding, tw, startAngle, endAngle); - g.lineStyle(1, colorToHex("red"), 0, 0.5); - g.beginFill(colorToHex(theme.track.titleBackground), 0.5); - g.moveTo(pos.x, pos.y); - g.arc(cx, cy, titleR - metric.height, startRad, endRad, true); - g.arc(cx, cy, titleR, endRad, startRad, false); - g.closePath(); - textGraphic.updateText(); - const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints); - g.addChild(rope); -} -function drawChartOutlines(trackInfo, tm, theme) { - var _a, _b, _c, _d; - const g = trackInfo.pBorder; - const [l, t] = trackInfo.position; - const [w, h] = trackInfo.dimensions; - g.lineStyle( - (_b = (_a = tm.spec().style) == null ? void 0 : _a.outlineWidth) != null ? _b : 1, - // TODO: outline not working - colorToHex((_d = (_c = tm.spec().style) == null ? void 0 : _c.outline) != null ? _d : theme.track.outline), - 1, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - g.beginFill(colorToHex("white"), 0); - g.drawRect(l, t, w, h); - const x = tm.spec().x; - g.lineStyle( - 1, - colorToHex(theme.axis.baselineColor), - 1, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - if (IsChannelDeep(x) && x.axis === "top") { - g.moveTo(l, t); - g.lineTo(l + w, t); - } else if (IsChannelDeep(x) && x.axis === "bottom") { - g.moveTo(l, t + h); - g.lineTo(l + w, t + h); - } -} -function drawColorLegend(HGC, trackInfo, _tile, model, theme) { - if (!trackInfo.gLegend) { - return; - } - trackInfo.gLegend.selectAll(".brush").remove(); - const spec = model.spec(); - const offset = { offsetRight: 0 }; - if (IsChannelDeep(spec.color) && spec.color.legend) { - switch (spec.color.type) { - case "nominal": - drawColorLegendCategories(HGC, trackInfo, _tile, model, theme); - break; - case "quantitative": - drawColorLegendQuantitative(HGC, trackInfo, _tile, model, theme, "color", offset); - break; - } - } - if (IsChannelDeep(spec.stroke) && spec.stroke.legend) { - switch (spec.stroke.type) { - case "quantitative": - drawColorLegendQuantitative(HGC, trackInfo, _tile, model, theme, "stroke", offset); - break; - } - } -} -function drawColorLegendQuantitative(HGC, trackInfo, _tile, model, theme, channelKey, offset) { - const spec = model.spec(); - const channel = spec[channelKey]; - if (!IsChannelDeep(channel) || channel.type !== "quantitative" || !channel.legend) { - return; - } - const [trackX, trackY] = trackInfo.position; - const [trackWidth, trackHeight] = trackInfo.dimensions; - const legendWidth = 80; - const legendHeight = trackHeight - 2 > 110 ? 110 : Math.max(trackHeight - 2, 40 - 2); - const colorBarDim = { - top: 10, - left: 55, - width: 20, - height: legendHeight - 20 - }; - const legendX = trackX + trackWidth - legendWidth - 1 - offset.offsetRight; - const legendY = trackY + 1; - const colorScale = model.getChannelScale(channelKey); - const colorDomain = model.getChannelDomainArray(channelKey); - if (!colorScale || !colorDomain) { - return; - } - const graphics = trackInfo.pBorder; - graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity); - graphics.lineStyle( - 1, - colorToHex(theme.legend.backgroundStroke), - theme.legend.backgroundOpacity, - // alpha - 0 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - graphics.drawRect(legendX, legendY, legendWidth, legendHeight); - if (channel.title) { - const titleStr = channel.title; - const labelTextStyle2 = getTextStyle({ - color: theme.legend.labelColor, - size: theme.legend.labelFontSize, - fontWeight: theme.legend.labelFontWeight, - fontFamily: theme.legend.labelFontFamily - }); - const textGraphic = new HGC.libraries.PIXI.Text(titleStr, { - ...labelTextStyle2, - fontWeight: "bold" - }); - textGraphic.anchor.x = 0; - textGraphic.anchor.y = 0; - textGraphic.position.x = legendX + 10; - textGraphic.position.y = legendY + 10; - const textStyleObj = new HGC.libraries.PIXI.TextStyle({ ...labelTextStyle2, fontWeight: "bold" }); - const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(titleStr, textStyleObj); - graphics.addChild(textGraphic); - colorBarDim.top += textMetrics.height + 4; - colorBarDim.height -= textMetrics.height + 4; - } - const [startValue, endValue] = colorDomain; - const extent = endValue - startValue; - const scaleOffset = IsChannelDeep(channel) && channel.scaleOffset ? channel.scaleOffset : [0, 1]; - [...Array(colorBarDim.height).keys()].forEach((y) => { - let value; - const scaleOffsetSorted = Array.from(scaleOffset).sort(); - if (y / colorBarDim.height >= scaleOffsetSorted[1]) { - value = endValue; - } else if (y / colorBarDim.height <= scaleOffsetSorted[0]) { - value = startValue; - } else { - const s1 = scaleLinear().domain([colorBarDim.height * scaleOffsetSorted[0], colorBarDim.height * scaleOffsetSorted[1]]).range([0, colorBarDim.height]); - const s2 = scaleLinear().domain([0, colorBarDim.height]).range([startValue, endValue]); - value = s2(s1(y)); - } - graphics.beginFill( - colorToHex(colorScale(value)), - 1 - // alpha - ); - graphics.lineStyle( - 1, - colorToHex(theme.legend.backgroundStroke), - 0, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - graphics.drawRect( - legendX + colorBarDim.left, - legendY + colorBarDim.top + colorBarDim.height - y, - colorBarDim.width, - 1 - ); - }); - const BRUSH_HEIGHT = 4; - trackInfo.colorBrushes = trackInfo.gLegend.append("g").attr("class", channelKey).selectAll(`.brush`).data( - scaleOffset.map((d, i) => { - return { y: d, id: i }; - }) - ).enter().append("rect").attr("class", `brush`).attr("pointer-events", "all").attr("cursor", "ns-resize").attr( - "transform", - (d) => `translate(${legendX + colorBarDim.left}, ${legendY + colorBarDim.top - BRUSH_HEIGHT / 2 + colorBarDim.height - colorBarDim.height * d.y})` - ).attr("width", `${colorBarDim.width}px`).attr("height", `${BRUSH_HEIGHT}px`).attr("fill", "lightgrey").attr("stroke", "black").attr("stroke-width", "0.5px").call( - HGC.libraries.d3Drag.drag().on("start", (event) => { - trackInfo.startEvent = event.sourceEvent; - }).on("drag", (event, d) => { - if (channel && channel.scaleOffset) { - const endEvent = event.sourceEvent; - const diffY = trackInfo.startEvent.clientY - endEvent.clientY; - const newScaleOffset = [channel.scaleOffset[0], channel.scaleOffset[1]]; - if (d.id === 0) { - newScaleOffset[0] += diffY / colorBarDim.height; - } else { - newScaleOffset[1] += diffY / colorBarDim.height; - } - newScaleOffset[0] = Math.min(1, Math.max(0, newScaleOffset[0])); - newScaleOffset[1] = Math.min(1, Math.max(0, newScaleOffset[1])); - trackInfo.updateScaleOffsetFromOriginalSpec(spec._renderingId, newScaleOffset, channelKey); - trackInfo.shareScaleOffsetAcrossTracksAndTiles(newScaleOffset, channelKey); - trackInfo.draw(); - trackInfo.startEvent = event.sourceEvent; - } - }) - ); - const tickCount = Math.max(Math.ceil(colorBarDim.height / 30), 2); - let ticks = colorScale.ticks(tickCount).filter((v) => colorDomain[0] <= v && v <= colorDomain[1]); - if (ticks.length === 1) { - ticks = colorScale.ticks(tickCount + 1).filter((v) => colorDomain[0] <= v && v <= colorDomain[1]); - } - const TICK_STROKE_SIZE = 1; - graphics.lineStyle( - TICK_STROKE_SIZE, - colorToHex(theme.legend.tickColor), - 1, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - const labelTextStyle = getTextStyle({ - color: theme.legend.labelColor, - size: theme.legend.labelFontSize, - fontWeight: theme.legend.labelFontWeight, - fontFamily: theme.legend.labelFontFamily - }); - const tickEnd = legendX + colorBarDim.left; - ticks.forEach((value) => { - let y = legendY + colorBarDim.top + colorBarDim.height - (value - startValue) / extent * colorBarDim.height; - if (y === legendY + colorBarDim.top) { - y += TICK_STROKE_SIZE / 2; - } else if (y === legendY + colorBarDim.top + colorBarDim.height) { - y -= TICK_STROKE_SIZE / 2; - } - graphics.moveTo(tickEnd - 3, y); - graphics.lineTo(tickEnd, y); - const textGraphic = new HGC.libraries.PIXI.Text(value, labelTextStyle); - textGraphic.anchor.x = 1; - textGraphic.anchor.y = 0.5; - textGraphic.position.x = tickEnd - 6; - textGraphic.position.y = y; - graphics.addChild(textGraphic); - }); - offset.offsetRight = trackWidth - legendX; -} -function drawColorLegendCategories(HGC, track, _tile, tm, theme) { - var _a, _b, _c, _d, _e; - const spec = tm.spec(); - if (!IsChannelDeep(spec.color) || spec.color.type !== "nominal" || !spec.color.legend) { - return; - } - const colorCategories = (_a = tm.getChannelDomainArray("color")) != null ? _a : ["___SINGLE_COLOR___"]; - if (colorCategories.length === 0) { - return; - } - const domain = spec.color.domain; - const range = spec.color.range; - const existingLegends = track.displayedLegends; - const toStr = (_) => { - return typeof _ === "string" ? _ : _.join(); - }; - if (existingLegends.find((d) => toStr(d.domain) === toStr(domain) && toStr(d.range) === toStr(range))) { - return; - } else { - existingLegends.push({ domain, range }); - } - const graphics = track.pBorder; - const paddingX = 10; - const paddingY = 4; - let cumY = paddingY; - let maxWidth = 0; - const recipe = []; - const labelTextStyle = getTextStyle({ - color: theme.legend.labelColor, - size: theme.legend.labelFontSize, - fontWeight: theme.legend.labelFontWeight, - fontFamily: theme.legend.labelFontFamily - }); - if ((_b = spec.style) == null ? void 0 : _b.inlineLegend) { - colorCategories.map((d) => d).reverse().forEach((category) => { - if (maxWidth > track.dimensions[0]) { - return; - } - const color2 = tm.encodedValue("color", category); - const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle); - textGraphic.anchor.x = 1; - textGraphic.anchor.y = 0; - textGraphic.position.x = track.position[0] + track.dimensions[0] - maxWidth - paddingX; - textGraphic.position.y = track.position[1] + paddingY; - graphics.addChild(textGraphic); - const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle); - const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj); - if (cumY < textMetrics.height + paddingY * 3) { - cumY = textMetrics.height + paddingY * 3; - } - recipe.push({ - x: track.position[0] + track.dimensions[0] - textMetrics.width - maxWidth - paddingX * 2, - y: track.position[1] + paddingY + textMetrics.height / 2, - color: color2 - }); - maxWidth += textMetrics.width + paddingX * 3; - }); - } else { - if ((_c = spec.style) == null ? void 0 : _c.legendTitle) { - const textGraphic = new HGC.libraries.PIXI.Text((_d = spec.style) == null ? void 0 : _d.legendTitle, { - ...labelTextStyle, - fontWeight: "bold" - }); - textGraphic.anchor.x = 1; - textGraphic.anchor.y = 0; - textGraphic.position.x = track.position[0] + track.dimensions[0] - paddingX; - textGraphic.position.y = track.position[1] + cumY; - const textStyleObj = new HGC.libraries.PIXI.TextStyle({ ...labelTextStyle, fontWeight: "bold" }); - const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText((_e = spec.style) == null ? void 0 : _e.legendTitle, textStyleObj); - graphics.addChild(textGraphic); - cumY += textMetrics.height + paddingY * 2; - } - colorCategories.forEach((category) => { - if (cumY > track.dimensions[1]) { - return; - } - const color2 = tm.encodedValue("color", category); - const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle); - textGraphic.anchor.x = 1; - textGraphic.anchor.y = 0; - textGraphic.position.x = track.position[0] + track.dimensions[0] - paddingX; - textGraphic.position.y = track.position[1] + cumY; - graphics.addChild(textGraphic); - const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle); - const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj); - if (maxWidth < textMetrics.width + paddingX * 3) { - maxWidth = textMetrics.width + paddingX * 3; - } - recipe.push({ - x: track.position[0] + track.dimensions[0] - textMetrics.width - paddingX * 2, - y: track.position[1] + cumY + textMetrics.height / 2, - color: color2 - }); - cumY += textMetrics.height + paddingY * 2; - }); - } - graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity); - graphics.lineStyle( - 1, - colorToHex(theme.legend.backgroundStroke), - theme.legend.backgroundOpacity, - // alpha - 0 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - graphics.drawRect( - track.position[0] + track.dimensions[0] - maxWidth - 1, - track.position[1] + 1, - maxWidth, - cumY - paddingY - ); - recipe.forEach((r) => { - graphics.lineStyle( - 1, - colorToHex("black"), - 0, - // alpha - 0 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - graphics.beginFill(colorToHex(r.color), 1); - graphics.drawCircle(r.x, r.y, 4); - }); -} -function drawRowLegend(HGC, trackInfo, _tile, tm, theme) { - var _a; - const spec = tm.spec(); - if (!IsChannelDeep(spec.row) || spec.row.type !== "nominal" || !spec.row.legend) { - return; - } - const rowCategories = (_a = tm.getChannelDomainArray("row")) != null ? _a : ["___SINGLE_ROW___"]; - if (rowCategories.length === 0) { - return; - } - const graphics = trackInfo.pBorder; - const paddingX = 4; - const paddingY = 2; - const labelTextStyle = getTextStyle({ - color: theme.legend.labelColor, - size: theme.legend.labelFontSize, - fontWeight: theme.legend.labelFontWeight, - fontFamily: theme.legend.labelFontFamily - }); - rowCategories.forEach((category) => { - const rowPosition = tm.encodedValue("row", category); - const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle); - textGraphic.anchor.x = 0; - textGraphic.anchor.y = 0; - textGraphic.position.x = trackInfo.position[0] + paddingX; - textGraphic.position.y = trackInfo.position[1] + rowPosition + paddingY; - graphics.addChild(textGraphic); - const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle); - const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj); - graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity); - graphics.lineStyle( - 1, - colorToHex(theme.legend.backgroundStroke), - 0, - // alpha - 0 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - graphics.drawRect( - trackInfo.position[0] + 1, - trackInfo.position[1] + rowPosition + 1, - textMetrics.width + paddingX * 2, - textMetrics.height + paddingY * 2 - ); - }); -} -const EXTENT_TICK_SIZE = 8; -const TICK_SIZE = 6; -function drawLinearYAxis(HGC, trackInfo, _tile, model, theme) { - var _a; - const spec = model.spec(); - const CIRCULAR = spec.layout === "circular"; - const yDomain = model.getChannelDomainArray("y"); - const yRange = model.getChannelRangeArray("y"); - if (CIRCULAR) { - return; - } - if (!model.isShowYAxis() || !yDomain || !yRange) { - return; - } - if (!isNumberArray(yDomain)) { - return; - } - const [tw, th] = trackInfo.dimensions; - const [tx, ty] = trackInfo.position; - const rowCategories = (_a = model.getChannelDomainArray("row")) != null ? _a : ["___SINGLE_ROW___"]; - if (!isStringArray(rowCategories)) { - return; - } - const rowHeight = th / rowCategories.length; - if (rowHeight <= 20) { - return; - } - const yChannel = model.spec().y; - const isLeft = IsChannelDeep(yChannel) && "axis" in yChannel && yChannel.axis === "right" ? false : true; - const yScale = scaleLinear().domain(yDomain).range(yRange); - const graphics = trackInfo.pBorder; - rowCategories.forEach((category) => { - const rowPosition = model.encodedValue("row", category); - const dx = isLeft ? tx : tx + tw; - const dy = ty + rowPosition; - graphics.lineStyle( - 1, - colorToHex(theme.axis.baselineColor), - 1, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - graphics.moveTo(dx, dy); - graphics.lineTo(dx, dy + rowHeight); - const tickCount = Math.max(Math.ceil(rowHeight / 40), 1); - let ticks = yScale.ticks(tickCount).filter((v) => yDomain[0] <= v && v <= yDomain[1]); - if (ticks.length === 1) { - ticks = yScale.ticks(tickCount + 1).filter((v) => yDomain[0] <= v && v <= yDomain[1]); - } - graphics.lineStyle( - 1, - colorToHex(theme.axis.tickColor), - 1, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - let tickEnd = isLeft ? dx + TICK_SIZE : dx - TICK_SIZE; - ticks.forEach((t) => { - const y = yScale(t); - graphics.moveTo(dx, dy + rowHeight - y); - graphics.lineTo(tickEnd, dy + rowHeight - y); - }); - tickEnd = isLeft ? dx + EXTENT_TICK_SIZE : dx - EXTENT_TICK_SIZE; - graphics.moveTo(dx, dy); - graphics.lineTo(tickEnd, dy); - graphics.moveTo(dx, dy + rowHeight); - graphics.lineTo(tickEnd, dy + rowHeight); - const styleConfig = getTextStyle({ - color: theme.axis.labelColor, - size: theme.axis.labelFontSize, - fontFamily: theme.axis.labelFontFamily, - fontWeight: theme.axis.labelFontWeight - }); - ticks.forEach((t) => { - const y = yScale(t); - tickEnd = isLeft ? dx + TICK_SIZE * 2 : dx - TICK_SIZE * 2; - const textGraphic = new HGC.libraries.PIXI.Text(t, styleConfig); - textGraphic.anchor.x = isLeft ? 0 : 1; - textGraphic.anchor.y = y === 0 ? 0.9 : 0.5; - textGraphic.position.x = tickEnd; - textGraphic.position.y = dy + rowHeight - y; - if (spec.orientation === "vertical") { - textGraphic.anchor.x = isLeft ? 1 : 0; - textGraphic.scale.x *= -1; - } - graphics.addChild(textGraphic); - }); - }); -} -function drawCircularYAxis(HGC, trackInfo, tile, model, theme) { - var _a, _b, _c, _d, _e; - const spec = model.spec(); - const CIRCULAR = spec.layout === "circular"; - const yDomain = model.getChannelDomainArray("y"); - const yRange = model.getChannelRangeArray("y"); - if (!CIRCULAR) { - return; - } - if (!model.isShowYAxis() || !yDomain || !yRange) { - return; - } - if (!isNumberArray(yDomain)) { - return; - } - const [tw, th] = trackInfo.dimensions; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const cx = tw / 2; - const cy = th / 2; - const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = th / rowCategories.length; - if (rowHeight / th * trackRingSize <= 20) { - return; - } - const yChannel = model.spec().y; - const isLeft = IsChannelDeep(yChannel) && "axis" in yChannel && yChannel.axis === "right" ? false : true; - const yScale = scaleLinear().domain(yDomain).range(yRange); - const graphics = tile.graphics; - rowCategories.forEach((category) => { - const rowPosition = model.encodedValue("row", category); - const innerR = trackOuterRadius - (rowPosition + rowHeight) / th * trackRingSize; - const outerR = trackOuterRadius - rowPosition / th * trackRingSize; - const innerPos = cartesianToPolar(isLeft ? 0 : tw, tw, innerR, cx, cy, startAngle, endAngle); - const outerPos = cartesianToPolar(isLeft ? 0 : tw, tw, outerR, cx, cy, startAngle, endAngle); - graphics.lineStyle( - 1, - colorToHex(theme.axis.baselineColor), - 1, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - graphics.moveTo(innerPos.x, innerPos.y); - graphics.lineTo(outerPos.x, outerPos.y); - const SCALED_TICK_SIZE = (r) => TICK_SIZE * tw / 2 / Math.PI / r; - const SCALED_EXTENT_TICK_SIZE = (r) => EXTENT_TICK_SIZE * tw / 2 / Math.PI / r; - const axisHeight = rowHeight / th * trackRingSize; - const tickCount = Math.max(Math.ceil(axisHeight / 40), 1); - let ticks = yScale.ticks(tickCount).filter((v) => yDomain[0] <= v && v <= yDomain[1]); - if (ticks.length === 1) { - ticks = yScale.ticks(tickCount + 1).filter((v) => yDomain[0] <= v && v <= yDomain[1]); - } - graphics.lineStyle( - 1, - colorToHex(theme.axis.tickColor), - 1, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - ticks.forEach((t) => { - const y = yScale(t); - const currentR = trackOuterRadius - (rowPosition + rowHeight - y) / th * trackRingSize; - const scaledStartX = isLeft ? 0 : tw - SCALED_TICK_SIZE(currentR); - const scaledEndX = isLeft ? SCALED_TICK_SIZE(currentR) : tw; - const pos = cartesianToPolar(scaledStartX, tw, currentR, cx, cy, startAngle, endAngle); - const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle); - const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle); - graphics.moveTo(pos.x, pos.y); - graphics.arc(cx, cy, currentR, startRad, endRad, true); - graphics.arc(cx, cy, currentR, endRad, startRad, false); - graphics.closePath(); - }); - { - const scaledStartX = isLeft ? 0 : tw - SCALED_EXTENT_TICK_SIZE(trackInnerRadius); - const scaledEndX = isLeft ? SCALED_EXTENT_TICK_SIZE(trackInnerRadius) : tw; - const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle); - const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle); - graphics.moveTo(innerPos.x, innerPos.y); - graphics.arc(cx, cy, trackInnerRadius, startRad, endRad, true); - graphics.arc(cx, cy, trackInnerRadius, endRad, startRad, false); - graphics.closePath(); - } - { - const scaledStartX = isLeft ? 0 : tw - SCALED_EXTENT_TICK_SIZE(trackOuterRadius); - const scaledEndX = isLeft ? SCALED_EXTENT_TICK_SIZE(trackOuterRadius) : tw; - const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle); - const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle); - graphics.moveTo(outerPos.x, outerPos.y); - graphics.arc(cx, cy, trackOuterRadius, startRad, endRad, true); - graphics.arc(cx, cy, trackOuterRadius, endRad, startRad, false); - graphics.closePath(); - } - ticks.forEach((t) => { - const y = yScale(t); - const currentR = trackOuterRadius - (rowPosition + rowHeight - y) / th * trackRingSize; - const pos = cartesianToPolar(SCALED_TICK_SIZE(currentR) * 2, tw, currentR, cx, cy, startAngle, endAngle); - const styleConfig = getTextStyle({ - color: theme.axis.labelColor, - size: theme.axis.labelFontSize, - fontFamily: theme.axis.labelFontFamily, - fontWeight: theme.axis.labelFontWeight - }); - const textGraphic = new HGC.libraries.PIXI.Text(t, styleConfig); - textGraphic.anchor.x = isLeft ? 1 : 0; - textGraphic.anchor.y = 0.5; - textGraphic.position.x = pos.x; - textGraphic.position.y = pos.y; - textGraphic.resolution = 4; - const txtStyle = new HGC.libraries.PIXI.TextStyle(styleConfig); - const metric = HGC.libraries.PIXI.TextMetrics.measureText(textGraphic.text, txtStyle); - const txtWidth = metric.width / (2 * currentR * Math.PI) * tw * 360 / (endAngle - startAngle); - const scaledStartX = isLeft ? SCALED_TICK_SIZE(currentR) * 2 : tw - SCALED_TICK_SIZE(currentR) * 2 - txtWidth; - const scaledEndX = isLeft ? SCALED_TICK_SIZE(currentR) * 2 + txtWidth : tw - SCALED_TICK_SIZE(currentR) * 2; - const ropePoints = []; - for (let i = scaledEndX; i >= scaledStartX; i -= txtWidth / 10) { - const p = cartesianToPolar(i, tw, currentR, cx, cy, startAngle, endAngle); - ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y)); - } - textGraphic.updateText(); - const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints); - graphics.addChild(rope); - }); - }); -} -function drawCircularOutlines(trackInfo, tm, theme) { - var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; - const spec = tm.spec(); - const [l, t] = trackInfo.position; - const [trackWidth, trackHeight] = trackInfo.dimensions; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const cx = l + trackWidth / 2; - const cy = t + trackHeight / 2; - const posStartInner = cartesianToPolar(0, trackWidth, trackInnerRadius, cx, cy, startAngle, endAngle); - const startRad = valueToRadian(0, trackWidth, startAngle, endAngle); - const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle); - const g = trackInfo.pBackground; - if (!(spec.layout === "circular" && spec.mark === "withinLink")) { - g.lineStyle( - ((_e = spec.style) == null ? void 0 : _e.outlineWidth) ? ((_f = spec.style) == null ? void 0 : _f.outlineWidth) / 2.5 : 0, - colorToHex((_h = (_g = spec.style) == null ? void 0 : _g.outline) != null ? _h : "#DBDBDB"), - 1, - // 0.4, // alpha - 1 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - g.beginFill( - colorToHex((_j = (_i = tm.spec().style) == null ? void 0 : _i.background) != null ? _j : theme.track.background), - (_l = (_k = tm.spec().style) == null ? void 0 : _k.backgroundOpacity) != null ? _l : !theme.track.background || theme.track.background === "transparent" ? 0 : 1 - ); - g.moveTo(posStartInner.x, posStartInner.y); - g.arc(cx, cy, trackInnerRadius, startRad, endRad, true); - g.arc(cx, cy, trackOuterRadius, endRad, startRad, false); - g.closePath(); - } - if (IsChannelDeep(spec.x) && spec.x.axis === "top") { - g.lineStyle( - 0.5, - colorToHex("black"), - 0, - // 1, // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - g.beginFill(colorToHex("white"), 0); - g.moveTo(posStartInner.x, posStartInner.y); - g.arc(cx, cy, trackOuterRadius - 0.5, startRad, endRad, true); - g.arc(cx, cy, trackOuterRadius, endRad, startRad, false); - g.closePath(); - } - g.lineStyle( - 0.5, - colorToHex("black"), - 0, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - g.beginFill(colorToHex("white"), 0); - g.moveTo(cx, cy); - g.arc(cx, cy, trackOuterRadius + 3, startRad, endRad, false); - g.closePath(); - g.lineStyle( - 1, - colorToHex("#DBDBDB"), - 0, - // alpha - 0 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - g.beginFill(colorToHex("white"), 0); - g.drawCircle(cx, cy, trackInnerRadius - 1); -} -function drawBackground(trackInfo, tm, theme) { - var _a, _b, _c, _d, _e, _f; - const [l, t] = trackInfo.position; - const [w, h] = trackInfo.dimensions; - const g = trackInfo.pBackground; - if (((_a = tm.spec().style) == null ? void 0 : _a.background) || theme.track.background && theme.track.background !== "transparent") { - g.clear(); - const bg = (_c = (_b = tm.spec().style) == null ? void 0 : _b.background) != null ? _c : theme.track.background; - const alpha = isUndefined((_d = tm.spec().style) == null ? void 0 : _d.backgroundOpacity) ? 1 : (_e = tm.spec().style) == null ? void 0 : _e.backgroundOpacity; - g.lineStyle( - 1, - colorToHex("white"), - 0, - // alpha - 0 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - g.beginFill(colorToHex(bg), alpha); - g.drawRect(l, t, w, h); - } - if (theme.track.alternatingBackground && theme.track.alternatingBackground !== "transparent") { - const spec = tm.spec(); - if (!IsChannelDeep(spec.row) || spec.row.type !== "nominal") { - return; - } - const rowCategories = (_f = tm.getChannelDomainArray("row")) != null ? _f : ["___SINGLE_ROW___"]; - if (rowCategories.length === 0) { - return; - } - rowCategories.forEach((category, i) => { - var _a2, _b2, _c2, _d2; - if (i % 2 === 0) { - return; - } - const rowPosition = tm.encodedValue("row", category); - const bg = (_b2 = (_a2 = tm.spec().style) == null ? void 0 : _a2.background) != null ? _b2 : theme.track.alternatingBackground; - const alpha = isUndefined((_c2 = tm.spec().style) == null ? void 0 : _c2.backgroundOpacity) ? 1 : (_d2 = tm.spec().style) == null ? void 0 : _d2.backgroundOpacity; - g.lineStyle( - 1, - colorToHex("white"), - 0, - // alpha - 0 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - g.beginFill(colorToHex(bg), alpha); - g.drawRect(trackInfo.position[0], trackInfo.position[1] + rowPosition, w, h / rowCategories.length); - }); - } -} -function drawBetweenLink(g, trackInfo, model) { - var _a, _b, _c, _d, _e; - const spec = model.spec(); - if (!spec.width || !spec.height) { - console.warn("Size of a track is not properly determined, so visual mark cannot be rendered"); - return; - } - const data2 = model.data(); - const [trackWidth, trackHeight] = trackInfo.dimensions; - const circular = spec.layout === "circular"; - const trackInnerRadius = (_a = spec.innerRadius) != null ? _a : 220; - const trackOuterRadius = (_b = spec.outerRadius) != null ? _b : 300; - const startAngle = (_c = spec.startAngle) != null ? _c : 0; - const endAngle = (_d = spec.endAngle) != null ? _d : 360; - const trackRingSize = trackOuterRadius - trackInnerRadius; - const tcx = trackWidth / 2; - const tcy = trackHeight / 2; - const rowCategories = (_e = model.getChannelDomainArray("row")) != null ? _e : ["___SINGLE_ROW___"]; - const rowHeight = trackHeight / rowCategories.length; - rowCategories.forEach((rowCategory) => { - const rowPosition = model.encodedValue("row", rowCategory); - data2.filter( - (d) => !getValueUsingChannel(d, spec.row) || getValueUsingChannel(d, spec.row) === rowCategory - ).forEach((d) => { - var _a2, _b2; - let x = model.encodedPIXIProperty("x", d); - let xe = model.encodedPIXIProperty("xe", d); - let x1 = model.encodedPIXIProperty("x1", d); - let x1e = model.encodedPIXIProperty("x1e", d); - const y = model.encodedPIXIProperty("y", d); - const stroke = model.encodedPIXIProperty("stroke", d); - const strokeWidth = model.encodedPIXIProperty("strokeWidth", d); - const color2 = model.encodedPIXIProperty("color", d); - const opacity = model.encodedPIXIProperty("opacity", d); - if (typeof xe !== "undefined") { - [x, xe] = [x, xe].sort((a, b) => a - b); - } - if (typeof x1 !== "undefined" && typeof x1e !== "undefined") { - [x1, x1e] = [x1, x1e].sort((a, b) => a - b); - } - const isRibon = typeof xe !== "undefined" && typeof x1 !== "undefined" && typeof x1e !== "undefined" && // This means the strokeWidth of a band is too small, so we just need to draw a line instead - Math.abs(x - xe) > 0.1 && Math.abs(x1 - x1e) > 0.1; - if (!isRibon && xe === void 0 && !Is2DTrack(spec)) { - if (x1 === void 0 && x1e === void 0) { - return; - } - xe = x1 !== void 0 ? x1 : x1e; - } - if (!isRibon && Math.abs(x - xe) <= 0.1 && Math.abs(x1 - x1e) <= 0.1) { - x = (x + xe) / 2; - xe = (x1 + x1e) / 2; - } - g.lineStyle( - strokeWidth, - colorToHex(stroke), - opacity, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - if (isRibon) { - g.beginFill(color2 === "none" ? colorToHex("white") : colorToHex(color2), color2 === "none" ? 0 : opacity); - let [_x1, _x2, _x3, _x4] = [x, xe, x1, x1e]; - [_x1, _x2] = [_x1, _x2].sort((a, b) => a - b); - [_x3, _x4] = [_x3, _x4].sort((a, b) => a - b); - if (_x1 > trackWidth || _x4 < 0 || Math.abs(_x4 - _x1) < 0.5) { - return; - } - if (circular) { - if (_x1 < 0 || _x4 > trackWidth) { - return; - } - const r = trackOuterRadius - rowPosition / trackHeight * trackRingSize; - const posX = cartesianToPolar(_x1, trackWidth, r, tcx, tcy, startAngle, endAngle); - const posXE = cartesianToPolar(_x2, trackWidth, r, tcx, tcy, startAngle, endAngle); - const posX1 = cartesianToPolar(_x3, trackWidth, r, tcx, tcy, startAngle, endAngle); - const posX1E = cartesianToPolar(_x4, trackWidth, r, tcx, tcy, startAngle, endAngle); - g.moveTo(posX.x, posX.y); - g.bezierCurveTo(tcx, tcy, tcx, tcy, posX1E.x, posX1E.y); - g.arc( - tcx, - tcy, - trackOuterRadius, - positionToRadian(posX1E.x, posX1E.y, tcx, tcy), - positionToRadian(posX1.x, posX1.y, tcx, tcy), - false - ); - g.bezierCurveTo(tcx, tcy, tcx, tcy, posXE.x, posXE.y); - g.arc( - tcx, - tcy, - trackOuterRadius, - positionToRadian(posXE.x, posXE.y, tcx, tcy), - positionToRadian(posX.x, posX.y, tcx, tcy), - false - ); - g.endFill(); - } else { - g.moveTo(_x1, rowPosition); - g.lineTo(_x2, rowPosition); - g.lineTo(_x4, rowPosition + rowHeight); - g.lineTo(_x3, rowPosition + rowHeight); - g.lineTo(_x1, rowPosition); - g.closePath(); - } - } else { - if (Is2DTrack(spec)) { - if (((_a2 = spec.style) == null ? void 0 : _a2.linkConnectionType) === "curve") { - g.moveTo(x, 0); - g.bezierCurveTo( - x / 5 * 4, - (rowPosition + rowHeight - y) / 2, - x / 2, - (rowPosition + rowHeight - y) / 5 * 4, - 0, - rowPosition + rowHeight - y - ); - } else if (((_b2 = spec.style) == null ? void 0 : _b2.linkConnectionType) === "straight") { - g.moveTo(x, 0); - g.lineTo(0, rowPosition + rowHeight - y); - } else { - g.moveTo(x, 0); - g.lineTo(x, rowPosition + rowHeight - y); - g.lineTo(0, rowPosition + rowHeight - y); - } - return; - } - if (circular) { - let prevX, prevY; - for (let t = 0; t <= 1; t += 0.02) { - const logodds = (t2) => Math.log(t2 / (1 - t2)); - const movingRadius = (t2) => trackOuterRadius - 1 / (1 + Math.exp(logodds(t2))) * trackRingSize + 3; - const getRadian = (t2, s, e) => ((e - s) * t2 + s) / trackWidth; - const _x = tcx + movingRadius(t) * Math.cos(-getRadian(t, x, xe) * 2 * Math.PI - Math.PI / 2); - const _y = tcy + movingRadius(t) * Math.sin(-getRadian(t, x, xe) * 2 * Math.PI - Math.PI / 2); - if (prevX && prevY) { - g.lineStyle( - strokeWidth, - colorToHex(stroke), - opacity, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - g.moveTo(prevX, prevY); - g.lineTo(_x, _y); - } - prevX = _x; - prevY = _y; - } - return; - } - g.moveTo(xe, rowPosition + rowHeight); - g.lineTo(x, rowPosition); - } - }); - }); -} -const SUPPORTED_CHANNELS = [ - "x", - "xe", - "x1", - "x1e", - "y", - "ye", - "y1", - "y1e", - "color", - "size", - "row", - "stroke", - "strokeWidth", - "opacity", - "text" - // ... -]; -function drawMark(HGC, trackInfo, tile, model) { - if (!HGC || !trackInfo || !tile) { - return; - } - if (model.spec().mark === "brush") { - return; - } - ["x", "x1", "x1e", "xe"].forEach((d) => { - model.setChannelScale(d, trackInfo._xScale); - }); - if (Is2DTrack(model.spec()) || IsVerticalRule(model.spec())) { - const yScale = trackInfo._yScale.copy(); - yScale.range([yScale.range()[1], yScale.range()[0]]); - ["y", "y1", "y1e", "ye"].forEach((d) => { - model.setChannelScale(d, yScale); - }); - } - const [trackWidth, trackHeight] = trackInfo.dimensions; - switch (model.spec().mark) { - case "point": - drawPoint(trackInfo, tile.graphics, model); - break; - case "bar": - drawBar(trackInfo, tile, model); - break; - case "line": - drawLine(tile.graphics, model, trackWidth, trackHeight); - break; - case "area": - drawArea(HGC, trackInfo, tile, model); - break; - case "rect": - drawRect(HGC, trackInfo, tile, model); - break; - case "triangleLeft": - case "triangleRight": - case "triangleBottom": - drawTriangle(tile.graphics, model, trackWidth, trackHeight); - break; - case "text": - drawText(HGC, trackInfo, tile, model); - break; - case "rule": - drawRule(HGC, trackInfo, tile, model); - break; - case "betweenLink": - drawBetweenLink(tile.graphics, trackInfo, model); - break; - case "withinLink": - drawWithinLink(tile.graphics, trackInfo, model); - break; - default: - console.warn("Unsupported mark type"); - break; - } -} -function drawPreEmbellishment(HGC, trackInfo, tile, model, theme) { - if (!HGC || !trackInfo || !tile) { - return; - } - if (model.spec().mark === "brush") { - return; - } - ["x", "x1", "x1e", "xe"].forEach((d) => { - model.setChannelScale(d, trackInfo._xScale); - }); - const isCircular = model.spec().layout === "circular"; - if (isCircular) { - drawCircularOutlines(trackInfo, model, theme); - } else { - drawBackground(trackInfo, model, theme); - drawChartOutlines(trackInfo, model, theme); - } - drawGrid(trackInfo, model, theme); -} -function drawPostEmbellishment(HGC, trackInfo, tile, model, theme) { - if (!HGC || !trackInfo || !tile) { - return; - } - if (model.spec().mark === "brush") { - return; - } - ["x", "x1", "x1e", "xe"].forEach((d) => { - model.setChannelScale(d, trackInfo._xScale); - }); - const isCircular = model.spec().layout === "circular"; - if (isCircular) { - drawCircularYAxis(HGC, trackInfo, tile, model, theme); - drawCircularTitle(HGC, trackInfo, tile, model, theme); - } else { - drawLinearYAxis(HGC, trackInfo, tile, model, theme); - drawRowLegend(HGC, trackInfo, tile, model, theme); - } - drawColorLegend(HGC, trackInfo, tile, model, theme); -} -function resolveSuperposedTracks(track) { - if (IsDataTrack(track) || IsDummyTrack(track)) { - return []; - } - if (!IsOverlaidTrack(track)) { - return [track]; - } - if (track._overlay.length === 0) { - return [{ ...track, superpose: void 0 }]; - } - const { _overlay, ...base } = track; - const resolved = []; - track._overlay.forEach((subSpec, i) => { - const spec = Object.assign({}, base, subSpec); - if (spec.title && i !== 0) { - delete spec.title; - } - resolved.push(spec); - }); - let xAxisPosition = void 0; - resolved.forEach((d) => { - if (IsChannelDeep(d.x) && d.x.axis && !xAxisPosition) { - xAxisPosition = d.x.axis; - } - }); - const corrected = resolved.map((d) => { - return { - ...d, - x: { ...d.x, axis: xAxisPosition } - }; - }); - return corrected; -} -function spreadTracksByData(tracks) { - return [].concat( - ...tracks.map((t) => { - if (IsDataTrack(t) || !IsOverlaidTrack(t) || t._overlay.length <= 1) { - return [t]; - } - if (t._overlay.filter((s) => s.data).length === 0) { - return [t]; - } - if (isIdenticalDataSpec([t.data, ...t._overlay.map((s) => s.data)])) { - return [t]; - } - const base = { ...t, id: void 0, _overlay: void 0 }; - const spread = []; - const original = JSON.parse(JSON.stringify(base)); - original._overlay = []; - t._overlay.forEach((subSpec) => { - if (!original.data) { - original.data = subSpec.data; - } - if (!original.id) { - original.id = subSpec.id; - } - if (!subSpec.data || isIdenticalDataSpec([original.data, subSpec.data])) { - original._overlay.push(subSpec); - return; - } - const spec = Object.assign(JSON.parse(JSON.stringify(base)), subSpec); - spread.push(spec); - }); - const output = original._overlay.length > 0 ? [original, ...spread] : spread; - return output.map((track, i, arr) => { - const overlayOnPreviousTrack = i !== 0; - const y = IsSingleTrack(track) && IsChannelDeep(track.y) && !track.y.axis && overlayOnPreviousTrack ? { ...track.y, axis: i === 1 ? "right" : "none" } : IsSingleTrack(track) ? track.y : void 0; - if (track.title && i !== arr.length - 1 && arr.length !== 1) { - delete track.title; - } - return { ...track, overlayOnPreviousTrack, y }; - }); - }) - ); -} -function isIdenticalDataSpec(specs) { - if (specs.length === 0) { - return false; - } - const definedSpecs = specs.filter((d) => d); - if (definedSpecs.length !== specs.length) { - return false; - } - const keys = Object.keys(definedSpecs[0]).sort(); - let isIdentical = true; - keys.forEach((k) => { - const uniqueProperties = Array.from(new Set(definedSpecs.map((d) => JSON.stringify(d[k])))); - if (uniqueProperties.length !== 1) { - isIdentical = false; - return; - } - }); - return isIdentical; -} -const PREDEFINED_COLOR_STR_MAP = { - viridis: interpolateViridis, - grey: interpolateGreys, - warm: interpolateWarm, - spectral: interpolateSpectral, - cividis: interpolateCividis, - bupu: interpolateBuPu, - rdbu: interpolateRdBu, - hot: interpolateYlOrBr, - pink: interpolateRdPu -}; -function isObject(x) { - return typeof x === "object" && x !== null; -} -function isTabularDataFetcher(dataFetcher) { - return isObject(dataFetcher) && "getTabularData" in dataFetcher; -} -function hasDataTransform(spec, type2) { - var _a; - return ((_a = spec.dataTransform) != null ? _a : []).some((d) => d.type === type2); -} -function getHiGlassColorRange(colorStr = "viridis", step = 100) { - var _a; - const interpolate = (_a = PREDEFINED_COLOR_STR_MAP[colorStr]) != null ? _a : PREDEFINED_COLOR_STR_MAP["viridis"]; - return [...Array(step)].map((_, i) => interpolate(1 / step * i)); -} -function IsFlatTracks(_) { - return !("alignment" in _) && !_.tracks.find((d) => d.alignment === "overlay" || "tracks" in d); -} -function IsOverlaidTracks(_) { - return "alignment" in _ && _.alignment === "overlay"; -} -function IsStackedTracks(_) { - return !IsFlatTracks(_) && !IsOverlaidTracks(_); -} -function IsDataTrack(_) { - return !IsOverlaidTrack(_) && "data" in _ && !("mark" in _); -} -function IsDummyTrack(_) { - return "type" in _ && _.type == "dummy-track"; -} -function IsDataTemplate(_) { - return !!("data" in _ && "overrideTemplate" in _ && _.overrideTemplate); -} -function IsDataDeep(data2) { - return typeof data2 === "object"; -} -function IsDomainChr(domain) { - return "chromosome" in domain && !("interval" in domain); -} -function IsDomainInterval(domain) { - return !("chromosome" in domain) && "interval" in domain; -} -function IsDomainChrInterval(domain) { - return "chromosome" in domain && "interval" in domain; -} -function IsSingleTrack(track) { - return !("_overlay" in track); -} -function IsOverlaidTrack(track) { - return "_overlay" in track; -} -function IsTemplateTrack(track) { - return "template" in track; -} -function IsVerticalRule(track) { - return IsSingleTrack(track) && !IsChannelDeep(track.x) && IsChannelDeep(track.y) && track.y.type === "genomic"; -} -function Is2DTrack(track) { - const t = IsSingleTrack(track) ? track : resolveSuperposedTracks(track)[0]; - return IsChannelDeep(t.x) && t.x.type === "genomic" && IsChannelDeep(t.y) && t.y.type === "genomic"; -} -function IsHiGlassMatrix(track) { - return Is2DTrack(track) && track.data.type === "matrix" && (track.mark === "bar" || track.mark === "rect") && track.xe && track.ye; -} -function IsChannelValue(channel) { - return channel !== null && typeof channel === "object" && "value" in channel; -} -function IsDataDeepTileset(_) { - return _ !== void 0 && (_.type === "vector" || _.type === "beddb" || _.type === "multivec" || _.type === "bigwig" || _.type === "matrix" || _.type === "bam" || _.type === "vcf" || _.type === "gff" || _.type === "bed"); -} -function IsChannelDeep(channel) { - return isObject(channel) && !("value" in channel); -} -function IsOneOfFilter(_) { - return "oneOf" in _; -} -function IsRangeFilter(_) { - return "inRange" in _; -} -function IsIncludeFilter(_) { - return "include" in _; -} -function IsDomainArray(domain) { - return Array.isArray(domain); -} -function IsRangeArray(range) { - return Array.isArray(range); -} -function IsStackedMark(track) { - return (track.mark === "bar" || track.mark === "area" || track.mark === "text") && IsChannelDeep(track.color) && track.color.type === "nominal" && (!track.row || IsChannelValue(track.row)) && // TODO: determine whether to use stacked bar for nominal fields or not - IsChannelDeep(track.y) && track.y.type === "quantitative" && !IsChannelDeep(track.ye); -} -function IsStackedChannel(track, channelKey) { - const channel = track[channelKey]; - return IsStackedMark(track) && // only x or y channel can be stacked - (channelKey === "x" || channelKey === "y") && // only quantitative channel can be stacked - IsChannelDeep(channel) && channel.type === "quantitative"; -} -function getValueUsingChannel(datum, channel) { - if (IsChannelDeep(channel) && channel.field) { - return datum[channel == null ? void 0 : channel.field]; - } - return void 0; -} -function getChannelKeysByAggregateFnc(spec) { - const keys = []; - SUPPORTED_CHANNELS.forEach((k) => { - const c = spec[k]; - if (IsChannelDeep(c) && "aggregate" in c) { - keys.push(k); - } - }); - return keys; -} -function getChannelKeysByType(spec, t) { - const keys = []; - SUPPORTED_CHANNELS.forEach((k) => { - const c = spec[k]; - if (IsChannelDeep(c) && c.type === t) { - keys.push(k); - } - }); - return keys; -} -function IsXAxis(_) { - if ((IsSingleTrack(_) || IsOverlaidTrack(_)) && IsChannelDeep(_.x) && _.x.axis && _.x.axis !== "none") { - return true; - } else if (IsOverlaidTrack(_)) { - let isFound = false; - _._overlay.forEach((t) => { - if (isFound) - return; - if (IsChannelDeep(t.x) && t.x.axis && t.x.axis !== "none") { - isFound = true; - } - }); - return isFound; - } - return false; -} -function IsYAxis(_) { - if ((IsSingleTrack(_) || IsOverlaidTrack(_)) && IsChannelDeep(_.y) && _.y.axis && _.y.axis !== "none") { - return true; - } else if (IsOverlaidTrack(_)) { - let isFound = false; - _._overlay.forEach((t) => { - if (isFound) - return; - if (IsChannelDeep(t.y) && t.y.axis && t.y.axis !== "none") { - isFound = true; - } - }); - return isFound; - } - return false; -} -function IsMouseEventsDeep(_) { - return typeof _ === "object"; -} -var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; -function getDefaultExportFromCjs(x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; -} -var uri_all = { exports: {} }; -/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ -(function(module, exports) { - (function(global2, factory) { - factory(exports); - })(commonjsGlobal, function(exports2) { - function merge() { - for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) { - sets[_key] = arguments[_key]; - } - if (sets.length > 1) { - sets[0] = sets[0].slice(0, -1); - var xl = sets.length - 1; - for (var x = 1; x < xl; ++x) { - sets[x] = sets[x].slice(1, -1); - } - sets[xl] = sets[xl].slice(1); - return sets.join(""); - } else { - return sets[0]; - } - } - function subexp(str) { - return "(?:" + str + ")"; - } - function typeOf(o) { - return o === void 0 ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase(); - } - function toUpperCase(str) { - return str.toUpperCase(); - } - function toArray(obj) { - return obj !== void 0 && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : []; - } - function assign(target, source) { - var obj = target; - if (source) { - for (var key in source) { - obj[key] = source[key]; - } - } - return obj; - } - function buildExps(isIRI) { - var ALPHA$$ = "[A-Za-z]", DIGIT$$ = "[0-9]", HEXDIG$$2 = merge(DIGIT$$, "[A-Fa-f]"), PCT_ENCODED$2 = subexp(subexp("%[EFef]" + HEXDIG$$2 + "%" + HEXDIG$$2 + HEXDIG$$2 + "%" + HEXDIG$$2 + HEXDIG$$2) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$2 + "%" + HEXDIG$$2 + HEXDIG$$2) + "|" + subexp("%" + HEXDIG$$2 + HEXDIG$$2)), GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]", SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]", UNRESERVED$$2 = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$); - subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*"); - subexp(subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\:]")) + "*"); - var DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$), IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$), H16$ = subexp(HEXDIG$$2 + "{1,4}"), LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$), IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$), IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$), IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$), IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$), IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$), IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$), IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$), IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$), IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"), IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")), ZONEID$ = subexp(subexp(UNRESERVED$$2 + "|" + PCT_ENCODED$2) + "+"); - subexp("[vV]" + HEXDIG$$2 + "+\\." + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\:]") + "+"); - subexp(subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$)) + "*"); - var PCHAR$ = subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\:\\@]")); - subexp(subexp(PCT_ENCODED$2 + "|" + merge(UNRESERVED$$2, SUB_DELIMS$$, "[\\@]")) + "+"); - subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*"); - return { - NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"), - NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$2, SUB_DELIMS$$), "g"), - NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$2, SUB_DELIMS$$), "g"), - NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$2, SUB_DELIMS$$), "g"), - NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$2, SUB_DELIMS$$), "g"), - NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$2, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"), - NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$2, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"), - ESCAPE: new RegExp(merge("[^]", UNRESERVED$$2, SUB_DELIMS$$), "g"), - UNRESERVED: new RegExp(UNRESERVED$$2, "g"), - OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$2, RESERVED$$), "g"), - PCT_ENCODED: new RegExp(PCT_ENCODED$2, "g"), - IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"), - IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$2 + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") - //RFC 6874, with relaxed parsing rules - }; - } - var URI_PROTOCOL = buildExps(false); - var IRI_PROTOCOL = buildExps(true); - var slicedToArray = function() { - function sliceIterator(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = void 0; - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - if (i && _arr.length === i) - break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"]) - _i["return"](); - } finally { - if (_d) - throw _e; - } - } - return _arr; - } - return function(arr, i) { - if (Array.isArray(arr)) { - return arr; - } else if (Symbol.iterator in Object(arr)) { - return sliceIterator(arr, i); - } else { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - } - }; - }(); - var toConsumableArray = function(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) - arr2[i] = arr[i]; - return arr2; - } else { - return Array.from(arr); - } - }; - var maxInt = 2147483647; - var base = 36; - var tMin = 1; - var tMax = 26; - var skew = 38; - var damp = 700; - var initialBias = 72; - var initialN = 128; - var delimiter = "-"; - var regexPunycode = /^xn--/; - var regexNonASCII = /[^\0-\x7E]/; - var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; - var errors = { - "overflow": "Overflow: input needs wider integers to process", - "not-basic": "Illegal input >= 0x80 (not a basic code point)", - "invalid-input": "Invalid input" - }; - var baseMinusTMin = base - tMin; - var floor = Math.floor; - var stringFromCharCode = String.fromCharCode; - function error$1(type2) { - throw new RangeError(errors[type2]); - } - function map(array, fn) { - var result = []; - var length = array.length; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } - function mapDomain(string, fn) { - var parts = string.split("@"); - var result = ""; - if (parts.length > 1) { - result = parts[0] + "@"; - string = parts[1]; - } - string = string.replace(regexSeparators, "."); - var labels = string.split("."); - var encoded = map(labels, fn).join("."); - return result + encoded; - } - function ucs2decode(string) { - var output = []; - var counter = 0; - var length = string.length; - while (counter < length) { - var value = string.charCodeAt(counter++); - if (value >= 55296 && value <= 56319 && counter < length) { - var extra = string.charCodeAt(counter++); - if ((extra & 64512) == 56320) { - output.push(((value & 1023) << 10) + (extra & 1023) + 65536); - } else { - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - var ucs2encode = function ucs2encode2(array) { - return String.fromCodePoint.apply(String, toConsumableArray(array)); - }; - var basicToDigit = function basicToDigit2(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - }; - var digitToBasic = function digitToBasic2(digit, flag) { - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - }; - var adapt = function adapt2(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for ( - ; - /* no initialization */ - delta > baseMinusTMin * tMax >> 1; - k += base - ) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - }; - var decode = function decode2(input) { - var output = []; - var inputLength = input.length; - var i = 0; - var n = initialN; - var bias = initialBias; - var basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - for (var j = 0; j < basic; ++j) { - if (input.charCodeAt(j) >= 128) { - error$1("not-basic"); - } - output.push(input.charCodeAt(j)); - } - for (var index = basic > 0 ? basic + 1 : 0; index < inputLength; ) { - var oldi = i; - for ( - var w = 1, k = base; - ; - /* no condition */ - k += base - ) { - if (index >= inputLength) { - error$1("invalid-input"); - } - var digit = basicToDigit(input.charCodeAt(index++)); - if (digit >= base || digit > floor((maxInt - i) / w)) { - error$1("overflow"); - } - i += digit * w; - var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; - if (digit < t) { - break; - } - var baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error$1("overflow"); - } - w *= baseMinusT; - } - var out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - if (floor(i / out) > maxInt - n) { - error$1("overflow"); - } - n += floor(i / out); - i %= out; - output.splice(i++, 0, n); - } - return String.fromCodePoint.apply(String, output); - }; - var encode = function encode2(input) { - var output = []; - input = ucs2decode(input); - var inputLength = input.length; - var n = initialN; - var delta = 0; - var bias = initialBias; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = void 0; - try { - for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var _currentValue2 = _step.value; - if (_currentValue2 < 128) { - output.push(stringFromCharCode(_currentValue2)); - } - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } - } - var basicLength = output.length; - var handledCPCount = basicLength; - if (basicLength) { - output.push(delimiter); - } - while (handledCPCount < inputLength) { - var m = maxInt; - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = void 0; - try { - for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { - var currentValue = _step2.value; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; - } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } - } - var handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error$1("overflow"); - } - delta += (m - n) * handledCPCountPlusOne; - n = m; - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = void 0; - try { - for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var _currentValue = _step3.value; - if (_currentValue < n && ++delta > maxInt) { - error$1("overflow"); - } - if (_currentValue == n) { - var q = delta; - for ( - var k = base; - ; - /* no condition */ - k += base - ) { - var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; - if (q < t) { - break; - } - var qMinusT = q - t; - var baseMinusT = base - t; - output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))); - q = floor(qMinusT / baseMinusT); - } - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; - } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } - } - ++delta; - ++n; - } - return output.join(""); - }; - var toUnicode = function toUnicode2(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; - }); - }; - var toASCII = function toASCII2(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) ? "xn--" + encode(string) : string; - }); - }; - var punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - "version": "2.1.0", - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - "ucs2": { - "decode": ucs2decode, - "encode": ucs2encode - }, - "decode": decode, - "encode": encode, - "toASCII": toASCII, - "toUnicode": toUnicode - }; - var SCHEMES = {}; - function pctEncChar(chr) { - var c = chr.charCodeAt(0); - var e = void 0; - if (c < 16) - e = "%0" + c.toString(16).toUpperCase(); - else if (c < 128) - e = "%" + c.toString(16).toUpperCase(); - else if (c < 2048) - e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(); - else - e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase(); - return e; - } - function pctDecChars(str) { - var newStr = ""; - var i = 0; - var il = str.length; - while (i < il) { - var c = parseInt(str.substr(i + 1, 2), 16); - if (c < 128) { - newStr += String.fromCharCode(c); - i += 3; - } else if (c >= 194 && c < 224) { - if (il - i >= 6) { - var c2 = parseInt(str.substr(i + 4, 2), 16); - newStr += String.fromCharCode((c & 31) << 6 | c2 & 63); - } else { - newStr += str.substr(i, 6); - } - i += 6; - } else if (c >= 224) { - if (il - i >= 9) { - var _c = parseInt(str.substr(i + 4, 2), 16); - var c3 = parseInt(str.substr(i + 7, 2), 16); - newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63); - } else { - newStr += str.substr(i, 9); - } - i += 9; - } else { - newStr += str.substr(i, 3); - i += 3; - } - } - return newStr; - } - function _normalizeComponentEncoding(components, protocol) { - function decodeUnreserved2(str) { - var decStr = pctDecChars(str); - return !decStr.match(protocol.UNRESERVED) ? str : decStr; - } - if (components.scheme) - components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved2).toLowerCase().replace(protocol.NOT_SCHEME, ""); - if (components.userinfo !== void 0) - components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.host !== void 0) - components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved2).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.path !== void 0) - components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.query !== void 0) - components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - if (components.fragment !== void 0) - components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved2).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase); - return components; - } - function _stripLeadingZeros(str) { - return str.replace(/^0*(.*)/, "$1") || "0"; - } - function _normalizeIPv4(host, protocol) { - var matches = host.match(protocol.IPV4ADDRESS) || []; - var _matches = slicedToArray(matches, 2), address = _matches[1]; - if (address) { - return address.split(".").map(_stripLeadingZeros).join("."); - } else { - return host; - } - } - function _normalizeIPv6(host, protocol) { - var matches = host.match(protocol.IPV6ADDRESS) || []; - var _matches2 = slicedToArray(matches, 3), address = _matches2[1], zone = _matches2[2]; - if (address) { - var _address$toLowerCase$ = address.toLowerCase().split("::").reverse(), _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2), last = _address$toLowerCase$2[0], first = _address$toLowerCase$2[1]; - var firstFields = first ? first.split(":").map(_stripLeadingZeros) : []; - var lastFields = last.split(":").map(_stripLeadingZeros); - var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]); - var fieldCount = isLastFieldIPv4Address ? 7 : 8; - var lastFieldsStart = lastFields.length - fieldCount; - var fields = Array(fieldCount); - for (var x = 0; x < fieldCount; ++x) { - fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || ""; - } - if (isLastFieldIPv4Address) { - fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol); - } - var allZeroFields = fields.reduce(function(acc, field, index) { - if (!field || field === "0") { - var lastLongest = acc[acc.length - 1]; - if (lastLongest && lastLongest.index + lastLongest.length === index) { - lastLongest.length++; - } else { - acc.push({ index, length: 1 }); - } - } - return acc; - }, []); - var longestZeroFields = allZeroFields.sort(function(a, b) { - return b.length - a.length; - })[0]; - var newHost = void 0; - if (longestZeroFields && longestZeroFields.length > 1) { - var newFirst = fields.slice(0, longestZeroFields.index); - var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length); - newHost = newFirst.join(":") + "::" + newLast.join(":"); - } else { - newHost = fields.join(":"); - } - if (zone) { - newHost += "%" + zone; - } - return newHost; - } else { - return host; - } - } - var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i; - var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === void 0; - function parse(uriString) { - var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - var components = {}; - var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; - if (options.reference === "suffix") - uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString; - var matches = uriString.match(URI_PARSE); - if (matches) { - if (NO_MATCH_IS_UNDEFINED) { - components.scheme = matches[1]; - components.userinfo = matches[3]; - components.host = matches[4]; - components.port = parseInt(matches[5], 10); - components.path = matches[6] || ""; - components.query = matches[7]; - components.fragment = matches[8]; - if (isNaN(components.port)) { - components.port = matches[5]; - } - } else { - components.scheme = matches[1] || void 0; - components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : void 0; - components.host = uriString.indexOf("//") !== -1 ? matches[4] : void 0; - components.port = parseInt(matches[5], 10); - components.path = matches[6] || ""; - components.query = uriString.indexOf("?") !== -1 ? matches[7] : void 0; - components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : void 0; - if (isNaN(components.port)) { - components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : void 0; - } - } - if (components.host) { - components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol); - } - if (components.scheme === void 0 && components.userinfo === void 0 && components.host === void 0 && components.port === void 0 && !components.path && components.query === void 0) { - components.reference = "same-document"; - } else if (components.scheme === void 0) { - components.reference = "relative"; - } else if (components.fragment === void 0) { - components.reference = "absolute"; - } else { - components.reference = "uri"; - } - if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) { - components.error = components.error || "URI is not a " + options.reference + " reference."; - } - var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; - if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) { - if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) { - try { - components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()); - } catch (e) { - components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e; - } - } - _normalizeComponentEncoding(components, URI_PROTOCOL); - } else { - _normalizeComponentEncoding(components, protocol); - } - if (schemeHandler && schemeHandler.parse) { - schemeHandler.parse(components, options); - } - } else { - components.error = components.error || "URI can not be parsed."; - } - return components; - } - function _recomposeAuthority(components, options) { - var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; - var uriTokens = []; - if (components.userinfo !== void 0) { - uriTokens.push(components.userinfo); - uriTokens.push("@"); - } - if (components.host !== void 0) { - uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function(_, $1, $2) { - return "[" + $1 + ($2 ? "%25" + $2 : "") + "]"; - })); - } - if (typeof components.port === "number" || typeof components.port === "string") { - uriTokens.push(":"); - uriTokens.push(String(components.port)); - } - return uriTokens.length ? uriTokens.join("") : void 0; - } - var RDS1 = /^\.\.?\//; - var RDS2 = /^\/\.(\/|$)/; - var RDS3 = /^\/\.\.(\/|$)/; - var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/; - function removeDotSegments(input) { - var output = []; - while (input.length) { - if (input.match(RDS1)) { - input = input.replace(RDS1, ""); - } else if (input.match(RDS2)) { - input = input.replace(RDS2, "/"); - } else if (input.match(RDS3)) { - input = input.replace(RDS3, "/"); - output.pop(); - } else if (input === "." || input === "..") { - input = ""; - } else { - var im = input.match(RDS5); - if (im) { - var s = im[0]; - input = input.slice(s.length); - output.push(s); - } else { - throw new Error("Unexpected dot segment condition"); - } - } - } - return output.join(""); - } - function serialize(components) { - var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL; - var uriTokens = []; - var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; - if (schemeHandler && schemeHandler.serialize) - schemeHandler.serialize(components, options); - if (components.host) { - if (protocol.IPV6ADDRESS.test(components.host)) - ; - else if (options.domainHost || schemeHandler && schemeHandler.domainHost) { - try { - components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host); - } catch (e) { - components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; - } - } - } - _normalizeComponentEncoding(components, protocol); - if (options.reference !== "suffix" && components.scheme) { - uriTokens.push(components.scheme); - uriTokens.push(":"); - } - var authority = _recomposeAuthority(components, options); - if (authority !== void 0) { - if (options.reference !== "suffix") { - uriTokens.push("//"); - } - uriTokens.push(authority); - if (components.path && components.path.charAt(0) !== "/") { - uriTokens.push("/"); - } - } - if (components.path !== void 0) { - var s = components.path; - if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { - s = removeDotSegments(s); - } - if (authority === void 0) { - s = s.replace(/^\/\//, "/%2F"); - } - uriTokens.push(s); - } - if (components.query !== void 0) { - uriTokens.push("?"); - uriTokens.push(components.query); - } - if (components.fragment !== void 0) { - uriTokens.push("#"); - uriTokens.push(components.fragment); - } - return uriTokens.join(""); - } - function resolveComponents(base2, relative) { - var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; - var skipNormalization = arguments[3]; - var target = {}; - if (!skipNormalization) { - base2 = parse(serialize(base2, options), options); - relative = parse(serialize(relative, options), options); - } - options = options || {}; - if (!options.tolerant && relative.scheme) { - target.scheme = relative.scheme; - target.userinfo = relative.userinfo; - target.host = relative.host; - target.port = relative.port; - target.path = removeDotSegments(relative.path || ""); - target.query = relative.query; - } else { - if (relative.userinfo !== void 0 || relative.host !== void 0 || relative.port !== void 0) { - target.userinfo = relative.userinfo; - target.host = relative.host; - target.port = relative.port; - target.path = removeDotSegments(relative.path || ""); - target.query = relative.query; - } else { - if (!relative.path) { - target.path = base2.path; - if (relative.query !== void 0) { - target.query = relative.query; - } else { - target.query = base2.query; - } - } else { - if (relative.path.charAt(0) === "/") { - target.path = removeDotSegments(relative.path); - } else { - if ((base2.userinfo !== void 0 || base2.host !== void 0 || base2.port !== void 0) && !base2.path) { - target.path = "/" + relative.path; - } else if (!base2.path) { - target.path = relative.path; - } else { - target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative.path; - } - target.path = removeDotSegments(target.path); - } - target.query = relative.query; - } - target.userinfo = base2.userinfo; - target.host = base2.host; - target.port = base2.port; - } - target.scheme = base2.scheme; - } - target.fragment = relative.fragment; - return target; - } - function resolve2(baseURI, relativeURI, options) { - var schemelessOptions = assign({ scheme: "null" }, options); - return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions); - } - function normalize(uri2, options) { - if (typeof uri2 === "string") { - uri2 = serialize(parse(uri2, options), options); - } else if (typeOf(uri2) === "object") { - uri2 = parse(serialize(uri2, options), options); - } - return uri2; - } - function equal3(uriA, uriB, options) { - if (typeof uriA === "string") { - uriA = serialize(parse(uriA, options), options); - } else if (typeOf(uriA) === "object") { - uriA = serialize(uriA, options); - } - if (typeof uriB === "string") { - uriB = serialize(parse(uriB, options), options); - } else if (typeOf(uriB) === "object") { - uriB = serialize(uriB, options); - } - return uriA === uriB; - } - function escapeComponent(str, options) { - return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar); - } - function unescapeComponent(str, options) { - return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars); - } - var handler = { - scheme: "http", - domainHost: true, - parse: function parse2(components, options) { - if (!components.host) { - components.error = components.error || "HTTP URIs must have a host."; - } - return components; - }, - serialize: function serialize2(components, options) { - var secure = String(components.scheme).toLowerCase() === "https"; - if (components.port === (secure ? 443 : 80) || components.port === "") { - components.port = void 0; - } - if (!components.path) { - components.path = "/"; - } - return components; - } - }; - var handler$1 = { - scheme: "https", - domainHost: handler.domainHost, - parse: handler.parse, - serialize: handler.serialize - }; - function isSecure(wsComponents) { - return typeof wsComponents.secure === "boolean" ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss"; - } - var handler$2 = { - scheme: "ws", - domainHost: true, - parse: function parse2(components, options) { - var wsComponents = components; - wsComponents.secure = isSecure(wsComponents); - wsComponents.resourceName = (wsComponents.path || "/") + (wsComponents.query ? "?" + wsComponents.query : ""); - wsComponents.path = void 0; - wsComponents.query = void 0; - return wsComponents; - }, - serialize: function serialize2(wsComponents, options) { - if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") { - wsComponents.port = void 0; - } - if (typeof wsComponents.secure === "boolean") { - wsComponents.scheme = wsComponents.secure ? "wss" : "ws"; - wsComponents.secure = void 0; - } - if (wsComponents.resourceName) { - var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path = _wsComponents$resourc2[0], query = _wsComponents$resourc2[1]; - wsComponents.path = path && path !== "/" ? path : void 0; - wsComponents.query = query; - wsComponents.resourceName = void 0; - } - wsComponents.fragment = void 0; - return wsComponents; - } - }; - var handler$3 = { - scheme: "wss", - domainHost: handler$2.domainHost, - parse: handler$2.parse, - serialize: handler$2.serialize - }; - var O = {}; - var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]"; - var HEXDIG$$ = "[0-9A-Fa-f]"; - var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); - var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]"; - var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]"; - var VCHAR$$ = merge(QTEXT$$, '[\\"\\\\]'); - var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"; - var UNRESERVED = new RegExp(UNRESERVED$$, "g"); - var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g"); - var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g"); - var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g"); - var NOT_HFVALUE = NOT_HFNAME; - function decodeUnreserved(str) { - var decStr = pctDecChars(str); - return !decStr.match(UNRESERVED) ? str : decStr; - } - var handler$4 = { - scheme: "mailto", - parse: function parse$$1(components, options) { - var mailtoComponents = components; - var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : []; - mailtoComponents.path = void 0; - if (mailtoComponents.query) { - var unknownHeaders = false; - var headers = {}; - var hfields = mailtoComponents.query.split("&"); - for (var x = 0, xl = hfields.length; x < xl; ++x) { - var hfield = hfields[x].split("="); - switch (hfield[0]) { - case "to": - var toAddrs = hfield[1].split(","); - for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) { - to.push(toAddrs[_x]); - } - break; - case "subject": - mailtoComponents.subject = unescapeComponent(hfield[1], options); - break; - case "body": - mailtoComponents.body = unescapeComponent(hfield[1], options); - break; - default: - unknownHeaders = true; - headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options); - break; - } - } - if (unknownHeaders) - mailtoComponents.headers = headers; - } - mailtoComponents.query = void 0; - for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) { - var addr = to[_x2].split("@"); - addr[0] = unescapeComponent(addr[0]); - if (!options.unicodeSupport) { - try { - addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase()); - } catch (e) { - mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e; - } - } else { - addr[1] = unescapeComponent(addr[1], options).toLowerCase(); - } - to[_x2] = addr.join("@"); - } - return mailtoComponents; - }, - serialize: function serialize$$1(mailtoComponents, options) { - var components = mailtoComponents; - var to = toArray(mailtoComponents.to); - if (to) { - for (var x = 0, xl = to.length; x < xl; ++x) { - var toAddr = String(to[x]); - var atIdx = toAddr.lastIndexOf("@"); - var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar); - var domain = toAddr.slice(atIdx + 1); - try { - domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain); - } catch (e) { - components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e; - } - to[x] = localPart + "@" + domain; - } - components.path = to.join(","); - } - var headers = mailtoComponents.headers = mailtoComponents.headers || {}; - if (mailtoComponents.subject) - headers["subject"] = mailtoComponents.subject; - if (mailtoComponents.body) - headers["body"] = mailtoComponents.body; - var fields = []; - for (var name in headers) { - if (headers[name] !== O[name]) { - fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar)); - } - } - if (fields.length) { - components.query = fields.join("&"); - } - return components; - } - }; - var URN_PARSE = /^([^\:]+)\:(.*)/; - var handler$5 = { - scheme: "urn", - parse: function parse$$1(components, options) { - var matches = components.path && components.path.match(URN_PARSE); - var urnComponents = components; - if (matches) { - var scheme = options.scheme || urnComponents.scheme || "urn"; - var nid = matches[1].toLowerCase(); - var nss = matches[2]; - var urnScheme = scheme + ":" + (options.nid || nid); - var schemeHandler = SCHEMES[urnScheme]; - urnComponents.nid = nid; - urnComponents.nss = nss; - urnComponents.path = void 0; - if (schemeHandler) { - urnComponents = schemeHandler.parse(urnComponents, options); - } - } else { - urnComponents.error = urnComponents.error || "URN can not be parsed."; - } - return urnComponents; - }, - serialize: function serialize$$1(urnComponents, options) { - var scheme = options.scheme || urnComponents.scheme || "urn"; - var nid = urnComponents.nid; - var urnScheme = scheme + ":" + (options.nid || nid); - var schemeHandler = SCHEMES[urnScheme]; - if (schemeHandler) { - urnComponents = schemeHandler.serialize(urnComponents, options); - } - var uriComponents = urnComponents; - var nss = urnComponents.nss; - uriComponents.path = (nid || options.nid) + ":" + nss; - return uriComponents; - } - }; - var UUID2 = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/; - var handler$6 = { - scheme: "urn:uuid", - parse: function parse2(urnComponents, options) { - var uuidComponents = urnComponents; - uuidComponents.uuid = uuidComponents.nss; - uuidComponents.nss = void 0; - if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID2))) { - uuidComponents.error = uuidComponents.error || "UUID is not valid."; - } - return uuidComponents; - }, - serialize: function serialize2(uuidComponents, options) { - var urnComponents = uuidComponents; - urnComponents.nss = (uuidComponents.uuid || "").toLowerCase(); - return urnComponents; - } - }; - SCHEMES[handler.scheme] = handler; - SCHEMES[handler$1.scheme] = handler$1; - SCHEMES[handler$2.scheme] = handler$2; - SCHEMES[handler$3.scheme] = handler$3; - SCHEMES[handler$4.scheme] = handler$4; - SCHEMES[handler$5.scheme] = handler$5; - SCHEMES[handler$6.scheme] = handler$6; - exports2.SCHEMES = SCHEMES; - exports2.pctEncChar = pctEncChar; - exports2.pctDecChars = pctDecChars; - exports2.parse = parse; - exports2.removeDotSegments = removeDotSegments; - exports2.serialize = serialize; - exports2.resolveComponents = resolveComponents; - exports2.resolve = resolve2; - exports2.normalize = normalize; - exports2.equal = equal3; - exports2.escapeComponent = escapeComponent; - exports2.unescapeComponent = unescapeComponent; - Object.defineProperty(exports2, "__esModule", { value: true }); - }); -})(uri_all, uri_all.exports); -var uri_allExports = uri_all.exports; -var fastDeepEqual = function equal(a, b) { - if (a === b) - return true; - if (a && b && typeof a == "object" && typeof b == "object") { - if (a.constructor !== b.constructor) - return false; - var length, i, keys; - if (Array.isArray(a)) { - length = a.length; - if (length != b.length) - return false; - for (i = length; i-- !== 0; ) - if (!equal(a[i], b[i])) - return false; - return true; - } - if (a.constructor === RegExp) - return a.source === b.source && a.flags === b.flags; - if (a.valueOf !== Object.prototype.valueOf) - return a.valueOf() === b.valueOf(); - if (a.toString !== Object.prototype.toString) - return a.toString() === b.toString(); - keys = Object.keys(a); - length = keys.length; - if (length !== Object.keys(b).length) - return false; - for (i = length; i-- !== 0; ) - if (!Object.prototype.hasOwnProperty.call(b, keys[i])) - return false; - for (i = length; i-- !== 0; ) { - var key = keys[i]; - if (!equal(a[key], b[key])) - return false; - } - return true; - } - return a !== a && b !== b; -}; -var ucs2length$1 = function ucs2length(str) { - var length = 0, len = str.length, pos = 0, value; - while (pos < len) { - length++; - value = str.charCodeAt(pos++); - if (value >= 55296 && value <= 56319 && pos < len) { - value = str.charCodeAt(pos); - if ((value & 64512) == 56320) - pos++; - } - } - return length; -}; -var util$5 = { - copy, - checkDataType, - checkDataTypes, - coerceToTypes, - toHash: toHash$1, - getProperty, - escapeQuotes, - equal: fastDeepEqual, - ucs2length: ucs2length$1, - varOccurences, - varReplace, - schemaHasRules, - schemaHasRulesExcept, - schemaUnknownRules, - toQuotedString, - getPathExpr, - getPath, - getData, - unescapeFragment, - unescapeJsonPointer, - escapeFragment, - escapeJsonPointer -}; -function copy(o, to) { - to = to || {}; - for (var key in o) - to[key] = o[key]; - return to; -} -function checkDataType(dataType, data2, strictNumbers, negate) { - var EQUAL = negate ? " !== " : " === ", AND = negate ? " || " : " && ", OK = negate ? "!" : "", NOT = negate ? "" : "!"; - switch (dataType) { - case "null": - return data2 + EQUAL + "null"; - case "array": - return OK + "Array.isArray(" + data2 + ")"; - case "object": - return "(" + OK + data2 + AND + "typeof " + data2 + EQUAL + '"object"' + AND + NOT + "Array.isArray(" + data2 + "))"; - case "integer": - return "(typeof " + data2 + EQUAL + '"number"' + AND + NOT + "(" + data2 + " % 1)" + AND + data2 + EQUAL + data2 + (strictNumbers ? AND + OK + "isFinite(" + data2 + ")" : "") + ")"; - case "number": - return "(typeof " + data2 + EQUAL + '"' + dataType + '"' + (strictNumbers ? AND + OK + "isFinite(" + data2 + ")" : "") + ")"; - default: - return "typeof " + data2 + EQUAL + '"' + dataType + '"'; - } -} -function checkDataTypes(dataTypes, data2, strictNumbers) { - switch (dataTypes.length) { - case 1: - return checkDataType(dataTypes[0], data2, strictNumbers, true); - default: - var code = ""; - var types = toHash$1(dataTypes); - if (types.array && types.object) { - code = types.null ? "(" : "(!" + data2 + " || "; - code += "typeof " + data2 + ' !== "object")'; - delete types.null; - delete types.array; - delete types.object; - } - if (types.number) - delete types.integer; - for (var t in types) - code += (code ? " && " : "") + checkDataType(t, data2, strictNumbers, true); - return code; - } -} -var COERCE_TO_TYPES = toHash$1(["string", "number", "integer", "boolean", "null"]); -function coerceToTypes(optionCoerceTypes, dataTypes) { - if (Array.isArray(dataTypes)) { - var types = []; - for (var i = 0; i < dataTypes.length; i++) { - var t = dataTypes[i]; - if (COERCE_TO_TYPES[t]) - types[types.length] = t; - else if (optionCoerceTypes === "array" && t === "array") - types[types.length] = t; - } - if (types.length) - return types; - } else if (COERCE_TO_TYPES[dataTypes]) { - return [dataTypes]; - } else if (optionCoerceTypes === "array" && dataTypes === "array") { - return ["array"]; - } -} -function toHash$1(arr) { - var hash = {}; - for (var i = 0; i < arr.length; i++) - hash[arr[i]] = true; - return hash; -} -var IDENTIFIER$1 = /^[a-z$_][a-z$_0-9]*$/i; -var SINGLE_QUOTE = /'|\\/g; -function getProperty(key) { - return typeof key == "number" ? "[" + key + "]" : IDENTIFIER$1.test(key) ? "." + key : "['" + escapeQuotes(key) + "']"; -} -function escapeQuotes(str) { - return str.replace(SINGLE_QUOTE, "\\$&").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\f/g, "\\f").replace(/\t/g, "\\t"); -} -function varOccurences(str, dataVar) { - dataVar += "[^0-9]"; - var matches = str.match(new RegExp(dataVar, "g")); - return matches ? matches.length : 0; -} -function varReplace(str, dataVar, expr) { - dataVar += "([^0-9])"; - expr = expr.replace(/\$/g, "$$$$"); - return str.replace(new RegExp(dataVar, "g"), expr + "$1"); -} -function schemaHasRules(schema, rules3) { - if (typeof schema == "boolean") - return !schema; - for (var key in schema) - if (rules3[key]) - return true; -} -function schemaHasRulesExcept(schema, rules3, exceptKeyword) { - if (typeof schema == "boolean") - return !schema && exceptKeyword != "not"; - for (var key in schema) - if (key != exceptKeyword && rules3[key]) - return true; -} -function schemaUnknownRules(schema, rules3) { - if (typeof schema == "boolean") - return; - for (var key in schema) - if (!rules3[key]) - return key; -} -function toQuotedString(str) { - return "'" + escapeQuotes(str) + "'"; -} -function getPathExpr(currentPath, expr, jsonPointers, isNumber) { - var path = jsonPointers ? "'/' + " + expr + (isNumber ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : isNumber ? "'[' + " + expr + " + ']'" : "'[\\'' + " + expr + " + '\\']'"; - return joinPaths(currentPath, path); -} -function getPath(currentPath, prop, jsonPointers) { - var path = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop)); - return joinPaths(currentPath, path); -} -var JSON_POINTER$1 = /^\/(?:[^~]|~0|~1)*$/; -var RELATIVE_JSON_POINTER$1 = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; -function getData($data, lvl, paths) { - var up, jsonPointer, data2, matches; - if ($data === "") - return "rootData"; - if ($data[0] == "/") { - if (!JSON_POINTER$1.test($data)) - throw new Error("Invalid JSON-pointer: " + $data); - jsonPointer = $data; - data2 = "rootData"; - } else { - matches = $data.match(RELATIVE_JSON_POINTER$1); - if (!matches) - throw new Error("Invalid JSON-pointer: " + $data); - up = +matches[1]; - jsonPointer = matches[2]; - if (jsonPointer == "#") { - if (up >= lvl) - throw new Error("Cannot access property/index " + up + " levels up, current level is " + lvl); - return paths[lvl - up]; - } - if (up > lvl) - throw new Error("Cannot access data " + up + " levels up, current level is " + lvl); - data2 = "data" + (lvl - up || ""); - if (!jsonPointer) - return data2; - } - var expr = data2; - var segments = jsonPointer.split("/"); - for (var i = 0; i < segments.length; i++) { - var segment = segments[i]; - if (segment) { - data2 += getProperty(unescapeJsonPointer(segment)); - expr += " && " + data2; - } - } - return expr; -} -function joinPaths(a, b) { - if (a == '""') - return b; - return (a + " + " + b).replace(/([^\\])' \+ '/g, "$1"); -} -function unescapeFragment(str) { - return unescapeJsonPointer(decodeURIComponent(str)); -} -function escapeFragment(str) { - return encodeURIComponent(escapeJsonPointer(str)); -} -function escapeJsonPointer(str) { - return str.replace(/~/g, "~0").replace(/\//g, "~1"); -} -function unescapeJsonPointer(str) { - return str.replace(/~1/g, "/").replace(/~0/g, "~"); -} -var util$4 = util$5; -var schema_obj = SchemaObject$2; -function SchemaObject$2(obj) { - util$4.copy(obj, this); -} -var jsonSchemaTraverse = { exports: {} }; -var traverse$1 = jsonSchemaTraverse.exports = function(schema, opts, cb) { - if (typeof opts == "function") { - cb = opts; - opts = {}; - } - cb = opts.cb || cb; - var pre = typeof cb == "function" ? cb : cb.pre || function() { - }; - var post = cb.post || function() { - }; - _traverse(opts, pre, post, schema, "", schema); -}; -traverse$1.keywords = { - additionalItems: true, - items: true, - contains: true, - additionalProperties: true, - propertyNames: true, - not: true -}; -traverse$1.arrayKeywords = { - items: true, - allOf: true, - anyOf: true, - oneOf: true -}; -traverse$1.propsKeywords = { - definitions: true, - properties: true, - patternProperties: true, - dependencies: true -}; -traverse$1.skipKeywords = { - default: true, - enum: true, - const: true, - required: true, - maximum: true, - minimum: true, - exclusiveMaximum: true, - exclusiveMinimum: true, - multipleOf: true, - maxLength: true, - minLength: true, - pattern: true, - format: true, - maxItems: true, - minItems: true, - uniqueItems: true, - maxProperties: true, - minProperties: true -}; -function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { - if (schema && typeof schema == "object" && !Array.isArray(schema)) { - pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); - for (var key in schema) { - var sch = schema[key]; - if (Array.isArray(sch)) { - if (key in traverse$1.arrayKeywords) { - for (var i = 0; i < sch.length; i++) - _traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key, schema, i); - } - } else if (key in traverse$1.propsKeywords) { - if (sch && typeof sch == "object") { - for (var prop in sch) - _traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop); - } - } else if (key in traverse$1.keywords || opts.allKeys && !(key in traverse$1.skipKeywords)) { - _traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema); - } - } - post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); - } -} -function escapeJsonPtr(str) { - return str.replace(/~/g, "~0").replace(/\//g, "~1"); -} -var jsonSchemaTraverseExports = jsonSchemaTraverse.exports; -var URI$1 = uri_allExports, equal$1 = fastDeepEqual, util$3 = util$5, SchemaObject$1 = schema_obj, traverse = jsonSchemaTraverseExports; -var resolve_1 = resolve$3; -resolve$3.normalizeId = normalizeId; -resolve$3.fullPath = getFullPath; -resolve$3.url = resolveUrl; -resolve$3.ids = resolveIds; -resolve$3.inlineRef = inlineRef; -resolve$3.schema = resolveSchema; -function resolve$3(compile2, root, ref2) { - var refVal = this._refs[ref2]; - if (typeof refVal == "string") { - if (this._refs[refVal]) - refVal = this._refs[refVal]; - else - return resolve$3.call(this, compile2, root, refVal); - } - refVal = refVal || this._schemas[ref2]; - if (refVal instanceof SchemaObject$1) { - return inlineRef(refVal.schema, this._opts.inlineRefs) ? refVal.schema : refVal.validate || this._compile(refVal); - } - var res = resolveSchema.call(this, root, ref2); - var schema, v, baseId; - if (res) { - schema = res.schema; - root = res.root; - baseId = res.baseId; - } - if (schema instanceof SchemaObject$1) { - v = schema.validate || compile2.call(this, schema.schema, root, void 0, baseId); - } else if (schema !== void 0) { - v = inlineRef(schema, this._opts.inlineRefs) ? schema : compile2.call(this, schema, root, void 0, baseId); - } - return v; -} -function resolveSchema(root, ref2) { - var p = URI$1.parse(ref2), refPath = _getFullPath(p), baseId = getFullPath(this._getId(root.schema)); - if (Object.keys(root.schema).length === 0 || refPath !== baseId) { - var id = normalizeId(refPath); - var refVal = this._refs[id]; - if (typeof refVal == "string") { - return resolveRecursive.call(this, root, refVal, p); - } else if (refVal instanceof SchemaObject$1) { - if (!refVal.validate) - this._compile(refVal); - root = refVal; - } else { - refVal = this._schemas[id]; - if (refVal instanceof SchemaObject$1) { - if (!refVal.validate) - this._compile(refVal); - if (id == normalizeId(ref2)) - return { schema: refVal, root, baseId }; - root = refVal; - } else { - return; - } - } - if (!root.schema) - return; - baseId = getFullPath(this._getId(root.schema)); - } - return getJsonPointer.call(this, p, baseId, root.schema, root); -} -function resolveRecursive(root, ref2, parsedRef) { - var res = resolveSchema.call(this, root, ref2); - if (res) { - var schema = res.schema; - var baseId = res.baseId; - root = res.root; - var id = this._getId(schema); - if (id) - baseId = resolveUrl(baseId, id); - return getJsonPointer.call(this, parsedRef, baseId, schema, root); - } -} -var PREVENT_SCOPE_CHANGE = util$3.toHash(["properties", "patternProperties", "enum", "dependencies", "definitions"]); -function getJsonPointer(parsedRef, baseId, schema, root) { - parsedRef.fragment = parsedRef.fragment || ""; - if (parsedRef.fragment.slice(0, 1) != "/") - return; - var parts = parsedRef.fragment.split("/"); - for (var i = 1; i < parts.length; i++) { - var part = parts[i]; - if (part) { - part = util$3.unescapeFragment(part); - schema = schema[part]; - if (schema === void 0) - break; - var id; - if (!PREVENT_SCOPE_CHANGE[part]) { - id = this._getId(schema); - if (id) - baseId = resolveUrl(baseId, id); - if (schema.$ref) { - var $ref = resolveUrl(baseId, schema.$ref); - var res = resolveSchema.call(this, root, $ref); - if (res) { - schema = res.schema; - root = res.root; - baseId = res.baseId; - } - } - } - } - } - if (schema !== void 0 && schema !== root.schema) - return { schema, root, baseId }; -} -var SIMPLE_INLINED = util$3.toHash([ - "type", - "format", - "pattern", - "maxLength", - "minLength", - "maxProperties", - "minProperties", - "maxItems", - "minItems", - "maximum", - "minimum", - "uniqueItems", - "multipleOf", - "required", - "enum" -]); -function inlineRef(schema, limit) { - if (limit === false) - return false; - if (limit === void 0 || limit === true) - return checkNoRef(schema); - else if (limit) - return countKeys(schema) <= limit; -} -function checkNoRef(schema) { - var item; - if (Array.isArray(schema)) { - for (var i = 0; i < schema.length; i++) { - item = schema[i]; - if (typeof item == "object" && !checkNoRef(item)) - return false; - } - } else { - for (var key in schema) { - if (key == "$ref") - return false; - item = schema[key]; - if (typeof item == "object" && !checkNoRef(item)) - return false; - } - } - return true; -} -function countKeys(schema) { - var count = 0, item; - if (Array.isArray(schema)) { - for (var i = 0; i < schema.length; i++) { - item = schema[i]; - if (typeof item == "object") - count += countKeys(item); - if (count == Infinity) - return Infinity; - } - } else { - for (var key in schema) { - if (key == "$ref") - return Infinity; - if (SIMPLE_INLINED[key]) { - count++; - } else { - item = schema[key]; - if (typeof item == "object") - count += countKeys(item) + 1; - if (count == Infinity) - return Infinity; - } - } - } - return count; -} -function getFullPath(id, normalize) { - if (normalize !== false) - id = normalizeId(id); - var p = URI$1.parse(id); - return _getFullPath(p); -} -function _getFullPath(p) { - return URI$1.serialize(p).split("#")[0] + "#"; -} -var TRAILING_SLASH_HASH = /#\/?$/; -function normalizeId(id) { - return id ? id.replace(TRAILING_SLASH_HASH, "") : ""; -} -function resolveUrl(baseId, id) { - id = normalizeId(id); - return URI$1.resolve(baseId, id); -} -function resolveIds(schema) { - var schemaId = normalizeId(this._getId(schema)); - var baseIds = { "": schemaId }; - var fullPaths = { "": getFullPath(schemaId, false) }; - var localRefs = {}; - var self2 = this; - traverse(schema, { allKeys: true }, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { - if (jsonPtr === "") - return; - var id = self2._getId(sch); - var baseId = baseIds[parentJsonPtr]; - var fullPath = fullPaths[parentJsonPtr] + "/" + parentKeyword; - if (keyIndex !== void 0) - fullPath += "/" + (typeof keyIndex == "number" ? keyIndex : util$3.escapeFragment(keyIndex)); - if (typeof id == "string") { - id = baseId = normalizeId(baseId ? URI$1.resolve(baseId, id) : id); - var refVal = self2._refs[id]; - if (typeof refVal == "string") - refVal = self2._refs[refVal]; - if (refVal && refVal.schema) { - if (!equal$1(sch, refVal.schema)) - throw new Error('id "' + id + '" resolves to more than one schema'); - } else if (id != normalizeId(fullPath)) { - if (id[0] == "#") { - if (localRefs[id] && !equal$1(sch, localRefs[id])) - throw new Error('id "' + id + '" resolves to more than one schema'); - localRefs[id] = sch; - } else { - self2._refs[id] = fullPath; - } - } - } - baseIds[jsonPtr] = baseId; - fullPaths[jsonPtr] = fullPath; - }); - return localRefs; -} -var resolve$2 = resolve_1; -var error_classes = { - Validation: errorSubclass(ValidationError$1), - MissingRef: errorSubclass(MissingRefError$1) -}; -function ValidationError$1(errors) { - this.message = "validation failed"; - this.errors = errors; - this.ajv = this.validation = true; -} -MissingRefError$1.message = function(baseId, ref2) { - return "can't resolve reference " + ref2 + " from id " + baseId; -}; -function MissingRefError$1(baseId, ref2, message) { - this.message = message || MissingRefError$1.message(baseId, ref2); - this.missingRef = resolve$2.url(baseId, ref2); - this.missingSchema = resolve$2.normalizeId(resolve$2.fullPath(this.missingRef)); -} -function errorSubclass(Subclass) { - Subclass.prototype = Object.create(Error.prototype); - Subclass.prototype.constructor = Subclass; - return Subclass; -} -var fastJsonStableStringify = function(data2, opts) { - if (!opts) - opts = {}; - if (typeof opts === "function") - opts = { cmp: opts }; - var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false; - var cmp = opts.cmp && function(f) { - return function(node) { - return function(a, b) { - var aobj = { key: a, value: node[a] }; - var bobj = { key: b, value: node[b] }; - return f(aobj, bobj); - }; - }; - }(opts.cmp); - var seen = []; - return function stringify(node) { - if (node && node.toJSON && typeof node.toJSON === "function") { - node = node.toJSON(); - } - if (node === void 0) - return; - if (typeof node == "number") - return isFinite(node) ? "" + node : "null"; - if (typeof node !== "object") - return JSON.stringify(node); - var i, out; - if (Array.isArray(node)) { - out = "["; - for (i = 0; i < node.length; i++) { - if (i) - out += ","; - out += stringify(node[i]) || "null"; - } - return out + "]"; - } - if (node === null) - return "null"; - if (seen.indexOf(node) !== -1) { - if (cycles) - return JSON.stringify("__cycle__"); - throw new TypeError("Converting circular structure to JSON"); - } - var seenIndex = seen.push(node) - 1; - var keys = Object.keys(node).sort(cmp && cmp(node)); - out = ""; - for (i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = stringify(node[key]); - if (!value) - continue; - if (out) - out += ","; - out += JSON.stringify(key) + ":" + value; - } - seen.splice(seenIndex, 1); - return "{" + out + "}"; - }(data2); -}; -var validate$1 = function generate_validate(it, $keyword, $ruleType) { - var out = ""; - var $async = it.schema.$async === true, $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, "$ref"), $id2 = it.self._getId(it.schema); - if (it.opts.strictKeywords) { - var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords); - if ($unknownKwd) { - var $keywordsMsg = "unknown keyword: " + $unknownKwd; - if (it.opts.strictKeywords === "log") - it.logger.warn($keywordsMsg); - else - throw new Error($keywordsMsg); - } - } - if (it.isTop) { - out += " var validate = "; - if ($async) { - it.async = true; - out += "async "; - } - out += "function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; "; - if ($id2 && (it.opts.sourceCode || it.opts.processCode)) { - out += " " + ("/*# sourceURL=" + $id2 + " */") + " "; - } - } - if (typeof it.schema == "boolean" || !($refKeywords || it.schema.$ref)) { - var $keyword = "false schema"; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = "data" + ($dataLvl || ""); - var $valid = "valid" + $lvl; - if (it.schema === false) { - if (it.isTop) { - $breakOnError = true; - } else { - out += " var " + $valid + " = false; "; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: '" + ($errorKeyword || "false schema") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; - if (it.opts.messages !== false) { - out += " , message: 'boolean schema is false' "; - } - if (it.opts.verbose) { - out += " , schema: false , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - } else { - if (it.isTop) { - if ($async) { - out += " return data; "; - } else { - out += " validate.errors = null; return true; "; - } - } else { - out += " var " + $valid + " = true; "; - } - } - if (it.isTop) { - out += " }; return validate; "; - } - return out; - } - if (it.isTop) { - var $top = it.isTop, $lvl = it.level = 0, $dataLvl = it.dataLevel = 0, $data = "data"; - it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); - it.baseId = it.baseId || it.rootId; - delete it.isTop; - it.dataPathArr = [""]; - if (it.schema.default !== void 0 && it.opts.useDefaults && it.opts.strictDefaults) { - var $defaultMsg = "default is ignored in the schema root"; - if (it.opts.strictDefaults === "log") - it.logger.warn($defaultMsg); - else - throw new Error($defaultMsg); - } - out += " var vErrors = null; "; - out += " var errors = 0; "; - out += " if (rootData === undefined) rootData = data; "; - } else { - var $lvl = it.level, $dataLvl = it.dataLevel, $data = "data" + ($dataLvl || ""); - if ($id2) - it.baseId = it.resolve.url(it.baseId, $id2); - if ($async && !it.async) - throw new Error("async schema in sync schema"); - out += " var errs_" + $lvl + " = errors;"; - } - var $valid = "valid" + $lvl, $breakOnError = !it.opts.allErrors, $closingBraces1 = "", $closingBraces2 = ""; - var $errorKeyword; - var $typeSchema = it.schema.type, $typeIsArray = Array.isArray($typeSchema); - if ($typeSchema && it.opts.nullable && it.schema.nullable === true) { - if ($typeIsArray) { - if ($typeSchema.indexOf("null") == -1) - $typeSchema = $typeSchema.concat("null"); - } else if ($typeSchema != "null") { - $typeSchema = [$typeSchema, "null"]; - $typeIsArray = true; - } - } - if ($typeIsArray && $typeSchema.length == 1) { - $typeSchema = $typeSchema[0]; - $typeIsArray = false; - } - if (it.schema.$ref && $refKeywords) { - if (it.opts.extendRefs == "fail") { - throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); - } else if (it.opts.extendRefs !== true) { - $refKeywords = false; - it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); - } - } - if (it.schema.$comment && it.opts.$comment) { - out += " " + it.RULES.all.$comment.code(it, "$comment"); - } - if ($typeSchema) { - if (it.opts.coerceTypes) { - var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); - } - var $rulesGroup = it.RULES.types[$typeSchema]; - if ($coerceToTypes || $typeIsArray || $rulesGroup === true || $rulesGroup && !$shouldUseGroup($rulesGroup)) { - var $schemaPath = it.schemaPath + ".type", $errSchemaPath = it.errSchemaPath + "/type"; - var $schemaPath = it.schemaPath + ".type", $errSchemaPath = it.errSchemaPath + "/type", $method = $typeIsArray ? "checkDataTypes" : "checkDataType"; - out += " if (" + it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true) + ") { "; - if ($coerceToTypes) { - var $dataType = "dataType" + $lvl, $coerced = "coerced" + $lvl; - out += " var " + $dataType + " = typeof " + $data + "; var " + $coerced + " = undefined; "; - if (it.opts.coerceTypes == "array") { - out += " if (" + $dataType + " == 'object' && Array.isArray(" + $data + ") && " + $data + ".length == 1) { " + $data + " = " + $data + "[0]; " + $dataType + " = typeof " + $data + "; if (" + it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers) + ") " + $coerced + " = " + $data + "; } "; - } - out += " if (" + $coerced + " !== undefined) ; "; - var arr1 = $coerceToTypes; - if (arr1) { - var $type, $i = -1, l1 = arr1.length - 1; - while ($i < l1) { - $type = arr1[$i += 1]; - if ($type == "string") { - out += " else if (" + $dataType + " == 'number' || " + $dataType + " == 'boolean') " + $coerced + " = '' + " + $data + "; else if (" + $data + " === null) " + $coerced + " = ''; "; - } else if ($type == "number" || $type == "integer") { - out += " else if (" + $dataType + " == 'boolean' || " + $data + " === null || (" + $dataType + " == 'string' && " + $data + " && " + $data + " == +" + $data + " "; - if ($type == "integer") { - out += " && !(" + $data + " % 1)"; - } - out += ")) " + $coerced + " = +" + $data + "; "; - } else if ($type == "boolean") { - out += " else if (" + $data + " === 'false' || " + $data + " === 0 || " + $data + " === null) " + $coerced + " = false; else if (" + $data + " === 'true' || " + $data + " === 1) " + $coerced + " = true; "; - } else if ($type == "null") { - out += " else if (" + $data + " === '' || " + $data + " === 0 || " + $data + " === false) " + $coerced + " = null; "; - } else if (it.opts.coerceTypes == "array" && $type == "array") { - out += " else if (" + $dataType + " == 'string' || " + $dataType + " == 'number' || " + $dataType + " == 'boolean' || " + $data + " == null) " + $coerced + " = [" + $data + "]; "; - } - } - } - out += " else { "; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: '" + ($errorKeyword || "type") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { type: '"; - if ($typeIsArray) { - out += "" + $typeSchema.join(","); - } else { - out += "" + $typeSchema; - } - out += "' } "; - if (it.opts.messages !== false) { - out += " , message: 'should be "; - if ($typeIsArray) { - out += "" + $typeSchema.join(","); - } else { - out += "" + $typeSchema; - } - out += "' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " } if (" + $coerced + " !== undefined) { "; - var $parentData = $dataLvl ? "data" + ($dataLvl - 1 || "") : "parentData", $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : "parentDataProperty"; - out += " " + $data + " = " + $coerced + "; "; - if (!$dataLvl) { - out += "if (" + $parentData + " !== undefined)"; - } - out += " " + $parentData + "[" + $parentDataProperty + "] = " + $coerced + "; } "; - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: '" + ($errorKeyword || "type") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { type: '"; - if ($typeIsArray) { - out += "" + $typeSchema.join(","); - } else { - out += "" + $typeSchema; - } - out += "' } "; - if (it.opts.messages !== false) { - out += " , message: 'should be "; - if ($typeIsArray) { - out += "" + $typeSchema.join(","); - } else { - out += "" + $typeSchema; - } - out += "' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - } - out += " } "; - } - } - if (it.schema.$ref && !$refKeywords) { - out += " " + it.RULES.all.$ref.code(it, "$ref") + " "; - if ($breakOnError) { - out += " } if (errors === "; - if ($top) { - out += "0"; - } else { - out += "errs_" + $lvl; - } - out += ") { "; - $closingBraces2 += "}"; - } - } else { - var arr2 = it.RULES; - if (arr2) { - var $rulesGroup, i2 = -1, l2 = arr2.length - 1; - while (i2 < l2) { - $rulesGroup = arr2[i2 += 1]; - if ($shouldUseGroup($rulesGroup)) { - if ($rulesGroup.type) { - out += " if (" + it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers) + ") { "; - } - if (it.opts.useDefaults) { - if ($rulesGroup.type == "object" && it.schema.properties) { - var $schema2 = it.schema.properties, $schemaKeys = Object.keys($schema2); - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema2[$propertyKey]; - if ($sch.default !== void 0) { - var $passData = $data + it.util.getProperty($propertyKey); - if (it.compositeRule) { - if (it.opts.strictDefaults) { - var $defaultMsg = "default is ignored for: " + $passData; - if (it.opts.strictDefaults === "log") - it.logger.warn($defaultMsg); - else - throw new Error($defaultMsg); - } - } else { - out += " if (" + $passData + " === undefined "; - if (it.opts.useDefaults == "empty") { - out += " || " + $passData + " === null || " + $passData + " === '' "; - } - out += " ) " + $passData + " = "; - if (it.opts.useDefaults == "shared") { - out += " " + it.useDefault($sch.default) + " "; - } else { - out += " " + JSON.stringify($sch.default) + " "; - } - out += "; "; - } - } - } - } - } else if ($rulesGroup.type == "array" && Array.isArray(it.schema.items)) { - var arr4 = it.schema.items; - if (arr4) { - var $sch, $i = -1, l4 = arr4.length - 1; - while ($i < l4) { - $sch = arr4[$i += 1]; - if ($sch.default !== void 0) { - var $passData = $data + "[" + $i + "]"; - if (it.compositeRule) { - if (it.opts.strictDefaults) { - var $defaultMsg = "default is ignored for: " + $passData; - if (it.opts.strictDefaults === "log") - it.logger.warn($defaultMsg); - else - throw new Error($defaultMsg); - } - } else { - out += " if (" + $passData + " === undefined "; - if (it.opts.useDefaults == "empty") { - out += " || " + $passData + " === null || " + $passData + " === '' "; - } - out += " ) " + $passData + " = "; - if (it.opts.useDefaults == "shared") { - out += " " + it.useDefault($sch.default) + " "; - } else { - out += " " + JSON.stringify($sch.default) + " "; - } - out += "; "; - } - } - } - } - } - } - var arr5 = $rulesGroup.rules; - if (arr5) { - var $rule, i5 = -1, l5 = arr5.length - 1; - while (i5 < l5) { - $rule = arr5[i5 += 1]; - if ($shouldUseRule($rule)) { - var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); - if ($code) { - out += " " + $code + " "; - if ($breakOnError) { - $closingBraces1 += "}"; - } - } - } - } - } - if ($breakOnError) { - out += " " + $closingBraces1 + " "; - $closingBraces1 = ""; - } - if ($rulesGroup.type) { - out += " } "; - if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { - out += " else { "; - var $schemaPath = it.schemaPath + ".type", $errSchemaPath = it.errSchemaPath + "/type"; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: '" + ($errorKeyword || "type") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { type: '"; - if ($typeIsArray) { - out += "" + $typeSchema.join(","); - } else { - out += "" + $typeSchema; - } - out += "' } "; - if (it.opts.messages !== false) { - out += " , message: 'should be "; - if ($typeIsArray) { - out += "" + $typeSchema.join(","); - } else { - out += "" + $typeSchema; - } - out += "' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " } "; - } - } - if ($breakOnError) { - out += " if (errors === "; - if ($top) { - out += "0"; - } else { - out += "errs_" + $lvl; - } - out += ") { "; - $closingBraces2 += "}"; - } - } - } - } - } - if ($breakOnError) { - out += " " + $closingBraces2 + " "; - } - if ($top) { - if ($async) { - out += " if (errors === 0) return data; "; - out += " else throw new ValidationError(vErrors); "; - } else { - out += " validate.errors = vErrors; "; - out += " return errors === 0; "; - } - out += " }; return validate;"; - } else { - out += " var " + $valid + " = errors === errs_" + $lvl + ";"; - } - function $shouldUseGroup($rulesGroup2) { - var rules3 = $rulesGroup2.rules; - for (var i = 0; i < rules3.length; i++) - if ($shouldUseRule(rules3[i])) - return true; - } - function $shouldUseRule($rule2) { - return it.schema[$rule2.keyword] !== void 0 || $rule2.implements && $ruleImplementsSomeKeyword($rule2); - } - function $ruleImplementsSomeKeyword($rule2) { - var impl = $rule2.implements; - for (var i = 0; i < impl.length; i++) - if (it.schema[impl[i]] !== void 0) - return true; - } - return out; -}; -var resolve$1 = resolve_1, util$2 = util$5, errorClasses$1 = error_classes, stableStringify$1 = fastJsonStableStringify; -var validateGenerator = validate$1; -var ucs2length2 = util$2.ucs2length; -var equal2 = fastDeepEqual; -var ValidationError = errorClasses$1.Validation; -var compile_1 = compile$1; -function compile$1(schema, root, localRefs, baseId) { - var self2 = this, opts = this._opts, refVal = [void 0], refs = {}, patterns = [], patternsHash = {}, defaults = [], defaultsHash = {}, customRules = []; - root = root || { schema, refVal, refs }; - var c = checkCompiling.call(this, schema, root, baseId); - var compilation = this._compilations[c.index]; - if (c.compiling) - return compilation.callValidate = callValidate; - var formats2 = this._formats; - var RULES = this.RULES; - try { - var v = localCompile(schema, root, localRefs, baseId); - compilation.validate = v; - var cv = compilation.callValidate; - if (cv) { - cv.schema = v.schema; - cv.errors = null; - cv.refs = v.refs; - cv.refVal = v.refVal; - cv.root = v.root; - cv.$async = v.$async; - if (opts.sourceCode) - cv.source = v.source; - } - return v; - } finally { - endCompiling.call(this, schema, root, baseId); - } - function callValidate() { - var validate2 = compilation.validate; - var result = validate2.apply(this, arguments); - callValidate.errors = validate2.errors; - return result; - } - function localCompile(_schema, _root, localRefs2, baseId2) { - var isRoot = !_root || _root && _root.schema == _schema; - if (_root.schema != root.schema) - return compile$1.call(self2, _schema, _root, localRefs2, baseId2); - var $async = _schema.$async === true; - var sourceCode = validateGenerator({ - isTop: true, - schema: _schema, - isRoot, - baseId: baseId2, - root: _root, - schemaPath: "", - errSchemaPath: "#", - errorPath: '""', - MissingRefError: errorClasses$1.MissingRef, - RULES, - validate: validateGenerator, - util: util$2, - resolve: resolve$1, - resolveRef, - usePattern, - useDefault, - useCustomRule, - opts, - formats: formats2, - logger: self2.logger, - self: self2 - }); - sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) + vars(defaults, defaultCode) + vars(customRules, customRuleCode$1) + sourceCode; - if (opts.processCode) - sourceCode = opts.processCode(sourceCode, _schema); - var validate2; - try { - var makeValidate = new Function( - "self", - "RULES", - "formats", - "root", - "refVal", - "defaults", - "customRules", - "equal", - "ucs2length", - "ValidationError", - sourceCode - ); - validate2 = makeValidate( - self2, - RULES, - formats2, - root, - refVal, - defaults, - customRules, - equal2, - ucs2length2, - ValidationError - ); - refVal[0] = validate2; - } catch (e) { - self2.logger.error("Error compiling schema, function code:", sourceCode); - throw e; - } - validate2.schema = _schema; - validate2.errors = null; - validate2.refs = refs; - validate2.refVal = refVal; - validate2.root = isRoot ? validate2 : _root; - if ($async) - validate2.$async = true; - if (opts.sourceCode === true) { - validate2.source = { - code: sourceCode, - patterns, - defaults - }; - } - return validate2; - } - function resolveRef(baseId2, ref2, isRoot) { - ref2 = resolve$1.url(baseId2, ref2); - var refIndex = refs[ref2]; - var _refVal, refCode; - if (refIndex !== void 0) { - _refVal = refVal[refIndex]; - refCode = "refVal[" + refIndex + "]"; - return resolvedRef(_refVal, refCode); - } - if (!isRoot && root.refs) { - var rootRefId = root.refs[ref2]; - if (rootRefId !== void 0) { - _refVal = root.refVal[rootRefId]; - refCode = addLocalRef(ref2, _refVal); - return resolvedRef(_refVal, refCode); - } - } - refCode = addLocalRef(ref2); - var v2 = resolve$1.call(self2, localCompile, root, ref2); - if (v2 === void 0) { - var localSchema = localRefs && localRefs[ref2]; - if (localSchema) { - v2 = resolve$1.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile$1.call(self2, localSchema, root, localRefs, baseId2); - } - } - if (v2 === void 0) { - removeLocalRef(ref2); - } else { - replaceLocalRef(ref2, v2); - return resolvedRef(v2, refCode); - } - } - function addLocalRef(ref2, v2) { - var refId = refVal.length; - refVal[refId] = v2; - refs[ref2] = refId; - return "refVal" + refId; - } - function removeLocalRef(ref2) { - delete refs[ref2]; - } - function replaceLocalRef(ref2, v2) { - var refId = refs[ref2]; - refVal[refId] = v2; - } - function resolvedRef(refVal2, code) { - return typeof refVal2 == "object" || typeof refVal2 == "boolean" ? { code, schema: refVal2, inline: true } : { code, $async: refVal2 && !!refVal2.$async }; - } - function usePattern(regexStr) { - var index = patternsHash[regexStr]; - if (index === void 0) { - index = patternsHash[regexStr] = patterns.length; - patterns[index] = regexStr; - } - return "pattern" + index; - } - function useDefault(value) { - switch (typeof value) { - case "boolean": - case "number": - return "" + value; - case "string": - return util$2.toQuotedString(value); - case "object": - if (value === null) - return "null"; - var valueStr = stableStringify$1(value); - var index = defaultsHash[valueStr]; - if (index === void 0) { - index = defaultsHash[valueStr] = defaults.length; - defaults[index] = value; - } - return "default" + index; - } - } - function useCustomRule(rule, schema2, parentSchema, it) { - if (self2._opts.validateSchema !== false) { - var deps = rule.definition.dependencies; - if (deps && !deps.every(function(keyword2) { - return Object.prototype.hasOwnProperty.call(parentSchema, keyword2); - })) - throw new Error("parent schema must have all required keywords: " + deps.join(",")); - var validateSchema2 = rule.definition.validateSchema; - if (validateSchema2) { - var valid = validateSchema2(schema2); - if (!valid) { - var message = "keyword schema is invalid: " + self2.errorsText(validateSchema2.errors); - if (self2._opts.validateSchema == "log") - self2.logger.error(message); - else - throw new Error(message); - } - } - } - var compile2 = rule.definition.compile, inline = rule.definition.inline, macro = rule.definition.macro; - var validate2; - if (compile2) { - validate2 = compile2.call(self2, schema2, parentSchema, it); - } else if (macro) { - validate2 = macro.call(self2, schema2, parentSchema, it); - if (opts.validateSchema !== false) - self2.validateSchema(validate2, true); - } else if (inline) { - validate2 = inline.call(self2, it, rule.keyword, schema2, parentSchema); - } else { - validate2 = rule.definition.validate; - if (!validate2) - return; - } - if (validate2 === void 0) - throw new Error('custom keyword "' + rule.keyword + '"failed to compile'); - var index = customRules.length; - customRules[index] = validate2; - return { - code: "customRule" + index, - validate: validate2 - }; - } -} -function checkCompiling(schema, root, baseId) { - var index = compIndex.call(this, schema, root, baseId); - if (index >= 0) - return { index, compiling: true }; - index = this._compilations.length; - this._compilations[index] = { - schema, - root, - baseId - }; - return { index, compiling: false }; -} -function endCompiling(schema, root, baseId) { - var i = compIndex.call(this, schema, root, baseId); - if (i >= 0) - this._compilations.splice(i, 1); -} -function compIndex(schema, root, baseId) { - for (var i = 0; i < this._compilations.length; i++) { - var c = this._compilations[i]; - if (c.schema == schema && c.root == root && c.baseId == baseId) - return i; - } - return -1; -} -function patternCode(i, patterns) { - return "var pattern" + i + " = new RegExp(" + util$2.toQuotedString(patterns[i]) + ");"; -} -function defaultCode(i) { - return "var default" + i + " = defaults[" + i + "];"; -} -function refValCode(i, refVal) { - return refVal[i] === void 0 ? "" : "var refVal" + i + " = refVal[" + i + "];"; -} -function customRuleCode$1(i) { - return "var customRule" + i + " = customRules[" + i + "];"; -} -function vars(arr, statement) { - if (!arr.length) - return ""; - var code = ""; - for (var i = 0; i < arr.length; i++) - code += statement(i, arr); - return code; -} -var cache = { exports: {} }; -var Cache$1 = cache.exports = function Cache() { - this._cache = {}; -}; -Cache$1.prototype.put = function Cache_put(key, value) { - this._cache[key] = value; -}; -Cache$1.prototype.get = function Cache_get(key) { - return this._cache[key]; -}; -Cache$1.prototype.del = function Cache_del(key) { - delete this._cache[key]; -}; -Cache$1.prototype.clear = function Cache_clear() { - this._cache = {}; -}; -var cacheExports = cache.exports; -var util$1 = util$5; -var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; -var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; -var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i; -var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i; -var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=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=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; -var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i; -var URL$1 = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; -var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i; -var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/; -var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i; -var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/; -var formats_1 = formats$1; -function formats$1(mode) { - mode = mode == "full" ? "full" : "fast"; - return util$1.copy(formats$1[mode]); -} -formats$1.fast = { - // date: http://tools.ietf.org/html/rfc3339#section-5.6 - date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/, - // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 - time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, - "date-time": /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, - // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js - uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, - "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, - "uri-template": URITEMPLATE, - url: URL$1, - // email (sources from jsen validator): - // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 - // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation') - email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, - hostname: HOSTNAME, - // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex, - // uuid: http://tools.ietf.org/html/rfc4122 - uuid: UUID, - // JSON-pointer: https://tools.ietf.org/html/rfc6901 - // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A - "json-pointer": JSON_POINTER, - "json-pointer-uri-fragment": JSON_POINTER_URI_FRAGMENT, - // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 - "relative-json-pointer": RELATIVE_JSON_POINTER -}; -formats$1.full = { - date, - time, - "date-time": date_time, - uri, - "uri-reference": URIREF, - "uri-template": URITEMPLATE, - url: URL$1, - email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, - hostname: HOSTNAME, - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex, - uuid: UUID, - "json-pointer": JSON_POINTER, - "json-pointer-uri-fragment": JSON_POINTER_URI_FRAGMENT, - "relative-json-pointer": RELATIVE_JSON_POINTER -}; -function isLeapYear(year) { - return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); -} -function date(str) { - var matches = str.match(DATE); - if (!matches) - return false; - var year = +matches[1]; - var month = +matches[2]; - var day = +matches[3]; - return month >= 1 && month <= 12 && day >= 1 && day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]); -} -function time(str, full) { - var matches = str.match(TIME); - if (!matches) - return false; - var hour = matches[1]; - var minute = matches[2]; - var second = matches[3]; - var timeZone = matches[5]; - return (hour <= 23 && minute <= 59 && second <= 59 || hour == 23 && minute == 59 && second == 60) && (!full || timeZone); -} -var DATE_TIME_SEPARATOR = /t|\s/i; -function date_time(str) { - var dateTime = str.split(DATE_TIME_SEPARATOR); - return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true); -} -var NOT_URI_FRAGMENT = /\/|:/; -function uri(str) { - return NOT_URI_FRAGMENT.test(str) && URI.test(str); -} -var Z_ANCHOR = /[^\\]\\Z/; -function regex(str) { - if (Z_ANCHOR.test(str)) - return false; - try { - new RegExp(str); - return true; - } catch (e) { - return false; - } -} -var ref = function generate_ref(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $valid = "valid" + $lvl; - var $async, $refCode; - if ($schema2 == "#" || $schema2 == "#/") { - if (it.isRoot) { - $async = it.async; - $refCode = "validate"; - } else { - $async = it.root.schema.$async === true; - $refCode = "root.refVal[0]"; - } - } else { - var $refVal = it.resolveRef(it.baseId, $schema2, it.isRoot); - if ($refVal === void 0) { - var $message = it.MissingRefError.message(it.baseId, $schema2); - if (it.opts.missingRefs == "fail") { - it.logger.error($message); - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: '$ref' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { ref: '" + it.util.escapeQuotes($schema2) + "' } "; - if (it.opts.messages !== false) { - out += " , message: 'can\\'t resolve reference " + it.util.escapeQuotes($schema2) + "' "; - } - if (it.opts.verbose) { - out += " , schema: " + it.util.toQuotedString($schema2) + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - if ($breakOnError) { - out += " if (false) { "; - } - } else if (it.opts.missingRefs == "ignore") { - it.logger.warn($message); - if ($breakOnError) { - out += " if (true) { "; - } - } else { - throw new it.MissingRefError(it.baseId, $schema2, $message); - } - } else if ($refVal.inline) { - var $it = it.util.copy(it); - $it.level++; - var $nextValid = "valid" + $it.level; - $it.schema = $refVal.schema; - $it.schemaPath = ""; - $it.errSchemaPath = $schema2; - var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); - out += " " + $code + " "; - if ($breakOnError) { - out += " if (" + $nextValid + ") { "; - } - } else { - $async = $refVal.$async === true || it.async && $refVal.$async !== false; - $refCode = $refVal.code; - } - } - if ($refCode) { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.opts.passContext) { - out += " " + $refCode + ".call(this, "; - } else { - out += " " + $refCode + "( "; - } - out += " " + $data + ", (dataPath || '')"; - if (it.errorPath != '""') { - out += " + " + it.errorPath; - } - var $parentData = $dataLvl ? "data" + ($dataLvl - 1 || "") : "parentData", $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : "parentDataProperty"; - out += " , " + $parentData + " , " + $parentDataProperty + ", rootData) "; - var __callValidate = out; - out = $$outStack.pop(); - if ($async) { - if (!it.async) - throw new Error("async schema referenced by sync schema"); - if ($breakOnError) { - out += " var " + $valid + "; "; - } - out += " try { await " + __callValidate + "; "; - if ($breakOnError) { - out += " " + $valid + " = true; "; - } - out += " } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; "; - if ($breakOnError) { - out += " " + $valid + " = false; "; - } - out += " } "; - if ($breakOnError) { - out += " if (" + $valid + ") { "; - } - } else { - out += " if (!" + __callValidate + ") { if (vErrors === null) vErrors = " + $refCode + ".errors; else vErrors = vErrors.concat(" + $refCode + ".errors); errors = vErrors.length; } "; - if ($breakOnError) { - out += " else { "; - } - } - } - return out; -}; -var allOf = function generate_allOf(it, $keyword, $ruleType) { - var out = " "; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $it = it.util.copy(it); - var $closingBraces = ""; - $it.level++; - var $nextValid = "valid" + $it.level; - var $currentBaseId = $it.baseId, $allSchemasEmpty = true; - var arr1 = $schema2; - if (arr1) { - var $sch, $i = -1, l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { - $allSchemasEmpty = false; - $it.schema = $sch; - $it.schemaPath = $schemaPath + "[" + $i + "]"; - $it.errSchemaPath = $errSchemaPath + "/" + $i; - out += " " + it.validate($it) + " "; - $it.baseId = $currentBaseId; - if ($breakOnError) { - out += " if (" + $nextValid + ") { "; - $closingBraces += "}"; - } - } - } - } - if ($breakOnError) { - if ($allSchemasEmpty) { - out += " if (true) { "; - } else { - out += " " + $closingBraces.slice(0, -1) + " "; - } - } - return out; -}; -var anyOf = function generate_anyOf(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $valid = "valid" + $lvl; - var $errs = "errs__" + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ""; - $it.level++; - var $nextValid = "valid" + $it.level; - var $noEmptySchema = $schema2.every(function($sch2) { - return it.opts.strictKeywords ? typeof $sch2 == "object" && Object.keys($sch2).length > 0 || $sch2 === false : it.util.schemaHasRules($sch2, it.RULES.all); - }); - if ($noEmptySchema) { - var $currentBaseId = $it.baseId; - out += " var " + $errs + " = errors; var " + $valid + " = false; "; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema2; - if (arr1) { - var $sch, $i = -1, l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - $it.schema = $sch; - $it.schemaPath = $schemaPath + "[" + $i + "]"; - $it.errSchemaPath = $errSchemaPath + "/" + $i; - out += " " + it.validate($it) + " "; - $it.baseId = $currentBaseId; - out += " " + $valid + " = " + $valid + " || " + $nextValid + "; if (!" + $valid + ") { "; - $closingBraces += "}"; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += " " + $closingBraces + " if (!" + $valid + ") { var err = "; - if (it.createErrors !== false) { - out += " { keyword: 'anyOf' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; - if (it.opts.messages !== false) { - out += " , message: 'should match some schema in anyOf' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError(vErrors); "; - } else { - out += " validate.errors = vErrors; return false; "; - } - } - out += " } else { errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } "; - if (it.opts.allErrors) { - out += " } "; - } - } else { - if ($breakOnError) { - out += " if (true) { "; - } - } - return out; -}; -var comment = function generate_comment(it, $keyword, $ruleType) { - var out = " "; - var $schema2 = it.schema[$keyword]; - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - !it.opts.allErrors; - var $comment = it.util.toQuotedString($schema2); - if (it.opts.$comment === true) { - out += " console.log(" + $comment + ");"; - } else if (typeof it.opts.$comment == "function") { - out += " self._opts.$comment(" + $comment + ", " + it.util.toQuotedString($errSchemaPath) + ", validate.root.schema);"; - } - return out; -}; -var _const = function generate_const(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $valid = "valid" + $lvl; - var $isData = it.opts.$data && $schema2 && $schema2.$data; - if ($isData) { - out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; - } - if (!$isData) { - out += " var schema" + $lvl + " = validate.schema" + $schemaPath + ";"; - } - out += "var " + $valid + " = equal(" + $data + ", schema" + $lvl + "); if (!" + $valid + ") { "; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'const' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { allowedValue: schema" + $lvl + " } "; - if (it.opts.messages !== false) { - out += " , message: 'should be equal to constant' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " }"; - if ($breakOnError) { - out += " else { "; - } - return out; -}; -var contains = function generate_contains(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $valid = "valid" + $lvl; - var $errs = "errs__" + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ""; - $it.level++; - var $nextValid = "valid" + $it.level; - var $idx = "i" + $lvl, $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $currentBaseId = it.baseId, $nonEmptySchema = it.opts.strictKeywords ? typeof $schema2 == "object" && Object.keys($schema2).length > 0 || $schema2 === false : it.util.schemaHasRules($schema2, it.RULES.all); - out += "var " + $errs + " = errors;var " + $valid + ";"; - if ($nonEmptySchema) { - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $schema2; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += " var " + $nextValid + " = false; for (var " + $idx + " = 0; " + $idx + " < " + $data + ".length; " + $idx + "++) { "; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + "[" + $idx + "]"; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += " " + it.util.varReplace($code, $nextData, $passData) + " "; - } else { - out += " var " + $nextData + " = " + $passData + "; " + $code + " "; - } - out += " if (" + $nextValid + ") break; } "; - it.compositeRule = $it.compositeRule = $wasComposite; - out += " " + $closingBraces + " if (!" + $nextValid + ") {"; - } else { - out += " if (" + $data + ".length == 0) {"; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'contains' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; - if (it.opts.messages !== false) { - out += " , message: 'should contain a valid item' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " } else { "; - if ($nonEmptySchema) { - out += " errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } "; - } - if (it.opts.allErrors) { - out += " } "; - } - return out; -}; -var dependencies = function generate_dependencies(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $errs = "errs__" + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ""; - $it.level++; - var $nextValid = "valid" + $it.level; - var $schemaDeps = {}, $propertyDeps = {}, $ownProperties = it.opts.ownProperties; - for ($property in $schema2) { - if ($property == "__proto__") - continue; - var $sch = $schema2[$property]; - var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps; - $deps[$property] = $sch; - } - out += "var " + $errs + " = errors;"; - var $currentErrorPath = it.errorPath; - out += "var missing" + $lvl + ";"; - for (var $property in $propertyDeps) { - $deps = $propertyDeps[$property]; - if ($deps.length) { - out += " if ( " + $data + it.util.getProperty($property) + " !== undefined "; - if ($ownProperties) { - out += " && Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($property) + "') "; - } - if ($breakOnError) { - out += " && ( "; - var arr1 = $deps; - if (arr1) { - var $propertyKey, $i = -1, l1 = arr1.length - 1; - while ($i < l1) { - $propertyKey = arr1[$i += 1]; - if ($i) { - out += " || "; - } - var $prop = it.util.getProperty($propertyKey), $useData = $data + $prop; - out += " ( ( " + $useData + " === undefined "; - if ($ownProperties) { - out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; - } - out += ") && (missing" + $lvl + " = " + it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) + ") ) "; - } - } - out += ")) { "; - var $propertyPath = "missing" + $lvl, $missingProperty = "' + " + $propertyPath + " + '"; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + " + " + $propertyPath; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'dependencies' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { property: '" + it.util.escapeQuotes($property) + "', missingProperty: '" + $missingProperty + "', depsCount: " + $deps.length + ", deps: '" + it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", ")) + "' } "; - if (it.opts.messages !== false) { - out += " , message: 'should have "; - if ($deps.length == 1) { - out += "property " + it.util.escapeQuotes($deps[0]); - } else { - out += "properties " + it.util.escapeQuotes($deps.join(", ")); - } - out += " when property " + it.util.escapeQuotes($property) + " is present' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - } else { - out += " ) { "; - var arr2 = $deps; - if (arr2) { - var $propertyKey, i2 = -1, l2 = arr2.length - 1; - while (i2 < l2) { - $propertyKey = arr2[i2 += 1]; - var $prop = it.util.getProperty($propertyKey), $missingProperty = it.util.escapeQuotes($propertyKey), $useData = $data + $prop; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - out += " if ( " + $useData + " === undefined "; - if ($ownProperties) { - out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; - } - out += ") { var err = "; - if (it.createErrors !== false) { - out += " { keyword: 'dependencies' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { property: '" + it.util.escapeQuotes($property) + "', missingProperty: '" + $missingProperty + "', depsCount: " + $deps.length + ", deps: '" + it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", ")) + "' } "; - if (it.opts.messages !== false) { - out += " , message: 'should have "; - if ($deps.length == 1) { - out += "property " + it.util.escapeQuotes($deps[0]); - } else { - out += "properties " + it.util.escapeQuotes($deps.join(", ")); - } - out += " when property " + it.util.escapeQuotes($property) + " is present' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "; - } - } - } - out += " } "; - if ($breakOnError) { - $closingBraces += "}"; - out += " else { "; - } - } - } - it.errorPath = $currentErrorPath; - var $currentBaseId = $it.baseId; - for (var $property in $schemaDeps) { - var $sch = $schemaDeps[$property]; - if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { - out += " " + $nextValid + " = true; if ( " + $data + it.util.getProperty($property) + " !== undefined "; - if ($ownProperties) { - out += " && Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($property) + "') "; - } - out += ") { "; - $it.schema = $sch; - $it.schemaPath = $schemaPath + it.util.getProperty($property); - $it.errSchemaPath = $errSchemaPath + "/" + it.util.escapeFragment($property); - out += " " + it.validate($it) + " "; - $it.baseId = $currentBaseId; - out += " } "; - if ($breakOnError) { - out += " if (" + $nextValid + ") { "; - $closingBraces += "}"; - } - } - } - if ($breakOnError) { - out += " " + $closingBraces + " if (" + $errs + " == errors) {"; - } - return out; -}; -var _enum = function generate_enum(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $valid = "valid" + $lvl; - var $isData = it.opts.$data && $schema2 && $schema2.$data; - if ($isData) { - out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; - } - var $i = "i" + $lvl, $vSchema = "schema" + $lvl; - if (!$isData) { - out += " var " + $vSchema + " = validate.schema" + $schemaPath + ";"; - } - out += "var " + $valid + ";"; - if ($isData) { - out += " if (schema" + $lvl + " === undefined) " + $valid + " = true; else if (!Array.isArray(schema" + $lvl + ")) " + $valid + " = false; else {"; - } - out += "" + $valid + " = false;for (var " + $i + "=0; " + $i + "<" + $vSchema + ".length; " + $i + "++) if (equal(" + $data + ", " + $vSchema + "[" + $i + "])) { " + $valid + " = true; break; }"; - if ($isData) { - out += " } "; - } - out += " if (!" + $valid + ") { "; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'enum' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { allowedValues: schema" + $lvl + " } "; - if (it.opts.messages !== false) { - out += " , message: 'should be equal to one of the allowed values' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " }"; - if ($breakOnError) { - out += " else { "; - } - return out; -}; -var format = function generate_format(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - if (it.opts.format === false) { - if ($breakOnError) { - out += " if (true) { "; - } - return out; - } - var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; - if ($isData) { - out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; - $schemaValue = "schema" + $lvl; - } else { - $schemaValue = $schema2; - } - var $unknownFormats = it.opts.unknownFormats, $allowUnknown = Array.isArray($unknownFormats); - if ($isData) { - var $format = "format" + $lvl, $isObject = "isObject" + $lvl, $formatType = "formatType" + $lvl; - out += " var " + $format + " = formats[" + $schemaValue + "]; var " + $isObject + " = typeof " + $format + " == 'object' && !(" + $format + " instanceof RegExp) && " + $format + ".validate; var " + $formatType + " = " + $isObject + " && " + $format + ".type || 'string'; if (" + $isObject + ") { "; - if (it.async) { - out += " var async" + $lvl + " = " + $format + ".async; "; - } - out += " " + $format + " = " + $format + ".validate; } if ( "; - if ($isData) { - out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'string') || "; - } - out += " ("; - if ($unknownFormats != "ignore") { - out += " (" + $schemaValue + " && !" + $format + " "; - if ($allowUnknown) { - out += " && self._opts.unknownFormats.indexOf(" + $schemaValue + ") == -1 "; - } - out += ") || "; - } - out += " (" + $format + " && " + $formatType + " == '" + $ruleType + "' && !(typeof " + $format + " == 'function' ? "; - if (it.async) { - out += " (async" + $lvl + " ? await " + $format + "(" + $data + ") : " + $format + "(" + $data + ")) "; - } else { - out += " " + $format + "(" + $data + ") "; - } - out += " : " + $format + ".test(" + $data + "))))) {"; - } else { - var $format = it.formats[$schema2]; - if (!$format) { - if ($unknownFormats == "ignore") { - it.logger.warn('unknown format "' + $schema2 + '" ignored in schema at path "' + it.errSchemaPath + '"'); - if ($breakOnError) { - out += " if (true) { "; - } - return out; - } else if ($allowUnknown && $unknownFormats.indexOf($schema2) >= 0) { - if ($breakOnError) { - out += " if (true) { "; - } - return out; - } else { - throw new Error('unknown format "' + $schema2 + '" is used in schema at path "' + it.errSchemaPath + '"'); - } - } - var $isObject = typeof $format == "object" && !($format instanceof RegExp) && $format.validate; - var $formatType = $isObject && $format.type || "string"; - if ($isObject) { - var $async = $format.async === true; - $format = $format.validate; - } - if ($formatType != $ruleType) { - if ($breakOnError) { - out += " if (true) { "; - } - return out; - } - if ($async) { - if (!it.async) - throw new Error("async format in sync schema"); - var $formatRef = "formats" + it.util.getProperty($schema2) + ".validate"; - out += " if (!(await " + $formatRef + "(" + $data + "))) { "; - } else { - out += " if (! "; - var $formatRef = "formats" + it.util.getProperty($schema2); - if ($isObject) - $formatRef += ".validate"; - if (typeof $format == "function") { - out += " " + $formatRef + "(" + $data + ") "; - } else { - out += " " + $formatRef + ".test(" + $data + ") "; - } - out += ") { "; - } - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'format' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { format: "; - if ($isData) { - out += "" + $schemaValue; - } else { - out += "" + it.util.toQuotedString($schema2); - } - out += " } "; - if (it.opts.messages !== false) { - out += ` , message: 'should match format "`; - if ($isData) { - out += "' + " + $schemaValue + " + '"; - } else { - out += "" + it.util.escapeQuotes($schema2); - } - out += `"' `; - } - if (it.opts.verbose) { - out += " , schema: "; - if ($isData) { - out += "validate.schema" + $schemaPath; - } else { - out += "" + it.util.toQuotedString($schema2); - } - out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " } "; - if ($breakOnError) { - out += " else { "; - } - return out; -}; -var _if = function generate_if(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $valid = "valid" + $lvl; - var $errs = "errs__" + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = "valid" + $it.level; - var $thenSch = it.schema["then"], $elseSch = it.schema["else"], $thenPresent = $thenSch !== void 0 && (it.opts.strictKeywords ? typeof $thenSch == "object" && Object.keys($thenSch).length > 0 || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)), $elsePresent = $elseSch !== void 0 && (it.opts.strictKeywords ? typeof $elseSch == "object" && Object.keys($elseSch).length > 0 || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)), $currentBaseId = $it.baseId; - if ($thenPresent || $elsePresent) { - var $ifClause; - $it.createErrors = false; - $it.schema = $schema2; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += " var " + $errs + " = errors; var " + $valid + " = true; "; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - out += " " + it.validate($it) + " "; - $it.baseId = $currentBaseId; - $it.createErrors = true; - out += " errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } "; - it.compositeRule = $it.compositeRule = $wasComposite; - if ($thenPresent) { - out += " if (" + $nextValid + ") { "; - $it.schema = it.schema["then"]; - $it.schemaPath = it.schemaPath + ".then"; - $it.errSchemaPath = it.errSchemaPath + "/then"; - out += " " + it.validate($it) + " "; - $it.baseId = $currentBaseId; - out += " " + $valid + " = " + $nextValid + "; "; - if ($thenPresent && $elsePresent) { - $ifClause = "ifClause" + $lvl; - out += " var " + $ifClause + " = 'then'; "; - } else { - $ifClause = "'then'"; - } - out += " } "; - if ($elsePresent) { - out += " else { "; - } - } else { - out += " if (!" + $nextValid + ") { "; - } - if ($elsePresent) { - $it.schema = it.schema["else"]; - $it.schemaPath = it.schemaPath + ".else"; - $it.errSchemaPath = it.errSchemaPath + "/else"; - out += " " + it.validate($it) + " "; - $it.baseId = $currentBaseId; - out += " " + $valid + " = " + $nextValid + "; "; - if ($thenPresent && $elsePresent) { - $ifClause = "ifClause" + $lvl; - out += " var " + $ifClause + " = 'else'; "; - } else { - $ifClause = "'else'"; - } - out += " } "; - } - out += " if (!" + $valid + ") { var err = "; - if (it.createErrors !== false) { - out += " { keyword: 'if' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { failingKeyword: " + $ifClause + " } "; - if (it.opts.messages !== false) { - out += ` , message: 'should match "' + ` + $ifClause + ` + '" schema' `; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError(vErrors); "; - } else { - out += " validate.errors = vErrors; return false; "; - } - } - out += " } "; - if ($breakOnError) { - out += " else { "; - } - } else { - if ($breakOnError) { - out += " if (true) { "; - } - } - return out; -}; -var items = function generate_items(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $valid = "valid" + $lvl; - var $errs = "errs__" + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ""; - $it.level++; - var $nextValid = "valid" + $it.level; - var $idx = "i" + $lvl, $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $currentBaseId = it.baseId; - out += "var " + $errs + " = errors;var " + $valid + ";"; - if (Array.isArray($schema2)) { - var $additionalItems = it.schema.additionalItems; - if ($additionalItems === false) { - out += " " + $valid + " = " + $data + ".length <= " + $schema2.length + "; "; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + "/additionalItems"; - out += " if (!" + $valid + ") { "; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'additionalItems' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schema2.length + " } "; - if (it.opts.messages !== false) { - out += " , message: 'should NOT have more than " + $schema2.length + " items' "; - } - if (it.opts.verbose) { - out += " , schema: false , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " } "; - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - $closingBraces += "}"; - out += " else { "; - } - } - var arr1 = $schema2; - if (arr1) { - var $sch, $i = -1, l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { - out += " " + $nextValid + " = true; if (" + $data + ".length > " + $i + ") { "; - var $passData = $data + "[" + $i + "]"; - $it.schema = $sch; - $it.schemaPath = $schemaPath + "[" + $i + "]"; - $it.errSchemaPath = $errSchemaPath + "/" + $i; - $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); - $it.dataPathArr[$dataNxt] = $i; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += " " + it.util.varReplace($code, $nextData, $passData) + " "; - } else { - out += " var " + $nextData + " = " + $passData + "; " + $code + " "; - } - out += " } "; - if ($breakOnError) { - out += " if (" + $nextValid + ") { "; - $closingBraces += "}"; - } - } - } - } - if (typeof $additionalItems == "object" && (it.opts.strictKeywords ? typeof $additionalItems == "object" && Object.keys($additionalItems).length > 0 || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) { - $it.schema = $additionalItems; - $it.schemaPath = it.schemaPath + ".additionalItems"; - $it.errSchemaPath = it.errSchemaPath + "/additionalItems"; - out += " " + $nextValid + " = true; if (" + $data + ".length > " + $schema2.length + ") { for (var " + $idx + " = " + $schema2.length + "; " + $idx + " < " + $data + ".length; " + $idx + "++) { "; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + "[" + $idx + "]"; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += " " + it.util.varReplace($code, $nextData, $passData) + " "; - } else { - out += " var " + $nextData + " = " + $passData + "; " + $code + " "; - } - if ($breakOnError) { - out += " if (!" + $nextValid + ") break; "; - } - out += " } } "; - if ($breakOnError) { - out += " if (" + $nextValid + ") { "; - $closingBraces += "}"; - } - } - } else if (it.opts.strictKeywords ? typeof $schema2 == "object" && Object.keys($schema2).length > 0 || $schema2 === false : it.util.schemaHasRules($schema2, it.RULES.all)) { - $it.schema = $schema2; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += " for (var " + $idx + " = 0; " + $idx + " < " + $data + ".length; " + $idx + "++) { "; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + "[" + $idx + "]"; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += " " + it.util.varReplace($code, $nextData, $passData) + " "; - } else { - out += " var " + $nextData + " = " + $passData + "; " + $code + " "; - } - if ($breakOnError) { - out += " if (!" + $nextValid + ") break; "; - } - out += " }"; - } - if ($breakOnError) { - out += " " + $closingBraces + " if (" + $errs + " == errors) {"; - } - return out; -}; -var _limit = function generate__limit(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = "data" + ($dataLvl || ""); - var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; - if ($isData) { - out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; - $schemaValue = "schema" + $lvl; - } else { - $schemaValue = $schema2; - } - var $isMax = $keyword == "maximum", $exclusiveKeyword = $isMax ? "exclusiveMaximum" : "exclusiveMinimum", $schemaExcl = it.schema[$exclusiveKeyword], $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data, $op = $isMax ? "<" : ">", $notOp = $isMax ? ">" : "<", $errorKeyword = void 0; - if (!($isData || typeof $schema2 == "number" || $schema2 === void 0)) { - throw new Error($keyword + " must be number"); - } - if (!($isDataExcl || $schemaExcl === void 0 || typeof $schemaExcl == "number" || typeof $schemaExcl == "boolean")) { - throw new Error($exclusiveKeyword + " must be number or boolean"); - } - if ($isDataExcl) { - var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), $exclusive = "exclusive" + $lvl, $exclType = "exclType" + $lvl, $exclIsNumber = "exclIsNumber" + $lvl, $opExpr = "op" + $lvl, $opStr = "' + " + $opExpr + " + '"; - out += " var schemaExcl" + $lvl + " = " + $schemaValueExcl + "; "; - $schemaValueExcl = "schemaExcl" + $lvl; - out += " var " + $exclusive + "; var " + $exclType + " = typeof " + $schemaValueExcl + "; if (" + $exclType + " != 'boolean' && " + $exclType + " != 'undefined' && " + $exclType + " != 'number') { "; - var $errorKeyword = $exclusiveKeyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: '" + ($errorKeyword || "_exclusiveLimit") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; - if (it.opts.messages !== false) { - out += " , message: '" + $exclusiveKeyword + " should be boolean' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " } else if ( "; - if ($isData) { - out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; - } - out += " " + $exclType + " == 'number' ? ( (" + $exclusive + " = " + $schemaValue + " === undefined || " + $schemaValueExcl + " " + $op + "= " + $schemaValue + ") ? " + $data + " " + $notOp + "= " + $schemaValueExcl + " : " + $data + " " + $notOp + " " + $schemaValue + " ) : ( (" + $exclusive + " = " + $schemaValueExcl + " === true) ? " + $data + " " + $notOp + "= " + $schemaValue + " : " + $data + " " + $notOp + " " + $schemaValue + " ) || " + $data + " !== " + $data + ") { var op" + $lvl + " = " + $exclusive + " ? '" + $op + "' : '" + $op + "='; "; - if ($schema2 === void 0) { - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + "/" + $exclusiveKeyword; - $schemaValue = $schemaValueExcl; - $isData = $isDataExcl; - } - } else { - var $exclIsNumber = typeof $schemaExcl == "number", $opStr = $op; - if ($exclIsNumber && $isData) { - var $opExpr = "'" + $opStr + "'"; - out += " if ( "; - if ($isData) { - out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; - } - out += " ( " + $schemaValue + " === undefined || " + $schemaExcl + " " + $op + "= " + $schemaValue + " ? " + $data + " " + $notOp + "= " + $schemaExcl + " : " + $data + " " + $notOp + " " + $schemaValue + " ) || " + $data + " !== " + $data + ") { "; - } else { - if ($exclIsNumber && $schema2 === void 0) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + "/" + $exclusiveKeyword; - $schemaValue = $schemaExcl; - $notOp += "="; - } else { - if ($exclIsNumber) - $schemaValue = Math[$isMax ? "min" : "max"]($schemaExcl, $schema2); - if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + "/" + $exclusiveKeyword; - $notOp += "="; - } else { - $exclusive = false; - $opStr += "="; - } - } - var $opExpr = "'" + $opStr + "'"; - out += " if ( "; - if ($isData) { - out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; - } - out += " " + $data + " " + $notOp + " " + $schemaValue + " || " + $data + " !== " + $data + ") { "; - } - } - $errorKeyword = $errorKeyword || $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: '" + ($errorKeyword || "_limit") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { comparison: " + $opExpr + ", limit: " + $schemaValue + ", exclusive: " + $exclusive + " } "; - if (it.opts.messages !== false) { - out += " , message: 'should be " + $opStr + " "; - if ($isData) { - out += "' + " + $schemaValue; - } else { - out += "" + $schemaValue + "'"; - } - } - if (it.opts.verbose) { - out += " , schema: "; - if ($isData) { - out += "validate.schema" + $schemaPath; - } else { - out += "" + $schema2; - } - out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " } "; - if ($breakOnError) { - out += " else { "; - } - return out; -}; -var _limitItems = function generate__limitItems(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = "data" + ($dataLvl || ""); - var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; - if ($isData) { - out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; - $schemaValue = "schema" + $lvl; - } else { - $schemaValue = $schema2; - } - if (!($isData || typeof $schema2 == "number")) { - throw new Error($keyword + " must be number"); - } - var $op = $keyword == "maxItems" ? ">" : "<"; - out += "if ( "; - if ($isData) { - out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; - } - out += " " + $data + ".length " + $op + " " + $schemaValue + ") { "; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: '" + ($errorKeyword || "_limitItems") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schemaValue + " } "; - if (it.opts.messages !== false) { - out += " , message: 'should NOT have "; - if ($keyword == "maxItems") { - out += "more"; - } else { - out += "fewer"; - } - out += " than "; - if ($isData) { - out += "' + " + $schemaValue + " + '"; - } else { - out += "" + $schema2; - } - out += " items' "; - } - if (it.opts.verbose) { - out += " , schema: "; - if ($isData) { - out += "validate.schema" + $schemaPath; - } else { - out += "" + $schema2; - } - out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += "} "; - if ($breakOnError) { - out += " else { "; - } - return out; -}; -var _limitLength = function generate__limitLength(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = "data" + ($dataLvl || ""); - var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; - if ($isData) { - out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; - $schemaValue = "schema" + $lvl; - } else { - $schemaValue = $schema2; - } - if (!($isData || typeof $schema2 == "number")) { - throw new Error($keyword + " must be number"); - } - var $op = $keyword == "maxLength" ? ">" : "<"; - out += "if ( "; - if ($isData) { - out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; - } - if (it.opts.unicode === false) { - out += " " + $data + ".length "; - } else { - out += " ucs2length(" + $data + ") "; - } - out += " " + $op + " " + $schemaValue + ") { "; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: '" + ($errorKeyword || "_limitLength") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schemaValue + " } "; - if (it.opts.messages !== false) { - out += " , message: 'should NOT be "; - if ($keyword == "maxLength") { - out += "longer"; - } else { - out += "shorter"; - } - out += " than "; - if ($isData) { - out += "' + " + $schemaValue + " + '"; - } else { - out += "" + $schema2; - } - out += " characters' "; - } - if (it.opts.verbose) { - out += " , schema: "; - if ($isData) { - out += "validate.schema" + $schemaPath; - } else { - out += "" + $schema2; - } - out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += "} "; - if ($breakOnError) { - out += " else { "; - } - return out; -}; -var _limitProperties = function generate__limitProperties(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = "data" + ($dataLvl || ""); - var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; - if ($isData) { - out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; - $schemaValue = "schema" + $lvl; - } else { - $schemaValue = $schema2; - } - if (!($isData || typeof $schema2 == "number")) { - throw new Error($keyword + " must be number"); - } - var $op = $keyword == "maxProperties" ? ">" : "<"; - out += "if ( "; - if ($isData) { - out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'number') || "; - } - out += " Object.keys(" + $data + ").length " + $op + " " + $schemaValue + ") { "; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: '" + ($errorKeyword || "_limitProperties") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { limit: " + $schemaValue + " } "; - if (it.opts.messages !== false) { - out += " , message: 'should NOT have "; - if ($keyword == "maxProperties") { - out += "more"; - } else { - out += "fewer"; - } - out += " than "; - if ($isData) { - out += "' + " + $schemaValue + " + '"; - } else { - out += "" + $schema2; - } - out += " properties' "; - } - if (it.opts.verbose) { - out += " , schema: "; - if ($isData) { - out += "validate.schema" + $schemaPath; - } else { - out += "" + $schema2; - } - out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += "} "; - if ($breakOnError) { - out += " else { "; - } - return out; -}; -var multipleOf = function generate_multipleOf(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; - if ($isData) { - out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; - $schemaValue = "schema" + $lvl; - } else { - $schemaValue = $schema2; - } - if (!($isData || typeof $schema2 == "number")) { - throw new Error($keyword + " must be number"); - } - out += "var division" + $lvl + ";if ("; - if ($isData) { - out += " " + $schemaValue + " !== undefined && ( typeof " + $schemaValue + " != 'number' || "; - } - out += " (division" + $lvl + " = " + $data + " / " + $schemaValue + ", "; - if (it.opts.multipleOfPrecision) { - out += " Math.abs(Math.round(division" + $lvl + ") - division" + $lvl + ") > 1e-" + it.opts.multipleOfPrecision + " "; - } else { - out += " division" + $lvl + " !== parseInt(division" + $lvl + ") "; - } - out += " ) "; - if ($isData) { - out += " ) "; - } - out += " ) { "; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'multipleOf' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { multipleOf: " + $schemaValue + " } "; - if (it.opts.messages !== false) { - out += " , message: 'should be multiple of "; - if ($isData) { - out += "' + " + $schemaValue; - } else { - out += "" + $schemaValue + "'"; - } - } - if (it.opts.verbose) { - out += " , schema: "; - if ($isData) { - out += "validate.schema" + $schemaPath; - } else { - out += "" + $schema2; - } - out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += "} "; - if ($breakOnError) { - out += " else { "; - } - return out; -}; -var not = function generate_not(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $errs = "errs__" + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = "valid" + $it.level; - if (it.opts.strictKeywords ? typeof $schema2 == "object" && Object.keys($schema2).length > 0 || $schema2 === false : it.util.schemaHasRules($schema2, it.RULES.all)) { - $it.schema = $schema2; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += " var " + $errs + " = errors; "; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.createErrors = false; - var $allErrorsOption; - if ($it.opts.allErrors) { - $allErrorsOption = $it.opts.allErrors; - $it.opts.allErrors = false; - } - out += " " + it.validate($it) + " "; - $it.createErrors = true; - if ($allErrorsOption) - $it.opts.allErrors = $allErrorsOption; - it.compositeRule = $it.compositeRule = $wasComposite; - out += " if (" + $nextValid + ") { "; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'not' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; - if (it.opts.messages !== false) { - out += " , message: 'should NOT be valid' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " } else { errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; } "; - if (it.opts.allErrors) { - out += " } "; - } - } else { - out += " var err = "; - if (it.createErrors !== false) { - out += " { keyword: 'not' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: {} "; - if (it.opts.messages !== false) { - out += " , message: 'should NOT be valid' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - if ($breakOnError) { - out += " if (false) { "; - } - } - return out; -}; -var oneOf = function generate_oneOf(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $valid = "valid" + $lvl; - var $errs = "errs__" + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ""; - $it.level++; - var $nextValid = "valid" + $it.level; - var $currentBaseId = $it.baseId, $prevValid = "prevValid" + $lvl, $passingSchemas = "passingSchemas" + $lvl; - out += "var " + $errs + " = errors , " + $prevValid + " = false , " + $valid + " = false , " + $passingSchemas + " = null; "; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema2; - if (arr1) { - var $sch, $i = -1, l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { - $it.schema = $sch; - $it.schemaPath = $schemaPath + "[" + $i + "]"; - $it.errSchemaPath = $errSchemaPath + "/" + $i; - out += " " + it.validate($it) + " "; - $it.baseId = $currentBaseId; - } else { - out += " var " + $nextValid + " = true; "; - } - if ($i) { - out += " if (" + $nextValid + " && " + $prevValid + ") { " + $valid + " = false; " + $passingSchemas + " = [" + $passingSchemas + ", " + $i + "]; } else { "; - $closingBraces += "}"; - } - out += " if (" + $nextValid + ") { " + $valid + " = " + $prevValid + " = true; " + $passingSchemas + " = " + $i + "; }"; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += "" + $closingBraces + "if (!" + $valid + ") { var err = "; - if (it.createErrors !== false) { - out += " { keyword: 'oneOf' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { passingSchemas: " + $passingSchemas + " } "; - if (it.opts.messages !== false) { - out += " , message: 'should match exactly one schema in oneOf' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError(vErrors); "; - } else { - out += " validate.errors = vErrors; return false; "; - } - } - out += "} else { errors = " + $errs + "; if (vErrors !== null) { if (" + $errs + ") vErrors.length = " + $errs + "; else vErrors = null; }"; - if (it.opts.allErrors) { - out += " } "; - } - return out; -}; -var pattern = function generate_pattern(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; - if ($isData) { - out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; - $schemaValue = "schema" + $lvl; - } else { - $schemaValue = $schema2; - } - var $regexp = $isData ? "(new RegExp(" + $schemaValue + "))" : it.usePattern($schema2); - out += "if ( "; - if ($isData) { - out += " (" + $schemaValue + " !== undefined && typeof " + $schemaValue + " != 'string') || "; - } - out += " !" + $regexp + ".test(" + $data + ") ) { "; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'pattern' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { pattern: "; - if ($isData) { - out += "" + $schemaValue; - } else { - out += "" + it.util.toQuotedString($schema2); - } - out += " } "; - if (it.opts.messages !== false) { - out += ` , message: 'should match pattern "`; - if ($isData) { - out += "' + " + $schemaValue + " + '"; - } else { - out += "" + it.util.escapeQuotes($schema2); - } - out += `"' `; - } - if (it.opts.verbose) { - out += " , schema: "; - if ($isData) { - out += "validate.schema" + $schemaPath; - } else { - out += "" + it.util.toQuotedString($schema2); - } - out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += "} "; - if ($breakOnError) { - out += " else { "; - } - return out; -}; -var properties$2 = function generate_properties(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $errs = "errs__" + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ""; - $it.level++; - var $nextValid = "valid" + $it.level; - var $key = "key" + $lvl, $idx = "idx" + $lvl, $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $dataProperties = "dataProperties" + $lvl; - var $schemaKeys = Object.keys($schema2 || {}).filter(notProto), $pProperties = it.schema.patternProperties || {}, $pPropertyKeys = Object.keys($pProperties).filter(notProto), $aProperties = it.schema.additionalProperties, $someProperties = $schemaKeys.length || $pPropertyKeys.length, $noAdditional = $aProperties === false, $additionalIsSchema = typeof $aProperties == "object" && Object.keys($aProperties).length, $removeAdditional = it.opts.removeAdditional, $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, $ownProperties = it.opts.ownProperties, $currentBaseId = it.baseId; - var $required = it.schema.required; - if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) { - var $requiredHash = it.util.toHash($required); - } - function notProto(p) { - return p !== "__proto__"; - } - out += "var " + $errs + " = errors;var " + $nextValid + " = true;"; - if ($ownProperties) { - out += " var " + $dataProperties + " = undefined;"; - } - if ($checkAdditional) { - if ($ownProperties) { - out += " " + $dataProperties + " = " + $dataProperties + " || Object.keys(" + $data + "); for (var " + $idx + "=0; " + $idx + "<" + $dataProperties + ".length; " + $idx + "++) { var " + $key + " = " + $dataProperties + "[" + $idx + "]; "; - } else { - out += " for (var " + $key + " in " + $data + ") { "; - } - if ($someProperties) { - out += " var isAdditional" + $lvl + " = !(false "; - if ($schemaKeys.length) { - if ($schemaKeys.length > 8) { - out += " || validate.schema" + $schemaPath + ".hasOwnProperty(" + $key + ") "; - } else { - var arr1 = $schemaKeys; - if (arr1) { - var $propertyKey, i1 = -1, l1 = arr1.length - 1; - while (i1 < l1) { - $propertyKey = arr1[i1 += 1]; - out += " || " + $key + " == " + it.util.toQuotedString($propertyKey) + " "; - } - } - } - } - if ($pPropertyKeys.length) { - var arr2 = $pPropertyKeys; - if (arr2) { - var $pProperty, $i = -1, l2 = arr2.length - 1; - while ($i < l2) { - $pProperty = arr2[$i += 1]; - out += " || " + it.usePattern($pProperty) + ".test(" + $key + ") "; - } - } - } - out += " ); if (isAdditional" + $lvl + ") { "; - } - if ($removeAdditional == "all") { - out += " delete " + $data + "[" + $key + "]; "; - } else { - var $currentErrorPath = it.errorPath; - var $additionalProperty = "' + " + $key + " + '"; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - } - if ($noAdditional) { - if ($removeAdditional) { - out += " delete " + $data + "[" + $key + "]; "; - } else { - out += " " + $nextValid + " = false; "; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + "/additionalProperties"; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'additionalProperties' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { additionalProperty: '" + $additionalProperty + "' } "; - if (it.opts.messages !== false) { - out += " , message: '"; - if (it.opts._errorDataPathProperty) { - out += "is an invalid additional property"; - } else { - out += "should NOT have additional properties"; - } - out += "' "; - } - if (it.opts.verbose) { - out += " , schema: false , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - out += " break; "; - } - } - } else if ($additionalIsSchema) { - if ($removeAdditional == "failing") { - out += " var " + $errs + " = errors; "; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + ".additionalProperties"; - $it.errSchemaPath = it.errSchemaPath + "/additionalProperties"; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + "[" + $key + "]"; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += " " + it.util.varReplace($code, $nextData, $passData) + " "; - } else { - out += " var " + $nextData + " = " + $passData + "; " + $code + " "; - } - out += " if (!" + $nextValid + ") { errors = " + $errs + "; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete " + $data + "[" + $key + "]; } "; - it.compositeRule = $it.compositeRule = $wasComposite; - } else { - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + ".additionalProperties"; - $it.errSchemaPath = it.errSchemaPath + "/additionalProperties"; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + "[" + $key + "]"; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += " " + it.util.varReplace($code, $nextData, $passData) + " "; - } else { - out += " var " + $nextData + " = " + $passData + "; " + $code + " "; - } - if ($breakOnError) { - out += " if (!" + $nextValid + ") break; "; - } - } - } - it.errorPath = $currentErrorPath; - } - if ($someProperties) { - out += " } "; - } - out += " } "; - if ($breakOnError) { - out += " if (" + $nextValid + ") { "; - $closingBraces += "}"; - } - } - var $useDefaults = it.opts.useDefaults && !it.compositeRule; - if ($schemaKeys.length) { - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema2[$propertyKey]; - if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { - var $prop = it.util.getProperty($propertyKey), $passData = $data + $prop, $hasDefault = $useDefaults && $sch.default !== void 0; - $it.schema = $sch; - $it.schemaPath = $schemaPath + $prop; - $it.errSchemaPath = $errSchemaPath + "/" + it.util.escapeFragment($propertyKey); - $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); - $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - $code = it.util.varReplace($code, $nextData, $passData); - var $useData = $passData; - } else { - var $useData = $nextData; - out += " var " + $nextData + " = " + $passData + "; "; - } - if ($hasDefault) { - out += " " + $code + " "; - } else { - if ($requiredHash && $requiredHash[$propertyKey]) { - out += " if ( " + $useData + " === undefined "; - if ($ownProperties) { - out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; - } - out += ") { " + $nextValid + " = false; "; - var $currentErrorPath = it.errorPath, $currErrSchemaPath = $errSchemaPath, $missingProperty = it.util.escapeQuotes($propertyKey); - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - $errSchemaPath = it.errSchemaPath + "/required"; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; - if (it.opts.messages !== false) { - out += " , message: '"; - if (it.opts._errorDataPathProperty) { - out += "is a required property"; - } else { - out += "should have required property \\'" + $missingProperty + "\\'"; - } - out += "' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - $errSchemaPath = $currErrSchemaPath; - it.errorPath = $currentErrorPath; - out += " } else { "; - } else { - if ($breakOnError) { - out += " if ( " + $useData + " === undefined "; - if ($ownProperties) { - out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; - } - out += ") { " + $nextValid + " = true; } else { "; - } else { - out += " if (" + $useData + " !== undefined "; - if ($ownProperties) { - out += " && Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; - } - out += " ) { "; - } - } - out += " " + $code + " } "; - } - } - if ($breakOnError) { - out += " if (" + $nextValid + ") { "; - $closingBraces += "}"; - } - } - } - } - if ($pPropertyKeys.length) { - var arr4 = $pPropertyKeys; - if (arr4) { - var $pProperty, i4 = -1, l4 = arr4.length - 1; - while (i4 < l4) { - $pProperty = arr4[i4 += 1]; - var $sch = $pProperties[$pProperty]; - if (it.opts.strictKeywords ? typeof $sch == "object" && Object.keys($sch).length > 0 || $sch === false : it.util.schemaHasRules($sch, it.RULES.all)) { - $it.schema = $sch; - $it.schemaPath = it.schemaPath + ".patternProperties" + it.util.getProperty($pProperty); - $it.errSchemaPath = it.errSchemaPath + "/patternProperties/" + it.util.escapeFragment($pProperty); - if ($ownProperties) { - out += " " + $dataProperties + " = " + $dataProperties + " || Object.keys(" + $data + "); for (var " + $idx + "=0; " + $idx + "<" + $dataProperties + ".length; " + $idx + "++) { var " + $key + " = " + $dataProperties + "[" + $idx + "]; "; - } else { - out += " for (var " + $key + " in " + $data + ") { "; - } - out += " if (" + it.usePattern($pProperty) + ".test(" + $key + ")) { "; - $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + "[" + $key + "]"; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += " " + it.util.varReplace($code, $nextData, $passData) + " "; - } else { - out += " var " + $nextData + " = " + $passData + "; " + $code + " "; - } - if ($breakOnError) { - out += " if (!" + $nextValid + ") break; "; - } - out += " } "; - if ($breakOnError) { - out += " else " + $nextValid + " = true; "; - } - out += " } "; - if ($breakOnError) { - out += " if (" + $nextValid + ") { "; - $closingBraces += "}"; - } - } - } - } - } - if ($breakOnError) { - out += " " + $closingBraces + " if (" + $errs + " == errors) {"; - } - return out; -}; -var propertyNames = function generate_propertyNames(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $errs = "errs__" + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ""; - $it.level++; - var $nextValid = "valid" + $it.level; - out += "var " + $errs + " = errors;"; - if (it.opts.strictKeywords ? typeof $schema2 == "object" && Object.keys($schema2).length > 0 || $schema2 === false : it.util.schemaHasRules($schema2, it.RULES.all)) { - $it.schema = $schema2; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - var $key = "key" + $lvl, $idx = "idx" + $lvl, $i = "i" + $lvl, $invalidName = "' + " + $key + " + '", $dataNxt = $it.dataLevel = it.dataLevel + 1, $nextData = "data" + $dataNxt, $dataProperties = "dataProperties" + $lvl, $ownProperties = it.opts.ownProperties, $currentBaseId = it.baseId; - if ($ownProperties) { - out += " var " + $dataProperties + " = undefined; "; - } - if ($ownProperties) { - out += " " + $dataProperties + " = " + $dataProperties + " || Object.keys(" + $data + "); for (var " + $idx + "=0; " + $idx + "<" + $dataProperties + ".length; " + $idx + "++) { var " + $key + " = " + $dataProperties + "[" + $idx + "]; "; - } else { - out += " for (var " + $key + " in " + $data + ") { "; - } - out += " var startErrs" + $lvl + " = errors; "; - var $passData = $key; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += " " + it.util.varReplace($code, $nextData, $passData) + " "; - } else { - out += " var " + $nextData + " = " + $passData + "; " + $code + " "; - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += " if (!" + $nextValid + ") { for (var " + $i + "=startErrs" + $lvl + "; " + $i + " 0 || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) { - $required[$required.length] = $property; - } - } - } - } else { - var $required = $schema2; - } - } - if ($isData || $required.length) { - var $currentErrorPath = it.errorPath, $loopRequired = $isData || $required.length >= it.opts.loopRequired, $ownProperties = it.opts.ownProperties; - if ($breakOnError) { - out += " var missing" + $lvl + "; "; - if ($loopRequired) { - if (!$isData) { - out += " var " + $vSchema + " = validate.schema" + $schemaPath + "; "; - } - var $i = "i" + $lvl, $propertyPath = "schema" + $lvl + "[" + $i + "]", $missingProperty = "' + " + $propertyPath + " + '"; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - out += " var " + $valid + " = true; "; - if ($isData) { - out += " if (schema" + $lvl + " === undefined) " + $valid + " = true; else if (!Array.isArray(schema" + $lvl + ")) " + $valid + " = false; else {"; - } - out += " for (var " + $i + " = 0; " + $i + " < " + $vSchema + ".length; " + $i + "++) { " + $valid + " = " + $data + "[" + $vSchema + "[" + $i + "]] !== undefined "; - if ($ownProperties) { - out += " && Object.prototype.hasOwnProperty.call(" + $data + ", " + $vSchema + "[" + $i + "]) "; - } - out += "; if (!" + $valid + ") break; } "; - if ($isData) { - out += " } "; - } - out += " if (!" + $valid + ") { "; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; - if (it.opts.messages !== false) { - out += " , message: '"; - if (it.opts._errorDataPathProperty) { - out += "is a required property"; - } else { - out += "should have required property \\'" + $missingProperty + "\\'"; - } - out += "' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " } else { "; - } else { - out += " if ( "; - var arr2 = $required; - if (arr2) { - var $propertyKey, $i = -1, l2 = arr2.length - 1; - while ($i < l2) { - $propertyKey = arr2[$i += 1]; - if ($i) { - out += " || "; - } - var $prop = it.util.getProperty($propertyKey), $useData = $data + $prop; - out += " ( ( " + $useData + " === undefined "; - if ($ownProperties) { - out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; - } - out += ") && (missing" + $lvl + " = " + it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) + ") ) "; - } - } - out += ") { "; - var $propertyPath = "missing" + $lvl, $missingProperty = "' + " + $propertyPath + " + '"; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + " + " + $propertyPath; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; - if (it.opts.messages !== false) { - out += " , message: '"; - if (it.opts._errorDataPathProperty) { - out += "is a required property"; - } else { - out += "should have required property \\'" + $missingProperty + "\\'"; - } - out += "' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " } else { "; - } - } else { - if ($loopRequired) { - if (!$isData) { - out += " var " + $vSchema + " = validate.schema" + $schemaPath + "; "; - } - var $i = "i" + $lvl, $propertyPath = "schema" + $lvl + "[" + $i + "]", $missingProperty = "' + " + $propertyPath + " + '"; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - if ($isData) { - out += " if (" + $vSchema + " && !Array.isArray(" + $vSchema + ")) { var err = "; - if (it.createErrors !== false) { - out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; - if (it.opts.messages !== false) { - out += " , message: '"; - if (it.opts._errorDataPathProperty) { - out += "is a required property"; - } else { - out += "should have required property \\'" + $missingProperty + "\\'"; - } - out += "' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (" + $vSchema + " !== undefined) { "; - } - out += " for (var " + $i + " = 0; " + $i + " < " + $vSchema + ".length; " + $i + "++) { if (" + $data + "[" + $vSchema + "[" + $i + "]] === undefined "; - if ($ownProperties) { - out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", " + $vSchema + "[" + $i + "]) "; - } - out += ") { var err = "; - if (it.createErrors !== false) { - out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; - if (it.opts.messages !== false) { - out += " , message: '"; - if (it.opts._errorDataPathProperty) { - out += "is a required property"; - } else { - out += "should have required property \\'" + $missingProperty + "\\'"; - } - out += "' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } "; - if ($isData) { - out += " } "; - } - } else { - var arr3 = $required; - if (arr3) { - var $propertyKey, i3 = -1, l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $prop = it.util.getProperty($propertyKey), $missingProperty = it.util.escapeQuotes($propertyKey), $useData = $data + $prop; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - out += " if ( " + $useData + " === undefined "; - if ($ownProperties) { - out += " || ! Object.prototype.hasOwnProperty.call(" + $data + ", '" + it.util.escapeQuotes($propertyKey) + "') "; - } - out += ") { var err = "; - if (it.createErrors !== false) { - out += " { keyword: 'required' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { missingProperty: '" + $missingProperty + "' } "; - if (it.opts.messages !== false) { - out += " , message: '"; - if (it.opts._errorDataPathProperty) { - out += "is a required property"; - } else { - out += "should have required property \\'" + $missingProperty + "\\'"; - } - out += "' "; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - out += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "; - } - } - } - } - it.errorPath = $currentErrorPath; - } else if ($breakOnError) { - out += " if (true) {"; - } - return out; -}; -var uniqueItems = function generate_uniqueItems(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = "data" + ($dataLvl || ""); - var $valid = "valid" + $lvl; - var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; - if ($isData) { - out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; - $schemaValue = "schema" + $lvl; - } else { - $schemaValue = $schema2; - } - if (($schema2 || $isData) && it.opts.uniqueItems !== false) { - if ($isData) { - out += " var " + $valid + "; if (" + $schemaValue + " === false || " + $schemaValue + " === undefined) " + $valid + " = true; else if (typeof " + $schemaValue + " != 'boolean') " + $valid + " = false; else { "; - } - out += " var i = " + $data + ".length , " + $valid + " = true , j; if (i > 1) { "; - var $itemType = it.schema.items && it.schema.items.type, $typeIsArray = Array.isArray($itemType); - if (!$itemType || $itemType == "object" || $itemType == "array" || $typeIsArray && ($itemType.indexOf("object") >= 0 || $itemType.indexOf("array") >= 0)) { - out += " outer: for (;i--;) { for (j = i; j--;) { if (equal(" + $data + "[i], " + $data + "[j])) { " + $valid + " = false; break outer; } } } "; - } else { - out += " var itemIndices = {}, item; for (;i--;) { var item = " + $data + "[i]; "; - var $method = "checkDataType" + ($typeIsArray ? "s" : ""); - out += " if (" + it.util[$method]($itemType, "item", it.opts.strictNumbers, true) + ") continue; "; - if ($typeIsArray) { - out += ` if (typeof item == 'string') item = '"' + item; `; - } - out += " if (typeof itemIndices[item] == 'number') { " + $valid + " = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "; - } - out += " } "; - if ($isData) { - out += " } "; - } - out += " if (!" + $valid + ") { "; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: 'uniqueItems' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { i: i, j: j } "; - if (it.opts.messages !== false) { - out += " , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "; - } - if (it.opts.verbose) { - out += " , schema: "; - if ($isData) { - out += "validate.schema" + $schemaPath; - } else { - out += "" + $schema2; - } - out += " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - out += " } "; - if ($breakOnError) { - out += " else { "; - } - } else { - if ($breakOnError) { - out += " if (true) { "; - } - } - return out; -}; -var dotjs = { - "$ref": ref, - allOf, - anyOf, - "$comment": comment, - const: _const, - contains, - dependencies, - "enum": _enum, - format, - "if": _if, - items, - maximum: _limit, - minimum: _limit, - maxItems: _limitItems, - minItems: _limitItems, - maxLength: _limitLength, - minLength: _limitLength, - maxProperties: _limitProperties, - minProperties: _limitProperties, - multipleOf, - not, - oneOf, - pattern, - properties: properties$2, - propertyNames, - required: required$1, - uniqueItems, - validate: validate$1 -}; -var ruleModules = dotjs, toHash = util$5.toHash; -var rules$1 = function rules() { - var RULES = [ - { - type: "number", - rules: [ - { "maximum": ["exclusiveMaximum"] }, - { "minimum": ["exclusiveMinimum"] }, - "multipleOf", - "format" - ] - }, - { - type: "string", - rules: ["maxLength", "minLength", "pattern", "format"] - }, - { - type: "array", - rules: ["maxItems", "minItems", "items", "contains", "uniqueItems"] - }, - { - type: "object", - rules: [ - "maxProperties", - "minProperties", - "required", - "dependencies", - "propertyNames", - { "properties": ["additionalProperties", "patternProperties"] } - ] - }, - { rules: ["$ref", "const", "enum", "not", "anyOf", "oneOf", "allOf", "if"] } - ]; - var ALL = ["type", "$comment"]; - var KEYWORDS2 = [ - "$schema", - "$id", - "id", - "$data", - "$async", - "title", - "description", - "default", - "definitions", - "examples", - "readOnly", - "writeOnly", - "contentMediaType", - "contentEncoding", - "additionalItems", - "then", - "else" - ]; - var TYPES = ["number", "integer", "string", "array", "object", "boolean", "null"]; - RULES.all = toHash(ALL); - RULES.types = toHash(TYPES); - RULES.forEach(function(group2) { - group2.rules = group2.rules.map(function(keyword2) { - var implKeywords; - if (typeof keyword2 == "object") { - var key = Object.keys(keyword2)[0]; - implKeywords = keyword2[key]; - keyword2 = key; - implKeywords.forEach(function(k) { - ALL.push(k); - RULES.all[k] = true; - }); - } - ALL.push(keyword2); - var rule = RULES.all[keyword2] = { - keyword: keyword2, - code: ruleModules[keyword2], - implements: implKeywords - }; - return rule; - }); - RULES.all.$comment = { - keyword: "$comment", - code: ruleModules.$comment - }; - if (group2.type) - RULES.types[group2.type] = group2; - }); - RULES.keywords = toHash(ALL.concat(KEYWORDS2)); - RULES.custom = {}; - return RULES; -}; -var KEYWORDS = [ - "multipleOf", - "maximum", - "exclusiveMaximum", - "minimum", - "exclusiveMinimum", - "maxLength", - "minLength", - "pattern", - "additionalItems", - "maxItems", - "minItems", - "uniqueItems", - "maxProperties", - "minProperties", - "required", - "additionalProperties", - "enum", - "format", - "const" -]; -var data = function(metaSchema2, keywordsJsonPointers) { - for (var i = 0; i < keywordsJsonPointers.length; i++) { - metaSchema2 = JSON.parse(JSON.stringify(metaSchema2)); - var segments = keywordsJsonPointers[i].split("/"); - var keywords = metaSchema2; - var j; - for (j = 1; j < segments.length; j++) - keywords = keywords[segments[j]]; - for (j = 0; j < KEYWORDS.length; j++) { - var key = KEYWORDS[j]; - var schema = keywords[key]; - if (schema) { - keywords[key] = { - anyOf: [ - schema, - { $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#" } - ] - }; - } - } - } - return metaSchema2; -}; -var MissingRefError = error_classes.MissingRef; -var async = compileAsync; -function compileAsync(schema, meta, callback) { - var self2 = this; - if (typeof this._opts.loadSchema != "function") - throw new Error("options.loadSchema should be a function"); - if (typeof meta == "function") { - callback = meta; - meta = void 0; - } - var p = loadMetaSchemaOf(schema).then(function() { - var schemaObj = self2._addSchema(schema, void 0, meta); - return schemaObj.validate || _compileAsync(schemaObj); - }); - if (callback) { - p.then( - function(v) { - callback(null, v); - }, - callback - ); - } - return p; - function loadMetaSchemaOf(sch) { - var $schema2 = sch.$schema; - return $schema2 && !self2.getSchema($schema2) ? compileAsync.call(self2, { $ref: $schema2 }, true) : Promise.resolve(); - } - function _compileAsync(schemaObj) { - try { - return self2._compile(schemaObj); - } catch (e) { - if (e instanceof MissingRefError) - return loadMissingSchema(e); - throw e; - } - function loadMissingSchema(e) { - var ref2 = e.missingSchema; - if (added(ref2)) - throw new Error("Schema " + ref2 + " is loaded but " + e.missingRef + " cannot be resolved"); - var schemaPromise = self2._loadingSchemas[ref2]; - if (!schemaPromise) { - schemaPromise = self2._loadingSchemas[ref2] = self2._opts.loadSchema(ref2); - schemaPromise.then(removePromise, removePromise); - } - return schemaPromise.then(function(sch) { - if (!added(ref2)) { - return loadMetaSchemaOf(sch).then(function() { - if (!added(ref2)) - self2.addSchema(sch, ref2, void 0, meta); - }); - } - }).then(function() { - return _compileAsync(schemaObj); - }); - function removePromise() { - delete self2._loadingSchemas[ref2]; - } - function added(ref3) { - return self2._refs[ref3] || self2._schemas[ref3]; - } - } - } -} -var custom = function generate_custom(it, $keyword, $ruleType) { - var out = " "; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema2 = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + "/" + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = "data" + ($dataLvl || ""); - var $valid = "valid" + $lvl; - var $errs = "errs__" + $lvl; - var $isData = it.opts.$data && $schema2 && $schema2.$data, $schemaValue; - if ($isData) { - out += " var schema" + $lvl + " = " + it.util.getData($schema2.$data, $dataLvl, it.dataPathArr) + "; "; - $schemaValue = "schema" + $lvl; - } else { - $schemaValue = $schema2; - } - var $rule = this, $definition = "definition" + $lvl, $rDef = $rule.definition, $closingBraces = ""; - var $compile, $inline, $macro, $ruleValidate, $validateCode; - if ($isData && $rDef.$data) { - $validateCode = "keywordValidate" + $lvl; - var $validateSchema = $rDef.validateSchema; - out += " var " + $definition + " = RULES.custom['" + $keyword + "'].definition; var " + $validateCode + " = " + $definition + ".validate;"; - } else { - $ruleValidate = it.useCustomRule($rule, $schema2, it.schema, it); - if (!$ruleValidate) - return; - $schemaValue = "validate.schema" + $schemaPath; - $validateCode = $ruleValidate.code; - $compile = $rDef.compile; - $inline = $rDef.inline; - $macro = $rDef.macro; - } - var $ruleErrs = $validateCode + ".errors", $i = "i" + $lvl, $ruleErr = "ruleErr" + $lvl, $asyncKeyword = $rDef.async; - if ($asyncKeyword && !it.async) - throw new Error("async keyword in sync schema"); - if (!($inline || $macro)) { - out += "" + $ruleErrs + " = null;"; - } - out += "var " + $errs + " = errors;var " + $valid + ";"; - if ($isData && $rDef.$data) { - $closingBraces += "}"; - out += " if (" + $schemaValue + " === undefined) { " + $valid + " = true; } else { "; - if ($validateSchema) { - $closingBraces += "}"; - out += " " + $valid + " = " + $definition + ".validateSchema(" + $schemaValue + "); if (" + $valid + ") { "; - } - } - if ($inline) { - if ($rDef.statements) { - out += " " + $ruleValidate.validate + " "; - } else { - out += " " + $valid + " = " + $ruleValidate.validate + "; "; - } - } else if ($macro) { - var $it = it.util.copy(it); - var $closingBraces = ""; - $it.level++; - var $nextValid = "valid" + $it.level; - $it.schema = $ruleValidate.validate; - $it.schemaPath = ""; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); - it.compositeRule = $it.compositeRule = $wasComposite; - out += " " + $code; - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - out += " " + $validateCode + ".call( "; - if (it.opts.passContext) { - out += "this"; - } else { - out += "self"; - } - if ($compile || $rDef.schema === false) { - out += " , " + $data + " "; - } else { - out += " , " + $schemaValue + " , " + $data + " , validate.schema" + it.schemaPath + " "; - } - out += " , (dataPath || '')"; - if (it.errorPath != '""') { - out += " + " + it.errorPath; - } - var $parentData = $dataLvl ? "data" + ($dataLvl - 1 || "") : "parentData", $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : "parentDataProperty"; - out += " , " + $parentData + " , " + $parentDataProperty + " , rootData ) "; - var def_callRuleValidate = out; - out = $$outStack.pop(); - if ($rDef.errors === false) { - out += " " + $valid + " = "; - if ($asyncKeyword) { - out += "await "; - } - out += "" + def_callRuleValidate + "; "; - } else { - if ($asyncKeyword) { - $ruleErrs = "customErrors" + $lvl; - out += " var " + $ruleErrs + " = null; try { " + $valid + " = await " + def_callRuleValidate + "; } catch (e) { " + $valid + " = false; if (e instanceof ValidationError) " + $ruleErrs + " = e.errors; else throw e; } "; - } else { - out += " " + $ruleErrs + " = null; " + $valid + " = " + def_callRuleValidate + "; "; - } - } - } - if ($rDef.modifying) { - out += " if (" + $parentData + ") " + $data + " = " + $parentData + "[" + $parentDataProperty + "];"; - } - out += "" + $closingBraces; - if ($rDef.valid) { - if ($breakOnError) { - out += " if (true) { "; - } - } else { - out += " if ( "; - if ($rDef.valid === void 0) { - out += " !"; - if ($macro) { - out += "" + $nextValid; - } else { - out += "" + $valid; - } - } else { - out += " " + !$rDef.valid + " "; - } - out += ") { "; - $errorKeyword = $rule.keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ""; - if (it.createErrors !== false) { - out += " { keyword: '" + ($errorKeyword || "custom") + "' , dataPath: (dataPath || '') + " + it.errorPath + " , schemaPath: " + it.util.toQuotedString($errSchemaPath) + " , params: { keyword: '" + $rule.keyword + "' } "; - if (it.opts.messages !== false) { - out += ` , message: 'should pass "` + $rule.keyword + `" keyword validation' `; - } - if (it.opts.verbose) { - out += " , schema: validate.schema" + $schemaPath + " , parentSchema: validate.schema" + it.schemaPath + " , data: " + $data + " "; - } - out += " } "; - } else { - out += " {} "; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - if (it.async) { - out += " throw new ValidationError([" + __err + "]); "; - } else { - out += " validate.errors = [" + __err + "]; return false; "; - } - } else { - out += " var err = " + __err + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "; - } - var def_customError = out; - out = $$outStack.pop(); - if ($inline) { - if ($rDef.errors) { - if ($rDef.errors != "full") { - out += " for (var " + $i + "=" + $errs + "; " + $i + " { - callback(t, i, ts); - traverseTracks(t, callback); - }); - } else if ("views" in spec) { - spec.views.forEach((view) => traverseTracks(view, callback)); - } -} -function traverseTracksAndViews(spec, callback) { - if ("tracks" in spec) { - spec.tracks.forEach((t) => { - callback(t); - traverseTracksAndViews(t, callback); - }); - } else if ("views" in spec) { - spec.views.forEach((v) => { - callback(v); - traverseTracksAndViews(v, callback); - }); - } -} -function traverseViewArrangements(spec, callback) { - if ("tracks" in spec) - ; - else { - callback(spec); - spec.views.forEach((v) => { - traverseViewArrangements(v, callback); - }); - } -} -function convertToFlatTracks(spec) { - if (IsFlatTracks(spec)) { - const base = { ...spec, tracks: void 0, id: void 0 }; - return spec.tracks.filter((track) => !track._invalidTrack).map((track) => Object.assign(JSON.parse(JSON.stringify(base)), track)); - } - const newTracks = []; - if (IsStackedTracks(spec)) { - spec.tracks.filter((track) => !track._invalidTrack).map((track) => { - if ("alignment" in track) { - newTracks.push({ - ...track, - _overlay: [...track.tracks], - tracks: void 0, - alignment: void 0 - }); - } else { - const base = { ...spec, tracks: void 0, id: void 0 }; - const newSpec = Object.assign(JSON.parse(JSON.stringify(base)), track); - newTracks.push(newSpec); - } - }); - } else { - newTracks.push({ - ...spec, - _overlay: [...spec.tracks.filter((track) => !track._invalidTrack)], - tracks: void 0, - alignment: void 0 - }); - } - return JSON.parse(JSON.stringify(newTracks)); -} -function traverseToFixSpecDownstream(spec, parentDef) { - if (parentDef) { - if (spec.assembly === void 0) - spec.assembly = parentDef.assembly; - if (spec.layout === void 0) - spec.layout = parentDef.layout; - if (spec.orientation === void 0) - spec.orientation = parentDef.orientation; - if (spec.static === void 0) - spec.static = parentDef.static !== void 0 ? parentDef.static : false; - if (spec.zoomLimits === void 0) - spec.zoomLimits = parentDef.zoomLimits; - if (spec.xDomain === void 0) - spec.xDomain = parentDef.xDomain; - if (spec.yDomain === void 0) - spec.yDomain = parentDef.yDomain; - if (spec.linkingId === void 0) - spec.linkingId = parentDef.linkingId; - if (spec.centerRadius === void 0) - spec.centerRadius = parentDef.centerRadius; - if (spec.spacing === void 0 && !("tracks" in spec)) - spec.spacing = parentDef.spacing; - if (spec.xOffset === void 0) - spec.xOffset = parentDef.xOffset; - if (spec.yOffset === void 0) - spec.yOffset = parentDef.yOffset; - if ("views" in spec && "arrangement" in parentDef && spec.arrangement === void 0) - spec.arrangement = parentDef.arrangement; - spec.style = getStyleOverridden(parentDef.style, spec.style); - } else { - if (spec.assembly === void 0) - spec.assembly = "hg38"; - if (spec.layout === void 0) - spec.layout = "linear"; - if (spec.orientation === void 0) - spec.orientation = "horizontal"; - if (spec.static === void 0) - spec.static = false; - if (spec.zoomLimits === void 0) - spec.zoomLimits = [1, null]; - if (spec.centerRadius === void 0) - spec.centerRadius = DEFAULT_INNER_RADIUS_PROP; - if (spec.spacing === void 0) - spec.spacing = DEFAULT_VIEW_SPACING; - if ("views" in spec && spec.arrangement === void 0) - spec.arrangement = "vertical"; - if (spec.xOffset === void 0) - spec.xOffset = 0; - if (spec.yOffset === void 0) - spec.yOffset = 0; - } - if (!spec.id) { - spec.id = uuid(); - } - if ("tracks" in spec) { - let tracks = convertToFlatTracks(spec); - tracks = spreadTracksByData(tracks); - const linkID = uuid(); - tracks.forEach((track, i, array) => { - var _a, _b, _c; - if (!track.id) { - track.id = uuid(); - } - if (!track.width) { - track.width = Is2DTrack(track) ? DEFAULT_TRACK_SIZE_2D : DEFAULT_TRACK_WIDTH_LINEAR; - } - if (!track.height) { - track.height = Is2DTrack(track) ? DEFAULT_TRACK_SIZE_2D : DEFAULT_TRACK_HEIGHT_LINEAR; - } - if ("displacement" in track) { - if (((_a = track.displacement) == null ? void 0 : _a.type) === "pile" && track.row === void 0 && IsChannelDeep(track.x) && track.x.field && IsChannelDeep(track.xe) && track.xe.field) { - const newField = uuid(); - const startField = track.x.field; - const endField = track.xe.field; - const padding = track.displacement.padding; - const displaceTransform = { - type: "displace", - newField, - boundingBox: { startField, endField, padding }, - method: "pile" - }; - if (!track.dataTransform) { - track.dataTransform = []; - } - track.dataTransform = [...track.dataTransform, displaceTransform]; - track.row = { field: newField, type: "nominal" }; - } else if (((_b = track.displacement) == null ? void 0 : _b.type) === "spread") - ; - } - if (track.layout) - track.layout = void 0; - if (track.zoomLimits) - track.zoomLimits = void 0; - if (!track.assembly) - track.assembly = spec.assembly; - if (!track.layout) - track.layout = spec.layout; - if (!track.orientation) - track.orientation = spec.orientation; - if (track.static === void 0) - track.static = spec.static !== void 0 ? spec.static : false; - if (!track.zoomLimits) - track.zoomLimits = spec.zoomLimits; - if (track.layout == "circular" && IsDummyTrack(track)) { - track._invalidTrack = true; - return; - } - track.style = getStyleOverridden(spec.style, track.style); - if (IsOverlaidTrack(track)) { - track._overlay = track._overlay.filter((overlayTrack) => { - return !("type" in overlayTrack && overlayTrack.type == "dummy-track"); - }); - track._overlay.forEach((o) => { - o.style = getStyleOverridden(track.style, o.style); - }); - } - if ((track.layout === "circular" || Is2DTrack(track)) && track.orientation === "vertical") { - track.orientation = "horizontal"; - } - if (Is2DTrack(track)) { - track.layout = "linear"; - if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.y) && !track.y.domain) { - track.y.domain = spec.yDomain; - } else if (IsOverlaidTrack(track)) { - track._overlay.forEach((o) => { - if (IsChannelDeep(o.y) && !o.y.domain) { - o.y.domain = spec.yDomain; - } - }); - } - } - if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.domain) { - track.x.domain = spec.xDomain; - } else if (IsOverlaidTrack(track)) { - track._overlay.forEach((o) => { - if (IsChannelDeep(o.x) && !o.x.domain) { - o.x.domain = spec.xDomain; - } - }); - } - if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.linkingId) { - track.x.linkingId = (_c = spec.linkingId) != null ? _c : linkID; - } else if (IsOverlaidTrack(track)) { - let isAdded = false; - track._overlay.forEach((o) => { - var _a2; - if (isAdded) - return; - if (IsChannelDeep(o.x) && !o.x.linkingId) { - o.x.linkingId = (_a2 = spec.linkingId) != null ? _a2 : linkID; - isAdded = true; - } - }); - } - if (i === 0) { - track.overlayOnPreviousTrack = false; - } - if (i === 0 || i !== 0 && tracks.slice(0, i).filter((d) => !d.overlayOnPreviousTrack).length === 1 && track.overlayOnPreviousTrack === true) { - if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.axis) { - if (track.orientation === "vertical") { - track.x.axis = "left"; - } else { - track.x.axis = "top"; - } - } else if (IsOverlaidTrack(track)) { - track._overlay.forEach((o) => { - if (IsChannelDeep(o.x) && !o.x.axis) { - if (track.orientation === "vertical") { - o.x.axis = "left"; - } else { - o.x.axis = "top"; - } - } - }); - } - } - if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && track.x.axis && track.x.axis !== "none") { - if (track.orientation === "vertical") { - if (track.x.axis === "top") { - track.x.axis = "left"; - } else if (track.x.axis === "bottom") { - track.x.axis = "right"; - } - } else { - if (track.x.axis === "left") { - track.x.axis = "top"; - } else if (track.x.axis === "right") { - track.x.axis = "bottom"; - } - } - } else if (IsOverlaidTrack(track)) { - track._overlay.forEach((o) => { - if (IsChannelDeep(o.x) && o.x.axis && o.x.axis !== "none") { - if (track.orientation === "vertical") { - if (o.x.axis === "top") { - o.x.axis = "left"; - } else if (o.x.axis === "bottom") { - o.x.axis = "right"; - } - } else { - if (o.x.axis === "left") { - o.x.axis = "top"; - } else if (o.x.axis === "right") { - o.x.axis = "bottom"; - } - } - } - }); - } - if ( - // first track can never flipped by default - i !== 0 && // [0, ..., i] tracks should not overlaid as a single track - (i === array.length - 1 && array.slice(0, i + 1).filter((d) => d.overlayOnPreviousTrack).length < i || // Are the rest of the tracks overlaid as a single track? - i !== array.length - 1 && array.slice(i + 1).filter((d) => d.overlayOnPreviousTrack).length === array.length - i - 1 && array.slice(0, i + 1).filter((d) => d.overlayOnPreviousTrack).length < i) - ) { - if (IsSingleTrack(track) && track.mark === "withinLink" && track.flipY === void 0) { - track.flipY = true; - } else if (IsOverlaidTrack(track)) { - if (track.mark === "withinLink" && track.flipY === void 0) { - track.flipY = true; - } - track._overlay.forEach((o) => { - if (o.mark === "withinLink" && o.flipY === void 0) { - o.flipY = true; - } - }); - } - } - if (track.overlayOnPreviousTrack && array[i - 1]) { - track.width = array[i - 1].width; - track.height = array[i - 1].height; - track.layout = array[i - 1].layout; - track.assembly = array[i - 1].assembly; - } - }); - tracks = tracks.filter((track) => !track._invalidTrack); - spec.tracks = tracks; - } else { - spec.views.forEach((v) => { - traverseToFixSpecDownstream(v, spec); - }); - } -} -function getVectorTemplate(column, value) { - return { - data: { - type: "vector", - url: "", - column, - value - }, - mark: "bar", - x: { field: column, type: "genomic", axis: "top" }, - y: { field: value, type: "quantitative" }, - width: 400, - height: 100 - }; -} -function getMultivecTemplate(row, column, value, categories) { - return categories && categories.length < 10 ? { - data: { - type: "multivec", - url: "", - row, - column, - value, - categories - }, - mark: "bar", - x: { field: column, type: "genomic", axis: "top" }, - y: { field: value, type: "quantitative" }, - row: { field: row, type: "nominal", legend: true }, - color: { field: row, type: "nominal" }, - width: 400, - height: 100 - } : { - data: { - type: "multivec", - url: "", - row, - column, - value, - categories - }, - mark: "rect", - x: { field: column, type: "genomic", axis: "top" }, - row: { field: row, type: "nominal", legend: true }, - color: { field: value, type: "quantitative" }, - width: 400, - height: 100 - }; -} -function overrideDataTemplates(spec) { - traverseTracks(spec, (t, i, ts) => { - var _a, _b, _c, _d, _e; - if (!("data" in t) || !t.data || !IsDataDeepTileset(t.data)) { - return; - } - if ("alignment" in t) { - return; - } - if (!IsDataTemplate(t)) { - return; - } - switch (t.data.type) { - case "vector": - case "bigwig": - ts[i] = Object.assign(getVectorTemplate((_a = t.data.column) != null ? _a : "position", (_b = t.data.value) != null ? _b : "value"), t); - break; - case "multivec": - ts[i] = Object.assign( - getMultivecTemplate( - (_c = t.data.row) != null ? _c : "category", - (_d = t.data.column) != null ? _d : "position", - (_e = t.data.value) != null ? _e : "value", - t.data.categories - ), - t - ); - break; - } - }); -} -const CHROM_SIZE_HG38 = { - chr1: 248956422, - chr2: 242193529, - chr3: 198295559, - chr4: 190214555, - chr5: 181538259, - chr6: 170805979, - chr7: 159345973, - chr8: 145138636, - chr9: 138394717, - chr10: 133797422, - chr11: 135086622, - chr12: 133275309, - chr13: 114364328, - chr14: 107043718, - chr15: 101991189, - chr16: 90338345, - chr17: 83257441, - chr18: 80373285, - chr19: 58617616, - chr20: 64444167, - chr21: 46709983, - chr22: 50818468, - chrX: 156040895, - chrY: 57227415 -}; -const CHROM_SIZE_HG19 = { - chr1: 249250621, - chr2: 243199373, - chr3: 198022430, - chr4: 191154276, - chr5: 180915260, - chr6: 171115067, - chr7: 159138663, - chr8: 146364022, - chr9: 141213431, - chr10: 135534747, - chr11: 135006516, - chr12: 133851895, - chr13: 115169878, - chr14: 107349540, - chr15: 102531392, - chr16: 90354753, - chr17: 81195210, - chr18: 78077248, - chr19: 59128983, - chr20: 63025520, - chr21: 48129895, - chr22: 51304566, - chrX: 155270560, - chrY: 59373566, - chrM: 16571 -}; -const CHROM_SIZE_HG18 = { - chr1: 247249719, - chr2: 242951149, - chr3: 199501827, - chr4: 191273063, - chr5: 180857866, - chr6: 170899992, - chr7: 158821424, - chr8: 146274826, - chr9: 140273252, - chr10: 135374737, - chr11: 134452384, - chr12: 132349534, - chr13: 114142980, - chr14: 106368585, - chr15: 100338915, - chr16: 88827254, - chr17: 78774742, - chr18: 76117153, - chr19: 63811651, - chr20: 62435964, - chr21: 46944323, - chr22: 49691432, - chrX: 154913754, - chrY: 57772954, - chrM: 16571 -}; -const CHROM_SIZE_HG17 = { - chr1: 245522847, - chr2: 243018229, - chr3: 199505740, - chr4: 191411218, - chr5: 180857866, - chr6: 170975699, - chr7: 158628139, - chr8: 146274826, - chr9: 138429268, - chr10: 135413628, - chr11: 134452384, - chr12: 132449811, - chr13: 114142980, - chr14: 106368585, - chr15: 100338915, - chr16: 88827254, - chr17: 78774742, - chr18: 76117153, - chr19: 63811651, - chr20: 62435964, - chr21: 46944323, - chr22: 49554710, - chrX: 154824264, - chrY: 57701691, - chrM: 16571 -}; -const CHROM_SIZE_HG16 = { - chr1: 246127941, - chr2: 243615958, - chr3: 199344050, - chr4: 191731959, - chr5: 181034922, - chr6: 170914576, - chr7: 158545518, - chr8: 146308819, - chr9: 136372045, - chr10: 135037215, - chr11: 134482954, - chr12: 132078379, - chr13: 113042980, - chr14: 105311216, - chr15: 100256656, - chr16: 90041932, - chr17: 81860266, - chr18: 76115139, - chr19: 63811651, - chr20: 63741868, - chr21: 46976097, - chr22: 49396972, - chrX: 153692391, - chrY: 50286555, - chrM: 16571 -}; -const CHROM_SIZE_MM10 = { - chr1: 195471971, - chr2: 182113224, - chr3: 160039680, - chr4: 156508116, - chr5: 151834684, - chr6: 149736546, - chr7: 145441459, - chr8: 129401213, - chr9: 124595110, - chr10: 130694993, - chr11: 122082543, - chr12: 120129022, - chr13: 120421639, - chr14: 124902244, - chr15: 104043685, - chr16: 98207768, - chr17: 94987271, - chr18: 90702639, - chr19: 61431566, - chrX: 171031299, - chrY: 91744698, - chrM: 16299 -}; -const CHROM_SIZE_MM9 = { - chr1: 197195432, - chr2: 181748087, - chr3: 159599783, - chr4: 155630120, - chr5: 152537259, - chr6: 149517037, - chr7: 152524553, - chr8: 131738871, - chr9: 124076172, - chr10: 129993255, - chr11: 121843856, - chr12: 121257530, - chr13: 120284312, - chr14: 125194864, - chr15: 103494974, - chr16: 98319150, - chr17: 95272651, - chr18: 90772031, - chr19: 61342430, - chrX: 166650296, - chrY: 15902555, - chrM: 16299 -}; -function getRelativeGenomicPosition(absPos, assembly, returnWithinAssembly = false) { - const chrSizes = Object.entries(computeChromSizes(assembly).interval); - const minPosChr = { chromosome: "unknown", position: Infinity }; - const maxPosChr = { chromosome: "unknown", position: 0 }; - for (const chrSize of chrSizes) { - const [chromosome, absInterval] = chrSize; - const [start, end] = absInterval; - if (start <= absPos && absPos < end) { - return { chromosome, position: absPos - start }; - } - if (start < minPosChr.position) { - minPosChr.chromosome = chromosome; - minPosChr.position = start; - } - if (end > maxPosChr.position) { - maxPosChr.chromosome = chromosome; - maxPosChr.position = end; - } - } - if (returnWithinAssembly) { - if (absPos < minPosChr.position) { - return minPosChr; - } else { - return maxPosChr; - } - } else { - return { chromosome: "unknown", position: absPos }; - } -} -function createChromSizesUrl(chromSizes) { - const text = chromSizes.map((d) => d.join(" ")).join("\n"); - const tsv = new Blob([text], { type: "text/tsv" }); - return URL.createObjectURL(tsv); -} -function computeChromSizes(assembly) { - if (assembly && typeof assembly === "string" && assembly in CRHOM_SIZES) { - return CRHOM_SIZES[assembly]; - } else if (Array.isArray(assembly) && assembly.length !== 0) { - const size = Object.fromEntries(assembly); - return { - size, - interval: getChromInterval(size), - total: getChromTotalSize(size), - path: createChromSizesUrl(assembly) - }; - } else { - return CRHOM_SIZES.hg38; - } -} -const basePath = (assembly) => `https://s3.amazonaws.com/gosling-lang.org/data/${assembly}.chrom.sizes`; -const CRHOM_SIZES = Object.freeze({ - hg38: { - size: CHROM_SIZE_HG38, - interval: getChromInterval(CHROM_SIZE_HG38), - total: getChromTotalSize(CHROM_SIZE_HG38), - path: basePath("hg38") - }, - hg19: { - size: CHROM_SIZE_HG19, - interval: getChromInterval(CHROM_SIZE_HG19), - total: getChromTotalSize(CHROM_SIZE_HG19), - path: basePath("hg19") - }, - hg18: { - size: CHROM_SIZE_HG18, - interval: getChromInterval(CHROM_SIZE_HG18), - total: getChromTotalSize(CHROM_SIZE_HG18), - path: basePath("hg18") - }, - hg17: { - size: CHROM_SIZE_HG17, - interval: getChromInterval(CHROM_SIZE_HG17), - total: getChromTotalSize(CHROM_SIZE_HG17), - path: basePath("hg17") - }, - hg16: { - size: CHROM_SIZE_HG16, - interval: getChromInterval(CHROM_SIZE_HG16), - total: getChromTotalSize(CHROM_SIZE_HG16), - path: basePath("hg16") - }, - mm10: { - size: CHROM_SIZE_MM10, - interval: getChromInterval(CHROM_SIZE_MM10), - total: getChromTotalSize(CHROM_SIZE_MM10), - path: basePath("mm10") - }, - mm9: { - size: CHROM_SIZE_MM9, - interval: getChromInterval(CHROM_SIZE_MM9), - total: getChromTotalSize(CHROM_SIZE_MM9), - path: basePath("mm9") - }, - // `unknown` assembly contains only one chromosome with max length - unknown: { - size: { chr: Number.MAX_VALUE }, - interval: { chr: [0, Number.MAX_VALUE] }, - total: Number.MAX_VALUE, - path: basePath("hg38") - // just to ensure this does not make crash - } -}); -function getAutoCompleteId(assembly) { - switch (assembly) { - case "hg19": - return "OHJakQICQD6gTD7skx4EWA"; - case "mm10": - return "QDutvmyiSrec5nX4pA5WGQ"; - case "mm9": - return "GUm5aBiLRCyz2PsBea7Yzg"; - case "hg38": - default: - return "P0PLbQMwTYGy-5uPIQid7A"; - } -} -function getChromInterval(chromSize) { - const interval = {}; - Object.keys(chromSize).reduce((sum, k) => { - interval[k] = [sum, sum + chromSize[k]]; - return sum + chromSize[k]; - }, 0); - return interval; -} -function getChromTotalSize(chromSize) { - return Object.values(chromSize).reduce((sum, current) => sum + current, 0); -} -function parseGenomicPosition(position) { - const [chromosome, intervalString] = position.split(":"); - if (intervalString) { - const [start, end] = intervalString.split("-").map((s) => +s.replace(/,/g, "")); - if (!Number.isNaN(start) && !Number.isNaN(end)) { - return { chromosome, start, end }; - } - } - return { chromosome }; -} -class GenomicPositionHelper { - constructor(chromosome, start, end) { - this.chromosome = chromosome; - this.start = start; - this.end = end; - } - static fromString(str) { - const result = parseGenomicPosition(str); - return new GenomicPositionHelper(result.chromosome, result.start, result.end); - } - toAbsoluteCoordinates(assembly, padding = 0) { - const info = computeChromSizes(assembly); - const size = info.size[this.chromosome]; - const interval = info.interval[this.chromosome]; - if (size === void 0 || interval === void 0) { - throw new Error(`Chromosome name ${this.chromosome} is not valid`); - } - let { start, end } = this; - if (start === void 0 || end === void 0) { - [start, end] = [1, size]; - } - const offset = interval[0]; - return [start + offset - padding, end + offset + padding]; - } -} -function filterUsingGenoPos(data2, [minX, maxX], config) { - const { x, xe, x1, x1e } = config; - const definedXFields = [x, xe, x1, x1e].filter((f) => f); - return data2.filter((d) => { - if (definedXFields.length === 0) { - return true; - } else if (definedXFields.length === 1) { - const value = +d[definedXFields[0]]; - return typeof value === "number" && minX < value && value <= maxX; - } else { - const values = definedXFields.map((f) => +d[f]).filter((v) => !isNaN(v)); - const minValue = Math.min(...values); - const maxValue = Math.max(...values); - return minX <= maxValue && minValue <= maxX; - } - }); -} -bisector((d) => d.pos).left; -function sanitizeChrName(chrName, assembly, chromosomePrefix) { - if (Array.isArray(assembly)) { - return chrName; - } - if (chromosomePrefix) { - chrName = chrName.replace(chromosomePrefix, "chr"); - } else if (!chrName.includes("chr")) { - chrName = `chr${chrName}`; - } - return chrName; -} -class RemoteFile extends RemoteFile$1 { - constructor() { - super(...arguments); - // Overrides `read` to eagerly read 200 or 206 response - // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162 - __publicField(this, "read", async (buffer, offset = 0, length, position = 0, opts = {}) => { - const { headers = {}, signal, overrides = {} } = opts; - if (length < Infinity) { - headers.range = `bytes=${position}-${position + length}`; - } else if (length === Infinity && position !== 0) { - headers.range = `bytes=${position}-`; - } - const args = { - // @ts-expect-error private property - ...this.baseOverrides, - ...overrides, - headers: { - ...headers, - ...overrides.headers, - // @ts-expect-error private property - ...this.baseOverrides.headers - }, - method: "GET", - redirect: "follow", - mode: "cors", - signal - }; - const response = await this.fetch(this.url, args); - if (!response.ok) { - throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`); - } - if (response.status === 200 || response.status === 206) { - const responseData = await this.getBufferFromResponse(response); - const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length)); - const res = response.headers.get("content-range"); - const sizeMatch = /\/(\d+)$/.exec(res || ""); - if (sizeMatch && sizeMatch[1]) { - this._stat = { size: parseInt(sizeMatch[1], 10) }; - } - return { bytesRead: bytesCopied, buffer }; - } - throw new Error(`HTTP ${response.status} fetching ${this.url}`); - }); - } -} -export { - IsDummyTrack as $, - Ajv$1 as A, - rectProperty as B, - pointProperty as C, - barProperty as D, - IsStackedChannel as E, - IsDomainArray as F, - IsRangeArray as G, - Is2DTrack as H, - IsChannelDeep as I, - isTabularDataFetcher as J, - drawPreEmbellishment as K, - drawMark as L, - drawPostEmbellishment as M, - getRelativeGenomicPosition as N, - hasDataTransform as O, - PREDEFINED_COLOR_STR_MAP as P, - IsXAxis as Q, - RADIAN_GAP as R, - SUPPORTED_CHANNELS as S, - IsMouseEventsDeep as T, - colorToHex as U, - flatArrayToPairArray as V, - DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM as W, - traverseTracksAndViews as X, - traverseViewArrangements as Y, - DEFAULT_VIEW_SPACING as Z, - DEFAULT_INNER_RADIUS_PROP as _, - IsTemplateTrack as a, - IsOverlaidTrack as a0, - IsYAxis as a1, - DEFAULT_CIRCULAR_VIEW_PADDING as a2, - IsDataDeep as a3, - IsHiGlassMatrix as a4, - getHiGlassColorRange as a5, - DEFAULT_TEXT_STYLE as a6, - overrideDataTemplates as a7, - traverseToFixSpecDownstream as a8, - GenomicPositionHelper as a9, - isObject as aa, - getChromInterval as ab, - getChromTotalSize as ac, - parseGenomicPosition as ad, - convertToFlatTracks as ae, - spreadTracksByData as af, - cartesianToPolar as b, - computeChromSizes as c, - commonjsGlobal as d, - RemoteFile as e, - IsOneOfFilter as f, - getTextStyle as g, - IsRangeFilter as h, - IsIncludeFilter as i, - getChannelKeysByAggregateFnc as j, - getChannelKeysByType as k, - filterUsingGenoPos as l, - IsDataDeepTileset as m, - IsDomainChr as n, - IsDomainInterval as o, - pointsToDegree as p, - IsDomainChrInterval as q, - resolveSuperposedTracks as r, - sanitizeChrName as s, - traverseTracks as t, - uuid as u, - valueToRadian as v, - insertItemToArray as w, - getAutoCompleteId as x, - IsChannelValue as y, - getValueUsingChannel as z -}; -//# sourceMappingURL=exported-utils-c80467e4.js.map diff --git a/dist/exported-utils-c80467e4.js.map b/dist/exported-utils-c80467e4.js.map deleted file mode 100644 index d0973c31..00000000 --- a/dist/exported-utils-c80467e4.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"exported-utils-c80467e4.js","sources":["../src/compiler/defaults.ts","../src/core/utils/color-to-hex.ts","../src/core/utils/polar.ts","../src/core/mark/point.ts","../src/core/mark/line.ts","../src/core/mark/bar.ts","../src/core/mark/area.ts","../src/core/mark/rect.ts","../src/core/mark/triangle.ts","../src/core/mark/text.ts","../src/core/mark/rule.ts","../src/core/mark/withinLink.ts","../src/core/utils/array.ts","../src/core/mark/grid.ts","../src/core/utils/text-style.ts","../src/core/mark/title.ts","../src/core/mark/outline.ts","../src/core/mark/legend.ts","../src/core/mark/axis.ts","../src/core/mark/outline-circular.ts","../src/core/mark/background.ts","../src/core/mark/betweenLink.ts","../src/core/mark/index.ts","../src/core/utils/overlay.ts","../src/gosling-schema/gosling.schema.guards.ts","../node_modules/.pnpm/uri-js@4.4.1/node_modules/uri-js/dist/es5/uri.all.js","../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/ucs2length.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/util.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/schema_obj.js","../node_modules/.pnpm/json-schema-traverse@0.4.1/node_modules/json-schema-traverse/index.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/resolve.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/error_classes.js","../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/validate.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/index.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/cache.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/formats.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/ref.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/allOf.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/anyOf.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/comment.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/const.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/contains.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/dependencies.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/enum.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/format.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/if.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/items.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/_limit.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/_limitItems.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/_limitLength.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/_limitProperties.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/multipleOf.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/not.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/oneOf.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/pattern.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/properties.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/propertyNames.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/required.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/uniqueItems.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/index.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/rules.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/data.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/compile/async.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/dotjs/custom.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/definition_schema.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/keyword.js","../node_modules/.pnpm/ajv@6.12.6/node_modules/ajv/lib/ajv.js","../src/core/utils/style.ts","../src/core/utils/uuid.ts","../src/compiler/spec-preprocess.ts","../src/core/utils/chrom-size.ts","../src/core/utils/assembly.ts","../src/data-fetchers/utils.ts"],"sourcesContent":["export const DEFAULT_VISUAL_PROPERTIES = {\n opacity: 1\n};\n\nexport const DEFAULT_TITLE_HEIGHT = 20; // deprecated\nexport const DEFAULT_SUBTITLE_HEIGHT = 20; // deprecated\nexport const DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM = 6;\n\n// default track size\nexport const DEFAULT_TRACK_HEIGHT_LINEAR = 130;\nexport const DEFAULT_TRACK_WIDTH_LINEAR = 600;\nexport const DEFAULT_TRACK_SIZE_2D = 600;\n\n// gab between views\nexport const DEFAULT_VIEW_SPACING = 10;\n\n// empty space inside the visualization for circular layouts\nexport const DEFAULT_INNER_RADIUS_PROP = 0.3;\n\n// padding around a circular view\nexport const DEFAULT_CIRCULAR_VIEW_PADDING = 0; // TODO: this is not properly considered in determining the arrangement of views\n\n// default color when cannot parse\nexport const DEFAULT_BACKUP_COLOR = 'gray';\n","import * as PIXI from 'pixi.js';\nimport { color } from 'd3-color';\nimport { DEFAULT_BACKUP_COLOR } from '../../compiler/defaults';\n\n/**\n * Convert a regular color value (e.g. 'red', '#FF0000', 'rgb(255,0,0)') to a hex value which is legible by PIXI.\n */\nconst colorToHex = (colorStr: string) => {\n let c = color(colorStr) as any;\n\n if (!c) {\n c = color(DEFAULT_BACKUP_COLOR) as any;\n }\n\n const hex = PIXI.utils.rgb2hex([c.rgb().r / 255.0, c.rgb().g / 255.0, c.rgb().b / 255.0]);\n return hex;\n};\n\nexport default colorToHex;\n","export const RADIAN_GAP = 0; //0.04;\n\n/**\n * Convert a value in a single-linear axis to a radian value. Anticlockwise, starts from 12 o'clock.\n * v span from zero to `max`.\n */\nexport function valueToRadian(v: number, max: number, sa: number, ea: number, g?: number) {\n const safeVal = Math.max(Math.min(max, v), 0);\n const gap = g ?? RADIAN_GAP;\n const radExtent = ((ea - sa) / 360) * Math.PI * 2 - gap * 2;\n const radStart = (sa / 360) * Math.PI * 2;\n return -(radStart + (safeVal / max) * radExtent) - Math.PI / 2.0 - gap;\n}\n\n/**\n * Convert a position in a cartesian system to a polar coordinate.\n */\nexport function cartesianToPolar(x: number, max: number, r: number, cx: number, cy: number, sa: number, ea: number) {\n return {\n x: cx + r * Math.cos(valueToRadian(x, max, sa, ea)),\n y: cy + r * Math.sin(valueToRadian(x, max, sa, ea))\n };\n}\n\nexport function positionToRadian(x: number, y: number, cx: number, cy: number) {\n if (cx <= x) {\n return Math.atan((y - cy) / (x - cx));\n } else {\n return Math.atan((y - cy) / (x - cx)) - Math.PI;\n }\n}\n\n/**\n * Calculate a degree in the range of [0, 360) based on two points. Anticlockwise, starts from 12 o'clock.\n */\nexport function pointsToDegree(x: number, y: number, cx: number, cy: number) {\n return ((Math.atan2(-(y - cy), x - cx) / Math.PI) * 180 + 270) % 360;\n}\n","import type * as PIXI from 'pixi.js';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport { getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport { cartesianToPolar } from '../utils/polar';\nimport type { PIXIVisualProperty } from '../visual-property.schema';\n\nexport function drawPoint(track: any, g: PIXI.Graphics, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = track.dimensions;\n const zoomLevel =\n (model.getChannelScale('x') as any).invert(trackWidth) - (model.getChannelScale('x') as any).invert(0);\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300;\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const tcx = trackWidth / 2.0;\n const tcy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* render */\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n const cx = model.encodedPIXIProperty('x-center', d);\n const cy = model.encodedPIXIProperty('y-center', d);\n const color = model.encodedPIXIProperty('color', d);\n const radius = model.encodedPIXIProperty('p-size', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n const alphaTransition = model.markVisibility(d, { width: radius, zoomLevel });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (radius <= 0.1 || actualOpacity === 0 || cx + radius < 0 || cx - radius > trackWidth) {\n // Don't draw invisible marks\n return;\n }\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n actualOpacity, // alpha\n 1 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n if (circular) {\n const r = trackOuterRadius - ((rowPosition + rowHeight - cy) / trackHeight) * trackRingSize;\n const pos = cartesianToPolar(cx, trackWidth, r, tcx, tcy, startAngle, endAngle);\n g.beginFill(colorToHex(color), actualOpacity);\n g.drawCircle(pos.x, pos.y, radius);\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, radius]);\n } else {\n g.beginFill(colorToHex(color), actualOpacity);\n g.drawCircle(cx, rowPosition + rowHeight - cy, radius);\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - cy, radius]);\n }\n });\n });\n}\n\nexport function pointProperty(\n model: GoslingTrackModel,\n propertyKey: PIXIVisualProperty,\n datum?: { [k: string]: string | number }\n) {\n const xe = model.visualPropertyByChannel('xe', datum);\n const x = model.visualPropertyByChannel('x', datum);\n const size = model.visualPropertyByChannel('size', datum);\n\n // priority of channels\n switch (propertyKey) {\n case 'x-center':\n return xe ? (xe + x) / 2.0 : x;\n case 'y-center': {\n const ye = model.visualPropertyByChannel('ye', datum);\n const y = model.visualPropertyByChannel('y', datum);\n return ye ? (ye + y) / 2.0 : y;\n }\n case 'p-size':\n return xe && model.spec().stretch ? (xe - x) / 2.0 : size;\n default:\n return undefined;\n }\n}\n","import type * as PIXI from 'pixi.js';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport { getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport { cartesianToPolar } from '../utils/polar';\n\nexport function drawLine(g: PIXI.Graphics, model: GoslingTrackModel, trackWidth: number, trackHeight: number) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220; // TODO: should default values be filled already\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const trackCenterX = trackWidth / 2.0;\n const trackCenterY = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* color separation */\n const colorCategories = (model.getChannelDomainArray('color') as string[]) ?? ['___SINGLE_COLOR___'];\n\n /* render */\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n // line marks are drawn for each color\n colorCategories.forEach(colorCategory => {\n data.filter(\n d =>\n (!getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory) &&\n (!getValueUsingChannel(d, spec.color as Channel) ||\n (getValueUsingChannel(d, spec.color as Channel) as string) === colorCategory)\n )\n .sort(\n (d1, d2) =>\n // draw from the left to right\n (getValueUsingChannel(d1, spec.x as Channel) as number) -\n (getValueUsingChannel(d2, spec.x as Channel) as number)\n )\n .forEach((d, i) => {\n const cx = model.encodedPIXIProperty('x', d);\n const y = model.encodedPIXIProperty('y', d);\n const size = model.encodedPIXIProperty('size', d);\n const color = model.encodedPIXIProperty('color', d); // should be identical for a single line\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n g.lineStyle(\n size,\n colorToHex(color),\n opacity,\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n if (circular) {\n const r = trackOuterRadius - ((rowPosition + rowHeight - y) / trackHeight) * trackRingSize;\n const pos = cartesianToPolar(\n cx,\n trackWidth,\n r,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n\n if (i === 0) {\n g.moveTo(pos.x, pos.y);\n } else {\n g.lineTo(pos.x, pos.y);\n }\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, 1]);\n } else {\n if (i === 0) {\n g.moveTo(cx, rowPosition + rowHeight - y);\n } else {\n g.lineTo(cx, rowPosition + rowHeight - y);\n }\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - y, 1]);\n }\n });\n });\n });\n}\n","import type { Tile } from '@gosling-lang/gosling-track';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { group } from 'd3-array';\nimport type { PIXIVisualProperty } from '../visual-property.schema';\nimport { IsChannelDeep, IsStackedMark, getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\n\nexport function drawBar(track: any, tile: Tile, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = track.dimensions;\n const tileSize = track.tilesetInfo.tile_size;\n const zoomLevel =\n (model.getChannelScale('x') as any).invert(trackWidth) - (model.getChannelScale('x') as any).invert(0);\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* genomic scale */\n const xScale = model.getChannelScale('x');\n let tileUnitWidth: number;\n if (tile.tileData.tilePos) {\n const { tileX, tileWidth } = track.getTilePosAndDimensions(\n tile.tileData.zoomLevel,\n tile.tileData.tilePos,\n tileSize\n );\n tileUnitWidth = xScale(tileX + tileWidth / tileSize) - xScale(tileX);\n }\n\n /* row separation */\n const rowCategories = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n const clipRow =\n !IsChannelDeep(spec.row) || (IsChannelDeep(spec.row) && typeof spec.row.clip === 'undefined') || spec.row.clip;\n\n /* baseline */\n const baselineValue = IsChannelDeep(spec.y) ? spec.y?.baseline : undefined;\n const staticBaseY = model.encodedValue('y', baselineValue) ?? 0;\n\n /* render */\n const g = tile.graphics;\n if (IsStackedMark(spec)) {\n // TODO: many parts in this scope are identical to the below `else` statement, so encaptulate this?\n // const rowGraphics = tile.graphics; // new HGC.libraries.PIXI.Graphics(); // only one row for stacked marks\n\n const genomicChannel = model.getGenomicChannel();\n if (!genomicChannel || !genomicChannel.field) {\n console.warn('Genomic field is not provided in the specification');\n return;\n }\n const pivotedData = group(data, d => d[genomicChannel.field as string]);\n const xKeys = [...pivotedData.keys()];\n\n // TODO: users may want to align rows by values\n xKeys.forEach(k => {\n let prevYEnd = 0;\n pivotedData.get(k)?.forEach(d => {\n const color = model.encodedPIXIProperty('color', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n const y = model.encodedPIXIProperty('y', d);\n\n const barWidth = model.encodedPIXIProperty('width', d, { tileUnitWidth });\n\n const xs = model.encodedPIXIProperty('x-start', d, { markWidth: barWidth });\n const xe = xs + barWidth;\n\n const alphaTransition = model.markVisibility(d, { width: barWidth, zoomLevel });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (actualOpacity === 0 || barWidth <= 0 || y <= 0) {\n // do not draw invisible marks\n return;\n }\n\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n actualOpacity,\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n let polygonForMouseEvents: number[] = [];\n\n if (circular) {\n const farR = trackOuterRadius - ((rowHeight - prevYEnd) / trackHeight) * trackRingSize;\n const nearR = trackOuterRadius - ((rowHeight - y - prevYEnd) / trackHeight) * trackRingSize;\n\n const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(xs + barWidth, trackWidth, startAngle, endAngle);\n\n g.beginFill(colorToHex(color), color === 'none' ? 0 : actualOpacity);\n g.moveTo(sPos.x, sPos.y);\n g.arc(cx, cy, nearR, startRad, endRad, true);\n g.arc(cx, cy, farR, endRad, startRad, false);\n polygonForMouseEvents = Array.from(g.currentPath.points);\n g.closePath();\n } else {\n g.beginFill(colorToHex(color), color === 'none' ? 0 : actualOpacity);\n g.drawRect(xs, rowHeight - y - prevYEnd, barWidth, y);\n const ys = rowHeight - y - prevYEnd;\n const ye = ys + y;\n polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys];\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents);\n\n prevYEnd += y;\n });\n });\n } else {\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(d => {\n const rowValue = getValueUsingChannel(d, spec.row as Channel);\n return !rowValue || rowValue === rowCategory;\n }).forEach(d => {\n const color = model.encodedPIXIProperty('color', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity');\n let y = model.encodedPIXIProperty('y', d);\n let ye = model.encodedPIXIProperty('ye', d);\n\n if (typeof ye !== 'undefined' && y > ye) {\n // ensure `ye` is larger\n [y, ye] = [ye, y];\n }\n\n const barWidth = model.encodedPIXIProperty('width', d, { tileUnitWidth });\n const xs = model.encodedPIXIProperty('x-start', d, { markWidth: barWidth });\n const xe = xs + barWidth;\n\n let ys: number;\n if (typeof ye === 'undefined') {\n ys = rowPosition + rowHeight - staticBaseY - y;\n ye = rowPosition + rowHeight - staticBaseY;\n\n // Flip the bar along y-axis\n if ((IsChannelDeep(spec.y) && spec.y.flip) || spec.flipY) {\n ye = ys;\n ys = rowPosition;\n }\n } else {\n ys = rowPosition + rowHeight - ye;\n ye = rowPosition + rowHeight - y;\n }\n\n // If the position exceeds the given scale, clip it!\n if (clipRow) {\n ys = Math.max(rowPosition, ys);\n ys = Math.min(ys, rowPosition + rowHeight);\n ye = Math.max(rowPosition, ye);\n ye = Math.min(ye, rowPosition + rowHeight);\n }\n\n const alphaTransition = model.markVisibility(d, { width: barWidth, zoomLevel });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (actualOpacity === 0 || barWidth === 0 || ye - ys === 0) {\n // do not draw invisible marks\n return;\n }\n\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n actualOpacity,\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n let polygonForMouseEvents: number[] = [];\n\n if (circular) {\n const farR = trackOuterRadius - (ys / trackHeight) * trackRingSize;\n const nearR = trackOuterRadius - (ye / trackHeight) * trackRingSize;\n\n const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(xs + barWidth, trackWidth, startAngle, endAngle);\n\n g.beginFill(colorToHex(color), color === 'none' ? 0 : actualOpacity);\n g.moveTo(sPos.x, sPos.y);\n g.arc(cx, cy, nearR, startRad, endRad, true);\n g.arc(cx, cy, farR, endRad, startRad, false);\n polygonForMouseEvents = Array.from(g.currentPath.points);\n g.closePath();\n } else {\n g.beginFill(colorToHex(color), color === 'none' ? 0 : actualOpacity);\n g.drawRect(xs, ys, barWidth, ye - ys);\n polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys];\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents);\n });\n });\n }\n}\n\nexport function barProperty(\n gm: GoslingTrackModel,\n propertyKey: PIXIVisualProperty,\n datum?: { [k: string]: string | number },\n additionalInfo?: {\n tileUnitWidth?: number;\n markWidth?: number;\n }\n) {\n const x = gm.visualPropertyByChannel('x', datum);\n const xe = gm.visualPropertyByChannel('xe', datum);\n const size = gm.visualPropertyByChannel('size', datum);\n switch (propertyKey) {\n case 'width':\n return size ?? (xe ? xe - x : additionalInfo?.tileUnitWidth);\n case 'x-start':\n if (!additionalInfo?.markWidth) {\n // `markWidth` is required\n return undefined;\n }\n return xe ? (x + xe - additionalInfo?.markWidth) / 2.0 : x - additionalInfo?.markWidth / 2.0;\n default:\n return undefined;\n }\n}\n","import { min as d3min, max as d3max, group } from 'd3-array';\nimport type { Channel, Datum } from '@gosling-lang/gosling-schema';\nimport type { Tile } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsStackedMark, getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\n\n/**\n * Draw area marks\n */\nexport function drawArea(HGC: import('@higlass/types').HGC, track: any, tile: Tile, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = track.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220; // TODO: should default values be filled already\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const trackCenterX = trackWidth / 2.0;\n const trackCenterY = trackHeight / 2.0;\n\n /* genomic scale */\n const xScale = track._xScale;\n\n /* row separation */\n const rowCategories = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* color separation */\n const colorCategories = (model.getChannelDomainArray('color') as string[]) ?? ['___SINGLE_COLOR___'];\n\n /* constant values */\n // we do not support encoding opacity, strokeWidth, and stroke for area marks\n const constantOpacity = model.encodedPIXIProperty('opacity');\n const constantStrokeWidth = model.encodedPIXIProperty('strokeWidth');\n const constantStroke = model.encodedPIXIProperty('stroke');\n\n /* render */\n const graphics = tile.graphics;\n if (IsStackedMark(spec)) {\n // TODO: many parts in this scope are identical as the below `else` statement, so encaptulate this?\n\n const genomicChannel = model.getGenomicChannel();\n if (!genomicChannel || !genomicChannel.field) {\n console.warn('Genomic field is not provided in the specification');\n return;\n }\n const pivotedData = group(data, d => d[genomicChannel.field as string]);\n const genomicPosCategories = [...pivotedData.keys()]; // TODO: make sure to be sorted from left to right or top to bottom\n\n // stroke\n graphics.lineStyle(\n constantStrokeWidth,\n colorToHex(constantStroke),\n constantOpacity,\n 1 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n const prevYEndByGPos: { [k: string]: number } = {};\n\n // TODO: we can have a multiple rows when color and row are mapped with different fields\n // are marks are drawn for each color\n colorCategories.forEach(colorCategory => {\n // we have two sets of points since we need to draw the bottom line as well\n const areaPointsTop: number[][] = [];\n const areaPointsBottom: number[][] = [];\n\n // TODO: users may want to align rows by values\n genomicPosCategories.forEach((genomicPosCategory, i, array) => {\n pivotedData\n .get(genomicPosCategory)\n ?.filter(d => getValueUsingChannel(d, spec.color as Channel) === colorCategory)\n ?.forEach(d => {\n const xValue = +genomicPosCategory;\n\n const cx = xScale(xValue);\n const cy = d3max([model.encodedPIXIProperty('y', d), 0]); // make should not to overflow\n\n if (typeof prevYEndByGPos[genomicPosCategory] === 'undefined') {\n prevYEndByGPos[genomicPosCategory] = 0;\n }\n\n const ys = rowHeight - cy - prevYEndByGPos[genomicPosCategory];\n const ye = rowHeight - prevYEndByGPos[genomicPosCategory];\n\n if (circular) {\n if (i === 0) {\n // start position of the polygon\n const r = trackOuterRadius - (rowHeight / trackHeight) * trackRingSize;\n const pos = cartesianToPolar(\n cx,\n trackWidth,\n r,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n areaPointsTop.push([pos.x, pos.y]);\n areaPointsBottom.push([pos.x, pos.y]);\n }\n\n const rTop = trackOuterRadius - (ys / trackHeight) * trackRingSize;\n const posTop = cartesianToPolar(\n cx,\n trackWidth,\n rTop,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n areaPointsTop.push([posTop.x, posTop.y]);\n\n const rBot = trackOuterRadius - (ye / trackHeight) * trackRingSize;\n const posBot = cartesianToPolar(\n cx,\n trackWidth,\n rBot,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n areaPointsBottom.push([posBot.x, posBot.y]);\n\n if (i === array.length - 1) {\n // end position of the polygon\n const r = trackOuterRadius - (rowHeight / trackHeight) * trackRingSize;\n const pos = cartesianToPolar(\n cx,\n trackWidth,\n r,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n areaPointsTop.push([pos.x, pos.y]);\n areaPointsBottom.push([pos.x, pos.y]);\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [posBot.x, posBot.y, 1]);\n } else {\n if (i === 0) {\n // start position of the polygon\n areaPointsTop.push([cx, rowHeight]); // TODO: confirm if this is correct\n areaPointsBottom.push([cx, rowHeight]);\n }\n\n areaPointsTop.push([cx, ys]);\n areaPointsBottom.push([cx, ye]);\n\n if (i === array.length - 1) {\n // end position of the polygon\n areaPointsTop.push([cx, rowHeight]);\n areaPointsBottom.push([cx, rowHeight]);\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [cx, ys, 1]);\n }\n\n prevYEndByGPos[genomicPosCategory] += cy;\n });\n });\n const color = model.encodedValue('color', colorCategory);\n graphics.beginFill(colorToHex(color), constantOpacity);\n graphics.drawPolygon([\n ...areaPointsTop.reduce((a, b) => a.concat(b)),\n ...areaPointsBottom.reverse().reduce((a, b) => a.concat(b))\n ]);\n graphics.endFill();\n });\n } else {\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n // stroke\n graphics.lineStyle(\n constantStrokeWidth,\n colorToHex(constantStroke),\n constantOpacity,\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n // area marks are drawn for each color\n colorCategories.forEach(colorCategory => {\n const baselinePoints: number[][] = [];\n const areaPoints: number[] = [];\n const baselineR = trackOuterRadius - ((rowPosition + rowHeight) / trackHeight) * trackRingSize;\n let startX = 0;\n\n data.filter(\n d =>\n (typeof getValueUsingChannel(d, spec.row as Channel) === 'undefined' ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory) &&\n (typeof getValueUsingChannel(d, spec.color as Channel) === 'undefined' ||\n (getValueUsingChannel(d, spec.color as Channel) as string) === colorCategory)\n )\n .sort(\n // should sort properly before visualizing it so that the path is correctly drawn\n (a: Datum, b: Datum) => model.encodedPIXIProperty('x', a) - model.encodedPIXIProperty('x', b)\n )\n .forEach((d, i, array) => {\n // TODO: this should be included in the `encodedValue` functions\n // make should not to overflow when using use-defined `domain`\n const cy = d3min([d3max([model.encodedPIXIProperty('y', d), 0]), rowHeight]);\n const cx = model.encodedPIXIProperty('x', d);\n\n if (circular) {\n // we need to prepare the points for drawing baseline\n const baselinePos = cartesianToPolar(\n cx,\n trackWidth,\n baselineR,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n baselinePoints.push([baselinePos.x, baselinePos.y]);\n\n if (i === 0) {\n // start position of the polygon\n areaPoints.push(baselinePos.x, baselinePos.y);\n }\n\n const r = trackOuterRadius - ((rowPosition + rowHeight - cy) / trackHeight) * trackRingSize;\n const pos = cartesianToPolar(\n cx,\n trackWidth,\n r,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n areaPoints.push(pos.x, pos.y);\n\n if (i === array.length - 1) {\n // close the polygon with a point at the start\n const startR =\n trackOuterRadius - ((rowPosition + rowHeight) / trackHeight) * trackRingSize;\n const curPos = cartesianToPolar(\n cx,\n trackWidth,\n startR,\n trackCenterX,\n trackCenterY,\n startAngle,\n endAngle\n );\n\n areaPoints.push(curPos.x, curPos.y);\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [pos.x, pos.y, 1]);\n } else {\n if (i === 0) {\n // start position of the polygon\n areaPoints.push(cx, rowPosition + rowHeight);\n startX = cx;\n }\n\n areaPoints.push(cx, rowPosition + rowHeight - cy);\n\n if (i === array.length - 1) {\n // close the polygon with a point at the start\n areaPoints.push(cx, rowPosition + rowHeight);\n areaPoints.push(startX, rowPosition + rowHeight);\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPointBasedEvent(d, [cx, rowPosition + rowHeight - cy, 1]);\n }\n });\n\n if (circular && baselinePoints.length !== 0) {\n // Add baseline points\n areaPoints.push(...baselinePoints.reverse().reduce((a, b) => a.concat(b)));\n }\n\n const color = model.encodedValue('color', colorCategory);\n graphics.beginFill(colorToHex(color), constantOpacity);\n graphics.drawPolygon(areaPoints);\n graphics.endFill();\n });\n });\n }\n}\n","import type { Tile } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport type { PIXIVisualProperty } from '../visual-property.schema';\nimport colorToHex from '../utils/color-to-hex';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\n\nexport function drawRect(HGC: import('@higlass/types').HGC, track: any, tile: Tile, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = track.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* genomic scale */\n const xScale = track._xScale;\n let tileUnitWidth: number;\n if (tile.tileData.tilePos) {\n const tileSize = track.tilesetInfo.tile_size;\n const { tileX, tileWidth } = track.getTilePosAndDimensions(\n tile.tileData.zoomLevel,\n tile.tileData.tilePos, // TODO: required parameter. Typing out `track` should address this issue.\n tileSize\n );\n tileUnitWidth = xScale(tileX + tileWidth / tileSize) - xScale(tileX);\n }\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n const RPAD = IsChannelDeep(spec.row) && spec.row.padding ? spec.row.padding : 0;\n\n // TODO: what if quantitative Y field is used?\n const yCategories = (model.getChannelDomainArray('y') as string[]) ?? ['___SINGLE_Y_POSITION___'];\n const cellHeight = rowHeight / yCategories.length - RPAD * 2;\n\n /* render */\n const g = tile.graphics;\n data.forEach(d => {\n const rowPosition = model.encodedPIXIProperty('row', d) + RPAD;\n const x = model.encodedPIXIProperty('x', d);\n const color = model.encodedPIXIProperty('color', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n const rectWidth = model.encodedPIXIProperty('width', d, { markWidth: tileUnitWidth });\n const rectHeight = model.encodedPIXIProperty('height', d, { markHeight: cellHeight });\n const y = model.encodedPIXIProperty('y', d); // - rectHeight / 2.0; // It is top posiiton now\n\n const alphaTransition = model.markVisibility(d, {\n width: rectWidth,\n zoomLevel: track._xScale.invert(trackWidth) - track._xScale.invert(0)\n });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (actualOpacity === 0 || rectHeight === 0 || rectWidth <= 0.0001) {\n // No need to draw invisible objects\n return;\n }\n\n const [xs, xe, ys, ye] = [\n x,\n x + rectWidth,\n rowPosition + rowHeight - y - rectHeight / 2.0,\n rowPosition + rowHeight - y + rectHeight / 2.0\n ];\n\n const absoluteHeight = model.visualPropertyByChannel('size', d) ?? undefined; // TODO: this is making it complicated, way to simplify this?\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n actualOpacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n let polygonForMouseEvent: number[] = [];\n\n if (circular) {\n if (xe < 0 || trackWidth < xs) {\n // do not draw overflewed visual marks\n return;\n }\n\n // TODO: Does a `row` channel affect here?\n let farR = trackOuterRadius - (ys / trackHeight) * trackRingSize;\n let nearR = trackOuterRadius - (ye / trackHeight) * trackRingSize;\n\n if (absoluteHeight) {\n const midR = trackOuterRadius - ((rowPosition + y) / trackHeight) * trackRingSize;\n farR = midR - absoluteHeight / 2.0;\n nearR = midR + absoluteHeight / 2.0;\n }\n\n const sPos = cartesianToPolar(xs, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(xs, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(xe, trackWidth, startAngle, endAngle);\n\n g.beginFill(colorToHex(color === 'none' ? 'white' : color), color === 'none' ? 0 : actualOpacity);\n g.moveTo(sPos.x, sPos.y);\n g.arc(cx, cy, nearR, startRad, endRad, true);\n g.arc(cx, cy, farR, endRad, startRad, false);\n polygonForMouseEvent = Array.from(g.currentPath.points);\n g.closePath();\n } else {\n g.beginFill(colorToHex(color === 'none' ? 'white' : color), color === 'none' ? 0 : actualOpacity);\n g.drawRect(xs, ys, xe - xs, ye - ys);\n polygonForMouseEvent = [xs, ys, xs, ye, xe, ye, xe, ys];\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvent);\n });\n}\n\nexport function rectProperty(\n gm: GoslingTrackModel,\n propertyKey: PIXIVisualProperty,\n datum?: { [k: string]: string | number },\n additionalInfo?: {\n markHeight?: number;\n markWidth?: number;\n }\n) {\n switch (propertyKey) {\n case 'width':\n const width =\n // (1) size\n gm.visualPropertyByChannel('xe', datum)\n ? gm.visualPropertyByChannel('xe', datum) - gm.visualPropertyByChannel('x', datum)\n : // (2) unit mark height\n additionalInfo?.markWidth;\n return width === 0 ? 0.1 : width; // TODO: not sure if this is necessary for all cases. Perhaps, we can have an option.\n case 'height':\n return (\n // (1) size\n gm.visualPropertyByChannel('size', datum) ??\n // (2) unit mark height\n additionalInfo?.markHeight\n );\n default:\n return undefined;\n }\n}\n","import type * as PIXI from 'pixi.js';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Channel, Mark } from '@gosling-lang/gosling-schema';\nimport { getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport { cartesianToPolar } from '../utils/polar';\n\nexport function drawTriangle(g: PIXI.Graphics, model: GoslingTrackModel, trackWidth: number, trackHeight: number) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* track size */\n const zoomLevel =\n (model.getChannelScale('x') as any).invert(trackWidth) - (model.getChannelScale('x') as any).invert(0);\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n const yCategories: string[] = (model.getChannelDomainArray('y') as string[]) ?? ['___SINGLE_Y___'];\n const triHeight =\n model.encodedValue('size') ??\n (circular ? trackRingSize / rowCategories.length / yCategories.length : rowHeight / yCategories.length);\n\n /* render */\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n const x = model.encodedPIXIProperty('x', d);\n const xe = model.encodedPIXIProperty('xe', d);\n const markWidth = model.encodedPIXIProperty('size', d) ?? (xe === undefined ? triHeight : xe - x);\n\n const y = model.encodedPIXIProperty('y', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const color = model.encodedPIXIProperty('color', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n let polygon: number[] = [];\n\n if (circular) {\n let x0 = x ? x : xe - markWidth;\n let x1 = xe ? xe : x + markWidth;\n let xm = (x0 + x1) / 2.0;\n\n const rm = trackOuterRadius - ((rowPosition + rowHeight - y) / trackHeight) * trackRingSize;\n const r0 = rm - triHeight / 2.0;\n const r1 = rm + triHeight / 2.0;\n\n if (spec.style?.align === 'right' && !xe) {\n x0 -= markWidth;\n x1 -= markWidth;\n xm -= markWidth;\n }\n\n if (spec.mark === 'triangleLeft') {\n const p0 = cartesianToPolar(x1, trackWidth, r0, cx, cy, startAngle, endAngle);\n const p1 = cartesianToPolar(x0, trackWidth, rm, cx, cy, startAngle, endAngle);\n const p2 = cartesianToPolar(x1, trackWidth, r1, cx, cy, startAngle, endAngle);\n const p3 = cartesianToPolar(x1, trackWidth, r0, cx, cy, startAngle, endAngle);\n polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y];\n } else if (spec.mark === 'triangleRight') {\n const p0 = cartesianToPolar(x0, trackWidth, r0, cx, cy, startAngle, endAngle);\n const p1 = cartesianToPolar(x1, trackWidth, rm, cx, cy, startAngle, endAngle);\n const p2 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle);\n const p3 = cartesianToPolar(x0, trackWidth, r0, cx, cy, startAngle, endAngle);\n polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y];\n } else if (spec.mark === 'triangleBottom') {\n x0 = xm - markWidth / 2.0;\n x1 = xm + markWidth / 2.0;\n const p0 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle);\n const p1 = cartesianToPolar(x1, trackWidth, r1, cx, cy, startAngle, endAngle);\n const p2 = cartesianToPolar(xm, trackWidth, r0, cx, cy, startAngle, endAngle);\n const p3 = cartesianToPolar(x0, trackWidth, r1, cx, cy, startAngle, endAngle);\n polygon = [p0.x, p0.y, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y];\n }\n\n const alphaTransition = model.markVisibility(d, { width: x1 - x0, zoomLevel });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n // too narrow triangle's stroke is becoming too sharp\n x1 - x0 > 2 ? actualOpacity : 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n g.beginFill(colorToHex(color), actualOpacity);\n g.drawPolygon(polygon);\n g.endFill();\n } else {\n let x0 = x ? x : xe - markWidth;\n let x1 = xe ? xe : x + markWidth;\n let xm = x0 + (x1 - x0) / 2.0;\n const ym = rowPosition + rowHeight - y;\n const y0 = rowPosition + rowHeight - y - triHeight / 2.0;\n const y1 = rowPosition + rowHeight - y + triHeight / 2.0;\n\n if (spec.style?.align === 'right' && !xe) {\n x0 -= markWidth;\n x1 -= markWidth;\n xm -= markWidth;\n }\n\n polygon = (\n {\n triangleLeft: [x1, y0, x0, ym, x1, y1, x1, y0],\n triangleRight: [x0, y0, x1, ym, x0, y1, x0, y0],\n triangleBottom: [x0, y0, x1, y0, xm, y1, x0, y0]\n } as any\n )[spec.mark as Mark];\n\n const alphaTransition = model.markVisibility(d, { width: x1 - x0, zoomLevel });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n // too narrow triangle's stroke is becoming too sharp\n x1 - x0 > 2 ? actualOpacity : 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n g.beginFill(colorToHex(color), actualOpacity);\n g.drawPolygon(polygon);\n g.endFill();\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addPolygonBasedEvent(d, polygon);\n });\n });\n}\n","import type { Tile } from '@gosling-lang/gosling-track';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { group } from 'd3-array';\nimport { getValueUsingChannel, IsStackedMark } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar } from '../utils/polar';\n\n// Merge with the one in the `utils/text-style.ts`\nexport const TEXT_STYLE_GLOBAL = {\n fontSize: '12px',\n fontFamily: 'sans-serif', // 'Arial',\n fontWeight: 'normal',\n fill: 'black',\n background: 'white',\n lineJoin: 'round',\n stroke: '#ffffff',\n strokeThickness: 0\n} as const;\n\nexport function drawText(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const tcx = trackWidth / 2.0;\n const tcy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* styles */\n const dx = spec.style?.dx ?? 0;\n const dy = spec.style?.dy ?? 0;\n const textAnchor = !spec.style?.textAnchor ? 'middle' : spec.style.textAnchor;\n\n /* render */\n if (IsStackedMark(spec)) {\n if (circular) {\n // TODO: Not supported for circular layouts yet.\n return;\n }\n\n const rowGraphics = tile.graphics; // new HGC.libraries.PIXI.Graphics(); // only one row for stacked marks\n\n const genomicChannel = model.getGenomicChannel();\n if (!genomicChannel || !genomicChannel.field) {\n console.warn('Genomic field is not provided in the specification');\n return;\n }\n const pivotedData = group(data, d => d[genomicChannel.field as string]);\n const xKeys = [...pivotedData.keys()];\n\n // TODO: users may want to align rows by values\n xKeys.forEach(k => {\n let prevYEnd = 0;\n pivotedData.get(k)?.forEach(d => {\n const text = model.encodedPIXIProperty('text', d);\n const color = model.encodedPIXIProperty('color', d);\n const x = model.encodedPIXIProperty('x', d) + dx;\n const xe = model.encodedPIXIProperty('xe', d) + dx;\n const cx = model.encodedPIXIProperty('x-center', d) + dx;\n const y = model.encodedPIXIProperty('y', d) + dy;\n const size = model.encodedPIXIProperty('size', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n if (cx < 0 || cx > trackWidth) {\n // we do not draw texts that are out of the view\n return;\n }\n\n if (trackInfo.textsBeingUsed > 1000) {\n // prevent from drawing too many text elements for the performance\n return;\n }\n\n /* text styles */\n const localTextStyle = {\n ...TEXT_STYLE_GLOBAL,\n fontSize:\n size ??\n (spec.style?.textFontSize ? `${spec.style?.textFontSize}px` : TEXT_STYLE_GLOBAL.fontSize),\n stroke: stroke ?? spec.style?.textStroke ?? TEXT_STYLE_GLOBAL.stroke,\n strokeThickness: strokeWidth ?? spec.style?.textStrokeWidth ?? TEXT_STYLE_GLOBAL.strokeThickness,\n fontWeight: spec.style?.textFontWeight ?? TEXT_STYLE_GLOBAL.fontWeight\n };\n const textStyleObj = new HGC.libraries.PIXI.TextStyle(localTextStyle);\n\n let textGraphic;\n if (trackInfo.textGraphics.length > trackInfo.textsBeingUsed) {\n textGraphic = trackInfo.textGraphics[trackInfo.textsBeingUsed];\n textGraphic.style.fill = color;\n textGraphic.visible = true;\n textGraphic.text = text;\n textGraphic.alpha = 1;\n } else {\n textGraphic = new HGC.libraries.PIXI.Text(text, {\n ...localTextStyle,\n fill: color\n });\n trackInfo.textGraphics.push(textGraphic);\n }\n\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, textStyleObj);\n trackInfo.textsBeingUsed++;\n\n const alphaTransition = model.markVisibility(d, {\n ...metric,\n zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0)\n });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (!text || actualOpacity === 0) {\n trackInfo.textsBeingUsed--;\n textGraphic.visible = false;\n return;\n }\n\n textGraphic.alpha = actualOpacity;\n\n textGraphic.resolution = 8;\n textGraphic.updateText();\n\n textGraphic.texture.baseTexture.scaleMode = HGC.libraries.PIXI.SCALE_MODES.LINEAR; // or .NEAREST\n\n const sprite = new HGC.libraries.PIXI.Sprite(textGraphic.texture);\n sprite.x = x;\n sprite.y = rowHeight - y - prevYEnd;\n sprite.width = xe - x;\n sprite.height = y;\n\n rowGraphics.addChild(sprite);\n\n prevYEnd += y;\n });\n });\n } else {\n rowCategories.forEach(rowCategory => {\n // we are separately drawing each row so that y scale can be more effectively shared across tiles without rerendering from the bottom\n const rowGraphics = tile.graphics;\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n const text = model.encodedPIXIProperty('text', d);\n const color = model.encodedPIXIProperty('color', d);\n const cx = model.encodedPIXIProperty('x-center', d) + dx;\n const y = model.encodedPIXIProperty('y', d) + dy;\n const size = model.encodedPIXIProperty('size', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n if (cx < 0 || cx > trackWidth) {\n // we do not draw texts that are out of the view\n return;\n }\n\n if (trackInfo.textsBeingUsed > 1000) {\n // prevent from drawing too many text elements for the performance\n return;\n }\n\n /* text styles */\n const localTextStyle = {\n ...TEXT_STYLE_GLOBAL,\n fontSize:\n size ??\n (spec.style?.textFontSize ? `${spec.style?.textFontSize}px` : TEXT_STYLE_GLOBAL.fontSize),\n stroke: stroke ?? spec.style?.textStroke ?? TEXT_STYLE_GLOBAL.stroke,\n strokeThickness: strokeWidth ?? spec.style?.textStrokeWidth ?? TEXT_STYLE_GLOBAL.strokeThickness,\n fontWeight: spec.style?.textFontWeight ?? TEXT_STYLE_GLOBAL.fontWeight\n };\n const textStyleObj = new HGC.libraries.PIXI.TextStyle(localTextStyle);\n\n let textGraphic;\n if (trackInfo.textGraphics.length > trackInfo.textsBeingUsed) {\n textGraphic = trackInfo.textGraphics[trackInfo.textsBeingUsed];\n textGraphic.style.fill = color;\n textGraphic.visible = true;\n textGraphic.text = text;\n textGraphic.alpha = 1;\n } else {\n textGraphic = new HGC.libraries.PIXI.Text(text, {\n ...localTextStyle,\n fill: color\n });\n trackInfo.textGraphics.push(textGraphic);\n }\n\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, textStyleObj);\n trackInfo.textsBeingUsed++;\n\n const alphaTransition = model.markVisibility(d, {\n ...metric,\n zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0)\n });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n if (!text || actualOpacity === 0) {\n trackInfo.textsBeingUsed--;\n textGraphic.visible = false;\n return;\n }\n\n textGraphic.alpha = actualOpacity;\n textGraphic.anchor.y = 0.5;\n textGraphic.anchor.x = textAnchor === 'middle' ? 0.5 : textAnchor === 'start' ? 0 : 1;\n\n let polygonForMouseEvents: number[] = [];\n\n if (circular) {\n const r = trackOuterRadius - ((rowPosition + rowHeight - y) / trackHeight) * trackRingSize;\n const centerPos = cartesianToPolar(cx, trackWidth, r, tcx, tcy, startAngle, endAngle);\n textGraphic.x = centerPos.x;\n textGraphic.y = centerPos.y;\n\n textGraphic.resolution = 4;\n // const txtStyle = new HGC.libraries.PIXI.TextStyle(textStyleObj);\n // const metric = HGC.libraries.PIXI.TextMetrics.measureText(textGraphic.text, txtStyle);\n\n // scale the width of text label so that its width is the same when converted into circular form\n const tw = (metric.width / (2 * r * Math.PI)) * trackWidth;\n let [minX, maxX] = [cx - tw / 2.0, cx + tw / 2.0];\n\n // make sure not to place the label on the origin\n if (minX < 0) {\n const gap = -minX;\n minX = 0;\n maxX += gap;\n } else if (maxX > trackWidth) {\n const gap = maxX - trackWidth;\n maxX = trackWidth;\n minX -= gap;\n }\n\n const ropePoints: import('pixi.js').Point[] = [];\n const eventPointsFar: number[] = [];\n const eventPointsNear: number[] = [];\n for (let i = maxX; i >= minX; i -= tw / 10.0) {\n const p = cartesianToPolar(i, trackWidth, r, tcx, tcy, startAngle, endAngle);\n ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y));\n\n const pFar = cartesianToPolar(\n i,\n trackWidth,\n r + metric.height / 2.0,\n tcx,\n tcy,\n startAngle,\n endAngle\n );\n const pNear = cartesianToPolar(\n i,\n trackWidth,\n r - metric.height / 2.0,\n tcx,\n tcy,\n startAngle,\n endAngle\n );\n eventPointsFar.push(pFar.x, pFar.y);\n if (i === maxX) {\n eventPointsNear.push(pFar.y, pFar.x);\n }\n eventPointsNear.push(pNear.y, pNear.x);\n }\n\n textGraphic.updateText();\n const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints);\n rope.alpha = actualOpacity;\n rowGraphics.addChild(rope);\n\n /* Mouse Events */\n eventPointsNear.reverse();\n polygonForMouseEvents = eventPointsFar.concat(eventPointsNear);\n } else {\n textGraphic.position.x = cx;\n textGraphic.position.y = rowPosition + rowHeight - y;\n rowGraphics.addChild(textGraphic);\n\n /* Mouse Events */\n const { height: h, width: w } = metric;\n const ys = textGraphic.position.y - h / 2.0;\n const ye = ys + h;\n let xs = 0;\n let xe = 0;\n if (textAnchor === 'start') {\n xs = cx;\n xe = cx + w;\n } else if (textAnchor === 'middle') {\n xs = cx - w / 2;\n xe = cx + w / 2;\n } else {\n xs = cx - w;\n xe = cx;\n }\n polygonForMouseEvents = [xs, ys, xs, ye, xe, ye, xe, ys];\n }\n\n model.getMouseEventModel().addPolygonBasedEvent(d, polygonForMouseEvents);\n });\n });\n }\n}\n","import type { Tile } from '@gosling-lang/gosling-track';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { getValueUsingChannel } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\n\nexport function drawRule(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* style */\n const dashed = spec.style?.dashed;\n const linePattern = spec.style?.linePattern;\n const curved = spec.style?.curve;\n\n /* render */\n const g = tile.graphics;\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n const x = model.encodedPIXIProperty('x', d);\n const xe = model.encodedPIXIProperty('xe', d);\n const y = model.encodedPIXIProperty('y', d); // y middle position\n const color = model.encodedPIXIProperty('color', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n const alphaTransition = model.markVisibility(d, {\n width: xe - x,\n zoomLevel: trackInfo._xScale.invert(trackWidth) - trackInfo._xScale.invert(0)\n });\n const actualOpacity = Math.min(alphaTransition, opacity);\n\n g.lineStyle(\n strokeWidth,\n colorToHex(color),\n actualOpacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n // TODO: Large parts of the following code blocks can be reused, reducing the lines\n // Does this rule span entire width or height of a track?\n if (!xe && (!spec.y || !('field' in spec.y))) {\n /* vertical rule */\n if (circular) {\n // TODO:\n return;\n } else {\n if (dashed) {\n const [dashSize, gapSize] = dashed;\n let curPos = 0;\n\n do {\n g.moveTo(x, curPos);\n g.lineTo(x, curPos + dashSize);\n curPos += dashSize + gapSize;\n } while (curPos < trackHeight);\n } else {\n g.moveTo(x, 0);\n g.lineTo(x, trackHeight);\n }\n }\n } else if (!xe && y) {\n // TODO: draw only single rule regardless of multiple tiles.\n /* horizontal rule */\n if (circular) {\n // Actually, we are drawing arcs instead of lines, so lets remove stroke.\n g.lineStyle(\n strokeWidth,\n colorToHex(color),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n const midR = trackOuterRadius - ((rowPosition + y) / trackHeight) * trackRingSize;\n const farR = midR + strokeWidth / 2.0;\n const nearR = midR - strokeWidth / 2.0;\n\n const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(0, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle);\n\n g.beginFill(colorToHex(color), actualOpacity);\n g.moveTo(sPos.x, sPos.y);\n g.arc(cx, cy, nearR, startRad, endRad, true);\n g.arc(cx, cy, farR, endRad, startRad, false);\n g.closePath();\n } else {\n if (dashed) {\n const [dashSize, gapSize] = dashed;\n let curPos = 0;\n\n do {\n g.moveTo(curPos, rowPosition + rowHeight - y);\n g.lineTo(curPos + dashSize, rowPosition + rowHeight - y);\n curPos += dashSize + gapSize;\n } while (curPos < trackWidth);\n } else {\n g.moveTo(0, rowPosition + rowHeight - y);\n g.lineTo(trackWidth, rowPosition + rowHeight - y);\n }\n }\n } else {\n if (circular) {\n // !!! Currently, we only support simple straight lines for circular layouts.\n if (strokeWidth === 0) {\n // Do not render invisible elements.\n return;\n }\n\n // Actually, we are drawing arcs instead of lines, so lets remove stroke.\n g.lineStyle(\n strokeWidth,\n colorToHex(color),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n const midR = trackOuterRadius - ((rowPosition + rowHeight - y) / trackHeight) * trackRingSize;\n const farR = midR + strokeWidth / 2.0;\n const nearR = midR - strokeWidth / 2.0;\n\n const sPos = cartesianToPolar(x, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(x, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(xe, trackWidth, startAngle, endAngle);\n\n g.beginFill(colorToHex(color), actualOpacity);\n g.moveTo(sPos.x, sPos.y);\n g.arc(cx, cy, nearR, startRad, endRad, true);\n g.arc(cx, cy, farR, endRad, startRad, false);\n g.closePath();\n } else if (dashed) {\n const [dashSize, gapSize] = dashed;\n let curPos = x;\n\n do {\n g.moveTo(curPos, rowPosition + rowHeight - y);\n g.lineTo(curPos + dashSize, rowPosition + rowHeight - y);\n curPos += dashSize + gapSize;\n } while (curPos < xe);\n } else {\n /* regular horizontal lines */\n if (curved === undefined) {\n g.moveTo(x, rowPosition + rowHeight - y);\n g.lineTo(xe, rowPosition + rowHeight - y);\n } else if (curved === 'top') {\n // TODO: to default value\n const CURVE_HEIGHT = 2;\n ///\n\n const xm = x + (xe - x) / 2.0;\n\n g.moveTo(x, rowPosition + rowHeight - y + CURVE_HEIGHT / 2.0);\n g.lineTo(xm, rowPosition + rowHeight - y - CURVE_HEIGHT / 2.0);\n g.moveTo(xm, rowPosition + rowHeight - y - CURVE_HEIGHT / 2.0);\n g.lineTo(xe, rowPosition + rowHeight - y + CURVE_HEIGHT / 2.0);\n }\n }\n\n if (linePattern && curved === undefined && !circular) {\n const { type: pType, size: pSize } = linePattern;\n let curPos = Math.max(x, 0); // saftly start from visible position\n\n g.lineStyle(0);\n\n // TODO: to default value\n const PATTERN_GAP_SIZE = pSize * 2;\n ///\n\n let count = 0;\n while (curPos < Math.min(xe, trackWidth) && count < 100) {\n const x0 = curPos;\n const x1 = curPos + pSize;\n const ym = rowPosition + rowHeight - y;\n const y0 = ym - pSize / 2.0;\n const y1 = ym + pSize / 2.0;\n\n g.beginFill(colorToHex(color), actualOpacity);\n g.drawPolygon(\n pType === 'triangleLeft'\n ? [x1, y0, x0, ym, x1, y1, x1, y0]\n : [x0, y0, x1, ym, x0, y1, x0, y0]\n );\n g.endFill();\n curPos += pSize + PATTERN_GAP_SIZE;\n\n count++;\n\n // saftly end before the visible position\n }\n }\n }\n });\n });\n}\n","import type * as PIXI from 'pixi.js';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport { IsChannelDeep, getValueUsingChannel, Is2DTrack } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar, positionToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\nimport { Bezier } from 'bezier-js';\n\nexport function drawWithinLink(g: PIXI.Graphics, trackInfo: any, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300;\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const tcx = trackWidth / 2.0;\n const tcy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n /* defaults */\n const MIN_HEIGHT = spec.style?.linkMinHeight ?? 0.5;\n const NUM_STEPS = spec.experimental?.performanceMode ? 10 : 50; // https://github.com/gosling-lang/gosling.js/issues/634\n const showVerticalLines = spec.style?.withinLinkVerticalLines ?? false;\n\n // TODO: Can row be actually used for circular layouts?\n /* render */\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n let x = model.encodedPIXIProperty('x', d);\n let xe = model.encodedPIXIProperty('xe', d);\n let x1 = model.encodedPIXIProperty('x1', d);\n let x1e = model.encodedPIXIProperty('x1e', d);\n const y = model.encodedPIXIProperty('y', d);\n const ye = model.encodedPIXIProperty('ye', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const color = model.encodedPIXIProperty('color', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n // sort properly\n if (typeof xe !== 'undefined') {\n [x, xe] = [x, xe].sort((a, b) => a - b);\n }\n if (typeof x1 !== 'undefined' && typeof x1e !== 'undefined') {\n [x1, x1e] = [x1, x1e].sort((a, b) => a - b);\n }\n\n // Is this band or line?\n const isRibbon =\n typeof xe !== 'undefined' &&\n typeof x1 !== 'undefined' &&\n typeof x1e !== 'undefined' &&\n // This means the strokeWidth of a band is too small, so we just need to draw a line instead\n Math.abs(x - xe) > 0.1 &&\n Math.abs(x1 - x1e) > 0.1;\n\n // TODO: This correction can be moved to the compile process\n if (!isRibbon && xe === undefined && !Is2DTrack(spec)) {\n // We need to use a valid value to draw lines, so lets find alternative one.\n if (x1 === undefined && x1e === undefined) {\n // We do not have a valid ones.\n return;\n }\n xe = x1 !== undefined ? x1 : x1e;\n }\n\n if (!isRibbon && Math.abs(x - xe) <= 0.1 && Math.abs(x1 - x1e) <= 0.1) {\n // Put the larger value on `xe` so that it can be used in line connection\n x = (x + xe) / 2.0;\n xe = (x1 + x1e) / 2.0;\n }\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n opacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n const flipY = (IsChannelDeep(spec.y) && spec.y.flip) || spec.flipY;\n const baseY = spec.baselineY ?? rowPosition + (flipY ? 0 : rowHeight);\n\n let pathForMouseEvent: number[] = [];\n\n if (isRibbon) {\n g.beginFill(color === 'none' ? colorToHex('white') : colorToHex(color), color === 'none' ? 0 : opacity);\n\n let [_x1, _x2, _x3, _x4] = [x, xe, x1, x1e];\n\n // Sort values to safely draw bands\n [_x1, _x2, _x3, _x4] = [_x1, _x2, _x3, _x4].sort((a, b) => a - b);\n\n if (_x1 > trackWidth || _x4 < 0 || Math.abs(_x4 - _x1) < 0.5) {\n // Do not draw very small visual marks\n return;\n }\n\n if (circular) {\n if (_x1 < 0 || _x4 > trackWidth) {\n // Do not show bands that are partly outside of the current domain\n return;\n }\n\n // https://pixijs.download/dev/docs/PIXI.Graphics.html#bezierCurveTo\n const r = trackOuterRadius - (rowPosition / trackHeight) * trackRingSize;\n const posX = cartesianToPolar(_x1, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posXE = cartesianToPolar(_x2, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posX1 = cartesianToPolar(_x3, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posX1E = cartesianToPolar(_x4, trackWidth, r, tcx, tcy, startAngle, endAngle);\n\n g.moveTo(posX.x, posX.y);\n\n // outer curve\n g.bezierCurveTo(tcx, tcy, tcx, tcy, posX1E.x, posX1E.y);\n\n g.arc(\n tcx,\n tcy,\n trackOuterRadius,\n positionToRadian(posX1E.x, posX1E.y, tcx, tcy),\n positionToRadian(posX1.x, posX1.y, tcx, tcy),\n false\n );\n\n // inner curve\n g.bezierCurveTo(tcx, tcy, tcx, tcy, posXE.x, posXE.y);\n\n g.arc(\n tcx,\n tcy,\n trackOuterRadius,\n positionToRadian(posXE.x, posXE.y, tcx, tcy),\n positionToRadian(posX.x, posX.y, tcx, tcy),\n false\n );\n pathForMouseEvent = Array.from(g.currentPath.points);\n g.endFill();\n } else {\n // Linear mark\n\n g.moveTo(_x1, baseY);\n\n if (!spec.style?.linkStyle || spec.style?.linkStyle === 'circular') {\n g.arc(\n (_x1 + _x4) / 2.0, // cx\n baseY, // cy\n (_x4 - _x1) / 2.0, // radius\n -Math.PI, // start angle\n Math.PI, // end angle\n false\n );\n g.arc((_x2 + _x3) / 2.0, baseY, (_x3 - _x2) / 2.0, Math.PI, -Math.PI, true);\n pathForMouseEvent = Array.from(g.currentPath.points);\n g.closePath();\n } else {\n g.lineTo(_x3, rowPosition + rowHeight);\n g.bezierCurveTo(\n _x3 + (_x2 - _x3) / 3.0,\n // rowPosition + (x1 - x),\n rowPosition + rowHeight - (_x2 - _x3) / 2.0, //Math.min(rowHeight - (x1 - x), (xe - x1) / 2.0),\n _x3 + ((_x2 - _x3) / 3.0) * 2,\n // rowPosition + (x1 - x),\n rowPosition + rowHeight - (_x2 - _x3) / 2.0, //Math.min(rowHeight - (x1 - x), (xe - x1) / 2.0),\n _x2,\n rowPosition + rowHeight\n );\n g.lineTo(_x4, rowPosition + rowHeight);\n g.bezierCurveTo(\n _x1 + ((_x4 - _x1) / 3.0) * 2,\n // rowPosition,\n rowPosition + rowHeight - (_x4 - _x1) / 2.0, //Math.min(rowHeight, (x1e - x) / 2.0),\n _x1 + (_x4 - _x1) / 3.0,\n // rowPosition,\n rowPosition + rowHeight - (_x4 - _x1) / 2.0, //Math.min(rowHeight, (x1e - x) / 2.0),\n _x1,\n rowPosition + rowHeight\n );\n pathForMouseEvent = Array.from(g.currentPath.points);\n g.endFill();\n }\n }\n /* Mouse Events */\n model.getMouseEventModel().addPolygonBasedEvent(d, pathForMouseEvent);\n } else {\n /**\n * Line connection and not ribbon style\n */\n\n const midX = (x + xe) / 2.0;\n\n // Must not fill color for `line`, just use `stroke`\n g.beginFill(colorToHex('white'), 0);\n\n if (circular) {\n if (x < 0 || xe > trackWidth) {\n // Do not show bands that are partly outside of the current domain\n return;\n }\n\n const IS_ELLIPTICAL_READY = false;\n if (IS_ELLIPTICAL_READY && spec.style?.linkStyle === 'elliptical') {\n // !! Not ready to use\n const morePoints: { x: number; y: number }[] = [];\n\n for (let step = 0; step <= NUM_STEPS; step++) {\n const theta = (Math.PI * step) / NUM_STEPS;\n const mx = ((xe - x) / 2.0) * Math.cos(theta) + (x + xe) / 2.0;\n const my =\n baseY -\n (((rowHeight - y) *\n Math.sin(theta) *\n Math.min(xe - x + trackWidth * 0.5, trackWidth * 1.5)) /\n trackWidth /\n 1.5) *\n (flipY ? -1 : 1);\n\n const r = trackOuterRadius - (my / trackHeight) * trackRingSize;\n const cmx = cartesianToPolar(mx, trackWidth, r, tcx, tcy, startAngle, endAngle);\n\n if (step % 20 === 0 || step === NUM_STEPS) {\n // we draw less points than the hidden points for mouse events\n if (step === 0) {\n g.moveTo(cmx.x, cmx.y);\n } else {\n g.lineTo(cmx.x, cmx.y);\n }\n }\n morePoints.push({ ...cmx });\n }\n\n pathForMouseEvent = morePoints.flatMap(d => [d.x, d.y]);\n } else if (spec.style?.linkStyle === 'straight') {\n const r = trackOuterRadius - (rowPosition / trackHeight) * trackRingSize;\n const posS = cartesianToPolar(x, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posE = cartesianToPolar(xe, trackWidth, r, tcx, tcy, startAngle, endAngle);\n\n const x1 = posS.x;\n const y1 = posS.y;\n const x4 = posE.x;\n const y4 = posE.y;\n\n g.moveTo(x1, y1);\n g.lineTo(x4, y4);\n\n /* click event data */\n const length = 100;\n const eventPoints = Array.from({ length }, (d, i) => {\n return {\n x: ((x4 - x1) / (length - 1)) * i + x1,\n y: ((y4 - y1) / (length - 1)) * i + y1\n };\n });\n\n pathForMouseEvent = eventPoints.flatMap(d => [d.x, d.y]);\n } else {\n const r = trackOuterRadius - (rowPosition / trackHeight) * trackRingSize;\n const posS = cartesianToPolar(x, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posE = cartesianToPolar(xe, trackWidth, r, tcx, tcy, startAngle, endAngle);\n\n const x1 = posS.x;\n const y1 = posS.y;\n const x2 = posS.x;\n const y2 = posS.y;\n const x3 = trackWidth / 2.0;\n const y3 = trackHeight / 2.0;\n const x4 = posE.x;\n const y4 = posE.y;\n\n g.moveTo(x1, y1);\n\n const bezier = new Bezier(x1, y1, x2, y2, x3, y3, x4, y4);\n const points = bezier.getLUT(14);\n points.forEach(d => g.lineTo(d.x, d.y));\n\n /* click event data */\n const morePoints = bezier.getLUT(1000);\n pathForMouseEvent = morePoints.flatMap(d => [d.x, d.y]);\n }\n } else {\n // linear line connection\n\n if (spec.style?.linkStyle === 'elliptical') {\n if (!(0 <= x && x <= trackWidth) && !(0 <= xe && xe <= trackWidth)) {\n // not within this window\n return;\n }\n\n const points: { x: number; y: number }[] = [];\n\n // https://github.com/gosling-lang/gosling.js/issues/634\n const isYSpecified = IsChannelDeep(spec.y);\n // Iterate from right to left side\n for (let step = 0; step <= NUM_STEPS; step++) {\n const theta = Math.PI * (step / NUM_STEPS);\n const mx = ((xe - x) / 2.0) * Math.cos(theta) + (x + xe) / 2.0;\n let my =\n baseY -\n y *\n Math.sin(theta) *\n (isYSpecified\n ? 1\n : Math.min(xe - x + trackWidth * MIN_HEIGHT, trackWidth) / trackWidth) *\n (flipY ? -1 : 1);\n\n if (typeof y !== 'undefined' && typeof ye !== 'undefined') {\n // If both defined, we draw link between `y` and `ye`\n const linkHeight = Math.abs(ye - y);\n const flipShape = ye > y;\n my = y - linkHeight * Math.sin(theta) * (flipShape ? -1 : 1);\n }\n\n if (step === 0) {\n if (showVerticalLines) {\n const _y = flipY ? baseY - trackHeight : baseY;\n g.moveTo(mx, _y);\n points.push({ x: mx, y: _y });\n\n g.lineTo(mx, my);\n } else {\n g.moveTo(mx, my);\n }\n } else {\n g.lineTo(mx, my);\n }\n points.push({ x: mx, y: my });\n\n if (step === NUM_STEPS && showVerticalLines) {\n const _y = flipY ? baseY - trackHeight : baseY;\n g.lineTo(mx, _y);\n points.push({ x: mx, y: _y });\n }\n }\n\n pathForMouseEvent = points.flatMap(d => [d.x, d.y]);\n } else {\n if (xe < 0 || x > trackWidth) {\n // Q: Do we really need this?\n return;\n }\n g.arc(midX, baseY, (xe - x) / 2.0, -Math.PI, Math.PI);\n pathForMouseEvent = Array.from(g.currentPath.points);\n g.closePath();\n }\n }\n\n /* Mouse Events */\n model.getMouseEventModel().addLineBasedEvent(d, pathForMouseEvent);\n }\n });\n });\n}\n","/**\n * Repeat elements in the array until its size becomes to `targetLength`.\n */\nexport function arrayRepeat(base: T[], targetLength: number): T[] {\n if (base.length === targetLength) return base;\n else if (base.length > targetLength) return base.slice(0, targetLength);\n else {\n const repeated = Array.from(base);\n do {\n repeated.push(...Array.from(base));\n } while (repeated.length < targetLength);\n return repeated.slice(0, targetLength);\n }\n}\n\n/**\n * Insert item to an array and return it.\n * @param array Array to be updated.\n * @param index Index of array to insert new item.\n * @param item Item to be inserted.\n * @returns Updated array.\n */\nexport function insertItemToArray(array: T[], index: number, item: T): T[] {\n return [...array.slice(0, index), item, ...array.slice(index)];\n}\n\n/**\n * Insert item to an array and return it.\n * @param array Array to be updated.\n * @param index Index of array to change item.\n * @param item Item to be inserted.\n * @returns Updated array.\n */\nexport function modifyItemInArray(array: T[], index: number, item: T): T[] {\n return [...array.slice(0, index), item, ...array.slice(index + 1)];\n}\n\n/**\n * Remove item from an array stored in a certain index.\n * @param array Array to be updated.\n * @param index Index of an item to be removed.\n * @returns Updated array.\n */\nexport function removeItemFromArray(array: T[], index: number): T[] {\n return [...array.slice(0, index), ...array.slice(index + 1)];\n}\n\n/**\n * Convert 1D array into 2D array where each pair of elements are grouped.\n * @param array Array to be used.\n * @returns Updated array.\n */\nexport function flatArrayToPairArray(array: T[]): [T, T][] {\n const output: [T, T][] = [];\n for (let i = 0; i < array.length; i += 2) {\n output.push([array[i], array[i + 1]]);\n }\n return output;\n}\n\n/**\n * Check if all elements in an array satisfy a type guard.\n * @param array Array to check\n * @param is Type guard to check each element\n */\nexport function isEvery(array: any[], is: (x: Arr[number]) => x is T): array is T[] {\n return array.every(is);\n}\n\n/** Check if all elements in an array are numbers. */\nexport function isNumberArray(array: any[]): array is number[] {\n return isEvery(array, (x): x is number => typeof x === 'number');\n}\n\n/** Check if all elements in an array are strings. */\nexport function isStringArray(array: any[]): array is string[] {\n return isEvery(array, (x): x is string => typeof x === 'string');\n}\n","import type { ScaleLinear } from 'd3-scale';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport { isNumberArray, isStringArray } from '../utils/array';\nimport type { CompleteThemeDeep } from '../utils/theme';\n\nexport function drawGrid(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n drawYGridQuantitative(trackInfo, tm, theme);\n drawRowGrid(trackInfo, tm, theme);\n}\n\nexport function drawRowGrid(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n const spec = tm.spec();\n\n if (!IsChannelDeep(spec.row) || spec.row.grid !== true) {\n // we do not need to draw grid\n return;\n }\n\n /* track size */\n const [trackX, trackY] = trackInfo.position;\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const circular = tm.spec().layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories = tm.getChannelDomainArray('row') as string[] | undefined;\n\n if (!rowCategories) {\n // We do not have categories mapped to row to draw grid with\n return;\n }\n\n const rowHeight = trackHeight / rowCategories.length;\n\n if ((circular && trackRingSize <= 20) || (!circular && rowHeight <= 20)) {\n // Height is too narrow to draw axis\n return;\n }\n\n /* render */\n const graphics = trackInfo.pBackground;\n\n const strokeWidth = theme.axis.gridStrokeWidth;\n rowCategories.forEach(rowCategory => {\n const rowPosition = tm.encodedValue('row', rowCategory);\n\n if (!circular) {\n graphics.lineStyle(\n strokeWidth,\n colorToHex(theme.axis.gridColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n const y = trackY + rowPosition + rowHeight / 2.0;\n graphics.moveTo(trackX, y);\n graphics.lineTo(trackX + trackWidth, y);\n } else {\n const y = rowPosition + rowHeight / 2.0;\n const midR = trackOuterRadius - (y / trackHeight) * trackRingSize;\n const farR = midR + strokeWidth / 2.0;\n const nearR = midR - strokeWidth / 2.0;\n\n const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(0, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle);\n\n // For circular grid, we draw 'filled' arc w/ zero strokeWidth\n graphics.lineStyle(\n strokeWidth,\n colorToHex('black'),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n graphics.beginFill(colorToHex(theme.axis.gridColor), 1);\n graphics.moveTo(trackX + sPos.x, trackY + sPos.y);\n graphics.arc(trackX + cx, trackY + cy, nearR, startRad, endRad, true);\n graphics.arc(trackX + cx, trackY + cy, farR, endRad, startRad, false);\n graphics.closePath();\n }\n });\n}\n\nexport function drawYGridQuantitative(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n const spec = tm.spec();\n\n if (!IsChannelDeep(spec.y) || spec.y.grid !== true) {\n // we do not need to draw grid\n return;\n }\n\n /* track size */\n const [trackX, trackY] = trackInfo.position;\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n const startX = trackX;\n const endX = trackX + trackWidth;\n\n /* circular parameters */\n const circular = tm.spec().layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const cx = trackWidth / 2.0;\n const cy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories = tm.getChannelDomainArray('row') ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n if (!isStringArray(rowCategories)) {\n // We do not have categories mapped to row to draw grid with\n return;\n }\n\n /* Grid Components */\n const scale = tm.getChannelScale('y');\n const domain = tm.getChannelDomainArray('y');\n\n if (!scale || !domain || !isNumberArray(domain)) {\n // We do not have sufficient information to draw a grid\n return;\n }\n\n if ((circular && (rowHeight / trackHeight) * trackRingSize <= 20) || (!circular && rowHeight <= 20)) {\n // Height is too narrow to draw axis\n return;\n }\n\n /* render */\n const graphics = trackInfo.pBackground;\n const strokeWidth = theme.axis.gridStrokeWidth;\n\n rowCategories.forEach(rowCategory => {\n const rowPosition = tm.encodedValue('row', rowCategory);\n\n const assignedHeight = circular ? (rowHeight / trackHeight) * trackRingSize : rowHeight;\n const tickCount = Math.max(Math.ceil(assignedHeight / 40), 1);\n\n let ticks = (scale as ScaleLinear).ticks(tickCount).filter(v => domain[0] <= v && v <= domain[1]);\n\n if (ticks.length === 1) {\n // Sometimes, ticks() gives a single value, so use a larger tickCount.\n ticks = (scale as ScaleLinear).ticks(tickCount + 1).filter(v => domain[0] <= v && v <= domain[1]);\n }\n\n if (!circular) {\n graphics.lineStyle(\n strokeWidth,\n colorToHex(theme.axis.gridColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n ticks.forEach(value => {\n const y = trackY + rowPosition + rowHeight - scale(value);\n if (theme.axis.gridStrokeType === 'solid') {\n graphics.moveTo(startX, y);\n graphics.lineTo(endX, y);\n } else if (theme.axis.gridStrokeType === 'dashed') {\n const [line, gap] = theme.axis.gridStrokeDash ?? [1, 1];\n // eslint-disable-next-line\n for (let i = startX; i < endX; i += line + gap) {\n graphics.moveTo(i, y);\n graphics.lineTo(i + line, y);\n }\n }\n });\n } else {\n ticks.forEach(value => {\n const y = scale(value);\n const midR = trackOuterRadius - ((rowPosition + rowHeight - y) / trackHeight) * trackRingSize;\n const farR = midR + strokeWidth / 2.0;\n const nearR = midR - strokeWidth / 2.0;\n\n const sPos = cartesianToPolar(0, trackWidth, nearR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(0, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle);\n\n // For circular grid, we draw 'filled' arc w/ zero strokeWidth\n graphics.lineStyle(\n strokeWidth,\n colorToHex('black'),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n graphics.beginFill(colorToHex(theme.axis.gridColor), 1);\n graphics.moveTo(trackX + sPos.x, trackY + sPos.y);\n graphics.arc(trackX + cx, trackY + cy, nearR, startRad, endRad, true);\n graphics.arc(trackX + cx, trackY + cy, farR, endRad, startRad, false);\n graphics.closePath();\n });\n }\n });\n}\n","export type TextStyle = {\n color?: string;\n size?: number;\n fontFamily?: string;\n fontWeight?: 'bold' | 'normal' | 'light';\n stroke?: string;\n strokeThickness?: number;\n};\n\nexport const DEFAULT_TEXT_STYLE: Required = {\n color: 'black',\n size: 10,\n fontFamily: 'Arial',\n fontWeight: 'normal',\n stroke: '#ffffff',\n strokeThickness: 0\n};\n\nexport function getTextStyle(style: TextStyle = {}) {\n const merged: Required = { ...DEFAULT_TEXT_STYLE, ...style };\n // Use `const` to get object literal which is compatible with `Partial`\n const pixiTextStyle = {\n fontSize: `${merged.size}px`,\n fontFamily: merged.fontFamily,\n fontWeight: merged.fontWeight === 'light' ? 'lighter' : merged.fontWeight,\n fill: merged.color,\n lineJoin: 'round',\n stroke: merged.stroke,\n strokeThickness: merged.strokeThickness\n } as const;\n // Allow returned object to be mutable (strip `readonly` modifier from `const`)\n return pixiTextStyle as {\n -readonly [K in keyof typeof pixiTextStyle]: (typeof pixiTextStyle)[K];\n };\n}\n","import type * as PIXI from 'pixi.js';\nimport type { Tile } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\nimport { getTextStyle } from '../utils/text-style';\n\nexport function drawCircularTitle(\n HGC: import('@higlass/types').HGC,\n trackInfo: any,\n tile: Tile,\n model: GoslingTrackModel,\n theme: Required\n) {\n const spec = model.spec();\n const { title } = spec;\n\n if (spec.layout !== 'circular') {\n // Wrong function call, this is for circular tracks.\n return;\n }\n\n if (!title) {\n // No point to render a title.\n return;\n }\n\n /* track size */\n const [tw, th] = trackInfo.dimensions;\n\n /* circular parameters */\n const trackOuterRadius = spec.outerRadius ?? 300;\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const cx = tw / 2.0;\n const cy = th / 2.0;\n\n /* render */\n const g = tile.graphics; // We do not use `pBorder` as in linear layouts.\n\n // The current position, i.e., radius, of this label\n const titleR = trackOuterRadius - 1;\n\n // The position of a tick in the polar system\n const padding = 1;\n const pos = cartesianToPolar(padding, tw, titleR, cx, cy, startAngle, endAngle);\n\n /* Title label */\n const styleConfig = getTextStyle({\n color: theme.track.titleColor,\n size: 12, // `theme.track.titleFontSize` seems to use much larger fonts\n fontFamily: theme.axis.labelFontFamily, // TODO: support\n fontWeight: theme.axis.labelFontWeight // TODO: support\n });\n const textGraphic = new HGC.libraries.PIXI.Text(title, styleConfig);\n textGraphic.anchor.x = 1;\n textGraphic.anchor.y = 0.5;\n textGraphic.position.x = pos.x;\n textGraphic.position.y = pos.y;\n\n textGraphic.resolution = 4;\n const txtStyle = new HGC.libraries.PIXI.TextStyle(styleConfig);\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(textGraphic.text, txtStyle);\n\n // Scale the width of text label so that its width is the same when converted into circular form\n const txtWidth = ((metric.width / (2 * titleR * Math.PI)) * tw * 360) / (endAngle - startAngle);\n const scaledStartX = padding;\n const scaledEndX = padding + txtWidth;\n\n // Determine the points of a rope element for a lebel\n const ropePoints: PIXI.Point[] = [];\n for (let i = scaledEndX; i >= scaledStartX; i -= txtWidth / 10.0) {\n const p = cartesianToPolar(i, tw, titleR - metric.height / 2.0, cx, cy, startAngle, endAngle);\n ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y));\n }\n\n /* Background */\n const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle);\n const endRad = valueToRadian(scaledEndX + padding, tw, startAngle, endAngle);\n\n g.lineStyle(1, colorToHex('red'), 0, 0.5);\n g.beginFill(colorToHex(theme.track.titleBackground), 0.5); // TODO: support `theme.track.titleBackgroundOpacity`\n g.moveTo(pos.x, pos.y);\n g.arc(cx, cy, titleR - metric.height, startRad, endRad, true);\n g.arc(cx, cy, titleR, endRad, startRad, false);\n g.closePath();\n\n // Render a label\n // @ts-expect-error, missing argument to updateText\n textGraphic.updateText();\n const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints);\n g.addChild(rope);\n}\n","import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\n\nexport const TITLE_STYLE = {\n fontSize: '12px',\n fontFamily: 'sans-serif', // 'Arial',\n fontWeight: 'normal',\n fill: 'black',\n background: 'white',\n lineJoin: 'round'\n};\n\nexport function drawChartOutlines(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n const g = trackInfo.pBorder; // use pBorder not to affected by zoomming\n\n // size and position\n const [l, t] = trackInfo.position;\n const [w, h] = trackInfo.dimensions;\n\n // Let's try using the native title (`name` in viewConfig options)\n // if (tm.spec().title) {\n // const paddingX = 3;\n // const paddingY = 3;\n\n // const text = tm.spec().title;\n // const textGraphic = new HGC.libraries.PIXI.Text(text, { ...TITLE_STYLE });\n // textGraphic.anchor.x = 0;\n // textGraphic.anchor.y = 0;\n // textGraphic.position.x = l + paddingX;\n // textGraphic.position.y = t + paddingY;\n // g.addChild(textGraphic);\n\n // const textStyleObj = new HGC.libraries.PIXI.TextStyle(TITLE_STYLE);\n // const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(text, textStyleObj);\n // const textWidth = textMetrics.width;\n // const textHeight = textMetrics.height;\n // g.beginFill(colorToHex('white'), 0.7);\n // g.lineStyle(\n // 0,\n // colorToHex('#DBDBDB'),\n // 0.7, // alpha\n // 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n // );\n // g.drawRect(l, t, textWidth + paddingX * 2, textHeight + paddingY * 2);\n // }\n\n // Rectangular outline\n g.lineStyle(\n tm.spec().style?.outlineWidth ?? 1,\n // TODO: outline not working\n colorToHex(tm.spec().style?.outline ?? theme.track.outline),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex('white'), 0);\n g.drawRect(l, t, w, h);\n\n // Borders\n const x = tm.spec().x;\n\n g.lineStyle(\n 1,\n colorToHex(theme.axis.baselineColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n if (IsChannelDeep(x) && x.axis === 'top') {\n // top\n g.moveTo(l, t);\n g.lineTo(l + w, t);\n\n // left\n // g.moveTo(l, t);\n // g.lineTo(l, t + h);\n } else if (IsChannelDeep(x) && x.axis === 'bottom') {\n // bottom\n g.moveTo(l, t + h);\n g.lineTo(l + w, t + h);\n\n // left\n // g.moveTo(l, t);\n // g.lineTo(l, t + h);\n }\n}\n","import type { DisplayedLegend } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\nimport type { Dimension } from '../utils/position';\nimport { scaleLinear, type ScaleLinear } from 'd3-scale';\nimport { getTextStyle } from '../utils/text-style';\nimport type { SubjectPosition, D3DragEvent } from 'd3-drag';\n\n// Just the libraries necesssary fro this module\ntype Libraries = Pick;\n\ntype LegendOffset = { offsetRight: number };\n\nexport function drawColorLegend(\n HGC: { libraries: Libraries },\n trackInfo: any,\n _tile: unknown,\n model: GoslingTrackModel,\n theme: Required\n) {\n if (!trackInfo.gLegend) {\n // We do not have enough components to draw legends\n return;\n }\n\n trackInfo.gLegend.selectAll('.brush').remove();\n\n const spec = model.spec();\n const offset: LegendOffset = { offsetRight: 0 };\n\n if (IsChannelDeep(spec.color) && spec.color.legend) {\n switch (spec.color.type) {\n case 'nominal':\n drawColorLegendCategories(HGC, trackInfo, _tile, model, theme);\n break;\n case 'quantitative':\n drawColorLegendQuantitative(HGC, trackInfo, _tile, model, theme, 'color', offset);\n break;\n }\n }\n\n if (IsChannelDeep(spec.stroke) && spec.stroke.legend) {\n switch (spec.stroke.type) {\n case 'quantitative':\n drawColorLegendQuantitative(HGC, trackInfo, _tile, model, theme, 'stroke', offset);\n break;\n }\n }\n}\n\nexport function drawColorLegendQuantitative(\n HGC: { libraries: Libraries },\n trackInfo: any,\n _tile: unknown,\n model: GoslingTrackModel,\n theme: Required,\n channelKey: 'color' | 'stroke',\n offset: LegendOffset\n) {\n const spec = model.spec();\n\n const channel = spec[channelKey];\n if (!IsChannelDeep(channel) || channel.type !== 'quantitative' || !channel.legend) {\n // This means we do not need to draw legend\n return;\n }\n\n /* track size */\n const [trackX, trackY] = trackInfo.position;\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* Visual Parameters */\n const legendWidth = 80;\n const legendHeight = trackHeight - 2 > 110 ? 110 : Math.max(trackHeight - 2, 40 - 2);\n const colorBarDim: Dimension = {\n top: 10,\n left: 55,\n width: 20,\n height: legendHeight - 20\n };\n const legendX = trackX + trackWidth - legendWidth - 1 - offset.offsetRight;\n const legendY = trackY + 1;\n\n /* Legend Components */\n const colorScale = model.getChannelScale(channelKey);\n // TODO: Use overloads to remove type-casting (via `as`)\n const colorDomain = model.getChannelDomainArray(channelKey) as [number, number] | undefined;\n\n if (!colorScale || !colorDomain) {\n // We do not have enough information for creating a color legend\n return;\n }\n\n /* render */\n const graphics = trackInfo.pBorder; // use pBorder not to be affected by zoomming\n\n // Background\n graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity);\n graphics.lineStyle(\n 1,\n colorToHex(theme.legend.backgroundStroke),\n theme.legend.backgroundOpacity, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.drawRect(legendX, legendY, legendWidth, legendHeight);\n\n /* Lgend title */\n if (channel.title) {\n const titleStr = channel.title;\n\n // label text style\n const labelTextStyle = getTextStyle({\n color: theme.legend.labelColor,\n size: theme.legend.labelFontSize,\n fontWeight: theme.legend.labelFontWeight,\n fontFamily: theme.legend.labelFontFamily\n });\n\n const textGraphic = new HGC.libraries.PIXI.Text(titleStr, {\n ...labelTextStyle,\n fontWeight: 'bold'\n });\n textGraphic.anchor.x = 0;\n textGraphic.anchor.y = 0;\n textGraphic.position.x = legendX + 10;\n textGraphic.position.y = legendY + 10;\n\n const textStyleObj = new HGC.libraries.PIXI.TextStyle({ ...labelTextStyle, fontWeight: 'bold' });\n const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(titleStr, textStyleObj);\n\n graphics.addChild(textGraphic);\n\n // Adjust the color bar\n colorBarDim.top += textMetrics.height + 4;\n colorBarDim.height -= textMetrics.height + 4;\n }\n\n // Color bar\n const [startValue, endValue] = colorDomain as [number, number];\n const extent = endValue - startValue;\n const scaleOffset = IsChannelDeep(channel) && channel.scaleOffset ? channel.scaleOffset : [0, 1];\n\n [...Array(colorBarDim.height).keys()].forEach(y => {\n // For each pixel, draw a small rectangle with different color\n let value;\n const scaleOffsetSorted = Array.from(scaleOffset).sort();\n if (y / colorBarDim.height >= scaleOffsetSorted[1]) {\n value = endValue;\n } else if (y / colorBarDim.height <= scaleOffsetSorted[0]) {\n value = startValue;\n } else {\n const s1 = scaleLinear()\n .domain([colorBarDim.height * scaleOffsetSorted[0], colorBarDim.height * scaleOffsetSorted[1]])\n .range([0, colorBarDim.height]);\n const s2 = scaleLinear().domain([0, colorBarDim.height]).range([startValue, endValue]);\n value = s2(s1(y));\n }\n\n graphics.beginFill(\n colorToHex(colorScale(value)),\n 1 // alpha\n );\n graphics.lineStyle(\n 1,\n colorToHex(theme.legend.backgroundStroke),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.drawRect(\n legendX + colorBarDim.left,\n legendY + colorBarDim.top + colorBarDim.height - y,\n colorBarDim.width,\n 1\n );\n });\n\n // Brush\n // Refer to https://github.com/higlass/higlass/blob/0b2cac5a770db6d55370a61d5dbbe09c4f577c68/app/scripts/HeatmapTiledPixiTrack.js#L580\n const BRUSH_HEIGHT = 4;\n type Datum = { y: number; id: number };\n trackInfo.colorBrushes = trackInfo.gLegend\n .append('g')\n .attr('class', channelKey)\n .selectAll(`.brush`)\n // We could consider using `_renderingId` to support multiple color legends in overlaid tracks.\n .data(\n scaleOffset.map((d, i) => {\n return { y: d, id: i };\n })\n )\n .enter()\n .append('rect')\n .attr('class', `brush`)\n .attr('pointer-events', 'all')\n .attr('cursor', 'ns-resize')\n .attr(\n 'transform',\n (d: Datum) =>\n `translate(${legendX + colorBarDim.left}, ${\n legendY + colorBarDim.top - BRUSH_HEIGHT / 2.0 + colorBarDim.height - colorBarDim.height * d.y\n })`\n )\n .attr('width', `${colorBarDim.width}px`)\n .attr('height', `${BRUSH_HEIGHT}px`)\n .attr('fill', 'lightgrey')\n .attr('stroke', 'black')\n .attr('stroke-width', '0.5px')\n .call(\n HGC.libraries.d3Drag\n .drag()\n .on('start', (event: D3DragEvent) => {\n trackInfo.startEvent = event.sourceEvent;\n })\n .on('drag', (event: D3DragEvent, d: Datum) => {\n if (channel && channel.scaleOffset) {\n const endEvent = event.sourceEvent;\n const diffY = trackInfo.startEvent.clientY - endEvent.clientY;\n const newScaleOffset = [channel.scaleOffset[0], channel.scaleOffset[1]];\n if (d.id === 0) {\n newScaleOffset[0] += diffY / colorBarDim.height;\n } else {\n newScaleOffset[1] += diffY / colorBarDim.height;\n }\n newScaleOffset[0] = Math.min(1, Math.max(0, newScaleOffset[0]));\n newScaleOffset[1] = Math.min(1, Math.max(0, newScaleOffset[1]));\n trackInfo.updateScaleOffsetFromOriginalSpec(spec._renderingId, newScaleOffset, channelKey);\n trackInfo.shareScaleOffsetAcrossTracksAndTiles(newScaleOffset, channelKey);\n trackInfo.draw();\n trackInfo.startEvent = event.sourceEvent;\n }\n })\n );\n\n // Ticks & labels\n const tickCount = Math.max(Math.ceil(colorBarDim.height / 30), 2);\n let ticks = (colorScale as ScaleLinear)\n .ticks(tickCount)\n .filter(v => colorDomain[0] <= v && v <= colorDomain[1]);\n\n if (ticks.length === 1) {\n // Sometimes, ticks() gives a single value, so use a larger tickCount.\n ticks = (colorScale as ScaleLinear)\n .ticks(tickCount + 1)\n .filter(v => colorDomain[0] <= v && v <= colorDomain[1]);\n }\n const TICK_STROKE_SIZE = 1;\n graphics.lineStyle(\n TICK_STROKE_SIZE,\n colorToHex(theme.legend.tickColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n // label text style\n const labelTextStyle = getTextStyle({\n color: theme.legend.labelColor,\n size: theme.legend.labelFontSize,\n fontWeight: theme.legend.labelFontWeight,\n fontFamily: theme.legend.labelFontFamily\n });\n\n const tickEnd = legendX + colorBarDim.left;\n ticks.forEach(value => {\n let y = legendY + colorBarDim.top + colorBarDim.height - ((value - startValue) / extent) * colorBarDim.height;\n\n // Prevent ticks from exceeding outside of a color bar by the stroke size of ticks\n if (y === legendY + colorBarDim.top) {\n y += TICK_STROKE_SIZE / 2.0;\n } else if (y === legendY + colorBarDim.top + colorBarDim.height) {\n y -= TICK_STROKE_SIZE / 2.0;\n }\n\n // ticks\n graphics.moveTo(tickEnd - 3, y);\n graphics.lineTo(tickEnd, y);\n\n // labels\n const textGraphic = new HGC.libraries.PIXI.Text(value, labelTextStyle);\n textGraphic.anchor.x = 1;\n textGraphic.anchor.y = 0.5;\n textGraphic.position.x = tickEnd - 6;\n textGraphic.position.y = y;\n\n graphics.addChild(textGraphic);\n });\n\n // Record this info so that additional legends can be displayed on the side\n offset.offsetRight = trackWidth - legendX;\n}\n\nexport function drawColorLegendCategories(\n HGC: { libraries: Libraries },\n track: any,\n _tile: unknown,\n tm: GoslingTrackModel,\n theme: Required\n) {\n /* track spec */\n const spec = tm.spec();\n if (!IsChannelDeep(spec.color) || spec.color.type !== 'nominal' || !spec.color.legend) {\n // This means we do not need to draw legend\n return;\n }\n\n /* color separation */\n const colorCategories: string[] = (tm.getChannelDomainArray('color') as string[]) ?? ['___SINGLE_COLOR___'];\n if (colorCategories.length === 0) {\n // We do not need to draw a legend for only one color\n return;\n }\n\n /* check redundancy */\n const domain = spec.color.domain!;\n const range = spec.color.range!;\n const existingLegends: DisplayedLegend[] = track.displayedLegends;\n const toStr = (_: any[] | string) => {\n return typeof _ === 'string' ? _ : _.join();\n };\n if (existingLegends.find(d => toStr(d.domain) === toStr(domain) && toStr(d.range) === toStr(range))) {\n // Identical color legend already added\n return;\n } else {\n existingLegends.push({ domain, range });\n }\n\n /* render */\n const graphics = track.pBorder; // use pBorder not to be affected by zoomming\n\n const paddingX = 10;\n const paddingY = 4;\n let cumY = paddingY;\n let maxWidth = 0;\n\n const recipe: { x: number; y: number; color: string }[] = [];\n\n // label text style\n const labelTextStyle = getTextStyle({\n color: theme.legend.labelColor,\n size: theme.legend.labelFontSize,\n fontWeight: theme.legend.labelFontWeight,\n fontFamily: theme.legend.labelFontFamily\n });\n\n if (spec.style?.inlineLegend) {\n // Show legend in a single horizontal line\n\n // !! reversed to add the last category first from the right side\n colorCategories\n .map(d => d)\n .reverse()\n .forEach(category => {\n if (maxWidth > track.dimensions[0]) {\n // We do not draw labels overflow\n return;\n }\n\n const color = tm.encodedValue('color', category);\n const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle);\n textGraphic.anchor.x = 1;\n textGraphic.anchor.y = 0;\n textGraphic.position.x = track.position[0] + track.dimensions[0] - maxWidth - paddingX;\n textGraphic.position.y = track.position[1] + paddingY;\n\n graphics.addChild(textGraphic);\n\n const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle);\n const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj);\n\n if (cumY < textMetrics.height + paddingY * 3) {\n cumY = textMetrics.height + paddingY * 3;\n }\n\n recipe.push({\n x: track.position[0] + track.dimensions[0] - textMetrics.width - maxWidth - paddingX * 2,\n y: track.position[1] + paddingY + textMetrics.height / 2.0,\n color\n });\n\n maxWidth += textMetrics.width + paddingX * 3;\n });\n } else {\n // Show legend vertically\n\n if (spec.style?.legendTitle) {\n const textGraphic = new HGC.libraries.PIXI.Text(spec.style?.legendTitle, {\n ...labelTextStyle,\n fontWeight: 'bold'\n });\n textGraphic.anchor.x = 1;\n textGraphic.anchor.y = 0;\n textGraphic.position.x = track.position[0] + track.dimensions[0] - paddingX;\n textGraphic.position.y = track.position[1] + cumY;\n\n const textStyleObj = new HGC.libraries.PIXI.TextStyle({ ...labelTextStyle, fontWeight: 'bold' });\n const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(spec.style?.legendTitle, textStyleObj);\n\n graphics.addChild(textGraphic);\n\n cumY += textMetrics.height + paddingY * 2;\n }\n\n colorCategories.forEach(category => {\n if (cumY > track.dimensions[1]) {\n // We do not draw labels overflow\n return;\n }\n\n const color = tm.encodedValue('color', category);\n\n const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle);\n textGraphic.anchor.x = 1;\n textGraphic.anchor.y = 0;\n textGraphic.position.x = track.position[0] + track.dimensions[0] - paddingX;\n textGraphic.position.y = track.position[1] + cumY;\n\n graphics.addChild(textGraphic);\n\n const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle);\n const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj);\n\n if (maxWidth < textMetrics.width + paddingX * 3) {\n maxWidth = textMetrics.width + paddingX * 3;\n }\n\n recipe.push({\n x: track.position[0] + track.dimensions[0] - textMetrics.width - paddingX * 2,\n y: track.position[1] + cumY + textMetrics.height / 2.0,\n color\n });\n\n cumY += textMetrics.height + paddingY * 2;\n });\n }\n\n graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity);\n graphics.lineStyle(\n 1,\n colorToHex(theme.legend.backgroundStroke),\n theme.legend.backgroundOpacity, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.drawRect(\n track.position[0] + track.dimensions[0] - maxWidth - 1,\n track.position[1] + 1,\n maxWidth,\n cumY - paddingY\n );\n\n recipe.forEach(r => {\n graphics.lineStyle(\n 1,\n colorToHex('black'),\n 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.beginFill(colorToHex(r.color), 1);\n graphics.drawCircle(r.x, r.y, 4);\n });\n}\n\nexport function drawRowLegend(\n HGC: { libraries: Libraries },\n trackInfo: any,\n _tile: unknown,\n tm: GoslingTrackModel,\n theme: Required\n) {\n /* track spec */\n const spec = tm.spec();\n if (\n !IsChannelDeep(spec.row) ||\n spec.row.type !== 'nominal' ||\n !spec.row.legend\n // || (!IsChannelDeep(spec.y) || spec.y.type !== 'nominal' || !spec.y.legend)\n ) {\n // we do not need to draw a legend\n return;\n }\n\n /* track size */\n // const trackHeight = trackInfo.dimensions[1];\n\n /* row separation */\n const rowCategories: string[] = (tm.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n // const rowHeight = trackHeight / rowCategories.length;\n if (rowCategories.length === 0) {\n // We do not need to draw a legend for only one category\n return;\n }\n\n /* render */\n const graphics = trackInfo.pBorder; // use pBorder not to affected by zoomming\n\n const paddingX = 4;\n const paddingY = 2;\n\n // label text style\n const labelTextStyle = getTextStyle({\n color: theme.legend.labelColor,\n size: theme.legend.labelFontSize,\n fontWeight: theme.legend.labelFontWeight,\n fontFamily: theme.legend.labelFontFamily\n });\n\n rowCategories.forEach(category => {\n const rowPosition = tm.encodedValue('row', category);\n\n const textGraphic = new HGC.libraries.PIXI.Text(category, labelTextStyle);\n textGraphic.anchor.x = 0;\n textGraphic.anchor.y = 0;\n textGraphic.position.x = trackInfo.position[0] + paddingX;\n textGraphic.position.y = trackInfo.position[1] + rowPosition + paddingY;\n\n graphics.addChild(textGraphic);\n\n const textStyleObj = new HGC.libraries.PIXI.TextStyle(labelTextStyle);\n const textMetrics = HGC.libraries.PIXI.TextMetrics.measureText(category, textStyleObj);\n\n graphics.beginFill(colorToHex(theme.legend.background), theme.legend.backgroundOpacity);\n graphics.lineStyle(\n 1,\n colorToHex(theme.legend.backgroundStroke),\n 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.drawRect(\n trackInfo.position[0] + 1,\n trackInfo.position[1] + rowPosition + 1,\n textMetrics.width + paddingX * 2,\n textMetrics.height + paddingY * 2\n );\n });\n}\n","import { scaleLinear } from 'd3-scale';\nimport type { Tile } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport { isNumberArray, isStringArray } from '../utils/array';\nimport { getTextStyle } from '../utils/text-style';\n\nconst EXTENT_TICK_SIZE = 8;\nconst TICK_SIZE = 6;\n\n/**\n * Draw linear scale Y axis\n */\nexport function drawLinearYAxis(\n HGC: { libraries: { PIXI: typeof import('pixi.js') } },\n trackInfo: any,\n _tile: unknown,\n model: GoslingTrackModel,\n theme: Required\n) {\n const spec = model.spec();\n const CIRCULAR = spec.layout === 'circular';\n const yDomain = model.getChannelDomainArray('y');\n const yRange = model.getChannelRangeArray('y');\n\n if (CIRCULAR) {\n // Wrong function call, this is for linear tracks!\n return;\n }\n\n if (!model.isShowYAxis() || !yDomain || !yRange) {\n // We do not need to draw a y-axis\n return;\n }\n\n if (!isNumberArray(yDomain)) {\n // We can only draw axis for number domains\n return;\n }\n\n /* track size */\n const [tw, th] = trackInfo.dimensions;\n const [tx, ty] = trackInfo.position;\n\n /* row separation */\n const rowCategories = model.getChannelDomainArray('row') ?? ['___SINGLE_ROW___'];\n if (!isStringArray(rowCategories)) {\n // We can only draw axis for string categories\n return;\n }\n const rowHeight = th / rowCategories.length;\n\n if (rowHeight <= 20) {\n // Height is too narrow to draw axis\n return;\n }\n\n /* Axis components */\n const yChannel = model.spec().y;\n const isLeft = IsChannelDeep(yChannel) && 'axis' in yChannel && yChannel.axis === 'right' ? false : true; // Right position only if explicitly specified\n const yScale = scaleLinear()\n .domain(yDomain as number[])\n .range(yRange as number[]);\n\n /* render */\n const graphics = trackInfo.pBorder;\n\n rowCategories.forEach(category => {\n // if (rowCategories.length > 1 ? i !== 1 : i !== 0) {\n // // Let's draw only one y-axis since the scale is shared anyway.\n // // Draw the second y-axis if exist, so that track title is not occluded by the y-axis.\n // return;\n // }\n\n const rowPosition = model.encodedValue('row', category);\n const dx = isLeft ? tx : tx + tw;\n const dy = ty + rowPosition;\n\n /* Axis Baseline */\n graphics.lineStyle(\n 1,\n colorToHex(theme.axis.baselineColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.moveTo(dx, dy);\n graphics.lineTo(dx, dy + rowHeight);\n\n /* Ticks */\n const tickCount = Math.max(Math.ceil(rowHeight / 40), 1);\n let ticks = yScale.ticks(tickCount).filter(v => yDomain[0] <= v && v <= yDomain[1]);\n\n if (ticks.length === 1) {\n // Sometimes, ticks() gives a single value, so use a larger tickCount.\n ticks = yScale.ticks(tickCount + 1).filter(v => yDomain[0] <= v && v <= yDomain[1]);\n }\n\n graphics.lineStyle(\n 1,\n colorToHex(theme.axis.tickColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n let tickEnd = isLeft ? dx + TICK_SIZE : dx - TICK_SIZE;\n ticks.forEach(t => {\n const y = yScale(t);\n graphics.moveTo(dx, dy + rowHeight - y);\n graphics.lineTo(tickEnd, dy + rowHeight - y);\n });\n\n // Two ticks on the bottom and top\n tickEnd = isLeft ? dx + EXTENT_TICK_SIZE : dx - EXTENT_TICK_SIZE;\n graphics.moveTo(dx, dy);\n graphics.lineTo(tickEnd, dy);\n graphics.moveTo(dx, dy + rowHeight);\n graphics.lineTo(tickEnd, dy + rowHeight);\n\n const styleConfig = getTextStyle({\n color: theme.axis.labelColor,\n size: theme.axis.labelFontSize,\n fontFamily: theme.axis.labelFontFamily,\n fontWeight: theme.axis.labelFontWeight\n });\n\n /* Labels */\n ticks.forEach(t => {\n const y = yScale(t);\n tickEnd = isLeft ? dx + TICK_SIZE * 2 : dx - TICK_SIZE * 2;\n\n const textGraphic = new HGC.libraries.PIXI.Text(t, styleConfig);\n textGraphic.anchor.x = isLeft ? 0 : 1;\n textGraphic.anchor.y = y === 0 ? 0.9 : 0.5;\n textGraphic.position.x = tickEnd;\n textGraphic.position.y = dy + rowHeight - y;\n\n // Flip labels when orientation is vertical\n if (spec.orientation === 'vertical') {\n textGraphic.anchor.x = isLeft ? 1 : 0;\n textGraphic.scale.x *= -1;\n }\n graphics.addChild(textGraphic);\n });\n });\n}\n\n/**\n * Draw linear scale Y axis\n */\nexport function drawCircularYAxis(\n HGC: import('@higlass/types').HGC,\n trackInfo: any,\n tile: Tile,\n model: GoslingTrackModel,\n theme: Required\n) {\n const spec = model.spec();\n const CIRCULAR = spec.layout === 'circular';\n const yDomain = model.getChannelDomainArray('y');\n const yRange = model.getChannelRangeArray('y');\n\n if (!CIRCULAR) {\n // Wrong function call, this is for circular tracks.\n return;\n }\n\n if (!model.isShowYAxis() || !yDomain || !yRange) {\n // We do not need to draw a y-axis\n return;\n }\n\n if (!isNumberArray(yDomain)) {\n // We can only draw axis for number domains\n return;\n }\n\n /* track size */\n const [tw, th] = trackInfo.dimensions;\n\n /* circular parameters */\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const cx = tw / 2.0;\n const cy = th / 2.0;\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = th / rowCategories.length;\n\n if ((rowHeight / th) * trackRingSize <= 20) {\n // Height is too narrow to draw axis\n return;\n }\n\n /* Axis components */\n const yChannel = model.spec().y;\n const isLeft = IsChannelDeep(yChannel) && 'axis' in yChannel && yChannel.axis === 'right' ? false : true; // Right position only if explicitly specified\n const yScale = scaleLinear()\n .domain(yDomain as number[])\n .range(yRange as number[]);\n\n /* render */\n const graphics = tile.graphics; // We do not use `pBorder` as in linear layouts.\n\n rowCategories.forEach(category => {\n // if (rowCategories.length > 1 ? i !== 1 : i !== 0) {\n // // Let's draw only one y-axis since the scale is shared anyway.\n // // Draw the second y-axis if exist, so that track title is not occluded by the y-axis.\n // return;\n // }\n\n const rowPosition = model.encodedValue('row', category);\n\n /* Axis Baseline */\n const innerR = trackOuterRadius - ((rowPosition + rowHeight) / th) * trackRingSize;\n const outerR = trackOuterRadius - (rowPosition / th) * trackRingSize;\n const innerPos = cartesianToPolar(isLeft ? 0 : tw, tw, innerR, cx, cy, startAngle, endAngle);\n const outerPos = cartesianToPolar(isLeft ? 0 : tw, tw, outerR, cx, cy, startAngle, endAngle);\n\n graphics.lineStyle(\n 1,\n colorToHex(theme.axis.baselineColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n graphics.moveTo(innerPos.x, innerPos.y);\n graphics.lineTo(outerPos.x, outerPos.y);\n\n /* Ticks */\n // Since we use the polar system, we use numbers 'scaled' for the polar system.\n const SCALED_TICK_SIZE = (r: number) => (TICK_SIZE * tw) / 2 / Math.PI / r;\n const SCALED_EXTENT_TICK_SIZE = (r: number) => (EXTENT_TICK_SIZE * tw) / 2 / Math.PI / r;\n\n // Determine ticks to display\n const axisHeight = (rowHeight / th) * trackRingSize;\n const tickCount = Math.max(Math.ceil(axisHeight / 40), 1);\n let ticks = yScale.ticks(tickCount).filter(v => yDomain[0] <= v && v <= yDomain[1]);\n\n if (ticks.length === 1) {\n // Sometimes, ticks() gives a single tick (e.g., only baseline), so let's use a larger tickCount.\n ticks = yScale.ticks(tickCount + 1).filter(v => yDomain[0] <= v && v <= yDomain[1]);\n }\n\n // Render ticks\n graphics.lineStyle(\n 1,\n colorToHex(theme.axis.tickColor),\n 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n ticks.forEach(t => {\n const y = yScale(t);\n\n // The current position, i.e., radius, of this tick\n const currentR = trackOuterRadius - ((rowPosition + rowHeight - y) / th) * trackRingSize;\n\n // Ticks are drawn in anti-clockwise direction\n const scaledStartX = isLeft ? 0 : tw - SCALED_TICK_SIZE(currentR);\n const scaledEndX = isLeft ? SCALED_TICK_SIZE(currentR) : tw;\n\n // The position of a tick in the polar system\n const pos = cartesianToPolar(scaledStartX, tw, currentR, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle);\n const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle);\n\n // Render a tick\n graphics.moveTo(pos.x, pos.y);\n graphics.arc(cx, cy, currentR, startRad, endRad, true);\n graphics.arc(cx, cy, currentR, endRad, startRad, false);\n graphics.closePath();\n });\n\n // Two ticks on the bottom and top\n {\n // The inner tick\n const scaledStartX = isLeft ? 0 : tw - SCALED_EXTENT_TICK_SIZE(trackInnerRadius);\n const scaledEndX = isLeft ? SCALED_EXTENT_TICK_SIZE(trackInnerRadius) : tw;\n\n const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle);\n const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle);\n\n graphics.moveTo(innerPos.x, innerPos.y);\n graphics.arc(cx, cy, trackInnerRadius, startRad, endRad, true);\n graphics.arc(cx, cy, trackInnerRadius, endRad, startRad, false);\n graphics.closePath();\n }\n {\n // The outer tick\n const scaledStartX = isLeft ? 0 : tw - SCALED_EXTENT_TICK_SIZE(trackOuterRadius);\n const scaledEndX = isLeft ? SCALED_EXTENT_TICK_SIZE(trackOuterRadius) : tw;\n\n const startRad = valueToRadian(scaledStartX, tw, startAngle, endAngle);\n const endRad = valueToRadian(scaledEndX, tw, startAngle, endAngle);\n\n graphics.moveTo(outerPos.x, outerPos.y);\n graphics.arc(cx, cy, trackOuterRadius, startRad, endRad, true);\n graphics.arc(cx, cy, trackOuterRadius, endRad, startRad, false);\n graphics.closePath();\n }\n\n /* Labels */\n ticks.forEach(t => {\n const y = yScale(t);\n\n // The current position, i.e., radius, of this label\n const currentR = trackOuterRadius - ((rowPosition + rowHeight - y) / th) * trackRingSize;\n\n // The position of a tick in the polar system\n const pos = cartesianToPolar(SCALED_TICK_SIZE(currentR) * 2, tw, currentR, cx, cy, startAngle, endAngle);\n\n const styleConfig = getTextStyle({\n color: theme.axis.labelColor,\n size: theme.axis.labelFontSize,\n fontFamily: theme.axis.labelFontFamily,\n fontWeight: theme.axis.labelFontWeight\n });\n const textGraphic = new HGC.libraries.PIXI.Text(t, styleConfig);\n textGraphic.anchor.x = isLeft ? 1 : 0;\n textGraphic.anchor.y = 0.5;\n textGraphic.position.x = pos.x;\n textGraphic.position.y = pos.y;\n\n textGraphic.resolution = 4;\n const txtStyle = new HGC.libraries.PIXI.TextStyle(styleConfig);\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(textGraphic.text, txtStyle);\n\n // Scale the width of text label so that its width is the same when converted into circular form\n const txtWidth = ((metric.width / (2 * currentR * Math.PI)) * tw * 360) / (endAngle - startAngle);\n const scaledStartX = isLeft\n ? SCALED_TICK_SIZE(currentR) * 2\n : tw - SCALED_TICK_SIZE(currentR) * 2 - txtWidth;\n const scaledEndX = isLeft ? SCALED_TICK_SIZE(currentR) * 2 + txtWidth : tw - SCALED_TICK_SIZE(currentR) * 2;\n\n // Determine the points of a rope element for a lebel\n const ropePoints: import('pixi.js').Point[] = [];\n for (let i = scaledEndX; i >= scaledStartX; i -= txtWidth / 10.0) {\n const p = cartesianToPolar(i, tw, currentR, cx, cy, startAngle, endAngle);\n ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y));\n }\n\n // Render a label\n // @ts-expect-error missing argument in updateText?\n textGraphic.updateText();\n const rope = new HGC.libraries.PIXI.SimpleRope(textGraphic.texture, ropePoints);\n graphics.addChild(rope);\n });\n });\n}\n","import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar, valueToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\n\nexport function drawCircularOutlines(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n /* track spec */\n const spec = tm.spec();\n\n /* track size */\n const [l, t] = trackInfo.position;\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const trackInnerRadius = spec.innerRadius ?? 220; // TODO: should default values be filled already\n const trackOuterRadius = spec.outerRadius ?? 300; // TODO: should be smaller than Math.min(width, height)\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const cx = l + trackWidth / 2.0;\n const cy = t + trackHeight / 2.0;\n\n const posStartInner = cartesianToPolar(0, trackWidth, trackInnerRadius, cx, cy, startAngle, endAngle);\n const startRad = valueToRadian(0, trackWidth, startAngle, endAngle);\n const endRad = valueToRadian(trackWidth, trackWidth, startAngle, endAngle);\n\n /* render */\n const g = trackInfo.pBackground;\n\n if (!(spec.layout === 'circular' && spec.mark === 'withinLink')) {\n // circular link marks usually use entire inner space\n g.lineStyle(\n spec.style?.outlineWidth ? spec.style?.outlineWidth / 2.5 : 0,\n colorToHex(spec.style?.outline ?? '#DBDBDB'),\n 1, // 0.4, // alpha\n 1 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(\n colorToHex(tm.spec().style?.background ?? theme.track.background),\n tm.spec().style?.backgroundOpacity ??\n (!theme.track.background || theme.track.background === 'transparent' ? 0 : 1)\n );\n g.moveTo(posStartInner.x, posStartInner.y);\n g.arc(cx, cy, trackInnerRadius, startRad, endRad, true);\n g.arc(cx, cy, trackOuterRadius, endRad, startRad, false);\n g.closePath();\n }\n\n if (IsChannelDeep(spec.x) && spec.x.axis === 'top') {\n // outer line\n g.lineStyle(\n 0.5,\n colorToHex('black'),\n 0, // 1, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex('white'), 0);\n g.moveTo(posStartInner.x, posStartInner.y);\n g.arc(cx, cy, trackOuterRadius - 0.5, startRad, endRad, true);\n g.arc(cx, cy, trackOuterRadius, endRad, startRad, false);\n g.closePath();\n }\n\n // inner line\n // graphics.lineStyle(\n // 0.5,\n // colorToHex('black'),\n // 1, // alpha\n // 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n // );\n // graphics.beginFill(colorToHex('white'), 0);\n // graphics.moveTo(xToPos(0, innerRadius - 0.5).x, xToPos(0, innerRadius - 0.5).y);\n // graphics.arc(cx, cy, innerRadius - 0.5, xToDt(0), xToDt(trackWidth), true);\n // graphics.arc(cx, cy, innerRadius, xToDt(trackWidth), xToDt(0), false);\n // graphics.closePath();\n\n // slice on the top\n g.lineStyle(\n 0.5,\n colorToHex('black'),\n 0, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex('white'), 0);\n g.moveTo(cx, cy);\n g.arc(cx, cy, trackOuterRadius + 3, startRad, endRad, false);\n g.closePath();\n\n // center white hole\n g.lineStyle(\n 1,\n colorToHex('#DBDBDB'),\n 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex('white'), 0);\n g.drawCircle(cx, cy, trackInnerRadius - 1);\n}\n","import { isUndefined } from 'lodash-es';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport colorToHex from '../utils/color-to-hex';\nimport type { CompleteThemeDeep } from '../utils/theme';\n\nexport function drawBackground(trackInfo: any, tm: GoslingTrackModel, theme: Required) {\n // size and position\n const [l, t] = trackInfo.position;\n const [w, h] = trackInfo.dimensions;\n\n // refer to https://github.com/higlass/higlass/blob/f82c0a4f7b2ab1c145091166b0457638934b15f3/app/scripts/PixiTrack.js#L129\n const g = trackInfo.pBackground;\n\n if (tm.spec().style?.background || (theme.track.background && theme.track.background !== 'transparent')) {\n g.clear();\n\n const bg = tm.spec().style?.background ?? theme.track.background;\n const alpha = isUndefined(tm.spec().style?.backgroundOpacity) ? 1 : tm.spec().style?.backgroundOpacity;\n // background\n g.lineStyle(\n 1,\n colorToHex('white'),\n 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex(bg), alpha);\n g.drawRect(l, t, w, h);\n }\n\n if (theme.track.alternatingBackground && theme.track.alternatingBackground !== 'transparent') {\n const spec = tm.spec();\n\n if (!IsChannelDeep(spec.row) || spec.row.type !== 'nominal') {\n // we do not use a `row` channel, so no need to draw alternating backgrounds\n return;\n }\n\n /* row separation */\n const rowCategories: string[] = (tm.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n if (rowCategories.length === 0) {\n // We do not need to fill alternating colors for only one category\n return;\n }\n\n /* render */\n rowCategories.forEach((category, i) => {\n if (i % 2 === 0) {\n // we only draw even rows\n return;\n }\n const rowPosition = tm.encodedValue('row', category);\n\n const bg = tm.spec().style?.background ?? theme.track.alternatingBackground;\n const alpha = isUndefined(tm.spec().style?.backgroundOpacity) ? 1 : tm.spec().style?.backgroundOpacity;\n // background\n g.lineStyle(\n 1,\n colorToHex('white'),\n 0, // alpha\n 0 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex(bg), alpha);\n g.drawRect(trackInfo.position[0], trackInfo.position[1] + rowPosition, w, h / rowCategories.length);\n });\n }\n}\n","import type * as PIXI from 'pixi.js';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Channel } from '@gosling-lang/gosling-schema';\nimport { getValueUsingChannel, Is2DTrack } from '@gosling-lang/gosling-schema';\nimport { cartesianToPolar, positionToRadian } from '../utils/polar';\nimport colorToHex from '../utils/color-to-hex';\n\n// TODO: This code is taken from `link.ts` which is for withinLink marks. Large parts should be removed.\nexport function drawBetweenLink(g: PIXI.Graphics, trackInfo: any, model: GoslingTrackModel) {\n /* track spec */\n const spec = model.spec();\n\n if (!spec.width || !spec.height) {\n console.warn('Size of a track is not properly determined, so visual mark cannot be rendered');\n return;\n }\n\n /* data */\n const data = model.data();\n\n /* track size */\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* circular parameters */\n const circular = spec.layout === 'circular';\n const trackInnerRadius = spec.innerRadius ?? 220;\n const trackOuterRadius = spec.outerRadius ?? 300;\n const startAngle = spec.startAngle ?? 0;\n const endAngle = spec.endAngle ?? 360;\n const trackRingSize = trackOuterRadius - trackInnerRadius;\n const tcx = trackWidth / 2.0;\n const tcy = trackHeight / 2.0;\n\n /* row separation */\n const rowCategories: string[] = (model.getChannelDomainArray('row') as string[]) ?? ['___SINGLE_ROW___'];\n const rowHeight = trackHeight / rowCategories.length;\n\n // TODO: Can row be actually used for circular layouts?\n /* render */\n rowCategories.forEach(rowCategory => {\n const rowPosition = model.encodedValue('row', rowCategory);\n\n data.filter(\n d =>\n !getValueUsingChannel(d, spec.row as Channel) ||\n (getValueUsingChannel(d, spec.row as Channel) as string) === rowCategory\n ).forEach(d => {\n let x = model.encodedPIXIProperty('x', d);\n let xe = model.encodedPIXIProperty('xe', d);\n let x1 = model.encodedPIXIProperty('x1', d);\n let x1e = model.encodedPIXIProperty('x1e', d);\n const y = model.encodedPIXIProperty('y', d);\n const stroke = model.encodedPIXIProperty('stroke', d);\n const strokeWidth = model.encodedPIXIProperty('strokeWidth', d);\n const color = model.encodedPIXIProperty('color', d);\n const opacity = model.encodedPIXIProperty('opacity', d);\n\n // sort properly\n if (typeof xe !== 'undefined') {\n [x, xe] = [x, xe].sort((a, b) => a - b);\n }\n if (typeof x1 !== 'undefined' && typeof x1e !== 'undefined') {\n [x1, x1e] = [x1, x1e].sort((a, b) => a - b);\n }\n\n // Is this band or line?\n const isRibon =\n typeof xe !== 'undefined' &&\n typeof x1 !== 'undefined' &&\n typeof x1e !== 'undefined' &&\n // This means the strokeWidth of a band is too small, so we just need to draw a line instead\n Math.abs(x - xe) > 0.1 &&\n Math.abs(x1 - x1e) > 0.1;\n\n // TODO: This correction can be moved to the compile process\n if (!isRibon && xe === undefined && !Is2DTrack(spec)) {\n // We need to use a valid value to draw lines, so lets find alternative one.\n if (x1 === undefined && x1e === undefined) {\n // We do not have a valid ones.\n return;\n }\n xe = x1 !== undefined ? x1 : x1e;\n }\n\n if (!isRibon && Math.abs(x - xe) <= 0.1 && Math.abs(x1 - x1e) <= 0.1) {\n // Put the larger value on `xe` so that it can be used in line connection\n x = (x + xe) / 2.0;\n xe = (x1 + x1e) / 2.0;\n }\n\n // stroke\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n opacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n\n if (isRibon) {\n g.beginFill(color === 'none' ? colorToHex('white') : colorToHex(color), color === 'none' ? 0 : opacity);\n\n let [_x1, _x2, _x3, _x4] = [x, xe, x1, x1e];\n\n // Sort values to safely draw bands\n [_x1, _x2] = [_x1, _x2].sort((a, b) => a - b);\n [_x3, _x4] = [_x3, _x4].sort((a, b) => a - b);\n\n if (_x1 > trackWidth || _x4 < 0 || Math.abs(_x4 - _x1) < 0.5) {\n // Do not draw very small visual marks\n return;\n }\n\n if (circular) {\n if (_x1 < 0 || _x4 > trackWidth) {\n // Do not show bands that are partly outside of the current domain\n return;\n }\n\n // https://pixijs.download/dev/docs/PIXI.Graphics.html#bezierCurveTo\n const r = trackOuterRadius - (rowPosition / trackHeight) * trackRingSize;\n const posX = cartesianToPolar(_x1, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posXE = cartesianToPolar(_x2, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posX1 = cartesianToPolar(_x3, trackWidth, r, tcx, tcy, startAngle, endAngle);\n const posX1E = cartesianToPolar(_x4, trackWidth, r, tcx, tcy, startAngle, endAngle);\n\n g.moveTo(posX.x, posX.y);\n\n // outer curve\n g.bezierCurveTo(tcx, tcy, tcx, tcy, posX1E.x, posX1E.y);\n\n g.arc(\n tcx,\n tcy,\n trackOuterRadius,\n positionToRadian(posX1E.x, posX1E.y, tcx, tcy),\n positionToRadian(posX1.x, posX1.y, tcx, tcy),\n false\n );\n\n // inner curve\n g.bezierCurveTo(tcx, tcy, tcx, tcy, posXE.x, posXE.y);\n\n g.arc(\n tcx,\n tcy,\n trackOuterRadius,\n positionToRadian(posXE.x, posXE.y, tcx, tcy),\n positionToRadian(posX.x, posX.y, tcx, tcy),\n false\n );\n g.endFill();\n } else {\n // Linear mark\n g.moveTo(_x1, rowPosition);\n g.lineTo(_x2, rowPosition);\n g.lineTo(_x4, rowPosition + rowHeight);\n g.lineTo(_x3, rowPosition + rowHeight);\n g.lineTo(_x1, rowPosition);\n g.closePath();\n }\n } else {\n /* Line Connection */\n\n // Experimental\n if (Is2DTrack(spec)) {\n if (spec.style?.linkConnectionType === 'curve') {\n g.moveTo(x, 0);\n g.bezierCurveTo(\n (x / 5.0) * 4,\n (rowPosition + rowHeight - y) / 2.0,\n x / 2.0,\n ((rowPosition + rowHeight - y) / 5.0) * 4,\n 0,\n rowPosition + rowHeight - y\n );\n } else if (spec.style?.linkConnectionType === 'straight') {\n g.moveTo(x, 0);\n g.lineTo(0, rowPosition + rowHeight - y);\n } else {\n // spec.style?.linkConnectionType === 'corner'\n g.moveTo(x, 0);\n g.lineTo(x, rowPosition + rowHeight - y);\n g.lineTo(0, rowPosition + rowHeight - y);\n }\n return;\n }\n\n if (circular) {\n /* Original lines */\n // const r = trackOuterRadius - (rowPosition / trackHeight) * trackRingSize;\n // const posX = cartesianToPolar(x, trackWidth, r, tcx, tcy, startAngle, endAngle);\n // const posXE = cartesianToPolar(xe, trackWidth, trackInnerRadius, tcx, tcy, startAngle, endAngle);\n // g.lineStyle(\n // 1,\n // colorToHex('red'),\n // 1, // alpha\n // 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n // );\n // g.moveTo(posX.x, posX.y);\n // g.lineTo(posXE.x, posXE.y);\n\n // https://www.tessellationtech.io/tutorial-circular-sankey/\n let prevX, prevY;\n for (let t = 0; t <= 1; t += 0.02) {\n const logodds = (t: number) => Math.log(t / (1 - t));\n const movingRadius = (t: number) =>\n trackOuterRadius - (1 / (1 + Math.exp(logodds(t)))) * trackRingSize + 3;\n const getRadian = (t: number, s: number, e: number) => ((e - s) * t + s) / trackWidth;\n const _x = tcx + movingRadius(t) * Math.cos(-getRadian(t, x, xe) * 2 * Math.PI - Math.PI / 2.0);\n const _y = tcy + movingRadius(t) * Math.sin(-getRadian(t, x, xe) * 2 * Math.PI - Math.PI / 2.0);\n if (prevX && prevY) {\n g.lineStyle(\n strokeWidth,\n colorToHex(stroke),\n opacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.moveTo(prevX, prevY);\n g.lineTo(_x, _y);\n }\n prevX = _x;\n prevY = _y;\n }\n\n return;\n }\n\n // TODO: Not yet supported.\n g.moveTo(xe, rowPosition + rowHeight);\n g.lineTo(x, rowPosition);\n }\n });\n });\n}\n","import type { Tile } from '@gosling-lang/gosling-track';\nimport type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport { drawPoint } from './point';\nimport { drawLine } from './line';\nimport { drawBar } from './bar';\nimport { drawArea } from './area';\nimport { drawRect } from './rect';\nimport type { ChannelTypes } from '@gosling-lang/gosling-schema';\nimport { drawTriangle } from './triangle';\nimport { drawText } from './text';\nimport { drawRule } from './rule';\nimport { drawWithinLink } from './withinLink';\nimport { drawGrid } from './grid';\nimport { drawCircularTitle } from './title';\nimport { drawChartOutlines } from './outline';\nimport { drawColorLegend, drawRowLegend } from './legend';\nimport { drawCircularYAxis, drawLinearYAxis } from './axis';\nimport { drawCircularOutlines } from './outline-circular';\nimport { drawBackground } from './background';\nimport type { CompleteThemeDeep } from '../utils/theme';\nimport { Is2DTrack, IsVerticalRule } from '@gosling-lang/gosling-schema';\nimport { drawBetweenLink } from './betweenLink';\n\n/**\n * Visual channels currently supported for visual encoding.\n */\nexport const SUPPORTED_CHANNELS: (keyof typeof ChannelTypes)[] = [\n 'x',\n 'xe',\n 'x1',\n 'x1e',\n\n 'y',\n 'ye',\n 'y1',\n 'y1e',\n\n 'color',\n 'size',\n 'row',\n 'stroke',\n 'strokeWidth',\n 'opacity',\n 'text'\n // ...\n];\n\nexport const RESOLUTION = 4;\n\n/**\n * Draw a track based on the track specification in a Gosling grammar.\n */\nexport function drawMark(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel) {\n if (!HGC || !trackInfo || !tile) {\n // We did not receive parameters correctly.\n return;\n }\n\n if (model.spec().mark === 'brush') {\n // Interactive brushes are rendered by our another plugin track, called `gosling-brush`\n return;\n }\n\n // Replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher.\n (['x', 'x1', 'x1e', 'xe'] as const).forEach(d => {\n model.setChannelScale(d, trackInfo._xScale);\n });\n\n if (Is2DTrack(model.spec()) || IsVerticalRule(model.spec())) {\n // Since small numbers are positioned on the top in the y axis, we reverse the domain, making it consistent to regular y scale.\n const yScale = trackInfo._yScale.copy();\n yScale.range([yScale.range()[1], yScale.range()[0]]);\n\n ['y', 'y1', 'y1e', 'ye'].forEach((d: any) => {\n model.setChannelScale(d, yScale);\n });\n }\n\n // Size of a track\n const [trackWidth, trackHeight] = trackInfo.dimensions;\n\n /* spec */\n switch (model.spec().mark) {\n case 'point':\n drawPoint(trackInfo, tile.graphics, model);\n break;\n case 'bar':\n drawBar(trackInfo, tile, model);\n break;\n case 'line':\n drawLine(tile.graphics, model, trackWidth, trackHeight);\n break;\n case 'area':\n drawArea(HGC, trackInfo, tile, model);\n break;\n case 'rect':\n drawRect(HGC, trackInfo, tile, model);\n break;\n case 'triangleLeft':\n case 'triangleRight':\n case 'triangleBottom':\n drawTriangle(tile.graphics, model, trackWidth, trackHeight);\n break;\n case 'text':\n drawText(HGC, trackInfo, tile, model);\n break;\n case 'rule':\n drawRule(HGC, trackInfo, tile, model);\n break;\n case 'betweenLink':\n drawBetweenLink(tile.graphics, trackInfo, model);\n break;\n case 'withinLink':\n drawWithinLink(tile.graphics, trackInfo, model);\n break;\n default:\n console.warn('Unsupported mark type');\n break;\n }\n}\n\n/**\n * Draw chart embellishments before rendering marks.\n */\nexport function drawPreEmbellishment(\n HGC: import('@higlass/types').HGC,\n trackInfo: any,\n tile: Tile,\n model: GoslingTrackModel,\n theme: Required\n) {\n if (!HGC || !trackInfo || !tile) {\n // We did not receive parameters correctly.\n return;\n }\n\n if (model.spec().mark === 'brush') {\n // We do not draw brush. Instead, higlass do.\n return;\n }\n // Replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher.\n (['x', 'x1', 'x1e', 'xe'] as const).forEach(d => {\n model.setChannelScale(d, trackInfo._xScale);\n });\n\n const isCircular = model.spec().layout === 'circular';\n\n if (isCircular) {\n drawCircularOutlines(trackInfo, model, theme);\n } else {\n drawBackground(trackInfo, model, theme);\n drawChartOutlines(trackInfo, model, theme);\n }\n drawGrid(trackInfo, model, theme);\n}\n\n/**\n * Draw chart embellishments after rendering marks.\n */\nexport function drawPostEmbellishment(\n HGC: import('@higlass/types').HGC,\n trackInfo: any,\n tile: Tile,\n model: GoslingTrackModel,\n theme: Required\n) {\n if (!HGC || !trackInfo || !tile) {\n // We did not receive parameters correctly.\n return;\n }\n\n if (model.spec().mark === 'brush') {\n // We do not draw brush. Instead, higlass do.\n return;\n }\n // Replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher.\n (['x', 'x1', 'x1e', 'xe'] as const).forEach(d => {\n model.setChannelScale(d, trackInfo._xScale);\n });\n\n const isCircular = model.spec().layout === 'circular';\n\n if (isCircular) {\n drawCircularYAxis(HGC, trackInfo, tile, model, theme);\n drawCircularTitle(HGC, trackInfo, tile, model, theme);\n } else {\n drawLinearYAxis(HGC, trackInfo, tile, model, theme);\n drawRowLegend(HGC, trackInfo, tile, model, theme);\n }\n drawColorLegend(HGC, trackInfo, tile, model, theme);\n}\n","import type {\n AxisPosition,\n SingleTrack,\n OverlaidTrack,\n Track,\n ChannelDeep,\n DataDeep\n} from '@gosling-lang/gosling-schema';\nimport { IsChannelDeep, IsDataTrack, IsOverlaidTrack, IsSingleTrack, IsDummyTrack } from '@gosling-lang/gosling-schema';\n\n/**\n * Resolve superposed tracks into multiple track specifications.\n * Some options are corrected to ensure the resolved tracks use consistent visual properties, such as the existence of the axis for genomic coordinates.\n */\nexport function resolveSuperposedTracks(track: Track): SingleTrack[] {\n if (IsDataTrack(track) || IsDummyTrack(track)) {\n // no BasicSingleTrack to return\n return [];\n }\n\n if (!IsOverlaidTrack(track)) {\n // no `superpose` to resolve\n return [track];\n }\n\n if (track._overlay.length === 0) {\n // This makes sure not to return empty object\n return [{ ...track, superpose: undefined } as SingleTrack];\n }\n\n // TODO: Is this sufficient? If yes, also apply to other functions doing this.\n const { _overlay, ...base } = track as Partial;\n // delete (base as Partial).overlay; // remove `superpose` from the base spec\n\n const resolved: SingleTrack[] = [];\n track._overlay.forEach((subSpec, i) => {\n const spec = Object.assign({}, base, subSpec) as SingleTrack;\n if (spec.title && i !== 0) {\n delete spec.title;\n }\n resolved.push(spec);\n });\n\n /* Correct the spec for consistency */\n // x-axis\n let xAxisPosition: undefined | AxisPosition = undefined;\n resolved.forEach(d => {\n if (IsChannelDeep(d.x) && d.x.axis && !xAxisPosition) {\n xAxisPosition = d.x.axis;\n }\n });\n\n const corrected = resolved.map(d => {\n return {\n ...d,\n x: { ...d.x, axis: xAxisPosition }\n } as SingleTrack;\n });\n\n // height\n // ...\n\n return corrected;\n}\n\n/**\n * Spread overlaid tracks if they are assigned to different data/metadata.\n * This process is necessary since we are passing over each track to HiGlass, and if a single track is mapped to multiple datastes, HiGlass cannot handle that.\n */\nexport function spreadTracksByData(tracks: Track[]): Track[] {\n return ([] as Track[]).concat(\n ...tracks.map(t => {\n if (IsDataTrack(t) || !IsOverlaidTrack(t) || t._overlay.length <= 1) {\n // no overlaid tracks to spread\n return [t];\n }\n\n if (t._overlay.filter(s => s.data).length === 0) {\n // overlaid tracks use the parent's data specs as it w/o re-specification, so no point to spread.\n return [t];\n }\n\n if (isIdenticalDataSpec([t.data, ...t._overlay.map(s => s.data)])) {\n // individual overlaid tracks define the same data, so no point to spread.\n return [t];\n }\n\n const base: Partial = { ...t, id: undefined, _overlay: undefined };\n const spread: Track[] = [];\n const original: OverlaidTrack = JSON.parse(JSON.stringify(base));\n original._overlay = [];\n\n t._overlay.forEach(subSpec => {\n // If data specs are undefined, put the first spec to the parent\n if (!original.data) {\n original.data = subSpec.data;\n }\n\n // If the id is undefined, put the first spec to the parent\n if (!original.id) {\n original.id = subSpec.id;\n }\n\n // Determine if this `subSpec` should be added to `overlay` or become a separate track\n if (!subSpec.data || isIdenticalDataSpec([original.data, subSpec.data])) {\n original._overlay.push(subSpec);\n return;\n }\n\n const spec = Object.assign(JSON.parse(JSON.stringify(base)), subSpec) as SingleTrack;\n spread.push(spec);\n });\n\n const output = original._overlay.length > 0 ? [original, ...spread] : spread;\n return output.map((track, i, arr) => {\n const overlayOnPreviousTrack = i !== 0;\n\n // Y axis should be positioned on the right or hidden if multiple tracks are overlaid to prevent visual occlussion.\n // Refer to this issue: https://github.com/gosling-lang/gosling.js/issues/400\n const y =\n IsSingleTrack(track) && IsChannelDeep(track.y) && !track.y.axis && overlayOnPreviousTrack\n ? ({ ...track.y, axis: i === 1 ? 'right' : 'none' } as ChannelDeep)\n : IsSingleTrack(track)\n ? track.y\n : undefined;\n\n if (track.title && i !== arr.length - 1 && arr.length !== 1) {\n delete track.title; // remove `title` except the last one\n }\n return { ...track, overlayOnPreviousTrack, y } as Track;\n });\n })\n );\n}\n\nexport function isIdenticalDataSpec(specs: (DataDeep | undefined)[]): boolean {\n if (specs.length === 0) {\n return false;\n }\n\n const definedSpecs = specs.filter(d => d) as DataDeep[];\n\n if (definedSpecs.length !== specs.length) {\n return false;\n }\n\n // Iterate keys to check if these are identical\n const keys = Object.keys(definedSpecs[0]).sort();\n let isIdentical = true;\n keys.forEach(k => {\n const uniqueProperties = Array.from(new Set(definedSpecs.map(d => JSON.stringify((d as any)[k]))));\n if (uniqueProperties.length !== 1) {\n isIdentical = false;\n return;\n }\n });\n return isIdentical;\n}\n","import type {\n ChannelDeep,\n ChannelValue,\n DataDeep,\n Datum,\n DomainChr,\n DomainInterval,\n DomainChrInterval,\n Style,\n Track,\n SingleTrack,\n OverlaidTrack,\n ChannelTypes,\n Channel,\n FieldType,\n Domain,\n FilterTransform,\n OneOfFilter,\n RangeFilter,\n IncludeFilter,\n BeddbData,\n MultivecData,\n MatrixData,\n VectorData,\n DataTrack,\n BigWigData,\n SingleView,\n FlatTracks,\n OverlaidTracks,\n StackedTracks,\n BamData,\n Range,\n TemplateTrack,\n MouseEventsDeep,\n DataTransform,\n DummyTrack\n} from './gosling.schema';\nimport { SUPPORTED_CHANNELS } from '../core/mark';\nimport {\n interpolateGreys,\n interpolateWarm,\n interpolateSpectral,\n interpolateCividis,\n interpolateBuPu,\n interpolateRdBu,\n interpolateViridis,\n interpolateYlOrBr,\n interpolateRdPu\n} from 'd3-scale-chromatic';\nimport { resolveSuperposedTracks } from '../core/utils/overlay';\nimport type { TabularDataFetcher } from '@data-fetchers';\n\nexport const PREDEFINED_COLOR_STR_MAP: { [k: string]: (t: number) => string } = {\n viridis: interpolateViridis,\n grey: interpolateGreys,\n warm: interpolateWarm,\n spectral: interpolateSpectral,\n cividis: interpolateCividis,\n bupu: interpolateBuPu,\n rdbu: interpolateRdBu,\n hot: interpolateYlOrBr,\n pink: interpolateRdPu\n};\n\nexport function isObject(x: unknown): x is Record {\n return typeof x === 'object' && x !== null;\n}\n\nexport function isTabularDataFetcher(dataFetcher: unknown): dataFetcher is TabularDataFetcher {\n return isObject(dataFetcher) && 'getTabularData' in dataFetcher;\n}\n\nexport function hasDataTransform(spec: SingleTrack | OverlaidTrack, type: DataTransform['type']) {\n return (spec.dataTransform ?? []).some(d => d.type === type);\n}\n\n/**\n * This returns an array of color strings that can be assigned to HiGlass' option, `colorRange`\n */\nexport function getHiGlassColorRange(colorStr = 'viridis', step = 100) {\n const interpolate = PREDEFINED_COLOR_STR_MAP[colorStr] ?? PREDEFINED_COLOR_STR_MAP['viridis'];\n return [...Array(step)].map((_, i) => interpolate((1 / step) * i));\n}\n\nexport function IsFlatTracks(_: SingleView): _ is FlatTracks {\n return !('alignment' in _) && !_.tracks.find(d => (d as any).alignment === 'overlay' || 'tracks' in d);\n}\nexport function IsOverlaidTracks(_: SingleView): _ is OverlaidTracks {\n return 'alignment' in _ && _.alignment === 'overlay';\n}\nexport function IsStackedTracks(_: SingleView): _ is StackedTracks {\n return !IsFlatTracks(_) && !IsOverlaidTracks(_);\n}\n\nexport function IsDataTrack(_: Track): _ is DataTrack {\n // !!! Track might not contain `mark` when it is superposed one\n return !IsOverlaidTrack(_) && 'data' in _ && !('mark' in _);\n}\nexport function IsDummyTrack(_: Track): _ is DummyTrack {\n return 'type' in _ && _.type == 'dummy-track';\n}\n\nexport function IsDataTemplate(_: Partial): boolean {\n return !!('data' in _ && 'overrideTemplate' in _ && _.overrideTemplate);\n}\n\nexport function IsDataDeep(data: DataDeep | Datum[]): data is DataDeep {\n return typeof data === 'object';\n}\n\nexport function IsDomainFlat(domain: Domain): domain is string[] | number[] {\n return Array.isArray(domain);\n}\n\nexport function IsDomainChr(domain: Domain): domain is DomainChr {\n return 'chromosome' in domain && !('interval' in domain);\n}\n\nexport function IsDomainInterval(domain: Domain): domain is DomainInterval {\n return !('chromosome' in domain) && 'interval' in domain;\n}\n\nexport function IsDomainChrInterval(domain: Domain): domain is DomainChrInterval {\n return 'chromosome' in domain && 'interval' in domain;\n}\n\nexport function IsTrackStyle(track: Style | undefined): track is Style {\n return track !== undefined;\n}\n\nexport function IsSingleTrack(track: Track): track is SingleTrack {\n return !('_overlay' in track);\n}\n\nexport function IsOverlaidTrack(track: Partial): track is OverlaidTrack {\n return '_overlay' in track;\n}\n\nexport function IsTemplateTrack(track: Partial): track is TemplateTrack {\n return 'template' in track;\n}\n\n/**\n * Is this a vertical rule, i.e., y genomic axis?\n */\nexport function IsVerticalRule(track: Track) {\n return IsSingleTrack(track) && !IsChannelDeep(track.x) && IsChannelDeep(track.y) && track.y.type === 'genomic';\n}\n\n/**\n * Is this 2D track, i.e., two genomic axes?\n */\nexport function Is2DTrack(track: Track) {\n // If this is an overlaid tracks (e.g., matrix w/ rules),\n // we use the first `SingleTrack` to check the type of two axes.\n const t = IsSingleTrack(track) ? track : resolveSuperposedTracks(track)[0];\n return IsChannelDeep(t.x) && t.x.type === 'genomic' && IsChannelDeep(t.y) && t.y.type === 'genomic';\n}\n\n/**\n * Do we want to use HiGlass matrix track (i.e., 'heatmap') to rendering the given visualization?\n */\nexport function IsHiGlassMatrix(track: SingleTrack) {\n return (\n Is2DTrack(track) &&\n track.data.type === 'matrix' &&\n (track.mark === 'bar' || track.mark === 'rect') &&\n track.xe &&\n track.ye\n );\n}\n\nexport function IsChannelValue(channel: ChannelDeep | ChannelValue | undefined | 'none'): channel is ChannelValue {\n return channel !== null && typeof channel === 'object' && 'value' in channel;\n}\n\nexport function IsDataDeepTileset(\n _: DataDeep | undefined\n): _ is BeddbData | VectorData | MultivecData | BigWigData | BamData | MatrixData {\n return (\n _ !== undefined &&\n (_.type === 'vector' ||\n _.type === 'beddb' ||\n _.type === 'multivec' ||\n _.type === 'bigwig' ||\n _.type === 'matrix' ||\n _.type === 'bam' ||\n _.type === 'vcf' ||\n _.type === 'gff' ||\n _.type === 'bed')\n );\n}\n\n/**\n * Checks if a channel is of type ChannelDeep\n */\nexport function IsChannelDeep(channel: ChannelDeep | ChannelValue | undefined): channel is ChannelDeep {\n return isObject(channel) && !('value' in channel);\n}\n\nexport function IsOneOfFilter(_: FilterTransform): _ is OneOfFilter {\n return 'oneOf' in _;\n}\n\nexport function IsRangeFilter(_: FilterTransform): _ is RangeFilter {\n return 'inRange' in _;\n}\n\nexport function IsIncludeFilter(_: FilterTransform): _ is IncludeFilter {\n return 'include' in _;\n}\n\n/**\n * Check whether domain is in array shape.\n */\nexport function IsDomainArray(domain?: Domain): domain is string[] | number[] {\n return Array.isArray(domain);\n}\n\n/**\n * Check whether range is in array shape.\n */\nexport function IsRangeArray(range?: Range): range is string[] | number[] {\n return Array.isArray(range);\n}\n\n// TODO: perhaps, combine this with `isStackedChannel`\n/**\n * Check whether visual marks can be stacked on top of each other.\n */\nexport function IsStackedMark(track: SingleTrack): boolean {\n return (\n (track.mark === 'bar' || track.mark === 'area' || track.mark === 'text') &&\n IsChannelDeep(track.color) &&\n track.color.type === 'nominal' &&\n (!track.row || IsChannelValue(track.row)) &&\n // TODO: determine whether to use stacked bar for nominal fields or not\n IsChannelDeep(track.y) &&\n track.y.type === 'quantitative' &&\n !IsChannelDeep(track.ye)\n );\n}\n\n/**\n * Check whether visual marks in this channel are stacked on top of each other.\n * For example, `area` marks with a `quantitative` `y` channel are being stacked.\n */\nexport function IsStackedChannel(track: SingleTrack, channelKey: keyof typeof ChannelTypes): boolean {\n const channel = track[channelKey];\n return (\n IsStackedMark(track) &&\n // only x or y channel can be stacked\n (channelKey === 'x' || channelKey === 'y') &&\n // only quantitative channel can be stacked\n IsChannelDeep(channel) &&\n channel.type === 'quantitative'\n );\n}\n\n/**\n * Retreive value using a `channel`.\n * `undefined` if unable to retreive the value.\n */\nexport function getValueUsingChannel(datum: { [k: string]: string | number }, channel: Channel) {\n if (IsChannelDeep(channel) && channel.field) {\n return datum[channel?.field];\n }\n return undefined;\n}\n\nexport function getChannelKeysByAggregateFnc(spec: SingleTrack) {\n const keys: (keyof typeof ChannelTypes)[] = [];\n SUPPORTED_CHANNELS.forEach(k => {\n const c = spec[k];\n if (IsChannelDeep(c) && 'aggregate' in c) {\n keys.push(k);\n }\n });\n return keys;\n}\n\n/**\n * Get channel keys by a field type.\n */\nexport function getChannelKeysByType(spec: SingleTrack, t: FieldType) {\n const keys: (keyof typeof ChannelTypes)[] = [];\n SUPPORTED_CHANNELS.forEach(k => {\n const c = spec[k];\n if (IsChannelDeep(c) && c.type === t) {\n keys.push(k);\n }\n });\n return keys;\n}\n\nexport function IsXAxis(_: Track) {\n if ((IsSingleTrack(_) || IsOverlaidTrack(_)) && IsChannelDeep(_.x) && _.x.axis && _.x.axis !== 'none') {\n return true;\n } else if (IsOverlaidTrack(_)) {\n let isFound = false;\n _._overlay.forEach(t => {\n if (isFound) return;\n\n if (IsChannelDeep(t.x) && t.x.axis && t.x.axis !== 'none') {\n isFound = true;\n }\n });\n return isFound;\n }\n return false;\n}\n\nexport function IsYAxis(_: Track) {\n if ((IsSingleTrack(_) || IsOverlaidTrack(_)) && IsChannelDeep(_.y) && _.y.axis && _.y.axis !== 'none') {\n return true;\n } else if (IsOverlaidTrack(_)) {\n let isFound = false;\n _._overlay.forEach(t => {\n if (isFound) return;\n\n if (IsChannelDeep(t.y) && t.y.axis && t.y.axis !== 'none') {\n isFound = true;\n }\n });\n return isFound;\n }\n return false;\n}\n\n/* ----------------------------- MOUSE EVENT ----------------------------- */\n\nexport function IsMouseEventsDeep(_?: boolean | MouseEventsDeep): _ is MouseEventsDeep {\n return typeof _ === 'object';\n}\n","/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */\n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n\ttypeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t(factory((global.URI = global.URI || {})));\n}(this, (function (exports) { 'use strict';\n\nfunction merge() {\n for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {\n sets[_key] = arguments[_key];\n }\n\n if (sets.length > 1) {\n sets[0] = sets[0].slice(0, -1);\n var xl = sets.length - 1;\n for (var x = 1; x < xl; ++x) {\n sets[x] = sets[x].slice(1, -1);\n }\n sets[xl] = sets[xl].slice(1);\n return sets.join('');\n } else {\n return sets[0];\n }\n}\nfunction subexp(str) {\n return \"(?:\" + str + \")\";\n}\nfunction typeOf(o) {\n return o === undefined ? \"undefined\" : o === null ? \"null\" : Object.prototype.toString.call(o).split(\" \").pop().split(\"]\").shift().toLowerCase();\n}\nfunction toUpperCase(str) {\n return str.toUpperCase();\n}\nfunction toArray(obj) {\n return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== \"number\" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : [];\n}\nfunction assign(target, source) {\n var obj = target;\n if (source) {\n for (var key in source) {\n obj[key] = source[key];\n }\n }\n return obj;\n}\n\nfunction buildExps(isIRI) {\n var ALPHA$$ = \"[A-Za-z]\",\n CR$ = \"[\\\\x0D]\",\n DIGIT$$ = \"[0-9]\",\n DQUOTE$$ = \"[\\\\x22]\",\n HEXDIG$$ = merge(DIGIT$$, \"[A-Fa-f]\"),\n //case-insensitive\n LF$$ = \"[\\\\x0A]\",\n SP$$ = \"[\\\\x20]\",\n PCT_ENCODED$ = subexp(subexp(\"%[EFef]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%[89A-Fa-f]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%\" + HEXDIG$$ + HEXDIG$$)),\n //expanded\n GEN_DELIMS$$ = \"[\\\\:\\\\/\\\\?\\\\#\\\\[\\\\]\\\\@]\",\n SUB_DELIMS$$ = \"[\\\\!\\\\$\\\\&\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\;\\\\=]\",\n RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),\n UCSCHAR$$ = isIRI ? \"[\\\\xA0-\\\\u200D\\\\u2010-\\\\u2029\\\\u202F-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFEF]\" : \"[]\",\n //subset, excludes bidi control characters\n IPRIVATE$$ = isIRI ? \"[\\\\uE000-\\\\uF8FF]\" : \"[]\",\n //subset\n UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, \"[\\\\-\\\\.\\\\_\\\\~]\", UCSCHAR$$),\n SCHEME$ = subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, \"[\\\\+\\\\-\\\\.]\") + \"*\"),\n USERINFO$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:]\")) + \"*\"),\n DEC_OCTET$ = subexp(subexp(\"25[0-5]\") + \"|\" + subexp(\"2[0-4]\" + DIGIT$$) + \"|\" + subexp(\"1\" + DIGIT$$ + DIGIT$$) + \"|\" + subexp(\"[1-9]\" + DIGIT$$) + \"|\" + DIGIT$$),\n DEC_OCTET_RELAXED$ = subexp(subexp(\"25[0-5]\") + \"|\" + subexp(\"2[0-4]\" + DIGIT$$) + \"|\" + subexp(\"1\" + DIGIT$$ + DIGIT$$) + \"|\" + subexp(\"0?[1-9]\" + DIGIT$$) + \"|0?0?\" + DIGIT$$),\n //relaxed parsing rules\n IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$ + \"\\\\.\" + DEC_OCTET_RELAXED$),\n H16$ = subexp(HEXDIG$$ + \"{1,4}\"),\n LS32$ = subexp(subexp(H16$ + \"\\\\:\" + H16$) + \"|\" + IPV4ADDRESS$),\n IPV6ADDRESS1$ = subexp(subexp(H16$ + \"\\\\:\") + \"{6}\" + LS32$),\n // 6( h16 \":\" ) ls32\n IPV6ADDRESS2$ = subexp(\"\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{5}\" + LS32$),\n // \"::\" 5( h16 \":\" ) ls32\n IPV6ADDRESS3$ = subexp(subexp(H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{4}\" + LS32$),\n //[ h16 ] \"::\" 4( h16 \":\" ) ls32\n IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,1}\" + H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{3}\" + LS32$),\n //[ *1( h16 \":\" ) h16 ] \"::\" 3( h16 \":\" ) ls32\n IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,2}\" + H16$) + \"?\\\\:\\\\:\" + subexp(H16$ + \"\\\\:\") + \"{2}\" + LS32$),\n //[ *2( h16 \":\" ) h16 ] \"::\" 2( h16 \":\" ) ls32\n IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,3}\" + H16$) + \"?\\\\:\\\\:\" + H16$ + \"\\\\:\" + LS32$),\n //[ *3( h16 \":\" ) h16 ] \"::\" h16 \":\" ls32\n IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,4}\" + H16$) + \"?\\\\:\\\\:\" + LS32$),\n //[ *4( h16 \":\" ) h16 ] \"::\" ls32\n IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,5}\" + H16$) + \"?\\\\:\\\\:\" + H16$),\n //[ *5( h16 \":\" ) h16 ] \"::\" h16\n IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + \"\\\\:\") + \"{0,6}\" + H16$) + \"?\\\\:\\\\:\"),\n //[ *6( h16 \":\" ) h16 ] \"::\"\n IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join(\"|\")),\n ZONEID$ = subexp(subexp(UNRESERVED$$ + \"|\" + PCT_ENCODED$) + \"+\"),\n //RFC 6874\n IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + \"\\\\%25\" + ZONEID$),\n //RFC 6874\n IPV6ADDRZ_RELAXED$ = subexp(IPV6ADDRESS$ + subexp(\"\\\\%25|\\\\%(?!\" + HEXDIG$$ + \"{2})\") + ZONEID$),\n //RFC 6874, with relaxed parsing rules\n IPVFUTURE$ = subexp(\"[vV]\" + HEXDIG$$ + \"+\\\\.\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:]\") + \"+\"),\n IP_LITERAL$ = subexp(\"\\\\[\" + subexp(IPV6ADDRZ_RELAXED$ + \"|\" + IPV6ADDRESS$ + \"|\" + IPVFUTURE$) + \"\\\\]\"),\n //RFC 6874\n REG_NAME$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$)) + \"*\"),\n HOST$ = subexp(IP_LITERAL$ + \"|\" + IPV4ADDRESS$ + \"(?!\" + REG_NAME$ + \")\" + \"|\" + REG_NAME$),\n PORT$ = subexp(DIGIT$$ + \"*\"),\n AUTHORITY$ = subexp(subexp(USERINFO$ + \"@\") + \"?\" + HOST$ + subexp(\"\\\\:\" + PORT$) + \"?\"),\n PCHAR$ = subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@]\")),\n SEGMENT$ = subexp(PCHAR$ + \"*\"),\n SEGMENT_NZ$ = subexp(PCHAR$ + \"+\"),\n SEGMENT_NZ_NC$ = subexp(subexp(PCT_ENCODED$ + \"|\" + merge(UNRESERVED$$, SUB_DELIMS$$, \"[\\\\@]\")) + \"+\"),\n PATH_ABEMPTY$ = subexp(subexp(\"\\\\/\" + SEGMENT$) + \"*\"),\n PATH_ABSOLUTE$ = subexp(\"\\\\/\" + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + \"?\"),\n //simplified\n PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$),\n //simplified\n PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$),\n //simplified\n PATH_EMPTY$ = \"(?!\" + PCHAR$ + \")\",\n PATH$ = subexp(PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$),\n QUERY$ = subexp(subexp(PCHAR$ + \"|\" + merge(\"[\\\\/\\\\?]\", IPRIVATE$$)) + \"*\"),\n FRAGMENT$ = subexp(subexp(PCHAR$ + \"|[\\\\/\\\\?]\") + \"*\"),\n HIER_PART$ = subexp(subexp(\"\\\\/\\\\/\" + AUTHORITY$ + PATH_ABEMPTY$) + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$),\n URI$ = subexp(SCHEME$ + \"\\\\:\" + HIER_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\" + subexp(\"\\\\#\" + FRAGMENT$) + \"?\"),\n RELATIVE_PART$ = subexp(subexp(\"\\\\/\\\\/\" + AUTHORITY$ + PATH_ABEMPTY$) + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_EMPTY$),\n RELATIVE$ = subexp(RELATIVE_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\" + subexp(\"\\\\#\" + FRAGMENT$) + \"?\"),\n URI_REFERENCE$ = subexp(URI$ + \"|\" + RELATIVE$),\n ABSOLUTE_URI$ = subexp(SCHEME$ + \"\\\\:\" + HIER_PART$ + subexp(\"\\\\?\" + QUERY$) + \"?\"),\n GENERIC_REF$ = \"^(\" + SCHEME$ + \")\\\\:\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n RELATIVE_REF$ = \"^(){0}\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_NOSCHEME$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n ABSOLUTE_REF$ = \"^(\" + SCHEME$ + \")\\\\:\" + subexp(subexp(\"\\\\/\\\\/(\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?)\") + \"?(\" + PATH_ABEMPTY$ + \"|\" + PATH_ABSOLUTE$ + \"|\" + PATH_ROOTLESS$ + \"|\" + PATH_EMPTY$ + \")\") + subexp(\"\\\\?(\" + QUERY$ + \")\") + \"?$\",\n SAMEDOC_REF$ = \"^\" + subexp(\"\\\\#(\" + FRAGMENT$ + \")\") + \"?$\",\n AUTHORITY_REF$ = \"^\" + subexp(\"(\" + USERINFO$ + \")@\") + \"?(\" + HOST$ + \")\" + subexp(\"\\\\:(\" + PORT$ + \")\") + \"?$\";\n return {\n NOT_SCHEME: new RegExp(merge(\"[^]\", ALPHA$$, DIGIT$$, \"[\\\\+\\\\-\\\\.]\"), \"g\"),\n NOT_USERINFO: new RegExp(merge(\"[^\\\\%\\\\:]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n NOT_HOST: new RegExp(merge(\"[^\\\\%\\\\[\\\\]\\\\:]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n NOT_PATH: new RegExp(merge(\"[^\\\\%\\\\/\\\\:\\\\@]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n NOT_PATH_NOSCHEME: new RegExp(merge(\"[^\\\\%\\\\/\\\\@]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n NOT_QUERY: new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@\\\\/\\\\?]\", IPRIVATE$$), \"g\"),\n NOT_FRAGMENT: new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, SUB_DELIMS$$, \"[\\\\:\\\\@\\\\/\\\\?]\"), \"g\"),\n ESCAPE: new RegExp(merge(\"[^]\", UNRESERVED$$, SUB_DELIMS$$), \"g\"),\n UNRESERVED: new RegExp(UNRESERVED$$, \"g\"),\n OTHER_CHARS: new RegExp(merge(\"[^\\\\%]\", UNRESERVED$$, RESERVED$$), \"g\"),\n PCT_ENCODED: new RegExp(PCT_ENCODED$, \"g\"),\n IPV4ADDRESS: new RegExp(\"^(\" + IPV4ADDRESS$ + \")$\"),\n IPV6ADDRESS: new RegExp(\"^\\\\[?(\" + IPV6ADDRESS$ + \")\" + subexp(subexp(\"\\\\%25|\\\\%(?!\" + HEXDIG$$ + \"{2})\") + \"(\" + ZONEID$ + \")\") + \"?\\\\]?$\") //RFC 6874, with relaxed parsing rules\n };\n}\nvar URI_PROTOCOL = buildExps(false);\n\nvar IRI_PROTOCOL = buildExps(true);\n\nvar slicedToArray = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n}();\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar toConsumableArray = function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n};\n\n/** Highest positive signed 32-bit float value */\n\nvar maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1\n\n/** Bootstring parameters */\nvar base = 36;\nvar tMin = 1;\nvar tMax = 26;\nvar skew = 38;\nvar damp = 700;\nvar initialBias = 72;\nvar initialN = 128; // 0x80\nvar delimiter = '-'; // '\\x2D'\n\n/** Regular expressions */\nvar regexPunycode = /^xn--/;\nvar regexNonASCII = /[^\\0-\\x7E]/; // non-ASCII chars\nvar regexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g; // RFC 3490 separators\n\n/** Error messages */\nvar errors = {\n\t'overflow': 'Overflow: input needs wider integers to process',\n\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t'invalid-input': 'Invalid input'\n};\n\n/** Convenience shortcuts */\nvar baseMinusTMin = base - tMin;\nvar floor = Math.floor;\nvar stringFromCharCode = String.fromCharCode;\n\n/*--------------------------------------------------------------------------*/\n\n/**\n * A generic error utility function.\n * @private\n * @param {String} type The error type.\n * @returns {Error} Throws a `RangeError` with the applicable error message.\n */\nfunction error$1(type) {\n\tthrow new RangeError(errors[type]);\n}\n\n/**\n * A generic `Array#map` utility function.\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} callback The function that gets called for every array\n * item.\n * @returns {Array} A new array of values returned by the callback function.\n */\nfunction map(array, fn) {\n\tvar result = [];\n\tvar length = array.length;\n\twhile (length--) {\n\t\tresult[length] = fn(array[length]);\n\t}\n\treturn result;\n}\n\n/**\n * A simple `Array#map`-like wrapper to work with domain name strings or email\n * addresses.\n * @private\n * @param {String} domain The domain name or email address.\n * @param {Function} callback The function that gets called for every\n * character.\n * @returns {Array} A new string of characters returned by the callback\n * function.\n */\nfunction mapDomain(string, fn) {\n\tvar parts = string.split('@');\n\tvar result = '';\n\tif (parts.length > 1) {\n\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t// the local part (i.e. everything up to `@`) intact.\n\t\tresult = parts[0] + '@';\n\t\tstring = parts[1];\n\t}\n\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\tstring = string.replace(regexSeparators, '\\x2E');\n\tvar labels = string.split('.');\n\tvar encoded = map(labels, fn).join('.');\n\treturn result + encoded;\n}\n\n/**\n * Creates an array containing the numeric code points of each Unicode\n * character in the string. While JavaScript uses UCS-2 internally,\n * this function will convert a pair of surrogate halves (each of which\n * UCS-2 exposes as separate characters) into a single code point,\n * matching UTF-16.\n * @see `punycode.ucs2.encode`\n * @see \n * @memberOf punycode.ucs2\n * @name decode\n * @param {String} string The Unicode input string (UCS-2).\n * @returns {Array} The new array of code points.\n */\nfunction ucs2decode(string) {\n\tvar output = [];\n\tvar counter = 0;\n\tvar length = string.length;\n\twhile (counter < length) {\n\t\tvar value = string.charCodeAt(counter++);\n\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t// It's a high surrogate, and there is a next character.\n\t\t\tvar extra = string.charCodeAt(counter++);\n\t\t\tif ((extra & 0xFC00) == 0xDC00) {\n\t\t\t\t// Low surrogate.\n\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t} else {\n\t\t\t\t// It's an unmatched surrogate; only append this code unit, in case the\n\t\t\t\t// next code unit is the high surrogate of a surrogate pair.\n\t\t\t\toutput.push(value);\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t} else {\n\t\t\toutput.push(value);\n\t\t}\n\t}\n\treturn output;\n}\n\n/**\n * Creates a string based on an array of numeric code points.\n * @see `punycode.ucs2.decode`\n * @memberOf punycode.ucs2\n * @name encode\n * @param {Array} codePoints The array of numeric code points.\n * @returns {String} The new Unicode string (UCS-2).\n */\nvar ucs2encode = function ucs2encode(array) {\n\treturn String.fromCodePoint.apply(String, toConsumableArray(array));\n};\n\n/**\n * Converts a basic code point into a digit/integer.\n * @see `digitToBasic()`\n * @private\n * @param {Number} codePoint The basic numeric code point value.\n * @returns {Number} The numeric value of a basic code point (for use in\n * representing integers) in the range `0` to `base - 1`, or `base` if\n * the code point does not represent a value.\n */\nvar basicToDigit = function basicToDigit(codePoint) {\n\tif (codePoint - 0x30 < 0x0A) {\n\t\treturn codePoint - 0x16;\n\t}\n\tif (codePoint - 0x41 < 0x1A) {\n\t\treturn codePoint - 0x41;\n\t}\n\tif (codePoint - 0x61 < 0x1A) {\n\t\treturn codePoint - 0x61;\n\t}\n\treturn base;\n};\n\n/**\n * Converts a digit/integer into a basic code point.\n * @see `basicToDigit()`\n * @private\n * @param {Number} digit The numeric value of a basic code point.\n * @returns {Number} The basic code point whose value (when used for\n * representing integers) is `digit`, which needs to be in the range\n * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n * used; else, the lowercase form is used. The behavior is undefined\n * if `flag` is non-zero and `digit` has no uppercase form.\n */\nvar digitToBasic = function digitToBasic(digit, flag) {\n\t// 0..25 map to ASCII a..z or A..Z\n\t// 26..35 map to ASCII 0..9\n\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n};\n\n/**\n * Bias adaptation function as per section 3.4 of RFC 3492.\n * https://tools.ietf.org/html/rfc3492#section-3.4\n * @private\n */\nvar adapt = function adapt(delta, numPoints, firstTime) {\n\tvar k = 0;\n\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\tdelta += floor(delta / numPoints);\n\tfor (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\tdelta = floor(delta / baseMinusTMin);\n\t}\n\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n};\n\n/**\n * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n * symbols.\n * @memberOf punycode\n * @param {String} input The Punycode string of ASCII-only symbols.\n * @returns {String} The resulting string of Unicode symbols.\n */\nvar decode = function decode(input) {\n\t// Don't use UCS-2.\n\tvar output = [];\n\tvar inputLength = input.length;\n\tvar i = 0;\n\tvar n = initialN;\n\tvar bias = initialBias;\n\n\t// Handle the basic code points: let `basic` be the number of input code\n\t// points before the last delimiter, or `0` if there is none, then copy\n\t// the first basic code points to the output.\n\n\tvar basic = input.lastIndexOf(delimiter);\n\tif (basic < 0) {\n\t\tbasic = 0;\n\t}\n\n\tfor (var j = 0; j < basic; ++j) {\n\t\t// if it's not a basic code point\n\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\terror$1('not-basic');\n\t\t}\n\t\toutput.push(input.charCodeAt(j));\n\t}\n\n\t// Main decoding loop: start just after the last delimiter if any basic code\n\t// points were copied; start at the beginning otherwise.\n\n\tfor (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{\n\n\t\t// `index` is the index of the next character to be consumed.\n\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t// which gets added to `i`. The overflow checking is easier\n\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t// value at the end to obtain `delta`.\n\t\tvar oldi = i;\n\t\tfor (var w = 1, k = base;; /* no condition */k += base) {\n\n\t\t\tif (index >= inputLength) {\n\t\t\t\terror$1('invalid-input');\n\t\t\t}\n\n\t\t\tvar digit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\terror$1('overflow');\n\t\t\t}\n\n\t\t\ti += digit * w;\n\t\t\tvar t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n\n\t\t\tif (digit < t) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tvar baseMinusT = base - t;\n\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\terror$1('overflow');\n\t\t\t}\n\n\t\t\tw *= baseMinusT;\n\t\t}\n\n\t\tvar out = output.length + 1;\n\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t// incrementing `n` each time, so we'll fix that now:\n\t\tif (floor(i / out) > maxInt - n) {\n\t\t\terror$1('overflow');\n\t\t}\n\n\t\tn += floor(i / out);\n\t\ti %= out;\n\n\t\t// Insert `n` at position `i` of the output.\n\t\toutput.splice(i++, 0, n);\n\t}\n\n\treturn String.fromCodePoint.apply(String, output);\n};\n\n/**\n * Converts a string of Unicode symbols (e.g. a domain name label) to a\n * Punycode string of ASCII-only symbols.\n * @memberOf punycode\n * @param {String} input The string of Unicode symbols.\n * @returns {String} The resulting Punycode string of ASCII-only symbols.\n */\nvar encode = function encode(input) {\n\tvar output = [];\n\n\t// Convert the input in UCS-2 to an array of Unicode code points.\n\tinput = ucs2decode(input);\n\n\t// Cache the length.\n\tvar inputLength = input.length;\n\n\t// Initialize the state.\n\tvar n = initialN;\n\tvar delta = 0;\n\tvar bias = initialBias;\n\n\t// Handle the basic code points.\n\tvar _iteratorNormalCompletion = true;\n\tvar _didIteratorError = false;\n\tvar _iteratorError = undefined;\n\n\ttry {\n\t\tfor (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\tvar _currentValue2 = _step.value;\n\n\t\t\tif (_currentValue2 < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(_currentValue2));\n\t\t\t}\n\t\t}\n\t} catch (err) {\n\t\t_didIteratorError = true;\n\t\t_iteratorError = err;\n\t} finally {\n\t\ttry {\n\t\t\tif (!_iteratorNormalCompletion && _iterator.return) {\n\t\t\t\t_iterator.return();\n\t\t\t}\n\t\t} finally {\n\t\t\tif (_didIteratorError) {\n\t\t\t\tthrow _iteratorError;\n\t\t\t}\n\t\t}\n\t}\n\n\tvar basicLength = output.length;\n\tvar handledCPCount = basicLength;\n\n\t// `handledCPCount` is the number of code points that have been handled;\n\t// `basicLength` is the number of basic code points.\n\n\t// Finish the basic string with a delimiter unless it's empty.\n\tif (basicLength) {\n\t\toutput.push(delimiter);\n\t}\n\n\t// Main encoding loop:\n\twhile (handledCPCount < inputLength) {\n\n\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t// larger one:\n\t\tvar m = maxInt;\n\t\tvar _iteratorNormalCompletion2 = true;\n\t\tvar _didIteratorError2 = false;\n\t\tvar _iteratorError2 = undefined;\n\n\t\ttry {\n\t\t\tfor (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n\t\t\t\tvar currentValue = _step2.value;\n\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow.\n\t\t} catch (err) {\n\t\t\t_didIteratorError2 = true;\n\t\t\t_iteratorError2 = err;\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (!_iteratorNormalCompletion2 && _iterator2.return) {\n\t\t\t\t\t_iterator2.return();\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tif (_didIteratorError2) {\n\t\t\t\t\tthrow _iteratorError2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar handledCPCountPlusOne = handledCPCount + 1;\n\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\terror$1('overflow');\n\t\t}\n\n\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\tn = m;\n\n\t\tvar _iteratorNormalCompletion3 = true;\n\t\tvar _didIteratorError3 = false;\n\t\tvar _iteratorError3 = undefined;\n\n\t\ttry {\n\t\t\tfor (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n\t\t\t\tvar _currentValue = _step3.value;\n\n\t\t\t\tif (_currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror$1('overflow');\n\t\t\t\t}\n\t\t\t\tif (_currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer.\n\t\t\t\t\tvar q = delta;\n\t\t\t\t\tfor (var k = base;; /* no condition */k += base) {\n\t\t\t\t\t\tvar t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar qMinusT = q - t;\n\t\t\t\t\t\tvar baseMinusT = base - t;\n\t\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t_didIteratorError3 = true;\n\t\t\t_iteratorError3 = err;\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (!_iteratorNormalCompletion3 && _iterator3.return) {\n\t\t\t\t\t_iterator3.return();\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tif (_didIteratorError3) {\n\t\t\t\t\tthrow _iteratorError3;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t++delta;\n\t\t++n;\n\t}\n\treturn output.join('');\n};\n\n/**\n * Converts a Punycode string representing a domain name or an email address\n * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n * it doesn't matter if you call it on a string that has already been\n * converted to Unicode.\n * @memberOf punycode\n * @param {String} input The Punycoded domain name or email address to\n * convert to Unicode.\n * @returns {String} The Unicode representation of the given Punycode\n * string.\n */\nvar toUnicode = function toUnicode(input) {\n\treturn mapDomain(input, function (string) {\n\t\treturn regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;\n\t});\n};\n\n/**\n * Converts a Unicode string representing a domain name or an email address to\n * Punycode. Only the non-ASCII parts of the domain name will be converted,\n * i.e. it doesn't matter if you call it with a domain that's already in\n * ASCII.\n * @memberOf punycode\n * @param {String} input The domain name or email address to convert, as a\n * Unicode string.\n * @returns {String} The Punycode representation of the given domain name or\n * email address.\n */\nvar toASCII = function toASCII(input) {\n\treturn mapDomain(input, function (string) {\n\t\treturn regexNonASCII.test(string) ? 'xn--' + encode(string) : string;\n\t});\n};\n\n/*--------------------------------------------------------------------------*/\n\n/** Define the public API */\nvar punycode = {\n\t/**\n * A string representing the current Punycode.js version number.\n * @memberOf punycode\n * @type String\n */\n\t'version': '2.1.0',\n\t/**\n * An object of methods to convert from JavaScript's internal character\n * representation (UCS-2) to Unicode code points, and back.\n * @see \n * @memberOf punycode\n * @type Object\n */\n\t'ucs2': {\n\t\t'decode': ucs2decode,\n\t\t'encode': ucs2encode\n\t},\n\t'decode': decode,\n\t'encode': encode,\n\t'toASCII': toASCII,\n\t'toUnicode': toUnicode\n};\n\n/**\n * URI.js\n *\n * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.\n * @author Gary Court\n * @see http://github.com/garycourt/uri-js\n */\n/**\n * Copyright 2011 Gary Court. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification, are\n * permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this list of\n * conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice, this list\n * of conditions and the following disclaimer in the documentation and/or other materials\n * provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED\n * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * The views and conclusions contained in the software and documentation are those of the\n * authors and should not be interpreted as representing official policies, either expressed\n * or implied, of Gary Court.\n */\nvar SCHEMES = {};\nfunction pctEncChar(chr) {\n var c = chr.charCodeAt(0);\n var e = void 0;\n if (c < 16) e = \"%0\" + c.toString(16).toUpperCase();else if (c < 128) e = \"%\" + c.toString(16).toUpperCase();else if (c < 2048) e = \"%\" + (c >> 6 | 192).toString(16).toUpperCase() + \"%\" + (c & 63 | 128).toString(16).toUpperCase();else e = \"%\" + (c >> 12 | 224).toString(16).toUpperCase() + \"%\" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + \"%\" + (c & 63 | 128).toString(16).toUpperCase();\n return e;\n}\nfunction pctDecChars(str) {\n var newStr = \"\";\n var i = 0;\n var il = str.length;\n while (i < il) {\n var c = parseInt(str.substr(i + 1, 2), 16);\n if (c < 128) {\n newStr += String.fromCharCode(c);\n i += 3;\n } else if (c >= 194 && c < 224) {\n if (il - i >= 6) {\n var c2 = parseInt(str.substr(i + 4, 2), 16);\n newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);\n } else {\n newStr += str.substr(i, 6);\n }\n i += 6;\n } else if (c >= 224) {\n if (il - i >= 9) {\n var _c = parseInt(str.substr(i + 4, 2), 16);\n var c3 = parseInt(str.substr(i + 7, 2), 16);\n newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);\n } else {\n newStr += str.substr(i, 9);\n }\n i += 9;\n } else {\n newStr += str.substr(i, 3);\n i += 3;\n }\n }\n return newStr;\n}\nfunction _normalizeComponentEncoding(components, protocol) {\n function decodeUnreserved(str) {\n var decStr = pctDecChars(str);\n return !decStr.match(protocol.UNRESERVED) ? str : decStr;\n }\n if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, \"\");\n if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);\n return components;\n}\n\nfunction _stripLeadingZeros(str) {\n return str.replace(/^0*(.*)/, \"$1\") || \"0\";\n}\nfunction _normalizeIPv4(host, protocol) {\n var matches = host.match(protocol.IPV4ADDRESS) || [];\n\n var _matches = slicedToArray(matches, 2),\n address = _matches[1];\n\n if (address) {\n return address.split(\".\").map(_stripLeadingZeros).join(\".\");\n } else {\n return host;\n }\n}\nfunction _normalizeIPv6(host, protocol) {\n var matches = host.match(protocol.IPV6ADDRESS) || [];\n\n var _matches2 = slicedToArray(matches, 3),\n address = _matches2[1],\n zone = _matches2[2];\n\n if (address) {\n var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),\n _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),\n last = _address$toLowerCase$2[0],\n first = _address$toLowerCase$2[1];\n\n var firstFields = first ? first.split(\":\").map(_stripLeadingZeros) : [];\n var lastFields = last.split(\":\").map(_stripLeadingZeros);\n var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);\n var fieldCount = isLastFieldIPv4Address ? 7 : 8;\n var lastFieldsStart = lastFields.length - fieldCount;\n var fields = Array(fieldCount);\n for (var x = 0; x < fieldCount; ++x) {\n fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';\n }\n if (isLastFieldIPv4Address) {\n fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);\n }\n var allZeroFields = fields.reduce(function (acc, field, index) {\n if (!field || field === \"0\") {\n var lastLongest = acc[acc.length - 1];\n if (lastLongest && lastLongest.index + lastLongest.length === index) {\n lastLongest.length++;\n } else {\n acc.push({ index: index, length: 1 });\n }\n }\n return acc;\n }, []);\n var longestZeroFields = allZeroFields.sort(function (a, b) {\n return b.length - a.length;\n })[0];\n var newHost = void 0;\n if (longestZeroFields && longestZeroFields.length > 1) {\n var newFirst = fields.slice(0, longestZeroFields.index);\n var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);\n newHost = newFirst.join(\":\") + \"::\" + newLast.join(\":\");\n } else {\n newHost = fields.join(\":\");\n }\n if (zone) {\n newHost += \"%\" + zone;\n }\n return newHost;\n } else {\n return host;\n }\n}\nvar URI_PARSE = /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:([^\\/?#@]*)@)?(\\[[^\\/?#\\]]+\\]|[^\\/?#:]*)(?:\\:(\\d*))?))?([^?#]*)(?:\\?([^#]*))?(?:#((?:.|\\n|\\r)*))?/i;\nvar NO_MATCH_IS_UNDEFINED = \"\".match(/(){0}/)[1] === undefined;\nfunction parse(uriString) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var components = {};\n var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;\n if (options.reference === \"suffix\") uriString = (options.scheme ? options.scheme + \":\" : \"\") + \"//\" + uriString;\n var matches = uriString.match(URI_PARSE);\n if (matches) {\n if (NO_MATCH_IS_UNDEFINED) {\n //store each component\n components.scheme = matches[1];\n components.userinfo = matches[3];\n components.host = matches[4];\n components.port = parseInt(matches[5], 10);\n components.path = matches[6] || \"\";\n components.query = matches[7];\n components.fragment = matches[8];\n //fix port number\n if (isNaN(components.port)) {\n components.port = matches[5];\n }\n } else {\n //IE FIX for improper RegExp matching\n //store each component\n components.scheme = matches[1] || undefined;\n components.userinfo = uriString.indexOf(\"@\") !== -1 ? matches[3] : undefined;\n components.host = uriString.indexOf(\"//\") !== -1 ? matches[4] : undefined;\n components.port = parseInt(matches[5], 10);\n components.path = matches[6] || \"\";\n components.query = uriString.indexOf(\"?\") !== -1 ? matches[7] : undefined;\n components.fragment = uriString.indexOf(\"#\") !== -1 ? matches[8] : undefined;\n //fix port number\n if (isNaN(components.port)) {\n components.port = uriString.match(/\\/\\/(?:.|\\n)*\\:(?:\\/|\\?|\\#|$)/) ? matches[4] : undefined;\n }\n }\n if (components.host) {\n //normalize IP hosts\n components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);\n }\n //determine reference type\n if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {\n components.reference = \"same-document\";\n } else if (components.scheme === undefined) {\n components.reference = \"relative\";\n } else if (components.fragment === undefined) {\n components.reference = \"absolute\";\n } else {\n components.reference = \"uri\";\n }\n //check for reference errors\n if (options.reference && options.reference !== \"suffix\" && options.reference !== components.reference) {\n components.error = components.error || \"URI is not a \" + options.reference + \" reference.\";\n }\n //find scheme handler\n var schemeHandler = SCHEMES[(options.scheme || components.scheme || \"\").toLowerCase()];\n //check if scheme can't handle IRIs\n if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {\n //if host component is a domain name\n if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {\n //convert Unicode IDN -> ASCII IDN\n try {\n components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());\n } catch (e) {\n components.error = components.error || \"Host's domain name can not be converted to ASCII via punycode: \" + e;\n }\n }\n //convert IRI -> URI\n _normalizeComponentEncoding(components, URI_PROTOCOL);\n } else {\n //normalize encodings\n _normalizeComponentEncoding(components, protocol);\n }\n //perform scheme specific parsing\n if (schemeHandler && schemeHandler.parse) {\n schemeHandler.parse(components, options);\n }\n } else {\n components.error = components.error || \"URI can not be parsed.\";\n }\n return components;\n}\n\nfunction _recomposeAuthority(components, options) {\n var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;\n var uriTokens = [];\n if (components.userinfo !== undefined) {\n uriTokens.push(components.userinfo);\n uriTokens.push(\"@\");\n }\n if (components.host !== undefined) {\n //normalize IP hosts, add brackets and escape zone separator for IPv6\n uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {\n return \"[\" + $1 + ($2 ? \"%25\" + $2 : \"\") + \"]\";\n }));\n }\n if (typeof components.port === \"number\" || typeof components.port === \"string\") {\n uriTokens.push(\":\");\n uriTokens.push(String(components.port));\n }\n return uriTokens.length ? uriTokens.join(\"\") : undefined;\n}\n\nvar RDS1 = /^\\.\\.?\\//;\nvar RDS2 = /^\\/\\.(\\/|$)/;\nvar RDS3 = /^\\/\\.\\.(\\/|$)/;\nvar RDS5 = /^\\/?(?:.|\\n)*?(?=\\/|$)/;\nfunction removeDotSegments(input) {\n var output = [];\n while (input.length) {\n if (input.match(RDS1)) {\n input = input.replace(RDS1, \"\");\n } else if (input.match(RDS2)) {\n input = input.replace(RDS2, \"/\");\n } else if (input.match(RDS3)) {\n input = input.replace(RDS3, \"/\");\n output.pop();\n } else if (input === \".\" || input === \"..\") {\n input = \"\";\n } else {\n var im = input.match(RDS5);\n if (im) {\n var s = im[0];\n input = input.slice(s.length);\n output.push(s);\n } else {\n throw new Error(\"Unexpected dot segment condition\");\n }\n }\n }\n return output.join(\"\");\n}\n\nfunction serialize(components) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;\n var uriTokens = [];\n //find scheme handler\n var schemeHandler = SCHEMES[(options.scheme || components.scheme || \"\").toLowerCase()];\n //perform scheme specific serialization\n if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);\n if (components.host) {\n //if host component is an IPv6 address\n if (protocol.IPV6ADDRESS.test(components.host)) {}\n //TODO: normalize IPv6 address as per RFC 5952\n\n //if host component is a domain name\n else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {\n //convert IDN via punycode\n try {\n components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);\n } catch (e) {\n components.error = components.error || \"Host's domain name can not be converted to \" + (!options.iri ? \"ASCII\" : \"Unicode\") + \" via punycode: \" + e;\n }\n }\n }\n //normalize encoding\n _normalizeComponentEncoding(components, protocol);\n if (options.reference !== \"suffix\" && components.scheme) {\n uriTokens.push(components.scheme);\n uriTokens.push(\":\");\n }\n var authority = _recomposeAuthority(components, options);\n if (authority !== undefined) {\n if (options.reference !== \"suffix\") {\n uriTokens.push(\"//\");\n }\n uriTokens.push(authority);\n if (components.path && components.path.charAt(0) !== \"/\") {\n uriTokens.push(\"/\");\n }\n }\n if (components.path !== undefined) {\n var s = components.path;\n if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {\n s = removeDotSegments(s);\n }\n if (authority === undefined) {\n s = s.replace(/^\\/\\//, \"/%2F\"); //don't allow the path to start with \"//\"\n }\n uriTokens.push(s);\n }\n if (components.query !== undefined) {\n uriTokens.push(\"?\");\n uriTokens.push(components.query);\n }\n if (components.fragment !== undefined) {\n uriTokens.push(\"#\");\n uriTokens.push(components.fragment);\n }\n return uriTokens.join(\"\"); //merge tokens into a string\n}\n\nfunction resolveComponents(base, relative) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var skipNormalization = arguments[3];\n\n var target = {};\n if (!skipNormalization) {\n base = parse(serialize(base, options), options); //normalize base components\n relative = parse(serialize(relative, options), options); //normalize relative components\n }\n options = options || {};\n if (!options.tolerant && relative.scheme) {\n target.scheme = relative.scheme;\n //target.authority = relative.authority;\n target.userinfo = relative.userinfo;\n target.host = relative.host;\n target.port = relative.port;\n target.path = removeDotSegments(relative.path || \"\");\n target.query = relative.query;\n } else {\n if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {\n //target.authority = relative.authority;\n target.userinfo = relative.userinfo;\n target.host = relative.host;\n target.port = relative.port;\n target.path = removeDotSegments(relative.path || \"\");\n target.query = relative.query;\n } else {\n if (!relative.path) {\n target.path = base.path;\n if (relative.query !== undefined) {\n target.query = relative.query;\n } else {\n target.query = base.query;\n }\n } else {\n if (relative.path.charAt(0) === \"/\") {\n target.path = removeDotSegments(relative.path);\n } else {\n if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {\n target.path = \"/\" + relative.path;\n } else if (!base.path) {\n target.path = relative.path;\n } else {\n target.path = base.path.slice(0, base.path.lastIndexOf(\"/\") + 1) + relative.path;\n }\n target.path = removeDotSegments(target.path);\n }\n target.query = relative.query;\n }\n //target.authority = base.authority;\n target.userinfo = base.userinfo;\n target.host = base.host;\n target.port = base.port;\n }\n target.scheme = base.scheme;\n }\n target.fragment = relative.fragment;\n return target;\n}\n\nfunction resolve(baseURI, relativeURI, options) {\n var schemelessOptions = assign({ scheme: 'null' }, options);\n return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);\n}\n\nfunction normalize(uri, options) {\n if (typeof uri === \"string\") {\n uri = serialize(parse(uri, options), options);\n } else if (typeOf(uri) === \"object\") {\n uri = parse(serialize(uri, options), options);\n }\n return uri;\n}\n\nfunction equal(uriA, uriB, options) {\n if (typeof uriA === \"string\") {\n uriA = serialize(parse(uriA, options), options);\n } else if (typeOf(uriA) === \"object\") {\n uriA = serialize(uriA, options);\n }\n if (typeof uriB === \"string\") {\n uriB = serialize(parse(uriB, options), options);\n } else if (typeOf(uriB) === \"object\") {\n uriB = serialize(uriB, options);\n }\n return uriA === uriB;\n}\n\nfunction escapeComponent(str, options) {\n return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);\n}\n\nfunction unescapeComponent(str, options) {\n return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);\n}\n\nvar handler = {\n scheme: \"http\",\n domainHost: true,\n parse: function parse(components, options) {\n //report missing host\n if (!components.host) {\n components.error = components.error || \"HTTP URIs must have a host.\";\n }\n return components;\n },\n serialize: function serialize(components, options) {\n var secure = String(components.scheme).toLowerCase() === \"https\";\n //normalize the default port\n if (components.port === (secure ? 443 : 80) || components.port === \"\") {\n components.port = undefined;\n }\n //normalize the empty path\n if (!components.path) {\n components.path = \"/\";\n }\n //NOTE: We do not parse query strings for HTTP URIs\n //as WWW Form Url Encoded query strings are part of the HTML4+ spec,\n //and not the HTTP spec.\n return components;\n }\n};\n\nvar handler$1 = {\n scheme: \"https\",\n domainHost: handler.domainHost,\n parse: handler.parse,\n serialize: handler.serialize\n};\n\nfunction isSecure(wsComponents) {\n return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === \"wss\";\n}\n//RFC 6455\nvar handler$2 = {\n scheme: \"ws\",\n domainHost: true,\n parse: function parse(components, options) {\n var wsComponents = components;\n //indicate if the secure flag is set\n wsComponents.secure = isSecure(wsComponents);\n //construct resouce name\n wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');\n wsComponents.path = undefined;\n wsComponents.query = undefined;\n return wsComponents;\n },\n serialize: function serialize(wsComponents, options) {\n //normalize the default port\n if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === \"\") {\n wsComponents.port = undefined;\n }\n //ensure scheme matches secure flag\n if (typeof wsComponents.secure === 'boolean') {\n wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';\n wsComponents.secure = undefined;\n }\n //reconstruct path from resource name\n if (wsComponents.resourceName) {\n var _wsComponents$resourc = wsComponents.resourceName.split('?'),\n _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),\n path = _wsComponents$resourc2[0],\n query = _wsComponents$resourc2[1];\n\n wsComponents.path = path && path !== '/' ? path : undefined;\n wsComponents.query = query;\n wsComponents.resourceName = undefined;\n }\n //forbid fragment component\n wsComponents.fragment = undefined;\n return wsComponents;\n }\n};\n\nvar handler$3 = {\n scheme: \"wss\",\n domainHost: handler$2.domainHost,\n parse: handler$2.parse,\n serialize: handler$2.serialize\n};\n\nvar O = {};\nvar isIRI = true;\n//RFC 3986\nvar UNRESERVED$$ = \"[A-Za-z0-9\\\\-\\\\.\\\\_\\\\~\" + (isIRI ? \"\\\\xA0-\\\\u200D\\\\u2010-\\\\u2029\\\\u202F-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFEF\" : \"\") + \"]\";\nvar HEXDIG$$ = \"[0-9A-Fa-f]\"; //case-insensitive\nvar PCT_ENCODED$ = subexp(subexp(\"%[EFef]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%[89A-Fa-f]\" + HEXDIG$$ + \"%\" + HEXDIG$$ + HEXDIG$$) + \"|\" + subexp(\"%\" + HEXDIG$$ + HEXDIG$$)); //expanded\n//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =\n//const ATEXT$$ = \"[A-Za-z0-9\\\\!\\\\#\\\\$\\\\%\\\\&\\\\'\\\\*\\\\+\\\\-\\\\/\\\\=\\\\?\\\\^\\\\_\\\\`\\\\{\\\\|\\\\}\\\\~]\";\n//const WSP$$ = \"[\\\\x20\\\\x09]\";\n//const OBS_QTEXT$$ = \"[\\\\x01-\\\\x08\\\\x0B\\\\x0C\\\\x0E-\\\\x1F\\\\x7F]\"; //(%d1-8 / %d11-12 / %d14-31 / %d127)\n//const QTEXT$$ = merge(\"[\\\\x21\\\\x23-\\\\x5B\\\\x5D-\\\\x7E]\", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext\n//const VCHAR$$ = \"[\\\\x21-\\\\x7E]\";\n//const WSP$$ = \"[\\\\x20\\\\x09]\";\n//const OBS_QP$ = subexp(\"\\\\\\\\\" + merge(\"[\\\\x00\\\\x0D\\\\x0A]\", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext\n//const FWS$ = subexp(subexp(WSP$$ + \"*\" + \"\\\\x0D\\\\x0A\") + \"?\" + WSP$$ + \"+\");\n//const QUOTED_PAIR$ = subexp(subexp(\"\\\\\\\\\" + subexp(VCHAR$$ + \"|\" + WSP$$)) + \"|\" + OBS_QP$);\n//const QUOTED_STRING$ = subexp('\\\\\"' + subexp(FWS$ + \"?\" + QCONTENT$) + \"*\" + FWS$ + \"?\" + '\\\\\"');\nvar ATEXT$$ = \"[A-Za-z0-9\\\\!\\\\$\\\\%\\\\'\\\\*\\\\+\\\\-\\\\^\\\\_\\\\`\\\\{\\\\|\\\\}\\\\~]\";\nvar QTEXT$$ = \"[\\\\!\\\\$\\\\%\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\-\\\\.0-9\\\\<\\\\>A-Z\\\\x5E-\\\\x7E]\";\nvar VCHAR$$ = merge(QTEXT$$, \"[\\\\\\\"\\\\\\\\]\");\nvar SOME_DELIMS$$ = \"[\\\\!\\\\$\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\;\\\\:\\\\@]\";\nvar UNRESERVED = new RegExp(UNRESERVED$$, \"g\");\nvar PCT_ENCODED = new RegExp(PCT_ENCODED$, \"g\");\nvar NOT_LOCAL_PART = new RegExp(merge(\"[^]\", ATEXT$$, \"[\\\\.]\", '[\\\\\"]', VCHAR$$), \"g\");\nvar NOT_HFNAME = new RegExp(merge(\"[^]\", UNRESERVED$$, SOME_DELIMS$$), \"g\");\nvar NOT_HFVALUE = NOT_HFNAME;\nfunction decodeUnreserved(str) {\n var decStr = pctDecChars(str);\n return !decStr.match(UNRESERVED) ? str : decStr;\n}\nvar handler$4 = {\n scheme: \"mailto\",\n parse: function parse$$1(components, options) {\n var mailtoComponents = components;\n var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(\",\") : [];\n mailtoComponents.path = undefined;\n if (mailtoComponents.query) {\n var unknownHeaders = false;\n var headers = {};\n var hfields = mailtoComponents.query.split(\"&\");\n for (var x = 0, xl = hfields.length; x < xl; ++x) {\n var hfield = hfields[x].split(\"=\");\n switch (hfield[0]) {\n case \"to\":\n var toAddrs = hfield[1].split(\",\");\n for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {\n to.push(toAddrs[_x]);\n }\n break;\n case \"subject\":\n mailtoComponents.subject = unescapeComponent(hfield[1], options);\n break;\n case \"body\":\n mailtoComponents.body = unescapeComponent(hfield[1], options);\n break;\n default:\n unknownHeaders = true;\n headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);\n break;\n }\n }\n if (unknownHeaders) mailtoComponents.headers = headers;\n }\n mailtoComponents.query = undefined;\n for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {\n var addr = to[_x2].split(\"@\");\n addr[0] = unescapeComponent(addr[0]);\n if (!options.unicodeSupport) {\n //convert Unicode IDN -> ASCII IDN\n try {\n addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());\n } catch (e) {\n mailtoComponents.error = mailtoComponents.error || \"Email address's domain name can not be converted to ASCII via punycode: \" + e;\n }\n } else {\n addr[1] = unescapeComponent(addr[1], options).toLowerCase();\n }\n to[_x2] = addr.join(\"@\");\n }\n return mailtoComponents;\n },\n serialize: function serialize$$1(mailtoComponents, options) {\n var components = mailtoComponents;\n var to = toArray(mailtoComponents.to);\n if (to) {\n for (var x = 0, xl = to.length; x < xl; ++x) {\n var toAddr = String(to[x]);\n var atIdx = toAddr.lastIndexOf(\"@\");\n var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);\n var domain = toAddr.slice(atIdx + 1);\n //convert IDN via punycode\n try {\n domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);\n } catch (e) {\n components.error = components.error || \"Email address's domain name can not be converted to \" + (!options.iri ? \"ASCII\" : \"Unicode\") + \" via punycode: \" + e;\n }\n to[x] = localPart + \"@\" + domain;\n }\n components.path = to.join(\",\");\n }\n var headers = mailtoComponents.headers = mailtoComponents.headers || {};\n if (mailtoComponents.subject) headers[\"subject\"] = mailtoComponents.subject;\n if (mailtoComponents.body) headers[\"body\"] = mailtoComponents.body;\n var fields = [];\n for (var name in headers) {\n if (headers[name] !== O[name]) {\n fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + \"=\" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar));\n }\n }\n if (fields.length) {\n components.query = fields.join(\"&\");\n }\n return components;\n }\n};\n\nvar URN_PARSE = /^([^\\:]+)\\:(.*)/;\n//RFC 2141\nvar handler$5 = {\n scheme: \"urn\",\n parse: function parse$$1(components, options) {\n var matches = components.path && components.path.match(URN_PARSE);\n var urnComponents = components;\n if (matches) {\n var scheme = options.scheme || urnComponents.scheme || \"urn\";\n var nid = matches[1].toLowerCase();\n var nss = matches[2];\n var urnScheme = scheme + \":\" + (options.nid || nid);\n var schemeHandler = SCHEMES[urnScheme];\n urnComponents.nid = nid;\n urnComponents.nss = nss;\n urnComponents.path = undefined;\n if (schemeHandler) {\n urnComponents = schemeHandler.parse(urnComponents, options);\n }\n } else {\n urnComponents.error = urnComponents.error || \"URN can not be parsed.\";\n }\n return urnComponents;\n },\n serialize: function serialize$$1(urnComponents, options) {\n var scheme = options.scheme || urnComponents.scheme || \"urn\";\n var nid = urnComponents.nid;\n var urnScheme = scheme + \":\" + (options.nid || nid);\n var schemeHandler = SCHEMES[urnScheme];\n if (schemeHandler) {\n urnComponents = schemeHandler.serialize(urnComponents, options);\n }\n var uriComponents = urnComponents;\n var nss = urnComponents.nss;\n uriComponents.path = (nid || options.nid) + \":\" + nss;\n return uriComponents;\n }\n};\n\nvar UUID = /^[0-9A-Fa-f]{8}(?:\\-[0-9A-Fa-f]{4}){3}\\-[0-9A-Fa-f]{12}$/;\n//RFC 4122\nvar handler$6 = {\n scheme: \"urn:uuid\",\n parse: function parse(urnComponents, options) {\n var uuidComponents = urnComponents;\n uuidComponents.uuid = uuidComponents.nss;\n uuidComponents.nss = undefined;\n if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {\n uuidComponents.error = uuidComponents.error || \"UUID is not valid.\";\n }\n return uuidComponents;\n },\n serialize: function serialize(uuidComponents, options) {\n var urnComponents = uuidComponents;\n //normalize UUID\n urnComponents.nss = (uuidComponents.uuid || \"\").toLowerCase();\n return urnComponents;\n }\n};\n\nSCHEMES[handler.scheme] = handler;\nSCHEMES[handler$1.scheme] = handler$1;\nSCHEMES[handler$2.scheme] = handler$2;\nSCHEMES[handler$3.scheme] = handler$3;\nSCHEMES[handler$4.scheme] = handler$4;\nSCHEMES[handler$5.scheme] = handler$5;\nSCHEMES[handler$6.scheme] = handler$6;\n\nexports.SCHEMES = SCHEMES;\nexports.pctEncChar = pctEncChar;\nexports.pctDecChars = pctDecChars;\nexports.parse = parse;\nexports.removeDotSegments = removeDotSegments;\nexports.serialize = serialize;\nexports.resolveComponents = resolveComponents;\nexports.resolve = resolve;\nexports.normalize = normalize;\nexports.equal = equal;\nexports.escapeComponent = escapeComponent;\nexports.unescapeComponent = unescapeComponent;\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=uri.all.js.map\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","'use strict';\n\n// https://mathiasbynens.be/notes/javascript-encoding\n// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode\nmodule.exports = function ucs2length(str) {\n var length = 0\n , len = str.length\n , pos = 0\n , value;\n while (pos < len) {\n length++;\n value = str.charCodeAt(pos++);\n if (value >= 0xD800 && value <= 0xDBFF && pos < len) {\n // high surrogate, and there is a next character\n value = str.charCodeAt(pos);\n if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate\n }\n }\n return length;\n};\n","'use strict';\n\n\nmodule.exports = {\n copy: copy,\n checkDataType: checkDataType,\n checkDataTypes: checkDataTypes,\n coerceToTypes: coerceToTypes,\n toHash: toHash,\n getProperty: getProperty,\n escapeQuotes: escapeQuotes,\n equal: require('fast-deep-equal'),\n ucs2length: require('./ucs2length'),\n varOccurences: varOccurences,\n varReplace: varReplace,\n schemaHasRules: schemaHasRules,\n schemaHasRulesExcept: schemaHasRulesExcept,\n schemaUnknownRules: schemaUnknownRules,\n toQuotedString: toQuotedString,\n getPathExpr: getPathExpr,\n getPath: getPath,\n getData: getData,\n unescapeFragment: unescapeFragment,\n unescapeJsonPointer: unescapeJsonPointer,\n escapeFragment: escapeFragment,\n escapeJsonPointer: escapeJsonPointer\n};\n\n\nfunction copy(o, to) {\n to = to || {};\n for (var key in o) to[key] = o[key];\n return to;\n}\n\n\nfunction checkDataType(dataType, data, strictNumbers, negate) {\n var EQUAL = negate ? ' !== ' : ' === '\n , AND = negate ? ' || ' : ' && '\n , OK = negate ? '!' : ''\n , NOT = negate ? '' : '!';\n switch (dataType) {\n case 'null': return data + EQUAL + 'null';\n case 'array': return OK + 'Array.isArray(' + data + ')';\n case 'object': return '(' + OK + data + AND +\n 'typeof ' + data + EQUAL + '\"object\"' + AND +\n NOT + 'Array.isArray(' + data + '))';\n case 'integer': return '(typeof ' + data + EQUAL + '\"number\"' + AND +\n NOT + '(' + data + ' % 1)' +\n AND + data + EQUAL + data +\n (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';\n case 'number': return '(typeof ' + data + EQUAL + '\"' + dataType + '\"' +\n (strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';\n default: return 'typeof ' + data + EQUAL + '\"' + dataType + '\"';\n }\n}\n\n\nfunction checkDataTypes(dataTypes, data, strictNumbers) {\n switch (dataTypes.length) {\n case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);\n default:\n var code = '';\n var types = toHash(dataTypes);\n if (types.array && types.object) {\n code = types.null ? '(': '(!' + data + ' || ';\n code += 'typeof ' + data + ' !== \"object\")';\n delete types.null;\n delete types.array;\n delete types.object;\n }\n if (types.number) delete types.integer;\n for (var t in types)\n code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);\n\n return code;\n }\n}\n\n\nvar COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);\nfunction coerceToTypes(optionCoerceTypes, dataTypes) {\n if (Array.isArray(dataTypes)) {\n var types = [];\n for (var i=0; i= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);\n return paths[lvl - up];\n }\n\n if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);\n data = 'data' + ((lvl - up) || '');\n if (!jsonPointer) return data;\n }\n\n var expr = data;\n var segments = jsonPointer.split('/');\n for (var i=0; i= 0) return { index: index, compiling: true };\n index = this._compilations.length;\n this._compilations[index] = {\n schema: schema,\n root: root,\n baseId: baseId\n };\n return { index: index, compiling: false };\n}\n\n\n/**\n * Removes the schema from the currently compiled list\n * @this Ajv\n * @param {Object} schema schema to compile\n * @param {Object} root root object\n * @param {String} baseId base schema ID\n */\nfunction endCompiling(schema, root, baseId) {\n /* jshint validthis: true */\n var i = compIndex.call(this, schema, root, baseId);\n if (i >= 0) this._compilations.splice(i, 1);\n}\n\n\n/**\n * Index of schema compilation in the currently compiled list\n * @this Ajv\n * @param {Object} schema schema to compile\n * @param {Object} root root object\n * @param {String} baseId base schema ID\n * @return {Integer} compilation index\n */\nfunction compIndex(schema, root, baseId) {\n /* jshint validthis: true */\n for (var i=0; i%\\\\^`{|}]|%[0-9a-f]{2})|\\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?)*\\})*$/i;\n// For the source: https://gist.github.com/dperini/729294\n// For test cases: https://mathiasbynens.be/demo/url-regex\n// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.\n// var URL = /^(?:(?:https?|ftp):\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!192\\.168(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-)*[a-z\\u{00a1}-\\u{ffff}0-9]+)(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-)*[a-z\\u{00a1}-\\u{ffff}0-9]+)*(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?$/iu;\nvar URL = /^(?:(?:http[s\\u017F]?|ftp):\\/\\/)(?:(?:[\\0-\\x08\\x0E-\\x1F!-\\x9F\\xA1-\\u167F\\u1681-\\u1FFF\\u200B-\\u2027\\u202A-\\u202E\\u2030-\\u205E\\u2060-\\u2FFF\\u3001-\\uD7FF\\uE000-\\uFEFE\\uFF00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])+(?::(?:[\\0-\\x08\\x0E-\\x1F!-\\x9F\\xA1-\\u167F\\u1681-\\u1FFF\\u200B-\\u2027\\u202A-\\u202E\\u2030-\\u205E\\u2060-\\u2FFF\\u3001-\\uD7FF\\uE000-\\uFEFE\\uFF00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])*)?@)?(?:(?!10(?:\\.[0-9]{1,3}){3})(?!127(?:\\.[0-9]{1,3}){3})(?!169\\.254(?:\\.[0-9]{1,3}){2})(?!192\\.168(?:\\.[0-9]{1,3}){2})(?!172\\.(?:1[6-9]|2[0-9]|3[01])(?:\\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\\xA1-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])+-)*(?:[0-9a-z\\xA1-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])+)(?:\\.(?:(?:[0-9a-z\\xA1-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])+-)*(?:[0-9a-z\\xA1-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])+)*(?:\\.(?:(?:[a-z\\xA1-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\\/(?:[\\0-\\x08\\x0E-\\x1F!-\\x9F\\xA1-\\u167F\\u1681-\\u1FFF\\u200B-\\u2027\\u202A-\\u202E\\u2030-\\u205E\\u2060-\\u2FFF\\u3001-\\uD7FF\\uE000-\\uFEFE\\uFF00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])*)?$/i;\nvar UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;\nvar JSON_POINTER = /^(?:\\/(?:[^~/]|~0|~1)*)*$/;\nvar JSON_POINTER_URI_FRAGMENT = /^#(?:\\/(?:[a-z0-9_\\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;\nvar RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/;\n\n\nmodule.exports = formats;\n\nfunction formats(mode) {\n mode = mode == 'full' ? 'full' : 'fast';\n return util.copy(formats[mode]);\n}\n\n\nformats.fast = {\n // date: http://tools.ietf.org/html/rfc3339#section-5.6\n date: /^\\d\\d\\d\\d-[0-1]\\d-[0-3]\\d$/,\n // date-time: http://tools.ietf.org/html/rfc3339#section-5.6\n time: /^(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)(?:\\.\\d+)?(?:z|[+-]\\d\\d(?::?\\d\\d)?)?$/i,\n 'date-time': /^\\d\\d\\d\\d-[0-1]\\d-[0-3]\\d[t\\s](?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)(?:\\.\\d+)?(?:z|[+-]\\d\\d(?::?\\d\\d)?)$/i,\n // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js\n uri: /^(?:[a-z][a-z0-9+\\-.]*:)(?:\\/?\\/)?[^\\s]*$/i,\n 'uri-reference': /^(?:(?:[a-z][a-z0-9+\\-.]*:)?\\/?\\/)?(?:[^\\\\\\s#][^\\s#]*)?(?:#[^\\\\\\s]*)?$/i,\n 'uri-template': URITEMPLATE,\n url: URL,\n // email (sources from jsen validator):\n // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363\n // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')\n email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,\n hostname: HOSTNAME,\n // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html\n ipv4: /^(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$/,\n // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses\n ipv6: /^\\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(?:%.+)?\\s*$/i,\n regex: regex,\n // uuid: http://tools.ietf.org/html/rfc4122\n uuid: UUID,\n // JSON-pointer: https://tools.ietf.org/html/rfc6901\n // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A\n 'json-pointer': JSON_POINTER,\n 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,\n // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00\n 'relative-json-pointer': RELATIVE_JSON_POINTER\n};\n\n\nformats.full = {\n date: date,\n time: time,\n 'date-time': date_time,\n uri: uri,\n 'uri-reference': URIREF,\n 'uri-template': URITEMPLATE,\n url: URL,\n email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/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:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(?:%.+)?\\s*$/i,\n regex: regex,\n uuid: UUID,\n 'json-pointer': JSON_POINTER,\n 'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,\n 'relative-json-pointer': RELATIVE_JSON_POINTER\n};\n\n\nfunction isLeapYear(year) {\n // https://tools.ietf.org/html/rfc3339#appendix-C\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\n\nfunction date(str) {\n // full-date from http://tools.ietf.org/html/rfc3339#section-5.6\n var matches = str.match(DATE);\n if (!matches) return false;\n\n var year = +matches[1];\n var month = +matches[2];\n var day = +matches[3];\n\n return month >= 1 && month <= 12 && day >= 1 &&\n day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);\n}\n\n\nfunction time(str, full) {\n var matches = str.match(TIME);\n if (!matches) return false;\n\n var hour = matches[1];\n var minute = matches[2];\n var second = matches[3];\n var timeZone = matches[5];\n return ((hour <= 23 && minute <= 59 && second <= 59) ||\n (hour == 23 && minute == 59 && second == 60)) &&\n (!full || timeZone);\n}\n\n\nvar DATE_TIME_SEPARATOR = /t|\\s/i;\nfunction date_time(str) {\n // http://tools.ietf.org/html/rfc3339#section-5.6\n var dateTime = str.split(DATE_TIME_SEPARATOR);\n return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);\n}\n\n\nvar NOT_URI_FRAGMENT = /\\/|:/;\nfunction uri(str) {\n // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required \".\"\n return NOT_URI_FRAGMENT.test(str) && URI.test(str);\n}\n\n\nvar Z_ANCHOR = /[^\\\\]\\\\Z/;\nfunction regex(str) {\n if (Z_ANCHOR.test(str)) return false;\n try {\n new RegExp(str);\n return true;\n } catch(e) {\n return false;\n }\n}\n","'use strict';\nmodule.exports = function generate_ref(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $async, $refCode;\n if ($schema == '#' || $schema == '#/') {\n if (it.isRoot) {\n $async = it.async;\n $refCode = 'validate';\n } else {\n $async = it.root.schema.$async === true;\n $refCode = 'root.refVal[0]';\n }\n } else {\n var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot);\n if ($refVal === undefined) {\n var $message = it.MissingRefError.message(it.baseId, $schema);\n if (it.opts.missingRefs == 'fail') {\n it.logger.error($message);\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('$ref') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \\'' + (it.util.escapeQuotes($schema)) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'can\\\\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n if ($breakOnError) {\n out += ' if (false) { ';\n }\n } else if (it.opts.missingRefs == 'ignore') {\n it.logger.warn($message);\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n } else {\n throw new it.MissingRefError(it.baseId, $schema, $message);\n }\n } else if ($refVal.inline) {\n var $it = it.util.copy(it);\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n $it.schema = $refVal.schema;\n $it.schemaPath = '';\n $it.errSchemaPath = $schema;\n var $code = it.validate($it).replace(/validate\\.schema/g, $refVal.code);\n out += ' ' + ($code) + ' ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n }\n } else {\n $async = $refVal.$async === true || (it.async && $refVal.$async !== false);\n $refCode = $refVal.code;\n }\n }\n if ($refCode) {\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = '';\n if (it.opts.passContext) {\n out += ' ' + ($refCode) + '.call(this, ';\n } else {\n out += ' ' + ($refCode) + '( ';\n }\n out += ' ' + ($data) + ', (dataPath || \\'\\')';\n if (it.errorPath != '\"\"') {\n out += ' + ' + (it.errorPath);\n }\n var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',\n $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';\n out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ', rootData) ';\n var __callValidate = out;\n out = $$outStack.pop();\n if ($async) {\n if (!it.async) throw new Error('async schema referenced by sync schema');\n if ($breakOnError) {\n out += ' var ' + ($valid) + '; ';\n }\n out += ' try { await ' + (__callValidate) + '; ';\n if ($breakOnError) {\n out += ' ' + ($valid) + ' = true; ';\n }\n out += ' } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ';\n if ($breakOnError) {\n out += ' ' + ($valid) + ' = false; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' if (' + ($valid) + ') { ';\n }\n } else {\n out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } ';\n if ($breakOnError) {\n out += ' else { ';\n }\n }\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_allOf(it, $keyword, $ruleType) {\n var out = ' ';\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $currentBaseId = $it.baseId,\n $allSchemasEmpty = true;\n var arr1 = $schema;\n if (arr1) {\n var $sch, $i = -1,\n l1 = arr1.length - 1;\n while ($i < l1) {\n $sch = arr1[$i += 1];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n $allSchemasEmpty = false;\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + '[' + $i + ']';\n $it.errSchemaPath = $errSchemaPath + '/' + $i;\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n }\n }\n if ($breakOnError) {\n if ($allSchemasEmpty) {\n out += ' if (true) { ';\n } else {\n out += ' ' + ($closingBraces.slice(0, -1)) + ' ';\n }\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_anyOf(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $noEmptySchema = $schema.every(function($sch) {\n return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all));\n });\n if ($noEmptySchema) {\n var $currentBaseId = $it.baseId;\n out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; ';\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n var arr1 = $schema;\n if (arr1) {\n var $sch, $i = -1,\n l1 = arr1.length - 1;\n while ($i < l1) {\n $sch = arr1[$i += 1];\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + '[' + $i + ']';\n $it.errSchemaPath = $errSchemaPath + '/' + $i;\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { ';\n $closingBraces += '}';\n }\n }\n it.compositeRule = $it.compositeRule = $wasComposite;\n out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('anyOf') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should match some schema in anyOf\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError(vErrors); ';\n } else {\n out += ' validate.errors = vErrors; return false; ';\n }\n }\n out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';\n if (it.opts.allErrors) {\n out += ' } ';\n }\n } else {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_comment(it, $keyword, $ruleType) {\n var out = ' ';\n var $schema = it.schema[$keyword];\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $comment = it.util.toQuotedString($schema);\n if (it.opts.$comment === true) {\n out += ' console.log(' + ($comment) + ');';\n } else if (typeof it.opts.$comment == 'function') {\n out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_const(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (!$isData) {\n out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';';\n }\n out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('const') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should be equal to constant\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' }';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_contains(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $idx = 'i' + $lvl,\n $dataNxt = $it.dataLevel = it.dataLevel + 1,\n $nextData = 'data' + $dataNxt,\n $currentBaseId = it.baseId,\n $nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all));\n out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';\n if ($nonEmptySchema) {\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n $it.schema = $schema;\n $it.schemaPath = $schemaPath;\n $it.errSchemaPath = $errSchemaPath;\n out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';\n $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);\n var $passData = $data + '[' + $idx + ']';\n $it.dataPathArr[$dataNxt] = $idx;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n out += ' if (' + ($nextValid) + ') break; } ';\n it.compositeRule = $it.compositeRule = $wasComposite;\n out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {';\n } else {\n out += ' if (' + ($data) + '.length == 0) {';\n }\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('contains') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should contain a valid item\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } else { ';\n if ($nonEmptySchema) {\n out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';\n }\n if (it.opts.allErrors) {\n out += ' } ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_dependencies(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $schemaDeps = {},\n $propertyDeps = {},\n $ownProperties = it.opts.ownProperties;\n for ($property in $schema) {\n if ($property == '__proto__') continue;\n var $sch = $schema[$property];\n var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;\n $deps[$property] = $sch;\n }\n out += 'var ' + ($errs) + ' = errors;';\n var $currentErrorPath = it.errorPath;\n out += 'var missing' + ($lvl) + ';';\n for (var $property in $propertyDeps) {\n $deps = $propertyDeps[$property];\n if ($deps.length) {\n out += ' if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';\n if ($ownProperties) {\n out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($property)) + '\\') ';\n }\n if ($breakOnError) {\n out += ' && ( ';\n var arr1 = $deps;\n if (arr1) {\n var $propertyKey, $i = -1,\n l1 = arr1.length - 1;\n while ($i < l1) {\n $propertyKey = arr1[$i += 1];\n if ($i) {\n out += ' || ';\n }\n var $prop = it.util.getProperty($propertyKey),\n $useData = $data + $prop;\n out += ' ( ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';\n }\n }\n out += ')) { ';\n var $propertyPath = 'missing' + $lvl,\n $missingProperty = '\\' + ' + $propertyPath + ' + \\'';\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;\n }\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('dependencies') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \\'' + (it.util.escapeQuotes($property)) + '\\', missingProperty: \\'' + ($missingProperty) + '\\', depsCount: ' + ($deps.length) + ', deps: \\'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(\", \"))) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should have ';\n if ($deps.length == 1) {\n out += 'property ' + (it.util.escapeQuotes($deps[0]));\n } else {\n out += 'properties ' + (it.util.escapeQuotes($deps.join(\", \")));\n }\n out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n } else {\n out += ' ) { ';\n var arr2 = $deps;\n if (arr2) {\n var $propertyKey, i2 = -1,\n l2 = arr2.length - 1;\n while (i2 < l2) {\n $propertyKey = arr2[i2 += 1];\n var $prop = it.util.getProperty($propertyKey),\n $missingProperty = it.util.escapeQuotes($propertyKey),\n $useData = $data + $prop;\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);\n }\n out += ' if ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('dependencies') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \\'' + (it.util.escapeQuotes($property)) + '\\', missingProperty: \\'' + ($missingProperty) + '\\', depsCount: ' + ($deps.length) + ', deps: \\'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(\", \"))) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should have ';\n if ($deps.length == 1) {\n out += 'property ' + (it.util.escapeQuotes($deps[0]));\n } else {\n out += 'properties ' + (it.util.escapeQuotes($deps.join(\", \")));\n }\n out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';\n }\n }\n }\n out += ' } ';\n if ($breakOnError) {\n $closingBraces += '}';\n out += ' else { ';\n }\n }\n }\n it.errorPath = $currentErrorPath;\n var $currentBaseId = $it.baseId;\n for (var $property in $schemaDeps) {\n var $sch = $schemaDeps[$property];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';\n if ($ownProperties) {\n out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($property)) + '\\') ';\n }\n out += ') { ';\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + it.util.getProperty($property);\n $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n out += ' } ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n }\n if ($breakOnError) {\n out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_enum(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n var $i = 'i' + $lvl,\n $vSchema = 'schema' + $lvl;\n if (!$isData) {\n out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';';\n }\n out += 'var ' + ($valid) + ';';\n if ($isData) {\n out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';\n }\n out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }';\n if ($isData) {\n out += ' } ';\n }\n out += ' if (!' + ($valid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('enum') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should be equal to one of the allowed values\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' }';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_format(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n if (it.opts.format === false) {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n return out;\n }\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n var $unknownFormats = it.opts.unknownFormats,\n $allowUnknown = Array.isArray($unknownFormats);\n if ($isData) {\n var $format = 'format' + $lvl,\n $isObject = 'isObject' + $lvl,\n $formatType = 'formatType' + $lvl;\n out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \\'object\\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \\'string\\'; if (' + ($isObject) + ') { ';\n if (it.async) {\n out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; ';\n }\n out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'string\\') || ';\n }\n out += ' (';\n if ($unknownFormats != 'ignore') {\n out += ' (' + ($schemaValue) + ' && !' + ($format) + ' ';\n if ($allowUnknown) {\n out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 ';\n }\n out += ') || ';\n }\n out += ' (' + ($format) + ' && ' + ($formatType) + ' == \\'' + ($ruleType) + '\\' && !(typeof ' + ($format) + ' == \\'function\\' ? ';\n if (it.async) {\n out += ' (async' + ($lvl) + ' ? await ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) ';\n } else {\n out += ' ' + ($format) + '(' + ($data) + ') ';\n }\n out += ' : ' + ($format) + '.test(' + ($data) + '))))) {';\n } else {\n var $format = it.formats[$schema];\n if (!$format) {\n if ($unknownFormats == 'ignore') {\n it.logger.warn('unknown format \"' + $schema + '\" ignored in schema at path \"' + it.errSchemaPath + '\"');\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n return out;\n } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n return out;\n } else {\n throw new Error('unknown format \"' + $schema + '\" is used in schema at path \"' + it.errSchemaPath + '\"');\n }\n }\n var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate;\n var $formatType = $isObject && $format.type || 'string';\n if ($isObject) {\n var $async = $format.async === true;\n $format = $format.validate;\n }\n if ($formatType != $ruleType) {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n return out;\n }\n if ($async) {\n if (!it.async) throw new Error('async format in sync schema');\n var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';\n out += ' if (!(await ' + ($formatRef) + '(' + ($data) + '))) { ';\n } else {\n out += ' if (! ';\n var $formatRef = 'formats' + it.util.getProperty($schema);\n if ($isObject) $formatRef += '.validate';\n if (typeof $format == 'function') {\n out += ' ' + ($formatRef) + '(' + ($data) + ') ';\n } else {\n out += ' ' + ($formatRef) + '.test(' + ($data) + ') ';\n }\n out += ') { ';\n }\n }\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('format') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: ';\n if ($isData) {\n out += '' + ($schemaValue);\n } else {\n out += '' + (it.util.toQuotedString($schema));\n }\n out += ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should match format \"';\n if ($isData) {\n out += '\\' + ' + ($schemaValue) + ' + \\'';\n } else {\n out += '' + (it.util.escapeQuotes($schema));\n }\n out += '\"\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + (it.util.toQuotedString($schema));\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_if(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $thenSch = it.schema['then'],\n $elseSch = it.schema['else'],\n $thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),\n $elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),\n $currentBaseId = $it.baseId;\n if ($thenPresent || $elsePresent) {\n var $ifClause;\n $it.createErrors = false;\n $it.schema = $schema;\n $it.schemaPath = $schemaPath;\n $it.errSchemaPath = $errSchemaPath;\n out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true; ';\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n $it.createErrors = true;\n out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';\n it.compositeRule = $it.compositeRule = $wasComposite;\n if ($thenPresent) {\n out += ' if (' + ($nextValid) + ') { ';\n $it.schema = it.schema['then'];\n $it.schemaPath = it.schemaPath + '.then';\n $it.errSchemaPath = it.errSchemaPath + '/then';\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';\n if ($thenPresent && $elsePresent) {\n $ifClause = 'ifClause' + $lvl;\n out += ' var ' + ($ifClause) + ' = \\'then\\'; ';\n } else {\n $ifClause = '\\'then\\'';\n }\n out += ' } ';\n if ($elsePresent) {\n out += ' else { ';\n }\n } else {\n out += ' if (!' + ($nextValid) + ') { ';\n }\n if ($elsePresent) {\n $it.schema = it.schema['else'];\n $it.schemaPath = it.schemaPath + '.else';\n $it.errSchemaPath = it.errSchemaPath + '/else';\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';\n if ($thenPresent && $elsePresent) {\n $ifClause = 'ifClause' + $lvl;\n out += ' var ' + ($ifClause) + ' = \\'else\\'; ';\n } else {\n $ifClause = '\\'else\\'';\n }\n out += ' } ';\n }\n out += ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('if') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should match \"\\' + ' + ($ifClause) + ' + \\'\" schema\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError(vErrors); ';\n } else {\n out += ' validate.errors = vErrors; return false; ';\n }\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' else { ';\n }\n } else {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_items(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $idx = 'i' + $lvl,\n $dataNxt = $it.dataLevel = it.dataLevel + 1,\n $nextData = 'data' + $dataNxt,\n $currentBaseId = it.baseId;\n out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';\n if (Array.isArray($schema)) {\n var $additionalItems = it.schema.additionalItems;\n if ($additionalItems === false) {\n out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; ';\n var $currErrSchemaPath = $errSchemaPath;\n $errSchemaPath = it.errSchemaPath + '/additionalItems';\n out += ' if (!' + ($valid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('additionalItems') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT have more than ' + ($schema.length) + ' items\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } ';\n $errSchemaPath = $currErrSchemaPath;\n if ($breakOnError) {\n $closingBraces += '}';\n out += ' else { ';\n }\n }\n var arr1 = $schema;\n if (arr1) {\n var $sch, $i = -1,\n l1 = arr1.length - 1;\n while ($i < l1) {\n $sch = arr1[$i += 1];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';\n var $passData = $data + '[' + $i + ']';\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + '[' + $i + ']';\n $it.errSchemaPath = $errSchemaPath + '/' + $i;\n $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);\n $it.dataPathArr[$dataNxt] = $i;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n }\n }\n if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) {\n $it.schema = $additionalItems;\n $it.schemaPath = it.schemaPath + '.additionalItems';\n $it.errSchemaPath = it.errSchemaPath + '/additionalItems';\n out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';\n $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);\n var $passData = $data + '[' + $idx + ']';\n $it.dataPathArr[$dataNxt] = $idx;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n if ($breakOnError) {\n out += ' if (!' + ($nextValid) + ') break; ';\n }\n out += ' } } ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n } else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {\n $it.schema = $schema;\n $it.schemaPath = $schemaPath;\n $it.errSchemaPath = $errSchemaPath;\n out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';\n $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);\n var $passData = $data + '[' + $idx + ']';\n $it.dataPathArr[$dataNxt] = $idx;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n if ($breakOnError) {\n out += ' if (!' + ($nextValid) + ') break; ';\n }\n out += ' }';\n }\n if ($breakOnError) {\n out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate__limit(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $errorKeyword;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n var $isMax = $keyword == 'maximum',\n $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum',\n $schemaExcl = it.schema[$exclusiveKeyword],\n $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data,\n $op = $isMax ? '<' : '>',\n $notOp = $isMax ? '>' : '<',\n $errorKeyword = undefined;\n if (!($isData || typeof $schema == 'number' || $schema === undefined)) {\n throw new Error($keyword + ' must be number');\n }\n if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {\n throw new Error($exclusiveKeyword + ' must be number or boolean');\n }\n if ($isDataExcl) {\n var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),\n $exclusive = 'exclusive' + $lvl,\n $exclType = 'exclType' + $lvl,\n $exclIsNumber = 'exclIsNumber' + $lvl,\n $opExpr = 'op' + $lvl,\n $opStr = '\\' + ' + $opExpr + ' + \\'';\n out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';\n $schemaValueExcl = 'schemaExcl' + $lvl;\n out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \\'boolean\\' && ' + ($exclType) + ' != \\'undefined\\' && ' + ($exclType) + ' != \\'number\\') { ';\n var $errorKeyword = $exclusiveKeyword;\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ($errorKeyword || '_exclusiveLimit') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'' + ($exclusiveKeyword) + ' should be boolean\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } else if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n out += ' ' + ($exclType) + ' == \\'number\\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \\'' + ($op) + '\\' : \\'' + ($op) + '=\\'; ';\n if ($schema === undefined) {\n $errorKeyword = $exclusiveKeyword;\n $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;\n $schemaValue = $schemaValueExcl;\n $isData = $isDataExcl;\n }\n } else {\n var $exclIsNumber = typeof $schemaExcl == 'number',\n $opStr = $op;\n if ($exclIsNumber && $isData) {\n var $opExpr = '\\'' + $opStr + '\\'';\n out += ' if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { ';\n } else {\n if ($exclIsNumber && $schema === undefined) {\n $exclusive = true;\n $errorKeyword = $exclusiveKeyword;\n $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;\n $schemaValue = $schemaExcl;\n $notOp += '=';\n } else {\n if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);\n if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {\n $exclusive = true;\n $errorKeyword = $exclusiveKeyword;\n $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;\n $notOp += '=';\n } else {\n $exclusive = false;\n $opStr += '=';\n }\n }\n var $opExpr = '\\'' + $opStr + '\\'';\n out += ' if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { ';\n }\n }\n $errorKeyword = $errorKeyword || $keyword;\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ($errorKeyword || '_limit') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should be ' + ($opStr) + ' ';\n if ($isData) {\n out += '\\' + ' + ($schemaValue);\n } else {\n out += '' + ($schemaValue) + '\\'';\n }\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate__limitItems(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $errorKeyword;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (!($isData || typeof $schema == 'number')) {\n throw new Error($keyword + ' must be number');\n }\n var $op = $keyword == 'maxItems' ? '>' : '<';\n out += 'if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { ';\n var $errorKeyword = $keyword;\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ($errorKeyword || '_limitItems') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT have ';\n if ($keyword == 'maxItems') {\n out += 'more';\n } else {\n out += 'fewer';\n }\n out += ' than ';\n if ($isData) {\n out += '\\' + ' + ($schemaValue) + ' + \\'';\n } else {\n out += '' + ($schema);\n }\n out += ' items\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += '} ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate__limitLength(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $errorKeyword;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (!($isData || typeof $schema == 'number')) {\n throw new Error($keyword + ' must be number');\n }\n var $op = $keyword == 'maxLength' ? '>' : '<';\n out += 'if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n if (it.opts.unicode === false) {\n out += ' ' + ($data) + '.length ';\n } else {\n out += ' ucs2length(' + ($data) + ') ';\n }\n out += ' ' + ($op) + ' ' + ($schemaValue) + ') { ';\n var $errorKeyword = $keyword;\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ($errorKeyword || '_limitLength') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT be ';\n if ($keyword == 'maxLength') {\n out += 'longer';\n } else {\n out += 'shorter';\n }\n out += ' than ';\n if ($isData) {\n out += '\\' + ' + ($schemaValue) + ' + \\'';\n } else {\n out += '' + ($schema);\n }\n out += ' characters\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += '} ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate__limitProperties(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $errorKeyword;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (!($isData || typeof $schema == 'number')) {\n throw new Error($keyword + ' must be number');\n }\n var $op = $keyword == 'maxProperties' ? '>' : '<';\n out += 'if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'number\\') || ';\n }\n out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { ';\n var $errorKeyword = $keyword;\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ($errorKeyword || '_limitProperties') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT have ';\n if ($keyword == 'maxProperties') {\n out += 'more';\n } else {\n out += 'fewer';\n }\n out += ' than ';\n if ($isData) {\n out += '\\' + ' + ($schemaValue) + ' + \\'';\n } else {\n out += '' + ($schema);\n }\n out += ' properties\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += '} ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_multipleOf(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (!($isData || typeof $schema == 'number')) {\n throw new Error($keyword + ' must be number');\n }\n out += 'var division' + ($lvl) + ';if (';\n if ($isData) {\n out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \\'number\\' || ';\n }\n out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', ';\n if (it.opts.multipleOfPrecision) {\n out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' ';\n } else {\n out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') ';\n }\n out += ' ) ';\n if ($isData) {\n out += ' ) ';\n }\n out += ' ) { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('multipleOf') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should be multiple of ';\n if ($isData) {\n out += '\\' + ' + ($schemaValue);\n } else {\n out += '' + ($schemaValue) + '\\'';\n }\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += '} ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_not(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {\n $it.schema = $schema;\n $it.schemaPath = $schemaPath;\n $it.errSchemaPath = $errSchemaPath;\n out += ' var ' + ($errs) + ' = errors; ';\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n $it.createErrors = false;\n var $allErrorsOption;\n if ($it.opts.allErrors) {\n $allErrorsOption = $it.opts.allErrors;\n $it.opts.allErrors = false;\n }\n out += ' ' + (it.validate($it)) + ' ';\n $it.createErrors = true;\n if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;\n it.compositeRule = $it.compositeRule = $wasComposite;\n out += ' if (' + ($nextValid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('not') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT be valid\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';\n if (it.opts.allErrors) {\n out += ' } ';\n }\n } else {\n out += ' var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('not') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT be valid\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n if ($breakOnError) {\n out += ' if (false) { ';\n }\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_oneOf(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $currentBaseId = $it.baseId,\n $prevValid = 'prevValid' + $lvl,\n $passingSchemas = 'passingSchemas' + $lvl;\n out += 'var ' + ($errs) + ' = errors , ' + ($prevValid) + ' = false , ' + ($valid) + ' = false , ' + ($passingSchemas) + ' = null; ';\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n var arr1 = $schema;\n if (arr1) {\n var $sch, $i = -1,\n l1 = arr1.length - 1;\n while ($i < l1) {\n $sch = arr1[$i += 1];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + '[' + $i + ']';\n $it.errSchemaPath = $errSchemaPath + '/' + $i;\n out += ' ' + (it.validate($it)) + ' ';\n $it.baseId = $currentBaseId;\n } else {\n out += ' var ' + ($nextValid) + ' = true; ';\n }\n if ($i) {\n out += ' if (' + ($nextValid) + ' && ' + ($prevValid) + ') { ' + ($valid) + ' = false; ' + ($passingSchemas) + ' = [' + ($passingSchemas) + ', ' + ($i) + ']; } else { ';\n $closingBraces += '}';\n }\n out += ' if (' + ($nextValid) + ') { ' + ($valid) + ' = ' + ($prevValid) + ' = true; ' + ($passingSchemas) + ' = ' + ($i) + '; }';\n }\n }\n it.compositeRule = $it.compositeRule = $wasComposite;\n out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('oneOf') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { passingSchemas: ' + ($passingSchemas) + ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should match exactly one schema in oneOf\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError(vErrors); ';\n } else {\n out += ' validate.errors = vErrors; return false; ';\n }\n }\n out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }';\n if (it.opts.allErrors) {\n out += ' } ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_pattern(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema);\n out += 'if ( ';\n if ($isData) {\n out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \\'string\\') || ';\n }\n out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('pattern') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: ';\n if ($isData) {\n out += '' + ($schemaValue);\n } else {\n out += '' + (it.util.toQuotedString($schema));\n }\n out += ' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should match pattern \"';\n if ($isData) {\n out += '\\' + ' + ($schemaValue) + ' + \\'';\n } else {\n out += '' + (it.util.escapeQuotes($schema));\n }\n out += '\"\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + (it.util.toQuotedString($schema));\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += '} ';\n if ($breakOnError) {\n out += ' else { ';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_properties(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n var $key = 'key' + $lvl,\n $idx = 'idx' + $lvl,\n $dataNxt = $it.dataLevel = it.dataLevel + 1,\n $nextData = 'data' + $dataNxt,\n $dataProperties = 'dataProperties' + $lvl;\n var $schemaKeys = Object.keys($schema || {}).filter(notProto),\n $pProperties = it.schema.patternProperties || {},\n $pPropertyKeys = Object.keys($pProperties).filter(notProto),\n $aProperties = it.schema.additionalProperties,\n $someProperties = $schemaKeys.length || $pPropertyKeys.length,\n $noAdditional = $aProperties === false,\n $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length,\n $removeAdditional = it.opts.removeAdditional,\n $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional,\n $ownProperties = it.opts.ownProperties,\n $currentBaseId = it.baseId;\n var $required = it.schema.required;\n if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {\n var $requiredHash = it.util.toHash($required);\n }\n\n function notProto(p) {\n return p !== '__proto__';\n }\n out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';\n if ($ownProperties) {\n out += ' var ' + ($dataProperties) + ' = undefined;';\n }\n if ($checkAdditional) {\n if ($ownProperties) {\n out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';\n } else {\n out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';\n }\n if ($someProperties) {\n out += ' var isAdditional' + ($lvl) + ' = !(false ';\n if ($schemaKeys.length) {\n if ($schemaKeys.length > 8) {\n out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') ';\n } else {\n var arr1 = $schemaKeys;\n if (arr1) {\n var $propertyKey, i1 = -1,\n l1 = arr1.length - 1;\n while (i1 < l1) {\n $propertyKey = arr1[i1 += 1];\n out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' ';\n }\n }\n }\n }\n if ($pPropertyKeys.length) {\n var arr2 = $pPropertyKeys;\n if (arr2) {\n var $pProperty, $i = -1,\n l2 = arr2.length - 1;\n while ($i < l2) {\n $pProperty = arr2[$i += 1];\n out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') ';\n }\n }\n }\n out += ' ); if (isAdditional' + ($lvl) + ') { ';\n }\n if ($removeAdditional == 'all') {\n out += ' delete ' + ($data) + '[' + ($key) + ']; ';\n } else {\n var $currentErrorPath = it.errorPath;\n var $additionalProperty = '\\' + ' + $key + ' + \\'';\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);\n }\n if ($noAdditional) {\n if ($removeAdditional) {\n out += ' delete ' + ($data) + '[' + ($key) + ']; ';\n } else {\n out += ' ' + ($nextValid) + ' = false; ';\n var $currErrSchemaPath = $errSchemaPath;\n $errSchemaPath = it.errSchemaPath + '/additionalProperties';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('additionalProperties') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \\'' + ($additionalProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is an invalid additional property';\n } else {\n out += 'should NOT have additional properties';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n $errSchemaPath = $currErrSchemaPath;\n if ($breakOnError) {\n out += ' break; ';\n }\n }\n } else if ($additionalIsSchema) {\n if ($removeAdditional == 'failing') {\n out += ' var ' + ($errs) + ' = errors; ';\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n $it.schema = $aProperties;\n $it.schemaPath = it.schemaPath + '.additionalProperties';\n $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';\n $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);\n var $passData = $data + '[' + $key + ']';\n $it.dataPathArr[$dataNxt] = $key;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } ';\n it.compositeRule = $it.compositeRule = $wasComposite;\n } else {\n $it.schema = $aProperties;\n $it.schemaPath = it.schemaPath + '.additionalProperties';\n $it.errSchemaPath = it.errSchemaPath + '/additionalProperties';\n $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);\n var $passData = $data + '[' + $key + ']';\n $it.dataPathArr[$dataNxt] = $key;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n if ($breakOnError) {\n out += ' if (!' + ($nextValid) + ') break; ';\n }\n }\n }\n it.errorPath = $currentErrorPath;\n }\n if ($someProperties) {\n out += ' } ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n var $useDefaults = it.opts.useDefaults && !it.compositeRule;\n if ($schemaKeys.length) {\n var arr3 = $schemaKeys;\n if (arr3) {\n var $propertyKey, i3 = -1,\n l3 = arr3.length - 1;\n while (i3 < l3) {\n $propertyKey = arr3[i3 += 1];\n var $sch = $schema[$propertyKey];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n var $prop = it.util.getProperty($propertyKey),\n $passData = $data + $prop,\n $hasDefault = $useDefaults && $sch.default !== undefined;\n $it.schema = $sch;\n $it.schemaPath = $schemaPath + $prop;\n $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);\n $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);\n $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n $code = it.util.varReplace($code, $nextData, $passData);\n var $useData = $passData;\n } else {\n var $useData = $nextData;\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ';\n }\n if ($hasDefault) {\n out += ' ' + ($code) + ' ';\n } else {\n if ($requiredHash && $requiredHash[$propertyKey]) {\n out += ' if ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') { ' + ($nextValid) + ' = false; ';\n var $currentErrorPath = it.errorPath,\n $currErrSchemaPath = $errSchemaPath,\n $missingProperty = it.util.escapeQuotes($propertyKey);\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);\n }\n $errSchemaPath = it.errSchemaPath + '/required';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n $errSchemaPath = $currErrSchemaPath;\n it.errorPath = $currentErrorPath;\n out += ' } else { ';\n } else {\n if ($breakOnError) {\n out += ' if ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') { ' + ($nextValid) + ' = true; } else { ';\n } else {\n out += ' if (' + ($useData) + ' !== undefined ';\n if ($ownProperties) {\n out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ' ) { ';\n }\n }\n out += ' ' + ($code) + ' } ';\n }\n }\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n }\n }\n if ($pPropertyKeys.length) {\n var arr4 = $pPropertyKeys;\n if (arr4) {\n var $pProperty, i4 = -1,\n l4 = arr4.length - 1;\n while (i4 < l4) {\n $pProperty = arr4[i4 += 1];\n var $sch = $pProperties[$pProperty];\n if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {\n $it.schema = $sch;\n $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);\n $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);\n if ($ownProperties) {\n out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';\n } else {\n out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';\n }\n out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { ';\n $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);\n var $passData = $data + '[' + $key + ']';\n $it.dataPathArr[$dataNxt] = $key;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n if ($breakOnError) {\n out += ' if (!' + ($nextValid) + ') break; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' else ' + ($nextValid) + ' = true; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' if (' + ($nextValid) + ') { ';\n $closingBraces += '}';\n }\n }\n }\n }\n }\n if ($breakOnError) {\n out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_propertyNames(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $errs = 'errs__' + $lvl;\n var $it = it.util.copy(it);\n var $closingBraces = '';\n $it.level++;\n var $nextValid = 'valid' + $it.level;\n out += 'var ' + ($errs) + ' = errors;';\n if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {\n $it.schema = $schema;\n $it.schemaPath = $schemaPath;\n $it.errSchemaPath = $errSchemaPath;\n var $key = 'key' + $lvl,\n $idx = 'idx' + $lvl,\n $i = 'i' + $lvl,\n $invalidName = '\\' + ' + $key + ' + \\'',\n $dataNxt = $it.dataLevel = it.dataLevel + 1,\n $nextData = 'data' + $dataNxt,\n $dataProperties = 'dataProperties' + $lvl,\n $ownProperties = it.opts.ownProperties,\n $currentBaseId = it.baseId;\n if ($ownProperties) {\n out += ' var ' + ($dataProperties) + ' = undefined; ';\n }\n if ($ownProperties) {\n out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';\n } else {\n out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';\n }\n out += ' var startErrs' + ($lvl) + ' = errors; ';\n var $passData = $key;\n var $wasComposite = it.compositeRule;\n it.compositeRule = $it.compositeRule = true;\n var $code = it.validate($it);\n $it.baseId = $currentBaseId;\n if (it.util.varOccurences($code, $nextData) < 2) {\n out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';\n } else {\n out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';\n }\n it.compositeRule = $it.compositeRule = $wasComposite;\n out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + ' 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {\n $required[$required.length] = $property;\n }\n }\n }\n } else {\n var $required = $schema;\n }\n }\n if ($isData || $required.length) {\n var $currentErrorPath = it.errorPath,\n $loopRequired = $isData || $required.length >= it.opts.loopRequired,\n $ownProperties = it.opts.ownProperties;\n if ($breakOnError) {\n out += ' var missing' + ($lvl) + '; ';\n if ($loopRequired) {\n if (!$isData) {\n out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';\n }\n var $i = 'i' + $lvl,\n $propertyPath = 'schema' + $lvl + '[' + $i + ']',\n $missingProperty = '\\' + ' + $propertyPath + ' + \\'';\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);\n }\n out += ' var ' + ($valid) + ' = true; ';\n if ($isData) {\n out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';\n }\n out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined ';\n if ($ownProperties) {\n out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';\n }\n out += '; if (!' + ($valid) + ') break; } ';\n if ($isData) {\n out += ' } ';\n }\n out += ' if (!' + ($valid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } else { ';\n } else {\n out += ' if ( ';\n var arr2 = $required;\n if (arr2) {\n var $propertyKey, $i = -1,\n l2 = arr2.length - 1;\n while ($i < l2) {\n $propertyKey = arr2[$i += 1];\n if ($i) {\n out += ' || ';\n }\n var $prop = it.util.getProperty($propertyKey),\n $useData = $data + $prop;\n out += ' ( ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';\n }\n }\n out += ') { ';\n var $propertyPath = 'missing' + $lvl,\n $missingProperty = '\\' + ' + $propertyPath + ' + \\'';\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;\n }\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } else { ';\n }\n } else {\n if ($loopRequired) {\n if (!$isData) {\n out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; ';\n }\n var $i = 'i' + $lvl,\n $propertyPath = 'schema' + $lvl + '[' + $i + ']',\n $missingProperty = '\\' + ' + $propertyPath + ' + \\'';\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);\n }\n if ($isData) {\n out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { ';\n }\n out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) ';\n }\n out += ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ';\n if ($isData) {\n out += ' } ';\n }\n } else {\n var arr3 = $required;\n if (arr3) {\n var $propertyKey, i3 = -1,\n l3 = arr3.length - 1;\n while (i3 < l3) {\n $propertyKey = arr3[i3 += 1];\n var $prop = it.util.getProperty($propertyKey),\n $missingProperty = it.util.escapeQuotes($propertyKey),\n $useData = $data + $prop;\n if (it.opts._errorDataPathProperty) {\n it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);\n }\n out += ' if ( ' + ($useData) + ' === undefined ';\n if ($ownProperties) {\n out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \\'' + (it.util.escapeQuotes($propertyKey)) + '\\') ';\n }\n out += ') { var err = '; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('required') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \\'' + ($missingProperty) + '\\' } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'';\n if (it.opts._errorDataPathProperty) {\n out += 'is a required property';\n } else {\n out += 'should have required property \\\\\\'' + ($missingProperty) + '\\\\\\'';\n }\n out += '\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';\n }\n }\n }\n }\n it.errorPath = $currentErrorPath;\n } else if ($breakOnError) {\n out += ' if (true) {';\n }\n return out;\n}\n","'use strict';\nmodule.exports = function generate_uniqueItems(it, $keyword, $ruleType) {\n var out = ' ';\n var $lvl = it.level;\n var $dataLvl = it.dataLevel;\n var $schema = it.schema[$keyword];\n var $schemaPath = it.schemaPath + it.util.getProperty($keyword);\n var $errSchemaPath = it.errSchemaPath + '/' + $keyword;\n var $breakOnError = !it.opts.allErrors;\n var $data = 'data' + ($dataLvl || '');\n var $valid = 'valid' + $lvl;\n var $isData = it.opts.$data && $schema && $schema.$data,\n $schemaValue;\n if ($isData) {\n out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';\n $schemaValue = 'schema' + $lvl;\n } else {\n $schemaValue = $schema;\n }\n if (($schema || $isData) && it.opts.uniqueItems !== false) {\n if ($isData) {\n out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \\'boolean\\') ' + ($valid) + ' = false; else { ';\n }\n out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { ';\n var $itemType = it.schema.items && it.schema.items.type,\n $typeIsArray = Array.isArray($itemType);\n if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) {\n out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } ';\n } else {\n out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';\n var $method = 'checkDataType' + ($typeIsArray ? 's' : '');\n out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';\n if ($typeIsArray) {\n out += ' if (typeof item == \\'string\\') item = \\'\"\\' + item; ';\n }\n out += ' if (typeof itemIndices[item] == \\'number\\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } ';\n }\n out += ' } ';\n if ($isData) {\n out += ' } ';\n }\n out += ' if (!' + ($valid) + ') { ';\n var $$outStack = $$outStack || [];\n $$outStack.push(out);\n out = ''; /* istanbul ignore else */\n if (it.createErrors !== false) {\n out += ' { keyword: \\'' + ('uniqueItems') + '\\' , dataPath: (dataPath || \\'\\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } ';\n if (it.opts.messages !== false) {\n out += ' , message: \\'should NOT have duplicate items (items ## \\' + j + \\' and \\' + i + \\' are identical)\\' ';\n }\n if (it.opts.verbose) {\n out += ' , schema: ';\n if ($isData) {\n out += 'validate.schema' + ($schemaPath);\n } else {\n out += '' + ($schema);\n }\n out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';\n }\n out += ' } ';\n } else {\n out += ' {} ';\n }\n var __err = out;\n out = $$outStack.pop();\n if (!it.compositeRule && $breakOnError) {\n /* istanbul ignore if */\n if (it.async) {\n out += ' throw new ValidationError([' + (__err) + ']); ';\n } else {\n out += ' validate.errors = [' + (__err) + ']; return false; ';\n }\n } else {\n out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';\n }\n out += ' } ';\n if ($breakOnError) {\n out += ' else { ';\n }\n } else {\n if ($breakOnError) {\n out += ' if (true) { ';\n }\n }\n return out;\n}\n","'use strict';\n\n//all requires must be explicit because browserify won't work with dynamic requires\nmodule.exports = {\n '$ref': require('./ref'),\n allOf: require('./allOf'),\n anyOf: require('./anyOf'),\n '$comment': require('./comment'),\n const: require('./const'),\n contains: require('./contains'),\n dependencies: require('./dependencies'),\n 'enum': require('./enum'),\n format: require('./format'),\n 'if': require('./if'),\n items: require('./items'),\n maximum: require('./_limit'),\n minimum: require('./_limit'),\n maxItems: require('./_limitItems'),\n minItems: require('./_limitItems'),\n maxLength: require('./_limitLength'),\n minLength: require('./_limitLength'),\n maxProperties: require('./_limitProperties'),\n minProperties: require('./_limitProperties'),\n multipleOf: require('./multipleOf'),\n not: require('./not'),\n oneOf: require('./oneOf'),\n pattern: require('./pattern'),\n properties: require('./properties'),\n propertyNames: require('./propertyNames'),\n required: require('./required'),\n uniqueItems: require('./uniqueItems'),\n validate: require('./validate')\n};\n","'use strict';\n\nvar ruleModules = require('../dotjs')\n , toHash = require('./util').toHash;\n\nmodule.exports = function rules() {\n var RULES = [\n { type: 'number',\n rules: [ { 'maximum': ['exclusiveMaximum'] },\n { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] },\n { type: 'string',\n rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },\n { type: 'array',\n rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] },\n { type: 'object',\n rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames',\n { 'properties': ['additionalProperties', 'patternProperties'] } ] },\n { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] }\n ];\n\n var ALL = [ 'type', '$comment' ];\n var KEYWORDS = [\n '$schema', '$id', 'id', '$data', '$async', 'title',\n 'description', 'default', 'definitions',\n 'examples', 'readOnly', 'writeOnly',\n 'contentMediaType', 'contentEncoding',\n 'additionalItems', 'then', 'else'\n ];\n var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];\n RULES.all = toHash(ALL);\n RULES.types = toHash(TYPES);\n\n RULES.forEach(function (group) {\n group.rules = group.rules.map(function (keyword) {\n var implKeywords;\n if (typeof keyword == 'object') {\n var key = Object.keys(keyword)[0];\n implKeywords = keyword[key];\n keyword = key;\n implKeywords.forEach(function (k) {\n ALL.push(k);\n RULES.all[k] = true;\n });\n }\n ALL.push(keyword);\n var rule = RULES.all[keyword] = {\n keyword: keyword,\n code: ruleModules[keyword],\n implements: implKeywords\n };\n return rule;\n });\n\n RULES.all.$comment = {\n keyword: '$comment',\n code: ruleModules.$comment\n };\n\n if (group.type) RULES.types[group.type] = group;\n });\n\n RULES.keywords = toHash(ALL.concat(KEYWORDS));\n RULES.custom = {};\n\n return RULES;\n};\n","'use strict';\n\nvar KEYWORDS = [\n 'multipleOf',\n 'maximum',\n 'exclusiveMaximum',\n 'minimum',\n 'exclusiveMinimum',\n 'maxLength',\n 'minLength',\n 'pattern',\n 'additionalItems',\n 'maxItems',\n 'minItems',\n 'uniqueItems',\n 'maxProperties',\n 'minProperties',\n 'required',\n 'additionalProperties',\n 'enum',\n 'format',\n 'const'\n];\n\nmodule.exports = function (metaSchema, keywordsJsonPointers) {\n for (var i=0; i} errors optional array of validation errors, if not passed errors from the instance are used.\n * @param {Object} options optional options with properties `separator` and `dataVar`.\n * @return {String} human readable string with all errors descriptions\n */\nfunction errorsText(errors, options) {\n errors = errors || this.errors;\n if (!errors) return 'No errors';\n options = options || {};\n var separator = options.separator === undefined ? ', ' : options.separator;\n var dataVar = options.dataVar === undefined ? 'data' : options.dataVar;\n\n var text = '';\n for (var i=0; i, i: number, ts: Partial[]) => void\n) {\n if ('tracks' in spec) {\n spec.tracks.forEach((t, i, ts) => {\n callback(t, i, ts);\n traverseTracks(t, callback);\n });\n } else if ('views' in spec) {\n spec.views.forEach(view => traverseTracks(view, callback));\n }\n}\n\n/**\n * Traverse individual tracks and views and call the callback function to read and/or update the common definition of views and tracks.\n * @param spec\n * @param callback\n */\nexport function traverseTracksAndViews(\n spec: GoslingSpec | View | PartialTrack,\n callback: (tv: CommonViewDef | CommonTrackDef) => void\n) {\n if ('tracks' in spec) {\n spec.tracks.forEach(t => {\n callback(t);\n traverseTracksAndViews(t, callback);\n });\n } else if ('views' in spec) {\n spec.views.forEach(v => {\n callback(v);\n traverseTracksAndViews(v, callback);\n });\n }\n}\n\n/**\n * Traverse individual view arrangements and call the callback function to read and/or update the arrangement information.\n * @param spec\n * @param callback\n */\nexport function traverseViewArrangements(spec: GoslingSpec, callback: (tv: MultipleViews) => void) {\n if ('tracks' in spec) {\n // No need to do anything\n } else {\n callback(spec);\n spec.views.forEach(v => {\n traverseViewArrangements(v, callback);\n });\n }\n}\n\n/**\n * This convert the nested track definitions into a flat array.\n * @param spec\n */\nexport function convertToFlatTracks(spec: SingleView): Track[] {\n if (IsFlatTracks(spec)) {\n // This is already `FlatTracks`, so just override the view definition\n const base = { ...spec, tracks: undefined, id: undefined };\n return spec.tracks\n .filter(track => !track._invalidTrack)\n .map(track => Object.assign(JSON.parse(JSON.stringify(base)), track) as SingleTrack);\n }\n\n const newTracks: Track[] = [];\n if (IsStackedTracks(spec)) {\n spec.tracks\n .filter(track => !track._invalidTrack)\n .map(track => {\n if ('alignment' in track) {\n // This is OverlaidTracks\n newTracks.push({\n ...track,\n _overlay: [...track.tracks],\n tracks: undefined,\n alignment: undefined\n } as Track);\n } else {\n // Override track definitions from views\n const base = { ...spec, tracks: undefined, id: undefined };\n const newSpec = Object.assign(JSON.parse(JSON.stringify(base)), track) as SingleTrack;\n newTracks.push(newSpec);\n }\n });\n } else {\n newTracks.push({\n ...spec,\n _overlay: [...spec.tracks.filter(track => !track._invalidTrack)],\n tracks: undefined,\n alignment: undefined\n } as Track);\n }\n\n return JSON.parse(JSON.stringify(newTracks));\n}\n\n/**\n * Traverse views and tracks to use parents's properties if missing.\n * @param spec\n * @param callback\n */\nexport function traverseToFixSpecDownstream(spec: GoslingSpec | SingleView, parentDef?: CommonViewDef | MultipleViews) {\n // TODO: Instead of overriding props individually, use Object.assign()\n if (parentDef) {\n // For assembly and layout, we use the ones defiend by the parents if missing\n if (spec.assembly === undefined) spec.assembly = parentDef.assembly;\n if (spec.layout === undefined) spec.layout = parentDef.layout;\n if (spec.orientation === undefined) spec.orientation = parentDef.orientation;\n if (spec.static === undefined) spec.static = parentDef.static !== undefined ? parentDef.static : false;\n if (spec.zoomLimits === undefined) spec.zoomLimits = parentDef.zoomLimits;\n if (spec.xDomain === undefined) spec.xDomain = parentDef.xDomain;\n if (spec.yDomain === undefined) spec.yDomain = parentDef.yDomain;\n if (spec.linkingId === undefined) spec.linkingId = parentDef.linkingId;\n if (spec.centerRadius === undefined) spec.centerRadius = parentDef.centerRadius;\n if (spec.spacing === undefined && !('tracks' in spec)) spec.spacing = parentDef.spacing;\n if (spec.xOffset === undefined) spec.xOffset = parentDef.xOffset;\n if (spec.yOffset === undefined) spec.yOffset = parentDef.yOffset;\n if ('views' in spec && 'arrangement' in parentDef && spec.arrangement === undefined)\n spec.arrangement = parentDef.arrangement;\n spec.style = getStyleOverridden(parentDef.style, spec.style); // override styles deeply\n } else {\n // This means we are at the rool level, so assign default values if missing\n if (spec.assembly === undefined) spec.assembly = 'hg38';\n if (spec.layout === undefined) spec.layout = 'linear';\n if (spec.orientation === undefined) spec.orientation = 'horizontal';\n if (spec.static === undefined) spec.static = false;\n if (spec.zoomLimits === undefined) spec.zoomLimits = [1, null];\n if (spec.centerRadius === undefined) spec.centerRadius = DEFAULT_INNER_RADIUS_PROP;\n if (spec.spacing === undefined) spec.spacing = DEFAULT_VIEW_SPACING;\n if ('views' in spec && spec.arrangement === undefined) spec.arrangement = 'vertical';\n if (spec.xOffset === undefined) spec.xOffset = 0;\n if (spec.yOffset === undefined) spec.yOffset = 0;\n // Nothing to do when `xDomain` not suggested\n // Nothing to do when `xLinkID` not suggested\n }\n\n // ID should be assigned to each view and track for an API usage\n if (!spec.id) {\n spec.id = uuid();\n }\n\n if ('tracks' in spec) {\n let tracks: Track[] = convertToFlatTracks(spec);\n // !!! Be aware that this should be taken before fixing `overlayOnPreviousTrack` options.\n /**\n * Spread superposed tracks if they are assigned to different data spec.\n * This process is necessary since we are passing over each track to HiGlass, and if a track contain multiple datastes, HiGlass cannot handle that.\n */\n tracks = spreadTracksByData(tracks);\n\n const linkID = uuid();\n tracks.forEach((track, i, array) => {\n // ID should be assigned to each view and track for an API usage\n if (!track.id) {\n track.id = uuid();\n }\n\n // If size not defined, set default ones\n if (!track.width) {\n track.width = Is2DTrack(track) ? DEFAULT_TRACK_SIZE_2D : DEFAULT_TRACK_WIDTH_LINEAR;\n }\n if (!track.height) {\n track.height = Is2DTrack(track) ? DEFAULT_TRACK_SIZE_2D : DEFAULT_TRACK_HEIGHT_LINEAR;\n }\n /**\n * Process a stack option.\n */\n if ('displacement' in track) {\n if (\n track.displacement?.type === 'pile' &&\n track.row === undefined &&\n IsChannelDeep(track.x) &&\n track.x.field &&\n IsChannelDeep(track.xe) &&\n track.xe.field\n // Question: Should we consider mark types? (e.g., link might not be supported?)\n ) {\n const newField = uuid();\n const startField = track.x.field;\n const endField = track.xe.field;\n const padding = track.displacement.padding;\n const displaceTransform: DisplaceTransform = {\n type: 'displace',\n newField,\n boundingBox: { startField, endField, padding },\n method: 'pile'\n };\n\n // Add a data transform for stacking\n if (!track.dataTransform) {\n track.dataTransform = [];\n }\n track.dataTransform = [...track.dataTransform, displaceTransform];\n track.row = { field: newField, type: 'nominal' };\n } else if (track.displacement?.type === 'spread') {\n // ...\n }\n }\n\n /*\n * Properties that shouldn't be suggested\n */\n if (track.layout) track.layout = undefined;\n if (track.zoomLimits) track.zoomLimits = undefined;\n /**\n * Override options received from the parent\n */\n if (!track.assembly) track.assembly = spec.assembly;\n if (!track.layout) track.layout = spec.layout;\n if (!track.orientation) track.orientation = spec.orientation;\n if (track.static === undefined) track.static = spec.static !== undefined ? spec.static : false;\n if (!track.zoomLimits) track.zoomLimits = spec.zoomLimits;\n\n /**\n * Dummy track can't have a circular layout\n */\n if (track.layout == 'circular' && IsDummyTrack(track)) {\n track._invalidTrack = true;\n return;\n }\n\n // Override styles\n track.style = getStyleOverridden(spec.style, track.style);\n if (IsOverlaidTrack(track)) {\n // Remove the dummy tracks from an overlay track\n track._overlay = track._overlay.filter(overlayTrack => {\n return !('type' in overlayTrack && overlayTrack.type == 'dummy-track');\n });\n track._overlay.forEach(o => {\n o.style = getStyleOverridden(track.style, o.style);\n });\n }\n\n /**\n * Orientation is only supported in 1D linear layouts\n */\n if ((track.layout === 'circular' || Is2DTrack(track)) && track.orientation === 'vertical') {\n track.orientation = 'horizontal';\n }\n\n /**\n * A track with 2D genomic coordinates is forced to use a linear layout\n */\n if (Is2DTrack(track)) {\n // TODO: Add a test for this.\n track.layout = 'linear';\n\n /**\n * Add y-axis domain\n */\n if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.y) && !track.y.domain) {\n track.y.domain = spec.yDomain;\n } else if (IsOverlaidTrack(track)) {\n track._overlay.forEach(o => {\n if (IsChannelDeep(o.y) && !o.y.domain) {\n o.y.domain = spec.yDomain;\n }\n });\n }\n }\n\n /**\n * Add x-axis domain\n */\n if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.domain) {\n track.x.domain = spec.xDomain;\n } else if (IsOverlaidTrack(track)) {\n track._overlay.forEach(o => {\n if (IsChannelDeep(o.x) && !o.x.domain) {\n o.x.domain = spec.xDomain;\n }\n });\n }\n\n /**\n * Link tracks in a single view\n */\n if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.linkingId) {\n track.x.linkingId = spec.linkingId ?? linkID;\n } else if (IsOverlaidTrack(track)) {\n let isAdded = false;\n track._overlay.forEach(o => {\n if (isAdded) return; // We want to add only once\n\n if (IsChannelDeep(o.x) && !o.x.linkingId) {\n // TODO: Is this safe?\n o.x.linkingId = spec.linkingId ?? linkID;\n isAdded = true;\n }\n });\n }\n\n if (i === 0) {\n // There is no track to overlay on\n track.overlayOnPreviousTrack = false;\n }\n\n // This means this track is positioned on the top of a view\n if (\n i === 0 ||\n (i !== 0 &&\n tracks.slice(0, i).filter(d => !d.overlayOnPreviousTrack).length === 1 &&\n track.overlayOnPreviousTrack === true)\n ) {\n /**\n * Add axis to the first track, i.e., the track on the top, if undefined\n */\n if ((IsSingleTrack(track) || IsOverlaidTrack(track)) && IsChannelDeep(track.x) && !track.x.axis) {\n if (track.orientation === 'vertical') {\n track.x.axis = 'left';\n } else {\n track.x.axis = 'top';\n }\n } else if (IsOverlaidTrack(track)) {\n // let isNone = false; // If there is at least one 'none' axis, should not render axis.\n track._overlay.forEach(o => {\n if (IsChannelDeep(o.x) && !o.x.axis) {\n if (track.orientation === 'vertical') {\n o.x.axis = 'left';\n } else {\n o.x.axis = 'top';\n }\n }\n // else if (IsChannelDeep(o.x) && o.x.axis === 'none') {\n // isNone = true;\n // }\n });\n }\n }\n\n /*\n * Change axis positions considering the orientation.\n */\n if (\n (IsSingleTrack(track) || IsOverlaidTrack(track)) &&\n IsChannelDeep(track.x) &&\n track.x.axis &&\n track.x.axis !== 'none'\n ) {\n if (track.orientation === 'vertical') {\n if (track.x.axis === 'top') {\n track.x.axis = 'left';\n } else if (track.x.axis === 'bottom') {\n track.x.axis = 'right';\n }\n } else {\n if (track.x.axis === 'left') {\n track.x.axis = 'top';\n } else if (track.x.axis === 'right') {\n track.x.axis = 'bottom';\n }\n }\n } else if (IsOverlaidTrack(track)) {\n // let isNone = false; // If there is at least one 'none' axis, should not render axis.\n track._overlay.forEach(o => {\n if (IsChannelDeep(o.x) && o.x.axis && o.x.axis !== 'none') {\n if (track.orientation === 'vertical') {\n if (o.x.axis === 'top') {\n o.x.axis = 'left';\n } else if (o.x.axis === 'bottom') {\n o.x.axis = 'right';\n }\n } else {\n if (o.x.axis === 'left') {\n o.x.axis = 'top';\n } else if (o.x.axis === 'right') {\n o.x.axis = 'bottom';\n }\n }\n }\n // else if (IsChannelDeep(o.x) && o.x.axis === 'none') {\n // isNone = true;\n // }\n });\n }\n\n /*\n * Flip y scale if the last track uses `link` marks\n */\n if (\n // first track can never flipped by default\n i !== 0 &&\n // [0, ..., i] tracks should not overlaid as a single track\n ((i === array.length - 1 && array.slice(0, i + 1).filter(d => d.overlayOnPreviousTrack).length < i) ||\n // Are the rest of the tracks overlaid as a single track?\n (i !== array.length - 1 &&\n array.slice(i + 1).filter(d => d.overlayOnPreviousTrack).length === array.length - i - 1 &&\n array.slice(0, i + 1).filter(d => d.overlayOnPreviousTrack).length < i))\n ) {\n if (IsSingleTrack(track) && track.mark === 'withinLink' && track.flipY === undefined) {\n track.flipY = true;\n } else if (IsOverlaidTrack(track)) {\n if (track.mark === 'withinLink' && track.flipY === undefined) {\n track.flipY = true;\n }\n track._overlay.forEach(o => {\n if (o.mark === 'withinLink' && o.flipY === undefined) {\n o.flipY = true;\n }\n });\n }\n }\n\n if (track.overlayOnPreviousTrack && array[i - 1]) {\n // Use the same size as the previous one\n track.width = array[i - 1].width;\n track.height = array[i - 1].height;\n\n track.layout = array[i - 1].layout;\n track.assembly = array[i - 1].assembly;\n }\n });\n // Filter out any invalid tracks\n tracks = tracks.filter(track => !track._invalidTrack);\n\n spec.tracks = tracks;\n } else {\n // we did not reach track definition, so continue traversing\n spec.views.forEach(v => {\n traverseToFixSpecDownstream(v, spec as CommonViewDef);\n });\n }\n}\n\n/**\n * Get an encoding template for the `higlass-vector` data type.\n * @param column\n * @param value\n */\nexport function getVectorTemplate(column: string, value: string): SingleTrack {\n return {\n data: {\n type: 'vector',\n url: '',\n column,\n value\n },\n mark: 'bar',\n x: { field: column, type: 'genomic', axis: 'top' },\n y: { field: value, type: 'quantitative' },\n width: 400,\n height: 100\n };\n}\n\nexport function getMultivecTemplate(\n row: string,\n column: string,\n value: string,\n categories: string[] | undefined\n): SingleTrack {\n return categories && categories.length < 10\n ? {\n data: {\n type: 'multivec',\n url: '',\n row,\n column,\n value,\n categories\n },\n mark: 'bar',\n x: { field: column, type: 'genomic', axis: 'top' },\n y: { field: value, type: 'quantitative' },\n row: { field: row, type: 'nominal', legend: true },\n color: { field: row, type: 'nominal' },\n width: 400,\n height: 100\n }\n : {\n data: {\n type: 'multivec',\n url: '',\n row,\n column,\n value,\n categories\n },\n mark: 'rect',\n x: { field: column, type: 'genomic', axis: 'top' },\n row: { field: row, type: 'nominal', legend: true },\n color: { field: value, type: 'quantitative' },\n width: 400,\n height: 100\n };\n}\n\n/**\n * Override default visual encoding in each track for given data type.\n * @param spec\n */\nexport function overrideDataTemplates(spec: GoslingSpec) {\n traverseTracks(spec, (t, i, ts) => {\n if (!('data' in t) || !t.data || !IsDataDeepTileset(t.data)) {\n // if `data` is not specified, we can not provide a correct template.\n return;\n }\n\n if ('alignment' in t) {\n // This is an OverlaidTracks, so skip this.\n return;\n }\n\n if (!IsDataTemplate(t)) {\n // This is not partial specification that we need to use templates\n return;\n }\n\n switch (t.data.type) {\n case 'vector':\n case 'bigwig':\n ts[i] = Object.assign(getVectorTemplate(t.data.column ?? 'position', t.data.value ?? 'value'), t);\n break;\n case 'multivec':\n ts[i] = Object.assign(\n getMultivecTemplate(\n t.data.row ?? 'category',\n t.data.column ?? 'position',\n t.data.value ?? 'value',\n t.data.categories\n ),\n t\n );\n break;\n }\n });\n}\n","export const CHROM_SIZE_HG38 = {\n chr1: 248956422,\n chr2: 242193529,\n chr3: 198295559,\n chr4: 190214555,\n chr5: 181538259,\n chr6: 170805979,\n chr7: 159345973,\n chr8: 145138636,\n chr9: 138394717,\n chr10: 133797422,\n chr11: 135086622,\n chr12: 133275309,\n chr13: 114364328,\n chr14: 107043718,\n chr15: 101991189,\n chr16: 90338345,\n chr17: 83257441,\n chr18: 80373285,\n chr19: 58617616,\n chr20: 64444167,\n chr21: 46709983,\n chr22: 50818468,\n chrX: 156040895,\n chrY: 57227415\n};\n\nexport const CHROM_SIZE_HG19 = {\n chr1: 249250621,\n chr2: 243199373,\n chr3: 198022430,\n chr4: 191154276,\n chr5: 180915260,\n chr6: 171115067,\n chr7: 159138663,\n chr8: 146364022,\n chr9: 141213431,\n chr10: 135534747,\n chr11: 135006516,\n chr12: 133851895,\n chr13: 115169878,\n chr14: 107349540,\n chr15: 102531392,\n chr16: 90354753,\n chr17: 81195210,\n chr18: 78077248,\n chr19: 59128983,\n chr20: 63025520,\n chr21: 48129895,\n chr22: 51304566,\n chrX: 155270560,\n chrY: 59373566,\n chrM: 16571\n};\n\nexport const CHROM_SIZE_HG18 = {\n chr1: 247249719,\n chr2: 242951149,\n chr3: 199501827,\n chr4: 191273063,\n chr5: 180857866,\n chr6: 170899992,\n chr7: 158821424,\n chr8: 146274826,\n chr9: 140273252,\n chr10: 135374737,\n chr11: 134452384,\n chr12: 132349534,\n chr13: 114142980,\n chr14: 106368585,\n chr15: 100338915,\n chr16: 88827254,\n chr17: 78774742,\n chr18: 76117153,\n chr19: 63811651,\n chr20: 62435964,\n chr21: 46944323,\n chr22: 49691432,\n chrX: 154913754,\n chrY: 57772954,\n chrM: 16571\n};\n\nexport const CHROM_SIZE_HG17 = {\n chr1: 245522847,\n chr2: 243018229,\n chr3: 199505740,\n chr4: 191411218,\n chr5: 180857866,\n chr6: 170975699,\n chr7: 158628139,\n chr8: 146274826,\n chr9: 138429268,\n chr10: 135413628,\n chr11: 134452384,\n chr12: 132449811,\n chr13: 114142980,\n chr14: 106368585,\n chr15: 100338915,\n chr16: 88827254,\n chr17: 78774742,\n chr18: 76117153,\n chr19: 63811651,\n chr20: 62435964,\n chr21: 46944323,\n chr22: 49554710,\n chrX: 154824264,\n chrY: 57701691,\n chrM: 16571\n};\n\nexport const CHROM_SIZE_HG16 = {\n chr1: 246127941,\n chr2: 243615958,\n chr3: 199344050,\n chr4: 191731959,\n chr5: 181034922,\n chr6: 170914576,\n chr7: 158545518,\n chr8: 146308819,\n chr9: 136372045,\n chr10: 135037215,\n chr11: 134482954,\n chr12: 132078379,\n chr13: 113042980,\n chr14: 105311216,\n chr15: 100256656,\n chr16: 90041932,\n chr17: 81860266,\n chr18: 76115139,\n chr19: 63811651,\n chr20: 63741868,\n chr21: 46976097,\n chr22: 49396972,\n chrX: 153692391,\n chrY: 50286555,\n chrM: 16571\n};\n\nexport const CHROM_SIZE_MM10 = {\n chr1: 195471971,\n chr2: 182113224,\n chr3: 160039680,\n chr4: 156508116,\n chr5: 151834684,\n chr6: 149736546,\n chr7: 145441459,\n chr8: 129401213,\n chr9: 124595110,\n chr10: 130694993,\n chr11: 122082543,\n chr12: 120129022,\n chr13: 120421639,\n chr14: 124902244,\n chr15: 104043685,\n chr16: 98207768,\n chr17: 94987271,\n chr18: 90702639,\n chr19: 61431566,\n chrX: 171031299,\n chrY: 91744698,\n chrM: 16299\n};\n\nexport const CHROM_SIZE_MM9 = {\n chr1: 197195432,\n chr2: 181748087,\n chr3: 159599783,\n chr4: 155630120,\n chr5: 152537259,\n chr6: 149517037,\n chr7: 152524553,\n chr8: 131738871,\n chr9: 124076172,\n chr10: 129993255,\n chr11: 121843856,\n chr12: 121257530,\n chr13: 120284312,\n chr14: 125194864,\n chr15: 103494974,\n chr16: 98319150,\n chr17: 95272651,\n chr18: 90772031,\n chr19: 61342430,\n chrX: 166650296,\n chrY: 15902555,\n chrM: 16299\n};\n\nexport type Chromosome =\n | '1'\n | '2'\n | '3'\n | '4'\n | '5'\n | '6'\n | '7'\n | '8'\n | '9'\n | '10'\n | '11'\n | '12'\n | '13'\n | '14'\n | '15'\n | '16'\n | '17'\n | '18'\n | '19'\n | '20'\n | '21'\n | '22'\n | 'X'\n | 'Y'\n | 'M'\n | 'chr1'\n | 'chr2'\n | 'chr3'\n | 'chr4'\n | 'chr5'\n | 'chr6'\n | 'chr7'\n | 'chr8'\n | 'chr9'\n | 'chr10'\n | 'chr11'\n | 'chr12'\n | 'chr13'\n | 'chr14'\n | 'chr15'\n | 'chr16'\n | 'chr17'\n | 'chr18'\n | 'chr19'\n | 'chr20'\n | 'chr21'\n | 'chr22'\n | 'chrX'\n | 'chrY'\n | 'chrM';\n","import type { Assembly, ChromSizes, GenomicPosition } from '@gosling-lang/gosling-schema';\nimport {\n CHROM_SIZE_HG16,\n CHROM_SIZE_HG17,\n CHROM_SIZE_HG18,\n CHROM_SIZE_HG19,\n CHROM_SIZE_HG38,\n CHROM_SIZE_MM10,\n CHROM_SIZE_MM9\n} from './chrom-size';\n\nexport interface ChromSize {\n size: { [chr: string]: number };\n interval: { [chr: string]: [number, number] };\n total: number;\n path: string;\n}\n\n/**\n * Get relative chromosome position (e.g., `100` => `{ chromosome: 'chr1', position: 100 }`)\n * @param absPos number which is the absolute chromosome position\n * @param assembly the assembly used to calculate which chromosome position\n * @param returnWithinAssembly If true, then if the absolute position is before the first chromosome, it returns the\n * first position of the first chromosome. If the absolute position is after the last chromosome, it returns the last\n * position of the last chromosome\n * @returns the genomic position of the absPos\n */\nexport function getRelativeGenomicPosition(\n absPos: number,\n assembly?: Assembly,\n returnWithinAssembly = false\n): GenomicPosition {\n const chrSizes = Object.entries(computeChromSizes(assembly).interval);\n const minPosChr = { chromosome: 'unknown', position: Infinity } as GenomicPosition;\n const maxPosChr = { chromosome: 'unknown', position: 0 } as GenomicPosition;\n for (const chrSize of chrSizes) {\n const [chromosome, absInterval] = chrSize;\n const [start, end] = absInterval;\n // absPos was found within this chromosome\n if (start <= absPos && absPos < end) {\n return { chromosome, position: absPos - start } as GenomicPosition;\n }\n // Update the min and max chromosomes found\n if (start < minPosChr.position) {\n minPosChr.chromosome = chromosome;\n minPosChr.position = start;\n }\n if (end > maxPosChr.position) {\n maxPosChr.chromosome = chromosome;\n maxPosChr.position = end;\n }\n }\n if (returnWithinAssembly) {\n // Return either the min or max chromosome position\n if (absPos < minPosChr.position) {\n return minPosChr;\n } else {\n return maxPosChr;\n }\n } else {\n return { chromosome: 'unknown', position: absPos };\n }\n}\n\n/**\n * Generate a URL for custom chrom sizes\n * @param chromSizes A custom assembly that specifies chromosomes and their sizes\n */\nfunction createChromSizesUrl(chromSizes: ChromSizes): string {\n const text = chromSizes.map(d => d.join('\\t')).join('\\n');\n const tsv = new Blob([text], { type: 'text/tsv' });\n return URL.createObjectURL(tsv);\n}\n\n/**\n * Get chromosome sizes.\n * @param assembly (default: 'hg38')\n */\nexport function computeChromSizes(assembly?: Assembly): ChromSize {\n if (assembly && typeof assembly === 'string' && assembly in CRHOM_SIZES) {\n return CRHOM_SIZES[assembly];\n } else if (Array.isArray(assembly) && assembly.length !== 0) {\n // custom assembly\n const size = Object.fromEntries(assembly);\n return {\n size,\n interval: getChromInterval(size),\n total: getChromTotalSize(size),\n path: createChromSizesUrl(assembly)\n };\n } else {\n // We do not have that assembly prepared, so return a default one.\n return CRHOM_SIZES.hg38;\n }\n}\n\nconst basePath = (assembly: string) => `https://s3.amazonaws.com/gosling-lang.org/data/${assembly}.chrom.sizes`;\nconst CRHOM_SIZES: { [assembly: string]: ChromSize } = Object.freeze({\n hg38: {\n size: CHROM_SIZE_HG38,\n interval: getChromInterval(CHROM_SIZE_HG38),\n total: getChromTotalSize(CHROM_SIZE_HG38),\n path: basePath('hg38')\n },\n hg19: {\n size: CHROM_SIZE_HG19,\n interval: getChromInterval(CHROM_SIZE_HG19),\n total: getChromTotalSize(CHROM_SIZE_HG19),\n path: basePath('hg19')\n },\n hg18: {\n size: CHROM_SIZE_HG18,\n interval: getChromInterval(CHROM_SIZE_HG18),\n total: getChromTotalSize(CHROM_SIZE_HG18),\n path: basePath('hg18')\n },\n hg17: {\n size: CHROM_SIZE_HG17,\n interval: getChromInterval(CHROM_SIZE_HG17),\n total: getChromTotalSize(CHROM_SIZE_HG17),\n path: basePath('hg17')\n },\n hg16: {\n size: CHROM_SIZE_HG16,\n interval: getChromInterval(CHROM_SIZE_HG16),\n total: getChromTotalSize(CHROM_SIZE_HG16),\n path: basePath('hg16')\n },\n mm10: {\n size: CHROM_SIZE_MM10,\n interval: getChromInterval(CHROM_SIZE_MM10),\n total: getChromTotalSize(CHROM_SIZE_MM10),\n path: basePath('mm10')\n },\n mm9: {\n size: CHROM_SIZE_MM9,\n interval: getChromInterval(CHROM_SIZE_MM9),\n total: getChromTotalSize(CHROM_SIZE_MM9),\n path: basePath('mm9')\n },\n // `unknown` assembly contains only one chromosome with max length\n unknown: {\n size: { chr: Number.MAX_VALUE },\n interval: { chr: [0, Number.MAX_VALUE] },\n total: Number.MAX_VALUE,\n path: basePath('hg38') // just to ensure this does not make crash\n }\n});\n\n/**\n * Some presets of auto-complete IDs (`autocompleteId`) to search for genes using the HiGlass server.\n */\nexport function getAutoCompleteId(assembly?: Assembly) {\n switch (assembly) {\n case 'hg19':\n return 'OHJakQICQD6gTD7skx4EWA';\n case 'mm10':\n return 'QDutvmyiSrec5nX4pA5WGQ';\n case 'mm9':\n return 'GUm5aBiLRCyz2PsBea7Yzg';\n case 'hg38':\n default:\n return 'P0PLbQMwTYGy-5uPIQid7A';\n }\n}\n\n/**\n * Calculate cumulative interval of each chromosome.\n */\nexport function getChromInterval(chromSize: { [k: string]: number }) {\n const interval: { [k: string]: [number, number] } = {};\n\n Object.keys(chromSize).reduce((sum, k) => {\n interval[k] = [sum, sum + chromSize[k]];\n return sum + chromSize[k];\n }, 0);\n\n return interval;\n}\n\n/**\n * Calculate total size of entire chromosomes.\n */\nexport function getChromTotalSize(chromSize: { [k: string]: number }) {\n return Object.values(chromSize).reduce((sum, current) => sum + current, 0);\n}\n\nexport function parseGenomicPosition(position: string): { chromosome: string; start?: number; end?: number } {\n const [chromosome, intervalString] = position.split(':');\n if (intervalString) {\n const [start, end] = intervalString.split('-').map(s => +s.replace(/,/g, ''));\n // only return if both are valid\n if (!Number.isNaN(start) && !Number.isNaN(end)) {\n return { chromosome, start, end };\n }\n }\n return { chromosome };\n}\n\n/**\n * A class that consistently manage and convert genomics positions.\n */\nexport class GenomicPositionHelper {\n constructor(public chromosome: string, public start?: number, public end?: number) {}\n static fromString(str: string) {\n const result = parseGenomicPosition(str);\n return new GenomicPositionHelper(result.chromosome, result.start, result.end);\n }\n toAbsoluteCoordinates(assembly?: Assembly, padding = 0): [number, number] {\n const info = computeChromSizes(assembly);\n const size = info.size[this.chromosome];\n const interval = info.interval[this.chromosome];\n if (size === undefined || interval === undefined) {\n throw new Error(`Chromosome name ${this.chromosome} is not valid`);\n }\n let { start, end } = this;\n if (start === undefined || end === undefined) {\n // if only a chromosome name is specified, set to the extent of the chromosome\n [start, end] = [1, size];\n }\n const offset = interval[0];\n return [start + offset - padding, end + offset + padding];\n }\n}\n","import { bisector } from 'd3-array';\nimport { RemoteFile as _RemoteFile } from 'generic-filehandle';\n\nimport type * as HiGlass from '@higlass/types';\nimport type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema';\n\nexport type CommonDataConfig = {\n assembly: Assembly;\n x?: string;\n xe?: string;\n x1?: string;\n x1e?: string;\n urlFetchOptions?: RequestInit;\n};\n\nexport class DataSource {\n chromInfo: ExtendedChromInfo;\n tilesetInfo: ReturnType;\n\n constructor(public file: File, chromSizes: ChromSizes, public options: Options) {\n this.chromInfo = sizesToChromInfo(chromSizes);\n this.tilesetInfo = tilesetInfoFromChromInfo(this.chromInfo);\n }\n}\n\n/**\n * Filter data before sending to a track considering the visible genomic area in the track.\n * TODO(2022-Jul-13): Consider genomic `y` channels as well.\n */\nexport function filterUsingGenoPos(\n data: Datum[],\n [minX, maxX]: [number, number],\n config: Omit\n) {\n const { x, xe, x1, x1e } = config;\n const definedXFields = [x, xe, x1, x1e].filter(f => f) as string[];\n return data.filter((d: Datum) => {\n if (definedXFields.length === 0) {\n // no filter applies\n return true;\n } else if (definedXFields.length === 1) {\n // filter based on one genomic position\n const value = +d[definedXFields[0]];\n return typeof value === 'number' && minX < value && value <= maxX;\n } else {\n // filter based on two genomic positions, i.e., check overlaps\n const values = definedXFields.map(f => +d[f]).filter(v => !isNaN(v));\n const minValue = Math.min(...values);\n const maxValue = Math.max(...values);\n return minX <= maxValue && minValue <= maxX;\n }\n });\n}\n\nconst chromInfoBisector = bisector((d: { pos: number }) => d.pos).left;\n\nconst chrToAbs = (chrom: string, chromPos: number, chromInfo: HiGlass.ChromInfo) =>\n chromInfo.chrPositions[chrom].pos + chromPos;\n\nconst absToChr = (absPosition: number, chromInfo: HiGlass.ChromInfo) => {\n if (!chromInfo || !chromInfo.cumPositions || !chromInfo.cumPositions.length) {\n return null;\n }\n\n let insertPoint = chromInfoBisector(chromInfo.cumPositions, absPosition);\n const lastChr = chromInfo.cumPositions[chromInfo.cumPositions.length - 1].chr;\n const lastLength = chromInfo.chromLengths[lastChr];\n\n // @ts-expect-error\n insertPoint -= insertPoint > 0 && 1;\n\n let chrPosition = Math.floor(absPosition - chromInfo.cumPositions[insertPoint].pos);\n let offset = 0;\n\n if (chrPosition < 0) {\n // before the start of the genome\n offset = chrPosition - 1;\n chrPosition = 1;\n }\n\n if (insertPoint === chromInfo.cumPositions.length - 1 && chrPosition > lastLength) {\n // beyond the last chromosome\n offset = chrPosition - lastLength;\n chrPosition = lastLength;\n }\n\n return [chromInfo.cumPositions[insertPoint].chr, chrPosition, offset, insertPoint] as const;\n};\n\n/**\n * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`.\n * @param chrName A chromosome name to be sanitized\n * @param assembly A genome assembly of the data\n * @param chromosomePrefix A prefix string that can be replaced to 'chr'\n * @returns\n */\nexport function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string) {\n if (Array.isArray(assembly)) {\n // this is a custom assembly, so use this as is\n return chrName;\n }\n\n // For assemblies in Gosling, we use the `chr` prefix consistently\n if (chromosomePrefix) {\n // `hs1` --> `chr1`\n chrName = chrName.replace(chromosomePrefix, 'chr');\n } else if (!chrName.includes('chr')) {\n // `1` --> `chr1`\n chrName = `chr${chrName}`;\n }\n return chrName;\n}\n\nexport type ExtendedChromInfo = HiGlass.ChromInfo & {\n absToChr(absPos: number): ReturnType | null;\n chrToAbs(chr: [name: string, pos: number]): number | null;\n};\n\nexport function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize = 1024) {\n return {\n tile_size: tileSize,\n bins_per_dimension: tileSize,\n max_zoom: Math.ceil(Math.log(chromInfo.totalLength / tileSize) / Math.log(2)),\n max_width: chromInfo.totalLength,\n min_pos: [0],\n max_pos: [chromInfo.totalLength]\n };\n}\n\nexport function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo {\n const info: HiGlass.ChromInfo = {\n cumPositions: [],\n chromLengths: {},\n chrPositions: {},\n totalLength: 0\n };\n\n sizes.forEach(([chr, length], i) => {\n const chrPosition = { id: i, chr, pos: info.totalLength };\n info.chrPositions[chr] = chrPosition;\n info.chromLengths[chr] = length;\n info.cumPositions.push(chrPosition);\n info.totalLength += length;\n });\n\n return {\n ...info,\n absToChr: absPos => (info.chrPositions ? absToChr(absPos, info) : null),\n chrToAbs: ([chrName, chrPos]) => (info.chrPositions ? chrToAbs(chrName, chrPos, info) : null)\n };\n}\n\nexport class RemoteFile extends _RemoteFile {\n // Overrides `read` to eagerly read 200 or 206 response\n // from https://github.com/GMOD/generic-filehandle/blob/0e8209be25e3097307bd15e964edd8c017e808d7/src/remoteFile.ts#L100-L162\n public read: _RemoteFile['read'] = async (\n buffer,\n offset = 0,\n length,\n position = 0,\n opts = {}\n ): Promise<{ bytesRead: number; buffer: Buffer }> => {\n const { headers = {}, signal, overrides = {} } = opts;\n\n if (length < Infinity) {\n headers.range = `bytes=${position}-${position + length}`;\n } else if (length === Infinity && position !== 0) {\n headers.range = `bytes=${position}-`;\n }\n const args = {\n // @ts-expect-error private property\n ...this.baseOverrides,\n ...overrides,\n headers: {\n ...headers,\n ...overrides.headers,\n // @ts-expect-error private property\n ...this.baseOverrides.headers\n },\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n signal\n };\n const response = await this.fetch(this.url, args);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} ${response.statusText} ${this.url}`);\n }\n\n // Just read the response if it was successful.\n if (response.status === 200 || response.status === 206) {\n // @ts-expect-error private method\n const responseData = await this.getBufferFromResponse(response);\n const bytesCopied = responseData.copy(buffer, offset, 0, Math.min(length, responseData.length));\n\n // try to parse out the size of the remote file\n const res = response.headers.get('content-range');\n const sizeMatch = /\\/(\\d+)$/.exec(res || '');\n if (sizeMatch && sizeMatch[1]) {\n // @ts-expect-error private property\n this._stat = { size: parseInt(sizeMatch[1], 10) };\n }\n\n return { bytesRead: bytesCopied, buffer };\n }\n\n // TODO: try harder here to gather more information about what the problem is\n throw new Error(`HTTP ${response.status} fetching ${this.url}`);\n };\n}\n\nexport interface TabularDataFetcher {\n getTabularData(tileIds: string[]): Promise;\n MAX_TILE_WIDTH?: number;\n}\n"],"names":["max","data","color","_a","_b","d3max","d3min","_c","_d","_f","_e","_h","_g","x1","d","title","labelTextStyle","t","type","global","this","exports","HEXDIG$$","PCT_ENCODED$","UNRESERVED$$","ucs2encode","basicToDigit","digitToBasic","adapt","decode","encode","toUnicode","toASCII","decodeUnreserved","base","resolve","uri","equal","parse","serialize","UUID","ucs2length","util","toHash","require$$0","require$$1","IDENTIFIER","rules","JSON_POINTER","RELATIVE_JSON_POINTER","SchemaObject","traverse","jsonSchemaTraverseModule","URI","require$$2","require$$3","require$$4","compile","ref","self","ValidationError","MissingRefError","validate","$id","$schema","$rulesGroup","$rule","errorClasses","stableStringify","require$$5","formats","localRefs","baseId","customRuleCode","v","refVal","schema","keyword","validateSchema","Cache","cacheModule","URL","$sch","properties","required","require$$7","require$$9","require$$11","require$$12","require$$13","require$$14","require$$19","require$$21","require$$23","KEYWORDS","group","metaSchema","dataType","definition","i","require$$6","require$$8","require$$10","regex","format","_RemoteFile"],"mappings":";;;;;;;;;;;;;;AAMO,MAAM,2CAA2C;AAGjD,MAAM,8BAA8B;AACpC,MAAM,6BAA6B;AACnC,MAAM,wBAAwB;AAG9B,MAAM,uBAAuB;AAG7B,MAAM,4BAA4B;AAGlC,MAAM,gCAAgC;AAGtC,MAAM,uBAAuB;AChB9B,MAAA,aAAa,CAAC,aAAqB;AACjC,MAAA,IAAI,MAAM,QAAQ;AAEtB,MAAI,CAAC,GAAG;AACJ,QAAI,MAAM,oBAAoB;AAAA,EAClC;AAEM,QAAA,MAAM,KAAK,MAAM,QAAQ,CAAC,EAAE,MAAM,IAAI,K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AAK,IAAI,QAAQ,aAAa,MAAM,CAAC;AAG9F,cAAM,MAAM,SAAS,QAAQ,IAAI,eAAe;AAChD,cAAM,YAAY,WAAW,KAAK,OAAO,EAAE;AACvC,YAAA,aAAa,UAAU,CAAC,GAAG;AAEtB,eAAA,QAAQ,EAAE,MAAM,SAAS,UAAU,CAAC,GAAG,EAAE;QAClD;AAEO,eAAA,EAAE,WAAW,aAAa;MACrC;AAGM,YAAA,IAAI,MAAM,QAAQ,SAAS,MAAM,aAAa,KAAK,GAAG,EAAE;AAAA,IAAA;AAAA;AAEtE;","x_google_ignoreList":[25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]} \ No newline at end of file diff --git a/dist/favicon.ico b/dist/favicon.ico deleted file mode 100644 index 25998e805bf746eae340ffa3addbc253b45bad0b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2055 zcmb7Fdo&Xa8{ab5A%riNw5{2+l+YUuZyVcZE4;>(#bzr?lgzDLMvZ;$xhCY2n#){1 zVMK1da(Po(ujGA|=R4mYzvp+(^E~JL&iS3^Ilp*E2U{ftZ3O@T zphP6#oOapsZ^+5)R@Ou&d6(o_1WF(Pu&48H0Nv8^!2p2lQz8ya4#`_^f0K9!ufC{3 zxlD()BK_WfGaCM8lr7e69oCa(911ZLw}4~=mS;jpe%*;kMy;Nerz!HhBjKQQyB!_- z`t@-BYlIe~VQQ@{-OM-4DZgqy61;{r&ViP-ls}%|T70U{Wf`uI|ME)O$kjT#UG2Hz zJ(bJV+~d*uTrETBYq~r`=B%9Q{~kR)Z;&i8PfmPn`{m|LapkXV1>?u}dIuao;SR;k zPE1VftpR@B_<60ym95WRQhMna1e%?l9eX_Vc>s}fMezO-6elWD{3qhhXH4`^hDc4{5bt3kDfQ&ZfD6_g;_NttM3}Nbl!~1YoUEI)4&l(#;cBZB} zbL`$tl-NrWC)Y-Hhgm8ZmvX*)+#oTkj_0Q5ywd}9|Mxi$ ziA3^D6;Ha)=A}KAY?k?mnDw*|Z4sLf*21>%yuS5LE+m0{^ zjJ`k0@KOSF%jJB#04!Li$M%kK{c=Yc;kK0V8y}8rY^jPL1)XTN**9R<%C!qWI$Zq( zv8R@RY1J5&yE~^NwL*wW4jR!PrQN#{rzpF&bL?MB`PVb|6gp2Fy7;{g(~u>-mGgj^ zX9T;W+&sUmDujmL3ew9idVipNtq5h^th6gD^@qRs@KTzb733;z5|w0t)_N-lj2HAd zt~YiHZyeo=m`L4L;u0iYT=7}oV~CAKpDEsv#X}@fOZ%bG0IlWPxbuMuy&ut*`&LKb z-J%(o+3$ySTxUX(NCJ!126o+XJN!H&jh~I1679jor}&}s&Bx**Z|u67gA`iN;QXa+2Oz)gAm{k?V1h7i+pukIC27`5|w$d44l)OjFNyJz7EyY_iDz{$RnM5ow8*4_WR0ZBi&~Hm)3V!z9>?m4_ zafJQbZQ$}E*;km0@Ikrk50+CuczHW7b-id1K!WX4i8%$bV%~@iI~dbbs9;U!q!^!( zRg=NXL;MpmHcp>2}e_m#zyebk%c84N&nmbbpkNb%Lv2kMZ2C%Q>z&eiIm)59VBk*xYK7fN*`T~_|lRpnCp7FUypC=#~E+%}|bAo<>9PhKk9 sI9I3C8AnIxa{jN#`!7L>+&zDzqP|m?y+AkHcat4J#5>@stm#pI0h-RiGXMYp diff --git a/dist/gosling.js b/dist/gosling.js deleted file mode 100644 index 7e7e5ab8..00000000 --- a/dist/gosling.js +++ /dev/null @@ -1,26774 +0,0 @@ -var __defProp = Object.defineProperty; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __publicField = (obj, key, value) => { - __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); - return value; -}; -var __accessCheck = (obj, member, msg) => { - if (!member.has(obj)) - throw TypeError("Cannot " + msg); -}; -var __privateGet = (obj, member, getter) => { - __accessCheck(obj, member, "read from private field"); - return getter ? getter.call(obj) : member.get(obj); -}; -var __privateAdd = (obj, member, value) => { - if (member.has(obj)) - throw TypeError("Cannot add the same private member more than once"); - member instanceof WeakSet ? member.add(obj) : member.set(obj, value); -}; -var __privateSet = (obj, member, value, setter) => { - __accessCheck(obj, member, "write to private field"); - setter ? setter.call(obj, value) : member.set(obj, value); - return value; -}; -var __privateMethod = (obj, member, method) => { - __accessCheck(obj, member, "access private method"); - return method; -}; -var _dataPromise, _chromSizes, _parsedData, _assembly, _filter, _file, _fetchCsv, fetchCsv_fn, _processCsvRow, processCsvRow_fn, _calcCumulativePos, calcCumulativePos_fn, _generateTilesetInfo, generateTilesetInfo_fn, _tile, tile_fn, _generateChomSizeInfo, generateChomSizeInfo_fn, _table; -import * as PIXI from "pixi.js"; -import "d3-color"; -import { group, min, sum, max } from "d3-array"; -import "bezier-js"; -import { scaleLinear, scaleSequential, scaleOrdinal, scaleBand } from "d3-scale"; -import { sampleSize, isEqual, uniqBy, cloneDeepWith } from "lodash-es"; -import { interpolateViridis } from "d3-scale-chromatic"; -import { A as Ajv, I as IsChannelDeep, r as resolveSuperposedTracks, t as traverseTracks, a as IsTemplateTrack, g as getTextStyle, c as computeChromSizes, b as cartesianToPolar, u as uuid, R as RADIAN_GAP, v as valueToRadian, p as pointsToDegree, d as commonjsGlobal, e as RemoteFile, f as IsOneOfFilter, h as IsRangeFilter, i as IsIncludeFilter, j as getChannelKeysByAggregateFnc, k as getChannelKeysByType, s as sanitizeChrName, l as filterUsingGenoPos, m as IsDataDeepTileset, n as IsDomainChr, o as IsDomainInterval, q as IsDomainChrInterval, S as SUPPORTED_CHANNELS, w as insertItemToArray, x as getAutoCompleteId, y as IsChannelValue, z as getValueUsingChannel, B as rectProperty, C as pointProperty, D as barProperty, E as IsStackedChannel, F as IsDomainArray, P as PREDEFINED_COLOR_STR_MAP, G as IsRangeArray, H as Is2DTrack, J as isTabularDataFetcher, K as drawPreEmbellishment, L as drawMark, M as drawPostEmbellishment, N as getRelativeGenomicPosition, O as hasDataTransform, Q as IsXAxis, T as IsMouseEventsDeep, U as colorToHex, V as flatArrayToPairArray, W as DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM, X as traverseTracksAndViews, Y as traverseViewArrangements, Z as DEFAULT_VIEW_SPACING, _ as DEFAULT_INNER_RADIUS_PROP, $ as IsDummyTrack, a0 as IsOverlaidTrack, a1 as IsYAxis, a2 as DEFAULT_CIRCULAR_VIEW_PADDING, a3 as IsDataDeep, a4 as IsHiGlassMatrix, a5 as getHiGlassColorRange, a6 as DEFAULT_TEXT_STYLE, a7 as overrideDataTemplates, a8 as traverseToFixSpecDownstream, a9 as GenomicPositionHelper, aa as isObject } from "./exported-utils-c80467e4.js"; -import higlassRegister from "higlass-register"; -import { TextTrack } from "higlass-text"; -import RBush from "rbush"; -import { precisionPrefix, format, formatPrefix } from "d3-format"; -import { arc } from "d3-shape"; -import { createNanoEvents } from "nanoevents"; -import { spawn } from "threads"; -import { Buffer as Buffer2 } from "buffer"; -import QuickLRU from "quick-lru"; -import { RemoteFile as RemoteFile$1, LocalFile } from "generic-filehandle"; -import { dsvFormat } from "d3-dsv"; -import PubSub$1 from "pubsub-js"; -import React, { forwardRef, useState, useEffect, useMemo, useRef, useImperativeHandle, useCallback } from "react"; -import require$$0 from "react-dom"; -import { HiGlassComponent } from "higlass"; -import { ResizeSensor } from "css-element-queries"; -const name = "gosling.js"; -const version = "0.14.0"; -const $ref$2 = "#/definitions/GoslingSpec"; -const $schema$2 = "http://json-schema.org/draft-07/schema#"; -const definitions$2 = { - Aggregate: { - "enum": [ - "max", - "min", - "mean", - "bin", - "count" - ], - type: "string" - }, - Assembly: { - anyOf: [ - { - "const": "hg38", - type: "string" - }, - { - "const": "hg19", - type: "string" - }, - { - "const": "hg18", - type: "string" - }, - { - "const": "hg17", - type: "string" - }, - { - "const": "hg16", - type: "string" - }, - { - "const": "mm10", - type: "string" - }, - { - "const": "mm9", - type: "string" - }, - { - "const": "unknown", - type: "string" - }, - { - $ref: "#/definitions/ChromSizes" - } - ] - }, - AxisPosition: { - "enum": [ - "none", - "top", - "bottom", - "left", - "right" - ], - type: "string" - }, - BamData: { - additionalProperties: false, - description: "Binary Alignment Map (BAM) is the comprehensive raw data of genome sequencing; it consists of the lossless, compressed binary representation of the Sequence Alignment Map-files.", - properties: { - extractJunction: { - description: "Determine whether to extract exon-to-exon junctions. __Default__: `false`", - type: "boolean" - }, - indexUrl: { - description: "URL link to the index file of the BAM file", - type: "string" - }, - junctionMinCoverage: { - description: "Determine the threshold of coverage when extracting exon-to-exon junctions. __Default__: `1`", - type: "number" - }, - loadMates: { - description: "Load mates that are located in the same chromosome. __Default__: `false`", - type: "boolean" - }, - maxInsertSize: { - description: "Determines the threshold of insert sizes for determining the structural variants. __Default__: `5000`", - type: "number" - }, - type: { - "const": "bam", - type: "string" - }, - url: { - description: "URL link to the BAM data file", - type: "string" - } - }, - required: [ - "type", - "url", - "indexUrl" - ], - type: "object" - }, - BedData: { - additionalProperties: false, - description: "BED file format", - properties: { - customFields: { - description: "An array of strings, where each string is the name of a non-standard field in the BED file. If there are `n` custom fields, we assume that the last `n` columns of the BED file correspond to the custom fields.", - items: { - type: "string" - }, - type: "array" - }, - indexUrl: { - description: "Specify the URL address of the data file index.", - type: "string" - }, - sampleLength: { - description: "Specify the number of rows loaded from the URL.\n\n__Default:__ `1000`", - type: "number" - }, - type: { - "const": "bed", - type: "string" - }, - url: { - description: "Specify the URL address of the data file.", - type: "string" - } - }, - required: [ - "type", - "url", - "indexUrl" - ], - type: "object" - }, - BeddbData: { - additionalProperties: false, - description: "Regular BED or similar files can be pre-aggregated for the scalable data exploration. Find our more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#bed-files).", - properties: { - exonIntervalFields: { - description: "experimental", - items: [ - { - additionalProperties: false, - properties: { - index: { - type: "number" - }, - name: { - type: "string" - } - }, - required: [ - "index", - "name" - ], - type: "object" - }, - { - additionalProperties: false, - properties: { - index: { - type: "number" - }, - name: { - type: "string" - } - }, - required: [ - "index", - "name" - ], - type: "object" - } - ], - maxItems: 2, - minItems: 2, - type: "array" - }, - genomicFields: { - description: "Specify the name of genomic data fields.", - items: { - additionalProperties: false, - properties: { - index: { - type: "number" - }, - name: { - type: "string" - } - }, - required: [ - "index", - "name" - ], - type: "object" - }, - type: "array" - }, - type: { - "const": "beddb", - type: "string" - }, - url: { - description: "Specify the URL address of the data file.", - type: "string" - }, - valueFields: { - description: "Specify the column indexes, field names, and field types.", - items: { - additionalProperties: false, - properties: { - index: { - type: "number" - }, - name: { - type: "string" - }, - type: { - "enum": [ - "nominal", - "quantitative" - ], - type: "string" - } - }, - required: [ - "index", - "name", - "type" - ], - type: "object" - }, - type: "array" - } - }, - required: [ - "type", - "url", - "genomicFields" - ], - type: "object" - }, - BigWigData: { - additionalProperties: false, - properties: { - aggregation: { - $ref: "#/definitions/BinAggregate", - description: 'Determine aggregation function to apply within bins. __Default__: `"mean"`' - }, - binSize: { - description: "Binning the genomic interval in tiles (unit size: 256).", - type: "number" - }, - column: { - description: 'Assign a field name of the middle position of genomic intervals. __Default__: `"position"`', - type: "string" - }, - end: { - description: 'Assign a field name of the end position of genomic intervals. __Default__: `"end"`', - type: "string" - }, - start: { - description: 'Assign a field name of the start position of genomic intervals. __Default__: `"start"`', - type: "string" - }, - type: { - "const": "bigwig", - type: "string" - }, - url: { - description: "Specify the URL address of the data file.", - type: "string" - }, - value: { - description: 'Assign a field name of quantitative values. __Default__: `"value"`', - type: "string" - } - }, - required: [ - "type", - "url" - ], - type: "object" - }, - BinAggregate: { - "enum": [ - "mean", - "sum" - ], - type: "string" - }, - Channel: { - anyOf: [ - { - $ref: "#/definitions/ChannelDeep" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - ChannelDeep: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/Text" - } - ] - }, - ChannelValue: { - additionalProperties: false, - properties: { - value: { - description: "Assign a constant value for a visual channel.", - type: [ - "number", - "string" - ] - } - }, - required: [ - "value" - ], - type: "object" - }, - ChromSizes: { - description: 'Custom chromosome sizes, e.g., [["foo", 1000], ["bar", 300], ["baz", 240]]', - items: { - items: [ - { - type: "string" - }, - { - type: "number" - } - ], - maxItems: 2, - minItems: 2, - type: "array" - }, - type: "array" - }, - Color: { - additionalProperties: false, - properties: { - domain: { - $ref: "#/definitions/ValueExtent", - description: "Values of the data" - }, - field: { - description: "Name of the data field", - type: "string" - }, - legend: { - description: "Whether to display legend. __Default__: `false`", - type: "boolean" - }, - range: { - $ref: "#/definitions/Range", - description: "Determine the colors that should be bound to data value. Default properties are determined considering the field type." - }, - scale: { - "enum": [ - "linear", - "log" - ], - type: "string" - }, - scaleOffset: { - description: "Whether to use offset of the domain proportionally. This is bound to brushes on the color legend. __Default__: `[0, 1]`", - items: { - type: "number" - }, - maxItems: 2, - minItems: 2, - type: "array" - }, - title: { - description: "Title of the legend. __Default__: `undefined`", - type: "string" - }, - type: { - description: "Specify the data type", - "enum": [ - "quantitative", - "nominal" - ], - type: "string" - } - }, - type: "object" - }, - CoverageTransform: { - additionalProperties: false, - description: "Aggregate rows and calculate coverage", - properties: { - endField: { - type: "string" - }, - groupField: { - description: "The name of a nominal field to group rows by in prior to piling-up", - type: "string" - }, - newField: { - type: "string" - }, - startField: { - type: "string" - }, - type: { - "const": "coverage", - type: "string" - } - }, - required: [ - "type", - "startField", - "endField" - ], - type: "object" - }, - CsvData: { - additionalProperties: false, - description: 'Any small enough tabular data files, such as tsv, csv, BED, BEDPE, and GFF, can be loaded using "csv" data specification.', - properties: { - chromosomeField: { - description: "Specify the name of chromosome data fields.", - type: "string" - }, - chromosomePrefix: { - description: 'Specify the chromosome prefix if chromosomes are denoted using a prefix besides "chr" or a number', - type: "string" - }, - genomicFields: { - description: "Specify the name of genomic data fields.", - items: { - type: "string" - }, - type: "array" - }, - genomicFieldsToConvert: { - description: "experimental", - items: { - additionalProperties: false, - properties: { - chromosomeField: { - type: "string" - }, - genomicFields: { - items: { - type: "string" - }, - type: "array" - } - }, - required: [ - "chromosomeField", - "genomicFields" - ], - type: "object" - }, - type: "array" - }, - headerNames: { - description: "Specify the names of data fields if a CSV file does not contain a header.", - items: { - type: "string" - }, - type: "array" - }, - longToWideId: { - description: "experimental", - type: "string" - }, - sampleLength: { - description: "Specify the number of rows loaded from the URL.\n\n__Default:__ `1000`", - type: "number" - }, - separator: { - description: "Specify file separator, __Default:__ ','", - type: "string" - }, - type: { - "const": "csv", - type: "string" - }, - url: { - description: "Specify the URL address of the data file.", - type: "string" - } - }, - required: [ - "type", - "url" - ], - type: "object" - }, - DataDeep: { - anyOf: [ - { - $ref: "#/definitions/JsonData" - }, - { - $ref: "#/definitions/CsvData" - }, - { - $ref: "#/definitions/BedData" - }, - { - $ref: "#/definitions/BigWigData" - }, - { - $ref: "#/definitions/MultivecData" - }, - { - $ref: "#/definitions/BeddbData" - }, - { - $ref: "#/definitions/VectorData" - }, - { - $ref: "#/definitions/MatrixData" - }, - { - $ref: "#/definitions/BamData" - }, - { - $ref: "#/definitions/VcfData" - }, - { - $ref: "#/definitions/GffData" - } - ] - }, - DataTrack: { - additionalProperties: false, - description: "Partial specification of `BasicSingleTrack` to use default visual encoding predefined by data type.", - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - data: { - $ref: "#/definitions/DataDeep" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "data" - ], - type: "object" - }, - DataTransform: { - anyOf: [ - { - $ref: "#/definitions/FilterTransform" - }, - { - $ref: "#/definitions/StrConcatTransform" - }, - { - $ref: "#/definitions/StrReplaceTransform" - }, - { - $ref: "#/definitions/LogTransform" - }, - { - $ref: "#/definitions/DisplaceTransform" - }, - { - $ref: "#/definitions/ExonSplitTransform" - }, - { - $ref: "#/definitions/GenomicLengthTransform" - }, - { - $ref: "#/definitions/SvTypeTransform" - }, - { - $ref: "#/definitions/CoverageTransform" - }, - { - $ref: "#/definitions/JsonParseTransform" - } - ] - }, - Datum: { - additionalProperties: { - type: [ - "number", - "string" - ] - }, - description: "Values in the form of JSON.", - type: "object" - }, - DisplaceTransform: { - additionalProperties: false, - properties: { - boundingBox: { - additionalProperties: false, - properties: { - endField: { - description: "The name of a quantitative field that represents the end position.", - type: "string" - }, - groupField: { - description: "The name of a nominal field to group rows by in prior to piling-up.", - type: "string" - }, - isPaddingBP: { - description: "Whether to consider `padding` as the bp length.", - type: "boolean" - }, - padding: { - description: "The padding around visual lements. Either px or bp", - type: "number" - }, - startField: { - description: "The name of a quantitative field that represents the start position.", - type: "string" - } - }, - required: [ - "startField", - "endField" - ], - type: "object" - }, - maxRows: { - description: "Specify maximum rows to be generated (default has no limit).", - type: "number" - }, - method: { - $ref: "#/definitions/DisplacementType", - description: "A string that specifies the type of displacement." - }, - newField: { - type: "string" - }, - type: { - "const": "displace", - type: "string" - } - }, - required: [ - "type", - "boundingBox", - "method", - "newField" - ], - type: "object" - }, - Displacement: { - additionalProperties: false, - properties: { - padding: { - type: "number" - }, - type: { - $ref: "#/definitions/DisplacementType" - } - }, - required: [ - "type" - ], - type: "object" - }, - DisplacementType: { - "enum": [ - "pile", - "spread" - ], - type: "string" - }, - DomainChr: { - additionalProperties: false, - properties: { - chromosome: { - type: "string" - } - }, - required: [ - "chromosome" - ], - type: "object" - }, - DomainChrInterval: { - additionalProperties: false, - properties: { - chromosome: { - description: "If specified, only showing a certain interval in a chromosome.", - type: "string" - }, - interval: { - items: { - type: "number" - }, - maxItems: 2, - minItems: 2, - type: "array" - } - }, - required: [ - "chromosome", - "interval" - ], - type: "object" - }, - DomainInterval: { - additionalProperties: false, - properties: { - interval: { - description: "Show a certain interval within entire chromosome", - items: { - type: "number" - }, - maxItems: 2, - minItems: 2, - type: "array" - } - }, - required: [ - "interval" - ], - type: "object" - }, - DummyTrack: { - additionalProperties: false, - description: "A placeholder track. In contrast to other tracks, this track does not display any data. Instead it provides empty space for third party tools to display their data on top of.", - properties: { - _invalidTrack: { - description: "internal", - type: "boolean" - }, - assembly: { - "const": "unknown", - description: "No assemblies can be associated with a dummy track", - type: "string" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", - type: "string" - }, - layout: { - "const": "linear", - description: "Only linear layout are supported at this time", - type: "string" - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - "static": { - "const": true, - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - style: { - $ref: "#/definitions/DummyTrackStyle", - description: "Defines how the track is styled" - }, - title: { - description: "Text that gets shown on the DummyTrack", - type: "string" - }, - type: { - "const": "dummy-track", - description: "Used to specify the dummy track", - type: "string" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - zoomLimits: { - description: "Unused property for DummyTrack", - items: { - type: "null" - }, - maxItems: 2, - minItems: 2, - type: "array" - } - }, - required: [ - "type" - ], - type: "object" - }, - DummyTrackStyle: { - additionalProperties: false, - properties: { - background: { - description: "Background color of the track", - type: "string" - }, - outline: { - description: "Color of the outline of the track", - type: "string" - }, - textFontSize: { - description: "Specify the font size of the title", - type: "number" - }, - textFontWeight: { - description: "Specify the font weight of the title.", - "enum": [ - "bold", - "normal" - ], - type: "string" - }, - textStroke: { - description: "Specify the stroke color of title.", - type: "string" - }, - textStrokeWidth: { - description: "Specify the stroke width of the title.", - type: "number" - } - }, - type: "object" - }, - EventStyle: { - additionalProperties: false, - description: "The styles defined here will be applied to the target marks of mouse events, such as a point mark after the user clicks on it.", - properties: { - arrange: { - description: "Show event effects behind or in front of marks.", - "enum": [ - "behind", - "front" - ], - type: "string" - }, - color: { - description: "color of the marks when mouse events are triggered", - type: "string" - }, - opacity: { - description: "opacity of the marks when mouse events are triggered", - type: "number" - }, - stroke: { - description: "stroke color of the marks when mouse events are triggered", - type: "string" - }, - strokeOpacity: { - type: "number" - }, - strokeWidth: { - description: "stroke width of the marks when mouse events are triggered", - type: "number" - } - }, - type: "object" - }, - ExonSplitTransform: { - additionalProperties: false, - properties: { - fields: { - items: { - additionalProperties: false, - properties: { - chrField: { - type: "string" - }, - field: { - type: "string" - }, - newField: { - type: "string" - }, - type: { - $ref: "#/definitions/FieldType" - } - }, - required: [ - "field", - "type", - "newField", - "chrField" - ], - type: "object" - }, - type: "array" - }, - flag: { - additionalProperties: false, - properties: { - field: { - type: "string" - }, - value: { - type: [ - "number", - "string" - ] - } - }, - required: [ - "field", - "value" - ], - type: "object" - }, - separator: { - type: "string" - }, - type: { - "const": "exonSplit", - type: "string" - } - }, - required: [ - "type", - "separator", - "flag", - "fields" - ], - type: "object" - }, - FieldType: { - "enum": [ - "genomic", - "nominal", - "quantitative" - ], - type: "string" - }, - FilterTransform: { - anyOf: [ - { - $ref: "#/definitions/OneOfFilter" - }, - { - $ref: "#/definitions/RangeFilter" - }, - { - $ref: "#/definitions/IncludeFilter" - } - ] - }, - GenomicDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ] - }, - GenomicLengthTransform: { - additionalProperties: false, - description: "Calculate genomic length using two genomic fields", - properties: { - endField: { - type: "string" - }, - newField: { - type: "string" - }, - startField: { - type: "string" - }, - type: { - "const": "genomicLength", - type: "string" - } - }, - required: [ - "type", - "startField", - "endField", - "newField" - ], - type: "object" - }, - GffData: { - additionalProperties: false, - description: "Generic Feature Format Version 3 (GFF3) format data. It parses files that follow the [GFF3 specification](https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md).", - properties: { - attributesToFields: { - description: 'Specifies which attributes to include as a fields. GFF files have an "attributes" column which contains a list of attributes which are each tag-value pairs (`tag=value`). This option allows for specific attributes to be accessible as a field. For example, if you have an attribute called "gene_name" and you want label features on your track using those values, you can use this option so that you can use `"field": "gene_name"` in the schema.\n\nIf there is a single `value` corresponding to the `tag`, Gosling will parse that value as a string. If there are multiple `value`s corresponding to a `tag`, Gosling will parse it as a comma-separated list string. If a feature does not have a particular attribute, then the attribute value will be set to the `defaultValue`.', - items: { - additionalProperties: false, - properties: { - attribute: { - type: "string" - }, - defaultValue: { - type: "string" - } - }, - required: [ - "attribute", - "defaultValue" - ], - type: "object" - }, - type: "array" - }, - indexUrl: { - description: "URL link to the tabix index file", - type: "string" - }, - sampleLength: { - description: "The maximum number of samples to be shown on the track. Samples are uniformly randomly selected so that this threshold is not exceeded. __Default:__ `1000`", - type: "number" - }, - type: { - "const": "gff", - type: "string" - }, - url: { - description: "URL link to the GFF file", - type: "string" - } - }, - required: [ - "type", - "url", - "indexUrl" - ], - type: "object" - }, - GoslingSpec: { - anyOf: [ - { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - alignment: { - "const": "overlay", - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - description: { - type: "string" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - responsiveSize: { - $ref: "#/definitions/ResponsiveSize", - description: "Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false`" - }, - responsiveSpec: { - items: { - additionalProperties: false, - properties: { - selectivity: { - items: { - $ref: "#/definitions/SelectivityCondition" - }, - type: "array" - }, - spec: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - alignment: { - "enum": [ - "overlay", - "stack" - ], - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - tracks: { - anyOf: [ - { - items: { - $ref: "#/definitions/PartialTrack" - }, - type: "array" - }, - { - items: { - anyOf: [ - { - $ref: "#/definitions/PartialTrack" - }, - { - $ref: "#/definitions/OverlaidTracks" - } - ] - }, - type: "array" - } - ] - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - type: "object" - } - }, - required: [ - "spec", - "selectivity" - ], - type: "object" - }, - type: "array" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - tracks: { - items: { - $ref: "#/definitions/PartialTrack" - }, - type: "array" - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "alignment", - "tracks" - ], - type: "object" - }, - { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - alignment: { - "const": "stack", - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - description: { - type: "string" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - responsiveSize: { - $ref: "#/definitions/ResponsiveSize", - description: "Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false`" - }, - responsiveSpec: { - items: { - additionalProperties: false, - properties: { - selectivity: { - items: { - $ref: "#/definitions/SelectivityCondition" - }, - type: "array" - }, - spec: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - alignment: { - "enum": [ - "overlay", - "stack" - ], - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - tracks: { - anyOf: [ - { - items: { - $ref: "#/definitions/PartialTrack" - }, - type: "array" - }, - { - items: { - anyOf: [ - { - $ref: "#/definitions/PartialTrack" - }, - { - $ref: "#/definitions/OverlaidTracks" - } - ] - }, - type: "array" - } - ] - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - type: "object" - } - }, - required: [ - "spec", - "selectivity" - ], - type: "object" - }, - type: "array" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - tracks: { - items: { - anyOf: [ - { - $ref: "#/definitions/PartialTrack" - }, - { - $ref: "#/definitions/OverlaidTracks" - } - ] - }, - type: "array" - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "tracks" - ], - type: "object" - }, - { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - description: { - type: "string" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - responsiveSize: { - $ref: "#/definitions/ResponsiveSize", - description: "Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false`" - }, - responsiveSpec: { - items: { - additionalProperties: false, - properties: { - selectivity: { - items: { - $ref: "#/definitions/SelectivityCondition" - }, - type: "array" - }, - spec: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - alignment: { - "enum": [ - "overlay", - "stack" - ], - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - tracks: { - anyOf: [ - { - items: { - $ref: "#/definitions/PartialTrack" - }, - type: "array" - }, - { - items: { - anyOf: [ - { - $ref: "#/definitions/PartialTrack" - }, - { - $ref: "#/definitions/OverlaidTracks" - } - ] - }, - type: "array" - } - ] - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - type: "object" - } - }, - required: [ - "spec", - "selectivity" - ], - type: "object" - }, - type: "array" - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - title: { - type: "string" - }, - tracks: { - items: { - $ref: "#/definitions/Track" - }, - type: "array" - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "tracks" - ], - type: "object" - }, - { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - arrangement: { - description: "Specify how multiple views are arranged.", - "enum": [ - "parallel", - "serial", - "horizontal", - "vertical" - ], - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - description: { - type: "string" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - responsiveSize: { - $ref: "#/definitions/ResponsiveSize", - description: "Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false`" - }, - responsiveSpec: { - items: { - additionalProperties: false, - properties: { - selectivity: { - items: { - $ref: "#/definitions/SelectivityCondition" - }, - type: "array" - }, - spec: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - arrangement: { - description: "Specify how multiple views are arranged.", - "enum": [ - "parallel", - "serial", - "horizontal", - "vertical" - ], - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - views: { - description: "An array of view specifications", - items: { - anyOf: [ - { - $ref: "#/definitions/SingleView" - }, - { - $ref: "#/definitions/MultipleViews" - } - ] - }, - type: "array" - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - type: "object" - } - }, - required: [ - "spec", - "selectivity" - ], - type: "object" - }, - type: "array" - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - title: { - type: "string" - }, - views: { - description: "An array of view specifications", - items: { - anyOf: [ - { - $ref: "#/definitions/SingleView" - }, - { - $ref: "#/definitions/MultipleViews" - } - ] - }, - type: "array" - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "views" - ], - type: "object" - } - ] - }, - IncludeFilter: { - additionalProperties: false, - properties: { - field: { - description: "A filter is applied based on the values of the specified data field", - type: "string" - }, - include: { - description: "Check whether the value includes a substring.", - type: "string" - }, - not: { - description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', - type: "boolean" - }, - type: { - "const": "filter", - type: "string" - } - }, - required: [ - "field", - "include", - "type" - ], - type: "object" - }, - JsonData: { - additionalProperties: false, - description: "The JSON data format allows users to include data directly in the Gosling's JSON specification.", - properties: { - chromosomeField: { - description: "Specify the name of chromosome data fields.", - type: "string" - }, - genomicFields: { - description: "Specify the name of genomic data fields.", - items: { - type: "string" - }, - type: "array" - }, - genomicFieldsToConvert: { - description: "experimental", - items: { - additionalProperties: false, - properties: { - chromosomeField: { - type: "string" - }, - genomicFields: { - items: { - type: "string" - }, - type: "array" - } - }, - required: [ - "chromosomeField", - "genomicFields" - ], - type: "object" - }, - type: "array" - }, - sampleLength: { - description: "Specify the number of rows loaded from the URL.\n\n__Default:__ `1000`", - type: "number" - }, - sampleType: { - description: "Specify the way of sampling from the data if the number of rows to show exceeds `sampleLength`.\n\n__Default:__ `random`", - "enum": [ - "first", - "random" - ], - type: "string" - }, - type: { - "const": "json", - description: "Define data type.", - type: "string" - }, - values: { - description: "Values in the form of JSON.", - items: { - $ref: "#/definitions/Datum" - }, - type: "array" - } - }, - required: [ - "type", - "values" - ], - type: "object" - }, - JsonParseTransform: { - additionalProperties: false, - description: "Parse JSON Object Array and append vertically", - properties: { - baseGenomicField: { - description: "Base genomic position when parsing relative position.", - type: "string" - }, - field: { - description: "The field that contains the JSON object array.", - type: "string" - }, - genomicField: { - description: "Relative genomic position to parse.", - type: "string" - }, - genomicLengthField: { - description: "Length of genomic interval.", - type: "string" - }, - type: { - "const": "subjson", - type: "string" - } - }, - required: [ - "type", - "field", - "baseGenomicField", - "genomicField", - "genomicLengthField" - ], - type: "object" - }, - Layout: { - "enum": [ - "linear", - "circular" - ], - type: "string" - }, - LogBase: { - anyOf: [ - { - type: "number" - }, - { - "const": "e", - type: "string" - } - ] - }, - LogTransform: { - additionalProperties: false, - properties: { - base: { - $ref: "#/definitions/LogBase", - description: "If not specified, 10 is used." - }, - field: { - type: "string" - }, - newField: { - description: "If specified, store transformed values in a new field.", - type: "string" - }, - type: { - "const": "log", - type: "string" - } - }, - required: [ - "type", - "field" - ], - type: "object" - }, - LogicalOperation: { - "enum": [ - "less-than", - "lt", - "LT", - "greater-than", - "gt", - "GT", - "less-than-or-equal-to", - "ltet", - "LTET", - "greater-than-or-equal-to", - "gtet", - "GTET" - ], - type: "string" - }, - Mark: { - "enum": [ - "point", - "line", - "area", - "bar", - "rect", - "text", - "withinLink", - "betweenLink", - "rule", - "triangleLeft", - "triangleRight", - "triangleBottom", - "brush", - "header" - ], - type: "string" - }, - MatrixData: { - additionalProperties: false, - properties: { - binSize: { - description: "Determine the number of nearby cells to aggregate. __Default__: `1`", - type: "number" - }, - column: { - description: "The name of the first genomic field. __Default__: `x`", - type: "string" - }, - row: { - description: "The name of the first genomic field. __Default__: `y`", - type: "string" - }, - type: { - "const": "matrix", - type: "string" - }, - url: { - description: "URL link to the matrix data file", - type: "string" - }, - value: { - description: "The name of the value field. __Default__: `value`", - type: "string" - } - }, - required: [ - "type", - "url" - ], - type: "object" - }, - MouseEventsDeep: { - additionalProperties: false, - description: "Options for determining mouse events in detail, e.g., turning on specific events only", - properties: { - click: { - description: "Whether to enable click events.", - type: "boolean" - }, - enableMouseOverOnMultipleMarks: { - description: "Determine whether all marks underneath the mouse point should be affected by mouse over. __Default__: `false`", - type: "boolean" - }, - groupMarksByField: { - description: "Group marks using keys in a data field. This affects how a set of marks are highlighted/selected by interaction. __Default__: `undefined`", - type: "string" - }, - mouseOver: { - description: "Whether to enable mouseover events.", - type: "boolean" - }, - rangeSelect: { - description: "Whether to send range selection events.", - type: "boolean" - } - }, - type: "object" - }, - MultipleViews: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - arrangement: { - description: "Specify how multiple views are arranged.", - "enum": [ - "parallel", - "serial", - "horizontal", - "vertical" - ], - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - views: { - description: "An array of view specifications", - items: { - anyOf: [ - { - $ref: "#/definitions/SingleView" - }, - { - $ref: "#/definitions/MultipleViews" - } - ] - }, - type: "array" - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "views" - ], - type: "object" - }, - MultivecData: { - additionalProperties: false, - description: 'Two-dimensional quantitative values, one axis for genomic coordinate and the other for different samples, can be converted into HiGlass\' `"multivec"` data. For example, multiple BigWig files can be converted into a single multivec file. You can also convert sequence data (FASTA) into this format where rows will be different nucleotide bases (e.g., A, T, G, C) and quantitative values represent the frequency. Find out more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#multivec-files).', - properties: { - aggregation: { - $ref: "#/definitions/BinAggregate", - description: 'Determine aggregation function to apply within bins. __Default__: `"mean"`' - }, - binSize: { - description: "Binning the genomic interval in tiles (unit size: 256).", - type: "number" - }, - categories: { - description: "assign names of individual samples.", - items: { - type: "string" - }, - type: "array" - }, - column: { - description: 'Assign a field name of the middle position of genomic intervals. __Default__: `"position"`', - type: "string" - }, - end: { - description: 'Assign a field name of the end position of genomic intervals. __Default__: `"end"`', - type: "string" - }, - row: { - description: 'Assign a field name of samples. __Default__: `"category"`', - type: "string" - }, - start: { - description: 'Assign a field name of the start position of genomic intervals. __Default__: `"start"`', - type: "string" - }, - type: { - "const": "multivec", - type: "string" - }, - url: { - description: "Specify the URL address of the data file.", - type: "string" - }, - value: { - description: 'Assign a field name of quantitative values. __Default__: `"value"`', - type: "string" - } - }, - required: [ - "type", - "url" - ], - type: "object" - }, - OneOfFilter: { - additionalProperties: false, - properties: { - field: { - description: "A filter is applied based on the values of the specified data field", - type: "string" - }, - not: { - description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', - type: "boolean" - }, - oneOf: { - description: "Check whether the value is an element in the provided list.", - items: { - type: [ - "string", - "number", - "null" - ] - }, - type: "array" - }, - type: { - "const": "filter", - type: "string" - } - }, - required: [ - "field", - "oneOf", - "type" - ], - type: "object" - }, - Opacity: { - additionalProperties: false, - properties: { - domain: { - $ref: "#/definitions/ValueExtent", - description: "Values of the data" - }, - field: { - description: "Name of the data field", - type: "string" - }, - range: { - $ref: "#/definitions/ValueExtent", - description: "Ranges of visual channel values" - }, - type: { - description: "Specify the data type", - "enum": [ - "quantitative", - "nominal" - ], - type: "string" - } - }, - type: "object" - }, - Orientation: { - "enum": [ - "horizontal", - "vertical" - ], - type: "string" - }, - OverlaidTrack: { - additionalProperties: false, - description: "Superposing multiple tracks.", - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _overlay: { - items: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - id: { - description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - type: "object" - }, - type: "array" - }, - _renderingId: { - description: "internal", - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "_overlay" - ], - type: "object" - }, - OverlaidTracks: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - alignment: { - "const": "overlay", - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - tracks: { - items: { - $ref: "#/definitions/PartialTrack" - }, - type: "array" - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "alignment", - "tracks" - ], - type: "object" - }, - PartialTrack: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _overlay: { - items: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - id: { - description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - type: "object" - }, - type: "array" - }, - _renderingId: { - description: "internal", - type: "string" - }, - assembly: { - anyOf: [ - { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - { - "const": "unknown", - description: "No assemblies can be associated with a dummy track", - type: "string" - } - ], - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - encoding: { - additionalProperties: { - $ref: "#/definitions/Channel" - }, - type: "object" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - anyOf: [ - { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - { - "const": "linear", - description: "Only linear layout are supported at this time", - type: "string" - } - ], - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - anyOf: [ - { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - { - "const": true, - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - } - ], - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`." - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - anyOf: [ - { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - { - $ref: "#/definitions/DummyTrackStyle", - description: "Defines how the track is styled" - } - ], - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - template: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - type: { - "const": "dummy-track", - description: "Used to specify the dummy track", - type: "string" - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - anyOf: [ - { - $ref: "#/definitions/ZoomLimits" - }, - { - description: "Unused property for DummyTrack", - items: { - type: "null" - }, - maxItems: 2, - minItems: 2, - type: "array" - } - ] - } - }, - type: "object" - }, - PredefinedColors: { - "enum": [ - "viridis", - "grey", - "spectral", - "warm", - "cividis", - "bupu", - "rdbu", - "hot", - "pink" - ], - type: "string" - }, - Range: { - anyOf: [ - { - $ref: "#/definitions/ValueExtent" - }, - { - $ref: "#/definitions/PredefinedColors" - } - ] - }, - RangeFilter: { - additionalProperties: false, - properties: { - field: { - description: "A filter is applied based on the values of the specified data field", - type: "string" - }, - inRange: { - description: "Check whether the value is in a number range.", - items: { - type: "number" - }, - type: "array" - }, - not: { - description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', - type: "boolean" - }, - type: { - "const": "filter", - type: "string" - } - }, - required: [ - "field", - "inRange", - "type" - ], - type: "object" - }, - ResponsiveSize: { - anyOf: [ - { - type: "boolean" - }, - { - additionalProperties: false, - properties: { - height: { - type: "boolean" - }, - width: { - type: "boolean" - } - }, - type: "object" - } - ] - }, - Row: { - additionalProperties: false, - properties: { - clip: { - description: "Clip row when the actual y value exceeds the max value of the y scale. Used only for bar marks at the moment. __Default__: `true`", - type: "boolean" - }, - domain: { - $ref: "#/definitions/ValueExtent", - description: "Values of the data" - }, - field: { - description: "Name of the data field", - type: "string" - }, - grid: { - description: "Whether to display grid. __Default__: `false`", - type: "boolean" - }, - legend: { - description: "Whether to display legend. __Default__: `false`", - type: "boolean" - }, - padding: { - description: "Determines the size of inner white spaces on the top and bottom of individiual rows. __Default__: `0`", - type: "number" - }, - range: { - $ref: "#/definitions/ValueExtent", - description: "Determine the start and end position of rendering area of this track along vertical axis. __Default__: `[0, height]`" - }, - type: { - "const": "nominal", - description: "Specify the data type", - type: "string" - } - }, - type: "object" - }, - SelectivityCondition: { - additionalProperties: false, - properties: { - measure: { - "enum": [ - "width", - "height", - "aspectRatio" - ], - type: "string" - }, - operation: { - $ref: "#/definitions/LogicalOperation" - }, - target: { - description: "Does the condition applied to the visualization itself or its container? __Default__: `'self'`", - "enum": [ - "self", - "container" - ], - type: "string" - }, - threshold: { - description: "Threshold in the unit of pixels.", - type: "number" - } - }, - required: [ - "operation", - "measure", - "threshold" - ], - type: "object" - }, - SingleTrack: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "data", - "mark" - ], - type: "object" - }, - SingleView: { - anyOf: [ - { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - alignment: { - "const": "overlay", - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - responsiveSpec: { - items: { - additionalProperties: false, - properties: { - selectivity: { - items: { - $ref: "#/definitions/SelectivityCondition" - }, - type: "array" - }, - spec: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - alignment: { - "enum": [ - "overlay", - "stack" - ], - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - tracks: { - anyOf: [ - { - items: { - $ref: "#/definitions/PartialTrack" - }, - type: "array" - }, - { - items: { - anyOf: [ - { - $ref: "#/definitions/PartialTrack" - }, - { - $ref: "#/definitions/OverlaidTracks" - } - ] - }, - type: "array" - } - ] - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - type: "object" - } - }, - required: [ - "spec", - "selectivity" - ], - type: "object" - }, - type: "array" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - tracks: { - items: { - $ref: "#/definitions/PartialTrack" - }, - type: "array" - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "alignment", - "tracks" - ], - type: "object" - }, - { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - alignment: { - "const": "stack", - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - responsiveSpec: { - items: { - additionalProperties: false, - properties: { - selectivity: { - items: { - $ref: "#/definitions/SelectivityCondition" - }, - type: "array" - }, - spec: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - alignment: { - "enum": [ - "overlay", - "stack" - ], - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - tracks: { - anyOf: [ - { - items: { - $ref: "#/definitions/PartialTrack" - }, - type: "array" - }, - { - items: { - anyOf: [ - { - $ref: "#/definitions/PartialTrack" - }, - { - $ref: "#/definitions/OverlaidTracks" - } - ] - }, - type: "array" - } - ] - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - type: "object" - } - }, - required: [ - "spec", - "selectivity" - ], - type: "object" - }, - type: "array" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - tracks: { - items: { - anyOf: [ - { - $ref: "#/definitions/PartialTrack" - }, - { - $ref: "#/definitions/OverlaidTracks" - } - ] - }, - type: "array" - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "tracks" - ], - type: "object" - }, - { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - responsiveSpec: { - items: { - additionalProperties: false, - properties: { - selectivity: { - items: { - $ref: "#/definitions/SelectivityCondition" - }, - type: "array" - }, - spec: { - additionalProperties: false, - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - alignment: { - "enum": [ - "overlay", - "stack" - ], - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - baselineY: { - type: "number" - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - color: { - anyOf: [ - { - $ref: "#/definitions/Color" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - data: { - $ref: "#/definitions/DataDeep" - }, - dataTransform: { - items: { - $ref: "#/definitions/DataTransform" - }, - type: "array" - }, - displacement: { - $ref: "#/definitions/Displacement" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - experimental: { - additionalProperties: false, - properties: { - mouseEvents: { - anyOf: [ - { - type: "boolean" - }, - { - $ref: "#/definitions/MouseEventsDeep" - } - ] - }, - performanceMode: { - "default": false, - description: "Render visual marks with less smooth curves to increase rendering performance. Only supported for `elliptical` `linkStyle` `withinLink` currently.", - type: "boolean" - }, - stretchGraphics: { - description: "Performance rendering option. By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve rendering performance. No marks will be stretched in circular layouts.\n\nWhen this option is set to true, all marks will be stretched when zooming in/out. When this option is set to false, all marks will be rerendered when zooming in/out.", - type: "boolean" - }, - stretchGraphicsThreshold: { - "default": 1.5, - description: "Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will be rerendered. This is to prevent the graphics from being stretched too much.", - type: "number" - } - }, - type: "object" - }, - flipY: { - type: "boolean" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - mark: { - $ref: "#/definitions/Mark" - }, - opacity: { - anyOf: [ - { - $ref: "#/definitions/Opacity" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - overrideTemplate: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - row: { - anyOf: [ - { - $ref: "#/definitions/Row" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - size: { - anyOf: [ - { - $ref: "#/definitions/Size" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - stretch: { - type: "boolean" - }, - stroke: { - anyOf: [ - { - $ref: "#/definitions/Stroke" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - strokeWidth: { - anyOf: [ - { - $ref: "#/definitions/StrokeWidth" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - text: { - anyOf: [ - { - $ref: "#/definitions/Text" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - tooltip: { - items: { - $ref: "#/definitions/Tooltip" - }, - type: "array" - }, - tracks: { - anyOf: [ - { - items: { - $ref: "#/definitions/PartialTrack" - }, - type: "array" - }, - { - items: { - anyOf: [ - { - $ref: "#/definitions/PartialTrack" - }, - { - $ref: "#/definitions/OverlaidTracks" - } - ] - }, - type: "array" - } - ] - }, - visibility: { - items: { - $ref: "#/definitions/VisibilityCondition" - }, - type: "array" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - x: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - x1e: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - xe: { - anyOf: [ - { - $ref: "#/definitions/X" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - y1e: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - ye: { - anyOf: [ - { - $ref: "#/definitions/Y" - }, - { - $ref: "#/definitions/ChannelValue" - } - ] - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - type: "object" - } - }, - required: [ - "spec", - "selectivity" - ], - type: "object" - }, - type: "array" - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - tracks: { - items: { - $ref: "#/definitions/Track" - }, - type: "array" - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "tracks" - ], - type: "object" - } - ] - }, - Size: { - additionalProperties: false, - properties: { - domain: { - $ref: "#/definitions/ValueExtent", - description: "Values of the data" - }, - field: { - description: "Name of the data field", - type: "string" - }, - legend: { - description: "not supported: Whether to display legend. __Default__: `false`", - type: "boolean" - }, - range: { - $ref: "#/definitions/ValueExtent", - description: "Ranges of visual channel values" - }, - type: { - description: "Specify the data type", - "enum": [ - "quantitative", - "nominal" - ], - type: "string" - } - }, - type: "object" - }, - SizeVisibilityCondition: { - additionalProperties: false, - properties: { - conditionPadding: { - description: "Specify the buffer size (in pixel) of width or height when calculating the visibility.\n\n__Default__: `0`", - type: "number" - }, - measure: { - description: "Specify which aspect of the `target` will be compared to the `threshold`.", - "enum": [ - "width", - "height" - ], - type: "string" - }, - operation: { - $ref: "#/definitions/LogicalOperation", - description: 'A string that specifies the logical operation to conduct between `threshold` and the `measure` of `target`. Support\n\n- greater than : "greater-than", "gt", "GT"\n\n- less than : "less-than", "lt", "LT"\n\n- greater than or equal to : "greater-than-or-equal-to", "gtet", "GTET"\n\n- less than or equal to : "less-than-or-equal-to", "ltet", "LTET"' - }, - target: { - description: "Target specifies the object that you want to compare with the threshold.", - "enum": [ - "track", - "mark" - ], - type: "string" - }, - threshold: { - anyOf: [ - { - type: "number" - }, - { - "const": "|xe-x|", - type: "string" - } - ], - description: 'Specify the threshold as one of:\n\n- A number representing a fixed threshold in the unit of pixels;\n\n- `"|xe-x|"`, using the distance between `xe` and `x` as threshold' - }, - transitionPadding: { - description: "Specify the buffer size (in pixel) of width or height for smooth transition.\n\n__Default__: `0`", - type: "number" - } - }, - required: [ - "measure", - "operation", - "target", - "threshold" - ], - type: "object" - }, - StrConcatTransform: { - additionalProperties: false, - properties: { - fields: { - items: { - type: "string" - }, - type: "array" - }, - newField: { - type: "string" - }, - separator: { - type: "string" - }, - type: { - "const": "concat", - type: "string" - } - }, - required: [ - "type", - "fields", - "newField", - "separator" - ], - type: "object" - }, - StrReplaceTransform: { - additionalProperties: false, - properties: { - field: { - type: "string" - }, - newField: { - type: "string" - }, - replace: { - items: { - additionalProperties: false, - properties: { - from: { - type: "string" - }, - to: { - type: "string" - } - }, - required: [ - "from", - "to" - ], - type: "object" - }, - type: "array" - }, - type: { - "const": "replace", - type: "string" - } - }, - required: [ - "type", - "field", - "newField", - "replace" - ], - type: "object" - }, - Stroke: { - additionalProperties: false, - properties: { - domain: { - $ref: "#/definitions/ValueExtent", - description: "Values of the data" - }, - field: { - description: "Name of the data field", - type: "string" - }, - legend: { - description: "Whether to display legend. __Default__: `false`", - type: "boolean" - }, - range: { - $ref: "#/definitions/Range", - description: "Ranges of visual channel values" - }, - scaleOffset: { - description: "Whether to use offset of the domain proportionally. This is bound to brushes on the color legend. __Default__: `[0, 1]`", - items: { - type: "number" - }, - maxItems: 2, - minItems: 2, - type: "array" - }, - title: { - description: "Title of the legend. __Default__: `undefined`", - type: "string" - }, - type: { - description: "Specify the data type", - "enum": [ - "quantitative", - "nominal" - ], - type: "string" - } - }, - type: "object" - }, - StrokeWidth: { - additionalProperties: false, - properties: { - domain: { - $ref: "#/definitions/ValueExtent", - description: "Values of the data" - }, - field: { - description: "Name of the data field", - type: "string" - }, - range: { - $ref: "#/definitions/ValueExtent", - description: "Ranges of visual channel values" - }, - type: { - description: "Specify the data type", - "enum": [ - "quantitative", - "nominal" - ], - type: "string" - } - }, - type: "object" - }, - Style: { - additionalProperties: false, - properties: { - align: { - description: "Specify the alignment of marks. This property is currently only supported for `triangle` marks.", - "enum": [ - "left", - "right" - ], - type: "string" - }, - background: { - type: "string" - }, - backgroundOpacity: { - type: "number" - }, - brush: { - additionalProperties: false, - description: "Customize the style of the brush mark in the `rangeSelect` mouse event.", - properties: { - color: { - description: "color of the marks when mouse events are triggered", - type: "string" - }, - opacity: { - description: "opacity of the marks when mouse events are triggered", - type: "number" - }, - stroke: { - description: "stroke color of the marks when mouse events are triggered", - type: "string" - }, - strokeOpacity: { - type: "number" - }, - strokeWidth: { - description: "stroke width of the marks when mouse events are triggered", - type: "number" - } - }, - type: "object" - }, - curve: { - description: "Specify the curve of `rule` marks.", - "enum": [ - "top", - "bottom", - "left", - "right" - ], - type: "string" - }, - dashed: { - description: "Specify the pattern of dashes and gaps for `rule` marks.", - items: { - type: "number" - }, - maxItems: 2, - minItems: 2, - type: "array" - }, - dx: { - description: "Offset the position of marks in x direction. This property is currently only supported for `text` marks", - type: "number" - }, - dy: { - description: "Offset the position of marks in y direction. This property is currently only supported for `text` marks.", - type: "number" - }, - enableSmoothPath: { - description: "Whether to enable smooth paths when drawing curves.\n\n__Default__: `false`", - type: "boolean" - }, - inlineLegend: { - description: "Specify whether to show legend in a single horizontal line?", - type: "boolean" - }, - legendTitle: { - description: "If defined, show legend title on the top or left", - type: "string" - }, - linePattern: { - additionalProperties: false, - description: "Specify the pattern of dashes and gaps for `rule` marks.", - properties: { - size: { - type: "number" - }, - type: { - "enum": [ - "triangleLeft", - "triangleRight" - ], - type: "string" - } - }, - required: [ - "type", - "size" - ], - type: "object" - }, - linkConnectionType: { - description: 'Specify the connetion type of `betweenLink` marks.\n\n__Default__: `"corner"`', - "enum": [ - "straight", - "curve", - "corner" - ], - type: "string" - }, - linkMinHeight: { - description: "The minimum height of `withinLink` and `betweenLink` marks. Unit is a percentagle. __Default__: `0.5`", - type: "number" - }, - linkStyle: { - description: "The style of `withinLink` and `betweenLink` marks. __Default__: `'circular'` `'elliptical'` will be used as a default option.", - "enum": [ - "elliptical", - "circular", - "straight" - ], - type: "string" - }, - matrixExtent: { - description: 'Determine to show only one side of the diagonal in a HiGlass matrix. __Default__: `"full"`', - "enum": [ - "full", - "upper-right", - "lower-left" - ], - type: "string" - }, - mouseOver: { - $ref: "#/definitions/EventStyle", - description: "Customize visual effects of `mouseOver` events on marks." - }, - outline: { - type: "string" - }, - outlineWidth: { - type: "number" - }, - select: { - $ref: "#/definitions/EventStyle", - description: "Customize visual effects of `rangeSelect` events on marks ." - }, - textAnchor: { - description: "Specify the alignment of `text` marks to a given point.", - "enum": [ - "start", - "middle", - "end" - ], - type: "string" - }, - textFontSize: { - description: "Specify the font size of `text` marks. Can also be specified using the `size` channel option of `text` marks.", - type: "number" - }, - textFontWeight: { - description: "Specify the font weight of `text` marks.", - "enum": [ - "bold", - "normal" - ], - type: "string" - }, - textStroke: { - description: "Specify the stroke of `text` marks. Can also be specified using the `stroke` channel option of `text` marks.", - type: "string" - }, - textStrokeWidth: { - description: "Specify the stroke width of `text` marks. Can also be specified using the `strokeWidth` channel option of `text` marks.", - type: "number" - }, - withinLinkVerticalLines: { - description: "Whether to show vertical lines that connect to the baseline (axis) when `y` and `ye` are both used. __Default__: `false`", - type: "boolean" - } - }, - type: "object" - }, - SvTypeTransform: { - additionalProperties: false, - properties: { - firstBp: { - additionalProperties: false, - description: "Based on the BEDPE, infer SV types. SV types are specified as one of the following strings: DUP, TRA, DEL, t2tINV, h2hINV.", - properties: { - chrField: { - type: "string" - }, - posField: { - type: "string" - }, - strandField: { - type: "string" - } - }, - required: [ - "chrField", - "posField", - "strandField" - ], - type: "object" - }, - newField: { - type: "string" - }, - secondBp: { - additionalProperties: false, - description: "Based on the BEDPE, infer SV types. SV types are specified as one of the following strings: DUP, TRA, DEL, t2tINV, h2hINV.", - properties: { - chrField: { - type: "string" - }, - posField: { - type: "string" - }, - strandField: { - type: "string" - } - }, - required: [ - "chrField", - "posField", - "strandField" - ], - type: "object" - }, - type: { - "const": "svType", - type: "string" - } - }, - required: [ - "type", - "firstBp", - "secondBp", - "newField" - ], - type: "object" - }, - TemplateTrack: { - additionalProperties: false, - description: "Template specification that will be internally converted into `SingleTrack` for rendering.", - properties: { - _assignedHeight: { - type: "number" - }, - _assignedWidth: { - description: "Internal: Used for responsive spec", - type: "number" - }, - _invalidTrack: { - description: "internal", - type: "boolean" - }, - _renderingId: { - description: "internal", - type: "string" - }, - assembly: { - $ref: "#/definitions/Assembly", - description: 'A string that specifies the genome builds to use. Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`.\n\n__Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels.' - }, - centerRadius: { - description: "Proportion of the radius of the center white space.\n\n__Default:__ `0.3`", - type: "number" - }, - data: { - $ref: "#/definitions/DataDeep" - }, - encoding: { - additionalProperties: { - $ref: "#/definitions/Channel" - }, - type: "object" - }, - endAngle: { - description: 'Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - height: { - description: "Specify the track height in pixels.", - type: "number" - }, - id: { - description: "Assigned to `uid` in a HiGlass view config, used for API and caching.", - type: "string" - }, - innerRadius: { - description: 'Specify the inner radius of tracks when (`{"layout": "circular"}`).', - type: "number" - }, - layout: { - $ref: "#/definitions/Layout", - description: "Specify the layout type of all tracks." - }, - linkingId: { - description: "Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views)", - type: "string" - }, - orientation: { - $ref: "#/definitions/Orientation", - description: "Specify the orientation." - }, - outerRadius: { - description: 'Specify the outer radius of tracks when `{"layout": "circular"}`.', - type: "number" - }, - overlayOnPreviousTrack: { - type: "boolean" - }, - prerelease: { - additionalProperties: false, - description: "internal", - type: "object" - }, - spacing: { - description: "The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. The effect of this property depends on where on the spec you specify the `spacing`.\n\nIn a linear layout, this value is used in pixels, while in a circular layout, this value is used relative to the height of the tracks or views.", - type: "number" - }, - startAngle: { - description: 'Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`).', - type: "number" - }, - "static": { - description: "Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), __Default:__ `false`.", - type: "boolean" - }, - style: { - $ref: "#/definitions/Style", - description: "Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. Will be overwritten by the style of children elements (e.g., view, track)." - }, - subtitle: { - type: "string" - }, - template: { - type: "string" - }, - title: { - description: "If defined, will show the textual label on the left-top corner of a track.", - type: "string" - }, - width: { - description: "Specify the track width in pixels.", - type: "number" - }, - xAxis: { - $ref: "#/definitions/AxisPosition", - description: "not supported" - }, - xDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic x-axis" - }, - xOffset: { - description: "Specify the x offset of views in the unit of pixels", - type: "number" - }, - yDomain: { - anyOf: [ - { - $ref: "#/definitions/DomainInterval" - }, - { - $ref: "#/definitions/DomainChrInterval" - }, - { - $ref: "#/definitions/DomainChr" - } - ], - description: "Specify the visible region of genomic y-axis" - }, - yOffset: { - description: "Specify the y offset of views in the unit of pixels", - type: "number" - }, - zoomLimits: { - $ref: "#/definitions/ZoomLimits" - } - }, - required: [ - "template", - "data" - ], - type: "object" - }, - Text: { - additionalProperties: false, - properties: { - domain: { - description: "Values of the data", - items: { - type: "string" - }, - type: "array" - }, - field: { - description: "Name of the data field", - type: "string" - }, - range: { - description: "Ranges of visual channel values", - items: { - type: "string" - }, - type: "array" - }, - type: { - description: "Specify the data type", - "enum": [ - "quantitative", - "nominal" - ], - type: "string" - } - }, - type: "object" - }, - Tooltip: { - additionalProperties: false, - properties: { - alt: { - description: "Name of the data field for showing in the tooltip. Will use the field name if not specified.", - type: "string" - }, - field: { - description: "Specifiy a data field whose value will show in the tooltip.", - type: "string" - }, - format: { - description: "format of the data value.", - type: "string" - }, - type: { - $ref: "#/definitions/FieldType", - description: "Type of the data field." - } - }, - required: [ - "field", - "type" - ], - type: "object" - }, - Track: { - anyOf: [ - { - $ref: "#/definitions/SingleTrack" - }, - { - $ref: "#/definitions/OverlaidTrack" - }, - { - $ref: "#/definitions/DataTrack" - }, - { - $ref: "#/definitions/TemplateTrack" - }, - { - $ref: "#/definitions/DummyTrack" - } - ] - }, - ValueExtent: { - anyOf: [ - { - items: { - type: "string" - }, - type: "array" - }, - { - items: { - type: "number" - }, - type: "array" - } - ] - }, - VcfData: { - additionalProperties: false, - description: "The Variant Call Format (VCF).", - properties: { - indexUrl: { - description: "URL link to the tabix index file", - type: "string" - }, - sampleLength: { - description: "The maximum number of rows to be loaded from the URL. __Default:__ `1000`", - type: "number" - }, - type: { - "const": "vcf", - type: "string" - }, - url: { - description: "URL link to the VCF file", - type: "string" - } - }, - required: [ - "type", - "url", - "indexUrl" - ], - type: "object" - }, - VectorData: { - additionalProperties: false, - description: 'One-dimensional quantitative values along genomic position (e.g., bigwig) can be converted into HiGlass\' `"vector"` format data. Find out more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#bigwig-files).', - properties: { - aggregation: { - $ref: "#/definitions/BinAggregate", - description: 'Determine aggregation function to apply within bins. __Default__: `"mean"`' - }, - binSize: { - description: "Binning the genomic interval in tiles (unit size: 256).", - type: "number" - }, - column: { - description: 'Assign a field name of the middle position of genomic intervals. __Default__: `"position"`', - type: "string" - }, - end: { - description: 'Assign a field name of the end position of genomic intervals. __Default__: `"end"`', - type: "string" - }, - start: { - description: 'Assign a field name of the start position of genomic intervals. __Default__: `"start"`', - type: "string" - }, - type: { - "const": "vector", - type: "string" - }, - url: { - description: "Specify the URL address of the data file.", - type: "string" - }, - value: { - description: 'Assign a field name of quantitative values. __Default__: `"value"`', - type: "string" - } - }, - required: [ - "type", - "url" - ], - type: "object" - }, - VisibilityCondition: { - anyOf: [ - { - $ref: "#/definitions/SizeVisibilityCondition" - }, - { - $ref: "#/definitions/ZoomLevelVisibilityCondition" - } - ] - }, - X: { - additionalProperties: false, - properties: { - aggregate: { - $ref: "#/definitions/Aggregate", - description: "Specify how to aggregate data. __Default__: `undefined`" - }, - axis: { - $ref: "#/definitions/AxisPosition", - description: "Specify where should the axis be put" - }, - domain: { - $ref: "#/definitions/GenomicDomain", - description: "Values of the data" - }, - field: { - description: "Name of the data field.", - type: "string" - }, - grid: { - description: "Whether to display grid. __Default__: `false`", - type: "boolean" - }, - legend: { - description: "Whether to display legend. __Default__: `false`", - type: "boolean" - }, - linkingId: { - description: "Users need to assign a unique linkingId for [linking views](/docs/user-interaction#linking-views) and [Brushing and Linking](/docs/user-interaction#brushing-and-linking)", - type: "string" - }, - range: { - $ref: "#/definitions/ValueExtent", - description: "Values of the visual channel." - }, - type: { - "const": "genomic", - description: "Specify the data type.", - type: "string" - } - }, - type: "object" - }, - Y: { - additionalProperties: false, - properties: { - aggregate: { - $ref: "#/definitions/Aggregate", - description: "Specify how to aggregate data. __Default__: `undefined`" - }, - axis: { - $ref: "#/definitions/AxisPosition", - description: "Specify where should the axis be put" - }, - baseline: { - description: "Custom baseline of the y-axis. __Default__: `0`", - type: [ - "string", - "number" - ] - }, - domain: { - anyOf: [ - { - $ref: "#/definitions/ValueExtent" - }, - { - $ref: "#/definitions/GenomicDomain" - } - ], - description: "Values of the data" - }, - field: { - description: "Name of the data field.", - type: "string" - }, - flip: { - description: "Whether to flip the y-axis. This is done by inverting the `range` property. __Default__: `false`", - type: "boolean" - }, - grid: { - description: "Whether to display grid. __Default__: `false`", - type: "boolean" - }, - legend: { - description: "Whether to display legend. __Default__: `false`", - type: "boolean" - }, - linkingId: { - description: "Users need to assign a unique linkingId for [linking views](/docs/user-interaction#linking-views) and [Brushing and Linking](/docs/user-interaction#brushing-and-linking)", - type: "string" - }, - range: { - $ref: "#/definitions/ValueExtent", - description: "Values of the visual channel." - }, - type: { - description: "Specify the data type.", - "enum": [ - "quantitative", - "nominal", - "genomic" - ], - type: "string" - }, - zeroBaseline: { - description: "Specify whether to use zero baseline. __Default__: `true`", - type: "boolean" - } - }, - type: "object" - }, - ZoomLevelVisibilityCondition: { - additionalProperties: false, - properties: { - conditionPadding: { - description: "Specify the buffer size (in pixel) of width or height when calculating the visibility.\n\n__Default__: `0`", - type: "number" - }, - measure: { - "const": "zoomLevel", - description: "Specify which aspect of the `target` will be compared to the `threshold`.", - type: "string" - }, - operation: { - $ref: "#/definitions/LogicalOperation", - description: 'A string that specifies the logical operation to conduct between `threshold` and the `measure` of `target`. Support\n\n- greater than : "greater-than", "gt", "GT"\n\n- less than : "less-than", "lt", "LT"\n\n- greater than or equal to : "greater-than-or-equal-to", "gtet", "GTET"\n\n- less than or equal to : "less-than-or-equal-to", "ltet", "LTET"' - }, - target: { - description: "Target specifies the object that you want to compare with the threshold.", - "enum": [ - "track", - "mark" - ], - type: "string" - }, - threshold: { - description: "Set a threshold in the unit of base pairs (bp)", - type: "number" - }, - transitionPadding: { - description: "Specify the buffer size (in pixel) of width or height for smooth transition.\n\n__Default__: `0`", - type: "number" - } - }, - required: [ - "measure", - "operation", - "target", - "threshold" - ], - type: "object" - }, - ZoomLimits: { - items: { - type: [ - "number", - "null" - ] - }, - maxItems: 2, - minItems: 2, - type: "array" - } -}; -const GoslingSchema = { - $ref: $ref$2, - $schema: $schema$2, - definitions: definitions$2 -}; -function validateGoslingSpec(spec) { - return validateSpec(GoslingSchema, spec); -} -function validateSpec(schema, spec, silence = false) { - const validate = new Ajv({ extendRefs: true }).compile(schema); - const valid = validate(spec); - let message = ""; - let details = ""; - if (validate.errors) { - details = JSON.stringify(validate.errors, null, 2); - if (!silence) { - console.warn(details); - } - message = "⚠️ Some properties are incorrectly used."; - } - return { state: valid ? "success" : "warn", message, details }; -} -function validateTrack(track) { - let valid = true; - const errorMessages = []; - const resolvedTrack = resolveSuperposedTracks(track); - resolvedTrack.forEach((spec) => { - if (!getGenomicChannelFromTrack(spec) && spec.mark !== "brush" && spec.mark !== "rule") { - errorMessages.push("genomic type is not encoded to either a x- or y- axis"); - valid = false; - } - const color = spec.color; - if (spec.mark === "line" && IsChannelDeep(color) && color.type === "quantitative") { - errorMessages.push("`line` mark cannot be used with `quantitative` value"); - valid = false; - } - }); - return { valid, errorMessages }; -} -function getGenomicChannelFromTrack(track) { - let genomicChannel = void 0; - ["x", "y", "xe", "ye", "x1", "y1", "x1e", "y1e"].reverse().forEach((channelType) => { - const channel = track[channelType]; - if (IsChannelDeep(channel) && channel.type === "genomic") { - genomicChannel = channel; - } - }); - return genomicChannel; -} -function getGenomicChannelKeyFromTrack(track) { - let genomicChannelKey = void 0; - ["x", "xe", "y", "ye", "x1", "y1", "x1e", "y1e"].reverse().forEach((channelKey) => { - const channel = track[channelKey]; - if (IsChannelDeep(channel) && channel.type === "genomic") { - genomicChannelKey = channelKey; - } - }); - return genomicChannelKey; -} -const $ref$1 = "#/definitions/Theme"; -const $schema$1 = "http://json-schema.org/draft-07/schema#"; -const definitions$1 = { - AxisStyle: { - additionalProperties: false, - properties: { - baselineColor: { - type: "string" - }, - gridColor: { - type: "string" - }, - gridStrokeDash: { - items: { - type: "number" - }, - maxItems: 2, - minItems: 2, - type: "array" - }, - gridStrokeType: { - "enum": [ - "solid", - "dashed" - ], - type: "string" - }, - gridStrokeWidth: { - type: "number" - }, - labelColor: { - type: "string" - }, - labelExcludeChrPrefix: { - description: "If `true`, labels of genomics axes excludes the chromosome prefix (e.g., `chr1` -> `1`).", - type: "boolean" - }, - labelFontFamily: { - type: "string" - }, - labelFontSize: { - type: "number" - }, - labelFontWeight: { - "enum": [ - "bold", - "normal", - "light" - ], - type: "string" - }, - labelMargin: { - description: "The margin around labels for calculating visual overlaps between labels. This is mainly used for determining the visibility of axis labels. `0` if no margin to use. Negative values (`-1`) for showing all labels even if they overlap.", - type: "number" - }, - tickColor: { - type: "string" - } - }, - type: "object" - }, - LegendStyle: { - additionalProperties: false, - properties: { - background: { - type: "string" - }, - backgroundOpacity: { - type: "number" - }, - backgroundStroke: { - type: "string" - }, - labelColor: { - type: "string" - }, - labelFontFamily: { - type: "string" - }, - labelFontSize: { - type: "number" - }, - labelFontWeight: { - "enum": [ - "bold", - "normal", - "light" - ], - type: "string" - }, - position: { - "enum": [ - "top", - "right" - ], - type: "string" - }, - tickColor: { - type: "string" - } - }, - type: "object" - }, - MarkStyle: { - additionalProperties: false, - properties: { - color: { - type: "string" - }, - nominalColorRange: { - items: { - type: "string" - }, - type: "array" - }, - opacity: { - type: "number" - }, - quantitativeSizeRange: { - items: { - type: "number" - }, - maxItems: 2, - minItems: 2, - type: "array" - }, - size: { - type: "number" - }, - stroke: { - type: "string" - }, - strokeWidth: { - type: "number" - } - }, - type: "object" - }, - RootStyle: { - additionalProperties: false, - properties: { - background: { - type: "string" - }, - mousePositionColor: { - type: "string" - }, - showMousePosition: { - type: "boolean" - }, - subtitleAlign: { - "enum": [ - "left", - "middle", - "right" - ], - type: "string" - }, - subtitleBackgroundColor: { - type: "string" - }, - subtitleColor: { - type: "string" - }, - subtitleFontFamily: { - type: "string" - }, - subtitleFontSize: { - type: "number" - }, - subtitleFontWeight: { - "enum": [ - "bold", - "normal", - "light" - ], - type: "string" - }, - titleAlign: { - "enum": [ - "left", - "middle", - "right" - ], - type: "string" - }, - titleBackgroundColor: { - type: "string" - }, - titleColor: { - type: "string" - }, - titleFontFamily: { - type: "string" - }, - titleFontSize: { - type: "number" - }, - titleFontWeight: { - "enum": [ - "bold", - "normal", - "light" - ], - type: "string" - } - }, - type: "object" - }, - Theme: { - anyOf: [ - { - $ref: "#/definitions/ThemeType" - }, - { - $ref: "#/definitions/ThemeDeep" - } - ] - }, - ThemeDeep: { - additionalProperties: false, - properties: { - area: { - $ref: "#/definitions/MarkStyle" - }, - axis: { - $ref: "#/definitions/AxisStyle" - }, - bar: { - $ref: "#/definitions/MarkStyle" - }, - base: { - $ref: "#/definitions/ThemeType" - }, - brush: { - $ref: "#/definitions/MarkStyle" - }, - legend: { - $ref: "#/definitions/LegendStyle" - }, - line: { - $ref: "#/definitions/MarkStyle" - }, - link: { - $ref: "#/definitions/MarkStyle" - }, - markCommon: { - $ref: "#/definitions/MarkStyle" - }, - point: { - $ref: "#/definitions/MarkStyle" - }, - rect: { - $ref: "#/definitions/MarkStyle" - }, - root: { - $ref: "#/definitions/RootStyle" - }, - rule: { - $ref: "#/definitions/MarkStyle" - }, - text: { - additionalProperties: false, - properties: { - color: { - type: "string" - }, - nominalColorRange: { - items: { - type: "string" - }, - type: "array" - }, - opacity: { - type: "number" - }, - quantitativeSizeRange: { - items: { - type: "number" - }, - maxItems: 2, - minItems: 2, - type: "array" - }, - size: { - type: "number" - }, - stroke: { - type: "string" - }, - strokeWidth: { - type: "number" - }, - textAnchor: { - "enum": [ - "start", - "middle", - "end" - ], - type: "string" - }, - textFontWeight: { - "enum": [ - "bold", - "normal" - ], - type: "string" - } - }, - type: "object" - }, - track: { - $ref: "#/definitions/TrackStyle" - }, - triangle: { - $ref: "#/definitions/MarkStyle" - } - }, - required: [ - "base" - ], - type: "object" - }, - ThemeType: { - "enum": [ - "light", - "dark", - "warm", - "ggplot", - "igv", - "ensembl", - "jbrowse", - "ucsc", - "washu", - "excel", - "google" - ], - type: "string" - }, - TrackStyle: { - additionalProperties: false, - properties: { - alternatingBackground: { - type: "string" - }, - background: { - type: "string" - }, - outline: { - type: "string" - }, - outlineWidth: { - type: "number" - }, - titleAlign: { - "enum": [ - "left", - "middle", - "right" - ], - type: "string" - }, - titleBackground: { - type: "string" - }, - titleColor: { - type: "string" - }, - titleFontSize: { - type: "number" - } - }, - type: "object" - } -}; -const theme_schema = { - $ref: $ref$1, - $schema: $schema$1, - definitions: definitions$1 -}; -const GoslingTemplates = [ - { - name: "gene", - channels: [ - { name: "startPosition", type: "genomic", required: true }, - { name: "endPosition", type: "genomic", required: true }, - { name: "strandColor", type: "nominal", required: true }, - { name: "strandRow", type: "nominal", required: true }, - { name: "opacity", type: "value", required: false }, - { name: "geneHeight", type: "value", required: false }, - { name: "geneLabel", type: "nominal", required: true }, - { name: "geneLabelColor", type: "nominal", required: true }, - { name: "geneLabelFontSize", type: "value", required: false }, - { name: "geneLabelStroke", type: "value", required: false }, - { name: "geneLabelStrokeThickness", type: "value", required: false }, - { name: "geneLabelOpacity", type: "value", required: false }, - { name: "type", type: "nominal", required: true } - // either 'gene' or 'exon' - ], - mapping: [ - { - dataTransform: [ - { type: "filter", base: "type", oneOf: ["gene"] }, - { type: "filter", base: "strandColor", oneOf: ["-"] } - ], - mark: "triangleLeft", - x: { base: "startPosition", type: "genomic" }, - size: { base: "geneHeight", value: 12 }, - row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, - color: { base: "strandColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, - opacity: { base: "opacity", value: 0.4 }, - style: { align: "right" } - }, - { - dataTransform: [ - { type: "filter", base: "type", oneOf: ["gene"] }, - { type: "filter", base: "strandColor", oneOf: ["+"] } - ], - mark: "triangleRight", - x: { base: "endPosition", type: "genomic" }, - size: { base: "geneHeight", value: 12 }, - row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, - color: { base: "strandColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, - opacity: { base: "opacity", value: 0.4 }, - style: { align: "left" } - }, - { - dataTransform: [{ type: "filter", base: "type", oneOf: ["exon"] }], - mark: "rect", - x: { base: "startPosition", type: "genomic" }, - xe: { base: "endPosition", type: "genomic" }, - size: { base: "geneHeight", value: 12 }, - row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, - color: { base: "strandColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, - opacity: { base: "opacity", value: 0.4 } - }, - { - dataTransform: [ - { type: "filter", base: "type", oneOf: ["gene"] }, - { type: "filter", base: "strandColor", oneOf: ["+"] } - ], - mark: "rect", - x: { base: "startPosition", type: "genomic" }, - xe: { base: "endPosition", type: "genomic" }, - row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, - color: { base: "strandColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, - opacity: { base: "opacity", value: 0.4 }, - size: { value: 3 } - // style: { - // linePattern: { type: 'triangleRight', size: 5 } - // } - }, - { - dataTransform: [ - { type: "filter", base: "type", oneOf: ["gene"] }, - { type: "filter", base: "strandColor", oneOf: ["-"] } - ], - mark: "rect", - x: { base: "startPosition", type: "genomic" }, - xe: { base: "endPosition", type: "genomic" }, - row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, - color: { base: "strandColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, - opacity: { base: "opacity", value: 0.4 }, - size: { value: 3 } - // style: { - // linePattern: { type: 'triangleLeft', size: 5 } - // } - }, - { - dataTransform: [{ type: "filter", base: "type", oneOf: ["gene"] }], - mark: "text", - text: { base: "geneLabel", type: "nominal" }, - // TODO: add dy here - x: { base: "startPosition", type: "genomic" }, - xe: { base: "endPosition", type: "genomic" }, - row: { base: "strandRow", type: "nominal", domain: ["+", "-"] }, - color: { base: "geneLabelColor", type: "nominal", domain: ["+", "-"], range: ["blue", "red"] }, - opacity: { base: "opacity", value: 1 }, - size: { base: "geneLabelFontSize", value: 18 }, - stroke: { base: "geneLabelStroke", value: "white" }, - strokeWidth: { base: "geneLabelStrokeThickness", value: 2 }, - // TODO: how to redefine style from the users' side? (e.g., dy: -30) - visibility: [ - { - operation: "less-than", - measure: "width", - threshold: "|xe-x|", - transitionPadding: 10, - target: "mark" - } - ] - } - ] - }, - { - name: "ideogram", - channels: [ - { name: "startPosition", type: "genomic", required: true }, - { name: "endPosition", type: "genomic", required: true }, - { name: "chrHeight", type: "value", required: false }, - // https://eweitz.github.io/ideogram/ - { name: "name", type: "nominal", required: true }, - { name: "stainBackgroundColor", type: "nominal", required: true }, - { name: "stainLabelColor", type: "nominal", required: true }, - { name: "stainStroke", type: "value", required: false }, - { name: "stainStrokeWidth", type: "value", required: false } - ], - mapping: [ - { - mark: "rect", - dataTransform: [{ type: "filter", base: "stainBackgroundColor", oneOf: ["acen"], not: true }], - color: { - base: "stainBackgroundColor", - type: "nominal", - domain: ["gneg", "gpos25", "gpos50", "gpos75", "gpos100", "gvar", "acen"], - range: ["white", "lightgray", "gray", "gray", "black", "#7B9CC8", "#DC4542"] - }, - size: { base: "chrHeight", value: 18 }, - x: { base: "startPosition", type: "genomic" }, - xe: { base: "endPosition", type: "genomic" }, - stroke: { base: "stainStroke", value: "gray" }, - strokeWidth: { base: "stainStrokeWidth", value: 0.3 } - }, - { - mark: "triangleRight", - dataTransform: [ - { type: "filter", base: "stainBackgroundColor", oneOf: ["acen"] }, - { type: "filter", base: "name", include: "q" } - ], - color: { - base: "stainBackgroundColor", - type: "nominal", - domain: ["gneg", "gpos25", "gpos50", "gpos75", "gpos100", "gvar", "acen"], - range: ["white", "lightgray", "gray", "gray", "black", "#7B9CC8", "#DC4542"] - }, - size: { base: "chrHeight", value: 18 }, - x: { base: "startPosition", type: "genomic" }, - xe: { base: "endPosition", type: "genomic" }, - stroke: { base: "stainStroke", value: "gray" }, - strokeWidth: { base: "stainStrokeWidth", value: 0.3 } - }, - { - mark: "triangleLeft", - dataTransform: [ - { type: "filter", base: "stainBackgroundColor", oneOf: ["acen"] }, - { type: "filter", base: "name", include: "p" } - ], - color: { - base: "stainBackgroundColor", - type: "nominal", - domain: ["gneg", "gpos25", "gpos50", "gpos75", "gpos100", "gvar", "acen"], - range: ["white", "lightgray", "gray", "gray", "black", "#7B9CC8", "#DC4542"] - }, - size: { base: "chrHeight", value: 18 }, - x: { base: "startPosition", type: "genomic" }, - xe: { base: "endPosition", type: "genomic" }, - stroke: { base: "stainStroke", value: "gray" }, - strokeWidth: { base: "stainStrokeWidth", value: 0.3 } - }, - { - mark: "text", - dataTransform: [{ type: "filter", base: "stainLabelColor", oneOf: ["acen"], not: true }], - color: { - base: "stainLabelColor", - type: "nominal", - domain: ["gneg", "gpos25", "gpos50", "gpos75", "gpos100", "gvar"], - range: ["black", "black", "black", "black", "white", "black"] - }, - text: { base: "name", type: "nominal" }, - x: { base: "startPosition", type: "genomic" }, - xe: { base: "endPosition", type: "genomic" }, - visibility: [ - { - operation: "less-than", - measure: "width", - threshold: "|xe-x|", - transitionPadding: 10, - target: "mark" - } - ] - } - ] - }, - { - name: "sequence", - channels: [ - { name: "startPosition", type: "genomic", required: true }, - { name: "endPosition", type: "genomic", required: true }, - { name: "barLength", type: "quantitative", required: true }, - { name: "baseBackground", type: "nominal", required: true }, - { name: "baseLabelColor", type: "nominal", required: true }, - { name: "baseLabelFontSize", type: "value", required: false } - ], - mapping: [ - { - mark: "bar", - // x: { base: 'position', type: 'genomic' }, - x: { base: "startPosition", type: "genomic" }, - xe: { base: "endPosition", type: "genomic" }, - y: { base: "barLength", type: "quantitative", axis: "none" }, - color: { base: "baseBackground", type: "nominal", domain: ["A", "T", "G", "C"] } - }, - { - dataTransform: [{ type: "filter", base: "barLength", oneOf: [0], not: true }], - mark: "text", - x: { base: "startPosition", type: "genomic" }, - xe: { base: "endPosition", type: "genomic" }, - color: { base: "baseLabelColor", type: "nominal", domain: ["A", "T", "G", "C"], range: ["white"] }, - text: { base: "baseBackground", type: "nominal" }, - size: { base: "baseLabelFontSize", value: 18 }, - visibility: [ - { - operation: "less-than", - measure: "width", - threshold: "|xe-x|", - transitionPadding: 30, - target: "mark" - }, - { - operation: "LT", - measure: "zoomLevel", - threshold: 10, - target: "track" - } - ] - } - ] - } -]; -function replaceTrackTemplates(spec, templates) { - traverseTracks(spec, (t, i, ts) => { - var _a, _b; - if (!IsTemplateTrack(t)) { - return; - } - const { template: name2 } = t; - const templateDef = templates.find((d) => d.name === name2); - if (!templateDef) { - t._invalidTrack = true; - console.warn(`There is no track template named '${name2}'`); - return; - } - let isValid = true; - templateDef.channels.forEach((d) => { - if (d.required && (!t.encoding || !(d.name in t.encoding))) { - isValid = false; - console.warn(`A template spec ('${name2}') does not contain a required channel, ${d.name}`); - } - }); - if (!isValid) { - t._invalidTrack = true; - return; - } - const viewBase = JSON.parse(JSON.stringify(t)); - if ("encoding" in viewBase) { - delete viewBase.encoding; - } - const convertedView = { - ...viewBase, - alignment: "overlay", - tracks: [], - width: (_a = t.width) != null ? _a : 100, - height: (_b = t.height) != null ? _b : 100 - }; - templateDef.mapping.forEach((singleTrackMappingDef) => { - const convertedTrack = { - data: t.data, - mark: singleTrackMappingDef.mark - }; - const { dataTransform } = singleTrackMappingDef; - if (dataTransform) { - dataTransform.map((dataTramsformMap) => { - const baseChannelName = dataTramsformMap.base; - if (baseChannelName && t.encoding && baseChannelName in t.encoding && "field" in t.encoding[baseChannelName]) { - delete dataTramsformMap.base; - dataTramsformMap.field = t.encoding[baseChannelName].field; - } - }); - } - const encodingSpec = t.encoding; - if (!encodingSpec) { - Object.keys(singleTrackMappingDef).filter((k) => k !== "mark").forEach((channelKey) => { - const channelMap = JSON.parse(JSON.stringify(singleTrackMappingDef[channelKey])); - if ("base" in channelMap) { - delete channelMap.base; - } - convertedTrack[channelKey] = channelMap; - }); - } else { - Object.keys(singleTrackMappingDef).filter((k) => k !== "mark").forEach((channelKey) => { - const channelMap = JSON.parse(JSON.stringify(singleTrackMappingDef[channelKey])); - if ("base" in channelMap) { - const baseChannelName = channelMap.base; - if (baseChannelName in encodingSpec) { - const base = JSON.parse(JSON.stringify(encodingSpec[baseChannelName])); - delete channelMap.base; - const newChannelSpec = Object.assign(channelMap, JSON.parse(JSON.stringify(base))); - convertedTrack[channelKey] = newChannelSpec; - } else { - delete channelMap.base; - convertedTrack[channelKey] = channelMap; - } - } else { - convertedTrack[channelKey] = channelMap; - } - }); - } - convertedView.tracks.push(convertedTrack); - }); - ts[i] = convertedView; - }); -} -const NOMINAL_COLOR$a = [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - /*'#000000'*/ -]; -const LightThemeMarkCommonStyle$1 = { - color: NOMINAL_COLOR$a[0], - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR$a, - quantitativeSizeRange: [2, 6] -}; -const light = { - base: "light", - root: { - background: "white", - titleColor: "black", - titleBackgroundColor: "transparent", - titleFontSize: 18, - titleFontFamily: "Arial", - titleAlign: "left", - titleFontWeight: "bold", - subtitleColor: "gray", - subtitleBackgroundColor: "transparent", - subtitleFontSize: 16, - subtitleFontFamily: "Arial", - subtitleFontWeight: "normal", - subtitleAlign: "left", - showMousePosition: true, - mousePositionColor: "#000000" - }, - track: { - background: "transparent", - alternatingBackground: "transparent", - titleColor: "black", - titleBackground: "white", - titleFontSize: 24, - titleAlign: "left", - outline: "black", - outlineWidth: 1 - }, - legend: { - position: "top", - background: "white", - backgroundOpacity: 0.7, - labelColor: "black", - labelFontSize: 12, - labelFontWeight: "normal", - labelFontFamily: "Arial", - backgroundStroke: "#DBDBDB", - tickColor: "black" - }, - axis: { - tickColor: "black", - labelColor: "black", - labelMargin: 5, - labelExcludeChrPrefix: false, - labelFontSize: 12, - labelFontWeight: "normal", - labelFontFamily: "Arial", - baselineColor: "black", - gridColor: "#E3E3E3", - gridStrokeWidth: 1, - gridStrokeType: "solid", - gridStrokeDash: [4, 4] - }, - markCommon: { - ...LightThemeMarkCommonStyle$1 - }, - point: { - ...LightThemeMarkCommonStyle$1, - size: 3 - }, - rect: { - ...LightThemeMarkCommonStyle$1 - }, - triangle: { - ...LightThemeMarkCommonStyle$1 - }, - area: { - ...LightThemeMarkCommonStyle$1 - }, - line: { - ...LightThemeMarkCommonStyle$1 - }, - bar: { - ...LightThemeMarkCommonStyle$1 - }, - rule: { - ...LightThemeMarkCommonStyle$1, - strokeWidth: 1 - }, - link: { - ...LightThemeMarkCommonStyle$1, - strokeWidth: 1 - }, - text: { - ...LightThemeMarkCommonStyle$1, - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - ...LightThemeMarkCommonStyle$1, - color: "gray", - opacity: 0.3, - stroke: "black", - strokeWidth: 1 - } -}; -const NOMINAL_COLOR$9 = [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - /*'#000000'*/ -]; -const LightThemeMarkCommonStyle = { - color: NOMINAL_COLOR$9[0], - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR$9, - quantitativeSizeRange: [2, 6] -}; -const DarkThemeMarkCommonStyle = { ...LightThemeMarkCommonStyle, stroke: "white" }; -const dark = { - base: "dark", - root: { - background: "black", - titleColor: "white", - titleBackgroundColor: "transparent", - titleFontSize: 18, - titleFontFamily: "Arial", - titleAlign: "middle", - titleFontWeight: "bold", - subtitleColor: "lightgray", - subtitleBackgroundColor: "transparent", - subtitleFontSize: 16, - subtitleFontFamily: "Arial", - subtitleAlign: "middle", - subtitleFontWeight: "normal", - showMousePosition: true, - mousePositionColor: "#FFFFFF" - }, - track: { - background: "transparent", - alternatingBackground: "transparent", - titleColor: "white", - titleBackground: "black", - titleFontSize: 18, - titleAlign: "left", - outline: "white", - outlineWidth: 1 - }, - legend: { - position: "right", - background: "black", - backgroundOpacity: 0.7, - labelColor: "white", - labelFontSize: 12, - labelFontWeight: "normal", - labelFontFamily: "Arial", - backgroundStroke: "#DBDBDB", - tickColor: "white" - }, - axis: { - tickColor: "white", - labelMargin: 5, - labelExcludeChrPrefix: false, - labelColor: "white", - labelFontSize: 10, - labelFontWeight: "normal", - labelFontFamily: "Arial", - baselineColor: "white", - gridColor: "gray", - gridStrokeWidth: 1, - gridStrokeType: "solid", - gridStrokeDash: [4, 4] - }, - markCommon: { - ...DarkThemeMarkCommonStyle - }, - point: { - ...DarkThemeMarkCommonStyle, - size: 3 - }, - rect: { - ...DarkThemeMarkCommonStyle - }, - triangle: { - ...DarkThemeMarkCommonStyle - }, - area: { - ...DarkThemeMarkCommonStyle - }, - line: { - ...DarkThemeMarkCommonStyle - }, - bar: { - ...DarkThemeMarkCommonStyle - }, - rule: { - ...DarkThemeMarkCommonStyle, - strokeWidth: 1 - }, - link: { - ...DarkThemeMarkCommonStyle, - strokeWidth: 1 - }, - text: { - ...DarkThemeMarkCommonStyle, - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - ...DarkThemeMarkCommonStyle, - color: "lightgray", - opacity: 0.3, - stroke: "white", - strokeWidth: 1 - } -}; -const NOMINAL_COLOR$8 = ["#D19000", "#008F67", "#005F96", "#B86E97", "#B55100", "#4793BF", "#C9C03"]; -const WarmThemeMarkCommonStyle = { - color: NOMINAL_COLOR$8[0], - size: 1, - stroke: "#3C3C3C", - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR$8, - quantitativeSizeRange: [2, 6] -}; -const warm = { - base: "warm", - root: { - background: "#FFF8E8", - titleColor: "#3C3C3C", - subtitleColor: "gray", - showMousePosition: true, - mousePositionColor: "#3C3C3C" - }, - track: { - titleColor: "#3C3C3C", - titleBackground: "#FFF8E8", - outline: "#3C3C3C", - outlineWidth: 1 - }, - legend: { - background: "#FFF8E8", - backgroundOpacity: 0.7, - labelColor: "#3C3C3C", - backgroundStroke: "#3C3C3C", - tickColor: "3C3C3C" - }, - axis: { - tickColor: "#3C3C3C", - labelColor: "#3C3C3C", - baselineColor: "#3C3C3C", - gridColor: "#E3E3E3", - gridStrokeWidth: 1 - }, - markCommon: { - ...WarmThemeMarkCommonStyle - }, - point: { - ...WarmThemeMarkCommonStyle, - size: 3 - }, - rect: { - ...WarmThemeMarkCommonStyle - }, - triangle: { - ...WarmThemeMarkCommonStyle - }, - area: { - ...WarmThemeMarkCommonStyle - }, - line: { - ...WarmThemeMarkCommonStyle - }, - bar: { - ...WarmThemeMarkCommonStyle - }, - rule: { - ...WarmThemeMarkCommonStyle, - strokeWidth: 1 - }, - link: { - ...WarmThemeMarkCommonStyle, - strokeWidth: 1 - }, - text: { - ...WarmThemeMarkCommonStyle, - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - ...WarmThemeMarkCommonStyle, - color: "lightgray", - opacity: 0.3, - stroke: "#3C3C3C", - strokeWidth: 1 - } -}; -const NOMINAL_COLOR$7 = ["#F66A62", "#05B230", "#5692FF", "#D764D6", "#86E9D4", "#6E6AD7", "#FFFB00"]; -const GgplotThemeMarkCommonStyle = { - color: NOMINAL_COLOR$7[0], - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR$7, - quantitativeSizeRange: [2, 6] -}; -const ggplot = { - base: "ggplot", - root: { - background: "white", - titleColor: "black", - titleFontSize: 18, - titleFontFamily: "Helvetica", - titleAlign: "middle", - titleFontWeight: "bold", - titleBackgroundColor: "white", - subtitleColor: "gray", - subtitleFontSize: 14, - subtitleFontFamily: "Helvetica", - subtitleAlign: "middle", - subtitleFontWeight: "light", - subtitleBackgroundColor: "white", - showMousePosition: true, - mousePositionColor: "black" - }, - track: { - background: "#e8e8e8", - alternatingBackground: "#d1d1d1", - titleColor: "black", - titleBackground: "white", - //titleFontSize:'', - //titleAlign:'', - outline: "black", - outlineWidth: 2 - }, - legend: { - position: "right", - background: "#e8e8e8", - backgroundOpacity: 1, - labelColor: "black", - backgroundStroke: "#e8e8e8", - tickColor: "white" - //,labelFontSize: '', - //labelFontWeight: '', - //labelFontFamily: '' - }, - axis: { - tickColor: "white", - labelColor: "black", - //labelFontSize: '', - //labelFontWeight: '', - //labelFontFamily: '', - baselineColor: "#e8e8e8", - gridColor: "white", - gridStrokeWidth: 2 - //,gridStrokeType: '', - //gridStrokeDash: - }, - markCommon: { - ...GgplotThemeMarkCommonStyle - }, - point: { - ...GgplotThemeMarkCommonStyle, - size: 3 - }, - rect: { - ...GgplotThemeMarkCommonStyle - }, - triangle: { - ...GgplotThemeMarkCommonStyle - }, - area: { - ...GgplotThemeMarkCommonStyle - }, - line: { - ...GgplotThemeMarkCommonStyle - }, - bar: { - ...GgplotThemeMarkCommonStyle - }, - rule: { - ...GgplotThemeMarkCommonStyle, - strokeWidth: 1 - }, - link: { - ...GgplotThemeMarkCommonStyle, - strokeWidth: 1 - }, - text: { - ...GgplotThemeMarkCommonStyle, - textAnchor: "middle", - textFontWeight: "bold" - }, - brush: { - ...GgplotThemeMarkCommonStyle, - color: "black", - opacity: 0.3, - stroke: "black", - strokeWidth: 1 - } -}; -const NOMINAL_COLOR$6 = ["#37E649", "#ED2D44", "#AEAFEA", "#EBAEAE", "#CE7B3D", "#8743E0", "#5233F0"]; -const IGVThemeMarkCommonStyle = { - color: NOMINAL_COLOR$6[0], - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR$6, - quantitativeSizeRange: [2, 6] -}; -const igv = { - base: "igv", - root: { - background: "white", - titleColor: "white", - //titleFontSize:'', - //titleFontFamily:'', - titleAlign: "left", - titleFontWeight: "bold", - titleBackgroundColor: "#5f5f5f", - subtitleColor: "#3b3b3b", - //subtitleFontSize:'', - //subtitleFontFamily:'', - subtitleAlign: "left", - subtitleFontWeight: "bold", - subtitleBackgroundColor: "#c4c4c4", - showMousePosition: true, - mousePositionColor: "black" - }, - track: { - background: "white", - alternatingBackground: "#e8e8e8", - titleColor: "white", - titleBackground: "#5F5F5F", - //titleFontSize:'', - //titleAlign:'', - outline: "#5F5F5F", - outlineWidth: 1 - }, - legend: { - position: "top", - background: "white", - backgroundOpacity: 1, - labelColor: "black", - //labelFontSize: '', - //labelFontWeight: '', - //labelFontFamily: '', - backgroundStroke: "black", - tickColor: "black" - }, - axis: { - tickColor: "black", - labelColor: "black", - //labelFontSize: '', - //labelFontWeight: '', - //labelFontFamily: '', - //baselineColor: '#E6E6E6', - baselineColor: "white", - gridColor: "transparent", - gridStrokeWidth: 0 - //gridStrokeType: '', - //gridStrokeDash: - }, - markCommon: { - ...IGVThemeMarkCommonStyle - }, - point: { - ...IGVThemeMarkCommonStyle, - size: 3 - }, - rect: { - ...IGVThemeMarkCommonStyle - }, - triangle: { - ...IGVThemeMarkCommonStyle - }, - area: { - ...IGVThemeMarkCommonStyle - }, - line: { - ...IGVThemeMarkCommonStyle - }, - bar: { - ...IGVThemeMarkCommonStyle - }, - rule: { - ...IGVThemeMarkCommonStyle, - strokeWidth: 1 - }, - link: { - ...IGVThemeMarkCommonStyle, - strokeWidth: 1 - }, - text: { - ...IGVThemeMarkCommonStyle, - textAnchor: "middle", - textFontWeight: "bold" - }, - brush: { - ...IGVThemeMarkCommonStyle, - color: "white", - opacity: 0.3, - stroke: "black", - strokeWidth: 1 - } -}; -const NOMINAL_COLOR$5 = [ - "#CD9B1D", - "#8A668B", - "#40E0D0", - "#FF6969", - "#666666", - "#FAC902", - "#FE0000", - "#CC96CD", - "#D9D9D9" - /*'#000000'*/ -]; -const EnsemblThemeMarkCommonStyle = { - color: NOMINAL_COLOR$5[0], - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR$5, - quantitativeSizeRange: [2, 6] -}; -const ensembl = { - base: "ensembl", - root: { - background: "white", - titleColor: "#494949", - titleFontSize: 24, - titleFontFamily: "GGX88", - titleAlign: "left", - titleFontWeight: "bold", - titleBackgroundColor: "white", - subtitleColor: "white", - subtitleFontSize: 19, - subtitleFontFamily: "GGX88", - subtitleAlign: "left", - subtitleFontWeight: "normal", - subtitleBackgroundColor: "#7B8BAF", - mousePositionColor: "#FE0000", - showMousePosition: true - }, - track: { - background: "white", - alternatingBackground: "#fffdf7", - titleColor: "black", - titleBackground: "white", - titleAlign: "left", - outline: "#7B8BAF", - outlineWidth: 2 - }, - legend: { - tickColor: "black", - labelColor: "black", - //labelFontSize: , - labelFontWeight: "normal", - labelFontFamily: "GGX88", - background: "white", - backgroundOpacity: 2, - backgroundStroke: "lightgray" - }, - axis: { - tickColor: "black", - labelColor: "black", - //labelFontSize: , - //labelFontWeight: '', - labelFontFamily: "GGX88", - baselineColor: "black", - gridColor: "#7B8BAF", - gridStrokeWidth: 2 - //gridStrokeType: '', - //gridStrokeDash: - }, - markCommon: { - ...EnsemblThemeMarkCommonStyle - }, - point: { - ...EnsemblThemeMarkCommonStyle, - /*color: NOMINAL_COLOR[0], - stroke: 'black', - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR, - quantitativeSizeRange: [2, 6]*/ - size: 3 - }, - rect: { - ...EnsemblThemeMarkCommonStyle - /*color: NOMINAL_COLOR[0], - size: 1, - stroke: 'black', - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR, - quantitativeSizeRange: [2, 6]*/ - }, - triangle: { - ...EnsemblThemeMarkCommonStyle - /*color: NOMINAL_COLOR[0], - size: 1, - stroke: 'black', - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR, - quantitativeSizeRange: [2, 6]*/ - }, - area: { - ...EnsemblThemeMarkCommonStyle - /*color: NOMINAL_COLOR[0], - size: 1, - stroke: 'black', - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR, - quantitativeSizeRange: [2, 6]*/ - }, - line: { - ...EnsemblThemeMarkCommonStyle - /*color: NOMINAL_COLOR[0], - size: 1, - stroke: 'black', - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR, - quantitativeSizeRange: [2, 6]*/ - }, - bar: { - ...EnsemblThemeMarkCommonStyle - /*color: NOMINAL_COLOR[0], - size: 1, - stroke: 'black', - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR, - quantitativeSizeRange: [2, 6]*/ - }, - rule: { - ...EnsemblThemeMarkCommonStyle, - /*color: NOMINAL_COLOR[0], - size: 1, - stroke: 'black', - opacity: 1, - nominalColorRange: NOMINAL_COLOR, - quantitativeSizeRange: [2, 6]*/ - strokeWidth: 1 - }, - link: { - ...EnsemblThemeMarkCommonStyle, - /*color: NOMINAL_COLOR[0], - size: 1, - stroke: 'black', - opacity: 1, - nominalColorRange: NOMINAL_COLOR, - quantitativeSizeRange: [2, 6]*/ - strokeWidth: 1 - }, - text: { - ...EnsemblThemeMarkCommonStyle, - /*color: NOMINAL_COLOR[0], - size: 1, - stroke: 'black', - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR, - quantitativeSizeRange: [2, 6]*/ - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - ...EnsemblThemeMarkCommonStyle, - /*size: 1, - nominalColorRange: NOMINAL_COLOR, - quantitativeSizeRange: [2, 6]*/ - color: "gray", - opacity: 0.3, - stroke: "black", - strokeWidth: 1 - } -}; -const NOMINAL_COLOR$4 = [ - "#3A62FE", - "#F85353", - "#3A62FE", - "#F85353", - "#DCA326", - "#03BF06", - "#BABABA" - /*'#000000'*/ -]; -const JBrowseThemeMarkCommonStyle = { - color: NOMINAL_COLOR$4[0], - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR$4, - quantitativeSizeRange: [2, 6] -}; -const jbrowse = { - base: "jbrowse", - root: { - background: "white", - titleColor: "white", - titleFontSize: 20, - titleFontFamily: "Roboto", - titleAlign: "middle", - titleFontWeight: "normal", - titleBackgroundColor: "#0b243f", - subtitleColor: "white", - subtitleFontSize: 18, - subtitleFontFamily: "Roboto", - subtitleAlign: "middle", - subtitleFontWeight: "normal", - subtitleBackgroundColor: "#732162", - showMousePosition: true, - mousePositionColor: "#000000" - }, - track: { - background: "white", - alternatingBackground: "white", - //titleFontSize:'', - titleAlign: "middle", - titleColor: "white", - titleBackground: "#0B243F", - outline: "black", - outlineWidth: 1 - }, - legend: { - position: "top", - background: "white", - backgroundOpacity: 0.7, - labelColor: "#DCA326", - //labelFontSize: '', - labelFontWeight: "bold", - labelFontFamily: "Roboto", - backgroundStroke: "#black", - tickColor: "black" - }, - axis: { - tickColor: "black", - labelColor: "#DCA326", - //labelFontSize: '', - labelFontWeight: "bold", - labelFontFamily: "Roboto", - baselineColor: "black", - gridColor: "#c5d5d9", - gridStrokeWidth: 1 - //, - //gridStrokeType: '', - //gridStrokeDash: - }, - markCommon: { - ...JBrowseThemeMarkCommonStyle - }, - point: { - ...JBrowseThemeMarkCommonStyle, - size: 3 - }, - rect: { - ...JBrowseThemeMarkCommonStyle - }, - triangle: { - ...JBrowseThemeMarkCommonStyle - }, - area: { - ...JBrowseThemeMarkCommonStyle - }, - line: { - ...JBrowseThemeMarkCommonStyle - }, - bar: { - ...JBrowseThemeMarkCommonStyle - }, - rule: { - ...JBrowseThemeMarkCommonStyle, - strokeWidth: 1 - }, - link: { - ...JBrowseThemeMarkCommonStyle, - strokeWidth: 1 - }, - text: { - ...JBrowseThemeMarkCommonStyle, - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - ...JBrowseThemeMarkCommonStyle, - color: "#c5d5d9", - opacity: 0.3, - stroke: "black", - strokeWidth: 1 - } -}; -const NOMINAL_COLOR$3 = [ - "#3A5FCD", - "#FFA54E", - "#8FBC8F", - "#B6709B", - "#EE6A50", - "#CCB79E", - "#DADA8F", - "#00CDCC", - "#EED5D2", - "#CD8EDD", - "#9ACD31", - "#D1BEA8", - "#FFB6C0" - /*'#000000'*/ -]; -const UCSCThemeMarkCommonStyle = { - color: NOMINAL_COLOR$3[0], - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR$3, - quantitativeSizeRange: [2, 6] -}; -const ucsc = { - base: "ucsc", - root: { - background: "white", - titleColor: "white", - titleFontSize: 22, - //titleFontFamily:'', - titleAlign: "middle", - titleFontWeight: "bold", - titleBackgroundColor: "#00457c", - subtitleColor: "black", - //subtitleFontSize:'', - //subtitleFontFamily:'', - subtitleAlign: "middle", - subtitleFontWeight: "bold", - subtitleBackgroundColor: "white", - showMousePosition: true, - mousePositionColor: "#FE0000" - }, - track: { - background: "white", - alternatingBackground: "#e3f7fc", - titleColor: "#3A5FCD", - titleBackground: "white", - //titleFontSize:'', - //titleAlign:'', - outline: "black", - outlineWidth: 1 - }, - legend: { - position: "top", - background: "white", - backgroundOpacity: 0.7, - labelColor: "black", - //labelFontSize: '', - labelFontWeight: "bold", - //labelFontFamily: '', - backgroundStroke: "#DBDBDB", - tickColor: "black" - }, - axis: { - tickColor: "black", - labelColor: "#3A5FCD", - //labelFontSize: '', - labelFontWeight: "bold", - //labelFontFamily: '', - baselineColor: "black", - gridColor: "#E3E3E3", - gridStrokeWidth: 1 - //, - //gridStrokeType: '', - //gridStrokeDash: - }, - markCommon: { - ...UCSCThemeMarkCommonStyle - }, - point: { - ...UCSCThemeMarkCommonStyle, - size: 3 - }, - rect: { - ...UCSCThemeMarkCommonStyle - }, - triangle: { - ...UCSCThemeMarkCommonStyle - }, - area: { - ...UCSCThemeMarkCommonStyle - }, - line: { - ...UCSCThemeMarkCommonStyle - }, - bar: { - ...UCSCThemeMarkCommonStyle - }, - rule: { - ...UCSCThemeMarkCommonStyle, - strokeWidth: 1 - }, - link: { - ...UCSCThemeMarkCommonStyle, - strokeWidth: 1 - }, - text: { - ...UCSCThemeMarkCommonStyle, - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - ...UCSCThemeMarkCommonStyle, - color: "gray", - opacity: 0.3, - stroke: "black", - strokeWidth: 1 - } -}; -const NOMINAL_COLOR$2 = [ - "#6E12AC", - "#15C250", - "#E70FB1", - "#FF8E55", - "#A3B8F3", - "#DE5E59", - "#77AAAA", - "#F5CCCA" - /*'#000000'*/ -]; -const WashUThemeMarkCommonStyle = { - color: NOMINAL_COLOR$2[0], - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR$2, - quantitativeSizeRange: [2, 6] -}; -const washu = { - base: "washu", - root: { - background: "white", - titleColor: "gray", - //titleFontSize:16, - //titleFontFamily:'', - titleAlign: "left", - titleFontWeight: "normal", - titleBackgroundColor: "white", - subtitleColor: "lightgray", - //subtitleFontSize:12, - //subtitleFontFamily:'', - subtitleAlign: "left", - subtitleFontWeight: "light", - subtitleBackgroundColor: "white", - showMousePosition: true, - mousePositionColor: "#000000" - }, - track: { - background: "white", - //alternatingBackground:'', - titleColor: "gray", - titleBackground: "white", - //titleFontSize:'', - titleAlign: "left", - outline: "gray", - outlineWidth: 1 - }, - legend: { - background: "white", - backgroundOpacity: 0.5, - labelColor: "gray", - //labelFontSize: '', - labelFontWeight: "light", - //labelFontFamily: '', - backgroundStroke: "#DBDBDB", - tickColor: "gray" - }, - axis: { - tickColor: "lightgray", - labelColor: "gray", - //labelFontSize: '', - labelFontWeight: "light", - //labelFontFamily: '', - baselineColor: "gray", - gridColor: "transparent", - gridStrokeWidth: 0 - //, - //gridStrokeType: '', - //gridStrokeDash: - }, - markCommon: { - ...WashUThemeMarkCommonStyle - }, - point: { - ...WashUThemeMarkCommonStyle, - size: 3 - }, - rect: { - ...WashUThemeMarkCommonStyle - }, - triangle: { - ...WashUThemeMarkCommonStyle - }, - area: { - ...WashUThemeMarkCommonStyle - }, - line: { - ...WashUThemeMarkCommonStyle - }, - bar: { - ...WashUThemeMarkCommonStyle - }, - rule: { - ...WashUThemeMarkCommonStyle, - strokeWidth: 1 - }, - link: { - ...WashUThemeMarkCommonStyle, - strokeWidth: 1 - }, - text: { - ...WashUThemeMarkCommonStyle, - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - ...WashUThemeMarkCommonStyle, - color: "gray", - opacity: 0.3, - stroke: "gray", - strokeWidth: 1 - } -}; -const NOMINAL_COLOR$1 = [ - "#ED7D31", - "#4472C4", - "#FFC207", - "#76AE4F", - "#9E480E", - "#A5A5A5", - "#4472C4", - "#264378", - "#76AE4F", - "#5B9CD5" - /*'#000000'*/ -]; -const ExcelThemeMarkCommonStyle = { - color: NOMINAL_COLOR$1[0], - size: 1, - stroke: "#5A5A5A", - strokeWidth: 0, - opacity: 1, - nominalColorRange: NOMINAL_COLOR$1, - quantitativeSizeRange: [2, 6] -}; -const excel = { - base: "excel", - root: { - background: "white", - titleColor: "#5A5A5A", - titleFontSize: 30, - titleFontFamily: "Calibri", - titleAlign: "middle", - titleFontWeight: "bold", - titleBackgroundColor: "white", - subtitleColor: "#5A5A5A", - subtitleFontSize: 22, - subtitleFontFamily: "Calibri", - subtitleAlign: "middle", - subtitleFontWeight: "bold", - subtitleBackgroundColor: "white", - showMousePosition: true, - mousePositionColor: "#000000" - }, - track: { - background: "white", - alternatingBackground: "#f5f5f5", - titleColor: "#5A5A5A", - titleBackground: "white", - //titleFontSize:'', - //titleAlign:'', - outline: "#5A5A5A", - outlineWidth: 1 - }, - legend: { - position: "right", - tickColor: "#5A5A5A", - labelColor: "#5A5A5A", - labelFontSize: 12, - labelFontWeight: "bold", - labelFontFamily: "Calibri", - background: "white", - backgroundOpacity: 0.7, - backgroundStroke: "#5A5A5A" - }, - axis: { - tickColor: "#5A5A5A", - labelColor: "#5A5A5A", - //labelFontSize: '', - //labelFontWeight: '', - labelFontFamily: "Calibri", - baselineColor: "#5A5A5A", - gridColor: "#5A5A5A", - gridStrokeWidth: 1 - //gridStrokeType: '', - //gridStrokeDash: - }, - markCommon: { - ...ExcelThemeMarkCommonStyle - }, - point: { - ...ExcelThemeMarkCommonStyle, - size: 3 - }, - rect: { - ...ExcelThemeMarkCommonStyle - }, - triangle: { - ...ExcelThemeMarkCommonStyle - }, - area: { - ...ExcelThemeMarkCommonStyle - }, - line: { - ...ExcelThemeMarkCommonStyle - }, - bar: { - ...ExcelThemeMarkCommonStyle - }, - rule: { - ...ExcelThemeMarkCommonStyle, - strokeWidth: 1 - }, - link: { - ...ExcelThemeMarkCommonStyle, - strokeWidth: 1 - }, - text: { - ...ExcelThemeMarkCommonStyle, - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - ...ExcelThemeMarkCommonStyle, - color: "#5A5A5A", - opacity: 0.3, - stroke: "#5A5A5A", - strokeWidth: 1 - } -}; -const NOMINAL_COLOR = [ - "#4185f4", - "#DB4437", - "#F4B400", - "#0D9D58", - "#AA30C3", - "#FF6E02", - "#CBC74C" - /*'#000000'*/ -]; -const GoogleThemeMarkCommonStyle = { - color: NOMINAL_COLOR[0], - size: 2, - stroke: "black", - strokeWidth: 0.3, - opacity: 1, - nominalColorRange: NOMINAL_COLOR, - quantitativeSizeRange: [2, 6] -}; -const google = { - base: "google", - root: { - background: "white", - titleColor: "#454545", - titleFontSize: 20, - titleFontFamily: "Arial", - titleAlign: "left", - titleFontWeight: "normal", - titleBackgroundColor: "white", - subtitleColor: "#7d7d7d", - subtitleFontSize: 16, - subtitleFontFamily: "Arial", - subtitleAlign: "left", - subtitleFontWeight: "light", - subtitleBackgroundColor: "white", - showMousePosition: true, - mousePositionColor: "#000000" - }, - track: { - background: "white", - alternatingBackground: "#f5f5f5", - titleColor: "#e8e8e8", - titleBackground: "white", - titleFontSize: 12, - titleAlign: "left", - outline: "black", - outlineWidth: 1 - }, - legend: { - position: "right", - background: "white", - backgroundOpacity: 1, - labelColor: "black", - labelFontSize: 12, - labelFontWeight: "normal", - labelFontFamily: "Arial", - backgroundStroke: "black", - tickColor: "black" - }, - axis: { - labelFontSize: 12, - labelFontWeight: "normal", - labelFontFamily: "Arial", - tickColor: "black", - labelColor: "black", - baselineColor: "black", - gridColor: "black", - gridStrokeWidth: 1 - //, - //gridStrokeType: '', - //gridStrokeDash: - }, - markCommon: { - ...GoogleThemeMarkCommonStyle - }, - point: { - ...GoogleThemeMarkCommonStyle, - size: 3 - }, - rect: { - ...GoogleThemeMarkCommonStyle - }, - triangle: { - ...GoogleThemeMarkCommonStyle - }, - area: { - ...GoogleThemeMarkCommonStyle - }, - line: { - ...GoogleThemeMarkCommonStyle - }, - bar: { - ...GoogleThemeMarkCommonStyle - }, - rule: { - ...GoogleThemeMarkCommonStyle, - strokeWidth: 1 - }, - link: { - ...GoogleThemeMarkCommonStyle, - strokeWidth: 1 - }, - text: { - ...GoogleThemeMarkCommonStyle, - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - ...GoogleThemeMarkCommonStyle, - color: "#999999", - opacity: 0.3, - stroke: "black", - strokeWidth: 0.7 - } -}; -const Themes = { - light, - dark, - warm, - ggplot, - igv, - ensembl, - jbrowse, - ucsc, - washu, - excel, - google -}; -function isThereTheme(key) { - return Object.keys(Themes).indexOf(key) !== -1; -} -function getTheme$1(key) { - return isThereTheme(key) ? Themes[key] : Themes["light"]; -} -function createPluginTrack(config2, factory2) { - var _a; - function Track(...args) { - if (!new.target) { - throw new Error('Uncaught TypeError: Class constructor cannot be invoked without "new"'); - } - return factory2(...args); - } - Track.config = { - ...config2, - availableOptions: Object.keys((_a = config2.defaultOptions) != null ? _a : {}) - }; - return Track; -} -const TICK_WIDTH = 200; -const TICK_HEIGHT = 6; -const TICK_TEXT_SEPARATION = 2; -const TICK_COLOR = 7829367; -const icon$1 = ' '; -const config$3 = { - type: "axis-track", - datatype: ["multivec", "epilogos"], - local: false, - orientation: "1d-horizontal", - thumbnail: new DOMParser().parseFromString(icon$1, "text/xml").documentElement, - defaultOptions: { - innerRadius: 340, - outerRadius: 310, - startAngle: 0, - endAngle: 360, - width: 700, - height: 700, - layout: "linear", - labelMargin: 5, - excludeChrPrefix: false, - labelPosition: "none", - labelColor: "black", - labelTextOpacity: 0.4, - trackBorderWidth: 0, - trackBorderColor: "black", - tickPositions: "even", - fontSize: 12, - fontFamily: "sans-serif", - // 'Arial', - fontWeight: "normal", - color: "#808080", - stroke: "#ffffff", - backgroundColor: "transparent", - showMousePosition: false, - tickColor: TICK_COLOR - } -}; -const factory$2 = (HGC, context, options) => { - const { absToChr, colorToHex: colorToHex2, pixiTextToSvg, svgLine, showMousePosition } = HGC.utils; - function createTickText(text, style) { - return Object.assign(new HGC.libraries.PIXI.Text(text, style), { hashValue: Math.random() }); - } - class AxisTrackClass extends HGC.tracks.PixiTrack { - constructor() { - super(context, options); - __publicField(this, "allTexts"); - __publicField(this, "searchField"); - __publicField(this, "chromInfo"); - __publicField(this, "dataConfig"); - __publicField(this, "pTicksCircular"); - __publicField(this, "pTicks"); - __publicField(this, "gTicks"); - __publicField(this, "tickTexts"); - __publicField(this, "isShowGlobalMousePosition"); - __publicField(this, "pixiTextConfig"); - __publicField(this, "stroke"); - __publicField(this, "tickWidth"); - __publicField(this, "tickHeight"); - __publicField(this, "tickTextSeparation"); - __publicField(this, "tickColor"); - __publicField(this, "animate"); - __publicField(this, "hideMousePosition"); - __publicField(this, "gBoundTicks"); - __publicField(this, "leftBoundTick"); - __publicField(this, "rightBoundTick"); - __publicField(this, "is2d"); - __publicField(this, "texts"); - const { dataConfig, animate, chromInfoPath, isShowGlobalMousePosition } = context; - this.searchField = null; - this.dataConfig = dataConfig; - this.allTexts = []; - this.pTicksCircular = new HGC.libraries.PIXI.Graphics(); - this.pTicks = new HGC.libraries.PIXI.Graphics(); - this.pMain.addChild(this.pTicks); - this.pMain.addChild(this.pTicksCircular); - this.gTicks = {}; - this.tickTexts = {}; - this.options = options; - this.isShowGlobalMousePosition = isShowGlobalMousePosition; - this.pixiTextConfig = getTextStyle({ - size: +this.options.fontSize, - fontFamily: this.options.fontFamily, - fontWeight: this.options.fontWeight, - color: this.options.color, - stroke: this.options.stroke, - strokeThickness: 2 - }); - this.stroke = colorToHex2(this.pixiTextConfig.stroke); - this.tickWidth = TICK_WIDTH; - this.tickHeight = TICK_HEIGHT; - this.tickTextSeparation = TICK_TEXT_SEPARATION; - this.tickColor = colorToHex2(this.options.tickColor); - this.animate = animate; - this.pubSubs = []; - if (this.options.showMousePosition && !this.hideMousePosition) { - this.hideMousePosition = showMousePosition(this, this.is2d, this.isShowGlobalMousePosition()); - } - let chromSizesPath = chromInfoPath; - if (!chromSizesPath) { - chromSizesPath = `${dataConfig.server}/chrom-sizes/?id=${dataConfig.tilesetUid}`; - } - const assembly = this.options.assembly; - const chrPositions = {}; - const chromLengths = { ...computeChromSizes(assembly).size }; - const cumPositions = []; - Object.keys(computeChromSizes(assembly).size).forEach((k) => { - chrPositions[k] = { chr: k, pos: computeChromSizes(assembly).size[k] }; - }); - Object.keys(computeChromSizes(assembly).interval).forEach((k) => { - cumPositions.push({ chr: k, pos: computeChromSizes(assembly).interval[k][0] }); - }); - this.chromInfo = { chrPositions, chromLengths, cumPositions }; - this.rerender(this.options, true); - this.draw(); - this.animate(); - } - initBoundsTicks() { - if (this.pTicks) { - this.pMain.removeChild(this.pTicks); - this.pTicks = null; - } - if (!this.gBoundTicks) { - this.gBoundTicks = new HGC.libraries.PIXI.Graphics(); - this.leftBoundTick = createTickText("", this.pixiTextConfig); - this.rightBoundTick = createTickText("", this.pixiTextConfig); - this.gBoundTicks.addChild(this.leftBoundTick); - this.gBoundTicks.addChild(this.rightBoundTick); - this.pMain.addChild(this.gBoundTicks); - } - this.texts = []; - } - initChromLabels() { - if (!this.chromInfo) - return; - if (this.gBoundTicks) { - this.pMain.removeChild(this.gBoundTicks); - this.gBoundTicks = void 0; - } - if (!this.pTicks) { - this.pTicks = new HGC.libraries.PIXI.Graphics(); - this.pMain.addChild(this.pTicks); - } - this.texts = []; - this.pTicks.removeChildren(); - this.chromInfo.cumPositions.forEach((info) => { - var _a, _b, _c; - const chromName = info.chr; - this.gTicks[chromName] = new HGC.libraries.PIXI.Graphics(); - if (!this.tickTexts[chromName]) - this.tickTexts[chromName] = []; - const chromNameText = this.options.excludeChrPrefix ? chromName.replace("chr", "") : chromName; - const text = createTickText(chromNameText, this.pixiTextConfig); - (_a = this.pTicks) == null ? void 0 : _a.addChild(text); - (_b = this.pTicks) == null ? void 0 : _b.addChild(this.gTicks[chromName]); - (_c = this.texts) == null ? void 0 : _c.push(text); - }); - } - rerender(options2, force) { - const strOptions = JSON.stringify(options2); - if (!force && strOptions === this.prevOptions) - return; - this.prevOptions = strOptions; - this.options = options2; - this.pixiTextConfig.fontSize = +this.options.fontSize ? `${+this.options.fontSize}px` : this.pixiTextConfig.fontSize; - this.pixiTextConfig.fill = this.options.color || this.pixiTextConfig.fill; - this.pixiTextConfig.stroke = this.options.stroke || this.pixiTextConfig.stroke; - this.stroke = colorToHex2(this.pixiTextConfig.stroke); - this.tickColor = this.options.tickColor ? colorToHex2(this.options.tickColor) : TICK_COLOR; - if (this.options.tickPositions === "ends" && this.options.layout !== "circular") { - this.initBoundsTicks(); - } else { - this.initChromLabels(); - } - super.rerender(options2, force); - if (this.options.showMousePosition && !this.hideMousePosition) { - this.hideMousePosition = showMousePosition(this, this.is2d, this.isShowGlobalMousePosition()); - } - if (!this.options.showMousePosition && this.hideMousePosition) { - this.hideMousePosition(); - this.hideMousePosition = void 0; - } - } - formatTick(pos) { - if (isNaN(pos)) { - return "null"; - } - const domain = this._xScale.domain(); - const viewWidth = domain[1] - domain[0]; - const p = precisionPrefix(pos, viewWidth); - const fPlain = format(","); - const fPrecision = formatPrefix(`,.${p}`, viewWidth); - let f = fPlain; - if (this.options.tickFormat === "si") { - f = fPrecision; - } else if (this.options.tickFormat === "plain") { - f = fPlain; - } else if (this.options.tickPositions === "ends") { - f = fPrecision; - } - return f(pos); - } - /** Show two labels at the end of both left and right sides */ - drawBoundsTicks(x1, x2) { - if (!this.gBoundTicks || !this.leftBoundTick || !this.rightBoundTick) - return; - const graphics = this.gBoundTicks; - graphics.clear(); - graphics.lineStyle(1, 0); - const lineYStart = this.options.reverseOrientation ? 0 : this.dimensions[1]; - const lineYEnd = this.options.reverseOrientation ? this.tickHeight : this.dimensions[1] - this.tickHeight; - graphics.moveTo(1, lineYStart); - graphics.lineTo(1, lineYEnd); - graphics.moveTo(this.dimensions[0] - 1, lineYStart); - graphics.lineTo(this.dimensions[0] - 1, lineYEnd); - this.leftBoundTick.x = 0; - this.leftBoundTick.y = this.options.reverseOrientation ? lineYEnd + this.tickTextSeparation : lineYEnd - this.tickTextSeparation; - this.leftBoundTick.text = this.options.assembly === "unknown" ? `${this.formatTick(x1[1])}` : `${x1[0]}: ${this.formatTick(x1[1])}`; - this.leftBoundTick.anchor.y = this.options.reverseOrientation ? 0 : 1; - this.rightBoundTick.x = this.dimensions[0]; - this.rightBoundTick.text = this.options.assembly === "unknown" ? `${this.formatTick(x2[1])}` : `${x2[0]}: ${this.formatTick(x2[1])}`; - this.rightBoundTick.y = this.options.reverseOrientation ? lineYEnd + this.tickTextSeparation : lineYEnd - this.tickTextSeparation; - this.rightBoundTick.anchor.y = this.options.reverseOrientation ? 0 : 1; - this.rightBoundTick.anchor.x = 1; - if (this.flipText) { - this.leftBoundTick.scale.x = -1; - this.leftBoundTick.anchor.x = 1; - this.rightBoundTick.scale.x = -1; - this.rightBoundTick.anchor.x = 0; - } - this.leftBoundTick.tickLine = [1, this.dimensions[1], 1, this.dimensions[1] - this.tickHeight]; - this.rightBoundTick.tickLine = [ - this.dimensions[0] - 1, - this.dimensions[1], - this.dimensions[0] - 1, - this.dimensions[1] - this.tickHeight - ]; - this.tickTexts = {}; - this.tickTexts.all = [this.leftBoundTick, this.rightBoundTick]; - } - drawTicks(cumPos) { - const graphics = this.gTicks[cumPos.chr]; - graphics.visible = true; - graphics.clear(); - const chromLen = +this.chromInfo.chromLengths[cumPos.chr]; - const vpLeft = Math.max(this._xScale(cumPos.pos), 0); - const vpRight = Math.min(this._xScale(cumPos.pos + chromLen), this.dimensions[0]); - const numTicks = (vpRight - vpLeft) / this.tickWidth; - const xScale = scaleLinear().domain([ - Math.max(1, this._xScale.invert(0) - cumPos.pos), - Math.min(chromLen, this._xScale.invert(this.dimensions[0]) - cumPos.pos) - ]).range([vpLeft, vpRight]); - const ticks = xScale.ticks(numTicks).filter((tick) => Number.isInteger(tick)); - const tickTexts = this.tickTexts[cumPos.chr]; - const tickHeight = this.tickHeight; - const xPadding = 0; - let yPadding = tickHeight + this.tickTextSeparation; - if (this.options.reverseOrientation) { - yPadding = this.dimensions[1] - yPadding; - } - while (tickTexts.length < ticks.length) { - const newText = createTickText("", this.pixiTextConfig); - tickTexts.push(newText); - this.gTicks[cumPos.chr].addChild(newText); - } - while (tickTexts.length > ticks.length) { - const text = tickTexts.pop(); - this.gTicks[cumPos.chr].removeChild(text); - } - let i = 0; - while (i < ticks.length) { - tickTexts[i].visible = true; - tickTexts[i].anchor.x = 0.5; - tickTexts[i].anchor.y = this.options.layout === "circular" ? 0 : this.options.reverseOrientation ? 0 : 1; - if (this.flipText) - tickTexts[i].scale.x = -1; - const chrText = this.options.assembly === "unknown" ? "" : `${cumPos.chr}: `; - tickTexts[i].text = ticks[i] === 0 ? `${chrText}1` : `${chrText}${this.formatTick(ticks[i])}`; - const x = this._xScale(cumPos.pos + ticks[i]); - if (this.options.layout === "circular") { - const rope = this.addCurvedText(tickTexts[i], x + xPadding); - rope && this.pTicksCircular.addChild(rope); - } else { - tickTexts[i].x = x + xPadding; - tickTexts[i].y = this.dimensions[1] - yPadding; - tickTexts[i].tickLine = [x - 1, this.dimensions[1], x - 1, this.dimensions[1] - tickHeight - 1]; - const lineYStart = this.options.reverseOrientation ? 0 : this.dimensions[1]; - const lineYEnd = this.options.reverseOrientation ? tickHeight : this.dimensions[1] - tickHeight; - graphics.lineStyle(1, this.tickColor); - graphics.moveTo(x, lineYStart); - graphics.lineTo(x, lineYEnd); - } - i += 1; - } - if (this.options.layout === "circular") - i = 0; - while (i < tickTexts.length) { - tickTexts[i].visible = false; - i += 1; - } - return ticks.length; - } - addCurvedText(textObj, cx) { - const [width, height] = this.dimensions; - const { startAngle, endAngle } = this.options; - const factor = Math.min(width, height) / Math.min(this.options.width, this.options.height); - const innerRadius = this.options.innerRadius * factor; - const outerRadius = this.options.outerRadius * factor; - const r = (outerRadius + innerRadius) / 2; - const centerPos = cartesianToPolar(cx, width, r, width / 2, height / 2, startAngle, endAngle); - textObj.x = centerPos.x; - textObj.y = centerPos.y; - textObj.resolution = 4; - const txtStyle = new HGC.libraries.PIXI.TextStyle(this.pixiTextConfig); - const metric = HGC.libraries.PIXI.TextMetrics.measureText(textObj.text, txtStyle); - const tw = metric.width / (2 * r * Math.PI) * width * 360 / (endAngle - startAngle); - let [minX, maxX] = [cx - tw / 2, cx + tw / 2]; - if (minX < 0) { - const gap = -minX; - minX = 0; - maxX += gap; - } else if (maxX > width) { - const gap = maxX - width; - maxX = width; - minX -= gap; - } - const ropePoints = []; - const baseR = innerRadius + metric.height / 2 + 3; - for (let i = maxX; i >= minX; i -= tw / 10) { - const p = cartesianToPolar(i, width, baseR, width / 2, height / 2, startAngle, endAngle); - ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y)); - } - if (ropePoints.length === 0) { - return void 0; - } - textObj.updateText(); - const rope = new HGC.libraries.PIXI.SimpleRope(textObj.texture, ropePoints); - return rope; - } - draw() { - this.allTexts = []; - if (!this.texts) - return; - const x1 = absToChr(this._xScale.domain()[0], this.chromInfo); - const x2 = absToChr(this._xScale.domain()[1], this.chromInfo); - if (!x1 || !x2) { - console.warn("Empty chromInfo:", this.dataConfig, this.chromInfo); - return; - } - if (this.options.tickPositions === "ends" && this.options.layout !== "circular") { - if (!this.gBoundTicks) - return; - this.gBoundTicks.visible = true; - this.drawBoundsTicks(x1, x2); - return; - } - if (!this.pTicks) { - return; - } - const circular = this.options.layout === "circular"; - for (let i = 0; i < this.texts.length; i++) { - this.texts[i].visible = false; - this.gTicks[this.chromInfo.cumPositions[i].chr].visible = false; - } - let yPadding = this.tickHeight + this.tickTextSeparation; - if (this.options.reverseOrientation) { - yPadding = this.dimensions[1] - yPadding; - } - Object.keys(this.chromInfo.chrPositions).forEach((chrom) => { - if (this.tickTexts[chrom]) { - this.tickTexts[chrom].forEach((tick) => { - tick.visible = false; - }); - } - }); - this.pTicksCircular.removeChildren(); - for (let i = x1[3]; i <= x2[3]; i++) { - const xCumPos = this.chromInfo.cumPositions[i]; - const midX = xCumPos.pos + this.chromInfo.chromLengths[xCumPos.chr] / 2; - const viewportMidX = this._xScale(midX); - const chrText = this.texts[i]; - chrText.anchor.x = 0.5; - chrText.anchor.y = circular ? 0.5 : this.options.reverseOrientation ? 0 : 1; - let rope; - if (circular) { - rope = this.addCurvedText(chrText, viewportMidX); - if (rope) { - this.pTicksCircular.addChild(rope); - } - } else { - chrText.x = viewportMidX; - chrText.y = this.dimensions[1] - yPadding; - } - chrText.updateTransform(); - if (this.flipText) - chrText.scale.x = -1; - const numTicksDrawn = this.drawTicks(xCumPos); - if (!circular) { - chrText.visible = numTicksDrawn <= 0; - } else { - if (numTicksDrawn > 0) { - rope && this.pTicksCircular.removeChild(rope); - } - } - this.allTexts.push({ - importance: chrText.hashValue, - text: chrText, - rope - }); - } - this.hideOverlaps(this.allTexts); - } - hideOverlaps(allTexts) { - const tree = new RBush(); - allTexts.sort((a, b) => b.importance - a.importance).forEach(({ text, rope }) => { - text.updateTransform(); - const b = text.getBounds(); - const m2 = this.options.labelMargin; - const boxWithMargin = { - minX: b.x - m2, - minY: b.y - m2, - maxX: b.x + b.width + m2 * 2, - maxY: b.y + b.height + m2 * 2 - }; - if (m2 < 0 || !tree.collides(boxWithMargin)) { - tree.insert(boxWithMargin); - } else { - text.visible = false; - if (this.options.layout === "circular" && rope) { - this.pTicksCircular.removeChild(rope); - } - } - }); - } - setPosition(newPosition) { - super.setPosition(newPosition); - [this.pMain.position.x, this.pMain.position.y] = this.position; - } - zoomed(newXScale, newYScale) { - const domainValues = [...newXScale.domain(), ...newYScale.domain()]; - if (domainValues.filter((d) => isNaN(d)).length !== 0) { - return; - } - this.xScale(newXScale); - this.yScale(newYScale); - this.draw(); - } - exportSVG() { - let track = null; - let base = null; - if (super.exportSVG) { - [base, track] = super.exportSVG(); - } else { - base = document.createElement("g"); - track = base; - } - base.setAttribute("class", "chromosome-labels"); - const output = document.createElement("g"); - track.appendChild(output); - output.setAttribute("transform", `translate(${this.position[0]},${this.position[1]})`); - this.allTexts.filter((text) => text.text.visible).forEach((text) => { - const g = pixiTextToSvg(text.text); - output.appendChild(g); - }); - Object.values(this.tickTexts).forEach((texts) => { - texts.filter((x) => x.visible).forEach((text) => { - if (!text.tickLine) - return; - let g = pixiTextToSvg(text); - output.appendChild(g); - g = svgLine( - text.x, - this.options.reverseOrientation ? 0 : this.dimensions[1], - text.x, - this.options.reverseOrientation ? this.tickHeight : this.dimensions[1] - this.tickHeight, - 1, - this.tickColor - ); - const line = document.createElement("line"); - line.setAttribute("x1", String(text.tickLine[0])); - line.setAttribute("y1", String(text.tickLine[1])); - line.setAttribute("x2", String(text.tickLine[2])); - line.setAttribute("y2", String(text.tickLine[3])); - line.setAttribute("style", "stroke: grey"); - output.appendChild(g); - output.appendChild(line); - }); - }); - return [base, track]; - } - } - return new AxisTrackClass(); -}; -const AxisTrack = createPluginTrack(config$3, factory$2); -function BrushTrack(HGC, ...args) { - if (!new.target) { - throw new Error('Uncaught TypeError: Class constructor cannot be invoked without "new"'); - } - class BrushTrackClass extends HGC.tracks.SVGTrack { - constructor(params) { - var _a, _b; - super(...params); - __publicField(this, "circularBrushData"); - __publicField(this, "prevExtent"); - const [context, options] = params; - const { registerViewportChanged, removeViewportChanged, setDomainsCallback } = context; - this.uid = uuid(); - this.options = options; - this.hasFromView = !context.projectionXDomain; - this.removeViewportChanged = removeViewportChanged; - this.setDomainsCallback = setDomainsCallback; - this.viewportXDomain = this.hasFromView ? null : context.projectionXDomain; - this.viewportYDomain = this.hasFromView ? null : [0, 0]; - this.prevExtent = [0, 0]; - this.RR = 0.02; - const extent = [0, Math.PI * 1.7]; - this.circularBrushData = this.getBrushData(extent); - this.brush = arc().innerRadius((_a = this.options.innerRadius) != null ? _a : 100).outerRadius((_b = this.options.outerRadius) != null ? _b : 200); - this.gBrush = this.gMain.append("g").attr("id", `brush-${this.uid}`).selectAll(".brush").data(this.circularBrushData).enter().append("path").attr("class", "brush").attr("d", this.brush).attr("fill", this.options.projectionFillColor).attr("stroke", this.options.projectionStrokeColor).attr( - "fill-opacity", - (d) => d.type === "brush" ? this.options.projectionFillOpacity : 0 - ).attr( - "stroke-opacity", - (d) => d.type === "brush" ? this.options.projectionStrokeOpacity : 0 - ).attr("stroke-width", this.options.strokeWidth).style("pointer-events", "all").style("cursor", (d) => d.cursor).call(this.dragged()); - registerViewportChanged(this.uid, this.viewportChanged.bind(this)); - this.draw(); - } - /** - * Get information for circular brush for given extent of angle. - */ - getBrushData(extent) { - return [ - { - type: "brush", - startAngle: extent[0], - endAngle: extent[1], - cursor: "grab" - }, - { - type: "start", - startAngle: extent[0], - endAngle: extent[0] + this.RR, - cursor: "move" - }, - { - type: "end", - startAngle: extent[1] - this.RR, - endAngle: extent[1], - cursor: "move" - } - ]; - } - cropExtent(extent) { - let [s, e] = extent; - let round = 0; - while (s > Math.PI * 2 || e > Math.PI * 2 || s < 0 || e < 0) { - if (round++ > 10) { - break; - } - if (s > Math.PI * 2 || e > Math.PI * 2) { - s -= Math.PI * 2; - e -= Math.PI * 2; - } else if (s < 0 || e < 0) { - s += Math.PI * 2; - e += Math.PI * 2; - } - } - return [s, e].sort((a, b) => a - b); - } - /** - * Update the position and size of brush. - */ - updateBrush(extent) { - let [s, e] = extent; - if (s <= RADIAN_GAP && e <= RADIAN_GAP || s >= Math.PI * 2 - RADIAN_GAP && e >= Math.PI * 2 - RADIAN_GAP) { - this.gBrush.attr("visibility", "hidden"); - return; - } - if (s < RADIAN_GAP) { - s = RADIAN_GAP; - } - if (s > Math.PI * 2 - RADIAN_GAP) { - s = Math.PI * 2 - RADIAN_GAP; - } - if (e < RADIAN_GAP) { - e = RADIAN_GAP; - } - if (e > Math.PI * 2 - RADIAN_GAP) { - e = Math.PI * 2 - RADIAN_GAP; - } - this.circularBrushData = this.getBrushData(extent); - this.gBrush.data(this.circularBrushData).attr("d", this.brush).attr("visibility", "visible"); - } - /** - * Function to call upon hearing click event on the brush - */ - dragged() { - const start = (event) => { - this.startEvent = event.sourceEvent; - this.prevExtent = [this.circularBrushData[0].startAngle, this.circularBrushData[0].endAngle]; - }; - const drag = (event, d) => { - const [x, y] = this.position; - const [w, h] = this.dimensions; - const endEvent = event.sourceEvent; - const startX = this.startEvent.layerX - x; - const startY = this.startEvent.layerY - y; - const endX = endEvent.layerX - x; - const endY = endEvent.layerY - y; - const radDiff = ( - // radian of the start position - Math.atan2(startX - w / 2, startY - h / 2) - // radian of the current position - Math.atan2(endX - w / 2, endY - h / 2) - ); - let [s, e] = this.prevExtent; - if (d.type === "brush") { - s = s + radDiff; - e = e + radDiff; - if (s < RADIAN_GAP || Math.PI * 2 - RADIAN_GAP < e) { - const sto = RADIAN_GAP - s; - const eto = e - (Math.PI * 2 - RADIAN_GAP); - if (sto > eto) { - e += sto; - s += sto; - } else { - s -= eto; - e -= eto; - } - } - } else if (d.type === "start") { - s = s + radDiff; - } else if (d.type === "end") { - e = e + radDiff; - } - [s, e] = this.cropExtent([s, e]); - if (!this._xScale || !this._yScale) { - return; - } - const scale = (this.options.endAngle - this.options.startAngle) / 360; - const offsetedS = s - this.options.startAngle / 360 * Math.PI * 2; - const offsetedE = e - this.options.startAngle / 360 * Math.PI * 2; - const xDomain = [ - this._xScale.invert(w - w * offsetedE / (Math.PI * 2 * scale)), - this._xScale.invert(w - w * offsetedS / (Math.PI * 2 * scale)) - ]; - const yDomain = this.viewportYDomain; - if (!this.hasFromView) { - this.viewportXDomain = xDomain; - } - this.setDomainsCallback(xDomain, yDomain); - this.updateBrush([s, e]); - }; - return HGC.libraries.d3Drag.drag().on("start", start).on("drag", drag); - } - draw() { - if (!this._xScale || !this.yScale) { - return; - } - if (!this.viewportXDomain || !this.viewportYDomain) { - return; - } - const x0 = this._xScale(this.viewportXDomain[0]); - const x1 = this._xScale(this.viewportXDomain[1]); - const [w] = this.dimensions; - let e = valueToRadian(x0, w, this.options.startAngle, this.options.endAngle) + Math.PI / 2; - let s = valueToRadian(x1, w, this.options.startAngle, this.options.endAngle) + Math.PI / 2; - [s, e] = this.cropExtent([s, e]); - this.updateBrush([s, e]); - } - viewportChanged(viewportXScale, viewportYScale) { - const viewportXDomain = viewportXScale.domain(); - const viewportYDomain = viewportYScale.domain(); - this.viewportXDomain = viewportXDomain; - this.viewportYDomain = viewportYDomain; - this.draw(); - } - remove() { - this.removeViewportChanged(this.uid); - super.remove(); - } - rerender() { - } - zoomed(newXScale, newYScale) { - this.xScale(newXScale); - this.yScale(newYScale); - this.draw(); - } - setPosition(newPosition) { - super.setPosition(newPosition); - this.draw(); - } - setDimensions(newDimensions) { - super.setDimensions(newDimensions); - this.gBrush.attr("transform", `translate(${newDimensions[0] / 2},${newDimensions[1] / 2})`); - this.draw(); - } - } - return new BrushTrackClass(args); -} -const icon = ' '; -BrushTrack.config = { - type: "brush-track", - datatype: ["projection"], - local: false, - // TODO: - projection: true, - orientation: "2d", - thumbnail: new DOMParser().parseFromString(icon, "text/xml").documentElement, - availableOptions: [ - "innerRadius", - "outerRadius", - "startAngle", - "endAngle", - "axisPositionHorizontal", - "projectionFillColor", - "projectionStrokeColor", - "projectionFillOpacity", - "projectionStrokeOpacity", - "strokeWidth" - ], - defaultOptions: { - innerRadius: 100, - outerRadius: 200, - startAngle: 0, - endAngle: 360, - axisPositionHorizontal: "left", - projectionFillColor: "#777", - projectionStrokeColor: "#777", - projectionFillOpacity: 0.3, - projectionStrokeOpacity: 0.7, - strokeWidth: 1 - } -}; -const HIDDEN_BRUSH_EDGE_SIZE = 3; -const BRUSH_STYLE_DEFAULT = { - color: "#777", - stroke: "#777", - strokeWidth: 1, - strokeOpacity: 0.7, - opacity: 0.3 -}; -class LinearBrushModel { - constructor(selection, hgLibraries, style = {}) { - /* graphical elements */ - __publicField(this, "brushSelection"); - __publicField(this, "style"); - /* data */ - __publicField(this, "range"); - __publicField(this, "data"); - /* drag */ - __publicField(this, "startEvent"); - __publicField(this, "prevExtent"); - /* visual parameters */ - __publicField(this, "offset"); - __publicField(this, "size"); - // fixed size of one-dimension of a brush (e.g., height) - /* External libraries that we re-use from HiGlass */ - __publicField(this, "externals"); - __publicField(this, "emitter"); - this.emitter = createNanoEvents(); - this.range = null; - this.prevExtent = [0, 0]; - this.data = this.rangeToData(0, 0); - this.offset = [0, 0]; - this.size = 0; - this.externals = { - d3Selection: hgLibraries.d3Selection, - d3Drag: hgLibraries.d3Drag - }; - this.style = Object.assign({}, BRUSH_STYLE_DEFAULT, style); - this.brushSelection = selection.selectAll(".genomic-range-brush").data(this.data).enter().append("rect").attr("class", "genomic-range-brush").call(this.onDrag()); - } - getRange() { - return this.range; - } - setSize(size) { - this.size = size; - return this; - } - /** - * Update the left and top offsets for drawing the brush. - */ - setOffset(offsetX, offsetY) { - this.offset = [offsetX, offsetY]; - return this; - } - /** - * Update brush data based on the positions of two edges. - */ - updateRange(range) { - if (range) { - this.range = [Math.min(...range), Math.max(...range)]; - this.data = this.rangeToData(...this.range); - } else { - this.range = null; - } - return this; - } - /** - * Update the brush using the internal range value. By default, - * This function calls a render function from gosling-track. - */ - drawBrush(skipApiTrigger = false) { - const [x, y] = this.offset; - const height = this.size; - const getWidth = (d) => Math.abs(d.end - d.start); - this.brushSelection.data(this.data).attr("transform", (d) => `translate(${x + d.start}, ${y + 1})`).attr("width", (d) => `${getWidth(d)}px`).attr("height", `${height - 2}px`).attr("fill", this.style.color).attr("stroke", this.style.stroke).attr("stroke-width", `${this.style.strokeWidth}px`).attr("fill-opacity", (d) => d.type === "body" ? this.style.opacity : 0).attr("stroke-opacity", (d) => d.type === "body" ? this.style.strokeOpacity : 0).attr("cursor", (d) => d.cursor); - this.emitter.emit("brush", this.getRange(), skipApiTrigger); - return this; - } - enable() { - this.brushSelection.attr("pointer-events", "all"); - return this; - } - disable() { - this.brushSelection.attr("pointer-events", "none"); - return this; - } - visible() { - this.brushSelection.attr("visibility", "visible"); - return this; - } - hidden() { - this.brushSelection.attr("visibility", "hidden"); - return this; - } - clear() { - this.updateRange(null).drawBrush().hidden().disable(); - return this; - } - remove() { - this.brushSelection.remove(); - return this; - } - /** - * Based on the extent values, generate a JSON object for the brush. - */ - rangeToData(start, end) { - return [ - { - type: "body", - cursor: "grab", - start, - end - }, - { - type: "start", - cursor: "ew-resize", - start: start - HIDDEN_BRUSH_EDGE_SIZE, - end: start - }, - { - type: "end", - cursor: "ew-resize", - start: end, - end: end + HIDDEN_BRUSH_EDGE_SIZE - } - ]; - } - onDrag() { - const started = (event) => { - this.startEvent = event.sourceEvent; - this.prevExtent = this.range; - }; - const dragged = (event, d) => { - var _a; - const delta = event.sourceEvent.layerX - this.startEvent.layerX; - let [s, e] = (_a = this.prevExtent) != null ? _a : [0, 0]; - if (d.type === "body") { - s += delta; - e += delta; - } else if (d.type === "start") { - s += delta; - } else if (d.type === "end") { - e += delta; - } - this.updateRange([s, e]).drawBrush(); - }; - return this.externals.d3Drag.drag().on("start", started).on("drag", dragged); - } - on(event, callback) { - this.emitter.on(event, callback); - } -} -const isPointInsideDonutSlice = ([x, y], [cx, cy], [innerRadius, outerRadius], [startAngle, endAngle]) => { - const dist = Math.sqrt((x - cx) ** 2 + (y - cy) ** 2); - if (dist < innerRadius || outerRadius < dist) { - return false; - } - const degree = pointsToDegree(x, y, cx, cy); - if (degree < startAngle || endAngle < degree) { - return false; - } - return true; -}; -const isPointNearPoint = ([x1, y1], [x2, y2], radius = 5) => { - return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) < radius; -}; -const isPointInsideRange = ([x1, x2], x) => { - return x1 <= x && x <= x2; -}; -const isCircleWithinRange = (range, x, radius = 5) => { - return isPointInsideRange(range, x - radius) && isPointInsideRange(range, x + radius); -}; -const isAllPointsWithinRange = (range, path) => { - return path.filter((_, i) => i % 2 === 0).every((x) => isPointInsideRange(range, x)); -}; -const isPointNearLine = ([x, y], path, dist = 5) => { - let x1; - let y1; - let x2; - let y2; - let isWithin = false; - for (let i = 0; i < path.length - 2; i += 2) { - x1 = path[i]; - y1 = path[i + 1]; - x2 = path[i + 2]; - y2 = path[i + 3]; - const AB = [x2 - x1, y2 - y1]; - const BE = [x - x2, y - y2]; - const AE = [x - x1, y - y1]; - const AB_BE = AB[0] * BE[0] + AB[1] * BE[1]; - const AB_AE = AB[0] * AE[0] + AB[1] * AE[1]; - let actDist = 0; - if (AB_BE > 0) { - actDist = Math.sqrt((y - y2) ** 2 + (x - x2) ** 2); - } else if (AB_AE < 0) { - actDist = Math.sqrt((y - y1) ** 2 + (x - x1) ** 2); - } else { - actDist = Math.abs(AB[0] * AE[1] - AB[1] * AE[0]) / Math.sqrt(AB[0] ** 2 + AB[1] ** 2); - } - if (actDist < dist) { - isWithin = true; - } - } - return isWithin; -}; -const isPointInPolygon = ([x, y], polygon) => { - let x1; - let y1; - let x2; - let y2; - let isWithin = false; - for (let i = 0, j = polygon.length - 2; i < polygon.length; i += 2) { - x1 = polygon[i]; - y1 = polygon[i + 1]; - x2 = polygon[j]; - y2 = polygon[j + 1]; - if (y1 > y !== y2 > y && x < (x2 - x1) * (y - y1) / (y2 - y1) + x1) { - isWithin = !isWithin; - } - j = i; - } - return isWithin; -}; -class MouseEventModel { - constructor() { - // main data that this model manage - __publicField(this, "data"); - this.data = []; - } - /** - * Access the number of mouse events stored. - */ - size() { - return this.data.length; - } - /** - * Add a new mouse event that is polygon-based. - */ - addPolygonBasedEvent(value, polygon) { - this.data.push({ uid: uuid(), type: "polygon", value, polygon }); - } - /** - * Add a new mouse event that is point-based. - */ - addPointBasedEvent(value, pointAndRadius) { - this.data.push({ uid: uuid(), type: "point", value, polygon: pointAndRadius }); - } - /** - * Add a new mouse event that is line-based. - */ - addLineBasedEvent(value, path) { - this.data.push({ uid: uuid(), type: "line", value, polygon: path }); - } - /** - * Make the data array empty. - */ - clear() { - this.data = []; - } - /** - * Find the first event data that is within the mouse position. - */ - find(x, y, reverse = false) { - const _ = Array.from(this.data); - if (reverse) - _.reverse(); - return _.find((d) => this.isMouseWithin(d, x, y)); - } - /** - * Find all event data that is within the mouse position. - */ - findAll(x, y, reverse = false) { - const _ = Array.from(this.data); - if (reverse) - _.reverse(); - return _.filter((d) => this.isMouseWithin(d, x, y)); - } - /** - * Find all event data that matches the id values in the source and return them. - */ - getSiblings(source, idField) { - const siblings = []; - const sourceUids = Array.from(new Set(source.map((d) => d.uid))); - source.forEach((s) => { - const id = s.value[idField]; - if (id) { - siblings.push(...this.data.filter((_) => _.value[idField] === id && sourceUids.indexOf(_.uid) === -1)); - } - }); - return siblings; - } - /** - * Test if a mouse position is within a given object. - */ - isMouseWithin(data, x, y) { - switch (data.type) { - case "point": - return isPointNearPoint([x, y], data.polygon); - case "line": - return isPointNearLine([x, y], data.polygon); - case "polygon": - default: - return isPointInPolygon([x, y], data.polygon); - } - } - /** - * Find all event data that is within the range along the x-axis. - */ - findAllWithinRange(x1, x2, reverse = false) { - const _ = Array.from(this.data); - if (reverse) - _.reverse(); - return _.filter((d) => this.isWithinRange(d, x1, x2)); - } - /** - * Test if a given object is within an 1D range. - */ - isWithinRange(data, x1, x2) { - switch (data.type) { - case "point": - return isCircleWithinRange([x1, x2], data.polygon[0], data.polygon[2]); - case "line": - case "polygon": - default: - return isAllPointsWithinRange([x1, x2], data.polygon); - } - } -} -const encodedJs$3 = "KCgpID0+IHsKICB2YXIgX19jcmVhdGUgPSBPYmplY3QuY3JlYXRlOwogIHZhciBfX2RlZlByb3AgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiA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iB8IHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpMiArIDIpXSA8PCA2IHwgcmV2TG9va3VwW2I2NC5jaGFyQ29kZUF0KGkyICsgMyldOwogICAgICAgICAgYXJyW2N1ckJ5dGUrK10gPSB0bXAgPj4gMTYgJiAyNTU7CiAgICAgICAgICBhcnJbY3VyQnl0ZSsrXSA9IHRtcCA+PiA4ICYgMjU1OwogICAgICAgICAgYXJyW2N1ckJ5dGUrK10gPSB0bXAgJiAyNTU7CiAgICAgICAgfQogICAgICAgIGlmIChwbGFjZUhvbGRlcnNMZW4gPT09IDIpIHsKICAgICAgICAgIHRtcCA9IHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpMildIDw8IDIgfCByZXZMb29rdXBbYjY0LmNoYXJDb2RlQXQoaTIgKyAxKV0gPj4gNDsKICAgICAgICAgIGFycltjdXJCeXRlKytdID0gdG1wICYgMjU1OwogICAgICAgIH0KICAgICAgICBpZiAocGxhY2VIb2xkZXJzTGVuID09PSAxKSB7CiAgICAgICAgICB0bXAgPSByZXZMb29rdXBbYjY0LmNoYXJDb2RlQXQoaTIpXSA8PCAxMCB8IHJldkxvb2t1cFtiNjQuY2hhckNvZGVBdChpMiArIDEpXSA8PCA0IHwgcmV2TG9va3VwW2I2NC5jaGFyQ29kZUF0KGkyICsgMildID4+IDI7CiAgICAgICAgICBhcnJbY3VyQnl0ZSsrXSA9IHRtcCA+PiA4ICYgMjU1OwogICAgICAgICAgYXJyW2N1ckJ5dGUrK10gPSB0bXAgJiAyNTU7CiAgICAgICAgfQogICAgICAgIHJldHVybiBhcnI7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdHJpcGxldFRvQmFzZTY0KG51bSkgewogICAgICAgIHJldHVybiBsb29rdXBbbnVtID4+IDE4ICYgNjNdICsgbG9va3VwW251bSA+PiAxMiAmIDYzXSArIGxvb2t1cFtudW0gPj4gNiAmIDYzXSArIGxvb2t1cFtudW0gJiA2M107CiAgICAgIH0KICAgICAgZnVuY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YgKDEgPDwgLW5CaXRzKSAtIDE7CiAgICAgICAgcyA+Pj0gLW5CaXRzOwogICAgICAgIG5CaXRzICs9IGVMZW47CiAgICAgICAgZm9yICg7IG5CaXRzID4gMDsgZSA9IGUgKiAyNTYgKyBidWZmZXJbb2Zmc2V0ICsgaV0sIGkgKz0gZCwgbkJpdHMgLT0gOCkgewogICAgICAgIH0KICAgICAgICBtID0gZSAmICgxIDw8IC1uQml0cykgLSAxOwogICAgICAgIGUgPj49IC1uQml0czsKICAgICAgICBuQml0cyArPSBtTGVuOwogICAgICAgIGZvciAoOyBuQml0cyA+IDA7IG0gPSBtICogMjU2ICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9IGQsIG5CaXRzIC09IDgpIHsKICAgICAgICB9CiAgICAgICAgaWYgKGUgPT09IDApIHsKICAgICAgICAgIGUgPSAxIC0gZUJpYXM7CiAgICAgICAgfSBlbHNlIGlmIChlID09PSBlTWF4KSB7CiAgICAgICAgICByZXR1cm4gbSA/IE5hTiA6IChzID8gLTEgOiAxKSAqIEluZmluaXR5OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBtID0gbSArIE1hdGgucG93KDIsIG1MZW4pOwogICAgICAgICAgZSA9IGUgLSBlQmlhczsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIChzID8gLTEgOiAxKSAqIG0gKiBNYXRoLnBvdygyLCBlIC0gbUxlbik7CiAgICAgIH07CiAgICAgIGV4cG9ydHMud3JpdGUgPSBmdW5jdGlvbihidWZmZXIsIHZhbHVlLCBvZmZzZXQsIGlzTEUsIG1MZW4sIG5CeXRlcykgewogICAgICAgIHZhciBlLCBtLCBjOwogICAgICAgIHZhciBlTGVuID0gbkJ5dGVzICogOCAtIG1MZW4gLSAxOwogICAgICAgIHZhciBlTWF4ID0gKDEgPDwgZUxlbikgLSAxOwogICAgICAgIHZhciBlQmlhcyA9IGVNYXggPj4gMTsKICAgICAgICB2YXIgcnQgPSBtTGVuID09PSAyMyA/IE1hdGgucG93KDIsIC0yNCkgLSBNYXRoLnBvdygyLCAtNzcpIDogMDsKICAgICAgICB2YXIgaSA9IGlzTEUgPyAwIDogbkJ5dGVzIC0gMTsKICAgICAgICB2YXIgZCA9IGlzTEUgPyAxIDogLTE7CiAgICAgICAgdmFyIHMgPSB2YWx1ZSA8IDAgfHwgdmFsdWUgPT09IDAgJiYgMSAvIHZhbHVlIDwgMCA/IDEgOiAwOwogICAgICAgIHZhbHVlID0gTWF0aC5hYnModmFsdWUpOwogICAgICAgIGlmIChpc05hTih2YWx1ZSkgfHwgdmFsdWUgPT09IEluZmluaXR5KSB7CiAgICAgICAgICBtID0gaXNOYU4odmFsdWUpID8gMSA6IDA7CiAgICAgICAgICBlID0gZU1heDsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZSA9IE1hdGguZmxvb3IoTWF0aC5sb2codmFsdWUpIC8gTWF0aC5MTjIpOwogICAgICAgICAgaWYgKHZhbHVlICogKGMgPSBNYXRoLnBvdygyLCAtZSkpIDwgMSkgewogICAgICAgICAgICBlLS07CiAgICAgICAgICAgIGMgKj0gMjsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChlICsgZUJpYXMgPj0gMSkgewogICAgICAgICAgICB2YWx1ZSArPSBydCAvIGM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB2YWx1ZSArPSBydCAqIE1hdGgucG93KDIsIDEgLSBlQmlhcyk7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodmFsdWUgKiBjID49IDIpIHsKICAgICAgICAgICAgZSsrOwogICAgICAgICAgICBjIC89IDI7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoZSArIGVCaWFzID49IGVNYXgpIHsKICAgICAgICAgICAgbSA9IDA7CiAgICAgICAgICAgIGUgPSBlTWF4OwogICAgICAgICAgfSBlbHNlIGlmIChlICsgZUJpYXMgPj0gMSkgewogICAgICAgICAgICBtID0gKHZhbHVlICogYyAtIDEpICogTWF0aC5wb3coMiwgbUxlbik7CiAgICAgICAg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ycmF5LnByb3RvdHlwZSk7CiAgICAgICAgICBPYmplY3Quc2V0UHJvdG90eXBlT2YoYXJyLCBwcm90byk7CiAgICAgICAgICByZXR1cm4gYXJyLmZvbygpID09PSA0MjsKICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICB9CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShCdWZmZXI4LnByb3RvdHlwZSwgInBhcmVudCIsIHsKICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgIGdldDogZnVuY3Rpb24oKSB7CiAgICAgICAgICBpZiAoIUJ1ZmZlcjguaXNCdWZmZXIodGhpcykpCiAgICAgICAgICAgIHJldHVybiB2b2lkIDA7CiAgICAgICAgICByZXR1cm4gdGhpcy5idWZmZXI7CiAgICAgICAgfQogICAgICB9KTsKICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KEJ1ZmZlcjgucHJvdG90eXBlLCAib2Zmc2V0IiwgewogICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHsKICAgICAgICAgIGlmICghQnVmZmVyOC5pc0J1ZmZlcih0aGlzKSkKICAgICAgICAgICAgcmV0dXJuIHZvaWQgMDsKICAgICAgICAgIHJldHVybiB0aGlzLmJ5dGVPZmZzZXQ7CiAgICAgICAgfQogICAgICB9KTsKICAgICAgZnVuY3Rpb24gY3JlYXRlQnVmZmVyKGxlbmd0aCkgewogICAgICAgIGlmIChsZW5ndGggPiBLX01BWF9MRU5HVEgpIHsKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCdUaGUgdmFsdWUgIicgKyBsZW5ndGggKyAnIiBpcyBpbnZhbGlkIGZvciBvcHRpb24gInNpemUiJyk7CiAgICAgICAgfQogICAgICAgIGNvbnN0IGJ1ZiA9IG5ldyBVaW50OEFycmF5KGxlbmd0aCk7CiAgICAgICAgT2JqZWN0LnNldFBy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A9PT0gdm9pZCAwKSB7CiAgICAgICAgICBidWYgPSBuZXcgVWludDhBcnJheShhcnJheSwgYnl0ZU9mZnNldCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGJ1ZiA9IG5ldyBVaW50OEFycmF5KGFycmF5LCBieXRlT2Zmc2V0LCBsZW5ndGgpOwogICAgICAgIH0KICAgICAgICBPYmplY3Quc2V0UHJvdG90eXBlT2YoYnVmLCBCdWZmZXI4LnByb3RvdHlwZSk7CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfQogICAgICBmdW5jdGlvbiBmcm9tT2JqZWN0KG9iaikgewogICAgICAgIGlmIChCdWZmZXI4LmlzQnVmZmVyKG9iaikpIHsKICAgICAgICAgIGNvbnN0IGxlbiA9IGNoZWNrZWQob2JqLmxlbmd0aCkgfCAwOwogICAgICAgICAgY29uc3QgYnVmID0gY3JlYXRlQnVmZmVyKGxlbik7CiAgICAgICAgICBpZiAoYnVmLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gYnVmOwogICAgICAgICAgfQogICAgICAgICAgb2JqLmNvcHkoYnVmLCAwLCAwLCBsZW4pOwogICAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai5sZW5ndGggIT09IHZvaWQgMCkgewogICAgICAgICAgaWYgKHR5cGVvZiBvYmoubGVuZ3RoICE9PSAibnVtYmVyIiB8fCBudW1iZXJJc05hTihvYmoubGVuZ3RoKSkgewogICAgICAgICAgICByZXR1cm4gY3JlYXRlQnVmZmVyKDApOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUxpa2Uob2JqKTsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai50eXBlID09PSAiQnVmZmVyIiAmJiBBcnJheS5pc0FycmF5KG9iai5kYXRhKSkgewogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUxpa2Uob2JqLmRhdGEpOwogICAgICAgIH0KICAgICAgfQogICA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b3cgbmV3IFR5cGVFcnJvcignVGhlICJidWYxIiwgImJ1ZjIiIGFyZ3VtZW50cyBtdXN0IGJlIG9uZSBvZiB0eXBlIEJ1ZmZlciBvciBVaW50OEFycmF5Jyk7CiAgICAgICAgfQogICAgICAgIGlmIChhID09PSBiKQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgbGV0IHggPSBhLmxlbmd0aDsKICAgICAgICBsZXQgeSA9IGIubGVuZ3RoOwogICAgICAgIGZvciAobGV0IGkgPSAwLCBsZW4gPSBNYXRoLm1pbih4LCB5KTsgaSA8IGxlbjsgKytpKSB7CiAgICAgICAgICBpZiAoYVtpXSAhPT0gYltpXSkgewogICAgICAgICAgICB4ID0gYVtpXTsKICAgICAgICAgICAgeSA9IGJbaV07CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoeCA8IHkpCiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHkgPCB4KQogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgcmV0dXJuIDA7CiAgICAgIH07CiAgICAgIEJ1ZmZlcjguaXNFbmNvZGluZyA9IGZ1bmN0aW9uIGlzRW5jb2RpbmcoZW5jb2RpbmcpIHsKICAgICAgICBzd2l0Y2ggKFN0cmluZyhlbmNvZGluZykudG9Mb3dlckNhc2UoKSkgewogICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgY2FzZSAidXRmLTgiOgogICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgY2FzZSAibGF0aW4xIjoKICAgICAgICAgIGNhc2UgImJpbmFyeSI6CiAgICAgICAgICBjYXNlICJiYXNlNjQiOgogICAgICAgICAgY2FzZSAidWNzMiI6CiAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICBjYXNlICJ1dGYxNmxlIjoKICAgICAgICAgIGNhc2UgInV0Zi0xNmxlIjoKICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICB9OwogICAgICBCdWZmZXI4LmNvbmNhdCA9IGZ1bmN0aW9uIGNvbmNhdChsaXN0LCBsZW5ndGgpIHsKICAgICAgICBpZiAoIUFycmF5LmlzQXJyYXkobGlzdCkpIHsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJyJsaXN0IiBhcmd1bWVudCBtdXN0IGJlIGFuIEFycmF5IG9mIEJ1ZmZlcnMnKTsKICAgICAgICB9CiAgICAgICAgaWYgKGxpc3QubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICByZXR1cm4gQnVmZmVyOC5hbGxvYygwKTsKICAgICAgICB9CiAgICAgICAgbGV0IGk7CiAgICAgICAgaWYgKGxlbmd0aCA9PT0gdm9pZCAwKSB7CiAgICAgICAgICBsZW5ndGggPSAwOwogICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyArK2kpIHsKICAgICAgICAgICAgbGVuZ3RoICs9IGxpc3RbaV0ubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb25zdCBidWZmZXIgPSBCdWZmZXI4LmFsbG9jVW5zYWZlKGxlbmd0aCk7CiAgICAgICAgbGV0IHBvcyA9IDA7CiAgICAgICAgZm9yIChpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGxldCBidWYgPSBsaXN0W2ldOwogICAgICAgICAgaWYgKGlzSW5zdGFuY2UoYnVmLCBVaW50OEFycmF5KSkgewogICAgICAgICAgICBpZiAocG9zICsgYnVmLmxlbmd0aCA+IGJ1ZmZlci5sZW5ndGgpIHsKICAgICAgICAgICAgICBpZiAoIUJ1ZmZlcjguaXNCdWZmZXIoYnVmKSkKICAgICAgICAgICAgICAgIGJ1ZiA9IEJ1ZmZlcjguZnJvbShidWYpOwogICAgICAgIC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ICAgICAgICBjb25zdCBsZW4gPSBzdHJpbmcubGVuZ3RoOwogICAgICAgIGNvbnN0IG11c3RNYXRjaCA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIGFyZ3VtZW50c1syXSA9PT0gdHJ1ZTsKICAgICAgICBpZiAoIW11c3RNYXRjaCAmJiBsZW4gPT09IDApCiAgICAgICAgICByZXR1cm4gMDsKICAgICAgICBsZXQgbG93ZXJlZENhc2UgPSBmYWxzZTsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBsZW47CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhUb0J5dGVzKHN0cmluZykubGVuZ3RoOwogICAgICAgICAgICBjYXNlICJ1Y3MyIjoKICAgICAgICAgICAgY2FzZSAidWNzLTIiOgogICAgICAgICAgICBjYXNlICJ1dGYxNmxlIjoKICAgICAgICAgICAgY2FzZSAidXRmLTE2bGUiOgogICAgICAgICAgICAgIHJldHVybiBsZW4gKiAyOwogICAgICAgICAgICBjYXNlICJoZXgiOgogICAgICAgICAgICAgIHJldHVybiBsZW4gPj4+IDE7CiAgICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICAgICAgcmV0dXJuIGJhc2U2NFRvQnl0ZXMoc3RyaW5nKS5sZW5ndGg7CiAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgaWYgKGxvd2VyZWRDYXNlKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbXVzdE1hdGNoID8gLTEgOiB1dGY4VG9CeXRlcyhzdHJpbmcpLmxlbmd0aDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgZW5jb2RpbmcgPSAoIiIgKyBlbmNvZGluZykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICBsb3dlcmVkQ2FzZSA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIEJ1ZmZlcjguYnl0ZUxlbmd0aCA9IGJ5dGVMZW5ndGg7CiAgICAgIGZ1bmN0aW9uIHNsb3dUb1N0cmluZyhlbmNvZGluZywgc3RhcnQsIGVuZCkgewogICAgICAgIGxldCBsb3dlcmVkQ2FzZSA9IGZhbHNlOwogICAgICAgIGlmIChzdGFydCA9PT0gdm9pZCAwIHx8IHN0YXJ0IDwgMCkgewogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPiB0aGlzLmxlbmd0aCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kID09PSB2b2lkIDAgfHwgZW5kID4gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kIDw9IDApIHsKICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICB9CiAgICAgICAgZW5kID4+Pj0gMDsKICAgICAgICBzdGFydCA+Pj49IDA7CiAgICAgICAgaWYgKGVuZCA8PSBzdGFydCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoIWVuY29kaW5nKQogICAgICAgICAgZW5jb2RpbmcgPSAidXRmOCI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gaGV4U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICAgIHJldHVybiBhc2NpaVNsaWNlKHRoaXMsIHN0YXJ0LCBlbmQpOwogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBsYXRpbjFTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjE2bGVTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgICAgIGVuY29kaW5nID0gKGVuY29kaW5nICsgIiIpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgbG93ZXJlZENhc2UgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBCdWZmZXI4LnByb3RvdHlwZS5faXNCdWZmZXIgPSB0cnVlOwogICAgICBmdW5jdGlvbiBzd2FwKGIsIG4sIG0pIHsKICAgICAgICBjb25zdCBpID0gYltuXTsKICAgICAgICBiW25dID0gYlttXTsKICAgICAgICBiW21dID0gaTsKICAgICAgfQogICAgICBCdWZmZXI4LnByb3RvdH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KICAgICAgICB9CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsZW47IGkgKz0gOCkgewogICAgICAgICAgc3dhcCh0aGlzLCBpLCBpICsgNyk7CiAgICAgICAgICBzd2FwKHRoaXMsIGkgKyAxLCBpICsgNik7CiAgICAgICAgICBzd2FwKHRoaXMsIGkgKyAyLCBpICsgNSk7CiAgICAgICAgICBzd2FwKHRoaXMsIGkgKyAzLCBpICsgNCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9OwogICAgICBCdWZmZXI4LnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uIHRvU3RyaW5nKCkgewogICAgICAgIGNvbnN0IGxlbmd0aCA9IHRoaXMubGVuZ3RoOwogICAgICAgIGlmIChsZW5ndGggPT09IDApCiAgICAgICAgICByZXR1cm4gIiI7CiAgICAgICAgaWYgKGFyZ3VtZW50cy5sZW5ndGggPT09IDApCiAgICAgICAgICByZXR1cm4gdXRmOFNsaWNlKHRoaXMsIDAsIGxlbmd0aCk7CiAgICAgICAgcmV0dXJuIHNsb3dUb1N0cmluZy5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICB9OwogICAgICBCdWZmZXI4LnByb3RvdHlwZS50b0xvY2FsZVN0cmluZyA9IEJ1ZmZlcjgucHJvdG90eXBlLnRvU3RyaW5nOwogICAgICBCdWZmZXI4LnByb3RvdHlwZS5lcXVhbHMgPSBmdW5jdGlvbiBlcXVhbHMoYikgewogICAgICAgIGlmICghQnVmZmVyOC5pc0J1ZmZlcihiKSkKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoIkFyZ3VtZW50IG11c3QgYmUgYSBCdWZmZXIiKTsKICAgICAgICBpZiAodGhpcyA9PT0gYikKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIHJldHVybiBCdWZmZXI4LmNvbXBhcmUodGhpcywgYikgPT09IDA7CiAgICAgIH07CiAgICAgIEJ1ZmZlcjgucHJvdG90e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09IHZvaWQgMCkgewogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kID09PSB2b2lkIDApIHsKICAgICAgICAgIGVuZCA9IHRhcmdldCA/IHRhcmdldC5sZW5ndGggOiAwOwogICAgICAgIH0KICAgICAgICBpZiAodGhpc1N0YXJ0ID09PSB2b2lkIDApIHsKICAgICAgICAgIHRoaXNTdGFydCA9IDA7CiAgICAgICAgfQogICAgICAgIGlmICh0aGlzRW5kID09PSB2b2lkIDApIHsKICAgICAgICAgIHRoaXNFbmQgPSB0aGlzLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0IDwgMCB8fCBlbmQgPiB0YXJnZXQubGVuZ3RoIHx8IHRoaXNTdGFydCA8IDAgfHwgdGhpc0VuZCA+IHRoaXMubGVuZ3RoKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigib3V0IG9mIHJhbmdlIGluZGV4Iik7CiAgICAgICAgfQogICAgICAgIGlmICh0aGlzU3RhcnQgPj0gdGhpc0VuZCAmJiBzdGFydCA+PSBlbmQpIHsKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgICAgICBpZiAodGhpc1N0YXJ0ID49IHRoaXNFbmQpIHsKICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0ID49IGVuZCkgewogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIHN0YXJ0ID4+Pj0gMDsKICAgICAgICBlbmQgPj4+PSAwOwogICAgICAgIHRoaXNTdGFydCA+Pj49IDA7CiAgICAgICAgdGhpc0VuZCA+Pj49IDA7CiAgICAgICAgaWYgKHRoaXMgPT09IHRhcmdldCkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIGxldCB4ID0gdGhpc0VuZCAtIHRoaXNTdGFydDsKICAgICAgICBsZXQgeSA9IGVuZCAtIHN0YXJ0OwogICAgICAgIGNvbnN0IG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gYnl0ZU9mZnNldCA9ICtieXRlT2Zmc2V0OwogICAgICAgIGlmIChudW1iZXJJc05hTihieXRlT2Zmc2V0KSkgewogICAgICAgICAgYnl0ZU9mZnNldCA9IGRpciA/IDAgOiBidWZmZXIubGVuZ3RoIC0gMTsKICAgICAgICB9CiAgICAgICAgaWYgKGJ5dGVPZmZzZXQgPCAwKQogICAgICAgICAgYnl0ZU9mZnNldCA9IGJ1ZmZlci5sZW5ndGggKyBieXRlT2Zmc2V0OwogICAgICAgIGlmIChieXRlT2Zmc2V0ID49IGJ1ZmZlci5sZW5ndGgpIHsKICAgICAgICAgIGlmIChkaXIpCiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgIGVsc2UKICAgICAgICAgICAgYnl0ZU9mZnNldCA9IGJ1ZmZlci5sZW5ndGggLSAxOwogICAgICAgIH0gZWxzZSBpZiAoYnl0ZU9mZnNldCA8IDApIHsKICAgICAgICAgIGlmIChkaXIpCiAgICAgICAgICAgIGJ5dGVPZmZzZXQgPSAwOwogICAgICAgICAgZWxzZQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAic3RyaW5nIikgewogICAgICAgICAgdmFsID0gQnVmZmVyOC5mcm9tKHZhbCwgZW5jb2RpbmcpOwogICAgICAgIH0KICAgICAgICBpZiAoQnVmZmVyOC5pc0J1ZmZlcih2YWwpKSB7CiAgICAgICAgICBpZiAodmFsLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gYXJyYXlJbmRleE9mKGJ1ZmZlciwgdmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZywgZGlyKTsKICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiB2YWwgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICB2YWwgPSB2YWwgJiAyNTU7CiAgICAgICAgICBpZiAodHlwZW9mIFVpbnQ4QXJyYXkucHJvdG90eXBlLmluZGV4T2YgPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgICAgaWYgKGRpcikgewogICAgICAgICAgICAgIHJldHVybiBVaW50OEFycmF5LnByb3RvdHlwZS5pbmRleE9mLmNhbGwoYnVmZmVyLCB2YWwsIGJ5dGVPZmZzZXQpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHJldHVybiBVaW50OEFycmF5LnByb3RvdHlwZS5sYXN0SW5kZXhPZi5jYWxsKGJ1ZmZlciwgdmFsLCBieXRlT2Zmc2V0KTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGFycmF5SW5kZXhPZihidWZmZXIsIFt2YWxdLCBieXRlT2Zmc2V0LCBlbmNvZGluZywgZGlyKTsKICAgICAgICB9CiAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigidmFsIG11c3QgYmUgc3RyaW5nLCBudW1iZXIgb3IgQnVmZmVyIik7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYXJyYXlJbmRleE9mKGFyciwgdmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZywgZGlyKSB7CiAgICAgICAgbGV0IGluZGV4U2l6ZSA9IDE7CiAgICAgICAgbGV0IGFyckxlbmd0aCA9IGFyci5sZW5ndGg7CiAgICAgICAgbGV0IHZhbExlbmd0aCA9IHZhbC5sZW5ndGg7CiAgICAgICAgaWYgKGVuY29kaW5nICE9PSB2b2lkIDApIHsKICAgICAgICAgIGVuY29kaW5nID0gU3RyaW5nKGVuY29kaW5nKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgaWYgKGVuY29kaW5nID09PSAidWNzMiIgfHwgZW5jb2RpbmcgPT09ICJ1Y3MtMiIgfHwgZW5jb2RpbmcgPT09ICJ1dGYxNmxlIiB8fCBlbmNvZGluZyA9PT0gInV0Zi0xNmxlIikgewogICAgICAgICAgICBpZiAoYXJyLmxlbmd0aCA8IDIgfHwgdmFsLmxlbmd0aCA8IDIpIHsKICAgICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaW5kZXhTaXplID0gMjsKICAgICAgICAgICAgYXJyTGVuZ3RoIC89IDI7CiAgICAgICAgICAgIHZhbExlbmd0aCAvPSAyOwogICAgICAgICAgICBieXRlT2Zmc2V0IC89IDI7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHJlYWQoYnVmLCBpMikgewogICAgICAgICAgaWYgKGluZGV4U2l6ZSA9PT0gMSkgewogICAgICAgICAgICByZXR1cm4gYnVmW2kyXTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiBidWYucmVhZFVJbnQxNkJFKGkyICogaW5kZXhTaXplKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgbGV0IGk7CiAgICAgICAgaWYgKGRpcikgewogICAgICAgICAgbGV0IGZvdW5kSW5kZXggPSAtMTsKICAgICAgICAgIGZvciAoaSA9IGJ5dGVPZmZzZXQ7IGkgPCBhcnJMZW5ndGg7IGkrKykgewogICAgICAgICAgICBpZiAocmVhZChhcnIsIGkpID09PSByZWFkKHZhbCwgZm91bmRJbmRleCA9PT0gLTEgPyAwIDogaSAtIGZvdW5kSW5kZXgpKSB7CiAgICAgICAgICAgICAgaWYgKGZvdW5kSW5kZXggPT09IC0xKQogICAgICAgICAgICAgICAgZm91bmRJbmRleCA9IGk7CiAgICAgICAgICAgICAgaWYgKGkgLSBmb3VuZEluZGV4ICsgMSA9PT0gdmFsTGVuZ3RoKQogICAgICAgICAgICAgICAgcmV0dXJuIGZvdW5kSW5kZXggKiBpbmRleFNpemU7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgaWYgKGZvdW5kSW5kZXggIT09IC0xKQogICAgICAgICAgICAgICAgaSAtPSBpIC0gZm91bmRJbmRleDsKICAgICAgICAgICAgICBmb3VuZEluZGV4ID0gLTE7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKGJ5dGVPZmZzZXQgKyB2YWxMZW5ndGggPiBhcnJMZW5ndGgpCiAgICAgICAgICAgIGJ5dGVPZmZzZXQgPSBhcnJMZW5ndGggLSB2YWxMZW5ndGg7CiAgICAgICAgICBmb3IgKGkgPSBieXRlT2Zmc2V0OyBpID49IDA7IGktLSkgewogICAgICAgICAgICBsZXQgZm91bmQgPSB0cnVlOwogICAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IHZhbExlbmd0aDsgaisrKSB7CiAgICAgICAgICAgICAgaWYgKHJlYWQoYXJyLCBpICsgaikgIT09IHJlYWQodmFsLCBqKSkgewogICAgICAgICAgICAgICAgZm91bmQgPSBmYWxzZTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoZm91bmQpCiAgICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiAtMTsKICAgICAgfQogICAgICBCdWZmZXI4LnByb3RvdHlwZS5pbmNsdWRlcyA9IGZ1bmN0aW9uIGluY2x1ZGVzKHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcpIHsKICAgICAgICByZXR1cm4gdGhpcy5pbmRleE9mKHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcpICE9PSAtMTsKICAgICAgfTsKICAgICAgQnVmZmVyOC5wcm90b3R5cGUuaW5kZXhPZiA9IGZ1bmN0aW9uIGluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBiaWRpcmVjdGlvbmFsSW5kZXhPZih0aGlzLCB2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nLCB0cnVlKTsKICAgICAgfTsKICAgICAgQnVmZmVyOC5wcm90b3R5cGUubGFzdEluZGV4T2YgPSBmdW5jdGlvbiBsYXN0SW5kZXhPZih2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nKSB7CiAgICAgICAgcmV0dXJuIGJpZGlyZWN0aW9uYWxJbmRleE9mKHRoaXMsIHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGZhbHNlKTsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gaGV4V3JpdGUoYnVmLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKSB7CiAgICAgICAgb2Zmc2V0ID0gTnVtYmVyKG9mZnNldCkgfHwgMDsKICAgICAgICBjb25zdCByZW1haW5pbmcgPSBidWYubGVuZ3RoIC0gb2Zmc2V0OwogICAgICAgIGlmICghbGVuZ3RoKSB7CiAgICAgICAgICBsZW5ndGggPSByZW1haW5pbmc7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGxlbmd0aCA9IE51bWJlcihsZW5ndGgpOwogICAgICAgICAgaWYgKGxlbmd0aCA+IHJlbWFpbmluZykgewogICAgICAgICAgICBsZW5ndGggPSByZW1haW5pbmc7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNvbnN0IHN0ckxlbiA9IHN0cmluZy5sZW5ndGg7CiAgICAgICAgaWYgKGxlbmd0aCA+IHN0ckxlbiAvIDIpIHsKICAgICAgICAgIGxlbmd0aCA9IHN0ckxlbiAvIDI7CiAgICAgICAgfQogICAgICAgIGxldCBpOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW5ndGg7ICsraSkgewogICAgICAgICAgY29uc3QgcGFyc2VkID0gcGFyc2VJbnQoc3RyaW5nLnN1YnN0cihpICogMiwgMiksIDE2KTsKICAgICAgICAgIGlmIChudW1iZXJJc05hTihwYXJzZWQpKQogICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgIGJ1ZltvZmZzZXQgKyBpXSA9IHBhcnNlZDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdXRmOFdyaXRlK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ICBpZiAoIWVuY29kaW5nKQogICAgICAgICAgZW5jb2RpbmcgPSAidXRmOCI7CiAgICAgICAgbGV0IGxvd2VyZWRDYXNlID0gZmFsc2U7CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBzd2l0Y2ggKGVuY29kaW5nKSB7CiAgICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICAgICAgcmV0dXJuIGhleFdyaXRlKHRoaXMsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpOwogICAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgICAgY2FzZSAidXRmLTgiOgogICAgICAgICAgICAgIHJldHVybiB1dGY4V3JpdGUodGhpcywgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCk7CiAgICAgICAgICAgIGNhc2UgImFzY2lpIjoKICAgICAgICAgICAgY2FzZSAibGF0aW4xIjoKICAgICAgICAgICAgY2FzZSAiYmluYXJ5IjoKICAgICAgICAgICAgICByZXR1cm4gYXNjaWlXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0V3JpdGUodGhpcywgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCk7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIHVjczJXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICA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eXRlID4gMTkxID8gMiA6IDE7CiAgICAgICAgICBpZiAoaSArIGJ5dGVzUGVyU2VxdWVuY2UgPD0gZW5kKSB7CiAgICAgICAgICAgIGxldCBzZWNvbmRCeXRlLCB0aGlyZEJ5dGUsIGZvdXJ0aEJ5dGUsIHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgIHN3aXRjaCAoYnl0ZXNQZXJTZXF1ZW5jZSkgewogICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgIGlmIChmaXJzdEJ5dGUgPCAxMjgpIHsKICAgICAgICAgICAgICAgICAgY29kZVBvaW50ID0gZmlyc3RCeXRlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgc2Vjb25kQnl0ZSA9IGJ1ZltpICsgMV07CiAgICAgICAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAzMSkgPDwgNiB8IHNlY29uZEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAxMjcpIHsKICAgICAgICAgICAgICAgICAgICBjb2RlUG9pbnQgPSB0ZW1wQ29kZVBvaW50OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICBzZWNvbmRCeXRlID0gYnVmW2kgKyAxXTsKICAgICAgICAgICAgICAgIHRoaXJkQnl0ZSA9IGJ1ZltpICsgMl07CiAgICAgICAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAxOTIpID09PSAxMjggJiYgKHRoaXJkQnl0ZSAmIDE5MikgPT09IDEyOCkgewogICAgICAgICAgICAgICAgICB0ZW1wQ29kZVBvaW50ID0gKGZpcnN0Qnl0ZSAmIDE1KSA8PCAxMiB8IChzZWNvbmRCeXRlICYgNjMpIDw8IDYgfCB0aGlyZEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAyMDQ3ICYmICh0ZW1wQ29kZVBvaW50IDwgNTUyOTYgfHwgdGVtcENvZGVQb2ludCA+IDU3MzQzKSkgewogICAgICAgICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgIHNlY29uZEJ5dGUgPSBidWZbaSArIDFdOwogICAgICAgICAgICAgICAgdGhpcmRCeXRlID0gYnVmW2kgKyAyXTsKICAgICAgICAgICAgICAgIGZvdXJ0aEJ5dGUgPSBidWZbaSArIDNdOwogICAgICAgICAgICAgICAgaWYgKChzZWNvbmRCeXRlICYgMTkyKSA9PT0gMTI4ICYmICh0aGlyZEJ5dGUgJiAxOTIpID09PSAxMjggJiYgKGZvdXJ0aEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAxNSkgPDwgMTggfCAoc2Vjb25kQnl0ZSAmIDYzKSA8PCAxMiB8ICh0aGlyZEJ5dGUgJiA2MykgPDwgNiB8IGZvdXJ0aEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiA2NTUzNSAmJiB0ZW1wQ29kZVBvaW50IDwgMTExNDExMikgewogICAgICAgICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKGNvZGVQb2ludCA9PT0gbnVsbCkgewogICAgICAgICAgICBjb2RlUG9pbnQgPSA2NTUzMzsKICAgICAgICAgICAgYnl0ZXNQZXJTZXF1ZW5jZSA9IDE7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA+IDY1NTM1KSB7CiAgICAgICAgICAgIGNvZGVQb2ludCAtPSA2NTUzNjsKICAgICAgICAgICAgcmVzLnB1c2goY29kZVBvaW50ID4+PiAxMCAmIDEwMjMgfCA1NTI5Nik7CiAgICAgICAgICAgIGNvZGVQb2ludCA9IDU2MzIwIHwgY29kZVBvaW50ICYgMTAyMzsKICAgICAgICAgIH0KICAgICAgICAgIHJlcy5wdXNoKGNvZGVQb2ludCk7CiAgICAgICAgICBpICs9IGJ5dGVzUGVyU2VxdWVuY2U7CiAgICAgICAgfQogICAgICAgIHJldHVybiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkocmVzKTsKICAgICAgfQogICAgICB2YXIgTUFYX0FSR1VNRU5UU19MRU5HVEggPSA0MDk2OwogICAgICBmdW5jdGlvbiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkoY29kZVBvaW50cykgewogICAgICAgIGNvbnN0IGxlbiA9IGNvZGVQb2ludHMubGVuZ3RoOwogICAgICAgIGlmIChsZW4gPD0gTUFYX0FSR1VNRU5UU19MRU5HVEgpIHsKICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cyk7CiAgICAgICAgfQogICAgICAgIGxldCByZXMgPSAiIjsKICAgICAgICBsZXQgaSA9IDA7CiAgICAgICAgd2hpbGUgKGkgPCBsZW4pIHsKICAgICAgICAgIHJlcyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cy5zbGljZShpLCBpICs9IE1BWF9BUkdVTUVOVFNfTEVOR1RIKSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYXNjaWlTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldICYgMTI3KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBsYXRpbjFTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBoZXhTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBjb25zdCBsZW4gPSBidWYubGVuZ3RoOwogICAgICAgIGlmICghc3RhcnQgfHwgc3RhcnQgPCAwKQogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIGlmICghZW5kIHx8IGVuZCA8IDAgfHwgZW5kID4gbGVuKQogICAgICAgICAgZW5kID0gbGVuOwogICAgICAgIGxldCBvdXQgPSAiIjsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgb3V0ICs9IGhleFNsaWNlTG9va3VwVGFibGVbYnVmW2ldXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG91dDsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNmxlU2xpY2U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CBzdGFydCwgZW5kKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgVWludDhBcnJheS5wcm90b3R5cGUuc2V0LmNhbGwodGFyZ2V0LCB0aGlzLnN1YmFycmF5KHN0YXJ0LCBlbmQpLCB0YXJnZXRTdGFydCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBsZW47CiAgICAgIH07CiAgICAgIEJ1ZmZlcjgucHJvdG90eXBlLmZpbGwgPSBmdW5jdGlvbiBmaWxsKHZhbCwgc3RhcnQsIGVuZCwgZW5jb2RpbmcpIHsKICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gInN0cmluZyIpIHsKICAgICAgICAgIGlmICh0eXBlb2Ygc3RhcnQgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIGVuY29kaW5nID0gc3RhcnQ7CiAgICAgICAgICAgIHN0YXJ0ID0gMDsKICAgICAgICAgICAgZW5kID0gdGhpcy5sZW5ndGg7CiAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBlbmQgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIGVuY29kaW5nID0gZW5kOwogICAgICAgICAgICBlbmQgPSB0aGlzLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChlbmNvZGluZyAhPT0gdm9pZCAwICYmIHR5cGVvZiBlbmNvZGluZyAhPT0gInN0cmluZyIpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiZW5jb2RpbmcgbXVzdCBiZSBhIHN0cmluZyIpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHR5cGVvZiBlbmNvZGluZyA9PT0gInN0cmluZyIgJiYgIUJ1ZmZlcjguaXNFbmNvZGluZyhlbmNvZGluZykpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiVW5rbm93biBlbmNvZGluZzogIiArIGVuY29kaW5nKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh2YWwubGVuZ3RoID09PSAxKSB7CiAgICAgICAgICAgIGNvbnN0IGNvZGUgPSB2YWwuY2hhckNvZGVBdCgwKTsKICAgICAgICAgICAgaWYgKGVuY29kaW5nID09PSAidXRmOCIgJiYgY29kZSA8IDEyOCB8fCBlbmNvZGluZyA9PT0gImxhdGluMSIpIHsKICAgICAgICAgICAgICB2YWwgPSBjb2RlOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgdmFsID0gdmFsICYgMjU1OwogICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIHZhbCA9PT0gImJvb2xlYW4iKSB7CiAgICAgICAgICB2YWwgPSBOdW1iZXIodmFsKTsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0IDwgMCB8fCB0aGlzLmxlbmd0aCA8IHN0YXJ0IHx8IHRoaXMubGVuZ3RoIDwgZW5kKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigiT3V0IG9mIHJhbmdlIGluZGV4Iik7CiAgICAgICAgfQogICAgICAgIGlmIChlbmQgPD0gc3RhcnQpIHsKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIH0KICAgICAgICBzdGFydCA9IHN0YXJ0ID4+PiAwOwogICAgICAgIGVuZCA9IGVuZCA9PT0gdm9pZCAwID8gdGhpcy5sZW5ndGggOiBlbmQgPj4+IDA7CiAgICAgICAgaWYgKCF2YWwpCiAgICAgICAgICB2YWwgPSAwOwogICAgICAgIGxldCBpOwogICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgZm9yIChpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgICB0aGlzW2ldID0gdmFsOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBjb25zdCBieXRlcyA9IEJ1ZmZlcjguaXNCdWZmZXIodmFsKSA/IHZhbCA6IEJ1ZmZlcjguZnJvbSh2YWwsIGVuY29kaW5nKTsKICAgICAgICAgIGNvbnN0IGxlbiA9IGJ5dGVzLmxlbmd0aDsKICAgICAgICAgIGlmIChsZW4gPT09IDApIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignVGhlIHZhbHVlICInICsgdmFsICsgJyIgaXMgaW52YWxpZCBmb3IgYXJndW1lbnQgInZhbHVlIicpOwogICAgICAgICAgfQogICAgICAgICAgZm9yIChpID0gMDsgaSA8IGVuZCAtIHN0YXJ0OyArK2kpIHsKICAgICAgICAgICAgdGhpc1tpICsgc3RhcnRdID0gYnl0ZXNbaSAlIGxlbl07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9OwogICAgICB2YXIgZXJyb3JzID0ge307CiAgICAgIGZ1bmN0aW9uIEUoc3ltLCBnZXRNZXNzYWdlLCBCYXNlKSB7CiAgICAgICAgZXJyb3JzW3N5bV0gPSBjbGFzcyBOb2RlRXJyb3IgZXh0ZW5kcyBCYXNlIHsKICAgICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgICBzdXBlcigpOwogICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgIm1lc3NhZ2UiLCB7CiAgICAgICAgICAgICAgdmFsdWU6IGdldE1lc3NhZ2UuYXBwbHkodGhpcywgYXJndW1lbnRzKSwKICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHRoaXMubmFtZSA9IGAke3RoaXMubmFtZX0gWyR7c3ltfV1gOwogICAgICAgICAgICB0aGlzLnN0YWNrOwogICAgICAgICAgICBkZWxldGUgdGhpcy5uYW1lOwogICAgICAgICAgfQogICAgICAgICAgZ2V0IGNvZGUoKSB7CiAgICAgICAgICAgIHJldHVybiBzeW07CiAgICAgICAgICB9CiAgICAgICAgICBzZXQgY29kZSh2YWx1ZSkgewogICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgImNvZGUiLCB7CiAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLAogICAgICAgICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgICAgICAgdmFsdWUsCiAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICAgICAgfSk7CiAgICAgICAgICB9CiAgICAgICAgICB0b1N0cmluZygpIHsKICAgICAgICAgICAgcmV0dXJuIGAke3RoaXMubmFtZX0gWyR7c3ltfV06ICR7dGhpcy5tZXNzYWdlfWA7CiAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgfQogICAgICBFKCJFUlJfQlVGRkVSX09VVF9PRl9CT1VORFMiLCBmdW5jdGlvbihuYW1lKSB7CiAgICAgICAgaWYgKG5hbWUpIHsKICAgICAgICAgIHJldHVybiBgJHtuYW1lfSBpcyBvdXRzaWRlIG9mIGJ1ZmZlciBib3VuZHNgOwogICAgICAgIH0KICAgICAgICByZXR1cm4gIkF0dGVtcHQgdG8gYWNjZXNzIG1lbW9yeSBvdXRzaWRlIGJ1ZmZlciBib3VuZHMiOwogICAgICB9LCBSYW5nZUVycm9yKTsKICAgICAgRSgiRVJSX0lOVkFMSURfQVJHX1RZUEUiLCBmdW5jdGlvbihuYW1lLCBhY3R1YWwpIHsKICAgICAgICByZXR1cm4gYFRoZSAiJHtuYW1lfSIgYXJndW1lbnQgbXVzdCBiZSBvZiB0eXBlIG51bWJlci4gUmVjZWl2ZWQgdHlwZSAke3R5cGVvZiBhY3R1YWx9YDsKICAgICAgfSwgVHlwZUVycm9yKTsKICAgICAgRSgiRVJSX09VVF9PRl9SQU5HRSIsIGZ1bmN0aW9uKHN0ciwgcmFuZ2UsIGlucHV0KSB7CiAgICAgICAgbGV0IG1zZyA9IGBUaGUgdmFsdWUgb2YgIiR7c3RyfSIgaXMgb3V0IG9mIHJhbmdlLmA7CiAgICAgICAgbGV0IHJlY2VpdmVkID0gaW5wdXQ7CiAgICAgICAgaWYgKE51bWJlci5pc0ludGVnZXIoaW5wdXQpICYmIE1hdGguYWJzKGlucHV0KSA+IDIgKiogMzIpIHsKICAgICAgICAgIHJlY2VpdmVkID0gYWRkTnVtZXJpY2FsU2VwYXJhdG9yKFN0cmluZyhpbnB1dCkpOwogICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIGlucHV0ID09PSAiYmlnaW50IikgewogICAgICAgICAgcmVjZWl2ZWQgPSBTdHJpbmcoaW5wdXQpOwogICAgICAgICAgaWYgKGlucHV0ID4gQmlnSW50KDIpICoqIEJpZ0ludCgzMikgfHwgaW5wdXQgPCAtKEJpZ0ludCgyKSAqKiBCaWdJbnQoMzIpKSkgewogICAgICAgICAgICByZWNlaXZlZCA9IGFkZE51bWVyaWNhbFNlcGFyYXRvcihyZWNlaXZlZCk7CiAgICAgICAgICB9CiAgICAgICAgICByZWNlaXZlZCArPSAibiI7CiAgICAgICAgfQogICAgICAgIG1zZyArPSBgIEl0IG11c3QgYmUgJHtyYW5nZX0uIFJlY2VpdmVkICR7cmVjZWl2ZWR9YDsKICAgICAgICByZXR1cm4gbXNnOwogICAgICB9LCBSYW5nZUVycm9yKTsKICAgICAgZnVuY3Rpb24gYWRkTnVtZXJpY2FsU2VwYXJhdG9yKHZhbCkgewogICAgICAgIGxldCByZXMgPSAiIjsKICAgICAgICBsZXQgaSA9IHZhbC5sZW5ndGg7CiAgICAgICAgY29uc3Qgc3RhcnQgPSB2YWxbMF0gPT09ICItIiA/IDEgOiAwOwogICAgICAgIGZvciAoOyBpID49IHN0YXJ0ICsgNDsgaSAtPSAzKSB7CiAgICAgICAgICByZXMgPSBgXyR7dmFsLnNsaWNlKGkgLSAzLCBpKX0ke3Jlc31gOwogICAgICAgIH0KICAgICAgICByZXR1cm4gYCR7dmFsLnNsaWNlKDAsIGkpfSR7cmVzfWA7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gY2hl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BzdHIuc3BsaXQoIj0iKVswXTsKICAgICAgICBzdHIgPSBzdHIudHJpbSgpLnJlcGxhY2UoSU5WQUxJRF9CQVNFNjRfUkUsICIiKTsKICAgICAgICBpZiAoc3RyLmxlbmd0aCA8IDIpCiAgICAgICAgICByZXR1cm4gIiI7CiAgICAgICAgd2hpbGUgKHN0ci5sZW5ndGggJSA0ICE9PSAwKSB7CiAgICAgICAgICBzdHIgPSBzdHIgKyAiPSI7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzdHI7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdXRmOFRvQnl0ZXMoc3RyaW5nLCB1bml0cykgewogICAgICAgIHVuaXRzID0gdW5pdHMgfHwgSW5maW5pdHk7CiAgICAgICAgbGV0IGNvZGVQb2ludDsKICAgICAgICBjb25zdCBsZW5ndGggPSBzdHJpbmcubGVuZ3RoOwogICAgICAgIGxldCBsZWFkU3Vycm9nYXRlID0gbnVsbDsKICAgICAgICBjb25zdCBieXRlcyA9IFtdOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGNvZGVQb2ludCA9IHN0cmluZy5jaGFyQ29kZUF0KGkpOwogICAgICAgICAgaWYgKGNvZGVQb2ludCA+IDU1Mjk1ICYmIGNvZGVQb2ludCA8IDU3MzQ0KSB7CiAgICAgICAgICAgIGlmICghbGVhZFN1cnJvZ2F0ZSkgewogICAgICAgICAgICAgIGlmIChjb2RlUG9pbnQgPiA1NjMxOSkgewogICAgICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgICAgICBieXRlcy5wdXNoKDIzOSwgMTkxLCAxODkpOwogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgfSBlbHNlIGlmIChpICsgMSA9PT0gbGVuZ3RoKSB7CiAgICAgICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpCiAgICAgICAgICAgICAgICAgIGJ5dGVzLnB1c2goMjM5LCAxOTEsIDE4OSk7CiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgbGVhZFN1cnJvZ2F0ZSA9IGNvZGVQb2ludDsKICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY29kZVBvaW50IDwgNTYzMjApIHsKICAgICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpCiAgICAgICAgICAgICAgICBieXRlcy5wdXNoKDIzOSwgMTkxLCAxODkpOwogICAgICAgICAgICAgIGxlYWRTdXJyb2dhdGUgPSBjb2RlUG9pbnQ7CiAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY29kZVBvaW50ID0gKGxlYWRTdXJyb2dhdGUgLSA1NTI5NiA8PCAxMCB8IGNvZGVQb2ludCAtIDU2MzIwKSArIDY1NTM2OwogICAgICAgICAgfSBlbHNlIGlmIChsZWFkU3Vycm9nYXRlKSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkKICAgICAgICAgICAgICBieXRlcy5wdXNoKDIzOSwgMTkxLCAxODkpOwogICAgICAgICAgfQogICAgICAgICAgbGVhZFN1cnJvZ2F0ZSA9IG51bGw7CiAgICAgICAgICBpZiAoY29kZVBvaW50IDwgMTI4KSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMSkgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA8IDIwNDgpIHsKICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAyKSA8IDApCiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIGJ5dGVzLnB1c2goY29kZVBvaW50ID4+IDYgfCAxOTIsIGNvZGVQb2ludCAmIDYzIHwgMTI4KTsKICA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2UpIHsKICAgICAgICAgIHJldHVybiBPYmplY3QuYXNzaWduKEVycm9yKG1lc3NhZ2UubWVzc2FnZSksIHsKICAgICAgICAgICAgbmFtZTogbWVzc2FnZS5uYW1lLAogICAgICAgICAgICBzdGFjazogbWVzc2FnZS5zdGFjawogICAgICAgICAgfSk7CiAgICAgICAgfSwKICAgICAgICBzZXJpYWxpemUoZXJyb3IpIHsKICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIF9fZXJyb3JfbWFya2VyOiAiJCRlcnJvciIsCiAgICAgICAgICAgIG1lc3NhZ2U6IGVycm9yLm1lc3NhZ2UsCiAgICAgICAgICAgIG5hbWU6IGVycm9yLm5hbWUsCiAgICAgICAgICAgIHN0YWNrOiBlcnJvci5zdGFjawogICAgICAgICAgfTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIHZhciBpc1NlcmlhbGl6ZWRFcnJvciA9ICh0aGluZykgPT4gdGhpbmcgJiYgdHlwZW9mIHRoaW5nID09PSAib2JqZWN0IiAmJiAiX19lcnJvcl9tYXJrZXIiIGluIHRoaW5nICYmIHRoaW5nLl9fZXJyb3JfbWFya2VyID09PSAiJCRlcnJvciI7CiAgICAgIGV4cG9ydHMuRGVmYXVsdFNlcmlhbGl6ZXIgPSB7CiAgICAgICAgZGVzZXJpYWxpemUobWVzc2FnZSkgewogICAgICAgICAgaWYgKGlzU2VyaWFsaXplZEVycm9yKG1lc3NhZ2UpKSB7CiAgICAgICAgICAgIHJldHVybiBEZWZhdWx0RXJyb3JTZXJpYWxpemVyLmRlc2VyaWFsaXplKG1lc3NhZ2UpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIG1lc3NhZ2U7CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBzZXJpYWxpemUoaW5wdXQpIHsKICAgICAgICAgIGlmIChpbnB1dCBpbnN0YW5jZW9mIEVycm9yKSB7CiAgICAgICAgICAgIHJldHVybiBEZWZhdWx0RXJyb3JTZX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WRvcHQodmFsdWUpIHsKICAgICAgICAgIHJldHVybiB2YWx1ZSBpbnN0YW5jZW9mIFAgPyB2YWx1ZSA6IG5ldyBQKGZ1bmN0aW9uKHJlc29sdmUpIHsKICAgICAgICAgICAgcmVzb2x2ZSh2YWx1ZSk7CiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgIGZ1bmN0aW9uIGZ1bGZpbGxlZCh2YWx1ZSkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgIHN0ZXAoZ2VuZXJhdG9yLm5leHQodmFsdWUpKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgIHJlamVjdChlKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gcmVqZWN0ZWQodmFsdWUpIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgcmVqZWN0KGUpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgewogICAgICAgICAgICByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsKICAgICAgICAgIH0KICAgICAgICAgIHN0ZXAoKGdlbmVyYXRvciA9IGdlbmVyYXRvci5hcHBseSh0aGlzQXJnLCBfYXJndW1lbnRzIHx8IFtdKSkubmV4dCgpKTsKICAgICAgICB9KTsKICAgICAgfTsKICAgICAgdmFyIF9faW1wb3J0RGVmYXVsdCA9IGV4cG9ydHMgJiYgZXhwb3J0cy5fX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XNzZW1ibHkuSW5zdGFuY2UobmV3IFdlYkFzc2VtYmx5Lk1vZHVsZShuZXcgVWludDhBcnJheShbCiAgICAgICAgICAwLAogICAgICAgICAgOTcsCiAgICAgICAgICAxMTUsCiAgICAgICAgICAxMDksCiAgICAgICAgICAxLAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEzLAogICAgICAgICAgMiwKICAgICAgICAgIDk2LAogICAgICAgICAgMCwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICA5NiwKICAgICAgICAgIDQsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxLAogICAgICAgICAgMTI3LAogICAgICAgICAgMywKICAgICAgICAgIDcsCiAgICAgICAgICA2LAogICAgICAgICAgMCwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgNiwKICAgICAgICAgIDYsCiAgICAgICAgICAxLAogICAgICAgICAgMTI3LAogICAgICAgICAgMSwKICAgICAgICAgIDY1LAogICAgICAgICAgMCwKICAgICAgICAgIDExLAogICAgICAgICAgNywKICAgICAgICAgIDUwLAogICAgICAgICAgNiwKICAgICAgICAgIDMsCiAgICAgICAgICAxMDksCiAgICAgICAgICAxMTcsCiAgICAgICAgICAxMDgsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDUsCiAgICAgICAgICAxMDAsCiAgICAgICAgICAxMDUsCiAgICAgICAgICAxMTgsCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNSwKICAgICAgICAgIDAsCiAgICAgICAgICAyLAogICAgICAgICAgNSwKICAgICAgICAgIDEwMCwKICAgICAgICAgIDEwNSwKICAgICAgICAgIDExOCwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE3LAogICAgICAgICAgMCwKICAgICAgICAgIDMsCiAgICAgICAgICA1LAogICAgICAgICAgMTE0LAogICAgICAgICAgMTAxLAogICAgICAgICAgMTA5LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMTUsCiAgICAgICAgICAwLAogICAgICAgICAgNCwKICAgICAgICAgIDUsCiAgICAgICAgICAxMTQsCiAgICAgICAgICAxMDEsCiAgICAgICAgICAxMDksCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNywKICAgICAgICAgIDAsCiAgICAgICAgICA1LAogICAgICAgICAgOCwKICAgICAgICAgIDEwMywKICAgICAgICAgIDEwMSwKICAgICAgICAgIDExNiwKICAgICAgICAgIDk1LAogICAgICAgICAgMTA0LAogICAgICAgICAgMTA1LAogICAgICAgICAgMTAzLAogICAgICAgICAgMTA0LAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAxMCwKICAgICAgICAgIDE5MSwKICAgICAgICAgIDEsCiAgICAgICAgICA2LAogICAgICAgICAgNCwKICAgICAgICAgIDAsCiAgICAgICAgICAzNSwKICAgICAgICAgIDAsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyNywKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyOCwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyOSwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEzMCwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMQogICAgICAgIF0pKSwge30pLmV4cG9ydHM7CiAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgfQogICAgICBmdW5jdGlvbiBMb25nNChsb3csIGhpZ2gsIHVuc2lnbmVkKSB7CiAgICAgICAgdGhpcy5sb3cgPSBsb3cgfCAwOwogICAgICAgIHRoaXMuaGlnaCA9IGhpZ2ggfCAwOwogICAgICAgIHRoaXMudW5zaWduZWQgPSAhIXVuc2lnbmVkOwogICAgICB9CiAgICAgIExvbmc0LnByb3RvdHlwZS5fX2lzTG9uZ19fOwogICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoTG9uZzQucHJvdG90eXBlLCAiX19pc0xvbmdfXyIsIHsgdmFsdWU6IHRydWUgfSk7CiAgICAgIGZ1bmN0aW9uIGlzTG9uZyhvYmopIHsKICAgICAgICByZXR1cm4gKG9iaiAmJiBvYmpbIl9faXNMb25nX18iXSkgPT09IHRydWU7CiAgICAgIH0KICAgICAgTG9uZzQuaXNMb25nID0gaXNMb25nOwogICAgICB2YXIgSU5UX0NBQ0hFID0ge307CiAgICAgIHZhciBVSU5UX0NBQ0hFID0ge307CiAgICAgIGZ1bmN0aW9uIGZyb21JbnQodmFsdWUsIHVuc2lnbmVkKSB7CiAgICAgICAgdmFyIG9iaiwgY2FjaGVkT2JqLCBjYWNoZTsKICAgICAgICBpZiAodW5zaWduZWQpIHsKICAgICAgICAgIHZhbHVlID4+Pj0gMDsKICAgICAgICAgIGlmIChjYWNoZSA9IDAgPD0gdmFsdWUgJiYgdmFsdWUgPCAyNTYpIHsKICAgICAgICAgICAgY2FjaGVkT2JqID0gVUlOVF9DQUNIRVt2YWx1ZV07CiAgICAgICAgICAgIGlmIChjYWNoZWRPYmopCiAgICAgICAgICAgICAgcmV0dXJuIGNhY2hlZE9iajsKICAgICAgICAgIH0KICAgICAgICAgIG9iaiA9IGZyb21CaXRzKHZhbHVlLCAodmFsdWUgfCAwKSA8IDAgPyAtMSA6IDAsIHRydWUpOwogICAgICAgICAgaWYgKGNhY2hlKQogICAgICAgICAgICBVSU5UX0NBQ0hFW3ZhbHVlXSA9IG9iajsKICAgICAgICAgIHJldHVybiBvYmo7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHZhbHVlIHw9IDA7CiAgICAgICAgICBpZiAoY2FjaGUgPSAtMTI4IDw9IHZhbHVlICYmIHZhbHVlIDwgMTI4KSB7CiAgICAgICAgICAgIGNhY2hlZE9iaiA9IElOVF9DQUNIRVt2YWx1ZV07CiAgICAgICAgICAgIGlmIChjYWNoZWRPYmopCiAgICAgICAgICAgICAgcmV0dXJuIGNhY2hlZE9iajsKICAgICAgICAgIH0KICAgICAgICAgIG9iaiA9IGZyb21CaXRzKHZhbHVlLCB2YWx1ZSA8IDAgPyAtMSA6IDAsIGZhbHNlKTsKICAgICAgICAgIGlmIChjYWNoZSkKICAgICAgICAgICAgSU5UX0NBQ0hFW3ZhbHVlXSA9IG9iajsKICAgICAgICAgIHJldHVybiBvYmo7CiAgICAgICAgfQogICAgICB9CiAgICAgIExvbmc0LmZyb21JbnQgPSBmcm9tSW50OwogICAgICBmdW5jdGlvbiBmcm9tTnVtYmVyKHZhbHVlLCB1bnNpZ25lZCkgewogICAgICAgIGlmIChpc05hTih2YWx1ZSkpCiAgICAgICAgICByZXR1cm4gdW5zaWduZWQgPyBVWkVSTyA6IFpFUk87CiAgICAgICAgaWYgKHVuc2lnbmVkKSB7CiAgICAgICAgICBpZiAodmFsdWUgPCAwKQogICAgICAgICAgICByZXR1cm4gVVpFUk87CiAgICAgICAgICBpZiAodmFsdWUgPj0gVFdPX1BXUl82NF9EQkwpCiAgICAgICAgICAgIHJldHVybiBNQVhfVU5TSUdORURfVkFMVUU7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGlmICh2YWx1ZSA8PSAtVFdPX1BXUl82M19EQkwpCiAgICAgICAgICAgIHJldHVybiBNSU5fVkFMVUU7CiAgICAgICAgICBpZiAodmFsdWUgKyAxID49IFRXT19QV1JfNjNfREJMKQogICAgICAgICAgICByZXR1cm4gTUFYX1ZBTFVFOwogICAgICAgIH0KICAgICAgICBpZiAodmFsdWUgPCAwKQogICAgICAgICAgcmV0dXJuIGZyb21OdW1iZXIoLXZhbHVlLCB1bnNpZ25lZCkubmVnKCk7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHZhbHVlICUgVFdPX1BXUl8zMl9EQkwgfCAwLCB2YWx1ZSAvIFRXT19QV1JfMzJfREJMIHwgMCwgdW5zaWduZWQpOwogICAgICB9CiAgICAgIExvbmc0LmZyb21OdW1iZXIgPSBmcm9tTnVtYmVyOwogICAgICBmdW5jdGlvbiBmcm9tQml0cyhsb3dCaXRzLCBoaWdoQml0cywgdW5zaWduZWQpIHsKICAgICAgICByZXR1cm4gbmV3IExvbmc0KGxvd0JpdHMsIGhpZ2hCaXRzLCB1bnNpZ25lZCk7CiAgICAgIH0KICAgICAgTG9uZzQuZnJvbUJpdHMgPSBmcm9tQml0czsKICAgICAgdmFyIHBvd19kYmwgPSBNYXRoLnBvdzsKICAgICAgZnVuY3Rpb24gZnJvbVN0cmluZyhzdHIsIHVuc2lnbmVkLCByYWRpeCkgewogICAgICAgIGlmIChzdHIubGVuZ3RoID09PSAwKQogICAgICAgICAgdGhyb3cgRXJyb3IoImVtcHR5IHN0cmluZyIpOwogICAgICAgIGlmIChzdHIgPT09ICJOYU4iIHx8IHN0ciA9PT0gIkluZmluaXR5IiB8fCBzdHIgPT09ICIrSW5maW5pdHkiIHx8IHN0ciA9PT0gIi1JbmZpbml0eSIpCiAgICAgICAgICByZXR1cm4gWkVSTzsKICAgICAgICBpZiAodHlwZW9mIHVuc2lnbmVkID09PSAibnVtYmVyIikgewogICAgICAgICAgcmFkaXggPSB1bnNpZ25lZCwgdW5zaWduZWQgPSBmYWxzZTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdW5zaWduZWQgPSAhIXVuc2lnbmVkOwogICAgICAgIH0KICAgICAgICByYWRpeCA9IHJhZGl4IHx8IDEwOwogICAgICAgIGlmIChyYWRpeCA8IDIgfHwgMzYgPCByYWRpeCkKICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoInJhZGl4Iik7CiAgICAgICAgdmFyIHA7CiAgICAgICAgaWYgKChwID0gc3RyLmluZGV4T2YoIi0iKSkgPiAwKQogICAgICAgICAgdGhyb3cgRXJyb3IoImludGVyaW9yIGh5cGhlbiIpOwogICAgICAgIGVsc2UgaWYgKHAgPT09IDApIHsKICAgICAgICAgIHJldHVybiBmcm9tU3RyaW5nKHN0ci5zdWJzdHJpbmcoMSksIHVuc2lnbmVkLCByYWRpeCkubmVnKCk7CiAgICAgICAgfQogICAgICAgIHZhciByYWRpeFRvUG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIDgpKTsKICAgICAgICB2YXIgcmVzdWx0ID0gWkVSTzsKICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkgKz0gOCkgewogICAgICAgICAgdmFyIHNpemUgPSBNYXRoLm1pbig4LCBzdHIubGVuZ3RoIC0gaSksIHZhbHVlID0gcGFyc2VJbnQoc3RyLnN1YnN0cmluZyhpLCBpICsgc2l6ZSksIHJhZGl4KTsKICAgICAgICAgIGlmIChzaXplIDwgOCkgewogICAgICAgICAgICB2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y5uZWcoKS50b1N0cmluZyhyYWRpeCk7CiAgICAgICAgfQogICAgICAgIHZhciByYWRpeFRvUG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIDYpLCB0aGlzLnVuc2lnbmVkKSwgcmVtID0gdGhpczsKICAgICAgICB2YXIgcmVzdWx0ID0gIiI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHZhciByZW1EaXYgPSByZW0uZGl2KHJhZGl4VG9Qb3dlciksIGludHZhbCA9IHJlbS5zdWIocmVtRGl2Lm11bChyYWRpeFRvUG93ZXIpKS50b0ludCgpID4+PiAwLCBkaWdpdHMgPSBpbnR2YWwudG9TdHJpbmcocmFkaXgpOwogICAgICAgICAgcmVtID0gcmVtRGl2OwogICAgICAgICAgaWYgKHJlbS5pc1plcm8oKSkKICAgICAgICAgICAgcmV0dXJuIGRpZ2l0cyArIHJlc3VsdDsKICAgICAgICAgIGVsc2UgewogICAgICAgICAgICB3aGlsZSAoZGlnaXRzLmxlbmd0aCA8IDYpCiAgICAgICAgICAgICAgZGlnaXRzID0gIjAiICsgZGlnaXRzOwogICAgICAgICAgICByZXN1bHQgPSAiIiArIGRpZ2l0cyArIHJlc3VsdDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0SGlnaEJpdHMgPSBmdW5jdGlvbiBnZXRIaWdoQml0cygpIHsKICAgICAgICByZXR1cm4gdGhpcy5oaWdoOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmdldEhpZ2hCaXRzVW5zaWduZWQgPSBmdW5jdGlvbiBnZXRIaWdoQml0c1Vuc2lnbmVkKCkgewogICAgICAgIHJldHVybiB0aGlzLmhpZ2ggPj4+IDA7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0TG93Qml0cyA9IGZ1bmN0aW9uIGdldExvd0JpdHMoKSB7CiAgICAgICAgcmV0dXJuIHRoaXMubG93OwogIC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cmFoZW5kID0gZnJvbVZhbHVlKHN1YnRyYWhlbmQpOwogICAgICAgIHJldHVybiB0aGlzLmFkZChzdWJ0cmFoZW5kLm5lZygpKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zdWIgPSBMb25nUHJvdG90eXBlLnN1YnRyYWN0OwogICAgICBMb25nUHJvdG90eXBlLm11bHRpcGx5ID0gZnVuY3Rpb24gbXVsdGlwbHkobXVsdGlwbGllcikgewogICAgICAgIGlmICh0aGlzLmlzWmVybygpKQogICAgICAgICAgcmV0dXJuIFpFUk87CiAgICAgICAgaWYgKCFpc0xvbmcobXVsdGlwbGllcikpCiAgICAgICAgICBtdWx0aXBsaWVyID0gZnJvbVZhbHVlKG11bHRpcGxpZXIpOwogICAgICAgIGlmICh3YXNtKSB7CiAgICAgICAgICB2YXIgbG93ID0gd2FzbS5tdWwodGhpcy5sb3csIHRoaXMuaGlnaCwgbXVsdGlwbGllci5sb3csIG11bHRpcGxpZXIuaGlnaCk7CiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMobG93LCB3YXNtLmdldF9oaWdoKCksIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgICBpZiAobXVsdGlwbGllci5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiBaRVJPOwogICAgICAgIGlmICh0aGlzLmVxKE1JTl9WQUxVRSkpCiAgICAgICAgICByZXR1cm4gbXVsdGlwbGllci5pc09kZCgpID8gTUlOX1ZBTFVFIDogWkVSTzsKICAgICAgICBpZiAobXVsdGlwbGllci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgcmV0dXJuIHRoaXMuaXNPZGQoKSA/IE1JTl9WQUxVRSA6IFpFUk87CiAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKSB7CiAgICAgICAgICBpZiAobXVsdGlwbGllci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICAgIHJldHVybiB0aGlzLm5lZygpLm11bChtdWx0aXBsaWVyLm5lZygpKT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V0dXJuIHRoaXM7CiAgICAgICAgICB9CiAgICAgICAgICB2YXIgbG93ID0gKHRoaXMudW5zaWduZWQgPyB3YXNtLmRpdl91IDogd2FzbS5kaXZfcykodGhpcy5sb3csIHRoaXMuaGlnaCwgZGl2aXNvci5sb3csIGRpdmlzb3IuaGlnaCk7CiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMobG93LCB3YXNtLmdldF9oaWdoKCksIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiB0aGlzLnVuc2lnbmVkID8gVVpFUk8gOiBaRVJPOwogICAgICAgIHZhciBhcHByb3gsIHJlbSwgcmVzOwogICAgICAgIGlmICghdGhpcy51bnNpZ25lZCkgewogICAgICAgICAgaWYgKHRoaXMuZXEoTUlOX1ZBTFVFKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5lcShPTkUpIHx8IGRpdmlzb3IuZXEoTkVHX09ORSkpCiAgICAgICAgICAgICAgcmV0dXJuIE1JTl9WQUxVRTsKICAgICAgICAgICAgZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICAgIHJldHVybiBPTkU7CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgIHZhciBoYWxmVGhpcyA9IHRoaXMuc2hyKDEpOwogICAgICAgICAgICAgIGFwcHJveCA9IGhhbGZUaGlzLmRpdihkaXZpc29yKS5zaGwoMSk7CiAgICAgICAgICAgICAgaWYgKGFwcHJveC5lcShaRVJPKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGRpdmlzb3IuaXNOZWdhdGl2ZSgpID8gT05FIDogTkVHX09ORTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmVtID0gdGhpcy5zdWIoZGl2aXNvci5tdWwoYXBwcm94KSk7CiAgICAgICAgICAgICAgICByZXMgPSBhcHByb3guYWRkKHJlbS5kaXYoZGl2aXNvcikpOwogICAgICAgICAgICAgICAgcmV0dXJuIHJlczsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICByZXR1cm4gdGhpcy51bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICAgIGlmICh0aGlzLmlzTmVnYXRpdmUoKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkuZGl2KGRpdmlzb3IubmVnKCkpOwogICAgICAgICAgICByZXR1cm4gdGhpcy5uZWcoKS5kaXYoZGl2aXNvcikubmVnKCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGRpdmlzb3IuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgICByZXR1cm4gdGhpcy5kaXYoZGl2aXNvci5uZWcoKSkubmVnKCk7CiAgICAgICAgICByZXMgPSBaRVJPOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAoIWRpdmlzb3IudW5zaWduZWQpCiAgICAgICAgICAgIGRpdmlzb3IgPSBkaXZpc29yLnRvVW5zaWduZWQoKTsKICAgICAgICAgIGlmIChkaXZpc29yLmd0KHRoaXMpKQogICAgICAgICAgICByZXR1cm4gVVpFUk87CiAgICAgICAgICBpZiAoZGl2aXNvci5ndCh0aGlzLnNocnUoMSkpKQogICAgICAgICAgICByZXR1cm4gVU9ORTsKICAgICAgICAgIHJlcyA9IFVaRVJPOwogICAgICAgIH0KICAgICAgICByZW0gPSB0aGlzOwogICAgICAgIHdoaWxlIChyZW0uZ3RlKGRpdmlzb3IpKSB7CiAgICAgICAgICBhcHByb3ggPSBNYXRoLm1heCgxLCBNYXRoLmZsb29yKHJlbS50b051bWJlcigpIC8gZGl2aXNvci50b051bWJlcigpKSk7CiAgICAgICAgICB2YXIgbG9nMiA9IE1hdGguY2VpbChNYXRoLmxvZyhhcHByb3gpIC8gTWF0aC5MTjIpLCBkZWx0YSA9IGxvZzIgPD0gNDggPyAxIDogcG93X2RibCgyLCBsb2cyIC0gNDgpLCBhcHByb3hSZXMgPSBmcm9tTnVtYmVyKGFwcHJveCksIGFwcHJveFJlbSA9IGFwcHJveFJlcy5tdWwoZGl2aXNvcik7CiAgICAgICAgICB3aGlsZSAoYXBwcm94UmVtLmlzTmVnYXRpdmUoKSB8fCBhcHByb3hSZW0uZ3QocmVtKSkgewogICAgICAgICAgICBhcHByb3ggLT0gZGVsdGE7CiAgICAgICAgICAgIGFwcHJveFJlcyA9IGZyb21OdW1iZXIoYXBwcm94LCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICAgICAgYXBwcm94UmVtID0gYXBwcm94UmVzLm11bChkaXZpc29yKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChhcHByb3hSZXMuaXNaZXJvKCkpCiAgICAgICAgICAgIGFwcHJveFJlcyA9IE9ORTsKICAgICAgICAgIHJlcyA9IHJlcy5hZGQoYXBwcm94UmVzKTsKICAgICAgICAgIHJlbSA9IHJlbS5zdWIoYXBwcm94UmVtKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlczsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5kaXYgPSBMb25nUHJvdG90eXBlLmRpdmlkZTsKICAgICAgTG9uZ1Byb3RvdHlwZS5tb2R1bG8gPSBmdW5jdGlvbiBtb2R1bG8oZGl2aXNvcikgewogICAgICAgIGlmICghaXNMb25nKGRpdmlzb3IpKQogICAgICAgICAgZGl2aXNvciA9IGZyb21WYWx1ZShkaXZpc29yKTsKICAgICAgICBpZiAod2FzbSkgewogICAgICAgICAgdmFyIGxvdyA9ICh0aGlzLnVuc2lnbmVkID8gd2FzbS5yZW1fdSA6IHdhc20ucmVtX3MpKHRoaXMubG93LCB0aGlzLmhpZ2gsIGRpdmlzb3IubG93LCBkaXZpc29yLmhpZ2gpOwogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKGxvdywgd2FzbS5nZXRfaGlnaCgpLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXMuc3ViKHRoaXMuZGl2KGRpdmlzb3IpLm11bChkaXZpc29yKSk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUubW9kID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUucmVtID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUubm90ID0gZnVuY3Rpb24gbm90KCkgewogICAgICAgIHJldHVybiBmcm9tQml0cyh+dGhpcy5sb3csIH50aGlzLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmFuZCA9IGZ1bmN0aW9uIGFuZChvdGhlcikgewogICAgICAgIGlmICghaXNMb25nKG90aGVyKSkKICAgICAgICAgIG90aGVyID0gZnJvbVZhbHVlKG90aGVyKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgJiBvdGhlci5sb3csIHRoaXMuaGlnaCAmIG90aGVyLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLm9yID0gZnVuY3Rpb24gb3Iob3RoZXIpIHsKICAgICAgICBpZiAoIWlzTG9uZyhvdGhlcikpCiAgICAgICAgICBvdGhlciA9IGZyb21WYWx1ZShvdGhlcik7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IHwgb3RoZXIubG93LCB0aGlzLmhpZ2ggfCBvdGhlci5oaWdoLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS54b3IgPSBmdW5jdGlvbiB4b3Iob3RoZXIpIHsKICAgICAgICBpZiAoIWlzTG9uZyhvdGhlcikpCiAgICAgICAgICBvdGhlciA9IGZyb21WYWx1ZShvdGhlcik7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IF4gb3RoZXIubG93LCB0aGlzLmhpZ2ggXiBvdGhlci5oaWdoLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdExlZnQgPSBmdW5jdGlvbiBzaGlmdExlZnQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIGlmICgobnVtQml0cyAmPSA2MykgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNlIGlmIChudW1CaXRzIDwgMzIpCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgPDwgbnVtQml0cywgdGhpcy5oaWdoIDw8IG51bUJpdHMgfCB0aGlzLmxvdyA+Pj4gMzIgLSBudW1CaXRzLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICBlbHNlCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMoMCwgdGhpcy5sb3cgPDwgbnVtQml0cyAtIDMyLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGwgPSBMb25nUHJvdG90eXBlLnNoaWZ0TGVmdDsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0ID0gZnVuY3Rpb24gc2hpZnRSaWdodChudW1CaXRzKSB7CiAgICAgICAgaWYgKGlzTG9uZyhudW1CaXRzKSkKICAgICAgICAgIG51bUJpdHMgPSBudW1CaXRzLnRvSW50KCk7CiAgICAgICAgaWYgKChudW1CaXRzICY9IDYzKSA9PT0gMCkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKG51bUJpdHMgPCAzMikKICAgICAgICAgIHJldHVybiBmcm9tQml0cyh0aGlzLmxvdyA+Pj4gbnVtQml0cyB8IHRoaXMuaGlnaCA8PCAzMiAtIG51bUJpdHMsIHRoaXMuaGlnaCA+PiBudW1CaXRzLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICBlbHNlCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5oaWdoID4+IG51bUJpdHMgLSAzMiwgdGhpcy5oaWdoID49IDAgPyAwIDogLTEsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLnNociA9IExvbmdQcm90b3R5cGUuc2hpZnRSaWdodDsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0VW5zaWduZWQgPSBmdW5jdGlvbiBzaGlmdFJpZ2h0VW5zaWduZWQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIG51bUJpdHMgJj0gNjM7CiAgICAgICAgaWYgKG51bUJpdHMgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNlIHsKICAgICAgICAgIHZhciBoaWdoID0gdGhpcy5oaWdoOwogICAgICAgICAgaWYgKG51bUJpdHMgPCAzMikgewogICAgICAgICAgICB2YXIgbG93ID0gdGhpcy5sb3c7CiAgICAgICAgICAgIHJldHVybiBmcm9tQml0cyhsb3cgPj4+IG51bUJpdHMgfCBoaWdoIDw8IDMyIC0gbnVtQml0cywgaGlnaCA+Pj4gbnVtQml0cywgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgICB9IGVsc2UgaWYgKG51bUJpdHMgPT09IDMyKQogICAgICAgICAgICByZXR1cm4gZnJvbUJpdHMoaGlnaCwgMCwgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiBmcm9tQml0cyhoaWdoID4+PiBudW1CaXRzIC0gMzIsIDAsIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgfTsKICAgICAgTG9uZ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kZWZpbmVkIiAmJiB0eXBlb2YgSW50MzJBcnJheSAhPT0gInVuZGVmaW5lZCI7CiAgICAgIGZ1bmN0aW9uIF9oYXMob2JqLCBrZXkpIHsKICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iaiwga2V5KTsKICAgICAgfQogICAgICBleHBvcnRzLmFzc2lnbiA9IGZ1bmN0aW9uKG9iaikgewogICAgICAgIHZhciBzb3VyY2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKTsKICAgICAgICB3aGlsZSAoc291cmNlcy5sZW5ndGgpIHsKICAgICAgICAgIHZhciBzb3VyY2UgPSBzb3VyY2VzLnNoaWZ0KCk7CiAgICAgICAgICBpZiAoIXNvdXJjZSkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0eXBlb2Ygc291cmNlICE9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKHNvdXJjZSArICJtdXN0IGJlIG5vbi1vYmplY3QiKTsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAodmFyIHAgaW4gc291cmNlKSB7CiAgICAgICAgICAgIGlmIChfaGFzKHNvdXJjZSwgcCkpIHsKICAgICAgICAgICAgICBvYmpbcF0gPSBzb3VyY2VbcF07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIG9iajsKICAgICAgfTsKICAgICAgZXhwb3J0cy5zaHJpbmtCdWYgPSBmdW5jdGlvbihidWYsIHNpemUpIHsKICAgICAgICBpZiAoYnVmLmxlbmd0aCA9PT0gc2l6ZSkgewogICAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgICB9CiAgICAgICAgaWYgKGJ1Zi5zdWJhcnJheSkgewogICAgICAgICAgcmV0dXJuIGJ1Zi5zdWJhcnJheSgwLCBzaXplKTsKICAgICAgICB9CiAgICAgICAgYnVmLmxlbmd0aCA9IHNpemU7CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfTsKICAgICAgdmFyIGZuVHlwZWQgPSB7CiAgICAgICAgYXJyYXlTZXQ6IGZ1bmN0aW9uKGRlc3QsIHNyYywgc3JjX29mZnMsIGxlbiwgZGVzdF9vZmZzKSB7CiAgICAgICAgICBpZiAoc3JjLnN1YmFycmF5ICYmIGRlc3Quc3ViYXJyYXkpIHsKICAgICAgICAgICAgZGVzdC5zZXQoc3JjLnN1YmFycmF5KHNyY19vZmZzLCBzcmNfb2ZmcyArIGxlbiksIGRlc3Rfb2Zmcyk7CiAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKICAgICAgICAgICAgZGVzdFtkZXN0X29mZnMgKyBpXSA9IHNyY1tzcmNfb2ZmcyArIGldOwogICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgZmxhdHRlbkNodW5rczogZnVuY3Rpb24oY2h1bmtzKSB7CiAgICAgICAgICB2YXIgaSwgbCwgbGVuLCBwb3MsIGNodW5rLCByZXN1bHQ7CiAgICAgICAgICBsZW4gPSAwOwogICAgICAgICAgZm9yIChpID0gMCwgbCA9IGNodW5rcy5sZW5ndGg7IGkgPCBsOyBpKyspIHsKICAgICAgICAgICAgbGVuICs9IGNodW5rc1tpXS5sZW5ndGg7CiAgICAgICAgICB9CiAgICAgICAgICByZXN1bHQgPSBuZXcgVWludDhBcnJheShsZW4pOwogICAgICAgICAgcG9zID0gMDsKICAgICAgICAgIGZvciAoaSA9IDAsIGwgPSBjaHVua3MubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgICAgIGNodW5rID0gY2h1bmtzW2ldOwogICAgICAgICAgICByZXN1bHQuc2V0KGNodW5rLCBwb3MpOwogICAgICAgICAgICBwb3MgKz0gY2h1bmsubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgICB9CiAgICAgIH07CiAgICAgIHZhciBmblVudHlwZWQgPSB7CiAgICAgICAgYXJyYXlTZXQ6IGZ1bmN0aW9uKGRlc3QsIHNyYywgc3JjX29mZnMsIGxlbiwgZGVzdF9vZmZzKSB7CiAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgICAgIGRlc3RbZGVzdF9vZmZzICsgaV0gPSBzcmNbc3JjX29mZnMgKyBpXTsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIGZsYXR0ZW5DaHVua3M6IGZ1bmN0aW9uKGNodW5rcykgewogICAgICAgICAgcmV0dXJuIFtdLmNvbmNhdC5hcHBseShbXSwgY2h1bmtzKTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIGV4cG9ydHMuc2V0VHlwZWQgPSBmdW5jdGlvbihvbikgewogICAgICAgIGlmIChvbikgewogICAgICAgICAgZXhwb3J0cy5CdWY4ID0gVWludDhBcnJheTsKICAgICAgICAgIGV4cG9ydHMuQnVmMTYgPSBVaW50MTZBcnJheTsKICAgICAgICAgIGV4cG9ydHMuQnVmMzIgPSBJbnQzMkFycmF5OwogICAgICAgICAgZXhwb3J0cy5hc3NpZ24oZXhwb3J0cywgZm5UeXBlZCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGV4cG9ydHMuQnVmOCA9IEFycmF5OwogICAgICAgICAgZXhwb3J0cy5CdWYxNiA9IEFycmF5OwogICAgICAgICAgZXhwb3J0cy5CdWYzMiA9IEFycmF5OwogICAgICAgICAgZXhwb3J0cy5hc3NpZ24oZXhwb3J0cywgZm5VbnR5cGVkKTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIGV4cG9ydHMuc2V0VHlwZWQoVFlQRURfT0spOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvdHJlZXMuanMKICB2YXIgcmVxdWlyZV90cmVlcyA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi90cmVlcy5qcyIoZXhwb3J0cykgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIHV0aWxzID0gcmVxdWlyZV9jb21tb24yKCk7CiAgICAgIHZhciBaX0ZJWEVEID0gNDsKICAgICAgdmFyIFpfQklOQVJZID0gMDsKICAgICAgdmFyIFpfVEVYVCA9IDE7CiAgICAgIHZhciBaX1VOS05PV04gPSAyOwogICAgICBmdW5jdGlvbiB6ZXJvKGJ1ZikgewogICAgICAgIHZhciBsZW4gPSBidWYubGVuZ3RoOwogICAgICAgIHdoaWxlICgtLWxlbiA+PSAwKSB7CiAgICAgICAgICBidWZbbGVuXSA9IDA7CiAgICAgICAgfQogICAgICB9CiAgICAgIHZhciBTVE9SRURfQkxPQ0sgPSAwOwogICAgICB2YXIgU1RBVElDX1RSRUVTID0gMTsKICAgICAgdmFyIERZTl9UUkVFUyA9IDI7CiAgICAgIHZhciBNSU5fTUFUQ0ggPSAzOwogICAgICB2YXIgTUFYX01BVENIID0gMjU4OwogICAgICB2YXIgTEVOR1RIX0NPREVTID0gMjk7CiAgICAgIHZhciBMSVRFUkFMUyA9IDI1NjsKICAgICAgdmFyIExfQ09ERVMgPSBMSVRFUkFMUyArIDEgKyBMRU5HVEhfQ09ERVM7CiAgICAgIHZhciBEX0NPREVTID0gMzA7CiAgICAgIHZhciBCTF9DT0RFUyA9IDE5OwogICAgICB2YXIgSEVBUF9TSVpFID0gMiAqIExfQ09ERVMgKyAxOwogICAgICB2YXIgTUFYX0JJVFMgPSAxNTsKICAgICAgdmFyIEJ1Zl9zaXplID0gMTY7CiAgICAgIHZhciBNQVhfQkxfQklUUyA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BNQVhfQklUUzsgYml0cysrKSB7CiAgICAgICAgICBzLmJsX2NvdW50W2JpdHNdID0gMDsKICAgICAgICB9CiAgICAgICAgdHJlZVtzLmhlYXBbcy5oZWFwX21heF0gKiAyICsgMV0gPSAwOwogICAgICAgIGZvciAoaCA9IHMuaGVhcF9tYXggKyAxOyBoIDwgSEVBUF9TSVpFOyBoKyspIHsKICAgICAgICAgIG4gPSBzLmhlYXBbaF07CiAgICAgICAgICBiaXRzID0gdHJlZVt0cmVlW24gKiAyICsgMV0gKiAyICsgMV0gKyAxOwogICAgICAgICAgaWYgKGJpdHMgPiBtYXhfbGVuZ3RoKSB7CiAgICAgICAgICAgIGJpdHMgPSBtYXhfbGVuZ3RoOwogICAgICAgICAgICBvdmVyZmxvdysrOwogICAgICAgICAgfQogICAgICAgICAgdHJlZVtuICogMiArIDFdID0gYml0czsKICAgICAgICAgIGlmIChuID4gbWF4X2NvZGUpIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBzLmJsX2NvdW50W2JpdHNdKys7CiAgICAgICAgICB4Yml0cyA9IDA7CiAgICAgICAgICBpZiAobiA+PSBiYXNlKSB7CiAgICAgICAgICAgIHhiaXRzID0gZXh0cmFbbiAtIGJhc2VdOwogICAgICAgICAgfQogICAgICAgICAgZiA9IHRyZWVbbiAqIDJdOwogICAgICAgICAgcy5vcHRfbGVuICs9IGYgKiAoYml0cyArIHhiaXRzKTsKICAgICAgICAgIGlmIChoYXNfc3RyZWUpIHsKICAgICAgICAgICAgcy5zdGF0aWNfbGVuICs9IGYgKiAoc3RyZWVbbiAqIDIgKyAxXSArIHhiaXRzKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKG92ZXJmbG93ID09PSAwKSB7CiAgICAgICAgICByZXR1cm47CiAgICAgICAgfQogICAgICAgIGRvIHsKICAgICAgICAgIGJpdHMgPSBtYXhfbGVuZ3RoIC0gMTsKICAgICAgICAgIHdoaWxlIChzLmJsX2NvdW50W2JpdHNdID09PSAwKSB7CiAgICAgICAgICAgIGJpdHMtLTsKICAgICAgICAgIH0KICAgICAgICAgIHMuYmxfY291bnRbYml0c10tLTsKICAgICAgICAgIHMuYmxfY291bnRbYml0cyArIDFdICs9IDI7CiAgICAgICAgICBzLmJsX2NvdW50W21heF9sZW5ndGhdLS07CiAgICAgICAgICBvdmVyZmxvdyAtPSAyOwogICAgICAgIH0gd2hpbGUgKG92ZXJmbG93ID4gMCk7CiAgICAgICAgZm9yIChiaXRzID0gbWF4X2xlbmd0aDsgYml0cyAhPT0gMDsgYml0cy0tKSB7CiAgICAgICAgICBuID0gcy5ibF9jb3VudFtiaXRzXTsKICAgICAgICAgIHdoaWxlIChuICE9PSAwKSB7CiAgICAgICAgICAgIG0gPSBzLmhlYXBbLS1oXTsKICAgICAgICAgICAgaWYgKG0gPiBtYXhfY29kZSkgewogICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh0cmVlW20gKiAyICsgMV0gIT09IGJpdHMpIHsKICAgICAgICAgICAgICBzLm9wdF9sZW4gKz0gKGJpdHMgLSB0cmVlW20gKiAyICsgMV0pICogdHJlZVttICogMl07CiAgICAgICAgICAgICAgdHJlZVttICogMiArIDFdID0gYml0czsKICAgICAgICAgICAgfQogICAgICAgICAgICBuLS07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGdlbl9jb2Rlcyh0cmVlLCBtYXhfY29kZSwgYmxfY291bnQpIHsKICAgICAgICB2YXIgbmV4dF9jb2RlID0gbmV3IEFycmF5KE1BWF9CSVRTICsgMSk7CiAgICAgICAgdmFyIGNvZGUgPSAwOwogICAgICAgIHZhciBiaXRzOwogICAgICAgIHZhciBuOwogICAgICAgIGZvciAoYml0cyA9IDE7IGJpdHMgPD0gTUFYX0JJVFM7IGJpdHMrKykgewogICAgICAgICAgbmV4dF9jb2RlW2JpdHNdID0gY29kZSA9IGNvZGUgKyBibF9jb3VudFtiaXRzIC0gMV0gPDwgMTsKICAgICAgICB9CiAgICAgICAgZm9yIChuID0gMDsgbiA8PSBtYXhfY29kZTsgbisrKSB7CiAgICAgICAgICB2YXIgbGVuID0gdHJlZVtuICogMiArIDFdOwogICAgICAgICAgaWYgKGxlbiA9PT0gMCkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIHRyZWVbbiAqIDJdID0gYmlfcmV2ZXJzZShuZXh0X2NvZGVbbGVuXSsrLCBsZW4pOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiB0cl9zdGF0aWNfaW5pdCgpIHsKICAgICAgICB2YXIgbjsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgbGVuZ3RoOwogICAgICAgIHZhciBjb2RlOwogICAgICAgIHZhciBkaXN0OwogICAgICAgIHZhciBibF9jb3VudCA9IG5ldyBBcnJheShNQVhfQklUUyArIDEpOwogICAgICAgIGxlbmd0aCA9IDA7CiAgICAgICAgZm9yIChjb2RlID0gMDsgY29kZSA8IExFTkdUSF9DT0RFUyAtIDE7IGNvZGUrKykgewogICAgICAgICAgYmFzZV9sZW5ndGhbY29kZV0gPSBsZW5ndGg7CiAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgMSA8PCBleHRyYV9sYml0c1tjb2RlXTsgbisrKSB7CiAgICAgICAgICAgIF9sZW5ndGhfY29kZVtsZW5ndGgrK10gPSBjb2RlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBfbGVuZ3RoX2NvZGVbbGVuZ3RoIC0gMV0gPSBjb2RlOwogICAgICAgIGRpc3QgPSAwOwogICAgICAgIGZvciAoY29kZSA9IDA7IGNvZGUgPCAxNjsgY29kZSsrKSB7CiAgICAgICAgICBiYXNlX2Rpc3RbY29kZV0gPSBkaXN0OwogICAgICAgICAgZm9yIChuID0gMDsgbiA8IDEgPDwgZXh0cmFfZGJpdHNbY29kZV07IG4rKykgewogICAgICAgICAgICBfZGlzdF9jb2RlW2Rpc3QrK10gPSBjb2RlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkaXN0ID4+PSA3OwogICAgICAgIGZvciAoOyBjb2RlIDwgRF9DT0RFUzsgY29kZSsrKSB7CiAgICAgICAgICBiYXNlX2Rpc3RbY29kZV0gPSBkaXN0IDw8IDc7CiAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgMSA8PCBleHRyYV9kYml0c1tjb2RlXSAtIDc7IG4rKykgewogICAgICAgICAgICBfZGlzdF9jb2RlWzI1NiArIGRpc3QrK10gPSBjb2RlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmb3IgKGJpdHMgPSAwOyBiaXRzIDw9IE1BWF9CSVRTOyBiaXRzKyspIHsKICAgICAgICAgIGJsX2NvdW50W2JpdHNdID0gMDsKICAgICAgICB9CiAgICAgICAgbiA9IDA7CiAgICAgICAgd2hpbGUgKG4gPD0gMTQzKSB7CiAgICAgICAgICBzdGF0aWNfbHRyZWVbbiAqIDIgKyAxXSA9IDg7CiAgICAgICAgICBuKys7CiAgICAgICAgICBibF9jb3VudFs4XSsrOwogICAgICAgIH0KICAgICAgICB3aGlsZSAobiA8PSAyNTUpIHsKICAgICAgICAgIHN0YXRpY19sdHJlZVtuICogMiArIDFdID0gOTsKICAgICAgICAgIG4rKzsKICAgICAgICAgIGJsX2NvdW50WzldKys7CiAgICAgICAgfQogICAgICAgIHdoaWxlIChuIDw9IDI3OSkgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA3OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbN10rKzsKICAgICAgICB9CiAgICAgICAgd2hpbGUgKG4gPD0gMjg3KSB7CiAgICAgICAgICBzdGF0aWNfbHRyZWVbbiAqIDIgKyAxXSA9IDg7CiAgICAgICAgICBuKys7CiAgICAgICAgICBibF9jb3VudFs4XSsrOwogICAgICAgIH0KICAgICAgICBnZW5fY29kZXMoc3RhdGljX2x0cmVlLCBMX0NPREVTICsgMSwgYmxfY291bnQpOwogICAgICAgIGZvciAobiA9IDA7IG4gPCBEX0NPREVTOyBuKyspIHsKICAgICAgICAgIHN0YXRpY19kdHJlZVtuICogMiArIDFdID0gNTsKICAgICAgICAgIHN0YXRpY19kdHJlZVtuICogMl0gPSBiaV9yZXZlcnNlKG4sIDUpOwogICAgICAgIH0KICAgICAgICBzdGF0aWNfbF9kZXNjID0gbmV3IFN0YXRpY1RyZWVEZXNjKHN0YXRpY19sdHJlZSwgZXh0cmFfbGJpdHMsIExJVEVSQUxTICsgMSwgTF9DT0RFUywgTUFYX0JJVFMpOwogICAgICAgIHN0YXRpY19kX2Rlc2MgPSBuZXcgU3RhdGljVHJlZURlc2Moc3RhdGljX2R0cmVlLCBleHRyYV9kYml0cywgMCwgRF9DT0RFUywgTUFYX0JJVFMpOwogICAgICAgIHN0YXRpY19ibF9kZXNjID0gbmV3IFN0YXRpY1RyZWVEZXNjKG5ldyBBcnJheSgwKSwgZXh0cmFfYmxiaXRzLCAwLCBCTF9DT0RFUywgTUFYX0JMX0JJVFMpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluaXRfYmxvY2socykgewogICAgICAgIHZhciBuOwogICAgICAgIGZvciAobiA9IDA7IG4gPCBMX0NPREVTOyBuKyspIHsKICAgICAgICAgIHMuZHluX2x0cmVlW24gKiAyXSA9IDA7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDA7IG4gPCBEX0NPREVTOyBuKyspIHsKICAgICAgICAgIHMuZHluX2R0cmVlW24gKiAyXSA9IDA7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDA7IG4gPCBCTF9DT0RFUzsgbisrKSB7CiAgICAgICAgICBzLmJsX3RyZWVbbiAqIDJdID0gMDsKICAgICAgICB9CiAgICAgICAgcy5keW5fbHRyZWVbRU5EX0JMT0NLICogMl0gPSAxOwogICAgICAgIHMub3B0X2xlbiA9IHMuc3RhdGljX2xlbiA9IDA7CiAgICAgICAgcy5sYXN0X2xpdCA9IHMubWF0Y2hlcyA9IDA7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYmlfd2luZHVwKHMpIHsKICAgICAgICBpZiAocy5iaV92YWxpZCA+IDgpIHsKICAgICAgICAgIHB1dF9zaG9ydChzLCBzLmJpX2J1Zik7CiAgICAgICAgfSBlbHNlIGlmIChzLmJpX3ZhbGlkID4gMCkgewogICAgICAgICAgcy5wZW5kaW5nX2J1ZltzLnBlbmRpbmcrK10gPSBzLmJpX2J1ZjsKICAgICAgICB9CiAgICAgICAgcy5iaV9idWYgPSAwOwogICAgICAgIHMuYmlfdmFsaWQgPSAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGNvcHlfYmxvY2socywgYnVmLCBsZW4sIGhlYWRlcikgewogICAgICAgIGJpX3dpbmR1cChzKTsKICAgICAgICBpZiAoaGVhZGVyKSB7CiAgICAgICAgICBwdXRfc2hvcnQocywgbGVuKTsKICAgICAgICAgIHB1dF9zaG9ydChzLCB+bGVuKTsKICAgICAgICB9CiAgICAgICAgdXRpbHMuYXJyYXlTZXQocy5wZW5kaW5nX2J1Ziwgcy53aW5kb3csIGJ1ZiwgbGVuLCBzLnBlbmRpbmcpOwogICAgICAgIHMucGVuZGluZyArPSBsZW47CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc21hbGxlcih0cmVlLCBuLCBtLCBkZXB0aCkgewogICAgICAgIHZhciBfbjIgPSBuICogMjsKICAgICAgICB2YXIgX20yID0gbSAqIDI7CiAgICAgICAgcmV0dXJuIHRyZWVbX24yXSA8IHRyZWVbX20yXSB8fCB0cmVlW19uMl0gPT09IHRyZWVbX20yXSAmJiBkZXB0aFtuXSA8PSBkZXB0aFttXTsKICAgICAgfQogICAgICBmdW5jdGlvbiBwcWRvd25oZWFwKHMsIHRyZWUsIGspIHsKICAgICAgICB2YXIgdiA9IHMuaGVhcFtrXTsKICAgICAgICB2YXIgaiA9IGsgPDwgMTsKICAgICAgICB3aGlsZSAoaiA8PSBzLmhlYXBfbGVuKSB7CiAgICAgICAgICBpZiAoaiA8IHMuaGVhcF9sZW4gJiYgc21hbGxlcih0cmVlLCBzLmhlYXBbaiArIDFdLCBzLmhlYXBbal0sIHMuZGVwdGgpKSB7CiAgICAgICAgICAgIGorKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzbWFsbGVyKHRyZWUsIHYsIHMuaGVhcFtqXSwgcy5kZXB0aCkpIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgICBzLmhlYXBba10gPSBzLmhlYXBbal07CiAgICAgICAgICBrID0gajsKICAgICAgICAgIGogPDw9IDE7CiAgICAgICAgfQogICAgICAgIHMuaGVhcFtrXSA9IHY7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gY29tcHJlc3NfYmxvY2socywgbHRyZWUsIGR0cmVlKSB7CiAgICAgICAgdmFyIGRpc3Q7CiAgICAgICAgdmFyIGxjOwogICAgICAgIHZhciBseCA9IDA7CiAgICAgICAgdmFyIGNvZGU7CiAgICAgICAgdmFyIGV4dHJhOwogICAgICAgIGlmIChzLmxhc3RfbGl0ICE9PSAwKSB7CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIGRpc3QgPSBzLnBlbmRpbmdfYnVmW3MuZF9idWYgKyBseCAqIDJdIDw8IDggfCBzLnBlbmRpbmdfYnVmW3MuZF9idWYgKyBseCAqIDIgKyAxXTsKICAgICAgICAgICAgbGMgPSBzLnBlbmRpbmdfYnVmW3MubF9idWYgKyBseF07CiAgICAgICAgICAgIGx4Kys7CiAgICAgICAgICAgIGlmIChkaXN0ID09PSAwKSB7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGxjLCBsdHJlZSk7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgY29kZSA9IF9sZW5ndGhfY29kZVtsY107CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGNvZGUgKyBMSVRFUkFMUyArIDEsIGx0cmVlKTsKICAgICAgICAgICAgICBleHRyYSA9IGV4dHJhX2xiaXRzW2NvZGVdOwogICAgICAgICAgICAgIGlmIChleHRyYSAhPT0gMCkgewogICAgICAgICAgICAgICAgbGMgLT0gYmFzZV9sZW5ndGhbY29kZV07CiAgICAgICAgICAgICAgICBzZW5kX2JpdHMocywgbGMsIGV4dHJhKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgZGlzdC0tOwogICAgICAgICAgICAgIGNvZGUgPSBkX2NvZGUoZGlzdCk7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGNvZGUsIGR0cmVlKTsKICAgICAgICAgICAgICBleHRyYSA9IGV4dHJhX2RiaXRzW2NvZGVdOwogICAgICAgICAgICAgIGlmIChleHRyYSAhPT0gMCkgewogICAgICAgICAgICAgICAgZGlzdCAtPSBiYXNlX2Rpc3RbY29kZV07CiAgICAgICAgICAgICAgICBzZW5kX2JpdHMocywgZGlzdCwgZXh0cmEpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfSB3aGlsZSAobHggPCBzLmxhc3RfbGl0KTsKICAgICAgICB9CiAgICAgICAgc2VuZF9jb2RlKHMsIEVORF9CTE9DSywgbHRyZWUpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJ1aWxkX3RyZWUocywgZGVzYykgewogICAgICAgIHZhciB0cmVlID0gZGVzYy5keW5fdHJlZTsKICAgICAgICB2YXIgc3RyZWUgPSBkZXNjLnN0YXRfZGVzYy5zdGF0aWNfdHJlZTsKICAgICAgICB2YXIgaGFzX3N0cmVlID0gZGVzYy5zdGF0X2Rlc2MuaGFzX3N0cmVlOwogICAgICAgIHZhciBlbGVtcyA9IGRlc2Muc3RhdF9kZXNjLmVsZW1zOwogICAgICAgIHZhciBuLCBtOwogICAgICAgIHZhciBtYXhfY29kZSA9IC0xOwogICAgICAgIHZhciBub2RlOwogICAgICAgIHMuaGVhcF9sZW4gPSAwOwogICAgICAgIHMuaGVhcF9tYXggPSBIRUFQX1NJWkU7CiAgICAgICAgZm9yIChuID0gMDsgbiA8IGVsZW1zOyBuKyspIHsKICAgICAgICAgIGlmICh0cmVlW24gKiAyXSAhPT0gMCkgewogICAgICAgICAgICBzLmhlYXBbKytzLmhlYXBfbGVuXSA9IG1heF9jb2RlID0gbjsKICAgICAgICAgICAgcy5kZXB0aFtuXSA9IDA7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0cmVlW24gKiAyICsgMV0gPSAwOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB3aGlsZSAocy5oZWFwX2xlbiA8IDIpIHsKICAgICAgICAgIG5vZGUgPSBzLmhlYXBbKytzLmhlYXBfbGVuXSA9IG1heF9jb2RlIDwgMiA/ICsrbWF4X2NvZGUgOiAwOwogICAgICAgICAgdHJlZVtub2RlICogMl0gPSAxOwogICAgICAgICAgcy5kZXB0aFtub2RlXSA9IDA7CiAgICAgICAgICBzLm9wdF9sZW4tLTsKICAgICAgICAgIGlmIChoYXNfc3RyZWUpIHsKICAgICAgICAgICAgcy5zdGF0aWNfbGVuIC09IHN0cmVlW25vZGUgKiAyICsgMV07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGRlc2MubWF4X2NvZGUgPSBtYXhfY29kZTsKICAgICAgICBmb3IgKG4gPSBzLmhlYXBfbGVuID4+IDE7IG4gPj0gMTsgbi0tKSB7CiAgICAgICAgICBwcWRvd25oZWFwKHMsIHRyZWUsIG4pOwogICAgICAgIH0KICAgICAgICBub2RlID0gZWxlbXM7CiAgICAgICAgZG8gewogICAgICAgICAgbiA9IHMuaGVhcFsxXTsKICAgICAgICAgIHMuaGVhcFsxXSA9IHMuaGVhcFtzLmhlYXBfbGVuLS1dOwogICAgICAgICAgcHFkb3duaGVhcChzLCB0cmVlLCAxKTsKICAgICAgICAgIG0gPSBzLmhlYXBbMV07CiAgICAgICAgICBzLmhlYXBbLS1zLmhlYXBfbWF4XSA9IG47CiAgICAgICAgICBzLmhlYXBbLS1zLmhlYXBfbWF4XSA9IG07CiAgICAgICAgICB0cmVlW25vZGUgKiAyXSA9IHRyZWVbbiAqIDJdICsgdHJlZVttICogMl07CiAgICAgICAgICBzLmRlcHRoW25vZGVdID0gKHMuZGVwdGhbbl0gPj0gcy5kZXB0aFttXSA/IHMuZGVwdGhbbl0gOiBzLmRlcHRoW21dKSArIDE7CiAgICAgICAgICB0cmVlW24gKiAyICsgMV0gPSB0cmVlW20gKiAyICsgMV0gPSBub2RlOwogICAgICAgICAgcy5oZWFwWzFdID0gbm9kZSsrOwogICAgICAgICAgcHFkb3duaGVhcChzLCB0cmVlLCAxKTsKICAgICAgICB9IHdoaWxlIChzLmhlYXBfbGVuID49IDIpOwogICAgICAgIHMuaGVhcFstLXMuaGVhcF9tYXhdID0gcy5oZWFwWzFdOwogICAgICAgIGdlbl9iaXRsZW4ocywgZGVzYyk7CiAgICAgICAgZ2VuX2NvZGVzKHRyZWUsIG1heF9jb2RlLCBzLmJsX2NvdW50KTsKICAgICAgfQogICAgICBmdW5jdGlvbiBzY2FuX3RyZWUocywgdHJlZSwgbWF4X2NvZGUpIHsKICAgICAgICB2YXIgbjsKICAgICAgICB2YXIgcHJldmxlbiA9IC0xOwogICAgICAgIHZhciBjdXJsZW47CiAgICAgICAgdmFyIG5leHRsZW4gPSB0cmVlWzAgKiAyICsgMV07CiAgICAgICAgdmFyIGNvdW50ID0gMDsKICAgICAgICB2YXIgbWF4X2NvdW50ID0gNzsKICAgICAgICB2YXIgbWluX2NvdW50ID0gNDsKICAgICAgICBpZiAobmV4dGxlbiA9PT0gMCkgewogICAgICAgICAgbWF4X2NvdW50ID0gMTM4OwogICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICB9CiAgICAgICAgdHJlZVsobWF4X2NvZGUgKyAxKSAqIDIgKyAxXSA9IDY1NTM1OwogICAgICAgIGZvciAobiA9IDA7IG4gPD0gbWF4X2NvZGU7IG4rKykgewogICAgICAgICAgY3VybGVuID0gbmV4dGxlbjsKICAgICAgICAgIG5leHRsZW4gPSB0cmVlWyhuICsgMSkgKiAyICsgMV07CiAgICAgICAgICBpZiAoKytjb3VudCA8IG1heF9jb3VudCAmJiBjdXJsZW4gPT09IG5leHRsZW4pIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvdW50IDwgbWluX2NvdW50KSB7CiAgICAgICAgICAgIHMuYmxfdHJlZVtjdXJsZW4gKiAyXSArPSBjb3VudDsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VybGVuICE9PSAwKSB7CiAgICAgICAgICAgIGlmIChjdXJsZW4gIT09IHByZXZsZW4pIHsKICAgICAgICAgICAgICBzLmJsX3RyZWVbY3VybGVuICogMl0rKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBzLmJsX3RyZWVbUkVQXzNfNiAqIDJdKys7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvdW50IDw9IDEwKSB7CiAgICAgICAgICAgIHMuYmxfdHJlZVtSRVBaXzNfMTAgKiAyXSsrOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5ibF90cmVlW1JFUFpfMTFfMTM4ICogMl0rKzsKICAgICAgICAgIH0KICAgICAgICAgIGNvdW50ID0gMDsKICAgICAgICAgIHByZXZsZW4gPSBjdXJsZW47CiAgICAgICAgICBpZiAobmV4dGxlbiA9PT0gMCkgewogICAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiA9PT0gbmV4dGxlbikgewogICAgICAgICAgICBtYXhfY291bnQgPSA2OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNzsKICAgICAgICAgICAgbWluX2NvdW50ID0gNDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2VuZF90cmVlKHMsIHRyZWUsIG1heF9jb2RlKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIHByZXZsZW4gPSAtMTsKICAgICAgICB2YXIgY3VybGVuOwogICAgICAgIHZhciBuZXh0bGVuID0gdHJlZVswICogMiArIDFdOwogICAgICAgIHZhciBjb3VudCA9IDA7CiAgICAgICAgdmFyIG1heF9jb3VudCA9IDc7CiAgICAgICAgdmFyIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgIG1heF9jb3VudCA9IDEzODsKICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDA7IG4gPD0gbWF4X2NvZGU7IG4rKykgewogICAgICAgICAgY3VybGVuID0gbmV4dGxlbjsKICAgICAgICAgIG5leHRsZW4gPSB0cmVlWyhuICsgMSkgKiAyICsgMV07CiAgICAgICAgICBpZiAoKytjb3VudCA8IG1heF9jb3VudCAmJiBjdXJsZW4gPT09IG5leHRsZW4pIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvdW50IDwgbWluX2NvdW50KSB7CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBzZW5kX2NvZGUocywgY3VybGVuLCBzLmJsX3RyZWUpOwogICAgICAgICAgICB9IHdoaWxlICgtLWNvdW50ICE9PSAwKTsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VybGVuICE9PSAwKSB7CiAgICAgICAgICAgIGlmIChjdXJsZW4gIT09IHByZXZsZW4pIHsKICAgICAgICAgICAgICBzZW5kX2NvZGUocywgY3VybGVuLCBzLmJsX3RyZWUpOwogICAgICAgICAgICAgIGNvdW50LS07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2VuZF9jb2RlKHMsIFJFUF8zXzYsIHMuYmxfdHJlZSk7CiAgICAgICAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDMsIDIpOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkgewogICAgICAgICAgICBzZW5kX2NvZGUocywgUkVQWl8zXzEwLCBzLmJsX3RyZWUpOwogICAgICAgICAgICBzZW5kX2JpdHMocywgY291bnQgLSAzLCAzKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHNlbmRfY29kZShzLCBSRVBaXzExXzEzOCwgcy5ibF90cmVlKTsKICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGNvdW50IC0gMTEsIDcpOwogICAgICAgICAgfQogICAgICAgICAgY291bnQgPSAwOwogICAgICAgICAgcHJldmxlbiA9IGN1cmxlbjsKICAgICAgICAgIGlmIChuZXh0bGVuID09PSAwKSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDEzODsKICAgICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDY7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBtYXhfY291bnQgPSA3OwogICAgICAgICAgICBtaW5fY291bnQgPSA0OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBidWlsZF9ibF90cmVlKHMpIHsKICAgICAgICB2YXIgbWF4X2JsaW5kZXg7CiAgICAgICAgc2Nhbl90cmVlKHMsIHMuZHluX2x0cmVlLCBzLmxfZGVzYy5tYXhfY29kZSk7CiAgICAgICAgc2Nhbl90cmVlKHMsIHMuZHluX2R0cmVlLCBzLmRfZGVzYy5tYXhfY29kZSk7CiAgICAgICAgYnVpbGRfdHJlZShzLCBzLmJsX2Rlc2MpOwogICAgICAgIGZvciAobWF4X2JsaW5kZXggPSBCTF9DT0RFUyAtIDE7IG1heF9ibGluZGV4ID49IDM7IG1heF9ibGluZGV4LS0pIHsKICAgICAgICAgIGlmIChzLmJsX3RyZWVbYmxfb3JkZXJbbWF4X2JsaW5kZXhdICogMiArIDFdICE9PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLm9wdF9sZW4gKz0gMyAqIChtYXhfYmxpbmRleCArIDEpICsgNSArIDUgKyA0OwogICAgICAgIHJldHVybiBtYXhfYmxpbmRleDsKICAgICAgfQogICAgICBmdW5jdGlvbiBzZW5kX2FsbF90cmVlcyhzLCBsY29kZXMsIGRjb2RlcywgYmxjb2RlcykgewogICAgICAgIHZhciByYW5rOwogICAgICAgIHNlbmRfYml0cyhzLCBsY29kZXMgLSAyNTcsIDUpOwogICAgICAgIHNlbmRfYml0cyhzLCBkY29kZXMgLSAxLCA1KTsKICAgICAgICBzZW5kX2JpdHMocywgYmxjb2RlcyAtIDQsIDQpOwogICAgICAgIGZvciAocmFuayA9IDA7IHJhbmsgPCBibGNvZGVzOyByYW5rKyspIHsKICAgICAgICAgIHNlbmRfYml0cyhzLCBzLmJsX3RyZWVbYmxfb3JkZXJbcmFua10gKiAyICsgMV0sIDMpOwogICAgICAgIH0KICAgICAgICBzZW5kX3RyZWUocywgcy5keW5fbHRyZWUsIGxjb2RlcyAtIDEpOwogICAgICAgIHNlbmRfdHJlZShzLCBzLmR5bl9kdHJlZSwgZGNvZGVzIC0gMSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGV0ZWN0X2RhdGFfdHlwZShzKSB7CiAgICAgICAgdmFyIGJsYWNrX21hc2sgPSA0MDkzNjI0NDQ3OwogICAgICAgIHZhciBuOwogICAgICAgIGZvciAobiA9IDA7IG4gPD0gMzE7IG4rKywgYmxhY2tfbWFzayA+Pj49IDEpIHsKICAgICAgICAgIGlmIChibGFja19tYXNrICYgMSAmJiBzLmR5bl9sdHJlZVtuICogMl0gIT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIFpfQklOQVJZOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5keW5fbHRyZWVbOSAqIDJdICE9PSAwIHx8IHMuZHluX2x0cmVlWzEwICogMl0gIT09IDAgfHwgcy5keW5fbHRyZWVbMTMgKiAyXSAhPT0gMCkgewogICAgICAgICAgcmV0dXJuIFpfVEVYVDsKICAgICAgICB9CiAgICAgICAgZm9yIChuID0gMzI7IG4gPCBMSVRFUkFMUzsgbisrKSB7CiAgICAgICAgICBpZiAocy5keW5fbHRyZWVbbiAqIDJdICE9PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBaX1RFWFQ7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBaX0JJTkFSWTsKICAgICAgfQogICAgICB2YXIgc3RhdGljX2luaXRfZG9uZSA9IGZhbHNlOwogICAgICBmdW5jdGlvbiBfdHJfaW5pdChzKSB7CiAgICAgICAgaWYgKCFzdGF0aWNfaW5pdF9kb25lKSB7CiAgICAgICAgICB0cl9zdGF0aWNfaW5pdCgpOwogICAgICAgICAgc3RhdGljX2luaXRfZG9uZSA9IHRydWU7CiAgICAgICAgfQogICAgICAgIHMubF9kZXNjID0gbmV3IFRyZWVEZXNjKHMuZHluX2x0cmVlLCBzdGF0aWNfbF9kZXNjKTsKICAgICAgICBzLmRfZGVzYyA9IG5ldyBUcmVlRGVzYyhzLmR5bl9kdHJlZSwgc3RhdGljX2RfZGVzYyk7CiAgICAgICAgcy5ibF9kZXNjID0gbmV3IFRyZWVEZXNjKHMuYmxfdHJlZSwgc3RhdGljX2JsX2Rlc2MpOwogICAgICAgIHMuYmlfYnVmID0gMDsKICAgICAgICBzLmJpX3ZhbGlkID0gMDsKICAgICAgICBpbml0X2Jsb2NrKHMpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF90cl9zdG9yZWRfYmxvY2socywgYnVmLCBzdG9yZWRfbGVuLCBsYXN0KSB7CiAgICAgICAgc2VuZF9iaXRzKHMsIChTVE9SRURfQkxPQ0sgPDwgMSkgKyAobGFzdCA/IDEgOiAwKSwgMyk7CiAgICAgICAgY29weV9ibG9jayhzLCBid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gICAgdmFyIHMxID0gYWRsZXIgJiA2NTUzNSB8IDAsIHMyID0gYWRsZXIgPj4+IDE2ICYgNjU1MzUgfCAwLCBuID0gMDsKICAgICAgICB3aGlsZSAobGVuICE9PSAwKSB7CiAgICAgICAgICBuID0gbGVuID4gMmUzID8gMmUzIDogbGVuOwogICAgICAgICAgbGVuIC09IG47CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIHMxID0gczEgKyBidWZbcG9zKytdIHwgMDsKICAgICAgICAgICAgczIgPSBzMiArIHMxIHwgMDsKICAgICAgICAgIH0gd2hpbGUgKC0tbik7CiAgICAgICAgICBzMSAlPSA2NTUyMTsKICAgICAgICAgIHMyICU9IDY1NTIxOwogICAgICAgIH0KICAgICAgICByZXR1cm4gczEgfCBzMiA8PCAxNiB8IDA7CiAgICAgIH0KICAgICAgbW9kdWxlLmV4cG9ydHMgPSBhZGxlcjMyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvY3JjMzIuanMKICB2YXIgcmVxdWlyZV9jcmMzMiA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9jcmMzMi5qcyIoZXhwb3J0cywgbW9kdWxlKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBmdW5jdGlvbiBtYWtlVGFibGUoKSB7CiAgICAgICAgdmFyIGMsIHRhYmxlID0gW107CiAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCAyNTY7IG4rKykgewogICAgICAgICAgYyA9IG47CiAgICAgICAgICBmb3IgKHZhciBrID0gMDsgayA8IDg7IGsrKykgewogICAgICAgICAgICBjID0gYyAmIDEgPyAzOTg4MjkyMzg0IF4gYyA+Pj4gMSA6IGMgPj4+IDE7CiAgICAgICAgICB9CiAgICAgICAgICB0YWJsZVtuXSA9IGM7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0YWJsZTsKICAgICAgfQogICAgICB2YXIgY3JjVGFibGUgPSBtYWtlVGFibGUoKTsKICAgICAgZnVuY3Rpb24gY3JjMzIyKGNyYywgYnVmLCBsZW4sIHBvcykgewogICAgICAgIHZhciB0ID0gY3JjVGFibGUsIGVuZCA9IHBvcyArIGxlbjsKICAgICAgICBjcmMgXj0gLTE7CiAgICAgICAgZm9yICh2YXIgaSA9IHBvczsgaSA8IGVuZDsgaSsrKSB7CiAgICAgICAgICBjcmMgPSBjcmMgPj4+IDggXiB0WyhjcmMgXiBidWZbaV0pICYgMjU1XTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGNyYyBeIC0xOwogICAgICB9CiAgICAgIG1vZHVsZS5leHBvcnRzID0gY3JjMzIyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvbWVzc2FnZXMuanMKICB2YXIgcmVxdWlyZV9tZXNzYWdlczIgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvbWVzc2FnZXMuanMiKGV4cG9ydHMsIG1vZHVsZSkgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgbW9kdWxlLmV4cG9ydHMgPSB7CiAgICAgICAgMjogIm5lZWQgZGljdGlvbmFyeSIsCiAgICAgICAgMTogInN0cmVhbSBlbmQiLAogICAgICAgIDA6ICIiLAogICAgICAgICItMSI6ICJmaWxlIGVycm9yIiwKICAgICAgICAiLTIiOiAic3RyZWFtIGVycm9yIiwKICAgICAgICAiLTMiOiAiZGF0YSBlcnJvciIsCiAgICAgICAgIi00IjogImluc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E7CiAgICAgIHZhciBCU19CTE9DS19ET05FID0gMjsKICAgICAgdmFyIEJTX0ZJTklTSF9TVEFSVEVEID0gMzsKICAgICAgdmFyIEJTX0ZJTklTSF9ET05FID0gNDsKICAgICAgdmFyIE9TX0NPREUgPSAzOwogICAgICBmdW5jdGlvbiBlcnIoc3RybSwgZXJyb3JDb2RlKSB7CiAgICAgICAgc3RybS5tc2cgPSBtc2dbZXJyb3JDb2RlXTsKICAgICAgICByZXR1cm4gZXJyb3JDb2RlOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHJhbmsoZikgewogICAgICAgIHJldHVybiAoZiA8PCAxKSAtIChmID4gNCA/IDkgOiAwKTsKICAgICAgfQogICAgICBmdW5jdGlvbiB6ZXJvKGJ1ZikgewogICAgICAgIHZhciBsZW4gPSBidWYubGVuZ3RoOwogICAgICAgIHdoaWxlICgtLWxlbiA+PSAwKSB7CiAgICAgICAgICBidWZbbGVuXSA9IDA7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZsdXNoX3BlbmRpbmcoc3RybSkgewogICAgICAgIHZhciBzID0gc3RybS5zdGF0ZTsKICAgICAgICB2YXIgbGVuID0gcy5wZW5kaW5nOwogICAgICAgIGlmIChsZW4gPiBzdHJtLmF2YWlsX291dCkgewogICAgICAgICAgbGVuID0gc3RybS5hdmFpbF9vdXQ7CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gPT09IDApIHsKICAgICAgICAgIHJldHVybjsKICAgICAgICB9CiAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RybS5vdXRwdXQsIHMucGVuZGluZ19idWYsIHMucGVuZGluZ19vdXQsIGxlbiwgc3RybS5uZXh0X291dCk7CiAgICAgICAgc3RybS5uZXh0X291dCArPSBsZW47CiAgICAgICAgcy5wZW5kaW5nX291dCArPSBsZW47CiAgICAgICAgc3RybS50b3RhbF9vdXQgKz0gbGVuOwogICAgICAgIHN0cm0uYXZhaWxfb3V0IC09IGxlbjsKICAgICAgICBzLnBlbmRpbmcgLT0gbGVuOwogICAgICAgIGlmIChzLnBlbmRpbmcgPT09IDApIHsKICAgICAgICAgIHMucGVuZGluZ19vdXQgPSAwOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBmbHVzaF9ibG9ja19vbmx5KHMsIGxhc3QpIHsKICAgICAgICB0cmVlcy5fdHJfZmx1c2hfYmxvY2socywgcy5ibG9ja19zdGFydCA+PSAwID8gcy5ibG9ja19zdGFydCA6IC0xLCBzLnN0cnN0YXJ0IC0gcy5ibG9ja19zdGFydCwgbGFzdCk7CiAgICAgICAgcy5ibG9ja19zdGFydCA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgZmx1c2hfcGVuZGluZyhzLnN0cm0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHB1dF9ieXRlKHMsIGIpIHsKICAgICAgICBzLnBlbmRpbmdfYnVmW3MucGVuZGluZysrXSA9IGI7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcHV0U2hvcnRNU0IocywgYikgewogICAgICAgIHMucGVuZGluZ19idWZbcy5wZW5kaW5nKytdID0gYiA+Pj4gOCAmIDI1NTsKICAgICAgICBzLnBlbmRpbmdfYnVmW3MucGVuZGluZysrXSA9IGIgJiAyNTU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcmVhZF9idWYoc3RybSwgYnVmLCBzdGFydCwgc2l6ZSkgewogICAgICAgIHZhciBsZW4gPSBzdHJtLmF2YWlsX2luOwogICAgICAgIGlmIChsZW4gPiBzaXplKSB7CiAgICAgICAgICBsZW4gPSBzaXplOwogICAgICAgIH0KICAgICAgICBpZiAobGVuID09PSAwKSB7CiAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB9CiAgICAgICAgc3RybS5hdmFpbF9pbiAtPSBsZW47CiAgICAgICAgdXRpbHMuYXJyYXlTZXQoYnVmLCBzdHJtLmlucHV0LCBzdHJtLm5leHRfaW4sIGxlbiwgc3RhcnQpOwogICAgICAgIGlmIChzdHJ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lc3RfbGVuXTsKICAgICAgICBpZiAocy5wcmV2X2xlbmd0aCA+PSBzLmdvb2RfbWF0Y2gpIHsKICAgICAgICAgIGNoYWluX2xlbmd0aCA+Pj0gMjsKICAgICAgICB9CiAgICAgICAgaWYgKG5pY2VfbWF0Y2ggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgbmljZV9tYXRjaCA9IHMubG9va2FoZWFkOwogICAgICAgIH0KICAgICAgICBkbyB7CiAgICAgICAgICBtYXRjaCA9IGN1cl9tYXRjaDsKICAgICAgICAgIGlmIChfd2luW21hdGNoICsgYmVzdF9sZW5dICE9PSBzY2FuX2VuZCB8fCBfd2luW21hdGNoICsgYmVzdF9sZW4gLSAxXSAhPT0gc2Nhbl9lbmQxIHx8IF93aW5bbWF0Y2hdICE9PSBfd2luW3NjYW5dIHx8IF93aW5bKyttYXRjaF0gIT09IF93aW5bc2NhbiArIDFdKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgc2NhbiArPSAyOwogICAgICAgICAgbWF0Y2grKzsKICAgICAgICAgIGRvIHsKICAgICAgICAgIH0gd2hpbGUgKF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgc2NhbiA8IHN0cmVuZCk7CiAgICAgICAgICBsZW4gPSBNQVhfTUFUQ0ggLSAoc3RyZW5kIC0gc2Nhbik7CiAgICAgICAgICBzY2FuID0gc3RyZW5kIC0gTUFYX01BVENIOwogICAgICAgICAgaWYgKGxlbiA+IGJlc3RfbGVuKSB7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgPSBjdXJfbWF0Y2g7CiAgICAgICAgICAgIGJlc3RfbGVuID0gbGVuOwogICAgICAgICAgICBpZiAobGVuID49IG5pY2VfbWF0Y2gpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBzY2FuX2VuZDEgPSBfd2luW3NjYW4gKyBiZXN0X2xlbiAtIDFdOwogICAgICAgICAgICBzY2FuX2VuZCA9IF93aW5bc2NhbiArIGJlc3RfbGVuXTsKICAgICAgICAgIH0KICAgICAgICB9IHdoaWxlICgoY3VyX21hdGNoID0gcHJldltjdXJfbWF0Y2ggJiB3bWFza10pID4gbGltaXQgJiYgLS1jaGFpbl9sZW5ndGggIT09IDApOwogICAgICAgIGlmIChiZXN0X2xlbiA8PSBzLmxvb2thaGVhZCkgewogICAgICAgICAgcmV0dXJuIGJlc3RfbGVuOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcy5sb29rYWhlYWQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZmlsbF93aW5kb3cocykgewogICAgICAgIHZhciBfd19zaXplID0gcy53X3NpemU7CiAgICAgICAgdmFyIHAsIG4sIG0sIG1vcmUsIHN0cjsKICAgICAgICBkbyB7CiAgICAgICAgICBtb3JlID0gcy53aW5kb3dfc2l6ZSAtIHMubG9va2FoZWFkIC0gcy5zdHJzdGFydDsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID49IF93X3NpemUgKyAoX3dfc2l6ZSAtIE1JTl9MT09LQUhFQUQpKSB7CiAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHMud2luZG93LCBzLndpbmRvdywgX3dfc2l6ZSwgX3dfc2l6ZSwgMCk7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgLT0gX3dfc2l6ZTsKICAgICAgICAgICAgcy5zdHJzdGFydCAtPSBfd19zaXplOwogICAgICAgICAgICBzLmJsb2NrX3N0YXJ0IC09IF93X3NpemU7CiAgICAgICAgICAgIG4gPSBzLmhhc2hfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5oZWFkWy0tcF07CiAgICAgICAgICAgICAgcy5oZWFkW3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBuID0gX3dfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5wcmV2Wy0tcF07CiAgICAgICAgICAgICAgcy5wcmV2W3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBtb3JlICs9IF93X3NpemU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX2luID09PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgbiA9IHJlYWRfYnVmKHMuc3RybSwgcy53aW5kb3csIHMuc3Ryc3RhcnQgKyBzLmxvb2thaGVhZCwgbW9yZSk7CiAgICAgICAgICBzLmxvb2thaGVhZCArPSBuOwogICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHN0ciA9IHMuc3Ryc3RhcnQgLSBzLmluc2VydDsKICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3N0cl07CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzdHIgKyAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgd2hpbGUgKHMuaW5zZXJ0KSB7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3N0ciArIE1JTl9NQVRDSCAtIDFdKSAmIHMuaGFzaF9tYXNrOwogICAgICAgICAgICAgIHMucHJldltzdHIgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gc3RyOwogICAgICAgICAgICAgIHN0cisrOwogICAgICAgICAgICAgIHMuaW5zZXJ0LS07CiAgICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPCBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBzLnN0cm0uYXZhaWxfaW4gIT09IDApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVfc3RvcmVkKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIG1heF9ibG9ja19zaXplID0gNjU1MzU7CiAgICAgICAgaWYgKG1heF9ibG9ja19zaXplID4gcy5wZW5kaW5nX2J1Zl9zaXplIC0gNSkgewogICAgICAgICAgbWF4X2Jsb2NrX3NpemUgPSBzLnBlbmRpbmdfYnVmX3NpemUgLSA1OwogICAgICAgIH0KICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8PSAxKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDAgJiYgZmx1c2ggPT09IFpfTk9fRkxVU0gpIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBzLnN0cnN0YXJ0ICs9IHMubG9va2FoZWFkOwogICAgICAgICAgcy5sb29rYWhlYWQgPSAwOwogICAgICAgICAgdmFyIG1heF9zdGFydCA9IHMuYmxvY2tfc3RhcnQgKyBtYXhfYmxvY2tfc2l6ZTsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID09PSAwIHx8IHMuc3Ryc3RhcnQgPj0gbWF4X3N0YXJ0KSB7CiAgICAgICAgICAgIHMubG9va2FoZWFkID0gcy5zdHJzdGFydCAtIG1heF9zdGFydDsKICAgICAgICAgICAgcy5zdHJzdGFydCA9IG1heF9zdGFydDsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgLSBzLmJsb2NrX3N0YXJ0ID49IHMud19zaXplIC0gTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5zdHJzdGFydCA+IHMuYmxvY2tfc3RhcnQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX2Zhc3QocywgZmx1c2gpIHsKICAgICAgICB2YXIgaGFzaF9oZWFkOwogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEICYmIGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDApIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaGFzaF9oZWFkID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgaGFzaF9oZWFkID0gcy5wcmV2W3Muc3Ryc3RhcnQgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoaGFzaF9oZWFkICE9PSAwICYmIHMuc3Ryc3RhcnQgLSBoYXNoX2hlYWQgPD0gcy53X3NpemUgLSBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gbG9uZ2VzdF9tYXRjaChzLCBoYXNoX2hlYWQpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHMubWF0Y2hfbGVuZ3RoID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICBiZmx1c2ggPSB0cmVlcy5fdHJfdGFsbHkocywgcy5zdHJzdGFydCAtIHMubWF0Y2hfc3RhcnQsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA8PSBzLm1heF9sYXp5X21hdGNoICYmIHMubG9va2FoZWFkID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoLS07CiAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9IHdoaWxlICgtLXMubWF0Y2hfbGVuZ3RoICE9PSAwKTsKICAgICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcy5zdHJzdGFydCArPSBzLm1hdGNoX2xlbmd0aDsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3Muc3Ryc3RhcnRdOwogICAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IHMuc3Ryc3RhcnQgPCBNSU5fTUFUQ0ggLSAxID8gcy5zdHJzdGFydCA6IE1JTl9NQVRDSCAtIDE7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9zbG93KHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGhhc2hfaGVhZDsKICAgICAgICB2YXIgYmZsdXNoOwogICAgICAgIHZhciBtYXhfaW5zZXJ0OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGhhc2hfaGVhZCA9IDA7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgTUlOX01BVENIIC0gMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICBzLmhlYWR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d0aCAtIDE7CiAgICAgICAgICAgIHMucHJldl9sZW5ndGggLT0gMjsKICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgIGlmICgrK3Muc3Ryc3RhcnQgPD0gbWF4X2luc2VydCkgewogICAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gd2hpbGUgKC0tcy5wcmV2X2xlbmd0aCAhPT0gMCk7CiAgICAgICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMDsKICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAocy5tYXRjaF9hdmFpbGFibGUpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5tYXRjaF9hdmFpbGFibGUgPSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLm1hdGNoX2F2YWlsYWJsZSkgewogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICBzLm1hdGNoX2F2YWlsYWJsZSA9IDA7CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gcy5zdHJzdGFydCA8IE1JTl9NQVRDSCAtIDEgPyBzLnN0cnN0YXJ0IDogTUlOX01BVENIIC0gMTsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5sYXN0X2xpdCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gQlNfQkxPQ0tfRE9ORTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX3JsZShzLCBmbHVzaCkgewogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgdmFyIHByZXY7CiAgICAgICAgdmFyIHNjYW4sIHN0cmVuZDsKICAgICAgICB2YXIgX3dpbiA9IHMud2luZG93OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0ggJiYgcy5zdHJzdGFydCA+IDApIHsKICAgICAgICAgICAgc2NhbiA9IHMuc3Ryc3RhcnQgLSAxOwogICAgICAgICAgICBwcmV2ID0gX3dpbltzY2FuXTsKICAgICAgICAgICAgaWYgKHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dKSB7CiAgICAgICAgICAgICAgc3RyZW5kID0gcy5zdHJzdGFydCArIE1BWF9NQVRDSDsKICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgfSB3aGlsZSAocHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBzY2FuIDwgc3RyZW5kKTsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IE1BWF9NQVRDSCAtIChzdHJlbmQgLSBzY2FuKTsKICAgICAgICAgICAgICBpZiAocy5tYXRjaF9sZW5ndGggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBzLmxvb2thaGVhZDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDEsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgKz0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IDA7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9odWZmKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGJmbHVzaDsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSAwOwogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnRdKTsKICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgIGlmIChmbHVzaCA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgdHJ1ZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX1NUQVJURUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX0RPTkU7CiAgICAgICAgfQogICAgICAgIGlmIChzLmxhc3RfbGl0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBCU19CTE9DS19ET05FOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIENvbmZpZyhnb29kX2xlbmd0aCwgbWF4X2xhenksIG5pY2VfbGVuZ3RoLCBtYXhfY2hhaW4sIGZ1bmMpIHsKICAgICAgICB0aGlzLmdvb2RfbGVuZ3RoID0gZ29vZF9sZW5ndGg7CiAgICAgICAgdGhpcy5tYXhfbGF6eSA9IG1heF9sYXp5OwogICAgICAgIHRoaXMubmljZV9sZW5ndGggPSBuaWNlX2xlbmd0aDsKICAgICAgICB0aGlzLm1heF9jaGFpbi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ICAgICAgIHMubmljZV9tYXRjaCA9IGNvbmZpZ3VyYXRpb25fdGFibGVbcy5sZXZlbF0ubmljZV9sZW5ndGg7CiAgICAgICAgcy5tYXhfY2hhaW5fbGVuZ3RoID0gY29uZmlndXJhdGlvbl90YWJsZVtzLmxldmVsXS5tYXhfY2hhaW47CiAgICAgICAgcy5zdHJzdGFydCA9IDA7CiAgICAgICAgcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgcy5sb29rYWhlYWQgPSAwOwogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IHMucHJldl9sZW5ndGggPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMDsKICAgICAgICBzLmluc19oID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBEZWZsYXRlU3RhdGUoKSB7CiAgICAgICAgdGhpcy5zdHJtID0gbnVsbDsKICAgICAgICB0aGlzLnN0YXR1cyA9IDA7CiAgICAgICAgdGhpcy5wZW5kaW5nX2J1ZiA9IG51bGw7CiAgICAgICAgdGhpcy5wZW5kaW5nX2J1Zl9zaXplID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmcgPSAwOwogICAgICAgIHRoaXMud3JhcCA9IDA7CiAgICAgICAgdGhpcy5nemhlYWQgPSBudWxsOwogICAgICAgIHRoaXMuZ3ppbmRleCA9IDA7CiAgICAgICAgdGhpcy5tZXRob2QgPSBaX0RFRkxBVEVEOwogICAgICAgIHRoaXMubGFzdF9mbHVzaCA9IC0xOwogICAgICAgIHRoaXMud19zaXplID0gMDsKICAgICAgICB0aGlzLndfYml0cyA9IDA7CiAgICAgICAgdGhpcy53X21hc2sgPSAwOwogICAgICAgIHRoaXMud2luZG93ID0gbnVsbDsKICAgICAgICB0aGlzLndpbmRvd19zaXplID0gMDsKICAgICAgICB0aGlzLnByZXYgPSBudWxsOw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cy5ibF90cmVlKTsKICAgICAgICB0aGlzLmxfZGVzYyA9IG51bGw7CiAgICAgICAgdGhpcy5kX2Rlc2MgPSBudWxsOwogICAgICAgIHRoaXMuYmxfZGVzYyA9IG51bGw7CiAgICAgICAgdGhpcy5ibF9jb3VudCA9IG5ldyB1dGlscy5CdWYxNihNQVhfQklUUyArIDEpOwogICAgICAgIHRoaXMuaGVhcCA9IG5ldyB1dGlscy5CdWYxNigyICogTF9DT0RFUyArIDEpOwogICAgICAgIHplcm8odGhpcy5oZWFwKTsKICAgICAgICB0aGlzLmhlYXBfbGVuID0gMDsKICAgICAgICB0aGlzLmhlYXBfbWF4ID0gMDsKICAgICAgICB0aGlzLmRlcHRoID0gbmV3IHV0aWxzLkJ1ZjE2KDIgKiBMX0NPREVTICsgMSk7CiAgICAgICAgemVybyh0aGlzLmRlcHRoKTsKICAgICAgICB0aGlzLmxfYnVmID0gMDsKICAgICAgICB0aGlzLmxpdF9idWZzaXplID0gMDsKICAgICAgICB0aGlzLmxhc3RfbGl0ID0gMDsKICAgICAgICB0aGlzLmRfYnVmID0gMDsKICAgICAgICB0aGlzLm9wdF9sZW4gPSAwOwogICAgICAgIHRoaXMuc3RhdGljX2xlbiA9IDA7CiAgICAgICAgdGhpcy5tYXRjaGVzID0gMDsKICAgICAgICB0aGlzLmluc2VydCA9IDA7CiAgICAgICAgdGhpcy5iaV9idWYgPSAwOwogICAgICAgIHRoaXMuYmlfdmFsaWQgPSAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVSZXNldEtlZXAoc3RybSkgewogICAgICAgIHZhciBzOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBaX1NUUkVBTV9FUlJPUik7CiAgICAgICAgfQogICAgICAgIHN0cm0udG90YWxfaW4gPSBzdHJtLnRvdGFsX291dCA9IDA7CiAgICAgICAgc3RybS5kYXRhX3R5cGUgPSBaX1VOS05PV047CiAgICAgICAgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgcy5wZW5kaW5nID0gMDsKICAgICAgICBzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICBpZiAocy53cmFwIDwgMCkgewogICAgICAgICAgcy53cmFwID0gLXMud3JhcDsKICAgICAgICB9CiAgICAgICAgcy5zdGF0dXMgPSBzLndyYXAgPyBJTklUX1NUQVRFIDogQlVTWV9TVEFURTsKICAgICAgICBzdHJtLmFkbGVyID0gcy53cmFwID09PSAyID8gMCA6IDE7CiAgICAgICAgcy5sYXN0X2ZsdXNoID0gWl9OT19GTFVTSDsKICAgICAgICB0cmVlcy5fdHJfaW5pdChzKTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlUmVzZXQoc3RybSkgewogICAgICAgIHZhciByZXQgPSBkZWZsYXRlUmVzZXRLZWVwKHN0cm0pOwogICAgICAgIGlmIChyZXQgPT09IFpfT0spIHsKICAgICAgICAgIGxtX2luaXQoc3RybS5zdGF0ZSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZVNldEhlYWRlcihzdHJtLCBoZWFkKSB7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdHJtLnN0YXRlLndyYXAgIT09IDIpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RybS5zdGF0ZS5nemhlYWQgPSBoZWFkOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVJbml0MihzdHJtLCBsZXZlbCwgbWV0aG9kLCB3aW5kb3dCaXRzLCBtZW1MZXZlbCwgc3RyYXRlZ3kpIHsKICAgICAgICBpZiAoIXN0cm0pIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgdmFyIHdyYXAgPSAxOwogICAgICAgIGlmIChsZXZlbCA9PT0gWl9ERUZBVUxUX0NPTVBSRVNTSU9OKSB7CiAgICAgICAgICBsZXZlbCA9IDY7CiAgICAgICAgfQogICAgICAgIGlmICh3aW5kb3dCaXRzIDwgMCkgewogICAgICAgICAgd3JhcCA9IDA7CiAgICAgICAgICB3aW5kb3dCaXRzID0gLXdpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIGlmICh3aW5kb3dCaXRzID4gMTUpIHsKICAgICAgICAgIHdyYXAgPSAyOwogICAgICAgICAgd2luZG93Qml0cyAtPSAxNjsKICAgICAgICB9CiAgICAgICAgaWYgKG1lbUxldmVsIDwgMSB8fCBtZW1MZXZlbCA+IE1BWF9NRU1fTEVWRUwgfHwgbWV0aG9kICE9PSBaX0RFRkxBVEVEIHx8IHdpbmRvd0JpdHMgPCA4IHx8IHdpbmRvd0JpdHMgPiAxNSB8fCBsZXZlbCA8IDAgfHwgbGV2ZWwgPiA5IHx8IHN0cmF0ZWd5IDwgMCB8fCBzdHJhdGVneSA+IFpfRklYRUQpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBpZiAod2luZG93Qml0cyA9PT0gOCkgewogICAgICAgICAgd2luZG93Qml0cyA9IDk7CiAgICAgICAgfQogICAgICAgIHZhciBzID0gbmV3IERlZmxhdGVTdGF0ZSgpOwogICAgICAgIHN0cm0uc3RhdGUgPSBzOwogICAgICAgIHMuc3RybSA9IHN0cm07CiAgICAgICAgcy53cmFwID0gd3JhcDsKICAgICAgICBzLmd6aGVhZCA9IG51bGw7CiAgICAgICAgcy53X2JpdHMgPSB3aW5kb3dCaXRzOwogICAgICAgIHMud19zaXplID0gMSA8PCBzLndfYml0czsKICAgICAgICBzLndfbWF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fU1RSQVRFR1kpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGUoc3RybSwgZmx1c2gpIHsKICAgICAgICB2YXIgb2xkX2ZsdXNoLCBzOwogICAgICAgIHZhciBiZWcsIHZhbDsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUgfHwgZmx1c2ggPiBaX0JMT0NLIHx8IGZsdXNoIDwgMCkgewogICAgICAgICAgcmV0dXJuIHN0cm0gPyBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpIDogWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHMgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICghc3RybS5vdXRwdXQgfHwgIXN0cm0uaW5wdXQgJiYgc3RybS5hdmFpbF9pbiAhPT0gMCB8fCBzLnN0YXR1cyA9PT0gRklOSVNIX1NUQVRFICYmIGZsdXNoICE9PSBaX0ZJTklTSCkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBzdHJtLmF2YWlsX291dCA9PT0gMCA/IFpfQlVGX0VSUk9SIDogWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBzLnN0cm0gPSBzdHJtOwogICAgICAgIG9sZF9mbHVzaCA9IHMubGFzdF9mbHVzaDsKICAgICAgICBzLmxhc3RfZmx1c2ggPSBmbHVzaDsKICAgICAgICBpZiAocy5zdGF0dXMgPT09IElOSVRfU1RBVEUpIHsKICAgICAgICAgIGlmIChzLndyYXAgPT09IDIpIHsKICAgICAgICAgICAgc3RybS5hZGxlciA9IDA7CiAgICAgICAgICAgIHB1dF9ieXRlKHMsIDMxKTsKICAgICAgICAgICAgcHV0X2J5dGUocywgMTM5KTsKICAgICAgICAgICAgcHV0X2J5dGUocywgOCk7CiAgICAgICAgICAgIGlmICghcy5nemhlYWQpIHsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgT1NfQ09ERSk7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50ZXh0ID8gMSA6IDApICsgKHMuZ3poZWFkLmhjcmMgPyAyIDogMCkgKyAoIXMuZ3poZWFkLmV4dHJhID8gMCA6IDQpICsgKCFzLmd6aGVhZC5uYW1lID8gMCA6IDgpICsgKCFzLmd6aGVhZC5jb21tZW50ID8gMCA6IDE2KSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSA+PiA4ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDE2ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDI0ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQub3MgJiAyNTUpOwogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5leHRyYSAmJiBzLmd6aGVhZC5leHRyYS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLmV4dHJhLmxlbmd0aCAmIDI1NSk7CiAgICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYS5sZW5ndGggPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjKSB7CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZywgMCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBFWFRSQV9TVEFURTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdmFyIGhlYWRlciA9IFpfREVGTEFURUQgKyAocy53X2JpdHMgLSA4IDw8IDQpIDw8IDg7CiAgICAgICAgICAgIHZhciBsZXZlbF9mbGFncyA9IC0xOwogICAgICAgICAgICBpZiAocy5zdHJhdGVneSA+PSBaX0hVRkZNQU5fT05MWSB8fCBzLmxldmVsIDwgMikgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMDsKICAgICAgICAgICAgfSBlbHNlIGlmIChzLmxldmVsIDwgNikgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMTsKICAgICAgICAgICAgfSBlbHNlIGlmIChzLmxldmVsID09PSA2KSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAyOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMzsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXIgfD0gbGV2ZWxfZmxhZ3MgPDwgNjsKICAgICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgIT09IDApIHsKICAgICAgICAgICAgICBoZWFkZXIgfD0gUFJFU0VUX0RJQ1Q7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaGVhZGVyICs9IDMxIC0gaGVhZGVyICUgMzE7CiAgICAgICAgICAgIHMuc3RhdHVzID0gQlVTWV9TVEFURTsKICAgICAgICAgICAgcHV0U2hvcnRNU0IocywgaGVhZGVyKTsKICAgICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgIT09IDApIHsKICAgICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBzdHJtLmFkbGVyID4+PiAxNik7CiAgICAgICAgICAgICAgcHV0U2hvcnRNU0Iocywgc3RybS5hZGxlciAmIDY1NTM1KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzdHJtLmFkbGVyID0gMTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBFWFRSQV9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLmV4dHJhKSB7CiAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgd2hpbGUgKHMuZ3ppbmRleCA8IChzLmd6aGVhZC5leHRyYS5sZW5ndGggJiA2NTUzNSkpIHsKICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLmV4dHJhW3MuZ3ppbmRleF0gJiAyNTUpOwogICAgICAgICAgICAgIHMuZ3ppbmRleCsrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMjIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPT09IHMuZ3poZWFkLmV4dHJhLmxlbmd0aCkgewogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBOQU1FX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IE5BTUVfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gTkFNRV9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLm5hbWUpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyMihzdHJtLmFkbGVyLCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmcgLSBiZWcsIGJlZyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICAgIHZhbCA9IDE7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBpZiAocy5nemluZGV4IDwgcy5nemhlYWQubmFtZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHZhbCA9IHMuZ3poZWFkLm5hbWUuY2hhckNvZGVBdChzLmd6aW5kZXgrKykgJiAyNTU7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHZhbCA9IDA7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHZhbCk7CiAgICAgICAgICAgIH0gd2hpbGUgKHZhbCAhPT0gMCk7CiAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMjIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh2YWwgPT09IDApIHsKICAgICAgICAgICAgICBzLmd6aW5kZXggPSAwOwogICAgICAgICAgICAgIHMuc3RhdHVzID0gQ09NTUVOVF9TVEFURTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5zdGF0dXMgPSBDT01NRU5UX1NUQVRFOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5zdGF0dXMgPT09IENPTU1FTlRfU1RBVEUpIHsKICAgICAgICAgIGlmIChzLmd6aGVhZC5jb21tZW50KSB7CiAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMjIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgICB2YWwgPSAxOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHMuZ3ppbmRleCA8IHMuZ3poZWFkLmNvbW1lbnQubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICB2YWwgPSBzLmd6aGVhZC5jb21tZW50LmNoYXJDb2RlQXQocy5nemluZGV4KyspICYgMjU1OwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB2YWwgPSAwOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwdXRfYnl0ZShzLCB2YWwpOwogICAgICAgICAgICB9IHdoaWxlICh2YWwgIT09IDApOwogICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodmFsID09PSAwKSB7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBIQ1JDX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IEhDUkNfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gSENSQ19TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMpIHsKICAgICAgICAgICAgaWYgKHMucGVuZGluZyArIDIgPiBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgKyAyIDw9IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgJiAyNTUpOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IEJVU1lfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnBlbmRpbmcgIT09IDApIHsKICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcy5sYXN0X2ZsdXNoID0gLTE7CiAgICAgICAgICAgIHJldHVybiBaX09LOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSBpZiAoc3RybS5hdmFpbF9pbiA9PT0gMCAmJiByYW5rKGZsdXNoKSA8PSByYW5rKG9sZF9mbHVzaCkgJiYgZmx1c2ggIT09IFpfRklOSVNIKSB7CiAgICAgICAgICByZXR1cm4gZXJyKHN0cm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AgICAgICAgdHJlZXMuX3RyX2FsaWduKHMpOwogICAgICAgICAgICB9IGVsc2UgaWYgKGZsdXNoICE9PSBaX0JMT0NLKSB7CiAgICAgICAgICAgICAgdHJlZXMuX3RyX3N0b3JlZF9ibG9jayhzLCAwLCAwLCBmYWxzZSk7CiAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZVTExfRkxVU0gpIHsKICAgICAgICAgICAgICAgIHplcm8ocy5oZWFkKTsKICAgICAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzLnN0cnN0YXJ0ID0gMDsKICAgICAgICAgICAgICAgICAgcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgICAgICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcy5sYXN0X2ZsdXNoID0gLTE7CiAgICAgICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKGZsdXNoICE9PSBaX0ZJTklTSCkgewogICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgfQogICAgICAgIGlmIChzLndyYXAgPD0gMCkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VORDsKICAgICAgICB9CiAgICAgICAgaWYgKHMud3JhcCA9PT0gMikgewogICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyID4+IDggJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciA+PiAxNiAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZSh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5JU0hfU1RBVEUpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBzdHJtLnN0YXRlID0gbnVsbDsKICAgICAgICByZXR1cm4gc3RhdHVzID09PSBCVVNZX1NUQVRFID8gZXJyKHN0cm0sIFpfREFUQV9FUlJPUikgOiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVTZXREaWN0aW9uYXJ5KHN0cm0sIGRpY3Rpb25hcnkpIHsKICAgICAgICB2YXIgZGljdExlbmd0aCA9IGRpY3Rpb25hcnkubGVuZ3RoOwogICAgICAgIHZhciBzOwogICAgICAgIHZhciBzdHIsIG47CiAgICAgICAgdmFyIHdyYXA7CiAgICAgICAgdmFyIGF2YWlsOwogICAgICAgIHZhciBuZXh0OwogICAgICAgIHZhciBpbnB1dDsKICAgICAgICB2YXIgdG1wRGljdDsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgd3JhcCA9IHMud3JhcDsKICAgICAgICBpZiAod3JhcCA9PT0gMiB8fCB3cmFwID09PSAxICYmIHMuc3RhdHVzICE9PSBJTklUX1NUQVRFIHx8IHMubG9va2FoZWFkKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmICh3cmFwID09PSAxKSB7CiAgICAgICAgICBzdHJtLmFkbGVyID0gYWRsZXIzMihzdHJtLmFkbGVyLCBkaWN0aW9uYXJ5LCBkaWN0TGVuZ3RoLCAwKTsKICAgICAgICB9CiAgICAgICAgcy53cmFwID0gMDsKICAgICAgICBpZiAoZGljdExlbmd0aCA+PSBzLndfc2l6ZSkgewogICAgICAgICAgaWYgKHdyYXAgPT09IDApIHsKICAgICAgICAgICAgemVybyhzLmhlYWQpOwogICAgICAgICAgICBzLnN0cnN0YXJ0ID0gMDsKICAgICAgICAgICAgcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIHRtcERpY3QgPSBuZXcgdXRpbHMuQnVmOChzLndfc2l6ZSk7CiAgICAgICAgICB1dGlscy5hcnJheVNldCh0bXBEaWN0LCBkaWN0aW9uYXJ5LCBkaWN0TGVuZ3RoIC0gcy53X3NpemUsIHMud19zaXplLCAwKTsKICAgICAgICAgIGRpY3Rpb25hcnkgPSB0bXBEaWN0OwogICAgICAgICAgZGljdExlbmd0aCA9IHMud19zaXplOwogICAgICAgIH0KICAgICAgICBhdmFpbCA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgbmV4dCA9IHN0cm0ubmV4dF9pbjsKICAgICAgICBpbnB1dCA9IHN0cm0uaW5wdXQ7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IGRpY3RMZW5ndGg7CiAgICAgICAgc3RybS5uZXh0X2luID0gMDsKICAgICAgICBzdHJtLmlucHV0ID0gZGljdGlvbmFyeTsKICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICB3aGlsZSAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICBzdHIgPSBzLnN0cnN0YXJ0OwogICAgICAgICAgbiA9IHMubG9va2FoZWFkIC0gKE1JTl9NQVRDSCAtIDEpOwogICAgICAgICAgZG8gewogICAgICAgICAgICBzLmluc19oID0gKHMuaW5zX2ggPDwgcy5oYXNoX3NoaWZ0IF4gcy53aW5kb3dbc3RyICsgTUlOX01BVENIIC0gMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIHMucHJldltzdHIgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHN0cjsKICAgICAgICAgICAgc3RyKys7CiAgICAgIC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3RyLmNoYXJDb2RlQXQobV9wb3MgKyAxKTsKICAgICAgICAgICAgaWYgKChjMiAmIDY0NTEyKSA9PT0gNTYzMjApIHsKICAgICAgICAgICAgICBjID0gNjU1MzYgKyAoYyAtIDU1Mjk2IDw8IDEwKSArIChjMiAtIDU2MzIwKTsKICAgICAgICAgICAgICBtX3BvcysrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDEyOCkgewogICAgICAgICAgICBidWZbaSsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCAyMDQ4KSB7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTkyIHwgYyA+Pj4gNjsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCA2NTUzNikgewogICAgICAgICAgICBidWZbaSsrXSA9IDIyNCB8IGMgPj4+IDEyOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDYgJiA2MzsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBidWZbaSsrXSA9IDI0MCB8IGMgPj4+IDE4OwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDEyICYgNjM7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTI4IHwgYyA+Pj4gNiAmIDYzOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgJiA2MzsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gYnVmMmJpbnN0cmluZyhidWYsIGxlbikgewogICAgICAgIGlmIChsZW4gPCA2NTUzNCkgewogICAgICAgICAgaWYgKGJ1Zi5zdWJhcnJheSAmJiBTVFJfQVBQTFlfVUlBX09LIHx8ICFidWYuc3ViYXJyYXkgJiYgU1RSX0FQUExZX09LKSB7CiAgICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KG51bGwsIHV0aWxzLnNocmlua0J1ZihidWYsIGxlbikpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB2YXIgcmVzdWx0ID0gIiI7CiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgcmVzdWx0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgfQogICAgICBleHBvcnRzLmJ1ZjJiaW5zdHJpbmcgPSBmdW5jdGlvbihidWYpIHsKICAgICAgICByZXR1cm4gYnVmMmJpbnN0cmluZyhidWYsIGJ1Zi5sZW5ndGgpOwogICAgICB9OwogICAgICBleHBvcnRzLmJpbnN0cmluZzJidWYgPSBmdW5jdGlvbihzdHIpIHsKICAgICAgICB2YXIgYnVmID0gbmV3IHV0aWxzLkJ1Zjgoc3RyLmxlbmd0aCk7CiAgICAgICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IGJ1Zi5sZW5ndGg7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgYnVmW2ldID0gc3RyLmNoYXJDb2RlQXQoaSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBidWY7CiAgICAgIH07CiAgICAgIGV4cG9ydHMuYnVmMnN0cmluZyA9IGZ1bmN0aW9uKGJ1ZiwgbWF4KSB7CiAgICAgICAgdmFyIGksIG91dCwgYywgY19sZW47CiAgICAgICAgdmFyIGxlbiA9IG1heCB8fCBidWYubGVuZ3RoOwogICAgICAgIHZhciB1dGYxNmJ1ZiA9IG5ldyBBcnJheShsZW4gKiAyKTsKICAgICAgICBmb3IgKG91dCA9IDAsIGkgPSAwOyBpIDwgbGVuOyApIHsKICAgICAgICAgIGMgPSBidWZbaSsrXTsKICAgICAgICAgIGlmIChjIDwgMTI4KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgY19sZW4gPSBfdXRmOGxlbltjXTsKICAgICAgICAgIGlmIChjX2xlbiA+IDQpIHsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNjU1MzM7CiAgICAgICAgICAgIGkgKz0gY19sZW4gLSAxOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGMgJj0gY19sZW4gPT09IDIgPyAzMSA6IGNfbGVuID09PSAzID8gMTUgOiA3OwogICAgICAgICAgd2hpbGUgKGNfbGVuID4gMSAmJiBpIDwgbGVuKSB7CiAgICAgICAgICAgIGMgPSBjIDw8IDYgfCBidWZbaSsrXSAmIDYzOwogICAgICAgICAgICBjX2xlbi0tOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGNfbGVuID4gMSkgewogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA2NTUzMzsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDY1NTM2KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjIC09IDY1NTM2OwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NTI5NiB8IGMgPj4gMTAgJiAxMDIzOwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NjMyMCB8IGMgJiAxMDIzOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gYnVmMmJpbnN0cmluZyh1dGYxNmJ1Ziwgb3V0KTsKICAgICAgfTsKICAgICAgZXhwb3J0cy51dGY4Ym9yZGVyID0gZnVuY3Rpb24oYnVmLCBtYXgpIHsKICAgICAgICB2YXIgcG9zOwogICAgICAgIG1heCA9IG1heCB8fCBidWYubGVuZ3RoOwogICAgICAgIGlmIChtYXggPiBidWYubGVuZ3RoKSB7CiAgICAgICAgICBtYXggPSBidWYubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBwb3MgPSBtYXggLSAxOwogICAgICAgIHdoaWxlIChwb3MgPj0gMCAmJiAoYnVmW3Bvc10gJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgIHBvcy0tOwogICAgICAgIH0KICAgICAgICBpZiAocG9zIDwgMCkgewogICAgICAgICAgcmV0dXJuIG1heDsKICAgICAgICB9CiAgICAgICAgaWYgKHBvcyA9PT0gMCkgewogICAgICAgICAgcmV0dXJuIG1heDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHBvcyArIF91dGY4bGVuW2J1Zltwb3NdXSA+IG1heCA/IHBvcyA6IG1heDsKICAgICAgfTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL3pzdHJlYW0uanMKICB2YXIgcmVxdWlyZV96c3RyZWFtID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL3pzdHJlYW0uanMiKGV4cG9ydHMsIG1vZHVsZSkgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgZnVuY3Rpb24gWlN0cmVhbSgpIHsKICAgICAgICB0aGlzLmlucHV0ID0gbnVsbDsKICAgICAgICB0aGlzLm5leHRfaW4gPSAwOwogICAgICAgIHRoaXMuYXZhaWxfaW4gPSAwOwogICAgICAgIHRoaXMudG90YWxfaW4gPSAwOwogICAgICAgIHRoaXMub3V0cHV0ID0gbnVsbDsKICAgICAgICB0aGlzLm5leHRfb3V0ID0gMDsKICAgICAgICB0aGlzLmF2YWlsX291dCA9IDA7CiAgICAgICAgdGhpcy50b3RhbF9vdXQgPSAwOwogICA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gdmFyIFpfREVGTEFURUQgPSA4OwogICAgICBmdW5jdGlvbiBEZWZsYXRlKG9wdGlvbnMpIHsKICAgICAgICBpZiAoISh0aGlzIGluc3RhbmNlb2YgRGVmbGF0ZSkpCiAgICAgICAgICByZXR1cm4gbmV3IERlZmxhdGUob3B0aW9ucyk7CiAgICAgICAgdGhpcy5vcHRpb25zID0gdXRpbHMuYXNzaWduKHsKICAgICAgICAgIGxldmVsOiBaX0RFRkFVTFRfQ09NUFJFU1NJT04sCiAgICAgICAgICBtZXRob2Q6IFpfREVGTEFURUQsCiAgICAgICAgICBjaHVua1NpemU6IDE2Mzg0LAogICAgICAgICAgd2luZG93Qml0czogMTUsCiAgICAgICAgICBtZW1MZXZlbDogOCwKICAgICAgICAgIHN0cmF0ZWd5OiBaX0RFRkFVTFRfU1RSQVRFR1ksCiAgICAgICAgICB0bzogIiIKICAgICAgICB9LCBvcHRpb25zIHx8IHt9KTsKICAgICAgICB2YXIgb3B0ID0gdGhpcy5vcHRpb25zOwogICAgICAgIGlmIChvcHQucmF3ICYmIG9wdC53aW5kb3dCaXRzID4gMCkgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgPSAtb3B0LndpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIGlmIChvcHQuZ3ppcCAmJiBvcHQud2luZG93Qml0cyA+IDAgJiYgb3B0LndpbmRvd0JpdHMgPCAxNikgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgKz0gMTY7CiAgICAgICAgfQogICAgICAgIHRoaXMuZXJyID0gMDsKICAgICAgICB0aGlzLm1zZyA9ICIiOwogICAgICAgIHRoaXMuZW5kZWQgPSBmYWxzZTsKICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAgICAgIHRoaXMuc3RybSA9IG5ldyBaU3RyZWFtKCk7CiAgICAgICAgdGhpcy5zdHJtLmF2YWlsX291dCA9IDA7CiAgICAgICAgdmFyIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlSW5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b3RvdHlwZS5wdXNoID0gZnVuY3Rpb24oZGF0YSwgbW9kZSkgewogICAgICAgIHZhciBzdHJtID0gdGhpcy5zdHJtOwogICAgICAgIHZhciBjaHVua1NpemUgPSB0aGlzLm9wdGlvbnMuY2h1bmtTaXplOwogICAgICAgIHZhciBzdGF0dXMsIF9tb2RlOwogICAgICAgIGlmICh0aGlzLmVuZGVkKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICAgIF9tb2RlID0gbW9kZSA9PT0gfn5tb2RlID8gbW9kZSA6IG1vZGUgPT09IHRydWUgPyBaX0ZJTklTSCA6IFpfTk9fRkxVU0g7CiAgICAgICAgaWYgKHR5cGVvZiBkYXRhID09PSAic3RyaW5nIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IHN0cmluZ3Muc3RyaW5nMmJ1ZihkYXRhKTsKICAgICAgICB9IGVsc2UgaWYgKHRvU3RyaW5nLmNhbGwoZGF0YSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgIHN0cm0uaW5wdXQgPSBuZXcgVWludDhBcnJheShkYXRhKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RybS5pbnB1dCA9IGRhdGE7CiAgICAgICAgfQogICAgICAgIHN0cm0ubmV4dF9pbiA9IDA7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IHN0cm0uaW5wdXQubGVuZ3RoOwogICAgICAgIGRvIHsKICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBzdHJtLm91dHB1dCA9IG5ldyB1dGlscy5CdWY4KGNodW5rU2l6ZSk7CiAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSAwOwogICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGNodW5rU2l6ZTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlKHN0cm0sIF9tb2RlKTsKICAgICAgICAgIGlmIChzdGF0dXMgIT09IFpfU1RSRUFNX0VORCAmJiBzdGF0dXMgIT09IFpfT0spIHsKICAgICAgICAgICAgdGhpcy5vbkVuZChzdGF0dXMpOwogICAgICAgICAgICB0aGlzLmVuZGVkID0gdHJ1ZTsKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwIHx8IHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgKF9tb2RlID09PSBaX0ZJTklTSCB8fCBfbW9kZSA9PT0gWl9TWU5DX0ZMVVNIMikpIHsKICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICB0aGlzLm9uRGF0YShzdHJpbmdzLmJ1ZjJiaW5zdHJpbmcodXRpbHMuc2hyaW5rQnVmKHN0cm0ub3V0cHV0LCBzdHJtLm5leHRfb3V0KSkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0aWxzLnNocmlua0J1ZihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCkpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSB3aGlsZSAoKHN0cm0uYXZhaWxfaW4gPiAwIHx8IHN0cm0uYXZhaWxfb3V0ID09PSAwKSAmJiBzdGF0dXMgIT09IFpfU1RSRUFNX0VORCk7CiAgICAgICAgaWYgKF9tb2RlID09PSBaX0ZJTklTSCkgewogICAgICAgICAgc3RhdHVzID0gemxpYl9kZWZsYXRlLmRlZmxhdGVFbmQodGhpcy5zdHJtKTsKICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgIHRoaXMuZW5kZWQgPSB0cnVlOwogICAgICAgICAgcmV0dXJuIHN0YXR1cyA9PT0gWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBaX1NZTkNfRkxVU0gyKSB7CiAgICAgICAgICB0aGlzLm9uRW5kKFpfT0spOwogICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSAwOwogICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0cnVlOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkRhdGEgPSBmdW5jdGlvbihjaHVuaykgewogICAgICAgIHRoaXMuY2h1bmtzLnB1c2goY2h1bmspOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkVuZCA9IGZ1bmN0aW9uKHN0YXR1cykgewogICAgICAgIGlmIChzdGF0dXMgPT09IFpfT0spIHsKICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMudG8gPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdGhpcy5jaHVua3Muam9pbigiIik7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aGlzLnJlc3VsdCA9IHV0aWxzLmZsYXR0ZW5DaHVua3ModGhpcy5jaHVua3MpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAgICAgIHRoaXMuZXJyID0gc3RhdHVzOwogICAgICAgIHRoaXMubXNnID0gdGhpcy5zdHJtLm1zZzsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gZGVmbGF0ZShpbnB1dCwgb3B0aW9ucykgewogICAgICAgIHZhciBkZWZsYXRvciA9IG5ldyBEZWZsYXRlKG9wdGlvbnMpOwogICAgICAgIGRlZmxhdG9yLnB1c2goaW5wdXQsIHRydWUpOwogICAgICAgIGlmIChkZWZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IGRlZmxhdG9yLm1zZyB8fCBtc2dbZGVmbGF0b3IuZXJyXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGRlZmxhdG9yLnJlc3VsdDsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYX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ZhciBfb3V0OwogICAgICAgIHZhciBiZWc7CiAgICAgICAgdmFyIGVuZDsKICAgICAgICB2YXIgZG1heDsKICAgICAgICB2YXIgd3NpemU7CiAgICAgICAgdmFyIHdoYXZlOwogICAgICAgIHZhciB3bmV4dDsKICAgICAgICB2YXIgc193aW5kb3c7CiAgICAgICAgdmFyIGhvbGQ7CiAgICAgICAgdmFyIGJpdHM7CiAgICAgICAgdmFyIGxjb2RlOwogICAgICAgIHZhciBkY29kZTsKICAgICAgICB2YXIgbG1hc2s7CiAgICAgICAgdmFyIGRtYXNrOwogICAgICAgIHZhciBoZXJlOwogICAgICAgIHZhciBvcDsKICAgICAgICB2YXIgbGVuOwogICAgICAgIHZhciBkaXN0OwogICAgICAgIHZhciBmcm9tOwogICAgICAgIHZhciBmcm9tX3NvdXJjZTsKICAgICAgICB2YXIgaW5wdXQsIG91dHB1dDsKICAgICAgICBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgX2luID0gc3RybS5uZXh0X2luOwogICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICBsYXN0ID0gX2luICsgKHN0cm0uYXZhaWxfaW4gLSA1KTsKICAgICAgICBfb3V0ID0gc3RybS5uZXh0X291dDsKICAgICAgICBvdXRwdXQgPSBzdHJtLm91dHB1dDsKICAgICAgICBiZWcgPSBfb3V0IC0gKHN0YXJ0IC0gc3RybS5hdmFpbF9vdXQpOwogICAgICAgIGVuZCA9IF9vdXQgKyAoc3RybS5hdmFpbF9vdXQgLSAyNTcpOwogICAgICAgIGRtYXggPSBzdGF0ZS5kbWF4OwogICAgICAgIHdzaXplID0gc3RhdGUud3NpemU7CiAgICAgICAgd2hhdmUgPSBzdGF0ZS53aGF2ZTsKICAgICAgICB3bmV4dCA9IHN0YXRlLnduZXh0OwogICAgICAgIHNfd2luZG93ID0gc3RhdGUud2luZG93OwogICAgICAgIGhvbGQgPSBzdGF0ZS5ob2xkOwogICAgICAgIGJpdHMgPSBzdGF0ZS5iaXRzOwogICAgICAgIGxjb2RlID0gc3RhdGUubGVuY29kZTsKICAgICAgICBkY29kZSA9IHN0YXRlLmRpc3Rjb2RlOwogICAgICAgIGxtYXNrID0gKDEgPDwgc3RhdGUubGVuYml0cykgLSAxOwogICAgICAgIGRtYXNrID0gKDEgPDwgc3RhdGUuZGlzdGJpdHMpIC0gMTsKICAgICAgICB0b3A6CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIGlmIChiaXRzIDwgMTUpIHsKICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZXJlID0gbGNvZGVbaG9sZCAmIGxtYXNrXTsKICAgICAgICAgICAgZG9sZW46CiAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICBvcCA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgaG9sZCA+Pj49IG9wOwogICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgIG9wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICBpZiAob3AgPT09IDApIHsKICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG9wICYgMTYpIHsKICAgICAgICAgICAgICAgICAgbGVuID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICBvcCAmPSAxNTsKICAgICAgICAgICAgICAgICAgaWYgKG9wKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkgewogICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbGVuICs9IGhvbGQgJiAoMSA8PCBvcCkgLSAxOwogICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgICAgICBiaXRzIC09IG9wOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChiaXRzIDwgMTUpIHsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoZXJlID0gZGNvZGVbaG9sZCAmIGRtYXNrXTsKICAgICAgICAgICAgICAgICAgZG9kaXN0OgogICAgICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAyNDsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICBvcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgICAgaWYgKG9wICYgMTYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgZGlzdCA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgICAgICAgb3AgJj0gMTU7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiaXRzIDwgb3ApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBkaXN0ICs9IGhvbGQgJiAoMSA8PCBvcCkgLSAxOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGlzdCA+IGRtYXgpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0b3A7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IG9wOwogICAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgICBvcCA9IF9vdXQgLSBiZWc7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXN0ID4gb3ApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBvcCA9IGRpc3QgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob3AgPiB3aGF2ZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLnNhbmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2siOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0b3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gc193aW5kb3c7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHduZXh0ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tICs9IHdzaXplIC0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob3AgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHduZXh0IDwgb3ApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gKz0gd3NpemUgKyB3bmV4dCAtIG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3AgLT0gd25leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob3AgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3bmV4dCA8IGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wID0gd25leHQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSArPSB3bmV4dCAtIG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wIDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChsZW4gPiAyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gMzsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbiA+IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IDM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobGVuID4gMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4gPiAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKChvcCAmIDY0KSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICBoZXJlID0gZGNvZGVbKGhlcmUgJiA2NTUzNSkgKyAoaG9sZCAmICgxIDw8IG9wKSAtIDEpXTsKICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWUgZG9kaXN0OwogICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSBjb2RlIjsKICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIGlmICgob3AgJiA2NCkgPT09IDApIHsKICAgICAgICAgICAgICAgICAgaGVyZSA9IGxjb2RlWyhoZXJlICYgNjU1MzUpICsgKGhvbGQgJiAoMSA8PCBvcCkgLSAxKV07CiAgICAgICAgICAgICAgICAgIGNvbnRpbnVlIGRvbGVuOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChvcCAmIDMyKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFOwogICAgICAgICAgICAgICAgICBicmVhayB0b3A7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGxpdGVyYWwvbGVuZ3RoIGNvZGUiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhayB0b3A7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICB9IHdoaWxlIChfaW4gPCBsYXN0ICYmIF9vdXQgPCBlbmQpOwogICAgICAgIGxlbiA9IGJpdHMgPj4gMzsKICAgICAgICBfaW4gLT0gbGVuOwogICAgICAgIGJpdHMgLT0gbGVuIDw8IDM7CiAgICAgICAgaG9sZCAmPSAoMSA8PCBiaXRzKSAtIDE7CiAgICAgICAgc3RybS5uZXh0X2luID0gX2luOwogICAgICAgIHN0cm0ubmV4dF9vdXQgPSBfb3V0OwogICAgICAgIHN0cm0uYXZhaWxfaW4gPSBfaW4gPCBsYXN0ID8gNSArIChsYXN0IC0gX2luKSA6IDUgLSAoX2luIC0gbGFzdCk7CiAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBfb3V0IDwgZW5kID8gMjU3ICsgKGVuZCAtIF9vdXQpIDogMjU3IC0gKF9vdXQgLSBlbmQpOwogICAgICAgIHN0YXRlLmhvbGQgPSBob2xkOwogICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgIHJldHVybjsKICAgICAgfTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2luZnRyZWVzLmpzCiAgdmFyIHJlcXVpcmVfaW5mdHJlZXMgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvaW5mdHJlZXMuanMiKGV4cG9ydHMsIG1vZHVsZSkgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIHV0aWxzID0gcmVxdWlyZV9jb21tb24yKCk7CiAgICAgIHZhciBNQVhCSVRTID0gMTU7CiAgICAgIHZhciBFTk9VR0hfTEVOUyA9IDg1MjsKICAgICAgdmFyIEVOT1VHSF9ESVNUUyA9IDU5MjsKICAgICAgdmFyIENPREVTID0gMDsKICAgICAgdmFyIExFTlMgPSAxOwogICAgICB2YXIgRElTVFMgPSAyOwogICAgICB2YXIgbGJhc2UgPSBbCiAgICAgICAgMywKICAgICAgICA0LAogICAgICAgIDUsCiAgICAgICAgNiwKICAgICAgICA3LAogICAgICAgIDgsCiAgICAgICAgOSwKICAgICAgICAxMCwKICAgICAgICAxMSwKICAgICAgICAxMywKICAgICAgICAxNSwKICAgICAgICAxNywKICAgICAgICAxOSwKICAgICAgICAyMywKICAgICAgICAyNywKICAgICAgICAzMSwKICAgICAgICAzNSwKICAgICAgICA0MywKICAgICAgICA1MSwKICAgICAgICA1OSwKICAgICAgICA2NywKICAgICAgICA4MywKICAgICAgICA5OSwKICAgICAgICAxMTUsCiAgICAgICAgMTMxLAogICAgICAgIDE2MywKICAgICAgICAxOTUsCiAgICAgICAgMjI3LAogICAgICAgIDI1OCwKICAgICAgICAwLAogICAgICAgIDAKICAgICAgXTsKICAgICAgdmFyIGxleHQgPSBbCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMTYsCiAgICAgICAgNzIsCiAgICAgICAgNzgKICAgICAgXTsKICAgICAgdmFyIGRiYXNlID0gWwogICAgICAgIDEsCiAgICAgICAgMiwKICAgICAgICAzLAogICAgICAgIDQsCiAgICAgICAgNSwKICAgICAgICA3LAogICAgICAgIDksCiAgICAgICAgMTMsCiAgICAgICAgMTcsCiAgICAgICAgMjUsCiAgICAgICAgMzMsCiAgICAgICAgNDksCiAgICAgICAgNjUsCiAgICAgICAgOTcsCiAgICAgICAgMTI5LAogICAgICAgIDE5MywKICAgICAgICAyNTcsCiAgICAgICAgMzg1LAogICAgICAgIDUxMywKICAgICAgICA3NjksCiAgICAgICAgMTAyNSwKICAgICAgICAxNTM3LAogICAgICAgIDIwNDksCiAgICAgICAgMzA3MywKICAgICAgICA0MDk3LAogICAgICAgIDYxNDUsCiAgICAgICAgODE5MywKICAgICAgICAxMjI4OSwKICAgICAgICAxNjM4NSwKICAgICAgICAyNDU3NywKICAgICAgICAwLAogICAgICAgIDAKICAgICAgXTsKICAgICAgdmFyIGRleHQgPSBbCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjIsCiAgICAgICAgMjIsCiAgICAgICAgMjMsCiAgICAgICAgMjMsCiAgICAgICAgMjQsCiAgICAgICAgMjQsCiAgICAgICAgMjUsCiAgICAgICAgMjUsCiAgICAgICAgMjYsCiAgICAgICAgMjYsCiAgICAgICAgMjcsCiAgICAgICAgMjcsCiAgICAgICAgMjgsCiAgICAgICAgMjgsCiAgICAgICAgMjksCiAgICAgICAgMjksCiAgICAgICAgNjQsCiAgICAgICAgNjQKICAgICAgXTsKICAgICAgbW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBpbmZsYXRlX3RhYmxlKHR5cGUsIGxlbnMsIGxlbnNfaW5kZXgsIGNvZGVzLCB0YWJsZSwgdGFibGVfaW5kZXgsIHdvcmssIG9wdHMpIHsKICAgICAgICB2YXIgYml0cyA9IG9wdHMuYml0czsKICAgICAgICB2YXIgbGVuID0gMDsKICAgICAgICB2YXIgc3ltID0gMDsKICAgICAgICB2YXIgbWluID0gMCwgbWF4ID0gMDsKICAgICAgICB2YXIgcm9vdCA9IDA7CiAgICAgICAgdmFyIGN1cnIgPSAwOwogICAgICAgIHZhciBkcm9wID0gMDsKICAgICAgICB2YXIgbGVmdCA9IDA7CiAgICAgICAgdmFyIHVzZWQgPSAwOwogICAgICAgIHZhciBodWZmID0gMDsKICAgICAgICB2YXIgaW5jcjsKICAgICAgICB2YXIgZmlsbDsKICAgICAgICB2YXIgbG93OwogICAgICAgIHZhciBtYXNrOwogICAgICAgIHZhciBuZXh0OwogICAgICAgIHZhciBiYXNlID0gbnVsbDsKICAgICAgICB2YXIgYmFzZV9pbmRleCA9IDA7CiAgICAgICAgdmFyIGVuZDsKICAgICAgICB2YXIgY291bnQgPSBuZXcgdXRpbHMuQnVmMTYoTUFYQklUUyArIDEpOwogICAgICAgIHZhciBvZmZzID0gbmV3IHV0aWxzLkJ1ZjE2KE1BWEJJVFMgKyAxKTsKICAgICAgICB2YXIgZXh0cmEgPSBudWxsOwogICAgICAgIHZhciBleHRyYV9pbmRleCA9IDA7CiAgICAgICAgdmFyIGhlcmVfYml0cywgaGVyZV9vcCwgaGVyZV92YWw7CiAgICAgICAgZm9yIChsZW4gPSAwOyBsZW4gPD0gTUFYQklUUzsgbGVuKyspIHsKICAgICAgICAgIGNvdW50W2xlbl0gPSAwOwogICAgICAgIH0KICAgICAgICBmb3IgKHN5bSA9IDA7IHN5bSA8IGNvZGVzOyBzeW0rKykgewogICAgICAgICAgY291bnRbbGVuc1tsZW5zX2luZGV4ICsgc3ltXV0rKzsKICAgICAgICB9CiAgICAgICAgcm9vdCA9IGJpdHM7CiAgICAgICAgZm9yIChtYXggPSBNQVhCSVRTOyBtYXggPj0gMTsgbWF4LS0pIHsKICAgICAgICAgIGlmIChjb3VudFttYXhdICE9PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocm9vdCA+IG1heCkgewogICAgICAgICAgcm9vdCA9IG1heDsKICAgICAgICB9CiAgICAgICAgaWYgKG1heCA9PT0gMCkgewogICAgICAgICAgdGFibGVbdGFibGVfaW5kZXgrK10gPSAxIDw8IDI0IHwgNjQgPDwgMTYgfCAwOwogICAgICAgICAgdGFibGVbdGFibGVfaW5kZXgrK10gPSAxIDw8IDI0IHwgNjQgPDwgMTYgfCAwOwogICAgICAgICAgb3B0cy5iaXRzID0gMTsKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgICAgICBmb3IgKG1pbiA9IDE7IG1pbiA8IG1heDsgbWluKyspIHsKICAgICAgICAgIGlmIChjb3VudFttaW5dICE9PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocm9vdCA8IG1pbikgewogICAgICAgICAgcm9vdCA9IG1pbjsKICAgICAgICB9CiAgICAgICAgbGVmdCA9IDE7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPD0gTUFYQklUUzsgbGVuKyspIHsKICAgICAgICAgIGxlZnQgPDw9IDE7CiAgICAgICAgICBsZWZ0IC09IGNvdW50W2xlbl07CiAgICAgICAgICBpZiAobGVmdCA8IDApIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAobGVmdCA+IDAgJiYgKHR5cGUgPT09IENPREVTIHx8IG1heCAhPT0gMSkpIHsKICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgb2Zmc1sxXSA9IDA7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPCBNQVhCSVRTOyBsZW4rKykgewogICAgICAgICAgb2Zmc1tsZW4gKyAxXSA9IG9mZnNbbGVuXSArIGNvdW50W2xlbl07CiAgICAgICAgfQogICAgICAgIGZvciAoc3ltID0gMDsgc3ltIDwgY29kZXM7IHN5bSsrKSB7CiAgICAgICAgICBpZiAobGVuc1tsZW5zX2luZGV4ICsgc3ltXSAhPT0gMCkgewogICAgICAgICAgICB3b3JrW29mZnNbbGVuc1tsZW5zX2luZGV4ICsgc3ltXV0rK10gPSBzeW07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICh0eXBlID09PSBDT0RFUykgewogICAgICAgICAgYmFzZSA9IGV4dHJhID0gd29yazsKICAgICAgICAgIGVuZCA9IDE5OwogICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PT0gTEVOUykgewogICAgICAgICAgYmFzZSA9IGxiYXNlOwogICAgICAgICAgYmFzZV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBleHRyYSA9IGxleHQ7CiAgICAgICAgICBleHRyYV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBlbmQgPSAyNTY7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGJhc2UgPSBkYmFzZTsKICAgICAgICAgIGV4dHJhID0gZGV4dDsKICAgICAgICAgIGVuZCA9IC0xOwogICAgICAgIH0KICAgICAgICBodWZmID0gMDsKICAgICAgICBzeW0gPSAwOwogICAgICAgIGxlbiA9IG1pbjsKICAgICAgICBuZXh0ID0gdGFibGVfaW5kZXg7CiAgICAgICAgY3VyciA9IHJvb3Q7CiAgICAgICAgZHJvcCA9IDA7CiAgICAgICAgbG93ID0gLTE7CiAgICAgICAgdXNlZCA9IDEgPDwgcm9vdDsKICAgICAgICBtYXNrID0gdXNlZCAtIDE7CiAgICAgICAgaWYgKHR5cGUgPT09IExFTlMgJiYgdXNlZCA+IEVOT1VHSF9MRU5TIHx8IHR5cGUgPT09IERJU1RTICYmIHVzZWQgPiBFTk9VR0hfRElTVFMpIHsKICAgICAgICAgIHJldHVybiAxOwogICAgICAgIH0KICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGhlcmVfYml0cyA9IGxlbiAtIGRyb3A7CiAgICAgICAgICBpZiAod29ya1tzeW1dIDwgZW5kKSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSAwOwogICAgICAgICAgICBoZXJlX3ZhbCA9IHdvcmtbc3ltXTsKICAgICAgICAgIH0gZWxzZSBpZiAod29ya1tzeW1dID4gZW5kKSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSBleHRyYVtleHRyYV9pbmRleCArIHdvcmtbc3ltXV07CiAgICAgICAgICAgIGhlcmVfdmFsID0gYmFzZVtiYXNlX2luZGV4ICsgd29ya1tzeW1dXTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSAzMiArIDY0OwogICAgICAgICAgICBoZXJlX3ZhbCA9IDA7CiAgICAgICAgICB9CiAgICAgICAgICBpbmNyID0gMSA8PCBsZW4gLSBkcm9wOwogICAgICAgICAgZmlsbCA9IDEgPDwgY3VycjsKICAgICAgICAgIG1pbiA9IGZpbGw7CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIGZpbGwgLT0gaW5jcjsKICAgICAgICAgICAgdGFibGVbbmV4dCArIChodWZmID4+IGRyb3ApICsgZmlsbF0gPSBoZXJlX2JpdHMgPDwgMjQgfCBoZXJlX29wIDw8IDE2IHwgaGVyZV92YWwgfCAwOwogICAgICAgICAgfSB3aGlsZSAoZmlsbCAhPT0gMCk7CiAgICAgICAgICBpbmNyID0gMSA8PCBsZW4gLSAxOwogICAgICAgICAgd2hpbGUgKGh1ZmYgJiBpbmNyKSB7CiAgICAgICAgICAgIGluY3IgPj49IDE7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoaW5jciAhPT0gMCkgewogICAgICAgICAgICBodWZmICY9IGluY3IgLSAxOwogICAgICAgICAgICBodWZmICs9IGluY3I7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBodWZmID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIHN5bSsrOwogICAgICAgICAgaWYgKC0tY291bnRbbGVuXSA9PT0gMCkgewogICAgICAgICAgICBpZiAobGVuID09PSBtYXgpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZW4gPSBsZW5zW2xlbnNfaW5kZXggKyB3b3JrW3N5bV1dOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGxlbiA+IHJvb3QgJiYgKGh1ZmYgJiBtYXNrKSAhPT0gbG93KSB7CiAgICAgICAgICAgIGlmIChkcm9wID09PSAwKSB7CiAgICAgICAgICAgICAgZHJvcCA9IHJvb3Q7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbmV4dCArPSBtaW47CiAgICAgICAgICAgIGN1cnIgPSBsZW4gLSBkcm9wOwogICAgICAgICAgICBsZWZ0ID0gMSA8PCBjdXJyOwogICAgICAgICAgICB3aGlsZSAoY3VyciArIGRyb3AgPCBtYXgpIHsKICAgICAgICAgICAgICBsZWZ0IC09IGNvdW50W2N1cnIgKyBkcm9wXTsKICAgICAgICAgICAgICBpZiAobGVmdCA8PSAwKSB7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgY3VycisrOwogICAgICAgICAgICAgIGxlZnQgPDw9IDE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdXNlZCArPSAxIDw8IGN1cnI7CiAgICAgICAgICAgIGlmICh0eXBlID09PSBMRU5TICYmIHVzZWQgPiBFTk9VR0hfTEVOUyB8fCB0eXBlID09PSBESVNUUyAmJiB1c2VkID4gRU5PVUdIX0RJU1RTKSB7CiAgICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbG93ID0gaHVmZiAmIG1hc2s7CiAgICAgICAgICAgIHRhYmxlW2xvd10gPSByb290IDw8IDI0IHwgY3VyciA8PCAxNiB8IG5leHQgLSB0YWJsZV9pbmRleCB8IDA7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChodWZmICE9PSAwKSB7CiAgICAgICAgICB0YWJsZVtuZXh0ICsgaHVmZl0gPSBsZW4gLSBkcm9wIDw8IDI0IHwgNjQgPDwgMTYgfCAwOwogICAgICAgIH0KICAgICAgICBvcHRzLmJpdHMgPSByb290OwogICAgICAgIHJldHVybiAwOwogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvaW5mbGF0ZS5qcwogIHZhciByZXF1aXJlX2luZmxhdGUgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvaW5mbGF0ZS5qcyIoZXhwb3J0cykgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIHV0aWxzID0gcmVxdWlyZV9jb21tb24yKCk7CiAgICAgIHZhciBhZGxlcjMyID0gcmVxdWlyZV9hZGxlcjMyKCk7CiAgICAgIHZhciBjcmMzMjIgPSByZXF1aXJlX2NyYzMyKCk7CiAgICAgIHZhciBpbmZsYXRlX2Zhc3QgPSByZXF1aXJlX2luZmZhc3QoKTsKICAgICAgdmFyIGluZmxhdGVfdGFibGUgPSByZXF1aXJlX2luZnRyZWVzKCk7CiAgICAgIHZhciBDT0RFUyA9IDA7CiAgICAgIHZhciBMRU5TID0gMTsKICAgICAgdmFyIERJU1RTID0gMjsKICAgICAgdmFyIFpfRklOSVNIID0gNDsKICAgICAgdmFyIFpfQkxPQ0sgPSA1OwogICAgICB2YXIgWl9UUkVFUyA9IDY7CiAgICAgIHZhciBaX09LID0gMDsKICAgICAgdmFyIFpfU1RSRUFNX0VORCA9IDE7CiAgICAgIHZhciBaX05FRURfRElDVCA9IDI7CiAgICAgIHZhciBaX1NUUkVBTV9FUlJPUiA9IC0yOwogICAgICB2YXIgWl9EQVRBX0VSUk9SID0gLTM7CiAgICAgIHZhciBaX01FTV9FUlJPUiA9IC00OwogICAgICB2YXIgWl9CVUZfRVJST1IgPSAtNTsKICAgICAgdmFyIFpfREVGTEFURUQgPSA4OwogICAgICB2YXIgSEVBRCA9IDE7CiAgICAgIHZhciBGTEFHUyA9IDI7CiAgICAgIHZhciBUSU1FID0gMzsKICAgICAgdmFyIE9TID0gNDsKICAgICAgdmFyIEVYTEVOID0gNTsKICAgICAgdmFyIEVYVFJBID0gNjsKICAgICAgdmFyIE5BTUUgPSA3OwogICAgICB2YXIgQ09NTUVOVCA9IDg7CiAgICAgIHZhciBIQ1JDID0gOTsKICAgICAgdmFyIERJQ1RJRCA9IDEwOwogICAgICB2YXIgRElDVCA9IDExOwogICAgICB2YXIgVFlQRSA9IDEyOwogICAgICB2YXIgVFlQRURPID0gMTM7CiAgICAgIHZhciBTVE9SRUQgPSAxNDsKICAgICAgdmFyIENPUFlfID0gMTU7CiAgICAgIHZhciBDT1BZID0gMTY7CiAgICAgIHZhciBUQUJMRSA9IDE3OwogICAgICB2YXIgTEVOTEVOUyA9IDE4OwogICAgICB2YXIgQ09ERUxFTlMgPSAxOTsKICAgICAgdmFyIExFTl8gPSAyMDsKICAgICAgdmFyIExFTiA9IDIxOwogICAgICB2YXIgTEVORVhUID0gMjI7CiAgICAgIHZhciBESVNUID0gMjM7CiAgICAgIHZhciBESVNURVhUID0gMjQ7CiAgICAgIHZhciBNQVRDSCA9IDI1OwogICAgICB2YXIgTElUID0gMjY7CiAgICAgIHZhciBDSEVDSyA9IDI3OwogICAgICB2YXIgTEVOR1RIID0gMjg7CiAgICAgIHZhciBET05FID0gMjk7CiAgICAgIHZhciBCQUQgPSAzMDsKICAgICAgdmFyIE1FTSA9IDMxOwogICAgICB2YXIgU1lOQyA9IDMyOwogICAgICB2YXIgRU5PVUdIX0xFTlMgPSA4NTI7CiAgICAgIHZhciBFTk9VR0hfRElTVFMgPSA1OTI7CiAgICAgIHZhciBNQVhfV0JJVFMgPSAxNTsKICAgICAgdmFyIERFRl9XQklUUyA9IE1BWF9XQklUUzsKICAgICAgZnVuY3Rpb24genN3YXAzMihxKSB7CiAgICAgICAgcmV0dXJuIChxID4+PiAyNCAmIDI1NSkgKyAocSA+Pj4gOCAmIDY1MjgwKSArICgocSAmIDY1MjgwKSA8PCA4KSArICgocSAmIDI1NSkgPDwgMjQpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIEluZmxhdGVTdGF0ZSgpIHsKICAgICAgICB0aGlzLm1vZGUgPSAwOwogICAgICAgIHRoaXMubGFzdCA9IGZhbHNlOwogICAgICAgIHRoaXMud3JhcCA9IDA7CiAgICAgICAgdGhpcy5oYXZlZGljdCA9IGZhbHNlOwogICAgICAgIHRoaXMuZmxhZ3MgPSAwOwogICAgICAgIHRoaXMuZG1heCA9IDA7CiAgICAgICAgdGhpcy5jaGVjayA9IDA7CiAgICAgICAgdGhpcy50b3RhbCA9IDA7CiAgICAgICAgdGhpcy5oZWFkID0gbnVsbDsKICAgICAgICB0aGlzLndiaXRzID0gMDsKICAgICAgICB0aGlzLndzaXplID0gMDsKICAgICAgICB0aGlzLndoYXZlID0gMDsKICAgICAgICB0aGlzLnduZXh0ID0gMDsKICAgICAgICB0aGlzLndpbmRvdyA9IG51bGw7CiAgICAgICAgdGhpcy5ob2xkID0gMDsKICAgICAgICB0aGlzLmJpdHMgPSAwOwogICAgICAgIHRoaXMubGVuZ3RoID0gMDsKICAgICAgICB0aGlzLm9mZnNldCA9IDA7CiAgICAgICAgdGhpcy5leHRyYSA9IDA7CiAgICAgICAgdGhpcy5sZW5jb2RlID0gbnVsbDsKICAgICAgICB0aGlzLmRpc3Rjb2RlID0gbnVsbDsKICAgICAgICB0aGlzLmxlbmJpdHMgPSAwOwogICAgICAgIHRoaXMuZGlzdGJpdHMgPSAwOwogICAgICAgIHRoaXMubmNvZGUgPSAwOwogICAgICAgIHRoaXMubmxlbiA9IDA7CiAgICAgICAgdGhpcy5uZGlzdCA9IDA7CiAgICAgICAgdGhpcy5oYXZlID0gMDsKICAgICAgICB0aGlzLm5leHQgPSBudWxsOwogICAgICAgIHRoaXMubGVucyA9IG5ldyB1dGlscy5CdWYxNigzMjApOwogICAgICAgIHRoaXMud29yayA9IG5ldyB1dGlscy5CdWYxNigyODgpOwogICAgICAgIHRoaXMubGVuZHluID0gbnVsbDsKICAgICAgICB0aGlzLmRpc3RkeW4gPSBudWxsOwogICAgICAgIHRoaXMuc2FuZSA9IDA7CiAgICAgICAgdGhpcy5iYWNrID0gMDsKICAgICAgICB0aGlzLndhcyA9IDA7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZVJlc2V0S2VlcChzdHJtKSB7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgc3RybS50b3RhbF9pbiA9IHN0cm0udG90YWxfb3V0ID0gc3RhdGUudG90YWwgPSAwOwogICAgICAgIHN0cm0ubXNnID0gIiI7CiAgICAgICAgaWYgKHN0YXRlLndyYXApIHsKICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS53cmFwICYgMTsKICAgICAgICB9CiAg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U1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBpZiAod2luZG93Qml0cyA8IDApIHsKICAgICAgICAgIHdyYXAgPSAwOwogICAgICAgICAgd2luZG93Qml0cyA9IC13aW5kb3dCaXRzOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB3cmFwID0gKHdpbmRvd0JpdHMgPj4gNCkgKyAxOwogICAgICAgICAgaWYgKHdpbmRvd0JpdHMgPCA0OCkgewogICAgICAgICAgICB3aW5kb3dCaXRzICY9IDE1OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAod2luZG93Qml0cyAmJiAod2luZG93Qml0cyA8IDggfHwgd2luZG93Qml0cyA+IDE1KSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhdGUud2luZG93ICE9PSBudWxsICYmIHN0YXRlLndiaXRzICE9PSB3aW5kb3dCaXRzKSB7CiAgICAgICAgICBzdGF0ZS53aW5kb3cgPSBudWxsOwogICAgICAgIH0KICAgICAgICBzdGF0ZS53cmFwID0gd3JhcDsKICAgICAgICBzdGF0ZS53Yml0cyA9IHdpbmRvd0JpdHM7CiAgICAgICAgcmV0dXJuIGluZmxhdGVSZXNldChzdHJtKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlSW5pdDIoc3RybSwgd2luZG93Qml0cykgewogICAgICAgIHZhciByZXQ7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIGlmICghc3RybSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZSA9IG5ldyBJbmZsYXRlU3RhdGUoKTsKICAgICAgICBzdHJtLnN0YXRlID0gc3RhdGU7CiAgICAgICAgc3RhdGUud2luZG93ID0gbnVsbDsKICAgICAgICByZXQgPSBpbmZsYXRlUmVzZXQyKHN0cm0sIHdpbmRvd0JpdHMpOwogICAgICAgIGlmIChyZXQgIT09IFpfT0spIHsKICAgICAgICAgIHN0cm0uc3RhdGUgPSBudWxsOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmV0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVJbml0KHN0cm0pIHsKICAgICAgICByZXR1cm4gaW5mbGF0ZUluaXQyKHN0cm0sIERFRl9XQklUUyk7CiAgICAgIH0KICAgICAgdmFyIHZpcmdpbiA9IHRydWU7CiAgICAgIHZhciBsZW5maXg7CiAgICAgIHZhciBkaXN0Zml4OwogICAgICBmdW5jdGlvbiBmaXhlZHRhYmxlcyhzdGF0ZSkgewogICAgICAgIGlmICh2aXJnaW4pIHsKICAgICAgICAgIHZhciBzeW07CiAgICAgICAgICBsZW5maXggPSBuZXcgdXRpbHMuQnVmMzIoNTEyKTsKICAgICAgICAgIGRpc3RmaXggPSBuZXcgdXRpbHMuQnVmMzIoMzIpOwogICAgICAgICAgc3ltID0gMDsKICAgICAgICAgIHdoaWxlIChzeW0gPCAxNDQpIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA4OwogICAgICAgICAgfQogICAgICAgICAgd2hpbGUgKHN5bSA8IDI1NikgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDk7CiAgICAgICAgICB9CiAgICAgICAgICB3aGlsZSAoc3ltIDwgMjgwKSB7CiAgICAgICAgICAgIHN0YXRlLmxlbnNbc3ltKytdID0gNzsKICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzeW0gPCAyODgpIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA4OwogICAgICAgICAgfQogICAgICAgICAgaW5mbGF0ZV90YWJsZShMRU5TLCBzdGF0ZS5sZW5zLCAwLCAyODgsIGxlbmZpeCwgMCwgc3RhdGUud29yaywgeyBiaXRzOiA5IH0pOwogICAgICAgICAgc3ltID0gMDsKICAgICAgICAgIHdoaWxlIChzeW0gPCAzMikgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDU7CiAgICAgICAgICB9CiAgICAgICAgICBpbmZsYXRlX3RhYmxlKERJU1RTLCBzdGF0ZS5sZW5zLCAwLCAzMiwgZGlzdGZpeCwgMCwgc3RhdGUud29yaywgeyBiaXRzOiA1IH0pOwogICAgICAgICAgdmlyZ2luID0gZmFsc2U7CiAgICAgICAgfQogICAgICAgIHN0YXRlLmxlbmNvZGUgPSBsZW5maXg7CiAgICAgICAgc3RhdGUubGVuYml0cyA9IDk7CiAgICAgICAgc3RhdGUuZGlzdGNvZGUgPSBkaXN0Zml4OwogICAgICAgIHN0YXRlLmRpc3RiaXRzID0gNTsKICAgICAgfQogICAgICBmdW5jdGlvbiB1cGRhdGV3aW5kb3coc3RybSwgc3JjLCBlbmQsIGNvcHkpIHsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS53aW5kb3cgPT09IG51bGwpIHsKICAgICAgICAgIHN0YXRlLndzaXplID0gMSA8PCBzdGF0ZS53Yml0czsKICAgICAgICAgIHN0YXRlLnduZXh0ID0gMDsKICAgICAgICAgIHN0YXRlLndoYXZlID0gMDsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG5ldyB1dGlscy5CdWY4KHN0YXRlLndzaXplKTsKICAgICAgICB9CiAgICAgICAgaWYgKGNvcHkgPj0gc3RhdGUud3NpemUpIHsKICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0YXRlLndpbmRvdywgc3JjLCBlbmQgLSBzdGF0ZS53c2l6ZSwgc3RhdGUud3NpemUsIDApOwogICAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgICAgc3RhdGUud2hhdmUgPSBzdGF0ZS53c2l6ZTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZGlzdCA9IHN0YXRlLndzaXplIC0gc3RhdGUud25leHQ7CiAgICAgICAgICBpZiAoZGlzdCA+IGNvcHkpIHsKICAgICAgICAgICAgZGlzdCA9IGNvcHk7CiAgICAgICAgICB9CiAgICAgICAgICB1dGlscy5hcnJheVNldChzdGF0ZS53aW5kb3csIHNyYywgZW5kIC0gY29weSwgZGlzdCwgc3RhdGUud25leHQpOwogICAgICAgICAgY29weSAtPSBkaXN0OwogICAgICAgICAgaWYgKGNvcHkpIHsKICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUud2luZG93LCBzcmMsIGVuZCAtIGNvcHksIGNvcHksIDApOwogICAgICAgICAgICBzdGF0ZS53bmV4dCA9IGNvcHk7CiAgICAgICAgICAgIHN0YXRlLndoYXZlID0gc3RhdGUud3NpemU7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzdGF0ZS53bmV4dCArPSBkaXN0OwogICAgICAgICAgICBpZiAoc3RhdGUud25leHQgPT09IHN0YXRlLndzaXplKSB7CiAgICAgICAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzdGF0ZS53aGF2ZSA8IHN0YXRlLndzaXplKSB7CiAgICAgICAgICAgICAgc3RhdGUud2hhdmUgKz0gZGlzdDsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlKHN0cm0sIGZsdXNoKSB7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIHZhciBpbnB1dCwgb3V0cHV0OwogICAgICAgIHZhciBuZXh0OwogICAgICAgIHZhciBwdXQ7CiAgICAgICAgdmFyIGhhdmUsIGxlZnQ7CiAgICAgICAgdmFyIGhvbGQ7CiAgICAgICAgdmFyIGJpdHM7CiAgICAgICAgdmFyIF9pbiwgX291dDsKICAgICAgICB2YXIgY29weTsKICAgICAgICB2YXIgZnJvbTsKICAgICAgICB2YXIgZnJvbV9zb3VyY2U7CiAgICAgICAgdmFyIGhlcmUgPSAwOwogICAgICAgIHZhciBoZXJlX2JpdHMsIGhlcmVfb3AsIGhlcmVfdmFsOwogICAgICAgIHZhciBsYXN0X2JpdHMsIGxhc3Rfb3AsIGxhc3RfdmFsOwogICAgICAgIHZhciBsZW47CiAgICAgICAgdmFyIHJldDsKICAgICAgICB2YXIgaGJ1ZiA9IG5ldyB1dGlscy5CdWY4KDQpOwogICAgICAgIHZhciBvcHRzOwogICAgICAgIHZhciBuOwogICAgICAgIHZhciBvcmRlciA9IFsxNiwgMTcsIDE4LCAwLCA4LCA3LCA5LCA2LCAxMCwgNSwgMTEsIDQsIDEyLCAzLCAxMywgMiwgMTQsIDEsIDE1XTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUgfHwgIXN0cm0ub3V0cHV0IHx8ICFzdHJtLmlucHV0ICYmIHN0cm0uYXZhaWxfaW4gIT09IDApIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS5tb2RlID09PSBUWVBFKSB7CiAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRURPOwogICAgICAgIH0KICAgICAgICBwdXQgPSBzdHJtLm5leHRfb3V0OwogICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgIGxlZnQgPSBzdHJtLmF2YWlsX291dDsKICAgICAgICBuZXh0ID0gc3RybS5uZXh0X2luOwogICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICBoYXZlID0gc3RybS5hdmFpbF9pbjsKICAgICAgICBob2xkID0gc3RhdGUuaG9sZDsKICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICBfaW4gPSBoYXZlOwogICAgICAgIF9vdXQgPSBsZWZ0OwogICAgICAgIHJldCA9IFpfT0s7CiAgICAgICAgaW5mX2xlYXZlOgogICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgIHN3aXRjaCAoc3RhdGUubW9kZSkgewogICAgICAgICAgICAgIGNhc2UgSEVBRDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFRE87CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUud3JhcCAmIDIgJiYgaG9sZCA9PT0gMzU2MTUpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSAwOwogICAgICAgICAgICAgICAgICBoYnVmWzBdID0gaG9sZCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIyKHN0YXRlLmNoZWNrLCBoYnVmLCAyLCAwKTsKICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRkxBR1M7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZmxhZ3MgPSAwOwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5kb25lID0gZmFsc2U7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoIShzdGF0ZS53cmFwICYgMSkgfHwgKCgoaG9sZCAmIDI1NSkgPDwgOCkgKyAoaG9sZCA+PiA4KSkgJSAzMSkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbmNvcnJlY3QgaGVhZGVyIGNoZWNrIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhvbGQgJiAxNSkgIT09IFpfREVGTEFURUQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAidW5rbm93biBjb21wcmVzc2lvbiBtZXRob2QiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA0OwogICAgICAgICAgICAgICAgYml0cyAtPSA0OwogICAgICAgICAgICAgICAgbGVuID0gKGhvbGQgJiAxNSkgKyA4OwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLndiaXRzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLndiaXRzID0gbGVuOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsZW4gPiBzdGF0ZS53Yml0cykgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIHdpbmRvdyBzaXplIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5kbWF4ID0gMSA8PCBsZW47CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSAxOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IGhvbGQgJiA1MTIgPyBESUNUSUQgOiBUWVBFOwogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgRkxBR1M6CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmZsYWdzID0gaG9sZDsKICAgICAgICAgICAgICAgIGlmICgoc3RhdGUuZmxhZ3MgJiAyNTUpICE9PSBaX0RFRkxBVEVEKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInVua25vd24gY29tcHJlc3Npb24gbWV0aG9kIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1NzM0NCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJ1bmtub3duIGhlYWRlciBmbGFncyBzZXQiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQudGV4dCA9IGhvbGQgPj4gOCAmIDE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhidWZbMV0gPSBob2xkID4+PiA4ICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRJTUU7CiAgICAgICAgICAgICAgY2FzZSBUSU1FOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnRpbWUgPSBob2xkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsyXSA9IGhvbGQgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzNdID0gaG9sZCA+Pj4gMjQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIyKHN0YXRlLmNoZWNrLCBoYnVmLCA0LCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gT1M7CiAgICAgICAgICAgICAgY2FzZSBPUzoKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC54ZmxhZ3MgPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLm9zID0gaG9sZCA+PiA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMjIoc3RhdGUuY2hlY2ssIGhidWYsIDIsIDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBFWExFTjsKICAgICAgICAgICAgICBjYXNlIEVYTEVOOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMTAyNCkgewogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBob2xkOwogICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmFfbGVuID0gaG9sZDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgICBoYnVmWzBdID0gaG9sZCAmIDI1NTsKICAgICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEVYVFJBOwogICAgICAgICAgICAgIGNhc2UgRVhUUkE6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAxMDI0KSB7CiAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmhlYWQuZXh0cmFfbGVuIC0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgaWYgKCFzdGF0ZS5oZWFkLmV4dHJhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBuZXcgQXJyYXkoc3RhdGUuaGVhZC5leHRyYV9sZW4pOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUuaGVhZC5leHRyYSwgaW5wdXQsIG5leHQsIGNvcHksIGxlbik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMjIoc3RhdGUuY2hlY2ssIGlucHV0LCBjb3B5LCBuZXh0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZSAtPSBjb3B5OwogICAgICAgICAgICAgICAgICAgIG5leHQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IE5BTUU7CiAgICAgICAgICAgICAgY2FzZSBOQU1FOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMjA0OCkgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBjb3B5ID0gMDsKICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgIGxlbiA9IGlucHV0W25leHQgKyBjb3B5KytdOwogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkICYmIGxlbiAmJiBzdGF0ZS5sZW5ndGggPCA2NTUzNikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5uYW1lICs9IFN0cmluZy5mcm9tQ2hhckNvZGUobGVuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiAmJiBjb3B5IDwgaGF2ZSk7CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIyKHN0YXRlLmNoZWNrLCBpbnB1dCwgY29weSwgbmV4dCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZSAtPSBjb3B5OwogICAgICAgICAgICAgICAgICBuZXh0ICs9IGNvcHk7CiAgICAgICAgICAgICAgICAgIGlmIChsZW4pIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLm5hbWUgPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT01NRU5UOwogICAgICAgICAgICAgIGNhc2UgQ09NTUVOVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDQwOTYpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgY29weSA9IDA7CiAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICBsZW4gPSBpbnB1dFtuZXh0ICsgY29weSsrXTsKICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCAmJiBsZW4gJiYgc3RhdGUubGVuZ3RoIDwgNjU1MzYpIHsKICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuY29tbWVudCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGxlbik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9IHdoaWxlIChsZW4gJiYgY29weSA8IGhhdmUpOwogICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5jb21tZW50ID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBIQ1JDOwogICAgICAgICAgICAgIGNhc2UgSENSQzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaG9sZCAhPT0gKHN0YXRlLmNoZWNrICYgNjU1MzUpKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaGVhZGVyIGNyYyBtaXNtYXRjaCI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmhjcmMgPSBzdGF0ZS5mbGFncyA+PiA5ICYgMTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5kb25lID0gdHJ1ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgRElDVElEOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSB6c3dhcDMyKGhvbGQpOwogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESUNUOwogICAgICAgICAgICAgIGNhc2UgRElDVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlZGljdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfb3V0ID0gcHV0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGxlZnQ7CiAgICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9pbiA9IG5leHQ7CiAgICAgICAgICAgICAgICAgIHN0cm0uYXZhaWxfaW4gPSBoYXZlOwogICAgICAgICAgICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICAgICAgICAgICAgc3RhdGUuYml0cyA9IGJpdHM7CiAgICAgICAgICAgICAgICAgIHJldHVybiBaX05FRURfRElDVDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDE7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICBjYXNlIFRZUEU6CiAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfQkxPQ0sgfHwgZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGNhc2UgVFlQRURPOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxhc3QpIHsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ0hFQ0s7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxhc3QgPSBob2xkICYgMTsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAxOwogICAgICAgICAgICAgICAgYml0cyAtPSAxOwogICAgICAgICAgICAgICAgc3dpdGNoIChob2xkICYgMykgewogICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFNUT1JFRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgIGZpeGVkdGFibGVzKHN0YXRlKTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUQUJMRTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYmxvY2sgdHlwZSI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBTVE9SRUQ6CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gYml0cyAmIDc7CiAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhvbGQgJiA2NTUzNSkgIT09IChob2xkID4+PiAxNiBeIDY1NTM1KSkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIHN0b3JlZCBibG9jayBsZW5ndGhzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBob2xkICYgNjU1MzU7CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFlfOwogICAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX1RSRUVTKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBjYXNlIENPUFlfOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFk7CiAgICAgICAgICAgICAgY2FzZSBDT1BZOgogICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBsZWZ0OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KG91dHB1dCwgaW5wdXQsIG5leHQsIGNvcHksIHB1dCk7CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBsZWZ0IC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIHB1dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgVEFCTEU6CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE0KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm5sZW4gPSAoaG9sZCAmIDMxKSArIDI1NzsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA1OwogICAgICAgICAgICAgICAgYml0cyAtPSA1OwogICAgICAgICAgICAgICAgc3RhdGUubmRpc3QgPSAoaG9sZCAmIDMxKSArIDE7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNTsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNTsKICAgICAgICAgICAgICAgIHN0YXRlLm5jb2RlID0gKGhvbGQgJiAxNSkgKyA0OwogICAgICAgICAgICAgICAgaG9sZCA+Pj49IDQ7CiAgICAgICAgICAgICAgICBiaXRzIC09IDQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubmxlbiA+IDI4NiB8fCBzdGF0ZS5uZGlzdCA+IDMwKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInRvbyBtYW55IGxlbmd0aCBvciBkaXN0YW5jZSBzeW1ib2xzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5MRU5TOwogICAgICAgICAgICAgIGNhc2UgTEVOTEVOUzoKICAgICAgICAgICAgICAgIHdoaWxlIChzdGF0ZS5oYXZlIDwgc3RhdGUubmNvZGUpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW29yZGVyW3N0YXRlLmhhdmUrK11dID0gaG9sZCAmIDc7CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAzOwogICAgICAgICAgICAgICAgICBiaXRzIC09IDM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB3aGlsZSAoc3RhdGUuaGF2ZSA8IDE5KSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbb3JkZXJbc3RhdGUuaGF2ZSsrXV0gPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubGVuY29kZSA9IHN0YXRlLmxlbmR5bjsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA3OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShDT0RFUywgc3RhdGUubGVucywgMCwgMTksIHN0YXRlLmxlbmNvZGUsIDAsIHN0YXRlLndvcmssIG9wdHMpOwogICAgICAgICAgICAgICAgc3RhdGUubGVuYml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBjb2RlIGxlbmd0aHMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT0RFTEVOUzsKICAgICAgICAgICAgICBjYXNlIENPREVMRU5TOgogICAgICAgICAgICAgICAgd2hpbGUgKHN0YXRlLmhhdmUgPCBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgICAgaGVyZSA9IHN0YXRlLmxlbmNvZGVbaG9sZCAmICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhlcmVfdmFsIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSsrXSA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX3ZhbCA9PT0gMTYpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAyOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgY29weSA9IDMgKyAoaG9sZCAmIDMpOwogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IDI7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IDI7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChoZXJlX3ZhbCA9PT0gMTcpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAzOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICBjb3B5ID0gMyArIChob2xkICYgNyk7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gMzsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gMzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgbiA9IGhlcmVfYml0cyArIDc7CiAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgICAgbGVuID0gMDsKICAgICAgICAgICAgICAgICAgICAgIGNvcHkgPSAxMSArIChob2xkICYgMTI3KTsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA3OwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSA3OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSArIGNvcHkgPiBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB3aGlsZSAoY29weS0tKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBsZW47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubW9kZSA9PT0gQkFEKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxlbnNbMjU2XSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGNvZGUgLS0gbWlzc2luZyBlbmQtb2YtYmxvY2siOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA5OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShMRU5TLCBzdGF0ZS5sZW5zLCAwLCBzdGF0ZS5ubGVuLCBzdGF0ZS5sZW5jb2RlLCAwLCBzdGF0ZS53b3JrLCBvcHRzKTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgICAgICAgICBpZiAocmV0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgbGl0ZXJhbC9sZW5ndGhzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGJpdHMgPSA2OwogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGNvZGUgPSBzdGF0ZS5kaXN0ZHluOwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUuZGlzdGJpdHMgfTsKICAgICAgICAgICAgICAgIHJldCA9IGluZmxhdGVfdGFibGUoRElTVFMsIHN0YXRlLmxlbnMsIHN0YXRlLm5sZW4sIHN0YXRlLm5kaXN0LCBzdGF0ZS5kaXN0Y29kZSwgMCwgc3RhdGUud29yaywgb3B0cyk7CiAgICAgICAgICAgICAgICBzdGF0ZS5kaXN0Yml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZXMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9UUkVFUykgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgY2FzZSBMRU5fOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTjsKICAgICAgICAgICAgICBjYXNlIExFTjoKICAgICAgICAgICAgICAgIGlmIChoYXZlID49IDYgJiYgbGVmdCA+PSAyNTgpIHsKICAgICAgICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBsZWZ0OwogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaG9sZCA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgICAgICAgICAgICBpbmZsYXRlX2Zhc3Qoc3RybSwgX291dCk7CiAgICAgICAgICAgICAgICAgIHB1dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgICAgICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgICAgICAgICAgICBsZWZ0ID0gc3RybS5hdmFpbF9vdXQ7CiAgICAgICAgICAgICAgICAgIG5leHQgPSBzdHJtLm5leHRfaW47CiAgICAgICAgICAgICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICAgICAgICAgICAgaGF2ZSA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgICAgICAgICAgIGhvbGQgPSBzdGF0ZS5ob2xkOwogICAgICAgICAgICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IFRZUEUpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gMDsKICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtob2xkICYgKDEgPDwgc3RhdGUubGVuYml0cykgLSAxXTsKICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGVyZV92YWwgPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYmIChoZXJlX29wICYgMjQwKSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBsYXN0X2JpdHMgPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgIGxhc3Rfb3AgPSBoZXJlX29wOwogICAgICAgICAgICAgICAgICBsYXN0X3ZhbCA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBoZXJlX3ZhbDsKICAgICAgICAgICAgICAgIGlmIChoZXJlX29wID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMSVQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGhlcmVfb3AgJiAzMikgewogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYgNjQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5FWFQ7CiAgICAgICAgICAgICAgY2FzZSBMRU5FWFQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZXh0cmEpIHsKICAgICAgICAgICAgICAgICAgbiA9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCArPSBob2xkICYgKDEgPDwgc3RhdGUuZXh0cmEpIC0gMTsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBiaXRzIC09IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUud2FzID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IERJU1Q7CiAgICAgICAgICAgICAgY2FzZSBESVNUOgogICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtob2xkICYgKDEgPDwgc3RhdGUuZGlzdGJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICBoZXJlX29wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICBpZiAoaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhlcmVfb3AgJiAyNDApID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGxhc3RfYml0cyA9IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgbGFzdF9vcCA9IGhlcmVfb3A7CiAgICAgICAgICAgICAgICAgIGxhc3RfdmFsID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCAmIDY0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgY29kZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESVNURVhUOwogICAgICAgICAgICAgIGNhc2UgRElTVEVYVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5leHRyYSkgewogICAgICAgICAgICAgICAgICBuID0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ICs9IGhvbGQgJiAoMSA8PCBzdGF0ZS5leHRyYSkgLSAxOwogICAgICAgICAgICAgICAgICBob2xkID4+Pj0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIGJpdHMgLT0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gc3RhdGUuZG1heCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IE1BVENIOwogICAgICAgICAgICAgIGNhc2UgTUFUQ0g6CiAgICAgICAgICAgICAgICBpZiAobGVmdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjb3B5ID0gX291dCAtIGxlZnQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gY29weSkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gc3RhdGUub2Zmc2V0IC0gY29weTsKICAgICAgICAgICAgICAgICAgaWYgKGNvcHkgPiBzdGF0ZS53aGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gc3RhdGUud25leHQpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5IC09IHN0YXRlLnduZXh0OwogICAgICAgICAgICAgICAgICAgIGZyb20gPSBzdGF0ZS53c2l6ZSAtIGNvcHk7CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZnJvbSA9IHN0YXRlLnduZXh0IC0gY29weTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IHN0YXRlLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBzdGF0ZS53aW5kb3c7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgZnJvbSA9IHB1dCAtIHN0YXRlLm9mZnNldDsKICAgICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gbGVmdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGxlZnQgLT0gY29weTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCAtPSBjb3B5OwogICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICBvdXRwdXRbcHV0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tY29weSk7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIExJVDoKICAgICAgICAgICAgICAgIGlmIChsZWZ0ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG91dHB1dFtwdXQrK10gPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICBsZWZ0LS07CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBDSEVDSzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCB8PSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIF9vdXQgLT0gbGVmdDsKICAgICAgICAgICAgICAgICAgc3RybS50b3RhbF9vdXQgKz0gX291dDsKICAgICAgICAgICAgICAgICAgc3RhdGUudG90YWwgKz0gX291dDsKICAgICAgICAgICAgICAgICAgaWYgKF9vdXQpIHsKICAgICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSBzdGF0ZS5mbGFncyA/IGNyYzMyMihzdGF0ZS5jaGVjaywgb3V0cHV0LCBfb3V0LCBwdXQgLSBfb3V0KSA6IGFkbGVyMzIoc3RhdGUuY2hlY2ssIG91dHB1dCwgX291dCwgcHV0IC0gX291dCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgX291dCA9IGxlZnQ7CiAgICAgICAgICAgICAgICAgIGlmICgoc3RhdGUuZmxhZ3MgPyBob2xkIDogenN3YXAzMihob2xkKSkgIT09IHN0YXRlLmNoZWNrKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGRhdGEgY2hlY2siOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTkdUSDsKICAgICAgICAgICAgICBjYXNlIExFTkdUSDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwICYmIHN0YXRlLmZsYWdzKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChob2xkICE9PSAoc3RhdGUudG90YWwgJiA0Mjk0OTY3Mjk1KSkgewogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImluY29ycmVjdCBsZW5ndGggY2hlY2siOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IERPTkU7CiAgICAgICAgICAgICAgY2FzZSBET05FOgogICAgICAgICAgICAgICAgcmV0ID0gWl9TVFJFQU1fRU5EOwogICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgIGNhc2UgQkFEOgogICAgICAgICAgICAgICAgcmV0ID0gWl9EQVRBX0VSUk9SOwogICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgIGNhc2UgTUVNOgogICAgICAgICAgICAgICAgcmV0dXJuIFpfTUVNX0VSUk9SOwogICAgICAgICAgICAgIGNhc2UgU1lOQzoKICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICBzdHJtLmF2YWlsX291dCA9IGxlZnQ7CiAgICAgICA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UEUgPyAxMjggOiAwKSArIChzdGF0ZS5tb2RlID09PSBMRU5fIHx8IHN0YXRlLm1vZGUgPT09IENPUFlfID8gMjU2IDogMCk7CiAgICAgICAgaWYgKChfaW4gPT09IDAgJiYgX291dCA9PT0gMCB8fCBmbHVzaCA9PT0gWl9GSU5JU0gpICYmIHJldCA9PT0gWl9PSykgewogICAgICAgICAgcmV0ID0gWl9CVUZfRVJST1I7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZUVuZChzdHJtKSB7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHZhciBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgaWYgKHN0YXRlLndpbmRvdykgewogICAgICAgICAgc3RhdGUud2luZG93ID0gbnVsbDsKICAgICAgICB9CiAgICAgICAgc3RybS5zdGF0ZSA9IG51bGw7CiAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZUdldEhlYWRlcihzdHJtLCBoZWFkKSB7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgaWYgKChzdGF0ZS53cmFwICYgMikgPT09IDApIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUuaGVhZCA9IGhlYWQ7CiAgICAgICAgaGVhZC5kb25lID0gZmFsc2U7CiAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZVNldERpY3Rpb25hcnkoc3RybSwgZGljdGlvbmFyeSkgewogICAgICAgIHZhciBkaWN0TGVuZ3RoID0gZGljdGlvbmFyeS5sZW5ndGg7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIHZhciBkaWN0aWQ7CiAgICAgICAgdmFyIHJldDsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS53cmFwICE9PSAwICYmIHN0YXRlLm1vZGUgIT09IERJQ1QpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IERJQ1QpIHsKICAgICAgICAgIGRpY3RpZCA9IDE7CiAgICAgICAgICBkaWN0aWQgPSBhZGxlcjMyKGRpY3RpZCwgZGljdGlvbmFyeSwgZGljdExlbmd0aCwgMCk7CiAgICAgICAgICBpZiAoZGljdGlkICE9PSBzdGF0ZS5jaGVjaykgewogICAgICAgICAgICByZXR1cm4gWl9EQVRBX0VSUk9SOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXQgPSB1cGRhdGV3aW5kb3coc3RybSwgZGljdGlvbmFyeSwgZGljdExlbmd0aCwgZGljdExlbmd0aCk7CiAgICAgICAgaWYgKHJldCkgewogICAgICAgICAgc3RhdGUubW9kZSA9IE1FTTsKICAgICAgICAgIHJldHVybiBaX01FTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUuaGF2ZWRpY3QgPSAxOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGV4cG9ydHMuaW5mbGF0ZVJlc2V0ID0gaW5mbGF0ZVJlc2V0OwogICAgICBleHBvcnRzLmluZmxhdGVSZXNldDIgPSBpbmZsYXRlUmVzZXQyOwogICAgICBleHBv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AgIFpfT0s6IDAsCiAgICAgICAgWl9TVFJFQU1fRU5EOiAxLAogICAgICAgIFpfTkVFRF9ESUNUOiAyLAogICAgICAgIFpfRVJSTk86IC0xLAogICAgICAgIFpfU1RSRUFNX0VSUk9SOiAtMiwKICAgICAgICBaX0RBVEFfRVJST1I6IC0zLAogICAgICAgIFpfQlVGX0VSUk9SOiAtNSwKICAgICAgICBaX05PX0NPTVBSRVNTSU9OOiAwLAogICAgICAgIFpfQkVTVF9TUEVFRDogMSwKICAgICAgICBaX0JFU1RfQ09NUFJFU1NJT046IDksCiAgICAgICAgWl9ERUZBVUxUX0NPTVBSRVNTSU9OOiAtMSwKICAgICAgICBaX0ZJTFRFUkVEOiAxLAogICAgICAgIFpfSFVGRk1BTl9PTkxZOiAyLAogICAgICAgIFpfUkxFOiAzLAogICAgICAgIFpfRklYRUQ6IDQsCiAgICAgICAgWl9ERUZBVUxUX1NUUkFURUdZOiAwLAogICAgICAgIFpfQklOQVJZOiAwLAogICAgICAgIFpfVEVYVDogMSwKICAgICAgICBaX1VOS05PV046IDIsCiAgICAgICAgWl9ERUZMQVRFRDogOAogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvZ3poZWFkZXIuanMKICB2YXIgcmVxdWlyZV9nemhlYWRlciA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9nemhlYWRlci5qcyIoZXhwb3J0cywgbW9kdWxlKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBmdW5jdGlvbiBHWmhlYWRlcigpIHsKICAgICAgICB0aGlzLnRleHQgPSAwOwogICAgICAgIHRoaXMudGltZSA9IDA7CiAgICAgICAgdGhpcy54ZmxhZ3M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aGlzIGluc3RhbmNlb2YgSW5mbGF0ZTIpKQogICAgICAgICAgcmV0dXJuIG5ldyBJbmZsYXRlMihvcHRpb25zKTsKICAgICAgICB0aGlzLm9wdGlvbnMgPSB1dGlscy5hc3NpZ24oewogICAgICAgICAgY2h1bmtTaXplOiAxNjM4NCwKICAgICAgICAgIHdpbmRvd0JpdHM6IDAsCiAgICAgICAgICB0bzogIiIKICAgICAgICB9LCBvcHRpb25zIHx8IHt9KTsKICAgICAgICB2YXIgb3B0ID0gdGhpcy5vcHRpb25zOwogICAgICAgIGlmIChvcHQucmF3ICYmIG9wdC53aW5kb3dCaXRzID49IDAgJiYgb3B0LndpbmRvd0JpdHMgPCAxNikgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgPSAtb3B0LndpbmRvd0JpdHM7CiAgICAgICAgICBpZiAob3B0LndpbmRvd0JpdHMgPT09IDApIHsKICAgICAgICAgICAgb3B0LndpbmRvd0JpdHMgPSAtMTU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChvcHQud2luZG93Qml0cyA+PSAwICYmIG9wdC53aW5kb3dCaXRzIDwgMTYgJiYgIShvcHRpb25zICYmIG9wdGlvbnMud2luZG93Qml0cykpIHsKICAgICAgICAgIG9wdC53aW5kb3dCaXRzICs9IDMyOwogICAgICAgIH0KICAgICAgICBpZiAob3B0LndpbmRvd0JpdHMgPiAxNSAmJiBvcHQud2luZG93Qml0cyA8IDQ4KSB7CiAgICAgICAgICBpZiAoKG9wdC53aW5kb3dCaXRzICYgMTUpID09PSAwKSB7CiAgICAgICAgICAgIG9wdC53aW5kb3dCaXRzIHw9IDE1OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB0aGlzLmVyciA9IDA7CiAgICAgICAgdGhpcy5tc2cgPSAiIjsKICAgICAgICB0aGlzLmVuZGVkID0gZmFsc2U7CiAgICAgICAgdGhpcy5jaHVua3MgPSBbXTsKICAgICAgICB0aGlzLnN0cm0gPSBuZXcgWlN0cmVhbSgpOwogICAgICAgIHRoaXMuc3RybS5hdmFpbF9vdXQgPSAwOwogICAgICAgIHZhciBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZUluaXQyKHRoaXMuc3RybSwgb3B0LndpbmRvd0JpdHMpOwogICAgICAgIGlmIChzdGF0dXMgIT09IGMuWl9PSykgewogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKG1zZ1tzdGF0dXNdKTsKICAgICAgICB9CiAgICAgICAgdGhpcy5oZWFkZXIgPSBuZXcgR1poZWFkZXIoKTsKICAgICAgICB6bGliX2luZmxhdGUuaW5mbGF0ZUdldEhlYWRlcih0aGlzLnN0cm0sIHRoaXMuaGVhZGVyKTsKICAgICAgICBpZiAob3B0LmRpY3Rpb25hcnkpIHsKICAgICAgICAgIGlmICh0eXBlb2Ygb3B0LmRpY3Rpb25hcnkgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIG9wdC5kaWN0aW9uYXJ5ID0gc3RyaW5ncy5zdHJpbmcyYnVmKG9wdC5kaWN0aW9uYXJ5KTsKICAgICAgICAgIH0gZWxzZSBpZiAodG9TdHJpbmcuY2FsbChvcHQuZGljdGlvbmFyeSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgICAgb3B0LmRpY3Rpb25hcnkgPSBuZXcgVWludDhBcnJheShvcHQuZGljdGlvbmFyeSk7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAob3B0LnJhdykgewogICAgICAgICAgICBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZVNldERpY3Rpb25hcnkodGhpcy5zdHJtLCBvcHQuZGljdGlvbmFyeSk7CiAgICAgICAgICAgIGlmIChzdGF0dXMgIT09IGMuWl9PSykgewogICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihtc2dbc3RhdHVzXSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgSW5mbGF0ZTIucHJvdG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ua1NpemUpOwogICAgICAgICAgICBzdHJtLm5leHRfb3V0ID0gMDsKICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBjaHVua1NpemU7CiAgICAgICAgICB9CiAgICAgICAgICBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZShzdHJtLCBjLlpfTk9fRkxVU0gpOwogICAgICAgICAgaWYgKHN0YXR1cyA9PT0gYy5aX05FRURfRElDVCAmJiBkaWN0aW9uYXJ5KSB7CiAgICAgICAgICAgIHN0YXR1cyA9IHpsaWJfaW5mbGF0ZS5pbmZsYXRlU2V0RGljdGlvbmFyeSh0aGlzLnN0cm0sIGRpY3Rpb25hcnkpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHN0YXR1cyA9PT0gYy5aX0JVRl9FUlJPUiAmJiBhbGxvd0J1ZkVycm9yID09PSB0cnVlKSB7CiAgICAgICAgICAgIHN0YXR1cyA9IGMuWl9PSzsKICAgICAgICAgICAgYWxsb3dCdWZFcnJvciA9IGZhbHNlOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHN0YXR1cyAhPT0gYy5aX1NUUkVBTV9FTkQgJiYgc3RhdHVzICE9PSBjLlpfT0spIHsKICAgICAgICAgICAgdGhpcy5vbkVuZChzdGF0dXMpOwogICAgICAgICAgICB0aGlzLmVuZGVkID0gdHJ1ZTsKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHN0cm0ubmV4dF9vdXQpIHsKICAgICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwIHx8IHN0YXR1cyA9PT0gYy5aX1NUUkVBTV9FTkQgfHwgc3RybS5hdmFpbF9pbiA9PT0gMCAmJiAoX21vZGUgPT09IGMuWl9GSU5JU0ggfHwgX21vZGUgPT09IGMuWl9TWU5DX0ZMVVNIKSkgewogICAgICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMudG8gPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgICAgICBuZXh0X291dF91dGY4ID0gc3RyaW5ncy51dGY4Ym9yZGVyKHN0cm0ub3V0cHV0LCBzdHJtLm5leHRfb3V0KTsKICAgICAgICAgICAgICAgIHRhaWwgPSBzdHJtLm5leHRfb3V0IC0gbmV4dF9vdXRfdXRmODsKICAgICAgICAgICAgICAgIHV0ZjhzdHIgPSBzdHJpbmdzLmJ1ZjJzdHJpbmcoc3RybS5vdXRwdXQsIG5leHRfb3V0X3V0ZjgpOwogICAgICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IHRhaWw7CiAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGNodW5rU2l6ZSAtIHRhaWw7CiAgICAgICAgICAgICAgICBpZiAodGFpbCkgewogICAgICAgICAgICAgICAgICB1dGlscy5hcnJheVNldChzdHJtLm91dHB1dCwgc3RybS5vdXRwdXQsIG5leHRfb3V0X3V0ZjgsIHRhaWwsIDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgdGhpcy5vbkRhdGEodXRmOHN0cik7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0aWxzLnNocmlua0J1ZihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCkpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgYWxsb3dCdWZFcnJvciA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgfSB3aGlsZSAoKHN0cm0uYXZhaWxfaW4gPiAwIHx8IHN0cm0uYXZhaWxfb3V0ID09PSAwKSAmJiBzdGF0dXMgIT09IGMuWl9TVFJFQU1fRU5EKTsKICAgICAgICBpZiAoc3RhdHVzID09PSBjLlpfU1RSRUFNX0VORCkgewogICAgICAgICAgX21vZGUgPSBjLlpfRklOSVNIOwogICAgICAgIH0KICAgICAgICBpZiAoX21vZGUgPT09IGMuWl9GSU5JU0gpIHsKICAgICAgICAgIHN0YXR1cyA9IHpsaWJfaW5mbGF0ZS5pbmZsYXRlRW5kKHRoaXMuc3RybSk7CiAgICAgICAgICB0aGlzLm9uRW5kKHN0YXR1cyk7CiAgICAgICAgICB0aGlzLmVuZGVkID0gdHJ1ZTsKICAgICAgICAgIHJldHVybiBzdGF0dXMgPT09IGMuWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBjLlpfU1lOQ19GTFVTSCkgewogICAgICAgICAgdGhpcy5vbkVuZChjLlpfT0spOwogICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSAwOwogICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0cnVlOwogICAgICB9OwogICAgICBJbmZsYXRlMi5wcm90b3R5cGUub25EYXRhID0gZnVuY3Rpb24oY2h1bmspIHsKICAgICAgICB0aGlzLmNodW5rcy5wdXNoKGNodW5rKTsKICAgICAgfTsKICAgICAgSW5mbGF0ZTIucHJvdG90eXBlLm9uRW5kID0gZnVuY3Rpb24oc3RhdHVzKSB7CiAgICAgICAgaWYgKHN0YXR1cyA9PT0gYy5aX09LKSB7CiAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLnRvID09PSAic3RyaW5nIikgewogICAgICAgICAgICB0aGlzLnJlc3VsdCA9IHRoaXMuY2h1bmtzLmpvaW4oIiIpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdGhpcy5yZXN1bHQgPSB1dGlscy5mbGF0dGVuQ2h1bmtzKHRoaXMuY2h1bmtzKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgdGhpcy5jaHVua3MgPSBbXTsKICAgICAgICB0aGlzLmVyciA9IHN0YXR1czsKICAgICAgICB0aGlzLm1zZyA9IHRoaXMuc3RybS5tc2c7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGluZmxhdGU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0OTg1MzY1NDgsCiAgICAgICAgMTc4OTkyNzY2NiwKICAgICAgICA0MDg5MDE2NjQ4LAogICAgICAgIDIyMjcwNjEyMTQsCiAgICAgICAgNDUwNTQ4ODYxLAogICAgICAgIDE4NDMyNTg2MDMsCiAgICAgICAgNDEwNzU4MDc1MywKICAgICAgICAyMjExNjc3NjM5LAogICAgICAgIDMyNTg4Mzk5MCwKICAgICAgICAxNjg0Nzc3MTUyLAogICAgICAgIDQyNTExMjIwNDIsCiAgICAgICAgMjMyMTkyNjYzNiwKICAgICAgICAzMzU2MzM0ODcsCiAgICAgICAgMTY2MTM2NTQ2NSwKICAgICAgICA0MTk1MzAyNzU1LAogICAgICAgIDIzNjYxMTUzMTcsCiAgICAgICAgOTk3MDczMDk2LAogICAgICAgIDEyODE5NTM4ODYsCiAgICAgICAgMzU3OTg1NTMzMiwKICAgICAgICAyNzI0Njg4MjQyLAogICAgICAgIDEwMDY4ODgxNDUsCiAgICAgICAgMTI1ODYwNzY4NywKICAgICAgICAzNTI0MTAxNjI5LAogICAgICAgIDI3Njg5NDI0NDMsCiAgICAgICAgOTAxMDk3NzIyLAogICAgICAgIDExMTkwMDA2ODQsCiAgICAgICAgMzY4NjUxNzIwNiwKICAgICAgICAyODk4MDY1NzI4LAogICAgICAgIDg1MzA0NDQ1MSwKICAgICAgICAxMTcyMjY2MTAxLAogICAgICAgIDM3MDUwMTU3NTksCiAgICAgICAgMjg4MjYxNjY2NSwKICAgICAgICA2NTE3Njc5ODAsCiAgICAgICAgMTM3MzUwMzU0NiwKICAgICAgICAzMzY5NTU0MzA0LAogICAgICAgIDMyMTgxMDQ1OTgsCiAgICAgICAgNTY1NTA3MjUzLAogICAgICAgIDE0NTQ2MjE3MzEsCiAgICAgICAgMzQ4NTExMTcwNSwKICAgICAgICAzMDk5NDM2MzAzLAogICAgICAgIDY3MTI2Njk3NCwKICAgICAgICAxNTk0MTk4MDI0LAogICAgICAgIDMzMjI3MzA5MzAsCiAgICAgICAgMjk3MDM0NzgxMiwKICAgICAgICA3OTU4MzU1MjcsCiAgICAgICAgMTQ4MzIzMDIyNSwKICAgICAgICAzMjQ0MzY3Mjc1LAogICAgICAgIDMwNjAxNDk1NjUsCiAgICAgICAgMTk5NDE0NjE5MiwKICAgICAgICAzMTE1ODUzNCwKICAgICAgICAyNTYzOTA3NzcyLAogICAgICAgIDQwMjM3MTc5MzAsCiAgICAgICAgMTkwNzQ1OTQ2NSwKICAgICAgICAxMTI2MzcyMTUsCiAgICAgICAgMjY4MDE1MzI1MywKICAgICAgICAzOTA0NDI3MDU5LAogICAgICAgIDIwMTM3NzYyOTAsCiAgICAgICAgMjUxNzIyMDM2LAogICAgICAgIDI1MTcyMTUzNzQsCiAgICAgICAgMzc3NTgzMDA0MCwKICAgICAgICAyMTM3NjU2NzYzLAogICAgICAgIDE0MTM3NjgxMywKICAgICAgICAyNDM5Mjc3NzE5LAogICAgICAgIDM4NjUyNzEyOTcsCiAgICAgICAgMTgwMjE5NTQ0NCwKICAgICAgICA0NzY4NjQ4NjYsCiAgICAgICAgMjIzODAwMTM2OCwKICAgICAgICA0MDY2NTA4ODc4LAogICAgICAgIDE4MTIzNzA5MjUsCiAgICAgICAgNDUzMDkyNzMxLAogICAgICAgIDIxODE2MjUwMjUsCiAgICAgICAgNDExMTQ1MTIyMywKICAgICAgICAxNzA2MDg4OTAyLAogICAgICAgIDMxNDA0MjcwNCwKICAgICAgICAyMzQ0NTMyMjAyLAogICAgICAgIDQyNDAwMTc1MzIsCiAgICAgICAgMTY1ODY1ODI3MSwKICAgICAgICAzNjY2MTk5NzcsCiAgICAgICAgMjM2MjY3MDMyMywKICAgICAgICA0MjI0OTk0NDA1LAogICAgICAgIDEzMDM1MzU5NjAsCiAgICAgICAgOTg0OTYxNDg2LAogICAgICAgIDI3NDcwMDcwOTIsCiAgICAgICAgMzU2OTAzNzUzOCwKICAgICAgICAxMjU2MTcwODE3LAogICAgICAgIDEwMzc2MDQzMTEsCiAgICAgICAgMjc2NTIxMDczMywKICAgICAgICAzNTU0MDc5OTk1LAogICAgICAgIDExMzEwMTQ1MDYsCiAgICAgICAgODc5Njc5OTk2LAogICAgICAgIDI5MDkyNDM0NjIsCiAgICAgICAgMzY2Mzc3MTg1NiwKICAgICAgICAxMTQxMTI0NDY3LAogICAgICAgIDg1NTg0MjI3NywKICAgICAgICAyODUyODAxNjMxLAogICAgICAgIDM3MDg2NDg2NDksCiAgICAgICAgMTM0MjUzMzk0OCwKICAgICAgICA2NTQ0NTkzMDYsCiAgICAgICAgMzE4ODM5NjA0OCwKICAgICAgICAzMzczMDE1MTc0LAogICAgICAgIDE0NjY0Nzk5MDksCiAgICAgICAgNTQ0MTc5NjM1LAogICAgICAgIDMxMTA1MjM5MTMsCiAgICAgICAgMzQ2MjUyMjAxNSwKICAgICAgICAxNTkxNjcxMDU0LAogICAgICAgIDcwMjEzODc3NiwKICAgICAgICAyOTY2NDYwNDUwLAogICAgICAgIDMzNTI3OTk0MTIsCiAgICAgICAgMTUwNDkxODgwNywKICAgICAgICA3ODM1NTE4NzMsCiAgICAgICAgMzA4MjY0MDQ0MywKICAgICAgICAzMjMzNDQyOTg5LAogICAgICAgIDM5ODgyOTIzODQsCiAgICAgICAgMjU5NjI1NDY0NiwKICAgICAgICA2MjMxNzA2OCwKICAgICAgICAxOTU3ODEwODQyLAogICAgICAgIDM5Mzk4NDU5NDUsCiAgICAgICAgMjY0NzgxNjExMSwKICAgICAgICA4MTQ3MDk5NywKICAgICAgICAxOTQzODAzNTIzLAogICAgICAgIDM4MTQ5MTg5MzAsCiAgICAgICAgMjQ4OTU5NjgwNCwKICAgICAgICAyMjUyNzQ0MzAsCiAgICAgICAgMjA1Mzc5MDM3NiwKICAgICAgICAzODI2MTc1NzU1LAogICAgICAgIDI0NjY5MDYwMTMsCiAgICAgICAgMTY3ODE2NzQzLAogICAgICAgIDIwOTc2NTEzNzcsCiAgICAgICAgNDAyNzU1MjU4MCwKICAgICAgICAyMjY1NDkwMzg2LAogICAgICAgIDUwMzQ0NDA3MiwKICAgICAgICAxNzYyMDUwODE0LAogICAgICAgIDQxNTA0MTcyNDUsCiAgICAgICAgMjE1NDEyOTM1NSwKICAgICAgICA0MjY1MjIyMjUsCiAgICAgICAgMTg1MjUwNzg3OSwKICAgICAgICA0Mjc1MzEzNTI2LAogICAgICAgIDIzMTIzMTc5MjAsCiAgICAgICAgMjgyNzUzNjI2LAogICAgICAgIDE3NDI1NTU4NTIsCiAgICAgICAgNDE4OTcwODE0MywKICAgICAgICAyMzk0ODc3OTQ1LAogICAgICAgIDM5NzkxNzc2MywKICAgICAgICAxNjIyMTgzNjM3LAogICAgICAgIDM2MDQzOTA4ODgsCiAgICAgICAgMjcxNDg2NjU1OCwKICAgICAgICA5NTM3Mjk3MzIsCiAgICAgICAgMTM0MDA3NjYyNiwKICAgICAgICAzNTE4NzE5OTg1LAogICAgICAgIDI3OTczNjA5OTksCiAgICAgICAgMTA2ODgyODM4MSwKICAgICAgICAxMjE5NjM4ODU5LAogICAgICAgIDM2MjQ3NDE4NTAsCiAgICAgICAgMjkzNjY3NTE0OCwKICAgICAgICA5MDYxODU0NjIsCiAgICAgICAgMTA5MDgxMjUxMiwKICAgICAgICAzNzQ3NjcyMDAzLAogICAgICAgIDI4MjUzNzk2NjksCiAgICAgICAgODI5MzI5MTM1LAogICAgICAgIDExODEzMzUxNjEsCiAgICAgICAgMzQxMjE3NzgwNCwKICAgICAgICAzMTYwODM0ODQyLAogICAgICAgIDYyODA4NTQwOCwKICAgICAgICAxMzgyNjA1MzY2LAogICAgICAgIDM0MjMzNjkxMDksCiAgICAgICAgMzEzODA3ODQ2NywKICAgICAgICA1NzA1NjIyMzMsCiAgICAgICAgMTQyNjQwMDgxNSwKICAgICAgICAzMzE3MzE2NTQyLAogICAgICAgIDI5OTg3MzM2MDgsCiAgICAgICAgNzMzMjM5OTU0LAogICAgICAgIDE1NTUyNjE5NTYsCiAgICAgICAgMzI2ODkzNTU5MSwKICAgICAgICAzMDUwMzYwNjI1LAogICAgICAgIDc1MjQ1OTQwMywKICAgICAgICAxNTQxMzIwMjIxLAogICAgICAgIDI2MDcwNzE5MjAsCiAgICAgICAgMzk2NTk3MzAzMCwKICAgICAgICAxOTY5OTIyOTcyLAogICAgICAgIDQwNzM1NDk4LAogICAgICAgIDI2MTc4MzcyMjUsCiAgICAgICAgMzk0MzU3NzE1MSwKICAgICAgICAxOTEzMDg3ODc3LAogICAgICAgIDgzOTA4MzcxLAogICAgICAgIDI1MTIzNDE2MzQsCiAgICAgICAgMzgwMzc0MDY5MiwKICAgICAgICAyMDc1MjA4NjIyLAogICAgICAgIDIxMzI2MTExMiwKICAgICAgICAyNDYzMjcyNjAzLAogICAgICAgIDM4NTU5OTAyODUsCiAgICAgICAgMjA5NDg1NDA3MSwKICAgICAgICAxOTg5NTg4ODEsCiAgICAgICAgMjI2MjAyOTAxMiwKICAgICAgICA0MDU3MjYwNjEwLAogICAgICAgIDE3NTkzNTk5OTIsCiAgICAgICAgNTM0NDE0MTkwLAogICAgICAgIDIxNzY3MTg1NDEsCiAgICAgICAgNDEzOTMyOTExNSwKICAgICAgICAxODczODM2MDAxLAogICAgICAgIDQxNDY2NDU2NywKICAgICAgICAyMjgyMjQ4OTM0LAogICAgICAgIDQyNzkyMDAzNjgsCiAgICAgICAgMTcxMTY4NDU1NCwKICAgICAgICAyODUyODExMTYsCiAgICAgICAgMjQwNTgwMTcyNywKICAgICAgICA0MTY3MjE2NzQ1LAogICAgICAgIDE2MzQ0Njc3OTUsCiAgICAgICAgMzc2MjI5NzAxLAogICAgICAgIDI2ODUwNjc4OTYsCiAgICAgICAgMzYwODAwNzQwNiwKICAgICAgICAxMzA4OTE4NjEyLAogICAgICAgIDk1NjU0MzkzOCwKICAgICAgICAyODA4NTU1MTA1LAogICAgICAgIDM0OTU5NTgyNjMsCiAgICAgICAgMTIzMTYzNjMwMSwKICAgICAgICAxMDQ3NDI3MDM1LAogICAgICAgIDI5MzI5NTk4MTgsCiAgICAgICAgMzY1NDcwMzgzNiwKICAgICAgICAxMDg4MzU5MjcwLAogICAgICAgIDkzNjkxOGUzLAogICAgICAgIDI4NDc3MTQ4OTksCiAgICAgICAgMzczNjgzNzgyOSwKICAgICAgICAxMjAyOTAwODYzLAogICAgICAgIDgxNzIzMzg5NywKICAgICAgICAzMTgzMzQyMTA4LAogICAgICAgIDM0MDEyMzcxMzAsCiAgICAgICAgMTQwNDI3NzU1MiwKICAgICAgICA2MTU4MTgxNTAsCiAgICAgICAgMzEzNDIwNzQ5MywKICAgICAgICAzNDUzNDIxMjAzLAogICAgICAgIDE0MjM4NTc0NDksCiAgICAgICAgNjAxNDUwNDMxLAogICAgICAgIDMwMDk4Mzc2MTQsCiAgICAgICAgMzI5NDcxMDQ1NiwKICAgICAgICAxNTY3MTAzNzQ2LAogICAgICAgIDcxMTkyODcyNCwKICAgICAgICAzMDIwNjY4NDcxLAogICAgICAgIDMyNzIzODAwNjUsCiAgICAgICAgMTUxMDMzNDIzNSwKICAgICAgICA3NTUxNjcxMTcKICAgICAgXTsKICAgICAgaWYgKHR5cGVvZiBJbnQzMkFycmF5ICE9PSAidW5kZWZpbmVkIikgewogICAgICAgIENSQ19UQUJMRSA9IG5ldyBJbnQzMkFycmF5KENSQ19UQUJMRSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZW5zdXJlQnVmZmVyKGlucHV0KSB7CiAgICAgICAgaWYgKEJ1ZmZlcjguaXNCdWZmZXIoaW5wdXQpKSB7CiAgICAgICAgICByZXR1cm4gaW5wdXQ7CiAgICAgICAgfQogICAgICAgIHZhciBoYXNOZXdCdWZmZXJBUEkgPSB0eXBlb2YgQnVmZmVyOC5hbGxvYyA9PT0gImZ1bmN0aW9uIiAmJiB0eXBlb2YgQnVmZmVyOC5mcm9tID09PSAiZnVuY3Rpb24iOwogICAgICAgIGlmICh0eXBlb2YgaW5wdXQgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICByZXR1cm4gaGFzTmV3QnVmZmVyQVBJID8gQnVmZmVyOC5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AgICAgICAgICBjb25maWd1cmFibGU6IHRydWUKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoc3ViQ2xhc3MsICJwcm90b3R5cGUiLCB7CiAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KTsKICAgICAgICBpZiAoc3VwZXJDbGFzcykKICAgICAgICAgIF9zZXRQcm90b3R5cGVPZihzdWJDbGFzcywgc3VwZXJDbGFzcyk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mKG8pIHsKICAgICAgICBfZ2V0UHJvdG90eXBlT2YgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgPyBPYmplY3QuZ2V0UHJvdG90eXBlT2YuYmluZCgpIDogZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mMihvMikgewogICAgICAgICAgcmV0dXJuIG8yLl9fcHJvdG9fXyB8fCBPYmplY3QuZ2V0UHJvdG90eXBlT2YobzIpOwogICAgICAgIH07CiAgICAgICAgcmV0dXJuIF9nZXRQcm90b3R5cGVPZihvKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YobywgcCkgewogICAgICAgIF9zZXRQcm90b3R5cGVPZiA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiA/IE9iamVjdC5zZXRQcm90b3R5cGVPZi5iaW5kKCkgOiBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YyKG8yLCBwMikgewogICAgICAgICAgbzIuX19wcm90b19fID0gcDI7CiAgICAgICAgICByZXR1cm4gbzI7CiAgICAgICAgfTsKICAgICAgICByZXR1cm4gX3NldFByb3RvdHlwZU9mKG8sIHApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9pc05hdGl2ZVJlZmxlY3RDb25zdHJ1Y3QoKSB7CiAgICAgICAgaWYgKHR5cGVvZiBSZWZsZWN0ID09PSAidW5kZWZpbmVkIiB8fCAhUmVmbGVjdC5jb25zdHJ1Y3QpCiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKFJlZmxlY3QuY29uc3RydWN0LnNoYW0pCiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKHR5cGVvZiBQcm94eSA9PT0gImZ1bmN0aW9uIikKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIHRyeSB7CiAgICAgICAgICBCb29sZWFuLnByb3RvdHlwZS52YWx1ZU9mLmNhbGwoUmVmbGVjdC5jb25zdHJ1Y3QoQm9vbGVhbiwgW10sIGZ1bmN0aW9uKCkgewogICAgICAgICAgfSkpOwogICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBfYXNzZXJ0VGhpc0luaXRpYWxpemVkKHNlbGYyKSB7CiAgICAgICAgaWYgKHNlbGYyID09PSB2b2lkIDApIHsKICAgICAgICAgIHRocm93IG5ldyBSZWZlcmVuY2VFcnJvcigidGhpcyBoYXNuJ3QgYmVlbiBpbml0aWFsaXNlZCAtIHN1cGVyKCkgaGFzbid0IGJlZW4gY2FsbGVkIik7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzZWxmMjsKICAgICAgfQogICAgICBmdW5jdGlvbiBfcG9zc2libGVDb25zdHJ1Y3RvclJldHVybihzZWxmMiwgY2FsbCkgewogICAgICAgIGlmIChjYWxsICYmICh0eXBlb2YgY2FsbCA9PT0gIm9iamVjdCIgfHwgdHlwZW9mIGNhbGwgPT09ICJmdW5jdGlvbiIpKSB7CiAgICAgICAgICByZXR1cm4gY2FsbDsKICAgICAgICB9IGVsc2UgaWYgKGNhbGwgIT09IHZvaWQgMCkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiRGVyaXZlZCBjb25zdHJ1Y3RvcnMgbWF5IG9ubHkgcmV0dXJuIG9iamVjdCBvci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OwogICAgICAgIH0KICAgICAgICByZXR1cm4gb2JqZWN0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9nZXQoKSB7CiAgICAgICAgaWYgKHR5cGVvZiBSZWZsZWN0ICE9PSAidW5kZWZpbmVkIiAmJiBSZWZsZWN0LmdldCkgewogICAgICAgICAgX2dldCA9IFJlZmxlY3QuZ2V0LmJpbmQoKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgX2dldCA9IGZ1bmN0aW9uIF9nZXQyKHRhcmdldCwgcHJvcGVydHksIHJlY2VpdmVyKSB7CiAgICAgICAgICAgIHZhciBiYXNlID0gX3N1cGVyUHJvcEJhc2UodGFyZ2V0LCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmICghYmFzZSkKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIHZhciBkZXNjID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihiYXNlLCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmIChkZXNjLmdldCkgewogICAgICAgICAgICAgIHJldHVybiBkZXNjLmdldC5jYWxsKGFyZ3VtZW50cy5sZW5ndGggPCAzID8gdGFyZ2V0IDogcmVjZWl2ZXIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBkZXNjLnZhbHVlOwogICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIF9nZXQuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgfQogICAgICB2YXIgRW1pdHRlciA9IC8qIEBfX1BVUkVfXyAqLyBmdW5jdGlvbigpIHsKICAgICAgICBmdW5jdGlvbiBFbWl0dGVyMigpIHsKICAgICAgICAgIF9jbGFzc0NhbGxDaGVjayh0aGlzLCBFbWl0dGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgImxpc3RlbmVycyIsIHsKICAgICAgICAgICAgdmFsdWU6IHt9LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEVtaXR0ZXIyLCBbewogICAgICAgICAga2V5OiAiYWRkRXZlbnRMaXN0ZW5lciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWRkRXZlbnRMaXN0ZW5lcih0eXBlLCBjYWxsYmFjaywgb3B0aW9ucykgewogICAgICAgICAgICBpZiAoISh0eXBlIGluIHRoaXMubGlzdGVuZXJzKSkgewogICAgICAgICAgICAgIHRoaXMubGlzdGVuZXJzW3R5cGVdID0gW107CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5saXN0ZW5lcnNbdHlwZV0ucHVzaCh7CiAgICAgICAgICAgICAgY2FsbGJhY2ssCiAgICAgICAgICAgICAgb3B0aW9ucwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJyZW1vdmVFdmVudExpc3RlbmVyIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiByZW1vdmVFdmVudExpc3RlbmVyKHR5cGUsIGNhbGxiYWNrKSB7CiAgICAgICAgICAgIGlmICghKHR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW3R5cGVdOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIGlmIChzdGFja1tpXS5jYWxsYmFjayA9PT0gY2FsbGJhY2spIHsKICAgICAgICAgICAgICAgIHN0YWNrLnNwbGljZShpLCAxKTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJkaXNwYXRjaEV2ZW50IiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBkaXNwYXRjaEV2ZW50KGV2ZW50KSB7CiAgICAgICAgICAgIGlmICghKGV2ZW50LnR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW2V2ZW50LnR5cGVdOwogICAgICAgICAgICB2YXIgc3RhY2tUb0NhbGwgPSBzdGFjay5zbGljZSgpOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrVG9DYWxsLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIHZhciBsaXN0ZW5lciA9IHN0YWNrVG9DYWxsW2ldOwogICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBsaXN0ZW5lci5jYWxsYmFjay5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBQcm9taXNlLnJlc29sdmUoKS50aGVuKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChsaXN0ZW5lci5vcHRpb25zICYmIGxpc3RlbmVyLm9wdGlvbnMub25jZSkgewogICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVFdmVudExpc3RlbmVyKGV2ZW50LnR5cGUsIGxpc3RlbmVyLmNhbGxiYWNrKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuICFldmVudC5kZWZhdWx0UHJldmVudGVkOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gRW1pdHRlcjI7CiAgICAgIH0oKTsKICAgICAgdmFyIEFib3J0U2lnbmFsID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKF9FbWl0dGVyKSB7CiAgICAgICAgX2luaGVyaXRzKEFib3J0U2lnbmFsMiwgX0VtaXR0ZXIpOwogICAgICAgIHZhciBfc3VwZXIgPSBfY3JlYXRlU3VwZXIoQWJvcnRTaWduYWwyKTsKICAgICAgICBmdW5jdGlvbiBBYm9ydFNpZ25hbDIoKSB7CiAgICAgICAgICB2YXIgX3RoaXM7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRTaWduYWwyKTsKICAgICAgICAgIF90aGlzID0gX3N1cGVyLmNhbGwodGhpcyk7CiAgICAgICAgICBpZiAoIV90aGlzLmxpc3RlbmVycykgewogICAgICAgICAgICBFbWl0dGVyLmNhbGwoX2Fzc2VydFRoaXNJbml0aWFsaXplZChfdGhpcykpOwogICAgICAgICAgfQogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KF9hc3NlcnRUaGlzSW5pdGlhbGl6ZWQoX3RoaXMpLCAiYWJvcnRlZCIsIHsKICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgIm9uYWJvcnQiLCB7CiAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgInJlYXNvbiIsIHsKICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgICByZXR1cm4gX3RoaXM7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhBYm9ydFNpZ25hbDIsIFt7CiAgICAgICAgICBrZXk6ICJ0b1N0cmluZyIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gdG9TdHJpbmcoKSB7CiAgICAgICAgICAgIHJldHVybiAiW29iamVjdCBBYm9ydFNpZ25hbF0iOwogICAgICAgICAgfQogICAgICAgIH0sIHsKICAgICAgICAgIGtleTogImRpc3BhdGNoRXZlbnQiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGRpc3BhdGNoRXZlbnQoZXZlbnQpIHsKICAgICAgICAgICAgaWYgKGV2ZW50LnR5cGUgPT09ICJhYm9ydCIpIHsKICAgICAgICAgICAgICB0aGlzLmFib3J0ZWQgPSB0cnVlOwogICAgICAgICAgICAgIGlmICh0eXBlb2YgdGhpcy5vbmFib3J0ID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICB0aGlzLm9uYWJvcnQuY2FsbCh0aGlzLCBldmVudCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIF9nZXQoX2dldFByb3RvdHlwZU9mKEFib3J0U2lnbmFsMi5wcm90b3R5cGUpLCAiZGlzcGF0Y2hFdmVudCIsIHRoaXMpLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gQWJvcnRTaWduYWwyOwogICAgICB9KEVtaXR0ZXIpOwogICAgICB2YXIgQWJvcnRDb250cm9sbGVyID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKCkgewogICAgICAgIGZ1bmN0aW9uIEFib3J0Q29udHJvbGxlcjIoKSB7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRDb250cm9sbGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgInNpZ25hbCIsIHsKICAgICAgICAgICAgdmFsdWU6IG5ldyBBYm9ydFNpZ25hbCgpLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEFib3J0Q29udHJvbGxlcjIsIFt7CiAgICAgICAgICBrZXk6ICJhYm9ydCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWJvcnQocmVhc29uKSB7CiAgICAgICAgICAgIHZhciBldmVudDsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBldmVudCA9IG5ldyBFdmVudCgiYWJvcnQiKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgIGlmICh0eXBlb2YgZG9jdW1lbnQgIT09ICJ1bmRlZmluZWQiKSB7CiAgICAgICAgICAgICAgICBpZiAoIWRvY3VtZW50LmNyZWF0ZUV2ZW50KSB7CiAgICAgICAgICAgICAgICAgIGV2ZW50ID0gZG9jdW1lbnQuY3JlYXRlRXZlbnRPYmplY3QoKTsKICAgICAgICAgICAgICAgICAgZXZlbnQudHlwZSA9ICJhYm9ydCI7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBldmVudCA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCJFdmVudCIpOwogICAgICAgICAgICAgICAgICBldmVudC5pbml0RXZlbnQoImFib3J0IiwgZmFsc2UsIGZhbHNlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZXZlbnQgPSB7CiAgICAgICAgICAgICAgICAgIHR5cGU6ICJhYm9ydCIsCiAgICAgICAgICAgICAgICAgIGJ1YmJsZXM6IGZhbHNlLAogICAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHNpZ25hbFJlYXNvbiA9IHJlYXNvbjsKICAgICAgICAgICAgaWYgKHNpZ25hbFJlYXNvbiA9PT0gdm9pZCAwKSB7CiAgICAgICAgICAgICAgaWYgKHR5cGVvZiBkb2N1bWVudCA9PT0gInVuZGVmaW5lZCIpIHsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbi5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24gPSBuZXcgRE9NRXhjZXB0aW9uKCJzaWduYWwgaXMgYWJvcnRlZCB3aXRob3V0IHJlYXNvbiIpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgICAgc2lnbmFsUmVhc29uLm5hbWUgPSAiQWJvcnRFcnJvciI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMuc2lnbmFsLnJlYXNvbiA9IHNpZ25hbFJlYXNvbjsKICAgICAgICAgICAgdGhpcy5zaWduYWwuZGlzcGF0Y2hFdmVudChldmVudCk7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAidG9TdHJpbmciLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIHRvU3RyaW5nKCkgewog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CiAgICAgICAgdmFyIFJlcXVlc3QgPSBOYXRpdmVSZXF1ZXN0OwogICAgICAgIGlmIChSZXF1ZXN0ICYmICFSZXF1ZXN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eSgic2lnbmFsIikgfHwgX19GT1JDRV9JTlNUQUxMX0FCT1JUQ09OVFJPTExFUl9QT0xZRklMTCkgewogICAgICAgICAgUmVxdWVzdCA9IGZ1bmN0aW9uIFJlcXVlc3QyKGlucHV0LCBpbml0MikgewogICAgICAgICAgICB2YXIgc2lnbmFsOwogICAgICAgICAgICBpZiAoaW5pdDIgJiYgaW5pdDIuc2lnbmFsKSB7CiAgICAgICAgICAgICAgc2lnbmFsID0gaW5pdDIuc2lnbmFsOwogICAgICAgICAgICAgIGRlbGV0ZSBpbml0Mi5zaWduYWw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHJlcXVlc3QgPSBuZXcgTmF0aXZlUmVxdWVzdChpbnB1dCwgaW5pdDIpOwogICAgICAgICAgICBpZiAoc2lnbmFsKSB7CiAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHJlcXVlc3QsICJzaWduYWwiLCB7CiAgICAgICAgICAgICAgICB3cml0YWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICAgIHZhbHVlOiBzaWduYWwKICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmVxdWVzdDsKICAgICAgICAgIH07CiAgICAgICAgICBSZXF1ZXN0LnByb3RvdHlwZSA9IE5hdGl2ZVJlcXVlc3QucHJvdG90eXBlOwogICAgICAgIH0KICAgICAgICB2YXIgcmVhbEZldGNoID0gZmV0Y2gyOwogICAgICAgIHZhciBhYm9ydGFibGVGZXRjaCA9IGZ1bmN0aW9uIGFib3J0YWJsZUZldGNoMihpbnB1dCwgaW5pdDIpIHsKICAgICAgICAgIHZhciBzaWduYWwgPSBSZXF1ZXN0ICYmIFJlcXVlc3QucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoaW5wdXQpID8gaW5wdXQuc2lnbmFsIDogaW5pdDIgPyBpbml0Mi5zaWduYWwgOiB2b2lkIDA7CiAgICAgICAgICBpZiAoc2lnbmFsKSB7CiAgICAgICAgICAgIHZhciBhYm9ydEVycm9yOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgIGFib3J0RXJyb3IgPSBuZXcgRE9NRXhjZXB0aW9uKCJBYm9ydGVkIiwgIkFib3J0RXJyb3IiKTsKICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgICAgYWJvcnRFcnJvciA9IG5ldyBFcnJvcigiQWJvcnRlZCIpOwogICAgICAgICAgICAgIGFib3J0RXJyb3IubmFtZSA9ICJBYm9ydEVycm9yIjsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoYWJvcnRFcnJvcik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIGNhbmNlbGxhdGlvbiA9IG5ldyBQcm9taXNlKGZ1bmN0aW9uKF8sIHJlamVjdCkgewogICAgICAgICAgICAgIHNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsIGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHJlamVjdChhYm9ydEVycm9yKTsKICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICBvbmNlOiB0cnVlCiAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBpZiAoaW5pdDIgJiYgaW5pdDIuc2lnbmFsKSB7CiAgICAgICAgICAgICAgZGVsZXRlIGluaXQyLnNpZ25hbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBy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HNpZ25hbCwgYWxyZWFkeSBhYm9ydGVkISIpOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5zaWduYWxzLmFkZChzaWduYWwpOwogICAgICAgICAgaWYgKHNpZ25hbC5hYm9ydGVkKSB7CiAgICAgICAgICAgIHRoaXMuaGFuZGxlQWJvcnRlZChzaWduYWwpOwogICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2Ygc2lnbmFsLmFkZEV2ZW50TGlzdGVuZXIgPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgICAgc2lnbmFsLmFkZEV2ZW50TGlzdGVuZXIoImFib3J0IiwgKCkgPT4gewogICAgICAgICAgICAgIHRoaXMuaGFuZGxlQWJvcnRlZChzaWduYWwpOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaGFuZGxlQWJvcnRlZChzaWduYWwpIHsKICAgICAgICAgIHRoaXMuc2lnbmFscy5kZWxldGUoc2lnbmFsKTsKICAgICAgICAgIGlmICh0aGlzLnNpZ25hbHMuc2l6ZSA9PT0gMCkgewogICAgICAgICAgICB0aGlzLmFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBnZXQgc2lnbmFsKCkgewogICAgICAgICAgcmV0dXJuIHRoaXMuYWJvcnRDb250cm9sbGVyLnNpZ25hbDsKICAgICAgICB9CiAgICAgICAgYWJvcnQoKSB7CiAgICAgICAgICB0aGlzLmFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgIH0KICAgICAgfTsKICAgICAgZXhwb3J0cy5kZWZhdWx0ID0gQWdncmVnYXRlQWJvcnRDb250cm9sbGVyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vYWJvcnRhYmxlLXByb21pc2UtY2FjaGVAMS41LjAvbm9kZV9tb2R1bGVzL2Fib3J0YWJsZS1wcm9taXNlLWNhY2hlL2VzbS9BZ2dyZWdhdGVTdGF0dXNSZ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vcnRlZCI7CiAgICAgICAgfQogICAgICAgIGV2aWN0KGtleSwgZW50cnkpIHsKICAgICAgICAgIGlmICh0aGlzLmNhY2hlLmdldChrZXkpID09PSBlbnRyeSkgewogICAgICAgICAgICB0aGlzLmNhY2hlLmRlbGV0ZShrZXkpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmaWxsKGtleSwgZGF0YSwgc2lnbmFsLCBzdGF0dXNDYWxsYmFjaykgewogICAgICAgICAgY29uc3QgYWJvcnRlciA9IG5ldyBBZ2dyZWdhdGVBYm9ydENvbnRyb2xsZXJfMS5kZWZhdWx0KCk7CiAgICAgICAgICBjb25zdCBzdGF0dXNSZXBvcnRlciA9IG5ldyBBZ2dyZWdhdGVTdGF0dXNSZXBvcnRlcl8xLmRlZmF1bHQoKTsKICAgICAgICAgIHN0YXR1c1JlcG9ydGVyLmFkZENhbGxiYWNrKHN0YXR1c0NhbGxiYWNrKTsKICAgICAgICAgIGNvbnN0IG5ld0VudHJ5ID0gewogICAgICAgICAgICBhYm9ydGVyLAogICAgICAgICAgICBwcm9taXNlOiB0aGlzLmZpbGxDYWxsYmFjayhkYXRhLCBhYm9ydGVyLnNpZ25hbCwgKG1lc3NhZ2UpID0+IHsKICAgICAgICAgICAgICBzdGF0dXNSZXBvcnRlci5jYWxsYmFjayhtZXNzYWdlKTsKICAgICAgICAgICAgfSksCiAgICAgICAgICAgIHNldHRsZWQ6IGZhbHNlLAogICAgICAgICAgICBzdGF0dXNSZXBvcnRlciwKICAgICAgICAgICAgZ2V0IGFib3J0ZWQoKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYWJvcnRlci5zaWduYWwuYWJvcnRlZDsKICAgICAgICAgICAgfQogICAgICAgICAgfTsKICAgICAgICAgIG5ld0VudHJ5LmFib3J0ZXIuYWRkU2lnbmFsKHNpZ25hbCk7CiAgICAgICAgICBuZXdFbnRyeS5hYm9ydGVyLnNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsICgpID0+IHsKICAgICAgICAgICAgaWYgKCFuZXdFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgdGhpcy5ldmljdChrZXksIG5ld0VudHJ5KTsKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgICBuZXdFbnRyeS5wcm9taXNlLnRoZW4oKCkgPT4gewogICAgICAgICAgICBuZXdFbnRyeS5zZXR0bGVkID0gdHJ1ZTsKICAgICAgICAgIH0sICgpID0+IHsKICAgICAgICAgICAgbmV3RW50cnkuc2V0dGxlZCA9IHRydWU7CiAgICAgICAgICAgIHRoaXMuZXZpY3Qoa2V5LCBuZXdFbnRyeSk7CiAgICAgICAgICB9KS5jYXRjaCgoZSkgPT4gewogICAgICAgICAgICBjb25zb2xlLmVycm9yKGUpOwogICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgfSk7CiAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIG5ld0VudHJ5KTsKICAgICAgICB9CiAgICAgICAgc3RhdGljIGNoZWNrU2luZ2xlUHJvbWlzZShwcm9taXNlLCBzaWduYWwpIHsKICAgICAgICAgIGZ1bmN0aW9uIGNoZWNrRm9yU2luZ2xlQWJvcnQoKSB7CiAgICAgICAgICAgIGlmIChzaWduYWwgJiYgc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICB0aHJvdyBPYmplY3QuYXNzaWduKG5ldyBFcnJvcigiYWJvcnRlZCIpLCB7IGNvZGU6ICJFUlJfQUJPUlRFRCIgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBwcm9taXNlLnRoZW4oKHJlc3VsdCkgPT4gewogICAgICAgICAgICBjaGVja0ZvclNpbmdsZUFib3J0KCk7CiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICAgICB9LCAoZXJyb3IpID0+IHsKICAgICAgICAgICAgY2hlY2tGb3JTaW5nbGVBYm9ydCgpOwogICAgICAgICAgICB0aHJv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RhdHVzQ2FsbGJhY2spOwogICAgICAgICAgICByZXR1cm4gQWJvcnRhYmxlUHJvbWlzZUNhY2hlMi5jaGVja1NpbmdsZVByb21pc2UoY2FjaGVFbnRyeS5wcm9taXNlLCBzaWduYWwpOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5maWxsKGtleSwgZGF0YSwgc2lnbmFsLCBzdGF0dXNDYWxsYmFjayk7CiAgICAgICAgICByZXR1cm4gQWJvcnRhYmxlUHJvbWlzZUNhY2hlMi5jaGVja1NpbmdsZVByb21pc2UodGhpcy5jYWNoZS5nZXQoa2V5KS5wcm9taXNlLCBzaWduYWwpOwogICAgICAgIH0KICAgICAgICBkZWxldGUoa2V5KSB7CiAgICAgICAgICBjb25zdCBjYWNoZWRFbnRyeSA9IHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICBpZiAoY2FjaGVkRW50cnkpIHsKICAgICAgICAgICAgaWYgKCFjYWNoZWRFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgY2FjaGVkRW50cnkuYWJvcnRlci5hYm9ydCgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMuY2FjaGUuZGVsZXRlKGtleSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNsZWFyKCkgewogICAgICAgICAgY29uc3Qga2V5SXRlciA9IHRoaXMuY2FjaGUua2V5cygpOwogICAgICAgICAgbGV0IGRlbGV0ZUNvdW50ID0gMDsKICAgICAgICAgIGZvciAobGV0IHJlc3VsdCA9IGtleUl0ZXIubmV4dCgpOyAhcmVzdWx0LmRvbmU7IHJlc3VsdCA9IGtleUl0ZXIubmV4dCgpKSB7CiAgICAgICAgICAgIHRoaXMuZGVsZXRlKHJlc3VsdC52YWx1ZSk7CiAgICAgICAgICAgIGRlbGV0ZUNvdW50ICs9IDE7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gZGVsZXRlQ291bnQ7CiAgICAgICAgfQogICAgICB9OwogICAgICBleH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2xydSA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9xdWljay1scnVAMi4wLjAvbm9kZV9tb2R1bGVzL3F1aWNrLWxydS9pbmRleC5qcyIoZXhwb3J0cywgbW9kdWxlKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICB2YXIgUXVpY2tMUlUzID0gY2xhc3MgewogICAgICAgIGNvbnN0cnVjdG9yKG9wdGlvbnMgPSB7fSkgewogICAgICAgICAgaWYgKCEob3B0aW9ucy5tYXhTaXplICYmIG9wdGlvbnMubWF4U2l6ZSA+IDApKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoImBtYXhTaXplYCBtdXN0IGJlIGEgbnVtYmVyIGdyZWF0ZXIgdGhhbiAwIik7CiAgICAgICAgICB9CiAgICAgICAgICB0aGlzLm1heFNpemUgPSBvcHRpb25zLm1heFNpemU7CiAgICAgICAgICB0aGlzLmNhY2hlID0gbmV3IE1hcCgpOwogICAgICAgICAgdGhpcy5vbGRDYWNoZSA9IG5ldyBNYXAoKTsKICAgICAgICAgIHRoaXMuX3NpemUgPSAwOwogICAgICAgIH0KICAgICAgICBfc2V0KGtleSwgdmFsdWUpIHsKICAgICAgICAgIHRoaXMuY2FjaGUuc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgdGhpcy5fc2l6ZSsrOwogICAgICAgICAgaWYgKHRoaXMuX3NpemUgPj0gdGhpcy5tYXhTaXplKSB7CiAgICAgICAgICAgIHRoaXMuX3NpemUgPSAwOwogICAgICAgICAgICB0aGlzLm9sZENhY2hlID0gdGhpcy5jYWNoZTsKICAgICAgICAgICAgdGhpcy5jYWNoZSA9IG5ldyBNYXAoKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZ2V0KGtleSkgewogICAgICAgICAgaWYgKHRoaXMuY2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodGhpcy5vbGRDYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICBjb25zdCB2YWx1ZSA9IHRoaXMub2xkQ2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICAgIHRoaXMuX3NldChrZXksIHZhbHVlKTsKICAgICAgICAgICAgcmV0dXJuIHZhbHVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzZXQoa2V5LCB2YWx1ZSkgewogICAgICAgICAgaWYgKHRoaXMuY2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgdGhpcy5jYWNoZS5zZXQoa2V5LCB2YWx1ZSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aGlzLl9zZXQoa2V5LCB2YWx1ZSk7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICB9CiAgICAgICAgaGFzKGtleSkgewogICAgICAgICAgcmV0dXJuIHRoaXMuY2FjaGUuaGFzKGtleSkgfHwgdGhpcy5vbGRDYWNoZS5oYXMoa2V5KTsKICAgICAgICB9CiAgICAgICAgcGVlayhrZXkpIHsKICAgICAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLmNhY2hlLmdldChrZXkpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHRoaXMub2xkQ2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMub2xkQ2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGRlbGV0ZShrZXkpIHsKICAgICAgICAgIGNvbnN0IGRlbGV0ZWQgPSB0aGlzLmNhY2hlLmRlbGV0ZShrZXkpOwogICAgICAgICAgaWYgKGRlbGV0ZWQpIHsKICAgICAgICAgICAgdGhpcy5fc2l6ZS0tOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHRoaXMub2xkQ2FjaGUuZGVsZXRlKGtleSkgfHwgZGVsZXRlZDsKICAgICAgICB9CiAgICAgICAgY2xlYXIoKSB7CiAgICAgICAgICB0aGlzLmNhY2hlLmNsZWFyKCk7CiAgICAgICAgICB0aGlzLm9sZENhY2hlLmNsZWFyKCk7CiAgICAgICAgICB0aGlzLl9zaXplID0gMDsKICAgICAgICB9CiAgICAgICAgKmtleXMoKSB7CiAgICAgICAgICBmb3IgKGNvbnN0IFtrZXldIG9mIHRoaXMpIHsKICAgICAgICAgICAgeWllbGQga2V5OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICAqdmFsdWVzKCkgewogICAgICAgICAgZm9yIChjb25zdCBbLCB2YWx1ZV0gb2YgdGhpcykgewogICAgICAgICAgICB5aWVsZCB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgKltTeW1ib2wuaXRlcmF0b3JdKCkgewogICAgICAgICAgZm9yIChjb25zdCBpdGVtIG9mIHRoaXMuY2FjaGUpIHsKICAgICAgICAgICAgeWllbGQgaXRlbTsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAoY29uc3QgaXRlbSBvZiB0aGlzLm9sZENhY2hlKSB7CiAgICAgICAgICAgIGNvbnN0IFtrZXldID0gaXRlbTsKICAgICAgICAgICAgaWYgKCF0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgICAgeWllbGQgaXRlbTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBnZXQgc2l6ZSgpIHsKICAgICAgICAgIGxldCBvbGRDYWNoZVNpemUgPSAwOwogICAgICAgICAgZm9yIChjb25zdCBrZXkgb2YgdGhpcy5vbGRDYWNoZS5rZXlzKCkpIHsKICAgICAgICAgICAgaWYgKCF0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgICAgb2xkQ2FjaGVTaXplKys7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0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KICAgICAgICAgICAgZm9ybURhdGE6ICJGb3JtRGF0YSIgaW4gc2VsZjIsCiAgICAgICAgICAgIGFycmF5QnVmZmVyOiAiQXJyYXlCdWZmZXIiIGluIHNlbGYyCiAgICAgICAgICB9OwogICAgICAgICAgZnVuY3Rpb24gaXNEYXRhVmlldyhvYmopIHsKICAgICAgICAgICAgcmV0dXJuIG9iaiAmJiBEYXRhVmlldy5wcm90b3R5cGUuaXNQcm90b3R5cGVPZihvYmopOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHN1cHBvcnQuYXJyYXlCdWZmZXIpIHsKICAgICAgICAgICAgdmFyIHZpZXdDbGFzc2VzID0gWwogICAgICAgICAgICAgICJbb2JqZWN0IEludDhBcnJheV0iLAogICAgICAgICAgICAgICJbb2JqZWN0IFVpbnQ4QXJyYXldIiwKICAgICAgICAgICAgICAiW29iamVjdCBVaW50OENsYW1wZWRBcnJheV0iLAogICAgICAgICAgICAgICJbb2JqZWN0IEludDE2QXJyYXldIiwKICAgICAgICAgICAgICAiW29iamVjdCBVaW50MTZBcnJheV0iLAogICAgICAgICAgICAgICJbb2JqZWN0IEludDMyQXJyYXldIiwKICAgICAgICAgICAgICAiW29iamVjdCBVaW50MzJBcnJheV0iLAogICAgICAgICAgICAgICJbb2JqZWN0IEZsb2F0MzJBcnJheV0iLAogICAgICAgICAgICAgICJbb2JqZWN0IEZsb2F0NjRBcnJheV0iCiAgICAgICAgICAgIF07CiAgICAgICAgICAgIHZhciBpc0FycmF5QnVmZmVyVmlldyA9IEFycmF5QnVmZmVyLmlzVmlldyB8fCBmdW5jdGlvbihvYmopIHsKICAgICAgICAgICAgICByZXR1cm4gb2JqICYmIHZpZXdDbGFzc2VzLmluZGV4T2YoT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZy5jYWxsKG9iaikpID4gLTE7CiAgICAgICAgICAgIH07CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiBub3JtYWxpemVOYW1lKG5hbWUpIHsKICAgICAgICAgICAgaWYgKHR5cGVvZiBuYW1lICE9PSAic3RyaW5nIikgewogICAgICAgICAgICAgIG5hbWUgPSBTdHJpbmcobmFtZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKC9bXmEtejAtOVwtIyQlJicqKy5eX2B8fl0vaS50ZXN0KG5hbWUpKSB7CiAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiSW52YWxpZCBjaGFyYWN0ZXIgaW4gaGVhZGVyIGZpZWxkIG5hbWUiKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gbmFtZS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gbm9ybWFsaXplVmFsdWUodmFsdWUpIHsKICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSAhPT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICB2YWx1ZSA9IFN0cmluZyh2YWx1ZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHZhbHVlOwogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gaXRlcmF0b3JGb3IoaXRlbXMpIHsKICAgICAgICAgICAgdmFyIGl0ZXJhdG9yID0gewogICAgICAgICAgICAgIG5leHQ6IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gaXRlbXMuc2hpZnQoKTsKICAgICAgICAgICAgICAgIHJldHVybiB7IGRvbmU6IHZhbHVlID09PSB2b2lkIDAsIHZhbHVlIH07CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBpZiAoc3VwcG9ydC5pdGVyYWJsZSkgewogICAgICAgICAgICAgIGl0ZXJhdG9yW1N5bWJvbC5pdGVyYXRvcl0gPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHJldHVybiBpdGVyYXRvcjsKICAgICAgICAgICAgICB9OwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBpdGVyYXRvcjsKICAgICAgICAgIH0KICAgICAgICAgIGZ1bmN0aW9uIEhlYWRlcnMoaGVhZGVycykgewogICAgICAgICAgICB0aGlzLm1hcCA9IHt9OwogICAgICAgICAgICBpZiAoaGVhZGVycyBpbnN0YW5jZW9mIEhlYWRlcnMpIHsKICAgICAgICAgICAgICBoZWFkZXJzLmZvckVhY2goZnVuY3Rpb24odmFsdWUsIG5hbWUpIHsKICAgICAgICAgICAgICAgIHRoaXMuYXBwZW5kKG5hbWUsIHZhbHVlKTsKICAgICAgICAgICAgICB9LCB0aGlzKTsKICAgICAgICAgICAgfSBlbHNlIGlmIChBcnJheS5pc0FycmF5KGhlYWRlcnMpKSB7CiAgICAgICAgICAgICAgaGVhZGVycy5mb3JFYWNoKGZ1bmN0aW9uKGhlYWRlcikgewogICAgICAgICAgICAgICAgdGhpcy5hcHBlbmQoaGVhZGVyWzBdLCBoZWFkZXJbMV0pOwogICAgICAgICAgICAgIH0sIHRoaXMpOwogICAgICAgICAgICB9IGVsc2UgaWYgKGhlYWRlcnMpIHsKICAgICAgICAgICAgICBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyhoZWFkZXJzKS5mb3JFYWNoKGZ1bmN0aW9uKG5hbWUpIHsKICAgICAgICAgICAgICAgIHRoaXMuYXBwZW5kKG5hbWUsIGhlYWRlcnNbbmFtZV0pOwogICAgICAgICAgICAgIH0sIHRoaXMpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBIZWFkZXJzLnByb3RvdHlwZS5hcHBlbmQgPSBmdW5jdGlvbihuYW1lLCB2YWx1ZSkgewogICAgICAgICAgICBuYW1lID0gbm9ybWFsaXplTmFtZShuYW1lKTsKICAgICAgICAgICAgdmFsdWUgPSBub3JtYWxpemVWYWx1ZSh2YWx1ZSk7CiAgICAgICAgICAgIHZhciBvbGRWYWx1ZSA9IHRoaXMubWFwW25hbWVdOwogICAgICAgICAgICB0aGlzLm1hcFtuYW1lXSA9IG9sZFZhbHVlID8gb2xkVmFsdWUgKyAiLCAiICsgdmFsdWUgOiB2YWx1ZTsKICAgICAgICAgIH07CiAgICAgICAgICBIZWFkZXJzLnByb3RvdHlwZVsiZGVsZXRlIl0gPSBmdW5jdGlvbihuYW1lKSB7CiAgICAgICAgICAgIGRlbGV0ZSB0aGlzLm1hcFtub3JtYWxpemVOYW1lKG5hbWUpXTsKICAgICAgICAgIH07CiAgICAgICAgICBIZWFkZXJzLnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbihuYW1lKSB7CiAgICAgICAgICAgIG5hbWUgPSBub3JtYWxpemVOYW1lKG5hbWUpOwogICAgICAgICAgICByZXR1cm4gdGhpcy5oYXMobmFtZSkgPyB0aGlzLm1hcFtuYW1lXSA6IG51bGw7CiAgICAgICAgICB9OwogICAgICAgICAgSGVhZGVycy5wcm90b3R5cGUuaGFzID0gZnVuY3Rpb24obmFtZSkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5tYXAuaGFzT3duUHJvcGVydHkobm9ybWFsaXplTmFtZShuYW1lKSk7CiAgICAgICAgICB9OwogICAgICAgICAgSGVhZGVycy5wcm90b3R5cGUuc2V0ID0gZnVuY3Rpb24obmFtZSwgdmFsdWUpIHsKICAgICAgICAgICAgdGhpcy5tYXBbbm9ybWFsaXplTmFtZShuYW1lKV0gPSBub3JtYWxpemVWYWx1ZSh2YWx1ZSk7CiAgICAgICAgICB9OwogICAgICAgICAgSGVhZGVycy5wcm90b3R5cGUuZm9yRWFjaCA9IGZ1bmN0aW9uKGNhbGxiYWNrLCB0aGlzQXJnKSB7CiAgICAgICAgICAgIGZvciAodmFyIG5hbWUgaW4gdGhpcy5tYXApIHsKICAgICAgICAgICAgICBpZiAodGhpcy5tYXAuaGFzT3duUHJvcGVydHkobmFtZSkpIHsKICAgICAgICAgICAgICAgIGNhbGxiYWNrLmNhbGwodGhpc0FyZywgdGhpcy5tYXBbbmFtZV0sIG5hbWUsIHRoaXMpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfTsKICAgICAgICAgIEhlYWRlcnMucHJvdG90eXBlLmtleXMgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgdmFyIGl0ZW1zID0gW107CiAgICAgICAgICAgIHRoaXMuZm9yRWFjaChmdW5jdGlvbih2YWx1ZSwgbmFtZSkgewogICAgICAgICAgICAgIGl0ZW1zLnB1c2gobmFtZSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICByZXR1cm4gaXRlcmF0b3JGb3IoaXRlbXMpOwogICAgICAgICAgfTsKICAgICAgICAgIEhlYWRlcnMucHJvdG90eXBlLnZhbHVlcyA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICB2YXIgaXRlbXMgPSBbXTsKICAgICAgICAgICAgdGhpcy5mb3JFYWNoKGZ1bmN0aW9uKHZhbHVlKSB7CiAgICAgICAgICAgICAgaXRlbXMucHVzaCh2YWx1ZSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICByZXR1cm4gaXRlcmF0b3JGb3IoaXRlbXMpOwogICAgICAgICAgfTsKICAgICAgICAgIEhlYWRlcnMucHJvdG90eXBlLmVudHJpZXMgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgdmFyIGl0ZW1zID0gW107CiAgICAgICAgICAgIHRoaXMuZm9yRWFjaChmdW5jdGlvbih2YWx1ZSwgbmFtZSkgewogICAgICAgICAgICAgIGl0ZW1zLnB1c2goW25hbWUsIHZhbHVlXSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICByZXR1cm4gaXRlcmF0b3JGb3IoaXRlbXMpOwogICAgICAgICAgfTsKICAgICAgICAgIGlmIChzdXBwb3J0Lml0ZXJhYmxlKSB7CiAgICAgICAgICAgIEhlYWRlcnMucHJvdG90eXBlW1N5bWJvbC5pdGVyYXRvcl0gPSBIZWFkZXJzLnByb3RvdHlwZS5lbnRyaWVzOwogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gY29uc3VtZWQoYm9keSkgewogICAgICAgICAgICBpZiAoYm9keS5ib2R5VXNlZCkgewogICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChuZXcgVHlwZUVycm9yKCJBbHJlYWR5IHJlYWQiKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYm9keS5ib2R5VXNlZCA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiBmaWxlUmVhZGVyUmVhZHkocmVhZGVyKSB7CiAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgICAgICByZWFkZXIub25sb2FkID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXNvbHZlKHJlYWRlci5yZXN1bHQpOwogICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgcmVhZGVyLm9uZXJyb3IgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHJlamVjdChyZWFkZXIuZXJyb3IpOwogICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0pOwogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gcmVhZEJsb2JBc0FycmF5QnVmZmVyKGJsb2IpIHsKICAgICAgICAgICAgdmFyIHJlYWRlciA9IG5ldyBGaWxlUmVhZGVyKCk7CiAgICAgICAgICAgIHZhciBwcm9taXNlID0gZmlsZVJlYWRlclJlYWR5KHJlYWRlcik7CiAgICAgICAgICAgIHJlYWRlci5yZWFkQXNBcnJheUJ1ZmZlcihibG9iKTsKICAgICAgICAgICAgcmV0dXJuIHByb21pc2U7CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiByZWFkQmxvYkFzVGV4dChibG9iKSB7CiAgICAgICAgICAgIHZhciByZWFkZXIgPSBuZXcgRmlsZVJlYWRlcigpOwogICAgICAgICAgICB2YXIgcHJvbWlzZSA9IGZpbGVSZWFkZXJSZWFkeShyZWFkZXIpOwogICAgICAgICAgICByZWFkZXIucmVhZEFzVGV4dChibG9iKTsKICAgICAgICAgICAgcmV0dXJuIHByb21pc2U7CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiByZWFkQXJyYXlCdWZmZXJBc1RleHQoYnVmKSB7CiAgICAgICAgICAgIHZhciB2aWV3ID0gbmV3IFVpbnQ4QXJyYXkoYnVmKTsKICAgICAgICAgICAgdmFyIGNoYXJzID0gbmV3IEFycmF5KHZpZXcubGVuZ3RoKTsKICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCB2aWV3Lmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgY2hhcnNbaV0gPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHZpZXdbaV0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBjaGFycy5qb2luKCIiKTsKICAgICAgICAgIH0KICAgICAgICAgIGZ1bmN0aW9uIGJ1ZmZlckNsb25lKGJ1ZikgewogICAgICAgICAgICBpZiAoYnVmLnNsaWNlKSB7CiAgICAgICAgICAgICAgcmV0dXJuIGJ1Zi5zbGljZSgwKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICB2YXIgdmlldyA9IG5ldyBVaW50OEFycmF5KGJ1Zi5ieXRlTGVuZ3RoKTsKICAgICAgICAgICAgICB2aWV3LnNldChuZXcgVWludDhBcnJheShidWYpKTsKICAgICAgICAgICAgICByZXR1cm4gdmlldy5idWZmZXI7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGZ1bmN0aW9uIEJvZHkoKSB7CiAgICAgICAgICAgIHRoaXMuYm9keVVzZWQgPSBmYWxzZTsKICAgICAgICAgICAgdGhpcy5faW5pdEJvZHkgPSBmdW5jdGlvbihib2R5KSB7CiAgICAgICAgICAgICAgdGhpcy5fYm9keUluaXQgPSBib2R5OwogICAgICAgICAgICAgIGlmICghYm9keSkgewogICAgICAgICAgICAgICAgdGhpcy5fYm9keVRleHQgPSAiIjsKICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBib2R5ID09PSAic3RyaW5nIikgewogICAgICAgICAgICAgICAgdGhpcy5fYm9keVRleHQgPSBib2R5OwogICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3VwcG9ydC5ibG9iICYmIEJsb2IucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoYm9keSkpIHsKICAgICAgICAgICAgICAgIHRoaXMuX2JvZHlCbG9iID0gYm9keTsKICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN1cHBvcnQuZm9ybURhdGEgJiYgRm9ybURhdGEucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoYm9keSkpIHsKICAgICAgICAgICAgICAgIHRoaXMuX2JvZHlGb3JtRGF0YSA9IGJvZHk7CiAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdXBwb3J0LnNlYXJjaFBhcmFtcyAmJiBVUkxTZWFyY2hQYXJhbXMucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoYm9keSkpIHsKICAgICAgICAgICAgICAgIHRoaXMuX2JvZHlUZXh0ID0gYm9keS50b1N0cmluZygpOwogICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3VwcG9ydC5hcnJheUJ1ZmZlciAmJiBzdXBwb3J0LmJsb2IgJiYgaXNEYXRhVmlldyhib2R5KSkgewogICAgICAgICAgICAgICAgdGhpcy5fYm9keUFycmF5QnVmZmVyID0gYnVmZmVyQ2xvbmUoYm9keS5idWZmZXIpOwogICAgICAgICAgICAgICAgdGhpcy5fYm9keUluaXQgPSBuZXcgQmxvYihbdGhpcy5fYm9keUFycmF5QnVmZmVyXSk7CiAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdXBwb3J0LmFycmF5QnVmZmVyICYmIChBcnJheUJ1ZmZlci5wcm90b3R5cGUuaXNQcm90b3R5cGVPZihib2R5KSB8fCBpc0FycmF5QnVmZmVyVmlldyhib2R5KSkpIHsKICAgICAgICAgICAgICAgIHRoaXMuX2JvZHlBcnJheUJ1ZmZlciA9IGJ1ZmZlckNsb25lKGJvZHkpOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0aGlzLl9ib2R5VGV4dCA9IGJvZHkgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwoYm9keSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmICghdGhpcy5oZWFkZXJzLmdldCgiY29udGVudC10eXBlIikpIHsKICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgYm9keSA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkZXJzLnNldCgiY29udGVudC10eXBlIiwgInRleHQvcGxhaW47Y2hhcnNldD1VVEYtOCIpOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0aGlzLl9ib2R5QmxvYiAmJiB0aGlzLl9ib2R5QmxvYi50eXBlKSB7CiAgICAgICAgICAgICAgICAgIHRoaXMuaGVhZGVycy5zZXQoImNvbnRlbnQtdHlwZSIsIHRoaXMuX2JvZHlCbG9iLnR5cGUpOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdXBwb3J0LnNlYXJjaFBhcmFtcyAmJiBVUkxTZWFyY2hQYXJhbXMucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoYm9keSkpIHsKICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkZXJzLnNldCgiY29udGVudC10eXBlIiwgImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZDtjaGFyc2V0PVVURi04Iik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBpZiAoc3VwcG9ydC5ibG9iKSB7CiAgICAgICAgICAgICAgdGhpcy5ibG9iID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICB2YXIgcmVqZWN0ZWQgPSBjb25zdW1lZCh0aGlzKTsKICAgICAgICAgICAgICAgIGlmIChyZWplY3RlZCkgewogICAgICAgICAgICAgICAgICByZXR1cm4gcmVqZWN0ZWQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAodGhpcy5fYm9keUJsb2IpIHsKICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSh0aGlzLl9ib2R5QmxvYik7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuX2JvZHlBcnJheUJ1ZmZlcikgewogICAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKG5ldyBCbG9iKFt0aGlzLl9ib2R5QXJyYXlCdWZmZXJdKSk7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuX2JvZHlGb3JtRGF0YSkgewogICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoImNvdWxkIG5vdCByZWFkIEZvcm1EYXRhIGJvZHkgYXMgYmxvYiIpOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShuZXcgQmxvYihbdGhpcy5fYm9keVRleHRdKSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICB0aGlzLmFycmF5QnVmZmVyID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICBpZiAodGhpcy5fYm9keUFycmF5QnVmZmVyKSB7CiAgICAgICAgICAgICAgICAgIHJldHVybiBjb25zdW1lZCh0aGlzKSB8fCBQcm9taXNlLnJlc29sdmUodGhpcy5fYm9keUFycmF5QnVmZmVyKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmJsb2IoKS50aGVuKHJlYWRCbG9iQXNBcnJheUJ1ZmZlcik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnRleHQgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICB2YXIgcmVqZWN0ZWQgPSBjb25zdW1lZCh0aGlzKTsKICAgICAgICAgICAgICBpZiAocmVqZWN0ZWQpIHsKICAgICAgICAgICAgICAgIHJldHVybiByZWplY3RlZDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHRoaXMuX2JvZHlCbG9iKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gcmVhZEJsb2JBc1RleHQodGhpcy5fYm9keUJsb2IpOwogICAgICAgICAgICAgIH0gZWxzZSBpZiAodGhpcy5fYm9keUFycmF5QnVmZmVyKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKHJlYWRBcnJheUJ1ZmZlckFzVGV4dCh0aGlzLl9ib2R5QXJyYXlCdWZmZXIpKTsKICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMuX2JvZHlGb3JtRGF0YSkgewogICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJjb3VsZCBub3QgcmVhZCBGb3JtRGF0YSBib2R5IGFzIHRleHQiKTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSh0aGlzLl9ib2R5VGV4dCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBpZiAoc3VwcG9ydC5mb3JtRGF0YSkgewogICAgICAgICAgICAgIHRoaXMuZm9ybURhdGEgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRleHQoKS50aGVuKGRlY29kZSk7CiAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLmpzb24gPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICByZXR1cm4gdGhpcy50ZXh0KCkudGhlbihKU09OLnBhcnNlKTsKICAgICAgICAgICAgfTsKICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICB9CiAgICAgICAgICB2YXIgbWV0aG9kcyA9IFsiREVMRVRFIiwgIkdFVCIsICJIRUFEIiwgIk9QVElPTlMiLCAiUE9TVCIsICJQVVQiXTsKICAgICAgICAgIGZ1bmN0aW9uIG5vcm1hbGl6ZU1ldGhvZChtZXRob2QpIHsKICAgICAgICAgICAgdmFyIHVwY2FzZWQgPSBtZXRob2QudG9VcHBlckNhc2UoKTsKICAgICAgICAgICAgcmV0dXJuIG1ldGhvZHMuaW5kZXhPZih1cGNhc2VkKSA+IC0xID8gdXBjYXNlZCA6IG1ldGhvZDsKICAgICAgICAgIH0KICAgICAgICAgIGZ1bmN0aW9uIFJlcXVlc3QoaW5wdXQsIG9wdGlvbnMpIHsKICAgICAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307CiAgICAgICAgICAgIHZhciBib2R5ID0gb3B0aW9ucy5ib2R5OwogICAgICAgICAgICBpZiAoaW5wdXQgaW5zdGFuY2VvZiBSZXF1ZXN0KSB7CiAgICAgICAgICAgICAgaWYgKGlucHV0LmJvZHlVc2VkKSB7CiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJBbHJlYWR5IHJlYWQiKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgdGhpcy51cmwgPSBpbnB1dC51cmw7CiAgICAgICAgICAgICAgdGhpcy5jcmVkZW50aWFscyA9IGlucHV0LmNyZWRlbnRpYWxzOwogICAgICAgICAgICAgIGlmICghb3B0aW9ucy5oZWFkZXJzKSB7CiAgICAgICAgICAgICAgICB0aGlzLmhlYWRlcnMgPSBuZXcgSGVhZGVycyhpbnB1dC5oZWFkZXJzKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgdGhpcy5tZXRob2QgPSBpbnB1dC5tZXRob2Q7CiAgICAgICAgICAgICAgdGhpcy5tb2RlID0gaW5wdXQubW9kZTsKICAgICAgICAgICAgICB0aGlzLnNpZ25hbCA9IGlucHV0LnNpZ25hbDsKICAgICAgICAgICAgICBpZiAoIWJvZHkgJiYgaW5wdXQuX2JvZHlJbml0ICE9IG51bGwpIHsKICAgICAgICAgICAgICAgIGJvZHkgPSBpbnB1dC5fYm9keUluaXQ7CiAgICAgICAgICAgICAgICBpbnB1dC5ib2R5VXNlZCA9IHRydWU7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHRoaXMudXJsID0gU3RyaW5nKGlucHV0KTsKICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLmNyZWRlbnRpYWxzID0gb3B0aW9ucy5jcmVkZW50aWFscyB8fCB0aGlzLmNyZWRlbnRpYWxzIHx8ICJzYW1lLW9yaWdpbiI7CiAgICAgICAgICAgIGlmIChvcHRpb25zLmhlYWRlcnMgfHwgIXRoaXMuaGVhZGVycykgewogICAgICAgICAgICAgIHRoaXMuaGVhZGVycyA9IG5ldyBIZWFkZXJzKG9wdGlvbnMuaGVhZGVycyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5tZXRob2QgPSBub3JtYWxpemVNZXRob2Qob3B0aW9ucy5tZXRob2QgfHwgdGhpcy5tZXRob2QgfHwgIkdFVCIpOwogICAgICAgICAgICB0aGlzLm1vZGUgPSBvcHRpb25zLm1vZGUgfHwgdGhpcy5tb2RlIHx8IG51bGw7CiAgICAgICAgICAgIHRoaXMuc2lnbmFsID0gb3B0aW9ucy5zaWduYWwgfHwgdGhpcy5zaWduYWw7CiAgICAgICAgICAgIHRoaXMucmVmZXJyZXIgPSBudWxsOwogICAgICAgICAgICBpZiAoKHRoaXMubWV0aG9kID09PSAiR0VUIiB8fCB0aGlzLm1ldGhvZCA9PT0gIkhFQUQiKSAmJiBib2R5KSB7CiAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiQm9keSBub3QgYWxsb3dlZCBmb3IgR0VUIG9yIEhFQUQgcmVxdWVzdHMiKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLl9pbml0Qm9keShib2R5KTsKICAgICAgICAgIH0KICAgICAgICAgIFJlcXVlc3QucHJvdG90eXBlLmNsb25lID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgIHJldHVybiBuZXcgUmVxdWVzdCh0aGlzLCB7IGJvZHk6IHRoaXMuX2JvZHlJbml0IH0pOwogICAgICAgICAgfTsKICAgICAgICAgIGZ1bmN0aW9uIGRlY29kZShib2R5KSB7CiAgICAgICAgICAgIHZhciBmb3JtID0gbmV3IEZvcm1EYXRhKCk7CiAgICAgICAgICAgIGJvZHkudHJpbSgpLnNwbGl0KCImIikuZm9yRWFjaChmdW5jdGlvbihieXRlcykgewogICAgICAgICAgICAgIGlmIChieXRlcykgewogICAgICAgICAgICAgICAgdmFyIHNwbGl0ID0gYnl0ZXMuc3BsaXQoIj0iKTsKICAgICAgICAgICAgICAgIHZhciBuYW1lID0gc3BsaXQuc2hpZnQoKS5yZXBsYWNlKC9cKy9nLCAiICIpOwogICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gc3BsaXQuam9pbigiPSIpLnJlcGxhY2UoL1wrL2csICIgIik7CiAgICAgICAgICAgICAgICBmb3JtLmFwcGVuZChkZWNvZGVVUklDb21wb25lbnQobmFtZSksIGRlY29kZVVSSUNvbXBvbmVudCh2YWx1ZSkpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHJldHVybiBmb3JtOwogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gcGFyc2VIZWFkZXJzKHJhd0hlYWRlcnMpIHsKICAgICAgICAgICAgdmFyIGhlYWRlcnMgPSBuZXcgSGVhZGVycygpOwogICAgICAgICAgICB2YXIgcHJlUHJvY2Vzc2VkSGVhZGVycyA9IHJhd0hlYWRlcnMucmVwbGFjZSgvXHI/XG5bXHQgXSsvZywgIiAiKTsKICAgICAgICAgICAgcHJlUHJvY2Vzc2VkSGVhZGVycy5zcGxpdCgvXHI/XG4vKS5mb3JFYWNoKGZ1bmN0aW9uKGxpbmUpIHsKICAgICAgICAgICAgICB2YXIgcGFydHMgPSBsaW5lLnNwbGl0KCI6Iik7CiAgICAgICAgICAgICAgdmFyIGtleSA9IHBhcnRzLnNoaWZ0KCkudHJpbSgpOwogICAgICAgICAgICAgIGlmIChrZXkpIHsKICAgICAgICAgICAgICAgIHZhciB2YWx1ZSA9IHBhcnRzLmpvaW4oIjoiKS50cmltKCk7CiAgICAgICAgICAgICAgICBoZWFkZXJzLmFwcGVuZChrZXksIHZhbHVlKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICByZXR1cm4gaGVhZGVyczsKICAgICAgICAgIH0KICAgICAgICAgIEJvZHkuY2FsbChSZXF1ZXN0LnByb3RvdHlwZSk7CiAgICAgICAgICBmdW5jdGlvbiBSZXNwb25zZShib2R5SW5pdCwgb3B0aW9ucykgewogICAgICAgICAgICBpZiAoIW9wdGlvbnMpIHsKICAgICAgICAgICAgICBvcHRpb25zID0ge307CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy50eXBlID0gImRlZmF1bHQiOwogICAgICAgICAgICB0aGlzLnN0YXR1cyA9IG9wdGlvbnMuc3RhdHVzID09PSB2b2lkIDAgPyAyMDAgOiBvcHRpb25zLnN0YXR1czsKICAgICAgICAgICAgdGhpcy5vayA9IHRoaXMuc3RhdHVzID49IDIwMCAmJiB0aGlzLnN0YXR1cyA8IDMwMDsKICAgICAgICAgICAgdGhpcy5zdGF0dXNUZXh0ID0gInN0YXR1c1RleHQiIGluIG9wdGlvbnMgPyBvcHRpb25zLnN0YXR1c1RleHQgOiAiT0siOwogICAgICAgICAgICB0aGlzLmhlYWRlcnMgPSBuZXcgSGVhZGVycyhvcHRpb25zLmhlYWRlcnMpOwogICAgICAgICAgICB0aGlzLnVybCA9IG9wdGlvbnMudXJsIHx8ICIiOwogICAgICAgICAgICB0aGlzLl9pbml0Qm9keShib2R5SW5pdCk7CiAgICAgICAgICB9CiAgICAgICAgICBCb2R5LmNhbGwoUmVzcG9uc2UucHJvdG90eXBlKTsKICAgICAgICAgIFJlc3BvbnNlLnByb3RvdHlwZS5jbG9uZSA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICByZXR1cm4gbmV3IFJlc3BvbnNlKHRoaXMuX2JvZHlJbml0LCB7CiAgICAgICAgICAgICAgc3RhdHVzOiB0aGlzLnN0YXR1cywKICAgICAgICAgICAgICBzdGF0dXNUZXh0OiB0aGlzLnN0YXR1c1RleHQsCiAgICAgICAgICAgICAgaGVhZGVyczogbmV3IEhlYWRlcnModGhpcy5oZWFkZXJzKSwKICAgICAgICAgICAgICB1cmw6IHRoaXMudXJsCiAgICAgICAgICAgIH0pOwogICAgICAgICAgfTsKICAgICAgICAgIFJlc3BvbnNlLmVycm9yID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgIHZhciByZXNwb25zZSA9IG5ldyBSZXNwb25zZShudWxsLCB7IHN0YXR1czogMCwgc3RhdHVzVGV4dDogIiIgfSk7CiAgICAgICAgICAgIHJlc3BvbnNlLnR5cGUgPSAiZXJyb3IiOwogICAgICAgICAgICByZXR1cm4gcmVzcG9uc2U7CiAgICAgICAgICB9OwogICAgICAgICAgdmFyIHJlZGlyZWN0U3RhdHVzZXMgPSBbMzAxLCAzMDIsIDMwMywgMzA3LCAzMDhdOwogICAgICAgICAgUmVzcG9uc2UucmVkaXJlY3QgPSBmdW5jdGlvbih1cmwsIHN0YXR1cykgewogICAgICAgICAgICBpZiAocmVkaXJlY3RTdGF0dXNlcy5pbmRleE9mKHN0YXR1cykgPT09IC0xKSB7CiAgICAgICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkludmFsaWQgc3RhdHVzIGNvZGUiKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gbmV3IFJlc3BvbnNlKG51bGwsIHsgc3RhdHVzLCBoZWFkZXJzOiB7IGxvY2F0aW9uOiB1cmwgfSB9KTsKICAgICAgICAgIH07CiAgICAgICAgICBleHBvcnRzMi5ET01FeGNlcHRpb24gPSBzZWxmMi5ET01FeGNlcHRpb247CiAgICAgICAgICB0cnkgewogICAgICAgICAgICBuZXcgZXhwb3J0czIuRE9NRXhjZXB0aW9uKCk7CiAgICAgICAgICB9IGNhdGNoIChlcnIpIHsKICAgICAgICAgICAgZXhwb3J0czIuRE9NRXhjZXB0aW9uID0gZnVuY3Rpb24obWVzc2FnZSwgbmFtZSkgewogICAgICAgICAgICAgIHRoaXMubWVzc2FnZSA9IG1lc3NhZ2U7CiAgICAgICAgICAgICAgdGhpcy5uYW1lID0gbmFtZTsKICAgICAgICAgICAgICB2YXIgZXJyb3IgPSBFcnJvcihtZXNzYWdlKTsKICAgICAgICAgICAgICB0aGlzLnN0YWNrID0gZXJyb3Iuc3RhY2s7CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIGV4cG9ydHMyLkRPTUV4Y2VwdGlvbi5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKEVycm9yLnByb3RvdHlwZSk7CiAgICAgICAgICAgIGV4cG9ydHMyLkRPTUV4Y2VwdGlvbi5wcm90b3R5cGUuY29uc3RydWN0b3IgPSBleHBvcnRzMi5ET01FeGNlcHRpb247CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiBmZXRjaDIoaW5wdXQsIGluaXQyKSB7CiAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgICAgICB2YXIgcmVxdWVzdCA9IG5ldyBSZXF1ZXN0KGlucHV0LCBpbml0Mik7CiAgICAgICAgICAgICAgaWYgKHJlcXVlc3Quc2lnbmFsICYmIHJlcXVlc3Quc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICAgIHJldHVybiByZWplY3QobmV3IGV4cG9ydHMyLkRPTUV4Y2VwdGlvbigiQWJvcnRlZCIsICJBYm9ydEVycm9yIikpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB2YXIgeGhyID0gbmV3IFhNTEh0dHBSZXF1ZXN0KCk7CiAgICAgICAgICAgICAgZnVuY3Rpb24gYWJvcnRYaHIoKSB7CiAgICAgICAgICAgICAgICB4aHIuYWJvcnQoKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgeGhyLm9ubG9hZCA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgdmFyIG9wdGlvbnMgPSB7CiAgICAgICAgICAgICAgICAgIHN0YXR1czogeGhyLnN0YXR1cywKICAgICAgICAgICAgICAgICAgc3RhdHVzVGV4dDogeGhyLnN0YXR1c1RleHQsCiAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHBhcnNlSGVhZGVycyh4aHIuZ2V0QWxsUmVzcG9uc2VIZWFkZXJzKCkgfHwgIiIpCiAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgb3B0aW9ucy51cmwgPSAicmVzcG9uc2VVUkwiIGluIHhociA/IHhoci5yZXNwb25zZVVSTCA6IG9wdGlvbnMuaGVhZGVycy5nZXQoIlgtUmVxdWVzdC1VUkwiKTsKICAgICAgICAgICAgICAgIHZhciBib2R5ID0gInJlc3BvbnNlIiBpbiB4aHIgPyB4aHIucmVzcG9uc2UgOiB4aHIucmVzcG9uc2VUZXh0OwogICAgICAgICAgICAgICAgcmVzb2x2ZShuZXcgUmVzcG9uc2UoYm9keSwgb3B0aW9ucykpOwogICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgeGhyLm9uZXJyb3IgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIHJlamVjdChuZXcgVHlwZUVycm9yKCJOZXR3b3JrIHJlcXVlc3QgZmFpbGVkIikpOwogICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgeGhyLm9udGltZW91dCA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgcmVqZWN0KG5ldyBUeXBlRXJyb3IoIk5ldHdvcmsgcmVxdWVzdCBmYWlsZWQiKSk7CiAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICB4aHIub25hYm9ydCA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgcmVqZWN0KG5ldyBleHBvcnRzMi5ET01FeGNlcHRpb24oIkFib3J0ZWQiLCAiQWJvcnRFcnJvciIpKTsKICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgIHhoci5vcGVuKHJlcXVlc3QubWV0aG9kLCByZXF1ZXN0LnVybCwgdHJ1ZSk7CiAgICAgICAgICAgICAgaWYgKHJlcXVlc3QuY3JlZGVudGlhbHMgPT09ICJpbmNsdWRlIikgewogICAgICAgICAgICAgICAgeGhyLndpdGhDcmVkZW50aWFscyA9IHRydWU7CiAgICAgICAgICAgICAgfSBlbHNlIGlmIChyZXF1ZXN0LmNyZWRlbnRpYWxzID09PSAib21pdCIpIHsKICAgICAgICAgICAgICAgIHhoci53aXRoQ3JlZGVudGlhbHMgPSBmYWxzZTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKCJyZXNwb25zZVR5cGUiIGluIHhociAmJiBzdXBwb3J0LmJsb2IpIHsKICAgICAgICAgICAgICAgIHhoci5yZXNwb25zZVR5cGUgPSAiYmxvYiI7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHJlcXVlc3QuaGVhZGVycy5mb3JFYWNoKGZ1bmN0aW9uKHZhbHVlLCBuYW1lKSB7CiAgICAgICAgICAgICAgICB4aHIuc2V0UmVxdWVzdEhlYWRlcihuYW1lLCB2YWx1ZSk7CiAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgaWYgKHJlcXVlc3Quc2lnbmFsKSB7CiAgICAgICAgICAgICAgICByZXF1ZXN0LnNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsIGFib3J0WGhyKTsKICAgICAgICAgICAgICAgIHhoci5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICAgaWYgKHhoci5yZWFkeVN0YXRlID09PSA0KSB7CiAgICAgICAgICAgICAgICAgICAgcmVxdWVzdC5zaWduYWwucmVtb3ZlRXZlbnRMaXN0ZW5lcigiYWJvcnQiLCBhYm9ydFhocik7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHhoci5zZW5kKHR5cGVvZiByZXF1ZXN0Ll9ib2R5SW5pdCA9PT0gInVuZGVmaW5lZCIgPyBudWxsIDogcmVxdWVzdC5fYm9keUluaXQpOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICAgIGZldGNoMi5wb2x5ZmlsbCA9IHRydWU7CiAgICAgICAgICBpZiAoIXNlbGYyLmZldGNoKSB7CiAgICAgICAgICAgIHNlbGYyLmZldGNoID0gZmV0Y2gyOwogICAgICAgICAgICBzZWxmMi5IZWFkZXJzID0gSGVhZGVyczsKICAgICAgICAgICAgc2VsZjIuUmVxdWVzdCA9IFJlcXVlc3Q7CiAgICAgICAgICAgIHNlbGYyLlJlc3BvbnNlID0gUmVzcG9uc2U7CiAgICAgICAgICB9CiAgICAgICAgICBleHBvcnRzMi5IZWFkZXJzID0gSGVhZGVyczsKICAgICAgICAgIGV4cG9ydHMyLlJlcXVlc3QgPSBSZXF1ZXN0OwogICAgICAgICAgZXhwb3J0czIuUmVzcG9uc2UgPSBSZXNwb25zZTsKICAgICAgICAgIGV4cG9ydHMyLmZldGNoID0gZmV0Y2gyOwogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGV4cG9ydHMyLCAiX19lc01vZHVsZSIsIHsgdmFsdWU6IHRydWUgfSk7CiAgICAgICAgICByZXR1cm4gZXhwb3J0czI7CiAgICAgICAgfSh7fSk7CiAgICAgIH0pKHR5cGVvZiBzZWxmICE9PSAidW5kZWZpbmVkIiA/IHNlbGYgOiBleHBvcnRzKTsKICAgIH0KICB9KTsKCiAgLy8gc3JjL2RhdGEtZmV0Y2hlcnMvYmFtL2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c3QgfHwgY2h1bmsubWF4di5jb21wYXJlVG8obG93ZXN0KSA+IDApIHsKICAgICAgICBpZiAobGFzdENodW5rID09PSBudWxsKSB7CiAgICAgICAgICBtZXJnZWRDaHVua3MucHVzaChjaHVuayk7CiAgICAgICAgICBsYXN0Q2h1bmsgPSBjaHVuazsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKGNhbk1lcmdlQmxvY2tzKGxhc3RDaHVuaywgY2h1bmspKSB7CiAgICAgICAgICAgIGlmIChjaHVuay5tYXh2LmNvbXBhcmVUbyhsYXN0Q2h1bmsubWF4dikgPiAwKSB7CiAgICAgICAgICAgICAgbGFzdENodW5rLm1heHYgPSBjaHVuay5tYXh2OwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBtZXJnZWRDaHVua3MucHVzaChjaHVuayk7CiAgICAgICAgICAgIGxhc3RDaHVuayA9IGNodW5rOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgfSk7CiAgICByZXR1cm4gbWVyZ2VkQ2h1bmtzOwogIH0KCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL0BnbW9kK2JhbUAxLjEuMTgvbm9kZV9tb2R1bGVzL0BnbW9kL2JhbS9lc20vYmFpLmpzCiAgdmFyIEJBSV9NQUdJQyA9IDIxNTc4MDUwOwogIGZ1bmN0aW9uIHJvdW5kRG93bihuLCBtdWx0aXBsZSkgewogICAgcmV0dXJuIG4gLSBuICUgbXVsdGlwbGU7CiAgfQogIGZ1bmN0aW9uIHJvdW5kVXAobiwgbXVsdGlwbGUpIHsKICAgIHJldHVybiBuIC0gbiAlIG11bHRpcGxlICsgbXVsdGlwbGU7CiAgfQogIHZhciBCQUkgPSBjbGFzcyBleHRlbmRzIEluZGV4RmlsZSB7CiAgICBwYXJzZVBzZXVkb0JpbihieXRlcywgb2Zmc2V0KSB7CiAgICAgIGNvbnN0IGxpbmVDb3VudCA9IGxvbmdUb051bWJlcihpbXBvcnRfbG9uZy5kZWZhdWx0LmZyb21CeXRlc0xFKEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGJ5dGVzLCBvZmZzZXQgKyAxNiwgb2Zmc2V0ICsgMjQpLCB0cnVlKSk7CiAgICAgIHJldHVybiB7IGxpbmVDb3VudCB9OwogICAgfQogICAgYXN5bmMgbGluZUNvdW50KHJlZklkLCBvcHRzID0ge30pIHsKICAgICAgY29uc3QgcHJvbSA9IGF3YWl0IHRoaXMucGFyc2Uob3B0cyk7CiAgICAgIGNvbnN0IGluZGV4ID0gcHJvbS5pbmRpY2VzW3JlZklkXTsKICAgICAgaWYgKCFpbmRleCkgewogICAgICAgIHJldHVybiAtMTsKICAgICAgfQogICAgICBjb25zdCByZXQgPSBpbmRleC5zdGF0cyB8fCB7fTsKICAgICAgcmV0dXJuIHJldC5saW5lQ291bnQgPT09IHZvaWQgMCA/IC0xIDogcmV0LmxpbmVDb3VudDsKICAgIH0KICAgIGZldGNoQmFpKG9wdHMgPSB7fSkgewogICAgICBpZiAoIXRoaXMuYmFpUCkgewogICAgICAgIHRoaXMuYmFpUCA9IHRoaXMuZmlsZWhhbmRsZS5yZWFkRmlsZShvcHRzKS5jYXRjaCgoZSkgPT4gewogICAgICAgICAgdGhpcy5iYWlQID0gdm9pZCAwOwogICAgICAgICAgdGhyb3cgZTsKICAgICAgICB9KTsKICAgICAgfQogICAgICByZXR1cm4gdGhpcy5iYWlQOwogICAgfQogICAgYXN5bmMgX3BhcnNlKCkgewogICAgICBjb25zdCBkYXRhID0geyBiYWk6IHRydWUsIG1heEJsb2NrU2l6ZTogMSA8PCAxNiB9OwogICAgICBjb25zdCBieXRlcyA9IGF3YWl0IHRoaXMuZmV0Y2hCYWkoKTsKICAgICAgaWYgKGJ5dGVzLnJlYWRVSW50MzJMRSgwKSAhPT0gQkFJX01BR0lDKSB7CiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJOb3QgYSBCQUkgZmlsZSIpOwogICAgICB9CiAgICAgIGRhd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kxFKGN1cnJPZmZzZXQpOwogICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDQ7CiAgICAgICAgICAgIGNvbnN0IGNodW5rcyA9IG5ldyBBcnJheShjaHVua0NvdW50KTsKICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBjaHVua0NvdW50OyBrICs9IDEpIHsKICAgICAgICAgICAgICBjb25zdCB1ID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgICBjb25zdCB2ID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0ICsgOCk7CiAgICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNjsKICAgICAgICAgICAgICB0aGlzLl9maW5kRmlyc3REYXRhKGRhdGEsIHUpOwogICAgICAgICAgICAgIGNodW5rc1trXSA9IG5ldyBDaHVuayh1LCB2LCBiaW4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGJpbkluZGV4W2Jpbl0gPSBjaHVua3M7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNvbnN0IGxpbmVhckNvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCk7CiAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgIGNvbnN0IGxpbmVhckluZGV4ID0gbmV3IEFycmF5KGxpbmVhckNvdW50KTsKICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGxpbmVhckNvdW50OyBrICs9IDEpIHsKICAgICAgICAgIGxpbmVhckluZGV4W2tdID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0KTsKICAgICAgICAgIGN1cnJPZmZzZXQgKz0gODsKICAgICAgICAgIHRoaXMuX2ZpbmRGaXJzdERhdGEoZGF0YSwgbGluZWFySW5kZXhba10pOwogICAgICAgIH0KICAgICAgICBkYXRhLmluZGljZXNbaV0gPSB7IGJpbkluZGV4LCBsaW5lYXJJbmRleCwgc3RhdHMgfTsKICAgICAgfQogICAgICByZXR1cm4gZGF0YTsKICAgIH0KICAgIGFzeW5jIGluZGV4Q292KHNlcUlkLCBzdGFydCwgZW5kLCBvcHRzID0ge30pIHsKICAgICAgY29uc3QgdiA9IDE2Mzg0OwogICAgICBjb25zdCByYW5nZSA9IHN0YXJ0ICE9PSB2b2lkIDA7CiAgICAgIGNvbnN0IGluZGV4RGF0YSA9IGF3YWl0IHRoaXMucGFyc2Uob3B0cyk7CiAgICAgIGNvbnN0IHNlcUlkeCA9IGluZGV4RGF0YS5pbmRpY2VzW3NlcUlkXTsKICAgICAgaWYgKCFzZXFJZHgpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3QgeyBsaW5lYXJJbmRleCA9IFtdLCBzdGF0cyB9ID0gc2VxSWR4OwogICAgICBpZiAoIWxpbmVhckluZGV4Lmxlbmd0aCkgewogICAgICAgIHJldHVybiBbXTsKICAgICAgfQogICAgICBjb25zdCBlID0gZW5kICE9PSB2b2lkIDAgPyByb3VuZFVwKGVuZCwgdikgOiAobGluZWFySW5kZXgubGVuZ3RoIC0gMSkgKiB2OwogICAgICBjb25zdCBzID0gc3RhcnQgIT09IHZvaWQgMCA/IHJvdW5kRG93bihzdGFydCwgdikgOiAwOwogICAgICBsZXQgZGVwdGhzOwogICAgICBpZiAocmFuZ2UpIHsKICAgICAgICBkZXB0aHMgPSBuZXcgQXJyYXkoKGUgLSBzKSAvIHYpOwogICAgICB9IGVsc2UgewogICAgICAgIGRlcHRocyA9IG5ldyBBcnJheShsaW5lYXJJbmRleC5sZW5ndGggLSAxKTsKICAgICAgfQogICAgICBjb25zdCB0b3RhbFNpemUgPSBsaW5lYXJJbmRleFtsaW5lYXJJbmRleC5sZW5ndGggLSAxXS5ibG9ja1Bvc2l0aW9uOwogICAgICBpZiAoZSA+IChsaW5lYXJJbmRleC5sZW5ndGggLSAxKSAqIHYpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoInF1ZXJ5IG91dHNpZGUgb2YgcmFuZ2Ugb2YgbGluZWFyIGluZGV4Iik7CiAgICAgIH0KICAgICAgbGV0IGN1cnJlbnRQb3MgPSBsaW5lYXJJbmRleFtzIC8gdl0uYmxvY2tQb3NpdGlvbjsKICAgICAgZm9yIChsZXQgaSA9IHMgLyB2LCBqID0gMDsgaSA8IGUgLyB2OyBpKyssIGorKykgewogICAgICAgIGRlcHRoc1tqXSA9IHsKICAgICAgICAgIHNjb3JlOiBsaW5lYXJJbmRleFtpICsgMV0uYmxvY2tQb3NpdGlvbiAtIGN1cnJlbnRQb3MsCiAgICAgICAgICBzdGFydDogaSAqIHYsCiAgICAgICAgICBlbmQ6IGkgKiB2ICsgdgogICAgICAgIH07CiAgICAgICAgY3VycmVudFBvcyA9IGxpbmVhckluZGV4W2kgKyAxXS5ibG9ja1Bvc2l0aW9uOwogICAgICB9CiAgICAgIHJldHVybiBkZXB0aHMubWFwKChkKSA9PiB7CiAgICAgICAgcmV0dXJuIHsgLi4uZCwgc2NvcmU6IGQuc2NvcmUgKiBzdGF0cy5saW5lQ291bnQgLyB0b3RhbFNpemUgfTsKICAgICAgfSk7CiAgICB9CiAgICByZWcyYmlucyhiZWcsIGVuZCkgewogICAgICBlbmQgLT0gMTsKICAgICAgcmV0dXJuIFsKICAgICAgICBbMCwgMF0sCiAgICAgICAgWzEgKyAoYmVnID4+IDI2KSwgMSArIChlbmQgPj4gMjYpXSwKICAgICAgICBbOSArIChiZWcgPj4gMjMpLCA5ICsgKGVuZCA+PiAyMyldLAogICAgICAgIFs3MyArIChiZWcgPj4gMjApLCA3MyArIChlbmQgPj4gMjApXSwKICAgICAgICBbNTg1ICsgKGJlZyA+PiAxNyksIDU4NSArIChlbmQgPj4gMTcpXSwKICAgICAgICBbNDY4MSArIChiZWcgPj4gMTQpLCA0NjgxICsgKGVuZCA+PiAxNCldCiAgICAgIF07CiAgICB9CiAgICBhc3luYyBibG9ja3NGb3JSYW5nZShyZWZJZCwgbWluLCBtYXgsIG9wdHMgPSB7fSkgewogICAgICBpZiAobWluIDwgMCkgewogICAgICAgIG1pbiA9IDA7CiAgICAgIH0KICAgICAgY29uc3QgaW5kZXhEYXRhID0gYXdhaXQgdGhpcy5wYXJzZShvcHRzKTsKICAgICAgaWYgKCFpbmRleERhdGEpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3QgYmEgPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmICghYmEpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3Qgb3ZlcmxhcHBpbmdCaW5zID0gdGhpcy5yZWcyYmlucyhtaW4sIG1heCk7CiAgICAgIGNvbnN0IGNodW5rcyA9IFtdOwogICAgICBmb3IgKGNvbnN0IFtzdGFydCwgZW5kXSBvZiBvdmVybGFwcGluZ0JpbnMpIHsKICAgICAgICBmb3IgKGxldCBiaW4gPSBzdGFydDsgYmluIDw9IGVuZDsgYmluKyspIHsKICAgICAgICAgIGlmIChiYS5iaW5JbmRleFtiaW5dKSB7CiAgICAgICAgICAgIGNvbnN0IGJpbkNodW5rcyA9IGJhLmJpbkluZGV4W2Jpbl07CiAgICAgICAgICAgIGZvciAobGV0IGMgPSAwOyBjIDwgYmluQ2h1bmtzLmxlbmd0aDsgKytjKSB7CiAgICAgICAgICAgICAgY2h1bmtzLnB1c2gobmV3IENodW5rKGJpbkNodW5rc1tjXS5taW52LCBiaW5DaHVua3NbY10ubWF4diwgYmluKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgY29uc3QgbmludHYgPSBiYS5saW5lYXJJbmRleC5sZW5ndGg7CiAgICAgIGxldCBsb3dlc3QgPSBudWxsOwogICAgICBjb25zdCBtaW5MaW4gPSBNYXRoLm1pbihtaW4gPj4gMTQsIG5pbnR2IC0gMSk7CiAgICAgIGNvbnN0IG1heExpbiA9IE1hdGgubWluKG1heCA+PiAxNCwgbmludHYgLSAxKTsKICAgICAg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ZldGNoIHx8IGdsb2JhbFRoaXMuZmV0Y2guYmluZChnbG9iYWxUaGlzKTsKICAgICAgaWYgKCFmZXRjaDIpIHsKICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKGBubyBmZXRjaCBmdW5jdGlvbiBzdXBwbGllZCwgYW5kIG5vbmUgZm91bmQgaW4gZ2xvYmFsIGVudmlyb25tZW50YCk7CiAgICAgIH0KICAgICAgaWYgKG9wdHMub3ZlcnJpZGVzKSB7CiAgICAgICAgdGhpcy5iYXNlT3ZlcnJpZGVzID0gb3B0cy5vdmVycmlkZXM7CiAgICAgIH0KICAgICAgdGhpcy5mZXRjaEltcGxlbWVudGF0aW9uID0gZmV0Y2gyOwogICAgfQogICAgYXN5bmMgZmV0Y2goaW5wdXQsIGluaXQyKSB7CiAgICAgIGxldCByZXNwb25zZTsKICAgICAgdHJ5IHsKICAgICAgICByZXNwb25zZSA9IGF3YWl0IHRoaXMuZmV0Y2hJbXBsZW1lbnRhdGlvbihpbnB1dCwgaW5pdDIpOwogICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgaWYgKGAke2V9YC5pbmNsdWRlcygiRmFpbGVkIHRvIGZldGNoIikpIHsKICAgICAgICAgIGNvbnNvbGUud2FybihgZ2VuZXJpYy1maWxlaGFuZGxlOiByZWZldGNoaW5nICR7aW5wdXR9IHRvIGF0dGVtcHQgdG8gd29yayBhcm91bmQgY2hyb21lIENPUlMgaGVhZGVyIGNhY2hpbmcgYnVnYCk7CiAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IHRoaXMuZmV0Y2hJbXBsZW1lbnRhdGlvbihpbnB1dCwgewogICAgICAgICAgICAuLi5pbml0MiwKICAgICAgICAgICAgY2FjaGU6ICJyZWxvYWQiCiAgICAgICAgICB9KTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdGhyb3cgZTsKICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIHJlc3BvbnNlOwogICAgfQogICAgYXN5bmMgcmVhZChid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czsKICAgICAgICBvcHRzID0ge307CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZW5jb2RpbmcgPSBvcHRpb25zLmVuY29kaW5nOwogICAgICAgIG9wdHMgPSBvcHRpb25zOwogICAgICAgIGRlbGV0ZSBvcHRzLmVuY29kaW5nOwogICAgICB9CiAgICAgIGNvbnN0IHsgaGVhZGVycyA9IHt9LCBzaWduYWwsIG92ZXJyaWRlcyA9IHt9IH0gPSBvcHRzOwogICAgICBjb25zdCBhcmdzID0gewogICAgICAgIGhlYWRlcnMsCiAgICAgICAgbWV0aG9kOiAiR0VUIiwKICAgICAgICByZWRpcmVjdDogImZvbGxvdyIsCiAgICAgICAgbW9kZTogImNvcnMiLAogICAgICAgIHNpZ25hbCwKICAgICAgICAuLi50aGlzLmJhc2VPdmVycmlkZXMsCiAgICAgICAgLi4ub3ZlcnJpZGVzCiAgICAgIH07CiAgICAgIGNvbnN0IHJlc3BvbnNlID0gYXdhaXQgdGhpcy5mZXRjaCh0aGlzLnVybCwgYXJncyk7CiAgICAgIGlmICghcmVzcG9uc2UpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoImdlbmVyaWMtZmlsZWhhbmRsZSBmYWlsZWQgdG8gZmV0Y2giKTsKICAgICAgfQogICAgICBpZiAocmVzcG9uc2Uuc3RhdHVzICE9PSAyMDApIHsKICAgICAgICB0aHJvdyBPYmplY3QuYXNzaWduKG5ldyBFcnJvcihgSFRUUCAke3Jlc3BvbnNlLnN0YXR1c30gZmV0Y2hpbmcgJHt0aGlzLnVybH1gKSwgewogICAgICAgICAgc3RhdHVzOiByZXNwb25zZS5zdGF0dXMKICAgICAgICB9KTsKICAgICAgfQogICAgICBpZiAoZW5jb2RpbmcgPT09ICJ1dGY4IikgewogICAgICAgIHJldHVybiByZXNwb25zZS50ZXh0KCk7CiAgICAgIH0KICAgICAgaWYgKGVuY29kaW5nKSB7CiAgICAgICAgdGhyb3cgbmV3IEVycm9yKGB1bnN1cHBvcnRlZCBlbmNvZ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91bnppcC1wYWtvLmpzCiAgaW5pdF9idWZmZXJfc2hpbSgpOwogIHZhciBpbXBvcnRfYnVmZmVyNCA9IF9fdG9Nb2R1bGUocmVxdWlyZV9idWZmZXIoKSk7CiAgdmFyIGltcG9ydF9wYWtvID0gX190b01vZHVsZShyZXF1aXJlX3Bha28oKSk7CiAgYXN5bmMgZnVuY3Rpb24gdW56aXAoaW5wdXREYXRhKSB7CiAgICB0cnkgewogICAgICBsZXQgc3RybTsKICAgICAgbGV0IHBvcyA9IDA7CiAgICAgIGxldCBpID0gMDsKICAgICAgY29uc3QgY2h1bmtzID0gW107CiAgICAgIGxldCB0b3RhbFNpemUgPSAwOwogICAgICBsZXQgaW5mbGF0b3I7CiAgICAgIGRvIHsKICAgICAgICBjb25zdCByZW1haW5pbmdJbnB1dCA9IGlucHV0RGF0YS5zdWJhcnJheShwb3MpOwogICAgICAgIGluZmxhdG9yID0gbmV3IGltcG9ydF9wYWtvLkluZmxhdGUoKTsKICAgICAgICAoeyBzdHJtIH0gPSBpbmZsYXRvcik7CiAgICAgICAgaW5mbGF0b3IucHVzaChyZW1haW5pbmdJbnB1dCwgaW1wb3J0X3Bha28uWl9TWU5DX0ZMVVNIKTsKICAgICAgICBpZiAoaW5mbGF0b3IuZXJyKSB7CiAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoaW5mbGF0b3IubXNnKTsKICAgICAgICB9CiAgICAgICAgcG9zICs9IHN0cm0ubmV4dF9pbjsKICAgICAgICBjaHVua3NbaV0gPSBpbmZsYXRvci5yZXN1bHQ7CiAgICAgICAgdG90YWxTaXplICs9IGNodW5rc1tpXS5sZW5ndGg7CiAgICAgICAgaSArPSAxOwogICAgICB9IHdoaWxlIChzdHJtLmF2YWlsX2luKTsKICAgICAgY29uc3QgcmVzdWx0ID0gbmV3IFVpbnQ4QXJyYXkodG90YWxTaXplKTsKICAgICAgZm9yIChsZXQgaTIgPSAwLCBvZmZzZXQgPSAwOyBpMiA8IGNodW5rcy5sZW5ndG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HJlbWFpbmluZ0lucHV0LCBpbXBvcnRfcGFrby5aX1NZTkNfRkxVU0gpOwogICAgICAgIGlmIChpbmZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcihpbmZsYXRvci5tc2cpOwogICAgICAgIH0KICAgICAgICBjb25zdCBidWZmZXIyID0gaW5mbGF0b3IucmVzdWx0OwogICAgICAgIGNodW5rcy5wdXNoKGJ1ZmZlcjIpOwogICAgICAgIGxldCBsZW4gPSBidWZmZXIyLmxlbmd0aDsKICAgICAgICBjcG9zaXRpb25zLnB1c2goY3Bvcyk7CiAgICAgICAgZHBvc2l0aW9ucy5wdXNoKGRwb3MpOwogICAgICAgIGlmIChjaHVua3MubGVuZ3RoID09PSAxICYmIG1pbnYuZGF0YVBvc2l0aW9uKSB7CiAgICAgICAgICBjaHVua3NbMF0gPSBjaHVua3NbMF0uc3ViYXJyYXkobWludi5kYXRhUG9zaXRpb24pOwogICAgICAgICAgbGVuID0gY2h1bmtzWzBdLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgY29uc3Qgb3JpZ0Nwb3MgPSBjcG9zOwogICAgICAgIGNwb3MgKz0gc3RybS5uZXh0X2luOwogICAgICAgIGRwb3MgKz0gbGVuOwogICAgICAgIGlmIChvcmlnQ3BvcyA+PSBtYXh2LmJsb2NrUG9zaXRpb24pIHsKICAgICAgICAgIGNodW5rc1tpXSA9IGNodW5rc1tpXS5zdWJhcnJheSgwLCBtYXh2LmJsb2NrUG9zaXRpb24gPT09IG1pbnYuYmxvY2tQb3NpdGlvbiA/IG1heHYuZGF0YVBvc2l0aW9uIC0gbWludi5kYXRhUG9zaXRpb24gKyAxIDogbWF4di5kYXRhUG9zaXRpb24gKyAxKTsKICAgICAgICAgIGNwb3NpdGlvbnMucHVzaChjcG9zKTsKICAgICAgICAgIGRwb3NpdGlvbnMucHVzaChkcG9zKTsKICAgICAgICAgIHRvdGFsU2l6ZSArPSBjaHVua3NbaV0ubGVuZ3RoOwogICAgIC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vLyBub2RlX21vZHVsZXMvLnBucG0vQGdtb2QrYmFtQDEuMS4xOC9ub2RlX21vZHVsZXMvQGdtb2QvYmFtL2VzbS9jc2kuanMKICB2YXIgQ1NJMV9NQUdJQyA9IDIxNTgyNjU5OwogIHZhciBDU0kyX01BR0lDID0gMzgzNTk4NzU7CiAgZnVuY3Rpb24gbHNoaWZ0KG51bSwgYml0cykgewogICAgcmV0dXJuIG51bSAqIDIgKiogYml0czsKICB9CiAgZnVuY3Rpb24gcnNoaWZ0KG51bSwgYml0cykgewogICAgcmV0dXJuIE1hdGguZmxvb3IobnVtIC8gMiAqKiBiaXRzKTsKICB9CiAgdmFyIENTSSA9IGNsYXNzIGV4dGVuZHMgSW5kZXhGaWxlIHsKICAgIGNvbnN0cnVjdG9yKGFyZ3MpIHsKICAgICAgc3VwZXIoYXJncyk7CiAgICAgIHRoaXMubWF4QmluTnVtYmVyID0gMDsKICAgICAgdGhpcy5kZXB0aCA9IDA7CiAgICAgIHRoaXMubWluU2hpZnQgPSAwOwogICAgfQogICAgYXN5bmMgbGluZUNvdW50KHJlZklkKSB7CiAgICAgIGNvbnN0IGluZGV4RGF0YSA9IGF3YWl0IHRoaXMucGFyc2UoKTsKICAgICAgaWYgKCFpbmRleERhdGEpIHsKICAgICAgICByZXR1cm4gLTE7CiAgICAgIH0KICAgICAgY29uc3QgaWR4ID0gaW5kZXhEYXRhLmluZGljZXNbcmVmSWRdOwogICAgICBpZiAoIWlkeCkgewogICAgICAgIHJldHVybiAtMTsKICAgICAgfQogICAgICBjb25zdCB7IHN0YXRzIH0gPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmIChzdGF0cykgewogICAgICAgIHJldHVybiBzdGF0cy5saW5lQ291bnQ7CiAgICAgIH0KICAgICAgcmV0dXJuIC0xOwogICAgfQogICAgYXN5bmMgaW5kZXhDb3YoKSB7CiAgICAgIHJldHVybiBbXTsKICAgIH0KICAgIHBhcnNlQXV4RGF0YShieXRlcywgb2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AgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZGF0YS5yZWZDb3VudDsgaSArPSAxKSB7CiAgICAgICAgYXdhaXQgYWJvcnRCcmVha1BvaW50KG9wdHMuc2lnbmFsKTsKICAgICAgICBjb25zdCBiaW5Db3VudCA9IGJ5dGVzLnJlYWRJbnQzMkxFKGN1cnJPZmZzZXQpOwogICAgICAgIGN1cnJPZmZzZXQgKz0gNDsKICAgICAgICBjb25zdCBiaW5JbmRleCA9IHt9OwogICAgICAgIGxldCBzdGF0czsKICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGJpbkNvdW50OyBqICs9IDEpIHsKICAgICAgICAgIGNvbnN0IGJpbiA9IGJ5dGVzLnJlYWRVSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgIGlmIChiaW4gPiB0aGlzLm1heEJpbk51bWJlcikgewogICAgICAgICAgICBzdGF0cyA9IHRoaXMucGFyc2VQc2V1ZG9CaW4oYnl0ZXMsIGN1cnJPZmZzZXQgKyA0KTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSA0ICsgOCArIDQgKyAxNiArIDE2OwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgY29uc3QgbG9mZnNldCA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCArIDQpOwogICAgICAgICAgICB0aGlzLl9maW5kRmlyc3REYXRhKGRhdGEsIGxvZmZzZXQpOwogICAgICAgICAgICBjb25zdCBjaHVua0NvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCArIDEyKTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNjsKICAgICAgICAgICAgY29uc3QgY2h1bmtzID0gbmV3IEFycmF5KGNodW5rQ291bnQpOwogICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGNodW5rQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgICAgIGNvbnN0IHUgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZz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wgbWF4KTsKICAgICAgY29uc3QgY2h1bmtzID0gW107CiAgICAgIGZvciAoY29uc3QgW3N0YXJ0LCBlbmRdIG9mIG92ZXJsYXBwaW5nQmlucykgewogICAgICAgIGZvciAobGV0IGJpbiA9IHN0YXJ0OyBiaW4gPD0gZW5kOyBiaW4rKykgewogICAgICAgICAgaWYgKGJhLmJpbkluZGV4W2Jpbl0pIHsKICAgICAgICAgICAgY29uc3QgYmluQ2h1bmtzID0gYmEuYmluSW5kZXhbYmluXTsKICAgICAgICAgICAgZm9yIChsZXQgYyA9IDA7IGMgPCBiaW5DaHVua3MubGVuZ3RoOyArK2MpIHsKICAgICAgICAgICAgICBjaHVua3MucHVzaChuZXcgQ2h1bmsoYmluQ2h1bmtzW2NdLm1pbnYsIGJpbkNodW5rc1tjXS5tYXh2LCBiaW4pKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gb3B0aW1pemVDaHVua3MoY2h1bmtzLCBuZXcgVmlydHVhbE9mZnNldCgwLCAwKSk7CiAgICB9CiAgICByZWcyYmlucyhiZWcsIGVuZCkgewogICAgICBiZWcgLT0gMTsKICAgICAgaWYgKGJlZyA8IDEpIHsKICAgICAgICBiZWcgPSAxOwogICAgICB9CiAgICAgIGlmIChlbmQgPiAyICoqIDUwKSB7CiAgICAgICAgZW5kID0gMiAqKiAzNDsKICAgICAgfQogICAgICBlbmQgLT0gMTsKICAgICAgbGV0IGwgPSAwOwogICAgICBsZXQgdCA9IDA7CiAgICAgIGxldCBzID0gdGhpcy5taW5TaGlmdCArIHRoaXMuZGVwdGggKiAzOwogICAgICBjb25zdCBiaW5zID0gW107CiAgICAgIGZvciAoOyBsIDw9IHRoaXMuZGVwdGg7IHMgLT0gMywgdCArPSBsc2hpZnQoMSwgbCAqIDMpLCBsICs9IDEpIHsKICAgICAgICBjb25zdCBiID0gdCArIHJzaGlmdChiZWcsIHMpOwogICAgICAgIGNvbnN0IGUgPSB0ICs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dGhpcy5faWQgPSBmaWxlT2Zmc2V0OwogICAgICB0aGlzLl9yZWZJRCA9IGJ5dGVBcnJheS5yZWFkSW50MzJMRShzdGFydCArIDQpOwogICAgICB0aGlzLmRhdGEuc3RhcnQgPSBieXRlQXJyYXkucmVhZEludDMyTEUoc3RhcnQgKyA4KTsKICAgICAgdGhpcy5mbGFncyA9IChieXRlQXJyYXkucmVhZEludDMyTEUoc3RhcnQgKyAxNikgJiA0Mjk0OTAxNzYwKSA+PiAxNjsKICAgIH0KICAgIGdldChmaWVsZCkgewogICAgICBpZiAodGhpc1tmaWVsZF0pIHsKICAgICAgICBpZiAodGhpcy5kYXRhW2ZpZWxkXSkgewogICAgICAgICAgcmV0dXJuIHRoaXMuZGF0YVtmaWVsZF07CiAgICAgICAgfQogICAgICAgIHRoaXMuZGF0YVtmaWVsZF0gPSB0aGlzW2ZpZWxkXSgpOwogICAgICAgIHJldHVybiB0aGlzLmRhdGFbZmllbGRdOwogICAgICB9CiAgICAgIHJldHVybiB0aGlzLl9nZXQoZmllbGQudG9Mb3dlckNhc2UoKSk7CiAgICB9CiAgICBlbmQoKSB7CiAgICAgIHJldHVybiB0aGlzLmdldCgic3RhcnQiKSArIHRoaXMuZ2V0KCJsZW5ndGhfb25fcmVmIik7CiAgICB9CiAgICBzZXFfaWQoKSB7CiAgICAgIHJldHVybiB0aGlzLl9yZWZJRDsKICAgIH0KICAgIF9nZXQoZmllbGQpIHsKICAgICAgaWYgKGZpZWxkIGluIHRoaXMuZGF0YSkgewogICAgICAgIHJldHVybiB0aGlzLmRhdGFbZmllbGRdOwogICAgICB9CiAgICAgIHRoaXMuZGF0YVtmaWVsZF0gPSB0aGlzLl9wYXJzZVRhZyhmaWVsZCk7CiAgICAgIHJldHVybiB0aGlzLmRhdGFbZmllbGRdOwogICAgfQogICAgX3RhZ3MoKSB7CiAgICAgIHRoaXMuX3BhcnNlQWxsVGFncygpOwogICAgICBsZXQgdGFncyA9IFsic2VxIl07CiAgICAgIGlmICgh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NvbnN0IHR5cGUgPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGJ5dGVBcnJheVtwICsgMl0pOwogICAgICAgIHAgKz0gMzsKICAgICAgICBsZXQgdmFsdWU7CiAgICAgICAgc3dpdGNoICh0eXBlKSB7CiAgICAgICAgICBjYXNlICJBIjoKICAgICAgICAgICAgdmFsdWUgPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGJ5dGVBcnJheVtwXSk7CiAgICAgICAgICAgIHAgKz0gMTsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlICJpIjoKICAgICAgICAgICAgdmFsdWUgPSBieXRlQXJyYXkucmVhZEludDMyTEUocCk7CiAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlICJJIjoKICAgICAgICAgICAgdmFsdWUgPSBieXRlQXJyYXkucmVhZFVJbnQzMkxFKHApOwogICAgICAgICAgICBwICs9IDQ7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgY2FzZSAiYyI6CiAgICAgICAgICAgIHZhbHVlID0gYnl0ZUFycmF5LnJlYWRJbnQ4KHApOwogICAgICAgICAgICBwICs9IDE7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgY2FzZSAiQyI6CiAgICAgICAgICAgIHZhbHVlID0gYnl0ZUFycmF5LnJlYWRVSW50OChwKTsKICAgICAgICAgICAgcCArPSAxOwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGNhc2UgInMiOgogICAgICAgICAgICB2YWx1ZSA9IGJ5dGVBcnJheS5yZWFkSW50MTZMRShwKTsKICAgICAgICAgICAgcCArPSAyOwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGNhc2UgIlMiOgogICAgICAgICAgICB2YWx1ZSA9IGJ5dGVBcnJheS5yZWFkVUludDE2TEUocCk7CiAgICAgICAgICAgIHAgKz0gMjsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlICJmIjoKICAgICAgICAgICAgdmFsdWUgPSBieXRlQXJyYXkucmVhZEZsb2F0TEUocCk7CiAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlICJaIjoKICAgICAgICAgIGNhc2UgIkgiOgogICAgICAgICAgICB2YWx1ZSA9ICIiOwogICAgICAgICAgICB3aGlsZSAocCA8PSBibG9ja0VuZCkgewogICAgICAgICAgICAgIGNvbnN0IGNjID0gYnl0ZUFycmF5W3ArK107CiAgICAgICAgICAgICAgaWYgKGNjID09PSAwKSB7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdmFsdWUgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShjYyk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgY2FzZSAiQiI6IHsKICAgICAgICAgICAgdmFsdWUgPSAiIjsKICAgICAgICAgICAgY29uc3QgY2MgPSBieXRlQXJyYXlbcCsrXTsKICAgICAgICAgICAgY29uc3QgQnR5cGUgPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGNjKTsKICAgICAgICAgICAgY29uc3QgbGltaXQgPSBieXRlQXJyYXkucmVhZEludDMyTEUocCk7CiAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgaWYgKEJ0eXBlID09PSAiaSIpIHsKICAgICAgICAgICAgICBpZiAodGFnID09PSAiQ0ciKSB7CiAgICAgICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGxpbWl0OyBrKyspIHsKICAgICAgICAgICAgICAgICAgY29uc3QgY2lnb3AgPSBieXRlQXJyYXkucmVhZEludDMyTEUocCk7CiAgICAgICAgICAgICAgICAgIGNvbnN0IGxvcCA9IGNpZ29wID4+IDQ7CiAgICAgICAgICAgICAgICAgIGNvbnN0IG9wID0gQ0lHQVJfREVDT0RFUltjaWdvcCAmIDE1XTsKICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gbG9wICsgb3A7CiAgICAgICAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBsaW1pdDsgaysrKSB7CiAgICAgICAgICAgICAgICAgIHZhbHVlICs9IGJ5dGVBcnJheS5yZWFkSW50MzJMRShwKTsKICAgICAgICAgICAgICAgICAgaWYgKGsgKyAxIDwgbGltaXQpIHsKICAgICAgICAgICAgICAgICAgICB2YWx1ZSArPSAiLCI7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgcCArPSA0OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoQnR5cGUgPT09ICJJIikgewogICAgICAgICAgICAgIGlmICh0YWcgPT09ICJDRyIpIHsKICAgICAgICAgICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgbGltaXQ7IGsrKykgewogICAgICAgICAgICAgICAgICBjb25zdCBjaWdvcCA9IGJ5dGVBcnJheS5yZWFkVUludDMyTEUocCk7CiAgICAgICAgICAgICAgICAgIGNvbnN0IGxvcCA9IGNpZ29wID4+IDQ7CiAgICAgICAgICAgICAgICAgIGNvbnN0IG9wID0gQ0lHQVJfREVDT0RFUltjaWdvcCAmIDE1XTsKICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gbG9wICsgb3A7CiAgICAgICAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBsaW1pdDsgaysrKSB7CiAgICAgICAgICAgICAgICAgIHZhbHVlICs9IGJ5dGVBcnJheS5yZWFkVUludDMyTEUocCk7CiAgICAgICAgICAgICAgICAgIGlmIChrICsgMSA8IGxpbWl0KSB7CiAgICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gIiwiOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHAgKz0gNDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKEJ0eXBlID09PSAicyIpIHsKICAgICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGxpbWl0OyBrKyspIHsKICAgICAgICAgICAgICAgIHZhbHVlICs9IGJ5dGVBcnJheS5yZWFkSW50MTZMRShwKTsKICAgICAgICAgICAgICAgIGlmIChrICsgMSA8IGxpbWl0KSB7CiAgICAgICAgICAgICAgICAgIHZhbHVlICs9ICIsIjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHAgKz0gMjsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKEJ0eXBlID09PSAiUyIpIHsKICAgICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGxpbWl0OyBrKyspIHsKICAgICAgICAgICAgICAgIHZhbHVlICs9IGJ5dGVBcnJheS5yZWFkVUludDE2TEUocCk7CiAgICAgICAgICAgICAgICBpZiAoayArIDEgPCBsaW1pdCkgewogICAgICAgICAgICAgICAgICB2YWx1ZSArPSAiLCI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBwICs9IDI7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChCdHlwZSA9PT0gImMiKSB7CiAgICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBsaW1pdDsgaysrKSB7CiAgICAgICAgICAgICAgICB2YWx1ZSArPSBieXRlQXJyYXkucmVhZEludDgocCk7CiAgICAgICAgICAgICAgICBpZiAoayArIDEgPCBsaW1pdCkgewogICAgICAgICAgICAgICAgICB2YWx1ZSArPSAiLCI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBwICs9IDE7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChCdHlwZSA9PT0gIkMiKSB7CiAgICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBsaW1pdDsgaysrKSB7CiAgICAgICAgICAgICAgICB2YWx1ZSArPSBieXRlQXJyYXkucmVhZFVJbnQ4KHApOwogICAgICAgICAgICAgICAgaWYgKGsgKyAxIDwgbGltaXQpIHsKICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gIiwiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcCArPSAxOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoQnR5cGUgPT09ICJmIikgewogICAgICAgICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgbGltaXQ7IGsrKykgewogICAgICAgICAgICAgICAgdmFsdWUgKz0gYnl0ZUFycmF5LnJlYWRGbG9hdExFKHApOwogICAgICAgICAgICAgICAgaWYgKGsgKyAxIDwgbGltaXQpIHsKICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gIiwiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcCArPSA0OwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgIGNvbnNvbGUud2FybihgVW5rbm93biBCQU0gdGFnIHR5cGUgJyR7dHlwZX0nLCB0YWdzIG1heSBiZSBpbmNvbXBsZXRlYCk7CiAgICAgICAgICAgIHZhbHVlID0gdm9pZCAwOwogICAgICAgICAgICBwID0gYmxvY2tFbmQ7CiAgICAgICAgfQogICAgICAgIHRoaXMuX3RhZ09mZnNldCA9IHA7CiAgICAgICAgdGhpcy5fdGFnTGlzdC5wdXNoKHRhZyk7CiAgICAgICAgaWYgKGxjVGFnID09PSB0YWdOYW1lKSB7CiAgICAgICAgICByZXR1cm4gdmFsdWU7CiAgICAgICAgfQogICAgICAgIH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KTsKICAgICAgbGV0IGNpZ2FyID0gIiI7CiAgICAgIGxldCBscmVmID0gMDsKICAgICAgbGV0IGNpZ29wID0gYnl0ZUFycmF5LnJlYWRJbnQzMkxFKHApOwogICAgICBsZXQgbG9wID0gY2lnb3AgPj4gNDsKICAgICAgbGV0IG9wID0gQ0lHQVJfREVDT0RFUltjaWdvcCAmIDE1XTsKICAgICAgaWYgKG9wID09PSAiUyIgJiYgbG9wID09PSBzZXFMZW4pIHsKICAgICAgICBwICs9IDQ7CiAgICAgICAgY2lnb3AgPSBieXRlQXJyYXkucmVhZEludDMyTEUocCk7CiAgICAgICAgbG9wID0gY2lnb3AgPj4gNDsKICAgICAgICBvcCA9IENJR0FSX0RFQ09ERVJbY2lnb3AgJiAxNV07CiAgICAgICAgaWYgKG9wICE9PSAiTiIpIHsKICAgICAgICAgIGNvbnNvbGUud2FybigiQ0cgdGFnIHdpdGggbm8gTiB0YWciKTsKICAgICAgICB9CiAgICAgICAgdGhpcy5kYXRhLmxlbmd0aF9vbl9yZWYgPSBsb3A7CiAgICAgICAgcmV0dXJuIHRoaXMuZ2V0KCJDRyIpOwogICAgICB9IGVsc2UgewogICAgICAgIGZvciAobGV0IGMgPSAwOyBjIDwgbnVtQ2lnYXJPcHM7ICsrYykgewogICAgICAgICAgY2lnb3AgPSBieXRlQXJyYXkucmVhZEludDMyTEUocCk7CiAgICAgICAgICBsb3AgPSBjaWdvcCA+PiA0OwogICAgICAgICAgb3AgPSBDSUdBUl9ERUNPREVSW2NpZ29wICYgMTVdOwogICAgICAgICAgY2lnYXIgKz0gbG9wICsgb3A7CiAgICAgICAgICBpZiAob3AgIT09ICJIIiAmJiBvcCAhPT0gIlMiICYmIG9wICE9PSAiSSIpIHsKICAgICAgICAgICAgbHJlZiArPSBsb3A7CiAgICAgICAgICB9CiAgICAgICAgICBwICs9IDQ7CiAgICAgICAgfQogICAgICAgIHRoaXMuZGF0YS5sZW5ndGhfb25fcmVmID0gbHJlZjsKICAgICAgICByZXR1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Ynl0ZUFycmF5W3AgKyBqXTsKICAgICAgICBidWYgKz0gU0VRUkVUX0RFQ09ERVJbKHNiICYgMjQwKSA+PiA0XTsKICAgICAgICBpKys7CiAgICAgICAgaWYgKGkgPCBsZW4pIHsKICAgICAgICAgIGJ1ZiArPSBTRVFSRVRfREVDT0RFUltzYiAmIDE1XTsKICAgICAgICAgIGkrKzsKICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIGJ1ZjsKICAgIH0KICAgIGdldFBhaXJPcmllbnRhdGlvbigpIHsKICAgICAgaWYgKCF0aGlzLmlzU2VnbWVudFVubWFwcGVkKCkgJiYgIXRoaXMuaXNNYXRlVW5tYXBwZWQoKSAmJiB0aGlzLl9yZWZJRCA9PT0gdGhpcy5fbmV4dF9yZWZpZCgpKSB7CiAgICAgICAgY29uc3QgczEgPSB0aGlzLmlzUmV2ZXJzZUNvbXBsZW1lbnRlZCgpID8gIlIiIDogIkYiOwogICAgICAgIGNvbnN0IHMyID0gdGhpcy5pc01hdGVSZXZlcnNlQ29tcGxlbWVudGVkKCkgPyAiUiIgOiAiRiI7CiAgICAgICAgbGV0IG8xID0gIiAiOwogICAgICAgIGxldCBvMiA9ICIgIjsKICAgICAgICBpZiAodGhpcy5pc1JlYWQxKCkpIHsKICAgICAgICAgIG8xID0gIjEiOwogICAgICAgICAgbzIgPSAiMiI7CiAgICAgICAgfSBlbHNlIGlmICh0aGlzLmlzUmVhZDIoKSkgewogICAgICAgICAgbzEgPSAiMiI7CiAgICAgICAgICBvMiA9ICIxIjsKICAgICAgICB9CiAgICAgICAgY29uc3QgdG1wID0gW107CiAgICAgICAgY29uc3QgaXNpemUgPSB0aGlzLnRlbXBsYXRlX2xlbmd0aCgpOwogICAgICAgIGlmIChpc2l6ZSA+IDApIHsKICAgICAgICAgIHRtcFswXSA9IHMxOwogICAgICAgICAgdG1wWzFdID0gbzE7CiAgICAgICAgICB0bXBbMl0gPSBzMjsKICAgICAgICAgIHRtcFszXSA9IG8yOwogICA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AgICBpZiAoZmVhdHVyZS5zZXFfaWQoKSA9PT0gY2hySWQpIHsKICAgICAgICAgICAgaWYgKGZlYXR1cmUuZ2V0KCJzdGFydCIpID49IG1heCkgewogICAgICAgICAgICAgIGRvbmUgPSB0cnVlOwogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9IGVsc2UgaWYgKGZlYXR1cmUuZ2V0KCJlbmQiKSA+PSBtaW4pIHsKICAgICAgICAgICAgICByZWNzLnB1c2goZmVhdHVyZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZmVhdHMucHVzaChyZWNzKTsKICAgICAgICB5aWVsZCByZWNzOwogICAgICAgIGlmIChkb25lKSB7CiAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgIH0KICAgICAgY2hlY2tBYm9ydFNpZ25hbChvcHRzLnNpZ25hbCk7CiAgICAgIGlmICh2aWV3QXNQYWlycykgewogICAgICAgIHlpZWxkIHRoaXMuZmV0Y2hQYWlycyhjaHJJZCwgZmVhdHMsIG9wdHMpOwogICAgICB9CiAgICB9CiAgICBhc3luYyBmZXRjaFBhaXJzKGNocklkLCBmZWF0cywgb3B0cykgewogICAgICBjb25zdCB7IHBhaXJBY3Jvc3NDaHIgPSBmYWxzZSwgbWF4SW5zZXJ0U2l6ZSA9IDJlNSB9ID0gb3B0czsKICAgICAgY29uc3QgdW5tYXRlZFBhaXJzID0ge307CiAgICAgIGNvbnN0IHJlYWRJZHMgPSB7fTsKICAgICAgZmVhdHMubWFwKChyZXQpID0+IHsKICAgICAgICBjb25zdCByZWFkTmFtZXMgPSB7fTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHJldC5sZW5ndGg7IGkrKykgewogICAgICAgICAgY29uc3QgbmFtZSA9IHJldFtpXS5uYW1lKCk7CiAgICAgICAgICBjb25zdCBpZCA9IHJldFtpXS5pZCgpOwogICAgICAgICAgaWYgKCFyZWFkTmFtZXNbbmFtZV0pIHsKICAgICAgICAgICAgcmVhZE5hbWVzW25hbWVdID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIHJlYWROYW1lc1tuYW1lXSsrOwogICAgICAgICAgcmVhZElkc1tpZF0gPSAxOwogICAgICAgIH0KICAgICAgICAoMCwgaW1wb3J0X29iamVjdC5kZWZhdWx0KShyZWFkTmFtZXMpLmZvckVhY2goKFtrLCB2XSkgPT4gewogICAgICAgICAgaWYgKHYgPT09IDEpIHsKICAgICAgICAgICAgdW5tYXRlZFBhaXJzW2tdID0gdHJ1ZTsKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgfSk7CiAgICAgIGNvbnN0IG1hdGVQcm9taXNlcyA9IFtdOwogICAgICBmZWF0cy5tYXAoKHJldCkgPT4gewogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgcmV0Lmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICBjb25zdCBmID0gcmV0W2ldOwogICAgICAgICAgY29uc3QgbmFtZSA9IGYubmFtZSgpOwogICAgICAgICAgY29uc3Qgc3RhcnQgPSBmLmdldCgic3RhcnQiKTsKICAgICAgICAgIGNvbnN0IHBuZXh0ID0gZi5fbmV4dF9wb3MoKTsKICAgICAgICAgIGNvbnN0IHJuZXh0ID0gZi5fbmV4dF9yZWZpZCgpOwogICAgICAgICAgaWYgKHVubWF0ZWRQYWlyc1tuYW1lXSAmJiAocGFpckFjcm9zc0NociB8fCBybmV4dCA9PT0gY2hySWQgJiYgTWF0aC5hYnMoc3RhcnQgLSBwbmV4dCkgPCBtYXhJbnNlcnRTaXplKSkgewogICAgICAgICAgICBtYXRlUHJvbWlzZXMucHVzaCh0aGlzLmluZGV4LmJsb2Nrc0ZvclJhbmdlKHJuZXh0LCBwbmV4dCwgcG5leHQgKyAxLCBvcHRzKSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9KTsKICAgICAgY29uc3QgbWF0ZUNodW5rcyA9IGZsYXQoYXdhaXQgUHJvbWlzZS5hbGwobWF0ZVByb21p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IGJsb2NrU2l6ZSA9IGJhLnJlYWRJbnQzMkxFKGJsb2NrU3RhcnQpOwogICAgICAgIGNvbnN0IGJsb2NrRW5kID0gYmxvY2tTdGFydCArIDQgKyBibG9ja1NpemUgLSAxOwogICAgICAgIGlmIChkcG9zaXRpb25zKSB7CiAgICAgICAgICB3aGlsZSAoYmxvY2tTdGFydCArIGNodW5rLm1pbnYuZGF0YVBvc2l0aW9uID49IGRwb3NpdGlvbnNbcG9zKytdKSB7CiAgICAgICAgICB9CiAgICAgICAgICBwb3MtLTsKICAgICAgICB9CiAgICAgICAgaWYgKGJsb2NrRW5kIDwgYmEubGVuZ3RoKSB7CiAgICAgICAgICBjb25zdCBmZWF0dXJlID0gbmV3IEJhbVJlY29yZCh7CiAgICAgICAgICAgIGJ5dGVzOiB7CiAgICAgICAgICAgICAgYnl0ZUFycmF5OiBiYSwKICAgICAgICAgICAgICBzdGFydDogYmxvY2tTdGFydCwKICAgICAgICAgICAgICBlbmQ6IGJsb2NrRW5kCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIGZpbGVPZmZzZXQ6IGNwb3NpdGlvbnMgPyBjcG9zaXRpb25zW3Bvc10gKiAoMSA8PCA4KSArIChibG9ja1N0YXJ0IC0gZHBvc2l0aW9uc1twb3NdKSArIGNodW5rLm1pbnYuZGF0YVBvc2l0aW9uICsgMSA6IGltcG9ydF9idWZmZXJfY3JjMzIuZGVmYXVsdC5zaWduZWQoYmEuc2xpY2UoYmxvY2tTdGFydCwgYmxvY2tFbmQpKQogICAgICAgICAgfSk7CiAgICAgICAgICBzaW5rLnB1c2goZmVhdHVyZSk7CiAgICAgICAgICBpZiAodGhpcy55aWVsZFRocmVhZFRpbWUgJiYgK0RhdGUubm93KCkgLSBsYXN0ID4gdGhpcy55aWVsZFRocmVhZFRpbWUpIHsKICAgICAgICAgICAgYXdhaXQgdGltZW91dCgxKTsKICAgICAgICAgICAgbGFzdCA9ICtEYXRlLm5vdygpOwogICAgICAgICAgfQogICAgICAg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GFzKGtleSkpIHsKICAgICAgICByZXR1cm4gIXRoaXMuX2RlbGV0ZUlmRXhwaXJlZChrZXksIHRoaXMuY2FjaGUuZ2V0KGtleSkpOwogICAgICB9CiAgICAgIGlmICh0aGlzLm9sZENhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgcmV0dXJuICF0aGlzLl9kZWxldGVJZkV4cGlyZWQoa2V5LCB0aGlzLm9sZENhY2hlLmdldChrZXkpKTsKICAgICAgfQogICAgICByZXR1cm4gZmFsc2U7CiAgICB9CiAgICBwZWVrKGtleSkgewogICAgICBpZiAodGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgIHJldHVybiB0aGlzLl9wZWVrKGtleSwgdGhpcy5jYWNoZSk7CiAgICAgIH0KICAgICAgaWYgKHRoaXMub2xkQ2FjaGUuaGFzKGtleSkpIHsKICAgICAgICByZXR1cm4gdGhpcy5fcGVlayhrZXksIHRoaXMub2xkQ2FjaGUpOwogICAgICB9CiAgICB9CiAgICBkZWxldGUoa2V5KSB7CiAgICAgIGNvbnN0IGRlbGV0ZWQgPSB0aGlzLmNhY2hlLmRlbGV0ZShrZXkpOwogICAgICBpZiAoZGVsZXRlZCkgewogICAgICAgIHRoaXMuX3NpemUtLTsKICAgICAgfQogICAgICByZXR1cm4gdGhpcy5vbGRDYWNoZS5kZWxldGUoa2V5KSB8fCBkZWxldGVkOwogICAgfQogICAgY2xlYXIoKSB7CiAgICAgIHRoaXMuY2FjaGUuY2xlYXIoKTsKICAgICAgdGhpcy5vbGRDYWNoZS5jbGVhcigpOwogICAgICB0aGlzLl9zaXplID0gMDsKICAgIH0KICAgIHJlc2l6ZShuZXdTaXplKSB7CiAgICAgIGlmICghKG5ld1NpemUgJiYgbmV3U2l6ZSA+IDApKSB7CiAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiYG1heFNpemVgIG11c3QgYmUgYSBudW1iZXIgZ3JlYXRlciB0aGFuIDAiKTsKICAgICAgfQogICAgICBjb25zdCBpdG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pKSB7CiAgICAgIGlmIChsbyA9PSBudWxsKQogICAgICAgIGxvID0gMDsKICAgICAgaWYgKGhpID09IG51bGwpCiAgICAgICAgaGkgPSBhLmxlbmd0aDsKICAgICAgd2hpbGUgKGxvIDwgaGkpIHsKICAgICAgICBjb25zdCBtaWQgPSBsbyArIGhpID4+PiAxOwogICAgICAgIGlmIChjb21wYXJlKGFbbWlkXSwgeCkgPCAwKQogICAgICAgICAgbG8gPSBtaWQgKyAxOwogICAgICAgIGVsc2UKICAgICAgICAgIGhpID0gbWlkOwogICAgICB9CiAgICAgIHJldHVybiBsbzsKICAgIH0KICAgIGZ1bmN0aW9uIHJpZ2h0KGEsIHgsIGxvLCBoaSkgewogICAgICBpZiAobG8gPT0gbnVsbCkKICAgICAgICBsbyA9IDA7CiAgICAgIGlmIChoaSA9PSBudWxsKQogICAgICAgIGhpID0gYS5sZW5ndGg7CiAgICAgIHdoaWxlIChsbyA8IGhpKSB7CiAgICAgICAgY29uc3QgbWlkID0gbG8gKyBoaSA+Pj4gMTsKICAgICAgICBpZiAoY29tcGFyZShhW21pZF0sIHgpID4gMCkKICAgICAgICAgIGhpID0gbWlkOwogICAgICAgIGVsc2UKICAgICAgICAgIGxvID0gbWlkICsgMTsKICAgICAgfQogICAgICByZXR1cm4gbG87CiAgICB9CiAgICBmdW5jdGlvbiBjZW50ZXIoYSwgeCwgbG8sIGhpKSB7CiAgICAgIGlmIChsbyA9PSBudWxsKQogICAgICAgIGxvID0gMDsKICAgICAgaWYgKGhpID09IG51bGwpCiAgICAgICAgaGkgPSBhLmxlbmd0aDsKICAgICAgY29uc3QgaSA9IGxlZnQoYSwgeCwgbG8sIGhpIC0gMSk7CiAgICAgIHJldHVybiBpID4gbG8gJiYgZGVsdGEoYVtpIC0gMV0sIHgpID4gLWRlbHRhKGFbaV0sIHgpID8gaSAtIDEgOiBpOwogICAgfQogICAgcmV0dXJuIHsgbGVmdCwgY2VudGVyLCByaWdodCB9OwogIH0KICBmdW5jdGlvbiB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3RoOyBpKyspIHsKICAgICAgaWYgKG1kU3RyaW5nW2ldLm1hdGNoKC9bMC05XS9nKSkgewogICAgICAgIGN1cnJOdW0gPSBjdXJyTnVtICogMTAgKyArbWRTdHJpbmdbaV07CiAgICAgICAgZGVsZXRpb25FbmNvdW50ZXJlZCA9IGZhbHNlOwogICAgICB9IGVsc2UgaWYgKG1kU3RyaW5nW2ldID09PSAiXiIpIHsKICAgICAgICBkZWxldGlvbkVuY291bnRlcmVkID0gdHJ1ZTsKICAgICAgfSBlbHNlIHsKICAgICAgICBjdXJyUG9zICs9IGN1cnJOdW07CiAgICAgICAgaWYgKHVzZUNvdW50cykgewogICAgICAgICAgc3Vic3RpdHV0aW9ucy5wdXNoKHsKICAgICAgICAgICAgbGVuZ3RoOiBjdXJyTnVtLAogICAgICAgICAgICB0eXBlOiBtZFN0cmluZ1tpXQogICAgICAgICAgfSk7CiAgICAgICAgfSBlbHNlIGlmIChkZWxldGlvbkVuY291bnRlcmVkKSB7CiAgICAgICAgICBiYW1TZXFTaGlmdCAtPSAxOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBzdWJzdGl0dXRpb25zLnB1c2goewogICAgICAgICAgICBwb3M6IGN1cnJQb3MsCiAgICAgICAgICAgIGJhc2U6IG1kU3RyaW5nW2ldLAogICAgICAgICAgICBsZW5ndGg6IDEsCiAgICAgICAgICAgIGJhbVNlcVNoaWZ0CiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgY3Vyck51bSA9IDA7CiAgICAgICAgY3VyclBvcyArPSAxOwogICAgICB9CiAgICB9CiAgICByZXR1cm4gc3Vic3RpdHV0aW9uczsKICB9CiAgZnVuY3Rpb24gZ2V0U3Vic3RpdHV0aW9ucyhzZWdtZW50LCBzZXEpIHsKICAgIGxldCBzdWJzdGl0dXRpb25zID0gW107CiAgICBsZXQgc29mdENsaXBwaW5nQXRSZWFkU3RhcnQgPSBudWxsOwogICAgaWYgKHNlZ21lbnQuY2lnYXIpIHsKICAgICAgY29uc3QgY2lnYXJTdWJzID0gcGFyc2VNRChzZWdtZW50LmNpZ2FyLCB0cnVlKTsKICAgICAgbGV0IGN1cnJQb3MgPSAwOwogICAgICBmb3IgKGNvbnN0IHN1YiBvZiBjaWdhclN1YnMpIHsKICAgICAgICBpZiAoc3ViLnR5cGUgPT09ICJYIikgewogICAgICAgICAgc3Vic3RpdHV0aW9ucy5wdXNoKHsKICAgICAgICAgICAgcG9zOiBjdXJyUG9zLAogICAgICAgICAgICBsZW5ndGg6IHN1Yi5sZW5ndGgsCiAgICAgICAgICAgIHR5cGU6ICJYIgogICAgICAgICAgfSk7CiAgICAgICAgICBjdXJyUG9zICs9IHN1Yi5sZW5ndGg7CiAgICAgICAgfSBlbHNlIGlmIChzdWIudHlwZSA9PT0gIkkiKSB7CiAgICAgICAgICBzdWJzdGl0dXRpb25zLnB1c2goewogICAgICAgICAgICBwb3M6IGN1cnJQb3MsCiAgICAgICAgICAgIGxlbmd0aDogc3ViLmxlbmd0aCwKICAgICAgICAgICAgdHlwZTogIkkiCiAgICAgICAgICB9KTsKICAgICAgICB9IGVsc2UgaWYgKHN1Yi50eXBlID09PSAiRCIpIHsKICAgICAgICAgIHN1YnN0aXR1dGlvbnMucHVzaCh7CiAgICAgICAgICAgIHBvczogY3VyclBvcywKICAgICAgICAgICAgbGVuZ3RoOiBzdWIubGVuZ3RoLAogICAgICAgICAgICB0eXBlOiAiRCIKICAgICAgICAgIH0pOwogICAgICAgICAgY3VyclBvcyArPSBzdWIubGVuZ3RoOwogICAgICAgIH0gZWxzZSBpZiAoc3ViLnR5cGUgPT09ICJOIikgewogICAgICAgICAgc3Vic3RpdHV0aW9ucy5wdXNoKHsKICAgICAgICAgICAgcG9zOiBjdXJyUG9zLAogICAgICAgICAgICBsZW5ndGg6IHN1Yi5sZW5ndGgsCiAgICAgICAgICAgIHR5cGU6ICJOIgogICAgICAgICAgfSk7CiAgICAgICAgICBjdXJyUG9zICs9IHN1Yi5sZW5ndGg7CiAgICAg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ucG9zKSk7CiAgICAgICAgICAgIHRpbGVWYWx1ZXMuc2V0KGAke3VpZH0uJHt6fS4ke3h9YCwgdGlsZVZhbHVlcy5nZXQoYCR7dWlkfS4ke3p9LiR7eH1gKS5jb25jYXQobWFwcGVkUmVjb3JkcykpOwogICAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgICB9KSk7CiAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgIH0KICAgIH0KICAgIHJldHVybiBQcm9taXNlLmFsbChyZWNvcmRQcm9taXNlcykudGhlbigodmFsdWVzKSA9PiB7CiAgICAgIHJldHVybiB2YWx1ZXMuZmxhdCgpOwogICAgfSk7CiAgfTsKICB2YXIgZmV0Y2hUaWxlc0RlYm91bmNlZCA9IGFzeW5jICh1aWQsIHRpbGVJZHMpID0+IHsKICAgIGNvbnN0IHRpbGVzID0ge307CiAgICBjb25zdCB2YWxpZFRpbGVJZHMgPSBbXTsKICAgIGNvbnN0IHRpbGVQcm9taXNlcyA9IFtdOwogICAgZm9yIChjb25zdCB0aWxlSWQgb2YgdGlsZUlkcykgewogICAgICBjb25zdCBwYXJ0cyA9IHRpbGVJZC5zcGxpdCgiLiIpOwogICAgICBjb25zdCB6ID0gcGFyc2VJbnQocGFydHNbMF0sIDEwKTsKICAgICAgY29uc3QgeCA9IHBhcnNlSW50KHBhcnRzWzFdLCAxMCk7CiAgICAgIGlmIChOdW1iZXIuaXNOYU4oeCkgfHwgTnVtYmVyLmlzTmFOKHopKSB7CiAgICAgICAgY29uc29sZS53YXJuKCJJbnZhbGlkIHRpbGUgem9vbSBvciBwb3NpdGlvbjoiLCB6LCB4KTsKICAgICAgICBjb250aW51ZTsKICAgICAgfQogICAgICB2YWxpZFRpbGVJZHMucHVzaCh0aWxlSWQpOwogICAgICB0aWxlUHJvbWlzZXMucHVzaCh0aWxlKHVpZCwgeiwgeCkpOwogICAgfQogICAgcmV0dXJuIFByb21pc2UuYWxsKHRpbGVQcm9taXNlcykudGhlbigodmFsdWVzKSA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WQsIG1hdGVdLnNvcnQoKGEsIGIpID0+ICthLnN0YXJ0IC0gK2Iuc3RhcnQpOwogICAgICAgIGNvbnN0IGluc2VydFNpemUgPSBNYXRoLm1heCgwLCArci5zdGFydCAtICtsLmVuZCk7CiAgICAgICAgY29uc3QgbGFyZ2VJbnNlcnRTaXplID0gaW5zZXJ0U2l6ZSA+PSBtYXhJbnNlcnRTaXplOwogICAgICAgIGxldCBzdlR5cGU7CiAgICAgICAgaWYgKCFsYXJnZUluc2VydFNpemUpIHsKICAgICAgICAgIHN2VHlwZSA9ICJub3JtYWwgcmVhZCI7CiAgICAgICAgfSBlbHNlIGlmIChsLnN0cmFuZCA9PT0gIisiICYmIHIuc3RyYW5kID09PSAiLSIpIHsKICAgICAgICAgIHN2VHlwZSA9ICJkZWxldGlvbiAoKy0pIjsKICAgICAgICB9IGVsc2UgaWYgKGwuc3RyYW5kID09PSAiKyIgJiYgci5zdHJhbmQgPT09ICIrIikgewogICAgICAgICAgc3ZUeXBlID0gImludmVyc2lvbiAoKyspIjsKICAgICAgICB9IGVsc2UgaWYgKGwuc3RyYW5kID09PSAiLSIgJiYgci5zdHJhbmQgPT09ICItIikgewogICAgICAgICAgc3ZUeXBlID0gImludmVyc2lvbiAoLS0pIjsKICAgICAgICB9IGVsc2UgaWYgKGwuc3RyYW5kID09PSAiLSIgJiYgci5zdHJhbmQgPT09ICIrIikgewogICAgICAgICAgc3ZUeXBlID0gImR1cGxpY2F0aW9uICgtKykiOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBzdlR5cGUgPSBgKCR7bC5zdHJhbmR9JHtyLnN0cmFuZH0pYDsKICAgICAgICB9CiAgICAgICAgW3JlYWQsIG1hdGVdLmZvckVhY2goKGQpID0+IHsKICAgICAgICAgIGQuZm91bmRNYXRlID0gdHJ1ZTsKICAgICAgICAgIGQuaW5zZXJ0U2l6ZSA9IGluc2VydFNpemU7CiAgICAgICAgICBkLmxhcmdlSW5zZXJ0U2l6ZSA9IGxhcmd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zdGFydCArIHN1Yi5wb3MgKyBzdWIubGVuZ3RoOwogICAgICAgIGlmIChzZWdtZW50LnN0YXJ0IDwgZG9uICYmIGFjYyA8IHNlZ21lbnQuZW5kKSB7CiAgICAgICAgICBjb25zdCBqID0ganVuY3Rpb25zLmZpbmQoKGQpID0+IGQuc3RhcnQgPT09IGRvbiAmJiBkLmVuZCA9PT0gYWNjKTsKICAgICAgICAgIGlmIChqKSB7CiAgICAgICAgICAgIGouc2NvcmUgKz0gMTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGp1bmN0aW9ucy5wdXNoKHsgc3RhcnQ6IGRvbiwgZW5kOiBhY2MsIHNjb3JlOiAxIH0pOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfSk7CiAgICB9KTsKICAgIHJldHVybiBqdW5jdGlvbnMuZmlsdGVyKChkKSA9PiBkLnNjb3JlID49IG1pbkNvdmVyYWdlKTsKICB9OwogIHZhciB0aWxlRnVuY3Rpb25zID0gewogICAgaW5pdCwKICAgIHRpbGVzZXRJbmZvLAogICAgZmV0Y2hUaWxlc0RlYm91bmNlZCwKICAgIHRpbGUsCiAgICBnZXRUYWJ1bGFyRGF0YQogIH07CiAgZXhwb3NlKHRpbGVGdW5jdGlvbnMpOwp9KSgpOwovKiEKICogVGhlIGJ1ZmZlciBtb2R1bGUgZnJvbSBub2RlLmpzLCBmb3IgdGhlIGJyb3dzZXIuCiAqCiAqIEBhdXRob3IgICBGZXJvc3MgQWJvdWtoYWRpamVoIDxodHRwczovL2Zlcm9zcy5vcmc+CiAqIEBsaWNlbnNlICBNSVQKICovCi8qISBpZWVlNzU0LiBCU0QtMy1DbGF1c2UgTGljZW5zZS4gRmVyb3NzIEFib3VraGFkaWplaCA8aHR0cHM6Ly9mZXJvc3Mub3JnL29wZW5zb3VyY2U+ICovCg=="; -const blob$3 = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs$3)], { type: "text/javascript;charset=utf-8" }); -function Worker$4() { - const objURL = blob$3 && (window.URL || window.webkitURL).createObjectURL(blob$3); - try { - return objURL ? new Worker(objURL) : new Worker("data:application/javascript;base64," + encodedJs$3, { type: "module" }); - } finally { - objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL); - } -} -const DEBOUNCE_TIME$3 = 200; -class BamDataFetcher { - constructor(HGC, config2) { - __publicField(this, "dataConfig", {}); - // required for higlass - __publicField(this, "uid"); - __publicField(this, "fetchTimeout"); - __publicField(this, "toFetch"); - __publicField(this, "MAX_TILE_WIDTH", 2e4); - __publicField(this, "worker"); - // This is set by us but is accessed in `fetchTilesDebounced` - __publicField(this, "track"); - this.uid = HGC.libraries.slugid.nice(); - this.toFetch = /* @__PURE__ */ new Set(); - const { url, indexUrl, assembly, ...options } = config2; - this.worker = spawn(new Worker$4()).then(async (worker) => { - const chromSizes = Object.entries(computeChromSizes(assembly).size); - await worker.init(this.uid, { url, indexUrl }, chromSizes, options); - return worker; - }); - } - /* - * Collect Tileset Information, such as tile size and genomic positions - */ - async tilesetInfo(callback) { - (await this.worker).tilesetInfo(this.uid).then(callback); - } - fetchTilesDebounced(receivedTiles, tileIds) { - var _a; - const { toFetch } = this; - const thisZoomLevel = tileIds[0].split(".")[0]; - const toFetchZoomLevel = toFetch.size ? [...toFetch][0].split(".")[0] : null; - if (thisZoomLevel !== toFetchZoomLevel) { - for (const tileId of this.toFetch) { - (_a = this.track) == null ? void 0 : _a.fetching.delete(tileId); - } - this.toFetch.clear(); - } - tileIds.forEach((x) => this.toFetch.add(x)); - if (this.fetchTimeout) { - clearTimeout(this.fetchTimeout); - } - this.fetchTimeout = setTimeout(() => { - this.sendFetch(receivedTiles, [...this.toFetch]); - this.toFetch.clear(); - }, DEBOUNCE_TIME$3); - } - async sendFetch(receivedTiles, tileIds) { - (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles); - } - async getTabularData(tileIds) { - const buf = await (await this.worker).getTabularData(this.uid, tileIds); - return JSON.parse(new TextDecoder().decode(buf)); - } -} -__publicField(BamDataFetcher, "config", { type: "bam" }); -const encodedJs$2 = "KCgpID0+IHsKICB2YXIgX19jcmVhdGUgPSBPYmplY3QuY3JlYXRlOwogIHZhciBfX2RlZlByb3AgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiAgdmFyIF9fZ2V0T3duUHJvcERlc2MgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOwogIHZhciBfX2dldE93blByb3BOYW1lcyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzOwogIHZhciBfX2dldFByb3RvT2YgPSBPYmplY3QuZ2V0UHJvdG90eXBlT2Y7CiAgdmFyIF9faGFzT3duUHJvcCA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHk7CiAgdmFyIF9fbWFya0FzTW9kdWxlID0gKHRhcmdldCkgPT4gX19kZWZQcm9wKHRhcmdldCwgIl9fZXNNb2R1bGUiLCB7IHZhbHVlOiB0cnVlIH0pOwogIHZhciBfX2VzbSA9IChmbiwgcmVzKSA9PiBmdW5jdGlvbiBfX2luaXQoKSB7CiAgICByZXR1cm4gZm4gJiYgKHJlcyA9ICgwLCBmbltPYmplY3Qua2V5cyhmbilbMF1dKShmbiA9IDApKSwgcmVzOwogIH07CiAgdmFyIF9fY29tbW9uSlMgPSAoY2IsIG1vZCkgPT4gZnVuY3Rpb24gX19yZXF1aXJlKCkgewogICAgcmV0dXJuIG1vZCB8fCAoMCwgY2JbT2JqZWN0LmtleXMoY2IpWzBdXSkoKG1vZCA9IHsgZXhwb3J0czoge30gfSkuZXhwb3J0cywgbW9kKSwgbW9kLmV4cG9ydHM7CiAgfTsKICB2YXIgX19yZUV4cG9ydCA9ICh0YXJnZXQsIG1vZHVsZTIsIGRlc2MpID0+IHsKICAgIGlmIChtb2R1bGUyICYmIHR5cGVvZiBtb2R1bGUyID09PSAib2JqZWN0IiB8fCB0eXBlb2YgbW9kdWxlMiA9PT0gImZ1bmN0aW9uIikgewogICAgICBmb3Ig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IG5CaXRzID0gLTc7CiAgICAgICAgdmFyIGkgPSBpc0xFID8gbkJ5dGVzIC0gMSA6IDA7CiAgICAgICAgdmFyIGQgPSBpc0xFID8gLTEgOiAxOwogICAgICAgIHZhciBzID0gYnVmZmVyW29mZnNldCArIGldOwogICAgICAgIGkgKz0gZDsKICAgICAgICBlID0gcyAmICgxIDw8IC1uQml0cykgLSAxOwogICAgICAgIHMgPj49IC1uQml0czsKICAgICAgICBuQml0cyArPSBlTGVuOwogICAgICAgIGZvciAoOyBuQml0cyA+IDA7IGUgPSBlICogMjU2ICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9IGQsIG5CaXRzIC09IDgpIHsKICAgICAgICB9CiAgICAgICAgbSA9IGUgJiAoMSA8PCAtbkJpdHMpIC0gMTsKICAgICAgICBlID4+PSAtbkJpdHM7CiAgICAgICAgbkJpdHMgKz0gbUxlbjsKICAgICAgICBmb3IgKDsgbkJpdHMgPiAwOyBtID0gbSAqIDI1NiArIGJ1ZmZlcltvZmZzZXQgKyBpXSwgaSArPSBkLCBuQml0cyAtPSA4KSB7CiAgICAgICAgfQogICAgICAgIGlmIChlID09PSAwKSB7CiAgICAgICAgICBlID0gMSAtIGVCaWFzOwogICAgICAgIH0gZWxzZSBpZiAoZSA9PT0gZU1heCkgewogICAgICAgICAgcmV0dXJuIG0gPyBOYU4gOiAocyA/IC0xIDogMSkgKiBJbmZpbml0eTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgbSA9IG0gKyBNYXRoLnBvdygyLCBtTGVuKTsKICAgICAgICAgIGUgPSBlIC0gZUJpYXM7CiAgICAgICAgfQogICAgICAgIHJldHVybiAocyA/IC0xIDogMSkgKiBtICogTWF0aC5wb3coMiwgZSAtIG1MZW4pOwogICAgICB9OwogICAgICBleHBvcnRzMi53cml0ZSA9IGZ1bmN0aW9uKGJ1ZmZlciwgdmFsdWUsIG9mZnNldCwgaXNMRSwgbUxlbiwgbkJ5dGVzKSB7CiAgICAgICAgdmFyIGUsIG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KICAgICAgICAgIH0KICAgICAgICAgIGlmIChlICsgZUJpYXMgPj0gZU1heCkgewogICAgICAgICAgICBtID0gMDsKICAgICAgICAgICAgZSA9IGVNYXg7CiAgICAgICAgICB9IGVsc2UgaWYgKGUgKyBlQmlhcyA+PSAxKSB7CiAgICAgICAgICAgIG0gPSAodmFsdWUgKiBjIC0gMSkgKiBNYXRoLnBvdygyLCBtTGVuKTsKICAgICAgICAgICAgZSA9IGUgKyBlQmlhczsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIG0gPSB2YWx1ZSAqIE1hdGgucG93KDIsIGVCaWFzIC0gMSkgKiBNYXRoLnBvdygyLCBtTGVuKTsKICAgICAgICAgICAgZSA9IDA7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZvciAoOyBtTGVuID49IDg7IGJ1ZmZlcltvZmZzZXQgKyBpXSA9IG0gJiAyNTUsIGkgKz0gZCwgbSAvPSAyNTYsIG1MZW4gLT0gOCkgewogICAgICAgIH0KICAgICAgICBlID0gZSA8PCBtTGVuIHwgbTsKICAgICAgICBlTGVuICs9IG1MZW47CiAgICAgICAgZm9yICg7IGVMZW4gPiAwOyBidWZmZXJbb2Zmc2V0ICsgaV0gPSBlICYgMjU1LCBpICs9IGQsIGUgLz0gMjU2LCBlTGVuIC09IDgpIHsKICAgICAgICB9CiAgICAgICAgYnVmZmVyW29mZnNldCArIGkgLSBkXSB8PSBzICogMTI4OwogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vYnVmZmVyQDYuMC4zL25vZGVfbW9kdWxlcy9idWZmZXIvaW5kZXguanMKICB2YXIgcmVxdWlyZV9idWZmZXIgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vYnVmZmVyQDYuMC4zL25vZGVfbW9kdWxlcy9idWZmZXIvaW5kZXguanMiKGV4cG9ydHMyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICA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VN1cHBvcnQoKSB7CiAgICAgICAgdHJ5IHsKICAgICAgICAgIGNvbnN0IGFyciA9IG5ldyBVaW50OEFycmF5KDEpOwogICAgICAgICAgY29uc3QgcHJvdG8gPSB7IGZvbzogZnVuY3Rpb24oKSB7CiAgICAgICAgICAgIHJldHVybiA0MjsKICAgICAgICAgIH0gfTsKICAgICAgICAgIE9iamVjdC5zZXRQcm90b3R5cGVPZihwcm90bywgVWludDhBcnJheS5wcm90b3R5cGUpOwogICAgICAgICAgT2JqZWN0LnNldFByb3RvdHlwZU9mKGFyciwgcHJvdG8pOwogICAgICAgICAgcmV0dXJuIGFyci5mb28oKSA9PT0gNDI7CiAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgfQogICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoQnVmZmVyMTAucHJvdG90eXBlLCAicGFyZW50IiwgewogICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHsKICAgICAgICAgIGlmICghQnVmZmVyMTAuaXNCdWZmZXIodGhpcykpCiAgICAgICAgICAgIHJldHVybiB2b2lkIDA7CiAgICAgICAgICByZXR1cm4gdGhpcy5idWZmZXI7CiAgICAgICAgfQogICAgICB9KTsKICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KEJ1ZmZlcjEwLnByb3RvdHlwZSwgIm9mZnNldCIsIHsKICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgIGdldDogZnVuY3Rpb24oKSB7CiAgICAgICAgICBpZiAoIUJ1ZmZlcjEwLmlzQnVmZmVyKHRoaXMpKQogICAgICAgICAgICByZXR1cm4gdm9pZCAwOwogICAgICAgICAgcmV0dXJuIHRoaXMuYnl0ZU9mZnNldDsKICAgICAgICB9CiAgICAgIH0pOwogICAgICBmdW5jdGlvbiBjcmVhdGVCdWZmZXIobGVuZ3RoKSB7CiAgICAgICAgaWY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ZmZXIxMC5wcm90b3R5cGUsIFVpbnQ4QXJyYXkucHJvdG90eXBlKTsKICAgICAgT2JqZWN0LnNldFByb3RvdHlwZU9mKEJ1ZmZlcjEwLCBVaW50OEFycmF5KTsKICAgICAgZnVuY3Rpb24gYXNzZXJ0U2l6ZShzaXplKSB7CiAgICAgICAgaWYgKHR5cGVvZiBzaXplICE9PSAibnVtYmVyIikgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignInNpemUiIGFyZ3VtZW50IG11c3QgYmUgb2YgdHlwZSBudW1iZXInKTsKICAgICAgICB9IGVsc2UgaWYgKHNpemUgPCAwKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcignVGhlIHZhbHVlICInICsgc2l6ZSArICciIGlzIGludmFsaWQgZm9yIG9wdGlvbiAic2l6ZSInKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYWxsb2Moc2l6ZSwgZmlsbCwgZW5jb2RpbmcpIHsKICAgICAgICBhc3NlcnRTaXplKHNpemUpOwogICAgICAgIGlmIChzaXplIDw9IDApIHsKICAgICAgICAgIHJldHVybiBjcmVhdGVCdWZmZXIoc2l6ZSk7CiAgICAgICAgfQogICAgICAgIGlmIChmaWxsICE9PSB2b2lkIDApIHsKICAgICAgICAgIHJldHVybiB0eXBlb2YgZW5jb2RpbmcgPT09ICJzdHJpbmciID8gY3JlYXRlQnVmZmVyKHNpemUpLmZpbGwoZmlsbCwgZW5jb2RpbmcpIDogY3JlYXRlQnVmZmVyKHNpemUpLmZpbGwoZmlsbCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBjcmVhdGVCdWZmZXIoc2l6ZSk7CiAgICAgIH0KICAgICAgQnVmZmVyMTAuYWxsb2MgPSBmdW5jdGlvbihzaXplLCBmaWxsLCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBhbGxvYyhzaXplLCBmaWxsLCBlbmNvZGluZyk7CiAgICAgIH07CiAgICAgIGZ1bmN0aW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CBVaW50OEFycmF5KSkKICAgICAgICAgIGEgPSBCdWZmZXIxMC5mcm9tKGEsIGEub2Zmc2V0LCBhLmJ5dGVMZW5ndGgpOwogICAgICAgIGlmIChpc0luc3RhbmNlKGIsIFVpbnQ4QXJyYXkpKQogICAgICAgICAgYiA9IEJ1ZmZlcjEwLmZyb20oYiwgYi5vZmZzZXQsIGIuYnl0ZUxlbmd0aCk7CiAgICAgICAgaWYgKCFCdWZmZXIxMC5pc0J1ZmZlcihhKSB8fCAhQnVmZmVyMTAuaXNCdWZmZXIoYikpIHsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1RoZSAiYnVmMSIsICJidWYyIiBhcmd1bWVudHMgbXVzdCBiZSBvbmUgb2YgdHlwZSBCdWZmZXIgb3IgVWludDhBcnJheScpOwogICAgICAgIH0KICAgICAgICBpZiAoYSA9PT0gYikKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIGxldCB4ID0gYS5sZW5ndGg7CiAgICAgICAgbGV0IHkgPSBiLmxlbmd0aDsKICAgICAgICBmb3IgKGxldCBpID0gMCwgbGVuID0gTWF0aC5taW4oeCwgeSk7IGkgPCBsZW47ICsraSkgewogICAgICAgICAgaWYgKGFbaV0gIT09IGJbaV0pIHsKICAgICAgICAgICAgeCA9IGFbaV07CiAgICAgICAgICAgIHkgPSBiW2ldOwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHggPCB5KQogICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIGlmICh5IDwgeCkKICAgICAgICAgIHJldHVybiAxOwogICAgICAgIHJldHVybiAwOwogICAgICB9OwogICAgICBCdWZmZXIxMC5pc0VuY29kaW5nID0gZnVuY3Rpb24gaXNFbmNvZGluZyhlbmNvZGluZykgewogICAgICAgIHN3aXRjaCAoU3RyaW5nKGVuY29kaW5nKS50b0xvd2VyQ2FzZSgpKSB7CiAgICAgICAgICBjYXNlICJoZXgiOgogICAgICAgICAgY2FzZSAidXRmOCI6CiAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICBjYXNlICJhc2NpaSI6CiAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgY2FzZSAiYmluYXJ5IjoKICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICBjYXNlICJ1Y3MyIjoKICAgICAgICAgIGNhc2UgInVjcy0yIjoKICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgY2FzZSAidXRmLTE2bGUiOgogICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIEJ1ZmZlcjEwLmNvbmNhdCA9IGZ1bmN0aW9uIGNvbmNhdChsaXN0LCBsZW5ndGgpIHsKICAgICAgICBpZiAoIUFycmF5LmlzQXJyYXkobGlzdCkpIHsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJyJsaXN0IiBhcmd1bWVudCBtdXN0IGJlIGFuIEFycmF5IG9mIEJ1ZmZlcnMnKTsKICAgICAgICB9CiAgICAgICAgaWYgKGxpc3QubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICByZXR1cm4gQnVmZmVyMTAuYWxsb2MoMCk7CiAgICAgICAgfQogICAgICAgIGxldCBpOwogICAgICAgIGlmIChsZW5ndGggPT09IHZvaWQgMCkgewogICAgICAgICAgbGVuZ3RoID0gMDsKICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgKytpKSB7CiAgICAgICAgICAgIGxlbmd0aCArPSBsaXN0W2ldLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgY29uc3QgYnVmZmVyID0gQnVmZmVyMTAuYWxsb2NVbnNhZmUobGVuZ3RoKTsKICAgICAgICBsZXQgcG9zID0gMDsKICAgICAgICBmb3IgKGkgPSAw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AgICAgICAgIHJldHVybiBzdHJpbmcuYnl0ZUxlbmd0aDsKICAgICAgICB9CiAgICAgICAgaWYgKHR5cGVvZiBzdHJpbmcgIT09ICJzdHJpbmciKSB7CiAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdUaGUgInN0cmluZyIgYXJndW1lbnQgbXVzdCBiZSBvbmUgb2YgdHlwZSBzdHJpbmcsIEJ1ZmZlciwgb3IgQXJyYXlCdWZmZXIuIFJlY2VpdmVkIHR5cGUgJyArIHR5cGVvZiBzdHJpbmcpOwogICAgICAgIH0KICAgICAgICBjb25zdCBsZW4gPSBzdHJpbmcubGVuZ3RoOwogICAgICAgIGNvbnN0IG11c3RNYXRjaCA9IGFyZ3VtZW50cy5sZW5ndGggPiAyICYmIGFyZ3VtZW50c1syXSA9PT0gdHJ1ZTsKICAgICAgICBpZiAoIW11c3RNYXRjaCAmJiBsZW4gPT09IDApCiAgICAgICAgICByZXR1cm4gMDsKICAgICAgICBsZXQgbG93ZXJlZENhc2UgPSBmYWxzZTsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBsZW47CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhUb0J5dGVzKHN0cmluZykubGVuZ3RoOwogICAgICAgICAgICBjYXNlICJ1Y3MyIjoKICAgICAgICAgICAgY2FzZSAidWNzLTIiOgogICAgICAgICAgICBjYXNlICJ1dGYxNmxlIjoKICAgICAgICAgICAgY2FzZSAidXRmLTE2bGUiOgogICAgICAgICAgICAgIHJldHVybiBsZW4gKiAyOwogICAgICAgICAgICBjYXNlICJoZXgiOgogICAgICAg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ICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICB9CiAgICAgICAgaWYgKCFlbmNvZGluZykKICAgICAgICAgIGVuY29kaW5nID0gInV0ZjgiOwogICAgICAgIHdoaWxlICh0cnVlKSB7CiAgICAgICAgICBzd2l0Y2ggKGVuY29kaW5nKSB7CiAgICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICAgICAgcmV0dXJuIGhleFNsaWNlKHRoaXMsIHN0YXJ0LCBlbmQpOwogICAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgICAgY2FzZSAidXRmLTgiOgogICAgICAgICAgICAgIHJldHVybiB1dGY4U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgImFzY2lpIjoKICAgICAgICAgICAgICByZXR1cm4gYXNjaWlTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAibGF0aW4xIjoKICAgICAgICAgICAgY2FzZSAiYmluYXJ5IjoKICAgICAgICAgICAgICByZXR1cm4gbGF0aW4xU2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICAgICAgcmV0dXJuIGJhc2U2NFNsaWNlKHRoaXMsIHN0YXJ0LCBlbmQpOwogICAgICAgICAgICBjYXNlICJ1Y3MyIjoKICAgICAgICAgICAgY2FzZSAidWNzLTIiOgogICAgICAgICAgICBjYXNlICJ1dGYxNmxlIjoKICAgICAgICAgICAgY2FzZSAidXRmLTE2bGUiOgogICAgICAgICAgICAgIHJldHVybiB1dGYxNmxlU2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgaWYgKGxvd2VyZWRDYXNlKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiVW5rbm93biBlbmNvZGluZzogIiArIGVuY29kaW5nKTsKICAgICAgICAgICAgICBlbmNv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sKICAgICAgICAgIHN3YXAodGhpcywgaSArIDEsIGkgKyAyKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgIH07CiAgICAgIEJ1ZmZlcjEwLnByb3RvdHlwZS5zd2FwNjQgPSBmdW5jdGlvbiBzd2FwNjQoKSB7CiAgICAgICAgY29uc3QgbGVuID0gdGhpcy5sZW5ndGg7CiAgICAgICAgaWYgKGxlbiAlIDggIT09IDApIHsKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJCdWZmZXIgc2l6ZSBtdXN0IGJlIGEgbXVsdGlwbGUgb2YgNjQtYml0cyIpOwogICAgICAgIH0KICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbjsgaSArPSA4KSB7CiAgICAgICAgICBzd2FwKHRoaXMsIGksIGkgKyA3KTsKICAgICAgICAgIHN3YXAodGhpcywgaSArIDEsIGkgKyA2KTsKICAgICAgICAgIHN3YXAodGhpcywgaSArIDIsIGkgKyA1KTsKICAgICAgICAgIHN3YXAodGhpcywgaSArIDMsIGkgKyA0KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgIH07CiAgICAgIEJ1ZmZlcjEwLnByb3RvdHlwZS50b1N0cmluZyA9IGZ1bmN0aW9uIHRvU3RyaW5nKCkgewogICAgICAgIGNvbnN0IGxlbmd0aCA9IHRoaXMubGVuZ3RoOwogICAgICAgIGlmIChsZW5ndGggPT09IDApCiAgICAgICAgICByZXR1cm4gIiI7CiAgICAgICAgaWYgKGFyZ3VtZW50cy5sZW5ndGggPT09IDApCiAgICAgICAgICByZXR1cm4gdXRmOFNsaWNlKHRoaXMsIDAsIGxlbmd0aCk7CiAgICAgICAgcmV0dXJuIHNsb3dUb1N0cmluZy5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUudG9Mb2NhbGVTdHJpbmcgPSBCdWZmZXIxMC5wcm90b3R5cG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VybiAtMTsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0ID49IGVuZCkgewogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIHN0YXJ0ID4+Pj0gMDsKICAgICAgICBlbmQgPj4+PSAwOwogICAgICAgIHRoaXNTdGFydCA+Pj49IDA7CiAgICAgICAgdGhpc0VuZCA+Pj49IDA7CiAgICAgICAgaWYgKHRoaXMgPT09IHRhcmdldCkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIGxldCB4ID0gdGhpc0VuZCAtIHRoaXNTdGFydDsKICAgICAgICBsZXQgeSA9IGVuZCAtIHN0YXJ0OwogICAgICAgIGNvbnN0IGxlbiA9IE1hdGgubWluKHgsIHkpOwogICAgICAgIGNvbnN0IHRoaXNDb3B5ID0gdGhpcy5zbGljZSh0aGlzU3RhcnQsIHRoaXNFbmQpOwogICAgICAgIGNvbnN0IHRhcmdldENvcHkgPSB0YXJnZXQuc2xpY2Uoc3RhcnQsIGVuZCk7CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsZW47ICsraSkgewogICAgICAgICAgaWYgKHRoaXNDb3B5W2ldICE9PSB0YXJnZXRDb3B5W2ldKSB7CiAgICAgICAgICAgIHggPSB0aGlzQ29weVtpXTsKICAgICAgICAgICAgeSA9IHRhcmdldENvcHlbaV07CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoeCA8IHkpCiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHkgPCB4KQogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgcmV0dXJuIDA7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGJpZGlyZWN0aW9uYWxJbmRleE9mKGJ1ZmZlciwgdmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZywgZGlyKSB7CiAgICAgICAgaWYgKGJ1ZmZlci5sZW5ndGggPT09IDApCiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHR5cGVvZiBieXRlT2Zmc2V0ID09PSAic3RyaW5nIikgewogICAgICAgICAgZW5jb2RpbmcgPSBieXRlT2Zmc2V0OwogICAgICAgICAgYnl0ZU9mZnNldCA9IDA7CiAgICAgICAgfSBlbHNlIGlmIChieXRlT2Zmc2V0ID4gMjE0NzQ4MzY0NykgewogICAgICAgICAgYnl0ZU9mZnNldCA9IDIxNDc0ODM2NDc7CiAgICAgICAgfSBlbHNlIGlmIChieXRlT2Zmc2V0IDwgLTIxNDc0ODM2NDgpIHsKICAgICAgICAgIGJ5dGVPZmZzZXQgPSAtMjE0NzQ4MzY0ODsKICAgICAgICB9CiAgICAgICAgYnl0ZU9mZnNldCA9ICtieXRlT2Zmc2V0OwogICAgICAgIGlmIChudW1iZXJJc05hTihieXRlT2Zmc2V0KSkgewogICAgICAgICAgYnl0ZU9mZnNldCA9IGRpciA/IDAgOiBidWZmZXIubGVuZ3RoIC0gMTsKICAgICAgICB9CiAgICAgICAgaWYgKGJ5dGVPZmZzZXQgPCAwKQogICAgICAgICAgYnl0ZU9mZnNldCA9IGJ1ZmZlci5sZW5ndGggKyBieXRlT2Zmc2V0OwogICAgICAgIGlmIChieXRlT2Zmc2V0ID49IGJ1ZmZlci5sZW5ndGgpIHsKICAgICAgICAgIGlmIChkaXIpCiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgIGVsc2UKICAgICAgICAgICAgYnl0ZU9mZnNldCA9IGJ1ZmZlci5sZW5ndGggLSAxOwogICAgICAgIH0gZWxzZSBpZiAoYnl0ZU9mZnNldCA8IDApIHsKICAgICAgICAgIGlmIChkaXIpCiAgICAgICAgICAgIGJ5dGVPZmZzZXQgPSAwOwogICAgICAgICAgZWxzZQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAic3RyaW5nIikgewogICAgICAgICAgdmFsID0gQnVmZmVyMTAuZnJvbSh2YWwsIGVuY29k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uZ3RoID0gYXJyLmxlbmd0aDsKICAgICAgICBsZXQgdmFsTGVuZ3RoID0gdmFsLmxlbmd0aDsKICAgICAgICBpZiAoZW5jb2RpbmcgIT09IHZvaWQgMCkgewogICAgICAgICAgZW5jb2RpbmcgPSBTdHJpbmcoZW5jb2RpbmcpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICBpZiAoZW5jb2RpbmcgPT09ICJ1Y3MyIiB8fCBlbmNvZGluZyA9PT0gInVjcy0yIiB8fCBlbmNvZGluZyA9PT0gInV0ZjE2bGUiIHx8IGVuY29kaW5nID09PSAidXRmLTE2bGUiKSB7CiAgICAgICAgICAgIGlmIChhcnIubGVuZ3RoIDwgMiB8fCB2YWwubGVuZ3RoIDwgMikgewogICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpbmRleFNpemUgPSAyOwogICAgICAgICAgICBhcnJMZW5ndGggLz0gMjsKICAgICAgICAgICAgdmFsTGVuZ3RoIC89IDI7CiAgICAgICAgICAgIGJ5dGVPZmZzZXQgLz0gMjsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcmVhZChidWYsIGkyKSB7CiAgICAgICAgICBpZiAoaW5kZXhTaXplID09PSAxKSB7CiAgICAgICAgICAgIHJldHVybiBidWZbaTJdOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIGJ1Zi5yZWFkVUludDE2QkUoaTIgKiBpbmRleFNpemUpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBsZXQgaTsKICAgICAgICBpZiAoZGlyKSB7CiAgICAgICAgICBsZXQgZm91bmRJbmRleCA9IC0xOwogICAgICAgICAgZm9yIChpID0gYnl0ZU9mZnNldDsgaSA8IGFyckxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIGlmIChyZWFkKGFyciwgaSkgPT09IHJlYWQodmFsLCBmb3VuZEluZGV4ID09PSAtMSA/IDAgOiBpIC0gZm91bmRJbmRleCkpIHsKICAgICAgICAgICAgICBpZiAoZm91bmRJbmRleCA9PT0gLTEpCiAgICAgICAgICAgICAgICBmb3VuZEluZGV4ID0gaTsKICAgICAgICAgICAgICBpZiAoaSAtIGZvdW5kSW5kZXggKyAxID09PSB2YWxMZW5ndGgpCiAgICAgICAgICAgICAgICByZXR1cm4gZm91bmRJbmRleCAqIGluZGV4U2l6ZTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBpZiAoZm91bmRJbmRleCAhPT0gLTEpCiAgICAgICAgICAgICAgICBpIC09IGkgLSBmb3VuZEluZGV4OwogICAgICAgICAgICAgIGZvdW5kSW5kZXggPSAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAoYnl0ZU9mZnNldCArIHZhbExlbmd0aCA+IGFyckxlbmd0aCkKICAgICAgICAgICAgYnl0ZU9mZnNldCA9IGFyckxlbmd0aCAtIHZhbExlbmd0aDsKICAgICAgICAgIGZvciAoaSA9IGJ5dGVPZmZzZXQ7IGkgPj0gMDsgaS0tKSB7CiAgICAgICAgICAgIGxldCBmb3VuZCA9IHRydWU7CiAgICAgICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgdmFsTGVuZ3RoOyBqKyspIHsKICAgICAgICAgICAgICBpZiAocmVhZChhcnIsIGkgKyBqKSAhPT0gcmVhZCh2YWwsIGopKSB7CiAgICAgICAgICAgICAgICBmb3VuZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChmb3VuZCkKICAgICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIC0xOwogICAgICB9CiAgICAgIEJ1ZmZlcjEwLnByb3RvdHlwZS5pbmNsdWRlcyA9IGZ1bmN0aW9uIGluY2x1ZGVzKHZhbCwgYnl0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aW5nLCBvZmZzZXQsIGxlbmd0aCk7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIHVjczJXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgICAgIGVuY29kaW5nID0gKCIiICsgZW5jb2RpbmcpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgbG93ZXJlZENhc2UgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnRvSlNPTiA9IGZ1bmN0aW9uIHRvSlNPTigpIHsKICAgICAgICByZXR1cm4gewogICAgICAgICAgdHlwZTogIkJ1ZmZlciIsCiAgICAgICAgICBkYXRhOiBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbCh0aGlzLl9hcnIgfHwgdGhpcywgMCkKICAgICAgICB9OwogICAgICB9OwogICAgICBmdW5jdGlvbiBiYXNlNjRTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBpZiAoc3RhcnQgPT09IDAgJiYgZW5kID09PSBidWYubGVuZ3RoKSB7CiAgICAgICAgICByZXR1cm4gYmFzZTY0LmZyb21CeXRlQXJyYXkoYnVmKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgcmV0dXJuIGJhc2U2NC5mcm9tQnl0ZUFycmF5KGJ1Zi5zbGljZShzdGFydCwgZW5kKSk7CiAgICAgICAgfQogICAgICB9CiAgICAgIG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ID4gMTI3KSB7CiAgICAgICAgICAgICAgICAgICAgY29kZVBvaW50ID0gdGVtcENvZGVQb2ludDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgc2Vjb25kQnl0ZSA9IGJ1ZltpICsgMV07CiAgICAgICAgICAgICAgICB0aGlyZEJ5dGUgPSBidWZbaSArIDJdOwogICAgICAgICAgICAgICAgaWYgKChzZWNvbmRCeXRlICYgMTkyKSA9PT0gMTI4ICYmICh0aGlyZEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAxNSkgPDwgMTIgfCAoc2Vjb25kQnl0ZSAmIDYzKSA8PCA2IHwgdGhpcmRCeXRlICYgNjM7CiAgICAgICAgICAgICAgICAgIGlmICh0ZW1wQ29kZVBvaW50ID4gMjA0NyAmJiAodGVtcENvZGVQb2ludCA8IDU1Mjk2IHx8IHRlbXBDb2RlUG9pbnQgPiA1NzM0MykpIHsKICAgICAgICAgICAgICAgICAgICBjb2RlUG9pbnQgPSB0ZW1wQ29kZVBvaW50OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIDQ6CiAgICAgICAgICAgICAgICBzZWNvbmRCeXRlID0gYnVmW2kgKyAxXTsKICAgICAgICAgICAgICAgIHRoaXJkQnl0ZSA9IGJ1ZltpICsgMl07CiAgICAgICAgICAgICAgICBmb3VydGhCeXRlID0gYnVmW2kgKyAzXTsKICAgICAgICAgICAgICAgIGlmICgoc2Vjb25kQnl0ZSAmIDE5MikgPT09IDEyOCAmJiAodGhpcmRCeXRlICYgMTkyKSA9PT0gMTI4ICYmIChmb3VydGhCeXRlICYgMTkyKSA9PT0gMTI4KSB7CiAgICAgICAgICAgICAgICAgIHRlbXBDb2RlUG9pbnQgPSAoZmlyc3RCeXRlICYgMTUpIDw8IDE4IHwgKHNlY29uZEJ5dGUgJiA2MykgPDwgMTIgfCAodGhpcmRCeXRlICYgNjMpIDw8IDYgfCBmb3VydGhCeXRlICYgNjM7CiAgICAgICAgICAgICAgICAgIGlmICh0ZW1wQ29kZVBvaW50ID4gNjU1MzUgJiYgdGVtcENvZGVQb2ludCA8IDExMTQxMTIpIHsKICAgICAgICAgICAgICAgICAgICBjb2RlUG9pbnQgPSB0ZW1wQ29kZVBvaW50OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChjb2RlUG9pbnQgPT09IG51bGwpIHsKICAgICAgICAgICAgY29kZVBvaW50ID0gNjU1MzM7CiAgICAgICAgICAgIGJ5dGVzUGVyU2VxdWVuY2UgPSAxOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPiA2NTUzNSkgewogICAgICAgICAgICBjb2RlUG9pbnQgLT0gNjU1MzY7CiAgICAgICAgICAgIHJlcy5wdXNoKGNvZGVQb2ludCA+Pj4gMTAgJiAxMDIzIHwgNTUyOTYpOwogICAgICAgICAgICBjb2RlUG9pbnQgPSA1NjMyMCB8IGNvZGVQb2ludCAmIDEwMjM7CiAgICAgICAgICB9CiAgICAgICAgICByZXMucHVzaChjb2RlUG9pbnQpOwogICAgICAgICAgaSArPSBieXRlc1BlclNlcXVlbmNlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gZGVjb2RlQ29kZVBvaW50c0FycmF5KHJlcyk7CiAgICAgIH0KICAgICAgdmFyIE1BWF9BUkdVTUVOVFNfTEVOR1RIID0gNDA5NjsKICAgICAgZnVuY3Rpb24gZGVjb2RlQ29kZVBvaW50c0FycmF5KGNvZGVQb2ludHMpIHsKICAgICAgICBjb25zdCBsZW4gPSBjb2RlUG9pbnRzLmxlbmd0aDsKICAgICAgICB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9mIGJvdW5kcyIpOwogICAgICAgIGlmIChlbmQgPiB0aGlzLmxlbmd0aCkKICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgIGlmICh0YXJnZXQubGVuZ3RoIC0gdGFyZ2V0U3RhcnQgPCBlbmQgLSBzdGFydCkgewogICAgICAgICAgZW5kID0gdGFyZ2V0Lmxlbmd0aCAtIHRhcmdldFN0YXJ0ICsgc3RhcnQ7CiAgICAgICAgfQogICAgICAgIGNvbnN0IGxlbiA9IGVuZCAtIHN0YXJ0OwogICAgICAgIGlmICh0aGlzID09PSB0YXJnZXQgJiYgdHlwZW9mIFVpbnQ4QXJyYXkucHJvdG90eXBlLmNvcHlXaXRoaW4gPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgIHRoaXMuY29weVdpdGhpbih0YXJnZXRTdGFydCwgc3RhcnQsIGVuZCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIFVpbnQ4QXJyYXkucHJvdG90eXBlLnNldC5jYWxsKHRhcmdldCwgdGhpcy5zdWJhcnJheShzdGFydCwgZW5kKSwgdGFyZ2V0U3RhcnQpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gbGVuOwogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUuZmlsbCA9IGZ1bmN0aW9uIGZpbGwodmFsLCBzdGFydCwgZW5kLCBlbmNvZGluZykgewogICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAic3RyaW5nIikgewogICAgICAgICAgaWYgKHR5cGVvZiBzdGFydCA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgZW5jb2RpbmcgPSBzdGFydDsKICAgICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgICAgICBlbmQgPSB0aGlzLmxlbmd0aDsKICAgICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIGVuZCA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgZW5jb2RpbmcgPSBlbmQ7CiAgICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGVuY29kaW5nICE9PSB2b2lkIDAgJiYgdHlwZW9mIGVuY29kaW5nICE9PSAic3RyaW5nIikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJlbmNvZGluZyBtdXN0IGJlIGEgc3RyaW5nIik7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodHlwZW9mIGVuY29kaW5nID09PSAic3RyaW5nIiAmJiAhQnVmZmVyMTAuaXNFbmNvZGluZyhlbmNvZGluZykpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiVW5rbm93biBlbmNvZGluZzogIiArIGVuY29kaW5nKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh2YWwubGVuZ3RoID09PSAxKSB7CiAgICAgICAgICAgIGNvbnN0IGNvZGUgPSB2YWwuY2hhckNvZGVBdCgwKTsKICAgICAgICAgICAgaWYgKGVuY29kaW5nID09PSAidXRmOCIgJiYgY29kZSA8IDEyOCB8fCBlbmNvZGluZyA9PT0gImxhdGluMSIpIHsKICAgICAgICAgICAgICB2YWwgPSBjb2RlOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgdmFsID0gdmFsICYgMjU1OwogICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIHZhbCA9PT0gImJvb2xlYW4iKSB7CiAgICAgICAgICB2YWwgPSBOdW1iZXIodmFsKTsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXJ0IDwgMCB8fCB0aGlzLmxlbmd0aCA8IHN0YXJ0IHx8IHRoaXMubGVuZ3RoIDwgZW5kKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigiT3V0IG9mIHJhbmdlIGluZGV4Iik7CiAgICAgICAgfQogICAgICAgIGlmIChlbmQgPD0gc3RhcnQpIHsKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIH0KICAgICAgICBzdGFydCA9IHN0YXJ0ID4+PiAwOwogICAgICAgIGVuZCA9IGVuZCA9PT0gdm9pZCAwID8gdGhpcy5sZW5ndGggOiBlbmQgPj4+IDA7CiAgICAgICAgaWYgKCF2YWwpCiAgICAgICAgICB2YWwgPSAwOwogICAgICAgIGxldCBpOwogICAgICAgIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgZm9yIChpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgICB0aGlzW2ldID0gdmFsOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBjb25zdCBieXRlcyA9IEJ1ZmZlcjEwLmlzQnVmZmVyKHZhbCkgPyB2YWwgOiBCdWZmZXIxMC5mcm9tKHZhbCwgZW5jb2RpbmcpOwogICAgICAgICAgY29uc3QgbGVuID0gYnl0ZXMubGVuZ3RoOwogICAgICAgICAgaWYgKGxlbiA9PT0gMCkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdUaGUgdmFsdWUgIicgKyB2YWwgKyAnIiBpcyBpbnZhbGlkIGZvciBhcmd1bWVudCAidmFsdWUiJyk7CiAgICAgICAgICB9CiAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgZW5kIC0gc3RhcnQ7ICsraSkgewogICAgICAgICAgICB0aGlzW2kgKyBzdGFydF0gPSBieXRlc1tpICUgbGVuXTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgIH07CiAgICAgIHZhciBlcnJvcnMgPSB7fTsKICAgICAgZnVuY3Rpb24gRShzeW0sIGdldE1lc3NhZ2UsIEJhc2UpIHsKICAgICAgICBlcnJvcnNbc3ltXSA9IGNsYXNzIE5vZGVFcnJvciBleHRlbmRzIEJhc2UgewogICAgICAgICAgY29uc3RydWN0b3IoKSB7CiAgICAgICAgICAgIHN1cGVyKCk7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCAibWVzc2FnZSIsIHsKICAgICAgICAgICAgICB2YWx1ZTogZ2V0TWVzc2FnZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpLAogICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlLAogICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgdGhpcy5uYW1lID0gYCR7dGhpcy5uYW1lfSBbJHtzeW19XWA7CiAgICAgICAgICAgIHRoaXMuc3RhY2s7CiAgICAgICAgICAgIGRlbGV0ZSB0aGlzLm5hbWU7CiAgICAgICAgICB9CiAgICAgICAgICBnZXQgY29kZSgpIHsKICAgICAgICAgICAgcmV0dXJuIHN5bTsKICAgICAgICAgIH0KICAgICAgICAgIHNldCBjb2RlKHZhbHVlKSB7CiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCAiY29kZSIsIHsKICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICB2YWx1ZSwKICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICAgIHRvU3RyaW5nKCkgewogICAgICAgICAgICByZXR1cm4gYCR7dGhpcy5uYW1lfSBbJHtzeW19XTogJHt0aGlzLm1lc3NhZ2V9YDsKICAgICAgICAgIH0KICAgICAgICB9OwogICAgICB9CiAgICAgIEUoIkVSUl9CVUZGRVJfT1VUX09GX0JPVU5EUyIsIGZ1bmN0aW9uKG5hbWUpIHsKICAgICAgICBpZiAobmFtZSkgewogICAgICAgICAgcmV0dXJuIGAke25hbWV9IGlzIG91dHNpZGUgb2YgYnVmZmVyIGJvdW5kc2A7CiAgICAgICAgfQogICAgICAgIHJldHVybiAiQXR0Z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ewogICAgICAgICAgY29kZVBvaW50ID0gc3RyaW5nLmNoYXJDb2RlQXQoaSk7CiAgICAgICAgICBpZiAoY29kZVBvaW50ID4gNTUyOTUgJiYgY29kZVBvaW50IDwgNTczNDQpIHsKICAgICAgICAgICAgaWYgKCFsZWFkU3Vycm9nYXRlKSB7CiAgICAgICAgICAgICAgaWYgKGNvZGVQb2ludCA+IDU2MzE5KSB7CiAgICAgICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpCiAgICAgICAgICAgICAgICAgIGJ5dGVzLnB1c2goMjM5LCAxOTEsIDE4OSk7CiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICB9IGVsc2UgaWYgKGkgKyAxID09PSBsZW5ndGgpIHsKICAgICAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkKICAgICAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50OwogICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChjb2RlUG9pbnQgPCA1NjMyMCkgewogICAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkKICAgICAgICAgICAgICAgIGJ5dGVzLnB1c2goMjM5LCAxOTEsIDE4OSk7CiAgICAgICAgICAgICAgbGVhZFN1cnJvZ2F0ZSA9IGNvZGVQb2ludDsKICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjb2RlUG9pbnQgPSAobGVhZFN1cnJvZ2F0ZSAtIDU1Mjk2IDw8IDEwIHwgY29kZVBvaW50IC0gNTYzMjApICsgNjU1MzY7CiAgICAgICAgICB9IGVsc2UgaWYgKGxlYWRTdXJyb2dhdGUpIHsKICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgIGJ5dGVzLnB1c2goMjM5LCAxOTEsIDE4OSk7CiAgICAgICAgICB9CiAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gbnVsbDsKICAgICAgICAgIGlmIChjb2RlUG9pbnQgPCAxMjgpIHsKICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAxKSA8IDApCiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIGJ5dGVzLnB1c2goY29kZVBvaW50KTsKICAgICAgICAgIH0gZWxzZSBpZiAoY29kZVBvaW50IDwgMjA0OCkgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDIpIDwgMCkKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgYnl0ZXMucHVzaChjb2RlUG9pbnQgPj4gNiB8IDE5MiwgY29kZVBvaW50ICYgNjMgfCAxMjgpOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPCA2NTUzNikgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpIDwgMCkKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgYnl0ZXMucHVzaChjb2RlUG9pbnQgPj4gMTIgfCAyMjQsIGNvZGVQb2ludCA+PiA2ICYgNjMgfCAxMjgsIGNvZGVQb2ludCAmIDYzIHwgMTI4KTsKICAgICAgICAgIH0gZWxzZSBpZiAoY29kZVBvaW50IDwgMTExNDExMikgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDQpIDwgMCkKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgYnl0ZXMucHVzaChjb2RlUG9pbnQgPj4gMTggfCAyNDAsIGNvZGVQb2ludCA+PiAxMiAmIDYzIHwgMTI4LCBjb2RlUG9pbnQgPj4gNiAmIDYzIHwgMTI4LCBjb2RlUG9pbnQgJiA2MyB8IDEyOCk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgY29kZSBwb2ludCIpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gYnl0ZXM7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYXNjaWlUb0J5dGVzKHN0cikgewogICAgICAgIGNvbnN0IGJ5dGVBcnJheSA9IFtdOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgKytpKSB7CiAgICAgICAgICBieXRlQXJyYXkucHVzaChzdHIuY2hhckNvZGVBdChpKSAmIDI1NSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBieXRlQXJyYXk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdXRmMTZsZVRvQnl0ZXMoc3RyLCB1bml0cykgewogICAgICAgIGxldCBjLCBoaSwgbG87CiAgICAgICAgY29uc3QgYnl0ZUFycmF5ID0gW107CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBzdHIubGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGlmICgodW5pdHMgLT0gMikgPCAwKQogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGMgPSBzdHIuY2hhckNvZGVBdChpKTsKICAgICAgICAgIGhpID0gYyA+PiA4OwogICAgICAgICAgbG8gPSBjICUgMjU2OwogICAgICAgICAgYnl0ZUFycmF5LnB1c2gobG8pOwogICAgICAgICAgYnl0ZUFycmF5LnB1c2goaGkpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gYnl0ZUFycmF5OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJhc2U2NFRvQnl0ZXMoc3RyKSB7CiAgICAgICAgcmV0dXJuIGJhc2U2NC50b0J5dGVBcnJheShiYXNlNjRjbGVhbihzdHIpKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBibGl0QnVmZmVyKHNyYywgZHN0LCBvZmZzZXQsIGxlbmd0aCkgewogICAgICAgIGxldCBpOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW5ndGg7ICsraSkgewogICAgICAgICAgaWYgKGkgKyBvZmZzZXQgPj0gZHN0Lmxlbmd0aCB8fCBpID49IHNyYy5sZW5ndGgpCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgZHN0W2kgKyBvZmZzZXRdID0gc3JjW2ldOwogICAgICAgIH0KICAgICAgICByZXR1cm4gaTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpc0luc3RhbmNlKG9iaiwgdHlwZSkgewogICAgICAgIHJldHVybiBvYmogaW5zdGFuY2VvZiB0eXBlIHx8IG9iaiAhPSBudWxsICYmIG9iai5jb25zdHJ1Y3RvciAhPSBudWxsICYmIG9iai5jb25zdHJ1Y3Rvci5uYW1lICE9IG51bGwgJiYgb2JqLmNvbnN0cnVjdG9yLm5hbWUgPT09IHR5cGUubmFtZTsKICAgICAgfQogICAgICBmdW5jdGlvbiBudW1iZXJJc05hTihvYmopIHsKICAgICAgICByZXR1cm4gb2JqICE9PSBvYmo7CiAgICAgIH0KICAgICAgdmFyIGhleFNsaWNlTG9va3VwVGFibGUgPSBmdW5jdGlvbigpIHsKICAgICAgICBjb25zdCBhbHBoYWJldCA9ICIwMTIzNDU2Nzg5YWJjZGVmIjsKICAgICAgICBjb25zdCB0YWJsZSA9IG5ldyBBcnJheSgyNTYpOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgMTY7ICsraSkgewogICAgICAgICAgY29uc3QgaTE2ID0gaSAqIDE2OwogICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCAxNjsgKytqKSB7CiAgICAgICAgICAgIHRhYmxlW2kxNiArIGpdID0gYWxwaGFiZXRbaV0gKyBhbHBoYWJldFtqXTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRhYmxlOwogICAgICB9KCk7CiAgICAgIGZ1bmN0aW9uIGRlZmluZUJpZ0ludE1ldGhvZChmbikgewogICAgICAgIHJldHVybiB0eXBlb2YgQmlnSW50ID09PSAidW5kZWZpbmVkIiA/IEJ1ZmZlckJpZ0ludE5vdERlZmlu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B9OwogICAgICAgIHJldHVybiBfZ2V0UHJvdG90eXBlT2Yobyk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX3NldFByb3RvdHlwZU9mKG8sIHApIHsKICAgICAgICBfc2V0UHJvdG90eXBlT2YgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgPyBPYmplY3Quc2V0UHJvdG90eXBlT2YuYmluZCgpIDogZnVuY3Rpb24gX3NldFByb3RvdHlwZU9mMihvMiwgcDIpIHsKICAgICAgICAgIG8yLl9fcHJvdG9fXyA9IHAyOwogICAgICAgICAgcmV0dXJuIG8yOwogICAgICAgIH07CiAgICAgICAgcmV0dXJuIF9zZXRQcm90b3R5cGVPZihvLCBwKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfaXNOYXRpdmVSZWZsZWN0Q29uc3RydWN0KCkgewogICAgICAgIGlmICh0eXBlb2YgUmVmbGVjdCA9PT0gInVuZGVmaW5lZCIgfHwgIVJlZmxlY3QuY29uc3RydWN0KQogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIGlmIChSZWZsZWN0LmNvbnN0cnVjdC5zaGFtKQogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIGlmICh0eXBlb2YgUHJveHkgPT09ICJmdW5jdGlvbiIpCiAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICB0cnkgewogICAgICAgICAgQm9vbGVhbi5wcm90b3R5cGUudmFsdWVPZi5jYWxsKFJlZmxlY3QuY29uc3RydWN0KEJvb2xlYW4sIFtdLCBmdW5jdGlvbigpIHsKICAgICAgICAgIH0pKTsKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX2Fzc2VydFRoaXNJbml0aWFsaXplZChzZWxmMikgewogICAgICAgIGlmIChzZWxmMiA9PT0gdm9pZCAwKSB7CiAgICAgICAg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J1Y3QoU3VwZXIsIGFyZ3VtZW50cywgTmV3VGFyZ2V0KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJlc3VsdCA9IFN1cGVyLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gX3Bvc3NpYmxlQ29uc3RydWN0b3JSZXR1cm4odGhpcywgcmVzdWx0KTsKICAgICAgICB9OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9zdXBlclByb3BCYXNlKG9iamVjdCwgcHJvcGVydHkpIHsKICAgICAgICB3aGlsZSAoIU9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChvYmplY3QsIHByb3BlcnR5KSkgewogICAgICAgICAgb2JqZWN0ID0gX2dldFByb3RvdHlwZU9mKG9iamVjdCk7CiAgICAgICAgICBpZiAob2JqZWN0ID09PSBudWxsKQogICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG9iamVjdDsKICAgICAgfQogICAgICBmdW5jdGlvbiBfZ2V0KCkgewogICAgICAgIGlmICh0eXBlb2YgUmVmbGVjdCAhPT0gInVuZGVmaW5lZCIgJiYgUmVmbGVjdC5nZXQpIHsKICAgICAgICAgIF9nZXQgPSBSZWZsZWN0LmdldC5iaW5kKCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIF9nZXQgPSBmdW5jdGlvbiBfZ2V0Mih0YXJnZXQsIHByb3BlcnR5LCByZWNlaXZlcikgewogICAgICAgICAgICB2YXIgYmFzZSA9IF9zdXBlclByb3BCYXNlKHRhcmdldCwgcHJvcGVydHkpOwogICAgICAgICAgICBpZiAoIWJhc2UpCiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB2YXIgZGVzYyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoYmFzZSwgcHJvcGVydHkpOwogICAgICAgICAgICBpZiAoZGVzYy5nZXQpIHsKICAgICAgICAgICAgICByZXR1cm4gZGVzYy5nZXQuY2FsbChhcmd1bWVudHMubGVuZ3RoIDwgMyA/IHRhcmdldCA6IHJlY2VpdmVyKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gZGVzYy52YWx1ZTsKICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIHJldHVybiBfZ2V0LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7CiAgICAgIH0KICAgICAgdmFyIEVtaXR0ZXIgPSAvKiBAX19QVVJFX18gKi8gZnVuY3Rpb24oKSB7CiAgICAgICAgZnVuY3Rpb24gRW1pdHRlcjIoKSB7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgRW1pdHRlcjIpOwogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJsaXN0ZW5lcnMiLCB7CiAgICAgICAgICAgIHZhbHVlOiB7fSwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhFbWl0dGVyMiwgW3sKICAgICAgICAgIGtleTogImFkZEV2ZW50TGlzdGVuZXIiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGFkZEV2ZW50TGlzdGVuZXIodHlwZSwgY2FsbGJhY2ssIG9wdGlvbnMpIHsKICAgICAgICAgICAgaWYgKCEodHlwZSBpbiB0aGlzLmxpc3RlbmVycykpIHsKICAgICAgICAgICAgICB0aGlzLmxpc3RlbmVyc1t0eXBlXSA9IFtdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMubGlzdGVuZXJzW3R5cGVdLnB1c2goewogICAgICAgICAgICAgIGNhbGxiYWNrLAogICAgICAgICAgICAgIG9wdGlvbnMKICAgICAgICAgICAgfSk7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAicmVtb3ZlRXZlbnRMaXN0ZW5lciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gcmVtb3ZlRXZlbnRMaXN0ZW5lcih0eXBlLCBjYWxsYmFjaykgewogICAgICAgICAgICBpZiAoISh0eXBlIGluIHRoaXMubGlzdGVuZXJzKSkgewogICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgc3RhY2sgPSB0aGlzLmxpc3RlbmVyc1t0eXBlXTsKICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSBzdGFjay5sZW5ndGg7IGkgPCBsOyBpKyspIHsKICAgICAgICAgICAgICBpZiAoc3RhY2tbaV0uY2FsbGJhY2sgPT09IGNhbGxiYWNrKSB7CiAgICAgICAgICAgICAgICBzdGFjay5zcGxpY2UoaSwgMSk7CiAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAiZGlzcGF0Y2hFdmVudCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gZGlzcGF0Y2hFdmVudChldmVudCkgewogICAgICAgICAgICBpZiAoIShldmVudC50eXBlIGluIHRoaXMubGlzdGVuZXJzKSkgewogICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgc3RhY2sgPSB0aGlzLmxpc3RlbmVyc1tldmVudC50eXBlXTsKICAgICAgICAgICAgdmFyIHN0YWNrVG9DYWxsID0gc3RhY2suc2xpY2UoKTsKICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGwgPSBzdGFja1RvQ2FsbC5sZW5ndGg7IGkgPCBsOyBpKyspIHsKICAgICAgICAgICAgICB2YXIgbGlzdGVuZXIgPSBzdGFja1RvQ2FsbFtpXTsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgbGlzdGVuZXIuY2FsbGJhY2suY2FsbCh0aGlzLCBldmVudCk7CiAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgUHJvbWlzZS5yZXNvbHZlKCkudGhlbihmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICAgdGhyb3cgZTsKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBpZiAobGlzdGVuZXIub3B0aW9ucyAmJiBsaXN0ZW5lci5vcHRpb25zLm9uY2UpIHsKICAgICAgICAgICAgICAgIHRoaXMucmVtb3ZlRXZlbnRMaXN0ZW5lcihldmVudC50eXBlLCBsaXN0ZW5lci5jYWxsYmFjayk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiAhZXZlbnQuZGVmYXVsdFByZXZlbnRlZDsKICAgICAgICAgIH0KICAgICAgICB9XSk7CiAgICAgICAgcmV0dXJuIEVtaXR0ZXIyOwogICAgICB9KCk7CiAgICAgIHZhciBBYm9ydFNpZ25hbCA9IC8qIEBfX1BVUkVfXyAqLyBmdW5jdGlvbihfRW1pdHRlcikgewogICAgICAgIF9pbmhlcml0cyhBYm9ydFNpZ25hbDIsIF9FbWl0dGVyKTsKICAgICAgICB2YXIgX3N1cGVyID0gX2NyZWF0ZVN1cGVyKEFib3J0U2lnbmFsMik7CiAgICAgICAgZnVuY3Rpb24gQWJvcnRTaWduYWwyKCkgewogICAgICAgICAgdmFyIF90aGlzOwogICAgICAgICAgX2NsYXNzQ2FsbENoZWNrKHRoaXMsIEFib3J0U2lnbmFsMik7CiAgICAgICAgICBfdGhpcyA9IF9zdXBlci5jYWxsKHRoaXMpOwogICAgICAgICAgaWYgKCFfdGhpcy5saXN0ZW5lcnMpIHsKICAgICAgICAgICAgRW1pdHRlci5jYWxsKF9hc3NlcnRUaGlzSW5pdGlhbGl6ZWQoX3RoaXMpKTsKICAgICAgICAgIH0KICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgImFib3J0ZWQiLCB7CiAgICAgICAgICAgIHZhbHVlOiBmYWxzZSwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoX2Fzc2VydFRoaXNJbml0aWFsaXplZChfdGhpcyksICJvbmFib3J0IiwgewogICAgICAgICAgICB2YWx1ZTogbnVsbCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoX2Fzc2VydFRoaXNJbml0aWFsaXplZChfdGhpcyksICJyZWFzb24iLCB7CiAgICAgICAgICAgIHZhbHVlOiB2b2lkIDAsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlLAogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUKICAgICAgICAgIH0pOwogICAgICAgICAgcmV0dXJuIF90aGlzOwogICAgICAgIH0KICAgICAgICBfY3JlYXRlQ2xhc3MoQWJvcnRTaWduYWwyLCBbewogICAgICAgICAga2V5OiAidG9TdHJpbmciLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIHRvU3RyaW5nKCkgewogICAgICAgICAgICByZXR1cm4gIltvYmplY3QgQWJvcnRTaWduYWxdIjsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJkaXNwYXRjaEV2ZW50IiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBkaXNwYXRjaEV2ZW50KGV2ZW50KSB7CiAgICAgICAgICAgIGlmIChldmVudC50eXBlID09PSAiYWJvcnQiKSB7CiAgICAgICAgICAgICAgdGhpcy5hYm9ydGVkID0gdHJ1ZTsKICAgICAgICAgICAgICBpZiAodHlwZW9mIHRoaXMub25hYm9ydCA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgICAgICAgdGhpcy5vbmFib3J0LmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBfZ2V0KF9nZXRQcm90b3R5cGVPZihBYm9ydFNpZ25hbDIucHJvdG90eXBlKSwgImRpc3BhdGNoRXZlbnQiLCB0aGlzKS5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgIH0KICAgICAgICB9XSk7CiAgICAgICAgcmV0dXJuIEFib3J0U2lnbmFsMjsKICAgICAgfShFbWl0dGVyKTsKICAgICAgdmFyIEFib3J0Q29udHJvbGxlciA9IC8qIEBfX1BVUkVfXyAqLyBmdW5jdGlvbigpIHsKICAgICAgICBmdW5jdGlvbiBBYm9ydENvbnRyb2xsZXIyKCkgewogICAgICAgICAgX2NsYXNzQ2FsbENoZWNrKHRoaXMsIEFib3J0Q29udHJvbGxlcjIpOwogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJzaWduYWwiLCB7CiAgICAgICAgICAgIHZhbHVlOiBuZXcgQWJvcnRTaWduYWwoKSwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhBYm9ydENvbnRyb2xsZXIyLCBbewogICAgICAgICAga2V5OiAiYWJvcnQiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGFib3J0KHJlYXNvbikgewogICAgICAgICAgICB2YXIgZXZlbnQ7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgZXZlbnQgPSBuZXcgRXZlbnQoImFib3J0Iik7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICBpZiAodHlwZW9mIGRvY3VtZW50ICE9PSAidW5kZWZpbmVkIikgewogICAgICAgICAgICAgICAgaWYgKCFkb2N1bWVudC5jcmVhdGVFdmVudCkgewogICAgICAgICAgICAgICAgICBldmVudCA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50T2JqZWN0KCk7CiAgICAgICAgICAgICAgICAgIGV2ZW50LnR5cGUgPSAiYWJvcnQiOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgZXZlbnQgPSBkb2N1bWVudC5jcmVhdGVFdmVudCgiRXZlbnQiKTsKICAgICAgICAgICAgICAgICAgZXZlbnQuaW5pdEV2ZW50KCJhYm9ydCIsIGZhbHNlLCBmYWxzZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGV2ZW50ID0gewogICAgICAgICAgICAgICAgICB0eXBlOiAiYWJvcnQiLAogICAgICAgICAgICAgICAgICBidWJibGVzOiBmYWxzZSwKICAgICAgICAgICAgICAgICAgY2FuY2VsYWJsZTogZmFsc2UKICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzaWduYWxSZWFzb24gPSByZWFzb247CiAgICAgICAgICAgIGlmIChzaWduYWxSZWFzb24gPT09IHZvaWQgMCkgewogICAgICAgICAgICAgIGlmICh0eXBlb2YgZG9jdW1lbnQgPT09ICJ1bmRlZmluZWQiKSB7CiAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24gPSBuZXcgRXJyb3IoIlRoaXMgb3BlcmF0aW9uIHdhcyBhYm9ydGVkIik7CiAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24ubmFtZSA9ICJBYm9ydEVycm9yIjsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgc2lnbmFsUmVhc29uID0gbmV3IERPTUV4Y2VwdGlvbigic2lnbmFsIGlzIGFib3J0ZWQgd2l0aG91dCByZWFzb24iKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGVycikgewogICAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24gPSBuZXcgRXJyb3IoIlRoaXMgb3BlcmF0aW9uIHdhcyBhYm9ydGVkIik7CiAgICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbi5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnNpZ25hbC5yZWFzb24gPSBzaWduYWxSZWFzb247CiAgICAgICAgICAgIHRoaXMuc2lnbmFsLmRpc3BhdGNoRXZlbnQoZXZlbnQpOwogICAgICAgICAgfQogICAgICAgIH0sIHsKICAgICAgICAgIGtleTogInRvU3RyaW5nIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiB0b1N0cmluZygpIHsKICAgICAgICAgICAgcmV0dXJuICJbb2JqZWN0IEFib3J0Q29udHJvbGxlcl0iOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gQWJvcnRDb250cm9sbGVyMjsKICAgICAgfSgpOwogICAgICBpZiAodHlwZW9mIFN5bWJvbCAhPT0gInVuZGVmaW5lZCIgJiYgU3ltYm9sLnRvU3RyaW5nVGFnKSB7CiAgICAgICAgQWJvcnRDb250cm9sbGVyLnByb3RvdHlwZVtTeW1ib2wudG9TdHJpbmdUYWddID0gIkFib3J0Q29udHJvbGxlciI7CiAgICAgICAgQWJvcnRTaWduYWwucHJvdG90eXBlW1N5bWJvbC50b1N0cmluZ1RhZ10gPSAiQWJvcnRTaWduYWwiOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHBvbHlmaWxsTmVlZGVkKHNlbGYyKSB7CiAgICAgICAgaWYgKHNlbGYyLl9fRk9SQ0VfSU5TVEFMTF9BQk9SVENPTlRST0xMRVJfUE9MWUZJTEwpIHsKICAgICAgICAgIGNvbnNvbGUubG9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LCAic2lnbmFsIiwgewogICAgICAgICAgICAgICAgd3JpdGFibGU6IGZhbHNlLAogICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUsCiAgICAgICAgICAgICAgICB2YWx1ZTogc2lnbmFsCiAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJlcXVlc3Q7CiAgICAgICAgICB9OwogICAgICAgICAgUmVxdWVzdC5wcm90b3R5cGUgPSBOYXRpdmVSZXF1ZXN0LnByb3RvdHlwZTsKICAgICAgICB9CiAgICAgICAgdmFyIHJlYWxGZXRjaCA9IGZldGNoOwogICAgICAgIHZhciBhYm9ydGFibGVGZXRjaCA9IGZ1bmN0aW9uIGFib3J0YWJsZUZldGNoMihpbnB1dCwgaW5pdDIpIHsKICAgICAgICAgIHZhciBzaWduYWwgPSBSZXF1ZXN0ICYmIFJlcXVlc3QucHJvdG90eXBlLmlzUHJvdG90eXBlT2YoaW5wdXQpID8gaW5wdXQuc2lnbmFsIDogaW5pdDIgPyBpbml0Mi5zaWduYWwgOiB2b2lkIDA7CiAgICAgICAgICBpZiAoc2lnbmFsKSB7CiAgICAgICAgICAgIHZhciBhYm9ydEVycm9yOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgIGFib3J0RXJyb3IgPSBuZXcgRE9NRXhjZXB0aW9uKCJBYm9ydGVkIiwgIkFib3J0RXJyb3IiKTsKICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgICAgYWJvcnRFcnJvciA9IG5ldyBFcnJvcigiQWJvcnRlZCIpOwogICAgICAgICAgICAgIGFib3J0RXJyb3IubmFtZSA9ICJBYm9ydEVycm9yIjsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoYWJvcnRFcnJvcik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIGNhbmNlbGxhdGlvbiA9IG5ldyBQcm9taXNlKGZ1bmN0aW9uKF8sIHJlamVjdCkgewogICAgICAgICAgICAgIHNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsIGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHJlamVjdChhYm9ydEVycm9yKTsKICAgICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICBvbmNlOiB0cnVlCiAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBpZiAoaW5pdDIgJiYgaW5pdDIuc2lnbmFsKSB7CiAgICAgICAgICAgICAgZGVsZXRlIGluaXQyLnNpZ25hbDsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yYWNlKFtjYW5jZWxsYXRpb24sIHJlYWxGZXRjaChpbnB1dCwgaW5pdDIpXSk7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gcmVhbEZldGNoKGlucHV0LCBpbml0Mik7CiAgICAgICAgfTsKICAgICAgICByZXR1cm4gewogICAgICAgICAgZmV0Y2g6IGFib3J0YWJsZUZldGNoLAogICAgICAgICAgUmVxdWVzdAogICAgICAgIH07CiAgICAgIH0KICAgICAgZXhwb3J0czIuQWJvcnRDb250cm9sbGVyID0gQWJvcnRDb250cm9sbGVyOwogICAgICBleHBvcnRzMi5BYm9ydFNpZ25hbCA9IEFib3J0U2lnbmFsOwogICAgICBleHBvcnRzMi5hYm9ydGFibGVGZXRjaCA9IGFib3J0YWJsZUZldGNoRGVjb3JhdG9yOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vYWJvcnRhYmxlLXByb21pc2UtY2FjaGVAMS41LjAvbm9kZV9tb2R1bGVzL2Fib3J0YWJsZS1wcm9taXNlLWNhY2hlL2VzbS9hYm9ydGNvbnRyb2xsZXItcG9ueWZpbGw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XIgTnVsbFNpZ25hbCA9IGNsYXNzIHsKICAgICAgfTsKICAgICAgdmFyIEFnZ3JlZ2F0ZUFib3J0Q29udHJvbGxlciA9IGNsYXNzIHsKICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgIHRoaXMuc2lnbmFscyA9IG5ldyBTZXQoKTsKICAgICAgICAgIHRoaXMuYWJvcnRDb250cm9sbGVyID0gbmV3IGFib3J0Y29udHJvbGxlcl9wb255ZmlsbF8xLkFib3J0Q29udHJvbGxlcigpOwogICAgICAgIH0KICAgICAgICBhZGRTaWduYWwoc2lnbmFsID0gbmV3IE51bGxTaWduYWwoKSkgewogICAgICAgICAgaWYgKHRoaXMuc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJjYW5ub3QgYWRkIGEgc2lnbmFsLCBhbHJlYWR5IGFib3J0ZWQhIik7CiAgICAgICAgICB9CiAgICAgICAgICB0aGlzLnNpZ25hbHMuYWRkKHNpZ25hbCk7CiAgICAgICAgICBpZiAoc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgdGhpcy5oYW5kbGVBYm9ydGVkKHNpZ25hbCk7CiAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBzaWduYWwuYWRkRXZlbnRMaXN0ZW5lciA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgICBzaWduYWwuYWRkRXZlbnRMaXN0ZW5lcigiYWJvcnQiLCAoKSA9PiB7CiAgICAgICAgICAgICAgdGhpcy5oYW5kbGVBYm9ydGVkKHNpZ25hbCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBoYW5kbGVBYm9ydGVkKHNpZ25hbCkgewogICAgICAgICAgdGhpcy5zaWduYWxzLmRlbGV0ZShzaWduYWwpOwogICAgICAgICAgaWYgKHRoaXMuc2lnbmFscy5zaXplID09PSAwKSB7CiAgICAgICAgICAgIHRoaXMuYWJvcnRDb250cm9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2FsbGJhY2soZGF0YSwgYWJvcnRlci5zaWduYWwsIChtZXNzYWdlKSA9PiB7CiAgICAgICAgICAgICAgc3RhdHVzUmVwb3J0ZXIuY2FsbGJhY2sobWVzc2FnZSk7CiAgICAgICAgICAgIH0pLAogICAgICAgICAgICBzZXR0bGVkOiBmYWxzZSwKICAgICAgICAgICAgc3RhdHVzUmVwb3J0ZXIsCiAgICAgICAgICAgIGdldCBhYm9ydGVkKCkgewogICAgICAgICAgICAgIHJldHVybiB0aGlzLmFib3J0ZXIuc2lnbmFsLmFib3J0ZWQ7CiAgICAgICAgICAgIH0KICAgICAgICAgIH07CiAgICAgICAgICBuZXdFbnRyeS5hYm9ydGVyLmFkZFNpZ25hbChzaWduYWwpOwogICAgICAgICAgbmV3RW50cnkuYWJvcnRlci5zaWduYWwuYWRkRXZlbnRMaXN0ZW5lcigiYWJvcnQiLCAoKSA9PiB7CiAgICAgICAgICAgIGlmICghbmV3RW50cnkuc2V0dGxlZCkgewogICAgICAgICAgICAgIHRoaXMuZXZpY3Qoa2V5LCBuZXdFbnRyeSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0pOwogICAgICAgICAgbmV3RW50cnkucHJvbWlzZS50aGVuKCgpID0+IHsKICAgICAgICAgICAgbmV3RW50cnkuc2V0dGxlZCA9IHRydWU7CiAgICAgICAgICB9LCAoKSA9PiB7CiAgICAgICAgICAgIG5ld0VudHJ5LnNldHRsZWQgPSB0cnVlOwogICAgICAgICAgICB0aGlzLmV2aWN0KGtleSwgbmV3RW50cnkpOwogICAgICAgICAgfSkuY2F0Y2goKGUpID0+IHsKICAgICAgICAgICAgY29uc29sZS5lcnJvcihlKTsKICAgICAgICAgICAgdGhyb3cgZTsKICAgICAgICAgIH0pOwogICAgICAgICAgdGhpcy5jYWNoZS5zZXQoa2V5LCBuZXdFbnRyeSk7CiAgICAgICAgfQogICAgICAgIHN0YXRpYyBjaGVja1NpbmdsZVByb21pc2UocHJvbWlzZSwgc2lnbmFsKSB7CiAgICAgICAgICBmdW5jdGlvbiBjaGVja0ZvclNpbmdsZUFib3J0KCkgewogICAgICAgICAgICBpZiAoc2lnbmFsICYmIHNpZ25hbC5hYm9ydGVkKSB7CiAgICAgICAgICAgICAgdGhyb3cgT2JqZWN0LmFzc2lnbihuZXcgRXJyb3IoImFib3J0ZWQiKSwgeyBjb2RlOiAiRVJSX0FCT1JURUQiIH0pOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gcHJvbWlzZS50aGVuKChyZXN1bHQpID0+IHsKICAgICAgICAgICAgY2hlY2tGb3JTaW5nbGVBYm9ydCgpOwogICAgICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgICAgICAgfSwgKGVycm9yKSA9PiB7CiAgICAgICAgICAgIGNoZWNrRm9yU2luZ2xlQWJvcnQoKTsKICAgICAgICAgICAgdGhyb3cgZXJyb3I7CiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgaGFzKGtleSkgewogICAgICAgICAgcmV0dXJuIHRoaXMuY2FjaGUuaGFzKGtleSk7CiAgICAgICAgfQogICAgICAgIGdldChrZXksIGRhdGEsIHNpZ25hbCwgc3RhdHVzQ2FsbGJhY2spIHsKICAgICAgICAgIGlmICghc2lnbmFsICYmIGRhdGEgaW5zdGFuY2VvZiBhYm9ydGNvbnRyb2xsZXJfcG9ueWZpbGxfMS5BYm9ydFNpZ25hbCkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJzZWNvbmQgZ2V0IGFyZ3VtZW50IGFwcGVhcnMgdG8gYmUgYW4gQWJvcnRTaWduYWwsIHBlcmhhcHMgeW91IG1lYW50IHRvIHBhc3MgYG51bGxgIGZvciB0aGUgZmlsbCBkYXRhPyIpOwogICAgICAgICAgfQogICAgICAgICAgY29uc3QgY2FjaGVFbnRyeSA9IHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICBpZiAoY2FjaGVFbnRyeSkgewogICAgICAgICAgICBpZiAoY2FjaGVFbnRyeS5hYm9ydGVkICYmICFjYWNoZUVudHJ5LnNldHRsZWQpIHsKICAgICAgICAgICAgICB0aGlzLmV2aWN0KGtleSwgY2FjaGVFbnRyeSk7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0KGtleSwgZGF0YSwgc2lnbmFsLCBzdGF0dXNDYWxsYmFjayk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGNhY2hlRW50cnkuc2V0dGxlZCkgewogICAgICAgICAgICAgIHJldHVybiBjYWNoZUVudHJ5LnByb21pc2U7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY2FjaGVFbnRyeS5hYm9ydGVyLmFkZFNpZ25hbChzaWduYWwpOwogICAgICAgICAgICBjYWNoZUVudHJ5LnN0YXR1c1JlcG9ydGVyLmFkZENhbGxiYWNrKHN0YXR1c0NhbGxiYWNrKTsKICAgICAgICAgICAgcmV0dXJuIEFib3J0YWJsZVByb21pc2VDYWNoZTIuY2hlY2tTaW5nbGVQcm9taXNlKGNhY2hlRW50cnkucHJvbWlzZSwgc2lnbmFsKTsKICAgICAgICAgIH0KICAgICAgICAgIHRoaXMuZmlsbChrZXksIGRhdGEsIHNpZ25hbCwgc3RhdHVzQ2FsbGJhY2spOwogICAgICAgICAgcmV0dXJuIEFib3J0YWJsZVByb21pc2VDYWNoZTIuY2hlY2tTaW5nbGVQcm9taXNlKHRoaXMuY2FjaGUuZ2V0KGtleSkucHJvbWlzZSwgc2lnbmFsKTsKICAgICAgICB9CiAgICAgICAgZGVsZXRlKGtleSkgewogICAgICAgICAgY29uc3QgY2FjaGVkRW50cnkgPSB0aGlzLmNhY2hlLmdldChrZXkpOwogICAgICAgICAgaWYgKGNhY2hlZEVudHJ5KSB7CiAgICAgICAgICAgIGlmICghY2FjaGVkRW50cnkuc2V0dGxlZCkgewogICAgICAgICAgICAgIGNhY2hlZEVudHJ5LmFib3J0ZXIuYWJvcnQoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB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OwogICAgICAgICAgdGhpcy5fc2l6ZSA9IDA7CiAgICAgICAgfQogICAgICAgIF9zZXQoa2V5LCB2YWx1ZSkgewogICAgICAgICAgdGhpcy5jYWNoZS5zZXQoa2V5LCB2YWx1ZSk7CiAgICAgICAgICB0aGlzLl9zaXplKys7CiAgICAgICAgICBpZiAodGhpcy5fc2l6ZSA+PSB0aGlzLm1heFNpemUpIHsKICAgICAgICAgICAgdGhpcy5fc2l6ZSA9IDA7CiAgICAgICAgICAgIHRoaXMub2xkQ2FjaGUgPSB0aGlzLmNhY2hlOwogICAgICAgICAgICB0aGlzLmNhY2hlID0gbmV3IE1hcCgpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBnZXQoa2V5KSB7CiAgICAgICAgICBpZiAodGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5nZXQoa2V5KTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0aGlzLm9sZENhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gdGhpcy5vbGRDYWNoZS5nZXQoa2V5KTsKICAgICAgICAgICAgdGhpcy5vbGRDYWNoZS5kZWxldGUoa2V5KTsKICAgICAgICAgICAgdGhpcy5fc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgICByZXR1cm4gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHNldChrZXksIHZhbHVlKSB7CiAgICAgICAgICBpZiAodGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIHZhbHVlKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRoaXMuX3NldChrZXksIHZhbHVlKTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIH0KICAgICAgICBoYXMoa2V5KSB7CiAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5oYXMoa2V5KSB8fCB0aGlzLm9sZENhY2hlLmhhcyhrZXkpOwogICAgICAgIH0KICAgICAgICBwZWVrKGtleSkgewogICAgICAgICAgaWYgKHRoaXMuY2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodGhpcy5vbGRDYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5vbGRDYWNoZS5nZXQoa2V5KTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZGVsZXRlKGtleSkgewogICAgICAgICAgY29uc3QgZGVsZXRlZCA9IHRoaXMuY2FjaGUuZGVsZXRlKGtleSk7CiAgICAgICAgICBpZiAoZGVsZXRlZCkgewogICAgICAgICAgICB0aGlzLl9zaXplLS07CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gdGhpcy5vbGRDYWNoZS5kZWxldGUoa2V5KSB8fCBkZWxldGVkOwogICAgICAgIH0KICAgICAgICBjbGVhcigpIHsKICAgICAgICAgIHRoaXMuY2FjaGUuY2xlYXIoKTsKICAgICAgICAgIHRoaXMub2xkQ2FjaGUuY2xlYXIoKTsKICAgICAgICAgIHRoaXMuX3NpemUgPSAwOwogICAgICAgIH0KICAgICAgICAqa2V5cygpIHsKICAgICAgICAgIGZvciAoY29uc3QgW2tleV0gb2YgdGhpcykgewogICAgICAgICAgICB5aWVsZCBrZXk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgICp2YWx1ZXMoKSB7CiAgICAgICAgICBmb3IgKGNvbnN0IFssIHZhbHVlXSBvZiB0aGlzKSB7CiAgICAgICAgICAgIHlpZWxkIHZhbHVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICAqW1N5bWJvbC5pdGVyYXRvcl0oKSB7CiAgICAgICAgICBmb3IgKGNvbnN0IGl0ZW0gb2YgdGhpcy5jYWNoZSkgewogICAgICAgICAgICB5aWVsZCBpdGVtOwogICAgICAgICAgfQogICAgICAgICAgZm9yIChjb25zdCBpdGVtIG9mIHRoaXMub2xkQ2FjaGUpIHsKICAgICAgICAgICAgY29uc3QgW2tleV0gPSBpdGVtOwogICAgICAgICAgICBpZiAoIXRoaXMuY2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgICB5aWVsZCBpdGVtOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGdldCBzaXplKCkgewogICAgICAgICAgbGV0IG9sZENhY2hlU2l6ZSA9IDA7CiAgICAgICAgICBmb3IgKGNvbnN0IGtleSBvZiB0aGlzLm9sZENhY2hlLmtleXMoKSkgewogICAgICAgICAgICBpZiAoIXRoaXMuY2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgICBvbGRDYWNoZVNpemUrKzsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHRoaXMuX3NpemUgKyBvbGRDYWNoZVNpemU7CiAgICAgICAgfQogICAgICB9OwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBRdWlja0xSVTsKICAgIH0KICB9KTsKCiAgLy8gKGRpc2FibGVkKTpub2RlX21vZHVsZXMvLnBucG0vZ2VuZXJpYy1maWxlaGFuZGxlQDMuMS4xL25vZGVfbW9kdWxlcy9nZW5lcmljLWZpbGVoYW5kbGUvZXNtL2xvY2FsRmlsZQogIHZhciByZXF1aXJlX2xvY2FsRmlsZSA9IF9fY29tbW9uSlMoewogICAgIihkaXNhYmxlZCk6bm9kZV9tb2R1bGVzLy5wbnBtL2dlbmVyaWMtZmlsZWhhbmRsZUAzLjEuMS9ub2RlX21vZHVsZXMvZ2VuZXJpYy1maWxlaGFuZGxlL2VzbS9sb2NhbEZpbGUiKCkgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvdXRpbHMvY29tbW9uLmpzCiAgdmFyIHJlcXVpcmVfY29tbW9uID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi91dGlscy9jb21tb24uanMiKGV4cG9ydHMyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICB2YXIgVFlQRURfT0sgPSB0eXBlb2YgVWludDhBcnJheSAhPT0gInVuZGVmaW5lZCIgJiYgdHlwZW9mIFVpbnQxNkFycmF5ICE9PSAidW5kZWZpbmVkIiAmJiB0eXBlb2YgSW50MzJBcnJheSAhPT0gInVuZGVmaW5lZCI7CiAgICAgIGZ1bmN0aW9uIF9oYXMob2JqLCBrZXkpIHsKICAgICAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iaiwga2V5KTsKICAgICAgfQogICAgICBleHBvcnRzMi5hc3NpZ24gPSBmdW5jdGlvbihvYmopIHsKICAgICAgICB2YXIgc291cmNlcyA9IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKGFyZ3VtZW50cywgMSk7CiAgICAgICAgd2hpbGUgKHNvdXJjZXMubGVuZ3RoKSB7CiAgICAgICAgICB2YXIgc291cmNlID0gc291cmNlcy5zaGlmdCgpOwogICAgICAgICAgaWYgKCFzb3VyY2UpIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodHlwZW9mIHNvdXJjZSAhPT0gIm9iamVjdCIpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihzb3VyY2UgKyAibXVzdCBiZSBub24tb2JqZWN0Iik7CiAgICAgICAgICB9CiAgICAgICAgICBmb3IgKHZhciBwIGluIHNvdXJjZSkgewogICAgICAgICAgICBpZiAoX2hhcyhzb3VyY2UsIHApKSB7CiAgICAgICAgICAgICAgb2JqW3BdID0gc291cmNlW3BdOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBvYmo7CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLnNocmlua0J1ZiA9IGZ1bmN0aW9uKGJ1Ziwgc2l6ZSkgewogICAgICAgIGlmIChidWYubGVuZ3RoID09PSBzaXplKSB7CiAgICAgICAgICByZXR1cm4gYnVmOwogICAgICAgIH0KICAgICAgICBpZiAoYnVmLnN1YmFycmF5KSB7CiAgICAgICAgICByZXR1cm4gYnVmLnN1YmFycmF5KDAsIHNpemUpOwogICAgICAgIH0KICAgICAgICBidWYubGVuZ3RoID0gc2l6ZTsKICAgICAgICByZXR1cm4gYnVmOwogICAgICB9OwogICAgICB2YXIgZm5UeXBlZCA9IHsKICAgICAgICBhcnJheVNldDogZnVuY3Rpb24oZGVzdCwgc3JjLCBzcmNfb2ZmcywgbGVuLCBkZXN0X29mZnMpIHsKICAgICAgICAgIGlmIChzcmMuc3ViYXJyYXkgJiYgZGVzdC5zdWJhcnJheSkgewogICAgICAgICAgICBkZXN0LnNldChzcmMuc3ViYXJyYXkoc3JjX29mZnMsIHNyY19vZmZzICsgbGVuKSwgZGVzdF9vZmZzKTsKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgfQogICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgICBkZXN0W2Rlc3Rfb2ZmcyArIGldID0gc3JjW3NyY19vZmZzICsgaV07CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBmbGF0dGVuQ2h1bmtzOiBmdW5jdGlvbihjaHVua3MpIHsKICAgICAgICAgIHZhciBpLCBsLCBsZW4sIHBvcywgY2h1bmssIHJlc3VsdDsKICAgICAgICAgIGxlbiA9IDA7CiAgICAgICAgICBmb3IgKGkgPSAwLCBsID0gY2h1bmtzLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICBsZW4gKz0gY2h1bmtzW2ldLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICAgIHJlc3VsdCA9IG5ldyBVaW50OEFycmF5KGxlbik7CiAgICAgICAgICBwb3MgPSAwOwogICAgICAgICAgZm9yIChpID0gMCwgbCA9IGNodW5rcy5sZW5ndGg7IGkgPCBsOyBpKyspIHsKICAgICAgICAgICAgY2h1bmsgPSBjaHVua3NbaV07CiAgICAgICAgICAgIHJlc3VsdC5zZXQoY2h1bmssIHBvcyk7CiAgICAgICAgICAgIHBvcyArPSBjaHVuay5sZW5ndGg7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgICAgIH0KICAgICAgfTsKICAgICAgdmFyIGZuVW50eXBlZCA9IHsKICAgICAgICBhcnJheVNldDogZnVuY3Rpb24oZGVzdCwgc3JjLCBzcmNfb2ZmcywgbGVuLCBkZXN0X29mZnMpIHsKICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKICAgICAgICAgICAgZGVzdFtkZXN0X29mZnMgKyBpXSA9IHNyY1tzcmNfb2ZmcyArIGldOwogICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgZmxhdHRlbkNodW5rczogZnVuY3Rpb24oY2h1bmtzKSB7CiAgICAgICAgICByZXR1cm4gW10uY29uY2F0LmFwcGx5KFtdLCBjaHVua3MpOwogICAgICAgIH0KICAgICAgfTsKICAgICAgZXhwb3J0czIuc2V0VHlwZWQgPSBmdW5jdGlvbihvbikgewogICAgICAgIGlmIChvbikgewogICAgICAgICAgZXhwb3J0czIuQnVmOCA9IFVpbnQ4QXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5CdWYxNiA9IFVpbnQxNkFycmF5OwogICAgICAgICAgZXhwb3J0czIuQnVmMzIgPSBJbnQzMkFycmF5OwogICAgICAgICAgZXhwb3J0czIuYXNzaWduKGV4cG9ydHMyLCBmblR5cGVkKTsKICAgICAgICB9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wogICAgICAgIHZhciBleHRyYSA9IGRlc2Muc3RhdF9kZXNjLmV4dHJhX2JpdHM7CiAgICAgICAgdmFyIGJhc2UgPSBkZXNjLnN0YXRfZGVzYy5leHRyYV9iYXNlOwogICAgICAgIHZhciBtYXhfbGVuZ3RoID0gZGVzYy5zdGF0X2Rlc2MubWF4X2xlbmd0aDsKICAgICAgICB2YXIgaDsKICAgICAgICB2YXIgbiwgbTsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgeGJpdHM7CiAgICAgICAgdmFyIGY7CiAgICAgICAgdmFyIG92ZXJmbG93ID0gMDsKICAgICAgICBmb3IgKGJpdHMgPSAwOyBiaXRzIDw9IE1BWF9CSVRTOyBiaXRzKyspIHsKICAgICAgICAgIHMuYmxfY291bnRbYml0c10gPSAwOwogICAgICAgIH0KICAgICAgICB0cmVlW3MuaGVhcFtzLmhlYXBfbWF4XSAqIDIgKyAxXSA9IDA7CiAgICAgICAgZm9yIChoID0gcy5oZWFwX21heCArIDE7IGggPCBIRUFQX1NJWkU7IGgrKykgewogICAgICAgICAgbiA9IHMuaGVhcFtoXTsKICAgICAgICAgIGJpdHMgPSB0cmVlW3RyZWVbbiAqIDIgKyAxXSAqIDIgKyAxXSArIDE7CiAgICAgICAgICBpZiAoYml0cyA+IG1heF9sZW5ndGgpIHsKICAgICAgICAgICAgYml0cyA9IG1heF9sZW5ndGg7CiAgICAgICAgICAgIG92ZXJmbG93Kys7CiAgICAgICAgICB9CiAgICAgICAgICB0cmVlW24gKiAyICsgMV0gPSBiaXRzOwogICAgICAgICAgaWYgKG4gPiBtYXhfY29kZSkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIHMuYmxfY291bnRbYml0c10rKzsKICAgICAgICAgIHhiaXRzID0gMDsKICAgICAgICAgIGlmIChuID49IGJhc2UpIHsKICAgICAgICAgICAgeGJpdHMgPSBleHRyYVtuIC0gYmFzZV07CiAgICAgICAgICB9CiAgICAgICAgICBmID0gdHJlZVtuICogMl07CiAgICAgICAgICBzLm9wdF9sZW4gKz0gZiAqIChiaXRzICsgeGJpdHMpOwogICAgICAgICAgaWYgKGhhc19zdHJlZSkgewogICAgICAgICAgICBzLnN0YXRpY19sZW4gKz0gZiAqIChzdHJlZVtuICogMiArIDFdICsgeGJpdHMpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAob3ZlcmZsb3cgPT09IDApIHsKICAgICAgICAgIHJldHVybjsKICAgICAgICB9CiAgICAgICAgZG8gewogICAgICAgICAgYml0cyA9IG1heF9sZW5ndGggLSAxOwogICAgICAgICAgd2hpbGUgKHMuYmxfY291bnRbYml0c10gPT09IDApIHsKICAgICAgICAgICAgYml0cy0tOwogICAgICAgICAgfQogICAgICAgICAgcy5ibF9jb3VudFtiaXRzXS0tOwogICAgICAgICAgcy5ibF9jb3VudFtiaXRzICsgMV0gKz0gMjsKICAgICAgICAgIHMuYmxfY291bnRbbWF4X2xlbmd0aF0tLTsKICAgICAgICAgIG92ZXJmbG93IC09IDI7CiAgICAgICAgfSB3aGlsZSAob3ZlcmZsb3cgPiAwKTsKICAgICAgICBmb3IgKGJpdHMgPSBtYXhfbGVuZ3RoOyBiaXRzICE9PSAwOyBiaXRzLS0pIHsKICAgICAgICAgIG4gPSBzLmJsX2NvdW50W2JpdHNdOwogICAgICAgICAgd2hpbGUgKG4gIT09IDApIHsKICAgICAgICAgICAgbSA9IHMuaGVhcFstLWhdOwogICAgICAgICAgICBpZiAobSA+IG1heF9jb2RlKSB7CiAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHRyZWVbbSAqIDIgKyAxXSAhPT0gYml0cykgewogICAgICAgICAgICAgIHMub3B0X2xlbiArPSAoYml0cyAtIHRyZWVbbSAqIDIgKyAxXSkgKiB0cmVlW20gKiAyXTsKICAgICAgICAgICAgICB0cmVlW20gKiAyICsgMV0gPSBiaXRzOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG4tLTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZ2VuX2NvZGVzKHRyZWUsIG1heF9jb2RlLCBibF9jb3VudCkgewogICAgICAgIHZhciBuZXh0X2NvZGUgPSBuZXcgQXJyYXkoTUFYX0JJVFMgKyAxKTsKICAgICAgICB2YXIgY29kZSA9IDA7CiAgICAgICAgdmFyIGJpdHM7CiAgICAgICAgdmFyIG47CiAgICAgICAgZm9yIChiaXRzID0gMTsgYml0cyA8PSBNQVhfQklUUzsgYml0cysrKSB7CiAgICAgICAgICBuZXh0X2NvZGVbYml0c10gPSBjb2RlID0gY29kZSArIGJsX2NvdW50W2JpdHMgLSAxXSA8PCAxOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IG1heF9jb2RlOyBuKyspIHsKICAgICAgICAgIHZhciBsZW4gPSB0cmVlW24gKiAyICsgMV07CiAgICAgICAgICBpZiAobGVuID09PSAwKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgdHJlZVtuICogMl0gPSBiaV9yZXZlcnNlKG5leHRfY29kZVtsZW5dKyssIGxlbik7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIHRyX3N0YXRpY19pbml0KCkgewogICAgICAgIHZhciBuOwogICAgICAgIHZhciBiaXRzOwogICAgICAgIHZhciBsZW5ndGg7CiAgICAgICAgdmFyIGNvZGU7CiAgICAgICAgdmFyIGRpc3Q7CiAgICAgICAgdmFyIGJsX2NvdW50ID0gbmV3IEFycmF5KE1BWF9CSVRTICsgMSk7CiAgICAgICAgbGVuZ3RoID0gMDsKICAgICAgICBmb3IgKGNvZGUgPSAwOyBjb2RlIDwgTEVOR1RIX0NPREVTIC0gMTsgY29kZSsrKSB7CiAgICAgICAgICBiYXNlX2xlbmd0aFtjb2RlXSA9IGxlbmd0aDsKICAgICAgICAgIGZvciAobiA9IDA7IG4gPCAxIDw8IGV4dHJhX2xiaXRzW2NvZGVdOyBuKyspIHsKICAgICAgICAgICAgX2xlbmd0aF9jb2RlW2xlbmd0aCsrXSA9IGNvZGU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIF9sZW5ndGhfY29kZVtsZW5ndGggLSAxXSA9IGNvZGU7CiAgICAgICAgZGlzdCA9IDA7CiAgICAgICAgZm9yIChjb2RlID0gMDsgY29kZSA8IDE2OyBjb2RlKyspIHsKICAgICAgICAgIGJhc2VfZGlzdFtjb2RlXSA9IGRpc3Q7CiAgICAgICAgICBmb3IgKG4gPSAwOyBuIDwgMSA8PCBleHRyYV9kYml0c1tjb2RlXTsgbisrKSB7CiAgICAgICAgICAgIF9kaXN0X2NvZGVbZGlzdCsrXSA9IGNvZGU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGRpc3QgPj49IDc7CiAgICAgICAgZm9yICg7IGNvZGUgPCBEX0NPREVTOyBjb2RlKyspIHsKICAgICAgICAgIGJhc2VfZGlzdFtjb2RlXSA9IGRpc3QgPDwgNzsKICAgICAgICAgIGZvciAobiA9IDA7IG4gPCAxIDw8IGV4dHJhX2RiaXRzW2NvZGVdIC0gNzsgbisrKSB7CiAgICAgICAgICAgIF9kaXN0X2NvZGVbMjU2ICsgZGlzdCsrXSA9IGNvZGU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZvciAoYml0cyA9IDA7IGJpdHMgPD0gTUFYX0JJVFM7IGJpdHMrKykgewogICAgICAgICAgYmxfY291bnRbYml0c10gPSAwOwogICAgICAgIH0KICAgICAgICBuID0gMDsKICAgICAgICB3aGlsZSAobiA8PSAxNDMpIHsKICAgICAgICAgIHN0YXRpY19sdHJlZVtuICogMiArIDFdID0gODsKICAgICAgICAgIG4rKzsKICAgICAgICAgIGJsX2NvdW50WzhdKys7CiAgICAgICAgfQogICAgICAgIHdoaWxlIChuIDw9IDI1NSkgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA5OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbOV0rKzsKICAgICAgICB9CiAgICAgICAgd2hpbGUgKG4gPD0gMjc5KSB7CiAgICAgICAgICBzdGF0aWNfbHRyZWVbbiAqIDIgKyAxXSA9IDc7CiAgICAgICAgICBuKys7CiAgICAgICAgICBibF9jb3VudFs3XSsrOwogICAgICAgIH0KICAgICAgICB3aGlsZSAobiA8PSAyODcpIHsKICAgICAgICAgIHN0YXRpY19sdHJlZVtuICogMiArIDFdID0gODsKICAgICAgICAgIG4rKzsKICAgICAgICAgIGJsX2NvdW50WzhdKys7CiAgICAgICAgfQogICAgICAgIGdlbl9jb2RlcyhzdGF0aWNfbHRyZWUsIExfQ09ERVMgKyAxLCBibF9jb3VudCk7CiAgICAgICAgZm9yIChuID0gMDsgbiA8IERfQ09ERVM7IG4rKykgewogICAgICAgICAgc3RhdGljX2R0cmVlW24gKiAyICsgMV0gPSA1OwogICAgICAgICAgc3RhdGljX2R0cmVlW24gKiAyXSA9IGJpX3JldmVyc2UobiwgNSk7CiAgICAgICAgfQogICAgICAgIHN0YXRpY19sX2Rlc2MgPSBuZXcgU3RhdGljVHJlZURlc2Moc3RhdGljX2x0cmVlLCBleHRyYV9sYml0cywgTElURVJBTFMgKyAxLCBMX0NPREVTLCBNQVhfQklUUyk7CiAgICAgICAgc3RhdGljX2RfZGVzYyA9IG5ldyBTdGF0aWNUcmVlRGVzYyhzdGF0aWNfZHRyZWUsIGV4dHJhX2RiaXRzLCAwLCBEX0NPREVTLCBNQVhfQklUUyk7CiAgICAgICAgc3RhdGljX2JsX2Rlc2MgPSBuZXcgU3RhdGljVHJlZURlc2MobmV3IEFycmF5KDApLCBleHRyYV9ibGJpdHMsIDAsIEJMX0NPREVTLCBNQVhfQkxfQklUUyk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5pdF9ibG9jayhzKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgZm9yIChuID0gMDsgbiA8IExfQ09ERVM7IG4rKykgewogICAgICAgICAgcy5keW5fbHRyZWVbbiAqIDJdID0gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChuID0gMDsgbiA8IERfQ09ERVM7IG4rKykgewogICAgICAgICAgcy5keW5fZHRyZWVbbiAqIDJdID0gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChuID0gMDsgbiA8IEJMX0NPREVTOyBuKyspIHsKICAgICAgICAgIHMuYmxfdHJlZVtuICogMl0gPSAwOwogICAgICAgIH0KICAgICAgICBzLmR5bl9sdHJlZVtFTkRfQkxPQ0sgKiAyXSA9IDE7CiAgICAgICAgcy5vcHRfbGVuID0gcy5zdGF0aWNfbGVuID0gMDsKICAgICAgICBzLmxhc3RfbGl0ID0gcy5tYXRjaGVzID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBiaV93aW5kdXAocykgewogICAgICAgIGlmIChzLmJpX3ZhbGlkID4gOCkgewogICAgICAgICAgcHV0X3Nob3J0KHMsIHMuYmlfYnVmKTsKICAgICAgICB9IGVsc2UgaWYgKHMuYmlfdmFsaWQgPiAwKSB7CiAgICAgICAgICBzLnBlbmRpbmdfYnVmW3MucGVuZGluZysrXSA9IHMuYmlfYnVmOwogICAgICAgIH0KICAgICAgICBzLmJpX2J1ZiA9IDA7CiAgICAgICAgcy5iaV92YWxpZCA9IDA7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gY29weV9ibG9jayhzLCBidWYsIGxlbiwgaGVhZGVyKSB7CiAgICAgICAgYmlfd2luZHVwKHMpOwogICAgICAgIGlmIChoZWFkZXIpIHsKICAgICAgICAgIHB1dF9zaG9ydChzLCBsZW4pOwogICAgICAgICAgcHV0X3Nob3J0KHMsIH5sZW4pOwogICAgICAgIH0KICAgICAgICB1dGlscy5hcnJheVNldChzLnBlbmRpbmdfYnVmLCBzLndpbmRvdywgYnVmLCBsZW4sIHMucGVuZGluZyk7CiAgICAgICAgcy5wZW5kaW5nICs9IGxlbjsKICAgICAgfQogICAgICBmdW5jdGlvbiBzbWFsbGVyKHRyZWUsIG4sIG0sIGRlcHRoKSB7CiAgICAgICAgdmFyIF9uMiA9IG4gKiAyOwogICAgICAgIHZhciBfbTIgPSBtICogMjsKICAgICAgICByZXR1cm4gdHJlZVtfbjJdIDwgdHJlZVtfbTJdIHx8IHRyZWVbX24yXSA9PT0gdHJlZVtfbTJdICYmIGRlcHRoW25dIDw9IGRlcHRoW21dOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHBxZG93bmhlYXAocywgdHJlZSwgaykgewogICAgICAgIHZhciB2ID0gcy5oZWFwW2tdOwogICAgICAgIHZhciBqID0gayA8PCAxOwogICAgICAgIHdoaWxlIChqIDw9IHMuaGVhcF9sZW4pIHsKICAgICAgICAgIGlmIChqIDwgcy5oZWFwX2xlbiAmJiBzbWFsbGVyKHRyZWUsIHMuaGVhcFtqICsgMV0sIHMuaGVhcFtqXSwgcy5kZXB0aCkpIHsKICAgICAgICAgICAgaisrOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHNtYWxsZXIodHJlZSwgdiwgcy5oZWFwW2pdLCBzLmRlcHRoKSkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICAgIHMuaGVhcFtrXSA9IHMuaGVhcFtqXTsKICAgICAgICAgIGsgPSBqOwogICAgICAgICAgaiA8PD0gMTsKICAgICAgICB9CiAgICAgICAgcy5oZWFwW2tdID0gdjsKICAgICAgfQogICAgICBmdW5jdGlvbiBjb21wcmVzc19ibG9jayhzLCBsdHJlZSwgZHRyZWUpIHsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgbGM7CiAgICAgICAgdmFyIGx4ID0gMDsKICAgICAgICB2YXIgY29kZTsKICAgICAgICB2YXIgZXh0cmE7CiAgICAgICAgaWYgKHMubGFzdF9saXQgIT09IDApIHsKICAgICAgICAgIGRvIHsKICAgICAgICAgICAgZGlzdCA9IHMucGVuZGluZ19idWZbcy5kX2J1ZiArIGx4ICogMl0gPDwgOCB8IHMucGVuZGluZ19idWZbcy5kX2J1ZiArIGx4ICogMiArIDFdOwogICAgICAgICAgICBsYyA9IHMucGVuZGluZ19idWZbcy5sX2J1ZiArIGx4XTsKICAgICAgICAgICAgbHgrKzsKICAgICAgICAgICAgaWYgKGRpc3QgPT09IDApIHsKICAgICAgICAgICAgICBzZW5kX2NvZGUocywgbGMsIGx0cmVlKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBjb2RlID0gX2xlbmd0aF9jb2RlW2xjXTsKICAgICAgICAgICAgICBzZW5kX2NvZGUocywgY29kZSArIExJVEVSQUxTICsgMSwgbHRyZWUpOwogICAgICAgICAgICAgIGV4dHJhID0gZXh0cmFfbGJpdHNbY29kZV07CiAgICAgICAgICAgICAgaWYgKGV4dHJhICE9PSAwKSB7CiAgICAgICAgICAgICAgICBsYyAtPSBiYXNlX2xlbmd0aFtjb2RlXTsKICAgICAgICAgICAgICAgIHNlbmRfYml0cyhzLCBsYywgZXh0cmEpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBkaXN0LS07CiAgICAgICAgICAgICAgY29kZSA9IGRfY29kZShkaXN0KTsKICAgICAgICAgICAgICBzZW5kX2NvZGUocywgY29kZSwgZHRyZWUpOwogICAgICAgICAgICAgIGV4dHJhID0gZXh0cmFfZGJpdHNbY29kZV07CiAgICAgICAgICAgICAgaWYgKGV4dHJhICE9PSAwKSB7CiAgICAgICAgICAgICAgICBkaXN0IC09IGJhc2VfZGlzdFtjb2RlXTsKICAgICAgICAgICAgICAgIHNlbmRfYml0cyhzLCBkaXN0LCBleHRyYSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9IHdoaWxlIChseCA8IHMubGFzdF9saXQpOwogICAgICAgIH0KICAgICAgICBzZW5kX2NvZGUocywgRU5EX0JMT0NLLCBsdHJlZSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYnVpbGRfdHJlZShzLCBkZXNjKSB7CiAgICAgICAgdmFyIHRyZWUgPSBkZXNjLmR5bl90cmVlOwogICAgICAgIHZhciBzdHJlZSA9IGRlc2Muc3RhdF9kZXNjLnN0YXRpY190cmVlOwogICAgICAgIHZhciBoYXNfc3RyZWUgPSBkZXNjLnN0YXRfZGVzYy5oYXNfc3RyZWU7CiAgICAgICAgdmFyIGVsZW1zID0gZGVzYy5zdGF0X2Rlc2MuZWxlbXM7CiAgICAgICAgdmFyIG4sIG07CiAgICAgICAgdmFyIG1heF9jb2RlID0gLTE7CiAgICAgICAgdmFyIG5vZGU7CiAgICAgICAgcy5oZWFwX2xlbiA9IDA7CiAgICAgICAgcy5oZWFwX21heCA9IEhFQVBfU0laRTsKICAgICAgICBmb3IgKG4gPSAwOyBuIDwgZWxlbXM7IG4rKykgewogICAgICAgICAgaWYgKHRyZWVbbiAqIDJdICE9PSAwKSB7CiAgICAgICAgICAgIHMuaGVhcFsrK3MuaGVhcF9sZW5dID0gbWF4X2NvZGUgPSBuOwogICAgICAgICAgICBzLmRlcHRoW25dID0gMDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRyZWVbbiAqIDIgKyAxXSA9IDA7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHdoaWxlIChzLmhlYXBfbGVuIDwgMikgewogICAgICAgICAgbm9kZSA9IHMuaGVhcFsrK3MuaGVhcF9sZW5dID0gbWF4X2NvZGUgPCAyID8gKyttYXhfY29kZSA6IDA7CiAgICAgICAgICB0cmVlW25vZGUgKiAyXSA9IDE7CiAgICAgICAgICBzLmRlcHRoW25vZGVdID0gMDsKICAgICAgICAgIHMub3B0X2xlbi0tOwogICAgICAgICAgaWYgKGhhc19zdHJlZSkgewogICAgICAgICAgICBzLnN0YXRpY19sZW4gLT0gc3RyZWVbbm9kZSAqIDIgKyAxXTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZGVzYy5tYXhfY29kZSA9IG1heF9jb2RlOwogICAgICAgIGZvciAobiA9IHMuaGVhcF9sZW4gPj4gMTsgbiA+PSAxOyBuLS0pIHsKICAgICAgICAgIHBxZG93bmhlYXAocywgdHJlZSwgbik7CiAgICAgICAgfQogICAgICAgIG5vZGUgPSBlbGVtczsKICAgICAgICBkbyB7CiAgICAgICAgICBuID0gcy5oZWFwWzFdOwogICAgICAgICAgcy5oZWFwWzFdID0gcy5oZWFwW3MuaGVhcF9sZW4tLV07CiAgICAgICAgICBwcWRvd25oZWFwKHMsIHRyZWUsIDEpOwogICAgICAgICAgbSA9IHMuaGVhcFsxXTsKICAgICAgICAgIHMuaGVhcFstLXMuaGVhcF9tYXhdID0gbjsKICAgICAgICAgIHMuaGVhcFstLXMuaGVhcF9tYXhdID0gbTsKICAgICAgICAgIHRyZWVbbm9kZSAqIDJdID0gdHJlZVtuICogMl0gKyB0cmVlW20gKiAyXTsKICAgICAgICAgIHMuZGVwdGhbbm9kZV0gPSAocy5kZXB0aFtuXSA+PSBzLmRlcHRoW21dID8gcy5kZXB0aFtuXSA6IHMuZGVwdGhbbV0pICsgMTsKICAgICAgICAgIHRyZWVbbiAqIDIgKyAxXSA9IHRyZWVbbSAqIDIgKyAxXSA9IG5vZGU7CiAgICAgICAgICBzLmhlYXBbMV0gPSBub2RlKys7CiAgICAgICAgICBwcWRvd25oZWFwKHMsIHRyZWUsIDEpOwogICAgICAgIH0gd2hpbGUgKHMuaGVhcF9sZW4gPj0gMik7CiAgICAgICAgcy5oZWFwWy0tcy5oZWFwX21heF0gPSBzLmhlYXBbMV07CiAgICAgICAgZ2VuX2JpdGxlbihzLCBkZXNjKTsKICAgICAgICBnZW5fY29kZXModHJlZSwgbWF4X2NvZGUsIHMuYmxfY291bnQpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNjYW5fdHJlZShzLCB0cmVlLCBtYXhfY29kZSkgewogICAgICAgIHZhciBuOwogICAgICAgIHZhciBwcmV2bGVuID0gLTE7CiAgICAgICAgdmFyIGN1cmxlbjsKICAgICAgICB2YXIgbmV4dGxlbiA9IHRyZWVbMCAqIDIgKyAxXTsKICAgICAgICB2YXIgY291bnQgPSAwOwogICAgICAgIHZhciBtYXhfY291bnQgPSA3OwogICAgICAgIHZhciBtaW5fY291bnQgPSA0OwogICAgICAgIGlmIChuZXh0bGVuID09PSAwKSB7CiAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgIH0KICAgICAgICB0cmVlWyhtYXhfY29kZSArIDEpICogMiArIDFdID0gNjU1MzU7CiAgICAgICAgZm9yIChuID0gMDsgbiA8PSBtYXhfY29kZTsgbisrKSB7CiAgICAgICAgICBjdXJsZW4gPSBuZXh0bGVuOwogICAgICAgICAgbmV4dGxlbiA9IHRyZWVbKG4gKyAxKSAqIDIgKyAxXTsKICAgICAgICAgIGlmICgrK2NvdW50IDwgbWF4X2NvdW50ICYmIGN1cmxlbiA9PT0gbmV4dGxlbikgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0gZWxzZSBpZiAoY291bnQgPCBtaW5fY291bnQpIHsKICAgICAgICAgICAgcy5ibF90cmVlW2N1cmxlbiAqIDJdICs9IGNvdW50OwogICAgICAgICAgfSBlbHNlIGlmIChjdXJsZW4gIT09IDApIHsKICAgICAgICAgICAgaWYgKGN1cmxlbiAhPT0gcHJldmxlbikgewogICAgICAgICAgICAgIHMuYmxfdHJlZVtjdXJsZW4gKiAyXSsrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHMuYmxfdHJlZVtSRVBfM182ICogMl0rKzsKICAgICAgICAgIH0gZWxzZSBpZiAoY291bnQgPD0gMTApIHsKICAgICAgICAgICAgcy5ibF90cmVlW1JFUFpfM18xMCAqIDJdKys7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLmJsX3RyZWVbUkVQWl8xMV8xMzggKiAyXSsrOwogICAgICAgICAgfQogICAgICAgICAgY291bnQgPSAwOwogICAgICAgICAgcHJldmxlbiA9IGN1cmxlbjsKICAgICAgICAgIGlmIChuZXh0bGVuID09PSAwKSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDEzODsKICAgICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDY7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBtYXhfY291bnQgPSA3OwogICAgICAgICAgICBtaW5fY291bnQgPSA0OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBzZW5kX3RyZWUocywgdHJlZSwgbWF4X2NvZGUpIHsKICAgICAgICB2YXIgbjsKICAgICAgICB2YXIgcHJldmxlbiA9IC0xOwogICAgICAgIHZhciBjdXJsZW47CiAgICAgICAgdmFyIG5leHRsZW4gPSB0cmVlWzAgKiAyICsgMV07CiAgICAgICAgdmFyIGNvdW50ID0gMDsKICAgICAgICB2YXIgbWF4X2NvdW50ID0gNzsKICAgICAgICB2YXIgbWluX2NvdW50ID0gNDsKICAgICAgICBpZiAobmV4dGxlbiA9PT0gMCkgewogICAgICAgICAgbWF4X2NvdW50ID0gMTM4OwogICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICB9CiAgICAgICAgZm9yIChuID0gMDsgbiA8PSBtYXhfY29kZTsgbisrKSB7CiAgICAgICAgICBjdXJsZW4gPSBuZXh0bGVuOwogICAgICAgICAgbmV4dGxlbiA9IHRyZWVbKG4gKyAxKSAqIDIgKyAxXTsKICAgICAgICAgIGlmICgrK2NvdW50IDwgbWF4X2NvdW50ICYmIGN1cmxlbiA9PT0gbmV4dGxlbikgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0gZWxzZSBpZiAoY291bnQgPCBtaW5fY291bnQpIHsKICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjdXJsZW4sIHMuYmxfdHJlZSk7CiAgICAgICAgICAgIH0gd2hpbGUgKC0tY291bnQgIT09IDApOwogICAgICAgICAgfSBlbHNlIGlmIChjdXJsZW4gIT09IDApIHsKICAgICAgICAgICAgaWYgKGN1cmxlbiAhPT0gcHJldmxlbikgewogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjdXJsZW4sIHMuYmxfdHJlZSk7CiAgICAgICAgICAgICAgY291bnQtLTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzZW5kX2NvZGUocywgUkVQXzNfNiwgcy5ibF90cmVlKTsKICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGNvdW50IC0gMywgMik7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvdW50IDw9IDEwKSB7CiAgICAgICAgICAgIHNlbmRfY29kZShzLCBSRVBaXzNfMTAsIHMuYmxfdHJlZSk7CiAgICAgICAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDMsIDMpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgc2VuZF9jb2RlKHMsIFJFUFpfMTFfMTM4LCBzLmJsX3RyZWUpOwogICAgICAgICAgICBzZW5kX2JpdHMocywgY291bnQgLSAxMSwgNyk7CiAgICAgICAgICB9CiAgICAgICAgICBjb3VudCA9IDA7CiAgICAgICAgICBwcmV2bGVuID0gY3VybGVuOwogICAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gMTM4OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIGlmIChjdXJsZW4gPT09IG5leHRsZW4pIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNjsKICAgICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDc7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJ1aWxkX2JsX3RyZWUocykgewogICAgICAgIHZhciBtYXhfYmxpbmRleDsKICAgICAgICBzY2FuX3RyZWUocywgcy5keW5fbHRyZWUsIHMubF9kZXNjLm1heF9jb2RlKTsKICAgICAgICBzY2FuX3RyZWUocywgcy5keW5fZHRyZWUsIHMuZF9kZXNjLm1heF9jb2RlKTsKICAgICAgICBidWlsZF90cmVlKHMsIHMuYmxfZGVzYyk7CiAgICAgICAgZm9yIChtYXhfYmxpbmRleCA9IEJMX0NPREVTIC0gMTsgbWF4X2JsaW5kZXggPj0gMzsgbWF4X2JsaW5kZXgtLSkgewogICAgICAgICAgaWYgKHMuYmxfdHJlZVtibF9vcmRlclttYXhfYmxpbmRleF0gKiAyICsgMV0gIT09IDApIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHMub3B0X2xlbiArPSAzICogKG1heF9ibGluZGV4ICsgMSkgKyA1ICsgNSArIDQ7CiAgICAgICAgcmV0dXJuIG1heF9ibGluZGV4OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNlbmRfYWxsX3RyZWVzKHMsIGxjb2RlcywgZGNvZGVzLCBibGNvZGVzKSB7CiAgICAgICAgdmFyIHJhbms7CiAgICAgICAgc2VuZF9iaXRzKHMsIGxjb2RlcyAtIDI1NywgNSk7CiAgICAgICAgc2VuZF9iaXRzKHMsIGRjb2RlcyAtIDEsIDUpOwogICAgICAgIHNlbmRfYml0cyhzLCBibGNvZGVzIC0gNCwgNCk7CiAgICAgICAgZm9yIChyYW5rID0gMDsgcmFuayA8IGJsY29kZXM7IHJhbmsrKykgewogICAgICAgICAgc2VuZF9iaXRzKHMsIHMuYmxfdHJlZVtibF9vcmRlcltyYW5rXSAqIDIgKyAxXSwgMyk7CiAgICAgICAgfQogICAgICAgIHNlbmRfdHJlZShzLCBzLmR5bl9sdHJlZSwgbGNvZGVzIC0gMSk7CiAgICAgICAgc2VuZF90cmVlKHMsIHMuZHluX2R0cmVlLCBkY29kZXMgLSAxKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZXRlY3RfZGF0YV90eXBlKHMpIHsKICAgICAgICB2YXIgYmxhY2tfbWFzayA9IDQwOTM2MjQ0NDc7CiAgICAgICAgdmFyIG47CiAgICAgICAgZm9yIChuID0gMDsgbiA8PSAzMTsgbisrLCBibGFja19tYXNrID4+Pj0gMSkgewogICAgICAgICAgaWYgKGJsYWNrX21hc2sgJiAxICYmIHMuZHluX2x0cmVlW24gKiAyXSAhPT0gMCkgewogICAgICAgICAgICByZXR1cm4gWl9CSU5BUlk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLmR5bl9sdHJlZVs5ICogMl0gIT09IDAgfHwgcy5keW5fbHRyZWVbMTAgKiAyXSAhPT0gMCB8fCBzLmR5bl9sdHJlZVsxMyAqIDJdICE9PSAwKSB7CiAgICAgICAgICByZXR1cm4gWl9URVhUOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAzMjsgbiA8IExJVEVSQUxTOyBuKyspIHsKICAgICAgICAgIGlmIChzLmR5bl9sdHJlZVtuICogMl0gIT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIFpfVEVYVDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIFpfQklOQVJZOwogICAgICB9CiAgICAgIHZhciBzdGF0aWNfaW5pdF9kb25lID0gZmFsc2U7CiAgICAgIGZ1bmN0aW9uIF90cl9pbml0KHMpIHsKICAgICAgICBpZiAoIXN0YXRpY19pbml0X2RvbmUpIHsKICAgICAgICAgIHRyX3N0YXRpY19pbml0KCk7CiAgICAgICAgICBzdGF0aWNfaW5pdF9kb25lID0gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgcy5sX2Rlc2MgPSBuZXcgVHJlZURlc2Mocy5keW5fbHRyZWUsIHN0YXRpY19sX2Rlc2MpOwogICAgICAgIHMuZF9kZXNjID0gbmV3IFRyZWVEZXNjKHMuZHluX2R0cmVlLCBzdGF0aWNfZF9kZXNjKTsKICAg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AgICAgICAgb3B0X2xlbmIgPSBzLm9wdF9sZW4gKyAzICsgNyA+Pj4gMzsKICAgICAgICAgIHN0YXRpY19sZW5iID0gcy5zdGF0aWNfbGVuICsgMyArIDcgPj4+IDM7CiAgICAgICAgICBpZiAoc3RhdGljX2xlbmIgPD0gb3B0X2xlbmIpIHsKICAgICAgICAgICAgb3B0X2xlbmIgPSBzdGF0aWNfbGVuYjsKICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgb3B0X2xlbmIgPSBzdGF0aWNfbGVuYiA9IHN0b3JlZF9sZW4gKyA1OwogICAgICAgIH0KICAgICAgICBpZiAoc3RvcmVkX2xlbiArIDQgPD0gb3B0X2xlbmIgJiYgYnVmICE9PSAtMSkgewogICAgICAgICAgX3RyX3N0b3JlZF9ibG9jayhzLCBidWYsIHN0b3JlZF9sZW4sIGxhc3QpOwogICAgICAgIH0gZWxzZSBpZiAocy5zdHJhdGVneSA9PT0gWl9GSVhFRCB8fCBzdGF0aWNfbGVuYiA9PT0gb3B0X2xlbmIpIHsKICAgICAgICAgIHNlbmRfYml0cyhzLCAoU1RBVElDX1RSRUVTIDw8IDEpICsgKGxhc3QgPyAxIDogMCksIDMpOwogICAgICAgICAgY29tcHJlc3NfYmxvY2socywgc3RhdGljX2x0cmVlLCBzdGF0aWNfZHRyZWUpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBzZW5kX2JpdHMocywgKERZTl9UUkVFUyA8PCAxKSArIChsYXN0ID8gMSA6IDApLCAzKTsKICAgICAgICAgIHNlbmRfYWxsX3RyZWVzKHMsIHMubF9kZXNjLm1heF9jb2RlICsgMSwgcy5kX2Rlc2MubWF4X2NvZGUgKyAxLCBtYXhfYmxpbmRleCArIDEpOwogICAgICAgICAgY29tcHJlc3NfYmxvY2socywgcy5keW5fbHRyZWUsIHMuZHluX2R0cmVlKTsKICAgICAgICB9CiAgICAgICAgaW5pdF9ibG9jayhzKTsKICAgICAgICBpZiAobGFzdCkgewogICAgICAgICAgYmlfd2luZHVwKHMpOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBfdHJfdGFsbHkocywgZGlzdCwgbGMpIHsKICAgICAgICBzLnBlbmRpbmdfYnVmW3MuZF9idWYgKyBzLmxhc3RfbGl0ICogMl0gPSBkaXN0ID4+PiA4ICYgMjU1OwogICAgICAgIHMucGVuZGluZ19idWZbcy5kX2J1ZiArIHMubGFzdF9saXQgKiAyICsgMV0gPSBkaXN0ICYgMjU1OwogICAgICAgIHMucGVuZGluZ19idWZbcy5sX2J1ZiArIHMubGFzdF9saXRdID0gbGMgJiAyNTU7CiAgICAgICAgcy5sYXN0X2xpdCsrOwogICAgICAgIGlmIChkaXN0ID09PSAwKSB7CiAgICAgICAgICBzLmR5bl9sdHJlZVtsYyAqIDJdKys7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHMubWF0Y2hlcysrOwogICAgICAgICAgZGlzdC0tOwogICAgICAgICAgcy5keW5fbHRyZWVbKF9sZW5ndGhfY29kZVtsY10gKyBMSVRFUkFMUyArIDEpICogMl0rKzsKICAgICAgICAgIHMuZHluX2R0cmVlW2RfY29kZShkaXN0KSAqIDJdKys7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzLmxhc3RfbGl0ID09PSBzLmxpdF9idWZzaXplIC0gMTsKICAgICAgfQogICAgICBleHBvcnRzMi5fdHJfaW5pdCA9IF90cl9pbml0OwogICAgICBleHBvcnRzMi5fdHJfc3RvcmVkX2Jsb2NrID0gX3RyX3N0b3JlZF9ibG9jazsKICAgICAgZXhwb3J0czIuX3RyX2ZsdXNoX2Jsb2NrID0gX3RyX2ZsdXNoX2Jsb2NrOwogICAgICBleHBvcnRzMi5fdHJfdGFsbHkgPSBfdHJfdGFsbHk7CiAgICAgIGV4cG9ydHMyLl90cl9hbGlnbiA9IF90cl9hbGlnbjsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2FkbGVyMzIuanMKICB2YXIgcmVxdWlyZV9hZGxlcjMyID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2FkbGVyMzIuanMiKGV4cG9ydHMyLCBtb2R1bGUyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBmdW5jdGlvbiBhZGxlcjMyKGFkbGVyLCBidWYsIGxlbiwgcG9zKSB7CiAgICAgICAgdmFyIHMxID0gYWRsZXIgJiA2NTUzNSB8IDAsIHMyID0gYWRsZXIgPj4+IDE2ICYgNjU1MzUgfCAwLCBuID0gMDsKICAgICAgICB3aGlsZSAobGVuICE9PSAwKSB7CiAgICAgICAgICBuID0gbGVuID4gMmUzID8gMmUzIDogbGVuOwogICAgICAgICAgbGVuIC09IG47CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIHMxID0gczEgKyBidWZbcG9zKytdIHwgMDsKICAgICAgICAgICAgczIgPSBzMiArIHMxIHwgMDsKICAgICAgICAgIH0gd2hpbGUgKC0tbik7CiAgICAgICAgICBzMSAlPSA2NTUyMTsKICAgICAgICAgIHMyICU9IDY1NTIxOwogICAgICAgIH0KICAgICAgICByZXR1cm4gczEgfCBzMiA8PCAxNiB8IDA7CiAgICAgIH0KICAgICAgbW9kdWxlMi5leHBvcnRzID0gYWRsZXIzMjsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2NyYzMyLmpzCiAgdmFyIHJlcXVpcmVfY3JjMzIgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvY3JjMzIuanMiKGV4cG9ydHMyLCBtb2R1bGUyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBmdW5jdGlvbiBtYWtlVGFibGUoKSB7CiAgICAgICAgdmFyIGMsIHRhYmxlID0gW107CiAgICAgICAgZm9yICh2YXIgbiA9IDA7IG4gPCAyNTY7IG4rKykgewogICAgICAgICAgYyA9IG47CiAgICAgICAgICBmb3IgKHZhciBrID0gMDsgayA8IDg7IGsrKykgewogICAgICAgICAgICBjID0gYyAmIDEgPyAzOTg4MjkyMzg0IF4gYyA+Pj4gMSA6IGMgPj4+IDE7CiAgICAgICAgICB9CiAgICAgICAgICB0YWJsZVtuXSA9IGM7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0YWJsZTsKICAgICAgfQogICAgICB2YXIgY3JjVGFibGUgPSBtYWtlVGFibGUoKTsKICAgICAgZnVuY3Rpb24gY3JjMzIoY3JjLCBidWYsIGxlbiwgcG9zKSB7CiAgICAgICAgdmFyIHQgPSBjcmNUYWJsZSwgZW5kID0gcG9zICsgbGVuOwogICAgICAgIGNyYyBePSAtMTsKICAgICAgICBmb3IgKHZhciBpID0gcG9zOyBpIDwgZW5kOyBpKyspIHsKICAgICAgICAgIGNyYyA9IGNyYyA+Pj4gOCBeIHRbKGNyYyBeIGJ1ZltpXSkgJiAyNTVdOwogICAgICAgIH0KICAgICAgICByZXR1cm4gY3JjIF4gLTE7CiAgICAgIH0KICAgICAgbW9kdWxlMi5leHBvcnRzID0gY3JjMzI7CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9tZXNzYWdlcy5qcwogIHZhciByZXF1aXJlX21lc3NhZ2VzID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xp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0gMDsKICAgICAgdmFyIFpfUEFSVElBTF9GTFVTSCA9IDE7CiAgICAgIHZhciBaX0ZVTExfRkxVU0ggPSAzOwogICAgICB2YXIgWl9GSU5JU0ggPSA0OwogICAgICB2YXIgWl9CTE9DSyA9IDU7CiAgICAgIHZhciBaX09LID0gMDsKICAgICAgdmFyIFpfU1RSRUFNX0VORCA9IDE7CiAgICAgIHZhciBaX1NUUkVBTV9FUlJPUiA9IC0yOwogICAgICB2YXIgWl9EQVRBX0VSUk9SID0gLTM7CiAgICAgIHZhciBaX0JVRl9FUlJPUiA9IC01OwogICAgICB2YXIgWl9ERUZBVUxUX0NPTVBSRVNTSU9OID0gLTE7CiAgICAgIHZhciBaX0ZJTFRFUkVEID0gMTsKICAgICAgdmFyIFpfSFVGRk1BTl9PTkxZID0gMjsKICAgICAgdmFyIFpfUkxFID0gMzsKICAgICAgdmFyIFpfRklYRUQgPSA0OwogICAgICB2YXIgWl9ERUZBVUxUX1NUUkFURUdZID0gMDsKICAgICAgdmFyIFpfVU5LTk9XTiA9IDI7CiAgICAgIHZhciBaX0RFRkxBVEVEID0gODsKICAgICAgdmFyIE1BWF9NRU1fTEVWRUwgPSA5OwogICAgICB2YXIgTUFYX1dCSVRTID0gMTU7CiAgICAgIHZhciBERUZfTUVNX0xFVkVMID0gODsKICAgICAgdmFyIExFTkdUSF9DT0RFUyA9IDI5OwogICAgICB2YXIgTElURVJBTFMgPSAyNTY7CiAgICAgIHZhciBMX0NPREVTID0gTElURVJBTFMgKyAxICsgTEVOR1RIX0NPREVTOwogICAgICB2YXIgRF9DT0RFUyA9IDMwOwogICAgICB2YXIgQkxfQ09ERVMgPSAxOTsKICAgICAgdmFyIEhFQVBfU0laRSA9IDIgKiBMX0NPREVTICsgMTsKICAgICAgdmFyIE1BWF9CSVRTID0gMTU7CiAgICAgIHZhciBNSU5fTUFUQ0ggPSAzOwogICAgICB2YXIgTUFYX01BVENIID0gMjU4OwogICAgICB2YXIgTUlOX0xPT0tBSEVBRC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B7CiAgICAgICAgICBsZW4gPSBzdHJtLmF2YWlsX291dDsKICAgICAgICB9CiAgICAgICAgaWYgKGxlbiA9PT0gMCkgewogICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICB1dGlscy5hcnJheVNldChzdHJtLm91dHB1dCwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nX291dCwgbGVuLCBzdHJtLm5leHRfb3V0KTsKICAgICAgICBzdHJtLm5leHRfb3V0ICs9IGxlbjsKICAgICAgICBzLnBlbmRpbmdfb3V0ICs9IGxlbjsKICAgICAgICBzdHJtLnRvdGFsX291dCArPSBsZW47CiAgICAgICAgc3RybS5hdmFpbF9vdXQgLT0gbGVuOwogICAgICAgIHMucGVuZGluZyAtPSBsZW47CiAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gMCkgewogICAgICAgICAgcy5wZW5kaW5nX291dCA9IDA7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZsdXNoX2Jsb2NrX29ubHkocywgbGFzdCkgewogICAgICAgIHRyZWVzLl90cl9mbHVzaF9ibG9jayhzLCBzLmJsb2NrX3N0YXJ0ID49IDAgPyBzLmJsb2NrX3N0YXJ0IDogLTEsIHMuc3Ryc3RhcnQgLSBzLmJsb2NrX3N0YXJ0LCBsYXN0KTsKICAgICAgICBzLmJsb2NrX3N0YXJ0ID0gcy5zdHJzdGFydDsKICAgICAgICBmbHVzaF9wZW5kaW5nKHMuc3RybSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcHV0X2J5dGUocywgYikgewogICAgICAgIHMucGVuZGluZ19idWZbcy5wZW5kaW5nKytdID0gYjsKICAgICAgfQogICAgICBmdW5jdGlvbiBwdXRTaG9ydE1TQihzLCBiKSB7CiAgICAgICAgcy5wZW5kaW5nX2J1ZltzLnBlbmRpbmcrK10gPSBiID4+PiA4ICYgMjU1OwogICAgICAgIHMucGVuZGluZ19idWZbcy5wZW5kaW5nKytdID0gYiAmIDI1NTsKICAgICAgfQogICAgICBmdW5jdGlvbiByZWFkX2J1ZihzdHJtLCBidWYsIHN0YXJ0LCBzaXplKSB7CiAgICAgICAgdmFyIGxlbiA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgaWYgKGxlbiA+IHNpemUpIHsKICAgICAgICAgIGxlbiA9IHNpemU7CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gPT09IDApIHsKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgICAgICBzdHJtLmF2YWlsX2luIC09IGxlbjsKICAgICAgICB1dGlscy5hcnJheVNldChidWYsIHN0cm0uaW5wdXQsIHN0cm0ubmV4dF9pbiwgbGVuLCBzdGFydCk7CiAgICAgICAgaWYgKHN0cm0uc3RhdGUud3JhcCA9PT0gMSkgewogICAgICAgICAgc3RybS5hZGxlciA9IGFkbGVyMzIoc3RybS5hZGxlciwgYnVmLCBsZW4sIHN0YXJ0KTsKICAgICAgICB9IGVsc2UgaWYgKHN0cm0uc3RhdGUud3JhcCA9PT0gMikgewogICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIGJ1ZiwgbGVuLCBzdGFydCk7CiAgICAgICAgfQogICAgICAgIHN0cm0ubmV4dF9pbiArPSBsZW47CiAgICAgICAgc3RybS50b3RhbF9pbiArPSBsZW47CiAgICAgICAgcmV0dXJuIGxlbjsKICAgICAgfQogICAgICBmdW5jdGlvbiBsb25nZXN0X21hdGNoKHMsIGN1cl9tYXRjaCkgewogICAgICAgIHZhciBjaGFpbl9sZW5ndGggPSBzLm1heF9jaGFpbl9sZW5ndGg7CiAgICAgICAgdmFyIHNjYW4gPSBzLnN0cnN0YXJ0OwogICAgICAgIHZhciBtYXRjaDsKICAgICAgICB2YXIgbGVuOwogICAgICAgIHZhciBiZXN0X2xlbiA9IHMucHJldl9sZW5ndGg7CiAgICAgICAgdmFyIG5pY2VfbWF0Y2ggPSBzLm5pY2VfbWF0Y2g7CiAgICAgICAgdmFyIGxpbWl0ID0gcy5zdHJzdGFydCA+IHMud19zaXplIC0gTUlOX0xPT0tBSEVBRCA/IHMuc3Ryc3RhcnQgLSAocy53X3NpemUgLSBNSU5fTE9PS0FIRUFEKSA6IDA7CiAgICAgICAgdmFyIF93aW4gPSBzLndpbmRvdzsKICAgICAgICB2YXIgd21hc2sgPSBzLndfbWFzazsKICAgICAgICB2YXIgcHJldiA9IHMucHJldjsKICAgICAgICB2YXIgc3RyZW5kID0gcy5zdHJzdGFydCArIE1BWF9NQVRDSDsKICAgICAgICB2YXIgc2Nhbl9lbmQxID0gX3dpbltzY2FuICsgYmVzdF9sZW4gLSAxXTsKICAgICAgICB2YXIgc2Nhbl9lbmQgPSBfd2luW3NjYW4gKyBiZXN0X2xlbl07CiAgICAgICAgaWYgKHMucHJldl9sZW5ndGggPj0gcy5nb29kX21hdGNoKSB7CiAgICAgICAgICBjaGFpbl9sZW5ndGggPj49IDI7CiAgICAgICAgfQogICAgICAgIGlmIChuaWNlX21hdGNoID4gcy5sb29rYWhlYWQpIHsKICAgICAgICAgIG5pY2VfbWF0Y2ggPSBzLmxvb2thaGVhZDsKICAgICAgICB9CiAgICAgICAgZG8gewogICAgICAgICAgbWF0Y2ggPSBjdXJfbWF0Y2g7CiAgICAgICAgICBpZiAoX3dpblttYXRjaCArIGJlc3RfbGVuXSAhPT0gc2Nhbl9lbmQgfHwgX3dpblttYXRjaCArIGJlc3RfbGVuIC0gMV0gIT09IHNjYW5fZW5kMSB8fCBfd2luW21hdGNoXSAhPT0gX3dpbltzY2FuXSB8fCBfd2luWysrbWF0Y2hdICE9PSBfd2luW3NjYW4gKyAxXSkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIHNjYW4gKz0gMjsKICAgICAgICAgIG1hdGNoKys7CiAgICAgICAgICBkbyB7CiAgICAgICAgICB9IHdoaWxlIChfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIHNjYW4gPCBzdHJlbmQpOwogICAgICAgICAgbGVuID0gTUFYX01BVENIIC0gKHN0cmVuZCAtIHNjYW4pOwogICAgICAgICAgc2NhbiA9IHN0cmVuZCAtIE1BWF9NQVRDSDsKICAgICAgICAgIGlmIChsZW4gPiBiZXN0X2xlbikgewogICAgICAgICAgICBzLm1hdGNoX3N0YXJ0ID0gY3VyX21hdGNoOwogICAgICAgICAgICBiZXN0X2xlbiA9IGxlbjsKICAgICAgICAgICAgaWYgKGxlbiA+PSBuaWNlX21hdGNoKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgc2Nhbl9lbmQxID0gX3dpbltzY2FuICsgYmVzdF9sZW4gLSAxXTsKICAgICAgICAgICAgc2Nhbl9lbmQgPSBfd2luW3NjYW4gKyBiZXN0X2xlbl07CiAgICAgICAgICB9CiAgICAgICAgfSB3aGlsZSAoKGN1cl9tYXRjaCA9IHByZXZbY3VyX21hdGNoICYgd21hc2tdKSA+IGxpbWl0ICYmIC0tY2hhaW5fbGVuZ3RoICE9PSAwKTsKICAgICAgICBpZiAoYmVzdF9sZW4gPD0gcy5sb29rYWhlYWQpIHsKICAgICAgICAgIHJldHVybiBiZXN0X2xlbjsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHMubG9va2FoZWFkOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZpbGxfd2luZG93KHMpIHsKICAgICAgICB2YXIgX3dfc2l6ZSA9IHMud19zaXplOwogICAgICAgIHZhciBwLCBuLCBtLCBtb3JlLCBzdHI7CiAgICAgICAgZG8gewogICAgICAgICAgbW9yZSA9IHMud2luZG93X3NpemUgLSBzLmxvb2thaGVhZCAtIHMuc3Ryc3RhcnQ7CiAgICAgICAgICBpZiAocy5zdHJzdGFydCA+PSBfd19zaXplICsgKF93X3NpemUgLSBNSU5fTE9PS0FIRUFEKSkgewogICAgICAgICAgICB1dGlscy5hcnJheVNldChzLndpbmRvdywgcy53aW5kb3csIF93X3NpemUsIF93X3NpemUsIDApOwogICAgICAgICAgICBzLm1hdGNoX3N0YXJ0IC09IF93X3NpemU7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgLT0gX3dfc2l6ZTsKICAgICAgICAgICAgcy5ibG9ja19zdGFydCAtPSBfd19zaXplOwogICAgICAgICAgICBuID0gcy5oYXNoX3NpemU7CiAgICAgICAgICAgIHAgPSBuOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgbSA9IHMuaGVhZFstLXBdOwogICAgICAgICAgICAgIHMuaGVhZFtwXSA9IG0gPj0gX3dfc2l6ZSA/IG0gLSBfd19zaXplIDogMDsKICAgICAgICAgICAgfSB3aGlsZSAoLS1uKTsKICAgICAgICAgICAgbiA9IF93X3NpemU7CiAgICAgICAgICAgIHAgPSBuOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgbSA9IHMucHJldlstLXBdOwogICAgICAgICAgICAgIHMucHJldltwXSA9IG0gPj0gX3dfc2l6ZSA/IG0gLSBfd19zaXplIDogMDsKICAgICAgICAgICAgfSB3aGlsZSAoLS1uKTsKICAgICAgICAgICAgbW9yZSArPSBfd19zaXplOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9pbiA9PT0gMCkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICAgIG4gPSByZWFkX2J1ZihzLnN0cm0sIHMud2luZG93LCBzLnN0cnN0YXJ0ICsgcy5sb29rYWhlYWQsIG1vcmUpOwogICAgICAgICAgcy5sb29rYWhlYWQgKz0gbjsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCArIHMuaW5zZXJ0ID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICBzdHIgPSBzLnN0cnN0YXJ0IC0gcy5pbnNlcnQ7CiAgICAgICAgICAgIHMuaW5zX2ggPSBzLndpbmRvd1tzdHJdOwogICAgICAgICAgICBzLmluc19oID0gKHMuaW5zX2ggPDwgcy5oYXNoX3NoaWZ0IF4gcy53aW5kb3dbc3RyICsgMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIHdoaWxlIChzLmluc2VydCkgewogICAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzdHIgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICBzLnByZXZbc3RyICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHN0cjsKICAgICAgICAgICAgICBzdHIrKzsKICAgICAgICAgICAgICBzLmluc2VydC0tOwogICAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCArIHMuaW5zZXJ0IDwgTUlOX01BVENIKSB7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9IHdoaWxlIChzLmxvb2thaGVhZCA8IE1JTl9MT09LQUhFQUQgJiYgcy5zdHJtLmF2YWlsX2luICE9PSAwKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX3N0b3JlZChzLCBmbHVzaCkgewogICAgICAgIHZhciBtYXhfYmxvY2tfc2l6ZSA9IDY1NTM1OwogICAgICAgIGlmIChtYXhfYmxvY2tfc2l6ZSA+IHMucGVuZGluZ19idWZfc2l6ZSAtIDUpIHsKICAgICAgICAgIG1heF9ibG9ja19zaXplID0gcy5wZW5kaW5nX2J1Zl9zaXplIC0gNTsKICAgICAgICB9CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPD0gMSkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwICYmIGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDApIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcy5zdHJzdGFydCArPSBzLmxvb2thaGVhZDsKICAgICAgICAgIHMubG9va2FoZWFkID0gMDsKICAgICAgICAgIHZhciBtYXhfc3RhcnQgPSBzLmJsb2NrX3N0YXJ0ICsgbWF4X2Jsb2NrX3NpemU7CiAgICAgICAgICBpZiAocy5zdHJzdGFydCA9PT0gMCB8fCBzLnN0cnN0YXJ0ID49IG1heF9zdGFydCkgewogICAgICAgICAgICBzLmxvb2thaGVhZCA9IHMuc3Ryc3RhcnQgLSBtYXhfc3RhcnQ7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgPSBtYXhfc3RhcnQ7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzLnN0cnN0YXJ0IC0gcy5ibG9ja19zdGFydCA+PSBzLndfc2l6ZSAtIE1JTl9MT09LQUhFQUQpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IDA7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMuc3Ryc3RhcnQgPiBzLmJsb2NrX3N0YXJ0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9mYXN0KHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGhhc2hfaGVhZDsKICAgICAgICB2YXIgYmZsdXNoOwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAg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QrKzsKICAgICAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgTUlOX01BVENIIC0gMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgICAgICBoYXNoX2hlYWQgPSBzLnByZXZbcy5zdHJzdGFydCAmIHMud19tYXNrXSA9IHMuaGVhZFtzLmluc19oXTsKICAgICAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICAgICAgfSB3aGlsZSAoLS1zLm1hdGNoX2xlbmd0aCAhPT0gMCk7CiAgICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHMuc3Ryc3RhcnQgKz0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSAwOwogICAgICAgICAgICAgIHMuaW5zX2ggPSBzLndpbmRvd1tzLnN0cnN0YXJ0XTsKICAgICAgICAgICAgICBzLmluc19oID0gKHMuaW5zX2ggPDwgcy5oYXNoX3NoaWZ0IF4gcy53aW5kb3dbcy5zdHJzdGFydCArIDFdKSAmIHMuaGFzaF9tYXNrOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBiZmx1c2ggPSB0cmVlcy5fdHJfdGFsbHkocywgMCwgcy53aW5kb3dbcy5zdHJzdGFydF0pOwogICAgICAgICAgICBzLmxvb2thaGVhZC0tOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5pbnNlcnQgPSBzLnN0cnN0YXJ0IDwgTUlOX01BVENIIC0gMSA/IHMuc3Ryc3RhcnQgOiBNSU5fTUFUQ0ggLSAxOwogICAgICAgIGlmIChmbHVzaCA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgdHJ1ZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX1NUQVJURUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX0RPTkU7CiAgICAgICAgfQogICAgICAgIGlmIChzLmxhc3RfbGl0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBCU19CTE9DS19ET05FOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVfc2xvdyhzLCBmbHVzaCkgewogICAgICAgIHZhciBoYXNoX2hlYWQ7CiAgICAgICAgdmFyIGJmbHVzaDsKICAgICAgICB2YXIgbWF4X2luc2VydDsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8IE1JTl9MT09LQUhFQUQpIHsKICAgICAgICAgICAgZmlsbF93aW5kb3cocyk7CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8IE1JTl9MT09LQUhFQUQgJiYgZmx1c2ggPT09IFpfTk9fRkxVU0gpIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogIC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KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzLnByZXZfbGVuZ3RoID49IE1JTl9NQVRDSCAmJiBzLm1hdGNoX2xlbmd0aCA8PSBzLnByZXZfbGVuZ3RoKSB7CiAgICAgICAgICAgIG1heF9pbnNlcnQgPSBzLnN0cnN0YXJ0ICsgcy5sb29rYWhlYWQgLSBNSU5fTUFUQ0g7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCBzLnN0cnN0YXJ0IC0gMSAtIHMucHJldl9tYXRjaCwgcy5wcmV2X2xlbmd0aCAtIE1JTl9NQVRDSCk7CiAgICAgICAgICAgIHMubG9va2FoZWFkIC09IHMucHJldl9sZW5ndGggLSAxOwogICAgICAgICAgICBzLnByZXZfbGVuZ3RoIC09IDI7CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBpZiAoKytzLnN0cnN0YXJ0IDw9IG1heF9pbnNlcnQpIHsKICAgICAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgTUlOX01BVENIIC0gMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgICAgICBoYXNoX2hlYWQgPSBzLnByZXZbcy5zdHJzdGFydCAmIHMud19tYXNrXSA9IHMuaGVhZFtzLmluc19oXTsKICAgICAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IHdoaWxlICgtLXMucHJldl9sZW5ndGggIT09IDApOwogICAgICAgICAgICBzLm1hdGNoX2F2YWlsYWJsZSA9IDA7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gTUlOX01BVENIIC0gMTsKICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgaWYgKHMubWF0Y2hfYXZhaWxhYmxlKSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0IC0gMV0pOwogICAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICBzLmxvb2thaGVhZC0tOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMTsKICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICBzLmxvb2thaGVhZC0tOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5tYXRjaF9hdmFpbGFibGUpIHsKICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0IC0gMV0pOwogICAgICAgICAgcy5tYXRjaF9hdmFpbGFibGUgPSAwOwogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IHMuc3Ryc3RhcnQgPCBNSU5fTUFUQ0ggLSAxID8gcy5zdHJzdGFydCA6IE1JTl9NQVRDSCAtIDE7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9ybGUocywgZmx1c2gpIHsKICAgICAgICB2YXIgYmZsdXNoOwogICAgICAgIHZhciBwcmV2OwogICAgICAgIHZhciBzY2FuLCBzdHJlbmQ7CiAgICAgICAgdmFyIF93aW4gPSBzLndpbmRvdzsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8PSBNQVhfTUFUQ0gpIHsKICAgICAgICAgICAgZmlsbF93aW5kb3cocyk7CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8PSBNQVhfTUFUQ0ggJiYgZmx1c2ggPT09IFpfTk9fRkxVU0gpIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIICYmIHMuc3Ryc3RhcnQgPiAwKSB7CiAgICAgICAgICAgIHNjYW4gPSBzLnN0cnN0YXJ0IC0gMTsKICAgICAgICAgICAgcHJldiA9IF93aW5bc2Nhbl07CiAgICAgICAgICAgIGlmIChwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSkgewogICAgICAgICAgICAgIHN0cmVuZCA9IHMuc3Ryc3RhcnQgKyBNQVhfTUFUQ0g7CiAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgIH0gd2hpbGUgKHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgc2NhbiA8IHN0cmVuZCk7CiAgICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBNQVhfTUFUQ0ggLSAoc3RyZW5kIC0gc2Nhbik7CiAgICAgICAgICAgICAgaWYgKHMubWF0Y2hfbGVuZ3RoID4gcy5sb29rYWhlYWQpIHsKICAgICAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gcy5sb29rYWhlYWQ7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAocy5tYXRjaF9sZW5ndGggPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAxLCBzLm1hdGNoX2xlbmd0aCAtIE1JTl9NQVRDSCk7CiAgICAgICAgICAgIHMubG9va2FoZWFkIC09IHMubWF0Y2hfbGVuZ3RoOwogICAgICAgICAgICBzLnN0cnN0YXJ0ICs9IHMubWF0Y2hfbGVuZ3RoOwogICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBiZmx1c2ggPSB0cmVlcy5fdHJfdGFsbHkocywgMCwgcy53aW5kb3dbcy5zdHJzdGFydF0pOwogICAgICAgICAgICBzLmxvb2thaGVhZC0tOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgIGlmIChmbHVzaCA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgdHJ1ZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX1NUQVJURUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX0RPTkU7CiAgICAgICAgfQogICAgICAgIGlmIChzLmxhc3RfbGl0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBCU19CTE9DS19ET05FOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVfaHVmZihzLCBmbHVzaCkgewogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDApIHsKICAgICAgICAgICAgZmlsbF93aW5kb3cocyk7CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICBzLmxvb2thaGVhZC0tOwogICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgaWYgKGJmbHVzaCkgewogICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5sYXN0X2xpdCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4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W5nID0gMDsKICAgICAgICB0aGlzLndyYXAgPSAwOwogICAgICAgIHRoaXMuZ3poZWFkID0gbnVsbDsKICAgICAgICB0aGlzLmd6aW5kZXggPSAwOwogICAgICAgIHRoaXMubWV0aG9kID0gWl9ERUZMQVRFRDsKICAgICAgICB0aGlzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICB0aGlzLndfc2l6ZSA9IDA7CiAgICAgICAgdGhpcy53X2JpdHMgPSAwOwogICAgICAgIHRoaXMud19tYXNrID0gMDsKICAgICAgICB0aGlzLndpbmRvdyA9IG51bGw7CiAgICAgICAgdGhpcy53aW5kb3dfc2l6ZSA9IDA7CiAgICAgICAgdGhpcy5wcmV2ID0gbnVsbDsKICAgICAgICB0aGlzLmhlYWQgPSBudWxsOwogICAgICAgIHRoaXMuaW5zX2ggPSAwOwogICAgICAgIHRoaXMuaGFzaF9zaXplID0gMDsKICAgICAgICB0aGlzLmhhc2hfYml0cyA9IDA7CiAgICAgICAgdGhpcy5oYXNoX21hc2sgPSAwOwogICAgICAgIHRoaXMuaGFzaF9zaGlmdCA9IDA7CiAgICAgICAgdGhpcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgdGhpcy5tYXRjaF9sZW5ndGggPSAwOwogICAgICAgIHRoaXMucHJldl9tYXRjaCA9IDA7CiAgICAgICAgdGhpcy5tYXRjaF9hdmFpbGFibGUgPSAwOwogICAgICAgIHRoaXMuc3Ryc3RhcnQgPSAwOwogICAgICAgIHRoaXMubWF0Y2hfc3RhcnQgPSAwOwogICAgICAgIHRoaXMubG9va2FoZWFkID0gMDsKICAgICAgICB0aGlzLnByZXZfbGVuZ3RoID0gMDsKICAgICAgICB0aGlzLm1heF9jaGFpbl9sZW5ndGggPSAwOwogICAgICAgIHRoaXMubWF4X2xhenlfbWF0Y2ggPSAwOwogICAgICAgIHRoaXMubGV2ZWwgPSAwOwogICAgICAgIHRoaXMuc3RyYXRlZ3kgPSAwOwogICAgICAgIHRoaXMuZ29vZF9tYXRj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IHRoaXMubWF0Y2hlcyA9IDA7CiAgICAgICAgdGhpcy5pbnNlcnQgPSAwOwogICAgICAgIHRoaXMuYmlfYnVmID0gMDsKICAgICAgICB0aGlzLmJpX3ZhbGlkID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlUmVzZXRLZWVwKHN0cm0pIHsKICAgICAgICB2YXIgczsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBzdHJtLnRvdGFsX2luID0gc3RybS50b3RhbF9vdXQgPSAwOwogICAgICAgIHN0cm0uZGF0YV90eXBlID0gWl9VTktOT1dOOwogICAgICAgIHMgPSBzdHJtLnN0YXRlOwogICAgICAgIHMucGVuZGluZyA9IDA7CiAgICAgICAgcy5wZW5kaW5nX291dCA9IDA7CiAgICAgICAgaWYgKHMud3JhcCA8IDApIHsKICAgICAgICAgIHMud3JhcCA9IC1zLndyYXA7CiAgICAgICAgfQogICAgICAgIHMuc3RhdHVzID0gcy53cmFwID8gSU5JVF9TVEFURSA6IEJVU1lfU1RBVEU7CiAgICAgICAgc3RybS5hZGxlciA9IHMud3JhcCA9PT0gMiA/IDAgOiAxOwogICAgICAgIHMubGFzdF9mbHVzaCA9IFpfTk9fRkxVU0g7CiAgICAgICAgdHJlZXMuX3RyX2luaXQocyk7CiAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZVJlc2V0KHN0cm0pIHsKICAgICAgICB2YXIgcmV0ID0gZGVmbGF0ZVJlc2V0S2VlcChzdHJtKTsKICAgICAgICBpZiAocmV0ID09PSBaX09LKSB7CiAgICAgICAgICBsbV9pbml0KHN0cm0uc3RhdGUpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmV0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVTZXRIZWFkZXIoc3RybSwgaGVhZCkgewogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBpZiAoc3RybS5zdGF0ZS53cmFwICE9PSAyKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0cm0uc3RhdGUuZ3poZWFkID0gaGVhZDsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlSW5pdDIoc3RybSwgbGV2ZWwsIG1ldGhvZCwgd2luZG93Qml0cywgbWVtTGV2ZWwsIHN0cmF0ZWd5KSB7CiAgICAgICAgaWYgKCFzdHJtKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHZhciB3cmFwID0gMTsKICAgICAgICBpZiAobGV2ZWwgPT09IFpfREVGQVVMVF9DT01QUkVTU0lPTikgewogICAgICAgICAgbGV2ZWwgPSA2OwogICAgICAgIH0KICAgICAgICBpZiAod2luZG93Qml0cyA8IDApIHsKICAgICAgICAgIHdyYXAgPSAwOwogICAgICAgICAgd2luZG93Qml0cyA9IC13aW5kb3dCaXRzOwogICAgICAgIH0gZWxzZSBpZiAod2luZG93Qml0cyA+IDE1KSB7CiAgICAgICAgICB3cmFwID0gMjsKICAgICAgICAgIHdpbmRvd0JpdHMgLT0gMTY7CiAgICAgICAgfQogICAgICAgIGlmIChtZW1MZXZlbCA8IDEgfHwgbWVtTGV2ZWwgPiBNQVhfTUVNX0xFVkVMIHx8IG1ldGhvZCAhPT0gWl9ERUZMQVRFRCB8fCB3aW5kb3dCaXRzIDwgOCB8fCB3aW5kb3dCaXRzID4gMTUgfHwgbGV2ZWwgPCAwIHx8IGxldmVsID4gOSB8fCBzdHJhdGVneSA8IDAgfHwgc3RyYXRlZ3kgPiBaX0ZJWEVEKSB7CiAgICAgICAgICByZXR1cm4gZXJyKHN0cm0sIFpfU1RSRUFNX0VSUk9SKTsKICAgICAgICB9CiAgICAgICAgaWYgKHdpbmRvd0JpdHMgPT09IDgpIHsKICAgICAgICAgIHdpbmRvd0JpdHMgPSA5OwogICAgICAgIH0KICAgICAgICB2YXIgcyA9IG5ldyBEZWZsYXRlU3RhdGUoKTsKICAgICAgICBzdHJtLnN0YXRlID0gczsKICAgICAgICBzLnN0cm0gPSBzdHJtOwogICAgICAgIHMud3JhcCA9IHdyYXA7CiAgICAgICAgcy5nemhlYWQgPSBudWxsOwogICAgICAgIHMud19iaXRzID0gd2luZG93Qml0czsKICAgICAgICBzLndfc2l6ZSA9IDEgPDwgcy53X2JpdHM7CiAgICAgICAgcy53X21hc2sgPSBzLndfc2l6ZSAtIDE7CiAgICAgICAgcy5oYXNoX2JpdHMgPSBtZW1MZXZlbCArIDc7CiAgICAgICAgcy5oYXNoX3NpemUgPSAxIDw8IHMuaGFzaF9iaXRzOwogICAgICAgIHMuaGFzaF9tYXNrID0gcy5oYXNoX3NpemUgLSAxOwogICAgICAgIHMuaGFzaF9zaGlmdCA9IH5+KChzLmhhc2hfYml0cyArIE1JTl9NQVRDSCAtIDEpIC8gTUlOX01BVENIKTsKICAgICAgICBzLndpbmRvdyA9IG5ldyB1dGlscy5CdWY4KHMud19zaXplICogMik7CiAgICAgICAgcy5oZWFkID0gbmV3IHV0aWxzLkJ1ZjE2KHMuaGFzaF9zaXplKTsKICAgICAgICBzLnByZXYgPSBuZXcgdXRpbHMuQnVmMTYocy53X3NpemUpOwogICAgICAgIHMubGl0X2J1ZnNpemUgPSAxIDw8IG1lbUxldmVsICsgNjsKICAgICAgICBzLnBlbmRpbmdfYnVmX3NpemUgPSBzLmxpdF9idWZzaXplICogNDsKICAgICAgICBzLnBlbmRpbmdfYnVmID0gbmV3IHV0aWxzLkJ1Zjgocy5wZW5kaW5nX2J1Zl9zaXplKTsKICAgICAgICBzLmRfYnVmID0g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RfZmx1c2ggPSBzLmxhc3RfZmx1c2g7CiAgICAgICAgcy5sYXN0X2ZsdXNoID0gZmx1c2g7CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBJTklUX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy53cmFwID09PSAyKSB7CiAgICAgICAgICAgIHN0cm0uYWRsZXIgPSAwOwogICAgICAgICAgICBwdXRfYnl0ZShzLCAzMSk7CiAgICAgICAgICAgIHB1dF9ieXRlKHMsIDEzOSk7CiAgICAgICAgICAgIHB1dF9ieXRlKHMsIDgpOwogICAgICAgICAgICBpZiAoIXMuZ3poZWFkKSB7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5sZXZlbCA9PT0gOSA/IDIgOiBzLnN0cmF0ZWd5ID49IFpfSFVGRk1BTl9PTkxZIHx8IHMubGV2ZWwgPCAyID8gNCA6IDApOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIE9TX0NPREUpOwogICAgICAgICAgICAgIHMuc3RhdHVzID0gQlVTWV9TVEFURTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAocy5nemhlYWQudGV4dCA/IDEgOiAwKSArIChzLmd6aGVhZC5oY3JjID8gMiA6IDApICsgKCFzLmd6aGVhZC5leHRyYSA/IDAgOiA0KSArICghcy5nemhlYWQubmFtZSA/IDAgOiA4KSArICghcy5nemhlYWQuY29tbWVudCA/IDAgOiAxNikpOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLnRpbWUgJiAyNTUpOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLnRpbWUgPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSA+PiAxNiAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSA+PiAyNCAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5sZXZlbCA9PT0gOSA/IDIgOiBzLnN0cmF0ZWd5ID49IFpfSFVGRk1BTl9PTkxZIHx8IHMubGV2ZWwgPCAyID8gNCA6IDApOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLm9zICYgMjU1KTsKICAgICAgICAgICAgICBpZiAocy5nemhlYWQuZXh0cmEgJiYgcy5nemhlYWQuZXh0cmEubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYS5sZW5ndGggJiAyNTUpOwogICAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQuZXh0cmEubGVuZ3RoID4+IDggJiAyNTUpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYykgewogICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZywgMCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBFWFRSQV9TVEFURTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdmFyIGhlYWRlciA9IFpfREVGTEFURUQgKyAocy53X2JpdHMgLSA4IDw8IDQpIDw8IDg7CiAgICAgICAgICAgIHZhciBsZXZlbF9mbGFncyA9IC0xOwogICAgICAgICAgICBpZiAocy5zdHJhdGVneSA+PSBaX0hVRkZNQU5fT05MWSB8fCBzLmxldmVsIDwgMikgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMDsKICAgICAgICAgICAgfSBlbHNlIGlmIChzLmxldmVsIDwgNikgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMTsKICAgICAgICAgICAgfSBlbHNlIGlmIChzLmxldmVsID09PSA2KSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAyOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGxldmVsX2ZsYWdzID0gMzsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXIgfD0gbGV2ZWxfZmxhZ3MgPDwgNjsKICAgICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgIT09IDApIHsKICAgICAgICAgICAgICBoZWFkZXIgfD0gUFJFU0VUX0RJQ1Q7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaGVhZGVyICs9IDMxIC0gaGVhZGVyICUgMzE7CiAgICAgICAgICAgIHMuc3RhdHVzID0gQlVTWV9TVEFURTsKICAgICAgICAgICAgcHV0U2hvcnRNU0IocywgaGVhZGVyKTsKICAgICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgIT09IDApIHsKICAgICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBzdHJtLmFkbGVyID4+PiAxNik7CiAgICAgICAgICAgICAgcHV0U2hvcnRNU0Iocywgc3RybS5hZGxlciAmIDY1NTM1KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzdHJtLmFkbGVyID0gMTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBFWFRSQV9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLmV4dHJhKSB7CiAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgd2hpbGUgKHMuZ3ppbmRleCA8IChzLmd6aGVhZC5leHRyYS5sZW5ndGggJiA2NTUzNSkpIHsKICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQuZXh0cmFbcy5nemluZGV4XSAmIDI1NSk7CiAgICAgICAgICAgICAgcy5nemluZGV4Kys7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5nemluZGV4ID09PSBzLmd6aGVhZC5leHRyYS5sZW5ndGgpIHsKICAgICAgICAgICAgICBzLmd6aW5kZXggPSAwOwogICAgICAgICAgICAgIHMuc3RhdHVzID0gTkFNRV9TVEFURTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5zdGF0dXMgPSBOQU1FX1NUQVRFOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5zdGF0dXMgPT09IE5BTUVfU1RBVEUpIHsKICAgICAgICAgIGlmIChzLmd6aGVhZC5uYW1lKSB7CiAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMihzdHJtLmFkbGVyLCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmcgLSBiZWcsIGJlZyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICAgIHZhbCA9IDE7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBpZiAocy5nemluZGV4IDwgcy5nemhlYWQubmFtZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHZhbCA9IHMuZ3poZWFkLm5hbWUuY2hhckNvZGVBdChzLmd6aW5kZXgrKykgJiAyNTU7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHZhbCA9IDA7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHZhbCk7CiAgICAgICAgICAgIH0gd2hpbGUgKHZhbCAhPT0gMCk7CiAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMihzdHJtLmFkbGVyLCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmcgLSBiZWcsIGJlZyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHZhbCA9PT0gMCkgewogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBDT01NRU5UX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IENPTU1FTlRfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gQ09NTUVOVF9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLmNvbW1lbnQpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgICAgdmFsID0gMTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPCBzLmd6aGVhZC5jb21tZW50Lmxlbmd0aCkgewogICAgICAgICAgICAgICAgdmFsID0gcy5nemhlYWQuY29tbWVudC5jaGFyQ29kZUF0KHMuZ3ppbmRleCsrKSAmIDI1NTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdmFsID0gMDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgdmFsKTsKICAgICAgICAgICAgfSB3aGlsZSAodmFsICE9PSAwKTsKICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodmFsID09PSAwKSB7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBIQ1JDX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IEhDUkNfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gSENSQ19TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMpIHsKICAgICAgICAgICAgaWYgKHMucGVuZGluZyArIDIgPiBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgKyAyIDw9IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgJiAyNTUpOwogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IEJVU1lfU1RBVEU7CiAgIC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OwogICAgICAgICAgfQogICAgICAgICAgaWYgKGJzdGF0ZSA9PT0gQlNfTkVFRF9NT1JFIHx8IGJzdGF0ZSA9PT0gQlNfRklOSVNIX1NUQVJURUQpIHsKICAgICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcy5sYXN0X2ZsdXNoID0gLTE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYnN0YXRlID09PSBCU19CTE9DS19ET05FKSB7CiAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9QQVJUSUFMX0ZMVVNIKSB7CiAgICAgICAgICAgICAgdHJlZXMuX3RyX2FsaWduKHMpOwogICAgICAgICAgICB9IGVsc2UgaWYgKGZsdXNoICE9PSBaX0JMT0NLKSB7CiAgICAgICAgICAgICAgdHJlZXMuX3RyX3N0b3JlZF9ibG9jayhzLCAwLCAwLCBmYWxzZSk7CiAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZVTExfRkxVU0gpIHsKICAgICAgICAgICAgICAgIHplcm8ocy5oZWFkKTsKICAgICAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzLnN0cnN0YXJ0ID0gMDsKICAgICAgICAgICAgICAgICAgcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgICAgICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcy5sYXN0X2ZsdXNoID0gLTE7CiAgICAgICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKGZsdXNoICE9PSBaX0ZJTklTSCkgewogICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgfQogICAgICAgIGlmIChzLndyYXAgPD0gMCkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VORDsKICAgICAgICB9CiAgICAgICAgaWYgKHMud3JhcCA9PT0gMikgewogICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyID4+IDggJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciA+PiAxNiAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyID4+IDI0ICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0udG90YWxfaW4gJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiA+PiA4ICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0udG90YWxfaW4gPj4gMTYgJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiA+PiAyNCAmIDI1NSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHB1dFNob3J0TVNCKHMsIHN0cm0uYWRsZXIgPj4+IDE2KTsKICAgICAgICAgIHB1dFNob3J0TVNCKHMsIHN0cm0uYWRsZXIgJiA2NTUzNSk7CiAgICAgICAgfQogICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgaWYgKHMud3JhcCA+IDApIHsKICAgICAgICAgIHMud3JhcCA9IC1zLndyYXA7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzLnBlbmRpbmcgIT09IDAgPyBaX09LIDogWl9TVFJFQU1fRU5EOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVFbmQoc3RybSkgewogICAgICAgIHZhciBzdGF0dXM7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXR1cyA9IHN0cm0uc3RhdGUuc3RhdHVzOwogICAgICAgIGlmIChzdGF0dXMgIT09IElOSVRfU1RBVEUgJiYgc3RhdHVzICE9PSBFWFRSQV9TVEFURSAmJiBzdGF0dXMgIT09IE5BTUVfU1RBVEUgJiYgc3RhdHVzICE9PSBDT01NRU5UX1NUQVRFICYmIHN0YXR1cyAhPT0gSENSQ19TVEFURSAmJiBzdGF0dXMgIT09IEJVU1lfU1RBVEUgJiYgc3RhdHVzICE9PSBGSU5JU0hfU1RBVEUpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBzdHJtLnN0YXRlID0gbnVsbDsKICAgICAgICByZXR1cm4gc3RhdHVzID09PSBCVVNZX1NUQVRFID8gZXJyKHN0cm0sIFpfREFUQV9FUlJPUikgOiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVTZXREaWN0aW9uYXJ5KHN0cm0sIGRpY3Rpb25hcnkpIHsKICAgICAgICB2YXIgZGljdExlbmd0aCA9IGRpY3Rpb25hcnkubGVuZ3RoOwogICAgICAgIHZhciBzOwogICAgICAgIHZhciBzdHIsIG47CiAgICAgICAgdmFyIHdyYXA7CiAgICAgICAgdmFyIGF2YWlsOwogICAgICAgIHZhciBuZXh0OwogICAgICAgIHZhciBpbnB1dDsKICAgICAgICB2YXIgdG1wRGljdDsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgd3JhcCA9IHMud3JhcDsKICAgICAgICBpZiAod3JhcCA9PT0gMiB8fCB3cmFwID09PSAxICYmIHMuc3RhdHVzICE9PSBJTklUX1NUQVRFIHx8IHMubG9va2FoZWFkKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmICh3cmFwID09PSAxKSB7CiAgICAgICAgICBzdHJtLmFkbGVyID0gYWRsZXIzMihzdHJtLmFkbGVyLCBkaWN0aW9uYXJ5LCBkaWN0TGVuZ3RoLCAwKTsKICAgICAgICB9CiAgICAgICAgcy53cmFwID0gMDsKICAgICAgICBpZiAoZGljdExlbmd0aCA+PSBzLndfc2l6ZSkgewogICAgICAgICAgaWYgKHdyYXAgPT09IDApIHsKICAgICAgICAgICAgemVybyhzLmhlYWQpOwogICAgICAgICAgICBzLnN0cnN0YXJ0ID0gMDsKICAgICAgICAgICAgcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIHRtcERpY3QgPSBuZXcgdXRpbHMuQnVmOChzLndfc2l6ZSk7CiAgICAgICAgICB1dGlscy5hcnJheVNldCh0bXBEaWN0LCBkaWN0aW9uYXJ5LCBkaWN0TGVuZ3RoIC0gcy53X3NpemUsIHMud19zaXplLCAwKTsKICAgICAgICAgIGRpY3Rpb25hcnkgPSB0bXBEaWN0OwogICAgICAgICAgZGljdExlbmd0aCA9IHMud19zaXplOwogICAgICAgIH0KICAgICAgICBhdmFpbCA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgbmV4dCA9IHN0cm0ubmV4dF9pbjsKICAgICAgICBpbnB1dCA9IHN0cm0uaW5wdXQ7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IGRpY3RMZW5ndGg7CiAgICAgICAgc3RybS5uZXh0X2luID0gMDsKICAgICAgICBzdHJtLmlucHV0ID0gZGljdGlvbmFyeTsKICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICB3aGlsZSAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICBzdHIgPSBzLnN0cnN0YXJ0OwogICAgICAgICAgbiA9IHMubG9va2FoZWFkIC0gKE1JTl9NQVRDSCAtIDEpOwogICAgICAgICAgZG8gewogICAgICAgICAgICBzLmluc19oID0gKHMuaW5zX2ggPDwgcy5oYXNoX3NoaWZ0IF4gcy53aW5kb3dbc3RyICsgTUlOX01BVENIIC0gMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIHMucHJldltzdHIgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHN0cjsKICAgICAgICAgICAgc3RyKys7CiAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgcy5zdHJzdGFydCA9IHN0cjsKICAgICAgICAgIHMubG9va2FoZWFkID0gTUlOX01BVENIIC0gMTsKICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgIH0KICAgICAgICBzLnN0cnN0YXJ0ICs9IHMubG9va2FoZWFkOwogICAgICAgIHMuYmxvY2tfc3RhcnQgPSBzLnN0cnN0YXJ0OwogICAgICAgIHMuaW5zZXJ0ID0gcy5sb29rYWhlYWQ7CiAgICAgICAgcy5sb29rYWhlYWQgPSAwOwogICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gcy5wcmV2X2xlbmd0aCA9IE1JTl9NQVRDSCAtIDE7CiAgICAgICAgcy5tYXRjaF9hdmFpbGFibGUgPSAwOwogICAgICAgIHN0cm0ubmV4dF9pbiA9IG5leHQ7CiAgICAgICAgc3RybS5pbnB1dCA9IGlucHV0OwogICAgICAgIHN0cm0uYXZhaWxfaW4gPSBhdmFpbDsKICAgICAgICBzLndyYXAgPSB3cmFwOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGV4cG9ydHMyLmRlZmxhdGVJbml0ID0gZGVmbGF0ZUluaXQ7CiAgICAgIGV4cG9ydHMyLmRlZmxhdGVJb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AgIH0KICAgICAgICAgIH0KICAgICAgICAgIGJ1Zl9sZW4gKz0gYyA8IDEyOCA/IDEgOiBjIDwgMjA0OCA/IDIgOiBjIDwgNjU1MzYgPyAzIDogNDsKICAgICAgICB9CiAgICAgICAgYnVmID0gbmV3IHV0aWxzLkJ1ZjgoYnVmX2xlbik7CiAgICAgICAgZm9yIChpID0gMCwgbV9wb3MgPSAwOyBpIDwgYnVmX2xlbjsgbV9wb3MrKykgewogICAgICAgICAgYyA9IHN0ci5jaGFyQ29kZUF0KG1fcG9zKTsKICAgICAgICAgIGlmICgoYyAmIDY0NTEyKSA9PT0gNTUyOTYgJiYgbV9wb3MgKyAxIDwgc3RyX2xlbikgewogICAgICAgICAgICBjMiA9IHN0ci5jaGFyQ29kZUF0KG1fcG9zICsgMSk7CiAgICAgICAgICAgIGlmICgoYzIgJiA2NDUxMikgPT09IDU2MzIwKSB7CiAgICAgICAgICAgICAgYyA9IDY1NTM2ICsgKGMgLSA1NTI5NiA8PCAxMCkgKyAoYzIgLSA1NjMyMCk7CiAgICAgICAgICAgICAgbV9wb3MrKzsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKGMgPCAxMjgpIHsKICAgICAgICAgICAgYnVmW2krK10gPSBjOwogICAgICAgICAgfSBlbHNlIGlmIChjIDwgMjA0OCkgewogICAgICAgICAgICBidWZbaSsrXSA9IDE5MiB8IGMgPj4+IDY7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTI4IHwgYyAmIDYzOwogICAgICAgICAgfSBlbHNlIGlmIChjIDwgNjU1MzYpIHsKICAgICAgICAgICAgYnVmW2krK10gPSAyMjQgfCBjID4+PiAxMjsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjID4+PiA2ICYgNjM7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTI4IHwgYyAmIDYzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgYnVmW2krK10gPSAyNDAgfCBjID4+PiAxODsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjID4+PiAxMiAmIDYzOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDYgJiA2MzsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBidWY7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGJ1ZjJiaW5zdHJpbmcoYnVmLCBsZW4pIHsKICAgICAgICBpZiAobGVuIDwgNjU1MzQpIHsKICAgICAgICAgIGlmIChidWYuc3ViYXJyYXkgJiYgU1RSX0FQUExZX1VJQV9PSyB8fCAhYnVmLnN1YmFycmF5ICYmIFNUUl9BUFBMWV9PSykgewogICAgICAgICAgICByZXR1cm4gU3RyaW5nLmZyb21DaGFyQ29kZS5hcHBseShudWxsLCB1dGlscy5zaHJpbmtCdWYoYnVmLCBsZW4pKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgdmFyIHJlc3VsdCA9ICIiOwogICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKICAgICAgICAgIHJlc3VsdCArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKGJ1ZltpXSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgIH0KICAgICAgZXhwb3J0czIuYnVmMmJpbnN0cmluZyA9IGZ1bmN0aW9uKGJ1ZikgewogICAgICAgIHJldHVybiBidWYyYmluc3RyaW5nKGJ1ZiwgYnVmLmxlbmd0aCk7CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLmJpbnN0cmluZzJidWYgPSBmdW5jdGlvbihzdHIpIHsKICAgICAgICB2YXIgYnVmID0gbmV3IHV0aWxzLkJ1Zjgoc3RyLmxlbmd0aCk7CiAgICAgICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IGJ1Zi5sZW5ndGg7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgYnVmW2ldID0gc3RyLmNoYXJDb2RlQXQoaSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBidWY7CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLmJ1ZjJzdHJpbmcgPSBmdW5jdGlvbihidWYsIG1heCkgewogICAgICAgIHZhciBpLCBvdXQsIGMsIGNfbGVuOwogICAgICAgIHZhciBsZW4gPSBtYXggfHwgYnVmLmxlbmd0aDsKICAgICAgICB2YXIgdXRmMTZidWYgPSBuZXcgQXJyYXkobGVuICogMik7CiAgICAgICAgZm9yIChvdXQgPSAwLCBpID0gMDsgaSA8IGxlbjsgKSB7CiAgICAgICAgICBjID0gYnVmW2krK107CiAgICAgICAgICBpZiAoYyA8IDEyOCkgewogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSBjOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGNfbGVuID0gX3V0ZjhsZW5bY107CiAgICAgICAgICBpZiAoY19sZW4gPiA0KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IDY1NTMzOwogICAgICAgICAgICBpICs9IGNfbGVuIC0gMTsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBjICY9IGNfbGVuID09PSAyID8gMzEgOiBjX2xlbiA9PT0gMyA/IDE1IDogNzsKICAgICAgICAgIHdoaWxlIChjX2xlbiA+IDEgJiYgaSA8IGxlbikgewogICAgICAgICAgICBjID0gYyA8PCA2IHwgYnVmW2krK10gJiA2MzsKICAgICAgICAgICAgY19sZW4tLTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChjX2xlbiA+IDEpIHsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNjU1MzM7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGMgPCA2NTUzNikgewogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSBjOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgYyAtPSA2NTUzNjsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNTUyOTYgfCBjID4+IDEwICYgMTAyMzsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNTYzMjAgfCBjICYgMTAyMzsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjJiaW5zdHJpbmcodXRmMTZidWYsIG91dCk7CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLnV0Zjhib3JkZXIgPSBmdW5jdGlvbihidWYsIG1heCkgewogICAgICAgIHZhciBwb3M7CiAgICAgICAgbWF4ID0gbWF4IHx8IGJ1Zi5sZW5ndGg7CiAgICAgICAgaWYgKG1heCA+IGJ1Zi5sZW5ndGgpIHsKICAgICAgICAgIG1heCA9IGJ1Zi5sZW5ndGg7CiAgICAgICAgfQogICAgICAgIHBvcyA9IG1heCAtIDE7CiAgICAgICAgd2hpbGUgKHBvcyA+PSAwICYmIChidWZbcG9zXSAmIDE5MikgPT09IDEyOCkgewogICAgICAgICAgcG9zLS07CiAgICAgICAgfQogICAgICAgIGlmIChwb3MgPCAwKSB7CiAgICAgICAgICByZXR1cm4gbWF4OwogICAgICAgIH0KICAgICAgICBpZiAocG9zID09PSAwKSB7CiAgICAgICAgICByZXR1cm4gbWF4OwogICAgICAgIH0KICAgICAgICByZXR1cm4gcG9zICsgX3V0ZjhsZW5bYnVmW3Bvc11dID4gbWF4ID8gcG9zIDogbWF4OwogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvenN0cmVhbS5qcwogIHZhciByZXF1aXJlX3pzdHJlYW0gPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvenN0cmVhbS5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIGZ1bmN0aW9uIFpTdHJlYW0oKSB7CiAgICAgICAgdGhpcy5pbnB1dCA9IG51bGw7CiAgICAgICAgdGhpcy5uZXh0X2luID0gMDsKICAgICAgICB0aGlzLmF2YWlsX2luID0gMDsKICAgICAgICB0aGlzLnRvdGFsX2luID0gMDsKICAgICAgICB0aGlzLm91dHB1dCA9IG51bGw7CiAgICAgICAgdGhpcy5uZXh0X291dCA9IDA7CiAgICAgICAgdGhpcy5hdmFpbF9vdXQgPSAwOwogICAgICAgIHRoaXMudG90YWxfb3V0ID0gMDsKICAgICAgICB0aGlzLm1zZyA9ICIiOwogICAgICAgIHRoaXMuc3RhdGUgPSBudWxsOwogICAgICAgIHRoaXMuZGF0YV90eXBlID0gMjsKICAgICAgICB0aGlzLmFkbGVyID0gMDsKICAgICAgfQogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBaU3RyZWFtOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL2RlZmxhdGUuanMKICB2YXIgcmVxdWlyZV9kZWZsYXRlMiA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvZGVmbGF0ZS5qcyIoZXhwb3J0czIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIHZhciB6bGliX2RlZmxhdGUgPSByZXF1aXJlX2RlZmxhdGUoKTsKICAgICAgdmFyIHV0aWxzID0gcmVxdWlyZV9jb21tb24oKTsKICAgICAgdmFyIHN0cmluZ3MgPSByZXF1aXJlX3N0cmluZ3MoKTsKICAgICAgdmFyIG1zZyA9IHJlcXVpcmVfbW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ogICAgICAgIH0KICAgICAgICBzdHJtLm5leHRfaW4gPSAwOwogICAgICAgIHN0cm0uYXZhaWxfaW4gPSBzdHJtLmlucHV0Lmxlbmd0aDsKICAgICAgICBkbyB7CiAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgc3RybS5vdXRwdXQgPSBuZXcgdXRpbHMuQnVmOChjaHVua1NpemUpOwogICAgICAgICAgICBzdHJtLm5leHRfb3V0ID0gMDsKICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBjaHVua1NpemU7CiAgICAgICAgICB9CiAgICAgICAgICBzdGF0dXMgPSB6bGliX2RlZmxhdGUuZGVmbGF0ZShzdHJtLCBfbW9kZSk7CiAgICAgICAgICBpZiAoc3RhdHVzICE9PSBaX1NUUkVBTV9FTkQgJiYgc3RhdHVzICE9PSBaX09LKSB7CiAgICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgICAgdGhpcy5lbmRlZCA9IHRydWU7CiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCB8fCBzdHJtLmF2YWlsX2luID09PSAwICYmIChfbW9kZSA9PT0gWl9GSU5JU0ggfHwgX21vZGUgPT09IFpfU1lOQ19GTFVTSDIpKSB7CiAgICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMudG8gPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgICAgdGhpcy5vbkRhdGEoc3RyaW5ncy5idWYyYmluc3RyaW5nKHV0aWxzLnNocmlua0J1ZihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCkpKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICB0aGlzLm9uRGF0YSh1dGlscy5zaHJpbmtCdWYoc3RybS5vdXRwdXQsIHN0cm0ubmV4dF9vdXQpKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKChzdHJtLmF2YWlsX2luID4gMCB8fCBzdHJtLmF2YWlsX291dCA9PT0gMCkgJiYgc3RhdHVzICE9PSBaX1NUUkVBTV9FTkQpOwogICAgICAgIGlmIChfbW9kZSA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlRW5kKHRoaXMuc3RybSk7CiAgICAgICAgICB0aGlzLm9uRW5kKHN0YXR1cyk7CiAgICAgICAgICB0aGlzLmVuZGVkID0gdHJ1ZTsKICAgICAgICAgIHJldHVybiBzdGF0dXMgPT09IFpfT0s7CiAgICAgICAgfQogICAgICAgIGlmIChfbW9kZSA9PT0gWl9TWU5DX0ZMVVNIMikgewogICAgICAgICAgdGhpcy5vbkVuZChaX09LKTsKICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gMDsKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgfTsKICAgICAgRGVmbGF0ZS5wcm90b3R5cGUub25EYXRhID0gZnVuY3Rpb24oY2h1bmspIHsKICAgICAgICB0aGlzLmNodW5rcy5wdXNoKGNodW5rKTsKICAgICAgfTsKICAgICAgRGVmbGF0ZS5wcm90b3R5cGUub25FbmQgPSBmdW5jdGlvbihzdGF0dXMpIHsKICAgICAgICBpZiAoc3RhdHVzID09PSBaX09LKSB7CiAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLnRvID09PSAic3RyaW5nIikgewogICAgICAgICAgICB0aGlzLnJlc3VsdCA9IHRoaXMuY2h1bmtzLmpvaW4oIiIpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdGhpcy5yZXN1bHQgPSB1dGlscy5mbGF0dGVuQ2h1bmtzKHRoaXMuY2h1bmtzKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgdGhpcy5jaHVua3MgPSBbXTsKICAgICAgICB0aGlzLmVyciA9IHN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ZXF1aXJlX2luZmZhc3QgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvaW5mZmFzdC5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIHZhciBCQUQgPSAzMDsKICAgICAgdmFyIFRZUEUgPSAxMjsKICAgICAgbW9kdWxlMi5leHBvcnRzID0gZnVuY3Rpb24gaW5mbGF0ZV9mYXN0KHN0cm0sIHN0YXJ0KSB7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIHZhciBfaW47CiAgICAgICAgdmFyIGxhc3Q7CiAgICAgICAgdmFyIF9vdXQ7CiAgICAgICAgdmFyIGJlZzsKICAgICAgICB2YXIgZW5kOwogICAgICAgIHZhciBkbWF4OwogICAgICAgIHZhciB3c2l6ZTsKICAgICAgICB2YXIgd2hhdmU7CiAgICAgICAgdmFyIHduZXh0OwogICAgICAgIHZhciBzX3dpbmRvdzsKICAgICAgICB2YXIgaG9sZDsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgbGNvZGU7CiAgICAgICAgdmFyIGRjb2RlOwogICAgICAgIHZhciBsbWFzazsKICAgICAgICB2YXIgZG1hc2s7CiAgICAgICAgdmFyIGhlcmU7CiAgICAgICAgdmFyIG9wOwogICAgICAgIHZhciBsZW47CiAgICAgICAgdmFyIGRpc3Q7CiAgICAgICAgdmFyIGZyb207CiAgICAgICAgdmFyIGZyb21fc291cmNlOwogICAgICAgIHZhciBpbnB1dCwgb3V0cHV0OwogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBfaW4gPSBzdHJtLm5leHRfaW47CiAgICAgICAgaW5wdXQgPSBzdHJtLmlucHV0OwogICAgICAgIGxhc3QgPSBfaW4gKyAoc3RybS5hdmFpbF9pbiAtIDUpOwogICAgICAgIF9vdXQgPSBzdHJtLm5leHRfb3V0OwogICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgIGJlZyA9IF9vdXQgLSAoc3RhcnQgLSBzdHJtLmF2YWlsX291dCk7CiAgICAgICAgZW5kID0gX291dCArIChzdHJtLmF2YWlsX291dCAtIDI1Nyk7CiAgICAgICAgZG1heCA9IHN0YXRlLmRtYXg7CiAgICAgICAgd3NpemUgPSBzdGF0ZS53c2l6ZTsKICAgICAgICB3aGF2ZSA9IHN0YXRlLndoYXZlOwogICAgICAgIHduZXh0ID0gc3RhdGUud25leHQ7CiAgICAgICAgc193aW5kb3cgPSBzdGF0ZS53aW5kb3c7CiAgICAgICAgaG9sZCA9IHN0YXRlLmhvbGQ7CiAgICAgICAgYml0cyA9IHN0YXRlLmJpdHM7CiAgICAgICAgbGNvZGUgPSBzdGF0ZS5sZW5jb2RlOwogICAgICAgIGRjb2RlID0gc3RhdGUuZGlzdGNvZGU7CiAgICAgICAgbG1hc2sgPSAoMSA8PCBzdGF0ZS5sZW5iaXRzKSAtIDE7CiAgICAgICAgZG1hc2sgPSAoMSA8PCBzdGF0ZS5kaXN0Yml0cykgLSAxOwogICAgICAgIHRvcDoKICAgICAgICAgIGRvIHsKICAgICAgICAgICAgaWYgKGJpdHMgPCAxNSkgewogICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGhlcmUgPSBsY29kZVtob2xkICYgbG1hc2tdOwogICAgICAgICAgICBkb2xlbjoKICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgIG9wID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICBiaXRzIC09IG9wOwogICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgIGlmIChvcCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAob3AgJiAxNikgewogICAgICAgICAgICAgICAgICBsZW4gPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgIG9wICY9IDE1OwogICAgICAgICAgICAgICAgICBpZiAob3ApIHsKICAgICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W19pbisrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBsZW4gKz0gaG9sZCAmICgxIDw8IG9wKSAtIDE7CiAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IG9wOwogICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gb3A7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGJpdHMgPCAxNSkgewogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBkY29kZVtob2xkICYgZG1hc2tdOwogICAgICAgICAgICAgICAgICBkb2Rpc3Q6CiAgICAgICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgICAgICBvcCA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IG9wOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgIG9wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgICBpZiAob3AgJiAxNikgewogICAgICAgICAgICAgICAgICAgICAgICBkaXN0ID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgICAgICBvcCAmPSAxNTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiaXRzIDwgb3ApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3QgKz0gaG9sZCAmICgxIDw8IG9wKSAtIDE7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXN0ID4gZG1heCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgdG9vIGZhciBiYWNrIjsKICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgIG9wID0gX291dCAtIGJlZzsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpc3QgPiBvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIG9wID0gZGlzdCAtIG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA+IHdoYXZlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuc2FuZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBzX3dpbmRvdzsKICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod25leHQgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gKz0gd3NpemUgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gb3V0cHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAod25leHQgPCBvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSArPSB3c2l6ZSArIHduZXh0IC0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcCAtPSB3bmV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHduZXh0IDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3AgPSB3bmV4dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tICs9IHduZXh0IC0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob3AgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBzX3dpbmRvd1tmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICgtLW9wKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGxlbiA+IDIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSAzOwogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuID4gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gMzsKICAgICAgICAgICAgICAgICAgICAgICAgICB9IHdoaWxlIChsZW4gPiAyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxlbiA+IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoKG9wICYgNjQpID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGhlcmUgPSBkY29kZVsoaGVyZSAmIDY1NTM1KSArIChob2xkICYgKDEgPDwgb3ApIC0gMSldOwogICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZSBkb2Rpc3Q7CiAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIGNvZGUiOwogICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhayB0b3A7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKChvcCAmIDY0KSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBoZXJlID0gbGNvZGVbKGhlcmUgJiA2NTUzNSkgKyAoaG9sZCAmICgxIDw8IG9wKSAtIDEpXTsKICAgICAgICAgICAgICAgICAgY29udGludWUgZG9sZW47CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG9wICYgMzIpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEU7CiAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgbGl0ZXJhbC9sZW5ndGggY29kZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgIH0gd2hpbGUgKF9pbiA8IGxhc3QgJiYgX291dCA8IGVuZCk7CiAgICAgICAgbGVuID0gYml0cyA+PiAzOwogICAgICAgIF9pbiAtPSBsZW47CiAgICAgICAgYml0cyAtPSBsZW4gPDwgMzsKICAgICAgICBob2xkICY9ICgxIDw8IGJpdHMpIC0gMTsKICAgICAgICBzdHJtLm5leHRfaW4gPSBfaW47CiAgICAgICAgc3RybS5uZXh0X291dCA9IF9vdXQ7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IF9pbiA8IGxhc3QgPyA1ICsgKGxhc3QgLSBfaW4pIDogNSAtIChfaW4gLSBsYXN0KTsKICAgICAgICBzdHJtLmF2YWlsX291dCA9IF9vdXQgPCBlbmQgPyAyNTcgKyAoZW5kIC0gX291dCkgOiAyNTcgLSAoX291dCAtIGVuZCk7CiAgICAgICAgc3RhdGUuaG9sZCA9IGhvbGQ7CiAgICAgICAgc3RhdGUuYml0cyA9IGJpdHM7CiAgICAgICAgcmV0dXJuOwogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvaW5mdHJlZXMuanMKICB2YXIgcmVxdWlyZV9pbmZ0cmVlcyA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9pbmZ0cmVlcy5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIHZhciB1dGlscyA9IHJlcXVpcmVfY29tbW9uKCk7CiAgICAgIHZhciBNQVhCSVRTID0gMTU7CiAgICAgIHZhciBFTk9VR0hfTEVOUyA9IDg1MjsKICAgICAgdmFyIEVOT1VHSF9ESVNUUyA9IDU5MjsKICAgICAgdmFyIENPREVTID0gMDsKICAgICAgdmFyIExFTlMgPSAxOwogICAgICB2YXIgRElTVFMgPSAyOwogICAgICB2YXIgbGJhc2UgPSBbCiAgICAgICAgMywKICAgICAgICA0LAogICAgICAgIDUsCiAgICAgICAgNiwKICAgICAgICA3LAogICAgICAgIDgsCiAgICAgICAgOSwKICAgICAgICAxMCwKICAgICAgICAxMSwKICAgICAgICAxMywKICAgICAgICAxNSwKICAgICAgICAxNywKICAgICAgICAxOSwKICAgICAgICAyMywKICAgICAgICAyNywKICAgICAgICAzMSwKICAgICAgICAzNSwKICAgICAgICA0MywKICAgICAgICA1MSwKICAgICAgICA1OSwKICAgICAgICA2NywKICAgICAgICA4MywKICAgICAgICA5OSwKICAgICAgICAxMTUsCiAgICAgICAgMTMxLAogICAgICAgIDE2MywKICAgICAgICAxOTUsCiAgICAgICAgMjI3LAogICAgICAgIDI1OCwKICAgICAgICAwLAogICAgICAgIDAKICAgICAgXTsKICAgICAgdmFyIGxleHQgPSBbCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMTYsCiAgICAgICAgNzIsCiAgICAgICAgNzgKICAgICAgXTsKICAgICAgdmFyIGRiYXNlID0gWwogICAgICAgIDEsCiAgICAgICAgMiwKICAgICAgICAzLAogICAgICAgIDQsCiAgICAgICAgNSwKICAgICAgICA3LAogICAgICAgIDksCiAgICAgICAgMTMsCiAgICAgICAgMTcsCiAgICAgICAgMjUsCiAgICAgICAgMzMsCiAgICAgICAgNDksCiAgICAgICAgNjUsCiAgICAgICAgOTcsCiAgICAgICAgMTI5LAogICAgICAgIDE5MywKICAgICAgICAyNTcsCiAgICAgICAgMzg1LAogICAgICAgIDUxMywKICAgICAgICA3NjksCiAgICAgICAgMTAyNSwKICAgICAgICAxNTM3LAogICAgICAgIDIwNDksCiAgICAgICAgMzA3MywKICAgICAgICA0MDk3LAogICAgICAgIDYxNDUsCiAgICAgICAgODE5MywKICAgICAgICAxMjI4OSwKICAgICAgICAxNjM4NSwKICAgICAgICAyNDU3NywKICAgICAgICAwLAogICAgICAgIDAKICAgICAgXTsKICAgICAgdmFyIGRleHQgPSBbCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTYsCiAgICAgICAgMTcsCiAgICAgICAgMTcsCiAgICAgICAgMTgsCiAgICAgICAgMTgsCiAgICAgICAgMTksCiAgICAgICAgMTksCiAgICAgICAgMjAsCiAgICAgICAgMjAsCiAgICAgICAgMjEsCiAgICAgICAgMjEsCiAgICAgICAgMjIsCiAgICAgICAgMjIsCiAgICAgICAgMjMsCiAgICAgICAgMjMsCiAgICAgICAgMjQsCiAgICAgICAgMjQsCiAgICAgICAgMjUsCiAgICAgICAgMjUsCiAgICAgICAgMjYsCiAgICAgICAgMjYsCiAgICAgICAgMjcsCiAgICAgICAgMjcsCiAgICAgICAgMjgsCiAgICAgICAgMjgsCiAgICAgICAgMjksCiAgICAgICAgMjksCiAgICAgICAgNjQsCiAgICAgICAgNjQKICAgICAgXTsKICAgICAgbW9kdWxlMi5leHBvcnRzID0gZnVuY3Rpb24gaW5mbGF0ZV90YWJsZSh0eXBlLCBsZW5zLCBsZW5zX2luZGV4LCBjb2RlcywgdGFibGUsIHRhYmxlX2luZGV4LCB3b3JrLCBvcHRzKSB7CiAgICAgICAgdmFyIGJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgdmFyIGxlbiA9IDA7CiAgICAgICAgdmFyIHN5bSA9IDA7CiAgICAgICAgdmFyIG1pbiA9IDAsIG1heCA9IDA7CiAgICAgICAgdmFyIHJvb3QyID0gMDsKICAgICAgICB2YXIgY3VyciA9IDA7CiAgICAgICAgdmFyIGRyb3AgPSAwOwogICAgICAgIHZhciBsZWZ0ID0gMDsKICAgICAgICB2YXIgdXNlZCA9IDA7CiAgICAgICAgdmFyIGh1ZmYgPSAwOwogICAgICAgIHZhciBpbmNyOwogICAgICAgIHZhciBmaWxsOwogICAgICAgIHZhciBsb3c7CiAgICAgICAgdmFyIG1hc2s7CiAgICAgICAgdmFyIG5leHQ7CiAgICAgICAgdmFyIGJhc2UgPSBudWxsOwogICAgICAgIHZhciBiYXNlX2luZGV4ID0gMDsKICAgICAgICB2YXIgZW5kOwogICAgICAgIHZhciBjb3VudCA9IG5ldyB1dGlscy5CdWYxNihNQVhCSVRTICsgMSk7CiAgICAgICAgdmFyIG9mZnMgPSBuZXcgdXRpbHMuQnVmMTYoTUFYQklUUyArIDEpOwogICAgICAgIHZhciBleHRyYSA9IG51bGw7CiAgICAgICAgdmFyIGV4dHJhX2luZGV4ID0gMDsKICAgICAgICB2YXIgaGVyZV9iaXRzLCBoZXJlX29wLCBoZXJlX3ZhbDsKICAgICAgICBmb3IgKGxlbiA9IDA7IGxlbiA8PSBNQVhCSVRTOyBsZW4rKykgewogICAgICAgICAgY291bnRbbGVuXSA9IDA7CiAgICAgICAgfQogICAgICAgIGZvciAoc3ltID0gMDsgc3ltIDwgY29kZXM7IHN5bSsrKSB7CiAgICAgICAgICBjb3VudFtsZW5zW2xlbnNfaW5kZXggKyBzeW1dXSsrOwogICAgICAgIH0KICAgICAgICByb290MiA9IGJpdHM7CiAgICAgICAgZm9yIChtYXggPSBNQVhCSVRTOyBtYXggPj0gMTsgbWF4LS0pIHsKICAgICAgICAgIGlmIChjb3VudFttYXhdICE9PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocm9vdDIgPiBtYXgpIHsKICAgICAgICAgIHJvb3QyID0gbWF4OwogICAgICAgIH0KICAgICAgICBpZiAobWF4ID09PSAwKSB7CiAgICAgICAgICB0YWJsZVt0YWJsZV9pbmRleCsrXSA9IDEgPDwgMjQgfCA2NCA8PCAxNiB8IDA7CiAgICAgICAgICB0YWJsZVt0YWJsZV9pbmRleCsrXSA9IDEgPDwgMjQgfCA2NCA8PCAxNiB8IDA7CiAgICAgICAgICBvcHRzLmJpdHMgPSAxOwogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgICAgIGZvciAobWluID0gMTsgbWluIDwgbWF4OyBtaW4rKykgewogICAgICAgICAgaWYgKGNvdW50W21pbl0gIT09IDApIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChyb290MiA8IG1pbikgewogICAgICAgICAgcm9vdDIgPSBtaW47CiAgICAgICAgfQogICAgICAgIGxlZnQgPSAxOwogICAgICAgIGZvciAobGVuID0gMTsgbGVuIDw9IE1BWEJJVFM7IGxlbisrKSB7CiAgICAgICAgICBsZWZ0IDw8PSAxOwogICAgICAgICAgbGVmdCAtPSBjb3VudFtsZW5dOwogICAgICAgICAgaWYgKGxlZnQgPCAwKSB7CiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKGxlZnQgPiAwICYmICh0eXBlID09PSBDT0RFUyB8fCBtYXggIT09IDEpKSB7CiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIG9mZnNbMV0gPSAwOwogICAgICAgIGZvciAobGVuID0gMTsgbGVuIDwgTUFYQklUUzsgbGVuKyspIHsKICAgICAgICAgIG9mZnNbbGVuICsgMV0gPSBvZmZzW2xlbl0gKyBjb3VudFtsZW5dOwogICAgICAgIH0KICAgICAgICBmb3IgKHN5bSA9IDA7IHN5bSA8IGNvZGVzOyBzeW0rKykgewogICAgICAgICAgaWYgKGxlbnNbbGVuc19pbmRleCArIHN5bV0gIT09IDApIHsKICAgICAgICAgICAgd29ya1tvZmZzW2xlbnNbbGVuc19pbmRleCArIHN5bV1dKytdID0gc3ltOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAodHlwZSA9PT0gQ09ERVMpIHsKICAgICAgICAgIGJhc2UgPSBleHRyYSA9IHdvcms7CiAgICAgICAgICBlbmQgPSAxOTsKICAgICAgICB9IGVsc2UgaWYgKHR5cGUgPT09IExFTlMpIHsKICAgICAgICAgIGJhc2UgPSBsYmFzZTsKICAgICAgICAgIGJhc2VfaW5kZXggLT0gMjU3OwogICAgICAgICAgZXh0cmEgPSBsZXh0OwogICAgICAgICAgZXh0cmFfaW5kZXggLT0gMjU3OwogICAgICAgICAgZW5kID0gMjU2OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBiYXNlID0gZGJhc2U7CiAgICAgICAgICBleHRyYSA9IGRleHQ7CiAgICAgICAgICBlbmQgPSAtMTsKICAgICAgICB9CiAgICAgICAgaHVmZiA9IDA7CiAgICAgICAgc3ltID0gMDsKICAgICAgICBsZW4gPSBtaW47CiAgICAgICAgbmV4dCA9IHRhYmxlX2luZGV4OwogICAgICAgIGN1cnIgPSByb290MjsKICAgICAgICBkcm9wID0gMDsKICAgICAgICBsb3cgPSAtMTsKICAgICAgICB1c2VkID0gMSA8PCByb290MjsKICAgICAgICBtYXNrID0gdXNlZCAtIDE7CiAgICAgICAgaWYgKHR5cGUgPT09IExFTlMgJiYgdXNlZCA+IEVOT1VHSF9MRU5TIHx8IHR5cGUgPT09IERJU1RTICYmIHVzZWQgPiBFTk9VR0hfRElTVFMpIHsKICAgICAgICAgIHJldHVybiAxOwogICAgICAgIH0KICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGhlcmVfYml0cyA9IGxlbiAtIGRyb3A7CiAgICAgICAgICBpZiAod29ya1tzeW1dIDwgZW5kKSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSAwOwogICAgICAgICAgICBoZXJlX3ZhbCA9IHdvcmtbc3ltXTsKICAgICAgICAgIH0gZWxzZSBpZiAod29ya1tzeW1dID4gZW5kKSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSBleHRyYVtleHRyYV9pbmRleCArIHdvcmtbc3ltXV07CiAgICAgICAgICAgIGhlcmVfdmFsID0gYmFzZVtiYXNlX2luZGV4ICsgd29ya1tzeW1dXTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGhlcmVfb3AgPSAzMiArIDY0OwogICAgICAgICAgICBoZXJlX3ZhbCA9IDA7CiAgICAgICAgICB9CiAgICAgICAgICBpbmNyID0gMSA8PCBsZW4gLSBkcm9wOwogICAgICAgICAgZmlsbCA9IDEgPDwgY3VycjsKICAgICAgICAgIG1pbiA9IGZpbGw7CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIGZpbGwgLT0gaW5jcjsKICAgICAgICAgICAgdGFibGVbbmV4dCArIChodWZmID4+IGRyb3ApICsgZmlsbF0gPSBoZXJlX2JpdHMgPDwgMjQgfCBoZXJlX29wIDw8IDE2IHwgaGVyZV92YWwgfCAwOwogICAgICAgICAgfSB3aGlsZSAoZmlsbCAhPT0gMCk7CiAgICAgICAgICBpbmNyID0gMSA8PCBsZW4gLSAxOwogICAgICAgICAgd2hpbGUgKGh1ZmYgJiBpbmNyKSB7CiAgICAgICAgICAgIGluY3IgPj49IDE7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoaW5jciAhPT0gMCkgewogICAgICAgICAgICBodWZmICY9IGluY3IgLSAxOwogICAgICAgICAgICBodWZmICs9IGluY3I7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBodWZmID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIHN5bSsrOwogICAgICAgICAgaWYgKC0tY291bnRbbGVuXSA9PT0gMCkgewogICAgICAgICAgICBpZiAobGVuID09PSBtYXgpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZW4gPSBsZW5zW2xlbnNfaW5kZXggKyB3b3JrW3N5bV1dOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGxlbiA+IHJvb3QyICYmIChodWZmICYgbWFzaykgIT09IGxvdykgewogICAgICAgICAgICBpZiAoZHJvcCA9PT0gMCkgewogICAgICAgICAgICAgIGRyb3AgPSByb290MjsKICAgICAgICAgICAgfQogICAgICAgICAgICBuZXh0ICs9IG1pbjsKICAgICAgICAgICAgY3VyciA9IGxlbiAtIGRyb3A7CiAgICAgICAgICAgIGxlZnQgPSAxIDw8IGN1cnI7CiAgICAgICAgICAgIHdoaWxlIChjdXJyICsgZHJvcCA8IG1heCkgewogICAgICAgICAgICAgIGxlZnQgLT0gY291bnRbY3VyciArIGRyb3BdOwogICAgICAgICAgICAgIGlmIChsZWZ0IDw9IDApIHsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBjdXJyKys7CiAgICAgICAgICAgICAgbGVmdCA8PD0gMTsKICAgICAgICAgICAgfQogICAgICAgICAgICB1c2VkICs9IDEgPDwgY3VycjsKICAgICAgICAgICAgaWYgKHR5cGUgPT09IExFTlMgJiYgdXNlZCA+IEVOT1VHSF9MRU5TIHx8IHR5cGUgPT09IERJU1RTICYmIHVzZWQgPiBFTk9VR0hfRElTVFMpIHsKICAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBsb3cgPSBodWZmICYgbWFzazsKICAgICAgICAgICAgdGFibGVbbG93XSA9IHJvb3QyIDw8IDI0IHwgY3VyciA8PCAxNiB8IG5leHQgLSB0YWJsZV9pbmRleCB8IDA7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChodWZmICE9PSAwKSB7CiAgICAgICAgICB0YWJsZVtuZXh0ICsgaHVmZl0gPSBsZW4gLSBkcm9wIDw8IDI0IHwgNjQgPDwgMTYgfCAwOwogICAgICAgIH0KICAgICAgICBvcHRzLmJpdHMgPSByb290MjsKICAgICAgICByZXR1cm4gMDsKICAgICAgfTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2luZmxhdGUuanMKICB2YXIgcmVxdWlyZV9pbmZsYXRlID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2luZmxhdGUuanMiKGV4cG9ydHMyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICB2YXIgdXRpbHMgPSByZXF1aXJlX2NvbW1vbigpOwogICAgICB2YXIgYWRsZXIzMiA9IHJlcXVpcmVfYWRsZXIzMigpOwogICAgICB2YXIgY3JjMzIgPSByZXF1aXJlX2NyYzMyKCk7CiAgICAgIHZhciBpbmZsYXRlX2Zhc3QgPSByZXF1aXJlX2luZmZhc3QoKTsKICAgICAgdmFyIGluZmxhdGVfdGFibGUgPSByZXF1aXJlX2luZnRyZWVzKCk7CiAgICAgIHZhciBDT0RFUyA9IDA7CiAgICAgIHZhciBMRU5TID0gMTsKICAgICAgdmFyIERJU1RTID0gMjsKICAgICAgdmFyIFpfRklOSVNIID0gNDsKICAgICAgdmFyIFpfQkxPQ0sgPSA1OwogICAgICB2YXIgWl9UUkVFUyA9IDY7CiAgICAgIHZhciBaX09LID0gMDsKICAgICAgdmFyIFpfU1RSRUFNX0VORCA9IDE7CiAgICAgIHZhciBaX05FRURfRElDVCA9IDI7CiAgICAgIHZhciBaX1NUUkVBTV9FUlJPUiA9IC0yOwogICAgICB2YXIgWl9EQVRBX0VSUk9SID0gLTM7CiAgICAgIHZhciBaX01FTV9FUlJPUiA9IC00OwogICAgICB2YXIgWl9CVUZfRVJST1IgPSAtNTsKICAgICAgdmFyIFpfREVGTEFURUQgPSA4OwogICAgICB2YXIgSEVBRCA9IDE7CiAgICAgIHZhciBGTEFHUyA9IDI7CiAgICAgIHZhciBUSU1FID0gMzsKICAgICAgdmFyIE9TID0gNDsKICAgICAgdmFyIEVYTEVOID0gNTsKICAgICAgdmFyIEVYVFJBID0gNjsKICAgICAgdmFyIE5BTUUgPSA3OwogICAgICB2YXIgQ09NTUVOVCA9IDg7CiAgICAgIHZhciBIQ1JDID0gOTsKICAgICAgdmFyIERJQ1RJRCA9IDEwOwogICAgICB2YXIgRElDVCA9IDExOwogICAgICB2YXIgVFlQRSA9IDEyOwogICAgICB2YXIgVFlQRURPID0gMTM7CiAgICAgIHZhciBTVE9SRUQgPSAxNDsKICAgICAgdmFyIENPUFlfID0gMTU7CiAgICAgIHZhciBDT1BZID0gMTY7CiAgICAgIHZhciBUQUJMRSA9IDE3OwogICAgICB2YXIgTEVOTEVOUyA9IDE4OwogICAgICB2YXIgQ09ERUxFTlMgPSAxOTsKICAgICAgdmFyIExFTl8gPSAyMDsKICAgICAgdmFyIExFTiA9IDIxOwogICAgICB2YXIgTEVORVhUID0gMjI7CiAgICAgIHZhciBESVNUID0gMjM7CiAgICAgIHZhciBESVNURVhUID0gMjQ7CiAgICAgIHZhciBNQVRDSCA9IDI1OwogICAgICB2YXIgTElUID0gMjY7CiAgICAgIHZhciBDSEVDSyA9IDI3OwogICAgICB2YXIgTEVOR1RIID0gMjg7CiAgICAgIHZhciBET05FID0gMjk7CiAgICAgIHZhciBCQUQgPSAzMDsKICAgICAgdmFyIE1FTSA9IDMxOwogICAgICB2YXIgU1lOQyA9IDMyOwogICAgICB2YXIgRU5PVUdIX0xFTlMgPSA4NTI7CiAgICAgIHZhciBFTk9VR0hfRElTVFMgPSA1OTI7CiAgICAgIHZhciBNQVhfV0JJVFMgPSAxNTsKICAgICAgdmFyIERFRl9XQklUUyA9IE1BWF9XQklUUzsKICAgICAgZnVuY3Rpb24genN3YXAzMihxKSB7CiAgICAgICAgcmV0dXJuIChxID4+PiAyNCAmIDI1NSkgKyAocSA+Pj4gOCAmIDY1MjgwKSArICgocSAmIDY1MjgwKSA8PCA4KSArICgocSAmIDI1NSkgPDwgMjQpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIEluZmxhdGVTdGF0ZSgpIHsKICAgICAgICB0aGlzLm1vZGUgPSAwOwogICAgICAgIHRoaXMubGFzdCA9IGZhbHNlOwogICAgICAgIHRoaXMud3JhcCA9IDA7CiAgICAgICAgdGhpcy5oYXZlZGljdCA9IGZhbHNlOwogICAgICAgIHRoaXMuZmxhZ3MgPSAwOwogICAgICAgIHRoaXMuZG1heCA9IDA7CiAgICAgICAgdGhpcy5jaGVjayA9IDA7CiAgICAgICAgdGhpcy50b3RhbCA9IDA7CiAgICAgICAgdGhpcy5oZWFkID0gbnVsbDsKICAgICAgICB0aGlzLndiaXRzID0gMDsKICAgICAgICB0aGlzLndzaXplID0gMDsKICAgICAgICB0aGlzLndoYXZlID0gMDsKICAgICAgICB0aGlzLnduZXh0ID0gMDsKICAgICAgICB0aGlzLndpbmRvdyA9IG51bGw7CiAgICAgICAgdGhpcy5ob2xkID0gMDsKICAgICAgICB0aGlzLmJpdHMgPSAwOwogICAgICAgIHRoaXMubGVuZ3RoID0gMDsKICAgICAgICB0aGlzLm9mZnNldCA9IDA7CiAgICAgICAgdGhpcy5leHRyYSA9IDA7CiAgICAgICAgdGhpcy5sZW5jb2RlID0gbnVsbDsKICAgICAgICB0aGlzLmRpc3Rjb2RlID0gbnVsbDsKICAgICAgICB0aGlzLmxlbmJpdHMgPSAwOwogICAgICAgIHRoaXMuZGlzdGJpdHMgPSAwOwogICAgICAgIHRoaXMubmNvZGUgPSAwOwogICAgICAgIHRoaXMubmxlbiA9IDA7CiAgICAgICAgdGhpcy5uZGlzdCA9IDA7CiAgICAgICAgdGhpcy5oYXZlID0gMDsKICAgICAgICB0aGlzLm5leHQgPSBudWxsOwogICAgICAgIHRoaXMubGVucyA9IG5ldyB1dGlscy5CdWYxNigzMjApOwogICAgICAgIHRoaXMud29yayA9IG5ldyB1dGlscy5CdWYxNigyODgpOwogICAgICAgIHRoaXMubGVuZHluID0gbnVsbDsKICAgICAgICB0aGlzLmRpc3RkeW4gPSBudWxsOwogICAgICAgIHRoaXMuc2FuZSA9IDA7CiAgICAgICAgd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FzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBzdGF0ZS53c2l6ZSA9IDA7CiAgICAgICAgc3RhdGUud2hhdmUgPSAwOwogICAgICAgIHN0YXRlLnduZXh0ID0gMDsKICAgICAgICByZXR1cm4gaW5mbGF0ZVJlc2V0S2VlcChzdHJtKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlUmVzZXQyKHN0cm0sIHdpbmRvd0JpdHMpIHsKICAgICAgICB2YXIgd3JhcDsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBpZiAod2luZG93Qml0cyA8IDApIHsKICAgICAgICAgIHdyYXAgPSAwOwogICAgICAgICAgd2luZG93Qml0cyA9IC13aW5kb3dCaXRzOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB3cmFwID0gKHdpbmRvd0JpdHMgPj4gNCkgKyAxOwogICAgICAgICAgaWYgKHdpbmRvd0JpdHMgPCA0OCkgewogICAgICAgICAgICB3aW5kb3dCaXRzICY9IDE1OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAod2luZG93Qml0cyAmJiAod2luZG93Qml0cyA8IDggfHwgd2luZG93Qml0cyA+IDE1KSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhdGUud2luZG93ICE9PSBudWxsICYmIHN0YXRlLndiaXRzICE9PSB3aW5kb3dCaXRzKSB7CiAgICAgICAgICBzdGF0ZS53aW5kb3cgPSBudWxsOwogICAgICAgIH0KICAgICAgICBzdGF0ZS53cmFwID0gd3JhcDsKICAgICAgICBzdGF0ZS53Yml0cyA9IHdpbmRvd0JpdHM7CiAgICAgICAgcmV0dXJuIGluZmxhdGVSZXNldChzdHJtKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlSW5pdDIoc3RybSwgd2luZG93Qml0cykgewogICAgICAgIHZhciByZXQ7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIGlmICghc3RybSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZSA9IG5ldyBJbmZsYXRlU3RhdGUoKTsKICAgICAgICBzdHJtLnN0YXRlID0gc3RhdGU7CiAgICAgICAgc3RhdGUud2luZG93ID0gbnVsbDsKICAgICAgICByZXQgPSBpbmZsYXRlUmVzZXQyKHN0cm0sIHdpbmRvd0JpdHMpOwogICAgICAgIGlmIChyZXQgIT09IFpfT0spIHsKICAgICAgICAgIHN0cm0uc3RhdGUgPSBudWxsOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmV0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVJbml0KHN0cm0pIHsKICAgICAgICByZXR1cm4gaW5mbGF0ZUluaXQyKHN0cm0sIERFRl9XQklUUyk7CiAgICAgIH0KICAgICAgdmFyIHZpcmdpbiA9IHRydWU7CiAgICAgIHZhciBsZW5maXg7CiAgICAgIHZhciBkaXN0Zml4OwogICAgICBmdW5jdGlvbiBmaXhlZHRhYmxlcyhzdGF0ZSkgewogICAgICAgIGlmICh2aXJnaW4pIHsKICAgICAgICAgIHZhciBzeW07CiAgICAgICAgICBsZW5maXggPSBuZXcgdXRpbHMuQnVmMzIoNTEyKTsKICAgICAgICAgIGRpc3RmaXggPSBuZXcgdXRpbHMuQnVmMzIoMzIpOwogICAgICAgICAgc3ltID0gMDsKICAgICAgICAgIHdoaWxlIChzeW0gPCAxNDQpIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA4OwogICAgICAgICAgfQogICAgICAgICAgd2hpbGUgKHN5bSA8IDI1NikgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDk7CiAgICAgICAgICB9CiAgICAgICAgICB3aGlsZSAoc3ltIDwgMjgwKSB7CiAgICAgICAgICAgIHN0YXRlLmxlbnNbc3ltKytdID0gNzsKICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzeW0gPCAyODgpIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA4OwogICAgICAgICAgfQogICAgICAgICAgaW5mbGF0ZV90YWJsZShMRU5TLCBzdGF0ZS5sZW5zLCAwLCAyODgsIGxlbmZpeCwgMCwgc3RhdGUud29yaywgeyBiaXRzOiA5IH0pOwogICAgICAgICAgc3ltID0gMDsKICAgICAgICAgIHdoaWxlIChzeW0gPCAzMikgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDU7CiAgICAgICAgICB9CiAgICAgICAgICBpbmZsYXRlX3RhYmxlKERJU1RTLCBzdGF0ZS5sZW5zLCAwLCAzMiwgZGlzdGZpeCwgMCwgc3RhdGUud29yaywgeyBiaXRzOiA1IH0pOwogICAgICAgICAgdmlyZ2luID0gZmFsc2U7CiAgICAgICAgfQogICAgICAgIHN0YXRlLmxlbmNvZGUgPSBsZW5maXg7CiAgICAgICAgc3RhdGUubGVuYml0cyA9IDk7CiAgICAgICAgc3RhdGUuZGlzdGNvZGUgPSBkaXN0Zml4OwogICAgICAgIHN0YXRlLmRpc3RiaXRzID0gNTsKICAgICAgfQogICAgICBmdW5jdGlvbiB1cGRhdGV3aW5kb3coc3RybSwgc3JjLCBlbmQsIGNvcHkpIHsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS53aW5kb3cgPT09IG51bGwpIHsKICAgICAgICAgIHN0YXRlLndzaXplID0gMSA8PCBzdGF0ZS53Yml0czsKICAgICAgICAgIHN0YXRlLnduZXh0ID0gMDsKICAgICAgICAgIHN0YXRlLndoYXZlID0gMDsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG5ldyB1dGlscy5CdWY4KHN0YXRlLndzaXplKTsKICAgICAgICB9CiAgICAgICAgaWYgKGNvcHkgPj0gc3RhdGUud3NpemUpIHsKICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0YXRlLndpbmRvdywgc3JjLCBlbmQgLSBzdGF0ZS53c2l6ZSwgc3RhdGUud3NpemUsIDApOwogICAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgICAgc3RhdGUud2hhdmUgPSBzdGF0ZS53c2l6ZTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZGlzdCA9IHN0YXRlLndzaXplIC0gc3RhdGUud25leHQ7CiAgICAgICAgICBpZiAoZGlzdCA+IGNvcHkpIHsKICAgICAgICAgICAgZGlzdCA9IGNvcHk7CiAgICAgICAgICB9CiAgICAgICAgICB1dGlscy5hcnJheVNldChzdGF0ZS53aW5kb3csIHNyYywgZW5kIC0gY29weSwgZGlzdCwgc3RhdGUud25leHQpOwogICAgICAgICAgY29weSAtPSBkaXN0OwogICAgICAgICAgaWYgKGNvcHkpIHsKICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUud2luZG93LCBzcmMsIGVuZCAtIGNvcHksIGNvcHksIDApOwogICAgICAgICAgICBzdGF0ZS53bmV4dCA9IGNvcHk7CiAgICAgICAgICAgIHN0YXRlLndoYXZlID0gc3RhdGUud3NpemU7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzdGF0ZS53bmV4dCArPSBkaXN0OwogICAgICAgICAgICBpZiAoc3RhdGUud25leHQgPT09IHN0YXRlLndzaXplKSB7CiAgICAgICAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzdGF0ZS53aGF2ZSA8IHN0YXRlLndzaXplKSB7CiAgICAgICAgICAgICAgc3RhdGUud2hhdmUgKz0gZGlzdDsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlKHN0cm0sIGZsdXNoKSB7CiAgICAgICAgdmFyIHN0YXRlOwogICAgICAgIHZhciBpbnB1dCwgb3V0cHV0OwogICAgICAgIHZhciBuZXh0OwogICAgICAgIHZhciBwdXQ7CiAgICAgICAgdmFyIGhhdmUsIGxlZnQ7CiAgICAgICAgdmFyIGhvbGQ7CiAgICAgICAgdmFyIGJpdHM7CiAgICAgICAgdmFyIF9pbiwgX291dDsKICAgICAgICB2YXIgY29weTsKICAgICAgICB2YXIgZnJvbTsKICAgICAgICB2YXIgZnJvbV9zb3VyY2U7CiAgICAgICAgdmFyIGhlcmUgPSAwOwogICAgICAgIHZhciBoZXJlX2JpdHMsIGhlcmVfb3AsIGhlcmVfdmFsOwogICAgICAgIHZhciBsYXN0X2JpdHMsIGxhc3Rfb3AsIGxhc3RfdmFsOwogICAgICAgIHZhciBsZW47CiAgICAgICAgdmFyIHJldDsKICAgICAgICB2YXIgaGJ1ZiA9IG5ldyB1dGlscy5CdWY4KDQpOwogICAgICAgIHZhciBvcHRzOwogICAgICAgIHZhciBuOwogICAgICAgIHZhciBvcmRlciA9IFsxNiwgMTcsIDE4LCAwLCA4LCA3LCA5LCA2LCAxMCwgNSwgMTEsIDQsIDEyLCAzLCAxMywgMiwgMTQsIDEsIDE1XTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUgfHwgIXN0cm0ub3V0cHV0IHx8ICFzdHJtLmlucHV0ICYmIHN0cm0uYXZhaWxfaW4gIT09IDApIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS5tb2RlID09PSBUWVBFKSB7CiAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRURPOwogICAgICAgIH0KICAgICAgICBwdXQgPSBzdHJtLm5leHRfb3V0OwogICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgIGxlZnQgPSBzdHJtLmF2YWlsX291dDsKICAgICAgICBuZXh0ID0gc3RybS5uZXh0X2luOwogICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICBoYXZlID0gc3RybS5hdmFpbF9pbjsKICAgICAgICBob2xkID0gc3RhdGUuaG9sZDsKICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICBfaW4gPSBoYXZlOwogICAgICAgIF9vdXQgPSBsZWZ0OwogICAgICAgIHJldCA9IFpfT0s7CiAgICAgICAgaW5mX2xlYXZlOgogICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgIHN3aXRjaCAoc3RhdGUubW9kZSkgewogICAgICAgICAgICAgIGNhc2UgSEVBRDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFRE87CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUud3JhcCAmIDIgJiYgaG9sZCA9PT0gMzU2MTUpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSAwOwogICAgICAgICAgICAgICAgICBoYnVmWzBdID0gaG9sZCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGhidWYsIDIsIDApOwogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBGTEFHUzsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5mbGFncyA9IDA7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmRvbmUgPSBmYWxzZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICghKHN0YXRlLndyYXAgJiAxKSB8fCAoKChob2xkICYgMjU1KSA8PCA4KSArIChob2xkID4+IDgpKSAlIDMxKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImluY29ycmVjdCBoZWFkZXIgY2hlY2siOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICgoaG9sZCAmIDE1KSAhPT0gWl9ERUZMQVRFRCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJ1bmtub3duIGNvbXByZXNzaW9uIG1ldGhvZCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IDQ7CiAgICAgICAgICAgICAgICBiaXRzIC09IDQ7CiAgICAgICAgICAgICAgICBsZW4gPSAoaG9sZCAmIDE1KSArIDg7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUud2JpdHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgc3RhdGUud2JpdHMgPSBsZW47CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGxlbiA+IHN0YXRlLndiaXRzKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgd2luZG93IHNpemUiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmRtYXggPSAxIDw8IGxlbjsKICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDE7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gaG9sZCAmIDUxMiA/IERJQ1RJRCA6IFRZUEU7CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBGTEFHUzoKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZmxhZ3MgPSBob2xkOwogICAgICAgICAgICAgICAgaWYgKChzdGF0ZS5mbGFncyAmIDI1NSkgIT09IFpfREVGTEFURUQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAidW5rbm93biBjb21wcmVzc2lvbiBtZXRob2QiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDU3MzQ0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInVua25vd24gaGVhZGVyIGZsYWdzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC50ZXh0ID0gaG9sZCA+PiA4ICYgMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICBoYnVmWzBdID0gaG9sZCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGhidWYsIDIsIDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUSU1FOwogICAgICAgICAgICAgIGNhc2UgVElNRToKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC50aW1lID0gaG9sZDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICBoYnVmWzBdID0gaG9sZCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhidWZbMl0gPSBob2xkID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlszXSA9IGhvbGQgPj4+IDI0ICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyKHN0YXRlLmNoZWNrLCBoYnVmLCA0LCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gT1M7CiAgICAgICAgICAgICAgY2FzZSBPUzoKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC54ZmxhZ3MgPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLm9zID0gaG9sZCA+PiA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEVYTEVOOwogICAgICAgICAgICAgIGNhc2UgRVhMRU46CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAxMDI0KSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5leHRyYV9sZW4gPSBob2xkOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhidWZbMV0gPSBob2xkID4+PiA4ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGhidWYsIDIsIDApOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBFWFRSQTsKICAgICAgICAgICAgICBjYXNlIEVYVFJBOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMTAyNCkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IGhhdmUpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5ID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSkgewogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgICAgICBsZW4gPSBzdGF0ZS5oZWFkLmV4dHJhX2xlbiAtIHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgICAgICAgIGlmICghc3RhdGUuaGVhZC5leHRyYSkgewogICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhID0gbmV3IEFycmF5KHN0YXRlLmhlYWQuZXh0cmFfbGVuKTsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0YXRlLmhlYWQuZXh0cmEsIGlucHV0LCBuZXh0LCBjb3B5LCBsZW4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGlucHV0LCBjb3B5LCBuZXh0KTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZSAtPSBjb3B5OwogICAgICAgICAgICAgICAgICAgIG5leHQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IE5BTUU7CiAgICAgICAgICAgICAgY2FzZSBOQU1FOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgMjA0OCkgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBjb3B5ID0gMDsKICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgIGxlbiA9IGlucHV0W25leHQgKyBjb3B5KytdOwogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkICYmIGxlbiAmJiBzdGF0ZS5sZW5ndGggPCA2NTUzNikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5uYW1lICs9IFN0cmluZy5mcm9tQ2hhckNvZGUobGVuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiAmJiBjb3B5IDwgaGF2ZSk7CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGlucHV0LCBjb3B5LCBuZXh0KTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIG5leHQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgaWYgKGxlbikgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQubmFtZSA9IG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPTU1FTlQ7CiAgICAgICAgICAgICAgY2FzZSBDT01NRU5UOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNDA5NikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBjb3B5ID0gMDsKICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgIGxlbiA9IGlucHV0W25leHQgKyBjb3B5KytdOwogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkICYmIGxlbiAmJiBzdGF0ZS5sZW5ndGggPCA2NTUzNikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5jb21tZW50ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUobGVuKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiAmJiBjb3B5IDwgaGF2ZSk7CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGlucHV0LCBjb3B5LCBuZXh0KTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIG5leHQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgaWYgKGxlbikgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuY29tbWVudCA9IG51bGw7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gSENSQzsKICAgICAgICAgICAgICBjYXNlIEhDUkM6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhvbGQgIT09IChzdGF0ZS5jaGVjayAmIDY1NTM1KSkgewogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImhlYWRlciBjcmMgbWlzbWF0Y2giOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5oY3JjID0gc3RhdGUuZmxhZ3MgPj4gOSAmIDE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZG9uZSA9IHRydWU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEU7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIERJQ1RJRDoKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0genN3YXAzMihob2xkKTsKICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRElDVDsKICAgICAgICAgICAgICBjYXNlIERJQ1Q6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZWRpY3QgPT09IDApIHsKICAgICAgICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBsZWZ0OwogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaG9sZCA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgICAgICAgICAgICByZXR1cm4gWl9ORUVEX0RJQ1Q7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSAxOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEU7CiAgICAgICAgICAgICAgY2FzZSBUWVBFOgogICAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX0JMT0NLIHx8IGZsdXNoID09PSBaX1RSRUVTKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBjYXNlIFRZUEVETzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5sYXN0KSB7CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBiaXRzICYgNzsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBiaXRzICYgNzsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENIRUNLOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMykgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sYXN0ID0gaG9sZCAmIDE7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gMTsKICAgICAgICAgICAgICAgIGJpdHMgLT0gMTsKICAgICAgICAgICAgICAgIHN3aXRjaCAoaG9sZCAmIDMpIHsKICAgICAgICAgICAgICAgICAgY2FzZSAwOgogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBTVE9SRUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICBmaXhlZHRhYmxlcyhzdGF0ZSk7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTl87CiAgICAgICAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX1RSRUVTKSB7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gMjsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gMjsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVEFCTEU7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIGNhc2UgMzoKICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGJsb2NrIHR5cGUiOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gMjsKICAgICAgICAgICAgICAgIGJpdHMgLT0gMjsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgU1RPUkVEOgogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgYml0cyAtPSBiaXRzICYgNzsKICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKChob2xkICYgNjU1MzUpICE9PSAoaG9sZCA+Pj4gMTYgXiA2NTUzNSkpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBzdG9yZWQgYmxvY2sgbGVuZ3RocyI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoID0gaG9sZCAmIDY1NTM1OwogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT1BZXzsKICAgICAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9UUkVFUykgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgY2FzZSBDT1BZXzoKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT1BZOwogICAgICAgICAgICAgIGNhc2UgQ09QWToKICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICBpZiAoY29weSkgewogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IGhhdmUpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5ID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IGxlZnQpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5ID0gbGVmdDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB1dGlscy5hcnJheVNldChvdXRwdXQsIGlucHV0LCBuZXh0LCBjb3B5LCBwdXQpOwogICAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIG5leHQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgbGVmdCAtPSBjb3B5OwogICAgICAgICAgICAgICAgICBwdXQgKz0gY29weTsKICAgICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEU7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIFRBQkxFOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNCkgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5ubGVuID0gKGhvbGQgJiAzMSkgKyAyNTc7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNTsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNTsKICAgICAgICAgICAgICAgIHN0YXRlLm5kaXN0ID0gKGhvbGQgJiAzMSkgKyAxOwogICAgICAgICAgICAgICAgaG9sZCA+Pj49IDU7CiAgICAgICAgICAgICAgICBiaXRzIC09IDU7CiAgICAgICAgICAgICAgICBzdGF0ZS5uY29kZSA9IChob2xkICYgMTUpICsgNDsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA0OwogICAgICAgICAgICAgICAgYml0cyAtPSA0OwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLm5sZW4gPiAyODYgfHwgc3RhdGUubmRpc3QgPiAzMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJ0b28gbWFueSBsZW5ndGggb3IgZGlzdGFuY2Ugc3ltYm9scyI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuaGF2ZSA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOTEVOUzsKICAgICAgICAgICAgICBjYXNlIExFTkxFTlM6CiAgICAgICAgICAgICAgICB3aGlsZSAoc3RhdGUuaGF2ZSA8IHN0YXRlLm5jb2RlKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMykgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUubGVuc1tvcmRlcltzdGF0ZS5oYXZlKytdXSA9IGhvbGQgJiA3OwogICAgICAgICAgICAgICAgICBob2xkID4+Pj0gMzsKICAgICAgICAgICAgICAgICAgYml0cyAtPSAzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKHN0YXRlLmhhdmUgPCAxOSkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW29yZGVyW3N0YXRlLmhhdmUrK11dID0gMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmNvZGUgPSBzdGF0ZS5sZW5keW47CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5iaXRzID0gNzsKICAgICAgICAgICAgICAgIG9wdHMgPSB7IGJpdHM6IHN0YXRlLmxlbmJpdHMgfTsKICAgICAgICAgICAgICAgIHJldCA9IGluZmxhdGVfdGFibGUoQ09ERVMsIHN0YXRlLmxlbnMsIDAsIDE5LCBzdGF0ZS5sZW5jb2RlLCAwLCBzdGF0ZS53b3JrLCBvcHRzKTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgICAgICAgICBpZiAocmV0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgY29kZSBsZW5ndGhzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuaGF2ZSA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ09ERUxFTlM7CiAgICAgICAgICAgICAgY2FzZSBDT0RFTEVOUzoKICAgICAgICAgICAgICAgIHdoaWxlIChzdGF0ZS5oYXZlIDwgc3RhdGUubmxlbiArIHN0YXRlLm5kaXN0KSB7CiAgICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5sZW5jb2RlW2hvbGQgJiAoMSA8PCBzdGF0ZS5sZW5iaXRzKSAtIDFdOwogICAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgICBoZXJlX3ZhbCA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgICBpZiAoaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChoZXJlX3ZhbCA8IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBoZXJlX3ZhbDsKICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGVyZV92YWwgPT09IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgMjsKICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGJpdCBsZW5ndGggcmVwZWF0IjsKICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICBsZW4gPSBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUgLSAxXTsKICAgICAgICAgICAgICAgICAgICAgIGNvcHkgPSAzICsgKGhvbGQgJiAzKTsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaGVyZV92YWwgPT09IDE3KSB7CiAgICAgICAgICAgICAgICAgICAgICBuID0gaGVyZV9iaXRzICsgMzsKICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBsZW4gPSAwOwogICAgICAgICAgICAgICAgICAgICAgY29weSA9IDMgKyAoaG9sZCAmIDcpOwogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IDM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IDM7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyA3OwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICBjb3B5ID0gMTEgKyAoaG9sZCAmIDEyNyk7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gNzsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gNzsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhhdmUgKyBjb3B5ID4gc3RhdGUubmxlbiArIHN0YXRlLm5kaXN0KSB7CiAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGJpdCBsZW5ndGggcmVwZWF0IjsKICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGNvcHktLSkgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUubGVuc1tzdGF0ZS5oYXZlKytdID0gbGVuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IEJBRCkgewogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5sZW5zWzI1Nl0gPT09IDApIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBjb2RlIC0tIG1pc3NpbmcgZW5kLW9mLWJsb2NrIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5iaXRzID0gOTsKICAgICAgICAgICAgICAgIG9wdHMgPSB7IGJpdHM6IHN0YXRlLmxlbmJpdHMgfTsKICAgICAgICAgICAgICAgIHJldCA9IGluZmxhdGVfdGFibGUoTEVOUywgc3RhdGUubGVucywgMCwgc3RhdGUubmxlbiwgc3RhdGUubGVuY29kZSwgMCwgc3RhdGUud29yaywgb3B0cyk7CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5iaXRzID0gb3B0cy5iaXRzOwogICAgICAgICAgICAgICAgaWYgKHJldCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGxpdGVyYWwvbGVuZ3RocyBzZXQiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmRpc3RiaXRzID0gNjsKICAgICAgICAgICAgICAgIHN0YXRlLmRpc3Rjb2RlID0gc3RhdGUuZGlzdGR5bjsKICAgICAgICAgICAgICAgIG9wdHMgPSB7IGJpdHM6IHN0YXRlLmRpc3RiaXRzIH07CiAgICAgICAgICAgICAgICByZXQgPSBpbmZsYXRlX3RhYmxlKERJU1RTLCBzdGF0ZS5sZW5zLCBzdGF0ZS5ubGVuLCBzdGF0ZS5uZGlzdCwgc3RhdGUuZGlzdGNvZGUsIDAsIHN0YXRlLndvcmssIG9wdHMpOwogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgICAgICAgICBpZiAocmV0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2VzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTl87CiAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGNhc2UgTEVOXzoKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU47CiAgICAgICAgICAgICAgY2FzZSBMRU46CiAgICAgICAgICAgICAgICBpZiAoaGF2ZSA+PSA2ICYmIGxlZnQgPj0gMjU4KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSBwdXQ7CiAgICAgICAgICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gbGVmdDsKICAgICAgICAgICAgICAgICAgc3RybS5uZXh0X2luID0gbmV4dDsKICAgICAgICAgICAgICAgICAgc3RybS5hdmFpbF9pbiA9IGhhdmU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhvbGQgPSBob2xkOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iaXRzID0gYml0czsKICAgICAgICAgICAgICAgICAgaW5mbGF0ZV9mYXN0KHN0cm0sIF9vdXQpOwogICAgICAgICAgICAgICAgICBwdXQgPSBzdHJtLm5leHRfb3V0OwogICAgICAgICAgICAgICAgICBvdXRwdXQgPSBzdHJtLm91dHB1dDsKICAgICAgICAgICAgICAgICAgbGVmdCA9IHN0cm0uYXZhaWxfb3V0OwogICAgICAgICAgICAgICAgICBuZXh0ID0gc3RybS5uZXh0X2luOwogICAgICAgICAgICAgICAgICBpbnB1dCA9IHN0cm0uaW5wdXQ7CiAgICAgICAgICAgICAgICAgIGhhdmUgPSBzdHJtLmF2YWlsX2luOwogICAgICAgICAgICAgICAgICBob2xkID0gc3RhdGUuaG9sZDsKICAgICAgICAgICAgICAgICAgYml0cyA9IHN0YXRlLmJpdHM7CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5tb2RlID09PSBUWVBFKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuYmFjayA9IC0xOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuYmFjayA9IDA7CiAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgaGVyZSA9IHN0YXRlLmxlbmNvZGVbaG9sZCAmICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICBoZXJlX29wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICBpZiAoaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCAmJiAoaGVyZV9vcCAmIDI0MCkgPT09IDApIHsKICAgICAgICAgICAgICAgICAgbGFzdF9iaXRzID0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICBsYXN0X29wID0gaGVyZV9vcDsKICAgICAgICAgICAgICAgICAgbGFzdF92YWwgPSBoZXJlX3ZhbDsKICAgICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgICAgaGVyZSA9IHN0YXRlLmxlbmNvZGVbbGFzdF92YWwgKyAoKGhvbGQgJiAoMSA8PCBsYXN0X2JpdHMgKyBsYXN0X29wKSAtIDEpID4+IGxhc3RfYml0cyldOwogICAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgICBoZXJlX3ZhbCA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgICBpZiAobGFzdF9iaXRzICsgaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgLT0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IGxhc3RfYml0czsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTElUOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYgMzIpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuYmFjayA9IC0xOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCAmIDY0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgbGl0ZXJhbC9sZW5ndGggY29kZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZXh0cmEgPSBoZXJlX29wICYgMTU7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVORVhUOwogICAgICAgICAgICAgIGNhc2UgTEVORVhUOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmV4dHJhKSB7CiAgICAgICAgICAgICAgICAgIG4gPSBzdGF0ZS5leHRyYTsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggKz0gaG9sZCAmICgxIDw8IHN0YXRlLmV4dHJhKSAtIDE7CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBzdGF0ZS5leHRyYTsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBzdGF0ZS5leHRyYTsKICAgICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBzdGF0ZS5leHRyYTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLndhcyA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESVNUOwogICAgICAgICAgICAgIGNhc2UgRElTVDoKICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUuZGlzdGNvZGVbaG9sZCAmICgxIDw8IHN0YXRlLmRpc3RiaXRzKSAtIDFdOwogICAgICAgICAgICAgICAgICBoZXJlX2JpdHMgPSBoZXJlID4+PiAyNDsKICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICBoZXJlX3ZhbCA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgaWYgKGhlcmVfYml0cyA8PSBiaXRzKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKChoZXJlX29wICYgMjQwKSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBsYXN0X2JpdHMgPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgIGxhc3Rfb3AgPSBoZXJlX29wOwogICAgICAgICAgICAgICAgICBsYXN0X3ZhbCA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUuZGlzdGNvZGVbbGFzdF92YWwgKyAoKGhvbGQgJiAoMSA8PCBsYXN0X2JpdHMgKyBsYXN0X29wKSAtIDEpID4+IGxhc3RfYml0cyldOwogICAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgICBoZXJlX3ZhbCA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgICBpZiAobGFzdF9iaXRzICsgaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgLT0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IGxhc3RfYml0czsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgaWYgKGhlcmVfb3AgJiA2NCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIGNvZGUiOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm9mZnNldCA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgc3RhdGUuZXh0cmEgPSBoZXJlX29wICYgMTU7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRElTVEVYVDsKICAgICAgICAgICAgICBjYXNlIERJU1RFWFQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZXh0cmEpIHsKICAgICAgICAgICAgICAgICAgbiA9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHN0YXRlLm9mZnNldCArPSBob2xkICYgKDEgPDwgc3RhdGUuZXh0cmEpIC0gMTsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBiaXRzIC09IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLm9mZnNldCA+IHN0YXRlLmRtYXgpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2siOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBNQVRDSDsKICAgICAgICAgICAgICBjYXNlIE1BVENIOgogICAgICAgICAgICAgICAgaWYgKGxlZnQgPT09IDApIHsKICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgY29weSA9IF9vdXQgLSBsZWZ0OwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLm9mZnNldCA+IGNvcHkpIHsKICAgICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLm9mZnNldCAtIGNvcHk7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gc3RhdGUud2hhdmUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuc2FuZSkgewogICAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2siOwogICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IHN0YXRlLnduZXh0KSB7CiAgICAgICAgICAgICAgICAgICAgY29weSAtPSBzdGF0ZS53bmV4dDsKICAgICAgICAgICAgICAgICAgICBmcm9tID0gc3RhdGUud3NpemUgLSBjb3B5OwogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGZyb20gPSBzdGF0ZS53bmV4dCAtIGNvcHk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGNvcHkgPiBzdGF0ZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5ID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gc3RhdGUud2luZG93OwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7CiAgICAgICAgICAgICAgICAgIGZyb20gPSBwdXQgLSBzdGF0ZS5vZmZzZXQ7CiAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoY29weSA+IGxlZnQpIHsKICAgICAgICAgICAgICAgICAgY29weSA9IGxlZnQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBsZWZ0IC09IGNvcHk7CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgb3V0cHV0W3B1dCsrXSA9IGZyb21fc291cmNlW2Zyb20rK107CiAgICAgICAgICAgICAgICB9IHdoaWxlICgtLWNvcHkpOwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBMSVQ6CiAgICAgICAgICAgICAgICBpZiAobGVmdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBvdXRwdXRbcHV0KytdID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgbGVmdC0tOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTjsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgQ0hFQ0s6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUud3JhcCkgewogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDMyKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgfD0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBfb3V0IC09IGxlZnQ7CiAgICAgICAgICAgICAgICAgIHN0cm0udG90YWxfb3V0ICs9IF9vdXQ7CiAgICAgICAgICAgICAgICAgIHN0YXRlLnRvdGFsICs9IF9vdXQ7CiAgICAgICAgICAgICAgICAgIGlmIChfb3V0KSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0gc3RhdGUuZmxhZ3MgPyBjcmMzMihzdGF0ZS5jaGVjaywgb3V0cHV0LCBfb3V0LCBwdXQgLSBfb3V0KSA6IGFkbGVyMzIoc3RhdGUuY2hlY2ssIG91dHB1dCwgX291dCwgcHV0IC0gX291dCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgX291dCA9IGxlZnQ7CiAgICAgICAgICAgICAgICAgIGlmICgoc3RhdGUuZmxhZ3MgPyBob2xkIDogenN3YXAzMihob2xkKSkgIT09IHN0YXRlLmNoZWNrKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGRhdGEgY2hlY2siOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTkdUSDsKICAgICAgICAgICAgICBjYXNlIExFTkdUSDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwICYmIHN0YXRlLmZsYWdzKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChob2xkICE9PSAoc3RhdGUudG90YWwgJiA0Mjk0OTY3Mjk1KSkgewogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImluY29ycmVjdCBsZW5ndGggY2hlY2siOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IERPTkU7CiAgICAgICAgICAgICAgY2FzZSBET05FOgogICAgICAgICAgICAgICAgcmV0ID0gWl9TVFJFQU1fRU5EOwogICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgIGNhc2UgQkFEOgogICAgICAgICAgICAgICAgcmV0ID0gWl9EQVRBX0VSUk9SOwogICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgIGNhc2UgTUVNOgogICAgICAgICAgICAgICAgcmV0dXJuIFpfTUVNX0VSUk9SOwogICAgICAgICAgICAgIGNhc2UgU1lOQzoKICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICBzdHJtLmF2YWlsX291dCA9IGxlZnQ7CiAgICAgICAgc3RybS5uZXh0X2luID0gbmV4dDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTsKICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICBzdGF0ZS5iaXRzID0gYml0czsKICAgICAgICBpZiAoc3RhdGUud3NpemUgfHwgX291dCAhPT0gc3RybS5hdmFpbF9vdXQgJiYgc3RhdGUubW9kZSA8IEJBRCAmJiAoc3RhdGUubW9kZSA8IENIRUNLIHx8IGZsdXNoICE9PSBaX0ZJTklTSCkpIHsKICAgICAgICAgIGlmICh1cGRhdGV3aW5kb3coc3RybSwgc3RybS5vdXRwdXQsIHN0cm0ubmV4dF9vdXQsIF9vdXQgLSBzdHJtLmF2YWlsX291dCkpIHsKICAgICAgICAgICAgc3RhdGUubW9kZSA9IE1FTTsKICAgICAgICAgICAgcmV0dXJuIFpfTUVNX0VSUk9SOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBfaW4gLT0gc3RybS5hdmFpbF9pbjsKICAgICAgICBfb3V0IC09IHN0cm0uYXZhaWxfb3V0OwogICAgICAgIHN0cm0udG90YWxfaW4gKz0gX2luOwogICAgICAgIHN0cm0udG90YWxfb3V0ICs9IF9vdXQ7CiAgICAg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IGhlYWQpIHsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBpZiAoKHN0YXRlLndyYXAgJiAyKSA9PT0gMCkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZS5oZWFkID0gaGVhZDsKICAgICAgICBoZWFkLmRvbmUgPSBmYWxzZTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlU2V0RGljdGlvbmFyeShzdHJtLCBkaWN0aW9uYXJ5KSB7CiAgICAgICAgdmFyIGRpY3RMZW5ndGggPSBkaWN0aW9uYXJ5Lmxlbmd0aDsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgdmFyIGRpY3RpZDsKICAgICAgICB2YXIgcmV0OwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgaWYgKHN0YXRlLndyYXAgIT09IDAgJiYgc3RhdGUubW9kZSAhPT0gRElDVCkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhdGUubW9kZSA9PT0gRElDVCkgewogICAgICAgICAgZGljdGlkID0gMTsKICAgICAgICAgIGRpY3RpZCA9IGFkbGVyMzIoZGljdGlkLCBkaWN0aW9uYXJ5LCBkaWN0TGVuZ3RoLCAwKTsKICAgICAgICAgIGlmIChkaWN0aWQgIT09IHN0YXRlLmNoZWNrKSB7CiAgICAgICAgICAgIHJldHVybiBaX0RBVEFfRVJ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yZV9jb25zdGFudHMgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvY29uc3RhbnRzLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgbW9kdWxlMi5leHBvcnRzID0gewogICAgICAgIFpfTk9fRkxVU0g6IDAsCiAgICAgICAgWl9QQVJUSUFMX0ZMVVNIOiAxLAogICAgICAgIFpfU1lOQ19GTFVTSDogMiwKICAgICAgICBaX0ZVTExfRkxVU0g6IDMsCiAgICAgICAgWl9GSU5JU0g6IDQsCiAgICAgICAgWl9CTE9DSzogNSwKICAgICAgICBaX1RSRUVTOiA2LAogICAgICAgIFpfT0s6IDAsCiAgICAgICAgWl9TVFJFQU1fRU5EOiAxLAogICAgICAgIFpfTkVFRF9ESUNUOiAyLAogICAgICAgIFpfRVJSTk86IC0xLAogICAgICAgIFpfU1RSRUFNX0VSUk9SOiAtMiwKICAgICAgICBaX0RBVEFfRVJST1I6IC0zLAogICAgICAgIFpfQlVGX0VSUk9SOiAtNSwKICAgICAgICBaX05PX0NPTVBSRVNTSU9OOiAwLAogICAgICAgIFpfQkVTVF9TUEVFRDogMSwKICAgICAgICBaX0JFU1RfQ09NUFJFU1NJT046IDksCiAgICAgICAgWl9ERUZBVUxUX0NPTVBSRVNTSU9OOiAtMSwKICAgICAgICBaX0ZJTFRFUkVEOiAxLAogICAgICAgIFpfSFVGRk1BTl9PTkxZOiAyLAogICAgICAgIFpfUkxFOiAzLAogICAgICAgIFpfRklYRUQ6IDQsCiAgICAgICAgWl9ERUZBVUxUX1NUUkFURUdZOiAwLAogICAgICAgIFpfQklOQVJZOiAwLAogICAgICAgIFpfVEVYVDogMSwKICAgICAgICBaX1VOS05PV046IDIsCiAgICAgICAgWl9ERUZMQVRFRDogOAogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvZ3poZWFkZXIuanMKICB2YXIgcmVxdWlyZV9nemhlYWRlciA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9nemhlYWRlci5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIGZ1bmN0aW9uIEdaaGVhZGVyKCkgewogICAgICAgIHRoaXMudGV4dCA9IDA7CiAgICAgICAgdGhpcy50aW1lID0gMDsKICAgICAgICB0aGlzLnhmbGFncyA9IDA7CiAgICAgICAgdGhpcy5vcyA9IDA7CiAgICAgICAgdGhpcy5leHRyYSA9IG51bGw7CiAgICAgICAgdGhpcy5leHRyYV9sZW4gPSAwOwogICAgICAgIHRoaXMubmFtZSA9ICIiOwogICAgICAgIHRoaXMuY29tbWVudCA9ICIiOwogICAgICAgIHRoaXMuaGNyYyA9IDA7CiAgICAgICAgdGhpcy5kb25lID0gZmFsc2U7CiAgICAgIH0KICAgICAgbW9kdWxlMi5leHBvcnRzID0gR1poZWFkZXI7CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvaW5mbGF0ZS5qcwogIHZhciByZXF1aXJlX2luZmxhdGUyID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi9pbmZsYXRlLmpzIihleHBvcnRzMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIHpsaWJfaW5mbGF0ZSA9IHJlcXVpcmVfaW5mbGF0ZSgpOwogICAgICB2YXIgdXRpbHMgPSByZXF1aXJlX2NvbW1vbigpOwogICAgICB2YXIgc3RyaW5ncyA9IHJlcXVpcmVfc3RyaW5ncygpOwogICAgICB2YXIgYyA9IHJlcXVpcmVfY29uc3RhbnRzKCk7CiAgICAgIHZhciBtc2cgPSByZXF1aXJlX21lc3NhZ2VzKCk7CiAgICAgIHZhciBaU3RyZWFtID0gcmVxdWlyZV96c3RyZWFtKCk7CiAgICAgIHZhciBHWmhlYWRlciA9IHJlcXVpcmVfZ3poZWFkZXIoKTsKICAgICAgdmFyIHRvU3RyaW5nID0gT2JqZWN0LnByb3RvdHlwZS50b1N0cmluZzsKICAgICAgZnVuY3Rpb24gSW5mbGF0ZTIob3B0aW9ucykgewogICAgICAgIGlmICghKHRoaXMgaW5zdGFuY2VvZiBJbmZsYXRlMikpCiAgICAgICAgICByZXR1cm4gbmV3IEluZmxhdGUyKG9wdGlvbnMpOwogICAgICAgIHRoaXMub3B0aW9ucyA9IHV0aWxzLmFzc2lnbih7CiAgICAgICAgICBjaHVua1NpemU6IDE2Mzg0LAogICAgICAgICAgd2luZG93Qml0czogMCwKICAgICAgICAgIHRvOiAiIgogICAgICAgIH0sIG9wdGlvbnMgfHwge30pOwogICAgICAgIHZhciBvcHQgPSB0aGlzLm9wdGlvbnM7CiAgICAgICAgaWYgKG9wdC5yYXcgJiYgb3B0LndpbmRvd0JpdHMgPj0gMCAmJiBvcHQud2luZG93Qml0cyA8IDE2KSB7CiAgICAgICAgICBvcHQud2luZG93Qml0cyA9IC1vcHQud2luZG93Qml0czsKICAgICAgICAgIGlmIChvcHQud2luZG93Qml0cyA9PT0gMCkgewogICAgICAgICAgICBvcHQud2luZG93Qml0cyA9IC0xNTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKG9wdC53aW5kb3dCaXRzID49IDAgJiYgb3B0LndpbmRvd0JpdHMgPCAxNiAmJiAhKG9wdGlvbnMgJiYgb3B0aW9ucy53aW5kb3dCaXRzKSkgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgKz0gMzI7CiAgICAgICAgfQogICAgICAgIGlmIChvcHQud2luZG93Qml0cyA+IDE1ICYmIG9wdC53aW5kb3dCaXRzIDwgNDgpIHsKICAgICAgICAgIGlmICgob3B0LndpbmRvd0JpdHMgJiAxNSkgPT09IDApIHsKICAgICAgICAgICAgb3B0LndpbmRvd0JpdHMgfD0gMTU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHRoaXMuZXJyID0gMDsKICAgICAgICB0aGlzLm1zZyA9ICIiOwogICAgICAgIHRoaXMuZW5kZWQgPSBmYWxzZTsKICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAgICAgIHRoaXMuc3RybSA9IG5ldyBaU3RyZWFtKCk7CiAgICAgICAgdGhpcy5zdHJtLmF2YWlsX291dCA9IDA7CiAgICAgICAgdmFyIHN0YXR1cyA9IHpsaWJfaW5mbGF0ZS5pbmZsYXRlSW5pdDIodGhpcy5zdHJtLCBvcHQud2luZG93Qml0cyk7CiAgICAgICAgaWYgKHN0YXR1cyAhPT0gYy5aX09LKSB7CiAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IobXNnW3N0YXR1c10pOwogICAgICAgIH0KICAgICAgICB0aGlzLmhlYWRlciA9IG5ldyBHWmhlYWRlcigpOwogICAgICAgIHpsaWJfaW5mbGF0ZS5pbmZsYXRlR2V0SGVhZGVyKHRoaXMuc3RybSwgdGhpcy5oZWFkZXIpOwogICAgICAgIGlmIChvcHQuZGljdGlvbmFyeSkgewogICAgICAgICAgaWYgKHR5cGVvZiBvcHQuZGljdGlvbmFyeSA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgb3B0LmRpY3Rpb25hcnkgPSBzdHJpbmdzLnN0cmluZzJidWYob3B0LmRpY3Rpb25hcnkpOwogICAgICAgICAgfSBlbHNlIGlmICh0b1N0cmluZy5jYWxsKG9wdC5kaWN0aW9uYXJ5KSA9PT0gIltvYmplY3QgQXJyYXlCdWZmZXJdIikgewogICAgICAgICAgICBvcHQuZGljdGlvbmFyeSA9IG5ldyBVaW50OEFycmF5KG9wdC5kaWN0aW9uYXJ5KTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChvcHQucmF3KSB7CiAgICAgICAgICAgIHN0YXR1cyA9IHpsaWJfaW5mbGF0ZS5pbmZsYXRlU2V0RGljdGlvbmFyeSh0aGlzLnN0cm0sIG9wdC5kaWN0aW9uYXJ5KTsKICAgICAgICAgICAgaWYgKHN0YXR1cyAhPT0gYy5aX09LKSB7CiAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKG1zZ1tzdGF0dXNdKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBJbmZsYXRlMi5wcm90b3R5cGUucHVzaCA9IGZ1bmN0aW9uKGRhdGEsIG1vZGUpIHsKICAgICAgICB2YXIgc3RybSA9IHRoaXMuc3RybTsKICAgICAgICB2YXIgY2h1bmtTaXplID0gdGhpcy5vcHRpb25zLmNodW5rU2l6ZTsKICAgICAgICB2YXIgZGljdGlvbmFyeSA9IHRoaXMub3B0aW9ucy5kaWN0aW9uYXJ5OwogICAgICAgIHZhciBzdGF0dXMsIF9tb2RlOwogICAgICAgIHZhciBuZXh0X291dF91dGY4LCB0YWlsLCB1dGY4c3RyOwogICAgICAgIHZhciBhbGxvd0J1ZkVycm9yID0gZmFsc2U7CiAgICAgICAgaWYgKHRoaXMuZW5kZWQpIHsKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICB9CiAgICAgICAgX21vZGUgPSBtb2RlID09PSB+fm1vZGUgPyBtb2RlIDogbW9kZSA9PT0gdHJ1ZSA/IGMuWl9GSU5JU0ggOiBjLlpfTk9fRkxVU0g7CiAgICAgICAgaWYgKHR5cGVvZiBkYXRhID09PSAic3RyaW5nIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IHN0cmluZ3MuYmluc3RyaW5nMmJ1ZihkYXRhKTsKICAgICAgICB9IGVsc2UgaWYgKHRvU3RyaW5nLmNhbGwoZGF0YSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgIHN0cm0uaW5wdXQgPSBuZXcgVWludDhBcnJheShkYXRhKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RybS5pbnB1dCA9IGRhdGE7CiAgICAgICAgfQogICAgICAgIHN0cm0ubmV4dF9pbiA9IDA7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IHN0cm0uaW5wdXQubGVuZ3RoOwogICAgICAgIGRvIHsKICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBzdHJtLm91dHB1dCA9IG5ldyB1dGlscy5CdWY4KGNodW5rU2l6ZSk7CiAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSAwOwogICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGNodW5rU2l6ZTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfaW5mbGF0ZS5pbmZsYXRlKHN0cm0sIGMuWl9OT19GTFVTSCk7CiAgICAgICAgICBpZiAoc3RhdHVzID09PSBjLlpfTkVFRF9ESUNUICYmIGRpY3Rpb25hcnkpIHsKICAgICAgICAgICAgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGVTZXREaWN0aW9uYXJ5KHRoaXMuc3RybSwgZGljdGlvbmFyeSk7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc3RhdHVzID09PSBjLlpfQlVGX0VSUk9SICYmIGFsbG93QnVmRXJyb3IgPT09IHRydWUpIHsKICAgICAgICAgICAgc3RhdHVzID0gYy5aX09LOwogICAgICAgICAgICBhbGxvd0J1ZkVycm9yID0gZmFsc2U7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc3RhdHVzICE9PSBjLlpfU1RSRUFNX0VORCAmJiBzdGF0dXMgIT09IGMuWl9PSykgewogICAgICAgICAgICB0aGlzLm9uRW5kKHN0YXR1cyk7CiAgICAgICAgICAgIHRoaXMuZW5kZWQgPSB0cnVlOwogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc3RybS5uZXh0X291dCkgewogICAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDAgfHwgc3RhdHVzID09PSBjLlpfU1RSRUFNX0VORCB8fCBzdHJtLmF2YWlsX2luID09PSAwICYmIChfbW9kZSA9PT0gYy5aX0ZJTklTSCB8fCBfbW9kZSA9PT0gYy5aX1NZTkNfRkxVU0gpKSB7CiAgICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICAgIG5leHRfb3V0X3V0ZjggPSBzdHJpbmdzLnV0Zjhib3JkZXIoc3RybS5vdXRwdXQsIHN0cm0ubmV4dF9vdXQpOwogICAgICAgICAgICAgICAgdGFpbCA9IHN0cm0ubmV4dF9vdXQgLSBuZXh0X291dF91dGY4OwogICAgICAgICAgICAgICAgdXRmOHN0ciA9IHN0cmluZ3MuYnVmMnN0cmluZyhzdHJtLm91dHB1dCwgbmV4dF9vdXRfdXRmOCk7CiAgICAgICAgICAgICAgICBzdHJtLm5leHRfb3V0ID0gdGFpbDsKICAgICAgICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gY2h1bmtTaXplIC0gdGFpbDsKICAgICAgICAgICAgICAgIGlmICh0YWlsKSB7CiAgICAgICAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0cm0ub3V0cHV0LCBzdHJtLm91dHB1dCwgbmV4dF9vdXRfdXRmOCwgdGFpbCwgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB0aGlzLm9uRGF0YSh1dGY4c3RyKTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdGhpcy5vbkRhdGEodXRpbHMuc2hyaW5rQnVmKHN0cm0ub3V0cHV0LCBzdHJtLm5leHRfb3V0KSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc3RybS5hdmFpbF9pbiA9PT0gMCAmJiBzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBhbGxvd0J1ZkVycm9yID0gdHJ1ZTsKICAgICAgICAgIH0KICAgICAgICB9IHdoaWxlICgoc3RybS5hdmFpbF9pbiA+IDAgfHwgc3RybS5hdmFpbF9vdXQgPT09IDApICYmIHN0YXR1cyAhPT0gYy5aX1NUUkVBTV9FTkQpOwogICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9TVFJFQU1fRU5EKSB7CiAgICAgICAgICBfbW9kZSA9IGMuWl9GSU5JU0g7CiAgICAgICAgfQogICAgICAgIGlmIChfbW9kZSA9PT0gYy5aX0ZJTklTSCkgewogICAgICAgICAgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGVFbmQodGhpcy5zdHJtKTsKICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgIHRoaXMuZW5kZWQgPSB0cnVlOwogICAgICAgICAgcmV0dXJuIHN0YXR1cyA9PT0gYy5aX09LOwogICAgICAgIH0KICAgICAgICBpZiAoX21vZGUgPT09IGMuWl9TWU5DX0ZMVVNIKSB7CiAgICAgICAgICB0aGlzLm9uRW5kKGMuWl9PSyk7CiAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IDA7CiAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgIH07CiAgICAgIEluZmxhdGUyLnByb3RvdHlwZS5vbkRhdGEgPSBmdW5jdGlvbihjaHVuaykgewogICAgICAgIHRoaXMuY2h1bmtzLnB1c2goY2h1bmspOwogICAgICB9OwogICAgICBJbmZsYXRlMi5wcm90b3R5cGUub25FbmQgPSBmdW5jdGlvbihzdGF0dXMpIHsKICAgICAgICBpZiAoc3RhdHVzID09PSBjLlpfT0spIHsKICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMudG8gPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdGhpcy5jaHVua3Muam9pbigiIik7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aGlzLnJlc3VsdCA9IHV0aWxzLmZsYXR0ZW5DaHVua3ModGhpcy5jaHVua3MpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAgICAgIHRoaXMuZXJyID0gc3RhdHVzOwogICAgICAgIHRoaXMubXNnID0gdGhpcy5zdHJtLm1zZzsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gaW5mbGF0ZShpbnB1dCwgb3B0aW9ucykgewogICAgICAgIHZhciBpbmZsYXRvciA9IG5ldyBJbmZsYXRlMihvcHRpb25zKTsKICAgICAgICBpbmZsYXRvci5wdXNoKGlucHV0LCB0cnVlKTsKICAgICAgICBpZiAoaW5mbGF0b3IuZXJyKSB7CiAgICAgICAgICB0aHJvdyBpbmZsYXRvci5tc2cgfHwgbXNnW2luZmxhdG9yLmVycl07CiAgICAgICAgfQogICAgICAgIHJldHVybiBpbmZsYXRvci5yZXN1bHQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZVJhdyhpbnB1dCwgb3B0aW9ucykgewogICAgICAgIG9wdGlvbnMgPSBvcHRpb25zIHx8IHt9OwogICAgICAgIG9wdGlvbnMucmF3ID0gdHJ1ZTsKICAgICAgICByZXR1cm4gaW5mbGF0ZShpbnB1dCwgb3B0aW9ucyk7CiAgICAgIH0KICAgICAgZXhwb3J0czIuSW5mbGF0ZSA9IEluZmxhdGUyOwogICAgICBleHBvcnRzMi5pbmZsYXRlID0gaW5mbGF0ZTsKICAgICAgZXhwb3J0czIuaW5mbGF0ZVJhdyA9IGluZ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OwogICAgICB0cnkgewogICAgICAgIHdhc20gPSBuZXcgV2ViQXNzZW1ibHkuSW5zdGFuY2UobmV3IFdlYkFzc2VtYmx5Lk1vZHVsZShuZXcgVWludDhBcnJheShbCiAgICAgICAgICAwLAogICAgICAgICAgOTcsCiAgICAgICAgICAxMTUsCiAgICAgICAgICAxMDksCiAgICAgICAgICAxLAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEzLAogICAgICAgICAgMiwKICAgICAgICAgIDk2LAogICAgICAgICAgMCwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICA5NiwKICAgICAgICAgIDQsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxLAogICAgICAgICAgMTI3LAogICAgICAgICAgMywKICAgICAgICAgIDcsCiAgICAgICAgICA2LAogICAgICAgICAgMCwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgNiwKICAgICAgICAgIDYsCiAgICAgICAgICAxLAogICAgICAgICAgMTI3LAogICAgICAgICAgMSwKICAgICAgICAgIDY1LAogICAgICAgICAgMCwKICAgICAgICAgIDExLAogICAgICAgICAgNywKICAgICAgICAgIDUwLAogICAgICAgICAgNiwKICAgICAgICAgIDMsCiAgICAgICAgICAxMDksCiAgICAgICAgICAxMTcsCiAgICAgICAgICAxMDgsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDUsCiAgICAgICAgICAxMDAsCiAgICAgICAgICAxMDUsCiAgICAgICAgICAxMTgsCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNSwKICAgICAgICAgIDAsCiAgICAgICAgICAyLAogICAgICAgICAgNSwKICAgICAgICAgIDEwMCwKICAgICAgICAgIDEwNSwKICAgICAgICAgIDExOCwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE3LAogICAgICAgICAgMCwKICAgICAgICAgIDMsCiAgICAgICAgICA1LAogICAgICAgICAgMTE0LAogICAgICAgICAgMTAxLAogICAgICAgICAgMTA5LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMTUsCiAgICAgICAgICAwLAogICAgICAgICAgNCwKICAgICAgICAgIDUsCiAgICAgICAgICAxMTQsCiAgICAgICAgICAxMDEsCiAgICAgICAgICAxMDksCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNywKICAgICAgICAgIDAsCiAgICAgICAgICA1LAogICAgICAgICAgOCwKICAgICAgICAgIDEwMywKICAgICAgICAgIDEwMSwKICAgICAgICAgIDExNiwKICAgICAgICAgIDk1LAogICAgICAgICAgMTA0LAogICAgICAgICAgMTA1LAogICAgICAgICAgMTAzLAogICAgICAgICAgMTA0LAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAxMCwKICAgICAgICAgIDE5MSwKICAgICAgICAgIDEsCiAgICAgICAgICA2LAogICAgICAgICAgNCwKICAgICAgICAgIDAsCiAgICAgICAgICAzNSwKICAgICAgICAgIDAsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyNywKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyOCwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEyOSwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMSwKICAgICAgICAgIDM2LAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDAsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMzIsCiAgICAgICAgICAyLAogICAgICAgICAgMTczLAogICAgICAgICAgMzIsCiAgICAgICAgICAzLAogICAgICAgICAgMTczLAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNCwKICAgICAgICAgIDEzMiwKICAgICAgICAgIDEzMCwKICAgICAgICAgIDM0LAogICAgICAgICAgNCwKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzUsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAzNiwKICAgICAgICAgIDAsCiAgICAgICAgICAzMiwKICAgICAgICAgIDQsCiAgICAgICAgICAxNjcsCiAgICAgICAgICAxMQogICAgICAgIF0pKSwge30pLmV4cG9ydHM7CiAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgfQogICAgICBmdW5jdGlvbiBMb25nNChsb3csIGhpZ2gsIHVuc2lnbmVkKSB7CiAgICAgICAgdGhpcy5sb3cgPSBsb3cgfCAwOwogICAgICAgIHRoaXMuaGlnaCA9IGhpZ2ggfCAwOwogICAgICAgIHRoaXMudW5zaWduZWQgPSAhIXVuc2lnbmVkOwogICAgICB9CiAgICAgIExvbmc0LnByb3RvdHlwZS5fX2lzTG9uZ19fOwogICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoTG9uZzQucHJvdG90eXBlLCAiX19pc0xvbmdfXyIsIHsgdmFsdWU6IHRydWUgfSk7CiAgICAgIGZ1bmN0aW9uIGlzTG9uZyhvYmopIHsKICAgICAgICByZXR1cm4gKG9iaiAmJiBvYmpbIl9faXNMb25nX18iXSkgPT09IHRydWU7CiAgICAgIH0KICAgICAgTG9uZzQuaXNMb25nID0gaXNMb25nOwogICAgICB2YXIgSU5UX0NBQ0hFID0ge307CiAgICAgIHZhciBVSU5UX0NBQ0hFID0ge307CiAgICAgIGZ1bmN0aW9uIGZyb21JbnQodmFsdWUsIHVuc2lnbmVkKSB7CiAgICAgICAgdmFyIG9iaiwgY2FjaGVkT2JqLCBjYWNoZTsKICAgICAgICBpZiAodW5zaWduZWQpIHsKICAgICAgICAgIHZhbHVlID4+Pj0gMDsKICAgICAgICAgIGlmIChjYWNoZSA9IDAgPD0gdmFsdWUgJiYgdmFsdWUgPCAyNTYpIHsKICAgICAgICAgICAgY2FjaGVkT2JqID0gVUlOVF9DQUNIRVt2YWx1ZV07CiAgICAgICAgICAgIGlmIChjYWNoZWRPYmopCiAgICAgICAgICAgICAgcmV0dXJuIGNhY2hlZE9iajsKICAgICAgICAgIH0KICAgICAgICAgIG9iaiA9IGZyb21CaXRzKHZhbHVlLCAodmFsdWUgfCAwKSA8IDAgPyAtMSA6IDAsIHRydWUpOwogICAgICAgICAgaWYgKGNhY2hlKQogICAgICAgICAgICBVSU5UX0NBQ0hFW3ZhbHVlXSA9IG9iajsKICAgICAgICAgIHJldHVybiBvYmo7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHZhbHVlIHw9IDA7CiAgICAgICAgICBpZiAoY2FjaGUgPSAtMTI4IDw9IHZhbHVlICYmIHZhbHVlIDwgMTI4KSB7CiAgICAgICAgICAgIGNhY2hlZE9iaiA9IElOVF9DQUNIRVt2YWx1ZV07CiAgICAgICAgICAgIGlmIChjYWNoZWRPYmopCiAgICAgICAgICAgICAgcmV0dXJuIGNhY2hlZE9iajsKICAgICAgICAgIH0KICAgICAgICAgIG9iaiA9IGZyb21CaXRzKHZhbHVlLCB2YWx1ZSA8IDAgPyAtMSA6IDAsIGZhbHNlKTsKICAgICAgICAgIGlmIChjYWNoZSkKICAgICAgICAgICAgSU5UX0NBQ0hFW3ZhbHVlXSA9IG9iajsKICAgICAgICAgIHJldHVybiBvYmo7CiAgICAgICAgfQogICAgICB9CiAgICAgIExvbmc0LmZyb21JbnQgPSBmcm9tSW50OwogICAgICBmdW5jdGlvbiBmcm9tTnVtYmVyKHZhbHVlLCB1bnNpZ25lZCkgewogICAgICAgIGlmIChpc05hTih2YWx1ZSkpCiAgICAgICAgICByZXR1cm4gdW5zaWduZWQgPyBVWkVSTyA6IFpFUk87CiAgICAgICAgaWYgKHVuc2lnbmVkKSB7CiAgICAgICAgICBpZiAodmFsdWUgPCAwKQogICAgICAgICAgICByZXR1cm4gVVpFUk87CiAgICAgICAgICBpZiAodmFsdWUgPj0gVFdPX1BXUl82NF9EQkwpCiAgICAgICAgICAgIHJldHVybiBNQVhfVU5TSUdORURfVkFMVUU7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGlmICh2YWx1ZSA8PSAtVFdPX1BXUl82M19EQkwpCiAgICAgICAgICAgIHJldHVybiBNSU5fVkFMVUU7CiAgICAgICAgICBpZiAodmFsdWUgKyAxID49IFRXT19QV1JfNjNfREJMKQogICAgICAgICAgICByZXR1cm4gTUFYX1ZBTFVFOwogICAgICAgIH0KICAgICAgICBpZiAodmFsdWUgPCAwKQogICAgICAgICAgcmV0dXJuIGZyb21OdW1iZXIoLXZhbHVlLCB1bnNpZ25lZCkubmVnKCk7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHZhbHVlICUgVFdPX1BXUl8zMl9EQkwgfCAwLCB2YWx1ZSAvIFRXT19QV1JfMzJfREJMIHwgMCwgdW5zaWduZWQpOwogICAgICB9CiAgICAgIExvbmc0LmZyb21OdW1iZXIgPSBmcm9tTnVtYmVyOwogICAgICBmdW5jdGlvbiBmcm9tQml0cyhsb3dCaXRzLCBoaWdoQml0cywgdW5zaWduZWQpIHsKICAgICAgICByZXR1cm4gbmV3IExvbmc0KGxvd0JpdHMsIGhpZ2hCaXRzLCB1bnNpZ25lZCk7CiAgICAgIH0KICAgICAgTG9uZzQuZnJvbUJpdHMgPSBmcm9tQml0czsKICAgICAgdmFyIHBvd19kYmwgPSBNYXRoLnBvdzsKICAgICAgZnVuY3Rpb24gZnJvbVN0cmluZyhzdHIsIHVuc2lnbmVkLCByYWRpeCkgewogICAgICAgIGlmIChzdHIubGVuZ3RoID09PSAwKQogICAgICAgICAgdGhyb3cgRXJyb3IoImVtcHR5IHN0cmluZyIpOwogICAgICAgIGlmIChzdHIgPT09ICJOYU4iIHx8IHN0ciA9PT0gIkluZmluaXR5IiB8fCBzdHIgPT09ICIrSW5maW5pdHkiIHx8IHN0ciA9PT0gIi1JbmZpbml0eSIpCiAgICAgICAgICByZXR1cm4gWkVSTzsKICAgICAgICBpZiAodHlwZW9mIHVuc2lnbmVkID09PSAibnVtYmVyIikgewogICAgICAgICAgcmFkaXggPSB1bnNpZ25lZCwgdW5zaWduZWQgPSBmYWxzZTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdW5zaWduZWQgPSAhIXVuc2lnbmVkOwogICAgICAgIH0KICAgICAgICByYWRpeCA9IHJhZGl4IHx8IDEwOwogICAgICAgIGlmIChyYWRpeCA8IDIgfHwgMzYgPCByYWRpeCkKICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoInJhZGl4Iik7CiAgICAgICAgdmFyIHA7CiAgICAgICAgaWYgKChwID0gc3RyLmluZGV4T2YoIi0iKSkgPiAwKQogICAgICAgICAgdGhyb3cgRXJyb3IoImludGVyaW9yIGh5cGhlbiIpOwogICAgICAgIGVsc2UgaWYgKHAgPT09IDApIHsKICAgICAgICAgIHJldHVybiBmcm9tU3RyaW5nKHN0ci5zdWJzdHJpbmcoMSksIHVuc2lnbmVkLCByYWRpeCkubmVnKCk7CiAgICAgICAgfQogICAgICAgIHZhciByYWRpeFRvUG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIDgpKTsKICAgICAgICB2YXIgcmVzdWx0ID0gWkVSTzsKICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkgKz0gOCkgewogICAgICAgICAgdmFyIHNpemUgPSBNYXRoLm1pbig4LCBzdHIubGVuZ3RoIC0gaSksIHZhbHVlID0gcGFyc2VJbnQoc3RyLnN1YnN0cmluZyhpLCBpICsgc2l6ZSksIHJhZGl4KTsK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G9uZ1Byb3RvdHlwZSA9IExvbmc0LnByb3RvdHlwZTsKICAgICAgTG9uZ1Byb3RvdHlwZS50b0ludCA9IGZ1bmN0aW9uIHRvSW50KCkgewogICAgICAgIHJldHVybiB0aGlzLnVuc2lnbmVkID8gdGhpcy5sb3cgPj4+IDAgOiB0aGlzLmxvdzsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS50b051bWJlciA9IGZ1bmN0aW9uIHRvTnVtYmVyMigpIHsKICAgICAgICBpZiAodGhpcy51bnNpZ25lZCkKICAgICAgICAgIHJldHVybiAodGhpcy5oaWdoID4+PiAwKSAqIFRXT19QV1JfMzJfREJMICsgKHRoaXMubG93ID4+PiAwKTsKICAgICAgICByZXR1cm4gdGhpcy5oaWdoICogVFdPX1BXUl8zMl9EQkwgKyAodGhpcy5sb3cgPj4+IDApOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gdG9TdHJpbmcocmFkaXgpIHsKICAgICAgICByYWRpeCA9IHJhZGl4IHx8IDEwOwogICAgICAgIGlmIChyYWRpeCA8IDIgfHwgMzYgPCByYWRpeCkKICAgICAgICAgIHRocm93IFJhbmdlRXJyb3IoInJhZGl4Iik7CiAgICAgICAgaWYgKHRoaXMuaXNaZXJvKCkpCiAgICAgICAgICByZXR1cm4gIjAiOwogICAgICAgIGlmICh0aGlzLmlzTmVnYXRpdmUoKSkgewogICAgICAgICAgaWYgKHRoaXMuZXEoTUlOX1ZBTFVFKSkgewogICAgICAgICAgICB2YXIgcmFkaXhMb25nID0gZnJvbU51bWJlcihyYWRpeCksIGRpdiA9IHRoaXMuZGl2KHJhZGl4TG9uZyksIHJlbTEgPSBkaXYubXVsKHJhZGl4TG9uZykuc3ViKHRoaXMpOwogICAgICAgICAgICByZXR1cm4gZGl2LnRvU3RyaW5nKHJhZGl4KSArIHJlbTEudG9JbnQoKS50b1N0cmluZyhyYWRpeCk7CiAgICAgICAgICB9IGVsc2UKICA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c2l0aXZlID0gZnVuY3Rpb24gaXNQb3NpdGl2ZSgpIHsKICAgICAgICByZXR1cm4gdGhpcy51bnNpZ25lZCB8fCB0aGlzLmhpZ2ggPj0gMDsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5pc09kZCA9IGZ1bmN0aW9uIGlzT2RkKCkgewogICAgICAgIHJldHVybiAodGhpcy5sb3cgJiAxKSA9PT0gMTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5pc0V2ZW4gPSBmdW5jdGlvbiBpc0V2ZW4oKSB7CiAgICAgICAgcmV0dXJuICh0aGlzLmxvdyAmIDEpID09PSAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmVxdWFscyA9IGZ1bmN0aW9uIGVxdWFscyhvdGhlcikgewogICAgICAgIGlmICghaXNMb25nKG90aGVyKSkKICAgICAgICAgIG90aGVyID0gZnJvbVZhbHVlKG90aGVyKTsKICAgICAgICBpZiAodGhpcy51bnNpZ25lZCAhPT0gb3RoZXIudW5zaWduZWQgJiYgdGhpcy5oaWdoID4+PiAzMSA9PT0gMSAmJiBvdGhlci5oaWdoID4+PiAzMSA9PT0gMSkKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICByZXR1cm4gdGhpcy5oaWdoID09PSBvdGhlci5oaWdoICYmIHRoaXMubG93ID09PSBvdGhlci5sb3c7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZXEgPSBMb25nUHJvdG90eXBlLmVxdWFsczsKICAgICAgTG9uZ1Byb3RvdHlwZS5ub3RFcXVhbHMgPSBmdW5jdGlvbiBub3RFcXVhbHMob3RoZXIpIHsKICAgICAgICByZXR1cm4gIXRoaXMuZXEob3RoZXIpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLm5lcSA9IExvbmdQcm90b3R5cGUubm90RXF1YWxzOwogICAgICBMb25nUHJvdG90eXBlLm5lID0gTG9uZ1Byb3RvdHlwZS5ub3RFcXVhbHM7CiAg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tcGFyZShvdGhlcikgewogICAgICAgIGlmICghaXNMb25nKG90aGVyKSkKICAgICAgICAgIG90aGVyID0gZnJvbVZhbHVlKG90aGVyKTsKICAgICAgICBpZiAodGhpcy5lcShvdGhlcikpCiAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB2YXIgdGhpc05lZyA9IHRoaXMuaXNOZWdhdGl2ZSgpLCBvdGhlck5lZyA9IG90aGVyLmlzTmVnYXRpdmUoKTsKICAgICAgICBpZiAodGhpc05lZyAmJiAhb3RoZXJOZWcpCiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKCF0aGlzTmVnICYmIG90aGVyTmVnKQogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgaWYgKCF0aGlzLnVuc2lnbmVkKQogICAgICAgICAgcmV0dXJuIHRoaXMuc3ViKG90aGVyKS5pc05lZ2F0aXZlKCkgPyAtMSA6IDE7CiAgICAgICAgcmV0dXJuIG90aGVyLmhpZ2ggPj4+IDAgPiB0aGlzLmhpZ2ggPj4+IDAgfHwgb3RoZXIuaGlnaCA9PT0gdGhpcy5oaWdoICYmIG90aGVyLmxvdyA+Pj4gMCA+IHRoaXMubG93ID4+PiAwID8gLTEgOiAxOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmNvbXAgPSBMb25nUHJvdG90eXBlLmNvbXBhcmU7CiAgICAgIExvbmdQcm90b3R5cGUubmVnYXRlID0gZnVuY3Rpb24gbmVnYXRlKCkgewogICAgICAgIGlmICghdGhpcy51bnNpZ25lZCAmJiB0aGlzLmVxKE1JTl9WQUxVRSkpCiAgICAgICAgICByZXR1cm4gTUlOX1ZBTFVFOwogICAgICAgIHJldHVybiB0aGlzLm5vdCgpLmFkZChPTkUpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLm5lZyA9IExvbmdQcm90b3R5cGUubmVnYXRlOwogICAgICBMb25nUHJvdG90eXBlLmFkZCA9IGZ1bmN0aW9uIGFkZChhZGRlbmQpIHsKICAgICAg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Rpdmlzb3IubG93ID09PSAtMSAmJiBkaXZpc29yLmhpZ2ggPT09IC0xKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICAgfQogICAgICAgICAgdmFyIGxvdyA9ICh0aGlzLnVuc2lnbmVkID8gd2FzbS5kaXZfdSA6IHdhc20uZGl2X3MpKHRoaXMubG93LCB0aGlzLmhpZ2gsIGRpdmlzb3IubG93LCBkaXZpc29yLmhpZ2gpOwogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKGxvdywgd2FzbS5nZXRfaGlnaCgpLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICB9CiAgICAgICAgaWYgKHRoaXMuaXNaZXJvKCkpCiAgICAgICAgICByZXR1cm4gdGhpcy51bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICB2YXIgYXBwcm94LCByZW0sIHJlczsKICAgICAgICBpZiAoIXRoaXMudW5zaWduZWQpIHsKICAgICAgICAgIGlmICh0aGlzLmVxKE1JTl9WQUxVRSkpIHsKICAgICAgICAgICAgaWYgKGRpdmlzb3IuZXEoT05FKSB8fCBkaXZpc29yLmVxKE5FR19PTkUpKQogICAgICAgICAgICAgIHJldHVybiBNSU5fVkFMVUU7CiAgICAgICAgICAgIGVsc2UgaWYgKGRpdmlzb3IuZXEoTUlOX1ZBTFVFKSkKICAgICAgICAgICAgICByZXR1cm4gT05FOwogICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICB2YXIgaGFsZlRoaXMgPSB0aGlzLnNocigxKTsKICAgICAgICAgICAgICBhcHByb3ggPSBoYWxmVGhpcy5kaXYoZGl2aXNvcikuc2hsKDEpOwogICAgICAgICAgICAgIGlmIChhcHByb3guZXEoWkVSTykpIHsKICAgICAgICAgICAgICAgIHJldHVybiBkaXZpc29yLmlzTmVnYXRpdmUoKSA/IE9ORSA6IE5FR19PTkU7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJlbSA9IHRoaXMuc3ViKGRpdmlzb3IubXVsKGFwcHJveCkpOwogICAgICAgICAgICAgICAgcmVzID0gYXBwcm94LmFkZChyZW0uZGl2KGRpdmlzb3IpKTsKICAgICAgICAgICAgICAgIHJldHVybiByZXM7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgaWYgKGRpdmlzb3IuZXEoTUlOX1ZBTFVFKSkKICAgICAgICAgICAgcmV0dXJuIHRoaXMudW5zaWduZWQgPyBVWkVSTyA6IFpFUk87CiAgICAgICAgICBpZiAodGhpcy5pc05lZ2F0aXZlKCkpIHsKICAgICAgICAgICAgaWYgKGRpdmlzb3IuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgICAgIHJldHVybiB0aGlzLm5lZygpLmRpdihkaXZpc29yLm5lZygpKTsKICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkuZGl2KGRpdmlzb3IpLm5lZygpOwogICAgICAgICAgfSBlbHNlIGlmIChkaXZpc29yLmlzTmVnYXRpdmUoKSkKICAgICAgICAgICAgcmV0dXJuIHRoaXMuZGl2KGRpdmlzb3IubmVnKCkpLm5lZygpOwogICAgICAgICAgcmVzID0gWkVSTzsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKCFkaXZpc29yLnVuc2lnbmVkKQogICAgICAgICAgICBkaXZpc29yID0gZGl2aXNvci50b1Vuc2lnbmVkKCk7CiAgICAgICAgICBpZiAoZGl2aXNvci5ndCh0aGlzKSkKICAgICAgICAgICAgcmV0dXJuIFVaRVJPOwogICAgICAgICAgaWYgKGRpdmlzb3IuZ3QodGhpcy5zaHJ1KDEpKSkKICAgICAgICAgICAgcmV0dXJuIFVPTkU7CiAgICAgICAgICByZXMgPSBVWkVSTzsKICAgICAgICB9CiAgICAgICAgcmVtID0gdGhpczsKICAgICAgICB3aGlsZSAocmVtLmd0ZShkaXZpc29yKSkgewogICAgICAgICAgYXBwcm94ID0gTWF0aC5tYXgoMSwgTWF0aC5mbG9vcihyZW0udG9OdW1iZXIoKSAvIGRpdmlzb3IudG9OdW1iZXIoKSkpOwogICAgICAgICAgdmFyIGxvZzIgPSBNYXRoLmNlaWwoTWF0aC5sb2coYXBwcm94KSAvIE1hdGguTE4yKSwgZGVsdGEgPSBsb2cyIDw9IDQ4ID8gMSA6IHBvd19kYmwoMiwgbG9nMiAtIDQ4KSwgYXBwcm94UmVzID0gZnJvbU51bWJlcihhcHByb3gpLCBhcHByb3hSZW0gPSBhcHByb3hSZXMubXVsKGRpdmlzb3IpOwogICAgICAgICAgd2hpbGUgKGFwcHJveFJlbS5pc05lZ2F0aXZlKCkgfHwgYXBwcm94UmVtLmd0KHJlbSkpIHsKICAgICAgICAgICAgYXBwcm94IC09IGRlbHRhOwogICAgICAgICAgICBhcHByb3hSZXMgPSBmcm9tTnVtYmVyKGFwcHJveCwgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgICAgIGFwcHJveFJlbSA9IGFwcHJveFJlcy5tdWwoZGl2aXNvcik7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYXBwcm94UmVzLmlzWmVybygpKQogICAgICAgICAgICBhcHByb3hSZXMgPSBPTkU7CiAgICAgICAgICByZXMgPSByZXMuYWRkKGFwcHJveFJlcyk7CiAgICAgICAgICByZW0gPSByZW0uc3ViKGFwcHJveFJlbSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZGl2ID0gTG9uZ1Byb3RvdHlwZS5kaXZpZGU7CiAgICAgIExvbmdQcm90b3R5cGUubW9kdWxvID0gZnVuY3Rpb24gbW9kdWxvKGRpdmlzb3IpIHsKICAgICAgICBpZiAoIWlzTG9uZyhkaXZpc29yKSkKICAgICAgICAgIGRpdmlzb3IgPSBmcm9tVmFsdWUoZGl2aXNvcik7CiAgICAgICAgaWYgKHdhc20pIHsKICAgICAgICAgIHZhciBsb3cgPSAodGhpcy51bnNpZ25lZCA/IHdhc20ucmVtX3UgOiB3YXNtLn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gZnVuY3Rpb24geG9yKG90aGVyKSB7CiAgICAgICAgaWYgKCFpc0xvbmcob3RoZXIpKQogICAgICAgICAgb3RoZXIgPSBmcm9tVmFsdWUob3RoZXIpOwogICAgICAgIHJldHVybiBmcm9tQml0cyh0aGlzLmxvdyBeIG90aGVyLmxvdywgdGhpcy5oaWdoIF4gb3RoZXIuaGlnaCwgdGhpcy51bnNpZ25lZCk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuc2hpZnRMZWZ0ID0gZnVuY3Rpb24gc2hpZnRMZWZ0KG51bUJpdHMpIHsKICAgICAgICBpZiAoaXNMb25nKG51bUJpdHMpKQogICAgICAgICAgbnVtQml0cyA9IG51bUJpdHMudG9JbnQoKTsKICAgICAgICBpZiAoKG51bUJpdHMgJj0gNjMpID09PSAwKQogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgZWxzZSBpZiAobnVtQml0cyA8IDMyKQogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IDw8IG51bUJpdHMsIHRoaXMuaGlnaCA8PCBudW1CaXRzIHwgdGhpcy5sb3cgPj4+IDMyIC0gbnVtQml0cywgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgZWxzZQogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKDAsIHRoaXMubG93IDw8IG51bUJpdHMgLSAzMiwgdGhpcy51bnNpZ25lZCk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuc2hsID0gTG9uZ1Byb3RvdHlwZS5zaGlmdExlZnQ7CiAgICAgIExvbmdQcm90b3R5cGUuc2hpZnRSaWdodCA9IGZ1bmN0aW9uIHNoaWZ0UmlnaHQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIGlmICgobnVtQml0cyAmPSA2MykgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNlIGlmIChudW1CaXRzIDwgMzIpCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgPj4+IG51bUJpdHMgfCB0aGlzLmhpZ2ggPDwgMzIgLSBudW1CaXRzLCB0aGlzLmhpZ2ggPj4gbnVtQml0cywgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgZWxzZQogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMuaGlnaCA+PiBudW1CaXRzIC0gMzIsIHRoaXMuaGlnaCA+PSAwID8gMCA6IC0xLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaHIgPSBMb25nUHJvdG90eXBlLnNoaWZ0UmlnaHQ7CiAgICAgIExvbmdQcm90b3R5cGUuc2hpZnRSaWdodFVuc2lnbmVkID0gZnVuY3Rpb24gc2hpZnRSaWdodFVuc2lnbmVkKG51bUJpdHMpIHsKICAgICAgICBpZiAoaXNMb25nKG51bUJpdHMpKQogICAgICAgICAgbnVtQml0cyA9IG51bUJpdHMudG9JbnQoKTsKICAgICAgICBudW1CaXRzICY9IDYzOwogICAgICAgIGlmIChudW1CaXRzID09PSAwKQogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgZWxzZSB7CiAgICAgICAgICB2YXIgaGlnaCA9IHRoaXMuaGlnaDsKICAgICAgICAgIGlmIChudW1CaXRzIDwgMzIpIHsKICAgICAgICAgICAgdmFyIGxvdyA9IHRoaXMubG93OwogICAgICAgICAgICByZXR1cm4gZnJvbUJpdHMobG93ID4+PiBudW1CaXRzIHwgaGlnaCA8PCAzMiAtIG51bUJpdHMsIGhpZ2ggPj4+IG51bUJpdHMsIHRoaXMudW5zaWduZWQpOwogICAgICAgICAgfSBlbHNlIGlmIChudW1CaXRzID09PSAzMikKICAgICAgICAgICAgcmV0dXJuIGZyb21CaXRzKGhpZ2gsIDAsIHRoaXMudW5zaWduZWQpOwogICAgICAgICAgZWxzZQogICAgICAgICAgICByZ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NlcmlhbGl6ZShtZXNzYWdlLCBmYWxsYmFja0Rlc2VyaWFsaXplcik7CiAgICAgICAgICB9LAogICAgICAgICAgc2VyaWFsaXplKGlucHV0KSB7CiAgICAgICAgICAgIHJldHVybiBpbXBsZW1lbnRhdGlvbi5zZXJpYWxpemUoaW5wdXQsIGZhbGxiYWNrU2VyaWFsaXplcik7CiAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgfQogICAgICBleHBvcnRzMi5leHRlbmRTZXJpYWxpemVyID0gZXh0ZW5kU2VyaWFsaXplcjsKICAgICAgdmFyIERlZmF1bHRFcnJvclNlcmlhbGl6ZXIgPSB7CiAgICAgICAgZGVzZXJpYWxpemUobWVzc2FnZSkgewogICAgICAgICAgcmV0dXJuIE9iamVjdC5hc3NpZ24oRXJyb3IobWVzc2FnZS5tZXNzYWdlKSwgewogICAgICAgICAgICBuYW1lOiBtZXNzYWdlLm5hbWUsCiAgICAgICAgICAgIHN0YWNrOiBtZXNzYWdlLnN0YWNrCiAgICAgICAgICB9KTsKICAgICAgICB9LAogICAgICAgIHNlcmlhbGl6ZShlcnJvcikgewogICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgX19lcnJvcl9tYXJrZXI6ICIkJGVycm9yIiwKICAgICAgICAgICAgbWVzc2FnZTogZXJyb3IubWVzc2FnZSwKICAgICAgICAgICAgbmFtZTogZXJyb3IubmFtZSwKICAgICAgICAgICAgc3RhY2s6IGVycm9yLnN0YWNrCiAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgfTsKICAgICAgdmFyIGlzU2VyaWFsaXplZEVycm9yID0gKHRoaW5nKSA9PiB0aGluZyAmJiB0eXBlb2YgdGhpbmcgPT09ICJvYmplY3QiICYmICJfX2Vycm9yX21hcmtlciIgaW4gdGhpbmcgJiYgdGhpbmcuX19lcnJvcl9tYXJrZXIgPT09ICIkJGVycm9yIjsKICAgICAgZXhwb3J0czIuRGVmYXVsdFNlcmlhbGl6ZXIgPSB7CiAgICAgICAgZGV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HJ1ZSB9KTsKICAgICAgZXhwb3J0czIuVHJhbnNmZXIgPSBleHBvcnRzMi5pc1RyYW5zZmVyRGVzY3JpcHRvciA9IHZvaWQgMDsKICAgICAgdmFyIHN5bWJvbHNfMSA9IHJlcXVpcmVfc3ltYm9scygpOwogICAgICBmdW5jdGlvbiBpc1RyYW5zZmVyYWJsZSh0aGluZykgewogICAgICAgIGlmICghdGhpbmcgfHwgdHlwZW9mIHRoaW5nICE9PSAib2JqZWN0IikKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpc1RyYW5zZmVyRGVzY3JpcHRvcih0aGluZykgewogICAgICAgIHJldHVybiB0aGluZyAmJiB0eXBlb2YgdGhpbmcgPT09ICJvYmplY3QiICYmIHRoaW5nW3N5bWJvbHNfMS4kdHJhbnNmZXJhYmxlXTsKICAgICAgfQogICAgICBleHBvcnRzMi5pc1RyYW5zZmVyRGVzY3JpcHRvciA9IGlzVHJhbnNmZXJEZXNjcmlwdG9yOwogICAgICBmdW5jdGlvbiBUcmFuc2ZlcjIocGF5bG9hZCwgdHJhbnNmZXJhYmxlcykgewogICAgICAgIGlmICghdHJhbnNmZXJhYmxlcykgewogICAgICAgICAgaWYgKCFpc1RyYW5zZmVyYWJsZShwYXlsb2FkKSkKICAgICAgICAgICAgdGhyb3cgRXJyb3IoKTsKICAgICAgICAgIHRyYW5zZmVyYWJsZXMgPSBbcGF5bG9hZF07CiAgICAgICAgfQogICAgICAgIHJldHVybiB7CiAgICAgICAgICBbc3ltYm9sc18xLiR0cmFuc2ZlcmFibGVdOiB0cnVlLAogICAgICAgICAgc2VuZDogcGF5bG9hZCwKICAgICAgICAgIHRyYW5zZmVyYWJsZXMKICAgICAgICB9OwogICAgICB9CiAgICAgIGV4cG9ydHMyLlRyYW5zZmVyID0gVHJhbnNmZXIyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vd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lzdC93b3JrZXIvaW5kZXguanMKICB2YXIgcmVxdWlyZV93b3JrZXIgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vdGhyZWFkc0AxLjcuMC9ub2RlX21vZHVsZXMvdGhyZWFkcy9kaXN0L3dvcmtlci9pbmRleC5qcyIoZXhwb3J0czIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIHZhciBfX2F3YWl0ZXIgPSBleHBvcnRzMiAmJiBleHBvcnRzMi5fX2F3YWl0ZXIgfHwgZnVuY3Rpb24odGhpc0FyZywgX2FyZ3VtZW50cywgUCwgZ2VuZXJhdG9yKSB7CiAgICAgICAgZnVuY3Rpb24gYWRvcHQodmFsdWUpIHsKICAgICAgICAgIHJldHVybiB2YWx1ZSBpbnN0YW5jZW9mIFAgPyB2YWx1ZSA6IG5ldyBQKGZ1bmN0aW9uKHJlc29sdmUpIHsKICAgICAgICAgICAgcmVzb2x2ZSh2YWx1ZSk7CiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgIGZ1bmN0aW9uIGZ1bGZpbGxlZCh2YWx1ZSkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgIHN0ZXAoZ2VuZXJhdG9yLm5leHQodmFsdWUpKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgIHJlamVjdChlKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgZnVuY3Rpb24gcmVqZWN0ZWQodmFsdWUpIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgcmVqZWN0K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XldID09PSAiZnVuY3Rpb24iKTsKICAgICAgICAgIHBvc3RNb2R1bGVJbml0TWVzc2FnZShtZXRob2ROYW1lcyk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHRocm93IEVycm9yKGBJbnZhbGlkIGFyZ3VtZW50IHBhc3NlZCB0byBleHBvc2UoKS4gRXhwZWN0ZWQgYSBmdW5jdGlvbiBvciBhbiBvYmplY3QsIGdvdDogJHtleHBvc2VkfWApOwogICAgICAgIH0KICAgICAgICBpbXBsZW1lbnRhdGlvbl8xLmRlZmF1bHQuc3Vic2NyaWJlVG9NYXN0ZXJNZXNzYWdlcygobWVzc2FnZURhdGEpID0+IHsKICAgICAgICAgIGlmIChpc01hc3RlckpvYkNhbmNlbE1lc3NhZ2UobWVzc2FnZURhdGEpKSB7CiAgICAgICAgICAgIGNvbnN0IGpvYlVJRCA9IG1lc3NhZ2VEYXRhLnVpZDsKICAgICAgICAgICAgY29uc3Qgc3Vic2NyaXB0aW9uID0gYWN0aXZlU3Vic2NyaXB0aW9ucy5nZXQoam9iVUlEKTsKICAgICAgICAgICAgaWYgKHN1YnNjcmlwdGlvbikgewogICAgICAgICAgICAgIHN1YnNjcmlwdGlvbi51bnN1YnNjcmliZSgpOwogICAgICAgICAgICAgIGFjdGl2ZVN1YnNjcmlwdGlvbnMuZGVsZXRlKGpvYlVJRCk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgfQogICAgICBleHBvcnRzMi5leHBvc2UgPSBleHBvc2UyOwogICAgICBpZiAodHlwZW9mIHNlbGYgIT09ICJ1bmRlZmluZWQiICYmIHR5cGVvZiBzZWxmLmFkZEV2ZW50TGlzdGVuZXIgPT09ICJmdW5jdGlvbiIgJiYgaW1wbGVtZW50YXRpb25fMS5kZWZhdWx0LmlzV29ya2VyUnVudGltZSgpKSB7CiAgICAgICAgc2VsZi5hZGRFdmVudExpc3RlbmVyKCJlcnJvciIsIChldmVudCkgPT4gewogICAgICAgICA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0aCA9PT0gSW5maW5pdHkgJiYgcG9zaXRpb24gIT09IDApIHsKICAgICAgICBoZWFkZXJzLnJhbmdlID0gYGJ5dGVzPSR7cG9zaXRpb259LWA7CiAgICAgIH0KICAgICAgY29uc3QgYXJncyA9IHsKICAgICAgICAuLi50aGlzLmJhc2VPdmVycmlkZXMsCiAgICAgICAgLi4ub3ZlcnJpZGVzLAogICAgICAgIGhlYWRlcnM6IHsKICAgICAgICAgIC4uLmhlYWRlcnMsCiAgICAgICAgICAuLi5vdmVycmlkZXMuaGVhZGVycywKICAgICAgICAgIC4uLnRoaXMuYmFzZU92ZXJyaWRlcy5oZWFkZXJzCiAgICAgICAgfSwKICAgICAgICBtZXRob2Q6ICJHRVQiLAogICAgICAgIHJlZGlyZWN0OiAiZm9sbG93IiwKICAgICAgICBtb2RlOiAiY29ycyIsCiAgICAgICAgc2lnbmFsCiAgICAgIH07CiAgICAgIGNvbnN0IHJlc3BvbnNlID0gYXdhaXQgdGhpcy5mZXRjaCh0aGlzLnVybCwgYXJncyk7CiAgICAgIGlmICghcmVzcG9uc2Uub2spIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYEhUVFAgJHtyZXNwb25zZS5zdGF0dXN9ICR7cmVzcG9uc2Uuc3RhdHVzVGV4dH0gJHt0aGlzLnVybH1gKTsKICAgICAgfQogICAgICBpZiAocmVzcG9uc2Uuc3RhdHVzID09PSAyMDAgJiYgcG9zaXRpb24gPT09IDAgfHwgcmVzcG9uc2Uuc3RhdHVzID09PSAyMDYpIHsKICAgICAgICBjb25zdCByZXNwb25zZURhdGEgPSBhd2FpdCB0aGlzLmdldEJ1ZmZlckZyb21SZXNwb25zZShyZXNwb25zZSk7CiAgICAgICAgY29uc3QgYnl0ZXNDb3BpZWQgPSByZXNwb25zZURhdGEuY29weShidWZmZXIsIG9mZnNldCwgMCwgTWF0aC5taW4obGVuZ3RoLCByZXNwb25zZURhdGEubGVuZ3RoKSk7CiAgICAgICAgY29uc3QgcmVzID0gcmVzcG9uc2UuaGVhZGVycy5nZXQoImNvbnRlbnQtcmFuZ2UiKTsKICAgICAgICBjb25zdCBzaXplTWF0Y2ggPSAvXC8oXGQrKSQvLmV4ZWMocmVzIHx8ICIiKTsKICAgICAgICBpZiAoc2l6ZU1hdGNoICYmIHNpemVNYXRjaFsxXSkgewogICAgICAgICAgdGhpcy5fc3RhdCA9IHsgc2l6ZTogcGFyc2VJbnQoc2l6ZU1hdGNoWzFdLCAxMCkgfTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHsgYnl0ZXNSZWFkOiBieXRlc0NvcGllZCwgYnVmZmVyIH07CiAgICAgIH0KICAgICAgaWYgKHJlc3BvbnNlLnN0YXR1cyA9PT0gMjAwKSB7CiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCIke3RoaXMudXJsfSBmZXRjaCByZXR1cm5lZCBzdGF0dXMgMjAwLCBleHBlY3RlZCAyMDYiKTsKICAgICAgfQogICAgICB0aHJvdyBuZXcgRXJyb3IoYEhUVFAgJHtyZXNwb25zZS5zdGF0dXN9IGZldGNoaW5nICR7dGhpcy51cmx9YCk7CiAgICB9CiAgICBhc3luYyByZWFkRmlsZShvcHRpb25zID0ge30pIHsKICAgICAgbGV0IGVuY29kaW5nOwogICAgICBsZXQgb3B0czsKICAgICAgaWYgKHR5cGVvZiBvcHRpb25zID09PSAic3RyaW5nIikgewogICAgICAgIGVuY29kaW5nID0gb3B0aW9uczsKICAgICAgICBvcHRzID0ge307CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZW5jb2RpbmcgPSBvcHRpb25zLmVuY29kaW5nOwogICAgICAgIG9wdHMgPSBvcHRpb25zOwogICAgICAgIGRlbGV0ZSBvcHRzLmVuY29kaW5nOwogICAgICB9CiAgICAgIGNvbnN0IHsgaGVhZGVycyA9IHt9LCBzaWduYWwsIG92ZXJyaWRlcyA9IHt9IH0gPSBvcHRzOwogICAgICBjb25zdCBhcmdzID0gewogICAgICAgIGhlYWRlcnMsCiAgICAgICAgb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CiAgICByZXR1cm4gY2h1bmsyLm1pbnYuYmxvY2tQb3NpdGlvbiAtIGNodW5rMS5tYXh2LmJsb2NrUG9zaXRpb24gPCA2NWUzICYmIGNodW5rMi5tYXh2LmJsb2NrUG9zaXRpb24gLSBjaHVuazEubWludi5ibG9ja1Bvc2l0aW9uIDwgNWU2OwogIH0KICBmdW5jdGlvbiBvcHRpbWl6ZUNodW5rcyhjaHVua3MsIGxvd2VzdCkgewogICAgY29uc3QgbWVyZ2VkQ2h1bmtzID0gW107CiAgICBsZXQgbGFzdENodW5rID0gbnVsbDsKICAgIGlmIChjaHVua3MubGVuZ3RoID09PSAwKSB7CiAgICAgIHJldHVybiBjaHVua3M7CiAgICB9CiAgICBjaHVua3Muc29ydChmdW5jdGlvbihjMCwgYzEpIHsKICAgICAgY29uc3QgZGlmID0gYzAubWludi5ibG9ja1Bvc2l0aW9uIC0gYzEubWludi5ibG9ja1Bvc2l0aW9uOwogICAgICBpZiAoZGlmICE9PSAwKSB7CiAgICAgICAgcmV0dXJuIGRpZjsKICAgICAgfSBlbHNlIHsKICAgICAgICByZXR1cm4gYzAubWludi5kYXRhUG9zaXRpb24gLSBjMS5taW52LmRhdGFQb3NpdGlvbjsKICAgICAgfQogICAgfSk7CiAgICBjaHVua3MuZm9yRWFjaCgoY2h1bmspID0+IHsKICAgICAgaWYgKCFsb3dlc3QgfHwgY2h1bmsubWF4di5jb21wYXJlVG8obG93ZXN0KSA+IDApIHsKICAgICAgICBpZiAobGFzdENodW5rID09PSBudWxsKSB7CiAgICAgICAgICBtZXJnZWRDaHVua3MucHVzaChjaHVuayk7CiAgICAgICAgICBsYXN0Q2h1bmsgPSBjaHVuazsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKGNhbk1lcmdlQmxvY2tzKGxhc3RDaHVuaywgY2h1bmspKSB7CiAgICAgICAgICAgIGlmIChjaHVuay5tYXh2LmNvbXBhcmVUbyhsYXN0Q2h1bmsubWF4dikgPiAwKSB7CiAgICAgICA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ldCk7CiAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDQ7CiAgICAgICAgICBpZiAoYmluID4gbWF4QmluTnVtYmVyICsgMSkgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoInRhYml4IGluZGV4IGNvbnRhaW5zIHRvbyBtYW55IGJpbnMsIHBsZWFzZSB1c2UgYSBDU0kgaW5kZXgiKTsKICAgICAgICAgIH0gZWxzZSBpZiAoYmluID09PSBtYXhCaW5OdW1iZXIgKyAxKSB7CiAgICAgICAgICAgIGNvbnN0IGNodW5rQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgICAgICBpZiAoY2h1bmtDb3VudCA9PT0gMikgewogICAgICAgICAgICAgIHN0YXRzID0gdGhpcy5wYXJzZVBzZXVkb0JpbihieXRlcywgY3Vyck9mZnNldCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNiAqIGNodW5rQ291bnQ7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjb25zdCBjaHVua0NvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCk7CiAgICAgICAgICAgIGN1cnJPZmZzZXQgKz0gNDsKICAgICAgICAgICAgY29uc3QgY2h1bmtzID0gbmV3IEFycmF5KGNodW5rQ291bnQpOwogICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGNodW5rQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgICAgIGNvbnN0IHUgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQpOwogICAgICAgICAgICAgIGNvbnN0IHYgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQgKyA4KTsKICAgICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDE2OwogICAgICAgICAgICAgIGZpcnN0RGF0YUxpbmUgPSB0aGlzLl9maW5kRmlyc3REYXRhKGZpcnN0RGF0YUxpbmUsIHUpOwogICAgICAgICAgICAgIGNodW5rc1trXSA9IG5ldyBDaHVuayh1LCB2LCBiaW4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGJpbkluZGV4W2Jpbl0gPSBjaHVua3M7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNvbnN0IGxpbmVhckNvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCk7CiAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgIGNvbnN0IGxpbmVhckluZGV4ID0gbmV3IEFycmF5KGxpbmVhckNvdW50KTsKICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGxpbmVhckNvdW50OyBrICs9IDEpIHsKICAgICAgICAgIGxpbmVhckluZGV4W2tdID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0KTsKICAgICAgICAgIGN1cnJPZmZzZXQgKz0gODsKICAgICAgICAgIGZpcnN0RGF0YUxpbmUgPSB0aGlzLl9maW5kRmlyc3REYXRhKGZpcnN0RGF0YUxpbmUsIGxpbmVhckluZGV4W2tdKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHsgYmluSW5kZXgsIGxpbmVhckluZGV4LCBzdGF0cyB9OwogICAgICB9KTsKICAgICAgcmV0dXJuIHsKICAgICAgICBpbmRpY2VzLAogICAgICAgIG1ldGFDaGFyLAogICAgICAgIG1heEJpbk51bWJlciwKICAgICAgICBtYXhSZWZMZW5ndGgsCiAgICAgICAgc2tpcExpbmVzLAogICAgICAgIGZpcnN0RGF0YUxpbmUsCiAgICAgICAgY29sdW1uTnVtYmVycywKICAgICAgICBjb29yZGluYXRlVHlwZSwKICAgICAgICBmb3JtYXQsCiAgICAgICAgcmVmSWRUb05hbWUsCiAgICAgICAgcmVmTmFtZVRvSWQsCiAgICAgICAgbWF4QmxvY2tTaXplOiAxIDw8IDE2CiAgICAgIH07CiAgICB9CiAgICBwYXJzZVB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bWluLCBtYXgsIG9wdHMgPSB7fSkgewogICAgICBpZiAobWluIDwgMCkgewogICAgICAgIG1pbiA9IDA7CiAgICAgIH0KICAgICAgY29uc3QgaW5kZXhEYXRhID0gYXdhaXQgdGhpcy5wYXJzZShvcHRzKTsKICAgICAgaWYgKCFpbmRleERhdGEpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3QgcmVmSWQgPSBpbmRleERhdGEucmVmTmFtZVRvSWRbcmVmTmFtZV07CiAgICAgIGNvbnN0IGJhID0gaW5kZXhEYXRhLmluZGljZXNbcmVmSWRdOwogICAgICBpZiAoIWJhKSB7CiAgICAgICAgcmV0dXJuIFtdOwogICAgICB9CiAgICAgIGNvbnN0IG1pbk9mZnNldCA9IGJhLmxpbmVhckluZGV4Lmxlbmd0aCA/IGJhLmxpbmVhckluZGV4W21pbiA+PiBUQURfTElEWF9TSElGVCA+PSBiYS5saW5lYXJJbmRleC5sZW5ndGggPyBiYS5saW5lYXJJbmRleC5sZW5ndGggLSAxIDogbWluID4+IFRBRF9MSURYX1NISUZUXSA6IG5ldyBWaXJ0dWFsT2Zmc2V0KDAsIDApOwogICAgICBpZiAoIW1pbk9mZnNldCkgewogICAgICAgIGNvbnNvbGUud2FybigicXVlcnlpbmcgb3V0c2lkZSBvZiBwb3NzaWJsZSB0YWJpeCByYW5nZSIpOwogICAgICB9CiAgICAgIGNvbnN0IG92ZXJsYXBwaW5nQmlucyA9IHJlZzJiaW5zKG1pbiwgbWF4KTsKICAgICAgY29uc3QgY2h1bmtzID0gW107CiAgICAgIGZvciAoY29uc3QgW3N0YXJ0LCBlbmRdIG9mIG92ZXJsYXBwaW5nQmlucykgewogICAgICAgIGZvciAobGV0IGJpbiA9IHN0YXJ0OyBiaW4gPD0gZW5kOyBiaW4rKykgewogICAgICAgICAgaWYgKGJhLmJpbkluZGV4W2Jpbl0pIHsKICAgICAgICAgICAgY29uc3QgYmluQ2h1bmtzID0gYmEuYmluSW5kZXhbYmluXTsKICAgICAgICAgICAgZm9yIChsZXQgYyA9IDA7IGMgPCBiaW5DaHVua3MubGVuZ3RoOyArK2MpIHsKICAgICAgICAgICAgICBjaHVua3MucHVzaChuZXcgQ2h1bmsoYmluQ2h1bmtzW2NdLm1pbnYsIGJpbkNodW5rc1tjXS5tYXh2LCBiaW4pKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBjb25zdCBuaW50diA9IGJhLmxpbmVhckluZGV4Lmxlbmd0aDsKICAgICAgbGV0IGxvd2VzdCA9IG51bGw7CiAgICAgIGNvbnN0IG1pbkxpbiA9IE1hdGgubWluKG1pbiA+PiAxNCwgbmludHYgLSAxKTsKICAgICAgY29uc3QgbWF4TGluID0gTWF0aC5taW4obWF4ID4+IDE0LCBuaW50diAtIDEpOwogICAgICBmb3IgKGxldCBpID0gbWluTGluOyBpIDw9IG1heExpbjsgKytpKSB7CiAgICAgICAgY29uc3QgdnAgPSBiYS5saW5lYXJJbmRleFtpXTsKICAgICAgICBpZiAodnApIHsKICAgICAgICAgIGlmICghbG93ZXN0IHx8IHZwLmNvbXBhcmVUbyhsb3dlc3QpIDwgMCkgewogICAgICAgICAgICBsb3dlc3QgPSB2cDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIG9wdGltaXplQ2h1bmtzKGNodW5rcywgbG93ZXN0KTsKICAgIH0KICB9OwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vQGdtb2QrdGFiaXhAMS41LjExL25vZGVfbW9kdWxlcy9AZ21vZC90YWJpeC9lc20vY3NpLmpzCiAgaW5pdF9idWZmZXJfc2hpbSgpOwogIHZhciBpbXBvcnRfbG9uZzMgPSBfX3RvTW9kdWxlKHJlcXVpcmVfbG9uZygpKTsKICB2YXIgQ1NJMV9NQUdJQyA9IDIxNTgyNjU5OwogIHZhciBDU0kyX01BR0lDID0gMzgzNTk4NzU7CiAgZnVuY3Rpb24gbHNoaWZ0KG51bSwgYml0cykgewogICAgcmV0dXJuIG51bSAqIDIgKiogYml0czsKICB9CiAgZnVuY3Rpb24gcnNoaWZ0KG51bSwgYml0cykgewogICAgcmV0dXJuIE1hdGguZmxvb3IobnVtIC8gMiAqKiBiaXRzKTsKICB9CiAgdmFyIENTSSA9IGNsYXNzIGV4dGVuZHMgSW5kZXhGaWxlIHsKICAgIGNvbnN0cnVjdG9yKGFyZ3MpIHsKICAgICAgc3VwZXIoYXJncyk7CiAgICAgIHRoaXMubWF4QmluTnVtYmVyID0gMDsKICAgICAgdGhpcy5kZXB0aCA9IDA7CiAgICAgIHRoaXMubWluU2hpZnQgPSAwOwogICAgfQogICAgYXN5bmMgbGluZUNvdW50KHJlZk5hbWUsIG9wdHMgPSB7fSkgewogICAgICBjb25zdCBpbmRleERhdGEgPSBhd2FpdCB0aGlzLnBhcnNlKG9wdHMpOwogICAgICBpZiAoIWluZGV4RGF0YSkgewogICAgICAgIHJldHVybiAtMTsKICAgICAgfQogICAgICBjb25zdCByZWZJZCA9IGluZGV4RGF0YS5yZWZOYW1lVG9JZFtyZWZOYW1lXTsKICAgICAgY29uc3QgaWR4ID0gaW5kZXhEYXRhLmluZGljZXNbcmVmSWRdOwogICAgICBpZiAoIWlkeCkgewogICAgICAgIHJldHVybiAtMTsKICAgICAgfQogICAgICBjb25zdCB7IHN0YXRzIH0gPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmIChzdGF0cykgewogICAgICAgIHJldHVybiBzdGF0cy5saW5lQ291bnQ7CiAgICAgIH0KICAgICAgcmV0dXJuIC0xOwogICAgfQogICAgYXN5bmMgaW5kZXhDb3YoKSB7CiAgICAgIHRocm93IG5ldyBFcnJvcigiQ1NJIGluZGV4ZXMgZG8gbm90IHN1cHBvcnQgaW5kZXhjb3YiKTsKICAgIH0KICAgIHBhcnNlQXV4RGF0YShieXRlcywgb2Zmc2V0KSB7CiAgICAgIGNvbnN0IGZvcm1hdEZsYWdzID0gYnl0ZX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uYW1lU2VjdGlvbkxlbmd0aCkpOwogICAgICByZXR1cm4gewogICAgICAgIHJlZklkVG9OYW1lLAogICAgICAgIHJlZk5hbWVUb0lkLAogICAgICAgIHNraXBMaW5lcywKICAgICAgICBtZXRhQ2hhciwKICAgICAgICBjb2x1bW5OdW1iZXJzLAogICAgICAgIGZvcm1hdCwKICAgICAgICBjb29yZGluYXRlVHlwZQogICAgICB9OwogICAgfQogICAgX3BhcnNlTmFtZUJ5dGVzKG5hbWVzQnl0ZXMpIHsKICAgICAgbGV0IGN1cnJSZWZJZCA9IDA7CiAgICAgIGxldCBjdXJyTmFtZVN0YXJ0ID0gMDsKICAgICAgY29uc3QgcmVmSWRUb05hbWUgPSBbXTsKICAgICAgY29uc3QgcmVmTmFtZVRvSWQgPSB7fTsKICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBuYW1lc0J5dGVzLmxlbmd0aDsgaSArPSAxKSB7CiAgICAgICAgaWYgKCFuYW1lc0J5dGVzW2ldKSB7CiAgICAgICAgICBpZiAoY3Vyck5hbWVTdGFydCA8IGkpIHsKICAgICAgICAgICAgbGV0IHJlZk5hbWUgPSBuYW1lc0J5dGVzLnRvU3RyaW5nKCJ1dGY4IiwgY3Vyck5hbWVTdGFydCwgaSk7CiAgICAgICAgICAgIHJlZk5hbWUgPSB0aGlzLnJlbmFtZVJlZlNlcShyZWZOYW1lKTsKICAgICAgICAgICAgcmVmSWRUb05hbWVbY3VyclJlZklkXSA9IHJlZk5hbWU7CiAgICAgICAgICAgIHJlZk5hbWVUb0lkW3JlZk5hbWVdID0gY3VyclJlZklkOwogICAgICAgICAgfQogICAgICAgICAgY3Vyck5hbWVTdGFydCA9IGkgKyAxOwogICAgICAgICAgY3VyclJlZklkICs9IDE7CiAgICAgICAgfQogICAgICB9CiAgICAgIHJldHVybiB7IHJlZk5hbWVUb0lkLCByZWZJZFRvTmFtZSB9OwogICAgfQogICAgYXN5bmMgX3BhcnNlKG9wdHMgPSB7fSkgewogICAgICBjb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ogICAgICAgIGZvcm1hdDogImdlbmVyaWMiCiAgICAgIH07CiAgICAgIGNvbnN0IHJlZkNvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoMTYgKyBhdXhMZW5ndGgpOwogICAgICBsZXQgZmlyc3REYXRhTGluZTsKICAgICAgbGV0IGN1cnJPZmZzZXQgPSAxNiArIGF1eExlbmd0aCArIDQ7CiAgICAgIGNvbnN0IGluZGljZXMgPSBuZXcgQXJyYXkocmVmQ291bnQpLmZpbGwoMCkubWFwKCgpID0+IHsKICAgICAgICBjb25zdCBiaW5Db3VudCA9IGJ5dGVzLnJlYWRJbnQzMkxFKGN1cnJPZmZzZXQpOwogICAgICAgIGN1cnJPZmZzZXQgKz0gNDsKICAgICAgICBjb25zdCBiaW5JbmRleCA9IHt9OwogICAgICAgIGxldCBzdGF0czsKICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGJpbkNvdW50OyBqICs9IDEpIHsKICAgICAgICAgIGNvbnN0IGJpbiA9IGJ5dGVzLnJlYWRVSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgIGlmIChiaW4gPiB0aGlzLm1heEJpbk51bWJlcikgewogICAgICAgICAgICBzdGF0cyA9IHRoaXMucGFyc2VQc2V1ZG9CaW4oYnl0ZXMsIGN1cnJPZmZzZXQgKyA0KTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSA0ICsgOCArIDQgKyAxNiArIDE2OwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgY29uc3QgbG9mZnNldCA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCArIDQpOwogICAgICAgICAgICBmaXJzdERhdGFMaW5lID0gdGhpcy5fZmluZEZpcnN0RGF0YShmaXJzdERhdGFMaW5lLCBsb2Zmc2V0KTsKICAgICAgICAgICAgY29uc3QgY2h1bmtDb3VudCA9IGJ5dGVzLnJlYWRJbnQzMkxFKGN1cnJPZmZzZXQgKyAxMik7CiAgICAgICAgICAgIGN1cnJPZmZzZXQgKz0gMTY7CiAgICAgICAgICAgIGNvbnN0IGNodW5rcyA9IG5ldyBBcnJheShjaHVua0NvdW50KTsKICAgICAgICAgICAgZm9yIChsZXQgayA9IDA7IGsgPCBjaHVua0NvdW50OyBrICs9IDEpIHsKICAgICAgICAgICAgICBjb25zdCB1ID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgICBjb25zdCB2ID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0ICsgOCk7CiAgICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNjsKICAgICAgICAgICAgICBjaHVua3Nba10gPSBuZXcgQ2h1bmsodSwgdiwgYmluKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBiaW5JbmRleFtiaW5dID0gY2h1bmtzOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4geyBiaW5JbmRleCwgc3RhdHMgfTsKICAgICAgfSk7CiAgICAgIHJldHVybiB7CiAgICAgICAgLi4uYXV4LAogICAgICAgIGNzaTogdHJ1ZSwKICAgICAgICByZWZDb3VudCwKICAgICAgICBtYXhCbG9ja1NpemU6IDEgPDwgMTYsCiAgICAgICAgZmlyc3REYXRhTGluZSwKICAgICAgICBjc2lWZXJzaW9uLAogICAgICAgIGluZGljZXMsCiAgICAgICAgZGVwdGg6IHRoaXMuZGVwdGgsCiAgICAgICAgbWF4QmluTnVtYmVyOiB0aGlzLm1heEJpbk51bWJlciwKICAgICAgICBtYXhSZWZMZW5ndGgKICAgICAgfTsKICAgIH0KICAgIHBhcnNlUHNldWRvQmluKGJ5dGVzLCBvZmZzZXQpIHsKICAgICAgY29uc3QgbGluZUNvdW50ID0gbG9uZ1RvTnVtYmVyKGltcG9ydF9sb25nMy5kZWZhdWx0LmZyb21CeXRlc0xFKGJ5dGVzLnNsaWNlKG9mZnNldCArIDI4LCBvZmZzZXQgKyAzNiksIHRydWUpKTsKICAgICAgcmV0dXJuIHsgbGluZUNvdW50IH07CiAgICB9CiAgICBhc3luYyBibG9ja3NGb3JSYW5nZShyZWZOYW1lLCBtaW4sIG1heCwgb3B0cyA9IHt9KSB7CiAgICAgIGlmIChtaW4gPCAwKSB7CiAgICAgICAgbWluID0gMDsKICAgICAgfQogICAgICBjb25zdCBpbmRleERhdGEgPSBhd2FpdCB0aGlzLnBhcnNlKG9wdHMpOwogICAgICBpZiAoIWluZGV4RGF0YSkgewogICAgICAgIHJldHVybiBbXTsKICAgICAgfQogICAgICBjb25zdCByZWZJZCA9IGluZGV4RGF0YS5yZWZOYW1lVG9JZFtyZWZOYW1lXTsKICAgICAgY29uc3QgYmEgPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmICghYmEpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3Qgb3ZlcmxhcHBpbmdCaW5zID0gdGhpcy5yZWcyYmlucyhtaW4sIG1heCk7CiAgICAgIGNvbnN0IGNodW5rcyA9IFtdOwogICAgICBmb3IgKGNvbnN0IFtzdGFydCwgZW5kXSBvZiBvdmVybGFwcGluZ0JpbnMpIHsKICAgICAgICBmb3IgKGxldCBiaW4gPSBzdGFydDsgYmluIDw9IGVuZDsgYmluKyspIHsKICAgICAgICAgIGlmIChiYS5iaW5JbmRleFtiaW5dKSB7CiAgICAgICAgICAgIGNvbnN0IGJpbkNodW5rcyA9IGJhLmJpbkluZGV4W2Jpbl07CiAgICAgICAgICAgIGZvciAobGV0IGMgPSAwOyBjIDwgYmluQ2h1bmtzLmxlbmd0aDsgKytjKSB7CiAgICAgICAgICAgICAgY2h1bmtzLnB1c2gobmV3IENodW5rKGJpbkNodW5rc1tjXS5taW52LCBiaW5DaHVua3NbY10ubWF4diwgYmluKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIG9wdGltaXplQ2h1bmtzKGNodW5rcywgbmV3IFZpcnR1YWxPZmZzZXQoM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V0YWRhdGEob3B0aW9ucyk7CiAgICAgIGNoZWNrQWJvcnRTaWduYWwoc2lnbmFsKTsKICAgICAgaWYgKCFzdGFydCkgewogICAgICAgIHN0YXJ0ID0gMDsKICAgICAgfQogICAgICBpZiAoIWVuZCkgewogICAgICAgIGVuZCA9IG1ldGFkYXRhLm1heFJlZkxlbmd0aDsKICAgICAgfQogICAgICBpZiAoIShzdGFydCA8PSBlbmQpKSB7CiAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiaW52YWxpZCBzdGFydCBhbmQgZW5kIGNvb3JkaW5hdGVzLiBzdGFydCBtdXN0IGJlIGxlc3MgdGhhbiBvciBlcXVhbCB0byBlbmQiKTsKICAgICAgfQogICAgICBpZiAoc3RhcnQgPT09IGVuZCkgewogICAgICAgIHJldHVybjsKICAgICAgfQogICAgICBjb25zdCBjaHVua3MgPSBhd2FpdCB0aGlzLmluZGV4LmJsb2Nrc0ZvclJhbmdlKHJlZk5hbWUsIHN0YXJ0LCBlbmQsIG9wdGlvbnMpOwogICAgICBjaGVja0Fib3J0U2lnbmFsKHNpZ25hbCk7CiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgY2h1bmtzLmxlbmd0aDsgaSArPSAxKSB7CiAgICAgICAgY29uc3Qgc2l6ZSA9IGNodW5rc1tpXS5mZXRjaGVkU2l6ZSgpOwogICAgICAgIGlmIChzaXplID4gdGhpcy5jaHVua1NpemVMaW1pdCkgewogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBUb28gbXVjaCBkYXRhLiBDaHVuayBzaXplICR7c2l6ZS50b0xvY2FsZVN0cmluZygpfSBieXRlcyBleGNlZWRzIGNodW5rU2l6ZUxpbWl0IG9mICR7dGhpcy5jaHVua1NpemVMaW1pdC50b0xvY2FsZVN0cmluZygpfS5gKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgbGV0IGxhc3QgPSBEYXRlLm5vdygpOwogICAgICBmb3IgKGxldCBjaHVua051bSA9IDA7IGNodW5rTnVtIDwgY2h1bmtzLmxlbmd0aDsgY2h1bmtOdW0gKz0gMSkgewogICAgICAgIGxldCBwcmV2aW91c1N0YXJ0Q29vcmRpbmF0ZTsKICAgICAgICBjb25zdCBjID0gY2h1bmtzW2NodW5rTnVtXTsKICAgICAgICBjb25zdCB7IGJ1ZmZlciwgY3Bvc2l0aW9ucywgZHBvc2l0aW9ucyB9ID0gYXdhaXQgdGhpcy5jaHVua0NhY2hlLmdldChjLnRvU3RyaW5nKCksIGMpOwogICAgICAgIGNoZWNrQWJvcnRTaWduYWwoc2lnbmFsKTsKICAgICAgICBsZXQgYmxvY2tTdGFydCA9IDA7CiAgICAgICAgbGV0IHBvcyA9IDA7CiAgICAgICAgd2hpbGUgKGJsb2NrU3RhcnQgPCBidWZmZXIubGVuZ3RoKSB7CiAgICAgICAgICBjb25zdCBuID0gYnVmZmVyLmluZGV4T2YoIlxuIiwgYmxvY2tTdGFydCk7CiAgICAgICAgICBpZiAobiA9PT0gLTEpIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgICBjb25zdCBiID0gYnVmZmVyLnNsaWNlKGJsb2NrU3RhcnQsIG4pOwogICAgICAgICAgY29uc3QgbGluZSA9IChkZWNvZGVyID09PSBudWxsIHx8IGRlY29kZXIgPT09IHZvaWQgMCA/IHZvaWQgMCA6IGRlY29kZXIuZGVjb2RlKGIpKSB8fCBiLnRvU3RyaW5nKCk7CiAgICAgICAgICBpZiAoZHBvc2l0aW9ucykgewogICAgICAgICAgICB3aGlsZSAoYmxvY2tTdGFydCArIGMubWludi5kYXRhUG9zaXRpb24gPj0gZHBvc2l0aW9uc1twb3MrK10pIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBwb3MtLTsKICAgICAgICAgIH0KICAgICAgICAgIGNvbnN0IHsgc3RhcnRDb29yZGluYXRlLCBvdmVybGFwcyB9ID0gdGhpcy5jaGVja0xpbmUobWV0YWRhdGEsIHJlZk5hbWUsIHN0YXJ0LCBlbmQsIGxpbmUpOwogICAgICAgICAgaWYgKHByZXZpb3VzU3RhcnRDb29yZGluYXRlICE9PSB2b2lkIDAgJiYgc3RhcnRDb29yZGluYXRlICE9PSB2b2lkIDAgJiYgcHJldmlvdXNTdGFydENvb3JkaW5hdGUgPiBzdGFydENvb3JkaW5hdGUpIHsKICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGBMaW5lcyBub3Qgc29ydGVkIGJ5IHN0YXJ0IGNvb3JkaW5hdGUgKCR7cHJldmlvdXNTdGFydENvb3JkaW5hdGV9ID4gJHtzdGFydENvb3JkaW5hdGV9KSwgdGhpcyBmaWxlIGlzIG5vdCB1c2FibGUgd2l0aCBUYWJpeC5gKTsKICAgICAgICAgIH0KICAgICAgICAgIHByZXZpb3VzU3RhcnRDb29yZGluYXRlID0gc3RhcnRDb29yZGluYXRlOwogICAgICAgICAgaWYgKG92ZXJsYXBzKSB7CiAgICAgICAgICAgIGNhbGxiYWNrKGxpbmUudHJpbSgpLCBjcG9zaXRpb25zW3Bvc10gKiAoMSA8PCA4KSArIChibG9ja1N0YXJ0IC0gZHBvc2l0aW9uc1twb3NdKSArIGMubWludi5kYXRhUG9zaXRpb24gKyAxKTsKICAgICAgICAgIH0gZWxzZSBpZiAoc3RhcnRDb29yZGluYXRlICE9PSB2b2lkIDAgJiYgc3RhcnRDb29yZGluYXRlID49IGVuZCkgewogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICB9CiAgICAgICAgICBpZiAodGhpcy55aWVsZFRpbWUgJiYgbGFzdCAtIERhdGUubm93KCkgPiB0aGlzLnlpZWxkVGltZSkgewogICAgICAgICAgICBsYXN0ID0gRGF0ZS5ub3coKTsKICAgICAgICAgICAgY2hlY2tBYm9ydFNpZ25hbChzaWduYWwpOwogICAgICAgICAgICBhd2FpdCB0aW1lb3V0KDEpOwogICAgICAgICAgfQogICAgICAgICAgYmxvY2tTdGFydCA9IG4gKyAxOwogICAgICAgIH0KICAgICAgfQogICAgfQogICAgYXN5bmMgZ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0YXJ0LCBlbmQgfSA9IGNvbHVtbk51bWJlcnM7CiAgICAgIGlmICghcmVmKSB7CiAgICAgICAgcmVmID0gMDsKICAgICAgfQogICAgICBpZiAoIXN0YXJ0KSB7CiAgICAgICAgc3RhcnQgPSAwOwogICAgICB9CiAgICAgIGlmICghZW5kKSB7CiAgICAgICAgZW5kID0gMDsKICAgICAgfQogICAgICBpZiAoZm9ybWF0ID09PSAiVkNGIikgewogICAgICAgIGVuZCA9IDg7CiAgICAgIH0KICAgICAgY29uc3QgbWF4Q29sdW1uID0gTWF0aC5tYXgocmVmLCBzdGFydCwgZW5kKTsKICAgICAgbGV0IGN1cnJlbnRDb2x1bW5OdW1iZXIgPSAxOwogICAgICBsZXQgY3VycmVudENvbHVtblN0YXJ0ID0gMDsKICAgICAgbGV0IHJlZlNlcSA9ICIiOwogICAgICBsZXQgc3RhcnRDb29yZGluYXRlID0gLUluZmluaXR5OwogICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpbmUubGVuZ3RoICsgMTsgaSArPSAxKSB7CiAgICAgICAgaWYgKGxpbmVbaV0gPT09ICIJIiB8fCBpID09PSBsaW5lLmxlbmd0aCkgewogICAgICAgICAgaWYgKGN1cnJlbnRDb2x1bW5OdW1iZXIgPT09IHJlZikgewogICAgICAgICAgICBpZiAodGhpcy5yZW5hbWVSZWZTZXEobGluZS5zbGljZShjdXJyZW50Q29sdW1uU3RhcnQsIGkpKSAhPT0gcmVnaW9uUmVmTmFtZSkgewogICAgICAgICAgICAgIHJldHVybiB7IG92ZXJsYXBzOiBmYWxzZSB9OwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cnJlbnRDb2x1bW5OdW1iZXIgPT09IHN0YXJ0KSB7CiAgICAgICAgICAgIHN0YXJ0Q29vcmRpbmF0ZSA9IHBhcnNlSW50KGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKSwgMTApOwogICAgICAgICAgICBpZiAoY29vcmRpbmF0ZV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ICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoZW5kQ29vcmRpbmF0ZSA8PSByZWdpb25TdGFydCkgewogICAgICAgICAgICAgIHJldHVybiB7IG92ZXJsYXBzOiBmYWxzZSB9OwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBjdXJyZW50Q29sdW1uU3RhcnQgPSBpICsgMTsKICAgICAgICAgIGN1cnJlbnRDb2x1bW5OdW1iZXIgKz0gMTsKICAgICAgICAgIGlmIChjdXJyZW50Q29sdW1uTnVtYmVyID4gbWF4Q29sdW1uKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4geyBzdGFydENvb3JkaW5hdGUsIG92ZXJsYXBzOiB0cnVlIH07CiAgICB9CiAgICBfZ2V0VmNmRW5kKHN0YXJ0Q29vcmRpbmF0ZSwgcmVmU2VxLCBpbmZvKSB7CiAgICAgIGxldCBlbmRDb29yZGluYXRlID0gc3RhcnRDb29yZGluYXRlICsgcmVmU2VxLmxlbmd0aDsKICAgICAgY29uc3QgaXNUUkEgPSBpbmZvLmluZGV4T2YoIlNWVFlQRT1UUkEiKSAhPT0gLTE7CiAgICAgIGlmIChpbmZvWzBdICE9PSAiLiIgJiYgIWlzVFJBKSB7CiAgICAgICAgbGV0IHByZXZDaGFyID0gIjsiOwogICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgaW5mby5sZW5ndGg7IGogKz0gMSkgewogICAgICAgICAgaWYgKHByZXZDaGFyID09PSAiOyIgJiYgaW5mby5zbGljZShqLCBqICsgNCkgPT09ICJFTkQ9IikgewogICAgICAgICAgICBsZXQgdmFsdWVFbmQgPSBpbmZvLmluZGV4T2YoIjsiLCBqKTsKICAgICAgICAgICAgaWYgKHZhbHVlRW5kID09PSAtMSkgewogICAgICAgICAgICAgIHZhbHVlRW5kID0gaW5mby5sZW5ndGg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZW5kQ29vcmRp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YWciLAogICAgICAgIERlc2NyaXB0aW9uOiAiZGJTTlAgbWVtYmVyc2hpcCIKICAgICAgfSwKICAgICAgRFA6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiY29tYmluZWQgZGVwdGggYWNyb3NzIHNhbXBsZXMiCiAgICAgIH0sCiAgICAgIEVORDogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJFbmQgcG9zaXRpb24gKGZvciB1c2Ugd2l0aCBzeW1ib2xpYyBhbGxlbGVzKSIKICAgICAgfSwKICAgICAgSDI6IHsKICAgICAgICBOdW1iZXI6IDAsCiAgICAgICAgVHlwZTogIkZsYWciLAogICAgICAgIERlc2NyaXB0aW9uOiAiSGFwTWFwMiBtZW1iZXJzaGlwIgogICAgICB9LAogICAgICBIMzogewogICAgICAgIE51bWJlcjogMCwKICAgICAgICBUeXBlOiAiRmxhZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICJIYXBNYXAzIG1lbWJlcnNoaXAiCiAgICAgIH0sCiAgICAgIE1ROiB7CiAgICAgICAgTnVtYmVyOiAxLAogICAgICAgIFR5cGU6IG51bGwsCiAgICAgICAgRGVzY3JpcHRpb246ICJSTVMgbWFwcGluZyBxdWFsaXR5IgogICAgICB9LAogICAgICBNUTA6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiTnVtYmVyIG9mIE1BUFEgPT0gMCByZWFkcyIKICAgICAgfSwKICAgICAgTlM6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiTnVtYmVyIG9mIHNhbXBsZXMgd2l0aCBkYXRhIgogICAgICB9LAogICAgICBTQjogewogICAgICAgIE51bWJlcjogNCwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJTdHJhbmQgYmlhcyIKICAgICAgfSwKICAgICAgU09NQVRJQzogewogICAgICAgIE51bWJlcjogMCwKICAgICAgICBUeXBlOiAiRmxhZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICJTb21hdGljIG11dGF0aW9uIChmb3IgY2FuY2VyIGdlbm9taWNzKSIKICAgICAgfSwKICAgICAgVkFMSURBVEVEOiB7CiAgICAgICAgTnVtYmVyOiAwLAogICAgICAgIFR5cGU6ICJGbGFnIiwKICAgICAgICBEZXNjcmlwdGlvbjogIlZhbGlkYXRlZCBieSBmb2xsb3ctdXAgZXhwZXJpbWVudCIKICAgICAgfSwKICAgICAgIjEwMDBHIjogewogICAgICAgIE51bWJlcjogMCwKICAgICAgICBUeXBlOiAiRmxhZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICIxMDAwIEdlbm9tZXMgbWVtYmVyc2hpcCIKICAgICAgfSwKICAgICAgSU1QUkVDSVNFOiB7CiAgICAgICAgTnVtYmVyOiAwLAogICAgICAgIFR5cGU6ICJGbGFnIiwKICAgICAgICBEZXNjcmlwdGlvbjogIkltcHJlY2lzZSBzdHJ1Y3R1cmFsIHZhcmlhdGlvbiIKICAgICAgfSwKICAgICAgTk9WRUw6IHsKICAgICAgICBOdW1iZXI6IDAsCiAgICAgICAgVHlwZTogIkZsYWciLAogICAgICAgIERlc2NyaXB0aW9uOiAiSW5kaWNhdGVzIGEgbm92ZWwgc3RydWN0dXJhbCB2YXJpYXRpb24iCiAgICAgIH0sCiAgICAgIFNWVFlQRTogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIlR5cGUgb2Ygc3RydWN0dXJhbCB2YXJpYW50IgogICAgICB9LAogICAgICBTVkxFTjogewogICAgICAgIE51bWJlcjogbnVsbCwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJEaWZmZXJlbmNlIGluIGxlbmd0aCBiZXR3ZWVuIFJFRiBhbmQgQUxUIGFsbGVsZXMiCiAgICAgIH0sCiAgICAgIENJUE9TOiB7CiAgICAgICAgTnVtYmVyOiAyLAogICAgICAgIFR5cGU6ICJJbnRlZ2VyIiwKICAgICAgICBEZXNjcmlwdGlvbjogIkNvbmZpZGVuY2UgaW50ZXJ2YWwgYXJvdW5kIFBPUyBmb3IgaW1wcmVjaXNlIHZhcmlhbnRzIgogICAgICB9LAogICAgICBDSUVORDogewogICAgICAgIE51bWJlcjogMiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJDb25maWRlbmNlIGludGVydmFsIGFyb3VuZCBFTkQgZm9yIGltcHJlY2lzZSB2YXJpYW50cyIKICAgICAgfSwKICAgICAgSE9NTEVOOiB7CiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiTGVuZ3RoIG9mIGJhc2UgcGFpciBpZGVudGljYWwgbWljcm8taG9tb2xvZ3kgYXQgZXZlbnQgYnJlYWtwb2ludHMiCiAgICAgIH0sCiAgICAgIEhPTVNFUTogewogICAgICAgIFR5cGU6ICJTdHJpbmciLAogICAgICAgIERlc2NyaXB0aW9uOiAiU2VxdWVuY2Ugb2YgYmFzZSBwYWlyIGlkZW50aWNhbCBtaWNyby1ob21vbG9neSBhdCBldmVudCBicmVha3BvaW50cyIKICAgICAgfSwKICAgICAgQktQVElEOiB7CiAgICAgICAgVHlwZTogIlN0cmluZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICJJRCBvZiB0aGUgYXNzZW1ibGVkIGFsdGVybmF0ZSBhbGxlbGUgaW4gdGhlIGFzc2VtYmx5IGZpbGUiCiAgICAgIH0sCiAgICAgIE1FSU5GTzogewogICAgICAgIE51bWJlcjogNCwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIk1vYmlsZSBlbGVtZW50IGluZm8gb2YgdGhlIGZvcm0gTkFNRSxTVEFSVCxFTkQsUE9MQVJJVFkiCiAgICAgIH0sCiAgICAgIE1FVFJBTlM6IHsKICAgICAgICBOdW1iZXI6IDQsCiAgICAgICAgVHlwZTogIlN0cmluZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICJNb2JpbGUgZWxlbWVudCB0cmFuc2R1Y3Rpb24gaW5mbyBvZiB0aGUgZm9ybSBDSFIsU1RBUlQsRU5ELFBPTEFSSVRZIgogICAgICB9LAogICAgICBER1ZJRDogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIklEIG9mIHRoaXMgZWxlbWVudCBpbiBEYXRhYmFzZSBvZiBHZW5vbWljIFZhcmlhdGlvbiIKICAgICAgfSwKICAgICAgREJWQVJJRDogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIklEIG9mIHRoaXMgZWxlbWVudCBpbiBEQlZBUiIKICAgICAgfSwKICAgICAgREJSSVBJRDogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIklEIG9mIHRoaXMgZWxlbWVudCBpbiBEQlJJUCIKICAgICAgfSwKICAgICAgTUFURUlEOiB7CiAgICAgICAgTnVtYmVyOiBudWxsLAogICAgICAgIFR5cGU6ICJTdHJpbmciLAogICAgICAgIERlc2NyaXB0aW9uOiAiSUQgb2YgbWF0ZSBicmVha2VuZHMiCiAgICAgIH0sCiAgICAgIFBBUklEOiB7CiAgICAgICAgTnVtYmVyOiAxLAogICAgICAgIFR5cGU6ICJTdHJpbmciLAogICAgICAgIERlc2NyaXB0aW9uOiAiSUQgb2YgcGFydG5lciBicmVha2VuZCIKICAgICAgfSwKICAgICAgRVZFTlQ6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIlN0cmluZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICJJRCBvZiBldmVudCBhc3NvY2lhdGVkIHRvIGJyZWFrZW5kIgogICAgICB9LAogICAgICBDSUxFTjogewogICAgICAgIE51bWJlcjogMiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJDb25maWRlbmNlIGludGVydmFsIGFyb3VuZCB0aGUgaW5zZXJ0ZWQgbWF0ZXJpYWwgYmV0d2VlbiBicmVha2VuZCIKICAgICAgfSwKICAgICAgRFBBREo6IHsgVHlwZTogIkludGVnZXIiLCBEZXNjcmlwdGlvbjogIlJlYWQgRGVwdGggb2YgYWRqYWNlbmN5IiB9LAogICAgICBDTjogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJDb3B5IG51bWJlciBvZiBzZWdtZW50IGNvbnRhaW5pbmcgYnJlYWtlbmQiCiAgICAgIH0sCiAgICAgIENOQURKOiB7CiAgICAgICAgTnVtYmVyOiBudWxsLAogICAgICAgIFR5cGU6ICJJbnRlZ2VyIiwKICAgICAgICBEZXNjcmlwdGlvbjogIkNvcHkgbnVtYmVyIG9mIGFkamFjZW5jeSIKICAgICAgfSwKICAgICAgQ0lDTjogewogICAgICAgIE51bWJlcjogMiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJDb25maWRlbmNlIGludGVydmFsIGFyb3VuZCBjb3B5IG51bWJlciBmb3IgdGhlIHNlZ21lbnQiCiAgICAgIH0sCiAgICAgIENJQ05BREo6IHsKICAgICAgICBOdW1iZXI6IG51bGwsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiQ29uZmlkZW5jZSBpbnRlcnZhbCBhcm91bmQgY29weSBudW1iZXIgZm9yIHRoZSBhZGphY2VuY3kiCiAgICAgIH0KICAgIH0sCiAgICBHZW5vdHlwZUZpZWxkczogewogICAgICBBRDogewogICAgICAgIE51bWJlcjogIlIiLAogICAgICAgIFR5cGU6ICJJbnRlZ2VyIiwKICAgICAgICBEZXNjcmlwdGlvbjogIlJlYWQgZGVwdGggZm9yIGVhY2ggYWxsZWxlIgogICAgICB9LAogICAgICBBREY6IHsKICAgICAgICBOdW1iZXI6ICJSIiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJSZWFkIGRlcHRoIGZvciBlYWNoIGFsbGVsZSBvbiB0aGUgZm9yd2FyZCBzdHJhbmQiCiAgICAgIH0sCiAgICAgIEFEUjogewogICAgICAgIE51bWJlcjogIlIiLAogICAgICAgIFR5cGU6ICJJbnRlZ2VyIiwKICAgICAgICBEZXNjcmlwdGlvbjogIlJlYWQgZGVwdGggZm9yIGVhY2ggYWxsZWxlIG9uIHRoZSByZXZlcnNlIHN0cmFuZCIKICAgICAgfSwKICAgICAgRFA6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiUmVhZCBkZXB0aCIKICAgICAgfSwKICAgICAgRUM6IHsKICAgICAgICBOdW1iZXI6ICJBIiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJFeHBlY3RlZCBhbHRlcm5hdGUgYWxsZWxlIGNvdW50cyIKICAgICAgfSwKICAgICAgRlQ6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIlN0cmluZyIsCiAgICAgICAgRGVzY3JpcHRpb246ICdGaWx0ZXIgaW5kaWNhdGluZyBpZiB0aGlzIGdlbm90eXBlIHdhcyAiY2FsbGVkIicKICAgICAgfSwKICAgICAgR0w6IHsKICAgICAgICBOdW1iZXI6ICJHIiwKICAgICAgICBUeXBlOiAiRmxvYXQiLAogICAgICAgIERlc2NyaXB0aW9uOiAiR2Vub3R5cGUgbGlrZWxpaG9vZHMiCiAgICAgIH0sCiAgICAgIEdQOiB7CiAgICAgICAgTnVtYmVyOiAiRyIsCiAgICAgICAgVHlwZTogIkZsb2F0IiwKICAgICAgICBEZXNjcmlwdGlvbjogIkdlbm90eXBlIHBvc3RlcmlvciBwcm9iYWJpbGl0aWVzIgogICAgICB9LAogICAgICBHUTogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJDb25kaXRpb25hbCBnZW5vdHlwZSBxdWFsaXR5IgogICAgICB9LAogICAgICBHVDogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiU3RyaW5nIiwKICAgICAgICBEZXNjcmlwdGlvbjogIkdlbm90eXBlIgogICAgICB9LAogICAgICBIUTogewogICAgICAgIE51bWJlcjogMiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJIYXBsb3R5cGUgcXVhbGl0eSIKICAgICAgfSwKICAgICAgTVE6IHsKICAgICAgICBOdW1iZXI6IDEsCiAgICAgICAgVHlwZTogIkludGVnZXIiLAogICAgICAgIERlc2NyaXB0aW9uOiAiUk1TIG1hcHBpbmcgcXVhbGl0eSIKICAgICAgfSwKICAgICAgUEw6IHsKICAgICAgICBOdW1iZXI6ICJHIiwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJQaHJlZC1zY2FsZWQgZ2Vub3R5cGUgbGlrZWxpaG9vZHMgcm91bmRlZCB0byB0aGUgY2xvc2VzdCBpbnRlZ2VyIgogICAgICB9LAogICAgICBQUTogewogICAgICAgIE51bWJlcjogMSwKICAgICAgICBUeXBlOiAiSW50ZWdlciIsCiAgICAgICAgRGVzY3JpcHRpb246ICJQaGFzaW5nIHF1YWxp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cy5mb3JFYWNoKChzYW1wbGUsIGluZGV4KSA9PiB7CiAgICAgICAgICBnZW5vdHlwZXNbc2FtcGxlXSA9IHt9OwogICAgICAgICAgZm9ybWF0S2V5cy5mb3JFYWNoKChrZXkpID0+IHsKICAgICAgICAgICAgZ2Vub3R5cGVzW3NhbXBsZV1ba2V5XSA9IG51bGw7CiAgICAgICAgICB9KTsKICAgICAgICAgIHJlc3RbaW5kZXhdLnNwbGl0KCI6IikuZmlsdGVyKChmKSA9PiBmKS5mb3JFYWNoKCh2YWwsIGluZGV4MikgPT4gewogICAgICAgICAgICBsZXQgdGhpc1ZhbHVlOwogICAgICAgICAgICBpZiAodmFsID09PSAiIiB8fCB2YWwgPT09ICIuIiB8fCB2YWwgPT09IHZvaWQgMCkgewogICAgICAgICAgICAgIHRoaXNWYWx1ZSA9IG51bGw7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgY29uc3QgZW50cmllcyA9IHZhbC5zcGxpdCgiLCIpLm1hcCgoZW50KSA9PiBlbnQgPT09ICIuIiA/IG51bGwgOiBlbnQpOwogICAgICAgICAgICAgIGNvbnN0IHZhbHVlVHlwZSA9IHRoaXMuZ2V0TWV0YWRhdGEoIkZPUk1BVCIsIGZvcm1hdEtleXNbaW5kZXgyXSwgIlR5cGUiKTsKICAgICAgICAgICAgICBpZiAodmFsdWVUeXBlID09PSAiSW50ZWdlciIgfHwgdmFsdWVUeXBlID09PSAiRmxvYXQiKSB7CiAgICAgICAgICAgICAgICB0aGlzVmFsdWUgPSBlbnRyaWVzLm1hcCgodmFsMikgPT4gdmFsMiA/ICt2YWwyIDogdmFsMik7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHRoaXNWYWx1ZSA9IGVudHJpZXM7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGdlbm90eXBlc1tzYW1wbGVdW2Zvcm1hdEtleXNbaW5kZXgyXV0gPSB0aGlzVmFsdW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gIiIpIHsKICAgICAgICAgICAgZGF0YVtjdXJyS2V5XSA9IG51bGw7CiAgICAgICAgICAgIGN1cnJLZXkgPSAiIjsKICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgaWYgKHN0YXRlID09PSAyKSB7CiAgICAgICAgICBpZiAoc3RyW2ldID09PSBwYWlyU2VwYXJhdG9yKSB7CiAgICAgICAgICAgIGRhdGFbY3VycktleV0gPSBjdXJyVmFsdWU7CiAgICAgICAgICAgIGN1cnJLZXkgPSAiIjsKICAgICAgICAgICAgY3VyclZhbHVlID0gIiI7CiAgICAgICAgICAgIHN0YXRlID0gMTsKICAgICAgICAgIH0gZWxzZSBpZiAoc3RyW2ldID09PSAnIicpIHsKICAgICAgICAgICAgc3RhdGUgPSAzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgY3VyclZhbHVlICs9IHN0cltpXTsKICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgaWYgKHN0YXRlID09PSAzKSB7CiAgICAgICAgICBpZiAoc3RyW2ldICE9PSAnIicpIHsKICAgICAgICAgICAgY3VyclZhbHVlICs9IHN0cltpXTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHN0YXRlID0gMjsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgaWYgKHN0YXRlID09PSAyIHx8IHN0YXRlID09PSAzKSB7CiAgICAgICAgZGF0YVtjdXJyS2V5XSA9IGN1cnJWYWx1ZTsKICAgICAgfSBlbHNlIGlmIChzdGF0ZSA9PT0gMSkgewogICAgICAgIGRhdGFbY3VycktleV0gPSBudWxsOwogICAgICB9CiAgICAgIHJldHVybiBkYXRhOwogICAgfQogICAgcGFyc2VMaW5lKGxpbmUpIHsKICAgICAgbGluZSA9IGxpbmUudHJpbSgpOwogICAgICBpZiAoIWxpbmUubGVuZ3RoKSB7CiAgICAgICAgcmV0dXJuIHZvaWQgMDsKICAgICAgfQogICAgICBjb25zdCBwYXJzZXIgPSB0aGlzOwogICAgICBsZXQgY3VyckNoYXIgPSAwOwogICAgICBmb3IgKGxldCBjdXJyRmllbGQgPSAwOyBjdXJyQ2hhciA8IGxpbmUubGVuZ3RoOyBjdXJyQ2hhciArPSAxKSB7CiAgICAgICAgaWYgKGxpbmVbY3VyckNoYXJdID09PSAiCSIpIHsKICAgICAgICAgIGN1cnJGaWVsZCArPSAxOwogICAgICAgIH0KICAgICAgICBpZiAoY3VyckZpZWxkID09PSA5KSB7CiAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgIH0KICAgICAgY29uc3QgZmllbGRzID0gbGluZS5zdWJzdHIoMCwgY3VyckNoYXIpLnNwbGl0KCIJIik7CiAgICAgIGNvbnN0IHJlc3QgPSBsaW5lLnN1YnN0cihjdXJyQ2hhciArIDEpOwogICAgICBjb25zdCBbQ0hST00sIFBPUywgSUQsIFJFRiwgQUxULCBRVUFMLCBGSUxURVJdID0gZmllbGRzOwogICAgICBjb25zdCBjaHJvbSA9IENIUk9NOwogICAgICBjb25zdCBwb3MgPSArUE9TOwogICAgICBjb25zdCBpZCA9IElEID09PSAiLiIgPyBudWxsIDogSUQuc3BsaXQoIjsiKTsKICAgICAgY29uc3QgcmVmID0gUkVGOwogICAgICBjb25zdCBhbHQgPSBBTFQgPT09ICIuIiA/IG51bGwgOiBBTFQuc3BsaXQoIiwiKTsKICAgICAgY29uc3QgcXVhbCA9IFFVQUwgPT09ICIuIiA/IG51bGwgOiArUVVBTDsKICAgICAgY29uc3QgZmlsdGVyID0gRklMVEVSID09PSAiLiIgPyBudWxsIDogRklMVEVSLnNwbGl0KCI7Iik7CiAgICAgIGlmICh0aGlzLnN0cmljdCAmJiBmaWVsZHNbN10gPT09IHZvaWQgMCkgewogICAgICAgIHRocm93IG5ldyBFcnJvcigibm8gSU5GTyBmaWVsZCBzcGVjaWZpZWQsIG11c3QgY29udGFpbiBhdCBsZWFzdCBhICcuJyAodHVybiBvZmYgc3RyaWN0IG1vZGUgdG8gYWxsb3cpIik7CiAgICAgIH0KICAgICAgY29uc3QgaW5mbyA9IGZpZWxkc1s3XSA9PT0gdm9pZCAwIHx8IGZpZWxkc1s3XSA9PT0gIi4iID8ge30gOiB0aGlzLl9wYXJzZUtleVZhbHVlKGZpZWxkc1s3XSk7CiAgICAgIE9iamVjdC5rZXlzKGluZm8pLmZvckVhY2goKGtleSkgPT4gewogICAgICAgIGxldCBpdGVtczsKICAgICAgICBpZiAoaW5mb1trZXldKSB7CiAgICAgICAgICBpdGVtcyA9IGluZm9ba2V5XS5zcGxpdCgiLCIpLm1hcCgodmFsKSA9PiB2YWwgPT09ICIuIiA/IG51bGwgOiB2YWwpLm1hcCgoZikgPT4gZiA/IGRlY29kZVVSSUNvbXBvbmVudE5vVGhyb3coZikgOiBmKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaXRlbXMgPSBpbmZvW2tleV07CiAgICAgICAgfQogICAgICAgIGNvbnN0IGl0ZW1UeXBlID0gdGhpcy5nZXRNZXRhZGF0YSgiSU5GTyIsIGtleSwgIlR5cGUiKTsKICAgICAgICBpZiAoaXRlbVR5cGUpIHsKICAgICAgICAgIGlmIChpdGVtVHlwZSA9PT0gIkludGVnZXIiIHx8IGl0ZW1UeXBlID09PSAiRmxvYXQiKSB7CiAgICAgICAgICAgIGl0ZW1zID0gaXRlbXMubWFwKCh2YWwpID0+IHsKICAgICAgICAgICAgICBpZiAodmFsID09PSBudWxsKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcmV0dXJuIE51bWJlcih2YWwpOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0gZWxzZSBpZiAoaXRlbVR5cGUgPT09ICJGbGFnIikgewogICAgICAgICAgICBpZiAoaW5mb1trZXldKSB7CiAgICAgICAgICAgICAgY29uc29sZS53YXJuKGBJbmZvIGZpZWxkICR7a2V5fSBpcyBhIEZsYWcgYW5kIHNob3VsZCBub3QgaGF2ZSBhIHZhbHVlIChnb3QgdmFsdWUgJHtpbmZvW2tleV19KWApOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGl0ZW1zID0gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpbmZvW2tleV0gPSBpdGVtczsKICAgICAgfSk7CiAgICAgIGNvbnN0IHZhcmlhbnQgPSBuZXcgVmFyaWFudCh7CiAgICAgICAgQ0hST006IGNocm9tLAogICAgICAgIFBPUzogcG9zLAogICAgICAgIEFMVDogYWx0LAogICAgICAgIElORk86IGluZm8sCiAgICAgICAgUkVGOiByZWYsCiAgICAgICAgRklMVEVSOiBmaWx0ZXIgJiYgZmlsdGVyLmxlbmd0aCA9PT0gMSAmJiBmaWx0ZXJbMF0gPT09ICJQQVNTIiA/ICJQQVNTIiA6IGZpbHRlciwKICAgICAgICBJRDogaWQsCiAgICAgICAgUVVBTDogcXVhbAogICAgICB9KTsKICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHZhcmlhbnQsICJTQU1QTEVTIiwgewogICAgICAgIGdldCgpIHsKICAgICAgICAgIGNvbnN0IHNhbXBsZXMgPSBwYXJzZXIuX3BhcnNlR2Vub3R5cGVzKGZpZWxkc1s4XSwgcmVzdCk7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgIlNBTVBMRVMiLCB7CiAgICAgICAgICAgIHZhbHVlOiBzYW1wbGVzLAogICAgICAgICAgICBjb25maWd1cmFibGU6IGZhbHNlCiAgICAgICAgICB9KTsKICAgICAgICAgIHJldHVybiBzYW1wbGVzOwogICAgICAgIH0sCiAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgIH0pOwogICAgICByZXR1cm4gdmFyaWFudDsKICAgIH0KICB9OwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vQGdtb2QrdmNmQDUuMC4xMC9ub2RlX21vZHVsZXMvQGdtb2QvdmNmL2VzbS9pbmRleC5qcwogIHZhciBlc21fZGV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fQoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vZDMtYXJyYXlAMi4xMi4xL25vZGVfbW9kdWxlcy9kMy1hcnJheS9zcmMvYmlzZWN0b3IuanMKICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgZnVuY3Rpb24gYmlzZWN0b3JfZGVmYXVsdChmKSB7CiAgICBsZXQgZGVsdGEgPSBmOwogICAgbGV0IGNvbXBhcmUgPSBmOwogICAgaWYgKGYubGVuZ3RoID09PSAxKSB7CiAgICAgIGRlbHRhID0gKGQsIHgpID0+IGYoZCkgLSB4OwogICAgICBjb21wYXJlID0gYXNjZW5kaW5nQ29tcGFyYXRvcihmKTsKICAgIH0KICAgIGZ1bmN0aW9uIGxlZnQoYSwgeCwgbG8sIGhpKSB7CiAgICAgIGlmIChsbyA9PSBudWxsKQogICAgICAgIGxvID0gMDsKICAgICAgaWYgKGhpID09IG51bGwpCiAgICAgICAgaGkgPSBhLmxlbmd0aDsKICAgICAgd2hpbGUgKGxvIDwgaGkpIHsKICAgICAgICBjb25zdCBtaWQgPSBsbyArIGhpID4+PiAxOwogICAgICAgIGlmIChjb21wYXJlKGFbbWlkXSwgeCkgPCAwKQogICAgICAgICAgbG8gPSBtaWQgKyAxOwogICAgICAgIGVsc2UKICAgICAgICAgIGhpID0gbWlkOwogICAgICB9CiAgICAgIHJldHVybiBsbzsKICAgIH0KICAgIGZ1bmN0aW9uIHJpZ2h0KGEsIHgsIGxvLCBoaSkgewogICAgICBpZiAobG8gPT0gbnVsbCkKICAgICAgICBsbyA9IDA7CiAgICAgIGlmIChoaSA9PSBudWxsKQogICAgICAgIGhpID0gYS5sZW5ndGg7CiAgICAgIHdoaWxlIChsbyA8IGhpKSB7CiAgICAgICAgY29uc3QgbWlkID0gbG8gKyBoaSA+Pj4gMTsKICAgICAgICBpZiAoY29tcGFyZShhW21pZF0sIHgpID4gMCkKICAgICAgICAgIGhpID0gbWlkOwogICAgICAgIGVsc2UKICAgICAgICAgIGxvID0gbWlkICsgMTsKICAgICAgfQogICAgICByZXR1cm4gbG87CiAgICB9CiAgICBmdW5jdGlvbiBjZW50ZXIoYSwgeCwgbG8sIGhpKSB7CiAgICAgIGlmIChsbyA9PSBudWxsKQogICAgICAgIGxvID0gMDsKICAgICAgaWYgKGhpID09IG51bGwpCiAgICAgICAgaGkgPSBhLmxlbmd0aDsKICAgICAgY29uc3QgaSA9IGxlZnQoYSwgeCwgbG8sIGhpIC0gMSk7CiAgICAgIHJldHVybiBpID4gbG8gJiYgZGVsdGEoYVtpIC0gMV0sIHgpID4gLWRlbHRhKGFbaV0sIHgpID8gaSAtIDEgOiBpOwogICAgfQogICAgcmV0dXJuIHsgbGVmdCwgY2VudGVyLCByaWdodCB9OwogIH0KICBmdW5jdGlvbiBhc2NlbmRpbmdDb21wYXJhdG9yKGYpIHsKICAgIHJldHVybiAoZCwgeCkgPT4gYXNjZW5kaW5nX2RlZmF1bHQoZihkKSwgeCk7CiAgfQoKICAvLyBzcmMvZGF0YS1mZXRjaGVycy91dGlscy50cwogIHZhciBEYXRhU291cmNlID0gY2xhc3MgewogICAgY29uc3RydWN0b3IoZmlsZSwgY2hyb21TaXplcywgb3B0aW9ucykgewogICAgICB0aGlzLmZpbGUgPSBmaWxlOwogICAgICB0aGlzLm9wdGlvbnMgPSBvcHRpb25zOwogICAgICB0aGlzLmNocm9tSW5mbyA9IHNpemVzVG9DaHJvbUluZm8oY2hyb21TaXplcyk7CiAgICAgIHRoaXMudGlsZXNldEluZm8gPSB0aWxlc2V0SW5mb0Zyb21DaHJvbUluZm8odGhpcy5jaHJvbUluZm8pOwogICAgfQogICAgY2hyb21JbmZvOwogICAgdGlsZXNldEluZm87CiAgfTsKICB2YXIgY2hyb21JbmZvQmlzZWN0b3IgPSBiaXNlY3Rvcl9kZWZhdWx0KChkKSA9PiBkLnBvcykubGVmdDsKICB2YXIgY2hyVG9BYnMgPSAoY2hyb20sIGNocm9tUG9zLCBjaHJvbUluZm8pID0+IGNocm9tSW5mby5jaHJQb3N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jaGluZyAke3RoaXMudXJsfWApOwogICAgfTsKICB9OwoKICAvLyBzcmMvZGF0YS1mZXRjaGVycy92Y2YvdXRpbHMudHMKICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgdmFyIGdldE11dGF0aW9uVHlwZSA9IChyZWYsIGFsdCkgPT4gewogICAgaWYgKCFhbHQpCiAgICAgIHJldHVybiAidW5rbm93biI7CiAgICBpZiAocmVmLmxlbmd0aCA9PT0gYWx0Lmxlbmd0aCkKICAgICAgcmV0dXJuICJzdWJzdGl0dXRpb24iOwogICAgaWYgKHJlZi5sZW5ndGggPiBhbHQubGVuZ3RoKQogICAgICByZXR1cm4gImRlbGV0aW9uIjsKICAgIGlmIChyZWYubGVuZ3RoIDwgYWx0Lmxlbmd0aCkKICAgICAgcmV0dXJuICJpbnNlcnRpb24iOwogICAgcmV0dXJuICJ1bmtub3duIjsKICB9OwogIHZhciBnZXRTdWJzdGl0dXRpb25UeXBlID0gKHJlZiwgYWx0KSA9PiB7CiAgICBzd2l0Y2ggKHJlZiArIGFsdCkgewogICAgICBjYXNlICJDQSI6CiAgICAgIGNhc2UgIkdUIjoKICAgICAgICByZXR1cm4gIkM+QSI7CiAgICAgIGNhc2UgIkNHIjoKICAgICAgY2FzZSAiR0MiOgogICAgICAgIHJldHVybiAiQz5HIjsKICAgICAgY2FzZSAiQ1QiOgogICAgICBjYXNlICJHQSI6CiAgICAgICAgcmV0dXJuICJDPlQiOwogICAgICBjYXNlICJUQSI6CiAgICAgIGNhc2UgIkFUIjoKICAgICAgICByZXR1cm4gIlQ+QSI7CiAgICAgIGNhc2UgIlRDIjoKICAgICAgY2FzZSAiQUciOgogICAgICAgIHJldHVybiAiVD5DIjsKICAgICAgY2FzZSAiVEciOgogICAgICBjYXNlICJBQyI6CiAgICAgICAgcmV0dXJuICJUPkciOwogICAgICBkZWZhdWx0OgogICAgICAgIHJldHVybiAidW5rbm93biI7CiAgICB9CiAgfTsKICBmdW5jdGlvbiByZWNvcmRUb1RpbGU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ZWNvcmRUb1RpbGUodmNmUmVjb3JkLCBjaHJvbVN0YXJ0LCBwcmV2UE9TKTsKICAgICAgICAgICAgcHJldlBPUyA9IHZjZlRpbGUuUE9TOwogICAgICAgICAgICB0aWxlcy5wdXNoKHZjZlRpbGUpOwogICAgICAgICAgfTsKICAgICAgICAgIGlmIChtYXhYID4gY2hyb21FbmQpIHsKICAgICAgICAgICAgc3RhcnRQb3MgPSBjdXJNaW5YIC0gY2hyb21TdGFydDsKICAgICAgICAgICAgZW5kUG9zID0gY2hyb21FbmQgLSBjaHJvbVN0YXJ0OwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgc3RhcnRQb3MgPSBNYXRoLmZsb29yKGN1ck1pblggLSBjaHJvbVN0YXJ0KTsKICAgICAgICAgICAgZW5kUG9zID0gTWF0aC5jZWlsKG1heFggLSBjaHJvbVN0YXJ0KTsKICAgICAgICAgIH0KICAgICAgICAgIHNvdXJjZS5maWxlLnRiaS5nZXRMaW5lcyhjaHJvbU5hbWUsIHN0YXJ0UG9zLCBlbmRQb3MsIGxpbmVDYWxsYmFjaykudGhlbigoKSA9PiB7CiAgICAgICAgICAgIHJlc29sdmUodGlsZXMpOwogICAgICAgICAgfSk7CiAgICAgICAgfSk7CiAgICAgICAgcmVjb3JkUHJvbWlzZXMucHVzaCh0aWxlc1Byb21pc2UpOwogICAgICAgIGlmIChtYXhYIDw9IGNocm9tRW5kKSB7CiAgICAgICAgICBjb250aW51ZTsKICAgICAgICB9CiAgICAgICAgY3VyTWluWCA9IGNocm9tRW5kOwogICAgICB9CiAgICAgIGNvbnN0IHRpbGVBcnJheXMgPSBhd2FpdCBQcm9taXNlLmFsbChyZWNvcmRQcm9taXNlcyk7CiAgICAgIHJldHVybiB0aWxlQXJyYXlzLmZsYXQoKTsKICAgIH0KICB9OwogIHZhciB0aWxlVmFsdWVzID0ge307CiAgdmFyIGRhdGFTb3VyY2VzID0gbmV3IE1hcCgpOwogIGZ1bmN0aW9uIGluaXQodWlkL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hrZW5hcywgRG9jdW1lbnRDbG91ZCBhbmQgSW52ZXN0aWdhdGl2ZSBSZXBvcnRlcnMgJiBFZGl0b3JzCiAqLwo="; -const blob$2 = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs$2)], { type: "text/javascript;charset=utf-8" }); -function Worker$3() { - const objURL = blob$2 && (window.URL || window.webkitURL).createObjectURL(blob$2); - try { - return objURL ? new Worker(objURL) : new Worker("data:application/javascript;base64," + encodedJs$2, { type: "module" }); - } finally { - objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL); - } -} -const DEBOUNCE_TIME$2 = 200; -class VcfDataFetcher { - constructor(HGC, config2) { - __publicField(this, "dataConfig", {}); - // required for higlass - __publicField(this, "uid"); - __publicField(this, "prevRequestTime"); - __publicField(this, "track"); - __publicField(this, "toFetch"); - __publicField(this, "fetchTimeout"); - __publicField(this, "worker"); - this.uid = HGC.libraries.slugid.nice(); - this.prevRequestTime = 0; - this.toFetch = /* @__PURE__ */ new Set(); - const { url, indexUrl, assembly, ...options } = config2; - this.worker = spawn(new Worker$3()).then(async (worker) => { - const chromSizes = Object.entries(computeChromSizes(assembly).size); - await worker.init(this.uid, { url, indexUrl }, chromSizes, options); - return worker; - }); - } - /* - * Collect Tileset Information, such as tile size and genomic positions - */ - async tilesetInfo(callback) { - (await this.worker).tilesetInfo(this.uid).then(callback); - } - fetchTilesDebounced(receivedTiles, tileIds) { - this.track.drawLoadingCue(); - tileIds.forEach((tileId) => this.toFetch.add(tileId)); - if (this.fetchTimeout) { - clearTimeout(this.fetchTimeout); - } - this.fetchTimeout = setTimeout(() => { - this.sendFetch(receivedTiles, [...this.toFetch]); - this.toFetch.clear(); - }, DEBOUNCE_TIME$2); - } - async sendFetch(receivedTiles, tileIds) { - (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles); - } - async getTabularData(tileIds) { - const buf = await (await this.worker).getTabularData(this.uid, tileIds); - return JSON.parse(new TextDecoder().decode(buf)); - } -} -__publicField(VcfDataFetcher, "config", { type: "vcf" }); -const BigInt32 = BigInt(32); -function getBigInt64(dataView, byteOffset, littleEndian) { - const littleEndianMask = Number(!!littleEndian); - const bigEndianMask = Number(!littleEndian); - return BigInt(dataView.getInt32(byteOffset, littleEndian) * bigEndianMask + dataView.getInt32(byteOffset + 4, littleEndian) * littleEndianMask) << BigInt32 | BigInt(dataView.getUint32(byteOffset, littleEndian) * littleEndianMask + dataView.getUint32(byteOffset + 4, littleEndian) * bigEndianMask); -} -function getBigUint64(dataView, byteOffset, littleEndian) { - const a = dataView.getUint32(byteOffset, littleEndian); - const b = dataView.getUint32(byteOffset + 4, littleEndian); - const littleEndianMask = Number(!!littleEndian); - const bigEndianMask = Number(!littleEndian); - return BigInt(a * bigEndianMask + b * littleEndianMask) << BigInt32 | BigInt(a * littleEndianMask + b * bigEndianMask); -} -function setBigInt64(dataView, byteOffset, value, littleEndian) { - const hi = Number(value >> BigInt32); - const lo = Number(value & BigInt(4294967295)); - if (littleEndian) { - dataView.setInt32(byteOffset + 4, hi, littleEndian); - dataView.setUint32(byteOffset, lo, littleEndian); - } else { - dataView.setInt32(byteOffset, hi, littleEndian); - dataView.setUint32(byteOffset + 4, lo, littleEndian); - } -} -function setBigUint64(dataView, byteOffset, value, littleEndian) { - const hi = Number(value >> BigInt32); - const lo = Number(value & BigInt(4294967295)); - if (littleEndian) { - dataView.setUint32(byteOffset + 4, hi, littleEndian); - dataView.setUint32(byteOffset, lo, littleEndian); - } else { - dataView.setUint32(byteOffset, hi, littleEndian); - dataView.setUint32(byteOffset + 4, lo, littleEndian); - } -} -if (!("getBigInt64" in DataView)) { - DataView.prototype.getBigInt64 = function(byteOffset, littleEndian) { - return getBigInt64(this, byteOffset, littleEndian); - }; -} -if (!("getBigUint64" in DataView)) { - DataView.prototype.getBigUint64 = function(byteOffset, littleEndian) { - return getBigUint64(this, byteOffset, littleEndian); - }; -} -if (!("setBigInt64" in DataView)) { - DataView.prototype.setBigInt64 = function(byteOffset, value, littleEndian) { - setBigInt64(this, byteOffset, value, littleEndian); - }; -} -if (!("setBigUint64" in DataView)) { - DataView.prototype.setBigUint64 = function(byteOffset, value, littleEndian) { - setBigUint64(this, byteOffset, value, littleEndian); - }; -} -class Context { - constructor(importPath, useContextVariables) { - this.code = ""; - this.scopes = [["vars"]]; - this.bitFields = []; - this.tmpVariableCount = 0; - this.references = /* @__PURE__ */ new Map(); - this.imports = []; - this.reverseImports = /* @__PURE__ */ new Map(); - this.useContextVariables = false; - this.importPath = importPath; - this.useContextVariables = useContextVariables; - } - generateVariable(name2) { - const scopes = [...this.scopes[this.scopes.length - 1]]; - if (name2) { - scopes.push(name2); - } - return scopes.join("."); - } - generateOption(val) { - switch (typeof val) { - case "number": - return val.toString(); - case "string": - return this.generateVariable(val); - case "function": - return `${this.addImport(val)}.call(${this.generateVariable()}, vars)`; - } - } - generateError(err2) { - this.pushCode(`throw new Error(${err2});`); - } - generateTmpVariable() { - return "$tmp" + this.tmpVariableCount++; - } - pushCode(code) { - this.code += code + "\n"; - } - pushPath(name2) { - if (name2) { - this.scopes[this.scopes.length - 1].push(name2); - } - } - popPath(name2) { - if (name2) { - this.scopes[this.scopes.length - 1].pop(); - } - } - pushScope(name2) { - this.scopes.push([name2]); - } - popScope() { - this.scopes.pop(); - } - addImport(im) { - if (!this.importPath) - return `(${im})`; - let id = this.reverseImports.get(im); - if (!id) { - id = this.imports.push(im) - 1; - this.reverseImports.set(im, id); - } - return `${this.importPath}[${id}]`; - } - addReference(alias) { - if (!this.references.has(alias)) { - this.references.set(alias, { resolved: false, requested: false }); - } - } - markResolved(alias) { - const reference = this.references.get(alias); - if (reference) { - reference.resolved = true; - } - } - markRequested(aliasList) { - aliasList.forEach((alias) => { - const reference = this.references.get(alias); - if (reference) { - reference.requested = true; - } - }); - } - getUnresolvedReferences() { - return Array.from(this.references).filter(([_, reference]) => !reference.resolved && !reference.requested).map(([alias, _]) => alias); - } -} -const aliasRegistry = /* @__PURE__ */ new Map(); -const FUNCTION_PREFIX = "___parser_"; -const PRIMITIVE_SIZES = { - uint8: 1, - uint16le: 2, - uint16be: 2, - uint32le: 4, - uint32be: 4, - int8: 1, - int16le: 2, - int16be: 2, - int32le: 4, - int32be: 4, - int64be: 8, - int64le: 8, - uint64be: 8, - uint64le: 8, - floatle: 4, - floatbe: 4, - doublele: 8, - doublebe: 8 -}; -const PRIMITIVE_NAMES = { - uint8: "Uint8", - uint16le: "Uint16", - uint16be: "Uint16", - uint32le: "Uint32", - uint32be: "Uint32", - int8: "Int8", - int16le: "Int16", - int16be: "Int16", - int32le: "Int32", - int32be: "Int32", - int64be: "BigInt64", - int64le: "BigInt64", - uint64be: "BigUint64", - uint64le: "BigUint64", - floatle: "Float32", - floatbe: "Float32", - doublele: "Float64", - doublebe: "Float64" -}; -const PRIMITIVE_LITTLE_ENDIANS = { - uint8: false, - uint16le: true, - uint16be: false, - uint32le: true, - uint32be: false, - int8: false, - int16le: true, - int16be: false, - int32le: true, - int32be: false, - int64be: false, - int64le: true, - uint64be: false, - uint64le: true, - floatle: true, - floatbe: false, - doublele: true, - doublebe: false -}; -class Parser { - constructor() { - this.varName = ""; - this.type = ""; - this.options = {}; - this.endian = "be"; - this.useContextVariables = false; - } - static start() { - return new Parser(); - } - primitiveGenerateN(type, ctx) { - const typeName = PRIMITIVE_NAMES[type]; - const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type]; - ctx.pushCode(`${ctx.generateVariable(this.varName)} = dataView.get${typeName}(offset, ${littleEndian});`); - ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`); - } - primitiveN(type, varName, options) { - return this.setNextParser(type, varName, options); - } - useThisEndian(type) { - return type + this.endian.toLowerCase(); - } - uint8(varName, options = {}) { - return this.primitiveN("uint8", varName, options); - } - uint16(varName, options = {}) { - return this.primitiveN(this.useThisEndian("uint16"), varName, options); - } - uint16le(varName, options = {}) { - return this.primitiveN("uint16le", varName, options); - } - uint16be(varName, options = {}) { - return this.primitiveN("uint16be", varName, options); - } - uint32(varName, options = {}) { - return this.primitiveN(this.useThisEndian("uint32"), varName, options); - } - uint32le(varName, options = {}) { - return this.primitiveN("uint32le", varName, options); - } - uint32be(varName, options = {}) { - return this.primitiveN("uint32be", varName, options); - } - int8(varName, options = {}) { - return this.primitiveN("int8", varName, options); - } - int16(varName, options = {}) { - return this.primitiveN(this.useThisEndian("int16"), varName, options); - } - int16le(varName, options = {}) { - return this.primitiveN("int16le", varName, options); - } - int16be(varName, options = {}) { - return this.primitiveN("int16be", varName, options); - } - int32(varName, options = {}) { - return this.primitiveN(this.useThisEndian("int32"), varName, options); - } - int32le(varName, options = {}) { - return this.primitiveN("int32le", varName, options); - } - int32be(varName, options = {}) { - return this.primitiveN("int32be", varName, options); - } - bigIntVersionCheck() { - if (!DataView.prototype.getBigInt64) - throw new Error("BigInt64 is unsupported on this runtime"); - } - int64(varName, options = {}) { - this.bigIntVersionCheck(); - return this.primitiveN(this.useThisEndian("int64"), varName, options); - } - int64be(varName, options = {}) { - this.bigIntVersionCheck(); - return this.primitiveN("int64be", varName, options); - } - int64le(varName, options = {}) { - this.bigIntVersionCheck(); - return this.primitiveN("int64le", varName, options); - } - uint64(varName, options = {}) { - this.bigIntVersionCheck(); - return this.primitiveN(this.useThisEndian("uint64"), varName, options); - } - uint64be(varName, options = {}) { - this.bigIntVersionCheck(); - return this.primitiveN("uint64be", varName, options); - } - uint64le(varName, options = {}) { - this.bigIntVersionCheck(); - return this.primitiveN("uint64le", varName, options); - } - floatle(varName, options = {}) { - return this.primitiveN("floatle", varName, options); - } - floatbe(varName, options = {}) { - return this.primitiveN("floatbe", varName, options); - } - doublele(varName, options = {}) { - return this.primitiveN("doublele", varName, options); - } - doublebe(varName, options = {}) { - return this.primitiveN("doublebe", varName, options); - } - bitN(size, varName, options) { - options.length = size; - return this.setNextParser("bit", varName, options); - } - bit1(varName, options = {}) { - return this.bitN(1, varName, options); - } - bit2(varName, options = {}) { - return this.bitN(2, varName, options); - } - bit3(varName, options = {}) { - return this.bitN(3, varName, options); - } - bit4(varName, options = {}) { - return this.bitN(4, varName, options); - } - bit5(varName, options = {}) { - return this.bitN(5, varName, options); - } - bit6(varName, options = {}) { - return this.bitN(6, varName, options); - } - bit7(varName, options = {}) { - return this.bitN(7, varName, options); - } - bit8(varName, options = {}) { - return this.bitN(8, varName, options); - } - bit9(varName, options = {}) { - return this.bitN(9, varName, options); - } - bit10(varName, options = {}) { - return this.bitN(10, varName, options); - } - bit11(varName, options = {}) { - return this.bitN(11, varName, options); - } - bit12(varName, options = {}) { - return this.bitN(12, varName, options); - } - bit13(varName, options = {}) { - return this.bitN(13, varName, options); - } - bit14(varName, options = {}) { - return this.bitN(14, varName, options); - } - bit15(varName, options = {}) { - return this.bitN(15, varName, options); - } - bit16(varName, options = {}) { - return this.bitN(16, varName, options); - } - bit17(varName, options = {}) { - return this.bitN(17, varName, options); - } - bit18(varName, options = {}) { - return this.bitN(18, varName, options); - } - bit19(varName, options = {}) { - return this.bitN(19, varName, options); - } - bit20(varName, options = {}) { - return this.bitN(20, varName, options); - } - bit21(varName, options = {}) { - return this.bitN(21, varName, options); - } - bit22(varName, options = {}) { - return this.bitN(22, varName, options); - } - bit23(varName, options = {}) { - return this.bitN(23, varName, options); - } - bit24(varName, options = {}) { - return this.bitN(24, varName, options); - } - bit25(varName, options = {}) { - return this.bitN(25, varName, options); - } - bit26(varName, options = {}) { - return this.bitN(26, varName, options); - } - bit27(varName, options = {}) { - return this.bitN(27, varName, options); - } - bit28(varName, options = {}) { - return this.bitN(28, varName, options); - } - bit29(varName, options = {}) { - return this.bitN(29, varName, options); - } - bit30(varName, options = {}) { - return this.bitN(30, varName, options); - } - bit31(varName, options = {}) { - return this.bitN(31, varName, options); - } - bit32(varName, options = {}) { - return this.bitN(32, varName, options); - } - namely(alias) { - aliasRegistry.set(alias, this); - this.alias = alias; - return this; - } - skip(length, options = {}) { - return this.seek(length, options); - } - seek(relOffset, options = {}) { - if (options.assert) { - throw new Error("assert option on seek is not allowed."); - } - return this.setNextParser("seek", "", { length: relOffset }); - } - string(varName, options) { - if (!options.zeroTerminated && !options.length && !options.greedy) { - throw new Error("One of length, zeroTerminated, or greedy must be defined for string."); - } - if ((options.zeroTerminated || options.length) && options.greedy) { - throw new Error("greedy is mutually exclusive with length and zeroTerminated for string."); - } - if (options.stripNull && !(options.length || options.greedy)) { - throw new Error("length or greedy must be defined if stripNull is enabled."); - } - options.encoding = options.encoding || "utf8"; - return this.setNextParser("string", varName, options); - } - buffer(varName, options) { - if (!options.length && !options.readUntil) { - throw new Error("length or readUntil must be defined for buffer."); - } - return this.setNextParser("buffer", varName, options); - } - wrapped(varName, options) { - if (typeof options !== "object" && typeof varName === "object") { - options = varName; - varName = ""; - } - if (!options || !options.wrapper || !options.type) { - throw new Error("Both wrapper and type must be defined for wrapped."); - } - if (!options.length && !options.readUntil) { - throw new Error("length or readUntil must be defined for wrapped."); - } - return this.setNextParser("wrapper", varName, options); - } - array(varName, options) { - if (!options.readUntil && !options.length && !options.lengthInBytes) { - throw new Error("One of readUntil, length and lengthInBytes must be defined for array."); - } - if (!options.type) { - throw new Error("type is required for array."); - } - if (typeof options.type === "string" && !aliasRegistry.has(options.type) && !(options.type in PRIMITIVE_SIZES)) { - throw new Error(`Array element type "${options.type}" is unkown.`); - } - return this.setNextParser("array", varName, options); - } - choice(varName, options) { - if (typeof options !== "object" && typeof varName === "object") { - options = varName; - varName = ""; - } - if (!options) { - throw new Error("tag and choices are are required for choice."); - } - if (!options.tag) { - throw new Error("tag is requird for choice."); - } - if (!options.choices) { - throw new Error("choices is required for choice."); - } - for (const keyString in options.choices) { - const key = parseInt(keyString, 10); - const value = options.choices[key]; - if (isNaN(key)) { - throw new Error(`Choice key "${keyString}" is not a number.`); - } - if (typeof value === "string" && !aliasRegistry.has(value) && !(value in PRIMITIVE_SIZES)) { - throw new Error(`Choice type "${value}" is unkown.`); - } - } - return this.setNextParser("choice", varName, options); - } - nest(varName, options) { - if (typeof options !== "object" && typeof varName === "object") { - options = varName; - varName = ""; - } - if (!options || !options.type) { - throw new Error("type is required for nest."); - } - if (!(options.type instanceof Parser) && !aliasRegistry.has(options.type)) { - throw new Error("type must be a known parser name or a Parser object."); - } - if (!(options.type instanceof Parser) && !varName) { - throw new Error("type must be a Parser object if the variable name is omitted."); - } - return this.setNextParser("nest", varName, options); - } - pointer(varName, options) { - if (!options.offset) { - throw new Error("offset is required for pointer."); - } - if (!options.type) { - throw new Error("type is required for pointer."); - } - if (typeof options.type === "string" && !(options.type in PRIMITIVE_SIZES) && !aliasRegistry.has(options.type)) { - throw new Error(`Pointer type "${options.type}" is unkown.`); - } - return this.setNextParser("pointer", varName, options); - } - saveOffset(varName, options = {}) { - return this.setNextParser("saveOffset", varName, options); - } - endianness(endianness) { - switch (endianness.toLowerCase()) { - case "little": - this.endian = "le"; - break; - case "big": - this.endian = "be"; - break; - default: - throw new Error('endianness must be one of "little" or "big"'); - } - return this; - } - endianess(endianess) { - return this.endianness(endianess); - } - useContextVars(useContextVariables = true) { - this.useContextVariables = useContextVariables; - return this; - } - create(constructorFn) { - if (!(constructorFn instanceof Function)) { - throw new Error("Constructor must be a Function object."); - } - this.constructorFn = constructorFn; - return this; - } - getContext(importPath) { - const ctx = new Context(importPath, this.useContextVariables); - ctx.pushCode("var dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);"); - if (!this.alias) { - this.addRawCode(ctx); - } else { - this.addAliasedCode(ctx); - ctx.pushCode(`return ${FUNCTION_PREFIX + this.alias}(0).result;`); - } - return ctx; - } - getCode() { - const importPath = "imports"; - return this.getContext(importPath).code; - } - addRawCode(ctx) { - ctx.pushCode("var offset = 0;"); - ctx.pushCode(`var vars = ${this.constructorFn ? "new constructorFn()" : "{}"};`); - ctx.pushCode("vars.$parent = null;"); - ctx.pushCode("vars.$root = vars;"); - this.generate(ctx); - this.resolveReferences(ctx); - ctx.pushCode("delete vars.$parent;"); - ctx.pushCode("delete vars.$root;"); - ctx.pushCode("return vars;"); - } - addAliasedCode(ctx) { - ctx.pushCode(`function ${FUNCTION_PREFIX + this.alias}(offset, context) {`); - ctx.pushCode(`var vars = ${this.constructorFn ? "new constructorFn()" : "{}"};`); - ctx.pushCode("var ctx = Object.assign({$parent: null, $root: vars}, context || {});"); - ctx.pushCode(`vars = Object.assign(vars, ctx);`); - this.generate(ctx); - ctx.markResolved(this.alias); - this.resolveReferences(ctx); - ctx.pushCode("Object.keys(ctx).forEach(function (item) { delete vars[item]; });"); - ctx.pushCode("return { offset: offset, result: vars };"); - ctx.pushCode("}"); - return ctx; - } - resolveReferences(ctx) { - const references = ctx.getUnresolvedReferences(); - ctx.markRequested(references); - references.forEach((alias) => { - var _a; - (_a = aliasRegistry.get(alias)) === null || _a === void 0 ? void 0 : _a.addAliasedCode(ctx); - }); - } - compile() { - const importPath = "imports"; - const ctx = this.getContext(importPath); - this.compiled = new Function(importPath, "TextDecoder", `return function (buffer, constructorFn) { ${ctx.code} };`)(ctx.imports, TextDecoder); - } - sizeOf() { - let size = NaN; - if (Object.keys(PRIMITIVE_SIZES).indexOf(this.type) >= 0) { - size = PRIMITIVE_SIZES[this.type]; - } else if (this.type === "string" && typeof this.options.length === "number") { - size = this.options.length; - } else if (this.type === "buffer" && typeof this.options.length === "number") { - size = this.options.length; - } else if (this.type === "array" && typeof this.options.length === "number") { - let elementSize = NaN; - if (typeof this.options.type === "string") { - elementSize = PRIMITIVE_SIZES[this.options.type]; - } else if (this.options.type instanceof Parser) { - elementSize = this.options.type.sizeOf(); - } - size = this.options.length * elementSize; - } else if (this.type === "seek") { - size = this.options.length; - } else if (this.type === "nest") { - size = this.options.type.sizeOf(); - } else if (!this.type) { - size = 0; - } - if (this.next) { - size += this.next.sizeOf(); - } - return size; - } - // Follow the parser chain till the root and start parsing from there - parse(buffer) { - if (!this.compiled) { - this.compile(); - } - return this.compiled(buffer, this.constructorFn); - } - setNextParser(type, varName, options) { - const parser = new Parser(); - parser.type = type; - parser.varName = varName; - parser.options = options; - parser.endian = this.endian; - if (this.head) { - this.head.next = parser; - } else { - this.next = parser; - } - this.head = parser; - return this; - } - // Call code generator for this parser - generate(ctx) { - if (this.type) { - switch (this.type) { - case "uint8": - case "uint16le": - case "uint16be": - case "uint32le": - case "uint32be": - case "int8": - case "int16le": - case "int16be": - case "int32le": - case "int32be": - case "int64be": - case "int64le": - case "uint64be": - case "uint64le": - case "floatle": - case "floatbe": - case "doublele": - case "doublebe": - this.primitiveGenerateN(this.type, ctx); - break; - case "bit": - this.generateBit(ctx); - break; - case "string": - this.generateString(ctx); - break; - case "buffer": - this.generateBuffer(ctx); - break; - case "seek": - this.generateSeek(ctx); - break; - case "nest": - this.generateNest(ctx); - break; - case "array": - this.generateArray(ctx); - break; - case "choice": - this.generateChoice(ctx); - break; - case "pointer": - this.generatePointer(ctx); - break; - case "saveOffset": - this.generateSaveOffset(ctx); - break; - case "wrapper": - this.generateWrapper(ctx); - break; - } - if (this.type !== "bit") - this.generateAssert(ctx); - } - const varName = ctx.generateVariable(this.varName); - if (this.options.formatter && this.type !== "bit") { - this.generateFormatter(ctx, varName, this.options.formatter); - } - return this.generateNext(ctx); - } - generateAssert(ctx) { - if (!this.options.assert) { - return; - } - const varName = ctx.generateVariable(this.varName); - switch (typeof this.options.assert) { - case "function": - { - const func = ctx.addImport(this.options.assert); - ctx.pushCode(`if (!${func}.call(vars, ${varName})) {`); - } - break; - case "number": - ctx.pushCode(`if (${this.options.assert} !== ${varName}) {`); - break; - case "string": - ctx.pushCode(`if (${JSON.stringify(this.options.assert)} !== ${varName}) {`); - break; - default: - throw new Error("assert option must be a string, number or a function."); - } - ctx.generateError(`"Assertion error: ${varName} is " + ${JSON.stringify(this.options.assert.toString())}`); - ctx.pushCode("}"); - } - // Recursively call code generators and append results - generateNext(ctx) { - if (this.next) { - ctx = this.next.generate(ctx); - } - return ctx; - } - generateBit(ctx) { - const parser = JSON.parse(JSON.stringify(this)); - parser.options = this.options; - parser.generateAssert = this.generateAssert.bind(this); - parser.generateFormatter = this.generateFormatter.bind(this); - parser.varName = ctx.generateVariable(parser.varName); - ctx.bitFields.push(parser); - if (!this.next || this.next && ["bit", "nest"].indexOf(this.next.type) < 0) { - const val = ctx.generateTmpVariable(); - ctx.pushCode(`var ${val} = 0;`); - const getMaxBits = (from = 0) => { - let sum3 = 0; - for (let i = from; i < ctx.bitFields.length; i++) { - const length = ctx.bitFields[i].options.length; - if (sum3 + length > 32) - break; - sum3 += length; - } - return sum3; - }; - const getBytes = (sum3) => { - if (sum3 <= 8) { - ctx.pushCode(`${val} = dataView.getUint8(offset);`); - sum3 = 8; - } else if (sum3 <= 16) { - ctx.pushCode(`${val} = dataView.getUint16(offset);`); - sum3 = 16; - } else if (sum3 <= 24) { - ctx.pushCode(`${val} = (dataView.getUint16(offset) << 8) | dataView.getUint8(offset + 2);`); - sum3 = 24; - } else { - ctx.pushCode(`${val} = dataView.getUint32(offset);`); - sum3 = 32; - } - ctx.pushCode(`offset += ${sum3 / 8};`); - return sum3; - }; - let bitOffset = 0; - const isBigEndian = this.endian === "be"; - let sum2 = 0; - let rem = 0; - ctx.bitFields.forEach((parser2, i) => { - let length = parser2.options.length; - if (length > rem) { - if (rem) { - const mask2 = -1 >>> 32 - rem; - ctx.pushCode(`${parser2.varName} = (${val} & 0x${mask2.toString(16)}) << ${length - rem};`); - length -= rem; - } - bitOffset = 0; - rem = sum2 = getBytes(getMaxBits(i) - rem); - } - const offset = isBigEndian ? sum2 - bitOffset - length : bitOffset; - const mask = -1 >>> 32 - length; - ctx.pushCode(`${parser2.varName} ${length < parser2.options.length ? "|=" : "="} ${val} >> ${offset} & 0x${mask.toString(16)};`); - if (parser2.options.length === 32) { - ctx.pushCode(`${parser2.varName} >>>= 0`); - } - if (parser2.options.assert) { - parser2.generateAssert(ctx); - } - if (parser2.options.formatter) { - parser2.generateFormatter(ctx, parser2.varName, parser2.options.formatter); - } - bitOffset += length; - rem -= length; - }); - ctx.bitFields = []; - } - } - generateSeek(ctx) { - const length = ctx.generateOption(this.options.length); - ctx.pushCode(`offset += ${length};`); - } - generateString(ctx) { - const name2 = ctx.generateVariable(this.varName); - const start = ctx.generateTmpVariable(); - const encoding = this.options.encoding; - const isHex = encoding.toLowerCase() === "hex"; - const toHex = 'b => b.toString(16).padStart(2, "0")'; - if (this.options.length && this.options.zeroTerminated) { - const len = this.options.length; - ctx.pushCode(`var ${start} = offset;`); - ctx.pushCode(`while(dataView.getUint8(offset++) !== 0 && offset - ${start} < ${len});`); - const end = `offset - ${start} < ${len} ? offset - 1 : offset`; - ctx.pushCode(isHex ? `${name2} = Array.from(buffer.subarray(${start}, ${end}), ${toHex}).join('');` : `${name2} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, ${end}));`); - } else if (this.options.length) { - const len = ctx.generateOption(this.options.length); - ctx.pushCode(isHex ? `${name2} = Array.from(buffer.subarray(offset, offset + ${len}), ${toHex}).join('');` : `${name2} = new TextDecoder('${encoding}').decode(buffer.subarray(offset, offset + ${len}));`); - ctx.pushCode(`offset += ${len};`); - } else if (this.options.zeroTerminated) { - ctx.pushCode(`var ${start} = offset;`); - ctx.pushCode("while(dataView.getUint8(offset++) !== 0);"); - ctx.pushCode(isHex ? `${name2} = Array.from(buffer.subarray(${start}, offset - 1), ${toHex}).join('');` : `${name2} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, offset - 1));`); - } else if (this.options.greedy) { - ctx.pushCode(`var ${start} = offset;`); - ctx.pushCode("while(buffer.length > offset++);"); - ctx.pushCode(isHex ? `${name2} = Array.from(buffer.subarray(${start}, offset), ${toHex}).join('');` : `${name2} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, offset));`); - } - if (this.options.stripNull) { - ctx.pushCode(`${name2} = ${name2}.replace(/\\x00+$/g, '')`); - } - } - generateBuffer(ctx) { - const varName = ctx.generateVariable(this.varName); - if (typeof this.options.readUntil === "function") { - const pred = this.options.readUntil; - const start = ctx.generateTmpVariable(); - const cur = ctx.generateTmpVariable(); - ctx.pushCode(`var ${start} = offset;`); - ctx.pushCode(`var ${cur} = 0;`); - ctx.pushCode(`while (offset < buffer.length) {`); - ctx.pushCode(`${cur} = dataView.getUint8(offset);`); - const func = ctx.addImport(pred); - ctx.pushCode(`if (${func}.call(${ctx.generateVariable()}, ${cur}, buffer.subarray(offset))) break;`); - ctx.pushCode(`offset += 1;`); - ctx.pushCode(`}`); - ctx.pushCode(`${varName} = buffer.subarray(${start}, offset);`); - } else if (this.options.readUntil === "eof") { - ctx.pushCode(`${varName} = buffer.subarray(offset);`); - } else { - const len = ctx.generateOption(this.options.length); - ctx.pushCode(`${varName} = buffer.subarray(offset, offset + ${len});`); - ctx.pushCode(`offset += ${len};`); - } - if (this.options.clone) { - ctx.pushCode(`${varName} = buffer.constructor.from(${varName});`); - } - } - generateArray(ctx) { - const length = ctx.generateOption(this.options.length); - const lengthInBytes = ctx.generateOption(this.options.lengthInBytes); - const type = this.options.type; - const counter = ctx.generateTmpVariable(); - const lhs = ctx.generateVariable(this.varName); - const item = ctx.generateTmpVariable(); - const key = this.options.key; - const isHash = typeof key === "string"; - if (isHash) { - ctx.pushCode(`${lhs} = {};`); - } else { - ctx.pushCode(`${lhs} = [];`); - } - if (typeof this.options.readUntil === "function") { - ctx.pushCode("do {"); - } else if (this.options.readUntil === "eof") { - ctx.pushCode(`for (var ${counter} = 0; offset < buffer.length; ${counter}++) {`); - } else if (lengthInBytes !== void 0) { - ctx.pushCode(`for (var ${counter} = offset + ${lengthInBytes}; offset < ${counter}; ) {`); - } else { - ctx.pushCode(`for (var ${counter} = ${length}; ${counter} > 0; ${counter}--) {`); - } - if (typeof type === "string") { - if (!aliasRegistry.get(type)) { - const typeName = PRIMITIVE_NAMES[type]; - const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type]; - ctx.pushCode(`var ${item} = dataView.get${typeName}(offset, ${littleEndian});`); - ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`); - } else { - const tempVar = ctx.generateTmpVariable(); - ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + type}(offset, {`); - if (ctx.useContextVariables) { - const parentVar = ctx.generateVariable(); - ctx.pushCode(`$parent: ${parentVar},`); - ctx.pushCode(`$root: ${parentVar}.$root,`); - if (!this.options.readUntil && lengthInBytes === void 0) { - ctx.pushCode(`$index: ${length} - ${counter},`); - } - } - ctx.pushCode(`});`); - ctx.pushCode(`var ${item} = ${tempVar}.result; offset = ${tempVar}.offset;`); - if (type !== this.alias) - ctx.addReference(type); - } - } else if (type instanceof Parser) { - ctx.pushCode(`var ${item} = {};`); - const parentVar = ctx.generateVariable(); - ctx.pushScope(item); - if (ctx.useContextVariables) { - ctx.pushCode(`${item}.$parent = ${parentVar};`); - ctx.pushCode(`${item}.$root = ${parentVar}.$root;`); - if (!this.options.readUntil && lengthInBytes === void 0) { - ctx.pushCode(`${item}.$index = ${length} - ${counter};`); - } - } - type.generate(ctx); - if (ctx.useContextVariables) { - ctx.pushCode(`delete ${item}.$parent;`); - ctx.pushCode(`delete ${item}.$root;`); - ctx.pushCode(`delete ${item}.$index;`); - } - ctx.popScope(); - } - if (isHash) { - ctx.pushCode(`${lhs}[${item}.${key}] = ${item};`); - } else { - ctx.pushCode(`${lhs}.push(${item});`); - } - ctx.pushCode("}"); - if (typeof this.options.readUntil === "function") { - const pred = this.options.readUntil; - const func = ctx.addImport(pred); - ctx.pushCode(`while (!${func}.call(${ctx.generateVariable()}, ${item}, buffer.subarray(offset)));`); - } - } - generateChoiceCase(ctx, varName, type) { - if (typeof type === "string") { - const varName2 = ctx.generateVariable(this.varName); - if (!aliasRegistry.has(type)) { - const typeName = PRIMITIVE_NAMES[type]; - const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type]; - ctx.pushCode(`${varName2} = dataView.get${typeName}(offset, ${littleEndian});`); - ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]}`); - } else { - const tempVar = ctx.generateTmpVariable(); - ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + type}(offset, {`); - if (ctx.useContextVariables) { - ctx.pushCode(`$parent: ${varName2}.$parent,`); - ctx.pushCode(`$root: ${varName2}.$root,`); - } - ctx.pushCode(`});`); - ctx.pushCode(`${varName2} = ${tempVar}.result; offset = ${tempVar}.offset;`); - if (type !== this.alias) - ctx.addReference(type); - } - } else if (type instanceof Parser) { - ctx.pushPath(varName); - type.generate(ctx); - ctx.popPath(varName); - } - } - generateChoice(ctx) { - const tag = ctx.generateOption(this.options.tag); - const nestVar = ctx.generateVariable(this.varName); - if (this.varName) { - ctx.pushCode(`${nestVar} = {};`); - if (ctx.useContextVariables) { - const parentVar = ctx.generateVariable(); - ctx.pushCode(`${nestVar}.$parent = ${parentVar};`); - ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`); - } - } - ctx.pushCode(`switch(${tag}) {`); - for (const tagString in this.options.choices) { - const tag2 = parseInt(tagString, 10); - const type = this.options.choices[tag2]; - ctx.pushCode(`case ${tag2}:`); - this.generateChoiceCase(ctx, this.varName, type); - ctx.pushCode("break;"); - } - ctx.pushCode("default:"); - if (this.options.defaultChoice) { - this.generateChoiceCase(ctx, this.varName, this.options.defaultChoice); - } else { - ctx.generateError(`"Met undefined tag value " + ${tag} + " at choice"`); - } - ctx.pushCode("}"); - if (this.varName && ctx.useContextVariables) { - ctx.pushCode(`delete ${nestVar}.$parent;`); - ctx.pushCode(`delete ${nestVar}.$root;`); - } - } - generateNest(ctx) { - const nestVar = ctx.generateVariable(this.varName); - if (this.options.type instanceof Parser) { - if (this.varName) { - ctx.pushCode(`${nestVar} = {};`); - if (ctx.useContextVariables) { - const parentVar = ctx.generateVariable(); - ctx.pushCode(`${nestVar}.$parent = ${parentVar};`); - ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`); - } - } - ctx.pushPath(this.varName); - this.options.type.generate(ctx); - ctx.popPath(this.varName); - if (this.varName && ctx.useContextVariables) { - if (ctx.useContextVariables) { - ctx.pushCode(`delete ${nestVar}.$parent;`); - ctx.pushCode(`delete ${nestVar}.$root;`); - } - } - } else if (aliasRegistry.has(this.options.type)) { - const tempVar = ctx.generateTmpVariable(); - ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + this.options.type}(offset, {`); - if (ctx.useContextVariables) { - const parentVar = ctx.generateVariable(); - ctx.pushCode(`$parent: ${parentVar},`); - ctx.pushCode(`$root: ${parentVar}.$root,`); - } - ctx.pushCode(`});`); - ctx.pushCode(`${nestVar} = ${tempVar}.result; offset = ${tempVar}.offset;`); - if (this.options.type !== this.alias) { - ctx.addReference(this.options.type); - } - } - } - generateWrapper(ctx) { - const wrapperVar = ctx.generateVariable(this.varName); - const wrappedBuf = ctx.generateTmpVariable(); - if (typeof this.options.readUntil === "function") { - const pred = this.options.readUntil; - const start = ctx.generateTmpVariable(); - const cur = ctx.generateTmpVariable(); - ctx.pushCode(`var ${start} = offset;`); - ctx.pushCode(`var ${cur} = 0;`); - ctx.pushCode(`while (offset < buffer.length) {`); - ctx.pushCode(`${cur} = dataView.getUint8(offset);`); - const func2 = ctx.addImport(pred); - ctx.pushCode(`if (${func2}.call(${ctx.generateVariable()}, ${cur}, buffer.subarray(offset))) break;`); - ctx.pushCode(`offset += 1;`); - ctx.pushCode(`}`); - ctx.pushCode(`${wrappedBuf} = buffer.subarray(${start}, offset);`); - } else if (this.options.readUntil === "eof") { - ctx.pushCode(`${wrappedBuf} = buffer.subarray(offset);`); - } else { - const len = ctx.generateOption(this.options.length); - ctx.pushCode(`${wrappedBuf} = buffer.subarray(offset, offset + ${len});`); - ctx.pushCode(`offset += ${len};`); - } - if (this.options.clone) { - ctx.pushCode(`${wrappedBuf} = buffer.constructor.from(${wrappedBuf});`); - } - const tempBuf = ctx.generateTmpVariable(); - const tempOff = ctx.generateTmpVariable(); - const tempView = ctx.generateTmpVariable(); - const func = ctx.addImport(this.options.wrapper); - ctx.pushCode(`${wrappedBuf} = ${func}.call(this, ${wrappedBuf}).subarray(0);`); - ctx.pushCode(`var ${tempBuf} = buffer;`); - ctx.pushCode(`var ${tempOff} = offset;`); - ctx.pushCode(`var ${tempView} = dataView;`); - ctx.pushCode(`buffer = ${wrappedBuf};`); - ctx.pushCode(`offset = 0;`); - ctx.pushCode(`dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);`); - if (this.options.type instanceof Parser) { - if (this.varName) { - ctx.pushCode(`${wrapperVar} = {};`); - } - ctx.pushPath(this.varName); - this.options.type.generate(ctx); - ctx.popPath(this.varName); - } else if (aliasRegistry.has(this.options.type)) { - const tempVar = ctx.generateTmpVariable(); - ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + this.options.type}(0);`); - ctx.pushCode(`${wrapperVar} = ${tempVar}.result;`); - if (this.options.type !== this.alias) { - ctx.addReference(this.options.type); - } - } - ctx.pushCode(`buffer = ${tempBuf};`); - ctx.pushCode(`dataView = ${tempView};`); - ctx.pushCode(`offset = ${tempOff};`); - } - generateFormatter(ctx, varName, formatter) { - if (typeof formatter === "function") { - const func = ctx.addImport(formatter); - ctx.pushCode(`${varName} = ${func}.call(${ctx.generateVariable()}, ${varName});`); - } - } - generatePointer(ctx) { - const type = this.options.type; - const offset = ctx.generateOption(this.options.offset); - const tempVar = ctx.generateTmpVariable(); - const nestVar = ctx.generateVariable(this.varName); - ctx.pushCode(`var ${tempVar} = offset;`); - ctx.pushCode(`offset = ${offset};`); - if (this.options.type instanceof Parser) { - ctx.pushCode(`${nestVar} = {};`); - if (ctx.useContextVariables) { - const parentVar = ctx.generateVariable(); - ctx.pushCode(`${nestVar}.$parent = ${parentVar};`); - ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`); - } - ctx.pushPath(this.varName); - this.options.type.generate(ctx); - ctx.popPath(this.varName); - if (ctx.useContextVariables) { - ctx.pushCode(`delete ${nestVar}.$parent;`); - ctx.pushCode(`delete ${nestVar}.$root;`); - } - } else if (aliasRegistry.has(this.options.type)) { - const tempVar2 = ctx.generateTmpVariable(); - ctx.pushCode(`var ${tempVar2} = ${FUNCTION_PREFIX + this.options.type}(offset, {`); - if (ctx.useContextVariables) { - const parentVar = ctx.generateVariable(); - ctx.pushCode(`$parent: ${parentVar},`); - ctx.pushCode(`$root: ${parentVar}.$root,`); - } - ctx.pushCode(`});`); - ctx.pushCode(`${nestVar} = ${tempVar2}.result; offset = ${tempVar2}.offset;`); - if (this.options.type !== this.alias) { - ctx.addReference(this.options.type); - } - } else if (Object.keys(PRIMITIVE_SIZES).indexOf(this.options.type) >= 0) { - const typeName = PRIMITIVE_NAMES[type]; - const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type]; - ctx.pushCode(`${nestVar} = dataView.get${typeName}(offset, ${littleEndian});`); - ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`); - } - ctx.pushCode(`offset = ${tempVar};`); - } - generateSaveOffset(ctx) { - const varName = ctx.generateVariable(this.varName); - ctx.pushCode(`${varName} = offset`); - } -} -var esm = {}; -var AbortablePromiseCache$1 = {}; -var abortcontrollerPonyfill = {}; -var cjsPonyfill = {}; -Object.defineProperty(cjsPonyfill, "__esModule", { value: true }); -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties(Constructor, staticProps); - Object.defineProperty(Constructor, "prototype", { - writable: false - }); - return Constructor; -} -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - Object.defineProperty(subClass, "prototype", { - writable: false - }); - if (superClass) - _setPrototypeOf(subClass, superClass); -} -function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) { - return o2.__proto__ || Object.getPrototypeOf(o2); - }; - return _getPrototypeOf(o); -} -function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) { - o2.__proto__ = p2; - return o2; - }; - return _setPrototypeOf(o, p); -} -function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) - return false; - if (Reflect.construct.sham) - return false; - if (typeof Proxy === "function") - return true; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { - })); - return true; - } catch (e) { - return false; - } -} -function _assertThisInitialized(self2) { - if (self2 === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return self2; -} -function _possibleConstructorReturn(self2, call) { - if (call && (typeof call === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } - return _assertThisInitialized(self2); -} -function _createSuper(Derived) { - var hasNativeReflectConstruct = _isNativeReflectConstruct(); - return function _createSuperInternal() { - var Super = _getPrototypeOf(Derived), result; - if (hasNativeReflectConstruct) { - var NewTarget = _getPrototypeOf(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - return _possibleConstructorReturn(this, result); - }; -} -function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = _getPrototypeOf(object); - if (object === null) - break; - } - return object; -} -function _get() { - if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get.bind(); - } else { - _get = function _get2(target, property, receiver) { - var base = _superPropBase(target, property); - if (!base) - return; - var desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.get) { - return desc.get.call(arguments.length < 3 ? target : receiver); - } - return desc.value; - }; - } - return _get.apply(this, arguments); -} -var Emitter = /* @__PURE__ */ function() { - function Emitter2() { - _classCallCheck(this, Emitter2); - Object.defineProperty(this, "listeners", { - value: {}, - writable: true, - configurable: true - }); - } - _createClass(Emitter2, [{ - key: "addEventListener", - value: function addEventListener(type, callback, options) { - if (!(type in this.listeners)) { - this.listeners[type] = []; - } - this.listeners[type].push({ - callback, - options - }); - } - }, { - key: "removeEventListener", - value: function removeEventListener(type, callback) { - if (!(type in this.listeners)) { - return; - } - var stack = this.listeners[type]; - for (var i = 0, l = stack.length; i < l; i++) { - if (stack[i].callback === callback) { - stack.splice(i, 1); - return; - } - } - } - }, { - key: "dispatchEvent", - value: function dispatchEvent(event) { - if (!(event.type in this.listeners)) { - return; - } - var stack = this.listeners[event.type]; - var stackToCall = stack.slice(); - for (var i = 0, l = stackToCall.length; i < l; i++) { - var listener = stackToCall[i]; - try { - listener.callback.call(this, event); - } catch (e) { - Promise.resolve().then(function() { - throw e; - }); - } - if (listener.options && listener.options.once) { - this.removeEventListener(event.type, listener.callback); - } - } - return !event.defaultPrevented; - } - }]); - return Emitter2; -}(); -var AbortSignal$1 = /* @__PURE__ */ function(_Emitter) { - _inherits(AbortSignal2, _Emitter); - var _super = _createSuper(AbortSignal2); - function AbortSignal2() { - var _this; - _classCallCheck(this, AbortSignal2); - _this = _super.call(this); - if (!_this.listeners) { - Emitter.call(_assertThisInitialized(_this)); - } - Object.defineProperty(_assertThisInitialized(_this), "aborted", { - value: false, - writable: true, - configurable: true - }); - Object.defineProperty(_assertThisInitialized(_this), "onabort", { - value: null, - writable: true, - configurable: true - }); - Object.defineProperty(_assertThisInitialized(_this), "reason", { - value: void 0, - writable: true, - configurable: true - }); - return _this; - } - _createClass(AbortSignal2, [{ - key: "toString", - value: function toString2() { - return "[object AbortSignal]"; - } - }, { - key: "dispatchEvent", - value: function dispatchEvent(event) { - if (event.type === "abort") { - this.aborted = true; - if (typeof this.onabort === "function") { - this.onabort.call(this, event); - } - } - _get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event); - } - }]); - return AbortSignal2; -}(Emitter); -var AbortController$1 = /* @__PURE__ */ function() { - function AbortController2() { - _classCallCheck(this, AbortController2); - Object.defineProperty(this, "signal", { - value: new AbortSignal$1(), - writable: true, - configurable: true - }); - } - _createClass(AbortController2, [{ - key: "abort", - value: function abort(reason) { - var event; - try { - event = new Event("abort"); - } catch (e) { - if (typeof document !== "undefined") { - if (!document.createEvent) { - event = document.createEventObject(); - event.type = "abort"; - } else { - event = document.createEvent("Event"); - event.initEvent("abort", false, false); - } - } else { - event = { - type: "abort", - bubbles: false, - cancelable: false - }; - } - } - var signalReason = reason; - if (signalReason === void 0) { - if (typeof document === "undefined") { - signalReason = new Error("This operation was aborted"); - signalReason.name = "AbortError"; - } else { - try { - signalReason = new DOMException("signal is aborted without reason"); - } catch (err2) { - signalReason = new Error("This operation was aborted"); - signalReason.name = "AbortError"; - } - } - } - this.signal.reason = signalReason; - this.signal.dispatchEvent(event); - } - }, { - key: "toString", - value: function toString2() { - return "[object AbortController]"; - } - }]); - return AbortController2; -}(); -if (typeof Symbol !== "undefined" && Symbol.toStringTag) { - AbortController$1.prototype[Symbol.toStringTag] = "AbortController"; - AbortSignal$1.prototype[Symbol.toStringTag] = "AbortSignal"; -} -function polyfillNeeded(self2) { - if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) { - console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"); - return true; - } - return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController; -} -function abortableFetchDecorator(patchTargets) { - if ("function" === typeof patchTargets) { - patchTargets = { - fetch: patchTargets - }; - } - var _patchTargets = patchTargets, fetch = _patchTargets.fetch, _patchTargets$Request = _patchTargets.Request, NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request, NativeAbortController = _patchTargets.AbortController, _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL, __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE; - if (!polyfillNeeded({ - fetch, - Request: NativeRequest, - AbortController: NativeAbortController, - __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL - })) { - return { - fetch, - Request - }; - } - var Request = NativeRequest; - if (Request && !Request.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) { - Request = function Request2(input, init2) { - var signal; - if (init2 && init2.signal) { - signal = init2.signal; - delete init2.signal; - } - var request = new NativeRequest(input, init2); - if (signal) { - Object.defineProperty(request, "signal", { - writable: false, - enumerable: false, - configurable: true, - value: signal - }); - } - return request; - }; - Request.prototype = NativeRequest.prototype; - } - var realFetch = fetch; - var abortableFetch = function abortableFetch2(input, init2) { - var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0; - if (signal) { - var abortError; - try { - abortError = new DOMException("Aborted", "AbortError"); - } catch (err2) { - abortError = new Error("Aborted"); - abortError.name = "AbortError"; - } - if (signal.aborted) { - return Promise.reject(abortError); - } - var cancellation = new Promise(function(_, reject) { - signal.addEventListener("abort", function() { - return reject(abortError); - }, { - once: true - }); - }); - if (init2 && init2.signal) { - delete init2.signal; - } - return Promise.race([cancellation, realFetch(input, init2)]); - } - return realFetch(input, init2); - }; - return { - fetch: abortableFetch, - Request - }; -} -cjsPonyfill.AbortController = AbortController$1; -cjsPonyfill.AbortSignal = AbortSignal$1; -cjsPonyfill.abortableFetch = abortableFetchDecorator; -Object.defineProperty(abortcontrollerPonyfill, "__esModule", { value: true }); -abortcontrollerPonyfill.AbortSignal = abortcontrollerPonyfill.AbortController = void 0; -const cjs_ponyfill_1 = cjsPonyfill; -var getGlobal = function() { - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof commonjsGlobal !== "undefined") { - return commonjsGlobal; - } - throw new Error("unable to locate global object"); -}; -let AbortController = typeof getGlobal().AbortController === "undefined" ? cjs_ponyfill_1.AbortController : getGlobal().AbortController; -abortcontrollerPonyfill.AbortController = AbortController; -let AbortSignal = typeof getGlobal().AbortController === "undefined" ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal; -abortcontrollerPonyfill.AbortSignal = AbortSignal; -var AggregateAbortController$1 = {}; -Object.defineProperty(AggregateAbortController$1, "__esModule", { value: true }); -const abortcontroller_ponyfill_1$1 = abortcontrollerPonyfill; -class NullSignal { -} -class AggregateAbortController { - constructor() { - this.signals = /* @__PURE__ */ new Set(); - this.abortController = new abortcontroller_ponyfill_1$1.AbortController(); - } - /** - * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy, - * will be treated as a null-signal, and this abortcontroller will no - * longer be abortable. - */ - //@ts-ignore - addSignal(signal = new NullSignal()) { - if (this.signal.aborted) { - throw new Error("cannot add a signal, already aborted!"); - } - this.signals.add(signal); - if (signal.aborted) { - this.handleAborted(signal); - } else if (typeof signal.addEventListener === "function") { - signal.addEventListener("abort", () => { - this.handleAborted(signal); - }); - } - } - handleAborted(signal) { - this.signals.delete(signal); - if (this.signals.size === 0) { - this.abortController.abort(); - } - } - get signal() { - return this.abortController.signal; - } - abort() { - this.abortController.abort(); - } -} -AggregateAbortController$1.default = AggregateAbortController; -var AggregateStatusReporter$1 = {}; -Object.defineProperty(AggregateStatusReporter$1, "__esModule", { value: true }); -class AggregateStatusReporter { - constructor() { - this.callbacks = /* @__PURE__ */ new Set(); - } - addCallback(callback = () => { - }) { - this.callbacks.add(callback); - callback(this.currentMessage); - } - callback(message) { - this.currentMessage = message; - this.callbacks.forEach((elt) => { - elt(message); - }); - } -} -AggregateStatusReporter$1.default = AggregateStatusReporter; -var __importDefault$1 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; -}; -Object.defineProperty(AbortablePromiseCache$1, "__esModule", { value: true }); -const abortcontroller_ponyfill_1 = abortcontrollerPonyfill; -const AggregateAbortController_1 = __importDefault$1(AggregateAbortController$1); -const AggregateStatusReporter_1 = __importDefault$1(AggregateStatusReporter$1); -class AbortablePromiseCache { - constructor({ fill, cache }) { - if (typeof fill !== "function") { - throw new TypeError("must pass a fill function"); - } - if (typeof cache !== "object") { - throw new TypeError("must pass a cache object"); - } - if (typeof cache.get !== "function" || typeof cache.set !== "function" || typeof cache.delete !== "function") { - throw new TypeError("cache must implement get(key), set(key, val), and and delete(key)"); - } - this.cache = cache; - this.fillCallback = fill; - } - static isAbortException(exception) { - return ( - // DOMException - exception.name === "AbortError" || // standard-ish non-DOM abort exception - //@ts-ignore - exception.code === "ERR_ABORTED" || // stringified DOMException - exception.message === "AbortError: aborted" || // stringified standard-ish exception - exception.message === "Error: aborted" - ); - } - evict(key, entry) { - if (this.cache.get(key) === entry) { - this.cache.delete(key); - } - } - fill(key, data, signal, statusCallback) { - const aborter = new AggregateAbortController_1.default(); - const statusReporter = new AggregateStatusReporter_1.default(); - statusReporter.addCallback(statusCallback); - const newEntry = { - aborter, - promise: this.fillCallback(data, aborter.signal, (message) => { - statusReporter.callback(message); - }), - settled: false, - statusReporter, - get aborted() { - return this.aborter.signal.aborted; - } - }; - newEntry.aborter.addSignal(signal); - newEntry.aborter.signal.addEventListener("abort", () => { - if (!newEntry.settled) { - this.evict(key, newEntry); - } - }); - newEntry.promise.then(() => { - newEntry.settled = true; - }, () => { - newEntry.settled = true; - this.evict(key, newEntry); - }).catch((e) => { - console.error(e); - throw e; - }); - this.cache.set(key, newEntry); - } - static checkSinglePromise(promise, signal) { - function checkForSingleAbort() { - if (signal && signal.aborted) { - throw Object.assign(new Error("aborted"), { code: "ERR_ABORTED" }); - } - } - return promise.then((result) => { - checkForSingleAbort(); - return result; - }, (error) => { - checkForSingleAbort(); - throw error; - }); - } - has(key) { - return this.cache.has(key); - } - /** - * Callback for getting status of the pending async - * - * @callback statusCallback - * @param {any} status, current status string or message object - */ - /** - * @param {any} key cache key to use for this request - * @param {any} data data passed as the first argument to the fill callback - * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request - * @param {statusCallback} a callback to get the current status of a pending async operation - */ - get(key, data, signal, statusCallback) { - if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) { - throw new TypeError("second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?"); - } - const cacheEntry = this.cache.get(key); - if (cacheEntry) { - if (cacheEntry.aborted && !cacheEntry.settled) { - this.evict(key, cacheEntry); - return this.get(key, data, signal, statusCallback); - } - if (cacheEntry.settled) { - return cacheEntry.promise; - } - cacheEntry.aborter.addSignal(signal); - cacheEntry.statusReporter.addCallback(statusCallback); - return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal); - } - this.fill(key, data, signal, statusCallback); - return AbortablePromiseCache.checkSinglePromise( - //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix- - //eslint-disable-next-line @typescript-eslint/no-non-null-assertion - this.cache.get(key).promise, - signal - ); - } - /** - * delete the given entry from the cache. if it exists and its fill request has - * not yet settled, the fill will be signaled to abort. - * - * @param {any} key - */ - delete(key) { - const cachedEntry = this.cache.get(key); - if (cachedEntry) { - if (!cachedEntry.settled) { - cachedEntry.aborter.abort(); - } - this.cache.delete(key); - } - } - /** - * Clear all requests from the cache. Aborts any that have not settled. - * @returns {number} count of entries deleted - */ - clear() { - const keyIter = this.cache.keys(); - let deleteCount = 0; - for (let result = keyIter.next(); !result.done; result = keyIter.next()) { - this.delete(result.value); - deleteCount += 1; - } - return deleteCount; - } -} -AbortablePromiseCache$1.default = AbortablePromiseCache; -var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; -}; -Object.defineProperty(esm, "__esModule", { value: true }); -const AbortablePromiseCache_1 = __importDefault(AbortablePromiseCache$1); -var _default = esm.default = AbortablePromiseCache_1.default; -class Range { - constructor(arg1, arg2) { - this.ranges = arguments.length === 2 ? [{ min: arg1, max: arg2 }] : 0 in arg1 ? Object.assign({}, arg1) : [arg1]; - } - min() { - return this.ranges[0].min; - } - max() { - return this.ranges[this.ranges.length - 1].max; - } - contains(pos) { - for (let s = 0; s < this.ranges.length; s += 1) { - const r = this.ranges[s]; - if (r.min <= pos && r.max >= pos) { - return true; - } - } - return false; - } - isContiguous() { - return this.ranges.length > 1; - } - getRanges() { - return this.ranges.map((r) => new Range(r.min, r.max)); - } - toString() { - return this.ranges.map((r) => `[${r.min}-${r.max}]`).join(","); - } - union(s1) { - const ranges = this.getRanges().concat(s1.getRanges()).sort(this.rangeOrder); - const oranges = []; - let current = ranges[0]; - for (let i = 1; i < ranges.length; i += 1) { - const nxt = ranges[i]; - if (nxt.min() > current.max() + 1) { - oranges.push(current); - current = nxt; - } else if (nxt.max() > current.max()) { - current = new Range(current.min(), nxt.max()); - } - } - oranges.push(current); - if (oranges.length === 1) { - return oranges[0]; - } - return new Range(oranges); - } - intersection(arg) { - let s0 = this; - let s1 = arg; - const r0 = this.ranges(); - const r1 = s1.ranges(); - const l0 = r0.length; - const l1 = r1.length; - let i0 = 0; - let i1 = 0; - const or = []; - while (i0 < l0 && i1 < l1) { - s0 = r0[i0]; - s1 = r1[i1]; - const lapMin = Math.max(s0.min(), s1.min()); - const lapMax = Math.min(s0.max(), s1.max()); - if (lapMax >= lapMin) { - or.push(new Range(lapMin, lapMax)); - } - if (s0.max() > s1.max()) { - i1 += 1; - } else { - i0 += 1; - } - } - if (or.length === 0) { - throw new Error("found range of length 0"); - } - if (or.length === 1) { - return or[0]; - } - return new Range(or); - } - coverage() { - let tot = 0; - const rl = this.ranges(); - for (let ri = 0; ri < rl.length; ri += 1) { - const r = rl[ri]; - tot += r.max() - r.min() + 1; - } - return tot; - } - rangeOrder(tmpa, tmpb) { - let a = tmpa; - let b = tmpb; - if (arguments.length < 2) { - b = a; - a = this; - } - if (a.min() < b.min()) { - return -1; - } - if (a.min() > b.min()) { - return 1; - } - if (a.max() < b.max()) { - return -1; - } - if (b.max() > a.max()) { - return 1; - } - return 0; - } -} -/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */ -const Z_FIXED$1 = 4; -const Z_BINARY = 0; -const Z_TEXT = 1; -const Z_UNKNOWN$1 = 2; -function zero$1(buf) { - let len = buf.length; - while (--len >= 0) { - buf[len] = 0; - } -} -const STORED_BLOCK = 0; -const STATIC_TREES = 1; -const DYN_TREES = 2; -const MIN_MATCH$1 = 3; -const MAX_MATCH$1 = 258; -const LENGTH_CODES$1 = 29; -const LITERALS$1 = 256; -const L_CODES$1 = LITERALS$1 + 1 + LENGTH_CODES$1; -const D_CODES$1 = 30; -const BL_CODES$1 = 19; -const HEAP_SIZE$1 = 2 * L_CODES$1 + 1; -const MAX_BITS$1 = 15; -const Buf_size = 16; -const MAX_BL_BITS = 7; -const END_BLOCK = 256; -const REP_3_6 = 16; -const REPZ_3_10 = 17; -const REPZ_11_138 = 18; -const extra_lbits = ( - /* extra bits for each length code */ - new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]) -); -const extra_dbits = ( - /* extra bits for each distance code */ - new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]) -); -const extra_blbits = ( - /* extra bits for each bit length code */ - new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]) -); -const bl_order = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); -const DIST_CODE_LEN = 512; -const static_ltree = new Array((L_CODES$1 + 2) * 2); -zero$1(static_ltree); -const static_dtree = new Array(D_CODES$1 * 2); -zero$1(static_dtree); -const _dist_code = new Array(DIST_CODE_LEN); -zero$1(_dist_code); -const _length_code = new Array(MAX_MATCH$1 - MIN_MATCH$1 + 1); -zero$1(_length_code); -const base_length = new Array(LENGTH_CODES$1); -zero$1(base_length); -const base_dist = new Array(D_CODES$1); -zero$1(base_dist); -function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { - this.static_tree = static_tree; - this.extra_bits = extra_bits; - this.extra_base = extra_base; - this.elems = elems; - this.max_length = max_length; - this.has_stree = static_tree && static_tree.length; -} -let static_l_desc; -let static_d_desc; -let static_bl_desc; -function TreeDesc(dyn_tree, stat_desc) { - this.dyn_tree = dyn_tree; - this.max_code = 0; - this.stat_desc = stat_desc; -} -const d_code = (dist) => { - return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; -}; -const put_short = (s, w) => { - s.pending_buf[s.pending++] = w & 255; - s.pending_buf[s.pending++] = w >>> 8 & 255; -}; -const send_bits = (s, value, length) => { - if (s.bi_valid > Buf_size - length) { - s.bi_buf |= value << s.bi_valid & 65535; - put_short(s, s.bi_buf); - s.bi_buf = value >> Buf_size - s.bi_valid; - s.bi_valid += length - Buf_size; - } else { - s.bi_buf |= value << s.bi_valid & 65535; - s.bi_valid += length; - } -}; -const send_code = (s, c, tree) => { - send_bits( - s, - tree[c * 2], - tree[c * 2 + 1] - /*.Len*/ - ); -}; -const bi_reverse = (code, len) => { - let res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; -}; -const bi_flush = (s) => { - if (s.bi_valid === 16) { - put_short(s, s.bi_buf); - s.bi_buf = 0; - s.bi_valid = 0; - } else if (s.bi_valid >= 8) { - s.pending_buf[s.pending++] = s.bi_buf & 255; - s.bi_buf >>= 8; - s.bi_valid -= 8; - } -}; -const gen_bitlen = (s, desc) => { - const tree = desc.dyn_tree; - const max_code = desc.max_code; - const stree = desc.stat_desc.static_tree; - const has_stree = desc.stat_desc.has_stree; - const extra = desc.stat_desc.extra_bits; - const base = desc.stat_desc.extra_base; - const max_length = desc.stat_desc.max_length; - let h; - let n, m2; - let bits; - let xbits; - let f; - let overflow = 0; - for (bits = 0; bits <= MAX_BITS$1; bits++) { - s.bl_count[bits] = 0; - } - tree[s.heap[s.heap_max] * 2 + 1] = 0; - for (h = s.heap_max + 1; h < HEAP_SIZE$1; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1] * 2 + 1] + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1] = bits; - if (n > max_code) { - continue; - } - s.bl_count[bits]++; - xbits = 0; - if (n >= base) { - xbits = extra[n - base]; - } - f = tree[n * 2]; - s.opt_len += f * (bits + xbits); - if (has_stree) { - s.static_len += f * (stree[n * 2 + 1] + xbits); - } - } - if (overflow === 0) { - return; - } - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) { - bits--; - } - s.bl_count[bits]--; - s.bl_count[bits + 1] += 2; - s.bl_count[max_length]--; - overflow -= 2; - } while (overflow > 0); - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m2 = s.heap[--h]; - if (m2 > max_code) { - continue; - } - if (tree[m2 * 2 + 1] !== bits) { - s.opt_len += (bits - tree[m2 * 2 + 1]) * tree[m2 * 2]; - tree[m2 * 2 + 1] = bits; - } - n--; - } - } -}; -const gen_codes = (tree, max_code, bl_count) => { - const next_code = new Array(MAX_BITS$1 + 1); - let code = 0; - let bits; - let n; - for (bits = 1; bits <= MAX_BITS$1; bits++) { - code = code + bl_count[bits - 1] << 1; - next_code[bits] = code; - } - for (n = 0; n <= max_code; n++) { - let len = tree[n * 2 + 1]; - if (len === 0) { - continue; - } - tree[n * 2] = bi_reverse(next_code[len]++, len); - } -}; -const tr_static_init = () => { - let n; - let bits; - let length; - let code; - let dist; - const bl_count = new Array(MAX_BITS$1 + 1); - length = 0; - for (code = 0; code < LENGTH_CODES$1 - 1; code++) { - base_length[code] = length; - for (n = 0; n < 1 << extra_lbits[code]; n++) { - _length_code[length++] = code; - } - } - _length_code[length - 1] = code; - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < 1 << extra_dbits[code]; n++) { - _dist_code[dist++] = code; - } - } - dist >>= 7; - for (; code < D_CODES$1; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < 1 << extra_dbits[code] - 7; n++) { - _dist_code[256 + dist++] = code; - } - } - for (bits = 0; bits <= MAX_BITS$1; bits++) { - bl_count[bits] = 0; - } - n = 0; - while (n <= 143) { - static_ltree[n * 2 + 1] = 8; - n++; - bl_count[8]++; - } - while (n <= 255) { - static_ltree[n * 2 + 1] = 9; - n++; - bl_count[9]++; - } - while (n <= 279) { - static_ltree[n * 2 + 1] = 7; - n++; - bl_count[7]++; - } - while (n <= 287) { - static_ltree[n * 2 + 1] = 8; - n++; - bl_count[8]++; - } - gen_codes(static_ltree, L_CODES$1 + 1, bl_count); - for (n = 0; n < D_CODES$1; n++) { - static_dtree[n * 2 + 1] = 5; - static_dtree[n * 2] = bi_reverse(n, 5); - } - static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS$1 + 1, L_CODES$1, MAX_BITS$1); - static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES$1, MAX_BITS$1); - static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES$1, MAX_BL_BITS); -}; -const init_block = (s) => { - let n; - for (n = 0; n < L_CODES$1; n++) { - s.dyn_ltree[n * 2] = 0; - } - for (n = 0; n < D_CODES$1; n++) { - s.dyn_dtree[n * 2] = 0; - } - for (n = 0; n < BL_CODES$1; n++) { - s.bl_tree[n * 2] = 0; - } - s.dyn_ltree[END_BLOCK * 2] = 1; - s.opt_len = s.static_len = 0; - s.sym_next = s.matches = 0; -}; -const bi_windup = (s) => { - if (s.bi_valid > 8) { - put_short(s, s.bi_buf); - } else if (s.bi_valid > 0) { - s.pending_buf[s.pending++] = s.bi_buf; - } - s.bi_buf = 0; - s.bi_valid = 0; -}; -const smaller = (tree, n, m2, depth) => { - const _n2 = n * 2; - const _m2 = m2 * 2; - return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m2]; -}; -const pqdownheap = (s, tree, k) => { - const v = s.heap[k]; - let j = k << 1; - while (j <= s.heap_len) { - if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { - j++; - } - if (smaller(tree, v, s.heap[j], s.depth)) { - break; - } - s.heap[k] = s.heap[j]; - k = j; - j <<= 1; - } - s.heap[k] = v; -}; -const compress_block = (s, ltree, dtree) => { - let dist; - let lc; - let sx = 0; - let code; - let extra; - if (s.sym_next !== 0) { - do { - dist = s.pending_buf[s.sym_buf + sx++] & 255; - dist += (s.pending_buf[s.sym_buf + sx++] & 255) << 8; - lc = s.pending_buf[s.sym_buf + sx++]; - if (dist === 0) { - send_code(s, lc, ltree); - } else { - code = _length_code[lc]; - send_code(s, code + LITERALS$1 + 1, ltree); - extra = extra_lbits[code]; - if (extra !== 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); - } - dist--; - code = d_code(dist); - send_code(s, code, dtree); - extra = extra_dbits[code]; - if (extra !== 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); - } - } - } while (sx < s.sym_next); - } - send_code(s, END_BLOCK, ltree); -}; -const build_tree = (s, desc) => { - const tree = desc.dyn_tree; - const stree = desc.stat_desc.static_tree; - const has_stree = desc.stat_desc.has_stree; - const elems = desc.stat_desc.elems; - let n, m2; - let max_code = -1; - let node; - s.heap_len = 0; - s.heap_max = HEAP_SIZE$1; - for (n = 0; n < elems; n++) { - if (tree[n * 2] !== 0) { - s.heap[++s.heap_len] = max_code = n; - s.depth[n] = 0; - } else { - tree[n * 2 + 1] = 0; - } - } - while (s.heap_len < 2) { - node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0; - tree[node * 2] = 1; - s.depth[node] = 0; - s.opt_len--; - if (has_stree) { - s.static_len -= stree[node * 2 + 1]; - } - } - desc.max_code = max_code; - for (n = s.heap_len >> 1; n >= 1; n--) { - pqdownheap(s, tree, n); - } - node = elems; - do { - n = s.heap[ - 1 - /*SMALLEST*/ - ]; - s.heap[ - 1 - /*SMALLEST*/ - ] = s.heap[s.heap_len--]; - pqdownheap( - s, - tree, - 1 - /*SMALLEST*/ - ); - m2 = s.heap[ - 1 - /*SMALLEST*/ - ]; - s.heap[--s.heap_max] = n; - s.heap[--s.heap_max] = m2; - tree[node * 2] = tree[n * 2] + tree[m2 * 2]; - s.depth[node] = (s.depth[n] >= s.depth[m2] ? s.depth[n] : s.depth[m2]) + 1; - tree[n * 2 + 1] = tree[m2 * 2 + 1] = node; - s.heap[ - 1 - /*SMALLEST*/ - ] = node++; - pqdownheap( - s, - tree, - 1 - /*SMALLEST*/ - ); - } while (s.heap_len >= 2); - s.heap[--s.heap_max] = s.heap[ - 1 - /*SMALLEST*/ - ]; - gen_bitlen(s, desc); - gen_codes(tree, max_code, s.bl_count); -}; -const scan_tree = (s, tree, max_code) => { - let n; - let prevlen = -1; - let curlen; - let nextlen = tree[0 * 2 + 1]; - let count = 0; - let max_count = 7; - let min_count = 4; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - tree[(max_code + 1) * 2 + 1] = 65535; - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]; - if (++count < max_count && curlen === nextlen) { - continue; - } else if (count < min_count) { - s.bl_tree[curlen * 2] += count; - } else if (curlen !== 0) { - if (curlen !== prevlen) { - s.bl_tree[curlen * 2]++; - } - s.bl_tree[REP_3_6 * 2]++; - } else if (count <= 10) { - s.bl_tree[REPZ_3_10 * 2]++; - } else { - s.bl_tree[REPZ_11_138 * 2]++; - } - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - } else { - max_count = 7; - min_count = 4; - } - } -}; -const send_tree = (s, tree, max_code) => { - let n; - let prevlen = -1; - let curlen; - let nextlen = tree[0 * 2 + 1]; - let count = 0; - let max_count = 7; - let min_count = 4; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]; - if (++count < max_count && curlen === nextlen) { - continue; - } else if (count < min_count) { - do { - send_code(s, curlen, s.bl_tree); - } while (--count !== 0); - } else if (curlen !== 0) { - if (curlen !== prevlen) { - send_code(s, curlen, s.bl_tree); - count--; - } - send_code(s, REP_3_6, s.bl_tree); - send_bits(s, count - 3, 2); - } else if (count <= 10) { - send_code(s, REPZ_3_10, s.bl_tree); - send_bits(s, count - 3, 3); - } else { - send_code(s, REPZ_11_138, s.bl_tree); - send_bits(s, count - 11, 7); - } - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - } else { - max_count = 7; - min_count = 4; - } - } -}; -const build_bl_tree = (s) => { - let max_blindex; - scan_tree(s, s.dyn_ltree, s.l_desc.max_code); - scan_tree(s, s.dyn_dtree, s.d_desc.max_code); - build_tree(s, s.bl_desc); - for (max_blindex = BL_CODES$1 - 1; max_blindex >= 3; max_blindex--) { - if (s.bl_tree[bl_order[max_blindex] * 2 + 1] !== 0) { - break; - } - } - s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - return max_blindex; -}; -const send_all_trees = (s, lcodes, dcodes, blcodes) => { - let rank2; - send_bits(s, lcodes - 257, 5); - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); - for (rank2 = 0; rank2 < blcodes; rank2++) { - send_bits(s, s.bl_tree[bl_order[rank2] * 2 + 1], 3); - } - send_tree(s, s.dyn_ltree, lcodes - 1); - send_tree(s, s.dyn_dtree, dcodes - 1); -}; -const detect_data_type = (s) => { - let block_mask = 4093624447; - let n; - for (n = 0; n <= 31; n++, block_mask >>>= 1) { - if (block_mask & 1 && s.dyn_ltree[n * 2] !== 0) { - return Z_BINARY; - } - } - if (s.dyn_ltree[9 * 2] !== 0 || s.dyn_ltree[10 * 2] !== 0 || s.dyn_ltree[13 * 2] !== 0) { - return Z_TEXT; - } - for (n = 32; n < LITERALS$1; n++) { - if (s.dyn_ltree[n * 2] !== 0) { - return Z_TEXT; - } - } - return Z_BINARY; -}; -let static_init_done = false; -const _tr_init$1 = (s) => { - if (!static_init_done) { - tr_static_init(); - static_init_done = true; - } - s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); - s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); - s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); - s.bi_buf = 0; - s.bi_valid = 0; - init_block(s); -}; -const _tr_stored_block$1 = (s, buf, stored_len, last) => { - send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); - bi_windup(s); - put_short(s, stored_len); - put_short(s, ~stored_len); - if (stored_len) { - s.pending_buf.set(s.window.subarray(buf, buf + stored_len), s.pending); - } - s.pending += stored_len; -}; -const _tr_align$1 = (s) => { - send_bits(s, STATIC_TREES << 1, 3); - send_code(s, END_BLOCK, static_ltree); - bi_flush(s); -}; -const _tr_flush_block$1 = (s, buf, stored_len, last) => { - let opt_lenb, static_lenb; - let max_blindex = 0; - if (s.level > 0) { - if (s.strm.data_type === Z_UNKNOWN$1) { - s.strm.data_type = detect_data_type(s); - } - build_tree(s, s.l_desc); - build_tree(s, s.d_desc); - max_blindex = build_bl_tree(s); - opt_lenb = s.opt_len + 3 + 7 >>> 3; - static_lenb = s.static_len + 3 + 7 >>> 3; - if (static_lenb <= opt_lenb) { - opt_lenb = static_lenb; - } - } else { - opt_lenb = static_lenb = stored_len + 5; - } - if (stored_len + 4 <= opt_lenb && buf !== -1) { - _tr_stored_block$1(s, buf, stored_len, last); - } else if (s.strategy === Z_FIXED$1 || static_lenb === opt_lenb) { - send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); - compress_block(s, static_ltree, static_dtree); - } else { - send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); - send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); - compress_block(s, s.dyn_ltree, s.dyn_dtree); - } - init_block(s); - if (last) { - bi_windup(s); - } -}; -const _tr_tally$1 = (s, dist, lc) => { - s.pending_buf[s.sym_buf + s.sym_next++] = dist; - s.pending_buf[s.sym_buf + s.sym_next++] = dist >> 8; - s.pending_buf[s.sym_buf + s.sym_next++] = lc; - if (dist === 0) { - s.dyn_ltree[lc * 2]++; - } else { - s.matches++; - dist--; - s.dyn_ltree[(_length_code[lc] + LITERALS$1 + 1) * 2]++; - s.dyn_dtree[d_code(dist) * 2]++; - } - return s.sym_next === s.sym_end; -}; -var _tr_init_1 = _tr_init$1; -var _tr_stored_block_1 = _tr_stored_block$1; -var _tr_flush_block_1 = _tr_flush_block$1; -var _tr_tally_1 = _tr_tally$1; -var _tr_align_1 = _tr_align$1; -var trees = { - _tr_init: _tr_init_1, - _tr_stored_block: _tr_stored_block_1, - _tr_flush_block: _tr_flush_block_1, - _tr_tally: _tr_tally_1, - _tr_align: _tr_align_1 -}; -const adler32 = (adler, buf, len, pos) => { - let s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n = 0; - while (len !== 0) { - n = len > 2e3 ? 2e3 : len; - len -= n; - do { - s1 = s1 + buf[pos++] | 0; - s2 = s2 + s1 | 0; - } while (--n); - s1 %= 65521; - s2 %= 65521; - } - return s1 | s2 << 16 | 0; -}; -var adler32_1 = adler32; -const makeTable = () => { - let c, table = []; - for (var n = 0; n < 256; n++) { - c = n; - for (var k = 0; k < 8; k++) { - c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1; - } - table[n] = c; - } - return table; -}; -const crcTable = new Uint32Array(makeTable()); -const crc32 = (crc, buf, len, pos) => { - const t = crcTable; - const end = pos + len; - crc ^= -1; - for (let i = pos; i < end; i++) { - crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 255]; - } - return crc ^ -1; -}; -var crc32_1 = crc32; -var messages = { - 2: "need dictionary", - /* Z_NEED_DICT 2 */ - 1: "stream end", - /* Z_STREAM_END 1 */ - 0: "", - /* Z_OK 0 */ - "-1": "file error", - /* Z_ERRNO (-1) */ - "-2": "stream error", - /* Z_STREAM_ERROR (-2) */ - "-3": "data error", - /* Z_DATA_ERROR (-3) */ - "-4": "insufficient memory", - /* Z_MEM_ERROR (-4) */ - "-5": "buffer error", - /* Z_BUF_ERROR (-5) */ - "-6": "incompatible version" - /* Z_VERSION_ERROR (-6) */ -}; -var constants$2 = { - /* Allowed flush values; see deflate() and inflate() below for details */ - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_TREES: 6, - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - //Z_VERSION_ERROR: -6, - /* compression levels */ - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - /* Possible values of the data_type field (though see inflate()) */ - Z_BINARY: 0, - Z_TEXT: 1, - //Z_ASCII: 1, // = Z_TEXT (deprecated) - Z_UNKNOWN: 2, - /* The deflate compression method */ - Z_DEFLATED: 8 - //Z_NULL: null // Use -1 or null inline, depending on var type -}; -const { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = trees; -const { - Z_NO_FLUSH: Z_NO_FLUSH$2, - Z_PARTIAL_FLUSH, - Z_FULL_FLUSH: Z_FULL_FLUSH$1, - Z_FINISH: Z_FINISH$3, - Z_BLOCK: Z_BLOCK$1, - Z_OK: Z_OK$3, - Z_STREAM_END: Z_STREAM_END$3, - Z_STREAM_ERROR: Z_STREAM_ERROR$2, - Z_DATA_ERROR: Z_DATA_ERROR$2, - Z_BUF_ERROR: Z_BUF_ERROR$1, - Z_DEFAULT_COMPRESSION: Z_DEFAULT_COMPRESSION$1, - Z_FILTERED, - Z_HUFFMAN_ONLY, - Z_RLE, - Z_FIXED, - Z_DEFAULT_STRATEGY: Z_DEFAULT_STRATEGY$1, - Z_UNKNOWN, - Z_DEFLATED: Z_DEFLATED$2 -} = constants$2; -const MAX_MEM_LEVEL = 9; -const MAX_WBITS$1 = 15; -const DEF_MEM_LEVEL = 8; -const LENGTH_CODES = 29; -const LITERALS = 256; -const L_CODES = LITERALS + 1 + LENGTH_CODES; -const D_CODES = 30; -const BL_CODES = 19; -const HEAP_SIZE = 2 * L_CODES + 1; -const MAX_BITS = 15; -const MIN_MATCH = 3; -const MAX_MATCH = 258; -const MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1; -const PRESET_DICT = 32; -const INIT_STATE = 42; -const GZIP_STATE = 57; -const EXTRA_STATE = 69; -const NAME_STATE = 73; -const COMMENT_STATE = 91; -const HCRC_STATE = 103; -const BUSY_STATE = 113; -const FINISH_STATE = 666; -const BS_NEED_MORE = 1; -const BS_BLOCK_DONE = 2; -const BS_FINISH_STARTED = 3; -const BS_FINISH_DONE = 4; -const OS_CODE = 3; -const err = (strm, errorCode) => { - strm.msg = messages[errorCode]; - return errorCode; -}; -const rank = (f) => { - return f * 2 - (f > 4 ? 9 : 0); -}; -const zero = (buf) => { - let len = buf.length; - while (--len >= 0) { - buf[len] = 0; - } -}; -const slide_hash = (s) => { - let n, m2; - let p; - let wsize = s.w_size; - n = s.hash_size; - p = n; - do { - m2 = s.head[--p]; - s.head[p] = m2 >= wsize ? m2 - wsize : 0; - } while (--n); - n = wsize; - p = n; - do { - m2 = s.prev[--p]; - s.prev[p] = m2 >= wsize ? m2 - wsize : 0; - } while (--n); -}; -let HASH_ZLIB = (s, prev, data) => (prev << s.hash_shift ^ data) & s.hash_mask; -let HASH = HASH_ZLIB; -const flush_pending = (strm) => { - const s = strm.state; - let len = s.pending; - if (len > strm.avail_out) { - len = strm.avail_out; - } - if (len === 0) { - return; - } - strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out); - strm.next_out += len; - s.pending_out += len; - strm.total_out += len; - strm.avail_out -= len; - s.pending -= len; - if (s.pending === 0) { - s.pending_out = 0; - } -}; -const flush_block_only = (s, last) => { - _tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last); - s.block_start = s.strstart; - flush_pending(s.strm); -}; -const put_byte = (s, b) => { - s.pending_buf[s.pending++] = b; -}; -const putShortMSB = (s, b) => { - s.pending_buf[s.pending++] = b >>> 8 & 255; - s.pending_buf[s.pending++] = b & 255; -}; -const read_buf = (strm, buf, start, size) => { - let len = strm.avail_in; - if (len > size) { - len = size; - } - if (len === 0) { - return 0; - } - strm.avail_in -= len; - buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start); - if (strm.state.wrap === 1) { - strm.adler = adler32_1(strm.adler, buf, len, start); - } else if (strm.state.wrap === 2) { - strm.adler = crc32_1(strm.adler, buf, len, start); - } - strm.next_in += len; - strm.total_in += len; - return len; -}; -const longest_match = (s, cur_match) => { - let chain_length = s.max_chain_length; - let scan = s.strstart; - let match; - let len; - let best_len = s.prev_length; - let nice_match = s.nice_match; - const limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0; - const _win = s.window; - const wmask = s.w_mask; - const prev = s.prev; - const strend = s.strstart + MAX_MATCH; - let scan_end1 = _win[scan + best_len - 1]; - let scan_end = _win[scan + best_len]; - if (s.prev_length >= s.good_match) { - chain_length >>= 2; - } - if (nice_match > s.lookahead) { - nice_match = s.lookahead; - } - do { - match = cur_match; - if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) { - continue; - } - scan += 2; - match++; - do { - } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend); - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - if (len > best_len) { - s.match_start = cur_match; - best_len = len; - if (len >= nice_match) { - break; - } - scan_end1 = _win[scan + best_len - 1]; - scan_end = _win[scan + best_len]; - } - } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); - if (best_len <= s.lookahead) { - return best_len; - } - return s.lookahead; -}; -const fill_window = (s) => { - const _w_size = s.w_size; - let n, more, str; - do { - more = s.window_size - s.lookahead - s.strstart; - if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - s.window.set(s.window.subarray(_w_size, _w_size + _w_size - more), 0); - s.match_start -= _w_size; - s.strstart -= _w_size; - s.block_start -= _w_size; - if (s.insert > s.strstart) { - s.insert = s.strstart; - } - slide_hash(s); - more += _w_size; - } - if (s.strm.avail_in === 0) { - break; - } - n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); - s.lookahead += n; - if (s.lookahead + s.insert >= MIN_MATCH) { - str = s.strstart - s.insert; - s.ins_h = s.window[str]; - s.ins_h = HASH(s, s.ins_h, s.window[str + 1]); - while (s.insert) { - s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]); - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - s.insert--; - if (s.lookahead + s.insert < MIN_MATCH) { - break; - } - } - } - } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); -}; -const deflate_stored = (s, flush) => { - let min_block = s.pending_buf_size - 5 > s.w_size ? s.w_size : s.pending_buf_size - 5; - let len, left, have, last = 0; - let used = s.strm.avail_in; - do { - len = 65535; - have = s.bi_valid + 42 >> 3; - if (s.strm.avail_out < have) { - break; - } - have = s.strm.avail_out - have; - left = s.strstart - s.block_start; - if (len > left + s.strm.avail_in) { - len = left + s.strm.avail_in; - } - if (len > have) { - len = have; - } - if (len < min_block && (len === 0 && flush !== Z_FINISH$3 || flush === Z_NO_FLUSH$2 || len !== left + s.strm.avail_in)) { - break; - } - last = flush === Z_FINISH$3 && len === left + s.strm.avail_in ? 1 : 0; - _tr_stored_block(s, 0, 0, last); - s.pending_buf[s.pending - 4] = len; - s.pending_buf[s.pending - 3] = len >> 8; - s.pending_buf[s.pending - 2] = ~len; - s.pending_buf[s.pending - 1] = ~len >> 8; - flush_pending(s.strm); - if (left) { - if (left > len) { - left = len; - } - s.strm.output.set(s.window.subarray(s.block_start, s.block_start + left), s.strm.next_out); - s.strm.next_out += left; - s.strm.avail_out -= left; - s.strm.total_out += left; - s.block_start += left; - len -= left; - } - if (len) { - read_buf(s.strm, s.strm.output, s.strm.next_out, len); - s.strm.next_out += len; - s.strm.avail_out -= len; - s.strm.total_out += len; - } - } while (last === 0); - used -= s.strm.avail_in; - if (used) { - if (used >= s.w_size) { - s.matches = 2; - s.window.set(s.strm.input.subarray(s.strm.next_in - s.w_size, s.strm.next_in), 0); - s.strstart = s.w_size; - s.insert = s.strstart; - } else { - if (s.window_size - s.strstart <= used) { - s.strstart -= s.w_size; - s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0); - if (s.matches < 2) { - s.matches++; - } - if (s.insert > s.strstart) { - s.insert = s.strstart; - } - } - s.window.set(s.strm.input.subarray(s.strm.next_in - used, s.strm.next_in), s.strstart); - s.strstart += used; - s.insert += used > s.w_size - s.insert ? s.w_size - s.insert : used; - } - s.block_start = s.strstart; - } - if (s.high_water < s.strstart) { - s.high_water = s.strstart; - } - if (last) { - return BS_FINISH_DONE; - } - if (flush !== Z_NO_FLUSH$2 && flush !== Z_FINISH$3 && s.strm.avail_in === 0 && s.strstart === s.block_start) { - return BS_BLOCK_DONE; - } - have = s.window_size - s.strstart; - if (s.strm.avail_in > have && s.block_start >= s.w_size) { - s.block_start -= s.w_size; - s.strstart -= s.w_size; - s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0); - if (s.matches < 2) { - s.matches++; - } - have += s.w_size; - if (s.insert > s.strstart) { - s.insert = s.strstart; - } - } - if (have > s.strm.avail_in) { - have = s.strm.avail_in; - } - if (have) { - read_buf(s.strm, s.window, s.strstart, have); - s.strstart += have; - s.insert += have > s.w_size - s.insert ? s.w_size - s.insert : have; - } - if (s.high_water < s.strstart) { - s.high_water = s.strstart; - } - have = s.bi_valid + 42 >> 3; - have = s.pending_buf_size - have > 65535 ? 65535 : s.pending_buf_size - have; - min_block = have > s.w_size ? s.w_size : have; - left = s.strstart - s.block_start; - if (left >= min_block || (left || flush === Z_FINISH$3) && flush !== Z_NO_FLUSH$2 && s.strm.avail_in === 0 && left <= have) { - len = left > have ? have : left; - last = flush === Z_FINISH$3 && s.strm.avail_in === 0 && len === left ? 1 : 0; - _tr_stored_block(s, s.block_start, len, last); - s.block_start += len; - flush_pending(s.strm); - } - return last ? BS_FINISH_STARTED : BS_NEED_MORE; -}; -const deflate_fast = (s, flush) => { - let hash_head; - let bflush; - for (; ; ) { - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; - } - } - hash_head = 0; - if (s.lookahead >= MIN_MATCH) { - s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]); - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - } - if (hash_head !== 0 && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { - s.match_length = longest_match(s, hash_head); - } - if (s.match_length >= MIN_MATCH) { - bflush = _tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); - s.lookahead -= s.match_length; - if (s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) { - s.match_length--; - do { - s.strstart++; - s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]); - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - } while (--s.match_length !== 0); - s.strstart++; - } else { - s.strstart += s.match_length; - s.match_length = 0; - s.ins_h = s.window[s.strstart]; - s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]); - } - } else { - bflush = _tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - } - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === Z_FINISH$3) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - return BS_FINISH_DONE; - } - if (s.sym_next) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - return BS_BLOCK_DONE; -}; -const deflate_slow = (s, flush) => { - let hash_head; - let bflush; - let max_insert; - for (; ; ) { - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; - } - } - hash_head = 0; - if (s.lookahead >= MIN_MATCH) { - s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]); - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - } - s.prev_length = s.match_length; - s.prev_match = s.match_start; - s.match_length = MIN_MATCH - 1; - if (hash_head !== 0 && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) { - s.match_length = longest_match(s, hash_head); - if (s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096)) { - s.match_length = MIN_MATCH - 1; - } - } - if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { - max_insert = s.strstart + s.lookahead - MIN_MATCH; - bflush = _tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); - s.lookahead -= s.prev_length - 1; - s.prev_length -= 2; - do { - if (++s.strstart <= max_insert) { - s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]); - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - } - } while (--s.prev_length !== 0); - s.match_available = 0; - s.match_length = MIN_MATCH - 1; - s.strstart++; - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - } else if (s.match_available) { - bflush = _tr_tally(s, 0, s.window[s.strstart - 1]); - if (bflush) { - flush_block_only(s, false); - } - s.strstart++; - s.lookahead--; - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } else { - s.match_available = 1; - s.strstart++; - s.lookahead--; - } - } - if (s.match_available) { - bflush = _tr_tally(s, 0, s.window[s.strstart - 1]); - s.match_available = 0; - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === Z_FINISH$3) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - return BS_FINISH_DONE; - } - if (s.sym_next) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - return BS_BLOCK_DONE; -}; -const deflate_rle = (s, flush) => { - let bflush; - let prev; - let scan, strend; - const _win = s.window; - for (; ; ) { - if (s.lookahead <= MAX_MATCH) { - fill_window(s); - if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH$2) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; - } - } - s.match_length = 0; - if (s.lookahead >= MIN_MATCH && s.strstart > 0) { - scan = s.strstart - 1; - prev = _win[scan]; - if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { - strend = s.strstart + MAX_MATCH; - do { - } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend); - s.match_length = MAX_MATCH - (strend - scan); - if (s.match_length > s.lookahead) { - s.match_length = s.lookahead; - } - } - } - if (s.match_length >= MIN_MATCH) { - bflush = _tr_tally(s, 1, s.match_length - MIN_MATCH); - s.lookahead -= s.match_length; - s.strstart += s.match_length; - s.match_length = 0; - } else { - bflush = _tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - } - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - } - s.insert = 0; - if (flush === Z_FINISH$3) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - return BS_FINISH_DONE; - } - if (s.sym_next) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - return BS_BLOCK_DONE; -}; -const deflate_huff = (s, flush) => { - let bflush; - for (; ; ) { - if (s.lookahead === 0) { - fill_window(s); - if (s.lookahead === 0) { - if (flush === Z_NO_FLUSH$2) { - return BS_NEED_MORE; - } - break; - } - } - s.match_length = 0; - bflush = _tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - if (bflush) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - } - s.insert = 0; - if (flush === Z_FINISH$3) { - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - return BS_FINISH_DONE; - } - if (s.sym_next) { - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } - return BS_BLOCK_DONE; -}; -function Config(good_length, max_lazy, nice_length, max_chain, func) { - this.good_length = good_length; - this.max_lazy = max_lazy; - this.nice_length = nice_length; - this.max_chain = max_chain; - this.func = func; -} -const configuration_table = [ - /* good lazy nice chain */ - new Config(0, 0, 0, 0, deflate_stored), - /* 0 store only */ - new Config(4, 4, 8, 4, deflate_fast), - /* 1 max speed, no lazy matches */ - new Config(4, 5, 16, 8, deflate_fast), - /* 2 */ - new Config(4, 6, 32, 32, deflate_fast), - /* 3 */ - new Config(4, 4, 16, 16, deflate_slow), - /* 4 lazy matches */ - new Config(8, 16, 32, 32, deflate_slow), - /* 5 */ - new Config(8, 16, 128, 128, deflate_slow), - /* 6 */ - new Config(8, 32, 128, 256, deflate_slow), - /* 7 */ - new Config(32, 128, 258, 1024, deflate_slow), - /* 8 */ - new Config(32, 258, 258, 4096, deflate_slow) - /* 9 max compression */ -]; -const lm_init = (s) => { - s.window_size = 2 * s.w_size; - zero(s.head); - s.max_lazy_match = configuration_table[s.level].max_lazy; - s.good_match = configuration_table[s.level].good_length; - s.nice_match = configuration_table[s.level].nice_length; - s.max_chain_length = configuration_table[s.level].max_chain; - s.strstart = 0; - s.block_start = 0; - s.lookahead = 0; - s.insert = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - s.ins_h = 0; -}; -function DeflateState() { - this.strm = null; - this.status = 0; - this.pending_buf = null; - this.pending_buf_size = 0; - this.pending_out = 0; - this.pending = 0; - this.wrap = 0; - this.gzhead = null; - this.gzindex = 0; - this.method = Z_DEFLATED$2; - this.last_flush = -1; - this.w_size = 0; - this.w_bits = 0; - this.w_mask = 0; - this.window = null; - this.window_size = 0; - this.prev = null; - this.head = null; - this.ins_h = 0; - this.hash_size = 0; - this.hash_bits = 0; - this.hash_mask = 0; - this.hash_shift = 0; - this.block_start = 0; - this.match_length = 0; - this.prev_match = 0; - this.match_available = 0; - this.strstart = 0; - this.match_start = 0; - this.lookahead = 0; - this.prev_length = 0; - this.max_chain_length = 0; - this.max_lazy_match = 0; - this.level = 0; - this.strategy = 0; - this.good_match = 0; - this.nice_match = 0; - this.dyn_ltree = new Uint16Array(HEAP_SIZE * 2); - this.dyn_dtree = new Uint16Array((2 * D_CODES + 1) * 2); - this.bl_tree = new Uint16Array((2 * BL_CODES + 1) * 2); - zero(this.dyn_ltree); - zero(this.dyn_dtree); - zero(this.bl_tree); - this.l_desc = null; - this.d_desc = null; - this.bl_desc = null; - this.bl_count = new Uint16Array(MAX_BITS + 1); - this.heap = new Uint16Array(2 * L_CODES + 1); - zero(this.heap); - this.heap_len = 0; - this.heap_max = 0; - this.depth = new Uint16Array(2 * L_CODES + 1); - zero(this.depth); - this.sym_buf = 0; - this.lit_bufsize = 0; - this.sym_next = 0; - this.sym_end = 0; - this.opt_len = 0; - this.static_len = 0; - this.matches = 0; - this.insert = 0; - this.bi_buf = 0; - this.bi_valid = 0; -} -const deflateStateCheck = (strm) => { - if (!strm) { - return 1; - } - const s = strm.state; - if (!s || s.strm !== strm || s.status !== INIT_STATE && //#ifdef GZIP - s.status !== GZIP_STATE && //#endif - s.status !== EXTRA_STATE && s.status !== NAME_STATE && s.status !== COMMENT_STATE && s.status !== HCRC_STATE && s.status !== BUSY_STATE && s.status !== FINISH_STATE) { - return 1; - } - return 0; -}; -const deflateResetKeep = (strm) => { - if (deflateStateCheck(strm)) { - return err(strm, Z_STREAM_ERROR$2); - } - strm.total_in = strm.total_out = 0; - strm.data_type = Z_UNKNOWN; - const s = strm.state; - s.pending = 0; - s.pending_out = 0; - if (s.wrap < 0) { - s.wrap = -s.wrap; - } - s.status = //#ifdef GZIP - s.wrap === 2 ? GZIP_STATE : ( - //#endif - s.wrap ? INIT_STATE : BUSY_STATE - ); - strm.adler = s.wrap === 2 ? 0 : 1; - s.last_flush = -2; - _tr_init(s); - return Z_OK$3; -}; -const deflateReset = (strm) => { - const ret = deflateResetKeep(strm); - if (ret === Z_OK$3) { - lm_init(strm.state); - } - return ret; -}; -const deflateSetHeader = (strm, head) => { - if (deflateStateCheck(strm) || strm.state.wrap !== 2) { - return Z_STREAM_ERROR$2; - } - strm.state.gzhead = head; - return Z_OK$3; -}; -const deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => { - if (!strm) { - return Z_STREAM_ERROR$2; - } - let wrap = 1; - if (level === Z_DEFAULT_COMPRESSION$1) { - level = 6; - } - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } else if (windowBits > 15) { - wrap = 2; - windowBits -= 16; - } - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED$2 || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED || windowBits === 8 && wrap !== 1) { - return err(strm, Z_STREAM_ERROR$2); - } - if (windowBits === 8) { - windowBits = 9; - } - const s = new DeflateState(); - strm.state = s; - s.strm = strm; - s.status = INIT_STATE; - s.wrap = wrap; - s.gzhead = null; - s.w_bits = windowBits; - s.w_size = 1 << s.w_bits; - s.w_mask = s.w_size - 1; - s.hash_bits = memLevel + 7; - s.hash_size = 1 << s.hash_bits; - s.hash_mask = s.hash_size - 1; - s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); - s.window = new Uint8Array(s.w_size * 2); - s.head = new Uint16Array(s.hash_size); - s.prev = new Uint16Array(s.w_size); - s.lit_bufsize = 1 << memLevel + 6; - s.pending_buf_size = s.lit_bufsize * 4; - s.pending_buf = new Uint8Array(s.pending_buf_size); - s.sym_buf = s.lit_bufsize; - s.sym_end = (s.lit_bufsize - 1) * 3; - s.level = level; - s.strategy = strategy; - s.method = method; - return deflateReset(strm); -}; -const deflateInit = (strm, level) => { - return deflateInit2(strm, level, Z_DEFLATED$2, MAX_WBITS$1, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY$1); -}; -const deflate$2 = (strm, flush) => { - if (deflateStateCheck(strm) || flush > Z_BLOCK$1 || flush < 0) { - return strm ? err(strm, Z_STREAM_ERROR$2) : Z_STREAM_ERROR$2; - } - const s = strm.state; - if (!strm.output || strm.avail_in !== 0 && !strm.input || s.status === FINISH_STATE && flush !== Z_FINISH$3) { - return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR$1 : Z_STREAM_ERROR$2); - } - const old_flush = s.last_flush; - s.last_flush = flush; - if (s.pending !== 0) { - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; - return Z_OK$3; - } - } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH$3) { - return err(strm, Z_BUF_ERROR$1); - } - if (s.status === FINISH_STATE && strm.avail_in !== 0) { - return err(strm, Z_BUF_ERROR$1); - } - if (s.status === INIT_STATE && s.wrap === 0) { - s.status = BUSY_STATE; - } - if (s.status === INIT_STATE) { - let header = Z_DEFLATED$2 + (s.w_bits - 8 << 4) << 8; - let level_flags = -1; - if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { - level_flags = 0; - } else if (s.level < 6) { - level_flags = 1; - } else if (s.level === 6) { - level_flags = 2; - } else { - level_flags = 3; - } - header |= level_flags << 6; - if (s.strstart !== 0) { - header |= PRESET_DICT; - } - header += 31 - header % 31; - putShortMSB(s, header); - if (s.strstart !== 0) { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 65535); - } - strm.adler = 1; - s.status = BUSY_STATE; - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK$3; - } - } - if (s.status === GZIP_STATE) { - strm.adler = 0; - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (!s.gzhead) { - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); - put_byte(s, OS_CODE); - s.status = BUSY_STATE; - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK$3; - } - } else { - put_byte( - s, - (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16) - ); - put_byte(s, s.gzhead.time & 255); - put_byte(s, s.gzhead.time >> 8 & 255); - put_byte(s, s.gzhead.time >> 16 & 255); - put_byte(s, s.gzhead.time >> 24 & 255); - put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0); - put_byte(s, s.gzhead.os & 255); - if (s.gzhead.extra && s.gzhead.extra.length) { - put_byte(s, s.gzhead.extra.length & 255); - put_byte(s, s.gzhead.extra.length >> 8 & 255); - } - if (s.gzhead.hcrc) { - strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending, 0); - } - s.gzindex = 0; - s.status = EXTRA_STATE; - } - } - if (s.status === EXTRA_STATE) { - if (s.gzhead.extra) { - let beg = s.pending; - let left = (s.gzhead.extra.length & 65535) - s.gzindex; - while (s.pending + left > s.pending_buf_size) { - let copy = s.pending_buf_size - s.pending; - s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex + copy), s.pending); - s.pending = s.pending_buf_size; - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); - } - s.gzindex += copy; - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK$3; - } - beg = 0; - left -= copy; - } - let gzhead_extra = new Uint8Array(s.gzhead.extra); - s.pending_buf.set(gzhead_extra.subarray(s.gzindex, s.gzindex + left), s.pending); - s.pending += left; - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); - } - s.gzindex = 0; - } - s.status = NAME_STATE; - } - if (s.status === NAME_STATE) { - if (s.gzhead.name) { - let beg = s.pending; - let val; - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK$3; - } - beg = 0; - } - if (s.gzindex < s.gzhead.name.length) { - val = s.gzhead.name.charCodeAt(s.gzindex++) & 255; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); - } - s.gzindex = 0; - } - s.status = COMMENT_STATE; - } - if (s.status === COMMENT_STATE) { - if (s.gzhead.comment) { - let beg = s.pending; - let val; - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK$3; - } - beg = 0; - } - if (s.gzindex < s.gzhead.comment.length) { - val = s.gzhead.comment.charCodeAt(s.gzindex++) & 255; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg); - } - } - s.status = HCRC_STATE; - } - if (s.status === HCRC_STATE) { - if (s.gzhead.hcrc) { - if (s.pending + 2 > s.pending_buf_size) { - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK$3; - } - } - put_byte(s, strm.adler & 255); - put_byte(s, strm.adler >> 8 & 255); - strm.adler = 0; - } - s.status = BUSY_STATE; - flush_pending(strm); - if (s.pending !== 0) { - s.last_flush = -1; - return Z_OK$3; - } - } - if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH$2 && s.status !== FINISH_STATE) { - let bstate = s.level === 0 ? deflate_stored(s, flush) : s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush); - if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { - s.status = FINISH_STATE; - } - if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { - if (strm.avail_out === 0) { - s.last_flush = -1; - } - return Z_OK$3; - } - if (bstate === BS_BLOCK_DONE) { - if (flush === Z_PARTIAL_FLUSH) { - _tr_align(s); - } else if (flush !== Z_BLOCK$1) { - _tr_stored_block(s, 0, 0, false); - if (flush === Z_FULL_FLUSH$1) { - zero(s.head); - if (s.lookahead === 0) { - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - } - } - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; - return Z_OK$3; - } - } - } - if (flush !== Z_FINISH$3) { - return Z_OK$3; - } - if (s.wrap <= 0) { - return Z_STREAM_END$3; - } - if (s.wrap === 2) { - put_byte(s, strm.adler & 255); - put_byte(s, strm.adler >> 8 & 255); - put_byte(s, strm.adler >> 16 & 255); - put_byte(s, strm.adler >> 24 & 255); - put_byte(s, strm.total_in & 255); - put_byte(s, strm.total_in >> 8 & 255); - put_byte(s, strm.total_in >> 16 & 255); - put_byte(s, strm.total_in >> 24 & 255); - } else { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 65535); - } - flush_pending(strm); - if (s.wrap > 0) { - s.wrap = -s.wrap; - } - return s.pending !== 0 ? Z_OK$3 : Z_STREAM_END$3; -}; -const deflateEnd = (strm) => { - if (deflateStateCheck(strm)) { - return Z_STREAM_ERROR$2; - } - const status = strm.state.status; - strm.state = null; - return status === BUSY_STATE ? err(strm, Z_DATA_ERROR$2) : Z_OK$3; -}; -const deflateSetDictionary = (strm, dictionary) => { - let dictLength = dictionary.length; - if (deflateStateCheck(strm)) { - return Z_STREAM_ERROR$2; - } - const s = strm.state; - const wrap = s.wrap; - if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) { - return Z_STREAM_ERROR$2; - } - if (wrap === 1) { - strm.adler = adler32_1(strm.adler, dictionary, dictLength, 0); - } - s.wrap = 0; - if (dictLength >= s.w_size) { - if (wrap === 0) { - zero(s.head); - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - let tmpDict = new Uint8Array(s.w_size); - tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0); - dictionary = tmpDict; - dictLength = s.w_size; - } - const avail = strm.avail_in; - const next = strm.next_in; - const input = strm.input; - strm.avail_in = dictLength; - strm.next_in = 0; - strm.input = dictionary; - fill_window(s); - while (s.lookahead >= MIN_MATCH) { - let str = s.strstart; - let n = s.lookahead - (MIN_MATCH - 1); - do { - s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]); - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - } while (--n); - s.strstart = str; - s.lookahead = MIN_MATCH - 1; - fill_window(s); - } - s.strstart += s.lookahead; - s.block_start = s.strstart; - s.insert = s.lookahead; - s.lookahead = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - strm.next_in = next; - strm.input = input; - strm.avail_in = avail; - s.wrap = wrap; - return Z_OK$3; -}; -var deflateInit_1 = deflateInit; -var deflateInit2_1 = deflateInit2; -var deflateReset_1 = deflateReset; -var deflateResetKeep_1 = deflateResetKeep; -var deflateSetHeader_1 = deflateSetHeader; -var deflate_2$1 = deflate$2; -var deflateEnd_1 = deflateEnd; -var deflateSetDictionary_1 = deflateSetDictionary; -var deflateInfo = "pako deflate (from Nodeca project)"; -var deflate_1$2 = { - deflateInit: deflateInit_1, - deflateInit2: deflateInit2_1, - deflateReset: deflateReset_1, - deflateResetKeep: deflateResetKeep_1, - deflateSetHeader: deflateSetHeader_1, - deflate: deflate_2$1, - deflateEnd: deflateEnd_1, - deflateSetDictionary: deflateSetDictionary_1, - deflateInfo -}; -const _has = (obj, key) => { - return Object.prototype.hasOwnProperty.call(obj, key); -}; -var assign = function(obj) { - const sources = Array.prototype.slice.call(arguments, 1); - while (sources.length) { - const source = sources.shift(); - if (!source) { - continue; - } - if (typeof source !== "object") { - throw new TypeError(source + "must be non-object"); - } - for (const p in source) { - if (_has(source, p)) { - obj[p] = source[p]; - } - } - } - return obj; -}; -var flattenChunks = (chunks) => { - let len = 0; - for (let i = 0, l = chunks.length; i < l; i++) { - len += chunks[i].length; - } - const result = new Uint8Array(len); - for (let i = 0, pos = 0, l = chunks.length; i < l; i++) { - let chunk = chunks[i]; - result.set(chunk, pos); - pos += chunk.length; - } - return result; -}; -var common = { - assign, - flattenChunks -}; -let STR_APPLY_UIA_OK = true; -try { - String.fromCharCode.apply(null, new Uint8Array(1)); -} catch (__) { - STR_APPLY_UIA_OK = false; -} -const _utf8len = new Uint8Array(256); -for (let q = 0; q < 256; q++) { - _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1; -} -_utf8len[254] = _utf8len[254] = 1; -var string2buf = (str) => { - if (typeof TextEncoder === "function" && TextEncoder.prototype.encode) { - return new TextEncoder().encode(str); - } - let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 64512) === 55296 && m_pos + 1 < str_len) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 64512) === 56320) { - c = 65536 + (c - 55296 << 10) + (c2 - 56320); - m_pos++; - } - } - buf_len += c < 128 ? 1 : c < 2048 ? 2 : c < 65536 ? 3 : 4; - } - buf = new Uint8Array(buf_len); - for (i = 0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 64512) === 55296 && m_pos + 1 < str_len) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 64512) === 56320) { - c = 65536 + (c - 55296 << 10) + (c2 - 56320); - m_pos++; - } - } - if (c < 128) { - buf[i++] = c; - } else if (c < 2048) { - buf[i++] = 192 | c >>> 6; - buf[i++] = 128 | c & 63; - } else if (c < 65536) { - buf[i++] = 224 | c >>> 12; - buf[i++] = 128 | c >>> 6 & 63; - buf[i++] = 128 | c & 63; - } else { - buf[i++] = 240 | c >>> 18; - buf[i++] = 128 | c >>> 12 & 63; - buf[i++] = 128 | c >>> 6 & 63; - buf[i++] = 128 | c & 63; - } - } - return buf; -}; -const buf2binstring = (buf, len) => { - if (len < 65534) { - if (buf.subarray && STR_APPLY_UIA_OK) { - return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len)); - } - } - let result = ""; - for (let i = 0; i < len; i++) { - result += String.fromCharCode(buf[i]); - } - return result; -}; -var buf2string = (buf, max2) => { - const len = max2 || buf.length; - if (typeof TextDecoder === "function" && TextDecoder.prototype.decode) { - return new TextDecoder().decode(buf.subarray(0, max2)); - } - let i, out; - const utf16buf = new Array(len * 2); - for (out = 0, i = 0; i < len; ) { - let c = buf[i++]; - if (c < 128) { - utf16buf[out++] = c; - continue; - } - let c_len = _utf8len[c]; - if (c_len > 4) { - utf16buf[out++] = 65533; - i += c_len - 1; - continue; - } - c &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7; - while (c_len > 1 && i < len) { - c = c << 6 | buf[i++] & 63; - c_len--; - } - if (c_len > 1) { - utf16buf[out++] = 65533; - continue; - } - if (c < 65536) { - utf16buf[out++] = c; - } else { - c -= 65536; - utf16buf[out++] = 55296 | c >> 10 & 1023; - utf16buf[out++] = 56320 | c & 1023; - } - } - return buf2binstring(utf16buf, out); -}; -var utf8border = (buf, max2) => { - max2 = max2 || buf.length; - if (max2 > buf.length) { - max2 = buf.length; - } - let pos = max2 - 1; - while (pos >= 0 && (buf[pos] & 192) === 128) { - pos--; - } - if (pos < 0) { - return max2; - } - if (pos === 0) { - return max2; - } - return pos + _utf8len[buf[pos]] > max2 ? pos : max2; -}; -var strings = { - string2buf, - buf2string, - utf8border -}; -function ZStream() { - this.input = null; - this.next_in = 0; - this.avail_in = 0; - this.total_in = 0; - this.output = null; - this.next_out = 0; - this.avail_out = 0; - this.total_out = 0; - this.msg = ""; - this.state = null; - this.data_type = 2; - this.adler = 0; -} -var zstream = ZStream; -const toString$1 = Object.prototype.toString; -const { - Z_NO_FLUSH: Z_NO_FLUSH$1, - Z_SYNC_FLUSH, - Z_FULL_FLUSH, - Z_FINISH: Z_FINISH$2, - Z_OK: Z_OK$2, - Z_STREAM_END: Z_STREAM_END$2, - Z_DEFAULT_COMPRESSION, - Z_DEFAULT_STRATEGY, - Z_DEFLATED: Z_DEFLATED$1 -} = constants$2; -function Deflate$1(options) { - this.options = common.assign({ - level: Z_DEFAULT_COMPRESSION, - method: Z_DEFLATED$1, - chunkSize: 16384, - windowBits: 15, - memLevel: 8, - strategy: Z_DEFAULT_STRATEGY - }, options || {}); - let opt = this.options; - if (opt.raw && opt.windowBits > 0) { - opt.windowBits = -opt.windowBits; - } else if (opt.gzip && opt.windowBits > 0 && opt.windowBits < 16) { - opt.windowBits += 16; - } - this.err = 0; - this.msg = ""; - this.ended = false; - this.chunks = []; - this.strm = new zstream(); - this.strm.avail_out = 0; - let status = deflate_1$2.deflateInit2( - this.strm, - opt.level, - opt.method, - opt.windowBits, - opt.memLevel, - opt.strategy - ); - if (status !== Z_OK$2) { - throw new Error(messages[status]); - } - if (opt.header) { - deflate_1$2.deflateSetHeader(this.strm, opt.header); - } - if (opt.dictionary) { - let dict; - if (typeof opt.dictionary === "string") { - dict = strings.string2buf(opt.dictionary); - } else if (toString$1.call(opt.dictionary) === "[object ArrayBuffer]") { - dict = new Uint8Array(opt.dictionary); - } else { - dict = opt.dictionary; - } - status = deflate_1$2.deflateSetDictionary(this.strm, dict); - if (status !== Z_OK$2) { - throw new Error(messages[status]); - } - this._dict_set = true; - } -} -Deflate$1.prototype.push = function(data, flush_mode) { - const strm = this.strm; - const chunkSize = this.options.chunkSize; - let status, _flush_mode; - if (this.ended) { - return false; - } - if (flush_mode === ~~flush_mode) - _flush_mode = flush_mode; - else - _flush_mode = flush_mode === true ? Z_FINISH$2 : Z_NO_FLUSH$1; - if (typeof data === "string") { - strm.input = strings.string2buf(data); - } else if (toString$1.call(data) === "[object ArrayBuffer]") { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - strm.next_in = 0; - strm.avail_in = strm.input.length; - for (; ; ) { - if (strm.avail_out === 0) { - strm.output = new Uint8Array(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH) && strm.avail_out <= 6) { - this.onData(strm.output.subarray(0, strm.next_out)); - strm.avail_out = 0; - continue; - } - status = deflate_1$2.deflate(strm, _flush_mode); - if (status === Z_STREAM_END$2) { - if (strm.next_out > 0) { - this.onData(strm.output.subarray(0, strm.next_out)); - } - status = deflate_1$2.deflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return status === Z_OK$2; - } - if (strm.avail_out === 0) { - this.onData(strm.output); - continue; - } - if (_flush_mode > 0 && strm.next_out > 0) { - this.onData(strm.output.subarray(0, strm.next_out)); - strm.avail_out = 0; - continue; - } - if (strm.avail_in === 0) - break; - } - return true; -}; -Deflate$1.prototype.onData = function(chunk) { - this.chunks.push(chunk); -}; -Deflate$1.prototype.onEnd = function(status) { - if (status === Z_OK$2) { - this.result = common.flattenChunks(this.chunks); - } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; -}; -const BAD$1 = 16209; -const TYPE$1 = 16191; -var inffast = function inflate_fast(strm, start) { - let _in; - let last; - let _out; - let beg; - let end; - let dmax; - let wsize; - let whave; - let wnext; - let s_window; - let hold; - let bits; - let lcode; - let dcode; - let lmask; - let dmask; - let here; - let op; - let len; - let dist; - let from; - let from_source; - let input, output; - const state = strm.state; - _in = strm.next_in; - input = strm.input; - last = _in + (strm.avail_in - 5); - _out = strm.next_out; - output = strm.output; - beg = _out - (start - strm.avail_out); - end = _out + (strm.avail_out - 257); - dmax = state.dmax; - wsize = state.wsize; - whave = state.whave; - wnext = state.wnext; - s_window = state.window; - hold = state.hold; - bits = state.bits; - lcode = state.lencode; - dcode = state.distcode; - lmask = (1 << state.lenbits) - 1; - dmask = (1 << state.distbits) - 1; - top: - do { - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = lcode[hold & lmask]; - dolen: - for (; ; ) { - op = here >>> 24; - hold >>>= op; - bits -= op; - op = here >>> 16 & 255; - if (op === 0) { - output[_out++] = here & 65535; - } else if (op & 16) { - len = here & 65535; - op &= 15; - if (op) { - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - len += hold & (1 << op) - 1; - hold >>>= op; - bits -= op; - } - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = dcode[hold & dmask]; - dodist: - for (; ; ) { - op = here >>> 24; - hold >>>= op; - bits -= op; - op = here >>> 16 & 255; - if (op & 16) { - dist = here & 65535; - op &= 15; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - } - dist += hold & (1 << op) - 1; - if (dist > dmax) { - strm.msg = "invalid distance too far back"; - state.mode = BAD$1; - break top; - } - hold >>>= op; - bits -= op; - op = _out - beg; - if (dist > op) { - op = dist - op; - if (op > whave) { - if (state.sane) { - strm.msg = "invalid distance too far back"; - state.mode = BAD$1; - break top; - } - } - from = 0; - from_source = s_window; - if (wnext === 0) { - from += wsize - op; - if (op < len) { - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; - from_source = output; - } - } else if (wnext < op) { - from += wsize + wnext - op; - op -= wnext; - if (op < len) { - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = 0; - if (wnext < len) { - op = wnext; - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; - from_source = output; - } - } - } else { - from += wnext - op; - if (op < len) { - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; - from_source = output; - } - } - while (len > 2) { - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - len -= 3; - } - if (len) { - output[_out++] = from_source[from++]; - if (len > 1) { - output[_out++] = from_source[from++]; - } - } - } else { - from = _out - dist; - do { - output[_out++] = output[from++]; - output[_out++] = output[from++]; - output[_out++] = output[from++]; - len -= 3; - } while (len > 2); - if (len) { - output[_out++] = output[from++]; - if (len > 1) { - output[_out++] = output[from++]; - } - } - } - } else if ((op & 64) === 0) { - here = dcode[(here & 65535) + (hold & (1 << op) - 1)]; - continue dodist; - } else { - strm.msg = "invalid distance code"; - state.mode = BAD$1; - break top; - } - break; - } - } else if ((op & 64) === 0) { - here = lcode[(here & 65535) + (hold & (1 << op) - 1)]; - continue dolen; - } else if (op & 32) { - state.mode = TYPE$1; - break top; - } else { - strm.msg = "invalid literal/length code"; - state.mode = BAD$1; - break top; - } - break; - } - } while (_in < last && _out < end); - len = bits >> 3; - _in -= len; - bits -= len << 3; - hold &= (1 << bits) - 1; - strm.next_in = _in; - strm.next_out = _out; - strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last); - strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end); - state.hold = hold; - state.bits = bits; - return; -}; -const MAXBITS = 15; -const ENOUGH_LENS$1 = 852; -const ENOUGH_DISTS$1 = 592; -const CODES$1 = 0; -const LENS$1 = 1; -const DISTS$1 = 2; -const lbase = new Uint16Array([ - /* Length codes 257..285 base */ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 13, - 15, - 17, - 19, - 23, - 27, - 31, - 35, - 43, - 51, - 59, - 67, - 83, - 99, - 115, - 131, - 163, - 195, - 227, - 258, - 0, - 0 -]); -const lext = new Uint8Array([ - /* Length codes 257..285 extra */ - 16, - 16, - 16, - 16, - 16, - 16, - 16, - 16, - 17, - 17, - 17, - 17, - 18, - 18, - 18, - 18, - 19, - 19, - 19, - 19, - 20, - 20, - 20, - 20, - 21, - 21, - 21, - 21, - 16, - 72, - 78 -]); -const dbase = new Uint16Array([ - /* Distance codes 0..29 base */ - 1, - 2, - 3, - 4, - 5, - 7, - 9, - 13, - 17, - 25, - 33, - 49, - 65, - 97, - 129, - 193, - 257, - 385, - 513, - 769, - 1025, - 1537, - 2049, - 3073, - 4097, - 6145, - 8193, - 12289, - 16385, - 24577, - 0, - 0 -]); -const dext = new Uint8Array([ - /* Distance codes 0..29 extra */ - 16, - 16, - 16, - 16, - 17, - 17, - 18, - 18, - 19, - 19, - 20, - 20, - 21, - 21, - 22, - 22, - 23, - 23, - 24, - 24, - 25, - 25, - 26, - 26, - 27, - 27, - 28, - 28, - 29, - 29, - 64, - 64 -]); -const inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) => { - const bits = opts.bits; - let len = 0; - let sym = 0; - let min2 = 0, max2 = 0; - let root = 0; - let curr = 0; - let drop = 0; - let left = 0; - let used = 0; - let huff = 0; - let incr; - let fill; - let low; - let mask; - let next; - let base = null; - let match; - const count = new Uint16Array(MAXBITS + 1); - const offs = new Uint16Array(MAXBITS + 1); - let extra = null; - let here_bits, here_op, here_val; - for (len = 0; len <= MAXBITS; len++) { - count[len] = 0; - } - for (sym = 0; sym < codes; sym++) { - count[lens[lens_index + sym]]++; - } - root = bits; - for (max2 = MAXBITS; max2 >= 1; max2--) { - if (count[max2] !== 0) { - break; - } - } - if (root > max2) { - root = max2; - } - if (max2 === 0) { - table[table_index++] = 1 << 24 | 64 << 16 | 0; - table[table_index++] = 1 << 24 | 64 << 16 | 0; - opts.bits = 1; - return 0; - } - for (min2 = 1; min2 < max2; min2++) { - if (count[min2] !== 0) { - break; - } - } - if (root < min2) { - root = min2; - } - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) { - return -1; - } - } - if (left > 0 && (type === CODES$1 || max2 !== 1)) { - return -1; - } - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) { - offs[len + 1] = offs[len] + count[len]; - } - for (sym = 0; sym < codes; sym++) { - if (lens[lens_index + sym] !== 0) { - work[offs[lens[lens_index + sym]]++] = sym; - } - } - if (type === CODES$1) { - base = extra = work; - match = 20; - } else if (type === LENS$1) { - base = lbase; - extra = lext; - match = 257; - } else { - base = dbase; - extra = dext; - match = 0; - } - huff = 0; - sym = 0; - len = min2; - next = table_index; - curr = root; - drop = 0; - low = -1; - used = 1 << root; - mask = used - 1; - if (type === LENS$1 && used > ENOUGH_LENS$1 || type === DISTS$1 && used > ENOUGH_DISTS$1) { - return 1; - } - for (; ; ) { - here_bits = len - drop; - if (work[sym] + 1 < match) { - here_op = 0; - here_val = work[sym]; - } else if (work[sym] >= match) { - here_op = extra[work[sym] - match]; - here_val = base[work[sym] - match]; - } else { - here_op = 32 + 64; - here_val = 0; - } - incr = 1 << len - drop; - fill = 1 << curr; - min2 = fill; - do { - fill -= incr; - table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0; - } while (fill !== 0); - incr = 1 << len - 1; - while (huff & incr) { - incr >>= 1; - } - if (incr !== 0) { - huff &= incr - 1; - huff += incr; - } else { - huff = 0; - } - sym++; - if (--count[len] === 0) { - if (len === max2) { - break; - } - len = lens[lens_index + work[sym]]; - } - if (len > root && (huff & mask) !== low) { - if (drop === 0) { - drop = root; - } - next += min2; - curr = len - drop; - left = 1 << curr; - while (curr + drop < max2) { - left -= count[curr + drop]; - if (left <= 0) { - break; - } - curr++; - left <<= 1; - } - used += 1 << curr; - if (type === LENS$1 && used > ENOUGH_LENS$1 || type === DISTS$1 && used > ENOUGH_DISTS$1) { - return 1; - } - low = huff & mask; - table[low] = root << 24 | curr << 16 | next - table_index | 0; - } - } - if (huff !== 0) { - table[next + huff] = len - drop << 24 | 64 << 16 | 0; - } - opts.bits = root; - return 0; -}; -var inftrees = inflate_table; -const CODES = 0; -const LENS = 1; -const DISTS = 2; -const { - Z_FINISH: Z_FINISH$1, - Z_BLOCK, - Z_TREES, - Z_OK: Z_OK$1, - Z_STREAM_END: Z_STREAM_END$1, - Z_NEED_DICT: Z_NEED_DICT$1, - Z_STREAM_ERROR: Z_STREAM_ERROR$1, - Z_DATA_ERROR: Z_DATA_ERROR$1, - Z_MEM_ERROR: Z_MEM_ERROR$1, - Z_BUF_ERROR, - Z_DEFLATED -} = constants$2; -const HEAD = 16180; -const FLAGS = 16181; -const TIME = 16182; -const OS = 16183; -const EXLEN = 16184; -const EXTRA = 16185; -const NAME = 16186; -const COMMENT = 16187; -const HCRC = 16188; -const DICTID = 16189; -const DICT = 16190; -const TYPE = 16191; -const TYPEDO = 16192; -const STORED = 16193; -const COPY_ = 16194; -const COPY = 16195; -const TABLE = 16196; -const LENLENS = 16197; -const CODELENS = 16198; -const LEN_ = 16199; -const LEN = 16200; -const LENEXT = 16201; -const DIST = 16202; -const DISTEXT = 16203; -const MATCH = 16204; -const LIT = 16205; -const CHECK = 16206; -const LENGTH = 16207; -const DONE = 16208; -const BAD = 16209; -const MEM = 16210; -const SYNC = 16211; -const ENOUGH_LENS = 852; -const ENOUGH_DISTS = 592; -const MAX_WBITS = 15; -const DEF_WBITS = MAX_WBITS; -const zswap32 = (q) => { - return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24); -}; -function InflateState() { - this.strm = null; - this.mode = 0; - this.last = false; - this.wrap = 0; - this.havedict = false; - this.flags = 0; - this.dmax = 0; - this.check = 0; - this.total = 0; - this.head = null; - this.wbits = 0; - this.wsize = 0; - this.whave = 0; - this.wnext = 0; - this.window = null; - this.hold = 0; - this.bits = 0; - this.length = 0; - this.offset = 0; - this.extra = 0; - this.lencode = null; - this.distcode = null; - this.lenbits = 0; - this.distbits = 0; - this.ncode = 0; - this.nlen = 0; - this.ndist = 0; - this.have = 0; - this.next = null; - this.lens = new Uint16Array(320); - this.work = new Uint16Array(288); - this.lendyn = null; - this.distdyn = null; - this.sane = 0; - this.back = 0; - this.was = 0; -} -const inflateStateCheck = (strm) => { - if (!strm) { - return 1; - } - const state = strm.state; - if (!state || state.strm !== strm || state.mode < HEAD || state.mode > SYNC) { - return 1; - } - return 0; -}; -const inflateResetKeep = (strm) => { - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR$1; - } - const state = strm.state; - strm.total_in = strm.total_out = state.total = 0; - strm.msg = ""; - if (state.wrap) { - strm.adler = state.wrap & 1; - } - state.mode = HEAD; - state.last = 0; - state.havedict = 0; - state.flags = -1; - state.dmax = 32768; - state.head = null; - state.hold = 0; - state.bits = 0; - state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS); - state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS); - state.sane = 1; - state.back = -1; - return Z_OK$1; -}; -const inflateReset = (strm) => { - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR$1; - } - const state = strm.state; - state.wsize = 0; - state.whave = 0; - state.wnext = 0; - return inflateResetKeep(strm); -}; -const inflateReset2 = (strm, windowBits) => { - let wrap; - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR$1; - } - const state = strm.state; - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } else { - wrap = (windowBits >> 4) + 5; - if (windowBits < 48) { - windowBits &= 15; - } - } - if (windowBits && (windowBits < 8 || windowBits > 15)) { - return Z_STREAM_ERROR$1; - } - if (state.window !== null && state.wbits !== windowBits) { - state.window = null; - } - state.wrap = wrap; - state.wbits = windowBits; - return inflateReset(strm); -}; -const inflateInit2 = (strm, windowBits) => { - if (!strm) { - return Z_STREAM_ERROR$1; - } - const state = new InflateState(); - strm.state = state; - state.strm = strm; - state.window = null; - state.mode = HEAD; - const ret = inflateReset2(strm, windowBits); - if (ret !== Z_OK$1) { - strm.state = null; - } - return ret; -}; -const inflateInit = (strm) => { - return inflateInit2(strm, DEF_WBITS); -}; -let virgin = true; -let lenfix, distfix; -const fixedtables = (state) => { - if (virgin) { - lenfix = new Int32Array(512); - distfix = new Int32Array(32); - let sym = 0; - while (sym < 144) { - state.lens[sym++] = 8; - } - while (sym < 256) { - state.lens[sym++] = 9; - } - while (sym < 280) { - state.lens[sym++] = 7; - } - while (sym < 288) { - state.lens[sym++] = 8; - } - inftrees(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); - sym = 0; - while (sym < 32) { - state.lens[sym++] = 5; - } - inftrees(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); - virgin = false; - } - state.lencode = lenfix; - state.lenbits = 9; - state.distcode = distfix; - state.distbits = 5; -}; -const updatewindow = (strm, src, end, copy) => { - let dist; - const state = strm.state; - if (state.window === null) { - state.wsize = 1 << state.wbits; - state.wnext = 0; - state.whave = 0; - state.window = new Uint8Array(state.wsize); - } - if (copy >= state.wsize) { - state.window.set(src.subarray(end - state.wsize, end), 0); - state.wnext = 0; - state.whave = state.wsize; - } else { - dist = state.wsize - state.wnext; - if (dist > copy) { - dist = copy; - } - state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext); - copy -= dist; - if (copy) { - state.window.set(src.subarray(end - copy, end), 0); - state.wnext = copy; - state.whave = state.wsize; - } else { - state.wnext += dist; - if (state.wnext === state.wsize) { - state.wnext = 0; - } - if (state.whave < state.wsize) { - state.whave += dist; - } - } - } - return 0; -}; -const inflate$2 = (strm, flush) => { - let state; - let input, output; - let next; - let put; - let have, left; - let hold; - let bits; - let _in, _out; - let copy; - let from; - let from_source; - let here = 0; - let here_bits, here_op, here_val; - let last_bits, last_op, last_val; - let len; - let ret; - const hbuf = new Uint8Array(4); - let opts; - let n; - const order = ( - /* permutation of code lengths */ - new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]) - ); - if (inflateStateCheck(strm) || !strm.output || !strm.input && strm.avail_in !== 0) { - return Z_STREAM_ERROR$1; - } - state = strm.state; - if (state.mode === TYPE) { - state.mode = TYPEDO; - } - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - _in = have; - _out = left; - ret = Z_OK$1; - inf_leave: - for (; ; ) { - switch (state.mode) { - case HEAD: - if (state.wrap === 0) { - state.mode = TYPEDO; - break; - } - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.wrap & 2 && hold === 35615) { - if (state.wbits === 0) { - state.wbits = 15; - } - state.check = 0; - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc32_1(state.check, hbuf, 2, 0); - hold = 0; - bits = 0; - state.mode = FLAGS; - break; - } - if (state.head) { - state.head.done = false; - } - if (!(state.wrap & 1) || /* check if zlib header allowed */ - (((hold & 255) << 8) + (hold >> 8)) % 31) { - strm.msg = "incorrect header check"; - state.mode = BAD; - break; - } - if ((hold & 15) !== Z_DEFLATED) { - strm.msg = "unknown compression method"; - state.mode = BAD; - break; - } - hold >>>= 4; - bits -= 4; - len = (hold & 15) + 8; - if (state.wbits === 0) { - state.wbits = len; - } - if (len > 15 || len > state.wbits) { - strm.msg = "invalid window size"; - state.mode = BAD; - break; - } - state.dmax = 1 << state.wbits; - state.flags = 0; - strm.adler = state.check = 1; - state.mode = hold & 512 ? DICTID : TYPE; - hold = 0; - bits = 0; - break; - case FLAGS: - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.flags = hold; - if ((state.flags & 255) !== Z_DEFLATED) { - strm.msg = "unknown compression method"; - state.mode = BAD; - break; - } - if (state.flags & 57344) { - strm.msg = "unknown header flags set"; - state.mode = BAD; - break; - } - if (state.head) { - state.head.text = hold >> 8 & 1; - } - if (state.flags & 512 && state.wrap & 4) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc32_1(state.check, hbuf, 2, 0); - } - hold = 0; - bits = 0; - state.mode = TIME; - case TIME: - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.head) { - state.head.time = hold; - } - if (state.flags & 512 && state.wrap & 4) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - hbuf[2] = hold >>> 16 & 255; - hbuf[3] = hold >>> 24 & 255; - state.check = crc32_1(state.check, hbuf, 4, 0); - } - hold = 0; - bits = 0; - state.mode = OS; - case OS: - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.head) { - state.head.xflags = hold & 255; - state.head.os = hold >> 8; - } - if (state.flags & 512 && state.wrap & 4) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc32_1(state.check, hbuf, 2, 0); - } - hold = 0; - bits = 0; - state.mode = EXLEN; - case EXLEN: - if (state.flags & 1024) { - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.length = hold; - if (state.head) { - state.head.extra_len = hold; - } - if (state.flags & 512 && state.wrap & 4) { - hbuf[0] = hold & 255; - hbuf[1] = hold >>> 8 & 255; - state.check = crc32_1(state.check, hbuf, 2, 0); - } - hold = 0; - bits = 0; - } else if (state.head) { - state.head.extra = null; - } - state.mode = EXTRA; - case EXTRA: - if (state.flags & 1024) { - copy = state.length; - if (copy > have) { - copy = have; - } - if (copy) { - if (state.head) { - len = state.head.extra_len - state.length; - if (!state.head.extra) { - state.head.extra = new Uint8Array(state.head.extra_len); - } - state.head.extra.set( - input.subarray( - next, - // extra field is limited to 65536 bytes - // - no need for additional size check - next + copy - ), - /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ - len - ); - } - if (state.flags & 512 && state.wrap & 4) { - state.check = crc32_1(state.check, input, copy, next); - } - have -= copy; - next += copy; - state.length -= copy; - } - if (state.length) { - break inf_leave; - } - } - state.length = 0; - state.mode = NAME; - case NAME: - if (state.flags & 2048) { - if (have === 0) { - break inf_leave; - } - copy = 0; - do { - len = input[next + copy++]; - if (state.head && len && state.length < 65536) { - state.head.name += String.fromCharCode(len); - } - } while (len && copy < have); - if (state.flags & 512 && state.wrap & 4) { - state.check = crc32_1(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { - break inf_leave; - } - } else if (state.head) { - state.head.name = null; - } - state.length = 0; - state.mode = COMMENT; - case COMMENT: - if (state.flags & 4096) { - if (have === 0) { - break inf_leave; - } - copy = 0; - do { - len = input[next + copy++]; - if (state.head && len && state.length < 65536) { - state.head.comment += String.fromCharCode(len); - } - } while (len && copy < have); - if (state.flags & 512 && state.wrap & 4) { - state.check = crc32_1(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { - break inf_leave; - } - } else if (state.head) { - state.head.comment = null; - } - state.mode = HCRC; - case HCRC: - if (state.flags & 512) { - while (bits < 16) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.wrap & 4 && hold !== (state.check & 65535)) { - strm.msg = "header crc mismatch"; - state.mode = BAD; - break; - } - hold = 0; - bits = 0; - } - if (state.head) { - state.head.hcrc = state.flags >> 9 & 1; - state.head.done = true; - } - strm.adler = state.check = 0; - state.mode = TYPE; - break; - case DICTID: - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - strm.adler = state.check = zswap32(hold); - hold = 0; - bits = 0; - state.mode = DICT; - case DICT: - if (state.havedict === 0) { - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - return Z_NEED_DICT$1; - } - strm.adler = state.check = 1; - state.mode = TYPE; - case TYPE: - if (flush === Z_BLOCK || flush === Z_TREES) { - break inf_leave; - } - case TYPEDO: - if (state.last) { - hold >>>= bits & 7; - bits -= bits & 7; - state.mode = CHECK; - break; - } - while (bits < 3) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.last = hold & 1; - hold >>>= 1; - bits -= 1; - switch (hold & 3) { - case 0: - state.mode = STORED; - break; - case 1: - fixedtables(state); - state.mode = LEN_; - if (flush === Z_TREES) { - hold >>>= 2; - bits -= 2; - break inf_leave; - } - break; - case 2: - state.mode = TABLE; - break; - case 3: - strm.msg = "invalid block type"; - state.mode = BAD; - } - hold >>>= 2; - bits -= 2; - break; - case STORED: - hold >>>= bits & 7; - bits -= bits & 7; - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if ((hold & 65535) !== (hold >>> 16 ^ 65535)) { - strm.msg = "invalid stored block lengths"; - state.mode = BAD; - break; - } - state.length = hold & 65535; - hold = 0; - bits = 0; - state.mode = COPY_; - if (flush === Z_TREES) { - break inf_leave; - } - case COPY_: - state.mode = COPY; - case COPY: - copy = state.length; - if (copy) { - if (copy > have) { - copy = have; - } - if (copy > left) { - copy = left; - } - if (copy === 0) { - break inf_leave; - } - output.set(input.subarray(next, next + copy), put); - have -= copy; - next += copy; - left -= copy; - put += copy; - state.length -= copy; - break; - } - state.mode = TYPE; - break; - case TABLE: - while (bits < 14) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.nlen = (hold & 31) + 257; - hold >>>= 5; - bits -= 5; - state.ndist = (hold & 31) + 1; - hold >>>= 5; - bits -= 5; - state.ncode = (hold & 15) + 4; - hold >>>= 4; - bits -= 4; - if (state.nlen > 286 || state.ndist > 30) { - strm.msg = "too many length or distance symbols"; - state.mode = BAD; - break; - } - state.have = 0; - state.mode = LENLENS; - case LENLENS: - while (state.have < state.ncode) { - while (bits < 3) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.lens[order[state.have++]] = hold & 7; - hold >>>= 3; - bits -= 3; - } - while (state.have < 19) { - state.lens[order[state.have++]] = 0; - } - state.lencode = state.lendyn; - state.lenbits = 7; - opts = { bits: state.lenbits }; - ret = inftrees(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); - state.lenbits = opts.bits; - if (ret) { - strm.msg = "invalid code lengths set"; - state.mode = BAD; - break; - } - state.have = 0; - state.mode = CODELENS; - case CODELENS: - while (state.have < state.nlen + state.ndist) { - for (; ; ) { - here = state.lencode[hold & (1 << state.lenbits) - 1]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (here_val < 16) { - hold >>>= here_bits; - bits -= here_bits; - state.lens[state.have++] = here_val; - } else { - if (here_val === 16) { - n = here_bits + 2; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= here_bits; - bits -= here_bits; - if (state.have === 0) { - strm.msg = "invalid bit length repeat"; - state.mode = BAD; - break; - } - len = state.lens[state.have - 1]; - copy = 3 + (hold & 3); - hold >>>= 2; - bits -= 2; - } else if (here_val === 17) { - n = here_bits + 3; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= here_bits; - bits -= here_bits; - len = 0; - copy = 3 + (hold & 7); - hold >>>= 3; - bits -= 3; - } else { - n = here_bits + 7; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= here_bits; - bits -= here_bits; - len = 0; - copy = 11 + (hold & 127); - hold >>>= 7; - bits -= 7; - } - if (state.have + copy > state.nlen + state.ndist) { - strm.msg = "invalid bit length repeat"; - state.mode = BAD; - break; - } - while (copy--) { - state.lens[state.have++] = len; - } - } - } - if (state.mode === BAD) { - break; - } - if (state.lens[256] === 0) { - strm.msg = "invalid code -- missing end-of-block"; - state.mode = BAD; - break; - } - state.lenbits = 9; - opts = { bits: state.lenbits }; - ret = inftrees(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); - state.lenbits = opts.bits; - if (ret) { - strm.msg = "invalid literal/lengths set"; - state.mode = BAD; - break; - } - state.distbits = 6; - state.distcode = state.distdyn; - opts = { bits: state.distbits }; - ret = inftrees(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); - state.distbits = opts.bits; - if (ret) { - strm.msg = "invalid distances set"; - state.mode = BAD; - break; - } - state.mode = LEN_; - if (flush === Z_TREES) { - break inf_leave; - } - case LEN_: - state.mode = LEN; - case LEN: - if (have >= 6 && left >= 258) { - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - inffast(strm, _out); - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - if (state.mode === TYPE) { - state.back = -1; - } - break; - } - state.back = 0; - for (; ; ) { - here = state.lencode[hold & (1 << state.lenbits) - 1]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (here_op && (here_op & 240) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (; ; ) { - here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (last_bits + here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= last_bits; - bits -= last_bits; - state.back += last_bits; - } - hold >>>= here_bits; - bits -= here_bits; - state.back += here_bits; - state.length = here_val; - if (here_op === 0) { - state.mode = LIT; - break; - } - if (here_op & 32) { - state.back = -1; - state.mode = TYPE; - break; - } - if (here_op & 64) { - strm.msg = "invalid literal/length code"; - state.mode = BAD; - break; - } - state.extra = here_op & 15; - state.mode = LENEXT; - case LENEXT: - if (state.extra) { - n = state.extra; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.length += hold & (1 << state.extra) - 1; - hold >>>= state.extra; - bits -= state.extra; - state.back += state.extra; - } - state.was = state.length; - state.mode = DIST; - case DIST: - for (; ; ) { - here = state.distcode[hold & (1 << state.distbits) - 1]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if ((here_op & 240) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (; ; ) { - here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]; - here_bits = here >>> 24; - here_op = here >>> 16 & 255; - here_val = here & 65535; - if (last_bits + here_bits <= bits) { - break; - } - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - hold >>>= last_bits; - bits -= last_bits; - state.back += last_bits; - } - hold >>>= here_bits; - bits -= here_bits; - state.back += here_bits; - if (here_op & 64) { - strm.msg = "invalid distance code"; - state.mode = BAD; - break; - } - state.offset = here_val; - state.extra = here_op & 15; - state.mode = DISTEXT; - case DISTEXT: - if (state.extra) { - n = state.extra; - while (bits < n) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - state.offset += hold & (1 << state.extra) - 1; - hold >>>= state.extra; - bits -= state.extra; - state.back += state.extra; - } - if (state.offset > state.dmax) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break; - } - state.mode = MATCH; - case MATCH: - if (left === 0) { - break inf_leave; - } - copy = _out - left; - if (state.offset > copy) { - copy = state.offset - copy; - if (copy > state.whave) { - if (state.sane) { - strm.msg = "invalid distance too far back"; - state.mode = BAD; - break; - } - } - if (copy > state.wnext) { - copy -= state.wnext; - from = state.wsize - copy; - } else { - from = state.wnext - copy; - } - if (copy > state.length) { - copy = state.length; - } - from_source = state.window; - } else { - from_source = output; - from = put - state.offset; - copy = state.length; - } - if (copy > left) { - copy = left; - } - left -= copy; - state.length -= copy; - do { - output[put++] = from_source[from++]; - } while (--copy); - if (state.length === 0) { - state.mode = LEN; - } - break; - case LIT: - if (left === 0) { - break inf_leave; - } - output[put++] = state.length; - left--; - state.mode = LEN; - break; - case CHECK: - if (state.wrap) { - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold |= input[next++] << bits; - bits += 8; - } - _out -= left; - strm.total_out += _out; - state.total += _out; - if (state.wrap & 4 && _out) { - strm.adler = state.check = /*UPDATE_CHECK(state.check, put - _out, _out);*/ - state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out); - } - _out = left; - if (state.wrap & 4 && (state.flags ? hold : zswap32(hold)) !== state.check) { - strm.msg = "incorrect data check"; - state.mode = BAD; - break; - } - hold = 0; - bits = 0; - } - state.mode = LENGTH; - case LENGTH: - if (state.wrap && state.flags) { - while (bits < 32) { - if (have === 0) { - break inf_leave; - } - have--; - hold += input[next++] << bits; - bits += 8; - } - if (state.wrap & 4 && hold !== (state.total & 4294967295)) { - strm.msg = "incorrect length check"; - state.mode = BAD; - break; - } - hold = 0; - bits = 0; - } - state.mode = DONE; - case DONE: - ret = Z_STREAM_END$1; - break inf_leave; - case BAD: - ret = Z_DATA_ERROR$1; - break inf_leave; - case MEM: - return Z_MEM_ERROR$1; - case SYNC: - default: - return Z_STREAM_ERROR$1; - } - } - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH$1)) { - if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) - ; - } - _in -= strm.avail_in; - _out -= strm.avail_out; - strm.total_in += _in; - strm.total_out += _out; - state.total += _out; - if (state.wrap & 4 && _out) { - strm.adler = state.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/ - state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out); - } - strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); - if ((_in === 0 && _out === 0 || flush === Z_FINISH$1) && ret === Z_OK$1) { - ret = Z_BUF_ERROR; - } - return ret; -}; -const inflateEnd = (strm) => { - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR$1; - } - let state = strm.state; - if (state.window) { - state.window = null; - } - strm.state = null; - return Z_OK$1; -}; -const inflateGetHeader = (strm, head) => { - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR$1; - } - const state = strm.state; - if ((state.wrap & 2) === 0) { - return Z_STREAM_ERROR$1; - } - state.head = head; - head.done = false; - return Z_OK$1; -}; -const inflateSetDictionary = (strm, dictionary) => { - const dictLength = dictionary.length; - let state; - let dictid; - let ret; - if (inflateStateCheck(strm)) { - return Z_STREAM_ERROR$1; - } - state = strm.state; - if (state.wrap !== 0 && state.mode !== DICT) { - return Z_STREAM_ERROR$1; - } - if (state.mode === DICT) { - dictid = 1; - dictid = adler32_1(dictid, dictionary, dictLength, 0); - if (dictid !== state.check) { - return Z_DATA_ERROR$1; - } - } - ret = updatewindow(strm, dictionary, dictLength, dictLength); - if (ret) { - state.mode = MEM; - return Z_MEM_ERROR$1; - } - state.havedict = 1; - return Z_OK$1; -}; -var inflateReset_1 = inflateReset; -var inflateReset2_1 = inflateReset2; -var inflateResetKeep_1 = inflateResetKeep; -var inflateInit_1 = inflateInit; -var inflateInit2_1 = inflateInit2; -var inflate_2$1 = inflate$2; -var inflateEnd_1 = inflateEnd; -var inflateGetHeader_1 = inflateGetHeader; -var inflateSetDictionary_1 = inflateSetDictionary; -var inflateInfo = "pako inflate (from Nodeca project)"; -var inflate_1$2 = { - inflateReset: inflateReset_1, - inflateReset2: inflateReset2_1, - inflateResetKeep: inflateResetKeep_1, - inflateInit: inflateInit_1, - inflateInit2: inflateInit2_1, - inflate: inflate_2$1, - inflateEnd: inflateEnd_1, - inflateGetHeader: inflateGetHeader_1, - inflateSetDictionary: inflateSetDictionary_1, - inflateInfo -}; -function GZheader() { - this.text = 0; - this.time = 0; - this.xflags = 0; - this.os = 0; - this.extra = null; - this.extra_len = 0; - this.name = ""; - this.comment = ""; - this.hcrc = 0; - this.done = false; -} -var gzheader = GZheader; -const toString$2 = Object.prototype.toString; -const { - Z_NO_FLUSH, - Z_FINISH, - Z_OK, - Z_STREAM_END, - Z_NEED_DICT, - Z_STREAM_ERROR, - Z_DATA_ERROR, - Z_MEM_ERROR -} = constants$2; -function Inflate$1(options) { - this.options = common.assign({ - chunkSize: 1024 * 64, - windowBits: 15, - to: "" - }, options || {}); - const opt = this.options; - if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) { - opt.windowBits = -opt.windowBits; - if (opt.windowBits === 0) { - opt.windowBits = -15; - } - } - if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) { - opt.windowBits += 32; - } - if (opt.windowBits > 15 && opt.windowBits < 48) { - if ((opt.windowBits & 15) === 0) { - opt.windowBits |= 15; - } - } - this.err = 0; - this.msg = ""; - this.ended = false; - this.chunks = []; - this.strm = new zstream(); - this.strm.avail_out = 0; - let status = inflate_1$2.inflateInit2( - this.strm, - opt.windowBits - ); - if (status !== Z_OK) { - throw new Error(messages[status]); - } - this.header = new gzheader(); - inflate_1$2.inflateGetHeader(this.strm, this.header); - if (opt.dictionary) { - if (typeof opt.dictionary === "string") { - opt.dictionary = strings.string2buf(opt.dictionary); - } else if (toString$2.call(opt.dictionary) === "[object ArrayBuffer]") { - opt.dictionary = new Uint8Array(opt.dictionary); - } - if (opt.raw) { - status = inflate_1$2.inflateSetDictionary(this.strm, opt.dictionary); - if (status !== Z_OK) { - throw new Error(messages[status]); - } - } - } -} -Inflate$1.prototype.push = function(data, flush_mode) { - const strm = this.strm; - const chunkSize = this.options.chunkSize; - const dictionary = this.options.dictionary; - let status, _flush_mode, last_avail_out; - if (this.ended) - return false; - if (flush_mode === ~~flush_mode) - _flush_mode = flush_mode; - else - _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH; - if (toString$2.call(data) === "[object ArrayBuffer]") { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - strm.next_in = 0; - strm.avail_in = strm.input.length; - for (; ; ) { - if (strm.avail_out === 0) { - strm.output = new Uint8Array(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - status = inflate_1$2.inflate(strm, _flush_mode); - if (status === Z_NEED_DICT && dictionary) { - status = inflate_1$2.inflateSetDictionary(strm, dictionary); - if (status === Z_OK) { - status = inflate_1$2.inflate(strm, _flush_mode); - } else if (status === Z_DATA_ERROR) { - status = Z_NEED_DICT; - } - } - while (strm.avail_in > 0 && status === Z_STREAM_END && strm.state.wrap > 0 && data[strm.next_in] !== 0) { - inflate_1$2.inflateReset(strm); - status = inflate_1$2.inflate(strm, _flush_mode); - } - switch (status) { - case Z_STREAM_ERROR: - case Z_DATA_ERROR: - case Z_NEED_DICT: - case Z_MEM_ERROR: - this.onEnd(status); - this.ended = true; - return false; - } - last_avail_out = strm.avail_out; - if (strm.next_out) { - if (strm.avail_out === 0 || status === Z_STREAM_END) { - if (this.options.to === "string") { - let next_out_utf8 = strings.utf8border(strm.output, strm.next_out); - let tail = strm.next_out - next_out_utf8; - let utf8str = strings.buf2string(strm.output, next_out_utf8); - strm.next_out = tail; - strm.avail_out = chunkSize - tail; - if (tail) - strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0); - this.onData(utf8str); - } else { - this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out)); - } - } - } - if (status === Z_OK && last_avail_out === 0) - continue; - if (status === Z_STREAM_END) { - status = inflate_1$2.inflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return true; - } - if (strm.avail_in === 0) - break; - } - return true; -}; -Inflate$1.prototype.onData = function(chunk) { - this.chunks.push(chunk); -}; -Inflate$1.prototype.onEnd = function(status) { - if (status === Z_OK) { - if (this.options.to === "string") { - this.result = this.chunks.join(""); - } else { - this.result = common.flattenChunks(this.chunks); - } - } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; -}; -function inflate$1(input, options) { - const inflator = new Inflate$1(options); - inflator.push(input); - if (inflator.err) - throw inflator.msg || messages[inflator.err]; - return inflator.result; -} -function inflateRaw$1(input, options) { - options = options || {}; - options.raw = true; - return inflate$1(input, options); -} -var Inflate_1$1 = Inflate$1; -var inflate_2 = inflate$1; -var inflateRaw_1$1 = inflateRaw$1; -var ungzip$1 = inflate$1; -var constants = constants$2; -var inflate_1$1 = { - Inflate: Inflate_1$1, - inflate: inflate_2, - inflateRaw: inflateRaw_1$1, - ungzip: ungzip$1, - constants -}; -const { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1; -var inflateRaw_1 = inflateRaw; -function unzip(input) { - return inflateRaw_1(input.subarray(2)); -} -class AbortError extends Error { - constructor(message) { - super(message); - this.code = "ERR_ABORTED"; - } -} -function groupBlocks(blocks) { - blocks.sort((b0, b1) => Number(b0.offset) - Number(b1.offset)); - const blockGroups = []; - let lastBlock; - let lastBlockEnd; - for (let i = 0; i < blocks.length; i += 1) { - if (lastBlock && lastBlockEnd && Number(blocks[i].offset) - lastBlockEnd <= 2e3) { - lastBlock.length = BigInt(Number(lastBlock.length) + Number(blocks[i].length) - lastBlockEnd + Number(blocks[i].offset)); - lastBlock.blocks.push(blocks[i]); - } else { - blockGroups.push(lastBlock = { - blocks: [blocks[i]], - length: blocks[i].length, - offset: blocks[i].offset - }); - } - lastBlockEnd = Number(lastBlock.offset) + Number(lastBlock.length); - } - return blockGroups; -} -function checkAbortSignal(signal) { - if (!signal) { - return; - } - if (signal.aborted) { - if (typeof DOMException !== "undefined") { - throw new DOMException("aborted", "AbortError"); - } else { - const e = new AbortError("aborted"); - e.code = "ERR_ABORTED"; - throw e; - } - } -} -const BIG_WIG_TYPE_GRAPH = 1; -const BIG_WIG_TYPE_VSTEP = 2; -const BIG_WIG_TYPE_FSTEP = 3; -function coordFilter(s1, e1, s2, e2) { - return s1 < e2 && e1 >= s2; -} -function getParsers$1(isBigEndian) { - const le = isBigEndian ? "big" : "little"; - const summaryParser = new Parser().endianess(le).uint32("chromId").uint32("start").uint32("end").uint32("validCnt").floatle("minScore").floatle("maxScore").floatle("sumData").floatle("sumSqData").saveOffset("offset"); - const leafParser = new Parser().endianess(le).uint8("isLeaf").skip(1).uint16("cnt").choice({ - tag: "isLeaf", - choices: { - 1: new Parser().endianess(le).array("blocksToFetch", { - length: "cnt", - type: new Parser().endianess(le).uint32("startChrom").uint32("startBase").uint32("endChrom").uint32("endBase").uint64("blockOffset").uint64("blockSize").saveOffset("offset") - }), - 0: new Parser().array("recurOffsets", { - length: "cnt", - type: new Parser().endianess(le).uint32("startChrom").uint32("startBase").uint32("endChrom").uint32("endBase").uint64("blockOffset").saveOffset("offset") - }) - } - }); - const bigBedParser = new Parser().endianess(le).uint32("chromId").int32("start").int32("end").string("rest", { - zeroTerminated: true - }).saveOffset("offset"); - const bigWigParser = new Parser().endianess(le).skip(4).int32("blockStart").skip(4).uint32("itemStep").uint32("itemSpan").uint8("blockType").skip(1).uint16("itemCount").choice({ - tag: "blockType", - choices: { - [BIG_WIG_TYPE_FSTEP]: new Parser().array("items", { - length: "itemCount", - type: new Parser().floatle("score") - }), - [BIG_WIG_TYPE_VSTEP]: new Parser().array("items", { - length: "itemCount", - type: new Parser().endianess(le).int32("start").floatle("score") - }), - [BIG_WIG_TYPE_GRAPH]: new Parser().array("items", { - length: "itemCount", - type: new Parser().endianess(le).int32("start").int32("end").floatle("score") - }) - } - }); - return { - bigWigParser, - bigBedParser, - summaryParser, - leafParser - }; -} -class BlockView { - constructor(bbi, refsByName, cirTreeOffset, isBigEndian, isCompressed, blockType) { - this.bbi = bbi; - this.refsByName = refsByName; - this.cirTreeOffset = cirTreeOffset; - this.isBigEndian = isBigEndian; - this.isCompressed = isCompressed; - this.blockType = blockType; - this.featureCache = new _default({ - cache: new QuickLRU({ maxSize: 1e3 }), - fill: async (requestData, signal) => { - const len = Number(requestData.length); - const off = Number(requestData.offset); - const { buffer } = await this.bbi.read(Buffer2.alloc(len), 0, len, off, { - signal - }); - return buffer; - } - }); - if (!(cirTreeOffset >= 0)) { - throw new Error("invalid cirTreeOffset!"); - } - const parsers = getParsers$1(isBigEndian); - this.leafParser = parsers.leafParser; - this.bigBedParser = parsers.bigBedParser; - } - async readWigData(chrName, start, end, observer, opts) { - try { - const { refsByName, bbi, cirTreeOffset, isBigEndian } = this; - const chrId = refsByName[chrName]; - if (chrId === void 0) { - observer.complete(); - } - const request = { chrId, start, end }; - if (!this.cirTreePromise) { - this.cirTreePromise = bbi.read(Buffer2.alloc(48), 0, 48, Number(cirTreeOffset), opts); - } - const { buffer } = await this.cirTreePromise; - const cirBlockSize = isBigEndian ? buffer.readUInt32BE(4) : buffer.readUInt32LE(4); - let blocksToFetch = []; - let outstanding = 0; - const cirFobRecur2 = (cirBlockData, offset, level) => { - try { - const data = cirBlockData.subarray(offset); - const p = this.leafParser.parse(data); - if (p.blocksToFetch) { - blocksToFetch = blocksToFetch.concat(p.blocksToFetch.filter(filterFeats).map((l) => ({ - offset: l.blockOffset, - length: l.blockSize - }))); - } - if (p.recurOffsets) { - const recurOffsets = p.recurOffsets.filter(filterFeats).map((l) => Number(l.blockOffset)); - if (recurOffsets.length > 0) { - cirFobRecur(recurOffsets, level + 1); - } - } - } catch (e) { - observer.error(e); - } - }; - const filterFeats = (b) => { - const { startChrom, startBase, endChrom, endBase } = b; - return (startChrom < chrId || startChrom === chrId && startBase <= end) && (endChrom > chrId || endChrom === chrId && endBase >= start); - }; - const cirFobStartFetch = async (off, fr, level) => { - try { - const length = fr.max() - fr.min(); - const offset = fr.min(); - const resultBuffer = await this.featureCache.get(`${length}_${offset}`, { length, offset }, opts.signal); - for (let i = 0; i < off.length; i += 1) { - if (fr.contains(off[i])) { - cirFobRecur2(resultBuffer, off[i] - offset, level); - outstanding -= 1; - if (outstanding === 0) { - this.readFeatures(observer, blocksToFetch, { ...opts, request }); - } - } - } - } catch (e) { - observer.error(e); - } - }; - const cirFobRecur = (offset, level) => { - try { - outstanding += offset.length; - const maxCirBlockSpan = 4 + Number(cirBlockSize) * 32; - let spans = new Range(offset[0], offset[0] + maxCirBlockSpan); - for (let i = 1; i < offset.length; i += 1) { - const blockSpan = new Range(offset[i], offset[i] + maxCirBlockSpan); - spans = spans.union(blockSpan); - } - spans.getRanges().map((fr) => cirFobStartFetch(offset, fr, level)); - } catch (e) { - observer.error(e); - } - }; - return cirFobRecur([Number(cirTreeOffset) + 48], 1); - } catch (e) { - observer.error(e); - } - } - parseSummaryBlock(buffer, startOffset, request) { - const features = []; - let offset = startOffset; - const dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length); - while (offset < buffer.byteLength) { - const chromId = dataView.getUint32(offset, true); - offset += 4; - const start = dataView.getUint32(offset, true); - offset += 4; - const end = dataView.getUint32(offset, true); - offset += 4; - const validCnt = dataView.getUint32(offset, true); - offset += 4; - const minScore = dataView.getFloat32(offset, true); - offset += 4; - const maxScore = dataView.getFloat32(offset, true); - offset += 4; - const sumData = dataView.getFloat32(offset, true); - offset += 4; - offset += 4; - if (request ? chromId === request.chrId && coordFilter(start, end, request.start, request.end) : true) { - features.push({ - start, - end, - maxScore, - minScore, - summary: true, - score: sumData / (validCnt || 1) - }); - } - } - return features; - } - parseBigBedBlock(data, startOffset, offset, request) { - const items = []; - let currOffset = startOffset; - while (currOffset < data.byteLength) { - const res = this.bigBedParser.parse(data.subarray(currOffset)); - items.push({ ...res, uniqueId: `bb-${offset + currOffset}` }); - currOffset += res.offset; - } - return request ? items.filter((f) => coordFilter(f.start, f.end, request.start, request.end)) : items; - } - parseBigWigBlock(buffer, startOffset, request) { - const b = buffer.subarray(startOffset); - const dataView = new DataView(b.buffer, b.byteOffset, b.length); - let offset = 0; - offset += 4; - const blockStart = dataView.getInt32(offset, true); - offset += 8; - const itemStep = dataView.getUint32(offset, true); - offset += 4; - const itemSpan = dataView.getUint32(offset, true); - offset += 4; - const blockType = dataView.getUint8(offset); - offset += 2; - const itemCount = dataView.getUint16(offset, true); - offset += 2; - const items = new Array(itemCount); - switch (blockType) { - case 1: - for (let i = 0; i < itemCount; i++) { - const start = dataView.getInt32(offset, true); - offset += 4; - const end = dataView.getInt32(offset, true); - offset += 4; - const score = dataView.getFloat32(offset, true); - offset += 4; - items[i] = { start, end, score }; - } - break; - case 2: - for (let i = 0; i < itemCount; i++) { - const start = dataView.getInt32(offset, true); - offset += 4; - const score = dataView.getFloat32(offset, true); - offset += 4; - items[i] = { score, start, end: start + itemSpan }; - } - break; - case 3: - for (let i = 0; i < itemCount; i++) { - const score = dataView.getFloat32(offset, true); - offset += 4; - const start = blockStart + i * itemStep; - items[i] = { score, start, end: start + itemSpan }; - } - break; - } - return request ? items.filter((f) => coordFilter(f.start, f.end, request.start, request.end)) : items; - } - async readFeatures(observer, blocks, opts = {}) { - try { - const { blockType, isCompressed } = this; - const { signal, request } = opts; - const blockGroupsToFetch = groupBlocks(blocks); - checkAbortSignal(signal); - await Promise.all(blockGroupsToFetch.map(async (blockGroup) => { - checkAbortSignal(signal); - const { length, offset } = blockGroup; - const data = await this.featureCache.get(`${length}_${offset}`, blockGroup, signal); - blockGroup.blocks.forEach((block) => { - checkAbortSignal(signal); - let blockOffset = Number(block.offset) - Number(blockGroup.offset); - let resultData = data; - if (isCompressed) { - resultData = unzip(data.subarray(blockOffset)); - blockOffset = 0; - } - checkAbortSignal(signal); - switch (blockType) { - case "summary": - observer.next(this.parseSummaryBlock(resultData, blockOffset, request)); - break; - case "bigwig": - observer.next(this.parseBigWigBlock(resultData, blockOffset, request)); - break; - case "bigbed": - observer.next(this.parseBigBedBlock(resultData, blockOffset, Number(block.offset) * (1 << 8), request)); - break; - default: - console.warn(`Don't know what to do with ${blockType}`); - } - }); - })); - observer.complete(); - } catch (e) { - observer.error(e); - } - } -} -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) - if (Object.prototype.hasOwnProperty.call(b2, p)) - d2[p] = b2[p]; - }; - return extendStatics(d, b); -}; -function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} -function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m2 = s && o[s], i = 0; - if (m2) - return m2.call(o); - if (o && typeof o.length === "number") - return { - next: function() { - if (o && i >= o.length) - o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} -function __read(o, n) { - var m2 = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m2) - return o; - var i = m2.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) - ar.push(r.value); - } catch (error) { - e = { error }; - } finally { - try { - if (r && !r.done && (m2 = i["return"])) - m2.call(i); - } finally { - if (e) - throw e.error; - } - } - return ar; -} -function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) - for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) - ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -} -typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}; -function isFunction(value) { - return typeof value === "function"; -} -function createErrorClass(createImpl) { - var _super = function(instance) { - Error.call(instance); - instance.stack = new Error().stack; - }; - var ctorFunc = createImpl(_super); - ctorFunc.prototype = Object.create(Error.prototype); - ctorFunc.prototype.constructor = ctorFunc; - return ctorFunc; -} -var UnsubscriptionError = createErrorClass(function(_super) { - return function UnsubscriptionErrorImpl(errors) { - _super(this); - this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err2, i) { - return i + 1 + ") " + err2.toString(); - }).join("\n ") : ""; - this.name = "UnsubscriptionError"; - this.errors = errors; - }; -}); -function arrRemove(arr, item) { - if (arr) { - var index = arr.indexOf(item); - 0 <= index && arr.splice(index, 1); - } -} -var Subscription = function() { - function Subscription2(initialTeardown) { - this.initialTeardown = initialTeardown; - this.closed = false; - this._parentage = null; - this._finalizers = null; - } - Subscription2.prototype.unsubscribe = function() { - var e_1, _a, e_2, _b; - var errors; - if (!this.closed) { - this.closed = true; - var _parentage = this._parentage; - if (_parentage) { - this._parentage = null; - if (Array.isArray(_parentage)) { - try { - for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) { - var parent_1 = _parentage_1_1.value; - parent_1.remove(this); - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) - _a.call(_parentage_1); - } finally { - if (e_1) - throw e_1.error; - } - } - } else { - _parentage.remove(this); - } - } - var initialFinalizer = this.initialTeardown; - if (isFunction(initialFinalizer)) { - try { - initialFinalizer(); - } catch (e) { - errors = e instanceof UnsubscriptionError ? e.errors : [e]; - } - } - var _finalizers = this._finalizers; - if (_finalizers) { - this._finalizers = null; - try { - for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) { - var finalizer = _finalizers_1_1.value; - try { - execFinalizer(finalizer); - } catch (err2) { - errors = errors !== null && errors !== void 0 ? errors : []; - if (err2 instanceof UnsubscriptionError) { - errors = __spreadArray(__spreadArray([], __read(errors)), __read(err2.errors)); - } else { - errors.push(err2); - } - } - } - } catch (e_2_1) { - e_2 = { error: e_2_1 }; - } finally { - try { - if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) - _b.call(_finalizers_1); - } finally { - if (e_2) - throw e_2.error; - } - } - } - if (errors) { - throw new UnsubscriptionError(errors); - } - } - }; - Subscription2.prototype.add = function(teardown) { - var _a; - if (teardown && teardown !== this) { - if (this.closed) { - execFinalizer(teardown); - } else { - if (teardown instanceof Subscription2) { - if (teardown.closed || teardown._hasParent(this)) { - return; - } - teardown._addParent(this); - } - (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown); - } - } - }; - Subscription2.prototype._hasParent = function(parent) { - var _parentage = this._parentage; - return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent); - }; - Subscription2.prototype._addParent = function(parent) { - var _parentage = this._parentage; - this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent; - }; - Subscription2.prototype._removeParent = function(parent) { - var _parentage = this._parentage; - if (_parentage === parent) { - this._parentage = null; - } else if (Array.isArray(_parentage)) { - arrRemove(_parentage, parent); - } - }; - Subscription2.prototype.remove = function(teardown) { - var _finalizers = this._finalizers; - _finalizers && arrRemove(_finalizers, teardown); - if (teardown instanceof Subscription2) { - teardown._removeParent(this); - } - }; - Subscription2.EMPTY = function() { - var empty = new Subscription2(); - empty.closed = true; - return empty; - }(); - return Subscription2; -}(); -Subscription.EMPTY; -function isSubscription(value) { - return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe); -} -function execFinalizer(finalizer) { - if (isFunction(finalizer)) { - finalizer(); - } else { - finalizer.unsubscribe(); - } -} -var config$2 = { - onUnhandledError: null, - onStoppedNotification: null, - Promise: void 0, - useDeprecatedSynchronousErrorHandling: false, - useDeprecatedNextContext: false -}; -var timeoutProvider = { - setTimeout: function(handler, timeout) { - var args = []; - for (var _i = 2; _i < arguments.length; _i++) { - args[_i - 2] = arguments[_i]; - } - var delegate = timeoutProvider.delegate; - if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) { - return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args))); - } - return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args))); - }, - clearTimeout: function(handle) { - var delegate = timeoutProvider.delegate; - return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle); - }, - delegate: void 0 -}; -function reportUnhandledError(err2) { - timeoutProvider.setTimeout(function() { - { - throw err2; - } - }); -} -function noop() { -} -function errorContext(cb) { - { - cb(); - } -} -var Subscriber = function(_super) { - __extends(Subscriber2, _super); - function Subscriber2(destination) { - var _this = _super.call(this) || this; - _this.isStopped = false; - if (destination) { - _this.destination = destination; - if (isSubscription(destination)) { - destination.add(_this); - } - } else { - _this.destination = EMPTY_OBSERVER; - } - return _this; - } - Subscriber2.create = function(next, error, complete) { - return new SafeSubscriber(next, error, complete); - }; - Subscriber2.prototype.next = function(value) { - if (this.isStopped) - ; - else { - this._next(value); - } - }; - Subscriber2.prototype.error = function(err2) { - if (this.isStopped) - ; - else { - this.isStopped = true; - this._error(err2); - } - }; - Subscriber2.prototype.complete = function() { - if (this.isStopped) - ; - else { - this.isStopped = true; - this._complete(); - } - }; - Subscriber2.prototype.unsubscribe = function() { - if (!this.closed) { - this.isStopped = true; - _super.prototype.unsubscribe.call(this); - this.destination = null; - } - }; - Subscriber2.prototype._next = function(value) { - this.destination.next(value); - }; - Subscriber2.prototype._error = function(err2) { - try { - this.destination.error(err2); - } finally { - this.unsubscribe(); - } - }; - Subscriber2.prototype._complete = function() { - try { - this.destination.complete(); - } finally { - this.unsubscribe(); - } - }; - return Subscriber2; -}(Subscription); -var _bind = Function.prototype.bind; -function bind(fn, thisArg) { - return _bind.call(fn, thisArg); -} -var ConsumerObserver = function() { - function ConsumerObserver2(partialObserver) { - this.partialObserver = partialObserver; - } - ConsumerObserver2.prototype.next = function(value) { - var partialObserver = this.partialObserver; - if (partialObserver.next) { - try { - partialObserver.next(value); - } catch (error) { - handleUnhandledError(error); - } - } - }; - ConsumerObserver2.prototype.error = function(err2) { - var partialObserver = this.partialObserver; - if (partialObserver.error) { - try { - partialObserver.error(err2); - } catch (error) { - handleUnhandledError(error); - } - } else { - handleUnhandledError(err2); - } - }; - ConsumerObserver2.prototype.complete = function() { - var partialObserver = this.partialObserver; - if (partialObserver.complete) { - try { - partialObserver.complete(); - } catch (error) { - handleUnhandledError(error); - } - } - }; - return ConsumerObserver2; -}(); -var SafeSubscriber = function(_super) { - __extends(SafeSubscriber2, _super); - function SafeSubscriber2(observerOrNext, error, complete) { - var _this = _super.call(this) || this; - var partialObserver; - if (isFunction(observerOrNext) || !observerOrNext) { - partialObserver = { - next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0, - error: error !== null && error !== void 0 ? error : void 0, - complete: complete !== null && complete !== void 0 ? complete : void 0 - }; - } else { - var context_1; - if (_this && config$2.useDeprecatedNextContext) { - context_1 = Object.create(observerOrNext); - context_1.unsubscribe = function() { - return _this.unsubscribe(); - }; - partialObserver = { - next: observerOrNext.next && bind(observerOrNext.next, context_1), - error: observerOrNext.error && bind(observerOrNext.error, context_1), - complete: observerOrNext.complete && bind(observerOrNext.complete, context_1) - }; - } else { - partialObserver = observerOrNext; - } - } - _this.destination = new ConsumerObserver(partialObserver); - return _this; - } - return SafeSubscriber2; -}(Subscriber); -function handleUnhandledError(error) { - { - reportUnhandledError(error); - } -} -function defaultErrorHandler(err2) { - throw err2; -} -var EMPTY_OBSERVER = { - closed: true, - next: noop, - error: defaultErrorHandler, - complete: noop -}; -var observable = function() { - return typeof Symbol === "function" && Symbol.observable || "@@observable"; -}(); -function identity(x) { - return x; -} -function pipeFromArray(fns) { - if (fns.length === 0) { - return identity; - } - if (fns.length === 1) { - return fns[0]; - } - return function piped(input) { - return fns.reduce(function(prev, fn) { - return fn(prev); - }, input); - }; -} -var Observable = function() { - function Observable2(subscribe2) { - if (subscribe2) { - this._subscribe = subscribe2; - } - } - Observable2.prototype.lift = function(operator) { - var observable2 = new Observable2(); - observable2.source = this; - observable2.operator = operator; - return observable2; - }; - Observable2.prototype.subscribe = function(observerOrNext, error, complete) { - var _this = this; - var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete); - errorContext(function() { - var _a = _this, operator = _a.operator, source = _a.source; - subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber)); - }); - return subscriber; - }; - Observable2.prototype._trySubscribe = function(sink) { - try { - return this._subscribe(sink); - } catch (err2) { - sink.error(err2); - } - }; - Observable2.prototype.forEach = function(next, promiseCtor) { - var _this = this; - promiseCtor = getPromiseCtor(promiseCtor); - return new promiseCtor(function(resolve, reject) { - var subscriber = new SafeSubscriber({ - next: function(value) { - try { - next(value); - } catch (err2) { - reject(err2); - subscriber.unsubscribe(); - } - }, - error: reject, - complete: resolve - }); - _this.subscribe(subscriber); - }); - }; - Observable2.prototype._subscribe = function(subscriber) { - var _a; - return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber); - }; - Observable2.prototype[observable] = function() { - return this; - }; - Observable2.prototype.pipe = function() { - var operations = []; - for (var _i = 0; _i < arguments.length; _i++) { - operations[_i] = arguments[_i]; - } - return pipeFromArray(operations)(this); - }; - Observable2.prototype.toPromise = function(promiseCtor) { - var _this = this; - promiseCtor = getPromiseCtor(promiseCtor); - return new promiseCtor(function(resolve, reject) { - var value; - _this.subscribe(function(x) { - return value = x; - }, function(err2) { - return reject(err2); - }, function() { - return resolve(value); - }); - }); - }; - Observable2.create = function(subscribe2) { - return new Observable2(subscribe2); - }; - return Observable2; -}(); -function getPromiseCtor(promiseCtor) { - var _a; - return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config$2.Promise) !== null && _a !== void 0 ? _a : Promise; -} -function isObserver(value) { - return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete); -} -function isSubscriber(value) { - return value && value instanceof Subscriber || isObserver(value) && isSubscription(value); -} -function hasLift(source) { - return isFunction(source === null || source === void 0 ? void 0 : source.lift); -} -function operate(init2) { - return function(source) { - if (hasLift(source)) { - return source.lift(function(liftedSource) { - try { - return init2(liftedSource, this); - } catch (err2) { - this.error(err2); - } - }); - } - throw new TypeError("Unable to lift unknown Observable type"); - }; -} -function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) { - return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize); -} -var OperatorSubscriber = function(_super) { - __extends(OperatorSubscriber2, _super); - function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) { - var _this = _super.call(this, destination) || this; - _this.onFinalize = onFinalize; - _this.shouldUnsubscribe = shouldUnsubscribe; - _this._next = onNext ? function(value) { - try { - onNext(value); - } catch (err2) { - destination.error(err2); - } - } : _super.prototype._next; - _this._error = onError ? function(err2) { - try { - onError(err2); - } catch (err3) { - destination.error(err3); - } finally { - this.unsubscribe(); - } - } : _super.prototype._error; - _this._complete = onComplete ? function() { - try { - onComplete(); - } catch (err2) { - destination.error(err2); - } finally { - this.unsubscribe(); - } - } : _super.prototype._complete; - return _this; - } - OperatorSubscriber2.prototype.unsubscribe = function() { - var _a; - if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { - var closed_1 = this.closed; - _super.prototype.unsubscribe.call(this); - !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this)); - } - }; - return OperatorSubscriber2; -}(Subscriber); -var EmptyError = createErrorClass(function(_super) { - return function EmptyErrorImpl() { - _super(this); - this.name = "EmptyError"; - this.message = "no elements in sequence"; - }; -}); -function firstValueFrom(source, config2) { - var hasConfig = typeof config2 === "object"; - return new Promise(function(resolve, reject) { - var subscriber = new SafeSubscriber({ - next: function(value) { - resolve(value); - subscriber.unsubscribe(); - }, - error: reject, - complete: function() { - if (hasConfig) { - resolve(config2.defaultValue); - } else { - reject(new EmptyError()); - } - } - }); - source.subscribe(subscriber); - }); -} -function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) { - return function(source, subscriber) { - var hasState = hasSeed; - var state = seed; - var index = 0; - source.subscribe(createOperatorSubscriber(subscriber, function(value) { - var i = index++; - state = hasState ? accumulator(state, value, i) : (hasState = true, value); - emitOnNext && subscriber.next(state); - }, emitBeforeComplete && function() { - hasState && subscriber.next(state); - subscriber.complete(); - })); - }; -} -function reduce(accumulator, seed) { - return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true)); -} -var arrReducer = function(arr, value) { - return arr.push(value), arr; -}; -function toArray() { - return operate(function(source, subscriber) { - reduce(arrReducer, [])(source).subscribe(subscriber); - }); -} -const BIG_WIG_MAGIC = -2003829722; -const BIG_BED_MAGIC = -2021002517; -function toString(arr) { - return new TextDecoder().decode(arr); -} -function getParsers(isBE) { - const le = isBE ? "big" : "little"; - const headerParser = new Parser().endianess(le).int32("magic").uint16("version").uint16("numZoomLevels").uint64("chromTreeOffset").uint64("unzoomedDataOffset").uint64("unzoomedIndexOffset").uint16("fieldCount").uint16("definedFieldCount").uint64("asOffset").uint64("totalSummaryOffset").uint32("uncompressBufSize").uint64("extHeaderOffset").array("zoomLevels", { - length: "numZoomLevels", - type: new Parser().endianess(le).uint32("reductionLevel").uint32("reserved").uint64("dataOffset").uint64("indexOffset") - }); - const totalSummaryParser = new Parser().endianess(le).uint64("basesCovered").doublele("scoreMin").doublele("scoreMax").doublele("scoreSum").doublele("scoreSumSquares"); - const chromTreeParser = new Parser().endianess(le).uint32("magic").uint32("blockSize").uint32("keySize").uint32("valSize").uint64("itemCount"); - const isLeafNode = new Parser().endianess(le).uint8("isLeafNode").skip(1).uint16("cnt").saveOffset("offset"); - return { - chromTreeParser, - totalSummaryParser, - headerParser, - isLeafNode - }; -} -class BBI { - /* fetch and parse header information from a bigwig or bigbed file - * @param abortSignal - abort the operation, can be null - * @return a Header object - */ - getHeader(opts = {}) { - const options = "aborted" in opts ? { signal: opts } : opts; - if (!this.headerP) { - this.headerP = this._getHeader(options).catch((e) => { - this.headerP = void 0; - throw e; - }); - } - return this.headerP; - } - /* - * @param filehandle - a filehandle from generic-filehandle or implementing something similar to the node10 fs.promises API - * @param path - a Local file path as a string - * @param url - a URL string - * @param renameRefSeqs - an optional method to rename the internal reference sequences using a mapping function - */ - constructor(options = {}) { - const { filehandle, renameRefSeqs = (s) => s, path, url } = options; - this.renameRefSeqs = renameRefSeqs; - if (filehandle) { - this.bbi = filehandle; - } else if (url) { - this.bbi = new RemoteFile$1(url); - } else if (path) { - this.bbi = new LocalFile(path); - } else { - throw new Error("no file given"); - } - } - async _getHeader(opts) { - const header = await this._getMainHeader(opts); - const chroms = await this._readChromTree(header, opts); - return { ...header, ...chroms }; - } - async _getMainHeader(opts, requestSize = 2e3) { - const { buffer } = await this.bbi.read(Buffer2.alloc(requestSize), 0, requestSize, 0, opts); - const isBigEndian = this._isBigEndian(buffer); - const ret = getParsers(isBigEndian); - const header = ret.headerParser.parse(buffer); - const { magic, asOffset, totalSummaryOffset } = header; - header.fileType = magic === BIG_BED_MAGIC ? "bigbed" : "bigwig"; - if (asOffset > requestSize || totalSummaryOffset > requestSize) { - return this._getMainHeader(opts, requestSize * 2); - } - if (asOffset) { - const off = Number(header.asOffset); - header.autoSql = toString(buffer.subarray(off, buffer.indexOf(0, off))); - } - if (header.totalSummaryOffset > requestSize) { - return this._getMainHeader(opts, requestSize * 2); - } - if (header.totalSummaryOffset) { - const tail = buffer.subarray(Number(header.totalSummaryOffset)); - const sum2 = ret.totalSummaryParser.parse(tail); - header.totalSummary = { ...sum2, basesCovered: Number(sum2.basesCovered) }; - } - return { ...header, isBigEndian }; - } - _isBigEndian(buffer) { - let ret = buffer.readInt32LE(0); - if (ret === BIG_WIG_MAGIC || ret === BIG_BED_MAGIC) { - return false; - } - ret = buffer.readInt32BE(0); - if (ret === BIG_WIG_MAGIC || ret === BIG_BED_MAGIC) { - return true; - } - throw new Error("not a BigWig/BigBed file"); - } - // todo: add progress if long running - async _readChromTree(header, opts) { - const isBE = header.isBigEndian; - const le = isBE ? "big" : "little"; - const refsByNumber = []; - const refsByName = {}; - let unzoomedDataOffset = Number(header.unzoomedDataOffset); - const chromTreeOffset = Number(header.chromTreeOffset); - while (unzoomedDataOffset % 4 !== 0) { - unzoomedDataOffset += 1; - } - const off = unzoomedDataOffset - chromTreeOffset; - const { buffer } = await this.bbi.read(Buffer2.alloc(off), 0, off, Number(chromTreeOffset), opts); - const p = getParsers(isBE); - const { keySize } = p.chromTreeParser.parse(buffer); - const leafNodeParser = new Parser().endianess(le).string("key", { stripNull: true, length: keySize }).uint32("refId").uint32("refSize").saveOffset("offset"); - const nonleafNodeParser = new Parser().endianess(le).skip(keySize).uint64("childOffset").saveOffset("offset"); - const rootNodeOffset = 32; - const bptReadNode = async (currentOffset) => { - let offset = currentOffset; - if (offset >= buffer.length) { - throw new Error("reading beyond end of buffer"); - } - const ret = p.isLeafNode.parse(buffer.subarray(offset)); - const { isLeafNode, cnt } = ret; - offset += ret.offset; - if (isLeafNode) { - for (let n = 0; n < cnt; n += 1) { - const leafRet = leafNodeParser.parse(buffer.subarray(offset)); - offset += leafRet.offset; - const { key, refId, refSize } = leafRet; - const refRec = { name: key, id: refId, length: refSize }; - refsByName[this.renameRefSeqs(key)] = refId; - refsByNumber[refId] = refRec; - } - } else { - const nextNodes = []; - for (let n = 0; n < cnt; n += 1) { - const nonleafRet = nonleafNodeParser.parse(buffer.subarray(offset)); - const { childOffset } = nonleafRet; - offset += nonleafRet.offset; - nextNodes.push(bptReadNode(Number(childOffset) - Number(chromTreeOffset))); - } - await Promise.all(nextNodes); - } - }; - await bptReadNode(rootNodeOffset); - return { - refsByName, - refsByNumber - }; - } - /* - * fetches the "unzoomed" view of the bigwig data. this is the default for bigbed - * @param abortSignal - a signal to optionally abort this operation - */ - async getUnzoomedView(opts) { - const { unzoomedIndexOffset, refsByName, uncompressBufSize, isBigEndian, fileType } = await this.getHeader(opts); - return new BlockView(this.bbi, refsByName, unzoomedIndexOffset, isBigEndian, uncompressBufSize > 0, fileType); - } - /** - * Gets features from a BigWig file - * - * @param refName - The chromosome name - * @param start - The start of a region - * @param end - The end of a region - * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) or scale used to infer the zoomLevel to use - */ - async getFeatureStream(refName, start, end, opts = { - scale: 1 - }) { - await this.getHeader(opts); - const chrName = this.renameRefSeqs(refName); - let view; - if (opts.basesPerSpan) { - view = await this.getView(1 / opts.basesPerSpan, opts); - } else if (opts.scale) { - view = await this.getView(opts.scale, opts); - } else { - view = await this.getView(1, opts); - } - if (!view) { - throw new Error("unable to get block view for data"); - } - return new Observable((observer) => { - view.readWigData(chrName, start, end, observer, opts); - }); - } - async getFeatures(refName, start, end, opts = { - scale: 1 - }) { - const ob = await this.getFeatureStream(refName, start, end, opts); - const ret = await firstValueFrom(ob.pipe(toArray())); - return ret.flat(); - } -} -class BigWig extends BBI { - /** - * Retrieves a BlockView of a specific zoomLevel - * - * @param scale - number - * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) or scale used to infer the zoomLevel to use - */ - async getView(scale, opts) { - const { zoomLevels, refsByName, fileSize, isBigEndian, uncompressBufSize } = await this.getHeader(opts); - const basesPerPx = 1 / scale; - let maxLevel = zoomLevels.length; - if (!fileSize) { - maxLevel -= 1; - } - for (let i = maxLevel; i >= 0; i -= 1) { - const zh = zoomLevels[i]; - if (zh && zh.reductionLevel <= 2 * basesPerPx) { - const indexOffset = Number(zh.indexOffset); - return new BlockView(this.bbi, refsByName, indexOffset, isBigEndian, uncompressBufSize > 0, "summary"); - } - } - return this.getUnzoomedView(opts); - } -} -function BigWigDataFetcher(HGC, dataConfig) { - if (!new.target) { - throw new Error('Uncaught TypeError: Class constructor cannot be invoked without "new"'); - } - const cls = class BigWigDataFetcherClass { - constructor() { - __publicField(this, "dataConfig"); - __publicField(this, "bwFileHeader"); - __publicField(this, "bwFile"); - __publicField(this, "TILE_SIZE"); - __publicField(this, "errorTxt"); - __publicField(this, "dataPromises"); - __publicField(this, "chromSizes"); - __publicField(this, "assembly"); - __publicField(this, "tilesetInfoLoading"); - this.dataConfig = dataConfig; - this.assembly = this.dataConfig.assembly; - this.bwFileHeader = null; - this.bwFile = null; - this.TILE_SIZE = 1024; - this.errorTxt = ""; - this.dataPromises = []; - const chromosomeSizes = computeChromSizes(this.assembly).size; - const chromosomeCumPositions = []; - const chromosomePositions = {}; - let prevEndPosition = 0; - Object.keys(computeChromSizes(this.assembly).size).forEach((chrStr, i) => { - const positionInfo = { - id: i, - chr: chrStr, - pos: prevEndPosition - }; - chromosomeCumPositions.push(positionInfo); - chromosomePositions[chrStr] = positionInfo; - prevEndPosition += computeChromSizes(this.assembly).size[chrStr]; - }); - this.chromSizes = { - chrToAbs: (chrom, chromPos) => this.chromSizes.chrPositions[chrom].pos + chromPos, - cumPositions: chromosomeCumPositions, - chrPositions: chromosomePositions, - totalLength: prevEndPosition, - chromLengths: chromosomeSizes - }; - this.dataPromises.push(this.loadBBI(dataConfig)); - } - async loadBBI(dataConfig2) { - if (dataConfig2.url) { - this.bwFile = new BigWig({ - filehandle: new RemoteFile(dataConfig2.url, { overrides: dataConfig2.urlFetchOptions }) - }); - return this.bwFile.getHeader().then((h) => { - this.bwFileHeader = h; - }); - } else { - console.error('Please enter a "url" field to the data config'); - return null; - } - } - tilesetInfo(callback) { - this.tilesetInfoLoading = true; - return Promise.all(this.dataPromises).then(() => { - this.tilesetInfoLoading = false; - const totalLength = this.chromSizes.totalLength; - const retVal = { - tile_size: this.TILE_SIZE, - max_zoom: Math.ceil(Math.log(totalLength / this.TILE_SIZE) / Math.log(2)), - max_width: 2 ** Math.ceil(Math.log(totalLength) / Math.log(2)), - min_pos: [0], - max_pos: [totalLength] - }; - if (callback) { - callback(retVal); - } - return retVal; - }).catch((err2) => { - this.tilesetInfoLoading = false; - console.error(err2); - if (callback) { - callback({ - error: `Error parsing bigwig: ${err2}` - }); - } - return null; - }); - } - fetchTilesDebounced(receivedTiles, tileIds) { - const tiles = {}; - const validTileIds = []; - const tilePromises = []; - for (const tileId of tileIds) { - const parts = tileId.split("."); - const z = parseInt(parts[0], 10); - const x = parseInt(parts[1], 10); - if (Number.isNaN(x) || Number.isNaN(z)) { - console.warn("Invalid tile zoom or position:", z, x); - continue; - } - validTileIds.push(tileId); - tilePromises.push(this.tile(z, x)); - } - Promise.all(tilePromises).then((values) => { - for (let i = 0; i < values.length; i++) { - const validTileId = validTileIds[i]; - tiles[validTileId] = values[i]; - tiles[validTileId].tilePositionId = validTileId; - } - receivedTiles(tiles); - }); - return tiles; - } - async tile(z, x) { - const tsInfo = await this.tilesetInfo(); - const tileWidth = +tsInfo.max_width / 2 ** +z; - const recordPromises = []; - const tile = { - tilePos: [x], - tileId: `bigwig.${z}.${x}`, - zoomLevel: z - }; - const minXOriginal = tsInfo.min_pos[0] + x * tileWidth; - let minX = minXOriginal; - const maxX = tsInfo.min_pos[0] + (x + 1) * tileWidth; - const basesPerPixel = this.determineScale(minX, maxX); - const basesPerBin = (maxX - minX) / this.TILE_SIZE; - const binStarts = []; - for (let i = 0; i < this.TILE_SIZE; i++) { - binStarts.push(minX + i * basesPerBin); - } - const { chromLengths, cumPositions } = this.chromSizes; - cumPositions.forEach((cumPos) => { - const chromName = cumPos.chr; - const chromStart = cumPos.pos; - const chromEnd = cumPos.pos + chromLengths[chromName]; - let startPos, endPos; - if (chromStart <= minX && minX < chromEnd) { - if (maxX > chromEnd) { - startPos = minX - chromStart; - endPos = chromEnd - chromStart; - recordPromises.push( - this.bwFile.getFeatures(chromName, startPos, endPos, { - scale: 1 / basesPerPixel - }).then((values) => { - values.forEach((v) => { - v["startAbs"] = HGC.utils.chrToAbs(chromName, v.start, this.chromSizes); - v["endAbs"] = HGC.utils.chrToAbs(chromName, v.end, this.chromSizes); - }); - return values; - }) - ); - minX = chromEnd; - } else { - startPos = Math.floor(minX - chromStart); - endPos = Math.ceil(maxX - chromStart); - if (!this.bwFile) - return; - recordPromises.push( - this.bwFile.getFeatures(chromName, startPos, endPos, { - scale: 1 / basesPerPixel - }).then((values) => { - values.forEach((v) => { - v["startAbs"] = HGC.utils.chrToAbs(chromName, v.start, this.chromSizes); - v["endAbs"] = HGC.utils.chrToAbs(chromName, v.end, this.chromSizes); - }); - return values; - }) - ); - return; - } - } - }); - return Promise.all(recordPromises).then((v) => { - const values = v.flat(); - const dense = []; - for (let i = 0; i < this.TILE_SIZE; i++) { - dense.push(null); - } - binStarts.forEach((curStart, index) => { - if (curStart < minXOriginal || curStart > maxX) { - return; - } - const filtered = values.filter((v2) => { - return curStart >= v2.startAbs && curStart < v2.endAbs; - }).map((v2) => v2.score); - dense[index] = filtered.length > 0 ? filtered[0] : null; - }); - const dde = new HGC.utils.DenseDataExtrema1D(dense); - tile.min_value = Math.min(...dense); - tile.max_value = Math.max(...dense); - tile.dense = dense; - tile.denseDataExtrema = dde; - tile.minNonZero = dde.minNonZeroInTile; - tile.maxNonZero = dde.maxNonZeroInTile; - return tile; - }); - } - // We never want to request more than 1024 * 20 elements from the file. - determineScale(minX, maxX) { - const reductionLevels = [1]; - const numRequestedElements = maxX - minX; - if (!this.bwFileHeader) { - throw Error("no bigwig header"); - } - this.bwFileHeader.zoomLevels.forEach((z) => { - reductionLevels.push(z.reductionLevel); - }); - let level; - reductionLevels.forEach((rl) => { - if (level) - return; - const numElementsFromFile = numRequestedElements / rl; - if (numElementsFromFile <= this.TILE_SIZE * 20) { - level = rl; - } - }); - return level || reductionLevels.slice(-1)[0]; - } - }; - return new cls(); -} -BigWigDataFetcher.config = { - type: "bigwig" -}; -function filterData(filter, data) { - const { field, not } = filter; - let output = Array.from(data); - if (IsOneOfFilter(filter)) { - const { oneOf } = filter; - output = output.filter((d) => { - return not ? oneOf.indexOf(d[field]) === -1 : oneOf.indexOf(d[field]) !== -1; - }); - } else if (IsRangeFilter(filter)) { - const { inRange } = filter; - output = output.filter((d) => { - const value = +d[field]; - return not ? !(inRange[0] <= value && value <= inRange[1]) : inRange[0] <= value && value <= inRange[1]; - }); - } else if (IsIncludeFilter(filter)) { - const { include } = filter; - output = output.filter((d) => { - return not ? `${d[field]}`.includes(include) : !`${d[field]}`.includes(include); - }); - } - return output; -} -function concatString(concat, data) { - const { fields, separator, newField } = concat; - let output = Array.from(data); - output = output.map((d) => { - const strs = fields.map((f) => d[f]); - d[newField] = strs.join(separator); - return d; - }); - return output; -} -function replaceString(_, data) { - const { field, replace, newField } = _; - let output = Array.from(data); - output = output.map((d) => { - d[newField] = d[field]; - replace.forEach((r) => { - const { from, to } = r; - d[newField] = d[newField].toString().replaceAll(from, to); - }); - return d; - }); - return output; -} -function calculateData(log, data) { - const { field, base, newField } = log; - let output = Array.from(data); - output = output.map((d) => { - if (+d[field]) { - if (base === "e") { - d[newField != null ? newField : field] = Math.log(+d[field]); - } else { - d[newField != null ? newField : field] = Math.log(+d[field]) / Math.log(base != null ? base : 10); - } - } - return d; - }); - return output; -} -function calculateGenomicLength(_, data) { - const { startField, endField, newField } = _; - const output = Array.from(data); - output.forEach((d) => { - const s = d[startField]; - const e = d[endField]; - if (!s || !e) { - return; - } - d[newField] = Math.abs(+e - +s); - }); - return output; -} -function inferSvType(_, data) { - const { firstBp, secondBp, newField } = _; - const output = Array.from(data); - const [DUP, TRA, DEL, t2tINV, h2hINV] = ["DUP", "TRA", "DEL", "t2tINV", "h2hINV"]; - output.forEach((d) => { - const chr1 = d[firstBp.chrField]; - const chr2 = d[secondBp.chrField]; - if (chr1 !== chr2) { - d[newField] = TRA; - return; - } - let pos1 = d[firstBp.posField]; - let pos2 = d[secondBp.posField]; - let strand1 = d[firstBp.strandField]; - let strand2 = d[secondBp.strandField]; - if (pos1 > pos2) { - const _pos = pos1; - const _strand = strand1; - pos1 = pos2; - strand1 = strand2; - pos2 = _pos; - strand2 = _strand; - } - switch (`${strand1}${strand2}`) { - case "+-": - d[newField] = DEL; - break; - case "--": - d[newField] = t2tINV; - break; - case "++": - d[newField] = h2hINV; - break; - case "-+": - d[newField] = DUP; - break; - default: - d[newField] = "unknown"; - } - }); - return output; -} -function aggregateCoverage(_, data, scale) { - const { startField, endField, newField, groupField } = _; - const coverage = {}; - const binSize = 1; - data.forEach((d) => { - const curStart = scale(d[startField]); - const curEnd = scale(d[endField]); - const group2 = groupField ? d[groupField] : "__NO_GROUP__"; - const adjustedStart = Math.floor(curStart); - for (let i = adjustedStart; i < curEnd; i += binSize) { - if (!coverage[group2]) { - coverage[group2] = {}; - } - if (!coverage[group2][i]) { - coverage[group2][i] = 0; - } - coverage[group2][i]++; - } - }); - const output = Object.entries(coverage).flatMap((group2) => { - const [groupName, coverageRecords] = group2; - return Object.entries(coverageRecords).map((entry) => { - const [key, value] = entry; - return { - [startField]: scale.invert(+key), - [endField]: scale.invert(+key + binSize), - [newField != null ? newField : "coverage"]: value, - [groupField != null ? groupField : "group"]: groupName - }; - }); - }); - return output; -} -function displace(t, data, scale) { - const { boundingBox, method, newField } = t; - const { startField, endField, groupField } = boundingBox; - let paddingInBp = 0; - if (boundingBox.padding && scale && !boundingBox.isPaddingBP) { - paddingInBp = Math.abs(scale.invert(boundingBox.padding) - scale.invert(0)); - } else if (boundingBox.padding && boundingBox.isPaddingBP) { - paddingInBp = boundingBox.padding; - } - const base = Array.from(data); - if (base && base.length > 0) { - if (!Object.keys(base[0]).find((d) => d === startField) || !Object.keys(base[0]).find((d) => d === endField)) { - return base; - } - } - if (method === "pile") { - const { maxRows } = t; - const occupiedSpaceInRows = {}; - const sorted = base.sort((a, b) => a[startField] - b[startField]); - sorted.forEach((d) => { - const start = +d[startField] - paddingInBp; - const end = +d[endField] + paddingInBp; - const group2 = groupField ? d[groupField] : "__NO_GROUP__"; - if (!occupiedSpaceInRows[group2]) { - occupiedSpaceInRows[group2] = []; - } - let rowIndex = occupiedSpaceInRows[group2].findIndex((d2) => { - if (end < d2.start) { - d2.start = start; - return true; - } else if (d2.end < start) { - d2.end = end; - return true; - } - return false; - }); - if (rowIndex === -1) { - occupiedSpaceInRows[group2].push({ start, end }); - rowIndex = occupiedSpaceInRows[group2].length - 1; - } - d[newField] = `${maxRows && maxRows <= rowIndex ? maxRows - 1 : rowIndex}`; - }); - } else if (method === "spread") { - const boundingBoxes = []; - base.sort((a, b) => a[startField] - b[startField]).forEach((d) => { - let start = d[startField] - paddingInBp; - let end = d[endField] + paddingInBp; - let overlapped = boundingBoxes.filter( - (box) => box.start === start && end === box.end || box.start < start && start < box.end || box.start < end && end < box.end || start < box.start && box.end < end - ); - if (overlapped.length > 0) { - let trial = 0; - do { - overlapped = boundingBoxes.filter( - (box) => box.start === start && end === box.end || box.start < start && start < box.end || box.start < end && end < box.end || start < box.start && box.end < end - ); - if (overlapped.length > 0) { - if (trial % 2 === 0) { - start += paddingInBp * trial; - end += paddingInBp * trial; - } else { - start -= paddingInBp * trial; - end -= paddingInBp * trial; - } - } - trial++; - } while (overlapped.length > 0 && trial < 1e3); - } - d[`${newField}Start`] = `${start + paddingInBp}`; - d[`${newField}Etart`] = `${end - paddingInBp}`; - boundingBoxes.push({ start, end }); - }); - } - return base; -} -function splitExon(split, data, assembly = "hg38") { - const { separator, fields, flag } = split; - let output = Array.from(data); - output = output.map((d) => { - const newRows = []; - fields.forEach((f) => { - const { field, type, newField, chrField } = f; - const splitted = d[field].toString().split(separator); - splitted.forEach((s, i) => { - let newValue = s; - if (type === "genomic") { - newValue = computeChromSizes(assembly).interval[d[chrField]][0] + +s; - } - if (!newRows[i]) { - newRows[i] = Object.assign(JSON.parse(JSON.stringify(d)), { - [newField]: newValue, - [flag.field]: flag.value - }); - } else { - newRows[i][newField] = newValue; - } - }); - }); - return [d, ...newRows]; - }).reduce((a, b) => a.concat(b), []); - return output; -} -function parseSubJSON(_, data) { - const { field, genomicField, baseGenomicField, genomicLengthField } = _; - let output = Array.from(data); - output = output.map((d) => { - let newRows = JSON.parse(d[field]); - newRows = newRows.map((row) => { - var _a, _b; - if (row[genomicField] && d[baseGenomicField]) { - row[`${genomicField}_start`] = +row[genomicField] + +d[baseGenomicField]; - row[`${genomicField}_end`] = +row[genomicField] + +d[baseGenomicField] + +row[genomicLengthField]; - } - return Object.assign(JSON.parse(JSON.stringify(d)), { - ...row, - [`${genomicField}_start`]: row[`${genomicField}_start`], - [`${genomicField}_end`]: row[`${genomicField}_end`], - type: (_b = (_a = row.type) != null ? _a : row.variant) != null ? _b : null, - isParsedRow: "yes" - }); - }); - return [d, ...newRows]; - }).reduce((a, b) => a.concat(b), []); - return output; -} -function aggregateData(spec, data) { - if (getChannelKeysByAggregateFnc(spec).length === 0) { - return data; - } - const nChannelKeys = getChannelKeysByType(spec, "nominal"); - if (nChannelKeys.length !== 1) { - console.warn("Currently, we only support aggregating datasets with single nominal field."); - return data; - } - const nFieldSpec = spec[nChannelKeys[0]]; - if (!IsChannelDeep(nFieldSpec)) { - return data; - } - const nField = nFieldSpec.field; - if (!nField) { - return data; - } - const qChannelKeys = [...getChannelKeysByType(spec, "quantitative"), ...getChannelKeysByType(spec, "genomic")]; - const aggregated = []; - const uniqueCategories = Array.from(new Set(data.map((d) => d[nField]))); - let failed = false; - uniqueCategories.forEach((c) => { - const datum = {}; - datum[nField] = c; - qChannelKeys.forEach((q) => { - const qFieldSpec = spec[q]; - if (!IsChannelDeep(qFieldSpec)) { - failed = true; - return; - } - const { field: qField } = qFieldSpec; - if (!qField || !("aggregate" in qFieldSpec)) { - failed = true; - return; - } - datum[qField] = qFieldSpec.aggregate === "max" ? Math.max(...data.filter((d) => d[nField] === c).map((d) => +d[qField])) : Math.min(...data.filter((d) => d[nField] === c).map((d) => +d[qField])); - }); - aggregated.push(datum); - }); - return !failed ? aggregated : data; -} -class CsvDataFetcherClass { - constructor(dataConfig) { - /** - * Fetches CSV file from url, parses it, and sets this.#parsedData - */ - __privateAdd(this, _fetchCsv); - /** - * Function passed into DSV parser to process each row - * @param row An object which contains the row information. The keys are the column names - * @param genomicFieldsToConvert From data config - * @param chromosomeField From data config - * @param genomicFields From data config - * @returns The processed row - */ - __privateAdd(this, _processCsvRow); - /** - * Calculates the cumulative chromosome position based on the chromosome name and position - * @param chromName A string, the name of the chromosome - * @param chromPosition A string, the position within the chromosome - */ - __privateAdd(this, _calcCumulativePos); - /** - * Called by this.tilesetInfo() to call a callback function with tileset info. - */ - __privateAdd(this, _generateTilesetInfo); - /** - * Creates an object to associate a tile position with the corresponding data - * @param z An integer, the z coordinate of the tile - * @param x An integer, the x coordinate of the tile - * @param y An integer, the y coordinate of the tile - * @returns A promise of an object with tile coordinates and data - */ - __privateAdd(this, _tile); - /** - * This function calculates chromosome position and size based on the assembly (this.#assembly) - * @returns An object containing chromosome information and a way to calculate absolute position - */ - __privateAdd(this, _generateChomSizeInfo); - __publicField(this, "dataConfig"); - // @ts-ignore - __publicField(this, "tilesetInfoLoading"); - // Used in TiledPixiTrack - __privateAdd(this, _dataPromise, void 0); - __privateAdd(this, _chromSizes, void 0); - __privateAdd(this, _parsedData, void 0); - // Either set in the constructor or in #fetchCsv() - __privateAdd(this, _assembly, void 0); - __privateAdd(this, _filter, void 0); - __privateAdd(this, _file, void 0); - this.dataConfig = dataConfig; - this.tilesetInfoLoading = false; - __privateSet(this, _assembly, this.dataConfig.assembly); - __privateSet(this, _filter, this.dataConfig.filter); - if (!dataConfig.url) { - console.error("Please provide the `url` of the data"); - } - const { urlFetchOptions, url } = dataConfig; - __privateSet(this, _file, new RemoteFile(url, { overrides: urlFetchOptions })); - __privateSet(this, _chromSizes, __privateMethod(this, _generateChomSizeInfo, generateChomSizeInfo_fn).call(this)); - __privateSet(this, _dataPromise, __privateMethod(this, _fetchCsv, fetchCsv_fn).call(this)); - } - /** - * Called in TiledPixiTrack - */ - tilesetInfo(callback) { - if (!__privateGet(this, _dataPromise)) { - return; - } - this.tilesetInfoLoading = true; - return __privateGet(this, _dataPromise).then(() => __privateMethod(this, _generateTilesetInfo, generateTilesetInfo_fn).call(this, callback)).catch((err2) => { - this.tilesetInfoLoading = false; - console.error("[Gosling Data Fetcher] Error parsing data:", err2); - }); - } - /** - * Called in TiledPixiTrack. - * @param receivedTiles A function from TiledPixiTrack which takes in all the loaded tiles - * @param tileIds An array of tile IDs. Ex. ['1.0', '1.1'] - */ - fetchTilesDebounced(receivedTiles, tileIds) { - const tiles = {}; - const validTileIds = []; - const tilePromises = []; - for (const tileId of tileIds) { - const parts = tileId.split("."); - const z = parseInt(parts[0], 10); - const x = parseInt(parts[1], 10); - const y = parseInt(parts[2], 10); - if (Number.isNaN(x) || Number.isNaN(z)) { - console.warn("[Gosling Data Fetcher] Invalid tile zoom or position:", z, x, y); - continue; - } - validTileIds.push(tileId); - tilePromises.push(__privateMethod(this, _tile, tile_fn).call(this, z, x, y)); - } - Promise.all(tilePromises).then((tileInfo) => { - tileInfo.forEach((tileInfo2, i) => { - if (tileInfo2) { - const validTileId = validTileIds[i]; - tiles[validTileId] = tileInfo2; - tiles[validTileId].tilePositionId = validTileId; - } - }); - receivedTiles(tiles); - }); - } -} -_dataPromise = new WeakMap(); -_chromSizes = new WeakMap(); -_parsedData = new WeakMap(); -_assembly = new WeakMap(); -_filter = new WeakMap(); -_file = new WeakMap(); -_fetchCsv = new WeakSet(); -fetchCsv_fn = async function() { - var _a, _b; - const { chromosomeField, genomicFields, headerNames, longToWideId, genomicFieldsToConvert } = this.dataConfig; - const separator = (_a = this.dataConfig.separator) != null ? _a : ","; - try { - const buffer = await __privateGet(this, _file).readFile(); - const text = buffer.toString(); - const textWithHeader = headerNames ? `${headerNames.join(separator)} -${text}` : text; - const parsedCSV = dsvFormat(separator).parse( - textWithHeader, - (row) => __privateMethod(this, _processCsvRow, processCsvRow_fn).call(this, row, genomicFieldsToConvert, chromosomeField, genomicFields) - ); - if (longToWideId && ((_b = parsedCSV[0]) == null ? void 0 : _b[longToWideId])) { - const columnNames = Object.keys(parsedCSV[0]); - const newJson = {}; - parsedCSV.forEach((row) => { - if (!newJson[row[longToWideId]]) { - newJson[row[longToWideId]] = JSON.parse(JSON.stringify(row)); - } else { - columnNames.forEach((colName) => { - newJson[row[longToWideId]][`${colName}_2`] = row[colName]; - }); - } - }); - __privateSet(this, _parsedData, Object.keys(newJson).map((k_3) => newJson[k_3])); - } else { - __privateSet(this, _parsedData, parsedCSV); - } - } catch (error) { - console.error("[Gosling Data Fetcher] Error fetching data", error); - } -}; -_processCsvRow = new WeakSet(); -processCsvRow_fn = function(row, genomicFieldsToConvert, chromosomeField, genomicFields) { - try { - if (genomicFieldsToConvert) { - genomicFieldsToConvert.forEach((chromMap) => { - const genomicFields_1 = chromMap.genomicFields; - const chromName = row[chromMap.chromosomeField]; - genomicFields_1.forEach((positionCol) => { - const chromPosition = row[positionCol]; - row[positionCol] = String(__privateMethod(this, _calcCumulativePos, calcCumulativePos_fn).call(this, chromName, chromPosition)); - }); - }); - } else if (chromosomeField && genomicFields) { - genomicFields.forEach((positionCol_1) => { - const chromPosition_1 = row[positionCol_1]; - const chromName_1 = row[chromosomeField]; - row[positionCol_1] = String(__privateMethod(this, _calcCumulativePos, calcCumulativePos_fn).call(this, chromName_1, chromPosition_1)); - }); - } - return row; - } catch (e) { - return void 0; - } -}; -_calcCumulativePos = new WeakSet(); -calcCumulativePos_fn = function(chromName, chromPosition) { - if (__privateGet(this, _assembly) !== "unknown") { - const chrName = sanitizeChrName(chromName, __privateGet(this, _assembly), this.dataConfig.chromosomePrefix); - return computeChromSizes(__privateGet(this, _assembly)).interval[chrName][0] + +chromPosition; - } else { - return chromPosition; - } -}; -_generateTilesetInfo = new WeakSet(); -generateTilesetInfo_fn = function(callback) { - this.tilesetInfoLoading = false; - const TILE_SIZE = 1024; - const totalLength = __privateGet(this, _chromSizes).totalLength; - const retVal = { - tile_size: TILE_SIZE, - max_zoom: Math.ceil(Math.log(totalLength / TILE_SIZE) / Math.log(2)), - max_width: totalLength, - min_pos: [0, 0], - max_pos: [totalLength, totalLength] - }; - if (callback) { - callback(retVal); - } - return retVal; -}; -_tile = new WeakSet(); -tile_fn = async function(z, x, y) { - var _a, _b; - const tilesetInfo = await this.tilesetInfo(); - if (!tilesetInfo) - return; - const tileWidth = +tilesetInfo.max_width / 2 ** +z; - const minX = tilesetInfo.min_pos[0] + x * tileWidth; - const maxX = tilesetInfo.min_pos[0] + (x + 1) * tileWidth; - let tabularData = filterUsingGenoPos(__privateGet(this, _parsedData), [minX, maxX], this.dataConfig); - (_a = __privateGet(this, _filter)) == null ? void 0 : _a.forEach((f) => { - tabularData = filterData(f, tabularData); - }); - const sizeLimit = (_b = this.dataConfig.sampleLength) != null ? _b : 1e3; - return { - // sample the data to make it managable for visualization components - tabularData: tabularData.length > sizeLimit ? sampleSize(tabularData, sizeLimit) : tabularData, - server: null, - tilePos: [x, y], - zoomLevel: z - }; -}; -_generateChomSizeInfo = new WeakSet(); -generateChomSizeInfo_fn = function() { - const chromosomeSizes = computeChromSizes(__privateGet(this, _assembly)).size; - const chromosomeCumPositions = []; - const chromosomePositions = {}; - let prevEndPosition = 0; - Object.keys(chromosomeSizes).forEach((chrStr, i) => { - const positionInfo = { - id: i, - chr: chrStr, - pos: prevEndPosition - }; - chromosomeCumPositions.push(positionInfo); - chromosomePositions[chrStr] = positionInfo; - prevEndPosition += chromosomeSizes[chrStr]; - }); - return { - chrToAbs: (chrom, chromPos) => __privateGet(this, _chromSizes).chrPositions[chrom].pos + chromPos, - cumPositions: chromosomeCumPositions, - chrPositions: chromosomePositions, - totalLength: prevEndPosition, - chromLengths: chromosomeSizes - }; -}; -function CsvDataFetcher(_HGC, dataConfig, _pubsub) { - if (!new.target) { - throw new Error('Uncaught TypeError: Class constructor cannot be invoked without "new"'); - } - return new CsvDataFetcherClass(dataConfig); -} -CsvDataFetcher.config = { - type: "csv" -}; -function JsonDataFetcher(HGC, ...args) { - if (!new.target) { - throw new Error('Uncaught TypeError: Class constructor cannot be invoked without "new"'); - } - class JsonDataFetcherClass { - constructor(params) { - __publicField(this, "dataConfig"); - // @ts-ignore - __publicField(this, "tilesetInfoLoading"); - __publicField(this, "chromSizes"); - __publicField(this, "values"); - __publicField(this, "assembly"); - const [dataConfig] = params; - this.dataConfig = dataConfig; - this.tilesetInfoLoading = false; - this.assembly = this.dataConfig.assembly; - if (!dataConfig.values) { - console.error("Please provide `values` of the JSON data"); - return; - } - const chromosomeSizes = computeChromSizes(this.assembly).size; - const chromosomeCumPositions = []; - const chromosomePositions = {}; - let prevEndPosition = 0; - Object.keys(computeChromSizes(this.assembly).size).forEach((chrStr, i) => { - const positionInfo = { - id: i, - chr: chrStr, - pos: prevEndPosition - }; - chromosomeCumPositions.push(positionInfo); - chromosomePositions[chrStr] = positionInfo; - prevEndPosition += computeChromSizes(this.assembly).size[chrStr]; - }); - this.chromSizes = { - chrToAbs: (chrom, chromPos) => this.chromSizes.chrPositions[chrom].pos + chromPos, - cumPositions: chromosomeCumPositions, - chrPositions: chromosomePositions, - totalLength: prevEndPosition, - chromLengths: chromosomeSizes - }; - const { chromosomeField, genomicFields, genomicFieldsToConvert } = this.dataConfig; - this.values = dataConfig.values.map((row) => { - try { - if (genomicFieldsToConvert) { - genomicFieldsToConvert.forEach((chromMap) => { - const genomicFields2 = chromMap.genomicFields; - const chromName = sanitizeChrName(row[chromMap.chromosomeField], this.assembly); - genomicFields2.forEach((positionCol) => { - const chromPosition = row[positionCol]; - row[positionCol] = String(this.chromSizes.chrToAbs(chromName, chromPosition)); - }); - }); - } else if (chromosomeField && genomicFields) { - genomicFields.forEach((positionCol) => { - const chromPosition = row[positionCol]; - const chromName = sanitizeChrName(row[chromosomeField], this.assembly); - row[positionCol] = String(this.chromSizes.chrToAbs(chromName, chromPosition)); - }); - } - return row; - } catch (e) { - return void 0; - } - }); - } - tilesetInfo(callback) { - this.tilesetInfoLoading = false; - const TILE_SIZE = 1024; - const totalLength = this.chromSizes.totalLength; - const retVal = { - tile_size: TILE_SIZE, - max_zoom: Math.ceil(Math.log(totalLength / TILE_SIZE) / Math.log(2)), - max_width: totalLength, - min_pos: [0, 0], - max_pos: [totalLength, totalLength] - }; - if (callback) { - callback(retVal); - } - return retVal; - } - fetchTilesDebounced(receivedTiles, tileIds) { - const tiles = {}; - const validTileIds = []; - const tilePromises = []; - for (const tileId of tileIds) { - const parts = tileId.split("."); - const z = parseInt(parts[0], 10); - const x = parseInt(parts[1], 10); - const y = parseInt(parts[2], 10); - if (Number.isNaN(x) || Number.isNaN(z)) { - console.warn("[Gosling Data Fetcher] Invalid tile zoom or position:", z, x, y); - continue; - } - validTileIds.push(tileId); - tilePromises.push(this.tile(z, x, y)); - } - Promise.all(tilePromises).then((values) => { - values.forEach((value, i) => { - const validTileId = validTileIds[i]; - tiles[validTileId] = value; - tiles[validTileId].tilePositionId = validTileId; - }); - receivedTiles(tiles); - }); - return tiles; - } - tile(z, x, y) { - var _a; - const tsInfo = this.tilesetInfo(); - const tileWidth = +tsInfo.max_width / 2 ** +z; - const minX = tsInfo.min_pos[0] + x * tileWidth; - const maxX = tsInfo.min_pos[0] + (x + 1) * tileWidth; - let tabularData = filterUsingGenoPos(this.values, [minX, maxX], this.dataConfig); - const sizeLimit = (_a = this.dataConfig.sampleLength) != null ? _a : 1e3; - if (sizeLimit < tabularData.length) { - tabularData = this.dataConfig.sampleType === "first" ? tabularData.slice(0, sizeLimit) : sampleSize(tabularData, sizeLimit); - } - return { - tabularData, - server: null, - tilePos: [x, y], - zoomLevel: z - }; - } - } - return new JsonDataFetcherClass(args); -} -JsonDataFetcher.config = { - type: "json" -}; -const encodedJs$1 = "KCgpID0+IHsKICB2YXIgX19jcmVhdGUgPSBPYmplY3QuY3JlYXRlOwogIHZhciBfX2RlZlByb3AgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiAgdmFyIF9fZ2V0T3duUHJvcERlc2MgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOwogIHZhciBfX2dldE93blByb3BOYW1lcyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzOwogIHZhciBfX2dldFByb3RvT2YgPSBPYmplY3QuZ2V0UHJvdG90eXBlT2Y7CiAgdmFyIF9faGFzT3duUHJvcCA9IE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHk7CiAgdmFyIF9fbWFya0FzTW9kdWxlID0gKHRhcmdldCkgPT4gX19kZWZQcm9wKHRhcmdldCwgIl9fZXNNb2R1bGUiLCB7IHZhbHVlOiB0cnVlIH0pOwogIHZhciBfX2VzbSA9IChmbiwgcmVzKSA9PiBmdW5jdGlvbiBfX2luaXQoKSB7CiAgICByZXR1cm4gZm4gJiYgKHJlcyA9ICgwLCBmbltPYmplY3Qua2V5cyhmbilbMF1dKShmbiA9IDApKSwgcmVzOwogIH07CiAgdmFyIF9fY29tbW9uSlMgPSAoY2IsIG1vZCkgPT4gZnVuY3Rpb24gX19yZXF1aXJlK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ICAgICAgIH0KICAgICAgICByZXR1cm4gb3V0cHV0LmpvaW4oIiIpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZyb21CeXRlQXJyYXkodWludDgpIHsKICAgICAgICB2YXIgdG1wOwogICAgICAgIHZhciBsZW4yID0gdWludDgubGVuZ3RoOwogICAgICAgIHZhciBleHRyYUJ5dGVzID0gbGVuMiAlIDM7CiAgICAgICAgdmFyIHBhcnRzID0gW107CiAgICAgICAgdmFyIG1heENodW5rTGVuZ3RoID0gMTYzODM7CiAgICAgICAgZm9yICh2YXIgaTIgPSAwLCBsZW4yMiA9IGxlbjIgLSBleHRyYUJ5dGVzOyBpMiA8IGxlbjIyOyBpMiArPSBtYXhDaHVua0xlbmd0aCkgewogICAgICAgICAgcGFydHMucHVzaChlbmNvZGVDaHVuayh1aW50OCwgaTIsIGkyICsgbWF4Q2h1bmtMZW5ndGggPiBsZW4yMiA/IGxlbjIyIDogaTIgKyBtYXhDaHVua0xlbmd0aCkpOwogICAgICAgIH0KICAgICAgICBpZiAoZXh0cmFCeXRlcyA9PT0gMSkgewogICAgICAgICAgdG1wID0gdWludDhbbGVuMiAtIDFdOwogICAgICAgICAgcGFydHMucHVzaChsb29rdXBbdG1wID4+IDJdICsgbG9va3VwW3RtcCA8PCA0ICYgNjNdICsgIj09Iik7CiAgICAgICAgfSBlbHNlIGlmIChleHRyYUJ5dGVzID09PSAyKSB7CiAgICAgICAgICB0bXAgPSAodWludDhbbGVuMiAtIDJdIDw8IDgpICsgdWludDhbbGVuMiAtIDFdOwogICAgICAgICAgcGFydHMucHVzaChsb29rdXBbdG1wID4+IDEwXSArIGxvb2t1cFt0bXAgPj4gNCAmIDYzXSArIGxvb2t1cFt0bXAgPDwgMiAmIDYzXSArICI9Iik7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwYXJ0cy5qb2luKCIiKTsKICAgICAgfQogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vaWVlZTc1NEAxLjIuMS9ub2RlX21vZHVsZXMvaWVlZTc1NC9pbmRleC5qcwogIHZhciByZXF1aXJlX2llZWU3NTQgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vaWVlZTc1NEAxLjIuMS9ub2RlX21vZHVsZXMvaWVlZTc1NC9pbmRleC5qcyIoZXhwb3J0czIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICBleHBvcnRzMi5yZWFkID0gZnVuY3Rpb24oYnVmZmVyLCBvZmZzZXQsIGlzTEUsIG1MZW4sIG5CeXRlcykgewogICAgICAgIHZhciBlLCBtOwogICAgICAgIHZhciBlTGVuID0gbkJ5dGVzICogOCAtIG1MZW4gLSAxOwogICAgICAgIHZhciBlTWF4ID0gKDEgPDwgZUxlbikgLSAxOwogICAgICAgIHZhciBlQmlhcyA9IGVNYXggPj4gMTsKICAgICAgICB2YXIgbkJpdHMgPSAtNzsKICAgICAgICB2YXIgaSA9IGlzTEUgPyBuQnl0ZXMgLSAxIDogMDsKICAgICAgICB2YXIgZCA9IGlzTEUgPyAtMSA6IDE7CiAgICAgICAgdmFyIHMgPSBidWZmZXJbb2Zmc2V0ICsgaV07CiAgICAgICAgaSArPSBkOwogICAgICAgIGUgPSBzICYgKDEgPDwgLW5CaXRzKSAtIDE7CiAgICAgICAgcyA+Pj0gLW5CaXRzOwogICAgICAgIG5CaXRzICs9IGVMZW47CiAgICAgICAgZm9yICg7IG5CaXRzID4gMDsgZSA9IGUgKiAyNTYgKyBidWZmZXJbb2Zmc2V0ICsgaV0sIGkgKz0gZCwgbkJpdHMgLT0gOCkgewogICAgICAgIH0KICAgICAgICBtID0gZSAmICgxIDw8IC1uQml0cykgLSAxOwogICAgICAgIGUgPj49IC1uQml0czsKICAgICAgICBuQml0cyArPSBtTGVuOwogICAgICAgIGZvciAoOyBuQml0cyA+IDA7IG0gPSBtICogMjU2ICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9IGQsIG5CaXRzIC09IDgpIHs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AgZSA9IGVNYXg7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGUgPSBNYXRoLmZsb29yKE1hdGgubG9nKHZhbHVlKSAvIE1hdGguTE4yKTsKICAgICAgICAgIGlmICh2YWx1ZSAqIChjID0gTWF0aC5wb3coMiwgLWUpKSA8IDEpIHsKICAgICAgICAgICAgZS0tOwogICAgICAgICAgICBjICo9IDI7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoZSArIGVCaWFzID49IDEpIHsKICAgICAgICAgICAgdmFsdWUgKz0gcnQgLyBjOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdmFsdWUgKz0gcnQgKiBNYXRoLnBvdygyLCAxIC0gZUJpYXMpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHZhbHVlICogYyA+PSAyKSB7CiAgICAgICAgICAgIGUrKzsKICAgICAgICAgICAgYyAvPSAyOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGUgKyBlQmlhcyA+PSBlTWF4KSB7CiAgICAgICAgICAgIG0gPSAwOwogICAgICAgICAgICBlID0gZU1heDsKICAgICAgICAgIH0gZWxzZSBpZiAoZSArIGVCaWFzID49IDEpIHsKICAgICAgICAgICAgbSA9ICh2YWx1ZSAqIGMgLSAxKSAqIE1hdGgucG93KDIsIG1MZW4pOwogICAgICAgICAgICBlID0gZSArIGVCaWFzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbSA9IHZhbHVlICogTWF0aC5wb3coMiwgZUJpYXMgLSAxKSAqIE1hdGgucG93KDIsIG1MZW4pOwogICAgICAgICAgICBlID0gMDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZm9yICg7IG1MZW4gPj0gODsgYnVmZmVyW29mZnNldCArIGldID0gbSAmIDI1NSwgaSArPSBkLCBtIC89IDI1NiwgbUxlbiAtPSA4KSB7CiAgICAgICAgfQogICAgICAgIGUgPSBlIDw8IG1MZW4gfCBtOwogICAgICAgIGVMZW4gKz0gbUxlbjsKIC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aWYgKCFCdWZmZXIxMC5pc0J1ZmZlcih0aGlzKSkKICAgICAgICAgICAgcmV0dXJuIHZvaWQgMDsKICAgICAgICAgIHJldHVybiB0aGlzLmJ1ZmZlcjsKICAgICAgICB9CiAgICAgIH0pOwogICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoQnVmZmVyMTAucHJvdG90eXBlLCAib2Zmc2V0IiwgewogICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHsKICAgICAgICAgIGlmICghQnVmZmVyMTAuaXNCdWZmZXIodGhpcykpCiAgICAgICAgICAgIHJldHVybiB2b2lkIDA7CiAgICAgICAgICByZXR1cm4gdGhpcy5ieXRlT2Zmc2V0OwogICAgICAgIH0KICAgICAgfSk7CiAgICAgIGZ1bmN0aW9uIGNyZWF0ZUJ1ZmZlcihsZW5ndGgpIHsKICAgICAgICBpZiAobGVuZ3RoID4gS19NQVhfTEVOR1RIKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcignVGhlIHZhbHVlICInICsgbGVuZ3RoICsgJyIgaXMgaW52YWxpZCBmb3Igb3B0aW9uICJzaXplIicpOwogICAgICAgIH0KICAgICAgICBjb25zdCBidWYgPSBuZXcgVWludDhBcnJheShsZW5ndGgpOwogICAgICAgIE9iamVjdC5zZXRQcm90b3R5cGVPZihidWYsIEJ1ZmZlcjEwLnByb3RvdHlwZSk7CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfQogICAgICBmdW5jdGlvbiBCdWZmZXIxMChhcmcsIGVuY29kaW5nT3JPZmZzZXQsIGxlbmd0aCkgewogICAgICAgIGlmICh0eXBlb2YgYXJnID09PSAibnVtYmVyIikgewogICAgICAgICAgaWYgKHR5cGVvZiBlbmNvZGluZ09yT2Zmc2V0ID09PSAic3RyaW5nIikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdUaGUgInN0cmluZyIgYXJndW1lbnQgbXVzd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IUJ1ZmZlcjEwLmlzRW5jb2RpbmcoZW5jb2RpbmcpKSB7CiAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgIH0KICAgICAgICBjb25zdCBsZW5ndGggPSBieXRlTGVuZ3RoKHN0cmluZywgZW5jb2RpbmcpIHwgMDsKICAgICAgICBsZXQgYnVmID0gY3JlYXRlQnVmZmVyKGxlbmd0aCk7CiAgICAgICAgY29uc3QgYWN0dWFsID0gYnVmLndyaXRlKHN0cmluZywgZW5jb2RpbmcpOwogICAgICAgIGlmIChhY3R1YWwgIT09IGxlbmd0aCkgewogICAgICAgICAgYnVmID0gYnVmLnNsaWNlKDAsIGFjdHVhbCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBidWY7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZnJvbUFycmF5TGlrZShhcnJheSkgewogICAgICAgIGNvbnN0IGxlbmd0aCA9IGFycmF5Lmxlbmd0aCA8IDAgPyAwIDogY2hlY2tlZChhcnJheS5sZW5ndGgpIHwgMDsKICAgICAgICBjb25zdCBidWYgPSBjcmVhdGVCdWZmZXIobGVuZ3RoKTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgaSArPSAxKSB7CiAgICAgICAgICBidWZbaV0gPSBhcnJheVtpXSAmIDI1NTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfQogICAgICBmdW5jdGlvbiBmcm9tQXJyYXlWaWV3KGFycmF5VmlldykgewogICAgICAgIGlmIChpc0luc3RhbmNlKGFycmF5VmlldywgVWludDhBcnJheSkpIHsKICAgICAgICAgIGNvbnN0IGNvcHkgPSBuZXcgVWludDhBcnJheShhcnJheVZpZXcpOwogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUJ1ZmZlcihjb3B5LmJ1ZmZlciwgY29weS5ieXRlT2Zmc2V0LCBjb3B5LmJ5dG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1ZmZlcjEwLmlzQnVmZmVyKG9iaikpIHsKICAgICAgICAgIGNvbnN0IGxlbiA9IGNoZWNrZWQob2JqLmxlbmd0aCkgfCAwOwogICAgICAgICAgY29uc3QgYnVmID0gY3JlYXRlQnVmZmVyKGxlbik7CiAgICAgICAgICBpZiAoYnVmLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gYnVmOwogICAgICAgICAgfQogICAgICAgICAgb2JqLmNvcHkoYnVmLCAwLCAwLCBsZW4pOwogICAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai5sZW5ndGggIT09IHZvaWQgMCkgewogICAgICAgICAgaWYgKHR5cGVvZiBvYmoubGVuZ3RoICE9PSAibnVtYmVyIiB8fCBudW1iZXJJc05hTihvYmoubGVuZ3RoKSkgewogICAgICAgICAgICByZXR1cm4gY3JlYXRlQnVmZmVyKDApOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUxpa2Uob2JqKTsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai50eXBlID09PSAiQnVmZmVyIiAmJiBBcnJheS5pc0FycmF5KG9iai5kYXRhKSkgewogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUxpa2Uob2JqLmRhdGEpOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBjaGVja2VkKGxlbmd0aCkgewogICAgICAgIGlmIChsZW5ndGggPj0gS19NQVhfTEVOR1RIKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigiQXR0ZW1wdCB0byBhbGxvY2F0ZSBCdWZmZXIgbGFyZ2VyIHRoYW4gbWF4aW11bSBzaXplOiAweCIgKyBLX01BWF9MRU5HVEgudG9TdHJpbmcoMTYpICsgIiBieXRlcyIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gbGVuZ3RoIHwgMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBTbG93QnVmZmVyKGxlbmd0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gICAgICBpZiAoYVtpXSAhPT0gYltpXSkgewogICAgICAgICAgICB4ID0gYVtpXTsKICAgICAgICAgICAgeSA9IGJbaV07CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoeCA8IHkpCiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHkgPCB4KQogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgcmV0dXJuIDA7CiAgICAgIH07CiAgICAgIEJ1ZmZlcjEwLmlzRW5jb2RpbmcgPSBmdW5jdGlvbiBpc0VuY29kaW5nKGVuY29kaW5nKSB7CiAgICAgICAgc3dpdGNoIChTdHJpbmcoZW5jb2RpbmcpLnRvTG93ZXJDYXNlKCkpIHsKICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgIGNhc2UgInV0Zi04IjoKICAgICAgICAgIGNhc2UgImFzY2lpIjoKICAgICAgICAgIGNhc2UgImxhdGluMSI6CiAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgY2FzZSAidWNzLTIiOgogICAgICAgICAgY2FzZSAidXRmMTZsZSI6CiAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgfTsKICAgICAgQnVmZmVyMTAuY29uY2F0ID0gZnVuY3Rpb24gY29uY2F0KGxpc3QsIGxlbmd0aCkgewogICAgICAgIGlmICghQXJyYXkuaXNBcnJheShsaXN0KSkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignImxpc3QiIGFyZ3VtZW50IG11c3QgYmUgYW4gQXJyYXkgb2YgQnVmZmVycycpOwogICAgICAgIH0KICAgICAgICBpZiAobGlzdC5sZW5ndGggPT09IDApIHsKICAgICAgICAgIHJldHVybiBCdWZmZXIxMC5hbGxvYygwKTsKICAgICAgICB9CiAgICAgICAgbGV0IGk7CiAgICAgICAgaWYgKGxlbmd0aCA9PT0gdm9pZCAwKSB7CiAgICAgICAgICBsZW5ndGggPSAwOwogICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyArK2kpIHsKICAgICAgICAgICAgbGVuZ3RoICs9IGxpc3RbaV0ubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb25zdCBidWZmZXIgPSBCdWZmZXIxMC5hbGxvY1Vuc2FmZShsZW5ndGgpOwogICAgICAgIGxldCBwb3MgPSAwOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgKytpKSB7CiAgICAgICAgICBsZXQgYnVmID0gbGlzdFtpXTsKICAgICAgICAgIGlmIChpc0luc3RhbmNlKGJ1ZiwgVWludDhBcnJheSkpIHsKICAgICAgICAgICAgaWYgKHBvcyArIGJ1Zi5sZW5ndGggPiBidWZmZXIubGVuZ3RoKSB7CiAgICAgICAgICAgICAgaWYgKCFCdWZmZXIxMC5pc0J1ZmZlcihidWYpKQogICAgICAgICAgICAgICAgYnVmID0gQnVmZmVyMTAuZnJvbShidWYpOwogICAgICAgICAgICAgIGJ1Zi5jb3B5KGJ1ZmZlciwgcG9zKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBVaW50OEFycmF5LnByb3RvdHlwZS5zZXQuY2FsbChidWZmZXIsIGJ1ZiwgcG9zKTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIGlmICghQnVmZmVyMTAuaXNCdWZmZXIoYnVmKSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCcibGlzdCIgYXJndW1lbnQgbXVzdCBiZSBhbiBBcnJheSBvZiBCdWZmZXJzJyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBidWYuY29weShidWZmZXIsIHBvcyk7CiAgICAgICAgICB9CiAgICAgICAgICBwb3MgKz0gYnVmLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZmZlcjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gYnl0ZUxlbmd0aChzdHJpbmcsIGVuY29kaW5nKSB7CiAgICAgICAgaWYgKEJ1ZmZlcjEwLmlzQnVmZmVyKHN0cmluZykpIHsKICAgICAgICAgIHJldHVybiBzdHJpbmcubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoQXJyYXlCdWZmZXIuaXNWaWV3KHN0cmluZykgfHwgaXNJbnN0YW5jZShzdHJpbmcsIEFycmF5QnVmZmVyKSkgewogICAgICAgICAgcmV0dXJuIHN0cmluZy5ieXRlTGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAodHlwZW9mIHN0cmluZyAhPT0gInN0cmluZyIpIHsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1RoZSAic3RyaW5nIiBhcmd1bWVudCBtdXN0IGJlIG9uZSBvZiB0eXBlIHN0cmluZywgQnVmZmVyLCBvciBBcnJheUJ1ZmZlci4gUmVjZWl2ZWQgdHlwZSAnICsgdHlwZW9mIHN0cmluZyk7CiAgICAgICAgfQogICAgICAgIGNvbnN0IGxlbiA9IHN0cmluZy5sZW5ndGg7CiAgICAgICAgY29uc3QgbXVzdE1hdGNoID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgYXJndW1lbnRzWzJdID09PSB0cnVlOwogICAgICAgIGlmICghbXVzdE1hdGNoICYmIGxlbiA9PT0gMCkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIGxldCBsb3dlcmVkQ2FzZSA9IGZhbHNlOwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgc3dpdGNoIChlbmNvZGluZykgewogICAgICAgICAgICBjYXNlICJhc2NpaSI6CiAgICAgICAgICAgIGNhc2UgImxhdGluMSI6CiAgICAgICAgICAgIGNhc2UgImJpbmFyeSI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbjsKICAgICAgICAgICAgY2FzZSAidXRmOCI6CiAgICAgICAgICAgIGNhc2UgInV0Zi04IjoKICAgICAgICAgICAgICByZXR1cm4gdXRmOFRvQnl0ZXMoc3RyaW5nKS5sZW5ndGg7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbiAqIDI7CiAgICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbiA+Pj4gMTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0VG9CeXRlcyhzdHJpbmcpLmxlbmd0aDsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpIHsKICAgICAgICAgICAgICAgIHJldHVybiBtdXN0TWF0Y2ggPyAtMSA6IHV0ZjhUb0J5dGVzKHN0cmluZykubGVuZ3RoOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBlbmNvZGluZyA9ICgiIiArIGVuY29kaW5nKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgIGxvd2VyZWRDYXNlID0gdHJ1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgQnVmZmVyMTAuYnl0ZUxlbmd0aCA9IGJ5dGVMZW5ndGg7CiAgICAgIGZ1bmN0aW9uIHNsb3dUb1N0cmluZyhlbmNvZGluZywgc3RhcnQsIGVuZCkgewogICAgICAgIGxldCBsb3dlcmVkQ2FzZSA9IGZhbHNlOwogICAgICAgIGlmIChzdGFydCA9PT0gdm9pZCAwIHx8IHN0YXJ0IDwgMCkgewogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPiB0aGlzLmxlbmd0aCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kID09PSB2b2lkIDAgfHwgZW5kID4gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kIDw9IDApIHsKICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICB9CiAgICAgICAgZW5kID4+Pj0gMDsKICAgICAgICBzdGFydCA+Pj49IDA7CiAgICAgICAgaWYgKGVuZCA8PSBzdGFydCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoIWVuY29kaW5nKQogICAgICAgICAgZW5jb2RpbmcgPSAidXRmOCI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gaGV4U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICAgIHJldHVybiBhc2NpaVNsaWNlKHRoaXMsIHN0YXJ0LCBlbmQpOwogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBsYXRpbjFTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjE2bGVTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgICAgIGVuY29kaW5nID0gKGVuY29kaW5nICsgIiIpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgbG93ZXJlZENhc2UgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBCdWZmZXIxMC5wcm90b3R5cGUuX2lzQnVmZmVyID0gdHJ1ZTsKICAgICAgZnVuY3Rpb24gc3dhcChiLCBuLCBtKSB7CiAgICAgICAgY29uc3QgaSA9IGJbbl07CiAgICAgICAgYltuXSA9IGJbbV07CiAgICAgICAgYlttXSA9IGk7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXAxNiA9IGZ1bmN0aW9uIHN3YXAxNigpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgMiAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiAxNi1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDIpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDEpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXAzMiA9IGZ1bmN0aW9uIHN3YXAzMigpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgNCAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiAzMi1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDQpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDMpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMSwgaSArIDIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXA2NCA9IGZ1bmN0aW9uIHN3YXA2NCgpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgOCAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiA2NC1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDgpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDcpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMSwgaSArIDYpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMiwgaSArIDUpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMywgaSArIDQpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gdG9TdHJpbmcoKSB7Ci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0KICAgICAgICBpZiAoc3RhcnQgPCAwIHx8IGVuZCA+IHRhcmdldC5sZW5ndGggfHwgdGhpc1N0YXJ0IDwgMCB8fCB0aGlzRW5kID4gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJvdXQgb2YgcmFuZ2UgaW5kZXgiKTsKICAgICAgICB9CiAgICAgICAgaWYgKHRoaXNTdGFydCA+PSB0aGlzRW5kICYmIHN0YXJ0ID49IGVuZCkgewogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgICAgIGlmICh0aGlzU3RhcnQgPj0gdGhpc0VuZCkgewogICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPj0gZW5kKSB7CiAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgc3RhcnQgPj4+PSAwOwogICAgICAgIGVuZCA+Pj49IDA7CiAgICAgICAgdGhpc1N0YXJ0ID4+Pj0gMDsKICAgICAgICB0aGlzRW5kID4+Pj0gMDsKICAgICAgICBpZiAodGhpcyA9PT0gdGFyZ2V0KQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgbGV0IHggPSB0aGlzRW5kIC0gdGhpc1N0YXJ0OwogICAgICAgIGxldCB5ID0gZW5kIC0gc3RhcnQ7CiAgICAgICAgY29uc3QgbGVuID0gTWF0aC5taW4oeCwgeSk7CiAgICAgICAgY29uc3QgdGhpc0NvcHkgPSB0aGlzLnNsaWNlKHRoaXNTdGFydCwgdGhpc0VuZCk7CiAgICAgICAgY29uc3QgdGFyZ2V0Q29weSA9IHRhcmdldC5zbGljZShzdGFydCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbjsgKytpKSB7CiAgICAgICAgICBpZiAodGhpc0NvcHlbaV0gIT09IHRhcmdldENvcHlbaV0pIHsKICAgICAgICAgICAgeCA9IHRoaXNDb3B5W2ldOwogICAgICAgICAgICB5ID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kgewogICAgICAgICAgaWYgKGRpcikKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgZWxzZQogICAgICAgICAgICBieXRlT2Zmc2V0ID0gYnVmZmVyLmxlbmd0aCAtIDE7CiAgICAgICAgfSBlbHNlIGlmIChieXRlT2Zmc2V0IDwgMCkgewogICAgICAgICAgaWYgKGRpcikKICAgICAgICAgICAgYnl0ZU9mZnNldCA9IDA7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICB2YWwgPSBCdWZmZXIxMC5mcm9tKHZhbCwgZW5jb2RpbmcpOwogICAgICAgIH0KICAgICAgICBpZiAoQnVmZmVyMTAuaXNCdWZmZXIodmFsKSkgewogICAgICAgICAgaWYgKHZhbC5sZW5ndGggPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGFycmF5SW5kZXhPZihidWZmZXIsIHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcik7CiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgdmFsID0gdmFsICYgMjU1OwogICAgICAgICAgaWYgKHR5cGVvZiBVaW50OEFycmF5LnByb3RvdHlwZS5pbmRleE9mID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIGlmIChkaXIpIHsKICAgICAgICAgICAgICByZXR1cm4gVWludDhBcnJheS5wcm90b3R5cGUuaW5kZXhPZi5jYWxsKGJ1ZmZlciwgdmFsLCBieXRlT2Zmc2V0KTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICByZXR1cm4gVWludDhBcnJheS5wcm90b3R5cGUubGFzdEluZGV4T2YuY2FsbChidWZmZXIsIHZhbCwgYnl0ZU9mZnNldCk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBhcnJheUluZGV4T2YoYnVmZmVyLCBbdmFsXSwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcik7CiAgICAgICAgfQogICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoInZhbCBtdXN0IGJlIHN0cmluZywgbnVtYmVyIG9yIEJ1ZmZlciIpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGFycmF5SW5kZXhPZihhcnIsIHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcikgewogICAgICAgIGxldCBpbmRleFNpemUgPSAxOwogICAgICAgIGxldCBhcnJMZW5ndGggPSBhcnIubGVuZ3RoOwogICAgICAgIGxldCB2YWxMZW5ndGggPSB2YWwubGVuZ3RoOwogICAgICAgIGlmIChlbmNvZGluZyAhPT0gdm9pZCAwKSB7CiAgICAgICAgICBlbmNvZGluZyA9IFN0cmluZyhlbmNvZGluZykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgIGlmIChlbmNvZGluZyA9PT0gInVjczIiIHx8IGVuY29kaW5nID09PSAidWNzLTIiIHx8IGVuY29kaW5nID09PSAidXRmMTZsZSIgfHwgZW5jb2RpbmcgPT09ICJ1dGYtMTZsZSIpIHsKICAgICAgICAgICAgaWYgKGFyci5sZW5ndGggPCAyIHx8IHZhbC5sZW5ndGggPCAyKSB7CiAgICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGluZGV4U2l6ZSA9IDI7CiAgICAgICAgICAgIGFyckxlbmd0aCAvPSAyOwogICAgICAgICAgICB2YWxMZW5ndGggLz0gMjsKICAgICAgICAgICAgYnl0ZU9mZnNldCAvPSAyOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiByZWFkKGJ1ZiwgaTIpIHsKICAgICAgICAgIGlmIChpbmRleFNpemUgPT09IDEpIHsKICAgICAgICAgICAgcmV0dXJuIGJ1ZltpMl07CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gYnVmLnJlYWRVSW50MTZCRShpMiAqIGluZGV4U2l6ZSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGxldCBpOwogICAgICAgIGlmIChkaXIpIHsKICAgICAgICAgIGxldCBmb3VuZEluZGV4ID0gLTE7CiAgICAgICAgICBmb3IgKGkgPSBieXRlT2Zmc2V0OyBpIDwgYXJyTGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgaWYgKHJlYWQoYXJyLCBpKSA9PT0gcmVhZCh2YWwsIGZvdW5kSW5kZXggPT09IC0xID8gMCA6IGkgLSBmb3VuZEluZGV4KSkgewogICAgICAgICAgICAgIGlmIChmb3VuZEluZGV4ID09PSAtMSkKICAgICAgICAgICAgICAgIGZvdW5kSW5kZXggPSBpOwogICAgICAgICAgICAgIGlmIChpIC0gZm91bmRJbmRleCArIDEgPT09IHZhbExlbmd0aCkKICAgICAgICAgICAgICAgIHJldHVybiBmb3VuZEluZGV4ICogaW5kZXhTaXplOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGlmIChmb3VuZEluZGV4ICE9PSAtMSkKICAgICAgICAgICAgICAgIGkgLT0gaSAtIGZvdW5kSW5kZXg7CiAgICAgICAgICAgICAgZm91bmRJbmRleCA9IC0xOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGlmIChieXRlT2Zmc2V0ICsgdmFsTGVuZ3RoID4gYXJyTGVuZ3RoKQogICAgICAgICAgICBieXRlT2Zmc2V0ID0gYXJyTGVuZ3RoIC0gdmFsTGVuZ3RoOwogICAgICAgICAgZm9yIChpID0gYnl0ZU9mZnNldDsgaSA+PSAwOyBpLS0pIHsKICAgICAgICAgICAgbGV0IGZvdW5kID0gdHJ1ZTsKICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCB2YWxMZW5ndGg7IGorKykgewogICAgICAgICAgICAgIGlmIChyZWFkKGFyciwgaSArIGopICE9PSByZWFkKHZhbCwgaikpIHsKICAgICAgICAgICAgICAgIGZvdW5kID0gZmFsc2U7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGZvdW5kKQogICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gLTE7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLmluY2x1ZGVzID0gZnVuY3Rpb24gaW5jbHVkZXModmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiB0aGlzLmluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgIT09IC0xOwogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUuaW5kZXhPZiA9IGZ1bmN0aW9uIGluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBiaWRpcmVjdGlvbmFsSW5kZXhPZih0aGlzLCB2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nLCB0cnVlKTsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLmxhc3RJbmRleE9mID0gZnVuY3Rpb24gbGFzdEluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBiaWRpcmVjdGlvbmFsSW5kZXhPZih0aGlzLCB2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nLCBmYWxzZSk7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGhleFdyaXRlKGJ1Ziwgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCkgewogICAgICAgIG9mZnNldCA9IE51bWJlcihvZmZzZXQpIHx8IDA7CiAgICAgICAgY29uc3QgcmVtYWluaW5nID0gYnVmLmxlbmd0aCAtIG9mZnNldDsKICAgICAgICBpZiAoIWxlbmd0aCkgewogICAgICAgICAgbGVuZ3RoID0gcmVtYWluaW5nOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBsZW5ndGggPSBOdW1iZXIobGVuZ3RoKTsKICAgICAgICAgIGlmIChsZW5ndGggPiByZW1haW5pbmcpIHsKICAgICAgICAgICAgbGVuZ3RoID0gcmVtYWluaW5nOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb25zdCBzdHJMZW4gPSBzdHJpbmcubGVuZ3RoOwogICAgICAgIGlmIChsZW5ndGggPiBzdHJMZW4gLyAyKSB7CiAgICAgICAgICBsZW5ndGggPSBzdHJMZW4gLyAyOwogICAgICAgIH0KICAgICAgICBsZXQgaTsKICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGNvbnN0IHBhcnNlZCA9IHBhcnNlSW50KHN0cmluZy5zdWJzdHIoaSAqIDIsIDIpLCAxNik7CiAgICAgICAgICBpZiAobnVtYmVySXNOYU4ocGFyc2VkKSkKICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICBidWZbb2Zmc2V0ICsgaV0gPSBwYXJzZWQ7CiAgICAgICAgfQogICAgICAgIHJldHVybiBpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHV0ZjhXcml0ZShidWYsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpIHsKICAgICAgICByZXR1cm4gYmxpdEJ1ZmZlcih1dGY4VG9CeXRlcyhzdHJpbmcsIGJ1Zi5sZW5ndGggLSBvZmZzZXQpLCBidWYsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBhc2NpaVdyaXRlKGJ1Ziwgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCkgewogICAgICAgIHJldHVybiBibGl0QnVmZmVyKGFzY2lpVG9CeXRlcyhzdHJpbmcpLCBidWYsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgfQogIC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GVuY29kaW5nID0gInV0ZjgiOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgZW5jb2RpbmcgPSBsZW5ndGg7CiAgICAgICAgICAgIGxlbmd0aCA9IHZvaWQgMDsKICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIud3JpdGUoc3RyaW5nLCBlbmNvZGluZywgb2Zmc2V0WywgbGVuZ3RoXSkgaXMgbm8gbG9uZ2VyIHN1cHBvcnRlZCIpOwogICAgICAgIH0KICAgICAgICBjb25zdCByZW1haW5pbmcgPSB0aGlzLmxlbmd0aCAtIG9mZnNldDsKICAgICAgICBpZiAobGVuZ3RoID09PSB2b2lkIDAgfHwgbGVuZ3RoID4gcmVtYWluaW5nKQogICAgICAgICAgbGVuZ3RoID0gcmVtYWluaW5nOwogICAgICAgIGlmIChzdHJpbmcubGVuZ3RoID4gMCAmJiAobGVuZ3RoIDwgMCB8fCBvZmZzZXQgPCAwKSB8fCBvZmZzZXQgPiB0aGlzLmxlbmd0aCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkF0dGVtcHQgdG8gd3JpdGUgb3V0c2lkZSBidWZmZXIgYm91bmRzIik7CiAgICAgICAgfQogICAgICAgIGlmICghZW5jb2RpbmcpCiAgICAgICAgICBlbmNvZGluZyA9ICJ1dGY4IjsKICAgICAgICBsZXQgbG93ZXJlZENhc2UgPSBmYWxzZTsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gaGV4V3JpdGUodGhpcywgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCk7CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBhc2NpaVdyaXRlKHRoaXMsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpOwogICAgICAgICAgICBjYXNlICJiYXNlNjQiOgogICAgICAgICAgICAgIHJldHVybiBiYXNlNjRXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgY2FzZSAidWNzMiI6CiAgICAgICAgICAgIGNhc2UgInVjcy0yIjoKICAgICAgICAgICAgY2FzZSAidXRmMTZsZSI6CiAgICAgICAgICAgIGNhc2UgInV0Zi0xNmxlIjoKICAgICAgICAgICAgICByZXR1cm4gdWNzMldyaXRlKHRoaXMsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgIGlmIChsb3dlcmVkQ2FzZSkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoIlVua25vd24gZW5jb2Rpbmc6ICIgKyBlbmNvZGluZyk7CiAgICAgICAgICAgICAgZW5jb2RpbmcgPSAoIiIgKyBlbmNvZGluZykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICBsb3dlcmVkQ2FzZSA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUudG9KU09OID0gZnVuY3Rpb24gdG9KU09OKCkgewogICAgICAgIHJldHVybiB7CiAgICAgICAgICB0eXBlOiAiQnVmZmVyIiwKICAgICAgICAgIGRhdGE6IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKHRoaXMuX2FyciB8fCB0aGlzLCAwKQogICAgICAgIH07CiAgICAgIH07CiAgICAgIGZ1b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ICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgc2Vjb25kQnl0ZSA9IGJ1ZltpICsgMV07CiAgICAgICAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAzMSkgPDwgNiB8IHNlY29uZEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAxMjcpIHsKICAgICAgICAgICAgICAgICAgICBjb2RlUG9pbnQgPSB0ZW1wQ29kZVBvaW50OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICBzZWNvbmRCeXRlID0gYnVmW2kgKyAxXTsKICAgICAgICAgICAgICAgIHRoaXJkQnl0ZSA9IGJ1ZltpICsgMl07CiAgICAgICAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAxOTIpID09PSAxMjggJiYgKHRoaXJkQnl0ZSAmIDE5MikgPT09IDEyOCkgewogICAgICAgICAgICAgICAgICB0ZW1wQ29kZVBvaW50ID0gKGZpcnN0Qnl0ZSAmIDE1KSA8PCAxMiB8IChzZWNvbmRCeXRlICYgNjMpIDw8IDYgfCB0aGlyZEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAyMDQ3ICYmICh0ZW1wQ29kZVBvaW50IDwgNTUyOTYgfHwgdGVtcENvZGVQb2ludCA+IDU3MzQzKSkgewogICAgICAgICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgNDoKICAgICAgICAgICAgICAgIHNlY29uZEJ5dGUgPSBidWZbaSArIDFdOwogICAgICAgICAgICAgICAgdGhpcmRCeXRlID0gYnVmW2kgKyAyXTsKICAgICAgICAgICAgICAgIGZvdXJ0aEJ5dGUgPSBidWZbaSArIDNdOwogICAgICAgICAgICAgICAgaWYgKChzZWNvbmRCeXRlICYgMTkyKSA9PT0gMTI4ICYmICh0aGlyZEJ5dGUgJiAxOTIpID09PSAxMjggJiYgKGZvdXJ0aEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAxNSkgPDwgMTggfCAoc2Vjb25kQnl0ZSAmIDYzKSA8PCAxMiB8ICh0aGlyZEJ5dGUgJiA2MykgPDwgNiB8IGZvdXJ0aEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiA2NTUzNSAmJiB0ZW1wQ29kZVBvaW50IDwgMTExNDExMikgewogICAgICAgICAgICAgICAgICAgIGNvZGVQb2ludCA9IHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKGNvZGVQb2ludCA9PT0gbnVsbCkgewogICAgICAgICAgICBjb2RlUG9pbnQgPSA2NTUzMzsKICAgICAgICAgICAgYnl0ZXNQZXJTZXF1ZW5jZSA9IDE7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA+IDY1NTM1KSB7CiAgICAgICAgICAgIGNvZGVQb2ludCAtPSA2NTUzNjsKICAgICAgICAgICAgcmVzLnB1c2goY29kZVBvaW50ID4+PiAxMCAmIDEwMjMgfCA1NTI5Nik7CiAgICAgICAgICAgIGNvZGVQb2ludCA9IDU2MzIwIHwgY29kZVBvaW50ICYgMTAyMzsKICAgICAgICAgIH0KICAgICAgICAgIHJlcy5wdXNoKGNvZGVQb2ludCk7CiAgICAgICAgICBpICs9IGJ5dGVzUGVyU2VxdWVuY2U7CiAgICAgICAgfQogICAgICAgIHJldHVybiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkocmVzKTsKICAgICAgfQogICAgICB2YXIgTUFYX0FSR1VNRU5UU19MRU5HVEggPSA0MDk2OwogICAgICBmdW5jdGlvbiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkoY29kZVBvaW50cykgewogICAgICAgIGNvbnN0IGxlbiA9IGNvZGVQb2ludHMubGVuZ3RoOwogICAgICAgIGlmIChsZW4gPD0gTUFYX0FSR1VNRU5UU19MRU5HVEgpIHsKICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cyk7CiAgICAgICAgfQogICAgICAgIGxldCByZXMgPSAiIjsKICAgICAgICBsZXQgaSA9IDA7CiAgICAgICAgd2hpbGUgKGkgPCBsZW4pIHsKICAgICAgICAgIHJlcyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cy5zbGljZShpLCBpICs9IE1BWF9BUkdVTUVOVFNfTEVOR1RIKSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYXNjaWlTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldICYgMTI3KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBsYXRpbjFTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBoZXhTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBjb25zdCBsZW4gPSBidWYubGVuZ3RoOwogICAgICAgIGlmICghc3RhcnQgfHwgc3RhcnQgPCAwKQogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIGlmICghZW5kIHx8IGVuZCA8IDAgfHwgZW5kID4gbGVuKQogICAgICAgICAgZW5kID0gbGVuOwogICAgICAgIGxldCBvdXQgPSAiIjsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgb3V0ICs9IGhleFNsaWNlTG9va3VwVGFibGVbYnVmW2ldXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG91dDsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNmxlU2xpY2UoYnVmLCBzdGFydCwgZW5kKSB7CiAgICAgICAgY29uc3QgYnl0ZXMgPSBidWYuc2xpY2Uoc3RhcnQsIGVuZCk7CiAgICAgICAgbGV0IHJlcyA9ICIiOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYnl0ZXMubGVuZ3RoIC0gMTsgaSArPSAyKSB7CiAgICAgICAgICByZXMgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShieXRlc1tpXSArIGJ5dGVzW2kgKyAxXSAqIDI1Nik7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnNsaWNlID0gZnVuY3Rpb24gc2xpY2Uoc3RhcnQsIGVuZCkgewogICAgICAgIGNvbnN0IGxlbiA9IHRoaXMubGVuZ3RoOwogICAgICAgIHN0YXJ0ID0gfn5zdGFydDsKICAgICAgICBlbmQgPSBlbmQgPT09IHZvaWQgMCA/IGxlbiA6IH5+ZW5kOwogICAgICAgIGlmIChzdGFydCA8IDApIHsKICAgICAgICAgIHN0YXJ0ICs9IGxlbjsKICAgICAgICAgIGlmIChzdGFydCA8IDApCiAgICAgICAgICAgIHN0YXJ0ID0gMDsKICAgICAgICB9IGVsc2UgaWYgKHN0YXJ0ID4gbGVuKSB7CiAgICAgICAgICBzdGFydCA9IGxlbjsKICAgICAgICB9CiAgICAgICAgaWYgKGVuZCA8IDApIHsKICAgICAgICAgIGVuZCArPSBsZW47CiAgICAgICAgICBpZiAoZW5kIDwgMCkKICAgICAgICAgICAgZW5kID0gMDsKICAgICAgICB9IGVsc2UgaWYgKGVuZCA+IGxlbikgewogICAgICAgICAgZW5kID0gbGVuOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kIDwgc3RhcnQpCiAgICAgICAgICBlbmQgPSBzdGFydDsKICAgICAgICBjb25zdCBuZXdCdWYgPSB0aGlzLnN1YmFycmF5KHN0YXJ0LCBlbmQpOwogICAgICAgIE9iamVjdC5zZXRQcm90b3R5cGVPZihuZXdCdWYsIEJ1ZmZlcjEwLnByb3RvdHlwZSk7CiAgICAgICAgcmV0dXJuIG5ld0J1ZjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gY2hlY2tPZmZzZXQob2Zmc2V0LCBleHQsIGxlbmd0aCkgewogICAgICAgIGlmIChvZmZzZXQgJSAxICE9PSAwIHx8IG9mZnNldCA8IDApCiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcigib2Zmc2V0IGlzIG5vdCB1aW50Iik7CiAgICAgICAgaWYgKG9mZnNldCArIGV4dCA+IGxlbmd0aCkKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJUcnlpbmc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ICogbXVsOwogICAgICAgIH0KICAgICAgICBtdWwgKj0gMTI4OwogICAgICAgIGlmICh2YWwgPj0gbXVsKQogICAgICAgICAgdmFsIC09IE1hdGgucG93KDIsIDggKiBieXRlTGVuZ3RoMik7CiAgICAgICAgcmV0dXJuIHZhbDsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnJlYWRJbnRCRSA9IGZ1bmN0aW9uIHJlYWRJbnRCRShvZmZzZXQsIGJ5dGVMZW5ndGgyLCBub0Fzc2VydCkgewogICAgICAgIG9mZnNldCA9IG9mZnNldCA+Pj4gMDsKICAgICAgICBieXRlTGVuZ3RoMiA9IGJ5dGVMZW5ndGgyID4+PiAwOwogICAgICAgIGlmICghbm9Bc3NlcnQpCiAgICAgICAgICBjaGVja09mZnNldChvZmZzZXQsIGJ5dGVMZW5ndGgyLCB0aGlzLmxlbmd0aCk7CiAgICAgICAgbGV0IGkgPSBieXRlTGVuZ3RoMjsKICAgICAgICBsZXQgbXVsID0gMTsKICAgICAgICBsZXQgdmFsID0gdGhpc1tvZmZzZXQgKyAtLWldOwogICAgICAgIHdoaWxlIChpID4gMCAmJiAobXVsICo9IDI1NikpIHsKICAgICAgICAgIHZhbCArPSB0aGlzW29mZnNldCArIC0taV0gKiBtdWw7CiAgICAgICAgfQogICAgICAgIG11bCAqPSAxMjg7CiAgICAgICAgaWYgKHZhbCA+PSBtdWwpCiAgICAgICAgICB2YWwgLT0gTWF0aC5wb3coMiwgOCAqIGJ5dGVMZW5ndGgyKTsKICAgICAgICByZXR1cm4gdmFsOwogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUucmVhZEludDggPSBmdW5jdGlvbiByZWFkSW50OChvZmZzZXQsIG5vQXNzZXJ0KSB7CiAgICAgICAgb2Zmc2V0ID0gb2Zmc2V0ID4+PiAwOwogICAgICAgIGlmICghbm9Bc3NlcnQpCiAgICAgICAgICBjaGVja09mZnNldChvZmZzZXQsIDEsIHRoaXMubGVuZ3RoK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WYgKHR5cGVvZiB2YWwgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICBpZiAodHlwZW9mIHN0YXJ0ID09PSAic3RyaW5nIikgewogICAgICAgICAgICBlbmNvZGluZyA9IHN0YXJ0OwogICAgICAgICAgICBzdGFydCA9IDA7CiAgICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgZW5kID09PSAic3RyaW5nIikgewogICAgICAgICAgICBlbmNvZGluZyA9IGVuZDsKICAgICAgICAgICAgZW5kID0gdGhpcy5sZW5ndGg7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoZW5jb2RpbmcgIT09IHZvaWQgMCAmJiB0eXBlb2YgZW5jb2RpbmcgIT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoImVuY29kaW5nIG11c3QgYmUgYSBzdHJpbmciKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0eXBlb2YgZW5jb2RpbmcgPT09ICJzdHJpbmciICYmICFCdWZmZXIxMC5pc0VuY29kaW5nKGVuY29kaW5nKSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHZhbC5sZW5ndGggPT09IDEpIHsKICAgICAgICAgICAgY29uc3QgY29kZSA9IHZhbC5jaGFyQ29kZUF0KDApOwogICAgICAgICAgICBpZiAoZW5jb2RpbmcgPT09ICJ1dGY4IiAmJiBjb2RlIDwgMTI4IHx8IGVuY29kaW5nID09PSAibGF0aW4xIikgewogICAgICAgICAgICAgIHZhbCA9IGNvZGU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiB2YWwgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICB2YWwgPSB2YWwgJiAyNTU7CiAgICAgICAgfSBl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iAgICAgICAgICAgIHRoaXNbaSArIHN0YXJ0XSA9IGJ5dGVzW2kgJSBsZW5dOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgdmFyIGVycm9ycyA9IHt9OwogICAgICBmdW5jdGlvbiBFKHN5bSwgZ2V0TWVzc2FnZSwgQmFzZSkgewogICAgICAgIGVycm9yc1tzeW1dID0gY2xhc3MgTm9kZUVycm9yIGV4dGVuZHMgQmFzZSB7CiAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgc3VwZXIoKTsKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJtZXNzYWdlIiwgewogICAgICAgICAgICAgIHZhbHVlOiBnZXRNZXNzYWdlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyksCiAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB0aGlzLm5hbWUgPSBgJHt0aGlzLm5hbWV9IFske3N5bX1dYDsKICAgICAgICAgICAgdGhpcy5zdGFjazsKICAgICAgICAgICAgZGVsZXRlIHRoaXMubmFtZTsKICAgICAgICAgIH0KICAgICAgICAgIGdldCBjb2RlKCkgewogICAgICAgICAgICByZXR1cm4gc3ltOwogICAgICAgICAgfQogICAgICAgICAgc2V0IGNvZGUodmFsdWUpIHsKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJjb2RlIiwgewogICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICAgIHZhbHVlLAogICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgIH0pOwogICAgICAgICAgfQogICAgICAgICAgdG9TdHJpbmcoKSB7CiAgICA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yICsgMSkpOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBjaGVja0ludEJJKHZhbHVlLCBtaW4sIG1heCwgYnVmLCBvZmZzZXQsIGJ5dGVMZW5ndGgyKSB7CiAgICAgICAgaWYgKHZhbHVlID4gbWF4IHx8IHZhbHVlIDwgbWluKSB7CiAgICAgICAgICBjb25zdCBuID0gdHlwZW9mIG1pbiA9PT0gImJpZ2ludCIgPyAibiIgOiAiIjsKICAgICAgICAgIGxldCByYW5nZTsKICAgICAgICAgIGlmIChieXRlTGVuZ3RoMiA+IDMpIHsKICAgICAgICAgICAgaWYgKG1pbiA9PT0gMCB8fCBtaW4gPT09IEJpZ0ludCgwKSkgewogICAgICAgICAgICAgIHJhbmdlID0gYD49IDAke259IGFuZCA8IDIke259ICoqICR7KGJ5dGVMZW5ndGgyICsgMSkgKiA4fSR7bn1gOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHJhbmdlID0gYD49IC0oMiR7bn0gKiogJHsoYnl0ZUxlbmd0aDIgKyAxKSAqIDggLSAxfSR7bn0pIGFuZCA8IDIgKiogJHsoYnl0ZUxlbmd0aDIgKyAxKSAqIDggLSAxfSR7bn1gOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByYW5nZSA9IGA+PSAke21pbn0ke259IGFuZCA8PSAke21heH0ke259YDsKICAgICAgICAgIH0KICAgICAgICAgIHRocm93IG5ldyBlcnJvcnMuRVJSX09VVF9PRl9SQU5HRSgidmFsdWUiLCByYW5nZSwgdmFsdWUpOwogICAgICAgIH0KICAgICAgICBjaGVja0JvdW5kcyhidWYsIG9mZnNldCwgYnl0ZUxlbmd0aDIpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHZhbGlkYXRlTnVtYmVyKHZhbHVlLCBuYW1lKSB7CiAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSAhPT0gIm51bWJlciIpIHsKICAgICAgICAgIHRocm93IG5ldyBlcnJ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V0ZjhUb0J5dGVzKHN0cmluZywgdW5pdHMpIHsKICAgICAgICB1bml0cyA9IHVuaXRzIHx8IEluZmluaXR5OwogICAgICAgIGxldCBjb2RlUG9pbnQ7CiAgICAgICAgY29uc3QgbGVuZ3RoID0gc3RyaW5nLmxlbmd0aDsKICAgICAgICBsZXQgbGVhZFN1cnJvZ2F0ZSA9IG51bGw7CiAgICAgICAgY29uc3QgYnl0ZXMgPSBbXTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgKytpKSB7CiAgICAgICAgICBjb2RlUG9pbnQgPSBzdHJpbmcuY2hhckNvZGVBdChpKTsKICAgICAgICAgIGlmIChjb2RlUG9pbnQgPiA1NTI5NSAmJiBjb2RlUG9pbnQgPCA1NzM0NCkgewogICAgICAgICAgICBpZiAoIWxlYWRTdXJyb2dhdGUpIHsKICAgICAgICAgICAgICBpZiAoY29kZVBvaW50ID4gNTYzMTkpIHsKICAgICAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkKICAgICAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgIH0gZWxzZSBpZiAoaSArIDEgPT09IGxlbmd0aCkgewogICAgICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgICAgICBieXRlcy5wdXNoKDIzOSwgMTkxLCAxODkpOwogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGxlYWRTdXJyb2dhdGUgPSBjb2RlUG9pbnQ7CiAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGNvZGVQb2ludCA8IDU2MzIwKSB7CiAgICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50OwogICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGNvZGVQb2ludCA9IChsZWFkU3Vycm9nYXRlIC0gNTUyOTYgPDwgMTAgfCBjb2RlUG9pbnQgLSA1NjMyMCkgKyA2NTUzNjsKICAgICAgICAgIH0gZWxzZSBpZiAobGVhZFN1cnJvZ2F0ZSkgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpCiAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgIH0KICAgICAgICAgIGxlYWRTdXJyb2dhdGUgPSBudWxsOwogICAgICAgICAgaWYgKGNvZGVQb2ludCA8IDEyOCkgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDEpIDwgMCkKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgYnl0ZXMucHVzaChjb2RlUG9pbnQpOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPCAyMDQ4KSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMikgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiA2IHwgMTkyLCBjb2RlUG9pbnQgJiA2MyB8IDEyOCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA8IDY1NTM2KSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiAxMiB8IDIyNCwgY29kZVBvaW50ID4+IDYgJiA2MyB8IDEyOCwgY29kZVBvaW50ICYgNjMgfCAxMjgpOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPCAxMTE0MTEyKSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gNCkgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiAxOCB8IDI0MCwgY29kZVBvaW50ID4+IDEyICYgNjMgfCAxMjgsIGNvZGVQb2ludCA+PiA2ICYgNjMgfCAxMjgsIGNvZGVQb2ludCAmIDYzIHwgMTI4KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigiSW52YWxpZCBjb2RlIHBvaW50Iik7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBieXRlczsKICAgICAgfQogICAgICBmdW5jdGlvbiBhc2NpaVRvQnl0ZXMoc3RyKSB7CiAgICAgICAgY29uc3QgYnl0ZUFycmF5ID0gW107CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBzdHIubGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGJ5dGVBcnJheS5wdXNoKHN0ci5jaGFyQ29kZUF0KGkpICYgMjU1KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ5dGVBcnJheTsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNmxlVG9CeXRlcyhzdHIsIHVuaXRzKSB7CiAgICAgICAgbGV0IGMsIGhpLCBsbzsKICAgICAgICBjb25zdCBieXRlQXJyYXkgPSBbXTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0ci5sZW5ndGg7ICsraSkgewogICAgICAgICAgaWYgKCh1bml0cyAtPSAyKSA8IDApCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgYyA9IHN0ci5jaGFyQ29kZUF0KGkpOwogICAgICAgICAgaGkgPSBjID4+IDg7CiAgICAgICAgICBsbyA9IGMgJSAyNTY7CiAgICAgICAgICBieXRlQXJyYXkucHVzaChsbyk7CiAgICAgICAgICBieXRlQXJyYXkucHVzaChoaSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBieX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cnRpZXMoQ29uc3RydWN0b3IucHJvdG90eXBlLCBwcm90b1Byb3BzKTsKICAgICAgICBpZiAoc3RhdGljUHJvcHMpCiAgICAgICAgICBfZGVmaW5lUHJvcGVydGllcyhDb25zdHJ1Y3Rvciwgc3RhdGljUHJvcHMpOwogICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShDb25zdHJ1Y3RvciwgInByb3RvdHlwZSIsIHsKICAgICAgICAgIHdyaXRhYmxlOiBmYWxzZQogICAgICAgIH0pOwogICAgICAgIHJldHVybiBDb25zdHJ1Y3RvcjsKICAgICAgfQogICAgICBmdW5jdGlvbiBfaW5oZXJpdHMoc3ViQ2xhc3MsIHN1cGVyQ2xhc3MpIHsKICAgICAgICBpZiAodHlwZW9mIHN1cGVyQ2xhc3MgIT09ICJmdW5jdGlvbiIgJiYgc3VwZXJDbGFzcyAhPT0gbnVsbCkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiU3VwZXIgZXhwcmVzc2lvbiBtdXN0IGVpdGhlciBiZSBudWxsIG9yIGEgZnVuY3Rpb24iKTsKICAgICAgICB9CiAgICAgICAgc3ViQ2xhc3MucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShzdXBlckNsYXNzICYmIHN1cGVyQ2xhc3MucHJvdG90eXBlLCB7CiAgICAgICAgICBjb25zdHJ1Y3RvcjogewogICAgICAgICAgICB2YWx1ZTogc3ViQ2xhc3MsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlLAogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoc3ViQ2xhc3MsICJwcm90b3R5cGUiLCB7CiAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KTsKICAgICAgICBpZiAoc3VwZXJDbGFzcykKICAgICAgICAgIF9zZXRQcm90b3R5cGVPZihzdWJDbGFzcywgc3VwZXJDbGFzcyk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mKG8pIHsKICAgICAgICBfZ2V0UHJvdG90eXBlT2YgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgPyBPYmplY3QuZ2V0UHJvdG90eXBlT2YuYmluZCgpIDogZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mMihvMikgewogICAgICAgICAgcmV0dXJuIG8yLl9fcHJvdG9fXyB8fCBPYmplY3QuZ2V0UHJvdG90eXBlT2YobzIpOwogICAgICAgIH07CiAgICAgICAgcmV0dXJuIF9nZXRQcm90b3R5cGVPZihvKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YobywgcCkgewogICAgICAgIF9zZXRQcm90b3R5cGVPZiA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiA/IE9iamVjdC5zZXRQcm90b3R5cGVPZi5iaW5kKCkgOiBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YyKG8yLCBwMikgewogICAgICAgICAgbzIuX19wcm90b19fID0gcDI7CiAgICAgICAgICByZXR1cm4gbzI7CiAgICAgICAgfTsKICAgICAgICByZXR1cm4gX3NldFByb3RvdHlwZU9mKG8sIHApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9pc05hdGl2ZVJlZmxlY3RDb25zdHJ1Y3QoKSB7CiAgICAgICAgaWYgKHR5cGVvZiBSZWZsZWN0ID09PSAidW5kZWZpbmVkIiB8fCAhUmVmbGVjdC5jb25zdHJ1Y3QpCiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKFJlZmxlY3QuY29uc3RydWN0LnNoYW0pCiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKHR5cGVvZiBQcm94eSA9PT0gImZ1bmN0aW9uIikKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIHRyeSB7CiAgICAgICAgICBCb29sZWFuLnByb3RvdHlwZS52YWx1ZU9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cmV0dXJuIGZ1bmN0aW9uIF9jcmVhdGVTdXBlckludGVybmFsKCkgewogICAgICAgICAgdmFyIFN1cGVyID0gX2dldFByb3RvdHlwZU9mKERlcml2ZWQpLCByZXN1bHQ7CiAgICAgICAgICBpZiAoaGFzTmF0aXZlUmVmbGVjdENvbnN0cnVjdCkgewogICAgICAgICAgICB2YXIgTmV3VGFyZ2V0ID0gX2dldFByb3RvdHlwZU9mKHRoaXMpLmNvbnN0cnVjdG9yOwogICAgICAgICAgICByZXN1bHQgPSBSZWZsZWN0LmNvbnN0cnVjdChTdXBlciwgYXJndW1lbnRzLCBOZXdUYXJnZXQpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmVzdWx0ID0gU3VwZXIuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBfcG9zc2libGVDb25zdHJ1Y3RvclJldHVybih0aGlzLCByZXN1bHQpOwogICAgICAgIH07CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX3N1cGVyUHJvcEJhc2Uob2JqZWN0LCBwcm9wZXJ0eSkgewogICAgICAgIHdoaWxlICghT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwgcHJvcGVydHkpKSB7CiAgICAgICAgICBvYmplY3QgPSBfZ2V0UHJvdG90eXBlT2Yob2JqZWN0KTsKICAgICAgICAgIGlmIChvYmplY3QgPT09IG51bGwpCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICByZXR1cm4gb2JqZWN0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9nZXQoKSB7CiAgICAgICAgaWYgKHR5cGVvZiBSZWZsZWN0ICE9PSAidW5kZWZpbmVkIiAmJiBSZWZsZWN0LmdldCkgewogICAgICAgICAgX2dldCA9IFJlZmxlY3QuZ2V0LmJpbmQoKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgX2dldCA9IGZ1bmN0aW9uIF9nZXQyKHRhcmdldCwgcHJvcGVydHksIHJlY2VpdmVyKSB7CiAgICAgICAgICAgIHZhciBiYXNlID0gX3N1cGVyUHJvcEJhc2UodGFyZ2V0LCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmICghYmFzZSkKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIHZhciBkZXNjID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihiYXNlLCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmIChkZXNjLmdldCkgewogICAgICAgICAgICAgIHJldHVybiBkZXNjLmdldC5jYWxsKGFyZ3VtZW50cy5sZW5ndGggPCAzID8gdGFyZ2V0IDogcmVjZWl2ZXIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBkZXNjLnZhbHVlOwogICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIF9nZXQuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgfQogICAgICB2YXIgRW1pdHRlciA9IC8qIEBfX1BVUkVfXyAqLyBmdW5jdGlvbigpIHsKICAgICAgICBmdW5jdGlvbiBFbWl0dGVyMigpIHsKICAgICAgICAgIF9jbGFzc0NhbGxDaGVjayh0aGlzLCBFbWl0dGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgImxpc3RlbmVycyIsIHsKICAgICAgICAgICAgdmFsdWU6IHt9LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEVtaXR0ZXIyLCBbewogICAgICAgICAga2V5OiAiYWRkRXZlbnRMaXN0ZW5lciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWRkRXZlbnRMaXN0ZW5lcih0eXBlLCBjYWxsYmFjaywgb3B0aW9ucykgewogICAgICAgICAgICBpZiAoISh0eXBlIGluIHRoaXMubGlzdGVuZXJzKSkgewogICAgICAgICAgICAgIHRoaXMubGlzdGVuZXJzW3R5cGVdID0gW107CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5saXN0ZW5lcnNbdHlwZV0ucHVzaCh7CiAgICAgICAgICAgICAgY2FsbGJhY2ssCiAgICAgICAgICAgICAgb3B0aW9ucwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJyZW1vdmVFdmVudExpc3RlbmVyIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiByZW1vdmVFdmVudExpc3RlbmVyKHR5cGUsIGNhbGxiYWNrKSB7CiAgICAgICAgICAgIGlmICghKHR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW3R5cGVdOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIGlmIChzdGFja1tpXS5jYWxsYmFjayA9PT0gY2FsbGJhY2spIHsKICAgICAgICAgICAgICAgIHN0YWNrLnNwbGljZShpLCAxKTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJkaXNwYXRjaEV2ZW50IiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBkaXNwYXRjaEV2ZW50KGV2ZW50KSB7CiAgICAgICAgICAgIGlmICghKGV2ZW50LnR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW2V2ZW50LnR5cGVdOwogICAgICAgICAgICB2YXIgc3RhY2tUb0NhbGwgPSBzdGFjay5zbGljZSgpOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrVG9DYWxsLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIHZhciBsaXN0ZW5lciA9IHN0YWNrVG9DYWxsW2ldOwogICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBsaXN0ZW5lci5jYWxsYmFjay5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBQcm9taXNlLnJlc29sdmUoKS50aGVuKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChsaXN0ZW5lci5vcHRpb25zICYmIGxpc3RlbmVyLm9wdGlvbnMub25jZSkgewogICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVFdmVudExpc3RlbmVyKGV2ZW50LnR5cGUsIGxpc3RlbmVyLmNhbGxiYWNrKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuICFldmVudC5kZWZhdWx0UHJldmVudGVkOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gRW1pdHRlcjI7CiAgICAgIH0oKTsKICAgICAgdmFyIEFib3J0U2lnbmFsID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKF9FbWl0dGVyKSB7CiAgICAgICAgX2luaGVyaXRzKEFib3J0U2lnbmFsMiwgX0VtaXR0ZXIpOwogICAgICAgIHZhciBfc3VwZXIgPSBfY3JlYXRlU3VwZXIoQWJvcnRTaWduYWwyKTsKICAgICAgICBmdW5jdGlvbiBBYm9ydFNpZ25hbDIoKSB7CiAgICAgICAgICB2YXIgX3RoaXM7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRTaWduYWwyKTsKICAgICAgICAgIF90aGlzID0gX3N1cGVyLmNhbGwodGhpcyk7CiAgICAgICAgICBpZiAoIV90aGlzLmxpc3RlbmVycykgewogICAgICAgICAgICBFbWl0dGVyLmNhbGwoX2Fzc2VydFRoaXNJbml0aWFsaXplZChfdGhpcykpOwogICAgICAgICAgfQogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KF9hc3NlcnRUaGlzSW5pdGlhbGl6ZWQoX3RoaXMpLCAiYWJvcnRlZCIsIHsKICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgIm9uYWJvcnQiLCB7CiAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgInJlYXNvbiIsIHsKICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgICByZXR1cm4gX3RoaXM7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhBYm9ydFNpZ25hbDIsIFt7CiAgICAgICAgICBrZXk6ICJ0b1N0cmluZyIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gdG9TdHJpbmcoKSB7CiAgICAgICAgICAgIHJldHVybiAiW29iamVjdCBBYm9ydFNpZ25hbF0iOwogICAgICAgICAgfQogICAgICAgIH0sIHsKICAgICAgICAgIGtleTogImRpc3BhdGNoRXZlbnQiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGRpc3BhdGNoRXZlbnQoZXZlbnQpIHsKICAgICAgICAgICAgaWYgKGV2ZW50LnR5cGUgPT09ICJhYm9ydCIpIHsKICAgICAgICAgICAgICB0aGlzLmFib3J0ZWQgPSB0cnVlOwogICAgICAgICAgICAgIGlmICh0eXBlb2YgdGhpcy5vbmFib3J0ID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICB0aGlzLm9uYWJvcnQuY2FsbCh0aGlzLCBldmVudCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIF9nZXQoX2dldFByb3RvdHlwZU9mKEFib3J0U2lnbmFsMi5wcm90b3R5cGUpLCAiZGlzcGF0Y2hFdmVudCIsIHRoaXMpLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gQWJvcnRTaWduYWwyOwogICAgICB9KEVtaXR0ZXIpOwogICAgICB2YXIgQWJvcnRDb250cm9sbGVyID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKCkgewogICAgICAgIGZ1bmN0aW9uIEFib3J0Q29udHJvbGxlcjIoKSB7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRDb250cm9sbGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgInNpZ25hbCIsIHsKICAgICAgICAgICAgdmFsdWU6IG5ldyBBYm9ydFNpZ25hbCgpLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEFib3J0Q29udHJvbGxlcjIsIFt7CiAgICAgICAgICBrZXk6ICJhYm9ydCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWJvcnQocmVhc29uKSB7CiAgICAgICAgICAgIHZhciBldmVudDsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBldmVudCA9IG5ldyBFdmVudCgiYWJvcnQiKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgIGlmICh0eXBlb2YgZG9jdW1lbnQgIT09ICJ1bmRlZmluZWQiKSB7CiAgICAgICAgICAgICAgICBpZiAoIWRvY3VtZW50LmNyZWF0ZUV2ZW50KSB7CiAgICAgICAgICAgICAgICAgIGV2ZW50ID0gZG9jdW1lbnQuY3JlYXRlRXZlbnRPYmplY3QoKTsKICAgICAgICAgICAgICAgICAgZXZlbnQudHlwZSA9ICJhYm9ydCI7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBldmVudCA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCJFdmVudCIpOwogICAgICAgICAgICAgICAgICBldmVudC5pbml0RXZlbnQoImFib3J0IiwgZmFsc2UsIGZhbHNlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZXZlbnQgPSB7CiAgICAgICAgICAgICAgICAgIHR5cGU6ICJhYm9ydCIsCiAgICAgICAgICAgICAgICAgIGJ1YmJsZXM6IGZhbHNlLAogICAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHNpZ25hbFJlYXNvbiA9IHJlYXNvbjsKICAgICAgICAgICAgaWYgKHNpZ25hbFJlYXNvbiA9PT0gdm9pZCAwKSB7CiAgICAgICAgICAgICAgaWYgKHR5cGVvZiBkb2N1bWVudCA9PT0gInVuZGVmaW5lZCIpIHsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbi5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24gPSBuZXcgRE9NRXhjZXB0aW9uKCJzaWduYWwgaXMgYWJvcnRlZCB3aXRob3V0IHJlYXNvbiIpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgICAgc2lnbmFsUmVhc29uLm5hbWUgPSAiQWJvcnRFcnJvciI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMuc2lnbmFsLnJlYXNvbiA9IHNpZ25hbFJlYXNvbjsKICAgICAgICAgICAgdGhpcy5zaWduYWwuZGlzcGF0Y2hFdmVudChldmVudCk7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAidG9TdHJpbmciLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIHRvU3RyaW5nKCkgewogICAgICAgICAgICByZXR1cm4gIltvYmplY3QgQWJvcnRDb250cm9sbGVyXSI7CiAgICAgICAgICB9CiAgICAgICAgfV0pOwogICAgICAgIHJldHVybiBBYm9ydENvbnRyb2xsZXIyOwogICAgICB9KCk7CiAgICAgIGlmICh0eXBlb2YgU3ltYm9sICE9PSAidW5kZWZpbmVkIiAmJiBTeW1ib2wudG9TdHJpbmdUYWcpIHsKICAgICAgICBBYm9ydENvbnRyb2xsZXIucHJvdG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2YXIgc2lnbmFsOwogICAgICAgICAgICBpZiAoaW5pdDIgJiYgaW5pdDIuc2lnbmFsKSB7CiAgICAgICAgICAgICAgc2lnbmFsID0gaW5pdDIuc2lnbmFsOwogICAgICAgICAgICAgIGRlbGV0ZSBpbml0Mi5zaWduYWw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHJlcXVlc3QgPSBuZXcgTmF0aXZlUmVxdWVzdChpbnB1dCwgaW5pdDIpOwogICAgICAgICAgICBpZiAoc2lnbmFsKSB7CiAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHJlcXVlc3QsICJzaWduYWwiLCB7CiAgICAgICAgICAgICAgICB3cml0YWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICAgIHZhbHVlOiBzaWduYWwKICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmVxdWVzdDsKICAgICAgICAgIH07CiAgICAgICAgICBSZXF1ZXN0LnByb3RvdHlwZSA9IE5hdGl2ZVJlcXVlc3QucHJvdG90eXBlOwogICAgICAgIH0KICAgICAgICB2YXIgcmVhbEZldGNoID0gZmV0Y2g7CiAgICAgICAgdmFyIGFib3J0YWJsZUZldGNoID0gZnVuY3Rpb24gYWJvcnRhYmxlRmV0Y2gyKGlucHV0LCBpbml0MikgewogICAgICAgICAgdmFyIHNpZ25hbCA9IFJlcXVlc3QgJiYgUmVxdWVzdC5wcm90b3R5cGUuaXNQcm90b3R5cGVPZihpbnB1dCkgPyBpbnB1dC5zaWduYWwgOiBpbml0MiA/IGluaXQyLnNpZ25hbCA6IHZvaWQgMDsKICAgICAgICAgIGlmIChzaWduYWwpIHsKICAgICAgICAgICAgdmFyIGFib3J0RXJyb3I7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgYWJvcnRFcnJvciA9IG5ldyBET01FeGNlcHRpb24oIkFib3J0ZWQiLCAiQWJvcnRFcnJvciIpOwogICAgICAgICAgICB9IGNhdGNoIChlcnIpIHsKICAgICAgICAgICAgICBhYm9ydEVycm9yID0gbmV3IEVycm9yKCJBYm9ydGVkIik7CiAgICAgICAgICAgICAgYWJvcnRFcnJvci5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzaWduYWwuYWJvcnRlZCkgewogICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChhYm9ydEVycm9yKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgY2FuY2VsbGF0aW9uID0gbmV3IFByb21pc2UoZnVuY3Rpb24oXywgcmVqZWN0KSB7CiAgICAgICAgICAgICAgc2lnbmFsLmFkZEV2ZW50TGlzdGVuZXIoImFib3J0IiwgZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gcmVqZWN0KGFib3J0RXJyb3IpOwogICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIG9uY2U6IHRydWUKICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGlmIChpbml0MiAmJiBpbml0Mi5zaWduYWwpIHsKICAgICAgICAgICAgICBkZWxldGUgaW5pdDIuc2lnbmFsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJhY2UoW2NhbmNlbGxhdGlvbiwgcmVhbEZldGNoKGlucHV0LCBpbml0MildKTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiByZWFsRmV0Y2goaW5wdXQsIGluaXQyKTsKICAgICAgICB9OwogICAgICAgIHJldHVybiB7CiAgICAgICAgICBmZXRjaDogYWJvcnRhYmxlRmV0Y2gsCiAgICAgICAgICBSZXF1ZXN0CiAgICAgICAgfTsKICAgICAgfQogICAgICBleHBvcnRzMi5BYm9ydENvbnRyb2xsZXIg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zZS1jYWNoZS9lc20vQWdncmVnYXRlQWJvcnRDb250cm9sbGVyLmpzIihleHBvcnRzMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGV4cG9ydHMyLCAiX19lc01vZHVsZSIsIHsgdmFsdWU6IHRydWUgfSk7CiAgICAgIHZhciBhYm9ydGNvbnRyb2xsZXJfcG9ueWZpbGxfMSA9IHJlcXVpcmVfYWJvcnRjb250cm9sbGVyX3BvbnlmaWxsKCk7CiAgICAgIHZhciBOdWxsU2lnbmFsID0gY2xhc3MgewogICAgICB9OwogICAgICB2YXIgQWdncmVnYXRlQWJvcnRDb250cm9sbGVyID0gY2xhc3MgewogICAgICAgIGNvbnN0cnVjdG9yKCkgewogICAgICAgICAgdGhpcy5zaWduYWxzID0gbmV3IFNldCgpOwogICAgICAgICAgdGhpcy5hYm9ydENvbnRyb2xsZXIgPSBuZXcgYWJvcnRjb250cm9sbGVyX3BvbnlmaWxsXzEuQWJvcnRDb250cm9sbGVyKCk7CiAgICAgICAgfQogICAgICAgIGFkZFNpZ25hbChzaWduYWwgPSBuZXcgTnVsbFNpZ25hbCgpKSB7CiAgICAgICAgICBpZiAodGhpcy5zaWduYWwuYWJvcnRlZCkgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoImNhbm5vdCBhZGQgYSBzaWduYWwsIGFscmVhZHkgYWJvcnRlZCEiKTsKICAgICAgICAgIH0KICAgICAgICAgIHRoaXMuc2lnbmFscy5hZGQoc2lnbmFsKTsKICAgICAgICAgIGlmIChzaWduYWwuYWJvcnRlZCkgewogICAgICAgICAgICB0aGlzLmhhbmRsZUFib3J0ZWQoc2lnbmFsKTsKICAgICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIHNpZ25hbC5hZGRFdmVudExpc3RlbmVyID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIHNpZ25hbC5hZGR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A9IG5ldyBBZ2dyZWdhdGVBYm9ydENvbnRyb2xsZXJfMS5kZWZhdWx0KCk7CiAgICAgICAgICBjb25zdCBzdGF0dXNSZXBvcnRlciA9IG5ldyBBZ2dyZWdhdGVTdGF0dXNSZXBvcnRlcl8xLmRlZmF1bHQoKTsKICAgICAgICAgIHN0YXR1c1JlcG9ydGVyLmFkZENhbGxiYWNrKHN0YXR1c0NhbGxiYWNrKTsKICAgICAgICAgIGNvbnN0IG5ld0VudHJ5ID0gewogICAgICAgICAgICBhYm9ydGVyLAogICAgICAgICAgICBwcm9taXNlOiB0aGlzLmZpbGxDYWxsYmFjayhkYXRhLCBhYm9ydGVyLnNpZ25hbCwgKG1lc3NhZ2UpID0+IHsKICAgICAgICAgICAgICBzdGF0dXNSZXBvcnRlci5jYWxsYmFjayhtZXNzYWdlKTsKICAgICAgICAgICAgfSksCiAgICAgICAgICAgIHNldHRsZWQ6IGZhbHNlLAogICAgICAgICAgICBzdGF0dXNSZXBvcnRlciwKICAgICAgICAgICAgZ2V0IGFib3J0ZWQoKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuYWJvcnRlci5zaWduYWwuYWJvcnRlZDsKICAgICAgICAgICAgfQogICAgICAgICAgfTsKICAgICAgICAgIG5ld0VudHJ5LmFib3J0ZXIuYWRkU2lnbmFsKHNpZ25hbCk7CiAgICAgICAgICBuZXdFbnRyeS5hYm9ydGVyLnNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsICgpID0+IHsKICAgICAgICAgICAgaWYgKCFuZXdFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgdGhpcy5ldmljdChrZXksIG5ld0VudHJ5KTsKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgICBuZXdFbnRyeS5wcm9taXNlLnRoZW4oKCkgPT4gewogICAgICAgICAgICBuZXdFbnRyeS5zZXR0bGVkID0gdHJ1ZTsKICAgICAgICAgIH0sICgpID0+IHsKICAgICAgICAgICAgbmV3RW50cnkuc2V0dGxlZCA9IHRydWU7CiAgICAgICAgICAgIHRoaXMuZXZpY3Qoa2V5LCBuZXdFbnRyeSk7CiAgICAgICAgICB9KS5jYXRjaCgoZSkgPT4gewogICAgICAgICAgICBjb25zb2xlLmVycm9yKGUpOwogICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgfSk7CiAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIG5ld0VudHJ5KTsKICAgICAgICB9CiAgICAgICAgc3RhdGljIGNoZWNrU2luZ2xlUHJvbWlzZShwcm9taXNlLCBzaWduYWwpIHsKICAgICAgICAgIGZ1bmN0aW9uIGNoZWNrRm9yU2luZ2xlQWJvcnQoKSB7CiAgICAgICAgICAgIGlmIChzaWduYWwgJiYgc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICB0aHJvdyBPYmplY3QuYXNzaWduKG5ldyBFcnJvcigiYWJvcnRlZCIpLCB7IGNvZGU6ICJFUlJfQUJPUlRFRCIgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBwcm9taXNlLnRoZW4oKHJlc3VsdCkgPT4gewogICAgICAgICAgICBjaGVja0ZvclNpbmdsZUFib3J0KCk7CiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICAgICB9LCAoZXJyb3IpID0+IHsKICAgICAgICAgICAgY2hlY2tGb3JTaW5nbGVBYm9ydCgpOwogICAgICAgICAgICB0aHJvdyBlcnJvcjsKICAgICAgICAgIH0pOwogICAgICAgIH0KICAgICAgICBoYXMoa2V5KSB7CiAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5oYXMoa2V5KTsKICAgICAgICB9CiAgICAgICAgZ2V0KGtleSwgZGF0YSwgc2lnbmFsLCBzdGF0dXNDYWxsYmFjaykgewogICAgICAgICAgaWYgKCFzaWduYWwgJiYgZGF0YSBpbnN0YW5jZW9mIGFib3J0Y29udHJvbGxlcl9wb255ZmlsbF8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jaGVja1NpbmdsZVByb21pc2UodGhpcy5jYWNoZS5nZXQoa2V5KS5wcm9taXNlLCBzaWduYWwpOwogICAgICAgIH0KICAgICAgICBkZWxldGUoa2V5KSB7CiAgICAgICAgICBjb25zdCBjYWNoZWRFbnRyeSA9IHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICBpZiAoY2FjaGVkRW50cnkpIHsKICAgICAgICAgICAgaWYgKCFjYWNoZWRFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgY2FjaGVkRW50cnkuYWJvcnRlci5hYm9ydCgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMuY2FjaGUuZGVsZXRlKGtleSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNsZWFyKCkgewogICAgICAgICAgY29uc3Qga2V5SXRlciA9IHRoaXMuY2FjaGUua2V5cygpOwogICAgICAgICAgbGV0IGRlbGV0ZUNvdW50ID0gMDsKICAgICAgICAgIGZvciAobGV0IHJlc3VsdCA9IGtleUl0ZXIubmV4dCgpOyAhcmVzdWx0LmRvbmU7IHJlc3VsdCA9IGtleUl0ZXIubmV4dCgpKSB7CiAgICAgICAgICAgIHRoaXMuZGVsZXRlKHJlc3VsdC52YWx1ZSk7CiAgICAgICAgICAgIGRlbGV0ZUNvdW50ICs9IDE7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gZGVsZXRlQ291bnQ7CiAgICAgICAgfQogICAgICB9OwogICAgICBleHBvcnRzMi5kZWZhdWx0ID0gQWJvcnRhYmxlUHJvbWlzZUNhY2hlMjsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL2Fib3J0YWJsZS1wcm9taXNlLWNhY2hlQDEuNS4wL25vZGVfbW9kdWxlcy9hYm9ydGFibGUtcHJvbWlzZS1jYWNoZS9lc20vaW5kZXguanMKICB2YXIgcmVxdWlyZV9lc20gPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHV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vcihvcHRpb25zID0ge30pIHsKICAgICAgICAgIGlmICghKG9wdGlvbnMubWF4U2l6ZSAmJiBvcHRpb25zLm1heFNpemUgPiAwKSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJgbWF4U2l6ZWAgbXVzdCBiZSBhIG51bWJlciBncmVhdGVyIHRoYW4gMCIpOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5tYXhTaXplID0gb3B0aW9ucy5tYXhTaXplOwogICAgICAgICAgdGhpcy5jYWNoZSA9IG5ldyBNYXAoKTsKICAgICAgICAgIHRoaXMub2xkQ2FjaGUgPSBuZXcgTWFwKCk7CiAgICAgICAgICB0aGlzLl9zaXplID0gMDsKICAgICAgICB9CiAgICAgICAgX3NldChrZXksIHZhbHVlKSB7CiAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIHZhbHVlKTsKICAgICAgICAgIHRoaXMuX3NpemUrKzsKICAgICAgICAgIGlmICh0aGlzLl9zaXplID49IHRoaXMubWF4U2l6ZSkgewogICAgICAgICAgICB0aGlzLl9zaXplID0gMDsKICAgICAgICAgICAgdGhpcy5vbGRDYWNoZSA9IHRoaXMuY2FjaGU7CiAgICAgICAgICAgIHRoaXMuY2FjaGUgPSBuZXcgTWFwKCk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGdldChrZXkpIHsKICAgICAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLmNhY2hlLmdldChrZXkpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHRoaXMub2xkQ2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgY29uc3QgdmFsdWUgPSB0aGlzLm9sZENhY2hlLmdldChrZXkpOwogICAgICAgICAgICB0aGlzLm9sZENhY2hlLmRlbGV0ZShrZXkpOwogICAgICAgICAgICB0aGlzLl9zZXQoa2V5LCB2YWx1ZSk7CiAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgc2V0KGtleSwgdmFsdWUpIHsKICAgICAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHRoaXMuY2FjaGUuc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdGhpcy5fc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgfQogICAgICAgIGhhcyhrZXkpIHsKICAgICAgICAgIHJldHVybiB0aGlzLmNhY2hlLmhhcyhrZXkpIHx8IHRoaXMub2xkQ2FjaGUuaGFzKGtleSk7CiAgICAgICAgfQogICAgICAgIHBlZWsoa2V5KSB7CiAgICAgICAgICBpZiAodGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5nZXQoa2V5KTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0aGlzLm9sZENhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLm9sZENhY2hlLmdldChrZXkpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkZWxldGUoa2V5KSB7CiAgICAgICAgICBjb25zdCBkZWxldGVkID0gdGhpcy5jYWNoZS5kZWxldGUoa2V5KTsKICAgICAgICAgIGlmIChkZWxldGVkKSB7CiAgICAgICAgICAgIHRoaXMuX3NpemUtLTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiB0aGlzLm9sZENhY2hlLmRlbGV0ZShrZXkpIHx8IGRlbGV0ZWQ7CiAgICAgICAgfQogICAgICAgIGNsZWFyKCkgewogICAgICAgICAgdGhpcy5jYWNoZS5jbGVhcigpOwogICAgICAgICAgdGhpcy5vbGRDYWNoZS5jbGVhcigpOwogICAgICAgICAgdGhpcy5fc2l6ZSA9IDA7CiAgICAgICAgfQogICAgICAgICprZXlzKCkgewogICAgICAgICAgZm9yIChjb25zdCBba2V5XSBvZiB0aGlzKSB7CiAgICAgICAgICAgIHlpZWxkIGtleTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgKnZhbHVlcygpIHsKICAgICAgICAgIGZvciAoY29uc3QgWywgdmFsdWVdIG9mIHRoaXMpIHsKICAgICAgICAgICAgeWllbGQgdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgICpbU3ltYm9sLml0ZXJhdG9yXSgpIHsKICAgICAgICAgIGZvciAoY29uc3QgaXRlbSBvZiB0aGlzLmNhY2hlKSB7CiAgICAgICAgICAgIHlpZWxkIGl0ZW07CiAgICAgICAgICB9CiAgICAgICAgICBmb3IgKGNvbnN0IGl0ZW0gb2YgdGhpcy5vbGRDYWNoZSkgewogICAgICAgICAgICBjb25zdCBba2V5XSA9IGl0ZW07CiAgICAgICAgICAgIGlmICghdGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICAgIHlpZWxkIGl0ZW07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZ2V0IHNpemUoKSB7CiAgICAgICAgICBsZXQgb2xkQ2FjaGVTaXplID0gMDsKICAgICAgICAgIGZvciAoY29uc3Qga2V5IG9mIHRoaXMub2xkQ2FjaGUua2V5cygpKSB7CiAgICAgICAgICAgIGlmICghdGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICAgIG9sZENhY2hlU2l6ZSsrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gdGhpcy5fc2l6ZSArIG9sZENhY2hlU2l6ZTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIG1vZHVsZTIuZXhwb3J0cyA9IFF1aWNrTFJVOwogICAgfQogIH0pOwoKICAvLyAoZGlzYWJsZWQpOm5vZGVfbW9kdWxlcy8ucG5wbS9nZW5lcmljLWZpbGVoYW5kbGVAMy4xLjEvbm9kZV9tb2R1bGVzL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KICAgICAgICAgIHZhciBzb3VyY2UgPSBzb3VyY2VzLnNoaWZ0KCk7CiAgICAgICAgICBpZiAoIXNvdXJjZSkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0eXBlb2Ygc291cmNlICE9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKHNvdXJjZSArICJtdXN0IGJlIG5vbi1vYmplY3QiKTsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAodmFyIHAgaW4gc291cmNlKSB7CiAgICAgICAgICAgIGlmIChfaGFzKHNvdXJjZSwgcCkpIHsKICAgICAgICAgICAgICBvYmpbcF0gPSBzb3VyY2VbcF07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIG9iajsKICAgICAgfTsKICAgICAgZXhwb3J0czIuc2hyaW5rQnVmID0gZnVuY3Rpb24oYnVmLCBzaXplKSB7CiAgICAgICAgaWYgKGJ1Zi5sZW5ndGggPT09IHNpemUpIHsKICAgICAgICAgIHJldHVybiBidWY7CiAgICAgICAgfQogICAgICAgIGlmIChidWYuc3ViYXJyYXkpIHsKICAgICAgICAgIHJldHVybiBidWYuc3ViYXJyYXkoMCwgc2l6ZSk7CiAgICAgICAgfQogICAgICAgIGJ1Zi5sZW5ndGggPSBzaXplOwogICAgICAgIHJldHVybiBidWY7CiAgICAgIH07CiAgICAgIHZhciBmblR5cGVkID0gewogICAgICAgIGFycmF5U2V0OiBmdW5jdGlvbihkZXN0LCBzcmMsIHNyY19vZmZzLCBsZW4sIGRlc3Rfb2ZmcykgewogICAgICAgICAgaWYgKHNyYy5zdWJhcnJheSAmJiBkZXN0LnN1YmFycmF5KSB7CiAgICAgICAgICAgIGRlc3Quc2V0KHNyYy5zdWJhcnJheShzcmNfb2Zmcywgc3JjX29mZnMgKyBsZW4pLCBkZXN0X29mZnMpOwogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICB9CiAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgICAgIGRlc3RbZGVzdF9vZmZzICsgaV0gPSBzcmNbc3JjX29mZnMgKyBpXTsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIGZsYXR0ZW5DaHVua3M6IGZ1bmN0aW9uKGNodW5rcykgewogICAgICAgICAgdmFyIGksIGwsIGxlbiwgcG9zLCBjaHVuaywgcmVzdWx0OwogICAgICAgICAgbGVuID0gMDsKICAgICAgICAgIGZvciAoaSA9IDAsIGwgPSBjaHVua3MubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgICAgIGxlbiArPSBjaHVua3NbaV0ubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgICAgcmVzdWx0ID0gbmV3IFVpbnQ4QXJyYXkobGVuKTsKICAgICAgICAgIHBvcyA9IDA7CiAgICAgICAgICBmb3IgKGkgPSAwLCBsID0gY2h1bmtzLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICBjaHVuayA9IGNodW5rc1tpXTsKICAgICAgICAgICAgcmVzdWx0LnNldChjaHVuaywgcG9zKTsKICAgICAgICAgICAgcG9zICs9IGNodW5rLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICAgfQogICAgICB9OwogICAgICB2YXIgZm5VbnR5cGVkID0gewogICAgICAgIGFycmF5U2V0OiBmdW5jdGlvbihkZXN0LCBzcmMsIHNyY19vZmZzLCBsZW4sIGRlc3Rfb2ZmcykgewogICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgICBkZXN0W2Rlc3Rfb2ZmcyArIGldID0gc3JjW3NyY19vZmZzICsgaV07CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBmbGF0dGVuQ2h1bmtzOiBmdW5jdGlvbihjaHVua3MpIHsKICAgICAgICAgIHJldHVyb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QgPSAxOwogICAgICB2YXIgWl9VTktOT1dOID0gMjsKICAgICAgZnVuY3Rpb24gemVybyhidWYpIHsKICAgICAgICB2YXIgbGVuID0gYnVmLmxlbmd0aDsKICAgICAgICB3aGlsZSAoLS1sZW4gPj0gMCkgewogICAgICAgICAgYnVmW2xlbl0gPSAwOwogICAgICAgIH0KICAgICAgfQogICAgICB2YXIgU1RPUkVEX0JMT0NLID0gMDsKICAgICAgdmFyIFNUQVRJQ19UUkVFUyA9IDE7CiAgICAgIHZhciBEWU5fVFJFRVMgPSAyOwogICAgICB2YXIgTUlOX01BVENIID0gMzsKICAgICAgdmFyIE1BWF9NQVRDSCA9IDI1ODsKICAgICAgdmFyIExFTkdUSF9DT0RFUyA9IDI5OwogICAgICB2YXIgTElURVJBTFMgPSAyNTY7CiAgICAgIHZhciBMX0NPREVTID0gTElURVJBTFMgKyAxICsgTEVOR1RIX0NPREVTOwogICAgICB2YXIgRF9DT0RFUyA9IDMwOwogICAgICB2YXIgQkxfQ09ERVMgPSAxOTsKICAgICAgdmFyIEhFQVBfU0laRSA9IDIgKiBMX0NPREVTICsgMTsKICAgICAgdmFyIE1BWF9CSVRTID0gMTU7CiAgICAgIHZhciBCdWZfc2l6ZSA9IDE2OwogICAgICB2YXIgTUFYX0JMX0JJVFMgPSA3OwogICAgICB2YXIgRU5EX0JMT0NLID0gMjU2OwogICAgICB2YXIgUkVQXzNfNiA9IDE2OwogICAgICB2YXIgUkVQWl8zXzEwID0gMTc7CiAgICAgIHZhciBSRVBaXzExXzEzOCA9IDE4OwogICAgICB2YXIgZXh0cmFfbGJpdHMgPSBbMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMSwgMSwgMSwgMSwgMiwgMiwgMiwgMiwgMywgMywgMywgMywgNCwgNCwgNCwgNCwgNSwgNSwgNSwgNSwgMF07CiAgICAgIHZhciBleHRyYV9kYml0cyA9IFswLCAwLCAwLCAwLCAxLCAxLCAyLCAyLCAzLCAzLCA0LCA0LCA1LCA1LC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pX3ZhbGlkICYgNjU1MzU7CiAgICAgICAgICBwdXRfc2hvcnQocywgcy5iaV9idWYpOwogICAgICAgICAgcy5iaV9idWYgPSB2YWx1ZSA+PiBCdWZfc2l6ZSAtIHMuYmlfdmFsaWQ7CiAgICAgICAgICBzLmJpX3ZhbGlkICs9IGxlbmd0aCAtIEJ1Zl9zaXplOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBzLmJpX2J1ZiB8PSB2YWx1ZSA8PCBzLmJpX3ZhbGlkICYgNjU1MzU7CiAgICAgICAgICBzLmJpX3ZhbGlkICs9IGxlbmd0aDsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2VuZF9jb2RlKHMsIGMsIHRyZWUpIHsKICAgICAgICBzZW5kX2JpdHMocywgdHJlZVtjICogMl0sIHRyZWVbYyAqIDIgKyAxXSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYmlfcmV2ZXJzZShjb2RlLCBsZW4pIHsKICAgICAgICB2YXIgcmVzID0gMDsKICAgICAgICBkbyB7CiAgICAgICAgICByZXMgfD0gY29kZSAmIDE7CiAgICAgICAgICBjb2RlID4+Pj0gMTsKICAgICAgICAgIHJlcyA8PD0gMTsKICAgICAgICB9IHdoaWxlICgtLWxlbiA+IDApOwogICAgICAgIHJldHVybiByZXMgPj4+IDE7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYmlfZmx1c2gocykgewogICAgICAgIGlmIChzLmJpX3ZhbGlkID09PSAxNikgewogICAgICAgICAgcHV0X3Nob3J0KHMsIHMuYmlfYnVmKTsKICAgICAgICAgIHMuYmlfYnVmID0gMDsKICAgICAgICAgIHMuYmlfdmFsaWQgPSAwOwogICAgICAgIH0gZWxzZSBpZiAocy5iaV92YWxpZCA+PSA4KSB7CiAgICAgICAgICBzLnBlbmRpbmdfYnVmW3MucGVuZGluZysrXSA9IHMuYmlfYnVmICYgMjU1OwogICAgICAgICAgcy5iaV9idWYgPj49IDg7CiAgICAgICAgICBzLmJpX3ZhbGlkIC09IDg7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGdlbl9iaXRsZW4ocywgZGVzYykgewogICAgICAgIHZhciB0cmVlID0gZGVzYy5keW5fdHJlZTsKICAgICAgICB2YXIgbWF4X2NvZGUgPSBkZXNjLm1heF9jb2RlOwogICAgICAgIHZhciBzdHJlZSA9IGRlc2Muc3RhdF9kZXNjLnN0YXRpY190cmVlOwogICAgICAgIHZhciBoYXNfc3RyZWUgPSBkZXNjLnN0YXRfZGVzYy5oYXNfc3RyZWU7CiAgICAgICAgdmFyIGV4dHJhID0gZGVzYy5zdGF0X2Rlc2MuZXh0cmFfYml0czsKICAgICAgICB2YXIgYmFzZSA9IGRlc2Muc3RhdF9kZXNjLmV4dHJhX2Jhc2U7CiAgICAgICAgdmFyIG1heF9sZW5ndGggPSBkZXNjLnN0YXRfZGVzYy5tYXhfbGVuZ3RoOwogICAgICAgIHZhciBoOwogICAgICAgIHZhciBuLCBtOwogICAgICAgIHZhciBiaXRzOwogICAgICAgIHZhciB4Yml0czsKICAgICAgICB2YXIgZjsKICAgICAgICB2YXIgb3ZlcmZsb3cgPSAwOwogICAgICAgIGZvciAoYml0cyA9IDA7IGJpdHMgPD0gTUFYX0JJVFM7IGJpdHMrKykgewogICAgICAgICAgcy5ibF9jb3VudFtiaXRzXSA9IDA7CiAgICAgICAgfQogICAgICAgIHRyZWVbcy5oZWFwW3MuaGVhcF9tYXhdICogMiArIDFdID0gMDsKICAgICAgICBmb3IgKGggPSBzLmhlYXBfbWF4ICsgMTsgaCA8IEhFQVBfU0laRTsgaCsrKSB7CiAgICAgICAgICBuID0gcy5oZWFwW2hdOwogICAgICAgICAgYml0cyA9IHRyZWVbdHJlZVtuICogMiArIDFdICogMiArIDFdICsgMTsKICAgICAgICAgIGlmIChiaXRzID4gbWF4X2xlbmd0aCkgewogICAgICAgICAgICBiaXRzID0gbWF4X2xlbmd0aDsKICAgICAgICAgICAgb3ZlcmZsb3crKzsKICAgICAgICAgIH0KICAgICAgICAgIHRyZWVbbiAqIDIgKyAxXSA9IGJpdHM7CiAgICAgICAgICBpZiAobiA+IG1heF9jb2RlKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgcy5ibF9jb3VudFtiaXRzXSsrOwogICAgICAgICAgeGJpdHMgPSAwOwogICAgICAgICAgaWYgKG4gPj0gYmFzZSkgewogICAgICAgICAgICB4Yml0cyA9IGV4dHJhW24gLSBiYXNlXTsKICAgICAgICAgIH0KICAgICAgICAgIGYgPSB0cmVlW24gKiAyXTsKICAgICAgICAgIHMub3B0X2xlbiArPSBmICogKGJpdHMgKyB4Yml0cyk7CiAgICAgICAgICBpZiAoaGFzX3N0cmVlKSB7CiAgICAgICAgICAgIHMuc3RhdGljX2xlbiArPSBmICogKHN0cmVlW24gKiAyICsgMV0gKyB4Yml0cyk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChvdmVyZmxvdyA9PT0gMCkgewogICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICBkbyB7CiAgICAgICAgICBiaXRzID0gbWF4X2xlbmd0aCAtIDE7CiAgICAgICAgICB3aGlsZSAocy5ibF9jb3VudFtiaXRzXSA9PT0gMCkgewogICAgICAgICAgICBiaXRzLS07CiAgICAgICAgICB9CiAgICAgICAgICBzLmJsX2NvdW50W2JpdHNdLS07CiAgICAgICAgICBzLmJsX2NvdW50W2JpdHMgKyAxXSArPSAyOwogICAgICAgICAgcy5ibF9jb3VudFttYXhfbGVuZ3RoXS0tOwogICAgICAgICAgb3ZlcmZsb3cgLT0gMjsKICAgICAgICB9IHdoaWxlIChvdmVyZmxvdyA+IDApOwogICAgICAgIGZvciAoYml0cyA9IG1heF9sZW5ndGg7IGJpdHMgIT09IDA7IGJpdHMtLSkgewogICAgICAgICAgbiA9IHMuYmxfY291bnRbYml0c107CiAgICAgICAgICB3aGlsZSAobiAhPT0gMCkgewogICAgICAgICAgICBtID0gcy5oZWFwWy0taF07CiAgICAgICAgICAgIGlmIChtID4gbWF4X2NvZGUpIHsKICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodHJlZVttICogMiArIDFdICE9PSBiaXRzKSB7CiAgICAgICAgICAgICAgcy5vcHRfbGVuICs9IChiaXRzIC0gdHJlZVttICogMiArIDFdKSAqIHRyZWVbbSAqIDJdOwogICAgICAgICAgICAgIHRyZWVbbSAqIDIgKyAxXSA9IGJpdHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbi0tOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBnZW5fY29kZXModHJlZSwgbWF4X2NvZGUsIGJsX2NvdW50KSB7CiAgICAgICAgdmFyIG5leHRfY29kZSA9IG5ldyBBcnJheShNQVhfQklUUyArIDEpOwogICAgICAgIHZhciBjb2RlID0gMDsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgbjsKICAgICAgICBmb3IgKGJpdHMgPSAxOyBiaXRzIDw9IE1BWF9CSVRTOyBiaXRzKyspIHsKICAgICAgICAgIG5leHRfY29kZVtiaXRzXSA9IGNvZGUgPSBjb2RlICsgYmxfY291bnRbYml0cyAtIDFdIDw8IDE7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDA7IG4gPD0gbWF4X2NvZGU7IG4rKykgewogICAgICAgICAgdmFyIGxlbiA9IHRyZWVbbiAqIDIgKyAxXTsKICAgICAgICAgIGlmIChsZW4gPT09IDApIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICB0cmVlW24gKiAyXSA9IGJpX3JldmVyc2UobmV4dF9jb2RlW2xlbl0rKywgbGVuKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdHJfc3RhdGljX2luaXQoKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIGJpdHM7CiAgICAgICAgdmFyIGxlbmd0aDsKICAgICAgICB2YXIgY29kZTsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgYmxfY291bnQgPSBuZXcgQXJyYXkoTUFYX0JJVFMgKyAxKTsKICAgICAgICBsZW5ndGggPSAwOwogICAgICAgIGZvciAoY29kZSA9IDA7IGNvZGUgPCBMRU5HVEhfQ09ERVMgLSAxOyBjb2RlKyspIHsKICAgICAgICAgIGJhc2VfbGVuZ3RoW2NvZGVdID0gbGVuZ3RoOwogICAgICAgICAgZm9yIChuID0gMDsgbiA8IDEgPDwgZXh0cmFfbGJpdHNbY29kZV07IG4rKykgewogICAgICAgICAgICBfbGVuZ3RoX2NvZGVbbGVuZ3RoKytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgX2xlbmd0aF9jb2RlW2xlbmd0aCAtIDFdID0gY29kZTsKICAgICAgICBkaXN0ID0gMDsKICAgICAgICBmb3IgKGNvZGUgPSAwOyBjb2RlIDwgMTY7IGNvZGUrKykgewogICAgICAgICAgYmFzZV9kaXN0W2NvZGVdID0gZGlzdDsKICAgICAgICAgIGZvciAobiA9IDA7IG4gPCAxIDw8IGV4dHJhX2RiaXRzW2NvZGVdOyBuKyspIHsKICAgICAgICAgICAgX2Rpc3RfY29kZVtkaXN0KytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZGlzdCA+Pj0gNzsKICAgICAgICBmb3IgKDsgY29kZSA8IERfQ09ERVM7IGNvZGUrKykgewogICAgICAgICAgYmFzZV9kaXN0W2NvZGVdID0gZGlzdCA8PCA3OwogICAgICAgICAgZm9yIChuID0gMDsgbiA8IDEgPDwgZXh0cmFfZGJpdHNbY29kZV0gLSA3OyBuKyspIHsKICAgICAgICAgICAgX2Rpc3RfY29kZVsyNTYgKyBkaXN0KytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZm9yIChiaXRzID0gMDsgYml0cyA8PSBNQVhfQklUUzsgYml0cysrKSB7CiAgICAgICAgICBibF9jb3VudFtiaXRzXSA9IDA7CiAgICAgICAgfQogICAgICAgIG4gPSAwOwogICAgICAgIHdoaWxlIChuIDw9IDE0MykgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA4OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbOF0rKzsKICAgICAgICB9CiAgICAgICAgd2hpbGUgKG4gPD0gMjU1KSB7CiAgICAgICAgICBzdGF0aWNfbHRyZWVbbiAqIDIgKyAxXSA9IDk7CiAgICAgICAgICBuKys7CiAgICAgICAgICBibF9jb3VudFs5XSsrOwogICAgICAgIH0KICAgICAgICB3aGlsZSAobiA8PSAyNzkpIHsKICAgICAgICAgIHN0YXRpY19sdHJlZVtuICogMiArIDFdID0gNzsKICAgICAgICAgIG4rKzsKICAgICAgICAgIGJsX2NvdW50WzddKys7CiAgICAgICAgfQogICAgICAgIHdoaWxlIChuIDw9IDI4NykgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA4OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbOF0rKzsKICAgICAgICB9CiAgICAgICAgZ2VuX2NvZGVzKHN0YXRpY19sdHJlZSwgTF9DT0RFUyArIDEsIGJsX2NvdW50KTsKICAgICAgICBmb3IgKG4gPSAwOyBuIDwgRF9DT0RFUzsgbisrKSB7CiAgICAgICAgICBzdGF0aWNfZHRyZWVbbiAqIDIgKyAxXSA9IDU7CiAgICAgICAgICBzdGF0aWNfZHRyZWVbbiAqIDJdID0gYmlfcmV2ZXJzZShuLCA1KTsKICAgICAgICB9CiAgICAgICAgc3RhdGljX2xfZGVzYyA9IG5ldyBTdGF0aWNUcmVlRGVzYyhzdGF0aWNfbHRyZWUsIGV4dHJhX2xiaXRzLCBMSVRFUkFMUyArIDEsIExfQ09ERVMsIE1BWF9CSVRTKTsKICAgICAgICBzdGF0aWNfZF9kZXNjID0gbmV3IFN0YXRpY1RyZWVEZXNjKHN0YXRpY19kdHJlZSwgZXh0cmFfZGJpdHMsIDAsIERfQ09ERVMsIE1BWF9CSVRTKTsKICAgICAgICBzdGF0aWNfYmxfZGVzYyA9IG5ldyBTdGF0aWNUcmVlRGVzYyhuZXcgQXJyYXkoMCksIGV4dHJhX2JsYml0cywgMCwgQkxfQ09ERVMsIE1BWF9CTF9CSVRTKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbml0X2Jsb2NrKHMpIHsKICAgICAgICB2YXIgbjsKICAgICAgICBmb3IgKG4gPSAwOyBuIDwgTF9DT0RFUzsgbisrKSB7CiAgICAgICAgICBzLmR5bl9sdHJlZVtuICogMl0gPSAwOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAwOyBuIDwgRF9DT0RFUzsgbisrKSB7CiAgICAgICAgICBzLmR5bl9kdHJlZVtuICogMl0gPSAwOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAwOyBuIDwgQkxfQ09ERVM7IG4rKykgewogICAgICAgICAgcy5ibF90cmVlW24gKiAyXSA9IDA7CiAgICAgICAgfQogICAgICAgIHMuZHluX2x0cmVlW0VORF9CTE9DSyAqIDJdID0gMTsKICAgICAgICBzLm9wdF9sZW4gPSBzLnN0YXRpY19sZW4gPSAwOwogICAgICAgIHMubGFzdF9saXQgPSBzLm1hdGNoZXMgPSAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJpX3dpbmR1cChzKSB7CiAgICAgICAgaWYgKHMuYmlfdmFsaWQgPiA4KSB7CiAgICAgICAgICBwdXRfc2hvcnQocywgcy5iaV9idWYpOwogICAgICAgIH0gZWxzZSBpZiAocy5iaV92YWxpZCA+IDApIHsKICAgICAgICAgIHMucGVuZGluZ19idWZbcy5wZW5kaW5nKytdID0gcy5iaV9idWY7CiAgICAgICAgfQogICAgICAgIHMuYmlfYnVmID0gMDsKICAgICAgICBzLmJpX3ZhbGlkID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBjb3B5X2Jsb2NrKHMsIGJ1ZiwgbGVuLCBoZWFkZXIpIHsKICAgICAgICBiaV93aW5kdXAocyk7CiAgICAgICAgaWYgKGhlYWRlcikgewogICAgICAgICAgcHV0X3Nob3J0KHMsIGxlbik7CiAgICAgICAgICBwdXRfc2hvcnQocywgfmxlbik7CiAgICAgICAgfQogICAgICAgIHV0aWxzLmFycmF5U2V0KHMucGVuZGluZ19idWYsIHMud2luZG93LCBidWYsIGxlbiwgcy5wZW5kaW5nKTsKICAgICAgICBzLnBlbmRpbmcgKz0gbGVuOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNtYWxsZXIodHJlZSwgbiwgbSwgZGVwdGgpIHsKICAgICAgICB2YXIgX24yID0gbiAqIDI7CiAgICAgICAgdmFyIF9tMiA9IG0gKiAyOwogICAgICAgIHJldHVybiB0cmVlW19uMl0gPCB0cmVlW19tMl0gfHwgdHJlZVtfbjJdID09PSB0cmVlW19tMl0gJiYgZGVwdGhbbl0gPD0gZGVwdGhbbV07CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcHFkb3duaGVhcChzLCB0cmVlLCBrKSB7CiAgICAgICAgdmFyIHYgPSBzLmhlYXBba107CiAgICAgICAgdmFyIGogPSBrIDw8IDE7CiAgICAgICAgd2hpbGUgKGogPD0gcy5oZWFwX2xlbikgewogICAgICAgICAgaWYgKGogPCBzLmhlYXBfbGVuICYmIHNtYWxsZXIodHJlZSwgcy5oZWFwW2ogKyAxXSwgcy5oZWFwW2pdLCBzLmRlcHRoKSkgewogICAgICAgICAgICBqKys7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc21hbGxlcih0cmVlLCB2LCBzLmhlYXBbal0sIHMuZGVwdGgpKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgcy5oZWFwW2tdID0gcy5oZWFwW2pdOwogICAgICAgICAgayA9IGo7CiAgICAgICAgICBqIDw8PSAxOwogICAgICAgIH0KICAgICAgICBzLmhlYXBba10gPSB2OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGNvbXByZXNzX2Jsb2NrKHMsIGx0cmVlLCBkdHJlZSkgewogICAgICAgIHZhciBkaXN0OwogICAgICAgIHZhciBsYzsKICAgICAgICB2YXIgbHggPSAwOwogICAgICAgIHZhciBjb2RlOwogICAgICAgIHZhciBleHRyYTsKICAgICAgICBpZiAocy5sYXN0X2xpdCAhPT0gMCkgewogICAgICAgICAgZG8gewogICAgICAgICAgICBkaXN0ID0gcy5wZW5kaW5nX2J1ZltzLmRfYnVmICsgbHggKiAyXSA8PCA4IHwgcy5wZW5kaW5nX2J1ZltzLmRfYnVmICsgbHggKiAyICsgMV07CiAgICAgICAgICAgIGxjID0gcy5wZW5kaW5nX2J1ZltzLmxfYnVmICsgbHhdOwogICAgICAgICAgICBseCsrOwogICAgICAgICAgICBpZiAoZGlzdCA9PT0gMCkgewogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBsYywgbHRyZWUpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGNvZGUgPSBfbGVuZ3RoX2NvZGVbbGNdOwogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjb2RlICsgTElURVJBTFMgKyAxLCBsdHJlZSk7CiAgICAgICAgICAgICAgZXh0cmEgPSBleHRyYV9sYml0c1tjb2RlXTsKICAgICAgICAgICAgICBpZiAoZXh0cmEgIT09IDApIHsKICAgICAgICAgICAgICAgIGxjIC09IGJhc2VfbGVuZ3RoW2NvZGVdOwogICAgICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGxjLCBleHRyYSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGRpc3QtLTsKICAgICAgICAgICAgICBjb2RlID0gZF9jb2RlKGRpc3QpOwogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjb2RlLCBkdHJlZSk7CiAgICAgICAgICAgICAgZXh0cmEgPSBleHRyYV9kYml0c1tjb2RlXTsKICAgICAgICAgICAgICBpZiAoZXh0cmEgIT09IDApIHsKICAgICAgICAgICAgICAgIGRpc3QgLT0gYmFzZV9kaXN0W2NvZGVdOwogICAgICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGRpc3QsIGV4dHJhKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gd2hpbGUgKGx4IDwgcy5sYXN0X2xpdCk7CiAgICAgICAgfQogICAgICAgIHNlbmRfY29kZShzLCBFTkRfQkxPQ0ssIGx0cmVlKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBidWlsZF90cmVlKHMsIGRlc2MpIHsKICAgICAgICB2YXIgdHJlZSA9IGRlc2MuZHluX3RyZWU7CiAgICAgICAgdmFyIHN0cmVlID0gZGVzYy5zdGF0X2Rlc2Muc3RhdGljX3RyZWU7CiAgICAgICAgdmFyIGhhc19zdHJlZSA9IGRlc2Muc3RhdF9kZXNjLmhhc19zdHJlZTsKICAgICAgICB2YXIgZWxlbXMgPSBkZXNjLnN0YXRfZGVzYy5lbGVtczsKICAgICAgICB2YXIgbiwgbTsKICAgICAgICB2YXIgbWF4X2NvZGUgPSAtMTsKICAgICAgICB2YXIgbm9kZTsKICAgICAgICBzLmhlYXBfbGVuID0gMDsKICAgICAgICBzLmhlYXBfbWF4ID0gSEVBUF9TSVpFOwogICAgICAgIGZvciAobiA9IDA7IG4gPCBlbGVtczsgbisrKSB7CiAgICAgICAgICBpZiAodHJlZVtuICogMl0gIT09IDApIHsKICAgICAgICAgICAgcy5oZWFwWysrcy5oZWFwX2xlbl0gPSBtYXhfY29kZSA9IG47CiAgICAgICAgICAgIHMuZGVwdGhbbl0gPSAwOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdHJlZVtuICogMiArIDFdID0gMDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgd2hpbGUgKHMuaGVhcF9sZW4gPCAyKSB7CiAgICAgICAgICBub2RlID0gcy5oZWFwWysrcy5oZWFwX2xlbl0gPSBtYXhfY29kZSA8IDIgPyArK21heF9jb2RlIDogMDsKICAgICAgICAgIHRyZWVbbm9kZSAqIDJdID0gMTsKICAgICAgICAgIHMuZGVwdGhbbm9kZV0gPSAwOwogICAgICAgICAgcy5vcHRfbGVuLS07CiAgICAgICAgICBpZiAoaGFzX3N0cmVlKSB7CiAgICAgICAgICAgIHMuc3RhdGljX2xlbiAtPSBzdHJlZVtub2RlICogMiArIDFdOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkZXNjLm1heF9jb2RlID0gbWF4X2NvZGU7CiAgICAgICAgZm9yIChuID0gcy5oZWFwX2xlbiA+PiAxOyBuID49IDE7IG4tLSkgewogICAgICAgICAgcHFkb3duaGVhcChzLCB0cmVlLCBuKTsKICAgICAgICB9CiAgICAgICAgbm9kZSA9IGVsZW1zOwogICAgICAgIGRvIHsKICAgICAgICAgIG4gPSBzLmhlYXBbMV07CiAgICAgICAgICBzLmhlYXBbMV0gPSBzLmhlYXBbcy5oZWFwX2xlbi0tXTsKICAgICAgICAgIHBxZG93bmhlYXAocywgdHJlZSwgMSk7CiAgICAgICAgICBtID0gcy5oZWFwWzFdOwogICAgICAgICAgcy5oZWFwWy0tcy5oZWFwX21heF0gPSBuOwogICAgICAgICAgcy5oZWFwWy0tcy5oZWFwX21heF0gPSBtOwogICAgICAgICAgdHJlZVtub2RlICogMl0gPSB0cmVlW24gKiAyXSArIHRyZWVbbSAqIDJdOwogICAgICAgICAgcy5kZXB0aFtub2RlXSA9IChzLmRlcHRoW25dID49IHMuZGVwdGhbbV0gPyBzLmRlcHRoW25dIDogcy5kZXB0aFttXSkgKyAxOwogICAgICAgICAgdHJlZVtuICogMiArIDFdID0gdHJlZVttICogMiArIDFdID0gbm9kZTsKICAgICAgICAgIHMuaGVhcFsxXSA9IG5vZGUrKzsKICAgICAgICAgIHBxZG93bmhlYXAocywgdHJlZSwgMSk7CiAgICAgICAgfSB3aGlsZSAocy5oZWFwX2xlbiA+PSAyKTsKICAgICAgICBzLmhlYXBbLS1zLmhlYXBfbWF4XSA9IHMuaGVhcFsxXTsKICAgICAgICBnZW5fYml0bGVuKHMsIGRlc2MpOwogICAgICAgIGdlbl9jb2Rlcyh0cmVlLCBtYXhfY29kZSwgcy5ibF9jb3VudCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2Nhbl90cmVlKHMsIHRyZWUsIG1heF9jb2RlKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIHByZXZsZW4gPSAtMTsKICAgICAgICB2YXIgY3VybGVuOwogICAgICAgIHZhciBuZXh0bGVuID0gdHJlZVswICogMiArIDFdOwogICAgICAgIHZhciBjb3VudCA9IDA7CiAgICAgICAgdmFyIG1heF9jb3VudCA9IDc7CiAgICAgICAgdmFyIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgIG1heF9jb3VudCA9IDEzODsKICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgfQogICAgICAgIHRyZWVbKG1heF9jb2RlICsgMSkgKiAyICsgMV0gPSA2NTUzNTsKICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IG1heF9jb2RlOyBuKyspIHsKICAgICAgICAgIGN1cmxlbiA9IG5leHRsZW47CiAgICAgICAgICBuZXh0bGVuID0gdHJlZVsobiArIDEpICogMiArIDFdOwogICAgICAgICAgaWYgKCsrY291bnQgPCBtYXhfY291bnQgJiYgY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkgewogICAgICAgICAgICBzLmJsX3RyZWVbY3VybGVuICogMl0gKz0gY291bnQ7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiAhPT0gMCkgewogICAgICAgICAgICBpZiAoY3VybGVuICE9PSBwcmV2bGVuKSB7CiAgICAgICAgICAgICAgcy5ibF90cmVlW2N1cmxlbiAqIDJdKys7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcy5ibF90cmVlW1JFUF8zXzYgKiAyXSsrOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkgewogICAgICAgICAgICBzLmJsX3RyZWVbUkVQWl8zXzEwICogMl0rKzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuYmxfdHJlZVtSRVBaXzExXzEzOCAqIDJdKys7CiAgICAgICAgICB9CiAgICAgICAgICBjb3VudCA9IDA7CiAgICAgICAgICBwcmV2bGVuID0gY3VybGVuOwogICAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gMTM4OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIGlmIChjdXJsZW4gPT09IG5leHRsZW4pIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNjsKICAgICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDc7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNlbmRfdHJlZShzLCB0cmVlLCBtYXhfY29kZSkgewogICAgICAgIHZhciBuOwogICAgICAgIHZhciBwcmV2bGVuID0gLTE7CiAgICAgICAgdmFyIGN1cmxlbjsKICAgICAgICB2YXIgbmV4dGxlbiA9IHRyZWVbMCAqIDIgKyAxXTsKICAgICAgICB2YXIgY291bnQgPSAwOwogICAgICAgIHZhciBtYXhfY291bnQgPSA3OwogICAgICAgIHZhciBtaW5fY291bnQgPSA0OwogICAgICAgIGlmIChuZXh0bGVuID09PSAwKSB7CiAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IG1heF9jb2RlOyBuKyspIHsKICAgICAgICAgIGN1cmxlbiA9IG5leHRsZW47CiAgICAgICAgICBuZXh0bGVuID0gdHJlZVsobiArIDEpICogMiArIDFdOwogICAgICAgICAgaWYgKCsrY291bnQgPCBtYXhfY291bnQgJiYgY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkgewogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGN1cmxlbiwgcy5ibF90cmVlKTsKICAgICAgICAgICAgfSB3aGlsZSAoLS1jb3VudCAhPT0gMCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiAhPT0gMCkgewogICAgICAgICAgICBpZiAoY3VybGVuICE9PSBwcmV2bGVuKSB7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGN1cmxlbiwgcy5ibF90cmVlKTsKICAgICAgICAgICAgICBjb3VudC0tOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNlbmRfY29kZShzLCBSRVBfM182LCBzLmJsX3RyZWUpOwogICAgICAgICAgICBzZW5kX2JpdHMocywgY291bnQgLSAzLCAyKTsKICAgICAgICAgIH0gZWxzZSBpZiAoY291bnQgPD0gMTApIHsKICAgICAgICAgICAgc2VuZF9jb2RlKHMsIFJFUFpfM18xMCwgcy5ibF90cmVlKTsKICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGNvdW50IC0gMywgMyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzZW5kX2NvZGUocywgUkVQWl8xMV8xMzgsIHMuYmxfdHJlZSk7CiAgICAgICAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDExLCA3KTsKICAgICAgICAgIH0KICAgICAgICAgIGNvdW50ID0gMDsKICAgICAgICAgIHByZXZsZW4gPSBjdXJsZW47CiAgICAgICAgICBpZiAobmV4dGxlbiA9PT0gMCkgewogICAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiA9PT0gbmV4dGxlbikgewogICAgICAgICAgICBtYXhfY291bnQgPSA2OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNzsKICAgICAgICAgICAgbWluX2NvdW50ID0gNDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYnVpbGRfYmxfdHJlZShzKSB7CiAgICAgICAgdmFyIG1heF9ibGluZGV4OwogICAgICAgIHNjYW5fdHJlZShzLCBzLmR5bl9sdHJlZSwgcy5sX2Rlc2MubWF4X2NvZGUpOwogICAgICAgIHNjYW5fdHJlZShzLCBzLmR5bl9kdHJlZSwgcy5kX2Rlc2MubWF4X2NvZGUpOwogICAgICAgIGJ1aWxkX3RyZWUocywgcy5ibF9kZXNjKTsKICAgICAgICBmb3IgKG1heF9ibGluZGV4ID0gQkxfQ09ERVMgLSAxOyBtYXhfYmxpbmRleCA+PSAzOyBtYXhfYmxpbmRleC0tKSB7CiAgICAgICAgICBpZiAocy5ibF90cmVlW2JsX29yZGVyW21heF9ibGluZGV4XSAqIDIgKyAxXSAhPT0gMCkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5vcHRfbGVuICs9IDMgKiAobWF4X2JsaW5kZXggKyAxKSArIDUgKyA1ICsgNDsKICAgICAgICByZXR1cm4gbWF4X2JsaW5kZXg7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2VuZF9hbGxfdHJlZXMocywgbGNvZGVzLCBkY29kZXMsIGJsY29kZXMpIHsKICAgICAgICB2YXIgcmFuazsKICAgICAgICBzZW5kX2JpdHMocywgbGNvZGVzIC0gMjU3LCA1KTsKICAgICAgICBzZW5kX2JpdHMocywgZGNvZGVzIC0gMSwgNSk7CiAgICAgICAgc2VuZF9iaXRzKHMsIGJsY29kZXMgLSA0LCA0KTsKICAgICAgICBmb3IgKHJhbmsgPSAwOyByYW5rIDwgYmxjb2RlczsgcmFuaysrKSB7CiAgICAgICAgICBzZW5kX2JpdHMocywgcy5ibF90cmVlW2JsX29yZGVyW3JhbmtdICogMiArIDFdLCAzKTsKICAgICAgICB9CiAgICAgICAgc2VuZF90cmVlKHMsIHMuZHluX2x0cmVlLCBsY29kZXMgLSAxKTsKICAgICAgICBzZW5kX3RyZWUocywgcy5keW5fZHRyZWUsIGRjb2RlcyAtIDEpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRldGVjdF9kYXRhX3R5cGUocykgewogICAgICAgIHZhciBibGFja19tYXNrID0gNDA5MzYyNDQ0NzsKICAgICAgICB2YXIgbjsKICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IDMxOyBuKyssIGJsYWNrX21hc2sgPj4+PSAxKSB7CiAgICAgICAgICBpZiAoYmxhY2tfbWFzayAmIDEgJiYgcy5keW5fbHRyZWVbbiAqIDJdICE9PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBaX0JJTkFSWTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuZHluX2x0cmVlWzkgKiAyXSAhPT0gMCB8fCBzLmR5bl9sdHJlZVsxMCAqIDJdICE9PSAwIHx8IHMuZHluX2x0cmVlWzEzICogMl0gIT09IDApIHsKICAgICAgICAgIHJldHVybiBaX1RFWFQ7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDMyOyBuIDwgTElURVJBTFM7IG4rKykgewogICAgICAgICAgaWYgKHMuZHluX2x0cmVlW24gKiAyXSAhPT0gMCkgewogICAgICAgICAgICByZXR1cm4gWl9URVhUOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gWl9CSU5BUlk7CiAgICAgIH0KICAgICAgdmFyIHN0YXRpY19pbml0X2RvbmUgPSBmYWxzZTsKICAgICAgZnVuY3Rpb24gX3RyX2luaXQocykgewogICAgICAgIG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EpICsgKGxhc3QgPyAxIDogMCksIDMpOwogICAgICAgICAgc2VuZF9hbGxfdHJlZXMocywgcy5sX2Rlc2MubWF4X2NvZGUgKyAxLCBzLmRfZGVzYy5tYXhfY29kZSArIDEsIG1heF9ibGluZGV4ICsgMSk7CiAgICAgICAgICBjb21wcmVzc19ibG9jayhzLCBzLmR5bl9sdHJlZSwgcy5keW5fZHRyZWUpOwogICAgICAgIH0KICAgICAgICBpbml0X2Jsb2NrKHMpOwogICAgICAgIGlmIChsYXN0KSB7CiAgICAgICAgICBiaV93aW5kdXAocyk7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIF90cl90YWxseShzLCBkaXN0LCBsYykgewogICAgICAgIHMucGVuZGluZ19idWZbcy5kX2J1ZiArIHMubGFzdF9saXQgKiAyXSA9IGRpc3QgPj4+IDggJiAyNTU7CiAgICAgICAgcy5wZW5kaW5nX2J1ZltzLmRfYnVmICsgcy5sYXN0X2xpdCAqIDIgKyAxXSA9IGRpc3QgJiAyNTU7CiAgICAgICAgcy5wZW5kaW5nX2J1ZltzLmxfYnVmICsgcy5sYXN0X2xpdF0gPSBsYyAmIDI1NTsKICAgICAgICBzLmxhc3RfbGl0Kys7CiAgICAgICAgaWYgKGRpc3QgPT09IDApIHsKICAgICAgICAgIHMuZHluX2x0cmVlW2xjICogMl0rKzsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgcy5tYXRjaGVzKys7CiAgICAgICAgICBkaXN0LS07CiAgICAgICAgICBzLmR5bl9sdHJlZVsoX2xlbmd0aF9jb2RlW2xjXSArIExJVEVSQUxTICsgMSkgKiAyXSsrOwogICAgICAgICAgcy5keW5fZHRyZWVbZF9jb2RlKGRpc3QpICogMl0rKzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHMubGFzdF9saXQgPT09IHMubGl0X2J1ZnNpemUgLSAxOwogICAgICB9CiAgICAgIGV4cG9ydHMyLl90cl9pbml0ID0gX3RyX2luaXQ7CiAgICAgIGV4cG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fQogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBhZGxlcjMyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvY3JjMzIuanMKICB2YXIgcmVxdWlyZV9jcmMzMiA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9jcmMzMi5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIGZ1bmN0aW9uIG1ha2VUYWJsZSgpIHsKICAgICAgICB2YXIgYywgdGFibGUgPSBbXTsKICAgICAgICBmb3IgKHZhciBuID0gMDsgbiA8IDI1NjsgbisrKSB7CiAgICAgICAgICBjID0gbjsKICAgICAgICAgIGZvciAodmFyIGsgPSAwOyBrIDwgODsgaysrKSB7CiAgICAgICAgICAgIGMgPSBjICYgMSA/IDM5ODgyOTIzODQgXiBjID4+PiAxIDogYyA+Pj4gMTsKICAgICAgICAgIH0KICAgICAgICAgIHRhYmxlW25dID0gYzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRhYmxlOwogICAgICB9CiAgICAgIHZhciBjcmNUYWJsZSA9IG1ha2VUYWJsZSgpOwogICAgICBmdW5jdGlvbiBjcmMzMihjcmMsIGJ1ZiwgbGVuLCBwb3MpIHsKICAgICAgICB2YXIgdCA9IGNyY1RhYmxlLCBlbmQgPSBwb3MgKyBsZW47CiAgICAgICAgY3JjIF49IC0xOwogICAgICAgIGZvciAodmFyIGkgPSBwb3M7IGkgPCBlbmQ7IGkrKykgewogICAgICAgICAgY3JjID0gY3JjID4+PiA4IF4gdFsoY3JjIF4gYnVmW2ldKSAmIDI1NV07CiAgICAgICAgfQogICAgICAgIHJldHVybiBjcmMgXiAtMTs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Gxvbmdlc3RfbWF0Y2gocywgY3VyX21hdGNoKSB7CiAgICAgICAgdmFyIGNoYWluX2xlbmd0aCA9IHMubWF4X2NoYWluX2xlbmd0aDsKICAgICAgICB2YXIgc2NhbiA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgdmFyIG1hdGNoOwogICAgICAgIHZhciBsZW47CiAgICAgICAgdmFyIGJlc3RfbGVuID0gcy5wcmV2X2xlbmd0aDsKICAgICAgICB2YXIgbmljZV9tYXRjaCA9IHMubmljZV9tYXRjaDsKICAgICAgICB2YXIgbGltaXQgPSBzLnN0cnN0YXJ0ID4gcy53X3NpemUgLSBNSU5fTE9PS0FIRUFEID8gcy5zdHJzdGFydCAtIChzLndfc2l6ZSAtIE1JTl9MT09LQUhFQUQpIDogMDsKICAgICAgICB2YXIgX3dpbiA9IHMud2luZG93OwogICAgICAgIHZhciB3bWFzayA9IHMud19tYXNrOwogICAgICAgIHZhciBwcmV2ID0gcy5wcmV2OwogICAgICAgIHZhciBzdHJlbmQgPSBzLnN0cnN0YXJ0ICsgTUFYX01BVENIOwogICAgICAgIHZhciBzY2FuX2VuZDEgPSBfd2luW3NjYW4gKyBiZXN0X2xlbiAtIDFdOwogICAgICAgIHZhciBzY2FuX2VuZCA9IF93aW5bc2NhbiArIGJlc3RfbGVuXTsKICAgICAgICBpZiAocy5wcmV2X2xlbmd0aCA+PSBzLmdvb2RfbWF0Y2gpIHsKICAgICAgICAgIGNoYWluX2xlbmd0aCA+Pj0gMjsKICAgICAgICB9CiAgICAgICAgaWYgKG5pY2VfbWF0Y2ggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgbmljZV9tYXRjaCA9IHMubG9va2FoZWFkOwogICAgICAgIH0KICAgICAgICBkbyB7CiAgICAgICAgICBtYXRjaCA9IGN1cl9tYXRjaDsKICAgICAgICAgIGlmIChfd2luW21hdGNoICsgYmVzdF9sZW5dICE9PSBzY2FuX2VuZCB8fCBfd2luW21hdGNoICsgYmVzdF9sZW4gLSAxXSAhPT0gc2Nhbl9lbmQxIHx8IF93aW5bbWF0Y2hdICE9PSBfd2luW3NjYW5dIHx8IF93aW5bKyttYXRjaF0gIT09IF93aW5bc2NhbiArIDFdKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgc2NhbiArPSAyOwogICAgICAgICAgbWF0Y2grKzsKICAgICAgICAgIGRvIHsKICAgICAgICAgIH0gd2hpbGUgKF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgc2NhbiA8IHN0cmVuZCk7CiAgICAgICAgICBsZW4gPSBNQVhfTUFUQ0ggLSAoc3RyZW5kIC0gc2Nhbik7CiAgICAgICAgICBzY2FuID0gc3RyZW5kIC0gTUFYX01BVENIOwogICAgICAgICAgaWYgKGxlbiA+IGJlc3RfbGVuKSB7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgPSBjdXJfbWF0Y2g7CiAgICAgICAgICAgIGJlc3RfbGVuID0gbGVuOwogICAgICAgICAgICBpZiAobGVuID49IG5pY2VfbWF0Y2gpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBzY2FuX2VuZDEgPSBfd2luW3NjYW4gKyBiZXN0X2xlbiAtIDFdOwogICAgICAgICAgICBzY2FuX2VuZCA9IF93aW5bc2NhbiArIGJlc3RfbGVuXTsKICAgICAgICAgIH0KICAgICAgICB9IHdoaWxlICgoY3VyX21hdGNoID0gcHJldltjdXJfbWF0Y2ggJiB3bWFza10pID4gbGltaXQgJiYgLS1jaGFpbl9sZW5ndGggIT09IDApOwogICAgICAgIGlmIChiZXN0X2xlbiA8PSBzLmxvb2thaGVhZCkgewogICAgICAgICAgcmV0dXJuIGJlc3RfbGVuOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcy5sb29rYWhlYWQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZmlsbF93aW5kb3cocykgewogICAgICAgIHZhciBfd19zaXplID0gcy53X3NpemU7CiAgICAgICAgdmFyIHAsIG4sIG0sIG1vcmUsIHN0cjsKICAgICAgICBkbyB7CiAgICAgICAgICBtb3JlID0gcy53aW5kb3dfc2l6ZSAtIHMubG9va2FoZWFkIC0gcy5zdHJzdGFydDsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID49IF93X3NpemUgKyAoX3dfc2l6ZSAtIE1JTl9MT09LQUhFQUQpKSB7CiAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHMud2luZG93LCBzLndpbmRvdywgX3dfc2l6ZSwgX3dfc2l6ZSwgMCk7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgLT0gX3dfc2l6ZTsKICAgICAgICAgICAgcy5zdHJzdGFydCAtPSBfd19zaXplOwogICAgICAgICAgICBzLmJsb2NrX3N0YXJ0IC09IF93X3NpemU7CiAgICAgICAgICAgIG4gPSBzLmhhc2hfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5oZWFkWy0tcF07CiAgICAgICAgICAgICAgcy5oZWFkW3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBuID0gX3dfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5wcmV2Wy0tcF07CiAgICAgICAgICAgICAgcy5wcmV2W3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBtb3JlICs9IF93X3NpemU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX2luID09PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgbiA9IHJlYWRfYnVmKHMuc3RybSwgcy53aW5kb3csIHMuc3Ryc3RhcnQgKyBzLmxvb2thaGVhZCwgbW9yZSk7CiAgICAgICAgICBzLmxvb2thaGVhZCArPSBuOwogICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHN0ciA9IHMuc3Ryc3RhcnQgLSBzLmluc2VydDsKICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3N0cl07CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzdHIgKyAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgd2hpbGUgKHMuaW5zZXJ0KSB7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3N0ciArIE1JTl9NQVRDSCAtIDFdKSAmIHMuaGFzaF9tYXNrOwogICAgICAgICAgICAgIHMucHJldltzdHIgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gc3RyOwogICAgICAgICAgICAgIHN0cisrOwogICAgICAgICAgICAgIHMuaW5zZXJ0LS07CiAgICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPCBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBzLnN0cm0uYXZhaWxfaW4gIT09IDApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVfc3RvcmVkKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIG1heF9ibG9ja19zaXplID0gNjU1MzU7CiAgICAgICAgaWYgKG1heF9ibG9ja19zaXplID4gcy5wZW5kaW5nX2J1Zl9zaXplIC0gNSkgewogICAgICAgICAgbWF4X2Jsb2NrX3NpemUgPSBzLnBlbmRpbmdfYnVmX3NpemUgLSA1OwogICAgICAgIH0KICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8PSAxKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDAgJiYgZmx1c2ggPT09IFpfTk9fRkxVU0gpIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBzLnN0cnN0YXJ0ICs9IHMubG9va2FoZWFkOwogICAgICAgICAgcy5sb29rYWhlYWQgPSAwOwogICAgICAgICAgdmFyIG1heF9zdGFydCA9IHMuYmxvY2tfc3RhcnQgKyBtYXhfYmxvY2tfc2l6ZTsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID09PSAwIHx8IHMuc3Ryc3RhcnQgPj0gbWF4X3N0YXJ0KSB7CiAgICAgICAgICAgIHMubG9va2FoZWFkID0gcy5zdHJzdGFydCAtIG1heF9zdGFydDsKICAgICAgICAgICAgcy5zdHJzdGFydCA9IG1heF9zdGFydDsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgLSBzLmJsb2NrX3N0YXJ0ID49IHMud19zaXplIC0gTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5zdHJzdGFydCA+IHMuYmxvY2tfc3RhcnQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX2Zhc3QocywgZmx1c2gpIHsKICAgICAgICB2YXIgaGFzaF9oZWFkOwogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEICYmIGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDApIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaGFzaF9oZWFkID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgaGFzaF9oZWFkID0gcy5wcmV2W3Muc3Ryc3RhcnQgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoaGFzaF9oZWFkICE9PSAwICYmIHMuc3Ryc3RhcnQgLSBoYXNoX2hlYWQgPD0gcy53X3NpemUgLSBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gbG9uZ2VzdF9tYXRjaChzLCBoYXNoX2hlYWQpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHMubWF0Y2hfbGVuZ3RoID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICBiZmx1c2ggPSB0cmVlcy5fdHJfdGFsbHkocywgcy5zdHJzdGFydCAtIHMubWF0Y2hfc3RhcnQsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA8PSBzLm1heF9sYXp5X21hdGNoICYmIHMubG9va2FoZWFkID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoLS07CiAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9IHdoaWxlICgtLXMubWF0Y2hfbGVuZ3RoICE9PSAwKTsKICAgICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcy5zdHJzdGFydCArPSBzLm1hdGNoX2xlbmd0aDsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3Muc3Ryc3RhcnRdOwogICAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IHMuc3Ryc3RhcnQgPCBNSU5fTUFUQ0ggLSAxID8gcy5zdHJzdGFydCA6IE1JTl9NQVRDSCAtIDE7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9zbG93KHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGhhc2hfaGVhZDsKICAgICAgICB2YXIgYmZsdXNoOwogICAgICAgIHZhciBtYXhfaW5zZXJ0OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGhhc2hfaGVhZCA9IDA7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgTUlOX01BVENIIC0gMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICBzLmhlYWRbcy5pbnNfaF0gPSBzLnN0cnN0YXJ0OwogICAgICAgICAgfQogICAgICAgICAgcy5wcmV2X2xlbmd0aCA9IHMubWF0Y2hfbGVuZ3RoOwogICAgICAgICAgcy5wcmV2X21hdGNoID0gcy5tYXRjaF9zdGFydDsKICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gTUlOX01BVENIIC0gMTsKICAgICAgICAgIGlmIChoYXNoX2hlYWQgIT09IDAgJiYgcy5wcmV2X2xlbmd0aCA8IHMubWF4X2xhenlfbWF0Y2ggJiYgcy5zdHJzdGFydCAtIGhhc2hfaGVhZCA8PSBzLndfc2l6ZSAtIE1JTl9MT09LQUhFQUQpIHsKICAgICAgICAgICAgcy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WFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gd2hpbGUgKC0tcy5wcmV2X2xlbmd0aCAhPT0gMCk7CiAgICAgICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMDsKICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAocy5tYXRjaF9hdmFpbGFibGUpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5tYXRjaF9hdmFpbGFibGUgPSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLm1hdGNoX2F2YWlsYWJsZSkgewogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICBzLm1hdGNoX2F2YWlsYWJsZSA9IDA7CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gcy5zdHJzdGFydCA8IE1JTl9NQVRDSCAtIDEgPyBzLnN0cnN0YXJ0IDogTUlOX01BVENIIC0gMTsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5sYXN0X2xpdCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gQlNfQkxPQ0tfRE9ORTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX3JsZShzLCBmbHVzaCkgewogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgdmFyIHByZXY7CiAgICAgICAgdmFyIHNjYW4sIHN0cmVuZDsKICAgICAgICB2YXIgX3dpbiA9IHMud2luZG93OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0ggJiYgcy5zdHJzdGFydCA+IDApIHsKICAgICAgICAgICAgc2NhbiA9IHMuc3Ryc3RhcnQgLSAxOwogICAgICAgICAgICBwcmV2ID0gX3dpbltzY2FuXTsKICAgICAgICAgICAgaWYgKHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dKSB7CiAgICAgICAgICAgICAgc3RyZW5kID0gcy5zdHJzdGFydCArIE1BWF9NQVRDSDsKICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgfSB3aGlsZSAocHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBzY2FuIDwgc3RyZW5kKTsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IE1BWF9NQVRDSCAtIChzdHJlbmQgLSBzY2FuKTsKICAgICAgICAgICAgICBpZiAocy5tYXRjaF9sZW5ndGggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBzLmxvb2thaGVhZDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDEsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgKz0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IDA7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9odWZmKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGJmbHVzaDsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSAwOwogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnRdKTsKICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgIGlmIChmbHVzaCA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgdHJ1ZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX1NUQVJURUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX0RPTkU7CiAgICAgICAgfQogICAgICAgIGlmIChzLmxhc3RfbGl0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBCU19CTE9DS19ET05FOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIENvbmZpZyhnb29kX2xlbmd0aCwgbWF4X2xhenksIG5pY2VfbGVuZ3RoLCBtYXhfY2hhaW4sIGZ1bmMpIHsKICAgICAgICB0aGlzLmdvb2RfbGVuZ3RoID0gZ29vZF9sZW5ndGg7CiAgICAgICAgdGhpcy5tYXhfbGF6eSA9IG1heF9sYXp5OwogICAgICAgIHRoaXMubmljZV9sZW5ndGggPSBuaWNlX2xlbmd0aDsKICAgICAgICB0aGlzLm1heF9jaGFpbiA9IG1heF9jaGFpbjsKICAgICAgICB0aGlzLmZ1bmMgPSBmdW5jOwogICAgICB9CiAgICAgIHZhciBjb25maWd1cmF0aW9uX3RhYmxlOwogICAgICBjb25maWd1cmF0aW9uX3RhYmxlID0gWwogICAgICAgIG5ldyBDb25maWcoMCwgMCwgMCwgMCwgZGVmbGF0ZV9zdG9yZWQpLAogICAgICAgIG5ldyBDb25maWcoNCwgNCwgOCwgNCwgZGVmbGF0ZV9mYXN0KSwKICAgICAgICBuZXcgQ29uZmlnKDQsIDUsIDE2LCA4LCBkZWZsYXRlX2Zhc3QpLAogICAgICAgIG5ldyBDb25maWcoNCwgNiwgMzIsIDMyLCBkZWZsYXRlX2Zhc3QpL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0Y2hfYXZhaWxhYmxlID0gMDsKICAgICAgICBzLmluc19oID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBEZWZsYXRlU3RhdGUoKSB7CiAgICAgICAgdGhpcy5zdHJtID0gbnVsbDsKICAgICAgICB0aGlzLnN0YXR1cyA9IDA7CiAgICAgICAgdGhpcy5wZW5kaW5nX2J1ZiA9IG51bGw7CiAgICAgICAgdGhpcy5wZW5kaW5nX2J1Zl9zaXplID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmcgPSAwOwogICAgICAgIHRoaXMud3JhcCA9IDA7CiAgICAgICAgdGhpcy5nemhlYWQgPSBudWxsOwogICAgICAgIHRoaXMuZ3ppbmRleCA9IDA7CiAgICAgICAgdGhpcy5tZXRob2QgPSBaX0RFRkxBVEVEOwogICAgICAgIHRoaXMubGFzdF9mbHVzaCA9IC0xOwogICAgICAgIHRoaXMud19zaXplID0gMDsKICAgICAgICB0aGlzLndfYml0cyA9IDA7CiAgICAgICAgdGhpcy53X21hc2sgPSAwOwogICAgICAgIHRoaXMud2luZG93ID0gbnVsbDsKICAgICAgICB0aGlzLndpbmRvd19zaXplID0gMDsKICAgICAgICB0aGlzLnByZXYgPSBudWxsOwogICAgICAgIHRoaXMuaGVhZCA9IG51bGw7CiAgICAgICAgdGhpcy5pbnNfaCA9IDA7CiAgICAgICAgdGhpcy5oYXNoX3NpemUgPSAwOwogICAgICAgIHRoaXMuaGFzaF9iaXRzID0gMDsKICAgICAgICB0aGlzLmhhc2hfbWFzayA9IDA7CiAgICAgICAgdGhpcy5oYXNoX3NoaWZ0ID0gMDsKICAgICAgICB0aGlzLmJsb2NrX3N0YXJ0ID0gMDsKICAgICAgICB0aGlzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgdGhpcy5wcmV2X21hdGNoID0gMDsKICAgICAgICB0aGlzLm1hdGNoX2F2YWlsYWJsZSA9IDA7CiAgICAgICAgdGhpcy5zdHJzdGFydCA9IDA7CiAgICAgICAgdGhpcy5tYXRjaF9zdGFydCA9IDA7CiAgICAgICAgdGhpcy5sb29rYWhlYWQgPSAwOwogICAgICAgIHRoaXMucHJldl9sZW5ndGggPSAwOwogICAgICAgIHRoaXMubWF4X2NoYWluX2xlbmd0aCA9IDA7CiAgICAgICAgdGhpcy5tYXhfbGF6eV9tYXRjaCA9IDA7CiAgICAgICAgdGhpcy5sZXZlbCA9IDA7CiAgICAgICAgdGhpcy5zdHJhdGVneSA9IDA7CiAgICAgICAgdGhpcy5nb29kX21hdGNoID0gMDsKICAgICAgICB0aGlzLm5pY2VfbWF0Y2ggPSAwOwogICAgICAgIHRoaXMuZHluX2x0cmVlID0gbmV3IHV0aWxzLkJ1ZjE2KEhFQVBfU0laRSAqIDIpOwogICAgICAgIHRoaXMuZHluX2R0cmVlID0gbmV3IHV0aWxzLkJ1ZjE2KCgyICogRF9DT0RFUyArIDEpICogMik7CiAgICAgICAgdGhpcy5ibF90cmVlID0gbmV3IHV0aWxzLkJ1ZjE2KCgyICogQkxfQ09ERVMgKyAxKSAqIDIpOwogICAgICAgIHplcm8odGhpcy5keW5fbHRyZWUpOwogICAgICAgIHplcm8odGhpcy5keW5fZHRyZWUpOwogICAgICAgIHplcm8odGhpcy5ibF90cmVlKTsKICAgICAgICB0aGlzLmxfZGVzYyA9IG51bGw7CiAgICAgICAgdGhpcy5kX2Rlc2MgPSBudWxsOwogICAgICAgIHRoaXMuYmxfZGVzYyA9IG51bGw7CiAgICAgICAgdGhpcy5ibF9jb3VudCA9IG5ldyB1dGlscy5CdWYxNihNQVhfQklUUyArIDEpOwogICAgICAgIHRoaXMuaGVhcCA9IG5ldyB1dGlscy5CdWYxNigyICogTF9DT0RFUyArIDEpOwogICAgICAgIHplcm8odGhpcy5oZWFwKTsKICAgICAgICB0aGlzLmhlYXBfbGVuID0gMDsKICAgICAgICB0aGlzLmhlYXBfbWF4ID0gMDsKICAgICAgICB0aGlzLmRlcHRoID0gbmV3IHV0aWxzLkJ1ZjE2KDIgKiBMX0NPREVTICsgMSk7CiAgICAgICAgemVybyh0aGlzLmRlcHRoKTsKICAgICAgICB0aGlzLmxfYnVmID0gMDsKICAgICAgICB0aGlzLmxpdF9idWZzaXplID0gMDsKICAgICAgICB0aGlzLmxhc3RfbGl0ID0gMDsKICAgICAgICB0aGlzLmRfYnVmID0gMDsKICAgICAgICB0aGlzLm9wdF9sZW4gPSAwOwogICAgICAgIHRoaXMuc3RhdGljX2xlbiA9IDA7CiAgICAgICAgdGhpcy5tYXRjaGVzID0gMDsKICAgICAgICB0aGlzLmluc2VydCA9IDA7CiAgICAgICAgdGhpcy5iaV9idWYgPSAwOwogICAgICAgIHRoaXMuYmlfdmFsaWQgPSAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVSZXNldEtlZXAoc3RybSkgewogICAgICAgIHZhciBzOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBaX1NUUkVBTV9FUlJPUik7CiAgICAgICAgfQogICAgICAgIHN0cm0udG90YWxfaW4gPSBzdHJtLnRvdGFsX291dCA9IDA7CiAgICAgICAgc3RybS5kYXRhX3R5cGUgPSBaX1VOS05PV047CiAgICAgICAgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgcy5wZW5kaW5nID0gMDsKICAgICAgICBzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICBpZiAocy53cmFwIDwgMCkgewogICAgICAgICAgcy53cmFwID0gLXMud3JhcDsKICAgICAgICB9CiAgICAgICAgcy5zdGF0dXMgPSBzLndyYXAgPyBJTklUX1NUQVRFIDogQlVTWV9TVEFURTsKICAgICAgICBzdHJtLmFkbGVyID0gcy53cmFwID09PSAyID8gMCA6IDE7CiAgICAgICAgcy5sYXN0X2ZsdXNoID0gWl9OT19GTFVTSDsKICAgICAgICB0cmVlcy5fdHJfaW5pdChzKTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlUmVzZXQoc3RybSkgewogICAgICAgIHZhciByZXQgPSBkZWZsYXRlUmVzZXRLZWVwKHN0cm0pOwogICAgICAgIGlmIChyZXQgPT09IFpfT0spIHsKICAgICAgICAgIGxtX2luaXQoc3RybS5zdGF0ZSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZVNldEhlYWRlcihzdHJtLCBoZWFkKSB7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdHJtLnN0YXRlLndyYXAgIT09IDIpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RybS5zdGF0ZS5nemhlYWQgPSBoZWFkOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVJbml0MihzdHJtLCBsZXZlbCwgbWV0aG9kLCB3aW5kb3dCaXRzLCBtZW1MZXZlbCwgc3RyYXRlZ3kpIHsKICAgICAgICBpZiAoIXN0cm0pIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgdmFyIHdyYXAgPSAxOwogICAgICAgIGlmIChsZXZlbCA9PT0gWl9ERUZBVUxUX0NPTVBSRVNTSU9OKSB7CiAgICAgICAgICBsZXZlbCA9IDY7CiAgICAgICAgfQogICAgICAgIGlmICh3aW5kb3dCaXRzIDwgMCkgewogICAgICAgICAgd3JhcCA9IDA7CiAgICAgICAgICB3aW5kb3dCaXRzID0gLXdpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIGlmICh3aW5kb3dCaXRzID4gMTUpIHsKICAgICAgICAgIHdyYXAgPSAyOwogIC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XQgfHwgIXN0cm0uaW5wdXQgJiYgc3RybS5hdmFpbF9pbiAhPT0gMCB8fCBzLnN0YXR1cyA9PT0gRklOSVNIX1NUQVRFICYmIGZsdXNoICE9PSBaX0ZJTklTSCkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBzdHJtLmF2YWlsX291dCA9PT0gMCA/IFpfQlVGX0VSUk9SIDogWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBzLnN0cm0gPSBzdHJtOwogICAgICAgIG9sZF9mbHVzaCA9IHMubGFzdF9mbHVzaDsKICAgICAgICBzLmxhc3RfZmx1c2ggPSBmbHVzaDsKICAgICAgICBpZiAocy5zdGF0dXMgPT09IElOSVRfU1RBVEUpIHsKICAgICAgICAgIGlmIChzLndyYXAgPT09IDIpIHsKICAgICAgICAgICAgc3RybS5hZGxlciA9IDA7CiAgICAgICAgICAgIHB1dF9ieXRlKHMsIDMxKTsKICAgICAgICAgICAgcHV0X2J5dGUocywgMTM5KTsKICAgICAgICAgICAgcHV0X2J5dGUocywgOCk7CiAgICAgICAgICAgIGlmICghcy5nemhlYWQpIHsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgT1NfQ09ERSk7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50ZXh0ID8gMSA6IDApICsgKHMuZ3poZWFkLmhjcmMgPyAyIDogMCkgKyAoIXMuZ3poZWFkLmV4dHJhID8gMCA6IDQpICsgKCFzLmd6aGVhZC5uYW1lID8gMCA6IDgpICsgKCFzLmd6aGVhZC5jb21tZW50ID8gMCA6IDE2KSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSA+PiA4ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDE2ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDI0ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQub3MgJiAyNTUpOwogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5leHRyYSAmJiBzLmd6aGVhZC5leHRyYS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLmV4dHJhLmxlbmd0aCAmIDI1NSk7CiAgICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYS5sZW5ndGggPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjKSB7CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nLCAwKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcy5nemluZGV4ID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEVYVFJBX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB2YXIgaGVhZGVyID0gWl9ERUZMQVRFRCArIChzLndfYml0cyAtIDggPDwgNCkgPDwgODsKICAgICAgICAgICAgdmFyIGxldmVsX2ZsYWdzID0gLTE7CiAgICAgICAgICAgIGlmIChzLnN0cmF0ZWd5ID49IFpfSFVGRk1BTl9PTkxZIHx8IHMubGV2ZWwgPCAyKSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAwOwogICAgICAgICAgICB9IGVsc2UgaWYgKHMubGV2ZWwgPCA2KSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAxOwogICAgICAgICAgICB9IGVsc2UgaWYgKHMubGV2ZWwgPT09IDYpIHsKICAgICAgICAgICAgICBsZXZlbF9mbGFncyA9IDI7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAzOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGhlYWRlciB8PSBsZXZlbF9mbGFncyA8PCA2OwogICAgICAgICAgICBpZiAocy5zdHJzdGFydCAhPT0gMCkgewogICAgICAgICAgICAgIGhlYWRlciB8PSBQUkVTRVRfRElDVDsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXIgKz0gMzEgLSBoZWFkZXIgJSAzMTsKICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBoZWFkZXIpOwogICAgICAgICAgICBpZiAocy5zdHJzdGFydCAhPT0gMCkgewogICAgICAgICAgICAgIHB1dFNob3J0TVNCKHMsIHN0cm0uYWRsZXIgPj4+IDE2KTsKICAgICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBzdHJtLmFkbGVyICYgNjU1MzUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHN0cm0uYWRsZXIgPSAxOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5zdGF0dXMgPT09IEVYVFJBX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuZXh0cmEpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICB3aGlsZSAocy5nemluZGV4IDwgKHMuZ3poZWFkLmV4dHJhLmxlbmd0aCAmIDY1NTM1KSkgewogICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMihzdHJtLmFkbGVyLCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmcgLSBiZWcsIGJlZyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYVtzLmd6aW5kZXhdICYgMjU1KTsKICAgICAgICAgICAgICBzLmd6aW5kZXgrKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPT09IHMuZ3poZWFkLmV4dHJhLmxlbmd0aCkgewogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBOQU1FX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IE5BTUVfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gTkFNRV9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLm5hbWUpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgICAgdmFsID0gMTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPCBzLmd6aGVhZC5uYW1lLmxlbmd0aCkgewogICAgICAgICAgICAgICAgdmFsID0gcy5nemhlYWQubmFtZS5jaGFyQ29kZUF0KHMuZ3ppbmRleCsrKSAmIDI1NTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdmFsID0gMDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgdmFsKTsKICAgICAgICAgICAgfSB3aGlsZSAodmFsICE9PSAwKTsKICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodmFsID09PSAwKSB7CiAgICAgICAgICAgICAgcy5nemluZGV4ID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IENPTU1FTlRfU1RBVEU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuc3RhdHVzID0gQ09NTUVOVF9TVEFURTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBDT01NRU5UX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuY29tbWVudCkgewogICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgICB2YWwgPSAxOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHMuZ3ppbmRleCA8IHMuZ3poZWFkLmNvbW1lbnQubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICB2YWwgPSBzLmd6aGVhZC5jb21tZW50LmNoYXJDb2RlQXQocy5nemluZGV4KyspICYgMjU1OwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB2YWwgPSAwOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwdXRfYnl0ZShzLCB2YWwpOwogICAgICAgICAgICB9IHdoaWxlICh2YWwgIT09IDApOwogICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh2YWwgPT09IDApIHsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEhDUkNfU1RBVEU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuc3RhdHVzID0gSENSQ19TVEFURTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBIQ1JDX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYykgewogICAgICAgICAgICBpZiAocy5wZW5kaW5nICsgMiA+IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMucGVuZGluZyArIDIgPD0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciA+PiA4ICYgMjU1KTsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEJVU1lfU1RBVEU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuc3RhdHVzID0gQlVTWV9TVEFURTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMucGVuZGluZyAhPT0gMCkgewogICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIGlmIChzdHJtLmF2YWlsX2luID09PSAwICYmIHJhbmsoZmx1c2gpIDw9IHJhbmsob2xkX2ZsdXNoKSAmJiBmbHVzaCAhPT0gWl9GSU5JU0gpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9CVUZfRVJST1IpOwogICAgICAgIH0KICAgICAgICBpZiAocy5zdGF0dXMgPT09IEZJTklTSF9TVEFURSAmJiBzdHJtLmF2YWlsX2luICE9PSAwKSB7CiAgICAgICAgICByZXR1cm4gZXJyKHN0cm0sIFpfQlVGX0VSUk9SKTsKICAgICAgICB9CiAgICAgICAgaWYgKHN0cm0uYXZhaWxfaW4gIT09IDAgfHwgcy5sb29rYWhlYWQgIT09IDAgfHwgZmx1c2ggIT09IFpfTk9fRkxVU0ggJiYgcy5zdGF0dXMgIT09IEZJTklTSF9TVEFURSkgewogICAgICAgICAgdmFyIGJzdGF0ZSA9IHMuc3RyYXRlZ3kgPT09IFpfSFVGRk1BTl9PTkxZID8gZGVmbGF0ZV9odWZmKHMsIGZsdXNoKSA6IHMuc3RyYXRlZ3kgPT09IFpfUkxFID8gZGVmbGF0ZV9ybGUocywgZmx1c2gpIDogY29uZmlndXJhdGlvbl90YWJsZVtzLmxldmVsXS5mdW5jKHMsIGZsdXNoKTsKICAgICAgICAgIGlmIChic3RhdGUgPT09IEJTX0ZJTklTSF9TVEFSVEVEIHx8IGJzdGF0ZSA9PT0gQlNfRklOSVNIX0RPTkUpIHsKICAgICAgICAgICAgcy5zdGF0dXMgPSBGSU5JU0hfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYnN0YXRlID09PSBCU19ORUVEX01PUkUgfHwgYnN0YXRlID09PSBCU19GSU5JU0hfU1RBUlRFRCkgewogICAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICBzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChic3RhdGUgPT09IEJTX0JMT0NLX0RPTkUpIHsKICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX1BBUlRJQUxfRkxVU0gpIHsKICAgICAgICAgICAgICB0cmVlcy5fdHJfYWxpZ24ocyk7CiAgICAgICAgICAgIH0gZWxzZSBpZiAoZmx1c2ggIT09IFpfQkxPQ0spIHsKICAgICAgICAgICAgICB0cmVlcy5fdHJfc3RvcmVkX2Jsb2NrKHMsIDAsIDAsIGZhbHNlKTsKICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfRlVMTF9GTFVTSCkgewogICAgICAgICAgICAgICAgemVybyhzLmhlYWQpOwogICAgICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHMuc3Ryc3RhcnQgPSAwOwogICAgICAgICAgICAgICAgICBzLmJsb2NrX3N0YXJ0ID0gMDsKICAgICAgICAgICAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICBzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoZmx1c2ggIT09IFpfRklOSVNIKSB7CiAgICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKHMud3JhcCA8PSAwKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRU5EOwogICAgICAgIH0KICAgICAgICBpZiAocy53cmFwID09PSAyKSB7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgPj4gOCAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyID4+IDE2ICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgPj4gMjQgJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLnRvdGFsX2luID4+IDggJiAyNTUpOwogICAgICAgICAgcHV0X2J5dGUocywgc3RybS50b3RhbF9pbiA+PiAxNiAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLnRvdGFsX2luID4+IDI0ICYgMjU1KTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgcHV0U2hvcnRNU0Iocywgc3RybS5hZGxlciA+Pj4gMTYpOwogICAgICAgICAgcHV0U2hvcnRNU0Iocywgc3RybS5hZGxlciAmID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3JhcDsKICAgICAgICB2YXIgYXZhaWw7CiAgICAgICAgdmFyIG5leHQ7CiAgICAgICAgdmFyIGlucHV0OwogICAgICAgIHZhciB0bXBEaWN0OwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzID0gc3RybS5zdGF0ZTsKICAgICAgICB3cmFwID0gcy53cmFwOwogICAgICAgIGlmICh3cmFwID09PSAyIHx8IHdyYXAgPT09IDEgJiYgcy5zdGF0dXMgIT09IElOSVRfU1RBVEUgfHwgcy5sb29rYWhlYWQpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgaWYgKHdyYXAgPT09IDEpIHsKICAgICAgICAgIHN0cm0uYWRsZXIgPSBhZGxlcjMyKHN0cm0uYWRsZXIsIGRpY3Rpb25hcnksIGRpY3RMZW5ndGgsIDApOwogICAgICAgIH0KICAgICAgICBzLndyYXAgPSAwOwogICAgICAgIGlmIChkaWN0TGVuZ3RoID49IHMud19zaXplKSB7CiAgICAgICAgICBpZiAod3JhcCA9PT0gMCkgewogICAgICAgICAgICB6ZXJvKHMuaGVhZCk7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgPSAwOwogICAgICAgICAgICBzLmJsb2NrX3N0YXJ0ID0gMDsKICAgICAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgICAgfQogICAgICAgICAgdG1wRGljdCA9IG5ldyB1dGlscy5CdWY4KHMud19zaXplKTsKICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHRtcERpY3QsIGRpY3Rpb25hcnksIGRpY3RMZW5ndGggLSBzLndfc2l6ZSwgcy53X3NpemUsIDApOwogICAgICAgICAgZGljdGlvbmFyeSA9IHRtcERpY3Q7CiAgICAgICAgICBkaWN0TGVuZ3RoID0gcy53X3NpemU7CiAgICAgICAgfQogICAgICAgIGF2YWlsID0gc3RybS5hdmFpbF9pbjsKICAgICAgICBuZXh0ID0gc3RybS5uZXh0X2luOwogICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gZGljdExlbmd0aDsKICAgICAgICBzdHJtLm5leHRfaW4gPSAwOwogICAgICAgIHN0cm0uaW5wdXQgPSBkaWN0aW9uYXJ5OwogICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgIHdoaWxlIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgIHN0ciA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICBuID0gcy5sb29rYWhlYWQgLSAoTUlOX01BVENIIC0gMSk7CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzdHIgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgcy5wcmV2W3N0ciAmIHMud19tYXNrXSA9IHMuaGVhZFtzLmluc19oXTsKICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gc3RyOwogICAgICAgICAgICBzdHIrKzsKICAgICAgICAgIH0gd2hpbGUgKC0tbik7CiAgICAgICAgICBzLnN0cnN0YXJ0ID0gc3RyOwogICAgICAgICAgcy5sb29rYWhlYWQgPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgICAgZmlsbF93aW5kb3cocyk7CiAgICAgICAgfQogICAgICAgIHMuc3Ryc3RhcnQgKz0gcy5sb29rYWhlYWQ7CiAgICAgICAgcy5ibG9ja19zdGFydCA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgcy5pbnNlcnQgPSBzLmxvb2thaGVhZDsKICAgICAgICBzLmxvb2thaGVhZCA9IDA7CiAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBzLnByZXZfbGVuZ3RoID0gTUlOX01BVENIIC0gMTsKICAgICAgICBz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GlmICgoYyAmIDY0NTEyKSA9PT0gNTUyOTYgJiYgbV9wb3MgKyAxIDwgc3RyX2xlbikgewogICAgICAgICAgICBjMiA9IHN0ci5jaGFyQ29kZUF0KG1fcG9zICsgMSk7CiAgICAgICAgICAgIGlmICgoYzIgJiA2NDUxMikgPT09IDU2MzIwKSB7CiAgICAgICAgICAgICAgYyA9IDY1NTM2ICsgKGMgLSA1NTI5NiA8PCAxMCkgKyAoYzIgLSA1NjMyMCk7CiAgICAgICAgICAgICAgbV9wb3MrKzsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgYnVmX2xlbiArPSBjIDwgMTI4ID8gMSA6IGMgPCAyMDQ4ID8gMiA6IGMgPCA2NTUzNiA/IDMgOiA0OwogICAgICAgIH0KICAgICAgICBidWYgPSBuZXcgdXRpbHMuQnVmOChidWZfbGVuKTsKICAgICAgICBmb3IgKGkgPSAwLCBtX3BvcyA9IDA7IGkgPCBidWZfbGVuOyBtX3BvcysrKSB7CiAgICAgICAgICBjID0gc3RyLmNoYXJDb2RlQXQobV9wb3MpOwogICAgICAgICAgaWYgKChjICYgNjQ1MTIpID09PSA1NTI5NiAmJiBtX3BvcyArIDEgPCBzdHJfbGVuKSB7CiAgICAgICAgICAgIGMyID0gc3RyLmNoYXJDb2RlQXQobV9wb3MgKyAxKTsKICAgICAgICAgICAgaWYgKChjMiAmIDY0NTEyKSA9PT0gNTYzMjApIHsKICAgICAgICAgICAgICBjID0gNjU1MzYgKyAoYyAtIDU1Mjk2IDw8IDEwKSArIChjMiAtIDU2MzIwKTsKICAgICAgICAgICAgICBtX3BvcysrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDEyOCkgewogICAgICAgICAgICBidWZbaSsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCAyMDQ4KSB7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTkyIHwgYyA+Pj4gNjsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCA2NTUzNikgewogICAgICAgICAgICBidWZbaSsrXSA9IDIyNCB8IGMgPj4+IDEyOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDYgJiA2MzsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBidWZbaSsrXSA9IDI0MCB8IGMgPj4+IDE4OwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDEyICYgNjM7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTI4IHwgYyA+Pj4gNiAmIDYzOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgJiA2MzsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gYnVmMmJpbnN0cmluZyhidWYsIGxlbikgewogICAgICAgIGlmIChsZW4gPCA2NTUzNCkgewogICAgICAgICAgaWYgKGJ1Zi5zdWJhcnJheSAmJiBTVFJfQVBQTFlfVUlBX09LIHx8ICFidWYuc3ViYXJyYXkgJiYgU1RSX0FQUExZX09LKSB7CiAgICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KG51bGwsIHV0aWxzLnNocmlua0J1ZihidWYsIGxlbikpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB2YXIgcmVzdWx0ID0gIiI7CiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgcmVzdWx0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgfQogICAgICBleHBvcnRzMi5idWYyYmluc3RyaW5nID0gZnVuY3Rpb24oYnVmKSB7CiAgICAgICAgcmV0dXJuIGJ1ZjJiaW5zdHJpbmcoYnVmLCBidWYubGVuZ3RoKTsKICAgICAgfTsKICAgICAgZXhwb3J0czIuYmluc3RyaW5nMmJ1ZiA9IGZ1bmN0aW9uKHN0cikgewogICAgICAgIHZhciBidWYgPSBuZXcgdXRpbHMuQnVmOChzdHIubGVuZ3RoKTsKICAgICAgICBmb3IgKHZhciBpID0gMCwgbGVuID0gYnVmLmxlbmd0aDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgICBidWZbaV0gPSBzdHIuY2hhckNvZGVBdChpKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfTsKICAgICAgZXhwb3J0czIuYnVmMnN0cmluZyA9IGZ1bmN0aW9uKGJ1ZiwgbWF4KSB7CiAgICAgICAgdmFyIGksIG91dCwgYywgY19sZW47CiAgICAgICAgdmFyIGxlbiA9IG1heCB8fCBidWYubGVuZ3RoOwogICAgICAgIHZhciB1dGYxNmJ1ZiA9IG5ldyBBcnJheShsZW4gKiAyKTsKICAgICAgICBmb3IgKG91dCA9IDAsIGkgPSAwOyBpIDwgbGVuOyApIHsKICAgICAgICAgIGMgPSBidWZbaSsrXTsKICAgICAgICAgIGlmIChjIDwgMTI4KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgY19sZW4gPSBfdXRmOGxlbltjXTsKICAgICAgICAgIGlmIChjX2xlbiA+IDQpIHsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNjU1MzM7CiAgICAgICAgICAgIGkgKz0gY19sZW4gLSAxOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGMgJj0gY19sZW4gPT09IDIgPyAzMSA6IGNfbGVuID09PSAzID8gMTUgOiA3OwogICAgICAgICAgd2hpbGUgKGNfbGVuID4gMSAmJiBpIDwgbGVuKSB7CiAgICAgICAgICAgIGMgPSBjIDw8IDYgfCBidWZbaSsrXSAmIDYzOwogICAgICAgICAgICBjX2xlbi0tOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGNfbGVuID4gMSkgewogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA2NTUzMzsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDY1NTM2KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjIC09IDY1NTM2OwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NTI5NiB8IGMgPj4gMTAgJiAxMDIzOwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NjMyMCB8IGMgJiAxMDIzOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gYnVmMmJpbnN0cmluZyh1dGYxNmJ1Ziwgb3V0KTsKICAgICAgfTsKICAgICAgZXhwb3J0czIudXRmOGJvcmRlciA9IGZ1bmN0aW9uKGJ1ZiwgbWF4KSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBtYXggPSBtYXggfHwgYnVmLmxlbmd0aDsKICAgICAgICBpZiAobWF4ID4gYnVmLmxlbmd0aCkgewogICAgICAgICAgbWF4ID0gYnVmLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgcG9zID0gbWF4IC0gMTsKICAgICAgICB3aGlsZSAocG9zID49IDAgJiYgKGJ1Zltwb3NdICYgMTkyKSA9PT0gMTI4KSB7CiAgICAgICAgICBwb3MtLTsKICAgICAgICB9CiAgICAgICAgaWYgKHBvcyA8IDApIHsKICAgICAgICAgIHJldHVybiBtYXg7CiAgICAgICAgfQogICAgICAgIGlmIChwb3MgPT09IDApIHsKICAgICAgICAgIHJldHVybiBtYXg7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwb3MgKyBfdXRmOGxlbltidWZbcG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wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi9kZWZsYXRlLmpzIihleHBvcnRzMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIHpsaWJfZGVmbGF0ZSA9IHJlcXVpcmVfZGVmbGF0ZSgpOwogICAgICB2YXIgdXRpbHMgPSByZXF1aXJlX2NvbW1vbigpOwogICAgICB2YXIgc3RyaW5ncyA9IHJlcXVpcmVfc3RyaW5ncygpOwogICAgICB2YXIgbXNnID0gcmVxdWlyZV9tZXNzYWdlcygpOwogICAgICB2YXIgWlN0cmVhbSA9IHJlcXVpcmVfenN0cmVhbSgpOwogICAgICB2YXIgdG9TdHJpbmcgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nOwogICAgICB2YXIgWl9OT19GTFVTSCA9IDA7CiAgICAgIHZhciBaX0ZJTklTSCA9IDQ7CiAgICAgIHZhciBaX09LID0gMDsKICAgICAgdmFyIFpfU1RSRUFNX0VORCA9IDE7CiAgICAgIHZhciBaX1NZTkNfRkxVU0gyID0gMjsKICAgICAgdmFyIFpfREVGQVVMVF9DT01QUkVTU0lPTiA9IC0xOwogICAgICB2YXIgWl9ERUZBVUxUX1NUUkFURUdZID0gMDsKICAgICAgdmFyIFpfREVGTEFURUQgPSA4OwogICAgICBmdW5jdGlvbiBEZWZsYXRlKG9wdGlvbnMpIHsKICAgICAgICBpZiAoISh0aGlzIGluc3RhbmNlb2YgRGVmbGF0ZSkpCiAgICAgICAgICByZXR1cm4gbmV3IERlZmxhdGUob3B0aW9ucyk7CiAgICAgICAgdGhpcy5vcHRpb25zID0gdXRpbHMuYXNzaWduKHsKICAgICAgICAgIGxldmVsOiBaX0RFRkFVTFRfQ09NUFJFU1NJT04sCiAgICAgICAgICBtZXRob2Q6IFpfREVGTEFURUQsCiAgICAgICAgICBjaHVua1NpemU6IDE2Mzg0LAogICAgICAgICAgd2luZG93Qml0czogMTUsCiAgICAgICA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gewogICAgICAgICAgdmFyIGRpY3Q7CiAgICAgICAgICBpZiAodHlwZW9mIG9wdC5kaWN0aW9uYXJ5ID09PSAic3RyaW5nIikgewogICAgICAgICAgICBkaWN0ID0gc3RyaW5ncy5zdHJpbmcyYnVmKG9wdC5kaWN0aW9uYXJ5KTsKICAgICAgICAgIH0gZWxzZSBpZiAodG9TdHJpbmcuY2FsbChvcHQuZGljdGlvbmFyeSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgICAgZGljdCA9IG5ldyBVaW50OEFycmF5KG9wdC5kaWN0aW9uYXJ5KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGRpY3QgPSBvcHQuZGljdGlvbmFyeTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlU2V0RGljdGlvbmFyeSh0aGlzLnN0cm0sIGRpY3QpOwogICAgICAgICAgaWYgKHN0YXR1cyAhPT0gWl9PSykgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IobXNnW3N0YXR1c10pOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5fZGljdF9zZXQgPSB0cnVlOwogICAgICAgIH0KICAgICAgfQogICAgICBEZWZsYXRlLnByb3RvdHlwZS5wdXNoID0gZnVuY3Rpb24oZGF0YSwgbW9kZSkgewogICAgICAgIHZhciBzdHJtID0gdGhpcy5zdHJtOwogICAgICAgIHZhciBjaHVua1NpemUgPSB0aGlzLm9wdGlvbnMuY2h1bmtTaXplOwogICAgICAgIHZhciBzdGF0dXMsIF9tb2RlOwogICAgICAgIGlmICh0aGlzLmVuZGVkKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICAgIF9tb2RlID0gbW9kZSA9PT0gfn5tb2RlID8gbW9kZSA6IG1vZGUgPT09IHRydWUgPyBaX0ZJTklTSCA6IFpfTk9fRkxVU0g7CiAgICAgICAgaWYgKHR5cGVvZiBkYXRhID09PSAic3RyaW5nIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IHN0cmluZ3Muc3RyaW5nMmJ1ZihkYXRhKTsKICAgICAgICB9IGVsc2UgaWYgKHRvU3RyaW5nLmNhbGwoZGF0YSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgIHN0cm0uaW5wdXQgPSBuZXcgVWludDhBcnJheShkYXRhKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RybS5pbnB1dCA9IGRhdGE7CiAgICAgICAgfQogICAgICAgIHN0cm0ubmV4dF9pbiA9IDA7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IHN0cm0uaW5wdXQubGVuZ3RoOwogICAgICAgIGRvIHsKICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBzdHJtLm91dHB1dCA9IG5ldyB1dGlscy5CdWY4KGNodW5rU2l6ZSk7CiAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSAwOwogICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGNodW5rU2l6ZTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlKHN0cm0sIF9tb2RlKTsKICAgICAgICAgIGlmIChzdGF0dXMgIT09IFpfU1RSRUFNX0VORCAmJiBzdGF0dXMgIT09IFpfT0spIHsKICAgICAgICAgICAgdGhpcy5vbkVuZChzdGF0dXMpOwogICAgICAgICAgICB0aGlzLmVuZGVkID0gdHJ1ZTsKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwIHx8IHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgKF9tb2RlID09PSBaX0ZJTklTSCB8fCBfbW9kZSA9PT0gWl9TWU5DX0ZMVVNIMikpIHsKICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICB0aGlzLm9uRGF0YShzdHJpbmdzLmJ1ZjJiaW5zdHJpbmcodXRpbHMuc2hyaW5rQnVmKHN0cm0ub3V0cHV0LCBzdHJtLm5leHRfb3V0KSkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0aWxzLnNocmlua0J1ZihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCkpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSB3aGlsZSAoKHN0cm0uYXZhaWxfaW4gPiAwIHx8IHN0cm0uYXZhaWxfb3V0ID09PSAwKSAmJiBzdGF0dXMgIT09IFpfU1RSRUFNX0VORCk7CiAgICAgICAgaWYgKF9tb2RlID09PSBaX0ZJTklTSCkgewogICAgICAgICAgc3RhdHVzID0gemxpYl9kZWZsYXRlLmRlZmxhdGVFbmQodGhpcy5zdHJtKTsKICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgIHRoaXMuZW5kZWQgPSB0cnVlOwogICAgICAgICAgcmV0dXJuIHN0YXR1cyA9PT0gWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBaX1NZTkNfRkxVU0gyKSB7CiAgICAgICAgICB0aGlzLm9uRW5kKFpfT0spOwogICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSAwOwogICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0cnVlOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkRhdGEgPSBmdW5jdGlvbihjaHVuaykgewogICAgICAgIHRoaXMuY2h1bmtzLnB1c2goY2h1bmspOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkVuZCA9IGZ1bmN0aW9uKHN0YXR1cykgewogICAgICAgIGlmIChzdGF0dXMgPT09IFpfT0spIHsKICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMudG8gPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdGhpcy5jaHVua3Muam9pbigiIik7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aGlzLnJlc3VsdCA9IHV0aWxzLmZsYXR0ZW5DaHVua3ModGhpcy5jaHVua3MpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAgICAgIHRoaXMuZXJyID0gc3RhdHVzOwogICAgICAgIHRoaXMubXNnID0gdGhpcy5zdHJtLm1zZzsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gZGVmbGF0ZShpbnB1dCwgb3B0aW9ucykgewogICAgICAgIHZhciBkZWZsYXRvciA9IG5ldyBEZWZsYXRlKG9wdGlvbnMpOwogICAgICAgIGRlZmxhdG9yLnB1c2goaW5wdXQsIHRydWUpOwogICAgICAgIGlmIChkZWZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IGRlZmxhdG9yLm1zZyB8fCBtc2dbZGVmbGF0b3IuZXJyXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGRlZmxhdG9yLnJlc3VsdDsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlUmF3KGlucHV0LCBvcHRpb25zKSB7CiAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307CiAgICAgICAgb3B0aW9ucy5yYXcgPSB0cnVlOwogICAgICAgIHJldHVybiBkZWZsYXRlKGlucHV0LCBvcHRpb25zKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBnemlwKGlucHV0LCBvcHRpb25zKSB7CiAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307CiAgICAgICAgb3B0aW9ucy5nemlwID0gdHJ1ZTsKICAgICAgICByZXR1cm4gZGVmbGF0ZShpbnB1dCwgb3B0aW9ucyk7CiAgICAgIH0KICAgICAgZXhwb3J0czIuRGVmb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yIGxlbjsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgZnJvbTsKICAgICAgICB2YXIgZnJvbV9zb3VyY2U7CiAgICAgICAgdmFyIGlucHV0LCBvdXRwdXQ7CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIF9pbiA9IHN0cm0ubmV4dF9pbjsKICAgICAgICBpbnB1dCA9IHN0cm0uaW5wdXQ7CiAgICAgICAgbGFzdCA9IF9pbiArIChzdHJtLmF2YWlsX2luIC0gNSk7CiAgICAgICAgX291dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgb3V0cHV0ID0gc3RybS5vdXRwdXQ7CiAgICAgICAgYmVnID0gX291dCAtIChzdGFydCAtIHN0cm0uYXZhaWxfb3V0KTsKICAgICAgICBlbmQgPSBfb3V0ICsgKHN0cm0uYXZhaWxfb3V0IC0gMjU3KTsKICAgICAgICBkbWF4ID0gc3RhdGUuZG1heDsKICAgICAgICB3c2l6ZSA9IHN0YXRlLndzaXplOwogICAgICAgIHdoYXZlID0gc3RhdGUud2hhdmU7CiAgICAgICAgd25leHQgPSBzdGF0ZS53bmV4dDsKICAgICAgICBzX3dpbmRvdyA9IHN0YXRlLndpbmRvdzsKICAgICAgICBob2xkID0gc3RhdGUuaG9sZDsKICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICBsY29kZSA9IHN0YXRlLmxlbmNvZGU7CiAgICAgICAgZGNvZGUgPSBzdGF0ZS5kaXN0Y29kZTsKICAgICAgICBsbWFzayA9ICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMTsKICAgICAgICBkbWFzayA9ICgxIDw8IHN0YXRlLmRpc3RiaXRzKSAtIDE7CiAgICAgICAgdG9wOgogICAgICAgICAgZG8gewogICAgICAgICAgICBpZiAoYml0cyA8IDE1KSB7CiAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaGVyZSA9IGxjb2RlW2hvbGQgJiBsbWFza107CiAgICAgICAgICAgIGRvbGVuOgogICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAyNDsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgIGJpdHMgLT0gb3A7CiAgICAgICAgICAgICAgICBvcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgaWYgKG9wID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChvcCAmIDE2KSB7CiAgICAgICAgICAgICAgICAgIGxlbiA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgb3AgJj0gMTU7CiAgICAgICAgICAgICAgICAgIGlmIChvcCkgewogICAgICAgICAgICAgICAgICAgIGlmIChiaXRzIDwgb3ApIHsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGxlbiArPSBob2xkICYgKDEgPDwgb3ApIC0gMTsKICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IDE1KSB7CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGVyZSA9IGRjb2RlW2hvbGQgJiBkbWFza107CiAgICAgICAgICAgICAgICAgIGRvZGlzdDoKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICAgIG9wID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCAmIDE2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3QgPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgICAgICAgIG9wICY9IDE1OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZGlzdCArPSBob2xkICYgKDEgPDwgb3ApIC0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpc3QgPiBkbWF4KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2siOwogICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgb3AgPSBfb3V0IC0gYmVnOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGlzdCA+IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgb3AgPSBkaXN0IC0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wID4gd2hhdmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgdG9vIGZhciBiYWNrIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IHNfd2luZG93OwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3bmV4dCA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSArPSB3c2l6ZSAtIG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wIDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh3bmV4dCA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tICs9IHdzaXplICsgd25leHQgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wIC09IHduZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wIDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod25leHQgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcCA9IHduZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gb3V0cHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gKz0gd25leHQgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gb3V0cHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAobGVuID4gMikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IDM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4gPiAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSAzOwogICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiA+IDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuID4gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgob3AgJiA2NCkgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgaGVyZSA9IGRjb2RlWyhoZXJlICYgNjU1MzUpICsgKGhvbGQgJiAoMSA8PCBvcCkgLSAxKV07CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlIGRvZGlzdDsKICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgY29kZSI7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoKG9wICYgNjQpID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBsY29kZVsoaGVyZSAmIDY1NTM1KSArIChob2xkICYgKDEgPDwgb3ApIC0gMSldOwogICAgICAgICAgICAgICAgICBjb250aW51ZSBkb2xlbjsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAob3AgJiAzMikgewogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgfQogICAgICAgICAgfSB3aGlsZSAoX2luIDwgbGFzdCAmJiBfb3V0IDwgZW5kKTsKICAgICAgICBsZW4gPSBiaXRzID4+IDM7CiAgICAgICAgX2luIC09IGxlbjsKICAgICAgICBiaXRzIC09IGxlbiA8PCAzOwogICAgICAgIGhvbGQgJj0gKDEgPDwgYml0cykgLSAxOwogICAgICAgIHN0cm0ubmV4dF9pbiA9IF9pbjsKICAgICAgICBzdHJtLm5leHRfb3V0ID0gX291dDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gX2luIDwgbGFzdCA/IDUgKyAobGFzdCAtIF9pbikgOiA1IC0gKF9pbiAtIGxhc3QpOwogICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gX291dCA8IGVuZCA/IDI1NyArIChlbmQgLSBfb3V0KSA6IDI1NyAtIChfb3V0IC0gZW5kKTsKICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICBzdGF0ZS5iaXRzID0gYml0czsKICAgICAgICByZXR1cm47CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9pbmZ0cmVlcy5qcwogIHZhciByZXF1aXJlX2luZnRyZWVzID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2luZnRyZWVzLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIHV0aWxzID0gcmVxdWlyZV9jb21tb24oKTsKICAgICAgdmFyIE1BWEJJVFMgPSAxNTsKICAgICAgdmFyIEVOT1VHSF9MRU5TID0gODUyOwogICAgICB2YXIgRU5PVUdIX0RJU1RTID0gNTkyOwogICAgICB2YXIgQ09ERVMgPSAwOwogICAgICB2YXIgTEVOUyA9IDE7CiAgICAgIHZhciBESVNUUyA9IDI7CiAgICAgIHZhciBsYmFzZSA9IFsKICAgICAgICAzLAogICAgICAgIDQsCiAgICAgICAgNSwKICAgICAgICA2LAogICAgICAgIDcsCiAgICAgICAgOCwKICAgICAgICA5LAogICAgICAgIDEwLAogICAgICAgIDExLAogICAgICAgIDEzLAogICAgICAgIDE1LAogICAgICAgIDE3LAogICAgICAgIDE5LAogICAgICAgIDIzLAogICAgICAgIDI3LAogICAgICAgIDMxLAogICAgICAgIDM1LAogICAgICAgIDQzLAogICAgICAgIDUxLAogICAgICAgIDU5LAogICAgICAgIDY3LAogICAgICAgIDgzLAogICAgICAgIDk5LAogICAgICAgIDExNSwKICAgICAgICAxMzEsCiAgICAgICAgMTYzLAogICAgICAgIDE5NSwKICAgICAgICAyMjcsCiAgICAgICAgMjU4LAogICAgICAgIDAsCiAgICAgICAgMAogICAgICBdOwogICAgICB2YXIgbGV4dCA9IFsKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAxNiwKICAgICAgICA3MiwKICAgICAgICA3OAogICAgICBdOwogICAgICB2YXIgZGJhc2UgPSBbCiAgICAgICAgMSwKICAgICAgICAyLAogICAgICAgIDMsCiAgICAgICAgNCwKICAgICAgICA1LAogICAgICAgIDcsCiAgICAgICAgOSwKICAgICAgICAxMywKICAgICAgICAxNywKICAgICAgICAyNSwKICAgICAgICAzMywKICAgICAgICA0OSwKICAgICAgICA2NSwKICAgICAgICA5NywKICAgICAgICAxMjksCiAgICAgICAgMTkzLAogICAgICAgIDI1NywKICAgICAgICAzODUsCiAgICAgICAgNTEzLAogICAgICAgIDc2OSwKICAgICAgICAxMDI1LAogICAgICAgIDE1MzcsCiAgICAgICAgMjA0OSwKICAgICAgICAzMDczLAogICAgICAgIDQwOTcsCiAgICAgICAgNjE0NSwKICAgICAgICA4MTkzLAogICAgICAgIDEyMjg5LAogICAgICAgIDE2Mzg1LAogICAgICAgIDI0NTc3LAogICAgICAgIDAsCiAgICAgICAgMAogICAgICBdOwogICAgICB2YXIgZGV4dCA9IFsKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMiwKICAgICAgICAyMiwKICAgICAgICAyMywKICAgICAgICAyMywKICAgICAgICAyNCwKICAgICAgICAyNCwKICAgICAgICAyNSwKICAgICAgICAyNSwKICAgICAgICAyNiwKICAgICAgICAyNiwKICAgICAgICAyNywKICAgICAgICAyNywKICAgICAgICAyOCwKICAgICAgICAyOCwKICAgICAgICAyOSwKICAgICAgICAyOSwKICAgICAgICA2NCwKICAgICAgICA2NAogICAgICBdOwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBmdW5jdGlvbiBpbmZsYXRlX3RhYmxlKHR5cGUsIGxlbnMsIGxlbnNfaW5kZXgsIGNvZGVzLCB0YWJsZSwgdGFibGVfaW5kZXgsIHdvcmssIG9wdHMpIHsKICAgICAgICB2YXIgYml0cyA9IG9wdHMuYml0czsKICAgICAgICB2YXIgbGVuID0gMDsKICAgICAgICB2YXIgc3ltID0gMDsKICAgICAgICB2YXIgbWluID0gMCwgbWF4ID0gMDsKICAgICAgICB2YXIgcm9vdDIgPSAwOwogICAgICAgIHZhciBjdXJyID0gMDsKICAgICAgICB2YXIgZHJvcCA9IDA7CiAgICAgICAgdmFyIGxlZnQgPSAwOwogICAgICAgIHZhciB1c2VkID0gMDsKICAgICAgICB2YXIgaHVmZiA9IDA7CiAgICAgICAgdmFyIGluY3I7CiAgICAgICAgdmFyIGZpbGw7CiAgICAgICAgdmFyIGxvdzsKICAgICAgICB2YXIgbWFzazsKICAgICAgICB2YXIgbmV4dDsKICAgICAgICB2YXIgYmFzZSA9IG51bGw7CiAgICAgICAgdmFyIGJhc2VfaW5kZXggPSAwOwogICAgICAgIHZhciBlbmQ7CiAgICAgICAgdmFyIGNvdW50ID0gbmV3IHV0aWxzLkJ1ZjE2KE1BWEJJVFMgKyAxKTsKICAgICAgICB2YXIgb2ZmcyA9IG5ldyB1dGlscy5CdWYxNihNQVhCSVRTICsgMSk7CiAgICAgICAgdmFyIGV4dHJhID0gbnVsbDsKICAgICAgICB2YXIgZXh0cmFfaW5kZXggPSAwOwogICAgICAgIHZhciBoZXJlX2JpdHMsIGhlcmVfb3AsIGhlcmVfdmFsOwogICAgICAgIGZvciAobGVuID0gMDsgbGVuIDw9IE1BWEJJVFM7IGxlbisrKSB7CiAgICAgICAgICBjb3VudFtsZW5dID0gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChzeW0gPSAwOyBzeW0gPCBjb2Rlczsgc3ltKyspIHsKICAgICAgICAgIGNvdW50W2xlbnNbbGVuc19pbmRleCArIHN5bV1dKys7CiAgICAgICAgfQogICAgICAgIHJvb3QyID0gYml0czsKICAgICAgICBmb3IgKG1heCA9IE1BWEJJVFM7IG1heCA+PSAxOyBtYXgtLSkgewogICAgICAgICAgaWYgKGNvdW50W21heF0gIT09IDApIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChyb290MiA+IG1heCkgewogICAgICAgICAgcm9vdDIgPSBtYXg7CiAgICAgICAgfQogICAgICAgIGlmIChtYXggPT09IDApIHsKICAgICAgICAgIHRhYmxlW3RhYmxlX2luZGV4KytdID0gMSA8PCAyNCB8IDY0IDw8IDE2IHwgMDsKICAgICAgICAgIHRhYmxlW3RhYmxlX2luZGV4KytdID0gMSA8PCAyNCB8IDY0IDw8IDE2IHwgMDsKICAgICAgICAgIG9wdHMuYml0cyA9IDE7CiAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChtaW4gPSAxOyBtaW4gPCBtYXg7IG1pbisrKSB7CiAgICAgICAgICBpZiAoY291bnRbbWluXSAhPT0gMCkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvb3QyIDwgbWluKSB7CiAgICAgICAgICByb290MiA9IG1pbjsKICAgICAgICB9CiAgICAgICAgbGVmdCA9IDE7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPD0gTUFYQklUUzsgbGVuKyspIHsKICAgICAgICAgIGxlZnQgPDw9IDE7CiAgICAgICAgICBsZWZ0IC09IGNvdW50W2xlbl07CiAgICAgICAgICBpZiAobGVmdCA8IDApIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAobGVmdCA+IDAgJiYgKHR5cGUgPT09IENPREVTIHx8IG1heCAhPT0gMSkpIHsKICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgb2Zmc1sxXSA9IDA7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPCBNQVhCSVRTOyBsZW4rKykgewogICAgICAgICAgb2Zmc1tsZW4gKyAxXSA9IG9mZnNbbGVuXSArIGNvdW50W2xlbl07CiAgICAgICAgfQogICAgICAgIGZvciAoc3ltID0gMDsgc3ltIDwgY29kZXM7IHN5bSsrKSB7CiAgICAgICAgICBpZiAobGVuc1tsZW5zX2luZGV4ICsgc3ltXSAhPT0gMCkgewogICAgICAgICAgICB3b3JrW29mZnNbbGVuc1tsZW5zX2luZGV4ICsgc3ltXV0rK10gPSBzeW07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICh0eXBlID09PSBDT0RFUykgewogICAgICAgICAgYmFzZSA9IGV4dHJhID0gd29yazsKICAgICAgICAgIGVuZCA9IDE5OwogICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PT0gTEVOUykgewogICAgICAgICAgYmFzZSA9IGxiYXNlOwogICAgICAgICAgYmFzZV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBleHRyYSA9IGxleHQ7CiAgICAgICAgICBleHRyYV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBlbmQgPSAyNTY7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGJhc2UgPSBkYmFzZTsKICAgICAgICAgIGV4dHJhID0gZGV4dDsKICAgICAgICAgIGVuZCA9IC0xOwogICAgICAgIH0KICAgICAgICBodWZmID0gMDsKICAgICAgICBzeW0gPSAwOwogICAgICAgIGxlbiA9IG1pbjsKICAgICAgICBuZXh0ID0gdGFibGVfaW5kZXg7CiAgICAgICAgY3VyciA9IHJvb3QyOwogICAgICAgIGRyb3AgPSAwOwogICAgICAgIGxvdyA9IC0xOwogICAgICAgIHVzZWQgPSAxIDw8IHJvb3QyOwogICAgICAgIG1hc2sgPSB1c2VkIC0gMTsKICAgICAgICBpZiAodHlwZSA9PT0gTEVOUyAmJiB1c2VkID4gRU5PVUdIX0xFTlMgfHwgdHlwZSA9PT0gRElTVFMgJiYgdXNlZCA+IEVOT1VHSF9ESVNUUykgewogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaGVyZV9iaXRzID0gbGVuIC0gZHJvcDsKICAgICAgICAgIGlmICh3b3JrW3N5bV0gPCBlbmQpIHsKICAgICAgICAgICAgaGVyZV9vcCA9IDA7CiAgICAgICAgICAgIGhlcmVfdmFsID0gd29ya1tzeW1dOwogICAgICAgICAgfSBlbHNlIGlmICh3b3JrW3N5bV0gPiBlbmQpIHsKICAgICAgICAgICAgaGVyZV9vcCA9IGV4dHJhW2V4dHJhX2luZGV4ICsgd29ya1tzeW1dXTsKICAgICAgICAgICAgaGVyZV92YWwgPSBiYXNlW2Jhc2VfaW5kZXggKyB3b3JrW3N5bV1dOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgaGVyZV9vcCA9IDMyICsgNjQ7CiAgICAgICAgICAgIGhlcmVfdmFsID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIGluY3IgPSAxIDw8IGxlbiAtIGRyb3A7CiAgICAgICAgICBmaWxsID0gMSA8PCBjdXJyOwogICAgICAgICAgbWluID0gZmlsbDsKICAgICAgICAgIGRvIHsKICAgICAgICAgICAgZmlsbCAtPSBpbmNyOwogICAgICAgICAgICB0YWJsZVtuZXh0ICsgKGh1ZmYgPj4gZHJvcCkgKyBmaWxsXSA9IGhlcmVfYml0cyA8PCAyNCB8IGhlcmVfb3AgPDwgMTYgfCBoZXJlX3ZhbCB8IDA7CiAgICAgICAgICB9IHdoaWxlIChmaWxsICE9PSAwKTsKICAgICAgICAgIGluY3IgPSAxIDw8IGxlbiAtIDE7CiAgICAgICAgICB3aGlsZSAoaHVmZiAmIGluY3IpIHsKICAgICAgICAgICAgaW5jciA+Pj0gMTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChpbmNyICE9PSAwKSB7CiAgICAgICAgICAgIGh1ZmYgJj0gaW5jciAtIDE7CiAgICAgICAgICAgIGh1ZmYgKz0gaW5jcjsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGh1ZmYgPSAwOwogICAgICAgICAgfQogICAgICAgICAgc3ltKys7CiAgICAgICAgICBpZiAoLS1jb3VudFtsZW5dID09PSAwKSB7CiAgICAgICAgICAgIGlmIChsZW4gPT09IG1heCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxlbiA9IGxlbnNbbGVuc19pbmRleCArIHdvcmtbc3ltXV07CiAgICAgICAgICB9CiAgICAgICAgICBpZiAobGVuID4gcm9vdDIgJiYgKGh1ZmYgJiBtYXNrKSAhPT0gbG93KSB7CiAgICAgICAgICAgIGlmIChkcm9wID09PSAwKSB7CiAgICAgICAgICAgICAgZHJvcCA9IHJvb3QyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG5leHQgKz0gbWluOwogICAgICAgICAgICBjdXJyID0gbGVuIC0gZHJvcDsKICAgICAgICAgICAgbGVmdCA9IDEgPDwgY3VycjsKICAgICAgICAgICAgd2hpbGUgKGN1cnIgKyBkcm9wIDwgbWF4KSB7CiAgICAgICAgICAgICAgbGVmdCAtPSBjb3VudFtjdXJyICsgZHJvcF07CiAgICAgICAgICAgICAgaWYgKGxlZnQgPD0gMCkgewogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGN1cnIrKzsKICAgICAgICAgICAgICBsZWZ0IDw8PSAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHVzZWQgKz0gMSA8PCBjdXJyOwogICAgICAgICAgICBpZiAodHlwZSA9PT0gTEVOUyAmJiB1c2VkID4gRU5PVUdIX0xFTlMgfHwgdHlwZSA9PT0gRElTVFMgJiYgdXNlZCA+IEVOT1VHSF9ESVNUUykgewogICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxvdyA9IGh1ZmYgJiBtYXNrOwogICAgICAgICAgICB0YWJsZVtsb3ddID0gcm9vdDIgPDwgMjQgfCBjdXJyIDw8IDE2IHwgbmV4dCAtIHRhYmxlX2luZGV4IHwgMDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKGh1ZmYgIT09IDApIHsKICAgICAgICAg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zsKICAgICAgdmFyIFpfTUVNX0VSUk9SID0gLTQ7CiAgICAgIHZhciBaX0JVRl9FUlJPUiA9IC01OwogICAgICB2YXIgWl9ERUZMQVRFRCA9IDg7CiAgICAgIHZhciBIRUFEID0gMTsKICAgICAgdmFyIEZMQUdTID0gMjsKICAgICAgdmFyIFRJTUUgPSAzOwogICAgICB2YXIgT1MgPSA0OwogICAgICB2YXIgRVhMRU4gPSA1OwogICAgICB2YXIgRVhUUkEgPSA2OwogICAgICB2YXIgTkFNRSA9IDc7CiAgICAgIHZhciBDT01NRU5UID0gODsKICAgICAgdmFyIEhDUkMgPSA5OwogICAgICB2YXIgRElDVElEID0gMTA7CiAgICAgIHZhciBESUNUID0gMTE7CiAgICAgIHZhciBUWVBFID0gMTI7CiAgICAgIHZhciBUWVBFRE8gPSAxMzsKICAgICAgdmFyIFNUT1JFRCA9IDE0OwogICAgICB2YXIgQ09QWV8gPSAxNTsKICAgICAgdmFyIENPUFkgPSAxNjsKICAgICAgdmFyIFRBQkxFID0gMTc7CiAgICAgIHZhciBMRU5MRU5TID0gMTg7CiAgICAgIHZhciBDT0RFTEVOUyA9IDE5OwogICAgICB2YXIgTEVOXyA9IDIwOwogICAgICB2YXIgTEVOID0gMjE7CiAgICAgIHZhciBMRU5FWFQgPSAyMjsKICAgICAgdmFyIERJU1QgPSAyMzsKICAgICAgdmFyIERJU1RFWFQgPSAyNDsKICAgICAgdmFyIE1BVENIID0gMjU7CiAgICAgIHZhciBMSVQgPSAyNjsKICAgICAgdmFyIENIRUNLID0gMjc7CiAgICAgIHZhciBMRU5HVEggPSAyODsKICAgICAgdmFyIERPTkUgPSAyOTsKICAgICAgdmFyIEJBRCA9IDMwOwogICAgICB2YXIgTUVNID0gMzE7CiAgICAgIHZhciBTWU5DID0gMzI7CiAgICAgIHZhciBFTk9VR0hfTEVOUyA9IDg1MjsKICAgICAgdmFyIEVOT1VHSF9ESVNUUyA9IDU5MjsKICAgICAgdmFyIE1BWF9XQklUUyA9IDE1OwogICAgICB2YXIgREVGX1dCSVRTID0gTUFYX1dCSVRTOwogICAgICBmdW5jdGlvbiB6c3dhcDMyKHEpIHsKICAgICAgICByZXR1cm4gKHEgPj4+IDI0ICYgMjU1KSArIChxID4+PiA4ICYgNjUyODApICsgKChxICYgNjUyODApIDw8IDgpICsgKChxICYgMjU1KSA8PCAyNCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gSW5mbGF0ZVN0YXRlKCkgewogICAgICAgIHRoaXMubW9kZSA9IDA7CiAgICAgICAgdGhpcy5sYXN0ID0gZmFsc2U7CiAgICAgICAgdGhpcy53cmFwID0gMDsKICAgICAgICB0aGlzLmhhdmVkaWN0ID0gZmFsc2U7CiAgICAgICAgdGhpcy5mbGFncyA9IDA7CiAgICAgICAgdGhpcy5kbWF4ID0gMDsKICAgICAgICB0aGlzLmNoZWNrID0gMDsKICAgICAgICB0aGlzLnRvdGFsID0gMDsKICAgICAgICB0aGlzLmhlYWQgPSBudWxsOwogICAgICAgIHRoaXMud2JpdHMgPSAwOwogICAgICAgIHRoaXMud3NpemUgPSAwOwogICAgICAgIHRoaXMud2hhdmUgPSAwOwogICAgICAgIHRoaXMud25leHQgPSAwOwogICAgICAgIHRoaXMud2luZG93ID0gbnVsbDsKICAgICAgICB0aGlzLmhvbGQgPSAwOwogICAgICAgIHRoaXMuYml0cyA9IDA7CiAgICAgICAgdGhpcy5sZW5ndGggPSAwOwogICAgICAgIHRoaXMub2Zmc2V0ID0gMDsKICAgICAgICB0aGlzLmV4dHJhID0gMDsKICAgICAgICB0aGlzLmxlbmNvZGUgPSBudWxsOwogICAgICAgIHRoaXMuZGlzdGNvZGUgPSBudWxsOwogICAgICAgIHRoaXMubGVuYml0cyA9IDA7CiAgICAgICAgdGhpcy5kaXN0Yml0cyA9IDA7CiAgICAgICAgdGhpcy5uY29kZSA9IDA7CiAgICAgICAgdGhpcy5ubGVuID0gMDsKICAgICAgICB0aGlzLm5kaXN0ID0gMDsKICAgICAgICB0aGlzLm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rjb2RlID0gc3RhdGUuZGlzdGR5biA9IG5ldyB1dGlscy5CdWYzMihFTk9VR0hfRElTVFMpOwogICAgICAgIHN0YXRlLnNhbmUgPSAxOwogICAgICAgIHN0YXRlLmJhY2sgPSAtMTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlUmVzZXQoc3RybSkgewogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIHN0YXRlLndzaXplID0gMDsKICAgICAgICBzdGF0ZS53aGF2ZSA9IDA7CiAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgIHJldHVybiBpbmZsYXRlUmVzZXRLZWVwKHN0cm0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVSZXNldDIoc3RybSwgd2luZG93Qml0cykgewogICAgICAgIHZhciB3cmFwOwogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICh3aW5kb3dCaXRzIDwgMCkgewogICAgICAgICAgd3JhcCA9IDA7CiAgICAgICAgICB3aW5kb3dCaXRzID0gLXdpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHdyYXAgPSAod2luZG93Qml0cyA+PiA0KSArIDE7CiAgICAgICAgICBpZiAod2luZG93Qml0cyA8IDQ4KSB7CiAgICAgICAgICAgIHdpbmRvd0JpdHMgJj0gMTU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICh3aW5kb3dCaXRzICYmICh3aW5kb3dCaXRzIDwgOCB8fCB3aW5kb3dCaXRzID4gMTUpKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdGF0ZS53aW5kb3cgIT09IG51bGwgJiYgc3RhdGUud2JpdHMgIT09IHdpbmRvd0JpdHMpIHsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHN0YXRlLndyYXAgPSB3cmFwOwogICAgICAgIHN0YXRlLndiaXRzID0gd2luZG93Qml0czsKICAgICAgICByZXR1cm4gaW5mbGF0ZVJlc2V0KHN0cm0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVJbml0MihzdHJtLCB3aW5kb3dCaXRzKSB7CiAgICAgICAgdmFyIHJldDsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgaWYgKCFzdHJtKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gbmV3IEluZmxhdGVTdGF0ZSgpOwogICAgICAgIHN0cm0uc3RhdGUgPSBzdGF0ZTsKICAgICAgICBzdGF0ZS53aW5kb3cgPSBudWxsOwogICAgICAgIHJldCA9IGluZmxhdGVSZXNldDIoc3RybSwgd2luZG93Qml0cyk7CiAgICAgICAgaWYgKHJldCAhPT0gWl9PSykgewogICAgICAgICAgc3RybS5zdGF0ZSA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZUluaXQoc3RybSkgewogICAgICAgIHJldHVybiBpbmZsYXRlSW5pdDIoc3RybSwgREVGX1dCSVRTKTsKICAgICAgfQogICAgICB2YXIgdmlyZ2luID0gdHJ1ZTsKICAgICAgdmFyIGxlbmZpeDsKICAgICAgdmFyIGRpc3RmaXg7CiAgICAgIGZ1bmN0aW9uIGZpeGVkdGFibGVzKHN0YXRlKSB7CiAgICAgICAgaWYgKHZpcmdpbikgewogICAgICAgICAgdmFyIHN5bTsKICAgICAgICAgIGxlbmZpeCA9IG5ldyB1dGlscy5CdWYzMig1MTIpOwogICAgICAgICAgZGlzdGZpeCA9IG5ldyB1dGlscy5CdWYzMigzMik7CiAgICAgICAgICBzeW0gPSAwOwogICAgICAgICAgd2hpbGUgKHN5bSA8IDE0NCkgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDg7CiAgICAgICAgICB9CiAgICAgICAgICB3aGlsZSAoc3ltIDwgMjU2KSB7CiAgICAgICAgICAgIHN0YXRlLmxlbnNbc3ltKytdID0gOTsKICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzeW0gPCAyODApIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA3OwogICAgICAgICAgfQogICAgICAgICAgd2hpbGUgKHN5bSA8IDI4OCkgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDg7CiAgICAgICAgICB9CiAgICAgICAgICBpbmZsYXRlX3RhYmxlKExFTlMsIHN0YXRlLmxlbnMsIDAsIDI4OCwgbGVuZml4LCAwLCBzdGF0ZS53b3JrLCB7IGJpdHM6IDkgfSk7CiAgICAgICAgICBzeW0gPSAwOwogICAgICAgICAgd2hpbGUgKHN5bSA8IDMyKSB7CiAgICAgICAgICAgIHN0YXRlLmxlbnNbc3ltKytdID0gNTsKICAgICAgICAgIH0KICAgICAgICAgIGluZmxhdGVfdGFibGUoRElTVFMsIHN0YXRlLmxlbnMsIDAsIDMyLCBkaXN0Zml4LCAwLCBzdGF0ZS53b3JrLCB7IGJpdHM6IDUgfSk7CiAgICAgICAgICB2aXJnaW4gPSBmYWxzZTsKICAgICAgICB9CiAgICAgICAgc3RhdGUubGVuY29kZSA9IGxlbmZpeDsKICAgICAgICBzdGF0ZS5sZW5iaXRzID0gOTsKICAgICAgICBzdGF0ZS5kaXN0Y29kZSA9IGRpc3RmaXg7CiAgICAgICAgc3RhdGUuZGlzdGJpdHMgPSA1OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHVwZGF0ZXdpbmRvdyhzdHJtLCBzcmMsIGVuZCwgY29weSkgewogICAgICAgIHZhciBkaXN0OwogICAgICAgIHZhciBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgaWYgKHN0YXRlLndpbmRvdyA9PT0gbnVsbCkgewogICAgICAgICAgc3RhdGUud3NpemUgPSAxIDw8IHN0YXRlLndiaXRzOwogICAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgICAgc3RhdGUud2hhdmUgPSAwOwogICAgICAgICAgc3RhdGUud2luZG93ID0gbmV3IHV0aWxzLkJ1Zjgoc3RhdGUud3NpemUpOwogICAgICAgIH0KICAgICAgICBpZiAoY29weSA+PSBzdGF0ZS53c2l6ZSkgewogICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUud2luZG93LCBzcmMsIGVuZCAtIHN0YXRlLndzaXplLCBzdGF0ZS53c2l6ZSwgMCk7CiAgICAgICAgICBzdGF0ZS53bmV4dCA9IDA7CiAgICAgICAgICBzdGF0ZS53aGF2ZSA9IHN0YXRlLndzaXplOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBkaXN0ID0gc3RhdGUud3NpemUgLSBzdGF0ZS53bmV4dDsKICAgICAgICAgIGlmIChkaXN0ID4gY29weSkgewogICAgICAgICAgICBkaXN0ID0gY29weTsKICAgICAgICAgIH0KICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0YXRlLndpbmRvdywgc3JjLCBlbmQgLSBjb3B5LCBkaXN0LCBzdGF0ZS53bmV4dCk7CiAgICAgICAgICBjb3B5IC09IGRpc3Q7CiAgICAgICAgICBpZiAoY29weSkgewogICAgICAgICAgICB1dGlscy5hcnJheVNldChzdGF0ZS53aW5kb3csIHNyYywgZW5kIC0gY29weSwgY29weSwgMCk7CiAgICAgICAgICAgIHN0YXRlLnduZXh0ID0gY29weTsKICAgICAgICAgICAgc3RhdGUud2hhdmUgPSBzdGF0ZS53c2l6ZTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHN0YXRlLnduZXh0ICs9IGRpc3Q7CiAgICAgICAgICAgIGlmIChzdGF0ZS53bmV4dCA9PT0gc3RhdGUud3NpemUpIHsKICAgICAgICAgICAgICBzdGF0ZS53bmV4dCA9IDA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHN0YXRlLndoYXZlIDwgc3RhdGUud3NpemUpIHsKICAgICAgICAgICAgICBzdGF0ZS53aGF2ZSArPSBkaXN0OwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGUoc3RybSwgZmx1c2gpIHsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgdmFyIGlucHV0LCBvdXRwdXQ7CiAgICAgICAgdmFyIG5leHQ7CiAgICAgICAgdmFyIHB1dDsKICAgICAgICB2YXIgaGF2ZSwgbGVmdDsKICAgICAgICB2YXIgaG9sZDsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgX2luLCBfb3V0OwogICAgICAgIHZhciBjb3B5OwogICAgICAgIHZhciBmcm9tOwogICAgICAgIHZhciBmcm9tX3NvdXJjZTsKICAgICAgICB2YXIgaGVyZSA9IDA7CiAgICAgICAgdmFyIGhlcmVfYml0cywgaGVyZV9vcCwgaGVyZV92YWw7CiAgICAgICAgdmFyIGxhc3RfYml0cywgbGFzdF9vcCwgbGFzdF92YWw7CiAgICAgICAgdmFyIGxlbjsKICAgICAgICB2YXIgcmV0OwogICAgICAgIHZhciBoYnVmID0gbmV3IHV0aWxzLkJ1ZjgoNCk7CiAgICAgICAgdmFyIG9wdHM7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIG9yZGVyID0gWzE2LCAxNywgMTgsIDAsIDgsIDcsIDksIDYsIDEwLCA1LCAxMSwgNCwgMTIsIDMsIDEzLCAyLCAxNCwgMSwgMTVdOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSB8fCAhc3RybS5vdXRwdXQgfHwgIXN0cm0uaW5wdXQgJiYgc3RybS5hdmFpbF9pbiAhPT0gMCkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzdGF0ZSA9IHN0cm0uc3RhdGU7CiAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IFRZUEUpIHsKICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFRE87CiAgICAgICAgfQogICAgICAgIHB1dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgb3V0cHV0ID0gc3RybS5vdXRwdXQ7CiAgICAgICAgbGVmdCA9IHN0cm0uYXZhaWxfb3V0OwogICAgICAgIG5leHQgPSBzdHJtLm5leHRfaW47CiAgICAgICAgaW5wdXQgPSBzdHJtLmlucHV0OwogICAgICAgIGhhdmUgPSBzdHJtLmF2YWlsX2luOwogICAgICAgIGhvbGQgPSBzdGF0ZS5ob2xkOwogICAgICAgIGJpdHMgPSBzdGF0ZS5iaXRzOwogICAgICAgIF9pbiA9IGhhdmU7CiAgICAgICAgX291dCA9IGxlZnQ7CiAgICAgICAgcmV0ID0gWl9PSzsKICAgICAgICBpbmZfbGVhdmU6CiAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgc3dpdGNoIChzdGF0ZS5tb2RlKSB7CiAgICAgICAgICAgICAgY2FzZSBIRUFEOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLndyYXAgPT09IDApIHsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEVETzsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwICYgMiAmJiBob2xkID09PSAzNTYxNSkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IDA7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEZMQUdTOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmZsYWdzID0gMDsKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZG9uZSA9IGZhbHNlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCEoc3RhdGUud3JhcCAmIDEpIHx8ICgoKGhvbGQgJiAyNTUpIDw8IDgpICsgKGhvbGQgPj4gOCkpICUgMzEpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGhlYWRlciBjaGVjayI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKChob2xkICYgMTUpICE9PSBaX0RFRkxBVEVEKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInVua25vd24gY29tcHJlc3Npb24gbWV0aG9kIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNDsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNDsKICAgICAgICAgICAgICAgIGxlbiA9IChob2xkICYgMTUpICsgODsKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53Yml0cyA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS53Yml0cyA9IGxlbjsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobGVuID4gc3RhdGUud2JpdHMpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCB3aW5kb3cgc2l6ZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZG1heCA9IDEgPDwgbGVuOwogICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0gMTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBob2xkICYgNTEyID8gRElDVElEIDogVFlQRTsKICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIEZMQUdTOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5mbGFncyA9IGhvbGQ7CiAgICAgICAgICAgICAgICBpZiAoKHN0YXRlLmZsYWdzICYgMjU1KSAhPT0gWl9ERUZMQVRFRCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJ1bmtub3duIGNvbXByZXNzaW9uIG1ldGhvZCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTczNDQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAidW5rbm93biBoZWFkZXIgZmxhZ3Mgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnRleHQgPSBob2xkID4+IDggJiAxOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRJTUU7CiAgICAgICAgICAgICAgY2FzZSBUSU1FOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnRpbWUgPSBob2xkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsyXSA9IGhvbGQgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzNdID0gaG9sZCA+Pj4gMjQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGhidWYsIDQsIDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBPUzsKICAgICAgICAgICAgICBjYXNlIE9TOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnhmbGFncyA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQub3MgPSBob2xkID4+IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhidWZbMV0gPSBob2xkID4+PiA4ICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyKHN0YXRlLmNoZWNrLCBoYnVmLCAyLCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRVhMRU47CiAgICAgICAgICAgICAgY2FzZSBFWExFTjoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDEwMjQpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoID0gaG9sZDsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhX2xlbiA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEVYVFJBOwogICAgICAgICAgICAgIGNhc2UgRVhUUkE6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAxMDI0KSB7CiAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmhlYWQuZXh0cmFfbGVuIC0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgaWYgKCFzdGF0ZS5oZWFkLmV4dHJhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBuZXcgQXJyYXkoc3RhdGUuaGVhZC5leHRyYV9sZW4pOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUuaGVhZC5leHRyYSwgaW5wdXQsIG5leHQsIGNvcHksIGxlbik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCAtPSBjb3B5OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTkFNRTsKICAgICAgICAgICAgICBjYXNlIE5BTUU6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAyMDQ4KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGNvcHkgPSAwOwogICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgbGVuID0gaW5wdXRbbmV4dCArIGNvcHkrK107CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQgJiYgbGVuICYmIHN0YXRlLmxlbmd0aCA8IDY1NTM2KSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLm5hbWUgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShsZW4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobGVuICYmIGNvcHkgPCBoYXZlKTsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5uYW1lID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ09NTUVOVDsKICAgICAgICAgICAgICBjYXNlIENPTU1FTlQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA0MDk2KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGNvcHkgPSAwOwogICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgbGVuID0gaW5wdXRbbmV4dCArIGNvcHkrK107CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQgJiYgbGVuICYmIHN0YXRlLmxlbmd0aCA8IDY1NTM2KSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmNvbW1lbnQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShsZW4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobGVuICYmIGNvcHkgPCBoYXZlKTsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5jb21tZW50ID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBIQ1JDOwogICAgICAgICAgICAgIGNhc2UgSENSQzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaG9sZCAhPT0gKHN0YXRlLmNoZWNrICYgNjU1MzUpKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaGVhZGVyIGNyYyBtaXNtYXRjaCI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmhjcmMgPSBzdGF0ZS5mbGFncyA+PiA5ICYgMTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5kb25lID0gdHJ1ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgRElDVElEOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSB6c3dhcDMyKGhvbGQpOwogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESUNUOwogICAgICAgICAgICAgIGNhc2UgRElDVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlZGljdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfb3V0ID0gcHV0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGxlZnQ7CiAgICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9pbiA9IG5leHQ7CiAgICAgICAgICAgICAgICAgIHN0cm0uYXZhaWxfaW4gPSBoYXZlOwogICAgICAgICAgICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICAgICAgICAgICAgc3RhdGUuYml0cyA9IGJpdHM7CiAgICAgICAgICAgICAgICAgIHJldHVybiBaX05FRURfRElDVDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDE7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICBjYXNlIFRZUEU6CiAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfQkxPQ0sgfHwgZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGNhc2UgVFlQRURPOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxhc3QpIHsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ0hFQ0s7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxhc3QgPSBob2xkICYgMTsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAxOwogICAgICAgICAgICAgICAgYml0cyAtPSAxOwogICAgICAgICAgICAgICAgc3dpdGNoIChob2xkICYgMykgewogICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFNUT1JFRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgIGZpeGVkdGFibGVzKHN0YXRlKTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUQUJMRTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYmxvY2sgdHlwZSI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBTVE9SRUQ6CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gYml0cyAmIDc7CiAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhvbGQgJiA2NTUzNSkgIT09IChob2xkID4+PiAxNiBeIDY1NTM1KSkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIHN0b3JlZCBibG9jayBsZW5ndGhzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBob2xkICYgNjU1MzU7CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFlfOwogICAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX1RSRUVTKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBjYXNlIENPUFlfOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFk7CiAgICAgICAgICAgICAgY2FzZSBDT1BZOgogICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBsZWZ0OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KG91dHB1dCwgaW5wdXQsIG5leHQsIGNvcHksIHB1dCk7CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBsZWZ0IC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIHB1dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgVEFCTEU6CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE0KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm5sZW4gPSAoaG9sZCAmIDMxKSArIDI1NzsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA1OwogICAgICAgICAgICAgICAgYml0cyAtPSA1OwogICAgICAgICAgICAgICAgc3RhdGUubmRpc3QgPSAoaG9sZCAmIDMxKSArIDE7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNTsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNTsKICAgICAgICAgICAgICAgIHN0YXRlLm5jb2RlID0gKGhvbGQgJiAxNSkgKyA0OwogICAgICAgICAgICAgICAgaG9sZCA+Pj49IDQ7CiAgICAgICAgICAgICAgICBiaXRzIC09IDQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubmxlbiA+IDI4NiB8fCBzdGF0ZS5uZGlzdCA+IDMwKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInRvbyBtYW55IGxlbmd0aCBvciBkaXN0YW5jZSBzeW1ib2xzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5MRU5TOwogICAgICAgICAgICAgIGNhc2UgTEVOTEVOUzoKICAgICAgICAgICAgICAgIHdoaWxlIChzdGF0ZS5oYXZlIDwgc3RhdGUubmNvZGUpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW29yZGVyW3N0YXRlLmhhdmUrK11dID0gaG9sZCAmIDc7CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAzOwogICAgICAgICAgICAgICAgICBiaXRzIC09IDM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB3aGlsZSAoc3RhdGUuaGF2ZSA8IDE5KSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbb3JkZXJbc3RhdGUuaGF2ZSsrXV0gPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubGVuY29kZSA9IHN0YXRlLmxlbmR5bjsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA3OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShDT0RFUywgc3RhdGUubGVucywgMCwgMTksIHN0YXRlLmxlbmNvZGUsIDAsIHN0YXRlLndvcmssIG9wdHMpOwogICAgICAgICAgICAgICAgc3RhdGUubGVuYml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBjb2RlIGxlbmd0aHMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT0RFTEVOUzsKICAgICAgICAgICAgICBjYXNlIENPREVMRU5TOgogICAgICAgICAgICAgICAgd2hpbGUgKHN0YXRlLmhhdmUgPCBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgICAgaGVyZSA9IHN0YXRlLmxlbmNvZGVbaG9sZCAmICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhlcmVfdmFsIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSsrXSA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX3ZhbCA9PT0gMTYpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAyOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgY29weSA9IDMgKyAoaG9sZCAmIDMpOwogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IDI7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IDI7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChoZXJlX3ZhbCA9PT0gMTcpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAzOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICBjb3B5ID0gMyArIChob2xkICYgNyk7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gMzsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gMzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgbiA9IGhlcmVfYml0cyArIDc7CiAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgICAgbGVuID0gMDsKICAgICAgICAgICAgICAgICAgICAgIGNvcHkgPSAxMSArIChob2xkICYgMTI3KTsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA3OwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSA3OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSArIGNvcHkgPiBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB3aGlsZSAoY29weS0tKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBsZW47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubW9kZSA9PT0gQkFEKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxlbnNbMjU2XSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGNvZGUgLS0gbWlzc2luZyBlbmQtb2YtYmxvY2siOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA5OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShMRU5TLCBzdGF0ZS5sZW5zLCAwLCBzdGF0ZS5ubGVuLCBzdGF0ZS5sZW5jb2RlLCAwLCBzdGF0ZS53b3JrLCBvcHRzKTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgICAgICAgICBpZiAocmV0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgbGl0ZXJhbC9sZW5ndGhzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGJpdHMgPSA2OwogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGNvZGUgPSBzdGF0ZS5kaXN0ZHluOwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUuZGlzdGJpdHMgfTsKICAgICAgICAgICAgICAgIHJldCA9IGluZmxhdGVfdGFibGUoRElTVFMsIHN0YXRlLmxlbnMsIHN0YXRlLm5sZW4sIHN0YXRlLm5kaXN0LCBzdGF0ZS5kaXN0Y29kZSwgMCwgc3RhdGUud29yaywgb3B0cyk7CiAgICAgICAgICAgICAgICBzdGF0ZS5kaXN0Yml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZXMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9UUkVFUykgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgY2FzZSBMRU5fOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTjsKICAgICAgICAgICAgICBjYXNlIExFTjoKICAgICAgICAgICAgICAgIGlmIChoYXZlID49IDYgJiYgbGVmdCA+PSAyNTgpIHsKICAgICAgICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBsZWZ0OwogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaG9sZCA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgICAgICAgICAgICBpbmZsYXRlX2Zhc3Qoc3RybSwgX291dCk7CiAgICAgICAgICAgICAgICAgIHB1dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgICAgICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgICAgICAgICAgICBsZWZ0ID0gc3RybS5hdmFpbF9vdXQ7CiAgICAgICAgICAgICAgICAgIG5leHQgPSBzdHJtLm5leHRfaW47CiAgICAgICAgICAgICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICAgICAgICAgICAgaGF2ZSA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgICAgICAgICAgIGhvbGQgPSBzdGF0ZS5ob2xkOwogICAgICAgICAgICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IFRZUEUpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gMDsKICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtob2xkICYgKDEgPDwgc3RhdGUubGVuYml0cykgLSAxXTsKICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGVyZV92YWwgPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYmIChoZXJlX29wICYgMjQwKSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBsYXN0X2JpdHMgPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgIGxhc3Rfb3AgPSBoZXJlX29wOwogICAgICAgICAgICAgICAgICBsYXN0X3ZhbCA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBoZXJlX3ZhbDsKICAgICAgICAgICAgICAgIGlmIChoZXJlX29wID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMSVQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGhlcmVfb3AgJiAzMikgewogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYgNjQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5FWFQ7CiAgICAgICAgICAgICAgY2FzZSBMRU5FWFQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZXh0cmEpIHsKICAgICAgICAgICAgICAgICAgbiA9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCArPSBob2xkICYgKDEgPDwgc3RhdGUuZXh0cmEpIC0gMTsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBiaXRzIC09IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUud2FzID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IERJU1Q7CiAgICAgICAgICAgICAgY2FzZSBESVNUOgogICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtob2xkICYgKDEgPDwgc3RhdGUuZGlzdGJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICBoZXJlX29wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICBpZiAoaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhlcmVfb3AgJiAyNDApID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGxhc3RfYml0cyA9IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgbGFzdF9vcCA9IGhlcmVfb3A7CiAgICAgICAgICAgICAgICAgIGxhc3RfdmFsID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCAmIDY0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgY29kZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESVNURVhUOwogICAgICAgICAgICAgIGNhc2UgRElTVEVYVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5leHRyYSkgewogICAgICAgICAgICAgICAgICBuID0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ICs9IGhvbGQgJiAoMSA8PCBzdGF0ZS5leHRyYSkgLSAxOwogICAgICAgICAgICAgICAgICBob2xkID4+Pj0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIGJpdHMgLT0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gc3RhdGUuZG1heCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IE1BVENIOwogICAgICAgICAgICAgIGNhc2UgTUFUQ0g6CiAgICAgICAgICAgICAgICBpZiAobGVmdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjb3B5ID0gX291dCAtIGxlZnQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gY29weSkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gc3RhdGUub2Zmc2V0IC0gY29weTsKICAgICAgICAgICAgICAgICAgaWYgKGNvcHkgPiBzdGF0ZS53aGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gc3RhdGUud25leHQpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5IC09IHN0YXRlLnduZXh0OwogICAgICAgICAgICAgICAgICAgIGZyb20gPSBzdGF0ZS53c2l6ZSAtIGNvcHk7CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZnJvbSA9IHN0YXRlLnduZXh0IC0gY29weTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IHN0YXRlLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBzdGF0ZS53aW5kb3c7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgZnJvbSA9IHB1dCAtIHN0YXRlLm9mZnNldDsKICAgICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gbGVmdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGxlZnQgLT0gY29weTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCAtPSBjb3B5OwogICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICBvdXRwdXRbcHV0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tY29weSk7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIExJVDoKICAgICAgICAgICAgICAgIGlmIChsZWZ0ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG91dHB1dFtwdXQrK10gPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICBsZWZ0LS07CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBDSEVDSzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCB8PSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIF9vdXQgLT0gbGVmdDsKICAgICAgICAgICAgICAgICAgc3RybS50b3RhbF9vdXQgKz0gX291dDsKICAgICAgICAgICAgICAgICAgc3RhdGUudG90YWwgKz0gX291dDsKICAgICAgICAgICAgICAgICAgaWYgKF9vdXQpIHsKICAgICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSBzdGF0ZS5mbGFncyA/IGNyYzMyKHN0YXRlLmNoZWNrLCBvdXRwdXQsIF9vdXQsIHB1dCAtIF9vdXQpIDogYWRsZXIzMihzdGF0ZS5jaGVjaywgb3V0cHV0LCBfb3V0LCBwdXQgLSBfb3V0KTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBfb3V0ID0gbGVmdDsKICAgICAgICAgICAgICAgICAgaWYgKChzdGF0ZS5mbGFncyA/IGhvbGQgOiB6c3dhcDMyKGhvbGQpKSAhPT0gc3RhdGUuY2hlY2spIHsKICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbmNvcnJlY3QgZGF0YSBjaGVjayI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOR1RIOwogICAgICAgICAgICAgIGNhc2UgTEVOR1RIOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLndyYXAgJiYgc3RhdGUuZmxhZ3MpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhvbGQgIT09IChzdGF0ZS50b3RhbCAmIDQyOTQ5NjcyOTUpKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGxlbmd0aCBjaGVjayI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRE9ORTsKICAgICAgICAgICAgICBjYXNlIERPTkU6CiAgICAgICAgICAgICAgICByZXQgPSBaX1NUUkVBTV9FTkQ7CiAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgY2FzZSBCQUQ6CiAgICAgICAgICAgICAgICByZXQgPSBaX0RBVEFfRVJST1I7CiAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgY2FzZSBNRU06CiAgICAgICAgICAgICAgICByZXR1cm4gWl9NRU1fRVJST1I7CiAgICAgICAgICAgICAgY2FzZSBTWU5DOgogICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICBzdHJtLm5leHRfb3V0ID0gcHV0OwogICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gbGVmdDsKICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0OwogICAgICAgIHN0cm0uYXZhaWxfaW4gPSBoYXZlOwogICAgICAgIHN0YXRlLmhvbGQgPSBob2xkOwogICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgIGlmIChzdGF0ZS53c2l6ZSB8fCBfb3V0ICE9PSBzdHJtLmF2YWlsX291dCAmJiBzdGF0ZS5tb2RlIDwgQkFEICYmIChzdGF0ZS5tb2RlIDwgQ0hFQ0sgfHwgZmx1c2ggIT09IFpfRklOSVNIKSkgewogICAgICAgICAgaWYgKHVwZGF0ZXdpbmRvdyhzdHJtLCBzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCwgX291dCAtIHN0cm0uYXZhaWxfb3V0KSkgewogICAgICAgICAgICBzdGF0ZS5tb2RlID0gTUVNOwogICAgICAgICAgICByZXR1cm4gWl9NRU1fRVJST1I7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIF9pbiAtPSBzdHJtLmF2YWlsX2luOwogICAgICAgIF9vdXQgLT0gc3RybS5hdmFpbF9vdXQ7CiAgICAgICAgc3RybS50b3RhbF9pbiArPSBfaW47CiAgICAgICAgc3RybS50b3RhbF9vdXQgKz0gX291dDsKICAgICAgICBzdGF0ZS50b3RhbCArPSBfb3V0OwogICAgICAgIGlmIChzdGF0ZS53cmFwICYmIF9vdXQpIHsKICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IHN0YXRlLmZsYWdzID8gY3JjMzIoc3RhdGUuY2hlY2ssIG91dHB1dCwgX291dCwgc3RybS5uZXh0X291dCAtIF9vdXQpIDogYWRsZXIzMihzdGF0ZS5jaGVjaywgb3V0cHV0LCBfb3V0LCBzdHJtLm5leHRfb3V0IC0gX291dCk7CiAgICAgICAgfQogICAgICAgIHN0cm0uZGF0YV90eXBlID0gc3RhdGUuYml0cyArIChzdGF0ZS5sYXN0ID8gNjQgOiAwKSArIChzdGF0ZS5tb2RlID09PSBUWVBFID8gMTI4IDogMCkgKyAoc3RhdGUubW9kZSA9PT0gTEVOXyB8fCBzdGF0ZS5tb2RlID09PSBDT1BZXyA/IDI1NiA6IDApOwogICAgICAgIGlmICgoX2luID09PSAwICYmIF9vdXQgPT09IDAgfHwgZmx1c2ggPT09IFpfRklOSVNIKSAmJiByZXQgPT09IFpfT0spIHsKICAgICAgICAgIHJldCA9IFpfQlVGX0VSUk9SOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmV0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVFbmQoc3RybSkgewogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICB2YXIgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS53aW5kb3cpIHsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHN0cm0uc3RhdGUgPSBudWxsOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVHZXRIZWFkZXIoc3RybSwgaGVhZCkgewogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICgoc3RhdGUud3JhcCAmIDIpID09PSAwKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlLmhlYWQgPSBoZWFkOwogICAgICAgIGhlYWQuZG9uZSA9IGZhbHNlOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVTZXREaWN0aW9uYXJ5KHN0cm0sIGRpY3Rpb25hcnkpIHsKICAgICAgICB2YXIgZGljdExlbmd0aCA9IGRpY3Rpb25hcnkubGVuZ3RoOwogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICB2YXIgZGljdGlkOwogICAgICAgIHZhciByZXQ7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBpZiAoc3RhdG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VTVF9DT01QUkVTU0lPTjogOSwKICAgICAgICBaX0RFRkFVTFRfQ09NUFJFU1NJT046IC0xLAogICAgICAgIFpfRklMVEVSRUQ6IDEsCiAgICAgICAgWl9IVUZGTUFOX09OTFk6IDIsCiAgICAgICAgWl9STEU6IDMsCiAgICAgICAgWl9GSVhFRDogNCwKICAgICAgICBaX0RFRkFVTFRfU1RSQVRFR1k6IDAsCiAgICAgICAgWl9CSU5BUlk6IDAsCiAgICAgICAgWl9URVhUOiAxLAogICAgICAgIFpfVU5LTk9XTjogMiwKICAgICAgICBaX0RFRkxBVEVEOiA4CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9nemhlYWRlci5qcwogIHZhciByZXF1aXJlX2d6aGVhZGVyID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2d6aGVhZGVyLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgZnVuY3Rpb24gR1poZWFkZXIoKSB7CiAgICAgICAgdGhpcy50ZXh0ID0gMDsKICAgICAgICB0aGlzLnRpbWUgPSAwOwogICAgICAgIHRoaXMueGZsYWdzID0gMDsKICAgICAgICB0aGlzLm9zID0gMDsKICAgICAgICB0aGlzLmV4dHJhID0gbnVsbDsKICAgICAgICB0aGlzLmV4dHJhX2xlbiA9IDA7CiAgICAgICAgdGhpcy5uYW1lID0gIiI7CiAgICAgICAgdGhpcy5jb21tZW50ID0gIiI7CiAgICAgICAgdGhpcy5oY3JjID0gMDsKICAgICAgICB0aGlzLmRvbmUgPSBmYWxzZTsKICAgICAgfQogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBHWmhlYW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G9wdCA9IHRoaXMub3B0aW9uczsKICAgICAgICBpZiAob3B0LnJhdyAmJiBvcHQud2luZG93Qml0cyA+PSAwICYmIG9wdC53aW5kb3dCaXRzIDwgMTYpIHsKICAgICAgICAgIG9wdC53aW5kb3dCaXRzID0gLW9wdC53aW5kb3dCaXRzOwogICAgICAgICAgaWYgKG9wdC53aW5kb3dCaXRzID09PSAwKSB7CiAgICAgICAgICAgIG9wdC53aW5kb3dCaXRzID0gLTE1OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAob3B0LndpbmRvd0JpdHMgPj0gMCAmJiBvcHQud2luZG93Qml0cyA8IDE2ICYmICEob3B0aW9ucyAmJiBvcHRpb25zLndpbmRvd0JpdHMpKSB7CiAgICAgICAgICBvcHQud2luZG93Qml0cyArPSAzMjsKICAgICAgICB9CiAgICAgICAgaWYgKG9wdC53aW5kb3dCaXRzID4gMTUgJiYgb3B0LndpbmRvd0JpdHMgPCA0OCkgewogICAgICAgICAgaWYgKChvcHQud2luZG93Qml0cyAmIDE1KSA9PT0gMCkgewogICAgICAgICAgICBvcHQud2luZG93Qml0cyB8PSAxNTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgdGhpcy5lcnIgPSAwOwogICAgICAgIHRoaXMubXNnID0gIiI7CiAgICAgICAgdGhpcy5lbmRlZCA9IGZhbHNlOwogICAgICAgIHRoaXMuY2h1bmtzID0gW107CiAgICAgICAgdGhpcy5zdHJtID0gbmV3IFpTdHJlYW0oKTsKICAgICAgICB0aGlzLnN0cm0uYXZhaWxfb3V0ID0gMDsKICAgICAgICB2YXIgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGVJbml0Mih0aGlzLnN0cm0sIG9wdC53aW5kb3dCaXRzKTsKICAgICAgICBpZiAoc3RhdHVzICE9PSBjLlpfT0spIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcihtc2dbc3RhdHVzXSk7CiAgICAgICAgfQogICAgICAgIHRoaXMuaGVhZGVyID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V0X3V0ZjgsIHRhaWwsIHV0ZjhzdHI7CiAgICAgICAgdmFyIGFsbG93QnVmRXJyb3IgPSBmYWxzZTsKICAgICAgICBpZiAodGhpcy5lbmRlZCkgewogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgICBfbW9kZSA9IG1vZGUgPT09IH5+bW9kZSA/IG1vZGUgOiBtb2RlID09PSB0cnVlID8gYy5aX0ZJTklTSCA6IGMuWl9OT19GTFVTSDsKICAgICAgICBpZiAodHlwZW9mIGRhdGEgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICBzdHJtLmlucHV0ID0gc3RyaW5ncy5iaW5zdHJpbmcyYnVmKGRhdGEpOwogICAgICAgIH0gZWxzZSBpZiAodG9TdHJpbmcuY2FsbChkYXRhKSA9PT0gIltvYmplY3QgQXJyYXlCdWZmZXJdIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IG5ldyBVaW50OEFycmF5KGRhdGEpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBzdHJtLmlucHV0ID0gZGF0YTsKICAgICAgICB9CiAgICAgICAgc3RybS5uZXh0X2luID0gMDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gc3RybS5pbnB1dC5sZW5ndGg7CiAgICAgICAgZG8gewogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHN0cm0ub3V0cHV0ID0gbmV3IHV0aWxzLkJ1ZjgoY2h1bmtTaXplKTsKICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IDA7CiAgICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gY2h1bmtTaXplOwogICAgICAgICAgfQogICAgICAgICAgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGUoc3RybSwgYy5aX05PX0ZMVVNIKTsKICAgICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9ORUVEX0RJQ1QgJiYgZGljdGlvbmFyeSkgewogICAgICAgICAgICBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZVNldERpY3Rpb25hcnkodGhpcy5zdHJtLCBkaWN0aW9uYXJ5KTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9CVUZfRVJST1IgJiYgYWxsb3dCdWZFcnJvciA9PT0gdHJ1ZSkgewogICAgICAgICAgICBzdGF0dXMgPSBjLlpfT0s7CiAgICAgICAgICAgIGFsbG93QnVmRXJyb3IgPSBmYWxzZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdGF0dXMgIT09IGMuWl9TVFJFQU1fRU5EICYmIHN0YXR1cyAhPT0gYy5aX09LKSB7CiAgICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgICAgdGhpcy5lbmRlZCA9IHRydWU7CiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdHJtLm5leHRfb3V0KSB7CiAgICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCB8fCBzdGF0dXMgPT09IGMuWl9TVFJFQU1fRU5EIHx8IHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgKF9tb2RlID09PSBjLlpfRklOSVNIIHx8IF9tb2RlID09PSBjLlpfU1lOQ19GTFVTSCkpIHsKICAgICAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLnRvID09PSAic3RyaW5nIikgewogICAgICAgICAgICAgICAgbmV4dF9vdXRfdXRmOCA9IHN0cmluZ3MudXRmOGJvcmRlcihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCk7CiAgICAgICAgICAgICAgICB0YWlsID0gc3RybS5uZXh0X291dCAtIG5leHRfb3V0X3V0Zjg7CiAgICAgICAgICAgICAgICB1dGY4c3RyID0gc3RyaW5ncy5idWYyc3RyaW5nKHN0cm0ub3V0cHV0LCBuZXh0X291dF91dGY4KTsKICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSB0YWlsOwogICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBjaHVua1NpemUgLSB0YWlsOwogICAgICAgICAgICAgICAgaWYgKHRhaWwpIHsKICAgICAgICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RybS5vdXRwdXQsIHN0cm0ub3V0cHV0LCBuZXh0X291dF91dGY4LCB0YWlsLCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0ZjhzdHIpOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0aGlzLm9uRGF0YSh1dGlscy5zaHJpbmtCdWYoc3RybS5vdXRwdXQsIHN0cm0ubmV4dF9vdXQpKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdHJtLmF2YWlsX2luID09PSAwICYmIHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIGFsbG93QnVmRXJyb3IgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKChzdHJtLmF2YWlsX2luID4gMCB8fCBzdHJtLmF2YWlsX291dCA9PT0gMCkgJiYgc3RhdHVzICE9PSBjLlpfU1RSRUFNX0VORCk7CiAgICAgICAgaWYgKHN0YXR1cyA9PT0gYy5aX1NUUkVBTV9FTkQpIHsKICAgICAgICAgIF9tb2RlID0gYy5aX0ZJTklTSDsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBjLlpfRklOSVNIKSB7CiAgICAgICAgICBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZUVuZCh0aGlzLnN0cm0pOwogICAgICAgICAgdGhpcy5vbkVuZChzdGF0dXMpOwogICAgICAgICAgdGhpcy5lbmRlZCA9IHRydWU7CiAgICAgICAgICByZXR1cm4gc3RhdHVzID09PSBjLlpfT0s7CiAgICAgICAgfQogICAgICAgIGlmIChfbW9kZSA9PT0gYy5aX1NZTkNfRkxVU0gpIHsKICAgICAgICAgIHRoaXMub25FbmQoYy5aX09LKTsKICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gMDsKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgfTsKICAgICAgSW5mbGF0ZTIucHJvdG90eXBlLm9uRGF0YSA9IGZ1bmN0aW9uKGNodW5rKSB7CiAgICAgICAgdGhpcy5jaHVua3MucHVzaChjaHVuayk7CiAgICAgIH07CiAgICAgIEluZmxhdGUyLnByb3RvdHlwZS5vbkVuZCA9IGZ1bmN0aW9uKHN0YXR1cykgewogICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9PSykgewogICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgdGhpcy5yZXN1bHQgPSB0aGlzLmNodW5rcy5qb2luKCIiKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdXRpbHMuZmxhdHRlbkNodW5rcyh0aGlzLmNodW5rcyk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHRoaXMuY2h1bmtzID0gW107CiAgICAgICAgdGhpcy5lcnIgPSBzdGF0dXM7CiAgICAgICAgdGhpcy5tc2cgPSB0aGlzLnN0cm0ubXNnOwogICAgICB9OwogICAgICBmdW5jdGlvbiBpbmZsYXRlKGlucHV0LCBvcHRpb25zKSB7CiAgICAgICAgdmFyIGluZmxhdG9yID0gbmV3IEluZmxhdGUyKG9wdGlvbnMpOwogICAgICAgIGluZmxhdG9yLnB1c2goaW5wdXQsIHRydWUpOwogICAgICAgIGlmIChpbmZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IGluZmxhdG9yLm1zZyB8fCBtc2dbaW5mbGF0b3IuZXJyXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGluZmxhdG9yLnJlc3VsdDsKICAgICA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ucG5wbS9sb25nQDQuMC4wL25vZGVfbW9kdWxlcy9sb25nL3NyYy9sb25nLmpzCiAgdmFyIHJlcXVpcmVfbG9uZyA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9sb25nQDQuMC4wL25vZGVfbW9kdWxlcy9sb25nL3NyYy9sb25nLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgIG1vZHVsZTIuZXhwb3J0cyA9IExvbmc0OwogICAgICB2YXIgd2FzbSA9IG51bGw7CiAgICAgIHRyeSB7CiAgICAgICAgd2FzbSA9IG5ldyBXZWJBc3NlbWJseS5JbnN0YW5jZShuZXcgV2ViQXNzZW1ibHkuTW9kdWxlKG5ldyBVaW50OEFycmF5KFsKICAgICAgICAgIDAsCiAgICAgICAgICA5NywKICAgICAgICAgIDExNSwKICAgICAgICAgIDEwOSwKICAgICAgICAgIDEsCiAgICAgICAgICAwLAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAxLAogICAgICAgICAgMTMsCiAgICAgICAgICAyLAogICAgICAgICAgOTYsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNywKICAgICAgICAgIDk2LAogICAgICAgICAgNCwKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAzLAogICAgICAgICAgNywKICAgICAgICAgIDYsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICA2LAogICAgICAgICAgNiwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxLAogICAgICAgICAgNjUsCiAgICAgICAgICAwLAogICAgICAgICAgMTEsCiAgICAgICAgICA3LAogICAgICAgICAgNTAsCiAgICAgICAgICA2LAogICAgICAgICAgMywKICAgICAgICAgIDEwOSwKICAgICAgICAgIDExNywKICAgICAgICAgIDEwOCwKICAgICAgICAgIDAsCiAgICAgICAgICAxLAogICAgICAgICAgNSwKICAgICAgICAgIDEwMCwKICAgICAgICAgIDEwNSwKICAgICAgICAgIDExOCwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE1LAogICAgICAgICAgMCwKICAgICAgICAgIDIsCiAgICAgICAgICA1LAogICAgICAgICAgMTAwLAogICAgICAgICAgMTA1LAogICAgICAgICAgMTE4LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMTcsCiAgICAgICAgICAwLAogICAgICAgICAgMywKICAgICAgICAgIDUsCiAgICAgICAgICAxMTQsCiAgICAgICAgICAxMDEsCiAgICAgICAgICAxMDksCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNSwKICAgICAgICAgIDAsCiAgICAgICAgICA0LAogICAgICAgICAgNSwKICAgICAgICAgIDExNCwKICAgICAgICAgIDEwMSwKICAgICAgICAgIDEwOSwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE3LAogICAgICAgICAgMCwKICAgICAgICAgIDUsCiAgICAgICAgICA4LAogICAgICAgICAgMTAzLAogICAgICAgICAgMTAxLAogICAgICAgICAgMTE2LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMDQsCiAgICAgICAgICAxMDUsCiAgICAgICAgICAxMDMsCiAgICAgICAgICAxMDQsCiAgICAgICAgICAwLAogICAgICAgICAgMCwKICAgICAgICAgIDEwLAogICAgICAgICAgMTkxLAogICAgICAgICAgMSwKICAgICAgICAgIDYsCiAgICAgICAgICA0LAogICAgICAgICAgMCwKICAgICAgICAgIDM1LAogICAgICAgICAgMCwKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI2LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI3LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI4LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI5LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTMwLAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExCiAgICAgICAgXSkpLCB7fSkuZXhwb3J0czsKICAgICAgfSBjYXRjaCAoZSkgewogICAgICB9CiAgICAgIGZ1bmN0aW9uIExvbmc0KGxvdywgaGlnaCwgdW5zaWduZWQpIHsKICAgICAgICB0aGlzLmxvdyA9IGxvdyB8IDA7CiAgICAgICAgdGhpcy5oaWdoID0gaGlnaCB8IDA7CiAgICAgICAgdGhpcy51bnNpZ25lZCA9ICEhdW5zaWduZWQ7CiAgICAgIH0KICAgICAgTG9uZzQucHJvdG90eXBlLl9faXNMb25nX187CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShMb25nNC5wcm90b3R5cGUsICJfX2lzTG9uZ19fIiwgeyB2YWx1ZTogdHJ1ZSB9KTsKICAgICAgZnVuY3Rpb24gaXNMb25nKG9iaikgewogICAgICAgIHJldHVybiAob2JqICYmIG9ialsiX19pc0xvbmdfXyJdKSA9PT0gdHJ1ZTsKICAgICAgfQogICAgICBMb25nNC5pc0xvbmcgPSBpc0xvbmc7CiAgICAgIHZhciBJTlRfQ0FDSEUgPSB7fTsKICAgICAgdmFyIFVJTlRfQ0FDSEUgPSB7fTsKICAgICAgZnVuY3Rpb24gZnJvbUludCh2YWx1ZSwgdW5zaWduZWQpIHsKICAgICAgICB2YXIgb2JqLCBjYWNoZWRPYmosIGNhY2hlOwogICAgICAgIGlmICh1bnNpZ25lZCkgewogICAgICAgICAgdmFsdWUgPj4+PSAwOwogICAgICAgICAgaWYgKGNhY2hlID0gMCA8PSB2YWx1ZSAmJiB2YWx1ZSA8IDI1NikgewogICAgICAgICAgICBjYWNoZWRPYmogPSBVSU5UX0NBQ0hFW3ZhbHVlXTsKICAgICAgICAgICAgaWYgKGNhY2hlZE9iaikKICAgICAgICAgICAgICByZXR1cm4gY2FjaGVkT2JqOwogICAgICAgICAgfQogICAgICAgICAgb2JqID0gZnJvbUJpdHModmFsdWUsICh2YWx1ZSB8IDApIDwgMCA/IC0xIDogMCwgdHJ1ZSk7CiAgICAgICAgICBpZiAoY2FjaGUpCiAgICAgICAgICAgIFVJTlRfQ0FDSEVbdmFsdWVdID0gb2JqOwogICAgICAgICAgcmV0dXJuIG9iajsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdmFsdWUgfD0gMDsKICAgICAgICAgIGlmIChjYWNoZSA9IC0xMjggPD0gdmFsdWUgJiYgdmFsdWUgPCAxMjgpIHsKICAgICAgICAgICAgY2FjaGVkT2JqID0gSU5UX0NBQ0hFW3ZhbHVlXTsKICAgICAgICAgICAgaWYgKGNhY2hlZE9iaikKICAgICAgICAgICAgICByZXR1cm4gY2FjaGVkT2JqOwogICAgICAgICAgfQogICAgICAgICAgb2JqID0gZnJvbUJpdHModmFsdWUsIHZhbHVlIDwgMCA/IC0xIDogMCwgZmFsc2UpOwogICAgICAgICAgaWYgKGNhY2hlKQogICAgICAgICAgICBJTlRfQ0FDSEVbdmFsdWVdID0gb2JqOwogICAgICAgICAgcmV0dXJuIG9iajsKICAgICAgICB9CiAgICAgIH0KICAgICAgTG9uZzQuZnJvbUludCA9IGZyb21JbnQ7CiAgICAgIGZ1bmN0aW9uIGZyb21OdW1iZXIodmFsdWUsIHVuc2lnbmVkKSB7CiAgICAgICAgaWYgKGlzTmFOKHZhbHVlKSkKICAgICAgICAgIHJldHVybiB1bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICBpZiAodW5zaWduZWQpIHsKICAgICAgICAgIGlmICh2YWx1ZSA8IDApCiAgICAgICAgICAgIHJldHVybiBVWkVSTzsKICAgICAgICAgIGlmICh2YWx1ZSA+PSBUV09fUFdSXzY0X0RCTCkKICAgICAgICAgICAgcmV0dXJuIE1BWF9VTlNJR05FRF9WQUxVRTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKHZhbHVlIDw9IC1UV09fUFdSXzYzX0RCTCkKICAgICAgICAgICAgcmV0dXJuIE1JTl9WQUxVRTsKICAgICAgICAgIGlmICh2YWx1ZSArIDEgPj0gVFdPX1BXUl82M19EQkwpCiAgICAgICAgICAgIHJldHVybiBNQVhfVkFMVUU7CiAgICAgICAgfQogICAgICAgIGlmICh2YWx1ZSA8IDApCiAgICAgICAgICByZXR1cm4gZnJvbU51bWJlcigtdmFsdWUsIHVuc2lnbmVkKS5uZWcoKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModmFsdWUgJSBUV09fUFdSXzMyX0RCTCB8IDAsIHZhbHVlIC8gVFdPX1BXUl8zMl9EQkwgfCAwLCB1bnNpZ25lZCk7CiAgICAgIH0KICAgICAgTG9uZzQuZnJvbU51bWJlciA9IGZyb21OdW1iZXI7CiAgICAgIGZ1bmN0aW9uIGZyb21CaXRzKGxvd0JpdHMsIGhpZ2hCaXRzLCB1bnNpZ25lZCkgewogICAgICAgIHJldHVybiBuZXcgTG9uZzQobG93Qml0cywgaGlnaEJpdHMsIHVuc2lnbmVkKTsKICAgICAgfQogICAgICBMb25nNC5mcm9tQml0cyA9IGZyb21CaXRzOwogICAgICB2YXIgcG93X2RibCA9IE1hdGgucG93OwogICAgICBmdW5jdGlvbiBmcm9tU3RyaW5nKHN0ciwgdW5zaWduZWQsIHJhZGl4KSB7CiAgICAgICAgaWYgKHN0ci5sZW5ndGggPT09IDApCiAgICAgICAgICB0aHJvdyBFcnJvcigiZW1wdHkgc3RyaW5nIik7CiAgICAgICAgaWYgKHN0ciA9PT0gIk5hTiIgfHwgc3RyID09PSAiSW5maW5pdHkiIHx8IHN0ciA9PT0gIitJbmZpbml0eSIgfHwgc3RyID09PSAiLUluZmluaXR5IikKICAgICAgICAgIHJldHVybiBaRVJPOwogICAgICAgIGlmICh0eXBlb2YgdW5zaWduZWQgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICByYWRpeCA9IHVuc2lnbmVkLCB1bnNpZ25lZCA9IGZhbHNlOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB1bnNpZ25lZCA9ICEhdW5zaWduZWQ7CiAgICAgICAgfQogICAgICAgIHJhZGl4ID0gcmFkaXggfHwgMTA7CiAgICAgICAgaWYgKHJhZGl4IDwgMiB8fCAzNiA8IHJhZGl4KQogICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcigicmFkaXgiKTsKICAgICAgICB2YXIgcDsKICAgICAgICBpZiAoKHAgPSBzdHIuaW5kZXhPZigiLSIpKSA+IDApCiAgICAgICAgICB0aHJvdyBFcnJvcigiaW50ZXJpb3IgaHlwaGVuIik7CiAgICAgICAgZWxzZSBpZiAocCA9PT0gMCkgewogICAgICAgICAgcmV0dXJuIGZyb21TdHJpbmcoc3RyLnN1YnN0cmluZygxKSwgdW5zaWduZWQsIHJhZGl4KS5uZWcoKTsKICAgICAgICB9CiAgICAgICAgdmFyIHJhZGl4VG9Qb3dlciA9IGZyb21OdW1iZXIocG93X2RibChyYWRpeCwgOCkpOwogICAgICAgIHZhciByZXN1bHQgPSBaRVJPOwogICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSArPSA4KSB7CiAgICAgICAgICB2YXIgc2l6ZSA9IE1hdGgubWluKDgsIHN0ci5sZW5ndGggLSBpKSwgdmFsdWUgPSBwYXJzZUludChzdHIuc3Vic3RyaW5nKGksIGkgKyBzaXplKSwgcmFkaXgpOwogICAgICAgICAgaWYgKHNpemUgPCA4KSB7CiAgICAgICAgICAgIHZhciBwb3dlciA9IGZyb21OdW1iZXIocG93X2RibChyYWRpeCwgc2l6ZSkpOwogICAgICAgICAgICByZXN1bHQgPSByZXN1bHQubXVsKHBvd2VyKS5hZGQoZnJvbU51bWJlcih2YWx1ZSkpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmVzdWx0ID0gcmVzdWx0Lm11bChyYWRpeFRvUG93ZXIpOwogICAgICAgICAgICByZXN1bHQgPSByZXN1bHQuYWRkKGZyb21OdW1iZXIodmFsdWUpKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmVzdWx0LnVuc2lnbmVkID0gdW5zaWduZWQ7CiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgfQogICAgICBMb25nNC5mcm9tU3RyaW5nID0gZnJvbVN0cmluZzsKICAgICAgZnVuY3Rpb24gZnJvbVZhbHVlKHZhbCwgdW5zaWduZWQpIHsKICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gIm51bWJlciIpCiAgICAgICAgICByZXR1cm4gZnJvbU51bWJlcih2YWwsIHVuc2lnbmVkKTsKICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gInN0cmluZyIpCiAgICAgICAgICByZXR1cm4gZnJvbVN0cmluZyh2YWwsIHVuc2lnbmVkKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModmFsLmxvd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pKSB7CiAgICAgICAgICAgIHZhciByYWRpeExvbmcgPSBmcm9tTnVtYmVyKHJhZGl4KSwgZGl2ID0gdGhpcy5kaXYocmFkaXhMb25nKSwgcmVtMSA9IGRpdi5tdWwocmFkaXhMb25nKS5zdWIodGhpcyk7CiAgICAgICAgICAgIHJldHVybiBkaXYudG9TdHJpbmcocmFkaXgpICsgcmVtMS50b0ludCgpLnRvU3RyaW5nKHJhZGl4KTsKICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICByZXR1cm4gIi0iICsgdGhpcy5uZWcoKS50b1N0cmluZyhyYWRpeCk7CiAgICAgICAgfQogICAgICAgIHZhciByYWRpeFRvUG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIDYpLCB0aGlzLnVuc2lnbmVkKSwgcmVtID0gdGhpczsKICAgICAgICB2YXIgcmVzdWx0ID0gIiI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHZhciByZW1EaXYgPSByZW0uZGl2KHJhZGl4VG9Qb3dlciksIGludHZhbCA9IHJlbS5zdWIocmVtRGl2Lm11bChyYWRpeFRvUG93ZXIpKS50b0ludCgpID4+PiAwLCBkaWdpdHMgPSBpbnR2YWwudG9TdHJpbmcocmFkaXgpOwogICAgICAgICAgcmVtID0gcmVtRGl2OwogICAgICAgICAgaWYgKHJlbS5pc1plcm8oKSkKICAgICAgICAgICAgcmV0dXJuIGRpZ2l0cyArIHJlc3VsdDsKICAgICAgICAgIGVsc2UgewogICAgICAgICAgICB3aGlsZSAoZGlnaXRzLmxlbmd0aCA8IDYpCiAgICAgICAgICAgICAgZGlnaXRzID0gIjAiICsgZGlnaXRzOwogICAgICAgICAgICByZXN1bHQgPSAiIiArIGRpZ2l0cyArIHJlc3VsdDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0SGlnaEJpdHMgPSBmdW5jdGlvbiBnZXRIaWdoQml0cygpIHsKICAgICA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AgICBMb25nUHJvdG90eXBlLmVxeiA9IExvbmdQcm90b3R5cGUuaXNaZXJvOwogICAgICBMb25nUHJvdG90eXBlLmlzTmVnYXRpdmUgPSBmdW5jdGlvbiBpc05lZ2F0aXZlKCkgewogICAgICAgIHJldHVybiAhdGhpcy51bnNpZ25lZCAmJiB0aGlzLmhpZ2ggPCAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzUG9zaXRpdmUgPSBmdW5jdGlvbiBpc1Bvc2l0aXZlKCkgewogICAgICAgIHJldHVybiB0aGlzLnVuc2lnbmVkIHx8IHRoaXMuaGlnaCA+PSAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzT2RkID0gZnVuY3Rpb24gaXNPZGQoKSB7CiAgICAgICAgcmV0dXJuICh0aGlzLmxvdyAmIDEpID09PSAxOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzRXZlbiA9IGZ1bmN0aW9uIGlzRXZlbigpIHsKICAgICAgICByZXR1cm4gKHRoaXMubG93ICYgMSkgPT09IDA7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZXF1YWxzID0gZnVuY3Rpb24gZXF1YWxzKG90aGVyKSB7CiAgICAgICAgaWYgKCFpc0xvbmcob3RoZXIpKQogICAgICAgICAgb3RoZXIgPSBmcm9tVmFsdWUob3RoZXIpOwogICAgICAgIGlmICh0aGlzLnVuc2lnbmVkICE9PSBvdGhlci51bnNpZ25lZCAmJiB0aGlzLmhpZ2ggPj4+IDMxID09PSAxICYmIG90aGVyLmhpZ2ggPj4+IDMxID09PSAxKQogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIHJldHVybiB0aGlzLmhpZ2ggPT09IG90aGVyLmhpZ2ggJiYgdGhpcy5sb3cgPT09IG90aGVyLmxvdzsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5lcSA9IExvbmdQcm90b3R5cGUuZXF1YWxzOwogICAgICBMb25nUHJvdG90eXBlLm5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ggKyBiNDg7CiAgICAgICAgYzQ4ICY9IDY1NTM1OwogICAgICAgIHJldHVybiBmcm9tQml0cyhjMTYgPDwgMTYgfCBjMDAsIGM0OCA8PCAxNiB8IGMzMiwgdGhpcy51bnNpZ25lZCk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuc3VidHJhY3QgPSBmdW5jdGlvbiBzdWJ0cmFjdChzdWJ0cmFoZW5kKSB7CiAgICAgICAgaWYgKCFpc0xvbmcoc3VidHJhaGVuZCkpCiAgICAgICAgICBzdWJ0cmFoZW5kID0gZnJvbVZhbHVlKHN1YnRyYWhlbmQpOwogICAgICAgIHJldHVybiB0aGlzLmFkZChzdWJ0cmFoZW5kLm5lZygpKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zdWIgPSBMb25nUHJvdG90eXBlLnN1YnRyYWN0OwogICAgICBMb25nUHJvdG90eXBlLm11bHRpcGx5ID0gZnVuY3Rpb24gbXVsdGlwbHkobXVsdGlwbGllcikgewogICAgICAgIGlmICh0aGlzLmlzWmVybygpKQogICAgICAgICAgcmV0dXJuIFpFUk87CiAgICAgICAgaWYgKCFpc0xvbmcobXVsdGlwbGllcikpCiAgICAgICAgICBtdWx0aXBsaWVyID0gZnJvbVZhbHVlKG11bHRpcGxpZXIpOwogICAgICAgIGlmICh3YXNtKSB7CiAgICAgICAgICB2YXIgbG93ID0gd2FzbS5tdWwodGhpcy5sb3csIHRoaXMuaGlnaCwgbXVsdGlwbGllci5sb3csIG11bHRpcGxpZXIuaGlnaCk7CiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMobG93LCB3YXNtLmdldF9oaWdoKCksIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgICBpZiAobXVsdGlwbGllci5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiBaRVJPOwogICAgICAgIGlmICh0aGlzLmVxKE1JTl9WQUxVRSkpCiAgICAgICAgICByZXR1cm4gbXVsdGlwbGllci5pc09kZCgpID8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nJvbVZhbHVlKGRpdmlzb3IpOwogICAgICAgIGlmIChkaXZpc29yLmlzWmVybygpKQogICAgICAgICAgdGhyb3cgRXJyb3IoImRpdmlzaW9uIGJ5IHplcm8iKTsKICAgICAgICBpZiAod2FzbSkgewogICAgICAgICAgaWYgKCF0aGlzLnVuc2lnbmVkICYmIHRoaXMuaGlnaCA9PT0gLTIxNDc0ODM2NDggJiYgZGl2aXNvci5sb3cgPT09IC0xICYmIGRpdmlzb3IuaGlnaCA9PT0gLTEpIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICB9CiAgICAgICAgICB2YXIgbG93ID0gKHRoaXMudW5zaWduZWQgPyB3YXNtLmRpdl91IDogd2FzbS5kaXZfcykodGhpcy5sb3csIHRoaXMuaGlnaCwgZGl2aXNvci5sb3csIGRpdmlzb3IuaGlnaCk7CiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMobG93LCB3YXNtLmdldF9oaWdoKCksIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiB0aGlzLnVuc2lnbmVkID8gVVpFUk8gOiBaRVJPOwogICAgICAgIHZhciBhcHByb3gsIHJlbSwgcmVzOwogICAgICAgIGlmICghdGhpcy51bnNpZ25lZCkgewogICAgICAgICAgaWYgKHRoaXMuZXEoTUlOX1ZBTFVFKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5lcShPTkUpIHx8IGRpdmlzb3IuZXEoTkVHX09ORSkpCiAgICAgICAgICAgICAgcmV0dXJuIE1JTl9WQUxVRTsKICAgICAgICAgICAgZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICAgIHJldHVybiBPTkU7CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgIHZhciBoYWxmVGhpcyA9IHRoaXMuc2hyKDEpOwogICAgICAgICAgICAgIGFwcHJveCA9IGhhbGZUaGlzLmRpdihkaXZpc29yKS5zaGwoMSk7CiAgICAgICAgICAgICAgaWYgKGFwcHJveC5lcShaRVJPKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGRpdmlzb3IuaXNOZWdhdGl2ZSgpID8gT05FIDogTkVHX09ORTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmVtID0gdGhpcy5zdWIoZGl2aXNvci5tdWwoYXBwcm94KSk7CiAgICAgICAgICAgICAgICByZXMgPSBhcHByb3guYWRkKHJlbS5kaXYoZGl2aXNvcikpOwogICAgICAgICAgICAgICAgcmV0dXJuIHJlczsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICByZXR1cm4gdGhpcy51bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICAgIGlmICh0aGlzLmlzTmVnYXRpdmUoKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkuZGl2KGRpdmlzb3IubmVnKCkpOwogICAgICAgICAgICByZXR1cm4gdGhpcy5uZWcoKS5kaXYoZGl2aXNvcikubmVnKCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGRpdmlzb3IuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgICByZXR1cm4gdGhpcy5kaXYoZGl2aXNvci5uZWcoKSkubmVnKCk7CiAgICAgICAgICByZXMgPSBaRVJPOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAoIWRpdmlzb3IudW5zaWduZWQpCiAgICAgICAgICAgIGRpdmlzb3IgPSBkaXZpc29yLnRvVW5zaWduZWQoKTsKICAgICAgICAgIGlmIChkaXZpc29yLmd0KHRoaXMpKQogICAgICAgICAgICByZXR1cm4gVVpFUk87CiAgICAgICAgICBpZiAoZGl2aXNvci5ndCh0aGlzLnNocnUoMSkpKQogICAgICAgICAgICByZXR1cm4gVU9ORTsKICAgICAgICAgIHJlcyA9IFVaRVJPOwogICAgICAgIH0KICAgICAgICByZW0gPSB0aGlzOwogICAgICAgIHdoaWxlIChyZW0uZ3RlKGRpdmlzb3IpKSB7CiAgICAgICAgICBhcHByb3ggPSBNYXRoLm1heCgxLCBNYXRoLmZsb29yKHJlbS50b051bWJlcigpIC8gZGl2aXNvci50b051bWJlcigpKSk7CiAgICAgICAgICB2YXIgbG9nMiA9IE1hdGguY2VpbChNYXRoLmxvZyhhcHByb3gpIC8gTWF0aC5MTjIpLCBkZWx0YSA9IGxvZzIgPD0gNDggPyAxIDogcG93X2RibCgyLCBsb2cyIC0gNDgpLCBhcHByb3hSZXMgPSBmcm9tTnVtYmVyKGFwcHJveCksIGFwcHJveFJlbSA9IGFwcHJveFJlcy5tdWwoZGl2aXNvcik7CiAgICAgICAgICB3aGlsZSAoYXBwcm94UmVtLmlzTmVnYXRpdmUoKSB8fCBhcHByb3hSZW0uZ3QocmVtKSkgewogICAgICAgICAgICBhcHByb3ggLT0gZGVsdGE7CiAgICAgICAgICAgIGFwcHJveFJlcyA9IGZyb21OdW1iZXIoYXBwcm94LCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICAgICAgYXBwcm94UmVtID0gYXBwcm94UmVzLm11bChkaXZpc29yKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChhcHByb3hSZXMuaXNaZXJvKCkpCiAgICAgICAgICAgIGFwcHJveFJlcyA9IE9ORTsKICAgICAgICAgIHJlcyA9IHJlcy5hZGQoYXBwcm94UmVzKTsKICAgICAgICAgIHJlbSA9IHJlbS5zdWIoYXBwcm94UmVtKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlczsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5kaXYgPSBMb25nUHJvdG90eXBlLmRpdmlkZTsKICAgICAgTG9uZ1Byb3RvdHlwZS5tb2R1bG8gPSBmdW5jdGlvbiBtb2R1bG8oZGl2aXNvcikgewogICAgICAgIGlmICghaXNMb25nKGRpdmlzb3IpKQogICAgICAgICAgZGl2aXNvciA9IGZyb21WYWx1ZShkaXZpc29yKTsKICAgICAgICBpZiAod2FzbSkgewogICAgICAgICAgdmFyIGxvdyA9ICh0aGlzLnVuc2lnbmVkID8gd2FzbS5yZW1fdSA6IHdhc20ucmVtX3MpKHRoaXMubG93LCB0aGlzLmhpZ2gsIGRpdmlzb3IubG93LCBkaXZpc29yLmhpZ2gpOwogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKGxvdywgd2FzbS5nZXRfaGlnaCgpLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXMuc3ViKHRoaXMuZGl2KGRpdmlzb3IpLm11bChkaXZpc29yKSk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUubW9kID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUucmVtID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUubm90ID0gZnVuY3Rpb24gbm90KCkgewogICAgICAgIHJldHVybiBmcm9tQml0cyh+dGhpcy5sb3csIH50aGlzLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmFuZCA9IGZ1bmN0aW9uIGFuZChvdGhlcikgewogICAgICAgIGlmICghaXNMb25nKG90aGVyKSkKICAgICAgICAgIG90aGVyID0gZnJvbVZhbHVlKG90aGVyKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgJiBvdGhlci5sb3csIHRoaXMuaGlnaCAmIG90aGVyLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLm9yID0gZnVuY3Rpb24gb3Iob3RoZXIpIHsKICAgICAgICBpZiAoIWlzTG9uZyhvdGhlcikpCiAgICAgICAg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Y3Rpb24gc2hpZnRSaWdodChudW1CaXRzKSB7CiAgICAgICAgaWYgKGlzTG9uZyhudW1CaXRzKSkKICAgICAgICAgIG51bUJpdHMgPSBudW1CaXRzLnRvSW50KCk7CiAgICAgICAgaWYgKChudW1CaXRzICY9IDYzKSA9PT0gMCkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKG51bUJpdHMgPCAzMikKICAgICAgICAgIHJldHVybiBmcm9tQml0cyh0aGlzLmxvdyA+Pj4gbnVtQml0cyB8IHRoaXMuaGlnaCA8PCAzMiAtIG51bUJpdHMsIHRoaXMuaGlnaCA+PiBudW1CaXRzLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICBlbHNlCiAgICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5oaWdoID4+IG51bUJpdHMgLSAzMiwgdGhpcy5oaWdoID49IDAgPyAwIDogLTEsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLnNociA9IExvbmdQcm90b3R5cGUuc2hpZnRSaWdodDsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0VW5zaWduZWQgPSBmdW5jdGlvbiBzaGlmdFJpZ2h0VW5zaWduZWQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIG51bUJpdHMgJj0gNjM7CiAgICAgICAgaWYgKG51bUJpdHMgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNlIHsKICAgICAgICAgIHZhciBoaWdoID0gdGhpcy5oaWdoOwogICAgICAgICAgaWYgKG51bUJpdHMgPCAzMikgewogICAgICAgICAgICB2YXIgbG93ID0gdGhpcy5sb3c7CiAgICAgICAgICAgIHJldHVybiBmcm9tQml0cyhsb3cgPj4+IG51bUJpdHMgfCBoaWdoIDw8IDMyIC0gbnVtQml0cywgaGln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dW5jdGlvbiB0b0J5dGVzTEUoKSB7CiAgICAgICAgdmFyIGhpID0gdGhpcy5oaWdoLCBsbyA9IHRoaXMubG93OwogICAgICAgIHJldHVybiBbCiAgICAgICAgICBsbyAmIDI1NSwKICAgICAgICAgIGxvID4+PiA4ICYgMjU1LAogICAgICAgICAgbG8gPj4+IDE2ICYgMjU1LAogICAgICAgICAgbG8gPj4+IDI0LAogICAgICAgICAgaGkgJiAyNTUsCiAgICAgICAgICBoaSA+Pj4gOCAmIDI1NSwKICAgICAgICAgIGhpID4+PiAxNiAmIDI1NSwKICAgICAgICAgIGhpID4+PiAyNAogICAgICAgIF07CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9CeXRlc0JFID0gZnVuY3Rpb24gdG9CeXRlc0JFKCkgewogICAgICAgIHZhciBoaSA9IHRoaXMuaGlnaCwgbG8gPSB0aGlzLmxvdzsKICAgICAgICByZXR1cm4gWwogICAgICAgICAgaGkgPj4+IDI0LAogICAgICAgICAgaGkgPj4+IDE2ICYgMjU1LAogICAgICAgICAgaGkgPj4+IDggJiAyNTUsCiAgICAgICAgICBoaSAmIDI1NSwKICAgICAgICAgIGxvID4+PiAyNCwKICAgICAgICAgIGxvID4+PiAxNiAmIDI1NSwKICAgICAgICAgIGxvID4+PiA4ICYgMjU1LAogICAgICAgICAgbG8gJiAyNTUKICAgICAgICBdOwogICAgICB9OwogICAgICBMb25nNC5mcm9tQnl0ZXMgPSBmdW5jdGlvbiBmcm9tQnl0ZXMyKGJ5dGVzLCB1bnNpZ25lZCwgbGUpIHsKICAgICAgICByZXR1cm4gbGUgPyBMb25nNC5mcm9tQnl0ZXNMRShieXRlcywgdW5zaWduZWQpIDogTG9uZzQuZnJvbUJ5dGVzQkUoYnl0ZXMsIHVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZzQuZnJvbUJ5dGVzTEUgPSBmdW5jdGlvbiBmcm9tQnl0ZXNMRShieXRlcywgdW5zaWduZWQpIHsKICAgICAgIC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RhcmdldCwgcmVjZWl2ZXIsIGFyZ3MpIHsKICAgICAgICByZXR1cm4gRnVuY3Rpb24ucHJvdG90eXBlLmFwcGx5LmNhbGwodGFyZ2V0LCByZWNlaXZlciwgYXJncyk7CiAgICAgIH07CiAgICAgIHZhciBSZWZsZWN0T3duS2V5czsKICAgICAgaWYgKFIgJiYgdHlwZW9mIFIub3duS2V5cyA9PT0gImZ1bmN0aW9uIikgewogICAgICAgIFJlZmxlY3RPd25LZXlzID0gUi5vd25LZXlzOwogICAgICB9IGVsc2UgaWYgKE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMpIHsKICAgICAgICBSZWZsZWN0T3duS2V5cyA9IGZ1bmN0aW9uIFJlZmxlY3RPd25LZXlzMih0YXJnZXQpIHsKICAgICAgICAgIHJldHVybiBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyh0YXJnZXQpLmNvbmNhdChPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKHRhcmdldCkpOwogICAgICAgIH07CiAgICAgIH0gZWxzZSB7CiAgICAgICAgUmVmbGVjdE93bktleXMgPSBmdW5jdGlvbiBSZWZsZWN0T3duS2V5czIodGFyZ2V0KSB7CiAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXModGFyZ2V0KTsKICAgICAgICB9OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIFByb2Nlc3NFbWl0V2FybmluZyh3YXJuaW5nKSB7CiAgICAgICAgaWYgKGNvbnNvbGUgJiYgY29uc29sZS53YXJuKQogICAgICAgICAgY29uc29sZS53YXJuKHdhcm5pbmcpOwogICAgICB9CiAgICAgIHZhciBOdW1iZXJJc05hTiA9IE51bWJlci5pc05hTiB8fCBmdW5jdGlvbiBOdW1iZXJJc05hTjIodmFsdWUpIHsKICAgICAgICByZXR1cm4gdmFsdWUgIT09IHZhbHVlOwogICAgICB9OwogICAgICBmdW5jdGlvbiBFdmVudEVtaXR0ZXIoKSB7C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ICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gX2dldE1heExpc3RlbmVycyh0aGF0KSB7CiAgICAgICAgaWYgKHRoYXQuX21heExpc3RlbmVycyA9PT0gdm9pZCAwKQogICAgICAgICAgcmV0dXJuIEV2ZW50RW1pdHRlci5kZWZhdWx0TWF4TGlzdGVuZXJzOwogICAgICAgIHJldHVybiB0aGF0Ll9tYXhMaXN0ZW5lcnM7CiAgICAgIH0KICAgICAgRXZlbnRFbWl0dGVyLnByb3RvdHlwZS5nZXRNYXhMaXN0ZW5lcnMgPSBmdW5jdGlvbiBnZXRNYXhMaXN0ZW5lcnMoKSB7CiAgICAgICAgcmV0dXJuIF9nZXRNYXhMaXN0ZW5lcnModGhpcyk7CiAgICAgIH07CiAgICAgIEV2ZW50RW1pdHRlci5wcm90b3R5cGUuZW1pdCA9IGZ1bmN0aW9uIGVtaXQodHlwZSkgewogICAgICAgIHZhciBhcmdzID0gW107CiAgICAgICAgZm9yICh2YXIgaSA9IDE7IGkgPCBhcmd1bWVudHMubGVuZ3RoOyBpKyspCiAgICAgICAgICBhcmdzLnB1c2goYXJndW1lbnRzW2ldKTsKICAgICAgICB2YXIgZG9FcnJvciA9IHR5cGUgPT09ICJlcnJvciI7CiAgICAgICAgdmFyIGV2ZW50cyA9IHRoaXMuX2V2ZW50czsKICAgICAgICBpZiAoZXZlbnRzICE9PSB2b2lkIDApCiAgICAgICAgICBkb0Vycm9yID0gZG9FcnJvciAmJiBldmVudHMuZXJyb3IgPT09IHZvaWQgMDsKICAgICAgICBlbHNlIGlmICghZG9FcnJvcikKICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICBpZiAoZG9FcnJvcikgewogICAgICAgICAgdmFyIGVyOwogICAgICAgICAgaWYgKGFyZ3MubGVuZ3RoID4gMCkKICAgICAgICAgICAgZXIgPSBhcmdzWzBdOwogICAgICAgICAgaWYgKGVyIGluc3RhbmNlb2YgRXJyb3IpIHsKICAgICAgICAgICAg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9iamVjdC5jcmVhdGUobnVsbCk7CiAgICAgICAgICB0YXJnZXQuX2V2ZW50c0NvdW50ID0gMDsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKGV2ZW50cy5uZXdMaXN0ZW5lciAhPT0gdm9pZCAwKSB7CiAgICAgICAgICAgIHRhcmdldC5lbWl0KCJuZXdMaXN0ZW5lciIsIHR5cGUsIGxpc3RlbmVyLmxpc3RlbmVyID8gbGlzdGVuZXIubGlzdGVuZXIgOiBsaXN0ZW5lcik7CiAgICAgICAgICAgIGV2ZW50cyA9IHRhcmdldC5fZXZlbnRzOwogICAgICAgICAgfQogICAgICAgICAgZXhpc3RpbmcgPSBldmVudHNbdHlwZV07CiAgICAgICAgfQogICAgICAgIGlmIChleGlzdGluZyA9PT0gdm9pZCAwKSB7CiAgICAgICAgICBleGlzdGluZyA9IGV2ZW50c1t0eXBlXSA9IGxpc3RlbmVyOwogICAgICAgICAgKyt0YXJnZXQuX2V2ZW50c0NvdW50OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAodHlwZW9mIGV4aXN0aW5nID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIGV4aXN0aW5nID0gZXZlbnRzW3R5cGVdID0gcHJlcGVuZCA/IFtsaXN0ZW5lciwgZXhpc3RpbmddIDogW2V4aXN0aW5nLCBsaXN0ZW5lcl07CiAgICAgICAgICB9IGVsc2UgaWYgKHByZXBlbmQpIHsKICAgICAgICAgICAgZXhpc3RpbmcudW5zaGlmdChsaXN0ZW5lcik7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBleGlzdGluZy5wdXNoKGxpc3RlbmVyKTsKICAgICAgICAgIH0KICAgICAgICAgIG0gPSBfZ2V0TWF4TGlzdGVuZXJzKHRhcmdldCk7CiAgICAgICAgICBpZiAobSA+IDAgJiYgZXhpc3RpbmcubGVuZ3RoID4gbSAmJiAhZXhpc3Rpbmcud2FybmVkKSB7CiAgICAgICAgICAgIGV4aXN0aW5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ICAgIH0gZWxzZSBpZiAodHlwZW9mIGxpc3QgIT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgIHBvc2l0aW9uID0gLTE7CiAgICAgICAgICBmb3IgKGkgPSBsaXN0Lmxlbmd0aCAtIDE7IGkgPj0gMDsgaS0tKSB7CiAgICAgICAgICAgIGlmIChsaXN0W2ldID09PSBsaXN0ZW5lciB8fCBsaXN0W2ldLmxpc3RlbmVyID09PSBsaXN0ZW5lcikgewogICAgICAgICAgICAgIG9yaWdpbmFsTGlzdGVuZXIgPSBsaXN0W2ldLmxpc3RlbmVyOwogICAgICAgICAgICAgIHBvc2l0aW9uID0gaTsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHBvc2l0aW9uIDwgMCkKICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICBpZiAocG9zaXRpb24gPT09IDApCiAgICAgICAgICAgIGxpc3Quc2hpZnQoKTsKICAgICAgICAgIGVsc2UgewogICAgICAgICAgICBzcGxpY2VPbmUobGlzdCwgcG9zaXRpb24pOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGxpc3QubGVuZ3RoID09PSAxKQogICAgICAgICAgICBldmVudHNbdHlwZV0gPSBsaXN0WzBdOwogICAgICAgICAgaWYgKGV2ZW50cy5yZW1vdmVMaXN0ZW5lciAhPT0gdm9pZCAwKQogICAgICAgICAgICB0aGlzLmVtaXQoInJlbW92ZUxpc3RlbmVyIiwgdHlwZSwgb3JpZ2luYWxMaXN0ZW5lciB8fCBsaXN0ZW5lcik7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9OwogICAgICBFdmVudEVtaXR0ZXIucHJvdG90eXBlLm9mZiA9IEV2ZW50RW1pdHRlci5wcm90b3R5cGUucmVtb3ZlTGlzdGVuZXI7CiAgICAgIEV2ZW50RW1pdHRlci5wcm90b3R5cGUucmVtb3ZlQWxsTGlzdGVuZXJzID0gZnVuY3Rpb24gcmVtb3ZlQWxsTGlzdGVuZXJzKHR5cGUpIHsKICAgICAgICB2YXIgbGlzdGVuZXJzLCBldmVudHMsIGk7CiAgICAgICAgZXZlbnRzID0gdGhpcy5fZXZlbnRzOwogICAgICAgIGlmIChldmVudHMgPT09IHZvaWQgMCkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGlmIChldmVudHMucmVtb3ZlTGlzdGVuZXIgPT09IHZvaWQgMCkgewogICAgICAgICAgaWYgKGFyZ3VtZW50cy5sZW5ndGggPT09IDApIHsKICAgICAgICAgICAgdGhpcy5fZXZlbnRzID0gT2JqZWN0LmNyZWF0ZShudWxsKTsKICAgICAgICAgICAgdGhpcy5fZXZlbnRzQ291bnQgPSAwOwogICAgICAgICAgfSBlbHNlIGlmIChldmVudHNbdHlwZV0gIT09IHZvaWQgMCkgewogICAgICAgICAgICBpZiAoLS10aGlzLl9ldmVudHNDb3VudCA9PT0gMCkKICAgICAgICAgICAgICB0aGlzLl9ldmVudHMgPSBPYmplY3QuY3JlYXRlKG51bGwpOwogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgZGVsZXRlIGV2ZW50c1t0eXBlXTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIH0KICAgICAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgdmFyIGtleXMyID0gT2JqZWN0LmtleXMoZXZlbnRzKTsKICAgICAgICAgIHZhciBrZXk7CiAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwga2V5czIubGVuZ3RoOyArK2kpIHsKICAgICAgICAgICAga2V5ID0ga2V5czJbaV07CiAgICAgICAgICAgIGlmIChrZXkgPT09ICJyZW1vdmVMaXN0ZW5lciIpCiAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIHRoaXMucmVtb3ZlQWxsTGlzdGVuZXJzKGtleSk7CiAgICAgICAgICB9CiAgICAgICAgICB0aGlzLnJlbW92ZUFsbExpc3RlbmVycygicmVtb3ZlTGlzdGVuZXIiKTsKICAgICAgICAgIHRoaXMuX2V2ZW50cyA9IE9iamVjdC5jcmVhdGUobnVsbCk7CiAgICAgICAgICB0aGlzLl9ldmVudHNDb3VudCA9IDA7CiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICB9CiAgICAgICAgbGlzdGVuZXJzID0gZXZlbnRzW3R5cGVdOwogICAgICAgIGlmICh0eXBlb2YgbGlzdGVuZXJzID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICB0aGlzLnJlbW92ZUxpc3RlbmVyKHR5cGUsIGxpc3RlbmVycyk7CiAgICAgICAgfSBlbHNlIGlmIChsaXN0ZW5lcnMgIT09IHZvaWQgMCkgewogICAgICAgICAgZm9yIChpID0gbGlzdGVuZXJzLmxlbmd0aCAtIDE7IGkgPj0gMDsgaS0tKSB7CiAgICAgICAgICAgIHRoaXMucmVtb3ZlTGlzdGVuZXIodHlwZSwgbGlzdGVuZXJzW2ldKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIF9saXN0ZW5lcnModGFyZ2V0LCB0eXBlLCB1bndyYXApIHsKICAgICAgICB2YXIgZXZlbnRzID0gdGFyZ2V0Ll9ldmVudHM7CiAgICAgICAgaWYgKGV2ZW50cyA9PT0gdm9pZCAwKQogICAgICAgICAgcmV0dXJuIFtdOwogICAgICAgIHZhciBldmxpc3RlbmVyID0gZXZlbnRzW3R5cGVdOwogICAgICAgIGlmIChldmxpc3RlbmVyID09PSB2b2lkIDApCiAgICAgICAgICByZXR1cm4gW107CiAgICAgICAgaWYgKHR5cGVvZiBldmxpc3RlbmVyID09PSAiZnVuY3Rpb24iKQogICAgICAgICAgcmV0dXJuIHVud3JhcCA/IFtldmxpc3RlbmVyLmxpc3RlbmVyIHx8IGV2bGlzdGVuZXJdIDogW2V2bGlzdGVuZXJdOwogICAgICAgIHJld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yID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgfSBlbHNlIGlmIChldmxpc3RlbmVyICE9PSB2b2lkIDApIHsKICAgICAgICAgICAgcmV0dXJuIGV2bGlzdGVuZXIubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gMDsKICAgICAgfQogICAgICBFdmVudEVtaXR0ZXIucHJvdG90eXBlLmV2ZW50TmFtZXMgPSBmdW5jdGlvbiBldmVudE5hbWVzKCkgewogICAgICAgIHJldHVybiB0aGlzLl9ldmVudHNDb3VudCA+IDAgPyBSZWZsZWN0T3duS2V5cyh0aGlzLl9ldmVudHMpIDogW107CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGFycmF5Q2xvbmUoYXJyLCBuKSB7CiAgICAgICAgdmFyIGNvcHkgPSBuZXcgQXJyYXkobik7CiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBuOyArK2kpCiAgICAgICAgICBjb3B5W2ldID0gYXJyW2ldOwogICAgICAgIHJldHVybiBjb3B5OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNwbGljZU9uZShsaXN0LCBpbmRleCkgewogICAgICAgIGZvciAoOyBpbmRleCArIDEgPCBsaXN0Lmxlbmd0aDsgaW5kZXgrKykKICAgICAgICAgIGxpc3RbaW5kZXhdID0gbGlzdFtpbmRleCArIDFdOwogICAgICAgIGxpc3QucG9wKCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdW53cmFwTGlzdGVuZXJzKGFycikgewogICAgICAgIHZhciByZXQgPSBuZXcgQXJyYXkoYXJyLmxlbmd0aCk7CiAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCByZXQubGVuZ3RoOyArK2kpIHsKICAgICAgICAgIHJldFtpXSA9IGFycltpXS5saXN0ZW5lciB8fCBhcnJbaV07CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3R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y9pbmhlcml0cy9pbmhlcml0c19icm93c2VyLmpzCiAgdmFyIHJlcXVpcmVfaW5oZXJpdHNfYnJvd3NlciA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9pbmhlcml0c0AyLjAuNC9ub2RlX21vZHVsZXMvaW5oZXJpdHMvaW5oZXJpdHNfYnJvd3Nlci5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICBpZiAodHlwZW9mIE9iamVjdC5jcmVhdGUgPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICBtb2R1bGUyLmV4cG9ydHMgPSBmdW5jdGlvbiBpbmhlcml0cyhjdG9yLCBzdXBlckN0b3IpIHsKICAgICAgICAgIGlmIChzdXBlckN0b3IpIHsKICAgICAgICAgICAgY3Rvci5zdXBlcl8gPSBzdXBlckN0b3I7CiAgICAgICAgICAgIGN0b3IucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShzdXBlckN0b3IucHJvdG90eXBlLCB7CiAgICAgICAgICAgICAgY29uc3RydWN0b3I6IHsKICAgICAgICAgICAgICAgIHZhbHVlOiBjdG9yLAogICAgICAgICAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgfSBlbHNlIHsKICAgICAgICBtb2R1bGUyLmV4cG9ydHMgPSBmdW5jdGlvbiBpbmhlcml0cyhjdG9yLCBzdXBlckN0b3IpIHsKICAgICAgICAgIGlmIChzdXBlckN0b3IpIHsKICAgICAgICAgICAgY3Rvci5zdXBlcl8gPSBzdXBlckN0b3I7CiAgICAgICAgICAgIHZhciBUZW1wQ3RvciA9IGZ1bmN0aW9uKCkgewogICAgICAg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dChzb3VyY2UpLCB0cnVlKS5mb3JFYWNoKGZ1bmN0aW9uKGtleSkgewogICAgICAgICAgICBfZGVmaW5lUHJvcGVydHkodGFyZ2V0LCBrZXksIHNvdXJjZVtrZXldKTsKICAgICAgICAgIH0pIDogT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyh0YXJnZXQsIE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKHNvdXJjZSkpIDogb3duS2V5cyhPYmplY3Qoc291cmNlKSkuZm9yRWFjaChmdW5jdGlvbihrZXkpIHsKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRhcmdldCwga2V5LCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKHNvdXJjZSwga2V5KSk7CiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRhcmdldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBfZGVmaW5lUHJvcGVydHkob2JqLCBrZXksIHZhbHVlKSB7CiAgICAgICAga2V5ID0gX3RvUHJvcGVydHlLZXkoa2V5KTsKICAgICAgICBpZiAoa2V5IGluIG9iaikgewogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KG9iaiwga2V5LCB7IHZhbHVlLCBlbnVtZXJhYmxlOiB0cnVlLCBjb25maWd1cmFibGU6IHRydWUsIHdyaXRhYmxlOiB0cnVlIH0pOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBvYmpba2V5XSA9IHZhbHVlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gb2JqOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9jbGFzc0NhbGxDaGVjayhpbnN0YW5jZSwgQ29uc3RydWN0b3IpIHsKICAgICAgICBpZiAoIShpbnN0YW5jZSBpbnN0YW5jZW9mIENvbnN0cnVjdG9yKSkgewogICAgICAgICAgdGhyb3cgbmV3IF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ICB9CiAgICAgIGZ1bmN0aW9uIF90b1Byb3BlcnR5S2V5KGFyZykgewogICAgICAgIHZhciBrZXkgPSBfdG9QcmltaXRpdmUoYXJnLCAic3RyaW5nIik7CiAgICAgICAgcmV0dXJuIHR5cGVvZiBrZXkgPT09ICJzeW1ib2wiID8ga2V5IDogU3RyaW5nKGtleSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX3RvUHJpbWl0aXZlKGlucHV0LCBoaW50KSB7CiAgICAgICAgaWYgKHR5cGVvZiBpbnB1dCAhPT0gIm9iamVjdCIgfHwgaW5wdXQgPT09IG51bGwpCiAgICAgICAgICByZXR1cm4gaW5wdXQ7CiAgICAgICAgdmFyIHByaW0gPSBpbnB1dFtTeW1ib2wudG9QcmltaXRpdmVdOwogICAgICAgIGlmIChwcmltICE9PSB2b2lkIDApIHsKICAgICAgICAgIHZhciByZXMgPSBwcmltLmNhbGwoaW5wdXQsIGhpbnQgfHwgImRlZmF1bHQiKTsKICAgICAgICAgIGlmICh0eXBlb2YgcmVzICE9PSAib2JqZWN0IikKICAgICAgICAgICAgcmV0dXJuIHJlczsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoIkBAdG9QcmltaXRpdmUgbXVzdCByZXR1cm4gYSBwcmltaXRpdmUgdmFsdWUuIik7CiAgICAgICAgfQogICAgICAgIHJldHVybiAoaGludCA9PT0gInN0cmluZyIgPyBTdHJpbmcgOiBOdW1iZXIpKGlucHV0KTsKICAgICAgfQogICAgICB2YXIgX3JlcXVpcmUgPSByZXF1aXJlX2J1ZmZlcigpOwogICAgICB2YXIgQnVmZmVyMTAgPSBfcmVxdWlyZS5CdWZmZXI7CiAgICAgIHZhciBfcmVxdWlyZTIgPSByZXF1aXJlX3V0aWwoKTsKICAgICAgdmFyIGluc3BlY3QgPSBfcmVxdWlyZTIuaW5zcGVjdDsKICAgICAgdmFyIGN1c3RvbSA9IGluc3BlY3QgJiYgaW5zcGVjdC5jdXN0b20gfHwgImluc3BlY3QiOwogICAgICBmdW5jdGlvbiBjb3B5QnVmZmVyKHNyYywgdGFyZ2V0LCBvZmZzZXQpIHsKICAgICAgICBCdWZmZXIxMC5wcm90b3R5cGUuY29weS5jYWxsKHNyYywgdGFyZ2V0LCBvZmZzZXQpOwogICAgICB9CiAgICAgIG1vZHVsZTIuZXhwb3J0cyA9IC8qIEBfX1BVUkVfXyAqLyBmdW5jdGlvbigpIHsKICAgICAgICBmdW5jdGlvbiBCdWZmZXJMaXN0KCkgewogICAgICAgICAgX2NsYXNzQ2FsbENoZWNrKHRoaXMsIEJ1ZmZlckxpc3QpOwogICAgICAgICAgdGhpcy5oZWFkID0gbnVsbDsKICAgICAgICAgIHRoaXMudGFpbCA9IG51bGw7CiAgICAgICAgICB0aGlzLmxlbmd0aCA9IDA7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhCdWZmZXJMaXN0LCBbewogICAgICAgICAga2V5OiAicHVzaCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gcHVzaCh2KSB7CiAgICAgICAgICAgIHZhciBlbnRyeSA9IHsKICAgICAgICAgICAgICBkYXRhOiB2LAogICAgICAgICAgICAgIG5leHQ6IG51bGwKICAgICAgICAgICAgfTsKICAgICAgICAgICAgaWYgKHRoaXMubGVuZ3RoID4gMCkKICAgICAgICAgICAgICB0aGlzLnRhaWwubmV4dCA9IGVudHJ5OwogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgdGhpcy5oZWFkID0gZW50cnk7CiAgICAgICAgICAgIHRoaXMudGFpbCA9IGVudHJ5OwogICAgICAgICAgICArK3RoaXMubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgIH0sIHsKICAgICAgICAgIGtleTogInVuc2hpZnQiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIHVuc2hpZnQodikgewogICAgICAgICAgICB2YXIgZW50cnkgPSB7CiAgICAgICAgICAgICAgZGF0YTogdiwKICAgICAgICAgICAgICBuZXh0OiB0aGlzLmhlYWQKICAgICAgICAgICAgfTsKICAgICAgICAgICAgaWYgKHRoaXMubGVuZ3RoID09PSAwKQogICAgICAgICAgICAgIHRoaXMudGFpbCA9IGVudHJ5OwogICAgICAgICAgICB0aGlzLmhlYWQgPSBlbnRyeTsKICAgICAgICAgICAgKyt0aGlzLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJzaGlmdCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gc2hpZnQoKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmxlbmd0aCA9PT0gMCkKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIHZhciByZXQgPSB0aGlzLmhlYWQuZGF0YTsKICAgICAgICAgICAgaWYgKHRoaXMubGVuZ3RoID09PSAxKQogICAgICAgICAgICAgIHRoaXMuaGVhZCA9IHRoaXMudGFpbCA9IG51bGw7CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICB0aGlzLmhlYWQgPSB0aGlzLmhlYWQubmV4dDsKICAgICAgICAgICAgLS10aGlzLmxlbmd0aDsKICAgICAgICAgICAgcmV0dXJuIHJldDsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJjbGVhciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gY2xlYXIoKSB7CiAgICAgICAgICAgIHRoaXMuaGVhZCA9IHRoaXMudGFpbCA9IG51bGw7CiAgICAgICAgICAgIHRoaXMubGVuZ3RoID0gMDsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJqb2luIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBqb2luKHMpIHsKICAgICAgICAgICAgaWYgKHRoaXMubGVuZ3RoID09PSAwKQogICAgICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICAgICAgdmFyIHAgPSB0aGlzLmhlYWQ7CiAgICAgICAgICAgIHZhciByZXQgPSAiIiArIHAuZGF0YTsKICAgICAgICAgICAgd2hpbGUgKHAgPSBwLm5leHQpCiAgICAgICAgICAgICAgcmV0ICs9IHMgKyBwLmRhdGE7CiAgICAgICAgICAgIHJldHVybiByZXQ7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAiY29uY2F0IiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBjb25jYXQobikgewogICAgICAgICAgICBpZiAodGhpcy5sZW5ndGggPT09IDApCiAgICAgICAgICAgICAgcmV0dXJuIEJ1ZmZlcjEwLmFsbG9jKDApOwogICAgICAgICAgICB2YXIgcmV0ID0gQnVmZmVyMTAuYWxsb2NVbnNhZmUobiA+Pj4gMCk7CiAgICAgICAgICAgIHZhciBwID0gdGhpcy5oZWFkOwogICAgICAgICAgICB2YXIgaSA9IDA7CiAgICAgICAgICAgIHdoaWxlIChwKSB7CiAgICAgICAgICAgICAgY29weUJ1ZmZlcihwLmRhdGEsIHJldCwgaSk7CiAgICAgICAgICAgICAgaSArPSBwLmRhdGEubGVuZ3RoOwogICAgICAgICAgICAgIHAgPSBwLm5leHQ7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJldDsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJjb25zdW1lIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBjb25zdW1lKG4sIGhhc1N0cmluZ3MpIHsKICAgICAgICAgICAgdmFyIHJldDsKICAgICAgICAgICAgaWYgKG4gPCB0aGlzLmhlYWQuZGF0YS5sZW5ndGgpIHsKICAgICAgICAgICAgICByZXQgPSB0aGlzLmhlYWQuZGF0YS5zbGljZSgwLCBuKTsKICAgICAgICAgICAgICB0aGlzLmhlYWQuZGF0YSA9IHRoaXMuaGVhZC5kYXRhLnNsaWNlKG4pOwogICAgICAgICAgICB9IGVsc2UgaWYgKG4gPT09IHRoaXMuaGVhZC5kYXRhLmxlbmd0aCkgewogICAgICAgICAgICAgIHJldCA9IHRoaXMuc2hpZnQoKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICByZXQgPSBoYXNTdHJpbmdzID8gdGhpcy5fZ2V0U3RyaW5nKG4pIDogdGhpcy5fZ2V0QnVmZmVyKG4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiByZXQ7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAiZmlyc3QiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGZpcnN0KCkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5oZWFkLmRhdGE7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAiX2dldFN0cmluZyIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gX2dldFN0cmluZyhuKSB7CiAgICAgICAgICAgIHZhciBwID0gdGhpcy5oZWFkOwogICAgICAgICAgICB2YXIgYyA9IDE7CiAgICAgICAgICAgIHZhciByZXQgPSBwLmRhdGE7CiAgICAgICAgICAgIG4gLT0gcmV0Lmxlbmd0aDsKICAgICAgICAgICAgd2hpbGUgKHAgPSBwLm5leHQpIHsKICAgICAgICAgICAgICB2YXIgc3RyID0gcC5kYXRhOwogICAgICAgICAgICAgIHZhciBuYiA9IG4gPiBzdHIubGVuZ3RoID8gc3RyLmxlbmd0aCA6IG47CiAgICAgICAgICAgICAgaWYgKG5iID09PSBzdHIubGVuZ3RoKQogICAgICAgICAgICAgICAgcmV0ICs9IHN0cjsKICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICByZXQgKz0gc3RyLnNsaWNlKDAsIG4pOwogICAgICAgICAgICAgIG4gLT0gbmI7CiAgICAgICAgICAgICAgaWYgKG4gPT09IDApIHsKICAgICAgICAgICAgICAgIGlmIChuYiA9PT0gc3RyLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICArK2M7CiAgICAgICAgICAgICAgICAgIGlmIChwLm5leHQpCiAgICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkID0gcC5uZXh0OwogICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkID0gdGhpcy50YWlsID0gbnVsbDsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHRoaXMuaGVhZCA9IHA7CiAgICAgICAgICAgICAgICAgIHAuZGF0YSA9IHN0ci5zbGljZShuYik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgKytjOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMubGVuZ3RoIC09IGM7CiAgICAgICAgICAgIHJldHVybiByZXQ7CiAgICAgICAgICB9CiAgICAgICAgfSwgewogICAgICAgICAga2V5OiAiX2dldEJ1ZmZlciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gX2dldEJ1ZmZlcihuKSB7CiAgICAgICAgICAgIHZhciByZXQgPSBCdWZmZXIxMC5hbGxvY1Vuc2FmZShuKTsKICAgICAgICAgICAgdmFyIHAgPSB0aGlzLmhlYWQ7CiAgICAgICAgICAgIHZhciBjID0gMTsKICAgICAgICAgICAgcC5kYXRhLmNvcHkocmV0KTsKICAgICAgICAgICAgbiAtPSBwLmRhdGEubGVuZ3RoOwogICAgICAgICAgICB3aGlsZSAocCA9IHAubmV4dCkgewogICAgICAgICAgICAgIHZhciBidWYgPSBwLmRhdGE7CiAgICAgICAgICAgICAgdmFyIG5iID0gbiA+IGJ1Zi5sZW5ndGggPyBidWYubGVuZ3RoIDogbjsKICAgICAgICAgICAgICBidWYuY29weShyZXQsIHJldC5sZW5ndGggLSBuLCAwLCBuYik7CiAgICAgICAgICAgICAgbiAtPSBuYjsKICAgICAgICAgICAgICBpZiAobiA9PT0gMCkgewogICAgICAgICAgICAgICAgaWYgKG5iID09PSBidWYubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICsrYzsKICAgICAgICAgICAgICAgICAgaWYgKHAubmV4dCkKICAgICAgICAgICAgICAgICAgICB0aGlzLmhlYWQgPSBwLm5leHQ7CiAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICB0aGlzLmhlYWQgPSB0aGlzLnRhaWwgPSBudWxsOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgdGhpcy5oZWFkID0gcDsKICAgICAgICAgICAgICAgICAgcC5kYXRhID0gYnVmLnNsaWNlKG5iKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICArK2M7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5sZW5ndGggLT0gYzsKICAgICAgICAgICAgcmV0dXJuIHJldDsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6IGN1c3RvbSwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiB2YWx1ZShfLCBvcHRpb25zKSB7CiAgICAgICAgICAgIHJldHVybiBpbnNwZWN0KHRoaXMsIF9vYmplY3RTcHJlYWQoX29iamVjdFNwcmVhZCh7fSwgb3B0aW9ucyksIHt9LCB7CiAgICAgICAgICAgICAgZGVwdGg6IDAsCiAgICAgICAgICAgICAgY3VzdG9tSW5zcGVjdDogZmFsc2UKICAgICAgICAgICAgfSkpOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gQnVmZmVyTGlzdDsKICAgICAgfSgpOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcmVhZGFibGUtc3RyZWFtQDMuNi4yL25vZGVfbW9kdWxlcy9yZWFkYWJsZS1zdHJlYW0vbGliL2ludGVybmFsL3N0cmVhbXMvZGVzdHJveS5qcwogIHZhciByZXF1aXJlX2Rlc3Ryb3kgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcmVhZGFibGUtc3RyZWFtQDMuNi4yL25vZGVfbW9kdWxlcy9yZWFkYWJsZS1zdHJlYW0vbGliL2ludGVybmFsL3N0cmVhbXMvZGVzdHJveS5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIGZ1bmN0aW9uIGRlc3Ryb3koZXJyLCBjYikgewogICAgICAgIHZhciBfdGhpcyA9IHRoaXM7CiAgICAgICAgdmFyIHJlYWRhYmxlRGVzdHJveWVkID0gdGhpcy5fcmVhZGFibGVTdGF0ZSAmJiB0aGlzLl9yZWFkYWJsZVN0YXRlLmRlc3Ryb3llZDsKICAgICAgICB2YXIgd3JpdGFibGVEZXN0cm95ZWQgPSB0aGlzLl93cml0YWJsZVN0YXRlICYmIHRoaXMuX3dyaXRhYmxlU3RhdGUuZGVzdHJveWVkOwogICAgICAgIGlmIChyZWFkYWJsZURlc3Ryb3llZCB8fCB3cml0YWJsZURlc3Ryb3llZCkgewogICAgICAgICAgaWYgKGNiKSB7CiAgICAgICAgICAgIGNiKGVycik7CiAgICAgICAgICB9IGVsc2UgaWYgKGVycikgewogICAgICAgICAgICBpZiAoIXRoaXMuX3dyaXRhYmxlU3RhdGUpIHsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVtaXRFcnJvck5ULCB0aGlzLCBlcnIpOwogICAgICAgICAgICB9IGVsc2UgaWYgKCF0aGlzLl93cml0YWJsZVN0YXRlLmVycm9yRW1pdHRlZCkgewogICAgICAgICAgICAgIHRoaXMuX3dyaXRhYmxlU3RhdGUuZXJyb3JFbWl0dGVkID0gdHJ1ZTsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVtaXRFcnJvck5ULCB0aGlzLCBlcnIpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICB9CiAgICAgICAgaWYgKHRoaXMuX3JlYWRhYmxlU3RhdGUpIHsKICAgICAgICAgIHRoaXMuX3JlYWRhYmxlU3RhdGUuZGVzdHJveWVkID0gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgaWYgKHRoaXMuX3dyaXRhYmxlU3RhdGUpIHsKICAgICAgICAgIHRoaXMuX3dyaXRhYmxlU3RhdGUuZGVzdHJveWVkID0gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgdGhpcy5fZGVzdHJveShlcnIgfHwgbnVsbCwgZnVuY3Rpb24oZXJyMikgewogICAgICAgICAgaWYgKCFjYiAmJiBlcnIyKSB7CiAgICAgICAgICAgIGlmICghX3RoaXMuX3dyaXRhYmxlU3RhdGUpIHsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVtaXRFcnJvckFuZENsb3NlTlQsIF90aGlzLCBlcnIyKTsKICAgICAgICAgICAgfSBlbHNlIGlmICghX3RoaXMuX3dyaXRhYmxlU3RhdGUuZXJyb3JFbWl0dGVkKSB7CiAgICAgICAgICAgICAgX3RoaXMuX3dyaXRhYmxlU3RhdGUuZXJyb3JFbWl0dGVkID0gdHJ1ZTsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVtaXRFcnJvckFuZENsb3NlTlQsIF90aGlzLCBlcnIyKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVtaXRDbG9zZU5ULCBfdGhpcyk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoY2IpIHsKICAgICAgICAgICAgcHJvY2Vzcy5uZXh0VGljayhlbWl0Q2xvc2VOVCwgX3RoaXMpOwogICAgICAgICAgICBjYihlcnIyKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHByb2Nlc3MubmV4dFRpY2soZW1pdENsb3NlTlQsIF90aGlzKTsKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICByZXR1cm4gdGhpczsKICAgICA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RXJyb3IyKGFyZzEsIGFyZzIsIGFyZzMpIHsKICAgICAgICAgICAgcmV0dXJuIF9CYXNlLmNhbGwodGhpcywgZ2V0TWVzc2FnZShhcmcxLCBhcmcyLCBhcmczKSkgfHwgdGhpczsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBOb2RlRXJyb3IyOwogICAgICAgIH0oQmFzZSk7CiAgICAgICAgTm9kZUVycm9yLnByb3RvdHlwZS5uYW1lID0gQmFzZS5uYW1lOwogICAgICAgIE5vZGVFcnJvci5wcm90b3R5cGUuY29kZSA9IGNvZGU7CiAgICAgICAgY29kZXNbY29kZV0gPSBOb2RlRXJyb3I7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gb25lT2YoZXhwZWN0ZWQsIHRoaW5nKSB7CiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZXhwZWN0ZWQpKSB7CiAgICAgICAgICB2YXIgbGVuID0gZXhwZWN0ZWQubGVuZ3RoOwogICAgICAgICAgZXhwZWN0ZWQgPSBleHBlY3RlZC5tYXAoZnVuY3Rpb24oaSkgewogICAgICAgICAgICByZXR1cm4gU3RyaW5nKGkpOwogICAgICAgICAgfSk7CiAgICAgICAgICBpZiAobGVuID4gMikgewogICAgICAgICAgICByZXR1cm4gIm9uZSBvZiAiLmNvbmNhdCh0aGluZywgIiAiKS5jb25jYXQoZXhwZWN0ZWQuc2xpY2UoMCwgbGVuIC0gMSkuam9pbigiLCAiKSwgIiwgb3IgIikgKyBleHBlY3RlZFtsZW4gLSAxXTsKICAgICAgICAgIH0gZWxzZSBpZiAobGVuID09PSAyKSB7CiAgICAgICAgICAgIHJldHVybiAib25lIG9mICIuY29uY2F0KHRoaW5nLCAiICIpLmNvbmNhdChleHBlY3RlZFswXSwgIiBvciAiKS5jb25jYXQoZXhwZWN0ZWRbMV0pOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuICJvZiAiLmNvbmNhdCh0aGluZywgIiAiKS5jb25jYXQoZXhw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dGlvbihuYW1lLCB2YWx1ZSkgewogICAgICAgIHJldHVybiAnVGhlIHZhbHVlICInICsgdmFsdWUgKyAnIiBpcyBpbnZhbGlkIGZvciBvcHRpb24gIicgKyBuYW1lICsgJyInOwogICAgICB9LCBUeXBlRXJyb3IpOwogICAgICBjcmVhdGVFcnJvclR5cGUoIkVSUl9JTlZBTElEX0FSR19UWVBFIiwgZnVuY3Rpb24obmFtZSwgZXhwZWN0ZWQsIGFjdHVhbCkgewogICAgICAgIHZhciBkZXRlcm1pbmVyOwogICAgICAgIGlmICh0eXBlb2YgZXhwZWN0ZWQgPT09ICJzdHJpbmciICYmIHN0YXJ0c1dpdGgoZXhwZWN0ZWQsICJub3QgIikpIHsKICAgICAgICAgIGRldGVybWluZXIgPSAibXVzdCBub3QgYmUiOwogICAgICAgICAgZXhwZWN0ZWQgPSBleHBlY3RlZC5yZXBsYWNlKC9ebm90IC8sICIiKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgZGV0ZXJtaW5lciA9ICJtdXN0IGJlIjsKICAgICAgICB9CiAgICAgICAgdmFyIG1zZzsKICAgICAgICBpZiAoZW5kc1dpdGgobmFtZSwgIiBhcmd1bWVudCIpKSB7CiAgICAgICAgICBtc2cgPSAiVGhlICIuY29uY2F0KG5hbWUsICIgIikuY29uY2F0KGRldGVybWluZXIsICIgIikuY29uY2F0KG9uZU9mKGV4cGVjdGVkLCAidHlwZSIpKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdmFyIHR5cGUgPSBpbmNsdWRlcyhuYW1lLCAiLiIpID8gInByb3BlcnR5IiA6ICJhcmd1bWVudCI7CiAgICAgICAgICBtc2cgPSAnVGhlICInLmNvbmNhdChuYW1lLCAnIiAnKS5jb25jYXQodHlwZSwgIiAiKS5jb25jYXQoZGV0ZXJtaW5lciwgIiAiKS5jb25jYXQob25lT2YoZXhwZWN0ZWQsICJ0eXBlIikpOwogICAgICAgIH0KICAgICAgICBtc2cgKz0gIi4gUmVjZWl2ZWQ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b2R1bGUyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgbW9kdWxlMi5leHBvcnRzID0gZGVwcmVjYXRlOwogICAgICBmdW5jdGlvbiBkZXByZWNhdGUoZm4sIG1zZykgewogICAgICAgIGlmIChjb25maWcoIm5vRGVwcmVjYXRpb24iKSkgewogICAgICAgICAgcmV0dXJuIGZuOwogICAgICAgIH0KICAgICAgICB2YXIgd2FybmVkID0gZmFsc2U7CiAgICAgICAgZnVuY3Rpb24gZGVwcmVjYXRlZCgpIHsKICAgICAgICAgIGlmICghd2FybmVkKSB7CiAgICAgICAgICAgIGlmIChjb25maWcoInRocm93RGVwcmVjYXRpb24iKSkgewogICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihtc2cpOwogICAgICAgICAgICB9IGVsc2UgaWYgKGNvbmZpZygidHJhY2VEZXByZWNhdGlvbiIpKSB7CiAgICAgICAgICAgICAgY29uc29sZS50cmFjZShtc2cpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGNvbnNvbGUud2Fybihtc2cpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHdhcm5lZCA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gZm4uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGRlcHJlY2F0ZWQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gY29uZmlnKG5hbWUpIHsKICAgICAgICB0cnkgewogICAgICAgICAgaWYgKCFnbG9iYWwubG9jYWxTdG9yYWdlKQogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfSBjYXRjaCAoXykgewogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgICB2YXIgdmFsID0gZ2xvYmFsLmxvY2FsU3RvcmFnZVtuYW1lXTsKICAgICAgICBpZiAodmFsID09IG51bGwpCiAgICAgICAgICByZXR1cm4gZmFsc2U7Ci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AgICAgdmFyIHJldCA9IGZhbHNlOwogICAgICAgIHZhciBpc0J1ZiA9ICFzdGF0ZS5vYmplY3RNb2RlICYmIF9pc1VpbnQ4QXJyYXkoY2h1bmspOwogICAgICAgIGlmIChpc0J1ZiAmJiAhQnVmZmVyMTAuaXNCdWZmZXIoY2h1bmspKSB7CiAgICAgICAgICBjaHVuayA9IF91aW50OEFycmF5VG9CdWZmZXIoY2h1bmspOwogICAgICAgIH0KICAgICAgICBpZiAodHlwZW9mIGVuY29kaW5nID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICBjYiA9IGVuY29kaW5nOwogICAgICAgICAgZW5jb2RpbmcgPSBudWxsOwogICAgICAgIH0KICAgICAgICBpZiAoaXNCdWYpCiAgICAgICAgICBlbmNvZGluZyA9ICJidWZmZXIiOwogICAgICAgIGVsc2UgaWYgKCFlbmNvZGluZykKICAgICAgICAgIGVuY29kaW5nID0gc3RhdGUuZGVmYXVsdEVuY29kaW5nOwogICAgICAgIGlmICh0eXBlb2YgY2IgIT09ICJmdW5jdGlvbiIpCiAgICAgICAgICBjYiA9IG5vcDsKICAgICAgICBpZiAoc3RhdGUuZW5kaW5nKQogICAgICAgICAgd3JpdGVBZnRlckVuZCh0aGlzLCBjYik7CiAgICAgICAgZWxzZSBpZiAoaXNCdWYgfHwgdmFsaWRDaHVuayh0aGlzLCBzdGF0ZSwgY2h1bmssIGNiKSkgewogICAgICAgICAgc3RhdGUucGVuZGluZ2NiKys7CiAgICAgICAgICByZXQgPSB3cml0ZU9yQnVmZmVyKHRoaXMsIHN0YXRlLCBpc0J1ZiwgY2h1bmssIGVuY29kaW5nLCBjYik7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH07CiAgICAgIFdyaXRhYmxlLnByb3RvdHlwZS5jb3JrID0gZnVuY3Rpb24oKSB7CiAgICAgICAgdGhpcy5fd3JpdGFibGVTdGF0ZS5jb3JrZWQrKzsKICAgICAgfTsKICAgICAgV3JpdGFibGUucH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tLCBzdGF0ZSwgd3JpdGV2LCBsZW4sIGNodW5rLCBlbmNvZGluZywgY2IpIHsKICAgICAgICBzdGF0ZS53cml0ZWxlbiA9IGxlbjsKICAgICAgICBzdGF0ZS53cml0ZWNiID0gY2I7CiAgICAgICAgc3RhdGUud3JpdGluZyA9IHRydWU7CiAgICAgICAgc3RhdGUuc3luYyA9IHRydWU7CiAgICAgICAgaWYgKHN0YXRlLmRlc3Ryb3llZCkKICAgICAgICAgIHN0YXRlLm9ud3JpdGUobmV3IEVSUl9TVFJFQU1fREVTVFJPWUVEKCJ3cml0ZSIpKTsKICAgICAgICBlbHNlIGlmICh3cml0ZXYpCiAgICAgICAgICBzdHJlYW0uX3dyaXRldihjaHVuaywgc3RhdGUub253cml0ZSk7CiAgICAgICAgZWxzZQogICAgICAgICAgc3RyZWFtLl93cml0ZShjaHVuaywgZW5jb2RpbmcsIHN0YXRlLm9ud3JpdGUpOwogICAgICAgIHN0YXRlLnN5bmMgPSBmYWxzZTsKICAgICAgfQogICAgICBmdW5jdGlvbiBvbndyaXRlRXJyb3Ioc3RyZWFtLCBzdGF0ZSwgc3luYywgZXIsIGNiKSB7CiAgICAgICAgLS1zdGF0ZS5wZW5kaW5nY2I7CiAgICAgICAgaWYgKHN5bmMpIHsKICAgICAgICAgIHByb2Nlc3MubmV4dFRpY2soY2IsIGVyKTsKICAgICAgICAgIHByb2Nlc3MubmV4dFRpY2soZmluaXNoTWF5YmUsIHN0cmVhbSwgc3RhdGUpOwogICAgICAgICAgc3RyZWFtLl93cml0YWJsZVN0YXRlLmVycm9yRW1pdHRlZCA9IHRydWU7CiAgICAgICAgICBlcnJvck9yRGVzdHJveShzdHJlYW0sIGVyKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgY2IoZXIpOwogICAgICAgICAgc3RyZWFtLl93cml0YWJsZVN0YXRlLmVycm9yRW1pdHRlZCA9IHRydWU7CiAgICAgICAgICBlcnJvck9yRGVzdHJveShzdHJlYW0sIGVyKTsKICAgIC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lcXVlc3RzRnJlZTsKICAgICAgICAgIGhvbGRlci5lbnRyeSA9IGVudHJ5OwogICAgICAgICAgdmFyIGNvdW50ID0gMDsKICAgICAgICAgIHZhciBhbGxCdWZmZXJzID0gdHJ1ZTsKICAgICAgICAgIHdoaWxlIChlbnRyeSkgewogICAgICAgICAgICBidWZmZXJbY291bnRdID0gZW50cnk7CiAgICAgICAgICAgIGlmICghZW50cnkuaXNCdWYpCiAgICAgICAgICAgICAgYWxsQnVmZmVycyA9IGZhbHNlOwogICAgICAgICAgICBlbnRyeSA9IGVudHJ5Lm5leHQ7CiAgICAgICAgICAgIGNvdW50ICs9IDE7CiAgICAgICAgICB9CiAgICAgICAgICBidWZmZXIuYWxsQnVmZmVycyA9IGFsbEJ1ZmZlcnM7CiAgICAgICAgICBkb1dyaXRlKHN0cmVhbSwgc3RhdGUsIHRydWUsIHN0YXRlLmxlbmd0aCwgYnVmZmVyLCAiIiwgaG9sZGVyLmZpbmlzaCk7CiAgICAgICAgICBzdGF0ZS5wZW5kaW5nY2IrKzsKICAgICAgICAgIHN0YXRlLmxhc3RCdWZmZXJlZFJlcXVlc3QgPSBudWxsOwogICAgICAgICAgaWYgKGhvbGRlci5uZXh0KSB7CiAgICAgICAgICAgIHN0YXRlLmNvcmtlZFJlcXVlc3RzRnJlZSA9IGhvbGRlci5uZXh0OwogICAgICAgICAgICBob2xkZXIubmV4dCA9IG51bGw7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzdGF0ZS5jb3JrZWRSZXF1ZXN0c0ZyZWUgPSBuZXcgQ29ya2VkUmVxdWVzdChzdGF0ZSk7CiAgICAgICAgICB9CiAgICAgICAgICBzdGF0ZS5idWZmZXJlZFJlcXVlc3RDb3VudCA9IDA7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHdoaWxlIChlbnRyeSkgewogICAgICAgICAgICB2YXIgY2h1bmsgPSBlbnRyeS5jaHVuazsKICAgICAgICAgICAgdmFyIGVuY29kaW5nID0gZW50cnkuZW5jb2Rpbmc7CiAgICAgICAgICAgIHZhciBjYiA9IGVudHJ5LmNhbGxiYWNrOwogICAgICAgICAgICB2YXIgbGVuID0gc3RhdGUub2JqZWN0TW9kZSA/IDEgOiBjaHVuay5sZW5ndGg7CiAgICAgICAgICAgIGRvV3JpdGUoc3RyZWFtLCBzdGF0ZSwgZmFsc2UsIGxlbiwgY2h1bmssIGVuY29kaW5nLCBjYik7CiAgICAgICAgICAgIGVudHJ5ID0gZW50cnkubmV4dDsKICAgICAgICAgICAgc3RhdGUuYnVmZmVyZWRSZXF1ZXN0Q291bnQtLTsKICAgICAgICAgICAgaWYgKHN0YXRlLndyaXRpbmcpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKGVudHJ5ID09PSBudWxsKQogICAgICAgICAgICBzdGF0ZS5sYXN0QnVmZmVyZWRSZXF1ZXN0ID0gbnVsbDsKICAgICAgICB9CiAgICAgICAgc3RhdGUuYnVmZmVyZWRSZXF1ZXN0ID0gZW50cnk7CiAgICAgICAgc3RhdGUuYnVmZmVyUHJvY2Vzc2luZyA9IGZhbHNlOwogICAgICB9CiAgICAgIFdyaXRhYmxlLnByb3RvdHlwZS5fd3JpdGUgPSBmdW5jdGlvbihjaHVuaywgZW5jb2RpbmcsIGNiKSB7CiAgICAgICAgY2IobmV3IEVSUl9NRVRIT0RfTk9UX0lNUExFTUVOVEVEKCJfd3JpdGUoKSIpKTsKICAgICAgfTsKICAgICAgV3JpdGFibGUucHJvdG90eXBlLl93cml0ZXYgPSBudWxsOwogICAgICBXcml0YWJsZS5wcm90b3R5cGUuZW5kID0gZnVuY3Rpb24oY2h1bmssIGVuY29kaW5nLCBjYikgewogICAgICAgIHZhciBzdGF0ZSA9IHRoaXMuX3dyaXRhYmxlU3RhdGU7CiAgICAgICAgaWYgKHR5cGVvZiBjaHVuayA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgY2IgPSBjaHVuazsKICAgICAgICAgIGNodW5rID0gbnVsbDsKICAgICAgICAgIGVuY29kaW5nID0gbnVsbDsKICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBlbmNvZGluZyA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgY2IgPSBlbmNvZGluZzsKICAgICAgICAgIGVuY29kaW5nID0gbnVsbDsKICAgICAgICB9CiAgICAgICAgaWYgKGNodW5rICE9PSBudWxsICYmIGNodW5rICE9PSB2b2lkIDApCiAgICAgICAgICB0aGlzLndyaXRlKGNodW5rLCBlbmNvZGluZyk7CiAgICAgICAgaWYgKHN0YXRlLmNvcmtlZCkgewogICAgICAgICAgc3RhdGUuY29ya2VkID0gMTsKICAgICAgICAgIHRoaXMudW5jb3JrKCk7CiAgICAgICAgfQogICAgICAgIGlmICghc3RhdGUuZW5kaW5nKQogICAgICAgICAgZW5kV3JpdGFibGUodGhpcywgc3RhdGUsIGNiKTsKICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KFdyaXRhYmxlLnByb3RvdHlwZSwgIndyaXRhYmxlTGVuZ3RoIiwgewogICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgIGdldDogZnVuY3Rpb24gZ2V0KCkgewogICAgICAgICAgcmV0dXJuIHRoaXMuX3dyaXRhYmxlU3RhdGUubGVuZ3RoOwogICAgICAgIH0KICAgICAgfSk7CiAgICAgIGZ1bmN0aW9uIG5lZWRGaW5pc2goc3RhdGUpIHsKICAgICAgICByZXR1cm4gc3RhdGUuZW5kaW5nICYmIHN0YXRlLmxlbmd0aCA9PT0gMCAmJiBzdGF0ZS5idWZmZXJlZFJlcXVlc3QgPT09IG51bGwgJiYgIXN0YXRlLmZpbmlzaGVkICYmICFzdGF0ZS53cml0aW5nOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGNhbGxGaW5hbChzdHJlYW0sIHN0YXRlKSB7CiAgICAgICAgc3RyZWFtLl9maW5hbChmdW5jdGlvbihlcnIpIHsKICAgICAgICAgIHN0YXRlLnBlbmRpbmdjYi0tOwogICAgICAgICAgaWYgKGVycikgewogICAgICAgICAgICBlcnJvck9yRGVzdHJveShzdHJlYW0sIGVycik7CiAgICAgICAgICB9CiAgICAgICAgICBzdGF0ZS5wcmVmaW5pc2hlZCA9IHRydWU7CiAgICAgICAgICBzdHJlYW0uZW1pdCgicHJlZmluaXNoIik7CiAgICAgICAgICBmaW5pc2hNYXliZShzdHJlYW0sIHN0YXRlKTsKICAgICAgICB9KTsKICAgICAgfQogICAgICBmdW5jdGlvbiBwcmVmaW5pc2goc3RyZWFtLCBzdGF0ZSkgewogICAgICAgIGlmICghc3RhdGUucHJlZmluaXNoZWQgJiYgIXN0YXRlLmZpbmFsQ2FsbGVkKSB7CiAgICAgICAgICBpZiAodHlwZW9mIHN0cmVhbS5fZmluYWwgPT09ICJmdW5jdGlvbiIgJiYgIXN0YXRlLmRlc3Ryb3llZCkgewogICAgICAgICAgICBzdGF0ZS5wZW5kaW5nY2IrKzsKICAgICAgICAgICAgc3RhdGUuZmluYWxDYWxsZWQgPSB0cnVlOwogICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGNhbGxGaW5hbCwgc3RyZWFtLCBzdGF0ZSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzdGF0ZS5wcmVmaW5pc2hlZCA9IHRydWU7CiAgICAgICAgICAgIHN0cmVhbS5lbWl0KCJwcmVmaW5pc2giKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZmluaXNoTWF5YmUoc3RyZWFtLCBzdGF0ZSkgewogICAgICAgIHZhciBuZWVkID0gbmVlZEZpbmlzaChzdGF0ZSk7CiAgICAgICAgaWYgKG5lZWQpIHsKICAgICAgICAgIHByZWZpbmlzaChzdHJlYW0sIHN0YXRlKTsKICAgICAgICAgIGlmIChzdGF0ZS5wZW5kaW5nY2IgPT09IDApIHsKICAgICAgICAgICAgc3RhdGUuZmluaXNoZWQgPSB0cnVlOwogICAgICAgICAgICBzdHJlYW0uZW1pdCgiZmluaXNoIik7CiAgICAgICAgICAgIGlmIChzdGF0ZS5hdXRvRGVzdHJveSkgewogICAgICAgICAgICAgIHZhciByU3RhdGUgPSBzdHJlYW0uX3JlYWRhYmxlU3RhdGU7CiAgICAgICAgICAgICAgaWYgKCFyU3RhdGUgfHwgclN0YXRlLmF1dG9EZXN0cm95ICYmIHJTdGF0ZS5lbmRFbWl0dGVkKSB7CiAgICAgICAgICAgICAgICBzdHJlYW0uZGVzdHJveSgpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gbmVlZDsKICAgICAgfQogICAgICBmdW5jdGlvbiBlbmRXcml0YWJsZShzdHJlYW0sIHN0YXRlLCBjYikgewogICAgICAgIHN0YXRlLmVuZGluZyA9IHRydWU7CiAgICAgICAgZmluaXNoTWF5YmUoc3RyZWFtLCBzdGF0ZSk7CiAgICAgICAgaWYgKGNiKSB7CiAgICAgICAgICBpZiAoc3RhdGUuZmluaXNoZWQpCiAgICAgICAgICAgIHByb2Nlc3MubmV4dFRpY2soY2IpOwogICAgICAgICAgZWxzZQogICAgICAgICAgICBzdHJlYW0ub25jZSgiZmluaXNoIiwgY2IpOwogICAgICAgIH0KICAgICAgICBzdGF0ZS5lbmRlZCA9IHRydWU7CiAgICAgICAgc3RyZWFtLndyaXRhYmxlID0gZmFsc2U7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gb25Db3JrZWRGaW5pc2goY29ya1JlcSwgc3RhdGUsIGVycikgewogICAgICAgIHZhciBlbnRyeSA9IGNvcmtSZXEuZW50cnk7CiAgICAgICAgY29ya1JlcS5lbnRyeSA9IG51bGw7CiAgICAgICAgd2hpbGUgKGVudHJ5KSB7CiAgICAgICAgICB2YXIgY2IgPSBlbnRyeS5jYWxsYmFjazsKICAgICAgICAgIHN0YXRlLnBlbmRpb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Utc3RyZWFtL2xpYi9fc3RyZWFtX2R1cGxleC5qcwogIHZhciByZXF1aXJlX3N0cmVhbV9kdXBsZXggPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcmVhZGFibGUtc3RyZWFtQDMuNi4yL25vZGVfbW9kdWxlcy9yZWFkYWJsZS1zdHJlYW0vbGliL19zdHJlYW1fZHVwbGV4LmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIG9iamVjdEtleXMgPSBPYmplY3Qua2V5cyB8fCBmdW5jdGlvbihvYmopIHsKICAgICAgICB2YXIga2V5czMgPSBbXTsKICAgICAgICBmb3IgKHZhciBrZXkgaW4gb2JqKQogICAgICAgICAga2V5czMucHVzaChrZXkpOwogICAgICAgIHJldHVybiBrZXlzMzsKICAgICAgfTsKICAgICAgbW9kdWxlMi5leHBvcnRzID0gRHVwbGV4OwogICAgICB2YXIgUmVhZGFibGUgPSByZXF1aXJlX3N0cmVhbV9yZWFkYWJsZSgpOwogICAgICB2YXIgV3JpdGFibGUgPSByZXF1aXJlX3N0cmVhbV93cml0YWJsZSgpOwogICAgICByZXF1aXJlX2luaGVyaXRzX2Jyb3dzZXIoKShEdXBsZXgsIFJlYWRhYmxlKTsKICAgICAgewogICAgICAgIGtleXMyID0gb2JqZWN0S2V5cyhXcml0YWJsZS5wcm90b3R5cGUpOwogICAgICAgIGZvciAodiA9IDA7IHYgPCBrZXlzMi5sZW5ndGg7IHYrKykgewogICAgICAgICAgbWV0aG9kID0ga2V5czJbdl07CiAgICAgICAgICBpZiAoIUR1cGxleC5wcm90b3R5cGVbbWV0aG9kXSkKICAgICAgICAgICAgRHVwbGV4LnByb3RvdHlwZVttZXRob2RdID0gV3JpdGFibGUucHJvdG90eXBlW21ldGhvZF07CiAgICAgICAgfQogICAgICB9CiAgICAgIHZhciBrZXlzMjsKICAgICAgdmFyIG1ldGhvZDsKICAgICAgdmFyIHY7CiAgICAgIGZ1bmN0aW9uIER1cGxleChvcHRpb25zKSB7CiAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIER1cGxleCkpCiAgICAgICAgICByZXR1cm4gbmV3IER1cGxleChvcHRpb25zKTsKICAgICAgICBSZWFkYWJsZS5jYWxsKHRoaXMsIG9wdGlvbnMpOwogICAgICAgIFdyaXRhYmxlLmNhbGwodGhpcywgb3B0aW9ucyk7CiAgICAgICAgdGhpcy5hbGxvd0hhbGZPcGVuID0gdHJ1ZTsKICAgICAgICBpZiAob3B0aW9ucykgewogICAgICAgICAgaWYgKG9wdGlvbnMucmVhZGFibGUgPT09IGZhbHNlKQogICAgICAgICAgICB0aGlzLnJlYWRhYmxlID0gZmFsc2U7CiAgICAgICAgICBpZiAob3B0aW9ucy53cml0YWJsZSA9PT0gZmFsc2UpCiAgICAgICAgICAgIHRoaXMud3JpdGFibGUgPSBmYWxzZTsKICAgICAgICAgIGlmIChvcHRpb25zLmFsbG93SGFsZk9wZW4gPT09IGZhbHNlKSB7CiAgICAgICAgICAgIHRoaXMuYWxsb3dIYWxmT3BlbiA9IGZhbHNlOwogICAgICAgICAgICB0aGlzLm9uY2UoImVuZCIsIG9uZW5kKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KER1cGxleC5wcm90b3R5cGUsICJ3cml0YWJsZUhpZ2hXYXRlck1hcmsiLCB7CiAgICAgICAgZW51bWVyYWJsZTogZmFsc2UsCiAgICAgICAgZ2V0OiBmdW5jdGlvbiBnZXQoKSB7CiAgICAgICAgICByZXR1cm4gdGhpcy5fd3JpdGFibGVTdGF0ZS5oaWdoV2F0ZXJNYXJrOwogICAgICAgIH0KICAgICAgfSk7CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShEdXBsZXgucHJvdG90eXBlLCAid3JpdGFibGVCdWZmZXIiLCB7CiA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3RyaW5nX2RlY29kZXIvbGliL3N0cmluZ19kZWNvZGVyLmpzIihleHBvcnRzMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIEJ1ZmZlcjEwID0gcmVxdWlyZV9zYWZlX2J1ZmZlcigpLkJ1ZmZlcjsKICAgICAgdmFyIGlzRW5jb2RpbmcgPSBCdWZmZXIxMC5pc0VuY29kaW5nIHx8IGZ1bmN0aW9uKGVuY29kaW5nKSB7CiAgICAgICAgZW5jb2RpbmcgPSAiIiArIGVuY29kaW5nOwogICAgICAgIHN3aXRjaCAoZW5jb2RpbmcgJiYgZW5jb2RpbmcudG9Mb3dlckNhc2UoKSkgewogICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgY2FzZSAidXRmLTgiOgogICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgY2FzZSAiYmluYXJ5IjoKICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICBjYXNlICJ1Y3MyIjoKICAgICAgICAgIGNhc2UgInVjcy0yIjoKICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgY2FzZSAidXRmLTE2bGUiOgogICAgICAgICAgY2FzZSAicmF3IjoKICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICB9OwogICAgICBmdW5jdGlvbiBfbm9ybWFsaXplRW5jb2RpbmcoZW5jKSB7CiAgICAgICAgaWYgKCFlbmMpCiAgICAgICAgICByZXR1cm4gInV0ZjgiOwogICAgICAgIHZhciByZXRyaWVkOwogICAgICAgIHdoaWxlICh0cnVlKSB7CiAgICAgICAgICBzd2l0Y2ggKGVuYykgewogICAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgICAgY2FzZSAidXRmLTgiOgogICAgICAgICAgICAgIHJldHVybiAidXRmOCI7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuICJ1dGYxNmxlIjsKICAgICAgICAgICAgY2FzZSAibGF0aW4xIjoKICAgICAgICAgICAgY2FzZSAiYmluYXJ5IjoKICAgICAgICAgICAgICByZXR1cm4gImxhdGluMSI7CiAgICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICAgIGNhc2UgImFzY2lpIjoKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gZW5jOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgIGlmIChyZXRyaWVkKQogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgIGVuYyA9ICgiIiArIGVuYykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICByZXRyaWVkID0gdHJ1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gbm9ybWFsaXplRW5jb2RpbmcoZW5jKSB7CiAgICAgICAgdmFyIG5lbmMgPSBfbm9ybWFsaXplRW5jb2RpbmcoZW5jKTsKICAgICAgICBpZiAodHlwZW9mIG5lbmMgIT09ICJzdHJpbmciICYmIChCdWZmZXIxMC5pc0VuY29kaW5nID09PSBpc0VuY29kaW5nIHx8ICFpc0VuY29kaW5nKGVuYykpKQogICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jKTsKICAgICAgICByZXR1cm4gbmVuYyB8fCBlbmM7CiAgICAgIH0KICAgICAgZXhwb3J0czIuU3RyaW5nRGVjb2RlciA9IFN0cmluZ0RlY29kZXI7CiAgICAgIGZ1bmN0aW9uIFN0cmluZ0RlY29kZXIoZW5jb2RpbmcpIHsKICAgICAgICB0aGlzLmVuY29kaW5nID0gbm9ybWFsaXplRW5jb2RpbmcoZW5jb2RpbmcpOwogICAgICAgIHZhciBuYjsKICAgICAgICBzd2l0Y2ggKHRoaXMuZW5jb2RpbmcpIHsKICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICB0aGlzLnRleHQgPSB1dGYxNlRleHQ7CiAgICAgICAgICAgIHRoaXMuZW5kID0gdXRmMTZFbmQ7CiAgICAgICAgICAgIG5iID0gNDsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgICAgdGhpcy5maWxsTGFzdCA9IHV0ZjhGaWxsTGFzdDsKICAgICAgICAgICAgbmIgPSA0OwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGNhc2UgImJhc2U2NCI6CiAgICAgICAgICAgIHRoaXMudGV4dCA9IGJhc2U2NFRleHQ7CiAgICAgICAgICAgIHRoaXMuZW5kID0gYmFzZTY0RW5kOwogICAgICAgICAgICBuYiA9IDM7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgdGhpcy53cml0ZSA9IHNpbXBsZVdyaXRlOwogICAgICAgICAgICB0aGlzLmVuZCA9IHNpbXBsZUVuZDsKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICB0aGlzLmxhc3ROZWVkID0gMDsKICAgICAgICB0aGlzLmxhc3RUb3RhbCA9IDA7CiAgICAgICAgdGhpcy5sYXN0Q2hhciA9IEJ1ZmZlcjEwLmFsbG9jVW5zYWZlKG5iKTsKICAgICAgfQogICAgICBTdHJpbmdEZWNvZGVyLnByb3RvdHlwZS53cml0ZSA9IGZ1bmN0aW9uKGJ1ZikgewogICAgICAgIGlmIChidWYubGVuZ3RoID09PSAwKQogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIHZhciByOwogICAgICAgIHZhciBpOwogICAgICAgIGlmICh0aGlzLmxhc3ROZWVkKSB7CiAgICAgICAgICByID0gdGhpcy5maWxsTGFzdChidWYpOwogICAgICAgICAgaWYgKHIgPT09IHZvaWQgMCkKICAgICAgICAgICAgcmV0dXJuICIiOwogICAgICAgICAgaSA9IHRoaXMubGFzdE5lZWQ7CiAgICAgICAgICB0aGlzLmxhc3ROZWVkID0gMDsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaSA9IDA7CiAgICAgICAgfQogICAgICAgIGlmIChpIDwgYnVmLmxlbmd0aCkKICAgICAgICAgIHJldHVybiByID8gciArIHRoaXMudGV4dChidWYsIGkpIDogdGhpcy50ZXh0KGJ1ZiwgaSk7CiAgICAgICAgcmV0dXJuIHIgfHwgIiI7CiAgICAgIH07CiAgICAgIFN0cmluZ0RlY29kZXIucHJvdG90eXBlLmVuZCA9IHV0ZjhFbmQ7CiAgICAgIFN0cmluZ0RlY29kZXIucHJvdG90eXBlLnRleHQgPSB1dGY4VGV4dDsKICAgICAgU3RyaW5nRGVjb2Rlci5wcm90b3R5cGUuZmlsbExhc3QgPSBmdW5jdGlvbihidWYpIHsKICAgICAgICBpZiAodGhpcy5sYXN0TmVlZCA8PSBidWYubGVuZ3RoKSB7CiAgICAgICAgICBidWYuY29weSh0aGlzLmxhc3RDaGFyLCB0aGlzLmxhc3RUb3RhbCAtIHRoaXMubGFzdE5lZWQsIDAsIHRoaXMubGFzdE5lZWQpOwogICAgICAgICAgcmV0dXJuIHRoaXMubGFzdENoYXIudG9TdHJpbmcodGhpcy5lbmNvZGluZywgMCwgdGhpcy5sYXN0VG90YWwpOwogICAgICAgIH0KICAgICAgICBidWYuY29weSh0aGlzLmxhc3RDaGFyLCB0aGlzLmxhc3RUb3RhbCAtIHRoaXMubGFzdE5lZWQsIDAsIGJ1Zi5sZW5ndGgpOwogICAgICAgIHRoaXMubGFzdE5lZWQgLT0gYnVmLmxlbmd0aDsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gdXRmOENoZWNrQnl0ZShieXRlKSB7CiAgICAgICAgaWYgKGJ5dGUgPD0gMTI3KQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgZWxzZSBpZiAoYnl0ZSA+PiA1ID09PSA2KQogICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgZWxzZSBpZiAoYnl0ZSA+PiA0ID09PSAxNCkKICAgICAgICAgIHJldHVybiAzOwogICAgICAgIGVsc2UgaWYgKGJ5dGUgPj4gMyA9PT0gMzApCiAgICAgICAgICByZXR1cm4gNDsKICAgICAgICByZXR1cm4gYnl0ZSA+PiA2ID09PSAyID8gLTEgOiAtMjsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGY4Q2hlY2tJbmNvbXBsZXRlKHNlbGYyLCBidWYsIGkpIHsKICAgICAgICB2YXIgaiA9IGJ1Zi5sZW5ndGggLSAxOwogICAgICAgIGlmIChqIDwgaSkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIHZhciBuYiA9IHV0ZjhDaGVja0J5dGUoYnVmW2pdKTsKICAgICAgICBpZiAobmIgPj0gMCkgewogICAgICAgICAgaWYgKG5iID4gMCkKICAgICAgICAgICAgc2VsZjIubGFzdE5lZWQgPSBuYiAtIDE7CiAgICAgICAgICByZXR1cm4gbmI7CiAgICAgICAgfQogICAgICAgIGlmICgtLWogPCBpIHx8IG5iID09PSAtMikKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIG5iID0gdXRmOENoZWNrQnl0ZShidWZbal0pOwogICAgICAgIGlmIChuYiA+PSAwKSB7CiAgICAgICAgICBpZiAobmIgPiAwKQogICAgICAgICAgICBzZWxmMi5sYXN0TmVlZCA9IG5iIC0gMjsKICAgICAgICAgIHJldHVybiBuYjsKICAgICAgICB9CiAgICAgICAgaWYgKC0taiA8IGkgfHwgbmIgPT09IC0yKQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgbmIgPSB1dGY4Q2hlY2tCeXRlKGJ1ZltqXSk7CiAgICAgICAgaWYgKG5iID49IDApIHsKICAgICAgICAgIGlmIChuYiA+IDApIHsKICAgICAgICAgICAgaWYgKG5iID09PSAyKQogICAgICAgICAgICAgIG5iID0gMDsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgIHNlbGYyLmxhc3ROZWVkID0gbmIgLSAzOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIG5iOwogICAgICAgIH0KICAgICAgICByZXR1cm4gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGY4Q2hlY2tFeHRyYUJ5dGVzKHNlbGYyLCBidWYsIHApIHsKICAgICAgICBpZiAoKGJ1ZlswXSAmIDE5MikgIT09IDEyOCkgewogICAgICAgICAgc2VsZjIubGFzdE5lZWQgPSAwOwogICAgICAgICAgcmV0dXJuICJcdUZGRkQiOwogICAgICAgIH0KICAgICAgICBpZiAoc2VsZjIubGFzdE5lZWQgPiAxICYmIGJ1Zi5sZW5ndGggPiAxKSB7CiAgICAgICAgICBpZiAoKGJ1ZlsxXSAmIDE5MikgIT09IDEyOCkgewogICAgICAgICAgICBzZWxmMi5sYXN0TmVlZCA9IDE7CiAgICAgICAgICAgIHJldHVybiAiXHVGRkZEIjsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzZWxmMi5sYXN0TmVlZCA+IDIgJiYgYnVmLmxlbmd0aCA+IDIpIHsKICAgICAgICAgICAgaWYgKChidWZbMl0gJiAxOTIpICE9PSAxMjgpIHsKICAgICAgICAgICAgICBzZWxmMi5sYXN0TmVlZCA9IDI7CiAgICAgICAgICAgICAgcmV0dXJuICJcdUZGRkQiOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIHV0ZjhGaWxsTGFzdChidWYpIHsKICAgICAgICB2YXIgcCA9IHRoaXMubGFzdFRvdGFsIC0gdGhpcy5sYXN0TmVlZDsKICAgICAgICB2YXIgciA9IHV0ZjhDaGVja0V4dHJhQnl0ZXModGhpcywgYnVmLCBwKTsKICA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fQogICAgICBmdW5jdGlvbiB1dGYxNlRleHQoYnVmLCBpKSB7CiAgICAgICAgaWYgKChidWYubGVuZ3RoIC0gaSkgJSAyID09PSAwKSB7CiAgICAgICAgICB2YXIgciA9IGJ1Zi50b1N0cmluZygidXRmMTZsZSIsIGkpOwogICAgICAgICAgaWYgKHIpIHsKICAgICAgICAgICAgdmFyIGMgPSByLmNoYXJDb2RlQXQoci5sZW5ndGggLSAxKTsKICAgICAgICAgICAgaWYgKGMgPj0gNTUyOTYgJiYgYyA8PSA1NjMxOSkgewogICAgICAgICAgICAgIHRoaXMubGFzdE5lZWQgPSAyOwogICAgICAgICAgICAgIHRoaXMubGFzdFRvdGFsID0gNDsKICAgICAgICAgICAgICB0aGlzLmxhc3RDaGFyWzBdID0gYnVmW2J1Zi5sZW5ndGggLSAyXTsKICAgICAgICAgICAgICB0aGlzLmxhc3RDaGFyWzFdID0gYnVmW2J1Zi5sZW5ndGggLSAxXTsKICAgICAgICAgICAgICByZXR1cm4gci5zbGljZSgwLCAtMSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiByOwogICAgICAgIH0KICAgICAgICB0aGlzLmxhc3ROZWVkID0gMTsKICAgICAgICB0aGlzLmxhc3RUb3RhbCA9IDI7CiAgICAgICAgdGhpcy5sYXN0Q2hhclswXSA9IGJ1ZltidWYubGVuZ3RoIC0gMV07CiAgICAgICAgcmV0dXJuIGJ1Zi50b1N0cmluZygidXRmMTZsZSIsIGksIGJ1Zi5sZW5ndGggLSAxKTsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNkVuZChidWYpIHsKICAgICAgICB2YXIgciA9IGJ1ZiAmJiBidWYubGVuZ3RoID8gdGhpcy53cml0ZShidWYpIDogIiI7CiAgICAgICAgaWYgKHRoaXMubGFzdE5lZWQpIHsKICAgICAgICAgIHZhciBlbmQgPSB0aGlzLmxhc3RUb3RhbCAtIHRoaXMubGFzdE5lZWQ7CiAgICAgICAgICByZXR1cm4gciArIHRoaXMubGFzdENoYXIudG9TdHJpbmcoInV0ZjE2bGUiLCAwLCBlbmQpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcjsKICAgICAgfQogICAgICBmdW5jdGlvbiBiYXNlNjRUZXh0KGJ1ZiwgaSkgewogICAgICAgIHZhciBuID0gKGJ1Zi5sZW5ndGggLSBpKSAlIDM7CiAgICAgICAgaWYgKG4gPT09IDApCiAgICAgICAgICByZXR1cm4gYnVmLnRvU3RyaW5nKCJiYXNlNjQiLCBpKTsKICAgICAgICB0aGlzLmxhc3ROZWVkID0gMyAtIG47CiAgICAgICAgdGhpcy5sYXN0VG90YWwgPSAzOwogICAgICAgIGlmIChuID09PSAxKSB7CiAgICAgICAgICB0aGlzLmxhc3RDaGFyWzBdID0gYnVmW2J1Zi5sZW5ndGggLSAxXTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdGhpcy5sYXN0Q2hhclswXSA9IGJ1ZltidWYubGVuZ3RoIC0gMl07CiAgICAgICAgICB0aGlzLmxhc3RDaGFyWzFdID0gYnVmW2J1Zi5sZW5ndGggLSAxXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1Zi50b1N0cmluZygiYmFzZTY0IiwgaSwgYnVmLmxlbmd0aCAtIG4pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJhc2U2NEVuZChidWYpIHsKICAgICAgICB2YXIgciA9IGJ1ZiAmJiBidWYubGVuZ3RoID8gdGhpcy53cml0ZShidWYpIDogIiI7CiAgICAgICAgaWYgKHRoaXMubGFzdE5lZWQpCiAgICAgICAgICByZXR1cm4gciArIHRoaXMubGFzdENoYXIudG9TdHJpbmcoImJhc2U2NCIsIDAsIDMgLSB0aGlzLmxhc3ROZWVkKTsKICAgICAgICByZXR1cm4gcjsKICAgICAgfQogICAgICBmdW5jdGlvbiBzaW1wbGVXcml0ZShidWYpIHsKICAgICAgICByZXR1cm4gYnVmLnRvU3RyaW5nKHRoaXMuZW5jb2RpbmcpOwogIC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V0gPSBhcmd1bWVudHNbX2tleV07CiAgICAgICAgICB9CiAgICAgICAgICBjYWxsYmFjay5hcHBseSh0aGlzLCBhcmdzKTsKICAgICAgICB9OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIG5vb3AoKSB7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaXNSZXF1ZXN0KHN0cmVhbSkgewogICAgICAgIHJldHVybiBzdHJlYW0uc2V0SGVhZGVyICYmIHR5cGVvZiBzdHJlYW0uYWJvcnQgPT09ICJmdW5jdGlvbiI7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZW9zKHN0cmVhbSwgb3B0cywgY2FsbGJhY2spIHsKICAgICAgICBpZiAodHlwZW9mIG9wdHMgPT09ICJmdW5jdGlvbiIpCiAgICAgICAgICByZXR1cm4gZW9zKHN0cmVhbSwgbnVsbCwgb3B0cyk7CiAgICAgICAgaWYgKCFvcHRzKQogICAgICAgICAgb3B0cyA9IHt9OwogICAgICAgIGNhbGxiYWNrID0gb25jZShjYWxsYmFjayB8fCBub29wKTsKICAgICAgICB2YXIgcmVhZGFibGUgPSBvcHRzLnJlYWRhYmxlIHx8IG9wdHMucmVhZGFibGUgIT09IGZhbHNlICYmIHN0cmVhbS5yZWFkYWJsZTsKICAgICAgICB2YXIgd3JpdGFibGUgPSBvcHRzLndyaXRhYmxlIHx8IG9wdHMud3JpdGFibGUgIT09IGZhbHNlICYmIHN0cmVhbS53cml0YWJsZTsKICAgICAgICB2YXIgb25sZWdhY3lmaW5pc2ggPSBmdW5jdGlvbiBvbmxlZ2FjeWZpbmlzaDIoKSB7CiAgICAgICAgICBpZiAoIXN0cmVhbS53cml0YWJsZSkKICAgICAgICAgICAgb25maW5pc2goKTsKICAgICAgICB9OwogICAgICAgIHZhciB3cml0YWJsZUVuZGVkID0gc3RyZWFtLl93cml0YWJsZVN0YXRlICYmIHN0cmVhbS5fd3JpdGFibGVTdGF0ZS5maW5pc2hlZDsKICAgICAgICB2YXIgb25maW5pc2ggPSBmdW5jdGlvbiBvbmZpbmlzaDIoKSB7CiAgICAgICAgICB3cml0YWJsZSA9IGZhbHNlOwogICAgICAgICAgd3JpdGFibGVFbmRlZCA9IHRydWU7CiAgICAgICAgICBpZiAoIXJlYWRhYmxlKQogICAgICAgICAgICBjYWxsYmFjay5jYWxsKHN0cmVhbSk7CiAgICAgICAgfTsKICAgICAgICB2YXIgcmVhZGFibGVFbmRlZCA9IHN0cmVhbS5fcmVhZGFibGVTdGF0ZSAmJiBzdHJlYW0uX3JlYWRhYmxlU3RhdGUuZW5kRW1pdHRlZDsKICAgICAgICB2YXIgb25lbmQgPSBmdW5jdGlvbiBvbmVuZDIoKSB7CiAgICAgICAgICByZWFkYWJsZSA9IGZhbHNlOwogICAgICAgICAgcmVhZGFibGVFbmRlZCA9IHRydWU7CiAgICAgICAgICBpZiAoIXdyaXRhYmxlKQogICAgICAgICAgICBjYWxsYmFjay5jYWxsKHN0cmVhbSk7CiAgICAgICAgfTsKICAgICAgICB2YXIgb25lcnJvciA9IGZ1bmN0aW9uIG9uZXJyb3IyKGVycikgewogICAgICAgICAgY2FsbGJhY2suY2FsbChzdHJlYW0sIGVycik7CiAgICAgICAgfTsKICAgICAgICB2YXIgb25jbG9zZSA9IGZ1bmN0aW9uIG9uY2xvc2UyKCkgewogICAgICAgICAgdmFyIGVycjsKICAgICAgICAgIGlmIChyZWFkYWJsZSAmJiAhcmVhZGFibGVFbmRlZCkgewogICAgICAgICAgICBpZiAoIXN0cmVhbS5fcmVhZGFibGVTdGF0ZSB8fCAhc3RyZWFtLl9yZWFkYWJsZVN0YXRlLmVuZGVkKQogICAgICAgICAgICAgIGVyciA9IG5ldyBFUlJfU1RSRUFNX1BSRU1BVFVSRV9DTE9TRSgpOwogICAgICAgICAgICByZXR1cm4gY2FsbGJhY2suY2FsbChzdHJlYW0sIGVycik7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAod3JpdGFibGUgJiYgIXdyaXRhYmxlRW5kZWQpIHsKICAgICAgICAgICAg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RpdmVdOwogICAgICAgIGlmIChwcmltICE9PSB2b2lkIDApIHsKICAgICAgICAgIHZhciByZXMgPSBwcmltLmNhbGwoaW5wdXQsIGhpbnQgfHwgImRlZmF1bHQiKTsKICAgICAgICAgIGlmICh0eXBlb2YgcmVzICE9PSAib2JqZWN0IikKICAgICAgICAgICAgcmV0dXJuIHJlczsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoIkBAdG9QcmltaXRpdmUgbXVzdCByZXR1cm4gYSBwcmltaXRpdmUgdmFsdWUuIik7CiAgICAgICAgfQogICAgICAgIHJldHVybiAoaGludCA9PT0gInN0cmluZyIgPyBTdHJpbmcgOiBOdW1iZXIpKGlucHV0KTsKICAgICAgfQogICAgICB2YXIgZmluaXNoZWQgPSByZXF1aXJlX2VuZF9vZl9zdHJlYW0oKTsKICAgICAgdmFyIGtMYXN0UmVzb2x2ZSA9IFN5bWJvbCgibGFzdFJlc29sdmUiKTsKICAgICAgdmFyIGtMYXN0UmVqZWN0ID0gU3ltYm9sKCJsYXN0UmVqZWN0Iik7CiAgICAgIHZhciBrRXJyb3IgPSBTeW1ib2woImVycm9yIik7CiAgICAgIHZhciBrRW5kZWQgPSBTeW1ib2woImVuZGVkIik7CiAgICAgIHZhciBrTGFzdFByb21pc2UgPSBTeW1ib2woImxhc3RQcm9taXNlIik7CiAgICAgIHZhciBrSGFuZGxlUHJvbWlzZSA9IFN5bWJvbCgiaGFuZGxlUHJvbWlzZSIpOwogICAgICB2YXIga1N0cmVhbSA9IFN5bWJvbCgic3RyZWFtIik7CiAgICAgIGZ1bmN0aW9uIGNyZWF0ZUl0ZXJSZXN1bHQodmFsdWUsIGRvbmUpIHsKICAgICAgICByZXR1cm4gewogICAgICAgICAgdmFsdWUsCiAgICAgICAgICBkb25lCiAgICAgICAgfTsKICAgICAgfQogICAgICBmdW5jdGlvbiByZWFkQW5kUmVzb2x2ZShpdGVyKSB7CiAgICAgICAgdmFyIHJlc29sdmUgPSBpdGVyW2tMYXN0UmVzb2x2ZV07CiAgICAgICAgaWYgKHJlc29sdmUgIT09IG51bGwpIHsKICAgICAgICAgIHZhciBkYXRhID0gaXRlcltrU3RyZWFtXS5yZWFkKCk7CiAgICAgICAgICBpZiAoZGF0YSAhPT0gbnVsbCkgewogICAgICAgICAgICBpdGVyW2tMYXN0UHJvbWlzZV0gPSBudWxsOwogICAgICAgICAgICBpdGVyW2tMYXN0UmVzb2x2ZV0gPSBudWxsOwogICAgICAgICAgICBpdGVyW2tMYXN0UmVqZWN0XSA9IG51bGw7CiAgICAgICAgICAgIHJlc29sdmUoY3JlYXRlSXRlclJlc3VsdChkYXRhLCBmYWxzZSkpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBvblJlYWRhYmxlKGl0ZXIpIHsKICAgICAgICBwcm9jZXNzLm5leHRUaWNrKHJlYWRBbmRSZXNvbHZlLCBpdGVyKTsKICAgICAgfQogICAgICBmdW5jdGlvbiB3cmFwRm9yTmV4dChsYXN0UHJvbWlzZSwgaXRlcikgewogICAgICAgIHJldHVybiBmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgIGxhc3RQcm9taXNlLnRoZW4oZnVuY3Rpb24oKSB7CiAgICAgICAgICAgIGlmIChpdGVyW2tFbmRlZF0pIHsKICAgICAgICAgICAgICByZXNvbHZlKGNyZWF0ZUl0ZXJSZXN1bHQodm9pZCAwLCB0cnVlKSk7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGl0ZXJba0hhbmRsZVByb21pc2VdKHJlc29sdmUsIHJlamVjdCk7CiAgICAgICAgICB9LCByZWplY3QpOwogICAgICAgIH07CiAgICAgIH0KICAgICAgdmFyIEFzeW5jSXRlcmF0b3JQcm90b3R5cGUgPSBPYmplY3QuZ2V0UHJvdG90eXBlT2YoZnVuY3Rpb24oKSB7CiAgICAgIH0pOwogICAgICB2YXIgUmVhZGFibGVTdHJlYW1Bc3luY0l0ZXJhdG9yUHJvdG90eXBlID0gT2JqZWN0LnNldFByb3RvdHlwZU9mKChfT2JqZWN0JHNldFByb3RvdHlwZU8gPSB7CiAgICAgICAgZ2V0IHN0cmVhbSgpIHsKICAgICAgICAgIHJldHVybiB0aGlzW2tTdHJlYW1dOwogICAgICAgIH0sCiAgICAgICAgbmV4dDogZnVuY3Rpb24gbmV4dCgpIHsKICAgICAgICAgIHZhciBfdGhpcyA9IHRoaXM7CiAgICAgICAgICB2YXIgZXJyb3IgPSB0aGlzW2tFcnJvcl07CiAgICAgICAgICBpZiAoZXJyb3IgIT09IG51bGwpIHsKICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KGVycm9yKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0aGlzW2tFbmRlZF0pIHsKICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShjcmVhdGVJdGVyUmVzdWx0KHZvaWQgMCwgdHJ1ZSkpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHRoaXNba1N0cmVhbV0uZGVzdHJveWVkKSB7CiAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZShmdW5jdGlvbihyZXNvbHZlLCByZWplY3QpIHsKICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgaWYgKF90aGlzW2tFcnJvcl0pIHsKICAgICAgICAgICAgICAgICAgcmVqZWN0KF90aGlzW2tFcnJvcl0pOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgcmVzb2x2ZShjcmVhdGVJdGVyUmVzdWx0KHZvaWQgMCwgdHJ1ZSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0pOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICAgIHZhciBsYXN0UHJvbWlzZSA9IHRoaXNba0xhc3RQcm9taXNlXTsKICAgICAgICAgIHZhciBwcm9taXNlOwogICAgICAgICAgaWYgKGxhc3RQcm9taXNlKSB7CiAgICAgICAgICAgIHByb21pc2UgPSBuZXcgUHJvbWlzZSh3cmFwRm9yTmV4dChsYXN0UHJvbWlzZSwgdGhpcykpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdmFyIGRhdGEgPSB0aGlzW2tTdHJlYW1dLnJlYWQoKTsKICAgICAgICAgICAgaWYgKGRhdGEgIT09IG51bGwpIHsKICAgICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKGNyZWF0ZUl0ZXJSZXN1bHQoZGF0YSwgZmFsc2UpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBwcm9taXNlID0gbmV3IFByb21pc2UodGhpc1trSGFuZGxlUHJvbWlzZV0pOwogICAgICAgICAgfQogICAgICAgICAgdGhpc1trTGFzdFByb21pc2VdID0gcHJvbWlzZTsKICAgICAgICAgIHJldHVybiBwcm9taXNlOwogICAgICAgIH0KICAgICAgfSwgX2RlZmluZVByb3BlcnR5KF9PYmplY3Qkc2V0UHJvdG90eXBlTywgU3ltYm9sLmFzeW5jSXRlcmF0b3IsIGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9KSwgX2RlZmluZVByb3BlcnR5KF9PYmplY3Qkc2V0UHJvdG90eXBlTywgInJldHVybiIsIGZ1bmN0aW9uIF9yZXR1cm4oKSB7CiAgICAgICAgdmFyIF90aGlzMiA9IHRoaXM7CiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKGZ1bmN0aW9uKHJlc29sdmUsIHJlamVjdCkgewogICAgICAgICAgX3RoaXMyW2tTdHJlYW1dLmRlc3Ryb3kobnVsbCwgZnVuY3Rpb24oZXJyKSB7CiAgICAgICAgICAgIGlmIChlcnIpIHsKICAgICAgICAgICAgICByZWplY3QoZXJyKTsKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmVzb2x2ZShjcmVhdG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0ZS5lbmRFbWl0dGVkLAogICAgICAgICAgd3JpdGFibGU6IHRydWUKICAgICAgICB9KSwgX2RlZmluZVByb3BlcnR5KF9PYmplY3QkY3JlYXRlLCBrSGFuZGxlUHJvbWlzZSwgewogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIHZhbHVlKHJlc29sdmUsIHJlamVjdCkgewogICAgICAgICAgICB2YXIgZGF0YSA9IGl0ZXJhdG9yW2tTdHJlYW1dLnJlYWQoKTsKICAgICAgICAgICAgaWYgKGRhdGEpIHsKICAgICAgICAgICAgICBpdGVyYXRvcltrTGFzdFByb21pc2VdID0gbnVsbDsKICAgICAgICAgICAgICBpdGVyYXRvcltrTGFzdFJlc29sdmVdID0gbnVsbDsKICAgICAgICAgICAgICBpdGVyYXRvcltrTGFzdFJlamVjdF0gPSBudWxsOwogICAgICAgICAgICAgIHJlc29sdmUoY3JlYXRlSXRlclJlc3VsdChkYXRhLCBmYWxzZSkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGl0ZXJhdG9yW2tMYXN0UmVzb2x2ZV0gPSByZXNvbHZlOwogICAgICAgICAgICAgIGl0ZXJhdG9yW2tMYXN0UmVqZWN0XSA9IHJlamVjdDsKICAgICAgICAgICAgfQogICAgICAgICAgfSwKICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgfSksIF9PYmplY3QkY3JlYXRlKSk7CiAgICAgICAgaXRlcmF0b3Jba0xhc3RQcm9taXNlXSA9IG51bGw7CiAgICAgICAgZmluaXNoZWQoc3RyZWFtLCBmdW5jdGlvbihlcnIpIHsKICAgICAgICAgIGlmIChlcnIgJiYgZXJyLmNvZGUgIT09ICJFUlJfU1RSRUFNX1BSRU1BVFVSRV9DTE9TRSIpIHsKICAgICAgICAgICAgdmFyIHJlamVjdCA9IGl0ZXJhdG9yW2tMYXN0UmVqZWN0XTsKICAgICAgICAgICAgaWYgKHJlamVjdCAhPT0gbnVsbCkgewogICAgICAgICAgICAgIGl0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zdHJpbmciKSB7CiAgICAgICAgICAgIGVuY29kaW5nID0gZW5jb2RpbmcgfHwgc3RhdGUuZGVmYXVsdEVuY29kaW5nOwogICAgICAgICAgICBpZiAoZW5jb2RpbmcgIT09IHN0YXRlLmVuY29kaW5nKSB7CiAgICAgICAgICAgICAgY2h1bmsgPSBCdWZmZXIxMC5mcm9tKGNodW5rLCBlbmNvZGluZyk7CiAgICAgICAgICAgICAgZW5jb2RpbmcgPSAiIjsKICAgICAgICAgICAgfQogICAgICAgICAgICBza2lwQ2h1bmtDaGVjayA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHNraXBDaHVua0NoZWNrID0gdHJ1ZTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlYWRhYmxlQWRkQ2h1bmsodGhpcywgY2h1bmssIGVuY29kaW5nLCBmYWxzZSwgc2tpcENodW5rQ2hlY2spOwogICAgICB9OwogICAgICBSZWFkYWJsZS5wcm90b3R5cGUudW5zaGlmdCA9IGZ1bmN0aW9uKGNodW5rKSB7CiAgICAgICAgcmV0dXJuIHJlYWRhYmxlQWRkQ2h1bmsodGhpcywgY2h1bmssIG51bGwsIHRydWUsIGZhbHNlKTsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gcmVhZGFibGVBZGRDaHVuayhzdHJlYW0sIGNodW5rLCBlbmNvZGluZywgYWRkVG9Gcm9udCwgc2tpcENodW5rQ2hlY2spIHsKICAgICAgICBkZWJ1ZygicmVhZGFibGVBZGRDaHVuayIsIGNodW5rKTsKICAgICAgICB2YXIgc3RhdGUgPSBzdHJlYW0uX3JlYWRhYmxlU3RhdGU7CiAgICAgICAgaWYgKGNodW5rID09PSBudWxsKSB7CiAgICAgICAgICBzdGF0ZS5yZWFkaW5nID0gZmFsc2U7CiAgICAgICAgICBvbkVvZkNodW5rKHN0cmVhbSwgc3RhdGUpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB2YXIgZXI7CiAgICAgICAgICBpZiAoIXNraXBDaHVua0NoZWNrKQogICAgICAgICAgICBlciA9IGNodW5rSW52YWxpZChzdGF0ZSwgY2h1bmspOwogICAgICAgICAgaWYgKGVyKSB7CiAgICAgICAgICAgIGVycm9yT3JEZXN0cm95KHN0cmVhbSwgZXIpOwogICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5vYmplY3RNb2RlIHx8IGNodW5rICYmIGNodW5rLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgaWYgKHR5cGVvZiBjaHVuayAhPT0gInN0cmluZyIgJiYgIXN0YXRlLm9iamVjdE1vZGUgJiYgT2JqZWN0LmdldFByb3RvdHlwZU9mKGNodW5rKSAhPT0gQnVmZmVyMTAucHJvdG90eXBlKSB7CiAgICAgICAgICAgICAgY2h1bmsgPSBfdWludDhBcnJheVRvQnVmZmVyKGNodW5rKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoYWRkVG9Gcm9udCkgewogICAgICAgICAgICAgIGlmIChzdGF0ZS5lbmRFbWl0dGVkKQogICAgICAgICAgICAgICAgZXJyb3JPckRlc3Ryb3koc3RyZWFtLCBuZXcgRVJSX1NUUkVBTV9VTlNISUZUX0FGVEVSX0VORF9FVkVOVCgpKTsKICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICBhZGRDaHVuayhzdHJlYW0sIHN0YXRlLCBjaHVuaywgdHJ1ZSk7CiAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RhdGUuZW5kZWQpIHsKICAgICAgICAgICAgICBlcnJvck9yRGVzdHJveShzdHJlYW0sIG5ldyBFUlJfU1RSRUFNX1BVU0hfQUZURVJfRU9GKCkpOwogICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmRlc3Ryb3llZCkgewogICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBzdGF0ZS5yZWFkaW5nID0gZmFsc2U7CiAgICAgICAgICAgICAgaWYgKHN0YXRlLmRlY29kZXIgJiYgIWVuY29kaW5nKSB7CiAgICAgICAgICAgICAgICBjaHVuayA9IHN0YXRlLmRlY29kZXIud3JpdGUoY2h1bmspOwogICAgICAgICAgICAgICAgaWYgKHN0YXRlLm9iamVjdE1vZGUgfHwgY2h1bmsubGVuZ3RoICE9PSAwKQogICAgICAgICAgICAgICAgICBhZGRDaHVuayhzdHJlYW0sIHN0YXRlLCBjaHVuaywgZmFsc2UpOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICBtYXliZVJlYWRNb3JlKHN0cmVhbSwgc3RhdGUpOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBhZGRDaHVuayhzdHJlYW0sIHN0YXRlLCBjaHVuaywgZmFsc2UpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIGlmICghYWRkVG9Gcm9udCkgewogICAgICAgICAgICBzdGF0ZS5yZWFkaW5nID0gZmFsc2U7CiAgICAgICAgICAgIG1heWJlUmVhZE1vcmUoc3RyZWFtLCBzdGF0ZSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiAhc3RhdGUuZW5kZWQgJiYgKHN0YXRlLmxlbmd0aCA8IHN0YXRlLmhpZ2hXYXRlck1hcmsgfHwgc3RhdGUubGVuZ3RoID09PSAwKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBhZGRDaHVuayhzdHJlYW0sIHN0YXRlLCBjaHVuaywgYWRkVG9Gcm9udCkgewogICAgICAgIGlmIChzdGF0ZS5mbG93aW5nICYmIHN0YXRlLmxlbmd0aCA9PT0gMCAmJiAhc3RhdGUuc3luYykgewogICAgICAgICAgc3RhdGUuYXdhaXREcmFpbiA9IDA7CiAgICAgICAgICBzdHJlYW0uZW1pdCgiZGF0YSIsIGNodW5rKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RhdGUubGVuZ3RoICs9IHN0YXRlLm9iamVjdE1v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jb2RlcjIgPSBuZXcgU3RyaW5nRGVjb2RlcihlbmMpOwogICAgICAgIHRoaXMuX3JlYWRhYmxlU3RhdGUuZGVjb2RlciA9IGRlY29kZXIyOwogICAgICAgIHRoaXMuX3JlYWRhYmxlU3RhdGUuZW5jb2RpbmcgPSB0aGlzLl9yZWFkYWJsZVN0YXRlLmRlY29kZXIuZW5jb2Rpbmc7CiAgICAgICAgdmFyIHAgPSB0aGlzLl9yZWFkYWJsZVN0YXRlLmJ1ZmZlci5oZWFkOwogICAgICAgIHZhciBjb250ZW50ID0gIiI7CiAgICAgICAgd2hpbGUgKHAgIT09IG51bGwpIHsKICAgICAgICAgIGNvbnRlbnQgKz0gZGVjb2RlcjIud3JpdGUocC5kYXRhKTsKICAgICAgICAgIHAgPSBwLm5leHQ7CiAgICAgICAgfQogICAgICAgIHRoaXMuX3JlYWRhYmxlU3RhdGUuYnVmZmVyLmNsZWFyKCk7CiAgICAgICAgaWYgKGNvbnRlbnQgIT09ICIiKQogICAgICAgICAgdGhpcy5fcmVhZGFibGVTdGF0ZS5idWZmZXIucHVzaChjb250ZW50KTsKICAgICAgICB0aGlzLl9yZWFkYWJsZVN0YXRlLmxlbmd0aCA9IGNvbnRlbnQubGVuZ3RoOwogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9OwogICAgICB2YXIgTUFYX0hXTSA9IDEwNzM3NDE4MjQ7CiAgICAgIGZ1bmN0aW9uIGNvbXB1dGVOZXdIaWdoV2F0ZXJNYXJrKG4pIHsKICAgICAgICBpZiAobiA+PSBNQVhfSFdNKSB7CiAgICAgICAgICBuID0gTUFYX0hXTTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgbi0tOwogICAgICAgICAgbiB8PSBuID4+PiAxOwogICAgICAgICAgbiB8PSBuID4+PiAyOwogICAgICAgICAgbiB8PSBuID4+PiA0OwogICAgICAgICAgbiB8PSBuID4+PiA4OwogICAgICAgICAgbiB8PSBuID4+PiAxNjsKICAgICAgICAgIG4rKzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG47CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaG93TXVjaFRvUmVhZChuLCBzdGF0ZSkgewogICAgICAgIGlmIChuIDw9IDAgfHwgc3RhdGUubGVuZ3RoID09PSAwICYmIHN0YXRlLmVuZGVkKQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgaWYgKHN0YXRlLm9iamVjdE1vZGUpCiAgICAgICAgICByZXR1cm4gMTsKICAgICAgICBpZiAobiAhPT0gbikgewogICAgICAgICAgaWYgKHN0YXRlLmZsb3dpbmcgJiYgc3RhdGUubGVuZ3RoKQogICAgICAgICAgICByZXR1cm4gc3RhdGUuYnVmZmVyLmhlYWQuZGF0YS5sZW5ndGg7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiBzdGF0ZS5sZW5ndGg7CiAgICAgICAgfQogICAgICAgIGlmIChuID4gc3RhdGUuaGlnaFdhdGVyTWFyaykKICAgICAgICAgIHN0YXRlLmhpZ2hXYXRlck1hcmsgPSBjb21wdXRlTmV3SGlnaFdhdGVyTWFyayhuKTsKICAgICAgICBpZiAobiA8PSBzdGF0ZS5sZW5ndGgpCiAgICAgICAgICByZXR1cm4gbjsKICAgICAgICBpZiAoIXN0YXRlLmVuZGVkKSB7CiAgICAgICAgICBzdGF0ZS5uZWVkUmVhZGFibGUgPSB0cnVlOwogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzdGF0ZS5sZW5ndGg7CiAgICAgIH0KICAgICAgUmVhZGFibGUucHJvdG90eXBlLnJlYWQgPSBmdW5jdGlvbihuKSB7CiAgICAgICAgZGVidWcoInJlYWQiLCBuKTsKICAgICAgICBuID0gcGFyc2VJbnQobiwgMTApOwogICAgICAgIHZhciBzdGF0ZSA9IHRoaXMuX3JlYWRhYmxlU3RhdGU7CiAgICAgICAgdmFyIG5PcmlnID0gbjsKICAgICAgICBpZiAobiAhPT0gMCkKICAgICAgICAgIHN0YX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oc3RhdGUuZW5kZWQgfHwgc3RhdGUucmVhZGluZykgewogICAgICAgICAgZG9SZWFkID0gZmFsc2U7CiAgICAgICAgICBkZWJ1ZygicmVhZGluZyBvciBlbmRlZCIsIGRvUmVhZCk7CiAgICAgICAgfSBlbHNlIGlmIChkb1JlYWQpIHsKICAgICAgICAgIGRlYnVnKCJkbyByZWFkIik7CiAgICAgICAgICBzdGF0ZS5yZWFkaW5nID0gdHJ1ZTsKICAgICAgICAgIHN0YXRlLnN5bmMgPSB0cnVlOwogICAgICAgICAgaWYgKHN0YXRlLmxlbmd0aCA9PT0gMCkKICAgICAgICAgICAgc3RhdGUubmVlZFJlYWRhYmxlID0gdHJ1ZTsKICAgICAgICAgIHRoaXMuX3JlYWQoc3RhdGUuaGlnaFdhdGVyTWFyayk7CiAgICAgICAgICBzdGF0ZS5zeW5jID0gZmFsc2U7CiAgICAgICAgICBpZiAoIXN0YXRlLnJlYWRpbmcpCiAgICAgICAgICAgIG4gPSBob3dNdWNoVG9SZWFkKG5PcmlnLCBzdGF0ZSk7CiAgICAgICAgfQogICAgICAgIHZhciByZXQ7CiAgICAgICAgaWYgKG4gPiAwKQogICAgICAgICAgcmV0ID0gZnJvbUxpc3Qobiwgc3RhdGUpOwogICAgICAgIGVsc2UKICAgICAgICAgIHJldCA9IG51bGw7CiAgICAgICAgaWYgKHJldCA9PT0gbnVsbCkgewogICAgICAgICAgc3RhdGUubmVlZFJlYWRhYmxlID0gc3RhdGUubGVuZ3RoIDw9IHN0YXRlLmhpZ2hXYXRlck1hcms7CiAgICAgICAgICBuID0gMDsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RhdGUubGVuZ3RoIC09IG47CiAgICAgICAgICBzdGF0ZS5hd2FpdERyYWluID0gMDsKICAgICAgICB9CiAgICAgICAgaWYgKHN0YXRlLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgaWYgKCFzdGF0ZS5lbmRlZCkKICAgICAgICAgICAgc3RhdGUubmVlZFJlYWRhYmxlID0gdHJ1ZTsKICAgICAgICAgIGlmIChuT3JpZyAhPT0gbiAmJiBzdGF0ZS5lbmRlZCkKICAgICAgICAgICAgZW5kUmVhZGFibGUodGhpcyk7CiAgICAgICAgfQogICAgICAgIGlmIChyZXQgIT09IG51bGwpCiAgICAgICAgICB0aGlzLmVtaXQoImRhdGEiLCByZXQpOwogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIG9uRW9mQ2h1bmsoc3RyZWFtLCBzdGF0ZSkgewogICAgICAgIGRlYnVnKCJvbkVvZkNodW5rIik7CiAgICAgICAgaWYgKHN0YXRlLmVuZGVkKQogICAgICAgICAgcmV0dXJuOwogICAgICAgIGlmIChzdGF0ZS5kZWNvZGVyKSB7CiAgICAgICAgICB2YXIgY2h1bmsgPSBzdGF0ZS5kZWNvZGVyLmVuZCgpOwogICAgICAgICAgaWYgKGNodW5rICYmIGNodW5rLmxlbmd0aCkgewogICAgICAgICAgICBzdGF0ZS5idWZmZXIucHVzaChjaHVuayk7CiAgICAgICAgICAgIHN0YXRlLmxlbmd0aCArPSBzdGF0ZS5vYmplY3RNb2RlID8gMSA6IGNodW5rLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgc3RhdGUuZW5kZWQgPSB0cnVlOwogICAgICAgIGlmIChzdGF0ZS5zeW5jKSB7CiAgICAgICAgICBlbWl0UmVhZGFibGUoc3RyZWFtKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RhdGUubmVlZFJlYWRhYmxlID0gZmFsc2U7CiAgICAgICAgICBpZiAoIXN0YXRlLmVtaXR0ZWRSZWFkYWJsZSkgewogICAgICAgICAgICBzdGF0ZS5lbWl0dGVkUmVhZGFibGUgPSB0cnVlOwogICAgICAgICAgICBlbWl0UmVhZGFibGVfKHN0cmVhbSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGVtaXRSZWFkYWJsZShzdHJ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zQ291bnQpIHsKICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgc3RhdGUucGlwZXMgPSBkZXN0OwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgc3RhdGUucGlwZXMgPSBbc3RhdGUucGlwZXMsIGRlc3RdOwogICAgICAgICAgICBicmVhazsKICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgIHN0YXRlLnBpcGVzLnB1c2goZGVzdCk7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICBzdGF0ZS5waXBlc0NvdW50ICs9IDE7CiAgICAgICAgZGVidWcoInBpcGUgY291bnQ9JWQgb3B0cz0laiIsIHN0YXRlLnBpcGVzQ291bnQsIHBpcGVPcHRzKTsKICAgICAgICB2YXIgZG9FbmQgPSAoIXBpcGVPcHRzIHx8IHBpcGVPcHRzLmVuZCAhPT0gZmFsc2UpICYmIGRlc3QgIT09IHByb2Nlc3Muc3Rkb3V0ICYmIGRlc3QgIT09IHByb2Nlc3Muc3RkZXJyOwogICAgICAgIHZhciBlbmRGbiA9IGRvRW5kID8gb25lbmQgOiB1bnBpcGU7CiAgICAgICAgaWYgKHN0YXRlLmVuZEVtaXR0ZWQpCiAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGVuZEZuKTsKICAgICAgICBlbHNlCiAgICAgICAgICBzcmMub25jZSgiZW5kIiwgZW5kRm4pOwogICAgICAgIGRlc3Qub24oInVucGlwZSIsIG9udW5waXBlKTsKICAgICAgICBmdW5jdGlvbiBvbnVucGlwZShyZWFkYWJsZSwgdW5waXBlSW5mbykgewogICAgICAgICAgZGVidWcoIm9udW5waXBlIik7CiAgICAgICAgICBpZiAocmVhZGFibGUgPT09IHNyYykgewogICAgICAgICAgICBpZiAodW5waXBlSW5mbyAmJiB1bnBpcGVJbmZvLmhhc1VucGlwZWQgPT09IGZhbHNlKSB7CiAgICAgICAgICAgICAgdW5waXBlSW5mby5oYXNVbnBpcG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Ck7CiAgICAgICAgfQogICAgICAgIHNyYy5vbigiZGF0YSIsIG9uZGF0YSk7CiAgICAgICAgZnVuY3Rpb24gb25kYXRhKGNodW5rKSB7CiAgICAgICAgICBkZWJ1Zygib25kYXRhIik7CiAgICAgICAgICB2YXIgcmV0ID0gZGVzdC53cml0ZShjaHVuayk7CiAgICAgICAgICBkZWJ1ZygiZGVzdC53cml0ZSIsIHJldCk7CiAgICAgICAgICBpZiAocmV0ID09PSBmYWxzZSkgewogICAgICAgICAgICBpZiAoKHN0YXRlLnBpcGVzQ291bnQgPT09IDEgJiYgc3RhdGUucGlwZXMgPT09IGRlc3QgfHwgc3RhdGUucGlwZXNDb3VudCA+IDEgJiYgaW5kZXhPZihzdGF0ZS5waXBlcywgZGVzdCkgIT09IC0xKSAmJiAhY2xlYW5lZFVwKSB7CiAgICAgICAgICAgICAgZGVidWcoImZhbHNlIHdyaXRlIHJlc3BvbnNlLCBwYXVzZSIsIHN0YXRlLmF3YWl0RHJhaW4pOwogICAgICAgICAgICAgIHN0YXRlLmF3YWl0RHJhaW4rKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBzcmMucGF1c2UoKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gb25lcnJvcihlcikgewogICAgICAgICAgZGVidWcoIm9uZXJyb3IiLCBlcik7CiAgICAgICAgICB1bnBpcGUoKTsKICAgICAgICAgIGRlc3QucmVtb3ZlTGlzdGVuZXIoImVycm9yIiwgb25lcnJvcik7CiAgICAgICAgICBpZiAoRUVsaXN0ZW5lckNvdW50KGRlc3QsICJlcnJvciIpID09PSAwKQogICAgICAgICAgICBlcnJvck9yRGVzdHJveShkZXN0LCBlcik7CiAgICAgICAgfQogICAgICAgIHByZXBlbmRMaXN0ZW5lcihkZXN0LCAiZXJyb3IiLCBvbmVycm9yKTsKICAgICAgICBmdW5jdGlvbiBvbmNsb3NlKCkgewogICAgICAgICAgZGVzdC5yZW1vdmVMaXN0ZW5lcigiZmluaXNoIiwgb25maW5pc2gpOwogICAgICAgICAgdW5waXBlKCk7CiAgICAgICAgfQogICAgICAgIGRlc3Qub25jZSgiY2xvc2UiLCBvbmNsb3NlKTsKICAgICAgICBmdW5jdGlvbiBvbmZpbmlzaCgpIHsKICAgICAgICAgIGRlYnVnKCJvbmZpbmlzaCIpOwogICAgICAgICAgZGVzdC5yZW1vdmVMaXN0ZW5lcigiY2xvc2UiLCBvbmNsb3NlKTsKICAgICAgICAgIHVucGlwZSgpOwogICAgICAgIH0KICAgICAgICBkZXN0Lm9uY2UoImZpbmlzaCIsIG9uZmluaXNoKTsKICAgICAgICBmdW5jdGlvbiB1bnBpcGUoKSB7CiAgICAgICAgICBkZWJ1ZygidW5waXBlIik7CiAgICAgICAgICBzcmMudW5waXBlKGRlc3QpOwogICAgICAgIH0KICAgICAgICBkZXN0LmVtaXQoInBpcGUiLCBzcmMpOwogICAgICAgIGlmICghc3RhdGUuZmxvd2luZykgewogICAgICAgICAgZGVidWcoInBpcGUgcmVzdW1lIik7CiAgICAgICAgICBzcmMucmVzdW1lKCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBkZXN0OwogICAgICB9OwogICAgICBmdW5jdGlvbiBwaXBlT25EcmFpbihzcmMpIHsKICAgICAgICByZXR1cm4gZnVuY3Rpb24gcGlwZU9uRHJhaW5GdW5jdGlvblJlc3VsdCgpIHsKICAgICAgICAgIHZhciBzdGF0ZSA9IHNyYy5fcmVhZGFibGVTdGF0ZTsKICAgICAgICAgIGRlYnVnKCJwaXBlT25EcmFpbiIsIHN0YXRlLmF3YWl0RHJhaW4pOwogICAgICAgICAgaWYgKHN0YXRlLmF3YWl0RHJhaW4pCiAgICAgICAgICAgIHN0YXRlLmF3YWl0RHJhaW4tLTsKICAgICAgICAgIGlmIChzdGF0ZS5hd2FpdERyYWluID09PSAwICYmIEVFbGlzdGVuZXJDb3VudChzcmMsICJkYXRhIikpIHsKICAgICAgICAgICAgc3RhdGUuZmxvd2luZyA9IHRydWU7CiAgICAgICAgICAgIGZsb3coc3JjKTsKICAgICAgICAgIH0KICAgICAgICB9OwogICAgICB9CiAgICAgIFJlYWRhYmxlLnByb3RvdHlwZS51bnBpcGUgPSBmdW5jdGlvbihkZXN0KSB7CiAgICAgICAgdmFyIHN0YXRlID0gdGhpcy5fcmVhZGFibGVTdGF0ZTsKICAgICAgICB2YXIgdW5waXBlSW5mbyA9IHsKICAgICAgICAgIGhhc1VucGlwZWQ6IGZhbHNlCiAgICAgICAgfTsKICAgICAgICBpZiAoc3RhdGUucGlwZXNDb3VudCA9PT0gMCkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGlmIChzdGF0ZS5waXBlc0NvdW50ID09PSAxKSB7CiAgICAgICAgICBpZiAoZGVzdCAmJiBkZXN0ICE9PSBzdGF0ZS5waXBlcykKICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICBpZiAoIWRlc3QpCiAgICAgICAgICAgIGRlc3QgPSBzdGF0ZS5waXBlczsKICAgICAgICAgIHN0YXRlLnBpcGVzID0gbnVsbDsKICAgICAgICAgIHN0YXRlLnBpcGVzQ291bnQgPSAwOwogICAgICAgICAgc3RhdGUuZmxvd2luZyA9IGZhbHNlOwogICAgICAgICAgaWYgKGRlc3QpCiAgICAgICAgICAgIGRlc3QuZW1pdCgidW5waXBlIiwgdGhpcywgdW5waXBlSW5mbyk7CiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICB9CiAgICAgICAgaWYgKCFkZXN0KSB7CiAgICAgICAgICB2YXIgZGVzdHMgPSBzdGF0ZS5waXBlczsKICAgICAgICAgIHZhciBsZW4gPSBzdGF0ZS5waXBlc0NvdW50OwogICAgICAgICAgc3RhdGUucGlwZXMgPSBudWxsOwogICAgICAgICAgc3RhdGUucGlwZXNDb3VudCA9IDA7CiAgICAgICAgICBzdGF0ZS5mbG93aW5nID0gZmFsc2U7CiAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbjsgaSsrKQogICAgICAgICAgICBkZXN0c1tpXS5lbWl0KCJ1bnBpcGUiLCB0aGlzLCB7CiAgICAgICAgICAgICAgaGFzVW5waXBlZDogZmFsc2UKICAgICAgICAgICAgfSk7CiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICB9CiAgICAgICAgdmFyIGluZGV4ID0gaW5kZXhPZihzdGF0ZS5waXBlcywgZGVzdCk7CiAgICAgICAgaWYgKGluZGV4ID09PSAtMSkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIHN0YXRlLnBpcGVzLnNwbGljZShpbmRleCwgMSk7CiAgICAgICAgc3RhdGUucGlwZXNDb3VudCAtPSAxOwogICAgICAgIGlmIChzdGF0ZS5waXBlc0NvdW50ID09PSAxKQogICAgICAgICAgc3RhdGUucGlwZXMgPSBzdGF0ZS5waXBlc1swXTsKICAgICAgICBkZXN0LmVtaXQoInVucGlwZSIsIHRoaXMsIHVucGlwZUluZm8pOwogICAgICAgIHJldHVybiB0aGlzOwogICAgICB9OwogICAgICBSZWFkYWJsZS5wcm90b3R5cGUub24gPSBmdW5jdGlvbihldiwgZm4pIHsKICAgICAgICB2YXIgcmVzID0gU3RyZWFtLnByb3RvdHlwZS5vbi5jYWxsKHRoaXMsIGV2LCBmbik7CiAgICAgICAgdmFyIHN0YXRlID0gdGhpcy5fcmVhZGFibGVTdGF0ZTsKICAgICAgICBpZiAoZXYgPT09ICJkYXRhIikgewogICAgICAgICAgc3RhdGUucmVhZGFibGVMaXN0ZW5pbmcgPSB0aGlzLmxpc3RlbmVyQ291bnQoInJlYWRhYmxlIikgPiAwOwogICAgICAgICAgaWYgKHN0YXRlLmZsb3dpbmcgIT09IGZhbHNlKQogICAgICAgICAgICB0aGlzLnJlc3VtZSgpOwogICAgICAgIH0gZWxzZSBpZiAoZXYgPT09ICJyZWFkYWJsZSIpIHsKICAgICAgICAgIGlmICghc3RhdGUuZW5kRW1pdHRlZCAmJiAhc3RhdGUucmVhZGFibGVMaXN0ZW5pbmcpIHsKICAgICAgICAgICAgc3RhdGUucmVhZGFibGVMaXN0ZW5pbmcgPSBzdGF0ZS5uZWVkUmVhZGFibGUgPSB0cnVlOwogICAgICAgICAgICBzdGF0ZS5mbG93aW5nID0gZmFsc2U7CiAgICAgICAgICAgIHN0YXRlLmVtaXR0ZWRSZWFkYWJsZSA9IGZhbHNlOwogICAgICAgICAgICBkZWJ1Zygib24gcmVhZGFibGUiLCBzdGF0ZS5sZW5ndGgsIHN0YXRlLnJlYWRpbmcpOwogICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoKSB7CiAgICAgICAgICAgICAgZW1pdFJlYWRhYmxlKHRoaXMpOwogICAgICAgICAgICB9IGVsc2UgaWYgKCFzdGF0ZS5yZWFkaW5nKSB7CiAgICAgICAgICAgICAgcHJvY2Vzcy5uZXh0VGljayhuUmVhZGluZ05leHRUaWNrLCB0aGlzKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gcmVzOwogICAgICB9OwogICAgICBSZWFkYWJsZS5wcm90b3R5cGUuYWRkTGlzdGVuZXIgPSBSZWFkYWJsZS5wcm90b3R5cGUub247CiAgICAgIFJlYWRhYmxlLnByb3RvdHlwZS5yZW1vdmVMaXN0ZW5lciA9IGZ1bmN0aW9uKGV2LCBmbikgewogICAgICAgIHZhciByZXMgPSBTdHJlYW0ucHJvdG90eXBlLnJlbW92ZUxpc3RlbmVyLmNhbGwodGhpcywgZXYsIGZuKTsKICAgICAgICBpZiAoZXYgPT09ICJyZWFkYWJsZSIpIHsKICAgICAgICAgIHByb2Nlc3MubmV4dFRpY2sodXBkYXRlUmVhZGFibGVMaXN0ZW5pbmcsIHRoaXMpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmVzOwogICAgICB9OwogICAgICBSZWFkYWJsZS5wcm90b3R5cGUucmVtb3ZlQWxsTGlzdGVuZXJzID0gZnVuY3Rpb24oZXYpIHsKICAgICAgICB2YXIgcmVzID0gU3RyZWFtLnByb3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hZGFibGVTdGF0ZS5mbG93aW5nID0gZmFsc2U7CiAgICAgICAgICB0aGlzLmVtaXQoInBhdXNlIik7CiAgICAgICAgfQogICAgICAgIHRoaXMuX3JlYWRhYmxlU3RhdGUucGF1c2VkID0gdHJ1ZTsKICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gZmxvdyhzdHJlYW0pIHsKICAgICAgICB2YXIgc3RhdGUgPSBzdHJlYW0uX3JlYWRhYmxlU3RhdGU7CiAgICAgICAgZGVidWcoImZsb3ciLCBzdGF0ZS5mbG93aW5nKTsKICAgICAgICB3aGlsZSAoc3RhdGUuZmxvd2luZyAmJiBzdHJlYW0ucmVhZCgpICE9PSBudWxsKQogICAgICAgICAgOwogICAgICB9CiAgICAgIFJlYWRhYmxlLnByb3RvdHlwZS53cmFwID0gZnVuY3Rpb24oc3RyZWFtKSB7CiAgICAgICAgdmFyIF90aGlzID0gdGhpczsKICAgICAgICB2YXIgc3RhdGUgPSB0aGlzLl9yZWFkYWJsZVN0YXRlOwogICAgICAgIHZhciBwYXVzZWQgPSBmYWxzZTsKICAgICAgICBzdHJlYW0ub24oImVuZCIsIGZ1bmN0aW9uKCkgewogICAgICAgICAgZGVidWcoIndyYXBwZWQgZW5kIik7CiAgICAgICAgICBpZiAoc3RhdGUuZGVjb2RlciAmJiAhc3RhdGUuZW5kZWQpIHsKICAgICAgICAgICAgdmFyIGNodW5rID0gc3RhdGUuZGVjb2Rlci5lbmQoKTsKICAgICAgICAgICAgaWYgKGNodW5rICYmIGNodW5rLmxlbmd0aCkKICAgICAgICAgICAgICBfdGhpcy5wdXNoKGNodW5rKTsKICAgICAgICAgIH0KICAgICAgICAgIF90aGlzLnB1c2gobnVsbCk7CiAgICAgICAgfSk7CiAgICAgICAgc3RyZWFtLm9uKCJkYXRhIiwgZnVuY3Rpb24oY2h1bmspIHsKICAgICAgICAgIGRlYnVnKCJ3cmFwcGVkIGRhdGEiKTsKICAgICAgICAgIGlmIChzdGF0ZS5kZWNvZGVyKQogICAgICAgICAgICBjaHVuayA9IHN0YXRlLmRlY29kZXIud3JpdGUoY2h1bmspOwogICAgICAgICAgaWYgKHN0YXRlLm9iamVjdE1vZGUgJiYgKGNodW5rID09PSBudWxsIHx8IGNodW5rID09PSB2b2lkIDApKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICBlbHNlIGlmICghc3RhdGUub2JqZWN0TW9kZSAmJiAoIWNodW5rIHx8ICFjaHVuay5sZW5ndGgpKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICB2YXIgcmV0ID0gX3RoaXMucHVzaChjaHVuayk7CiAgICAgICAgICBpZiAoIXJldCkgewogICAgICAgICAgICBwYXVzZWQgPSB0cnVlOwogICAgICAgICAgICBzdHJlYW0ucGF1c2UoKTsKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICBmb3IgKHZhciBpIGluIHN0cmVhbSkgewogICAgICAgICAgaWYgKHRoaXNbaV0gPT09IHZvaWQgMCAmJiB0eXBlb2Ygc3RyZWFtW2ldID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIHRoaXNbaV0gPSBmdW5jdGlvbiBtZXRob2RXcmFwKG1ldGhvZCkgewogICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiBtZXRob2RXcmFwUmV0dXJuRnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gc3RyZWFtW21ldGhvZF0uYXBwbHkoc3RyZWFtLCBhcmd1bWVudHMpOwogICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0oaSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZvciAodmFyIG4gPSAwOyBuIDwga1Byb3h5RXZlbnRzLmxlbmd0aDsgbisrKSB7CiAgICAgICAgICBzdHJlYW0ub24oa1Byb3h5RXZlbnRzW25dLCB0aGlzLmVtaXQuYmluZCh0aGlzLCBrUHJveHlFdmVudHNbbl0pKTsKICAgICAgICB9CiAgICAgICAgdGh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ubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICBzdGF0ZS5lbmRFbWl0dGVkID0gdHJ1ZTsKICAgICAgICAgIHN0cmVhbS5yZWFkYWJsZSA9IGZhbHNlOwogICAgICAgICAgc3RyZWFtLmVtaXQoImVuZCIpOwogICAgICAgICAgaWYgKHN0YXRlLmF1dG9EZXN0cm95KSB7CiAgICAgICAgICAgIHZhciB3U3RhdGUgPSBzdHJlYW0uX3dyaXRhYmxlU3RhdGU7CiAgICAgICAgICAgIGlmICghd1N0YXRlIHx8IHdTdGF0ZS5hdXRvRGVzdHJveSAmJiB3U3RhdGUuZmluaXNoZWQpIHsKICAgICAgICAgICAgICBzdHJlYW0uZGVzdHJveSgpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGlmICh0eXBlb2YgU3ltYm9sID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgUmVhZGFibGUuZnJvbSA9IGZ1bmN0aW9uKGl0ZXJhYmxlLCBvcHRzKSB7CiAgICAgICAgICBpZiAoZnJvbSA9PT0gdm9pZCAwKSB7CiAgICAgICAgICAgIGZyb20gPSByZXF1aXJlX2Zyb21fYnJvd3NlcigpOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGZyb20oUmVhZGFibGUsIGl0ZXJhYmxlLCBvcHRzKTsKICAgICAgICB9OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZGV4T2YoeHMsIHgpIHsKICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHhzLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgaWYgKHhzW2ldID09PSB4KQogICAgICAgICAgICByZXR1cm4gaTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIC0xOwogICAgICB9CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9yZWFkYWJsZS1zdHJlYW1AMy42LjIvbm9kZV9tb2R1bGVzL3JlYWRhYmxlLXN0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gZGF0YSkgewogICAgICAgIHZhciB0cyA9IHRoaXMuX3RyYW5zZm9ybVN0YXRlOwogICAgICAgIHRzLnRyYW5zZm9ybWluZyA9IGZhbHNlOwogICAgICAgIHZhciBjYiA9IHRzLndyaXRlY2I7CiAgICAgICAgaWYgKGNiID09PSBudWxsKSB7CiAgICAgICAgICByZXR1cm4gdGhpcy5lbWl0KCJlcnJvciIsIG5ldyBFUlJfTVVMVElQTEVfQ0FMTEJBQ0soKSk7CiAgICAgICAgfQogICAgICAgIHRzLndyaXRlY2h1bmsgPSBudWxsOwogICAgICAgIHRzLndyaXRlY2IgPSBudWxsOwogICAgICAgIGlmIChkYXRhICE9IG51bGwpCiAgICAgICAgICB0aGlzLnB1c2goZGF0YSk7CiAgICAgICAgY2IoZXIpOwogICAgICAgIHZhciBycyA9IHRoaXMuX3JlYWRhYmxlU3RhdGU7CiAgICAgICAgcnMucmVhZGluZyA9IGZhbHNlOwogICAgICAgIGlmIChycy5uZWVkUmVhZGFibGUgfHwgcnMubGVuZ3RoIDwgcnMuaGlnaFdhdGVyTWFyaykgewogICAgICAgICAgdGhpcy5fcmVhZChycy5oaWdoV2F0ZXJNYXJrKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gVHJhbnNmb3JtMihvcHRpb25zKSB7CiAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIFRyYW5zZm9ybTIpKQogICAgICAgICAgcmV0dXJuIG5ldyBUcmFuc2Zvcm0yKG9wdGlvbnMpOwogICAgICAgIER1cGxleC5jYWxsKHRoaXMsIG9wdGlvbnMpOwogICAgICAgIHRoaXMuX3RyYW5zZm9ybVN0YXRlID0gewogICAgICAgICAgYWZ0ZXJUcmFuc2Zvcm06IGFmdGVyVHJhbnNmb3JtLmJpbmQodGhpcyksCiAgICAgICAgICBuZWVkVHJhbnNmb3JtOiBmYWxzZSwKICAgICAgICAgIHRyYW5zZm9ybWluZzogZmFsc2UsCiAgICAgICAgICB3cml0ZWNiOiBudWxsLAogICAgICAgICAgd3JpdGVjaHVuazogbnVsbCwKICAgICAgICAgIHdyaXRlZW5jb2Rpbmc6IG51bGwKICAgICAgICB9OwogICAgICAgIHRoaXMuX3JlYWRhYmxlU3RhdGUubmVlZFJlYWRhYmxlID0gdHJ1ZTsKICAgICAgICB0aGlzLl9yZWFkYWJsZVN0YXRlLnN5bmMgPSBmYWxzZTsKICAgICAgICBpZiAob3B0aW9ucykgewogICAgICAgICAgaWYgKHR5cGVvZiBvcHRpb25zLnRyYW5zZm9ybSA9PT0gImZ1bmN0aW9uIikKICAgICAgICAgICAgdGhpcy5fdHJhbnNmb3JtID0gb3B0aW9ucy50cmFuc2Zvcm07CiAgICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMuZmx1c2ggPT09ICJmdW5jdGlvbiIpCiAgICAgICAgICAgIHRoaXMuX2ZsdXNoID0gb3B0aW9ucy5mbHVzaDsKICAgICAgICB9CiAgICAgICAgdGhpcy5vbigicHJlZmluaXNoIiwgcHJlZmluaXNoKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBwcmVmaW5pc2goKSB7CiAgICAgICAgdmFyIF90aGlzID0gdGhpczsKICAgICAgICBpZiAodHlwZW9mIHRoaXMuX2ZsdXNoID09PSAiZnVuY3Rpb24iICYmICF0aGlzLl9yZWFkYWJsZVN0YXRlLmRlc3Ryb3llZCkgewogICAgICAgICAgdGhpcy5fZmx1c2goZnVuY3Rpb24oZXIsIGRhdGEpIHsKICAgICAgICAgICAgZG9uZShfdGhpcywgZXIsIGRhdGEpOwogICAgICAgICAgfSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGRvbmUodGhpcywgbnVsbCwgbnVsbCk7CiAgICAgICAgfQogICAgICB9CiAgICAgIFRyYW5zZm9ybTIucHJvdG90eXBlLnB1c2ggPSBmdW5jdGlvbihjaHVuaywgZW5jb2RpbmcpIHsKICAgICAgICB0aGlzLl90cmFuc2Zvcm1TdGF0ZS5uZWVkVHJhbnNmb3J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GJhY2sgPSBvbmNlKGNhbGxiYWNrKTsKICAgICAgICB2YXIgY2xvc2VkID0gZmFsc2U7CiAgICAgICAgc3RyZWFtLm9uKCJjbG9zZSIsIGZ1bmN0aW9uKCkgewogICAgICAgICAgY2xvc2VkID0gdHJ1ZTsKICAgICAgICB9KTsKICAgICAgICBpZiAoZW9zID09PSB2b2lkIDApCiAgICAgICAgICBlb3MgPSByZXF1aXJlX2VuZF9vZl9zdHJlYW0oKTsKICAgICAgICBlb3Moc3RyZWFtLCB7CiAgICAgICAgICByZWFkYWJsZTogcmVhZGluZywKICAgICAgICAgIHdyaXRhYmxlOiB3cml0aW5nCiAgICAgICAgfSwgZnVuY3Rpb24oZXJyKSB7CiAgICAgICAgICBpZiAoZXJyKQogICAgICAgICAgICByZXR1cm4gY2FsbGJhY2soZXJyKTsKICAgICAgICAgIGNsb3NlZCA9IHRydWU7CiAgICAgICAgICBjYWxsYmFjaygpOwogICAgICAgIH0pOwogICAgICAgIHZhciBkZXN0cm95ZWQgPSBmYWxzZTsKICAgICAgICByZXR1cm4gZnVuY3Rpb24oZXJyKSB7CiAgICAgICAgICBpZiAoY2xvc2VkKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICBpZiAoZGVzdHJveWVkKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICBkZXN0cm95ZWQgPSB0cnVlOwogICAgICAgICAgaWYgKGlzUmVxdWVzdChzdHJlYW0pKQogICAgICAgICAgICByZXR1cm4gc3RyZWFtLmFib3J0KCk7CiAgICAgICAgICBpZiAodHlwZW9mIHN0cmVhbS5kZXN0cm95ID09PSAiZnVuY3Rpb24iKQogICAgICAgICAgICByZXR1cm4gc3RyZWFtLmRlc3Ryb3koKTsKICAgICAgICAgIGNhbGxiYWNrKGVyciB8fCBuZXcgRVJSX1NUUkVBTV9ERVNUUk9ZRUQoInBpcGUiKSk7CiAgICAgICAgfTsKICAgICAgfQogICAgICBmdW5jdGlvbiBjYWxsKGZuKSB7CiAgICAgICAgZm4oKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBwaXBlKGZyb20sIHRvKSB7CiAgICAgICAgcmV0dXJuIGZyb20ucGlwZSh0byk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcG9wQ2FsbGJhY2soc3RyZWFtcykgewogICAgICAgIGlmICghc3RyZWFtcy5sZW5ndGgpCiAgICAgICAgICByZXR1cm4gbm9vcDsKICAgICAgICBpZiAodHlwZW9mIHN0cmVhbXNbc3RyZWFtcy5sZW5ndGggLSAxXSAhPT0gImZ1bmN0aW9uIikKICAgICAgICAgIHJldHVybiBub29wOwogICAgICAgIHJldHVybiBzdHJlYW1zLnBvcCgpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHBpcGVsaW5lKCkgewogICAgICAgIGZvciAodmFyIF9sZW4gPSBhcmd1bWVudHMubGVuZ3RoLCBzdHJlYW1zID0gbmV3IEFycmF5KF9sZW4pLCBfa2V5ID0gMDsgX2tleSA8IF9sZW47IF9rZXkrKykgewogICAgICAgICAgc3RyZWFtc1tfa2V5XSA9IGFyZ3VtZW50c1tfa2V5XTsKICAgICAgICB9CiAgICAgICAgdmFyIGNhbGxiYWNrID0gcG9wQ2FsbGJhY2soc3RyZWFtcyk7CiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoc3RyZWFtc1swXSkpCiAgICAgICAgICBzdHJlYW1zID0gc3RyZWFtc1swXTsKICAgICAgICBpZiAoc3RyZWFtcy5sZW5ndGggPCAyKSB7CiAgICAgICAgICB0aHJvdyBuZXcgRVJSX01JU1NJTkdfQVJHUygic3RyZWFtcyIpOwogICAgICAgIH0KICAgICAgICB2YXIgZXJyb3I7CiAgICAgICAgdmFyIGRlc3Ryb3lzID0gc3RyZWFtcy5tYXAoZnVuY3Rpb24oc3RyZWFtLCBpKSB7CiAgICAgICAgICB2YXIgcmVhZGluZyA9IGkgPCBzdHJlYW1zLmxlbmd0aCAtIDE7CiAgICAgICAgICB2YXIgd3JpdGluZyA9IGkgPiAwOwogIC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S5yZXN1bWUoKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZGVzdC5vbigiZHJhaW4iLCBvbmRyYWluKTsKICAgICAgICBpZiAoIWRlc3QuX2lzU3RkaW8gJiYgKCFvcHRpb25zIHx8IG9wdGlvbnMuZW5kICE9PSBmYWxzZSkpIHsKICAgICAgICAgIHNvdXJjZS5vbigiZW5kIiwgb25lbmQpOwogICAgICAgICAgc291cmNlLm9uKCJjbG9zZSIsIG9uY2xvc2UpOwogICAgICAgIH0KICAgICAgICB2YXIgZGlkT25FbmQgPSBmYWxzZTsKICAgICAgICBmdW5jdGlvbiBvbmVuZCgpIHsKICAgICAgICAgIGlmIChkaWRPbkVuZCkKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgZGlkT25FbmQgPSB0cnVlOwogICAgICAgICAgZGVzdC5lbmQoKTsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gb25jbG9zZSgpIHsKICAgICAgICAgIGlmIChkaWRPbkVuZCkKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgZGlkT25FbmQgPSB0cnVlOwogICAgICAgICAgaWYgKHR5cGVvZiBkZXN0LmRlc3Ryb3kgPT09ICJmdW5jdGlvbiIpCiAgICAgICAgICAgIGRlc3QuZGVzdHJveSgpOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBvbmVycm9yKGVyKSB7CiAgICAgICAgICBjbGVhbnVwKCk7CiAgICAgICAgICBpZiAoRUUubGlzdGVuZXJDb3VudCh0aGlzLCAiZXJyb3IiKSA9PT0gMCkgewogICAgICAgICAgICB0aHJvdyBlcjsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgc291cmNlLm9uKCJlcnJvciIsIG9uZXJyb3IpOwogICAgICAgIGRlc3Qub24oImVycm9yIiwgb25lcnJvcik7CiAgICAgICAgZnVuY3Rpb24gY2xlYW51cCgpIHsKICAgICAgICAgIHNvdXJjZS5yZW1vdmVMaXN0ZW5lcigiZGF0YSIsIG9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XJyb3IiLAogICAgICAgICAgICBtZXNzYWdlOiBlcnJvci5tZXNzYWdlLAogICAgICAgICAgICBuYW1lOiBlcnJvci5uYW1lLAogICAgICAgICAgICBzdGFjazogZXJyb3Iuc3RhY2sKICAgICAgICAgIH07CiAgICAgICAgfQogICAgICB9OwogICAgICB2YXIgaXNTZXJpYWxpemVkRXJyb3IgPSAodGhpbmcpID0+IHRoaW5nICYmIHR5cGVvZiB0aGluZyA9PT0gIm9iamVjdCIgJiYgIl9fZXJyb3JfbWFya2VyIiBpbiB0aGluZyAmJiB0aGluZy5fX2Vycm9yX21hcmtlciA9PT0gIiQkZXJyb3IiOwogICAgICBleHBvcnRzMi5EZWZhdWx0U2VyaWFsaXplciA9IHsKICAgICAgICBkZXNlcmlhbGl6ZShtZXNzYWdlKSB7CiAgICAgICAgICBpZiAoaXNTZXJpYWxpemVkRXJyb3IobWVzc2FnZSkpIHsKICAgICAgICAgICAgcmV0dXJuIERlZmF1bHRFcnJvclNlcmlhbGl6ZXIuZGVzZXJpYWxpemUobWVzc2FnZSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gbWVzc2FnZTsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIHNlcmlhbGl6ZShpbnB1dCkgewogICAgICAgICAgaWYgKGlucHV0IGluc3RhbmNlb2YgRXJyb3IpIHsKICAgICAgICAgICAgcmV0dXJuIERlZmF1bHRFcnJvclNlcmlhbGl6ZXIuc2VyaWFsaXplKGlucHV0KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHJldHVybiBpbnB1dDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS90aHJlYWRzQDEuNy4wL25vZGVfbW9kdWxlcy90aHJlYWRzL2Rpc3QvY29tbW9uLmpzCiAgdmFyIHJlcXVpcmVfY29tbW9uMiA9IF9fY29tbW9uSlMoewogICAgIm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lc29sdmUsIHJlamVjdCkgewogICAgICAgICAgZnVuY3Rpb24gZnVsZmlsbGVkKHZhbHVlKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgcmVqZWN0KGUpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgIHN0ZXAoZ2VuZXJhdG9yWyJ0aHJvdyJdKHZhbHVlKSk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICByZWplY3QoZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGZ1bmN0aW9uIHN0ZXAocmVzdWx0KSB7CiAgICAgICAgICAgIHJlc3VsdC5kb25lID8gcmVzb2x2ZShyZXN1bHQudmFsdWUpIDogYWRvcHQocmVzdWx0LnZhbHVlKS50aGVuKGZ1bGZpbGxlZCwgcmVqZWN0ZWQpOwogICAgICAgICAgfQogICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOwogICAgICAgIH0pOwogICAgICB9OwogICAgICB2YXIgX19pbXBvcnREZWZhdWx0ID0gZXhwb3J0czIgJiYgZXhwb3J0czIuX19pbXBvcnREZWZhdWx0IHx8IGZ1bmN0aW9uKG1vZCkgewogICAgICAgIHJldHVybiBtb2QgJiYgbW9kLl9fZXNNb2R1bGUgPyBtb2QgOiB7ICJkZWZhdWx0IjogbW9kIH07CiAgICAgIH07CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShleHBvcnRzMiwgIl9fZXNNb2R1bGUiLCB7IHZhbHVlOiB0cnVlIH0pOwogICA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gICAgIGNvbnN0IGluaXRNZXNzYWdlID0gewogICAgICAgICAgdHlwZTogbWVzc2FnZXNfMS5Xb3JrZXJNZXNzYWdlVHlwZS5pbml0LAogICAgICAgICAgZXhwb3NlZDogewogICAgICAgICAgICB0eXBlOiAiZnVuY3Rpb24iCiAgICAgICAgICB9CiAgICAgICAgfTsKICAgICAgICBpbXBsZW1lbnRhdGlvbl8xLmRlZmF1bHQucG9zdE1lc3NhZ2VUb01hc3Rlcihpbml0TWVzc2FnZSk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcG9zdE1vZHVsZUluaXRNZXNzYWdlKG1ldGhvZE5hbWVzKSB7CiAgICAgICAgY29uc3QgaW5pdE1lc3NhZ2UgPSB7CiAgICAgICAgICB0eXBlOiBtZXNzYWdlc18xLldvcmtlck1lc3NhZ2VUeXBlLmluaXQsCiAgICAgICAgICBleHBvc2VkOiB7CiAgICAgICAgICAgIHR5cGU6ICJtb2R1bGUiLAogICAgICAgICAgICBtZXRob2RzOiBtZXRob2ROYW1lcwogICAgICAgICAgfQogICAgICAgIH07CiAgICAgICAgaW1wbGVtZW50YXRpb25fMS5kZWZhdWx0LnBvc3RNZXNzYWdlVG9NYXN0ZXIoaW5pdE1lc3NhZ2UpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHBvc3RKb2JFcnJvck1lc3NhZ2UodWlkLCByYXdFcnJvcikgewogICAgICAgIGNvbnN0IHsgcGF5bG9hZDogZXJyb3IsIHRyYW5zZmVyYWJsZXMgfSA9IGRlY29uc3RydWN0VHJhbnNmZXIocmF3RXJyb3IpOwogICAgICAgIGNvbnN0IGVycm9yTWVzc2FnZSA9IHsKICAgICAgICAgIHR5cGU6IG1lc3NhZ2VzXzEuV29ya2VyTWVzc2FnZVR5cGUuZXJyb3IsCiAgICAgICAgICB1aWQsCiAgICAgICAgICBlcnJvcjogY29tbW9uXzEuc2VyaWFsaXplKGVycm9yKQogICAgICAgIH07CiAgICAgICAgaW1wbGVtZW50YXRpb25f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NzYWdlKGpvYlVJRCwgcmVzdWx0VHlwZSk7CiAgICAgICAgICBpZiAoaXNPYnNlcnZhYmxlKHN5bmNSZXN1bHQpKSB7CiAgICAgICAgICAgIGNvbnN0IHN1YnNjcmlwdGlvbiA9IHN5bmNSZXN1bHQuc3Vic2NyaWJlKCh2YWx1ZSkgPT4gcG9zdEpvYlJlc3VsdE1lc3NhZ2Uoam9iVUlELCBmYWxzZSwgY29tbW9uXzEuc2VyaWFsaXplKHZhbHVlKSksIChlcnJvcikgPT4gewogICAgICAgICAgICAgIHBvc3RKb2JFcnJvck1lc3NhZ2Uoam9iVUlELCBjb21tb25fMS5zZXJpYWxpemUoZXJyb3IpKTsKICAgICAgICAgICAgICBhY3RpdmVTdWJzY3JpcHRpb25zLmRlbGV0ZShqb2JVSUQpOwogICAgICAgICAgICB9LCAoKSA9PiB7CiAgICAgICAgICAgICAgcG9zdEpvYlJlc3VsdE1lc3NhZ2Uoam9iVUlELCB0cnVlKTsKICAgICAgICAgICAgICBhY3RpdmVTdWJzY3JpcHRpb25zLmRlbGV0ZShqb2JVSUQpOwogICAgICAgICAgICB9KTsKICAgICAgICAgICAgYWN0aXZlU3Vic2NyaXB0aW9ucy5zZXQoam9iVUlELCBzdWJzY3JpcHRpb24pOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBjb25zdCByZXN1bHQgPSB5aWVsZCBzeW5jUmVzdWx0OwogICAgICAgICAgICAgIHBvc3RKb2JSZXN1bHRNZXNzYWdlKGpvYlVJRCwgdHJ1ZSwgY29tbW9uXzEuc2VyaWFsaXplKHJlc3VsdCkpOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgIHBvc3RKb2JFcnJvck1lc3NhZ2Uoam9iVUlELCBjb21tb25fMS5zZXJpYWxpemUoZXJyb3IpKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0pOwogICAgICB9CiAgICAgIGZ1b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AgIC4uLmluaXQyLAogICAgICAgICAgICBjYWNoZTogInJlbG9hZCIKICAgICAgICAgIH0pOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB0aHJvdyBlOwogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gcmVzcG9uc2U7CiAgICB9CiAgICBhc3luYyByZWFkKGJ1ZmZlciwgb2Zmc2V0ID0gMCwgbGVuZ3RoLCBwb3NpdGlvbiA9IDAsIG9wdHMgPSB7fSkgewogICAgICBjb25zdCB7IGhlYWRlcnMgPSB7fSwgc2lnbmFsLCBvdmVycmlkZXMgPSB7fSB9ID0gb3B0czsKICAgICAgaWYgKGxlbmd0aCA8IEluZmluaXR5KSB7CiAgICAgICAgaGVhZGVycy5yYW5nZSA9IGBieXRlcz0ke3Bvc2l0aW9ufS0ke3Bvc2l0aW9uICsgbGVuZ3RofWA7CiAgICAgIH0gZWxzZSBpZiAobGVuZ3RoID09PSBJbmZpbml0eSAmJiBwb3NpdGlvbiAhPT0gMCkgewogICAgICAgIGhlYWRlcnMucmFuZ2UgPSBgYnl0ZXM9JHtwb3NpdGlvbn0tYDsKICAgICAgfQogICAgICBjb25zdCBhcmdzID0gewogICAgICAgIC4uLnRoaXMuYmFzZU92ZXJyaWRlcywKICAgICAgICAuLi5vdmVycmlkZXMsCiAgICAgICAgaGVhZGVyczogewogICAgICAgICAgLi4uaGVhZGVycywKICAgICAgICAgIC4uLm92ZXJyaWRlcy5oZWFkZXJzLAogICAgICAgICAgLi4udGhpcy5iYXNlT3ZlcnJpZGVzLmhlYWRlcnMKICAgICAgICB9LAogICAgICAgIG1ldGhvZDogIkdFVCIsCiAgICAgICAgcmVkaXJlY3Q6ICJmb2xsb3ciLAogICAgICAgIG1vZGU6ICJjb3JzIiwKICAgICAgICBzaWduYWwKICAgICAgfTsKICAgICAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCB0aGlzLmZldGNoKHRoaXMudXJsLCBhcmdzKTsKICAgICAgaWYgKCFyZXNwb25zZ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2h1bmspIHsKICAgIHRyeSB7CiAgICAgIGxldCBzdHJtOwogICAgICBjb25zdCB7IG1pbnYsIG1heHYgfSA9IGNodW5rOwogICAgICBsZXQgY3BvcyA9IG1pbnYuYmxvY2tQb3NpdGlvbjsKICAgICAgbGV0IGRwb3MgPSBtaW52LmRhdGFQb3NpdGlvbjsKICAgICAgY29uc3QgY2h1bmtzID0gW107CiAgICAgIGNvbnN0IGNwb3NpdGlvbnMgPSBbXTsKICAgICAgY29uc3QgZHBvc2l0aW9ucyA9IFtdOwogICAgICBsZXQgdG90YWxTaXplID0gMDsKICAgICAgbGV0IGkgPSAwOwogICAgICBkbyB7CiAgICAgICAgY29uc3QgcmVtYWluaW5nSW5wdXQgPSBpbnB1dERhdGEuc3ViYXJyYXkoY3BvcyAtIG1pbnYuYmxvY2tQb3NpdGlvbik7CiAgICAgICAgY29uc3QgaW5mbGF0b3IgPSBuZXcgaW1wb3J0X3Bha28uSW5mbGF0ZSgpOwogICAgICAgICh7IHN0cm0gfSA9IGluZmxhdG9yKTsKICAgICAgICBpbmZsYXRvci5wdXNoKHJlbWFpbmluZ0lucHV0LCBpbXBvcnRfcGFrby5aX1NZTkNfRkxVU0gpOwogICAgICAgIGlmIChpbmZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcihpbmZsYXRvci5tc2cpOwogICAgICAgIH0KICAgICAgICBjb25zdCBidWZmZXIyID0gaW5mbGF0b3IucmVzdWx0OwogICAgICAgIGNodW5rcy5wdXNoKGJ1ZmZlcjIpOwogICAgICAgIGxldCBsZW4gPSBidWZmZXIyLmxlbmd0aDsKICAgICAgICBjcG9zaXRpb25zLnB1c2goY3Bvcyk7CiAgICAgICAgZHBvc2l0aW9ucy5wdXNoKGRwb3MpOwogICAgICAgIGlmIChjaHVua3MubGVuZ3RoID09PSAxICYmIG1pbnYuZGF0YVBvc2l0aW9uKSB7CiAgICAgICAgICBjaHVua3NbMF0gPSBjaHVua3NbMF0uc3ViYXJyYX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ydFNpZ25hbChzaWduYWwpIHsKICAgIGlmICghc2lnbmFsKSB7CiAgICAgIHJldHVybjsKICAgIH0KICAgIGlmIChzaWduYWwuYWJvcnRlZCkgewogICAgICBpZiAodHlwZW9mIERPTUV4Y2VwdGlvbiAhPT0gInVuZGVmaW5lZCIpIHsKICAgICAgICB0aHJvdyBuZXcgRE9NRXhjZXB0aW9uKCJhYm9ydGVkIiwgIkFib3J0RXJyb3IiKTsKICAgICAgfSBlbHNlIHsKICAgICAgICBjb25zdCBlID0gbmV3IEFib3J0RXJyb3IoImFib3J0ZWQiKTsKICAgICAgICBlLmNvZGUgPSAiRVJSX0FCT1JURUQiOwogICAgICAgIHRocm93IGU7CiAgICAgIH0KICAgIH0KICB9CiAgZnVuY3Rpb24gY2FuTWVyZ2VCbG9ja3MoY2h1bmsxLCBjaHVuazIpIHsKICAgIHJldHVybiBjaHVuazIubWludi5ibG9ja1Bvc2l0aW9uIC0gY2h1bmsxLm1heHYuYmxvY2tQb3NpdGlvbiA8IDY1ZTMgJiYgY2h1bmsyLm1heHYuYmxvY2tQb3NpdGlvbiAtIGNodW5rMS5taW52LmJsb2NrUG9zaXRpb24gPCA1ZTY7CiAgfQogIGZ1bmN0aW9uIG9wdGltaXplQ2h1bmtzKGNodW5rcywgbG93ZXN0KSB7CiAgICBjb25zdCBtZXJnZWRDaHVua3MgPSBbXTsKICAgIGxldCBsYXN0Q2h1bmsgPSBudWxsOwogICAgaWYgKGNodW5rcy5sZW5ndGggPT09IDApIHsKICAgICAgcmV0dXJuIGNodW5rczsKICAgIH0KICAgIGNodW5rcy5zb3J0KGZ1bmN0aW9uKGMwLCBjMSkgewogICAgICBjb25zdCBkaWYgPSBjMC5taW52LmJsb2NrUG9zaXRpb24gLSBjMS5taW52LmJsb2NrUG9zaXRpb247CiAgICAgIGlmIChkaWYgIT09IDApIHsKICAgICAgICByZXR1cm4gZGlmOwogICAgICB9IGVsc2UgewogICAgICAgIHJldHVybiBjMC5taW52LmRhdGFQb3NpdGlvbiAtIGMxLm1pbnYuZGF0YVBvc2l0aW9uOwogICAgICB9CiAgICB9KTsKICAgIGNodW5rcy5mb3JFYWNoKChjaHVuaykgPT4gewogICAgICBpZiAoIWxvd2VzdCB8fCBjaHVuay5tYXh2LmNvbXBhcmVUbyhsb3dlc3QpID4gMCkgewogICAgICAgIGlmIChsYXN0Q2h1bmsgPT09IG51bGwpIHsKICAgICAgICAgIG1lcmdlZENodW5rcy5wdXNoKGNodW5rKTsKICAgICAgICAgIGxhc3RDaHVuayA9IGNodW5rOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAoY2FuTWVyZ2VCbG9ja3MobGFzdENodW5rLCBjaHVuaykpIHsKICAgICAgICAgICAgaWYgKGNodW5rLm1heHYuY29tcGFyZVRvKGxhc3RDaHVuay5tYXh2KSA+IDApIHsKICAgICAgICAgICAgICBsYXN0Q2h1bmsubWF4diA9IGNodW5rLm1heHY7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIG1lcmdlZENodW5rcy5wdXNoKGNodW5rKTsKICAgICAgICAgICAgbGFzdENodW5rID0gY2h1bms7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9KTsKICAgIHJldHVybiBtZXJnZWRDaHVua3M7CiAgfQoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vQGdtb2QrdGFiaXhAMS41LjExL25vZGVfbW9kdWxlcy9AZ21vZC90YWJpeC9lc20vdGJpLmpzCiAgaW5pdF9idWZmZXJfc2hpbSgpOwogIHZhciBpbXBvcnRfbG9uZzIgPSBfX3RvTW9kdWxlKHJlcXVpcmVfbG9uZygpKTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL0BnbW9kK3RhYml4QDEuNS4xMS9ub2RlX21vZHVsZXMvQGdtb2QvdGFiaXgvZXNtL3ZpcnR1YWxPZmZzZXQuanMKICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgdmFyIFZpcnR1YWx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hcnNlUCkgewogICAgICAgIHRoaXMucGFyc2VQID0gdGhpcy5fcGFyc2Uob3B0cykuY2F0Y2goKGUpID0+IHsKICAgICAgICAgIHRoaXMucGFyc2VQID0gdm9pZCAwOwogICAgICAgICAgdGhyb3cgZTsKICAgICAgICB9KTsKICAgICAgfQogICAgICByZXR1cm4gdGhpcy5wYXJzZVA7CiAgICB9CiAgICBhc3luYyBoYXNSZWZTZXEoc2VxSWQsIG9wdHMgPSB7fSkgewogICAgICByZXR1cm4gISEoKGF3YWl0IHRoaXMucGFyc2Uob3B0cykpLmluZGljZXNbc2VxSWRdIHx8IHt9KS5iaW5JbmRleDsKICAgIH0KICB9OwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vQGdtb2QrdGFiaXhAMS41LjExL25vZGVfbW9kdWxlcy9AZ21vZC90YWJpeC9lc20vdGJpLmpzCiAgdmFyIFRCSV9NQUdJQyA9IDIxNTc4MzI0OwogIHZhciBUQURfTElEWF9TSElGVCA9IDE0OwogIGZ1bmN0aW9uIHJlZzJiaW5zKGJlZywgZW5kKSB7CiAgICBiZWcgKz0gMTsKICAgIGVuZCAtPSAxOwogICAgcmV0dXJuIFsKICAgICAgWzAsIDBdLAogICAgICBbMSArIChiZWcgPj4gMjYpLCAxICsgKGVuZCA+PiAyNildLAogICAgICBbOSArIChiZWcgPj4gMjMpLCA5ICsgKGVuZCA+PiAyMyldLAogICAgICBbNzMgKyAoYmVnID4+IDIwKSwgNzMgKyAoZW5kID4+IDIwKV0sCiAgICAgIFs1ODUgKyAoYmVnID4+IDE3KSwgNTg1ICsgKGVuZCA+PiAxNyldLAogICAgICBbNDY4MSArIChiZWcgPj4gMTQpLCA0NjgxICsgKGVuZCA+PiAxNCldCiAgICBdOwogIH0KICB2YXIgVGFiaXhJbmRleCA9IGNsYXNzIGV4dGVuZHMgSW5kZXhGaWxlIHsKICAgIGFzeW5jIGxpbmVDb3VudChyZWZOYW1lLCBvcHRzID0ge30pIHsKICAgICAgY29uc3QgaW5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IGNodW5rQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgICAgICBjb25zdCBjaHVua3MgPSBuZXcgQXJyYXkoY2h1bmtDb3VudCk7CiAgICAgICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgY2h1bmtDb3VudDsgayArPSAxKSB7CiAgICAgICAgICAgICAgY29uc3QgdSA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCk7CiAgICAgICAgICAgICAgY29uc3QgdiA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCArIDgpOwogICAgICAgICAgICAgIGN1cnJPZmZzZXQgKz0gMTY7CiAgICAgICAgICAgICAgZmlyc3REYXRhTGluZSA9IHRoaXMuX2ZpbmRGaXJzdERhdGEoZmlyc3REYXRhTGluZSwgdSk7CiAgICAgICAgICAgICAgY2h1bmtzW2tdID0gbmV3IENodW5rKHUsIHYsIGJpbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYmluSW5kZXhbYmluXSA9IGNodW5rczsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgY29uc3QgbGluZWFyQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICBjdXJyT2Zmc2V0ICs9IDQ7CiAgICAgICAgY29uc3QgbGluZWFySW5kZXggPSBuZXcgQXJyYXkobGluZWFyQ291bnQpOwogICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgbGluZWFyQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgbGluZWFySW5kZXhba10gPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQpOwogICAgICAgICAgY3Vyck9mZnNldCArPSA4OwogICAgICAgICAgZmlyc3REYXRhTGluZSA9IHRoaXMuX2ZpbmRGaXJzdERhdGEoZmlyc3REYXRhTGluZSwgbGluZWFySW5kZXhba10pOwogICAgICAgIH0KICAgICAgICByZXR1cm4geyBiaW5JbmRleCwgbGluZWFySW5kZXgsIHN0YXRzIH07CiAgICAgIH0pOwogICAgICByZXR1cm4gewogICAgICAgIGluZGljZXMsCiAgICAgICAgbWV0YUNoYXIsCiAgICAgICAgbWF4QmluTnVtYmVyLAogICAgICAgIG1heFJlZkxlbmd0aCwKICAgICAgICBza2lwTGluZXMsCiAgICAgICAgZmlyc3REYXRhTGluZSwKICAgICAgICBjb2x1bW5OdW1iZXJzLAogICAgICAgIGNvb3JkaW5hdGVUeXBlLAogICAgICAgIGZvcm1hdCwKICAgICAgICByZWZJZFRvTmFtZSwKICAgICAgICByZWZOYW1lVG9JZCwKICAgICAgICBtYXhCbG9ja1NpemU6IDEgPDwgMTYKICAgICAgfTsKICAgIH0KICAgIHBhcnNlUHNldWRvQmluKGJ5dGVzLCBvZmZzZXQpIHsKICAgICAgY29uc3QgbGluZUNvdW50ID0gbG9uZ1RvTnVtYmVyKGltcG9ydF9sb25nMi5kZWZhdWx0LmZyb21CeXRlc0xFKGJ5dGVzLnNsaWNlKG9mZnNldCArIDE2LCBvZmZzZXQgKyAyNCksIHRydWUpKTsKICAgICAgcmV0dXJuIHsgbGluZUNvdW50IH07CiAgICB9CiAgICBfcGFyc2VOYW1lQnl0ZXMobmFtZXNCeXRlcykgewogICAgICBsZXQgY3VyclJlZklkID0gMDsKICAgICAgbGV0IGN1cnJOYW1lU3RhcnQgPSAwOwogICAgICBjb25zdCByZWZJZFRvTmFtZSA9IFtdOwogICAgICBjb25zdCByZWZOYW1lVG9JZCA9IHt9OwogICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG5hbWVzQnl0ZXMubGVuZ3RoOyBpICs9IDEpIHsKICAgICAgICBpZiAoIW5hbWVzQnl0ZXNbaV0pIHsKICAgICAgICAgIGlmIChjdXJyTmFtZVN0YXJ0IDwgaSkgewogICAgICAgICAgICBsZXQgcmVmTmFtZSA9IG5hbWVzQnl0ZXMudG9TdHJpbmcoInV0ZjgiLCBjdXJyTmFtZVN0YXJ0LCBpKTsKICAgICAgICAgICAgcmVmTmFtZSA9IHRoaXMucmVuYW1lUmVmU2VxKHJlZk5hbWUpOwogICAgICAgICAgICByZWZJZFRvTmFtZVtjdXJyUmVmSWRdID0gcmVmTmFtZTsKICAgICAgICAgICAgcmVmTmFtZVRvSWRbcmVmTmFtZV0gPSBjdXJyUmVmSWQ7CiAgICAgICAgICB9CiAgICAgICAgICBjdXJyTmFtZVN0YXJ0ID0gaSArIDE7CiAgICAgICAgICBjdXJyUmVmSWQgKz0gMTsKICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIHsgcmVmTmFtZVRvSWQsIHJlZklkVG9OYW1lIH07CiAgICB9CiAgICBhc3luYyBibG9ja3NGb3JSYW5nZShyZWZOYW1lLCBtaW4sIG1heCwgb3B0cyA9IHt9KSB7CiAgICAgIGlmIChtaW4gPCAwKSB7CiAgICAgICAgbWluID0gMDsKICAgICAgfQogICAgICBjb25zdCBpbmRleERhdGEgPSBhd2FpdCB0aGlzLnBhcnNlKG9wdHMpOwogICAgICBpZiAoIWluZGV4RGF0YSkgewogICAgICAgIHJldHVybiBbXTsKICAgICAgfQogICAgICBjb25zdCByZWZJZCA9IGluZGV4RGF0YS5yZWZOYW1lVG9JZFtyZWZOYW1lXTsKICAgICAgY29uc3QgYmEgPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmICghYmEpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3QgbWluT2Zmc2V0ID0gYmEubGluZWFySW5kZXgubGVuZ3RoID8gYmEubGluZWFySW5kZXhbbWluID4+IFRBRF9MSURYX1NISUZUID49IGJhLmxpbmVhckluZGV4Lmxlbmd0aCA/IGJhLmxpbmVhckluZGV4Lmxlbmd0aCAtIDEgOiBtaW4gPj4gVEFEX0xJRFhfU0hJRlRdIDogbmV3IFZpcnR1YWxPZmZzZXQoMCwgMCk7CiAgICAgIGlmICghbWluT2Zmc2V0KSB7CiAgICAgICAgY29uc29sZS53YXJuKCJxdWVyeWluZyBvdXRzaWRlIG9mIHBvc3NpYmxlIHRhYml4IHJhbmdlIik7CiAgICAgIH0KICAgICAgY29uc3Qgb3ZlcmxhcHBpbmdCaW5zID0gcmVnMmJpbnMobWluLCBtYXgpOwogICAgICBjb25zdCBjaHVua3MgPSBbXTsKICAgICAgZm9yIChjb25zdCBbc3RhcnQsIGVuZF0gb2Ygb3ZlcmxhcHBpbmdCaW5zKSB7CiAgICAgICAgZm9yIChsZXQgYmluID0gc3RhcnQ7IGJpbiA8PSBlbmQ7IGJpbisrKSB7CiAgICAgICAgICBpZiAoYmEuYmluSW5kZXhbYmluXSkgewogICAgICAgICAgICBjb25zdCBiaW5DaHVua3MgPSBiYS5iaW5JbmRleFtiaW5dOwogICAgICAgICAgICBmb3IgKGxldCBjID0gMDsgYyA8IGJpbkNodW5rcy5sZW5ndGg7ICsrYykgewogICAgICAgICAgICAgIGNodW5rcy5wdXNoKG5ldyBDaHVuayhiaW5DaHVua3NbY10ubWludiwgYmluQ2h1bmtzW2NdLm1heHYsIGJpbikpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGNvbnN0IG5pbnR2ID0gYmEubGluZWFySW5kZXgubGVuZ3RoOwogICAgICBsZXQgbG93ZXN0ID0gbnVsbDsKICAgICAgY29uc3QgbWluTGluID0gTWF0aC5taW4obWluID4+IDE0LCBuaW50diAtIDEpOwogICAgICBjb25zdCBtYXhMaW4gPSBNYXRoLm1pbihtYXggPj4gMTQsIG5pbnR2IC0gMSk7CiAgICAgIGZvciAobGV0IGkgPSBtaW5MaW47IGkgPD0gbWF4TGluOyArK2kpIHsKICAgICAgICBjb25zdCB2cCA9IGJhLmxpbmVhckluZGV4W2ldOwogICAgICAgIGlmICh2cCkgewogICAgICAgICAgaWYgKCFsb3dlc3QgfHwgdnAuY29tcGFyZVRvKGxvd2VzdCkgPCAwKSB7CiAgICAgICAgIC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AodGhpcy5taW5TaGlmdCArIHRoaXMuZGVwdGggKiAzKTsKICAgICAgY29uc3QgYXV4TGVuZ3RoID0gYnl0ZXMucmVhZEludDMyTEUoMTIpOwogICAgICBjb25zdCBhdXggPSBhdXhMZW5ndGggJiYgYXV4TGVuZ3RoID49IDMwID8gdGhpcy5wYXJzZUF1eERhdGEoYnl0ZXMsIDE2KSA6IHsKICAgICAgICByZWZJZFRvTmFtZTogW10sCiAgICAgICAgcmVmTmFtZVRvSWQ6IHt9LAogICAgICAgIG1ldGFDaGFyOiBudWxsLAogICAgICAgIGNvbHVtbk51bWJlcnM6IHsgcmVmOiAwLCBzdGFydDogMSwgZW5kOiAyIH0sCiAgICAgICAgY29vcmRpbmF0ZVR5cGU6ICJ6ZXJvLWJhc2VkLWhhbGYtb3BlbiIsCiAgICAgICAgZm9ybWF0OiAiZ2VuZXJpYyIKICAgICAgfTsKICAgICAgY29uc3QgcmVmQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRSgxNiArIGF1eExlbmd0aCk7CiAgICAgIGxldCBmaXJzdERhdGFMaW5lOwogICAgICBsZXQgY3Vyck9mZnNldCA9IDE2ICsgYXV4TGVuZ3RoICsgNDsKICAgICAgY29uc3QgaW5kaWNlcyA9IG5ldyBBcnJheShyZWZDb3VudCkuZmlsbCgwKS5tYXAoKCkgPT4gewogICAgICAgIGNvbnN0IGJpbkNvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCk7CiAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgIGNvbnN0IGJpbkluZGV4ID0ge307CiAgICAgICAgbGV0IHN0YXRzOwogICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgYmluQ291bnQ7IGogKz0gMSkgewogICAgICAgICAgY29uc3QgYmluID0gYnl0ZXMucmVhZFVJbnQzMkxFKGN1cnJPZmZzZXQpOwogICAgICAgICAgaWYgKGJpbiA+IHRoaXMubWF4QmluTnVtYmVyKSB7CiAgICAgICAgICAgIHN0YXRzID0gdGhpcy5wYXJzZVBzZXVkb0JpbihieXRlcywgY3Vyck9mZnNldCArIDQpOwogICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDQgKyA4ICsgNCArIDE2ICsgMTY7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjb25zdCBsb2Zmc2V0ID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0ICsgNCk7CiAgICAgICAgICAgIGZpcnN0RGF0YUxpbmUgPSB0aGlzLl9maW5kRmlyc3REYXRhKGZpcnN0RGF0YUxpbmUsIGxvZmZzZXQpOwogICAgICAgICAgICBjb25zdCBjaHVua0NvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCArIDEyKTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNjsKICAgICAgICAgICAgY29uc3QgY2h1bmtzID0gbmV3IEFycmF5KGNodW5rQ291bnQpOwogICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGNodW5rQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgICAgIGNvbnN0IHUgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQpOwogICAgICAgICAgICAgIGNvbnN0IHYgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQgKyA4KTsKICAgICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDE2OwogICAgICAgICAgICAgIGNodW5rc1trXSA9IG5ldyBDaHVuayh1LCB2LCBiaW4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGJpbkluZGV4W2Jpbl0gPSBjaHVua3M7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiB7IGJpbkluZGV4LCBzdGF0cyB9OwogICAgICB9KTsKICAgICAgcmV0dXJuIHsKICAgICAgICAuLi5hdXgsCiAgICAgICAgY3NpOiB0cnVlLAogICAgICAgIHJlZkNvdW50LAogICAgICAgIG1heEJsb2NrU2l6ZTogMSA8PCAxNiwKICAgICAgICBmaXJzdERhdGFMaW5lLAogICAgICAgIGNzaVZlcnNpb24sCiAgICAgICAgaW5kaWNlcywKICAgICAgICBkZXB0aDogdGhpcy5kZXB0aCwKICAgICAgICBtYXhCaW5OdW1iZXI6IHRoaXMubWF4QmluTnVtYmVyLAogICAgICAgIG1heFJlZkxlbmd0aAogICAgICB9OwogICAgfQogICAgcGFyc2VQc2V1ZG9CaW4oYnl0ZXMsIG9mZnNldCkgewogICAgICBjb25zdCBsaW5lQ291bnQgPSBsb25nVG9OdW1iZXIoaW1wb3J0X2xvbmczLmRlZmF1bHQuZnJvbUJ5dGVzTEUoYnl0ZXMuc2xpY2Uob2Zmc2V0ICsgMjgsIG9mZnNldCArIDM2KSwgdHJ1ZSkpOwogICAgICByZXR1cm4geyBsaW5lQ291bnQgfTsKICAgIH0KICAgIGFzeW5jIGJsb2Nrc0ZvclJhbmdlKHJlZk5hbWUsIG1pbiwgbWF4LCBvcHRzID0ge30pIHsKICAgICAgaWYgKG1pbiA8IDApIHsKICAgICAgICBtaW4gPSAwOwogICAgICB9CiAgICAgIGNvbnN0IGluZGV4RGF0YSA9IGF3YWl0IHRoaXMucGFyc2Uob3B0cyk7CiAgICAgIGlmICghaW5kZXhEYXRhKSB7CiAgICAgICAgcmV0dXJuIFtdOwogICAgICB9CiAgICAgIGNvbnN0IHJlZklkID0gaW5kZXhEYXRhLnJlZk5hbWVUb0lkW3JlZk5hbWVdOwogICAgICBjb25zdCBiYSA9IGluZGV4RGF0YS5pbmRpY2VzW3JlZklkXTsKICAgICAgaWYgKCFiYSkgewogICAgICAgIHJldHVybiBbXTsKICAgICAgfQogICAgICBjb25zdCBvdmVybGFwcGluZ0JpbnMgPSB0aGlzLnJlZzJiaW5zKG1pbiwgbWF4KTsKICAgICAgY29uc3QgY2h1bmtzID0gW107CiAgICAgIGZvciAoY29uc3QgW3N0YXJ0LCBlbmRdIG9mIG92ZXJsYXBwaW5nQmlucykgewogICAgICAgIGZvciAobGV0IGJpbiA9IHN0YXJ0OyBiaW4gPD0gZW5kOyBiaW4rKykgewogICAgICAgICAgaWYgKGJhLmJpbkluZGV4W2Jpbl0pIHsKICAgICAgICAgICAgY29uc3QgYmluQ2h1bmtzID0gYmEuYmluSW5kZXhbYmluXTsKICAgICAgICAgICAgZm9yIChsZXQgYyA9IDA7IGMgPCBiaW5DaHVua3MubGVuZ3RoOyArK2MpIHsKICAgICAgICAgICAgICBjaHVua3MucHVzaChuZXcgQ2h1bmsoYmluQ2h1bmtzW2NdLm1pbnYsIGJpbkNodW5rc1tjXS5tYXh2LCBiaW4pKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gb3B0aW1pemVDaHVua3MoY2h1bmtzLCBuZXcgVmlydHVhbE9mZnNldCgwLCAwKSk7CiAgICB9CiAgICByZWcyYmlucyhiZWcsIGVuZCkgewogICAgICBiZWcgLT0gMTsKICAgICAgaWYgKGJlZyA8IDEpIHsKICAgICAgICBiZWcgPSAxOwogICAgICB9CiAgICAgIGlmIChlbmQgPiAyICoqIDUwKSB7CiAgICAgICAgZW5kID0gMiAqKiAzNDsKICAgICAgfQogICAgICBlbmQgLT0gMTsKICAgICAgbGV0IGwgPSAwOwogICAgICBsZXQgdCA9IDA7CiAgICAgIGxldCBzID0gdGhpcy5taW5TaGlmdCArIHRoaXMuZGVwdGggKiAzOwogICAgICBjb25zdCBiaW5zID0gW107CiAgICAgIGZvciAoOyBsIDw9IHRoaXMuZGVwdGg7IHMgLT0gMywgdCArPSBsc2hpZnQoMSwgbCAqIDMpLCBsICs9IDEpIHsKICAgICAgICBjb25zdCBiID0gdCArIHJzaGlmdChiZWcsIHMpOwogICAgICAgIGNvbnN0IGUgPSB0ICsgcnNoaWZ0KGVuZCwgcyk7CiAgICAgICAgaWYgKGUgLSBiICsgYmlucy5sZW5ndGggPiB0aGlzLm1heEJpbk51bWJlcikgewogICAgICAgICAgdGhyb3cgbmV3IEVycm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J1dGY4Iik7CiAgICB9CiAgICBhc3luYyBnZXRSZWZlcmVuY2VTZXF1ZW5jZU5hbWVzKG9wdHMgPSB7fSkgewogICAgICBjb25zdCBtZXRhZGF0YSA9IGF3YWl0IHRoaXMuZ2V0TWV0YWRhdGEob3B0cyk7CiAgICAgIHJldHVybiBtZXRhZGF0YS5yZWZJZFRvTmFtZTsKICAgIH0KICAgIGNoZWNrTGluZShtZXRhZGF0YSwgcmVnaW9uUmVmTmFtZSwgcmVnaW9uU3RhcnQsIHJlZ2lvbkVuZCwgbGluZSkgewogICAgICBjb25zdCB7IGNvbHVtbk51bWJlcnMsIG1ldGFDaGFyLCBjb29yZGluYXRlVHlwZSwgZm9ybWF0IH0gPSBtZXRhZGF0YTsKICAgICAgaWYgKGxpbmUuY2hhckF0KDApID09PSBtZXRhQ2hhcikgewogICAgICAgIHJldHVybiB7IG92ZXJsYXBzOiBmYWxzZSB9OwogICAgICB9CiAgICAgIGxldCB7IHJlZiwgc3RhcnQsIGVuZCB9ID0gY29sdW1uTnVtYmVyczsKICAgICAgaWYgKCFyZWYpIHsKICAgICAgICByZWYgPSAwOwogICAgICB9CiAgICAgIGlmICghc3RhcnQpIHsKICAgICAgICBzdGFydCA9IDA7CiAgICAgIH0KICAgICAgaWYgKCFlbmQpIHsKICAgICAgICBlbmQgPSAwOwogICAgICB9CiAgICAgIGlmIChmb3JtYXQgPT09ICJWQ0YiKSB7CiAgICAgICAgZW5kID0gODsKICAgICAgfQogICAgICBjb25zdCBtYXhDb2x1bW4gPSBNYXRoLm1heChyZWYsIHN0YXJ0LCBlbmQpOwogICAgICBsZXQgY3VycmVudENvbHVtbk51bWJlciA9IDE7CiAgICAgIGxldCBjdXJyZW50Q29sdW1uU3RhcnQgPSAwOwogICAgICBsZXQgcmVmU2VxID0gIiI7CiAgICAgIGxldCBzdGFydENvb3JkaW5hdGUgPSAtSW5maW5pdHk7CiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGluZS5sZW5ndGggKyAxOyBpICs9IDEpIHsKICAgICAgICBpZiAobGluZVtpXSA9PT0gIgkiIHx8IGkgPT09IGxpbmUubGVuZ3RoKSB7CiAgICAgICAgICBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gcmVmKSB7CiAgICAgICAgICAgIGlmICh0aGlzLnJlbmFtZVJlZlNlcShsaW5lLnNsaWNlKGN1cnJlbnRDb2x1bW5TdGFydCwgaSkpICE9PSByZWdpb25SZWZOYW1lKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHsgb3ZlcmxhcHM6IGZhbHNlIH07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gc3RhcnQpIHsKICAgICAgICAgICAgc3RhcnRDb29yZGluYXRlID0gcGFyc2VJbnQobGluZS5zbGljZShjdXJyZW50Q29sdW1uU3RhcnQsIGkpLCAxMCk7CiAgICAgICAgICAgIGlmIChjb29yZGluYXRlVHlwZSA9PT0gIjEtYmFzZWQtY2xvc2VkIikgewogICAgICAgICAgICAgIHN0YXJ0Q29vcmRpbmF0ZSAtPSAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzdGFydENvb3JkaW5hdGUgPj0gcmVnaW9uRW5kKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHsgc3RhcnRDb29yZGluYXRlLCBvdmVybGFwczogZmFsc2UgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoZW5kID09PSAwIHx8IGVuZCA9PT0gc3RhcnQpIHsKICAgICAgICAgICAgICBpZiAoc3RhcnRDb29yZGluYXRlICsgMSA8PSByZWdpb25TdGFydCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHsgc3RhcnRDb29yZGluYXRlLCBvdmVybGFwczogZmFsc2UgfTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoZm9ybWF0ID09PSAiVkNGIiAmJiBjdXJyZW50Q29sdW1uTnVtYmVyID09PSA0KSB7CiAgICAgICAgICAgIHJlZlNlcSA9IGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKTsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gZW5kKSB7CiAgICAgICAgICAgIGxldCBlbmRDb29yZGluYXRlOwogICAgICAgICAgICBpZiAoZm9ybWF0ID09PSAiVkNGIikgewogICAgICAgICAgICAgIGVuZENvb3JkaW5hdGUgPSB0aGlzLl9nZXRWY2ZFbmQoc3RhcnRDb29yZGluYXRlLCByZWZTZXEsIGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKSk7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgZW5kQ29vcmRpbmF0ZSA9IHBhcnNlSW50KGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKSwgMTApOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChlbmRDb29yZGluYXRlIDw9IHJlZ2lvblN0YXJ0KSB7CiAgICAgICAgICAgICAgcmV0dXJuIHsgb3ZlcmxhcHM6IGZhbHNlIH07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGN1cnJlbnRDb2x1bW5TdGFydCA9IGkgKyAxOwogICAgICAgICAgY3VycmVudENvbHVtbk51bWJlciArPSAxOwogICAgICAgICAgaWYgKGN1cnJlbnRDb2x1bW5OdW1iZXIgPiBtYXhDb2x1bW4pIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIHJldHVybiB7IHN0YXJ0Q29vcmRpbmF0ZSwgb3ZlcmxhcHM6IHRydWUgfTsKICAgIH0KICAgIF9nZXRWY2ZFbmQoc3RhcnRDb29yZGluYXRlLCByZWZTZXEsIGluZm8pIHsKICAgICAgbGV0IGVuZENvb3JkaW5hdGUgPSBzdGFydENvb3JkaW5hdGUgKyByZWZTZXEubGVuZ3RoOwogICAgICBjb25zdCBpc1RSQSA9IGluZm8uaW5kZXhPZigiU1ZUWVBFPVRSQSIpICE9PSAtMTsKICAgICAgaWYgKGluZm9bMF0gIT09ICIuIiAmJiAhaXNUUkEpIHsKICAgICAgICBsZXQgcHJldkNoYXIgPSAiOyI7CiAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBpbmZvLmxlbmd0aDsgaiArPSAxKSB7CiAgICAgICAgICBpZiAocHJldkNoYXIgPT09ICI7IiAmJiBpbmZvLnNsaWNlKGosIGogKyA0KSA9PT0gIkVORD0iKSB7CiAgICAgICAgICAgIGxldCB2YWx1ZUVuZCA9IGluZm8uaW5kZXhPZigiOyIsIGopOwogICAgICAgICAgICBpZiAodmFsdWVFbmQgPT09IC0xKSB7CiAgICAgICAgICAgICAgdmFsdWVFbmQgPSBpbmZvLmxlbmd0aDsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbmRDb29yZGluYXRlID0gcGFyc2VJbnQoaW5mby5zbGljZShqICsgNCwgdmFsdWVFbmQpLCAxMCk7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgcHJldkNoYXIgPSBpbmZvW2pdOwogICAgICAgIH0KICAgICAgfSBlbHNlIGlmIChpc1RSQSkgewogICAgICAgIHJldHVybiBzdGFydENvb3JkaW5hdGUgKyAxOwogICAgICB9CiAgICAgIHJldHVybiBlbmRDb29yZGluYXRlOwogICAgfQogICAgYXN5bmMgbGluZUNvdW50KHJlZk5hbWUsIG9wdHMgPSB7fSkgewogICAgICByZXR1cm4gdGhpcy5pbmRleC5saW5lQ291bnQocmVmTmFtZSwgb3B0cyk7CiAgICB9CiAgICBhc3luYyBfcmVhZFJlZ2lvbihwb3MsIHNpemUsIG9wdHMgPSB7fSkgewogICAgICBjb25zdCBiID0gaW1wb3J0X2J1ZmZlcjcuQnVmZmVyLmFsbG9jKHNpemUpOwogICAgICBjb25zdCB7IGJ5dGVzUmVhZCwgYnVmZmVyIH0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bnRzLmxlbmd0aCkgewogICAgICBjb250ZW50cyA9IGNvbnRlbnRzLnJlcGxhY2UoL1xyP1xuJC8sICIiKTsKICAgICAgcGFyc2VkLnZhbHVlID0gY29udGVudHM7CiAgICB9CiAgICBpZiAobmFtZSA9PT0gInNlcXVlbmNlLXJlZ2lvbiIpIHsKICAgICAgY29uc3QgYyA9IGNvbnRlbnRzLnNwbGl0KC9ccysvLCAzKTsKICAgICAgcmV0dXJuIHsKICAgICAgICAuLi5wYXJzZWQsCiAgICAgICAgc2VxX2lkOiBjWzBdLAogICAgICAgIHN0YXJ0OiBjWzFdICYmIGNbMV0ucmVwbGFjZSgvXEQvZywgIiIpLAogICAgICAgIGVuZDogY1syXSAmJiBjWzJdLnJlcGxhY2UoL1xEL2csICIiKQogICAgICB9OwogICAgfSBlbHNlIGlmIChuYW1lID09PSAiZ2Vub21lLWJ1aWxkIikgewogICAgICBjb25zdCBbc291cmNlLCBidWlsZE5hbWVdID0gY29udGVudHMuc3BsaXQoL1xzKy8sIDIpOwogICAgICByZXR1cm4gewogICAgICAgIC4uLnBhcnNlZCwKICAgICAgICBzb3VyY2UsCiAgICAgICAgYnVpbGROYW1lCiAgICAgIH07CiAgICB9CiAgICByZXR1cm4gcGFyc2VkOwogIH0KICBmdW5jdGlvbiBmb3JtYXRBdHRyaWJ1dGVzKGF0dHJzKSB7CiAgICBjb25zdCBhdHRyT3JkZXIgPSBbXTsKICAgIE9iamVjdC5lbnRyaWVzKGF0dHJzKS5mb3JFYWNoKChbdGFnLCB2YWxdKSA9PiB7CiAgICAgIGlmICghdmFsKQogICAgICAgIHJldHVybjsKICAgICAgbGV0IHZhbHN0cmluZzsKICAgICAgaWYgKHZhbC5oYXNPd25Qcm9wZXJ0eSgidG9TdHJpbmciKSkgewogICAgICAgIHZhbHN0cmluZyA9IGVzY2FwZSh2YWwudG9TdHJpbmcoKSk7CiAgICAgIH0gZWxzZSBpZiAoQXJyYXkuaXNBcnJheSh2YWwpKSB7CiAgICAgICA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lbmNlcyA/IFtdIDogKChfYyA9IGZlYXR1cmVMaW5lLmF0dHJpYnV0ZXMpID09PSBudWxsIHx8IF9jID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYy5EZXJpdmVzX2Zyb20pIHx8IFtdOwogICAgICBpZiAoIWlkcy5sZW5ndGggJiYgIXBhcmVudHMubGVuZ3RoICYmICFkZXJpdmVzLmxlbmd0aCkgewogICAgICAgIHRoaXMuX2VtaXRJdGVtKFtmZWF0dXJlTGluZV0pOwogICAgICAgIHJldHVybjsKICAgICAgfQogICAgICBsZXQgZmVhdHVyZSA9IHZvaWQgMDsKICAgICAgaWRzLmZvckVhY2goKGlkKSA9PiB7CiAgICAgICAgY29uc3QgZXhpc3RpbmcgPSB0aGlzLl91bmRlckNvbnN0cnVjdGlvbkJ5SWRbaWRdOwogICAgICAgIGlmIChleGlzdGluZykgewogICAgICAgICAgaWYgKGV4aXN0aW5nW2V4aXN0aW5nLmxlbmd0aCAtIDFdLnR5cGUgIT09IGZlYXR1cmVMaW5lLnR5cGUpIHsKICAgICAgICAgICAgdGhpcy5fcGFyc2VFcnJvcihgbXVsdGktbGluZSBmZWF0dXJlICIke2lkfSIgaGFzIGluY29uc2lzdGVudCB0eXBlczogIiR7ZmVhdHVyZUxpbmUudHlwZX0iLCAiJHtleGlzdGluZ1tleGlzdGluZy5sZW5ndGggLSAxXS50eXBlfSJgKTsKICAgICAgICAgIH0KICAgICAgICAgIGV4aXN0aW5nLnB1c2goZmVhdHVyZUxpbmUpOwogICAgICAgICAgZmVhdHVyZSA9IGV4aXN0aW5nOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBmZWF0dXJlID0gW2ZlYXR1cmVMaW5lXTsKICAgICAgICAgIHRoaXMuX2VuZm9yY2VCdWZmZXJTaXplTGltaXQoMSk7CiAgICAgICAgICBpZiAoIXBhcmVudHMubGVuZ3RoICYmICFkZXJpdmVzLmxlbmd0aCkgewogICAgICAgICAgICB0aGlzLl91bmRlckNvbnN0cnV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F0dXJlLCByZWZlcmVuY2VzLCBpZHMpIHsKICAgICAgZnVuY3Rpb24gcG9zdFNldChvYmosIHNsb3QxLCBzbG90MikgewogICAgICAgIGxldCBzdWJPYmogPSBvYmpbc2xvdDFdOwogICAgICAgIGlmICghc3ViT2JqKSB7CiAgICAgICAgICBzdWJPYmogPSB7fTsKICAgICAgICAgIG9ialtzbG90MV0gPSBzdWJPYmo7CiAgICAgICAgfQogICAgICAgIGNvbnN0IHJldHVyblZhbCA9IHN1Yk9ialtzbG90Ml0gfHwgZmFsc2U7CiAgICAgICAgc3ViT2JqW3Nsb3QyXSA9IHRydWU7CiAgICAgICAgcmV0dXJuIHJldHVyblZhbDsKICAgICAgfQogICAgICByZWZlcmVuY2VzLlBhcmVudC5mb3JFYWNoKCh0b0lkKSA9PiB7CiAgICAgICAgY29uc3Qgb3RoZXJGZWF0dXJlID0gdGhpcy5fdW5kZXJDb25zdHJ1Y3Rpb25CeUlkW3RvSWRdOwogICAgICAgIGlmIChvdGhlckZlYXR1cmUpIHsKICAgICAgICAgIGNvbnN0IHBuYW1lID0gY29udGFpbmVyQXR0cmlidXRlcy5QYXJlbnQ7CiAgICAgICAgICBpZiAoIWlkcy5maWx0ZXIoKGlkKSA9PiBwb3N0U2V0KHRoaXMuX2NvbXBsZXRlZFJlZmVyZW5jZXMsIGlkLCBgUGFyZW50LCR7dG9JZH1gKSkubGVuZ3RoKSB7CiAgICAgICAgICAgIG90aGVyRmVhdHVyZS5mb3JFYWNoKChsb2NhdGlvbikgPT4gewogICAgICAgICAgICAgIGxvY2F0aW9uW3BuYW1lXS5wdXNoKGZlYXR1cmUpOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgbGV0IHJlZiA9IHRoaXMuX3VuZGVyQ29uc3RydWN0aW9uT3JwaGFuc1t0b0lkXTsKICAgICAgICAgIGlmICghcmVmKSB7CiAgICAgICAgICAgIHJlZiA9IHsKICAgICAgICAgICAgICBQYXJlbnQ6IFtdLAogICAgICAgICAgICAgIERlcml2ZXNfZnJvbTogW10KICAgICAgICAgICAgfTsKICAgICAgICAgICAgdGhpcy5fdW5kZXJDb25zdHJ1Y3Rpb25PcnBoYW5zW3RvSWRdID0gcmVmOwogICAgICAgICAgfQogICAgICAgICAgcmVmLlBhcmVudC5wdXNoKGZlYXR1cmUpOwogICAgICAgIH0KICAgICAgfSk7CiAgICAgIHJlZmVyZW5jZXMuRGVyaXZlc19mcm9tLmZvckVhY2goKHRvSWQpID0+IHsKICAgICAgICBjb25zdCBvdGhlckZlYXR1cmUgPSB0aGlzLl91bmRlckNvbnN0cnVjdGlvbkJ5SWRbdG9JZF07CiAgICAgICAgaWYgKG90aGVyRmVhdHVyZSkgewogICAgICAgICAgY29uc3QgcG5hbWUgPSBjb250YWluZXJBdHRyaWJ1dGVzLkRlcml2ZXNfZnJvbTsKICAgICAgICAgIGlmICghaWRzLmZpbHRlcigoaWQpID0+IHBvc3RTZXQodGhpcy5fY29tcGxldGVkUmVmZXJlbmNlcywgaWQsIGBEZXJpdmVzX2Zyb20sJHt0b0lkfWApKS5sZW5ndGgpIHsKICAgICAgICAgICAgb3RoZXJGZWF0dXJlLmZvckVhY2goKGxvY2F0aW9uKSA9PiB7CiAgICAgICAgICAgICAgbG9jYXRpb25bcG5hbWVdLnB1c2goZmVhdHVyZSk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBsZXQgcmVmID0gdGhpcy5fdW5kZXJDb25zdHJ1Y3Rpb25PcnBoYW5zW3RvSWRdOwogICAgICAgICAgaWYgKCFyZWYpIHsKICAgICAgICAgICAgcmVmID0gewogICAgICAgICAgICAgIFBhcmVudDogW10sCiAgICAgICAgICAgICAgRGVyaXZlc19mcm9tOiBbXQogICAgICAgICAgICB9OwogICAgICAgICAgICB0aGlzLl91bmRlckNvbnN0cnVjdGlvbk9ycGhhbnNbdG9JZF0gPSByZWY7CiAgICAgICAg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ZiAoImRpcmVjdGl2ZSIgaW4gdGhpc0NodW5rKSB7CiAgICAgICAgICBpZiAodGhpc0NodW5rLmRpcmVjdGl2ZSAhPT0gImdmZi12ZXJzaW9uIikgewogICAgICAgICAgICB0aGlzLnB1c2goIiMjZ2ZmLXZlcnNpb24gM1xuIik7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGlmICgic2VxdWVuY2UiIGluIGNodW5rICYmICF0aGlzLmZhc3RhTW9kZSkgewogICAgICAgIHRoaXMucHVzaCgiIyNGQVNUQVxuIik7CiAgICAgICAgdGhpcy5mYXN0YU1vZGUgPSB0cnVlOwogICAgICB9CiAgICAgIGlmIChBcnJheS5pc0FycmF5KGNodW5rKSkKICAgICAgICBzdHIgPSBjaHVuay5tYXAoZm9ybWF0SXRlbSkuam9pbigiIik7CiAgICAgIGVsc2UKICAgICAgICBzdHIgPSBmb3JtYXRJdGVtKGNodW5rKTsKICAgICAgdGhpcy5wdXNoKHN0cik7CiAgICAgIGlmICh0aGlzLmxpbmVzU2luY2VMYXN0U3luY01hcmsgPj0gdGhpcy5taW5MaW5lc0JldHdlZW5TeW5jTWFya3MpIHsKICAgICAgICB0aGlzLnB1c2goIiMjI1xuIik7CiAgICAgICAgdGhpcy5saW5lc1NpbmNlTGFzdFN5bmNNYXJrID0gMDsKICAgICAgfSBlbHNlIHsKICAgICAgICBsZXQgY291bnQgPSAwOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSArPSAxKSB7CiAgICAgICAgICBpZiAoc3RyW2ldID09PSAiXG4iKQogICAgICAgICAgICBjb3VudCArPSAxOwogICAgICAgIH0KICAgICAgICB0aGlzLmxpbmVzU2luY2VMYXN0U3luY01hcmsgKz0gY291bnQ7CiAgICAgIH0KICAgICAgdGhpcy5oYXZlV2VFbWl0dGVkRGF0YSA9IHRydWU7CiAgICAgIF9jYWxsYmFjayhjYWxsYmFjayk7CiAgICB9CiAgfTsKICBmdW5jd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0NvbXBhcmF0b3IoZik7CiAgICB9CiAgICBmdW5jdGlvbiBsZWZ0KGEsIHgsIGxvLCBoaSkgewogICAgICBpZiAobG8gPT0gbnVsbCkKICAgICAgICBsbyA9IDA7CiAgICAgIGlmIChoaSA9PSBudWxsKQogICAgICAgIGhpID0gYS5sZW5ndGg7CiAgICAgIHdoaWxlIChsbyA8IGhpKSB7CiAgICAgICAgY29uc3QgbWlkID0gbG8gKyBoaSA+Pj4gMTsKICAgICAgICBpZiAoY29tcGFyZShhW21pZF0sIHgpIDwgMCkKICAgICAgICAgIGxvID0gbWlkICsgMTsKICAgICAgICBlbHNlCiAgICAgICAgICBoaSA9IG1pZDsKICAgICAgfQogICAgICByZXR1cm4gbG87CiAgICB9CiAgICBmdW5jdGlvbiByaWdodChhLCB4LCBsbywgaGkpIHsKICAgICAgaWYgKGxvID09IG51bGwpCiAgICAgICAgbG8gPSAwOwogICAgICBpZiAoaGkgPT0gbnVsbCkKICAgICAgICBoaSA9IGEubGVuZ3RoOwogICAgICB3aGlsZSAobG8gPCBoaSkgewogICAgICAgIGNvbnN0IG1pZCA9IGxvICsgaGkgPj4+IDE7CiAgICAgICAgaWYgKGNvbXBhcmUoYVttaWRdLCB4KSA+IDApCiAgICAgICAgICBoaSA9IG1pZDsKICAgICAgICBlbHNlCiAgICAgICAgICBsbyA9IG1pZCArIDE7CiAgICAgIH0KICAgICAgcmV0dXJuIGxvOwogICAgfQogICAgZnVuY3Rpb24gY2VudGVyKGEsIHgsIGxvLCBoaSkgewogICAgICBpZiAobG8gPT0gbnVsbCkKICAgICAgICBsbyA9IDA7CiAgICAgIGlmIChoaSA9PSBudWxsKQogICAgICAgIGhpID0gYS5sZW5ndGg7CiAgICAgIGNvbnN0IGkgPSBsZWZ0KGEsIHgsIGxvLCBoaSAtIDEpOwogICAgICByZXR1cm4gaSA+IGxvICYmIGRlbHRhKGFbaSAtIDFdLCB4KSA+IC1kZWx0YShhW2ldLCB4KSA/IGkgLSAxIDogaTsKICA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AgICBpZiAoIXRoaXMuI25fZmVhdHVyZXMpIHsKICAgICAgICBjb25zdCBzb3VyY2UgPSBkYXRhU291cmNlcy5nZXQodGhpcy4jdWlkKTsKICAgICAgICBjb25zdCB7IGN1bVBvc2l0aW9ucyB9ID0gc291cmNlLmNocm9tSW5mbzsKICAgICAgICBjb25zdCBjb3VudFByb21pc2VzID0gW107CiAgICAgICAgZm9yIChjb25zdCBjdW1Qb3Mgb2YgY3VtUG9zaXRpb25zKSB7CiAgICAgICAgICBjb25zdCBjaHJvbU5hbWUgPSBjdW1Qb3MuY2hyOwogICAgICAgICAgY291bnRQcm9taXNlcy5wdXNoKHRoaXMudGJpLmxpbmVDb3VudChjaHJvbU5hbWUpKTsKICAgICAgICB9CiAgICAgICAgY29uc3QgY291bnRzID0gYXdhaXQgUHJvbWlzZS5hbGwoY291bnRQcm9taXNlcyk7CiAgICAgICAgY29uc3QgdG90YWxfY291bnRzID0gY291bnRzLnJlZHVjZSgoYWNjLCBjdXIpID0+IGFjYyArIGN1ciwgMCk7CiAgICAgICAgdGhpcy4jbl9mZWF0dXJlcyA9IHRvdGFsX2NvdW50czsKICAgICAgfQogICAgICByZXR1cm4gdGhpcy4jbl9mZWF0dXJlczsKICAgIH0KICAgICNnZXRMaW5lUHJvbWlzZXMobWluWCwgbWF4WCkgewogICAgICBjb25zdCBzb3VyY2UgPSBkYXRhU291cmNlcy5nZXQodGhpcy4jdWlkKTsKICAgICAgbGV0IGN1ck1pblggPSBtaW5YOwogICAgICBjb25zdCB7IGNocm9tTGVuZ3RocywgY3VtUG9zaXRpb25zIH0gPSBzb3VyY2UuY2hyb21JbmZvOwogICAgICBjb25zdCBsaW5lUHJvbWlzZXMgPSBbXTsKICAgICAgY29uc3QgTUFYX0ZFQVRVUkVTID0gNWU1OwogICAgICBjb25zdCBNQVhfV0lORE9XID0gNGU2OwogICAgICBpZiAodGhpcy4jbl9mZWF0dXJlcyAmJiB0aGlzLiNuX2ZlYXR1cmVzID4gTUFYX0ZFQVRVUkVTICYmIG1heFggLSBtaW5YID4gTUFYX1dJTkRPVykgewogICAgICAgIGNvbnN0IGRpZmYgPSBtYXhYIC0gbWluWDsKICAgICAgICBjb25zdCB3aW5kb3dTaXplID0gNWU0OwogICAgICAgIGNvbnN0IG5fc2FtcGxlcyA9IDEwMDsKICAgICAgICBjb25zdCB0b3RhbEJpbnMgPSBNYXRoLmZsb29yKGRpZmYgLyB3aW5kb3dTaXplKTsKICAgICAgICBjb25zdCBzZWxlY3RlZEJpbnMgPSBtYWtlUmFuZG9tU29ydGVkQXJyYXkobl9zYW1wbGVzLCB0b3RhbEJpbnMpOwogICAgICAgIGNvbnN0IGJpbkxpbmVzID0gc2VsZWN0ZWRCaW5zLm1hcCgoYmluKSA9PiB7CiAgICAgICAgICBjb25zdCBiaW5TdGFydCA9IG1pblggKyBiaW4gKiB3aW5kb3dTaXplOwogICAgICAgICAgY29uc3QgYmluRW5kID0gYmluU3RhcnQgKyB3aW5kb3dTaXplOwogICAgICAgICAgcmV0dXJuIHRoaXMuI2dldExpbmVQcm9taXNlcyhiaW5TdGFydCwgYmluRW5kKTsKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gYmluTGluZXMuZmxhdCgpOwogICAgICB9CiAgICAgIGZvciAoY29uc3QgY3VtUG9zIG9mIGN1bVBvc2l0aW9ucykgewogICAgICAgIGNvbnN0IGNocm9tTmFtZSA9IGN1bVBvcy5jaHI7CiAgICAgICAgY29uc3QgY2hyb21TdGFydCA9IGN1bVBvcy5wb3M7CiAgICAgICAgY29uc3QgY2hyb21FbmQgPSBjdW1Qb3MucG9zICsgY2hyb21MZW5ndGhzW2Nocm9tTmFtZV07CiAgICAgICAgbGV0IHN0YXJ0UG9zLCBlbmRQb3M7CiAgICAgICAgaWYgKGNocm9tU3RhcnQgPiBjdXJNaW5YIHx8IGN1ck1pblggPj0gY2hyb21FbmQpIHsKICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgIH0KICAgICAgICBjb25zdCBsaW5lUHJvbWlzZSA9IG5ldyBQcm9taXNlKChyZXNvbHZlKSA9PiB7CiAgICAgICAgICBjb25zdCBsaW5lcyA9IFtdOwogICAgICAgICAgY29uc3QgbGluZUNhbGxiYWNrID0gKGxpbmUpID0+IHsKICAgICAgICAgICAgbGluZXMucHVzaChsaW5lKTsKICAgICAgICAgIH07CiAgICAgICAgICBpZiAobWF4WCA+IGNocm9tRW5kKSB7CiAgICAgICAgICAgIHN0YXJ0UG9zID0gY3VyTWluWCAtIGNocm9tU3RhcnQ7CiAgICAgICAgICAgIGVuZFBvcyA9IGNocm9tRW5kIC0gY2hyb21TdGFydDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHN0YXJ0UG9zID0gTWF0aC5mbG9vcihjdXJNaW5YIC0gY2hyb21TdGFydCk7CiAgICAgICAgICAgIGVuZFBvcyA9IE1hdGguY2VpbChtYXhYIC0gY2hyb21TdGFydCk7CiAgICAgICAgICB9CiAgICAgICAgICB0aGlzLnRiaS5nZXRMaW5lcyhjaHJvbU5hbWUsIHN0YXJ0UG9zLCBlbmRQb3MsIGxpbmVDYWxsYmFjaykudGhlbigoKSA9PiB7CiAgICAgICAgICAgIHJlc29sdmUobGluZXMpOwogICAgICAgICAgfSk7CiAgICAgICAgfSk7CiAgICAgICAgbGluZVByb21pc2VzLnB1c2gobGluZVByb21pc2UpOwogICAgICAgIGlmIChtYXhYIDw9IGNocm9tRW5kKSB7CiAgICAgICAgICBjb250aW51ZTsKICAgICAgICB9CiAgICAgICAgY3VyTWluWCA9IGNocm9tRW5kOwogICAgICB9CiAgICAgIHJldHVybiBsaW5lUHJvbWlzZXM7CiAgICB9CiAgICBhc3luYyBnZXRUaWxlRGF0YShtaW5YLCBtYXhYKSB7CiAgICAgIGNvbnN0IHNvdXJjZSA9IGRhdGFTb3VyY2VzLmdldCh0aGlzLiN1aWQpOwogICAgICBjb25zdCBzYW1wbGVMZW5ndGggPSBzb3VyY2Uub3B0aW9ucy5zYW1wbGVMZW5nd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Zlcm9zcyBBYm91a2hhZGlqZWggPGh0dHBzOi8vZmVyb3NzLm9yZz4KICogQGxpY2Vuc2UgIE1JVAogKi8KLyohIGllZWU3NTQuIEJTRC0zLUNsYXVzZSBMaWNlbnNlLiBGZXJvc3MgQWJvdWtoYWRpamVoIDxodHRwczovL2Zlcm9zcy5vcmcvb3BlbnNvdXJjZT4gKi8KLyohIHNhZmUtYnVmZmVyLiBNSVQgTGljZW5zZS4gRmVyb3NzIEFib3VraGFkaWplaCA8aHR0cHM6Ly9mZXJvc3Mub3JnL29wZW5zb3VyY2U+ICovCi8qKgogKiBAbGljZW5zZQogKiBMb2Rhc2ggKEN1c3RvbSBCdWlsZCkgPGh0dHBzOi8vbG9kYXNoLmNvbS8+CiAqIEJ1aWxkOiBgbG9kYXNoIG1vZHVsYXJpemUgZXhwb3J0cz0iZXMiIC1vIC4vYAogKiBDb3B5cmlnaHQgT3BlbkpTIEZvdW5kYXRpb24gYW5kIG90aGVyIGNvbnRyaWJ1dG9ycyA8aHR0cHM6Ly9vcGVuanNmLm9yZy8+CiAqIFJlbGVhc2VkIHVuZGVyIE1JVCBsaWNlbnNlIDxodHRwczovL2xvZGFzaC5jb20vbGljZW5zZT4KICogQmFzZWQgb24gVW5kZXJzY29yZS5qcyAxLjguMyA8aHR0cDovL3VuZGVyc2NvcmVqcy5vcmcvTElDRU5TRT4KICogQ29weXJpZ2h0IEplcmVteSBBc2hrZW5hcywgRG9jdW1lbnRDbG91ZCBhbmQgSW52ZXN0aWdhdGl2ZSBSZXBvcnRlcnMgJiBFZGl0b3JzCiAqLwo="; -const blob$1 = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs$1)], { type: "text/javascript;charset=utf-8" }); -function Worker$2() { - const objURL = blob$1 && (window.URL || window.webkitURL).createObjectURL(blob$1); - try { - return objURL ? new Worker(objURL) : new Worker("data:application/javascript;base64," + encodedJs$1, { type: "module" }); - } finally { - objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL); - } -} -const DEBOUNCE_TIME$1 = 200; -class GffDataFetcher { - constructor(HGC, config2) { - __publicField(this, "dataConfig", {}); - // required for higlass - __publicField(this, "uid"); - __publicField(this, "prevRequestTime"); - __publicField(this, "track"); - __publicField(this, "toFetch"); - __publicField(this, "fetchTimeout"); - __publicField(this, "worker"); - this.uid = HGC.libraries.slugid.nice(); - this.prevRequestTime = 0; - this.toFetch = /* @__PURE__ */ new Set(); - const { url, indexUrl, assembly, ...options } = config2; - this.worker = spawn(new Worker$2()).then(async (worker) => { - const chromSizes = Object.entries(computeChromSizes(assembly).size); - await worker.init(this.uid, { url, indexUrl }, chromSizes, options); - return worker; - }); - } - /* - * Collect Tileset Information, such as tile size and genomic positions - */ - async tilesetInfo(callback) { - (await this.worker).tilesetInfo(this.uid).then(callback); - } - fetchTilesDebounced(receivedTiles, tileIds) { - this.track.drawLoadingCue(); - tileIds.forEach((tileId) => this.toFetch.add(tileId)); - if (this.fetchTimeout) { - clearTimeout(this.fetchTimeout); - } - this.fetchTimeout = setTimeout(() => { - this.sendFetch(receivedTiles, [...this.toFetch]); - this.toFetch.clear(); - }, DEBOUNCE_TIME$1); - } - async sendFetch(receivedTiles, tileIds) { - (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles); - } - async getTabularData(tileIds) { - const buf = await (await this.worker).getTabularData(this.uid, tileIds); - const parsed = JSON.parse(new TextDecoder().decode(buf)); - return parsed; - } -} -__publicField(GffDataFetcher, "config", { type: "gff" }); -const encodedJs = "KCgpID0+IHsKICB2YXIgX19jcmVhdGUgPSBPYmplY3QuY3JlYXRlOwogIHZhciBfX2RlZlByb3AgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7CiAgdmFyIF9fZ2V0T3duUHJvcERlc2MgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yOwogIHZhciBfX2dldE93blByb3BOYW1lcyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzOwogIHZhciBfX2dldFByb3RvT2Y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JiA2M10gKyBsb29rdXBbbnVtID4+IDYgJiA2M10gKyBsb29rdXBbbnVtICYgNjNdOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGVuY29kZUNodW5rKHVpbnQ4LCBzdGFydCwgZW5kKSB7CiAgICAgICAgdmFyIHRtcDsKICAgICAgICB2YXIgb3V0cHV0ID0gW107CiAgICAgICAgZm9yICh2YXIgaTIgPSBzdGFydDsgaTIgPCBlbmQ7IGkyICs9IDMpIHsKICAgICAgICAgIHRtcCA9ICh1aW50OFtpMl0gPDwgMTYgJiAxNjcxMTY4MCkgKyAodWludDhbaTIgKyAxXSA8PCA4ICYgNjUyODApICsgKHVpbnQ4W2kyICsgMl0gJiAyNTUpOwogICAgICAgICAgb3V0cHV0LnB1c2godHJpcGxldFRvQmFzZTY0KHRtcCkpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gb3V0cHV0LmpvaW4oIiIpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZyb21CeXRlQXJyYXkodWludDgpIHsKICAgICAgICB2YXIgdG1wOwogICAgICAgIHZhciBsZW4yID0gdWludDgubGVuZ3RoOwogICAgICAgIHZhciBleHRyYUJ5dGVzID0gbGVuMiAlIDM7CiAgICAgICAgdmFyIHBhcnRzID0gW107CiAgICAgICAgdmFyIG1heENodW5rTGVuZ3RoID0gMTYzODM7CiAgICAgICAgZm9yICh2YXIgaTIgPSAwLCBsZW4yMiA9IGxlbjIgLSBleHRyYUJ5dGVzOyBpMiA8IGxlbjIyOyBpMiArPSBtYXhDaHVua0xlbmd0aCkgewogICAgICAgICAgcGFydHMucHVzaChlbmNvZGVDaHVuayh1aW50OCwgaTIsIGkyICsgbWF4Q2h1bmtMZW5ndGggPiBsZW4yMiA/IGxlbjIyIDogaTIgKyBtYXhDaHVua0xlbmd0aCkpOwogICAgICAgIH0KICAgICAgICBpZiAoZXh0cmFCeXRlcyA9PT0gMSkgewogICAgICAgICAgdG1wID0gdWludDhbbGVuMiAtIDFdOwogICAgICAgICAgcGFydHMucHVzaChsb29rdXBbdG1wID4+IDJdICsgbG9va3VwW3RtcCA8PCA0ICYgNjNdICsgIj09Iik7CiAgICAgICAgfSBlbHNlIGlmIChleHRyYUJ5dGVzID09PSAyKSB7CiAgICAgICAgICB0bXAgPSAodWludDhbbGVuMiAtIDJdIDw8IDgpICsgdWludDhbbGVuMiAtIDFdOwogICAgICAgICAgcGFydHMucHVzaChsb29rdXBbdG1wID4+IDEwXSArIGxvb2t1cFt0bXAgPj4gNCAmIDYzXSArIGxvb2t1cFt0bXAgPDwgMiAmIDYzXSArICI9Iik7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwYXJ0cy5qb2luKCIiKTsKICAgICAgfQogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vaWVlZTc1NEAxLjIuMS9ub2RlX21vZHVsZXMvaWVlZTc1NC9pbmRleC5qcwogIHZhciByZXF1aXJlX2llZWU3NTQgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vaWVlZTc1NEAxLjIuMS9ub2RlX21vZHVsZXMvaWVlZTc1NC9pbmRleC5qcyIoZXhwb3J0czIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICBleHBvcnRzMi5yZWFkID0gZnVuY3Rpb24oYnVmZmVyLCBvZmZzZXQsIGlzTEUsIG1MZW4sIG5CeXRlcykgewogICAgICAgIHZhciBlLCBtOwogICAgICAgIHZhciBlTGVuID0gbkJ5dGVzICogOCAtIG1MZW4gLSAxOwogICAgICAgIHZhciBlTWF4ID0gKDEgPDwgZUxlbikgLSAxOwogICAgICAgIHZhciBlQmlhcyA9IGVNYXggPj4gMTsKICAgICAgICB2YXIgbkJpdHMgPSAtNzsKICAgICAgICB2YXIgaSA9IGlzTEUgPyBuQnl0ZXMgLSAxIDogMDsKICAgICAgICB2YXIgZCA9IGlzTEUgPyAtMSA6IDE7CiAgICAgICAgdmFyIHMgPSBidWZmZXJbb2Zmc2V0ICsgaV07CiAgICAgICAgaSArPSBkOwogICAgICAgIGUgPSBzICYgKDEgPDwgLW5CaXRzKSAtIDE7CiAgICAgICAgcyA+Pj0gLW5CaXRzOwogICAgICAgIG5CaXRzICs9IGVMZW47CiAgICAgICAgZm9yICg7IG5CaXRzID4gMDsgZSA9IGUgKiAyNTYgKyBidWZmZXJbb2Zmc2V0ICsgaV0sIGkgKz0gZCwgbkJpdHMgLT0gOCkgewogICAgICAgIH0KICAgICAgICBtID0gZSAmICgxIDw8IC1uQml0cykgLSAxOwogICAgICAgIGUgPj49IC1uQml0czsKICAgICAgICBuQml0cyArPSBtTGVuOwogICAgICAgIGZvciAoOyBuQml0cyA+IDA7IG0gPSBtICogMjU2ICsgYnVmZmVyW29mZnNldCArIGldLCBpICs9IGQsIG5CaXRzIC09IDgpIHsKICAgICAgICB9CiAgICAgICAgaWYgKGUgPT09IDApIHsKICAgICAgICAgIGUgPSAxIC0gZUJpYXM7CiAgICAgICAgfSBlbHNlIGlmIChlID09PSBlTWF4KSB7CiAgICAgICAgICByZXR1cm4gbSA/IE5hTiA6IChzID8gLTEgOiAxKSAqIEluZmluaXR5OwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBtID0gbSArIE1hdGgucG93KDIsIG1MZW4pOwogICAgICAgICAgZSA9IGUgLSBlQmlhczsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIChzID8gLTEgOiAxKSAqIG0gKiBNYXRoLnBvdygyLCBlIC0gbUxlbik7CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLndyaXRlID0gZnVuY3Rpb24oYnVmZmVyLCB2YWx1ZSwgb2Zmc2V0LCBpc0xFLCBtTGVuLCBuQnl0ZXMpIHsKICAgICAgICB2YXIgZSwgbSwgYzsKICAgICAgICB2YXIgZUxlbiA9IG5CeXRlcyAqIDggLSBtTGVuIC0gMTsKICAgICAgICB2YXIgZU1heCA9ICgxIDw8IGVMZW4pIC0gMTsKICAgICAgICB2YXIgZUJpYXMgPSBlTWF4ID4+IDE7CiAgICAgICAgdmFyIHJ0ID0gbUxlbiA9PT0gMjMgPyBNYXRoLnBvdygyLCAtMjQpIC0gTWF0aC5wb3coMiwgLTc3KSA6IDA7CiAgICAgICAgdmFyIGkgPSBpc0xFID8gMCA6IG5CeXRlcyAtIDE7CiAgICAgICAgdmFyIGQgPSBpc0xFID8gMSA6IC0xOwogICAgICAgIHZhciBzID0gdmFsdWUgPCAwIHx8IHZhbHVlID09PSAwICYmIDEgLyB2YWx1ZSA8IDAgPyAxIDogMDsKICAgICAgICB2YWx1ZSA9IE1hdGguYWJzKHZhbHVlKTsKICAgICAgICBpZiAoaXNOYU4odmFsdWUpIHx8IHZhbHVlID09PSBJbmZpbml0eSkgewogICAgICAgICAgbSA9IGlzTmFOKHZhbHVlKSA/IDEgOiAwOwogICAgICAgICAgZSA9IGVNYXg7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGUgPSBNYXRoLmZsb29yKE1hdGgubG9nKHZhbHVlKSAvIE1hdGguTE4yKTsKICAgICAgICAgIGlmICh2YWx1ZSAqIChjID0gTWF0aC5wb3coMiwgLWUpKSA8IDEpIHsKICAgICAgICAgICAgZS0tOwogICAgICAgICAgICBjICo9IDI7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoZSArIGVCaWFzID49IDEpIHsKICAgICAgICAgICAgdmFsdWUgKz0gcnQgLyBjOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdmFsdWUgKz0gcnQgKiBNYXRoLnBvdygyLCAxIC0gZUJpYXMpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHZhbHVlICogYyA+PSAyKSB7CiAgICAgICAgICAgIGUrKzsKICAgICAgICAgICAgYyAvPSAyOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGUgKyBlQmlhcyA+PSBlTWF4KSB7CiAgICAgICAgICAgIG0gPSAwOwogICAgICAgICAgICBlID0gZU1heDsKICAgICAgICAgIH0gZWxzZSBpZiAoZSArIGVCaWFzID49IDEpI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gcmV0dXJuIDQyOwogICAgICAgICAgfSB9OwogICAgICAgICAgT2JqZWN0LnNldFByb3RvdHlwZU9mKHByb3RvLCBVaW50OEFycmF5LnByb3RvdHlwZSk7CiAgICAgICAgICBPYmplY3Quc2V0UHJvdG90eXBlT2YoYXJyLCBwcm90byk7CiAgICAgICAgICByZXR1cm4gYXJyLmZvbygpID09PSA0MjsKICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICB9CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShCdWZmZXIxMC5wcm90b3R5cGUsICJwYXJlbnQiLCB7CiAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSwKICAgICAgICBnZXQ6IGZ1bmN0aW9uKCkgewogICAgICAgICAgaWYgKCFCdWZmZXIxMC5pc0J1ZmZlcih0aGlzKSkKICAgICAgICAgICAgcmV0dXJuIHZvaWQgMDsKICAgICAgICAgIHJldHVybiB0aGlzLmJ1ZmZlcjsKICAgICAgICB9CiAgICAgIH0pOwogICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoQnVmZmVyMTAucHJvdG90eXBlLCAib2Zmc2V0IiwgewogICAgICAgIGVudW1lcmFibGU6IHRydWUsCiAgICAgICAgZ2V0OiBmdW5jdGlvbigpIHsKICAgICAgICAgIGlmICghQnVmZmVyMTAuaXNCdWZmZXIodGhpcykpCiAgICAgICAgICAgIHJldHVybiB2b2lkIDA7CiAgICAgICAgICByZXR1cm4gdGhpcy5ieXRlT2Zmc2V0OwogICAgICAgIH0KICAgICAgfSk7CiAgICAgIGZ1bmN0aW9uIGNyZWF0ZUJ1ZmZlcihsZW5ndGgpIHsKICAgICAgICBpZiAobGVuZ3RoID4gS19NQVhfTEVOR1RIKSB7CiAgICAgICAgICB0aHJvdyBuZXcgUmFuZ2VFcnJvcignVGhlIHZhbHVlICInICsgbGVuZ3RoICsgJyIgaXMgaW52YWxpZCBmb3Igb3B0aW9uICJzaXplIicpOwogICAgICAgIH0KICAgICAgICBjb25zdCBidWYgPSBuZXcgVWludDhBcnJheShsZW5ndGgpOwogICAgICAgIE9iamVjdC5zZXRQcm90b3R5cGVPZihidWYsIEJ1ZmZlcjEwLnByb3RvdHlwZSk7CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfQogICAgICBmdW5jdGlvbiBCdWZmZXIxMChhcmcsIGVuY29kaW5nT3JPZmZzZXQsIGxlbmd0aCkgewogICAgICAgIGlmICh0eXBlb2YgYXJnID09PSAibnVtYmVyIikgewogICAgICAgICAgaWYgKHR5cGVvZiBlbmNvZGluZ09yT2Zmc2V0ID09PSAic3RyaW5nIikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCdUaGUgInN0cmluZyIgYXJndW1lbnQgbXVzdCBiZSBvZiB0eXBlIHN0cmluZy4gUmVjZWl2ZWQgdHlwZSBudW1iZXInKTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBhbGxvY1Vuc2FmZShhcmcpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gZnJvbShhcmcsIGVuY29kaW5nT3JPZmZzZXQsIGxlbmd0aCk7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucG9vbFNpemUgPSA4MTkyOwogICAgICBmdW5jdGlvbiBmcm9tKHZhbHVlLCBlbmNvZGluZ09yT2Zmc2V0LCBsZW5ndGgpIHsKICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09PSAic3RyaW5nIikgewogICAgICAgICAgcmV0dXJuIGZyb21TdHJpbmcodmFsdWUsIGVuY29kaW5nT3JPZmZzZXQpOwogICAgICAgIH0KICAgICAgICBpZiAoQXJyYXlCdWZmZXIuaXNWaWV3KHZhbHVlKSkgewogICAgICAgICAgcmV0dXJuIGZyb21BcnJheVZpZXcodmFsdWUpOwogICAgICAgIH0KICAgICAgICBpZiAodmFsdWUgPT0gbnVsbCkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcigiVGh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gICAgIH0KICAgICAgQnVmZmVyMTAuYWxsb2NVbnNhZmUgPSBmdW5jdGlvbihzaXplKSB7CiAgICAgICAgcmV0dXJuIGFsbG9jVW5zYWZlKHNpemUpOwogICAgICB9OwogICAgICBCdWZmZXIxMC5hbGxvY1Vuc2FmZVNsb3cgPSBmdW5jdGlvbihzaXplKSB7CiAgICAgICAgcmV0dXJuIGFsbG9jVW5zYWZlKHNpemUpOwogICAgICB9OwogICAgICBmdW5jdGlvbiBmcm9tU3RyaW5nKHN0cmluZywgZW5jb2RpbmcpIHsKICAgICAgICBpZiAodHlwZW9mIGVuY29kaW5nICE9PSAic3RyaW5nIiB8fCBlbmNvZGluZyA9PT0gIiIpIHsKICAgICAgICAgIGVuY29kaW5nID0gInV0ZjgiOwogICAgICAgIH0KICAgICAgICBpZiAoIUJ1ZmZlcjEwLmlzRW5jb2RpbmcoZW5jb2RpbmcpKSB7CiAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgIH0KICAgICAgICBjb25zdCBsZW5ndGggPSBieXRlTGVuZ3RoKHN0cmluZywgZW5jb2RpbmcpIHwgMDsKICAgICAgICBsZXQgYnVmID0gY3JlYXRlQnVmZmVyKGxlbmd0aCk7CiAgICAgICAgY29uc3QgYWN0dWFsID0gYnVmLndyaXRlKHN0cmluZywgZW5jb2RpbmcpOwogICAgICAgIGlmIChhY3R1YWwgIT09IGxlbmd0aCkgewogICAgICAgICAgYnVmID0gYnVmLnNsaWNlKDAsIGFjdHVhbCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBidWY7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZnJvbUFycmF5TGlrZShhcnJheSkgewogICAgICAgIGNvbnN0IGxlbmd0aCA9IGFycmF5Lmxlbmd0aCA8IDAgPyAwIDogY2hlY2tlZChhcnJheS5sZW5ndGgpIHwgMDsKICAgICAgICBjb25zdCBidWYgPSBjcmVh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wKSB7CiAgICAgICAgICBidWYgPSBuZXcgVWludDhBcnJheShhcnJheSk7CiAgICAgICAgfSBlbHNlIGlmIChsZW5ndGggPT09IHZvaWQgMCkgewogICAgICAgICAgYnVmID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXksIGJ5dGVPZmZzZXQpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBidWYgPSBuZXcgVWludDhBcnJheShhcnJheSwgYnl0ZU9mZnNldCwgbGVuZ3RoKTsKICAgICAgICB9CiAgICAgICAgT2JqZWN0LnNldFByb3RvdHlwZU9mKGJ1ZiwgQnVmZmVyMTAucHJvdG90eXBlKTsKICAgICAgICByZXR1cm4gYnVmOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGZyb21PYmplY3Qob2JqKSB7CiAgICAgICAgaWYgKEJ1ZmZlcjEwLmlzQnVmZmVyKG9iaikpIHsKICAgICAgICAgIGNvbnN0IGxlbiA9IGNoZWNrZWQob2JqLmxlbmd0aCkgfCAwOwogICAgICAgICAgY29uc3QgYnVmID0gY3JlYXRlQnVmZmVyKGxlbik7CiAgICAgICAgICBpZiAoYnVmLmxlbmd0aCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gYnVmOwogICAgICAgICAgfQogICAgICAgICAgb2JqLmNvcHkoYnVmLCAwLCAwLCBsZW4pOwogICAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai5sZW5ndGggIT09IHZvaWQgMCkgewogICAgICAgICAgaWYgKHR5cGVvZiBvYmoubGVuZ3RoICE9PSAibnVtYmVyIiB8fCBudW1iZXJJc05hTihvYmoubGVuZ3RoKSkgewogICAgICAgICAgICByZXR1cm4gY3JlYXRlQnVmZmVyKDApOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGZyb21BcnJheUxpa2Uob2JqKTsKICAgICAgICB9CiAgICAgICAgaWYgKG9iai50eXBlID09PSAiQnVmZmVyIiAmJiBBcnJheS5pc0FycmF5KG9i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Z3RoKTsKICAgICAgICBpZiAoIUJ1ZmZlcjEwLmlzQnVmZmVyKGEpIHx8ICFCdWZmZXIxMC5pc0J1ZmZlcihiKSkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignVGhlICJidWYxIiwgImJ1ZjIiIGFyZ3VtZW50cyBtdXN0IGJlIG9uZSBvZiB0eXBlIEJ1ZmZlciBvciBVaW50OEFycmF5Jyk7CiAgICAgICAgfQogICAgICAgIGlmIChhID09PSBiKQogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgbGV0IHggPSBhLmxlbmd0aDsKICAgICAgICBsZXQgeSA9IGIubGVuZ3RoOwogICAgICAgIGZvciAobGV0IGkgPSAwLCBsZW4gPSBNYXRoLm1pbih4LCB5KTsgaSA8IGxlbjsgKytpKSB7CiAgICAgICAgICBpZiAoYVtpXSAhPT0gYltpXSkgewogICAgICAgICAgICB4ID0gYVtpXTsKICAgICAgICAgICAgeSA9IGJbaV07CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoeCA8IHkpCiAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHkgPCB4KQogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgcmV0dXJuIDA7CiAgICAgIH07CiAgICAgIEJ1ZmZlcjEwLmlzRW5jb2RpbmcgPSBmdW5jdGlvbiBpc0VuY29kaW5nKGVuY29kaW5nKSB7CiAgICAgICAgc3dpdGNoIChTdHJpbmcoZW5jb2RpbmcpLnRvTG93ZXJDYXNlKCkpIHsKICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICBjYXNlICJ1dGY4IjoKICAgICAgICAgIGNhc2UgInV0Zi04IjoKICAgICAgICAgIGNhc2UgImFzY2lpIjoKICAgICAgICAgIGNhc2UgImxhdGluMSI6CiAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgY2FzZSAidWNzLTIiOgogICAgICAgICAgY2FzZSAidXRmMTZsZSI6CiAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgfTsKICAgICAgQnVmZmVyMTAuY29uY2F0ID0gZnVuY3Rpb24gY29uY2F0KGxpc3QsIGxlbmd0aCkgewogICAgICAgIGlmICghQXJyYXkuaXNBcnJheShsaXN0KSkgewogICAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignImxpc3QiIGFyZ3VtZW50IG11c3QgYmUgYW4gQXJyYXkgb2YgQnVmZmVycycpOwogICAgICAgIH0KICAgICAgICBpZiAobGlzdC5sZW5ndGggPT09IDApIHsKICAgICAgICAgIHJldHVybiBCdWZmZXIxMC5hbGxvYygwKTsKICAgICAgICB9CiAgICAgICAgbGV0IGk7CiAgICAgICAgaWYgKGxlbmd0aCA9PT0gdm9pZCAwKSB7CiAgICAgICAgICBsZW5ndGggPSAwOwogICAgICAgICAgZm9yIChpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyArK2kpIHsKICAgICAgICAgICAgbGVuZ3RoICs9IGxpc3RbaV0ubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb25zdCBidWZmZXIgPSBCdWZmZXIxMC5hbGxvY1Vuc2FmZShsZW5ndGgpOwogICAgICAgIGxldCBwb3MgPSAwOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgKytpKSB7CiAgICAgICAgICBsZXQgYnVmID0gbGlzdFtpXTsKICAgICAgICAgIGlmIChpc0luc3RhbmNlKGJ1ZiwgVWludDhBcnJheSkpIHsKICAgICAgICAgICAgaWYgKHBvcyArIGJ1Zi5sZW5ndGggPiBidWZmZXIubGVuZ3RoKSB7CiAgICAgICAgICAgICAgaWYgKCFCdWZmZXIxMC5pc0J1ZmZlcihidWYpKQogICAgICAgICAgICAgICAgYnVmID0gQnVmZmVyMTAuZnJvbShidWYpOwogICAgICAgICAgICAgIGJ1Zi5jb3B5KGJ1ZmZlciwgcG9zKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBVaW50OEFycmF5LnByb3RvdHlwZS5zZXQuY2FsbChidWZmZXIsIGJ1ZiwgcG9zKTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIGlmICghQnVmZmVyMTAuaXNCdWZmZXIoYnVmKSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCcibGlzdCIgYXJndW1lbnQgbXVzdCBiZSBhbiBBcnJheSBvZiBCdWZmZXJzJyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBidWYuY29weShidWZmZXIsIHBvcyk7CiAgICAgICAgICB9CiAgICAgICAgICBwb3MgKz0gYnVmLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZmZlcjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gYnl0ZUxlbmd0aChzdHJpbmcsIGVuY29kaW5nKSB7CiAgICAgICAgaWYgKEJ1ZmZlcjEwLmlzQnVmZmVyKHN0cmluZykpIHsKICAgICAgICAgIHJldHVybiBzdHJpbmcubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoQXJyYXlCdWZmZXIuaXNWaWV3KHN0cmluZykgfHwgaXNJbnN0YW5jZShzdHJpbmcsIEFycmF5QnVmZmVyKSkgewogICAgICAgICAgcmV0dXJuIHN0cmluZy5ieXRlTGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAodHlwZW9mIHN0cmluZyAhPT0gInN0cmluZyIpIHsKICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1RoZSAic3RyaW5nIiBhcmd1bWVudCBtdXN0IGJlIG9uZSBvZiB0eXBlIHN0cmluZywgQnVmZmVyLCBvciBBcnJheUJ1ZmZlci4gUmVjZWl2ZWQgdHlwZSAnICsgdHlwZW9mIHN0cmluZyk7CiAgICAgICAgfQogICAgICAgIGNvbnN0IGxlbiA9IHN0cmluZy5sZW5ndGg7CiAgICAgICAgY29uc3QgbXVzdE1hdGNoID0gYXJndW1lbnRzLmxlbmd0aCA+IDIgJiYgYXJndW1lbnRzWzJdID09PSB0cnVlOwogICAgICAgIGlmICghbXVzdE1hdGNoICYmIGxlbiA9PT0gMCkKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIGxldCBsb3dlcmVkQ2FzZSA9IGZhbHNlOwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgc3dpdGNoIChlbmNvZGluZykgewogICAgICAgICAgICBjYXNlICJhc2NpaSI6CiAgICAgICAgICAgIGNhc2UgImxhdGluMSI6CiAgICAgICAgICAgIGNhc2UgImJpbmFyeSI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbjsKICAgICAgICAgICAgY2FzZSAidXRmOCI6CiAgICAgICAgICAgIGNhc2UgInV0Zi04IjoKICAgICAgICAgICAgICByZXR1cm4gdXRmOFRvQnl0ZXMoc3RyaW5nKS5sZW5ndGg7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbiAqIDI7CiAgICAgICAgICAgIGNhc2UgImhleCI6CiAgICAgICAgICAgICAgcmV0dXJuIGxlbiA+Pj4gMTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0VG9CeXRlcyhzdHJpbmcpLmxlbmd0aDsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpIHsKICAgICAgICAgICAgICAgIHJldHVybiBtdXN0TWF0Y2ggPyAtMSA6IHV0ZjhUb0J5dGVzKHN0cmluZykubGVuZ3RoOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBlbmNvZGluZyA9ICgiIiArIGVuY29kaW5nKS50b0xvd2VyQ2FzZSgpOwogICAgICAgICAgICAgIGxvd2VyZWRDYXNlID0gdHJ1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgQnVmZmVyMTAuYnl0ZUxlbmd0aCA9IGJ5dGVMZW5ndGg7CiAgICAgIGZ1bmN0aW9uIHNsb3dUb1N0cmluZyhlbmNvZGluZywgc3RhcnQsIGVuZCkgewogICAgICAgIGxldCBsb3dlcmVkQ2FzZSA9IGZhbHNlOwogICAgICAgIGlmIChzdGFydCA9PT0gdm9pZCAwIHx8IHN0YXJ0IDwgMCkgewogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPiB0aGlzLmxlbmd0aCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kID09PSB2b2lkIDAgfHwgZW5kID4gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kIDw9IDApIHsKICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICB9CiAgICAgICAgZW5kID4+Pj0gMDsKICAgICAgICBzdGFydCA+Pj49IDA7CiAgICAgICAgaWYgKGVuZCA8PSBzdGFydCkgewogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICBpZiAoIWVuY29kaW5nKQogICAgICAgICAgZW5jb2RpbmcgPSAidXRmOCI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gaGV4U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICAgIHJldHVybiBhc2NpaVNsaWNlKHRoaXMsIHN0YXJ0LCBlbmQpOwogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBsYXRpbjFTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgY2FzZSAiYmFzZTY0IjoKICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0U2xpY2UodGhpcywgc3RhcnQsIGVuZCk7CiAgICAgICAgICAgIGNhc2UgInVjczIiOgogICAgICAgICAgICBjYXNlICJ1Y3MtMiI6CiAgICAgICAgICAgIGNhc2UgInV0ZjE2bGUiOgogICAgICAgICAgICBjYXNlICJ1dGYtMTZsZSI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjE2bGVTbGljZSh0aGlzLCBzdGFydCwgZW5kKTsKICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICBpZiAobG93ZXJlZENhc2UpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgICAgIGVuY29kaW5nID0gKGVuY29kaW5nICsgIiIpLnRvTG93ZXJDYXNlKCk7CiAgICAgICAgICAgICAgbG93ZXJlZENhc2UgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBCdWZmZXIxMC5wcm90b3R5cGUuX2lzQnVmZmVyID0gdHJ1ZTsKICAgICAgZnVuY3Rpb24gc3dhcChiLCBuLCBtKSB7CiAgICAgICAgY29uc3QgaSA9IGJbbl07CiAgICAgICAgYltuXSA9IGJbbV07CiAgICAgICAgYlttXSA9IGk7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXAxNiA9IGZ1bmN0aW9uIHN3YXAxNigpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgMiAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiAxNi1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDIpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDEpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXAzMiA9IGZ1bmN0aW9uIHN3YXAzMigpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgNCAhPT0gMCkgewogICAgICAgICAgdGhyb3cgbmV3IFJhbmdlRXJyb3IoIkJ1ZmZlciBzaXplIG11c3QgYmUgYSBtdWx0aXBsZSBvZiAzMi1iaXRzIik7CiAgICAgICAgfQogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuOyBpICs9IDQpIHsKICAgICAgICAgIHN3YXAodGhpcywgaSwgaSArIDMpOwogICAgICAgICAgc3dhcCh0aGlzLCBpICsgMSwgaSArIDIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnN3YXA2NCA9IGZ1bmN0aW9uIHN3YXA2NCgpIHsKICAgICAgICBjb25zdCBsZW4gPSB0aGlzLmxlbmd0aDsKICAgICAgICBpZiAobGVuICUgOCAhPT0gMCkgewogICAgICAgICAgdGhyb3cg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b3IgVWludDhBcnJheS4gUmVjZWl2ZWQgdHlwZSAnICsgdHlwZW9mIHRhcmdldCk7CiAgICAgICAgfQogICAgICAgIGlmIChzdGFydCA9PT0gdm9pZCAwKSB7CiAgICAgICAgICBzdGFydCA9IDA7CiAgICAgICAgfQogICAgICAgIGlmIChlbmQgPT09IHZvaWQgMCkgewogICAgICAgICAgZW5kID0gdGFyZ2V0ID8gdGFyZ2V0Lmxlbmd0aCA6IDA7CiAgICAgICAgfQogICAgICAgIGlmICh0aGlzU3RhcnQgPT09IHZvaWQgMCkgewogICAgICAgICAgdGhpc1N0YXJ0ID0gMDsKICAgICAgICB9CiAgICAgICAgaWYgKHRoaXNFbmQgPT09IHZvaWQgMCkgewogICAgICAgICAgdGhpc0VuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPCAwIHx8IGVuZCA+IHRhcmdldC5sZW5ndGggfHwgdGhpc1N0YXJ0IDwgMCB8fCB0aGlzRW5kID4gdGhpcy5sZW5ndGgpIHsKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJvdXQgb2YgcmFuZ2UgaW5kZXgiKTsKICAgICAgICB9CiAgICAgICAgaWYgKHRoaXNTdGFydCA+PSB0aGlzRW5kICYmIHN0YXJ0ID49IGVuZCkgewogICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgICAgIGlmICh0aGlzU3RhcnQgPj0gdGhpc0VuZCkgewogICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPj0gZW5kKSB7CiAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgc3RhcnQgPj4+PSAwOwogICAgICAgIGVuZCA+Pj49IDA7CiAgICAgICAgdGhpc1N0YXJ0ID4+Pj0gMDsKICAgICAgICB0aGlzRW5kID4+Pj0gMDsKICAgICAgICBpZiAodGhpcyA9PT0gdGFyZ2V0KQogICAgICAgICAgcmV0dXJ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gaWYgKGJ5dGVPZmZzZXQgPCAtMjE0NzQ4MzY0OCkgewogICAgICAgICAgYnl0ZU9mZnNldCA9IC0yMTQ3NDgzNjQ4OwogICAgICAgIH0KICAgICAgICBieXRlT2Zmc2V0ID0gK2J5dGVPZmZzZXQ7CiAgICAgICAgaWYgKG51bWJlcklzTmFOKGJ5dGVPZmZzZXQpKSB7CiAgICAgICAgICBieXRlT2Zmc2V0ID0gZGlyID8gMCA6IGJ1ZmZlci5sZW5ndGggLSAxOwogICAgICAgIH0KICAgICAgICBpZiAoYnl0ZU9mZnNldCA8IDApCiAgICAgICAgICBieXRlT2Zmc2V0ID0gYnVmZmVyLmxlbmd0aCArIGJ5dGVPZmZzZXQ7CiAgICAgICAgaWYgKGJ5dGVPZmZzZXQgPj0gYnVmZmVyLmxlbmd0aCkgewogICAgICAgICAgaWYgKGRpcikKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgZWxzZQogICAgICAgICAgICBieXRlT2Zmc2V0ID0gYnVmZmVyLmxlbmd0aCAtIDE7CiAgICAgICAgfSBlbHNlIGlmIChieXRlT2Zmc2V0IDwgMCkgewogICAgICAgICAgaWYgKGRpcikKICAgICAgICAgICAgYnl0ZU9mZnNldCA9IDA7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICB2YWwgPSBCdWZmZXIxMC5mcm9tKHZhbCwgZW5jb2RpbmcpOwogICAgICAgIH0KICAgICAgICBpZiAoQnVmZmVyMTAuaXNCdWZmZXIodmFsKSkgewogICAgICAgICAgaWYgKHZhbC5sZW5ndGggPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIGFycmF5SW5kZXhPZihidWZmZXIsIHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcik7CiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsID09PSAibnVtYmVyIikgewogICAgICAgICAgdmFsID0gdmFsICYgMjU1OwogICAgICAgICAgaWYgKHR5cGVvZiBVaW50OEFycmF5LnByb3RvdHlwZS5pbmRleE9mID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIGlmIChkaXIpIHsKICAgICAgICAgICAgICByZXR1cm4gVWludDhBcnJheS5wcm90b3R5cGUuaW5kZXhPZi5jYWxsKGJ1ZmZlciwgdmFsLCBieXRlT2Zmc2V0KTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICByZXR1cm4gVWludDhBcnJheS5wcm90b3R5cGUubGFzdEluZGV4T2YuY2FsbChidWZmZXIsIHZhbCwgYnl0ZU9mZnNldCk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBhcnJheUluZGV4T2YoYnVmZmVyLCBbdmFsXSwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcik7CiAgICAgICAgfQogICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoInZhbCBtdXN0IGJlIHN0cmluZywgbnVtYmVyIG9yIEJ1ZmZlciIpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGFycmF5SW5kZXhPZihhcnIsIHZhbCwgYnl0ZU9mZnNldCwgZW5jb2RpbmcsIGRpcikgewogICAgICAgIGxldCBpbmRleFNpemUgPSAxOwogICAgICAgIGxldCBhcnJMZW5ndGggPSBhcnIubGVuZ3RoOwogICAgICAgIGxldCB2YWxMZW5ndGggPSB2YWwubGVuZ3RoOwogICAgICAgIGlmIChlbmNvZGluZyAhPT0gdm9pZCAwKSB7CiAgICAgICAgICBlbmNvZGluZyA9IFN0cmluZyhlbmNvZGluZykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgIGlmIChlbmNvZGluZyA9PT0gInVjczIiIHx8IGVuY29kaW5nID09PSAidWNzLTIiIHx8IGVuY29kaW5nID09PSAidXRmMTZsZSIgfHwgZW5jb2RpbmcgPT09ICJ1dGYtMTZsZSIpIHsKICAgICAgICAgICAgaWYgKGFyci5sZW5ndGggPCAyIHx8IHZhbC5sZW5ndGggPCAyKSB7CiAgICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGluZGV4U2l6ZSA9IDI7CiAgICAgICAgICAgIGFyckxlbmd0aCAvPSAyOwogICAgICAgICAgICB2YWxMZW5ndGggLz0gMjsKICAgICAgICAgICAgYnl0ZU9mZnNldCAvPSAyOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiByZWFkKGJ1ZiwgaTIpIHsKICAgICAgICAgIGlmIChpbmRleFNpemUgPT09IDEpIHsKICAgICAgICAgICAgcmV0dXJuIGJ1ZltpMl07CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gYnVmLnJlYWRVSW50MTZCRShpMiAqIGluZGV4U2l6ZSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGxldCBpOwogICAgICAgIGlmIChkaXIpIHsKICAgICAgICAgIGxldCBmb3VuZEluZGV4ID0gLTE7CiAgICAgICAgICBmb3IgKGkgPSBieXRlT2Zmc2V0OyBpIDwgYXJyTGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgaWYgKHJlYWQoYXJyLCBpKSA9PT0gcmVhZCh2YWwsIGZvdW5kSW5kZXggPT09IC0xID8gMCA6IGkgLSBmb3VuZEluZGV4KSkgewogICAgICAgICAgICAgIGlmIChmb3VuZEluZGV4ID09PSAtMSkKICAgICAgICAgICAgICAgIGZvdW5kSW5kZXggPSBpOwogICAgICAgICAgICAgIGlmIChpIC0gZm91bmRJbmRleCArIDEgPT09IHZhbExlbmd0aCkKICAgICAgICAgICAgICAgIHJldHVybiBmb3VuZEluZGV4ICogaW5kZXhTaXplOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGlmIChmb3VuZEluZGV4ICE9PSAtMSkKICAgICAgICAgICAgICAgIGkgLT0gaSAtIGZvdW5kSW5kZXg7CiAgICAgICAgICAgICAgZm91bmRJbmRleCA9IC0xOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGlmIChieXRlT2Zmc2V0ICsgdmFsTGVuZ3RoID4gYXJyTGVuZ3RoKQogICAgICAgICAgICBieXRlT2Zmc2V0ID0gYXJyTGVuZ3RoIC0gdmFsTGVuZ3RoOwogICAgICAgICAgZm9yIChpID0gYnl0ZU9mZnNldDsgaSA+PSAwOyBpLS0pIHsKICAgICAgICAgICAgbGV0IGZvdW5kID0gdHJ1ZTsKICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCB2YWxMZW5ndGg7IGorKykgewogICAgICAgICAgICAgIGlmIChyZWFkKGFyciwgaSArIGopICE9PSByZWFkKHZhbCwgaikpIHsKICAgICAgICAgICAgICAgIGZvdW5kID0gZmFsc2U7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGZvdW5kKQogICAgICAgICAgICAgIHJldHVybiBpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gLTE7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLmluY2x1ZGVzID0gZnVuY3Rpb24gaW5jbHVkZXModmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiB0aGlzLmluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgIT09IC0xOwogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUuaW5kZXhPZiA9IGZ1bmN0aW9uIGluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBiaWRpcmVjdGlvbmFsSW5kZXhPZih0aGlzLCB2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nLCB0cnVlKTsKICAgICAgfTsKICAgICAgQnVmZmVyMTAucHJvdG90eXBlLmxhc3RJbmRleE9mID0gZnVuY3Rpb24gbGFzdEluZGV4T2YodmFsLCBieXRlT2Zmc2V0LCBlbmNvZGluZykgewogICAgICAgIHJldHVybiBiaWRpcmVjdGlvbmFsSW5kZXhPZih0aGlzLCB2YWwsIGJ5dGVPZmZzZXQsIGVuY29kaW5nLCBmYWxzZSk7CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGhleFdyaXRlKGJ1Ziwgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCkgewogICAgICAgIG9mZnNldCA9IE51bWJlcihvZmZzZXQpIHx8IDA7CiAgICAgICAgY29uc3QgcmVtYWluaW5nID0gYnVmLmxlbmd0aCAtIG9mZnNldDsKICAgICAgICBpZiAoIWxlbmd0aCkgewogICAgICAgICAgbGVuZ3RoID0gcmVtYWluaW5nOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBsZW5ndGggPSBOdW1iZXIobGVuZ3RoKTsKICAgICAgICAgIGlmIChsZW5ndGggPiByZW1haW5pbmcpIHsKICAgICAgICAgICAgbGVuZ3RoID0gcmVtYWluaW5nOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBjb25zdCBzdHJMZW4gPSBzdHJpbmcubGVuZ3RoOwogICAgICAgIGlmIChsZW5ndGggPiBzdHJMZW4gLyAyKSB7CiAgICAgICAgICBsZW5ndGggPSBzdHJMZW4gLyAyOwogICAgICAgIH0KICAgICAgICBsZXQgaTsKICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGNvbnN0IHBhcnNlZCA9IHBhcnNlSW50KHN0cmluZy5zdWJzdHIoaSAqIDIsIDIpLCAxNik7CiAgICAgICAgICBpZiAobnVtYmVySXNOYU4ocGFyc2VkKSkKICAgICAgICAgICAgcmV0dXJuIGk7CiAgICAgICAgICBidWZbb2Zmc2V0ICsgaV0gP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QgdG8gd3JpdGUgb3V0c2lkZSBidWZmZXIgYm91bmRzIik7CiAgICAgICAgfQogICAgICAgIGlmICghZW5jb2RpbmcpCiAgICAgICAgICBlbmNvZGluZyA9ICJ1dGY4IjsKICAgICAgICBsZXQgbG93ZXJlZENhc2UgPSBmYWxzZTsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIHN3aXRjaCAoZW5jb2RpbmcpIHsKICAgICAgICAgICAgY2FzZSAiaGV4IjoKICAgICAgICAgICAgICByZXR1cm4gaGV4V3JpdGUodGhpcywgc3RyaW5nLCBvZmZzZXQsIGxlbmd0aCk7CiAgICAgICAgICAgIGNhc2UgInV0ZjgiOgogICAgICAgICAgICBjYXNlICJ1dGYtOCI6CiAgICAgICAgICAgICAgcmV0dXJuIHV0ZjhXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgY2FzZSAiYXNjaWkiOgogICAgICAgICAgICBjYXNlICJsYXRpbjEiOgogICAgICAgICAgICBjYXNlICJiaW5hcnkiOgogICAgICAgICAgICAgIHJldHVybiBhc2NpaVdyaXRlKHRoaXMsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpOwogICAgICAgICAgICBjYXNlICJiYXNlNjQiOgogICAgICAgICAgICAgIHJldHVybiBiYXNlNjRXcml0ZSh0aGlzLCBzdHJpbmcsIG9mZnNldCwgbGVuZ3RoKTsKICAgICAgICAgICAgY2FzZSAidWNzMiI6CiAgICAgICAgICAgIGNhc2UgInVjcy0yIjoKICAgICAgICAgICAgY2FzZSAidXRmMTZsZSI6CiAgICAgICAgICAgIGNhc2UgInV0Zi0xNmxlIjoKICAgICAgICAgICAgICByZXR1cm4gdWNzMldyaXRlKHRoaXMsIHN0cmluZywgb2Zmc2V0LCBsZW5ndGgpOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgIGlmIChsb3dlcmVkQ2FzZSkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoIlVua25vd24gZW5jb2Rpbmc6ICIgKyBlbmNvZGluZyk7CiAgICAgICAgICAgICAgZW5jb2RpbmcgPSAoIiIgKyBlbmNvZGluZykudG9Mb3dlckNhc2UoKTsKICAgICAgICAgICAgICBsb3dlcmVkQ2FzZSA9IHRydWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9OwogICAgICBCdWZmZXIxMC5wcm90b3R5cGUudG9KU09OID0gZnVuY3Rpb24gdG9KU09OKCkgewogICAgICAgIHJldHVybiB7CiAgICAgICAgICB0eXBlOiAiQnVmZmVyIiwKICAgICAgICAgIGRhdGE6IEFycmF5LnByb3RvdHlwZS5zbGljZS5jYWxsKHRoaXMuX2FyciB8fCB0aGlzLCAwKQogICAgICAgIH07CiAgICAgIH07CiAgICAgIGZ1bmN0aW9uIGJhc2U2NFNsaWNlKGJ1Ziwgc3RhcnQsIGVuZCkgewogICAgICAgIGlmIChzdGFydCA9PT0gMCAmJiBlbmQgPT09IGJ1Zi5sZW5ndGgpIHsKICAgICAgICAgIHJldHVybiBiYXNlNjQuZnJvbUJ5dGVBcnJheShidWYpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICByZXR1cm4gYmFzZTY0LmZyb21CeXRlQXJyYXkoYnVmLnNsaWNlKHN0YXJ0LCBlbmQpKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdXRmOFNsaWNlKGJ1Ziwgc3RhcnQsIGVuZCkgewogICAgICAgIGVuZCA9IE1hdGgubWluKGJ1Zi5sZW5ndGgsIGVuZCk7CiAgICAgICAgY29uc3QgcmVzID0gW107CiAgICAgICAgbGV0IGkgPSBzdGFydDsKICAgICAgICB3aGlsZSAoaSA8IGVuZCkgewogICAgICAgICAgY29uc3QgZmlyc3RCeXRlID0gYnVmW2ldOwogICAgICAgICAgbGV0IGNvZGVQb2ludCA9IG51bGw7CiAgICAgICAgICBsZXQgYnl0ZXNQZXJTZXF1ZW5jZSA9IGZpcnN0Qnl0ZSA+IDIzOSA/IDQgOiBmaXJzdEJ5dGUgPiAyMjMgPyAzIDogZmlyc3RCeXRlID4gMTkxID8gMiA6IDE7CiAgICAgICAgICBpZiAoaSArIGJ5dGVzUGVyU2VxdWVuY2UgPD0gZW5kKSB7CiAgICAgICAgICAgIGxldCBzZWNvbmRCeXRlLCB0aGlyZEJ5dGUsIGZvdXJ0aEJ5dGUsIHRlbXBDb2RlUG9pbnQ7CiAgICAgICAgICAgIHN3aXRjaCAoYnl0ZXNQZXJTZXF1ZW5jZSkgewogICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgIGlmIChmaXJzdEJ5dGUgPCAxMjgpIHsKICAgICAgICAgICAgICAgICAgY29kZVBvaW50ID0gZmlyc3RCeXRlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgc2Vjb25kQnl0ZSA9IGJ1ZltpICsgMV07CiAgICAgICAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAxOTIpID09PSAxMjgpIHsKICAgICAgICAgICAgICAgICAgdGVtcENvZGVQb2ludCA9IChmaXJzdEJ5dGUgJiAzMSkgPDwgNiB8IHNlY29uZEJ5dGUgJiA2MzsKICAgICAgICAgICAgICAgICAgaWYgKHRlbXBDb2RlUG9pbnQgPiAxMjcpIHsKICAgICAgICAgICAgICAgICAgICBjb2RlUG9pbnQgPSB0ZW1wQ29kZVBvaW50OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIDM6CiAgICAgICAgICAgICAgICBzZWNvbmRCeXRlID0gYnVmW2kgKyAxXTsKICAgICAgICAgICAgICAgIHRoaXJkQnl0ZSA9IGJ1ZltpICsgMl07CiAgICAgICAgICAgICAgICBpZiAoKHNlY29uZEJ5dGUgJiAxOTIpID09PSAxMjggJiYgKHRoa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AgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKGNvZGVQb2ludCA9PT0gbnVsbCkgewogICAgICAgICAgICBjb2RlUG9pbnQgPSA2NTUzMzsKICAgICAgICAgICAgYnl0ZXNQZXJTZXF1ZW5jZSA9IDE7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA+IDY1NTM1KSB7CiAgICAgICAgICAgIGNvZGVQb2ludCAtPSA2NTUzNjsKICAgICAgICAgICAgcmVzLnB1c2goY29kZVBvaW50ID4+PiAxMCAmIDEwMjMgfCA1NTI5Nik7CiAgICAgICAgICAgIGNvZGVQb2ludCA9IDU2MzIwIHwgY29kZVBvaW50ICYgMTAyMzsKICAgICAgICAgIH0KICAgICAgICAgIHJlcy5wdXNoKGNvZGVQb2ludCk7CiAgICAgICAgICBpICs9IGJ5dGVzUGVyU2VxdWVuY2U7CiAgICAgICAgfQogICAgICAgIHJldHVybiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkocmVzKTsKICAgICAgfQogICAgICB2YXIgTUFYX0FSR1VNRU5UU19MRU5HVEggPSA0MDk2OwogICAgICBmdW5jdGlvbiBkZWNvZGVDb2RlUG9pbnRzQXJyYXkoY29kZVBvaW50cykgewogICAgICAgIGNvbnN0IGxlbiA9IGNvZGVQb2ludHMubGVuZ3RoOwogICAgICAgIGlmIChsZW4gPD0gTUFYX0FSR1VNRU5UU19MRU5HVEgpIHsKICAgICAgICAgIHJldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cyk7CiAgICAgICAgfQogICAgICAgIGxldCByZXMgPSAiIjsKICAgICAgICBsZXQgaSA9IDA7CiAgICAgICAgd2hpbGUgKGkgPCBsZW4pIHsKICAgICAgICAgIHJlcyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KFN0cmluZywgY29kZVBvaW50cy5zbGljZShpLCBpICs9IE1BWF9BUkdVTUVOVFNfTEVOR1RIKSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYXNjaWlTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldICYgMTI3KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBsYXRpbjFTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBsZXQgcmV0ID0gIiI7CiAgICAgICAgZW5kID0gTWF0aC5taW4oYnVmLmxlbmd0aCwgZW5kKTsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgcmV0ICs9IFN0cmluZy5mcm9tQ2hhckNvZGUoYnVmW2ldKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJldDsKICAgICAgfQogICAgICBmdW5jdGlvbiBoZXhTbGljZShidWYsIHN0YXJ0LCBlbmQpIHsKICAgICAgICBjb25zdCBsZW4gPSBidWYubGVuZ3RoOwogICAgICAgIGlmICghc3RhcnQgfHwgc3RhcnQgPCAwKQogICAgICAgICAgc3RhcnQgPSAwOwogICAgICAgIGlmICghZW5kIHx8IGVuZCA8IDAgfHwgZW5kID4gbGVuKQogICAgICAgICAgZW5kID0gbGVuOwogICAgICAgIGxldCBvdXQgPSAiIjsKICAgICAgICBmb3IgKGxldCBpID0gc3RhcnQ7IGkgPCBlbmQ7ICsraSkgewogICAgICAgICAgb3V0ICs9IGhleFNsaWNlTG9va3VwVGFibGVbYnVmW2ldXTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG91dDsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNmxlU2xpY2UoYnVmLCBzdGFydCwgZW5kKSB7CiAgICAgICAgY29uc3QgYnl0ZXMgPSBidWYuc2xpY2Uoc3RhcnQsIGVuZCk7CiAgICAgICAgbGV0IHJlcyA9ICIiOwogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYnl0ZXMubGVuZ3RoIC0gMTsgaSArPSAyKSB7CiAgICAgICAgICByZXMgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShieXRlc1tpXSArIGJ5dGVzW2kgKyAxXSAqIDI1Nik7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXM7CiAgICAgIH0KICAgICAgQnVmZmVyMTAucHJvdG90eXBlLnNsaWNlID0gZnVuY3Rpb24gc2xpY2Uoc3RhcnQsIGVuZCkgewogICAgICAgIGNvbnN0IGxlbiA9IHRoaXMubGVuZ3RoOwogICAgICAgIHN0YXJ0ID0gfn5zdGFydDsKICAgICAgICBlbmQgPSBlbmQgPT09IHZvaWQgMCA/IGxlbiA6IH5+ZW5kOwogICAgICAgIGlmIChzdGFydCA8IDApIHsKICAgICAgICAgIHN0YXJ0ICs9IGxlbjsKICAgICAgICAgIGlmIChzdGFydCA8IDApCiAgICAgICAgICAgIHN0YXJ0ID0gMDsKICAgICAgICB9IGVsc2UgaWYgKHN0YXJ0ID4gbGVuKSB7CiAgICAgICAgICBzdGFydCA9IGxlbjsKICAgICAgICB9CiAgICAgICAgaWYgKGVuZCA8IDApIHsKICAgICAgICAgIGVuZCArPSBsZW47CiAgICAgICAgICBpZiAoZW5kIDwgMCkKICAgICAgICAgICAgZW5kID0gMDsKICAgICAgICB9IGVsc2UgaWYgKGVuZCA+IGxlbikgewogICAgICAgICAgZW5kID0gbGVuOwogICAgICAgIH0KICAgICAgICBpZiAoZW5kIDwgc3RhcnQpCiAgICAgICAgICBlbmQgPSBzdGFydDsKICAgICAgICBjb25zdCBuZXdCdWYgPS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hcmdldCAmJiB0eXBlb2YgVWludDhBcnJheS5wcm90b3R5cGUuY29weVdpdGhpbiA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgdGhpcy5jb3B5V2l0aGluKHRhcmdldFN0YXJ0LCBzdGFydCwgZW5kKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgVWludDhBcnJheS5wcm90b3R5cGUuc2V0LmNhbGwodGFyZ2V0LCB0aGlzLnN1YmFycmF5KHN0YXJ0LCBlbmQpLCB0YXJnZXRTdGFydCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBsZW47CiAgICAgIH07CiAgICAgIEJ1ZmZlcjEwLnByb3RvdHlwZS5maWxsID0gZnVuY3Rpb24gZmlsbCh2YWwsIHN0YXJ0LCBlbmQsIGVuY29kaW5nKSB7CiAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICBpZiAodHlwZW9mIHN0YXJ0ID09PSAic3RyaW5nIikgewogICAgICAgICAgICBlbmNvZGluZyA9IHN0YXJ0OwogICAgICAgICAgICBzdGFydCA9IDA7CiAgICAgICAgICAgIGVuZCA9IHRoaXMubGVuZ3RoOwogICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgZW5kID09PSAic3RyaW5nIikgewogICAgICAgICAgICBlbmNvZGluZyA9IGVuZDsKICAgICAgICAgICAgZW5kID0gdGhpcy5sZW5ndGg7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoZW5jb2RpbmcgIT09IHZvaWQgMCAmJiB0eXBlb2YgZW5jb2RpbmcgIT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoImVuY29kaW5nIG11c3QgYmUgYSBzdHJpbmciKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0eXBlb2YgZW5jb2RpbmcgPT09ICJzdHJpbmciICYmICFCdWZmZXIxMC5pc0VuY29kaW5nKGVuY29kaW5nKSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJVbmtub3duIGVuY29kaW5nOiAiICsgZW5jb2RpbmcpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHZhbC5sZW5ndGggPT09IDEpIHsKICAgICAgICAgICAgY29uc3QgY29kZSA9IHZhbC5jaGFyQ29kZUF0KDApOwogICAgICAgICAgICBpZiAoZW5jb2RpbmcgPT09ICJ1dGY4IiAmJiBjb2RlIDwgMTI4IHx8IGVuY29kaW5nID09PSAibGF0aW4xIikgewogICAgICAgICAgICAgIHZhbCA9IGNvZGU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiB2YWwgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICB2YWwgPSB2YWwgJiAyNTU7CiAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsID09PSAiYm9vbGVhbiIpIHsKICAgICAgICAgIHZhbCA9IE51bWJlcih2YWwpOwogICAgICAgIH0KICAgICAgICBpZiAoc3RhcnQgPCAwIHx8IHRoaXMubGVuZ3RoIDwgc3RhcnQgfHwgdGhpcy5sZW5ndGggPCBlbmQpIHsKICAgICAgICAgIHRocm93IG5ldyBSYW5nZUVycm9yKCJPdXQgb2YgcmFuZ2UgaW5kZXgiKTsKICAgICAgICB9CiAgICAgICAgaWYgKGVuZCA8PSBzdGFydCkgewogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgfQogICAgICAgIHN0YXJ0ID0gc3RhcnQgPj4+IDA7CiAgICAgICAgZW5kID0gZW5kID09PSB2b2lkIDAgPyB0aGlzLmxlbmd0aCA6IGVuZCA+Pj4gMDsKICAgICAgICBpZiAoIXZhbCkKICAgICAgICAgIHZhbCA9IDA7CiAgICAgICAgbGV0IGk7CiAgICAgICAgaWYgKHR5cGVvZiB2YWwgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICBmb3IgKGkgPSBzdGFydDsgaSA8IGVuZDsgKytpKSB7CiAgICAgICAgICAgIHRoaXNbaV0gPSB2YWw7CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGNvbnN0IGJ5dGVzID0gQnVmZmVyMTAuaXNCdWZmZXIodmFsKSA/IHZhbCA6IEJ1ZmZlcjEwLmZyb20odmFsLCBlbmNvZGluZyk7CiAgICAgICAgICBjb25zdCBsZW4gPSBieXRlcy5sZW5ndGg7CiAgICAgICAgICBpZiAobGVuID09PSAwKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoJ1RoZSB2YWx1ZSAiJyArIHZhbCArICciIGlzIGludmFsaWQgZm9yIGFyZ3VtZW50ICJ2YWx1ZSInKTsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBlbmQgLSBzdGFydDsgKytpKSB7CiAgICAgICAgICAgIHRoaXNbaSArIHN0YXJ0XSA9IGJ5dGVzW2kgJSBsZW5dOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gdGhpczsKICAgICAgfTsKICAgICAgdmFyIGVycm9ycyA9IHt9OwogICAgICBmdW5jdGlvbiBFKHN5bSwgZ2V0TWVzc2FnZSwgQmFzZSkgewogICAgICAgIGVycm9yc1tzeW1dID0gY2xhc3MgTm9kZUVycm9yIGV4dGVuZHMgQmFzZSB7CiAgICAgICAgICBjb25zdHJ1Y3RvcigpIHsKICAgICAgICAgICAgc3VwZXIoKTsKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJtZXNzYWdlIiwgewogICAgICAgICAgICAgIHZhbHVlOiBnZXRNZXNzYWdlLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyksCiAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICAgIH0pOwogICAgICAgICAgICB0aGlzLm5hbWUgPSBgJHt0aGlzLm5hbWV9IFske3N5bX1dYDsKICAgICAgICAgICAgdGhpcy5zdGFjazsKICAgICAgICAgICAgZGVsZXRlIHRoaXMubmFtZTsKICAgICAgICAgIH0KICAgICAgICAgIGdldCBjb2RlKCkgewogICAgICAgICAgICByZXR1cm4gc3ltOwogICAgICAgICAgfQogICAgICAgICAgc2V0IGNvZGUodmFsdWUpIHsKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICJjb2RlIiwgewogICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLAogICAgICAgICAgICAgIHZhbHVlLAogICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlCiAgICAgICAgICAgIH0pOwogICAgICAgICAgfQogICAgICAgICAgdG9TdHJpbmcoKSB7CiAgICAgICAgICAgIHJldHVybiBgJHt0aGlzLm5hbWV9IFske3N5bX1dOiAke3RoaXMubWVzc2FnZX1gOwogICAgICAgICAgfQogICAgICAgIH07CiAgICAgIH0KICAgICAgRSgiRVJSX0JVRkZFUl9PVVRfT0ZfQk9VTkRTIiwgZnVuY3Rpb24obmFtZSkgewogICAgICAgIGlmIChuYW1lKSB7CiAgICAgICAgICByZXR1cm4gYCR7bmFtZX0gaXMgb3V0c2lkZSBvZiBidWZmZXIgYm91bmRzYDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuICJBdHRlbXB0IHRvIGFjY2VzcyBtZW1vcnkgb3V0c2lkZSBidWZmZXIgYm91bmRzIjsKICAgICAgfSwgUmFuZ2VFcnJvcik7CiAgICAgIEUoIkVSUl9JTlZBTElEX0FSR19UWVBFIiwgZnVuY3Rpb24obmFtZSwgYWN0dWFsKSB7CiAgICAgICAgcmV0dXJuIGBUaGUgIiR7bmFtZX0iIGFyZ3VtZW50IG11c3QgYmUgb2YgdHlwZSBudW1iZXIuIFJlY2VpdmVkIHR5cGUgJHt0eXBlb2YgYWN0dWFsfWA7CiAgICAgIH0sIFR5cGVFcnJvcik7CiAgIC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k7CiAgICAgIH0KICAgICAgdmFyIElOVkFMSURfQkFTRTY0X1JFID0gL1teKy8wLTlBLVphLXotX10vZzsKICAgICAgZnVuY3Rpb24gYmFzZTY0Y2xlYW4oc3RyKSB7CiAgICAgICAgc3RyID0gc3RyLnNwbGl0KCI9IilbMF07CiAgICAgICAgc3RyID0gc3RyLnRyaW0oKS5yZXBsYWNlKElOVkFMSURfQkFTRTY0X1JFLCAiIik7CiAgICAgICAgaWYgKHN0ci5sZW5ndGggPCAyKQogICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIHdoaWxlIChzdHIubGVuZ3RoICUgNCAhPT0gMCkgewogICAgICAgICAgc3RyID0gc3RyICsgIj0iOwogICAgICAgIH0KICAgICAgICByZXR1cm4gc3RyOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHV0ZjhUb0J5dGVzKHN0cmluZywgdW5pdHMpIHsKICAgICAgICB1bml0cyA9IHVuaXRzIHx8IEluZmluaXR5OwogICAgICAgIGxldCBjb2RlUG9pbnQ7CiAgICAgICAgY29uc3QgbGVuZ3RoID0gc3RyaW5nLmxlbmd0aDsKICAgICAgICBsZXQgbGVhZFN1cnJvZ2F0ZSA9IG51bGw7CiAgICAgICAgY29uc3QgYnl0ZXMgPSBbXTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgKytpKSB7CiAgICAgICAgICBjb2RlUG9pbnQgPSBzdHJpbmcuY2hhckNvZGVBdChpKTsKICAgICAgICAgIGlmIChjb2RlUG9pbnQgPiA1NTI5NSAmJiBjb2RlUG9pbnQgPCA1NzM0NCkgewogICAgICAgICAgICBpZiAoIWxlYWRTdXJyb2dhdGUpIHsKICAgICAgICAgICAgICBpZiAoY29kZVBvaW50ID4gNTYzMTkpIHsKICAgICAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPiAtMSkKICAgICAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgIH0gZWxzZSBpZiAoaSArIDEgPT09IGxlbmd0aCkgewogICAgICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgICAgICBieXRlcy5wdXNoKDIzOSwgMTkxLCAxODkpOwogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGxlYWRTdXJyb2dhdGUgPSBjb2RlUG9pbnQ7CiAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKGNvZGVQb2ludCA8IDU2MzIwKSB7CiAgICAgICAgICAgICAgaWYgKCh1bml0cyAtPSAzKSA+IC0xKQogICAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgICAgICBsZWFkU3Vycm9nYXRlID0gY29kZVBvaW50OwogICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGNvZGVQb2ludCA9IChsZWFkU3Vycm9nYXRlIC0gNTUyOTYgPDwgMTAgfCBjb2RlUG9pbnQgLSA1NjMyMCkgKyA2NTUzNjsKICAgICAgICAgIH0gZWxzZSBpZiAobGVhZFN1cnJvZ2F0ZSkgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDMpID4gLTEpCiAgICAgICAgICAgICAgYnl0ZXMucHVzaCgyMzksIDE5MSwgMTg5KTsKICAgICAgICAgIH0KICAgICAgICAgIGxlYWRTdXJyb2dhdGUgPSBudWxsOwogICAgICAgICAgaWYgKGNvZGVQb2ludCA8IDEyOCkgewogICAgICAgICAgICBpZiAoKHVuaXRzIC09IDEpIDwgMCkKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgYnl0ZXMucHVzaChjb2RlUG9pbnQpOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPCAyMDQ4KSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMikgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiA2IHwgMTkyLCBjb2RlUG9pbnQgJiA2MyB8IDEyOCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVQb2ludCA8IDY1NTM2KSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gMykgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiAxMiB8IDIyNCwgY29kZVBvaW50ID4+IDYgJiA2MyB8IDEyOCwgY29kZVBvaW50ICYgNjMgfCAxMjgpOwogICAgICAgICAgfSBlbHNlIGlmIChjb2RlUG9pbnQgPCAxMTE0MTEyKSB7CiAgICAgICAgICAgIGlmICgodW5pdHMgLT0gNCkgPCAwKQogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBieXRlcy5wdXNoKGNvZGVQb2ludCA+PiAxOCB8IDI0MCwgY29kZVBvaW50ID4+IDEyICYgNjMgfCAxMjgsIGNvZGVQb2ludCA+PiA2ICYgNjMgfCAxMjgsIGNvZGVQb2ludCAmIDYzIHwgMTI4KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigiSW52YWxpZCBjb2RlIHBvaW50Iik7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBieXRlczsKICAgICAgfQogICAgICBmdW5jdGlvbiBhc2NpaVRvQnl0ZXMoc3RyKSB7CiAgICAgICAgY29uc3QgYnl0ZUFycmF5ID0gW107CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBzdHIubGVuZ3RoOyArK2kpIHsKICAgICAgICAgIGJ5dGVBcnJheS5wdXNoKHN0ci5jaGFyQ29kZUF0KGkpICYgMjU1KTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ5dGVBcnJheTsKICAgICAgfQogICAgICBmdW5jdGlvbiB1dGYxNmxlVG9CeXRlcyhzdHIsIHVuaXRzKSB7CiAgICAgICAgbGV0IGMsIGhpLCBsbzsKICAgICAgICBjb25zdCBieXRlQXJyYXkgPSBbXTsKICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0ci5sZW5ndGg7ICsraSkgewogICAgICAgICAgaWYgKCh1bml0cyAtPSAyKSA8IDApCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgYyA9IHN0ci5jaGFyQ29kZUF0KGkpOwogICAgICAgICAgaGkgPSBjID4+IDg7CiAgICAgICAgICBsbyA9IGMgJSAyNTY7CiAgICAgICAgICBieXRlQXJyYXkucHVzaChsbyk7CiAgICAgICAgICBieXRlQXJyYXkucHVzaChoaSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBieXRlQXJyYXk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYmFzZTY0VG9CeXRlcyhzdHIpIHsKICAgICAgICByZXR1cm4gYmFzZTY0LnRvQnl0ZUFycmF5KGJhc2U2NGNsZWFuKHN0cikpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJsaXRCdWZmZXIoc3JjLCBkc3QsIG9mZnNldCwgbGVuZ3RoKSB7CiAgICAgICAgbGV0IGk7CiAgICAgICAgZm9yIChpID0gMDsgaSA8IGxlbmd0aDsgKytpKSB7CiAgICAgICAgICBpZiAoaSArIG9mZnNldCA+PSBkc3QubGVuZ3RoIHx8IGkgPj0gc3JjLmxlbmd0aCkKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICBkc3RbaSArIG9mZnNldF0gPSBzcmNbaV07CiAgICAgICAgfQogICAgICAgIHJldHVybiBpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGlzSW5zdGFuY2Uob2JqLCB0eXBlKSB7CiAgICAgICAgcmV0dXJuIG9iaiBpbnN0YW5jZW9mIHR5cGUgfHwgb2JqICE9IG51bGwgJiYgb2JqLmNvbnN0cnVjdG9yICE9IG51bGwgJiYgb2JqLmNvbnN0cnVjdG9yLm5hbWUgIT0gbnVsbCAmJiBvYmouY29uc3RydWN0b3IubmFtZSA9PT0gdHlwZS5uYW1lOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIG51bWJlcklzTmFOKG9iaikgewogICAgICAgIHJldHVybiBvYmogIT09IG9iajsKICAgICAgfQogICAgICB2YXIgaGV4U2xpY2VMb29rdXBUYWJsZSA9IGZ1bmN0aW9uKCkgewogICAgICAgIGNvbnN0IGFscGhhYmV0ID0gIjAxMjM0NTY3ODlhYmNkZWYiOwogICAgICAgIGNvbnN0IHRhYmxlID0gbmV3IEFycmF5KDI1Nik7CiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCAxNjsgKytpKSB7CiAgICAgICAgICBjb25zdCBpMTYgPSBpICogMTY7CiAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IDE2OyArK2opIHsKICAgICAgICAgICAgdGFibGVbaTE2ICsgal0gPSBhbHBoYWJldFtpXSArIGFscGhhYmV0W2pdOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gdGFibGU7CiAgICAgIH0oKTsKICAgICAgZnVuY3Rpb24gZGVmaW5lQmlnSW50TWV0aG9kKGZuKSB7CiAgICAgICAgcmV0dXJuIHR5cGVvZiBCaWdJbnQgPT09ICJ1bmRlZmluZWQiID8gQnVmZmVyQmlnSW50Tm90RGVmaW5lZCA6IGZuOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIEJ1ZmZlckJpZ0ludE5vdERlZmluZWQoKSB7CiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJCaWdJbnQgbm90IHN1cHBvcnRlZCIpOwogICAgICB9CiAgICB9CiAgfSk7CgogIC8vIHNyYy9hbGlhcy9idWZmZXItc2hpbS5qcwogIHZhciBpbXBvcnRfYnVmZmVyOwogIHZhciBpbml0X2J1ZmZlcl9zaGltID0gX19lc20oewogICAgInNyYy9hbGlhcy9idWZmZXItc2hpbS5qcyIoKSB7C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G90eXBlID0gT2JqZWN0LmNyZWF0ZShzdXBlckNsYXNzICYmIHN1cGVyQ2xhc3MucHJvdG90eXBlLCB7CiAgICAgICAgICBjb25zdHJ1Y3RvcjogewogICAgICAgICAgICB2YWx1ZTogc3ViQ2xhc3MsCiAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlLAogICAgICAgICAgICBjb25maWd1cmFibGU6IHRydWUKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoc3ViQ2xhc3MsICJwcm90b3R5cGUiLCB7CiAgICAgICAgICB3cml0YWJsZTogZmFsc2UKICAgICAgICB9KTsKICAgICAgICBpZiAoc3VwZXJDbGFzcykKICAgICAgICAgIF9zZXRQcm90b3R5cGVPZihzdWJDbGFzcywgc3VwZXJDbGFzcyk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mKG8pIHsKICAgICAgICBfZ2V0UHJvdG90eXBlT2YgPSBPYmplY3Quc2V0UHJvdG90eXBlT2YgPyBPYmplY3QuZ2V0UHJvdG90eXBlT2YuYmluZCgpIDogZnVuY3Rpb24gX2dldFByb3RvdHlwZU9mMihvMikgewogICAgICAgICAgcmV0dXJuIG8yLl9fcHJvdG9fXyB8fCBPYmplY3QuZ2V0UHJvdG90eXBlT2YobzIpOwogICAgICAgIH07CiAgICAgICAgcmV0dXJuIF9nZXRQcm90b3R5cGVPZihvKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YobywgcCkgewogICAgICAgIF9zZXRQcm90b3R5cGVPZiA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiA/IE9iamVjdC5zZXRQcm90b3R5cGVPZi5iaW5kKCkgOiBmdW5jdGlvbiBfc2V0UHJvdG90eXBlT2YyKG8yLCBwMikgewogICAgICAgICAgbzIuX19wcm90b19fID0gcDI7CiAgICAgICAgICByZXR1cm4gbzI7CiAgICAgICAgfTsKICAgICAgICByZX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nByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwgcHJvcGVydHkpKSB7CiAgICAgICAgICBvYmplY3QgPSBfZ2V0UHJvdG90eXBlT2Yob2JqZWN0KTsKICAgICAgICAgIGlmIChvYmplY3QgPT09IG51bGwpCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICByZXR1cm4gb2JqZWN0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIF9nZXQoKSB7CiAgICAgICAgaWYgKHR5cGVvZiBSZWZsZWN0ICE9PSAidW5kZWZpbmVkIiAmJiBSZWZsZWN0LmdldCkgewogICAgICAgICAgX2dldCA9IFJlZmxlY3QuZ2V0LmJpbmQoKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgX2dldCA9IGZ1bmN0aW9uIF9nZXQyKHRhcmdldCwgcHJvcGVydHksIHJlY2VpdmVyKSB7CiAgICAgICAgICAgIHZhciBiYXNlID0gX3N1cGVyUHJvcEJhc2UodGFyZ2V0LCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmICghYmFzZSkKICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIHZhciBkZXNjID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihiYXNlLCBwcm9wZXJ0eSk7CiAgICAgICAgICAgIGlmIChkZXNjLmdldCkgewogICAgICAgICAgICAgIHJldHVybiBkZXNjLmdldC5jYWxsKGFyZ3VtZW50cy5sZW5ndGggPCAzID8gdGFyZ2V0IDogcmVjZWl2ZXIpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBkZXNjLnZhbHVlOwogICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIF9nZXQuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgfQogICAgICB2YXIgRW1pdHRlciA9IC8qIEBfX1BVUkVfXyAqLyBmdW5jdGlvbigpIHsKICAgICAgICBmdW5jdGlvbiBFbWl0dGVyMigpIHsKICAgICAgICAgIF9jbGFzc0NhbGxDaGVjayh0aGlzLCBFbWl0dGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgImxpc3RlbmVycyIsIHsKICAgICAgICAgICAgdmFsdWU6IHt9LAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEVtaXR0ZXIyLCBbewogICAgICAgICAga2V5OiAiYWRkRXZlbnRMaXN0ZW5lciIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWRkRXZlbnRMaXN0ZW5lcih0eXBlLCBjYWxsYmFjaywgb3B0aW9ucykgewogICAgICAgICAgICBpZiAoISh0eXBlIGluIHRoaXMubGlzdGVuZXJzKSkgewogICAgICAgICAgICAgIHRoaXMubGlzdGVuZXJzW3R5cGVdID0gW107CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdGhpcy5saXN0ZW5lcnNbdHlwZV0ucHVzaCh7CiAgICAgICAgICAgICAgY2FsbGJhY2ssCiAgICAgICAgICAgICAgb3B0aW9ucwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJyZW1vdmVFdmVudExpc3RlbmVyIiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiByZW1vdmVFdmVudExpc3RlbmVyKHR5cGUsIGNhbGxiYWNrKSB7CiAgICAgICAgICAgIGlmICghKHR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW3R5cGVdOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIGlmIChzdGFja1tpXS5jYWxsYmFjayA9PT0gY2FsbGJhY2spIHsKICAgICAgICAgICAgICAgIHN0YWNrLnNwbGljZShpLCAxKTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9LCB7CiAgICAgICAgICBrZXk6ICJkaXNwYXRjaEV2ZW50IiwKICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBkaXNwYXRjaEV2ZW50KGV2ZW50KSB7CiAgICAgICAgICAgIGlmICghKGV2ZW50LnR5cGUgaW4gdGhpcy5saXN0ZW5lcnMpKSB7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHZhciBzdGFjayA9IHRoaXMubGlzdGVuZXJzW2V2ZW50LnR5cGVdOwogICAgICAgICAgICB2YXIgc3RhY2tUb0NhbGwgPSBzdGFjay5zbGljZSgpOwogICAgICAgICAgICBmb3IgKHZhciBpID0gMCwgbCA9IHN0YWNrVG9DYWxsLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICAgIHZhciBsaXN0ZW5lciA9IHN0YWNrVG9DYWxsW2ldOwogICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBsaXN0ZW5lci5jYWxsYmFjay5jYWxsKHRoaXMsIGV2ZW50KTsKICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICBQcm9taXNlLnJlc29sdmUoKS50aGVuKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChsaXN0ZW5lci5vcHRpb25zICYmIGxpc3RlbmVyLm9wdGlvbnMub25jZSkgewogICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVFdmVudExpc3RlbmVyKGV2ZW50LnR5cGUsIGxpc3RlbmVyLmNhbGxiYWNrKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuICFldmVudC5kZWZhdWx0UHJldmVudGVkOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gRW1pdHRlcjI7CiAgICAgIH0oKTsKICAgICAgdmFyIEFib3J0U2lnbmFsID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKF9FbWl0dGVyKSB7CiAgICAgICAgX2luaGVyaXRzKEFib3J0U2lnbmFsMiwgX0VtaXR0ZXIpOwogICAgICAgIHZhciBfc3VwZXIgPSBfY3JlYXRlU3VwZXIoQWJvcnRTaWduYWwyKTsKICAgICAgICBmdW5jdGlvbiBBYm9ydFNpZ25hbDIoKSB7CiAgICAgICAgICB2YXIgX3RoaXM7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRTaWduYWwyKTsKICAgICAgICAgIF90aGlzID0gX3N1cGVyLmNhbGwodGhpcyk7CiAgICAgICAgICBpZiAoIV90aGlzLmxpc3RlbmVycykgewogICAgICAgICAgICBFbWl0dGVyLmNhbGwoX2Fzc2VydFRoaXNJbml0aWFsaXplZChfdGhpcykpOwogICAgICAgICAgfQogICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KF9hc3NlcnRUaGlzSW5pdGlhbGl6ZWQoX3RoaXMpLCAiYWJvcnRlZCIsIHsKICAgICAgICAgICAgdmFsdWU6IGZhbHNlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgIm9uYWJvcnQiLCB7CiAgICAgICAgICAgIHZhbHVlOiBudWxsLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfYXNzZXJ0VGhpc0luaXRpYWxpemVkKF90aGlzKSwgInJlYXNvbiIsIHsKICAgICAgICAgICAgdmFsdWU6IHZvaWQgMCwKICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsCiAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZQogICAgICAgICAgfSk7CiAgICAgICAgICByZXR1cm4gX3RoaXM7CiAgICAgICAgfQogICAgICAgIF9jcmVhdGVDbGFzcyhBYm9ydFNpZ25hbDIsIFt7CiAgICAgICAgICBrZXk6ICJ0b1N0cmluZyIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gdG9TdHJpbmcoKSB7CiAgICAgICAgICAgIHJldHVybiAiW29iamVjdCBBYm9ydFNpZ25hbF0iOwogICAgICAgICAgfQogICAgICAgIH0sIHsKICAgICAgICAgIGtleTogImRpc3BhdGNoRXZlbnQiLAogICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGRpc3BhdGNoRXZlbnQoZXZlbnQpIHsKICAgICAgICAgICAgaWYgKGV2ZW50LnR5cGUgPT09ICJhYm9ydCIpIHsKICAgICAgICAgICAgICB0aGlzLmFib3J0ZWQgPSB0cnVlOwogICAgICAgICAgICAgIGlmICh0eXBlb2YgdGhpcy5vbmFib3J0ID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICB0aGlzLm9uYWJvcnQuY2FsbCh0aGlzLCBldmVudCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIF9nZXQoX2dldFByb3RvdHlwZU9mKEFib3J0U2lnbmFsMi5wcm90b3R5cGUpLCAiZGlzcGF0Y2hFdmVudCIsIHRoaXMpLmNhbGwodGhpcywgZXZlbnQpOwogICAgICAgICAgfQogICAgICAgIH1dKTsKICAgICAgICByZXR1cm4gQWJvcnRTaWduYWwyOwogICAgICB9KEVtaXR0ZXIpOwogICAgICB2YXIgQWJvcnRDb250cm9sbGVyID0gLyogQF9fUFVSRV9fICovIGZ1bmN0aW9uKCkgewogICAgICAgIGZ1bmN0aW9uIEFib3J0Q29udHJvbGxlcjIoKSB7CiAgICAgICAgICBfY2xhc3NDYWxsQ2hlY2sodGhpcywgQWJvcnRDb250cm9sbGVyMik7CiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgInNpZ25hbCIsIHsKICAgICAgICAgICAgdmFsdWU6IG5ldyBBYm9ydFNpZ25hbCgpLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgX2NyZWF0ZUNsYXNzKEFib3J0Q29udHJvbGxlcjIsIFt7CiAgICAgICAgICBrZXk6ICJhYm9ydCIsCiAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gYWJvcnQocmVhc29uKSB7CiAgICAgICAgICAgIHZhciBldmVudDsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICBldmVudCA9IG5ldyBFdmVudCgiYWJvcnQiKTsKICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgIGlmICh0eXBlb2YgZG9jdW1lbnQgIT09ICJ1bmRlZmluZWQiKSB7CiAgICAgICAgICAgICAgICBpZiAoIWRvY3VtZW50LmNyZWF0ZUV2ZW50KSB7CiAgICAgICAgICAgICAgICAgIGV2ZW50ID0gZG9jdW1lbnQuY3JlYXRlRXZlbnRPYmplY3QoKTsKICAgICAgICAgICAgICAgICAgZXZlbnQudHlwZSA9ICJhYm9ydCI7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBldmVudCA9IGRvY3VtZW50LmNyZWF0ZUV2ZW50KCJFdmVudCIpOwogICAgICAgICAgICAgICAgICBldmVudC5pbml0RXZlbnQoImFib3J0IiwgZmFsc2UsIGZhbHNlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZXZlbnQgPSB7CiAgICAgICAgICAgICAgICAgIHR5cGU6ICJhYm9ydCIsCiAgICAgICAgICAgICAgICAgIGJ1YmJsZXM6IGZhbHNlLAogICAgICAgICAgICAgICAgICBjYW5jZWxhYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHNpZ25hbFJlYXNvbiA9IHJlYXNvbjsKICAgICAgICAgICAgaWYgKHNpZ25hbFJlYXNvbiA9PT0gdm9pZCAwKSB7CiAgICAgICAgICAgICAgaWYgKHR5cGVvZiBkb2N1bWVudCA9PT0gInVuZGVmaW5lZCIpIHsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbi5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICBzaWduYWxSZWFzb24gPSBuZXcgRE9NRXhjZXB0aW9uKCJzaWduYWwgaXMgYWJvcnRlZCB3aXRob3V0IHJlYXNvbiIpOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7CiAgICAgICAgICAgICAgICAgIHNpZ25hbFJlYXNvbiA9IG5ldyBFcnJvcigiVGhpcyBvcGVyYXRpb24gd2FzIGFib3J0ZWQiKTsKICAgICAgICAgICAgICAgICAgc2lnbmFsUmVhc29uLm5hbWUgPSAiQWJvcnRFcnJvciI7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMuc2lnbmFsLnJlYXNvbiA9IHN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GT1JDRV9JTlNUQUxMX0FCT1JUQ09OVFJPTExFUl9QT0xZRklMTAogICAgICAgIH0pKSB7CiAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICBmZXRjaCwKICAgICAgICAgICAgUmVxdWVzdAogICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgdmFyIFJlcXVlc3QgPSBOYXRpdmVSZXF1ZXN0OwogICAgICAgIGlmIChSZXF1ZXN0ICYmICFSZXF1ZXN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eSgic2lnbmFsIikgfHwgX19GT1JDRV9JTlNUQUxMX0FCT1JUQ09OVFJPTExFUl9QT0xZRklMTCkgewogICAgICAgICAgUmVxdWVzdCA9IGZ1bmN0aW9uIFJlcXVlc3QyKGlucHV0LCBpbml0MikgewogICAgICAgICAgICB2YXIgc2lnbmFsOwogICAgICAgICAgICBpZiAoaW5pdDIgJiYgaW5pdDIuc2lnbmFsKSB7CiAgICAgICAgICAgICAgc2lnbmFsID0gaW5pdDIuc2lnbmFsOwogICAgICAgICAgICAgIGRlbGV0ZSBpbml0Mi5zaWduYWw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgdmFyIHJlcXVlc3QgPSBuZXcgTmF0aXZlUmVxdWVzdChpbnB1dCwgaW5pdDIpOwogICAgICAgICAgICBpZiAoc2lnbmFsKSB7CiAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHJlcXVlc3QsICJzaWduYWwiLCB7CiAgICAgICAgICAgICAgICB3cml0YWJsZTogZmFsc2UsCiAgICAgICAgICAgICAgICBlbnVtZXJhYmxlOiBmYWxzZSwKICAgICAgICAgICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSwKICAgICAgICAgICAgICAgIHZhbHVlOiBzaWduYWwKICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmVxdWVzdDsKICAgICAgICAgIH07CiAgICAgICAgICBSZXF1ZXN0LnByb3RvdHlwZSA9IE5hdGl2ZVJlcXVlc3QucHJvdG90eXBlOwogICAgICAgIH0KICAgICAgICB2YXIgcmVhbEZldGNoID0gZmV0Y2g7CiAgICAgICAgdmFyIGFib3J0YWJsZUZldGNoID0gZnVuY3Rpb24gYWJvcnRhYmxlRmV0Y2gyKGlucHV0LCBpbml0MikgewogICAgICAgICAgdmFyIHNpZ25hbCA9IFJlcXVlc3QgJiYgUmVxdWVzdC5wcm90b3R5cGUuaXNQcm90b3R5cGVPZihpbnB1dCkgPyBpbnB1dC5zaWduYWwgOiBpbml0MiA/IGluaXQyLnNpZ25hbCA6IHZvaWQgMDsKICAgICAgICAgIGlmIChzaWduYWwpIHsKICAgICAgICAgICAgdmFyIGFib3J0RXJyb3I7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgYWJvcnRFcnJvciA9IG5ldyBET01FeGNlcHRpb24oIkFib3J0ZWQiLCAiQWJvcnRFcnJvciIpOwogICAgICAgICAgICB9IGNhdGNoIChlcnIpIHsKICAgICAgICAgICAgICBhYm9ydEVycm9yID0gbmV3IEVycm9yKCJBYm9ydGVkIik7CiAgICAgICAgICAgICAgYWJvcnRFcnJvci5uYW1lID0gIkFib3J0RXJyb3IiOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzaWduYWwuYWJvcnRlZCkgewogICAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChhYm9ydEVycm9yKTsKICAgICAgICAgICAgfQogICAgICAgICAgICB2YXIgY2FuY2VsbGF0aW9uID0gbmV3IFByb21pc2UoZnVuY3Rpb24oXywgcmVqZWN0KSB7CiAgICAgICAgICAgICAgc2lnbmFsLmFkZEV2ZW50TGlzdGVuZXIoImFib3J0IiwgZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gcmVqZWN0KGFib3J0RXJyb3IpOwogICAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIG9uY2U6IHRydWUKICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGlmIChpbml0MiAmJiBpbml0Mi5zaWduYWwpIHsKICAgICAgICAgICAgICBkZWxldGUgaW5pdDIuc2lnbmFsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBQcm9taXNlLnJhY2UoW2NhbmNlbGxhdGlvbiwgcmVhbEZldGNoKGlucHV0LCBpbml0MildKTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiByZWFsRmV0Y2goaW5wdXQsIGluaXQyKTsKICAgICAgICB9OwogICAgICAgIHJldHVybiB7CiAgICAgICAgICBmZXRjaDogYWJvcnRhYmxlRmV0Y2gsCiAgICAgICAgICBSZXF1ZXN0CiAgICAgICAgfTsKICAgICAgfQogICAgICBleHBvcnRzMi5BYm9ydENvbnRyb2xsZXIgPSBBYm9ydENvbnRyb2xsZXI7CiAgICAgIGV4cG9ydHMyLkFib3J0U2lnbmFsID0gQWJvcnRTaWduYWw7CiAgICAgIGV4cG9ydHMyLmFib3J0YWJsZUZldGNoID0gYWJvcnRhYmxlRmV0Y2hEZWNvcmF0b3I7CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9hYm9ydGFibGUtcHJvbWlzZS1jYWNoZUAxLjUuMC9ub2RlX21vZHVsZXMvYWJvcnRhYmxlLXByb21pc2UtY2FjaGUvZXNtL2Fib3J0Y29udHJvbGxlci1wb255ZmlsbC5qcwogIHZhciByZXF1aXJlX2Fib3J0Y29udHJvbGxlcl9wb255ZmlsbCA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9hYm9ydGFibGUtcHJvbWlzZS1jYWNoZUAxLjUuMC9ub2RlX21vZHVsZXMvYWJvcnRhYmxlLXByb21pc2UtY2FjaGUvZXNtL2Fib3J0Y29udHJvbGxlci1wb255ZmlsbC5qcyIoZXhwb3J0czIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0c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zaWduYWwgPSBuZXcgTnVsbFNpZ25hbCgpKSB7CiAgICAgICAgICBpZiAodGhpcy5zaWduYWwuYWJvcnRlZCkgewogICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoImNhbm5vdCBhZGQgYSBzaWduYWwsIGFscmVhZHkgYWJvcnRlZCEiKTsKICAgICAgICAgIH0KICAgICAgICAgIHRoaXMuc2lnbmFscy5hZGQoc2lnbmFsKTsKICAgICAgICAgIGlmIChzaWduYWwuYWJvcnRlZCkgewogICAgICAgICAgICB0aGlzLmhhbmRsZUFib3J0ZWQoc2lnbmFsKTsKICAgICAgICAgIH0gZWxzZSBpZiAodHlwZW9mIHNpZ25hbC5hZGRFdmVudExpc3RlbmVyID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgIHNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsICgpID0+IHsKICAgICAgICAgICAgICB0aGlzLmhhbmRsZUFib3J0ZWQoc2lnbmFsKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGhhbmRsZUFib3J0ZWQoc2lnbmFsKSB7CiAgICAgICAgICB0aGlzLnNpZ25hbHMuZGVsZXRlKHNpZ25hbCk7CiAgICAgICAgICBpZiAodGhpcy5zaWduYWxzLnNpemUgPT09IDApIHsKICAgICAgICAgICAgdGhpcy5hYm9ydENvbnRyb2xsZXIuYWJvcnQoKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZ2V0IHNpZ25hbCgpIHsKICAgICAgICAgIHJldHVybiB0aGlzLmFib3J0Q29udHJvbGxlci5zaWduYWw7CiAgICAgICAgfQogICAgICAgIGFib3J0KCkgewogICAgICAgICAgdGhpcy5hYm9ydENvbnRyb2xsZXIuYWJvcnQoKTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLmRlZmF1bHQgPSBBZ2dyZWdhdGVBYm9ydENvbnRyb2xsZXI7CiAgICB9CiAgfSk7Cgog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ZDsKICAgICAgICAgICAgfQogICAgICAgICAgfTsKICAgICAgICAgIG5ld0VudHJ5LmFib3J0ZXIuYWRkU2lnbmFsKHNpZ25hbCk7CiAgICAgICAgICBuZXdFbnRyeS5hYm9ydGVyLnNpZ25hbC5hZGRFdmVudExpc3RlbmVyKCJhYm9ydCIsICgpID0+IHsKICAgICAgICAgICAgaWYgKCFuZXdFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgdGhpcy5ldmljdChrZXksIG5ld0VudHJ5KTsKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgICBuZXdFbnRyeS5wcm9taXNlLnRoZW4oKCkgPT4gewogICAgICAgICAgICBuZXdFbnRyeS5zZXR0bGVkID0gdHJ1ZTsKICAgICAgICAgIH0sICgpID0+IHsKICAgICAgICAgICAgbmV3RW50cnkuc2V0dGxlZCA9IHRydWU7CiAgICAgICAgICAgIHRoaXMuZXZpY3Qoa2V5LCBuZXdFbnRyeSk7CiAgICAgICAgICB9KS5jYXRjaCgoZSkgPT4gewogICAgICAgICAgICBjb25zb2xlLmVycm9yKGUpOwogICAgICAgICAgICB0aHJvdyBlOwogICAgICAgICAgfSk7CiAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIG5ld0VudHJ5KTsKICAgICAgICB9CiAgICAgICAgc3RhdGljIGNoZWNrU2luZ2xlUHJvbWlzZShwcm9taXNlLCBzaWduYWwpIHsKICAgICAgICAgIGZ1bmN0aW9uIGNoZWNrRm9yU2luZ2xlQWJvcnQoKSB7CiAgICAgICAgICAgIGlmIChzaWduYWwgJiYgc2lnbmFsLmFib3J0ZWQpIHsKICAgICAgICAgICAgICB0aHJvdyBPYmplY3QuYXNzaWduKG5ldyBFcnJvcigiYWJvcnRlZCIpLCB7IGNvZGU6ICJFUlJfQUJPUlRFRCIgfSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBwcm9taXNlLnRoZW4oKHJlc3VsdCkgPT4gewogICAgICAgICAgICBjaGVja0ZvclNpbmdsZUFib3J0KCk7CiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICAgICB9LCAoZXJyb3IpID0+IHsKICAgICAgICAgICAgY2hlY2tGb3JTaW5nbGVBYm9ydCgpOwogICAgICAgICAgICB0aHJvdyBlcnJvcjsKICAgICAgICAgIH0pOwogICAgICAgIH0KICAgICAgICBoYXMoa2V5KSB7CiAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5oYXMoa2V5KTsKICAgICAgICB9CiAgICAgICAgZ2V0KGtleSwgZGF0YSwgc2lnbmFsLCBzdGF0dXNDYWxsYmFjaykgewogICAgICAgICAgaWYgKCFzaWduYWwgJiYgZGF0YSBpbnN0YW5jZW9mIGFib3J0Y29udHJvbGxlcl9wb255ZmlsbF8xLkFib3J0U2lnbmFsKSB7CiAgICAgICAgICAgIHRocm93IG5ldyBUeXBlRXJyb3IoInNlY29uZCBnZXQgYXJndW1lbnQgYXBwZWFycyB0byBiZSBhbiBBYm9ydFNpZ25hbCwgcGVyaGFwcyB5b3UgbWVhbnQgdG8gcGFzcyBgbnVsbGAgZm9yIHRoZSBmaWxsIGRhdGE/Iik7CiAgICAgICAgICB9CiAgICAgICAgICBjb25zdCBjYWNoZUVudHJ5ID0gdGhpcy5jYWNoZS5nZXQoa2V5KTsKICAgICAgICAgIGlmIChjYWNoZUVudHJ5KSB7CiAgICAgICAgICAgIGlmIChjYWNoZUVudHJ5LmFib3J0ZWQgJiYgIWNhY2hlRW50cnkuc2V0dGxlZCkgewogICAgICAgICAgICAgIHRoaXMuZXZpY3Qoa2V5LCBjYWNoZUVudHJ5KTsKICAgICAgICAgICAgICByZXR1cm4gdGhpcy5nZXQoa2V5LCBkYXRhLCBzaWduYWwsIHN0YXR1c0NhbGxiYWNrKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2FjaGVFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgcmV0dXJuIGNhY2hlRW50cnkucHJvbWlzZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjYWNoZUVudHJ5LmFib3J0ZXIuYWRkU2lnbmFsKHNpZ25hbCk7CiAgICAgICAgICAgIGNhY2hlRW50cnkuc3RhdHVzUmVwb3J0ZXIuYWRkQ2FsbGJhY2soc3RhdHVzQ2FsbGJhY2spOwogICAgICAgICAgICByZXR1cm4gQWJvcnRhYmxlUHJvbWlzZUNhY2hlMi5jaGVja1NpbmdsZVByb21pc2UoY2FjaGVFbnRyeS5wcm9taXNlLCBzaWduYWwpOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5maWxsKGtleSwgZGF0YSwgc2lnbmFsLCBzdGF0dXNDYWxsYmFjayk7CiAgICAgICAgICByZXR1cm4gQWJvcnRhYmxlUHJvbWlzZUNhY2hlMi5jaGVja1NpbmdsZVByb21pc2UodGhpcy5jYWNoZS5nZXQoa2V5KS5wcm9taXNlLCBzaWduYWwpOwogICAgICAgIH0KICAgICAgICBkZWxldGUoa2V5KSB7CiAgICAgICAgICBjb25zdCBjYWNoZWRFbnRyeSA9IHRoaXMuY2FjaGUuZ2V0KGtleSk7CiAgICAgICAgICBpZiAoY2FjaGVkRW50cnkpIHsKICAgICAgICAgICAgaWYgKCFjYWNoZWRFbnRyeS5zZXR0bGVkKSB7CiAgICAgICAgICAgICAgY2FjaGVkRW50cnkuYWJvcnRlci5hYm9ydCgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHRoaXMuY2FjaGUuZGVsZXRlKGtleSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNsZWFyKCkgewogICAgICAgICAgY29uc3Qga2V5SXRlciA9IHRoaXMuY2FjaGUua2V5cygpOwogICAgICAgICAgbGV0IGRlbGV0ZUNvdW50ID0gMDsKICAgICAgICAgIGZvciAobGV0IHJlc3VsdCA9IGtleUl0ZXIubmV4dCgpOyAhcmVzdWx0LmRvbmU7IHJlc3VsdCA9IGtleUl0ZXIubmV4dCgpKSB7CiA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EFib3J0YWJsZVByb21pc2VDYWNoZV8xLmRlZmF1bHQ7CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9xdWljay1scnVANC4wLjEvbm9kZV9tb2R1bGVzL3F1aWNrLWxydS9pbmRleC5qcwogIHZhciByZXF1aXJlX3F1aWNrX2xydSA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9xdWljay1scnVANC4wLjEvbm9kZV9tb2R1bGVzL3F1aWNrLWxydS9pbmRleC5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIHZhciBRdWlja0xSVSA9IGNsYXNzIHsKICAgICAgICBjb25zdHJ1Y3RvcihvcHRpb25zID0ge30pIHsKICAgICAgICAgIGlmICghKG9wdGlvbnMubWF4U2l6ZSAmJiBvcHRpb25zLm1heFNpemUgPiAwKSkgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJgbWF4U2l6ZWAgbXVzdCBiZSBhIG51bWJlciBncmVhdGVyIHRoYW4gMCIpOwogICAgICAgICAgfQogICAgICAgICAgdGhpcy5tYXhTaXplID0gb3B0aW9ucy5tYXhTaXplOwogICAgICAgICAgdGhpcy5jYWNoZSA9IG5ldyBNYXAoKTsKICAgICAgICAgIHRoaXMub2xkQ2FjaGUgPSBuZXcgTWFwKCk7CiAgICAgICAgICB0aGlzLl9zaXplID0gMDsKICAgICAgICB9CiAgICAgICAgX3NldChrZXksIHZhbHVlKSB7CiAgICAgICAgICB0aGlzLmNhY2hlLnNldChrZXksIHZhbHVlKTsKICAgICAgICAgIHRoaXMuX3NpemUrKzsKICAgICAgICAgIGlmICh0aGlzLl9zaXplID49IHRoaXMubWF4U2l6ZSkgewogICAgICAgICAgICB0aGlzLl9zaXplID0gMDsKICAgICAgICAgICAgdGhpcy5vbGRDYWNoZSA9IHRoaXMuY2FjaGU7CiAgICAgICAgICAgIHRoaXMuY2FjaGUgPSBuZXcgTWFwKCk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGdldChrZXkpIHsKICAgICAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLmNhY2hlLmdldChrZXkpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHRoaXMub2xkQ2FjaGUuaGFzKGtleSkpIHsKICAgICAgICAgICAgY29uc3QgdmFsdWUgPSB0aGlzLm9sZENhY2hlLmdldChrZXkpOwogICAgICAgICAgICB0aGlzLm9sZENhY2hlLmRlbGV0ZShrZXkpOwogICAgICAgICAgICB0aGlzLl9zZXQoa2V5LCB2YWx1ZSk7CiAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgc2V0KGtleSwgdmFsdWUpIHsKICAgICAgICAgIGlmICh0aGlzLmNhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHRoaXMuY2FjaGUuc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdGhpcy5fc2V0KGtleSwgdmFsdWUpOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgfQogICAgICAgIGhhcyhrZXkpIHsKICAgICAgICAgIHJldHVybiB0aGlzLmNhY2hlLmhhcyhrZXkpIHx8IHRoaXMub2xkQ2FjaGUuaGFzKGtleSk7CiAgICAgICAgfQogICAgICAgIHBlZWsoa2V5KSB7CiAgICAgICAgICBpZiAodGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZS5nZXQoa2V5KTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0aGlzLm9sZENhY2hlLmhhcyhrZXkpKSB7CiAgICAgICAgICAgIHJldHVybiB0aGlzLm9sZENhY2hlLmdldChrZXkpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkZWxldGUoa2V5KSB7CiAgICAgICAgICBjb25zdCBkZWxldGVkID0gdGhpcy5jYWNoZS5kZWxldGUoa2V5KTsKICAgICAgICAgIGlmIChkZWxldGVkKSB7CiAgICAgICAgICAgIHRoaXMuX3NpemUtLTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiB0aGlzLm9sZENhY2hlLmRlbGV0ZShrZXkpIHx8IGRlbGV0ZWQ7CiAgICAgICAgfQogICAgICAgIGNsZWFyKCkgewogICAgICAgICAgdGhpcy5jYWNoZS5jbGVhcigpOwogICAgICAgICAgdGhpcy5vbGRDYWNoZS5jbGVhcigpOwogICAgICAgICAgdGhpcy5fc2l6ZSA9IDA7CiAgICAgICAgfQogICAgICAgICprZXlzKCkgewogICAgICAgICAgZm9yIChjb25zdCBba2V5XSBvZiB0aGlzKSB7CiAgICAgICAgICAgIHlpZWxkIGtleTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgKnZhbHVlcygpIHsKICAgICAgICAgIGZvciAoY29uc3QgWywgdmFsdWVdIG9mIHRoaXMpIHsKICAgICAgICAgICAgeWllbGQgdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgICpbU3ltYm9sLml0ZXJhdG9yXSgpIHsKICAgICAgICAgIGZvciAoY29uc3QgaXRlbSBvZiB0aGlzLmNhY2hlKSB7CiAgICAgICAgICAgIHlpZWxkIGl0ZW07CiAgICAgICAgICB9CiAgICAgICAgICBmb3IgKGNvbnN0IGl0ZW0gb2YgdGhpcy5vbGRDYWNoZSkgewogICAgICAgICAgICBjb25zdCBba2V5XSA9IGl0ZW07CiAgICAgICAgICAgIGlmICghdGhpcy5jYWNoZS5oYXMoa2V5KSkgewogICAgICAgICAgICAgIHlpZWxkIGl0ZW07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZ2V0IHNpemUoKSB7CiAgICAgICAgICBsZXQgb2x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R5cGVvZiBVaW50OEFycmF5ICE9PSAidW5kZWZpbmVkIiAmJiB0eXBlb2YgVWludDE2QXJyYXkgIT09ICJ1bmRlZmluZWQiICYmIHR5cGVvZiBJbnQzMkFycmF5ICE9PSAidW5kZWZpbmVkIjsKICAgICAgZnVuY3Rpb24gX2hhcyhvYmosIGtleSkgewogICAgICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwob2JqLCBrZXkpOwogICAgICB9CiAgICAgIGV4cG9ydHMyLmFzc2lnbiA9IGZ1bmN0aW9uKG9iaikgewogICAgICAgIHZhciBzb3VyY2VzID0gQXJyYXkucHJvdG90eXBlLnNsaWNlLmNhbGwoYXJndW1lbnRzLCAxKTsKICAgICAgICB3aGlsZSAoc291cmNlcy5sZW5ndGgpIHsKICAgICAgICAgIHZhciBzb3VyY2UgPSBzb3VyY2VzLnNoaWZ0KCk7CiAgICAgICAgICBpZiAoIXNvdXJjZSkgewogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmICh0eXBlb2Ygc291cmNlICE9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKHNvdXJjZSArICJtdXN0IGJlIG5vbi1vYmplY3QiKTsKICAgICAgICAgIH0KICAgICAgICAgIGZvciAodmFyIHAgaW4gc291cmNlKSB7CiAgICAgICAgICAgIGlmIChfaGFzKHNvdXJjZSwgcCkpIHsKICAgICAgICAgICAgICBvYmpbcF0gPSBzb3VyY2VbcF07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIG9iajsKICAgICAgfTsKICAgICAgZXhwb3J0czIuc2hyaW5rQnVmID0gZnVuY3Rpb24oYnVmLCBzaXplKSB7CiAgICAgICAgaWYgKGJ1Zi5sZW5ndGggPT09IHNpemUpIHsKICAgICAgICAgIHJldHVybiBidWY7CiAgICAgICAgfQogICAgICAgIGlmIChidWYuc3ViYXJyYXkpIHsKICAgICAgICAgIHJldHVybiBidWYuc3ViYXJyYXkoMCwgc2l6ZSk7CiAgICAgICAgfQogICAgICAgIGJ1Zi5sZW5ndGggPSBzaXplOwogICAgICAgIHJldHVybiBidWY7CiAgICAgIH07CiAgICAgIHZhciBmblR5cGVkID0gewogICAgICAgIGFycmF5U2V0OiBmdW5jdGlvbihkZXN0LCBzcmMsIHNyY19vZmZzLCBsZW4sIGRlc3Rfb2ZmcykgewogICAgICAgICAgaWYgKHNyYy5zdWJhcnJheSAmJiBkZXN0LnN1YmFycmF5KSB7CiAgICAgICAgICAgIGRlc3Quc2V0KHNyYy5zdWJhcnJheShzcmNfb2Zmcywgc3JjX29mZnMgKyBsZW4pLCBkZXN0X29mZnMpOwogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICB9CiAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxlbjsgaSsrKSB7CiAgICAgICAgICAgIGRlc3RbZGVzdF9vZmZzICsgaV0gPSBzcmNbc3JjX29mZnMgKyBpXTsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIGZsYXR0ZW5DaHVua3M6IGZ1bmN0aW9uKGNodW5rcykgewogICAgICAgICAgdmFyIGksIGwsIGxlbiwgcG9zLCBjaHVuaywgcmVzdWx0OwogICAgICAgICAgbGVuID0gMDsKICAgICAgICAgIGZvciAoaSA9IDAsIGwgPSBjaHVua3MubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgICAgIGxlbiArPSBjaHVua3NbaV0ubGVuZ3RoOwogICAgICAgICAgfQogICAgICAgICAgcmVzdWx0ID0gbmV3IFVpbnQ4QXJyYXkobGVuKTsKICAgICAgICAgIHBvcyA9IDA7CiAgICAgICAgICBmb3IgKGkgPSAwLCBsID0gY2h1bmtzLmxlbmd0aDsgaSA8IGw7IGkrKykgewogICAgICAgICAgICBjaHVuayA9IGNodW5rc1tpXTsKICAgICAgICAgICAgcmVzdWx0LnNldChjaHVuaywgcG9zKTsKICAgICAgICAgICAgcG9zICs9IGNodW5rLmxlbmd0aDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICAgfQogICAgICB9OwogICAgICB2YXIgZm5VbnR5cGVkID0gewogICAgICAgIGFycmF5U2V0OiBmdW5jdGlvbihkZXN0LCBzcmMsIHNyY19vZmZzLCBsZW4sIGRlc3Rfb2ZmcykgewogICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgICAgICBkZXN0W2Rlc3Rfb2ZmcyArIGldID0gc3JjW3NyY19vZmZzICsgaV07CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBmbGF0dGVuQ2h1bmtzOiBmdW5jdGlvbihjaHVua3MpIHsKICAgICAgICAgIHJldHVybiBbXS5jb25jYXQuYXBwbHkoW10sIGNodW5rcyk7CiAgICAgICAgfQogICAgICB9OwogICAgICBleHBvcnRzMi5zZXRUeXBlZCA9IGZ1bmN0aW9uKG9uKSB7CiAgICAgICAgaWYgKG9uKSB7CiAgICAgICAgICBleHBvcnRzMi5CdWY4ID0gVWludDhBcnJheTsKICAgICAgICAgIGV4cG9ydHMyLkJ1ZjE2ID0gVWludDE2QXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5CdWYzMiA9IEludDMyQXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5hc3NpZ24oZXhwb3J0czIsIGZuVHlwZWQpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBleHBvcnRzMi5CdWY4ID0gQXJyYXk7CiAgICAgICAgICBleHBvcnRzMi5CdWYxNiA9IEFycmF5OwogICAgICAgICAgZXhwb3J0czIuQnVmMzIgPSBBcnJheTsKICAgICAgICAgIGV4cG9ydHMyLmFzc2lnbihleHBvcnRzMiwgZm5VbnR5cGVkKTsKICAgICAgICB9CiAgICAgIH07CiAgICAgIGV4cG9ydHMyLnNldFR5cGVkKFRZUEVEX09LKTsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL3RyZWVzLmpzCiAgdmFyIHJlcXVpcmVfdHJlZXMgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvdHJlZXMuanMiKGV4cG9ydHMyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICB2YXIgdXRpbHMgPSByZXF1aXJlX2NvbW1vbigpOwogICAgICB2YXIgWl9GSVhFRCA9IDQ7CiAgICAgIHZhciBaX0JJTkFSWSA9IDA7CiAgICAgIHZhciBaX1RFWFQgPSAxOwogICAgICB2YXIgWl9VTktOT1dOID0gMjsKICAgICAgZnVuY3Rpb24gemVybyhidWYpIHsKICAgICAgICB2YXIgbGVuID0gYnVmLmxlbmd0aDsKICAgICAgICB3aGlsZSAoLS1sZW4gPj0gMCkgewogICAgICAgICAgYnVmW2xlbl0gPSAwOwogICAgICAgIH0KICAgICAgfQogICAgICB2YXIgU1RPUkVEX0JMT0NLID0gMDsKICAgICAgdmFyIFNUQVRJQ19UUkVFUyA9IDE7CiAgICAgIHZhciBEWU5fVFJFRVMgPSAyOwogICAgICB2YXIgTUlOX01BVENIID0gMzsKICAgICAgdmFyIE1BWF9NQVRDSCA9IDI1ODsKICAgICAgdmFyIExFTkdUSF9DT0RFUyA9IDI5OwogICAgICB2YXIgTElURVJBTFMgPSAyNTY7CiAgICAgIHZhciBMX0NPREVTID0gTElURVJBTFMgKyAxICsgTEVOR1RIX0NPREVTOwogICAgICB2YXIgRF9DT0RFUyA9IDMwOwogICAgICB2YXIgQkxfQ09ERVMgPSAxOTsKICAgICAgdmFyIEhFQVBfU0laRSA9IDIgKiBMX0NPREVTICsgMTsKICAgICAgdmFyIE1BWF9CSVRTID0gMTU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ICAgICAgIHJlcyA8PD0gMTsKICAgICAgICB9IHdoaWxlICgtLWxlbiA+IDApOwogICAgICAgIHJldHVybiByZXMgPj4+IDE7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYmlfZmx1c2gocykgewogICAgICAgIGlmIChzLmJpX3ZhbGlkID09PSAxNikgewogICAgICAgICAgcHV0X3Nob3J0KHMsIHMuYmlfYnVmKTsKICAgICAgICAgIHMuYmlfYnVmID0gMDsKICAgICAgICAgIHMuYmlfdmFsaWQgPSAwOwogICAgICAgIH0gZWxzZSBpZiAocy5iaV92YWxpZCA+PSA4KSB7CiAgICAgICAgICBzLnBlbmRpbmdfYnVmW3MucGVuZGluZysrXSA9IHMuYmlfYnVmICYgMjU1OwogICAgICAgICAgcy5iaV9idWYgPj49IDg7CiAgICAgICAgICBzLmJpX3ZhbGlkIC09IDg7CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIGdlbl9iaXRsZW4ocywgZGVzYykgewogICAgICAgIHZhciB0cmVlID0gZGVzYy5keW5fdHJlZTsKICAgICAgICB2YXIgbWF4X2NvZGUgPSBkZXNjLm1heF9jb2RlOwogICAgICAgIHZhciBzdHJlZSA9IGRlc2Muc3RhdF9kZXNjLnN0YXRpY190cmVlOwogICAgICAgIHZhciBoYXNfc3RyZWUgPSBkZXNjLnN0YXRfZGVzYy5oYXNfc3RyZWU7CiAgICAgICAgdmFyIGV4dHJhID0gZGVzYy5zdGF0X2Rlc2MuZXh0cmFfYml0czsKICAgICAgICB2YXIgYmFzZSA9IGRlc2Muc3RhdF9kZXNjLmV4dHJhX2Jhc2U7CiAgICAgICAgdmFyIG1heF9sZW5ndGggPSBkZXNjLnN0YXRfZGVzYy5tYXhfbGVuZ3RoOwogICAgICAgIHZhciBoOwogICAgICAgIHZhciBuLCBtOwogICAgICAgIHZhciBiaXRzOwogICAgICAgIHZhciB4Yml0czsKICAgICAgICB2YXIgZjsKICAgICAgICB2YXIgb3ZlcmZsb3cgPSAwOwogICAgICAgIGZvciAoYml0cyA9IDA7IGJpdHMgPD0gTUFYX0JJVFM7IGJpdHMrKykgewogICAgICAgICAgcy5ibF9jb3VudFtiaXRzXSA9IDA7CiAgICAgICAgfQogICAgICAgIHRyZWVbcy5oZWFwW3MuaGVhcF9tYXhdICogMiArIDFdID0gMDsKICAgICAgICBmb3IgKGggPSBzLmhlYXBfbWF4ICsgMTsgaCA8IEhFQVBfU0laRTsgaCsrKSB7CiAgICAgICAgICBuID0gcy5oZWFwW2hdOwogICAgICAgICAgYml0cyA9IHRyZWVbdHJlZVtuICogMiArIDFdICogMiArIDFdICsgMTsKICAgICAgICAgIGlmIChiaXRzID4gbWF4X2xlbmd0aCkgewogICAgICAgICAgICBiaXRzID0gbWF4X2xlbmd0aDsKICAgICAgICAgICAgb3ZlcmZsb3crKzsKICAgICAgICAgIH0KICAgICAgICAgIHRyZWVbbiAqIDIgKyAxXSA9IGJpdHM7CiAgICAgICAgICBpZiAobiA+IG1heF9jb2RlKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgcy5ibF9jb3VudFtiaXRzXSsrOwogICAgICAgICAgeGJpdHMgPSAwOwogICAgICAgICAgaWYgKG4gPj0gYmFzZSkgewogICAgICAgICAgICB4Yml0cyA9IGV4dHJhW24gLSBiYXNlXTsKICAgICAgICAgIH0KICAgICAgICAgIGYgPSB0cmVlW24gKiAyXTsKICAgICAgICAgIHMub3B0X2xlbiArPSBmICogKGJpdHMgKyB4Yml0cyk7CiAgICAgICAgICBpZiAoaGFzX3N0cmVlKSB7CiAgICAgICAgICAgIHMuc3RhdGljX2xlbiArPSBmICogKHN0cmVlW24gKiAyICsgMV0gKyB4Yml0cyk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChvdmVyZmxvdyA9PT0gMCkgewogICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICBkbyB7CiAgICAgICAgICBiaXRzID0gbWF4X2xlbmd0aCAtIDE7CiAgICAgICAgICB3aGlsZSAocy5ibF9jb3VudFtiaXRzXSA9PT0gMCkgewogICAgICAgICAgICBiaXRzLS07CiAgICAgICAgICB9CiAgICAgICAgICBzLmJsX2NvdW50W2JpdHNdLS07CiAgICAgICAgICBzLmJsX2NvdW50W2JpdHMgKyAxXSArPSAyOwogICAgICAgICAgcy5ibF9jb3VudFttYXhfbGVuZ3RoXS0tOwogICAgICAgICAgb3ZlcmZsb3cgLT0gMjsKICAgICAgICB9IHdoaWxlIChvdmVyZmxvdyA+IDApOwogICAgICAgIGZvciAoYml0cyA9IG1heF9sZW5ndGg7IGJpdHMgIT09IDA7IGJpdHMtLSkgewogICAgICAgICAgbiA9IHMuYmxfY291bnRbYml0c107CiAgICAgICAgICB3aGlsZSAobiAhPT0gMCkgewogICAgICAgICAgICBtID0gcy5oZWFwWy0taF07CiAgICAgICAgICAgIGlmIChtID4gbWF4X2NvZGUpIHsKICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodHJlZVttICogMiArIDFdICE9PSBiaXRzKSB7CiAgICAgICAgICAgICAgcy5vcHRfbGVuICs9IChiaXRzIC0gdHJlZVttICogMiArIDFdKSAqIHRyZWVbbSAqIDJdOwogICAgICAgICAgICAgIHRyZWVbbSAqIDIgKyAxXSA9IGJpdHM7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbi0tOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBnZW5fY29kZXModHJlZSwgbWF4X2NvZGUsIGJsX2NvdW50KSB7CiAgICAgICAgdmFyIG5leHRfY29kZSA9IG5ldyBBcnJheShNQVhfQklUUyArIDEpOwogICAgICAgIHZhciBjb2RlID0gMDsKICAgICAgICB2YXIgYml0czsKICAgICAgICB2YXIgbjsKICAgICAgICBmb3IgKGJpdHMgPSAxOyBiaXRzIDw9IE1BWF9CSVRTOyBiaXRzKyspIHsKICAgICAgICAgIG5leHRfY29kZVtiaXRzXSA9IGNvZGUgPSBjb2RlICsgYmxfY291bnRbYml0cyAtIDFdIDw8IDE7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDA7IG4gPD0gbWF4X2NvZGU7IG4rKykgewogICAgICAgICAgdmFyIGxlbiA9IHRyZWVbbiAqIDIgKyAxXTsKICAgICAgICAgIGlmIChsZW4gPT09IDApIHsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICB0cmVlW24gKiAyXSA9IGJpX3JldmVyc2UobmV4dF9jb2RlW2xlbl0rKywgbGVuKTsKICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gdHJfc3RhdGljX2luaXQoKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIGJpdHM7CiAgICAgICAgdmFyIGxlbmd0aDsKICAgICAgICB2YXIgY29kZTsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgYmxfY291bnQgPSBuZXcgQXJyYXkoTUFYX0JJVFMgKyAxKTsKICAgICAgICBsZW5ndGggPSAwOwogICAgICAgIGZvciAoY29kZSA9IDA7IGNvZGUgPCBMRU5HVEhfQ09ERVMgLSAxOyBjb2RlKyspIHsKICAgICAgICAgIGJhc2VfbGVuZ3RoW2NvZGVdID0gbGVuZ3RoOwogICAgICAgICAgZm9yIChuID0gMDsgbiA8IDEgPDwgZXh0cmFfbGJpdHNbY29kZV07IG4rKykgewogICAgICAgICAgICBfbGVuZ3RoX2NvZGVbbGVuZ3RoKytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgX2xlbmd0aF9jb2RlW2xlbmd0aCAtIDFdID0gY29kZTsKICAgICAgICBkaXN0ID0gMDsKICAgICAgICBmb3IgKGNvZGUgPSAwOyBjb2RlIDwgMTY7IGNvZGUrKykgewogICAgICAgICAgYmFzZV9kaXN0W2NvZGVdID0gZGlzdDsKICAgICAgICAgIGZvciAobiA9IDA7IG4gPCAxIDw8IGV4dHJhX2RiaXRzW2NvZGVdOyBuKyspIHsKICAgICAgICAgICAgX2Rpc3RfY29kZVtkaXN0KytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZGlzdCA+Pj0gNzsKICAgICAgICBmb3IgKDsgY29kZSA8IERfQ09ERVM7IGNvZGUrKykgewogICAgICAgICAgYmFzZV9kaXN0W2NvZGVdID0gZGlzdCA8PCA3OwogICAgICAgICAgZm9yIChuID0gMDsgbiA8IDEgPDwgZXh0cmFfZGJpdHNbY29kZV0gLSA3OyBuKyspIHsKICAgICAgICAgICAgX2Rpc3RfY29kZVsyNTYgKyBkaXN0KytdID0gY29kZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZm9yIChiaXRzID0gMDsgYml0cyA8PSBNQVhfQklUUzsgYml0cysrKSB7CiAgICAgICAgICBibF9jb3VudFtiaXRzXSA9IDA7CiAgICAgICAgfQogICAgICAgIG4gPSAwOwogICAgICAgIHdoaWxlIChuIDw9IDE0MykgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA4OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbOF0rKzsKICAgICAgICB9CiAgICAgICAgd2hpbGUgKG4gPD0gMjU1KSB7CiAgICAgICAgICBzdGF0aWNfbHRyZWVbbiAqIDIgKyAxXSA9IDk7CiAgICAgICAgICBuKys7CiAgICAgICAgICBibF9jb3VudFs5XSsrOwogICAgICAgIH0KICAgICAgICB3aGlsZSAobiA8PSAyNzkpIHsKICAgICAgICAgIHN0YXRpY19sdHJlZVtuICogMiArIDFdID0gNzsKICAgICAgICAgIG4rKzsKICAgICAgICAgIGJsX2NvdW50WzddKys7CiAgICAgICAgfQogICAgICAgIHdoaWxlIChuIDw9IDI4NykgewogICAgICAgICAgc3RhdGljX2x0cmVlW24gKiAyICsgMV0gPSA4OwogICAgICAgICAgbisrOwogICAgICAgICAgYmxfY291bnRbOF0rKzsKICAgICAgICB9CiAgICAgICAgZ2VuX2NvZGV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sZW4gPSBzLnN0YXRpY19sZW4gPSAwOwogICAgICAgIHMubGFzdF9saXQgPSBzLm1hdGNoZXMgPSAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGJpX3dpbmR1cChzKSB7CiAgICAgICAgaWYgKHMuYmlfdmFsaWQgPiA4KSB7CiAgICAgICAgICBwdXRfc2hvcnQocywgcy5iaV9idWYpOwogICAgICAgIH0gZWxzZSBpZiAocy5iaV92YWxpZCA+IDApIHsKICAgICAgICAgIHMucGVuZGluZ19idWZbcy5wZW5kaW5nKytdID0gcy5iaV9idWY7CiAgICAgICAgfQogICAgICAgIHMuYmlfYnVmID0gMDsKICAgICAgICBzLmJpX3ZhbGlkID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBjb3B5X2Jsb2NrKHMsIGJ1ZiwgbGVuLCBoZWFkZXIpIHsKICAgICAgICBiaV93aW5kdXAocyk7CiAgICAgICAgaWYgKGhlYWRlcikgewogICAgICAgICAgcHV0X3Nob3J0KHMsIGxlbik7CiAgICAgICAgICBwdXRfc2hvcnQocywgfmxlbik7CiAgICAgICAgfQogICAgICAgIHV0aWxzLmFycmF5U2V0KHMucGVuZGluZ19idWYsIHMud2luZG93LCBidWYsIGxlbiwgcy5wZW5kaW5nKTsKICAgICAgICBzLnBlbmRpbmcgKz0gbGVuOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNtYWxsZXIodHJlZSwgbiwgbSwgZGVwdGgpIHsKICAgICAgICB2YXIgX24yID0gbiAqIDI7CiAgICAgICAgdmFyIF9tMiA9IG0gKiAyOwogICAgICAgIHJldHVybiB0cmVlW19uMl0gPCB0cmVlW19tMl0gfHwgdHJlZVtfbjJdID09PSB0cmVlW19tMl0gJiYgZGVwdGhbbl0gPD0gZGVwdGhbbV07CiAgICAgIH0KICAgICAgZnVuY3Rpb24gcHFkb3duaGVhcChzLCB0cmVlLCBrKSB7CiAgICAgICAgdmFyIHYgPSBzLmhlYXBba107CiAgICAgICAgdmFyIGogPSBrIDw8IDE7CiAgICAgICAgd2hpbGUgKGogPD0gcy5oZWFwX2xlbikgewogICAgICAgICAgaWYgKGogPCBzLmhlYXBfbGVuICYmIHNtYWxsZXIodHJlZSwgcy5oZWFwW2ogKyAxXSwgcy5oZWFwW2pdLCBzLmRlcHRoKSkgewogICAgICAgICAgICBqKys7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoc21hbGxlcih0cmVlLCB2LCBzLmhlYXBbal0sIHMuZGVwdGgpKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgcy5oZWFwW2tdID0gcy5oZWFwW2pdOwogICAgICAgICAgayA9IGo7CiAgICAgICAgICBqIDw8PSAxOwogICAgICAgIH0KICAgICAgICBzLmhlYXBba10gPSB2OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGNvbXByZXNzX2Jsb2NrKHMsIGx0cmVlLCBkdHJlZSkgewogICAgICAgIHZhciBkaXN0OwogICAgICAgIHZhciBsYzsKICAgICAgICB2YXIgbHggPSAwOwogICAgICAgIHZhciBjb2RlOwogICAgICAgIHZhciBleHRyYTsKICAgICAgICBpZiAocy5sYXN0X2xpdCAhPT0gMCkgewogICAgICAgICAgZG8gewogICAgICAgICAgICBkaXN0ID0gcy5wZW5kaW5nX2J1ZltzLmRfYnVmICsgbHggKiAyXSA8PCA4IHwgcy5wZW5kaW5nX2J1ZltzLmRfYnVmICsgbHggKiAyICsgMV07CiAgICAgICAgICAgIGxjID0gcy5wZW5kaW5nX2J1ZltzLmxfYnVmICsgbHhdOwogICAgICAgICAgICBseCsrOwogICAgICAgICAgICBpZiAoZGlzdCA9PT0gMCkgewogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBsYywgbHRyZWUpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIGNvZGUgPSBfbGVuZ3RoX2NvZGVbbGNdOwogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjb2RlICsgTElURVJBTFMgKyAxLCBsdHJlZSk7CiAgICAgICAgICAgICAgZXh0cmEgPSBleHRyYV9sYml0c1tjb2RlXTsKICAgICAgICAgICAgICBpZiAoZXh0cmEgIT09IDApIHsKICAgICAgICAgICAgICAgIGxjIC09IGJhc2VfbGVuZ3RoW2NvZGVdOwogICAgICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGxjLCBleHRyYSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGRpc3QtLTsKICAgICAgICAgICAgICBjb2RlID0gZF9jb2RlKGRpc3QpOwogICAgICAgICAgICAgIHNlbmRfY29kZShzLCBjb2RlLCBkdHJlZSk7CiAgICAgICAgICAgICAgZXh0cmEgPSBleHRyYV9kYml0c1tjb2RlXTsKICAgICAgICAgICAgICBpZiAoZXh0cmEgIT09IDApIHsKICAgICAgICAgICAgICAgIGRpc3QgLT0gYmFzZV9kaXN0W2NvZGVdOwogICAgICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGRpc3QsIGV4dHJhKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gd2hpbGUgKGx4IDwgcy5sYXN0X2xpdCk7CiAgICAgICAgfQogICAgICAgIHNlbmRfY29kZShzLCBFTkRfQkxPQ0ssIGx0cmVlKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBidWlsZF90cmVlKHMsIGRlc2MpIHsKICAgICAgICB2YXIgdHJlZSA9IGRlc2MuZHluX3RyZWU7CiAgICAgICAgdmFyIHN0cmVlID0gZGVzYy5zdGF0X2Rlc2Muc3RhdGljX3RyZWU7CiAgICAgICAgdmFyIGhhc19zdHJlZSA9IGRlc2Muc3RhdF9kZXNjLmhhc19zdHJlZTsKICAgICAgICB2YXIgZWxlbXMgPSBkZXNjLnN0YXRfZGVzYy5lbGVtczsKICAgICAgICB2YXIgbiwgbTsKICAgICAgICB2YXIgbWF4X2NvZGUgPSAtMTsKICAgICAgICB2YXIgbm9kZTsKICAgICAgICBzLmhlYXBfbGVuID0gMDsKICAgICAgICBzLmhlYXBfbWF4ID0gSEVBUF9TSVpFOwogICAgICAgIGZvciAobiA9IDA7IG4gPCBlbGVtczsgbisrKSB7CiAgICAgICAgICBpZiAodHJlZVtuICogMl0gIT09IDApIHsKICAgICAgICAgICAgcy5oZWFwWysrcy5oZWFwX2xlbl0gPSBtYXhfY29kZSA9IG47CiAgICAgICAgICAgIHMuZGVwdGhbbl0gPSAwOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgdHJlZVtuICogMiArIDFdID0gMDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgd2hpbGUgKHMuaGVhcF9sZW4gPCAyKSB7CiAgICAgICAgICBub2RlID0gcy5oZWFwWysrcy5oZWFwX2xlbl0gPSBtYXhfY29kZSA8IDIgPyArK21heF9jb2RlIDogMDsKICAgICAgICAgIHRyZWVbbm9kZSAqIDJdID0gMTsKICAgICAgICAgIHMuZGVwdGhbbm9kZV0gPSAwOwogICAgICAgICAgcy5vcHRfbGVuLS07CiAgICAgICAgICBpZiAoaGFzX3N0cmVlKSB7CiAgICAgICAgICAgIHMuc3RhdGljX2xlbiAtPSBzdHJlZVtub2RlICogMiArIDFdOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBkZXNjLm1heF9jb2RlID0gbWF4X2NvZGU7CiAgICAgICAgZm9yIChuID0gcy5oZWFwX2xlbiA+PiAxOyBuID49IDE7IG4tLSkgewogICAgICAgICAgcHFkb3duaGVhcChzLCB0cmVlLCBuKTsKICAgICAgICB9CiAgICAgICAgbm9kZSA9IGVsZW1zOwogICAgICAgIGRvIHsKICAgICAgICAgIG4gPSBzLmhlYXBbMV07CiAgICAgICAgICBzLmhlYXBbMV0gPSBzLmhlYXBbcy5oZWFwX2xlbi0tXTsKICAgICAgICAgIHBxZG93bmhlYXAocywgdHJlZSwgMSk7CiAgICAgICAgICBtID0gcy5oZWFwWzFdOwogICAgICAgICAgcy5oZWFwWy0tcy5oZWFwX21heF0gPSBuOwogICAgICAgICAgcy5oZWFwWy0tcy5oZWFwX21heF0gPSBtOwogICAgICAgICAgdHJlZVtub2RlICogMl0gPSB0cmVlW24gKiAyXSArIHRyZWVbbSAqIDJdOwogICAgICAgICAgcy5kZXB0aFtub2RlXSA9IChzLmRlcHRoW25dID49IHMuZGVwdGhbbV0gPyBzLmRlcHRoW25dIDogcy5kZXB0aFttXSkgKyAxOwogICAgICAgICAgdHJlZVtuICogMiArIDFdID0gdHJlZVttICogMiArIDFdID0gbm9kZTsKICAgICAgICAgIHMuaGVhcFsxXSA9IG5vZGUrKzsKICAgICAgICAgIHBxZG93bmhlYXAocywgdHJlZSwgMSk7CiAgICAgICAgfSB3aGlsZSAocy5oZWFwX2xlbiA+PSAyKTsKICAgICAgICBzLmhlYXBbLS1zLmhlYXBfbWF4XSA9IHMuaGVhcFsxXTsKICAgICAgICBnZW5fYml0bGVuKHMsIGRlc2MpOwogICAgICAgIGdlbl9jb2Rlcyh0cmVlLCBtYXhfY29kZSwgcy5ibF9jb3VudCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2Nhbl90cmVlKHMsIHRyZWUsIG1heF9jb2RlKSB7CiAgICAgICAgdmFyIG47CiAgICAgICAgdmFyIHByZXZsZW4gPSAtMTsKICAgICAgICB2YXIgY3VybGVuOwogICAgICAgIHZhciBuZXh0bGVuID0gdHJlZVswICogMiArIDFdOwogICAgICAgIHZhciBjb3VudCA9IDA7CiAgICAgICAgdmFyIG1heF9jb3VudCA9IDc7CiAgICAgICAgdmFyIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgIG1heF9jb3VudCA9IDEzODsKICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgfQogICAgICAgIHRyZWVbKG1heF9jb2RlICsgMSkgKiAyICsgMV0gPSA2NTUzNTsKICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IG1heF9jb2RlOyBuKyspIHsKICAgICAgICAgIGN1cmxlbiA9IG5leHRsZW47CiAgICAgICAgICBuZXh0bGVuID0gdHJlZVsobiArIDEpICogMiArIDFdOwogICAgICAgICAgaWYgKCsrY291bnQgPCBtYXhfY291bnQgJiYgY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkgewogICAgICAgICAgICBzLmJsX3RyZWVbY3VybGVuICogMl0gKz0gY291bnQ7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiAhPT0gMCkgewogICAgICAgICAgICBpZiAoY3VybGVuICE9PSBwcmV2bGVuKSB7CiAgICAgICAgICAgICAgcy5ibF90cmVlW2N1cmxlbiAqIDJdKys7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcy5ibF90cmVlW1JFUF8zXzYgKiAyXSsrOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8PSAxMCkgewogICAgICAgICAgICBzLmJsX3RyZWVbUkVQWl8zXzEwICogMl0rKzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuYmxfdHJlZVtSRVBaXzExXzEzOCAqIDJdKys7CiAgICAgICAgICB9CiAgICAgICAgICBjb3VudCA9IDA7CiAgICAgICAgICBwcmV2bGVuID0gY3VybGVuOwogICAgICAgICAgaWYgKG5leHRsZW4gPT09IDApIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gMTM4OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIGlmIChjdXJsZW4gPT09IG5leHRsZW4pIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNjsKICAgICAgICAgICAgbWluX2NvdW50ID0gMzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIG1heF9jb3VudCA9IDc7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDQ7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGZ1bmN0aW9uIHNlbmRfdHJlZShzLCB0cmVlLCBtYXhfY29kZSkgewogICAgICAgIHZhciBuOwogICAgICAgIHZhciBwcmV2bGVuID0gLTE7CiAgICAgICAgdmFyIGN1cmxlbjsKICAgICAgICB2YXIgbmV4dGxlbiA9IHRyZWVbMCAqIDIgKyAxXTsKICAgICAgICB2YXIgY291bnQgPSAwOwogICAgICAgIHZhciBtYXhfY291bnQgPSA3OwogICAgICAgIHZhciBtaW5fY291bnQgPSA0OwogICAgICAgIGlmIChuZXh0bGVuID09PSAwKSB7CiAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgIH0KICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IG1heF9jb2RlOyBuKyspIHsKICAgICAgICAgIGN1cmxlbiA9IG5leHRsZW47CiAgICAgICAgICBuZXh0bGVuID0gdHJlZVsobiArIDEpICogMiArIDFdOwogICAgICAgICAgaWYgKCsrY291bnQgPCBtYXhfY291bnQgJiYgY3VybGVuID09PSBuZXh0bGVuKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfSBlbHNlIGlmIChjb3VudCA8IG1pbl9jb3VudCkgewogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGN1cmxlbiwgcy5ibF90cmVlKTsKICAgICAgICAgICAgfSB3aGlsZSAoLS1jb3VudCAhPT0gMCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiAhPT0gMCkgewogICAgICAgICAgICBpZiAoY3VybGVuICE9PSBwcmV2bGVuKSB7CiAgICAgICAgICAgICAgc2VuZF9jb2RlKHMsIGN1cmxlbiwgcy5ibF90cmVlKTsKICAgICAgICAgICAgICBjb3VudC0tOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHNlbmRfY29kZShzLCBSRVBfM182LCBzLmJsX3RyZWUpOwogICAgICAgICAgICBzZW5kX2JpdHMocywgY291bnQgLSAzLCAyKTsKICAgICAgICAgIH0gZWxzZSBpZiAoY291bnQgPD0gMTApIHsKICAgICAgICAgICAgc2VuZF9jb2RlKHMsIFJFUFpfM18xMCwgcy5ibF90cmVlKTsKICAgICAgICAgICAgc2VuZF9iaXRzKHMsIGNvdW50IC0gMywgMyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzZW5kX2NvZGUocywgUkVQWl8xMV8xMzgsIHMuYmxfdHJlZSk7CiAgICAgICAgICAgIHNlbmRfYml0cyhzLCBjb3VudCAtIDExLCA3KTsKICAgICAgICAgIH0KICAgICAgICAgIGNvdW50ID0gMDsKICAgICAgICAgIHByZXZsZW4gPSBjdXJsZW47CiAgICAgICAgICBpZiAobmV4dGxlbiA9PT0gMCkgewogICAgICAgICAgICBtYXhfY291bnQgPSAxMzg7CiAgICAgICAgICAgIG1pbl9jb3VudCA9IDM7CiAgICAgICAgICB9IGVsc2UgaWYgKGN1cmxlbiA9PT0gbmV4dGxlbikgewogICAgICAgICAgICBtYXhfY291bnQgPSA2OwogICAgICAgICAgICBtaW5fY291bnQgPSAzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgbWF4X2NvdW50ID0gNzsKICAgICAgICAgICAgbWluX2NvdW50ID0gNDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgICAgZnVuY3Rpb24gYnVpbGRfYmxfdHJlZShzKSB7CiAgICAgICAgdmFyIG1heF9ibGluZGV4OwogICAgICAgIHNjYW5fdHJlZShzLCBzLmR5bl9sdHJlZSwgcy5sX2Rlc2MubWF4X2NvZGUpOwogICAgICAgIHNjYW5fdHJlZShzLCBzLmR5bl9kdHJlZSwgcy5kX2Rlc2MubWF4X2NvZGUpOwogICAgICAgIGJ1aWxkX3RyZWUocywgcy5ibF9kZXNjKTsKICAgICAgICBmb3IgKG1heF9ibGluZGV4ID0gQkxfQ09ERVMgLSAxOyBtYXhfYmxpbmRleCA+PSAzOyBtYXhfYmxpbmRleC0tKSB7CiAgICAgICAgICBpZiAocy5ibF90cmVlW2JsX29yZGVyW21heF9ibGluZGV4XSAqIDIgKyAxXSAhPT0gMCkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5vcHRfbGVuICs9IDMgKiAobWF4X2JsaW5kZXggKyAxKSArIDUgKyA1ICsgNDsKICAgICAgICByZXR1cm4gbWF4X2JsaW5kZXg7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gc2VuZF9hbGxfdHJlZXMocywgbGNvZGVzLCBkY29kZXMsIGJsY29kZXMpIHsKICAgICAgICB2YXIgcmFuazsKICAgICAgICBzZW5kX2JpdHMocywgbGNvZGVzIC0gMjU3LCA1KTsKICAgICAgICBzZW5kX2JpdHMocywgZGNvZGVzIC0gMSwgNSk7CiAgICAgICAgc2VuZF9iaXRzKHMsIGJsY29kZXMgLSA0LCA0KTsKICAgICAgICBmb3IgKHJhbmsgPSAwOyByYW5rIDwgYmxjb2RlczsgcmFuaysrKSB7CiAgICAgICAgICBzZW5kX2JpdHMocywgcy5ibF90cmVlW2JsX29yZGVyW3JhbmtdICogMiArIDFdLCAzKTsKICAgICAgICB9CiAgICAgICAgc2VuZF90cmVlKHMsIHMuZHluX2x0cmVlLCBsY29kZXMgLSAxKTsKICAgICAgICBzZW5kX3RyZWUocywgcy5keW5fZHRyZWUsIGRjb2RlcyAtIDEpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRldGVjdF9kYXRhX3R5cGUocykgewogICAgICAgIHZhciBibGFja19tYXNrID0gNDA5MzYyNDQ0NzsKICAgICAgICB2YXIgbjsKICAgICAgICBmb3IgKG4gPSAwOyBuIDw9IDMxOyBuKyssIGJsYWNrX21hc2sgPj4+PSAxKSB7CiAgICAgICAgICBpZiAoYmxhY2tfbWFzayAmIDEgJiYgcy5keW5fbHRyZWVbbiAqIDJdICE9PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBaX0JJTkFSWTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuZHluX2x0cmVlWzkgKiAyXSAhPT0gMCB8fCBzLmR5bl9sdHJlZVsxMCAqIDJdICE9PSAwIHx8IHMuZHluX2x0cmVlWzEzICogMl0gIT09IDApIHsKICAgICAgICAgIHJldHVybiBaX1RFWFQ7CiAgICAgICAgfQogICAgICAgIGZvciAobiA9IDMyOyBuIDwgTElURVJBTFM7IG4rKykgewogICAgICAgICAgaWYgKHMuZHluX2x0cmVlW24gKiAyXSAhPT0gMCkgewogICAgICAgICAgICByZXR1cm4gWl9URVhUOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gWl9CSU5BUlk7CiAgICAgIH0KICAgICAgdmFyIHN0YXRpY19pbml0X2RvbmUgPSBmYWxzZTsKICAgICAgZnVuY3Rpb24gX3RyX2luaXQocykgewogICAgICAgIGlmICghc3RhdGljX2luaXRfZG9uZSkgewogICAgICAgICAgdHJfc3RhdGljX2luaXQoKTsKICAgICAgICAgIHN0YXRpY19pbml0X2RvbmUgPSB0cnVlOwogICAgICAgIH0KICAgICAgICBzLmxfZGVzYyA9IG5ldyBUcmVlRGVzYyhzLmR5bl9sdHJlZSwgc3RhdGljX2xfZGVzYyk7CiAgICAgICAgcy5kX2Rlc2MgPSBuZXcgVHJlZURlc2Mocy5keW5fZHRyZWUsIHN0YXRpY19kX2Rlc2MpOwogICAgICAgIHMuYmxfZGVzYyA9IG5ldyBUcmVlRGVzYyhzLmJsX3RyZWUsIHN0YXRpY19ibF9kZXNjKTsKICAgICAgICBzLmJpX2J1ZiA9IDA7CiAgICAgICAgcy5iaV92YWxpZCA9IDA7CiAgICAgICAgaW5pdF9ibG9jayhzKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfdHJfc3RvcmVkX2Jsb2NrKHMsIGJ1Ziwgc3RvcmVkX2xlbiwgbGFzdCkgewogICAgICAgIHNlbmRfYml0cyhzLCAoU1RPUkVEX0JMT0NLIDw8IDEpICsgKGxhc3QgPyAxIDogMCksIDMpOwogICAgICAgIGNvcHlfYmxvY2socywgYnVmLCBzdG9yZWRfbGVuLCB0cnVlKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfdHJfYWxpZ24ocykgewogICAgICAgIHNlbmRfYml0cyhzLCBTVEFUSUNfVFJFRVMgPDwgMSwgMyk7CiAgICAgICAgc2VuZF9jb2RlKHMsIEVORF9CTE9DSywgc3RhdGljX2x0cmVlKTsKICAgICAgICBiaV9mbHVzaChzKTsKICAgICAgfQogICAgICBmdW5jdGlvbiBfdHJfZmx1c2hfYmxvY2socywgYnVmLCBzdG9yZWRfbGVuLCBsYXN0KSB7CiAgICAgICAgdmFyIG9wdF9sZW5iLCBzdGF0aWNfbGVuYjsKICAgICAgICB2YXIgbWF4X2JsaW5kZXggPSAwOwogICAgICAgIGlmIChzLmxldmVsID4gMCkgewogICAgICAgICAgaWYgKHMuc3RybS5kYXRhX3R5cGUgPT09IFpfVU5LTk9XTikgewogICAgICAgICAgICBzLnN0cm0uZGF0YV90eXBlID0gZGV0ZWN0X2RhdGFfdHlwZShzKTsKICAgICAgICAgIH0KICAgICAgICAgIGJ1aWxkX3RyZWUocywgcy5sX2Rlc2MpOwogICAgICAgICAgYnVpbGRfdHJlZShzLCBzLmRfZGVzYyk7CiAgICAgICAgICBtYXhfYmxpbmRleCA9IGJ1aWxkX2JsX3RyZWUocyk7CiAgICAgICAgICBvcHRfbGVuYiA9IHMub3B0X2xlbiArIDMgKyA3ID4+PiAzOwogICAgICAgICAgc3RhdGljX2xlbmIgPSBzLnN0YXRpY19sZW4gKyAzICsgNyA+Pj4gMzsKICAgICAgICAgIGlmIChzdGF0aWNfbGVuYiA8PSBvcHRfbGVuYikgewogICAgICAgICAgICBvcHRfbGVuYiA9IHN0YXRpY19sZW5iOwogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBvcHRfbGVuYiA9IHN0YXRpY19sZW5iID0gc3RvcmVkX2xlbiArIDU7CiAgICAgICAgfQogICAgICAgIGlmIChzdG9yZWRfbGVuIC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B2YXIgczEgPSBhZGxlciAmIDY1NTM1IHwgMCwgczIgPSBhZGxlciA+Pj4gMTYgJiA2NTUzNSB8IDAsIG4gPSAwOwogICAgICAgIHdoaWxlIChsZW4gIT09IDApIHsKICAgICAgICAgIG4gPSBsZW4gPiAyZTMgPyAyZTMgOiBsZW47CiAgICAgICAgICBsZW4gLT0gbjsKICAgICAgICAgIGRvIHsKICAgICAgICAgICAgczEgPSBzMSArIGJ1Zltwb3MrK10gfCAwOwogICAgICAgICAgICBzMiA9IHMyICsgczEgfCAwOwogICAgICAgICAgfSB3aGlsZSAoLS1uKTsKICAgICAgICAgIHMxICU9IDY1NTIxOwogICAgICAgICAgczIgJT0gNjU1MjE7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzMSB8IHMyIDw8IDE2IHwgMDsKICAgICAgfQogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBhZGxlcjMyOwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvY3JjMzIuanMKICB2YXIgcmVxdWlyZV9jcmMzMiA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9jcmMzMi5qcyIoZXhwb3J0czIsIG1vZHVsZTIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIGZ1bmN0aW9uIG1ha2VUYWJsZSgpIHsKICAgICAgICB2YXIgYywgdGFibGUgPSBbXTsKICAgICAgICBmb3IgKHZhciBuID0gMDsgbiA8IDI1NjsgbisrKSB7CiAgICAgICAgICBjID0gbjsKICAgICAgICAgIGZvciAodmFyIGsgPSAwOyBrIDwgODsgaysrKSB7CiAgICAgICAgICAgIGMgPSBjICYgMSA/IDM5ODgyOTIzODQgXiBjID4+PiAxIDogYyA+Pj4gMTsKICAgICAgICAgIH0KICAgICAgICAgIHRhYmxlW25dID0gYzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRhYmxlOwogICAgICB9CiAgICAgIHZhciBjcmNUYWJsZSA9IG1ha2VUYWJsZSgpOwogICAgICBmdW5jdGlvbiBjcmMzMihjcmMsIGJ1ZiwgbGVuLCBwb3MpIHsKICAgICAgICB2YXIgdCA9IGNyY1RhYmxlLCBlbmQgPSBwb3MgKyBsZW47CiAgICAgICAgY3JjIF49IC0xOwogICAgICAgIGZvciAodmFyIGkgPSBwb3M7IGkgPCBlbmQ7IGkrKykgewogICAgICAgICAgY3JjID0gY3JjID4+PiA4IF4gdFsoY3JjIF4gYnVmW2ldKSAmIDI1NV07CiAgICAgICAgfQogICAgICAgIHJldHVybiBjcmMgXiAtMTsKICAgICAgfQogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBjcmMzMjsKICAgIH0KICB9KTsKCiAgLy8gbm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL21lc3NhZ2VzLmpzCiAgdmFyIHJlcXVpcmVfbWVzc2FnZXMgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvbWVzc2FnZXMuanMiKGV4cG9ydHMyLCBtb2R1bGUyKSB7CiAgICAgIGluaXRfYnVmZmVyX3NoaW0oKTsKICAgICAgInVzZSBzdHJpY3QiOwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSB7CiAgICAgICAgMjogIm5lZWQgZGljdGlvbmFyeSIsCiAgICAgICAgMTogInN0cmVhbSBlbmQiLAogICAgICAgIDA6ICIiLAogICAgICAgICItMSI6ICJmaWxlIGVycm9yIiwKICAgICAgICAiLTIiOiAic3RyZWFtIGVycm9yIiwKICAgICAgICAiLTMiOiAiZGF0YSBlcnJvciIsCiAgICA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CU19ORUVEX01PUkUgPSAxOwogICAgICB2YXIgQlNfQkxPQ0tfRE9ORSA9IDI7CiAgICAgIHZhciBCU19GSU5JU0hfU1RBUlRFRCA9IDM7CiAgICAgIHZhciBCU19GSU5JU0hfRE9ORSA9IDQ7CiAgICAgIHZhciBPU19DT0RFID0gMzsKICAgICAgZnVuY3Rpb24gZXJyKHN0cm0sIGVycm9yQ29kZSkgewogICAgICAgIHN0cm0ubXNnID0gbXNnW2Vycm9yQ29kZV07CiAgICAgICAgcmV0dXJuIGVycm9yQ29kZTsKICAgICAgfQogICAgICBmdW5jdGlvbiByYW5rKGYpIHsKICAgICAgICByZXR1cm4gKGYgPDwgMSkgLSAoZiA+IDQgPyA5IDogMCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gemVybyhidWYpIHsKICAgICAgICB2YXIgbGVuID0gYnVmLmxlbmd0aDsKICAgICAgICB3aGlsZSAoLS1sZW4gPj0gMCkgewogICAgICAgICAgYnVmW2xlbl0gPSAwOwogICAgICAgIH0KICAgICAgfQogICAgICBmdW5jdGlvbiBmbHVzaF9wZW5kaW5nKHN0cm0pIHsKICAgICAgICB2YXIgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgdmFyIGxlbiA9IHMucGVuZGluZzsKICAgICAgICBpZiAobGVuID4gc3RybS5hdmFpbF9vdXQpIHsKICAgICAgICAgIGxlbiA9IHN0cm0uYXZhaWxfb3V0OwogICAgICAgIH0KICAgICAgICBpZiAobGVuID09PSAwKSB7CiAgICAgICAgICByZXR1cm47CiAgICAgICAgfQogICAgICAgIHV0aWxzLmFycmF5U2V0KHN0cm0ub3V0cHV0LCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmdfb3V0LCBsZW4sIHN0cm0ubmV4dF9vdXQpOwogICAgICAgIHN0cm0ubmV4dF9vdXQgKz0gbGVuOwogICAgICAgIHMucGVuZGluZ19vdXQgKz0gbGVuOwogICAgICAgIHN0cm0udG90YWxfb3V0ICs9IGxlbjsKICAgICAg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S5pbnB1dCwgc3RybS5uZXh0X2luLCBsZW4sIHN0YXJ0KTsKICAgICAgICBpZiAoc3RybS5zdGF0ZS53cmFwID09PSAxKSB7CiAgICAgICAgICBzdHJtLmFkbGVyID0gYWRsZXIzMihzdHJtLmFkbGVyLCBidWYsIGxlbiwgc3RhcnQpOwogICAgICAgIH0gZWxzZSBpZiAoc3RybS5zdGF0ZS53cmFwID09PSAyKSB7CiAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgYnVmLCBsZW4sIHN0YXJ0KTsKICAgICAgICB9CiAgICAgICAgc3RybS5uZXh0X2luICs9IGxlbjsKICAgICAgICBzdHJtLnRvdGFsX2luICs9IGxlbjsKICAgICAgICByZXR1cm4gbGVuOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGxvbmdlc3RfbWF0Y2gocywgY3VyX21hdGNoKSB7CiAgICAgICAgdmFyIGNoYWluX2xlbmd0aCA9IHMubWF4X2NoYWluX2xlbmd0aDsKICAgICAgICB2YXIgc2NhbiA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgdmFyIG1hdGNoOwogICAgICAgIHZhciBsZW47CiAgICAgICAgdmFyIGJlc3RfbGVuID0gcy5wcmV2X2xlbmd0aDsKICAgICAgICB2YXIgbmljZV9tYXRjaCA9IHMubmljZV9tYXRjaDsKICAgICAgICB2YXIgbGltaXQgPSBzLnN0cnN0YXJ0ID4gcy53X3NpemUgLSBNSU5fTE9PS0FIRUFEID8gcy5zdHJzdGFydCAtIChzLndfc2l6ZSAtIE1JTl9MT09LQUhFQUQpIDogMDsKICAgICAgICB2YXIgX3dpbiA9IHMud2luZG93OwogICAgICAgIHZhciB3bWFzayA9IHMud19tYXNrOwogICAgICAgIHZhciBwcmV2ID0gcy5wcmV2OwogICAgICAgIHZhciBzdHJlbmQgPSBzLnN0cnN0YXJ0ICsgTUFYX01BVENIOwogICAgICAgIHZhciBzY2FuX2VuZDEgPSBfd2luW3NjYW4gKyBiZXN0X2xlbiAtIDFdOwogICAgICAgIHZhciBzY2FuX2VuZCA9IF93aW5bc2NhbiArIGJlc3RfbGVuXTsKICAgICAgICBpZiAocy5wcmV2X2xlbmd0aCA+PSBzLmdvb2RfbWF0Y2gpIHsKICAgICAgICAgIGNoYWluX2xlbmd0aCA+Pj0gMjsKICAgICAgICB9CiAgICAgICAgaWYgKG5pY2VfbWF0Y2ggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgbmljZV9tYXRjaCA9IHMubG9va2FoZWFkOwogICAgICAgIH0KICAgICAgICBkbyB7CiAgICAgICAgICBtYXRjaCA9IGN1cl9tYXRjaDsKICAgICAgICAgIGlmIChfd2luW21hdGNoICsgYmVzdF9sZW5dICE9PSBzY2FuX2VuZCB8fCBfd2luW21hdGNoICsgYmVzdF9sZW4gLSAxXSAhPT0gc2Nhbl9lbmQxIHx8IF93aW5bbWF0Y2hdICE9PSBfd2luW3NjYW5dIHx8IF93aW5bKyttYXRjaF0gIT09IF93aW5bc2NhbiArIDFdKSB7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgc2NhbiArPSAyOwogICAgICAgICAgbWF0Y2grKzsKICAgICAgICAgIGRvIHsKICAgICAgICAgIH0gd2hpbGUgKF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgX3dpblsrK3NjYW5dID09PSBfd2luWysrbWF0Y2hdICYmIF93aW5bKytzY2FuXSA9PT0gX3dpblsrK21hdGNoXSAmJiBfd2luWysrc2Nhbl0gPT09IF93aW5bKyttYXRjaF0gJiYgc2NhbiA8IHN0cmVuZCk7CiAgICAgICAgICBsZW4gPSBNQVhfTUFUQ0ggLSAoc3RyZW5kIC0gc2Nhbik7CiAgICAgICAgICBzY2FuID0gc3RyZW5kIC0gTUFYX01BVENIOwogICAgICAgICAgaWYgKGxlbiA+IGJlc3RfbGVuKSB7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgPSBjdXJfbWF0Y2g7CiAgICAgICAgICAgIGJlc3RfbGVuID0gbGVuOwogICAgICAgICAgICBpZiAobGVuID49IG5pY2VfbWF0Y2gpIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBzY2FuX2VuZDEgPSBfd2luW3NjYW4gKyBiZXN0X2xlbiAtIDFdOwogICAgICAgICAgICBzY2FuX2VuZCA9IF93aW5bc2NhbiArIGJlc3RfbGVuXTsKICAgICAgICAgIH0KICAgICAgICB9IHdoaWxlICgoY3VyX21hdGNoID0gcHJldltjdXJfbWF0Y2ggJiB3bWFza10pID4gbGltaXQgJiYgLS1jaGFpbl9sZW5ndGggIT09IDApOwogICAgICAgIGlmIChiZXN0X2xlbiA8PSBzLmxvb2thaGVhZCkgewogICAgICAgICAgcmV0dXJuIGJlc3RfbGVuOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcy5sb29rYWhlYWQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZmlsbF93aW5kb3cocykgewogICAgICAgIHZhciBfd19zaXplID0gcy53X3NpemU7CiAgICAgICAgdmFyIHAsIG4sIG0sIG1vcmUsIHN0cjsKICAgICAgICBkbyB7CiAgICAgICAgICBtb3JlID0gcy53aW5kb3dfc2l6ZSAtIHMubG9va2FoZWFkIC0gcy5zdHJzdGFydDsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID49IF93X3NpemUgKyAoX3dfc2l6ZSAtIE1JTl9MT09LQUhFQUQpKSB7CiAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHMud2luZG93LCBzLndpbmRvdywgX3dfc2l6ZSwgX3dfc2l6ZSwgMCk7CiAgICAgICAgICAgIHMubWF0Y2hfc3RhcnQgLT0gX3dfc2l6ZTsKICAgICAgICAgICAgcy5zdHJzdGFydCAtPSBfd19zaXplOwogICAgICAgICAgICBzLmJsb2NrX3N0YXJ0IC09IF93X3NpemU7CiAgICAgICAgICAgIG4gPSBzLmhhc2hfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5oZWFkWy0tcF07CiAgICAgICAgICAgICAgcy5oZWFkW3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBuID0gX3dfc2l6ZTsKICAgICAgICAgICAgcCA9IG47CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBtID0gcy5wcmV2Wy0tcF07CiAgICAgICAgICAgICAgcy5wcmV2W3BdID0gbSA+PSBfd19zaXplID8gbSAtIF93X3NpemUgOiAwOwogICAgICAgICAgICB9IHdoaWxlICgtLW4pOwogICAgICAgICAgICBtb3JlICs9IF93X3NpemU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX2luID09PSAwKSB7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAgICAgbiA9IHJlYWRfYnVmKHMuc3RybSwgcy53aW5kb3csIHMuc3Ryc3RhcnQgKyBzLmxvb2thaGVhZCwgbW9yZSk7CiAgICAgICAgICBzLmxvb2thaGVhZCArPSBuOwogICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHN0ciA9IHMuc3Ryc3RhcnQgLSBzLmluc2VydDsKICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3N0cl07CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzdHIgKyAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgd2hpbGUgKHMuaW5zZXJ0KSB7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3N0ciArIE1JTl9NQVRDSCAtIDFdKSAmIHMuaGFzaF9tYXNrOwogICAgICAgICAgICAgIHMucHJldltzdHIgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gc3RyOwogICAgICAgICAgICAgIHN0cisrOwogICAgICAgICAgICAgIHMuaW5zZXJ0LS07CiAgICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkICsgcy5pbnNlcnQgPCBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBzLnN0cm0uYXZhaWxfaW4gIT09IDApOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVfc3RvcmVkKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIG1heF9ibG9ja19zaXplID0gNjU1MzU7CiAgICAgICAgaWYgKG1heF9ibG9ja19zaXplID4gcy5wZW5kaW5nX2J1Zl9zaXplIC0gNSkgewogICAgICAgICAgbWF4X2Jsb2NrX3NpemUgPSBzLnBlbmRpbmdfYnVmX3NpemUgLSA1OwogICAgICAgIH0KICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA8PSAxKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDAgJiYgZmx1c2ggPT09IFpfTk9fRkxVU0gpIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBzLnN0cnN0YXJ0ICs9IHMubG9va2FoZWFkOwogICAgICAgICAgcy5sb29rYWhlYWQgPSAwOwogICAgICAgICAgdmFyIG1heF9zdGFydCA9IHMuYmxvY2tfc3RhcnQgKyBtYXhfYmxvY2tfc2l6ZTsKICAgICAgICAgIGlmIChzLnN0cnN0YXJ0ID09PSAwIHx8IHMuc3Ryc3RhcnQgPj0gbWF4X3N0YXJ0KSB7CiAgICAgICAgICAgIHMubG9va2FoZWFkID0gcy5zdHJzdGFydCAtIG1heF9zdGFydDsKICAgICAgICAgICAgcy5zdHJzdGFydCA9IG1heF9zdGFydDsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMuc3Ryc3RhcnQgLSBzLmJsb2NrX3N0YXJ0ID49IHMud19zaXplIC0gTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5zdHJzdGFydCA+IHMuYmxvY2tfc3RhcnQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX2Zhc3QocywgZmx1c2gpIHsKICAgICAgICB2YXIgaGFzaF9oZWFkOwogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPCBNSU5fTE9PS0FIRUFEICYmIGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPT09IDApIHsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaGFzaF9oZWFkID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgaGFzaF9oZWFkID0gcy5wcmV2W3Muc3Ryc3RhcnQgJiBzLndfbWFza10gPSBzLmhlYWRbcy5pbnNfaF07CiAgICAgICAgICAgIHMuaGVhZFtzLmluc19oXSA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoaGFzaF9oZWFkICE9PSAwICYmIHMuc3Ryc3RhcnQgLSBoYXNoX2hlYWQgPD0gcy53X3NpemUgLSBNSU5fTE9PS0FIRUFEKSB7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gbG9uZ2VzdF9tYXRjaChzLCBoYXNoX2hlYWQpOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHMubWF0Y2hfbGVuZ3RoID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICBiZmx1c2ggPSB0cmVlcy5fdHJfdGFsbHkocywgcy5zdHJzdGFydCAtIHMubWF0Y2hfc3RhcnQsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA8PSBzLm1heF9sYXp5X21hdGNoICYmIHMubG9va2FoZWFkID49IE1JTl9NQVRDSCkgewogICAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoLS07CiAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgcy5zdHJzdGFydCsrOwogICAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9IHdoaWxlICgtLXMubWF0Y2hfbGVuZ3RoICE9PSAwKTsKICAgICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcy5zdHJzdGFydCArPSBzLm1hdGNoX2xlbmd0aDsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IDA7CiAgICAgICAgICAgICAgcy5pbnNfaCA9IHMud2luZG93W3Muc3Ryc3RhcnRdOwogICAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IHMuc3Ryc3RhcnQgPCBNSU5fTUFUQ0ggLSAxID8gcy5zdHJzdGFydCA6IE1JTl9NQVRDSCAtIDE7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9zbG93KHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGhhc2hfaGVhZDsKICAgICAgICB2YXIgYmZsdXNoOwogICAgICAgIHZhciBtYXhfaW5zZXJ0OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDwgTUlOX0xPT0tBSEVBRCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGhhc2hfaGVhZCA9IDA7CiAgICAgICAgICBpZiAocy5sb29rYWhlYWQgPj0gTUlOX01BVENIKSB7CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzLnN0cnN0YXJ0ICsgTUlOX01BVENIIC0gMV0pICYgcy5oYXNoX21hc2s7CiAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYg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X01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5wcmV2X2xlbmd0aCAtIDE7CiAgICAgICAgICAgIHMucHJldl9sZW5ndGggLT0gMjsKICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgIGlmICgrK3Muc3Ryc3RhcnQgPD0gbWF4X2luc2VydCkgewogICAgICAgICAgICAgICAgcy5pbnNfaCA9IChzLmluc19oIDw8IHMuaGFzaF9zaGlmdCBeIHMud2luZG93W3Muc3Ryc3RhcnQgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgICAgIGhhc2hfaGVhZCA9IHMucHJldltzLnN0cnN0YXJ0ICYgcy53X21hc2tdID0gcy5oZWFkW3MuaW5zX2hdOwogICAgICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hdID0gcy5zdHJzdGFydDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gd2hpbGUgKC0tcy5wcmV2X2xlbmd0aCAhPT0gMCk7CiAgICAgICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMDsKICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAocy5tYXRjaF9hdmFpbGFibGUpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcy5tYXRjaF9hdmFpbGFibGUgPSAxOwogICAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLm1hdGNoX2F2YWlsYWJsZSkgewogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnQgLSAxXSk7CiAgICAgICAgICBzLm1hdGNoX2F2YWlsYWJsZSA9IDA7CiAgICAgICAgfQogICAgICAgIHMuaW5zZXJ0ID0gcy5zdHJzdGFydCA8IE1JTl9NQVRDSCAtIDEgPyBzLnN0cnN0YXJ0IDogTUlOX01BVENIIC0gMTsKICAgICAgICBpZiAoZmx1c2ggPT09IFpfRklOSVNIKSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIHRydWUpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9TVEFSVEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIEJTX0ZJTklTSF9ET05FOwogICAgICAgIH0KICAgICAgICBpZiAocy5sYXN0X2xpdCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gQlNfQkxPQ0tfRE9ORTsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlX3JsZShzLCBmbHVzaCkgewogICAgICAgIHZhciBiZmx1c2g7CiAgICAgICAgdmFyIHByZXY7CiAgICAgICAgdmFyIHNjYW4sIHN0cmVuZDsKICAgICAgICB2YXIgX3dpbiA9IHMud2luZG93OwogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkIDw9IE1BWF9NQVRDSCAmJiBmbHVzaCA9PT0gWl9OT19GTFVTSCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0ggJiYgcy5zdHJzdGFydCA+IDApIHsKICAgICAgICAgICAgc2NhbiA9IHMuc3Ryc3RhcnQgLSAxOwogICAgICAgICAgICBwcmV2ID0gX3dpbltzY2FuXTsKICAgICAgICAgICAgaWYgKHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dKSB7CiAgICAgICAgICAgICAgc3RyZW5kID0gcy5zdHJzdGFydCArIE1BWF9NQVRDSDsKICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgfSB3aGlsZSAocHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBwcmV2ID09PSBfd2luWysrc2Nhbl0gJiYgcHJldiA9PT0gX3dpblsrK3NjYW5dICYmIHByZXYgPT09IF93aW5bKytzY2FuXSAmJiBzY2FuIDwgc3RyZW5kKTsKICAgICAgICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IE1BWF9NQVRDSCAtIChzdHJlbmQgLSBzY2FuKTsKICAgICAgICAgICAgICBpZiAocy5tYXRjaF9sZW5ndGggPiBzLmxvb2thaGVhZCkgewogICAgICAgICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSBzLmxvb2thaGVhZDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzLm1hdGNoX2xlbmd0aCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDEsIHMubWF0Y2hfbGVuZ3RoIC0gTUlOX01BVENIKTsKICAgICAgICAgICAgcy5sb29rYWhlYWQgLT0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgKz0gcy5tYXRjaF9sZW5ndGg7CiAgICAgICAgICAgIHMubWF0Y2hfbGVuZ3RoID0gMDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGJmbHVzaCA9IHRyZWVzLl90cl90YWxseShzLCAwLCBzLndpbmRvd1tzLnN0cnN0YXJ0XSk7CiAgICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICAgIHMuc3Ryc3RhcnQrKzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChiZmx1c2gpIHsKICAgICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCBmYWxzZSk7CiAgICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBzLmluc2VydCA9IDA7CiAgICAgICAgaWYgKGZsdXNoID09PSBaX0ZJTklTSCkgewogICAgICAgICAgZmx1c2hfYmxvY2tfb25seShzLCB0cnVlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfU1RBUlRFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBCU19GSU5JU0hfRE9ORTsKICAgICAgICB9CiAgICAgICAgaWYgKHMubGFzdF9saXQpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgaWYgKHMuc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgcmV0dXJuIEJTX05FRURfTU9SRTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIEJTX0JMT0NLX0RPTkU7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZV9odWZmKHMsIGZsdXNoKSB7CiAgICAgICAgdmFyIGJmbHVzaDsKICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgIGlmIChzLmxvb2thaGVhZCA9PT0gMCkgewogICAgICAgICAgICBmaWxsX3dpbmRvdyhzKTsKICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX05PX0ZMVVNIKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gQlNfTkVFRF9NT1JFOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcy5tYXRjaF9sZW5ndGggPSAwOwogICAgICAgICAgYmZsdXNoID0gdHJlZXMuX3RyX3RhbGx5KHMsIDAsIHMud2luZG93W3Muc3Ryc3RhcnRdKTsKICAgICAgICAgIHMubG9va2FoZWFkLS07CiAgICAgICAgICBzLnN0cnN0YXJ0Kys7CiAgICAgICAgICBpZiAoYmZsdXNoKSB7CiAgICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgZmFsc2UpOwogICAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgIGlmIChmbHVzaCA9PT0gWl9GSU5JU0gpIHsKICAgICAgICAgIGZsdXNoX2Jsb2NrX29ubHkocywgdHJ1ZSk7CiAgICAgICAgICBpZiAocy5zdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX1NUQVJURUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gQlNfRklOSVNIX0RPTkU7CiAgICAgICAgfQogICAgICAgIGlmIChzLmxhc3RfbGl0KSB7CiAgICAgICAgICBmbHVzaF9ibG9ja19vbmx5KHMsIGZhbHNlKTsKICAgICAgICAgIGlmIChzLnN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHJldHVybiBCU19ORUVEX01PUkU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBCU19CTE9DS19ET05FOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIENvbmZpZyhnb29kX2xlbmd0aCwgbWF4X2xhenksIG5pY2VfbGVuZ3RoLCBtYXhfY2hhaW4sIGZ1bmMpIHsKICAgICAgICB0aGlzLmdvb2RfbGVuZ3RoID0gZ29vZF9sZW5ndGg7CiAgICAgICAgdGhpcy5tYXhfbGF6eSA9IG1heF9sYXp5OwogICAgICAgIHRoaXMubmljZV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jb25maWd1cmF0aW9uX3RhYmxlW3MubGV2ZWxdLmdvb2RfbGVuZ3RoOwogICAgICAgIHMubmljZV9tYXRjaCA9IGNvbmZpZ3VyYXRpb25fdGFibGVbcy5sZXZlbF0ubmljZV9sZW5ndGg7CiAgICAgICAgcy5tYXhfY2hhaW5fbGVuZ3RoID0gY29uZmlndXJhdGlvbl90YWJsZVtzLmxldmVsXS5tYXhfY2hhaW47CiAgICAgICAgcy5zdHJzdGFydCA9IDA7CiAgICAgICAgcy5ibG9ja19zdGFydCA9IDA7CiAgICAgICAgcy5sb29rYWhlYWQgPSAwOwogICAgICAgIHMuaW5zZXJ0ID0gMDsKICAgICAgICBzLm1hdGNoX2xlbmd0aCA9IHMucHJldl9sZW5ndGggPSBNSU5fTUFUQ0ggLSAxOwogICAgICAgIHMubWF0Y2hfYXZhaWxhYmxlID0gMDsKICAgICAgICBzLmluc19oID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBEZWZsYXRlU3RhdGUoKSB7CiAgICAgICAgdGhpcy5zdHJtID0gbnVsbDsKICAgICAgICB0aGlzLnN0YXR1cyA9IDA7CiAgICAgICAgdGhpcy5wZW5kaW5nX2J1ZiA9IG51bGw7CiAgICAgICAgdGhpcy5wZW5kaW5nX2J1Zl9zaXplID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICB0aGlzLnBlbmRpbmcgPSAwOwogICAgICAgIHRoaXMud3JhcCA9IDA7CiAgICAgICAgdGhpcy5nemhlYWQgPSBudWxsOwogICAgICAgIHRoaXMuZ3ppbmRleCA9IDA7CiAgICAgICAgdGhpcy5tZXRob2QgPSBaX0RFRkxBVEVEOwogICAgICAgIHRoaXMubGFzdF9mbHVzaCA9IC0xOwogICAgICAgIHRoaXMud19zaXplID0gMDsKICAgICAgICB0aGlzLndfYml0cyA9IDA7CiAgICAgICAgdGhpcy53X21hc2sgPSAwOwogICAgICAgIHRoaXMud2luZG93ID0gbnVsbDsKICAgICAgIC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UpOwogICAgICAgIHplcm8odGhpcy5keW5fZHRyZWUpOwogICAgICAgIHplcm8odGhpcy5ibF90cmVlKTsKICAgICAgICB0aGlzLmxfZGVzYyA9IG51bGw7CiAgICAgICAgdGhpcy5kX2Rlc2MgPSBudWxsOwogICAgICAgIHRoaXMuYmxfZGVzYyA9IG51bGw7CiAgICAgICAgdGhpcy5ibF9jb3VudCA9IG5ldyB1dGlscy5CdWYxNihNQVhfQklUUyArIDEpOwogICAgICAgIHRoaXMuaGVhcCA9IG5ldyB1dGlscy5CdWYxNigyICogTF9DT0RFUyArIDEpOwogICAgICAgIHplcm8odGhpcy5oZWFwKTsKICAgICAgICB0aGlzLmhlYXBfbGVuID0gMDsKICAgICAgICB0aGlzLmhlYXBfbWF4ID0gMDsKICAgICAgICB0aGlzLmRlcHRoID0gbmV3IHV0aWxzLkJ1ZjE2KDIgKiBMX0NPREVTICsgMSk7CiAgICAgICAgemVybyh0aGlzLmRlcHRoKTsKICAgICAgICB0aGlzLmxfYnVmID0gMDsKICAgICAgICB0aGlzLmxpdF9idWZzaXplID0gMDsKICAgICAgICB0aGlzLmxhc3RfbGl0ID0gMDsKICAgICAgICB0aGlzLmRfYnVmID0gMDsKICAgICAgICB0aGlzLm9wdF9sZW4gPSAwOwogICAgICAgIHRoaXMuc3RhdGljX2xlbiA9IDA7CiAgICAgICAgdGhpcy5tYXRjaGVzID0gMDsKICAgICAgICB0aGlzLmluc2VydCA9IDA7CiAgICAgICAgdGhpcy5iaV9idWYgPSAwOwogICAgICAgIHRoaXMuYmlfdmFsaWQgPSAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVSZXNldEtlZXAoc3RybSkgewogICAgICAgIHZhciBzOwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBaX1NUUkVBTV9FUlJPUik7CiAgICAgICAgfQogICAgICAgIHN0cm0udG90YWxfaW4gPSBzdHJtLnRvdGFsX291dCA9IDA7CiAgICAgICAgc3RybS5kYXRhX3R5cGUgPSBaX1VOS05PV047CiAgICAgICAgcyA9IHN0cm0uc3RhdGU7CiAgICAgICAgcy5wZW5kaW5nID0gMDsKICAgICAgICBzLnBlbmRpbmdfb3V0ID0gMDsKICAgICAgICBpZiAocy53cmFwIDwgMCkgewogICAgICAgICAgcy53cmFwID0gLXMud3JhcDsKICAgICAgICB9CiAgICAgICAgcy5zdGF0dXMgPSBzLndyYXAgPyBJTklUX1NUQVRFIDogQlVTWV9TVEFURTsKICAgICAgICBzdHJtLmFkbGVyID0gcy53cmFwID09PSAyID8gMCA6IDE7CiAgICAgICAgcy5sYXN0X2ZsdXNoID0gWl9OT19GTFVTSDsKICAgICAgICB0cmVlcy5fdHJfaW5pdChzKTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBkZWZsYXRlUmVzZXQoc3RybSkgewogICAgICAgIHZhciByZXQgPSBkZWZsYXRlUmVzZXRLZWVwKHN0cm0pOwogICAgICAgIGlmIChyZXQgPT09IFpfT0spIHsKICAgICAgICAgIGxtX2luaXQoc3RybS5zdGF0ZSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZVNldEhlYWRlcihzdHJtLCBoZWFkKSB7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdHJtLnN0YXRlLndyYXAgIT09IDIpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RybS5zdGF0ZS5nemhlYWQgPSBoZWFkOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGVJbml0MihzdHJtLCBsZXZlbCwgbWV0aG9kLCB3aW5kb3dCaXRzLCBtZW1MZXZlbCwgc3RyYXRlZ3kpIHsKICAgICAgICBpZiAoIXN0cm0pIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgdmFyIHdyYXAgPSAxOwogICAgICAgIGlmIChsZXZlbCA9PT0gWl9ERUZBVUxUX0NPTVBSRVNTSU9OKSB7CiAgICAgICAgICBsZXZlbCA9IDY7CiAgICAgICAgfQogICAgICAgIGlmICh3aW5kb3dCaXRzIDwgMCkgewogICAgICAgICAgd3JhcCA9IDA7CiAgICAgICAgICB3aW5kb3dCaXRzID0gLXdpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIGlmICh3aW5kb3dCaXRzID4gMTUpIHsKICAgICAgICAgIHdyYXAgPSAyOwogICAgICAgICAgd2luZG93Qml0cyAtPSAxNjsKICAgICAgICB9CiAgICAgICAgaWYgKG1lbUxldmVsIDwgMSB8fCBtZW1MZXZlbCA+IE1BWF9NRU1fTEVWRUwgfHwgbWV0aG9kICE9PSBaX0RFRkxBVEVEIHx8IHdpbmRvd0JpdHMgPCA4IHx8IHdpbmRvd0JpdHMgPiAxNSB8fCBsZXZlbCA8IDAgfHwgbGV2ZWwgPiA5IHx8IHN0cmF0ZWd5IDwgMCB8fCBzdHJhdGVneSA+IFpfRklYRUQpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBpZiAod2luZG93Qml0cyA9PT0gOCkgewogICAgICAgICAgd2luZG93Qml0cyA9IDk7CiAgICAgICAgfQogICAgICAgIHZhciBzID0gbmV3IERlZmxhdGVTdGF0ZSgpOwogICAgICAgIHN0cm0uc3RhdGUgPSBzOwogICAgICAgIHMuc3RybSA9IHN0cm07CiAgICAgICAgcy53cmFwID0gd3JhcDsKICAgICAgICBzLmd6aGVhZCA9IG51bGw7CiAgICAgICAgcy53X2JpdHMgPSB3aW5kb3dCaX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MQVRFRCwgTUFYX1dCSVRTLCBERUZfTUVNX0xFVkVMLCBaX0RFRkFVTFRfU1RSQVRFR1kpOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGRlZmxhdGUoc3RybSwgZmx1c2gpIHsKICAgICAgICB2YXIgb2xkX2ZsdXNoLCBzOwogICAgICAgIHZhciBiZWcsIHZhbDsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUgfHwgZmx1c2ggPiBaX0JMT0NLIHx8IGZsdXNoIDwgMCkgewogICAgICAgICAgcmV0dXJuIHN0cm0gPyBlcnIoc3RybSwgWl9TVFJFQU1fRVJST1IpIDogWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHMgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICghc3RybS5vdXRwdXQgfHwgIXN0cm0uaW5wdXQgJiYgc3RybS5hdmFpbF9pbiAhPT0gMCB8fCBzLnN0YXR1cyA9PT0gRklOSVNIX1NUQVRFICYmIGZsdXNoICE9PSBaX0ZJTklTSCkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBzdHJtLmF2YWlsX291dCA9PT0gMCA/IFpfQlVGX0VSUk9SIDogWl9TVFJFQU1fRVJST1IpOwogICAgICAgIH0KICAgICAgICBzLnN0cm0gPSBzdHJtOwogICAgICAgIG9sZF9mbHVzaCA9IHMubGFzdF9mbHVzaDsKICAgICAgICBzLmxhc3RfZmx1c2ggPSBmbHVzaDsKICAgICAgICBpZiAocy5zdGF0dXMgPT09IElOSVRfU1RBVEUpIHsKICAgICAgICAgIGlmIChzLndyYXAgPT09IDIpIHsKICAgICAgICAgICAgc3RybS5hZGxlciA9IDA7CiAgICAgICAgICAgIHB1dF9ieXRlKHMsIDMxKTsKICAgICAgICAgICAgcHV0X2J5dGUocywgMTM5KTsKICAgICAgICAgICAgcHV0X2J5dGUocywgOCk7CiAgICAgICAgICAgIGlmICghcy5nemhlYWQpIHsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCAwKTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgT1NfQ09ERSk7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHB1dF9ieXRlKHMsIChzLmd6aGVhZC50ZXh0ID8gMSA6IDApICsgKHMuZ3poZWFkLmhjcmMgPyAyIDogMCkgKyAoIXMuZ3poZWFkLmV4dHJhID8gMCA6IDQpICsgKCFzLmd6aGVhZC5uYW1lID8gMCA6IDgpICsgKCFzLmd6aGVhZC5jb21tZW50ID8gMCA6IDE2KSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQudGltZSA+PiA4ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDE2ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC50aW1lID4+IDI0ICYgMjU1KTsKICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmxldmVsID09PSA5ID8gMiA6IHMuc3RyYXRlZ3kgPj0gWl9IVUZGTUFOX09OTFkgfHwgcy5sZXZlbCA8IDIgPyA0IDogMCk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgcy5nemhlYWQub3MgJiAyNTUpOwogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5leHRyYSAmJiBzLmd6aGVhZC5leHRyYS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgIHB1dF9ieXRlKHMsIHMuZ3poZWFkLmV4dHJhLmxlbmd0aCAmIDI1NSk7CiAgICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYS5sZW5ndGggPj4gOCAmIDI1NSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjKSB7CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nLCAwKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcy5nemluZGV4ID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEVYVFJBX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB2YXIgaGVhZGVyID0gWl9ERUZMQVRFRCArIChzLndfYml0cyAtIDggPDwgNCkgPDwgODsKICAgICAgICAgICAgdmFyIGxldmVsX2ZsYWdzID0gLTE7CiAgICAgICAgICAgIGlmIChzLnN0cmF0ZWd5ID49IFpfSFVGRk1BTl9PTkxZIHx8IHMubGV2ZWwgPCAyKSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAwOwogICAgICAgICAgICB9IGVsc2UgaWYgKHMubGV2ZWwgPCA2KSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAxOwogICAgICAgICAgICB9IGVsc2UgaWYgKHMubGV2ZWwgPT09IDYpIHsKICAgICAgICAgICAgICBsZXZlbF9mbGFncyA9IDI7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgbGV2ZWxfZmxhZ3MgPSAzOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGhlYWRlciB8PSBsZXZlbF9mbGFncyA8PCA2OwogICAgICAgICAgICBpZiAocy5zdHJzdGFydCAhPT0gMCkgewogICAgICAgICAgICAgIGhlYWRlciB8PSBQUkVTRVRfRElDVDsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXIgKz0gMzEgLSBoZWFkZXIgJSAzMTsKICAgICAgICAgICAgcy5zdGF0dXMgPSBCVVNZX1NUQVRFOwogICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBoZWFkZXIpOwogICAgICAgICAgICBpZiAocy5zdHJzdGFydCAhPT0gMCkgewogICAgICAgICAgICAgIHB1dFNob3J0TVNCKHMsIHN0cm0uYWRsZXIgPj4+IDE2KTsKICAgICAgICAgICAgICBwdXRTaG9ydE1TQihzLCBzdHJtLmFkbGVyICYgNjU1MzUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHN0cm0uYWRsZXIgPSAxOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAocy5zdGF0dXMgPT09IEVYVFJBX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuZXh0cmEpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICB3aGlsZSAocy5nemluZGV4IDwgKHMuZ3poZWFkLmV4dHJhLmxlbmd0aCAmIDY1NTM1KSkgewogICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBjcmMzMihzdHJtLmFkbGVyLCBzLnBlbmRpbmdfYnVmLCBzLnBlbmRpbmcgLSBiZWcsIGJlZyk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwdXRfYnl0ZShzLCBzLmd6aGVhZC5leHRyYVtzLmd6aW5kZXhdICYgMjU1KTsKICAgICAgICAgICAgICBzLmd6aW5kZXgrKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPT09IHMuZ3poZWFkLmV4dHJhLmxlbmd0aCkgewogICAgICAgICAgICAgIHMuZ3ppbmRleCA9IDA7CiAgICAgICAgICAgICAgcy5zdGF0dXMgPSBOQU1FX1NUQVRFOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzLnN0YXR1cyA9IE5BTUVfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChzLnN0YXR1cyA9PT0gTkFNRV9TVEFURSkgewogICAgICAgICAgaWYgKHMuZ3poZWFkLm5hbWUpIHsKICAgICAgICAgICAgYmVnID0gcy5wZW5kaW5nOwogICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgaWYgKHMucGVuZGluZyA9PT0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgICAgdmFsID0gMTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzLmd6aW5kZXggPCBzLmd6aGVhZC5uYW1lLmxlbmd0aCkgewogICAgICAgICAgICAgICAgdmFsID0gcy5nemhlYWQubmFtZS5jaGFyQ29kZUF0KHMuZ3ppbmRleCsrKSAmIDI1NTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdmFsID0gMDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgdmFsKTsKICAgICAgICAgICAgfSB3aGlsZSAodmFsICE9PSAwKTsKICAgICAgICAgICAgaWYgKHMuZ3poZWFkLmhjcmMgJiYgcy5wZW5kaW5nID4gYmVnKSB7CiAgICAgICAgICAgICAgc3RybS5hZGxlciA9IGNyYzMyKHN0cm0uYWRsZXIsIHMucGVuZGluZ19idWYsIHMucGVuZGluZyAtIGJlZywgYmVnKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAodmFsID09PSAwKSB7CiAgICAgICAgICAgICAgcy5nemluZGV4ID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IENPTU1FTlRfU1RBVEU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuc3RhdHVzID0gQ09NTUVOVF9TVEFURTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBDT01NRU5UX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuY29tbWVudCkgewogICAgICAgICAgICBiZWcgPSBzLnBlbmRpbmc7CiAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICBpZiAocy5wZW5kaW5nID09PSBzLnBlbmRpbmdfYnVmX3NpemUpIHsKICAgICAgICAgICAgICAgIGlmIChzLmd6aGVhZC5oY3JjICYmIHMucGVuZGluZyA+IGJlZykgewogICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgICAgICAgIGJlZyA9IHMucGVuZGluZzsKICAgICAgICAgICAgICAgIGlmIChzLnBlbmRpbmcgPT09IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgICAgICB2YWwgPSAxOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHMuZ3ppbmRleCA8IHMuZ3poZWFkLmNvbW1lbnQubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICB2YWwgPSBzLmd6aGVhZC5jb21tZW50LmNoYXJDb2RlQXQocy5nemluZGV4KyspICYgMjU1OwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB2YWwgPSAwOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwdXRfYnl0ZShzLCB2YWwpOwogICAgICAgICAgICB9IHdoaWxlICh2YWwgIT09IDApOwogICAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYyAmJiBzLnBlbmRpbmcgPiBiZWcpIHsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gY3JjMzIoc3RybS5hZGxlciwgcy5wZW5kaW5nX2J1Ziwgcy5wZW5kaW5nIC0gYmVnLCBiZWcpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh2YWwgPT09IDApIHsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEhDUkNfU1RBVEU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuc3RhdHVzID0gSENSQ19TVEFURTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMuc3RhdHVzID09PSBIQ1JDX1NUQVRFKSB7CiAgICAgICAgICBpZiAocy5nemhlYWQuaGNyYykgewogICAgICAgICAgICBpZiAocy5wZW5kaW5nICsgMiA+IHMucGVuZGluZ19idWZfc2l6ZSkgewogICAgICAgICAgICAgIGZsdXNoX3BlbmRpbmcoc3RybSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMucGVuZGluZyArIDIgPD0gcy5wZW5kaW5nX2J1Zl9zaXplKSB7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciAmIDI1NSk7CiAgICAgICAgICAgICAgcHV0X2J5dGUocywgc3RybS5hZGxlciA+PiA4ICYgMjU1KTsKICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gMDsKICAgICAgICAgICAgICBzLnN0YXR1cyA9IEJVU1lfU1RBVEU7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMuc3RhdHVzID0gQlVTWV9TVEFURTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHMucGVuZGluZyAhPT0gMCkgewogICAgICAgICAgZmx1c2hfcGVuZGluZyhzdHJtKTsKICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICAgICAgcmV0dXJuIFpfT0s7CiAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIGlmIChzdHJtLmF2YWlsX2luID09PSAwICYmIHJhbmsoZmx1c2gpIDw9IHJhbmsob2xkX2ZsdXNoKSAmJiBmbHVzaCAhPT0gWl9GSU5JU0gpIHsKICAgICAgICAgIHJldHVybiBlcnIoc3RybSwgWl9CVUZfRVJST1IpOwogICAgICAgIH0KICAgICAgICBpZiAocy5zdGF0dXMgPT09IEZJTklTSF9TVEFURSAmJiBzdHJtLmF2YWlsX2luICE9PSAwKSB7CiAgICAgICAgICByZXR1cm4gZXJyKHN0cm0sIFpfQlVGX0VSUk9SKTsKICAgICAgICB9CiAgICAgICAgaWYgKHN0cm0uYXZhaWxfaW4gIT09IDAgfHwgcy5sb29rYWhlYWQgIT09IDAgfHwgZmx1c2ggIT09IFpfTk9fRkxVU0ggJiYgcy5zdGF0dXMgIT09IEZJTklTSF9TVEFURSkgewogICAgICAgICAgdmFyIGJzdGF0ZSA9IHMuc3RyYXRlZ3kgPT09IFpfSFVGRk1BTl9PTkxZID8gZGVmbGF0ZV9odWZmKHMsIGZsdXNoKSA6IHMuc3RyYXRlZ3kgPT09IFpfUkxFID8gZGVmbGF0ZV9ybGUocywgZmx1c2gpIDogY29uZmlndXJhdGlvbl90YWJsZVtzLmxldmVsXS5mdW5jKHMsIGZsdXNoKTsKICAgICAgICAgIGlmIChic3RhdGUgPT09IEJTX0ZJTklTSF9TVEFSVEVEIHx8IGJzdGF0ZSA9PT0gQlNfRklOSVNIX0RPTkUpIHsKICAgICAgICAgICAgcy5zdGF0dXMgPSBGSU5JU0hfU1RBVEU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYnN0YXRlID09PSBCU19ORUVEX01PUkUgfHwgYnN0YXRlID09PSBCU19GSU5JU0hfU1RBUlRFRCkgewogICAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICBzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChic3RhdGUgPT09IEJTX0JMT0NLX0RPTkUpIHsKICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX1BBUlRJQUxfRkxVU0gpIHsKICAgICAgICAgICAgICB0cmVlcy5fdHJfYWxpZ24ocyk7CiAgICAgICAgICAgIH0gZWxzZSBpZiAoZmx1c2ggIT09IFpfQkxPQ0spIHsKICAgICAgICAgICAgICB0cmVlcy5fdHJfc3RvcmVkX2Jsb2NrKHMsIDAsIDAsIGZhbHNlKTsKICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfRlVMTF9GTFVTSCkgewogICAgICAgICAgICAgICAgemVybyhzLmhlYWQpOwogICAgICAgICAgICAgICAgaWYgKHMubG9va2FoZWFkID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHMuc3Ryc3RhcnQgPSAwOwogICAgICAgICAgICAgICAgICBzLmJsb2NrX3N0YXJ0ID0gMDsKICAgICAgICAgICAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBmbHVzaF9wZW5kaW5nKHN0cm0pOwogICAgICAgICAgICBpZiAoc3RybS5hdmFpbF9vdXQgPT09IDApIHsKICAgICAgICAgICAgICBzLmxhc3RfZmx1c2ggPSAtMTsKICAgICAgICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoZmx1c2ggIT09IFpfRklOSVNIKSB7CiAgICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKHMud3JhcCA8PSAwKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRU5EOwogICAgICAgIH0KICAgICAgICBpZiAocy53cmFwID09PSAyKSB7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyICYgMjU1KTsKICAgICAgICAgIHB1dF9ieXRlKHMsIHN0cm0uYWRsZXIgPj4gOCAmIDI1NSk7CiAgICAgICAgICBwdXRfYnl0ZShzLCBzdHJtLmFkbGVyID4+IDE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lVTWV9TVEFURSAmJiBzdGF0dXMgIT09IEZJTklTSF9TVEFURSkgewogICAgICAgICAgcmV0dXJuIGVycihzdHJtLCBaX1NUUkVBTV9FUlJPUik7CiAgICAgICAgfQogICAgICAgIHN0cm0uc3RhdGUgPSBudWxsOwogICAgICAgIHJldHVybiBzdGF0dXMgPT09IEJVU1lfU1RBVEUgPyBlcnIoc3RybSwgWl9EQVRBX0VSUk9SKSA6IFpfT0s7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gZGVmbGF0ZVNldERpY3Rpb25hcnkoc3RybSwgZGljdGlvbmFyeSkgewogICAgICAgIHZhciBkaWN0TGVuZ3RoID0gZGljdGlvbmFyeS5sZW5ndGg7CiAgICAgICAgdmFyIHM7CiAgICAgICAgdmFyIHN0ciwgbjsKICAgICAgICB2YXIgd3JhcDsKICAgICAgICB2YXIgYXZhaWw7CiAgICAgICAgdmFyIG5leHQ7CiAgICAgICAgdmFyIGlucHV0OwogICAgICAgIHZhciB0bXBEaWN0OwogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICBzID0gc3RybS5zdGF0ZTsKICAgICAgICB3cmFwID0gcy53cmFwOwogICAgICAgIGlmICh3cmFwID09PSAyIHx8IHdyYXAgPT09IDEgJiYgcy5zdGF0dXMgIT09IElOSVRfU1RBVEUgfHwgcy5sb29rYWhlYWQpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgaWYgKHdyYXAgPT09IDEpIHsKICAgICAgICAgIHN0cm0uYWRsZXIgPSBhZGxlcjMyKHN0cm0uYWRsZXIsIGRpY3Rpb25hcnksIGRpY3RMZW5ndGgsIDApOwogICAgICAgIH0KICAgICAgICBzLndyYXAgPSAwOwogICAgICAgIGlmIChkaWN0TGVuZ3RoID49IHMud19zaXplKSB7CiAgICAgICAgICBpZiAod3JhcCA9PT0gMCkgewogICAgICAgICAgICB6ZXJvKHMuaGVhZCk7CiAgICAgICAgICAgIHMuc3Ryc3RhcnQgPSAwOwogICAgICAgICAgICBzLmJsb2NrX3N0YXJ0ID0gMDsKICAgICAgICAgICAgcy5pbnNlcnQgPSAwOwogICAgICAgICAgfQogICAgICAgICAgdG1wRGljdCA9IG5ldyB1dGlscy5CdWY4KHMud19zaXplKTsKICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHRtcERpY3QsIGRpY3Rpb25hcnksIGRpY3RMZW5ndGggLSBzLndfc2l6ZSwgcy53X3NpemUsIDApOwogICAgICAgICAgZGljdGlvbmFyeSA9IHRtcERpY3Q7CiAgICAgICAgICBkaWN0TGVuZ3RoID0gcy53X3NpemU7CiAgICAgICAgfQogICAgICAgIGF2YWlsID0gc3RybS5hdmFpbF9pbjsKICAgICAgICBuZXh0ID0gc3RybS5uZXh0X2luOwogICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gZGljdExlbmd0aDsKICAgICAgICBzdHJtLm5leHRfaW4gPSAwOwogICAgICAgIHN0cm0uaW5wdXQgPSBkaWN0aW9uYXJ5OwogICAgICAgIGZpbGxfd2luZG93KHMpOwogICAgICAgIHdoaWxlIChzLmxvb2thaGVhZCA+PSBNSU5fTUFUQ0gpIHsKICAgICAgICAgIHN0ciA9IHMuc3Ryc3RhcnQ7CiAgICAgICAgICBuID0gcy5sb29rYWhlYWQgLSAoTUlOX01BVENIIC0gMSk7CiAgICAgICAgICBkbyB7CiAgICAgICAgICAgIHMuaW5zX2ggPSAocy5pbnNfaCA8PCBzLmhhc2hfc2hpZnQgXiBzLndpbmRvd1tzdHIgKyBNSU5fTUFUQ0ggLSAxXSkgJiBzLmhhc2hfbWFzazsKICAgICAgICAgICAgcy5wcmV2W3N0ciAmIHMud19tYXNrXSA9IHMuaGVhZFtzLmluc19oXTsKICAgICAgICAgICAgcy5oZWFkW3MuaW5zX2hd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BvcyArIDEgPCBzdHJfbGVuKSB7CiAgICAgICAgICAgIGMyID0gc3RyLmNoYXJDb2RlQXQobV9wb3MgKyAxKTsKICAgICAgICAgICAgaWYgKChjMiAmIDY0NTEyKSA9PT0gNTYzMjApIHsKICAgICAgICAgICAgICBjID0gNjU1MzYgKyAoYyAtIDU1Mjk2IDw8IDEwKSArIChjMiAtIDU2MzIwKTsKICAgICAgICAgICAgICBtX3BvcysrOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDEyOCkgewogICAgICAgICAgICBidWZbaSsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCAyMDQ4KSB7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTkyIHwgYyA+Pj4gNjsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgaWYgKGMgPCA2NTUzNikgewogICAgICAgICAgICBidWZbaSsrXSA9IDIyNCB8IGMgPj4+IDEyOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDYgJiA2MzsKICAgICAgICAgICAgYnVmW2krK10gPSAxMjggfCBjICYgNjM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBidWZbaSsrXSA9IDI0MCB8IGMgPj4+IDE4OwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgPj4+IDEyICYgNjM7CiAgICAgICAgICAgIGJ1ZltpKytdID0gMTI4IHwgYyA+Pj4gNiAmIDYzOwogICAgICAgICAgICBidWZbaSsrXSA9IDEyOCB8IGMgJiA2MzsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJ1ZjsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gYnVmMmJpbnN0cmluZyhidWYsIGxlbikgewogICAgICAgIGlmIChsZW4gPCA2NTUzNCkgewogICAgICAgICAgaWYgKGJ1Zi5zdWJhcnJheSAmJiBTVFJfQVB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GMgPSBidWZbaSsrXTsKICAgICAgICAgIGlmIChjIDwgMTI4KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgfQogICAgICAgICAgY19sZW4gPSBfdXRmOGxlbltjXTsKICAgICAgICAgIGlmIChjX2xlbiA+IDQpIHsKICAgICAgICAgICAgdXRmMTZidWZbb3V0KytdID0gNjU1MzM7CiAgICAgICAgICAgIGkgKz0gY19sZW4gLSAxOwogICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgIH0KICAgICAgICAgIGMgJj0gY19sZW4gPT09IDIgPyAzMSA6IGNfbGVuID09PSAzID8gMTUgOiA3OwogICAgICAgICAgd2hpbGUgKGNfbGVuID4gMSAmJiBpIDwgbGVuKSB7CiAgICAgICAgICAgIGMgPSBjIDw8IDYgfCBidWZbaSsrXSAmIDYzOwogICAgICAgICAgICBjX2xlbi0tOwogICAgICAgICAgfQogICAgICAgICAgaWYgKGNfbGVuID4gMSkgewogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA2NTUzMzsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoYyA8IDY1NTM2KSB7CiAgICAgICAgICAgIHV0ZjE2YnVmW291dCsrXSA9IGM7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjIC09IDY1NTM2OwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NTI5NiB8IGMgPj4gMTAgJiAxMDIzOwogICAgICAgICAgICB1dGYxNmJ1ZltvdXQrK10gPSA1NjMyMCB8IGMgJiAxMDIzOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gYnVmMmJpbnN0cmluZyh1dGYxNmJ1Ziwgb3V0KTsKICAgICAgfTsKICAgICAgZXhwb3J0czIudXRmOGJvcmRlciA9IGZ1bmN0aW9uKGJ1ZiwgbWF4KSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBtYXggPSBtYXggfHwgYnVmLmxlbmd0aDsKICAgICAgICBpZiAobWF4ID4gYnVmLmxlbmd0aCkgewogICAgICAgICAgbWF4ID0gYnVmLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgcG9zID0gbWF4IC0gMTsKICAgICAgICB3aGlsZSAocG9zID49IDAgJiYgKGJ1Zltwb3NdICYgMTkyKSA9PT0gMTI4KSB7CiAgICAgICAgICBwb3MtLTsKICAgICAgICB9CiAgICAgICAgaWYgKHBvcyA8IDApIHsKICAgICAgICAgIHJldHVybiBtYXg7CiAgICAgICAgfQogICAgICAgIGlmIChwb3MgPT09IDApIHsKICAgICAgICAgIHJldHVybiBtYXg7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwb3MgKyBfdXRmOGxlbltidWZbcG9zXV0gPiBtYXggPyBwb3MgOiBtYXg7CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi96c3RyZWFtLmpzCiAgdmFyIHJlcXVpcmVfenN0cmVhbSA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi96c3RyZWFtLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgZnVuY3Rpb24gWlN0cmVhbSgpIHsKICAgICAgICB0aGlzLmlucHV0ID0gbnVsbDsKICAgICAgICB0aGlzLm5leHRfaW4gPSAwOwogICAgICAgIHRoaXMuYXZhaWxfaW4gPSAwOwogICAgICAgIHRoaXMudG90YWxfaW4gPSAwOwogICAgICAgIHRoaXMub3V0cHV0ID0gbnVsbDsKICAgICAgICB0aGlzLm5leHRfb3V0ID0gMDsKICAgICAgICB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U0lPTiA9IC0xOwogICAgICB2YXIgWl9ERUZBVUxUX1NUUkFURUdZID0gMDsKICAgICAgdmFyIFpfREVGTEFURUQgPSA4OwogICAgICBmdW5jdGlvbiBEZWZsYXRlKG9wdGlvbnMpIHsKICAgICAgICBpZiAoISh0aGlzIGluc3RhbmNlb2YgRGVmbGF0ZSkpCiAgICAgICAgICByZXR1cm4gbmV3IERlZmxhdGUob3B0aW9ucyk7CiAgICAgICAgdGhpcy5vcHRpb25zID0gdXRpbHMuYXNzaWduKHsKICAgICAgICAgIGxldmVsOiBaX0RFRkFVTFRfQ09NUFJFU1NJT04sCiAgICAgICAgICBtZXRob2Q6IFpfREVGTEFURUQsCiAgICAgICAgICBjaHVua1NpemU6IDE2Mzg0LAogICAgICAgICAgd2luZG93Qml0czogMTUsCiAgICAgICAgICBtZW1MZXZlbDogOCwKICAgICAgICAgIHN0cmF0ZWd5OiBaX0RFRkFVTFRfU1RSQVRFR1ksCiAgICAgICAgICB0bzogIiIKICAgICAgICB9LCBvcHRpb25zIHx8IHt9KTsKICAgICAgICB2YXIgb3B0ID0gdGhpcy5vcHRpb25zOwogICAgICAgIGlmIChvcHQucmF3ICYmIG9wdC53aW5kb3dCaXRzID4gMCkgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgPSAtb3B0LndpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIGlmIChvcHQuZ3ppcCAmJiBvcHQud2luZG93Qml0cyA+IDAgJiYgb3B0LndpbmRvd0JpdHMgPCAxNikgewogICAgICAgICAgb3B0LndpbmRvd0JpdHMgKz0gMTY7CiAgICAgICAgfQogICAgICAgIHRoaXMuZXJyID0gMDsKICAgICAgICB0aGlzLm1zZyA9ICIiOwogICAgICAgIHRoaXMuZW5kZWQgPSBmYWxzZTsKICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAgICAgIHRoaXMuc3RybSA9IG5ldyBaU3RyZWFtKCk7CiAgICAgICAgdGhpcy5zdHJtLmF2YWlsX291dCA9ID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5fZGljdF9zZXQgPSB0cnVlOwogICAgICAgIH0KICAgICAgfQogICAgICBEZWZsYXRlLnByb3RvdHlwZS5wdXNoID0gZnVuY3Rpb24oZGF0YSwgbW9kZSkgewogICAgICAgIHZhciBzdHJtID0gdGhpcy5zdHJtOwogICAgICAgIHZhciBjaHVua1NpemUgPSB0aGlzLm9wdGlvbnMuY2h1bmtTaXplOwogICAgICAgIHZhciBzdGF0dXMsIF9tb2RlOwogICAgICAgIGlmICh0aGlzLmVuZGVkKSB7CiAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgICAgIF9tb2RlID0gbW9kZSA9PT0gfn5tb2RlID8gbW9kZSA6IG1vZGUgPT09IHRydWUgPyBaX0ZJTklTSCA6IFpfTk9fRkxVU0g7CiAgICAgICAgaWYgKHR5cGVvZiBkYXRhID09PSAic3RyaW5nIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IHN0cmluZ3Muc3RyaW5nMmJ1ZihkYXRhKTsKICAgICAgICB9IGVsc2UgaWYgKHRvU3RyaW5nLmNhbGwoZGF0YSkgPT09ICJbb2JqZWN0IEFycmF5QnVmZmVyXSIpIHsKICAgICAgICAgIHN0cm0uaW5wdXQgPSBuZXcgVWludDhBcnJheShkYXRhKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgc3RybS5pbnB1dCA9IGRhdGE7CiAgICAgICAgfQogICAgICAgIHN0cm0ubmV4dF9pbiA9IDA7CiAgICAgICAgc3RybS5hdmFpbF9pbiA9IHN0cm0uaW5wdXQubGVuZ3RoOwogICAgICAgIGRvIHsKICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCkgewogICAgICAgICAgICBzdHJtLm91dHB1dCA9IG5ldyB1dGlscy5CdWY4KGNodW5rU2l6ZSk7CiAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSAwOwogICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGNodW5rU2l6ZTsKICAgICAgICAgIH0KICAgICAgICAgIHN0YXR1cyA9IHpsaWJfZGVmbGF0ZS5kZWZsYXRlKHN0cm0sIF9tb2RlKTsKICAgICAgICAgIGlmIChzdGF0dXMgIT09IFpfU1RSRUFNX0VORCAmJiBzdGF0dXMgIT09IFpfT0spIHsKICAgICAgICAgICAgdGhpcy5vbkVuZChzdGF0dXMpOwogICAgICAgICAgICB0aGlzLmVuZGVkID0gdHJ1ZTsKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgfQogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwIHx8IHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgKF9tb2RlID09PSBaX0ZJTklTSCB8fCBfbW9kZSA9PT0gWl9TWU5DX0ZMVVNIMikpIHsKICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICB0aGlzLm9uRGF0YShzdHJpbmdzLmJ1ZjJiaW5zdHJpbmcodXRpbHMuc2hyaW5rQnVmKHN0cm0ub3V0cHV0LCBzdHJtLm5leHRfb3V0KSkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0aWxzLnNocmlua0J1ZihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCkpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfSB3aGlsZSAoKHN0cm0uYXZhaWxfaW4gPiAwIHx8IHN0cm0uYXZhaWxfb3V0ID09PSAwKSAmJiBzdGF0dXMgIT09IFpfU1RSRUFNX0VORCk7CiAgICAgICAgaWYgKF9tb2RlID09PSBaX0ZJTklTSCkgewogICAgICAgICAgc3RhdHVzID0gemxpYl9kZWZsYXRlLmRlZmxhdGVFbmQodGhpcy5zdHJtKTsKICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgIHRoaXMuZW5kZWQgPSB0cnVlOwogICAgICAgICAgcmV0dXJuIHN0YXR1cyA9PT0gWl9PSzsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBaX1NZTkNfRkxVU0gyKSB7CiAgICAgICAgICB0aGlzLm9uRW5kKFpfT0spOwogICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSAwOwogICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfQogICAgICAgIHJldHVybiB0cnVlOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkRhdGEgPSBmdW5jdGlvbihjaHVuaykgewogICAgICAgIHRoaXMuY2h1bmtzLnB1c2goY2h1bmspOwogICAgICB9OwogICAgICBEZWZsYXRlLnByb3RvdHlwZS5vbkVuZCA9IGZ1bmN0aW9uKHN0YXR1cykgewogICAgICAgIGlmIChzdGF0dXMgPT09IFpfT0spIHsKICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMudG8gPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdGhpcy5jaHVua3Muam9pbigiIik7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aGlzLnJlc3VsdCA9IHV0aWxzLmZsYXR0ZW5DaHVua3ModGhpcy5jaHVua3MpOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICB0aGlzLmNodW5rcyA9IFtdOwogICAgICAgIHRoaXMuZXJyID0gc3RhdHVzOwogICAgICAgIHRoaXMubXNnID0gdGhpcy5zdHJtLm1zZzsKICAgICAgfTsKICAgICAgZnVuY3Rpb24gZGVmbGF0ZShpbnB1dCwgb3B0aW9ucykgewogICAgICAgIHZhciBkZWZsYXRvciA9IG5ldyBEZWZsYXRlKG9wdGlvbnMpOwogICAgICAgIGRlZmxhdG9yLnB1c2goaW5wdXQsIHRydWUpOwogICAgICAgIGlmIChkZWZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IGRlZmxhdG9yLm1zZyB8fCBtc2dbZGVmbGF0b3IuZXJyXTsKICAgICAgICB9CiAgICAgICAgcmV0d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cnQpIHsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgdmFyIF9pbjsKICAgICAgICB2YXIgbGFzdDsKICAgICAgICB2YXIgX291dDsKICAgICAgICB2YXIgYmVnOwogICAgICAgIHZhciBlbmQ7CiAgICAgICAgdmFyIGRtYXg7CiAgICAgICAgdmFyIHdzaXplOwogICAgICAgIHZhciB3aGF2ZTsKICAgICAgICB2YXIgd25leHQ7CiAgICAgICAgdmFyIHNfd2luZG93OwogICAgICAgIHZhciBob2xkOwogICAgICAgIHZhciBiaXRzOwogICAgICAgIHZhciBsY29kZTsKICAgICAgICB2YXIgZGNvZGU7CiAgICAgICAgdmFyIGxtYXNrOwogICAgICAgIHZhciBkbWFzazsKICAgICAgICB2YXIgaGVyZTsKICAgICAgICB2YXIgb3A7CiAgICAgICAgdmFyIGxlbjsKICAgICAgICB2YXIgZGlzdDsKICAgICAgICB2YXIgZnJvbTsKICAgICAgICB2YXIgZnJvbV9zb3VyY2U7CiAgICAgICAgdmFyIGlucHV0LCBvdXRwdXQ7CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIF9pbiA9IHN0cm0ubmV4dF9pbjsKICAgICAgICBpbnB1dCA9IHN0cm0uaW5wdXQ7CiAgICAgICAgbGFzdCA9IF9pbiArIChzdHJtLmF2YWlsX2luIC0gNSk7CiAgICAgICAgX291dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgb3V0cHV0ID0gc3RybS5vdXRwdXQ7CiAgICAgICAgYmVnID0gX291dCAtIChzdGFydCAtIHN0cm0uYXZhaWxfb3V0KTsKICAgICAgICBlbmQgPSBfb3V0ICsgKHN0cm0uYXZhaWxfb3V0IC0gMjU3KTsKICAgICAgICBkbWF4ID0gc3RhdGUuZG1heDsKICAgICAgICB3c2l6ZSA9IHN0YXRlLndzaXplOwogICAgICAgIHdoYXZlID0gc3RhdGUud2hhdmU7CiAgICAgICAgd25leHQgPSBzdGF0ZS53bmV4dDsKICAgICAgICBzX3dpbmRvdyA9IHN0YXRlLndpbmRvdzsKICAgICAgICBob2xkID0gc3RhdGUuaG9sZDsKICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICBsY29kZSA9IHN0YXRlLmxlbmNvZGU7CiAgICAgICAgZGNvZGUgPSBzdGF0ZS5kaXN0Y29kZTsKICAgICAgICBsbWFzayA9ICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMTsKICAgICAgICBkbWFzayA9ICgxIDw8IHN0YXRlLmRpc3RiaXRzKSAtIDE7CiAgICAgICAgdG9wOgogICAgICAgICAgZG8gewogICAgICAgICAgICBpZiAoYml0cyA8IDE1KSB7CiAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaGVyZSA9IGxjb2RlW2hvbGQgJiBsbWFza107CiAgICAgICAgICAgIGRvbGVuOgogICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAyNDsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgIGJpdHMgLT0gb3A7CiAgICAgICAgICAgICAgICBvcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgaWYgKG9wID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChvcCAmIDE2KSB7CiAgICAgICAgICAgICAgICAgIGxlbiA9IGhlcmUgJiA2NTUzNTsKICAgICAgICAgICAgICAgICAgb3AgJj0gMTU7CiAgICAgICAgICAgICAgICAgIGlmIChvcCkgewogICAgICAgICAgICAgICAgICAgIGlmIChiaXRzIDwgb3ApIHsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbX2luKytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGxlbiArPSBob2xkICYgKDEgPDwgb3ApIC0gMTsKICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IDE1KSB7CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaGVyZSA9IGRjb2RlW2hvbGQgJiBkbWFza107CiAgICAgICAgICAgICAgICAgIGRvZGlzdDoKICAgICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICAgIG9wID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gb3A7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IG9wOwogICAgICAgICAgICAgICAgICAgICAgb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCAmIDE2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGRpc3QgPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgICAgICAgIG9wICY9IDE1OwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoYml0cyA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJpdHMgPCBvcCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtfaW4rK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZGlzdCArPSBob2xkICYgKDEgPDwgb3ApIC0gMTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpc3QgPiBkbWF4KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZSB0b28gZmFyIGJhY2siOwogICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgb3AgPSBfb3V0IC0gYmVnOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGlzdCA+IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgb3AgPSBkaXN0IC0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wID4gd2hhdmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgdG9vIGZhciBiYWNrIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IHNfd2luZG93OwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh3bmV4dCA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSArPSB3c2l6ZSAtIG9wOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wIDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSBfb3V0IC0gZGlzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBvdXRwdXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh3bmV4dCA8IG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tICs9IHdzaXplICsgd25leHQgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wIC09IHduZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9wIDwgbGVuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gc193aW5kb3dbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gPSAwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAod25leHQgPCBsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcCA9IHduZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoLS1vcCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gb3V0cHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb20gKz0gd25leHQgLSBvcDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcCA8IGxlbikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZW4gLT0gb3A7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IHNfd2luZG93W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tb3ApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tID0gX291dCAtIGRpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZyb21fc291cmNlID0gb3V0cHV0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAobGVuID4gMikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBmcm9tX3NvdXJjZVtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuIC09IDM7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4gPiAxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgZnJvbSA9IF9vdXQgLSBkaXN0OwogICAgICAgICAgICAgICAgICAgICAgICAgIGRvIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0W19vdXQrK10gPSBvdXRwdXRbZnJvbSsrXTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbiAtPSAzOwogICAgICAgICAgICAgICAgICAgICAgICAgIH0gd2hpbGUgKGxlbiA+IDIpOwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFtfb3V0KytdID0gb3V0cHV0W2Zyb20rK107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuID4gMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRbX291dCsrXSA9IG91dHB1dFtmcm9tKytdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgob3AgJiA2NCkgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgaGVyZSA9IGRjb2RlWyhoZXJlICYgNjU1MzUpICsgKGhvbGQgJiAoMSA8PCBvcCkgLSAxKV07CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlIGRvZGlzdDsKICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgY29kZSI7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHRvcDsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoKG9wICYgNjQpID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBsY29kZVsoaGVyZSAmIDY1NTM1KSArIChob2xkICYgKDEgPDwgb3ApIC0gMSldOwogICAgICAgICAgICAgICAgICBjb250aW51ZSBkb2xlbjsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAob3AgJiAzMikgewogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWsgdG9wOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgfQogICAgICAgICAgfSB3aGlsZSAoX2luIDwgbGFzdCAmJiBfb3V0IDwgZW5kKTsKICAgICAgICBsZW4gPSBiaXRzID4+IDM7CiAgICAgICAgX2luIC09IGxlbjsKICAgICAgICBiaXRzIC09IGxlbiA8PCAzOwogICAgICAgIGhvbGQgJj0gKDEgPDwgYml0cykgLSAxOwogICAgICAgIHN0cm0ubmV4dF9pbiA9IF9pbjsKICAgICAgICBzdHJtLm5leHRfb3V0ID0gX291dDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gX2luIDwgbGFzdCA/IDUgKyAobGFzdCAtIF9pbikgOiA1IC0gKF9pbiAtIGxhc3QpOwogICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gX291dCA8IGVuZCA/IDI1NyArIChlbmQgLSBfb3V0KSA6IDI1NyAtIChfb3V0IC0gZW5kKTsKICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICBzdGF0ZS5iaXRzID0gYml0czsKICAgICAgICByZXR1cm47CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9pbmZ0cmVlcy5qcwogIHZhciByZXF1aXJlX2luZnRyZWVzID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2luZnRyZWVzLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgICJ1c2Ugc3RyaWN0IjsKICAgICAgdmFyIHV0aWxzID0gcmVxdWlyZV9jb21tb24oKTsKICAgICAgdmFyIE1BWEJJVFMgPSAxNTsKICAgICAgdmFyIEVOT1VHSF9MRU5TID0gODUyOwogICAgICB2YXIgRU5PVUdIX0RJU1RTID0gNTkyOwogICAgICB2YXIgQ09ERVMgPSAwOwogICAgICB2YXIgTEVOUyA9IDE7CiAgICAgIHZhciBESVNUUyA9IDI7CiAgICAgIHZhciBsYmFzZSA9IFsKICAgICAgICAzLAogICAgICAgIDQsCiAgICAgICAgNSwKICAgICAgICA2LAogICAgICAgIDcsCiAgICAgICAgOCwKICAgICAgICA5LAogICAgICAgIDEwLAogICAgICAgIDExLAogICAgICAgIDEzLAogICAgICAgIDE1LAogICAgICAgIDE3LAogICAgICAgIDE5LAogICAgICAgIDIzLAogICAgICAgIDI3LAogICAgICAgIDMxLAogICAgICAgIDM1LAogICAgICAgIDQzLAogICAgICAgIDUxLAogICAgICAgIDU5LAogICAgICAgIDY3LAogICAgICAgIDgzLAogICAgICAgIDk5LAogICAgICAgIDExNSwKICAgICAgICAxMzEsCiAgICAgICAgMTYzLAogICAgICAgIDE5NSwKICAgICAgICAyMjcsCiAgICAgICAgMjU4LAogICAgICAgIDAsCiAgICAgICAgMAogICAgICBdOwogICAgICB2YXIgbGV4dCA9IFsKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAxNiwKICAgICAgICA3MiwKICAgICAgICA3OAogICAgICBdOwogICAgICB2YXIgZGJhc2UgPSBbCiAgICAgICAgMSwKICAgICAgICAyLAogICAgICAgIDMsCiAgICAgICAgNCwKICAgICAgICA1LAogICAgICAgIDcsCiAgICAgICAgOSwKICAgICAgICAxMywKICAgICAgICAxNywKICAgICAgICAyNSwKICAgICAgICAzMywKICAgICAgICA0OSwKICAgICAgICA2NSwKICAgICAgICA5NywKICAgICAgICAxMjksCiAgICAgICAgMTkzLAogICAgICAgIDI1NywKICAgICAgICAzODUsCiAgICAgICAgNTEzLAogICAgICAgIDc2OSwKICAgICAgICAxMDI1LAogICAgICAgIDE1MzcsCiAgICAgICAgMjA0OSwKICAgICAgICAzMDczLAogICAgICAgIDQwOTcsCiAgICAgICAgNjE0NSwKICAgICAgICA4MTkzLAogICAgICAgIDEyMjg5LAogICAgICAgIDE2Mzg1LAogICAgICAgIDI0NTc3LAogICAgICAgIDAsCiAgICAgICAgMAogICAgICBdOwogICAgICB2YXIgZGV4dCA9IFsKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNiwKICAgICAgICAxNywKICAgICAgICAxNywKICAgICAgICAxOCwKICAgICAgICAxOCwKICAgICAgICAxOSwKICAgICAgICAxOSwKICAgICAgICAyMCwKICAgICAgICAyMCwKICAgICAgICAyMSwKICAgICAgICAyMSwKICAgICAgICAyMiwKICAgICAgICAyMiwKICAgICAgICAyMywKICAgICAgICAyMywKICAgICAgICAyNCwKICAgICAgICAyNCwKICAgICAgICAyNSwKICAgICAgICAyNSwKICAgICAgICAyNiwKICAgICAgICAyNiwKICAgICAgICAyNywKICAgICAgICAyNywKICAgICAgICAyOCwKICAgICAgICAyOCwKICAgICAgICAyOSwKICAgICAgICAyOSwKICAgICAgICA2NCwKICAgICAgICA2NAogICAgICBdOwogICAgICBtb2R1bGUyLmV4cG9ydHMgPSBmdW5jdGlvbiBpbmZsYXRlX3RhYmxlKHR5cGUsIGxlbnMsIGxlbnNfaW5kZXgsIGNvZGVzLCB0YWJsZSwgdGFibGVfaW5kZXgsIHdvcmssIG9wdHMpIHsKICAgICAgICB2YXIgYml0cyA9IG9wdHMuYml0czsKICAgICAgICB2YXIgbGVuID0gMDsKICAgICAgICB2YXIgc3ltID0gMDsKICAgICAgICB2YXIgbWluID0gMCwgbWF4ID0gMDsKICAgICAgICB2YXIgcm9vdDIgPSAwOwogICAgICAgIHZhciBjdXJyID0gMDsKICAgICAgICB2YXIgZHJvcCA9IDA7CiAgICAgICAgdmFyIGxlZnQgPSAwOwogICAgICAgIHZhciB1c2VkID0gMDsKICAgICAgICB2YXIgaHVmZiA9IDA7CiAgICAgICAgdmFyIGluY3I7CiAgICAgICAgdmFyIGZpbGw7CiAgICAgICAgdmFyIGxvdzsKICAgICAgICB2YXIgbWFzazsKICAgICAgICB2YXIgbmV4dDsKICAgICAgICB2YXIgYmFzZSA9IG51bGw7CiAgICAgICAgdmFyIGJhc2VfaW5kZXggPSAwOwogICAgICAgIHZhciBlbmQ7CiAgICAgICAgdmFyIGNvdW50ID0gbmV3IHV0aWxzLkJ1ZjE2KE1BWEJJVFMgKyAxKTsKICAgICAgICB2YXIgb2ZmcyA9IG5ldyB1dGlscy5CdWYxNihNQVhCSVRTICsgMSk7CiAgICAgICAgdmFyIGV4dHJhID0gbnVsbDsKICAgICAgICB2YXIgZXh0cmFfaW5kZXggPSAwOwogICAgICAgIHZhciBoZXJlX2JpdHMsIGhlcmVfb3AsIGhlcmVfdmFsOwogICAgICAgIGZvciAobGVuID0gMDsgbGVuIDw9IE1BWEJJVFM7IGxlbisrKSB7CiAgICAgICAgICBjb3VudFtsZW5dID0gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChzeW0gPSAwOyBzeW0gPCBjb2Rlczsgc3ltKyspIHsKICAgICAgICAgIGNvdW50W2xlbnNbbGVuc19pbmRleCArIHN5bV1dKys7CiAgICAgICAgfQogICAgICAgIHJvb3QyID0gYml0czsKICAgICAgICBmb3IgKG1heCA9IE1BWEJJVFM7IG1heCA+PSAxOyBtYXgtLSkgewogICAgICAgICAgaWYgKGNvdW50W21heF0gIT09IDApIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChyb290MiA+IG1heCkgewogICAgICAgICAgcm9vdDIgPSBtYXg7CiAgICAgICAgfQogICAgICAgIGlmIChtYXggPT09IDApIHsKICAgICAgICAgIHRhYmxlW3RhYmxlX2luZGV4KytdID0gMSA8PCAyNCB8IDY0IDw8IDE2IHwgMDsKICAgICAgICAgIHRhYmxlW3RhYmxlX2luZGV4KytdID0gMSA8PCAyNCB8IDY0IDw8IDE2IHwgMDsKICAgICAgICAgIG9wdHMuYml0cyA9IDE7CiAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB9CiAgICAgICAgZm9yIChtaW4gPSAxOyBtaW4gPCBtYXg7IG1pbisrKSB7CiAgICAgICAgICBpZiAoY291bnRbbWluXSAhPT0gMCkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvb3QyIDwgbWluKSB7CiAgICAgICAgICByb290MiA9IG1pbjsKICAgICAgICB9CiAgICAgICAgbGVmdCA9IDE7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPD0gTUFYQklUUzsgbGVuKyspIHsKICAgICAgICAgIGxlZnQgPDw9IDE7CiAgICAgICAgICBsZWZ0IC09IGNvdW50W2xlbl07CiAgICAgICAgICBpZiAobGVmdCA8IDApIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAobGVmdCA+IDAgJiYgKHR5cGUgPT09IENPREVTIHx8IG1heCAhPT0gMSkpIHsKICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICB9CiAgICAgICAgb2Zmc1sxXSA9IDA7CiAgICAgICAgZm9yIChsZW4gPSAxOyBsZW4gPCBNQVhCSVRTOyBsZW4rKykgewogICAgICAgICAgb2Zmc1tsZW4gKyAxXSA9IG9mZnNbbGVuXSArIGNvdW50W2xlbl07CiAgICAgICAgfQogICAgICAgIGZvciAoc3ltID0gMDsgc3ltIDwgY29kZXM7IHN5bSsrKSB7CiAgICAgICAgICBpZiAobGVuc1tsZW5zX2luZGV4ICsgc3ltXSAhPT0gMCkgewogICAgICAgICAgICB3b3JrW29mZnNbbGVuc1tsZW5zX2luZGV4ICsgc3ltXV0rK10gPSBzeW07CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICh0eXBlID09PSBDT0RFUykgewogICAgICAgICAgYmFzZSA9IGV4dHJhID0gd29yazsKICAgICAgICAgIGVuZCA9IDE5OwogICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PT0gTEVOUykgewogICAgICAgICAgYmFzZSA9IGxiYXNlOwogICAgICAgICAgYmFzZV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBleHRyYSA9IGxleHQ7CiAgICAgICAgICBleHRyYV9pbmRleCAtPSAyNTc7CiAgICAgICAgICBlbmQgPSAyNTY7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGJhc2UgPSBkYmFzZTsKICAgICAgICAgIGV4dHJhID0gZGV4dDsKICAgICAgICAgIGVuZCA9IC0xOwogICAgICAgIH0KICAgICAgICBodWZmID0gMDsKICAgICAgICBzeW0gPSAwOwogICAgICAgIGxlbiA9IG1pbjsKICAgICAgICBuZXh0ID0gdGFibGVfaW5kZXg7CiAgICAgICAgY3VyciA9IHJvb3QyOwogICAgICAgIGRyb3AgPSAwOwogICAgICAgIGxvdyA9IC0xOwogICAgICAgIHVzZWQgPSAxIDw8IHJvb3QyOwogICAgICAgIG1hc2sgPSB1c2VkIC0gMTsKICAgICAgICBpZiAodHlwZSA9PT0gTEVOUyAmJiB1c2VkID4gRU5PVUdIX0xFTlMgfHwgdHlwZSA9PT0gRElTVFMgJiYgdXNlZCA+IEVOT1VHSF9ESVNUUykgewogICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgaGVyZV9iaXRzID0gbGVuIC0gZHJvcDsKICAgICAgICAgIGlmICh3b3JrW3N5bV0gPCBlbmQpIHsKICAgICAgICAgICAgaGVyZV9vcCA9IDA7CiAgICAgICAgICAgIGhlcmVfdmFsID0gd29ya1tzeW1dOwogICAgICAgICAgfSBlbHNlIGlmICh3b3JrW3N5bV0gPiBlbmQpIHsKICAgICAgICAgICAgaGVyZV9vcCA9IGV4dHJhW2V4dHJhX2luZGV4ICsgd29ya1tzeW1dXTsKICAgICAgICAgICAgaGVyZV92YWwgPSBiYXNlW2Jhc2VfaW5kZXggKyB3b3JrW3N5bV1dOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgaGVyZV9vcCA9IDMyICsgNjQ7CiAgICAgICAgICAgIGhlcmVfdmFsID0gMDsKICAgICAgICAgIH0KICAgICAgICAgIGluY3IgPSAxIDw8IGxlbiAtIGRyb3A7CiAgICAgICAgICBmaWxsID0gMSA8PCBjdXJyOwogICAgICAgICAgbWluID0gZmlsbDsKICAgICAgICAgIGRvIHsKICAgICAgICAgICAgZmlsbCAtPSBpbmNyOwogICAgICAgICAgICB0YWJsZVtuZXh0ICsgKGh1ZmYgPj4gZHJvcCkgKyBmaWxsXSA9IGhlcmVfYml0cyA8PCAyNCB8IGhlcmVfb3AgPDwgMTYgfCBoZXJlX3ZhbCB8IDA7CiAgICAgICAgICB9IHdoaWxlIChmaWxsICE9PSAwKTsKICAgICAgICAgIGluY3IgPSAxIDw8IGxlbiAtIDE7CiAgICAgICAgICB3aGlsZSAoaHVmZiAmIGluY3IpIHsKICAgICAgICAgICAgaW5jciA+Pj0gMTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChpbmNyICE9PSAwKSB7CiAgICAgICAgICAgIGh1ZmYgJj0gaW5jciAtIDE7CiAgICAgICAgICAgIGh1ZmYgKz0gaW5jcjsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGh1ZmYgPSAwOwogICAgICAgICAgfQogICAgICAgICAgc3ltKys7CiAgICAgICAgICBpZiAoLS1jb3VudFtsZW5dID09PSAwKSB7CiAgICAgICAgICAgIGlmIChsZW4gPT09IG1heCkgewogICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxlbiA9IGxlbnNbbGVuc19pbmRleCArIHdvcmtbc3ltXV07CiAgICAgICAgICB9CiAgICAgICAgICBpZiAobGVuID4gcm9vdDIgJiYgKGh1ZmYgJiBtYXNrKSAhPT0gbG93KSB7CiAgICAgICAgICAgIGlmIChkcm9wID09PSAwKSB7CiAgICAgICAgICAgICAgZHJvcCA9IHJvb3QyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG5leHQgKz0gbWluOwogICAgICAgICAgICBjdXJyID0gbGVuIC0gZHJvcDsKICAgICAgICAgICAgbGVmdCA9IDEgPDwgY3VycjsKICAgICAgICAgICAgd2hpbGUgKGN1cnIgKyBkcm9wIDwgbWF4KSB7CiAgICAgICAgICAgICAgbGVmdCAtPSBjb3VudFtjdXJyICsgZHJvcF07CiAgICAgICAgICAgICAgaWYgKGxlZnQgPD0gMCkgewogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGN1cnIrKzsKICAgICAgICAgICAgICBsZWZ0IDw8PSAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHVzZWQgKz0gMSA8PCBjdXJyOwogICAgICAgICAgICBpZiAodHlwZSA9PT0gTEVOUyAmJiB1c2VkID4gRU5PVUdIX0xFTlMgfHwgdHlwZSA9PT0gRElTVFMgJiYgdXNlZCA+IEVOT1VHSF9ESVNUUykgewogICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxvdyA9IGh1ZmYgJiBtYXNrOwogICAgICAgICAgICB0YWJsZVtsb3ddID0gcm9vdDIgPDwgMjQgfCBjdXJyIDw8IDE2IHwgbmV4dCAtIHRhYmxlX2luZGV4IHwgMDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKGh1ZmYgIT09IDApIHsKICAgICAgICAgIHRhYmxlW25leHQgKyBodWZmXSA9IGxlbiAtIGRyb3AgPDwgMjQgfCA2NCA8PCAxNiB8IDA7CiAgICAgICAgfQogICAgICAgIG9wdHMuYml0cyA9IHJvb3QyOwogICAgICAgIHJldHVybiAwOwogICAgICB9OwogICAgfQogIH0pOwoKICAvLyBub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvaW5mbGF0ZS5qcwogIHZhciByZXF1aXJlX2luZmxhdGUgPSBfX2NvbW1vbkpTKHsKICAgICJub2RlX21vZHVsZXMvLnBucG0vcGFrb0AxLjAuMTEvbm9kZV9tb2R1bGVzL3Bha28vbGliL3psaWIvaW5mbGF0ZS5qcyIoZXhwb3J0czIpIHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIHZhciB1dGlscyA9IHJlcXVpcmVfY29tbW9uKCk7CiAgICAgIHZhciBhZGxlcjMyID0gcmVxdWlyZV9hZGxlcjMyKCk7CiAgICAgIHZhciBjcmMzMiA9IHJlcXVpcmVfY3JjMzIoKTsKICAgICAgdmFyIGluZmxhdGVfZmFzdCA9IHJlcXVpcmVfaW5mZmFzdCgpOwogICAgICB2YXIgaW5mbGF0ZV90YWJsZSA9IHJlcXVpcmVfaW5mdHJlZXMoKTsKICAgICAgdmFyIENPREVTID0gMDsKICAgICAgdmFyIExFTlMgPSAxOwogICAgICB2YXIgRElTVFMgPSAyOwogICAgICB2YXIgWl9GSU5JU0ggPSA0OwogICAgICB2YXIgWl9CTE9DSyA9IDU7CiAgICAgIHZhciBaX1RSRUVTID0gNjsKICAgICAgdmFyIFpfT0sgPSAwOwogICAgICB2YXIgWl9TVFJFQU1fRU5EID0gMTsKICAgICAgdmFyIFpfTkVFRF9ESUNUID0gMjsKICAgICAgdmFyIFpfU1RSRUFNX0VSUk9SID0gLTI7CiAgICAgIHZhciBaX0RBVEFfRVJST1IgPSAtMzsKICAgICAgdmFyIFpfTUVNX0VSUk9SID0gLTQ7CiAgICAgIHZhciBaX0JVRl9FUlJPUiA9IC01OwogICAgICB2YXIgWl9ERUZMQVRFRCA9IDg7CiAgICAgIHZhciBIRUFEID0gMTsKICAgICAgdmFyIEZMQUdTID0gMjsKICAgICAgdmFyIFRJTUUgPSAzOwogICAgICB2YXIgT1MgPSA0OwogICAgICB2YXIgRVhMRU4gPSA1OwogICAgICB2YXIgRVhUUkEgPSA2OwogICAgICB2YXIgTkFNRSA9IDc7CiAgICAgIHZhciBDT01NRU5UID0gODsKICAgICAgdmFyIEhDUkMgPSA5OwogICAgICB2YXIgRElDVElEID0gMTA7CiAgICAgIHZhciBESUNUID0gMTE7CiAgICAgIHZhciBUWVBFID0gMTI7CiAgICAgIHZhciBUWVBFRE8gPSAxMzsKICAgICAgdmFyIFNUT1JFRCA9IDE0OwogICAgICB2YXIgQ09QWV8gPSAxNTsKICAgICAgdmFyIENPUFkgPSAxNjsKICAgICAgdmFyIFRBQkxFID0gMTc7CiAgICAgIHZhciBMRU5MRU5TID0gMTg7CiAgICAgIHZhciBDT0RFTEVOUyA9IDE5OwogICAgICB2YXIgTEVOXyA9IDIwOwogICAgICB2YXIgTEVOID0gMjE7CiAgICAgIHZhciBMRU5FWFQgPSAyMjsKICAgICAgdmFyIERJU1QgPSAyMzsKICAgICAgdmFyIERJU1RFWFQgPSAyNDsKICAgICAgdmFyIE1BVENIID0gMjU7CiAgICAgIHZhciBMSVQgPSAyNjsKICAgICAgdmFyIENIRUNLID0gMjc7CiAgICAgIHZhciBMRU5HVEggPSAyODsKICAgICAgdmFyIERPTkUgPSAyOTsKICAgICAgdmFyIEJBRCA9IDMwOwogICAgICB2YXIgTUVNID0gMzE7CiAgICAgIHZhciBTWU5DID0gMzI7CiAgICAgIHZhciBFTk9VR0hfTEVOUyA9IDg1MjsKICAgICAgdmFyIEVOT1VHSF9ESVNUUyA9IDU5MjsKICAgICAgdmFyIE1BWF9XQklUUyA9IDE1OwogICAgICB2YXIgREVGX1dCSVRTID0gTUFYX1dCSVRTOwogICAgICBmdW5jdGlvbiB6c3dhcDMyKHEpIHsKICAgICAgICByZXR1cm4gKHEgPj4+IDI0ICYgMjU1KSArIChxID4+PiA4ICYgNjUyODApICsgKChxICYgNjUyODApIDw8IDgpICsgKChxICYgMjU1KSA8PCAyNCk7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gSW5mbGF0ZVN0YXRlKCkgewogICAgICAgIHRoaXMubW9kZSA9IDA7CiAgICAgICAgdGhpcy5sYXN0ID0gZmFsc2U7CiAgICAgICAgdGhpcy53cmFwID0gMDsKICAgICAgICB0aGlzLmhhdmVkaWN0ID0gZmFsc2U7CiAgICAgICAgdGhpcy5mbGFncyA9IDA7CiAgICAgICAgdGhpcy5kbWF4ID0gMDsKICAgICAgICB0aGlzLmNoZWNrID0gMDsKICAgICAgICB0aGlzLnRvdGFsID0gMDsKICAgICAgICB0aGlzLmhlYWQgPSBudWxsOwogICAgICAgIHRoaXMud2JpdHMgPSAwOwogICAgICAgIHRoaXMud3NpemUgPSAwOwogICAgICAgIHRoaXMud2hhdmUgPSAwOwogICAgICAgIHRoaXMud25leHQgPSAwOwogICAgICAgIHRoaXMud2luZG93ID0gbnVsbDsKICAgICAgICB0aGlzLmhvbGQgPSAwOwogICAgICAgIHRoaXMuYml0cyA9IDA7CiAgICAgICAgdGhpcy5sZW5ndGggPSAwOwogICAgICAgIHRoaXMub2Zmc2V0ID0gMDsKICAgICAgICB0aGlzLmV4dHJhID0gMDsKICAgICAgICB0aGlzLmxlbmNvZGUgPSBudWxsOwogICAgICAgIHRoaXMuZGlzdGNvZGUgPSBudWxsOwogICAgICAgIHRoaXMubGVuYml0cyA9IDA7CiAgICAgICAgdGhpcy5kaXN0Yml0cyA9IDA7CiAgICAgICAgdGhpcy5uY29kZSA9IDA7CiAgICAgICAgdGhpcy5ubGVuID0gMDsKICAgICAgICB0aGlzLm5kaXN0ID0gMDsKICAgICAgICB0aGlzLmhhdmUgPSAwOwogICAgICAgIHRoaXMubmV4dCA9IG51bGw7CiAgICAgICAgdGhpcy5sZW5zID0gbmV3IHV0aWxzLkJ1ZjE2KDMyMCk7CiAgICAgICAgdGhpcy53b3JrID0gbmV3IHV0aWxzLkJ1ZjE2KDI4OCk7CiAgICAgICAgdGhpcy5sZW5keW4gPSBudWxsOwogICAgICAgIHRoaXMuZGlzdGR5biA9IG51bGw7CiAgICAgICAgdGhpcy5zYW5lID0gMDsKICAgICAgICB0aGlzLmJhY2sgPSAwOwogICAgICAgIHRoaXMud2FzID0gMDsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlUmVzZXRLZWVwKHN0cm0pIHsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBzdHJtLnRvdGFsX2luID0gc3RybS50b3RhbF9vdXQgPSBzdGF0ZS50b3RhbCA9IDA7CiAgICAgICAgc3RybS5tc2cgPSAiIjsKICAgICAgICBpZiAoc3RhdGUud3JhcCkgewogICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLndyYXAgJiAxOwogICAgICAgIH0KICAgICAgICBzdGF0ZS5tb2RlID0gSEVBRDsKICAgICAgICBzdGF0ZS5sYXN0ID0gMDsKICAgICAgICBzdGF0ZS5oYXZlZGljdCA9IDA7CiAgICAgICAgc3RhdGUuZG1heCA9IDMyNzY4OwogICAgICAgIHN0YXRlLmhlYWQgPSBudWxsOwogICAgICAgIHN0YXRlLmhvbGQgPSAwOwogICAgICAgIHN0YXRlLmJpdHMgPSAwOwogICAgICAgIHN0YXRlLmxlbmNvZGUgPSBzdGF0ZS5sZW5keW4gPSBuZXcgdXRpbHMuQnVmMzIoRU5PVUdIX0xFTlMpOwogICAgICAgIHN0YXRlLmRpc3Rjb2RlID0gc3RhdGUuZGlzdGR5biA9IG5ldyB1dGlscy5CdWYzMihFTk9VR0hfRElTVFMpOwogICAgICAgIHN0YXRlLnNhbmUgPSAxOwogICAgICAgIHN0YXRlLmJhY2sgPSAtMTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICAgfQogICAgICBmdW5jdGlvbiBpbmZsYXRlUmVzZXQoc3RybSkgewogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIHN0YXRlLndzaXplID0gMDsKICAgICAgICBzdGF0ZS53aGF2ZSA9IDA7CiAgICAgICAgc3RhdGUud25leHQgPSAwOwogICAgICAgIHJldHVybiBpbmZsYXRlUmVzZXRLZWVwKHN0cm0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVSZXNldDIoc3RybSwgd2luZG93Qml0cykgewogICAgICAgIHZhciB3cmFwOwogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICh3aW5kb3dCaXRzIDwgMCkgewogICAgICAgICAgd3JhcCA9IDA7CiAgICAgICAgICB3aW5kb3dCaXRzID0gLXdpbmRvd0JpdHM7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHdyYXAgPSAod2luZG93Qml0cyA+PiA0KSArIDE7CiAgICAgICAgICBpZiAod2luZG93Qml0cyA8IDQ4KSB7CiAgICAgICAgICAgIHdpbmRvd0JpdHMgJj0gMTU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICh3aW5kb3dCaXRzICYmICh3aW5kb3dCaXRzIDwgOCB8fCB3aW5kb3dCaXRzID4gMTUpKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdGF0ZS53aW5kb3cgIT09IG51bGwgJiYgc3RhdGUud2JpdHMgIT09IHdpbmRvd0JpdHMpIHsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHN0YXRlLndyYXAgPSB3cmFwOwogICAgICAgIHN0YXRlLndiaXRzID0gd2luZG93Qml0czsKICAgICAgICByZXR1cm4gaW5mbGF0ZVJlc2V0KHN0cm0pOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVJbml0MihzdHJtLCB3aW5kb3dCaXRzKSB7CiAgICAgICAgdmFyIHJldDsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgaWYgKCFzdHJtKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gbmV3IEluZmxhdGVTdGF0ZSgpOwogICAgICAgIHN0cm0uc3RhdGUgPSBzdGF0ZTsKICAgICAgICBzdGF0ZS53aW5kb3cgPSBudWxsOwogICAgICAgIHJldCA9IGluZmxhdGVSZXNldDIoc3RybSwgd2luZG93Qml0cyk7CiAgICAgICAgaWYgKHJldCAhPT0gWl9PSykgewogICAgICAgICAgc3RybS5zdGF0ZSA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXQ7CiAgICAgIH0KICAgICAgZnVuY3Rpb24gaW5mbGF0ZUluaXQoc3RybSkgewogICAgICAgIHJldHVybiBpbmZsYXRlSW5pdDIoc3RybSwgREVGX1dCSVRTKTsKICAgICAgfQogICAgICB2YXIgdmlyZ2luID0gdHJ1ZTsKICAgICAgdmFyIGxlbmZpeDsKICAgICAgdmFyIGRpc3RmaXg7CiAgICAgIGZ1bmN0aW9uIGZpeGVkdGFibGVzKHN0YXRlKSB7CiAgICAgICAgaWYgKHZpcmdpbikgewogICAgICAgICAgdmFyIHN5bTsKICAgICAgICAgIGxlbmZpeCA9IG5ldyB1dGlscy5CdWYzMig1MTIpOwogICAgICAgICAgZGlzdGZpeCA9IG5ldyB1dGlscy5CdWYzMigzMik7CiAgICAgICAgICBzeW0gPSAwOwogICAgICAgICAgd2hpbGUgKHN5bSA8IDE0NCkgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDg7CiAgICAgICAgICB9CiAgICAgICAgICB3aGlsZSAoc3ltIDwgMjU2KSB7CiAgICAgICAgICAgIHN0YXRlLmxlbnNbc3ltKytdID0gOTsKICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzeW0gPCAyODApIHsKICAgICAgICAgICAgc3RhdGUubGVuc1tzeW0rK10gPSA3OwogICAgICAgICAgfQogICAgICAgICAgd2hpbGUgKHN5bSA8IDI4OCkgewogICAgICAgICAgICBzdGF0ZS5sZW5zW3N5bSsrXSA9IDg7CiAgICAgICAgICB9CiAgICAgICAgICBpbmZsYXRlX3RhYmxlKExFTlMsIHN0YXRlLmxlbnMsIDAsIDI4OCwgbGV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SA9IHN0YXRlLndzaXplOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBkaXN0ID0gc3RhdGUud3NpemUgLSBzdGF0ZS53bmV4dDsKICAgICAgICAgIGlmIChkaXN0ID4gY29weSkgewogICAgICAgICAgICBkaXN0ID0gY29weTsKICAgICAgICAgIH0KICAgICAgICAgIHV0aWxzLmFycmF5U2V0KHN0YXRlLndpbmRvdywgc3JjLCBlbmQgLSBjb3B5LCBkaXN0LCBzdGF0ZS53bmV4dCk7CiAgICAgICAgICBjb3B5IC09IGRpc3Q7CiAgICAgICAgICBpZiAoY29weSkgewogICAgICAgICAgICB1dGlscy5hcnJheVNldChzdGF0ZS53aW5kb3csIHNyYywgZW5kIC0gY29weSwgY29weSwgMCk7CiAgICAgICAgICAgIHN0YXRlLnduZXh0ID0gY29weTsKICAgICAgICAgICAgc3RhdGUud2hhdmUgPSBzdGF0ZS53c2l6ZTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHN0YXRlLnduZXh0ICs9IGRpc3Q7CiAgICAgICAgICAgIGlmIChzdGF0ZS53bmV4dCA9PT0gc3RhdGUud3NpemUpIHsKICAgICAgICAgICAgICBzdGF0ZS53bmV4dCA9IDA7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHN0YXRlLndoYXZlIDwgc3RhdGUud3NpemUpIHsKICAgICAgICAgICAgICBzdGF0ZS53aGF2ZSArPSBkaXN0OwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiAwOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGUoc3RybSwgZmx1c2gpIHsKICAgICAgICB2YXIgc3RhdGU7CiAgICAgICAgdmFyIGlucHV0LCBvdXRwdXQ7CiAgICAgICAgdmFyIG5leHQ7CiAgICAgICAgdmFyIHB1dDsKICAgICAgICB2YXIgaGF2ZSwgbGVmdDsKICAgICAgICB2YXIgaG9sZDsKICAgICAgICB2YXIgYml0czsKICAg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ZS5iaXRzOwogICAgICAgIF9pbiA9IGhhdmU7CiAgICAgICAgX291dCA9IGxlZnQ7CiAgICAgICAgcmV0ID0gWl9PSzsKICAgICAgICBpbmZfbGVhdmU6CiAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgc3dpdGNoIChzdGF0ZS5tb2RlKSB7CiAgICAgICAgICAgICAgY2FzZSBIRUFEOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLndyYXAgPT09IDApIHsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRZUEVETzsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwICYgMiAmJiBob2xkID09PSAzNTYxNSkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IDA7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEZMQUdTOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmZsYWdzID0gMDsKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZG9uZSA9IGZhbHNlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCEoc3RhdGUud3JhcCAmIDEpIHx8ICgoKGhvbGQgJiAyNTUpIDw8IDgpICsgKGhvbGQgPj4gOCkpICUgMzEpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGhlYWRlciBjaGVjayI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKChob2xkICYgMTUpICE9PSBaX0RFRkxBVEVEKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInVua25vd24gY29tcHJlc3Npb24gbWV0aG9kIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNDsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNDsKICAgICAgICAgICAgICAgIGxlbiA9IChob2xkICYgMTUpICsgODsKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53Yml0cyA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS53Yml0cyA9IGxlbjsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobGVuID4gc3RhdGUud2JpdHMpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCB3aW5kb3cgc2l6ZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZG1heCA9IDEgPDwgbGVuOwogICAgICAgICAgICAgICAgc3RybS5hZGxlciA9IHN0YXRlLmNoZWNrID0gMTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBob2xkICYgNTEyID8gRElDVElEIDogVFlQRTsKICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIEZMQUdTOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5mbGFncyA9IGhvbGQ7CiAgICAgICAgICAgICAgICBpZiAoKHN0YXRlLmZsYWdzICYgMjU1KSAhPT0gWl9ERUZMQVRFRCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJ1bmtub3duIGNvbXByZXNzaW9uIG1ldGhvZCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTczNDQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAidW5rbm93biBoZWFkZXIgZmxhZ3Mgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnRleHQgPSBob2xkID4+IDggJiAxOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFRJTUU7CiAgICAgICAgICAgICAgY2FzZSBUSU1FOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnRpbWUgPSBob2xkOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgIGhidWZbMF0gPSBob2xkICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzFdID0gaG9sZCA+Pj4gOCAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGJ1ZlsyXSA9IGhvbGQgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICBoYnVmWzNdID0gaG9sZCA+Pj4gMjQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmNoZWNrID0gY3JjMzIoc3RhdGUuY2hlY2ssIGhidWYsIDQsIDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBPUzsKICAgICAgICAgICAgICBjYXNlIE9TOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLnhmbGFncyA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQub3MgPSBob2xkID4+IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA1MTIpIHsKICAgICAgICAgICAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhidWZbMV0gPSBob2xkID4+PiA4ICYgMjU1OwogICAgICAgICAgICAgICAgICBzdGF0ZS5jaGVjayA9IGNyYzMyKHN0YXRlLmNoZWNrLCBoYnVmLCAyLCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPSAwOwogICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRVhMRU47CiAgICAgICAgICAgICAgY2FzZSBFWExFTjoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDEwMjQpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAxNikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUubGVuZ3RoID0gaG9sZDsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmV4dHJhX2xlbiA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgaGJ1ZlswXSA9IGhvbGQgJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgaGJ1ZlsxXSA9IGhvbGQgPj4+IDggJiAyNTU7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaGJ1ZiwgMiwgMCk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5oZWFkKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBudWxsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEVYVFJBOwogICAgICAgICAgICAgIGNhc2UgRVhUUkE6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAxMDI0KSB7CiAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmhlYWQuZXh0cmFfbGVuIC0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgICAgICAgaWYgKCFzdGF0ZS5oZWFkLmV4dHJhKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlLmhlYWQuZXh0cmEgPSBuZXcgQXJyYXkoc3RhdGUuaGVhZC5leHRyYV9sZW4pOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RhdGUuaGVhZC5leHRyYSwgaW5wdXQsIG5leHQsIGNvcHksIGxlbik7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlIC09IGNvcHk7CiAgICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCAtPSBjb3B5OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTkFNRTsKICAgICAgICAgICAgICBjYXNlIE5BTUU6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiAyMDQ4KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGNvcHkgPSAwOwogICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgbGVuID0gaW5wdXRbbmV4dCArIGNvcHkrK107CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQgJiYgbGVuICYmIHN0YXRlLmxlbmd0aCA8IDY1NTM2KSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLm5hbWUgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShsZW4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobGVuICYmIGNvcHkgPCBoYXZlKTsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5uYW1lID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ09NTUVOVDsKICAgICAgICAgICAgICBjYXNlIENPTU1FTlQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZmxhZ3MgJiA0MDk2KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGNvcHkgPSAwOwogICAgICAgICAgICAgICAgICBkbyB7CiAgICAgICAgICAgICAgICAgICAgbGVuID0gaW5wdXRbbmV4dCArIGNvcHkrK107CiAgICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmhlYWQgJiYgbGVuICYmIHN0YXRlLmxlbmd0aCA8IDY1NTM2KSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmNvbW1lbnQgKz0gU3RyaW5nLmZyb21DaGFyQ29kZShsZW4pOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfSB3aGlsZSAobGVuICYmIGNvcHkgPCBoYXZlKTsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLmZsYWdzICYgNTEyKSB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUuY2hlY2sgPSBjcmMzMihzdGF0ZS5jaGVjaywgaW5wdXQsIGNvcHksIG5leHQpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBpZiAobGVuKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmhlYWQpIHsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5jb21tZW50ID0gbnVsbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBIQ1JDOwogICAgICAgICAgICAgIGNhc2UgSENSQzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5mbGFncyAmIDUxMikgewogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE2KSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaG9sZCAhPT0gKHN0YXRlLmNoZWNrICYgNjU1MzUpKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaGVhZGVyIGNyYyBtaXNtYXRjaCI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGVhZCkgewogICAgICAgICAgICAgICAgICBzdGF0ZS5oZWFkLmhjcmMgPSBzdGF0ZS5mbGFncyA+PiA5ICYgMTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaGVhZC5kb25lID0gdHJ1ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDA7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgRElDVElEOgogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSB6c3dhcDMyKGhvbGQpOwogICAgICAgICAgICAgICAgaG9sZCA9IDA7CiAgICAgICAgICAgICAgICBiaXRzID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESUNUOwogICAgICAgICAgICAgIGNhc2UgRElDVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlZGljdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfb3V0ID0gcHV0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX291dCA9IGxlZnQ7CiAgICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9pbiA9IG5leHQ7CiAgICAgICAgICAgICAgICAgIHN0cm0uYXZhaWxfaW4gPSBoYXZlOwogICAgICAgICAgICAgICAgICBzdGF0ZS5ob2xkID0gaG9sZDsKICAgICAgICAgICAgICAgICAgc3RhdGUuYml0cyA9IGJpdHM7CiAgICAgICAgICAgICAgICAgIHJldHVybiBaX05FRURfRElDVDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0cm0uYWRsZXIgPSBzdGF0ZS5jaGVjayA9IDE7CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICBjYXNlIFRZUEU6CiAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfQkxPQ0sgfHwgZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGNhc2UgVFlQRURPOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxhc3QpIHsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQ0hFQ0s7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxhc3QgPSBob2xkICYgMTsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAxOwogICAgICAgICAgICAgICAgYml0cyAtPSAxOwogICAgICAgICAgICAgICAgc3dpdGNoIChob2xkICYgMykgewogICAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IFNUT1JFRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgICAgICAgIGZpeGVkdGFibGVzKHN0YXRlKTsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgICAgICBpZiAoZmx1c2ggPT09IFpfVFJFRVMpIHsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAyOgogICAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUQUJMRTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgY2FzZSAzOgogICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYmxvY2sgdHlwZSI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAyOwogICAgICAgICAgICAgICAgYml0cyAtPSAyOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBTVE9SRUQ6CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gYml0cyAmIDc7CiAgICAgICAgICAgICAgICBiaXRzIC09IGJpdHMgJiA3OwogICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhvbGQgJiA2NTUzNSkgIT09IChob2xkID4+PiAxNiBeIDY1NTM1KSkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIHN0b3JlZCBibG9jayBsZW5ndGhzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBob2xkICYgNjU1MzU7CiAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgIGJpdHMgPSAwOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFlfOwogICAgICAgICAgICAgICAgaWYgKGZsdXNoID09PSBaX1RSRUVTKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBjYXNlIENPUFlfOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IENPUFk7CiAgICAgICAgICAgICAgY2FzZSBDT1BZOgogICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIGlmIChjb3B5KSB7CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gaGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBoYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBsZWZ0OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHV0aWxzLmFycmF5U2V0KG91dHB1dCwgaW5wdXQsIG5leHQsIGNvcHksIHB1dCk7CiAgICAgICAgICAgICAgICAgIGhhdmUgLT0gY29weTsKICAgICAgICAgICAgICAgICAgbmV4dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBsZWZ0IC09IGNvcHk7CiAgICAgICAgICAgICAgICAgIHB1dCArPSBjb3B5OwogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggLT0gY29weTsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gVFlQRTsKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgIGNhc2UgVEFCTEU6CiAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IDE0KSB7CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLm5sZW4gPSAoaG9sZCAmIDMxKSArIDI1NzsKICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA1OwogICAgICAgICAgICAgICAgYml0cyAtPSA1OwogICAgICAgICAgICAgICAgc3RhdGUubmRpc3QgPSAoaG9sZCAmIDMxKSArIDE7CiAgICAgICAgICAgICAgICBob2xkID4+Pj0gNTsKICAgICAgICAgICAgICAgIGJpdHMgLT0gNTsKICAgICAgICAgICAgICAgIHN0YXRlLm5jb2RlID0gKGhvbGQgJiAxNSkgKyA0OwogICAgICAgICAgICAgICAgaG9sZCA+Pj49IDQ7CiAgICAgICAgICAgICAgICBiaXRzIC09IDQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubmxlbiA+IDI4NiB8fCBzdGF0ZS5uZGlzdCA+IDMwKSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gInRvbyBtYW55IGxlbmd0aCBvciBkaXN0YW5jZSBzeW1ib2xzIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5MRU5TOwogICAgICAgICAgICAgIGNhc2UgTEVOTEVOUzoKICAgICAgICAgICAgICAgIHdoaWxlIChzdGF0ZS5oYXZlIDwgc3RhdGUubmNvZGUpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW29yZGVyW3N0YXRlLmhhdmUrK11dID0gaG9sZCAmIDc7CiAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSAzOwogICAgICAgICAgICAgICAgICBiaXRzIC09IDM7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB3aGlsZSAoc3RhdGUuaGF2ZSA8IDE5KSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbb3JkZXJbc3RhdGUuaGF2ZSsrXV0gPSAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubGVuY29kZSA9IHN0YXRlLmxlbmR5bjsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA3OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShDT0RFUywgc3RhdGUubGVucywgMCwgMTksIHN0YXRlLmxlbmNvZGUsIDAsIHN0YXRlLndvcmssIG9wdHMpOwogICAgICAgICAgICAgICAgc3RhdGUubGVuYml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBjb2RlIGxlbmd0aHMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5oYXZlID0gMDsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBDT0RFTEVOUzsKICAgICAgICAgICAgICBjYXNlIENPREVMRU5TOgogICAgICAgICAgICAgICAgd2hpbGUgKHN0YXRlLmhhdmUgPCBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgICAgaGVyZSA9IHN0YXRlLmxlbmNvZGVbaG9sZCAmICgxIDw8IHN0YXRlLmxlbmJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhlcmVfdmFsIDwgMTYpIHsKICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSsrXSA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIGlmIChoZXJlX3ZhbCA9PT0gMTYpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAyOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5oYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IHN0YXRlLmxlbnNbc3RhdGUuaGF2ZSAtIDFdOwogICAgICAgICAgICAgICAgICAgICAgY29weSA9IDMgKyAoaG9sZCAmIDMpOwogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IDI7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IDI7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChoZXJlX3ZhbCA9PT0gMTcpIHsKICAgICAgICAgICAgICAgICAgICAgIG4gPSBoZXJlX2JpdHMgKyAzOwogICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCBuKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgICAgICBiaXRzIC09IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGxlbiA9IDA7CiAgICAgICAgICAgICAgICAgICAgICBjb3B5ID0gMyArIChob2xkICYgNyk7CiAgICAgICAgICAgICAgICAgICAgICBob2xkID4+Pj0gMzsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gMzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgbiA9IGhlcmVfYml0cyArIDc7CiAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhhdmUgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaGF2ZS0tOwogICAgICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgICAgICAgbGVuID0gMDsKICAgICAgICAgICAgICAgICAgICAgIGNvcHkgPSAxMSArIChob2xkICYgMTI3KTsKICAgICAgICAgICAgICAgICAgICAgIGhvbGQgPj4+PSA3OwogICAgICAgICAgICAgICAgICAgICAgYml0cyAtPSA3OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUuaGF2ZSArIGNvcHkgPiBzdGF0ZS5ubGVuICsgc3RhdGUubmRpc3QpIHsKICAgICAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgYml0IGxlbmd0aCByZXBlYXQiOwogICAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB3aGlsZSAoY29weS0tKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5sZW5zW3N0YXRlLmhhdmUrK10gPSBsZW47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubW9kZSA9PT0gQkFEKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKHN0YXRlLmxlbnNbMjU2XSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGNvZGUgLS0gbWlzc2luZyBlbmQtb2YtYmxvY2siOwogICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSA5OwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUubGVuYml0cyB9OwogICAgICAgICAgICAgICAgcmV0ID0gaW5mbGF0ZV90YWJsZShMRU5TLCBzdGF0ZS5sZW5zLCAwLCBzdGF0ZS5ubGVuLCBzdGF0ZS5sZW5jb2RlLCAwLCBzdGF0ZS53b3JrLCBvcHRzKTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmJpdHMgPSBvcHRzLmJpdHM7CiAgICAgICAgICAgICAgICBpZiAocmV0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgbGl0ZXJhbC9sZW5ndGhzIHNldCI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGJpdHMgPSA2OwogICAgICAgICAgICAgICAgc3RhdGUuZGlzdGNvZGUgPSBzdGF0ZS5kaXN0ZHluOwogICAgICAgICAgICAgICAgb3B0cyA9IHsgYml0czogc3RhdGUuZGlzdGJpdHMgfTsKICAgICAgICAgICAgICAgIHJldCA9IGluZmxhdGVfdGFibGUoRElTVFMsIHN0YXRlLmxlbnMsIHN0YXRlLm5sZW4sIHN0YXRlLm5kaXN0LCBzdGF0ZS5kaXN0Y29kZSwgMCwgc3RhdGUud29yaywgb3B0cyk7CiAgICAgICAgICAgICAgICBzdGF0ZS5kaXN0Yml0cyA9IG9wdHMuYml0czsKICAgICAgICAgICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBkaXN0YW5jZXMgc2V0IjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOXzsKICAgICAgICAgICAgICAgIGlmIChmbHVzaCA9PT0gWl9UUkVFUykgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgY2FzZSBMRU5fOgogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IExFTjsKICAgICAgICAgICAgICBjYXNlIExFTjoKICAgICAgICAgICAgICAgIGlmIChoYXZlID49IDYgJiYgbGVmdCA+PSAyNTgpIHsKICAgICAgICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IHB1dDsKICAgICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBsZWZ0OwogICAgICAgICAgICAgICAgICBzdHJtLm5leHRfaW4gPSBuZXh0OwogICAgICAgICAgICAgICAgICBzdHJtLmF2YWlsX2luID0gaGF2ZTsKICAgICAgICAgICAgICAgICAgc3RhdGUuaG9sZCA9IGhvbGQ7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJpdHMgPSBiaXRzOwogICAgICAgICAgICAgICAgICBpbmZsYXRlX2Zhc3Qoc3RybSwgX291dCk7CiAgICAgICAgICAgICAgICAgIHB1dCA9IHN0cm0ubmV4dF9vdXQ7CiAgICAgICAgICAgICAgICAgIG91dHB1dCA9IHN0cm0ub3V0cHV0OwogICAgICAgICAgICAgICAgICBsZWZ0ID0gc3RybS5hdmFpbF9vdXQ7CiAgICAgICAgICAgICAgICAgIG5leHQgPSBzdHJtLm5leHRfaW47CiAgICAgICAgICAgICAgICAgIGlucHV0ID0gc3RybS5pbnB1dDsKICAgICAgICAgICAgICAgICAgaGF2ZSA9IHN0cm0uYXZhaWxfaW47CiAgICAgICAgICAgICAgICAgIGhvbGQgPSBzdGF0ZS5ob2xkOwogICAgICAgICAgICAgICAgICBiaXRzID0gc3RhdGUuYml0czsKICAgICAgICAgICAgICAgICAgaWYgKHN0YXRlLm1vZGUgPT09IFRZUEUpIHsKICAgICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gMDsKICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtob2xkICYgKDEgPDwgc3RhdGUubGVuYml0cykgLSAxXTsKICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgIGhlcmVfb3AgPSBoZXJlID4+PiAxNiAmIDI1NTsKICAgICAgICAgICAgICAgICAgaGVyZV92YWwgPSBoZXJlICYgNjU1MzU7CiAgICAgICAgICAgICAgICAgIGlmIChoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgIGJpdHMgKz0gODsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYmIChoZXJlX29wICYgMjQwKSA9PT0gMCkgewogICAgICAgICAgICAgICAgICBsYXN0X2JpdHMgPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICAgIGxhc3Rfb3AgPSBoZXJlX29wOwogICAgICAgICAgICAgICAgICBsYXN0X3ZhbCA9IGhlcmVfdmFsOwogICAgICAgICAgICAgICAgICBmb3IgKDsgOyApIHsKICAgICAgICAgICAgICAgICAgICBoZXJlID0gc3RhdGUubGVuY29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBzdGF0ZS5sZW5ndGggPSBoZXJlX3ZhbDsKICAgICAgICAgICAgICAgIGlmIChoZXJlX29wID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMSVQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKGhlcmVfb3AgJiAzMikgewogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrID0gLTE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBUWVBFOwogICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChoZXJlX29wICYgNjQpIHsKICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW52YWxpZCBsaXRlcmFsL2xlbmd0aCBjb2RlIjsKICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU5FWFQ7CiAgICAgICAgICAgICAgY2FzZSBMRU5FWFQ6CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUuZXh0cmEpIHsKICAgICAgICAgICAgICAgICAgbiA9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICB3aGlsZSAoYml0cyA8IG4pIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCArPSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCArPSBob2xkICYgKDEgPDwgc3RhdGUuZXh0cmEpIC0gMTsKICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBiaXRzIC09IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgICBzdGF0ZS5iYWNrICs9IHN0YXRlLmV4dHJhOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUud2FzID0gc3RhdGUubGVuZ3RoOwogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IERJU1Q7CiAgICAgICAgICAgICAgY2FzZSBESVNUOgogICAgICAgICAgICAgICAgZm9yICg7IDsgKSB7CiAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtob2xkICYgKDEgPDwgc3RhdGUuZGlzdGJpdHMpIC0gMV07CiAgICAgICAgICAgICAgICAgIGhlcmVfYml0cyA9IGhlcmUgPj4+IDI0OwogICAgICAgICAgICAgICAgICBoZXJlX29wID0gaGVyZSA+Pj4gMTYgJiAyNTU7CiAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICBpZiAoaGVyZV9iaXRzIDw9IGJpdHMpIHsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgIGhvbGQgKz0gaW5wdXRbbmV4dCsrXSA8PCBiaXRzOwogICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoKGhlcmVfb3AgJiAyNDApID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGxhc3RfYml0cyA9IGhlcmVfYml0czsKICAgICAgICAgICAgICAgICAgbGFzdF9vcCA9IGhlcmVfb3A7CiAgICAgICAgICAgICAgICAgIGxhc3RfdmFsID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICAgIGZvciAoOyA7ICkgewogICAgICAgICAgICAgICAgICAgIGhlcmUgPSBzdGF0ZS5kaXN0Y29kZVtsYXN0X3ZhbCArICgoaG9sZCAmICgxIDw8IGxhc3RfYml0cyArIGxhc3Rfb3ApIC0gMSkgPj4gbGFzdF9iaXRzKV07CiAgICAgICAgICAgICAgICAgICAgaGVyZV9iaXRzID0gaGVyZSA+Pj4gMjQ7CiAgICAgICAgICAgICAgICAgICAgaGVyZV9vcCA9IGhlcmUgPj4+IDE2ICYgMjU1OwogICAgICAgICAgICAgICAgICAgIGhlcmVfdmFsID0gaGVyZSAmIDY1NTM1OwogICAgICAgICAgICAgICAgICAgIGlmIChsYXN0X2JpdHMgKyBoZXJlX2JpdHMgPD0gYml0cykgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaG9sZCA+Pj49IGxhc3RfYml0czsKICAgICAgICAgICAgICAgICAgYml0cyAtPSBsYXN0X2JpdHM7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gbGFzdF9iaXRzOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaG9sZCA+Pj49IGhlcmVfYml0czsKICAgICAgICAgICAgICAgIGJpdHMgLT0gaGVyZV9iaXRzOwogICAgICAgICAgICAgICAgc3RhdGUuYmFjayArPSBoZXJlX2JpdHM7CiAgICAgICAgICAgICAgICBpZiAoaGVyZV9vcCAmIDY0KSB7CiAgICAgICAgICAgICAgICAgIHN0cm0ubXNnID0gImludmFsaWQgZGlzdGFuY2UgY29kZSI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ID0gaGVyZV92YWw7CiAgICAgICAgICAgICAgICBzdGF0ZS5leHRyYSA9IGhlcmVfb3AgJiAxNTsKICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBESVNURVhUOwogICAgICAgICAgICAgIGNhc2UgRElTVEVYVDoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5leHRyYSkgewogICAgICAgICAgICAgICAgICBuID0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgbikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgc3RhdGUub2Zmc2V0ICs9IGhvbGQgJiAoMSA8PCBzdGF0ZS5leHRyYSkgLSAxOwogICAgICAgICAgICAgICAgICBob2xkID4+Pj0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIGJpdHMgLT0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICAgIHN0YXRlLmJhY2sgKz0gc3RhdGUuZXh0cmE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gc3RhdGUuZG1heCkgewogICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBCQUQ7CiAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IE1BVENIOwogICAgICAgICAgICAgIGNhc2UgTUFUQ0g6CiAgICAgICAgICAgICAgICBpZiAobGVmdCA9PT0gMCkgewogICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjb3B5ID0gX291dCAtIGxlZnQ7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUub2Zmc2V0ID4gY29weSkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gc3RhdGUub2Zmc2V0IC0gY29weTsKICAgICAgICAgICAgICAgICAgaWYgKGNvcHkgPiBzdGF0ZS53aGF2ZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5zYW5lKSB7CiAgICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbnZhbGlkIGRpc3RhbmNlIHRvbyBmYXIgYmFjayI7CiAgICAgICAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gQkFEOwogICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gc3RhdGUud25leHQpIHsKICAgICAgICAgICAgICAgICAgICBjb3B5IC09IHN0YXRlLnduZXh0OwogICAgICAgICAgICAgICAgICAgIGZyb20gPSBzdGF0ZS53c2l6ZSAtIGNvcHk7CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZnJvbSA9IHN0YXRlLnduZXh0IC0gY29weTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoY29weSA+IHN0YXRlLmxlbmd0aCkgewogICAgICAgICAgICAgICAgICAgIGNvcHkgPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgZnJvbV9zb3VyY2UgPSBzdGF0ZS53aW5kb3c7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBmcm9tX3NvdXJjZSA9IG91dHB1dDsKICAgICAgICAgICAgICAgICAgZnJvbSA9IHB1dCAtIHN0YXRlLm9mZnNldDsKICAgICAgICAgICAgICAgICAgY29weSA9IHN0YXRlLmxlbmd0aDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChjb3B5ID4gbGVmdCkgewogICAgICAgICAgICAgICAgICBjb3B5ID0gbGVmdDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGxlZnQgLT0gY29weTsKICAgICAgICAgICAgICAgIHN0YXRlLmxlbmd0aCAtPSBjb3B5OwogICAgICAgICAgICAgICAgZG8gewogICAgICAgICAgICAgICAgICBvdXRwdXRbcHV0KytdID0gZnJvbV9zb3VyY2VbZnJvbSsrXTsKICAgICAgICAgICAgICAgIH0gd2hpbGUgKC0tY29weSk7CiAgICAgICAgICAgICAgICBpZiAoc3RhdGUubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHN0YXRlLm1vZGUgPSBMRU47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICBjYXNlIExJVDoKICAgICAgICAgICAgICAgIGlmIChsZWZ0ID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIGJyZWFrIGluZl9sZWF2ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIG91dHB1dFtwdXQrK10gPSBzdGF0ZS5sZW5ndGg7CiAgICAgICAgICAgICAgICBsZWZ0LS07CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOOwogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgY2FzZSBDSEVDSzoKICAgICAgICAgICAgICAgIGlmIChzdGF0ZS53cmFwKSB7CiAgICAgICAgICAgICAgICAgIHdoaWxlIChiaXRzIDwgMzIpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZSA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgYnJlYWsgaW5mX2xlYXZlOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBoYXZlLS07CiAgICAgICAgICAgICAgICAgICAgaG9sZCB8PSBpbnB1dFtuZXh0KytdIDw8IGJpdHM7CiAgICAgICAgICAgICAgICAgICAgYml0cyArPSA4OwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIF9vdXQgLT0gbGVmdDsKICAgICAgICAgICAgICAgICAgc3RybS50b3RhbF9vdXQgKz0gX291dDsKICAgICAgICAgICAgICAgICAgc3RhdGUudG90YWwgKz0gX291dDsKICAgICAgICAgICAgICAgICAgaWYgKF9vdXQpIHsKICAgICAgICAgICAgICAgICAgICBzdHJtLmFkbGVyID0gc3RhdGUuY2hlY2sgPSBzdGF0ZS5mbGFncyA/IGNyYzMyKHN0YXRlLmNoZWNrLCBvdXRwdXQsIF9vdXQsIHB1dCAtIF9vdXQpIDogYWRsZXIzMihzdGF0ZS5jaGVjaywgb3V0cHV0LCBfb3V0LCBwdXQgLSBfb3V0KTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBfb3V0ID0gbGVmdDsKICAgICAgICAgICAgICAgICAgaWYgKChzdGF0ZS5mbGFncyA/IGhvbGQgOiB6c3dhcDMyKGhvbGQpKSAhPT0gc3RhdGUuY2hlY2spIHsKICAgICAgICAgICAgICAgICAgICBzdHJtLm1zZyA9ICJpbmNvcnJlY3QgZGF0YSBjaGVjayI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gTEVOR1RIOwogICAgICAgICAgICAgIGNhc2UgTEVOR1RIOgogICAgICAgICAgICAgICAgaWYgKHN0YXRlLndyYXAgJiYgc3RhdGUuZmxhZ3MpIHsKICAgICAgICAgICAgICAgICAgd2hpbGUgKGJpdHMgPCAzMikgewogICAgICAgICAgICAgICAgICAgIGlmIChoYXZlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGhhdmUtLTsKICAgICAgICAgICAgICAgICAgICBob2xkICs9IGlucHV0W25leHQrK10gPDwgYml0czsKICAgICAgICAgICAgICAgICAgICBiaXRzICs9IDg7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgaWYgKGhvbGQgIT09IChzdGF0ZS50b3RhbCAmIDQyOTQ5NjcyOTUpKSB7CiAgICAgICAgICAgICAgICAgICAgc3RybS5tc2cgPSAiaW5jb3JyZWN0IGxlbmd0aCBjaGVjayI7CiAgICAgICAgICAgICAgICAgICAgc3RhdGUubW9kZSA9IEJBRDsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBob2xkID0gMDsKICAgICAgICAgICAgICAgICAgYml0cyA9IDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzdGF0ZS5tb2RlID0gRE9ORTsKICAgICAgICAgICAgICBjYXNlIERPTkU6CiAgICAgICAgICAgICAgICByZXQgPSBaX1NUUkVBTV9FTkQ7CiAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgY2FzZSBCQUQ6CiAgICAgICAgICAgICAgICByZXQgPSBaX0RBVEFfRVJST1I7CiAgICAgICAgICAgICAgICBicmVhayBpbmZfbGVhdmU7CiAgICAgICAgICAgICAgY2FzZSBNRU06CiAgICAgICAgICAgICAgICByZXR1cm4gWl9NRU1fRVJST1I7CiAgICAgICAgICAgICAgY2FzZSBTWU5DOgogICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICByZXR1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m5leHRfb3V0IC0gX291dCk7CiAgICAgICAgfQogICAgICAgIHN0cm0uZGF0YV90eXBlID0gc3RhdGUuYml0cyArIChzdGF0ZS5sYXN0ID8gNjQgOiAwKSArIChzdGF0ZS5tb2RlID09PSBUWVBFID8gMTI4IDogMCkgKyAoc3RhdGUubW9kZSA9PT0gTEVOXyB8fCBzdGF0ZS5tb2RlID09PSBDT1BZXyA/IDI1NiA6IDApOwogICAgICAgIGlmICgoX2luID09PSAwICYmIF9vdXQgPT09IDAgfHwgZmx1c2ggPT09IFpfRklOSVNIKSAmJiByZXQgPT09IFpfT0spIHsKICAgICAgICAgIHJldCA9IFpfQlVGX0VSUk9SOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcmV0OwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVFbmQoc3RybSkgewogICAgICAgIGlmICghc3RybSB8fCAhc3RybS5zdGF0ZSkgewogICAgICAgICAgcmV0dXJuIFpfU1RSRUFNX0VSUk9SOwogICAgICAgIH0KICAgICAgICB2YXIgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmIChzdGF0ZS53aW5kb3cpIHsKICAgICAgICAgIHN0YXRlLndpbmRvdyA9IG51bGw7CiAgICAgICAgfQogICAgICAgIHN0cm0uc3RhdGUgPSBudWxsOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVHZXRIZWFkZXIoc3RybSwgaGVhZCkgewogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICBpZiAoIXN0cm0gfHwgIXN0cm0uc3RhdGUpIHsKICAgICAgICAgIHJldHVybiBaX1NUUkVBTV9FUlJPUjsKICAgICAgICB9CiAgICAgICAgc3RhdGUgPSBzdHJtLnN0YXRlOwogICAgICAgIGlmICgoc3RhdGUud3JhcCAmIDIpID09PSAwKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlLmhlYWQgPSBoZWFkOwogICAgICAgIGhlYWQuZG9uZSA9IGZhbHNlOwogICAgICAgIHJldHVybiBaX09LOwogICAgICB9CiAgICAgIGZ1bmN0aW9uIGluZmxhdGVTZXREaWN0aW9uYXJ5KHN0cm0sIGRpY3Rpb25hcnkpIHsKICAgICAgICB2YXIgZGljdExlbmd0aCA9IGRpY3Rpb25hcnkubGVuZ3RoOwogICAgICAgIHZhciBzdGF0ZTsKICAgICAgICB2YXIgZGljdGlkOwogICAgICAgIHZhciByZXQ7CiAgICAgICAgaWYgKCFzdHJtIHx8ICFzdHJtLnN0YXRlKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlID0gc3RybS5zdGF0ZTsKICAgICAgICBpZiAoc3RhdGUud3JhcCAhPT0gMCAmJiBzdGF0ZS5tb2RlICE9PSBESUNUKSB7CiAgICAgICAgICByZXR1cm4gWl9TVFJFQU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIGlmIChzdGF0ZS5tb2RlID09PSBESUNUKSB7CiAgICAgICAgICBkaWN0aWQgPSAxOwogICAgICAgICAgZGljdGlkID0gYWRsZXIzMihkaWN0aWQsIGRpY3Rpb25hcnksIGRpY3RMZW5ndGgsIDApOwogICAgICAgICAgaWYgKGRpY3RpZCAhPT0gc3RhdGUuY2hlY2spIHsKICAgICAgICAgICAgcmV0dXJuIFpfREFUQV9FUlJPUjsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0ID0gdXBkYXRld2luZG93KHN0cm0sIGRpY3Rpb25hcnksIGRpY3RMZW5ndGgsIGRpY3RMZW5ndGgpOwogICAgICAgIGlmIChyZXQpIHsKICAgICAgICAgIHN0YXRlLm1vZGUgPSBNRU07CiAgICAgICAgICByZXR1cm4gWl9NRU1fRVJST1I7CiAgICAgICAgfQogICAgICAgIHN0YXRlLmhhdmVkaWN0ID0gMTsKICAgICAgICByZXR1cm4gWl9PSzsKICAgICA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U0g6IDEsCiAgICAgICAgWl9TWU5DX0ZMVVNIOiAyLAogICAgICAgIFpfRlVMTF9GTFVTSDogMywKICAgICAgICBaX0ZJTklTSDogNCwKICAgICAgICBaX0JMT0NLOiA1LAogICAgICAgIFpfVFJFRVM6IDYsCiAgICAgICAgWl9PSzogMCwKICAgICAgICBaX1NUUkVBTV9FTkQ6IDEsCiAgICAgICAgWl9ORUVEX0RJQ1Q6IDIsCiAgICAgICAgWl9FUlJOTzogLTEsCiAgICAgICAgWl9TVFJFQU1fRVJST1I6IC0yLAogICAgICAgIFpfREFUQV9FUlJPUjogLTMsCiAgICAgICAgWl9CVUZfRVJST1I6IC01LAogICAgICAgIFpfTk9fQ09NUFJFU1NJT046IDAsCiAgICAgICAgWl9CRVNUX1NQRUVEOiAxLAogICAgICAgIFpfQkVTVF9DT01QUkVTU0lPTjogOSwKICAgICAgICBaX0RFRkFVTFRfQ09NUFJFU1NJT046IC0xLAogICAgICAgIFpfRklMVEVSRUQ6IDEsCiAgICAgICAgWl9IVUZGTUFOX09OTFk6IDIsCiAgICAgICAgWl9STEU6IDMsCiAgICAgICAgWl9GSVhFRDogNCwKICAgICAgICBaX0RFRkFVTFRfU1RSQVRFR1k6IDAsCiAgICAgICAgWl9CSU5BUlk6IDAsCiAgICAgICAgWl9URVhUOiAxLAogICAgICAgIFpfVU5LTk9XTjogMiwKICAgICAgICBaX0RFRkxBVEVEOiA4CiAgICAgIH07CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9wYWtvQDEuMC4xMS9ub2RlX21vZHVsZXMvcGFrby9saWIvemxpYi9nemhlYWRlci5qcwogIHZhciByZXF1aXJlX2d6aGVhZGVyID0gX19jb21tb25KUyh7CiAgICAibm9kZV9tb2R1bGVzLy5wbnBtL3Bha29AMS4wLjExL25vZGVfbW9kdWxlcy9wYWtvL2xpYi96bGliL2d6aGVhZGVyLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1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gICAgdmFyIEdaaGVhZGVyID0gcmVxdWlyZV9nemhlYWRlcigpOwogICAgICB2YXIgdG9TdHJpbmcgPSBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nOwogICAgICBmdW5jdGlvbiBJbmZsYXRlMihvcHRpb25zKSB7CiAgICAgICAgaWYgKCEodGhpcyBpbnN0YW5jZW9mIEluZmxhdGUyKSkKICAgICAgICAgIHJldHVybiBuZXcgSW5mbGF0ZTIob3B0aW9ucyk7CiAgICAgICAgdGhpcy5vcHRpb25zID0gdXRpbHMuYXNzaWduKHsKICAgICAgICAgIGNodW5rU2l6ZTogMTYzODQsCiAgICAgICAgICB3aW5kb3dCaXRzOiAwLAogICAgICAgICAgdG86ICIiCiAgICAgICAgfSwgb3B0aW9ucyB8fCB7fSk7CiAgICAgICAgdmFyIG9wdCA9IHRoaXMub3B0aW9uczsKICAgICAgICBpZiAob3B0LnJhdyAmJiBvcHQud2luZG93Qml0cyA+PSAwICYmIG9wdC53aW5kb3dCaXRzIDwgMTYpIHsKICAgICAgICAgIG9wdC53aW5kb3dCaXRzID0gLW9wdC53aW5kb3dCaXRzOwogICAgICAgICAgaWYgKG9wdC53aW5kb3dCaXRzID09PSAwKSB7CiAgICAgICAgICAgIG9wdC53aW5kb3dCaXRzID0gLTE1OwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAob3B0LndpbmRvd0JpdHMgPj0gMCAmJiBvcHQud2luZG93Qml0cyA8IDE2ICYmICEob3B0aW9ucyAmJiBvcHRpb25zLndpbmRvd0JpdHMpKSB7CiAgICAgICAgICBvcHQud2luZG93Qml0cyArPSAzMjsKICAgICAgICB9CiAgICAgICAgaWYgKG9wdC53aW5kb3dCaXRzID4gMTUgJiYgb3B0LndpbmRvd0JpdHMgPCA0OCkgewogICAgICAgICAgaWYgKChvcHQud2luZG93Qml0cyAmIDE1KSA9PT0gMCkgewogICAgICAgICAgICBvcHQud2luZG93Qml0cyB8PSAxNTsKICAgICAgICAgIH0KICAgICA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pOwogICAgICAgICAgICBpZiAoc3RhdHVzICE9PSBjLlpfT0spIHsKICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IobXNnW3N0YXR1c10pOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIEluZmxhdGUyLnByb3RvdHlwZS5wdXNoID0gZnVuY3Rpb24oZGF0YSwgbW9kZSkgewogICAgICAgIHZhciBzdHJtID0gdGhpcy5zdHJtOwogICAgICAgIHZhciBjaHVua1NpemUgPSB0aGlzLm9wdGlvbnMuY2h1bmtTaXplOwogICAgICAgIHZhciBkaWN0aW9uYXJ5ID0gdGhpcy5vcHRpb25zLmRpY3Rpb25hcnk7CiAgICAgICAgdmFyIHN0YXR1cywgX21vZGU7CiAgICAgICAgdmFyIG5leHRfb3V0X3V0ZjgsIHRhaWwsIHV0ZjhzdHI7CiAgICAgICAgdmFyIGFsbG93QnVmRXJyb3IgPSBmYWxzZTsKICAgICAgICBpZiAodGhpcy5lbmRlZCkgewogICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgICBfbW9kZSA9IG1vZGUgPT09IH5+bW9kZSA/IG1vZGUgOiBtb2RlID09PSB0cnVlID8gYy5aX0ZJTklTSCA6IGMuWl9OT19GTFVTSDsKICAgICAgICBpZiAodHlwZW9mIGRhdGEgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICBzdHJtLmlucHV0ID0gc3RyaW5ncy5iaW5zdHJpbmcyYnVmKGRhdGEpOwogICAgICAgIH0gZWxzZSBpZiAodG9TdHJpbmcuY2FsbChkYXRhKSA9PT0gIltvYmplY3QgQXJyYXlCdWZmZXJdIikgewogICAgICAgICAgc3RybS5pbnB1dCA9IG5ldyBVaW50OEFycmF5KGRhdGEpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBzdHJtLmlucHV0ID0gZGF0YTsKICAgICAgICB9CiAgICAgICAgc3RybS5uZXh0X2luID0gMDsKICAgICAgICBzdHJtLmF2YWlsX2luID0gc3RybS5pbnB1dC5sZW5ndGg7CiAgICAgICAgZG8gewogICAgICAgICAgaWYgKHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIHN0cm0ub3V0cHV0ID0gbmV3IHV0aWxzLkJ1ZjgoY2h1bmtTaXplKTsKICAgICAgICAgICAgc3RybS5uZXh0X291dCA9IDA7CiAgICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gY2h1bmtTaXplOwogICAgICAgICAgfQogICAgICAgICAgc3RhdHVzID0gemxpYl9pbmZsYXRlLmluZmxhdGUoc3RybSwgYy5aX05PX0ZMVVNIKTsKICAgICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9ORUVEX0RJQ1QgJiYgZGljdGlvbmFyeSkgewogICAgICAgICAgICBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZVNldERpY3Rpb25hcnkodGhpcy5zdHJtLCBkaWN0aW9uYXJ5KTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9CVUZfRVJST1IgJiYgYWxsb3dCdWZFcnJvciA9PT0gdHJ1ZSkgewogICAgICAgICAgICBzdGF0dXMgPSBjLlpfT0s7CiAgICAgICAgICAgIGFsbG93QnVmRXJyb3IgPSBmYWxzZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdGF0dXMgIT09IGMuWl9TVFJFQU1fRU5EICYmIHN0YXR1cyAhPT0gYy5aX09LKSB7CiAgICAgICAgICAgIHRoaXMub25FbmQoc3RhdHVzKTsKICAgICAgICAgICAgdGhpcy5lbmRlZCA9IHRydWU7CiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdHJtLm5leHRfb3V0KSB7CiAgICAgICAgICAgIGlmIChzdHJtLmF2YWlsX291dCA9PT0gMCB8fCBzdGF0dXMgPT09IGMuWl9TVFJFQU1fRU5EIHx8IHN0cm0uYXZhaWxfaW4gPT09IDAgJiYgKF9tb2RlID09PSBjLlpfRklOSVNIIHx8IF9tb2RlID09PSBjLlpfU1lOQ19GTFVTSCkpIHsKICAgICAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLnRvID09PSAic3RyaW5nIikgewogICAgICAgICAgICAgICAgbmV4dF9vdXRfdXRmOCA9IHN0cmluZ3MudXRmOGJvcmRlcihzdHJtLm91dHB1dCwgc3RybS5uZXh0X291dCk7CiAgICAgICAgICAgICAgICB0YWlsID0gc3RybS5uZXh0X291dCAtIG5leHRfb3V0X3V0Zjg7CiAgICAgICAgICAgICAgICB1dGY4c3RyID0gc3RyaW5ncy5idWYyc3RyaW5nKHN0cm0ub3V0cHV0LCBuZXh0X291dF91dGY4KTsKICAgICAgICAgICAgICAgIHN0cm0ubmV4dF9vdXQgPSB0YWlsOwogICAgICAgICAgICAgICAgc3RybS5hdmFpbF9vdXQgPSBjaHVua1NpemUgLSB0YWlsOwogICAgICAgICAgICAgICAgaWYgKHRhaWwpIHsKICAgICAgICAgICAgICAgICAgdXRpbHMuYXJyYXlTZXQoc3RybS5vdXRwdXQsIHN0cm0ub3V0cHV0LCBuZXh0X291dF91dGY4LCB0YWlsLCAwKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHRoaXMub25EYXRhKHV0ZjhzdHIpOwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICB0aGlzLm9uRGF0YSh1dGlscy5zaHJpbmtCdWYoc3RybS5vdXRwdXQsIHN0cm0ubmV4dF9vdXQpKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzdHJtLmF2YWlsX2luID09PSAwICYmIHN0cm0uYXZhaWxfb3V0ID09PSAwKSB7CiAgICAgICAgICAgIGFsbG93QnVmRXJyb3IgPSB0cnVlOwogICAgICAgICAgfQogICAgICAgIH0gd2hpbGUgKChzdHJtLmF2YWlsX2luID4gMCB8fCBzdHJtLmF2YWlsX291dCA9PT0gMCkgJiYgc3RhdHVzICE9PSBjLlpfU1RSRUFNX0VORCk7CiAgICAgICAgaWYgKHN0YXR1cyA9PT0gYy5aX1NUUkVBTV9FTkQpIHsKICAgICAgICAgIF9tb2RlID0gYy5aX0ZJTklTSDsKICAgICAgICB9CiAgICAgICAgaWYgKF9tb2RlID09PSBjLlpfRklOSVNIKSB7CiAgICAgICAgICBzdGF0dXMgPSB6bGliX2luZmxhdGUuaW5mbGF0ZUVuZCh0aGlzLnN0cm0pOwogICAgICAgICAgdGhpcy5vbkVuZChzdGF0dXMpOwogICAgICAgICAgdGhpcy5lbmRlZCA9IHRydWU7CiAgICAgICAgICByZXR1cm4gc3RhdHVzID09PSBjLlpfT0s7CiAgICAgICAgfQogICAgICAgIGlmIChfbW9kZSA9PT0gYy5aX1NZTkNfRkxVU0gpIHsKICAgICAgICAgIHRoaXMub25FbmQoYy5aX09LKTsKICAgICAgICAgIHN0cm0uYXZhaWxfb3V0ID0gMDsKICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIH0KICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgfTsKICAgICAgSW5mbGF0ZTIucHJvdG90eXBlLm9uRGF0YSA9IGZ1bmN0aW9uKGNodW5rKSB7CiAgICAgICAgdGhpcy5jaHVua3MucHVzaChjaHVuayk7CiAgICAgIH07CiAgICAgIEluZmxhdGUyLnByb3RvdHlwZS5vbkVuZCA9IGZ1bmN0aW9uKHN0YXR1cykgewogICAgICAgIGlmIChzdGF0dXMgPT09IGMuWl9PSykgewogICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy50byA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgdGhpcy5yZXN1bHQgPSB0aGlzLmNodW5rcy5qb2luKCIiKTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHRoaXMucmVzdWx0ID0gdXRpbHMuZmxhdHRlbkNodW5rcyh0aGlzLmNodW5rcyk7CiAgICAgICAgICB9CiAgIC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IHsKICAgICAgaW5pdF9idWZmZXJfc2hpbSgpOwogICAgICAidXNlIHN0cmljdCI7CiAgICAgIHZhciBhc3NpZ24gPSByZXF1aXJlX2NvbW1vbigpLmFzc2lnbjsKICAgICAgdmFyIGRlZmxhdGUgPSByZXF1aXJlX2RlZmxhdGUyKCk7CiAgICAgIHZhciBpbmZsYXRlID0gcmVxdWlyZV9pbmZsYXRlMigpOwogICAgICB2YXIgY29uc3RhbnRzID0gcmVxdWlyZV9jb25zdGFudHMoKTsKICAgICAgdmFyIHBha28gPSB7fTsKICAgICAgYXNzaWduKHBha28sIGRlZmxhdGUsIGluZmxhdGUsIGNvbnN0YW50cyk7CiAgICAgIG1vZHVsZTIuZXhwb3J0cyA9IHBha287CiAgICB9CiAgfSk7CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9sb25nQDQuMC4wL25vZGVfbW9kdWxlcy9sb25nL3NyYy9sb25nLmpzCiAgdmFyIHJlcXVpcmVfbG9uZyA9IF9fY29tbW9uSlMoewogICAgIm5vZGVfbW9kdWxlcy8ucG5wbS9sb25nQDQuMC4wL25vZGVfbW9kdWxlcy9sb25nL3NyYy9sb25nLmpzIihleHBvcnRzMiwgbW9kdWxlMikgewogICAgICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgICAgIG1vZHVsZTIuZXhwb3J0cyA9IExvbmc0OwogICAgICB2YXIgd2FzbSA9IG51bGw7CiAgICAgIHRyeSB7CiAgICAgICAgd2FzbSA9IG5ldyBXZWJBc3NlbWJseS5JbnN0YW5jZShuZXcgV2ViQXNzZW1ibHkuTW9kdWxlKG5ldyBVaW50OEFycmF5KFsKICAgICAgICAgIDAsCiAgICAgICAgICA5NywKICAgICAgICAgIDExNSwKICAgICAgICAgIDEwOSwKICAgICAgICAgIDEsCiAgICAgICAgICAwLAogICAgICAgICAgMCwKICAgICAgICAgIDAsCiAgICAgICAgICAxLAogICAgICAgICAgMTMsCiAgICAgICAgICAyLAogICAgICAgICAgOTYsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNywKICAgICAgICAgIDk2LAogICAgICAgICAgNCwKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEyNywKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAzLAogICAgICAgICAgNywKICAgICAgICAgIDYsCiAgICAgICAgICAwLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEsCiAgICAgICAgICA2LAogICAgICAgICAgNiwKICAgICAgICAgIDEsCiAgICAgICAgICAxMjcsCiAgICAgICAgICAxLAogICAgICAgICAgNjUsCiAgICAgICAgICAwLAogICAgICAgICAgMTEsCiAgICAgICAgICA3LAogICAgICAgICAgNTAsCiAgICAgICAgICA2LAogICAgICAgICAgMywKICAgICAgICAgIDEwOSwKICAgICAgICAgIDExNywKICAgICAgICAgIDEwOCwKICAgICAgICAgIDAsCiAgICAgICAgICAxLAogICAgICAgICAgNSwKICAgICAgICAgIDEwMCwKICAgICAgICAgIDEwNSwKICAgICAgICAgIDExOCwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE1LAogICAgICAgICAgMCwKICAgICAgICAgIDIsCiAgICAgICAgICA1LAogICAgICAgICAgMTAwLAogICAgICAgICAgMTA1LAogICAgICAgICAgMTE4LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMTcsCiAgICAgICAgICAwLAogICAgICAgICAgMywKICAgICAgICAgIDUsCiAgICAgICAgICAxMTQsCiAgICAgICAgICAxMDEsCiAgICAgICAgICAxMDksCiAgICAgICAgICA5NSwKICAgICAgICAgIDExNSwKICAgICAgICAgIDAsCiAgICAgICAgICA0LAogICAgICAgICAgNSwKICAgICAgICAgIDExNCwKICAgICAgICAgIDEwMSwKICAgICAgICAgIDEwOSwKICAgICAgICAgIDk1LAogICAgICAgICAgMTE3LAogICAgICAgICAgMCwKICAgICAgICAgIDUsCiAgICAgICAgICA4LAogICAgICAgICAgMTAzLAogICAgICAgICAgMTAxLAogICAgICAgICAgMTE2LAogICAgICAgICAgOTUsCiAgICAgICAgICAxMDQsCiAgICAgICAgICAxMDUsCiAgICAgICAgICAxMDMsCiAgICAgICAgICAxMDQsCiAgICAgICAgICAwLAogICAgICAgICAgMCwKICAgICAgICAgIDEwLAogICAgICAgICAgMTkxLAogICAgICAgICAgMSwKICAgICAgICAgIDYsCiAgICAgICAgICA0LAogICAgICAgICAgMCwKICAgICAgICAgIDM1LAogICAgICAgICAgMCwKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI2LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI3LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI4LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTI5LAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExLAogICAgICAgICAgMzYsCiAgICAgICAgICAxLAogICAgICAgICAgMSwKICAgICAgICAgIDEyNiwKICAgICAgICAgIDMyLAogICAgICAgICAgMCwKICAgICAgICAgIDE3MywKICAgICAgICAgIDMyLAogICAgICAgICAgMSwKICAgICAgICAgIDE3MywKICAgICAgICAgIDY2LAogICAgICAgICAgMzIsCiAgICAgICAgICAxMzQsCiAgICAgICAgICAxMzIsCiAgICAgICAgICAzMiwKICAgICAgICAgIDIsCiAgICAgICAgICAxNzMsCiAgICAgICAgICAzMiwKICAgICAgICAgIDMsCiAgICAgICAgICAxNzMsCiAgICAgICAgICA2NiwKICAgICAgICAgIDMyLAogICAgICAgICAgMTM0LAogICAgICAgICAgMTMyLAogICAgICAgICAgMTMwLAogICAgICAgICAgMzQsCiAgICAgICAgICA0LAogICAgICAgICAgNjYsCiAgICAgICAgICAzMiwKICAgICAgICAgIDEzNSwKICAgICAgICAgIDE2NywKICAgICAgICAgIDM2LAogICAgICAgICAgMCwKICAgICAgICAgIDMyLAogICAgICAgICAgNCwKICAgICAgICAgIDE2NywKICAgICAgICAgIDExCiAgICAgICAgXSkpLCB7fSkuZXhwb3J0czsKICAgICAgfSBjYXRjaCAoZSkgewogICAgICB9CiAgICAgIGZ1bmN0aW9uIExvbmc0KGxvdywgaGlnaCwgdW5zaWduZWQpIHsKICAgICAgICB0aGlzLmxvdyA9IGxvdyB8IDA7CiAgICAgICAgdGhpcy5oaWdoID0gaGlnaCB8IDA7CiAgICAgICAgdGhpcy51bnNpZ25lZCA9ICEhdW5zaWduZWQ7CiAgICAgIH0KICAgICAgTG9uZzQucHJvdG90eXBlLl9faXNMb25nX187CiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShMb25nNC5wcm90b3R5cGUsICJfX2lzTG9uZ19fIiwgeyB2YWx1ZTogdHJ1ZSB9KTsKICAgICAgZnVuY3Rpb24gaXNMb25nKG9iaikgewogICAgICAgIHJldHVybiAob2JqICYmIG9ialsiX19pc0xvbmdfXyJdKSA9PT0gdHJ1ZTsKICAgICAgfQogICAgICBMb25nNC5pc0xvbmcgPSBpc0xvbmc7CiAgICAgIHZhciBJTlRfQ0FDSEUgPSB7fTsKICAgICAgdmFyIFVJTlRfQ0FDSEUgPSB7fTsKICAgICAgZnVuY3Rpb24gZnJvbUludCh2YWx1ZSwgdW5zaWduZWQpIHsKICAgICAgICB2YXIgb2JqLCBjYWNoZWRPYmosIGNhY2hlOwogICAgICAgIGlmICh1bnNpZ25lZCkgewogICAgICAgICAgdmFsdWUgPj4+PSAwOwogICAgICAgICAgaWYgKGNhY2hlID0gMCA8PSB2YWx1ZSAmJiB2YWx1ZSA8IDI1NikgewogICAgICAgICAgICBjYWNoZWRPYmogPSBVSU5UX0NBQ0hFW3ZhbHVlXTsKICAgICAgICAgICAgaWYgKGNhY2hlZE9iaikKICAgICAgICAgICAgICByZXR1cm4gY2FjaGVkT2JqOwogICAgICAgICAgfQogICAgICAgICAgb2JqID0gZnJvbUJpdHModmFsdWUsICh2YWx1ZSB8IDApIDwgMCA/IC0xIDogMCwgdHJ1ZSk7CiAgICAgICAgICBpZiAoY2FjaGUpCiAgICAgICAgICAgIFVJTlRfQ0FDSEVbdmFsdWVdID0gb2JqOwogICAgICAgICAgcmV0dXJuIG9iajsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdmFsdWUgfD0gMDsKICAgICAgICAgIGlmIChjYWNoZSA9IC0xMjggPD0gdmFsdWUgJiYgdmFsdWUgPCAxMjgpIHsKICAgICAgICAgICAgY2FjaGVkT2JqID0gSU5UX0NBQ0hFW3ZhbHVlXTsKICAgICAgICAgICAgaWYgKGNhY2hlZE9iaikKICAgICAgICAgICAgICByZXR1cm4gY2FjaGVkT2JqOwogICAgICAgICAgfQogICAgICAgICAgb2JqID0gZnJvbUJpdHModmFsdWUsIHZhbHVlIDwgMCA/IC0xIDogMCwgZmFsc2UpOwogICAgICAgICAgaWYgKGNhY2hlKQogICAgICAgICAgICBJTlRfQ0FDSEVbdmFsdWVdID0gb2JqOwogICAgICAgICAgcmV0dXJuIG9iajsKICAgICAgICB9CiAgICAgIH0KICAgICAgTG9uZzQuZnJvbUludCA9IGZyb21JbnQ7CiAgICAgIGZ1bmN0aW9uIGZyb21OdW1iZXIodmFsdWUsIHVuc2lnbmVkKSB7CiAgICAgICAgaWYgKGlzTmFOKHZhbHVlKSkKICAgICAgICAgIHJldHVybiB1bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICBpZiAodW5zaWduZWQpIHsKICAgICAgICAgIGlmICh2YWx1ZSA8IDApCiAgICAgICAgICAgIHJldHVybiBVWkVSTzsKICAgICAgICAgIGlmICh2YWx1ZSA+PSBUV09fUFdSXzY0X0RCTCkKICAgICAgICAgICAgcmV0dXJuIE1BWF9VTlNJR05FRF9WQUxVRTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgaWYgKHZhbHVlIDw9IC1UV09fUFdSXzYzX0RCTCkKICAgICAgICAgICAgcmV0dXJuIE1JTl9WQUxVRTsKICAgICAgICAgIGlmICh2YWx1ZSArIDEgPj0gVFdPX1BXUl82M19EQkwpCiAgICAgICAgICAgIHJldHVybiBNQVhfVkFMVUU7CiAgICAgICAgfQogICAgICAgIGlmICh2YWx1ZSA8IDApCiAgICAgICAgICByZXR1cm4gZnJvbU51bWJlcigtdmFsdWUsIHVuc2lnbmVkKS5uZWcoKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModmFsdWUgJSBUV09fUFdSXzMyX0RCTCB8IDAsIHZhbHVlIC8gVFdPX1BXUl8zMl9EQkwgfCAwLCB1bnNpZ25lZCk7CiAgICAgIH0KICAgICAgTG9uZzQuZnJvbU51bWJlciA9IGZyb21OdW1iZXI7CiAgICAgIGZ1bmN0aW9uIGZyb21CaXRzKGxvd0JpdHMsIGhpZ2hCaXRzLCB1bnNpZ25lZCkgewogICAgICAgIHJldHVybiBuZXcgTG9uZzQobG93Qml0cywgaGlnaEJpdHMsIHVuc2lnbmVkKTsKICAgICAgfQogICAgICBMb25nNC5mcm9tQml0cyA9IGZyb21CaXRzOwogICAgICB2YXIgcG93X2RibCA9IE1hdGgucG93OwogICAgICBmdW5jdGlvbiBmcm9tU3RyaW5nKHN0ciwgdW5zaWduZWQsIHJhZGl4KSB7CiAgICAgICAgaWYgKHN0ci5sZW5ndGggPT09IDApCiAgICAgICAgICB0aHJvdyBFcnJvcigiZW1wdHkgc3RyaW5nIik7CiAgICAgICAgaWYgKHN0ciA9PT0gIk5hTiIgfHwgc3RyID09PSAiSW5maW5pdHkiIHx8IHN0ciA9PT0gIitJbmZpbml0eSIgfHwgc3RyID09PSAiLUluZmluaXR5IikKICAgICAgICAgIHJldHVybiBaRVJPOwogICAgICAgIGlmICh0eXBlb2YgdW5zaWduZWQgPT09ICJudW1iZXIiKSB7CiAgICAgICAgICByYWRpeCA9IHVuc2lnbmVkLCB1bnNpZ25lZCA9IGZhbHNlOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICB1bnNpZ25lZCA9ICEhdW5zaWduZWQ7CiAgICAgICAgfQogICAgICAgIHJhZGl4ID0gcmFkaXggfHwgMTA7CiAgICAgICAgaWYgKHJhZGl4IDwgMiB8fCAzNiA8IHJhZGl4KQogICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcigicmFkaXgiKTsKICAgICAgICB2YXIgcDsKICAgICAgICBpZiAoKHAgPSBzdHIuaW5kZXhPZigiLSIpKSA+IDApCiAgICAgICAgICB0aHJvdyBFcnJvcigiaW50ZXJpb3IgaHlwaGVuIik7CiAgICAgICAgZWxzZSBpZiAocCA9PT0gMCkgewogICAgICAgICAgcmV0dXJuIGZyb21TdHJpbmcoc3RyLnN1YnN0cmluZygxKSwgdW5zaWduZWQsIHJhZGl4KS5uZWcoKTsKICAgICAgICB9CiAgICAgICAgdmFyIHJhZGl4VG9Qb3dlciA9IGZyb21OdW1iZXIocG93X2RibChyYWRpeCwgOCkpOwogICAgICAgIHZhciByZXN1bHQgPSBaRVJPOwogICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSArPSA4KSB7CiAgICAgICAgICB2YXIgc2l6ZSA9IE1hdGgubWluKDgsIHN0ci5sZW5ndGggLSBpKSwgdmFsdWUgPSBwYXJzZUludChzdHIuc3Vic3RyaW5nKGksIGkgKyBzaXplKSwgcmFkaXgpOwogICAgICAgICAgaWYgKHNpemUgPCA4KSB7CiAgICAgICAgICAgIHZhciBwb3dlciA9IGZyb21OdW1iZXIocG93X2RibChyYWRpeCwgc2l6ZSkpOwogICAgICAgICAgICByZXN1bHQgPSByZXN1bHQubXVsKHBvd2VyKS5hZGQoZnJvbU51bWJlcih2YWx1ZSkpOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcmVzdWx0ID0gcmVzdWx0Lm11bChyYWRpeFRvUG93ZXIpOwogICAgICAgICAgICByZXN1bHQgPSByZXN1bHQuYWRkKGZyb21OdW1iZXIodmFsdWUpKTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmVzdWx0LnVuc2lnbmVkID0gdW5zaWduZWQ7CiAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgfQogICAgICBMb25nNC5mcm9tU3RyaW5nID0gZnJvbVN0cmluZzsKICAgICAgZnVuY3Rpb24gZnJvbVZhbHVlKHZhbCwgdW5zaWduZWQpIHsKICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gIm51bWJlciIpCiAgICAgICAgICByZXR1cm4gZnJvbU51bWJlcih2YWwsIHVuc2lnbmVkKTsKICAgICAgICBpZiAodHlwZW9mIHZhbCA9PT0gInN0cmluZyIpCiAgICAgICAgICByZXR1cm4gZnJvbVN0cmluZyh2YWwsIHVuc2lnbmVkKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModmFsLmxvdywgdmFsLmhpZ2gsIHR5cGVvZiB1bnNpZ25lZCA9PT0gImJvb2xlYW4iID8gdW5zaWduZWQgOiB2YWwudW5zaWduZWQpOwogICAgICB9CiAgICAgIExvbmc0LmZyb21WYWx1ZSA9IGZyb21WYWx1ZTsKICAgICAgdmFyIFRXT19QV1JfMTZfREJMID0gMSA8PCAxNjsKICAgICAgdmFyIFRXT19QV1JfMjRfREJMID0gMSA8PCAyNDsKICAgICAgdmFyIFRXT19QV1JfMzJfREJMID0gVFdPX1BXUl8xNl9EQkwgKiBUV09fUFdSXzE2X0RCTDsKICAgICAgdmFyIFRXT19QV1JfNjRfREJMID0gVFdPX1BXUl8zMl9EQkwgKiBUV09fUFdSXzMyX0RCTDsKICAgICAgdmFyIFRXT19QV1JfNjNfREJMID0gVFdPX1BXUl82NF9EQkwgLyAyOwogICAgICB2YXIgVFdPX1BXUl8yNCA9IGZyb21JbnQoVFdPX1BXUl8yNF9EQkwpOwogICAgICB2YXIgWkVSTyA9IGZyb21JbnQoMCk7CiAgICAgIExvbmc0LlpFUk8gPSBaRVJPOwogICAgICB2YXIgVVpFUk8gPSBmcm9tSW50KDAsIHRydWUpOwogICAg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ogICAgICAgIHJldHVybiB0aGlzLmhpZ2ggKiBUV09fUFdSXzMyX0RCTCArICh0aGlzLmxvdyA+Pj4gMCk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9TdHJpbmcgPSBmdW5jdGlvbiB0b1N0cmluZyhyYWRpeCkgewogICAgICAgIHJhZGl4ID0gcmFkaXggfHwgMTA7CiAgICAgICAgaWYgKHJhZGl4IDwgMiB8fCAzNiA8IHJhZGl4KQogICAgICAgICAgdGhyb3cgUmFuZ2VFcnJvcigicmFkaXgiKTsKICAgICAgICBpZiAodGhpcy5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiAiMCI7CiAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKSB7CiAgICAgICAgICBpZiAodGhpcy5lcShNSU5fVkFMVUUpKSB7CiAgICAgICAgICAgIHZhciByYWRpeExvbmcgPSBmcm9tTnVtYmVyKHJhZGl4KSwgZGl2ID0gdGhpcy5kaXYocmFkaXhMb25nKSwgcmVtMSA9IGRpdi5tdWwocmFkaXhMb25nKS5zdWIodGhpcyk7CiAgICAgICAgICAgIHJldHVybiBkaXYudG9TdHJpbmcocmFkaXgpICsgcmVtMS50b0ludCgpLnRvU3RyaW5nKHJhZGl4KTsKICAgICAgICAgIH0gZWxzZQogICAgICAgICAgICByZXR1cm4gIi0iICsgdGhpcy5uZWcoKS50b1N0cmluZyhyYWRpeCk7CiAgICAgICAgfQogICAgICAgIHZhciByYWRpeFRvUG93ZXIgPSBmcm9tTnVtYmVyKHBvd19kYmwocmFkaXgsIDYpLCB0aGlzLnVuc2lnbmVkKSwgcmVtID0gdGhpczsKICAgICAgICB2YXIgcmVzdWx0ID0gIiI7CiAgICAgICAgd2hpbGUgKHRydWUpIHsKICAgICAgICAgIHZhciByZW1EaXYgPSByZW0uZGl2KHJhZGl4VG9Qb3dlciksIGludHZhbCA9IHJlbS5zdWIocmVtRGl2Lm11bChyYWRpeFRvUG93ZXIpKS50b0ludCgpID4+PiAwLCBkaWdpdHMgPSBpbnR2YWwudG9TdHJpbmcocmFkaXgpOwogICAgICAgICAgcmVtID0gcmVtRGl2OwogICAgICAgICAgaWYgKHJlbS5pc1plcm8oKSkKICAgICAgICAgICAgcmV0dXJuIGRpZ2l0cyArIHJlc3VsdDsKICAgICAgICAgIGVsc2UgewogICAgICAgICAgICB3aGlsZSAoZGlnaXRzLmxlbmd0aCA8IDYpCiAgICAgICAgICAgICAgZGlnaXRzID0gIjAiICsgZGlnaXRzOwogICAgICAgICAgICByZXN1bHQgPSAiIiArIGRpZ2l0cyArIHJlc3VsdDsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0SGlnaEJpdHMgPSBmdW5jdGlvbiBnZXRIaWdoQml0cygpIHsKICAgICAgICByZXR1cm4gdGhpcy5oaWdoOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmdldEhpZ2hCaXRzVW5zaWduZWQgPSBmdW5jdGlvbiBnZXRIaWdoQml0c1Vuc2lnbmVkKCkgewogICAgICAgIHJldHVybiB0aGlzLmhpZ2ggPj4+IDA7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0TG93Qml0cyA9IGZ1bmN0aW9uIGdldExvd0JpdHMoKSB7CiAgICAgICAgcmV0dXJuIHRoaXMubG93OwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmdldExvd0JpdHNVbnNpZ25lZCA9IGZ1bmN0aW9uIGdldExvd0JpdHNVbnNpZ25lZCgpIHsKICAgICAgICByZXR1cm4gdGhpcy5sb3cgPj4+IDA7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZ2V0TnVtQml0c0FicyA9IGZ1bmN0aW9uIGdldE51bUJpdHNBYnMoKSB7CiAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgcmV0dXJuIHRoaXMuZXEoTUlOX1ZBTFVFKSA/IDY0IDogdGhpcy5uZWcoKS5nZXROdW1CaXRzQWJzKCk7CiAgICAgICAgdmFyIHZhbCA9IHRoaXMuaGlnaCAhPSAwID8gdGhpcy5oaWdoIDogdGhpcy5sb3c7CiAgICAgICAgZm9yICh2YXIgYml0ID0gMzE7IGJpdCA+IDA7IGJpdC0tKQogICAgICAgICAgaWYgKCh2YWwgJiAxIDw8IGJpdCkgIT0gMCkKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgcmV0dXJuIHRoaXMuaGlnaCAhPSAwID8gYml0ICsgMzMgOiBiaXQgKyAxOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzWmVybyA9IGZ1bmN0aW9uIGlzWmVybygpIHsKICAgICAgICByZXR1cm4gdGhpcy5oaWdoID09PSAwICYmIHRoaXMubG93ID09PSAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmVxeiA9IExvbmdQcm90b3R5cGUuaXNaZXJvOwogICAgICBMb25nUHJvdG90eXBlLmlzTmVnYXRpdmUgPSBmdW5jdGlvbiBpc05lZ2F0aXZlKCkgewogICAgICAgIHJldHVybiAhdGhpcy51bnNpZ25lZCAmJiB0aGlzLmhpZ2ggPCAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzUG9zaXRpdmUgPSBmdW5jdGlvbiBpc1Bvc2l0aXZlKCkgewogICAgICAgIHJldHVybiB0aGlzLnVuc2lnbmVkIHx8IHRoaXMuaGlnaCA+PSAwOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzT2RkID0gZnVuY3Rpb24gaXNPZGQoKSB7CiAgICAgICAgcmV0dXJuICh0aGlzLmxvdyAmIDEpID09PSAxOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmlzRXZlbiA9IGZ1bmN0aW9uIGlzRXZlbigpIHsKICAgICAgICByZXR1cm4gKHRoaXMubG93ICYgMSkgPT09IDA7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUuZXF1YWxzID0gZnVuY3Rpb24gZX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GlwbGllcikpCiAgICAgICAgICBtdWx0aXBsaWVyID0gZnJvbVZhbHVlKG11bHRpcGxpZXIpOwogICAgICAgIGlmICh3YXNtKSB7CiAgICAgICAgICB2YXIgbG93ID0gd2FzbS5tdWwodGhpcy5sb3csIHRoaXMuaGlnaCwgbXVsdGlwbGllci5sb3csIG11bHRpcGxpZXIuaGlnaCk7CiAgICAgICAgICByZXR1cm4gZnJvbUJpdHMobG93LCB3YXNtLmdldF9oaWdoKCksIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgICBpZiAobXVsdGlwbGllci5pc1plcm8oKSkKICAgICAgICAgIHJldHVybiBaRVJPOwogICAgICAgIGlmICh0aGlzLmVxKE1JTl9WQUxVRSkpCiAgICAgICAgICByZXR1cm4gbXVsdGlwbGllci5pc09kZCgpID8gTUlOX1ZBTFVFIDogWkVSTzsKICAgICAgICBpZiAobXVsdGlwbGllci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgcmV0dXJuIHRoaXMuaXNPZGQoKSA/IE1JTl9WQUxVRSA6IFpFUk87CiAgICAgICAgaWYgKHRoaXMuaXNOZWdhdGl2ZSgpKSB7CiAgICAgICAgICBpZiAobXVsdGlwbGllci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICAgIHJldHVybiB0aGlzLm5lZygpLm11bChtdWx0aXBsaWVyLm5lZygpKTsKICAgICAgICAgIGVsc2UKICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkubXVsKG11bHRpcGxpZXIpLm5lZygpOwogICAgICAgIH0gZWxzZSBpZiAobXVsdGlwbGllci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICByZXR1cm4gdGhpcy5tdWwobXVsdGlwbGllci5uZWcoKSkubmVnKCk7CiAgICAgICAgaWYgKHRoaXMubHQoVFdPX1BXUl8yNCkgJiYgbXVsdGlwbGllci5sdChUV09fUFdSXzI0KSkKICAgICAgICAgIHJldHVybiBmcm9tTnVtYmVyKHRoaXMudG9OdW1iZXIoKSAqI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gOiBaRVJPOwogICAgICAgIHZhciBhcHByb3gsIHJlbSwgcmVzOwogICAgICAgIGlmICghdGhpcy51bnNpZ25lZCkgewogICAgICAgICAgaWYgKHRoaXMuZXEoTUlOX1ZBTFVFKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5lcShPTkUpIHx8IGRpdmlzb3IuZXEoTkVHX09ORSkpCiAgICAgICAgICAgICAgcmV0dXJuIE1JTl9WQUxVRTsKICAgICAgICAgICAgZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICAgIHJldHVybiBPTkU7CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgIHZhciBoYWxmVGhpcyA9IHRoaXMuc2hyKDEpOwogICAgICAgICAgICAgIGFwcHJveCA9IGhhbGZUaGlzLmRpdihkaXZpc29yKS5zaGwoMSk7CiAgICAgICAgICAgICAgaWYgKGFwcHJveC5lcShaRVJPKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGRpdmlzb3IuaXNOZWdhdGl2ZSgpID8gT05FIDogTkVHX09ORTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcmVtID0gdGhpcy5zdWIoZGl2aXNvci5tdWwoYXBwcm94KSk7CiAgICAgICAgICAgICAgICByZXMgPSBhcHByb3guYWRkKHJlbS5kaXYoZGl2aXNvcikpOwogICAgICAgICAgICAgICAgcmV0dXJuIHJlczsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoZGl2aXNvci5lcShNSU5fVkFMVUUpKQogICAgICAgICAgICByZXR1cm4gdGhpcy51bnNpZ25lZCA/IFVaRVJPIDogWkVSTzsKICAgICAgICAgIGlmICh0aGlzLmlzTmVnYXRpdmUoKSkgewogICAgICAgICAgICBpZiAoZGl2aXNvci5pc05lZ2F0aXZlKCkpCiAgICAgICAgICAgICAgcmV0dXJuIHRoaXMubmVnKCkuZGl2KGRpdmlzb3IubmVnKCkpOwogICAgICAgICAgICByZXR1cm4gdGhpcy5uZWcoKS5kaXYoZGl2aXNvcikubmVnKCk7CiAgICAgICAgICB9IGVsc2UgaWYgKGRpdmlzb3IuaXNOZWdhdGl2ZSgpKQogICAgICAgICAgICByZXR1cm4gdGhpcy5kaXYoZGl2aXNvci5uZWcoKSkubmVnKCk7CiAgICAgICAgICByZXMgPSBaRVJPOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAoIWRpdmlzb3IudW5zaWduZWQpCiAgICAgICAgICAgIGRpdmlzb3IgPSBkaXZpc29yLnRvVW5zaWduZWQoKTsKICAgICAgICAgIGlmIChkaXZpc29yLmd0KHRoaXMpKQogICAgICAgICAgICByZXR1cm4gVVpFUk87CiAgICAgICAgICBpZiAoZGl2aXNvci5ndCh0aGlzLnNocnUoMSkpKQogICAgICAgICAgICByZXR1cm4gVU9ORTsKICAgICAgICAgIHJlcyA9IFVaRVJPOwogICAgICAgIH0KICAgICAgICByZW0gPSB0aGlzOwogICAgICAgIHdoaWxlIChyZW0uZ3RlKGRpdmlzb3IpKSB7CiAgICAgICAgICBhcHByb3ggPSBNYXRoLm1heCgxLCBNYXRoLmZsb29yKHJlbS50b051bWJlcigpIC8gZGl2aXNvci50b051bWJlcigpKSk7CiAgICAgICAgICB2YXIgbG9nMiA9IE1hdGguY2VpbChNYXRoLmxvZyhhcHByb3gpIC8gTWF0aC5MTjIpLCBkZWx0YSA9IGxvZzIgPD0gNDggPyAxIDogcG93X2RibCgyLCBsb2cyIC0gNDgpLCBhcHByb3hSZXMgPSBmcm9tTnVtYmVyKGFwcHJveCksIGFwcHJveFJlbSA9IGFwcHJveFJlcy5tdWwoZGl2aXNvcik7CiAgICAgICAgICB3aGlsZSAoYXBwcm94UmVtLmlzTmVnYXRpdmUoKSB8fCBhcHByb3hSZW0uZ3QocmVtKSkgewogICAgICAgICAgICBhcHByb3ggLT0gZGVsdGE7CiAgICAgICAgICAgIGFwcHJveFJlcyA9IGZyb21OdW1iZXIoYXBwcm94LCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICAgICAgYXBwcm94UmVtID0gYXBwcm94UmVzLm11bChkaXZpc29yKTsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChhcHByb3hSZXMuaXNaZXJvKCkpCiAgICAgICAgICAgIGFwcHJveFJlcyA9IE9ORTsKICAgICAgICAgIHJlcyA9IHJlcy5hZGQoYXBwcm94UmVzKTsKICAgICAgICAgIHJlbSA9IHJlbS5zdWIoYXBwcm94UmVtKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlczsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5kaXYgPSBMb25nUHJvdG90eXBlLmRpdmlkZTsKICAgICAgTG9uZ1Byb3RvdHlwZS5tb2R1bG8gPSBmdW5jdGlvbiBtb2R1bG8oZGl2aXNvcikgewogICAgICAgIGlmICghaXNMb25nKGRpdmlzb3IpKQogICAgICAgICAgZGl2aXNvciA9IGZyb21WYWx1ZShkaXZpc29yKTsKICAgICAgICBpZiAod2FzbSkgewogICAgICAgICAgdmFyIGxvdyA9ICh0aGlzLnVuc2lnbmVkID8gd2FzbS5yZW1fdSA6IHdhc20ucmVtX3MpKHRoaXMubG93LCB0aGlzLmhpZ2gsIGRpdmlzb3IubG93LCBkaXZpc29yLmhpZ2gpOwogICAgICAgICAgcmV0dXJuIGZyb21CaXRzKGxvdywgd2FzbS5nZXRfaGlnaCgpLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHRoaXMuc3ViKHRoaXMuZGl2KGRpdmlzb3IpLm11bChkaXZpc29yKSk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUubW9kID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUucmVtID0gTG9uZ1Byb3RvdHlwZS5tb2R1bG87CiAgICAgIExvbmdQcm90b3R5cGUubm90ID0gZnVuY3Rpb24gbm90KCkgewogICAgICAgIHJldHVybiBmcm9tQml0cyh+dGhpcy5sb3csIH50aGlzLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLmFuZCA9IGZ1bmN0aW9uIGFuZChvdGhlcikgewogICAgICAgIGlmICghaXNMb25nKG90aGVyKSkKICAgICAgICAgIG90aGVyID0gZnJvbVZhbHVlKG90aGVyKTsKICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3cgJiBvdGhlci5sb3csIHRoaXMuaGlnaCAmIG90aGVyLmhpZ2gsIHRoaXMudW5zaWduZWQpOwogICAgICB9OwogICAgICBMb25nUHJvdG90eXBlLm9yID0gZnVuY3Rpb24gb3Iob3RoZXIpIHsKICAgICAgICBpZiAoIWlzTG9uZyhvdGhlcikpCiAgICAgICAgICBvdGhlciA9IGZyb21WYWx1ZShvdGhlcik7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IHwgb3RoZXIubG93LCB0aGlzLmhpZ2ggfCBvdGhlci5oaWdoLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS54b3IgPSBmdW5jdGlvbiB4b3Iob3RoZXIpIHsKICAgICAgICBpZiAoIWlzTG9uZyhvdGhlcikpCiAgICAgICAgICBvdGhlciA9IGZyb21WYWx1ZShvdGhlcik7CiAgICAgICAgcmV0dXJuIGZyb21CaXRzKHRoaXMubG93IF4gb3RoZXIubG93LCB0aGlzLmhpZ2ggXiBvdGhlci5oaWdoLCB0aGlzLnVuc2lnbmVkKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaGlmdExlZnQgPSBmdW5jdGlvbiBzaGlmdExlZnQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIGlmICgobnVtQml0cyAmPSA2MykgPT09IDApCiAgICAgICAgICByZ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WQgPSBmdW5jdGlvbiBzaGlmdFJpZ2h0VW5zaWduZWQobnVtQml0cykgewogICAgICAgIGlmIChpc0xvbmcobnVtQml0cykpCiAgICAgICAgICBudW1CaXRzID0gbnVtQml0cy50b0ludCgpOwogICAgICAgIG51bUJpdHMgJj0gNjM7CiAgICAgICAgaWYgKG51bUJpdHMgPT09IDApCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICBlbHNlIHsKICAgICAgICAgIHZhciBoaWdoID0gdGhpcy5oaWdoOwogICAgICAgICAgaWYgKG51bUJpdHMgPCAzMikgewogICAgICAgICAgICB2YXIgbG93ID0gdGhpcy5sb3c7CiAgICAgICAgICAgIHJldHVybiBmcm9tQml0cyhsb3cgPj4+IG51bUJpdHMgfCBoaWdoIDw8IDMyIC0gbnVtQml0cywgaGlnaCA+Pj4gbnVtQml0cywgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgICB9IGVsc2UgaWYgKG51bUJpdHMgPT09IDMyKQogICAgICAgICAgICByZXR1cm4gZnJvbUJpdHMoaGlnaCwgMCwgdGhpcy51bnNpZ25lZCk7CiAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHJldHVybiBmcm9tQml0cyhoaWdoID4+PiBudW1CaXRzIC0gMzIsIDAsIHRoaXMudW5zaWduZWQpOwogICAgICAgIH0KICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS5zaHJ1ID0gTG9uZ1Byb3RvdHlwZS5zaGlmdFJpZ2h0VW5zaWduZWQ7CiAgICAgIExvbmdQcm90b3R5cGUuc2hyX3UgPSBMb25nUHJvdG90eXBlLnNoaWZ0UmlnaHRVbnNpZ25lZDsKICAgICAgTG9uZ1Byb3RvdHlwZS50b1NpZ25lZCA9IGZ1bmN0aW9uIHRvU2lnbmVkKCkgewogICAgICAgIGlmICghdGhpcy51bnNpZ25lZCkKICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIHJldHVybiBmcm9tQml0cyh0aGlzLmxvdywgdGhpcy5oaWdoLCBmYWxzZSk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9VbnNpZ25lZCA9IGZ1bmN0aW9uIHRvVW5zaWduZWQoKSB7CiAgICAgICAgaWYgKHRoaXMudW5zaWduZWQpCiAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICByZXR1cm4gZnJvbUJpdHModGhpcy5sb3csIHRoaXMuaGlnaCwgdHJ1ZSk7CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9CeXRlcyA9IGZ1bmN0aW9uIHRvQnl0ZXMobGUpIHsKICAgICAgICByZXR1cm4gbGUgPyB0aGlzLnRvQnl0ZXNMRSgpIDogdGhpcy50b0J5dGVzQkUoKTsKICAgICAgfTsKICAgICAgTG9uZ1Byb3RvdHlwZS50b0J5dGVzTEUgPSBmdW5jdGlvbiB0b0J5dGVzTEUoKSB7CiAgICAgICAgdmFyIGhpID0gdGhpcy5oaWdoLCBsbyA9IHRoaXMubG93OwogICAgICAgIHJldHVybiBbCiAgICAgICAgICBsbyAmIDI1NSwKICAgICAgICAgIGxvID4+PiA4ICYgMjU1LAogICAgICAgICAgbG8gPj4+IDE2ICYgMjU1LAogICAgICAgICAgbG8gPj4+IDI0LAogICAgICAgICAgaGkgJiAyNTUsCiAgICAgICAgICBoaSA+Pj4gOCAmIDI1NSwKICAgICAgICAgIGhpID4+PiAxNiAmIDI1NSwKICAgICAgICAgIGhpID4+PiAyNAogICAgICAgIF07CiAgICAgIH07CiAgICAgIExvbmdQcm90b3R5cGUudG9CeXRlc0JFID0gZnVuY3Rpb24gdG9CeXRlc0JFKCkgewogICAgICAgIHZhciBoaSA9IHRoaXMuaGlnaCwgbG8gPSB0aGlzLmxvdzsKICAgICAgICByZXR1cm4gWwogICAgICAgICAgaGkgPj4+IDI0LAogICAgICAgICAgaGkgPj4+IDE2ICYgMjU1LAogICAgICAgICAgaGkgPj4+IDggJiAyNTUsCiAgICAgICAgICBoaSAmIDI1NSwKICAgICAgICAgIGxvID4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dlLm1lc3NhZ2UpLCB7CiAgICAgICAgICAgIG5hbWU6IG1lc3NhZ2UubmFtZSwKICAgICAgICAgICAgc3RhY2s6IG1lc3NhZ2Uuc3RhY2sKICAgICAgICAgIH0pOwogICAgICAgIH0sCiAgICAgICAgc2VyaWFsaXplKGVycm9yKSB7CiAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICBfX2Vycm9yX21hcmtlcjogIiQkZXJyb3IiLAogICAgICAgICAgICBtZXNzYWdlOiBlcnJvci5tZXNzYWdlLAogICAgICAgICAgICBuYW1lOiBlcnJvci5uYW1lLAogICAgICAgICAgICBzdGFjazogZXJyb3Iuc3RhY2sKICAgICAgICAgIH07CiAgICAgICAgfQogICAgICB9OwogICAgICB2YXIgaXNTZXJpYWxpemVkRXJyb3IgPSAodGhpbmcpID0+IHRoaW5nICYmIHR5cGVvZiB0aGluZyA9PT0gIm9iamVjdCIgJiYgIl9fZXJyb3JfbWFya2VyIiBpbiB0aGluZyAmJiB0aGluZy5fX2Vycm9yX21hcmtlciA9PT0gIiQkZXJyb3IiOwogICAgICBleHBvcnRzMi5EZWZhdWx0U2VyaWFsaXplciA9IHsKICAgICAgICBkZXNlcmlhbGl6ZShtZXNzYWdlKSB7CiAgICAgICAgICBpZiAoaXNTZXJpYWxpemVkRXJyb3IobWVzc2FnZSkpIHsKICAgICAgICAgICAgcmV0dXJuIERlZmF1bHRFcnJvclNlcmlhbGl6ZXIuZGVzZXJpYWxpemUobWVzc2FnZSk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gbWVzc2FnZTsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIHNlcmlhbGl6ZShpbnB1dCkgewogICAgICAgICAgaWYgKGlucHV0IGluc3RhbmNlb2YgRXJyb3IpIHsKICAgICAgICAgICAgcmV0dXJuIERlZmF1bHRFcnJvclNlcmlhbGl6ZXIuc2VyaWFsaXplKGlucHV0KTsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAg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x1ZSkgewogICAgICAgICAgcmV0dXJuIHZhbHVlIGluc3RhbmNlb2YgUCA/IHZhbHVlIDogbmV3IFAoZnVuY3Rpb24ocmVzb2x2ZSkgewogICAgICAgICAgICByZXNvbHZlKHZhbHVlKTsKICAgICAgICAgIH0pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gbmV3IChQIHx8IChQID0gUHJvbWlzZSkpKGZ1bmN0aW9uKHJlc29sdmUsIHJlamVjdCkgewogICAgICAgICAgZnVuY3Rpb24gZnVsZmlsbGVkKHZhbHVlKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgcmVqZWN0KGUpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgIHN0ZXAoZ2VuZXJhdG9yWyJ0aHJvdyJdKHZhbHVlKSk7CiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICByZWplY3QoZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGZ1bmN0aW9uIHN0ZXAocmVzdWx0KSB7CiAgICAgICAgICAgIHJlc3VsdC5kb25lID8gcmVzb2x2ZShyZXN1bHQudmFsdWUpIDogYWRvcHQocmVzdWx0LnZhbHVlKS50aGVuKGZ1bGZpbGxlZCwgcmVqZWN0ZWQpOwogICAgICAgICAgfQogICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOwogICAgICAgIH0pOwogICAgICB9OwogICAgICB2YXIgX19pbXBvcnREZWZhdWx0ID0gZXhwb3J0czIgJiYgZXhwb3J0czIuX19pbXBvcnRE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WYgKGlzTWFzdGVySm9iQ2FuY2VsTWVzc2FnZShtZXNzYWdlRGF0YSkpIHsKICAgICAgICAgICAgY29uc3Qgam9iVUlEID0gbWVzc2FnZURhdGEudWlkOwogICAgICAgICAgICBjb25zdCBzdWJzY3JpcHRpb24gPSBhY3RpdmVTdWJzY3JpcHRpb25zLmdldChqb2JVSUQpOwogICAgICAgICAgICBpZiAoc3Vic2NyaXB0aW9uKSB7CiAgICAgICAgICAgICAgc3Vic2NyaXB0aW9uLnVuc3Vic2NyaWJlKCk7CiAgICAgICAgICAgICAgYWN0aXZlU3Vic2NyaXB0aW9ucy5kZWxldGUoam9iVUlEKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0pOwogICAgICB9CiAgICAgIGV4cG9ydHMyLmV4cG9zZSA9IGV4cG9zZTI7CiAgICAgIGlmICh0eXBlb2Ygc2VsZiAhPT0gInVuZGVmaW5lZCIgJiYgdHlwZW9mIHNlbGYuYWRkRXZlbnRMaXN0ZW5lciA9PT0gImZ1bmN0aW9uIiAmJiBpbXBsZW1lbnRhdGlvbl8xLmRlZmF1bHQuaXNXb3JrZXJSdW50aW1lKCkpIHsKICAgICAgICBzZWxmLmFkZEV2ZW50TGlzdGVuZXIoImVycm9yIiwgKGV2ZW50KSA9PiB7CiAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHBvc3RVbmNhdWdodEVycm9yTWVzc2FnZShldmVudC5lcnJvciB8fCBldmVudCksIDI1MCk7CiAgICAgICAgfSk7CiAgICAgICAgc2VsZi5hZGRFdmVudExpc3RlbmVyKCJ1bmhhbmRsZWRyZWplY3Rpb24iLCAoZXZlbnQpID0+IHsKICAgICAgICAgIGNvbnN0IGVycm9yID0gZXZlbnQucmVhc29uOwogICAgICAgICAgaWYgKGVycm9yICYmIHR5cGVvZiBlcnJvci5tZXNzYWdlID09PSAic3RyaW5nIikgewogICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHBvc3RVbmNhdWdodEVycm9yT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mN0aW9uKGV4cGVjdGF0aW9uKSB7CiAgICAgICAgICAgIHZhciBlc2NhcGVkUGFydHMgPSAiIiwgaTsKICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IGV4cGVjdGF0aW9uLnBhcnRzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgICAgZXNjYXBlZFBhcnRzICs9IGV4cGVjdGF0aW9uLnBhcnRzW2ldIGluc3RhbmNlb2YgQXJyYXkgPyBjbGFzc0VzY2FwZShleHBlY3RhdGlvbi5wYXJ0c1tpXVswXSkgKyAiLSIgKyBjbGFzc0VzY2FwZShleHBlY3RhdGlvbi5wYXJ0c1tpXVsxXSkgOiBjbGFzc0VzY2FwZShleHBlY3RhdGlvbi5wYXJ0c1tpXSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuICJbIiArIChleHBlY3RhdGlvbi5pbnZlcnRlZCA/ICJeIiA6ICIiKSArIGVzY2FwZWRQYXJ0cyArICJdIjsKICAgICAgICAgIH0sCiAgICAgICAgICBhbnk6IGZ1bmN0aW9uKGV4cGVjdGF0aW9uKSB7CiAgICAgICAgICAgIHJldHVybiAiYW55IGNoYXJhY3RlciI7CiAgICAgICAgICB9LAogICAgICAgICAgZW5kOiBmdW5jdGlvbihleHBlY3RhdGlvbikgewogICAgICAgICAgICByZXR1cm4gImVuZCBvZiBpbnB1dCI7CiAgICAgICAgICB9LAogICAgICAgICAgb3RoZXI6IGZ1bmN0aW9uKGV4cGVjdGF0aW9uKSB7CiAgICAgICAgICAgIHJldHVybiBleHBlY3RhdGlvbi5kZXNjcmlwdGlvbjsKICAgICAgICAgIH0KICAgICAgICB9OwogICAgICAgIGZ1bmN0aW9uIGhleChjaCkgewogICAgICAgICAgcmV0dXJuIGNoLmNoYXJDb2RlQXQoMCkudG9TdHJpbmcoMTYpLnRvVXBwZXJDYXNlKCk7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIGxpdGVyYWxFc2NhcGUocykgewogICAgICAgICAg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WFBFQ1RBVElPTl9GTlNbZXhwZWN0YXRpb24udHlwZV0oZXhwZWN0YXRpb24pOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBkZXNjcmliZUV4cGVjdGVkKGV4cGVjdGVkMikgewogICAgICAgICAgdmFyIGRlc2NyaXB0aW9ucyA9IG5ldyBBcnJheShleHBlY3RlZDIubGVuZ3RoKSwgaSwgajsKICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBleHBlY3RlZDIubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgZGVzY3JpcHRpb25zW2ldID0gZGVzY3JpYmVFeHBlY3RhdGlvbihleHBlY3RlZDJbaV0pOwogICAgICAgICAgfQogICAgICAgICAgZGVzY3JpcHRpb25zLnNvcnQoKTsKICAgICAgICAgIGlmIChkZXNjcmlwdGlvbnMubGVuZ3RoID4gMCkgewogICAgICAgICAgICBmb3IgKGkgPSAxLCBqID0gMTsgaSA8IGRlc2NyaXB0aW9ucy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgIGlmIChkZXNjcmlwdGlvbnNbaSAtIDFdICE9PSBkZXNjcmlwdGlvbnNbaV0pIHsKICAgICAgICAgICAgICAgIGRlc2NyaXB0aW9uc1tqXSA9IGRlc2NyaXB0aW9uc1tpXTsKICAgICAgICAgICAgICAgIGorKzsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZGVzY3JpcHRpb25zLmxlbmd0aCA9IGo7CiAgICAgICAgICB9CiAgICAgICAgICBzd2l0Y2ggKGRlc2NyaXB0aW9ucy5sZW5ndGgpIHsKICAgICAgICAgICAgY2FzZSAxOgogICAgICAgICAgICAgIHJldHVybiBkZXNjcmlwdGlvbnNbMF07CiAgICAgICAgICAgIGNhc2UgMjoKICAgICAgICAgICAgICByZXR1cm4gZGVzY3JpcHRpb25zWzBdICsgIiBvciAiICsgZGVzY3JpcHRpb25zWzFdOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgIHJldH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IHJldHVybiB7IHR5cGU6ICJhbnkiIH07CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRlbmRFeHBlY3RhdGlvbigpIHsKICAgICAgICAgIHJldHVybiB7IHR5cGU6ICJlbmQiIH07CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRvdGhlckV4cGVjdGF0aW9uKGRlc2NyaXB0aW9uKSB7CiAgICAgICAgICByZXR1cm4geyB0eXBlOiAib3RoZXIiLCBkZXNjcmlwdGlvbiB9OwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckY29tcHV0ZVBvc0RldGFpbHMocG9zKSB7CiAgICAgICAgICB2YXIgZGV0YWlscyA9IHBlZyRwb3NEZXRhaWxzQ2FjaGVbcG9zXSwgcDsKICAgICAgICAgIGlmIChkZXRhaWxzKSB7CiAgICAgICAgICAgIHJldHVybiBkZXRhaWxzOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcCA9IHBvcyAtIDE7CiAgICAgICAgICAgIHdoaWxlICghcGVnJHBvc0RldGFpbHNDYWNoZVtwXSkgewogICAgICAgICAgICAgIHAtLTsKICAgICAgICAgICAgfQogICAgICAgICAgICBkZXRhaWxzID0gcGVnJHBvc0RldGFpbHNDYWNoZVtwXTsKICAgICAgICAgICAgZGV0YWlscyA9IHsKICAgICAgICAgICAgICBsaW5lOiBkZXRhaWxzLmxpbmUsCiAgICAgICAgICAgICAgY29sdW1uOiBkZXRhaWxzLmNvbHVtbgogICAgICAgICAgICB9OwogICAgICAgICAgICB3aGlsZSAocCA8IHBvcykgewogICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHApID09PSAxMCkgewogICAgICAgICAgICAgICAgZGV0YWlscy5saW5lKys7CiAgICAgICAgICAgICAgICBkZXRhaWxzLmNvbHVtbiA9IDE7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGRldGFpbHMuY29sdW1uKys7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHArKzsKICAgICAgICAgICAgfQogICAgICAgICAgICBwZWckcG9zRGV0YWlsc0NhY2hlW3Bvc10gPSBkZXRhaWxzOwogICAgICAgICAgICByZXR1cm4gZGV0YWlsczsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJGNvbXB1dGVMb2NhdGlvbihzdGFydFBvcywgZW5kUG9zKSB7CiAgICAgICAgICB2YXIgc3RhcnRQb3NEZXRhaWxzID0gcGVnJGNvbXB1dGVQb3NEZXRhaWxzKHN0YXJ0UG9zKSwgZW5kUG9zRGV0YWlscyA9IHBlZyRjb21wdXRlUG9zRGV0YWlscyhlbmRQb3MpOwogICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgc3RhcnQ6IHsKICAgICAgICAgICAgICBvZmZzZXQ6IHN0YXJ0UG9zLAogICAgICAgICAgICAgIGxpbmU6IHN0YXJ0UG9zRGV0YWlscy5saW5lLAogICAgICAgICAgICAgIGNvbHVtbjogc3RhcnRQb3NEZXRhaWxzLmNvbHVtbgogICAgICAgICAgICB9LAogICAgICAgICAgICBlbmQ6IHsKICAgICAgICAgICAgICBvZmZzZXQ6IGVuZFBvcywKICAgICAgICAgICAgICBsaW5lOiBlbmRQb3NEZXRhaWxzLmxpbmUsCiAgICAgICAgICAgICAgY29sdW1uOiBlbmRQb3NEZXRhaWxzLmNvbHVtbgogICAgICAgICAgICB9CiAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckZmFpbChleHBlY3RlZDIpIHsKICAgICAgICAgIGlmIChwZWckY3VyclBvcyA8IHBlZyRtYXhGYWlsUG9zKSB7CiAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChwZWckY3VyclBvcyA+IHBlZyRtYXhGYWlsUG9zKSB7CiAgICAgICAgICAgIHBlZyRtYXhGYWlsUG9zID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICAgIHBlZyRtYXhGYWlsRXhwZWN0ZWQgPSBbXTsKICAgICAgICAgIH0KICAgICAgICAgIHBlZyRtYXhGYWlsRXhwZWN0ZWQucHVzaChleHBlY3RlZDIpOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckYnVpbGRTaW1wbGVFcnJvcihtZXNzYWdlLCBsb2NhdGlvbjIpIHsKICAgICAgICAgIHJldHVybiBuZXcgcGVnJFN5bnRheEVycm9yKG1lc3NhZ2UsIG51bGwsIG51bGwsIGxvY2F0aW9uMik7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRidWlsZFN0cnVjdHVyZWRFcnJvcihleHBlY3RlZDIsIGZvdW5kLCBsb2NhdGlvbjIpIHsKICAgICAgICAgIHJldHVybiBuZXcgcGVnJFN5bnRheEVycm9yKHBlZyRTeW50YXhFcnJvci5idWlsZE1lc3NhZ2UoZXhwZWN0ZWQyLCBmb3VuZCksIGV4cGVjdGVkMiwgZm91bmQsIGxvY2F0aW9uMik7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWRlY2xhcmF0aW9uKCkgewogICAgICAgICAgdmFyIHMwLCBzMSwgczIsIHMzLCBzNCwgczUsIHM2LCBzNywgczgsIHM5LCBzMTAsIHMxMSwgczEyLCBzMTM7CiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgczEgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczIgPSBwZWckcGFyc2VkZWNsYXJlVHlwZSgpOwogICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIHM0ID0gcGVnJHBhcnNlZGVjbGFyZU5hbWUoKTsKICAgICAgICAgICAgICAgIGlmIChzNCAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICBzNSA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICAgICAgaWYgKHM1ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgczYgPSBwZWckcGFyc2Vjb21tZW50KCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHM2ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICBzNyA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICAgICAgICAgIGlmIChzNyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDQwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgczggPSBwZWckYzA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzOCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMxKTsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHM4ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgczkgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHM5ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMTAgPSBwZWckcGFyc2VmaWVsZExpc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMTAgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczExID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczExICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA0MSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEyID0gcGVnJGMyOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEyID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMxMiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEzID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMxMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEgPSBwZWckYzQoczIsIHM0LCBzNiwgczEwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBzMDsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJHBhcnNlZGVjbGFyZVR5cGUoKSB7CiAgICAgICAgICB2YXIgczA7CiAgICAgICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCA2KSA9PT0gcGVnJGM1KSB7CiAgICAgICAgICAgIHMwID0gcGVnJGM1OwogICAgICAgICAgICBwZWckY3VyclBvcyArPSA2OwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM2KTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDYpID09PSBwZWckYzcpIHsKICAgICAgICAgICAgICBzMCA9IHBlZyRjNzsKICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSA2OwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzgpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCA1KSA9PT0gcGVnJGM5KSB7CiAgICAgICAgICAgICAgICBzMCA9IHBlZyRjOTsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zICs9IDU7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMxMCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWRlY2xhcmVOYW1lKCkgewogICAgICAgICAgdmFyIHMwLCBzMSwgczIsIHMzOwogICAgICAgICAgczAgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczAgPSBwZWckY3VyclBvczsKICAgICAgICAgICAgczEgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIHMyID0gcGVnJHBhcnNlaW5kZXhUeXBlKCk7CiAgICAgICAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICBzMSA9IFtzMSwgczJdOwogICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczAgPSBwZWckY3VyclBvczsKICAgICAgICAgICAgICBzMSA9IHBlZyRwYXJzZW5hbWUoKTsKICAgICAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDQpID09PSBwZWckYzExKSB7CiAgICAgICAgICAgICAgICAgIHMyID0gcGVnJGMxMTsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNDsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHMyID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMTIpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgczEgPSBbczEsIHMyXTsKICAgICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgICAgICAgczEgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgczIgPSBwZWckcGFyc2VpbmRleFR5cGUoKTsKICAgICAgICAgICAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgNCkgPT09IHBlZyRjMTEpIHsKICAgICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJGMxMTsKICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zICs9IDQ7CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMxMik7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgczEgPSBbczEsIHMyLCBzM107CiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHMwOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckcGFyc2VpbmRleFR5cGUoKSB7CiAgICAgICAgICB2YXIgczA7CiAgICAgICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCA3KSA9PT0gcGVnJGMxMykgewogICAgICAgICAgICBzMCA9IHBlZyRjMTM7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zICs9IDc7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzE0KTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDUpID09PSBwZWckYzE1KSB7CiAgICAgICAgICAgICAgczAgPSBwZWckYzE1OwogICAgICAgICAgICAgIHBlZyRjdXJyUG9zICs9IDU7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMTYpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBpZiAoaW5wdXQuc3Vic3RyKHBlZyRjdXJyUG9zLCA2KSA9PT0gcGVnJGMxNykgewogICAgICAgICAgICAgICAgczAgPSBwZWckYzE3OwogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNjsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzE4KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBzMDsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJHBhcnNlY29tbWVudCgpIHsKICAgICAgICAgIHZhciBzMDsKICAgICAgICAgIHMwID0gcGVnJHBhcnNlbm9uUXVvdGVkU3RyaW5nKCk7CiAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczAgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWZpZWxkTGlzdCgpIHsKICAgICAgICAgIHZhciBzMCwgczEsIHMyLCBzMywgczQsIHM1LCBzNjsKICAgICAgICAgIHMwID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICBzMSA9IHBlZyRwYXJzZWZpZWxkKCk7CiAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczIgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgIGlmIChzMiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIHMzID0gW107CiAgICAgICAgICAgICAgczQgPSBwZWckY3VyclBvczsKICAgICAgICAgICAgICBzNSA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICBpZiAoczUgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIHM2ID0gcGVnJHBhcnNlZmllbGQoKTsKICAgICAgICAgICAgICAgIGlmIChzNiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzNDsKICAgICAgICAgICAgICAgICAgczUgPSBwZWckYzE5KHMxLCBzNik7CiAgICAgICAgICAgICAgICAgIHM0ID0gczU7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHM0OwogICAgICAgICAgICAgICAgICBzNCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczQ7CiAgICAgICAgICAgICAgICBzNCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHdoaWxlIChzNCAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgczMucHVzaChzNCk7CiAgICAgICAgICAgICAgICBzNCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgICAgICAgczUgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICBpZiAoczUgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgczYgPSBwZWckcGFyc2VmaWVsZCgpOwogICAgICAgICAgICAgICAgICBpZiAoczYgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzNDsKICAgICAgICAgICAgICAgICAgICBzNSA9IHBlZyRjMTkoczEsIHM2KTsKICAgICAgICAgICAgICAgICAgICBzNCA9IHM1OwogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczQ7CiAgICAgICAgICAgICAgICAgICAgczQgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHM0OwogICAgICAgICAgICAgICAgICBzNCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgczQgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICBpZiAoczQgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMxID0gcGVnJGMyMChzMSwgczMpOwogICAgICAgICAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgfQogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHMwOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckcGFyc2Vjb21tZW50U3RhcnQoKSB7CiAgICAgICAgICB2YXIgczA7CiAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDM1KSB7CiAgICAgICAgICAgIHMwID0gcGVnJGMyMTsKICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMjIpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWludGVybmFsQ29tbWVudCgpIHsKICAgICAgICAgIHZhciBzMCwgczEsIHMyLCBzMywgczQ7CiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgczEgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczIgPSBwZWckcGFyc2Vjb21tZW50U3RhcnQoKTsKICAgICAgICAgICAgaWYgKHMyICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2Vub25RdW90ZWRTdHJpbmcoKTsKICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIHM0ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgaWYgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgIHMxID0gW3MxLCBzMiwgczMsIHM0XTsKICAgICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBzMDsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJHBhcnNlZmllbGQoKSB7CiAgICAgICAgICB2YXIgczAsIHMxLCBzMiwgczMsIHM0LCBzNSwgczYsIHM3LCBzOCwgczksIHMxMCwgczExLCBzMTIsIHMxMzsKICAgICAgICAgIHMwID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICBzMSA9IHBlZyRwYXJzZWZpZWxkVHlwZSgpOwogICAgICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIHMyID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBzMyA9IHBlZyRwYXJzZW5hbWUoKTsKICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIHM0ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgaWYgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHBlZyRjdXJyUG9zKSA9PT0gNTkpIHsKICAgICAgICAgICAgICAgICAgICBzNSA9IHBlZyRjMjM7CiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBzNSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMyNCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzNSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgIHM2ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgIGlmIChzNiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgczcgPSBwZWckcGFyc2Vjb21tZW50KCk7CiAgICAgICAgICAgICAgICAgICAgICBpZiAoczcgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgIHMxID0gcGVnJGMyNShzMSwgczMsIHM3KTsKICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgIH0KICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgICBzMSA9IHBlZyRwYXJzZWZpZWxkVHlwZSgpOwogICAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBzMiA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHBlZyRjdXJyUG9zKSA9PT0gOTEpIHsKICAgICAgICAgICAgICAgICAgczMgPSBwZWckYzI2OwogICAgICAgICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMyNyk7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICBzNCA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICAgICAgaWYgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgczUgPSBwZWckcGFyc2VmaWVsZFNpemUoKTsKICAgICAgICAgICAgICAgICAgICBpZiAoczUgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgIHM2ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgaWYgKHM2ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHBlZyRjdXJyUG9zKSA9PT0gOTMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzNyA9IHBlZyRjMjg7CiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzNyA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMyOSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzNyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIHM4ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzOCAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgczkgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczkgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEwID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczEwICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA1OSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczExID0gcGVnJGMyMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMxMSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMjQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczExICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMTIgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczEyICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMxMyA9IHBlZyRwYXJzZWNvbW1lbnQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMxMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRzYXZlZFBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMxID0gcGVnJGMzMChzMSwgczUsIHM5LCBzMTMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gczE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczAgPSBwZWckY3VyclBvczsKICAgICAgICAgICAgICBzMSA9IHBlZyRwYXJzZWZpZWxkVHlwZSgpOwogICAgICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgczIgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA0MCkgewogICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJGMwOwogICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgIHM0ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgIGlmIChzNCAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgczUgPSBwZWckcGFyc2VmaWVsZFZhbHVlcygpOwogICAgICAgICAgICAgICAgICAgICAgaWYgKHM1ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHM2ID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAoczYgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQuY2hhckNvZGVBdChwZWckY3VyclBvcykgPT09IDQxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzNyA9IHBlZyRjMjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHM3ID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHM3ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzOCA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzOCAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzOSA9IHBlZyRwYXJzZW5hbWUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHM5ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEwID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMTAgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHBlZyRjdXJyUG9zKSA9PT0gNTkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczExID0gcGVnJGMyMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMxMSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzI0KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMxMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMTIgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMTIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMTMgPSBwZWckcGFyc2Vjb21tZW50KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHMxMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRjMzEoczEsIHM1LCBzOSwgczEzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gczE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgczAgPSBwZWckcGFyc2VpbnRlcm5hbENvbW1lbnQoKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBzMDsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJHBhcnNlZmllbGRWYWx1ZXMoKSB7CiAgICAgICAgICB2YXIgczAsIHMxLCBzMiwgczMsIHM0LCBzNSwgczY7CiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgczEgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczIgPSBbXTsKICAgICAgICAgICAgczMgPSBwZWckY3VyclBvczsKICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA0NCkgewogICAgICAgICAgICAgIHM0ID0gcGVnJGMzMjsKICAgICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHM0ID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzMzKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczUgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgaWYgKHM1ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICBzNiA9IHBlZyRwYXJzZW5hbWUoKTsKICAgICAgICAgICAgICAgIGlmIChzNiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMzsKICAgICAgICAgICAgICAgICAgczQgPSBwZWckYzE5KHMxLCBzNik7CiAgICAgICAgICAgICAgICAgIHMzID0gczQ7CiAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMzOwogICAgICAgICAgICAgICAgICBzMyA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczM7CiAgICAgICAgICAgICAgICBzMyA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczM7CiAgICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHdoaWxlIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIHMyLnB1c2goczMpOwogICAgICAgICAgICAgIHMzID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSA0NCkgewogICAgICAgICAgICAgICAgczQgPSBwZWckYzMyOwogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgczQgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzMzKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgaWYgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICBzNSA9IHBlZyRwYXJzZV8oKTsKICAgICAgICAgICAgICAgIGlmIChzNSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICBzNiA9IHBlZyRwYXJzZW5hbWUoKTsKICAgICAgICAgICAgICAgICAgaWYgKHM2ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczM7CiAgICAgICAgICAgICAgICAgICAgczQgPSBwZWckYzE5KHMxLCBzNik7CiAgICAgICAgICAgICAgICAgICAgczMgPSBzNDsKICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMzOwogICAgICAgICAgICAgICAgICAgIHMzID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMzsKICAgICAgICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMzOwogICAgICAgICAgICAgICAgczMgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMDsKICAgICAgICAgICAgICBzMSA9IHBlZyRjMzQoczEsIHMyKTsKICAgICAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWZpZWxkVHlwZSgpIHsKICAgICAgICAgIHZhciBzMCwgczEsIHMyLCBzMzsKICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDMpID09PSBwZWckYzM1KSB7CiAgICAgICAgICAgIHMwID0gcGVnJGMzNTsKICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gMzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjMzYpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgNCkgPT09IHBlZyRjMzcpIHsKICAgICAgICAgICAgICBzMCA9IHBlZyRjMzc7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNDsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGMzOCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDUpID09PSBwZWckYzM5KSB7CiAgICAgICAgICAgICAgICBzMCA9IHBlZyRjMzk7CiAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSA1OwogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDYpID09PSBwZWckYzQxKSB7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJGM0MTsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNjsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNDIpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgNCkgPT09IHBlZyRjNDMpIHsKICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNDM7CiAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNDsKICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM0NCk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDUpID09PSBwZWckYzQ1KSB7CiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNDU7CiAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSA1OwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNDYpOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDUpID09PSBwZWckYzQ3KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJGM0NzsKICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNTsKICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNDgpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgNCkgPT09IHBlZyRjNDkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNDk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNDsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM1MCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDYpID09PSBwZWckYzUxKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNTE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSA2OwogICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNTIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDcpID09PSBwZWckYzUzKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJGM1MzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNTQpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgNCkgPT09IHBlZyRjNTUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNTU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM1Nik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDYpID09PSBwZWckYzU3KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNTc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyArPSA2OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNTgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdWJzdHIocGVnJGN1cnJQb3MsIDYpID09PSBwZWckYzU5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJGM1OTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gNjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNjApOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN1YnN0cihwZWckY3VyclBvcywgMykgPT09IHBlZyRjNjEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRjNjE7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgKz0gMzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM2Mik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHMwID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczEgPSBwZWckcGFyc2VkZWNsYXJlVHlwZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczIgPSBwZWckcGFyc2VfKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczMgPSBwZWckcGFyc2VkZWNsYXJlTmFtZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoczMgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNjMoczEsIHMzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZWZpZWxkU2l6ZSgpIHsKICAgICAgICAgIHZhciBzMDsKICAgICAgICAgIHMwID0gcGVnJHBhcnNlbnVtYmVyKCk7CiAgICAgICAgICBpZiAoczAgPT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczAgPSBwZWckcGFyc2VuYW1lKCk7CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZW5hbWUoKSB7CiAgICAgICAgICB2YXIgczAsIHMxLCBzMiwgczMsIHM0OwogICAgICAgICAgczAgPSBwZWckY3VyclBvczsKICAgICAgICAgIHMxID0gcGVnJGN1cnJQb3M7CiAgICAgICAgICBpZiAocGVnJGM2NC50ZXN0KGlucHV0LmNoYXJBdChwZWckY3VyclBvcykpKSB7CiAgICAgICAgICAgIHMyID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHMyID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNjUpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgczMgPSBbXTsKICAgICAgICAgICAgaWYgKHBlZyRjNjYudGVzdChpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpKSkgewogICAgICAgICAgICAgIHM0ID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHM0ID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzY3KTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgd2hpbGUgKHM0ICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczMucHVzaChzNCk7CiAgICAgICAgICAgICAgaWYgKHBlZyRjNjYudGVzdChpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpKSkgewogICAgICAgICAgICAgICAgczQgPSBpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpOwogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgczQgPSBwZWckRkFJTEVEOwogICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzY3KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHMzICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgICAgczIgPSBbczIsIHMzXTsKICAgICAgICAgICAgICBzMSA9IHMyOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczE7CiAgICAgICAgICAgICAgczEgPSBwZWckRkFJTEVEOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBwZWckY3VyclBvcyA9IHMxOwogICAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoczEgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczA7CiAgICAgICAgICAgIHMxID0gcGVnJGM2OChzMSk7CiAgICAgICAgICB9CiAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgcmV0dXJuIHMwOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckcGFyc2VxdW90ZWRTdHJpbmcoKSB7CiAgICAgICAgICB2YXIgczAsIHMxLCBzMiwgczM7CiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgaWYgKGlucHV0LmNoYXJDb2RlQXQocGVnJGN1cnJQb3MpID09PSAzNCkgewogICAgICAgICAgICBzMSA9IHBlZyRjNjk7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzcwKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIHMyID0gW107CiAgICAgICAgICAgIGlmIChwZWckYzcxLnRlc3QoaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKSkpIHsKICAgICAgICAgICAgICBzMyA9IGlucHV0LmNoYXJBdChwZWckY3VyclBvcyk7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBzMyA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM3Mik7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHdoaWxlIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIHMyLnB1c2goczMpOwogICAgICAgICAgICAgIGlmIChwZWckYzcxLnRlc3QoaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKSkpIHsKICAgICAgICAgICAgICAgIHMzID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHMzID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM3Mik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzMiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIGlmIChpbnB1dC5jaGFyQ29kZUF0KHBlZyRjdXJyUG9zKSA9PT0gMzQpIHsKICAgICAgICAgICAgICAgIHMzID0gcGVnJGM2OTsKICAgICAgICAgICAgICAgIHBlZyRjdXJyUG9zKys7CiAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHMzID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM3MCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgcGVnJHNhdmVkUG9zID0gczA7CiAgICAgICAgICAgICAgICBzMSA9IHBlZyRjNzMoczIpOwogICAgICAgICAgICAgICAgczAgPSBzMTsKICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MgPSBzMDsKICAgICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgIHMwID0gcGVnJEZBSUxFRDsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBzMDsKICAgICAgICB9CiAgICAgICAgZnVuY3Rpb24gcGVnJHBhcnNlbm9uUXVvdGVkU3RyaW5nKCkgewogICAgICAgICAgdmFyIHMwLCBzMSwgczI7CiAgICAgICAgICBzMCA9IHBlZyRjdXJyUG9zOwogICAgICAgICAgczEgPSBbXTsKICAgICAgICAgIGlmIChwZWckYzc0LnRlc3QoaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKSkpIHsKICAgICAgICAgICAgczIgPSBpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpOwogICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgczIgPSBwZWckRkFJTEVEOwogICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM3NSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzMiAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICBzMS5wdXNoKHMyKTsKICAgICAgICAgICAgaWYgKHBlZyRjNzQudGVzdChpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpKSkgewogICAgICAgICAgICAgIHMyID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHMyID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzc1KTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGlmIChzMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMDsKICAgICAgICAgICAgczEgPSBwZWckYzc2KHMxKTsKICAgICAgICAgIH0KICAgICAgICAgIHMwID0gczE7CiAgICAgICAgICByZXR1cm4gczA7CiAgICAgICAgfQogICAgICAgIGZ1bmN0aW9uIHBlZyRwYXJzZW51bWJlcigpIHsKICAgICAgICAgIHZhciBzMCwgczEsIHMyLCBzMzsKICAgICAgICAgIHBlZyRzaWxlbnRGYWlscysrOwogICAgICAgICAgczAgPSBwZWckY3VyclBvczsKICAgICAgICAgIHMxID0gcGVnJHBhcnNlXygpOwogICAgICAgICAgaWYgKHMxICE9PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIHMyID0gW107CiAgICAgICAgICAgIGlmIChwZWckYzc4LnRlc3QoaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKSkpIHsKICAgICAgICAgICAgICBzMyA9IGlucHV0LmNoYXJBdChwZWckY3VyclBvcyk7CiAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICBzMyA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM3OSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgIHdoaWxlIChzMyAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICAgICAgczIucHVzaChzMyk7CiAgICAgICAgICAgICAgICBpZiAocGVnJGM3OC50ZXN0KGlucHV0LmNoYXJBdChwZWckY3VyclBvcykpKSB7CiAgICAgICAgICAgICAgICAgIHMzID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgICAgICAgcGVnJGN1cnJQb3MrKzsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHMzID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjNzkpOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHMyID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoczIgIT09IHBlZyRGQUlMRUQpIHsKICAgICAgICAgICAgICBwZWckc2F2ZWRQb3MgPSBzMDsKICAgICAgICAgICAgICBzMSA9IHBlZyRjODAoKTsKICAgICAgICAgICAgICBzMCA9IHMxOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHBlZyRjdXJyUG9zID0gczA7CiAgICAgICAgICAgICAgczAgPSBwZWckRkFJTEVEOwogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBwZWckY3VyclBvcyA9IHMwOwogICAgICAgICAgICBzMCA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICB9CiAgICAgICAgICBwZWckc2lsZW50RmFpbHMtLTsKICAgICAgICAgIGlmIChzMCA9PT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICBzMSA9IHBlZyRGQUlMRUQ7CiAgICAgICAgICAgIGlmIChwZWckc2lsZW50RmFpbHMgPT09IDApIHsKICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzc3KTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgcmV0dXJuIHMwOwogICAgICAgIH0KICAgICAgICBmdW5jdGlvbiBwZWckcGFyc2VfKCkgewogICAgICAgICAgdmFyIHMwLCBzMTsKICAgICAgICAgIHBlZyRzaWxlbnRGYWlscysrOwogICAgICAgICAgczAgPSBbXTsKICAgICAgICAgIGlmIChwZWckYzgyLnRlc3QoaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKSkpIHsKICAgICAgICAgICAgczEgPSBpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpOwogICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgczEgPSBwZWckRkFJTEVEOwogICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgcGVnJGZhaWwocGVnJGM4Myk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHdoaWxlIChzMSAhPT0gcGVnJEZBSUxFRCkgewogICAgICAgICAgICBzMC5wdXNoKHMxKTsKICAgICAgICAgICAgaWYgKHBlZyRjODIudGVzdChpbnB1dC5jaGFyQXQocGVnJGN1cnJQb3MpKSkgewogICAgICAgICAgICAgIHMxID0gaW5wdXQuY2hhckF0KHBlZyRjdXJyUG9zKTsKICAgICAgICAgICAgICBwZWckY3VyclBvcysrOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgIHMxID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgICBpZiAocGVnJHNpbGVudEZhaWxzID09PSAwKSB7CiAgICAgICAgICAgICAgICBwZWckZmFpbChwZWckYzgzKTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIHBlZyRzaWxlbnRGYWlscy0tOwogICAgICAgICAgaWYgKHMwID09PSBwZWckRkFJTEVEKSB7CiAgICAgICAgICAgIHMxID0gcGVnJEZBSUxFRDsKICAgICAgICAgICAgaWYgKHBlZyRzaWxlbnRGYWlscyA9PT0gMCkgewogICAgICAgICAgICAgIHBlZyRmYWlsKHBlZyRjODEpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgICByZXR1cm4gczA7CiAgICAg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gICBjb25zdCBhcmdzID0gewogICAgICAgIC4uLnRoaXMuYmFzZU92ZXJyaWRlcywKICAgICAgICAuLi5vdmVycmlkZXMsCiAgICAgICAgaGVhZGVyczogewogICAgICAgICAgLi4uaGVhZGVycywKICAgICAgICAgIC4uLm92ZXJyaWRlcy5oZWFkZXJzLAogICAgICAgICAgLi4udGhpcy5iYXNlT3ZlcnJpZGVzLmhlYWRlcnMKICAgICAgICB9LAogICAgICAgIG1ldGhvZDogIkdFVCIsCiAgICAgICAgcmVkaXJlY3Q6ICJmb2xsb3ciLAogICAgICAgIG1vZGU6ICJjb3JzIiwKICAgICAgICBzaWduYWwKICAgICAgfTsKICAgICAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCB0aGlzLmZldGNoKHRoaXMudXJsLCBhcmdzKTsKICAgICAgaWYgKCFyZXNwb25zZS5vaykgewogICAgICAgIHRocm93IG5ldyBFcnJvcihgSFRUUCAke3Jlc3BvbnNlLnN0YXR1c30gJHtyZXNwb25zZS5zdGF0dXNUZXh0fSAke3RoaXMudXJsfWApOwogICAgICB9CiAgICAgIGlmIChyZXNwb25zZS5zdGF0dXMgPT09IDIwMCAmJiBwb3NpdGlvbiA9PT0gMCB8fCByZXNwb25zZS5zdGF0dXMgPT09IDIwNikgewogICAgICAgIGNvbnN0IHJlc3BvbnNlRGF0YSA9IGF3YWl0IHRoaXMuZ2V0QnVmZmVyRnJvbVJlc3BvbnNlKHJlc3BvbnNlKTsKICAgICAgICBjb25zdCBieXRlc0NvcGllZCA9IHJlc3BvbnNlRGF0YS5jb3B5KGJ1ZmZlciwgb2Zmc2V0LCAwLCBNYXRoLm1pbihsZW5ndGgsIHJlc3BvbnNlRGF0YS5sZW5ndGgpKTsKICAgICAgICBjb25zdCByZXMgPSByZXNwb25zZS5oZWFkZXJzLmdldCgiY29udGVudC1yYW5nZSIpOwogICAgICAgIGNvbnN0IHNpemVNYXRjaCA9IC9cLyhcZCspJC8uZXhlYyhyZXMgfHwgIiIpOwogICAg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uLnRoaXMuYmFzZU92ZXJyaWRlcywKICAgICAgICAuLi5vdmVycmlkZXMKICAgICAgfTsKICAgICAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCB0aGlzLmZldGNoKHRoaXMudXJsLCBhcmdzKTsKICAgICAgaWYgKCFyZXNwb25zZSkgewogICAgICAgIHRocm93IG5ldyBFcnJvcigiZ2VuZXJpYy1maWxlaGFuZGxlIGZhaWxlZCB0byBmZXRjaCIpOwogICAgICB9CiAgICAgIGlmIChyZXNwb25zZS5zdGF0dXMgIT09IDIwMCkgewogICAgICAgIHRocm93IE9iamVjdC5hc3NpZ24obmV3IEVycm9yKGBIVFRQICR7cmVzcG9uc2Uuc3RhdHVzfSBmZXRjaGluZyAke3RoaXMudXJsfWApLCB7CiAgICAgICAgICBzdGF0dXM6IHJlc3BvbnNlLnN0YXR1cwogICAgICAgIH0pOwogICAgICB9CiAgICAgIGlmIChlbmNvZGluZyA9PT0gInV0ZjgiKSB7CiAgICAgICAgcmV0dXJuIHJlc3BvbnNlLnRleHQoKTsKICAgICAgfQogICAgICBpZiAoZW5jb2RpbmcpIHsKICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYHVuc3VwcG9ydGVkIGVuY29kaW5nOiAke2VuY29kaW5nfWApOwogICAgICB9CiAgICAgIHJldHVybiB0aGlzLmdldEJ1ZmZlckZyb21SZXNwb25zZShyZXNwb25zZSk7CiAgICB9CiAgICBhc3luYyBzdGF0KCkgewogICAgICBpZiAoIXRoaXMuX3N0YXQpIHsKICAgICAgICBjb25zdCBidWYgPSBpbXBvcnRfYnVmZmVyMi5CdWZmZXIuYWxsb2NVbnNhZmUoMTApOwogICAgICAgIGF3YWl0IHRoaXMucmVhZChidWYsIDAsIDEwLCAwKTsKICAgICAgICBpZiAoIXRoaXMuX3N0YXQpIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgdW5hYmxlIHRvIGRldGVybWluZSBzaXplIG9mIGZpbGUgYXQgJHt0aGlzLnVybH1gKTsK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WZmZXJfc2hpbSgpOwogIHZhciBpbXBvcnRfYnVmZmVyNCA9IF9fdG9Nb2R1bGUocmVxdWlyZV9idWZmZXIoKSk7CiAgdmFyIGltcG9ydF9wYWtvID0gX190b01vZHVsZShyZXF1aXJlX3Bha28oKSk7CiAgYXN5bmMgZnVuY3Rpb24gdW56aXAoaW5wdXREYXRhKSB7CiAgICB0cnkgewogICAgICBsZXQgc3RybTsKICAgICAgbGV0IHBvcyA9IDA7CiAgICAgIGxldCBpID0gMDsKICAgICAgY29uc3QgY2h1bmtzID0gW107CiAgICAgIGxldCB0b3RhbFNpemUgPSAwOwogICAgICBsZXQgaW5mbGF0b3I7CiAgICAgIGRvIHsKICAgICAgICBjb25zdCByZW1haW5pbmdJbnB1dCA9IGlucHV0RGF0YS5zdWJhcnJheShwb3MpOwogICAgICAgIGluZmxhdG9yID0gbmV3IGltcG9ydF9wYWtvLkluZmxhdGUoKTsKICAgICAgICAoeyBzdHJtIH0gPSBpbmZsYXRvcik7CiAgICAgICAgaW5mbGF0b3IucHVzaChyZW1haW5pbmdJbnB1dCwgaW1wb3J0X3Bha28uWl9TWU5DX0ZMVVNIKTsKICAgICAgICBpZiAoaW5mbGF0b3IuZXJyKSB7CiAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoaW5mbGF0b3IubXNnKTsKICAgICAgICB9CiAgICAgICAgcG9zICs9IHN0cm0ubmV4dF9pbjsKICAgICAgICBjaHVua3NbaV0gPSBpbmZsYXRvci5yZXN1bHQ7CiAgICAgICAgdG90YWxTaXplICs9IGNodW5rc1tpXS5sZW5ndGg7CiAgICAgICAgaSArPSAxOwogICAgICB9IHdoaWxlIChzdHJtLmF2YWlsX2luKTsKICAgICAgY29uc3QgcmVzdWx0ID0gbmV3IFVpbnQ4QXJyYXkodG90YWxTaXplKTsKICAgICAgZm9yIChsZXQgaTIgPSAwLCBvZmZzZXQgPSAwOyBpMiA8IGNodW5rcy5sZW5ndGg7IGkyKyspIHsKICAgICAgICByZXN1bHQ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RfcGFrby5aX1NZTkNfRkxVU0gpOwogICAgICAgIGlmIChpbmZsYXRvci5lcnIpIHsKICAgICAgICAgIHRocm93IG5ldyBFcnJvcihpbmZsYXRvci5tc2cpOwogICAgICAgIH0KICAgICAgICBjb25zdCBidWZmZXIyID0gaW5mbGF0b3IucmVzdWx0OwogICAgICAgIGNodW5rcy5wdXNoKGJ1ZmZlcjIpOwogICAgICAgIGxldCBsZW4gPSBidWZmZXIyLmxlbmd0aDsKICAgICAgICBjcG9zaXRpb25zLnB1c2goY3Bvcyk7CiAgICAgICAgZHBvc2l0aW9ucy5wdXNoKGRwb3MpOwogICAgICAgIGlmIChjaHVua3MubGVuZ3RoID09PSAxICYmIG1pbnYuZGF0YVBvc2l0aW9uKSB7CiAgICAgICAgICBjaHVua3NbMF0gPSBjaHVua3NbMF0uc3ViYXJyYXkobWludi5kYXRhUG9zaXRpb24pOwogICAgICAgICAgbGVuID0gY2h1bmtzWzBdLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgY29uc3Qgb3JpZ0Nwb3MgPSBjcG9zOwogICAgICAgIGNwb3MgKz0gc3RybS5uZXh0X2luOwogICAgICAgIGRwb3MgKz0gbGVuOwogICAgICAgIGlmIChvcmlnQ3BvcyA+PSBtYXh2LmJsb2NrUG9zaXRpb24pIHsKICAgICAgICAgIGNodW5rc1tpXSA9IGNodW5rc1tpXS5zdWJhcnJheSgwLCBtYXh2LmJsb2NrUG9zaXRpb24gPT09IG1pbnYuYmxvY2tQb3NpdGlvbiA/IG1heHYuZGF0YVBvc2l0aW9uIC0gbWludi5kYXRhUG9zaXRpb24gKyAxIDogbWF4di5kYXRhUG9zaXRpb24gKyAxKTsKICAgICAgICAgIGNwb3NpdGlvbnMucHVzaChjcG9zKTsKICAgICAgICAgIGRwb3NpdGlvbnMucHVzaChkcG9zKTsKICAgICAgICAgIHRvdGFsU2l6ZSArPSBjaHVua3NbaV0ubGVuZ3RoOwogICAgICAgICAgYnJlYWs7CiAgICAgICAgfQogICA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9zaXRpb24gPCA1ZTY7CiAgfQogIGZ1bmN0aW9uIG9wdGltaXplQ2h1bmtzKGNodW5rcywgbG93ZXN0KSB7CiAgICBjb25zdCBtZXJnZWRDaHVua3MgPSBbXTsKICAgIGxldCBsYXN0Q2h1bmsgPSBudWxsOwogICAgaWYgKGNodW5rcy5sZW5ndGggPT09IDApIHsKICAgICAgcmV0dXJuIGNodW5rczsKICAgIH0KICAgIGNodW5rcy5zb3J0KGZ1bmN0aW9uKGMwLCBjMSkgewogICAgICBjb25zdCBkaWYgPSBjMC5taW52LmJsb2NrUG9zaXRpb24gLSBjMS5taW52LmJsb2NrUG9zaXRpb247CiAgICAgIGlmIChkaWYgIT09IDApIHsKICAgICAgICByZXR1cm4gZGlmOwogICAgICB9IGVsc2UgewogICAgICAgIHJldHVybiBjMC5taW52LmRhdGFQb3NpdGlvbiAtIGMxLm1pbnYuZGF0YVBvc2l0aW9uOwogICAgICB9CiAgICB9KTsKICAgIGNodW5rcy5mb3JFYWNoKChjaHVuaykgPT4gewogICAgICBpZiAoIWxvd2VzdCB8fCBjaHVuay5tYXh2LmNvbXBhcmVUbyhsb3dlc3QpID4gMCkgewogICAgICAgIGlmIChsYXN0Q2h1bmsgPT09IG51bGwpIHsKICAgICAgICAgIG1lcmdlZENodW5rcy5wdXNoKGNodW5rKTsKICAgICAgICAgIGxhc3RDaHVuayA9IGNodW5rOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBpZiAoY2FuTWVyZ2VCbG9ja3MobGFzdENodW5rLCBjaHVuaykpIHsKICAgICAgICAgICAgaWYgKGNodW5rLm1heHYuY29tcGFyZVRvKGxhc3RDaHVuay5tYXh2KSA+IDApIHsKICAgICAgICAgICAgICBsYXN0Q2h1bmsubWF4diA9IGNodW5rLm1heHY7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIG1lcmdlZENodW5rcy5wdXNoKGNodW5rKTsKICAgICAgICAgICAgbGFzdENodW5rID0gY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ICAgcmV0dXJuIFsKICAgICAgWzAsIDBdLAogICAgICBbMSArIChiZWcgPj4gMjYpLCAxICsgKGVuZCA+PiAyNildLAogICAgICBbOSArIChiZWcgPj4gMjMpLCA5ICsgKGVuZCA+PiAyMyldLAogICAgICBbNzMgKyAoYmVnID4+IDIwKSwgNzMgKyAoZW5kID4+IDIwKV0sCiAgICAgIFs1ODUgKyAoYmVnID4+IDE3KSwgNTg1ICsgKGVuZCA+PiAxNyldLAogICAgICBbNDY4MSArIChiZWcgPj4gMTQpLCA0NjgxICsgKGVuZCA+PiAxNCldCiAgICBdOwogIH0KICB2YXIgVGFiaXhJbmRleCA9IGNsYXNzIGV4dGVuZHMgSW5kZXhGaWxlIHsKICAgIGFzeW5jIGxpbmVDb3VudChyZWZOYW1lLCBvcHRzID0ge30pIHsKICAgICAgY29uc3QgaW5kZXhEYXRhID0gYXdhaXQgdGhpcy5wYXJzZShvcHRzKTsKICAgICAgaWYgKCFpbmRleERhdGEpIHsKICAgICAgICByZXR1cm4gLTE7CiAgICAgIH0KICAgICAgY29uc3QgcmVmSWQgPSBpbmRleERhdGEucmVmTmFtZVRvSWRbcmVmTmFtZV07CiAgICAgIGNvbnN0IGlkeCA9IGluZGV4RGF0YS5pbmRpY2VzW3JlZklkXTsKICAgICAgaWYgKCFpZHgpIHsKICAgICAgICByZXR1cm4gLTE7CiAgICAgIH0KICAgICAgY29uc3QgeyBzdGF0cyB9ID0gaW5kZXhEYXRhLmluZGljZXNbcmVmSWRdOwogICAgICBpZiAoc3RhdHMpIHsKICAgICAgICByZXR1cm4gc3RhdHMubGluZUNvdW50OwogICAgICB9CiAgICAgIHJldHVybiAtMTsKICAgIH0KICAgIGFzeW5jIF9wYXJzZShvcHRzID0ge30pIHsKICAgICAgY29uc3QgYnVmID0gYXdhaXQgdGhpcy5maWxlaGFuZGxlLnJlYWRGaWxlKG9wdHMpOwogICAgICBjb25zdCBieXRlcyA9IGF3YWl0IHVuemlwKGJ1Zik7CiAgICAgIGNoZ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YmlucywgcGxlYXNlIHVzZSBhIENTSSBpbmRleCIpOwogICAgICAgICAgfSBlbHNlIGlmIChiaW4gPT09IG1heEJpbk51bWJlciArIDEpIHsKICAgICAgICAgICAgY29uc3QgY2h1bmtDb3VudCA9IGJ5dGVzLnJlYWRJbnQzMkxFKGN1cnJPZmZzZXQpOwogICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDQ7CiAgICAgICAgICAgIGlmIChjaHVua0NvdW50ID09PSAyKSB7CiAgICAgICAgICAgICAgc3RhdHMgPSB0aGlzLnBhcnNlUHNldWRvQmluKGJ5dGVzLCBjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgfQogICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDE2ICogY2h1bmtDb3VudDsKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGNvbnN0IGNodW5rQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgICAgICBjb25zdCBjaHVua3MgPSBuZXcgQXJyYXkoY2h1bmtDb3VudCk7CiAgICAgICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgY2h1bmtDb3VudDsgayArPSAxKSB7CiAgICAgICAgICAgICAgY29uc3QgdSA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCk7CiAgICAgICAgICAgICAgY29uc3QgdiA9IGZyb21CeXRlcyhieXRlcywgY3Vyck9mZnNldCArIDgpOwogICAgICAgICAgICAgIGN1cnJPZmZzZXQgKz0gMTY7CiAgICAgICAgICAgICAgZmlyc3REYXRhTGluZSA9IHRoaXMuX2ZpbmRGaXJzdERhdGEoZmlyc3REYXRhTGluZSwgdSk7CiAgICAgICAgICAgICAgY2h1bmtzW2tdID0gbmV3IENodW5rKHUsIHYsIGJpbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYmluSW5kZXhbYmluXSA9IGNodW5rczsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgY29uc3QgbGluZWFyQ291bnQgPSBieXRlcy5yZWFkSW50MzJMRShjdXJyT2Zmc2V0KTsKICAgICAgICBjdXJyT2Zmc2V0ICs9IDQ7CiAgICAgICAgY29uc3QgbGluZWFySW5kZXggPSBuZXcgQXJyYXkobGluZWFyQ291bnQpOwogICAgICAgIGZvciAobGV0IGsgPSAwOyBrIDwgbGluZWFyQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgbGluZWFySW5kZXhba10gPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQpOwogICAgICAgICAgY3Vyck9mZnNldCArPSA4OwogICAgICAgICAgZmlyc3REYXRhTGluZSA9IHRoaXMuX2ZpbmRGaXJzdERhdGEoZmlyc3REYXRhTGluZSwgbGluZWFySW5kZXhba10pOwogICAgICAgIH0KICAgICAgICByZXR1cm4geyBiaW5JbmRleCwgbGluZWFySW5kZXgsIHN0YXRzIH07CiAgICAgIH0pOwogICAgICByZXR1cm4gewogICAgICAgIGluZGljZXMsCiAgICAgICAgbWV0YUNoYXIsCiAgICAgICAgbWF4QmluTnVtYmVyLAogICAgICAgIG1heFJlZkxlbmd0aCwKICAgICAgICBza2lwTGluZXMsCiAgICAgICAgZmlyc3REYXRhTGluZSwKICAgICAgICBjb2x1bW5OdW1iZXJzLAogICAgICAgIGNvb3JkaW5hdGVUeXBlLAogICAgICAgIGZvcm1hdCwKICAgICAgICByZWZJZFRvTmFtZSwKICAgICAgICByZWZOYW1lVG9JZCwKICAgICAgICBtYXhCbG9ja1NpemU6IDEgPDwgMTYKICAgICAgfTsKICAgIH0KICAgIHBhcnNlUHNldWRvQmluKGJ5dGVzLCBvZmZzZXQpIHsKICAgICAgY29uc3QgbGluZUNvdW50ID0gbG9uZ1RvTnVtYmVyKGltcG9ydF9sb25nMi5kZWZhdWx0LmZyb21CeXRlc0xFKGJ5dGVzLnNsaWNlKG9mZnNldCArIDE2LCBvZmZzZXQgKyAyNCksIHRydWUpKTsKICAgICAgcmV0dXJuIHsgbGluZUNvdW50IH07CiAgICB9CiAgICBfcGFyc2VOYW1lQnl0ZXMobmFtZXNCeXRlcykgewogICAgICBsZXQgY3VyclJlZklkID0gMDsKICAgICAgbGV0IGN1cnJOYW1lU3RhcnQgPSAwOwogICAgICBjb25zdCByZWZJZFRvTmFtZSA9IFtdOwogICAgICBjb25zdCByZWZOYW1lVG9JZCA9IHt9OwogICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG5hbWVzQnl0ZXMubGVuZ3RoOyBpICs9IDEpIHsKICAgICAgICBpZiAoIW5hbWVzQnl0ZXNbaV0pIHsKICAgICAgICAgIGlmIChjdXJyTmFtZVN0YXJ0IDwgaSkgewogICAgICAgICAgICBsZXQgcmVmTmFtZSA9IG5hbWVzQnl0ZXMudG9TdHJpbmcoInV0ZjgiLCBjdXJyTmFtZVN0YXJ0LCBpKTsKICAgICAgICAgICAgcmVmTmFtZSA9IHRoaXMucmVuYW1lUmVmU2VxKHJlZk5hbWUpOwogICAgICAgICAgICByZWZJZFRvTmFtZVtjdXJyUmVmSWRdID0gcmVmTmFtZTsKICAgICAgICAgICAgcmVmTmFtZVRvSWRbcmVmTmFtZV0gPSBjdXJyUmVmSWQ7CiAgICAgICAgICB9CiAgICAgICAgICBjdXJyTmFtZVN0YXJ0ID0gaSArIDE7CiAgICAgICAgICBjdXJyUmVmSWQgKz0gMTsKICAgICAgICB9CiAgICAgIH0KICAgICAgcmV0dXJuIHsgcmVmTmFtZVRvSWQsIHJlZklkVG9OYW1lIH07CiAgICB9CiAgICBhc3luYyBibG9ja3NGb3JSYW5nZShyZWZOYW1lLCBtaW4sIG1heCwgb3B0cyA9IHt9KSB7CiAgICAgIGlmIChtaW4gPCAwKSB7CiAgICAgICAgbWluID0gMDsKICAgICAgfQogICAgICBjb25zdCBpbmRleERhdGEgPSBhd2FpdCB0aGlzLnBhcnNlKG9wdHMpOwogICAgICBpZiAoIWluZGV4RGF0YSkgewogICAgICAgIHJldHVybiBbXTsKICAgICAgfQogICAgICBjb25zdCByZWZJZCA9IGluZGV4RGF0YS5yZWZOYW1lVG9JZFtyZWZOYW1lXTsKICAgICAgY29uc3QgYmEgPSBpbmRleERhdGEuaW5kaWNlc1tyZWZJZF07CiAgICAgIGlmICghYmEpIHsKICAgICAgICByZXR1cm4gW107CiAgICAgIH0KICAgICAgY29uc3QgbWluT2Zmc2V0ID0gYmEubGluZWFySW5kZXgubGVuZ3RoID8gYmEubGluZWFySW5kZXhbbWluID4+IFRBRF9MSURYX1NISUZUID49IGJhLmxpbmVhckluZGV4Lmxlbmd0aCA/IGJhLmxpbmVhckluZGV4Lmxlbmd0aCAtIDEgOiBtaW4gPj4gVEFEX0xJRFhfU0hJRlRdIDogbmV3IFZpcnR1YWxPZmZzZXQoMCwgMCk7CiAgICAgIGlmICghbWluT2Zmc2V0KSB7CiAgICAgICAgY29uc29sZS53YXJuKCJxdWVyeWluZyBvdXRzaWRlIG9mIHBvc3NpYmxlIHRhYml4IHJhbmdlIik7CiAgICAgIH0KICAgICAgY29uc3Qgb3ZlcmxhcHBpbmdCaW5zID0gcmVnMmJpbnMobWluLCBtYXgpOwogICAgICBjb25zdCBjaHVua3MgPSBbXTsKICAgICAgZm9yIChjb25zdCBbc3RhcnQsIGVuZF0gb2Ygb3ZlcmxhcHBpbmdCaW5zKSB7CiAgICAgICAgZm9yIChsZXQgYmluID0gc3RhcnQ7IGJpbiA8PSBlbmQ7IGJpbisrKSB7CiAgICAgICAgICBpZiAoYmEuYmluSW5kZXhbYmluXSkgewogICAgICAgICAgICBjb25zdCBiaW5DaHVua3MgPSBiYS5iaW5JbmRleFtiaW5dOwogICAgICAgICAgICBmb3IgKGxldCBjID0gMDsgYyA8IGJpbkNodW5rcy5sZW5ndGg7ICsrYykgewogICAgICAgICAgICAgIGNodW5rcy5wdXNoKG5ldyBDaHVuayhiaW5DaHVua3NbY10ubWludiwgYmluQ2h1bmtzW2NdLm1heHYsIGJpbikpOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGNvbnN0IG5pbnR2ID0gYmEubGluZWFySW5kZXgubGVuZ3RoOwogICAgICBsZXQgbG93ZXN0ID0gbnVsbDsKICAgICAgY29uc3QgbWluTGluID0gTWF0aC5taW4obWluID4+IDE0LCBuaW50diAtIDEpOwogICAgICBjb25zdCBtYXhMaW4gPSBNYXRoLm1pbihtYXggPj4gMTQsIG5pbnR2IC0gMSk7CiAgICAgIGZvciAobGV0IGkgPSBtaW5MaW47IGkgPD0gbWF4TGluOyArK2kpIHsKICAgICAgICBjb25zdCB2cCA9IGJhLmxpbmVhckluZGV4W2ldOwogICAgICAgIGlmICh2cCkgewogICAgICAgICAgaWYgKCFsb3dlc3QgfHwgdnAuY29tcGFyZVRvKGxvd2VzdCkgPCAwKSB7CiAgICAgICAgICAgIGxvd2VzdCA9IHZwOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gb3B0aW1pemVDaHVua3MoY2h1bmtzLCBsb3dlc3QpOwogICAgfQogIH07CgogIC8vIG5vZGVfbW9kdWxlcy8ucG5wbS9AZ21vZCt0YWJpeEAxLjUuMTEvbm9kZV9tb2R1bGVzL0BnbW9kL3RhYml4L2VzbS9jc2kuanMKICBpbml0X2J1ZmZlcl9zaGltKCk7CiAgdmFyIGltcG9ydF9sb25nMyA9IF9fdG9Nb2R1bGUocmVxdWlyZV9sb25nKCkpOwogIHZhciBDU0kxX01BR0lDID0gMjE1ODI2NTk7CiAgdmFyIENTSTJfTUFHSUMgPSAzODM1OTg3NTsKICBmdW5jdGlvbiBsc2hpZnQobnVtLCBiaXRzKSB7CiAgICByZXR1cm4gbnVtICogMiAqKiBiaXRzOwogIH0KICBmdW5jdGlvbiByc2hpZnQobnVtLCBiaXRzKSB7CiAgICByZXR1cm4gTWF0aC5mbG9vcihudW0gLyAyICoqIGJpdHMpOwogIH0KICB2YXIgQ1NJID0gY2xhc3MgZXh0ZW5kcyBJbmRle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2ICsgYXV4TGVuZ3RoICsgNDsKICAgICAgY29uc3QgaW5kaWNlcyA9IG5ldyBBcnJheShyZWZDb3VudCkuZmlsbCgwKS5tYXAoKCkgPT4gewogICAgICAgIGNvbnN0IGJpbkNvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCk7CiAgICAgICAgY3Vyck9mZnNldCArPSA0OwogICAgICAgIGNvbnN0IGJpbkluZGV4ID0ge307CiAgICAgICAgbGV0IHN0YXRzOwogICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgYmluQ291bnQ7IGogKz0gMSkgewogICAgICAgICAgY29uc3QgYmluID0gYnl0ZXMucmVhZFVJbnQzMkxFKGN1cnJPZmZzZXQpOwogICAgICAgICAgaWYgKGJpbiA+IHRoaXMubWF4QmluTnVtYmVyKSB7CiAgICAgICAgICAgIHN0YXRzID0gdGhpcy5wYXJzZVBzZXVkb0JpbihieXRlcywgY3Vyck9mZnNldCArIDQpOwogICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDQgKyA4ICsgNCArIDE2ICsgMTY7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjb25zdCBsb2Zmc2V0ID0gZnJvbUJ5dGVzKGJ5dGVzLCBjdXJyT2Zmc2V0ICsgNCk7CiAgICAgICAgICAgIGZpcnN0RGF0YUxpbmUgPSB0aGlzLl9maW5kRmlyc3REYXRhKGZpcnN0RGF0YUxpbmUsIGxvZmZzZXQpOwogICAgICAgICAgICBjb25zdCBjaHVua0NvdW50ID0gYnl0ZXMucmVhZEludDMyTEUoY3Vyck9mZnNldCArIDEyKTsKICAgICAgICAgICAgY3Vyck9mZnNldCArPSAxNjsKICAgICAgICAgICAgY29uc3QgY2h1bmtzID0gbmV3IEFycmF5KGNodW5rQ291bnQpOwogICAgICAgICAgICBmb3IgKGxldCBrID0gMDsgayA8IGNodW5rQ291bnQ7IGsgKz0gMSkgewogICAgICAgICAgICAgIGNvbnN0IHUgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQpOwogICAgICAgICAgICAgIGNvbnN0IHYgPSBmcm9tQnl0ZXMoYnl0ZXMsIGN1cnJPZmZzZXQgKyA4KTsKICAgICAgICAgICAgICBjdXJyT2Zmc2V0ICs9IDE2OwogICAgICAgICAgICAgIGNodW5rc1trXSA9IG5ldyBDaHVuayh1LCB2LCBiaW4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGJpbkluZGV4W2Jpbl0gPSBjaHVua3M7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiB7IGJpbkluZGV4LCBzdGF0cyB9OwogICAgICB9KTsKICAgICAgcmV0dXJuIHsKICAgICAgICAuLi5hdXgsCiAgICAgICAgY3NpOiB0cnVlLAogICAgICAgIHJlZkNvdW50LAogICAgICAgIG1heEJsb2NrU2l6ZTogMSA8PCAxNiwKICAgICAgICBmaXJzdERhdGFMaW5lLAogICAgICAgIGNzaVZlcnNpb24sCiAgICAgICAgaW5kaWNlcywKICAgICAgICBkZXB0aDogdGhpcy5kZXB0aCwKICAgICAgICBtYXhCaW5OdW1iZXI6IHRoaXMubWF4QmluTnVtYmVyLAogICAgICAgIG1heFJlZkxlbmd0aAogICAgICB9OwogICAgfQogICAgcGFyc2VQc2V1ZG9CaW4oYnl0ZXMsIG9mZnNldCkgewogICAgICBjb25zdCBsaW5lQ291bnQgPSBsb25nVG9OdW1iZXIoaW1wb3J0X2xvbmczLmRlZmF1bHQuZnJvbUJ5dGVzTEUoYnl0ZXMuc2xpY2Uob2Zmc2V0ICsgMjgsIG9mZnNldCArIDM2KSwgdHJ1ZSkpOwogICAgICByZXR1cm4geyBsaW5lQ291bnQgfTsKICAgIH0KICAgIGFzeW5jIGJsb2Nrc0ZvclJhbmdlKHJlZk5hbWUsIG1pbiwgbWF4LCBvcHRzID0ge30pIHsKICAgICAgaWYgKG1pbiA8IDApIHsKICAgICAgICBtaW4gPSAwOwogICAgICB9CiAgICAgIGNvbnN0IGluZGV4RGF0YSA9IGF3YWl0IHRoaXMucGFyc2Uob3B0cyk7CiAgICAgIGlmICghaW5kZXhEYXRhKSB7CiAgICAgICAgcmV0dXJuIFtdOwogICAgICB9CiAgICAgIGNvbnN0IHJlZklkID0gaW5kZXhEYXRhLnJlZk5hbWVUb0lkW3JlZk5hbWVdOwogICAgICBjb25zdCBiYSA9IGluZGV4RGF0YS5pbmRpY2VzW3JlZklkXTsKICAgICAgaWYgKCFiYSkgewogICAgICAgIHJldHVybiBbXTsKICAgICAgfQogICAgICBjb25zdCBvdmVybGFwcGluZ0JpbnMgPSB0aGlzLnJlZzJiaW5zKG1pbiwgbWF4KTsKICAgICAgY29uc3QgY2h1bmtzID0gW107CiAgICAgIGZvciAoY29uc3QgW3N0YXJ0LCBlbmRdIG9mIG92ZXJsYXBwaW5nQmlucykgewogICAgICAgIGZvciAobGV0IGJpbiA9IHN0YXJ0OyBiaW4gPD0gZW5kOyBiaW4rKykgewogICAgICAgICAgaWYgKGJhLmJpbkluZGV4W2Jpbl0pIHsKICAgICAgICAgICAgY29uc3QgYmluQ2h1bmtzID0gYmEuYmluSW5kZXhbYmluXTsKICAgICAgICAgICAgZm9yIChsZXQgYyA9IDA7IGMgPCBiaW5DaHVua3MubGVuZ3RoOyArK2MpIHsKICAgICAgICAgICAgICBjaHVua3MucHVzaChuZXcgQ2h1bmsoYmluQ2h1bmtzW2NdLm1pbnYsIGJpbkNodW5rc1tjXS5tYXh2LCBiaW4pKTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgICByZXR1cm4gb3B0aW1pemVDaHVua3MoY2h1bmtzLCBuZXcgVmlydHVhbE9mZnNldCgwLCAwKSk7CiAgICB9CiAgICByZWcyYmlucyhiZWcsIGVuZCkgewogICAgICBiZWcgLT0gMTsKICAgICAgaWYgKGJlZyA8IDEpIHsKICAgICAgICBiZWcgPSAxOwogICAgICB9CiAgICAgIGlmIChlbmQgPiAyICoqIDUwKSB7CiAgICAgICAgZW5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IGMgPSBjaHVua3NbY2h1bmtOdW1dOwogICAgICAgIGNvbnN0IHsgYnVmZmVyLCBjcG9zaXRpb25zLCBkcG9zaXRpb25zIH0gPSBhd2FpdCB0aGlzLmNodW5rQ2FjaGUuZ2V0KGMudG9TdHJpbmcoKSwgYyk7CiAgICAgICAgY2hlY2tBYm9ydFNpZ25hbChzaWduYWwpOwogICAgICAgIGxldCBibG9ja1N0YXJ0ID0gMDsKICAgICAgICBsZXQgcG9zID0gMDsKICAgICAgICB3aGlsZSAoYmxvY2tTdGFydCA8IGJ1ZmZlci5sZW5ndGgpIHsKICAgICAgICAgIGNvbnN0IG4gPSBidWZmZXIuaW5kZXhPZigiXG4iLCBibG9ja1N0YXJ0KTsKICAgICAgICAgIGlmIChuID09PSAtMSkgewogICAgICAgICAgICBicmVhazsKICAgICAgICAgIH0KICAgICAgICAgIGNvbnN0IGIgPSBidWZmZXIuc2xpY2UoYmxvY2tTdGFydCwgbik7CiAgICAgICAgICBjb25zdCBsaW5lID0gKGRlY29kZXIgPT09IG51bGwgfHwgZGVjb2RlciA9PT0gdm9pZCAwID8gdm9pZCAwIDogZGVjb2Rlci5kZWNvZGUoYikpIHx8IGIudG9TdHJpbmcoKTsKICAgICAgICAgIGlmIChkcG9zaXRpb25zKSB7CiAgICAgICAgICAgIHdoaWxlIChibG9ja1N0YXJ0ICsgYy5taW52LmRhdGFQb3NpdGlvbiA+PSBkcG9zaXRpb25zW3BvcysrXSkgewogICAgICAgICAgICB9CiAgICAgICAgICAgIHBvcy0tOwogICAgICAgICAgfQogICAgICAgICAgY29uc3QgeyBzdGFydENvb3JkaW5hdGUsIG92ZXJsYXBzIH0gPSB0aGlzLmNoZWNrTGluZShtZXRhZGF0YSwgcmVmTmFtZSwgc3RhcnQsIGVuZCwgbGluZSk7CiAgICAgICAgICBpZiAocHJldmlvdXNTdGFydENvb3JkaW5hdGUgIT09IHZvaWQgMCAmJiBzdGFydENvb3JkaW5hdGUgIT09IHZvaWQgMCAmJiBwc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CiAgICAgIGlmICghc3RhcnQpIHsKICAgICAgICBzdGFydCA9IDA7CiAgICAgIH0KICAgICAgaWYgKCFlbmQpIHsKICAgICAgICBlbmQgPSAwOwogICAgICB9CiAgICAgIGlmIChmb3JtYXQgPT09ICJWQ0YiKSB7CiAgICAgICAgZW5kID0gODsKICAgICAgfQogICAgICBjb25zdCBtYXhDb2x1bW4gPSBNYXRoLm1heChyZWYsIHN0YXJ0LCBlbmQpOwogICAgICBsZXQgY3VycmVudENvbHVtbk51bWJlciA9IDE7CiAgICAgIGxldCBjdXJyZW50Q29sdW1uU3RhcnQgPSAwOwogICAgICBsZXQgcmVmU2VxID0gIiI7CiAgICAgIGxldCBzdGFydENvb3JkaW5hdGUgPSAtSW5maW5pdHk7CiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGluZS5sZW5ndGggKyAxOyBpICs9IDEpIHsKICAgICAgICBpZiAobGluZVtpXSA9PT0gIgkiIHx8IGkgPT09IGxpbmUubGVuZ3RoKSB7CiAgICAgICAgICBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gcmVmKSB7CiAgICAgICAgICAgIGlmICh0aGlzLnJlbmFtZVJlZlNlcShsaW5lLnNsaWNlKGN1cnJlbnRDb2x1bW5TdGFydCwgaSkpICE9PSByZWdpb25SZWZOYW1lKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHsgb3ZlcmxhcHM6IGZhbHNlIH07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gc3RhcnQpIHsKICAgICAgICAgICAgc3RhcnRDb29yZGluYXRlID0gcGFyc2VJbnQobGluZS5zbGljZShjdXJyZW50Q29sdW1uU3RhcnQsIGkpLCAxMCk7CiAgICAgICAgICAgIGlmIChjb29yZGluYXRlVHlwZSA9PT0gIjEtYmFzZWQtY2xvc2VkIikgewogICAgICAgICAgICAgIHN0YXJ0Q29vcmRpbmF0ZSAtPSAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChzdGFydENvb3JkaW5hdGUgPj0gcmVnaW9uRW5kKSB7CiAgICAgICAgICAgICAgcmV0dXJuIHsgc3RhcnRDb29yZGluYXRlLCBvdmVybGFwczogZmFsc2UgfTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoZW5kID09PSAwIHx8IGVuZCA9PT0gc3RhcnQpIHsKICAgICAgICAgICAgICBpZiAoc3RhcnRDb29yZGluYXRlICsgMSA8PSByZWdpb25TdGFydCkgewogICAgICAgICAgICAgICAgcmV0dXJuIHsgc3RhcnRDb29yZGluYXRlLCBvdmVybGFwczogZmFsc2UgfTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSBpZiAoZm9ybWF0ID09PSAiVkNGIiAmJiBjdXJyZW50Q29sdW1uTnVtYmVyID09PSA0KSB7CiAgICAgICAgICAgIHJlZlNlcSA9IGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKTsKICAgICAgICAgIH0gZWxzZSBpZiAoY3VycmVudENvbHVtbk51bWJlciA9PT0gZW5kKSB7CiAgICAgICAgICAgIGxldCBlbmRDb29yZGluYXRlOwogICAgICAgICAgICBpZiAoZm9ybWF0ID09PSAiVkNGIikgewogICAgICAgICAgICAgIGVuZENvb3JkaW5hdGUgPSB0aGlzLl9nZXRWY2ZFbmQoc3RhcnRDb29yZGluYXRlLCByZWZTZXEsIGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKSk7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgZW5kQ29vcmRpbmF0ZSA9IHBhcnNlSW50KGxpbmUuc2xpY2UoY3VycmVudENvbHVtblN0YXJ0LCBpKSwgMTApOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChlbmRDb29yZGluYXRlIDw9IHJlZ2lvblN0YXJ0KSB7CiAgICAgICAgICAgICAgcmV0dXJuIHsgb3ZlcmxhcHM6IGZhbHNlIH07CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICAgIGN1cnJlbnRDb2x1bW5TdGFydCA9IGkgKyAxOwogICAgICAgICAgY3VycmVudENvbHVtbk51bWJlciArPSAxOwogICAgICAgICAgaWYgKGN1cnJlbnRDb2x1bW5OdW1iZXIgPiBtYXhDb2x1bW4pIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIHJldHVybiB7IHN0YXJ0Q29vcmRpbmF0ZSwgb3ZlcmxhcHM6IHRydWUgfTsKICAgIH0KICAgIF9nZXRWY2ZFbmQoc3RhcnRDb29yZGluYXRlLCByZWZTZXEsIGluZm8pIHsKICAgICAgbGV0IGVuZENvb3JkaW5hdGUgPSBzdGFydENvb3JkaW5hdGUgKyByZWZTZXEubGVuZ3RoOwogICAgICBjb25zdCBpc1RSQSA9IGluZm8uaW5kZXhPZigiU1ZUWVBFPVRSQSIpICE9PSAtMTsKICAgICAgaWYgKGluZm9bMF0gIT09ICIuIiAmJiAhaXNUUkEpIHsKICAgICAgICBsZXQgcHJldkNoYXIgPSAiOyI7CiAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBpbmZvLmxlbmd0aDsgaiArPSAxKSB7CiAgICAgICAgICBpZiAocHJldkNoYXIgPT09ICI7IiAmJiBpbmZvLnNsaWNlKGosIGogKyA0KSA9PT0gIkVORD0iKSB7CiAgICAgICAgICAgIGxldCB2YWx1ZUVuZCA9IGluZm8uaW5kZXhPZigiOyIsIGopOwogICAgICAgICAgICBpZiAodmFsdWVFbmQgPT09IC0xKSB7CiAgICAgICAgICAgICAgdmFsdWVFbmQgPSBpbmZvLmxlbmd0aDsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbmRDb29yZGluYXRlID0gcGFyc2VJbnQoaW5mby5zbGljZShqICsgNCwgdmFsdWVFbmQpLCAxMCk7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgfQogICAgICAg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GEgPSBmOwogICAgbGV0IGNvbXBhcmUgPSBmOwogICAgaWYgKGYubGVuZ3RoID09PSAxKSB7CiAgICAgIGRlbHRhID0gKGQsIHgpID0+IGYoZCkgLSB4OwogICAgICBjb21wYXJlID0gYXNjZW5kaW5nQ29tcGFyYXRvcihmKTsKICAgIH0KICAgIGZ1bmN0aW9uIGxlZnQoYSwgeCwgbG8sIGhpKSB7CiAgICAgIGlmIChsbyA9PSBudWxsKQogICAgICAgIGxvID0gMDsKICAgICAgaWYgKGhpID09IG51bGwpCiAgICAgICAgaGkgPSBhLmxlbmd0aDsKICAgICAgd2hpbGUgKGxvIDwgaGkpIHsKICAgICAgICBjb25zdCBtaWQgPSBsbyArIGhpID4+PiAxOwogICAgICAgIGlmIChjb21wYXJlKGFbbWlkXSwgeCkgPCAwKQogICAgICAgICAgbG8gPSBtaWQgKyAxOwogICAgICAgIGVsc2UKICAgICAgICAgIGhpID0gbWlkOwogICAgICB9CiAgICAgIHJldHVybiBsbzsKICAgIH0KICAgIGZ1bmN0aW9uIHJpZ2h0KGEsIHgsIGxvLCBoaSkgewogICAgICBpZiAobG8gPT0gbnVsbCkKICAgICAgICBsbyA9IDA7CiAgICAgIGlmIChoaSA9PSBudWxsKQogICAgICAgIGhpID0gYS5sZW5ndGg7CiAgICAgIHdoaWxlIChsbyA8IGhpKSB7CiAgICAgICAgY29uc3QgbWlkID0gbG8gKyBoaSA+Pj4gMTsKICAgICAgICBpZiAoY29tcGFyZShhW21pZF0sIHgpID4gMCkKICAgICAgICAgIGhpID0gbWlkOwogICAgICAgIGVsc2UKICAgICAgICAgIGxvID0gbWlkICsgMTsKICAgICAgfQogICAgICByZXR1cm4gbG87CiAgICB9CiAgICBmdW5jdGlvbiBjZW50ZXIoYSwgeCwgbG8sIGhpKSB7CiAgICAgIGlmIChsbyA9PSBudWxsKQogICAgICAgIGxvID0gMDsKICAgICAgaWYgKGhpID09IG51bGwpCiAgICAgICAgaGkgPSBhLmxlbmd0aDsKICAgICAgY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geyBhdXRvU3FsIH0gPSB0aGlzOwogICAgICBjb25zdCB7IHVuaXF1ZUlkIH0gPSBvcHRzOwogICAgICBjb25zdCBmaWVsZHMgPSBBcnJheS5pc0FycmF5KGxpbmUpID8gbGluZSA6IGxpbmUuc3BsaXQoIgkiKTsKICAgICAgbGV0IGZlYXR1cmUgPSB7fTsKICAgICAgaWYgKCF0aGlzLmF0dGVtcHREZWZhdWx0QmVkIHx8IHRoaXMuYXR0ZW1wdERlZmF1bHRCZWQgJiYgaXNCZWQxMkxpa2UoZmllbGRzKSkgewogICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXV0b1NxbC5maWVsZHMubGVuZ3RoOyBpKyspIHsKICAgICAgICAgIGNvbnN0IGF1dG9GaWVsZCA9IGF1dG9TcWwuZmllbGRzW2ldOwogICAgICAgICAgbGV0IGNvbHVtblZhbCA9IGZpZWxkc1tpXTsKICAgICAgICAgIGNvbnN0IHsgaXNOdW1lcmljLCBpc0FycmF5OiBpc0FycmF5MiwgYXJyYXlJc051bWVyaWMsIG5hbWUgfSA9IGF1dG9GaWVsZDsKICAgICAgICAgIGlmIChjb2x1bW5WYWwgPT09IG51bGwgfHwgY29sdW1uVmFsID09PSB2b2lkIDApIHsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICB9CiAgICAgICAgICBpZiAoY29sdW1uVmFsICE9PSAiLiIpIHsKICAgICAgICAgICAgaWYgKGlzTnVtZXJpYykgewogICAgICAgICAgICAgIGNvbnN0IG51bSA9IE51bWJlcihjb2x1bW5WYWwpOwogICAgICAgICAgICAgIGNvbHVtblZhbCA9IE51bWJlci5pc05hTihudW0pID8gY29sdW1uVmFsIDogbnVtOwogICAgICAgICAgICB9IGVsc2UgaWYgKGlzQXJyYXkyKSB7CiAgICAgICAgICAgICAgY29sdW1uVmFsID0gY29sdW1uVmFsLnNwbGl0KCIsIik7CiAgICAgICAgICAgICAgaWYgKGNvbHVtblZhbFtjb2x1bW5WYWwubGVuZ3RoIC0gMV0gPT09ICIiKSB7CiAgICAgICAgICAgICAgICBjb2x1bW5WYWwucG9wKCk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGlmIChhcnJheUlzTnVtZXJpYykgewogICAgICAgICAgICAgICAgY29sdW1uVmFsID0gY29sdW1uVmFsLm1hcCgoc3RyKSA9PiBOdW1iZXIoc3RyKSk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZlYXR1cmVbbmFtZV0gPSBjb2x1bW5WYWw7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9IGVsc2UgewogICAgICAgIGNvbnN0IGZpZWxkTmFtZXMgPSBbImNocm9tIiwgImNocm9tU3RhcnQiLCAiY2hyb21FbmQiLCAibmFtZSJdOwogICAgICAgIGZlYXR1cmUgPSBPYmplY3QuZnJvbUVudHJpZXMoZmllbGRzLm1hcCgoZiwgaSkgPT4gW2ZpZWxkTmFtZXNbaV0gfHwgImZpZWxkIiArIGksIGZdKSk7CiAgICAgICAgZmVhdHVyZS5jaHJvbVN0YXJ0ID0gK2ZlYXR1cmUuY2hyb21TdGFydDsKICAgICAgICBmZWF0dXJlLmNocm9tRW5kID0gK2ZlYXR1cmUuY2hyb21FbmQ7CiAgICAgICAgaWYgKCFOdW1iZXIuaXNOYU4oTnVtYmVyLnBhcnNlRmxvYXQoZmVhdHVyZS5maWVsZDQpKSkgewogICAgICAgICAgZmVhdHVyZS5zY29yZSA9ICtmZWF0dXJlLmZpZWxkNDsKICAgICAgICAgIGRlbGV0ZSBmZWF0dXJlLmZpZWxkNDsKICAgICAgICB9CiAgICAgICAgaWYgKGZlYXR1cmUuZmllbGQ1ID09PSAiKyIgfHwgZmVhdHVyZS5maWVsZDUgPT09ICItIikgewogICAgICAgICAgZmVhdHVyZS5zdHJhbmQgPSBmZWF0dXJlLmZpZWxkNTsKICAgICAgICAgIGRlbGV0ZSBmZWF0dXJlLmZpZWxkNTsKICAgICAgICB9CiAgICAgIH0KICAgICAgaWYg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BdXRvU1FMRmllbGRzKCkgewogICAgICBjb25zdCBCRUQxMkZpZWxkcyA9IFsKICAgICAgICBbInN0cmluZyIsICJjaHJvbSJdLAogICAgICAgIFsidWludCIsICJjaHJvbVN0YXJ0Il0sCiAgICAgICAgWyJ1aW50IiwgImNocm9tRW5kIl0sCiAgICAgICAgWyJzdHJpbmciLCAibmFtZSJdLAogICAgICAgIFsiZmxvYXQiLCAic2NvcmUiXSwKICAgICAgICBbImNoYXIiLCAic3RyYW5kIl0sCiAgICAgICAgWyJ1aW50IiwgInRoaWNrU3RhcnQiXSwKICAgICAgICBbInVpbnQiLCAidGhpY2tFbmQiXSwKICAgICAgICBbInN0cmluZyIsICJpdGVtUmdiIl0sCiAgICAgICAgWyJ1aW50IiwgImJsb2NrQ291bnQiXSwKICAgICAgICBbInVpbnRbYmxvY2tDb3VudF0iLCAiYmxvY2tTaXplcyJdLAogICAgICAgIFsidWludFtibG9ja0NvdW50XSIsICJibG9ja1N0YXJ0cyJdCiAgICAgIF07CiAgICAgIGlmICghdGhpcy4jbl9jb2x1bW5zKQogICAgICAgIHRocm93IG5ldyBFcnJvcigiTnVtYmVyIG9mIGNvbHVtbnMgd2FzIG5vdCBhYmxlIHRvIGJlIGRldGVybWluZWQiKTsKICAgICAgaWYgKCF0aGlzLiNjdXN0b21GaWVsZHMpCiAgICAgICAgcmV0dXJuICIiOwogICAgICBjb25zdCBjdXN0b21GaWVsZFR5cGUgPSAic3RyaW5nIjsKICAgICAgY29uc3QgY3VzdG9tRmllbGRzV2l0aFR5cGVzID0gdGhpcy4jY3VzdG9tRmllbGRzLm1hcCgoY29sdW1uKSA9PiBbY3VzdG9tRmllbGRUeXBlLCBjb2x1bW5dKTsKICAgICAgbGV0IGFsbEZpZWxkczsKICAgICAgY29uc3QgUkVRVUlSRURfQ09MUyA9IDM7CiAgICAgIGlmICh0aGlzLiNuX2NvbHVtbnMgPiBCRUQxMkZpZWxkcy5sZW5ndGgpIHsKICAgICAgICBpZiAodGhpcy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aWYgKG5fY29scyA+IDApCiAgICAgICAgICBicmVhazsKICAgICAgfQogICAgICByZXR1cm4gbl9jb2xzOwogICAgfQogICAgYXN5bmMgZ2V0VGlsZURhdGEobWluWCwgbWF4WCkgewogICAgICBjb25zdCBzb3VyY2UgPSBkYXRhU291cmNlcy5nZXQodGhpcy4jdWlkKTsKICAgICAgY29uc3QgcGFyc2VyMiA9IGF3YWl0IHRoaXMuZ2V0UGFyc2VyKCk7CiAgICAgIGxldCBjdXJNaW5YID0gbWluWDsKICAgICAgY29uc3QgeyBjaHJvbUxlbmd0aHMsIGN1bVBvc2l0aW9ucyB9ID0gc291cmNlLmNocm9tSW5mbzsKICAgICAgY29uc3QgYWxsVGlsZXMgPSBbXTsKICAgICAgZm9yIChjb25zdCBjdW1Qb3Mgb2YgY3VtUG9zaXRpb25zKSB7CiAgICAgICAgY29uc3QgY2hyb21OYW1lID0gY3VtUG9zLmNocjsKICAgICAgICBjb25zdCBjaHJvbVN0YXJ0ID0gY3VtUG9zLnBvczsKICAgICAgICBjb25zdCBjaHJvbUVuZCA9IGN1bVBvcy5wb3MgKyBjaHJvbUxlbmd0aHNbY2hyb21OYW1lXTsKICAgICAgICBsZXQgc3RhcnRQb3MsIGVuZFBvczsKICAgICAgICBpZiAoY2hyb21TdGFydCA+IGN1ck1pblggfHwgY3VyTWluWCA+PSBjaHJvbUVuZCkgewogICAgICAgICAgY29udGludWU7CiAgICAgICAgfQogICAgICAgIGNvbnN0IHRpbGVzUHJvbWlzZSA9IG5ldyBQcm9taXNlKChyZXNvbHZlKSA9PiB7CiAgICAgICAgICBjb25zdCB0aWxlcyA9IFtdOwogICAgICAgICAgY29uc3QgbGluZUNhbGxiYWNrID0gKGxpbmUpID0+IHsKICAgICAgICAgICAgY29uc3QgYmVkVGlsZSA9IHBhcnNlcjIucGFyc2VMaW5lKGxpbmUsIGNocm9tU3RhcnQpOwogICAgICAgICAgICB0aWxlcy5wdXNoKGJlZFRpbGUpOwogICAgICAgICAgfTsKICAgICAgICAgIGlmIChtYXhYID4gY2hyb21FbmQpIHsKICAgICAgICAgICAgc3RhcnRQb3MgPSBjdXJNaW5YIC0gY2hyb21TdGFydDsKICAgICAgICAgICAgZW5kUG9zID0gY2hyb21FbmQgLSBjaHJvbVN0YXJ0OwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgc3RhcnRQb3MgPSBNYXRoLmZsb29yKGN1ck1pblggLSBjaHJvbVN0YXJ0KTsKICAgICAgICAgICAgZW5kUG9zID0gTWF0aC5jZWlsKG1heFggLSBjaHJvbVN0YXJ0KTsKICAgICAgICAgIH0KICAgICAgICAgIHNvdXJjZS5maWxlLnRiaS5nZXRMaW5lcyhjaHJvbU5hbWUsIHN0YXJ0UG9zLCBlbmRQb3MsIGxpbmVDYWxsYmFjaykudGhlbigoKSA9PiB7CiAgICAgICAgICAgIHJlc29sdmUodGlsZXMpOwogICAgICAgICAgfSk7CiAgICAgICAgfSk7CiAgICAgICAgYWxsVGlsZXMucHVzaCh0aWxlc1Byb21pc2UpOwogICAgICAgIGlmIChtYXhYIDw9IGNocm9tRW5kKSB7CiAgICAgICAgICBjb250aW51ZTsKICAgICAgICB9CiAgICAgICAgY3VyTWluWCA9IGNocm9tRW5kOwogICAgICB9CiAgICAgIGNvbnN0IHRpbGVBcnJheXMgPSBhd2FpdCBQcm9taXNlLmFsbChhbGxUaWxlcyk7CiAgICAgIHJldHVybiB0aWxlQXJyYXlzLmZsYXQoKTsKICAgIH0KICB9OwogIHZhciBiZWRGaWxlcyA9IG5ldyBNYXAoKTsKICB2YXIgdGlsZVZhbHVlcyA9IHt9OwogIHZhciBkYXRhU291cmNlcyA9IG5ldyBNYXAoKTsKICBmdW5jdGlvbiBpbml0KHVpZCwgYmVkLCBjaHJvbVNpemVzLCBvcHRpb25zID0ge30pIHsKICAgIGxldCBiZWRGaWxlID0gYmVkRmlsZXMuZ2V0KGJlZC51cmwpOwogICAgaWYgKCFiZWRGaWxlKSB7CiAgICAgIGJlZEZpbG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CiAgfTsKICBleHBvc2UodGlsZUZ1bmN0aW9ucyk7Cn0pKCk7Ci8qIQogKiBUaGUgYnVmZmVyIG1vZHVsZSBmcm9tIG5vZGUuanMsIGZvciB0aGUgYnJvd3Nlci4KICoKICogQGF1dGhvciAgIEZlcm9zcyBBYm91a2hhZGlqZWggPGh0dHBzOi8vZmVyb3NzLm9yZz4KICogQGxpY2Vuc2UgIE1JVAogKi8KLyohIGllZWU3NTQuIEJTRC0zLUNsYXVzZSBMaWNlbnNlLiBGZXJvc3MgQWJvdWtoYWRpamVoIDxodHRwczovL2Zlcm9zcy5vcmcvb3BlbnNvdXJjZT4gKi8KLyoqCiAqIEBsaWNlbnNlCiAqIExvZGFzaCAoQ3VzdG9tIEJ1aWxkKSA8aHR0cHM6Ly9sb2Rhc2guY29tLz4KICogQnVpbGQ6IGBsb2Rhc2ggbW9kdWxhcml6ZSBleHBvcnRzPSJlcyIgLW8gLi9gCiAqIENvcHlyaWdodCBPcGVuSlMgRm91bmRhdGlvbiBhbmQgb3RoZXIgY29udHJpYnV0b3JzIDxodHRwczovL29wZW5qc2Yub3JnLz4KICogUmVsZWFzZWQgdW5kZXIgTUlUIGxpY2Vuc2UgPGh0dHBzOi8vbG9kYXNoLmNvbS9saWNlbnNlPgogKiBCYXNlZCBvbiBVbmRlcnNjb3JlLmpzIDEuOC4zIDxodHRwOi8vdW5kZXJzY29yZWpzLm9yZy9MSUNFTlNFPgogKiBDb3B5cmlnaHQgSmVyZW15IEFzaGtlbmFzLCBEb2N1bWVudENsb3VkIGFuZCBJbnZlc3RpZ2F0aXZlIFJlcG9ydGVycyAmIEVkaXRvcnMKICovCg=="; -const blob = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs)], { type: "text/javascript;charset=utf-8" }); -function Worker$1() { - const objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob); - try { - return objURL ? new Worker(objURL) : new Worker("data:application/javascript;base64," + encodedJs, { type: "module" }); - } finally { - objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL); - } -} -const DEBOUNCE_TIME = 200; -class BedDataFetcher { - constructor(HGC, config2) { - __publicField(this, "dataConfig", {}); - // required for higlass - __publicField(this, "uid"); - __publicField(this, "prevRequestTime"); - __publicField(this, "track"); - __publicField(this, "toFetch"); - __publicField(this, "fetchTimeout"); - __publicField(this, "worker"); - this.uid = HGC.libraries.slugid.nice(); - this.prevRequestTime = 0; - this.toFetch = /* @__PURE__ */ new Set(); - const { url, indexUrl, assembly, ...options } = config2; - this.worker = spawn(new Worker$1()).then(async (worker) => { - const chromSizes = Object.entries(computeChromSizes(assembly).size); - await worker.init(this.uid, { url, indexUrl }, chromSizes, options); - return worker; - }); - } - /* - * Collect Tileset Information, such as tile size and genomic positions - */ - async tilesetInfo(callback) { - (await this.worker).tilesetInfo(this.uid).then(callback); - } - fetchTilesDebounced(receivedTiles, tileIds) { - this.track.drawLoadingCue(); - tileIds.forEach((tileId) => this.toFetch.add(tileId)); - if (this.fetchTimeout) { - clearTimeout(this.fetchTimeout); - } - this.fetchTimeout = setTimeout(() => { - this.sendFetch(receivedTiles, [...this.toFetch]); - this.toFetch.clear(); - }, DEBOUNCE_TIME); - } - async sendFetch(receivedTiles, tileIds) { - (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles); - } - /** - * Called by GoslingTrack. This is how the track gets data - * @param tileIds The position of the tile - * @returns A promise to the BedTiles - */ - async getTabularData(tileIds) { - const buf = await (await this.worker).getTabularData(this.uid, tileIds); - const parsed = JSON.parse(new TextDecoder().decode(buf)); - return parsed; - } -} -__publicField(BedDataFetcher, "config", { type: "bed" }); -const dataFetchers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - BamDataFetcher, - BedDataFetcher, - BigWigDataFetcher, - CsvDataFetcher, - GffDataFetcher, - JsonDataFetcher, - VcfDataFetcher -}, Symbol.toStringTag, { value: "Module" })); -const GOSLING_DATA_ROW_UID_FIELD = "gosling-data-row-uid"; -function getTabularData(spec, data) { - var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p; - const tabularData = []; - if (!IsDataDeepTileset(spec.data)) { - console.warn("No data is specified"); - return; - } - if (spec.data.type === "vector" || spec.data.type === "bigwig") { - if (!("dense" in data)) { - return; - } - const bin = (_a = spec.data.binSize) != null ? _a : 1; - const numericValues = data.dense; - const numOfGenomicPositions = data.tileSize; - const tileUnitSize = data.tileWidth / data.tileSize; - const valueName = (_b = spec.data.value) != null ? _b : "value"; - const columnName = (_c = spec.data.column) != null ? _c : "position"; - const startName = (_d = spec.data.start) != null ? _d : "start"; - const endName = (_e = spec.data.end) != null ? _e : "end"; - const minValueName = `${valueName}_min`; - const maxValueName = `${valueName}_max`; - const agg = (_f = spec.data.aggregation) != null ? _f : "mean"; - let cumVal = 0; - let minVal = Number.MAX_SAFE_INTEGER; - let maxVal = Number.MIN_SAFE_INTEGER; - let binStart = Number.MIN_SAFE_INTEGER; - let binEnd = Number.MAX_SAFE_INTEGER; - Array.from(Array(numOfGenomicPositions).keys()).forEach((g, j) => { - if (bin === 1) { - const value = numericValues[j] / (agg === "mean" ? tileUnitSize : 1); - tabularData.push({ - [valueName]: value, - [columnName]: data.tileX + (j + 0.5) * tileUnitSize, - [startName]: data.tileX + j * tileUnitSize, - [endName]: data.tileX + (j + 1) * tileUnitSize, - [minValueName]: value, - [maxValueName]: value - }); - } else { - if (j % bin === 0) { - cumVal = minVal = maxVal = numericValues[j]; - binStart = j; - binEnd = j + bin; - } else if (j % bin === bin - 1) { - tabularData.push({ - [valueName]: cumVal / bin / (agg === "mean" ? tileUnitSize : 1), - [columnName]: data.tileX + (binStart + bin / 2) * tileUnitSize, - [startName]: data.tileX + binStart * tileUnitSize, - [endName]: data.tileX + binEnd * tileUnitSize, - [minValueName]: minVal, - [maxValueName]: maxVal - }); - } else if (j === numOfGenomicPositions - 1) { - const smallBin = numOfGenomicPositions % bin; - const correctedBinEnd = binStart + smallBin; - tabularData.push({ - [valueName]: cumVal / smallBin / (agg === "mean" ? tileUnitSize : 1), - [columnName]: data.tileX + (binStart + smallBin / 2) * tileUnitSize, - [startName]: data.tileX + binStart * tileUnitSize, - [endName]: data.tileX + correctedBinEnd * tileUnitSize, - [minValueName]: minVal, - [maxValueName]: maxVal - }); - } else { - cumVal += numericValues[j]; - if (minVal > numericValues[j]) - minVal = numericValues[j]; - if (maxVal < numericValues[j]) - maxVal = numericValues[j]; - } - } - }); - } else if (spec.data.type === "multivec") { - if (!("dense" in data) || data.shape === void 0) { - return; - } - const bin = (_g = spec.data.binSize) != null ? _g : 1; - const numOfTotalCategories = data.shape[0]; - const categories = (_h = spec.data.categories) != null ? _h : [...Array(numOfTotalCategories).keys()]; - const numericValues = data.dense; - const numOfGenomicPositions = data.shape[1]; - const tileUnitSize = data.tileWidth / data.tileSize; - const rowName = (_i = spec.data.row) != null ? _i : "category"; - const valueName = (_j = spec.data.value) != null ? _j : "value"; - const columnName = (_k = spec.data.column) != null ? _k : "position"; - const startName = (_l = spec.data.start) != null ? _l : "start"; - const endName = (_m = spec.data.end) != null ? _m : "end"; - const minValueName = `${valueName}_min`; - const maxValueName = `${valueName}_max`; - const agg = (_n = spec.data.aggregation) != null ? _n : "mean"; - categories.forEach((c, i) => { - let cumVal = 0; - let binStart = Number.MIN_SAFE_INTEGER; - let binEnd = Number.MAX_SAFE_INTEGER; - let minVal = Number.MAX_SAFE_INTEGER; - let maxVal = Number.MIN_SAFE_INTEGER; - Array.from(Array(numOfGenomicPositions).keys()).forEach((g, j) => { - if (bin === 1) { - const value = numericValues[numOfGenomicPositions * i + j] / (agg === "mean" ? tileUnitSize : 1); - tabularData.push({ - [rowName]: c, - [valueName]: value, - [columnName]: data.tileX + (j + 0.5) * tileUnitSize, - [startName]: data.tileX + j * tileUnitSize, - [endName]: data.tileX + (j + 1) * tileUnitSize, - [minValueName]: value, - [maxValueName]: value - }); - } else { - if (j % bin === 0) { - cumVal = minVal = maxVal = numericValues[numOfGenomicPositions * i + j]; - binStart = j; - binEnd = j + bin; - } else if (j % bin === bin - 1) { - tabularData.push({ - [rowName]: c, - [valueName]: agg === "mean" ? cumVal / bin / tileUnitSize : cumVal, - [columnName]: data.tileX + (binStart + bin / 2) * tileUnitSize, - [startName]: data.tileX + binStart * tileUnitSize, - [endName]: data.tileX + binEnd * tileUnitSize, - [minValueName]: minVal, - [maxValueName]: maxVal - }); - } else if (j === numOfGenomicPositions - 1) { - const smallBin = numOfGenomicPositions % bin; - const correctedBinEnd = binStart + smallBin; - tabularData.push({ - [rowName]: c, - [valueName]: agg === "mean" ? cumVal / smallBin / tileUnitSize : cumVal, - [columnName]: data.tileX + (binStart + smallBin / 2) * tileUnitSize, - [startName]: data.tileX + binStart * tileUnitSize, - [endName]: data.tileX + correctedBinEnd * tileUnitSize, - [minValueName]: minVal, - [maxValueName]: maxVal - }); - } else { - const value = numericValues[numOfGenomicPositions * i + j]; - cumVal += value; - if (minVal > value) - minVal = value; - if (maxVal < value) - maxVal = value; - } - } - }); - }); - } else if (spec.data.type === "matrix") { - if (!("dense" in data) || typeof data.tileY === "undefined" || typeof data.tileHeight === "undefined") { - return; - } - const numBins = Math.sqrt(data.dense.length); - const { tileX, tileY, tileWidth, tileHeight } = data; - const numericValues = data.dense; - const tileXUnitSize = tileWidth / numBins; - const tileYUnitSize = tileHeight / numBins; - const columnField = (_o = spec.data.column) != null ? _o : "x"; - const rowField = (_p = spec.data.row) != null ? _p : "y"; - const aggSize = 16; - for (let i = 0; i < numericValues.length / aggSize; i++) { - const aggLen = Math.sqrt(aggSize); - const xIndex = i * aggLen % numBins; - const yIndex = Math.floor(i * aggLen / numBins) * aggLen; - let value = NaN; - for (let c = 0; c < aggLen; c++) { - for (let r = 0; r < aggLen; r++) { - const curVal = numericValues[(yIndex + r) * numBins + (xIndex + c)]; - if (!isNaN(+curVal)) { - if (isNaN(value)) { - value = 0; - } - value += curVal; - } - } - } - if (isNaN(value)) { - continue; - } - const xs = tileX + xIndex * tileXUnitSize; - const xe = tileX + (xIndex + aggLen) * tileXUnitSize; - const ys = tileY + yIndex * tileYUnitSize; - const ye = tileY + (yIndex + aggLen) * tileYUnitSize; - const x = (xs + xe) / 2; - const y = (ys + ye) / 2; - tabularData.push({ - value, - [columnField]: x, - [`${columnField}s`]: xs, - [`${columnField}e`]: xe, - [rowField]: y, - [`${rowField}s`]: ys, - [`${rowField}e`]: ye - }); - } - } else if (spec.data.type === "beddb") { - if (!data.sparse) { - return; - } - const { genomicFields, exonIntervalFields, valueFields } = spec.data; - data.sparse.forEach((d, i) => { - const { chrOffset, fields } = d; - const datum = {}; - datum[GOSLING_DATA_ROW_UID_FIELD] = `${i}`; - genomicFields.forEach((g) => { - datum[g.name] = +fields[g.index] + chrOffset; - }); - valueFields == null ? void 0 : valueFields.forEach((v) => { - datum[v.name] = v.type === "quantitative" ? +fields[v.index] : fields[v.index]; - }); - tabularData.push({ - ...datum, - type: "gene" - // this should be described in the spec - }); - if (exonIntervalFields) { - const [exonStartField, exonEndField] = exonIntervalFields; - const exonStartStrs = fields[exonStartField.index].split(","); - const exonEndStrs = fields[exonEndField.index].split(","); - exonStartStrs.forEach((es, i2) => { - const ee = exonEndStrs[i2]; - tabularData.push({ - ...datum, - [exonStartField.name]: +es + chrOffset, - [exonEndField.name]: +ee + chrOffset, - type: "exon" - }); - if (i2 + 1 < exonStartStrs.length) { - const nextEs = exonStartStrs[i2 + 1]; - tabularData.push({ - ...datum, - [exonStartField.name]: +ee + chrOffset, - [exonEndField.name]: +nextEs + chrOffset, - type: "intron" - }); - } - }); - } - }); - } - return tabularData; -} -const $ref = "#/definitions/HiGlassSpec"; -const $schema = "http://json-schema.org/draft-07/schema#"; -const definitions = { - Assembly: { - anyOf: [ - { - "const": "hg38", - type: "string" - }, - { - "const": "hg19", - type: "string" - }, - { - "const": "hg18", - type: "string" - }, - { - "const": "hg17", - type: "string" - }, - { - "const": "hg16", - type: "string" - }, - { - "const": "mm10", - type: "string" - }, - { - "const": "mm9", - type: "string" - }, - { - "const": "unknown", - type: "string" - }, - { - $ref: "#/definitions/ChromSizes" - } - ] - }, - ChromSizes: { - description: 'Custom chromosome sizes, e.g., [["foo", 1000], ["bar", 300], ["baz", 240]]', - items: { - items: [ - { - type: "string" - }, - { - type: "number" - } - ], - maxItems: 2, - minItems: 2, - type: "array" - }, - type: "array" - }, - CombinedTrack: { - additionalProperties: false, - properties: { - contents: { - items: { - $ref: "#/definitions/Track" - }, - type: "array" - }, - height: { - type: "number" - }, - options: {}, - position: { - type: "string" - }, - type: { - "const": "combined", - type: "string" - }, - uid: { - type: "string" - }, - width: { - type: "number" - } - }, - required: [ - "type", - "contents" - ], - type: "object" - }, - Data: { - additionalProperties: false, - properties: { - assembly: { - $ref: "#/definitions/Assembly" - }, - children: { - items: {}, - type: "array" - }, - filter: { - items: { - $ref: "#/definitions/FilterTransform" - }, - type: "array" - }, - indexUrl: { - type: "string" - }, - indexUrlFetchOptions: { - $ref: "#/definitions/RequestInit" - }, - tiles: {}, - tilesetInfo: {}, - type: { - type: "string" - }, - url: { - type: "string" - }, - urlFetchOptions: { - $ref: "#/definitions/RequestInit" - } - }, - type: "object" - }, - EnumTrack: { - additionalProperties: false, - properties: { - chromInfoPath: { - type: "string" - }, - data: { - $ref: "#/definitions/Data" - }, - fromViewUid: { - type: [ - "null", - "string" - ] - }, - height: { - type: "number" - }, - options: {}, - server: { - type: "string" - }, - tilesetUid: { - type: "string" - }, - type: { - $ref: "#/definitions/EnumTrackType" - }, - uid: { - type: "string" - }, - width: { - type: "number" - }, - x: { - type: "number" - }, - y: { - type: "number" - } - }, - required: [ - "type" - ], - type: "object" - }, - EnumTrackType: { - "enum": [ - "heatmap", - "2d-annotations", - "2d-chromosome-annotations", - "2d-chromosome-grid", - "2d-chromosome-labels", - "2d-rectangle-domains", - "2d-tiles", - "arrowhead-domains", - "bedlike", - "cross-rule", - "dummy", - "horizontal-1d-annotations", - "horizontal-1d-heatmap", - "horizontal-1d-tiles", - "horizontal-1d-value-interval", - "horizontal-2d-rectangle-domains", - "horizontal-bar", - "horizontal-chromosome-grid", - "horizontal-chromosome-labels", - "horizontal-divergent-bar", - "horizontal-gene-annotations", - "horizontal-heatmap", - "horizontal-line", - "horizontal-multivec", - "horizontal-point", - "horizontal-rule", - "horizontal-vector-heatmap", - "image-tiles", - "left-axis", - "left-stacked-interval", - "mapbox-tiles", - "osm-2d-tile-ids", - "osm-tiles", - "raster-tiles", - "simple-svg", - "square-markers", - "top-axis", - "top-stacked-interval", - "vertical-1d-annotations", - "vertical-1d-heatmap", - "vertical-1d-tiles", - "vertical-1d-value-interval", - "vertical-2d-rectangle-domains", - "vertical-bar", - "vertical-bedlike", - "vertical-chromosome-grid", - "vertical-chromosome-labels", - "vertical-gene-annotations", - "vertical-heatmap", - "vertical-line", - "vertical-multivec", - "vertical-point", - "vertical-rule", - "vertical-vector-heatmap", - "viewport-projection-center", - "viewport-projection-horizontal", - "viewport-projection-vertical", - "gosling-track", - "gosling-2d-track", - "axis-track", - "text", - "dummy-track" - ], - type: "string" - }, - FilterTransform: { - anyOf: [ - { - $ref: "#/definitions/OneOfFilter" - }, - { - $ref: "#/definitions/RangeFilter" - }, - { - $ref: "#/definitions/IncludeFilter" - } - ] - }, - GenericLocks: { - additionalProperties: false, - properties: { - locksByViewUid: { - $ref: "#/definitions/LocksByViewUid" - }, - locksDict: {} - }, - required: [ - "locksByViewUid", - "locksDict" - ], - type: "object" - }, - GenomePositionSearchBox: { - additionalProperties: false, - properties: { - autocompleteId: { - type: "string" - }, - autocompleteServer: { - type: "string" - }, - chromInfoId: { - type: "string" - }, - chromInfoServer: { - type: "string" - }, - visible: { - type: "boolean" - } - }, - required: [ - "chromInfoId", - "chromInfoServer" - ], - type: "object" - }, - HeatmapTrack: { - additionalProperties: false, - properties: { - data: { - $ref: "#/definitions/Data" - }, - height: { - type: "number" - }, - options: {}, - position: { - type: "string" - }, - server: { - type: "string" - }, - tilesetUid: { - type: "string" - }, - type: { - "const": "heatmap", - type: "string" - }, - uid: { - type: "string" - }, - width: { - type: "number" - } - }, - required: [ - "type" - ], - type: "object" - }, - HiGlassSpec: { - additionalProperties: false, - properties: { - chromInfoPath: { - type: "string" - }, - compactLayout: { - type: "boolean" - }, - editable: { - type: "boolean" - }, - exportViewUrl: { - type: "string" - }, - locationLocks: { - $ref: "#/definitions/GenericLocks" - }, - trackSourceServers: { - items: { - type: "string" - }, - type: "array" - }, - tracksEditable: { - type: "boolean" - }, - valueScaleLocks: { - $ref: "#/definitions/ValueScaleLocks" - }, - viewEditable: { - type: "boolean" - }, - views: { - items: { - $ref: "#/definitions/View" - }, - type: "array" - }, - zoomFixed: { - type: "boolean" - }, - zoomLocks: { - $ref: "#/definitions/GenericLocks" - } - }, - required: [ - "views", - "zoomLocks", - "locationLocks" - ], - type: "object" - }, - IncludeFilter: { - additionalProperties: false, - properties: { - field: { - description: "A filter is applied based on the values of the specified data field", - type: "string" - }, - include: { - description: "Check whether the value includes a substring.", - type: "string" - }, - not: { - description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', - type: "boolean" - }, - type: { - "const": "filter", - type: "string" - } - }, - required: [ - "field", - "include", - "type" - ], - type: "object" - }, - IndependentViewportProjectionTrack: { - additionalProperties: false, - properties: { - fromViewUid: { - type: "null" - }, - options: {}, - projectionXDomain: { - items: { - type: "number" - }, - type: "array" - }, - projectionYDomain: { - items: { - type: "number" - }, - type: "array" - }, - transforms: { - items: {}, - type: "array" - }, - type: { - "enum": [ - "viewport-projection-horizontal", - "viewport-projection-vertical", - "viewport-projection-center" - ], - type: "string" - }, - uid: { - type: "string" - }, - width: { - type: "number" - }, - x: { - type: "number" - }, - y: { - type: "number" - } - }, - required: [ - "type" - ], - type: "object" - }, - Layout: { - additionalProperties: false, - properties: { - h: { - type: "number" - }, - w: { - type: "number" - }, - x: { - type: "number" - }, - y: { - type: "number" - } - }, - required: [ - "h", - "w", - "x", - "y" - ], - type: "object" - }, - LocksByViewUid: { - additionalProperties: { - type: "string" - }, - type: "object" - }, - OneOfFilter: { - additionalProperties: false, - properties: { - field: { - description: "A filter is applied based on the values of the specified data field", - type: "string" - }, - not: { - description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', - type: "boolean" - }, - oneOf: { - description: "Check whether the value is an element in the provided list.", - items: { - type: [ - "string", - "number", - "null" - ] - }, - type: "array" - }, - type: { - "const": "filter", - type: "string" - } - }, - required: [ - "field", - "oneOf", - "type" - ], - type: "object" - }, - Overlay: { - additionalProperties: false, - properties: { - chromInfoPath: { - type: "string" - }, - includes: { - items: {}, - type: "array" - }, - options: { - $ref: "#/definitions/OverlayOptions" - }, - type: { - type: "string" - }, - uid: { - type: "string" - } - }, - type: "object" - }, - OverlayOptions: { - additionalProperties: false, - properties: { - extent: { - items: {}, - type: "array" - }, - fill: { - type: "string" - }, - fillOpacity: { - type: "number" - }, - minWidth: { - type: "number" - }, - outline: { - type: "string" - }, - outlineOpacity: { - type: "number" - }, - outlinePos: { - anyOf: [ - { - items: {}, - type: "array" - }, - { - type: "string" - } - ] - }, - outlineWidth: { - type: "number" - }, - stroke: { - type: "string" - }, - strokeOpacity: { - type: "number" - }, - strokePos: { - anyOf: [ - { - items: {}, - type: "array" - }, - { - type: "string" - } - ] - }, - strokeWidth: { - type: "number" - } - }, - type: "object" - }, - RangeFilter: { - additionalProperties: false, - properties: { - field: { - description: "A filter is applied based on the values of the specified data field", - type: "string" - }, - inRange: { - description: "Check whether the value is in a number range.", - items: { - type: "number" - }, - type: "array" - }, - not: { - description: 'when `{"not": true}`, apply a NOT logical operation to the filter.\n\n__Default:__ `false`', - type: "boolean" - }, - type: { - "const": "filter", - type: "string" - } - }, - required: [ - "field", - "inRange", - "type" - ], - type: "object" - }, - RequestInit: { - additionalProperties: false, - properties: { - headers: { - type: "object" - } - }, - type: "object" - }, - Track: { - anyOf: [ - { - $ref: "#/definitions/HeatmapTrack" - }, - { - $ref: "#/definitions/CombinedTrack" - }, - { - $ref: "#/definitions/IndependentViewportProjectionTrack" - }, - { - $ref: "#/definitions/EnumTrack" - } - ] - }, - Tracks: { - additionalProperties: false, - properties: { - bottom: { - items: { - $ref: "#/definitions/Track" - }, - type: "array" - }, - center: { - items: { - $ref: "#/definitions/Track" - }, - type: "array" - }, - gallery: { - items: { - $ref: "#/definitions/Track" - }, - type: "array" - }, - left: { - items: { - $ref: "#/definitions/Track" - }, - type: "array" - }, - right: { - items: { - $ref: "#/definitions/Track" - }, - type: "array" - }, - top: { - items: { - $ref: "#/definitions/Track" - }, - type: "array" - }, - whole: { - items: { - $ref: "#/definitions/Track" - }, - type: "array" - } - }, - required: [ - "top", - "left", - "center", - "right", - "bottom", - "gallery", - "whole" - ], - type: "object" - }, - ValueScaleLocks: { - additionalProperties: false, - properties: { - locksByViewUid: { - $ref: "#/definitions/LocksByViewUid" - }, - locksDict: {} - }, - required: [ - "locksByViewUid" - ], - type: "object" - }, - View: { - additionalProperties: false, - properties: { - autocompleteSource: { - type: "string" - }, - chromInfoPath: { - type: "string" - }, - genomePositionSearchBox: { - $ref: "#/definitions/GenomePositionSearchBox" - }, - genomePositionSearchBoxVisible: { - type: "boolean" - }, - initialXDomain: { - items: { - type: "number" - }, - type: "array" - }, - initialYDomain: { - items: { - type: "number" - }, - type: "array" - }, - layout: { - $ref: "#/definitions/Layout" - }, - overlays: { - items: { - $ref: "#/definitions/Overlay" - }, - type: "array" - }, - selectionView: { - type: "boolean" - }, - tracks: { - $ref: "#/definitions/Tracks" - }, - uid: { - type: "string" - }, - zoomFixed: { - type: "boolean" - }, - zoomLimits: { - items: { - type: [ - "number", - "null" - ] - }, - maxItems: 2, - minItems: 2, - type: "array" - } - }, - required: [ - "tracks", - "layout" - ], - type: "object" - } -}; -const HiGlassSchema = { - $ref, - $schema, - definitions -}; -function getNumericDomain(domain, assembly) { - const chromInterval = computeChromSizes(assembly).interval; - if ("chromosome" in domain) { - const isThereChr = Object.keys(chromInterval).find((chr) => chr === domain.chromosome); - if (!isThereChr) { - return; - } - } - if (IsDomainChr(domain)) { - return [chromInterval[domain.chromosome][0] + 1, chromInterval[domain.chromosome][1]]; - } else if (IsDomainInterval(domain)) { - return domain.interval; - } else if (IsDomainChrInterval(domain)) { - const chrStart = chromInterval[domain.chromosome][0]; - const [start, end] = domain.interval; - return [chrStart + start, chrStart + end]; - } -} -function shareScaleAcrossTracks(trackModels, force) { - const globalDomain = {}; - const channelKeys = SUPPORTED_CHANNELS; - trackModels.forEach((model) => { - channelKeys.forEach((channelKey) => { - const channel = model.spec()[channelKey]; - if (!IsChannelDeep(channel) || channel.domain === void 0) { - return; - } - const { domain, type } = channel; - if (type === "quantitative") { - const numericDomain = Array.from(domain); - if (!globalDomain[channelKey]) { - globalDomain[channelKey] = numericDomain; - } else { - const channelGlobalDomain = globalDomain[channelKey]; - if (channelGlobalDomain[0] > numericDomain[0]) { - channelGlobalDomain[0] = numericDomain[0]; - } - if (channelGlobalDomain[1] < numericDomain[1]) { - channelGlobalDomain[1] = numericDomain[1]; - } - } - } else if (type === "nominal") { - const nominalDomain = Array.from(domain); - if (!globalDomain[channelKey]) { - globalDomain[channelKey] = nominalDomain; - } else { - globalDomain[channelKey] = Array.from( - /* @__PURE__ */ new Set([...globalDomain[channelKey], ...nominalDomain]) - ); - } - } - }); - }); - trackModels.forEach((model) => { - channelKeys.forEach((channelKey) => { - const channel = model.spec()[channelKey]; - if (IsChannelDeep(channel) && channel.type === "genomic") - return; - model.setChannelDomain(channelKey, globalDomain[channelKey], force); - model.generateScales(); - }); - model.updateChannelValue(); - }); -} -const example = { - compactLayout: false, - trackSourceServers: ["https://server.gosling-lang.org/api/v1/"], - views: [ - { - genomePositionSearchBoxVisible: false, - genomePositionSearchBox: { - autocompleteServer: "https://higlass.io/api/v1", - autocompleteId: "P0PLbQMwTYGy-5uPIQid7A", - chromInfoServer: "https://higlass.io/api/v1", - chromInfoId: "hg38" - }, - layout: { x: 0, y: 0, w: 6.4, h: 600 }, - tracks: { - top: [], - left: [ - { - type: "combined", - width: 130, - height: 600, - contents: [ - { - type: "gosling-track", - server: "https://server.gosling-lang.org/api/v1/", - tilesetUid: "cistrome-multivec", - width: 130, - height: 600, - options: { - showMousePosition: true, - mousePositionColor: "#000000", - fontSize: 24, - labelPosition: "none", - labelShowResolution: false, - labelColor: "black", - labelBackgroundColor: "white", - labelTextOpacity: 1, - labelLeftMargin: 1, - labelTopMargin: 1, - labelRightMargin: 0, - labelBottomMargin: 0, - backgroundColor: "transparent", - spec: { - spacing: 10, - orientation: "vertical", - assembly: "hg38", - layout: "linear", - static: false, - xDomain: { interval: [0, 1e9] }, - centerRadius: 0.3, - xOffset: 0, - yOffset: 0, - style: { outlineWidth: 0.5 }, - data: { - url: "https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec", - type: "multivec", - row: "sample", - column: "position", - value: "peak", - categories: ["sample 1", "sample 2", "sample 3", "sample 4"], - binSize: 4 - }, - mark: "rect", - x: { - field: "start", - type: "genomic", - axis: "left", - domain: { interval: [0, 1e9] }, - linkingId: "7f94b74e-25ec-4e67-8c75-3dc0f1b0d6bd" - }, - xe: { field: "end", type: "genomic" }, - row: { - field: "sample", - type: "nominal", - legend: true - }, - color: { - field: "peak", - type: "quantitative", - legend: true - }, - tooltip: [ - { - field: "start", - type: "genomic", - alt: "Start Position" - }, - { - field: "end", - type: "genomic", - alt: "End Position" - }, - { - field: "peak", - type: "quantitative", - alt: "Value", - format: ".2" - }, - { field: "sample", type: "nominal", alt: "Sample" } - ], - width: 160, - height: 600, - overlayOnPreviousTrack: false - }, - theme: { - base: "light", - root: { - background: "white", - titleColor: "black", - titleBackgroundColor: "transparent", - titleFontSize: 18, - titleFontFamily: "Arial", - titleAlign: "left", - titleFontWeight: "bold", - subtitleColor: "gray", - subtitleBackgroundColor: "transparent", - subtitleFontSize: 16, - subtitleFontFamily: "Arial", - subtitleFontWeight: "normal", - subtitleAlign: "left", - mousePositionColor: "#000000" - }, - track: { - background: "transparent", - alternatingBackground: "transparent", - titleColor: "black", - titleBackground: "white", - titleFontSize: 24, - titleAlign: "left", - outline: "black", - outlineWidth: 1 - }, - legend: { - position: "top", - background: "white", - backgroundOpacity: 0.7, - labelColor: "black", - labelFontSize: 12, - labelFontWeight: "normal", - labelFontFamily: "Arial", - backgroundStroke: "#DBDBDB", - tickColor: "black" - }, - axis: { - tickColor: "black", - labelColor: "black", - labelFontSize: 12, - labelFontWeight: "normal", - labelFontFamily: "Arial", - baselineColor: "black", - gridColor: "#E3E3E3", - gridStrokeWidth: 1, - gridStrokeType: "solid", - gridStrokeDash: [4, 4] - }, - markCommon: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - point: { - color: "#E79F00", - size: 3, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - rect: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - triangle: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - area: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - line: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - bar: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - rule: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 1, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - link: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 1, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - text: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6], - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - color: "gray", - size: 1, - stroke: "black", - strokeWidth: 1, - opacity: 0.3, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - } - } - } - } - ] - }, - { - uid: "15483511-f6fb-11eb-914b-976b6ecda162", - type: "axis-track", - chromInfoPath: "https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes", - options: { - layout: "linear", - outerRadius: null, - width: 160, - height: 600, - theme: { - base: "light", - root: { - background: "white", - titleColor: "black", - titleBackgroundColor: "transparent", - titleFontSize: 18, - titleFontFamily: "Arial", - titleAlign: "left", - titleFontWeight: "bold", - subtitleColor: "gray", - subtitleBackgroundColor: "transparent", - subtitleFontSize: 16, - subtitleFontFamily: "Arial", - subtitleFontWeight: "normal", - subtitleAlign: "left", - mousePositionColor: "#000000" - }, - track: { - background: "transparent", - alternatingBackground: "transparent", - titleColor: "black", - titleBackground: "white", - titleFontSize: 24, - titleAlign: "left", - outline: "black", - outlineWidth: 1 - }, - legend: { - position: "top", - background: "white", - backgroundOpacity: 0.7, - labelColor: "black", - labelFontSize: 12, - labelFontWeight: "normal", - labelFontFamily: "Arial", - backgroundStroke: "#DBDBDB", - tickColor: "black" - }, - axis: { - tickColor: "black", - labelColor: "black", - labelFontSize: 12, - labelFontWeight: "normal", - labelFontFamily: "Arial", - baselineColor: "black", - gridColor: "#E3E3E3", - gridStrokeWidth: 1, - gridStrokeType: "solid", - gridStrokeDash: [4, 4] - }, - markCommon: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - point: { - color: "#E79F00", - size: 3, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - rect: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - triangle: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - area: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - line: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - bar: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - rule: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 1, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - link: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 1, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - text: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6], - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - color: "gray", - size: 1, - stroke: "black", - strokeWidth: 1, - opacity: 0.3, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - } - }, - assembly: "hg38", - stroke: "transparent", - color: "black", - fontSize: 12, - fontFamily: "Arial", - fontWeight: "normal", - tickColor: "black", - tickFormat: "plain", - tickPositions: "even", - reverseOrientation: false - }, - width: 30 - } - ], - center: [], - right: [], - bottom: [], - gallery: [], - whole: [] - }, - initialXDomain: [0, 1e9], - initialYDomain: [0, 1e9], - zoomFixed: false, - zoomLimits: [1, null], - uid: "15483510-f6fb-11eb-914b-976b6ecda162", - chromInfoPath: "https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes" - }, - { - genomePositionSearchBoxVisible: false, - genomePositionSearchBox: { - autocompleteServer: "https://higlass.io/api/v1", - autocompleteId: "P0PLbQMwTYGy-5uPIQid7A", - chromInfoServer: "https://higlass.io/api/v1", - chromInfoId: "hg38" - }, - layout: { x: 6.8, y: 0, w: 5.2, h: 600 }, - tracks: { - top: [], - left: [ - { - type: "combined", - width: 130, - height: 600, - contents: [ - { - type: "gosling-track", - server: "https://server.gosling-lang.org/api/v1/", - tilesetUid: "cistrome-multivec", - width: 130, - height: 600, - options: { - showMousePosition: true, - mousePositionColor: "#000000", - fontSize: 24, - labelPosition: "none", - labelShowResolution: false, - labelColor: "black", - labelBackgroundColor: "white", - labelTextOpacity: 1, - labelLeftMargin: 1, - labelTopMargin: 1, - labelRightMargin: 0, - labelBottomMargin: 0, - backgroundColor: "transparent", - spec: { - spacing: 10, - orientation: "vertical", - assembly: "hg38", - layout: "linear", - static: false, - xDomain: { interval: [0, 1e9] }, - centerRadius: 0.3, - xOffset: 0, - yOffset: 0, - style: { outlineWidth: 0.5 }, - data: { - url: "https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec", - type: "multivec", - row: "sample", - column: "position", - value: "peak", - categories: ["sample 1", "sample 2", "sample 3", "sample 4"], - binSize: 4 - }, - mark: "rect", - x: { - field: "start", - type: "genomic", - domain: { interval: [0, 1e9] }, - linkingId: "7f94b74e-25ec-4e67-8c75-3dc0f1b0d6bd" - }, - xe: { field: "end", type: "genomic" }, - row: { - field: "sample", - type: "nominal", - legend: true - }, - color: { - field: "peak", - type: "quantitative", - legend: true - }, - tooltip: [ - { - field: "start", - type: "genomic", - alt: "Start Position" - }, - { - field: "end", - type: "genomic", - alt: "End Position" - }, - { - field: "peak", - type: "quantitative", - alt: "Value", - format: ".2" - }, - { field: "sample", type: "nominal", alt: "Sample" } - ], - width: 130, - height: 600 - }, - theme: { - base: "light", - root: { - background: "white", - titleColor: "black", - titleBackgroundColor: "transparent", - titleFontSize: 18, - titleFontFamily: "Arial", - titleAlign: "left", - titleFontWeight: "bold", - subtitleColor: "gray", - subtitleBackgroundColor: "transparent", - subtitleFontSize: 16, - subtitleFontFamily: "Arial", - subtitleFontWeight: "normal", - subtitleAlign: "left", - mousePositionColor: "#000000" - }, - track: { - background: "transparent", - alternatingBackground: "transparent", - titleColor: "black", - titleBackground: "white", - titleFontSize: 24, - titleAlign: "left", - outline: "black", - outlineWidth: 1 - }, - legend: { - position: "top", - background: "white", - backgroundOpacity: 0.7, - labelColor: "black", - labelFontSize: 12, - labelFontWeight: "normal", - labelFontFamily: "Arial", - backgroundStroke: "#DBDBDB", - tickColor: "black" - }, - axis: { - tickColor: "black", - labelColor: "black", - labelFontSize: 12, - labelFontWeight: "normal", - labelFontFamily: "Arial", - baselineColor: "black", - gridColor: "#E3E3E3", - gridStrokeWidth: 1, - gridStrokeType: "solid", - gridStrokeDash: [4, 4] - }, - markCommon: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - point: { - color: "#E79F00", - size: 3, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - rect: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - triangle: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - area: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - line: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - bar: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - rule: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 1, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - link: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 1, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - }, - text: { - color: "#E79F00", - size: 1, - stroke: "black", - strokeWidth: 0, - opacity: 1, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6], - textAnchor: "middle", - textFontWeight: "normal" - }, - brush: { - color: "gray", - size: 1, - stroke: "black", - strokeWidth: 1, - opacity: 0.3, - nominalColorRange: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - ], - quantitativeSizeRange: [2, 6] - } - } - } - } - ] - } - ], - center: [], - right: [], - bottom: [], - gallery: [], - whole: [] - }, - initialXDomain: [0, 1e9], - initialYDomain: [0, 1e9], - zoomFixed: false, - zoomLimits: [1, null], - uid: "154b1b40-f6fb-11eb-914b-976b6ecda162" - } - ], - zoomLocks: { locksByViewUid: {}, locksDict: {} }, - locationLocks: { locksByViewUid: {}, locksDict: {} }, - editable: false, - chromInfoPath: "https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes" -}; -const HIGLASS_AXIS_SIZE = 30; -const getViewTemplate = (assembly) => { - return { - genomePositionSearchBoxVisible: false, - genomePositionSearchBox: { - autocompleteServer: "https://higlass.io/api/v1", - autocompleteId: getAutoCompleteId(assembly), - chromInfoServer: "https://higlass.io/api/v1", - chromInfoId: assembly != null ? assembly : "hg38" - }, - layout: { w: 12, h: 12, x: 0, y: 0 }, - tracks: { - top: [], - left: [], - center: [], - right: [], - bottom: [], - gallery: [], - whole: [] - }, - initialXDomain: [0, computeChromSizes(assembly).total], - initialYDomain: [0, computeChromSizes(assembly).total], - zoomFixed: false - }; -}; -class HiGlassModel { - constructor() { - __publicField(this, "assembly"); - __publicField(this, "orientation"); - __publicField(this, "hg"); - this.assembly = "hg38"; - this.hg = { - compactLayout: false, - trackSourceServers: [], - views: [], - zoomLocks: { - locksByViewUid: {}, - locksDict: {} - }, - locationLocks: { - locksByViewUid: {}, - locksDict: {} - } - }; - this.setEditable(false); - } - spec() { - return this.hg; - } - setViewOrientation(orientation) { - this.orientation = orientation; - return this; - } - addDefaultView(uid, assembly) { - this.hg.views.push(JSON.parse(JSON.stringify({ ...getViewTemplate(assembly), uid }))); - return this; - } - setAssembly(assembly) { - this.assembly = assembly; - this.setChromInfoPath(computeChromSizes(this.assembly).path); - return this; - } - getAssembly() { - return this.assembly; - } - setTextTrack(width, height, text, textColor = "black", fontSize = 14, fontWeight = "normal", align = "left", backgroundColor = "transparent", fontFamily = "Arial") { - var _a; - if (this.getLastView()) { - (_a = this.getLastView().tracks.top) == null ? void 0 : _a.push({ - type: "text", - width, - height, - options: { - backgroundColor, - textColor, - fontSize, - fontWeight, - fontFamily, - offsetY: 0, - // offset from the top of the track - align, - text - } - }); - } - return this; - } - /** - * Add a dummy track to the last view - * @param track - */ - setDummyTrack(track) { - var _a; - if (this.getLastView()) { - (_a = this.getLastView().tracks.top) == null ? void 0 : _a.push({ - type: "dummy-track", - width: track.width, - height: track.height, - options: { - width: track.width, - height: track.height, - title: track.title, - ...track.style - } - }); - } - return this; - } - addBrush(layout, viewId, theme, fromViewUid, style) { - var _a, _b, _c, _d, _e, _f; - if (!fromViewUid) - return; - (_f = this.getView(viewId)) == null ? void 0 : _f.tracks.whole.push({ - // type: 'viewport-projection-center', - type: layout === "circular" ? "brush-track" : "viewport-projection-horizontal", - uid: uuid(), - fromViewUid, - options: { - projectionFillColor: (_a = style == null ? void 0 : style.color) != null ? _a : theme.brush.color, - projectionStrokeColor: (_b = style == null ? void 0 : style.stroke) != null ? _b : theme.brush.stroke, - projectionFillOpacity: (_c = style == null ? void 0 : style.opacity) != null ? _c : theme.brush.opacity, - projectionStrokeOpacity: (_d = style == null ? void 0 : style.opacity) != null ? _d : theme.brush.opacity, - strokeWidth: (_e = style == null ? void 0 : style.strokeWidth) != null ? _e : theme.brush.strokeWidth, - startAngle: style == null ? void 0 : style.startAngle, - endAngle: style == null ? void 0 : style.endAngle, - innerRadius: style == null ? void 0 : style.innerRadius, - outerRadius: style == null ? void 0 : style.outerRadius - } - }); - return this; - } - getLastView() { - return this.hg.views[this.hg.views.length - 1]; - } - getMainTrackPosition() { - return this.orientation === "vertical" ? "left" : "center"; - } - /** - * Get the last view that renders any visualization, so skiping empty tracks. - */ - getLastVisView() { - const vs = this.hg.views.filter((v) => { - var _a, _b; - return ((_b = (_a = v.tracks[this.getMainTrackPosition()]) == null ? void 0 : _a[0]) == null ? void 0 : _b.type) === "combined"; - }); - return vs[vs.length - 1]; - } - getView(viewId) { - return this.hg.views.find((d) => d.uid === viewId); - } - validateSpec(silence = false) { - return validateSpec(HiGlassSchema, this.spec(), silence).state === "success"; - } - setDomain(xDomain, yDomain) { - if (xDomain) { - this.getLastView().initialXDomain = getNumericDomain(xDomain, this.getAssembly()); - } - if (yDomain) { - this.getLastView().initialYDomain = getNumericDomain(yDomain, this.getAssembly()); - } - return this; - } - /** - * This is a hacky function that adjust x domain to properly show vertical tracks. - * - * In HiGlass, the range of vertical tracks is affected by a center track. For example, if a center track is small, the vertical tracks become small as well. - * Currently, the actual size of center track for vertical gosling tracks is `1px`. So, we re-scale the x domain so that gosling's vertical tracks properly use the entire height of a view. - * @param orientation - * @param width - * @returns - */ - adjustDomain(orientation = "horizontal", width, height) { - if (orientation !== "vertical") { - return this; - } - const domain = this.getLastView().initialXDomain; - if (!domain) { - return this; - } - const [start, end] = domain; - const size = end - start; - const center = (start + end) / 2; - this.getLastView().initialXDomain = [ - center - size / width / 2 / height * width, - center + size / width / 2 / height * width - ]; - return this; - } - /** - * Allow a zoom interaction? - */ - setZoomFixed(zoomFixed) { - this.getLastView().zoomFixed = zoomFixed; - return this; - } - /** - * Set limits of zoom levels in base pairs. - */ - setZoomLimits(zoomLimits) { - this.getLastView().zoomLimits = zoomLimits; - return this; - } - setLayout(layout) { - this.getLastView().layout = layout; - return this; - } - setEditable(editable) { - this.hg.editable = editable; - return this; - } - setChromInfoPath(chromInfoPath) { - if (this.getLastView()) { - this.getLastView().chromInfoPath = chromInfoPath; - } - this.hg.chromInfoPath = chromInfoPath; - return this; - } - addTrackSourceServers(trackSourceServers) { - var _a, _b; - if (trackSourceServers && ((_a = this.hg.trackSourceServers) == null ? void 0 : _a.indexOf(trackSourceServers)) === -1) - (_b = this.hg.trackSourceServers) == null ? void 0 : _b.push(trackSourceServers); - return this; - } - setMainTrack(track) { - var _a; - if (!this.getLastView()) - return this; - this.getLastView().tracks[this.getMainTrackPosition()] = [ - { - type: "combined", - uid: `${(_a = track.uid) != null ? _a : uuid()}-${this.getMainTrackPosition()}-combined`, - // !! Hacky, but it is important to subtract 1px. Currently, HiGlass does not well handle a case where a center track is zero width (e.g., linking between views that contain zero-width center tracks). - // https://github.com/higlass/higlass/pull/1041 - width: track.width - 1, - height: track.height, - contents: [track] - } - ]; - return this; - } - addTrackToCombined(track) { - var _a; - if (!this.getLastVisView()) - return this; - (_a = this.getLastVisView().tracks[this.getMainTrackPosition()][0]) == null ? void 0 : _a.contents.push(track); - return this; - } - setAxisTrack(position, type = "regular", options) { - if (!this.hg.views) - return this; - const widthOrHeight = position === "left" || position === "right" ? "width" : "height"; - const axisTrackTemplate = { - // uid: options.id ?? uuid(), // TODO: turning this on makes some tick labels hidden - type: "axis-track", - chromInfoPath: this.hg.chromInfoPath, - options: { - ...options, - assembly: this.getAssembly(), - stroke: "transparent", - // text outline - color: options.theme.axis.labelColor, - labelMargin: options.theme.axis.labelMargin, - excludeChrPrefix: options.theme.axis.labelExcludeChrPrefix, - fontSize: options.theme.axis.labelFontSize, - fontFamily: options.theme.axis.labelFontFamily, - fontWeight: options.theme.axis.labelFontWeight, - tickColor: options.theme.axis.tickColor, - tickFormat: type === "narrower" ? "si" : "plain", - tickPositions: type === "regular" ? "even" : "ends", - reverseOrientation: position === "bottom" || position === "right" ? true : false - } - }; - if (options.layout === "circular") { - this.addTrackToCombined({ - ...axisTrackTemplate, - options: { ...axisTrackTemplate.options, layout: "circular" } - }); - } else { - const axisTrack = { ...axisTrackTemplate, [widthOrHeight]: HIGLASS_AXIS_SIZE }; - if (position === "left") { - if (this.getLastView().tracks.left.filter((d) => d.type === "axis-track").length !== 0) { - return this; - } - this.getLastView().tracks.left = insertItemToArray(this.getLastView().tracks.left, 0, axisTrack); - } else if (position === "right") { - if (this.getLastView().tracks.right.filter((d) => d.type === "axis-track").length !== 0) { - return this; - } - this.getLastView().tracks.right.push(axisTrack); - } else { - if (this.getLastView().tracks[position].filter((d) => d.type === "axis-track").length !== 0) { - return this; - } - this.getLastView().tracks[position].push(axisTrack); - } - } - return this; - } - setExampleHiglassViewConfig() { - this.hg = example; - } -} -function logicalComparison(value, op, ref, transitionPadding) { - const padding = transitionPadding && transitionPadding !== 0 ? transitionPadding : void 0; - let alpha = 0; - switch (op) { - case "less-than": - case "LT": - case "lt": - alpha = ref > value ? padding ? (ref - value) / padding : 1 : 0; - break; - case "less-than-or-equal-to": - case "LTET": - case "ltet": - alpha = ref >= value ? padding ? (ref - value) / padding : 1 : 0; - break; - case "greater-than": - case "GT": - case "gt": - alpha = ref < value ? padding ? (value - ref) / padding : 1 : 0; - break; - case "greater-than-or-equal-to": - case "GTET": - case "gtet": - alpha = ref <= value ? padding ? (value - ref) / padding : 1 : 0; - break; - } - return Math.max(Math.min(1, alpha), 0); -} -const CHANNEL_DEFAULTS = { - // https://mikemol.github.io/technique/colorblind/2018/02/11/color-safe-palette.html - NOMINAL_COLOR: [ - "#E79F00", - "#029F73", - "#0072B2", - "#CB7AA7", - "#D45E00", - "#57B4E9", - "#EFE441" - /*'#000000'*/ - ], - // https://colorcet.holoviz.org/user_guide/Categorical.html - NOMINAL_COLOR_EXTENDED: [ - "#d60000", - "#018700", - "#b500ff", - "#05acc6", - "#97ff00", - "#ffa52f", - "#ff8ec8", - "#79525e", - "#00fdcf", - "#afa5ff", - "#93ac83", - "#9a6900", - "#366962", - "#d3008c", - "#fdf490", - "#c86e66", - "#9ee2ff", - "#00c846", - "#a877ac", - "#b8ba01", - "#f4bfb1", - "#ff28fd", - "#f2cdff", - "#009e7c", - "#ff6200", - "#56642a", - "#953f1f", - "#90318e", - "#ff3464", - "#a0e491", - "#8c9ab1", - "#829026", - "#ae083f", - "#77c6ba", - "#bc9157", - "#e48eff", - "#72b8ff", - "#c6a5c1", - "#ff9070", - "#d3c37c", - "#bceddb", - "#6b8567", - "#916e56", - "#f9ff00", - "#bac1df", - "#ac567c", - "#ffcd03", - "#ff49b1", - "#c15603", - "#5d8c90", - "#c144bc", - "#00753f", - "#ba6efd", - "#00d493", - "#00ff75", - "#49a150", - "#cc9790", - "#00ebed", - "#db7e01", - "#f77589", - "#b89500", - "#c84248", - "#00cff9", - "#755726", - "#85d401", - "#ebffd4", - "#a77b87", - "#db72c8", - "#cae256", - "#8abf5d", - "#a1216b", - "#855b89", - "#89bacf", - "#ffbad6", - "#b6cfaa", - "#97414d", - "#67aa00", - "#fde1b1", - "#ff3628", - "#80793d", - "#d6e8ff", - "#a795c6", - "#7ea59a", - "#d182a3", - "#54823b", - "#e6a872", - "#9cffff", - "#da5480", - "#05b3aa", - "#ffaaf6", - "#d1afef", - "#da015d", - "#ac1a13", - "#60b385", - "#d442fd", - "#acaa59", - "#fb9ca7", - "#b3723b", - "#f26952", - "#aed1d4", - "#9affc3", - "#dbb333", - "#eb01c3", - "#9900c4", - "#cfff9e", - "#a55949", - "#3b6d01", - "#008579", - "#959167", - "#89dbb3", - "#6d7400", - "#aa5dca", - "#07ef00", - "#804f3d", - "#d88052", - "#ffc862", - "#b8009e", - "#99acdd", - "#904f00", - "#8c4470", - "#4f6e52", - "#ff8734", - "#c68ecd", - "#d4e29e", - "#b1826d", - "#9cfb75", - "#56dd77", - "#f90087", - "#a1cdff", - "#13cad1", - "#118e54", - "#d154a5", - "#00dfc3", - "#a3832f", - "#77975b", - "#baaa80", - "#70a3af", - "#d6fbff", - "#e8013a", - "#d84621", - "#ff82ed", - "#b63862", - "#b6cd72", - "#97626b", - "#897490", - "#00a316", - "#00f4a1", - "#bf90f2", - "#89e4d8", - "#a34d95", - "#6e5d00", - "#8cc68e", - "#95aa2a", - "#c672dd", - "#b33b01", - "#d69a36", - "#dfacb6", - "#009aa0", - "#599000", - "#97bca8", - "#ac8ca8", - "#dad4ff", - "#547c72", - "#00ba69", - "#ffc38e", - "#b800d4", - "#dfcf5b", - "#629a7b", - "#bfedbc", - "#c1bdfd", - "#80d3dd", - "#e2857e", - "#f9eb4d", - "#bf6d82", - "#caff4f", - "#ef72aa", - "#ed67ff", - "#9946ae", - "#6d6942", - "#e25660", - "#dd662d", - "#9cdb5d", - "#e29ccf", - "#b87500", - "#c6002d", - "#dfbcda", - "#59b5df", - "#ff59da", - "#38c1a1", - "#9e698c", - "#acaac8", - "#95622f", - "#b55662", - "#2b7e60", - "#b1e400", - "#eda590", - "#95fde2", - "#ff548e", - "#bd6ea1", - "#aa3b36", - "#d8cf00", - "#aa80cd", - "#a08052", - "#e100e8", - "#c35b3d", - "#b53a85", - "#8c7700", - "#dbbc95", - "#529e93", - "#afbc82", - "#91b5b6", - "#a75423", - "#ffd4ef", - "#79ae6b", - "#5db54b", - "#80fb9a", - "#48ffef", - "#979548", - "#9387a7", - "#31d400", - "#6ee956", - "#b6d4eb", - "#705470", - "#f2db8a", - "#aad4c1", - "#7ecdf2", - "#89ba00", - "#64b6ba", - "#ffb500", - "#c38285", - "#caaa5e", - "#647748", - "#59e2ff", - "#df4dcd", - "#e9ff79", - "#bc66b8", - "#c395a5", - "#64c674", - "#d19570", - "#70cf4f", - "#aa6e66", - "#9c60a5", - "#00b800", - "#e299b3", - "#bc006b", - "#b3e8ef", - "#cdbfe4", - "#77a342", - "#856277", - "#568e5b", - "#9eafc4", - "#e82fa0", - "#247c2a", - "#826723", - "#bfbc4d", - "#ddd3a5" - ], - QUANTITATIVE_COLOR: "viridis", - SIZE: 3, - SIZE_RANGE: [2, 6] -}; -function getTheme(theme = "light") { - if (typeof theme === "string") { - if (isThereTheme(theme)) { - return getTheme$1(theme); - } else { - return getTheme$1("light"); - } - } else { - let baseSpec = JSON.parse(JSON.stringify(getTheme$1("light"))); - if (isThereTheme(theme.base)) { - baseSpec = getTheme$1(theme.base); - } - Object.keys(baseSpec).forEach((k) => { - if (theme[k] && k !== "base") { - baseSpec[k] = Object.assign( - JSON.parse(JSON.stringify(baseSpec[k])), - JSON.parse(JSON.stringify(theme[k])) - ); - } - }); - return baseSpec; - } -} -class GoslingTrackModel { - constructor(spec, data, theme) { - __publicField(this, "id"); - __publicField(this, "theme"); - /* spec */ - __publicField(this, "specOriginal"); - // original spec of users - __publicField(this, "specComplete"); - // processed spec, being used in visualizations - /* data */ - __publicField(this, "dataAggregated"); - /* channel scales */ - __publicField(this, "channelScales"); - /* mouse events */ - __publicField(this, "mouseEventModel"); - this.id = uuid(); - this.theme = theme != null ? theme : getTheme(); - this.dataAggregated = data; - this.specOriginal = spec; - this.specComplete = spec; - this.channelScales = {}; - this.mouseEventModel = new MouseEventModel(); - const validity = this.validateSpec(); - if (!validity.valid) { - console.warn("Gosling specification is not valid!", validity.errorMessages); - return; - } - this.generateCompleteSpec(this.specComplete); - this.flipRanges(this.specComplete); - this.generateScales(); - this.dataAggregated = aggregateData(this.spec(), this.dataAggregated); - } - getId() { - return this.id; - } - originalSpec() { - return this.specOriginal; - } - spec() { - return this.specComplete; - } - data() { - return this.dataAggregated; - } - getMouseEventModel() { - return this.mouseEventModel; - } - /** - * Fill the missing options with default values or with the values calculated based on the data. - */ - generateCompleteSpec(spec) { - if (!spec.width || !spec.height) { - console.warn("Size of track is not determined yet."); - return; - } - if (spec.orientation === "vertical") { - const width = spec.width; - spec.width = spec.height; - spec.height = width; - } - const xOrY = this.getGenomicChannelKey(); - let isAxisShown = false; - if (xOrY === "x") { - isAxisShown = IsChannelDeep(spec.x) && spec.x.axis !== void 0 && spec.x.axis !== "none"; - } - if (xOrY === "y") { - isAxisShown = IsChannelDeep(spec.y) && spec.y.axis !== void 0 && spec.y.axis !== "none"; - } - if (spec.layout !== "circular") { - if (IsChannelDeep(spec.x) && spec.x.axis !== void 0 && spec.x.axis !== "none") { - spec.height -= HIGLASS_AXIS_SIZE; - } - } else { - if (xOrY === "x" && isAxisShown && IsChannelDeep(spec.x) && spec.x.axis === "top") { - spec["outerRadius"] = spec["outerRadius"] - HIGLASS_AXIS_SIZE; - } else if (xOrY === "x" && isAxisShown && IsChannelDeep(spec.x) && spec.x.axis === "bottom") { - spec["innerRadius"] = spec["innerRadius"] + HIGLASS_AXIS_SIZE; - } - } - SUPPORTED_CHANNELS.forEach((channelKey) => { - const channel = spec[channelKey]; - if (IsChannelDeep(channel) && !("zeroBaseline" in channel) && channel.type === "quantitative") { - channel.zeroBaseline = true; - } - }); - this.addScaleMaterials(spec); - } - /** - * TODO: This is experimental. For bar charts, for example, additional care should be taken to correctly flip the visual marks. - * Flip the y scales when `flip` options is used. - */ - flipRanges(spec) { - if (IsChannelDeep(spec.y) && spec.y.flip && Array.isArray(spec.y.range)) { - spec.y.range = spec.y.range.reverse(); - } - } - /** - * Find an axis channel that is encoded with genomic coordinate and return the key (e.g., 'x'). - * `undefined` if not found. - */ - getGenomicChannelKey() { - return getGenomicChannelKeyFromTrack(this.spec()); - } - /** - * Find a genomic field from the track specification. - * `undefined` if not found. - */ - getGenomicChannel() { - return getGenomicChannelFromTrack(this.spec()); - } - /** - * Replace a domain with a new one in the complete spec(s) if the original spec does not define the domain. - * A domain is replaced only when the channel is bound with data (i.e., `ChannelDeep`). - */ - setChannelDomain(channelKey, domain, force) { - const channelRaw = this.originalSpec()[channelKey]; - if (!force && IsChannelDeep(channelRaw) && channelRaw.domain !== void 0) { - return; - } - const channel = this.specComplete[channelKey]; - if (IsChannelDeep(channel)) { - channel.domain = domain; - } - } - /** - * Update default constant values by looking up other channels' scales. - */ - updateChannelValue() { - if (this.originalSpec().y === void 0) { - const y = this.spec().y; - const rowCategories = this.getChannelDomainArray("row"); - if (y && IsChannelValue(y) && rowCategories && this.spec().mark !== "withinLink") { - y.value = this.spec().height / rowCategories.length / 2; - } - } - } - /** - * Get the encoded value using the scales already constructed. - */ - encodedValue(channelKey, value) { - var _a; - if (channelKey === "text" && value !== void 0) { - return `${+value ? ~~value : value}`; - } - const channel = this.spec()[channelKey]; - const channelFieldType = IsChannelDeep(channel) ? channel.type : IsChannelValue(channel) ? "constant" : void 0; - if (!channelFieldType) { - return void 0; - } - if (channelFieldType === "constant") { - return this.channelScales[channelKey](); - } - if (value === void 0) { - return void 0; - } - if (value === null) { - if (channelFieldType === "quantitative") { - value = 0; - } else if (channelFieldType === "nominal") { - value = "null"; - } - } - if (typeof this.channelScales[channelKey] !== "function") { - return void 0; - } - switch (channelKey) { - case "x": - case "y": - case "x1": - case "y1": - case "xe": - case "ye": - case "x1e": - if (channelFieldType === "quantitative" || channelFieldType === "genomic") { - return this.channelScales[channelKey](value); - } - if (channelFieldType === "nominal") { - return this.channelScales[channelKey](value); - } - break; - case "stroke": - case "color": - if (channelFieldType === "quantitative") { - const s = this.channelScales[channelKey].copy(); - const d = s.domain(); - const e = d[1] - d[0]; - const so = Array.from((_a = channel.scaleOffset) != null ? _a : [0, 1]); - return s.domain([d[0] + e * so.sort()[0], d[0] + e * so.sort()[1]])(value); - } - if (channelFieldType === "nominal") { - return this.channelScales[channelKey](value); - } - break; - case "size": - if (channelFieldType === "quantitative") { - return this.channelScales[channelKey](value); - } - if (channelFieldType === "nominal") { - return this.channelScales[channelKey](value); - } - break; - case "row": - if (channelFieldType === "nominal") { - return this.channelScales[channelKey](value); - } - break; - case "strokeWidth": - case "opacity": - if (channelFieldType === "quantitative") { - return this.channelScales[channelKey](value); - } - break; - default: - console.warn(`${channelKey} is not supported for encoding values, so returning a undefined value`); - return void 0; - } - } - trackVisibility(currentStage) { - const spec = this.spec(); - if (!spec.visibility || spec.visibility.length === 0 || spec.visibility.filter((d) => d.target === "track").length === 0) { - return true; - } - let visibility = true; - spec.visibility.filter((d) => d.target === "track").forEach((d) => { - const { operation, measure, threshold } = d; - let compareValue; - if (measure === "zoomLevel") { - compareValue = currentStage[measure]; - } else { - compareValue = spec[measure]; - } - if (compareValue !== void 0) { - visibility = visibility && logicalComparison(compareValue, operation, threshold) === 1; - } - }); - return visibility; - } - /** - * Check whether the visual mark should be visible or not. - * Return 0 (invisible) only when the predefined condition is correct. - */ - markVisibility(datum, metrics) { - const spec = this.spec(); - if (!spec.visibility || spec.visibility.length === 0 || spec.visibility.filter((d) => d.target === "mark").length === 0) { - return 1; - } - let visibility = 1; - spec.visibility.filter((d) => d.target === "mark").forEach((d) => { - const { operation, threshold, conditionPadding, transitionPadding, measure } = d; - const padding = conditionPadding != null ? conditionPadding : 0; - const mark = spec.mark; - let newVisibility = 1; - if (mark === "text" && threshold === "|xe-x|" && measure === "width") { - const xe = this.encodedPIXIProperty("xe", datum); - const x = this.encodedPIXIProperty("x", datum); - if (xe !== void 0 && (metrics == null ? void 0 : metrics.width)) { - newVisibility = logicalComparison( - metrics.width + padding, - operation, - Math.abs(xe - x), - transitionPadding - ); - } - } else if (measure === "width" && typeof threshold === "number" && (metrics == null ? void 0 : metrics.width)) { - newVisibility = logicalComparison(metrics.width + padding, operation, threshold, transitionPadding); - } else if (measure === "zoomLevel" && typeof threshold === "number" && (metrics == null ? void 0 : metrics.zoomLevel)) { - newVisibility = logicalComparison(metrics.zoomLevel, operation, threshold, transitionPadding); - } - if (visibility > newVisibility) { - visibility = newVisibility; - } - }); - return visibility; - } - /** - * - */ - visualPropertyByChannel(channelKey, datum) { - const value = datum !== void 0 ? getValueUsingChannel(datum, this.spec()[channelKey]) : void 0; - return this.encodedValue(channelKey, value); - } - /** - * Retrieve an encoded visual property of a visual mark. - */ - encodedPIXIProperty(propertyKey, datum, additionalInfo) { - const mark = this.spec().mark; - if ([ - "text", - "color", - "row", - "stroke", - "opacity", - "strokeWidth", - "x", - "y", - "xe", - "x1", - "x1e", - "ye", - "size" - ].includes(propertyKey)) { - return this.visualPropertyByChannel(propertyKey, datum); - } - switch (mark) { - case "bar": - return barProperty(this, propertyKey, datum, additionalInfo); - case "point": - case "text": - return pointProperty(this, propertyKey, datum); - case "rect": - return rectProperty(this, propertyKey, datum, additionalInfo); - default: - return void 0; - } - } - // TODO: better organize this, perhaps, by combining several if statements - /** - * Set missing `range`, `domain`, and/or `value` of each channel by looking into data. - */ - addScaleMaterials(spec) { - const data = this.data(); - const genomicChannel = this.getGenomicChannel(); - if (!genomicChannel || !genomicChannel.field) { - console.warn("Genomic field is not provided in the specification"); - return; - } - if (typeof spec.width === "undefined" || typeof spec.height === "undefined") { - console.warn("Track size is not determined yet"); - return; - } - SUPPORTED_CHANNELS.forEach((channelKey) => { - var _a, _b, _c, _d; - const channel = spec[channelKey]; - if (IsStackedChannel(spec, channelKey) && IsChannelDeep(channel)) { - const pivotedData = group(data, (d) => d[genomicChannel.field]); - const xKeys = [...pivotedData.keys()]; - if (!channel.domain) { - const min$1 = "zeroBaseline" in channel && channel.zeroBaseline ? 0 : min( - xKeys.map( - (d) => sum( - pivotedData.get(d).map( - (_d2) => channel.field ? _d2[channel.field] : void 0 - ) - ) - ) - ); - const max$1 = max( - xKeys.map( - (d) => sum( - pivotedData.get(d).map( - (_d2) => channel.field ? _d2[channel.field] : void 0 - ) - ) - ) - ); - channel.domain = [min$1, max$1]; - } - if (!channel.range) { - const rowChannel = spec.row; - const rowField = IsChannelDeep(rowChannel) ? rowChannel.field : void 0; - const rowCategories = (_a = this.getChannelDomainArray("row")) != null ? _a : rowField ? Array.from(new Set(data.map((d) => d[rowField]))) : [1]; - const rowHeight = spec.height / rowCategories.length; - switch (channelKey) { - case "x": - channel.range = [0, spec.width]; - break; - case "y": - channel.range = [0, rowHeight]; - break; - } - } - } else { - const rowChannel = spec.row; - const rowField = IsChannelDeep(rowChannel) ? rowChannel.field : void 0; - const rowCategories = (_b = this.getChannelDomainArray("row")) != null ? _b : rowField ? Array.from(new Set(data.map((d) => d[rowField]))) : [1]; - const rowHeight = spec.height / rowCategories.length; - if (!channel) { - let value; - switch (channelKey) { - case "x": - value = spec.width / 2; - break; - case "y": - if (spec.mark === "withinLink") - value = rowHeight; - else - value = rowHeight / 2; - break; - case "size": - if (spec.mark === "line") - value = this.theme.line.size; - else if (spec.mark === "bar") - value = void 0; - else if (spec.mark === "rect") - value = void 0; - else if (spec.mark === "triangleRight") - value = void 0; - else if (spec.mark === "triangleLeft") - value = void 0; - else if (spec.mark === "triangleBottom") - value = void 0; - else if (spec.stretch && spec.mark === "point" && IsChannelDeep(spec.x) && IsChannelDeep(spec.xe)) - value = void 0; - else if (spec.mark === "text") - value = 12; - else - value = this.theme.point.size; - break; - case "color": - value = this.theme.markCommon.color; - break; - case "row": - value = 0; - break; - case "stroke": - if (spec.mark === "text") - value = this.theme.text.stroke; - else - value = this.theme.markCommon.stroke; - break; - case "strokeWidth": - if (spec.mark === "rule") - value = this.theme.rule.strokeWidth; - else if (spec.mark === "withinLink" || spec.mark === "betweenLink") - value = this.theme.link.strokeWidth; - else if (spec.mark === "text") - value = this.theme.text.strokeWidth; - else - value = this.theme.markCommon.strokeWidth; - break; - case "opacity": - value = this.theme.markCommon.opacity; - break; - case "text": - value = ""; - break; - } - if (typeof value !== "undefined") { - spec[channelKey] = { value }; - } - } else if (IsChannelDeep(channel) && (channel.type === "quantitative" || channel.type === "genomic")) { - if (channel.domain === void 0) { - const min$1 = "zeroBaseline" in channel && channel.zeroBaseline ? 0 : (_c = min(data.map((d) => +d[channel.field]))) != null ? _c : 0; - const max$1 = (_d = max(data.map((d) => +d[channel.field]))) != null ? _d : 0; - channel.domain = [min$1, max$1]; - } else if (channel.type === "genomic" && !IsDomainArray(channel.domain)) { - channel.domain = getNumericDomain(channel.domain); - } - if ((channelKey === "color" || channelKey === "stroke") && channel.type === "quantitative" && !channel.scaleOffset) { - channel.scaleOffset = [0, 1]; - } - if (!channel.range) { - let range; - switch (channelKey) { - case "x": - case "xe": - case "x1": - case "x1e": - range = [0, spec.width]; - break; - case "y": - case "ye": - range = [0, rowHeight]; - break; - case "color": - case "stroke": - range = CHANNEL_DEFAULTS.QUANTITATIVE_COLOR; - break; - case "size": - range = this.theme.markCommon.quantitativeSizeRange; - break; - case "strokeWidth": - range = [1, 3]; - break; - case "opacity": - range = [0, 1]; - break; - } - if (range) { - channel.range = range; - } - } - } else if (IsChannelDeep(channel) && channel.type === "nominal") { - if (channel.domain === void 0) { - channel.domain = Array.from( - new Set(data.map((d) => { - var _a2; - return (_a2 = d[channel.field]) != null ? _a2 : "null"; - })) - ); - } - if (!channel.range) { - let startSize = 2; - let range; - switch (channelKey) { - case "x": - case "xe": - range = [0, spec.width]; - break; - case "y": - case "ye": - range = [rowHeight, 0]; - break; - case "color": - case "stroke": - range = this.theme.markCommon.nominalColorRange; - break; - case "row": - range = [0, spec.height]; - break; - case "size": - range = channel.domain.map(() => startSize++); - break; - } - if (range) { - channel.range = range; - } - } - } - } - }); - [ - ["x", "xe"], - ["y", "ye"] - ].forEach((pair) => { - const [k1, k2] = pair; - const c1 = spec[k1], c2 = spec[k2]; - if (IsChannelDeep(c1) && IsChannelDeep(c2) && c1.type === c2.type && c1.domain && c2.domain && Array.isArray(c1.domain) && Array.isArray(c2.domain)) { - if (c1.type === "genomic" || c1.type === "quantitative") { - const min$1 = min([c1.domain[0], c2.domain[0]]); - const max$1 = max([c1.domain[1], c2.domain[1]]); - c1.domain = c2.domain = [min$1, max$1]; - } else if (c1.type === "nominal") { - const range = Array.from(/* @__PURE__ */ new Set([...c1.domain, ...c2.domain])); - c1.range = c2.range = range; - } - } - }); - } - /** - * Store the scale of individual visual channels based on the `complete` spec. - */ - generateScales() { - const spec = this.spec(); - SUPPORTED_CHANNELS.forEach((channelKey) => { - const channel = spec[channelKey]; - if (IsChannelValue(channel)) { - this.channelScales[channelKey] = () => channel.value; - } else if (IsChannelDeep(channel)) { - if (channelKey === "text") { - return; - } - const domain = channel.domain; - const range = channel.range; - if (domain === void 0 || range === void 0) { - return; - } - if (channel.type === "quantitative" || channel.type === "genomic") { - switch (channelKey) { - case "x": - case "x1": - case "xe": - case "x1e": - case "y": - case "ye": - case "size": - case "opacity": - case "strokeWidth": - this.channelScales[channelKey] = scaleLinear().domain(domain).range(range); - break; - case "color": - case "stroke": - let interpolate = interpolateViridis; - if (Object.keys(PREDEFINED_COLOR_STR_MAP).includes(range)) { - interpolate = PREDEFINED_COLOR_STR_MAP[range]; - } - this.channelScales[channelKey] = scaleSequential(interpolate).domain( - domain - ); - break; - } - } else if (channel.type === "nominal") { - switch (channelKey) { - case "x": - case "xe": - case "y": - case "ye": - case "row": - this.channelScales[channelKey] = scaleBand().domain(domain).range(range); - break; - case "size": - this.channelScales[channelKey] = scaleOrdinal().domain(domain).range(range); - break; - case "color": - case "stroke": - this.channelScales[channelKey] = scaleOrdinal(range).domain(domain); - break; - } - } - } - }); - } - /** - * Return the scale of a visual channel. - * `undefined` if we do not have the scale. - */ - getChannelScale(channelKey) { - return this.channelScales[channelKey]; - } - /** - * Set a new scale for a certain channel. Usually called to replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher. - */ - setChannelScale(channelKey, scale) { - this.channelScales[channelKey] = scale; - } - /** - * Return whether to show y-axis. - */ - isShowYAxis() { - const spec = this.spec(); - const yDomain = this.getChannelDomainArray("y"); - const yRange = this.getChannelRangeArray("y"); - return IsChannelDeep(spec.y) && spec.y.axis !== "none" && spec.y.type === "quantitative" && !!yDomain && !!yRange; - } - /** - * Return the domain of a visual channel. - * `undefined` if we do not have domain in array. - */ - getChannelDomainArray(channelKey) { - const c = this.spec()[channelKey]; - return IsChannelDeep(c) && IsDomainArray(c.domain) ? c.domain : void 0; - } - /** - * Return the range of a visual channel. - * `undefined` if we do not have domain in array. - */ - getChannelRangeArray(channelKey) { - const c = this.spec()[channelKey]; - return IsChannelDeep(c) && IsRangeArray(c.range) ? c.range : void 0; - } - /** - * Validate the original spec. - */ - validateSpec() { - return validateTrack(this.originalSpec()); - } -} -function publish(name2, data) { - PubSub$1.publish(name2, data); -} -function subscribe(name2, callback) { - PubSub$1.subscribe(name2, callback); -} -function unsubscribe(name2) { - PubSub$1.unsubscribe(name2); -} -const DEFAULT_MOUSE_EVENT_STYLE = { - stroke: "black", - strokeWidth: 1, - strokeOpacity: 1, - color: "none", - opacity: 1, - arrange: "front" -}; -function initProcessedTileInfo() { - return { goslingModels: [], tabularData: [], skipRendering: false }; -} -const config$1 = { - type: "gosling-track", - datatype: ["multivec", "epilogos"], - orientation: "1d-horizontal", - // @ts-expect-error missing default spec - defaultOptions: { - // TODO: Are any of these used? - // labelPosition: 'none', - // labelColor: 'black', - // labelTextOpacity: 0.4, - // trackBorderWidth: 0, - // trackBorderColor: 'black', - // backgroundColor: 'white', - // barBorder: false, - // sortLargestOnTop: true, - // axisPositionHorizontal: 'left', - theme: getTheme$1("light") - } -}; -const factory$1 = (HGC, context, options) => { - var _assembly2, _processedTileInfo, _mouseDownX, _mouseDownY, _isRangeBrushActivated, _gBrush, _loadingTextStyleObj, _loadingTextBg, _loadingText, _tilesToId, tilesToId_fn, _binsPerTile, binsPerTile_get, _generateTabularData, generateTabularData_fn, _onMouseDown, onMouseDown_fn, _onMouseMove, onMouseMove_fn, _onMouseUp, onMouseUp_fn, _onMouseOut, onMouseOut_fn, _getElementsWithinMouse, getElementsWithinMouse_fn, _publishTrackEvents, publishTrackEvents_fn, _onRangeBrush, onRangeBrush_fn, _highlightMarks, highlightMarks_fn, _publishOnNewTrack, publishOnNewTrack_fn, _hasStretchableGraphics, hasStretchableGraphics_fn, _isTooStretched, isTooStretched_fn; - const { tileProxy } = HGC.services; - const { BarTrack } = HGC.tracks; - const loadingTextStyle = getTextStyle({ color: "black", size: 12 }); - const _GoslingTrackClass = class _GoslingTrackClass extends BarTrack { - /* * - * - * Constructor - * - * */ - constructor() { - var _a, _b, _c, _d, _e, _f; - super(context, options); - __privateAdd(this, _binsPerTile); - /** - * Construct tabular data from a higlass tileset and a gosling track model. - */ - __privateAdd(this, _generateTabularData); - /* * - * - * Mouse methods - * - * */ - __privateAdd(this, _onMouseDown); - __privateAdd(this, _onMouseMove); - __privateAdd(this, _onMouseUp); - __privateAdd(this, _onMouseOut); - /** - * From all tiles and overlaid tracks, collect element(s) that are withing a mouse position. - */ - __privateAdd(this, _getElementsWithinMouse); - /** - * Call track events (e.g., `trackClick` or `trackMouseOver`) based on a mouse position and the track display area. - */ - __privateAdd(this, _publishTrackEvents); - __privateAdd(this, _onRangeBrush); - /** - * Highlight marks that are either mouse overed or selected. - */ - __privateAdd(this, _highlightMarks); - /** - * Javscript subscription API methods (besides for mouse) - */ - /** - * Publishes track information. Triggered when track gets created - */ - __privateAdd(this, _publishOnNewTrack); - /** - * Used in drawTile() - * Checks if the track has marks which are stretchable. Stretching - * is not supported for circular layouts or 2D tracks - */ - __privateAdd(this, _hasStretchableGraphics); - /** - * Used in drawTile() - * Checks if the tile Graphic is too stretched. If so, it returns true. - * @param stretchFactor The factor by which the tile is stretched - * @returns True if the tile is too stretched, false otherwise - */ - __privateAdd(this, _isTooStretched); - /* * - * - * Properties - * - * */ - __publicField(this, "tileSize"); - __publicField(this, "mRangeBrush"); - __privateAdd(this, _assembly2, void 0); - // Used to get the relative genomic position - __privateAdd(this, _processedTileInfo, void 0); - __publicField(this, "firstDraw", true); - // False if draw has been called once already. Used with onNewTrack API. Public because used in draw() - // Used in mark/legend.ts - __publicField(this, "gLegend", HGC.libraries.d3Selection.select(context.svgElement).append("g")); - __publicField(this, "displayedLegends", []); - // Store the color legends added so far so that we can avoid overlaps and redundancy - // Used in mark/text.ts - __publicField(this, "textGraphics", []); - __publicField(this, "textsBeingUsed", 0); - // Mouse fields - __publicField(this, "pMouseHover", new HGC.libraries.PIXI.Graphics()); - __publicField(this, "pMouseSelection", new HGC.libraries.PIXI.Graphics()); - __privateAdd(this, _mouseDownX, 0); - __privateAdd(this, _mouseDownY, 0); - __privateAdd(this, _isRangeBrushActivated, false); - __privateAdd(this, _gBrush, HGC.libraries.d3Selection.select(context.svgElement).append("g")); - __privateAdd(this, _loadingTextStyleObj, new HGC.libraries.PIXI.TextStyle(loadingTextStyle)); - __privateAdd(this, _loadingTextBg, new HGC.libraries.PIXI.Graphics()); - __privateAdd(this, _loadingText, new HGC.libraries.PIXI.Text("", loadingTextStyle)); - __publicField(this, "prevVisibleAndFetchedTiles"); - __publicField(this, "resolvedTracks"); - __publicField(this, "hideMousePosition"); - context.dataFetcher.track = this; - __privateSet(this, _processedTileInfo, {}); - __privateSet(this, _assembly2, this.options.spec.assembly); - if ("overlay" in this.options.spec) { - this.options.spec.overlay = this.options.spec._overlay.map((o) => { - return { ...o, _renderingId: uuid() }; - }); - } else { - this.options.spec._renderingId = uuid(); - } - this.fetchedTiles = {}; - this.tileSize = (_b = (_a = this.tilesetInfo) == null ? void 0 : _a.tile_size) != null ? _b : 1024; - const { valid, errorMessages } = validateTrack(this.options.spec); - if (!valid) { - console.warn("The specification of the following track is invalid", errorMessages, this.options.spec); - } - this.pMain.addChild(this.pMouseHover); - this.pMain.addChild(this.pMouseSelection); - this.pMask.interactive = true; - this.mRangeBrush = new LinearBrushModel(__privateGet(this, _gBrush), HGC.libraries, (_c = this.options.spec.style) == null ? void 0 : _c.brush); - this.mRangeBrush.on("brush", __privateMethod(this, _onRangeBrush, onRangeBrush_fn).bind(this)); - this.pMask.on("mousedown", (e) => { - const { x, y } = e.data.getLocalPosition(this.pMain); - __privateMethod(this, _onMouseDown, onMouseDown_fn).call(this, x, y, e.data.originalEvent.altKey); - }); - this.pMask.on("mouseup", (e) => { - const { x, y } = e.data.getLocalPosition(this.pMain); - __privateMethod(this, _onMouseUp, onMouseUp_fn).call(this, x, y); - }); - this.pMask.on("mousemove", (e) => { - const { x } = e.data.getLocalPosition(this.pMain); - __privateMethod(this, _onMouseMove, onMouseMove_fn).call(this, x); - }); - this.pMask.on("mouseout", __privateMethod(this, _onMouseOut, onMouseOut_fn).bind(this)); - this.flipText = this.options.spec.orientation === "vertical"; - if (this.hideMousePosition) { - this.hideMousePosition(); - this.hideMousePosition = void 0; - } - if (((_d = this.options) == null ? void 0 : _d.showMousePosition) && !this.hideMousePosition) { - this.hideMousePosition = HGC.utils.showMousePosition( - this, - Is2DTrack(this.getResolvedTracks()[0]), - this.isShowGlobalMousePosition() - ); - } - this.pLabel.removeChild(this.trackNotFoundText); - __privateGet(this, _loadingText).anchor.x = 1; - __privateGet(this, _loadingText).anchor.y = 1; - this.pLabel.addChild(__privateGet(this, _loadingTextBg)); - this.pLabel.addChild(__privateGet(this, _loadingText)); - HGC.libraries.PIXI.GRAPHICS_CURVES.adaptive = (_f = (_e = this.options.spec.style) == null ? void 0 : _e.enableSmoothPath) != null ? _f : false; - if (HGC.libraries.PIXI.GRAPHICS_CURVES.adaptive) { - HGC.libraries.PIXI.GRAPHICS_CURVES.maxLength = 1; - HGC.libraries.PIXI.GRAPHICS_CURVES.maxSegments = 2048 * 10; - } - } - /* * - * - * Rendering Cycle Methods - * - * */ - /** - * Draw all tiles from the bottom. Called from TiledPixiTrack constructor, so all methods called must be - * public. https://github.com/higlass/higlass/blob/387a03e877dcfa4c2cfeabc0869375b58c0b362d/app/scripts/TiledPixiTrack.js#L216 - * Overrides draw() in BarTrack. - * This means some class properties can be still `undefined`. - */ - draw() { - var _a, _b; - this.clearMouseEventData(); - this.textsBeingUsed = 0; - (_a = this.pMouseHover) == null ? void 0 : _a.clear(); - const processTilesAndDraw = () => { - const isBamDataFetcher = this.dataFetcher instanceof BamDataFetcher; - this.processAllTiles(isBamDataFetcher); - super.draw(); - this.prevVisibleAndFetchedTiles = this.visibleAndFetchedTiles(); - }; - if (isTabularDataFetcher(this.dataFetcher) && !isEqual(this.visibleAndFetchedTiles(), this.prevVisibleAndFetchedTiles)) { - this.updateTileAsync(this.dataFetcher, processTilesAndDraw); - } else { - processTilesAndDraw(); - } - (_b = this.mRangeBrush) == null ? void 0 : _b.drawBrush(true); - if (this.firstDraw) { - __privateMethod(this, _publishOnNewTrack, publishOnNewTrack_fn).call(this); - this.firstDraw = false; - } - } - /* - * Do whatever is necessary before rendering a new tile. This function is called from `receivedTiles()`. - * Overrides initTile in BarTrack - * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/HorizontalLine1DPixiTrack.js#L50) - */ - initTile(tile) { - this.drawTile(tile); - } - updateTile() { - } - // Never mind about this function for the simplicity. - renderTile() { - } - // Never mind about this function for the simplicity. - /** - * Display a tile upon receiving a new one or when explicitly called by a developer, e.g., calling - * `this.draw()`. Overrides drawTile in BarTrack - */ - drawTile(tile) { - var _a, _b; - const tileInfo = __privateGet(this, _processedTileInfo)[tile.tileId]; - if (!tileInfo) { - return; - } - if (!tile.drawnAtScale) { - tile.drawnAtScale = this._xScale.copy(); - } - const [graphicsXScale, graphicsXPos] = this.getXScaleAndOffset(tile.drawnAtScale); - const isFirstRender = graphicsXScale === 1; - if (!__privateMethod(this, _isTooStretched, isTooStretched_fn).call(this, graphicsXScale) && __privateMethod(this, _hasStretchableGraphics, hasStretchableGraphics_fn).call(this) && !isFirstRender) { - tile.graphics.scale.x = graphicsXScale; - tile.graphics.position.x = graphicsXPos; - return; - } - tile.drawnAtScale = this._xScale.copy(); - (_a = tile.graphics) == null ? void 0 : _a.clear(); - (_b = tile.graphics) == null ? void 0 : _b.removeChildren(); - this.pBackground.clear(); - this.pBackground.removeChildren(); - this.pBorder.clear(); - this.pBorder.removeChildren(); - this.displayedLegends = []; - tileInfo.goslingModels.forEach((model) => { - const trackWidth = this.dimensions[0]; - const zoomLevel = this._xScale.invert(trackWidth) - this._xScale.invert(0); - if (!model.trackVisibility({ zoomLevel })) { - return; - } - drawPreEmbellishment(HGC, this, tile, model, this.options.theme); - drawMark(HGC, this, tile, model); - drawPostEmbellishment(HGC, this, tile, model, this.options.theme); - }); - this.forceDraw(); - } - /** - * Render this track again using a new option when a user changed the option. Overrides rerender in BarTrack. - */ - rerender(newOptions) { - this.options = newOptions; - if (this.options.spec.layout === "circular") { - this.mRangeBrush.remove(); - } - this.getResolvedTracks(true); - this.clearMouseEventData(); - this.textsBeingUsed = 0; - this.processAllTiles(true); - this.draw(); - this.forceDraw(); - } - /** - * Clears MouseEventModel from each GoslingTrackModel. Must be a public method because it is called from draw() - */ - clearMouseEventData() { - this.visibleAndFetchedGoslingModels().forEach((model) => model.getMouseEventModel().clear()); - } - /** - * Collect all gosling models that correspond to the tiles that are both visible and fetched. - */ - visibleAndFetchedGoslingModels() { - return this.visibleAndFetchedTiles().flatMap( - (tile) => { - var _a, _b; - return (_b = (_a = __privateGet(this, _processedTileInfo)[tile.tileId]) == null ? void 0 : _a.goslingModels) != null ? _b : []; - } - ); - } - /** - * End of the rendering cycle. This function is called when the track is removed entirely. - */ - remove() { - super.remove(); - if (this.gLegend) { - this.gLegend.remove(); - this.gLegend = void 0; - } - this.mRangeBrush.remove(); - } - /* - * Rerender all tiles when track size is changed. Overrides method in TiledPixiTrack - * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/PixiTrack.js#L186). - */ - setDimensions(newDimensions) { - super.setDimensions(newDimensions); - this.mRangeBrush.setSize(newDimensions[1]); - } - /** - * Record new position. - */ - setPosition(newPosition) { - super.setPosition(newPosition); - [this.pMain.position.x, this.pMain.position.y] = this.position; - this.mRangeBrush.setOffset(...newPosition); - } - /** - * A function to redraw this track. Typically called when an asynchronous event occurs (i.e. tiles loaded) - * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/TiledPixiTrack.js#L71) - */ - forceDraw() { - this.animate(); - } - /** - * Called when location or zoom level has been changed by click-and-drag interaction - * (https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/HorizontalLine1DPixiTrack.js#L215) - * For brushing, refer to https://github.com/higlass/higlass/blob/caf230b5ee41168ea491572618612ac0cc804e5a/app/scripts/HeatmapTiledPixiTrack.js#L1493 - */ - zoomed(newXScale, newYScale) { - const range = this.mRangeBrush.getRange(); - this.mRangeBrush.updateRange( - range ? [newXScale(this._xScale.invert(range[0])), newXScale(this._xScale.invert(range[1]))] : null - ); - this.xScale(newXScale); - this.yScale(newYScale); - this.refreshTiles(); - this.draw(); - this.forceDraw(); - const genomicRange = newXScale.domain().map((absPos) => getRelativeGenomicPosition(absPos, __privateGet(this, _assembly2), true)); - publish("location", { - id: context.viewUid, - genomicRange - }); - } - /** - * This is how the mask gets drawn. Overrides method in PixiTrack. - * Compared to the method in PixiTrack, this method draws a circular mask when the layout is circular. - * @param position - * @param dimensions - */ - setMask(position, dimensions) { - this.pMask.clear(); - this.pMask.beginFill(); - if (this.options.spec.layout === "circular") { - const [x, y] = this.position; - const [width, height] = this.dimensions; - const cx = x + width / 2; - const cy = y + height / 2; - const outerRadius = this.options.spec.outerRadius; - this.pMask.drawCircle(cx, cy, outerRadius); - } else { - this.pMask.drawRect(position[0], position[1], dimensions[0], dimensions[1]); - } - this.pMask.endFill(); - } - /* * - * - * Tile and data processing methods - * - * */ - /** - * Gets all tiles and generates tabular data and GoslingTrackModels for each tile. Called by this.draw(), so - * this method must be public. - * @param force if true then tabular data gets regenerated - */ - processAllTiles(force = false) { - var _a, _b; - this.tileSize = (_b = (_a = this.tilesetInfo) == null ? void 0 : _a.tile_size) != null ? _b : 1024; - const tiles = this.visibleAndFetchedTiles(); - tiles.forEach((tile) => __privateMethod(this, _generateTabularData, generateTabularData_fn).call(this, tile, force)); - this.combineAllTilesIfNeeded(); - const models = tiles.flatMap((tile) => this.transformDataAndCreateModels(tile)); - shareScaleAcrossTracks(models); - const flatTileData = [].concat(...models.map((d) => d.data())); - if (flatTileData.length !== 0) { - this.options.siblingIds.forEach((id) => publish("rawData", { id, data: flatTileData })); - } - } - /** - * This is currently for testing the new way of rendering visual elements. Called by this.draw() - */ - async updateTileAsync(tabularDataFetcher, callback) { - if (!this.tilesetInfo) - return; - const tiles = this.visibleAndFetchedTiles(); - const tabularData = await tabularDataFetcher.getTabularData(Object.values(tiles).map((x) => x.remoteId)); - const tilesetInfo = this.tilesetInfo; - tiles.forEach((tile, i) => { - if (i === 0) { - const [refTile] = HGC.utils.trackUtils.calculate1DVisibleTiles(tilesetInfo, this._xScale); - tile.tileData.zoomLevel = refTile[0]; - tile.tileData.tilePos = [refTile[1], refTile[1]]; - tile.tileData.tabularData = tabularData; - } else { - tile.tileData.tabularData = []; - } - }); - callback(); - } - /** - * Overrides method in Tiled1DPixiTrack. It is called in the constructor, `super(context, options)`. - * So be aware to use defined variables. - */ - calculateVisibleTiles() { - var _a, _b, _c, _d, _e; - if (!this.tilesetInfo) - return; - if (isTabularDataFetcher(this.dataFetcher)) { - const tiles = HGC.utils.trackUtils.calculate1DVisibleTiles(this.tilesetInfo, this._xScale); - const maxTileWith = (_b = (_a = this.tilesetInfo.max_tile_width) != null ? _a : this.dataFetcher.MAX_TILE_WIDTH) != null ? _b : Number.MAX_SAFE_INTEGER; - for (const tile of tiles) { - const { tileWidth } = this.getTilePosAndDimensions(tile[0], [tile[1], tile[1]]); - this.forceDraw(); - if (tileWidth > maxTileWith) { - return; - } - } - this.setVisibleTiles(tiles); - } else { - if (!this.tilesetInfo) { - return; - } - const zoomLevel = this.calculateZoomLevel(); - if ("resolutions" in this.tilesetInfo) { - const sortedResolutions = this.tilesetInfo.resolutions.map((x) => +x).sort((a, b) => b - a); - const xTiles = tileProxy.calculateTilesFromResolution( - sortedResolutions[zoomLevel], - this._xScale, - this.tilesetInfo.min_pos[0], - this.tilesetInfo.max_pos[0] - ); - let yTiles; - if (Is2DTrack(this.getResolvedTracks()[0])) { - yTiles = tileProxy.calculateTilesFromResolution( - sortedResolutions[zoomLevel], - this._yScale, - this.tilesetInfo.min_pos[0], - this.tilesetInfo.max_pos[0] - ); - } - const tiles = __privateMethod(_c = _GoslingTrackClass, _tilesToId, tilesToId_fn).call(_c, xTiles, yTiles, zoomLevel); - this.setVisibleTiles(tiles); - } else { - const xTiles = tileProxy.calculateTiles( - zoomLevel, - this.relevantScale(), - this.tilesetInfo.min_pos[0], - this.tilesetInfo.max_pos[0], - this.tilesetInfo.max_zoom, - this.tilesetInfo.max_width - ); - let yTiles; - if (Is2DTrack(this.getResolvedTracks()[0])) { - yTiles = tileProxy.calculateTiles( - zoomLevel, - this._yScale, - this.tilesetInfo.min_pos[1], - this.tilesetInfo.max_pos[1], - this.tilesetInfo.max_zoom, - // @ts-expect-error what is max_width1? - (_d = this.tilesetInfo.max_width1) != null ? _d : this.tilesetInfo.max_width - ); - } - const tiles = __privateMethod(_e = _GoslingTrackClass, _tilesToId, tilesToId_fn).call(_e, xTiles, yTiles, zoomLevel); - this.setVisibleTiles(tiles); - } - } - } - /** - * Get the tile's position in its coordinate system. Overrides method in Tiled1DPixiTrack. - */ - getTilePosAndDimensions(zoomLevel, tilePos) { - if (!this.tilesetInfo) { - throw Error("tilesetInfo not parsed"); - } - if ("resolutions" in this.tilesetInfo) { - const sortedResolutions = this.tilesetInfo.resolutions.map((x) => +x).sort((a, b) => b - a); - const chosenResolution = sortedResolutions[zoomLevel]; - const [xTilePos, yTilePos] = tilePos; - const tileWidth = chosenResolution * __privateGet(this, _binsPerTile, binsPerTile_get); - const tileHeight = tileWidth; - const tileX = tileWidth * xTilePos; - const tileY = tileHeight * yTilePos; - return { - tileX, - tileY, - tileWidth, - tileHeight - }; - } else { - const [xTilePos, yTilePos] = tilePos; - const minX = this.tilesetInfo.min_pos[0]; - const minY = this.tilesetInfo.min_pos[1]; - const tileWidth = this.tilesetInfo.max_width / 2 ** zoomLevel; - const tileHeight = this.tilesetInfo.max_width / 2 ** zoomLevel; - const tileX = minX + xTilePos * tileWidth; - const tileY = minY + yTilePos * tileHeight; - return { - tileX, - tileY, - tileWidth, - tileHeight - }; - } - } - /** - * Gets the indices of the visible data a tile. Overrides method in Tiled1DPixiTrack - */ - getIndicesOfVisibleDataInTile(tile) { - const visible = this._xScale.range(); - if (!this.tilesetInfo || !tile.tileData.tilePos || !("dense" in tile.tileData)) { - return [0, 0]; - } - const { tileX, tileWidth } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos); - const tileXScale = HGC.libraries.d3Scale.scaleLinear().domain([0, __privateGet(this, _binsPerTile, binsPerTile_get)]).range([tileX, tileX + tileWidth]); - const start = Math.max(0, Math.round(tileXScale.invert(this._xScale.invert(visible[0])))); - const end = Math.min( - tile.tileData.dense.length, - Math.round(tileXScale.invert(this._xScale.invert(visible[1]))) - ); - return [start, end]; - } - /** - * Overrides method in TiledPixiTrack - * @param loadedTiles - */ - receivedTiles(loadedTiles) { - super.receivedTiles(loadedTiles); - isTabularDataFetcher(this.dataFetcher) && this.drawLoadingCue(); - } - /** - * Overrides method in TiledPixiTrack - */ - removeOldTiles() { - super.removeOldTiles(); - isTabularDataFetcher(this.dataFetcher) && this.drawLoadingCue(); - } - /** - * Combile multiple tiles into the last tile. - * This is sometimes necessary, for example, when applying a displacement algorithm to all tiles at once. - * Called by this.processAllTiles() so this method needs to be public. - */ - combineAllTilesIfNeeded() { - var _a, _b, _c; - if (!this.shouldCombineTiles()) - return; - const tiles = this.visibleAndFetchedTiles(); - if (!tiles || tiles.length <= 1) { - return; - } - this.tileSize = ((_b = (_a = this.tilesetInfo) == null ? void 0 : _a.tile_size) != null ? _b : 1024) * tiles.length; - let merged = []; - tiles.forEach((tile, i) => { - const tileInfo = __privateGet(this, _processedTileInfo)[tile.tileId]; - if (tileInfo) { - merged = [...merged, ...tileInfo.tabularData]; - tileInfo.skipRendering = i !== 0; - } - }); - const firstTileInfo = __privateGet(this, _processedTileInfo)[tiles[0].tileId]; - firstTileInfo.tabularData = merged; - if ((_c = firstTileInfo.tabularData[0]) == null ? void 0 : _c.uid) { - firstTileInfo.tabularData = uniqBy(firstTileInfo.tabularData, "uid"); - } - } - /** - * Check whether tiles should be merged. Needs to be public since called by combineAllTilesIfNeeded() - */ - shouldCombineTiles() { - const includesDisplaceTransform = hasDataTransform(this.options.spec, "displace"); - const hasDenseTiles = () => { - const tiles = this.visibleAndFetchedTiles(); - return tiles.length >= 1 && "dense" in tiles[0].tileData; - }; - const isBamDataFetcher = this.dataFetcher instanceof BamDataFetcher; - return includesDisplaceTransform && !hasDenseTiles() && !isBamDataFetcher; - } - /** - * Creates an array of SingleTracks if there are overlaid tracks. - * This method cannot be private because it is called by functions which are called by super.draw(); - */ - getResolvedTracks(forceUpdate = false) { - if (forceUpdate || !this.resolvedTracks) { - const tracks = resolveSuperposedTracks(this.options.spec).filter((t) => t.mark !== "brush"); - tracks.forEach((track) => { - if ("values" in track.data) { - track.data.values = []; - } - }); - this.resolvedTracks = tracks; - } - return this.resolvedTracks; - } - /** - * Apply data transformation to each of the overlaid tracks and generate GoslingTrackModels. - */ - transformDataAndCreateModels(tile) { - const tileInfo = __privateGet(this, _processedTileInfo)[tile.tileId]; - if (!tileInfo || tileInfo.skipRendering) { - return []; - } - tileInfo.goslingModels = []; - const resolvedTracks = this.getResolvedTracks(); - resolvedTracks.forEach((resolvedSpec) => { - var _a; - let tabularDataTransformed = Array.from(tileInfo.tabularData); - (_a = resolvedSpec.dataTransform) == null ? void 0 : _a.forEach((t) => { - switch (t.type) { - case "filter": - tabularDataTransformed = filterData(t, tabularDataTransformed); - break; - case "concat": - tabularDataTransformed = concatString(t, tabularDataTransformed); - break; - case "replace": - tabularDataTransformed = replaceString(t, tabularDataTransformed); - break; - case "log": - tabularDataTransformed = calculateData(t, tabularDataTransformed); - break; - case "exonSplit": - tabularDataTransformed = splitExon(t, tabularDataTransformed, resolvedSpec.assembly); - break; - case "genomicLength": - tabularDataTransformed = calculateGenomicLength(t, tabularDataTransformed); - break; - case "svType": - tabularDataTransformed = inferSvType(t, tabularDataTransformed); - break; - case "coverage": - tabularDataTransformed = aggregateCoverage(t, tabularDataTransformed, this._xScale.copy()); - break; - case "subjson": - tabularDataTransformed = parseSubJSON(t, tabularDataTransformed); - break; - case "displace": - tabularDataTransformed = displace(t, tabularDataTransformed, this._xScale.copy()); - break; - } - }); - try { - if (PubSub) { - const NUM_OF_ROWS_IN_PREVIEW = 100; - const numOrRows = tabularDataTransformed.length; - PubSub.publish("data-preview", { - id: context.viewUid, - // TODO: Do we need the stringified version? Stringify of large JSON data is very slow. - dataConfig: JSON.stringify({ data: resolvedSpec.data }), - data: NUM_OF_ROWS_IN_PREVIEW > numOrRows ? tabularDataTransformed : sampleSize(tabularDataTransformed, NUM_OF_ROWS_IN_PREVIEW) - // ... - }); - } - } catch (e) { - } - const [trackWidth, trackHeight] = this.dimensions; - const axisSize = IsXAxis(resolvedSpec) ? HIGLASS_AXIS_SIZE : 0; - const [w, h] = [trackWidth, trackHeight + axisSize]; - const circularFactor = Math.min(w, h) / Math.min(resolvedSpec.width, resolvedSpec.height); - if (resolvedSpec.innerRadius) { - resolvedSpec.innerRadius = resolvedSpec.innerRadius * circularFactor; - } - if (resolvedSpec.outerRadius) { - resolvedSpec.outerRadius = resolvedSpec.outerRadius * circularFactor; - } - resolvedSpec.width = w; - resolvedSpec.height = h; - const model = new GoslingTrackModel(resolvedSpec, tabularDataTransformed, this.options.theme); - tileInfo.goslingModels.push(model); - }); - return tileInfo.goslingModels; - } - // set in HorizontalTiled1DPixiTrack - /** - * Overrides method in HorizontalLine1DPixiTrack - */ - getMouseOverHtml(mouseX, mouseY) { - var _a, _b, _c, _d, _e; - __privateMethod(this, _publishTrackEvents, publishTrackEvents_fn).call(this, "trackMouseOver", mouseX, mouseY); - if (__privateGet(this, _isRangeBrushActivated)) { - return ""; - } - if (!this.tilesetInfo) { - return ""; - } - this.pMouseHover.clear(); - const genomicPosition = getRelativeGenomicPosition(Math.floor(this._xScale.invert(mouseX)), __privateGet(this, _assembly2)); - const capturedElements = __privateMethod(this, _getElementsWithinMouse, getElementsWithinMouse_fn).call(this, mouseX, mouseY); - if (capturedElements.length !== 0) { - document.body.style.cursor = "pointer"; - } else { - document.body.style.cursor = "default"; - } - if (capturedElements.length !== 0) { - const mouseEvents = (_a = this.options.spec.experimental) == null ? void 0 : _a.mouseEvents; - const mouseOverEnabled = !!mouseEvents || IsMouseEventsDeep(mouseEvents) && !!mouseEvents.mouseOver; - if (mouseOverEnabled) { - const g = this.pMouseHover; - if (((_c = (_b = this.options.spec.style) == null ? void 0 : _b.mouseOver) == null ? void 0 : _c.arrange) !== "behind") { - this.pMain.removeChild(g); - this.pMain.addChild(g); - } - __privateMethod(this, _highlightMarks, highlightMarks_fn).call(this, g, capturedElements, Object.assign({}, DEFAULT_MOUSE_EVENT_STYLE, (_d = this.options.spec.style) == null ? void 0 : _d.mouseOver)); - publish("mouseOver", { - id: context.viewUid, - genomicPosition, - data: capturedElements.map((d) => d.value) - }); - } - const models = this.visibleAndFetchedGoslingModels(); - const firstTooltipSpec = (_e = models.find((m2) => { - var _a2; - return m2.spec().tooltip && ((_a2 = m2.spec().tooltip) == null ? void 0 : _a2.length) !== 0; - })) == null ? void 0 : _e.spec().tooltip; - if (firstTooltipSpec) { - let content = firstTooltipSpec.map((d) => { - var _a2; - const rawValue = capturedElements[0].value[d.field]; - let value = rawValue; - if (d.type === "quantitative" && d.format) { - value = HGC.libraries.d3Format.format(d.format)(+rawValue); - } else if (d.type === "genomic") { - const { chromosome, position } = getRelativeGenomicPosition(+rawValue, __privateGet(this, _assembly2)); - value = `${chromosome}:${HGC.libraries.d3Format.format(",")(position)}`; - } - return `${(_a2 = d.alt) != null ? _a2 : d.field}${value}`; - }).join(""); - content = `${content}
`; - if (capturedElements.length > 1) { - content += `
${capturedElements.length - 1} Additional Selections...
`; - } - return `
${content}
`; - } - } - return ""; - } - /* * - * - * Other misc methods and overrides - * - * */ - /** - * Returns the minimum in the visible area (not visible tiles). - * Overrides method in Tiled1DPixiTrack - */ - minVisibleValue() { - return 0; - } - /** - * Returns the maximum in the visible area (not visible tiles). - * Overrides method in Tiled1DPixiTrack. - */ - maxVisibleValue() { - return 0; - } - /** - * Overrides method in PixiTrack. SVG export is not supported. - */ - exportSVG() { - throw new Error("exportSVG() not supported for gosling-track"); - } - /** - * Show visual cue during waiting for visualizations being rendered. Also called by data fetchers - */ - drawLoadingCue() { - if (this.fetching.size) { - const margin = 6; - const text = `Fetching... ${Array.from(this.fetching).join(" ")}`; - __privateGet(this, _loadingText).text = text; - __privateGet(this, _loadingText).x = this.position[0] + this.dimensions[0] - margin / 2; - __privateGet(this, _loadingText).y = this.position[1] + this.dimensions[1] - margin / 2; - const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, __privateGet(this, _loadingTextStyleObj)); - const { width: w, height: h } = metric; - __privateGet(this, _loadingTextBg).clear(); - __privateGet(this, _loadingTextBg).lineStyle(1, colorToHex("grey"), 1, 0.5); - __privateGet(this, _loadingTextBg).beginFill(colorToHex("white"), 0.8); - __privateGet(this, _loadingTextBg).drawRect( - this.position[0] + this.dimensions[0] - w - margin - 1, - this.position[1] + this.dimensions[1] - h - margin - 1, - w + margin, - h + margin - ); - __privateGet(this, _loadingText).visible = true; - __privateGet(this, _loadingTextBg).visible = true; - } else { - __privateGet(this, _loadingText).visible = false; - __privateGet(this, _loadingTextBg).visible = false; - } - } - /** - * Called in legend.ts - */ - updateScaleOffsetFromOriginalSpec(_renderingId, scaleOffset, channelKey) { - this.getResolvedTracks().map((spec) => { - if (spec._renderingId === _renderingId) { - const channel = spec[channelKey]; - if (IsChannelDeep(channel)) { - channel.scaleOffset = scaleOffset; - } - } - }); - } - /** - * Called in legend.ts - */ - shareScaleOffsetAcrossTracksAndTiles(scaleOffset, channelKey) { - const models = this.visibleAndFetchedGoslingModels(); - models.forEach((d) => { - const channel = d.spec()[channelKey]; - if (IsChannelDeep(channel)) { - channel.scaleOffset = scaleOffset; - } - const channelOriginal = d.originalSpec()[channelKey]; - if (IsChannelDeep(channelOriginal)) { - channelOriginal.scaleOffset = scaleOffset; - } - }); - } - }; - _assembly2 = new WeakMap(); - _processedTileInfo = new WeakMap(); - _mouseDownX = new WeakMap(); - _mouseDownY = new WeakMap(); - _isRangeBrushActivated = new WeakMap(); - _gBrush = new WeakMap(); - _loadingTextStyleObj = new WeakMap(); - _loadingTextBg = new WeakMap(); - _loadingText = new WeakMap(); - _tilesToId = new WeakSet(); - tilesToId_fn = function(xTiles, yTiles, zoomLevel) { - if (!yTiles) { - return xTiles.map((x) => [zoomLevel, x]); - } - const tiles = []; - xTiles.forEach((x) => yTiles.forEach((y) => tiles.push([zoomLevel, x, y]))); - return tiles; - }; - _binsPerTile = new WeakSet(); - binsPerTile_get = function() { - let maybeValue; - if (this.tilesetInfo) { - maybeValue = "bins_per_dimension" in this.tilesetInfo ? this.tilesetInfo.bins_per_dimension : this.tilesetInfo.tile_size; - } - return maybeValue != null ? maybeValue : 256; - }; - _generateTabularData = new WeakSet(); - generateTabularData_fn = function(tile, force = false) { - if (__privateGet(this, _processedTileInfo)[tile.tileId] && !force) { - return; - } - if (!tile.tileData.tilePos) { - return; - } - const tileInfo = initProcessedTileInfo(); - const resolvedTracks = this.getResolvedTracks(); - if (resolvedTracks.length === 0) { - return []; - } - const firstResolvedTrack = resolvedTracks[0]; - if ("tabularData" in tile.tileData) { - tileInfo.tabularData = tile.tileData.tabularData; - } else { - const { tileX, tileY, tileWidth, tileHeight } = this.getTilePosAndDimensions( - tile.tileData.zoomLevel, - tile.tileData.tilePos - ); - const sparse = "length" in tile.tileData ? Array.from(tile.tileData) : []; - const extendedTileData = Object.assign({}, tile.tileData, { - sparse, - tileX, - tileY, - tileWidth, - tileHeight, - tileSize: this.tileSize - }); - const tabularData = getTabularData(firstResolvedTrack, extendedTileData); - if (tabularData) { - tileInfo.tabularData = tabularData; - } - } - __privateGet(this, _processedTileInfo)[tile.tileId] = tileInfo; - }; - _onMouseDown = new WeakSet(); - onMouseDown_fn = function(mouseX, mouseY, isAltPressed) { - var _a; - __privateSet(this, _mouseDownX, mouseX); - __privateSet(this, _mouseDownY, mouseY); - const mouseEvents = (_a = this.options.spec.experimental) == null ? void 0 : _a.mouseEvents; - const rangeSelectEnabled = !!mouseEvents || IsMouseEventsDeep(mouseEvents) && !!mouseEvents.rangeSelect; - __privateSet(this, _isRangeBrushActivated, rangeSelectEnabled && isAltPressed); - this.pMouseHover.clear(); - }; - _onMouseMove = new WeakSet(); - onMouseMove_fn = function(mouseX) { - if (this.options.spec.layout === "circular") { - return; - } - if (__privateGet(this, _isRangeBrushActivated)) { - this.mRangeBrush.updateRange([mouseX, __privateGet(this, _mouseDownX)]).drawBrush().visible().disable(); - } - }; - _onMouseUp = new WeakSet(); - onMouseUp_fn = function(mouseX, mouseY) { - var _a; - __privateMethod(this, _publishTrackEvents, publishTrackEvents_fn).call(this, "trackClick", mouseX, mouseY); - const mouseEvents = (_a = this.options.spec.experimental) == null ? void 0 : _a.mouseEvents; - const clickEnabled = !!mouseEvents || IsMouseEventsDeep(mouseEvents) && !!mouseEvents.click; - const isDrag = Math.sqrt((__privateGet(this, _mouseDownX) - mouseX) ** 2 + (__privateGet(this, _mouseDownY) - mouseY) ** 2) > 1; - if (!__privateGet(this, _isRangeBrushActivated) && !isDrag) { - this.mRangeBrush.clear(); - this.pMouseSelection.clear(); - } else { - this.mRangeBrush.enable(); - } - __privateSet(this, _isRangeBrushActivated, false); - if (!this.tilesetInfo) { - return; - } - if (!isDrag && clickEnabled) { - const genomicPosition = getRelativeGenomicPosition( - Math.floor(this._xScale.invert(mouseX)), - __privateGet(this, _assembly2) - ); - const capturedElements = __privateMethod(this, _getElementsWithinMouse, getElementsWithinMouse_fn).call(this, mouseX, mouseY); - if (capturedElements.length !== 0) { - this.options.siblingIds.forEach( - (id) => publish("click", { - id, - genomicPosition, - data: capturedElements.map((d) => d.value) - }) - ); - } - } - }; - _onMouseOut = new WeakSet(); - onMouseOut_fn = function() { - __privateSet(this, _isRangeBrushActivated, false); - document.body.style.cursor = "default"; - this.pMouseHover.clear(); - }; - _getElementsWithinMouse = new WeakSet(); - getElementsWithinMouse_fn = function(mouseX, mouseY) { - var _a; - const models = this.visibleAndFetchedGoslingModels(); - const mouseEvents = (_a = this.options.spec.experimental) == null ? void 0 : _a.mouseEvents; - const multiHovering = IsMouseEventsDeep(mouseEvents) && mouseEvents.enableMouseOverOnMultipleMarks; - const idField = IsMouseEventsDeep(mouseEvents) && mouseEvents.groupMarksByField; - const mergedCapturedElements = models.map((model) => model.getMouseEventModel().findAll(mouseX, mouseY, true)).flat(); - if (!multiHovering) { - mergedCapturedElements.splice(1, mergedCapturedElements.length - 1); - } - if (mergedCapturedElements.length !== 0 && idField) { - const source = Array.from(mergedCapturedElements); - models.forEach((model) => { - const siblings = model.getMouseEventModel().getSiblings(source, idField); - mergedCapturedElements.push(...siblings); - }); - } - return mergedCapturedElements; - }; - _publishTrackEvents = new WeakSet(); - publishTrackEvents_fn = function(eventType, mouseX, mouseY) { - const [x, y] = this.position; - const [width, height] = this.dimensions; - if (this.options.spec.layout === "circular") { - const cx = x + width / 2; - const cy = y + height / 2; - const innerRadius = this.options.spec.innerRadius; - const outerRadius = this.options.spec.outerRadius; - const startAngle = this.options.spec.startAngle; - const endAngle = this.options.spec.endAngle; - if (isPointInsideDonutSlice( - [mouseX, mouseY], - [width / 2, height / 2], - [innerRadius, outerRadius], - [startAngle, endAngle] - )) { - publish(eventType, { - id: context.viewUid, - spec: this.options.spec, - shape: { x, y, width, height, cx, cy, innerRadius, outerRadius, startAngle, endAngle } - }); - } - } else { - publish(eventType, { - id: context.viewUid, - spec: this.options.spec, - shape: { x, y, width, height } - }); - } - }; - _onRangeBrush = new WeakSet(); - onRangeBrush_fn = function(range, skipApiTrigger = false) { - var _a, _b, _c, _d; - this.pMouseSelection.clear(); - if (range === null) { - if (!skipApiTrigger) { - publish("rangeSelect", { id: context.viewUid, genomicRange: null, data: [] }); - } - return; - } - const models = this.visibleAndFetchedGoslingModels(); - const [startX, endX] = range; - let capturedElements = models.map((model) => model.getMouseEventModel().findAllWithinRange(startX, endX, true)).flat(); - const mouseEvents = (_a = this.options.spec.experimental) == null ? void 0 : _a.mouseEvents; - const idField = IsMouseEventsDeep(mouseEvents) && mouseEvents.groupMarksByField; - if (capturedElements.length !== 0 && idField) { - models.forEach((model) => { - const siblings = model.getMouseEventModel().getSiblings(capturedElements, idField); - const siblingIds = Array.from(new Set(siblings.map((d) => d.value[idField]))); - capturedElements = capturedElements.filter((d) => siblingIds.indexOf(d.value[idField]) === -1); - }); - } - if (capturedElements.length !== 0) { - const g = this.pMouseSelection; - if (((_c = (_b = this.options.spec.style) == null ? void 0 : _b.select) == null ? void 0 : _c.arrange) !== "behind") { - this.pMain.removeChild(g); - this.pMain.addChild(g); - } - __privateMethod(this, _highlightMarks, highlightMarks_fn).call(this, g, capturedElements, Object.assign({}, DEFAULT_MOUSE_EVENT_STYLE, (_d = this.options.spec.style) == null ? void 0 : _d.select)); - } - if (!skipApiTrigger) { - const genomicRange = [ - getRelativeGenomicPosition(Math.floor(this._xScale.invert(startX)), __privateGet(this, _assembly2)), - getRelativeGenomicPosition(Math.floor(this._xScale.invert(endX)), __privateGet(this, _assembly2)) - ]; - publish("rangeSelect", { - id: context.viewUid, - genomicRange, - data: capturedElements.map((d) => d.value) - }); - } - this.forceDraw(); - }; - _highlightMarks = new WeakSet(); - highlightMarks_fn = function(g, marks, style) { - g.lineStyle( - style.strokeWidth, - colorToHex(style.stroke), - style.strokeOpacity, - // alpha - 0.5 - // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) - ); - g.beginFill(colorToHex(style.color), style.color === "none" ? 0 : style.opacity); - marks.forEach((d) => { - if (d.type === "point") { - const [x, y, r = 3] = d.polygon; - g.drawCircle(x, y, r); - } else if (d.type === "line") { - g.moveTo(d.polygon[0], d.polygon[1]); - flatArrayToPairArray(d.polygon).map((d2) => g.lineTo(d2[0], d2[1])); - } else { - g.drawPolygon(d.polygon); - } - }); - }; - _publishOnNewTrack = new WeakSet(); - publishOnNewTrack_fn = function() { - publish("onNewTrack", { - id: context.viewUid - }); - }; - _hasStretchableGraphics = new WeakSet(); - hasStretchableGraphics_fn = function() { - var _a, _b; - const hasStretchOption = (_a = this.options.spec.experimental) == null ? void 0 : _a.stretchGraphics; - if (hasStretchOption === true) { - return true; - } else if (hasStretchOption === false) { - return false; - } - const isFirstTrack1D = !Is2DTrack(this.getResolvedTracks()[0]); - const isNotCircularLayout = this.options.spec.layout !== "circular"; - const stretchableMarks = ["bar", "line", "rect", "area"]; - const hasStretchableMark = this.getResolvedTracks().reduce( - (acc, spec) => acc && stretchableMarks.includes(spec.mark), - true - ); - const noMouseInteractions = !((_b = this.options.spec.experimental) == null ? void 0 : _b.mouseEvents); - return isFirstTrack1D && isNotCircularLayout && hasStretchableMark && noMouseInteractions; - }; - _isTooStretched = new WeakSet(); - isTooStretched_fn = function(stretchFactor) { - var _a, _b; - const defaultThreshold = 1.5; - const threshold = (_b = (_a = this.options.spec.experimental) == null ? void 0 : _a.stretchGraphicsThreshold) != null ? _b : defaultThreshold; - return stretchFactor > threshold || stretchFactor < 1 / threshold; - }; - /** - * Convert tile positions to tile IDs - */ - __privateAdd(_GoslingTrackClass, _tilesToId); - let GoslingTrackClass = _GoslingTrackClass; - return new GoslingTrackClass(); -}; -const GoslingTrack = createPluginTrack(config$1, factory$1); -const config = { - type: "dummy-track", - defaultOptions: { - height: 0, - // default height gets set in when spec is preprocessed - width: 0, - // default width gets set in when spec is preprocessed - title: "", - background: "#fff", - textFontSize: 12, - textFontWeight: "normal", - textStroke: "#000", - textStrokeWidth: 0.1, - outline: "#fff" - } -}; -const factory = (HGC, context, options) => { - var _drawBackground, drawBackground_fn, _drawText, drawText_fn; - const { SVGTrack } = HGC.tracks; - class DummyTrackClass extends SVGTrack { - constructor() { - super(context, options); - __privateAdd(this, _drawBackground); - /** - * Draws the title of the dummy track - */ - __privateAdd(this, _drawText); - __privateMethod(this, _drawBackground, drawBackground_fn).call(this); - __privateMethod(this, _drawText, drawText_fn).call(this); - publish("onNewTrack", { - id: context.viewUid - }); - } - } - _drawBackground = new WeakSet(); - drawBackground_fn = function() { - this.gMain.append("rect").attr("fill", options.background).attr("x", 0).attr("y", 0).attr("width", options.width).attr("height", options.height).style("stroke", options.outline); - }; - _drawText = new WeakSet(); - drawText_fn = function() { - this.gMain.append("text").attr("x", options.width / 2).attr("y", (options.height + options.textFontSize) / 2).style("text-anchor", "middle").style("font-size", `${options.textFontSize}px`).style("font-weight", options.textFontWeight).style("stroke", options.textStroke).style("stroke-width", options.textStrokeWidth).text(options.title); - }; - return new DummyTrackClass(); -}; -const DummyTrack = createPluginTrack(config, factory); -let once = false; -function init() { - if (once) - return; - higlassRegister({ - name: "GoslingTrack", - track: GoslingTrack, - config: GoslingTrack.config - }); - higlassRegister({ - name: "Gosling2DTrack", - track: GoslingTrack, - config: { - ...GoslingTrack.config, - type: "gosling-2d-track", - orientation: "2d" - } - }); - higlassRegister({ - name: "AxisTrack", - track: AxisTrack, - config: AxisTrack.config - }); - higlassRegister({ - name: "TextTrack", - track: TextTrack, - config: TextTrack.config - }); - higlassRegister({ - name: "BrushTrack", - track: BrushTrack, - config: BrushTrack.config - }); - higlassRegister({ - name: "DummyTrack", - track: DummyTrack, - config: DummyTrack.config - }); - for (const dataFetcher of Object.values(dataFetchers)) { - const { config: config2 } = dataFetcher; - higlassRegister({ dataFetcher, config: config2 }, { pluginType: "dataFetcher" }); - } - once = true; -} -function getBoundingBox(trackInfos) { - let width = 0; - let height = 0; - trackInfos.forEach((_) => { - const w = _.boundingBox.x + _.boundingBox.width; - const h = _.boundingBox.y + _.boundingBox.height; - if (height < h) { - height = h; - } - if (width < w) { - width = w; - } - }); - return { width, height }; -} -function getRelativeTrackInfo(spec, theme) { - var _a, _b; - let trackInfos = []; - traverseAndCollectTrackInfo(spec, trackInfos); - const size = getBoundingBox(trackInfos); - if (spec.title || spec.subtitle) { - const titleHeight = (spec.title ? ((_a = theme.root.titleFontSize) != null ? _a : 18) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM : 0) + (spec.subtitle ? ((_b = theme.root.subtitleFontSize) != null ? _b : 14) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM : 0); - const marginBottom = 4; - size.height += titleHeight + marginBottom; - size.height = size.height + (8 - size.height % 8); - trackInfos.forEach((_) => { - _.boundingBox.y += titleHeight + marginBottom; - }); - trackInfos = [ - { - track: getTextTrack({ width: size.width, height: titleHeight }, spec.title, spec.subtitle), - boundingBox: { x: 0, y: 0, width: size.width, height: titleHeight }, - layout: { x: 0, y: 0, w: 12, h: titleHeight / size.height * 12 } - }, - ...trackInfos - ]; - } else { - size.height = size.height + (8 - size.height % 8); - } - const pixelPreciseMarginPadding = !(typeof spec.responsiveSize !== "object" ? spec.responsiveSize : spec.responsiveSize.height); - trackInfos.forEach((_) => { - _.layout.x = _.boundingBox.x / size.width * 12; - _.layout.w = _.boundingBox.width / size.width * 12; - _.layout.y = pixelPreciseMarginPadding ? _.boundingBox.y : _.boundingBox.y / size.height * 12; - _.layout.h = pixelPreciseMarginPadding ? _.boundingBox.height : _.boundingBox.height / size.height * 12; - }); - return { trackInfos, size }; -} -function traverseAndCollectTrackInfo(spec, output, dx = 0, dy = 0, circularRootNotFound = true) { - let cumWidth = 0; - let cumHeight = 0; - let allChildCircularLayout = true; - let traversedAtLeastOnce = false; - traverseTracksAndViews(spec, (tv) => { - traversedAtLeastOnce = true; - if (tv.layout !== "circular") { - allChildCircularLayout = false; - } - }); - let noChildConcatArrangement = true; - traverseViewArrangements(spec, (a) => { - if (a.arrangement === "vertical" || a.arrangement === "horizontal") { - noChildConcatArrangement = false; - } - }); - const isThisCircularRoot = circularRootNotFound && allChildCircularLayout && traversedAtLeastOnce && noChildConcatArrangement && ("views" in spec && (spec.arrangement === "parallel" || spec.arrangement === "serial") || "tracks" in spec); - const numTracksBeforeInsert = output.length; - if ("tracks" in spec) { - const tracks = spec.tracks; - if (spec.orientation === "vertical") { - cumHeight = Math.max(...tracks.map((d) => d.height)); - tracks.forEach((track, i, array) => { - if (getNumOfXAxes([track]) === 1) { - track.width += HIGLASS_AXIS_SIZE; - } - track.height = cumHeight; - output.push({ - track, - boundingBox: { - x: dx + cumWidth, - y: dy, - width: track.width, - height: cumHeight - }, - layout: { x: 0, y: 0, w: 0, h: 0 } - // Just put a dummy info here, this should be added after entire bounding box has been determined - }); - if (array[i + 1] && array[i + 1].overlayOnPreviousTrack) - ; - else { - cumWidth += track.width; - if (i !== array.length - 1) { - cumWidth += spec.spacing !== void 0 ? spec.spacing : 0; - } - } - }); - } else { - cumWidth = Math.max(...tracks.map((d) => d.width)); - tracks.forEach((track, i, array) => { - if (getNumOfXAxes([track]) === 1) { - track.height += HIGLASS_AXIS_SIZE; - } - const singleTrack = resolveSuperposedTracks(track); - if (singleTrack.length > 0 && Is2DTrack(singleTrack[0]) && getNumOfYAxes([track]) === 1) { - cumWidth += HIGLASS_AXIS_SIZE; - } - track.width = cumWidth; - output.push({ - track, - boundingBox: { - x: dx, - y: dy + cumHeight, - width: cumWidth, - height: track.height - }, - layout: { x: 0, y: 0, w: 0, h: 0 } - // Just put a dummy info here, this should be added after entire bounding box has been determined - }); - if (array[i + 1] && array[i + 1].overlayOnPreviousTrack) - ; - else { - cumHeight += track.height; - if (i !== array.length - 1) { - cumHeight += spec.spacing !== void 0 ? spec.spacing : 0; - } - } - }); - } - } else { - if (spec.arrangement === "parallel" || spec.arrangement === "vertical") { - const spacing = spec.spacing !== void 0 ? spec.spacing : DEFAULT_VIEW_SPACING; - spec.views.forEach((v, i, array) => { - var _a, _b, _c, _d, _e; - const viewBB = traverseAndCollectTrackInfo( - v, - output, - dx + ((_a = v.xOffset) != null ? _a : 0), - dy + ((_b = v.yOffset) != null ? _b : 0) + cumHeight, - !isThisCircularRoot && circularRootNotFound - ); - if (cumWidth < ((_c = v.xOffset) != null ? _c : 0) + viewBB.width) { - cumWidth = ((_d = v.xOffset) != null ? _d : 0) + viewBB.width; - } - if (i !== array.length - 1) { - cumHeight += spacing; - } - cumHeight += ((_e = v.yOffset) != null ? _e : 0) + viewBB.height; - }); - } else if (spec.arrangement === "serial" || spec.arrangement === "horizontal") { - spec.views.forEach((v, i, array) => { - var _a, _b, _c, _d, _e; - const spacing = spec.spacing !== void 0 ? spec.spacing : DEFAULT_VIEW_SPACING; - const viewBB = traverseAndCollectTrackInfo( - v, - output, - dx + ((_a = v.xOffset) != null ? _a : 0) + cumWidth, - dy + ((_b = v.yOffset) != null ? _b : 0), - !isThisCircularRoot && circularRootNotFound - ); - if (cumHeight < ((_c = v.xOffset) != null ? _c : 0) + viewBB.height) { - cumHeight = ((_d = v.xOffset) != null ? _d : 0) + viewBB.height; - } - if (i !== array.length - 1) { - cumWidth += spacing; - } - cumWidth += ((_e = v.xOffset) != null ? _e : 0) + viewBB.width; - }); - } - } - if (isThisCircularRoot) { - const cTracks = output.slice(numTracksBeforeInsert); - const ifMultipleViews = "views" in spec && (spec.arrangement === "parallel" || spec.arrangement === "serial") && spec.views.length > 1; - const SPACING = spec.spacing !== void 0 ? spec.spacing : DEFAULT_VIEW_SPACING; - const PADDING = DEFAULT_CIRCULAR_VIEW_PADDING; - const INNER_RADIUS = spec.centerRadius !== void 0 ? spec.centerRadius : DEFAULT_INNER_RADIUS_PROP; - const TOTAL_RADIUS = cumWidth / 2 + PADDING; - const TOTAL_RING_SIZE = TOTAL_RADIUS * (1 - INNER_RADIUS); - cTracks.forEach((t, i) => { - var _a, _b; - if (IsDummyTrack(t.track)) { - return; - } - t.track.layout = "circular"; - t.track.outerRadius = TOTAL_RADIUS - PADDING - (t.boundingBox.y - dy) / cumHeight * TOTAL_RING_SIZE; - t.track.innerRadius = TOTAL_RADIUS - PADDING - (t.boundingBox.y + t.boundingBox.height - dy) / cumHeight * TOTAL_RING_SIZE; - const spacingAngle = SPACING / cumWidth * 360; - t.track.startAngle = spacingAngle + (t.boundingBox.x - dx) / cumWidth * (cumWidth - SPACING) / cumWidth * 360; - t.track.endAngle = (t.boundingBox.x + t.boundingBox.width - dx) / cumWidth * (cumWidth - SPACING) / cumWidth * 360; - t.boundingBox.x = dx + ((_a = t.track.xOffset) != null ? _a : 0); - t.boundingBox.y = dy + ((_b = t.track.yOffset) != null ? _b : 0); - t.boundingBox.height = t.track.height = t.boundingBox.width = t.track.width = TOTAL_RADIUS * 2; - if (i !== 0) { - t.track.overlayOnPreviousTrack = true; - } - if (ifMultipleViews) { - if (IsOverlaidTrack(t.track)) { - t.track._overlay = t.track._overlay.filter((o) => o.mark !== "brush"); - } - } - }); - cumHeight = TOTAL_RADIUS * 2; - } - spec._assignedWidth = cumWidth; - spec._assignedHeight = cumHeight; - return { x: dx, y: dy, width: cumWidth, height: cumHeight }; -} -function getNumOfXAxes(tracks) { - return tracks.filter((t) => IsXAxis(t)).length; -} -function getNumOfYAxes(tracks) { - return tracks.filter((t) => IsYAxis(t)).length; -} -const getTextTrack = (size, title, subtitle) => { - return JSON.parse( - JSON.stringify({ - mark: "header", - width: size.width, - height: size.height, - title, - subtitle - }) - ); -}; -function parseServerAndTilesetUidFromUrl(url) { - if (!url.includes("tileset_info/?d=") || !url.includes("https:") && !url.includes("http:")) { - return { server: void 0, tilesetUid: void 0 }; - } - const server = url.split("tileset_info/?d=")[0]; - const tilesetUid = url.split("tileset_info/?d=")[1]; - return { server, tilesetUid }; -} -function goslingToHiGlass(hgModel, gosTrack, bb, layout, theme, idMapper, urlToFetchOptions) { - var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o; - if (IsDummyTrack(gosTrack)) { - hgModel.addDefaultView(gosTrack.id).setDummyTrack(gosTrack).setLayout(layout); - return hgModel; - } - const resolvedSpecs = resolveSuperposedTracks(gosTrack); - const firstResolvedSpec = resolvedSpecs[0]; - const trackId = (_a = firstResolvedSpec.id) != null ? _a : uuid(); - if (!firstResolvedSpec.id) { - firstResolvedSpec.id = trackId; - } - resolvedSpecs.forEach((spec) => { - if (spec.id) { - idMapper.addMapping(spec.id, trackId); - } - }); - const assembly = firstResolvedSpec.assembly; - if (IsDataDeep(firstResolvedSpec.data)) { - let server, tilesetUid; - if (IsDataDeepTileset(firstResolvedSpec.data)) { - const parsed = parseServerAndTilesetUidFromUrl(firstResolvedSpec.data.url); - server = parsed.server; - tilesetUid = parsed.tilesetUid; - } - const genomicChannel = getGenomicChannelFromTrack(firstResolvedSpec); - const genomicChannelKey = getGenomicChannelKeyFromTrack(firstResolvedSpec); - const isXGenomic = genomicChannelKey === "x" || genomicChannelKey === "xe"; - const xDomain = isXGenomic && IsChannelDeep(genomicChannel) ? genomicChannel.domain : void 0; - const yDomain = Is2DTrack(firstResolvedSpec) && IsChannelDeep(firstResolvedSpec.y) ? firstResolvedSpec.y.domain : void 0; - const width = bb.width - (firstResolvedSpec.layout !== "circular" && firstResolvedSpec.orientation === "vertical" && IsXAxis(firstResolvedSpec) ? HIGLASS_AXIS_SIZE : 0); - const height = bb.height - (firstResolvedSpec.layout !== "circular" && firstResolvedSpec.orientation === "horizontal" && IsXAxis(firstResolvedSpec) ? HIGLASS_AXIS_SIZE : 0); - const hgTrack = { - uid: `${trackId}-track`, - // This is being used to cache the visualization - type: Is2DTrack(firstResolvedSpec) ? "gosling-2d-track" : "gosling-track", - server, - tilesetUid, - width, - height, - options: { - id: trackId, - siblingIds: idMapper.getSiblingGoslingIds(trackId), - /* Mouse hover position */ - showMousePosition: firstResolvedSpec.layout === "circular" ? false : theme.root.showMousePosition, - // show mouse position only for linear tracks // TODO: or vertical - mousePositionColor: theme.root.mousePositionColor, - /* Track title */ - name: firstResolvedSpec.layout === "linear" ? firstResolvedSpec.title : " ", - labelPosition: firstResolvedSpec.title ? theme.track.titleAlign === "left" ? "topLeft" : "topRight" : "none", - labelShowResolution: false, - labelColor: theme.track.titleColor, - labelBackgroundColor: theme.track.titleBackground, - labelBackgroundOpacity: 0.5, - // TODO: Support `theme.track.titleBackgroundOpacity` - labelTextOpacity: 1, - labelLeftMargin: 1, - labelTopMargin: 1, - labelRightMargin: 0, - labelBottomMargin: 0, - // TODO: Use this eventually - // trackBorderWidth: firstResolvedSpec.style?.outlineWidth ?? 3, - // trackBorderColor: firstResolvedSpec.style?.outline ?? '#DBDBDB', - /* Others */ - backgroundColor: "transparent", - // in this way, we can superpose multiple tracks - spec: { ...gosTrack }, - theme - } - }; - if (firstResolvedSpec.data && IsDataDeep(firstResolvedSpec.data) && (firstResolvedSpec.data.type === "csv" || firstResolvedSpec.data.type === "json" || firstResolvedSpec.data.type === "bigwig" || firstResolvedSpec.data.type === "bam" || firstResolvedSpec.data.type === "vcf" || firstResolvedSpec.data.type === "gff" || firstResolvedSpec.data.type === "bed" || // TODO: This is a hack to enable custom data fetchers - firstResolvedSpec.data.useCustomDataFetcher)) { - const getFieldName = (c) => { - const cDef = firstResolvedSpec[c]; - return cDef && IsChannelDeep(cDef) ? cDef.field : void 0; - }; - const xFields = { - x: getFieldName("x"), - xe: getFieldName("xe"), - x1: getFieldName("x1"), - x1e: getFieldName("x1e") - }; - const urlFetchOptions = "url" in firstResolvedSpec.data && (urlToFetchOptions == null ? void 0 : urlToFetchOptions[firstResolvedSpec.data.url]) || {}; - const indexUrlFetchOptions = "indexUrl" in firstResolvedSpec.data && (urlToFetchOptions == null ? void 0 : urlToFetchOptions[firstResolvedSpec.data.indexUrl]) || {}; - hgTrack.data = { - ...firstResolvedSpec.data, - ...xFields, - urlFetchOptions, - indexUrlFetchOptions, - // Additionally, add assembly, otherwise, a default genome build is used - assembly - // TODO: should look all sub tracks' `dataTransform` and apply OR operation. - // Add a data transformation spec so that the fetcher can properly sample datasets - // filter: (firstResolvedSpec as any).dataTransform?.filter((f: DataTransform) => f.type === 'filter') - }; - } - if (IsHiGlassMatrix(firstResolvedSpec)) { - hgTrack.type = "heatmap"; - const colorStr = IsChannelDeep(firstResolvedSpec.color) && typeof firstResolvedSpec.color.range === "string" ? firstResolvedSpec.color.range : "viridis"; - hgTrack.options.colorRange = getHiGlassColorRange(colorStr); - hgTrack.options.trackBorderWidth = (_c = (_b = firstResolvedSpec.style) == null ? void 0 : _b.outlineWidth) != null ? _c : theme.track.outlineWidth; - hgTrack.options.trackBorderColor = (_e = (_d = firstResolvedSpec.style) == null ? void 0 : _d.outline) != null ? _e : theme.track.outline; - hgTrack.options.extent = (_g = (_f = firstResolvedSpec.style) == null ? void 0 : _f.matrixExtent) != null ? _g : "full"; - hgTrack.options.colorbarPosition = ((_h = firstResolvedSpec.color) == null ? void 0 : _h.legend) ? hgTrack.options.extent === "lower-left" ? "bottomLeft" : "topRight" : "hidden"; - } - if (firstResolvedSpec.overlayOnPreviousTrack) { - hgModel.setViewOrientation(firstResolvedSpec.orientation).addTrackToCombined(hgTrack); - } else { - hgModel.setViewOrientation(firstResolvedSpec.orientation).setAssembly(assembly).addDefaultView(trackId, assembly).setDomain(xDomain, yDomain != null ? yDomain : xDomain).adjustDomain(firstResolvedSpec.orientation, width, height).setMainTrack(hgTrack).addTrackSourceServers(server).setZoomFixed(firstResolvedSpec.static === true).setZoomLimits((_i = firstResolvedSpec.zoomLimits) != null ? _i : [1, null]).setLayout(layout); - } - const getAxisNarrowType = (c, orientation = "horizontal", width2, height2) => { - const narrowSizeThreshold = 400; - const narrowerSizeThreshold = 200; - if (orientation === "horizontal") { - if (c === "x" && width2 <= narrowerSizeThreshold || c === "y" && height2 <= narrowerSizeThreshold) { - return "narrower"; - } else if (c === "x" && width2 <= narrowSizeThreshold || c === "y" && height2 <= narrowSizeThreshold) { - return "narrow"; - } else { - return "regular"; - } - } else { - if (c === "x" && height2 <= narrowerSizeThreshold || c === "y" && width2 <= narrowerSizeThreshold) { - return "narrower"; - } else if (c === "x" && height2 <= narrowSizeThreshold || c === "y" && width2 <= narrowSizeThreshold) { - return "narrow"; - } else { - return "regular"; - } - } - }; - ["x", "y"].forEach((c) => { - const channel = firstResolvedSpec[c]; - if (IsChannelDeep(channel) && "axis" in channel && channel.axis && channel.axis !== "none" && channel.type === "genomic") { - const narrowType = getAxisNarrowType(c, gosTrack.orientation, bb.width, bb.height); - hgModel.setAxisTrack(channel.axis, narrowType, { - id: `${trackId}-${channel.axis}-axis`, - layout: firstResolvedSpec.layout, - innerRadius: channel.axis === "top" ? firstResolvedSpec.outerRadius - HIGLASS_AXIS_SIZE : firstResolvedSpec.innerRadius, - outerRadius: channel.axis === "top" ? firstResolvedSpec.outerRadius : firstResolvedSpec.innerRadius + HIGLASS_AXIS_SIZE, - width: firstResolvedSpec.width, - height: firstResolvedSpec.height, - startAngle: firstResolvedSpec.startAngle, - endAngle: firstResolvedSpec.endAngle, - theme - }); - } - }); - hgModel.validateSpec(true); - } else if (firstResolvedSpec.mark === "header") { - hgModel.addDefaultView(`${trackId}-title`).setLayout(layout); - if (typeof firstResolvedSpec.title === "string") { - hgModel.setTextTrack( - bb.width, - ((_j = theme.root.titleFontSize) != null ? _j : 18) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM, - firstResolvedSpec.title, - theme.root.titleColor, - (_k = theme.root.titleFontSize) != null ? _k : 18, - theme.root.titleFontWeight, - theme.root.titleAlign, - theme.root.titleBackgroundColor, - (_l = theme.root.titleFontFamily) != null ? _l : DEFAULT_TEXT_STYLE.fontFamily - ); - } - if (typeof firstResolvedSpec.subtitle === "string") { - hgModel.setTextTrack( - bb.width, - // TODO: better way to safely get the value when undefined? - ((_m = theme.root.subtitleFontSize) != null ? _m : 14) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM, - firstResolvedSpec.subtitle, - theme.root.subtitleColor, - (_n = theme.root.subtitleFontSize) != null ? _n : 14, - theme.root.subtitleFontWeight, - theme.root.subtitleAlign, - theme.root.subtitleBackgroundColor, - (_o = theme.root.subtitleFontFamily) != null ? _o : DEFAULT_TEXT_STYLE.fontFamily - ); - } - } - return hgModel; -} -function getLinkingInfo(hgModel) { - const linkingInfo = []; - hgModel.spec().views.forEach((v) => { - var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o; - const hgViewId = v.uid; - let spec = ( - /* TODO: */ - (_e = (_d = (_c = (_b = (_a = v.tracks.center) == null ? void 0 : _a[0]) == null ? void 0 : _b.contents) == null ? void 0 : _c[0]) == null ? void 0 : _d.options) == null ? void 0 : _e.spec - ); - if (!spec) { - spec = /* TODO: */ - (_j = (_i = (_h = (_g = (_f = v.tracks.left) == null ? void 0 : _f[0]) == null ? void 0 : _g.contents) == null ? void 0 : _h[0]) == null ? void 0 : _i.options) == null ? void 0 : _j.spec; - if (!spec) { - spec = /* TODO: */ - (_o = (_n = (_m = (_l = (_k = v.tracks.left) == null ? void 0 : _k[1]) == null ? void 0 : _l.contents) == null ? void 0 : _m[0]) == null ? void 0 : _n.options) == null ? void 0 : _o.spec; - } - } - if (!hgViewId || !spec) - return; - const resolved = resolveSuperposedTracks(spec); - resolved.forEach((spec2) => { - SUPPORTED_CHANNELS.forEach((cKey) => { - var _a2, _b2, _c2, _d2; - const channel = spec2[cKey]; - if (IsChannelDeep(channel) && "linkingId" in channel && channel.linkingId) { - linkingInfo.push({ - layout: spec2.layout === "circular" ? "circular" : "linear", - hgViewId, - linkId: channel.linkingId, - isBrush: spec2.mark === "brush", - style: { - color: (_a2 = spec2.color) == null ? void 0 : _a2.value, - stroke: (_b2 = spec2.stroke) == null ? void 0 : _b2.value, - strokeWidth: (_c2 = spec2.strokeWidth) == null ? void 0 : _c2.value, - opacity: (_d2 = spec2.opacity) == null ? void 0 : _d2.value, - startAngle: spec2.startAngle, - endAngle: spec2.endAngle, - innerRadius: spec2.innerRadius, - outerRadius: spec2.outerRadius - } - }); - return; - } - }); - }); - }); - return linkingInfo; -} -class GoslingToHiGlassIdMapper { - constructor() { - /** A mapping table between Gosling track IDs to HiGlass view IDs */ - __privateAdd(this, _table, {}); - } - addMapping(gtId, hvId) { - if (__privateGet(this, _table)[gtId] && __privateGet(this, _table)[gtId] !== hvId) { - console.warn(`The track ID ${gtId} already exists but overwriting with a different ID.`); - } - __privateGet(this, _table)[gtId] = hvId; - } - getTable() { - return __privateGet(this, _table); - } - getGoslingIds() { - return Object.keys(__privateGet(this, _table)); - } - getHiGlassId(gtId) { - return __privateGet(this, _table)[gtId]; - } - /** - * Get IDs of Gosling tracks that became the same HiGlass view. - * @param HiGlassId - * @returns - */ - getSiblingGoslingIds(HiGlassId) { - return Object.entries(__privateGet(this, _table)).filter(([, hvId]) => hvId === HiGlassId).map(([gtId]) => gtId); - } -} -_table = new WeakMap(); -function getViewIds(spec) { - const viewIds = /* @__PURE__ */ new Set(); - if (spec.id) { - viewIds.add(spec.id); - } - traverseTracksAndViews(spec, (subSpec) => { - if ("views" in subSpec || "tracks" in subSpec) { - if (subSpec.id) { - viewIds.add(subSpec.id); - } - } - }); - return Array.from(viewIds); -} -function getTrackIds(spec) { - const trackIds = /* @__PURE__ */ new Set(); - traverseTracksAndViews(spec, (subSpec) => { - if (!("views" in subSpec) && !("tracks" in subSpec)) { - if (subSpec.id) { - trackIds.add(subSpec.id); - } - } - }); - return Array.from(trackIds); -} -function getInternalSpecById(spec, id) { - let internalSpec; - if (spec.id === id) { - internalSpec = spec; - } - traverseTracksAndViews(spec, (subSpec) => { - if (subSpec.id === id) { - internalSpec = subSpec; - } - }); - return internalSpec; -} -function getViewApiData(spec, tracks) { - return getViewIds(spec).map((viewId) => { - const internalSpec = getInternalSpecById(spec, viewId); - const trackIds = getTrackIds(internalSpec); - const bb = { - x: Number.MAX_SAFE_INTEGER, - y: Number.MAX_SAFE_INTEGER, - xe: -Number.MAX_SAFE_INTEGER, - ye: -Number.MAX_SAFE_INTEGER - }; - trackIds.map((trackId) => tracks.find((t) => t.id === trackId)).forEach((track) => { - if (!track) - return; - const { shape } = track; - if (bb.x > shape.x) { - bb.x = shape.x; - } - if (bb.y > shape.y) { - bb.y = shape.y; - } - if (bb.xe < shape.x + shape.width) { - bb.xe = shape.x + shape.width; - } - if (bb.ye < shape.y + shape.height) { - bb.ye = shape.y + shape.height; - } - }); - return { - id: viewId, - spec: internalSpec, - shape: { ...bb, width: bb.xe - bb.x, height: bb.ye - bb.y } - }; - }); -} -function renderHiGlass(spec, trackInfos, callback, theme, urlToFetchOptions) { - if (trackInfos.length === 0) { - return; - } - const hgModel = new HiGlassModel(); - const idMapper = new GoslingToHiGlassIdMapper(); - trackInfos.forEach((tb) => { - const { track, boundingBox: bb, layout } = tb; - goslingToHiGlass(hgModel, track, bb, layout, theme, idMapper, urlToFetchOptions); - }); - const linkingInfos = getLinkingInfo(hgModel); - linkingInfos.filter((d) => d.isBrush).forEach((info) => { - var _a; - hgModel.addBrush( - info.layout, - info.hgViewId, - theme, - (_a = linkingInfos.find((d) => !d.isBrush && d.linkId === info.linkId)) == null ? void 0 : _a.hgViewId, - info.style - ); - }); - linkingInfos.filter((d) => !d.isBrush).forEach((d) => { - hgModel.spec().zoomLocks.locksByViewUid[d.hgViewId] = d.linkId; - hgModel.spec().locationLocks.locksByViewUid[d.hgViewId] = d.linkId; - }); - const uniqueLinkIds = Array.from(new Set(linkingInfos.map((d) => d.linkId))); - uniqueLinkIds.forEach((linkId) => { - hgModel.spec().zoomLocks.locksDict[linkId] = { uid: linkId }; - hgModel.spec().locationLocks.locksDict[linkId] = { uid: linkId }; - linkingInfos.filter((d) => !d.isBrush).filter((d) => d.linkId === linkId).forEach((d) => { - hgModel.spec().zoomLocks.locksDict[linkId][d.hgViewId] = [1246253105e-1, 1246253105e-1, 249250.621]; - hgModel.spec().locationLocks.locksDict[linkId][d.hgViewId] = [1246253105e-1, 1246253105e-1, 249250.621]; - }); - }); - const tracks = trackInfos.map((d) => { - return { - id: d.track.id, - spec: d.track, - shape: d.track.layout === "linear" || IsDummyTrack(d.track) ? d.boundingBox : { - ...d.boundingBox, - cx: d.boundingBox.x + d.boundingBox.width / 2, - cy: d.boundingBox.y + d.boundingBox.height / 2, - innerRadius: d.track.innerRadius, - outerRadius: d.track.outerRadius, - startAngle: d.track.startAngle, - endAngle: d.track.endAngle - } - }; - }); - const views = getViewApiData(spec, tracks); - const tracksAndViews = [ - ...tracks.map((d) => ({ ...d, type: "track" })), - ...views.map((d) => ({ ...d, type: "view" })) - ]; - callback(hgModel.spec(), getBoundingBox(trackInfos), spec, tracksAndViews, idMapper.getTable()); -} -function manageResponsiveSpecs(spec, wFactor, hFactor, parentWidth, parentHeight) { - if (typeof spec._assignedWidth === "undefined" || typeof spec._assignedHeight === "undefined") { - console.warn("Responsive spec cannot be used when width and height of a view is not determined yet."); - return false; - } - let replaced = false; - const { responsiveSpec } = spec; - const width = spec._assignedWidth * wFactor; - const height = spec._assignedHeight * hFactor; - const dimensions = { width, height, aspectRatio: width / height }; - const parentDimensions = { width: parentWidth, height: parentHeight, aspectRatio: parentWidth / parentHeight }; - if (responsiveSpec) { - responsiveSpec.forEach((specAndCondition) => { - const { spec: alternativeSpec, selectivity } = specAndCondition; - if (isSelectResponsiveSpec(selectivity, dimensions, parentDimensions) && !replaced) { - Object.keys(alternativeSpec).forEach((k) => { - spec[k] = alternativeSpec[k]; - }); - delete spec.responsiveSpec; - replaced = true; - return; - } - }); - } - if ("views" in spec) { - spec.views.forEach((view) => { - replaced = manageResponsiveSpecs(view, wFactor, hFactor, parentWidth, parentHeight) || replaced; - }); - } - return replaced; -} -function isSelectResponsiveSpec(conditions, assignedDimensions, parentDimensions) { - if (conditions.length === 0) - return false; - let isSelect = true; - conditions.forEach((condition) => { - const { measure, operation, threshold, target } = condition; - isSelect = isSelect && logicalComparison( - (target === "container" ? parentDimensions : assignedDimensions)[measure], - operation, - threshold - ) === 1; - }); - return isSelect; -} -function compile(spec, callback, templates, theme, containerStatus, urlToFetchOptions) { - var _a, _b; - const specCopy = JSON.parse(JSON.stringify(spec)); - overrideDataTemplates(specCopy); - replaceTrackTemplates(specCopy, templates); - traverseToFixSpecDownstream(specCopy); - const trackInfosAndSize = getRelativeTrackInfo(specCopy, theme); - let { trackInfos } = trackInfosAndSize; - const { size } = trackInfosAndSize; - const isResponsiveWidth = typeof spec.responsiveSize === "object" && ((_a = spec.responsiveSize) == null ? void 0 : _a.width) || spec.responsiveSize; - const isResponsiveHeight = typeof spec.responsiveSize === "object" && ((_b = spec.responsiveSize) == null ? void 0 : _b.height) || spec.responsiveSize; - const wFactor = isResponsiveWidth && containerStatus.containerSize ? containerStatus.containerSize.width / size.width : 1; - const hFactor = isResponsiveHeight && containerStatus.containerSize ? containerStatus.containerSize.height / size.height : 1; - const pWidth = containerStatus.containerParentSize ? containerStatus.containerParentSize.width : Number.MAX_SAFE_INTEGER; - const pHeight = containerStatus.containerParentSize ? containerStatus.containerParentSize.height : Number.MAX_SAFE_INTEGER; - const replaced = manageResponsiveSpecs(specCopy, wFactor, hFactor, pWidth, pHeight); - if (replaced) { - traverseToFixSpecDownstream(specCopy); - trackInfos = getRelativeTrackInfo(specCopy, theme).trackInfos; - } - publish("specProcessed", { - id: specCopy.id, - spec: specCopy - }); - renderHiGlass(specCopy, trackInfos, callback, theme, urlToFetchOptions); -} -init(); -const HiGlassComponentWrapper = forwardRef( - (props, ref) => { - var _a; - const [wrapperDivId, setWrapperDivId] = useState((_a = props.id) != null ? _a : uuid()); - useEffect(() => { - var _a2; - setWrapperDivId((_a2 = props.id) != null ? _a2 : uuid()); - }, [props.id]); - const viewConfig = props.viewConfig || {}; - const pixelPreciseMarginPadding = false; - const higlassComponent = useMemo( - () => /* @__PURE__ */ React.createElement( - HiGlassComponent, - { - ref, - options: { - // This uses `rowHeight: 1` in react-grid-layout, allowing to set height precisely. - // Since using this disallows responsive resizing of track heights in HiGlass, - // we need to use this only when users do not want to use responsive height. - // (See https://github.com/higlass/higlass/blob/2a3786e13c2415a52abc1227f75512f128e784a0/app/scripts/HiGlassComponent.js#L2199) - pixelPreciseMarginPadding, - containerPaddingX: 0, - containerPaddingY: 0, - viewMarginTop: 0, - viewMarginBottom: 0, - viewMarginLeft: 0, - viewMarginRight: 0, - viewPaddingTop: 0, - viewPaddingBottom: 0, - viewPaddingLeft: 0, - viewPaddingRight: 0, - sizeMode: "bounded", - rangeSelectionOnAlt: true - // this allows switching between `selection` and `zoom&pan` mode - }, - viewConfig - } - ), - [viewConfig, pixelPreciseMarginPadding] - ); - const { - padding = 60, - margin = 0, - border = "none", - background, - alt = "Gosling visualization" - } = props.options || {}; - return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement( - "div", - { - id: wrapperDivId, - className: `gosling-component ${props.className || ""}`, - style: { - position: "relative", - padding, - margin, - border, - background, - width: props.options.responsiveWidth ? `calc(100% - ${padding * 2}px)` : props.size.width, - height: props.options.responsiveHeight ? `calc(100% - ${padding * 2}px)` : props.size.height, - textAlign: "left" - }, - "aria-label": alt, - role: "graphics-document", - "aria-roledescription": "visualization" - }, - /* @__PURE__ */ React.createElement( - "div", - { - key: JSON.stringify(viewConfig), - id: "higlass-wrapper", - className: "higlass-wrapper", - style: { - position: "relative", - display: "block", - background, - margin: 0, - padding: 0, - // non-zero padding acts unexpectedly w/ HiGlassComponent - width: props.options.responsiveWidth ? "100%" : props.size.width, - height: props.options.responsiveHeight ? "100%" : props.size.height - } - }, - higlassComponent - ) - )); - } -); -HiGlassComponentWrapper.displayName = "HiGlassComponentWrapper"; -function createApi(hg, hgSpec, tracksAndViews, theme, idTable) { - const idTableCopy = structuredClone(idTable); - const getHgViewId = (trackId) => { - const viewId = idTableCopy[trackId]; - if (!viewId) { - console.warn(`Unable to find the track ID, named ${trackId}.`); - } - return viewId != null ? viewId : trackId; - }; - const getTrackIds2 = () => { - return Object.keys(idTableCopy); - }; - const getTracksAndViews = () => { - return [...tracksAndViews]; - }; - const getTracks = () => { - return [...getTracksAndViews().filter((d) => d.type === "track")]; - }; - const getTrack = (trackId) => { - const trackInfoFound = getTracks().find((d) => d.id === trackId); - if (!trackInfoFound) { - console.warn(`[getTrack()] Unable to find a track using the ID (${trackId})`); - } - return trackInfoFound; - }; - const getViews = () => { - return [...getTracksAndViews().filter((d) => d.type === "view")]; - }; - const getView = (viewId) => { - const view = getViews().find((d) => d.id === viewId); - if (!view) { - console.warn(`Unable to find a view with the ID of ${viewId}`); - } - return view; - }; - const getCanvas = (options) => { - var _a, _b; - const resolution = (_a = options == null ? void 0 : options.resolution) != null ? _a : 4; - const transparentBackground = (_b = options == null ? void 0 : options.transparentBackground) != null ? _b : false; - const renderer = hg.pixiRenderer; - const renderTexture = PIXI.RenderTexture.create({ - width: renderer.width / 2, - height: renderer.height / 2, - resolution - }); - renderer.render(hg.pixiStage, renderTexture); - const canvas = renderer.plugins.extract.canvas(renderTexture); - const canvasWithBg = document.createElement("canvas"); - canvasWithBg.width = canvas.width; - canvasWithBg.height = canvas.height; - const ctx = canvasWithBg.getContext("2d"); - if (!transparentBackground) { - ctx.fillStyle = theme.root.background; - ctx.fillRect(0, 0, canvasWithBg.width, canvasWithBg.height); - } - ctx.drawImage(canvas, 0, 0); - return { - canvas: canvasWithBg, - resolution, - canvasWidth: canvas.width, - canvasHeight: canvas.height - }; - }; - return { - subscribe, - unsubscribe, - zoomTo: (trackId, position, padding = 0, duration = 1e3) => { - var _a; - const assembly = (_a = getTrack(trackId)) == null ? void 0 : _a.spec.assembly; - const manager = GenomicPositionHelper.fromString(position); - const absCoordinates = manager.toAbsoluteCoordinates(assembly, padding); - const hgViewId = getHgViewId(trackId); - hg.api.zoomTo(hgViewId, ...absCoordinates, ...absCoordinates, duration); - }, - zoomToExtent: (trackId, duration = 1e3) => { - var _a; - const assembly = (_a = getTrack(trackId)) == null ? void 0 : _a.spec.assembly; - const [start, end] = [0, computeChromSizes(assembly).total]; - const hgViewId = getHgViewId(trackId); - hg.api.zoomTo(hgViewId, start, end, start, end, duration); - }, - zoomToGene: (trackId, gene, padding = 0, duration = 1e3) => { - const hgViewId = getHgViewId(trackId); - hg.api.zoomToGene(hgViewId, gene, padding, duration); - }, - suggestGene: (trackId, keyword, callback) => { - const hgViewId = getHgViewId(trackId); - hg.api.suggestGene(hgViewId, keyword, callback); - }, - getTrackIds: getTrackIds2, - getTracksAndViews, - getTracks, - getTrack, - getView, - getViews, - getCanvas, - exportPng: (transparentBackground) => { - const { canvas } = getCanvas({ resolution: 4, transparentBackground }); - canvas.toBlob((blob2) => { - const a = document.createElement("a"); - document.body.append(a); - a.download = "gosling-visualization"; - a.href = URL.createObjectURL(blob2); - a.click(); - a.remove(); - }, "image/png"); - }, - exportPdf: async (transparentBackground) => { - const { jsPDF } = await import("jspdf"); - const { canvas } = getCanvas({ resolution: 4, transparentBackground }); - const imgData = canvas.toDataURL("image/jpeg", 1); - const pdf = new jsPDF({ - orientation: canvas.width < canvas.height ? "p" : "l", - unit: "pt", - format: [canvas.width, canvas.height] - }); - pdf.addImage(imgData, "JPEG", 0, 0, canvas.width, canvas.height); - pdf.save("gosling-visualization.pdf"); - } - }; -} -function omitDeep(spec, omitKeys) { - return cloneDeepWith(spec, (value) => { - if (isObject(value)) { - omitKeys.forEach((key) => { - delete value[key]; - }); - } - }); -} -const preverseZoomStatus = (newSpec, prevSpec) => { - newSpec.views.forEach((view) => { - var _a, _b, _c; - const viewUid = view.uid; - const isNewView = !prevSpec.views.find((v) => v.uid === viewUid); - if (isNewView) { - const { locksByViewUid } = newSpec.zoomLocks; - const lockUid = locksByViewUid[viewUid]; - const linkedViewUid = (_a = Object.entries(locksByViewUid).find(([_, uid]) => _ && uid === lockUid)) == null ? void 0 : _a[0]; - const linkedViewExistedPrev = !!prevSpec.views.find((v) => v.uid === linkedViewUid); - if (linkedViewUid && linkedViewExistedPrev) { - view.initialXDomain = (_b = prevSpec.views.find((v) => v.uid === linkedViewUid)) == null ? void 0 : _b.initialXDomain; - view.initialYDomain = (_c = prevSpec.views.find((v) => v.uid === linkedViewUid)) == null ? void 0 : _c.initialYDomain; - } - } - }); -}; -const DELAY_FOR_CONTAINER_RESIZE_BEFORE_RERENDER = 300; -const GoslingComponent = forwardRef((props, ref) => { - var _a, _b, _c; - const [viewConfig, setViewConfig] = useState(); - const [size, setSize] = useState({ width: 200, height: 200 }); - const wrapperSize = useRef(); - const wrapperParentSize = useRef(); - const prevSpec = useRef(); - const tracksAndViews = useRef([]); - const idTable = useRef({}); - const hgRef = useRef(null); - const theme = getTheme(props.theme || "light"); - const wrapperDivId = (_a = props.id) != null ? _a : uuid(); - const publishOnNewView = (currentTracksAndViews) => { - const prevViews = tracksAndViews.current.filter((data) => data.type == "view"); - const currentViews = currentTracksAndViews.filter((data) => data.type == "view"); - const prevViewIds = new Set(prevViews.map((data) => data.id)); - const newViews = currentViews.filter((view) => !prevViewIds.has(view.id)); - newViews.forEach((view) => { - publish("onNewView", { id: view.id }); - }); - }; - useImperativeHandle( - ref, - () => { - const hgApi = refAsReadonlyProxy(hgRef); - const visUnits = refAsReadonlyProxy(tracksAndViews); - const api = createApi(hgApi, viewConfig, visUnits, theme, idTable.current); - return { api, hgApi }; - }, - [viewConfig, theme] - ); - const compile$1 = useCallback(() => { - if (props.spec) { - const valid = validateGoslingSpec(props.spec); - if (valid.state === "error") { - console.warn("Gosling spec is not valid. Please refer to the console message."); - return; - } - compile( - props.spec, - (newHiGlassSpec, newSize, newGoslingSpec, newTracksAndViews, newIdTable) => { - var _a2, _b2; - if (prevSpec.current && isEqual(omitDeep(prevSpec.current, ["linkingId"]), omitDeep(newGoslingSpec, ["linkingId"]))) { - return; - } - (_a2 = props.compiled) == null ? void 0 : _a2.call(props, props.spec, newHiGlassSpec, { _processedSpec: newGoslingSpec }); - setSize(newSize); - const isMountedOnce = typeof viewConfig !== "undefined"; - if (((_b2 = props.experimental) == null ? void 0 : _b2.reactive) && isMountedOnce) { - setTimeout(() => { - var _a3, _b3; - preverseZoomStatus( - newHiGlassSpec, - (_a3 = hgRef.current) == null ? void 0 : _a3.api.getViewConfig() - ); - (_b3 = hgRef.current) == null ? void 0 : _b3.api.setViewConfig(newHiGlassSpec); - }, DELAY_FOR_CONTAINER_RESIZE_BEFORE_RERENDER); - } else { - setViewConfig(newHiGlassSpec); - } - publishOnNewView(newTracksAndViews); - prevSpec.current = newGoslingSpec; - tracksAndViews.current = newTracksAndViews; - idTable.current = newIdTable; - }, - [...GoslingTemplates], - // TODO: allow user definitions - theme, - { - containerSize: wrapperSize.current, - containerParentSize: wrapperParentSize.current - }, - props.urlToFetchOptions - ); - } - }, [props.spec, theme]); - useEffect(() => { - var _a2; - if (!((_a2 = props.spec) == null ? void 0 : _a2.responsiveSize)) - return; - const containerElement = document.getElementById(wrapperDivId); - if (!containerElement) - return; - const resizer = new ResizeSensor(containerElement, (newSize) => { - if (!wrapperSize.current || wrapperSize.current.height !== newSize.height || wrapperSize.current.width !== newSize.width) { - wrapperSize.current = newSize; - compile$1(); - } - }); - const parentElement = containerElement.parentElement; - if (!parentElement) - return; - const parentResizer = new ResizeSensor(parentElement, (newSize) => { - if (!wrapperParentSize.current || wrapperParentSize.current.height !== newSize.height || wrapperParentSize.current.width !== newSize.width) { - wrapperParentSize.current = newSize; - compile$1(); - } - }); - return () => { - resizer.detach(); - parentResizer.detach(); - }; - }); - useEffect(() => { - compile$1(); - }, [props.spec, theme]); - const responsiveHeight = typeof ((_b = props.spec) == null ? void 0 : _b.responsiveSize) !== "object" ? (_c = props.spec) == null ? void 0 : _c.responsiveSize : props.spec.responsiveSize.height; - const higlassComponent = useMemo( - () => { - var _a2, _b2, _c2; - return /* @__PURE__ */ React.createElement( - HiGlassComponentWrapper, - { - ref: hgRef, - viewConfig, - size, - id: wrapperDivId, - className: props.className, - options: { - padding: props.padding, - border: props.border, - margin: props.margin, - responsiveWidth: typeof ((_a2 = props.spec) == null ? void 0 : _a2.responsiveSize) !== "object" ? (_b2 = props.spec) == null ? void 0 : _b2.responsiveSize : props.spec.responsiveSize.width, - responsiveHeight, - background: theme.root.background, - alt: (_c2 = props.spec) == null ? void 0 : _c2.description - } - } - ); - }, - [viewConfig, size, theme, responsiveHeight] - ); - return higlassComponent; -}); -GoslingComponent.displayName = "GoslingComponent"; -function refAsReadonlyProxy(ref) { - return new Proxy({}, { - get(_target, prop, reciever) { - if (!ref.current) - throw Error("ref is not set!"); - return Reflect.get(ref.current, prop, reciever); - } - }); -} -var createRoot; -var m = require$$0; -if (process.env.NODE_ENV === "production") { - createRoot = m.createRoot; - m.hydrateRoot; -} else { - var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - createRoot = function(c, o) { - i.usingClientEntryPoint = true; - try { - return m.createRoot(c, o); - } finally { - i.usingClientEntryPoint = false; - } - }; -} -const MAX_TRIES = 20; -const INTERVAL = 200; -const launchHiglass = (element, viewConfig, size, opts) => { - const ref = React.createRef(); - const component = React.createElement(HiGlassComponentWrapper, { - ref, - viewConfig, - size, - id: opts.id, - className: opts.className, - options: opts - }); - createRoot(element).render(component); - return new Promise((resolve, reject) => { - let tries = 0; - const poll = setInterval(() => { - if (ref && ref.current) { - clearInterval(poll); - resolve(ref.current); - } - if (tries >= MAX_TRIES) { - reject(new Error("Failed to initialize HiGlassApi.")); - } - tries++; - }, INTERVAL); - }); -}; -function embed(element, spec, opts = {}) { - return new Promise((resolve, reject) => { - var _a, _b; - const valid = validateGoslingSpec(spec); - if (valid.state === "error") { - reject(new Error("Gosling spec is not valid. Please refer to the console message.")); - } - const theme = getTheme(opts.theme || "light"); - const options = { - ...opts, - background: theme.root.background, - alt: (_b = (_a = opts.alt) != null ? _a : spec.description) != null ? _b : "Gosling visualization" - }; - compile( - spec, - async (hsSpec, size, _, trackInfos, idTable) => { - const hg = await launchHiglass(element, hsSpec, size, options); - const api = createApi(hg, hsSpec, trackInfos, theme, idTable); - resolve(api); - }, - [...GoslingTemplates], - theme, - {}, - // TODO: properly specify this - opts.urlToFetchOptions - ); - }); -} -export { - GoslingComponent, - GoslingSchema, - GoslingTemplates, - theme_schema as ThemeSchema, - Themes, - compile, - embed, - getTheme$1 as getTheme, - init, - isThereTheme, - name, - validateGoslingSpec, - version -}; -//# sourceMappingURL=gosling.js.map diff --git a/dist/gosling.js.map b/dist/gosling.js.map deleted file mode 100644 index 8f24ec12..00000000 --- a/dist/gosling.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gosling.js","sources":["../src/gosling-schema/validate.ts","../src/core/utils/template.ts","../src/gosling-theme/light.ts","../src/gosling-theme/dark.ts","../src/gosling-theme/warm.ts","../src/gosling-theme/ggplot.ts","../src/gosling-theme/igv.ts","../src/gosling-theme/ensembl.ts","../src/gosling-theme/jbrowse.ts","../src/gosling-theme/ucsc.ts","../src/gosling-theme/washu.ts","../src/gosling-theme/excel.ts","../src/gosling-theme/google.ts","../src/gosling-theme/index.ts","../src/core/utils/define-plugin-track.ts","../src/tracks/gosling-genomic-axis/axis-track.ts","../src/tracks/gosling-brush/brush-track.ts","../src/tracks/gosling-brush/linear-brush-model.ts","../src/tracks/gosling-track/gosling-mouse-event/polygon.ts","../src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.ts","../src/data-fetchers/bam/bam-data-fetcher.ts","../src/data-fetchers/vcf/vcf-data-fetcher.ts","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/bigint-polyfill/pure.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/bigint-polyfill/polyfill.js","../node_modules/.pnpm/binary-parser@2.2.1/node_modules/binary-parser/dist/esm/binary_parser.mjs","../node_modules/.pnpm/abortcontroller-polyfill@1.7.5/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/abortcontroller-ponyfill.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateAbortController.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AggregateStatusReporter.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/AbortablePromiseCache.js","../node_modules/.pnpm/abortable-promise-cache@1.5.0/node_modules/abortable-promise-cache/esm/index.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/range.js","../node_modules/.pnpm/pako@2.1.0/node_modules/pako/dist/pako.esm.mjs","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/unzip-pako.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/util.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/blockView.js","../node_modules/.pnpm/tslib@2.6.2/node_modules/tslib/tslib.es6.mjs","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isFunction.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Subscription.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/config.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/noop.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/errorContext.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Subscriber.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/symbol/observable.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/identity.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/pipe.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Observable.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/lift.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/EmptyError.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/firstValueFrom.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/scanInternals.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/reduce.js","../node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/toArray.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/bbi.js","../node_modules/.pnpm/@gmod+bbi@3.0.1/node_modules/@gmod/bbi/esm/bigwig.js","../src/data-fetchers/bigwig/bigwig-data-fetcher.ts","../src/core/utils/data-transform.ts","../src/data-fetchers/csv/csv-data-fetcher.ts","../src/data-fetchers/json/json-data-fetcher.ts","../src/data-fetchers/gff/gff-data-fetcher.ts","../src/data-fetchers/bed/bed-data-fetcher.ts","../src/tracks/gosling-track/data-abstraction.ts","../src/core/utils/scales.ts","../src/core/example/hg-view-config-1.ts","../src/compiler/higlass-model.ts","../src/core/utils/semantic-zoom.ts","../src/core/channel/index.ts","../src/core/utils/theme.ts","../src/tracks/gosling-track/gosling-track-model.ts","../src/api/pubsub.ts","../src/tracks/gosling-track/gosling-track.ts","../src/tracks/dummy-track/dummy-track.ts","../src/core/init.ts","../src/compiler/bounding-box.ts","../src/core/utils/index.ts","../src/compiler/gosling-to-higlass.ts","../src/core/utils/linking.ts","../src/api/track-and-view-ids.ts","../src/api/api-data.ts","../src/compiler/create-higlass-models.ts","../src/compiler/responsive.ts","../src/compiler/compile.ts","../src/core/higlass-component-wrapper.tsx","../src/api/api.ts","../src/core/utils/omit-deep.ts","../src/core/utils/higlass-zoom-config.ts","../src/core/gosling-component.tsx","../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/client.js","../src/core/gosling-embed.ts"],"sourcesContent":["import Ajv from 'ajv';\nimport type { SingleTrack, ChannelDeep, ChannelTypes, OverlaidTrack, Track } from './gosling.schema';\nimport { IsChannelDeep } from './gosling.schema.guards';\nimport { resolveSuperposedTracks } from '../core/utils/overlay';\nimport GoslingSchema from './gosling.schema.json';\n\nexport interface Validity {\n message: string;\n state: 'success' | 'warn' | 'error';\n details?: string;\n}\n\nexport function validateGoslingSpec(spec: any): Validity {\n return validateSpec(GoslingSchema, spec);\n}\n\n/**\n *\n */\nexport function validateSpec(schema: any, spec: any, silence = false): Validity {\n const validate = new Ajv({ extendRefs: true }).compile(schema);\n const valid = validate(spec);\n\n let message = '';\n let details = '';\n\n if (validate.errors) {\n details = JSON.stringify(validate.errors, null, 2);\n\n if (!silence) {\n console.warn(details);\n }\n\n message = '⚠️ Some properties are incorrectly used.';\n }\n\n return { state: valid ? 'success' : 'warn', message, details };\n}\n\nexport function validateTrack(track: Track) {\n let valid = true;\n const errorMessages: string[] = [];\n\n const resolvedTrack = resolveSuperposedTracks(track);\n\n resolvedTrack.forEach(spec => {\n // Validate with json schema\n // ...\n\n // Additionally, validate the schema with the aspects that cannot be validated by the json schema\n if (!getGenomicChannelFromTrack(spec) && spec.mark !== 'brush' && spec.mark !== 'rule') {\n // as an exception, brush and rule can encode no genomic data\n errorMessages.push('genomic type is not encoded to either a x- or y- axis');\n // EXPERIMENTAL: we are removing this rule in our spec.\n valid = false;\n }\n\n // combination of visual mark and channel\n const color = spec.color;\n if (spec.mark === 'line' && IsChannelDeep(color) && color.type === 'quantitative') {\n errorMessages.push('`line` mark cannot be used with `quantitative` value');\n valid = false;\n }\n\n /**\n * Linking\n */\n // are the linking used for same visual channels (do not work betwee `x` and `size`)\n });\n\n return { valid, errorMessages };\n}\n\n/**\n * Find an axis channel that is encoded with genomic coordinate.\n * `undefined` if not found.\n */\nexport function getGenomicChannelFromTrack(track: SingleTrack | OverlaidTrack): ChannelDeep | undefined {\n // we do not support using two genomic coordinates yet\n let genomicChannel: ChannelDeep | undefined = undefined;\n ['x', 'y', 'xe', 'ye', 'x1', 'y1', 'x1e', 'y1e'].reverse().forEach(channelType => {\n const channel = track[channelType as keyof typeof ChannelTypes];\n if (IsChannelDeep(channel) && channel.type === 'genomic') {\n genomicChannel = channel;\n }\n });\n return genomicChannel;\n}\n\n/**\n * Find an axis channel that is encoded with genomic coordinate and return 'x' or 'y'.\n * `undefined` if not found.\n */\nexport function getGenomicChannelKeyFromTrack(\n track: SingleTrack | OverlaidTrack\n): 'x' | 'xe' | 'y' | 'ye' | 'x1' | 'y1' | 'x1e' | 'y1e' | undefined {\n // we do not support using two genomic coordinates yet\n let genomicChannelKey: string | undefined = undefined;\n ['x', 'xe', 'y', 'ye', 'x1', 'y1', 'x1e', 'y1e'].reverse().forEach(channelKey => {\n const channel = track[channelKey as keyof typeof ChannelTypes];\n if (IsChannelDeep(channel) && channel.type === 'genomic') {\n genomicChannelKey = channelKey;\n }\n });\n return genomicChannelKey;\n}\n","import type {\n CustomChannelDef,\n DataTransform,\n DataTransformWithBase,\n GoslingSpec,\n OverlaidTracks,\n TemplateTrackDef,\n TemplateTrackMappingDef,\n Track\n} from '@gosling-lang/gosling-schema';\nimport { IsTemplateTrack } from '@gosling-lang/gosling-schema';\nimport { traverseTracks } from '../../compiler/spec-preprocess';\n\n/**\n * Track templates officially supported by Gosling.js.\n */\nexport const GoslingTemplates: TemplateTrackDef[] = [\n {\n name: 'gene',\n channels: [\n { name: 'startPosition', type: 'genomic', required: true },\n { name: 'endPosition', type: 'genomic', required: true },\n { name: 'strandColor', type: 'nominal', required: true },\n { name: 'strandRow', type: 'nominal', required: true },\n { name: 'opacity', type: 'value', required: false },\n { name: 'geneHeight', type: 'value', required: false },\n { name: 'geneLabel', type: 'nominal', required: true },\n { name: 'geneLabelColor', type: 'nominal', required: true },\n { name: 'geneLabelFontSize', type: 'value', required: false },\n { name: 'geneLabelStroke', type: 'value', required: false },\n { name: 'geneLabelStrokeThickness', type: 'value', required: false },\n { name: 'geneLabelOpacity', type: 'value', required: false },\n { name: 'type', type: 'nominal', required: true } // either 'gene' or 'exon'\n ],\n mapping: [\n {\n dataTransform: [\n { type: 'filter', base: 'type', oneOf: ['gene'] },\n { type: 'filter', base: 'strandColor', oneOf: ['-'] }\n ],\n mark: 'triangleLeft',\n x: { base: 'startPosition', type: 'genomic' },\n size: { base: 'geneHeight', value: 12 },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'strandColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 0.4 },\n style: { align: 'right' }\n },\n {\n dataTransform: [\n { type: 'filter', base: 'type', oneOf: ['gene'] },\n { type: 'filter', base: 'strandColor', oneOf: ['+'] }\n ],\n mark: 'triangleRight',\n x: { base: 'endPosition', type: 'genomic' },\n size: { base: 'geneHeight', value: 12 },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'strandColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 0.4 },\n style: { align: 'left' }\n },\n {\n dataTransform: [{ type: 'filter', base: 'type', oneOf: ['exon'] }],\n mark: 'rect',\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n size: { base: 'geneHeight', value: 12 },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'strandColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 0.4 }\n },\n {\n dataTransform: [\n { type: 'filter', base: 'type', oneOf: ['gene'] },\n { type: 'filter', base: 'strandColor', oneOf: ['+'] }\n ],\n mark: 'rect',\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'strandColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 0.4 },\n size: { value: 3 }\n // style: {\n // linePattern: { type: 'triangleRight', size: 5 }\n // }\n },\n {\n dataTransform: [\n { type: 'filter', base: 'type', oneOf: ['gene'] },\n { type: 'filter', base: 'strandColor', oneOf: ['-'] }\n ],\n mark: 'rect',\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'strandColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 0.4 },\n size: { value: 3 }\n // style: {\n // linePattern: { type: 'triangleLeft', size: 5 }\n // }\n },\n {\n dataTransform: [{ type: 'filter', base: 'type', oneOf: ['gene'] }],\n mark: 'text',\n text: { base: 'geneLabel', type: 'nominal' }, // TODO: add dy here\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n row: { base: 'strandRow', type: 'nominal', domain: ['+', '-'] },\n color: { base: 'geneLabelColor', type: 'nominal', domain: ['+', '-'], range: ['blue', 'red'] },\n opacity: { base: 'opacity', value: 1 },\n size: { base: 'geneLabelFontSize', value: 18 },\n stroke: { base: 'geneLabelStroke', value: 'white' },\n strokeWidth: { base: 'geneLabelStrokeThickness', value: 2 },\n // TODO: how to redefine style from the users' side? (e.g., dy: -30)\n visibility: [\n {\n operation: 'less-than',\n measure: 'width',\n threshold: '|xe-x|',\n transitionPadding: 10,\n target: 'mark'\n }\n ]\n }\n ]\n },\n {\n name: 'ideogram',\n channels: [\n { name: 'startPosition', type: 'genomic', required: true },\n { name: 'endPosition', type: 'genomic', required: true },\n { name: 'chrHeight', type: 'value', required: false }, // https://eweitz.github.io/ideogram/\n { name: 'name', type: 'nominal', required: true },\n { name: 'stainBackgroundColor', type: 'nominal', required: true },\n { name: 'stainLabelColor', type: 'nominal', required: true },\n { name: 'stainStroke', type: 'value', required: false },\n { name: 'stainStrokeWidth', type: 'value', required: false }\n ],\n mapping: [\n {\n mark: 'rect',\n dataTransform: [{ type: 'filter', base: 'stainBackgroundColor', oneOf: ['acen'], not: true }],\n color: {\n base: 'stainBackgroundColor',\n type: 'nominal',\n domain: ['gneg', 'gpos25', 'gpos50', 'gpos75', 'gpos100', 'gvar', 'acen'],\n range: ['white', 'lightgray', 'gray', 'gray', 'black', '#7B9CC8', '#DC4542']\n },\n size: { base: 'chrHeight', value: 18 },\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n stroke: { base: 'stainStroke', value: 'gray' },\n strokeWidth: { base: 'stainStrokeWidth', value: 0.3 }\n },\n {\n mark: 'triangleRight',\n dataTransform: [\n { type: 'filter', base: 'stainBackgroundColor', oneOf: ['acen'] },\n { type: 'filter', base: 'name', include: 'q' }\n ],\n color: {\n base: 'stainBackgroundColor',\n type: 'nominal',\n domain: ['gneg', 'gpos25', 'gpos50', 'gpos75', 'gpos100', 'gvar', 'acen'],\n range: ['white', 'lightgray', 'gray', 'gray', 'black', '#7B9CC8', '#DC4542']\n },\n size: { base: 'chrHeight', value: 18 },\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n stroke: { base: 'stainStroke', value: 'gray' },\n strokeWidth: { base: 'stainStrokeWidth', value: 0.3 }\n },\n {\n mark: 'triangleLeft',\n dataTransform: [\n { type: 'filter', base: 'stainBackgroundColor', oneOf: ['acen'] },\n { type: 'filter', base: 'name', include: 'p' }\n ],\n color: {\n base: 'stainBackgroundColor',\n type: 'nominal',\n domain: ['gneg', 'gpos25', 'gpos50', 'gpos75', 'gpos100', 'gvar', 'acen'],\n range: ['white', 'lightgray', 'gray', 'gray', 'black', '#7B9CC8', '#DC4542']\n },\n size: { base: 'chrHeight', value: 18 },\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n stroke: { base: 'stainStroke', value: 'gray' },\n strokeWidth: { base: 'stainStrokeWidth', value: 0.3 }\n },\n {\n mark: 'text',\n dataTransform: [{ type: 'filter', base: 'stainLabelColor', oneOf: ['acen'], not: true }],\n color: {\n base: 'stainLabelColor',\n type: 'nominal',\n domain: ['gneg', 'gpos25', 'gpos50', 'gpos75', 'gpos100', 'gvar'],\n range: ['black', 'black', 'black', 'black', 'white', 'black']\n },\n text: { base: 'name', type: 'nominal' },\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n visibility: [\n {\n operation: 'less-than',\n measure: 'width',\n threshold: '|xe-x|',\n transitionPadding: 10,\n target: 'mark'\n }\n ]\n }\n ]\n },\n {\n name: 'sequence',\n channels: [\n { name: 'startPosition', type: 'genomic', required: true },\n { name: 'endPosition', type: 'genomic', required: true },\n { name: 'barLength', type: 'quantitative', required: true },\n { name: 'baseBackground', type: 'nominal', required: true },\n { name: 'baseLabelColor', type: 'nominal', required: true },\n { name: 'baseLabelFontSize', type: 'value', required: false }\n ],\n mapping: [\n {\n mark: 'bar',\n // x: { base: 'position', type: 'genomic' },\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n y: { base: 'barLength', type: 'quantitative', axis: 'none' },\n color: { base: 'baseBackground', type: 'nominal', domain: ['A', 'T', 'G', 'C'] }\n },\n {\n dataTransform: [{ type: 'filter', base: 'barLength', oneOf: [0], not: true }],\n mark: 'text',\n x: { base: 'startPosition', type: 'genomic' },\n xe: { base: 'endPosition', type: 'genomic' },\n color: { base: 'baseLabelColor', type: 'nominal', domain: ['A', 'T', 'G', 'C'], range: ['white'] },\n text: { base: 'baseBackground', type: 'nominal' },\n size: { base: 'baseLabelFontSize', value: 18 },\n visibility: [\n {\n operation: 'less-than',\n measure: 'width',\n threshold: '|xe-x|',\n transitionPadding: 30,\n target: 'mark'\n },\n {\n operation: 'LT',\n measure: 'zoomLevel',\n threshold: 10,\n target: 'track'\n }\n ]\n }\n ]\n }\n];\n\n/**\n * Replace track templetes to low-level gosling specs.\n * @param spec\n */\nexport function replaceTrackTemplates(spec: GoslingSpec, templates: TemplateTrackDef[]) {\n traverseTracks(spec, (t, i, ts) => {\n if (!IsTemplateTrack(t)) {\n // If this is not a template track, no point to replace templates.\n return;\n }\n\n const { template: name } = t;\n const templateDef = templates.find(d => d.name === name);\n\n /* Validation */\n if (!templateDef) {\n // No idea what this template is, so set a flag and remove it from the spec when compiling.\n t._invalidTrack = true;\n console.warn(`There is no track template named '${name}'`);\n return;\n }\n\n let isValid = true;\n templateDef.channels.forEach((d: CustomChannelDef) => {\n if (d.required && (!t.encoding || !(d.name in t.encoding))) {\n // Required channels are not defined\n isValid = false;\n console.warn(`A template spec ('${name}') does not contain a required channel, ${d.name}`);\n }\n });\n\n if (!isValid) {\n // The template spec is not valid for given template definition\n t._invalidTrack = true;\n return;\n }\n\n /* conversion */\n const viewBase = JSON.parse(JSON.stringify(t));\n if ('encoding' in viewBase) {\n delete viewBase.encoding;\n }\n const convertedView: OverlaidTracks = {\n ...viewBase,\n alignment: 'overlay',\n tracks: [],\n width: t.width ?? 100,\n height: t.height ?? 100\n };\n templateDef.mapping.forEach((singleTrackMappingDef: TemplateTrackMappingDef) => {\n // Set required properties\n const convertedTrack: Partial = {\n data: t.data,\n mark: singleTrackMappingDef.mark\n };\n\n // Handle data transform\n const { dataTransform } = singleTrackMappingDef;\n if (dataTransform) {\n const newDataTransform: DataTransform[] = [];\n dataTransform.map((dataTramsformMap: DataTransformWithBase) => {\n const baseChannelName = dataTramsformMap.base;\n if (\n baseChannelName &&\n t.encoding &&\n baseChannelName in t.encoding &&\n 'field' in t.encoding[baseChannelName]\n ) {\n delete dataTramsformMap.base;\n (dataTramsformMap as any).field = (t.encoding[baseChannelName] as any).field;\n newDataTransform.push(dataTramsformMap as DataTransform);\n } else {\n // TODO: JUST ADD?\n }\n });\n }\n\n // Handle encoding\n const encodingSpec = t.encoding;\n if (!encodingSpec) {\n // This means we do not need to override anything, so use default encodings\n Object.keys(singleTrackMappingDef)\n .filter(k => k !== 'mark')\n .forEach(channelKey => {\n // Iterate all channels\n const channelMap = JSON.parse(JSON.stringify((singleTrackMappingDef as any)[channelKey]));\n if ('base' in channelMap) {\n delete channelMap.base;\n }\n // @ts-ignore\n convertedTrack[channelKey as keyof TemplateTrackMappingDef] = channelMap;\n });\n } else {\n Object.keys(singleTrackMappingDef)\n .filter(k => k !== 'mark')\n .forEach(channelKey => {\n // Iterate all channels\n const channelMap = JSON.parse(JSON.stringify((singleTrackMappingDef as any)[channelKey]));\n if ('base' in channelMap) {\n const baseChannelName = channelMap.base;\n if (baseChannelName in encodingSpec) {\n // This means we need to override a user's spec for this channel\n const base = JSON.parse(JSON.stringify(encodingSpec[baseChannelName]));\n delete channelMap.base;\n const newChannelSpec = Object.assign(channelMap, JSON.parse(JSON.stringify(base)));\n convertedTrack[channelKey as keyof TemplateTrackMappingDef] = newChannelSpec;\n } else {\n // This means a user did not specify a optional custom channel, so just remove a `base` property.\n delete channelMap.base;\n convertedTrack[channelKey as keyof TemplateTrackMappingDef] = channelMap;\n }\n } else {\n // This means we use encoding that is constant.\n convertedTrack[channelKey as keyof TemplateTrackMappingDef] = channelMap;\n }\n });\n }\n\n convertedView.tracks.push(convertedTrack);\n });\n\n ts[i] = convertedView;\n });\n\n // DEBUG\n // console.log('After replaceTrackTemplates()', JSON.parse(JSON.stringify(spec)));\n}\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#E79F00', '#029F73', '#0072B2', '#CB7AA7', '#D45E00', '#57B4E9', '#EFE441' /*'#000000'*/];\n\nconst LightThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const light: ThemeDeep = {\n base: 'light',\n\n root: {\n background: 'white',\n titleColor: 'black',\n titleBackgroundColor: 'transparent',\n titleFontSize: 18,\n titleFontFamily: 'Arial',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n subtitleColor: 'gray',\n subtitleBackgroundColor: 'transparent',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleFontWeight: 'normal',\n subtitleAlign: 'left',\n showMousePosition: true,\n mousePositionColor: '#000000'\n },\n\n track: {\n background: 'transparent',\n alternatingBackground: 'transparent',\n titleColor: 'black',\n titleBackground: 'white',\n titleFontSize: 24,\n titleAlign: 'left',\n outline: 'black',\n outlineWidth: 1\n },\n\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: '#DBDBDB',\n tickColor: 'black'\n },\n\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n labelMargin: 5,\n labelExcludeChrPrefix: false,\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n baselineColor: 'black',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1,\n gridStrokeType: 'solid',\n gridStrokeDash: [4, 4]\n },\n\n markCommon: {\n ...LightThemeMarkCommonStyle\n },\n point: {\n ...LightThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...LightThemeMarkCommonStyle\n },\n triangle: {\n ...LightThemeMarkCommonStyle\n },\n area: {\n ...LightThemeMarkCommonStyle\n },\n line: {\n ...LightThemeMarkCommonStyle\n },\n bar: {\n ...LightThemeMarkCommonStyle\n },\n rule: {\n ...LightThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...LightThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...LightThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...LightThemeMarkCommonStyle,\n color: 'gray',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#E79F00', '#029F73', '#0072B2', '#CB7AA7', '#D45E00', '#57B4E9', '#EFE441' /*'#000000'*/];\n\nconst LightThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nconst DarkThemeMarkCommonStyle = { ...LightThemeMarkCommonStyle, stroke: 'white' };\n\nexport const dark: ThemeDeep = {\n base: 'dark',\n\n root: {\n background: 'black',\n titleColor: 'white',\n titleBackgroundColor: 'transparent',\n titleFontSize: 18,\n titleFontFamily: 'Arial',\n titleAlign: 'middle',\n titleFontWeight: 'bold',\n subtitleColor: 'lightgray',\n subtitleBackgroundColor: 'transparent',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleAlign: 'middle',\n subtitleFontWeight: 'normal',\n showMousePosition: true,\n mousePositionColor: '#FFFFFF'\n },\n\n track: {\n background: 'transparent',\n alternatingBackground: 'transparent',\n titleColor: 'white',\n titleBackground: 'black',\n titleFontSize: 18,\n titleAlign: 'left',\n outline: 'white',\n outlineWidth: 1\n },\n legend: {\n position: 'right',\n background: 'black',\n backgroundOpacity: 0.7,\n labelColor: 'white',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: '#DBDBDB',\n tickColor: 'white'\n },\n axis: {\n tickColor: 'white',\n labelMargin: 5,\n labelExcludeChrPrefix: false,\n labelColor: 'white',\n labelFontSize: 10,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n baselineColor: 'white',\n gridColor: 'gray',\n gridStrokeWidth: 1,\n gridStrokeType: 'solid',\n gridStrokeDash: [4, 4]\n },\n\n markCommon: {\n ...DarkThemeMarkCommonStyle\n },\n point: {\n ...DarkThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...DarkThemeMarkCommonStyle\n },\n triangle: {\n ...DarkThemeMarkCommonStyle\n },\n area: {\n ...DarkThemeMarkCommonStyle\n },\n line: {\n ...DarkThemeMarkCommonStyle\n },\n bar: {\n ...DarkThemeMarkCommonStyle\n },\n rule: {\n ...DarkThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...DarkThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...DarkThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...DarkThemeMarkCommonStyle,\n color: 'lightgray',\n opacity: 0.3,\n stroke: 'white',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#D19000', '#008F67', '#005F96', '#B86E97', '#B55100', '#4793BF', '#C9C03'];\n\nconst WarmThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: '#3C3C3C',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const warm: ThemeDeep = {\n base: 'warm',\n\n root: {\n background: '#FFF8E8',\n titleColor: '#3C3C3C',\n subtitleColor: 'gray',\n showMousePosition: true,\n mousePositionColor: '#3C3C3C'\n },\n\n track: {\n titleColor: '#3C3C3C',\n titleBackground: '#FFF8E8',\n outline: '#3C3C3C',\n outlineWidth: 1\n },\n\n legend: {\n background: '#FFF8E8',\n backgroundOpacity: 0.7,\n labelColor: '#3C3C3C',\n backgroundStroke: '#3C3C3C',\n tickColor: '3C3C3C'\n },\n\n axis: {\n tickColor: '#3C3C3C',\n labelColor: '#3C3C3C',\n baselineColor: '#3C3C3C',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1\n },\n\n markCommon: {\n ...WarmThemeMarkCommonStyle\n },\n point: {\n ...WarmThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...WarmThemeMarkCommonStyle\n },\n triangle: {\n ...WarmThemeMarkCommonStyle\n },\n area: {\n ...WarmThemeMarkCommonStyle\n },\n line: {\n ...WarmThemeMarkCommonStyle\n },\n bar: {\n ...WarmThemeMarkCommonStyle\n },\n rule: {\n ...WarmThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...WarmThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...WarmThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...WarmThemeMarkCommonStyle,\n color: 'lightgray',\n opacity: 0.3,\n stroke: '#3C3C3C',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#F66A62', '#05B230', '#5692FF', '#D764D6', '#86E9D4', '#6E6AD7', '#FFFB00'];\n\nconst GgplotThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const ggplot: ThemeDeep = {\n base: 'ggplot',\n\n root: {\n background: 'white',\n titleColor: 'black',\n titleFontSize: 18,\n titleFontFamily: 'Helvetica',\n titleAlign: 'middle',\n titleFontWeight: 'bold',\n titleBackgroundColor: 'white',\n subtitleColor: 'gray',\n subtitleFontSize: 14,\n subtitleFontFamily: 'Helvetica',\n subtitleAlign: 'middle',\n subtitleFontWeight: 'light',\n subtitleBackgroundColor: 'white',\n showMousePosition: true,\n mousePositionColor: 'black'\n },\n\n track: {\n background: '#e8e8e8',\n alternatingBackground: '#d1d1d1',\n titleColor: 'black',\n titleBackground: 'white',\n //titleFontSize:'',\n //titleAlign:'',\n outline: 'black',\n outlineWidth: 2\n },\n\n legend: {\n position: 'right',\n background: '#e8e8e8',\n backgroundOpacity: 1,\n labelColor: 'black',\n backgroundStroke: '#e8e8e8',\n tickColor: 'white'\n //,labelFontSize: '',\n //labelFontWeight: '',\n //labelFontFamily: ''\n },\n\n axis: {\n tickColor: 'white',\n labelColor: 'black',\n //labelFontSize: '',\n //labelFontWeight: '',\n //labelFontFamily: '',\n baselineColor: '#e8e8e8',\n gridColor: 'white',\n gridStrokeWidth: 2\n //,gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...GgplotThemeMarkCommonStyle\n },\n point: {\n ...GgplotThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...GgplotThemeMarkCommonStyle\n },\n triangle: {\n ...GgplotThemeMarkCommonStyle\n },\n area: {\n ...GgplotThemeMarkCommonStyle\n },\n line: {\n ...GgplotThemeMarkCommonStyle\n },\n bar: {\n ...GgplotThemeMarkCommonStyle\n },\n rule: {\n ...GgplotThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...GgplotThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...GgplotThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'bold'\n },\n brush: {\n ...GgplotThemeMarkCommonStyle,\n color: 'black',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#37E649', '#ED2D44', '#AEAFEA', '#EBAEAE', '#CE7B3D', '#8743E0', '#5233F0'];\n\nconst IGVThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const igv: ThemeDeep = {\n base: 'igv',\n\n root: {\n background: 'white',\n titleColor: 'white',\n //titleFontSize:'',\n //titleFontFamily:'',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n titleBackgroundColor: '#5f5f5f',\n subtitleColor: '#3b3b3b',\n //subtitleFontSize:'',\n //subtitleFontFamily:'',\n subtitleAlign: 'left',\n subtitleFontWeight: 'bold',\n subtitleBackgroundColor: '#c4c4c4',\n showMousePosition: true,\n mousePositionColor: 'black'\n },\n\n track: {\n background: 'white',\n alternatingBackground: '#e8e8e8',\n titleColor: 'white',\n titleBackground: '#5F5F5F',\n //titleFontSize:'',\n //titleAlign:'',\n outline: '#5F5F5F',\n outlineWidth: 1\n },\n\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 1,\n labelColor: 'black',\n //labelFontSize: '',\n //labelFontWeight: '',\n //labelFontFamily: '',\n backgroundStroke: 'black',\n tickColor: 'black'\n },\n\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n //labelFontSize: '',\n //labelFontWeight: '',\n //labelFontFamily: '',\n //baselineColor: '#E6E6E6',\n baselineColor: 'white',\n gridColor: 'transparent',\n gridStrokeWidth: 0\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...IGVThemeMarkCommonStyle\n },\n point: {\n ...IGVThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...IGVThemeMarkCommonStyle\n },\n triangle: {\n ...IGVThemeMarkCommonStyle\n },\n area: {\n ...IGVThemeMarkCommonStyle\n },\n line: {\n ...IGVThemeMarkCommonStyle\n },\n bar: {\n ...IGVThemeMarkCommonStyle\n },\n rule: {\n ...IGVThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...IGVThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...IGVThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'bold'\n },\n brush: {\n ...IGVThemeMarkCommonStyle,\n color: 'white',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = [\n '#CD9B1D',\n '#8A668B',\n '#40E0D0',\n '#FF6969',\n '#666666',\n '#FAC902',\n '#FE0000',\n '#CC96CD',\n '#D9D9D9' /*'#000000'*/\n];\n\nconst EnsemblThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const ensembl: ThemeDeep = {\n base: 'ensembl',\n\n root: {\n background: 'white',\n titleColor: '#494949',\n titleFontSize: 24,\n titleFontFamily: 'GGX88',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n titleBackgroundColor: 'white',\n subtitleColor: 'white',\n subtitleFontSize: 19,\n subtitleFontFamily: 'GGX88',\n subtitleAlign: 'left',\n subtitleFontWeight: 'normal',\n subtitleBackgroundColor: '#7B8BAF',\n mousePositionColor: '#FE0000',\n showMousePosition: true\n },\n\n track: {\n background: 'white',\n alternatingBackground: '#fffdf7',\n titleColor: 'black',\n titleBackground: 'white',\n titleAlign: 'left',\n outline: '#7B8BAF',\n outlineWidth: 2\n },\n\n legend: {\n tickColor: 'black',\n labelColor: 'black',\n //labelFontSize: ,\n labelFontWeight: 'normal',\n labelFontFamily: 'GGX88',\n background: 'white',\n backgroundOpacity: 2,\n backgroundStroke: 'lightgray'\n },\n\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n //labelFontSize: ,\n //labelFontWeight: '',\n labelFontFamily: 'GGX88',\n baselineColor: 'black',\n gridColor: '#7B8BAF',\n gridStrokeWidth: 2\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...EnsemblThemeMarkCommonStyle\n },\n point: {\n ...EnsemblThemeMarkCommonStyle,\n /*color: NOMINAL_COLOR[0],\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n size: 3\n },\n rect: {\n ...EnsemblThemeMarkCommonStyle\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n },\n triangle: {\n ...EnsemblThemeMarkCommonStyle\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n },\n area: {\n ...EnsemblThemeMarkCommonStyle\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n },\n line: {\n ...EnsemblThemeMarkCommonStyle\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n },\n bar: {\n ...EnsemblThemeMarkCommonStyle\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n },\n rule: {\n ...EnsemblThemeMarkCommonStyle,\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n strokeWidth: 1\n },\n link: {\n ...EnsemblThemeMarkCommonStyle,\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n strokeWidth: 1\n },\n text: {\n ...EnsemblThemeMarkCommonStyle,\n /*color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...EnsemblThemeMarkCommonStyle,\n /*size: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6]*/\n color: 'gray',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#3A62FE', '#F85353', '#3A62FE', '#F85353', '#DCA326', '#03BF06', '#BABABA' /*'#000000'*/];\n\nconst JBrowseThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const jbrowse: ThemeDeep = {\n base: 'jbrowse',\n\n root: {\n background: 'white',\n titleColor: 'white',\n titleFontSize: 20,\n titleFontFamily: 'Roboto',\n titleAlign: 'middle',\n titleFontWeight: 'normal',\n titleBackgroundColor: '#0b243f',\n subtitleColor: 'white',\n subtitleFontSize: 18,\n subtitleFontFamily: 'Roboto',\n subtitleAlign: 'middle',\n subtitleFontWeight: 'normal',\n subtitleBackgroundColor: '#732162',\n showMousePosition: true,\n mousePositionColor: '#000000'\n },\n\n track: {\n background: 'white',\n alternatingBackground: 'white',\n //titleFontSize:'',\n titleAlign: 'middle',\n titleColor: 'white',\n titleBackground: '#0B243F',\n outline: 'black',\n outlineWidth: 1\n },\n\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: '#DCA326',\n //labelFontSize: '',\n labelFontWeight: 'bold',\n labelFontFamily: 'Roboto',\n backgroundStroke: '#black',\n tickColor: 'black'\n },\n\n axis: {\n tickColor: 'black',\n labelColor: '#DCA326',\n //labelFontSize: '',\n labelFontWeight: 'bold',\n labelFontFamily: 'Roboto',\n baselineColor: 'black',\n gridColor: '#c5d5d9',\n gridStrokeWidth: 1 //,\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...JBrowseThemeMarkCommonStyle\n },\n point: {\n ...JBrowseThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...JBrowseThemeMarkCommonStyle\n },\n triangle: {\n ...JBrowseThemeMarkCommonStyle\n },\n area: {\n ...JBrowseThemeMarkCommonStyle\n },\n line: {\n ...JBrowseThemeMarkCommonStyle\n },\n bar: {\n ...JBrowseThemeMarkCommonStyle\n },\n rule: {\n ...JBrowseThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...JBrowseThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...JBrowseThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...JBrowseThemeMarkCommonStyle,\n color: '#c5d5d9',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = [\n '#3A5FCD',\n '#FFA54E',\n '#8FBC8F',\n '#B6709B',\n '#EE6A50',\n '#CCB79E',\n '#DADA8F',\n '#00CDCC',\n '#EED5D2',\n '#CD8EDD',\n '#9ACD31',\n '#D1BEA8',\n '#FFB6C0' /*'#000000'*/\n];\n\nconst UCSCThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const ucsc: ThemeDeep = {\n base: 'ucsc',\n\n root: {\n background: 'white',\n titleColor: 'white',\n titleFontSize: 22,\n //titleFontFamily:'',\n titleAlign: 'middle',\n titleFontWeight: 'bold',\n titleBackgroundColor: '#00457c',\n subtitleColor: 'black',\n //subtitleFontSize:'',\n //subtitleFontFamily:'',\n subtitleAlign: 'middle',\n subtitleFontWeight: 'bold',\n subtitleBackgroundColor: 'white',\n showMousePosition: true,\n mousePositionColor: '#FE0000'\n },\n\n track: {\n background: 'white',\n alternatingBackground: '#e3f7fc',\n titleColor: '#3A5FCD',\n titleBackground: 'white',\n //titleFontSize:'',\n //titleAlign:'',\n outline: 'black',\n outlineWidth: 1\n },\n\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: 'black',\n //labelFontSize: '',\n labelFontWeight: 'bold',\n //labelFontFamily: '',\n backgroundStroke: '#DBDBDB',\n tickColor: 'black'\n },\n\n axis: {\n tickColor: 'black',\n labelColor: '#3A5FCD',\n //labelFontSize: '',\n labelFontWeight: 'bold',\n //labelFontFamily: '',\n baselineColor: 'black',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1 //,\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...UCSCThemeMarkCommonStyle\n },\n point: {\n ...UCSCThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...UCSCThemeMarkCommonStyle\n },\n triangle: {\n ...UCSCThemeMarkCommonStyle\n },\n area: {\n ...UCSCThemeMarkCommonStyle\n },\n line: {\n ...UCSCThemeMarkCommonStyle\n },\n bar: {\n ...UCSCThemeMarkCommonStyle\n },\n rule: {\n ...UCSCThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...UCSCThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...UCSCThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...UCSCThemeMarkCommonStyle,\n color: 'gray',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = [\n '#6E12AC',\n '#15C250',\n '#E70FB1',\n '#FF8E55',\n '#A3B8F3',\n '#DE5E59',\n '#77AAAA',\n '#F5CCCA' /*'#000000'*/\n];\n\nconst WashUThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const washu: ThemeDeep = {\n base: 'washu',\n\n root: {\n background: 'white',\n titleColor: 'gray',\n //titleFontSize:16,\n //titleFontFamily:'',\n titleAlign: 'left',\n titleFontWeight: 'normal',\n titleBackgroundColor: 'white',\n subtitleColor: 'lightgray',\n //subtitleFontSize:12,\n //subtitleFontFamily:'',\n subtitleAlign: 'left',\n subtitleFontWeight: 'light',\n subtitleBackgroundColor: 'white',\n showMousePosition: true,\n mousePositionColor: '#000000'\n },\n\n track: {\n background: 'white',\n //alternatingBackground:'',\n titleColor: 'gray',\n titleBackground: 'white',\n //titleFontSize:'',\n titleAlign: 'left',\n outline: 'gray',\n outlineWidth: 1\n },\n\n legend: {\n background: 'white',\n backgroundOpacity: 0.5,\n labelColor: 'gray',\n //labelFontSize: '',\n labelFontWeight: 'light',\n //labelFontFamily: '',\n backgroundStroke: '#DBDBDB',\n tickColor: 'gray'\n },\n\n axis: {\n tickColor: 'lightgray',\n labelColor: 'gray',\n //labelFontSize: '',\n labelFontWeight: 'light',\n //labelFontFamily: '',\n baselineColor: 'gray',\n gridColor: 'transparent',\n gridStrokeWidth: 0 //,\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...WashUThemeMarkCommonStyle\n },\n point: {\n ...WashUThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...WashUThemeMarkCommonStyle\n },\n triangle: {\n ...WashUThemeMarkCommonStyle\n },\n area: {\n ...WashUThemeMarkCommonStyle\n },\n line: {\n ...WashUThemeMarkCommonStyle\n },\n bar: {\n ...WashUThemeMarkCommonStyle\n },\n rule: {\n ...WashUThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...WashUThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...WashUThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...WashUThemeMarkCommonStyle,\n color: 'gray',\n opacity: 0.3,\n stroke: 'gray',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = [\n '#ED7D31',\n '#4472C4',\n '#FFC207',\n '#76AE4F',\n '#9E480E',\n '#A5A5A5',\n '#4472C4',\n '#264378',\n '#76AE4F',\n '#5B9CD5' /*'#000000'*/\n];\n\nconst ExcelThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 1,\n stroke: '#5A5A5A',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const excel: ThemeDeep = {\n base: 'excel',\n\n root: {\n background: 'white',\n titleColor: '#5A5A5A',\n titleFontSize: 30,\n titleFontFamily: 'Calibri',\n titleAlign: 'middle',\n titleFontWeight: 'bold',\n titleBackgroundColor: 'white',\n subtitleColor: '#5A5A5A',\n subtitleFontSize: 22,\n subtitleFontFamily: 'Calibri',\n subtitleAlign: 'middle',\n subtitleFontWeight: 'bold',\n subtitleBackgroundColor: 'white',\n showMousePosition: true,\n mousePositionColor: '#000000'\n },\n\n track: {\n background: 'white',\n alternatingBackground: '#f5f5f5',\n titleColor: '#5A5A5A',\n titleBackground: 'white',\n //titleFontSize:'',\n //titleAlign:'',\n outline: '#5A5A5A',\n outlineWidth: 1\n },\n\n legend: {\n position: 'right',\n tickColor: '#5A5A5A',\n labelColor: '#5A5A5A',\n labelFontSize: 12,\n labelFontWeight: 'bold',\n labelFontFamily: 'Calibri',\n background: 'white',\n backgroundOpacity: 0.7,\n backgroundStroke: '#5A5A5A'\n },\n\n axis: {\n tickColor: '#5A5A5A',\n labelColor: '#5A5A5A',\n //labelFontSize: '',\n //labelFontWeight: '',\n labelFontFamily: 'Calibri',\n baselineColor: '#5A5A5A',\n gridColor: '#5A5A5A',\n gridStrokeWidth: 1\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...ExcelThemeMarkCommonStyle\n },\n point: {\n ...ExcelThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...ExcelThemeMarkCommonStyle\n },\n triangle: {\n ...ExcelThemeMarkCommonStyle\n },\n area: {\n ...ExcelThemeMarkCommonStyle\n },\n line: {\n ...ExcelThemeMarkCommonStyle\n },\n bar: {\n ...ExcelThemeMarkCommonStyle\n },\n rule: {\n ...ExcelThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...ExcelThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...ExcelThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...ExcelThemeMarkCommonStyle,\n color: '#5A5A5A',\n opacity: 0.3,\n stroke: '#5A5A5A',\n strokeWidth: 1\n }\n};\n","import type { ThemeDeep } from 'src/core/utils/theme';\n\nconst NOMINAL_COLOR = ['#4185f4', '#DB4437', '#F4B400', '#0D9D58', '#AA30C3', '#FF6E02', '#CBC74C' /*'#000000'*/];\n\nconst GoogleThemeMarkCommonStyle = {\n color: NOMINAL_COLOR[0],\n size: 2,\n stroke: 'black',\n strokeWidth: 0.3,\n opacity: 1,\n nominalColorRange: NOMINAL_COLOR,\n quantitativeSizeRange: [2, 6] as [number, number]\n};\n\nexport const google: ThemeDeep = {\n base: 'google',\n\n root: {\n background: 'white',\n titleColor: '#454545',\n titleFontSize: 20,\n titleFontFamily: 'Arial',\n titleAlign: 'left',\n titleFontWeight: 'normal',\n titleBackgroundColor: 'white',\n subtitleColor: '#7d7d7d',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleAlign: 'left',\n subtitleFontWeight: 'light',\n subtitleBackgroundColor: 'white',\n showMousePosition: true,\n mousePositionColor: '#000000'\n },\n\n track: {\n background: 'white',\n alternatingBackground: '#f5f5f5',\n titleColor: '#e8e8e8',\n titleBackground: 'white',\n titleFontSize: 12,\n titleAlign: 'left',\n outline: 'black',\n outlineWidth: 1\n },\n\n legend: {\n position: 'right',\n background: 'white',\n backgroundOpacity: 1,\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: 'black',\n tickColor: 'black'\n },\n\n axis: {\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n tickColor: 'black',\n labelColor: 'black',\n baselineColor: 'black',\n gridColor: 'black',\n gridStrokeWidth: 1 //,\n //gridStrokeType: '',\n //gridStrokeDash:\n },\n\n markCommon: {\n ...GoogleThemeMarkCommonStyle\n },\n point: {\n ...GoogleThemeMarkCommonStyle,\n size: 3\n },\n rect: {\n ...GoogleThemeMarkCommonStyle\n },\n triangle: {\n ...GoogleThemeMarkCommonStyle\n },\n area: {\n ...GoogleThemeMarkCommonStyle\n },\n line: {\n ...GoogleThemeMarkCommonStyle\n },\n bar: {\n ...GoogleThemeMarkCommonStyle\n },\n rule: {\n ...GoogleThemeMarkCommonStyle,\n strokeWidth: 1\n },\n link: {\n ...GoogleThemeMarkCommonStyle,\n strokeWidth: 1\n },\n text: {\n ...GoogleThemeMarkCommonStyle,\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n ...GoogleThemeMarkCommonStyle,\n color: '#999999',\n opacity: 0.3,\n stroke: 'black',\n strokeWidth: 0.7\n }\n};\n","// Individual Themes\n// Based on https://github.com/gosling-lang/gosling.js/blob/58121b0d536e34c02cea9b2c046cc9efa734fe94/src/core/utils/theme.ts#L5\nimport { light } from './light';\nimport { dark } from './dark';\nimport { warm } from './warm';\nimport { ggplot } from './ggplot';\nimport { igv } from './igv';\nimport { ensembl } from './ensembl';\nimport { jbrowse } from './jbrowse';\nimport { ucsc } from './ucsc';\nimport { washu } from './washu';\nimport { excel } from './excel';\nimport { google } from './google';\n\nexport const Themes = {\n light,\n dark,\n warm,\n ggplot,\n igv,\n ensembl,\n jbrowse,\n ucsc,\n washu,\n excel,\n google\n};\n\nexport function isThereTheme(key: string) {\n return Object.keys(Themes).indexOf(key) !== -1;\n}\n\nexport function getTheme(key: string) {\n return isThereTheme(key) ? (Themes as any)[key] : Themes['light'];\n}\n","import type * as HiGlass from '@higlass/types';\n\nexport type PluginTrackFactory = (\n HGC: HiGlass.HGC,\n context: HiGlass.Context,\n options: Options\n) => HiGlass.Track;\n\ntype AsConstructor = T extends (...args: infer Args) => infer Ret ? { new (...args: Args): Ret } : never;\n\ntype PluginTrack = AsConstructor> & {\n config: HiGlass.TrackConfig;\n};\n\nexport type TrackConfig = Omit, 'availableOptions'>;\n\nexport function createPluginTrack(\n config: TrackConfig,\n factory: PluginTrackFactory\n) {\n function Track(...args: Parameters) {\n if (!new.target) {\n throw new Error('Uncaught TypeError: Class constructor cannot be invoked without \"new\"');\n }\n return factory(...args);\n }\n Track.config = {\n ...config,\n availableOptions: Object.keys(config.defaultOptions ?? {})\n };\n return Track as unknown as PluginTrack & {\n config: {\n // code above ensures this field is always defined when using the plugin.\n availableOptions: (keyof Options)[];\n };\n };\n}\n","// This plugin track is based on higlass/HorizontalChromosomeLabels\n// https://github.com/higlass/higlass/blob/83dc4fddb33582ef3c26b608c04a81e8f33c7f5f/app/scripts/HorizontalChromosomeLabels.js\n\nimport type * as PIXI from 'pixi.js';\nimport RBush from 'rbush';\nimport { scaleLinear } from 'd3-scale';\nimport { format, precisionPrefix, formatPrefix } from 'd3-format';\nimport { computeChromSizes } from '../../core/utils/assembly';\nimport { cartesianToPolar } from '../../core/utils/polar';\nimport { getTextStyle } from '../../core/utils/text-style';\nimport { createPluginTrack } from '../../core/utils/define-plugin-track';\n\nimport type { TextStyle } from '../../core/utils/text-style';\nimport type { PluginTrackFactory, TrackConfig } from '../../core/utils/define-plugin-track';\nimport type { Assembly } from '@gosling-lang/gosling-schema';\n\nconst TICK_WIDTH = 200;\nconst TICK_HEIGHT = 6;\nconst TICK_TEXT_SEPARATION = 2;\nconst TICK_COLOR = 0x777777;\n\ntype AxisTrackOptions = {\n innerRadius: number;\n outerRadius: number;\n startAngle: number;\n endAngle: number;\n width: number;\n height: number;\n layout: 'linear' | 'circular';\n labelMargin: number;\n excludeChrPrefix: boolean;\n labelPosition: string;\n labelColor: string;\n labelTextOpacity: number;\n trackBorderWidth: number;\n trackBorderColor: string;\n tickPositions: 'even' | 'ends';\n fontSize: number;\n fontFamily: string; // 'Arial',\n fontWeight: NonNullable;\n color: string;\n stroke: string;\n backgroundColor: string;\n showMousePosition: boolean;\n tickColor: number;\n tickFormat?: string;\n assembly?: Assembly;\n reverseOrientation?: boolean;\n};\ntype TickLabelInfo = {\n importance: number;\n text: PIXI.Text;\n rope?: PIXI.SimpleRope;\n};\ntype TickLine = [number, number, number, number];\ntype TickText = PIXI.Text & { hashValue: number; tickLine?: TickLine };\ntype ChrPosInfo = { chr: string; pos: number };\ntype ChromInfo = {\n chrPositions: Record;\n chromLengths: Record;\n cumPositions: ChrPosInfo[];\n};\n\n// TODO: Change the icon\nconst icon =\n ' ';\n\nconst config: TrackConfig = {\n type: 'axis-track',\n datatype: ['multivec', 'epilogos'],\n local: false,\n orientation: '1d-horizontal',\n thumbnail: new DOMParser().parseFromString(icon, 'text/xml').documentElement,\n defaultOptions: {\n innerRadius: 340,\n outerRadius: 310,\n startAngle: 0,\n endAngle: 360,\n width: 700,\n height: 700,\n layout: 'linear',\n labelMargin: 5,\n excludeChrPrefix: false,\n labelPosition: 'none',\n labelColor: 'black',\n labelTextOpacity: 0.4,\n trackBorderWidth: 0,\n trackBorderColor: 'black',\n tickPositions: 'even',\n fontSize: 12,\n fontFamily: 'sans-serif', // 'Arial',\n fontWeight: 'normal',\n color: '#808080',\n stroke: '#ffffff',\n backgroundColor: 'transparent',\n showMousePosition: false,\n tickColor: TICK_COLOR\n }\n};\n\nconst factory: PluginTrackFactory = (HGC, context, options) => {\n const { absToChr, colorToHex, pixiTextToSvg, svgLine, showMousePosition } = HGC.utils;\n\n function createTickText(text: string, style: Partial): TickText {\n return Object.assign(new HGC.libraries.PIXI.Text(text, style), { hashValue: Math.random() });\n }\n\n class AxisTrackClass extends HGC.tracks.PixiTrack {\n allTexts: TickLabelInfo[];\n searchField: null;\n chromInfo: ChromInfo;\n dataConfig: Record;\n pTicksCircular: PIXI.Graphics;\n pTicks: PIXI.Graphics | null;\n gTicks: Record;\n tickTexts: Record;\n\n isShowGlobalMousePosition: () => boolean;\n\n pixiTextConfig: ReturnType;\n stroke: number;\n\n tickWidth: number;\n tickHeight: number;\n tickTextSeparation: number;\n tickColor: number;\n\n animate: () => void;\n\n hideMousePosition?: ReturnType;\n\n gBoundTicks?: PIXI.Graphics;\n leftBoundTick?: TickText;\n rightBoundTick?: TickText;\n\n is2d?: boolean;\n texts?: TickText[];\n\n constructor() {\n super(context, options);\n const { dataConfig, animate, chromInfoPath, isShowGlobalMousePosition } = context;\n\n this.searchField = null;\n this.dataConfig = dataConfig;\n\n this.allTexts = [];\n\n this.pTicksCircular = new HGC.libraries.PIXI.Graphics();\n this.pTicks = new HGC.libraries.PIXI.Graphics();\n this.pMain.addChild(this.pTicks);\n this.pMain.addChild(this.pTicksCircular);\n\n this.gTicks = {};\n this.tickTexts = {};\n\n this.options = options;\n this.isShowGlobalMousePosition = isShowGlobalMousePosition;\n\n this.pixiTextConfig = getTextStyle({\n size: +this.options.fontSize,\n fontFamily: this.options.fontFamily,\n fontWeight: this.options.fontWeight,\n color: this.options.color,\n stroke: this.options.stroke,\n strokeThickness: 2\n });\n this.stroke = colorToHex(this.pixiTextConfig.stroke);\n\n // text objects to use if the tick style is \"bounds\", meaning\n // we only draw two ticks on the left and the right of the screen\n\n this.tickWidth = TICK_WIDTH;\n this.tickHeight = TICK_HEIGHT;\n this.tickTextSeparation = TICK_TEXT_SEPARATION;\n this.tickColor = colorToHex(this.options.tickColor);\n\n this.animate = animate;\n\n this.pubSubs = [];\n\n if (this.options.showMousePosition && !this.hideMousePosition) {\n this.hideMousePosition = showMousePosition(this, this.is2d, this.isShowGlobalMousePosition());\n }\n\n let chromSizesPath = chromInfoPath;\n\n if (!chromSizesPath) {\n chromSizesPath = `${dataConfig.server}/chrom-sizes/?id=${dataConfig.tilesetUid}`;\n }\n\n // Example:\n // chrPositions: {\n // chr1: { chr: \"chr1\", pos: 0 },\n // chr2: { chr: \"chr2\", pos: 1000 },\n // },\n // chromLengths: {\n // chr1: 1000,\n // chr2: 1000\n // },\n // cumPositions: [\n // { chr: \"chr1\", pos: 0 },\n // { chr: \"chr2\", pos: 1000 },\n // ]\n\n const assembly = this.options.assembly;\n const chrPositions: { [k: string]: ChrPosInfo } = {};\n const chromLengths: { [k: string]: number } = { ...computeChromSizes(assembly).size };\n const cumPositions: ChrPosInfo[] = [];\n\n Object.keys(computeChromSizes(assembly).size).forEach(k => {\n chrPositions[k] = { chr: k, pos: computeChromSizes(assembly).size[k] };\n });\n\n Object.keys(computeChromSizes(assembly).interval).forEach(k => {\n cumPositions.push({ chr: k, pos: computeChromSizes(assembly).interval[k][0] });\n });\n\n this.chromInfo = { chrPositions, chromLengths, cumPositions };\n\n this.rerender(this.options, true);\n this.draw();\n this.animate();\n }\n\n initBoundsTicks() {\n if (this.pTicks) {\n this.pMain.removeChild(this.pTicks);\n this.pTicks = null;\n }\n\n if (!this.gBoundTicks) {\n this.gBoundTicks = new HGC.libraries.PIXI.Graphics();\n\n this.leftBoundTick = createTickText('', this.pixiTextConfig);\n this.rightBoundTick = createTickText('', this.pixiTextConfig);\n\n this.gBoundTicks.addChild(this.leftBoundTick);\n this.gBoundTicks.addChild(this.rightBoundTick);\n\n this.pMain.addChild(this.gBoundTicks);\n }\n\n this.texts = [];\n }\n\n initChromLabels() {\n if (!this.chromInfo) return;\n\n if (this.gBoundTicks) {\n this.pMain.removeChild(this.gBoundTicks);\n this.gBoundTicks = undefined;\n }\n\n if (!this.pTicks) {\n this.pTicks = new HGC.libraries.PIXI.Graphics();\n this.pMain.addChild(this.pTicks);\n }\n\n this.texts = [];\n this.pTicks.removeChildren();\n\n this.chromInfo.cumPositions.forEach((info: any) => {\n const chromName = info.chr;\n this.gTicks[chromName] = new HGC.libraries.PIXI.Graphics();\n\n // create the array that will store tick TEXT objects\n if (!this.tickTexts[chromName]) this.tickTexts[chromName] = [];\n\n // Give each PIXI text object a random hash so that some get hidden when there's overlaps\n const chromNameText = this.options.excludeChrPrefix ? chromName.replace('chr', '') : chromName;\n const text = createTickText(chromNameText, this.pixiTextConfig);\n\n this.pTicks?.addChild(text);\n this.pTicks?.addChild(this.gTicks[chromName]);\n\n this.texts?.push(text);\n });\n }\n\n rerender(options: any, force: boolean) {\n const strOptions = JSON.stringify(options);\n\n if (!force && strOptions === this.prevOptions) return;\n\n this.prevOptions = strOptions;\n this.options = options;\n\n this.pixiTextConfig.fontSize = +this.options.fontSize\n ? (`${+this.options.fontSize}px` as const)\n : this.pixiTextConfig.fontSize;\n this.pixiTextConfig.fill = this.options.color || this.pixiTextConfig.fill;\n this.pixiTextConfig.stroke = this.options.stroke || this.pixiTextConfig.stroke;\n this.stroke = colorToHex(this.pixiTextConfig.stroke as string);\n\n this.tickColor = this.options.tickColor ? colorToHex(this.options.tickColor) : TICK_COLOR;\n\n if (this.options.tickPositions === 'ends' && this.options.layout !== 'circular') {\n this.initBoundsTicks();\n } else {\n this.initChromLabels();\n }\n\n super.rerender(options, force);\n\n if (this.options.showMousePosition && !this.hideMousePosition) {\n this.hideMousePosition = showMousePosition(this, this.is2d, this.isShowGlobalMousePosition());\n }\n\n if (!this.options.showMousePosition && this.hideMousePosition) {\n this.hideMousePosition();\n this.hideMousePosition = undefined;\n }\n }\n\n formatTick(pos: number) {\n if (isNaN(pos)) {\n // the value is not proper, so early return\n return 'null';\n }\n\n const domain = this._xScale.domain();\n\n const viewWidth = domain[1] - domain[0];\n\n const p = precisionPrefix(pos, viewWidth);\n\n const fPlain = format(',');\n const fPrecision = formatPrefix(`,.${p}`, viewWidth);\n let f = fPlain;\n\n if (this.options.tickFormat === 'si') {\n f = fPrecision;\n } else if (this.options.tickFormat === 'plain') {\n f = fPlain;\n } else if (this.options.tickPositions === 'ends') {\n // if no format is specified but tickPositions are at 'ends'\n // then use precision format\n f = fPrecision;\n }\n\n return f(pos);\n }\n\n /** Show two labels at the end of both left and right sides */\n drawBoundsTicks(x1: ReturnType, x2: ReturnType) {\n if (!this.gBoundTicks || !this.leftBoundTick || !this.rightBoundTick) return;\n const graphics = this.gBoundTicks;\n graphics.clear();\n graphics.lineStyle(1, 0);\n\n // determine the stard and end positions of tick lines along the vertical axis\n const lineYStart = this.options.reverseOrientation ? 0 : this.dimensions[1];\n const lineYEnd = this.options.reverseOrientation ? this.tickHeight : this.dimensions[1] - this.tickHeight;\n\n // left tick\n // line is offset by one because it's right on the edge of the\n // visible region and we want to get the full width\n graphics.moveTo(1, lineYStart);\n graphics.lineTo(1, lineYEnd);\n\n // right tick\n graphics.moveTo(this.dimensions[0] - 1, lineYStart);\n graphics.lineTo(this.dimensions[0] - 1, lineYEnd);\n\n // we want to control the precision of the tick labels\n // so that we don't end up with labels like 15.123131M\n this.leftBoundTick.x = 0;\n this.leftBoundTick.y = this.options.reverseOrientation\n ? lineYEnd + this.tickTextSeparation\n : lineYEnd - this.tickTextSeparation;\n this.leftBoundTick.text =\n this.options.assembly === 'unknown'\n ? `${this.formatTick(x1[1])}`\n : `${x1[0]}: ${this.formatTick(x1[1])}`;\n this.leftBoundTick.anchor.y = this.options.reverseOrientation ? 0 : 1;\n\n this.rightBoundTick.x = this.dimensions[0];\n this.rightBoundTick.text =\n this.options.assembly === 'unknown'\n ? `${this.formatTick(x2[1])}`\n : `${x2[0]}: ${this.formatTick(x2[1])}`;\n this.rightBoundTick.y = this.options.reverseOrientation\n ? lineYEnd + this.tickTextSeparation\n : lineYEnd - this.tickTextSeparation;\n this.rightBoundTick.anchor.y = this.options.reverseOrientation ? 0 : 1;\n\n this.rightBoundTick.anchor.x = 1;\n\n if (this.flipText) {\n // this means this track is displayed vertically, so update the anchor and scale of labels to make them readable!\n this.leftBoundTick.scale.x = -1;\n this.leftBoundTick.anchor.x = 1;\n this.rightBoundTick.scale.x = -1;\n this.rightBoundTick.anchor.x = 0;\n }\n\n // line is offset by one because it's right on the edge of the visible region and we want to get the full width\n this.leftBoundTick.tickLine = [1, this.dimensions[1], 1, this.dimensions[1] - this.tickHeight];\n this.rightBoundTick.tickLine = [\n this.dimensions[0] - 1,\n this.dimensions[1],\n this.dimensions[0] - 1,\n this.dimensions[1] - this.tickHeight\n ];\n\n this.tickTexts = {};\n this.tickTexts.all = [this.leftBoundTick, this.rightBoundTick];\n // this.rightBoundTick\n }\n\n drawTicks(cumPos: { chr: string; pos: number }) {\n const graphics = this.gTicks[cumPos.chr];\n\n graphics.visible = true;\n\n // clear graphics *and* ticktexts otherwise the two are out of sync!\n graphics.clear();\n\n const chromLen = +this.chromInfo.chromLengths[cumPos.chr];\n\n const vpLeft = Math.max(this._xScale(cumPos.pos), 0);\n const vpRight = Math.min(this._xScale(cumPos.pos + chromLen), this.dimensions[0]);\n\n const numTicks = (vpRight - vpLeft) / this.tickWidth;\n\n // what is the domain of this chromosome that is visible?\n const xScale = scaleLinear()\n .domain([\n Math.max(1, this._xScale.invert(0) - cumPos.pos),\n Math.min(chromLen, this._xScale.invert(this.dimensions[0]) - cumPos.pos)\n ])\n .range([vpLeft, vpRight]);\n\n // calculate a certain number of ticks\n const ticks = xScale.ticks(numTicks).filter(tick => Number.isInteger(tick));\n\n // not sure why we're separating these out by chromosome, but ok\n const tickTexts = this.tickTexts[cumPos.chr];\n\n const tickHeight = this.tickHeight;\n\n const xPadding = 0;\n\n let yPadding = tickHeight + this.tickTextSeparation;\n\n if (this.options.reverseOrientation) {\n yPadding = this.dimensions[1] - yPadding;\n }\n\n // these two loops reuse existing text objects so that we're not constantly recreating texts that already exist\n while (tickTexts.length < ticks.length) {\n const newText = createTickText('', this.pixiTextConfig);\n tickTexts.push(newText);\n this.gTicks[cumPos.chr].addChild(newText);\n }\n\n while (tickTexts.length > ticks.length) {\n const text = tickTexts.pop();\n this.gTicks[cumPos.chr].removeChild(text!);\n }\n\n let i = 0;\n while (i < ticks.length) {\n tickTexts[i].visible = true;\n\n tickTexts[i].anchor.x = 0.5;\n tickTexts[i].anchor.y =\n this.options.layout === 'circular' ? 0 : this.options.reverseOrientation ? 0 : 1;\n\n if (this.flipText) tickTexts[i].scale.x = -1;\n\n const chrText = this.options.assembly === 'unknown' ? '' : `${cumPos.chr}: `;\n tickTexts[i].text = ticks[i] === 0 ? `${chrText}1` : `${chrText}${this.formatTick(ticks[i])}`;\n\n const x = this._xScale(cumPos.pos + ticks[i]);\n\n // show the tick text labels\n if (this.options.layout === 'circular') {\n const rope = this.addCurvedText(tickTexts[i], x + xPadding);\n rope && this.pTicksCircular.addChild(rope);\n } else {\n tickTexts[i].x = x + xPadding;\n tickTexts[i].y = this.dimensions[1] - yPadding;\n\n // store the position of the tick line so that it can be used in the export function\n // TODO:\n tickTexts[i].tickLine = [x - 1, this.dimensions[1], x - 1, this.dimensions[1] - tickHeight - 1];\n\n // draw outline\n const lineYStart = this.options.reverseOrientation ? 0 : this.dimensions[1];\n const lineYEnd = this.options.reverseOrientation ? tickHeight : this.dimensions[1] - tickHeight;\n // graphics.lineStyle(1, this.stroke);\n // graphics.moveTo(x - 1, lineYStart);\n // graphics.lineTo(x - 1, lineYEnd - 1);\n // graphics.lineTo(x + 1, lineYEnd - 1);\n // graphics.lineTo(x + 1, lineYStart);\n\n // draw the vertical tick lines\n graphics.lineStyle(1, this.tickColor);\n graphics.moveTo(x, lineYStart);\n graphics.lineTo(x, lineYEnd);\n }\n\n i += 1;\n }\n\n if (this.options.layout === 'circular') i = 0;\n while (i < tickTexts.length) {\n // we don't need this text so we'll turn it off for now\n tickTexts[i].visible = false;\n\n i += 1;\n }\n\n return ticks.length;\n }\n\n addCurvedText(textObj: PIXI.Text, cx: number) {\n const [width, height] = this.dimensions;\n const { startAngle, endAngle } = this.options;\n const factor = Math.min(width, height) / Math.min(this.options.width, this.options.height);\n const innerRadius = this.options.innerRadius * factor;\n const outerRadius = this.options.outerRadius * factor;\n\n const r = (outerRadius + innerRadius) / 2.0;\n const centerPos = cartesianToPolar(cx, width, r, width / 2.0, height / 2.0, startAngle, endAngle);\n textObj.x = centerPos.x;\n textObj.y = centerPos.y;\n\n textObj.resolution = 4;\n const txtStyle = new HGC.libraries.PIXI.TextStyle(this.pixiTextConfig);\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(textObj.text, txtStyle);\n\n // scale the width of text label so that its width is the same when converted into circular form\n const tw = ((metric.width / (2 * r * Math.PI)) * width * 360) / (endAngle - startAngle);\n let [minX, maxX] = [cx - tw / 2.0, cx + tw / 2.0];\n\n // make sure not to place the label on the origin\n if (minX < 0) {\n const gap = -minX;\n minX = 0;\n maxX += gap;\n } else if (maxX > width) {\n const gap = maxX - width;\n maxX = width;\n minX -= gap;\n }\n\n const ropePoints: PIXI.Point[] = [];\n const baseR = innerRadius + metric.height / 2.0 + 3;\n for (let i = maxX; i >= minX; i -= tw / 10.0) {\n const p = cartesianToPolar(i, width, baseR, width / 2.0, height / 2.0, startAngle, endAngle);\n ropePoints.push(new HGC.libraries.PIXI.Point(p.x, p.y));\n }\n\n if (ropePoints.length === 0) {\n return undefined;\n }\n\n // @ts-expect-error missing argument\n textObj.updateText();\n const rope = new HGC.libraries.PIXI.SimpleRope(textObj.texture, ropePoints);\n return rope;\n }\n\n draw() {\n this.allTexts = [];\n\n if (!this.texts) return;\n\n const x1 = absToChr(this._xScale.domain()[0], this.chromInfo);\n const x2 = absToChr(this._xScale.domain()[1], this.chromInfo);\n\n if (!x1 || !x2) {\n console.warn('Empty chromInfo:', this.dataConfig, this.chromInfo);\n return;\n }\n\n if (this.options.tickPositions === 'ends' && this.options.layout !== 'circular') {\n // We only support linear layouts for this.\n if (!this.gBoundTicks) return;\n\n this.gBoundTicks.visible = true;\n\n this.drawBoundsTicks(x1, x2);\n\n return;\n }\n\n if (!this.pTicks) {\n // options.tickPositiosn was probably just changed to 'even' and initChromLabels hasn't been called yet\n return;\n }\n\n const circular = this.options.layout === 'circular';\n\n for (let i = 0; i < this.texts.length; i++) {\n this.texts[i].visible = false;\n this.gTicks[this.chromInfo.cumPositions[i].chr].visible = false;\n }\n\n let yPadding = this.tickHeight + this.tickTextSeparation;\n\n if (this.options.reverseOrientation) {\n yPadding = this.dimensions[1] - yPadding;\n }\n\n // hide all the chromosome labels in preparation for drawing new ones\n Object.keys(this.chromInfo.chrPositions).forEach(chrom => {\n if (this.tickTexts[chrom]) {\n this.tickTexts[chrom].forEach((tick: any) => {\n tick.visible = false;\n });\n }\n });\n\n /* tslint:disable */\n this.pTicksCircular.removeChildren();\n\n // iterate over each chromosome\n for (let i = x1[3]; i <= x2[3]; i++) {\n const xCumPos = this.chromInfo.cumPositions[i];\n\n const midX = xCumPos.pos + this.chromInfo.chromLengths[xCumPos.chr] / 2;\n\n const viewportMidX = this._xScale(midX);\n\n // This is ONLY the bare chromosome name. Not the tick label!\n const chrText = this.texts[i];\n\n chrText.anchor.x = 0.5;\n chrText.anchor.y = circular ? 0.5 : this.options.reverseOrientation ? 0 : 1;\n\n let rope: PIXI.SimpleRope | undefined;\n if (circular) {\n rope = this.addCurvedText(chrText, viewportMidX);\n if (rope) {\n this.pTicksCircular.addChild(rope);\n }\n } else {\n chrText.x = viewportMidX;\n chrText.y = this.dimensions[1] - yPadding;\n }\n\n chrText.updateTransform();\n\n if (this.flipText) chrText.scale.x = -1;\n\n const numTicksDrawn = this.drawTicks(xCumPos);\n\n // only show chromsome labels if there's no ticks drawn\n if (!circular) {\n chrText.visible = numTicksDrawn <= 0;\n } else {\n if (numTicksDrawn > 0) {\n rope && this.pTicksCircular.removeChild(rope);\n }\n }\n\n this.allTexts.push({\n importance: chrText.hashValue,\n text: chrText,\n rope\n });\n }\n /* tslint:enable */\n\n // define the edge chromosome which are visible\n this.hideOverlaps(this.allTexts);\n }\n\n hideOverlaps(allTexts: TickLabelInfo[]) {\n const tree = new RBush<{ minX: number; minY: number; maxX: number; maxY: number }>();\n\n // using bounding boxes of the text objects, calculate overlaps\n allTexts\n .sort((a, b) => b.importance - a.importance)\n .forEach(({ text, rope }: any) => {\n text.updateTransform();\n const b = text.getBounds();\n const m = this.options.labelMargin;\n const boxWithMargin = {\n minX: b.x - m,\n minY: b.y - m,\n maxX: b.x + b.width + m * 2,\n maxY: b.y + b.height + m * 2\n };\n if (m < 0 || !tree.collides(boxWithMargin)) {\n // if not overlapping, add a new boundingbox\n tree.insert(boxWithMargin);\n } else {\n // if overlapping, hide text labels\n text.visible = false;\n if (this.options.layout === 'circular' && rope) {\n this.pTicksCircular.removeChild(rope);\n }\n }\n });\n }\n\n setPosition(newPosition: [number, number]) {\n super.setPosition(newPosition);\n\n [this.pMain.position.x, this.pMain.position.y] = this.position;\n }\n\n zoomed(newXScale: any, newYScale: any) {\n const domainValues = [...newXScale.domain(), ...newYScale.domain()];\n if (domainValues.filter(d => isNaN(d)).length !== 0) {\n // we received an invalid scale somehow\n // console.warn('');\n return;\n }\n\n this.xScale(newXScale);\n this.yScale(newYScale);\n\n this.draw();\n }\n\n exportSVG(): [HTMLElement, HTMLElement] {\n let track = null;\n let base = null;\n\n // @ts-expect-error always true because it's defined on HGC.tracks.PixiTrack\n if (super.exportSVG) {\n [base, track] = super.exportSVG();\n } else {\n base = document.createElement('g');\n track = base;\n }\n base.setAttribute('class', 'chromosome-labels');\n\n const output = document.createElement('g');\n track.appendChild(output);\n\n output.setAttribute('transform', `translate(${this.position[0]},${this.position[1]})`);\n\n this.allTexts\n .filter(text => text.text.visible)\n .forEach(text => {\n const g = pixiTextToSvg(text.text);\n output.appendChild(g);\n });\n\n Object.values(this.tickTexts).forEach(texts => {\n texts\n .filter(x => x.visible)\n .forEach(text => {\n if (!text.tickLine) return;\n\n let g = pixiTextToSvg(text);\n output.appendChild(g);\n g = svgLine(\n text.x,\n this.options.reverseOrientation ? 0 : this.dimensions[1],\n text.x,\n this.options.reverseOrientation ? this.tickHeight : this.dimensions[1] - this.tickHeight,\n 1,\n this.tickColor\n );\n\n const line = document.createElement('line');\n\n line.setAttribute('x1', String(text.tickLine[0]));\n line.setAttribute('y1', String(text.tickLine[1]));\n line.setAttribute('x2', String(text.tickLine[2]));\n line.setAttribute('y2', String(text.tickLine[3]));\n line.setAttribute('style', 'stroke: grey');\n\n output.appendChild(g);\n output.appendChild(line);\n });\n });\n\n return [base, track];\n }\n }\n return new AxisTrackClass();\n};\n\nexport default createPluginTrack(config, factory);\n","import { arc as d3arc } from 'd3-shape';\nimport type { SubjectPosition, D3DragEvent } from 'd3-drag';\nimport { RADIAN_GAP, valueToRadian } from '../../core/utils/polar';\nimport { uuid } from '../../core/utils/uuid';\n\ntype CircularBrushData = {\n type: 'brush' | 'start' | 'end';\n startAngle: number;\n endAngle: number;\n cursor: string;\n};\n\nfunction BrushTrack(HGC: any, ...args: any[]): any {\n if (!new.target) {\n throw new Error('Uncaught TypeError: Class constructor cannot be invoked without \"new\"');\n }\n\n class BrushTrackClass extends HGC.tracks.SVGTrack {\n public circularBrushData: CircularBrushData[];\n public prevExtent: [number, number];\n\n constructor(params: any[]) {\n super(...params); // context, options\n\n const [context, options] = params;\n const { registerViewportChanged, removeViewportChanged, setDomainsCallback } = context;\n\n this.uid = uuid();\n this.options = options;\n\n // Is there actually a linked from view? Or is this projection \"independent\"?\n this.hasFromView = !context.projectionXDomain;\n\n this.removeViewportChanged = removeViewportChanged;\n this.setDomainsCallback = setDomainsCallback;\n\n this.viewportXDomain = this.hasFromView ? null : context.projectionXDomain;\n this.viewportYDomain = this.hasFromView ? null : [0, 0];\n\n this.prevExtent = [0, 0];\n this.RR = 0.02; // radian angle of resizers on the both sides\n\n const extent: [number, number] = [0, Math.PI * 1.7];\n this.circularBrushData = this.getBrushData(extent);\n\n this.brush = d3arc()\n .innerRadius(this.options.innerRadius ?? 100)\n .outerRadius(this.options.outerRadius ?? 200);\n\n this.gBrush = this.gMain\n .append('g')\n .attr('id', `brush-${this.uid}`)\n .selectAll('.brush')\n .data(this.circularBrushData)\n .enter()\n .append('path')\n .attr('class', 'brush')\n .attr('d', this.brush)\n .attr('fill', this.options.projectionFillColor)\n .attr('stroke', this.options.projectionStrokeColor)\n // Let's hide left and right resizer\n .attr('fill-opacity', (d: CircularBrushData) =>\n d.type === 'brush' ? this.options.projectionFillOpacity : 0\n )\n .attr('stroke-opacity', (d: CircularBrushData) =>\n d.type === 'brush' ? this.options.projectionStrokeOpacity : 0\n )\n .attr('stroke-width', this.options.strokeWidth)\n .style('pointer-events', 'all')\n .style('cursor', (d: CircularBrushData) => d.cursor)\n .call(this.dragged());\n\n // the viewport will call this.viewportChanged immediately upon hearing registerViewportChanged\n registerViewportChanged(this.uid, this.viewportChanged.bind(this));\n\n this.draw();\n }\n\n /**\n * Get information for circular brush for given extent of angle.\n */\n getBrushData(extent: [number, number]): CircularBrushData[] {\n return [\n {\n type: 'brush',\n startAngle: extent[0],\n endAngle: extent[1],\n cursor: 'grab'\n },\n {\n type: 'start',\n startAngle: extent[0],\n endAngle: extent[0] + this.RR,\n cursor: 'move'\n },\n {\n type: 'end',\n startAngle: extent[1] - this.RR,\n endAngle: extent[1],\n cursor: 'move'\n }\n ];\n }\n\n cropExtent(extent: [number, number]): [number, number] {\n let [s, e] = extent;\n\n let round = 0;\n while (s > Math.PI * 2 || e > Math.PI * 2 || s < 0 || e < 0) {\n if (round++ > 10) {\n // this shifting process should be done in a single round, so reaching here shouldn't happen.\n break;\n }\n\n if (s > Math.PI * 2 || e > Math.PI * 2) {\n s -= Math.PI * 2;\n e -= Math.PI * 2;\n } else if (s < 0 || e < 0) {\n s += Math.PI * 2;\n e += Math.PI * 2;\n }\n }\n return ([s, e] as number[]).sort((a, b) => a - b) as [number, number];\n }\n\n /**\n * Update the position and size of brush.\n */\n updateBrush(extent: [number, number]) {\n let [s, e] = extent;\n\n if (\n (s <= RADIAN_GAP && e <= RADIAN_GAP) ||\n (s >= Math.PI * 2 - RADIAN_GAP && e >= Math.PI * 2 - RADIAN_GAP)\n ) {\n // this means [s, e] is entirely out of the visible area, so simply hide the brush\n this.gBrush.attr('visibility', 'hidden');\n return;\n }\n\n // crop angles if they are out of the visible area\n if (s < RADIAN_GAP) {\n s = RADIAN_GAP;\n }\n if (s > Math.PI * 2 - RADIAN_GAP) {\n s = Math.PI * 2 - RADIAN_GAP;\n }\n if (e < RADIAN_GAP) {\n e = RADIAN_GAP;\n }\n if (e > Math.PI * 2 - RADIAN_GAP) {\n e = Math.PI * 2 - RADIAN_GAP;\n }\n\n this.circularBrushData = this.getBrushData(extent);\n this.gBrush.data(this.circularBrushData).attr('d', this.brush).attr('visibility', 'visible');\n }\n\n /**\n * Function to call upon hearing click event on the brush\n */\n dragged() {\n const start = (event: D3DragEvent) => {\n this.startEvent = event.sourceEvent;\n this.prevExtent = [this.circularBrushData[0].startAngle, this.circularBrushData[0].endAngle];\n };\n\n const drag = (event: D3DragEvent, d: CircularBrushData) => {\n const [x, y] = this.position;\n const [w, h] = this.dimensions;\n const endEvent = event.sourceEvent;\n\n // adjust the position\n const startX = this.startEvent.layerX - x;\n const startY = this.startEvent.layerY - y;\n const endX = endEvent.layerX - x;\n const endY = endEvent.layerY - y;\n\n // calculate the radian difference from the drag event\n // rotate the origin +90 degree so that it is positioned on the 12 O'clock\n const radDiff =\n // radian of the start position\n Math.atan2(startX - w / 2.0, startY - h / 2.0) -\n // radian of the current position\n Math.atan2(endX - w / 2.0, endY - h / 2.0);\n\n // previous extent of brush\n let [s, e] = this.prevExtent;\n\n if (d.type === 'brush') {\n s = s + radDiff;\n e = e + radDiff;\n\n if (s < RADIAN_GAP || Math.PI * 2 - RADIAN_GAP < e) {\n // This means [s, e] contains the origin, i.e., 12 O'clock\n const sto = RADIAN_GAP - s;\n const eto = e - (Math.PI * 2 - RADIAN_GAP);\n\n if (sto > eto) {\n // Place the brush on the right side of the origin\n e += sto;\n s += sto;\n } else {\n // Place the brush on the left side of the origin\n s -= eto;\n e -= eto;\n }\n }\n } else if (d.type === 'start') {\n s = s + radDiff;\n } else if (d.type === 'end') {\n e = e + radDiff;\n }\n\n [s, e] = this.cropExtent([s, e]);\n\n if (!this._xScale || !this._yScale) {\n return;\n }\n\n const scale = (this.options.endAngle - this.options.startAngle) / 360;\n const offsetedS = s - (this.options.startAngle / 360) * Math.PI * 2;\n const offsetedE = e - (this.options.startAngle / 360) * Math.PI * 2;\n const xDomain = [\n this._xScale.invert(w - (w * offsetedE) / (Math.PI * 2 * scale)),\n this._xScale.invert(w - (w * offsetedS) / (Math.PI * 2 * scale))\n ];\n\n const yDomain = this.viewportYDomain;\n\n if (!this.hasFromView) {\n this.viewportXDomain = xDomain;\n }\n\n this.setDomainsCallback(xDomain, yDomain);\n\n this.updateBrush([s, e]);\n };\n\n return HGC.libraries.d3Drag.drag().on('start', start).on('drag', drag);\n }\n\n draw() {\n if (!this._xScale || !this.yScale) {\n return;\n }\n\n if (!this.viewportXDomain || !this.viewportYDomain) {\n return;\n }\n\n const x0 = this._xScale(this.viewportXDomain[0]);\n const x1 = this._xScale(this.viewportXDomain[1]);\n\n const [w] = this.dimensions;\n let e = valueToRadian(x0, w, this.options.startAngle, this.options.endAngle) + Math.PI / 2.0;\n let s = valueToRadian(x1, w, this.options.startAngle, this.options.endAngle) + Math.PI / 2.0;\n\n [s, e] = this.cropExtent([s, e]);\n\n this.updateBrush([s, e]);\n }\n\n viewportChanged(viewportXScale: any, viewportYScale: any) {\n const viewportXDomain = viewportXScale.domain();\n const viewportYDomain = viewportYScale.domain();\n\n this.viewportXDomain = viewportXDomain;\n this.viewportYDomain = viewportYDomain;\n\n this.draw();\n }\n\n remove() {\n // remove the event handler that updates this viewport tracker\n this.removeViewportChanged(this.uid);\n\n super.remove();\n }\n\n rerender() {\n // !!! TODO: when does this called?\n }\n\n zoomed(newXScale: any, newYScale: any) {\n this.xScale(newXScale);\n this.yScale(newYScale);\n\n this.draw();\n }\n\n setPosition(newPosition: any) {\n super.setPosition(newPosition);\n\n this.draw();\n }\n\n setDimensions(newDimensions: any) {\n super.setDimensions(newDimensions);\n\n // change the position\n this.gBrush.attr('transform', `translate(${newDimensions[0] / 2.0},${newDimensions[1] / 2.0})`);\n\n this.draw();\n }\n }\n\n return new BrushTrackClass(args);\n}\n\n// TODO: Change the icon\nconst icon =\n ' ';\n\n// TODO:\n// default\nBrushTrack.config = {\n type: 'brush-track',\n datatype: ['projection'],\n local: false, // TODO:\n projection: true,\n orientation: '2d',\n thumbnail: new DOMParser().parseFromString(icon, 'text/xml').documentElement,\n availableOptions: [\n 'innerRadius',\n 'outerRadius',\n 'startAngle',\n 'endAngle',\n 'axisPositionHorizontal',\n 'projectionFillColor',\n 'projectionStrokeColor',\n 'projectionFillOpacity',\n 'projectionStrokeOpacity',\n 'strokeWidth'\n ],\n defaultOptions: {\n innerRadius: 100,\n outerRadius: 200,\n startAngle: 0,\n endAngle: 360,\n axisPositionHorizontal: 'left',\n projectionFillColor: '#777',\n projectionStrokeColor: '#777',\n projectionFillOpacity: 0.3,\n projectionStrokeOpacity: 0.7,\n strokeWidth: 1\n }\n};\n\nexport default BrushTrack;\n","import { createNanoEvents, type Emitter } from 'nanoevents';\nimport type * as D3Selection from 'd3-selection';\nimport type * as D3Drag from 'd3-drag';\nimport type { EventStyle } from '@gosling-lang/gosling-schema';\n\nconst HIDDEN_BRUSH_EDGE_SIZE = 3;\n\ninterface Interval {\n start: number;\n end: number;\n}\n\ntype LinearBrushData = [\n { type: 'body'; cursor: 'grab' } & Interval,\n { type: 'start'; cursor: 'ew-resize' } & Interval,\n { type: 'end'; cursor: 'ew-resize' } & Interval\n];\n\ninterface LinearBrushEvents {\n brush: (range: [number, number] | null, skipApiTrigger: boolean) => void;\n}\n\n// default styles for brush\nconst BRUSH_STYLE_DEFAULT: Required> = {\n color: '#777',\n stroke: '#777',\n strokeWidth: 1,\n strokeOpacity: 0.7,\n opacity: 0.3\n};\n\n/**\n * A model to manage 1D brush graphics and its data.\n */\nexport class LinearBrushModel {\n /* graphical elements */\n private brushSelection: D3Selection.Selection;\n private readonly style: Required>;\n\n /* data */\n private range: [number, number] | null;\n private data: LinearBrushData;\n\n /* drag */\n private startEvent: D3Drag.D3DragEvent['sourceEvent'];\n private prevExtent: [number, number] | null;\n\n /* visual parameters */\n private offset: [number, number];\n private size: number; // fixed size of one-dimension of a brush (e.g., height)\n\n /* External libraries that we re-use from HiGlass */\n private externals: {\n d3Selection: typeof D3Selection;\n d3Drag: typeof D3Drag;\n };\n\n private emitter: Emitter;\n\n constructor(\n selection: D3Selection.Selection,\n hgLibraries: any,\n style: EventStyle = {}\n ) {\n this.emitter = createNanoEvents();\n this.range = null;\n this.prevExtent = [0, 0];\n this.data = this.rangeToData(0, 0);\n\n this.offset = [0, 0];\n this.size = 0;\n\n this.externals = {\n d3Selection: hgLibraries.d3Selection,\n d3Drag: hgLibraries.d3Drag\n };\n\n this.style = Object.assign({}, BRUSH_STYLE_DEFAULT, style);\n\n this.brushSelection = selection\n .selectAll('.genomic-range-brush')\n .data(this.data)\n .enter()\n .append('rect')\n .attr('class', 'genomic-range-brush')\n .call(this.onDrag());\n }\n\n public getRange() {\n return this.range;\n }\n\n public setSize(size: number) {\n this.size = size;\n return this;\n }\n\n /**\n * Update the left and top offsets for drawing the brush.\n */\n public setOffset(offsetX: number, offsetY: number) {\n this.offset = [offsetX, offsetY];\n return this;\n }\n\n /**\n * Update brush data based on the positions of two edges.\n */\n public updateRange(range: [number, number] | null) {\n if (range) {\n this.range = [Math.min(...range), Math.max(...range)];\n this.data = this.rangeToData(...this.range);\n } else {\n this.range = null;\n }\n return this;\n }\n\n /**\n * Update the brush using the internal range value. By default,\n * This function calls a render function from gosling-track.\n */\n public drawBrush(skipApiTrigger = false) {\n const [x, y] = this.offset;\n const height = this.size;\n const getWidth = (d: LinearBrushData[number]) => Math.abs(d.end - d.start); // the start and end can be minus values\n this.brushSelection\n .data(this.data)\n .attr('transform', d => `translate(${x + d.start}, ${y + 1})`)\n .attr('width', d => `${getWidth(d)}px`)\n .attr('height', `${height - 2}px`)\n .attr('fill', this.style.color)\n .attr('stroke', this.style.stroke)\n .attr('stroke-width', `${this.style.strokeWidth}px`)\n .attr('fill-opacity', d => (d.type === 'body' ? this.style.opacity : 0))\n .attr('stroke-opacity', d => (d.type === 'body' ? this.style.strokeOpacity : 0))\n .attr('cursor', d => d.cursor);\n\n this.emitter.emit('brush', this.getRange(), skipApiTrigger);\n return this;\n }\n\n public enable() {\n this.brushSelection.attr('pointer-events', 'all');\n return this;\n }\n\n public disable() {\n this.brushSelection.attr('pointer-events', 'none');\n return this;\n }\n\n public visible() {\n this.brushSelection.attr('visibility', 'visible');\n return this;\n }\n\n public hidden() {\n this.brushSelection.attr('visibility', 'hidden');\n return this;\n }\n\n public clear() {\n this.updateRange(null).drawBrush().hidden().disable();\n return this;\n }\n\n public remove() {\n this.brushSelection.remove();\n return this;\n }\n\n /**\n * Based on the extent values, generate a JSON object for the brush.\n */\n private rangeToData(start: number, end: number): LinearBrushData {\n return [\n {\n type: 'body',\n cursor: 'grab',\n start,\n end\n },\n {\n type: 'start',\n cursor: 'ew-resize',\n start: start - HIDDEN_BRUSH_EDGE_SIZE,\n end: start\n },\n {\n type: 'end',\n cursor: 'ew-resize',\n start: end,\n end: end + HIDDEN_BRUSH_EDGE_SIZE\n }\n ];\n }\n\n private onDrag() {\n const started = (event: D3Drag.D3DragEvent) => {\n this.startEvent = event.sourceEvent;\n this.prevExtent = this.range;\n };\n\n const dragged = (\n event: D3Drag.D3DragEvent,\n d: LinearBrushData[number]\n ) => {\n const delta = event.sourceEvent.layerX - this.startEvent.layerX;\n\n // previous extent of brush\n let [s, e]: [number, number] = this.prevExtent ?? [0, 0];\n\n if (d.type === 'body') {\n s += delta;\n e += delta;\n } else if (d.type === 'start') {\n s += delta;\n } else if (d.type === 'end') {\n e += delta;\n }\n\n this.updateRange([s, e]).drawBrush();\n };\n\n return this.externals.d3Drag\n .drag()\n .on('start', started)\n .on('drag', dragged);\n }\n\n on(event: E, callback: LinearBrushEvents[E]) {\n this.emitter.on(event, callback);\n }\n}\n","import { pointsToDegree } from '../../../core/utils/polar';\n\n/**\n * @param point Tuple of the form `[x,y]` to be tested.\n * @param center Tuple of the form `[x,y]` that correspond to the center of an arc.\n * @param radius The inner and outer radius of the arc.\n * @param angle The start and end angle the arc in the range of [0, 360]. Anticlockwise, starting from 12 o'clock.\n * @returns If `true` point lies within the arc, i.e., the slice of the donut.\n */\nexport const isPointInsideDonutSlice: (\n point: [number, number],\n center: [number, number],\n radius: [number, number],\n angle: [number, number]\n) => boolean = ([x, y], [cx, cy], [innerRadius, outerRadius], [startAngle, endAngle]) => {\n const dist = Math.sqrt((x - cx) ** 2 + (y - cy) ** 2);\n if (dist < innerRadius || outerRadius < dist) {\n // Out of the given radius range\n return false;\n }\n const degree = pointsToDegree(x, y, cx, cy);\n if (degree < startAngle || endAngle < degree) {\n // Out of the given angle range\n return false;\n }\n return true;\n};\n\n/**\n * @param point Tuple of the form `[x,y]` to be tested.\n * @param point2 Tuple of the form `[x,y]` to be tested.\n * @param radius A radius of the second point.\n * @returns If `true` point lies within the point.\n */\nexport const isPointNearPoint: (point: [number, number], point2: number[], radius?: number) => boolean = (\n [x1, y1],\n [x2, y2],\n radius = 5\n) => {\n return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) < radius;\n};\n\n/**\n * @param range Tuple of the form `[x1,x2]` to be tested.\n * @param point A value x to be tested.\n * @returns If `true` point lies within the point.\n */\nexport const isPointInsideRange: (range: [number, number], x: number) => boolean = ([x1, x2], x) => {\n return x1 <= x && x <= x2;\n};\n\n/**\n * @param range Tuple of the form `[x1,x2]` to be tested.\n * @param x A value x to be tested.\n * @param radius A radius of the point.\n * @returns If `true` point lies within the point.\n */\nexport const isCircleWithinRange: (range: [number, number], x: number, radius?: number) => boolean = (\n range,\n x,\n radius = 5\n) => {\n return isPointInsideRange(range, x - radius) && isPointInsideRange(range, x + radius);\n};\n\n/**\n * @param point Tuple of the form `[x1,x2]` to be tested.\n * @param path 1D list of vertices defining the line segments.\n * @return If `true` point lies within the polygon.\n */\nexport const isAllPointsWithinRange: (range: [number, number], path: number[]) => boolean = (range, path) => {\n return path.filter((_, i) => i % 2 === 0).every(x => isPointInsideRange(range, x));\n};\n\n/**\n * From: https://www.geeksforgeeks.org/minimum-distance-from-a-point-to-the-line-segment-using-vectors/\n * @param point Tuple of the form `[x,y]` to be tested.\n * @param path 1D list of vertices defining the line segments.\n * @param dist A threshold distance for test.\n * @return If `true` point lies within the polygon.\n */\nexport const isPointNearLine: (point: [number, number], path: number[], dist?: number) => boolean = (\n [x, y],\n path,\n dist = 5\n) => {\n let x1;\n let y1;\n let x2;\n let y2;\n let isWithin = false;\n for (let i = 0; i < path.length - 2; i += 2) {\n x1 = path[i];\n y1 = path[i + 1];\n x2 = path[i + 2];\n y2 = path[i + 3];\n\n const AB = [x2 - x1, y2 - y1];\n const BE = [x - x2, y - y2];\n const AE = [x - x1, y - y1];\n\n // Variables to store dot product\n const AB_BE = AB[0] * BE[0] + AB[1] * BE[1];\n const AB_AE = AB[0] * AE[0] + AB[1] * AE[1];\n\n let actDist = 0;\n if (AB_BE > 0) {\n actDist = Math.sqrt((y - y2) ** 2 + (x - x2) ** 2);\n } else if (AB_AE < 0) {\n actDist = Math.sqrt((y - y1) ** 2 + (x - x1) ** 2);\n } else {\n actDist = Math.abs(AB[0] * AE[1] - AB[1] * AE[0]) / Math.sqrt(AB[0] ** 2 + AB[1] ** 2);\n }\n if (actDist < dist) {\n isWithin = true;\n }\n }\n return isWithin;\n};\n\n/**\n * Adopted from\n * https://github.com/flekschas/utils\n * https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html\n * @param point Tuple of the form `[x,y]` to be tested.\n * @param polygon 1D list of vertices defining the polygon.\n * @return If `true` point lies within the polygon.\n */\nexport const isPointInPolygon: (point: [number, number], polygon: number[]) => boolean = ([x, y], polygon) => {\n let x1;\n let y1;\n let x2;\n let y2;\n let isWithin = false;\n for (let i = 0, j = polygon.length - 2; i < polygon.length; i += 2) {\n x1 = polygon[i];\n y1 = polygon[i + 1];\n x2 = polygon[j];\n y2 = polygon[j + 1];\n if (y1 > y !== y2 > y && x < ((x2 - x1) * (y - y1)) / (y2 - y1) + x1) {\n isWithin = !isWithin;\n }\n j = i;\n }\n return isWithin;\n};\n","import type { Datum } from '@gosling-lang/gosling-schema';\nimport {\n isAllPointsWithinRange,\n isPointInPolygon,\n isPointNearLine,\n isPointNearPoint,\n isCircleWithinRange\n} from './polygon';\nimport { uuid } from '../../../core/utils/uuid';\n\nexport type MouseEventData = PointEventData | LineEventData | PolygonEventData;\n\ninterface CommonEventData {\n uid: string;\n value: Datum;\n}\n\ninterface PointEventData extends CommonEventData {\n type: 'point';\n polygon: [number, number, number]; // [x, y, radius]\n}\n\ninterface LineEventData extends CommonEventData {\n type: 'line';\n polygon: number[]; // [x1, y1, x2, y2, ...]\n}\n\ninterface PolygonEventData extends CommonEventData {\n type: 'polygon';\n polygon: number[]; // [x1, y1, x2, y2, ...]\n}\n\n/**\n * A model to manage mouse events.\n */\nexport class MouseEventModel {\n // main data that this model manage\n private data: MouseEventData[];\n\n constructor() {\n this.data = [];\n }\n\n /**\n * Access the number of mouse events stored.\n */\n public size() {\n return this.data.length;\n }\n\n /**\n * Add a new mouse event that is polygon-based.\n */\n public addPolygonBasedEvent(value: Datum, polygon: number[]) {\n this.data.push({ uid: uuid(), type: 'polygon', value, polygon });\n }\n\n /**\n * Add a new mouse event that is point-based.\n */\n public addPointBasedEvent(value: Datum, pointAndRadius: [number, number, number]) {\n this.data.push({ uid: uuid(), type: 'point', value, polygon: pointAndRadius });\n }\n\n /**\n * Add a new mouse event that is line-based.\n */\n public addLineBasedEvent(value: Datum, path: number[]) {\n this.data.push({ uid: uuid(), type: 'line', value, polygon: path });\n }\n\n /**\n * Make the data array empty.\n */\n public clear() {\n this.data = [];\n }\n\n /**\n * Find the first event data that is within the mouse position.\n */\n public find(x: number, y: number, reverse = false) {\n const _ = Array.from(this.data);\n if (reverse) _.reverse();\n return _.find(d => this.isMouseWithin(d, x, y));\n }\n\n /**\n * Find all event data that is within the mouse position.\n */\n public findAll(x: number, y: number, reverse = false) {\n const _ = Array.from(this.data);\n if (reverse) _.reverse();\n return _.filter(d => this.isMouseWithin(d, x, y));\n }\n\n /**\n * Find all event data that matches the id values in the source and return them.\n */\n public getSiblings(source: MouseEventData[], idField: string) {\n const siblings: MouseEventData[] = [];\n const sourceUids = Array.from(new Set(source.map(d => d.uid)));\n source.forEach(s => {\n const id = s.value[idField];\n if (id) {\n siblings.push(...this.data.filter(_ => _.value[idField] === id && sourceUids.indexOf(_.uid) === -1));\n }\n });\n return siblings;\n }\n\n /**\n * Test if a mouse position is within a given object.\n */\n public isMouseWithin(data: MouseEventData, x: number, y: number) {\n switch (data.type) {\n case 'point':\n return isPointNearPoint([x, y], data.polygon);\n case 'line':\n return isPointNearLine([x, y], data.polygon);\n case 'polygon':\n default:\n return isPointInPolygon([x, y], data.polygon);\n }\n }\n\n /**\n * Find all event data that is within the range along the x-axis.\n */\n public findAllWithinRange(x1: number, x2: number, reverse = false) {\n const _ = Array.from(this.data);\n if (reverse) _.reverse();\n return _.filter(d => this.isWithinRange(d, x1, x2));\n }\n\n /**\n * Test if a given object is within an 1D range.\n */\n public isWithinRange(data: MouseEventData, x1: number, x2: number) {\n switch (data.type) {\n case 'point':\n return isCircleWithinRange([x1, x2], data.polygon[0], data.polygon[2]);\n case 'line':\n case 'polygon':\n default:\n return isAllPointsWithinRange([x1, x2], data.polygon);\n }\n }\n}\n","/*\n * This code is based on the following repo:\n * https://github.com/higlass/higlass-pileup\n */\nimport { spawn } from 'threads';\nimport Worker from './bam-worker.ts?worker&inline';\n\nimport type { BamData, Assembly } from '@gosling-lang/gosling-schema';\nimport type { ModuleThread } from 'threads';\nimport type { WorkerApi, TilesetInfo, Tiles, Segment, Junction, SegmentWithMate } from './bam-worker';\nimport { computeChromSizes } from '../../core/utils/assembly';\nimport type { TabularDataFetcher } from '../utils';\n\nconst DEBOUNCE_TIME = 200;\n\ntype InferTileType = Config['extractJunction'] extends true\n ? Junction\n : Config['loadMates'] extends true\n ? SegmentWithMate\n : Segment;\n\nclass BamDataFetcher implements TabularDataFetcher> {\n static config = { type: 'bam' };\n dataConfig = {}; // required for higlass\n uid: string;\n fetchTimeout?: ReturnType;\n toFetch: Set;\n\n MAX_TILE_WIDTH = 2e4 as const;\n\n private worker: Promise>;\n\n // This is set by us but is accessed in `fetchTilesDebounced`\n track?: {\n fetching: { delete(id: string): void };\n };\n\n constructor(HGC: import('@higlass/types').HGC, config: Config & { assembly: Assembly }) {\n this.uid = HGC.libraries.slugid.nice();\n this.toFetch = new Set();\n const { url, indexUrl, assembly, ...options } = config;\n this.worker = spawn(new Worker()).then(async worker => {\n const chromSizes = Object.entries(computeChromSizes(assembly).size);\n await worker.init(this.uid, { url, indexUrl }, chromSizes, options);\n return worker;\n });\n }\n\n /*\n * Collect Tileset Information, such as tile size and genomic positions\n */\n async tilesetInfo(callback: (info: TilesetInfo) => void) {\n (await this.worker).tilesetInfo(this.uid).then(callback);\n }\n\n fetchTilesDebounced(receivedTiles: (tiles: Tiles) => void, tileIds: string[]) {\n const { toFetch } = this;\n\n const thisZoomLevel = tileIds[0].split('.')[0]; // Example of tileIds: [\"3.0\", \"3.1\"]\n const toFetchZoomLevel = toFetch.size ? [...toFetch][0].split('.')[0] : null;\n\n if (thisZoomLevel !== toFetchZoomLevel) {\n for (const tileId of this.toFetch) {\n this.track?.fetching.delete(tileId);\n }\n this.toFetch.clear();\n }\n\n tileIds.forEach(x => this.toFetch.add(x));\n\n if (this.fetchTimeout) {\n clearTimeout(this.fetchTimeout);\n }\n\n this.fetchTimeout = setTimeout(() => {\n this.sendFetch(receivedTiles, [...this.toFetch]);\n this.toFetch.clear();\n }, DEBOUNCE_TIME);\n }\n\n async sendFetch(receivedTiles: (tiles: Tiles) => void, tileIds: string[]) {\n (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles);\n }\n\n async getTabularData(tileIds: string[]): Promise[]> {\n const buf = await (await this.worker).getTabularData(this.uid, tileIds);\n return JSON.parse(new TextDecoder().decode(buf));\n }\n}\n\nexport default BamDataFetcher;\n","/*\n * This document is heavily based on the following repo by @alexander-veit:\n * https://github.com/dbmi-bgm/higlass-sv/blob/main/src/sv-fetcher.js\n */\nimport { spawn } from 'threads';\nimport Worker from './vcf-worker.ts?worker&inline';\n\nimport { computeChromSizes } from '../../core/utils/assembly';\n\nimport type { ModuleThread } from 'threads';\nimport type { Assembly, VcfData } from '@gosling-lang/gosling-schema';\nimport type { WorkerApi, TilesetInfo } from './vcf-worker';\nimport type { TabularDataFetcher } from '../utils';\nimport { getSubstitutionType, getMutationType } from './utils';\n\nconst DEBOUNCE_TIME = 200;\n\n// const MAX_TILES = 20;\n// https://github.com/GMOD/vcf-js/blob/c4a9cbad3ba5a3f0d1c817d685213f111bf9de9b/src/parse.ts#L284-L291\nexport type VcfRecord = {\n CHROM: string;\n POS: number;\n ID: null | string[];\n REF: string;\n ALT: null | string[];\n QUAL: null | number;\n FILTER: null | string;\n INFO: Record;\n};\n\nexport type VcfTile = Omit & {\n ALT: string | undefined;\n MUTTYPE: ReturnType;\n SUBTYPE: ReturnType;\n INFO: string;\n ORIGINALPOS: number;\n POS: number;\n POSEND: number;\n DISTPREV: number | null;\n DISTPREVLOGE: number | null;\n} & { [infoKey: string]: any };\n\nclass VcfDataFetcher implements TabularDataFetcher {\n static config = { type: 'vcf' };\n dataConfig = {}; // required for higlass\n uid: string;\n prevRequestTime: number;\n track?: any;\n\n private toFetch: Set;\n private fetchTimeout?: ReturnType;\n private worker: Promise>;\n\n constructor(HGC: import('@higlass/types').HGC, config: VcfData & { assembly: Assembly }) {\n this.uid = HGC.libraries.slugid.nice();\n this.prevRequestTime = 0;\n this.toFetch = new Set();\n const { url, indexUrl, assembly, ...options } = config;\n this.worker = spawn(new Worker()).then(async worker => {\n const chromSizes = Object.entries(computeChromSizes(assembly).size);\n await worker.init(this.uid, { url, indexUrl }, chromSizes, options);\n return worker;\n });\n }\n\n /*\n * Collect Tileset Information, such as tile size and genomic positions\n */\n async tilesetInfo(callback: (info: TilesetInfo) => void) {\n (await this.worker).tilesetInfo(this.uid).then(callback);\n }\n\n fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n this.track.drawLoadingCue();\n\n tileIds.forEach(tileId => this.toFetch.add(tileId));\n\n if (this.fetchTimeout) {\n clearTimeout(this.fetchTimeout);\n }\n\n this.fetchTimeout = setTimeout(() => {\n this.sendFetch(receivedTiles, [...this.toFetch]);\n this.toFetch.clear();\n }, DEBOUNCE_TIME);\n }\n\n async sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles);\n }\n\n async getTabularData(tileIds: string[]): Promise {\n const buf = await (await this.worker).getTabularData(this.uid, tileIds);\n return JSON.parse(new TextDecoder().decode(buf));\n }\n}\n\nexport default VcfDataFetcher;\n","const BigInt32 = BigInt(32);\nexport function getBigInt64(dataView, byteOffset, littleEndian) {\n const littleEndianMask = Number(!!littleEndian);\n const bigEndianMask = Number(!littleEndian);\n return ((BigInt(dataView.getInt32(byteOffset, littleEndian) * bigEndianMask +\n dataView.getInt32(byteOffset + 4, littleEndian) * littleEndianMask) <<\n BigInt32) |\n BigInt(dataView.getUint32(byteOffset, littleEndian) * littleEndianMask +\n dataView.getUint32(byteOffset + 4, littleEndian) * bigEndianMask));\n}\nexport function getBigUint64(dataView, byteOffset, littleEndian) {\n const a = dataView.getUint32(byteOffset, littleEndian);\n const b = dataView.getUint32(byteOffset + 4, littleEndian);\n const littleEndianMask = Number(!!littleEndian);\n const bigEndianMask = Number(!littleEndian);\n // This branch-less optimization is 77x faster than normal ternary operator.\n // and only 3% slower than native implementation\n // https://jsbench.me/p8kyhg1eqv/1\n return ((BigInt(a * bigEndianMask + b * littleEndianMask) << BigInt32) |\n BigInt(a * littleEndianMask + b * bigEndianMask));\n}\nexport function setBigInt64(dataView, byteOffset, value, littleEndian) {\n const hi = Number(value >> BigInt32);\n const lo = Number(value & BigInt(0xffffffff));\n if (littleEndian) {\n dataView.setInt32(byteOffset + 4, hi, littleEndian);\n dataView.setUint32(byteOffset, lo, littleEndian);\n }\n else {\n dataView.setInt32(byteOffset, hi, littleEndian);\n dataView.setUint32(byteOffset + 4, lo, littleEndian);\n }\n}\nexport function setBigUint64(dataView, byteOffset, value, littleEndian) {\n const hi = Number(value >> BigInt32);\n const lo = Number(value & BigInt(0xffffffff));\n if (littleEndian) {\n dataView.setUint32(byteOffset + 4, hi, littleEndian);\n dataView.setUint32(byteOffset, lo, littleEndian);\n }\n else {\n dataView.setUint32(byteOffset, hi, littleEndian);\n dataView.setUint32(byteOffset + 4, lo, littleEndian);\n }\n}\n//# sourceMappingURL=pure.js.map","import { getBigInt64, getBigUint64, setBigInt64, setBigUint64 } from './pure';\nif (!('getBigInt64' in DataView)) {\n DataView.prototype.getBigInt64 = function (byteOffset, littleEndian) {\n return getBigInt64(this, byteOffset, littleEndian);\n };\n}\nif (!('getBigUint64' in DataView)) {\n DataView.prototype.getBigUint64 = function (byteOffset, littleEndian) {\n return getBigUint64(this, byteOffset, littleEndian);\n };\n}\nif (!('setBigInt64' in DataView)) {\n DataView.prototype.setBigInt64 = function (byteOffset, value, littleEndian) {\n setBigInt64(this, byteOffset, value, littleEndian);\n };\n}\nif (!('setBigUint64' in DataView)) {\n DataView.prototype.setBigUint64 = function (byteOffset, value, littleEndian) {\n setBigUint64(this, byteOffset, value, littleEndian);\n };\n}\n//# sourceMappingURL=polyfill.js.map","class Context {\n constructor(importPath, useContextVariables) {\n this.code = \"\";\n this.scopes = [[\"vars\"]];\n this.bitFields = [];\n this.tmpVariableCount = 0;\n this.references = new Map();\n this.imports = [];\n this.reverseImports = new Map();\n this.useContextVariables = false;\n this.importPath = importPath;\n this.useContextVariables = useContextVariables;\n }\n generateVariable(name) {\n const scopes = [...this.scopes[this.scopes.length - 1]];\n if (name) {\n scopes.push(name);\n }\n return scopes.join(\".\");\n }\n generateOption(val) {\n switch (typeof val) {\n case \"number\":\n return val.toString();\n case \"string\":\n return this.generateVariable(val);\n case \"function\":\n return `${this.addImport(val)}.call(${this.generateVariable()}, vars)`;\n }\n }\n generateError(err) {\n this.pushCode(`throw new Error(${err});`);\n }\n generateTmpVariable() {\n return \"$tmp\" + this.tmpVariableCount++;\n }\n pushCode(code) {\n this.code += code + \"\\n\";\n }\n pushPath(name) {\n if (name) {\n this.scopes[this.scopes.length - 1].push(name);\n }\n }\n popPath(name) {\n if (name) {\n this.scopes[this.scopes.length - 1].pop();\n }\n }\n pushScope(name) {\n this.scopes.push([name]);\n }\n popScope() {\n this.scopes.pop();\n }\n addImport(im) {\n if (!this.importPath)\n return `(${im})`;\n let id = this.reverseImports.get(im);\n if (!id) {\n id = this.imports.push(im) - 1;\n this.reverseImports.set(im, id);\n }\n return `${this.importPath}[${id}]`;\n }\n addReference(alias) {\n if (!this.references.has(alias)) {\n this.references.set(alias, { resolved: false, requested: false });\n }\n }\n markResolved(alias) {\n const reference = this.references.get(alias);\n if (reference) {\n reference.resolved = true;\n }\n }\n markRequested(aliasList) {\n aliasList.forEach((alias) => {\n const reference = this.references.get(alias);\n if (reference) {\n reference.requested = true;\n }\n });\n }\n getUnresolvedReferences() {\n return Array.from(this.references)\n .filter(([_, reference]) => !reference.resolved && !reference.requested)\n .map(([alias, _]) => alias);\n }\n}\nconst aliasRegistry = new Map();\nconst FUNCTION_PREFIX = \"___parser_\";\nconst PRIMITIVE_SIZES = {\n uint8: 1,\n uint16le: 2,\n uint16be: 2,\n uint32le: 4,\n uint32be: 4,\n int8: 1,\n int16le: 2,\n int16be: 2,\n int32le: 4,\n int32be: 4,\n int64be: 8,\n int64le: 8,\n uint64be: 8,\n uint64le: 8,\n floatle: 4,\n floatbe: 4,\n doublele: 8,\n doublebe: 8,\n};\nconst PRIMITIVE_NAMES = {\n uint8: \"Uint8\",\n uint16le: \"Uint16\",\n uint16be: \"Uint16\",\n uint32le: \"Uint32\",\n uint32be: \"Uint32\",\n int8: \"Int8\",\n int16le: \"Int16\",\n int16be: \"Int16\",\n int32le: \"Int32\",\n int32be: \"Int32\",\n int64be: \"BigInt64\",\n int64le: \"BigInt64\",\n uint64be: \"BigUint64\",\n uint64le: \"BigUint64\",\n floatle: \"Float32\",\n floatbe: \"Float32\",\n doublele: \"Float64\",\n doublebe: \"Float64\",\n};\nconst PRIMITIVE_LITTLE_ENDIANS = {\n uint8: false,\n uint16le: true,\n uint16be: false,\n uint32le: true,\n uint32be: false,\n int8: false,\n int16le: true,\n int16be: false,\n int32le: true,\n int32be: false,\n int64be: false,\n int64le: true,\n uint64be: false,\n uint64le: true,\n floatle: true,\n floatbe: false,\n doublele: true,\n doublebe: false,\n};\nexport class Parser {\n constructor() {\n this.varName = \"\";\n this.type = \"\";\n this.options = {};\n this.endian = \"be\";\n this.useContextVariables = false;\n }\n static start() {\n return new Parser();\n }\n primitiveGenerateN(type, ctx) {\n const typeName = PRIMITIVE_NAMES[type];\n const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type];\n ctx.pushCode(`${ctx.generateVariable(this.varName)} = dataView.get${typeName}(offset, ${littleEndian});`);\n ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`);\n }\n primitiveN(type, varName, options) {\n return this.setNextParser(type, varName, options);\n }\n useThisEndian(type) {\n return (type + this.endian.toLowerCase());\n }\n uint8(varName, options = {}) {\n return this.primitiveN(\"uint8\", varName, options);\n }\n uint16(varName, options = {}) {\n return this.primitiveN(this.useThisEndian(\"uint16\"), varName, options);\n }\n uint16le(varName, options = {}) {\n return this.primitiveN(\"uint16le\", varName, options);\n }\n uint16be(varName, options = {}) {\n return this.primitiveN(\"uint16be\", varName, options);\n }\n uint32(varName, options = {}) {\n return this.primitiveN(this.useThisEndian(\"uint32\"), varName, options);\n }\n uint32le(varName, options = {}) {\n return this.primitiveN(\"uint32le\", varName, options);\n }\n uint32be(varName, options = {}) {\n return this.primitiveN(\"uint32be\", varName, options);\n }\n int8(varName, options = {}) {\n return this.primitiveN(\"int8\", varName, options);\n }\n int16(varName, options = {}) {\n return this.primitiveN(this.useThisEndian(\"int16\"), varName, options);\n }\n int16le(varName, options = {}) {\n return this.primitiveN(\"int16le\", varName, options);\n }\n int16be(varName, options = {}) {\n return this.primitiveN(\"int16be\", varName, options);\n }\n int32(varName, options = {}) {\n return this.primitiveN(this.useThisEndian(\"int32\"), varName, options);\n }\n int32le(varName, options = {}) {\n return this.primitiveN(\"int32le\", varName, options);\n }\n int32be(varName, options = {}) {\n return this.primitiveN(\"int32be\", varName, options);\n }\n bigIntVersionCheck() {\n if (!DataView.prototype.getBigInt64)\n throw new Error(\"BigInt64 is unsupported on this runtime\");\n }\n int64(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(this.useThisEndian(\"int64\"), varName, options);\n }\n int64be(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(\"int64be\", varName, options);\n }\n int64le(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(\"int64le\", varName, options);\n }\n uint64(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(this.useThisEndian(\"uint64\"), varName, options);\n }\n uint64be(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(\"uint64be\", varName, options);\n }\n uint64le(varName, options = {}) {\n this.bigIntVersionCheck();\n return this.primitiveN(\"uint64le\", varName, options);\n }\n floatle(varName, options = {}) {\n return this.primitiveN(\"floatle\", varName, options);\n }\n floatbe(varName, options = {}) {\n return this.primitiveN(\"floatbe\", varName, options);\n }\n doublele(varName, options = {}) {\n return this.primitiveN(\"doublele\", varName, options);\n }\n doublebe(varName, options = {}) {\n return this.primitiveN(\"doublebe\", varName, options);\n }\n bitN(size, varName, options) {\n options.length = size;\n return this.setNextParser(\"bit\", varName, options);\n }\n bit1(varName, options = {}) {\n return this.bitN(1, varName, options);\n }\n bit2(varName, options = {}) {\n return this.bitN(2, varName, options);\n }\n bit3(varName, options = {}) {\n return this.bitN(3, varName, options);\n }\n bit4(varName, options = {}) {\n return this.bitN(4, varName, options);\n }\n bit5(varName, options = {}) {\n return this.bitN(5, varName, options);\n }\n bit6(varName, options = {}) {\n return this.bitN(6, varName, options);\n }\n bit7(varName, options = {}) {\n return this.bitN(7, varName, options);\n }\n bit8(varName, options = {}) {\n return this.bitN(8, varName, options);\n }\n bit9(varName, options = {}) {\n return this.bitN(9, varName, options);\n }\n bit10(varName, options = {}) {\n return this.bitN(10, varName, options);\n }\n bit11(varName, options = {}) {\n return this.bitN(11, varName, options);\n }\n bit12(varName, options = {}) {\n return this.bitN(12, varName, options);\n }\n bit13(varName, options = {}) {\n return this.bitN(13, varName, options);\n }\n bit14(varName, options = {}) {\n return this.bitN(14, varName, options);\n }\n bit15(varName, options = {}) {\n return this.bitN(15, varName, options);\n }\n bit16(varName, options = {}) {\n return this.bitN(16, varName, options);\n }\n bit17(varName, options = {}) {\n return this.bitN(17, varName, options);\n }\n bit18(varName, options = {}) {\n return this.bitN(18, varName, options);\n }\n bit19(varName, options = {}) {\n return this.bitN(19, varName, options);\n }\n bit20(varName, options = {}) {\n return this.bitN(20, varName, options);\n }\n bit21(varName, options = {}) {\n return this.bitN(21, varName, options);\n }\n bit22(varName, options = {}) {\n return this.bitN(22, varName, options);\n }\n bit23(varName, options = {}) {\n return this.bitN(23, varName, options);\n }\n bit24(varName, options = {}) {\n return this.bitN(24, varName, options);\n }\n bit25(varName, options = {}) {\n return this.bitN(25, varName, options);\n }\n bit26(varName, options = {}) {\n return this.bitN(26, varName, options);\n }\n bit27(varName, options = {}) {\n return this.bitN(27, varName, options);\n }\n bit28(varName, options = {}) {\n return this.bitN(28, varName, options);\n }\n bit29(varName, options = {}) {\n return this.bitN(29, varName, options);\n }\n bit30(varName, options = {}) {\n return this.bitN(30, varName, options);\n }\n bit31(varName, options = {}) {\n return this.bitN(31, varName, options);\n }\n bit32(varName, options = {}) {\n return this.bitN(32, varName, options);\n }\n namely(alias) {\n aliasRegistry.set(alias, this);\n this.alias = alias;\n return this;\n }\n skip(length, options = {}) {\n return this.seek(length, options);\n }\n seek(relOffset, options = {}) {\n if (options.assert) {\n throw new Error(\"assert option on seek is not allowed.\");\n }\n return this.setNextParser(\"seek\", \"\", { length: relOffset });\n }\n string(varName, options) {\n if (!options.zeroTerminated && !options.length && !options.greedy) {\n throw new Error(\"One of length, zeroTerminated, or greedy must be defined for string.\");\n }\n if ((options.zeroTerminated || options.length) && options.greedy) {\n throw new Error(\"greedy is mutually exclusive with length and zeroTerminated for string.\");\n }\n if (options.stripNull && !(options.length || options.greedy)) {\n throw new Error(\"length or greedy must be defined if stripNull is enabled.\");\n }\n options.encoding = options.encoding || \"utf8\";\n return this.setNextParser(\"string\", varName, options);\n }\n buffer(varName, options) {\n if (!options.length && !options.readUntil) {\n throw new Error(\"length or readUntil must be defined for buffer.\");\n }\n return this.setNextParser(\"buffer\", varName, options);\n }\n wrapped(varName, options) {\n if (typeof options !== \"object\" && typeof varName === \"object\") {\n options = varName;\n varName = \"\";\n }\n if (!options || !options.wrapper || !options.type) {\n throw new Error(\"Both wrapper and type must be defined for wrapped.\");\n }\n if (!options.length && !options.readUntil) {\n throw new Error(\"length or readUntil must be defined for wrapped.\");\n }\n return this.setNextParser(\"wrapper\", varName, options);\n }\n array(varName, options) {\n if (!options.readUntil && !options.length && !options.lengthInBytes) {\n throw new Error(\"One of readUntil, length and lengthInBytes must be defined for array.\");\n }\n if (!options.type) {\n throw new Error(\"type is required for array.\");\n }\n if (typeof options.type === \"string\" &&\n !aliasRegistry.has(options.type) &&\n !(options.type in PRIMITIVE_SIZES)) {\n throw new Error(`Array element type \"${options.type}\" is unkown.`);\n }\n return this.setNextParser(\"array\", varName, options);\n }\n choice(varName, options) {\n if (typeof options !== \"object\" && typeof varName === \"object\") {\n options = varName;\n varName = \"\";\n }\n if (!options) {\n throw new Error(\"tag and choices are are required for choice.\");\n }\n if (!options.tag) {\n throw new Error(\"tag is requird for choice.\");\n }\n if (!options.choices) {\n throw new Error(\"choices is required for choice.\");\n }\n for (const keyString in options.choices) {\n const key = parseInt(keyString, 10);\n const value = options.choices[key];\n if (isNaN(key)) {\n throw new Error(`Choice key \"${keyString}\" is not a number.`);\n }\n if (typeof value === \"string\" &&\n !aliasRegistry.has(value) &&\n !(value in PRIMITIVE_SIZES)) {\n throw new Error(`Choice type \"${value}\" is unkown.`);\n }\n }\n return this.setNextParser(\"choice\", varName, options);\n }\n nest(varName, options) {\n if (typeof options !== \"object\" && typeof varName === \"object\") {\n options = varName;\n varName = \"\";\n }\n if (!options || !options.type) {\n throw new Error(\"type is required for nest.\");\n }\n if (!(options.type instanceof Parser) && !aliasRegistry.has(options.type)) {\n throw new Error(\"type must be a known parser name or a Parser object.\");\n }\n if (!(options.type instanceof Parser) && !varName) {\n throw new Error(\"type must be a Parser object if the variable name is omitted.\");\n }\n return this.setNextParser(\"nest\", varName, options);\n }\n pointer(varName, options) {\n if (!options.offset) {\n throw new Error(\"offset is required for pointer.\");\n }\n if (!options.type) {\n throw new Error(\"type is required for pointer.\");\n }\n if (typeof options.type === \"string\" &&\n !(options.type in PRIMITIVE_SIZES) &&\n !aliasRegistry.has(options.type)) {\n throw new Error(`Pointer type \"${options.type}\" is unkown.`);\n }\n return this.setNextParser(\"pointer\", varName, options);\n }\n saveOffset(varName, options = {}) {\n return this.setNextParser(\"saveOffset\", varName, options);\n }\n endianness(endianness) {\n switch (endianness.toLowerCase()) {\n case \"little\":\n this.endian = \"le\";\n break;\n case \"big\":\n this.endian = \"be\";\n break;\n default:\n throw new Error('endianness must be one of \"little\" or \"big\"');\n }\n return this;\n }\n endianess(endianess) {\n return this.endianness(endianess);\n }\n useContextVars(useContextVariables = true) {\n this.useContextVariables = useContextVariables;\n return this;\n }\n create(constructorFn) {\n if (!(constructorFn instanceof Function)) {\n throw new Error(\"Constructor must be a Function object.\");\n }\n this.constructorFn = constructorFn;\n return this;\n }\n getContext(importPath) {\n const ctx = new Context(importPath, this.useContextVariables);\n ctx.pushCode(\"var dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);\");\n if (!this.alias) {\n this.addRawCode(ctx);\n }\n else {\n this.addAliasedCode(ctx);\n ctx.pushCode(`return ${FUNCTION_PREFIX + this.alias}(0).result;`);\n }\n return ctx;\n }\n getCode() {\n const importPath = \"imports\";\n return this.getContext(importPath).code;\n }\n addRawCode(ctx) {\n ctx.pushCode(\"var offset = 0;\");\n ctx.pushCode(`var vars = ${this.constructorFn ? \"new constructorFn()\" : \"{}\"};`);\n ctx.pushCode(\"vars.$parent = null;\");\n ctx.pushCode(\"vars.$root = vars;\");\n this.generate(ctx);\n this.resolveReferences(ctx);\n ctx.pushCode(\"delete vars.$parent;\");\n ctx.pushCode(\"delete vars.$root;\");\n ctx.pushCode(\"return vars;\");\n }\n addAliasedCode(ctx) {\n ctx.pushCode(`function ${FUNCTION_PREFIX + this.alias}(offset, context) {`);\n ctx.pushCode(`var vars = ${this.constructorFn ? \"new constructorFn()\" : \"{}\"};`);\n ctx.pushCode(\"var ctx = Object.assign({$parent: null, $root: vars}, context || {});\");\n ctx.pushCode(`vars = Object.assign(vars, ctx);`);\n this.generate(ctx);\n ctx.markResolved(this.alias);\n this.resolveReferences(ctx);\n ctx.pushCode(\"Object.keys(ctx).forEach(function (item) { delete vars[item]; });\");\n ctx.pushCode(\"return { offset: offset, result: vars };\");\n ctx.pushCode(\"}\");\n return ctx;\n }\n resolveReferences(ctx) {\n const references = ctx.getUnresolvedReferences();\n ctx.markRequested(references);\n references.forEach((alias) => {\n var _a;\n (_a = aliasRegistry.get(alias)) === null || _a === void 0 ? void 0 : _a.addAliasedCode(ctx);\n });\n }\n compile() {\n const importPath = \"imports\";\n const ctx = this.getContext(importPath);\n this.compiled = new Function(importPath, \"TextDecoder\", `return function (buffer, constructorFn) { ${ctx.code} };`)(ctx.imports, TextDecoder);\n }\n sizeOf() {\n let size = NaN;\n if (Object.keys(PRIMITIVE_SIZES).indexOf(this.type) >= 0) {\n size = PRIMITIVE_SIZES[this.type];\n // if this is a fixed length string\n }\n else if (this.type === \"string\" &&\n typeof this.options.length === \"number\") {\n size = this.options.length;\n // if this is a fixed length buffer\n }\n else if (this.type === \"buffer\" &&\n typeof this.options.length === \"number\") {\n size = this.options.length;\n // if this is a fixed length array\n }\n else if (this.type === \"array\" &&\n typeof this.options.length === \"number\") {\n let elementSize = NaN;\n if (typeof this.options.type === \"string\") {\n elementSize = PRIMITIVE_SIZES[this.options.type];\n }\n else if (this.options.type instanceof Parser) {\n elementSize = this.options.type.sizeOf();\n }\n size = this.options.length * elementSize;\n // if this a skip\n }\n else if (this.type === \"seek\") {\n size = this.options.length;\n // if this is a nested parser\n }\n else if (this.type === \"nest\") {\n size = this.options.type.sizeOf();\n }\n else if (!this.type) {\n size = 0;\n }\n if (this.next) {\n size += this.next.sizeOf();\n }\n return size;\n }\n // Follow the parser chain till the root and start parsing from there\n parse(buffer) {\n if (!this.compiled) {\n this.compile();\n }\n return this.compiled(buffer, this.constructorFn);\n }\n setNextParser(type, varName, options) {\n const parser = new Parser();\n parser.type = type;\n parser.varName = varName;\n parser.options = options;\n parser.endian = this.endian;\n if (this.head) {\n this.head.next = parser;\n }\n else {\n this.next = parser;\n }\n this.head = parser;\n return this;\n }\n // Call code generator for this parser\n generate(ctx) {\n if (this.type) {\n switch (this.type) {\n case \"uint8\":\n case \"uint16le\":\n case \"uint16be\":\n case \"uint32le\":\n case \"uint32be\":\n case \"int8\":\n case \"int16le\":\n case \"int16be\":\n case \"int32le\":\n case \"int32be\":\n case \"int64be\":\n case \"int64le\":\n case \"uint64be\":\n case \"uint64le\":\n case \"floatle\":\n case \"floatbe\":\n case \"doublele\":\n case \"doublebe\":\n this.primitiveGenerateN(this.type, ctx);\n break;\n case \"bit\":\n this.generateBit(ctx);\n break;\n case \"string\":\n this.generateString(ctx);\n break;\n case \"buffer\":\n this.generateBuffer(ctx);\n break;\n case \"seek\":\n this.generateSeek(ctx);\n break;\n case \"nest\":\n this.generateNest(ctx);\n break;\n case \"array\":\n this.generateArray(ctx);\n break;\n case \"choice\":\n this.generateChoice(ctx);\n break;\n case \"pointer\":\n this.generatePointer(ctx);\n break;\n case \"saveOffset\":\n this.generateSaveOffset(ctx);\n break;\n case \"wrapper\":\n this.generateWrapper(ctx);\n break;\n }\n if (this.type !== \"bit\")\n this.generateAssert(ctx);\n }\n const varName = ctx.generateVariable(this.varName);\n if (this.options.formatter && this.type !== \"bit\") {\n this.generateFormatter(ctx, varName, this.options.formatter);\n }\n return this.generateNext(ctx);\n }\n generateAssert(ctx) {\n if (!this.options.assert) {\n return;\n }\n const varName = ctx.generateVariable(this.varName);\n switch (typeof this.options.assert) {\n case \"function\":\n {\n const func = ctx.addImport(this.options.assert);\n ctx.pushCode(`if (!${func}.call(vars, ${varName})) {`);\n }\n break;\n case \"number\":\n ctx.pushCode(`if (${this.options.assert} !== ${varName}) {`);\n break;\n case \"string\":\n ctx.pushCode(`if (${JSON.stringify(this.options.assert)} !== ${varName}) {`);\n break;\n default:\n throw new Error(\"assert option must be a string, number or a function.\");\n }\n ctx.generateError(`\"Assertion error: ${varName} is \" + ${JSON.stringify(this.options.assert.toString())}`);\n ctx.pushCode(\"}\");\n }\n // Recursively call code generators and append results\n generateNext(ctx) {\n if (this.next) {\n ctx = this.next.generate(ctx);\n }\n return ctx;\n }\n generateBit(ctx) {\n // TODO find better method to handle nested bit fields\n const parser = JSON.parse(JSON.stringify(this));\n parser.options = this.options;\n parser.generateAssert = this.generateAssert.bind(this);\n parser.generateFormatter = this.generateFormatter.bind(this);\n parser.varName = ctx.generateVariable(parser.varName);\n ctx.bitFields.push(parser);\n if (!this.next ||\n (this.next && [\"bit\", \"nest\"].indexOf(this.next.type) < 0)) {\n const val = ctx.generateTmpVariable();\n ctx.pushCode(`var ${val} = 0;`);\n const getMaxBits = (from = 0) => {\n let sum = 0;\n for (let i = from; i < ctx.bitFields.length; i++) {\n const length = ctx.bitFields[i].options.length;\n if (sum + length > 32)\n break;\n sum += length;\n }\n return sum;\n };\n const getBytes = (sum) => {\n if (sum <= 8) {\n ctx.pushCode(`${val} = dataView.getUint8(offset);`);\n sum = 8;\n }\n else if (sum <= 16) {\n ctx.pushCode(`${val} = dataView.getUint16(offset);`);\n sum = 16;\n }\n else if (sum <= 24) {\n ctx.pushCode(`${val} = (dataView.getUint16(offset) << 8) | dataView.getUint8(offset + 2);`);\n sum = 24;\n }\n else {\n ctx.pushCode(`${val} = dataView.getUint32(offset);`);\n sum = 32;\n }\n ctx.pushCode(`offset += ${sum / 8};`);\n return sum;\n };\n let bitOffset = 0;\n const isBigEndian = this.endian === \"be\";\n let sum = 0;\n let rem = 0;\n ctx.bitFields.forEach((parser, i) => {\n let length = parser.options.length;\n if (length > rem) {\n if (rem) {\n const mask = -1 >>> (32 - rem);\n ctx.pushCode(`${parser.varName} = (${val} & 0x${mask.toString(16)}) << ${length - rem};`);\n length -= rem;\n }\n bitOffset = 0;\n rem = sum = getBytes(getMaxBits(i) - rem);\n }\n const offset = isBigEndian ? sum - bitOffset - length : bitOffset;\n const mask = -1 >>> (32 - length);\n ctx.pushCode(`${parser.varName} ${length < parser.options.length ? \"|=\" : \"=\"} ${val} >> ${offset} & 0x${mask.toString(16)};`);\n // Ensure value is unsigned\n if (parser.options.length === 32) {\n ctx.pushCode(`${parser.varName} >>>= 0`);\n }\n if (parser.options.assert) {\n parser.generateAssert(ctx);\n }\n if (parser.options.formatter) {\n parser.generateFormatter(ctx, parser.varName, parser.options.formatter);\n }\n bitOffset += length;\n rem -= length;\n });\n ctx.bitFields = [];\n }\n }\n generateSeek(ctx) {\n const length = ctx.generateOption(this.options.length);\n ctx.pushCode(`offset += ${length};`);\n }\n generateString(ctx) {\n const name = ctx.generateVariable(this.varName);\n const start = ctx.generateTmpVariable();\n const encoding = this.options.encoding;\n const isHex = encoding.toLowerCase() === \"hex\";\n const toHex = 'b => b.toString(16).padStart(2, \"0\")';\n if (this.options.length && this.options.zeroTerminated) {\n const len = this.options.length;\n ctx.pushCode(`var ${start} = offset;`);\n ctx.pushCode(`while(dataView.getUint8(offset++) !== 0 && offset - ${start} < ${len});`);\n const end = `offset - ${start} < ${len} ? offset - 1 : offset`;\n ctx.pushCode(isHex\n ? `${name} = Array.from(buffer.subarray(${start}, ${end}), ${toHex}).join('');`\n : `${name} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, ${end}));`);\n }\n else if (this.options.length) {\n const len = ctx.generateOption(this.options.length);\n ctx.pushCode(isHex\n ? `${name} = Array.from(buffer.subarray(offset, offset + ${len}), ${toHex}).join('');`\n : `${name} = new TextDecoder('${encoding}').decode(buffer.subarray(offset, offset + ${len}));`);\n ctx.pushCode(`offset += ${len};`);\n }\n else if (this.options.zeroTerminated) {\n ctx.pushCode(`var ${start} = offset;`);\n ctx.pushCode(\"while(dataView.getUint8(offset++) !== 0);\");\n ctx.pushCode(isHex\n ? `${name} = Array.from(buffer.subarray(${start}, offset - 1), ${toHex}).join('');`\n : `${name} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, offset - 1));`);\n }\n else if (this.options.greedy) {\n ctx.pushCode(`var ${start} = offset;`);\n ctx.pushCode(\"while(buffer.length > offset++);\");\n ctx.pushCode(isHex\n ? `${name} = Array.from(buffer.subarray(${start}, offset), ${toHex}).join('');`\n : `${name} = new TextDecoder('${encoding}').decode(buffer.subarray(${start}, offset));`);\n }\n if (this.options.stripNull) {\n ctx.pushCode(`${name} = ${name}.replace(/\\\\x00+$/g, '')`);\n }\n }\n generateBuffer(ctx) {\n const varName = ctx.generateVariable(this.varName);\n if (typeof this.options.readUntil === \"function\") {\n const pred = this.options.readUntil;\n const start = ctx.generateTmpVariable();\n const cur = ctx.generateTmpVariable();\n ctx.pushCode(`var ${start} = offset;`);\n ctx.pushCode(`var ${cur} = 0;`);\n ctx.pushCode(`while (offset < buffer.length) {`);\n ctx.pushCode(`${cur} = dataView.getUint8(offset);`);\n const func = ctx.addImport(pred);\n ctx.pushCode(`if (${func}.call(${ctx.generateVariable()}, ${cur}, buffer.subarray(offset))) break;`);\n ctx.pushCode(`offset += 1;`);\n ctx.pushCode(`}`);\n ctx.pushCode(`${varName} = buffer.subarray(${start}, offset);`);\n }\n else if (this.options.readUntil === \"eof\") {\n ctx.pushCode(`${varName} = buffer.subarray(offset);`);\n }\n else {\n const len = ctx.generateOption(this.options.length);\n ctx.pushCode(`${varName} = buffer.subarray(offset, offset + ${len});`);\n ctx.pushCode(`offset += ${len};`);\n }\n if (this.options.clone) {\n ctx.pushCode(`${varName} = buffer.constructor.from(${varName});`);\n }\n }\n generateArray(ctx) {\n const length = ctx.generateOption(this.options.length);\n const lengthInBytes = ctx.generateOption(this.options.lengthInBytes);\n const type = this.options.type;\n const counter = ctx.generateTmpVariable();\n const lhs = ctx.generateVariable(this.varName);\n const item = ctx.generateTmpVariable();\n const key = this.options.key;\n const isHash = typeof key === \"string\";\n if (isHash) {\n ctx.pushCode(`${lhs} = {};`);\n }\n else {\n ctx.pushCode(`${lhs} = [];`);\n }\n if (typeof this.options.readUntil === \"function\") {\n ctx.pushCode(\"do {\");\n }\n else if (this.options.readUntil === \"eof\") {\n ctx.pushCode(`for (var ${counter} = 0; offset < buffer.length; ${counter}++) {`);\n }\n else if (lengthInBytes !== undefined) {\n ctx.pushCode(`for (var ${counter} = offset + ${lengthInBytes}; offset < ${counter}; ) {`);\n }\n else {\n ctx.pushCode(`for (var ${counter} = ${length}; ${counter} > 0; ${counter}--) {`);\n }\n if (typeof type === \"string\") {\n if (!aliasRegistry.get(type)) {\n const typeName = PRIMITIVE_NAMES[type];\n const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type];\n ctx.pushCode(`var ${item} = dataView.get${typeName}(offset, ${littleEndian});`);\n ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`);\n }\n else {\n const tempVar = ctx.generateTmpVariable();\n ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + type}(offset, {`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`$parent: ${parentVar},`);\n ctx.pushCode(`$root: ${parentVar}.$root,`);\n if (!this.options.readUntil && lengthInBytes === undefined) {\n ctx.pushCode(`$index: ${length} - ${counter},`);\n }\n }\n ctx.pushCode(`});`);\n ctx.pushCode(`var ${item} = ${tempVar}.result; offset = ${tempVar}.offset;`);\n if (type !== this.alias)\n ctx.addReference(type);\n }\n }\n else if (type instanceof Parser) {\n ctx.pushCode(`var ${item} = {};`);\n const parentVar = ctx.generateVariable();\n ctx.pushScope(item);\n if (ctx.useContextVariables) {\n ctx.pushCode(`${item}.$parent = ${parentVar};`);\n ctx.pushCode(`${item}.$root = ${parentVar}.$root;`);\n if (!this.options.readUntil && lengthInBytes === undefined) {\n ctx.pushCode(`${item}.$index = ${length} - ${counter};`);\n }\n }\n type.generate(ctx);\n if (ctx.useContextVariables) {\n ctx.pushCode(`delete ${item}.$parent;`);\n ctx.pushCode(`delete ${item}.$root;`);\n ctx.pushCode(`delete ${item}.$index;`);\n }\n ctx.popScope();\n }\n if (isHash) {\n ctx.pushCode(`${lhs}[${item}.${key}] = ${item};`);\n }\n else {\n ctx.pushCode(`${lhs}.push(${item});`);\n }\n ctx.pushCode(\"}\");\n if (typeof this.options.readUntil === \"function\") {\n const pred = this.options.readUntil;\n const func = ctx.addImport(pred);\n ctx.pushCode(`while (!${func}.call(${ctx.generateVariable()}, ${item}, buffer.subarray(offset)));`);\n }\n }\n generateChoiceCase(ctx, varName, type) {\n if (typeof type === \"string\") {\n const varName = ctx.generateVariable(this.varName);\n if (!aliasRegistry.has(type)) {\n const typeName = PRIMITIVE_NAMES[type];\n const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type];\n ctx.pushCode(`${varName} = dataView.get${typeName}(offset, ${littleEndian});`);\n ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]}`);\n }\n else {\n const tempVar = ctx.generateTmpVariable();\n ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + type}(offset, {`);\n if (ctx.useContextVariables) {\n ctx.pushCode(`$parent: ${varName}.$parent,`);\n ctx.pushCode(`$root: ${varName}.$root,`);\n }\n ctx.pushCode(`});`);\n ctx.pushCode(`${varName} = ${tempVar}.result; offset = ${tempVar}.offset;`);\n if (type !== this.alias)\n ctx.addReference(type);\n }\n }\n else if (type instanceof Parser) {\n ctx.pushPath(varName);\n type.generate(ctx);\n ctx.popPath(varName);\n }\n }\n generateChoice(ctx) {\n const tag = ctx.generateOption(this.options.tag);\n const nestVar = ctx.generateVariable(this.varName);\n if (this.varName) {\n ctx.pushCode(`${nestVar} = {};`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`${nestVar}.$parent = ${parentVar};`);\n ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`);\n }\n }\n ctx.pushCode(`switch(${tag}) {`);\n for (const tagString in this.options.choices) {\n const tag = parseInt(tagString, 10);\n const type = this.options.choices[tag];\n ctx.pushCode(`case ${tag}:`);\n this.generateChoiceCase(ctx, this.varName, type);\n ctx.pushCode(\"break;\");\n }\n ctx.pushCode(\"default:\");\n if (this.options.defaultChoice) {\n this.generateChoiceCase(ctx, this.varName, this.options.defaultChoice);\n }\n else {\n ctx.generateError(`\"Met undefined tag value \" + ${tag} + \" at choice\"`);\n }\n ctx.pushCode(\"}\");\n if (this.varName && ctx.useContextVariables) {\n ctx.pushCode(`delete ${nestVar}.$parent;`);\n ctx.pushCode(`delete ${nestVar}.$root;`);\n }\n }\n generateNest(ctx) {\n const nestVar = ctx.generateVariable(this.varName);\n if (this.options.type instanceof Parser) {\n if (this.varName) {\n ctx.pushCode(`${nestVar} = {};`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`${nestVar}.$parent = ${parentVar};`);\n ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`);\n }\n }\n ctx.pushPath(this.varName);\n this.options.type.generate(ctx);\n ctx.popPath(this.varName);\n if (this.varName && ctx.useContextVariables) {\n if (ctx.useContextVariables) {\n ctx.pushCode(`delete ${nestVar}.$parent;`);\n ctx.pushCode(`delete ${nestVar}.$root;`);\n }\n }\n }\n else if (aliasRegistry.has(this.options.type)) {\n const tempVar = ctx.generateTmpVariable();\n ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + this.options.type}(offset, {`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`$parent: ${parentVar},`);\n ctx.pushCode(`$root: ${parentVar}.$root,`);\n }\n ctx.pushCode(`});`);\n ctx.pushCode(`${nestVar} = ${tempVar}.result; offset = ${tempVar}.offset;`);\n if (this.options.type !== this.alias) {\n ctx.addReference(this.options.type);\n }\n }\n }\n generateWrapper(ctx) {\n const wrapperVar = ctx.generateVariable(this.varName);\n const wrappedBuf = ctx.generateTmpVariable();\n if (typeof this.options.readUntil === \"function\") {\n const pred = this.options.readUntil;\n const start = ctx.generateTmpVariable();\n const cur = ctx.generateTmpVariable();\n ctx.pushCode(`var ${start} = offset;`);\n ctx.pushCode(`var ${cur} = 0;`);\n ctx.pushCode(`while (offset < buffer.length) {`);\n ctx.pushCode(`${cur} = dataView.getUint8(offset);`);\n const func = ctx.addImport(pred);\n ctx.pushCode(`if (${func}.call(${ctx.generateVariable()}, ${cur}, buffer.subarray(offset))) break;`);\n ctx.pushCode(`offset += 1;`);\n ctx.pushCode(`}`);\n ctx.pushCode(`${wrappedBuf} = buffer.subarray(${start}, offset);`);\n }\n else if (this.options.readUntil === \"eof\") {\n ctx.pushCode(`${wrappedBuf} = buffer.subarray(offset);`);\n }\n else {\n const len = ctx.generateOption(this.options.length);\n ctx.pushCode(`${wrappedBuf} = buffer.subarray(offset, offset + ${len});`);\n ctx.pushCode(`offset += ${len};`);\n }\n if (this.options.clone) {\n ctx.pushCode(`${wrappedBuf} = buffer.constructor.from(${wrappedBuf});`);\n }\n const tempBuf = ctx.generateTmpVariable();\n const tempOff = ctx.generateTmpVariable();\n const tempView = ctx.generateTmpVariable();\n const func = ctx.addImport(this.options.wrapper);\n ctx.pushCode(`${wrappedBuf} = ${func}.call(this, ${wrappedBuf}).subarray(0);`);\n ctx.pushCode(`var ${tempBuf} = buffer;`);\n ctx.pushCode(`var ${tempOff} = offset;`);\n ctx.pushCode(`var ${tempView} = dataView;`);\n ctx.pushCode(`buffer = ${wrappedBuf};`);\n ctx.pushCode(`offset = 0;`);\n ctx.pushCode(`dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);`);\n if (this.options.type instanceof Parser) {\n if (this.varName) {\n ctx.pushCode(`${wrapperVar} = {};`);\n }\n ctx.pushPath(this.varName);\n this.options.type.generate(ctx);\n ctx.popPath(this.varName);\n }\n else if (aliasRegistry.has(this.options.type)) {\n const tempVar = ctx.generateTmpVariable();\n ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + this.options.type}(0);`);\n ctx.pushCode(`${wrapperVar} = ${tempVar}.result;`);\n if (this.options.type !== this.alias) {\n ctx.addReference(this.options.type);\n }\n }\n ctx.pushCode(`buffer = ${tempBuf};`);\n ctx.pushCode(`dataView = ${tempView};`);\n ctx.pushCode(`offset = ${tempOff};`);\n }\n generateFormatter(ctx, varName, formatter) {\n if (typeof formatter === \"function\") {\n const func = ctx.addImport(formatter);\n ctx.pushCode(`${varName} = ${func}.call(${ctx.generateVariable()}, ${varName});`);\n }\n }\n generatePointer(ctx) {\n const type = this.options.type;\n const offset = ctx.generateOption(this.options.offset);\n const tempVar = ctx.generateTmpVariable();\n const nestVar = ctx.generateVariable(this.varName);\n // Save current offset\n ctx.pushCode(`var ${tempVar} = offset;`);\n // Move offset\n ctx.pushCode(`offset = ${offset};`);\n if (this.options.type instanceof Parser) {\n ctx.pushCode(`${nestVar} = {};`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`${nestVar}.$parent = ${parentVar};`);\n ctx.pushCode(`${nestVar}.$root = ${parentVar}.$root;`);\n }\n ctx.pushPath(this.varName);\n this.options.type.generate(ctx);\n ctx.popPath(this.varName);\n if (ctx.useContextVariables) {\n ctx.pushCode(`delete ${nestVar}.$parent;`);\n ctx.pushCode(`delete ${nestVar}.$root;`);\n }\n }\n else if (aliasRegistry.has(this.options.type)) {\n const tempVar = ctx.generateTmpVariable();\n ctx.pushCode(`var ${tempVar} = ${FUNCTION_PREFIX + this.options.type}(offset, {`);\n if (ctx.useContextVariables) {\n const parentVar = ctx.generateVariable();\n ctx.pushCode(`$parent: ${parentVar},`);\n ctx.pushCode(`$root: ${parentVar}.$root,`);\n }\n ctx.pushCode(`});`);\n ctx.pushCode(`${nestVar} = ${tempVar}.result; offset = ${tempVar}.offset;`);\n if (this.options.type !== this.alias) {\n ctx.addReference(this.options.type);\n }\n }\n else if (Object.keys(PRIMITIVE_SIZES).indexOf(this.options.type) >= 0) {\n const typeName = PRIMITIVE_NAMES[type];\n const littleEndian = PRIMITIVE_LITTLE_ENDIANS[type];\n ctx.pushCode(`${nestVar} = dataView.get${typeName}(offset, ${littleEndian});`);\n ctx.pushCode(`offset += ${PRIMITIVE_SIZES[type]};`);\n }\n // Restore offset\n ctx.pushCode(`offset = ${tempVar};`);\n }\n generateSaveOffset(ctx) {\n const varName = ctx.generateVariable(this.varName);\n ctx.pushCode(`${varName} = offset`);\n }\n}\n//# sourceMappingURL=binary_parser.js.map","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get.bind();\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get.apply(this, arguments);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'reason', {\n value: undefined,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort(reason) {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n var signalReason = reason;\n\n if (signalReason === undefined) {\n if (typeof document === 'undefined') {\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n } else {\n try {\n signalReason = new DOMException('signal is aborted without reason');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n signalReason = new Error('This operation was aborted');\n signalReason.name = 'AbortError';\n }\n }\n }\n\n this.signal.reason = signalReason;\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","\"use strict\";\n/* eslint-disable */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AbortSignal = exports.AbortController = void 0;\nconst cjs_ponyfill_1 = require(\"abortcontroller-polyfill/dist/cjs-ponyfill\");\nvar getGlobal = function () {\n // the only reliable means to get the global object is\n // `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n};\n//@ts-ignore\nlet AbortController = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortController : getGlobal().AbortController;\nexports.AbortController = AbortController;\n//@ts-ignore\nlet AbortSignal = typeof getGlobal().AbortController === 'undefined' ? cjs_ponyfill_1.AbortSignal : getGlobal().AbortSignal;\nexports.AbortSignal = AbortSignal;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nclass NullSignal {\n}\n/**\n * aggregates a number of abort signals, will only fire the aggregated\n * abort if all of the input signals have been aborted\n */\nclass AggregateAbortController {\n constructor() {\n this.signals = new Set();\n this.abortController = new abortcontroller_ponyfill_1.AbortController();\n }\n /**\n * @param {AbortSignal} [signal] optional AbortSignal to add. if falsy,\n * will be treated as a null-signal, and this abortcontroller will no\n * longer be abortable.\n */\n //@ts-ignore\n addSignal(signal = new NullSignal()) {\n if (this.signal.aborted) {\n throw new Error('cannot add a signal, already aborted!');\n }\n // note that a NullSignal will never fire, so if we\n // have one this thing will never actually abort\n this.signals.add(signal);\n if (signal.aborted) {\n // handle the abort immediately if it is already aborted\n // for some reason\n this.handleAborted(signal);\n }\n else if (typeof signal.addEventListener === 'function') {\n signal.addEventListener('abort', () => {\n this.handleAborted(signal);\n });\n }\n }\n handleAborted(signal) {\n this.signals.delete(signal);\n if (this.signals.size === 0) {\n this.abortController.abort();\n }\n }\n get signal() {\n return this.abortController.signal;\n }\n abort() {\n this.abortController.abort();\n }\n}\nexports.default = AggregateAbortController;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass AggregateStatusReporter {\n constructor() {\n this.callbacks = new Set();\n }\n addCallback(callback = () => { }) {\n this.callbacks.add(callback);\n callback(this.currentMessage);\n }\n callback(message) {\n this.currentMessage = message;\n this.callbacks.forEach(elt => {\n elt(message);\n });\n }\n}\nexports.default = AggregateStatusReporter;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst abortcontroller_ponyfill_1 = require(\"./abortcontroller-ponyfill\");\nconst AggregateAbortController_1 = __importDefault(require(\"./AggregateAbortController\"));\nconst AggregateStatusReporter_1 = __importDefault(require(\"./AggregateStatusReporter\"));\nclass AbortablePromiseCache {\n constructor({ fill, cache, }) {\n if (typeof fill !== 'function') {\n throw new TypeError('must pass a fill function');\n }\n if (typeof cache !== 'object') {\n throw new TypeError('must pass a cache object');\n }\n if (typeof cache.get !== 'function' ||\n typeof cache.set !== 'function' ||\n typeof cache.delete !== 'function') {\n throw new TypeError('cache must implement get(key), set(key, val), and and delete(key)');\n }\n this.cache = cache;\n this.fillCallback = fill;\n }\n static isAbortException(exception) {\n return (\n // DOMException\n exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n //@ts-ignore\n exception.code === 'ERR_ABORTED' ||\n // stringified DOMException\n exception.message === 'AbortError: aborted' ||\n // stringified standard-ish exception\n exception.message === 'Error: aborted');\n }\n evict(key, entry) {\n if (this.cache.get(key) === entry) {\n this.cache.delete(key);\n }\n }\n fill(key, data, signal, statusCallback) {\n const aborter = new AggregateAbortController_1.default();\n const statusReporter = new AggregateStatusReporter_1.default();\n statusReporter.addCallback(statusCallback);\n const newEntry = {\n aborter: aborter,\n promise: this.fillCallback(data, aborter.signal, (message) => {\n statusReporter.callback(message);\n }),\n settled: false,\n statusReporter,\n get aborted() {\n return this.aborter.signal.aborted;\n },\n };\n newEntry.aborter.addSignal(signal);\n // remove the fill from the cache when its abortcontroller fires, if still in there\n newEntry.aborter.signal.addEventListener('abort', () => {\n if (!newEntry.settled) {\n this.evict(key, newEntry);\n }\n });\n // chain off the cached promise to record when it settles\n newEntry.promise\n .then(() => {\n newEntry.settled = true;\n }, () => {\n newEntry.settled = true;\n // if the fill throws an error (including abort) and is still in the cache, remove it\n this.evict(key, newEntry);\n })\n .catch(e => {\n // this will only be reached if there is some kind of\n // bad bug in this library\n console.error(e);\n throw e;\n });\n this.cache.set(key, newEntry);\n }\n static checkSinglePromise(promise, signal) {\n // check just this signal for having been aborted, and abort the\n // promise if it was, regardless of what happened with the cached\n // response\n function checkForSingleAbort() {\n if (signal && signal.aborted) {\n throw Object.assign(new Error('aborted'), { code: 'ERR_ABORTED' });\n }\n }\n return promise.then(result => {\n checkForSingleAbort();\n return result;\n }, error => {\n checkForSingleAbort();\n throw error;\n });\n }\n has(key) {\n return this.cache.has(key);\n }\n /**\n * Callback for getting status of the pending async\n *\n * @callback statusCallback\n * @param {any} status, current status string or message object\n */\n /**\n * @param {any} key cache key to use for this request\n * @param {any} data data passed as the first argument to the fill callback\n * @param {AbortSignal} [signal] optional AbortSignal object that aborts the request\n * @param {statusCallback} a callback to get the current status of a pending async operation\n */\n get(key, data, signal, statusCallback) {\n if (!signal && data instanceof abortcontroller_ponyfill_1.AbortSignal) {\n throw new TypeError('second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?');\n }\n const cacheEntry = this.cache.get(key);\n if (cacheEntry) {\n if (cacheEntry.aborted && !cacheEntry.settled) {\n // if it's aborted but has not realized it yet, evict it and redispatch\n this.evict(key, cacheEntry);\n return this.get(key, data, signal, statusCallback);\n }\n if (cacheEntry.settled) {\n // too late to abort, just return it\n return cacheEntry.promise;\n }\n // request is in-flight, add this signal to its list of signals,\n // or if there is no signal, the aborter will become non-abortable\n cacheEntry.aborter.addSignal(signal);\n cacheEntry.statusReporter.addCallback(statusCallback);\n return AbortablePromiseCache.checkSinglePromise(cacheEntry.promise, signal);\n }\n // if we got here, it is not in the cache. fill.\n this.fill(key, data, signal, statusCallback);\n return AbortablePromiseCache.checkSinglePromise(\n //see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#non-null-assertion-operator-postfix-\n //eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.cache.get(key).promise, signal);\n }\n /**\n * delete the given entry from the cache. if it exists and its fill request has\n * not yet settled, the fill will be signaled to abort.\n *\n * @param {any} key\n */\n delete(key) {\n const cachedEntry = this.cache.get(key);\n if (cachedEntry) {\n if (!cachedEntry.settled) {\n cachedEntry.aborter.abort();\n }\n this.cache.delete(key);\n }\n }\n /**\n * Clear all requests from the cache. Aborts any that have not settled.\n * @returns {number} count of entries deleted\n */\n clear() {\n // iterate without needing regenerator-runtime\n const keyIter = this.cache.keys();\n let deleteCount = 0;\n for (let result = keyIter.next(); !result.done; result = keyIter.next()) {\n this.delete(result.value);\n deleteCount += 1;\n }\n return deleteCount;\n }\n}\nexports.default = AbortablePromiseCache;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst AbortablePromiseCache_1 = __importDefault(require(\"./AbortablePromiseCache\"));\nexports.default = AbortablePromiseCache_1.default;\n","/* eslint prefer-rest-params:0, no-nested-ternary:0 */\n/**\n * Adapted from a combination of Range and _Compound in the\n * Dalliance Genome Explorer, (c) Thomas Down 2006-2010.\n */\nexport default class Range {\n constructor(arg1, arg2) {\n this.ranges =\n arguments.length === 2\n ? [{ min: arg1, max: arg2 }]\n : 0 in arg1\n ? Object.assign({}, arg1)\n : [arg1];\n }\n min() {\n return this.ranges[0].min;\n }\n max() {\n return this.ranges[this.ranges.length - 1].max;\n }\n contains(pos) {\n for (let s = 0; s < this.ranges.length; s += 1) {\n const r = this.ranges[s];\n if (r.min <= pos && r.max >= pos) {\n return true;\n }\n }\n return false;\n }\n isContiguous() {\n return this.ranges.length > 1;\n }\n getRanges() {\n return this.ranges.map((r) => new Range(r.min, r.max));\n }\n toString() {\n return this.ranges.map((r) => `[${r.min}-${r.max}]`).join(',');\n }\n union(s1) {\n const ranges = this.getRanges().concat(s1.getRanges()).sort(this.rangeOrder);\n const oranges = [];\n let current = ranges[0];\n for (let i = 1; i < ranges.length; i += 1) {\n const nxt = ranges[i];\n if (nxt.min() > current.max() + 1) {\n oranges.push(current);\n current = nxt;\n }\n else if (nxt.max() > current.max()) {\n current = new Range(current.min(), nxt.max());\n }\n }\n oranges.push(current);\n if (oranges.length === 1) {\n return oranges[0];\n }\n return new Range(oranges);\n }\n intersection(arg) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let s0 = this;\n let s1 = arg;\n const r0 = this.ranges();\n const r1 = s1.ranges();\n const l0 = r0.length;\n const l1 = r1.length;\n let i0 = 0;\n let i1 = 0;\n const or = [];\n while (i0 < l0 && i1 < l1) {\n s0 = r0[i0];\n s1 = r1[i1];\n const lapMin = Math.max(s0.min(), s1.min());\n const lapMax = Math.min(s0.max(), s1.max());\n if (lapMax >= lapMin) {\n or.push(new Range(lapMin, lapMax));\n }\n if (s0.max() > s1.max()) {\n i1 += 1;\n }\n else {\n i0 += 1;\n }\n }\n if (or.length === 0) {\n throw new Error('found range of length 0');\n }\n if (or.length === 1) {\n return or[0];\n }\n return new Range(or);\n }\n coverage() {\n let tot = 0;\n const rl = this.ranges();\n for (let ri = 0; ri < rl.length; ri += 1) {\n const r = rl[ri];\n tot += r.max() - r.min() + 1;\n }\n return tot;\n }\n rangeOrder(tmpa, tmpb) {\n let a = tmpa;\n let b = tmpb;\n if (arguments.length < 2) {\n b = a;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n a = this;\n }\n if (a.min() < b.min()) {\n return -1;\n }\n if (a.min() > b.min()) {\n return 1;\n }\n if (a.max() < b.max()) {\n return -1;\n }\n if (b.max() > a.max()) {\n return 1;\n }\n return 0;\n }\n}\n//# sourceMappingURL=range.js.map","\n/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//const Z_FILTERED = 1;\n//const Z_HUFFMAN_ONLY = 2;\n//const Z_RLE = 3;\nconst Z_FIXED$1 = 4;\n//const Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nconst Z_BINARY = 0;\nconst Z_TEXT = 1;\n//const Z_ASCII = 1; // = Z_TEXT\nconst Z_UNKNOWN$1 = 2;\n\n/*============================================================================*/\n\n\nfunction zero$1(buf) { let len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nconst STORED_BLOCK = 0;\nconst STATIC_TREES = 1;\nconst DYN_TREES = 2;\n/* The three kinds of block type */\n\nconst MIN_MATCH$1 = 3;\nconst MAX_MATCH$1 = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nconst LENGTH_CODES$1 = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nconst LITERALS$1 = 256;\n/* number of literal bytes 0..255 */\n\nconst L_CODES$1 = LITERALS$1 + 1 + LENGTH_CODES$1;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nconst D_CODES$1 = 30;\n/* number of distance codes */\n\nconst BL_CODES$1 = 19;\n/* number of codes used to transfer the bit lengths */\n\nconst HEAP_SIZE$1 = 2 * L_CODES$1 + 1;\n/* maximum heap size */\n\nconst MAX_BITS$1 = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nconst Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nconst MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nconst END_BLOCK = 256;\n/* end of block literal code */\n\nconst REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nconst REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nconst REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nconst extra_lbits = /* extra bits for each length code */\n new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]);\n\nconst extra_dbits = /* extra bits for each distance code */\n new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]);\n\nconst extra_blbits = /* extra bits for each bit length code */\n new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]);\n\nconst bl_order =\n new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nconst DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nconst static_ltree = new Array((L_CODES$1 + 2) * 2);\nzero$1(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nconst static_dtree = new Array(D_CODES$1 * 2);\nzero$1(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nconst _dist_code = new Array(DIST_CODE_LEN);\nzero$1(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nconst _length_code = new Array(MAX_MATCH$1 - MIN_MATCH$1 + 1);\nzero$1(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nconst base_length = new Array(LENGTH_CODES$1);\nzero$1(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nconst base_dist = new Array(D_CODES$1);\nzero$1(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nlet static_l_desc;\nlet static_d_desc;\nlet static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nconst d_code = (dist) => {\n\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n};\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nconst put_short = (s, w) => {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n};\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nconst send_bits = (s, value, length) => {\n\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n};\n\n\nconst send_code = (s, c, tree) => {\n\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n};\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nconst bi_reverse = (code, len) => {\n\n let res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n};\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nconst bi_flush = (s) => {\n\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n};\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nconst gen_bitlen = (s, desc) => {\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n\n const tree = desc.dyn_tree;\n const max_code = desc.max_code;\n const stree = desc.stat_desc.static_tree;\n const has_stree = desc.stat_desc.has_stree;\n const extra = desc.stat_desc.extra_bits;\n const base = desc.stat_desc.extra_base;\n const max_length = desc.stat_desc.max_length;\n let h; /* heap index */\n let n, m; /* iterate over the tree elements */\n let bits; /* bit length */\n let xbits; /* extra bits */\n let f; /* frequency */\n let overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS$1; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE$1; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Tracev((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Tracev((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n};\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nconst gen_codes = (tree, max_code, bl_count) => {\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n\n const next_code = new Array(MAX_BITS$1 + 1); /* next code value for each bit length */\n let code = 0; /* running code value */\n let bits; /* bit index */\n let n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS$1; bits++) {\n code = (code + bl_count[bits - 1]) << 1;\n next_code[bits] = code;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< {\n\n let n; /* iterates over tree elements */\n let bits; /* bit counter */\n let length; /* length value */\n let code; /* code value */\n let dist; /* distance index */\n const bl_count = new Array(MAX_BITS$1 + 1);\n /* number of codes at each bit length for an optimal tree */\n\n // do check in _tr_init()\n //if (static_init_done) return;\n\n /* For some embedded targets, global variables are not initialized: */\n/*#ifdef NO_INIT_GLOBAL_POINTERS\n static_l_desc.static_tree = static_ltree;\n static_l_desc.extra_bits = extra_lbits;\n static_d_desc.static_tree = static_dtree;\n static_d_desc.extra_bits = extra_dbits;\n static_bl_desc.extra_bits = extra_blbits;\n#endif*/\n\n /* Initialize the mapping length (0..255) -> length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES$1 - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES$1; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS$1; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES$1 + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES$1; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS$1 + 1, L_CODES$1, MAX_BITS$1);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES$1, MAX_BITS$1);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES$1, MAX_BL_BITS);\n\n //static_init_done = true;\n};\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nconst init_block = (s) => {\n\n let n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES$1; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES$1; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES$1; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.sym_next = s.matches = 0;\n};\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nconst bi_windup = (s) =>\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n};\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nconst smaller = (tree, n, m, depth) => {\n\n const _n2 = n * 2;\n const _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n};\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nconst pqdownheap = (s, tree, k) => {\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n\n const v = s.heap[k];\n let j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n};\n\n\n// inlined manually\n// const SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nconst compress_block = (s, ltree, dtree) => {\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n\n let dist; /* distance of matched string */\n let lc; /* match length or unmatched char (if dist == 0) */\n let sx = 0; /* running index in sym_buf */\n let code; /* the code to send */\n let extra; /* number of extra bits to send */\n\n if (s.sym_next !== 0) {\n do {\n dist = s.pending_buf[s.sym_buf + sx++] & 0xff;\n dist += (s.pending_buf[s.sym_buf + sx++] & 0xff) << 8;\n lc = s.pending_buf[s.sym_buf + sx++];\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS$1 + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and sym_buf is ok: */\n //Assert(s->pending < s->lit_bufsize + sx, \"pendingBuf overflow\");\n\n } while (sx < s.sym_next);\n }\n\n send_code(s, END_BLOCK, ltree);\n};\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nconst build_tree = (s, desc) => {\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n\n const tree = desc.dyn_tree;\n const stree = desc.stat_desc.static_tree;\n const has_stree = desc.stat_desc.has_stree;\n const elems = desc.stat_desc.elems;\n let n, m; /* iterate over heap elements */\n let max_code = -1; /* largest code with non zero frequency */\n let node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE$1;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n};\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nconst scan_tree = (s, tree, max_code) => {\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n\n let n; /* iterates over all tree elements */\n let prevlen = -1; /* last emitted length */\n let curlen; /* length of current code */\n\n let nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n let count = 0; /* repeat count of the current code */\n let max_count = 7; /* max repeat count */\n let min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n};\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nconst send_tree = (s, tree, max_code) => {\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n\n let n; /* iterates over all tree elements */\n let prevlen = -1; /* last emitted length */\n let curlen; /* length of current code */\n\n let nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n let count = 0; /* repeat count of the current code */\n let max_count = 7; /* max repeat count */\n let min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n};\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nconst build_bl_tree = (s) => {\n\n let max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES$1 - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n};\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nconst send_all_trees = (s, lcodes, dcodes, blcodes) => {\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n\n let rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n};\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"block list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"allow list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nconst detect_data_type = (s) => {\n /* block_mask is the bit mask of block-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n let block_mask = 0xf3ffc07f;\n let n;\n\n /* Check for non-textual (\"block-listed\") bytes. */\n for (n = 0; n <= 31; n++, block_mask >>>= 1) {\n if ((block_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"allow-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS$1; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"block-listed\" or \"allow-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n};\n\n\nlet static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nconst _tr_init$1 = (s) =>\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n};\n\n\n/* ===========================================================================\n * Send a stored block\n */\nconst _tr_stored_block$1 = (s, buf, stored_len, last) => {\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n bi_windup(s); /* align on byte boundary */\n put_short(s, stored_len);\n put_short(s, ~stored_len);\n if (stored_len) {\n s.pending_buf.set(s.window.subarray(buf, buf + stored_len), s.pending);\n }\n s.pending += stored_len;\n};\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nconst _tr_align$1 = (s) => {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n};\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and write out the encoded block.\n */\nconst _tr_flush_block$1 = (s, buf, stored_len, last) => {\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n\n let opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n let max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN$1) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->sym_next / 3));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block$1(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED$1 || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n};\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nconst _tr_tally$1 = (s, dist, lc) => {\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n\n s.pending_buf[s.sym_buf + s.sym_next++] = dist;\n s.pending_buf[s.sym_buf + s.sym_next++] = dist >> 8;\n s.pending_buf[s.sym_buf + s.sym_next++] = lc;\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS$1 + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n return (s.sym_next === s.sym_end);\n};\n\nvar _tr_init_1 = _tr_init$1;\nvar _tr_stored_block_1 = _tr_stored_block$1;\nvar _tr_flush_block_1 = _tr_flush_block$1;\nvar _tr_tally_1 = _tr_tally$1;\nvar _tr_align_1 = _tr_align$1;\n\nvar trees = {\n\t_tr_init: _tr_init_1,\n\t_tr_stored_block: _tr_stored_block_1,\n\t_tr_flush_block: _tr_flush_block_1,\n\t_tr_tally: _tr_tally_1,\n\t_tr_align: _tr_align_1\n};\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst adler32 = (adler, buf, len, pos) => {\n let s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n};\n\n\nvar adler32_1 = adler32;\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nconst makeTable = () => {\n let c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n};\n\n// Create table on load. Just 255 signed longs. Not a problem.\nconst crcTable = new Uint32Array(makeTable());\n\n\nconst crc32 = (crc, buf, len, pos) => {\n const t = crcTable;\n const end = pos + len;\n\n crc ^= -1;\n\n for (let i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n};\n\n\nvar crc32_1 = crc32;\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar messages = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar constants$2 = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = trees;\n\n\n\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH: Z_NO_FLUSH$2, Z_PARTIAL_FLUSH, Z_FULL_FLUSH: Z_FULL_FLUSH$1, Z_FINISH: Z_FINISH$3, Z_BLOCK: Z_BLOCK$1,\n Z_OK: Z_OK$3, Z_STREAM_END: Z_STREAM_END$3, Z_STREAM_ERROR: Z_STREAM_ERROR$2, Z_DATA_ERROR: Z_DATA_ERROR$2, Z_BUF_ERROR: Z_BUF_ERROR$1,\n Z_DEFAULT_COMPRESSION: Z_DEFAULT_COMPRESSION$1,\n Z_FILTERED, Z_HUFFMAN_ONLY, Z_RLE, Z_FIXED, Z_DEFAULT_STRATEGY: Z_DEFAULT_STRATEGY$1,\n Z_UNKNOWN,\n Z_DEFLATED: Z_DEFLATED$2\n} = constants$2;\n\n/*============================================================================*/\n\n\nconst MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nconst MAX_WBITS$1 = 15;\n/* 32K LZ77 window */\nconst DEF_MEM_LEVEL = 8;\n\n\nconst LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nconst LITERALS = 256;\n/* number of literal bytes 0..255 */\nconst L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nconst D_CODES = 30;\n/* number of distance codes */\nconst BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nconst HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nconst MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nconst MIN_MATCH = 3;\nconst MAX_MATCH = 258;\nconst MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nconst PRESET_DICT = 0x20;\n\nconst INIT_STATE = 42; /* zlib header -> BUSY_STATE */\n//#ifdef GZIP\nconst GZIP_STATE = 57; /* gzip header -> BUSY_STATE | EXTRA_STATE */\n//#endif\nconst EXTRA_STATE = 69; /* gzip extra block -> NAME_STATE */\nconst NAME_STATE = 73; /* gzip file name -> COMMENT_STATE */\nconst COMMENT_STATE = 91; /* gzip comment -> HCRC_STATE */\nconst HCRC_STATE = 103; /* gzip header CRC -> BUSY_STATE */\nconst BUSY_STATE = 113; /* deflate -> FINISH_STATE */\nconst FINISH_STATE = 666; /* stream complete */\n\nconst BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nconst BS_BLOCK_DONE = 2; /* block flush performed */\nconst BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nconst BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nconst OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nconst err = (strm, errorCode) => {\n strm.msg = messages[errorCode];\n return errorCode;\n};\n\nconst rank = (f) => {\n return ((f) * 2) - ((f) > 4 ? 9 : 0);\n};\n\nconst zero = (buf) => {\n let len = buf.length; while (--len >= 0) { buf[len] = 0; }\n};\n\n/* ===========================================================================\n * Slide the hash table when sliding the window down (could be avoided with 32\n * bit values at the expense of memory usage). We slide even when level == 0 to\n * keep the hash table consistent if we switch back to level > 0 later.\n */\nconst slide_hash = (s) => {\n let n, m;\n let p;\n let wsize = s.w_size;\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= wsize ? m - wsize : 0);\n } while (--n);\n n = wsize;\n//#ifndef FASTEST\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= wsize ? m - wsize : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n//#endif\n};\n\n/* eslint-disable new-cap */\nlet HASH_ZLIB = (s, prev, data) => ((prev << s.hash_shift) ^ data) & s.hash_mask;\n// This hash causes less collisions, https://github.com/nodeca/pako/issues/135\n// But breaks binary compatibility\n//let HASH_FAST = (s, prev, data) => ((prev << 8) + (prev >> 8) + (data << 4)) & s.hash_mask;\nlet HASH = HASH_ZLIB;\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output, except for\n * some deflate_stored() output, goes through this function so some\n * applications may wish to modify it to avoid allocating a large\n * strm->next_out buffer and copying into it. (See also read_buf()).\n */\nconst flush_pending = (strm) => {\n const s = strm.state;\n\n //_tr_flush_bits(s);\n let len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n};\n\n\nconst flush_block_only = (s, last) => {\n _tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n};\n\n\nconst put_byte = (s, b) => {\n s.pending_buf[s.pending++] = b;\n};\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nconst putShortMSB = (s, b) => {\n\n // put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n};\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nconst read_buf = (strm, buf, start, size) => {\n\n let len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32_1(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32_1(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n};\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nconst longest_match = (s, cur_match) => {\n\n let chain_length = s.max_chain_length; /* max hash chain length */\n let scan = s.strstart; /* current string */\n let match; /* matched string */\n let len; /* length of current match */\n let best_len = s.prev_length; /* best match length so far */\n let nice_match = s.nice_match; /* stop if match long enough */\n const limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n const _win = s.window; // shortcut\n\n const wmask = s.w_mask;\n const prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n const strend = s.strstart + MAX_MATCH;\n let scan_end1 = _win[scan + best_len - 1];\n let scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n};\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nconst fill_window = (s) => {\n\n const _w_size = s.w_size;\n let n, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n s.window.set(s.window.subarray(_w_size, _w_size + _w_size - more), 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n if (s.insert > s.strstart) {\n s.insert = s.strstart;\n }\n slide_hash(s);\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + 1]);\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// const curr = s.strstart + s.lookahead;\n// let init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n};\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n *\n * In case deflateParams() is used to later switch to a non-zero compression\n * level, s->matches (otherwise unused when storing) keeps track of the number\n * of hash table slides to perform. If s->matches is 1, then one hash table\n * slide will be done when switching. If s->matches is 2, the maximum value\n * allowed here, then the hash table will be cleared, since two or more slides\n * is the same as a clear.\n *\n * deflate_stored() is written to minimize the number of times an input byte is\n * copied. It is most efficient with large input and output buffers, which\n * maximizes the opportunites to have a single copy from next_in to next_out.\n */\nconst deflate_stored = (s, flush) => {\n\n /* Smallest worthy block size when not flushing or finishing. By default\n * this is 32K. This can be as small as 507 bytes for memLevel == 1. For\n * large input and output buffers, the stored block size will be larger.\n */\n let min_block = s.pending_buf_size - 5 > s.w_size ? s.w_size : s.pending_buf_size - 5;\n\n /* Copy as many min_block or larger stored blocks directly to next_out as\n * possible. If flushing, copy the remaining available input to next_out as\n * stored blocks, if there is enough space.\n */\n let len, left, have, last = 0;\n let used = s.strm.avail_in;\n do {\n /* Set len to the maximum size block that we can copy directly with the\n * available input data and output space. Set left to how much of that\n * would be copied from what's left in the window.\n */\n len = 65535/* MAX_STORED */; /* maximum deflate stored block length */\n have = (s.bi_valid + 42) >> 3; /* number of header bytes */\n if (s.strm.avail_out < have) { /* need room for header */\n break;\n }\n /* maximum stored block length that will fit in avail_out: */\n have = s.strm.avail_out - have;\n left = s.strstart - s.block_start; /* bytes left in window */\n if (len > left + s.strm.avail_in) {\n len = left + s.strm.avail_in; /* limit len to the input */\n }\n if (len > have) {\n len = have; /* limit len to the output */\n }\n\n /* If the stored block would be less than min_block in length, or if\n * unable to copy all of the available input when flushing, then try\n * copying to the window and the pending buffer instead. Also don't\n * write an empty block when flushing -- deflate() does that.\n */\n if (len < min_block && ((len === 0 && flush !== Z_FINISH$3) ||\n flush === Z_NO_FLUSH$2 ||\n len !== left + s.strm.avail_in)) {\n break;\n }\n\n /* Make a dummy stored block in pending to get the header bytes,\n * including any pending bits. This also updates the debugging counts.\n */\n last = flush === Z_FINISH$3 && len === left + s.strm.avail_in ? 1 : 0;\n _tr_stored_block(s, 0, 0, last);\n\n /* Replace the lengths in the dummy stored block with len. */\n s.pending_buf[s.pending - 4] = len;\n s.pending_buf[s.pending - 3] = len >> 8;\n s.pending_buf[s.pending - 2] = ~len;\n s.pending_buf[s.pending - 1] = ~len >> 8;\n\n /* Write the stored block header bytes. */\n flush_pending(s.strm);\n\n//#ifdef ZLIB_DEBUG\n// /* Update debugging counts for the data about to be copied. */\n// s->compressed_len += len << 3;\n// s->bits_sent += len << 3;\n//#endif\n\n /* Copy uncompressed bytes from the window to next_out. */\n if (left) {\n if (left > len) {\n left = len;\n }\n //zmemcpy(s->strm->next_out, s->window + s->block_start, left);\n s.strm.output.set(s.window.subarray(s.block_start, s.block_start + left), s.strm.next_out);\n s.strm.next_out += left;\n s.strm.avail_out -= left;\n s.strm.total_out += left;\n s.block_start += left;\n len -= left;\n }\n\n /* Copy uncompressed bytes directly from next_in to next_out, updating\n * the check value.\n */\n if (len) {\n read_buf(s.strm, s.strm.output, s.strm.next_out, len);\n s.strm.next_out += len;\n s.strm.avail_out -= len;\n s.strm.total_out += len;\n }\n } while (last === 0);\n\n /* Update the sliding window with the last s->w_size bytes of the copied\n * data, or append all of the copied data to the existing window if less\n * than s->w_size bytes were copied. Also update the number of bytes to\n * insert in the hash tables, in the event that deflateParams() switches to\n * a non-zero compression level.\n */\n used -= s.strm.avail_in; /* number of input bytes directly copied */\n if (used) {\n /* If any input was used, then no unused input remains in the window,\n * therefore s->block_start == s->strstart.\n */\n if (used >= s.w_size) { /* supplant the previous history */\n s.matches = 2; /* clear hash */\n //zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size);\n s.window.set(s.strm.input.subarray(s.strm.next_in - s.w_size, s.strm.next_in), 0);\n s.strstart = s.w_size;\n s.insert = s.strstart;\n }\n else {\n if (s.window_size - s.strstart <= used) {\n /* Slide the window down. */\n s.strstart -= s.w_size;\n //zmemcpy(s->window, s->window + s->w_size, s->strstart);\n s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0);\n if (s.matches < 2) {\n s.matches++; /* add a pending slide_hash() */\n }\n if (s.insert > s.strstart) {\n s.insert = s.strstart;\n }\n }\n //zmemcpy(s->window + s->strstart, s->strm->next_in - used, used);\n s.window.set(s.strm.input.subarray(s.strm.next_in - used, s.strm.next_in), s.strstart);\n s.strstart += used;\n s.insert += used > s.w_size - s.insert ? s.w_size - s.insert : used;\n }\n s.block_start = s.strstart;\n }\n if (s.high_water < s.strstart) {\n s.high_water = s.strstart;\n }\n\n /* If the last block was written to next_out, then done. */\n if (last) {\n return BS_FINISH_DONE;\n }\n\n /* If flushing and all input has been consumed, then done. */\n if (flush !== Z_NO_FLUSH$2 && flush !== Z_FINISH$3 &&\n s.strm.avail_in === 0 && s.strstart === s.block_start) {\n return BS_BLOCK_DONE;\n }\n\n /* Fill the window with any remaining input. */\n have = s.window_size - s.strstart;\n if (s.strm.avail_in > have && s.block_start >= s.w_size) {\n /* Slide the window down. */\n s.block_start -= s.w_size;\n s.strstart -= s.w_size;\n //zmemcpy(s->window, s->window + s->w_size, s->strstart);\n s.window.set(s.window.subarray(s.w_size, s.w_size + s.strstart), 0);\n if (s.matches < 2) {\n s.matches++; /* add a pending slide_hash() */\n }\n have += s.w_size; /* more space now */\n if (s.insert > s.strstart) {\n s.insert = s.strstart;\n }\n }\n if (have > s.strm.avail_in) {\n have = s.strm.avail_in;\n }\n if (have) {\n read_buf(s.strm, s.window, s.strstart, have);\n s.strstart += have;\n s.insert += have > s.w_size - s.insert ? s.w_size - s.insert : have;\n }\n if (s.high_water < s.strstart) {\n s.high_water = s.strstart;\n }\n\n /* There was not enough avail_out to write a complete worthy or flushed\n * stored block to next_out. Write a stored block to pending instead, if we\n * have enough input for a worthy block, or if flushing and there is enough\n * room for the remaining input as a stored block in the pending buffer.\n */\n have = (s.bi_valid + 42) >> 3; /* number of header bytes */\n /* maximum stored block length that will fit in pending: */\n have = s.pending_buf_size - have > 65535/* MAX_STORED */ ? 65535/* MAX_STORED */ : s.pending_buf_size - have;\n min_block = have > s.w_size ? s.w_size : have;\n left = s.strstart - s.block_start;\n if (left >= min_block ||\n ((left || flush === Z_FINISH$3) && flush !== Z_NO_FLUSH$2 &&\n s.strm.avail_in === 0 && left <= have)) {\n len = left > have ? have : left;\n last = flush === Z_FINISH$3 && s.strm.avail_in === 0 &&\n len === left ? 1 : 0;\n _tr_stored_block(s, s.block_start, len, last);\n s.block_start += len;\n flush_pending(s.strm);\n }\n\n /* We've done all we can with the available input and output. */\n return last ? BS_FINISH_STARTED : BS_NEED_MORE;\n};\n\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nconst deflate_fast = (s, flush) => {\n\n let hash_head; /* head of the hash chain */\n let bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = _tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]);\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.sym_next) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nconst deflate_slow = (s, flush) => {\n\n let hash_head; /* head of hash chain */\n let bflush; /* set if current block must be flushed */\n\n let max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = _tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.sym_next) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n};\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nconst deflate_rle = (s, flush) => {\n\n let bflush; /* set if current block must be flushed */\n let prev; /* byte at distance one to match */\n let scan, strend; /* scan goes up to strend for length of run */\n\n const _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = _tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.sym_next) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nconst deflate_huff = (s, flush) => {\n\n let bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.sym_next) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nconst configuration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nconst lm_init = (s) => {\n\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n};\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED$2; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new Uint16Array(HEAP_SIZE * 2);\n this.dyn_dtree = new Uint16Array((2 * D_CODES + 1) * 2);\n this.bl_tree = new Uint16Array((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new Uint16Array(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new Uint16Array(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new Uint16Array(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.sym_buf = 0; /* buffer for distances and literals/lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.sym_next = 0; /* running index in sym_buf */\n this.sym_end = 0; /* symbol table full when sym_next reaches this */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\n/* =========================================================================\n * Check for a valid deflate stream state. Return 0 if ok, 1 if not.\n */\nconst deflateStateCheck = (strm) => {\n\n if (!strm) {\n return 1;\n }\n const s = strm.state;\n if (!s || s.strm !== strm || (s.status !== INIT_STATE &&\n//#ifdef GZIP\n s.status !== GZIP_STATE &&\n//#endif\n s.status !== EXTRA_STATE &&\n s.status !== NAME_STATE &&\n s.status !== COMMENT_STATE &&\n s.status !== HCRC_STATE &&\n s.status !== BUSY_STATE &&\n s.status !== FINISH_STATE)) {\n return 1;\n }\n return 0;\n};\n\n\nconst deflateResetKeep = (strm) => {\n\n if (deflateStateCheck(strm)) {\n return err(strm, Z_STREAM_ERROR$2);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n const s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status =\n//#ifdef GZIP\n s.wrap === 2 ? GZIP_STATE :\n//#endif\n s.wrap ? INIT_STATE : BUSY_STATE;\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = -2;\n _tr_init(s);\n return Z_OK$3;\n};\n\n\nconst deflateReset = (strm) => {\n\n const ret = deflateResetKeep(strm);\n if (ret === Z_OK$3) {\n lm_init(strm.state);\n }\n return ret;\n};\n\n\nconst deflateSetHeader = (strm, head) => {\n\n if (deflateStateCheck(strm) || strm.state.wrap !== 2) {\n return Z_STREAM_ERROR$2;\n }\n strm.state.gzhead = head;\n return Z_OK$3;\n};\n\n\nconst deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => {\n\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR$2;\n }\n let wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION$1) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED$2 ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED || (windowBits === 8 && wrap !== 1)) {\n return err(strm, Z_STREAM_ERROR$2);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n const s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n s.status = INIT_STATE; /* to pass state test in deflateReset() */\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new Uint8Array(s.w_size * 2);\n s.head = new Uint16Array(s.hash_size);\n s.prev = new Uint16Array(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n /* We overlay pending_buf and sym_buf. This works since the average size\n * for length/distance pairs over any compressed block is assured to be 31\n * bits or less.\n *\n * Analysis: The longest fixed codes are a length code of 8 bits plus 5\n * extra bits, for lengths 131 to 257. The longest fixed distance codes are\n * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest\n * possible fixed-codes length/distance pair is then 31 bits total.\n *\n * sym_buf starts one-fourth of the way into pending_buf. So there are\n * three bytes in sym_buf for every four bytes in pending_buf. Each symbol\n * in sym_buf is three bytes -- two for the distance and one for the\n * literal/length. As each symbol is consumed, the pointer to the next\n * sym_buf value to read moves forward three bytes. From that symbol, up to\n * 31 bits are written to pending_buf. The closest the written pending_buf\n * bits gets to the next sym_buf symbol to read is just before the last\n * code is written. At that time, 31*(n-2) bits have been written, just\n * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at\n * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1\n * symbols are written.) The closest the writing gets to what is unread is\n * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and\n * can range from 128 to 32768.\n *\n * Therefore, at a minimum, there are 142 bits of space between what is\n * written and what is read in the overlain buffers, so the symbols cannot\n * be overwritten by the compressed data. That space is actually 139 bits,\n * due to the three-bit fixed-code block header.\n *\n * That covers the case where either Z_FIXED is specified, forcing fixed\n * codes, or when the use of fixed codes is chosen, because that choice\n * results in a smaller compressed block than dynamic codes. That latter\n * condition then assures that the above analysis also covers all dynamic\n * blocks. A dynamic-code block will only be chosen to be emitted if it has\n * fewer bits than a fixed-code block would for the same set of symbols.\n * Therefore its average symbol length is assured to be less than 31. So\n * the compressed data for a dynamic block also cannot overwrite the\n * symbols from which it is being constructed.\n */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n s.pending_buf = new Uint8Array(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->sym_buf = s->pending_buf + s->lit_bufsize;\n s.sym_buf = s.lit_bufsize;\n\n //s->sym_end = (s->lit_bufsize - 1) * 3;\n s.sym_end = (s.lit_bufsize - 1) * 3;\n /* We avoid equality with lit_bufsize*3 because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n};\n\nconst deflateInit = (strm, level) => {\n\n return deflateInit2(strm, level, Z_DEFLATED$2, MAX_WBITS$1, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY$1);\n};\n\n\n/* ========================================================================= */\nconst deflate$2 = (strm, flush) => {\n\n if (deflateStateCheck(strm) || flush > Z_BLOCK$1 || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR$2) : Z_STREAM_ERROR$2;\n }\n\n const s = strm.state;\n\n if (!strm.output ||\n (strm.avail_in !== 0 && !strm.input) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH$3)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR$1 : Z_STREAM_ERROR$2);\n }\n\n const old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK$3;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH$3) {\n return err(strm, Z_BUF_ERROR$1);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR$1);\n }\n\n /* Write the header */\n if (s.status === INIT_STATE && s.wrap === 0) {\n s.status = BUSY_STATE;\n }\n if (s.status === INIT_STATE) {\n /* zlib header */\n let header = (Z_DEFLATED$2 + ((s.w_bits - 8) << 4)) << 8;\n let level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n\n /* Compression must start with an empty pending buffer */\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n }\n//#ifdef GZIP\n if (s.status === GZIP_STATE) {\n /* gzip header */\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n\n /* Compression must start with an empty pending buffer */\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n let beg = s.pending; /* start of bytes to update crc */\n let left = (s.gzhead.extra.length & 0xffff) - s.gzindex;\n while (s.pending + left > s.pending_buf_size) {\n let copy = s.pending_buf_size - s.pending;\n // zmemcpy(s.pending_buf + s.pending,\n // s.gzhead.extra + s.gzindex, copy);\n s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex, s.gzindex + copy), s.pending);\n s.pending = s.pending_buf_size;\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n s.gzindex += copy;\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n beg = 0;\n left -= copy;\n }\n // JS specific: s.gzhead.extra may be TypedArray or Array for backward compatibility\n // TypedArray.slice and TypedArray.from don't exist in IE10-IE11\n let gzhead_extra = new Uint8Array(s.gzhead.extra);\n // zmemcpy(s->pending_buf + s->pending,\n // s->gzhead->extra + s->gzindex, left);\n s.pending_buf.set(gzhead_extra.subarray(s.gzindex, s.gzindex + left), s.pending);\n s.pending += left;\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n s.gzindex = 0;\n }\n s.status = NAME_STATE;\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n let beg = s.pending; /* start of bytes to update crc */\n let val;\n do {\n if (s.pending === s.pending_buf_size) {\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n beg = 0;\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n s.gzindex = 0;\n }\n s.status = COMMENT_STATE;\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n let beg = s.pending; /* start of bytes to update crc */\n let val;\n do {\n if (s.pending === s.pending_buf_size) {\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n beg = 0;\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n //--- HCRC_UPDATE(beg) ---//\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n //---//\n }\n s.status = HCRC_STATE;\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n }\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n }\n s.status = BUSY_STATE;\n\n /* Compression must start with an empty pending buffer */\n flush_pending(strm);\n if (s.pending !== 0) {\n s.last_flush = -1;\n return Z_OK$3;\n }\n }\n//#endif\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH$2 && s.status !== FINISH_STATE)) {\n let bstate = s.level === 0 ? deflate_stored(s, flush) :\n s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :\n s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush);\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK$3;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n _tr_align(s);\n }\n else if (flush !== Z_BLOCK$1) { /* FULL_FLUSH or SYNC_FLUSH */\n\n _tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH$1) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK$3;\n }\n }\n }\n\n if (flush !== Z_FINISH$3) { return Z_OK$3; }\n if (s.wrap <= 0) { return Z_STREAM_END$3; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK$3 : Z_STREAM_END$3;\n};\n\n\nconst deflateEnd = (strm) => {\n\n if (deflateStateCheck(strm)) {\n return Z_STREAM_ERROR$2;\n }\n\n const status = strm.state.status;\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR$2) : Z_OK$3;\n};\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nconst deflateSetDictionary = (strm, dictionary) => {\n\n let dictLength = dictionary.length;\n\n if (deflateStateCheck(strm)) {\n return Z_STREAM_ERROR$2;\n }\n\n const s = strm.state;\n const wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR$2;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32_1(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n let tmpDict = new Uint8Array(s.w_size);\n tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n const avail = strm.avail_in;\n const next = strm.next_in;\n const input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n let str = s.strstart;\n let n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK$3;\n};\n\n\nvar deflateInit_1 = deflateInit;\nvar deflateInit2_1 = deflateInit2;\nvar deflateReset_1 = deflateReset;\nvar deflateResetKeep_1 = deflateResetKeep;\nvar deflateSetHeader_1 = deflateSetHeader;\nvar deflate_2$1 = deflate$2;\nvar deflateEnd_1 = deflateEnd;\nvar deflateSetDictionary_1 = deflateSetDictionary;\nvar deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nmodule.exports.deflateBound = deflateBound;\nmodule.exports.deflateCopy = deflateCopy;\nmodule.exports.deflateGetDictionary = deflateGetDictionary;\nmodule.exports.deflateParams = deflateParams;\nmodule.exports.deflatePending = deflatePending;\nmodule.exports.deflatePrime = deflatePrime;\nmodule.exports.deflateTune = deflateTune;\n*/\n\nvar deflate_1$2 = {\n\tdeflateInit: deflateInit_1,\n\tdeflateInit2: deflateInit2_1,\n\tdeflateReset: deflateReset_1,\n\tdeflateResetKeep: deflateResetKeep_1,\n\tdeflateSetHeader: deflateSetHeader_1,\n\tdeflate: deflate_2$1,\n\tdeflateEnd: deflateEnd_1,\n\tdeflateSetDictionary: deflateSetDictionary_1,\n\tdeflateInfo: deflateInfo\n};\n\nconst _has = (obj, key) => {\n return Object.prototype.hasOwnProperty.call(obj, key);\n};\n\nvar assign = function (obj /*from1, from2, from3, ...*/) {\n const sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n const source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (const p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// Join array of chunks to single array.\nvar flattenChunks = (chunks) => {\n // calculate data length\n let len = 0;\n\n for (let i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n const result = new Uint8Array(len);\n\n for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {\n let chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n};\n\nvar common = {\n\tassign: assign,\n\tflattenChunks: flattenChunks\n};\n\n// String encode/decode helpers\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nlet STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nconst _utf8len = new Uint8Array(256);\nfor (let q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nvar string2buf = (str) => {\n if (typeof TextEncoder === 'function' && TextEncoder.prototype.encode) {\n return new TextEncoder().encode(str);\n }\n\n let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new Uint8Array(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper\nconst buf2binstring = (buf, len) => {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if (buf.subarray && STR_APPLY_UIA_OK) {\n return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));\n }\n }\n\n let result = '';\n for (let i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n};\n\n\n// convert array to string\nvar buf2string = (buf, max) => {\n const len = max || buf.length;\n\n if (typeof TextDecoder === 'function' && TextDecoder.prototype.decode) {\n return new TextDecoder().decode(buf.subarray(0, max));\n }\n\n let i, out;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n const utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n let c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n let c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nvar utf8border = (buf, max) => {\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n let pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n\nvar strings = {\n\tstring2buf: string2buf,\n\tbuf2string: buf2string,\n\tutf8border: utf8border\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nvar zstream = ZStream;\n\nconst toString$1 = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH: Z_NO_FLUSH$1, Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH: Z_FINISH$2,\n Z_OK: Z_OK$2, Z_STREAM_END: Z_STREAM_END$2,\n Z_DEFAULT_COMPRESSION,\n Z_DEFAULT_STRATEGY,\n Z_DEFLATED: Z_DEFLATED$1\n} = constants$2;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * , chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate$1(options) {\n this.options = common.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED$1,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY\n }, options || {});\n\n let opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new zstream();\n this.strm.avail_out = 0;\n\n let status = deflate_1$2.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK$2) {\n throw new Error(messages[status]);\n }\n\n if (opt.header) {\n deflate_1$2.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n let dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString$1.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = deflate_1$2.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK$2) {\n throw new Error(messages[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must\n * have `flush_mode` Z_FINISH (or `true`). That will flush internal pending\n * buffers and call [[Deflate#onEnd]].\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate$1.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n let status, _flush_mode;\n\n if (this.ended) { return false; }\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH$2 : Z_NO_FLUSH$1;\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString$1.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n // Make sure avail_out > 6 to avoid repeating markers\n if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH) && strm.avail_out <= 6) {\n this.onData(strm.output.subarray(0, strm.next_out));\n strm.avail_out = 0;\n continue;\n }\n\n status = deflate_1$2.deflate(strm, _flush_mode);\n\n // Ended => flush and finish\n if (status === Z_STREAM_END$2) {\n if (strm.next_out > 0) {\n this.onData(strm.output.subarray(0, strm.next_out));\n }\n status = deflate_1$2.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK$2;\n }\n\n // Flush if out buffer full\n if (strm.avail_out === 0) {\n this.onData(strm.output);\n continue;\n }\n\n // Flush if requested and has data\n if (_flush_mode > 0 && strm.next_out > 0) {\n this.onData(strm.output.subarray(0, strm.next_out));\n strm.avail_out = 0;\n continue;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array): output data.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate$1.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate$1.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK$2) {\n this.result = common.flattenChunks(this.chunks);\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array\n * - data (Uint8Array|ArrayBuffer|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const data = new Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate$1(input, options) {\n const deflator = new Deflate$1(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || messages[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array\n * - data (Uint8Array|ArrayBuffer|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw$1(input, options) {\n options = options || {};\n options.raw = true;\n return deflate$1(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array\n * - data (Uint8Array|ArrayBuffer|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip$1(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate$1(input, options);\n}\n\n\nvar Deflate_1$1 = Deflate$1;\nvar deflate_2 = deflate$1;\nvar deflateRaw_1$1 = deflateRaw$1;\nvar gzip_1$1 = gzip$1;\nvar constants$1 = constants$2;\n\nvar deflate_1$1 = {\n\tDeflate: Deflate_1$1,\n\tdeflate: deflate_2,\n\tdeflateRaw: deflateRaw_1$1,\n\tgzip: gzip_1$1,\n\tconstants: constants$1\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nconst BAD$1 = 16209; /* got a data error -- remain here until reset */\nconst TYPE$1 = 16191; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nvar inffast = function inflate_fast(strm, start) {\n let _in; /* local strm.input */\n let last; /* have enough input while in < last */\n let _out; /* local strm.output */\n let beg; /* inflate()'s initial strm.output */\n let end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n let dmax; /* maximum distance from zlib header */\n//#endif\n let wsize; /* window size or zero if not using window */\n let whave; /* valid bytes in the window */\n let wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n let s_window; /* allocated sliding window, if wsize != 0 */\n let hold; /* local strm.hold */\n let bits; /* local strm.bits */\n let lcode; /* local strm.lencode */\n let dcode; /* local strm.distcode */\n let lmask; /* mask for first level of length codes */\n let dmask; /* mask for first level of distance codes */\n let here; /* retrieved table entry */\n let op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n let len; /* match length, unused bytes */\n let dist; /* match distance */\n let from; /* where to copy match from */\n let from_source;\n\n\n let input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n const state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE$1;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst MAXBITS = 15;\nconst ENOUGH_LENS$1 = 852;\nconst ENOUGH_DISTS$1 = 592;\n//const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nconst CODES$1 = 0;\nconst LENS$1 = 1;\nconst DISTS$1 = 2;\n\nconst lbase = new Uint16Array([ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n]);\n\nconst lext = new Uint8Array([ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n]);\n\nconst dbase = new Uint16Array([ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n]);\n\nconst dext = new Uint8Array([ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n]);\n\nconst inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) =>\n{\n const bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n let len = 0; /* a code's length in bits */\n let sym = 0; /* index of code symbols */\n let min = 0, max = 0; /* minimum and maximum code lengths */\n let root = 0; /* number of index bits for root table */\n let curr = 0; /* number of index bits for current table */\n let drop = 0; /* code bits to drop for sub-table */\n let left = 0; /* number of prefix codes available */\n let used = 0; /* code entries in table used */\n let huff = 0; /* Huffman code */\n let incr; /* for incrementing code, index */\n let fill; /* index for replicating entries */\n let low; /* low bits for current root entry */\n let mask; /* mask for low root bits */\n let next; /* next available space in table */\n let base = null; /* base value table to use */\n// let shoextra; /* extra bits table to use */\n let match; /* use base and extra for symbol >= match */\n const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n let extra = null;\n\n let here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES$1 || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES$1) {\n base = extra = work; /* dummy value--not used */\n match = 20;\n\n } else if (type === LENS$1) {\n base = lbase;\n extra = lext;\n match = 257;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n match = 0;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] + 1 < match) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] >= match) {\n here_op = extra[work[sym] - match];\n here_val = base[work[sym] - match];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n\n\nvar inftrees = inflate_table;\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n\n\n\n\n\nconst CODES = 0;\nconst LENS = 1;\nconst DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_FINISH: Z_FINISH$1, Z_BLOCK, Z_TREES,\n Z_OK: Z_OK$1, Z_STREAM_END: Z_STREAM_END$1, Z_NEED_DICT: Z_NEED_DICT$1, Z_STREAM_ERROR: Z_STREAM_ERROR$1, Z_DATA_ERROR: Z_DATA_ERROR$1, Z_MEM_ERROR: Z_MEM_ERROR$1, Z_BUF_ERROR,\n Z_DEFLATED\n} = constants$2;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nconst HEAD = 16180; /* i: waiting for magic header */\nconst FLAGS = 16181; /* i: waiting for method and flags (gzip) */\nconst TIME = 16182; /* i: waiting for modification time (gzip) */\nconst OS = 16183; /* i: waiting for extra flags and operating system (gzip) */\nconst EXLEN = 16184; /* i: waiting for extra length (gzip) */\nconst EXTRA = 16185; /* i: waiting for extra bytes (gzip) */\nconst NAME = 16186; /* i: waiting for end of file name (gzip) */\nconst COMMENT = 16187; /* i: waiting for end of comment (gzip) */\nconst HCRC = 16188; /* i: waiting for header crc (gzip) */\nconst DICTID = 16189; /* i: waiting for dictionary check value */\nconst DICT = 16190; /* waiting for inflateSetDictionary() call */\nconst TYPE = 16191; /* i: waiting for type bits, including last-flag bit */\nconst TYPEDO = 16192; /* i: same, but skip check to exit inflate on new block */\nconst STORED = 16193; /* i: waiting for stored size (length and complement) */\nconst COPY_ = 16194; /* i/o: same as COPY below, but only first time in */\nconst COPY = 16195; /* i/o: waiting for input or output to copy stored block */\nconst TABLE = 16196; /* i: waiting for dynamic block table lengths */\nconst LENLENS = 16197; /* i: waiting for code length code lengths */\nconst CODELENS = 16198; /* i: waiting for length/lit and distance code lengths */\nconst LEN_ = 16199; /* i: same as LEN below, but only first time in */\nconst LEN = 16200; /* i: waiting for length/lit/eob code */\nconst LENEXT = 16201; /* i: waiting for length extra bits */\nconst DIST = 16202; /* i: waiting for distance code */\nconst DISTEXT = 16203; /* i: waiting for distance extra bits */\nconst MATCH = 16204; /* o: waiting for output space to copy string */\nconst LIT = 16205; /* o: waiting for output space to write literal */\nconst CHECK = 16206; /* i: waiting for 32-bit check value */\nconst LENGTH = 16207; /* i: waiting for 32-bit length (gzip) */\nconst DONE = 16208; /* finished check, done -- remain here until reset */\nconst BAD = 16209; /* got a data error -- remain here until reset */\nconst MEM = 16210; /* got an inflate() memory error -- remain here until reset */\nconst SYNC = 16211; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nconst ENOUGH_LENS = 852;\nconst ENOUGH_DISTS = 592;\n//const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nconst MAX_WBITS = 15;\n/* 32K LZ77 window */\nconst DEF_WBITS = MAX_WBITS;\n\n\nconst zswap32 = (q) => {\n\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n};\n\n\nfunction InflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip,\n bit 2 true to validate check value */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib), or\n -1 if raw or no header yet */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new Uint16Array(320); /* temporary storage for code lengths */\n this.work = new Uint16Array(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new Int32Array(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\n\nconst inflateStateCheck = (strm) => {\n\n if (!strm) {\n return 1;\n }\n const state = strm.state;\n if (!state || state.strm !== strm ||\n state.mode < HEAD || state.mode > SYNC) {\n return 1;\n }\n return 0;\n};\n\n\nconst inflateResetKeep = (strm) => {\n\n if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.flags = -1;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS);\n state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK$1;\n};\n\n\nconst inflateReset = (strm) => {\n\n if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n};\n\n\nconst inflateReset2 = (strm, windowBits) => {\n let wrap;\n\n /* get the state */\n if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 5;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR$1;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n};\n\n\nconst inflateInit2 = (strm, windowBits) => {\n\n if (!strm) { return Z_STREAM_ERROR$1; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n const state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.strm = strm;\n state.window = null/*Z_NULL*/;\n state.mode = HEAD; /* to pass state test in inflateReset2() */\n const ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK$1) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n};\n\n\nconst inflateInit = (strm) => {\n\n return inflateInit2(strm, DEF_WBITS);\n};\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nlet virgin = true;\n\nlet lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\n\nconst fixedtables = (state) => {\n\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n lenfix = new Int32Array(512);\n distfix = new Int32Array(32);\n\n /* literal/length table */\n let sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inftrees(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inftrees(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n};\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nconst updatewindow = (strm, src, end, copy) => {\n\n let dist;\n const state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new Uint8Array(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n state.window.set(src.subarray(end - state.wsize, end), 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n state.window.set(src.subarray(end - copy, end), 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n};\n\n\nconst inflate$2 = (strm, flush) => {\n\n let state;\n let input, output; // input/output buffers\n let next; /* next input INDEX */\n let put; /* next output INDEX */\n let have, left; /* available input and output */\n let hold; /* bit buffer */\n let bits; /* bits in bit buffer */\n let _in, _out; /* save starting available input and output */\n let copy; /* number of stored or match bytes to copy */\n let from; /* where to copy match bytes from */\n let from_source;\n let here = 0; /* current decoding table entry */\n let here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //let last; /* parent table entry */\n let last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n let len; /* length to copy for repeats, bits to drop */\n let ret; /* return code */\n const hbuf = new Uint8Array(4); /* buffer for gzip header crc calculation */\n let opts;\n\n let n; // temporary variable for NEED_BITS\n\n const order = /* permutation of code lengths */\n new Uint8Array([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]);\n\n\n if (inflateStateCheck(strm) || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR$1;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK$1;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n if (state.wbits === 0) {\n state.wbits = 15;\n }\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n if (len > 15 || len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n\n // !!! pako patch. Force use `options.windowBits` if passed.\n // Required to always use max window size by default.\n state.dmax = 1 << state.wbits;\n //state.dmax = 1 << len;\n\n state.flags = 0; /* indicate zlib header */\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32_1(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Uint8Array(state.head.extra_len);\n }\n state.head.extra.set(\n input.subarray(\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n next + copy\n ),\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if ((state.flags & 0x0200) && (state.wrap & 4)) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 4) && hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT$1;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n output.set(input.subarray(next, next + copy), put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inftrees(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inftrees(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inftrees(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inffast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if ((state.wrap & 4) && _out) {\n strm.adler = state.check =\n /*UPDATE_CHECK(state.check, put - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.wrap & 4) && (state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 4) && hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END$1;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR$1;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR$1;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR$1;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH$1))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) ;\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if ((state.wrap & 4) && _out) {\n strm.adler = state.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH$1) && ret === Z_OK$1) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n};\n\n\nconst inflateEnd = (strm) => {\n\n if (inflateStateCheck(strm)) {\n return Z_STREAM_ERROR$1;\n }\n\n let state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK$1;\n};\n\n\nconst inflateGetHeader = (strm, head) => {\n\n /* check state */\n if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR$1; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK$1;\n};\n\n\nconst inflateSetDictionary = (strm, dictionary) => {\n const dictLength = dictionary.length;\n\n let state;\n let dictid;\n let ret;\n\n /* check state */\n if (inflateStateCheck(strm)) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR$1;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32_1(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR$1;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR$1;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK$1;\n};\n\n\nvar inflateReset_1 = inflateReset;\nvar inflateReset2_1 = inflateReset2;\nvar inflateResetKeep_1 = inflateResetKeep;\nvar inflateInit_1 = inflateInit;\nvar inflateInit2_1 = inflateInit2;\nvar inflate_2$1 = inflate$2;\nvar inflateEnd_1 = inflateEnd;\nvar inflateGetHeader_1 = inflateGetHeader;\nvar inflateSetDictionary_1 = inflateSetDictionary;\nvar inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nmodule.exports.inflateCodesUsed = inflateCodesUsed;\nmodule.exports.inflateCopy = inflateCopy;\nmodule.exports.inflateGetDictionary = inflateGetDictionary;\nmodule.exports.inflateMark = inflateMark;\nmodule.exports.inflatePrime = inflatePrime;\nmodule.exports.inflateSync = inflateSync;\nmodule.exports.inflateSyncPoint = inflateSyncPoint;\nmodule.exports.inflateUndermine = inflateUndermine;\nmodule.exports.inflateValidate = inflateValidate;\n*/\n\nvar inflate_1$2 = {\n\tinflateReset: inflateReset_1,\n\tinflateReset2: inflateReset2_1,\n\tinflateResetKeep: inflateResetKeep_1,\n\tinflateInit: inflateInit_1,\n\tinflateInit2: inflateInit2_1,\n\tinflate: inflate_2$1,\n\tinflateEnd: inflateEnd_1,\n\tinflateGetHeader: inflateGetHeader_1,\n\tinflateSetDictionary: inflateSetDictionary_1,\n\tinflateInfo: inflateInfo\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nvar gzheader = GZheader;\n\nconst toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH, Z_FINISH,\n Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR\n} = constants$2;\n\n/* ===========================================================================*/\n\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * const chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate$1(options) {\n this.options = common.assign({\n chunkSize: 1024 * 64,\n windowBits: 15,\n to: ''\n }, options || {});\n\n const opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new zstream();\n this.strm.avail_out = 0;\n\n let status = inflate_1$2.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n\n this.header = new gzheader();\n\n inflate_1$2.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = inflate_1$2.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer): input data\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE\n * flush modes. See constants. Skipped or `false` means Z_NO_FLUSH,\n * `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. If end of stream detected,\n * [[Inflate#onEnd]] will be called.\n *\n * `flush_mode` is not needed for normal operation, because end of stream\n * detected automatically. You may try to use it for advanced things, but\n * this functionality was not tested.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate$1.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n const dictionary = this.options.dictionary;\n let status, _flush_mode, last_avail_out;\n\n if (this.ended) return false;\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;\n\n // Convert data if needed\n if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = inflate_1$2.inflate(strm, _flush_mode);\n\n if (status === Z_NEED_DICT && dictionary) {\n status = inflate_1$2.inflateSetDictionary(strm, dictionary);\n\n if (status === Z_OK) {\n status = inflate_1$2.inflate(strm, _flush_mode);\n } else if (status === Z_DATA_ERROR) {\n // Replace code with more verbose\n status = Z_NEED_DICT;\n }\n }\n\n // Skip snyc markers if more data follows and not raw mode\n while (strm.avail_in > 0 &&\n status === Z_STREAM_END &&\n strm.state.wrap > 0 &&\n data[strm.next_in] !== 0)\n {\n inflate_1$2.inflateReset(strm);\n status = inflate_1$2.inflate(strm, _flush_mode);\n }\n\n switch (status) {\n case Z_STREAM_ERROR:\n case Z_DATA_ERROR:\n case Z_NEED_DICT:\n case Z_MEM_ERROR:\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n // Remember real `avail_out` value, because we may patch out buffer content\n // to align utf8 strings boundaries.\n last_avail_out = strm.avail_out;\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === Z_STREAM_END) {\n\n if (this.options.to === 'string') {\n\n let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n let tail = strm.next_out - next_out_utf8;\n let utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail & realign counters\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);\n\n this.onData(utf8str);\n\n } else {\n this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));\n }\n }\n }\n\n // Must repeat iteration if out buffer is full\n if (status === Z_OK && last_avail_out === 0) continue;\n\n // Finalize if end of stream reached.\n if (status === Z_STREAM_END) {\n status = inflate_1$2.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return true;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|String): output data. When string output requested,\n * each chunk will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate$1.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate$1.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = common.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|String\n * - data (Uint8Array|ArrayBuffer): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako');\n * const input = pako.deflate(new Uint8Array([1,2,3,4,5,6,7,8,9]));\n * let output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err) {\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate$1(input, options) {\n const inflator = new Inflate$1(options);\n\n inflator.push(input);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) throw inflator.msg || messages[inflator.err];\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|String\n * - data (Uint8Array|ArrayBuffer): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw$1(input, options) {\n options = options || {};\n options.raw = true;\n return inflate$1(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|String\n * - data (Uint8Array|ArrayBuffer): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nvar Inflate_1$1 = Inflate$1;\nvar inflate_2 = inflate$1;\nvar inflateRaw_1$1 = inflateRaw$1;\nvar ungzip$1 = inflate$1;\nvar constants = constants$2;\n\nvar inflate_1$1 = {\n\tInflate: Inflate_1$1,\n\tinflate: inflate_2,\n\tinflateRaw: inflateRaw_1$1,\n\tungzip: ungzip$1,\n\tconstants: constants\n};\n\nconst { Deflate, deflate, deflateRaw, gzip } = deflate_1$1;\n\nconst { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1;\n\n\n\nvar Deflate_1 = Deflate;\nvar deflate_1 = deflate;\nvar deflateRaw_1 = deflateRaw;\nvar gzip_1 = gzip;\nvar Inflate_1 = Inflate;\nvar inflate_1 = inflate;\nvar inflateRaw_1 = inflateRaw;\nvar ungzip_1 = ungzip;\nvar constants_1 = constants$2;\n\nvar pako = {\n\tDeflate: Deflate_1,\n\tdeflate: deflate_1,\n\tdeflateRaw: deflateRaw_1,\n\tgzip: gzip_1,\n\tInflate: Inflate_1,\n\tinflate: inflate_1,\n\tinflateRaw: inflateRaw_1,\n\tungzip: ungzip_1,\n\tconstants: constants_1\n};\n\nexport { Deflate_1 as Deflate, Inflate_1 as Inflate, constants_1 as constants, pako as default, deflate_1 as deflate, deflateRaw_1 as deflateRaw, gzip_1 as gzip, inflate_1 as inflate, inflateRaw_1 as inflateRaw, ungzip_1 as ungzip };\n","import { inflateRaw } from 'pako';\nexport function unzip(input) {\n return inflateRaw(input.subarray(2));\n}\n//# sourceMappingURL=unzip-pako.js.map","/* eslint no-bitwise: [\"error\", { \"allow\": [\"|\"] }] */\nexport class AbortError extends Error {\n constructor(message) {\n super(message);\n this.code = 'ERR_ABORTED';\n }\n}\n// sort blocks by file offset and\n// group blocks that are within 2KB of eachother\nexport function groupBlocks(blocks) {\n blocks.sort((b0, b1) => Number(b0.offset) - Number(b1.offset));\n const blockGroups = [];\n let lastBlock;\n let lastBlockEnd;\n for (let i = 0; i < blocks.length; i += 1) {\n if (lastBlock &&\n lastBlockEnd &&\n Number(blocks[i].offset) - lastBlockEnd <= 2000) {\n lastBlock.length = BigInt(Number(lastBlock.length) +\n Number(blocks[i].length) -\n lastBlockEnd +\n Number(blocks[i].offset));\n lastBlock.blocks.push(blocks[i]);\n }\n else {\n blockGroups.push((lastBlock = {\n blocks: [blocks[i]],\n length: blocks[i].length,\n offset: blocks[i].offset,\n }));\n }\n lastBlockEnd = Number(lastBlock.offset) + Number(lastBlock.length);\n }\n return blockGroups;\n}\n/**\n * Properly check if the given AbortSignal is aborted.\n * Per the standard, if the signal reads as aborted,\n * this function throws either a DOMException AbortError, or a regular error\n * with a `code` attribute set to `ERR_ABORTED`.\n *\n * For convenience, passing `undefined` is a no-op\n *\n * @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute\n * @returns nothing\n */\nexport function checkAbortSignal(signal) {\n if (!signal) {\n return;\n }\n if (signal.aborted) {\n // console.log('bam aborted!')\n if (typeof DOMException !== 'undefined') {\n throw new DOMException('aborted', 'AbortError');\n }\n else {\n const e = new AbortError('aborted');\n e.code = 'ERR_ABORTED';\n throw e;\n }\n }\n}\n/**\n * Skips to the next tick, then runs `checkAbortSignal`.\n * Await this to inside an otherwise synchronous loop to\n * provide a place to break when an abort signal is received.\n * @param {AbortSignal} signal\n */\nexport async function abortBreakPoint(signal) {\n await Promise.resolve();\n checkAbortSignal(signal);\n}\n//# sourceMappingURL=util.js.map","import { Buffer } from 'buffer';\nimport { Parser } from 'binary-parser';\nimport AbortablePromiseCache from 'abortable-promise-cache';\nimport QuickLRU from 'quick-lru';\n// locals\nimport Range from './range';\nimport { unzip } from './unzip';\nimport { groupBlocks, checkAbortSignal } from './util';\nconst BIG_WIG_TYPE_GRAPH = 1;\nconst BIG_WIG_TYPE_VSTEP = 2;\nconst BIG_WIG_TYPE_FSTEP = 3;\nfunction coordFilter(s1, e1, s2, e2) {\n return s1 < e2 && e1 >= s2;\n}\nfunction getParsers(isBigEndian) {\n const le = isBigEndian ? 'big' : 'little';\n const summaryParser = new Parser()\n .endianess(le)\n .uint32('chromId')\n .uint32('start')\n .uint32('end')\n .uint32('validCnt')\n .floatle('minScore')\n .floatle('maxScore')\n .floatle('sumData')\n .floatle('sumSqData')\n .saveOffset('offset');\n const leafParser = new Parser()\n .endianess(le)\n .uint8('isLeaf')\n .skip(1)\n .uint16('cnt')\n .choice({\n tag: 'isLeaf',\n choices: {\n 1: new Parser().endianess(le).array('blocksToFetch', {\n length: 'cnt',\n type: new Parser()\n .endianess(le)\n .uint32('startChrom')\n .uint32('startBase')\n .uint32('endChrom')\n .uint32('endBase')\n .uint64('blockOffset')\n .uint64('blockSize')\n .saveOffset('offset'),\n }),\n 0: new Parser().array('recurOffsets', {\n length: 'cnt',\n type: new Parser()\n .endianess(le)\n .uint32('startChrom')\n .uint32('startBase')\n .uint32('endChrom')\n .uint32('endBase')\n .uint64('blockOffset')\n .saveOffset('offset'),\n }),\n },\n });\n const bigBedParser = new Parser()\n .endianess(le)\n .uint32('chromId')\n .int32('start')\n .int32('end')\n .string('rest', {\n zeroTerminated: true,\n })\n .saveOffset('offset');\n const bigWigParser = new Parser()\n .endianess(le)\n .skip(4)\n .int32('blockStart')\n .skip(4)\n .uint32('itemStep')\n .uint32('itemSpan')\n .uint8('blockType')\n .skip(1)\n .uint16('itemCount')\n .choice({\n tag: 'blockType',\n choices: {\n [BIG_WIG_TYPE_FSTEP]: new Parser().array('items', {\n length: 'itemCount',\n type: new Parser().floatle('score'),\n }),\n [BIG_WIG_TYPE_VSTEP]: new Parser().array('items', {\n length: 'itemCount',\n type: new Parser().endianess(le).int32('start').floatle('score'),\n }),\n [BIG_WIG_TYPE_GRAPH]: new Parser().array('items', {\n length: 'itemCount',\n type: new Parser()\n .endianess(le)\n .int32('start')\n .int32('end')\n .floatle('score'),\n }),\n },\n });\n return {\n bigWigParser,\n bigBedParser,\n summaryParser,\n leafParser,\n };\n}\n/**\n * View into a subset of the data in a BigWig file.\n *\n * Adapted by Robert Buels and Colin Diesh from bigwig.js in the Dalliance Genome\n * Explorer by Thomas Down.\n * @constructs\n */\nexport class BlockView {\n constructor(bbi, refsByName, cirTreeOffset, isBigEndian, isCompressed, blockType) {\n this.bbi = bbi;\n this.refsByName = refsByName;\n this.cirTreeOffset = cirTreeOffset;\n this.isBigEndian = isBigEndian;\n this.isCompressed = isCompressed;\n this.blockType = blockType;\n this.featureCache = new AbortablePromiseCache({\n cache: new QuickLRU({ maxSize: 1000 }),\n fill: async (requestData, signal) => {\n const len = Number(requestData.length);\n const off = Number(requestData.offset);\n const { buffer } = await this.bbi.read(Buffer.alloc(len), 0, len, off, {\n signal,\n });\n return buffer;\n },\n });\n if (!(cirTreeOffset >= 0)) {\n throw new Error('invalid cirTreeOffset!');\n }\n const parsers = getParsers(isBigEndian);\n this.leafParser = parsers.leafParser;\n this.bigBedParser = parsers.bigBedParser;\n }\n async readWigData(chrName, start, end, observer, opts) {\n try {\n const { refsByName, bbi, cirTreeOffset, isBigEndian } = this;\n const chrId = refsByName[chrName];\n if (chrId === undefined) {\n observer.complete();\n }\n const request = { chrId, start, end };\n if (!this.cirTreePromise) {\n this.cirTreePromise = bbi.read(Buffer.alloc(48), 0, 48, Number(cirTreeOffset), opts);\n }\n const { buffer } = await this.cirTreePromise;\n const cirBlockSize = isBigEndian\n ? buffer.readUInt32BE(4)\n : buffer.readUInt32LE(4);\n let blocksToFetch = [];\n let outstanding = 0;\n const cirFobRecur2 = (cirBlockData, offset, level) => {\n try {\n const data = cirBlockData.subarray(offset);\n const p = this.leafParser.parse(data);\n if (p.blocksToFetch) {\n blocksToFetch = blocksToFetch.concat(p.blocksToFetch\n .filter(filterFeats)\n .map((l) => ({\n offset: l.blockOffset,\n length: l.blockSize,\n })));\n }\n if (p.recurOffsets) {\n const recurOffsets = p.recurOffsets\n .filter(filterFeats)\n .map(l => Number(l.blockOffset));\n if (recurOffsets.length > 0) {\n cirFobRecur(recurOffsets, level + 1);\n }\n }\n }\n catch (e) {\n observer.error(e);\n }\n };\n const filterFeats = (b) => {\n const { startChrom, startBase, endChrom, endBase } = b;\n return ((startChrom < chrId || (startChrom === chrId && startBase <= end)) &&\n (endChrom > chrId || (endChrom === chrId && endBase >= start)));\n };\n const cirFobStartFetch = async (off, fr, level) => {\n try {\n const length = fr.max() - fr.min();\n const offset = fr.min();\n const resultBuffer = await this.featureCache.get(`${length}_${offset}`, { length, offset }, opts.signal);\n for (let i = 0; i < off.length; i += 1) {\n if (fr.contains(off[i])) {\n cirFobRecur2(resultBuffer, off[i] - offset, level);\n outstanding -= 1;\n if (outstanding === 0) {\n this.readFeatures(observer, blocksToFetch, { ...opts, request });\n }\n }\n }\n }\n catch (e) {\n observer.error(e);\n }\n };\n const cirFobRecur = (offset, level) => {\n try {\n outstanding += offset.length;\n const maxCirBlockSpan = 4 + Number(cirBlockSize) * 32; // Upper bound on size, based on a completely full leaf node.\n let spans = new Range(offset[0], offset[0] + maxCirBlockSpan);\n for (let i = 1; i < offset.length; i += 1) {\n const blockSpan = new Range(offset[i], offset[i] + maxCirBlockSpan);\n spans = spans.union(blockSpan);\n }\n spans.getRanges().map(fr => cirFobStartFetch(offset, fr, level));\n }\n catch (e) {\n observer.error(e);\n }\n };\n return cirFobRecur([Number(cirTreeOffset) + 48], 1);\n }\n catch (e) {\n observer.error(e);\n }\n }\n parseSummaryBlock(buffer, startOffset, request) {\n const features = [];\n let offset = startOffset;\n const dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.length);\n while (offset < buffer.byteLength) {\n // this was extracted from looking at the runtime code generated by\n // binary-parser\n const chromId = dataView.getUint32(offset, true);\n offset += 4;\n const start = dataView.getUint32(offset, true);\n offset += 4;\n const end = dataView.getUint32(offset, true);\n offset += 4;\n const validCnt = dataView.getUint32(offset, true);\n offset += 4;\n const minScore = dataView.getFloat32(offset, true);\n offset += 4;\n const maxScore = dataView.getFloat32(offset, true);\n offset += 4;\n const sumData = dataView.getFloat32(offset, true);\n offset += 4;\n // unused\n // const sumSqData = dataView.getFloat32(offset, true)\n offset += 4;\n if (request\n ? chromId === request.chrId &&\n coordFilter(start, end, request.start, request.end)\n : true) {\n features.push({\n start,\n end,\n maxScore,\n minScore,\n summary: true,\n score: sumData / (validCnt || 1),\n });\n }\n }\n return features;\n }\n parseBigBedBlock(data, startOffset, offset, request) {\n const items = [];\n let currOffset = startOffset;\n while (currOffset < data.byteLength) {\n const res = this.bigBedParser.parse(data.subarray(currOffset));\n items.push({ ...res, uniqueId: `bb-${offset + currOffset}` });\n currOffset += res.offset;\n }\n return request\n ? items.filter((f) => coordFilter(f.start, f.end, request.start, request.end))\n : items;\n }\n parseBigWigBlock(buffer, startOffset, request) {\n const b = buffer.subarray(startOffset);\n const dataView = new DataView(b.buffer, b.byteOffset, b.length);\n let offset = 0;\n offset += 4;\n const blockStart = dataView.getInt32(offset, true);\n offset += 8;\n const itemStep = dataView.getUint32(offset, true);\n offset += 4;\n const itemSpan = dataView.getUint32(offset, true);\n offset += 4;\n const blockType = dataView.getUint8(offset);\n offset += 2;\n const itemCount = dataView.getUint16(offset, true);\n offset += 2;\n const items = new Array(itemCount);\n switch (blockType) {\n case 1:\n for (let i = 0; i < itemCount; i++) {\n const start = dataView.getInt32(offset, true);\n offset += 4;\n const end = dataView.getInt32(offset, true);\n offset += 4;\n const score = dataView.getFloat32(offset, true);\n offset += 4;\n items[i] = { start, end, score };\n }\n break;\n case 2:\n for (let i = 0; i < itemCount; i++) {\n const start = dataView.getInt32(offset, true);\n offset += 4;\n const score = dataView.getFloat32(offset, true);\n offset += 4;\n items[i] = { score, start, end: start + itemSpan };\n }\n break;\n case 3:\n for (let i = 0; i < itemCount; i++) {\n const score = dataView.getFloat32(offset, true);\n offset += 4;\n const start = blockStart + i * itemStep;\n items[i] = { score, start, end: start + itemSpan };\n }\n break;\n }\n return request\n ? items.filter((f) => coordFilter(f.start, f.end, request.start, request.end))\n : items;\n }\n async readFeatures(observer, blocks, opts = {}) {\n try {\n const { blockType, isCompressed } = this;\n const { signal, request } = opts;\n const blockGroupsToFetch = groupBlocks(blocks);\n checkAbortSignal(signal);\n await Promise.all(blockGroupsToFetch.map(async (blockGroup) => {\n checkAbortSignal(signal);\n const { length, offset } = blockGroup;\n const data = await this.featureCache.get(`${length}_${offset}`, blockGroup, signal);\n blockGroup.blocks.forEach(block => {\n checkAbortSignal(signal);\n let blockOffset = Number(block.offset) - Number(blockGroup.offset);\n let resultData = data;\n if (isCompressed) {\n resultData = unzip(data.subarray(blockOffset));\n blockOffset = 0;\n }\n checkAbortSignal(signal);\n switch (blockType) {\n case 'summary':\n observer.next(this.parseSummaryBlock(resultData, blockOffset, request));\n break;\n case 'bigwig':\n observer.next(this.parseBigWigBlock(resultData, blockOffset, request));\n break;\n case 'bigbed':\n observer.next(this.parseBigBedBlock(resultData, blockOffset, Number(block.offset) * (1 << 8), request));\n break;\n default:\n console.warn(`Don't know what to do with ${blockType}`);\n }\n });\n }));\n observer.complete();\n }\n catch (e) {\n observer.error(e);\n }\n }\n}\n//# sourceMappingURL=blockView.js.map","/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n function next() {\n while (env.stack.length) {\n var rec = env.stack.pop();\n try {\n var result = rec.dispose && rec.dispose.call(rec.value);\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n catch (e) {\n fail(e);\n }\n }\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n};\n","export function isFunction(value) {\n return typeof value === 'function';\n}\n//# sourceMappingURL=isFunction.js.map","export function createErrorClass(createImpl) {\n var _super = function (instance) {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n var ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n//# sourceMappingURL=createErrorClass.js.map","import { createErrorClass } from './createErrorClass';\nexport var UnsubscriptionError = createErrorClass(function (_super) {\n return function UnsubscriptionErrorImpl(errors) {\n _super(this);\n this.message = errors\n ? errors.length + \" errors occurred during unsubscription:\\n\" + errors.map(function (err, i) { return i + 1 + \") \" + err.toString(); }).join('\\n ')\n : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n };\n});\n//# sourceMappingURL=UnsubscriptionError.js.map","export function arrRemove(arr, item) {\n if (arr) {\n var index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n//# sourceMappingURL=arrRemove.js.map","import { __read, __spreadArray, __values } from \"tslib\";\nimport { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { arrRemove } from './util/arrRemove';\nvar Subscription = (function () {\n function Subscription(initialTeardown) {\n this.initialTeardown = initialTeardown;\n this.closed = false;\n this._parentage = null;\n this._finalizers = null;\n }\n Subscription.prototype.unsubscribe = function () {\n var e_1, _a, e_2, _b;\n var errors;\n if (!this.closed) {\n this.closed = true;\n var _parentage = this._parentage;\n if (_parentage) {\n this._parentage = null;\n if (Array.isArray(_parentage)) {\n try {\n for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {\n var parent_1 = _parentage_1_1.value;\n parent_1.remove(this);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n }\n else {\n _parentage.remove(this);\n }\n }\n var initialFinalizer = this.initialTeardown;\n if (isFunction(initialFinalizer)) {\n try {\n initialFinalizer();\n }\n catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\n }\n }\n var _finalizers = this._finalizers;\n if (_finalizers) {\n this._finalizers = null;\n try {\n for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {\n var finalizer = _finalizers_1_1.value;\n try {\n execFinalizer(finalizer);\n }\n catch (err) {\n errors = errors !== null && errors !== void 0 ? errors : [];\n if (err instanceof UnsubscriptionError) {\n errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));\n }\n else {\n errors.push(err);\n }\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n }\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n };\n Subscription.prototype.add = function (teardown) {\n var _a;\n if (teardown && teardown !== this) {\n if (this.closed) {\n execFinalizer(teardown);\n }\n else {\n if (teardown instanceof Subscription) {\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);\n }\n }\n };\n Subscription.prototype._hasParent = function (parent) {\n var _parentage = this._parentage;\n return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));\n };\n Subscription.prototype._addParent = function (parent) {\n var _parentage = this._parentage;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n };\n Subscription.prototype._removeParent = function (parent) {\n var _parentage = this._parentage;\n if (_parentage === parent) {\n this._parentage = null;\n }\n else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n };\n Subscription.prototype.remove = function (teardown) {\n var _finalizers = this._finalizers;\n _finalizers && arrRemove(_finalizers, teardown);\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n };\n Subscription.EMPTY = (function () {\n var empty = new Subscription();\n empty.closed = true;\n return empty;\n })();\n return Subscription;\n}());\nexport { Subscription };\nexport var EMPTY_SUBSCRIPTION = Subscription.EMPTY;\nexport function isSubscription(value) {\n return (value instanceof Subscription ||\n (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));\n}\nfunction execFinalizer(finalizer) {\n if (isFunction(finalizer)) {\n finalizer();\n }\n else {\n finalizer.unsubscribe();\n }\n}\n//# sourceMappingURL=Subscription.js.map","export var config = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false,\n};\n//# sourceMappingURL=config.js.map","import { __read, __spreadArray } from \"tslib\";\nexport var timeoutProvider = {\n setTimeout: function (handler, timeout) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n var delegate = timeoutProvider.delegate;\n if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {\n return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));\n }\n return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));\n },\n clearTimeout: function (handle) {\n var delegate = timeoutProvider.delegate;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);\n },\n delegate: undefined,\n};\n//# sourceMappingURL=timeoutProvider.js.map","import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\nexport function reportUnhandledError(err) {\n timeoutProvider.setTimeout(function () {\n var onUnhandledError = config.onUnhandledError;\n if (onUnhandledError) {\n onUnhandledError(err);\n }\n else {\n throw err;\n }\n });\n}\n//# sourceMappingURL=reportUnhandledError.js.map","export function noop() { }\n//# sourceMappingURL=noop.js.map","import { config } from '../config';\nvar context = null;\nexport function errorContext(cb) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n var isRoot = !context;\n if (isRoot) {\n context = { errorThrown: false, error: null };\n }\n cb();\n if (isRoot) {\n var _a = context, errorThrown = _a.errorThrown, error = _a.error;\n context = null;\n if (errorThrown) {\n throw error;\n }\n }\n }\n else {\n cb();\n }\n}\nexport function captureError(err) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n//# sourceMappingURL=errorContext.js.map","import { __extends } from \"tslib\";\nimport { isFunction } from './util/isFunction';\nimport { isSubscription, Subscription } from './Subscription';\nimport { config } from './config';\nimport { reportUnhandledError } from './util/reportUnhandledError';\nimport { noop } from './util/noop';\nimport { nextNotification, errorNotification, COMPLETE_NOTIFICATION } from './NotificationFactories';\nimport { timeoutProvider } from './scheduler/timeoutProvider';\nimport { captureError } from './util/errorContext';\nvar Subscriber = (function (_super) {\n __extends(Subscriber, _super);\n function Subscriber(destination) {\n var _this = _super.call(this) || this;\n _this.isStopped = false;\n if (destination) {\n _this.destination = destination;\n if (isSubscription(destination)) {\n destination.add(_this);\n }\n }\n else {\n _this.destination = EMPTY_OBSERVER;\n }\n return _this;\n }\n Subscriber.create = function (next, error, complete) {\n return new SafeSubscriber(next, error, complete);\n };\n Subscriber.prototype.next = function (value) {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n }\n else {\n this._next(value);\n }\n };\n Subscriber.prototype.error = function (err) {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n }\n else {\n this.isStopped = true;\n this._error(err);\n }\n };\n Subscriber.prototype.complete = function () {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n }\n else {\n this.isStopped = true;\n this._complete();\n }\n };\n Subscriber.prototype.unsubscribe = function () {\n if (!this.closed) {\n this.isStopped = true;\n _super.prototype.unsubscribe.call(this);\n this.destination = null;\n }\n };\n Subscriber.prototype._next = function (value) {\n this.destination.next(value);\n };\n Subscriber.prototype._error = function (err) {\n try {\n this.destination.error(err);\n }\n finally {\n this.unsubscribe();\n }\n };\n Subscriber.prototype._complete = function () {\n try {\n this.destination.complete();\n }\n finally {\n this.unsubscribe();\n }\n };\n return Subscriber;\n}(Subscription));\nexport { Subscriber };\nvar _bind = Function.prototype.bind;\nfunction bind(fn, thisArg) {\n return _bind.call(fn, thisArg);\n}\nvar ConsumerObserver = (function () {\n function ConsumerObserver(partialObserver) {\n this.partialObserver = partialObserver;\n }\n ConsumerObserver.prototype.next = function (value) {\n var partialObserver = this.partialObserver;\n if (partialObserver.next) {\n try {\n partialObserver.next(value);\n }\n catch (error) {\n handleUnhandledError(error);\n }\n }\n };\n ConsumerObserver.prototype.error = function (err) {\n var partialObserver = this.partialObserver;\n if (partialObserver.error) {\n try {\n partialObserver.error(err);\n }\n catch (error) {\n handleUnhandledError(error);\n }\n }\n else {\n handleUnhandledError(err);\n }\n };\n ConsumerObserver.prototype.complete = function () {\n var partialObserver = this.partialObserver;\n if (partialObserver.complete) {\n try {\n partialObserver.complete();\n }\n catch (error) {\n handleUnhandledError(error);\n }\n }\n };\n return ConsumerObserver;\n}());\nvar SafeSubscriber = (function (_super) {\n __extends(SafeSubscriber, _super);\n function SafeSubscriber(observerOrNext, error, complete) {\n var _this = _super.call(this) || this;\n var partialObserver;\n if (isFunction(observerOrNext) || !observerOrNext) {\n partialObserver = {\n next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),\n error: error !== null && error !== void 0 ? error : undefined,\n complete: complete !== null && complete !== void 0 ? complete : undefined,\n };\n }\n else {\n var context_1;\n if (_this && config.useDeprecatedNextContext) {\n context_1 = Object.create(observerOrNext);\n context_1.unsubscribe = function () { return _this.unsubscribe(); };\n partialObserver = {\n next: observerOrNext.next && bind(observerOrNext.next, context_1),\n error: observerOrNext.error && bind(observerOrNext.error, context_1),\n complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),\n };\n }\n else {\n partialObserver = observerOrNext;\n }\n }\n _this.destination = new ConsumerObserver(partialObserver);\n return _this;\n }\n return SafeSubscriber;\n}(Subscriber));\nexport { SafeSubscriber };\nfunction handleUnhandledError(error) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(error);\n }\n else {\n reportUnhandledError(error);\n }\n}\nfunction defaultErrorHandler(err) {\n throw err;\n}\nfunction handleStoppedNotification(notification, subscriber) {\n var onStoppedNotification = config.onStoppedNotification;\n onStoppedNotification && timeoutProvider.setTimeout(function () { return onStoppedNotification(notification, subscriber); });\n}\nexport var EMPTY_OBSERVER = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop,\n};\n//# sourceMappingURL=Subscriber.js.map","export var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();\n//# sourceMappingURL=observable.js.map","export function identity(x) {\n return x;\n}\n//# sourceMappingURL=identity.js.map","import { identity } from './identity';\nexport function pipe() {\n var fns = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n fns[_i] = arguments[_i];\n }\n return pipeFromArray(fns);\n}\nexport function pipeFromArray(fns) {\n if (fns.length === 0) {\n return identity;\n }\n if (fns.length === 1) {\n return fns[0];\n }\n return function piped(input) {\n return fns.reduce(function (prev, fn) { return fn(prev); }, input);\n };\n}\n//# sourceMappingURL=pipe.js.map","import { SafeSubscriber, Subscriber } from './Subscriber';\nimport { isSubscription } from './Subscription';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nimport { isFunction } from './util/isFunction';\nimport { errorContext } from './util/errorContext';\nvar Observable = (function () {\n function Observable(subscribe) {\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n Observable.prototype.lift = function (operator) {\n var observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n };\n Observable.prototype.subscribe = function (observerOrNext, error, complete) {\n var _this = this;\n var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);\n errorContext(function () {\n var _a = _this, operator = _a.operator, source = _a.source;\n subscriber.add(operator\n ?\n operator.call(subscriber, source)\n : source\n ?\n _this._subscribe(subscriber)\n :\n _this._trySubscribe(subscriber));\n });\n return subscriber;\n };\n Observable.prototype._trySubscribe = function (sink) {\n try {\n return this._subscribe(sink);\n }\n catch (err) {\n sink.error(err);\n }\n };\n Observable.prototype.forEach = function (next, promiseCtor) {\n var _this = this;\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor(function (resolve, reject) {\n var subscriber = new SafeSubscriber({\n next: function (value) {\n try {\n next(value);\n }\n catch (err) {\n reject(err);\n subscriber.unsubscribe();\n }\n },\n error: reject,\n complete: resolve,\n });\n _this.subscribe(subscriber);\n });\n };\n Observable.prototype._subscribe = function (subscriber) {\n var _a;\n return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);\n };\n Observable.prototype[Symbol_observable] = function () {\n return this;\n };\n Observable.prototype.pipe = function () {\n var operations = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n operations[_i] = arguments[_i];\n }\n return pipeFromArray(operations)(this);\n };\n Observable.prototype.toPromise = function (promiseCtor) {\n var _this = this;\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor(function (resolve, reject) {\n var value;\n _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });\n });\n };\n Observable.create = function (subscribe) {\n return new Observable(subscribe);\n };\n return Observable;\n}());\nexport { Observable };\nfunction getPromiseCtor(promiseCtor) {\n var _a;\n return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;\n}\nfunction isObserver(value) {\n return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);\n}\nfunction isSubscriber(value) {\n return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));\n}\n//# sourceMappingURL=Observable.js.map","import { isFunction } from './isFunction';\nexport function hasLift(source) {\n return isFunction(source === null || source === void 0 ? void 0 : source.lift);\n}\nexport function operate(init) {\n return function (source) {\n if (hasLift(source)) {\n return source.lift(function (liftedSource) {\n try {\n return init(liftedSource, this);\n }\n catch (err) {\n this.error(err);\n }\n });\n }\n throw new TypeError('Unable to lift unknown Observable type');\n };\n}\n//# sourceMappingURL=lift.js.map","import { __extends } from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nexport function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {\n return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);\n}\nvar OperatorSubscriber = (function (_super) {\n __extends(OperatorSubscriber, _super);\n function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {\n var _this = _super.call(this, destination) || this;\n _this.onFinalize = onFinalize;\n _this.shouldUnsubscribe = shouldUnsubscribe;\n _this._next = onNext\n ? function (value) {\n try {\n onNext(value);\n }\n catch (err) {\n destination.error(err);\n }\n }\n : _super.prototype._next;\n _this._error = onError\n ? function (err) {\n try {\n onError(err);\n }\n catch (err) {\n destination.error(err);\n }\n finally {\n this.unsubscribe();\n }\n }\n : _super.prototype._error;\n _this._complete = onComplete\n ? function () {\n try {\n onComplete();\n }\n catch (err) {\n destination.error(err);\n }\n finally {\n this.unsubscribe();\n }\n }\n : _super.prototype._complete;\n return _this;\n }\n OperatorSubscriber.prototype.unsubscribe = function () {\n var _a;\n if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {\n var closed_1 = this.closed;\n _super.prototype.unsubscribe.call(this);\n !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));\n }\n };\n return OperatorSubscriber;\n}(Subscriber));\nexport { OperatorSubscriber };\n//# sourceMappingURL=OperatorSubscriber.js.map","import { createErrorClass } from './createErrorClass';\nexport var EmptyError = createErrorClass(function (_super) { return function EmptyErrorImpl() {\n _super(this);\n this.name = 'EmptyError';\n this.message = 'no elements in sequence';\n}; });\n//# sourceMappingURL=EmptyError.js.map","import { EmptyError } from './util/EmptyError';\nimport { SafeSubscriber } from './Subscriber';\nexport function firstValueFrom(source, config) {\n var hasConfig = typeof config === 'object';\n return new Promise(function (resolve, reject) {\n var subscriber = new SafeSubscriber({\n next: function (value) {\n resolve(value);\n subscriber.unsubscribe();\n },\n error: reject,\n complete: function () {\n if (hasConfig) {\n resolve(config.defaultValue);\n }\n else {\n reject(new EmptyError());\n }\n },\n });\n source.subscribe(subscriber);\n });\n}\n//# sourceMappingURL=firstValueFrom.js.map","import { createOperatorSubscriber } from './OperatorSubscriber';\nexport function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {\n return function (source, subscriber) {\n var hasState = hasSeed;\n var state = seed;\n var index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, function (value) {\n var i = index++;\n state = hasState\n ?\n accumulator(state, value, i)\n :\n ((hasState = true), value);\n emitOnNext && subscriber.next(state);\n }, emitBeforeComplete &&\n (function () {\n hasState && subscriber.next(state);\n subscriber.complete();\n })));\n };\n}\n//# sourceMappingURL=scanInternals.js.map","import { scanInternals } from './scanInternals';\nimport { operate } from '../util/lift';\nexport function reduce(accumulator, seed) {\n return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true));\n}\n//# sourceMappingURL=reduce.js.map","import { reduce } from './reduce';\nimport { operate } from '../util/lift';\nvar arrReducer = function (arr, value) { return (arr.push(value), arr); };\nexport function toArray() {\n return operate(function (source, subscriber) {\n reduce(arrReducer, [])(source).subscribe(subscriber);\n });\n}\n//# sourceMappingURL=toArray.js.map","import { Buffer } from 'buffer';\nimport { Parser } from 'binary-parser';\nimport { LocalFile, RemoteFile } from 'generic-filehandle';\nimport { firstValueFrom, Observable } from 'rxjs';\nimport { toArray } from 'rxjs/operators';\nimport { BlockView } from './blockView';\nconst BIG_WIG_MAGIC = -2003829722;\nconst BIG_BED_MAGIC = -2021002517;\nfunction toString(arr) {\n return new TextDecoder().decode(arr);\n}\n/* get the compiled parsers for different sections of the bigwig file\n *\n * @param isBE - is big endian, typically false\n * @return an object with compiled parsers\n */\nfunction getParsers(isBE) {\n const le = isBE ? 'big' : 'little';\n const headerParser = new Parser()\n .endianess(le)\n .int32('magic')\n .uint16('version')\n .uint16('numZoomLevels')\n .uint64('chromTreeOffset')\n .uint64('unzoomedDataOffset')\n .uint64('unzoomedIndexOffset')\n .uint16('fieldCount')\n .uint16('definedFieldCount')\n .uint64('asOffset') // autoSql offset, used in bigbed\n .uint64('totalSummaryOffset')\n .uint32('uncompressBufSize')\n .uint64('extHeaderOffset') // name index offset, used in bigbed\n .array('zoomLevels', {\n length: 'numZoomLevels',\n type: new Parser()\n .endianess(le)\n .uint32('reductionLevel')\n .uint32('reserved')\n .uint64('dataOffset')\n .uint64('indexOffset'),\n });\n const totalSummaryParser = new Parser()\n .endianess(le)\n .uint64('basesCovered')\n .doublele('scoreMin')\n .doublele('scoreMax')\n .doublele('scoreSum')\n .doublele('scoreSumSquares');\n const chromTreeParser = new Parser()\n .endianess(le)\n .uint32('magic')\n .uint32('blockSize')\n .uint32('keySize')\n .uint32('valSize')\n .uint64('itemCount');\n const isLeafNode = new Parser()\n .endianess(le)\n .uint8('isLeafNode')\n .skip(1)\n .uint16('cnt')\n .saveOffset('offset');\n return {\n chromTreeParser,\n totalSummaryParser,\n headerParser,\n isLeafNode,\n };\n}\nexport class BBI {\n /* fetch and parse header information from a bigwig or bigbed file\n * @param abortSignal - abort the operation, can be null\n * @return a Header object\n */\n getHeader(opts = {}) {\n const options = 'aborted' in opts ? { signal: opts } : opts;\n if (!this.headerP) {\n this.headerP = this._getHeader(options).catch(e => {\n this.headerP = undefined;\n throw e;\n });\n }\n return this.headerP;\n }\n /*\n * @param filehandle - a filehandle from generic-filehandle or implementing something similar to the node10 fs.promises API\n * @param path - a Local file path as a string\n * @param url - a URL string\n * @param renameRefSeqs - an optional method to rename the internal reference sequences using a mapping function\n */\n constructor(options = {}) {\n const { filehandle, renameRefSeqs = s => s, path, url } = options;\n this.renameRefSeqs = renameRefSeqs;\n if (filehandle) {\n this.bbi = filehandle;\n }\n else if (url) {\n this.bbi = new RemoteFile(url);\n }\n else if (path) {\n this.bbi = new LocalFile(path);\n }\n else {\n throw new Error('no file given');\n }\n }\n async _getHeader(opts) {\n const header = await this._getMainHeader(opts);\n const chroms = await this._readChromTree(header, opts);\n return { ...header, ...chroms };\n }\n async _getMainHeader(opts, requestSize = 2000) {\n const { buffer } = await this.bbi.read(Buffer.alloc(requestSize), 0, requestSize, 0, opts);\n const isBigEndian = this._isBigEndian(buffer);\n const ret = getParsers(isBigEndian);\n const header = ret.headerParser.parse(buffer);\n const { magic, asOffset, totalSummaryOffset } = header;\n header.fileType = magic === BIG_BED_MAGIC ? 'bigbed' : 'bigwig';\n if (asOffset > requestSize || totalSummaryOffset > requestSize) {\n return this._getMainHeader(opts, requestSize * 2);\n }\n if (asOffset) {\n const off = Number(header.asOffset);\n header.autoSql = toString(buffer.subarray(off, buffer.indexOf(0, off)));\n }\n if (header.totalSummaryOffset > requestSize) {\n return this._getMainHeader(opts, requestSize * 2);\n }\n if (header.totalSummaryOffset) {\n const tail = buffer.subarray(Number(header.totalSummaryOffset));\n const sum = ret.totalSummaryParser.parse(tail);\n header.totalSummary = { ...sum, basesCovered: Number(sum.basesCovered) };\n }\n return { ...header, isBigEndian };\n }\n _isBigEndian(buffer) {\n let ret = buffer.readInt32LE(0);\n if (ret === BIG_WIG_MAGIC || ret === BIG_BED_MAGIC) {\n return false;\n }\n ret = buffer.readInt32BE(0);\n if (ret === BIG_WIG_MAGIC || ret === BIG_BED_MAGIC) {\n return true;\n }\n throw new Error('not a BigWig/BigBed file');\n }\n // todo: add progress if long running\n async _readChromTree(header, opts) {\n const isBE = header.isBigEndian;\n const le = isBE ? 'big' : 'little';\n const refsByNumber = [];\n const refsByName = {};\n let unzoomedDataOffset = Number(header.unzoomedDataOffset);\n const chromTreeOffset = Number(header.chromTreeOffset);\n while (unzoomedDataOffset % 4 !== 0) {\n unzoomedDataOffset += 1;\n }\n const off = unzoomedDataOffset - chromTreeOffset;\n const { buffer } = await this.bbi.read(Buffer.alloc(off), 0, off, Number(chromTreeOffset), opts);\n const p = getParsers(isBE);\n const { keySize } = p.chromTreeParser.parse(buffer);\n const leafNodeParser = new Parser()\n .endianess(le)\n .string('key', { stripNull: true, length: keySize })\n .uint32('refId')\n .uint32('refSize')\n .saveOffset('offset');\n const nonleafNodeParser = new Parser()\n .endianess(le)\n .skip(keySize)\n .uint64('childOffset')\n .saveOffset('offset');\n const rootNodeOffset = 32;\n const bptReadNode = async (currentOffset) => {\n let offset = currentOffset;\n if (offset >= buffer.length) {\n throw new Error('reading beyond end of buffer');\n }\n const ret = p.isLeafNode.parse(buffer.subarray(offset));\n const { isLeafNode, cnt } = ret;\n offset += ret.offset;\n if (isLeafNode) {\n for (let n = 0; n < cnt; n += 1) {\n const leafRet = leafNodeParser.parse(buffer.subarray(offset));\n offset += leafRet.offset;\n const { key, refId, refSize } = leafRet;\n const refRec = { name: key, id: refId, length: refSize };\n refsByName[this.renameRefSeqs(key)] = refId;\n refsByNumber[refId] = refRec;\n }\n }\n else {\n // parse index node\n const nextNodes = [];\n for (let n = 0; n < cnt; n += 1) {\n const nonleafRet = nonleafNodeParser.parse(buffer.subarray(offset));\n const { childOffset } = nonleafRet;\n offset += nonleafRet.offset;\n nextNodes.push(bptReadNode(Number(childOffset) - Number(chromTreeOffset)));\n }\n await Promise.all(nextNodes);\n }\n };\n await bptReadNode(rootNodeOffset);\n return {\n refsByName,\n refsByNumber,\n };\n }\n /*\n * fetches the \"unzoomed\" view of the bigwig data. this is the default for bigbed\n * @param abortSignal - a signal to optionally abort this operation\n */\n async getUnzoomedView(opts) {\n const { unzoomedIndexOffset, refsByName, uncompressBufSize, isBigEndian, fileType, } = await this.getHeader(opts);\n return new BlockView(this.bbi, refsByName, unzoomedIndexOffset, isBigEndian, uncompressBufSize > 0, fileType);\n }\n /**\n * Gets features from a BigWig file\n *\n * @param refName - The chromosome name\n * @param start - The start of a region\n * @param end - The end of a region\n * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) or scale used to infer the zoomLevel to use\n */\n async getFeatureStream(refName, start, end, opts = {\n scale: 1,\n }) {\n await this.getHeader(opts);\n const chrName = this.renameRefSeqs(refName);\n let view;\n if (opts.basesPerSpan) {\n view = await this.getView(1 / opts.basesPerSpan, opts);\n }\n else if (opts.scale) {\n view = await this.getView(opts.scale, opts);\n }\n else {\n view = await this.getView(1, opts);\n }\n if (!view) {\n throw new Error('unable to get block view for data');\n }\n return new Observable((observer) => {\n view.readWigData(chrName, start, end, observer, opts);\n });\n }\n async getFeatures(refName, start, end, opts = {\n scale: 1,\n }) {\n const ob = await this.getFeatureStream(refName, start, end, opts);\n const ret = await firstValueFrom(ob.pipe(toArray()));\n return ret.flat();\n }\n}\n//# sourceMappingURL=bbi.js.map","import { BlockView } from './blockView';\nimport { BBI } from './bbi';\nexport class BigWig extends BBI {\n /**\n * Retrieves a BlockView of a specific zoomLevel\n *\n * @param scale - number\n * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) or scale used to infer the zoomLevel to use\n */\n async getView(scale, opts) {\n const { zoomLevels, refsByName, fileSize, isBigEndian, uncompressBufSize } = await this.getHeader(opts);\n const basesPerPx = 1 / scale;\n let maxLevel = zoomLevels.length;\n if (!fileSize) {\n // if we don't know the file size, we can't fetch the highest zoom level :-(\n maxLevel -= 1;\n }\n for (let i = maxLevel; i >= 0; i -= 1) {\n const zh = zoomLevels[i];\n if (zh && zh.reductionLevel <= 2 * basesPerPx) {\n const indexOffset = Number(zh.indexOffset);\n return new BlockView(this.bbi, refsByName, indexOffset, isBigEndian, uncompressBufSize > 0, 'summary');\n }\n }\n return this.getUnzoomedView(opts);\n }\n}\n//# sourceMappingURL=bigwig.js.map","/*\n * This code is based on the following repo:\n * https://github.com/higlass/higlass-bigwig-datafetcher/blob/main/src/BigwigDataFetcher.js\n */\nimport { BigWig } from '@gmod/bbi';\nimport type { Assembly, BigWigData } from '@gosling-lang/gosling-schema';\nimport { computeChromSizes } from '../../core/utils/assembly';\nimport { type CommonDataConfig, RemoteFile } from '../utils';\n\nimport type { Feature } from '@gmod/bbi';\nimport type { ChromInfo, TilesetInfo } from '@higlass/types';\n\ntype BigWigDataConfig = BigWigData & CommonDataConfig;\n\ntype Tile = {\n tilePos: [number];\n tileId: string;\n zoomLevel: number;\n min_value: number;\n max_value: number;\n dense: (number | null)[];\n denseDataExtrema: InstanceType;\n minNonZero: number;\n maxNonZero: number;\n};\n\ntype BigWigHeader = {\n zoomLevels: { reductionLevel: number }[];\n};\n\ntype ExtendedFeature = Feature & { startAbs: number; endAbs: number };\n\nfunction BigWigDataFetcher(HGC: import('@higlass/types').HGC, dataConfig: BigWigDataConfig) {\n if (!new.target) {\n throw new Error('Uncaught TypeError: Class constructor cannot be invoked without \"new\"');\n }\n\n const cls = class BigWigDataFetcherClass {\n dataConfig: typeof dataConfig;\n bwFileHeader: BigWigHeader | null;\n bwFile: BigWig | null;\n TILE_SIZE: number;\n errorTxt: string;\n dataPromises: Promise[];\n chromSizes: ChromInfo & { chrToAbs: (name: string, pos: number) => number };\n assembly?: Assembly;\n tilesetInfoLoading?: boolean;\n\n constructor() {\n this.dataConfig = dataConfig;\n this.assembly = this.dataConfig.assembly;\n this.bwFileHeader = null;\n this.bwFile = null;\n this.TILE_SIZE = 1024;\n\n this.errorTxt = '';\n this.dataPromises = [];\n\n // Prepare chromosome interval information\n const chromosomeSizes = computeChromSizes(this.assembly).size;\n\n const chromosomeCumPositions: ChromInfo['cumPositions'] = [];\n const chromosomePositions: Record = {};\n let prevEndPosition = 0;\n\n Object.keys(computeChromSizes(this.assembly).size).forEach((chrStr, i) => {\n const positionInfo = {\n id: i,\n chr: chrStr,\n pos: prevEndPosition\n };\n\n chromosomeCumPositions.push(positionInfo);\n chromosomePositions[chrStr] = positionInfo;\n\n prevEndPosition += computeChromSizes(this.assembly).size[chrStr];\n });\n this.chromSizes = {\n chrToAbs: (chrom, chromPos) => this.chromSizes.chrPositions[chrom].pos + chromPos,\n cumPositions: chromosomeCumPositions,\n chrPositions: chromosomePositions,\n totalLength: prevEndPosition,\n chromLengths: chromosomeSizes\n };\n\n this.dataPromises.push(this.loadBBI(dataConfig));\n }\n\n async loadBBI(dataConfig: BigWigDataConfig) {\n if (dataConfig.url) {\n this.bwFile = new BigWig({\n filehandle: new RemoteFile(dataConfig.url, { overrides: dataConfig.urlFetchOptions })\n });\n return this.bwFile.getHeader().then((h: BigWigHeader) => {\n this.bwFileHeader = h;\n });\n } else {\n console.error('Please enter a \"url\" field to the data config');\n return null;\n }\n }\n\n tilesetInfo(callback?: (info: TilesetInfo | { error: string }) => void) {\n this.tilesetInfoLoading = true;\n\n return Promise.all(this.dataPromises)\n .then(() => {\n this.tilesetInfoLoading = false;\n\n const totalLength = this.chromSizes.totalLength;\n\n const retVal = {\n tile_size: this.TILE_SIZE,\n max_zoom: Math.ceil(Math.log(totalLength / this.TILE_SIZE) / Math.log(2)),\n max_width: 2 ** Math.ceil(Math.log(totalLength) / Math.log(2)),\n min_pos: [0],\n max_pos: [totalLength]\n };\n\n if (callback) {\n callback(retVal);\n }\n\n return retVal;\n })\n .catch(err => {\n this.tilesetInfoLoading = false;\n\n console.error(err);\n\n if (callback) {\n callback({\n error: `Error parsing bigwig: ${err}`\n });\n }\n return null;\n });\n }\n\n fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n const tiles: Record = {};\n const validTileIds: string[] = [];\n const tilePromises = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('Invalid tile zoom or position:', z, x);\n continue;\n }\n\n validTileIds.push(tileId);\n tilePromises.push(this.tile(z, x));\n }\n\n Promise.all(tilePromises).then(values => {\n for (let i = 0; i < values.length; i++) {\n const validTileId = validTileIds[i];\n tiles[validTileId] = values[i];\n tiles[validTileId].tilePositionId = validTileId;\n }\n\n receivedTiles(tiles);\n });\n // tiles = tileResponseToData(tiles, null, tileIds);\n return tiles;\n }\n\n async tile(z: number, x: number) {\n const tsInfo = (await this.tilesetInfo())!;\n const tileWidth = +tsInfo.max_width / 2 ** +z;\n\n const recordPromises: Promise[] = [];\n\n const tile: Partial = {\n tilePos: [x],\n tileId: `bigwig.${z}.${x}`,\n zoomLevel: z\n };\n\n // get the bounds of the tile\n const minXOriginal = tsInfo.min_pos[0] + x * tileWidth;\n let minX = minXOriginal;\n const maxX = tsInfo.min_pos[0] + (x + 1) * tileWidth;\n\n const basesPerPixel = this.determineScale(minX, maxX);\n const basesPerBin = (maxX - minX) / this.TILE_SIZE;\n\n const binStarts: number[] = [];\n for (let i = 0; i < this.TILE_SIZE; i++) {\n binStarts.push(minX + i * basesPerBin);\n }\n\n const { chromLengths, cumPositions } = this.chromSizes;\n\n cumPositions.forEach(cumPos => {\n const chromName = cumPos.chr;\n const chromStart = cumPos.pos;\n const chromEnd = cumPos.pos + chromLengths[chromName];\n\n let startPos, endPos;\n\n if (chromStart <= minX && minX < chromEnd) {\n // start of the visible region is within this chromosome\n\n if (maxX > chromEnd) {\n // the visible region extends beyond the end of this chromosome\n // fetch from the start until the end of the chromosome\n startPos = minX - chromStart;\n endPos = chromEnd - chromStart;\n recordPromises.push(\n this.bwFile!.getFeatures(chromName, startPos, endPos, {\n scale: 1 / basesPerPixel\n }).then(values => {\n values.forEach((v: Feature & { startAbs?: number; endAbs?: number }) => {\n v['startAbs'] = HGC.utils.chrToAbs(chromName, v.start, this.chromSizes);\n v['endAbs'] = HGC.utils.chrToAbs(chromName, v.end, this.chromSizes);\n });\n return values as (Feature & { startAbs: number; endAbs: number })[];\n })\n );\n\n minX = chromEnd;\n } else {\n startPos = Math.floor(minX - chromStart);\n endPos = Math.ceil(maxX - chromStart);\n if (!this.bwFile) return;\n recordPromises.push(\n this.bwFile\n .getFeatures(chromName, startPos, endPos, {\n scale: 1 / basesPerPixel\n })\n .then(values => {\n values.forEach((v: Feature & { startAbs?: number; endAbs?: number }) => {\n v['startAbs'] = HGC.utils.chrToAbs(chromName, v.start, this.chromSizes);\n v['endAbs'] = HGC.utils.chrToAbs(chromName, v.end, this.chromSizes);\n });\n return values as (Feature & { startAbs: number; endAbs: number })[];\n })\n );\n return;\n }\n }\n });\n\n return Promise.all(recordPromises).then(v => {\n const values = v.flat();\n\n const dense: (number | null)[] = [];\n for (let i = 0; i < this.TILE_SIZE; i++) {\n dense.push(null);\n }\n\n // Currently we use the same binning strategy in all cases (basesPerBin =>< basesPerBinInFile)\n binStarts.forEach((curStart, index) => {\n if (curStart < minXOriginal || curStart > maxX) {\n return;\n }\n const filtered = values\n .filter(v => {\n return curStart >= v.startAbs && curStart < v.endAbs;\n })\n .map(v => v.score);\n dense[index] = filtered.length > 0 ? filtered[0] : null;\n });\n\n const dde = new HGC.utils.DenseDataExtrema1D(dense);\n // @ts-expect-error Math.min() allows `null` but results in min\n tile.min_value = Math.min(...dense);\n // @ts-expect-error Math.max() allows `null` but results in min\n tile.max_value = Math.max(...dense);\n tile.dense = dense;\n tile.denseDataExtrema = dde;\n tile.minNonZero = dde.minNonZeroInTile;\n tile.maxNonZero = dde.maxNonZeroInTile;\n return tile as Tile;\n });\n }\n\n // We never want to request more than 1024 * 20 elements from the file.\n determineScale(minX: number, maxX: number) {\n const reductionLevels = [1];\n const numRequestedElements = maxX - minX;\n\n if (!this.bwFileHeader) {\n throw Error('no bigwig header');\n }\n\n this.bwFileHeader.zoomLevels.forEach(z => {\n reductionLevels.push(z.reductionLevel);\n });\n\n let level: number | undefined;\n reductionLevels.forEach(rl => {\n if (level) return; // we found one\n\n const numElementsFromFile = numRequestedElements / rl;\n if (numElementsFromFile <= this.TILE_SIZE * 20) {\n level = rl;\n }\n });\n\n // return the highest reductionLevel, if we could not find anything better\n return level || reductionLevels.slice(-1)[0];\n }\n };\n\n return new cls();\n}\n\nBigWigDataFetcher.config = {\n type: 'bigwig'\n};\n\nexport default BigWigDataFetcher;\n","import type * as d3 from 'd3';\nimport type {\n SingleTrack,\n Datum,\n FilterTransform,\n LogTransform,\n ExonSplitTransform,\n Assembly,\n StrConcatTransform,\n StrReplaceTransform,\n GenomicLengthTransform,\n SvTypeTransform,\n CoverageTransform,\n DisplaceTransform,\n JsonParseTransform\n} from '@gosling-lang/gosling-schema';\nimport {\n getChannelKeysByAggregateFnc,\n getChannelKeysByType,\n IsChannelDeep,\n IsIncludeFilter,\n IsOneOfFilter,\n IsRangeFilter\n} from '@gosling-lang/gosling-schema';\nimport { computeChromSizes } from './assembly';\n// import Logging from './log';\n\n/**\n * Apply filter\n */\nexport function filterData(filter: FilterTransform, data: Datum[]): Datum[] {\n const { field, not } = filter;\n\n let output: Datum[] = Array.from(data);\n if (IsOneOfFilter(filter)) {\n const { oneOf } = filter;\n output = output.filter((d: Datum) => {\n return not ? (oneOf as any[]).indexOf(d[field]) === -1 : (oneOf as any[]).indexOf(d[field]) !== -1;\n });\n } else if (IsRangeFilter(filter)) {\n const { inRange } = filter;\n output = output.filter((d: Datum) => {\n const value = +d[field];\n return not ? !(inRange[0] <= value && value <= inRange[1]) : inRange[0] <= value && value <= inRange[1];\n });\n } else if (IsIncludeFilter(filter)) {\n const { include } = filter;\n output = output.filter((d: Datum) => {\n return not ? `${d[field]}`.includes(include) : !`${d[field]}`.includes(include);\n });\n }\n return output;\n}\n\n/**\n * Calculate new data, like log transformation.\n */\nexport function concatString(concat: StrConcatTransform, data: Datum[]): Datum[] {\n const { fields, separator, newField } = concat;\n\n let output: Datum[] = Array.from(data);\n output = output.map(d => {\n const strs = fields.map(f => d[f]);\n d[newField] = strs.join(separator);\n return d;\n });\n return output;\n}\n\nexport function replaceString(_: StrReplaceTransform, data: Datum[]): Datum[] {\n const { field, replace, newField } = _;\n\n let output: Datum[] = Array.from(data);\n output = output.map(d => {\n d[newField] = d[field]; // copy original string\n replace.forEach(r => {\n const { from, to } = r;\n d[newField] = d[newField].toString().replaceAll(from, to);\n });\n return d;\n });\n return output;\n}\n\n/**\n * Calculate new data, like log transformation.\n */\nexport function calculateData(log: LogTransform, data: Datum[]): Datum[] {\n const { field, base, newField } = log;\n\n let output: Datum[] = Array.from(data);\n output = output.map(d => {\n if (+d[field]) {\n if (base === 'e') {\n d[newField ?? field] = Math.log(+d[field]);\n } else {\n d[newField ?? field] = Math.log(+d[field]) / Math.log(base ?? 10);\n }\n }\n return d;\n });\n return output;\n}\n\n/**\n * Calculate genomic length using two genomic fields.\n */\nexport function calculateGenomicLength(_: GenomicLengthTransform, data: Datum[]): Datum[] {\n const { startField, endField, newField } = _;\n const output = Array.from(data);\n output.forEach(d => {\n const s = d[startField];\n const e = d[endField];\n if (!s || !e) {\n // such field does not exist, so skip this row\n // console.warn(`[Genomic Length] startField or endField (${s} or ${e}) does not exist.`);\n return;\n }\n d[newField] = Math.abs(+e - +s);\n });\n return output;\n}\n\n/*\n * Infer SV types (i.e., one of DUP, TRA, DEL, t2tINV, h2hINV).\n */\nexport function inferSvType(_: SvTypeTransform, data: Datum[]): Datum[] {\n const { firstBp, secondBp, newField } = _;\n const output = Array.from(data);\n const [DUP, TRA, DEL, t2tINV, h2hINV] = ['DUP', 'TRA', 'DEL', 't2tINV', 'h2hINV'];\n\n output.forEach(d => {\n const chr1 = d[firstBp.chrField];\n const chr2 = d[secondBp.chrField];\n\n if (chr1 !== chr2) {\n d[newField] = TRA;\n return;\n }\n\n let pos1 = d[firstBp.posField];\n let pos2 = d[secondBp.posField];\n let strand1 = d[firstBp.strandField];\n let strand2 = d[secondBp.strandField];\n\n if (pos1 > pos2) {\n // need to sort first\n const _pos = pos1;\n const _strand = strand1;\n pos1 = pos2;\n strand1 = strand2;\n pos2 = _pos;\n strand2 = _strand;\n }\n\n switch (`${strand1}${strand2}`) {\n case '+-':\n d[newField] = DEL;\n break;\n case '--':\n d[newField] = t2tINV;\n break;\n case '++':\n d[newField] = h2hINV;\n break;\n case '-+':\n d[newField] = DUP;\n break;\n default:\n d[newField] = 'unknown';\n }\n });\n return output;\n}\n\n/**\n * Aggregate data rows and calculate coverage of reads.\n */\nexport function aggregateCoverage(\n _: CoverageTransform,\n data: Datum[],\n scale: d3.ScaleContinuousNumeric\n): Datum[] {\n // Logging.recordTime('aggregateCoverage');\n\n const { startField, endField, newField, groupField } = _;\n\n const coverage: { [group: string]: { [position: string]: number } } = {};\n\n // Calculate coverage by one pixel.\n const binSize = 1;\n data.forEach(d => {\n const curStart = scale(d[startField] as number);\n const curEnd = scale(d[endField] as number);\n const group = groupField ? d[groupField] : '__NO_GROUP__';\n\n const adjustedStart = Math.floor(curStart);\n for (let i = adjustedStart; i < curEnd; i += binSize) {\n if (!coverage[group]) {\n coverage[group] = {};\n }\n if (!coverage[group][i]) {\n coverage[group][i] = 0;\n }\n coverage[group][i]++;\n }\n });\n\n const output = Object.entries(coverage).flatMap(group => {\n const [groupName, coverageRecords] = group;\n return Object.entries(coverageRecords).map(entry => {\n const [key, value] = entry;\n return {\n [startField]: scale.invert(+key),\n [endField]: scale.invert(+key + binSize),\n [newField ?? 'coverage']: value,\n [groupField ?? 'group']: groupName\n };\n });\n });\n\n // console.log(coverage);\n // Logging.printTime('aggregateCoverage');\n return output;\n}\n\n/**\n * Mark displacement transform furnctions.\n * @param t An object that contains data transformation spec.\n * @param data An array of objects that contain data.\n * @param scale A d3's linear scale that map between data-level values to screen-level values (px).\n * @returns\n */\nexport function displace(\n t: DisplaceTransform,\n data: Datum[],\n scale: d3.ScaleContinuousNumeric\n): Datum[] {\n const { boundingBox, method, newField } = t;\n const { startField, endField, groupField } = boundingBox;\n\n let paddingInBp = 0;\n if (boundingBox.padding && scale && !boundingBox.isPaddingBP) {\n paddingInBp = Math.abs(scale.invert(boundingBox.padding) - scale.invert(0));\n } else if (boundingBox.padding && boundingBox.isPaddingBP) {\n paddingInBp = boundingBox.padding;\n }\n\n // Check whether we have sufficient information.\n const base = Array.from(data);\n if (base && base.length > 0) {\n if (!Object.keys(base[0]).find(d => d === startField) || !Object.keys(base[0]).find(d => d === endField)) {\n // We did not find the fields from the data, so exit here.\n return base;\n }\n }\n\n if (method === 'pile') {\n // This piling algorithm is heavily based on\n // https://github.com/higlass/higlass-pileup/blob/8538a34c6d884c28455d6178377ee1ea2c2c90ae/src/bam-fetcher-worker.js#L626\n const { maxRows } = t;\n const occupiedSpaceInRows: { [group: string]: { start: number; end: number }[] } = {};\n\n const sorted = base.sort((a: Datum, b: Datum) => (a[startField] as number) - (b[startField] as number));\n\n sorted.forEach((d: Datum) => {\n const start = +d[startField] - paddingInBp;\n const end = +d[endField] + paddingInBp;\n\n // Create object if none\n const group = groupField ? d[groupField] : '__NO_GROUP__';\n if (!occupiedSpaceInRows[group]) {\n occupiedSpaceInRows[group] = [];\n }\n\n // Find a row to place this segment\n let rowIndex = occupiedSpaceInRows[group].findIndex(d => {\n // Find a space and update the occupancy info.\n if (end < d.start) {\n d.start = start;\n return true;\n } else if (d.end < start) {\n d.end = end;\n return true;\n }\n return false;\n });\n\n if (rowIndex === -1) {\n // We did not find sufficient space from the existing rows, so add a new row.\n occupiedSpaceInRows[group].push({ start, end });\n rowIndex = occupiedSpaceInRows[group].length - 1;\n }\n\n d[newField] = `${maxRows && maxRows <= rowIndex ? maxRows - 1 : rowIndex}`;\n });\n } else if (method === 'spread') {\n const boundingBoxes: { start: number; end: number }[] = [];\n\n base.sort((a: Datum, b: Datum) => (a[startField] as number) - (b[startField] as number)).forEach((d: Datum) => {\n let start = (d[startField] as number) - paddingInBp;\n let end = (d[endField] as number) + paddingInBp;\n\n let overlapped = boundingBoxes.filter(\n box =>\n (box.start === start && end === box.end) ||\n (box.start < start && start < box.end) ||\n (box.start < end && end < box.end) ||\n (start < box.start && box.end < end)\n );\n\n if (overlapped.length > 0) {\n let trial = 0;\n do {\n overlapped = boundingBoxes.filter(\n box =>\n (box.start === start && end === box.end) ||\n (box.start < start && start < box.end) ||\n (box.start < end && end < box.end) ||\n (start < box.start && box.end < end)\n );\n if (overlapped.length > 0) {\n if (trial % 2 === 0) {\n start += paddingInBp * trial;\n end += paddingInBp * trial;\n } else {\n start -= paddingInBp * trial;\n end -= paddingInBp * trial;\n }\n }\n trial++;\n // TODO: do not go outside of a tile.\n } while (overlapped.length > 0 && trial < 1000);\n }\n\n d[`${newField}Start`] = `${start + paddingInBp}`;\n d[`${newField}Etart`] = `${end - paddingInBp}`;\n\n boundingBoxes.push({ start, end });\n });\n }\n\n // Logging.printTime('displace()');\n return base;\n}\n\nexport function splitExon(split: ExonSplitTransform, data: Datum[], assembly: Assembly = 'hg38'): Datum[] {\n const { separator, fields, flag } = split;\n let output: Datum[] = Array.from(data);\n output = output\n .map((d: Datum) => {\n const newRows: Datum[] = [];\n\n fields.forEach(f => {\n const { field, type, newField, chrField } = f;\n const splitted = d[field].toString().split(separator);\n\n splitted.forEach((s, i) => {\n let newValue: string | number = s;\n if (type === 'genomic') {\n newValue = computeChromSizes(assembly).interval[d[chrField]][0] + +s;\n }\n if (!newRows[i]) {\n // No row exist, so create one.\n newRows[i] = Object.assign(JSON.parse(JSON.stringify(d)), {\n [newField]: newValue,\n [flag.field]: flag.value\n });\n } else {\n newRows[i][newField] = newValue;\n }\n });\n });\n return [d, ...newRows];\n })\n .reduce((a, b) => a.concat(b), []);\n return output;\n}\n\n// TODO: Get this data from the fetcher as a default with a flag variable.\nexport function parseSubJSON(_: JsonParseTransform, data: Datum[]): Datum[] {\n const { field, genomicField, baseGenomicField, genomicLengthField } = _;\n let output: Datum[] = Array.from(data);\n output = output\n .map((d: Datum) => {\n let newRows: Datum[] = JSON.parse(d[field] as string);\n\n newRows = newRows.map(row => {\n if (row[genomicField] && d[baseGenomicField]) {\n row[`${genomicField}_start`] = +row[genomicField] + +d[baseGenomicField];\n row[`${genomicField}_end`] = +row[genomicField] + +d[baseGenomicField] + +row[genomicLengthField];\n }\n\n return Object.assign(JSON.parse(JSON.stringify(d)), {\n ...row,\n [`${genomicField}_start`]: row[`${genomicField}_start`],\n [`${genomicField}_end`]: row[`${genomicField}_end`],\n type: row.type ?? row.variant ?? null,\n isParsedRow: 'yes'\n });\n });\n\n return [d, ...newRows];\n })\n .reduce((a, b) => a.concat(b), []);\n return output;\n}\n\n/**\n * Experimental! Only support one category supported yet.\n */\nexport function aggregateData(spec: SingleTrack, data: Datum[]): Datum[] {\n if (getChannelKeysByAggregateFnc(spec).length === 0) {\n // we do not have aggregated fields\n return data;\n }\n\n const nChannelKeys = getChannelKeysByType(spec, 'nominal');\n\n if (nChannelKeys.length !== 1) {\n console.warn('Currently, we only support aggregating datasets with single nominal field.');\n return data;\n }\n\n const nFieldSpec = spec[nChannelKeys[0]];\n if (!IsChannelDeep(nFieldSpec)) {\n // this shouldn't be reached\n return data;\n }\n\n const nField = nFieldSpec.field;\n if (!nField) {\n // this shouldn't be reached\n return data;\n }\n\n const qChannelKeys = [...getChannelKeysByType(spec, 'quantitative'), ...getChannelKeysByType(spec, 'genomic')];\n const aggregated: { [k: string]: number | string }[] = [];\n\n const uniqueCategories = Array.from(new Set(data.map(d => d[nField])));\n\n let failed = false;\n uniqueCategories.forEach(c => {\n const datum: { [k: string]: string | number } = {};\n\n datum[nField] = c;\n\n // for each quantitative fields\n qChannelKeys.forEach(q => {\n const qFieldSpec = spec[q];\n if (!IsChannelDeep(qFieldSpec)) {\n // this shouldn't be reached\n failed = true;\n return;\n }\n\n const { field: qField } = qFieldSpec;\n if (!qField || !('aggregate' in qFieldSpec)) {\n // this shouldn't be reached\n failed = true;\n return;\n }\n\n datum[qField] =\n qFieldSpec.aggregate === 'max'\n ? Math.max(...data.filter(d => d[nField] === c).map(d => +d[qField]))\n : Math.min(...data.filter(d => d[nField] === c).map(d => +d[qField]));\n });\n\n aggregated.push(datum);\n });\n\n // set aggregated data only if we successfully generated it\n return !failed ? aggregated : data;\n}\n","import { dsvFormat as d3dsvFormat, type DSVRowString } from 'd3-dsv';\nimport { computeChromSizes } from '../../core/utils/assembly';\nimport { sampleSize } from 'lodash-es';\nimport type { Assembly, CsvData, FilterTransform, Datum } from '@gosling-lang/gosling-schema';\nimport { filterData } from '../../core/utils/data-transform';\nimport { type CommonDataConfig, filterUsingGenoPos, sanitizeChrName, RemoteFile } from '../utils';\n\ntype CsvDataConfig = CsvData & CommonDataConfig & { filter?: FilterTransform[] };\n\ninterface ChromSizes {\n chrToAbs: (chrom: string, chromPos: number) => number;\n cumPositions: { id: number; chr: string; pos: number }[];\n chrPositions: { [k: string]: { id: number; chr: string; pos: number } };\n totalLength: number;\n chromLengths: { [k: string]: number };\n}\n\n/**\n * Used in #tile() to associate tile coordinates with data\n */\ninterface TileInfo {\n tabularData: Datum[];\n server: null;\n tilePos: number[];\n zoomLevel: number;\n tilePositionId?: string;\n}\n/**\n * This is what all the tile information eventually gets organized into.\n */\nexport interface LoadedTiles {\n [tilePositionId: string]: TileInfo;\n}\n\n/**\n * Used in #generateTilesetInfo()\n */\ninterface TilesetInfo {\n tile_size: number;\n max_zoom: number;\n max_width: number;\n min_pos: number[];\n max_pos: number[];\n}\n\nexport class CsvDataFetcherClass {\n dataConfig: CsvDataConfig;\n // @ts-ignore\n tilesetInfoLoading: boolean; // Used in TiledPixiTrack\n\n #dataPromise: Promise | undefined;\n #chromSizes: ChromSizes;\n #parsedData!: DSVRowString[]; // Either set in the constructor or in #fetchCsv()\n #assembly: Assembly;\n #filter: FilterTransform[] | undefined;\n #file: RemoteFile;\n\n constructor(dataConfig: CsvDataConfig) {\n this.dataConfig = dataConfig;\n this.tilesetInfoLoading = false;\n this.#assembly = this.dataConfig.assembly;\n this.#filter = this.dataConfig.filter;\n\n if (!dataConfig.url) {\n console.error('Please provide the `url` of the data');\n }\n\n // Use any headers for this particular URL\n const { urlFetchOptions, url } = dataConfig;\n this.#file = new RemoteFile(url, { overrides: urlFetchOptions });\n\n this.#chromSizes = this.#generateChomSizeInfo();\n this.#dataPromise = this.#fetchCsv();\n }\n\n /**\n * Fetches CSV file from url, parses it, and sets this.#parsedData\n */\n async #fetchCsv(): Promise {\n const { chromosomeField, genomicFields, headerNames, longToWideId, genomicFieldsToConvert } = this.dataConfig;\n\n const separator = this.dataConfig.separator ?? ',';\n\n try {\n const buffer = await this.#file.readFile();\n const text = buffer.toString();\n const textWithHeader = headerNames ? `${headerNames.join(separator)}\\n${text}` : text;\n\n const parsedCSV = d3dsvFormat(separator).parse(textWithHeader, (row: DSVRowString) =>\n this.#processCsvRow(row, genomicFieldsToConvert, chromosomeField, genomicFields)\n );\n\n if (longToWideId && parsedCSV[0]?.[longToWideId]) {\n // rows having identical IDs are juxtaposed horizontally\n const columnNames = Object.keys(parsedCSV[0]);\n const newJson: { [k: string]: DSVRowString } = {};\n parsedCSV.forEach(row => {\n if (!newJson[row[longToWideId] as string]) {\n newJson[row[longToWideId] as string] = JSON.parse(JSON.stringify(row));\n } else {\n columnNames.forEach(colName => {\n newJson[row[longToWideId] as string][`${colName}_2`] = row[colName];\n });\n }\n });\n this.#parsedData = Object.keys(newJson).map(k_3 => newJson[k_3]);\n } else {\n this.#parsedData = parsedCSV;\n }\n } catch (error) {\n console.error('[Gosling Data Fetcher] Error fetching data', error);\n }\n }\n\n /**\n * Function passed into DSV parser to process each row\n * @param row An object which contains the row information. The keys are the column names\n * @param genomicFieldsToConvert From data config\n * @param chromosomeField From data config\n * @param genomicFields From data config\n * @returns The processed row\n */\n #processCsvRow(\n row: DSVRowString,\n genomicFieldsToConvert: CsvData['genomicFieldsToConvert'],\n chromosomeField: CsvData['chromosomeField'],\n genomicFields: CsvData['genomicFields']\n ) {\n try {\n if (genomicFieldsToConvert) {\n // This spec is used when multiple chromosomes are stored in a single row\n genomicFieldsToConvert.forEach(chromMap => {\n const genomicFields_1 = chromMap.genomicFields;\n const chromName = row[chromMap.chromosomeField] as string;\n\n genomicFields_1.forEach((positionCol: string) => {\n const chromPosition = row[positionCol] as string;\n row[positionCol] = String(this.#calcCumulativePos(chromName, chromPosition));\n });\n });\n } else if (chromosomeField && genomicFields) {\n genomicFields.forEach((positionCol_1: string) => {\n const chromPosition_1 = row[positionCol_1] as string;\n const chromName_1 = row[chromosomeField] as string;\n row[positionCol_1] = String(this.#calcCumulativePos(chromName_1, chromPosition_1));\n });\n }\n return row;\n } catch {\n // skip the rows that had errors in them\n return undefined;\n }\n }\n\n /**\n * Calculates the cumulative chromosome position based on the chromosome name and position\n * @param chromName A string, the name of the chromosome\n * @param chromPosition A string, the position within the chromosome\n */\n #calcCumulativePos(chromName: string, chromPosition: string) {\n if (this.#assembly !== 'unknown') {\n // This means we need to use the relative position considering the start position of individual chr.\n const chrName = sanitizeChrName(chromName, this.#assembly, this.dataConfig.chromosomePrefix);\n return computeChromSizes(this.#assembly).interval[chrName][0] + +chromPosition;\n } else {\n return chromPosition;\n }\n }\n /**\n * Called in TiledPixiTrack\n */\n tilesetInfo(callback?: (tilesetInto: TilesetInfo) => void): Promise | undefined {\n if (!this.#dataPromise) {\n // data promise is not prepared yet\n return;\n }\n\n this.tilesetInfoLoading = true;\n\n return this.#dataPromise\n .then(() => this.#generateTilesetInfo(callback))\n .catch(err => {\n this.tilesetInfoLoading = false;\n console.error('[Gosling Data Fetcher] Error parsing data:', err);\n });\n }\n /**\n * Called by this.tilesetInfo() to call a callback function with tileset info.\n */\n #generateTilesetInfo(callback?: (tilesetInfo: TilesetInfo) => void): TilesetInfo {\n this.tilesetInfoLoading = false;\n\n const TILE_SIZE = 1024;\n const totalLength = this.#chromSizes.totalLength;\n const retVal = {\n tile_size: TILE_SIZE,\n max_zoom: Math.ceil(Math.log(totalLength / TILE_SIZE) / Math.log(2)),\n max_width: totalLength,\n min_pos: [0, 0],\n max_pos: [totalLength, totalLength]\n };\n\n if (callback) {\n callback(retVal);\n }\n\n return retVal;\n }\n /**\n * Called in TiledPixiTrack.\n * @param receivedTiles A function from TiledPixiTrack which takes in all the loaded tiles\n * @param tileIds An array of tile IDs. Ex. ['1.0', '1.1']\n */\n fetchTilesDebounced(receivedTiles: (loadedTiles: LoadedTiles) => void, tileIds: string[]): void {\n const tiles: LoadedTiles = {};\n\n const validTileIds: string[] = [];\n const tilePromises = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n const y = parseInt(parts[2], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('[Gosling Data Fetcher] Invalid tile zoom or position:', z, x, y);\n continue;\n }\n\n validTileIds.push(tileId);\n tilePromises.push(this.#tile(z, x, y));\n }\n\n Promise.all(tilePromises).then(tileInfo => {\n tileInfo.forEach((tileInfo, i) => {\n if (tileInfo) {\n const validTileId = validTileIds[i];\n tiles[validTileId] = tileInfo;\n tiles[validTileId].tilePositionId = validTileId;\n }\n });\n receivedTiles(tiles);\n });\n }\n /**\n * Creates an object to associate a tile position with the corresponding data\n * @param z An integer, the z coordinate of the tile\n * @param x An integer, the x coordinate of the tile\n * @param y An integer, the y coordinate of the tile\n * @returns A promise of an object with tile coordinates and data\n */\n async #tile(z: number, x: number, y: number): Promise {\n const tilesetInfo = await this.tilesetInfo();\n if (!tilesetInfo) return;\n\n const tileWidth = +tilesetInfo.max_width / 2 ** +z;\n\n // get the bounds of the tile\n const minX = tilesetInfo.min_pos[0] + x * tileWidth;\n const maxX = tilesetInfo.min_pos[0] + (x + 1) * tileWidth;\n\n // filter the data so that only the visible data is sent to tracks\n let tabularData = filterUsingGenoPos(this.#parsedData as Datum[], [minX, maxX], this.dataConfig);\n\n // filter data based on the `DataTransform` spec\n this.#filter?.forEach(f => {\n tabularData = filterData(f, tabularData);\n });\n\n const sizeLimit = this.dataConfig.sampleLength ?? 1000;\n return {\n // sample the data to make it managable for visualization components\n tabularData: tabularData.length > sizeLimit ? sampleSize(tabularData, sizeLimit) : tabularData,\n server: null,\n tilePos: [x, y],\n zoomLevel: z\n };\n }\n\n /**\n * This function calculates chromosome position and size based on the assembly (this.#assembly)\n * @returns An object containing chromosome information and a way to calculate absolute position\n */\n #generateChomSizeInfo(): ChromSizes {\n // Prepare chromosome interval information\n const chromosomeSizes: { [k: string]: number } = computeChromSizes(this.#assembly).size;\n const chromosomeCumPositions: { id: number; chr: string; pos: number }[] = [];\n const chromosomePositions: { [k: string]: { id: number; chr: string; pos: number } } = {};\n let prevEndPosition = 0;\n\n Object.keys(chromosomeSizes).forEach((chrStr, i) => {\n const positionInfo = {\n id: i,\n chr: chrStr,\n pos: prevEndPosition\n };\n\n chromosomeCumPositions.push(positionInfo);\n chromosomePositions[chrStr] = positionInfo;\n\n prevEndPosition += chromosomeSizes[chrStr];\n });\n\n return {\n chrToAbs: (chrom: string, chromPos: number) => this.#chromSizes.chrPositions[chrom].pos + chromPos,\n cumPositions: chromosomeCumPositions,\n chrPositions: chromosomePositions,\n totalLength: prevEndPosition,\n chromLengths: chromosomeSizes\n };\n }\n}\n\n/**\n * HiGlass data fetcher specific for Gosling which ultimately will accept any types of data other than CSV files.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction CsvDataFetcher(\n _HGC: import('@higlass/types').HGC,\n dataConfig: CsvDataConfig,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _pubsub: Record\n): CsvDataFetcherClass {\n if (!new.target) {\n throw new Error('Uncaught TypeError: Class constructor cannot be invoked without \"new\"');\n }\n\n return new CsvDataFetcherClass(dataConfig);\n}\n\nCsvDataFetcher.config = {\n type: 'csv'\n};\n\nexport default CsvDataFetcher;\n","import { computeChromSizes } from '../../core/utils/assembly';\nimport { sampleSize } from 'lodash-es';\nimport type { Assembly, JsonData } from '@gosling-lang/gosling-schema';\nimport { type CommonDataConfig, filterUsingGenoPos, sanitizeChrName } from '../utils';\n\ntype CsvDataConfig = JsonData & CommonDataConfig;\n\n/**\n * HiGlass data fetcher specific for Gosling which ultimately will accept any types of data other than JSON values.\n */\nfunction JsonDataFetcher(HGC: any, ...args: any): any {\n if (!new.target) {\n throw new Error('Uncaught TypeError: Class constructor cannot be invoked without \"new\"');\n }\n\n class JsonDataFetcherClass {\n private dataConfig: CsvDataConfig;\n // @ts-ignore\n private tilesetInfoLoading: boolean;\n private chromSizes: any;\n private values: any;\n private assembly: Assembly;\n\n constructor(params: any[]) {\n const [dataConfig] = params;\n this.dataConfig = dataConfig;\n this.tilesetInfoLoading = false;\n this.assembly = this.dataConfig.assembly;\n\n if (!dataConfig.values) {\n console.error('Please provide `values` of the JSON data');\n return;\n }\n\n // Prepare chromosome interval information\n const chromosomeSizes: { [k: string]: number } = computeChromSizes(this.assembly).size;\n const chromosomeCumPositions: { id: number; chr: string; pos: number }[] = [];\n const chromosomePositions: { [k: string]: { id: number; chr: string; pos: number } } = {};\n let prevEndPosition = 0;\n\n Object.keys(computeChromSizes(this.assembly).size).forEach((chrStr, i) => {\n const positionInfo = {\n id: i,\n chr: chrStr,\n pos: prevEndPosition\n };\n\n chromosomeCumPositions.push(positionInfo);\n chromosomePositions[chrStr] = positionInfo;\n\n prevEndPosition += computeChromSizes(this.assembly).size[chrStr];\n });\n this.chromSizes = {\n chrToAbs: (chrom: string, chromPos: number) => this.chromSizes.chrPositions[chrom].pos + chromPos,\n cumPositions: chromosomeCumPositions,\n chrPositions: chromosomePositions,\n totalLength: prevEndPosition,\n chromLengths: chromosomeSizes\n };\n\n const { chromosomeField, genomicFields, genomicFieldsToConvert } = this.dataConfig;\n this.values = dataConfig.values.map((row: any) => {\n try {\n if (genomicFieldsToConvert) {\n // This spec is used when multiple chromosomes are stored in a single row\n genomicFieldsToConvert.forEach(chromMap => {\n const genomicFields = chromMap.genomicFields;\n const chromName = sanitizeChrName(row[chromMap.chromosomeField], this.assembly) as string;\n\n genomicFields.forEach((positionCol: string) => {\n const chromPosition = row[positionCol] as string;\n row[positionCol] = String(this.chromSizes.chrToAbs(chromName, chromPosition));\n });\n });\n } else if (chromosomeField && genomicFields) {\n genomicFields.forEach((positionCol: string) => {\n const chromPosition = row[positionCol] as string;\n const chromName = sanitizeChrName(row[chromosomeField], this.assembly) as string;\n row[positionCol] = String(this.chromSizes.chrToAbs(chromName, chromPosition));\n });\n }\n return row;\n } catch {\n // skip the rows that had errors in them\n return undefined;\n }\n });\n }\n\n tilesetInfo(callback?: any) {\n this.tilesetInfoLoading = false;\n\n const TILE_SIZE = 1024;\n const totalLength = this.chromSizes.totalLength;\n const retVal = {\n tile_size: TILE_SIZE,\n max_zoom: Math.ceil(Math.log(totalLength / TILE_SIZE) / Math.log(2)),\n max_width: totalLength,\n min_pos: [0, 0],\n max_pos: [totalLength, totalLength]\n };\n\n if (callback) {\n callback(retVal);\n }\n\n return retVal;\n }\n\n fetchTilesDebounced(receivedTiles: any, tileIds: any) {\n const tiles: { [k: string]: any } = {};\n\n const validTileIds: any[] = [];\n const tilePromises = [];\n\n for (const tileId of tileIds) {\n const parts = tileId.split('.');\n const z = parseInt(parts[0], 10);\n const x = parseInt(parts[1], 10);\n const y = parseInt(parts[2], 10);\n\n if (Number.isNaN(x) || Number.isNaN(z)) {\n console.warn('[Gosling Data Fetcher] Invalid tile zoom or position:', z, x, y);\n continue;\n }\n\n validTileIds.push(tileId);\n tilePromises.push(this.tile(z, x, y));\n }\n\n Promise.all(tilePromises).then(values => {\n values.forEach((value, i) => {\n const validTileId = validTileIds[i];\n tiles[validTileId] = value;\n tiles[validTileId].tilePositionId = validTileId;\n });\n receivedTiles(tiles);\n });\n\n return tiles;\n }\n\n tile(z: any, x: any, y: any) {\n const tsInfo = this.tilesetInfo();\n const tileWidth = +tsInfo.max_width / 2 ** +z;\n\n // get the bounds of the tile\n const minX = tsInfo.min_pos[0] + x * tileWidth;\n const maxX = tsInfo.min_pos[0] + (x + 1) * tileWidth;\n\n // filter the data so that visible data is sent to tracks\n let tabularData = filterUsingGenoPos(this.values, [minX, maxX], this.dataConfig);\n\n // sample the data to make it managable for visualization components\n const sizeLimit = this.dataConfig.sampleLength ?? 1000;\n if (sizeLimit < tabularData.length) {\n // TODO: allow to provide sampling method which incorporates order of JSON array (similar to tabularData.slice(0, sizeLimit))\n tabularData =\n this.dataConfig.sampleType === 'first'\n ? tabularData.slice(0, sizeLimit)\n : sampleSize(tabularData, sizeLimit);\n }\n\n return {\n tabularData,\n server: null,\n tilePos: [x, y],\n zoomLevel: z\n };\n }\n }\n\n return new JsonDataFetcherClass(args);\n}\n\nJsonDataFetcher.config = {\n type: 'json'\n};\n\nexport default JsonDataFetcher;\n","/*\n * The GFF data fetcher is based heavily on the BED and VCF data fetchers\n */\nimport { spawn } from 'threads';\nimport Worker from './gff-worker.ts?worker&inline';\n\nimport { computeChromSizes } from '../../core/utils/assembly';\n\nimport type { ModuleThread } from 'threads';\nimport type { Assembly, GffData } from '@gosling-lang/gosling-schema';\nimport type { WorkerApi, TilesetInfo, GffTile, EmptyTile } from './gff-worker';\nimport type { TabularDataFetcher } from '../utils';\n\nconst DEBOUNCE_TIME = 200;\n\nexport type GFFDataConfig = GffData & { assembly: Assembly };\n\nclass GffDataFetcher implements TabularDataFetcher {\n static config = { type: 'gff' };\n dataConfig = {}; // required for higlass\n uid: string;\n prevRequestTime: number;\n track?: any;\n\n private toFetch: Set;\n private fetchTimeout?: ReturnType;\n private worker: Promise>;\n\n constructor(HGC: import('@higlass/types').HGC, config: GFFDataConfig) {\n this.uid = HGC.libraries.slugid.nice();\n this.prevRequestTime = 0;\n this.toFetch = new Set();\n const { url, indexUrl, assembly, ...options } = config;\n this.worker = spawn(new Worker()).then(async worker => {\n const chromSizes = Object.entries(computeChromSizes(assembly).size);\n await worker.init(this.uid, { url, indexUrl }, chromSizes, options);\n return worker;\n });\n }\n\n /*\n * Collect Tileset Information, such as tile size and genomic positions\n */\n async tilesetInfo(callback: (info: TilesetInfo) => void) {\n (await this.worker).tilesetInfo(this.uid).then(callback);\n }\n\n fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n this.track.drawLoadingCue();\n\n tileIds.forEach(tileId => this.toFetch.add(tileId));\n\n if (this.fetchTimeout) {\n clearTimeout(this.fetchTimeout);\n }\n\n this.fetchTimeout = setTimeout(() => {\n this.sendFetch(receivedTiles, [...this.toFetch]);\n this.toFetch.clear();\n }, DEBOUNCE_TIME);\n }\n\n async sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles);\n }\n\n async getTabularData(tileIds: string[]): Promise {\n const buf = await (await this.worker).getTabularData(this.uid, tileIds);\n const parsed = JSON.parse(new TextDecoder().decode(buf));\n return parsed;\n }\n}\n\nexport default GffDataFetcher;\n","/*\n * This document is heavily based on the following repo by @alexander-veit:\n * https://github.com/dbmi-bgm/higlass-sv/blob/main/src/sv-fetcher.js\n */\nimport { spawn } from 'threads';\nimport Worker from './bed-worker.ts?worker&inline';\n\nimport { computeChromSizes } from '../../core/utils/assembly';\n\nimport type { ModuleThread } from 'threads';\nimport type { Assembly, BedData } from '@gosling-lang/gosling-schema';\nimport type { WorkerApi, TilesetInfo } from './bed-worker';\nimport type { BedTile, EmptyTile } from './bed-worker';\nimport type { TabularDataFetcher } from '../utils';\n\nconst DEBOUNCE_TIME = 200;\n\nexport type BedDataConfig = BedData & { assembly: Assembly };\n\nclass BedDataFetcher implements TabularDataFetcher {\n static config = { type: 'bed' };\n dataConfig = {}; // required for higlass\n uid: string;\n prevRequestTime: number;\n track?: any;\n\n private toFetch: Set;\n private fetchTimeout?: ReturnType;\n private worker: Promise>;\n\n constructor(HGC: import('@higlass/types').HGC, config: BedDataConfig) {\n this.uid = HGC.libraries.slugid.nice();\n this.prevRequestTime = 0;\n this.toFetch = new Set();\n const { url, indexUrl, assembly, ...options } = config;\n this.worker = spawn(new Worker()).then(async worker => {\n const chromSizes = Object.entries(computeChromSizes(assembly).size);\n await worker.init(this.uid, { url, indexUrl }, chromSizes, options);\n return worker;\n });\n }\n\n /*\n * Collect Tileset Information, such as tile size and genomic positions\n */\n async tilesetInfo(callback: (info: TilesetInfo) => void) {\n (await this.worker).tilesetInfo(this.uid).then(callback);\n }\n\n fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n this.track.drawLoadingCue();\n\n tileIds.forEach(tileId => this.toFetch.add(tileId));\n\n if (this.fetchTimeout) {\n clearTimeout(this.fetchTimeout);\n }\n\n this.fetchTimeout = setTimeout(() => {\n this.sendFetch(receivedTiles, [...this.toFetch]);\n this.toFetch.clear();\n }, DEBOUNCE_TIME);\n }\n\n async sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]) {\n (await this.worker).fetchTilesDebounced(this.uid, tileIds).then(receivedTiles);\n }\n /**\n * Called by GoslingTrack. This is how the track gets data\n * @param tileIds The position of the tile\n * @returns A promise to the BedTiles\n */\n async getTabularData(tileIds: string[]): Promise {\n const buf = await (await this.worker).getTabularData(this.uid, tileIds);\n const parsed = JSON.parse(new TextDecoder().decode(buf));\n return parsed;\n }\n}\n\nexport default BedDataFetcher;\n","import type { SparseTile, TileData } from '@higlass/services';\nimport type { Datum, SingleTrack } from '@gosling-lang/gosling-schema';\nimport { IsDataDeepTileset } from '@gosling-lang/gosling-schema';\n\nexport const GOSLING_DATA_ROW_UID_FIELD = 'gosling-data-row-uid';\n\n/**\n * Convert genomic data formats to common tabular formats for given tile.\n */\nexport function getTabularData(\n spec: SingleTrack,\n data: TileData & {\n sparse?: Array;\n shape?: [number, number];\n tileX: number;\n tileWidth: number;\n tileSize: number;\n tileY?: number; // used for matrix\n tileHeight?: number; // used for matrix\n }\n) {\n const tabularData: Datum[] = [];\n\n if (!IsDataDeepTileset(spec.data)) {\n console.warn('No data is specified');\n return;\n }\n\n if (spec.data.type === 'vector' || spec.data.type === 'bigwig') {\n if (!('dense' in data)) {\n // we did not get sufficient data.\n return;\n }\n\n const bin = spec.data.binSize ?? 1;\n\n const numericValues = data.dense;\n const numOfGenomicPositions = data.tileSize;\n const tileUnitSize = data.tileWidth / data.tileSize;\n\n const valueName = spec.data.value ?? 'value';\n const columnName = spec.data.column ?? 'position';\n const startName = spec.data.start ?? 'start';\n const endName = spec.data.end ?? 'end';\n\n // additional columns with different aggregation functions\n const minValueName = `${valueName}_min`;\n const maxValueName = `${valueName}_max`;\n\n // user's aggregation function\n const agg = spec.data.aggregation ?? 'mean';\n\n // convert data to a visualization-friendly format\n let cumVal = 0;\n let minVal = Number.MAX_SAFE_INTEGER;\n let maxVal = Number.MIN_SAFE_INTEGER;\n let binStart = Number.MIN_SAFE_INTEGER;\n let binEnd = Number.MAX_SAFE_INTEGER;\n Array.from(Array(numOfGenomicPositions).keys()).forEach((g: number, j: number) => {\n // add individual rows\n if (bin === 1) {\n const value = numericValues[j] / (agg === 'mean' ? tileUnitSize : 1);\n tabularData.push({\n [valueName]: value,\n [columnName]: data.tileX + (j + 0.5) * tileUnitSize,\n [startName]: data.tileX + j * tileUnitSize,\n [endName]: data.tileX + (j + 1) * tileUnitSize,\n [minValueName]: value,\n [maxValueName]: value\n });\n } else {\n // bin the data considering the `binSize` option\n if (j % bin === 0) {\n // Start storing information for this bin\n cumVal = minVal = maxVal = numericValues[j];\n binStart = j;\n binEnd = j + bin;\n } else if (j % bin === bin - 1) {\n // Add a row using the cumulative value\n tabularData.push({\n [valueName]: cumVal / bin / (agg === 'mean' ? tileUnitSize : 1),\n [columnName]: data.tileX + (binStart + bin / 2.0) * tileUnitSize,\n [startName]: data.tileX + binStart * tileUnitSize,\n [endName]: data.tileX + binEnd * tileUnitSize,\n [minValueName]: minVal,\n [maxValueName]: maxVal\n });\n } else if (j === numOfGenomicPositions - 1) {\n // Manage the remainders. Just add them as a single row.\n const smallBin = numOfGenomicPositions % bin;\n const correctedBinEnd = binStart + smallBin;\n tabularData.push({\n [valueName]: cumVal / smallBin / (agg === 'mean' ? tileUnitSize : 1),\n [columnName]: data.tileX + (binStart + smallBin / 2.0) * tileUnitSize,\n [startName]: data.tileX + binStart * tileUnitSize,\n [endName]: data.tileX + correctedBinEnd * tileUnitSize,\n [minValueName]: minVal,\n [maxValueName]: maxVal\n });\n } else {\n // Add a current value\n cumVal += numericValues[j];\n if (minVal > numericValues[j]) minVal = numericValues[j];\n if (maxVal < numericValues[j]) maxVal = numericValues[j];\n }\n }\n });\n } else if (spec.data.type === 'multivec') {\n if (!('dense' in data) || data.shape === undefined) {\n // we did not get sufficient data.\n return;\n }\n\n const bin = spec.data.binSize ?? 1;\n\n const numOfTotalCategories = data.shape[0];\n const categories: any = spec.data.categories ?? [...Array(numOfTotalCategories).keys()];\n const numericValues = data.dense;\n const numOfGenomicPositions = data.shape[1];\n const tileUnitSize = data.tileWidth / data.tileSize;\n\n const rowName = spec.data.row ?? 'category';\n const valueName = spec.data.value ?? 'value';\n const columnName = spec.data.column ?? 'position';\n const startName = spec.data.start ?? 'start';\n const endName = spec.data.end ?? 'end';\n\n // additional columns with different aggregation functions\n const minValueName = `${valueName}_min`;\n const maxValueName = `${valueName}_max`;\n\n // user's aggregation function\n const agg = spec.data.aggregation ?? 'mean';\n\n // convert data to a visualization-friendly format\n categories.forEach((c: string, i: number) => {\n let cumVal = 0;\n let binStart = Number.MIN_SAFE_INTEGER;\n let binEnd = Number.MAX_SAFE_INTEGER;\n let minVal = Number.MAX_SAFE_INTEGER;\n let maxVal = Number.MIN_SAFE_INTEGER;\n Array.from(Array(numOfGenomicPositions).keys()).forEach((g: number, j: number) => {\n // add individual rows\n if (bin === 1) {\n const value = numericValues[numOfGenomicPositions * i + j] / (agg === 'mean' ? tileUnitSize : 1);\n tabularData.push({\n [rowName]: c,\n [valueName]: value,\n [columnName]: data.tileX + (j + 0.5) * tileUnitSize,\n [startName]: data.tileX + j * tileUnitSize,\n [endName]: data.tileX + (j + 1) * tileUnitSize,\n [minValueName]: value,\n [maxValueName]: value\n });\n } else {\n if (j % bin === 0) {\n // Start storing information for this bin\n cumVal = minVal = maxVal = numericValues[numOfGenomicPositions * i + j];\n binStart = j;\n binEnd = j + bin;\n } else if (j % bin === bin - 1) {\n // Add a row using the cumulative value\n\n tabularData.push({\n [rowName]: c,\n [valueName]: agg === 'mean' ? cumVal / bin / tileUnitSize : cumVal,\n [columnName]: data.tileX + (binStart + bin / 2.0) * tileUnitSize,\n [startName]: data.tileX + binStart * tileUnitSize,\n [endName]: data.tileX + binEnd * tileUnitSize,\n [minValueName]: minVal,\n [maxValueName]: maxVal\n });\n } else if (j === numOfGenomicPositions - 1) {\n // Manage the remainders. Just add them as a single row.\n const smallBin = numOfGenomicPositions % bin;\n const correctedBinEnd = binStart + smallBin;\n tabularData.push({\n [rowName]: c,\n [valueName]: agg === 'mean' ? cumVal / smallBin / tileUnitSize : cumVal,\n [columnName]: data.tileX + (binStart + smallBin / 2.0) * tileUnitSize,\n [startName]: data.tileX + binStart * tileUnitSize,\n [endName]: data.tileX + correctedBinEnd * tileUnitSize,\n [minValueName]: minVal,\n [maxValueName]: maxVal\n });\n } else {\n // Add a current value\n const value = numericValues[numOfGenomicPositions * i + j];\n cumVal += value;\n if (minVal > value) minVal = value;\n if (maxVal < value) maxVal = value;\n }\n }\n });\n });\n } else if (spec.data.type === 'matrix') {\n if (!('dense' in data) || typeof data.tileY === 'undefined' || typeof data.tileHeight === 'undefined') {\n // we do not have sufficient data.\n return;\n }\n\n // width and height of the tile\n const numBins = Math.sqrt(data.dense.length);\n\n const { tileX, tileY, tileWidth, tileHeight } = data;\n const numericValues = data.dense;\n\n const tileXUnitSize = tileWidth / numBins;\n const tileYUnitSize = tileHeight / numBins;\n const columnField = spec.data.column ?? 'x';\n const rowField = spec.data.row ?? 'y';\n\n // TODO: a way to improve rendering performance?\n // For the rendering performance, we aggregate cells so that we draw smaller number of marks.\n const aggSize = 16; // assuming that # of cells can be divided by binSize, which is mostly 256 or 1024\n for (let i = 0; i < numericValues.length / aggSize; i++) {\n const aggLen = Math.sqrt(aggSize);\n const xIndex = (i * aggLen) % numBins;\n const yIndex = Math.floor((i * aggLen) / numBins) * aggLen;\n\n // Being xIndex and yIndex the top-let origin, aggregate 4 x 4 cells\n let value = NaN;\n for (let c = 0; c < aggLen; c++) {\n for (let r = 0; r < aggLen; r++) {\n const curVal = numericValues[(yIndex + r) * numBins + (xIndex + c)];\n // If the current value is NaN, we do not need to do anything\n if (!isNaN(+curVal)) {\n // If the cumulative value is still NaN, which is the default value,\n // set that to zero so that we are able to add a value\n if (isNaN(value)) {\n value = 0;\n }\n value += curVal;\n }\n }\n }\n\n if (isNaN(value)) {\n // this means all values for this bin is NaN, hence a missing value\n continue;\n }\n\n const xs = tileX + xIndex * tileXUnitSize;\n const xe = tileX + (xIndex + aggLen) * tileXUnitSize;\n const ys = tileY + yIndex * tileYUnitSize;\n const ye = tileY + (yIndex + aggLen) * tileYUnitSize;\n const x = (xs + xe) / 2.0;\n const y = (ys + ye) / 2.0;\n tabularData.push({\n value,\n [columnField]: x,\n [`${columnField}s`]: xs,\n [`${columnField}e`]: xe,\n [rowField]: y,\n [`${rowField}s`]: ys,\n [`${rowField}e`]: ye\n });\n }\n } else if (spec.data.type === 'beddb') {\n if (!data.sparse) {\n // we did not get sufficient data.\n return;\n }\n\n const { genomicFields, exonIntervalFields, valueFields } = spec.data;\n\n data.sparse.forEach((d, i) => {\n const { chrOffset, fields } = d;\n\n const datum: { [k: string]: number | string } = {};\n\n datum[GOSLING_DATA_ROW_UID_FIELD] = `${i}`;\n\n genomicFields.forEach(g => {\n datum[g.name] = +fields[g.index] + chrOffset;\n });\n\n // values\n valueFields?.forEach(v => {\n datum[v.name] = v.type === 'quantitative' ? +fields[v.index] : fields[v.index];\n });\n\n tabularData.push({\n ...datum,\n type: 'gene' // this should be described in the spec\n });\n\n if (exonIntervalFields) {\n const [exonStartField, exonEndField] = exonIntervalFields;\n const exonStartStrs = (fields[exonStartField.index] as string).split(',');\n const exonEndStrs = (fields[exonEndField.index] as string).split(',');\n\n exonStartStrs.forEach((es, i) => {\n const ee = exonEndStrs[i];\n\n // exon\n tabularData.push({\n ...datum,\n [exonStartField.name]: +es + chrOffset,\n [exonEndField.name]: +ee + chrOffset,\n type: 'exon'\n });\n\n // intron\n if (i + 1 < exonStartStrs.length) {\n const nextEs = exonStartStrs[i + 1];\n tabularData.push({\n ...datum,\n [exonStartField.name]: +ee + chrOffset,\n [exonEndField.name]: +nextEs + chrOffset,\n type: 'intron'\n });\n }\n });\n }\n });\n }\n\n /// DEBUG\n // console.log(tabularData);\n\n return tabularData;\n}\n","import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model';\nimport type { Assembly, Domain } from '@gosling-lang/gosling-schema';\nimport { SUPPORTED_CHANNELS } from '../mark';\nimport { IsDomainChr, IsDomainInterval, IsDomainChrInterval, IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport { computeChromSizes } from './assembly';\n\n/**\n * Get a numeric domain based on a domain specification.\n * For example, domain: { chromosome: 'chr1', interval: [1, 300,000] } => domain: [1, 300,000]\n */\nexport function getNumericDomain(domain: Domain, assembly?: Assembly) {\n const chromInterval = computeChromSizes(assembly).interval;\n if ('chromosome' in domain) {\n const isThereChr = Object.keys(chromInterval).find(chr => chr === domain.chromosome);\n if (!isThereChr) {\n // Did not find the chromosome, so return early.\n return;\n }\n }\n if (IsDomainChr(domain)) {\n return [chromInterval[domain.chromosome][0] + 1, chromInterval[domain.chromosome][1]];\n } else if (IsDomainInterval(domain)) {\n return domain.interval;\n } else if (IsDomainChrInterval(domain)) {\n const chrStart = chromInterval[domain.chromosome][0];\n const [start, end] = domain.interval;\n return [chrStart + start, chrStart + end];\n }\n}\n\n// TODO: IMPORTANT: when panning the tiles, the extent only becomes larger\n/**\n * Use a shared scale (i.e., `domain`) across multiple gosling tracks.\n */\nexport function shareScaleAcrossTracks(trackModels: GoslingTrackModel[], force?: boolean) {\n // we update the spec with a global domain\n const globalDomain: { [k: string]: number[] | string[] } = {};\n const channelKeys = SUPPORTED_CHANNELS;\n\n // generate global domains\n trackModels.forEach(model => {\n channelKeys.forEach(channelKey => {\n const channel = model.spec()[channelKey];\n if (!IsChannelDeep(channel) || channel.domain === undefined) {\n return;\n }\n\n const { domain, type } = channel;\n\n if (type === 'quantitative') {\n const numericDomain: number[] = Array.from(domain as number[]);\n if (!globalDomain[channelKey]) {\n globalDomain[channelKey] = numericDomain;\n } else {\n const channelGlobalDomain = globalDomain[channelKey] as number[];\n\n if (channelGlobalDomain[0] > numericDomain[0]) {\n // min\n channelGlobalDomain[0] = numericDomain[0];\n }\n if (channelGlobalDomain[1] < numericDomain[1]) {\n // max\n channelGlobalDomain[1] = numericDomain[1];\n }\n }\n } else if (type === 'nominal') {\n const nominalDomain: string[] = Array.from(domain as string[]);\n if (!globalDomain[channelKey]) {\n globalDomain[channelKey] = nominalDomain;\n } else {\n globalDomain[channelKey] = Array.from(\n new Set([...globalDomain[channelKey], ...nominalDomain])\n ) as string[];\n }\n }\n });\n });\n\n // replace the domain and update scales\n trackModels.forEach(model => {\n channelKeys.forEach(channelKey => {\n const channel = model.spec()[channelKey];\n if (IsChannelDeep(channel) && channel.type === 'genomic') return;\n model.setChannelDomain(channelKey, globalDomain[channelKey], force);\n model.generateScales();\n });\n\n // update constant default values using the updated scales\n model.updateChannelValue();\n });\n}\n","const example = {\n compactLayout: false,\n trackSourceServers: ['https://server.gosling-lang.org/api/v1/'],\n views: [\n {\n genomePositionSearchBoxVisible: false,\n genomePositionSearchBox: {\n autocompleteServer: 'https://higlass.io/api/v1',\n autocompleteId: 'P0PLbQMwTYGy-5uPIQid7A',\n chromInfoServer: 'https://higlass.io/api/v1',\n chromInfoId: 'hg38'\n },\n layout: { x: 0, y: 0, w: 6.4, h: 600 },\n tracks: {\n top: [],\n left: [\n {\n type: 'combined',\n width: 130,\n height: 600,\n contents: [\n {\n type: 'gosling-track',\n server: 'https://server.gosling-lang.org/api/v1/',\n tilesetUid: 'cistrome-multivec',\n width: 130,\n height: 600,\n options: {\n showMousePosition: true,\n mousePositionColor: '#000000',\n fontSize: 24,\n labelPosition: 'none',\n labelShowResolution: false,\n labelColor: 'black',\n labelBackgroundColor: 'white',\n labelTextOpacity: 1,\n labelLeftMargin: 1,\n labelTopMargin: 1,\n labelRightMargin: 0,\n labelBottomMargin: 0,\n backgroundColor: 'transparent',\n spec: {\n spacing: 10,\n orientation: 'vertical',\n assembly: 'hg38',\n layout: 'linear',\n static: false,\n xDomain: { interval: [0, 1000000000] },\n centerRadius: 0.3,\n xOffset: 0,\n yOffset: 0,\n style: { outlineWidth: 0.5 },\n data: {\n url: 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec',\n type: 'multivec',\n row: 'sample',\n column: 'position',\n value: 'peak',\n categories: ['sample 1', 'sample 2', 'sample 3', 'sample 4'],\n binSize: 4\n },\n mark: 'rect',\n x: {\n field: 'start',\n type: 'genomic',\n axis: 'left',\n domain: { interval: [0, 1000000000] },\n linkingId: '7f94b74e-25ec-4e67-8c75-3dc0f1b0d6bd'\n },\n xe: { field: 'end', type: 'genomic' },\n row: {\n field: 'sample',\n type: 'nominal',\n legend: true\n },\n color: {\n field: 'peak',\n type: 'quantitative',\n legend: true\n },\n tooltip: [\n {\n field: 'start',\n type: 'genomic',\n alt: 'Start Position'\n },\n {\n field: 'end',\n type: 'genomic',\n alt: 'End Position'\n },\n {\n field: 'peak',\n type: 'quantitative',\n alt: 'Value',\n format: '.2'\n },\n { field: 'sample', type: 'nominal', alt: 'Sample' }\n ],\n width: 160,\n height: 600,\n overlayOnPreviousTrack: false\n },\n theme: {\n base: 'light',\n root: {\n background: 'white',\n titleColor: 'black',\n titleBackgroundColor: 'transparent',\n titleFontSize: 18,\n titleFontFamily: 'Arial',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n subtitleColor: 'gray',\n subtitleBackgroundColor: 'transparent',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleFontWeight: 'normal',\n subtitleAlign: 'left',\n mousePositionColor: '#000000'\n },\n track: {\n background: 'transparent',\n alternatingBackground: 'transparent',\n titleColor: 'black',\n titleBackground: 'white',\n titleFontSize: 24,\n titleAlign: 'left',\n outline: 'black',\n outlineWidth: 1\n },\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: '#DBDBDB',\n tickColor: 'black'\n },\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n baselineColor: 'black',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1,\n gridStrokeType: 'solid',\n gridStrokeDash: [4, 4]\n },\n markCommon: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n point: {\n color: '#E79F00',\n size: 3,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rect: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n triangle: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n area: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n line: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n bar: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rule: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n link: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n text: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6],\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n color: 'gray',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 0.3,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n }\n }\n }\n }\n ]\n },\n {\n uid: '15483511-f6fb-11eb-914b-976b6ecda162',\n type: 'axis-track',\n chromInfoPath: 'https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes',\n options: {\n layout: 'linear',\n outerRadius: null,\n width: 160,\n height: 600,\n theme: {\n base: 'light',\n root: {\n background: 'white',\n titleColor: 'black',\n titleBackgroundColor: 'transparent',\n titleFontSize: 18,\n titleFontFamily: 'Arial',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n subtitleColor: 'gray',\n subtitleBackgroundColor: 'transparent',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleFontWeight: 'normal',\n subtitleAlign: 'left',\n mousePositionColor: '#000000'\n },\n track: {\n background: 'transparent',\n alternatingBackground: 'transparent',\n titleColor: 'black',\n titleBackground: 'white',\n titleFontSize: 24,\n titleAlign: 'left',\n outline: 'black',\n outlineWidth: 1\n },\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: '#DBDBDB',\n tickColor: 'black'\n },\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n baselineColor: 'black',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1,\n gridStrokeType: 'solid',\n gridStrokeDash: [4, 4]\n },\n markCommon: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n point: {\n color: '#E79F00',\n size: 3,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rect: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n triangle: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n area: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n line: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n bar: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rule: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n link: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n text: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6],\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n color: 'gray',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 0.3,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n }\n },\n assembly: 'hg38',\n stroke: 'transparent',\n color: 'black',\n fontSize: 12,\n fontFamily: 'Arial',\n fontWeight: 'normal',\n tickColor: 'black',\n tickFormat: 'plain',\n tickPositions: 'even',\n reverseOrientation: false\n },\n width: 30\n }\n ],\n center: [],\n right: [],\n bottom: [],\n gallery: [],\n whole: []\n },\n initialXDomain: [0, 1000000000],\n initialYDomain: [0, 1000000000],\n zoomFixed: false,\n zoomLimits: [1, null],\n uid: '15483510-f6fb-11eb-914b-976b6ecda162',\n chromInfoPath: 'https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes'\n },\n {\n genomePositionSearchBoxVisible: false,\n genomePositionSearchBox: {\n autocompleteServer: 'https://higlass.io/api/v1',\n autocompleteId: 'P0PLbQMwTYGy-5uPIQid7A',\n chromInfoServer: 'https://higlass.io/api/v1',\n chromInfoId: 'hg38'\n },\n layout: { x: 6.8, y: 0, w: 5.2, h: 600 },\n tracks: {\n top: [],\n left: [\n {\n type: 'combined',\n width: 130,\n height: 600,\n contents: [\n {\n type: 'gosling-track',\n server: 'https://server.gosling-lang.org/api/v1/',\n tilesetUid: 'cistrome-multivec',\n width: 130,\n height: 600,\n options: {\n showMousePosition: true,\n mousePositionColor: '#000000',\n fontSize: 24,\n labelPosition: 'none',\n labelShowResolution: false,\n labelColor: 'black',\n labelBackgroundColor: 'white',\n labelTextOpacity: 1,\n labelLeftMargin: 1,\n labelTopMargin: 1,\n labelRightMargin: 0,\n labelBottomMargin: 0,\n backgroundColor: 'transparent',\n spec: {\n spacing: 10,\n orientation: 'vertical',\n assembly: 'hg38',\n layout: 'linear',\n static: false,\n xDomain: { interval: [0, 1000000000] },\n centerRadius: 0.3,\n xOffset: 0,\n yOffset: 0,\n style: { outlineWidth: 0.5 },\n data: {\n url: 'https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec',\n type: 'multivec',\n row: 'sample',\n column: 'position',\n value: 'peak',\n categories: ['sample 1', 'sample 2', 'sample 3', 'sample 4'],\n binSize: 4\n },\n mark: 'rect',\n x: {\n field: 'start',\n type: 'genomic',\n domain: { interval: [0, 1000000000] },\n linkingId: '7f94b74e-25ec-4e67-8c75-3dc0f1b0d6bd'\n },\n xe: { field: 'end', type: 'genomic' },\n row: {\n field: 'sample',\n type: 'nominal',\n legend: true\n },\n color: {\n field: 'peak',\n type: 'quantitative',\n legend: true\n },\n tooltip: [\n {\n field: 'start',\n type: 'genomic',\n alt: 'Start Position'\n },\n {\n field: 'end',\n type: 'genomic',\n alt: 'End Position'\n },\n {\n field: 'peak',\n type: 'quantitative',\n alt: 'Value',\n format: '.2'\n },\n { field: 'sample', type: 'nominal', alt: 'Sample' }\n ],\n width: 130,\n height: 600\n },\n theme: {\n base: 'light',\n root: {\n background: 'white',\n titleColor: 'black',\n titleBackgroundColor: 'transparent',\n titleFontSize: 18,\n titleFontFamily: 'Arial',\n titleAlign: 'left',\n titleFontWeight: 'bold',\n subtitleColor: 'gray',\n subtitleBackgroundColor: 'transparent',\n subtitleFontSize: 16,\n subtitleFontFamily: 'Arial',\n subtitleFontWeight: 'normal',\n subtitleAlign: 'left',\n mousePositionColor: '#000000'\n },\n track: {\n background: 'transparent',\n alternatingBackground: 'transparent',\n titleColor: 'black',\n titleBackground: 'white',\n titleFontSize: 24,\n titleAlign: 'left',\n outline: 'black',\n outlineWidth: 1\n },\n legend: {\n position: 'top',\n background: 'white',\n backgroundOpacity: 0.7,\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n backgroundStroke: '#DBDBDB',\n tickColor: 'black'\n },\n axis: {\n tickColor: 'black',\n labelColor: 'black',\n labelFontSize: 12,\n labelFontWeight: 'normal',\n labelFontFamily: 'Arial',\n baselineColor: 'black',\n gridColor: '#E3E3E3',\n gridStrokeWidth: 1,\n gridStrokeType: 'solid',\n gridStrokeDash: [4, 4]\n },\n markCommon: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n point: {\n color: '#E79F00',\n size: 3,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rect: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n triangle: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n area: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n line: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n bar: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n rule: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n link: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n },\n text: {\n color: '#E79F00',\n size: 1,\n stroke: 'black',\n strokeWidth: 0,\n opacity: 1,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6],\n textAnchor: 'middle',\n textFontWeight: 'normal'\n },\n brush: {\n color: 'gray',\n size: 1,\n stroke: 'black',\n strokeWidth: 1,\n opacity: 0.3,\n nominalColorRange: [\n '#E79F00',\n '#029F73',\n '#0072B2',\n '#CB7AA7',\n '#D45E00',\n '#57B4E9',\n '#EFE441'\n ],\n quantitativeSizeRange: [2, 6]\n }\n }\n }\n }\n ]\n }\n ],\n center: [],\n right: [],\n bottom: [],\n gallery: [],\n whole: []\n },\n initialXDomain: [0, 1000000000],\n initialYDomain: [0, 1000000000],\n zoomFixed: false,\n zoomLimits: [1, null],\n uid: '154b1b40-f6fb-11eb-914b-976b6ecda162'\n }\n ],\n zoomLocks: { locksByViewUid: {}, locksDict: {} },\n locationLocks: { locksByViewUid: {}, locksDict: {} },\n editable: false,\n chromInfoPath: 'https://s3.amazonaws.com/gosling-lang.org/data/hg38.chrom.sizes'\n};\n\nexport default example;\n","import type { HiGlassSpec, Track } from '@gosling-lang/higlass-schema';\nimport { HiGlassSchema } from '@gosling-lang/higlass-schema';\nimport type { Assembly, AxisPosition, Domain, DummyTrack, Orientation, ZoomLimits } from '@gosling-lang/gosling-schema';\nimport { getNumericDomain } from '../core/utils/scales';\nimport type { RelativePosition } from './bounding-box';\nimport { validateSpec } from '@gosling-lang/gosling-schema';\nimport { getAutoCompleteId, computeChromSizes } from '../core/utils/assembly';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\nimport exampleHg from '../core/example/hg-view-config-1';\nimport { insertItemToArray } from '../core/utils/array';\nimport { uuid } from '../core/utils/uuid';\n\nexport const HIGLASS_AXIS_SIZE = 30;\n\nconst getViewTemplate = (assembly?: Assembly) => {\n return {\n genomePositionSearchBoxVisible: false,\n genomePositionSearchBox: {\n autocompleteServer: 'https://higlass.io/api/v1',\n autocompleteId: getAutoCompleteId(assembly),\n chromInfoServer: 'https://higlass.io/api/v1',\n chromInfoId: assembly ?? 'hg38'\n },\n layout: { w: 12, h: 12, x: 0, y: 0 },\n tracks: {\n top: [],\n left: [],\n center: [],\n right: [],\n bottom: [],\n gallery: [],\n whole: []\n },\n initialXDomain: [0, computeChromSizes(assembly).total],\n initialYDomain: [0, computeChromSizes(assembly).total],\n zoomFixed: false\n };\n};\n\n/**\n * Model for managing the HiGlass view config.\n * We are currently only using a center track with additional tracks for axes in a single view.\n */\nexport class HiGlassModel {\n private assembly?: Assembly;\n private orientation?: Orientation;\n private hg: HiGlassSpec;\n constructor() {\n this.assembly = 'hg38';\n this.hg = {\n compactLayout: false,\n trackSourceServers: [],\n views: [],\n zoomLocks: {\n locksByViewUid: {},\n locksDict: {}\n },\n locationLocks: {\n locksByViewUid: {},\n locksDict: {}\n }\n };\n\n // Add default specs.\n this.setEditable(false);\n }\n\n public spec(): Readonly {\n return this.hg;\n }\n\n public setViewOrientation(orientation?: Orientation) {\n this.orientation = orientation;\n return this;\n }\n\n public addDefaultView(uid: string, assembly?: Assembly) {\n this.hg.views.push(JSON.parse(JSON.stringify({ ...getViewTemplate(assembly), uid })));\n return this;\n }\n\n public setAssembly(assembly?: Assembly) {\n this.assembly = assembly;\n this.setChromInfoPath(computeChromSizes(this.assembly).path);\n return this;\n }\n\n public getAssembly() {\n return this.assembly;\n }\n\n public setTextTrack(\n width: number,\n height: number,\n text: string,\n textColor = 'black',\n fontSize = 14,\n fontWeight = 'normal',\n align = 'left',\n backgroundColor = 'transparent',\n fontFamily = 'Arial'\n ) {\n if (this.getLastView()) {\n this.getLastView().tracks.top?.push({\n type: 'text',\n width,\n height,\n options: {\n backgroundColor,\n textColor,\n fontSize,\n fontWeight,\n fontFamily,\n offsetY: 0, // offset from the top of the track\n align,\n text\n }\n });\n }\n return this;\n }\n\n /**\n * Add a dummy track to the last view\n * @param track\n */\n public setDummyTrack(track: DummyTrack) {\n if (this.getLastView()) {\n this.getLastView().tracks.top?.push({\n type: 'dummy-track',\n width: track.width,\n height: track.height,\n options: {\n width: track.width,\n height: track.height,\n title: track.title,\n ...track.style\n }\n });\n }\n return this;\n }\n\n public addBrush(\n layout: 'circular' | 'linear',\n viewId: string,\n theme: Required,\n fromViewUid?: string,\n style?: {\n color?: string;\n stroke?: string;\n opacity?: string;\n strokeWidth?: number;\n startAngle?: number;\n endAngle?: number;\n innerRadius?: number;\n outerRadius?: number;\n }\n ) {\n if (!fromViewUid) return;\n\n // we could do this to either a `whole` track or a `center` track with `combined`\n (this.getView(viewId) as any)?.tracks.whole.push({\n // type: 'viewport-projection-center',\n type: layout === 'circular' ? 'brush-track' : 'viewport-projection-horizontal',\n uid: uuid(),\n fromViewUid,\n options: {\n projectionFillColor: style?.color ?? theme.brush.color,\n projectionStrokeColor: style?.stroke ?? theme.brush.stroke,\n projectionFillOpacity: style?.opacity ?? theme.brush.opacity,\n projectionStrokeOpacity: style?.opacity ?? theme.brush.opacity,\n strokeWidth: style?.strokeWidth ?? theme.brush.strokeWidth,\n startAngle: style?.startAngle,\n endAngle: style?.endAngle,\n innerRadius: style?.innerRadius,\n outerRadius: style?.outerRadius\n }\n });\n return this;\n }\n\n public getLastView() {\n return this.hg.views[this.hg.views.length - 1];\n }\n\n public getMainTrackPosition() {\n return this.orientation === 'vertical' ? 'left' : 'center';\n }\n\n /**\n * Get the last view that renders any visualization, so skiping empty tracks.\n */\n public getLastVisView() {\n const vs = this.hg.views.filter(v => (v.tracks as any)[this.getMainTrackPosition()]?.[0]?.type === 'combined');\n return vs[vs.length - 1];\n }\n\n public getView(viewId: string) {\n return this.hg.views.find(d => d.uid === viewId);\n }\n\n public validateSpec(silence = false) {\n return validateSpec(HiGlassSchema, this.spec(), silence).state === 'success';\n }\n\n public setDomain(xDomain: Domain | undefined, yDomain: Domain | undefined) {\n if (xDomain) {\n this.getLastView().initialXDomain = getNumericDomain(xDomain, this.getAssembly());\n }\n if (yDomain) {\n this.getLastView().initialYDomain = getNumericDomain(yDomain, this.getAssembly());\n }\n return this;\n }\n\n /**\n * This is a hacky function that adjust x domain to properly show vertical tracks.\n *\n * In HiGlass, the range of vertical tracks is affected by a center track. For example, if a center track is small, the vertical tracks become small as well.\n * Currently, the actual size of center track for vertical gosling tracks is `1px`. So, we re-scale the x domain so that gosling's vertical tracks properly use the entire height of a view.\n * @param orientation\n * @param width\n * @returns\n */\n public adjustDomain(orientation: Orientation = 'horizontal', width: number, height: number) {\n if (orientation !== 'vertical') {\n return this;\n }\n\n const domain = this.getLastView().initialXDomain;\n if (!domain) {\n return this;\n }\n\n const [start, end] = domain;\n const size = end - start;\n const center = (start + end) / 2.0;\n this.getLastView().initialXDomain = [\n center - (size / width / 2 / height) * width,\n center + (size / width / 2 / height) * width\n ];\n return this;\n }\n\n /**\n * Allow a zoom interaction?\n */\n public setZoomFixed(zoomFixed: boolean) {\n this.getLastView().zoomFixed = zoomFixed;\n return this;\n }\n\n /**\n * Set limits of zoom levels in base pairs.\n */\n public setZoomLimits(zoomLimits: ZoomLimits) {\n this.getLastView().zoomLimits = zoomLimits;\n return this;\n }\n\n public setLayout(layout: RelativePosition) {\n this.getLastView().layout = layout;\n return this;\n }\n\n private setEditable(editable: boolean | undefined) {\n this.hg.editable = editable;\n return this;\n }\n\n private setChromInfoPath(chromInfoPath: string | undefined) {\n if (this.getLastView()) {\n this.getLastView().chromInfoPath = chromInfoPath;\n }\n this.hg.chromInfoPath = chromInfoPath;\n return this;\n }\n\n public addTrackSourceServers(trackSourceServers: string | undefined) {\n if (trackSourceServers && this.hg.trackSourceServers?.indexOf(trackSourceServers) === -1)\n this.hg.trackSourceServers?.push(trackSourceServers);\n return this;\n }\n\n public setMainTrack(track: Track) {\n if (!this.getLastView()) return this;\n this.getLastView().tracks[this.getMainTrackPosition()] = [\n {\n type: 'combined',\n uid: `${track.uid ?? uuid()}-${this.getMainTrackPosition()}-combined`,\n // !! Hacky, but it is important to subtract 1px. Currently, HiGlass does not well handle a case where a center track is zero width (e.g., linking between views that contain zero-width center tracks).\n // https://github.com/higlass/higlass/pull/1041\n width: (track as any).width - 1,\n height: (track as any).height,\n contents: [track]\n }\n ];\n return this;\n }\n\n public addTrackToCombined(track: Track) {\n if (!this.getLastVisView()) return this;\n (this.getLastVisView() as any).tracks[this.getMainTrackPosition()][0]?.contents.push(track);\n return this;\n }\n\n public setAxisTrack(\n position: Exclude,\n type: 'regular' | 'narrow' | 'narrower' = 'regular',\n options: {\n id?: string;\n layout?: 'circular' | 'linear';\n innerRadius?: number;\n outerRadius?: number;\n width?: number;\n height?: number;\n startAngle?: number;\n endAngle?: number;\n theme: Required;\n }\n ) {\n if (!this.hg.views) return this;\n\n const widthOrHeight = position === 'left' || position === 'right' ? 'width' : 'height';\n const axisTrackTemplate: Track = {\n // uid: options.id ?? uuid(), // TODO: turning this on makes some tick labels hidden\n type: 'axis-track',\n chromInfoPath: this.hg.chromInfoPath,\n options: {\n ...options,\n assembly: this.getAssembly(),\n stroke: 'transparent', // text outline\n color: options.theme.axis.labelColor,\n labelMargin: options.theme.axis.labelMargin,\n excludeChrPrefix: options.theme.axis.labelExcludeChrPrefix,\n fontSize: options.theme.axis.labelFontSize,\n fontFamily: options.theme.axis.labelFontFamily,\n fontWeight: options.theme.axis.labelFontWeight,\n tickColor: options.theme.axis.tickColor,\n tickFormat: type === 'narrower' ? 'si' : 'plain',\n tickPositions: type === 'regular' ? 'even' : 'ends',\n reverseOrientation: position === 'bottom' || position === 'right' ? true : false\n }\n };\n if (options.layout === 'circular') {\n // circular axis: superpose an axis track on top of the `center` track\n this.addTrackToCombined({\n ...axisTrackTemplate,\n options: { ...axisTrackTemplate.options, layout: 'circular' }\n });\n } else {\n // linear axis: place an axis track on the top, left, bottom, or right\n const axisTrack = { ...axisTrackTemplate, [widthOrHeight]: HIGLASS_AXIS_SIZE };\n\n if (position === 'left') {\n // In vertical tracks, the main track has been already inserted into `left`, so put axis on the first index to show it on the left.\n if (this.getLastView().tracks.left.filter(d => d.type === 'axis-track').length !== 0) {\n // we already have an axis\n return this;\n }\n this.getLastView().tracks.left = insertItemToArray(this.getLastView().tracks.left, 0, axisTrack);\n } else if (position === 'right') {\n if (this.getLastView().tracks.right.filter(d => d.type === 'axis-track').length !== 0) {\n // we already have an axis\n return this;\n }\n this.getLastView().tracks.right.push(axisTrack);\n } else {\n if (this.getLastView().tracks[position].filter(d => d.type === 'axis-track').length !== 0) {\n // we already have an axis\n return this;\n }\n this.getLastView().tracks[position].push(axisTrack);\n }\n }\n return this;\n }\n\n public setExampleHiglassViewConfig() {\n this.hg = exampleHg as any;\n }\n}\n","import type { LogicalOperation } from '@gosling-lang/gosling-schema';\n\nexport function getMaxZoomLevel() {\n // TODO: How to correctly calculate maxZoomLevel?\n const TILE_SIZE = 256;\n const totalLength = 4795370;\n return Math.ceil(Math.log(totalLength / TILE_SIZE) / Math.log(2));\n}\n\n/**\n * Perform logical operation between a target and a reference value.\n * If the condition is `true`, return `1`.\n */\nexport function logicalComparison(\n value: number,\n op: LogicalOperation,\n ref: number,\n transitionPadding?: number\n): number {\n const padding = transitionPadding && transitionPadding !== 0 ? transitionPadding : undefined;\n let alpha = 0;\n switch (op) {\n case 'less-than':\n case 'LT':\n case 'lt':\n alpha = ref > value ? (padding ? (ref - value) / padding : 1) : 0;\n break;\n case 'less-than-or-equal-to':\n case 'LTET':\n case 'ltet':\n alpha = ref >= value ? (padding ? (ref - value) / padding : 1) : 0;\n break;\n case 'greater-than':\n case 'GT':\n case 'gt':\n alpha = ref < value ? (padding ? (value - ref) / padding : 1) : 0;\n break;\n case 'greater-than-or-equal-to':\n case 'GTET':\n case 'gtet':\n alpha = ref <= value ? (padding ? (value - ref) / padding : 1) : 0;\n break;\n }\n\n // make sure to return a value in [0, 1]\n return Math.max(Math.min(1, alpha), 0);\n}\n","// TODO: make mark-specific default\nexport const CHANNEL_DEFAULTS = {\n // https://mikemol.github.io/technique/colorblind/2018/02/11/color-safe-palette.html\n NOMINAL_COLOR: ['#E79F00', '#029F73', '#0072B2', '#CB7AA7', '#D45E00', '#57B4E9', '#EFE441' /*'#000000'*/],\n // https://colorcet.holoviz.org/user_guide/Categorical.html\n NOMINAL_COLOR_EXTENDED: [\n '#d60000',\n '#018700',\n '#b500ff',\n '#05acc6',\n '#97ff00',\n '#ffa52f',\n '#ff8ec8',\n '#79525e',\n '#00fdcf',\n '#afa5ff',\n '#93ac83',\n '#9a6900',\n '#366962',\n '#d3008c',\n '#fdf490',\n '#c86e66',\n '#9ee2ff',\n '#00c846',\n '#a877ac',\n '#b8ba01',\n '#f4bfb1',\n '#ff28fd',\n '#f2cdff',\n '#009e7c',\n '#ff6200',\n '#56642a',\n '#953f1f',\n '#90318e',\n '#ff3464',\n '#a0e491',\n '#8c9ab1',\n '#829026',\n '#ae083f',\n '#77c6ba',\n '#bc9157',\n '#e48eff',\n '#72b8ff',\n '#c6a5c1',\n '#ff9070',\n '#d3c37c',\n '#bceddb',\n '#6b8567',\n '#916e56',\n '#f9ff00',\n '#bac1df',\n '#ac567c',\n '#ffcd03',\n '#ff49b1',\n '#c15603',\n '#5d8c90',\n '#c144bc',\n '#00753f',\n '#ba6efd',\n '#00d493',\n '#00ff75',\n '#49a150',\n '#cc9790',\n '#00ebed',\n '#db7e01',\n '#f77589',\n '#b89500',\n '#c84248',\n '#00cff9',\n '#755726',\n '#85d401',\n '#ebffd4',\n '#a77b87',\n '#db72c8',\n '#cae256',\n '#8abf5d',\n '#a1216b',\n '#855b89',\n '#89bacf',\n '#ffbad6',\n '#b6cfaa',\n '#97414d',\n '#67aa00',\n '#fde1b1',\n '#ff3628',\n '#80793d',\n '#d6e8ff',\n '#a795c6',\n '#7ea59a',\n '#d182a3',\n '#54823b',\n '#e6a872',\n '#9cffff',\n '#da5480',\n '#05b3aa',\n '#ffaaf6',\n '#d1afef',\n '#da015d',\n '#ac1a13',\n '#60b385',\n '#d442fd',\n '#acaa59',\n '#fb9ca7',\n '#b3723b',\n '#f26952',\n '#aed1d4',\n '#9affc3',\n '#dbb333',\n '#eb01c3',\n '#9900c4',\n '#cfff9e',\n '#a55949',\n '#3b6d01',\n '#008579',\n '#959167',\n '#89dbb3',\n '#6d7400',\n '#aa5dca',\n '#07ef00',\n '#804f3d',\n '#d88052',\n '#ffc862',\n '#b8009e',\n '#99acdd',\n '#904f00',\n '#8c4470',\n '#4f6e52',\n '#ff8734',\n '#c68ecd',\n '#d4e29e',\n '#b1826d',\n '#9cfb75',\n '#56dd77',\n '#f90087',\n '#a1cdff',\n '#13cad1',\n '#118e54',\n '#d154a5',\n '#00dfc3',\n '#a3832f',\n '#77975b',\n '#baaa80',\n '#70a3af',\n '#d6fbff',\n '#e8013a',\n '#d84621',\n '#ff82ed',\n '#b63862',\n '#b6cd72',\n '#97626b',\n '#897490',\n '#00a316',\n '#00f4a1',\n '#bf90f2',\n '#89e4d8',\n '#a34d95',\n '#6e5d00',\n '#8cc68e',\n '#95aa2a',\n '#c672dd',\n '#b33b01',\n '#d69a36',\n '#dfacb6',\n '#009aa0',\n '#599000',\n '#97bca8',\n '#ac8ca8',\n '#dad4ff',\n '#547c72',\n '#00ba69',\n '#ffc38e',\n '#b800d4',\n '#dfcf5b',\n '#629a7b',\n '#bfedbc',\n '#c1bdfd',\n '#80d3dd',\n '#e2857e',\n '#f9eb4d',\n '#bf6d82',\n '#caff4f',\n '#ef72aa',\n '#ed67ff',\n '#9946ae',\n '#6d6942',\n '#e25660',\n '#dd662d',\n '#9cdb5d',\n '#e29ccf',\n '#b87500',\n '#c6002d',\n '#dfbcda',\n '#59b5df',\n '#ff59da',\n '#38c1a1',\n '#9e698c',\n '#acaac8',\n '#95622f',\n '#b55662',\n '#2b7e60',\n '#b1e400',\n '#eda590',\n '#95fde2',\n '#ff548e',\n '#bd6ea1',\n '#aa3b36',\n '#d8cf00',\n '#aa80cd',\n '#a08052',\n '#e100e8',\n '#c35b3d',\n '#b53a85',\n '#8c7700',\n '#dbbc95',\n '#529e93',\n '#afbc82',\n '#91b5b6',\n '#a75423',\n '#ffd4ef',\n '#79ae6b',\n '#5db54b',\n '#80fb9a',\n '#48ffef',\n '#979548',\n '#9387a7',\n '#31d400',\n '#6ee956',\n '#b6d4eb',\n '#705470',\n '#f2db8a',\n '#aad4c1',\n '#7ecdf2',\n '#89ba00',\n '#64b6ba',\n '#ffb500',\n '#c38285',\n '#caaa5e',\n '#647748',\n '#59e2ff',\n '#df4dcd',\n '#e9ff79',\n '#bc66b8',\n '#c395a5',\n '#64c674',\n '#d19570',\n '#70cf4f',\n '#aa6e66',\n '#9c60a5',\n '#00b800',\n '#e299b3',\n '#bc006b',\n '#b3e8ef',\n '#cdbfe4',\n '#77a342',\n '#856277',\n '#568e5b',\n '#9eafc4',\n '#e82fa0',\n '#247c2a',\n '#826723',\n '#bfbc4d',\n '#ddd3a5'\n ],\n QUANTITATIVE_COLOR: 'viridis',\n SIZE: 3,\n SIZE_RANGE: [2, 6]\n};\n","import { isThereTheme, getTheme as _getTheme } from '@gosling-lang/gosling-theme';\n\n/* ----------------------------- THEME ----------------------------- */\nexport type Theme = ThemeType | ThemeDeep;\nexport type ThemeType =\n | 'light'\n | 'dark'\n | 'warm'\n | 'ggplot'\n | 'igv'\n | 'ensembl'\n | 'jbrowse'\n | 'ucsc'\n | 'washu'\n | 'excel'\n | 'google';\n// export type ThemType = keyof typeof Themes;\n// Above line leads to `TypeError: Invalid value used as weak map key` error, due to cyclic dependency.\n// So, instead hard-coding the list as workaround\n// Refer to https://github.com/vega/ts-json-schema-generator/issues/1727\n\nexport interface ThemeDeep {\n base: ThemeType;\n\n root?: RootStyle;\n track?: TrackStyle;\n legend?: LegendStyle;\n axis?: AxisStyle;\n\n // Mark-Specific Styles\n markCommon?: MarkStyle;\n point?: MarkStyle;\n rect?: MarkStyle;\n triangle?: MarkStyle;\n area?: MarkStyle;\n line?: MarkStyle;\n bar?: MarkStyle;\n rule?: MarkStyle;\n link?: MarkStyle;\n brush?: MarkStyle;\n text?: MarkStyle & {\n textFontWeight?: 'bold' | 'normal';\n textAnchor?: 'start' | 'middle' | 'end';\n };\n}\n\n// TODO: Better way to implement deep `Required` type instead of having two separate interfaces, i.e., CompleteThemeDeep and ThemeDeep\nexport interface CompleteThemeDeep {\n base: Required;\n\n root: Required;\n track: Required;\n legend: Required;\n axis: Required;\n\n // Mark-Specific\n markCommon: Required;\n point: Required;\n rect: Required;\n triangle: Required;\n area: Required;\n line: Required;\n bar: Required;\n rule: Required;\n link: Required;\n brush: Required;\n text: Required &\n Required<{\n textFontWeight?: 'bold' | 'normal';\n textAnchor?: 'start' | 'middle' | 'end';\n }>;\n}\n\nexport interface RootStyle {\n background?: string;\n titleColor?: string;\n titleFontSize?: number;\n titleFontFamily?: string;\n titleAlign?: 'left' | 'middle' | 'right';\n titleFontWeight?: 'bold' | 'normal' | 'light';\n titleBackgroundColor?: string;\n subtitleColor?: string;\n subtitleFontSize?: number;\n subtitleFontFamily?: string;\n subtitleAlign?: 'left' | 'middle' | 'right';\n subtitleFontWeight?: 'bold' | 'normal' | 'light';\n subtitleBackgroundColor?: string;\n showMousePosition?: boolean;\n mousePositionColor?: string;\n}\n\nexport interface TrackStyle {\n background?: string;\n alternatingBackground?: string; // used to fill all even rows\n titleColor?: string;\n titleBackground?: string;\n titleFontSize?: number;\n titleAlign?: 'left' | 'middle' | 'right';\n outline?: string;\n outlineWidth?: number;\n // ...\n}\n\nexport interface LegendStyle {\n position?: 'top' | 'right'; // TODO: support bottom and left, and even all corners (e.g., top-left, bottom-right, etc)\n tickColor?: string;\n labelColor?: string;\n labelFontSize?: number;\n labelFontWeight?: 'bold' | 'normal' | 'light';\n labelFontFamily?: string;\n background?: string;\n backgroundOpacity?: number;\n backgroundStroke?: string;\n // ...\n}\n\nexport interface AxisStyle {\n tickColor?: string;\n /**\n * The margin around labels for calculating visual overlaps between labels.\n * This is mainly used for determining the visibility of axis labels.\n * `0` if no margin to use. Negative values (`-1`) for showing all labels even if they overlap.\n */\n labelMargin?: number;\n /**\n * If `true`, labels of genomics axes excludes the chromosome prefix (e.g., `chr1` -> `1`).\n */\n labelExcludeChrPrefix?: boolean;\n labelColor?: string;\n labelFontSize?: number;\n labelFontWeight?: 'bold' | 'normal' | 'light';\n labelFontFamily?: string;\n baselineColor?: string;\n gridColor?: string;\n gridStrokeWidth?: number;\n gridStrokeType?: 'solid' | 'dashed';\n gridStrokeDash?: [number, number];\n // ...\n}\n\nexport interface MarkStyle {\n color?: string;\n size?: number;\n stroke?: string;\n strokeWidth?: number;\n opacity?: number;\n\n nominalColorRange?: string[];\n quantitativeSizeRange?: [number, number];\n // ...\n}\n\n// TODO: Instead of calling this function everytime, create a JSON object and use it throughout the project.\nexport function getTheme(theme: Theme = 'light'): Required {\n if (typeof theme === 'string') {\n if (isThereTheme(theme)) {\n return _getTheme(theme);\n } else {\n return _getTheme('light');\n }\n } else {\n // Iterate all keys to override from base\n let baseSpec = JSON.parse(JSON.stringify(_getTheme('light')));\n if (isThereTheme(theme.base)) {\n baseSpec = _getTheme(theme.base);\n }\n // Override defaults from `base`\n Object.keys(baseSpec).forEach(k => {\n if ((theme as any)[k] && k !== 'base') {\n baseSpec[k] = Object.assign(\n JSON.parse(JSON.stringify(baseSpec[k])),\n JSON.parse(JSON.stringify((theme as any)[k]))\n );\n }\n });\n return baseSpec;\n }\n}\n","import type {\n ChannelDeep,\n PredefinedColors,\n ChannelTypes,\n ChannelValue,\n SingleTrack,\n Channel,\n Color,\n Stroke\n} from '@gosling-lang/gosling-schema';\nimport { validateTrack, getGenomicChannelFromTrack, getGenomicChannelKeyFromTrack } from '@gosling-lang/gosling-schema';\nimport {\n type ScaleLinear,\n scaleLinear,\n type ScaleOrdinal,\n scaleOrdinal,\n type ScaleBand,\n scaleBand,\n type ScaleSequential,\n scaleSequential\n} from 'd3-scale';\nimport { interpolateViridis } from 'd3-scale-chromatic';\nimport { min as d3min, max as d3max, sum as d3sum, group } from 'd3-array';\nimport { HIGLASS_AXIS_SIZE } from '../../compiler/higlass-model';\nimport { SUPPORTED_CHANNELS } from '../../core/mark';\nimport type { PIXIVisualProperty } from '../../core/visual-property.schema';\nimport { rectProperty } from '../../core/mark/rect';\nimport { pointProperty } from '../../core/mark/point';\nimport { barProperty } from '../../core/mark/bar';\nimport { getNumericDomain } from '../../core/utils/scales';\nimport { logicalComparison } from '../../core/utils/semantic-zoom';\nimport { aggregateData } from '../../core/utils/data-transform';\nimport {\n IsChannelDeep,\n IsChannelValue,\n getValueUsingChannel,\n IsStackedChannel,\n IsDomainArray,\n PREDEFINED_COLOR_STR_MAP,\n IsRangeArray\n} from '@gosling-lang/gosling-schema';\nimport { CHANNEL_DEFAULTS } from '../../core/channel';\nimport { type CompleteThemeDeep, getTheme } from '../../core/utils/theme';\nimport { uuid } from '../../core/utils/uuid';\nimport { MouseEventModel } from '../gosling-track/gosling-mouse-event';\n\nexport type ScaleType =\n | ScaleLinear\n | ScaleOrdinal\n | ScaleBand\n | ScaleSequential\n | (() => string | number); // constant value\n\nexport class GoslingTrackModel {\n private id: string;\n\n private theme: Required;\n\n /* spec */\n private specOriginal: SingleTrack; // original spec of users\n private specComplete: SingleTrack; // processed spec, being used in visualizations\n\n /* data */\n private dataAggregated: { [k: string]: number | string }[];\n\n /* channel scales */\n private channelScales: {\n [channel: string]: ScaleType;\n };\n\n /* mouse events */\n private mouseEventModel: MouseEventModel;\n\n constructor(spec: SingleTrack, data: { [k: string]: number | string }[], theme: Required) {\n this.id = uuid();\n\n this.theme = theme ?? getTheme();\n\n this.dataAggregated = data;\n\n this.specOriginal = spec;\n this.specComplete = spec;\n\n this.channelScales = {};\n\n this.mouseEventModel = new MouseEventModel();\n\n const validity = this.validateSpec();\n if (!validity.valid) {\n console.warn('Gosling specification is not valid!', validity.errorMessages);\n return;\n }\n\n // fill missing options\n this.generateCompleteSpec(this.specComplete);\n\n this.flipRanges(this.specComplete);\n\n // generate scales based on domains and ranges\n this.generateScales();\n\n this.dataAggregated = aggregateData(this.spec(), this.dataAggregated);\n\n // Add default specs.\n // ...\n\n // DEBUG\n // console.log('corrected track', this.spec());\n }\n\n public getId(): string {\n return this.id;\n }\n\n public originalSpec(): SingleTrack {\n return this.specOriginal;\n }\n\n public spec(): SingleTrack {\n return this.specComplete;\n }\n\n public data(): { [k: string]: number | string }[] {\n return this.dataAggregated;\n }\n\n public getMouseEventModel(): MouseEventModel {\n return this.mouseEventModel;\n }\n\n /**\n * Fill the missing options with default values or with the values calculated based on the data.\n */\n private generateCompleteSpec(spec: SingleTrack) {\n if (!spec.width || !spec.height) {\n // This shouldn't be reached.\n console.warn('Size of track is not determined yet.');\n return;\n }\n\n // If this is vertical track, switch them.\n if (spec.orientation === 'vertical') {\n const width = spec.width;\n spec.width = spec.height;\n spec.height = width;\n }\n\n // If axis presents, reserve a space to show axis\n const xOrY = this.getGenomicChannelKey();\n let isAxisShown = false;\n if (xOrY === 'x') {\n isAxisShown = IsChannelDeep(spec.x) && spec.x.axis !== undefined && spec.x.axis !== 'none';\n }\n if (xOrY === 'y') {\n isAxisShown = IsChannelDeep(spec.y) && spec.y.axis !== undefined && spec.y.axis !== 'none';\n }\n if (spec.layout !== 'circular') {\n if (IsChannelDeep(spec.x) && spec.x.axis !== undefined && spec.x.axis !== 'none') {\n // for linear layouts, prepare a horizontal or vertical space for the axis\n // we already switched the width and height in vertical tracks, so use `height`\n spec.height -= HIGLASS_AXIS_SIZE;\n }\n // TODO: consider 2D\n } else {\n // for circular layouts, prepare a space in radius for the axis\n if (xOrY === 'x' && isAxisShown && IsChannelDeep(spec.x) && spec.x.axis === 'top') {\n spec['outerRadius'] = ((spec['outerRadius'] as number) - HIGLASS_AXIS_SIZE) as number;\n } else if (xOrY === 'x' && isAxisShown && IsChannelDeep(spec.x) && spec.x.axis === 'bottom') {\n spec['innerRadius'] = ((spec['innerRadius'] as number) + HIGLASS_AXIS_SIZE) as number;\n }\n }\n\n // zero baseline\n SUPPORTED_CHANNELS.forEach(channelKey => {\n const channel = spec[channelKey];\n if (IsChannelDeep(channel) && !('zeroBaseline' in channel) && channel.type === 'quantitative') {\n (channel as any).zeroBaseline = true;\n }\n });\n\n this.addScaleMaterials(spec);\n }\n\n /**\n * TODO: This is experimental. For bar charts, for example, additional care should be taken to correctly flip the visual marks.\n * Flip the y scales when `flip` options is used.\n */\n private flipRanges(spec: SingleTrack) {\n if (IsChannelDeep(spec.y) && spec.y.flip && Array.isArray(spec.y.range)) {\n spec.y.range = spec.y.range.reverse();\n }\n }\n\n /**\n * Find an axis channel that is encoded with genomic coordinate and return the key (e.g., 'x').\n * `undefined` if not found.\n */\n public getGenomicChannelKey(): 'x' | 'xe' | 'y' | 'ye' | 'x1' | 'x1e' | 'y1' | 'y1e' | undefined {\n return getGenomicChannelKeyFromTrack(this.spec());\n }\n /**\n * Find a genomic field from the track specification.\n * `undefined` if not found.\n */\n public getGenomicChannel(): ChannelDeep | undefined {\n return getGenomicChannelFromTrack(this.spec());\n }\n\n /**\n * Replace a domain with a new one in the complete spec(s) if the original spec does not define the domain.\n * A domain is replaced only when the channel is bound with data (i.e., `ChannelDeep`).\n */\n public setChannelDomain(channelKey: keyof typeof ChannelTypes, domain: string[] | number[], force?: boolean) {\n const channelRaw = this.originalSpec()[channelKey];\n if (!force && IsChannelDeep(channelRaw) && channelRaw.domain !== undefined) {\n // if domain is provided in the original spec, we do not replace the domain in the complete spec(s)\n return;\n }\n const channel = this.specComplete[channelKey];\n if (IsChannelDeep(channel)) {\n channel.domain = domain;\n }\n }\n\n /**\n * Update default constant values by looking up other channels' scales.\n */\n public updateChannelValue() {\n if (this.originalSpec().y === undefined) {\n const y = this.spec().y;\n const rowCategories = this.getChannelDomainArray('row');\n if (y && IsChannelValue(y) && rowCategories && this.spec().mark !== 'withinLink') {\n y.value = (this.spec().height as number) / rowCategories.length / 2.0;\n }\n }\n }\n\n /**\n * Get the encoded value using the scales already constructed.\n */\n public encodedValue(channelKey: keyof typeof ChannelTypes, value?: number | string) {\n if (channelKey === 'text' && value !== undefined) {\n return `${+value ? ~~value : value}`;\n // TODO: Better formatting?\n // return `${+value ? (+value - ~~value) > 0 ? (+value).toExponential(1) : ~~value : value}`;\n }\n\n const channel = this.spec()[channelKey];\n const channelFieldType = IsChannelDeep(channel)\n ? channel.type\n : IsChannelValue(channel)\n ? 'constant'\n : undefined;\n\n if (!channelFieldType) {\n // Shouldn't be reached. Channel should be either encoded with data or a constant value.\n return undefined;\n }\n\n if (channelFieldType === 'constant') {\n // Just return the constant value.\n return (this.channelScales[channelKey] as () => number | string)();\n }\n\n if (value === undefined) {\n // Value is undefined, so returning undefined.\n return undefined;\n }\n\n if (value === null) {\n if (channelFieldType === 'quantitative') {\n value = 0;\n } else if (channelFieldType === 'nominal') {\n value = 'null';\n }\n }\n\n if (typeof this.channelScales[channelKey] !== 'function') {\n // Scale is undefined, so returning undefined.\n return undefined;\n }\n\n // The type of a channel scale is determined by a { channel type, field type } pair\n switch (channelKey) {\n case 'x':\n case 'y':\n case 'x1':\n case 'y1':\n case 'xe':\n case 'ye':\n case 'x1e':\n if (channelFieldType === 'quantitative' || channelFieldType === 'genomic') {\n return (this.channelScales[channelKey] as ScaleLinear)(value as number);\n }\n if (channelFieldType === 'nominal') {\n return (this.channelScales[channelKey] as ScaleBand)(value as string);\n }\n break;\n case 'stroke':\n case 'color':\n if (channelFieldType === 'quantitative') {\n const s = (this.channelScales[channelKey] as ScaleSequential).copy();\n const d = s.domain();\n const e = d[1] - d[0];\n const so = Array.from((channel as Color).scaleOffset ?? [0, 1]);\n return s.domain([d[0] + e * so.sort()[0], d[0] + e * so.sort()[1]])(value as number);\n }\n if (channelFieldType === 'nominal') {\n return (this.channelScales[channelKey] as ScaleOrdinal)(value as string);\n }\n /* genomic is not supported */\n break;\n case 'size':\n if (channelFieldType === 'quantitative') {\n return (this.channelScales[channelKey] as ScaleLinear)(value as number);\n }\n if (channelFieldType === 'nominal') {\n return (this.channelScales[channelKey] as ScaleOrdinal)(value as string);\n }\n /* genomic is not supported */\n break;\n case 'row':\n /* quantitative is not supported */\n if (channelFieldType === 'nominal') {\n return (this.channelScales[channelKey] as ScaleBand)(value as string);\n }\n /* genomic is not supported */\n break;\n case 'strokeWidth':\n case 'opacity':\n if (channelFieldType === 'quantitative') {\n return (this.channelScales[channelKey] as ScaleLinear)(value as number);\n }\n /* nominal is not supported */\n /* genomic is not supported */\n break;\n default:\n console.warn(`${channelKey} is not supported for encoding values, so returning a undefined value`);\n return undefined;\n }\n }\n\n public trackVisibility(currentStage: { zoomLevel?: number }): boolean {\n const spec = this.spec();\n if (\n !spec.visibility ||\n spec.visibility.length === 0 ||\n spec.visibility.filter(d => d.target === 'track').length === 0\n ) {\n // if condition is not defined, just show them.\n return true;\n }\n\n // We are using a logical operation AND, so if unless all options are `true`, we hide this track.\n let visibility = true;\n spec.visibility\n .filter(d => d.target === 'track')\n .forEach(d => {\n const { operation, measure, threshold } = d;\n\n let compareValue: number | undefined;\n\n if (measure === 'zoomLevel') {\n compareValue = currentStage[measure];\n } else {\n compareValue = spec[measure];\n }\n\n if (compareValue !== undefined) {\n // compare only when the measure is suggested\n visibility = visibility && logicalComparison(compareValue, operation, threshold as number) === 1;\n }\n });\n return visibility;\n }\n\n /**\n * Check whether the visual mark should be visible or not.\n * Return 0 (invisible) only when the predefined condition is correct.\n */\n public markVisibility(datum: { [k: string]: string | number }, metrics?: any): number {\n const spec = this.spec();\n if (\n !spec.visibility ||\n spec.visibility.length === 0 ||\n spec.visibility.filter(d => d.target === 'mark').length === 0\n ) {\n // if condition is not defined, just show them.\n return 1;\n }\n\n let visibility = 1;\n\n // Find the lowest visibility\n spec.visibility\n .filter(d => d.target === 'mark')\n .forEach(d => {\n const { operation, threshold, conditionPadding, transitionPadding, measure } = d;\n\n const padding = conditionPadding ?? 0;\n const mark = spec.mark;\n\n let newVisibility = 1;\n\n if (mark === 'text' && threshold === '|xe-x|' && measure === 'width') {\n // compare between the actual width and the |xe-x|\n const xe = this.encodedPIXIProperty('xe', datum);\n const x = this.encodedPIXIProperty('x', datum);\n\n if (xe !== undefined && metrics?.width) {\n newVisibility = logicalComparison(\n metrics.width + padding,\n operation,\n Math.abs(xe - x),\n transitionPadding\n );\n }\n } else if (measure === 'width' && typeof threshold === 'number' && metrics?.width) {\n // compare between the actual width and the constant width that user specified\n newVisibility = logicalComparison(metrics.width + padding, operation, threshold, transitionPadding);\n } else if (measure === 'zoomLevel' && typeof threshold === 'number' && metrics?.zoomLevel) {\n newVisibility = logicalComparison(metrics.zoomLevel, operation, threshold, transitionPadding);\n }\n\n // Update only if the upcoming one is smaller\n if (visibility > newVisibility) {\n visibility = newVisibility;\n }\n });\n return visibility;\n }\n\n /**\n *\n */\n public visualPropertyByChannel(channelKey: keyof typeof ChannelTypes, datum?: { [k: string]: string | number }) {\n const value = datum !== undefined ? getValueUsingChannel(datum, this.spec()[channelKey] as Channel) : undefined; // Is this safe enough?\n return this.encodedValue(channelKey, value);\n }\n\n /**\n * Retrieve an encoded visual property of a visual mark.\n */\n public encodedPIXIProperty(\n propertyKey: PIXIVisualProperty,\n datum?: { [k: string]: string | number },\n additionalInfo?: any\n ) {\n const mark = this.spec().mark;\n\n // common visual properties, not specific to visual marks\n if (\n [\n 'text',\n 'color',\n 'row',\n 'stroke',\n 'opacity',\n 'strokeWidth',\n 'x',\n 'y',\n 'xe',\n 'x1',\n 'x1e',\n 'ye',\n 'size'\n ].includes(propertyKey)\n ) {\n return this.visualPropertyByChannel(propertyKey as any, datum);\n }\n\n switch (mark) {\n case 'bar':\n return barProperty(this, propertyKey, datum, additionalInfo);\n case 'point':\n case 'text':\n return pointProperty(this, propertyKey, datum);\n case 'rect':\n return rectProperty(this, propertyKey, datum, additionalInfo);\n default:\n // Mark type that is not supported yet\n return undefined;\n }\n }\n\n // TODO: better organize this, perhaps, by combining several if statements\n /**\n * Set missing `range`, `domain`, and/or `value` of each channel by looking into data.\n */\n public addScaleMaterials(spec: SingleTrack) {\n const data = this.data();\n\n const genomicChannel = this.getGenomicChannel();\n if (!genomicChannel || !genomicChannel.field) {\n console.warn('Genomic field is not provided in the specification');\n // EXPERIMENTAL: we are removing this rule in our spec.\n return;\n }\n\n if (typeof spec.width === 'undefined' || typeof spec.height === 'undefined') {\n console.warn('Track size is not determined yet');\n return;\n }\n\n // const WARN_MSG = (c: string, t: string) =>\n // `The channel key and type pair {${c}, ${t}} is not supported when generating channel scales`;\n\n SUPPORTED_CHANNELS.forEach(channelKey => {\n const channel = spec[channelKey];\n\n if (IsStackedChannel(spec, channelKey) && IsChannelDeep(channel)) {\n // we need to group data before calculating scales because marks are going to be stacked\n // (spec as any /* TODO: select more accurately */).x\n const pivotedData = group(data, d => d[genomicChannel.field as string]);\n const xKeys = [...pivotedData.keys()];\n\n if (!channel.domain) {\n // TODO: consider data ranges in negative values\n const min =\n 'zeroBaseline' in channel && channel.zeroBaseline\n ? 0\n : d3min(\n xKeys.map(d =>\n d3sum(\n (pivotedData.get(d) as any).map((_d: any) =>\n channel.field ? _d[channel.field] : undefined\n )\n )\n ) as number[]\n );\n const max = d3max(\n xKeys.map(d =>\n d3sum(\n (pivotedData.get(d) as any).map((_d: any) =>\n channel.field ? _d[channel.field] : undefined\n )\n )\n ) as number[]\n );\n channel.domain = [min, max] as [number, number]; // TODO: what if data ranges in negative values\n }\n\n if (!channel.range) {\n const rowChannel = spec.row;\n const rowField = IsChannelDeep(rowChannel) ? rowChannel.field : undefined;\n const rowCategories =\n this.getChannelDomainArray('row') ??\n (rowField ? Array.from(new Set(data.map(d => d[rowField as string]))) : [1]);\n const rowHeight = (spec.height as number) / rowCategories.length;\n\n // `channel` here is either `x` or `y` because they only can ba stacked\n switch (channelKey) {\n case 'x':\n channel.range = [0, spec.width] as [number, number]; // TODO: not considering vertical direction tracks\n break;\n case 'y':\n channel.range = [0, rowHeight];\n break;\n }\n }\n } else {\n const rowChannel = spec.row;\n const rowField = IsChannelDeep(rowChannel) ? rowChannel.field : undefined;\n const rowCategories =\n this.getChannelDomainArray('row') ??\n (rowField ? Array.from(new Set(data.map(d => d[rowField as string]))) : [1]);\n const rowHeight = (spec.height as number) / rowCategories.length;\n\n if (!channel) {\n // this means the channel is entirely missing in the specification, so we add a default value\n let value;\n switch (channelKey) {\n case 'x':\n value = (spec.width as number) / 2.0;\n break;\n case 'y':\n if (spec.mark === 'withinLink') value = rowHeight;\n else value = rowHeight / 2.0;\n break;\n case 'size':\n if (spec.mark === 'line') value = this.theme.line.size;\n else if (spec.mark === 'bar') value = undefined;\n else if (spec.mark === 'rect') value = undefined;\n else if (spec.mark === 'triangleRight') value = undefined;\n else if (spec.mark === 'triangleLeft') value = undefined;\n else if (spec.mark === 'triangleBottom') value = undefined;\n // Points in this case are stretched from `x` to `xe`\n else if (\n spec.stretch &&\n spec.mark === 'point' &&\n IsChannelDeep(spec.x) &&\n IsChannelDeep(spec.xe)\n )\n value = undefined;\n else if (spec.mark === 'text') value = 12;\n else value = this.theme.point.size;\n break;\n case 'color':\n value = this.theme.markCommon.color;\n break;\n case 'row':\n value = 0;\n break;\n case 'stroke':\n // !! TODO: These should be based on themes\n if (spec.mark === 'text') value = this.theme.text.stroke;\n else value = this.theme.markCommon.stroke;\n break;\n case 'strokeWidth':\n if (spec.mark === 'rule') value = this.theme.rule.strokeWidth;\n else if (spec.mark === 'withinLink' || spec.mark === 'betweenLink')\n value = this.theme.link.strokeWidth;\n else if (spec.mark === 'text') value = this.theme.text.strokeWidth;\n else value = this.theme.markCommon.strokeWidth;\n break;\n case 'opacity':\n value = this.theme.markCommon.opacity;\n break;\n case 'text':\n value = '';\n break;\n default:\n // console.warn(WARN_MSG(channelKey, 'value'));\n }\n if (typeof value !== 'undefined') {\n spec[channelKey] = { value } as ChannelValue;\n }\n } else if (IsChannelDeep(channel) && (channel.type === 'quantitative' || channel.type === 'genomic')) {\n if (channel.domain === undefined) {\n const min =\n 'zeroBaseline' in channel && channel.zeroBaseline\n ? 0\n : (d3min(data.map(d => +d[channel.field as string]) as number[]) as number) ?? 0;\n const max = (d3max(data.map(d => +d[channel.field as string]) as number[]) as number) ?? 0;\n channel.domain = [min, max]; // TODO: what if data ranges in negative values\n } else if (channel.type === 'genomic' && !IsDomainArray(channel.domain)) {\n channel.domain = getNumericDomain(channel.domain);\n }\n\n if (\n (channelKey === 'color' || channelKey === 'stroke') &&\n channel.type === 'quantitative' &&\n !(channel as Color).scaleOffset\n ) {\n (channel as Color | Stroke).scaleOffset = [0, 1];\n }\n\n if (!channel.range) {\n let range;\n switch (channelKey) {\n case 'x':\n case 'xe':\n case 'x1':\n case 'x1e':\n range = [0, spec.width];\n break;\n case 'y':\n case 'ye':\n range = [0, rowHeight];\n break;\n case 'color':\n case 'stroke':\n range = CHANNEL_DEFAULTS.QUANTITATIVE_COLOR as PredefinedColors;\n break;\n case 'size':\n range = this.theme.markCommon.quantitativeSizeRange;\n break;\n case 'strokeWidth':\n range = [1, 3];\n break;\n case 'opacity':\n range = [0, 1];\n break;\n default:\n // console.warn(WARN_MSG(channelKey, channel.type));\n break;\n }\n if (range) {\n channel.range = range as PredefinedColors | number[];\n }\n }\n } else if (IsChannelDeep(channel) && channel.type === 'nominal') {\n if (channel.domain === undefined) {\n channel.domain = Array.from(\n new Set(data.map(d => d[channel.field as string] ?? 'null'))\n ) as string[];\n }\n if (!channel.range) {\n let startSize = 2;\n let range;\n switch (channelKey) {\n case 'x':\n case 'xe':\n range = [0, spec.width];\n break;\n case 'y':\n case 'ye':\n range = [rowHeight, 0]; // reversed because the origin is on the top\n break;\n case 'color':\n case 'stroke':\n range = this.theme.markCommon.nominalColorRange;\n break;\n case 'row':\n range = [0, spec.height];\n break;\n case 'size':\n range = (channel.domain as number[]).map(() => startSize++);\n break;\n default:\n // console.warn(WARN_MSG(channelKey, channel.type));\n break;\n }\n if (range) {\n channel.range = range as number[] | string[];\n }\n }\n }\n }\n });\n\n /* Merge domains of neighbor channels (e.g., x and xe) */\n [\n ['x', 'xe'],\n ['y', 'ye']\n ].forEach(pair => {\n const [k1, k2] = pair as [keyof typeof ChannelTypes, keyof typeof ChannelTypes];\n const c1 = spec[k1],\n c2 = spec[k2];\n if (\n IsChannelDeep(c1) &&\n IsChannelDeep(c2) &&\n c1.type === c2.type &&\n c1.domain &&\n c2.domain &&\n Array.isArray(c1.domain) &&\n Array.isArray(c2.domain)\n ) {\n if (c1.type === 'genomic' || c1.type === 'quantitative') {\n const min = d3min([c1.domain[0] as number, c2.domain[0] as number]) as number;\n const max = d3max([c1.domain[1] as number, c2.domain[1] as number]) as number;\n c1.domain = c2.domain = [min, max];\n } else if (c1.type === 'nominal') {\n const range = Array.from(new Set([...c1.domain, ...c2.domain])) as string[];\n c1.range = c2.range = range;\n }\n }\n });\n }\n\n /**\n * Store the scale of individual visual channels based on the `complete` spec.\n */\n public generateScales() {\n const spec = this.spec();\n\n /// DEBUG\n // console.log(spec);\n //\n\n SUPPORTED_CHANNELS.forEach(channelKey => {\n const channel = spec[channelKey];\n\n if (IsChannelValue(channel)) {\n this.channelScales[channelKey] = () => channel.value;\n } else if (IsChannelDeep(channel)) {\n if (channelKey === 'text') {\n // We do not generate scales for 'text' marks.\n return;\n }\n\n const domain = channel.domain;\n const range = channel.range;\n\n if (domain === undefined || range === undefined) {\n // we do not have sufficient info to generate scales\n return;\n }\n\n if (channel.type === 'quantitative' || channel.type === 'genomic') {\n switch (channelKey) {\n case 'x':\n case 'x1':\n case 'xe':\n case 'x1e':\n case 'y':\n case 'ye':\n case 'size':\n case 'opacity':\n case 'strokeWidth':\n this.channelScales[channelKey] = scaleLinear()\n .domain(domain as [number, number])\n .range(range as [number, number]);\n break;\n case 'color':\n case 'stroke':\n let interpolate = interpolateViridis;\n if (Object.keys(PREDEFINED_COLOR_STR_MAP).includes(range as string)) {\n interpolate = PREDEFINED_COLOR_STR_MAP[range as string];\n }\n this.channelScales[channelKey] = scaleSequential(interpolate).domain(\n domain as [number, number]\n );\n break;\n default:\n break;\n // console.warn('Not supported channel for calculating scales');\n }\n } else if (channel.type === 'nominal') {\n switch (channelKey) {\n case 'x':\n case 'xe':\n case 'y':\n case 'ye':\n case 'row':\n this.channelScales[channelKey] = scaleBand()\n .domain(domain as string[])\n .range(range as [number, number]);\n break;\n case 'size':\n this.channelScales[channelKey] = scaleOrdinal()\n .domain(domain as string[])\n .range(range as number[]);\n break;\n case 'color':\n case 'stroke':\n this.channelScales[channelKey] = scaleOrdinal(range as string[]).domain(domain as string[]);\n break;\n default:\n break;\n // console.warn('Not supported channel for calculating scales');\n }\n }\n }\n });\n }\n\n /**\n * Return the scale of a visual channel.\n * `undefined` if we do not have the scale.\n */\n public getChannelScale(channelKey: keyof typeof ChannelTypes) {\n return this.channelScales[channelKey];\n }\n\n /**\n * Set a new scale for a certain channel. Usually called to replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher.\n */\n public setChannelScale(channelKey: keyof typeof ChannelTypes, scale: ScaleType) {\n this.channelScales[channelKey] = scale;\n }\n\n /**\n * Return whether to show y-axis.\n */\n public isShowYAxis(): boolean {\n const spec = this.spec();\n const yDomain = this.getChannelDomainArray('y');\n const yRange = this.getChannelRangeArray('y');\n return (\n IsChannelDeep(spec.y) && spec.y.axis !== 'none' && spec.y.type === 'quantitative' && !!yDomain && !!yRange\n );\n }\n\n /**\n * Return the domain of a visual channel.\n * `undefined` if we do not have domain in array.\n */\n public getChannelDomainArray(channelKey: keyof typeof ChannelTypes): string[] | number[] | undefined {\n const c = this.spec()[channelKey];\n return IsChannelDeep(c) && IsDomainArray(c.domain) ? c.domain : undefined;\n }\n\n /**\n * Return the range of a visual channel.\n * `undefined` if we do not have domain in array.\n */\n public getChannelRangeArray(channelKey: keyof typeof ChannelTypes): string[] | number[] | undefined {\n const c = this.spec()[channelKey];\n return IsChannelDeep(c) && IsRangeArray(c.range) ? c.range : undefined;\n }\n\n /**\n * Validate the original spec.\n */\n public validateSpec(): { valid: boolean; errorMessages: string[] } {\n return validateTrack(this.originalSpec());\n }\n}\n","import type { _EventMap } from '@gosling-lang/gosling-schema';\nimport PubSub from 'pubsub-js';\n\ntype EventName = keyof _EventMap;\n\nexport function publish(name: Name, data: _EventMap[Name]): void {\n PubSub.publish(name, data);\n}\n\nexport function subscribe(\n name: Name,\n callback: (msg: string, data: _EventMap[Name]) => void\n): void {\n PubSub.subscribe(name, callback);\n}\n\nexport function unsubscribe(name: EventName): void {\n PubSub.unsubscribe(name);\n}\n","import type * as PIXI from 'pixi.js';\nimport { isEqual, sampleSize, uniqBy } from 'lodash-es';\nimport type { ScaleLinear } from 'd3-scale';\nimport type {\n SingleTrack,\n OverlaidTrack,\n Datum,\n EventStyle,\n GenomicPosition,\n Assembly,\n ValueExtent,\n Range\n} from '@gosling-lang/gosling-schema';\nimport { type MouseEventData, isPointInsideDonutSlice } from '../gosling-track/gosling-mouse-event';\nimport { BamDataFetcher, type TabularDataFetcher } from '@data-fetchers';\nimport type { Tile as _Tile, TileData, TileDataBase } from '@higlass/services';\nimport { LinearBrushModel } from '@gosling-lang/gosling-brush';\nimport { getTheme } from '@gosling-lang/gosling-theme';\nimport { getTabularData } from './data-abstraction';\n\nimport type { CompleteThemeDeep } from '../../core/utils/theme';\nimport { drawMark, drawPostEmbellishment, drawPreEmbellishment } from '../../core/mark';\nimport { GoslingTrackModel } from './gosling-track-model';\nimport { validateTrack } from '@gosling-lang/gosling-schema';\nimport { shareScaleAcrossTracks } from '../../core/utils/scales';\nimport { resolveSuperposedTracks } from '../../core/utils/overlay';\nimport colorToHex from '../../core/utils/color-to-hex';\nimport {\n aggregateCoverage,\n calculateData,\n concatString,\n displace,\n filterData,\n calculateGenomicLength,\n parseSubJSON,\n replaceString,\n splitExon,\n inferSvType\n} from '../../core/utils/data-transform';\nimport { publish } from '../../api/pubsub';\nimport { getRelativeGenomicPosition } from '../../core/utils/assembly';\nimport { getTextStyle } from '../../core/utils/text-style';\nimport {\n Is2DTrack,\n IsChannelDeep,\n IsMouseEventsDeep,\n IsXAxis,\n isTabularDataFetcher,\n hasDataTransform\n} from '@gosling-lang/gosling-schema';\nimport { HIGLASS_AXIS_SIZE } from '../../compiler/higlass-model';\nimport { flatArrayToPairArray } from '../../core/utils/array';\nimport { createPluginTrack, type PluginTrackFactory, type TrackConfig } from '../../core/utils/define-plugin-track';\nimport { uuid } from '../../core/utils/uuid';\n\n// Set `true` to print in what order each function is called\nexport const PRINT_RENDERING_CYCLE = false;\n\n// For using libraries, refer to https://github.com/higlass/higlass/blob/f82c0a4f7b2ab1c145091166b0457638934b15f3/app/scripts/configs/available-for-plugins.js\n// `getTilePosAndDimensions()` definition: https://github.com/higlass/higlass/blob/1e1146409c7d7c7014505dd80d5af3e9357c77b6/app/scripts/Tiled1DPixiTrack.js#L133\n// Refer to the following already supported graphics:\n// https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/PixiTrack.js#L115\n\nconst DEFAULT_MOUSE_EVENT_STYLE: Required = {\n stroke: 'black',\n strokeWidth: 1,\n strokeOpacity: 1,\n color: 'none',\n opacity: 1,\n arrange: 'front'\n};\n\ninterface GoslingTrackOptions {\n /**\n * Track ID specified by users\n */\n id: string;\n /**\n * Track IDs that are superposed with this track, containing the id of this track itself\n */\n siblingIds: string[];\n spec: SingleTrack | OverlaidTrack;\n theme: CompleteThemeDeep;\n showMousePosition?: boolean;\n}\n\n/** Tile data used in Gosling data fetchers */\ninterface TabularTileData extends TileDataBase {\n tabularData: Datum[];\n}\n\n/** Mutated type of `Tile` that includes Gosling's tile data, i.e., tabular tile data */\nexport interface Tile extends Omit<_Tile, 'tileData'> {\n tileData: TileData | TabularTileData;\n}\n\ninterface ProcessedTileInfo {\n /** Single tile can contain multiple gosling models if multiple tracks are superposed */\n goslingModels: GoslingTrackModel[];\n tabularData: Datum[];\n /** Flag variable that indicate that rendering of this tile should be skipped */\n skipRendering: boolean;\n}\n\n/** Information about the rendered color legend */\nexport interface DisplayedLegend {\n domain: ValueExtent;\n range: Range;\n}\n\nfunction initProcessedTileInfo(): ProcessedTileInfo {\n return { goslingModels: [], tabularData: [], skipRendering: false };\n}\n\nconst config: TrackConfig = {\n type: 'gosling-track',\n datatype: ['multivec', 'epilogos'],\n orientation: '1d-horizontal',\n // @ts-expect-error missing default spec\n defaultOptions: {\n // TODO: Are any of these used?\n // labelPosition: 'none',\n // labelColor: 'black',\n // labelTextOpacity: 0.4,\n // trackBorderWidth: 0,\n // trackBorderColor: 'black',\n // backgroundColor: 'white',\n // barBorder: false,\n // sortLargestOnTop: true,\n // axisPositionHorizontal: 'left',\n theme: getTheme('light')\n }\n};\n\nconst factory: PluginTrackFactory = (HGC, context, options) => {\n // Services\n const { tileProxy } = HGC.services;\n const { BarTrack } = HGC.tracks;\n\n /* Custom loading label */\n const loadingTextStyle = getTextStyle({ color: 'black', size: 12 });\n\n /**\n * The main plugin track in Gosling. This is a versetile plugin track for HiGlass which relies on GoslingTrackModel\n * to keep track of mouse event and channel scales.\n */\n class GoslingTrackClass extends BarTrack {\n /* *\n *\n * Properties\n *\n * */\n\n tileSize: number;\n mRangeBrush: LinearBrushModel;\n #assembly?: Assembly; // Used to get the relative genomic position\n #processedTileInfo: Record;\n firstDraw = true; // False if draw has been called once already. Used with onNewTrack API. Public because used in draw()\n // Used in mark/legend.ts\n gLegend? = HGC.libraries.d3Selection.select(context.svgElement).append('g');\n displayedLegends: DisplayedLegend[] = []; // Store the color legends added so far so that we can avoid overlaps and redundancy\n // Used in mark/text.ts\n textGraphics: unknown[] = [];\n textsBeingUsed = 0;\n // Mouse fields\n pMouseHover = new HGC.libraries.PIXI.Graphics();\n pMouseSelection = new HGC.libraries.PIXI.Graphics();\n #mouseDownX = 0;\n #mouseDownY = 0;\n #isRangeBrushActivated = false;\n #gBrush = HGC.libraries.d3Selection.select(context.svgElement).append('g');\n #loadingTextStyleObj = new HGC.libraries.PIXI.TextStyle(loadingTextStyle);\n #loadingTextBg = new HGC.libraries.PIXI.Graphics();\n #loadingText = new HGC.libraries.PIXI.Text('', loadingTextStyle);\n prevVisibleAndFetchedTiles?: Tile[];\n resolvedTracks: SingleTrack[] | undefined;\n\n /* *\n *\n * Constructor\n *\n * */\n\n constructor() {\n super(context, options);\n\n context.dataFetcher.track = this;\n this.#processedTileInfo = {};\n this.#assembly = this.options.spec.assembly;\n\n // Add unique IDs to each of the overlaid tracks that will be rendered independently.\n if ('overlay' in this.options.spec) {\n this.options.spec.overlay = (this.options.spec as OverlaidTrack)._overlay.map(o => {\n return { ...o, _renderingId: uuid() };\n });\n } else {\n this.options.spec._renderingId = uuid();\n }\n\n this.fetchedTiles = {};\n this.tileSize = this.tilesetInfo?.tile_size ?? 1024;\n\n const { valid, errorMessages } = validateTrack(this.options.spec);\n\n if (!valid) {\n console.warn('The specification of the following track is invalid', errorMessages, this.options.spec);\n }\n\n // Graphics for highlighting visual elements under the cursor\n this.pMain.addChild(this.pMouseHover);\n this.pMain.addChild(this.pMouseSelection);\n\n // Enable click event\n this.pMask.interactive = true;\n this.mRangeBrush = new LinearBrushModel(this.#gBrush, HGC.libraries, this.options.spec.style?.brush);\n this.mRangeBrush.on('brush', this.#onRangeBrush.bind(this));\n\n this.pMask.on('mousedown', (e: PIXI.InteractionEvent) => {\n const { x, y } = e.data.getLocalPosition(this.pMain);\n this.#onMouseDown(x, y, e.data.originalEvent.altKey);\n });\n this.pMask.on('mouseup', (e: PIXI.InteractionEvent) => {\n const { x, y } = e.data.getLocalPosition(this.pMain);\n this.#onMouseUp(x, y);\n });\n this.pMask.on('mousemove', (e: PIXI.InteractionEvent) => {\n const { x } = e.data.getLocalPosition(this.pMain);\n this.#onMouseMove(x);\n });\n this.pMask.on('mouseout', this.#onMouseOut.bind(this));\n this.flipText = this.options.spec.orientation === 'vertical';\n\n // Remove a mouse graphic if created by a parent, and draw ourselves.\n // See https://github.com/higlass/higlass/blob/38f0c4415f0595c3b9d685a754d6661dc9612f7c/app/scripts/utils/show-mouse-position.js#L28\n if (this.hideMousePosition) {\n this.hideMousePosition();\n this.hideMousePosition = undefined;\n }\n if (this.options?.showMousePosition && !this.hideMousePosition) {\n this.hideMousePosition = HGC.utils.showMousePosition(\n this,\n Is2DTrack(this.getResolvedTracks()[0]),\n this.isShowGlobalMousePosition()\n );\n }\n\n // We do not use HiGlass' trackNotFoundText\n this.pLabel.removeChild(this.trackNotFoundText);\n\n this.#loadingText.anchor.x = 1;\n this.#loadingText.anchor.y = 1;\n this.pLabel.addChild(this.#loadingTextBg);\n this.pLabel.addChild(this.#loadingText);\n\n // This improves the arc/link rendering performance\n HGC.libraries.PIXI.GRAPHICS_CURVES.adaptive = this.options.spec.style?.enableSmoothPath ?? false;\n if (HGC.libraries.PIXI.GRAPHICS_CURVES.adaptive) {\n HGC.libraries.PIXI.GRAPHICS_CURVES.maxLength = 1;\n HGC.libraries.PIXI.GRAPHICS_CURVES.maxSegments = 2048 * 10;\n }\n }\n\n /* *\n *\n * Rendering Cycle Methods\n *\n * */\n\n /**\n * Draw all tiles from the bottom. Called from TiledPixiTrack constructor, so all methods called must be\n * public. https://github.com/higlass/higlass/blob/387a03e877dcfa4c2cfeabc0869375b58c0b362d/app/scripts/TiledPixiTrack.js#L216\n * Overrides draw() in BarTrack.\n * This means some class properties can be still `undefined`.\n */\n override draw() {\n if (PRINT_RENDERING_CYCLE) console.warn('draw()');\n this.clearMouseEventData();\n this.textsBeingUsed = 0;\n this.pMouseHover?.clear();\n\n const processTilesAndDraw = () => {\n // Should we force to process all tiles?\n // For BAM, yes, since all tiles are stored in a single tile and visible tiles had been changed.\n const isBamDataFetcher = this.dataFetcher instanceof BamDataFetcher;\n\n // Preprocess all tiles at once so that we can share scales across tiles.\n this.processAllTiles(isBamDataFetcher);\n\n // This function calls `drawTile` on each tile.\n super.draw();\n\n // Record tiles so that we ignore loading same tiles again\n this.prevVisibleAndFetchedTiles = this.visibleAndFetchedTiles();\n };\n\n if (\n isTabularDataFetcher(this.dataFetcher) &&\n !isEqual(this.visibleAndFetchedTiles(), this.prevVisibleAndFetchedTiles)\n ) {\n this.updateTileAsync(this.dataFetcher as TabularDataFetcher, processTilesAndDraw);\n } else {\n processTilesAndDraw();\n }\n\n // Based on the updated marks, update range selection\n this.mRangeBrush?.drawBrush(true);\n // Publish onNewTrack if this is the first draw\n if (this.firstDraw) {\n this.#publishOnNewTrack();\n this.firstDraw = false;\n }\n }\n\n /*\n * Do whatever is necessary before rendering a new tile. This function is called from `receivedTiles()`.\n * Overrides initTile in BarTrack\n * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/HorizontalLine1DPixiTrack.js#L50)\n */\n override initTile(tile: Tile) {\n if (PRINT_RENDERING_CYCLE) console.warn('initTile(tile)');\n // Since `super.initTile(tile)` prints warning, we call `drawTile` ourselves without calling\n // `super.initTile(tile)`.\n this.drawTile(tile);\n }\n\n override updateTile(/* tile: Tile */) {} // Never mind about this function for the simplicity.\n override renderTile(/* tile: Tile */) {} // Never mind about this function for the simplicity.\n\n /**\n * Display a tile upon receiving a new one or when explicitly called by a developer, e.g., calling\n * `this.draw()`. Overrides drawTile in BarTrack\n */\n override drawTile(tile: Tile) {\n if (PRINT_RENDERING_CYCLE) console.warn('drawTile(tile)');\n\n /**\n * If we don't have info about the tile, we can't draw anything.\n */\n const tileInfo = this.#processedTileInfo[tile.tileId];\n if (!tileInfo) {\n // We do not have a track model prepared to visualize\n return;\n }\n\n /**\n * Add a copy of the track scale to the tile. The tile needs its own scale because we will use it to\n * determine how much the tile has been stretched (if we are stretching the graphics)\n */\n if (!tile.drawnAtScale) {\n // This is the first time this tile is being drawn\n tile.drawnAtScale = this._xScale.copy();\n }\n\n /**\n * For certain types of marks and layouts (linear), we can stretch the graphics to avoid redrawing\n * This is much more performant than redrawing everything at every frame\n */\n const [graphicsXScale, graphicsXPos] = this.getXScaleAndOffset(tile.drawnAtScale);\n const isFirstRender = graphicsXScale === 1; // The graphicsXScale is 1 if first time the tile is being drawn\n if (!this.#isTooStretched(graphicsXScale) && this.#hasStretchableGraphics() && !isFirstRender) {\n // Stretch the graphics\n tile.graphics.scale.x = graphicsXScale;\n tile.graphics.position.x = graphicsXPos;\n return;\n }\n\n /**\n * If we can't stretch the graphics, we need to redraw everything!\n */\n\n // We need the tile scale to match the scale of the track\n tile.drawnAtScale = this._xScale.copy();\n // Clear the graphics and redraw everything\n tile.graphics?.clear();\n tile.graphics?.removeChildren();\n\n // This is only to render embellishments only once.\n // TODO: Instead of rendering and removing for every tiles, render pBorder only once\n this.pBackground.clear();\n this.pBackground.removeChildren();\n this.pBorder.clear();\n this.pBorder.removeChildren();\n this.displayedLegends = [];\n\n // Because a single tile contains one track or multiple tracks overlaid, we draw marks and embellishments\n // for each GoslingTrackModel\n tileInfo.goslingModels.forEach((model: GoslingTrackModel) => {\n // check visibility condition\n const trackWidth = this.dimensions[0];\n const zoomLevel = this._xScale.invert(trackWidth) - this._xScale.invert(0);\n\n if (!model.trackVisibility({ zoomLevel })) {\n return;\n }\n drawPreEmbellishment(HGC, this, tile, model, this.options.theme);\n drawMark(HGC, this, tile, model);\n drawPostEmbellishment(HGC, this, tile, model, this.options.theme);\n });\n\n this.forceDraw();\n }\n\n /**\n * Render this track again using a new option when a user changed the option. Overrides rerender in BarTrack.\n */\n override rerender(newOptions: GoslingTrackOptions) {\n if (PRINT_RENDERING_CYCLE) console.warn('rerender(options)');\n this.options = newOptions;\n\n if (this.options.spec.layout === 'circular') {\n // TODO (May-27-2022): remove the following line when we support a circular brush.\n // If the spec is changed to use the circular layout, we remove the current linear brush\n // because circular brush is not supported.\n this.mRangeBrush.remove();\n }\n this.getResolvedTracks(true); // force update\n this.clearMouseEventData();\n this.textsBeingUsed = 0;\n\n this.processAllTiles(true);\n this.draw();\n this.forceDraw();\n }\n /**\n * Clears MouseEventModel from each GoslingTrackModel. Must be a public method because it is called from draw()\n */\n clearMouseEventData() {\n this.visibleAndFetchedGoslingModels().forEach(model => model.getMouseEventModel().clear());\n }\n /**\n * Collect all gosling models that correspond to the tiles that are both visible and fetched.\n */\n visibleAndFetchedGoslingModels() {\n return this.visibleAndFetchedTiles().flatMap(\n tile => this.#processedTileInfo[tile.tileId]?.goslingModels ?? []\n );\n }\n\n /**\n * End of the rendering cycle. This function is called when the track is removed entirely.\n */\n override remove() {\n super.remove();\n\n if (this.gLegend) {\n this.gLegend.remove();\n this.gLegend = undefined;\n }\n this.mRangeBrush.remove();\n }\n /*\n * Rerender all tiles when track size is changed. Overrides method in TiledPixiTrack\n * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/PixiTrack.js#L186).\n */\n override setDimensions(newDimensions: [number, number]) {\n if (PRINT_RENDERING_CYCLE) console.warn('setDimensions()');\n\n super.setDimensions(newDimensions); // This simply updates `this._xScale` and `this._yScale`\n\n this.mRangeBrush.setSize(newDimensions[1]);\n }\n\n /**\n * Record new position.\n */\n override setPosition(newPosition: [number, number]) {\n super.setPosition(newPosition); // This simply changes `this.position`\n\n [this.pMain.position.x, this.pMain.position.y] = this.position;\n\n this.mRangeBrush.setOffset(...newPosition);\n }\n\n /**\n * A function to redraw this track. Typically called when an asynchronous event occurs (i.e. tiles loaded)\n * (Refer to https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/TiledPixiTrack.js#L71)\n */\n forceDraw() {\n this.animate();\n }\n\n /**\n * Called when location or zoom level has been changed by click-and-drag interaction\n * (https://github.com/higlass/higlass/blob/54f5aae61d3474f9e868621228270f0c90ef9343/app/scripts/HorizontalLine1DPixiTrack.js#L215)\n * For brushing, refer to https://github.com/higlass/higlass/blob/caf230b5ee41168ea491572618612ac0cc804e5a/app/scripts/HeatmapTiledPixiTrack.js#L1493\n */\n override zoomed(newXScale: ScaleLinear, newYScale: ScaleLinear) {\n if (PRINT_RENDERING_CYCLE) console.warn('zoomed()');\n\n const range = this.mRangeBrush.getRange();\n this.mRangeBrush.updateRange(\n range ? [newXScale(this._xScale.invert(range[0])), newXScale(this._xScale.invert(range[1]))] : null\n );\n\n this.xScale(newXScale);\n this.yScale(newYScale);\n\n this.refreshTiles();\n this.draw();\n this.forceDraw();\n\n // Publish the new genomic axis domain\n const genomicRange = newXScale\n .domain()\n .map(absPos => getRelativeGenomicPosition(absPos, this.#assembly, true)) as [\n GenomicPosition,\n GenomicPosition\n ];\n publish('location', {\n id: context.viewUid,\n genomicRange: genomicRange\n });\n }\n\n /**\n * This is how the mask gets drawn. Overrides method in PixiTrack.\n * Compared to the method in PixiTrack, this method draws a circular mask when the layout is circular.\n * @param position\n * @param dimensions\n */\n override setMask(position: [number, number], dimensions: [number, number]) {\n this.pMask.clear();\n this.pMask.beginFill();\n\n if (this.options.spec.layout === 'circular') {\n /**\n * If the layout is circular, we want the mask to be circular as well.\n * Circular layout have multiple tracks on top of each other so if the mask is not circular, click\n * events will be triggered only on the top track.\n */\n const [x, y] = this.position;\n const [width, height] = this.dimensions;\n const cx = x + width / 2.0;\n const cy = y + height / 2.0;\n const outerRadius = this.options.spec.outerRadius!;\n this.pMask.drawCircle(cx, cy, outerRadius);\n } else {\n // Normal rectangular mask. This is what is done in PixiTrack\n this.pMask.drawRect(position[0], position[1], dimensions[0], dimensions[1]);\n }\n this.pMask.endFill();\n }\n\n /* *\n *\n * Tile and data processing methods\n *\n * */\n\n /**\n * Gets all tiles and generates tabular data and GoslingTrackModels for each tile. Called by this.draw(), so\n * this method must be public.\n * @param force if true then tabular data gets regenerated\n */\n processAllTiles(force = false) {\n this.tileSize = this.tilesetInfo?.tile_size ?? 1024;\n\n const tiles = this.visibleAndFetchedTiles();\n\n // generated tabular data\n tiles.forEach(tile => this.#generateTabularData(tile, force));\n\n // combine tabular data to the first tile if needed\n this.combineAllTilesIfNeeded();\n\n // apply data transforms to the tabular data and generate track models\n const models = tiles.flatMap(tile => this.transformDataAndCreateModels(tile));\n\n shareScaleAcrossTracks(models);\n\n const flatTileData = ([] as Datum[]).concat(...models.map(d => d.data()));\n if (flatTileData.length !== 0) {\n this.options.siblingIds.forEach(id => publish('rawData', { id, data: flatTileData }));\n }\n }\n\n /**\n * This is currently for testing the new way of rendering visual elements. Called by this.draw()\n */\n async updateTileAsync(tabularDataFetcher: TabularDataFetcher, callback: () => void) {\n if (!this.tilesetInfo) return;\n\n const tiles = this.visibleAndFetchedTiles();\n const tabularData = await tabularDataFetcher.getTabularData(Object.values(tiles).map(x => x.remoteId));\n const tilesetInfo = this.tilesetInfo;\n tiles.forEach((tile, i) => {\n if (i === 0) {\n const [refTile] = HGC.utils.trackUtils.calculate1DVisibleTiles(tilesetInfo, this._xScale);\n tile.tileData.zoomLevel = refTile[0];\n tile.tileData.tilePos = [refTile[1], refTile[1]];\n (tile.tileData as TabularTileData).tabularData = tabularData;\n } else {\n (tile.tileData as TabularTileData).tabularData = [];\n }\n });\n\n callback();\n }\n\n /**\n * Overrides method in Tiled1DPixiTrack. It is called in the constructor, `super(context, options)`.\n * So be aware to use defined variables.\n */\n override calculateVisibleTiles() {\n if (!this.tilesetInfo) return;\n if (isTabularDataFetcher(this.dataFetcher)) {\n const tiles = HGC.utils.trackUtils.calculate1DVisibleTiles(this.tilesetInfo, this._xScale);\n const maxTileWith =\n this.tilesetInfo.max_tile_width ?? this.dataFetcher.MAX_TILE_WIDTH ?? Number.MAX_SAFE_INTEGER;\n\n for (const tile of tiles) {\n const { tileWidth } = this.getTilePosAndDimensions(tile[0], [tile[1], tile[1]]);\n this.forceDraw();\n if (tileWidth > maxTileWith) {\n return;\n }\n }\n\n this.setVisibleTiles(tiles);\n } else {\n if (!this.tilesetInfo) {\n // if we don't know anything about this dataset, no point in trying to get tiles\n return;\n }\n\n // calculate the zoom level given the scales and the data bounds\n const zoomLevel = this.calculateZoomLevel();\n\n if ('resolutions' in this.tilesetInfo) {\n const sortedResolutions = this.tilesetInfo.resolutions\n .map((x: number) => +x)\n .sort((a: number, b: number) => b - a);\n\n const xTiles = tileProxy.calculateTilesFromResolution(\n sortedResolutions[zoomLevel],\n this._xScale,\n this.tilesetInfo.min_pos[0],\n this.tilesetInfo.max_pos[0]\n );\n\n let yTiles: number[] | undefined;\n if (Is2DTrack(this.getResolvedTracks()[0])) {\n // it makes sense only when the y-axis is being used for a genomic field\n yTiles = tileProxy.calculateTilesFromResolution(\n sortedResolutions[zoomLevel],\n this._yScale,\n this.tilesetInfo.min_pos[0],\n this.tilesetInfo.max_pos[0]\n );\n }\n\n const tiles = GoslingTrackClass.#tilesToId(xTiles, yTiles, zoomLevel);\n\n this.setVisibleTiles(tiles);\n } else {\n const xTiles = tileProxy.calculateTiles(\n zoomLevel,\n this.relevantScale(),\n this.tilesetInfo.min_pos[0],\n this.tilesetInfo.max_pos[0],\n this.tilesetInfo.max_zoom,\n this.tilesetInfo.max_width\n );\n\n let yTiles: number[] | undefined;\n if (Is2DTrack(this.getResolvedTracks()[0])) {\n // it makes sense only when the y-axis is being used for a genomic field\n yTiles = tileProxy.calculateTiles(\n zoomLevel,\n this._yScale,\n this.tilesetInfo.min_pos[1],\n this.tilesetInfo.max_pos[1],\n this.tilesetInfo.max_zoom,\n // @ts-expect-error what is max_width1?\n this.tilesetInfo.max_width1 ?? this.tilesetInfo.max_width\n );\n }\n\n const tiles = GoslingTrackClass.#tilesToId(xTiles, yTiles, zoomLevel);\n this.setVisibleTiles(tiles);\n }\n }\n }\n /**\n * Convert tile positions to tile IDs\n */\n static #tilesToId(\n xTiles: number[],\n yTiles: number[] | undefined,\n zoomLevel: number\n ): [number, number][] | [number, number, number][] {\n if (!yTiles) {\n // this means only the `x` axis is being used\n return xTiles.map(x => [zoomLevel, x]);\n }\n // this means both `x` and `y` axes are being used together\n const tiles: [number, number, number][] = [];\n xTiles.forEach(x => yTiles.forEach(y => tiles.push([zoomLevel, x, y])));\n return tiles;\n }\n\n /**\n * Get the tile's position in its coordinate system. Overrides method in Tiled1DPixiTrack.\n */\n override getTilePosAndDimensions(zoomLevel: number, tilePos: [number, number]) {\n if (!this.tilesetInfo) {\n throw Error('tilesetInfo not parsed');\n }\n\n if ('resolutions' in this.tilesetInfo) {\n const sortedResolutions = this.tilesetInfo.resolutions\n .map((x: number) => +x)\n .sort((a: number, b: number) => b - a);\n\n // A resolution specifies the number of BP per bin\n const chosenResolution = sortedResolutions[zoomLevel];\n\n const [xTilePos, yTilePos] = tilePos;\n\n const tileWidth = chosenResolution * this.#binsPerTile;\n const tileHeight = tileWidth;\n\n const tileX = tileWidth * xTilePos;\n const tileY = tileHeight * yTilePos;\n\n return {\n tileX,\n tileY,\n tileWidth,\n tileHeight\n };\n } else {\n const [xTilePos, yTilePos] = tilePos;\n\n const minX = this.tilesetInfo.min_pos[0];\n\n const minY = this.tilesetInfo.min_pos[1];\n\n const tileWidth = this.tilesetInfo.max_width / 2 ** zoomLevel;\n const tileHeight = this.tilesetInfo.max_width / 2 ** zoomLevel;\n\n const tileX = minX + xTilePos * tileWidth;\n const tileY = minY + yTilePos * tileHeight;\n\n return {\n tileX,\n tileY,\n tileWidth,\n tileHeight\n };\n }\n }\n get #binsPerTile() {\n let maybeValue: number | undefined;\n if (this.tilesetInfo) {\n maybeValue =\n 'bins_per_dimension' in this.tilesetInfo\n ? this.tilesetInfo.bins_per_dimension\n : this.tilesetInfo.tile_size;\n }\n return maybeValue ?? 256;\n }\n\n /**\n * Gets the indices of the visible data a tile. Overrides method in Tiled1DPixiTrack\n */\n override getIndicesOfVisibleDataInTile(tile: Tile): [number, number] {\n const visible = this._xScale.range();\n\n if (!this.tilesetInfo || !tile.tileData.tilePos || !('dense' in tile.tileData)) {\n return [0, 0];\n }\n\n const { tileX, tileWidth } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos);\n\n const tileXScale = HGC.libraries.d3Scale\n .scaleLinear()\n .domain([0, this.#binsPerTile])\n .range([tileX, tileX + tileWidth]);\n\n const start = Math.max(0, Math.round(tileXScale.invert(this._xScale.invert(visible[0]))));\n const end = Math.min(\n tile.tileData.dense.length,\n Math.round(tileXScale.invert(this._xScale.invert(visible[1])))\n );\n\n return [start, end];\n }\n\n /**\n * Overrides method in TiledPixiTrack\n * @param loadedTiles\n */\n override receivedTiles(loadedTiles: Record) {\n // https://github.com/higlass/higlass/blob/38f0c4415f0595c3b9d685a754d6661dc9612f7c/app/scripts/TiledPixiTrack.js#L637\n super.receivedTiles(loadedTiles);\n // some items in this.fetching are removed\n isTabularDataFetcher(this.dataFetcher) && this.drawLoadingCue();\n }\n\n /**\n * Overrides method in TiledPixiTrack\n */\n override removeOldTiles() {\n super.removeOldTiles(); // some items are added to this.fetching\n isTabularDataFetcher(this.dataFetcher) && this.drawLoadingCue();\n }\n\n /**\n * Combile multiple tiles into the last tile.\n * This is sometimes necessary, for example, when applying a displacement algorithm to all tiles at once.\n * Called by this.processAllTiles() so this method needs to be public.\n */\n combineAllTilesIfNeeded() {\n if (!this.shouldCombineTiles()) return;\n\n const tiles = this.visibleAndFetchedTiles();\n\n if (!tiles || tiles.length <= 1) {\n // Does not make sense to combine tiles\n return;\n }\n\n // Increase the size of tiles by length\n this.tileSize = (this.tilesetInfo?.tile_size ?? 1024) * tiles.length;\n\n let merged: Datum[] = [];\n\n tiles.forEach((tile, i) => {\n const tileInfo = this.#processedTileInfo[tile.tileId];\n if (tileInfo) {\n // Combine data\n merged = [...merged, ...tileInfo.tabularData];\n\n // Since we merge the data to the first one, skip rendering the rest\n tileInfo.skipRendering = i !== 0;\n }\n });\n\n const firstTileInfo = this.#processedTileInfo[tiles[0].tileId];\n firstTileInfo.tabularData = merged;\n\n // Remove duplicated if any. Sparse tiles can have duplications.\n if (firstTileInfo.tabularData[0]?.uid) {\n firstTileInfo.tabularData = uniqBy(firstTileInfo.tabularData, 'uid');\n }\n }\n /**\n * Check whether tiles should be merged. Needs to be public since called by combineAllTilesIfNeeded()\n */\n shouldCombineTiles() {\n const includesDisplaceTransform = hasDataTransform(this.options.spec, 'displace');\n // we do not need to combine dense tiles (from multivec, vector, matrix)\n const hasDenseTiles = () => {\n const tiles = this.visibleAndFetchedTiles();\n return tiles.length >= 1 && 'dense' in tiles[0].tileData;\n };\n // BAM data fetcher already combines the datasets;\n const isBamDataFetcher = this.dataFetcher instanceof BamDataFetcher;\n return includesDisplaceTransform && !hasDenseTiles() && !isBamDataFetcher;\n }\n\n /**\n * Creates an array of SingleTracks if there are overlaid tracks.\n * This method cannot be private because it is called by functions which are called by super.draw();\n */\n getResolvedTracks(forceUpdate = false) {\n if (forceUpdate || !this.resolvedTracks) {\n const tracks = resolveSuperposedTracks(this.options.spec).filter(t => t.mark !== 'brush');\n // We will never need to access the values field in the data spec. It can be quite large which can degrade performance so we remove it.\n tracks.forEach(track => {\n if ('values' in track.data) {\n track.data.values = [];\n }\n });\n this.resolvedTracks = tracks;\n }\n // Brushes are drawn by another plugin track.\n\n return this.resolvedTracks;\n }\n\n /**\n * Construct tabular data from a higlass tileset and a gosling track model.\n */\n #generateTabularData(tile: Tile, force = false) {\n if (this.#processedTileInfo[tile.tileId] && !force) {\n // we do not need to re-construct tabular data\n return;\n }\n\n if (!tile.tileData.tilePos) {\n // we do not have this information ready yet, i.e., cannot calculate `tileX`\n return;\n }\n\n const tileInfo = initProcessedTileInfo();\n const resolvedTracks = this.getResolvedTracks();\n\n if (resolvedTracks.length === 0) {\n // we do not have enough track to display\n return [];\n }\n\n /* Create tabular data */\n // The data spec is identical in all overlaid tracks, so we only need the first one.\n const firstResolvedTrack = resolvedTracks[0];\n\n if ('tabularData' in tile.tileData) {\n // some data fetchers directly generates `tabularData`\n tileInfo.tabularData = tile.tileData.tabularData;\n } else {\n // generate tabular data\n const { tileX, tileY, tileWidth, tileHeight } = this.getTilePosAndDimensions(\n tile.tileData.zoomLevel,\n tile.tileData.tilePos\n );\n\n const sparse = 'length' in tile.tileData ? Array.from(tile.tileData) : [];\n\n const extendedTileData = Object.assign({}, tile.tileData, {\n sparse,\n tileX,\n tileY,\n tileWidth,\n tileHeight,\n tileSize: this.tileSize\n });\n\n const tabularData = getTabularData(firstResolvedTrack, extendedTileData);\n if (tabularData) {\n tileInfo.tabularData = tabularData;\n }\n }\n\n this.#processedTileInfo[tile.tileId] = tileInfo;\n }\n\n /**\n * Apply data transformation to each of the overlaid tracks and generate GoslingTrackModels.\n */\n transformDataAndCreateModels(tile: Tile) {\n const tileInfo = this.#processedTileInfo[tile.tileId];\n\n if (!tileInfo || tileInfo.skipRendering) {\n // this probably means the tile data has been merged to another tile\n // so, no need to create track models\n return [];\n }\n\n // clear the array first\n tileInfo.goslingModels = [];\n\n const resolvedTracks = this.getResolvedTracks();\n resolvedTracks.forEach(resolvedSpec => {\n let tabularDataTransformed = Array.from(tileInfo.tabularData);\n resolvedSpec.dataTransform?.forEach(t => {\n switch (t.type) {\n case 'filter':\n tabularDataTransformed = filterData(t, tabularDataTransformed);\n break;\n case 'concat':\n tabularDataTransformed = concatString(t, tabularDataTransformed);\n break;\n case 'replace':\n tabularDataTransformed = replaceString(t, tabularDataTransformed);\n break;\n case 'log':\n tabularDataTransformed = calculateData(t, tabularDataTransformed);\n break;\n case 'exonSplit':\n tabularDataTransformed = splitExon(t, tabularDataTransformed, resolvedSpec.assembly);\n break;\n case 'genomicLength':\n tabularDataTransformed = calculateGenomicLength(t, tabularDataTransformed);\n break;\n case 'svType':\n tabularDataTransformed = inferSvType(t, tabularDataTransformed);\n break;\n case 'coverage':\n tabularDataTransformed = aggregateCoverage(t, tabularDataTransformed, this._xScale.copy());\n break;\n case 'subjson':\n tabularDataTransformed = parseSubJSON(t, tabularDataTransformed);\n break;\n case 'displace':\n tabularDataTransformed = displace(t, tabularDataTransformed, this._xScale.copy());\n break;\n }\n });\n\n // TODO: Remove the following block entirely and use the `rawData` API in the Editor (June-02-2022)\n // Send data preview to the editor so that it can be shown to users.\n try {\n if (PubSub) {\n const NUM_OF_ROWS_IN_PREVIEW = 100;\n const numOrRows = tabularDataTransformed.length;\n PubSub.publish('data-preview', {\n id: context.viewUid,\n // TODO: Do we need the stringified version? Stringify of large JSON data is very slow.\n dataConfig: JSON.stringify({ data: resolvedSpec.data }),\n data:\n NUM_OF_ROWS_IN_PREVIEW > numOrRows\n ? tabularDataTransformed\n : sampleSize(tabularDataTransformed, NUM_OF_ROWS_IN_PREVIEW)\n // ...\n });\n }\n } catch (e) {\n // ..\n }\n\n // Replace width and height information with the actual values for responsive encoding\n const [trackWidth, trackHeight] = this.dimensions; // actual size of a track\n const axisSize = IsXAxis(resolvedSpec) ? HIGLASS_AXIS_SIZE : 0; // Why the axis size must be added here?\n const [w, h] = [trackWidth, trackHeight + axisSize];\n const circularFactor = Math.min(w, h) / Math.min(resolvedSpec.width!, resolvedSpec.height!);\n if (resolvedSpec.innerRadius) {\n resolvedSpec.innerRadius = resolvedSpec.innerRadius * circularFactor;\n }\n if (resolvedSpec.outerRadius) {\n resolvedSpec.outerRadius = resolvedSpec.outerRadius * circularFactor;\n }\n resolvedSpec.width = w;\n resolvedSpec.height = h;\n\n // Construct separate gosling models for individual tiles\n const model = new GoslingTrackModel(resolvedSpec, tabularDataTransformed, this.options.theme);\n\n // Add a track model to the tile object\n tileInfo.goslingModels.push(model);\n });\n\n return tileInfo.goslingModels;\n }\n\n /* *\n *\n * Mouse methods\n *\n * */\n\n #onMouseDown(mouseX: number, mouseY: number, isAltPressed: boolean) {\n // Record these so that we do not triger click event when dragged.\n this.#mouseDownX = mouseX;\n this.#mouseDownY = mouseY;\n\n // Determine whether to activate a range brush\n const mouseEvents = this.options.spec.experimental?.mouseEvents;\n const rangeSelectEnabled = !!mouseEvents || (IsMouseEventsDeep(mouseEvents) && !!mouseEvents.rangeSelect);\n this.#isRangeBrushActivated = rangeSelectEnabled && isAltPressed;\n\n this.pMouseHover.clear();\n }\n\n #onMouseMove(mouseX: number) {\n if (this.options.spec.layout === 'circular') {\n // TODO: We do not yet support range selection on circular tracks\n return;\n }\n\n if (this.#isRangeBrushActivated) {\n this.mRangeBrush.updateRange([mouseX, this.#mouseDownX]).drawBrush().visible().disable();\n }\n }\n\n #onMouseUp(mouseX: number, mouseY: number) {\n // `trackClick` API\n this.#publishTrackEvents('trackClick', mouseX, mouseY);\n\n const mouseEvents = this.options.spec.experimental?.mouseEvents;\n const clickEnabled = !!mouseEvents || (IsMouseEventsDeep(mouseEvents) && !!mouseEvents.click);\n const isDrag = Math.sqrt((this.#mouseDownX - mouseX) ** 2 + (this.#mouseDownY - mouseY) ** 2) > 1;\n\n if (!this.#isRangeBrushActivated && !isDrag) {\n // Clicking outside the brush should remove the brush and the selection.\n this.mRangeBrush.clear();\n this.pMouseSelection.clear();\n } else {\n // Dragging ended, so enable adjusting the range brush\n this.mRangeBrush.enable();\n }\n\n this.#isRangeBrushActivated = false;\n\n if (!this.tilesetInfo) {\n // Do not have enough information\n return;\n }\n\n // `click` API\n if (!isDrag && clickEnabled) {\n // Identify the current position\n const genomicPosition = getRelativeGenomicPosition(\n Math.floor(this._xScale.invert(mouseX)),\n this.#assembly\n );\n\n // Get elements within mouse\n const capturedElements = this.#getElementsWithinMouse(mouseX, mouseY);\n\n if (capturedElements.length !== 0) {\n this.options.siblingIds.forEach(id =>\n publish('click', {\n id,\n genomicPosition,\n data: capturedElements.map(d => d.value)\n })\n );\n }\n }\n }\n\n #onMouseOut() {\n this.#isRangeBrushActivated = false;\n document.body.style.cursor = 'default';\n this.pMouseHover.clear();\n }\n\n /**\n * From all tiles and overlaid tracks, collect element(s) that are withing a mouse position.\n */\n #getElementsWithinMouse(mouseX: number, mouseY: number) {\n const models = this.visibleAndFetchedGoslingModels();\n\n // TODO: `Omit` this properties in the schema of individual overlaid tracks.\n // These should be defined only once for a group of overlaid traks (09-May-2022)\n // See https://github.com/gosling-lang/gosling.js/issues/677\n const mouseEvents = this.options.spec.experimental?.mouseEvents;\n const multiHovering = IsMouseEventsDeep(mouseEvents) && mouseEvents.enableMouseOverOnMultipleMarks;\n const idField = IsMouseEventsDeep(mouseEvents) && mouseEvents.groupMarksByField;\n\n // Collect all mouse event data from tiles and overlaid tracks\n const mergedCapturedElements: MouseEventData[] = models\n .map(model => model.getMouseEventModel().findAll(mouseX, mouseY, true))\n .flat();\n\n if (!multiHovering) {\n // Select only one on the top of a cursor\n mergedCapturedElements.splice(1, mergedCapturedElements.length - 1);\n }\n\n // Iterate again to select sibling marks (e.g., entire glyphs)\n if (mergedCapturedElements.length !== 0 && idField) {\n const source = Array.from(mergedCapturedElements);\n models.forEach(model => {\n const siblings = model.getMouseEventModel().getSiblings(source, idField);\n mergedCapturedElements.push(...siblings);\n });\n }\n\n return mergedCapturedElements;\n }\n\n /**\n * Call track events (e.g., `trackClick` or `trackMouseOver`) based on a mouse position and the track display area.\n */\n #publishTrackEvents(eventType: 'trackClick' | 'trackMouseOver', mouseX: number, mouseY: number) {\n const [x, y] = this.position;\n const [width, height] = this.dimensions;\n if (this.options.spec.layout === 'circular') {\n const cx = x + width / 2.0;\n const cy = y + height / 2.0;\n const innerRadius = this.options.spec.innerRadius!;\n const outerRadius = this.options.spec.outerRadius!;\n const startAngle = this.options.spec.startAngle!;\n const endAngle = this.options.spec.endAngle!;\n // Call the API function only when the mouse is positioned directly on the track display area\n if (\n isPointInsideDonutSlice(\n [mouseX, mouseY],\n [width / 2.0, height / 2.0],\n [innerRadius, outerRadius],\n [startAngle, endAngle]\n )\n ) {\n publish(eventType, {\n id: context.viewUid,\n spec: this.options.spec,\n shape: { x, y, width, height, cx, cy, innerRadius, outerRadius, startAngle, endAngle }\n });\n }\n } else {\n publish(eventType, {\n id: context.viewUid,\n spec: this.options.spec,\n shape: { x, y, width, height }\n });\n }\n }\n\n #onRangeBrush(range: [number, number] | null, skipApiTrigger = false) {\n this.pMouseSelection.clear();\n\n if (range === null) {\n // brush just removed\n if (!skipApiTrigger) {\n publish('rangeSelect', { id: context.viewUid, genomicRange: null, data: [] });\n }\n return;\n }\n\n const models = this.visibleAndFetchedGoslingModels();\n const [startX, endX] = range;\n\n // Collect all mouse event data from tiles and overlaid tracks\n let capturedElements: MouseEventData[] = models\n .map(model => model.getMouseEventModel().findAllWithinRange(startX, endX, true))\n .flat();\n\n // Deselect marks if their siblings are not selected.\n // e.g., if only one exon is selected in a gene, we do not select it.\n const mouseEvents = this.options.spec.experimental?.mouseEvents;\n const idField = IsMouseEventsDeep(mouseEvents) && mouseEvents.groupMarksByField;\n if (capturedElements.length !== 0 && idField) {\n models.forEach(model => {\n const siblings = model.getMouseEventModel().getSiblings(capturedElements, idField);\n const siblingIds = Array.from(new Set(siblings.map(d => d.value[idField])));\n capturedElements = capturedElements.filter(d => siblingIds.indexOf(d.value[idField]) === -1);\n });\n }\n\n if (capturedElements.length !== 0) {\n // selection effect graphics\n const g = this.pMouseSelection;\n\n if (this.options.spec.style?.select?.arrange !== 'behind') {\n // place on the top\n this.pMain.removeChild(g);\n this.pMain.addChild(g);\n }\n\n this.#highlightMarks(\n g,\n capturedElements,\n Object.assign({}, DEFAULT_MOUSE_EVENT_STYLE, this.options.spec.style?.select)\n );\n }\n\n /* API call */\n if (!skipApiTrigger) {\n const genomicRange: [GenomicPosition, GenomicPosition] = [\n getRelativeGenomicPosition(Math.floor(this._xScale.invert(startX)), this.#assembly),\n getRelativeGenomicPosition(Math.floor(this._xScale.invert(endX)), this.#assembly)\n ];\n\n publish('rangeSelect', {\n id: context.viewUid,\n genomicRange,\n data: capturedElements.map(d => d.value)\n });\n }\n\n this.forceDraw();\n }\n\n /**\n * Highlight marks that are either mouse overed or selected.\n */\n #highlightMarks(\n g: PIXI.Graphics,\n marks: MouseEventData[],\n style: {\n stroke: string;\n strokeWidth: number;\n strokeOpacity: number;\n color: string;\n opacity: number;\n }\n ) {\n g.lineStyle(\n style.strokeWidth,\n colorToHex(style.stroke),\n style.strokeOpacity, // alpha\n 0.5 // alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter)\n );\n g.beginFill(colorToHex(style.color), style.color === 'none' ? 0 : style.opacity);\n\n marks.forEach(d => {\n if (d.type === 'point') {\n const [x, y, r = 3] = d.polygon;\n g.drawCircle(x, y, r);\n } else if (d.type === 'line') {\n g.moveTo(d.polygon[0], d.polygon[1]);\n flatArrayToPairArray(d.polygon).map(d => g.lineTo(d[0], d[1]));\n } else {\n g.drawPolygon(d.polygon);\n }\n });\n }\n\n hideMousePosition?: () => void; // set in HorizontalTiled1DPixiTrack\n\n /**\n * Overrides method in HorizontalLine1DPixiTrack\n */\n override getMouseOverHtml(mouseX: number, mouseY: number) {\n // `trackMouseOver` API\n this.#publishTrackEvents('trackMouseOver', mouseX, mouseY);\n\n if (this.#isRangeBrushActivated) {\n // In the middle of drawing range brush.\n return '';\n }\n\n if (!this.tilesetInfo) {\n // Do not have enough information\n return '';\n }\n\n this.pMouseHover.clear();\n\n // Current position\n const genomicPosition = getRelativeGenomicPosition(Math.floor(this._xScale.invert(mouseX)), this.#assembly);\n\n // Get elements within mouse\n const capturedElements = this.#getElementsWithinMouse(mouseX, mouseY);\n\n // Change cursor\n // https://developer.mozilla.org/en-US/docs/Web/CSS/cursor\n if (capturedElements.length !== 0) {\n document.body.style.cursor = 'pointer';\n } else {\n document.body.style.cursor = 'default';\n }\n\n if (capturedElements.length !== 0) {\n const mouseEvents = this.options.spec.experimental?.mouseEvents;\n const mouseOverEnabled = !!mouseEvents || (IsMouseEventsDeep(mouseEvents) && !!mouseEvents.mouseOver);\n if (mouseOverEnabled) {\n // Display mouse over effects\n const g = this.pMouseHover;\n\n if (this.options.spec.style?.mouseOver?.arrange !== 'behind') {\n // place on the top\n this.pMain.removeChild(g);\n this.pMain.addChild(g);\n }\n\n this.#highlightMarks(\n g,\n capturedElements,\n Object.assign({}, DEFAULT_MOUSE_EVENT_STYLE, this.options.spec.style?.mouseOver)\n );\n\n // API call\n publish('mouseOver', {\n id: context.viewUid,\n genomicPosition,\n data: capturedElements.map(d => d.value)\n });\n }\n\n // Display a tooltip\n const models = this.visibleAndFetchedGoslingModels();\n\n const firstTooltipSpec = models\n .find(m => m.spec().tooltip && m.spec().tooltip?.length !== 0)\n ?.spec().tooltip;\n\n if (firstTooltipSpec) {\n let content = firstTooltipSpec\n .map(d => {\n const rawValue = capturedElements[0].value[d.field];\n let value = rawValue;\n if (d.type === 'quantitative' && d.format) {\n value = HGC.libraries.d3Format.format(d.format)(+rawValue);\n } else if (d.type === 'genomic') {\n // e.g., chr1:204,133\n const { chromosome, position } = getRelativeGenomicPosition(+rawValue, this.#assembly);\n value = `${chromosome}:${HGC.libraries.d3Format.format(',')(position)}`;\n }\n\n return (\n '' +\n `${d.alt ?? d.field}` +\n `${value}` +\n ''\n );\n })\n .join('');\n\n content = `${content}
`;\n if (capturedElements.length > 1) {\n content +=\n `
` +\n `${capturedElements.length - 1} Additional Selections...` +\n '
';\n }\n return `
${content}
`;\n }\n }\n return '';\n }\n\n /**\n * Javscript subscription API methods (besides for mouse)\n */\n\n /**\n * Publishes track information. Triggered when track gets created\n */\n #publishOnNewTrack() {\n publish('onNewTrack', {\n id: context.viewUid\n });\n }\n\n /* *\n *\n * Other misc methods and overrides\n *\n * */\n\n /**\n * Returns the minimum in the visible area (not visible tiles).\n * Overrides method in Tiled1DPixiTrack\n */\n override minVisibleValue() {\n return 0;\n }\n\n /**\n * Returns the maximum in the visible area (not visible tiles).\n * Overrides method in Tiled1DPixiTrack.\n */\n override maxVisibleValue() {\n return 0;\n }\n /**\n * Overrides method in PixiTrack. SVG export is not supported.\n */\n override exportSVG(): never {\n throw new Error('exportSVG() not supported for gosling-track');\n }\n\n /**\n * Show visual cue during waiting for visualizations being rendered. Also called by data fetchers\n */\n drawLoadingCue() {\n if (this.fetching.size) {\n const margin = 6;\n\n const text = `Fetching... ${Array.from(this.fetching).join(' ')}`;\n this.#loadingText.text = text;\n this.#loadingText.x = this.position[0] + this.dimensions[0] - margin / 2.0;\n this.#loadingText.y = this.position[1] + this.dimensions[1] - margin / 2.0;\n\n // Show background\n const metric = HGC.libraries.PIXI.TextMetrics.measureText(text, this.#loadingTextStyleObj);\n const { width: w, height: h } = metric;\n\n this.#loadingTextBg.clear();\n this.#loadingTextBg.lineStyle(1, colorToHex('grey'), 1, 0.5);\n this.#loadingTextBg.beginFill(colorToHex('white'), 0.8);\n this.#loadingTextBg.drawRect(\n this.position[0] + this.dimensions[0] - w - margin - 1,\n this.position[1] + this.dimensions[1] - h - margin - 1,\n w + margin,\n h + margin\n );\n\n this.#loadingText.visible = true;\n this.#loadingTextBg.visible = true;\n } else {\n this.#loadingText.visible = false;\n this.#loadingTextBg.visible = false;\n }\n }\n\n /**\n * Called in legend.ts\n */\n updateScaleOffsetFromOriginalSpec(\n _renderingId: string,\n scaleOffset: [number, number],\n channelKey: 'color' | 'stroke'\n ) {\n this.getResolvedTracks().map(spec => {\n if (spec._renderingId === _renderingId) {\n const channel = spec[channelKey];\n if (IsChannelDeep(channel)) {\n channel.scaleOffset = scaleOffset;\n }\n }\n });\n }\n\n /**\n * Called in legend.ts\n */\n shareScaleOffsetAcrossTracksAndTiles(scaleOffset: [number, number], channelKey: 'color' | 'stroke') {\n const models = this.visibleAndFetchedGoslingModels();\n models.forEach(d => {\n const channel = d.spec()[channelKey];\n if (IsChannelDeep(channel)) {\n channel.scaleOffset = scaleOffset;\n }\n const channelOriginal = d.originalSpec()[channelKey];\n if (IsChannelDeep(channelOriginal)) {\n channelOriginal.scaleOffset = scaleOffset;\n }\n });\n }\n\n /**\n * Used in drawTile()\n * Checks if the track has marks which are stretchable. Stretching\n * is not supported for circular layouts or 2D tracks\n */\n #hasStretchableGraphics() {\n const hasStretchOption = this.options.spec.experimental?.stretchGraphics;\n if (hasStretchOption === true) {\n return true;\n } else if (hasStretchOption === false) {\n return false;\n }\n // The default behavior is that we stretch when stretching looks acceptable\n const isFirstTrack1D = !Is2DTrack(this.getResolvedTracks()[0]);\n const isNotCircularLayout = this.options.spec.layout !== 'circular';\n const stretchableMarks = ['bar', 'line', 'rect', 'area'];\n const hasStretchableMark = this.getResolvedTracks().reduce(\n (acc, spec) => acc && stretchableMarks.includes(spec.mark),\n true\n );\n const noMouseInteractions = !this.options.spec.experimental?.mouseEvents;\n\n return isFirstTrack1D && isNotCircularLayout && hasStretchableMark && noMouseInteractions;\n }\n\n /**\n * Used in drawTile()\n * Checks if the tile Graphic is too stretched. If so, it returns true.\n * @param stretchFactor The factor by which the tile is stretched\n * @returns True if the tile is too stretched, false otherwise\n */\n #isTooStretched(stretchFactor: number) {\n const defaultThreshold = 1.5;\n const threshold = this.options.spec.experimental?.stretchGraphicsThreshold ?? defaultThreshold;\n return stretchFactor > threshold || stretchFactor < 1 / threshold;\n }\n }\n return new GoslingTrackClass();\n};\n\nexport default createPluginTrack(config, factory);\n","import { createPluginTrack, type PluginTrackFactory, type TrackConfig } from '../../core/utils/define-plugin-track';\nimport { publish } from '../../api/pubsub';\nimport { type DummyTrackStyle } from '@gosling-lang/gosling-schema';\n\ninterface DummyTrackOptions extends DummyTrackStyle {\n title: string;\n height: number;\n width: number;\n}\n\nconst config: TrackConfig = {\n type: 'dummy-track',\n defaultOptions: {\n height: 0, // default height gets set in when spec is preprocessed\n width: 0, // default width gets set in when spec is preprocessed\n title: '',\n background: '#fff',\n textFontSize: 12,\n textFontWeight: 'normal',\n textStroke: '#000',\n textStrokeWidth: 0.1,\n outline: '#fff'\n }\n};\n\nconst factory: PluginTrackFactory = (HGC, context, options) => {\n // Services\n const { SVGTrack } = HGC.tracks;\n\n class DummyTrackClass extends SVGTrack {\n constructor() {\n super(context, options);\n this.#drawBackground();\n this.#drawText();\n publish('onNewTrack', {\n id: context.viewUid\n });\n }\n\n #drawBackground() {\n this.gMain\n .append('rect')\n .attr('fill', options.background)\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', options.width)\n .attr('height', options.height)\n .style('stroke', options.outline);\n }\n /**\n * Draws the title of the dummy track\n */\n #drawText() {\n this.gMain\n .append('text')\n .attr('x', options.width / 2)\n .attr('y', (options.height + options.textFontSize!) / 2)\n .style('text-anchor', 'middle')\n .style('font-size', `${options.textFontSize}px`)\n .style('font-weight', options.textFontWeight)\n .style('stroke', options.textStroke)\n .style('stroke-width', options.textStrokeWidth)\n .text(options.title);\n }\n }\n\n return new DummyTrackClass();\n};\n\nexport default createPluginTrack(config, factory);\n","// @ts-ignore\nimport higlassRegister from 'higlass-register';\n// @ts-ignore\nimport { TextTrack } from 'higlass-text';\nimport { AxisTrack } from '@gosling-lang/gosling-genomic-axis';\nimport { BrushTrack } from '@gosling-lang/gosling-brush';\nimport { GoslingTrack } from '@gosling-lang/gosling-track';\nimport { DummyTrack } from '@gosling-lang/dummy-track';\nimport * as dataFetchers from '@data-fetchers';\n\nlet once = false;\n\n/**\n * Register plugin tracks and data fetchers to HiGlass. This is necessary for the first time before using Gosling.js.\n */\nexport function init() {\n if (once) return;\n\n /**\n * Register a linear Gosling.js track to HiGlassComponent\n */\n higlassRegister({\n name: 'GoslingTrack',\n track: GoslingTrack,\n config: GoslingTrack.config\n });\n\n /**\n * Register a 2D Gosling.js track to HiGlassComponent\n */\n higlassRegister({\n name: 'Gosling2DTrack',\n track: GoslingTrack,\n config: {\n ...GoslingTrack.config,\n type: 'gosling-2d-track',\n orientation: '2d'\n }\n });\n\n /**\n * Register an axis plugin track to HiGlassComponent\n */\n higlassRegister({\n name: 'AxisTrack',\n track: AxisTrack,\n config: AxisTrack.config\n });\n\n /**\n * Register a higlass-text plugin track to HiGlassComponent\n */\n higlassRegister({\n name: 'TextTrack',\n track: TextTrack,\n config: TextTrack.config\n });\n\n /**\n * Register a brush plugin track to HiGlassComponent\n */\n higlassRegister({\n name: 'BrushTrack',\n track: BrushTrack,\n config: BrushTrack.config\n });\n\n /**\n * Register a dummy plugin track to HiGlassComponent\n */\n higlassRegister({\n name: 'DummyTrack',\n track: DummyTrack,\n config: DummyTrack.config\n });\n\n /**\n * Register data fetchers to HiGlassComponent\n */\n for (const dataFetcher of Object.values(dataFetchers)) {\n const { config } = dataFetcher;\n higlassRegister({ dataFetcher, config }, { pluginType: 'dataFetcher' });\n }\n\n once = true;\n}\n","import type { MultipleViews, CommonViewDef, GoslingSpec, Track, SingleView } from '@gosling-lang/gosling-schema';\nimport { Is2DTrack, IsDummyTrack, IsOverlaidTrack, IsXAxis, IsYAxis } from '@gosling-lang/gosling-schema';\nimport { HIGLASS_AXIS_SIZE } from './higlass-model';\nimport {\n DEFAULT_CIRCULAR_VIEW_PADDING,\n DEFAULT_INNER_RADIUS_PROP,\n DEFAULT_VIEW_SPACING,\n DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM\n} from './defaults';\nimport { resolveSuperposedTracks } from '../core/utils/overlay';\nimport { traverseTracksAndViews, traverseViewArrangements } from './spec-preprocess';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\n\nexport interface Size {\n width: number;\n height: number;\n}\n\n/**\n * Position information of each track.\n */\nexport interface BoundingBox extends Size {\n x: number;\n y: number;\n}\n\n/**\n * Relative positioning of views, used in HiGlass view configs as `layout`.\n */\nexport interface RelativePosition {\n w: number;\n h: number;\n x: number;\n y: number;\n}\n\n/**\n * Track information for its arrangement.\n */\nexport interface TrackInfo {\n track: Track;\n boundingBox: BoundingBox;\n layout: RelativePosition;\n}\n\n/**\n * Return the size of entire visualization.\n * @param trackInfos\n */\nexport function getBoundingBox(trackInfos: TrackInfo[]) {\n let width = 0;\n let height = 0;\n\n trackInfos.forEach(_ => {\n const w = _.boundingBox.x + _.boundingBox.width;\n const h = _.boundingBox.y + _.boundingBox.height;\n if (height < h) {\n height = h;\n }\n if (width < w) {\n width = w;\n }\n });\n\n return { width, height };\n}\n\n/**\n * Collect information of individual tracks including their size/position and specs\n * @param spec\n */\nexport function getRelativeTrackInfo(\n spec: GoslingSpec,\n theme: CompleteThemeDeep\n): {\n trackInfos: TrackInfo[];\n size: { width: number; height: number };\n} {\n let trackInfos: TrackInfo[] = [] as TrackInfo[];\n\n // Collect track information including spec, bounding boxes, and RGL' `layout`.\n traverseAndCollectTrackInfo(spec, trackInfos); // RGL parameter (`layout`) is not deteremined yet since we do not know the entire size of vis yet.\n // Get the size of entire visualization.\n const size = getBoundingBox(trackInfos);\n\n // Titles\n if (spec.title || spec.subtitle) {\n // If title and/or subtitle presents, offset the y position by title/subtitle size\n const titleHeight =\n (spec.title ? (theme.root.titleFontSize ?? 18) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM : 0) +\n (spec.subtitle ? (theme.root.subtitleFontSize ?? 14) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM : 0);\n const marginBottom = 4;\n\n size.height += titleHeight + marginBottom;\n\n // !! The total height should be multiples of 8. Refer to `getBoundingBox()`\n size.height = size.height + (8 - (size.height % 8));\n\n // Offset all non-title tracks.\n trackInfos.forEach(_ => {\n _.boundingBox.y += titleHeight + marginBottom;\n });\n\n // Add a title track.\n trackInfos = [\n {\n track: getTextTrack({ width: size.width, height: titleHeight }, spec.title, spec.subtitle),\n boundingBox: { x: 0, y: 0, width: size.width, height: titleHeight },\n layout: { x: 0, y: 0, w: 12, h: (titleHeight / size.height) * 12.0 }\n },\n ...trackInfos\n ];\n } else {\n // !! The total height should be multiples of 8. Refer to `getBoundingBox()`\n size.height = size.height + (8 - (size.height % 8));\n }\n\n const pixelPreciseMarginPadding = !(typeof spec.responsiveSize !== 'object'\n ? spec.responsiveSize\n : spec.responsiveSize.height);\n\n // Calculate `layout`s for React Grid Layout (RGL).\n trackInfos.forEach(_ => {\n _.layout.x = (_.boundingBox.x / size.width) * 12;\n _.layout.w = (_.boundingBox.width / size.width) * 12;\n // If we set `pixelPreciseMarginPadding` `true`, we need to use actual values for `y` and `height`\n _.layout.y = pixelPreciseMarginPadding ? _.boundingBox.y : (_.boundingBox.y / size.height) * 12;\n _.layout.h = pixelPreciseMarginPadding ? _.boundingBox.height : (_.boundingBox.height / size.height) * 12;\n });\n\n return { trackInfos, size };\n}\n\n/**\n * Visit all tracks and views in the Gosling spec to collect information of individual tracks, including their size, position, and spec.\n * @param spec\n * @param output\n * @param dx\n * @param dy\n * @param forceWidth\n * @param forceHeight\n * @param circularRootNotFound\n */\nfunction traverseAndCollectTrackInfo(\n spec: GoslingSpec | SingleView,\n output: TrackInfo[],\n dx = 0,\n dy = 0,\n circularRootNotFound = true // A flag variable to find a root level of circular tracks/views\n) {\n let cumWidth = 0;\n let cumHeight = 0;\n\n /* Parameters to determine if we need to combine all the children to show as a single circular visualization */\n let allChildCircularLayout = true;\n let traversedAtLeastOnce = false;\n traverseTracksAndViews(spec, (tv: CommonViewDef) => {\n traversedAtLeastOnce = true;\n if (tv.layout !== 'circular') {\n allChildCircularLayout = false;\n }\n });\n\n let noChildConcatArrangement = true; // if v/hconcat is being used by children, circular visualizations should be adjacently placed.\n traverseViewArrangements(spec, (a: MultipleViews) => {\n if (a.arrangement === 'vertical' || a.arrangement === 'horizontal') {\n noChildConcatArrangement = false;\n }\n });\n\n const isThisCircularRoot =\n circularRootNotFound &&\n allChildCircularLayout &&\n traversedAtLeastOnce &&\n noChildConcatArrangement &&\n (('views' in spec && (spec.arrangement === 'parallel' || spec.arrangement === 'serial')) || 'tracks' in spec);\n\n const numTracksBeforeInsert = output.length;\n\n if ('tracks' in spec) {\n // following `traverseToFixSpecDownstream`, the width and height of each track are gaurenteed to be defined\n const tracks = spec.tracks as (Track & { width: number; height: number })[];\n\n if (spec.orientation === 'vertical') {\n // This is a vertical view, so use the largest `height` of the tracks for this view.\n cumHeight = Math.max(...tracks.map(d => d.height));\n tracks.forEach((track, i, array) => {\n if (getNumOfXAxes([track]) === 1) {\n track.width += HIGLASS_AXIS_SIZE;\n }\n\n track.height = cumHeight;\n\n output.push({\n track,\n boundingBox: {\n x: dx + cumWidth,\n y: dy,\n width: track.width,\n height: cumHeight\n },\n layout: { x: 0, y: 0, w: 0, h: 0 } // Just put a dummy info here, this should be added after entire bounding box has been determined\n });\n\n if (array[i + 1] && array[i + 1].overlayOnPreviousTrack) {\n // do not add a height\n } else {\n cumWidth += track.width;\n if (i !== array.length - 1) {\n cumWidth += spec.spacing !== undefined ? spec.spacing : 0;\n }\n }\n });\n } else {\n // This is a horizontal view, so use the largest `width` for this view.\n cumWidth = Math.max(...tracks.map(d => d.width)); //forceWidth ? forceWidth : spec.tracks[0]?.width;\n tracks.forEach((track, i, array) => {\n // let scaledHeight = track.height;\n\n if (getNumOfXAxes([track]) === 1) {\n track.height += HIGLASS_AXIS_SIZE;\n }\n const singleTrack = resolveSuperposedTracks(track);\n if (singleTrack.length > 0 && Is2DTrack(singleTrack[0]) && getNumOfYAxes([track]) === 1) {\n // If this is a 2D track (e.g., matrix), we need to reserve a space for the y-axis track\n cumWidth += HIGLASS_AXIS_SIZE;\n }\n\n track.width = cumWidth;\n\n output.push({\n track,\n boundingBox: {\n x: dx,\n y: dy + cumHeight,\n width: cumWidth,\n height: track.height\n },\n layout: { x: 0, y: 0, w: 0, h: 0 } // Just put a dummy info here, this should be added after entire bounding box has been determined\n });\n\n if (array[i + 1] && array[i + 1].overlayOnPreviousTrack) {\n // do not add a height\n } else {\n cumHeight += track.height;\n if (i !== array.length - 1) {\n cumHeight += spec.spacing !== undefined ? spec.spacing : 0;\n }\n }\n });\n }\n } else {\n // We did not reach a track definition, so continue traversing.\n\n // We first calculate position and size of each view and track by considering it as if it uses a linear layout\n if (spec.arrangement === 'parallel' || spec.arrangement === 'vertical') {\n const spacing = spec.spacing !== undefined ? spec.spacing : DEFAULT_VIEW_SPACING;\n\n spec.views.forEach((v, i, array) => {\n const viewBB = traverseAndCollectTrackInfo(\n v,\n output,\n dx + (v.xOffset ?? 0),\n dy + (v.yOffset ?? 0) + cumHeight,\n !isThisCircularRoot && circularRootNotFound\n );\n\n if (cumWidth < (v.xOffset ?? 0) + viewBB.width) {\n cumWidth = (v.xOffset ?? 0) + viewBB.width;\n }\n if (i !== array.length - 1) {\n cumHeight += spacing;\n }\n cumHeight += (v.yOffset ?? 0) + viewBB.height;\n });\n } else if (spec.arrangement === 'serial' || spec.arrangement === 'horizontal') {\n spec.views.forEach((v, i, array) => {\n const spacing = spec.spacing !== undefined ? spec.spacing : DEFAULT_VIEW_SPACING;\n\n // If so, we do not want to put large between-gap.\n // spacing *= (spec.arrangement === 'serial' && spec.layout === 'circular' ? 0.2 : 1);\n\n const viewBB = traverseAndCollectTrackInfo(\n v,\n output,\n dx + (v.xOffset ?? 0) + cumWidth,\n dy + (v.yOffset ?? 0),\n !isThisCircularRoot && circularRootNotFound\n );\n\n if (cumHeight < (v.xOffset ?? 0) + viewBB.height) {\n cumHeight = (v.xOffset ?? 0) + viewBB.height;\n }\n if (i !== array.length - 1) {\n cumWidth += spacing;\n }\n cumWidth += (v.xOffset ?? 0) + viewBB.width;\n });\n }\n }\n\n // If this is a root view that uses a circular layout, use the posiiton and size of views/tracks to calculate circular-specific parameters, such as outer/inner radius and start/end angle\n if (isThisCircularRoot) {\n const cTracks = output.slice(numTracksBeforeInsert);\n const ifMultipleViews =\n 'views' in spec &&\n (spec.arrangement === 'parallel' || spec.arrangement === 'serial') &&\n spec.views.length > 1;\n\n const SPACING = spec.spacing !== undefined ? spec.spacing : DEFAULT_VIEW_SPACING;\n const PADDING = DEFAULT_CIRCULAR_VIEW_PADDING;\n const INNER_RADIUS = spec.centerRadius !== undefined ? spec.centerRadius : DEFAULT_INNER_RADIUS_PROP;\n const TOTAL_RADIUS = cumWidth / 2.0 + PADDING; // (cumWidth + cumHeight) / 2.0 / 2.0;\n const TOTAL_RING_SIZE = TOTAL_RADIUS * (1 - INNER_RADIUS);\n\n // const numXAxes = getNumOfXAxes(cTracks.map(info => info.track));\n\n cTracks.forEach((t, i) => {\n // at this time, circular dummy tracks are not supported, so we don't do anything here\n if (IsDummyTrack(t.track)) {\n return;\n }\n t.track.layout = 'circular';\n\n t.track.outerRadius = TOTAL_RADIUS - PADDING - ((t.boundingBox.y - dy) / cumHeight) * TOTAL_RING_SIZE;\n t.track.innerRadius =\n TOTAL_RADIUS - PADDING - ((t.boundingBox.y + t.boundingBox.height - dy) / cumHeight) * TOTAL_RING_SIZE;\n\n // in circular layouts, we place spacing in the origin as well\n const spacingAngle = (SPACING / cumWidth) * 360;\n\n // !!! Multiplying by (cumWidth - SPACING) / cumWidth) to rescale to exclude SPACING\n t.track.startAngle =\n spacingAngle + ((((t.boundingBox.x - dx) / cumWidth) * (cumWidth - SPACING)) / cumWidth) * 360;\n t.track.endAngle =\n ((((t.boundingBox.x + t.boundingBox.width - dx) / cumWidth) * (cumWidth - SPACING)) / cumWidth) * 360;\n // t.track.startAngle = ((t.boundingBox.x - dx) / cumWidth) * 360;\n // t.track.endAngle = ((t.boundingBox.x + t.boundingBox.width - dx) / cumWidth) * 360;\n\n t.boundingBox.x = dx + (t.track.xOffset ?? 0);\n t.boundingBox.y = dy + (t.track.yOffset ?? 0);\n\n // Circular tracks share the same size and position since technically these tracks are being overlaid on top of the others\n t.boundingBox.height = t.track.height = t.boundingBox.width = t.track.width = TOTAL_RADIUS * 2;\n\n if (i !== 0) {\n t.track.overlayOnPreviousTrack = true;\n }\n\n // !!! As circular tracks are not well supported now when parallelized or serialized, we do not support brush for now.\n if (ifMultipleViews) {\n if (IsOverlaidTrack(t.track)) {\n t.track._overlay = t.track._overlay.filter(o => o.mark !== 'brush');\n }\n }\n });\n\n cumHeight = TOTAL_RADIUS * 2;\n }\n\n // DEBUG\n // console.log(output);\n\n // Record assigned sizes of this view so that we can determine whether to use alternative responsive spec\n spec._assignedWidth = cumWidth;\n spec._assignedHeight = cumHeight;\n\n return { x: dx, y: dy, width: cumWidth, height: cumHeight };\n}\n\nexport function getNumOfXAxes(tracks: Track[]): number {\n return tracks.filter(t => IsXAxis(t)).length;\n}\n\nexport function getNumOfYAxes(tracks: Track[]): number {\n return tracks.filter(t => IsYAxis(t)).length;\n}\n\n/**\n * Get a spec for a title track.\n * @param size\n * @param title\n * @param subtitle\n */\nconst getTextTrack = (size: Size, title?: string, subtitle?: string) => {\n return JSON.parse(\n JSON.stringify({\n mark: 'header',\n width: size.width,\n height: size.height,\n title,\n subtitle\n })\n ) as Track;\n};\n","export function validTilesetUrl(url: string) {\n if (!url.includes('tileset_info/?d=') || (!url.includes('https:') && !url.includes('http:'))) {\n return false;\n }\n return true;\n}\n\nexport function parseServerAndTilesetUidFromUrl(url: string) {\n if (!url.includes('tileset_info/?d=') || (!url.includes('https:') && !url.includes('http:'))) {\n // TODO: Add regular expression to validate the format.\n // console.warn(`Data url format is incorrect:${url}`);\n return { server: undefined, tilesetUid: undefined };\n }\n\n const server = url.split('tileset_info/?d=')[0];\n const tilesetUid = url.split('tileset_info/?d=')[1];\n return { server, tilesetUid };\n}\n","import type { Track as HiGlassTrack } from '@gosling-lang/higlass-schema';\nimport { HiGlassModel, HIGLASS_AXIS_SIZE } from './higlass-model';\nimport { parseServerAndTilesetUidFromUrl } from '../core/utils';\nimport type { Track, Domain } from '@gosling-lang/gosling-schema';\nimport type { BoundingBox, RelativePosition } from './bounding-box';\nimport { resolveSuperposedTracks } from '../core/utils/overlay';\nimport { getGenomicChannelKeyFromTrack, getGenomicChannelFromTrack } from '../gosling-schema/validate';\nimport {\n IsDataDeep,\n IsChannelDeep,\n IsDataDeepTileset,\n Is2DTrack,\n IsXAxis,\n IsHiGlassMatrix,\n getHiGlassColorRange,\n IsDummyTrack\n} from '@gosling-lang/gosling-schema';\nimport { DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM } from './defaults';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\nimport { DEFAULT_TEXT_STYLE } from '../core/utils/text-style';\nimport type { GoslingToHiGlassIdMapper } from '../api/track-and-view-ids';\nimport type { UrlToFetchOptions } from '../core/gosling-component';\nimport { uuid } from '../core/utils/uuid';\n\n/**\n * Convert a gosling track into a HiGlass view and add it into a higlass model.\n */\nexport function goslingToHiGlass(\n hgModel: HiGlassModel,\n gosTrack: Track,\n bb: BoundingBox,\n layout: RelativePosition,\n theme: Required,\n idMapper: GoslingToHiGlassIdMapper,\n urlToFetchOptions?: UrlToFetchOptions\n): HiGlassModel {\n // TODO: check whether there are multiple track.data across superposed tracks\n // ...\n\n // Adds the dummy track to the HiGlass spec\n if (IsDummyTrack(gosTrack)) {\n hgModel.addDefaultView(gosTrack.id!).setDummyTrack(gosTrack).setLayout(layout);\n return hgModel;\n }\n // we only look into the first resolved spec to get information, such as size of the track\n const resolvedSpecs = resolveSuperposedTracks(gosTrack);\n const firstResolvedSpec = resolvedSpecs[0];\n\n // If missing, create a unique track ID that will be used as HiGlass view ID for caching\n const trackId = firstResolvedSpec.id ?? uuid();\n if (!firstResolvedSpec.id) {\n firstResolvedSpec.id = trackId;\n }\n\n // Store the mapping between Gosling track ID and HiGlass view ID so that any lost track IDs\n // can be recovered and used for JS APIs.\n resolvedSpecs.forEach(spec => {\n // if `id` is not defined, no need to store it in the table\n if (spec.id) {\n idMapper.addMapping(spec.id, trackId);\n }\n });\n\n const assembly = firstResolvedSpec.assembly;\n\n if (IsDataDeep(firstResolvedSpec.data)) {\n let server, tilesetUid;\n\n if (IsDataDeepTileset(firstResolvedSpec.data)) {\n const parsed = parseServerAndTilesetUidFromUrl(firstResolvedSpec.data.url);\n server = parsed.server;\n tilesetUid = parsed.tilesetUid;\n }\n\n const genomicChannel = getGenomicChannelFromTrack(firstResolvedSpec);\n const genomicChannelKey = getGenomicChannelKeyFromTrack(firstResolvedSpec);\n const isXGenomic = genomicChannelKey === 'x' || genomicChannelKey === 'xe';\n const xDomain = isXGenomic && IsChannelDeep(genomicChannel) ? (genomicChannel.domain as Domain) : undefined;\n const yDomain =\n Is2DTrack(firstResolvedSpec) && IsChannelDeep(firstResolvedSpec.y)\n ? (firstResolvedSpec.y.domain as Domain)\n : undefined;\n const width =\n bb.width -\n (firstResolvedSpec.layout !== 'circular' &&\n firstResolvedSpec.orientation === 'vertical' &&\n IsXAxis(firstResolvedSpec)\n ? HIGLASS_AXIS_SIZE\n : 0);\n const height =\n bb.height -\n (firstResolvedSpec.layout !== 'circular' &&\n firstResolvedSpec.orientation === 'horizontal' &&\n IsXAxis(firstResolvedSpec)\n ? HIGLASS_AXIS_SIZE\n : 0);\n const hgTrack: HiGlassTrack = {\n uid: `${trackId}-track`, // This is being used to cache the visualization\n type: Is2DTrack(firstResolvedSpec) ? 'gosling-2d-track' : 'gosling-track',\n server,\n tilesetUid,\n width,\n height,\n options: {\n id: trackId,\n siblingIds: idMapper.getSiblingGoslingIds(trackId),\n /* Mouse hover position */\n showMousePosition: firstResolvedSpec.layout === 'circular' ? false : theme.root.showMousePosition, // show mouse position only for linear tracks // TODO: or vertical\n mousePositionColor: theme.root.mousePositionColor,\n /* Track title */\n name: firstResolvedSpec.layout === 'linear' ? firstResolvedSpec.title : ' ',\n labelPosition: firstResolvedSpec.title\n ? theme.track.titleAlign === 'left'\n ? 'topLeft'\n : 'topRight'\n : 'none',\n labelShowResolution: false,\n labelColor: theme.track.titleColor,\n labelBackgroundColor: theme.track.titleBackground,\n labelBackgroundOpacity: 0.5, // TODO: Support `theme.track.titleBackgroundOpacity`\n labelTextOpacity: 1,\n labelLeftMargin: 1,\n labelTopMargin: 1,\n labelRightMargin: 0,\n labelBottomMargin: 0,\n // TODO: Use this eventually\n // trackBorderWidth: firstResolvedSpec.style?.outlineWidth ?? 3,\n // trackBorderColor: firstResolvedSpec.style?.outline ?? '#DBDBDB',\n /* Others */\n backgroundColor: 'transparent', // in this way, we can superpose multiple tracks\n spec: { ...gosTrack },\n theme\n }\n };\n\n if (\n firstResolvedSpec.data &&\n IsDataDeep(firstResolvedSpec.data) &&\n (firstResolvedSpec.data.type === 'csv' ||\n firstResolvedSpec.data.type === 'json' ||\n firstResolvedSpec.data.type === 'bigwig' ||\n firstResolvedSpec.data.type === 'bam' ||\n firstResolvedSpec.data.type === 'vcf' ||\n firstResolvedSpec.data.type === 'gff' ||\n firstResolvedSpec.data.type === 'bed' ||\n // TODO: This is a hack to enable custom data fetchers\n (firstResolvedSpec.data as any).useCustomDataFetcher)\n ) {\n const getFieldName = (c: 'x' | 'xe' | 'x1' | 'x1e') => {\n const cDef = firstResolvedSpec[c];\n return cDef && IsChannelDeep(cDef) ? cDef.field : undefined;\n };\n const xFields = {\n x: getFieldName('x'),\n xe: getFieldName('xe'),\n x1: getFieldName('x1'),\n x1e: getFieldName('x1e')\n } as const;\n\n // Check whether there are any URL specific fetch options\n const urlFetchOptions =\n ('url' in firstResolvedSpec.data && urlToFetchOptions?.[firstResolvedSpec.data.url]) || {};\n const indexUrlFetchOptions =\n ('indexUrl' in firstResolvedSpec.data && urlToFetchOptions?.[firstResolvedSpec.data.indexUrl]) || {};\n\n // This object will be passed to the data fetchers\n hgTrack.data = {\n ...firstResolvedSpec.data,\n ...xFields,\n urlFetchOptions,\n indexUrlFetchOptions,\n // Additionally, add assembly, otherwise, a default genome build is used\n assembly\n // TODO: should look all sub tracks' `dataTransform` and apply OR operation.\n // Add a data transformation spec so that the fetcher can properly sample datasets\n // filter: (firstResolvedSpec as any).dataTransform?.filter((f: DataTransform) => f.type === 'filter')\n };\n }\n\n // We use higlass 'heatmap' track instead of 'gosling-track' for rendering performance.\n // HiGlass is really well-optimized for matrix visualization, and rendering it in Gosling\n // instead makes the zooming interaction slow.\n // See https://github.com/gosling-lang/gosling.js/pull/612#discussion_r771623844\n if (IsHiGlassMatrix(firstResolvedSpec)) {\n // By changing the track type, HiGlass uses its native heatmap track\n hgTrack.type = 'heatmap';\n const colorStr =\n IsChannelDeep(firstResolvedSpec.color) && typeof firstResolvedSpec.color.range === 'string'\n ? firstResolvedSpec.color.range\n : 'viridis';\n hgTrack.options.colorRange = getHiGlassColorRange(colorStr);\n hgTrack.options.trackBorderWidth = firstResolvedSpec.style?.outlineWidth ?? theme.track.outlineWidth;\n hgTrack.options.trackBorderColor = firstResolvedSpec.style?.outline ?? theme.track.outline;\n hgTrack.options.extent = firstResolvedSpec.style?.matrixExtent ?? 'full';\n hgTrack.options.colorbarPosition = (firstResolvedSpec.color as any)?.legend\n ? hgTrack.options.extent === 'lower-left'\n ? 'bottomLeft'\n : 'topRight'\n : 'hidden';\n }\n\n if (firstResolvedSpec.overlayOnPreviousTrack) {\n hgModel\n .setViewOrientation(firstResolvedSpec.orientation) // TODO: Orientation should be assigned to 'individual' views\n .addTrackToCombined(hgTrack);\n } else {\n hgModel\n .setViewOrientation(firstResolvedSpec.orientation) // TODO: Orientation should be assigned to 'individual' views\n .setAssembly(assembly) // TODO: Assembly should be assigned to 'individual' views\n .addDefaultView(trackId, assembly)\n .setDomain(xDomain, yDomain ?? xDomain)\n .adjustDomain(firstResolvedSpec.orientation, width, height)\n .setMainTrack(hgTrack)\n .addTrackSourceServers(server)\n .setZoomFixed(firstResolvedSpec.static === true)\n .setZoomLimits(firstResolvedSpec.zoomLimits ?? [1, null])\n .setLayout(layout);\n }\n\n // determine the compactness type of an axis considering the size of a track\n const getAxisNarrowType = (\n c: 'x' | 'y',\n orientation: 'horizontal' | 'vertical' = 'horizontal',\n width: number,\n height: number\n ) => {\n const narrowSizeThreshold = 400;\n const narrowerSizeThreshold = 200;\n\n if (orientation === 'horizontal') {\n if ((c === 'x' && width <= narrowerSizeThreshold) || (c === 'y' && height <= narrowerSizeThreshold)) {\n return 'narrower';\n } else if (\n (c === 'x' && width <= narrowSizeThreshold) ||\n (c === 'y' && height <= narrowSizeThreshold)\n ) {\n return 'narrow';\n } else {\n return 'regular';\n }\n } else {\n if ((c === 'x' && height <= narrowerSizeThreshold) || (c === 'y' && width <= narrowerSizeThreshold)) {\n return 'narrower';\n } else if (\n (c === 'x' && height <= narrowSizeThreshold) ||\n (c === 'y' && width <= narrowSizeThreshold)\n ) {\n return 'narrow';\n } else {\n return 'regular';\n }\n }\n };\n\n // check whether to show axis\n ['x', 'y'].forEach(c => {\n const channel = (firstResolvedSpec as any)[c];\n if (\n IsChannelDeep(channel) &&\n 'axis' in channel &&\n channel.axis &&\n channel.axis !== 'none' &&\n channel.type === 'genomic'\n ) {\n const narrowType = getAxisNarrowType(c as any, gosTrack.orientation, bb.width, bb.height);\n hgModel.setAxisTrack(channel.axis, narrowType, {\n id: `${trackId}-${channel.axis}-axis`,\n layout: firstResolvedSpec.layout,\n innerRadius:\n channel.axis === 'top'\n ? (firstResolvedSpec.outerRadius as number) - HIGLASS_AXIS_SIZE\n : firstResolvedSpec.innerRadius,\n outerRadius:\n channel.axis === 'top'\n ? firstResolvedSpec.outerRadius\n : (firstResolvedSpec.innerRadius as number) + HIGLASS_AXIS_SIZE,\n width: firstResolvedSpec.width,\n height: firstResolvedSpec.height,\n startAngle: firstResolvedSpec.startAngle,\n endAngle: firstResolvedSpec.endAngle,\n theme\n });\n }\n });\n\n hgModel.validateSpec(true);\n } else if (firstResolvedSpec.mark === 'header') {\n // `text` tracks are used to show title and subtitle of the views\n hgModel.addDefaultView(`${trackId}-title`).setLayout(layout);\n if (typeof firstResolvedSpec.title === 'string') {\n hgModel.setTextTrack(\n bb.width,\n (theme.root.titleFontSize ?? 18) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM,\n firstResolvedSpec.title,\n theme.root.titleColor,\n theme.root.titleFontSize ?? 18,\n theme.root.titleFontWeight,\n theme.root.titleAlign,\n theme.root.titleBackgroundColor,\n theme.root.titleFontFamily ?? DEFAULT_TEXT_STYLE.fontFamily\n );\n }\n if (typeof firstResolvedSpec.subtitle === 'string') {\n hgModel.setTextTrack(\n bb.width,\n // TODO: better way to safely get the value when undefined?\n (theme.root.subtitleFontSize ?? 14) + DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM,\n firstResolvedSpec.subtitle,\n theme.root.subtitleColor,\n theme.root.subtitleFontSize ?? 14,\n theme.root.subtitleFontWeight,\n theme.root.subtitleAlign,\n theme.root.subtitleBackgroundColor,\n theme.root.subtitleFontFamily ?? DEFAULT_TEXT_STYLE.fontFamily\n );\n }\n }\n\n // Uncomment the following code to test with specific HiGlass viewConfig\n // hgModel.setExampleHiglassViewConfig();\n\n return hgModel;\n}\n","import { IsChannelDeep } from '@gosling-lang/gosling-schema';\nimport type { HiGlassModel } from '../../compiler/higlass-model';\nimport { SUPPORTED_CHANNELS } from '../mark';\nimport { resolveSuperposedTracks } from './overlay';\n\n/**\n *\n */\nexport function getLinkingInfo(hgModel: HiGlassModel) {\n const linkingInfo: {\n layout: 'circular' | 'linear';\n hgViewId: string;\n linkId: string;\n isBrush: boolean;\n style: any;\n }[] = [];\n\n hgModel.spec().views.forEach(v => {\n const hgViewId = v.uid;\n\n // TODO: Better way to get view specifications?\n // Get spec of a view\n let spec = /* TODO: */ (v.tracks as any).center?.[0]?.contents?.[0]?.options?.spec;\n\n if (!spec) {\n // This means the orientation of this view is vertical, and spec might be positioned on the left\n spec = /* TODO: */ (v.tracks as any).left?.[0]?.contents?.[0]?.options?.spec;\n if (!spec) {\n // in case the first one is the axis track\n spec = /* TODO: */ (v.tracks as any).left?.[1]?.contents?.[0]?.options?.spec;\n }\n }\n\n if (!hgViewId || !spec) return;\n\n const resolved = resolveSuperposedTracks(spec);\n\n resolved.forEach(spec => {\n SUPPORTED_CHANNELS.forEach(cKey => {\n const channel = spec[cKey];\n\n if (IsChannelDeep(channel) && 'linkingId' in channel && channel.linkingId) {\n linkingInfo.push({\n layout: spec.layout === 'circular' ? 'circular' : 'linear',\n hgViewId,\n linkId: channel.linkingId,\n isBrush: spec.mark === 'brush',\n style: {\n color: (spec as any).color?.value,\n stroke: (spec as any).stroke?.value,\n strokeWidth: (spec as any).strokeWidth?.value,\n opacity: (spec as any).opacity?.value,\n startAngle: spec.startAngle,\n endAngle: spec.endAngle,\n innerRadius: spec.innerRadius,\n outerRadius: spec.outerRadius\n }\n });\n return;\n }\n });\n });\n });\n return linkingInfo;\n}\n","import type { CommonTrackDef, CommonViewDef, GoslingSpec, PartialTrack, View } from '@gosling-lang/gosling-schema';\nimport { traverseTracksAndViews } from '../compiler/spec-preprocess';\n\n/**\n * A table that maps Gosling track IDs to HiGlass view IDs.\n */\nexport type IdTable = Record;\n\n/**\n * Manage IDs of Gosling tracks and compiled HiGlass views.\n * The HiGlass view IDs correspond to the \"UIDs\" of HiGlass *views*,\n * which are used for calling HiGlass APIs internally in Gosling.js.\n * It is 1:1 or N:1 mapping between Gosling tracks IDs and HiGlass views IDs.\n * https://docs.higlass.io/view_config.html#uids\n */\nexport class GoslingToHiGlassIdMapper {\n /** A mapping table between Gosling track IDs to HiGlass view IDs */\n #table: IdTable = {};\n\n addMapping(gtId: string, hvId: string) {\n if (this.#table[gtId] && this.#table[gtId] !== hvId) {\n console.warn(`The track ID ${gtId} already exists but overwriting with a different ID.`);\n }\n this.#table[gtId] = hvId;\n }\n getTable() {\n return this.#table;\n }\n getGoslingIds() {\n return Object.keys(this.#table);\n }\n getHiGlassId(gtId: string) {\n return this.#table[gtId];\n }\n /**\n * Get IDs of Gosling tracks that became the same HiGlass view.\n * @param HiGlassId\n * @returns\n */\n getSiblingGoslingIds(HiGlassId: string) {\n return Object.entries(this.#table)\n .filter(([, hvId]) => hvId === HiGlassId)\n .map(([gtId]) => gtId);\n }\n}\n\n/**\n * Find all unique IDs of 'views' in a Gosling spec and return them as an array.\n * @param spec\n * @returns\n */\nexport function getViewIds(spec: GoslingSpec | View | PartialTrack) {\n const viewIds = new Set();\n if (spec.id) {\n // root view\n viewIds.add(spec.id);\n }\n traverseTracksAndViews(spec, subSpec => {\n if ('views' in subSpec || 'tracks' in subSpec) {\n // encountered a view\n if (subSpec.id) {\n // found a valid view id\n viewIds.add(subSpec.id);\n }\n }\n });\n return Array.from(viewIds);\n}\n\n/**\n * Find all unique IDs of 'tracks' in a Gosling spec and return them as an array.\n * @param spec\n * @returns\n */\nexport function getTrackIds(spec: GoslingSpec | View | PartialTrack) {\n const trackIds = new Set();\n traverseTracksAndViews(spec, subSpec => {\n if (!('views' in subSpec) && !('tracks' in subSpec)) {\n // encountered a track\n if (subSpec.id) {\n // found a valid track id\n trackIds.add(subSpec.id);\n }\n }\n });\n return Array.from(trackIds);\n}\n\n/**\n * Get an internal spec using an ID of a track or a view. `undefined` if unfound.\n * @param spec\n * @returns\n */\nexport function getInternalSpecById(spec: GoslingSpec | View | PartialTrack, id: string) {\n let internalSpec: CommonViewDef | CommonTrackDef | undefined;\n if (spec.id === id) {\n // root view\n internalSpec = spec;\n }\n traverseTracksAndViews(spec, subSpec => {\n if (subSpec.id === id) {\n internalSpec = subSpec;\n }\n });\n return internalSpec;\n}\n","import type { GoslingSpec, PartialTrack, TrackApiData, View } from '@gosling-lang/gosling-schema';\nimport { getInternalSpecById, getTrackIds, getViewIds } from '../api/track-and-view-ids';\n\n/**\n * This collect information of views by referring to the track information.\n * The information includes the bounding box of tracks.\n * @param spec\n * @param tracks\n * @returns\n */\nexport function getViewApiData(spec: GoslingSpec, tracks: TrackApiData[]) {\n return getViewIds(spec).map(viewId => {\n const internalSpec = getInternalSpecById(spec, viewId);\n const trackIds = getTrackIds(internalSpec as View | PartialTrack);\n const bb = {\n x: Number.MAX_SAFE_INTEGER,\n y: Number.MAX_SAFE_INTEGER,\n xe: -Number.MAX_SAFE_INTEGER,\n ye: -Number.MAX_SAFE_INTEGER\n };\n trackIds\n .map(trackId => tracks.find(t => t.id === trackId))\n .forEach(track => {\n if (!track) return;\n const { shape } = track;\n if (bb.x > shape.x) {\n bb.x = shape.x;\n }\n if (bb.y > shape.y) {\n bb.y = shape.y;\n }\n if (bb.xe < shape.x + shape.width) {\n bb.xe = shape.x + shape.width;\n }\n if (bb.ye < shape.y + shape.height) {\n bb.ye = shape.y + shape.height;\n }\n });\n return {\n id: viewId,\n spec: internalSpec as View,\n shape: { ...bb, width: bb.xe - bb.x, height: bb.ye - bb.y }\n };\n });\n}\n","import { getBoundingBox, type TrackInfo } from './bounding-box';\nimport { goslingToHiGlass } from './gosling-to-higlass';\nimport { HiGlassModel } from './higlass-model';\nimport { getLinkingInfo } from '../core/utils/linking';\nimport type {\n GoslingSpec,\n OverlaidTrack,\n SingleTrack,\n TrackApiData,\n VisUnitApiData,\n ViewApiData\n} from '@gosling-lang/gosling-schema';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\nimport type { CompileCallback } from './compile';\nimport type { UrlToFetchOptions } from 'src/core/gosling-component';\nimport { getViewApiData } from '../api/api-data';\nimport { GoslingToHiGlassIdMapper } from '../api/track-and-view-ids';\nimport { IsDummyTrack } from '@gosling-lang/gosling-schema';\n\nexport function renderHiGlass(\n spec: GoslingSpec,\n trackInfos: TrackInfo[],\n callback: CompileCallback,\n theme: CompleteThemeDeep,\n urlToFetchOptions?: UrlToFetchOptions\n) {\n if (trackInfos.length === 0) {\n // no tracks to render\n return;\n }\n\n // HiGlass model\n const hgModel = new HiGlassModel();\n\n // A mapping table between Gosling track IDs and HiGlass view IDs\n const idMapper = new GoslingToHiGlassIdMapper();\n\n /* Update the HiGlass model by iterating tracks */\n trackInfos.forEach(tb => {\n const { track, boundingBox: bb, layout } = tb;\n goslingToHiGlass(hgModel, track, bb, layout, theme, idMapper, urlToFetchOptions);\n });\n\n /* Add linking information to the HiGlass model */\n const linkingInfos = getLinkingInfo(hgModel);\n\n // Brushing\n // (between a view with `brush` and a view having the same linking name)\n linkingInfos\n .filter(d => d.isBrush)\n .forEach(info => {\n hgModel.addBrush(\n info.layout,\n info.hgViewId,\n theme,\n linkingInfos.find(d => !d.isBrush && d.linkId === info.linkId)?.hgViewId,\n info.style\n );\n });\n\n // location/zoom lock information\n // fill `locksByViewUid`\n linkingInfos\n .filter(d => !d.isBrush)\n .forEach(d => {\n hgModel.spec().zoomLocks.locksByViewUid[d.hgViewId] = d.linkId;\n hgModel.spec().locationLocks.locksByViewUid[d.hgViewId] = d.linkId;\n });\n\n // fill `locksDict`\n const uniqueLinkIds = Array.from(new Set(linkingInfos.map(d => d.linkId)));\n\n uniqueLinkIds.forEach(linkId => {\n hgModel.spec().zoomLocks.locksDict[linkId] = { uid: linkId };\n hgModel.spec().locationLocks.locksDict[linkId] = { uid: linkId };\n\n linkingInfos\n .filter(d => !d.isBrush)\n .filter(d => d.linkId === linkId)\n .forEach(d => {\n hgModel.spec().zoomLocks.locksDict[linkId][d.hgViewId] = [124625310.5, 124625310.5, 249250.621];\n hgModel.spec().locationLocks.locksDict[linkId][d.hgViewId] = [124625310.5, 124625310.5, 249250.621];\n });\n });\n\n const tracks: TrackApiData[] = trackInfos.map(d => {\n return {\n id: d.track.id!,\n spec: d.track as SingleTrack | OverlaidTrack,\n shape:\n d.track.layout === 'linear' || IsDummyTrack(d.track) // Dummy track is always linear\n ? d.boundingBox\n : {\n ...d.boundingBox,\n cx: d.boundingBox.x + d.boundingBox.width / 2.0,\n cy: d.boundingBox.y + d.boundingBox.height / 2.0,\n innerRadius: d.track.innerRadius!,\n outerRadius: d.track.outerRadius!,\n startAngle: d.track.startAngle!,\n endAngle: d.track.endAngle!\n }\n };\n });\n\n // Get the view information needed to support JS APIs (e.g., providing view bounding boxes)\n const views: ViewApiData[] = getViewApiData(spec, tracks);\n\n // Merge the tracks and views\n const tracksAndViews = [\n ...tracks.map(d => ({ ...d, type: 'track' } as VisUnitApiData)),\n ...views.map(d => ({ ...d, type: 'view' } as VisUnitApiData))\n ];\n\n callback(hgModel.spec(), getBoundingBox(trackInfos), spec, tracksAndViews, idMapper.getTable());\n}\n","import type { GoslingSpec, SelectivityCondition, SingleView } from '@gosling-lang/gosling-schema';\nimport { logicalComparison } from '../core/utils/semantic-zoom';\n\nexport function manageResponsiveSpecs(\n spec: GoslingSpec | SingleView,\n wFactor: number,\n hFactor: number,\n parentWidth: number,\n parentHeight: number\n): boolean {\n if (typeof spec._assignedWidth === 'undefined' || typeof spec._assignedHeight === 'undefined') {\n console.warn('Responsive spec cannot be used when width and height of a view is not determined yet.');\n return false;\n }\n\n let replaced = false;\n\n const { responsiveSpec } = spec;\n\n const width = spec._assignedWidth * wFactor;\n const height = spec._assignedHeight * hFactor;\n const dimensions = { width, height, aspectRatio: width / height };\n const parentDimensions = { width: parentWidth, height: parentHeight, aspectRatio: parentWidth / parentHeight };\n\n // Check whether any alternative specs fullfil the condition\n if (responsiveSpec) {\n // TODO: Specify types for `specAndCondition`\n responsiveSpec.forEach((specAndCondition: any) => {\n const { spec: alternativeSpec, selectivity } = specAndCondition;\n\n if (isSelectResponsiveSpec(selectivity, dimensions, parentDimensions) && !replaced) {\n // Override this alternative spec in this view\n Object.keys(alternativeSpec).forEach(k => {\n (spec as any)[k] = (alternativeSpec as any)[k];\n });\n delete spec.responsiveSpec;\n\n replaced = true;\n\n // now that we replaced a spec already, get out of this scope.\n return;\n }\n });\n }\n\n if ('views' in spec) {\n // This means we need to go deeper\n spec.views.forEach(view => {\n replaced = manageResponsiveSpecs(view, wFactor, hFactor, parentWidth, parentHeight) || replaced;\n });\n }\n\n return replaced;\n}\n\n/**\n * Test if given conditions are all `true`.\n * @param conditions\n * @param assignedDimensions\n * @returns\n */\nfunction isSelectResponsiveSpec(\n conditions: SelectivityCondition[],\n assignedDimensions: { width: number; height: number; aspectRatio: number },\n parentDimensions: { width: number; height: number; aspectRatio: number }\n): boolean {\n if (conditions.length === 0) return false;\n\n let isSelect = true;\n\n conditions.forEach(condition => {\n const { measure, operation, threshold, target } = condition;\n isSelect =\n isSelect &&\n logicalComparison(\n (target === 'container' ? parentDimensions : assignedDimensions)[measure],\n operation,\n threshold\n ) === 1;\n });\n\n return isSelect;\n}\n","import type { GoslingSpec, TemplateTrackDef, VisUnitApiData } from '@gosling-lang/gosling-schema';\nimport type { HiGlassSpec } from '@gosling-lang/higlass-schema';\nimport { traverseToFixSpecDownstream, overrideDataTemplates } from './spec-preprocess';\nimport { replaceTrackTemplates } from '../core/utils/template';\nimport { getRelativeTrackInfo, type Size } from './bounding-box';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\nimport type { UrlToFetchOptions } from 'src/core/gosling-component';\nimport { renderHiGlass as createHiGlassModels } from './create-higlass-models';\nimport { manageResponsiveSpecs } from './responsive';\nimport type { IdTable } from '../api/track-and-view-ids';\nimport { publish } from '../api/pubsub';\n\n/** The callback function called everytime after the spec has been compiled */\nexport type CompileCallback = (\n hg: HiGlassSpec,\n size: Size,\n gs: GoslingSpec,\n tracksAndViews: VisUnitApiData[],\n idTable: IdTable\n) => void;\n\nexport function compile(\n spec: GoslingSpec,\n callback: CompileCallback,\n templates: TemplateTrackDef[],\n theme: Required,\n containerStatus: {\n containerSize?: { width: number; height: number };\n containerParentSize?: { width: number; height: number };\n },\n urlToFetchOptions?: UrlToFetchOptions\n) {\n // Make sure to keep the original spec as-is\n const specCopy = JSON.parse(JSON.stringify(spec));\n\n // Override default visual encoding (i.e., `DataTrack` => `BasicSingleTrack`)\n overrideDataTemplates(specCopy);\n\n // Replace track templates with raw gosling specs (i.e., `TemplateTrack` => `SingleTrack | OverlaidTrack`)\n replaceTrackTemplates(specCopy, templates);\n\n // Fix track specs by looking into the root-level spec\n traverseToFixSpecDownstream(specCopy);\n\n // Generate arrangement data\n const trackInfosAndSize = getRelativeTrackInfo(specCopy, theme);\n let { trackInfos } = trackInfosAndSize;\n const { size } = trackInfosAndSize;\n\n // Handle responsive specs, either remove them or replace original specs w/ them\n const isResponsiveWidth =\n (typeof spec.responsiveSize === 'object' && spec.responsiveSize?.width) || spec.responsiveSize;\n const isResponsiveHeight =\n (typeof spec.responsiveSize === 'object' && spec.responsiveSize?.height) || spec.responsiveSize;\n const wFactor =\n isResponsiveWidth && containerStatus.containerSize ? containerStatus.containerSize.width / size.width : 1;\n const hFactor =\n isResponsiveHeight && containerStatus.containerSize ? containerStatus.containerSize.height / size.height : 1;\n const pWidth = containerStatus.containerParentSize\n ? containerStatus.containerParentSize.width\n : Number.MAX_SAFE_INTEGER;\n const pHeight = containerStatus.containerParentSize\n ? containerStatus.containerParentSize.height\n : Number.MAX_SAFE_INTEGER;\n const replaced = manageResponsiveSpecs(specCopy, wFactor, hFactor, pWidth, pHeight);\n\n // Do the downstream-fix and track arrangement again using the updated spec\n if (replaced) {\n traverseToFixSpecDownstream(specCopy);\n trackInfos = getRelativeTrackInfo(specCopy, theme).trackInfos;\n }\n\n // publish the fixed spec\n // used for alt-gosling\n publish('specProcessed', {\n id: specCopy.id,\n spec: specCopy\n });\n\n // Make HiGlass models for individual tracks\n createHiGlassModels(specCopy, trackInfos, callback, theme, urlToFetchOptions);\n}\n","/* eslint-disable react/prop-types */\nimport type * as PIXI from 'pixi.js';\nimport React, { useEffect, useState, forwardRef, useMemo } from 'react';\n\nimport * as gosling from '..';\n// @ts-ignore\nimport { HiGlassComponent } from 'higlass';\nimport type { HiGlassSpec } from '@gosling-lang/higlass-schema';\nimport { uuid } from '../core/utils/uuid';\n\n/**\n * Register plugin tracks and data fetchers to HiGlass. This is necessary for the first time before using Gosling.\n */\ngosling.init();\n\n// TODO: Complete the API\nexport type HiGlassApi = {\n api: Record;\n pixiRenderer: PIXI.Renderer;\n pixiStage: PIXI.IRenderableObject;\n};\n\nexport interface HiGlassComponentWrapperProps {\n size: { width: number; height: number };\n viewConfig?: HiGlassSpec;\n options: {\n padding?: number;\n margin?: number;\n border?: string;\n background?: string;\n responsiveWidth?: boolean;\n responsiveHeight?: boolean;\n alt?: string;\n };\n id?: string;\n className?: string;\n}\n\nexport const HiGlassComponentWrapper = forwardRef(\n (props, ref) => {\n // div `id` and `className` for detailed customization\n const [wrapperDivId, setWrapperDivId] = useState(props.id ?? uuid());\n useEffect(() => {\n setWrapperDivId(props.id ?? uuid());\n }, [props.id]);\n\n const viewConfig = props.viewConfig || {};\n const pixelPreciseMarginPadding = false; // !props.options.responsiveHeight;\n const higlassComponent = useMemo(\n () => (\n \n ),\n [viewConfig, pixelPreciseMarginPadding]\n );\n\n // Styling\n const {\n padding = 60,\n margin = 0,\n border = 'none',\n background,\n alt = 'Gosling visualization'\n } = props.options || {};\n return (\n <>\n \n {\n // PubSub.publish('gosling.click', {\n // mouseX: e.pageX - (document.getElementById('higlass-wrapper')?.offsetLeft ?? 0),\n // mouseY: e.pageY - (document.getElementById('higlass-wrapper')?.offsetTop ?? 0)\n // });\n // }}\n >\n {higlassComponent}\n
\n \n \n );\n }\n);\n\nHiGlassComponentWrapper.displayName = 'HiGlassComponentWrapper';\n","import * as PIXI from 'pixi.js';\nimport type { TrackApiData, VisUnitApiData, ViewApiData } from '@gosling-lang/gosling-schema';\nimport type { HiGlassSpec } from '@gosling-lang/higlass-schema';\nimport type { HiGlassApi } from '../core/higlass-component-wrapper';\nimport { subscribe, unsubscribe } from './pubsub';\nimport { computeChromSizes, GenomicPositionHelper } from '../core/utils/assembly';\nimport type { CompleteThemeDeep } from '../core/utils/theme';\nimport type { IdTable } from './track-and-view-ids';\n\n/**\n * Information of suggested genes.\n */\ninterface GeneSuggestion {\n geneName: string; // gene symbol\n score: number; // higher score means suggested gene is more likely to match the searched keyword\n chr: string; // chromosome name\n txStart: number; // absolute genomic position assuming chromosomes are concat end-to-end\n txEnd: number; // absolute genomic position assuming chromosomes are concat end-to-end\n}\n\nexport interface GoslingApi {\n subscribe: typeof subscribe;\n unsubscribe: typeof unsubscribe;\n zoomTo(viewId: string, position: string, padding?: number, duration?: number): void;\n zoomToExtent(viewId: string, duration?: number): void;\n zoomToGene(viewId: string, gene: string, padding?: number, duration?: number): void;\n suggestGene(viewId: string, keyword: string, callback: (suggestions: GeneSuggestion[]) => void): void;\n getTracksAndViews(): VisUnitApiData[];\n /**\n * Get an array of all available track IDs that are either specified by users or auto-generated by the compiler.\n * This can be used to call other API functions, e.g., `getTrack('track-1')`.\n */\n getTrackIds(): string[];\n getTracks(): TrackApiData[];\n getTrack(trackId: string): TrackApiData | undefined;\n getViews(): ViewApiData[];\n getView(viewId: string): ViewApiData | undefined;\n exportPng(transparentBackground?: boolean): void;\n exportPdf(transparentBackground?: boolean): void;\n getCanvas(options?: { resolution?: number; transparentBackground?: boolean }): {\n canvas: HTMLCanvasElement;\n canvasWidth: number;\n canvasHeight: number;\n resolution: number;\n };\n}\n\nexport function createApi(\n hg: Readonly,\n hgSpec: HiGlassSpec | undefined,\n tracksAndViews: readonly VisUnitApiData[],\n theme: Required,\n idTable: Readonly\n): GoslingApi {\n const idTableCopy = structuredClone(idTable);\n /**\n * Get the HiGlass view ID from the Gosling track ID.\n */\n const getHgViewId = (trackId: string) => {\n const viewId = idTableCopy[trackId];\n if (!viewId) {\n console.warn(`Unable to find the track ID, named ${trackId}.`);\n }\n return viewId ?? trackId;\n };\n const getTrackIds = () => {\n return Object.keys(idTableCopy);\n };\n const getTracksAndViews = () => {\n return [...tracksAndViews];\n };\n const getTracks = () => {\n return [...getTracksAndViews().filter(d => d.type === 'track')] as TrackApiData[];\n };\n const getTrack = (trackId: string) => {\n const trackInfoFound = getTracks().find(d => d.id === trackId);\n if (!trackInfoFound) {\n console.warn(`[getTrack()] Unable to find a track using the ID (${trackId})`);\n }\n return trackInfoFound;\n };\n const getViews = () => {\n return [...getTracksAndViews().filter(d => d.type === 'view')] as ViewApiData[];\n };\n const getView = (viewId: string) => {\n const view = getViews().find(d => d.id === viewId);\n if (!view) {\n console.warn(`Unable to find a view with the ID of ${viewId}`);\n }\n return view;\n };\n const getCanvas: GoslingApi['getCanvas'] = options => {\n const resolution = options?.resolution ?? 4;\n const transparentBackground = options?.transparentBackground ?? false;\n\n const renderer = hg.pixiRenderer;\n const renderTexture = PIXI.RenderTexture.create({\n width: renderer.width / 2,\n height: renderer.height / 2,\n resolution\n });\n\n renderer.render(hg.pixiStage, renderTexture);\n\n const canvas = renderer.plugins.extract.canvas(renderTexture);\n\n // Set background color for the given theme in the gosling spec\n // Otherwise, it is transparent\n const canvasWithBg = document.createElement('canvas') as HTMLCanvasElement;\n canvasWithBg.width = canvas.width;\n canvasWithBg.height = canvas.height;\n\n const ctx = canvasWithBg.getContext('2d')!;\n if (!transparentBackground) {\n ctx.fillStyle = theme.root.background;\n ctx.fillRect(0, 0, canvasWithBg.width, canvasWithBg.height);\n }\n ctx.drawImage(canvas, 0, 0);\n\n return {\n canvas: canvasWithBg,\n resolution,\n canvasWidth: canvas.width,\n canvasHeight: canvas.height\n };\n };\n return {\n subscribe,\n unsubscribe,\n zoomTo: (trackId, position, padding = 0, duration = 1000) => {\n // Accepted input: 'chr1' or 'chr1:1-1000'\n const assembly = getTrack(trackId)?.spec.assembly;\n const manager = GenomicPositionHelper.fromString(position);\n const absCoordinates = manager.toAbsoluteCoordinates(assembly, padding);\n const hgViewId = getHgViewId(trackId);\n hg.api.zoomTo(hgViewId, ...absCoordinates, ...absCoordinates, duration);\n },\n zoomToExtent: (trackId, duration = 1000) => {\n const assembly = getTrack(trackId)?.spec.assembly;\n const [start, end] = [0, computeChromSizes(assembly).total];\n const hgViewId = getHgViewId(trackId);\n hg.api.zoomTo(hgViewId, start, end, start, end, duration);\n },\n zoomToGene: (trackId, gene, padding = 0, duration = 1000) => {\n const hgViewId = getHgViewId(trackId);\n hg.api.zoomToGene(hgViewId, gene, padding, duration);\n },\n suggestGene: (trackId: string, keyword: string, callback: (suggestions: GeneSuggestion[]) => void) => {\n const hgViewId = getHgViewId(trackId);\n hg.api.suggestGene(hgViewId, keyword, callback);\n },\n getTrackIds,\n getTracksAndViews,\n getTracks,\n getTrack,\n getView,\n getViews,\n getCanvas,\n exportPng: transparentBackground => {\n const { canvas } = getCanvas({ resolution: 4, transparentBackground });\n canvas.toBlob(blob => {\n const a = document.createElement('a');\n document.body.append(a);\n a.download = 'gosling-visualization';\n a.href = URL.createObjectURL(blob!);\n a.click();\n a.remove();\n }, 'image/png');\n },\n exportPdf: async transparentBackground => {\n const { jsPDF } = await import('jspdf');\n const { canvas } = getCanvas({ resolution: 4, transparentBackground });\n const imgData = canvas.toDataURL('image/jpeg', 1);\n const pdf = new jsPDF({\n orientation: canvas.width < canvas.height ? 'p' : 'l',\n unit: 'pt',\n format: [canvas.width, canvas.height]\n });\n pdf.addImage(imgData, 'JPEG', 0, 0, canvas.width, canvas.height);\n pdf.save('gosling-visualization.pdf');\n }\n };\n}\n","import type { GoslingSpec } from '@gosling-lang/gosling-schema';\nimport { cloneDeepWith } from 'lodash-es';\nimport { isObject } from '@gosling-lang/gosling-schema';\n\nexport function omitDeep(spec: GoslingSpec, omitKeys: string[]) {\n return cloneDeepWith(spec, (value: unknown) => {\n if (isObject(value)) {\n omitKeys.forEach(key => {\n delete value[key];\n });\n }\n });\n}\n","import type { HiGlassSpec } from '@gosling-lang/higlass-schema';\n\n/**\n * This makes sure that all the current zooming status is preserved when new tracks are added\n */\nexport const preverseZoomStatus = (newSpec: HiGlassSpec, prevSpec: HiGlassSpec) => {\n newSpec.views.forEach(view => {\n const viewUid = view.uid!;\n const isNewView = !prevSpec.views.find(v => v.uid === viewUid);\n if (isNewView) {\n // if this view is linked with another view, we need to preverse the current zooming status of this view from the linked view\n // Otherwise, all the views that is linked with this view will be reset to the original zooming position\n const { locksByViewUid } = newSpec.zoomLocks;\n const lockUid = locksByViewUid[viewUid];\n const linkedViewUid = Object.entries(locksByViewUid).find(([_, uid]) => _ && uid === lockUid)?.[0];\n // Only if the linked view existed in the previous spec, we copy the zooming status\n const linkedViewExistedPrev = !!prevSpec.views.find(v => v.uid === linkedViewUid);\n if (linkedViewUid && linkedViewExistedPrev) {\n // We found a linked view, so copy the current zooming status\n view.initialXDomain = prevSpec.views.find(v => v.uid === linkedViewUid)?.initialXDomain;\n view.initialYDomain = prevSpec.views.find(v => v.uid === linkedViewUid)?.initialYDomain;\n }\n }\n });\n};\n","/* eslint-disable react/prop-types */\nimport { type HiGlassApi, HiGlassComponentWrapper } from './higlass-component-wrapper';\nimport type { TemplateTrackDef, VisUnitApiData } from '@gosling-lang/gosling-schema';\nimport type { RequestInit } from '@gosling-lang/higlass-schema';\nimport React, { useState, useEffect, useMemo, useRef, forwardRef, useCallback, useImperativeHandle } from 'react';\nimport { ResizeSensor } from 'css-element-queries';\nimport * as gosling from '..';\nimport { getTheme, type Theme } from './utils/theme';\nimport { createApi, type GoslingApi } from '../api/api';\nimport { GoslingTemplates } from '..';\nimport { omitDeep } from './utils/omit-deep';\nimport { isEqual } from 'lodash-es';\nimport { publish } from '../api/pubsub';\nimport type { IdTable } from '../api/track-and-view-ids';\nimport { preverseZoomStatus } from './utils/higlass-zoom-config';\nimport { uuid } from '../core/utils/uuid';\n\n// Before rerendering, wait for a few time so that HiGlass container is resized already.\n// If HiGlass is rendered and then the container resizes, the viewport position changes, unmatching `xDomain` specified by users.\nconst DELAY_FOR_CONTAINER_RESIZE_BEFORE_RERENDER = 300;\n\n/** Matches URLs to specific fetch options so that datafetchers have access URL specific fetch options */\nexport interface UrlToFetchOptions {\n [url: string]: RequestInit;\n}\ntype CompiledCallbackFn = (\n goslingSpec: gosling.GoslingSpec,\n higlassSpec: gosling.HiGlassSpec,\n _additionalData: { _processedSpec: gosling.GoslingSpec }\n) => void\n\ninterface GoslingCompProps {\n spec?: gosling.GoslingSpec;\n compiled?: CompiledCallbackFn;\n padding?: number;\n margin?: number;\n border?: string;\n id?: string;\n className?: string;\n theme?: Theme;\n templates?: TemplateTrackDef[];\n urlToFetchOptions?: UrlToFetchOptions;\n experimental?: {\n reactive?: boolean;\n };\n}\n\nexport type GoslingRef = {\n api: GoslingApi;\n hgApi: HiGlassApi;\n};\n\nexport const GoslingComponent = forwardRef((props, ref) => {\n const [viewConfig, setViewConfig] = useState();\n const [size, setSize] = useState({ width: 200, height: 200 });\n const wrapperSize = useRef();\n const wrapperParentSize = useRef();\n const prevSpec = useRef();\n const tracksAndViews = useRef([]);\n /** A mapping table that connects between Gosling track IDs to corresponding HiGlas view IDs */\n const idTable = useRef({});\n\n // HiGlass API\n // https://dev.to/wojciechmatuszewski/mutable-and-immutable-useref-semantics-with-react-typescript-30c9\n const hgRef = useRef(null);\n\n const theme = getTheme(props.theme || 'light');\n const wrapperDivId = props.id ?? uuid();\n\n /**\n * Publishes event if there is a new view added\n * @param currentTracksAndViews newly retrieved tracks and views from compile() callback\n */\n const publishOnNewView = (currentTracksAndViews: VisUnitApiData[]) => {\n // Compare the previous and current views to figure out the difference\n const prevViews = tracksAndViews.current.filter(data => data.type == 'view');\n const currentViews = currentTracksAndViews.filter(data => data.type == 'view');\n const prevViewIds = new Set(prevViews.map(data => data.id));\n const newViews = currentViews.filter(view => !prevViewIds.has(view.id));\n // Publish if there are any new changes\n newViews.forEach(view => {\n publish('onNewView', { id: view.id });\n });\n };\n\n // Gosling APIs\n useImperativeHandle(\n ref,\n () => {\n const hgApi = refAsReadonlyProxy(hgRef);\n const visUnits = refAsReadonlyProxy(tracksAndViews);\n const api = createApi(hgApi, viewConfig, visUnits, theme, idTable.current);\n return { api, hgApi };\n },\n [viewConfig, theme]\n );\n\n // TODO: add a `force` parameter since changing `linkingId` might not update vis\n const compile = useCallback(() => {\n if (props.spec) {\n const valid = gosling.validateGoslingSpec(props.spec);\n\n if (valid.state === 'error') {\n console.warn('Gosling spec is not valid. Please refer to the console message.');\n return;\n }\n\n gosling.compile(\n props.spec,\n (newHiGlassSpec, newSize, newGoslingSpec, newTracksAndViews, newIdTable) => {\n // TODO: `linkingId` should be updated\n // We may not want to re-render this\n if (\n prevSpec.current &&\n isEqual(omitDeep(prevSpec.current, ['linkingId']), omitDeep(newGoslingSpec, ['linkingId']))\n ) {\n return;\n }\n\n // If a callback function is provided, return compiled information.\n props.compiled?.(props.spec!, newHiGlassSpec, { _processedSpec: newGoslingSpec });\n\n // Change the size of wrapper `
` elements\n setSize(newSize);\n\n // Update the compiled view config\n const isMountedOnce = typeof viewConfig !== 'undefined';\n if (props.experimental?.reactive && isMountedOnce) {\n // Use API to update visualization.\n setTimeout(() => {\n preverseZoomStatus(\n newHiGlassSpec,\n hgRef.current?.api.getViewConfig() as gosling.HiGlassSpec\n );\n hgRef.current?.api.setViewConfig(newHiGlassSpec);\n }, DELAY_FOR_CONTAINER_RESIZE_BEFORE_RERENDER);\n } else {\n // Mount `HiGlassComponent` using this view config.\n setViewConfig(newHiGlassSpec);\n }\n publishOnNewView(newTracksAndViews);\n prevSpec.current = newGoslingSpec;\n tracksAndViews.current = newTracksAndViews;\n idTable.current = newIdTable;\n },\n [...GoslingTemplates], // TODO: allow user definitions\n theme,\n {\n containerSize: wrapperSize.current,\n containerParentSize: wrapperParentSize.current\n },\n props.urlToFetchOptions\n );\n }\n }, [props.spec, theme]);\n\n // TODO: If not necessary, do not update `wrapperSize` (i.e., when responsiveSize is not set)\n useEffect(() => {\n if (!props.spec?.responsiveSize) return;\n\n const containerElement = document.getElementById(wrapperDivId);\n if (!containerElement) return;\n\n const resizer = new ResizeSensor(containerElement, newSize => {\n if (\n !wrapperSize.current ||\n wrapperSize.current.height !== newSize.height ||\n wrapperSize.current.width !== newSize.width\n ) {\n wrapperSize.current = newSize;\n compile();\n }\n });\n\n const parentElement = containerElement.parentElement;\n if (!parentElement) return;\n\n const parentResizer = new ResizeSensor(parentElement, newSize => {\n if (\n !wrapperParentSize.current ||\n wrapperParentSize.current.height !== newSize.height ||\n wrapperParentSize.current.width !== newSize.width\n ) {\n wrapperParentSize.current = newSize;\n compile();\n }\n });\n\n return () => {\n resizer.detach();\n parentResizer.detach();\n };\n });\n\n useEffect(() => {\n compile();\n }, [props.spec, theme]);\n\n const responsiveHeight =\n typeof props.spec?.responsiveSize !== 'object' ? props.spec?.responsiveSize : props.spec.responsiveSize.height;\n\n // HiGlass component should be mounted only once\n const higlassComponent = useMemo(\n () => (\n \n ),\n [viewConfig, size, theme, responsiveHeight]\n );\n\n return higlassComponent;\n});\n\nGoslingComponent.displayName = 'GoslingComponent';\n\n/** Wraps the `.current` property of a React.RefObject as a readonly object. */\nfunction refAsReadonlyProxy(ref: React.RefObject): Readonly {\n // Readonly because because we only implement `get`.\n return new Proxy({} as Readonly, {\n get(_target, prop, reciever) {\n if (!ref.current) throw Error('ref is not set!');\n return Reflect.get(ref.current, prop, reciever);\n }\n });\n}\n","'use strict';\n\nvar m = require('react-dom');\nif (process.env.NODE_ENV === 'production') {\n exports.createRoot = m.createRoot;\n exports.hydrateRoot = m.hydrateRoot;\n} else {\n var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n exports.createRoot = function(c, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.createRoot(c, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n exports.hydrateRoot = function(c, h, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.hydrateRoot(c, h, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n}\n","import React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport type { GoslingSpec } from '@gosling-lang/gosling-schema';\nimport type { HiGlassSpec } from '@gosling-lang/higlass-schema';\n\nimport { validateGoslingSpec } from '@gosling-lang/gosling-schema';\nimport { compile } from '../compiler/compile';\nimport type { UrlToFetchOptions } from './gosling-component';\nimport { getTheme, type Theme } from './utils/theme';\nimport { GoslingTemplates } from './utils/template';\nimport { type GoslingApi, createApi } from '../api/api';\n\nimport {\n type HiGlassApi,\n HiGlassComponentWrapper,\n type HiGlassComponentWrapperProps\n} from './higlass-component-wrapper';\n\nexport type GoslingEmbedOptions = Omit & {\n id?: string;\n className?: string;\n theme?: Theme;\n urlToFetchOptions?: UrlToFetchOptions;\n};\n\nconst MAX_TRIES = 20;\nconst INTERVAL = 200; // ms\n\n// https://github.com/higlass/higlass/blob/0299ae1229fb57e0ca8da31dff58003c3e5bf1cf/app/scripts/hglib.js#L37A\nconst launchHiglass = (\n element: HTMLElement,\n viewConfig: HiGlassSpec,\n size: { width: number; height: number },\n opts: GoslingEmbedOptions & { background: string }\n): Promise => {\n const ref = React.createRef();\n const component = React.createElement(HiGlassComponentWrapper, {\n ref,\n viewConfig,\n size,\n id: opts.id,\n className: opts.className,\n options: opts\n });\n\n createRoot(element).render(component);\n\n // For some reason our wrapper component fails to initialize the provided `ref`\n // immediately like `hglib.launch()`. This is a work-around to poll `ref`\n // until it is initialized by our wrapper. We return a promise for the API once\n // it is defined or raise an error.\n // https://github.com/gosling-lang/gosling.js/pull/456#discussion_r687861694\n return new Promise((resolve, reject) => {\n let tries = 0;\n const poll = setInterval(() => {\n if (ref && ref.current) {\n clearInterval(poll);\n resolve(ref.current);\n }\n if (tries >= MAX_TRIES) {\n reject(new Error('Failed to initialize HiGlassApi.'));\n }\n tries++;\n }, INTERVAL);\n });\n};\n\n/**\n * Embed a Gosling component to a given HTMLElement.\n * @param element\n * @param spec\n */\nexport function embed(element: HTMLElement, spec: GoslingSpec, opts: GoslingEmbedOptions = {}) {\n return new Promise((resolve, reject) => {\n const valid = validateGoslingSpec(spec);\n\n if (valid.state === 'error') {\n reject(new Error('Gosling spec is not valid. Please refer to the console message.'));\n }\n\n const theme = getTheme(opts.theme || 'light');\n const options = {\n ...opts,\n background: theme.root.background,\n alt: opts.alt ?? spec.description ?? 'Gosling visualization'\n };\n\n compile(\n spec,\n async (hsSpec, size, _, trackInfos, idTable) => {\n const hg = await launchHiglass(element, hsSpec, size, options);\n const api = createApi(hg, hsSpec, trackInfos, theme, idTable);\n resolve(api);\n },\n [...GoslingTemplates],\n theme,\n {}, // TODO: properly specify this\n opts.urlToFetchOptions\n );\n });\n}\n"],"names":["name","NOMINAL_COLOR","LightThemeMarkCommonStyle","getTheme","config","factory","icon","colorToHex","options","m","d3arc","DEBOUNCE_TIME","Worker","err","sum","parser","mask","varName","tag","func","tempVar","_getPrototypeOf","o","_setPrototypeOf","p","self","_get","Emitter","AbortSignal","toString","AbortController","Request","init","abortableFetch","require$$0","global","AggregateAbortController_1","abortcontroller_ponyfill_1","AggregateStatusReporter_1","__importDefault","this","AbortablePromiseCache_1","require$$1","require$$2","rank","max","min","inflateRaw","getParsers","AbortablePromiseCache","Buffer","d","b","Subscription","Subscriber","ConsumerObserver","SafeSubscriber","Observable","subscribe","observable","Symbol_observable","OperatorSubscriber","RemoteFile","dataConfig","v","group","tileInfo","d3dsvFormat","genomicFields","i","exampleHg","_getTheme","d3min","d3sum","_d","d3max","_a","PubSub","_assembly","width","height","spec","createHiGlassModels","gosling.init","getTrackIds","blob","compile","gosling.validateGoslingSpec","gosling.compile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A,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;A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AAAA,MACD,KAAK;AAAA,IAAA;AAAA,EACT,CACH;AACL;","x_google_ignoreList":[22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,93]} \ No newline at end of file diff --git a/dist/src/alias/buffer-shim.d.ts b/dist/src/alias/buffer-shim.d.ts deleted file mode 100644 index e2646b22..00000000 --- a/dist/src/alias/buffer-shim.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Buffer } from "buffer/"; -//# sourceMappingURL=buffer-shim.d.ts.map \ No newline at end of file diff --git a/dist/src/alias/buffer-shim.d.ts.map b/dist/src/alias/buffer-shim.d.ts.map deleted file mode 100644 index 3cae5752..00000000 --- a/dist/src/alias/buffer-shim.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"buffer-shim.d.ts","sourceRoot":"","sources":["../../../src/alias/buffer-shim.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/src/alias/zlib.d.ts b/dist/src/alias/zlib.d.ts deleted file mode 100644 index a01bbd05..00000000 --- a/dist/src/alias/zlib.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/// -import { Buffer } from 'buffer'; -export declare function inflateSync(src: Uint8Array): Buffer; -declare const _default: { - inflateSync: typeof inflateSync; -}; -export default _default; -//# sourceMappingURL=zlib.d.ts.map \ No newline at end of file diff --git a/dist/src/alias/zlib.d.ts.map b/dist/src/alias/zlib.d.ts.map deleted file mode 100644 index ce50ab1f..00000000 --- a/dist/src/alias/zlib.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"zlib.d.ts","sourceRoot":"","sources":["../../../src/alias/zlib.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,UAE1C;;;;AAED,wBAA+B"} \ No newline at end of file diff --git a/dist/src/api/api-data.d.ts b/dist/src/api/api-data.d.ts deleted file mode 100644 index d072c62f..00000000 --- a/dist/src/api/api-data.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { GoslingSpec, TrackApiData, View } from '@gosling-lang/gosling-schema'; -/** - * This collect information of views by referring to the track information. - * The information includes the bounding box of tracks. - * @param spec - * @param tracks - * @returns - */ -export declare function getViewApiData(spec: GoslingSpec, tracks: TrackApiData[]): { - id: string; - spec: View; - shape: { - width: number; - height: number; - x: number; - y: number; - xe: number; - ye: number; - }; -}[]; -//# sourceMappingURL=api-data.d.ts.map \ No newline at end of file diff --git a/dist/src/api/api-data.d.ts.map b/dist/src/api/api-data.d.ts.map deleted file mode 100644 index 59c02102..00000000 --- a/dist/src/api/api-data.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"api-data.d.ts","sourceRoot":"","sources":["../../../src/api/api-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAgB,YAAY,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGlG;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE;;;;;;;;;;;IAkCvE"} \ No newline at end of file diff --git a/dist/src/api/api.d.ts b/dist/src/api/api.d.ts deleted file mode 100644 index 7caccc86..00000000 --- a/dist/src/api/api.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -import type { TrackApiData, VisUnitApiData, ViewApiData } from '@gosling-lang/gosling-schema'; -import type { HiGlassSpec } from '@gosling-lang/higlass-schema'; -import type { HiGlassApi } from '../core/higlass-component-wrapper'; -import { subscribe, unsubscribe } from './pubsub'; -import type { CompleteThemeDeep } from '../core/utils/theme'; -import type { IdTable } from './track-and-view-ids'; -/** - * Information of suggested genes. - */ -interface GeneSuggestion { - geneName: string; - score: number; - chr: string; - txStart: number; - txEnd: number; -} -export interface GoslingApi { - subscribe: typeof subscribe; - unsubscribe: typeof unsubscribe; - zoomTo(viewId: string, position: string, padding?: number, duration?: number): void; - zoomToExtent(viewId: string, duration?: number): void; - zoomToGene(viewId: string, gene: string, padding?: number, duration?: number): void; - suggestGene(viewId: string, keyword: string, callback: (suggestions: GeneSuggestion[]) => void): void; - getTracksAndViews(): VisUnitApiData[]; - /** - * Get an array of all available track IDs that are either specified by users or auto-generated by the compiler. - * This can be used to call other API functions, e.g., `getTrack('track-1')`. - */ - getTrackIds(): string[]; - getTracks(): TrackApiData[]; - getTrack(trackId: string): TrackApiData | undefined; - getViews(): ViewApiData[]; - getView(viewId: string): ViewApiData | undefined; - exportPng(transparentBackground?: boolean): void; - exportPdf(transparentBackground?: boolean): void; - getCanvas(options?: { - resolution?: number; - transparentBackground?: boolean; - }): { - canvas: HTMLCanvasElement; - canvasWidth: number; - canvasHeight: number; - resolution: number; - }; -} -export declare function createApi(hg: Readonly, hgSpec: HiGlassSpec | undefined, tracksAndViews: readonly VisUnitApiData[], theme: Required, idTable: Readonly): GoslingApi; -export {}; -//# sourceMappingURL=api.d.ts.map \ No newline at end of file diff --git a/dist/src/api/api.d.ts.map b/dist/src/api/api.d.ts.map deleted file mode 100644 index efb70671..00000000 --- a/dist/src/api/api.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api/api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;GAEG;AACH,UAAU,cAAc;IACpB,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E,MAAM,CAAC;QAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG;QAC3E,MAAM,EAAE,iBAAiB,CAAC;QAC1B,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL;AAED,wBAAgB,SAAS,CACrB,EAAE,EAAE,QAAQ,CAAC,UAAU,CAAC,EACxB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,cAAc,EAAE,SAAS,cAAc,EAAE,EACzC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAClC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAC3B,UAAU,CAiIZ"} \ No newline at end of file diff --git a/dist/src/api/pubsub.d.ts b/dist/src/api/pubsub.d.ts deleted file mode 100644 index ca315eaa..00000000 --- a/dist/src/api/pubsub.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { _EventMap } from '@gosling-lang/gosling-schema'; -type EventName = keyof _EventMap; -export declare function publish(name: Name, data: _EventMap[Name]): void; -export declare function subscribe(name: Name, callback: (msg: string, data: _EventMap[Name]) => void): void; -export declare function unsubscribe(name: EventName): void; -export {}; -//# sourceMappingURL=pubsub.d.ts.map \ No newline at end of file diff --git a/dist/src/api/pubsub.d.ts.map b/dist/src/api/pubsub.d.ts.map deleted file mode 100644 index 36330ea8..00000000 --- a/dist/src/api/pubsub.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pubsub.d.ts","sourceRoot":"","sources":["../../../src/api/pubsub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D,KAAK,SAAS,GAAG,MAAM,SAAS,CAAC;AAEjC,wBAAgB,OAAO,CAAC,IAAI,SAAS,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAEvF;AAED,wBAAgB,SAAS,CAAC,IAAI,SAAS,SAAS,EAC5C,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,GACvD,IAAI,CAEN;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAEjD"} \ No newline at end of file diff --git a/dist/src/api/track-and-view-ids.d.ts b/dist/src/api/track-and-view-ids.d.ts deleted file mode 100644 index 1eac64b8..00000000 --- a/dist/src/api/track-and-view-ids.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -import type { CommonTrackDef, CommonViewDef, GoslingSpec, PartialTrack, View } from '@gosling-lang/gosling-schema'; -/** - * A table that maps Gosling track IDs to HiGlass view IDs. - */ -export type IdTable = Record; -/** - * Manage IDs of Gosling tracks and compiled HiGlass views. - * The HiGlass view IDs correspond to the "UIDs" of HiGlass *views*, - * which are used for calling HiGlass APIs internally in Gosling.js. - * It is 1:1 or N:1 mapping between Gosling tracks IDs and HiGlass views IDs. - * https://docs.higlass.io/view_config.html#uids - */ -export declare class GoslingToHiGlassIdMapper { - #private; - addMapping(gtId: string, hvId: string): void; - getTable(): IdTable; - getGoslingIds(): string[]; - getHiGlassId(gtId: string): string; - /** - * Get IDs of Gosling tracks that became the same HiGlass view. - * @param HiGlassId - * @returns - */ - getSiblingGoslingIds(HiGlassId: string): string[]; -} -/** - * Find all unique IDs of 'views' in a Gosling spec and return them as an array. - * @param spec - * @returns - */ -export declare function getViewIds(spec: GoslingSpec | View | PartialTrack): string[]; -/** - * Find all unique IDs of 'tracks' in a Gosling spec and return them as an array. - * @param spec - * @returns - */ -export declare function getTrackIds(spec: GoslingSpec | View | PartialTrack): string[]; -/** - * Get an internal spec using an ID of a track or a view. `undefined` if unfound. - * @param spec - * @returns - */ -export declare function getInternalSpecById(spec: GoslingSpec | View | PartialTrack, id: string): CommonViewDef | CommonTrackDef | undefined; -//# sourceMappingURL=track-and-view-ids.d.ts.map \ No newline at end of file diff --git a/dist/src/api/track-and-view-ids.d.ts.map b/dist/src/api/track-and-view-ids.d.ts.map deleted file mode 100644 index 49d6c419..00000000 --- a/dist/src/api/track-and-view-ids.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"track-and-view-ids.d.ts","sourceRoot":"","sources":["../../../src/api/track-and-view-ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGnH;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7C;;;;;;GAMG;AACH,qBAAa,wBAAwB;;IAIjC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAMrC,QAAQ;IAGR,aAAa;IAGb,YAAY,CAAC,IAAI,EAAE,MAAM;IAGzB;;;;OAIG;IACH,oBAAoB,CAAC,SAAS,EAAE,MAAM;CAKzC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,YAAY,YAgBjE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,YAAY,YAYlE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,YAAY,EAAE,EAAE,EAAE,MAAM,8CAYtF"} \ No newline at end of file diff --git a/dist/src/compiler/bounding-box.d.ts b/dist/src/compiler/bounding-box.d.ts deleted file mode 100644 index 0e899ddb..00000000 --- a/dist/src/compiler/bounding-box.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -import type { GoslingSpec, Track } from '@gosling-lang/gosling-schema'; -import type { CompleteThemeDeep } from '../core/utils/theme'; -export interface Size { - width: number; - height: number; -} -/** - * Position information of each track. - */ -export interface BoundingBox extends Size { - x: number; - y: number; -} -/** - * Relative positioning of views, used in HiGlass view configs as `layout`. - */ -export interface RelativePosition { - w: number; - h: number; - x: number; - y: number; -} -/** - * Track information for its arrangement. - */ -export interface TrackInfo { - track: Track; - boundingBox: BoundingBox; - layout: RelativePosition; -} -/** - * Return the size of entire visualization. - * @param trackInfos - */ -export declare function getBoundingBox(trackInfos: TrackInfo[]): { - width: number; - height: number; -}; -/** - * Collect information of individual tracks including their size/position and specs - * @param spec - */ -export declare function getRelativeTrackInfo(spec: GoslingSpec, theme: CompleteThemeDeep): { - trackInfos: TrackInfo[]; - size: { - width: number; - height: number; - }; -}; -export declare function getNumOfXAxes(tracks: Track[]): number; -export declare function getNumOfYAxes(tracks: Track[]): number; -//# sourceMappingURL=bounding-box.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/bounding-box.d.ts.map b/dist/src/compiler/bounding-box.d.ts.map deleted file mode 100644 index 00fcd916..00000000 --- a/dist/src/compiler/bounding-box.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bounding-box.d.ts","sourceRoot":"","sources":["../../../src/compiler/bounding-box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgC,WAAW,EAAE,KAAK,EAAc,MAAM,8BAA8B,CAAC;AAWjH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,WAAW,IAAI;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,IAAI;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,SAAS,EAAE;;;EAgBrD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,iBAAiB,GACzB;IACC,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,CAsDA;AA+OD,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAErD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAErD"} \ No newline at end of file diff --git a/dist/src/compiler/compile.d.ts b/dist/src/compiler/compile.d.ts deleted file mode 100644 index f6afd98b..00000000 --- a/dist/src/compiler/compile.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { GoslingSpec, TemplateTrackDef, VisUnitApiData } from '@gosling-lang/gosling-schema'; -import type { HiGlassSpec } from '@gosling-lang/higlass-schema'; -import { type Size } from './bounding-box'; -import type { CompleteThemeDeep } from '../core/utils/theme'; -import type { UrlToFetchOptions } from 'src/core/gosling-component'; -import type { IdTable } from '../api/track-and-view-ids'; -/** The callback function called everytime after the spec has been compiled */ -export type CompileCallback = (hg: HiGlassSpec, size: Size, gs: GoslingSpec, tracksAndViews: VisUnitApiData[], idTable: IdTable) => void; -export declare function compile(spec: GoslingSpec, callback: CompileCallback, templates: TemplateTrackDef[], theme: Required, containerStatus: { - containerSize?: { - width: number; - height: number; - }; - containerParentSize?: { - width: number; - height: number; - }; -}, urlToFetchOptions?: UrlToFetchOptions): void; -//# sourceMappingURL=compile.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/compile.d.ts.map b/dist/src/compiler/compile.d.ts.map deleted file mode 100644 index 78ba69ee..00000000 --- a/dist/src/compiler/compile.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/compiler/compile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGhE,OAAO,EAAwB,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGzD,8EAA8E;AAC9E,MAAM,MAAM,eAAe,GAAG,CAC1B,EAAE,EAAE,WAAW,EACf,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,WAAW,EACf,cAAc,EAAE,cAAc,EAAE,EAChC,OAAO,EAAE,OAAO,KACf,IAAI,CAAC;AAEV,wBAAgB,OAAO,CACnB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,gBAAgB,EAAE,EAC7B,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAClC,eAAe,EAAE;IACb,aAAa,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,mBAAmB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3D,EACD,iBAAiB,CAAC,EAAE,iBAAiB,QAmDxC"} \ No newline at end of file diff --git a/dist/src/compiler/create-higlass-models.d.ts b/dist/src/compiler/create-higlass-models.d.ts deleted file mode 100644 index 5733aa21..00000000 --- a/dist/src/compiler/create-higlass-models.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { type TrackInfo } from './bounding-box'; -import type { GoslingSpec } from '@gosling-lang/gosling-schema'; -import type { CompleteThemeDeep } from '../core/utils/theme'; -import type { CompileCallback } from './compile'; -import type { UrlToFetchOptions } from 'src/core/gosling-component'; -export declare function renderHiGlass(spec: GoslingSpec, trackInfos: TrackInfo[], callback: CompileCallback, theme: CompleteThemeDeep, urlToFetchOptions?: UrlToFetchOptions): void; -//# sourceMappingURL=create-higlass-models.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/create-higlass-models.d.ts.map b/dist/src/compiler/create-higlass-models.d.ts.map deleted file mode 100644 index 7bf93c6c..00000000 --- a/dist/src/compiler/create-higlass-models.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"create-higlass-models.d.ts","sourceRoot":"","sources":["../../../src/compiler/create-higlass-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhE,OAAO,KAAK,EACR,WAAW,EAMd,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAKpE,wBAAgB,aAAa,CACzB,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,SAAS,EAAE,EACvB,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,iBAAiB,EACxB,iBAAiB,CAAC,EAAE,iBAAiB,QA0FxC"} \ No newline at end of file diff --git a/dist/src/compiler/defaults.d.ts b/dist/src/compiler/defaults.d.ts deleted file mode 100644 index 3cc273d8..00000000 --- a/dist/src/compiler/defaults.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export declare const DEFAULT_VISUAL_PROPERTIES: { - opacity: number; -}; -export declare const DEFAULT_TITLE_HEIGHT = 20; -export declare const DEFAULT_SUBTITLE_HEIGHT = 20; -export declare const DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM = 6; -export declare const DEFAULT_TRACK_HEIGHT_LINEAR = 130; -export declare const DEFAULT_TRACK_WIDTH_LINEAR = 600; -export declare const DEFAULT_TRACK_SIZE_2D = 600; -export declare const DEFAULT_VIEW_SPACING = 10; -export declare const DEFAULT_INNER_RADIUS_PROP = 0.3; -export declare const DEFAULT_CIRCULAR_VIEW_PADDING = 0; -export declare const DEFAULT_BACKUP_COLOR = "gray"; -//# sourceMappingURL=defaults.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/defaults.d.ts.map b/dist/src/compiler/defaults.d.ts.map deleted file mode 100644 index 3bf068da..00000000 --- a/dist/src/compiler/defaults.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/compiler/defaults.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB;;CAErC,CAAC;AAEF,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,wCAAwC,IAAI,CAAC;AAG1D,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAGzC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAGvC,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAG7C,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAG/C,eAAO,MAAM,oBAAoB,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/src/compiler/gosling-to-higlass.d.ts b/dist/src/compiler/gosling-to-higlass.d.ts deleted file mode 100644 index b54be16e..00000000 --- a/dist/src/compiler/gosling-to-higlass.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { HiGlassModel } from './higlass-model'; -import type { Track } from '@gosling-lang/gosling-schema'; -import type { BoundingBox, RelativePosition } from './bounding-box'; -import type { CompleteThemeDeep } from '../core/utils/theme'; -import type { GoslingToHiGlassIdMapper } from '../api/track-and-view-ids'; -import type { UrlToFetchOptions } from '../core/gosling-component'; -/** - * Convert a gosling track into a HiGlass view and add it into a higlass model. - */ -export declare function goslingToHiGlass(hgModel: HiGlassModel, gosTrack: Track, bb: BoundingBox, layout: RelativePosition, theme: Required, idMapper: GoslingToHiGlassIdMapper, urlToFetchOptions?: UrlToFetchOptions): HiGlassModel; -//# sourceMappingURL=gosling-to-higlass.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/gosling-to-higlass.d.ts.map b/dist/src/compiler/gosling-to-higlass.d.ts.map deleted file mode 100644 index 07cd64cc..00000000 --- a/dist/src/compiler/gosling-to-higlass.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gosling-to-higlass.d.ts","sourceRoot":"","sources":["../../../src/compiler/gosling-to-higlass.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAqB,MAAM,iBAAiB,CAAC;AAElE,OAAO,KAAK,EAAE,KAAK,EAAU,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAcpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,KAAK,EACf,EAAE,EAAE,WAAW,EACf,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAClC,QAAQ,EAAE,wBAAwB,EAClC,iBAAiB,CAAC,EAAE,iBAAiB,GACtC,YAAY,CA+Rd"} \ No newline at end of file diff --git a/dist/src/compiler/higlass-model.d.ts b/dist/src/compiler/higlass-model.d.ts deleted file mode 100644 index f0758262..00000000 --- a/dist/src/compiler/higlass-model.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -import type { HiGlassSpec, Track } from '@gosling-lang/higlass-schema'; -import type { Assembly, AxisPosition, Domain, DummyTrack, Orientation, ZoomLimits } from '@gosling-lang/gosling-schema'; -import type { RelativePosition } from './bounding-box'; -import type { CompleteThemeDeep } from '../core/utils/theme'; -export declare const HIGLASS_AXIS_SIZE = 30; -/** - * Model for managing the HiGlass view config. - * We are currently only using a center track with additional tracks for axes in a single view. - */ -export declare class HiGlassModel { - private assembly?; - private orientation?; - private hg; - constructor(); - spec(): Readonly; - setViewOrientation(orientation?: Orientation): this; - addDefaultView(uid: string, assembly?: Assembly): this; - setAssembly(assembly?: Assembly): this; - getAssembly(): Assembly | undefined; - setTextTrack(width: number, height: number, text: string, textColor?: string, fontSize?: number, fontWeight?: string, align?: string, backgroundColor?: string, fontFamily?: string): this; - /** - * Add a dummy track to the last view - * @param track - */ - setDummyTrack(track: DummyTrack): this; - addBrush(layout: 'circular' | 'linear', viewId: string, theme: Required, fromViewUid?: string, style?: { - color?: string; - stroke?: string; - opacity?: string; - strokeWidth?: number; - startAngle?: number; - endAngle?: number; - innerRadius?: number; - outerRadius?: number; - }): this | undefined; - getLastView(): import("@gosling-lang/higlass-schema").View; - getMainTrackPosition(): "left" | "center"; - /** - * Get the last view that renders any visualization, so skiping empty tracks. - */ - getLastVisView(): import("@gosling-lang/higlass-schema").View; - getView(viewId: string): import("@gosling-lang/higlass-schema").View | undefined; - validateSpec(silence?: boolean): boolean; - setDomain(xDomain: Domain | undefined, yDomain: Domain | undefined): this; - /** - * This is a hacky function that adjust x domain to properly show vertical tracks. - * - * In HiGlass, the range of vertical tracks is affected by a center track. For example, if a center track is small, the vertical tracks become small as well. - * Currently, the actual size of center track for vertical gosling tracks is `1px`. So, we re-scale the x domain so that gosling's vertical tracks properly use the entire height of a view. - * @param orientation - * @param width - * @returns - */ - adjustDomain(orientation: Orientation | undefined, width: number, height: number): this; - /** - * Allow a zoom interaction? - */ - setZoomFixed(zoomFixed: boolean): this; - /** - * Set limits of zoom levels in base pairs. - */ - setZoomLimits(zoomLimits: ZoomLimits): this; - setLayout(layout: RelativePosition): this; - private setEditable; - private setChromInfoPath; - addTrackSourceServers(trackSourceServers: string | undefined): this; - setMainTrack(track: Track): this; - addTrackToCombined(track: Track): this; - setAxisTrack(position: Exclude, type: "regular" | "narrow" | "narrower" | undefined, options: { - id?: string; - layout?: 'circular' | 'linear'; - innerRadius?: number; - outerRadius?: number; - width?: number; - height?: number; - startAngle?: number; - endAngle?: number; - theme: Required; - }): this; - setExampleHiglassViewConfig(): void; -} -//# sourceMappingURL=higlass-model.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/higlass-model.d.ts.map b/dist/src/compiler/higlass-model.d.ts.map deleted file mode 100644 index 80908b59..00000000 --- a/dist/src/compiler/higlass-model.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"higlass-model.d.ts","sourceRoot":"","sources":["../../../src/compiler/higlass-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAExH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,eAAO,MAAM,iBAAiB,KAAK,CAAC;AA2BpC;;;GAGG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,C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;IACI,YAAY,CAAC,WAAW,yBAA4B,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAoB1F;;OAEG;IACI,YAAY,CAAC,SAAS,EAAE,OAAO;IAKtC;;OAEG;IACI,aAAa,CAAC,UAAU,EAAE,UAAU;IAKpC,SAAS,CAAC,MAAM,EAAE,gBAAgB;IAKzC,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,gBAAgB;IAQjB,qBAAqB,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS;IAM5D,YAAY,CAAC,KAAK,EAAE,KAAK;IAgBzB,kBAAkB,CAAC,KAAK,EAAE,KAAK;IAM/B,YAAY,CACf,QAAQ,EAAE,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,EACvC,IAAI,+CAA+C,EACnD,OAAO,EAAE;QACL,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;QAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KACtC;IA2DE,2BAA2B;CAGrC"} \ No newline at end of file diff --git a/dist/src/compiler/responsive.d.ts b/dist/src/compiler/responsive.d.ts deleted file mode 100644 index 0524d2a6..00000000 --- a/dist/src/compiler/responsive.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { GoslingSpec, SingleView } from '@gosling-lang/gosling-schema'; -export declare function manageResponsiveSpecs(spec: GoslingSpec | SingleView, wFactor: number, hFactor: number, parentWidth: number, parentHeight: number): boolean; -//# sourceMappingURL=responsive.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/responsive.d.ts.map b/dist/src/compiler/responsive.d.ts.map deleted file mode 100644 index 1105b33b..00000000 --- a/dist/src/compiler/responsive.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../../src/compiler/responsive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAwB,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAGlG,wBAAgB,qBAAqB,CACjC,IAAI,EAAE,WAAW,GAAG,UAAU,EAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACrB,OAAO,CA4CT"} \ No newline at end of file diff --git a/dist/src/compiler/spec-preprocess.d.ts b/dist/src/compiler/spec-preprocess.d.ts deleted file mode 100644 index 5f80a26c..00000000 --- a/dist/src/compiler/spec-preprocess.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { SingleTrack, GoslingSpec, View, SingleView, Track, PartialTrack, CommonTrackDef, CommonViewDef, MultipleViews } from '@gosling-lang/gosling-schema'; -/** - * Traverse individual tracks and call the callback function to read and/or update the track definition. - * @param spec - * @param callback - */ -export declare function traverseTracks(spec: GoslingSpec | View | PartialTrack, callback: (t: Partial, i: number, ts: Partial[]) => void): void; -/** - * Traverse individual tracks and views and call the callback function to read and/or update the common definition of views and tracks. - * @param spec - * @param callback - */ -export declare function traverseTracksAndViews(spec: GoslingSpec | View | PartialTrack, callback: (tv: CommonViewDef | CommonTrackDef) => void): void; -/** - * Traverse individual view arrangements and call the callback function to read and/or update the arrangement information. - * @param spec - * @param callback - */ -export declare function traverseViewArrangements(spec: GoslingSpec, callback: (tv: MultipleViews) => void): void; -/** - * This convert the nested track definitions into a flat array. - * @param spec - */ -export declare function convertToFlatTracks(spec: SingleView): Track[]; -/** - * Traverse views and tracks to use parents's properties if missing. - * @param spec - * @param callback - */ -export declare function traverseToFixSpecDownstream(spec: GoslingSpec | SingleView, parentDef?: CommonViewDef | MultipleViews): void; -/** - * Get an encoding template for the `higlass-vector` data type. - * @param column - * @param value - */ -export declare function getVectorTemplate(column: string, value: string): SingleTrack; -export declare function getMultivecTemplate(row: string, column: string, value: string, categories: string[] | undefined): SingleTrack; -/** - * Override default visual encoding in each track for given data type. - * @param spec - */ -export declare function overrideDataTemplates(spec: GoslingSpec): void; -//# sourceMappingURL=spec-preprocess.d.ts.map \ No newline at end of file diff --git a/dist/src/compiler/spec-preprocess.d.ts.map b/dist/src/compiler/spec-preprocess.d.ts.map deleted file mode 100644 index 3b504a48..00000000 --- a/dist/src/compiler/spec-preprocess.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"spec-preprocess.d.ts","sourceRoot":"","sources":["../../../src/compiler/spec-preprocess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EACX,WAAW,EACX,IAAI,EACJ,UAAU,EACV,KAAK,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EAEhB,MAAM,8BAA8B,CAAC;AAuBtC;;;;GAIG;AACH,wBAAgB,cAAc,CAC1B,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,YAAY,EACvC,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,QAUzE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAClC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,YAAY,EACvC,QAAQ,EAAE,CAAC,EAAE,EAAE,aAAa,GAAG,cAAc,KAAK,IAAI,QAazD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,aAAa,KAAK,IAAI,QAShG;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,KAAK,EAAE,CAuC7D;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,EAAE,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,QAiUpH;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAc5E;AAED,wBAAgB,mBAAmB,CAC/B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,GACjC,WAAW,CAmCb;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,QAmCtD"} \ No newline at end of file diff --git a/dist/src/core/channel/index.d.ts b/dist/src/core/channel/index.d.ts deleted file mode 100644 index acfaffef..00000000 --- a/dist/src/core/channel/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export declare const CHANNEL_DEFAULTS: { - NOMINAL_COLOR: string[]; - NOMINAL_COLOR_EXTENDED: string[]; - QUANTITATIVE_COLOR: string; - SIZE: number; - SIZE_RANGE: number[]; -}; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/core/channel/index.d.ts.map b/dist/src/core/channel/index.d.ts.map deleted file mode 100644 index 1ac2a6ad..00000000 --- a/dist/src/core/channel/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/channel/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB;;;;;;CAyQ5B,CAAC"} \ No newline at end of file diff --git a/dist/src/core/example/hg-view-config-1.d.ts b/dist/src/core/example/hg-view-config-1.d.ts deleted file mode 100644 index b5e8f435..00000000 --- a/dist/src/core/example/hg-view-config-1.d.ts +++ /dev/null @@ -1,736 +0,0 @@ -declare const example: { - compactLayout: boolean; - trackSourceServers: string[]; - views: ({ - genomePositionSearchBoxVisible: boolean; - genomePositionSearchBox: { - autocompleteServer: string; - autocompleteId: string; - chromInfoServer: string; - chromInfoId: string; - }; - layout: { - x: number; - y: number; - w: number; - h: number; - }; - tracks: { - top: never[]; - left: ({ - type: string; - width: number; - height: number; - contents: { - type: string; - server: string; - tilesetUid: string; - width: number; - height: number; - options: { - showMousePosition: boolean; - mousePositionColor: string; - fontSize: number; - labelPosition: string; - labelShowResolution: boolean; - labelColor: string; - labelBackgroundColor: string; - labelTextOpacity: number; - labelLeftMargin: number; - labelTopMargin: number; - labelRightMargin: number; - labelBottomMargin: number; - backgroundColor: string; - spec: { - spacing: number; - orientation: string; - assembly: string; - layout: string; - static: boolean; - xDomain: { - interval: number[]; - }; - centerRadius: number; - xOffset: number; - yOffset: number; - style: { - outlineWidth: number; - }; - data: { - url: string; - type: string; - row: string; - column: string; - value: string; - categories: string[]; - binSize: number; - }; - mark: string; - x: { - field: string; - type: string; - axis: string; - domain: { - interval: number[]; - }; - linkingId: string; - }; - xe: { - field: string; - type: string; - }; - row: { - field: string; - type: string; - legend: boolean; - }; - color: { - field: string; - type: string; - legend: boolean; - }; - tooltip: ({ - field: string; - type: string; - alt: string; - format?: undefined; - } | { - field: string; - type: string; - alt: string; - format: string; - })[]; - width: number; - height: number; - overlayOnPreviousTrack: boolean; - }; - theme: { - base: string; - root: { - background: string; - titleColor: string; - titleBackgroundColor: string; - titleFontSize: number; - titleFontFamily: string; - titleAlign: string; - titleFontWeight: string; - subtitleColor: string; - subtitleBackgroundColor: string; - subtitleFontSize: number; - subtitleFontFamily: string; - subtitleFontWeight: string; - subtitleAlign: string; - mousePositionColor: string; - }; - track: { - background: string; - alternatingBackground: string; - titleColor: string; - titleBackground: string; - titleFontSize: number; - titleAlign: string; - outline: string; - outlineWidth: number; - }; - legend: { - position: string; - background: string; - backgroundOpacity: number; - labelColor: string; - labelFontSize: number; - labelFontWeight: string; - labelFontFamily: string; - backgroundStroke: string; - tickColor: string; - }; - axis: { - tickColor: string; - labelColor: string; - labelFontSize: number; - labelFontWeight: string; - labelFontFamily: string; - baselineColor: string; - gridColor: string; - gridStrokeWidth: number; - gridStrokeType: string; - gridStrokeDash: number[]; - }; - markCommon: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - point: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - rect: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - triangle: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - area: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - line: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - bar: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - rule: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - link: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - text: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - textAnchor: string; - textFontWeight: string; - }; - brush: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - }; - }; - }[]; - uid?: undefined; - chromInfoPath?: undefined; - options?: undefined; - } | { - uid: string; - type: string; - chromInfoPath: string; - options: { - layout: string; - outerRadius: null; - width: number; - height: number; - theme: { - base: string; - root: { - background: string; - titleColor: string; - titleBackgroundColor: string; - titleFontSize: number; - titleFontFamily: string; - titleAlign: string; - titleFontWeight: string; - subtitleColor: string; - subtitleBackgroundColor: string; - subtitleFontSize: number; - subtitleFontFamily: string; - subtitleFontWeight: string; - subtitleAlign: string; - mousePositionColor: string; - }; - track: { - background: string; - alternatingBackground: string; - titleColor: string; - titleBackground: string; - titleFontSize: number; - titleAlign: string; - outline: string; - outlineWidth: number; - }; - legend: { - position: string; - background: string; - backgroundOpacity: number; - labelColor: string; - labelFontSize: number; - labelFontWeight: string; - labelFontFamily: string; - backgroundStroke: string; - tickColor: string; - }; - axis: { - tickColor: string; - labelColor: string; - labelFontSize: number; - labelFontWeight: string; - labelFontFamily: string; - baselineColor: string; - gridColor: string; - gridStrokeWidth: number; - gridStrokeType: string; - gridStrokeDash: number[]; - }; - markCommon: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - point: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - rect: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - triangle: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - area: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - line: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - bar: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - rule: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - link: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - text: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - textAnchor: string; - textFontWeight: string; - }; - brush: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - }; - assembly: string; - stroke: string; - color: string; - fontSize: number; - fontFamily: string; - fontWeight: string; - tickColor: string; - tickFormat: string; - tickPositions: string; - reverseOrientation: boolean; - }; - width: number; - height?: undefined; - contents?: undefined; - })[]; - center: never[]; - right: never[]; - bottom: never[]; - gallery: never[]; - whole: never[]; - }; - initialXDomain: number[]; - initialYDomain: number[]; - zoomFixed: boolean; - zoomLimits: (number | null)[]; - uid: string; - chromInfoPath: string; - } | { - genomePositionSearchBoxVisible: boolean; - genomePositionSearchBox: { - autocompleteServer: string; - autocompleteId: string; - chromInfoServer: string; - chromInfoId: string; - }; - layout: { - x: number; - y: number; - w: number; - h: number; - }; - tracks: { - top: never[]; - left: { - type: string; - width: number; - height: number; - contents: { - type: string; - server: string; - tilesetUid: string; - width: number; - height: number; - options: { - showMousePosition: boolean; - mousePositionColor: string; - fontSize: number; - labelPosition: string; - labelShowResolution: boolean; - labelColor: string; - labelBackgroundColor: string; - labelTextOpacity: number; - labelLeftMargin: number; - labelTopMargin: number; - labelRightMargin: number; - labelBottomMargin: number; - backgroundColor: string; - spec: { - spacing: number; - orientation: string; - assembly: string; - layout: string; - static: boolean; - xDomain: { - interval: number[]; - }; - centerRadius: number; - xOffset: number; - yOffset: number; - style: { - outlineWidth: number; - }; - data: { - url: string; - type: string; - row: string; - column: string; - value: string; - categories: string[]; - binSize: number; - }; - mark: string; - x: { - field: string; - type: string; - domain: { - interval: number[]; - }; - linkingId: string; - }; - xe: { - field: string; - type: string; - }; - row: { - field: string; - type: string; - legend: boolean; - }; - color: { - field: string; - type: string; - legend: boolean; - }; - tooltip: ({ - field: string; - type: string; - alt: string; - format?: undefined; - } | { - field: string; - type: string; - alt: string; - format: string; - })[]; - width: number; - height: number; - }; - theme: { - base: string; - root: { - background: string; - titleColor: string; - titleBackgroundColor: string; - titleFontSize: number; - titleFontFamily: string; - titleAlign: string; - titleFontWeight: string; - subtitleColor: string; - subtitleBackgroundColor: string; - subtitleFontSize: number; - subtitleFontFamily: string; - subtitleFontWeight: string; - subtitleAlign: string; - mousePositionColor: string; - }; - track: { - background: string; - alternatingBackground: string; - titleColor: string; - titleBackground: string; - titleFontSize: number; - titleAlign: string; - outline: string; - outlineWidth: number; - }; - legend: { - position: string; - background: string; - backgroundOpacity: number; - labelColor: string; - labelFontSize: number; - labelFontWeight: string; - labelFontFamily: string; - backgroundStroke: string; - tickColor: string; - }; - axis: { - tickColor: string; - labelColor: string; - labelFontSize: number; - labelFontWeight: string; - labelFontFamily: string; - baselineColor: string; - gridColor: string; - gridStrokeWidth: number; - gridStrokeType: string; - gridStrokeDash: number[]; - }; - markCommon: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - point: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - rect: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - triangle: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - area: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - line: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - bar: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - rule: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - link: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - text: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - textAnchor: string; - textFontWeight: string; - }; - brush: { - color: string; - size: number; - stroke: string; - strokeWidth: number; - opacity: number; - nominalColorRange: string[]; - quantitativeSizeRange: number[]; - }; - }; - }; - }[]; - }[]; - center: never[]; - right: never[]; - bottom: never[]; - gallery: never[]; - whole: never[]; - }; - initialXDomain: number[]; - initialYDomain: number[]; - zoomFixed: boolean; - zoomLimits: (number | null)[]; - uid: string; - chromInfoPath?: undefined; - })[]; - zoomLocks: { - locksByViewUid: {}; - locksDict: {}; - }; - locationLocks: { - locksByViewUid: {}; - locksDict: {}; - }; - editable: boolean; - chromInfoPath: string; -}; -export default example; -//# sourceMappingURL=hg-view-config-1.d.ts.map \ No newline at end of file diff --git a/dist/src/core/example/hg-view-config-1.d.ts.map b/dist/src/core/example/hg-view-config-1.d.ts.map deleted file mode 100644 index 2205d6ba..00000000 --- a/dist/src/core/example/hg-view-config-1.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hg-view-config-1.d.ts","sourceRoot":"","sources":["../../../../src/core/example/hg-view-config-1.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAy9BZ,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/dist/src/core/gosling-component.d.ts b/dist/src/core/gosling-component.d.ts deleted file mode 100644 index e6eae139..00000000 --- a/dist/src/core/gosling-component.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { type HiGlassApi } from './higlass-component-wrapper'; -import type { TemplateTrackDef } from '@gosling-lang/gosling-schema'; -import type { RequestInit } from '@gosling-lang/higlass-schema'; -import React from 'react'; -import * as gosling from '..'; -import { type Theme } from './utils/theme'; -import { type GoslingApi } from '../api/api'; -/** Matches URLs to specific fetch options so that datafetchers have access URL specific fetch options */ -export interface UrlToFetchOptions { - [url: string]: RequestInit; -} -type CompiledCallbackFn = (goslingSpec: gosling.GoslingSpec, higlassSpec: gosling.HiGlassSpec, _additionalData: { - _processedSpec: gosling.GoslingSpec; -}) => void; -interface GoslingCompProps { - spec?: gosling.GoslingSpec; - compiled?: CompiledCallbackFn; - padding?: number; - margin?: number; - border?: string; - id?: string; - className?: string; - theme?: Theme; - templates?: TemplateTrackDef[]; - urlToFetchOptions?: UrlToFetchOptions; - experimental?: { - reactive?: boolean; - }; -} -export type GoslingRef = { - api: GoslingApi; - hgApi: HiGlassApi; -}; -export declare const GoslingComponent: React.ForwardRefExoticComponent>; -export {}; -//# sourceMappingURL=gosling-component.d.ts.map \ No newline at end of file diff --git a/dist/src/core/gosling-component.d.ts.map b/dist/src/core/gosling-component.d.ts.map deleted file mode 100644 index 2fa57c89..00000000 --- a/dist/src/core/gosling-component.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gosling-component.d.ts","sourceRoot":"","sources":["../../../src/core/gosling-component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAA2B,MAAM,6BAA6B,CAAC;AACvF,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,8BAA8B,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAA6F,MAAM,OAAO,CAAC;AAElH,OAAO,KAAK,OAAO,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAY,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAaxD,yGAAyG;AACzG,MAAM,WAAW,iBAAiB;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;CAC9B;AACD,KAAK,kBAAkB,GAAG,CACtB,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,WAAW,EAAE,OAAO,CAAC,WAAW,EAChC,eAAe,EAAE;IAAE,cAAc,EAAE,OAAO,CAAC,WAAW,CAAA;CAAE,KACvD,IAAI,CAAA;AAET,UAAU,gBAAgB;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,YAAY,CAAC,EAAE;QACX,QAAQ,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;CACL;AAED,MAAM,MAAM,UAAU,GAAG;IACrB,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,6FAgL3B,CAAC"} \ No newline at end of file diff --git a/dist/src/core/gosling-embed.d.ts b/dist/src/core/gosling-embed.d.ts deleted file mode 100644 index 418fc93c..00000000 --- a/dist/src/core/gosling-embed.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { GoslingSpec } from '@gosling-lang/gosling-schema'; -import type { UrlToFetchOptions } from './gosling-component'; -import { type Theme } from './utils/theme'; -import { type GoslingApi } from '../api/api'; -import { type HiGlassComponentWrapperProps } from './higlass-component-wrapper'; -export type GoslingEmbedOptions = Omit & { - id?: string; - className?: string; - theme?: Theme; - urlToFetchOptions?: UrlToFetchOptions; -}; -/** - * Embed a Gosling component to a given HTMLElement. - * @param element - * @param spec - */ -export declare function embed(element: HTMLElement, spec: GoslingSpec, opts?: GoslingEmbedOptions): Promise; -//# sourceMappingURL=gosling-embed.d.ts.map \ No newline at end of file diff --git a/dist/src/core/gosling-embed.d.ts.map b/dist/src/core/gosling-embed.d.ts.map deleted file mode 100644 index a9f8eddf..00000000 --- a/dist/src/core/gosling-embed.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gosling-embed.d.ts","sourceRoot":"","sources":["../../../src/core/gosling-embed.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAKhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAY,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,KAAK,UAAU,EAAa,MAAM,YAAY,CAAC;AAExD,OAAO,EAGH,KAAK,4BAA4B,EACpC,MAAM,6BAA6B,CAAC;AAErC,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,4BAA4B,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC,GAAG;IAC5F,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACzC,CAAC;AA4CF;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,GAAE,mBAAwB,uBA4B5F"} \ No newline at end of file diff --git a/dist/src/core/higlass-component-wrapper.d.ts b/dist/src/core/higlass-component-wrapper.d.ts deleted file mode 100644 index 4bb24976..00000000 --- a/dist/src/core/higlass-component-wrapper.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type * as PIXI from 'pixi.js'; -import React from 'react'; -import type { HiGlassSpec } from '@gosling-lang/higlass-schema'; -export type HiGlassApi = { - api: Record; - pixiRenderer: PIXI.Renderer; - pixiStage: PIXI.IRenderableObject; -}; -export interface HiGlassComponentWrapperProps { - size: { - width: number; - height: number; - }; - viewConfig?: HiGlassSpec; - options: { - padding?: number; - margin?: number; - border?: string; - background?: string; - responsiveWidth?: boolean; - responsiveHeight?: boolean; - alt?: string; - }; - id?: string; - className?: string; -} -export declare const HiGlassComponentWrapper: React.ForwardRefExoticComponent>; -//# sourceMappingURL=higlass-component-wrapper.d.ts.map \ No newline at end of file diff --git a/dist/src/core/higlass-component-wrapper.d.ts.map b/dist/src/core/higlass-component-wrapper.d.ts.map deleted file mode 100644 index 7ad2beca..00000000 --- a/dist/src/core/higlass-component-wrapper.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"higlass-component-wrapper.d.ts","sourceRoot":"","sources":["../../../src/core/higlass-component-wrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAShE,MAAM,MAAM,UAAU,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzB,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC;IAC5B,SAAS,EAAE,IAAI,CAAC,iBAAiB,CAAC;CACrC,CAAC;AAEF,MAAM,WAAW,4BAA4B;IACzC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE;QACL,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,uBAAuB,6GA6FnC,CAAC"} \ No newline at end of file diff --git a/dist/src/core/init.d.ts b/dist/src/core/init.d.ts deleted file mode 100644 index ff7afe6f..00000000 --- a/dist/src/core/init.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Register plugin tracks and data fetchers to HiGlass. This is necessary for the first time before using Gosling.js. - */ -export declare function init(): void; -//# sourceMappingURL=init.d.ts.map \ No newline at end of file diff --git a/dist/src/core/init.d.ts.map b/dist/src/core/init.d.ts.map deleted file mode 100644 index a5b4fa5c..00000000 --- a/dist/src/core/init.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/core/init.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,wBAAgB,IAAI,SAsEnB"} \ No newline at end of file diff --git a/dist/src/core/mark/area.d.ts b/dist/src/core/mark/area.d.ts deleted file mode 100644 index b401ad76..00000000 --- a/dist/src/core/mark/area.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { Tile } from '@gosling-lang/gosling-track'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -/** - * Draw area marks - */ -export declare function drawArea(HGC: import('@higlass/types').HGC, track: any, tile: Tile, model: GoslingTrackModel): void; -//# sourceMappingURL=area.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/area.d.ts.map b/dist/src/core/mark/area.d.ts.map deleted file mode 100644 index bd91d6a2..00000000 --- a/dist/src/core/mark/area.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"area.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/area.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAKxF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QAmS3G"} \ No newline at end of file diff --git a/dist/src/core/mark/axis.d.ts b/dist/src/core/mark/axis.d.ts deleted file mode 100644 index ffaf8ebe..00000000 --- a/dist/src/core/mark/axis.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { Tile } from '@gosling-lang/gosling-track'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { CompleteThemeDeep } from '../utils/theme'; -/** - * Draw linear scale Y axis - */ -export declare function drawLinearYAxis(HGC: { - libraries: { - PIXI: typeof import('pixi.js'); - }; -}, trackInfo: any, _tile: unknown, model: GoslingTrackModel, theme: Required): void; -/** - * Draw linear scale Y axis - */ -export declare function drawCircularYAxis(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel, theme: Required): void; -//# sourceMappingURL=axis.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/axis.d.ts.map b/dist/src/core/mark/axis.d.ts.map deleted file mode 100644 index 9b0c1be0..00000000 --- a/dist/src/core/mark/axis.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/axis.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAQxD;;GAEG;AACH,wBAAgB,eAAe,CAC3B,GAAG,EAAE;IAAE,SAAS,EAAE;QAAE,IAAI,EAAE,cAAc,SAAS,CAAC,CAAA;KAAE,CAAA;CAAE,EACtD,SAAS,EAAE,GAAG,EACd,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QA6HrC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EACjC,SAAS,EAAE,GAAG,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAoMrC"} \ No newline at end of file diff --git a/dist/src/core/mark/background.d.ts b/dist/src/core/mark/background.d.ts deleted file mode 100644 index 1224a311..00000000 --- a/dist/src/core/mark/background.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { CompleteThemeDeep } from '../utils/theme'; -export declare function drawBackground(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; -//# sourceMappingURL=background.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/background.d.ts.map b/dist/src/core/mark/background.d.ts.map deleted file mode 100644 index 69d60a1c..00000000 --- a/dist/src/core/mark/background.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/background.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,wBAAgB,cAAc,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QA4DvG"} \ No newline at end of file diff --git a/dist/src/core/mark/bar.d.ts b/dist/src/core/mark/bar.d.ts deleted file mode 100644 index d2e0da25..00000000 --- a/dist/src/core/mark/bar.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Tile } from '@gosling-lang/gosling-track'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { PIXIVisualProperty } from '../visual-property.schema'; -export declare function drawBar(track: any, tile: Tile, model: GoslingTrackModel): void; -export declare function barProperty(gm: GoslingTrackModel, propertyKey: PIXIVisualProperty, datum?: { - [k: string]: string | number; -}, additionalInfo?: { - tileUnitWidth?: number; - markWidth?: number; -}): any; -//# sourceMappingURL=bar.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/bar.d.ts.map b/dist/src/core/mark/bar.d.ts.map deleted file mode 100644 index 6b895c21..00000000 --- a/dist/src/core/mark/bar.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/bar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAExF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAKpE,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QAqNvE;AAED,wBAAgB,WAAW,CACvB,EAAE,EAAE,iBAAiB,EACrB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,CAAC,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,EACxC,cAAc,CAAC,EAAE;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,OAiBJ"} \ No newline at end of file diff --git a/dist/src/core/mark/betweenLink.d.ts b/dist/src/core/mark/betweenLink.d.ts deleted file mode 100644 index 996fa687..00000000 --- a/dist/src/core/mark/betweenLink.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type * as PIXI from 'pixi.js'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -export declare function drawBetweenLink(g: PIXI.Graphics, trackInfo: any, model: GoslingTrackModel): void; -//# sourceMappingURL=betweenLink.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/betweenLink.d.ts.map b/dist/src/core/mark/betweenLink.d.ts.map deleted file mode 100644 index fb525521..00000000 --- a/dist/src/core/mark/betweenLink.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"betweenLink.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/betweenLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAOxF,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,QAiOzF"} \ No newline at end of file diff --git a/dist/src/core/mark/grid.d.ts b/dist/src/core/mark/grid.d.ts deleted file mode 100644 index 5ce1963e..00000000 --- a/dist/src/core/mark/grid.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { CompleteThemeDeep } from '../utils/theme'; -export declare function drawGrid(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; -export declare function drawRowGrid(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; -export declare function drawYGridQuantitative(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; -//# sourceMappingURL=grid.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/grid.d.ts.map b/dist/src/core/mark/grid.d.ts.map deleted file mode 100644 index 6a6a843f..00000000 --- a/dist/src/core/mark/grid.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/grid.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAKxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,wBAAgB,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAGjG;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAgFpG;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAgH9G"} \ No newline at end of file diff --git a/dist/src/core/mark/index.d.ts b/dist/src/core/mark/index.d.ts deleted file mode 100644 index 1a1c12a3..00000000 --- a/dist/src/core/mark/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { Tile } from '@gosling-lang/gosling-track'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { ChannelTypes } from '@gosling-lang/gosling-schema'; -import type { CompleteThemeDeep } from '../utils/theme'; -/** - * Visual channels currently supported for visual encoding. - */ -export declare const SUPPORTED_CHANNELS: (keyof typeof ChannelTypes)[]; -export declare const RESOLUTION = 4; -/** - * Draw a track based on the track specification in a Gosling grammar. - */ -export declare function drawMark(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel): void; -/** - * Draw chart embellishments before rendering marks. - */ -export declare function drawPreEmbellishment(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel, theme: Required): void; -/** - * Draw chart embellishments after rendering marks. - */ -export declare function drawPostEmbellishment(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel, theme: Required): void; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/index.d.ts.map b/dist/src/core/mark/index.d.ts.map deleted file mode 100644 index de7ecc99..00000000 --- a/dist/src/core/mark/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAMxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAYjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,CAAC,MAAM,OAAO,YAAY,CAAC,EAmB3D,CAAC;AAEF,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QAmE/G;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAChC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EACjC,SAAS,EAAE,GAAG,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAyBrC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACjC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EACjC,SAAS,EAAE,GAAG,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QA0BrC"} \ No newline at end of file diff --git a/dist/src/core/mark/legend.d.ts b/dist/src/core/mark/legend.d.ts deleted file mode 100644 index 0de18b8d..00000000 --- a/dist/src/core/mark/legend.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { CompleteThemeDeep } from '../utils/theme'; -type Libraries = Pick; -type LegendOffset = { - offsetRight: number; -}; -export declare function drawColorLegend(HGC: { - libraries: Libraries; -}, trackInfo: any, _tile: unknown, model: GoslingTrackModel, theme: Required): void; -export declare function drawColorLegendQuantitative(HGC: { - libraries: Libraries; -}, trackInfo: any, _tile: unknown, model: GoslingTrackModel, theme: Required, channelKey: 'color' | 'stroke', offset: LegendOffset): void; -export declare function drawColorLegendCategories(HGC: { - libraries: Libraries; -}, track: any, _tile: unknown, tm: GoslingTrackModel, theme: Required): void; -export declare function drawRowLegend(HGC: { - libraries: Libraries; -}, trackInfo: any, _tile: unknown, tm: GoslingTrackModel, theme: Required): void; -export {}; -//# sourceMappingURL=legend.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/legend.d.ts.map b/dist/src/core/mark/legend.d.ts.map deleted file mode 100644 index 9f319f7a..00000000 --- a/dist/src/core/mark/legend.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/legend.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAOxD,KAAK,SAAS,GAAG,IAAI,CAAC,cAAc,oBAAoB,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAC;AAE9F,KAAK,YAAY,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5C,wBAAgB,eAAe,CAC3B,GAAG,EAAE;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,EAC7B,SAAS,EAAE,GAAG,EACd,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QA8BrC;AAED,wBAAgB,2BAA2B,CACvC,GAAG,EAAE;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,EAC7B,SAAS,EAAE,GAAG,EACd,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAClC,UAAU,EAAE,OAAO,GAAG,QAAQ,EAC9B,MAAM,EAAE,YAAY,QAuOvB;AAED,wBAAgB,yBAAyB,CACrC,GAAG,EAAE;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,EAC7B,KAAK,EAAE,GAAG,EACV,KAAK,EAAE,OAAO,EACd,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAmKrC;AAED,wBAAgB,aAAa,CACzB,GAAG,EAAE;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,EAC7B,SAAS,EAAE,GAAG,EACd,KAAK,EAAE,OAAO,EACd,EAAE,EAAE,iBAAiB,EACrB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAmErC"} \ No newline at end of file diff --git a/dist/src/core/mark/line.d.ts b/dist/src/core/mark/line.d.ts deleted file mode 100644 index 43740dd5..00000000 --- a/dist/src/core/mark/line.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type * as PIXI from 'pixi.js'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -export declare function drawLine(g: PIXI.Graphics, model: GoslingTrackModel, trackWidth: number, trackHeight: number): void; -//# sourceMappingURL=line.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/line.d.ts.map b/dist/src/core/mark/line.d.ts.map deleted file mode 100644 index fdce93ab..00000000 --- a/dist/src/core/mark/line.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/line.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAMxF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QA6F3G"} \ No newline at end of file diff --git a/dist/src/core/mark/outline-circular.d.ts b/dist/src/core/mark/outline-circular.d.ts deleted file mode 100644 index 163bf6f1..00000000 --- a/dist/src/core/mark/outline-circular.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { CompleteThemeDeep } from '../utils/theme'; -export declare function drawCircularOutlines(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; -//# sourceMappingURL=outline-circular.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/outline-circular.d.ts.map b/dist/src/core/mark/outline-circular.d.ts.map deleted file mode 100644 index e405e297..00000000 --- a/dist/src/core/mark/outline-circular.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"outline-circular.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/outline-circular.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAIxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QA2F7G"} \ No newline at end of file diff --git a/dist/src/core/mark/outline.d.ts b/dist/src/core/mark/outline.d.ts deleted file mode 100644 index 751a9724..00000000 --- a/dist/src/core/mark/outline.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { CompleteThemeDeep } from '../utils/theme'; -export declare const TITLE_STYLE: { - fontSize: string; - fontFamily: string; - fontWeight: string; - fill: string; - background: string; - lineJoin: string; -}; -export declare function drawChartOutlines(trackInfo: any, tm: GoslingTrackModel, theme: Required): void; -//# sourceMappingURL=outline.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/outline.d.ts.map b/dist/src/core/mark/outline.d.ts.map deleted file mode 100644 index f84e0441..00000000 --- a/dist/src/core/mark/outline.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"outline.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/outline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAwE1G"} \ No newline at end of file diff --git a/dist/src/core/mark/point.d.ts b/dist/src/core/mark/point.d.ts deleted file mode 100644 index 06ebac14..00000000 --- a/dist/src/core/mark/point.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type * as PIXI from 'pixi.js'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { PIXIVisualProperty } from '../visual-property.schema'; -export declare function drawPoint(track: any, g: PIXI.Graphics, model: GoslingTrackModel): void; -export declare function pointProperty(model: GoslingTrackModel, propertyKey: PIXIVisualProperty, datum?: { - [k: string]: string | number; -}): any; -//# sourceMappingURL=point.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/point.d.ts.map b/dist/src/core/mark/point.d.ts.map deleted file mode 100644 index fa2c556a..00000000 --- a/dist/src/core/mark/point.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/point.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAKxF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,iBAAiB,QAiF/E;AAED,wBAAgB,aAAa,CACzB,KAAK,EAAE,iBAAiB,EACxB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,CAAC,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,OAoB3C"} \ No newline at end of file diff --git a/dist/src/core/mark/rect.d.ts b/dist/src/core/mark/rect.d.ts deleted file mode 100644 index 200d982d..00000000 --- a/dist/src/core/mark/rect.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Tile } from '@gosling-lang/gosling-track'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { PIXIVisualProperty } from '../visual-property.schema'; -export declare function drawRect(HGC: import('@higlass/types').HGC, track: any, tile: Tile, model: GoslingTrackModel): void; -export declare function rectProperty(gm: GoslingTrackModel, propertyKey: PIXIVisualProperty, datum?: { - [k: string]: string | number; -}, additionalInfo?: { - markHeight?: number; - markWidth?: number; -}): any; -//# sourceMappingURL=rect.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/rect.d.ts.map b/dist/src/core/mark/rect.d.ts.map deleted file mode 100644 index 7efc1e84..00000000 --- a/dist/src/core/mark/rect.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/rect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAExF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAIpE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QAwH3G;AAED,wBAAgB,YAAY,CACxB,EAAE,EAAE,iBAAiB,EACrB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,CAAC,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,EACxC,cAAc,CAAC,EAAE;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,OAqBJ"} \ No newline at end of file diff --git a/dist/src/core/mark/rule.d.ts b/dist/src/core/mark/rule.d.ts deleted file mode 100644 index 2c6c9c4f..00000000 --- a/dist/src/core/mark/rule.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { Tile } from '@gosling-lang/gosling-track'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -export declare function drawRule(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel): void; -//# sourceMappingURL=rule.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/rule.d.ts.map b/dist/src/core/mark/rule.d.ts.map deleted file mode 100644 index 302134ae..00000000 --- a/dist/src/core/mark/rule.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAKxF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QAqN/G"} \ No newline at end of file diff --git a/dist/src/core/mark/text.d.ts b/dist/src/core/mark/text.d.ts deleted file mode 100644 index 22545966..00000000 --- a/dist/src/core/mark/text.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Tile } from '@gosling-lang/gosling-track'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -export declare const TEXT_STYLE_GLOBAL: { - readonly fontSize: "12px"; - readonly fontFamily: "sans-serif"; - readonly fontWeight: "normal"; - readonly fill: "black"; - readonly background: "white"; - readonly lineJoin: "round"; - readonly stroke: "#ffffff"; - readonly strokeThickness: 0; -}; -export declare function drawText(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel): void; -//# sourceMappingURL=text.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/text.d.ts.map b/dist/src/core/mark/text.d.ts.map deleted file mode 100644 index 615683b4..00000000 --- a/dist/src/core/mark/text.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAMxF,eAAO,MAAM,iBAAiB;;;;;;;;;CASpB,CAAC;AAEX,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,QA8S/G"} \ No newline at end of file diff --git a/dist/src/core/mark/title.d.ts b/dist/src/core/mark/title.d.ts deleted file mode 100644 index d7f335a6..00000000 --- a/dist/src/core/mark/title.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { Tile } from '@gosling-lang/gosling-track'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { CompleteThemeDeep } from '../utils/theme'; -export declare function drawCircularTitle(HGC: import('@higlass/types').HGC, trackInfo: any, tile: Tile, model: GoslingTrackModel, theme: Required): void; -//# sourceMappingURL=title.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/title.d.ts.map b/dist/src/core/mark/title.d.ts.map deleted file mode 100644 index 570d7737..00000000 --- a/dist/src/core/mark/title.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/title.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,wBAAgB,iBAAiB,CAC7B,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EACjC,SAAS,EAAE,GAAG,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,QAgFrC"} \ No newline at end of file diff --git a/dist/src/core/mark/triangle.d.ts b/dist/src/core/mark/triangle.d.ts deleted file mode 100644 index da239f4d..00000000 --- a/dist/src/core/mark/triangle.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type * as PIXI from 'pixi.js'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -export declare function drawTriangle(g: PIXI.Graphics, model: GoslingTrackModel, trackWidth: number, trackHeight: number): void; -//# sourceMappingURL=triangle.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/triangle.d.ts.map b/dist/src/core/mark/triangle.d.ts.map deleted file mode 100644 index 549517b3..00000000 --- a/dist/src/core/mark/triangle.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"triangle.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/triangle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAMxF,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAuJ/G"} \ No newline at end of file diff --git a/dist/src/core/mark/withinLink.d.ts b/dist/src/core/mark/withinLink.d.ts deleted file mode 100644 index eb4497d9..00000000 --- a/dist/src/core/mark/withinLink.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type * as PIXI from 'pixi.js'; -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -export declare function drawWithinLink(g: PIXI.Graphics, trackInfo: any, model: GoslingTrackModel): void; -//# sourceMappingURL=withinLink.d.ts.map \ No newline at end of file diff --git a/dist/src/core/mark/withinLink.d.ts.map b/dist/src/core/mark/withinLink.d.ts.map deleted file mode 100644 index 1cf14fd6..00000000 --- a/dist/src/core/mark/withinLink.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"withinLink.d.ts","sourceRoot":"","sources":["../../../../src/core/mark/withinLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAOxF,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,QA+WxF"} \ No newline at end of file diff --git a/dist/src/core/utils/array.d.ts b/dist/src/core/utils/array.d.ts deleted file mode 100644 index cbffc43c..00000000 --- a/dist/src/core/utils/array.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Repeat elements in the array until its size becomes to `targetLength`. - */ -export declare function arrayRepeat(base: T[], targetLength: number): T[]; -/** - * Insert item to an array and return it. - * @param array Array to be updated. - * @param index Index of array to insert new item. - * @param item Item to be inserted. - * @returns Updated array. - */ -export declare function insertItemToArray(array: T[], index: number, item: T): T[]; -/** - * Insert item to an array and return it. - * @param array Array to be updated. - * @param index Index of array to change item. - * @param item Item to be inserted. - * @returns Updated array. - */ -export declare function modifyItemInArray(array: T[], index: number, item: T): T[]; -/** - * Remove item from an array stored in a certain index. - * @param array Array to be updated. - * @param index Index of an item to be removed. - * @returns Updated array. - */ -export declare function removeItemFromArray(array: T[], index: number): T[]; -/** - * Convert 1D array into 2D array where each pair of elements are grouped. - * @param array Array to be used. - * @returns Updated array. - */ -export declare function flatArrayToPairArray(array: T[]): [T, T][]; -/** - * Check if all elements in an array satisfy a type guard. - * @param array Array to check - * @param is Type guard to check each element - */ -export declare function isEvery(array: any[], is: (x: Arr[number]) => x is T): array is T[]; -/** Check if all elements in an array are numbers. */ -export declare function isNumberArray(array: any[]): array is number[]; -/** Check if all elements in an array are strings. */ -export declare function isStringArray(array: any[]): array is string[]; -//# sourceMappingURL=array.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/array.d.ts.map b/dist/src/core/utils/array.d.ts.map deleted file mode 100644 index ed7536c3..00000000 --- a/dist/src/core/utils/array.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/array.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC,EAAE,CAUnE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAE5E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAE5E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE,CAErE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAM5D;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,SAAS,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,EAAE,CAExG;AAED,qDAAqD;AACrD,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,MAAM,EAAE,CAE7D;AAED,qDAAqD;AACrD,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,MAAM,EAAE,CAE7D"} \ No newline at end of file diff --git a/dist/src/core/utils/assembly.d.ts b/dist/src/core/utils/assembly.d.ts deleted file mode 100644 index ac28051d..00000000 --- a/dist/src/core/utils/assembly.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -import type { Assembly, GenomicPosition } from '@gosling-lang/gosling-schema'; -export interface ChromSize { - size: { - [chr: string]: number; - }; - interval: { - [chr: string]: [number, number]; - }; - total: number; - path: string; -} -/** - * Get relative chromosome position (e.g., `100` => `{ chromosome: 'chr1', position: 100 }`) - * @param absPos number which is the absolute chromosome position - * @param assembly the assembly used to calculate which chromosome position - * @param returnWithinAssembly If true, then if the absolute position is before the first chromosome, it returns the - * first position of the first chromosome. If the absolute position is after the last chromosome, it returns the last - * position of the last chromosome - * @returns the genomic position of the absPos - */ -export declare function getRelativeGenomicPosition(absPos: number, assembly?: Assembly, returnWithinAssembly?: boolean): GenomicPosition; -/** - * Get chromosome sizes. - * @param assembly (default: 'hg38') - */ -export declare function computeChromSizes(assembly?: Assembly): ChromSize; -/** - * Some presets of auto-complete IDs (`autocompleteId`) to search for genes using the HiGlass server. - */ -export declare function getAutoCompleteId(assembly?: Assembly): "OHJakQICQD6gTD7skx4EWA" | "QDutvmyiSrec5nX4pA5WGQ" | "GUm5aBiLRCyz2PsBea7Yzg" | "P0PLbQMwTYGy-5uPIQid7A"; -/** - * Calculate cumulative interval of each chromosome. - */ -export declare function getChromInterval(chromSize: { - [k: string]: number; -}): { - [k: string]: [number, number]; -}; -/** - * Calculate total size of entire chromosomes. - */ -export declare function getChromTotalSize(chromSize: { - [k: string]: number; -}): number; -export declare function parseGenomicPosition(position: string): { - chromosome: string; - start?: number; - end?: number; -}; -/** - * A class that consistently manage and convert genomics positions. - */ -export declare class GenomicPositionHelper { - chromosome: string; - start?: number | undefined; - end?: number | undefined; - constructor(chromosome: string, start?: number | undefined, end?: number | undefined); - static fromString(str: string): GenomicPositionHelper; - toAbsoluteCoordinates(assembly?: Assembly, padding?: number): [number, number]; -} -//# sourceMappingURL=assembly.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/assembly.d.ts.map b/dist/src/core/utils/assembly.d.ts.map deleted file mode 100644 index f80c1692..00000000 --- a/dist/src/core/utils/assembly.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"assembly.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/assembly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAc,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAW1F,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAChC,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACtC,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,QAAQ,EACnB,oBAAoB,UAAQ,GAC7B,eAAe,CA+BjB;AAYD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAgBhE;AAuDD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,QAAQ,6GAYpD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE;;EASlE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,UAEnE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAU3G;AAED;;GAEG;AACH,qBAAa,qBAAqB;IACX,UAAU,EAAE,MAAM;IAAS,KAAK,CAAC;IAAiB,GAAG,CAAC;gBAAtD,UAAU,EAAE,MAAM,EAAS,KAAK,CAAC,oBAAQ,EAAS,GAAG,CAAC,oBAAQ;IACjF,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,qBAAqB,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,SAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CAe5E"} \ No newline at end of file diff --git a/dist/src/core/utils/chrom-size.d.ts b/dist/src/core/utils/chrom-size.d.ts deleted file mode 100644 index 2b043939..00000000 --- a/dist/src/core/utils/chrom-size.d.ts +++ /dev/null @@ -1,184 +0,0 @@ -export declare const CHROM_SIZE_HG38: { - chr1: number; - chr2: number; - chr3: number; - chr4: number; - chr5: number; - chr6: number; - chr7: number; - chr8: number; - chr9: number; - chr10: number; - chr11: number; - chr12: number; - chr13: number; - chr14: number; - chr15: number; - chr16: number; - chr17: number; - chr18: number; - chr19: number; - chr20: number; - chr21: number; - chr22: number; - chrX: number; - chrY: number; -}; -export declare const CHROM_SIZE_HG19: { - chr1: number; - chr2: number; - chr3: number; - chr4: number; - chr5: number; - chr6: number; - chr7: number; - chr8: number; - chr9: number; - chr10: number; - chr11: number; - chr12: number; - chr13: number; - chr14: number; - chr15: number; - chr16: number; - chr17: number; - chr18: number; - chr19: number; - chr20: number; - chr21: number; - chr22: number; - chrX: number; - chrY: number; - chrM: number; -}; -export declare const CHROM_SIZE_HG18: { - chr1: number; - chr2: number; - chr3: number; - chr4: number; - chr5: number; - chr6: number; - chr7: number; - chr8: number; - chr9: number; - chr10: number; - chr11: number; - chr12: number; - chr13: number; - chr14: number; - chr15: number; - chr16: number; - chr17: number; - chr18: number; - chr19: number; - chr20: number; - chr21: number; - chr22: number; - chrX: number; - chrY: number; - chrM: number; -}; -export declare const CHROM_SIZE_HG17: { - chr1: number; - chr2: number; - chr3: number; - chr4: number; - chr5: number; - chr6: number; - chr7: number; - chr8: number; - chr9: number; - chr10: number; - chr11: number; - chr12: number; - chr13: number; - chr14: number; - chr15: number; - chr16: number; - chr17: number; - chr18: number; - chr19: number; - chr20: number; - chr21: number; - chr22: number; - chrX: number; - chrY: number; - chrM: number; -}; -export declare const CHROM_SIZE_HG16: { - chr1: number; - chr2: number; - chr3: number; - chr4: number; - chr5: number; - chr6: number; - chr7: number; - chr8: number; - chr9: number; - chr10: number; - chr11: number; - chr12: number; - chr13: number; - chr14: number; - chr15: number; - chr16: number; - chr17: number; - chr18: number; - chr19: number; - chr20: number; - chr21: number; - chr22: number; - chrX: number; - chrY: number; - chrM: number; -}; -export declare const CHROM_SIZE_MM10: { - chr1: number; - chr2: number; - chr3: number; - chr4: number; - chr5: number; - chr6: number; - chr7: number; - chr8: number; - chr9: number; - chr10: number; - chr11: number; - chr12: number; - chr13: number; - chr14: number; - chr15: number; - chr16: number; - chr17: number; - chr18: number; - chr19: number; - chrX: number; - chrY: number; - chrM: number; -}; -export declare const CHROM_SIZE_MM9: { - chr1: number; - chr2: number; - chr3: number; - chr4: number; - chr5: number; - chr6: number; - chr7: number; - chr8: number; - chr9: number; - chr10: number; - chr11: number; - chr12: number; - chr13: number; - chr14: number; - chr15: number; - chr16: number; - chr17: number; - chr18: number; - chr19: number; - chrX: number; - chrY: number; - chrM: number; -}; -export type Chromosome = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19' | '20' | '21' | '22' | 'X' | 'Y' | 'M' | 'chr1' | 'chr2' | 'chr3' | 'chr4' | 'chr5' | 'chr6' | 'chr7' | 'chr8' | 'chr9' | 'chr10' | 'chr11' | 'chr12' | 'chr13' | 'chr14' | 'chr15' | 'chr16' | 'chr17' | 'chr18' | 'chr19' | 'chr20' | 'chr21' | 'chr22' | 'chrX' | 'chrY' | 'chrM'; -//# sourceMappingURL=chrom-size.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/chrom-size.d.ts.map b/dist/src/core/utils/chrom-size.d.ts.map deleted file mode 100644 index 9235c872..00000000 --- a/dist/src/core/utils/chrom-size.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"chrom-size.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/chrom-size.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;CAyB3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;CAuB3B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;CAuB1B,CAAC;AAEF,MAAM,MAAM,UAAU,GAChB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,GAAG,GACH,GAAG,GACH,GAAG,GACH,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,GACN,MAAM,CAAC"} \ No newline at end of file diff --git a/dist/src/core/utils/color-to-hex.d.ts b/dist/src/core/utils/color-to-hex.d.ts deleted file mode 100644 index 9819781a..00000000 --- a/dist/src/core/utils/color-to-hex.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Convert a regular color value (e.g. 'red', '#FF0000', 'rgb(255,0,0)') to a hex value which is legible by PIXI. - */ -declare const colorToHex: (colorStr: string) => number; -export default colorToHex; -//# sourceMappingURL=color-to-hex.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/color-to-hex.d.ts.map b/dist/src/core/utils/color-to-hex.d.ts.map deleted file mode 100644 index 9675e779..00000000 --- a/dist/src/core/utils/color-to-hex.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"color-to-hex.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/color-to-hex.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,QAAA,MAAM,UAAU,aAAc,MAAM,WASnC,CAAC;AAEF,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/src/core/utils/data-transform.d.ts b/dist/src/core/utils/data-transform.d.ts deleted file mode 100644 index df5eddc3..00000000 --- a/dist/src/core/utils/data-transform.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type * as d3 from 'd3'; -import type { SingleTrack, Datum, FilterTransform, LogTransform, ExonSplitTransform, Assembly, StrConcatTransform, StrReplaceTransform, GenomicLengthTransform, SvTypeTransform, CoverageTransform, DisplaceTransform, JsonParseTransform } from '@gosling-lang/gosling-schema'; -/** - * Apply filter - */ -export declare function filterData(filter: FilterTransform, data: Datum[]): Datum[]; -/** - * Calculate new data, like log transformation. - */ -export declare function concatString(concat: StrConcatTransform, data: Datum[]): Datum[]; -export declare function replaceString(_: StrReplaceTransform, data: Datum[]): Datum[]; -/** - * Calculate new data, like log transformation. - */ -export declare function calculateData(log: LogTransform, data: Datum[]): Datum[]; -/** - * Calculate genomic length using two genomic fields. - */ -export declare function calculateGenomicLength(_: GenomicLengthTransform, data: Datum[]): Datum[]; -export declare function inferSvType(_: SvTypeTransform, data: Datum[]): Datum[]; -/** - * Aggregate data rows and calculate coverage of reads. - */ -export declare function aggregateCoverage(_: CoverageTransform, data: Datum[], scale: d3.ScaleContinuousNumeric): Datum[]; -/** - * Mark displacement transform furnctions. - * @param t An object that contains data transformation spec. - * @param data An array of objects that contain data. - * @param scale A d3's linear scale that map between data-level values to screen-level values (px). - * @returns - */ -export declare function displace(t: DisplaceTransform, data: Datum[], scale: d3.ScaleContinuousNumeric): Datum[]; -export declare function splitExon(split: ExonSplitTransform, data: Datum[], assembly?: Assembly): Datum[]; -export declare function parseSubJSON(_: JsonParseTransform, data: Datum[]): Datum[]; -/** - * Experimental! Only support one category supported yet. - */ -export declare function aggregateData(spec: SingleTrack, data: Datum[]): Datum[]; -//# sourceMappingURL=data-transform.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/data-transform.d.ts.map b/dist/src/core/utils/data-transform.d.ts.map deleted file mode 100644 index 692699f9..00000000 --- a/dist/src/core/utils/data-transform.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/data-transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,KAAK,EACR,WAAW,EACX,KAAK,EACL,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACR,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EACrB,MAAM,8BAA8B,CAAC;AAYtC;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAsB1E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAU/E;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAa5E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAevE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAcxF;AAKD,wBAAgB,WAAW,CAAC,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CA+CtE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,CAAC,EAAE,iBAAiB,EACpB,IAAI,EAAE,KAAK,EAAE,EACb,KAAK,EAAE,EAAE,CAAC,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,GACjD,KAAK,EAAE,CA0CT;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACpB,CAAC,EAAE,iBAAiB,EACpB,IAAI,EAAE,KAAK,EAAE,EACb,KAAK,EAAE,EAAE,CAAC,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,GACjD,KAAK,EAAE,CA2GT;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,QAAQ,GAAE,QAAiB,GAAG,KAAK,EAAE,CA+BxG;AAGD,wBAAgB,YAAY,CAAC,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CA0B1E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CA+DvE"} \ No newline at end of file diff --git a/dist/src/core/utils/define-plugin-track.d.ts b/dist/src/core/utils/define-plugin-track.d.ts deleted file mode 100644 index 353fdcb9..00000000 --- a/dist/src/core/utils/define-plugin-track.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type * as HiGlass from '@higlass/types'; -export type PluginTrackFactory = (HGC: HiGlass.HGC, context: HiGlass.Context, options: Options) => HiGlass.Track; -export type TrackConfig = Omit, 'availableOptions'>; -export declare function createPluginTrack(config: TrackConfig, factory: PluginTrackFactory): (new (HGC: HiGlass.HGC, context: HiGlass.Context, options: Options) => HiGlass.Track) & { - config: HiGlass.TrackConfig; -} & { - config: { - availableOptions: (keyof Options)[]; - }; -}; -//# sourceMappingURL=define-plugin-track.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/define-plugin-track.d.ts.map b/dist/src/core/utils/define-plugin-track.d.ts.map deleted file mode 100644 index 8ba55b55..00000000 --- a/dist/src/core/utils/define-plugin-track.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"define-plugin-track.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/define-plugin-track.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,kBAAkB,CAAC,IAAI,EAAE,OAAO,IAAI,CAC5C,GAAG,EAAE,OAAO,CAAC,GAAG,EAChB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EACvC,OAAO,EAAE,OAAO,KACf,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAQ5B,MAAM,MAAM,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAE1F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAC3C,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,EAC5B,OAAO,EAAE,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC;;;YAa9B;QAEJ,gBAAgB,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC;KACvC;EAER"} \ No newline at end of file diff --git a/dist/src/core/utils/higlass-zoom-config.d.ts b/dist/src/core/utils/higlass-zoom-config.d.ts deleted file mode 100644 index a4ecc28f..00000000 --- a/dist/src/core/utils/higlass-zoom-config.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { HiGlassSpec } from '@gosling-lang/higlass-schema'; -/** - * This makes sure that all the current zooming status is preserved when new tracks are added - */ -export declare const preverseZoomStatus: (newSpec: HiGlassSpec, prevSpec: HiGlassSpec) => void; -//# sourceMappingURL=higlass-zoom-config.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/higlass-zoom-config.d.ts.map b/dist/src/core/utils/higlass-zoom-config.d.ts.map deleted file mode 100644 index 669589aa..00000000 --- a/dist/src/core/utils/higlass-zoom-config.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"higlass-zoom-config.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/higlass-zoom-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,kBAAkB,YAAa,WAAW,YAAY,WAAW,SAmB7E,CAAC"} \ No newline at end of file diff --git a/dist/src/core/utils/index.d.ts b/dist/src/core/utils/index.d.ts deleted file mode 100644 index 3612e4ed..00000000 --- a/dist/src/core/utils/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare function validTilesetUrl(url: string): boolean; -export declare function parseServerAndTilesetUidFromUrl(url: string): { - server: undefined; - tilesetUid: undefined; -} | { - server: string; - tilesetUid: string; -}; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/index.d.ts.map b/dist/src/core/utils/index.d.ts.map deleted file mode 100644 index e24ee89f..00000000 --- a/dist/src/core/utils/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,WAK1C;AAED,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,MAAM;;;;;;EAU1D"} \ No newline at end of file diff --git a/dist/src/core/utils/linking.d.ts b/dist/src/core/utils/linking.d.ts deleted file mode 100644 index 9a181d84..00000000 --- a/dist/src/core/utils/linking.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { HiGlassModel } from '../../compiler/higlass-model'; -/** - * - */ -export declare function getLinkingInfo(hgModel: HiGlassModel): { - layout: 'circular' | 'linear'; - hgViewId: string; - linkId: string; - isBrush: boolean; - style: any; -}[]; -//# sourceMappingURL=linking.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/linking.d.ts.map b/dist/src/core/utils/linking.d.ts.map deleted file mode 100644 index 78756cab..00000000 --- a/dist/src/core/utils/linking.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/linking.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAIjE;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY;YAEpC,UAAU,GAAG,QAAQ;cACnB,MAAM;YACR,MAAM;aACL,OAAO;WACT,GAAG;IAkDjB"} \ No newline at end of file diff --git a/dist/src/core/utils/omit-deep.d.ts b/dist/src/core/utils/omit-deep.d.ts deleted file mode 100644 index 6521f736..00000000 --- a/dist/src/core/utils/omit-deep.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { GoslingSpec } from '@gosling-lang/gosling-schema'; -export declare function omitDeep(spec: GoslingSpec, omitKeys: string[]): any; -//# sourceMappingURL=omit-deep.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/omit-deep.d.ts.map b/dist/src/core/utils/omit-deep.d.ts.map deleted file mode 100644 index 3faba406..00000000 --- a/dist/src/core/utils/omit-deep.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"omit-deep.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/omit-deep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAIhE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,OAQ7D"} \ No newline at end of file diff --git a/dist/src/core/utils/overlay.d.ts b/dist/src/core/utils/overlay.d.ts deleted file mode 100644 index 23d5ffce..00000000 --- a/dist/src/core/utils/overlay.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { SingleTrack, Track, DataDeep } from '@gosling-lang/gosling-schema'; -/** - * Resolve superposed tracks into multiple track specifications. - * Some options are corrected to ensure the resolved tracks use consistent visual properties, such as the existence of the axis for genomic coordinates. - */ -export declare function resolveSuperposedTracks(track: Track): SingleTrack[]; -/** - * Spread overlaid tracks if they are assigned to different data/metadata. - * This process is necessary since we are passing over each track to HiGlass, and if a single track is mapped to multiple datastes, HiGlass cannot handle that. - */ -export declare function spreadTracksByData(tracks: Track[]): Track[]; -export declare function isIdenticalDataSpec(specs: (DataDeep | undefined)[]): boolean; -//# sourceMappingURL=overlay.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/overlay.d.ts.map b/dist/src/core/utils/overlay.d.ts.map deleted file mode 100644 index 5ae027a0..00000000 --- a/dist/src/core/utils/overlay.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/overlay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAER,WAAW,EAEX,KAAK,EAEL,QAAQ,EACX,MAAM,8BAA8B,CAAC;AAGtC;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,EAAE,CAiDnE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAgE3D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,CAAC,QAAQ,GAAG,SAAS,CAAC,EAAE,GAAG,OAAO,CAsB5E"} \ No newline at end of file diff --git a/dist/src/core/utils/polar.d.ts b/dist/src/core/utils/polar.d.ts deleted file mode 100644 index 2b73d015..00000000 --- a/dist/src/core/utils/polar.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export declare const RADIAN_GAP = 0; -/** - * Convert a value in a single-linear axis to a radian value. Anticlockwise, starts from 12 o'clock. - * v span from zero to `max`. - */ -export declare function valueToRadian(v: number, max: number, sa: number, ea: number, g?: number): number; -/** - * Convert a position in a cartesian system to a polar coordinate. - */ -export declare function cartesianToPolar(x: number, max: number, r: number, cx: number, cy: number, sa: number, ea: number): { - x: number; - y: number; -}; -export declare function positionToRadian(x: number, y: number, cx: number, cy: number): number; -/** - * Calculate a degree in the range of [0, 360) based on two points. Anticlockwise, starts from 12 o'clock. - */ -export declare function pointsToDegree(x: number, y: number, cx: number, cy: number): number; -//# sourceMappingURL=polar.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/polar.d.ts.map b/dist/src/core/utils/polar.d.ts.map deleted file mode 100644 index 9ae32dfc..00000000 --- a/dist/src/core/utils/polar.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"polar.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/polar.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,UAMvF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;;;EAKjH;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAM5E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAE1E"} \ No newline at end of file diff --git a/dist/src/core/utils/position.d.ts b/dist/src/core/utils/position.d.ts deleted file mode 100644 index fcd4f46b..00000000 --- a/dist/src/core/utils/position.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export interface Dimension { - top: number; - left: number; - width: number; - height: number; -} -export type Padding = SurroundingSize; -export type Margin = SurroundingSize; -export interface SurroundingSize { - top: number; - bottom: number; - left: number; - right: number; -} -export interface Offset { - top: number; - left: number; -} -//# sourceMappingURL=position.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/position.d.ts.map b/dist/src/core/utils/position.d.ts.map deleted file mode 100644 index c5702b8a..00000000 --- a/dist/src/core/utils/position.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/position.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,MAAM,OAAO,GAAG,eAAe,CAAC;AACtC,MAAM,MAAM,MAAM,GAAG,eAAe,CAAC;AACrC,MAAM,WAAW,eAAe;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WAAW,MAAM;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CAChB"} \ No newline at end of file diff --git a/dist/src/core/utils/scales.d.ts b/dist/src/core/utils/scales.d.ts deleted file mode 100644 index d7d8dc7d..00000000 --- a/dist/src/core/utils/scales.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { GoslingTrackModel } from '../../tracks/gosling-track/gosling-track-model'; -import type { Assembly, Domain } from '@gosling-lang/gosling-schema'; -/** - * Get a numeric domain based on a domain specification. - * For example, domain: { chromosome: 'chr1', interval: [1, 300,000] } => domain: [1, 300,000] - */ -export declare function getNumericDomain(domain: Domain, assembly?: Assembly): number[] | undefined; -/** - * Use a shared scale (i.e., `domain`) across multiple gosling tracks. - */ -export declare function shareScaleAcrossTracks(trackModels: GoslingTrackModel[], force?: boolean): void; -//# sourceMappingURL=scales.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/scales.d.ts.map b/dist/src/core/utils/scales.d.ts.map deleted file mode 100644 index c05c31f2..00000000 --- a/dist/src/core/utils/scales.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/scales.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAKrE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,wBAkBnE;AAGD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,iBAAiB,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO,QAwDvF"} \ No newline at end of file diff --git a/dist/src/core/utils/semantic-zoom.d.ts b/dist/src/core/utils/semantic-zoom.d.ts deleted file mode 100644 index 60626af4..00000000 --- a/dist/src/core/utils/semantic-zoom.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { LogicalOperation } from '@gosling-lang/gosling-schema'; -export declare function getMaxZoomLevel(): number; -/** - * Perform logical operation between a target and a reference value. - * If the condition is `true`, return `1`. - */ -export declare function logicalComparison(value: number, op: LogicalOperation, ref: number, transitionPadding?: number): number; -//# sourceMappingURL=semantic-zoom.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/semantic-zoom.d.ts.map b/dist/src/core/utils/semantic-zoom.d.ts.map deleted file mode 100644 index 658d1131..00000000 --- a/dist/src/core/utils/semantic-zoom.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"semantic-zoom.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/semantic-zoom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,wBAAgB,eAAe,WAK9B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,gBAAgB,EACpB,GAAG,EAAE,MAAM,EACX,iBAAiB,CAAC,EAAE,MAAM,GAC3B,MAAM,CA4BR"} \ No newline at end of file diff --git a/dist/src/core/utils/style.d.ts b/dist/src/core/utils/style.d.ts deleted file mode 100644 index 0c778e64..00000000 --- a/dist/src/core/utils/style.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { Style } from '@gosling-lang/gosling-schema'; -export declare function getStyleOverridden(parent: Style | undefined, child: Style | undefined): any; -//# sourceMappingURL=style.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/style.d.ts.map b/dist/src/core/utils/style.d.ts.map deleted file mode 100644 index c3c4ffa2..00000000 --- a/dist/src/core/utils/style.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAE1D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,OAIrF"} \ No newline at end of file diff --git a/dist/src/core/utils/template.d.ts b/dist/src/core/utils/template.d.ts deleted file mode 100644 index e7c8d2fe..00000000 --- a/dist/src/core/utils/template.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { GoslingSpec, TemplateTrackDef } from '@gosling-lang/gosling-schema'; -/** - * Track templates officially supported by Gosling.js. - */ -export declare const GoslingTemplates: TemplateTrackDef[]; -/** - * Replace track templetes to low-level gosling specs. - * @param spec - */ -export declare function replaceTrackTemplates(spec: GoslingSpec, templates: TemplateTrackDef[]): void; -//# sourceMappingURL=template.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/template.d.ts.map b/dist/src/core/utils/template.d.ts.map deleted file mode 100644 index db5ab410..00000000 --- a/dist/src/core/utils/template.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIR,WAAW,EAEX,gBAAgB,EAGnB,MAAM,8BAA8B,CAAC;AAItC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,EAqP9C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,QA0HrF"} \ No newline at end of file diff --git a/dist/src/core/utils/text-style.d.ts b/dist/src/core/utils/text-style.d.ts deleted file mode 100644 index a2f2fd5d..00000000 --- a/dist/src/core/utils/text-style.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export type TextStyle = { - color?: string; - size?: number; - fontFamily?: string; - fontWeight?: 'bold' | 'normal' | 'light'; - stroke?: string; - strokeThickness?: number; -}; -export declare const DEFAULT_TEXT_STYLE: Required; -export declare function getTextStyle(style?: TextStyle): { - fontSize: `${number}px`; - fontFamily: string; - fontWeight: "bold" | "normal" | "lighter"; - fill: string; - lineJoin: "round"; - stroke: string; - strokeThickness: number; -}; -//# sourceMappingURL=text-style.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/text-style.d.ts.map b/dist/src/core/utils/text-style.d.ts.map deleted file mode 100644 index 1f51438c..00000000 --- a/dist/src/core/utils/text-style.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"text-style.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/text-style.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,SAAS,CAOlD,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,GAAE,SAAc;;;;;;;;EAgBjD"} \ No newline at end of file diff --git a/dist/src/core/utils/theme.d.ts b/dist/src/core/utils/theme.d.ts deleted file mode 100644 index bfad90f5..00000000 --- a/dist/src/core/utils/theme.d.ts +++ /dev/null @@ -1,115 +0,0 @@ -export type Theme = ThemeType | ThemeDeep; -export type ThemeType = 'light' | 'dark' | 'warm' | 'ggplot' | 'igv' | 'ensembl' | 'jbrowse' | 'ucsc' | 'washu' | 'excel' | 'google'; -export interface ThemeDeep { - base: ThemeType; - root?: RootStyle; - track?: TrackStyle; - legend?: LegendStyle; - axis?: AxisStyle; - markCommon?: MarkStyle; - point?: MarkStyle; - rect?: MarkStyle; - triangle?: MarkStyle; - area?: MarkStyle; - line?: MarkStyle; - bar?: MarkStyle; - rule?: MarkStyle; - link?: MarkStyle; - brush?: MarkStyle; - text?: MarkStyle & { - textFontWeight?: 'bold' | 'normal'; - textAnchor?: 'start' | 'middle' | 'end'; - }; -} -export interface CompleteThemeDeep { - base: Required; - root: Required; - track: Required; - legend: Required; - axis: Required; - markCommon: Required; - point: Required; - rect: Required; - triangle: Required; - area: Required; - line: Required; - bar: Required; - rule: Required; - link: Required; - brush: Required; - text: Required & Required<{ - textFontWeight?: 'bold' | 'normal'; - textAnchor?: 'start' | 'middle' | 'end'; - }>; -} -export interface RootStyle { - background?: string; - titleColor?: string; - titleFontSize?: number; - titleFontFamily?: string; - titleAlign?: 'left' | 'middle' | 'right'; - titleFontWeight?: 'bold' | 'normal' | 'light'; - titleBackgroundColor?: string; - subtitleColor?: string; - subtitleFontSize?: number; - subtitleFontFamily?: string; - subtitleAlign?: 'left' | 'middle' | 'right'; - subtitleFontWeight?: 'bold' | 'normal' | 'light'; - subtitleBackgroundColor?: string; - showMousePosition?: boolean; - mousePositionColor?: string; -} -export interface TrackStyle { - background?: string; - alternatingBackground?: string; - titleColor?: string; - titleBackground?: string; - titleFontSize?: number; - titleAlign?: 'left' | 'middle' | 'right'; - outline?: string; - outlineWidth?: number; -} -export interface LegendStyle { - position?: 'top' | 'right'; - tickColor?: string; - labelColor?: string; - labelFontSize?: number; - labelFontWeight?: 'bold' | 'normal' | 'light'; - labelFontFamily?: string; - background?: string; - backgroundOpacity?: number; - backgroundStroke?: string; -} -export interface AxisStyle { - tickColor?: string; - /** - * The margin around labels for calculating visual overlaps between labels. - * This is mainly used for determining the visibility of axis labels. - * `0` if no margin to use. Negative values (`-1`) for showing all labels even if they overlap. - */ - labelMargin?: number; - /** - * If `true`, labels of genomics axes excludes the chromosome prefix (e.g., `chr1` -> `1`). - */ - labelExcludeChrPrefix?: boolean; - labelColor?: string; - labelFontSize?: number; - labelFontWeight?: 'bold' | 'normal' | 'light'; - labelFontFamily?: string; - baselineColor?: string; - gridColor?: string; - gridStrokeWidth?: number; - gridStrokeType?: 'solid' | 'dashed'; - gridStrokeDash?: [number, number]; -} -export interface MarkStyle { - color?: string; - size?: number; - stroke?: string; - strokeWidth?: number; - opacity?: number; - nominalColorRange?: string[]; - quantitativeSizeRange?: [number, number]; -} -export declare function getTheme(theme?: Theme): Required; -//# sourceMappingURL=theme.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/theme.d.ts.map b/dist/src/core/utils/theme.d.ts.map deleted file mode 100644 index 13d86c3a..00000000 --- a/dist/src/core/utils/theme.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/theme.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC;AAC1C,MAAM,MAAM,SAAS,GACf,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,KAAK,GACL,SAAS,GACT,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,CAAC;AAMf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;CAErC;AAED,MAAM,WAAW,SAAS;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAE5C;AAGD,wBAAgB,QAAQ,CAAC,KAAK,GAAE,KAAe,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAwB5E"} \ No newline at end of file diff --git a/dist/src/core/utils/uuid.d.ts b/dist/src/core/utils/uuid.d.ts deleted file mode 100644 index 904f8a96..00000000 --- a/dist/src/core/utils/uuid.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function uuid(): string; -//# sourceMappingURL=uuid.d.ts.map \ No newline at end of file diff --git a/dist/src/core/utils/uuid.d.ts.map b/dist/src/core/utils/uuid.d.ts.map deleted file mode 100644 index d332c0b0..00000000 --- a/dist/src/core/utils/uuid.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/uuid.ts"],"names":[],"mappings":"AAKA,wBAAgB,IAAI,IAAI,MAAM,CAE7B"} \ No newline at end of file diff --git a/dist/src/core/visual-property.schema.d.ts b/dist/src/core/visual-property.schema.d.ts deleted file mode 100644 index 56d75047..00000000 --- a/dist/src/core/visual-property.schema.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export type PIXIVisualProperty = 'color' | 'row' | 'stroke' | 'strokeWidth' | 'opacity' | 'x' | 'xe' | 'x1' | 'x1e' | 'y' | 'ye' | 'size' | 'text' | 'x-center' | 'y-center' | 'p-size' | 'x-start' | 'height' | 'width'; -//# sourceMappingURL=visual-property.schema.d.ts.map \ No newline at end of file diff --git a/dist/src/core/visual-property.schema.d.ts.map b/dist/src/core/visual-property.schema.d.ts.map deleted file mode 100644 index a3f37d07..00000000 --- a/dist/src/core/visual-property.schema.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"visual-property.schema.d.ts","sourceRoot":"","sources":["../../../src/core/visual-property.schema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAExB,OAAO,GACP,KAAK,GACL,QAAQ,GACR,aAAa,GACb,SAAS,GACT,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,GAAG,GACH,IAAI,GACJ,MAAM,GACN,MAAM,GAEN,UAAU,GACV,UAAU,GACV,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,OAAO,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts b/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts deleted file mode 100644 index f8545f5b..00000000 --- a/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type { BamData, Assembly } from '@gosling-lang/gosling-schema'; -import type { TilesetInfo, Tiles, Segment, Junction, SegmentWithMate } from './bam-worker'; -import type { TabularDataFetcher } from '../utils'; -type InferTileType = Config['extractJunction'] extends true ? Junction : Config['loadMates'] extends true ? SegmentWithMate : Segment; -declare class BamDataFetcher implements TabularDataFetcher> { - static config: { - type: string; - }; - dataConfig: {}; - uid: string; - fetchTimeout?: ReturnType; - toFetch: Set; - MAX_TILE_WIDTH: 20000; - private worker; - track?: { - fetching: { - delete(id: string): void; - }; - }; - constructor(HGC: import('@higlass/types').HGC, config: Config & { - assembly: Assembly; - }); - tilesetInfo(callback: (info: TilesetInfo) => void): Promise; - fetchTilesDebounced(receivedTiles: (tiles: Tiles) => void, tileIds: string[]): void; - sendFetch(receivedTiles: (tiles: Tiles) => void, tileIds: string[]): Promise; - getTabularData(tileIds: string[]): Promise[]>; -} -export default BamDataFetcher; -//# sourceMappingURL=bam-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts.map b/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts.map deleted file mode 100644 index 3184b98a..00000000 --- a/dist/src/data-fetchers/bam/bam-data-fetcher.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bam-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/bam/bam-data-fetcher.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,KAAK,EAAa,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEtG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,KAAK,aAAa,CAAC,MAAM,SAAS,OAAO,IAAI,MAAM,CAAC,iBAAiB,CAAC,SAAS,IAAI,GAC7E,QAAQ,GACR,MAAM,CAAC,WAAW,CAAC,SAAS,IAAI,GAChC,eAAe,GACf,OAAO,CAAC;AAEd,cAAM,cAAc,CAAC,MAAM,SAAS,OAAO,CAAE,YAAW,kBAAkB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7F,MAAM,CAAC,MAAM;;MAAmB;IAChC,UAAU,KAAM;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;IAC7C,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAErB,cAAc,QAAgB;IAE9B,OAAO,CAAC,MAAM,CAAmC;IAGjD,KAAK,CAAC,EAAE;QACJ,QAAQ,EAAE;YAAE,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAC;KAC1C,CAAC;gBAEU,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,QAAQ,CAAA;KAAE;IAchF,WAAW,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI;IAIvD,mBAAmB,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAyBtE,SAAS,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAIlE,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;CAI5E;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/bam/bam-worker.d.ts b/dist/src/data-fetchers/bam/bam-worker.d.ts deleted file mode 100644 index 40ec64bd..00000000 --- a/dist/src/data-fetchers/bam/bam-worker.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -import type { BamRecord } from '@gmod/bam'; -import type { TilesetInfo } from '@higlass/types'; -import type { ChromSizes } from '@gosling-lang/gosling-schema'; -interface BamFileOptions { - loadMates: boolean; - maxInsertSize: number; - extractJunction: boolean; - junctionMinCoverage: number; - urlFetchOptions?: RequestInit; - indexUrlFetchOptions?: RequestInit; -} -type Substitution = { - pos: number; - length: number; - type: 'X' | 'I' | 'D' | 'N' | '=' | 'M' | 'S' | 'H'; - variant?: string; -}; -export type Segment = { - id: string; - name: string; - start: number; - end: number; - md: string; - chrName: string; - chrOffset: number; - cigar: string; - mapq: string; - strand: '+' | '-'; -}; -declare const bamRecordToJson: (bamRecord: BamRecord, chrName: string, chrOffset: number) => Segment & { - substitutions: Substitution[]; -}; -type JsonBamRecord = ReturnType; -/** - * Not like other data fetchers, the Bam Data Fetcher fetches all the tiles at once. - * @param uid - * @param tileIds - * @returns - */ -declare const fetchTilesDebounced: (uid: string, tileIds: string[]) => Promise>; -export type SegmentWithMate = Segment & { - mateIds: string[]; - foundMate: boolean; - insertSize: number; - largeInsertSize: boolean; - svType: string; - numMates: number; -}; -export type Junction = { - start: number; - end: number; - score: number; -}; -declare const tileFunctions: { - init: (uid: string, bam: { - url: string; - indexUrl: string; - }, chromSizes: ChromSizes, options?: Partial) => Promise; - tilesetInfo: (uid: string) => { - tile_size: number; - bins_per_dimension: number; - max_zoom: number; - max_width: number; - min_pos: number[]; - max_pos: number[]; - }; - fetchTilesDebounced: (uid: string, tileIds: string[]) => Promise>; - tile: (uid: string, z: number, x: number) => Promise; - getTabularData: (uid: string, tileIds: string[]) => import("threads").TransferDescriptor; -}; -export type WorkerApi = typeof tileFunctions; -export type { TilesetInfo }; -export type Tiles = Awaited>; -//# sourceMappingURL=bam-worker.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bam/bam-worker.d.ts.map b/dist/src/data-fetchers/bam/bam-worker.d.ts.map deleted file mode 100644 index 97881082..00000000 --- a/dist/src/data-fetchers/bam/bam-worker.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bam-worker.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/bam/bam-worker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI/D,UAAU,cAAc;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,oBAAoB,CAAC,EAAE,WAAW,CAAC;CACtC;AAkDD,KAAK,YAAY,GAAG;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,GAAG,G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CAAC;uBA8BV,MAAM;;;;;;;;+BAoGQ,MAAM,WAAW,MAAM,EAAE;;;wBACG,MAAM;;gBAjGjD,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,QAAQ,aAAa,EAAE,CAAC;0BA4HnD,MAAM,WAAW,MAAM,EAAE;CA6IrD,CAAC;AAIF,MAAM,MAAM,SAAS,GAAG,OAAO,aAAa,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,CAAC;AAC5B,MAAM,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts b/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts deleted file mode 100644 index 230c824c..00000000 --- a/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { Assembly, BedData } from '@gosling-lang/gosling-schema'; -import type { TilesetInfo } from './bed-worker'; -import type { BedTile, EmptyTile } from './bed-worker'; -import type { TabularDataFetcher } from '../utils'; -export type BedDataConfig = BedData & { - assembly: Assembly; -}; -declare class BedDataFetcher implements TabularDataFetcher { - static config: { - type: string; - }; - dataConfig: {}; - uid: string; - prevRequestTime: number; - track?: any; - private toFetch; - private fetchTimeout?; - private worker; - constructor(HGC: import('@higlass/types').HGC, config: BedDataConfig); - tilesetInfo(callback: (info: TilesetInfo) => void): Promise; - fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]): void; - sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]): Promise; - /** - * Called by GoslingTrack. This is how the track gets data - * @param tileIds The position of the tile - * @returns A promise to the BedTiles - */ - getTabularData(tileIds: string[]): Promise; -} -export default BedDataFetcher; -//# sourceMappingURL=bed-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts.map b/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts.map deleted file mode 100644 index 04765769..00000000 --- a/dist/src/data-fetchers/bed/bed-data-fetcher.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bed-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/bed/bed-data-fetcher.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE7D,cAAM,cAAe,YAAW,kBAAkB,CAAC,OAAO,CAAC;IACvD,MAAM,CAAC,MAAM;;MAAmB;IAChC,UAAU,KAAM;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,YAAY,CAAC,CAAgC;IACrD,OAAO,CAAC,MAAM,CAAmC;gBAErC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa;IAe9D,WAAW,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI;IAIvD,mBAAmB,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAe1F,SAAS,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAG5F;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAK9D;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-parser.d.ts b/dist/src/data-fetchers/bed/bed-parser.d.ts deleted file mode 100644 index eae97339..00000000 --- a/dist/src/data-fetchers/bed/bed-parser.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { BedTile } from './bed-worker'; -/** - * A class to create a BED file parser - */ -declare class BedParser { - #private; - /** - * Constructor for BedParser - * @param customFields An array of strings, where each string is the name of a custom column - * @param n_columns A number which is the number of columns in the Bed File - */ - constructor(opt?: { - customFields: string[]; - n_columns: number; - }); - /** - * Parses a single BED file line - * @returns An object which contains the parsed data from the line - */ - parseLine(line: string, chromStart: number): BedTile; - /** - * Generates an autoSql schema for a BED file that has custom columns - * @returns A string which is the autoSql spec - */ - constructBedAutoSql(): string; -} -export default BedParser; -//# sourceMappingURL=bed-parser.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-parser.d.ts.map b/dist/src/data-fetchers/bed/bed-parser.d.ts.map deleted file mode 100644 index 84a74da1..00000000 --- a/dist/src/data-fetchers/bed/bed-parser.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bed-parser.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/bed/bed-parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA2B5C;;GAEG;AACH,cAAM,SAAS;;IAKX;;;;OAIG;gBACS,GAAG,CAAC,EAAE;QAAE,YAAY,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAU/D;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAY1C;;;OAGG;IACH,mBAAmB;CA2DtB;AAED,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-worker.d.ts b/dist/src/data-fetchers/bed/bed-worker.d.ts deleted file mode 100644 index 6d37d54e..00000000 --- a/dist/src/data-fetchers/bed/bed-worker.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type { TilesetInfo } from '@higlass/types'; -import type { ChromSizes } from '@gosling-lang/gosling-schema'; -export type BedFileOptions = { - sampleLength: number; - customFields?: string[]; - urlFetchOptions?: RequestInit; - indexUrlFetchOptions?: RequestInit; -}; -/** - * All data stored in each BED file eventually transformed and put into this - */ -export interface BedTile { - chrom: string; - chromStart: number; - chromEnd: number; - name?: string; - score?: number; - strand?: string; - thickStart?: number; - thickEnd?: number; - itemRgb?: string; - blockCount?: number; - blockSizes?: number[]; - blockStarts?: number[]; - [customField: string]: string | number | number[] | undefined; -} -export interface EmptyTile { - tilePositionId: string; -} -declare function init(uid: string, bed: { - url: string; - indexUrl: string; -}, chromSizes: ChromSizes, options?: Partial): void; -declare const tileFunctions: { - init: typeof init; - tilesetInfo: (uid: string) => { - tile_size: number; - bins_per_dimension: number; - max_zoom: number; - max_width: number; - min_pos: number[]; - max_pos: number[]; - }; - fetchTilesDebounced: (uid: string, tileIds: string[]) => Promise>; - tile: (uid: string, z: number, x: number) => Promise; - getTabularData: (uid: string, tileIds: string[]) => import("threads").TransferDescriptor; -}; -export type WorkerApi = typeof tileFunctions; -export type { TilesetInfo }; -//# sourceMappingURL=bed-worker.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bed/bed-worker.d.ts.map b/dist/src/data-fetchers/bed/bed-worker.d.ts.map deleted file mode 100644 index 7fb69998..00000000 --- a/dist/src/data-fetchers/bed/bed-worker.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bed-worker.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/bed/bed-worker.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,K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AM,EAAE;CAqCrD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,aAAa,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts b/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts deleted file mode 100644 index 483a989b..00000000 --- a/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { BigWig } from '@gmod/bbi'; -import type { Assembly, BigWigData } from '@gosling-lang/gosling-schema'; -import { type CommonDataConfig } from '../utils'; -import type { ChromInfo, TilesetInfo } from '@higlass/types'; -type BigWigDataConfig = BigWigData & CommonDataConfig; -type Tile = { - tilePos: [number]; - tileId: string; - zoomLevel: number; - min_value: number; - max_value: number; - dense: (number | null)[]; - denseDataExtrema: InstanceType; - minNonZero: number; - maxNonZero: number; -}; -type BigWigHeader = { - zoomLevels: { - reductionLevel: number; - }[]; -}; -declare function BigWigDataFetcher(HGC: import('@higlass/types').HGC, dataConfig: BigWigDataConfig): { - dataConfig: typeof dataConfig; - bwFileHeader: BigWigHeader | null; - bwFile: BigWig | null; - TILE_SIZE: number; - errorTxt: string; - dataPromises: Promise[]; - chromSizes: ChromInfo & { - chrToAbs: (name: string, pos: number) => number; - }; - assembly?: Assembly | undefined; - tilesetInfoLoading?: boolean | undefined; - loadBBI(dataConfig: BigWigDataConfig): Promise; - tilesetInfo(callback?: ((info: TilesetInfo | { - error: string; - }) => void) | undefined): Promise<{ - tile_size: number; - max_zoom: number; - max_width: number; - min_pos: number[]; - max_pos: number[]; - } | null>; - fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]): Record; - tile(z: number, x: number): Promise; - determineScale(minX: number, maxX: number): number; -}; -declare namespace BigWigDataFetcher { - var config: { - type: string; - }; -} -export default BigWigDataFetcher; -//# sourceMappingURL=bigwig-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts.map b/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts.map deleted file mode 100644 index e39d4ad0..00000000 --- a/dist/src/data-fetchers/bigwig/bigwig-data-fetcher.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bigwig-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/bigwig/bigwig-data-fetcher.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EAAE,KAAK,gBAAgB,EAAc,MAAM,UAAU,CAAC;AAG7D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7D,KAAK,gBAAgB,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAEtD,KAAK,IAAI,GAAG;IACR,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IACzB,gBAAgB,EAAE,YAAY,CAAC,OAAO,gBAAgB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC5F,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,YAAY,GAAG;IAChB,UAAU,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC5C,CAAC;AAIF,iBAAS,iBAAiB,CAAC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,UAAU,EAAE,gBAAgB;gBAMtE,iBAAiB;kBACf,YAAY,GAAG,IAAI;YACzB,MAAM,GAAG,IAAI;eACV,MAAM;cACP,MAAM;kBACF,QAAQ,OAAO,CAAC,EAAE;;yBACmB,MAAM,OAAO,MAAM,KAAK,MAAM;;;;wBA4CvD,gBAAgB;mCAcZ,WAAW,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;;;;;;+CAqC3B,OAAO,MAAM,EAAE,IAAI,CAAC,KAAK,IAAI,WAAW,MAAM,EAAE;;;YAgC7E,MAAM,KAAK,MAAM;yBAgHV,MAAM,QAAQ,MAAM;EA4BhD;kBAvRQ,iBAAiB;;;;;AA6R1B,eAAe,iBAAiB,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts b/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts deleted file mode 100644 index c088e6dd..00000000 --- a/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import type { CsvData, FilterTransform, Datum } from '@gosling-lang/gosling-schema'; -import { type CommonDataConfig } from '../utils'; -type CsvDataConfig = CsvData & CommonDataConfig & { - filter?: FilterTransform[]; -}; -/** - * Used in #tile() to associate tile coordinates with data - */ -interface TileInfo { - tabularData: Datum[]; - server: null; - tilePos: number[]; - zoomLevel: number; - tilePositionId?: string; -} -/** - * This is what all the tile information eventually gets organized into. - */ -export interface LoadedTiles { - [tilePositionId: string]: TileInfo; -} -/** - * Used in #generateTilesetInfo() - */ -interface TilesetInfo { - tile_size: number; - max_zoom: number; - max_width: number; - min_pos: number[]; - max_pos: number[]; -} -export declare class CsvDataFetcherClass { - #private; - dataConfig: CsvDataConfig; - tilesetInfoLoading: boolean; - constructor(dataConfig: CsvDataConfig); - /** - * Called in TiledPixiTrack - */ - tilesetInfo(callback?: (tilesetInto: TilesetInfo) => void): Promise | undefined; - /** - * Called in TiledPixiTrack. - * @param receivedTiles A function from TiledPixiTrack which takes in all the loaded tiles - * @param tileIds An array of tile IDs. Ex. ['1.0', '1.1'] - */ - fetchTilesDebounced(receivedTiles: (loadedTiles: LoadedTiles) => void, tileIds: string[]): void; -} -/** - * HiGlass data fetcher specific for Gosling which ultimately will accept any types of data other than CSV files. - */ -declare function CsvDataFetcher(_HGC: import('@higlass/types').HGC, dataConfig: CsvDataConfig, _pubsub: Record): CsvDataFetcherClass; -declare namespace CsvDataFetcher { - var config: { - type: string; - }; -} -export default CsvDataFetcher; -//# sourceMappingURL=csv-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts.map b/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts.map deleted file mode 100644 index e0d6a94d..00000000 --- a/dist/src/data-fetchers/csv/csv-data-fetcher.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"csv-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/csv/csv-data-fetcher.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAY,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAE9F,OAAO,EAAE,KAAK,gBAAgB,EAAmD,MAAM,UAAU,CAAC;AAElG,KAAK,aAAa,GAAG,OAAO,GAAG,gBAAgB,GAAG;IAAE,MAAM,CAAC,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAUjF;;GAEG;AACH,UAAU,QAAQ;IACd,WAAW,EAAE,KAAK,EAAE,CAAC;IACrB,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AACD;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,CAAC,cAAc,EAAE,MAAM,GAAG,QAAQ,CAAC;CACtC;AAED;;GAEG;AACH,UAAU,WAAW;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,qBAAa,mBAAmB;;IAC5B,UAAU,EAAE,aAAa,CAAC;IAE1B,kBAAkB,EAAE,OAAO,CAAC;gBAShB,UAAU,EAAE,aAAa;IA+GrC;;OAEG;IACH,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,SAAS;IAqCnG;;;;OAIG;IACH,mBAAmB,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;CAmGlG;AAED;;GAEG;AAEH,iBAAS,cAAc,CACnB,IAAI,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAClC,UAAU,EAAE,aAAa,EAEzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC7B,mBAAmB,CAMrB;kBAXQ,cAAc;;;;;AAiBvB,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts b/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts deleted file mode 100644 index 15b2e0b0..00000000 --- a/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Assembly, GffData } from '@gosling-lang/gosling-schema'; -import type { TilesetInfo, GffTile, EmptyTile } from './gff-worker'; -import type { TabularDataFetcher } from '../utils'; -export type GFFDataConfig = GffData & { - assembly: Assembly; -}; -declare class GffDataFetcher implements TabularDataFetcher { - static config: { - type: string; - }; - dataConfig: {}; - uid: string; - prevRequestTime: number; - track?: any; - private toFetch; - private fetchTimeout?; - private worker; - constructor(HGC: import('@higlass/types').HGC, config: GFFDataConfig); - tilesetInfo(callback: (info: TilesetInfo) => void): Promise; - fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]): void; - sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]): Promise; - getTabularData(tileIds: string[]): Promise; -} -export default GffDataFetcher; -//# sourceMappingURL=gff-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts.map b/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts.map deleted file mode 100644 index c97af03e..00000000 --- a/dist/src/data-fetchers/gff/gff-data-fetcher.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gff-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/gff/gff-data-fetcher.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAa,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE7D,cAAM,cAAe,YAAW,kBAAkB,CAAC,OAAO,CAAC;IACvD,MAAM,CAAC,MAAM;;MAAmB;IAChC,UAAU,KAAM;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,YAAY,CAAC,CAAgC;IACrD,OAAO,CAAC,MAAM,CAAmC;gBAErC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa;IAe9D,WAAW,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI;IAIvD,mBAAmB,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAe1F,SAAS,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAItF,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAK9D;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/gff-worker.d.ts b/dist/src/data-fetchers/gff/gff-worker.d.ts deleted file mode 100644 index bb51b4f8..00000000 --- a/dist/src/data-fetchers/gff/gff-worker.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { GFF3FeatureLineWithRefs } from '@gmod/gff'; -import type { TilesetInfo } from '@higlass/types'; -import type { ChromSizes } from '@gosling-lang/gosling-schema'; -export type GffFileOptions = { - sampleLength: number; - attributesToFields?: { - attribute: string; - defaultValue: string; - }[]; - urlFetchOptions?: RequestInit; - indexUrlFetchOptions?: RequestInit; -}; -export interface GffTile extends GFF3FeatureLineWithRefs { - attribute?: string; -} -export interface EmptyTile { - tilePositionId: string; -} -declare function init(uid: string, bed: { - url: string; - indexUrl: string; -}, chromSizes: ChromSizes, options?: Partial): void; -declare const tileFunctions: { - init: typeof init; - tilesetInfo: (uid: string) => { - tile_size: number; - bins_per_dimension: number; - max_zoom: number; - max_width: number; - min_pos: number[]; - max_pos: number[]; - }; - fetchTilesDebounced: (uid: string, tileIds: string[]) => Promise>; - tile: (uid: string, z: number, x: number) => Promise; - getTabularData: (uid: string, tileIds: string[]) => import("threads").TransferDescriptor; -}; -export type WorkerApi = typeof tileFunctions; -export type { TilesetInfo }; -//# sourceMappingURL=gff-worker.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/gff-worker.d.ts.map b/dist/src/data-fetchers/gff/gff-worker.d.ts.map deleted file mode 100644 index 78f67b9f..00000000 --- a/dist/src/data-fetchers/gff/gff-worker.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gff-worker.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/gff/gff-worker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAA6B,MAAM,WAAW,CAAC;AAGpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI/D,MAAM,MAAM,cAAc,GAAG;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnE,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,oBAAoB,CAAC,EAAE,WAAW,CAAC;CACtC,CAAC;AAEF,MAAM,WAAW,OAAQ,SAAQ,uBAAuB;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACtB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAyOD,iBAAS,IAAI,CACT,GAAG,EAAE,MAAM,EACX,GAAG,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EACtC,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM,QAWxC;AAsFD,QAAA,MAAM,aAAa;;uBApFO,MAAM;;;;;;;;+BA8BQ,MAAM,WAAW,MAAM,EAAE;gBApBxC,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,QAAQ,IAAI,EAAE,CAAC;0BAoD1C,MAAM,WAAW,MAAM,EAAE;CA4BrD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,aAAa,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/utils.d.ts b/dist/src/data-fetchers/gff/utils.d.ts deleted file mode 100644 index 29e15ccd..00000000 --- a/dist/src/data-fetchers/gff/utils.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { GFF3Feature, GFF3Sequence } from '@gmod/gff'; -/** - * Type guard for GFF3Feature - * @param entry An element from GFF.parseStringSync() return value - * @returns True if type is GFF3Feature - */ -export declare function isGFF3Feature(entry: GFF3Feature | GFF3Sequence): entry is GFF3Feature; -/** Returns an array of the unique values sampled n times between 0 and maxValue */ -export declare function makeRandomSortedArray(n: number, maxValue: number): number[]; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/gff/utils.d.ts.map b/dist/src/data-fetchers/gff/utils.d.ts.map deleted file mode 100644 index d0e4317f..00000000 --- a/dist/src/data-fetchers/gff/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/gff/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC3D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,GAAG,KAAK,IAAI,WAAW,CAErF;AAED,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,YAQhE"} \ No newline at end of file diff --git a/dist/src/data-fetchers/index.d.ts b/dist/src/data-fetchers/index.d.ts deleted file mode 100644 index 914c4855..00000000 --- a/dist/src/data-fetchers/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export { default as BamDataFetcher } from './bam/bam-data-fetcher'; -export { default as VcfDataFetcher } from './vcf/vcf-data-fetcher'; -export { default as BigWigDataFetcher } from './bigwig/bigwig-data-fetcher'; -export { default as CsvDataFetcher } from './csv/csv-data-fetcher'; -export { default as JsonDataFetcher } from './json/json-data-fetcher'; -export { default as GffDataFetcher } from './gff/gff-data-fetcher'; -export { default as BedDataFetcher } from './bed/bed-data-fetcher'; -export { type TabularDataFetcher } from './utils'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/index.d.ts.map b/dist/src/data-fetchers/index.d.ts.map deleted file mode 100644 index 81a018c6..00000000 --- a/dist/src/data-fetchers/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data-fetchers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/json/json-data-fetcher.d.ts b/dist/src/data-fetchers/json/json-data-fetcher.d.ts deleted file mode 100644 index 91bab2ef..00000000 --- a/dist/src/data-fetchers/json/json-data-fetcher.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * HiGlass data fetcher specific for Gosling which ultimately will accept any types of data other than JSON values. - */ -declare function JsonDataFetcher(HGC: any, ...args: any): any; -declare namespace JsonDataFetcher { - var config: { - type: string; - }; -} -export default JsonDataFetcher; -//# sourceMappingURL=json-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/json/json-data-fetcher.d.ts.map b/dist/src/data-fetchers/json/json-data-fetcher.d.ts.map deleted file mode 100644 index 50c700c7..00000000 --- a/dist/src/data-fetchers/json/json-data-fetcher.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/json/json-data-fetcher.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,iBAAS,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,GAAG,CAmKpD;kBAnKQ,eAAe;;;;;AAyKxB,eAAe,eAAe,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/utils.d.ts b/dist/src/data-fetchers/utils.d.ts deleted file mode 100644 index 3c3b93c5..00000000 --- a/dist/src/data-fetchers/utils.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { RemoteFile as _RemoteFile } from 'generic-filehandle'; -import type * as HiGlass from '@higlass/types'; -import type { Assembly, ChromSizes, Datum } from '@gosling-lang/gosling-schema'; -export type CommonDataConfig = { - assembly: Assembly; - x?: string; - xe?: string; - x1?: string; - x1e?: string; - urlFetchOptions?: RequestInit; -}; -export declare class DataSource { - file: File; - options: Options; - chromInfo: ExtendedChromInfo; - tilesetInfo: ReturnType; - constructor(file: File, chromSizes: ChromSizes, options: Options); -} -/** - * Filter data before sending to a track considering the visible genomic area in the track. - * TODO(2022-Jul-13): Consider genomic `y` channels as well. - */ -export declare function filterUsingGenoPos(data: Datum[], [minX, maxX]: [number, number], config: Omit): Datum[]; -declare const absToChr: (absPosition: number, chromInfo: HiGlass.ChromInfo) => readonly [string, number, number, number] | null; -/** - * Get a chromosome name for the consistentcy, e.g., `1` --> `chr1`. - * @param chrName A chromosome name to be sanitized - * @param assembly A genome assembly of the data - * @param chromosomePrefix A prefix string that can be replaced to 'chr' - * @returns - */ -export declare function sanitizeChrName(chrName: string, assembly: Assembly, chromosomePrefix?: string): string; -export type ExtendedChromInfo = HiGlass.ChromInfo & { - absToChr(absPos: number): ReturnType | null; - chrToAbs(chr: [name: string, pos: number]): number | null; -}; -export declare function tilesetInfoFromChromInfo(chromInfo: ExtendedChromInfo, tileSize?: number): { - tile_size: number; - bins_per_dimension: number; - max_zoom: number; - max_width: number; - min_pos: number[]; - max_pos: number[]; -}; -export declare function sizesToChromInfo(sizes: [string, number][]): ExtendedChromInfo; -export declare class RemoteFile extends _RemoteFile { - read: _RemoteFile['read']; -} -export interface TabularDataFetcher { - getTabularData(tileIds: string[]): Promise; - MAX_TILE_WIDTH?: number; -} -export {}; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/utils.d.ts.map b/dist/src/data-fetchers/utils.d.ts.map deleted file mode 100644 index 4d5309fa..00000000 --- a/dist/src/data-fetchers/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/data-fetchers/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAEhF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,WAAW,CAAC;CACjC,CAAC;AAEF,qBAAa,UAAU,CAAC,IAAI,EAAE,OAAO;IAId,IAAI,EAAE,IAAI;IAAiC,OAAO,EAAE,OAAO;IAH9E,SAAS,EAAE,iBAAiB,CAAC;IAC7B,WAAW,E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C;CAC3B"} \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/utils.d.ts b/dist/src/data-fetchers/vcf/utils.d.ts deleted file mode 100644 index bb61ad19..00000000 --- a/dist/src/data-fetchers/vcf/utils.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { VcfRecord, VcfTile } from './vcf-data-fetcher'; -export declare const getMutationType: (ref: string, alt?: string) => "unknown" | "substitution" | "deletion" | "insertion"; -export declare const getSubstitutionType: (ref: string, alt?: string) => "unknown" | "C>A" | "C>G" | "C>T" | "T>A" | "T>C" | "T>G"; -/** - * Convert a VCF record to a tile data - * @param vcfRecord A row of a VCF files loaded - * @param chrPos Cumulative start position of a chromosome - * @param prevAbsPos Previous position of a point mutation for calculating 'distance to previous' - */ -export declare function recordToTile(vcfRecord: VcfRecord, chrPos: number, prevAbsPos?: number): VcfTile; -//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/utils.d.ts.map b/dist/src/data-fetchers/vcf/utils.d.ts.map deleted file mode 100644 index f6bf057e..00000000 --- a/dist/src/data-fetchers/vcf/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/vcf/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7D,eAAO,MAAM,eAAe,QAAS,MAAM,QAAQ,MAAM,0DAMxD,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAS,MAAM,QAAQ,MAAM,8DAuB5D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,WAuCrF"} \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts b/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts deleted file mode 100644 index aa2485bb..00000000 --- a/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -import type { Assembly, VcfData } from '@gosling-lang/gosling-schema'; -import type { TilesetInfo } from './vcf-worker'; -import type { TabularDataFetcher } from '../utils'; -import { getSubstitutionType, getMutationType } from './utils'; -export type VcfRecord = { - CHROM: string; - POS: number; - ID: null | string[]; - REF: string; - ALT: null | string[]; - QUAL: null | number; - FILTER: null | string; - INFO: Record; -}; -export type VcfTile = Omit & { - ALT: string | undefined; - MUTTYPE: ReturnType; - SUBTYPE: ReturnType; - INFO: string; - ORIGINALPOS: number; - POS: number; - POSEND: number; - DISTPREV: number | null; - DISTPREVLOGE: number | null; -} & { - [infoKey: string]: any; -}; -declare class VcfDataFetcher implements TabularDataFetcher { - static config: { - type: string; - }; - dataConfig: {}; - uid: string; - prevRequestTime: number; - track?: any; - private toFetch; - private fetchTimeout?; - private worker; - constructor(HGC: import('@higlass/types').HGC, config: VcfData & { - assembly: Assembly; - }); - tilesetInfo(callback: (info: TilesetInfo) => void): Promise; - fetchTilesDebounced(receivedTiles: (tiles: Record) => void, tileIds: string[]): void; - sendFetch(receivedTiles: (tiles: Record) => void, tileIds: string[]): Promise; - getTabularData(tileIds: string[]): Promise; -} -export default VcfDataFetcher; -//# sourceMappingURL=vcf-data-fetcher.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts.map b/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts.map deleted file mode 100644 index 72686cdb..00000000 --- a/dist/src/data-fetchers/vcf/vcf-data-fetcher.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vcf-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/vcf/vcf-data-fetcher.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAa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;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,YAAY,CAAC,CAAgC;IACrD,OAAO,CAAC,MAAM,CAAmC;gBAErC,GAAG,EAAE,OAAO,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAG;QAAE,QAAQ,EAAE,QAAQ,CAAA;KAAE;IAejF,WAAW,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI;IAIvD,mBAAmB,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAexF,SAAS,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE;IAIpF,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAI9D;AAED,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/vcf-worker.d.ts b/dist/src/data-fetchers/vcf/vcf-worker.d.ts deleted file mode 100644 index 953b87b8..00000000 --- a/dist/src/data-fetchers/vcf/vcf-worker.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type { TilesetInfo } from '@higlass/types'; -import type { ChromSizes } from '@gosling-lang/gosling-schema'; -import type { VcfTile } from './vcf-data-fetcher'; -type VcfFileOptions = { - sampleLength: number; - urlFetchOptions?: RequestInit; - indexUrlFetchOptions?: RequestInit; -}; -declare function init(uid: string, vcf: { - url: string; - indexUrl: string; -}, chromSizes: ChromSizes, options?: Partial): void; -declare const tileFunctions: { - init: typeof init; - tilesetInfo: (uid: string) => { - tile_size: number; - bins_per_dimension: number; - max_zoom: number; - max_width: number; - min_pos: number[]; - max_pos: number[]; - }; - fetchTilesDebounced: (uid: string, tileIds: string[]) => Promise>; - tile: (uid: string, z: number, x: number) => Promise; - getTabularData: (uid: string, tileIds: string[]) => import("threads").TransferDescriptor; -}; -export type WorkerApi = typeof tileFunctions; -export type { TilesetInfo }; -//# sourceMappingURL=vcf-worker.d.ts.map \ No newline at end of file diff --git a/dist/src/data-fetchers/vcf/vcf-worker.d.ts.map b/dist/src/data-fetchers/vcf/vcf-worker.d.ts.map deleted file mode 100644 index 0f00cfc3..00000000 --- a/dist/src/data-fetchers/vcf/vcf-worker.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vcf-worker.d.ts","sourceRoot":"","sources":["../../../../src/data-fetchers/vcf/vcf-worker.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAMlD,KAAK,cAAc,GAAG;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,oBAAoB,CAAC,EAAE,WAAW,CAAC;CACtC,CAAC;AAiHF,iBAAS,IAAI,CACT,GAAG,EAAE,MAAM,EACX,GAAG,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EACtC,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM,QAWxC;AA0FD,QAAA,MAAM,aAAa;;uBAxFO,MAAM;;;;;;;;+BA6BQ,MAAM,WAAW,MAAM,EAAE;gBAnBxC,MAAM,KAAK,MAAM,KAAK,MAAM,KAAG,QAAQ,OAAO,EAAE,CAAC;0BA+C7C,MAAM,WAAW,MAAM,EAAE;CAqCrD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,aAAa,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/src/exported-utils.d.ts b/dist/src/exported-utils.d.ts deleted file mode 100644 index 0fb68f0e..00000000 --- a/dist/src/exported-utils.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { getRelativeGenomicPosition, computeChromSizes, getChromInterval, getChromTotalSize, parseGenomicPosition } from './core/utils/assembly'; -export { sanitizeChrName } from './data-fetchers/utils'; -export { convertToFlatTracks as _convertToFlatTracks } from './compiler/spec-preprocess'; -export { spreadTracksByData as _spreadTracksByData } from './core/utils/overlay'; -//# sourceMappingURL=exported-utils.d.ts.map \ No newline at end of file diff --git a/dist/src/exported-utils.d.ts.map b/dist/src/exported-utils.d.ts.map deleted file mode 100644 index 4cb5aca8..00000000 --- a/dist/src/exported-utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"exported-utils.d.ts","sourceRoot":"","sources":["../../src/exported-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,mBAAmB,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACzF,OAAO,EAAE,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-schema/gosling.schema.d.ts b/dist/src/gosling-schema/gosling.schema.d.ts deleted file mode 100644 index 5c23ab29..00000000 --- a/dist/src/gosling-schema/gosling.schema.d.ts +++ /dev/null @@ -1,1229 +0,0 @@ -export type GoslingSpec = (RootSpecWithSingleView & ResponsiveSpecOfSingleView) | (RootSpecWithMultipleViews & ResponsiveSpecOfMultipleViews); -export type ResponsiveSize = boolean | { - width?: boolean; - height?: boolean; -}; -export type RootSpecWithSingleView = SingleView & { - title?: string; - subtitle?: string; - description?: string; - /** Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false` */ - responsiveSize?: ResponsiveSize; -}; -export interface RootSpecWithMultipleViews extends MultipleViews { - title?: string; - subtitle?: string; - description?: string; - /** Determine whether to make the size of `GoslingComponent` bound to its parent element. __Default__: `false` */ - responsiveSize?: ResponsiveSize; -} -export type View = SingleView | (MultipleViews & ResponsiveSpecOfMultipleViews); -export type SingleView = (OverlaidTracks | StackedTracks | FlatTracks) & ResponsiveSpecOfSingleView; -export type SelectivityCondition = { - operation: LogicalOperation; - /** - * Does the condition applied to the visualization itself or its container? __Default__: `'self'` - */ - target?: 'self' | 'container'; - measure: 'width' | 'height' | 'aspectRatio'; - /** Threshold in the unit of pixels. */ - threshold: number; -}; -export type ResponsiveSpecOfSingleView = { - responsiveSpec?: { - spec: Partial; - selectivity: SelectivityCondition[]; - }[]; -}; -export interface FlatTracks extends CommonViewDef { - tracks: Track[]; -} -export type PartialTrack = Partial; -export interface StackedTracks extends CommonViewDef, Partial { - alignment?: 'stack'; - tracks: (PartialTrack | OverlaidTracks)[]; -} -export interface OverlaidTracks extends CommonViewDef, Partial { - alignment: 'overlay'; - tracks: PartialTrack[]; -} -export interface MultipleViews extends CommonViewDef { - /** - * Specify how multiple views are arranged. - */ - arrangement?: 'parallel' | 'serial' | 'horizontal' | 'vertical'; - /** An array of view specifications */ - views: Array; - /** Internal: Used for responsive spec */ - _assignedWidth?: number; - _assignedHeight?: number; -} -export type ResponsiveSpecOfMultipleViews = { - responsiveSpec?: { - spec: Partial; - selectivity: SelectivityCondition[]; - }[]; -}; -export type Layout = 'linear' | 'circular'; -export type Orientation = 'horizontal' | 'vertical'; -/** Custom chromosome sizes, e.g., [["foo", 1000], ["bar", 300], ["baz", 240]] */ -export type ChromSizes = [string, number][]; -export type Assembly = 'hg38' | 'hg19' | 'hg18' | 'hg17' | 'hg16' | 'mm10' | 'mm9' | 'unknown' | ChromSizes; -export type ZoomLimits = [number | null, number | null]; -export interface CommonViewDef { - /** The ID of a view that is maintained for the use of JS API functions, e.g., positions of a view */ - id?: string; - /** Specify the layout type of all tracks. */ - layout?: Layout; - /** Specify the orientation. */ - orientation?: Orientation; - /** - * The size of the gap (1) between tracks, (2) between views, and (3) of the origin of circular tracks. - * The effect of this property depends on where on the spec you specify the `spacing`. - * - * In a linear layout, this value is used in pixels, - * while in a circular layout, this value is used relative to the height of the tracks or views. - */ - spacing?: number; - /** Whether to disable [Zooming and Panning](http://gosling-lang.org/docs/user-interaction#zooming-and-panning), - * __Default:__ `false`. - */ - static?: boolean; - zoomLimits?: ZoomLimits; - /** Specify the x offset of views in the unit of pixels */ - xOffset?: number; - /** Specify the y offset of views in the unit of pixels */ - yOffset?: number; - /** - * A string that specifies the genome builds to use. - * Currently support `"hg38"`, `"hg19"`, `"hg18"`, `"hg17"`, `"hg16"`, `"mm10"`, `"mm9"`, and `"unknown"`. - * - * __Note:__: with `"unknown"` assembly, genomic axes do not show chrN: in labels. - */ - assembly?: Assembly; - /** Specify the visible region of genomic x-axis */ - xDomain?: DomainInterval | DomainChrInterval | DomainChr; - /** Specify the visible region of genomic y-axis */ - yDomain?: DomainInterval | DomainChrInterval | DomainChr; - /** Specify an ID for [linking multiple views](http://gosling-lang.org/docs/user-interaction#linking-views) */ - linkingId?: string; - /** not supported */ - xAxis?: AxisPosition; - /** - * Proportion of the radius of the center white space. - * - * __Default:__ `0.3` - * @Range [0, 1] - */ - centerRadius?: number; - /** - * Define the [style](http://gosling-lang.org/docs/visual-channel#style-related-properties) of multive views. - * Will be overwritten by the style of children elements (e.g., view, track). - */ - style?: Style; - /** Internal: Used for responsive spec */ - _assignedWidth?: number; - _assignedHeight?: number; -} -export type Track = SingleTrack | OverlaidTrack | DataTrack | TemplateTrack | DummyTrack; -export interface CommonTrackDef extends CommonViewDef { - /** Assigned to `uid` in a HiGlass view config, used for API and caching. */ - id?: string; - /** If defined, will show the textual label on the left-top corner of a track. */ - title?: string; - subtitle?: string; - /** Specify the track width in pixels. */ - width?: number; - /** Specify the track height in pixels. */ - height?: number; - overlayOnPreviousTrack?: boolean; - /** - * Specify the outer radius of tracks when `{"layout": "circular"}`. - */ - outerRadius?: number; - /** - * Specify the inner radius of tracks when (`{"layout": "circular"}`). - */ - innerRadius?: number; - /** - * Specify the start angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`). - */ - startAngle?: number; - /** - * Specify the end angle (in the range of [0, 360]) of circular tracks (`{"layout": "circular"}`). - */ - endAngle?: number; - /** internal */ - _renderingId?: string; - /** internal */ - _invalidTrack?: boolean; - /** internal */ - prerelease?: {}; -} -/** - * Partial specification of `BasicSingleTrack` to use default visual encoding predefined by data type. - */ -export interface DataTrack extends CommonTrackDef { - data: DataDeep; -} -/** - * A placeholder track. In contrast to other tracks, this track does not display any data. Instead it provides - * empty space for third party tools to display their data on top of. - */ -export interface DummyTrack extends Pick { - /** Used to specify the dummy track */ - type: 'dummy-track'; - /** Text that gets shown on the DummyTrack */ - title?: string; - /** Defines how the track is styled */ - style?: DummyTrackStyle; - /** Only linear layout are supported at this time */ - layout?: 'linear'; - static?: true; - /** Unused property for DummyTrack */ - zoomLimits?: [null, null]; - /** No assemblies can be associated with a dummy track */ - assembly?: 'unknown'; -} -export interface DummyTrackStyle { - /** Background color of the track */ - background?: string; - /** Color of the outline of the track */ - outline?: string; - /** Specify the font size of the title */ - textFontSize?: number; - /** Specify the font weight of the title. */ - textFontWeight?: 'bold' | 'normal'; - /** Specify the stroke color of title. */ - textStroke?: string; - /** Specify the stroke width of the title. */ - textStrokeWidth?: number; -} -export type Mark = 'point' | 'line' | 'area' | 'bar' | 'rect' | 'text' | 'withinLink' | 'betweenLink' | 'rule' | 'triangleLeft' | 'triangleRight' | 'triangleBottom' | 'brush' | 'header'; -interface CommonEventData { - /** Source visualization ID, i.e., `track.id` */ - id: string; - /** Values in a JSON array that represent data after data transformation */ - data: Datum[]; -} -interface SpecEventData { - /** Source visualization ID, i.e., `track.id` */ - id: string; - /** Gosling spec */ - spec: GoslingSpec; -} -export interface GenomicPosition { - chromosome: string; - position: number; -} -interface OnNewTrackEventData { - /** Source visualization ID, i.e., `track.id` */ - id: string; -} -interface OnNewViewEventData { - /** Source visualization ID, i.e., `track.id` */ - id: string; -} -interface PointMouseEventData extends CommonEventData { - /** A genomic coordinate, e.g., `chr1:100,000`. */ - genomicPosition: GenomicPosition; -} -interface RangeMouseEventData extends CommonEventData { - /** Start and end genomic coordinates. Null if a range is deselected. */ - genomicRange: [GenomicPosition, GenomicPosition] | null; -} -/** - * Data about the genomic range of a track - */ -interface LocationEventData extends Omit { - genomicRange: [GenomicPosition, GenomicPosition]; -} -/** - * The visual parameters that determine the shape of a linear track or a view. - * Origin is the left top corner. - */ -export interface BoundingBox { - x: number; - y: number; - width: number; - height: number; -} -/** The visual parameters that determine the shape of a circular track */ -interface CircularTrackShape { - cx: number; - cy: number; - innerRadius: number; - outerRadius: number; - /** The first angle in the range of [0, 360]. The origin is 12 o'clock. Anticlockwise. */ - startAngle: number; - /** The second angle in the range of [0, 360]. The origin is 12 o'clock. Anticlockwise. */ - endAngle: number; -} -/** - * The information of a view exposed to users through JS API. - */ -export type ViewApiData = { - /** ID of a source view, i.e., `view.id` */ - id: string; - /** Expanded view specification processed by the Gosling compiler, e.g., default properties filled in. */ - spec: View; - /** The shape of the source view */ - shape: BoundingBox; -}; -/** The information for a track mouse event */ -export type TrackApiData = { - /** ID of a source track, i.e., `track.id` */ - id: string; - /** Expanded track specification processed by the Gosling compiler, e.g., default properties filled in. */ - spec: SingleTrack | OverlaidTrack; - /** The shape of the source track */ - shape: BoundingBox | (BoundingBox & CircularTrackShape); -}; -/** The API data of tracks or views */ -export type VisUnitApiData = ({ - type: 'view'; -} & ViewApiData) | ({ - type: 'track'; -} & TrackApiData); -export type _EventMap = { - mouseOver: PointMouseEventData; - click: PointMouseEventData; - rangeSelect: RangeMouseEventData; - rawData: CommonEventData; - specProcessed: SpecEventData; - trackMouseOver: TrackApiData; - trackClick: TrackApiData; - onNewTrack: OnNewTrackEventData; - onNewView: OnNewViewEventData; - location: LocationEventData; -}; -/** Options for determining mouse events in detail, e.g., turning on specific events only */ -export type MouseEventsDeep = { - /** Whether to enable mouseover events. */ - mouseOver?: boolean; - /** Whether to enable click events. */ - click?: boolean; - /** Whether to send range selection events. */ - rangeSelect?: boolean; - /** Group marks using keys in a data field. This affects how a set of marks are highlighted/selected by interaction. __Default__: `undefined` */ - groupMarksByField?: string; - /** Determine whether all marks underneath the mouse point should be affected by mouse over. __Default__: `false` */ - enableMouseOverOnMultipleMarks?: boolean; -}; -export type SingleTrack = SingleTrackBase & Encoding; -interface SingleTrackBase extends CommonTrackDef { - data: DataDeep; - dataTransform?: DataTransform[]; - tooltip?: Tooltip[]; - experimental?: { - mouseEvents?: boolean | MouseEventsDeep; - /** - * Render visual marks with less smooth curves to increase rendering performance. - * Only supported for `elliptical` `linkStyle` `withinLink` currently. - * @default false - */ - performanceMode?: boolean; - /** - * Performance rendering option. - * By default, certain marks ('bar', 'line', 'rect', 'area') are stretched when zooming in/out to improve - * rendering performance. No marks will be stretched in circular layouts. - * - * When this option is set to true, all marks will be stretched when zooming in/out. - * When this option is set to false, all marks will be rerendered when zooming in/out. - * - */ - stretchGraphics?: boolean; - /** - * Threshold for stretching graphics. If the graphics are scaled larger than the threshold, then the graphic - * will be rerendered. If the graphics are scaled smaller than 1/threshold (e.g., 1/2), then the graphic will - * be rerendered. This is to prevent the graphics from being stretched too much. - * @default 1.5 - */ - stretchGraphicsThreshold?: number; - }; - mark: Mark; - displacement?: Displacement; - visibility?: VisibilityCondition[]; - flipY?: boolean; - baselineY?: number; - stretch?: boolean; - overrideTemplate?: boolean; -} -export interface Encoding { - x?: X | ChannelValue; - y?: Y | ChannelValue; - xe?: X | ChannelValue; - ye?: Y | ChannelValue; - x1?: X | ChannelValue; - y1?: Y | ChannelValue; - x1e?: X | ChannelValue; - y1e?: Y | ChannelValue; - row?: Row | ChannelValue; - color?: Color | ChannelValue; - size?: Size | ChannelValue; - text?: Text | ChannelValue; - stroke?: Stroke | ChannelValue; - strokeWidth?: StrokeWidth | ChannelValue; - opacity?: Opacity | ChannelValue; -} -export interface Tooltip { - /** Specifiy a data field whose value will show in the tooltip. */ - field: string; - /** Type of the data field. */ - type: FieldType; - /** Name of the data field for showing in the tooltip. Will use the field name if not specified. */ - alt?: string; - /** format of the data value. */ - format?: string; -} -export interface Displacement { - type: DisplacementType; - padding?: number; -} -export type DisplacementType = 'pile' | 'spread'; -/** - * Superposing multiple tracks. - */ -export type OverlaidTrack = Partial & { - _overlay: Partial>[]; -}; -/** - * The styles defined here will be applied to the target marks of mouse events, such as a point mark after the user clicks on it. - */ -export interface EventStyle { - /** color of the marks when mouse events are triggered */ - color?: string; - /** stroke color of the marks when mouse events are triggered */ - stroke?: string; - /** stroke width of the marks when mouse events are triggered */ - strokeWidth?: number; - strokeOpacity?: number; - /** opacity of the marks when mouse events are triggered */ - opacity?: number; - /** Show event effects behind or in front of marks. */ - arrange?: 'behind' | 'front'; -} -export interface Style { - background?: string; - backgroundOpacity?: number; - outline?: string; - outlineWidth?: number; - /** - * Whether to enable smooth paths when drawing curves. - * - * __Default__: `false` - */ - enableSmoothPath?: boolean; - /** - * Specify the pattern of dashes and gaps for `rule` marks. - */ - dashed?: [number, number]; - /** - * Specify the pattern of dashes and gaps for `rule` marks. - */ - linePattern?: { - type: 'triangleLeft' | 'triangleRight'; - size: number; - }; - /** - * Specify the curve of `rule` marks. - */ - curve?: 'top' | 'bottom' | 'left' | 'right'; - /** - * Specify the alignment of marks. - * This property is currently only supported for `triangle` marks. - */ - align?: 'left' | 'right'; - /** - * Offset the position of marks in x direction. - * This property is currently only supported for `text` marks - */ - dx?: number; - /** - * Offset the position of marks in y direction. - * This property is currently only supported for `text` marks. - */ - dy?: number; - /** - * The style of `withinLink` and `betweenLink` marks. __Default__: `'circular'` - * `'elliptical'` will be used as a default option. - */ - linkStyle?: 'elliptical' | 'circular' | 'straight'; - /** - * The minimum height of `withinLink` and `betweenLink` marks. Unit is a percentagle. __Default__: `0.5` - * @Range [0, 1] - */ - linkMinHeight?: number; - /** - * Whether to show vertical lines that connect to the baseline (axis) when `y` and `ye` are both used. __Default__: `false` - */ - withinLinkVerticalLines?: boolean; - /** - * Specify whether to show legend in a single horizontal line? - */ - inlineLegend?: boolean; - /** - * If defined, show legend title on the top or left - */ - legendTitle?: string; - /** - * Specify the font size of `text` marks. - * Can also be specified using the `size` channel option of `text` marks. - */ - textFontSize?: number; - /** - * Specify the stroke of `text` marks. - * Can also be specified using the `stroke` channel option of `text` marks. - */ - textStroke?: string; - /** - * Specify the stroke width of `text` marks. - * Can also be specified using the `strokeWidth` channel option of `text` marks. - */ - textStrokeWidth?: number; - /** Specify the font weight of `text` marks. */ - textFontWeight?: 'bold' | 'normal'; - /** Specify the alignment of `text` marks to a given point. - */ - textAnchor?: 'start' | 'middle' | 'end'; - /** Specify the connetion type of `betweenLink` marks. - * - * __Default__: `"corner"` - */ - linkConnectionType?: 'straight' | 'curve' | 'corner'; - /** - * Determine to show only one side of the diagonal in a HiGlass matrix. __Default__: `"full"` - */ - matrixExtent?: 'full' | 'upper-right' | 'lower-left'; - /** - * Customize visual effects of `mouseOver` events on marks. - */ - mouseOver?: EventStyle; - /** - * Customize visual effects of `rangeSelect` events on marks . - */ - select?: EventStyle; - /** - * Customize the style of the brush mark in the `rangeSelect` mouse event. - */ - brush?: Omit; -} -export type VisibilityCondition = SizeVisibilityCondition | ZoomLevelVisibilityCondition; -interface CommonVisibilityCondition { - /** - * A string that specifies the logical operation to conduct between `threshold` and the `measure` of `target`. - * Support - * - * - greater than : "greater-than", "gt", "GT" - * - * - less than : "less-than", "lt", "LT" - * - * - greater than or equal to : "greater-than-or-equal-to", "gtet", "GTET" - * - * - less than or equal to : "less-than-or-equal-to", "ltet", "LTET" - */ - operation: LogicalOperation; - /** - * Specify the buffer size (in pixel) of width or height when calculating the visibility. - * - * __Default__: `0` - */ - conditionPadding?: number; - /** - * Specify the buffer size (in pixel) of width or height for smooth transition. - * - * __Default__: `0` - */ - transitionPadding?: number; -} -export interface SizeVisibilityCondition extends CommonVisibilityCondition { - /** - * Target specifies the object that you want to compare with the threshold. - */ - target: 'track' | 'mark'; - /** - * Specify which aspect of the `target` will be compared to the `threshold`. - */ - measure: 'width' | 'height'; - /** - * Specify the threshold as one of: - * - * - A number representing a fixed threshold in the unit of pixels; - * - * - `"|xe-x|"`, using the distance between `xe` and `x` as threshold - */ - threshold: number | '|xe-x|'; -} -export interface ZoomLevelVisibilityCondition extends CommonVisibilityCondition { - /** - * Target specifies the object that you want to compare with the threshold. - */ - target: 'track' | 'mark'; - /** - * Specify which aspect of the `target` will be compared to the `threshold`. - */ - measure: 'zoomLevel'; - /** - * Set a threshold in the unit of base pairs (bp) - */ - threshold: number; -} -export type LogicalOperation = 'less-than' | 'lt' | 'LT' | 'greater-than' | 'gt' | 'GT' | 'less-than-or-equal-to' | 'ltet' | 'LTET' | 'greater-than-or-equal-to' | 'gtet' | 'GTET'; -export declare const ChannelTypes: { - readonly x: "x"; - readonly y: "y"; - readonly xe: "xe"; - readonly ye: "ye"; - readonly x1: "x1"; - readonly y1: "y1"; - readonly x1e: "x1e"; - readonly y1e: "y1e"; - readonly color: "color"; - readonly row: "row"; - readonly opacity: "opacity"; - readonly stroke: "stroke"; - readonly strokeWidth: "strokeWidth"; - readonly size: "size"; - readonly text: "text"; -}; -export type ChannelType = keyof typeof ChannelTypes | string; -export type Channel = ChannelDeep | ChannelValue; -export interface AxisCommon { - /** Name of the data field. */ - field?: string; - /** Specify the data type. */ - type?: 'quantitative' | 'nominal' | 'genomic'; - /** Values of the data */ - domain?: ValueExtent | GenomicDomain; - /** Values of the visual channel. */ - range?: ValueExtent; - /** Specify where should the axis be put */ - axis?: AxisPosition; - /** Whether to display legend. __Default__: `false` */ - legend?: boolean; - /** Users need to assign a unique linkingId for [linking views](/docs/user-interaction#linking-views) and [Brushing and Linking](/docs/user-interaction#brushing-and-linking) */ - linkingId?: string; - /** Specify how to aggregate data. __Default__: `undefined` */ - aggregate?: Aggregate; - /** Whether to display grid. __Default__: `false` */ - grid?: boolean; -} -export interface X extends AxisCommon { - type?: 'genomic'; - domain?: GenomicDomain; -} -export interface Y extends AxisCommon { - /** Custom baseline of the y-axis. __Default__: `0` */ - baseline?: string | number; - /** Specify whether to use zero baseline. __Default__: `true` */ - zeroBaseline?: boolean; - /** Whether to flip the y-axis. This is done by inverting the `range` property. __Default__: `false` */ - flip?: boolean; -} -export interface ChannelDeepCommon { - /** Name of the data field */ - field?: string; - /** Specify the data type */ - type?: 'quantitative' | 'nominal' | 'genomic'; - /** Values of the data */ - domain?: ValueExtent; - /** Ranges of visual channel values */ - range?: ValueExtent | Range; -} -export interface Row extends ChannelDeepCommon { - type?: 'nominal'; - domain?: ValueExtent; - /** Determine the start and end position of rendering area of this track along vertical axis. __Default__: `[0, height]` */ - range?: ValueExtent; - /** Whether to display legend. __Default__: `false` */ - legend?: boolean; - /** Determines the size of inner white spaces on the top and bottom of individiual rows. __Default__: `0` */ - padding?: number; - /** Whether to display grid. __Default__: `false` */ - grid?: boolean; - /** Clip row when the actual y value exceeds the max value of the y scale. Used only for bar marks at the moment. __Default__: `true` */ - clip?: boolean; -} -export interface Color extends ChannelDeepCommon { - type?: 'quantitative' | 'nominal'; - domain?: ValueExtent; - /** Determine the colors that should be bound to data value. Default properties are determined considering the field type. */ - range?: Range; - /** Title of the legend. __Default__: `undefined` */ - title?: string; - /** Whether to display legend. __Default__: `false` */ - legend?: boolean; - scale?: 'linear' | 'log'; - /** Whether to use offset of the domain proportionally. This is bound to brushes on the color legend. __Default__: `[0, 1]` */ - scaleOffset?: [number, number]; -} -export interface Stroke extends ChannelDeepCommon { - type?: 'quantitative' | 'nominal'; - domain?: ValueExtent; - range?: Range; - /** Title of the legend. __Default__: `undefined` */ - title?: string; - /** Whether to display legend. __Default__: `false` */ - legend?: boolean; - /** Whether to use offset of the domain proportionally. This is bound to brushes on the color legend. __Default__: `[0, 1]` */ - scaleOffset?: [number, number]; -} -export interface StrokeWidth extends ChannelDeepCommon { - type?: 'quantitative' | 'nominal'; - domain?: ValueExtent; - range?: ValueExtent; -} -export interface Size extends ChannelDeepCommon { - type?: 'quantitative' | 'nominal'; - domain?: ValueExtent; - range?: ValueExtent; - /** not supported: Whether to display legend. __Default__: `false` */ - legend?: boolean; -} -export interface Opacity extends ChannelDeepCommon { - type?: 'quantitative' | 'nominal'; - domain?: ValueExtent; - range?: ValueExtent; -} -export interface Text extends Omit { - type?: 'quantitative' | 'nominal'; - domain?: string[]; - range?: string[]; -} -export type ChannelDeep = X | Y | Row | Color | Size | Stroke | StrokeWidth | Opacity | Text; -export interface ChannelValue { - /** Assign a constant value for a visual channel. */ - value: number | string; -} -export type AxisPosition = 'none' | 'top' | 'bottom' | 'left' | 'right'; -export type FieldType = 'genomic' | 'nominal' | 'quantitative'; -export type ValueExtent = string[] | number[]; -export type GenomicDomain = DomainInterval | DomainChrInterval | DomainChr; -export type Domain = ValueExtent | GenomicDomain; -export type Range = ValueExtent | PredefinedColors; -export type PredefinedColors = 'viridis' | 'grey' | 'spectral' | 'warm' | 'cividis' | 'bupu' | 'rdbu' | 'hot' | 'pink'; -export interface DomainChr { - chromosome: string; -} -export interface DomainChrInterval { - /** If specified, only showing a certain interval in a chromosome. */ - chromosome: string; - interval: [number, number]; -} -export interface DomainInterval { - /** Show a certain interval within entire chromosome */ - interval: [number, number]; -} -export type Aggregate = 'max' | 'min' | 'mean' | 'bin' | 'count'; -export type BinAggregate = 'mean' | 'sum'; -export type DataDeep = JsonData | CsvData | BedData | BigWigData | MultivecData | BeddbData | VectorData | MatrixData | BamData | VcfData | GffData; -/** Values in the form of JSON. */ -export interface Datum { - [k: string]: number | string; -} -/** - * The JSON data format allows users to include data directly in the Gosling's JSON specification. - */ -export interface JsonData { - /** - * Define data type. - */ - type: 'json'; - /** Values in the form of JSON. */ - values: Datum[]; - /** Specify the name of chromosome data fields. */ - chromosomeField?: string; - /** Specify the name of genomic data fields. */ - genomicFields?: string[]; - /** Specify the number of rows loaded from the URL. - * - * __Default:__ `1000` - */ - sampleLength?: number; - /** - * Specify the way of sampling from the data if the number of rows to show exceeds `sampleLength`. - * - * __Default:__ `random` - */ - sampleType?: 'first' | 'random'; - /** experimental */ - genomicFieldsToConvert?: { - chromosomeField: string; - genomicFields: string[]; - }[]; -} -/** - * BED file format - */ -export interface BedData { - type: 'bed'; - /** - * Specify the URL address of the data file. - */ - url: string; - /** - * Specify the URL address of the data file index. - */ - indexUrl: string; - /** - * An array of strings, where each string is the name of a non-standard field in the BED file. - * If there are `n` custom fields, we assume that the last `n` columns of the BED file correspond to the custom fields. - */ - customFields?: string[]; - /** - * Specify the number of rows loaded from the URL. - * - * __Default:__ `1000` - */ - sampleLength?: number; -} -/** - * Any small enough tabular data files, such as tsv, csv, BED, BEDPE, and GFF, can be loaded using "csv" data specification. - */ -export interface CsvData { - type: 'csv'; - /** - * Specify the URL address of the data file. - */ - url: string; - /** - * Specify file separator, __Default:__ ',' - */ - separator?: string; - /** - * Specify the name of chromosome data fields. - */ - chromosomeField?: string; - /** - * Specify the name of genomic data fields. - */ - genomicFields?: string[]; - /** - * Specify the number of rows loaded from the URL. - * - * __Default:__ `1000` - */ - sampleLength?: number; - /** - * Specify the names of data fields if a CSV file does not contain a header. - */ - headerNames?: string[]; - /** - * Specify the chromosome prefix if chromosomes are denoted using a prefix besides "chr" or a number - */ - chromosomePrefix?: string; - /** - * experimental - */ - longToWideId?: string; - /** - * experimental - */ - genomicFieldsToConvert?: { - chromosomeField: string; - genomicFields: string[]; - }[]; -} -/** - * Two-dimensional quantitative values, - * one axis for genomic coordinate and the other for different samples, can be converted into HiGlass' `"multivec"` data. - * For example, multiple BigWig files can be converted into a single multivec file. - * You can also convert sequence data (FASTA) into this format where rows will be different nucleotide bases (e.g., A, T, G, C) - * and quantitative values represent the frequency. Find out more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#multivec-files). - */ -export interface MultivecData { - type: 'multivec'; - /** - * Specify the URL address of the data file. - */ - url: string; - /** - * Assign a field name of the middle position of genomic intervals. __Default__: `"position"` - */ - column?: string; - /** - * Assign a field name of samples. __Default__: `"category"` - */ - row?: string; - /** - * Assign a field name of quantitative values. __Default__: `"value"` - */ - value?: string; - /** - * assign names of individual samples. - */ - categories?: string[]; - /** - * Assign a field name of the start position of genomic intervals. __Default__: `"start"` - */ - start?: string; - /** - * Assign a field name of the end position of genomic intervals. __Default__: `"end"` - */ - end?: string; - /** - * Binning the genomic interval in tiles (unit size: 256). - */ - binSize?: number; - /** Determine aggregation function to apply within bins. __Default__: `"mean"` */ - aggregation?: BinAggregate; -} -export interface BigWigData { - type: 'bigwig'; - /** - * Specify the URL address of the data file. - */ - url: string; - /** - * Assign a field name of the middle position of genomic intervals. __Default__: `"position"` - */ - column?: string; - /** - * Assign a field name of quantitative values. __Default__: `"value"` - */ - value?: string; - /** - * Assign a field name of the start position of genomic intervals. __Default__: `"start"` - */ - start?: string; - /** - * Assign a field name of the end position of genomic intervals. __Default__: `"end"` - */ - end?: string; - /** - * Binning the genomic interval in tiles (unit size: 256). - */ - binSize?: number; - /** Determine aggregation function to apply within bins. __Default__: `"mean"` */ - aggregation?: BinAggregate; -} -/** - * One-dimensional quantitative values along genomic position (e.g., bigwig) can be converted into HiGlass' `"vector"` format data. - * Find out more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#bigwig-files). - */ -export interface VectorData { - type: 'vector'; - /** - * Specify the URL address of the data file. - */ - url: string; - /** Assign a field name of the middle position of genomic intervals. __Default__: `"position"` */ - column?: string; - /** Assign a field name of quantitative values. __Default__: `"value"` */ - value?: string; - /** Assign a field name of the start position of genomic intervals. __Default__: `"start"` */ - start?: string; - /** Assign a field name of the end position of genomic intervals. __Default__: `"end"` */ - end?: string; - /** Binning the genomic interval in tiles (unit size: 256). */ - binSize?: number; - /** Determine aggregation function to apply within bins. __Default__: `"mean"` */ - aggregation?: BinAggregate; -} -/** - * Regular BED or similar files can be pre-aggregated for the scalable data exploration. - * Find our more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#bed-files). - */ -export interface BeddbData { - type: 'beddb'; - /** Specify the URL address of the data file. */ - url: string; - /** Specify the name of genomic data fields. */ - genomicFields: { - index: number; - name: string; - }[]; - /** Specify the column indexes, field names, and field types. */ - valueFields?: { - index: number; - name: string; - type: 'nominal' | 'quantitative'; - }[]; - /** experimental */ - exonIntervalFields?: [{ - index: number; - name: string; - }, { - index: number; - name: string; - }]; -} -/** - * Binary Alignment Map (BAM) is the comprehensive raw data of genome sequencing; - * it consists of the lossless, compressed binary representation of the Sequence Alignment Map-files. - */ -export interface BamData { - type: 'bam'; - /** URL link to the BAM data file */ - url: string; - /** URL link to the index file of the BAM file */ - indexUrl: string; - /** Load mates that are located in the same chromosome. __Default__: `false` */ - loadMates?: boolean; - /** Determine whether to extract exon-to-exon junctions. __Default__: `false` */ - extractJunction?: boolean; - /** Determine the threshold of coverage when extracting exon-to-exon junctions. __Default__: `1` */ - junctionMinCoverage?: number; - /** Determines the threshold of insert sizes for determining the structural variants. __Default__: `5000` */ - maxInsertSize?: number; -} -/** - * Generic Feature Format Version 3 (GFF3) format data. It parses files that follow the - * [GFF3 specification](https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md). - */ -export interface GffData { - type: 'gff'; - /** URL link to the GFF file */ - url: string; - /** URL link to the tabix index file */ - indexUrl: string; - /** The maximum number of samples to be shown on the track. Samples are uniformly randomly selected so that this - * threshold is not exceeded. __Default:__ `1000` */ - sampleLength?: number; - /** - * Specifies which attributes to include as a fields. - * GFF files have an "attributes" column which contains a list of attributes which are each tag-value pairs (`tag=value`). - * This option allows for specific attributes to be accessible as a field. For example, if you have an attribute called - * "gene_name" and you want label features on your track using those values, you can use this option so that you can use - * `"field": "gene_name"` in the schema. - * - * If there is a single `value` corresponding to the `tag`, Gosling will parse that value as a string. If there are - * multiple `value`s corresponding to a `tag`, Gosling will parse it as a comma-separated list string. If a feature - * does not have a particular attribute, then the attribute value will be set to the `defaultValue`. - */ - attributesToFields?: { - attribute: string; - defaultValue: string; - }[]; -} -/** - * The Variant Call Format (VCF). - */ -export interface VcfData { - type: 'vcf'; - /** URL link to the VCF file */ - url: string; - /** URL link to the tabix index file */ - indexUrl: string; - /** The maximum number of rows to be loaded from the URL. __Default:__ `1000` */ - sampleLength?: number; -} -export interface MatrixData { - type: 'matrix'; - /** URL link to the matrix data file */ - url: string; - /** The name of the first genomic field. __Default__: `x` */ - column?: string; - /** The name of the first genomic field. __Default__: `y` */ - row?: string; - /** The name of the value field. __Default__: `value` */ - value?: string; - /** Determine the number of nearby cells to aggregate. __Default__: `1` */ - binSize?: number; -} -export type DataTransform = FilterTransform | StrConcatTransform | StrReplaceTransform | LogTransform | DisplaceTransform | ExonSplitTransform | GenomicLengthTransform | SvTypeTransform | CoverageTransform | JsonParseTransform; -export type FilterTransform = OneOfFilter | RangeFilter | IncludeFilter; -interface CommonFilterTransform { - type: 'filter'; - /** A filter is applied based on the values of the specified data field */ - field: string; - /** - * when `{"not": true}`, apply a NOT logical operation to the filter. - * - * __Default:__ `false` */ - not?: boolean; -} -export interface RangeFilter extends CommonFilterTransform { - /** Check whether the value is in a number range. */ - inRange: number[]; -} -export interface IncludeFilter extends CommonFilterTransform { - /** Check whether the value includes a substring. */ - include: string; -} -export interface OneOfFilter extends CommonFilterTransform { - /** Check whether the value is an element in the provided list. */ - oneOf: (string | number | null)[]; -} -export interface ComparisonFilter extends CommonFilterTransform { - /** - * The second field to compare the value with. - */ - field2: string; - /** - * A logical operation to apply between two fields. - */ - operation: LogicalOperation; - not: undefined; -} -export type LogBase = number | 'e'; -export interface LogTransform { - type: 'log'; - field: string; - /** If not specified, 10 is used. */ - base?: LogBase; - /** If specified, store transformed values in a new field. */ - newField?: string; -} -export interface StrConcatTransform { - type: 'concat'; - fields: string[]; - newField: string; - separator: string; -} -export interface StrReplaceTransform { - type: 'replace'; - field: string; - newField: string; - replace: { - from: string; - to: string; - }[]; -} -export interface DisplaceTransform { - type: 'displace'; - boundingBox: { - /** The name of a quantitative field that represents the start position. */ - startField: string; - /** The name of a quantitative field that represents the end position. */ - endField: string; - /** The padding around visual lements. Either px or bp */ - padding?: number; - /** Whether to consider `padding` as the bp length. */ - isPaddingBP?: boolean; - /** The name of a nominal field to group rows by in prior to piling-up. */ - groupField?: string; - }; - /** A string that specifies the type of displacement. */ - method: DisplacementType; - newField: string; - /** Specify maximum rows to be generated (default has no limit). */ - maxRows?: number; -} -export interface ExonSplitTransform { - type: 'exonSplit'; - separator: string; - flag: { - field: string; - value: number | string; - }; - fields: { - field: string; - type: FieldType; - newField: string; - chrField: string; - }[]; -} -/** - * Calculate genomic length using two genomic fields - */ -export interface GenomicLengthTransform { - type: 'genomicLength'; - startField: string; - endField: string; - newField: string; -} -/** - * Based on the BEDPE, infer SV types. - * SV types are specified as one of the following strings: DUP, TRA, DEL, t2tINV, h2hINV. - */ -type BpFields = { - chrField: string; - posField: string; - strandField: string; -}; -export interface SvTypeTransform { - type: 'svType'; - firstBp: BpFields; - secondBp: BpFields; - newField: string; -} -/** - * Aggregate rows and calculate coverage - */ -export interface CoverageTransform { - type: 'coverage'; - startField: string; - endField: string; - newField?: string; - /** The name of a nominal field to group rows by in prior to piling-up */ - groupField?: string; -} -/** - * Parse JSON Object Array and append vertically - */ -export interface JsonParseTransform { - type: 'subjson'; - /** The field that contains the JSON object array. */ - field: string; - /** Base genomic position when parsing relative position. */ - baseGenomicField: string; - /** Relative genomic position to parse. */ - genomicField: string; - /** Length of genomic interval. */ - genomicLengthField: string; -} -/** - * Template specification that will be internally converted into `SingleTrack` for rendering. - */ -export interface TemplateTrack extends CommonTrackDef { - template: string; - data: DataDeep; - encoding?: { - [k: string]: Channel; - }; -} -/** - * Definition of Track Templates. - */ -export interface TemplateTrackDef { - name: string; - channels: CustomChannelDef[]; - mapping: TemplateTrackMappingDef[]; -} -/** - * Definition of custom channels used in a track template. - */ -export interface CustomChannelDef { - name: string; - type: FieldType | 'value'; - required?: boolean; -} -export type DataTransformWithBase = Partial & { - base?: string; -}; -/** - * This is based on `SingleTrack` but the differences are only the type of channels - * which additionally have `base` properties to override properties from a template spec - * and remove of certain properties (e.g., `data`) - */ -export type TemplateTrackMappingDef = Omit & { - dataTransform?: DataTransformWithBase[]; - tooltip?: Tooltip[]; - mark: Mark; - x?: ChannelWithBase; - y?: ChannelWithBase; - xe?: ChannelWithBase; - ye?: ChannelWithBase; - x1?: ChannelWithBase; - y1?: ChannelWithBase; - x1e?: ChannelWithBase; - y1e?: ChannelWithBase; - row?: ChannelWithBase; - color?: ChannelWithBase; - size?: ChannelWithBase; - text?: ChannelWithBase; - stroke?: ChannelWithBase; - strokeWidth?: ChannelWithBase; - opacity?: ChannelWithBase; - displacement?: Displacement; - visibility?: VisibilityCondition[]; - flipY?: boolean; - stretch?: boolean; - overrideTemplate?: boolean; -}; -export type ChannelWithBase = Channel & { - base?: string; -}; -export {}; -//# sourceMappingURL=gosling.schema.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-schema/gosling.schema.d.ts.map b/dist/src/gosling-schema/gosling.schema.d.ts.map deleted file mode 100644 index 62bb6c54..00000000 --- a/dist/src/gosling-schema/gosling.schema.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gosling.schema.d.ts","sourceRoot":"","sources":["../../../src/gosling-schema/gosling.schema.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GACjB,CAAC,sBAAsB,GAAG,0BAA0B,CAAC,GACrD,CAAC,yBAAyB,GAAG,6BAA6B,CAAC,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7E,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IACl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ACrB,EAAE,CAAC,EAAE,eAAe,CAAC;IAErB,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,GAAG,CAAC,EAAE,eAAe,CAAC;IAEtB,GAAG,CAAC,EAAE,eAAe,CAAC;IAEtB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,IAAI,CAAC,EAAE,eAAe,CAAC;IAEvB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,OAAO,CAAC,EAAE,eAAe,CAAC;IAG1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAG5B,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAInC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-schema/gosling.schema.guards.d.ts b/dist/src/gosling-schema/gosling.schema.guards.d.ts deleted file mode 100644 index b7f5a759..00000000 --- a/dist/src/gosling-schema/gosling.schema.guards.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -import type { ChannelDeep, ChannelValue, DataDeep, Datum, DomainChr, DomainInterval, DomainChrInterval, Style, Track, SingleTrack, OverlaidTrack, ChannelTypes, Channel, FieldType, Domain, FilterTransform, OneOfFilter, RangeFilter, IncludeFilter, BeddbData, MultivecData, MatrixData, VectorData, DataTrack, BigWigData, SingleView, FlatTracks, OverlaidTracks, StackedTracks, BamData, Range, TemplateTrack, MouseEventsDeep, DataTransform, DummyTrack } from './gosling.schema'; -import type { TabularDataFetcher } from '@data-fetchers'; -export declare const PREDEFINED_COLOR_STR_MAP: { - [k: string]: (t: number) => string; -}; -export declare function isObject(x: unknown): x is Record; -export declare function isTabularDataFetcher(dataFetcher: unknown): dataFetcher is TabularDataFetcher; -export declare function hasDataTransform(spec: SingleTrack | OverlaidTrack, type: DataTransform['type']): boolean; -/** - * This returns an array of color strings that can be assigned to HiGlass' option, `colorRange` - */ -export declare function getHiGlassColorRange(colorStr?: string, step?: number): string[]; -export declare function IsFlatTracks(_: SingleView): _ is FlatTracks; -export declare function IsOverlaidTracks(_: SingleView): _ is OverlaidTracks; -export declare function IsStackedTracks(_: SingleView): _ is StackedTracks; -export declare function IsDataTrack(_: Track): _ is DataTrack; -export declare function IsDummyTrack(_: Track): _ is DummyTrack; -export declare function IsDataTemplate(_: Partial): boolean; -export declare function IsDataDeep(data: DataDeep | Datum[]): data is DataDeep; -export declare function IsDomainFlat(domain: Domain): domain is string[] | number[]; -export declare function IsDomainChr(domain: Domain): domain is DomainChr; -export declare function IsDomainInterval(domain: Domain): domain is DomainInterval; -export declare function IsDomainChrInterval(domain: Domain): domain is DomainChrInterval; -export declare function IsTrackStyle(track: Style | undefined): track is Style; -export declare function IsSingleTrack(track: Track): track is SingleTrack; -export declare function IsOverlaidTrack(track: Partial): track is OverlaidTrack; -export declare function IsTemplateTrack(track: Partial): track is TemplateTrack; -/** - * Is this a vertical rule, i.e., y genomic axis? - */ -export declare function IsVerticalRule(track: Track): boolean; -/** - * Is this 2D track, i.e., two genomic axes? - */ -export declare function Is2DTrack(track: Track): boolean; -/** - * Do we want to use HiGlass matrix track (i.e., 'heatmap') to rendering the given visualization? - */ -export declare function IsHiGlassMatrix(track: SingleTrack): false | ChannelValue | import("./gosling.schema").Y | undefined; -export declare function IsChannelValue(channel: ChannelDeep | ChannelValue | undefined | 'none'): channel is ChannelValue; -export declare function IsDataDeepTileset(_: DataDeep | undefined): _ is BeddbData | VectorData | MultivecData | BigWigData | BamData | MatrixData; -/** - * Checks if a channel is of type ChannelDeep - */ -export declare function IsChannelDeep(channel: ChannelDeep | ChannelValue | undefined): channel is ChannelDeep; -export declare function IsOneOfFilter(_: FilterTransform): _ is OneOfFilter; -export declare function IsRangeFilter(_: FilterTransform): _ is RangeFilter; -export declare function IsIncludeFilter(_: FilterTransform): _ is IncludeFilter; -/** - * Check whether domain is in array shape. - */ -export declare function IsDomainArray(domain?: Domain): domain is string[] | number[]; -/** - * Check whether range is in array shape. - */ -export declare function IsRangeArray(range?: Range): range is string[] | number[]; -/** - * Check whether visual marks can be stacked on top of each other. - */ -export declare function IsStackedMark(track: SingleTrack): boolean; -/** - * Check whether visual marks in this channel are stacked on top of each other. - * For example, `area` marks with a `quantitative` `y` channel are being stacked. - */ -export declare function IsStackedChannel(track: SingleTrack, channelKey: keyof typeof ChannelTypes): boolean; -/** - * Retreive value using a `channel`. - * `undefined` if unable to retreive the value. - */ -export declare function getValueUsingChannel(datum: { - [k: string]: string | number; -}, channel: Channel): string | number | undefined; -export declare function getChannelKeysByAggregateFnc(spec: SingleTrack): ("x" | "y" | "xe" | "ye" | "x1" | "y1" | "x1e" | "y1e" | "row" | "color" | "size" | "text" | "stroke" | "strokeWidth" | "opacity")[]; -/** - * Get channel keys by a field type. - */ -export declare function getChannelKeysByType(spec: SingleTrack, t: FieldType): ("x" | "y" | "xe" | "ye" | "x1" | "y1" | "x1e" | "y1e" | "row" | "color" | "size" | "text" | "stroke" | "strokeWidth" | "opacity")[]; -export declare function IsXAxis(_: Track): boolean; -export declare function IsYAxis(_: Track): boolean; -export declare function IsMouseEventsDeep(_?: boolean | MouseEventsDeep): _ is MouseEventsDeep; -//# sourceMappingURL=gosling.schema.guards.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-schema/gosling.schema.guards.d.ts.map b/dist/src/gosling-schema/gosling.schema.guards.d.ts.map deleted file mode 100644 index 5abd4691..00000000 --- a/dist/src/gosling-schema/gosling.schema.guards.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gosling.schema.guards.d.ts","sourceRoot":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GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,SAAS,wIASnE;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,WAe/B;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,WAe/B;AAID,wBAAgB,iBAAiB,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,eAAe,GAAG,CAAC,IAAI,eAAe,CAErF"} \ No newline at end of file diff --git a/dist/src/gosling-schema/index.d.ts b/dist/src/gosling-schema/index.d.ts deleted file mode 100644 index b6a7830b..00000000 --- a/dist/src/gosling-schema/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './gosling.schema'; -export * from './gosling.schema.guards'; -export * from './validate'; -export { default as ThemeSchema } from './theme.schema.json'; -export { default as GoslingSchema } from './gosling.schema.json'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-schema/index.d.ts.map b/dist/src/gosling-schema/index.d.ts.map deleted file mode 100644 index 281dc4d7..00000000 --- a/dist/src/gosling-schema/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gosling-schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-schema/validate.d.ts b/dist/src/gosling-schema/validate.d.ts deleted file mode 100644 index e3481f5f..00000000 --- a/dist/src/gosling-schema/validate.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { SingleTrack, ChannelDeep, OverlaidTrack, Track } from './gosling.schema'; -export interface Validity { - message: string; - state: 'success' | 'warn' | 'error'; - details?: string; -} -export declare function validateGoslingSpec(spec: any): Validity; -/** - * - */ -export declare function validateSpec(schema: any, spec: any, silence?: boolean): Validity; -export declare function validateTrack(track: Track): { - valid: boolean; - errorMessages: string[]; -}; -/** - * Find an axis channel that is encoded with genomic coordinate. - * `undefined` if not found. - */ -export declare function getGenomicChannelFromTrack(track: SingleTrack | OverlaidTrack): ChannelDeep | undefined; -/** - * Find an axis channel that is encoded with genomic coordinate and return 'x' or 'y'. - * `undefined` if not found. - */ -export declare function getGenomicChannelKeyFromTrack(track: SingleTrack | OverlaidTrack): 'x' | 'xe' | 'y' | 'ye' | 'x1' | 'y1' | 'x1e' | 'y1e' | undefined; -//# sourceMappingURL=validate.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-schema/validate.d.ts.map b/dist/src/gosling-schema/validate.d.ts.map deleted file mode 100644 index a92951d3..00000000 --- a/dist/src/gosling-schema/validate.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/gosling-schema/validate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAgB,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAKrG,MAAM,WAAW,QAAQ;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,GAAG,QAAQ,CAEvD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,UAAQ,GAAG,QAAQ,CAkB9E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK;;;EAgCzC;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAUtG;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CACzC,KAAK,EAAE,WAAW,GAAG,aAAa,GACnC,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAUnE"} \ No newline at end of file diff --git a/dist/src/gosling-theme/dark.d.ts b/dist/src/gosling-theme/dark.d.ts deleted file mode 100644 index bb053b70..00000000 --- a/dist/src/gosling-theme/dark.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ThemeDeep } from 'src/core/utils/theme'; -export declare const dark: ThemeDeep; -//# sourceMappingURL=dark.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/dark.d.ts.map b/dist/src/gosling-theme/dark.d.ts.map deleted file mode 100644 index fe2bd41f..00000000 --- a/dist/src/gosling-theme/dark.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/dark.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAgBtD,eAAO,MAAM,IAAI,EAAE,SAmGlB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/ensembl.d.ts b/dist/src/gosling-theme/ensembl.d.ts deleted file mode 100644 index 90acf0a3..00000000 --- a/dist/src/gosling-theme/ensembl.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ThemeDeep } from 'src/core/utils/theme'; -export declare const ensembl: ThemeDeep; -//# sourceMappingURL=ensembl.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/ensembl.d.ts.map b/dist/src/gosling-theme/ensembl.d.ts.map deleted file mode 100644 index 2aabfd58..00000000 --- a/dist/src/gosling-theme/ensembl.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ensembl.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/ensembl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAwBtD,eAAO,MAAM,OAAO,EAAE,SAgKrB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/excel.d.ts b/dist/src/gosling-theme/excel.d.ts deleted file mode 100644 index 49d58267..00000000 --- a/dist/src/gosling-theme/excel.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ThemeDeep } from 'src/core/utils/theme'; -export declare const excel: ThemeDeep; -//# sourceMappingURL=excel.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/excel.d.ts.map b/dist/src/gosling-theme/excel.d.ts.map deleted file mode 100644 index 1f726da7..00000000 --- a/dist/src/gosling-theme/excel.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"excel.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/excel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAyBtD,eAAO,MAAM,KAAK,EAAE,SAmGnB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/ggplot.d.ts b/dist/src/gosling-theme/ggplot.d.ts deleted file mode 100644 index e8636bc3..00000000 --- a/dist/src/gosling-theme/ggplot.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ThemeDeep } from 'src/core/utils/theme'; -export declare const ggplot: ThemeDeep; -//# sourceMappingURL=ggplot.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/ggplot.d.ts.map b/dist/src/gosling-theme/ggplot.d.ts.map deleted file mode 100644 index e65be9cc..00000000 --- a/dist/src/gosling-theme/ggplot.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ggplot.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/ggplot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,MAAM,EAAE,SAmGpB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/google.d.ts b/dist/src/gosling-theme/google.d.ts deleted file mode 100644 index 223a718a..00000000 --- a/dist/src/gosling-theme/google.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ThemeDeep } from 'src/core/utils/theme'; -export declare const google: ThemeDeep; -//# sourceMappingURL=google.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/google.d.ts.map b/dist/src/gosling-theme/google.d.ts.map deleted file mode 100644 index cf1b16bc..00000000 --- a/dist/src/gosling-theme/google.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/google.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,MAAM,EAAE,SAmGpB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/igv.d.ts b/dist/src/gosling-theme/igv.d.ts deleted file mode 100644 index 392ac7a9..00000000 --- a/dist/src/gosling-theme/igv.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ThemeDeep } from 'src/core/utils/theme'; -export declare const igv: ThemeDeep; -//# sourceMappingURL=igv.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/igv.d.ts.map b/dist/src/gosling-theme/igv.d.ts.map deleted file mode 100644 index 701f0b65..00000000 --- a/dist/src/gosling-theme/igv.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"igv.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/igv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,GAAG,EAAE,SAoGjB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/index.d.ts b/dist/src/gosling-theme/index.d.ts deleted file mode 100644 index f5f53619..00000000 --- a/dist/src/gosling-theme/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export declare const Themes: { - light: import("../core/utils/theme").ThemeDeep; - dark: import("../core/utils/theme").ThemeDeep; - warm: import("../core/utils/theme").ThemeDeep; - ggplot: import("../core/utils/theme").ThemeDeep; - igv: import("../core/utils/theme").ThemeDeep; - ensembl: import("../core/utils/theme").ThemeDeep; - jbrowse: import("../core/utils/theme").ThemeDeep; - ucsc: import("../core/utils/theme").ThemeDeep; - washu: import("../core/utils/theme").ThemeDeep; - excel: import("../core/utils/theme").ThemeDeep; - google: import("../core/utils/theme").ThemeDeep; -}; -export declare function isThereTheme(key: string): boolean; -export declare function getTheme(key: string): any; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/index.d.ts.map b/dist/src/gosling-theme/index.d.ts.map deleted file mode 100644 index 513c55a0..00000000 --- a/dist/src/gosling-theme/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/index.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,MAAM;;;;;;;;;;;;CAYlB,CAAC;AAEF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,WAEvC;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,OAEnC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/jbrowse.d.ts b/dist/src/gosling-theme/jbrowse.d.ts deleted file mode 100644 index 640df38b..00000000 --- a/dist/src/gosling-theme/jbrowse.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ThemeDeep } from 'src/core/utils/theme'; -export declare const jbrowse: ThemeDeep; -//# sourceMappingURL=jbrowse.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/jbrowse.d.ts.map b/dist/src/gosling-theme/jbrowse.d.ts.map deleted file mode 100644 index e9ab5cfe..00000000 --- a/dist/src/gosling-theme/jbrowse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"jbrowse.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/jbrowse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,OAAO,EAAE,SAmGrB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/light.d.ts b/dist/src/gosling-theme/light.d.ts deleted file mode 100644 index 47064394..00000000 --- a/dist/src/gosling-theme/light.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ThemeDeep } from 'src/core/utils/theme'; -export declare const light: ThemeDeep; -//# sourceMappingURL=light.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/light.d.ts.map b/dist/src/gosling-theme/light.d.ts.map deleted file mode 100644 index b82b62ae..00000000 --- a/dist/src/gosling-theme/light.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/light.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,KAAK,EAAE,SAqGnB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/test.d.ts b/dist/src/gosling-theme/test.d.ts deleted file mode 100644 index 37265f0f..00000000 --- a/dist/src/gosling-theme/test.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export declare const test: { - base: string; - root: { - background: string; - }; - axis: { - baselineColor: string; - tickColor: string; - labelColor: string; - gridColor: string; - }; - point: { - size: number; - }; -}; -//# sourceMappingURL=test.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/test.d.ts.map b/dist/src/gosling-theme/test.d.ts.map deleted file mode 100644 index 433e75d4..00000000 --- a/dist/src/gosling-theme/test.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/test.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;CAchB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/ucsc.d.ts b/dist/src/gosling-theme/ucsc.d.ts deleted file mode 100644 index 38772808..00000000 --- a/dist/src/gosling-theme/ucsc.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ThemeDeep } from 'src/core/utils/theme'; -export declare const ucsc: ThemeDeep; -//# sourceMappingURL=ucsc.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/ucsc.d.ts.map b/dist/src/gosling-theme/ucsc.d.ts.map deleted file mode 100644 index 9030febb..00000000 --- a/dist/src/gosling-theme/ucsc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ucsc.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/ucsc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA4BtD,eAAO,MAAM,IAAI,EAAE,SAmGlB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/warm.d.ts b/dist/src/gosling-theme/warm.d.ts deleted file mode 100644 index 1fd97810..00000000 --- a/dist/src/gosling-theme/warm.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ThemeDeep } from 'src/core/utils/theme'; -export declare const warm: ThemeDeep; -//# sourceMappingURL=warm.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/warm.d.ts.map b/dist/src/gosling-theme/warm.d.ts.map deleted file mode 100644 index 0e1819df..00000000 --- a/dist/src/gosling-theme/warm.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"warm.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/warm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AActD,eAAO,MAAM,IAAI,EAAE,SA4ElB,CAAC"} \ No newline at end of file diff --git a/dist/src/gosling-theme/washu.d.ts b/dist/src/gosling-theme/washu.d.ts deleted file mode 100644 index 11c9abe9..00000000 --- a/dist/src/gosling-theme/washu.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { ThemeDeep } from 'src/core/utils/theme'; -export declare const washu: ThemeDeep; -//# sourceMappingURL=washu.d.ts.map \ No newline at end of file diff --git a/dist/src/gosling-theme/washu.d.ts.map b/dist/src/gosling-theme/washu.d.ts.map deleted file mode 100644 index 7991ac9c..00000000 --- a/dist/src/gosling-theme/washu.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"washu.d.ts","sourceRoot":"","sources":["../../../src/gosling-theme/washu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAuBtD,eAAO,MAAM,KAAK,EAAE,SAkGnB,CAAC"} \ No newline at end of file diff --git a/dist/src/higlass-schema/higlass.schema.d.ts b/dist/src/higlass-schema/higlass.schema.d.ts deleted file mode 100644 index 8fb86e9d..00000000 --- a/dist/src/higlass-schema/higlass.schema.d.ts +++ /dev/null @@ -1,148 +0,0 @@ -import type { Assembly, FilterTransform } from '@gosling-lang/gosling-schema'; -export interface HiGlassSpec { - editable?: boolean; - zoomFixed?: boolean; - viewEditable?: boolean; - tracksEditable?: boolean; - compactLayout?: boolean; - trackSourceServers?: string[]; - exportViewUrl?: string; - chromInfoPath?: string; - views: View[]; - zoomLocks: GenericLocks; - locationLocks: GenericLocks; - valueScaleLocks?: ValueScaleLocks; -} -export interface View { - uid?: string; - initialXDomain?: number[]; - initialYDomain?: number[]; - zoomLimits?: [number | null, number | null]; - autocompleteSource?: string; - genomePositionSearchBox?: GenomePositionSearchBox; - genomePositionSearchBoxVisible?: boolean; - chromInfoPath?: string; - tracks: Tracks; - layout: Layout; - overlays?: Overlay[]; - selectionView?: boolean; - zoomFixed?: boolean; -} -export interface GenomePositionSearchBox { - chromInfoId: string; - chromInfoServer: string; - autocompleteId?: string; - autocompleteServer?: string; - visible?: boolean; -} -export interface Tracks { - top: Track[]; - left: Track[]; - center: Track[]; - right: Track[]; - bottom: Track[]; - gallery: Track[]; - whole: Track[]; -} -export type Track = HeatmapTrack | CombinedTrack | IndependentViewportProjectionTrack | EnumTrack; -export interface HeatmapTrack { - type: 'heatmap'; - uid?: string; - data?: Data; - server?: string; - tilesetUid?: string; - position?: string; - width?: number; - height?: number; - options?: any; -} -export interface CombinedTrack { - type: 'combined'; - contents: Track[]; - uid?: string; - width?: number; - height?: number; - position?: string; - options?: any; -} -export interface IndependentViewportProjectionTrack { - type: 'viewport-projection-horizontal' | 'viewport-projection-vertical' | 'viewport-projection-center'; - uid?: string; - fromViewUid?: null; - projectionXDomain?: number[]; - projectionYDomain?: number[]; - transforms?: any[]; - width?: number; - x?: number; - y?: number; - options?: any; -} -export interface EnumTrack { - type: EnumTrackType; - uid?: string; - server?: string; - tilesetUid?: string; - chromInfoPath?: string; - data?: Data; - fromViewUid?: null | string; - width?: number; - height?: number; - x?: number; - y?: number; - options?: any; -} -export interface Data { - type?: string; - children?: any[]; - tiles?: any; - tilesetInfo?: any; - url?: string; - assembly?: Assembly; - urlFetchOptions?: RequestInit; - indexUrl?: string; - indexUrlFetchOptions?: RequestInit; - filter?: FilterTransform[]; -} -export interface RequestInit { - headers?: Record; -} -export interface Overlay { - uid?: string; - type?: string; - chromInfoPath?: string; - includes?: any[]; - options?: OverlayOptions; -} -export interface OverlayOptions { - extent?: any[]; - fill?: string; - fillOpacity?: number; - minWidth?: number; - outline?: string; - outlineOpacity?: number; - outlinePos?: any[] | string; - outlineWidth?: number; - stroke?: string; - strokeOpacity?: number; - strokePos?: any[] | string; - strokeWidth?: number; -} -export interface Layout { - h: number; - w: number; - x: number; - y: number; -} -export interface GenericLocks { - locksByViewUid: LocksByViewUid; - locksDict: any; -} -export interface LocksByViewUid { - [k: string]: string; -} -export interface ValueScaleLocks { - locksByViewUid: LocksByViewUid; - locksDict?: any; -} -export type EnumTrackType = 'heatmap' | '2d-annotations' | '2d-chromosome-annotations' | '2d-chromosome-grid' | '2d-chromosome-labels' | '2d-rectangle-domains' | '2d-tiles' | 'arrowhead-domains' | 'bedlike' | 'cross-rule' | 'dummy' | 'horizontal-1d-annotations' | 'horizontal-1d-heatmap' | 'horizontal-1d-tiles' | 'horizontal-1d-value-interval' | 'horizontal-2d-rectangle-domains' | 'horizontal-bar' | 'horizontal-chromosome-grid' | 'horizontal-chromosome-labels' | 'horizontal-divergent-bar' | 'horizontal-gene-annotations' | 'horizontal-heatmap' | 'horizontal-line' | 'horizontal-multivec' | 'horizontal-point' | 'horizontal-rule' | 'horizontal-vector-heatmap' | 'image-tiles' | 'left-axis' | 'left-stacked-interval' | 'mapbox-tiles' | 'osm-2d-tile-ids' | 'osm-tiles' | 'raster-tiles' | 'simple-svg' | 'square-markers' | 'top-axis' | 'top-stacked-interval' | 'vertical-1d-annotations' | 'vertical-1d-heatmap' | 'vertical-1d-tiles' | 'vertical-1d-value-interval' | 'vertical-2d-rectangle-domains' | 'vertical-bar' | 'vertical-bedlike' | 'vertical-chromosome-grid' | 'vertical-chromosome-labels' | 'vertical-gene-annotations' | 'vertical-heatmap' | 'vertical-line' | 'vertical-multivec' | 'vertical-point' | 'vertical-rule' | 'vertical-vector-heatmap' | 'viewport-projection-center' | 'viewport-projection-horizontal' | 'viewport-projection-vertical' | 'gosling-track' | 'gosling-2d-track' | 'axis-track' | 'text' | 'dummy-track'; -//# sourceMappingURL=higlass.schema.d.ts.map \ No newline at end of file diff --git a/dist/src/higlass-schema/higlass.schema.d.ts.map b/dist/src/higlass-schema/higlass.schema.d.ts.map deleted file mode 100644 index 0e8a7436..00000000 --- a/dist/src/higlass-schema/higlass.schema.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"higlass.schema.d.ts","sourceRoot":"","sources":["../../../src/higlass-schema/higlass.schema.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAK9E,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,EAAE,OAA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AC9B,iCAAiC,GACjC,gBAAgB,GAChB,4BAA4B,GAC5B,8BAA8B,GAC9B,0BAA0B,GAC1B,6BAA6B,GAC7B,oBAAoB,GACpB,iBAAiB,GACjB,qBAAqB,GACrB,kBAAkB,GAClB,iBAAiB,GACjB,2BAA2B,GAC3B,aAAa,GACb,WAAW,GACX,uBAAuB,GACvB,cAAc,GACd,iBAAiB,GACjB,WAAW,GACX,cAAc,GACd,YAAY,GACZ,gBAAgB,GAChB,UAAU,GACV,sBAAsB,GACtB,yBAAyB,GACzB,qBAAqB,GACrB,mBAAmB,GACnB,4BAA4B,GAC5B,+BAA+B,GAC/B,cAAc,GACd,kBAAkB,GAClB,0BAA0B,GAC1B,4BAA4B,GAC5B,2BAA2B,GAC3B,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,gBAAgB,GAChB,eAAe,GACf,yBAAyB,GACzB,4BAA4B,GAC5B,gCAAgC,GAChC,8BAA8B,GAE9B,eAAe,GACf,kBAAkB,GAClB,YAAY,GACZ,MAAM,GACN,aAAa,CAAC"} \ No newline at end of file diff --git a/dist/src/higlass-schema/index.d.ts b/dist/src/higlass-schema/index.d.ts deleted file mode 100644 index 3bac49a4..00000000 --- a/dist/src/higlass-schema/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './higlass.schema'; -export { default as HiGlassSchema } from './higlass.schema.json'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/higlass-schema/index.d.ts.map b/dist/src/higlass-schema/index.d.ts.map deleted file mode 100644 index cf47a642..00000000 --- a/dist/src/higlass-schema/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/higlass-schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC"} \ No newline at end of file diff --git a/dist/src/index.d.ts b/dist/src/index.d.ts deleted file mode 100644 index a020c5dd..00000000 --- a/dist/src/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export { name, version } from '../package.json'; -import { GoslingSchema, ThemeSchema } from '@gosling-lang/gosling-schema'; -export { GoslingSchema, ThemeSchema }; -export type { GoslingSpec, TemplateTrackDef } from '@gosling-lang/gosling-schema'; -export type { HiGlassSpec } from '@gosling-lang/higlass-schema'; -export { GoslingTemplates } from './core/utils/template'; -export type { Theme } from './core/utils/theme'; -export { Themes, isThereTheme, getTheme } from '@gosling-lang/gosling-theme'; -export { init } from './core/init'; -export { compile } from './compiler/compile'; -export { validateGoslingSpec } from '@gosling-lang/gosling-schema'; -export { GoslingComponent } from './core/gosling-component'; -export type { GoslingRef } from './core/gosling-component'; -export { embed } from './core/gosling-embed'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/index.d.ts.map b/dist/src/index.d.ts.map deleted file mode 100644 index ca672083..00000000 --- a/dist/src/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAClF,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/dummy-track/dummy-track.d.ts b/dist/src/tracks/dummy-track/dummy-track.d.ts deleted file mode 100644 index 98ee8977..00000000 --- a/dist/src/tracks/dummy-track/dummy-track.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// -import { type DummyTrackStyle } from '@gosling-lang/gosling-schema'; -interface DummyTrackOptions extends DummyTrackStyle { - title: string; - height: number; - width: number; -} -declare const _default: (new (HGC: import("@higlass/types").HGC, context: import("@higlass/tracks").Context, options: DummyTrackOptions) => import("@higlass/tracks").Track) & { - config: import("@higlass/tracks").TrackConfig; -} & { - config: { - availableOptions: (keyof DummyTrackOptions)[]; - }; -}; -export default _default; -//# sourceMappingURL=dummy-track.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/dummy-track/dummy-track.d.ts.map b/dist/src/tracks/dummy-track/dummy-track.d.ts.map deleted file mode 100644 index 085cea88..00000000 --- a/dist/src/tracks/dummy-track/dummy-track.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dummy-track.d.ts","sourceRoot":"","sources":["../../../../src/tracks/dummy-track/dummy-track.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,UAAU,iBAAkB,SAAQ,eAAe;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB;;;;;;;;AA6DD,wBAAkD"} \ No newline at end of file diff --git a/dist/src/tracks/dummy-track/index.d.ts b/dist/src/tracks/dummy-track/index.d.ts deleted file mode 100644 index 7b38bb88..00000000 --- a/dist/src/tracks/dummy-track/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default as DummyTrack } from './dummy-track'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/dummy-track/index.d.ts.map b/dist/src/tracks/dummy-track/index.d.ts.map deleted file mode 100644 index ee8f729f..00000000 --- a/dist/src/tracks/dummy-track/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tracks/dummy-track/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/brush-track.d.ts b/dist/src/tracks/gosling-brush/brush-track.d.ts deleted file mode 100644 index a205a2dc..00000000 --- a/dist/src/tracks/gosling-brush/brush-track.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -declare function BrushTrack(HGC: any, ...args: any[]): any; -declare namespace BrushTrack { - var config: { - type: string; - datatype: string[]; - local: boolean; - projection: boolean; - orientation: string; - thumbnail: HTMLElement; - availableOptions: string[]; - defaultOptions: { - innerRadius: number; - outerRadius: number; - startAngle: number; - endAngle: number; - axisPositionHorizontal: string; - projectionFillColor: string; - projectionStrokeColor: string; - projectionFillOpacity: number; - projectionStrokeOpacity: number; - strokeWidth: number; - }; - }; -} -export default BrushTrack; -//# sourceMappingURL=brush-track.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/brush-track.d.ts.map b/dist/src/tracks/gosling-brush/brush-track.d.ts.map deleted file mode 100644 index f1f645ea..00000000 --- a/dist/src/tracks/gosling-brush/brush-track.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"brush-track.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-brush/brush-track.ts"],"names":[],"mappings":"AAYA,iBAAS,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAwSjD;kBAxSQ,UAAU;;;;;;;;;;;;;;;;;;;;;;;AAiVnB,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/index.d.ts b/dist/src/tracks/gosling-brush/index.d.ts deleted file mode 100644 index cd9f49c0..00000000 --- a/dist/src/tracks/gosling-brush/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { default as BrushTrack } from './brush-track'; -export { LinearBrushModel } from './linear-brush-model'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/index.d.ts.map b/dist/src/tracks/gosling-brush/index.d.ts.map deleted file mode 100644 index 835fc935..00000000 --- a/dist/src/tracks/gosling-brush/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-brush/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/linear-brush-model.d.ts b/dist/src/tracks/gosling-brush/linear-brush-model.d.ts deleted file mode 100644 index 9076bb70..00000000 --- a/dist/src/tracks/gosling-brush/linear-brush-model.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type * as D3Selection from 'd3-selection'; -import type { EventStyle } from '@gosling-lang/gosling-schema'; -interface LinearBrushEvents { - brush: (range: [number, number] | null, skipApiTrigger: boolean) => void; -} -/** - * A model to manage 1D brush graphics and its data. - */ -export declare class LinearBrushModel { - private brushSelection; - private readonly style; - private range; - private data; - private startEvent; - private prevExtent; - private offset; - private size; - private externals; - private emitter; - constructor(selection: D3Selection.Selection, hgLibraries: any, style?: EventStyle); - getRange(): [number, number] | null; - setSize(size: number): this; - /** - * Update the left and top offsets for drawing the brush. - */ - setOffset(offsetX: number, offsetY: number): this; - /** - * Update brush data based on the positions of two edges. - */ - updateRange(range: [number, number] | null): this; - /** - * Update the brush using the internal range value. By default, - * This function calls a render function from gosling-track. - */ - drawBrush(skipApiTrigger?: boolean): this; - enable(): this; - disable(): this; - visible(): this; - hidden(): this; - clear(): this; - remove(): this; - /** - * Based on the extent values, generate a JSON object for the brush. - */ - private rangeToData; - private onDrag; - on(event: E, callback: LinearBrushEvents[E]): void; -} -export {}; -//# sourceMappingURL=linear-brush-model.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-brush/linear-brush-model.d.ts.map b/dist/src/tracks/gosling-brush/linear-brush-model.d.ts.map deleted file mode 100644 index 1f539ce2..00000000 --- a/dist/src/tracks/gosling-brush/linear-brush-model.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"linear-brush-model.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-brush/linear-brush-model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,WAAW,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAe/D,UAAU,iBAAiB;IACvB,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAAE,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5E;AAWD;;GAEG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,cAAc,CAAmF;IACzG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwC;IAG9D,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,IAAI,CAAkB;IAG9B,OAAO,CAAC,UAAU,CAAiG;IACnH,OAAO,CAAC,UAAU,CAA0B;IAG5C,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,IAAI,CAAS;IAGrB,OAAO,CAAC,SAAS,CAGf;IAEF,OAAO,CAAC,OAAO,CAA6B;gBAGxC,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,EACrE,WAAW,EAAE,GAAG,EAChB,KAAK,GAAE,UAAe;IA0BnB,QAAQ;IAIR,OAAO,CAAC,IAAI,EAAE,MAAM;IAK3B;;OAEG;IACI,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAKjD;;OAEG;IACI,WAAW,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAUjD;;;OAGG;IACI,SAAS,CAAC,cAAc,UAAQ;IAoBhC,MAAM;IAKN,OAAO;IAKP,OAAO;IAKP,MAAM;IAKN,KAAK;IAKL,MAAM;IAKb;;OAEG;IACH,OAAO,CAAC,WAAW;IAuBnB,OAAO,CAAC,MAAM;IAiCd,EAAE,CAAC,CAAC,SAAS,MAAM,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC;CAGjF"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts b/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts deleted file mode 100644 index e46458a7..00000000 --- a/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// -import type { TextStyle } from '../../core/utils/text-style'; -import type { Assembly } from '@gosling-lang/gosling-schema'; -type AxisTrackOptions = { - innerRadius: number; - outerRadius: number; - startAngle: number; - endAngle: number; - width: number; - height: number; - layout: 'linear' | 'circular'; - labelMargin: number; - excludeChrPrefix: boolean; - labelPosition: string; - labelColor: string; - labelTextOpacity: number; - trackBorderWidth: number; - trackBorderColor: string; - tickPositions: 'even' | 'ends'; - fontSize: number; - fontFamily: string; - fontWeight: NonNullable; - color: string; - stroke: string; - backgroundColor: string; - showMousePosition: boolean; - tickColor: number; - tickFormat?: string; - assembly?: Assembly; - reverseOrientation?: boolean; -}; -declare const _default: (new (HGC: import("@higlass/types").HGC, context: import("@higlass/tracks").Context, options: AxisTrackOptions) => import("@higlass/tracks").Track) & { - config: import("@higlass/tracks").TrackConfig; -} & { - config: { - availableOptions: (keyof AxisTrackOptions)[]; - }; -}; -export default _default; -//# sourceMappingURL=axis-track.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts.map b/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts.map deleted file mode 100644 index 8062b1dd..00000000 --- a/dist/src/tracks/gosling-genomic-axis/axis-track.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"axis-track.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-genomic-axis/axis-track.ts"],"names":[],"mappings":";AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAO7D,KAAK,gBAAgB,GAAG;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;;;;;;;;AA6tBF,wBAAkD"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-genomic-axis/index.d.ts b/dist/src/tracks/gosling-genomic-axis/index.d.ts deleted file mode 100644 index e13c44d1..00000000 --- a/dist/src/tracks/gosling-genomic-axis/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import AxisTrack from './axis-track'; -export { AxisTrack }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-genomic-axis/index.d.ts.map b/dist/src/tracks/gosling-genomic-axis/index.d.ts.map deleted file mode 100644 index 61cfd841..00000000 --- a/dist/src/tracks/gosling-genomic-axis/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-genomic-axis/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/data-abstraction.d.ts b/dist/src/tracks/gosling-track/data-abstraction.d.ts deleted file mode 100644 index 78fd80e3..00000000 --- a/dist/src/tracks/gosling-track/data-abstraction.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { SparseTile, TileData } from '@higlass/services'; -import type { Datum, SingleTrack } from '@gosling-lang/gosling-schema'; -export declare const GOSLING_DATA_ROW_UID_FIELD = "gosling-data-row-uid"; -/** - * Convert genomic data formats to common tabular formats for given tile. - */ -export declare function getTabularData(spec: SingleTrack, data: TileData & { - sparse?: Array; - shape?: [number, number]; - tileX: number; - tileWidth: number; - tileSize: number; - tileY?: number; - tileHeight?: number; -}): Datum[] | undefined; -//# sourceMappingURL=data-abstraction.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/data-abstraction.d.ts.map b/dist/src/tracks/gosling-track/data-abstraction.d.ts.map deleted file mode 100644 index 63bf2a67..00000000 --- a/dist/src/tracks/gosling-track/data-abstraction.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"data-abstraction.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-track/data-abstraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGvE,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;AAEjE;;GAEG;AACH,wBAAgB,cAAc,CAC1B,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,QAAQ,GAAG;IACb,MAAM,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,uBA+SJ"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts b/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts deleted file mode 100644 index 9a425752..00000000 --- a/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { type MouseEventData, MouseEventModel } from './mouse-event-model'; -export { isPointInsideDonutSlice } from './polygon'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts.map b/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts.map deleted file mode 100644 index 295f94cf..00000000 --- a/dist/src/tracks/gosling-track/gosling-mouse-event/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tracks/gosling-track/gosling-mouse-event/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts b/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts deleted file mode 100644 index 6b086e82..00000000 --- a/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -import type { Datum } from '@gosling-lang/gosling-schema'; -export type MouseEventData = PointEventData | LineEventData | PolygonEventData; -interface CommonEventData { - uid: string; - value: Datum; -} -interface PointEventData extends CommonEventData { - type: 'point'; - polygon: [number, number, number]; -} -interface LineEventData extends CommonEventData { - type: 'line'; - polygon: number[]; -} -interface PolygonEventData extends CommonEventData { - type: 'polygon'; - polygon: number[]; -} -/** - * A model to manage mouse events. - */ -export declare class MouseEventModel { - private data; - constructor(); - /** - * Access the number of mouse events stored. - */ - size(): number; - /** - * Add a new mouse event that is polygon-based. - */ - addPolygonBasedEvent(value: Datum, polygon: number[]): void; - /** - * Add a new mouse event that is point-based. - */ - addPointBasedEvent(value: Datum, pointAndRadius: [number, number, number]): void; - /** - * Add a new mouse event that is line-based. - */ - addLineBasedEvent(value: Datum, path: number[]): void; - /** - * Make the data array empty. - */ - clear(): void; - /** - * Find the first event data that is within the mouse position. - */ - find(x: number, y: number, reverse?: boolean): MouseEventData | undefined; - /** - * Find all event data that is within the mouse position. - */ - findAll(x: number, y: number, reverse?: boolean): MouseEventData[]; - /** - * Find all event data that matches the id values in the source and return them. - */ - getSiblings(source: MouseEventData[], idField: string): MouseEventData[]; - /** - * Test if a mouse position is within a given object. - */ - isMouseWithin(data: MouseEventData, x: number, y: number): boolean; - /** - * Find all event data that is within the range along the x-axis. - */ - findAllWithinRange(x1: number, x2: number, reverse?: boolean): MouseEventData[]; - /** - * Test if a given object is within an 1D range. - */ - isWithinRange(data: MouseEventData, x1: number, x2: number): boolean; -} -export {}; -//# sourceMappingURL=mouse-event-model.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts.map b/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts.map deleted file mode 100644 index 116189f3..00000000 --- a/dist/src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"mouse-event-model.d.ts","sourceRoot":"","sources":["../../../../../src/tracks/gosling-track/gosling-mouse-event/mouse-event-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAU1D,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAE/E,UAAU,eAAe;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;CAChB;AAED,UAAU,cAAe,SAAQ,eAAe;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,UAAU,aAAc,SAAQ,eAAe;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,UAAU,gBAAiB,SAAQ,eAAe;IAC9C,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,IAAI,CAAmB;;IAM/B;;OAEG;IACI,IAAI;IAIX;;OAEG;IACI,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE;IAI3D;;OAEG;IACI,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAIhF;;OAEG;IACI,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE;IAIrD;;OAEG;IACI,KAAK;IAIZ;;OAEG;IACI,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,UAAQ;IAMjD;;OAEG;IACI,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,UAAQ;IAMpD;;OAEG;IACI,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,MAAM;IAY5D;;OAEG;IACI,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAY/D;;OAEG;IACI,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,UAAQ;IAMjE;;OAEG;IACI,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;CAUpE"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts b/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts deleted file mode 100644 index c7108999..00000000 --- a/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @param point Tuple of the form `[x,y]` to be tested. - * @param center Tuple of the form `[x,y]` that correspond to the center of an arc. - * @param radius The inner and outer radius of the arc. - * @param angle The start and end angle the arc in the range of [0, 360]. Anticlockwise, starting from 12 o'clock. - * @returns If `true` point lies within the arc, i.e., the slice of the donut. - */ -export declare const isPointInsideDonutSlice: (point: [number, number], center: [number, number], radius: [number, number], angle: [number, number]) => boolean; -/** - * @param point Tuple of the form `[x,y]` to be tested. - * @param point2 Tuple of the form `[x,y]` to be tested. - * @param radius A radius of the second point. - * @returns If `true` point lies within the point. - */ -export declare const isPointNearPoint: (point: [number, number], point2: number[], radius?: number) => boolean; -/** - * @param range Tuple of the form `[x1,x2]` to be tested. - * @param point A value x to be tested. - * @returns If `true` point lies within the point. - */ -export declare const isPointInsideRange: (range: [number, number], x: number) => boolean; -/** - * @param range Tuple of the form `[x1,x2]` to be tested. - * @param x A value x to be tested. - * @param radius A radius of the point. - * @returns If `true` point lies within the point. - */ -export declare const isCircleWithinRange: (range: [number, number], x: number, radius?: number) => boolean; -/** - * @param point Tuple of the form `[x1,x2]` to be tested. - * @param path 1D list of vertices defining the line segments. - * @return If `true` point lies within the polygon. - */ -export declare const isAllPointsWithinRange: (range: [number, number], path: number[]) => boolean; -/** - * From: https://www.geeksforgeeks.org/minimum-distance-from-a-point-to-the-line-segment-using-vectors/ - * @param point Tuple of the form `[x,y]` to be tested. - * @param path 1D list of vertices defining the line segments. - * @param dist A threshold distance for test. - * @return If `true` point lies within the polygon. - */ -export declare const isPointNearLine: (point: [number, number], path: number[], dist?: number) => boolean; -/** - * Adopted from - * https://github.com/flekschas/utils - * https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html - * @param point Tuple of the form `[x,y]` to be tested. - * @param polygon 1D list of vertices defining the polygon. - * @return If `true` point lies within the polygon. - */ -export declare const isPointInPolygon: (point: [number, number], polygon: number[]) => boolean; -//# sourceMappingURL=polygon.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts.map b/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts.map deleted file mode 100644 index e17c0bb3..00000000 --- a/dist/src/tracks/gosling-track/gosling-mouse-event/polygon.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../../../src/tracks/gosling-track/gosling-mouse-event/polygon.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,CAClC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EACvB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EACxB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EACxB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,OAYJ,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAM9F,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,OAExE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAM1F,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAEjF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAqCzF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,OAiB9E,CAAC"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-track-model.d.ts b/dist/src/tracks/gosling-track/gosling-track-model.d.ts deleted file mode 100644 index 82a0a70f..00000000 --- a/dist/src/tracks/gosling-track/gosling-track-model.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -import type { ChannelDeep, ChannelTypes, SingleTrack } from '@gosling-lang/gosling-schema'; -import { type ScaleLinear, type ScaleOrdinal, type ScaleBand, type ScaleSequential } from 'd3-scale'; -import type { PIXIVisualProperty } from '../../core/visual-property.schema'; -import { type CompleteThemeDeep } from '../../core/utils/theme'; -import { MouseEventModel } from '../gosling-track/gosling-mouse-event'; -export type ScaleType = ScaleLinear | ScaleOrdinal | ScaleBand | ScaleSequential | (() => string | number); -export declare class GoslingTrackModel { - private id; - private theme; - private specOriginal; - private specComplete; - private dataAggregated; - private channelScales; - private mouseEventModel; - constructor(spec: SingleTrack, data: { - [k: string]: number | string; - }[], theme: Required); - getId(): string; - originalSpec(): SingleTrack; - spec(): SingleTrack; - data(): { - [k: string]: number | string; - }[]; - getMouseEventModel(): MouseEventModel; - /** - * Fill the missing options with default values or with the values calculated based on the data. - */ - private generateCompleteSpec; - /** - * TODO: This is experimental. For bar charts, for example, additional care should be taken to correctly flip the visual marks. - * Flip the y scales when `flip` options is used. - */ - private flipRanges; - /** - * Find an axis channel that is encoded with genomic coordinate and return the key (e.g., 'x'). - * `undefined` if not found. - */ - getGenomicChannelKey(): 'x' | 'xe' | 'y' | 'ye' | 'x1' | 'x1e' | 'y1' | 'y1e' | undefined; - /** - * Find a genomic field from the track specification. - * `undefined` if not found. - */ - getGenomicChannel(): ChannelDeep | undefined; - /** - * Replace a domain with a new one in the complete spec(s) if the original spec does not define the domain. - * A domain is replaced only when the channel is bound with data (i.e., `ChannelDeep`). - */ - setChannelDomain(channelKey: keyof typeof ChannelTypes, domain: string[] | number[], force?: boolean): void; - /** - * Update default constant values by looking up other channels' scales. - */ - updateChannelValue(): void; - /** - * Get the encoded value using the scales already constructed. - */ - encodedValue(channelKey: keyof typeof ChannelTypes, value?: number | string): any; - trackVisibility(currentStage: { - zoomLevel?: number; - }): boolean; - /** - * Check whether the visual mark should be visible or not. - * Return 0 (invisible) only when the predefined condition is correct. - */ - markVisibility(datum: { - [k: string]: string | number; - }, metrics?: any): number; - /** - * - */ - visualPropertyByChannel(channelKey: keyof typeof ChannelTypes, datum?: { - [k: string]: string | number; - }): any; - /** - * Retrieve an encoded visual property of a visual mark. - */ - encodedPIXIProperty(propertyKey: PIXIVisualProperty, datum?: { - [k: string]: string | number; - }, additionalInfo?: any): any; - /** - * Set missing `range`, `domain`, and/or `value` of each channel by looking into data. - */ - addScaleMaterials(spec: SingleTrack): void; - /** - * Store the scale of individual visual channels based on the `complete` spec. - */ - generateScales(): void; - /** - * Return the scale of a visual channel. - * `undefined` if we do not have the scale. - */ - getChannelScale(channelKey: keyof typeof ChannelTypes): ScaleType; - /** - * Set a new scale for a certain channel. Usually called to replace the scale of a genomic axis with the one that is generated by the HiGlass data fetcher. - */ - setChannelScale(channelKey: keyof typeof ChannelTypes, scale: ScaleType): void; - /** - * Return whether to show y-axis. - */ - isShowYAxis(): boolean; - /** - * Return the domain of a visual channel. - * `undefined` if we do not have domain in array. - */ - getChannelDomainArray(channelKey: keyof typeof ChannelTypes): string[] | number[] | undefined; - /** - * Return the range of a visual channel. - * `undefined` if we do not have domain in array. - */ - getChannelRangeArray(channelKey: keyof typeof ChannelTypes): string[] | number[] | undefined; - /** - * Validate the original spec. - */ - validateSpec(): { - valid: boolean; - errorMessages: string[]; - }; -} -//# sourceMappingURL=gosling-track-model.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-track-model.d.ts.map b/dist/src/tracks/gosling-track/gosling-track-model.d.ts.map deleted file mode 100644 index ea30bd2e..00000000 --- a/dist/src/tracks/gosling-track/gosling-track-model.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gosling-track-model.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-track/gosling-track-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EAEX,YAAY,EAEZ,WAAW,EAId,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACH,KAAK,WAAW,EAEhB,KAAK,YAAY,EAEjB,KAAK,SAAS,EAEd,KAAK,eAAe,EAEvB,MAAM,UAAU,CAAC;AAKlB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAiB5E,OAAO,EAAE,KAAK,iBAAiB,EAAY,MAAM,wBAAwB,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,MAAM,MAAM,SAAS,GACf,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,GACrB,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,GACtB,SAAS,CAAC,GAAG,CAAC,GACd,eAAe,CAAC,GAAG,CAAC,GACpB,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC;AAE9B,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,EAAE,CAAS;IAEnB,OAAO,CAAC,KAAK,CAA8B;IAG3C,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,YAAY,CAAc;IAGlC,OAAO,CAAC,cAAc,CAAqC;IAG3D,OAAO,CAAC,aAAa,CAEnB;IAGF,OAAO,CAAC,eAAe,CAAkB;gBAE7B,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;KAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC;IAqCpG,KAAK,IAAI,MAAM;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,MAAM,CAAA;KAAE,EACxC,cAAc,CAAC,EAAE,GAAG;IAwCxB;;OAEG;IACI,iBAAiB,CAAC,IAAI,EAAE,WAAW;IAqQ1C;;OAEG;IACI,cAAc;IAoFrB;;;OAGG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,OAAO,YAAY;IAI5D;;OAEG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,OAAO,YAAY,EAAE,KAAK,EAAE,SAAS;IAI9E;;OAEG;IACI,WAAW,IAAI,OAAO;IAS7B;;;OAGG;IACI,qBAAqB,CAAC,UAAU,EAAE,MAAM,OAAO,YAAY,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS;IAKpG;;;OAGG;IACI,oBAAoB,CAAC,UAAU,EAAE,MAAM,OAAO,YAAY,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS;IAKnG;;OAEG;IACI,YAAY,IAAI;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,MAAM,EAAE,CAAA;KAAE;CAGrE"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-track.d.ts b/dist/src/tracks/gosling-track/gosling-track.d.ts deleted file mode 100644 index 9f511802..00000000 --- a/dist/src/tracks/gosling-track/gosling-track.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// -import type { SingleTrack, OverlaidTrack, Datum, ValueExtent, Range } from '@gosling-lang/gosling-schema'; -import type { Tile as _Tile, TileData, TileDataBase } from '@higlass/services'; -import type { CompleteThemeDeep } from '../../core/utils/theme'; -export declare const PRINT_RENDERING_CYCLE = false; -interface GoslingTrackOptions { - /** - * Track ID specified by users - */ - id: string; - /** - * Track IDs that are superposed with this track, containing the id of this track itself - */ - siblingIds: string[]; - spec: SingleTrack | OverlaidTrack; - theme: CompleteThemeDeep; - showMousePosition?: boolean; -} -/** Tile data used in Gosling data fetchers */ -interface TabularTileData extends TileDataBase { - tabularData: Datum[]; -} -/** Mutated type of `Tile` that includes Gosling's tile data, i.e., tabular tile data */ -export interface Tile extends Omit<_Tile, 'tileData'> { - tileData: TileData | TabularTileData; -} -/** Information about the rendered color legend */ -export interface DisplayedLegend { - domain: ValueExtent; - range: Range; -} -declare const _default: (new (HGC: import("@higlass/types").HGC, context: import("@higlass/tracks").Context, options: GoslingTrackOptions) => import("@higlass/tracks").Track) & { - config: import("@higlass/tracks").TrackConfig; -} & { - config: { - availableOptions: (keyof GoslingTrackOptions)[]; - }; -}; -export default _default; -//# sourceMappingURL=gosling-track.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/gosling-track.d.ts.map b/dist/src/tracks/gosling-track/gosling-track.d.ts.map deleted file mode 100644 index 89cf9124..00000000 --- a/dist/src/tracks/gosling-track/gosling-track.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gosling-track.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-track/gosling-track.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EACR,WAAW,EACX,aAAa,EACb,KAAK,EAIL,WAAW,EACX,KAAK,EACR,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAK/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAoChE,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAgB3C,UAAU,mBAAmB;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,WAAW,GAAG,aAAa,CAAC;IAClC,KAAK,EAAE,iBAAiB,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,8CAA8C;AAC9C,UAAU,eAAgB,SAAQ,YAAY;IAC1C,WAAW,EAAE,KAAK,EAAE,CAAC;CACxB;AAED,wFAAwF;AACxF,MAAM,WAAW,IAAK,SAAQ,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC;IACjD,QAAQ,EAAE,QAAQ,GAAG,eAAe,CAAC;CACxC;AAUD,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC5B,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;CAChB;;;;;;;;AA65CD,wBAAkD"} \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/index.d.ts b/dist/src/tracks/gosling-track/index.d.ts deleted file mode 100644 index 6a97cc4b..00000000 --- a/dist/src/tracks/gosling-track/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default as GoslingTrack, type Tile, type DisplayedLegend } from './gosling-track'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/tracks/gosling-track/index.d.ts.map b/dist/src/tracks/gosling-track/index.d.ts.map deleted file mode 100644 index 0ceaf867..00000000 --- a/dist/src/tracks/gosling-track/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tracks/gosling-track/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/dist/utils.js b/dist/utils.js deleted file mode 100644 index 3a8ccf7c..00000000 --- a/dist/utils.js +++ /dev/null @@ -1,20 +0,0 @@ -import { ae, af, c, ab, ac, N, ad, s } from "./exported-utils-c80467e4.js"; -import "d3-array"; -import "generic-filehandle"; -import "pixi.js"; -import "d3-color"; -import "bezier-js"; -import "d3-scale"; -import "lodash-es"; -import "d3-scale-chromatic"; -export { - ae as _convertToFlatTracks, - af as _spreadTracksByData, - c as computeChromSizes, - ab as getChromInterval, - ac as getChromTotalSize, - N as getRelativeGenomicPosition, - ad as parseGenomicPosition, - s as sanitizeChrName -}; -//# sourceMappingURL=utils.js.map diff --git a/dist/utils.js.map b/dist/utils.js.map deleted file mode 100644 index 3c9735f7..00000000 --- a/dist/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"} \ No newline at end of file diff --git a/package.json b/package.json index 00fdfb9b..715d5e28 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "main": "dist/gosling.js", "module": "dist/gosling.js", "types": "dist/src/index.d.ts", + "packageManager": "pnpm@8.6.11", "files": [ "dist" ], @@ -40,6 +41,8 @@ "format": "eslint src/ editor/ --fix && prettier 'editor/**/*.css' --write", "schema": "node scripts/generate-schemas.mjs", "version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md", + "prepare": "echo 'dummy prepare since prepack has no dev dependencies'", + "prepack": "npm run build", "knip": "knip --config knip.config.json", "e2e": "playwright test" }, From 0e1d13e999c7ee7c2fbcb8db1828c78bc67d0387 Mon Sep 17 00:00:00 2001 From: Michael Puehringer Date: Tue, 9 Jan 2024 09:47:52 +0100 Subject: [PATCH 7/8] Remove pnpm package manager entry --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 715d5e28..cce5c07e 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "main": "dist/gosling.js", "module": "dist/gosling.js", "types": "dist/src/index.d.ts", - "packageManager": "pnpm@8.6.11", + "--packageManager": "pnpm@8.6.11", "files": [ "dist" ], From a61a97760e0d2762fd49abc8a6d94603d276583f Mon Sep 17 00:00:00 2001 From: Michael Puehringer Date: Tue, 9 Jan 2024 09:52:58 +0100 Subject: [PATCH 8/8] Migrate to yarn --- .gitignore | 9 + .yarn/releases/yarn-4.0.2.cjs | 893 +++ .yarnrc.yml | 5 + package.json | 3 +- yarn.lock | 10155 ++++++++++++++++++++++++++++++++ 5 files changed, 11064 insertions(+), 1 deletion(-) create mode 100755 .yarn/releases/yarn-4.0.2.cjs create mode 100644 .yarnrc.yml create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore index e8a96926..22da2396 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,15 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +# yarn +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions + report.* *.swp *.swo diff --git a/.yarn/releases/yarn-4.0.2.cjs b/.yarn/releases/yarn-4.0.2.cjs new file mode 100755 index 00000000..9edf57a4 --- /dev/null +++ b/.yarn/releases/yarn-4.0.2.cjs @@ -0,0 +1,893 @@ +#!/usr/bin/env node +/* eslint-disable */ +//prettier-ignore +(()=>{var n_e=Object.create;var MT=Object.defineProperty;var i_e=Object.getOwnPropertyDescriptor;var s_e=Object.getOwnPropertyNames;var o_e=Object.getPrototypeOf,a_e=Object.prototype.hasOwnProperty;var Be=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var Et=(t,e)=>()=>(t&&(e=t(t=0)),e);var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Kt=(t,e)=>{for(var r in e)MT(t,r,{get:e[r],enumerable:!0})},l_e=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of s_e(e))!a_e.call(t,a)&&a!==r&&MT(t,a,{get:()=>e[a],enumerable:!(o=i_e(e,a))||o.enumerable});return t};var $e=(t,e,r)=>(r=t!=null?n_e(o_e(t)):{},l_e(e||!t||!t.__esModule?MT(r,"default",{value:t,enumerable:!0}):r,t));var vi={};Kt(vi,{SAFE_TIME:()=>F7,S_IFDIR:()=>wD,S_IFLNK:()=>ID,S_IFMT:()=>Mu,S_IFREG:()=>Hw});var Mu,wD,Hw,ID,F7,T7=Et(()=>{Mu=61440,wD=16384,Hw=32768,ID=40960,F7=456789e3});var ar={};Kt(ar,{EBADF:()=>Io,EBUSY:()=>c_e,EEXIST:()=>g_e,EINVAL:()=>A_e,EISDIR:()=>h_e,ENOENT:()=>f_e,ENOSYS:()=>u_e,ENOTDIR:()=>p_e,ENOTEMPTY:()=>m_e,EOPNOTSUPP:()=>y_e,EROFS:()=>d_e,ERR_DIR_CLOSED:()=>OT});function Rl(t,e){return Object.assign(new Error(`${t}: ${e}`),{code:t})}function c_e(t){return Rl("EBUSY",t)}function u_e(t,e){return Rl("ENOSYS",`${t}, ${e}`)}function A_e(t){return Rl("EINVAL",`invalid argument, ${t}`)}function Io(t){return Rl("EBADF",`bad file descriptor, ${t}`)}function f_e(t){return Rl("ENOENT",`no such file or directory, ${t}`)}function p_e(t){return Rl("ENOTDIR",`not a directory, ${t}`)}function h_e(t){return Rl("EISDIR",`illegal operation on a directory, ${t}`)}function g_e(t){return Rl("EEXIST",`file already exists, ${t}`)}function d_e(t){return Rl("EROFS",`read-only filesystem, ${t}`)}function m_e(t){return Rl("ENOTEMPTY",`directory not empty, ${t}`)}function y_e(t){return Rl("EOPNOTSUPP",`operation not supported, ${t}`)}function OT(){return Rl("ERR_DIR_CLOSED","Directory handle was closed")}var BD=Et(()=>{});var Ea={};Kt(Ea,{BigIntStatsEntry:()=>ey,DEFAULT_MODE:()=>HT,DirEntry:()=>UT,StatEntry:()=>$m,areStatsEqual:()=>jT,clearStats:()=>vD,convertToBigIntStats:()=>C_e,makeDefaultStats:()=>R7,makeEmptyStats:()=>E_e});function R7(){return new $m}function E_e(){return vD(R7())}function vD(t){for(let e in t)if(Object.hasOwn(t,e)){let r=t[e];typeof r=="number"?t[e]=0:typeof r=="bigint"?t[e]=BigInt(0):_T.types.isDate(r)&&(t[e]=new Date(0))}return t}function C_e(t){let e=new ey;for(let r in t)if(Object.hasOwn(t,r)){let o=t[r];typeof o=="number"?e[r]=BigInt(o):_T.types.isDate(o)&&(e[r]=new Date(o))}return e.atimeNs=e.atimeMs*BigInt(1e6),e.mtimeNs=e.mtimeMs*BigInt(1e6),e.ctimeNs=e.ctimeMs*BigInt(1e6),e.birthtimeNs=e.birthtimeMs*BigInt(1e6),e}function jT(t,e){if(t.atimeMs!==e.atimeMs||t.birthtimeMs!==e.birthtimeMs||t.blksize!==e.blksize||t.blocks!==e.blocks||t.ctimeMs!==e.ctimeMs||t.dev!==e.dev||t.gid!==e.gid||t.ino!==e.ino||t.isBlockDevice()!==e.isBlockDevice()||t.isCharacterDevice()!==e.isCharacterDevice()||t.isDirectory()!==e.isDirectory()||t.isFIFO()!==e.isFIFO()||t.isFile()!==e.isFile()||t.isSocket()!==e.isSocket()||t.isSymbolicLink()!==e.isSymbolicLink()||t.mode!==e.mode||t.mtimeMs!==e.mtimeMs||t.nlink!==e.nlink||t.rdev!==e.rdev||t.size!==e.size||t.uid!==e.uid)return!1;let r=t,o=e;return!(r.atimeNs!==o.atimeNs||r.mtimeNs!==o.mtimeNs||r.ctimeNs!==o.ctimeNs||r.birthtimeNs!==o.birthtimeNs)}var _T,HT,UT,$m,ey,qT=Et(()=>{_T=$e(Be("util")),HT=33188,UT=class{constructor(){this.name="";this.path="";this.mode=0}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},$m=class{constructor(){this.uid=0;this.gid=0;this.size=0;this.blksize=0;this.atimeMs=0;this.mtimeMs=0;this.ctimeMs=0;this.birthtimeMs=0;this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=0;this.ino=0;this.mode=HT;this.nlink=1;this.rdev=0;this.blocks=1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&61440)===16384}isFIFO(){return!1}isFile(){return(this.mode&61440)===32768}isSocket(){return!1}isSymbolicLink(){return(this.mode&61440)===40960}},ey=class{constructor(){this.uid=BigInt(0);this.gid=BigInt(0);this.size=BigInt(0);this.blksize=BigInt(0);this.atimeMs=BigInt(0);this.mtimeMs=BigInt(0);this.ctimeMs=BigInt(0);this.birthtimeMs=BigInt(0);this.atimeNs=BigInt(0);this.mtimeNs=BigInt(0);this.ctimeNs=BigInt(0);this.birthtimeNs=BigInt(0);this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=BigInt(0);this.ino=BigInt(0);this.mode=BigInt(HT);this.nlink=BigInt(1);this.rdev=BigInt(0);this.blocks=BigInt(1)}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&BigInt(61440))===BigInt(16384)}isFIFO(){return!1}isFile(){return(this.mode&BigInt(61440))===BigInt(32768)}isSocket(){return!1}isSymbolicLink(){return(this.mode&BigInt(61440))===BigInt(40960)}}});function D_e(t){let e,r;if(e=t.match(B_e))t=e[1];else if(r=t.match(v_e))t=`\\\\${r[1]?".\\":""}${r[2]}`;else return t;return t.replace(/\//g,"\\")}function P_e(t){t=t.replace(/\\/g,"/");let e,r;return(e=t.match(w_e))?t=`/${e[1]}`:(r=t.match(I_e))&&(t=`/unc/${r[1]?".dot/":""}${r[2]}`),t}function DD(t,e){return t===ue?L7(e):GT(e)}var jw,Bt,dr,ue,K,N7,w_e,I_e,B_e,v_e,GT,L7,Ca=Et(()=>{jw=$e(Be("path")),Bt={root:"/",dot:".",parent:".."},dr={home:"~",nodeModules:"node_modules",manifest:"package.json",lockfile:"yarn.lock",virtual:"__virtual__",pnpJs:".pnp.js",pnpCjs:".pnp.cjs",pnpData:".pnp.data.json",pnpEsmLoader:".pnp.loader.mjs",rc:".yarnrc.yml",env:".env"},ue=Object.create(jw.default),K=Object.create(jw.default.posix);ue.cwd=()=>process.cwd();K.cwd=process.platform==="win32"?()=>GT(process.cwd()):process.cwd;process.platform==="win32"&&(K.resolve=(...t)=>t.length>0&&K.isAbsolute(t[0])?jw.default.posix.resolve(...t):jw.default.posix.resolve(K.cwd(),...t));N7=function(t,e,r){return e=t.normalize(e),r=t.normalize(r),e===r?".":(e.endsWith(t.sep)||(e=e+t.sep),r.startsWith(e)?r.slice(e.length):null)};ue.contains=(t,e)=>N7(ue,t,e);K.contains=(t,e)=>N7(K,t,e);w_e=/^([a-zA-Z]:.*)$/,I_e=/^\/\/(\.\/)?(.*)$/,B_e=/^\/([a-zA-Z]:.*)$/,v_e=/^\/unc\/(\.dot\/)?(.*)$/;GT=process.platform==="win32"?P_e:t=>t,L7=process.platform==="win32"?D_e:t=>t;ue.fromPortablePath=L7;ue.toPortablePath=GT});async function PD(t,e){let r="0123456789abcdef";await t.mkdirPromise(e.indexPath,{recursive:!0});let o=[];for(let a of r)for(let n of r)o.push(t.mkdirPromise(t.pathUtils.join(e.indexPath,`${a}${n}`),{recursive:!0}));return await Promise.all(o),e.indexPath}async function M7(t,e,r,o,a){let n=t.pathUtils.normalize(e),u=r.pathUtils.normalize(o),A=[],p=[],{atime:h,mtime:E}=a.stableTime?{atime:Lg,mtime:Lg}:await r.lstatPromise(u);await t.mkdirpPromise(t.pathUtils.dirname(e),{utimes:[h,E]}),await YT(A,p,t,n,r,u,{...a,didParentExist:!0});for(let I of A)await I();await Promise.all(p.map(I=>I()))}async function YT(t,e,r,o,a,n,u){let A=u.didParentExist?await O7(r,o):null,p=await a.lstatPromise(n),{atime:h,mtime:E}=u.stableTime?{atime:Lg,mtime:Lg}:p,I;switch(!0){case p.isDirectory():I=await x_e(t,e,r,o,A,a,n,p,u);break;case p.isFile():I=await Q_e(t,e,r,o,A,a,n,p,u);break;case p.isSymbolicLink():I=await F_e(t,e,r,o,A,a,n,p,u);break;default:throw new Error(`Unsupported file type (${p.mode})`)}return(u.linkStrategy?.type!=="HardlinkFromIndex"||!p.isFile())&&((I||A?.mtime?.getTime()!==E.getTime()||A?.atime?.getTime()!==h.getTime())&&(e.push(()=>r.lutimesPromise(o,h,E)),I=!0),(A===null||(A.mode&511)!==(p.mode&511))&&(e.push(()=>r.chmodPromise(o,p.mode&511)),I=!0)),I}async function O7(t,e){try{return await t.lstatPromise(e)}catch{return null}}async function x_e(t,e,r,o,a,n,u,A,p){if(a!==null&&!a.isDirectory())if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1;let h=!1;a===null&&(t.push(async()=>{try{await r.mkdirPromise(o,{mode:A.mode})}catch(v){if(v.code!=="EEXIST")throw v}}),h=!0);let E=await n.readdirPromise(u),I=p.didParentExist&&!a?{...p,didParentExist:!1}:p;if(p.stableSort)for(let v of E.sort())await YT(t,e,r,r.pathUtils.join(o,v),n,n.pathUtils.join(u,v),I)&&(h=!0);else(await Promise.all(E.map(async b=>{await YT(t,e,r,r.pathUtils.join(o,b),n,n.pathUtils.join(u,b),I)}))).some(b=>b)&&(h=!0);return h}async function b_e(t,e,r,o,a,n,u,A,p,h){let E=await n.checksumFilePromise(u,{algorithm:"sha1"}),I=r.pathUtils.join(h.indexPath,E.slice(0,2),`${E}.dat`),v;(te=>(te[te.Lock=0]="Lock",te[te.Rename=1]="Rename"))(v||={});let b=1,C=await O7(r,I);if(a){let U=C&&a.dev===C.dev&&a.ino===C.ino,J=C?.mtimeMs!==S_e;if(U&&J&&h.autoRepair&&(b=0,C=null),!U)if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1}let T=!C&&b===1?`${I}.${Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0")}`:null,L=!1;return t.push(async()=>{if(!C&&(b===0&&await r.lockPromise(I,async()=>{let U=await n.readFilePromise(u);await r.writeFilePromise(I,U)}),b===1&&T)){let U=await n.readFilePromise(u);await r.writeFilePromise(T,U);try{await r.linkPromise(T,I)}catch(J){if(J.code==="EEXIST")L=!0,await r.unlinkPromise(T);else throw J}}a||await r.linkPromise(I,o)}),e.push(async()=>{C||await r.lutimesPromise(I,Lg,Lg),T&&!L&&await r.unlinkPromise(T)}),!1}async function k_e(t,e,r,o,a,n,u,A,p){if(a!==null)if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1;return t.push(async()=>{let h=await n.readFilePromise(u);await r.writeFilePromise(o,h)}),!0}async function Q_e(t,e,r,o,a,n,u,A,p){return p.linkStrategy?.type==="HardlinkFromIndex"?b_e(t,e,r,o,a,n,u,A,p,p.linkStrategy):k_e(t,e,r,o,a,n,u,A,p)}async function F_e(t,e,r,o,a,n,u,A,p){if(a!==null)if(p.overwrite)t.push(async()=>r.removePromise(o)),a=null;else return!1;return t.push(async()=>{await r.symlinkPromise(DD(r.pathUtils,await n.readlinkPromise(u)),o)}),!0}var Lg,S_e,WT=Et(()=>{Ca();Lg=new Date(456789e3*1e3),S_e=Lg.getTime()});function SD(t,e,r,o){let a=()=>{let n=r.shift();if(typeof n>"u")return null;let u=t.pathUtils.join(e,n);return Object.assign(t.statSync(u),{name:n,path:void 0})};return new qw(e,a,o)}var qw,U7=Et(()=>{BD();qw=class{constructor(e,r,o={}){this.path=e;this.nextDirent=r;this.opts=o;this.closed=!1}throwIfClosed(){if(this.closed)throw OT()}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.read())!==null;)yield e}finally{await this.close()}}read(e){let r=this.readSync();return typeof e<"u"?e(null,r):Promise.resolve(r)}readSync(){return this.throwIfClosed(),this.nextDirent()}close(e){return this.closeSync(),typeof e<"u"?e(null):Promise.resolve()}closeSync(){this.throwIfClosed(),this.opts.onClose?.(),this.closed=!0}}});function _7(t,e){if(t!==e)throw new Error(`Invalid StatWatcher status: expected '${e}', got '${t}'`)}var H7,ty,j7=Et(()=>{H7=Be("events");qT();ty=class extends H7.EventEmitter{constructor(r,o,{bigint:a=!1}={}){super();this.status="ready";this.changeListeners=new Map;this.startTimeout=null;this.fakeFs=r,this.path=o,this.bigint=a,this.lastStats=this.stat()}static create(r,o,a){let n=new ty(r,o,a);return n.start(),n}start(){_7(this.status,"ready"),this.status="running",this.startTimeout=setTimeout(()=>{this.startTimeout=null,this.fakeFs.existsSync(this.path)||this.emit("change",this.lastStats,this.lastStats)},3)}stop(){_7(this.status,"running"),this.status="stopped",this.startTimeout!==null&&(clearTimeout(this.startTimeout),this.startTimeout=null),this.emit("stop")}stat(){try{return this.fakeFs.statSync(this.path,{bigint:this.bigint})}catch{let o=this.bigint?new ey:new $m;return vD(o)}}makeInterval(r){let o=setInterval(()=>{let a=this.stat(),n=this.lastStats;jT(a,n)||(this.lastStats=a,this.emit("change",a,n))},r.interval);return r.persistent?o:o.unref()}registerChangeListener(r,o){this.addListener("change",r),this.changeListeners.set(r,this.makeInterval(o))}unregisterChangeListener(r){this.removeListener("change",r);let o=this.changeListeners.get(r);typeof o<"u"&&clearInterval(o),this.changeListeners.delete(r)}unregisterAllChangeListeners(){for(let r of this.changeListeners.keys())this.unregisterChangeListener(r)}hasChangeListeners(){return this.changeListeners.size>0}ref(){for(let r of this.changeListeners.values())r.ref();return this}unref(){for(let r of this.changeListeners.values())r.unref();return this}}});function ry(t,e,r,o){let a,n,u,A;switch(typeof r){case"function":a=!1,n=!0,u=5007,A=r;break;default:({bigint:a=!1,persistent:n=!0,interval:u=5007}=r),A=o;break}let p=xD.get(t);typeof p>"u"&&xD.set(t,p=new Map);let h=p.get(e);return typeof h>"u"&&(h=ty.create(t,e,{bigint:a}),p.set(e,h)),h.registerChangeListener(A,{persistent:n,interval:u}),h}function Mg(t,e,r){let o=xD.get(t);if(typeof o>"u")return;let a=o.get(e);typeof a>"u"||(typeof r>"u"?a.unregisterAllChangeListeners():a.unregisterChangeListener(r),a.hasChangeListeners()||(a.stop(),o.delete(e)))}function Og(t){let e=xD.get(t);if(!(typeof e>"u"))for(let r of e.keys())Mg(t,r)}var xD,VT=Et(()=>{j7();xD=new WeakMap});function T_e(t){let e=t.match(/\r?\n/g);if(e===null)return G7.EOL;let r=e.filter(a=>a===`\r +`).length,o=e.length-r;return r>o?`\r +`:` +`}function Ug(t,e){return e.replace(/\r?\n/g,T_e(t))}var q7,G7,hf,Ou,_g=Et(()=>{q7=Be("crypto"),G7=Be("os");WT();Ca();hf=class{constructor(e){this.pathUtils=e}async*genTraversePromise(e,{stableSort:r=!1}={}){let o=[e];for(;o.length>0;){let a=o.shift();if((await this.lstatPromise(a)).isDirectory()){let u=await this.readdirPromise(a);if(r)for(let A of u.sort())o.push(this.pathUtils.join(a,A));else throw new Error("Not supported")}else yield a}}async checksumFilePromise(e,{algorithm:r="sha512"}={}){let o=await this.openPromise(e,"r");try{let n=Buffer.allocUnsafeSlow(65536),u=(0,q7.createHash)(r),A=0;for(;(A=await this.readPromise(o,n,0,65536))!==0;)u.update(A===65536?n:n.slice(0,A));return u.digest("hex")}finally{await this.closePromise(o)}}async removePromise(e,{recursive:r=!0,maxRetries:o=5}={}){let a;try{a=await this.lstatPromise(e)}catch(n){if(n.code==="ENOENT")return;throw n}if(a.isDirectory()){if(r){let n=await this.readdirPromise(e);await Promise.all(n.map(u=>this.removePromise(this.pathUtils.resolve(e,u))))}for(let n=0;n<=o;n++)try{await this.rmdirPromise(e);break}catch(u){if(u.code!=="EBUSY"&&u.code!=="ENOTEMPTY")throw u;nsetTimeout(A,n*100))}}else await this.unlinkPromise(e)}removeSync(e,{recursive:r=!0}={}){let o;try{o=this.lstatSync(e)}catch(a){if(a.code==="ENOENT")return;throw a}if(o.isDirectory()){if(r)for(let a of this.readdirSync(e))this.removeSync(this.pathUtils.resolve(e,a));this.rmdirSync(e)}else this.unlinkSync(e)}async mkdirpPromise(e,{chmod:r,utimes:o}={}){if(e=this.resolve(e),e===this.pathUtils.dirname(e))return;let a=e.split(this.pathUtils.sep),n;for(let u=2;u<=a.length;++u){let A=a.slice(0,u).join(this.pathUtils.sep);if(!this.existsSync(A)){try{await this.mkdirPromise(A)}catch(p){if(p.code==="EEXIST")continue;throw p}if(n??=A,r!=null&&await this.chmodPromise(A,r),o!=null)await this.utimesPromise(A,o[0],o[1]);else{let p=await this.statPromise(this.pathUtils.dirname(A));await this.utimesPromise(A,p.atime,p.mtime)}}}return n}mkdirpSync(e,{chmod:r,utimes:o}={}){if(e=this.resolve(e),e===this.pathUtils.dirname(e))return;let a=e.split(this.pathUtils.sep),n;for(let u=2;u<=a.length;++u){let A=a.slice(0,u).join(this.pathUtils.sep);if(!this.existsSync(A)){try{this.mkdirSync(A)}catch(p){if(p.code==="EEXIST")continue;throw p}if(n??=A,r!=null&&this.chmodSync(A,r),o!=null)this.utimesSync(A,o[0],o[1]);else{let p=this.statSync(this.pathUtils.dirname(A));this.utimesSync(A,p.atime,p.mtime)}}}return n}async copyPromise(e,r,{baseFs:o=this,overwrite:a=!0,stableSort:n=!1,stableTime:u=!1,linkStrategy:A=null}={}){return await M7(this,e,o,r,{overwrite:a,stableSort:n,stableTime:u,linkStrategy:A})}copySync(e,r,{baseFs:o=this,overwrite:a=!0}={}){let n=o.lstatSync(r),u=this.existsSync(e);if(n.isDirectory()){this.mkdirpSync(e);let p=o.readdirSync(r);for(let h of p)this.copySync(this.pathUtils.join(e,h),o.pathUtils.join(r,h),{baseFs:o,overwrite:a})}else if(n.isFile()){if(!u||a){u&&this.removeSync(e);let p=o.readFileSync(r);this.writeFileSync(e,p)}}else if(n.isSymbolicLink()){if(!u||a){u&&this.removeSync(e);let p=o.readlinkSync(r);this.symlinkSync(DD(this.pathUtils,p),e)}}else throw new Error(`Unsupported file type (file: ${r}, mode: 0o${n.mode.toString(8).padStart(6,"0")})`);let A=n.mode&511;this.chmodSync(e,A)}async changeFilePromise(e,r,o={}){return Buffer.isBuffer(r)?this.changeFileBufferPromise(e,r,o):this.changeFileTextPromise(e,r,o)}async changeFileBufferPromise(e,r,{mode:o}={}){let a=Buffer.alloc(0);try{a=await this.readFilePromise(e)}catch{}Buffer.compare(a,r)!==0&&await this.writeFilePromise(e,r,{mode:o})}async changeFileTextPromise(e,r,{automaticNewlines:o,mode:a}={}){let n="";try{n=await this.readFilePromise(e,"utf8")}catch{}let u=o?Ug(n,r):r;n!==u&&await this.writeFilePromise(e,u,{mode:a})}changeFileSync(e,r,o={}){return Buffer.isBuffer(r)?this.changeFileBufferSync(e,r,o):this.changeFileTextSync(e,r,o)}changeFileBufferSync(e,r,{mode:o}={}){let a=Buffer.alloc(0);try{a=this.readFileSync(e)}catch{}Buffer.compare(a,r)!==0&&this.writeFileSync(e,r,{mode:o})}changeFileTextSync(e,r,{automaticNewlines:o=!1,mode:a}={}){let n="";try{n=this.readFileSync(e,"utf8")}catch{}let u=o?Ug(n,r):r;n!==u&&this.writeFileSync(e,u,{mode:a})}async movePromise(e,r){try{await this.renamePromise(e,r)}catch(o){if(o.code==="EXDEV")await this.copyPromise(r,e),await this.removePromise(e);else throw o}}moveSync(e,r){try{this.renameSync(e,r)}catch(o){if(o.code==="EXDEV")this.copySync(r,e),this.removeSync(e);else throw o}}async lockPromise(e,r){let o=`${e}.flock`,a=1e3/60,n=Date.now(),u=null,A=async()=>{let p;try{[p]=await this.readJsonPromise(o)}catch{return Date.now()-n<500}try{return process.kill(p,0),!0}catch{return!1}};for(;u===null;)try{u=await this.openPromise(o,"wx")}catch(p){if(p.code==="EEXIST"){if(!await A())try{await this.unlinkPromise(o);continue}catch{}if(Date.now()-n<60*1e3)await new Promise(h=>setTimeout(h,a));else throw new Error(`Couldn't acquire a lock in a reasonable time (via ${o})`)}else throw p}await this.writePromise(u,JSON.stringify([process.pid]));try{return await r()}finally{try{await this.closePromise(u),await this.unlinkPromise(o)}catch{}}}async readJsonPromise(e){let r=await this.readFilePromise(e,"utf8");try{return JSON.parse(r)}catch(o){throw o.message+=` (in ${e})`,o}}readJsonSync(e){let r=this.readFileSync(e,"utf8");try{return JSON.parse(r)}catch(o){throw o.message+=` (in ${e})`,o}}async writeJsonPromise(e,r,{compact:o=!1}={}){let a=o?0:2;return await this.writeFilePromise(e,`${JSON.stringify(r,null,a)} +`)}writeJsonSync(e,r,{compact:o=!1}={}){let a=o?0:2;return this.writeFileSync(e,`${JSON.stringify(r,null,a)} +`)}async preserveTimePromise(e,r){let o=await this.lstatPromise(e),a=await r();typeof a<"u"&&(e=a),await this.lutimesPromise(e,o.atime,o.mtime)}async preserveTimeSync(e,r){let o=this.lstatSync(e),a=r();typeof a<"u"&&(e=a),this.lutimesSync(e,o.atime,o.mtime)}},Ou=class extends hf{constructor(){super(K)}}});var Ps,gf=Et(()=>{_g();Ps=class extends hf{getExtractHint(e){return this.baseFs.getExtractHint(e)}resolve(e){return this.mapFromBase(this.baseFs.resolve(this.mapToBase(e)))}getRealPath(){return this.mapFromBase(this.baseFs.getRealPath())}async openPromise(e,r,o){return this.baseFs.openPromise(this.mapToBase(e),r,o)}openSync(e,r,o){return this.baseFs.openSync(this.mapToBase(e),r,o)}async opendirPromise(e,r){return Object.assign(await this.baseFs.opendirPromise(this.mapToBase(e),r),{path:e})}opendirSync(e,r){return Object.assign(this.baseFs.opendirSync(this.mapToBase(e),r),{path:e})}async readPromise(e,r,o,a,n){return await this.baseFs.readPromise(e,r,o,a,n)}readSync(e,r,o,a,n){return this.baseFs.readSync(e,r,o,a,n)}async writePromise(e,r,o,a,n){return typeof r=="string"?await this.baseFs.writePromise(e,r,o):await this.baseFs.writePromise(e,r,o,a,n)}writeSync(e,r,o,a,n){return typeof r=="string"?this.baseFs.writeSync(e,r,o):this.baseFs.writeSync(e,r,o,a,n)}async closePromise(e){return this.baseFs.closePromise(e)}closeSync(e){this.baseFs.closeSync(e)}createReadStream(e,r){return this.baseFs.createReadStream(e!==null?this.mapToBase(e):e,r)}createWriteStream(e,r){return this.baseFs.createWriteStream(e!==null?this.mapToBase(e):e,r)}async realpathPromise(e){return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(e)))}realpathSync(e){return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(e)))}async existsPromise(e){return this.baseFs.existsPromise(this.mapToBase(e))}existsSync(e){return this.baseFs.existsSync(this.mapToBase(e))}accessSync(e,r){return this.baseFs.accessSync(this.mapToBase(e),r)}async accessPromise(e,r){return this.baseFs.accessPromise(this.mapToBase(e),r)}async statPromise(e,r){return this.baseFs.statPromise(this.mapToBase(e),r)}statSync(e,r){return this.baseFs.statSync(this.mapToBase(e),r)}async fstatPromise(e,r){return this.baseFs.fstatPromise(e,r)}fstatSync(e,r){return this.baseFs.fstatSync(e,r)}lstatPromise(e,r){return this.baseFs.lstatPromise(this.mapToBase(e),r)}lstatSync(e,r){return this.baseFs.lstatSync(this.mapToBase(e),r)}async fchmodPromise(e,r){return this.baseFs.fchmodPromise(e,r)}fchmodSync(e,r){return this.baseFs.fchmodSync(e,r)}async chmodPromise(e,r){return this.baseFs.chmodPromise(this.mapToBase(e),r)}chmodSync(e,r){return this.baseFs.chmodSync(this.mapToBase(e),r)}async fchownPromise(e,r,o){return this.baseFs.fchownPromise(e,r,o)}fchownSync(e,r,o){return this.baseFs.fchownSync(e,r,o)}async chownPromise(e,r,o){return this.baseFs.chownPromise(this.mapToBase(e),r,o)}chownSync(e,r,o){return this.baseFs.chownSync(this.mapToBase(e),r,o)}async renamePromise(e,r){return this.baseFs.renamePromise(this.mapToBase(e),this.mapToBase(r))}renameSync(e,r){return this.baseFs.renameSync(this.mapToBase(e),this.mapToBase(r))}async copyFilePromise(e,r,o=0){return this.baseFs.copyFilePromise(this.mapToBase(e),this.mapToBase(r),o)}copyFileSync(e,r,o=0){return this.baseFs.copyFileSync(this.mapToBase(e),this.mapToBase(r),o)}async appendFilePromise(e,r,o){return this.baseFs.appendFilePromise(this.fsMapToBase(e),r,o)}appendFileSync(e,r,o){return this.baseFs.appendFileSync(this.fsMapToBase(e),r,o)}async writeFilePromise(e,r,o){return this.baseFs.writeFilePromise(this.fsMapToBase(e),r,o)}writeFileSync(e,r,o){return this.baseFs.writeFileSync(this.fsMapToBase(e),r,o)}async unlinkPromise(e){return this.baseFs.unlinkPromise(this.mapToBase(e))}unlinkSync(e){return this.baseFs.unlinkSync(this.mapToBase(e))}async utimesPromise(e,r,o){return this.baseFs.utimesPromise(this.mapToBase(e),r,o)}utimesSync(e,r,o){return this.baseFs.utimesSync(this.mapToBase(e),r,o)}async lutimesPromise(e,r,o){return this.baseFs.lutimesPromise(this.mapToBase(e),r,o)}lutimesSync(e,r,o){return this.baseFs.lutimesSync(this.mapToBase(e),r,o)}async mkdirPromise(e,r){return this.baseFs.mkdirPromise(this.mapToBase(e),r)}mkdirSync(e,r){return this.baseFs.mkdirSync(this.mapToBase(e),r)}async rmdirPromise(e,r){return this.baseFs.rmdirPromise(this.mapToBase(e),r)}rmdirSync(e,r){return this.baseFs.rmdirSync(this.mapToBase(e),r)}async linkPromise(e,r){return this.baseFs.linkPromise(this.mapToBase(e),this.mapToBase(r))}linkSync(e,r){return this.baseFs.linkSync(this.mapToBase(e),this.mapToBase(r))}async symlinkPromise(e,r,o){let a=this.mapToBase(r);if(this.pathUtils.isAbsolute(e))return this.baseFs.symlinkPromise(this.mapToBase(e),a,o);let n=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(r),e)),u=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(a),n);return this.baseFs.symlinkPromise(u,a,o)}symlinkSync(e,r,o){let a=this.mapToBase(r);if(this.pathUtils.isAbsolute(e))return this.baseFs.symlinkSync(this.mapToBase(e),a,o);let n=this.mapToBase(this.pathUtils.join(this.pathUtils.dirname(r),e)),u=this.baseFs.pathUtils.relative(this.baseFs.pathUtils.dirname(a),n);return this.baseFs.symlinkSync(u,a,o)}async readFilePromise(e,r){return this.baseFs.readFilePromise(this.fsMapToBase(e),r)}readFileSync(e,r){return this.baseFs.readFileSync(this.fsMapToBase(e),r)}readdirPromise(e,r){return this.baseFs.readdirPromise(this.mapToBase(e),r)}readdirSync(e,r){return this.baseFs.readdirSync(this.mapToBase(e),r)}async readlinkPromise(e){return this.mapFromBase(await this.baseFs.readlinkPromise(this.mapToBase(e)))}readlinkSync(e){return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(e)))}async truncatePromise(e,r){return this.baseFs.truncatePromise(this.mapToBase(e),r)}truncateSync(e,r){return this.baseFs.truncateSync(this.mapToBase(e),r)}async ftruncatePromise(e,r){return this.baseFs.ftruncatePromise(e,r)}ftruncateSync(e,r){return this.baseFs.ftruncateSync(e,r)}watch(e,r,o){return this.baseFs.watch(this.mapToBase(e),r,o)}watchFile(e,r,o){return this.baseFs.watchFile(this.mapToBase(e),r,o)}unwatchFile(e,r){return this.baseFs.unwatchFile(this.mapToBase(e),r)}fsMapToBase(e){return typeof e=="number"?e:this.mapToBase(e)}}});var Uu,Y7=Et(()=>{gf();Uu=class extends Ps{constructor(r,{baseFs:o,pathUtils:a}){super(a);this.target=r,this.baseFs=o}getRealPath(){return this.target}getBaseFs(){return this.baseFs}mapFromBase(r){return r}mapToBase(r){return r}}});function W7(t){let e=t;return typeof t.path=="string"&&(e.path=ue.toPortablePath(t.path)),e}var V7,Rn,Hg=Et(()=>{V7=$e(Be("fs"));_g();Ca();Rn=class extends Ou{constructor(r=V7.default){super();this.realFs=r}getExtractHint(){return!1}getRealPath(){return Bt.root}resolve(r){return K.resolve(r)}async openPromise(r,o,a){return await new Promise((n,u)=>{this.realFs.open(ue.fromPortablePath(r),o,a,this.makeCallback(n,u))})}openSync(r,o,a){return this.realFs.openSync(ue.fromPortablePath(r),o,a)}async opendirPromise(r,o){return await new Promise((a,n)=>{typeof o<"u"?this.realFs.opendir(ue.fromPortablePath(r),o,this.makeCallback(a,n)):this.realFs.opendir(ue.fromPortablePath(r),this.makeCallback(a,n))}).then(a=>{let n=a;return Object.defineProperty(n,"path",{value:r,configurable:!0,writable:!0}),n})}opendirSync(r,o){let n=typeof o<"u"?this.realFs.opendirSync(ue.fromPortablePath(r),o):this.realFs.opendirSync(ue.fromPortablePath(r));return Object.defineProperty(n,"path",{value:r,configurable:!0,writable:!0}),n}async readPromise(r,o,a=0,n=0,u=-1){return await new Promise((A,p)=>{this.realFs.read(r,o,a,n,u,(h,E)=>{h?p(h):A(E)})})}readSync(r,o,a,n,u){return this.realFs.readSync(r,o,a,n,u)}async writePromise(r,o,a,n,u){return await new Promise((A,p)=>typeof o=="string"?this.realFs.write(r,o,a,this.makeCallback(A,p)):this.realFs.write(r,o,a,n,u,this.makeCallback(A,p)))}writeSync(r,o,a,n,u){return typeof o=="string"?this.realFs.writeSync(r,o,a):this.realFs.writeSync(r,o,a,n,u)}async closePromise(r){await new Promise((o,a)=>{this.realFs.close(r,this.makeCallback(o,a))})}closeSync(r){this.realFs.closeSync(r)}createReadStream(r,o){let a=r!==null?ue.fromPortablePath(r):r;return this.realFs.createReadStream(a,o)}createWriteStream(r,o){let a=r!==null?ue.fromPortablePath(r):r;return this.realFs.createWriteStream(a,o)}async realpathPromise(r){return await new Promise((o,a)=>{this.realFs.realpath(ue.fromPortablePath(r),{},this.makeCallback(o,a))}).then(o=>ue.toPortablePath(o))}realpathSync(r){return ue.toPortablePath(this.realFs.realpathSync(ue.fromPortablePath(r),{}))}async existsPromise(r){return await new Promise(o=>{this.realFs.exists(ue.fromPortablePath(r),o)})}accessSync(r,o){return this.realFs.accessSync(ue.fromPortablePath(r),o)}async accessPromise(r,o){return await new Promise((a,n)=>{this.realFs.access(ue.fromPortablePath(r),o,this.makeCallback(a,n))})}existsSync(r){return this.realFs.existsSync(ue.fromPortablePath(r))}async statPromise(r,o){return await new Promise((a,n)=>{o?this.realFs.stat(ue.fromPortablePath(r),o,this.makeCallback(a,n)):this.realFs.stat(ue.fromPortablePath(r),this.makeCallback(a,n))})}statSync(r,o){return o?this.realFs.statSync(ue.fromPortablePath(r),o):this.realFs.statSync(ue.fromPortablePath(r))}async fstatPromise(r,o){return await new Promise((a,n)=>{o?this.realFs.fstat(r,o,this.makeCallback(a,n)):this.realFs.fstat(r,this.makeCallback(a,n))})}fstatSync(r,o){return o?this.realFs.fstatSync(r,o):this.realFs.fstatSync(r)}async lstatPromise(r,o){return await new Promise((a,n)=>{o?this.realFs.lstat(ue.fromPortablePath(r),o,this.makeCallback(a,n)):this.realFs.lstat(ue.fromPortablePath(r),this.makeCallback(a,n))})}lstatSync(r,o){return o?this.realFs.lstatSync(ue.fromPortablePath(r),o):this.realFs.lstatSync(ue.fromPortablePath(r))}async fchmodPromise(r,o){return await new Promise((a,n)=>{this.realFs.fchmod(r,o,this.makeCallback(a,n))})}fchmodSync(r,o){return this.realFs.fchmodSync(r,o)}async chmodPromise(r,o){return await new Promise((a,n)=>{this.realFs.chmod(ue.fromPortablePath(r),o,this.makeCallback(a,n))})}chmodSync(r,o){return this.realFs.chmodSync(ue.fromPortablePath(r),o)}async fchownPromise(r,o,a){return await new Promise((n,u)=>{this.realFs.fchown(r,o,a,this.makeCallback(n,u))})}fchownSync(r,o,a){return this.realFs.fchownSync(r,o,a)}async chownPromise(r,o,a){return await new Promise((n,u)=>{this.realFs.chown(ue.fromPortablePath(r),o,a,this.makeCallback(n,u))})}chownSync(r,o,a){return this.realFs.chownSync(ue.fromPortablePath(r),o,a)}async renamePromise(r,o){return await new Promise((a,n)=>{this.realFs.rename(ue.fromPortablePath(r),ue.fromPortablePath(o),this.makeCallback(a,n))})}renameSync(r,o){return this.realFs.renameSync(ue.fromPortablePath(r),ue.fromPortablePath(o))}async copyFilePromise(r,o,a=0){return await new Promise((n,u)=>{this.realFs.copyFile(ue.fromPortablePath(r),ue.fromPortablePath(o),a,this.makeCallback(n,u))})}copyFileSync(r,o,a=0){return this.realFs.copyFileSync(ue.fromPortablePath(r),ue.fromPortablePath(o),a)}async appendFilePromise(r,o,a){return await new Promise((n,u)=>{let A=typeof r=="string"?ue.fromPortablePath(r):r;a?this.realFs.appendFile(A,o,a,this.makeCallback(n,u)):this.realFs.appendFile(A,o,this.makeCallback(n,u))})}appendFileSync(r,o,a){let n=typeof r=="string"?ue.fromPortablePath(r):r;a?this.realFs.appendFileSync(n,o,a):this.realFs.appendFileSync(n,o)}async writeFilePromise(r,o,a){return await new Promise((n,u)=>{let A=typeof r=="string"?ue.fromPortablePath(r):r;a?this.realFs.writeFile(A,o,a,this.makeCallback(n,u)):this.realFs.writeFile(A,o,this.makeCallback(n,u))})}writeFileSync(r,o,a){let n=typeof r=="string"?ue.fromPortablePath(r):r;a?this.realFs.writeFileSync(n,o,a):this.realFs.writeFileSync(n,o)}async unlinkPromise(r){return await new Promise((o,a)=>{this.realFs.unlink(ue.fromPortablePath(r),this.makeCallback(o,a))})}unlinkSync(r){return this.realFs.unlinkSync(ue.fromPortablePath(r))}async utimesPromise(r,o,a){return await new Promise((n,u)=>{this.realFs.utimes(ue.fromPortablePath(r),o,a,this.makeCallback(n,u))})}utimesSync(r,o,a){this.realFs.utimesSync(ue.fromPortablePath(r),o,a)}async lutimesPromise(r,o,a){return await new Promise((n,u)=>{this.realFs.lutimes(ue.fromPortablePath(r),o,a,this.makeCallback(n,u))})}lutimesSync(r,o,a){this.realFs.lutimesSync(ue.fromPortablePath(r),o,a)}async mkdirPromise(r,o){return await new Promise((a,n)=>{this.realFs.mkdir(ue.fromPortablePath(r),o,this.makeCallback(a,n))})}mkdirSync(r,o){return this.realFs.mkdirSync(ue.fromPortablePath(r),o)}async rmdirPromise(r,o){return await new Promise((a,n)=>{o?this.realFs.rmdir(ue.fromPortablePath(r),o,this.makeCallback(a,n)):this.realFs.rmdir(ue.fromPortablePath(r),this.makeCallback(a,n))})}rmdirSync(r,o){return this.realFs.rmdirSync(ue.fromPortablePath(r),o)}async linkPromise(r,o){return await new Promise((a,n)=>{this.realFs.link(ue.fromPortablePath(r),ue.fromPortablePath(o),this.makeCallback(a,n))})}linkSync(r,o){return this.realFs.linkSync(ue.fromPortablePath(r),ue.fromPortablePath(o))}async symlinkPromise(r,o,a){return await new Promise((n,u)=>{this.realFs.symlink(ue.fromPortablePath(r.replace(/\/+$/,"")),ue.fromPortablePath(o),a,this.makeCallback(n,u))})}symlinkSync(r,o,a){return this.realFs.symlinkSync(ue.fromPortablePath(r.replace(/\/+$/,"")),ue.fromPortablePath(o),a)}async readFilePromise(r,o){return await new Promise((a,n)=>{let u=typeof r=="string"?ue.fromPortablePath(r):r;this.realFs.readFile(u,o,this.makeCallback(a,n))})}readFileSync(r,o){let a=typeof r=="string"?ue.fromPortablePath(r):r;return this.realFs.readFileSync(a,o)}async readdirPromise(r,o){return await new Promise((a,n)=>{o?o.recursive&&process.platform==="win32"?o.withFileTypes?this.realFs.readdir(ue.fromPortablePath(r),o,this.makeCallback(u=>a(u.map(W7)),n)):this.realFs.readdir(ue.fromPortablePath(r),o,this.makeCallback(u=>a(u.map(ue.toPortablePath)),n)):this.realFs.readdir(ue.fromPortablePath(r),o,this.makeCallback(a,n)):this.realFs.readdir(ue.fromPortablePath(r),this.makeCallback(a,n))})}readdirSync(r,o){return o?o.recursive&&process.platform==="win32"?o.withFileTypes?this.realFs.readdirSync(ue.fromPortablePath(r),o).map(W7):this.realFs.readdirSync(ue.fromPortablePath(r),o).map(ue.toPortablePath):this.realFs.readdirSync(ue.fromPortablePath(r),o):this.realFs.readdirSync(ue.fromPortablePath(r))}async readlinkPromise(r){return await new Promise((o,a)=>{this.realFs.readlink(ue.fromPortablePath(r),this.makeCallback(o,a))}).then(o=>ue.toPortablePath(o))}readlinkSync(r){return ue.toPortablePath(this.realFs.readlinkSync(ue.fromPortablePath(r)))}async truncatePromise(r,o){return await new Promise((a,n)=>{this.realFs.truncate(ue.fromPortablePath(r),o,this.makeCallback(a,n))})}truncateSync(r,o){return this.realFs.truncateSync(ue.fromPortablePath(r),o)}async ftruncatePromise(r,o){return await new Promise((a,n)=>{this.realFs.ftruncate(r,o,this.makeCallback(a,n))})}ftruncateSync(r,o){return this.realFs.ftruncateSync(r,o)}watch(r,o,a){return this.realFs.watch(ue.fromPortablePath(r),o,a)}watchFile(r,o,a){return this.realFs.watchFile(ue.fromPortablePath(r),o,a)}unwatchFile(r,o){return this.realFs.unwatchFile(ue.fromPortablePath(r),o)}makeCallback(r,o){return(a,n)=>{a?o(a):r(n)}}}});var gn,K7=Et(()=>{Hg();gf();Ca();gn=class extends Ps{constructor(r,{baseFs:o=new Rn}={}){super(K);this.target=this.pathUtils.normalize(r),this.baseFs=o}getRealPath(){return this.pathUtils.resolve(this.baseFs.getRealPath(),this.target)}resolve(r){return this.pathUtils.isAbsolute(r)?K.normalize(r):this.baseFs.resolve(K.join(this.target,r))}mapFromBase(r){return r}mapToBase(r){return this.pathUtils.isAbsolute(r)?r:this.pathUtils.join(this.target,r)}}});var J7,_u,z7=Et(()=>{Hg();gf();Ca();J7=Bt.root,_u=class extends Ps{constructor(r,{baseFs:o=new Rn}={}){super(K);this.target=this.pathUtils.resolve(Bt.root,r),this.baseFs=o}getRealPath(){return this.pathUtils.resolve(this.baseFs.getRealPath(),this.pathUtils.relative(Bt.root,this.target))}getTarget(){return this.target}getBaseFs(){return this.baseFs}mapToBase(r){let o=this.pathUtils.normalize(r);if(this.pathUtils.isAbsolute(r))return this.pathUtils.resolve(this.target,this.pathUtils.relative(J7,r));if(o.match(/^\.\.\/?/))throw new Error(`Resolving this path (${r}) would escape the jail`);return this.pathUtils.resolve(this.target,r)}mapFromBase(r){return this.pathUtils.resolve(J7,this.pathUtils.relative(this.target,r))}}});var ny,X7=Et(()=>{gf();ny=class extends Ps{constructor(r,o){super(o);this.instance=null;this.factory=r}get baseFs(){return this.instance||(this.instance=this.factory()),this.instance}set baseFs(r){this.instance=r}mapFromBase(r){return r}mapToBase(r){return r}}});var jg,wa,_p,Z7=Et(()=>{jg=Be("fs");_g();Hg();VT();BD();Ca();wa=4278190080,_p=class extends Ou{constructor({baseFs:r=new Rn,filter:o=null,magicByte:a=42,maxOpenFiles:n=1/0,useCache:u=!0,maxAge:A=5e3,typeCheck:p=jg.constants.S_IFREG,getMountPoint:h,factoryPromise:E,factorySync:I}){if(Math.floor(a)!==a||!(a>1&&a<=127))throw new Error("The magic byte must be set to a round value between 1 and 127 included");super();this.fdMap=new Map;this.nextFd=3;this.isMount=new Set;this.notMount=new Set;this.realPaths=new Map;this.limitOpenFilesTimeout=null;this.baseFs=r,this.mountInstances=u?new Map:null,this.factoryPromise=E,this.factorySync=I,this.filter=o,this.getMountPoint=h,this.magic=a<<24,this.maxAge=A,this.maxOpenFiles=n,this.typeCheck=p}getExtractHint(r){return this.baseFs.getExtractHint(r)}getRealPath(){return this.baseFs.getRealPath()}saveAndClose(){if(Og(this),this.mountInstances)for(let[r,{childFs:o}]of this.mountInstances.entries())o.saveAndClose?.(),this.mountInstances.delete(r)}discardAndClose(){if(Og(this),this.mountInstances)for(let[r,{childFs:o}]of this.mountInstances.entries())o.discardAndClose?.(),this.mountInstances.delete(r)}resolve(r){return this.baseFs.resolve(r)}remapFd(r,o){let a=this.nextFd++|this.magic;return this.fdMap.set(a,[r,o]),a}async openPromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.openPromise(r,o,a),async(n,{subPath:u})=>this.remapFd(n,await n.openPromise(u,o,a)))}openSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.openSync(r,o,a),(n,{subPath:u})=>this.remapFd(n,n.openSync(u,o,a)))}async opendirPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.opendirPromise(r,o),async(a,{subPath:n})=>await a.opendirPromise(n,o),{requireSubpath:!1})}opendirSync(r,o){return this.makeCallSync(r,()=>this.baseFs.opendirSync(r,o),(a,{subPath:n})=>a.opendirSync(n,o),{requireSubpath:!1})}async readPromise(r,o,a,n,u){if((r&wa)!==this.magic)return await this.baseFs.readPromise(r,o,a,n,u);let A=this.fdMap.get(r);if(typeof A>"u")throw Io("read");let[p,h]=A;return await p.readPromise(h,o,a,n,u)}readSync(r,o,a,n,u){if((r&wa)!==this.magic)return this.baseFs.readSync(r,o,a,n,u);let A=this.fdMap.get(r);if(typeof A>"u")throw Io("readSync");let[p,h]=A;return p.readSync(h,o,a,n,u)}async writePromise(r,o,a,n,u){if((r&wa)!==this.magic)return typeof o=="string"?await this.baseFs.writePromise(r,o,a):await this.baseFs.writePromise(r,o,a,n,u);let A=this.fdMap.get(r);if(typeof A>"u")throw Io("write");let[p,h]=A;return typeof o=="string"?await p.writePromise(h,o,a):await p.writePromise(h,o,a,n,u)}writeSync(r,o,a,n,u){if((r&wa)!==this.magic)return typeof o=="string"?this.baseFs.writeSync(r,o,a):this.baseFs.writeSync(r,o,a,n,u);let A=this.fdMap.get(r);if(typeof A>"u")throw Io("writeSync");let[p,h]=A;return typeof o=="string"?p.writeSync(h,o,a):p.writeSync(h,o,a,n,u)}async closePromise(r){if((r&wa)!==this.magic)return await this.baseFs.closePromise(r);let o=this.fdMap.get(r);if(typeof o>"u")throw Io("close");this.fdMap.delete(r);let[a,n]=o;return await a.closePromise(n)}closeSync(r){if((r&wa)!==this.magic)return this.baseFs.closeSync(r);let o=this.fdMap.get(r);if(typeof o>"u")throw Io("closeSync");this.fdMap.delete(r);let[a,n]=o;return a.closeSync(n)}createReadStream(r,o){return r===null?this.baseFs.createReadStream(r,o):this.makeCallSync(r,()=>this.baseFs.createReadStream(r,o),(a,{archivePath:n,subPath:u})=>{let A=a.createReadStream(u,o);return A.path=ue.fromPortablePath(this.pathUtils.join(n,u)),A})}createWriteStream(r,o){return r===null?this.baseFs.createWriteStream(r,o):this.makeCallSync(r,()=>this.baseFs.createWriteStream(r,o),(a,{subPath:n})=>a.createWriteStream(n,o))}async realpathPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.realpathPromise(r),async(o,{archivePath:a,subPath:n})=>{let u=this.realPaths.get(a);return typeof u>"u"&&(u=await this.baseFs.realpathPromise(a),this.realPaths.set(a,u)),this.pathUtils.join(u,this.pathUtils.relative(Bt.root,await o.realpathPromise(n)))})}realpathSync(r){return this.makeCallSync(r,()=>this.baseFs.realpathSync(r),(o,{archivePath:a,subPath:n})=>{let u=this.realPaths.get(a);return typeof u>"u"&&(u=this.baseFs.realpathSync(a),this.realPaths.set(a,u)),this.pathUtils.join(u,this.pathUtils.relative(Bt.root,o.realpathSync(n)))})}async existsPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.existsPromise(r),async(o,{subPath:a})=>await o.existsPromise(a))}existsSync(r){return this.makeCallSync(r,()=>this.baseFs.existsSync(r),(o,{subPath:a})=>o.existsSync(a))}async accessPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.accessPromise(r,o),async(a,{subPath:n})=>await a.accessPromise(n,o))}accessSync(r,o){return this.makeCallSync(r,()=>this.baseFs.accessSync(r,o),(a,{subPath:n})=>a.accessSync(n,o))}async statPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.statPromise(r,o),async(a,{subPath:n})=>await a.statPromise(n,o))}statSync(r,o){return this.makeCallSync(r,()=>this.baseFs.statSync(r,o),(a,{subPath:n})=>a.statSync(n,o))}async fstatPromise(r,o){if((r&wa)!==this.magic)return this.baseFs.fstatPromise(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw Io("fstat");let[n,u]=a;return n.fstatPromise(u,o)}fstatSync(r,o){if((r&wa)!==this.magic)return this.baseFs.fstatSync(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw Io("fstatSync");let[n,u]=a;return n.fstatSync(u,o)}async lstatPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.lstatPromise(r,o),async(a,{subPath:n})=>await a.lstatPromise(n,o))}lstatSync(r,o){return this.makeCallSync(r,()=>this.baseFs.lstatSync(r,o),(a,{subPath:n})=>a.lstatSync(n,o))}async fchmodPromise(r,o){if((r&wa)!==this.magic)return this.baseFs.fchmodPromise(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw Io("fchmod");let[n,u]=a;return n.fchmodPromise(u,o)}fchmodSync(r,o){if((r&wa)!==this.magic)return this.baseFs.fchmodSync(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw Io("fchmodSync");let[n,u]=a;return n.fchmodSync(u,o)}async chmodPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.chmodPromise(r,o),async(a,{subPath:n})=>await a.chmodPromise(n,o))}chmodSync(r,o){return this.makeCallSync(r,()=>this.baseFs.chmodSync(r,o),(a,{subPath:n})=>a.chmodSync(n,o))}async fchownPromise(r,o,a){if((r&wa)!==this.magic)return this.baseFs.fchownPromise(r,o,a);let n=this.fdMap.get(r);if(typeof n>"u")throw Io("fchown");let[u,A]=n;return u.fchownPromise(A,o,a)}fchownSync(r,o,a){if((r&wa)!==this.magic)return this.baseFs.fchownSync(r,o,a);let n=this.fdMap.get(r);if(typeof n>"u")throw Io("fchownSync");let[u,A]=n;return u.fchownSync(A,o,a)}async chownPromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.chownPromise(r,o,a),async(n,{subPath:u})=>await n.chownPromise(u,o,a))}chownSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.chownSync(r,o,a),(n,{subPath:u})=>n.chownSync(u,o,a))}async renamePromise(r,o){return await this.makeCallPromise(r,async()=>await this.makeCallPromise(o,async()=>await this.baseFs.renamePromise(r,o),async()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})}),async(a,{subPath:n})=>await this.makeCallPromise(o,async()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})},async(u,{subPath:A})=>{if(a!==u)throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"});return await a.renamePromise(n,A)}))}renameSync(r,o){return this.makeCallSync(r,()=>this.makeCallSync(o,()=>this.baseFs.renameSync(r,o),()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})}),(a,{subPath:n})=>this.makeCallSync(o,()=>{throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"})},(u,{subPath:A})=>{if(a!==u)throw Object.assign(new Error("EEXDEV: cross-device link not permitted"),{code:"EEXDEV"});return a.renameSync(n,A)}))}async copyFilePromise(r,o,a=0){let n=async(u,A,p,h)=>{if((a&jg.constants.COPYFILE_FICLONE_FORCE)!==0)throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${A}' -> ${h}'`),{code:"EXDEV"});if(a&jg.constants.COPYFILE_EXCL&&await this.existsPromise(A))throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${A}' -> '${h}'`),{code:"EEXIST"});let E;try{E=await u.readFilePromise(A)}catch{throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${A}' -> '${h}'`),{code:"EINVAL"})}await p.writeFilePromise(h,E)};return await this.makeCallPromise(r,async()=>await this.makeCallPromise(o,async()=>await this.baseFs.copyFilePromise(r,o,a),async(u,{subPath:A})=>await n(this.baseFs,r,u,A)),async(u,{subPath:A})=>await this.makeCallPromise(o,async()=>await n(u,A,this.baseFs,o),async(p,{subPath:h})=>u!==p?await n(u,A,p,h):await u.copyFilePromise(A,h,a)))}copyFileSync(r,o,a=0){let n=(u,A,p,h)=>{if((a&jg.constants.COPYFILE_FICLONE_FORCE)!==0)throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${A}' -> ${h}'`),{code:"EXDEV"});if(a&jg.constants.COPYFILE_EXCL&&this.existsSync(A))throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${A}' -> '${h}'`),{code:"EEXIST"});let E;try{E=u.readFileSync(A)}catch{throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${A}' -> '${h}'`),{code:"EINVAL"})}p.writeFileSync(h,E)};return this.makeCallSync(r,()=>this.makeCallSync(o,()=>this.baseFs.copyFileSync(r,o,a),(u,{subPath:A})=>n(this.baseFs,r,u,A)),(u,{subPath:A})=>this.makeCallSync(o,()=>n(u,A,this.baseFs,o),(p,{subPath:h})=>u!==p?n(u,A,p,h):u.copyFileSync(A,h,a)))}async appendFilePromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.appendFilePromise(r,o,a),async(n,{subPath:u})=>await n.appendFilePromise(u,o,a))}appendFileSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.appendFileSync(r,o,a),(n,{subPath:u})=>n.appendFileSync(u,o,a))}async writeFilePromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.writeFilePromise(r,o,a),async(n,{subPath:u})=>await n.writeFilePromise(u,o,a))}writeFileSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.writeFileSync(r,o,a),(n,{subPath:u})=>n.writeFileSync(u,o,a))}async unlinkPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.unlinkPromise(r),async(o,{subPath:a})=>await o.unlinkPromise(a))}unlinkSync(r){return this.makeCallSync(r,()=>this.baseFs.unlinkSync(r),(o,{subPath:a})=>o.unlinkSync(a))}async utimesPromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.utimesPromise(r,o,a),async(n,{subPath:u})=>await n.utimesPromise(u,o,a))}utimesSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.utimesSync(r,o,a),(n,{subPath:u})=>n.utimesSync(u,o,a))}async lutimesPromise(r,o,a){return await this.makeCallPromise(r,async()=>await this.baseFs.lutimesPromise(r,o,a),async(n,{subPath:u})=>await n.lutimesPromise(u,o,a))}lutimesSync(r,o,a){return this.makeCallSync(r,()=>this.baseFs.lutimesSync(r,o,a),(n,{subPath:u})=>n.lutimesSync(u,o,a))}async mkdirPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.mkdirPromise(r,o),async(a,{subPath:n})=>await a.mkdirPromise(n,o))}mkdirSync(r,o){return this.makeCallSync(r,()=>this.baseFs.mkdirSync(r,o),(a,{subPath:n})=>a.mkdirSync(n,o))}async rmdirPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.rmdirPromise(r,o),async(a,{subPath:n})=>await a.rmdirPromise(n,o))}rmdirSync(r,o){return this.makeCallSync(r,()=>this.baseFs.rmdirSync(r,o),(a,{subPath:n})=>a.rmdirSync(n,o))}async linkPromise(r,o){return await this.makeCallPromise(o,async()=>await this.baseFs.linkPromise(r,o),async(a,{subPath:n})=>await a.linkPromise(r,n))}linkSync(r,o){return this.makeCallSync(o,()=>this.baseFs.linkSync(r,o),(a,{subPath:n})=>a.linkSync(r,n))}async symlinkPromise(r,o,a){return await this.makeCallPromise(o,async()=>await this.baseFs.symlinkPromise(r,o,a),async(n,{subPath:u})=>await n.symlinkPromise(r,u))}symlinkSync(r,o,a){return this.makeCallSync(o,()=>this.baseFs.symlinkSync(r,o,a),(n,{subPath:u})=>n.symlinkSync(r,u))}async readFilePromise(r,o){return this.makeCallPromise(r,async()=>await this.baseFs.readFilePromise(r,o),async(a,{subPath:n})=>await a.readFilePromise(n,o))}readFileSync(r,o){return this.makeCallSync(r,()=>this.baseFs.readFileSync(r,o),(a,{subPath:n})=>a.readFileSync(n,o))}async readdirPromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.readdirPromise(r,o),async(a,{subPath:n})=>await a.readdirPromise(n,o),{requireSubpath:!1})}readdirSync(r,o){return this.makeCallSync(r,()=>this.baseFs.readdirSync(r,o),(a,{subPath:n})=>a.readdirSync(n,o),{requireSubpath:!1})}async readlinkPromise(r){return await this.makeCallPromise(r,async()=>await this.baseFs.readlinkPromise(r),async(o,{subPath:a})=>await o.readlinkPromise(a))}readlinkSync(r){return this.makeCallSync(r,()=>this.baseFs.readlinkSync(r),(o,{subPath:a})=>o.readlinkSync(a))}async truncatePromise(r,o){return await this.makeCallPromise(r,async()=>await this.baseFs.truncatePromise(r,o),async(a,{subPath:n})=>await a.truncatePromise(n,o))}truncateSync(r,o){return this.makeCallSync(r,()=>this.baseFs.truncateSync(r,o),(a,{subPath:n})=>a.truncateSync(n,o))}async ftruncatePromise(r,o){if((r&wa)!==this.magic)return this.baseFs.ftruncatePromise(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw Io("ftruncate");let[n,u]=a;return n.ftruncatePromise(u,o)}ftruncateSync(r,o){if((r&wa)!==this.magic)return this.baseFs.ftruncateSync(r,o);let a=this.fdMap.get(r);if(typeof a>"u")throw Io("ftruncateSync");let[n,u]=a;return n.ftruncateSync(u,o)}watch(r,o,a){return this.makeCallSync(r,()=>this.baseFs.watch(r,o,a),(n,{subPath:u})=>n.watch(u,o,a))}watchFile(r,o,a){return this.makeCallSync(r,()=>this.baseFs.watchFile(r,o,a),()=>ry(this,r,o,a))}unwatchFile(r,o){return this.makeCallSync(r,()=>this.baseFs.unwatchFile(r,o),()=>Mg(this,r,o))}async makeCallPromise(r,o,a,{requireSubpath:n=!0}={}){if(typeof r!="string")return await o();let u=this.resolve(r),A=this.findMount(u);return A?n&&A.subPath==="/"?await o():await this.getMountPromise(A.archivePath,async p=>await a(p,A)):await o()}makeCallSync(r,o,a,{requireSubpath:n=!0}={}){if(typeof r!="string")return o();let u=this.resolve(r),A=this.findMount(u);return!A||n&&A.subPath==="/"?o():this.getMountSync(A.archivePath,p=>a(p,A))}findMount(r){if(this.filter&&!this.filter.test(r))return null;let o="";for(;;){let a=r.substring(o.length),n=this.getMountPoint(a,o);if(!n)return null;if(o=this.pathUtils.join(o,n),!this.isMount.has(o)){if(this.notMount.has(o))continue;try{if(this.typeCheck!==null&&(this.baseFs.lstatSync(o).mode&jg.constants.S_IFMT)!==this.typeCheck){this.notMount.add(o);continue}}catch{return null}this.isMount.add(o)}return{archivePath:o,subPath:this.pathUtils.join(Bt.root,r.substring(o.length))}}}limitOpenFiles(r){if(this.mountInstances===null)return;let o=Date.now(),a=o+this.maxAge,n=r===null?0:this.mountInstances.size-r;for(let[u,{childFs:A,expiresAt:p,refCount:h}]of this.mountInstances.entries())if(!(h!==0||A.hasOpenFileHandles?.())){if(o>=p){A.saveAndClose?.(),this.mountInstances.delete(u),n-=1;continue}else if(r===null||n<=0){a=p;break}A.saveAndClose?.(),this.mountInstances.delete(u),n-=1}this.limitOpenFilesTimeout===null&&(r===null&&this.mountInstances.size>0||r!==null)&&isFinite(a)&&(this.limitOpenFilesTimeout=setTimeout(()=>{this.limitOpenFilesTimeout=null,this.limitOpenFiles(null)},a-o).unref())}async getMountPromise(r,o){if(this.mountInstances){let a=this.mountInstances.get(r);if(!a){let n=await this.factoryPromise(this.baseFs,r);a=this.mountInstances.get(r),a||(a={childFs:n(),expiresAt:0,refCount:0})}this.mountInstances.delete(r),this.limitOpenFiles(this.maxOpenFiles-1),this.mountInstances.set(r,a),a.expiresAt=Date.now()+this.maxAge,a.refCount+=1;try{return await o(a.childFs)}finally{a.refCount-=1}}else{let a=(await this.factoryPromise(this.baseFs,r))();try{return await o(a)}finally{a.saveAndClose?.()}}}getMountSync(r,o){if(this.mountInstances){let a=this.mountInstances.get(r);return a||(a={childFs:this.factorySync(this.baseFs,r),expiresAt:0,refCount:0}),this.mountInstances.delete(r),this.limitOpenFiles(this.maxOpenFiles-1),this.mountInstances.set(r,a),a.expiresAt=Date.now()+this.maxAge,o(a.childFs)}else{let a=this.factorySync(this.baseFs,r);try{return o(a)}finally{a.saveAndClose?.()}}}}});var Zt,KT,Gw,$7=Et(()=>{_g();Ca();Zt=()=>Object.assign(new Error("ENOSYS: unsupported filesystem access"),{code:"ENOSYS"}),KT=class extends hf{constructor(){super(K)}getExtractHint(){throw Zt()}getRealPath(){throw Zt()}resolve(){throw Zt()}async openPromise(){throw Zt()}openSync(){throw Zt()}async opendirPromise(){throw Zt()}opendirSync(){throw Zt()}async readPromise(){throw Zt()}readSync(){throw Zt()}async writePromise(){throw Zt()}writeSync(){throw Zt()}async closePromise(){throw Zt()}closeSync(){throw Zt()}createWriteStream(){throw Zt()}createReadStream(){throw Zt()}async realpathPromise(){throw Zt()}realpathSync(){throw Zt()}async readdirPromise(){throw Zt()}readdirSync(){throw Zt()}async existsPromise(e){throw Zt()}existsSync(e){throw Zt()}async accessPromise(){throw Zt()}accessSync(){throw Zt()}async statPromise(){throw Zt()}statSync(){throw Zt()}async fstatPromise(e){throw Zt()}fstatSync(e){throw Zt()}async lstatPromise(e){throw Zt()}lstatSync(e){throw Zt()}async fchmodPromise(){throw Zt()}fchmodSync(){throw Zt()}async chmodPromise(){throw Zt()}chmodSync(){throw Zt()}async fchownPromise(){throw Zt()}fchownSync(){throw Zt()}async chownPromise(){throw Zt()}chownSync(){throw Zt()}async mkdirPromise(){throw Zt()}mkdirSync(){throw Zt()}async rmdirPromise(){throw Zt()}rmdirSync(){throw Zt()}async linkPromise(){throw Zt()}linkSync(){throw Zt()}async symlinkPromise(){throw Zt()}symlinkSync(){throw Zt()}async renamePromise(){throw Zt()}renameSync(){throw Zt()}async copyFilePromise(){throw Zt()}copyFileSync(){throw Zt()}async appendFilePromise(){throw Zt()}appendFileSync(){throw Zt()}async writeFilePromise(){throw Zt()}writeFileSync(){throw Zt()}async unlinkPromise(){throw Zt()}unlinkSync(){throw Zt()}async utimesPromise(){throw Zt()}utimesSync(){throw Zt()}async lutimesPromise(){throw Zt()}lutimesSync(){throw Zt()}async readFilePromise(){throw Zt()}readFileSync(){throw Zt()}async readlinkPromise(){throw Zt()}readlinkSync(){throw Zt()}async truncatePromise(){throw Zt()}truncateSync(){throw Zt()}async ftruncatePromise(e,r){throw Zt()}ftruncateSync(e,r){throw Zt()}watch(){throw Zt()}watchFile(){throw Zt()}unwatchFile(){throw Zt()}},Gw=KT;Gw.instance=new KT});var Hp,eY=Et(()=>{gf();Ca();Hp=class extends Ps{constructor(r){super(ue);this.baseFs=r}mapFromBase(r){return ue.fromPortablePath(r)}mapToBase(r){return ue.toPortablePath(r)}}});var R_e,JT,N_e,mi,tY=Et(()=>{Hg();gf();Ca();R_e=/^[0-9]+$/,JT=/^(\/(?:[^/]+\/)*?(?:\$\$virtual|__virtual__))((?:\/((?:[^/]+-)?[a-f0-9]+)(?:\/([^/]+))?)?((?:\/.*)?))$/,N_e=/^([^/]+-)?[a-f0-9]+$/,mi=class extends Ps{constructor({baseFs:r=new Rn}={}){super(K);this.baseFs=r}static makeVirtualPath(r,o,a){if(K.basename(r)!=="__virtual__")throw new Error('Assertion failed: Virtual folders must be named "__virtual__"');if(!K.basename(o).match(N_e))throw new Error("Assertion failed: Virtual components must be ended by an hexadecimal hash");let u=K.relative(K.dirname(r),a).split("/"),A=0;for(;A{zT=$e(Be("buffer")),kD=Be("url"),rY=Be("util");gf();Ca();bD=class extends Ps{constructor(r){super(ue);this.baseFs=r}mapFromBase(r){return r}mapToBase(r){if(typeof r=="string")return r;if(r instanceof kD.URL)return(0,kD.fileURLToPath)(r);if(Buffer.isBuffer(r)){let o=r.toString();if(!L_e(r,o))throw new Error("Non-utf8 buffers are not supported at the moment. Please upvote the following issue if you encounter this error: https://github.com/yarnpkg/berry/issues/4942");return o}throw new Error(`Unsupported path type: ${(0,rY.inspect)(r)}`)}}});var iY,Bo,df,jp,QD,FD,iy,Rc,Nc,M_e,O_e,U_e,__e,Yw,sY=Et(()=>{iY=Be("readline"),Bo=Symbol("kBaseFs"),df=Symbol("kFd"),jp=Symbol("kClosePromise"),QD=Symbol("kCloseResolve"),FD=Symbol("kCloseReject"),iy=Symbol("kRefs"),Rc=Symbol("kRef"),Nc=Symbol("kUnref"),Yw=class{constructor(e,r){this[M_e]=1;this[O_e]=void 0;this[U_e]=void 0;this[__e]=void 0;this[Bo]=r,this[df]=e}get fd(){return this[df]}async appendFile(e,r){try{this[Rc](this.appendFile);let o=(typeof r=="string"?r:r?.encoding)??void 0;return await this[Bo].appendFilePromise(this.fd,e,o?{encoding:o}:void 0)}finally{this[Nc]()}}async chown(e,r){try{return this[Rc](this.chown),await this[Bo].fchownPromise(this.fd,e,r)}finally{this[Nc]()}}async chmod(e){try{return this[Rc](this.chmod),await this[Bo].fchmodPromise(this.fd,e)}finally{this[Nc]()}}createReadStream(e){return this[Bo].createReadStream(null,{...e,fd:this.fd})}createWriteStream(e){return this[Bo].createWriteStream(null,{...e,fd:this.fd})}datasync(){throw new Error("Method not implemented.")}sync(){throw new Error("Method not implemented.")}async read(e,r,o,a){try{this[Rc](this.read);let n;return Buffer.isBuffer(e)?n=e:(e??={},n=e.buffer??Buffer.alloc(16384),r=e.offset||0,o=e.length??n.byteLength,a=e.position??null),r??=0,o??=0,o===0?{bytesRead:o,buffer:n}:{bytesRead:await this[Bo].readPromise(this.fd,n,r,o,a),buffer:n}}finally{this[Nc]()}}async readFile(e){try{this[Rc](this.readFile);let r=(typeof e=="string"?e:e?.encoding)??void 0;return await this[Bo].readFilePromise(this.fd,r)}finally{this[Nc]()}}readLines(e){return(0,iY.createInterface)({input:this.createReadStream(e),crlfDelay:1/0})}async stat(e){try{return this[Rc](this.stat),await this[Bo].fstatPromise(this.fd,e)}finally{this[Nc]()}}async truncate(e){try{return this[Rc](this.truncate),await this[Bo].ftruncatePromise(this.fd,e)}finally{this[Nc]()}}utimes(e,r){throw new Error("Method not implemented.")}async writeFile(e,r){try{this[Rc](this.writeFile);let o=(typeof r=="string"?r:r?.encoding)??void 0;await this[Bo].writeFilePromise(this.fd,e,o)}finally{this[Nc]()}}async write(...e){try{if(this[Rc](this.write),ArrayBuffer.isView(e[0])){let[r,o,a,n]=e;return{bytesWritten:await this[Bo].writePromise(this.fd,r,o??void 0,a??void 0,n??void 0),buffer:r}}else{let[r,o,a]=e;return{bytesWritten:await this[Bo].writePromise(this.fd,r,o,a),buffer:r}}}finally{this[Nc]()}}async writev(e,r){try{this[Rc](this.writev);let o=0;if(typeof r<"u")for(let a of e){let n=await this.write(a,void 0,void 0,r);o+=n.bytesWritten,r+=n.bytesWritten}else for(let a of e){let n=await this.write(a);o+=n.bytesWritten}return{buffers:e,bytesWritten:o}}finally{this[Nc]()}}readv(e,r){throw new Error("Method not implemented.")}close(){if(this[df]===-1)return Promise.resolve();if(this[jp])return this[jp];if(this[iy]--,this[iy]===0){let e=this[df];this[df]=-1,this[jp]=this[Bo].closePromise(e).finally(()=>{this[jp]=void 0})}else this[jp]=new Promise((e,r)=>{this[QD]=e,this[FD]=r}).finally(()=>{this[jp]=void 0,this[FD]=void 0,this[QD]=void 0});return this[jp]}[(Bo,df,M_e=iy,O_e=jp,U_e=QD,__e=FD,Rc)](e){if(this[df]===-1){let r=new Error("file closed");throw r.code="EBADF",r.syscall=e.name,r}this[iy]++}[Nc](){if(this[iy]--,this[iy]===0){let e=this[df];this[df]=-1,this[Bo].closePromise(e).then(this[QD],this[FD])}}}});function Ww(t,e){e=new bD(e);let r=(o,a,n)=>{let u=o[a];o[a]=n,typeof u?.[sy.promisify.custom]<"u"&&(n[sy.promisify.custom]=u[sy.promisify.custom])};{r(t,"exists",(o,...a)=>{let u=typeof a[a.length-1]=="function"?a.pop():()=>{};process.nextTick(()=>{e.existsPromise(o).then(A=>{u(A)},()=>{u(!1)})})}),r(t,"read",(...o)=>{let[a,n,u,A,p,h]=o;if(o.length<=3){let E={};o.length<3?h=o[1]:(E=o[1],h=o[2]),{buffer:n=Buffer.alloc(16384),offset:u=0,length:A=n.byteLength,position:p}=E}if(u==null&&(u=0),A|=0,A===0){process.nextTick(()=>{h(null,0,n)});return}p==null&&(p=-1),process.nextTick(()=>{e.readPromise(a,n,u,A,p).then(E=>{h(null,E,n)},E=>{h(E,0,n)})})});for(let o of oY){let a=o.replace(/Promise$/,"");if(typeof t[a]>"u")continue;let n=e[o];if(typeof n>"u")continue;r(t,a,(...A)=>{let h=typeof A[A.length-1]=="function"?A.pop():()=>{};process.nextTick(()=>{n.apply(e,A).then(E=>{h(null,E)},E=>{h(E)})})})}t.realpath.native=t.realpath}{r(t,"existsSync",o=>{try{return e.existsSync(o)}catch{return!1}}),r(t,"readSync",(...o)=>{let[a,n,u,A,p]=o;return o.length<=3&&({offset:u=0,length:A=n.byteLength,position:p}=o[2]||{}),u==null&&(u=0),A|=0,A===0?0:(p==null&&(p=-1),e.readSync(a,n,u,A,p))});for(let o of H_e){let a=o;if(typeof t[a]>"u")continue;let n=e[o];typeof n>"u"||r(t,a,n.bind(e))}t.realpathSync.native=t.realpathSync}{let o=t.promises;for(let a of oY){let n=a.replace(/Promise$/,"");if(typeof o[n]>"u")continue;let u=e[a];typeof u>"u"||a!=="open"&&r(o,n,(A,...p)=>A instanceof Yw?A[n].apply(A,p):u.call(e,A,...p))}r(o,"open",async(...a)=>{let n=await e.openPromise(...a);return new Yw(n,e)})}t.read[sy.promisify.custom]=async(o,a,...n)=>({bytesRead:await e.readPromise(o,a,...n),buffer:a}),t.write[sy.promisify.custom]=async(o,a,...n)=>({bytesWritten:await e.writePromise(o,a,...n),buffer:a})}function TD(t,e){let r=Object.create(t);return Ww(r,e),r}var sy,H_e,oY,aY=Et(()=>{sy=Be("util");nY();sY();H_e=new Set(["accessSync","appendFileSync","createReadStream","createWriteStream","chmodSync","fchmodSync","chownSync","fchownSync","closeSync","copyFileSync","linkSync","lstatSync","fstatSync","lutimesSync","mkdirSync","openSync","opendirSync","readlinkSync","readFileSync","readdirSync","readlinkSync","realpathSync","renameSync","rmdirSync","statSync","symlinkSync","truncateSync","ftruncateSync","unlinkSync","unwatchFile","utimesSync","watch","watchFile","writeFileSync","writeSync"]),oY=new Set(["accessPromise","appendFilePromise","fchmodPromise","chmodPromise","fchownPromise","chownPromise","closePromise","copyFilePromise","linkPromise","fstatPromise","lstatPromise","lutimesPromise","mkdirPromise","openPromise","opendirPromise","readdirPromise","realpathPromise","readFilePromise","readdirPromise","readlinkPromise","renamePromise","rmdirPromise","statPromise","symlinkPromise","truncatePromise","ftruncatePromise","unlinkPromise","utimesPromise","writeFilePromise","writeSync"])});function lY(t){let e=Math.ceil(Math.random()*4294967296).toString(16).padStart(8,"0");return`${t}${e}`}function cY(){if(XT)return XT;let t=ue.toPortablePath(uY.default.tmpdir()),e=oe.realpathSync(t);return process.once("exit",()=>{oe.rmtempSync()}),XT={tmpdir:t,realTmpdir:e}}var uY,Lc,XT,oe,AY=Et(()=>{uY=$e(Be("os"));Hg();Ca();Lc=new Set,XT=null;oe=Object.assign(new Rn,{detachTemp(t){Lc.delete(t)},mktempSync(t){let{tmpdir:e,realTmpdir:r}=cY();for(;;){let o=lY("xfs-");try{this.mkdirSync(K.join(e,o))}catch(n){if(n.code==="EEXIST")continue;throw n}let a=K.join(r,o);if(Lc.add(a),typeof t>"u")return a;try{return t(a)}finally{if(Lc.has(a)){Lc.delete(a);try{this.removeSync(a)}catch{}}}}},async mktempPromise(t){let{tmpdir:e,realTmpdir:r}=cY();for(;;){let o=lY("xfs-");try{await this.mkdirPromise(K.join(e,o))}catch(n){if(n.code==="EEXIST")continue;throw n}let a=K.join(r,o);if(Lc.add(a),typeof t>"u")return a;try{return await t(a)}finally{if(Lc.has(a)){Lc.delete(a);try{await this.removePromise(a)}catch{}}}}},async rmtempPromise(){await Promise.all(Array.from(Lc.values()).map(async t=>{try{await oe.removePromise(t,{maxRetries:0}),Lc.delete(t)}catch{}}))},rmtempSync(){for(let t of Lc)try{oe.removeSync(t),Lc.delete(t)}catch{}}})});var Vw={};Kt(Vw,{AliasFS:()=>Uu,BasePortableFakeFS:()=>Ou,CustomDir:()=>qw,CwdFS:()=>gn,FakeFS:()=>hf,Filename:()=>dr,JailFS:()=>_u,LazyFS:()=>ny,MountFS:()=>_p,NoFS:()=>Gw,NodeFS:()=>Rn,PortablePath:()=>Bt,PosixFS:()=>Hp,ProxiedFS:()=>Ps,VirtualFS:()=>mi,constants:()=>vi,errors:()=>ar,extendFs:()=>TD,normalizeLineEndings:()=>Ug,npath:()=>ue,opendir:()=>SD,patchFs:()=>Ww,ppath:()=>K,setupCopyIndex:()=>PD,statUtils:()=>Ea,unwatchAllFiles:()=>Og,unwatchFile:()=>Mg,watchFile:()=>ry,xfs:()=>oe});var Pt=Et(()=>{T7();BD();qT();WT();U7();VT();_g();Ca();Ca();Y7();_g();K7();z7();X7();Z7();$7();Hg();eY();gf();tY();aY();AY()});var dY=_((axt,gY)=>{gY.exports=hY;hY.sync=q_e;var fY=Be("fs");function j_e(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var o=0;o{CY.exports=yY;yY.sync=G_e;var mY=Be("fs");function yY(t,e,r){mY.stat(t,function(o,a){r(o,o?!1:EY(a,e))})}function G_e(t,e){return EY(mY.statSync(t),e)}function EY(t,e){return t.isFile()&&Y_e(t,e)}function Y_e(t,e){var r=t.mode,o=t.uid,a=t.gid,n=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),u=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),A=parseInt("100",8),p=parseInt("010",8),h=parseInt("001",8),E=A|p,I=r&h||r&p&&a===u||r&A&&o===n||r&E&&n===0;return I}});var BY=_((uxt,IY)=>{var cxt=Be("fs"),RD;process.platform==="win32"||global.TESTING_WINDOWS?RD=dY():RD=wY();IY.exports=ZT;ZT.sync=W_e;function ZT(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,a){ZT(t,e||{},function(n,u){n?a(n):o(u)})})}RD(t,e||{},function(o,a){o&&(o.code==="EACCES"||e&&e.ignoreErrors)&&(o=null,a=!1),r(o,a)})}function W_e(t,e){try{return RD.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var kY=_((Axt,bY)=>{var oy=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",vY=Be("path"),V_e=oy?";":":",DY=BY(),PY=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),SY=(t,e)=>{let r=e.colon||V_e,o=t.match(/\//)||oy&&t.match(/\\/)?[""]:[...oy?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],a=oy?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=oy?a.split(r):[""];return oy&&t.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:o,pathExt:n,pathExtExe:a}},xY=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:o,pathExt:a,pathExtExe:n}=SY(t,e),u=[],A=h=>new Promise((E,I)=>{if(h===o.length)return e.all&&u.length?E(u):I(PY(t));let v=o[h],b=/^".*"$/.test(v)?v.slice(1,-1):v,C=vY.join(b,t),T=!b&&/^\.[\\\/]/.test(t)?t.slice(0,2)+C:C;E(p(T,h,0))}),p=(h,E,I)=>new Promise((v,b)=>{if(I===a.length)return v(A(E+1));let C=a[I];DY(h+C,{pathExt:n},(T,L)=>{if(!T&&L)if(e.all)u.push(h+C);else return v(h+C);return v(p(h,E,I+1))})});return r?A(0).then(h=>r(null,h),r):A(0)},K_e=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:o,pathExtExe:a}=SY(t,e),n=[];for(let u=0;u{"use strict";var QY=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};$T.exports=QY;$T.exports.default=QY});var LY=_((pxt,NY)=>{"use strict";var TY=Be("path"),J_e=kY(),z_e=FY();function RY(t,e){let r=t.options.env||process.env,o=process.cwd(),a=t.options.cwd!=null,n=a&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(t.options.cwd)}catch{}let u;try{u=J_e.sync(t.command,{path:r[z_e({env:r})],pathExt:e?TY.delimiter:void 0})}catch{}finally{n&&process.chdir(o)}return u&&(u=TY.resolve(a?t.options.cwd:"",u)),u}function X_e(t){return RY(t)||RY(t,!0)}NY.exports=X_e});var MY=_((hxt,tR)=>{"use strict";var eR=/([()\][%!^"`<>&|;, *?])/g;function Z_e(t){return t=t.replace(eR,"^$1"),t}function $_e(t,e){return t=`${t}`,t=t.replace(/(\\*)"/g,'$1$1\\"'),t=t.replace(/(\\*)$/,"$1$1"),t=`"${t}"`,t=t.replace(eR,"^$1"),e&&(t=t.replace(eR,"^$1")),t}tR.exports.command=Z_e;tR.exports.argument=$_e});var UY=_((gxt,OY)=>{"use strict";OY.exports=/^#!(.*)/});var HY=_((dxt,_Y)=>{"use strict";var e8e=UY();_Y.exports=(t="")=>{let e=t.match(e8e);if(!e)return null;let[r,o]=e[0].replace(/#! ?/,"").split(" "),a=r.split("/").pop();return a==="env"?o:o?`${a} ${o}`:a}});var qY=_((mxt,jY)=>{"use strict";var rR=Be("fs"),t8e=HY();function r8e(t){let r=Buffer.alloc(150),o;try{o=rR.openSync(t,"r"),rR.readSync(o,r,0,150,0),rR.closeSync(o)}catch{}return t8e(r.toString())}jY.exports=r8e});var VY=_((yxt,WY)=>{"use strict";var n8e=Be("path"),GY=LY(),YY=MY(),i8e=qY(),s8e=process.platform==="win32",o8e=/\.(?:com|exe)$/i,a8e=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l8e(t){t.file=GY(t);let e=t.file&&i8e(t.file);return e?(t.args.unshift(t.file),t.command=e,GY(t)):t.file}function c8e(t){if(!s8e)return t;let e=l8e(t),r=!o8e.test(e);if(t.options.forceShell||r){let o=a8e.test(e);t.command=n8e.normalize(t.command),t.command=YY.command(t.command),t.args=t.args.map(n=>YY.argument(n,o));let a=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${a}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function u8e(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let o={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?o:c8e(o)}WY.exports=u8e});var zY=_((Ext,JY)=>{"use strict";var nR=process.platform==="win32";function iR(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function A8e(t,e){if(!nR)return;let r=t.emit;t.emit=function(o,a){if(o==="exit"){let n=KY(a,e,"spawn");if(n)return r.call(t,"error",n)}return r.apply(t,arguments)}}function KY(t,e){return nR&&t===1&&!e.file?iR(e.original,"spawn"):null}function f8e(t,e){return nR&&t===1&&!e.file?iR(e.original,"spawnSync"):null}JY.exports={hookChildProcess:A8e,verifyENOENT:KY,verifyENOENTSync:f8e,notFoundError:iR}});var aR=_((Cxt,ay)=>{"use strict";var XY=Be("child_process"),sR=VY(),oR=zY();function ZY(t,e,r){let o=sR(t,e,r),a=XY.spawn(o.command,o.args,o.options);return oR.hookChildProcess(a,o),a}function p8e(t,e,r){let o=sR(t,e,r),a=XY.spawnSync(o.command,o.args,o.options);return a.error=a.error||oR.verifyENOENTSync(a.status,o),a}ay.exports=ZY;ay.exports.spawn=ZY;ay.exports.sync=p8e;ay.exports._parse=sR;ay.exports._enoent=oR});var eW=_((wxt,$Y)=>{"use strict";function h8e(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function qg(t,e,r,o){this.message=t,this.expected=e,this.found=r,this.location=o,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,qg)}h8e(qg,Error);qg.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",I;for(I=0;I0){for(I=1,v=1;I>",S=Br(">>",!1),y=">&",F=Br(">&",!1),z=">",X=Br(">",!1),Z="<<<",ie=Br("<<<",!1),Se="<&",Ne=Br("<&",!1),ot="<",dt=Br("<",!1),jt=function(N){return{type:"argument",segments:[].concat(...N)}},$t=function(N){return N},xt="$'",an=Br("$'",!1),Qr="'",mr=Br("'",!1),xr=function(N){return[{type:"text",text:N}]},Wr='""',Vn=Br('""',!1),Ns=function(){return{type:"text",text:""}},Ri='"',ps=Br('"',!1),io=function(N){return N},Si=function(N){return{type:"arithmetic",arithmetic:N,quoted:!0}},Ls=function(N){return{type:"shell",shell:N,quoted:!0}},so=function(N){return{type:"variable",...N,quoted:!0}},cc=function(N){return{type:"text",text:N}},cu=function(N){return{type:"arithmetic",arithmetic:N,quoted:!1}},ap=function(N){return{type:"shell",shell:N,quoted:!1}},lp=function(N){return{type:"variable",...N,quoted:!1}},Ms=function(N){return{type:"glob",pattern:N}},Dn=/^[^']/,oo=Cs(["'"],!0,!1),Os=function(N){return N.join("")},ml=/^[^$"]/,yl=Cs(["$",'"'],!0,!1),ao=`\\ +`,Kn=Br(`\\ +`,!1),Mn=function(){return""},Ni="\\",On=Br("\\",!1),_i=/^[\\$"`]/,tr=Cs(["\\","$",'"',"`"],!1,!1),Me=function(N){return N},ii="\\a",Oa=Br("\\a",!1),hr=function(){return"a"},uc="\\b",uu=Br("\\b",!1),Ac=function(){return"\b"},El=/^[Ee]/,vA=Cs(["E","e"],!1,!1),Au=function(){return"\x1B"},Ce="\\f",Tt=Br("\\f",!1),fc=function(){return"\f"},Hi="\\n",fu=Br("\\n",!1),Yt=function(){return` +`},Cl="\\r",DA=Br("\\r",!1),cp=function(){return"\r"},pc="\\t",PA=Br("\\t",!1),Qn=function(){return" "},hi="\\v",hc=Br("\\v",!1),SA=function(){return"\v"},sa=/^[\\'"?]/,Li=Cs(["\\","'",'"',"?"],!1,!1),_o=function(N){return String.fromCharCode(parseInt(N,16))},Ze="\\x",lo=Br("\\x",!1),gc="\\u",pu=Br("\\u",!1),ji="\\U",hu=Br("\\U",!1),xA=function(N){return String.fromCodePoint(parseInt(N,16))},Ua=/^[0-7]/,dc=Cs([["0","7"]],!1,!1),hs=/^[0-9a-fA-f]/,_t=Cs([["0","9"],["a","f"],["A","f"]],!1,!1),Fn=cg(),Ci="{}",oa=Br("{}",!1),co=function(){return"{}"},Us="-",aa=Br("-",!1),la="+",Ho=Br("+",!1),wi=".",gs=Br(".",!1),ds=function(N,V,re){return{type:"number",value:(N==="-"?-1:1)*parseFloat(V.join("")+"."+re.join(""))}},ms=function(N,V){return{type:"number",value:(N==="-"?-1:1)*parseInt(V.join(""))}},_s=function(N){return{type:"variable",...N}},Un=function(N){return{type:"variable",name:N}},Pn=function(N){return N},ys="*",We=Br("*",!1),tt="/",It=Br("/",!1),nr=function(N,V,re){return{type:V==="*"?"multiplication":"division",right:re}},$=function(N,V){return V.reduce((re,he)=>({left:re,...he}),N)},me=function(N,V,re){return{type:V==="+"?"addition":"subtraction",right:re}},Le="$((",ft=Br("$((",!1),pt="))",Rt=Br("))",!1),er=function(N){return N},Zr="$(",qi=Br("$(",!1),es=function(N){return N},xi="${",jo=Br("${",!1),bA=":-",kA=Br(":-",!1),up=function(N,V){return{name:N,defaultValue:V}},ng=":-}",gu=Br(":-}",!1),ig=function(N){return{name:N,defaultValue:[]}},du=":+",uo=Br(":+",!1),QA=function(N,V){return{name:N,alternativeValue:V}},mc=":+}",ca=Br(":+}",!1),sg=function(N){return{name:N,alternativeValue:[]}},yc=function(N){return{name:N}},Pm="$",og=Br("$",!1),$n=function(N){return e.isGlobPattern(N)},Ap=function(N){return N},ag=/^[a-zA-Z0-9_]/,FA=Cs([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),Hs=function(){return lg()},mu=/^[$@*?#a-zA-Z0-9_\-]/,Ha=Cs(["$","@","*","?","#",["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),Gi=/^[()}<>$|&; \t"']/,ua=Cs(["(",")","}","<",">","$","|","&",";"," "," ",'"',"'"],!1,!1),yu=/^[<>&; \t"']/,Es=Cs(["<",">","&",";"," "," ",'"',"'"],!1,!1),Ec=/^[ \t]/,Cc=Cs([" "," "],!1,!1),G=0,Dt=0,wl=[{line:1,column:1}],bi=0,wc=[],ct=0,Eu;if("startRule"in e){if(!(e.startRule in o))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=o[e.startRule]}function lg(){return t.substring(Dt,G)}function mw(){return Ic(Dt,G)}function TA(N,V){throw V=V!==void 0?V:Ic(Dt,G),fg([Ag(N)],t.substring(Dt,G),V)}function fp(N,V){throw V=V!==void 0?V:Ic(Dt,G),Sm(N,V)}function Br(N,V){return{type:"literal",text:N,ignoreCase:V}}function Cs(N,V,re){return{type:"class",parts:N,inverted:V,ignoreCase:re}}function cg(){return{type:"any"}}function ug(){return{type:"end"}}function Ag(N){return{type:"other",description:N}}function pp(N){var V=wl[N],re;if(V)return V;for(re=N-1;!wl[re];)re--;for(V=wl[re],V={line:V.line,column:V.column};rebi&&(bi=G,wc=[]),wc.push(N))}function Sm(N,V){return new qg(N,null,null,V)}function fg(N,V,re){return new qg(qg.buildMessage(N,V),N,V,re)}function pg(){var N,V,re;for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();return V!==r?(re=Cu(),re===r&&(re=null),re!==r?(Dt=N,V=n(re),N=V):(G=N,N=r)):(G=N,N=r),N}function Cu(){var N,V,re,he,ze;if(N=G,V=wu(),V!==r){for(re=[],he=Qt();he!==r;)re.push(he),he=Qt();re!==r?(he=hg(),he!==r?(ze=xm(),ze===r&&(ze=null),ze!==r?(Dt=N,V=u(V,he,ze),N=V):(G=N,N=r)):(G=N,N=r)):(G=N,N=r)}else G=N,N=r;if(N===r)if(N=G,V=wu(),V!==r){for(re=[],he=Qt();he!==r;)re.push(he),he=Qt();re!==r?(he=hg(),he===r&&(he=null),he!==r?(Dt=N,V=A(V,he),N=V):(G=N,N=r)):(G=N,N=r)}else G=N,N=r;return N}function xm(){var N,V,re,he,ze;for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();if(V!==r)if(re=Cu(),re!==r){for(he=[],ze=Qt();ze!==r;)he.push(ze),ze=Qt();he!==r?(Dt=N,V=p(re),N=V):(G=N,N=r)}else G=N,N=r;else G=N,N=r;return N}function hg(){var N;return t.charCodeAt(G)===59?(N=h,G++):(N=r,ct===0&&Ct(E)),N===r&&(t.charCodeAt(G)===38?(N=I,G++):(N=r,ct===0&&Ct(v))),N}function wu(){var N,V,re;return N=G,V=Aa(),V!==r?(re=yw(),re===r&&(re=null),re!==r?(Dt=N,V=b(V,re),N=V):(G=N,N=r)):(G=N,N=r),N}function yw(){var N,V,re,he,ze,mt,fr;for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();if(V!==r)if(re=bm(),re!==r){for(he=[],ze=Qt();ze!==r;)he.push(ze),ze=Qt();if(he!==r)if(ze=wu(),ze!==r){for(mt=[],fr=Qt();fr!==r;)mt.push(fr),fr=Qt();mt!==r?(Dt=N,V=C(re,ze),N=V):(G=N,N=r)}else G=N,N=r;else G=N,N=r}else G=N,N=r;else G=N,N=r;return N}function bm(){var N;return t.substr(G,2)===T?(N=T,G+=2):(N=r,ct===0&&Ct(L)),N===r&&(t.substr(G,2)===U?(N=U,G+=2):(N=r,ct===0&&Ct(J))),N}function Aa(){var N,V,re;return N=G,V=gg(),V!==r?(re=Bc(),re===r&&(re=null),re!==r?(Dt=N,V=te(V,re),N=V):(G=N,N=r)):(G=N,N=r),N}function Bc(){var N,V,re,he,ze,mt,fr;for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();if(V!==r)if(re=Il(),re!==r){for(he=[],ze=Qt();ze!==r;)he.push(ze),ze=Qt();if(he!==r)if(ze=Aa(),ze!==r){for(mt=[],fr=Qt();fr!==r;)mt.push(fr),fr=Qt();mt!==r?(Dt=N,V=le(re,ze),N=V):(G=N,N=r)}else G=N,N=r;else G=N,N=r}else G=N,N=r;else G=N,N=r;return N}function Il(){var N;return t.substr(G,2)===pe?(N=pe,G+=2):(N=r,ct===0&&Ct(Ae)),N===r&&(t.charCodeAt(G)===124?(N=ye,G++):(N=r,ct===0&&Ct(ae))),N}function Iu(){var N,V,re,he,ze,mt;if(N=G,V=Eg(),V!==r)if(t.charCodeAt(G)===61?(re=we,G++):(re=r,ct===0&&Ct(Pe)),re!==r)if(he=qo(),he!==r){for(ze=[],mt=Qt();mt!==r;)ze.push(mt),mt=Qt();ze!==r?(Dt=N,V=g(V,he),N=V):(G=N,N=r)}else G=N,N=r;else G=N,N=r;else G=N,N=r;if(N===r)if(N=G,V=Eg(),V!==r)if(t.charCodeAt(G)===61?(re=we,G++):(re=r,ct===0&&Ct(Pe)),re!==r){for(he=[],ze=Qt();ze!==r;)he.push(ze),ze=Qt();he!==r?(Dt=N,V=Ee(V),N=V):(G=N,N=r)}else G=N,N=r;else G=N,N=r;return N}function gg(){var N,V,re,he,ze,mt,fr,Cr,yn,oi,Mi;for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();if(V!==r)if(t.charCodeAt(G)===40?(re=De,G++):(re=r,ct===0&&Ct(ce)),re!==r){for(he=[],ze=Qt();ze!==r;)he.push(ze),ze=Qt();if(he!==r)if(ze=Cu(),ze!==r){for(mt=[],fr=Qt();fr!==r;)mt.push(fr),fr=Qt();if(mt!==r)if(t.charCodeAt(G)===41?(fr=ne,G++):(fr=r,ct===0&&Ct(ee)),fr!==r){for(Cr=[],yn=Qt();yn!==r;)Cr.push(yn),yn=Qt();if(Cr!==r){for(yn=[],oi=ja();oi!==r;)yn.push(oi),oi=ja();if(yn!==r){for(oi=[],Mi=Qt();Mi!==r;)oi.push(Mi),Mi=Qt();oi!==r?(Dt=N,V=Ie(ze,yn),N=V):(G=N,N=r)}else G=N,N=r}else G=N,N=r}else G=N,N=r;else G=N,N=r}else G=N,N=r;else G=N,N=r}else G=N,N=r;else G=N,N=r;if(N===r){for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();if(V!==r)if(t.charCodeAt(G)===123?(re=ke,G++):(re=r,ct===0&&Ct(ht)),re!==r){for(he=[],ze=Qt();ze!==r;)he.push(ze),ze=Qt();if(he!==r)if(ze=Cu(),ze!==r){for(mt=[],fr=Qt();fr!==r;)mt.push(fr),fr=Qt();if(mt!==r)if(t.charCodeAt(G)===125?(fr=H,G++):(fr=r,ct===0&&Ct(lt)),fr!==r){for(Cr=[],yn=Qt();yn!==r;)Cr.push(yn),yn=Qt();if(Cr!==r){for(yn=[],oi=ja();oi!==r;)yn.push(oi),oi=ja();if(yn!==r){for(oi=[],Mi=Qt();Mi!==r;)oi.push(Mi),Mi=Qt();oi!==r?(Dt=N,V=Re(ze,yn),N=V):(G=N,N=r)}else G=N,N=r}else G=N,N=r}else G=N,N=r;else G=N,N=r}else G=N,N=r;else G=N,N=r}else G=N,N=r;else G=N,N=r;if(N===r){for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();if(V!==r){for(re=[],he=Iu();he!==r;)re.push(he),he=Iu();if(re!==r){for(he=[],ze=Qt();ze!==r;)he.push(ze),ze=Qt();if(he!==r){if(ze=[],mt=hp(),mt!==r)for(;mt!==r;)ze.push(mt),mt=hp();else ze=r;if(ze!==r){for(mt=[],fr=Qt();fr!==r;)mt.push(fr),fr=Qt();mt!==r?(Dt=N,V=Qe(re,ze),N=V):(G=N,N=r)}else G=N,N=r}else G=N,N=r}else G=N,N=r}else G=N,N=r;if(N===r){for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();if(V!==r){if(re=[],he=Iu(),he!==r)for(;he!==r;)re.push(he),he=Iu();else re=r;if(re!==r){for(he=[],ze=Qt();ze!==r;)he.push(ze),ze=Qt();he!==r?(Dt=N,V=be(re),N=V):(G=N,N=r)}else G=N,N=r}else G=N,N=r}}}return N}function RA(){var N,V,re,he,ze;for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();if(V!==r){if(re=[],he=gp(),he!==r)for(;he!==r;)re.push(he),he=gp();else re=r;if(re!==r){for(he=[],ze=Qt();ze!==r;)he.push(ze),ze=Qt();he!==r?(Dt=N,V=_e(re),N=V):(G=N,N=r)}else G=N,N=r}else G=N,N=r;return N}function hp(){var N,V,re;for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();if(V!==r?(re=ja(),re!==r?(Dt=N,V=Te(re),N=V):(G=N,N=r)):(G=N,N=r),N===r){for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();V!==r?(re=gp(),re!==r?(Dt=N,V=Te(re),N=V):(G=N,N=r)):(G=N,N=r)}return N}function ja(){var N,V,re,he,ze;for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();return V!==r?(Je.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(He)),re===r&&(re=null),re!==r?(he=dg(),he!==r?(ze=gp(),ze!==r?(Dt=N,V=x(re,he,ze),N=V):(G=N,N=r)):(G=N,N=r)):(G=N,N=r)):(G=N,N=r),N}function dg(){var N;return t.substr(G,2)===w?(N=w,G+=2):(N=r,ct===0&&Ct(S)),N===r&&(t.substr(G,2)===y?(N=y,G+=2):(N=r,ct===0&&Ct(F)),N===r&&(t.charCodeAt(G)===62?(N=z,G++):(N=r,ct===0&&Ct(X)),N===r&&(t.substr(G,3)===Z?(N=Z,G+=3):(N=r,ct===0&&Ct(ie)),N===r&&(t.substr(G,2)===Se?(N=Se,G+=2):(N=r,ct===0&&Ct(Ne)),N===r&&(t.charCodeAt(G)===60?(N=ot,G++):(N=r,ct===0&&Ct(dt))))))),N}function gp(){var N,V,re;for(N=G,V=[],re=Qt();re!==r;)V.push(re),re=Qt();return V!==r?(re=qo(),re!==r?(Dt=N,V=Te(re),N=V):(G=N,N=r)):(G=N,N=r),N}function qo(){var N,V,re;if(N=G,V=[],re=ws(),re!==r)for(;re!==r;)V.push(re),re=ws();else V=r;return V!==r&&(Dt=N,V=jt(V)),N=V,N}function ws(){var N,V;return N=G,V=Ii(),V!==r&&(Dt=N,V=$t(V)),N=V,N===r&&(N=G,V=km(),V!==r&&(Dt=N,V=$t(V)),N=V,N===r&&(N=G,V=Qm(),V!==r&&(Dt=N,V=$t(V)),N=V,N===r&&(N=G,V=Go(),V!==r&&(Dt=N,V=$t(V)),N=V))),N}function Ii(){var N,V,re,he;return N=G,t.substr(G,2)===xt?(V=xt,G+=2):(V=r,ct===0&&Ct(an)),V!==r?(re=ln(),re!==r?(t.charCodeAt(G)===39?(he=Qr,G++):(he=r,ct===0&&Ct(mr)),he!==r?(Dt=N,V=xr(re),N=V):(G=N,N=r)):(G=N,N=r)):(G=N,N=r),N}function km(){var N,V,re,he;return N=G,t.charCodeAt(G)===39?(V=Qr,G++):(V=r,ct===0&&Ct(mr)),V!==r?(re=mp(),re!==r?(t.charCodeAt(G)===39?(he=Qr,G++):(he=r,ct===0&&Ct(mr)),he!==r?(Dt=N,V=xr(re),N=V):(G=N,N=r)):(G=N,N=r)):(G=N,N=r),N}function Qm(){var N,V,re,he;if(N=G,t.substr(G,2)===Wr?(V=Wr,G+=2):(V=r,ct===0&&Ct(Vn)),V!==r&&(Dt=N,V=Ns()),N=V,N===r)if(N=G,t.charCodeAt(G)===34?(V=Ri,G++):(V=r,ct===0&&Ct(ps)),V!==r){for(re=[],he=NA();he!==r;)re.push(he),he=NA();re!==r?(t.charCodeAt(G)===34?(he=Ri,G++):(he=r,ct===0&&Ct(ps)),he!==r?(Dt=N,V=io(re),N=V):(G=N,N=r)):(G=N,N=r)}else G=N,N=r;return N}function Go(){var N,V,re;if(N=G,V=[],re=dp(),re!==r)for(;re!==r;)V.push(re),re=dp();else V=r;return V!==r&&(Dt=N,V=io(V)),N=V,N}function NA(){var N,V;return N=G,V=Gr(),V!==r&&(Dt=N,V=Si(V)),N=V,N===r&&(N=G,V=yp(),V!==r&&(Dt=N,V=Ls(V)),N=V,N===r&&(N=G,V=Dc(),V!==r&&(Dt=N,V=so(V)),N=V,N===r&&(N=G,V=mg(),V!==r&&(Dt=N,V=cc(V)),N=V))),N}function dp(){var N,V;return N=G,V=Gr(),V!==r&&(Dt=N,V=cu(V)),N=V,N===r&&(N=G,V=yp(),V!==r&&(Dt=N,V=ap(V)),N=V,N===r&&(N=G,V=Dc(),V!==r&&(Dt=N,V=lp(V)),N=V,N===r&&(N=G,V=Ew(),V!==r&&(Dt=N,V=Ms(V)),N=V,N===r&&(N=G,V=pa(),V!==r&&(Dt=N,V=cc(V)),N=V)))),N}function mp(){var N,V,re;for(N=G,V=[],Dn.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(oo));re!==r;)V.push(re),Dn.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(oo));return V!==r&&(Dt=N,V=Os(V)),N=V,N}function mg(){var N,V,re;if(N=G,V=[],re=fa(),re===r&&(ml.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(yl))),re!==r)for(;re!==r;)V.push(re),re=fa(),re===r&&(ml.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(yl)));else V=r;return V!==r&&(Dt=N,V=Os(V)),N=V,N}function fa(){var N,V,re;return N=G,t.substr(G,2)===ao?(V=ao,G+=2):(V=r,ct===0&&Ct(Kn)),V!==r&&(Dt=N,V=Mn()),N=V,N===r&&(N=G,t.charCodeAt(G)===92?(V=Ni,G++):(V=r,ct===0&&Ct(On)),V!==r?(_i.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(tr)),re!==r?(Dt=N,V=Me(re),N=V):(G=N,N=r)):(G=N,N=r)),N}function ln(){var N,V,re;for(N=G,V=[],re=Ao(),re===r&&(Dn.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(oo)));re!==r;)V.push(re),re=Ao(),re===r&&(Dn.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(oo)));return V!==r&&(Dt=N,V=Os(V)),N=V,N}function Ao(){var N,V,re;return N=G,t.substr(G,2)===ii?(V=ii,G+=2):(V=r,ct===0&&Ct(Oa)),V!==r&&(Dt=N,V=hr()),N=V,N===r&&(N=G,t.substr(G,2)===uc?(V=uc,G+=2):(V=r,ct===0&&Ct(uu)),V!==r&&(Dt=N,V=Ac()),N=V,N===r&&(N=G,t.charCodeAt(G)===92?(V=Ni,G++):(V=r,ct===0&&Ct(On)),V!==r?(El.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(vA)),re!==r?(Dt=N,V=Au(),N=V):(G=N,N=r)):(G=N,N=r),N===r&&(N=G,t.substr(G,2)===Ce?(V=Ce,G+=2):(V=r,ct===0&&Ct(Tt)),V!==r&&(Dt=N,V=fc()),N=V,N===r&&(N=G,t.substr(G,2)===Hi?(V=Hi,G+=2):(V=r,ct===0&&Ct(fu)),V!==r&&(Dt=N,V=Yt()),N=V,N===r&&(N=G,t.substr(G,2)===Cl?(V=Cl,G+=2):(V=r,ct===0&&Ct(DA)),V!==r&&(Dt=N,V=cp()),N=V,N===r&&(N=G,t.substr(G,2)===pc?(V=pc,G+=2):(V=r,ct===0&&Ct(PA)),V!==r&&(Dt=N,V=Qn()),N=V,N===r&&(N=G,t.substr(G,2)===hi?(V=hi,G+=2):(V=r,ct===0&&Ct(hc)),V!==r&&(Dt=N,V=SA()),N=V,N===r&&(N=G,t.charCodeAt(G)===92?(V=Ni,G++):(V=r,ct===0&&Ct(On)),V!==r?(sa.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(Li)),re!==r?(Dt=N,V=Me(re),N=V):(G=N,N=r)):(G=N,N=r),N===r&&(N=LA()))))))))),N}function LA(){var N,V,re,he,ze,mt,fr,Cr,yn,oi,Mi,wg;return N=G,t.charCodeAt(G)===92?(V=Ni,G++):(V=r,ct===0&&Ct(On)),V!==r?(re=qa(),re!==r?(Dt=N,V=_o(re),N=V):(G=N,N=r)):(G=N,N=r),N===r&&(N=G,t.substr(G,2)===Ze?(V=Ze,G+=2):(V=r,ct===0&&Ct(lo)),V!==r?(re=G,he=G,ze=qa(),ze!==r?(mt=si(),mt!==r?(ze=[ze,mt],he=ze):(G=he,he=r)):(G=he,he=r),he===r&&(he=qa()),he!==r?re=t.substring(re,G):re=he,re!==r?(Dt=N,V=_o(re),N=V):(G=N,N=r)):(G=N,N=r),N===r&&(N=G,t.substr(G,2)===gc?(V=gc,G+=2):(V=r,ct===0&&Ct(pu)),V!==r?(re=G,he=G,ze=si(),ze!==r?(mt=si(),mt!==r?(fr=si(),fr!==r?(Cr=si(),Cr!==r?(ze=[ze,mt,fr,Cr],he=ze):(G=he,he=r)):(G=he,he=r)):(G=he,he=r)):(G=he,he=r),he!==r?re=t.substring(re,G):re=he,re!==r?(Dt=N,V=_o(re),N=V):(G=N,N=r)):(G=N,N=r),N===r&&(N=G,t.substr(G,2)===ji?(V=ji,G+=2):(V=r,ct===0&&Ct(hu)),V!==r?(re=G,he=G,ze=si(),ze!==r?(mt=si(),mt!==r?(fr=si(),fr!==r?(Cr=si(),Cr!==r?(yn=si(),yn!==r?(oi=si(),oi!==r?(Mi=si(),Mi!==r?(wg=si(),wg!==r?(ze=[ze,mt,fr,Cr,yn,oi,Mi,wg],he=ze):(G=he,he=r)):(G=he,he=r)):(G=he,he=r)):(G=he,he=r)):(G=he,he=r)):(G=he,he=r)):(G=he,he=r)):(G=he,he=r),he!==r?re=t.substring(re,G):re=he,re!==r?(Dt=N,V=xA(re),N=V):(G=N,N=r)):(G=N,N=r)))),N}function qa(){var N;return Ua.test(t.charAt(G))?(N=t.charAt(G),G++):(N=r,ct===0&&Ct(dc)),N}function si(){var N;return hs.test(t.charAt(G))?(N=t.charAt(G),G++):(N=r,ct===0&&Ct(_t)),N}function pa(){var N,V,re,he,ze;if(N=G,V=[],re=G,t.charCodeAt(G)===92?(he=Ni,G++):(he=r,ct===0&&Ct(On)),he!==r?(t.length>G?(ze=t.charAt(G),G++):(ze=r,ct===0&&Ct(Fn)),ze!==r?(Dt=re,he=Me(ze),re=he):(G=re,re=r)):(G=re,re=r),re===r&&(re=G,t.substr(G,2)===Ci?(he=Ci,G+=2):(he=r,ct===0&&Ct(oa)),he!==r&&(Dt=re,he=co()),re=he,re===r&&(re=G,he=G,ct++,ze=Fm(),ct--,ze===r?he=void 0:(G=he,he=r),he!==r?(t.length>G?(ze=t.charAt(G),G++):(ze=r,ct===0&&Ct(Fn)),ze!==r?(Dt=re,he=Me(ze),re=he):(G=re,re=r)):(G=re,re=r))),re!==r)for(;re!==r;)V.push(re),re=G,t.charCodeAt(G)===92?(he=Ni,G++):(he=r,ct===0&&Ct(On)),he!==r?(t.length>G?(ze=t.charAt(G),G++):(ze=r,ct===0&&Ct(Fn)),ze!==r?(Dt=re,he=Me(ze),re=he):(G=re,re=r)):(G=re,re=r),re===r&&(re=G,t.substr(G,2)===Ci?(he=Ci,G+=2):(he=r,ct===0&&Ct(oa)),he!==r&&(Dt=re,he=co()),re=he,re===r&&(re=G,he=G,ct++,ze=Fm(),ct--,ze===r?he=void 0:(G=he,he=r),he!==r?(t.length>G?(ze=t.charAt(G),G++):(ze=r,ct===0&&Ct(Fn)),ze!==r?(Dt=re,he=Me(ze),re=he):(G=re,re=r)):(G=re,re=r)));else V=r;return V!==r&&(Dt=N,V=Os(V)),N=V,N}function vc(){var N,V,re,he,ze,mt;if(N=G,t.charCodeAt(G)===45?(V=Us,G++):(V=r,ct===0&&Ct(aa)),V===r&&(t.charCodeAt(G)===43?(V=la,G++):(V=r,ct===0&&Ct(Ho))),V===r&&(V=null),V!==r){if(re=[],Je.test(t.charAt(G))?(he=t.charAt(G),G++):(he=r,ct===0&&Ct(He)),he!==r)for(;he!==r;)re.push(he),Je.test(t.charAt(G))?(he=t.charAt(G),G++):(he=r,ct===0&&Ct(He));else re=r;if(re!==r)if(t.charCodeAt(G)===46?(he=wi,G++):(he=r,ct===0&&Ct(gs)),he!==r){if(ze=[],Je.test(t.charAt(G))?(mt=t.charAt(G),G++):(mt=r,ct===0&&Ct(He)),mt!==r)for(;mt!==r;)ze.push(mt),Je.test(t.charAt(G))?(mt=t.charAt(G),G++):(mt=r,ct===0&&Ct(He));else ze=r;ze!==r?(Dt=N,V=ds(V,re,ze),N=V):(G=N,N=r)}else G=N,N=r;else G=N,N=r}else G=N,N=r;if(N===r){if(N=G,t.charCodeAt(G)===45?(V=Us,G++):(V=r,ct===0&&Ct(aa)),V===r&&(t.charCodeAt(G)===43?(V=la,G++):(V=r,ct===0&&Ct(Ho))),V===r&&(V=null),V!==r){if(re=[],Je.test(t.charAt(G))?(he=t.charAt(G),G++):(he=r,ct===0&&Ct(He)),he!==r)for(;he!==r;)re.push(he),Je.test(t.charAt(G))?(he=t.charAt(G),G++):(he=r,ct===0&&Ct(He));else re=r;re!==r?(Dt=N,V=ms(V,re),N=V):(G=N,N=r)}else G=N,N=r;if(N===r&&(N=G,V=Dc(),V!==r&&(Dt=N,V=_s(V)),N=V,N===r&&(N=G,V=Ga(),V!==r&&(Dt=N,V=Un(V)),N=V,N===r)))if(N=G,t.charCodeAt(G)===40?(V=De,G++):(V=r,ct===0&&Ct(ce)),V!==r){for(re=[],he=Qt();he!==r;)re.push(he),he=Qt();if(re!==r)if(he=ts(),he!==r){for(ze=[],mt=Qt();mt!==r;)ze.push(mt),mt=Qt();ze!==r?(t.charCodeAt(G)===41?(mt=ne,G++):(mt=r,ct===0&&Ct(ee)),mt!==r?(Dt=N,V=Pn(he),N=V):(G=N,N=r)):(G=N,N=r)}else G=N,N=r;else G=N,N=r}else G=N,N=r}return N}function Bl(){var N,V,re,he,ze,mt,fr,Cr;if(N=G,V=vc(),V!==r){for(re=[],he=G,ze=[],mt=Qt();mt!==r;)ze.push(mt),mt=Qt();if(ze!==r)if(t.charCodeAt(G)===42?(mt=ys,G++):(mt=r,ct===0&&Ct(We)),mt===r&&(t.charCodeAt(G)===47?(mt=tt,G++):(mt=r,ct===0&&Ct(It))),mt!==r){for(fr=[],Cr=Qt();Cr!==r;)fr.push(Cr),Cr=Qt();fr!==r?(Cr=vc(),Cr!==r?(Dt=he,ze=nr(V,mt,Cr),he=ze):(G=he,he=r)):(G=he,he=r)}else G=he,he=r;else G=he,he=r;for(;he!==r;){for(re.push(he),he=G,ze=[],mt=Qt();mt!==r;)ze.push(mt),mt=Qt();if(ze!==r)if(t.charCodeAt(G)===42?(mt=ys,G++):(mt=r,ct===0&&Ct(We)),mt===r&&(t.charCodeAt(G)===47?(mt=tt,G++):(mt=r,ct===0&&Ct(It))),mt!==r){for(fr=[],Cr=Qt();Cr!==r;)fr.push(Cr),Cr=Qt();fr!==r?(Cr=vc(),Cr!==r?(Dt=he,ze=nr(V,mt,Cr),he=ze):(G=he,he=r)):(G=he,he=r)}else G=he,he=r;else G=he,he=r}re!==r?(Dt=N,V=$(V,re),N=V):(G=N,N=r)}else G=N,N=r;return N}function ts(){var N,V,re,he,ze,mt,fr,Cr;if(N=G,V=Bl(),V!==r){for(re=[],he=G,ze=[],mt=Qt();mt!==r;)ze.push(mt),mt=Qt();if(ze!==r)if(t.charCodeAt(G)===43?(mt=la,G++):(mt=r,ct===0&&Ct(Ho)),mt===r&&(t.charCodeAt(G)===45?(mt=Us,G++):(mt=r,ct===0&&Ct(aa))),mt!==r){for(fr=[],Cr=Qt();Cr!==r;)fr.push(Cr),Cr=Qt();fr!==r?(Cr=Bl(),Cr!==r?(Dt=he,ze=me(V,mt,Cr),he=ze):(G=he,he=r)):(G=he,he=r)}else G=he,he=r;else G=he,he=r;for(;he!==r;){for(re.push(he),he=G,ze=[],mt=Qt();mt!==r;)ze.push(mt),mt=Qt();if(ze!==r)if(t.charCodeAt(G)===43?(mt=la,G++):(mt=r,ct===0&&Ct(Ho)),mt===r&&(t.charCodeAt(G)===45?(mt=Us,G++):(mt=r,ct===0&&Ct(aa))),mt!==r){for(fr=[],Cr=Qt();Cr!==r;)fr.push(Cr),Cr=Qt();fr!==r?(Cr=Bl(),Cr!==r?(Dt=he,ze=me(V,mt,Cr),he=ze):(G=he,he=r)):(G=he,he=r)}else G=he,he=r;else G=he,he=r}re!==r?(Dt=N,V=$(V,re),N=V):(G=N,N=r)}else G=N,N=r;return N}function Gr(){var N,V,re,he,ze,mt;if(N=G,t.substr(G,3)===Le?(V=Le,G+=3):(V=r,ct===0&&Ct(ft)),V!==r){for(re=[],he=Qt();he!==r;)re.push(he),he=Qt();if(re!==r)if(he=ts(),he!==r){for(ze=[],mt=Qt();mt!==r;)ze.push(mt),mt=Qt();ze!==r?(t.substr(G,2)===pt?(mt=pt,G+=2):(mt=r,ct===0&&Ct(Rt)),mt!==r?(Dt=N,V=er(he),N=V):(G=N,N=r)):(G=N,N=r)}else G=N,N=r;else G=N,N=r}else G=N,N=r;return N}function yp(){var N,V,re,he;return N=G,t.substr(G,2)===Zr?(V=Zr,G+=2):(V=r,ct===0&&Ct(qi)),V!==r?(re=Cu(),re!==r?(t.charCodeAt(G)===41?(he=ne,G++):(he=r,ct===0&&Ct(ee)),he!==r?(Dt=N,V=es(re),N=V):(G=N,N=r)):(G=N,N=r)):(G=N,N=r),N}function Dc(){var N,V,re,he,ze,mt;return N=G,t.substr(G,2)===xi?(V=xi,G+=2):(V=r,ct===0&&Ct(jo)),V!==r?(re=Ga(),re!==r?(t.substr(G,2)===bA?(he=bA,G+=2):(he=r,ct===0&&Ct(kA)),he!==r?(ze=RA(),ze!==r?(t.charCodeAt(G)===125?(mt=H,G++):(mt=r,ct===0&&Ct(lt)),mt!==r?(Dt=N,V=up(re,ze),N=V):(G=N,N=r)):(G=N,N=r)):(G=N,N=r)):(G=N,N=r)):(G=N,N=r),N===r&&(N=G,t.substr(G,2)===xi?(V=xi,G+=2):(V=r,ct===0&&Ct(jo)),V!==r?(re=Ga(),re!==r?(t.substr(G,3)===ng?(he=ng,G+=3):(he=r,ct===0&&Ct(gu)),he!==r?(Dt=N,V=ig(re),N=V):(G=N,N=r)):(G=N,N=r)):(G=N,N=r),N===r&&(N=G,t.substr(G,2)===xi?(V=xi,G+=2):(V=r,ct===0&&Ct(jo)),V!==r?(re=Ga(),re!==r?(t.substr(G,2)===du?(he=du,G+=2):(he=r,ct===0&&Ct(uo)),he!==r?(ze=RA(),ze!==r?(t.charCodeAt(G)===125?(mt=H,G++):(mt=r,ct===0&&Ct(lt)),mt!==r?(Dt=N,V=QA(re,ze),N=V):(G=N,N=r)):(G=N,N=r)):(G=N,N=r)):(G=N,N=r)):(G=N,N=r),N===r&&(N=G,t.substr(G,2)===xi?(V=xi,G+=2):(V=r,ct===0&&Ct(jo)),V!==r?(re=Ga(),re!==r?(t.substr(G,3)===mc?(he=mc,G+=3):(he=r,ct===0&&Ct(ca)),he!==r?(Dt=N,V=sg(re),N=V):(G=N,N=r)):(G=N,N=r)):(G=N,N=r),N===r&&(N=G,t.substr(G,2)===xi?(V=xi,G+=2):(V=r,ct===0&&Ct(jo)),V!==r?(re=Ga(),re!==r?(t.charCodeAt(G)===125?(he=H,G++):(he=r,ct===0&&Ct(lt)),he!==r?(Dt=N,V=yc(re),N=V):(G=N,N=r)):(G=N,N=r)):(G=N,N=r),N===r&&(N=G,t.charCodeAt(G)===36?(V=Pm,G++):(V=r,ct===0&&Ct(og)),V!==r?(re=Ga(),re!==r?(Dt=N,V=yc(re),N=V):(G=N,N=r)):(G=N,N=r)))))),N}function Ew(){var N,V,re;return N=G,V=yg(),V!==r?(Dt=G,re=$n(V),re?re=void 0:re=r,re!==r?(Dt=N,V=Ap(V),N=V):(G=N,N=r)):(G=N,N=r),N}function yg(){var N,V,re,he,ze;if(N=G,V=[],re=G,he=G,ct++,ze=Cg(),ct--,ze===r?he=void 0:(G=he,he=r),he!==r?(t.length>G?(ze=t.charAt(G),G++):(ze=r,ct===0&&Ct(Fn)),ze!==r?(Dt=re,he=Me(ze),re=he):(G=re,re=r)):(G=re,re=r),re!==r)for(;re!==r;)V.push(re),re=G,he=G,ct++,ze=Cg(),ct--,ze===r?he=void 0:(G=he,he=r),he!==r?(t.length>G?(ze=t.charAt(G),G++):(ze=r,ct===0&&Ct(Fn)),ze!==r?(Dt=re,he=Me(ze),re=he):(G=re,re=r)):(G=re,re=r);else V=r;return V!==r&&(Dt=N,V=Os(V)),N=V,N}function Eg(){var N,V,re;if(N=G,V=[],ag.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(FA)),re!==r)for(;re!==r;)V.push(re),ag.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(FA));else V=r;return V!==r&&(Dt=N,V=Hs()),N=V,N}function Ga(){var N,V,re;if(N=G,V=[],mu.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(Ha)),re!==r)for(;re!==r;)V.push(re),mu.test(t.charAt(G))?(re=t.charAt(G),G++):(re=r,ct===0&&Ct(Ha));else V=r;return V!==r&&(Dt=N,V=Hs()),N=V,N}function Fm(){var N;return Gi.test(t.charAt(G))?(N=t.charAt(G),G++):(N=r,ct===0&&Ct(ua)),N}function Cg(){var N;return yu.test(t.charAt(G))?(N=t.charAt(G),G++):(N=r,ct===0&&Ct(Es)),N}function Qt(){var N,V;if(N=[],Ec.test(t.charAt(G))?(V=t.charAt(G),G++):(V=r,ct===0&&Ct(Cc)),V!==r)for(;V!==r;)N.push(V),Ec.test(t.charAt(G))?(V=t.charAt(G),G++):(V=r,ct===0&&Ct(Cc));else N=r;return N}if(Eu=a(),Eu!==r&&G===t.length)return Eu;throw Eu!==r&&G!1}){try{return(0,tW.parse)(t,e)}catch(r){throw r.location&&(r.message=r.message.replace(/(\.)?$/,` (line ${r.location.start.line}, column ${r.location.start.column})$1`)),r}}function ly(t,{endSemicolon:e=!1}={}){return t.map(({command:r,type:o},a)=>`${MD(r)}${o===";"?a!==t.length-1||e?";":"":" &"}`).join(" ")}function MD(t){return`${cy(t.chain)}${t.then?` ${lR(t.then)}`:""}`}function lR(t){return`${t.type} ${MD(t.line)}`}function cy(t){return`${uR(t)}${t.then?` ${cR(t.then)}`:""}`}function cR(t){return`${t.type} ${cy(t.chain)}`}function uR(t){switch(t.type){case"command":return`${t.envs.length>0?`${t.envs.map(e=>ND(e)).join(" ")} `:""}${t.args.map(e=>AR(e)).join(" ")}`;case"subshell":return`(${ly(t.subshell)})${t.args.length>0?` ${t.args.map(e=>Kw(e)).join(" ")}`:""}`;case"group":return`{ ${ly(t.group,{endSemicolon:!0})} }${t.args.length>0?` ${t.args.map(e=>Kw(e)).join(" ")}`:""}`;case"envs":return t.envs.map(e=>ND(e)).join(" ");default:throw new Error(`Unsupported command type: "${t.type}"`)}}function ND(t){return`${t.name}=${t.args[0]?Gg(t.args[0]):""}`}function AR(t){switch(t.type){case"redirection":return Kw(t);case"argument":return Gg(t);default:throw new Error(`Unsupported argument type: "${t.type}"`)}}function Kw(t){return`${t.subtype} ${t.args.map(e=>Gg(e)).join(" ")}`}function Gg(t){return t.segments.map(e=>fR(e)).join("")}function fR(t){let e=(o,a)=>a?`"${o}"`:o,r=o=>o===""?"''":o.match(/[()}<>$|&;"'\n\t ]/)?o.match(/['\t\p{C}]/u)?o.match(/'/)?`"${o.replace(/["$\t\p{C}]/u,m8e)}"`:`$'${o.replace(/[\t\p{C}]/u,nW)}'`:`'${o}'`:o;switch(t.type){case"text":return r(t.text);case"glob":return t.pattern;case"shell":return e(`\${${ly(t.shell)}}`,t.quoted);case"variable":return e(typeof t.defaultValue>"u"?typeof t.alternativeValue>"u"?`\${${t.name}}`:t.alternativeValue.length===0?`\${${t.name}:+}`:`\${${t.name}:+${t.alternativeValue.map(o=>Gg(o)).join(" ")}}`:t.defaultValue.length===0?`\${${t.name}:-}`:`\${${t.name}:-${t.defaultValue.map(o=>Gg(o)).join(" ")}}`,t.quoted);case"arithmetic":return`$(( ${OD(t.arithmetic)} ))`;default:throw new Error(`Unsupported argument segment type: "${t.type}"`)}}function OD(t){let e=a=>{switch(a){case"addition":return"+";case"subtraction":return"-";case"multiplication":return"*";case"division":return"/";default:throw new Error(`Can't extract operator from arithmetic expression of type "${a}"`)}},r=(a,n)=>n?`( ${a} )`:a,o=a=>r(OD(a),!["number","variable"].includes(a.type));switch(t.type){case"number":return String(t.value);case"variable":return t.name;default:return`${o(t.left)} ${e(t.type)} ${o(t.right)}`}}var tW,rW,d8e,nW,m8e,iW=Et(()=>{tW=$e(eW());rW=new Map([["\f","\\f"],[` +`,"\\n"],["\r","\\r"],[" ","\\t"],["\v","\\v"],["\0","\\0"]]),d8e=new Map([["\\","\\\\"],["$","\\$"],['"','\\"'],...Array.from(rW,([t,e])=>[t,`"$'${e}'"`])]),nW=t=>rW.get(t)??`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`,m8e=t=>d8e.get(t)??`"$'${nW(t)}'"`});var oW=_((Nxt,sW)=>{"use strict";function y8e(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function Yg(t,e,r,o){this.message=t,this.expected=e,this.found=r,this.location=o,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Yg)}y8e(Yg,Error);Yg.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",I;for(I=0;I0){for(I=1,v=1;Ipe&&(pe=J,Ae=[]),Ae.push(He))}function lt(He,x){return new Yg(He,null,null,x)}function Re(He,x,w){return new Yg(Yg.buildMessage(He,x),He,x,w)}function Qe(){var He,x,w,S;return He=J,x=be(),x!==r?(t.charCodeAt(J)===47?(w=n,J++):(w=r,ye===0&&H(u)),w!==r?(S=be(),S!==r?(te=He,x=A(x,S),He=x):(J=He,He=r)):(J=He,He=r)):(J=He,He=r),He===r&&(He=J,x=be(),x!==r&&(te=He,x=p(x)),He=x),He}function be(){var He,x,w,S;return He=J,x=_e(),x!==r?(t.charCodeAt(J)===64?(w=h,J++):(w=r,ye===0&&H(E)),w!==r?(S=Je(),S!==r?(te=He,x=I(x,S),He=x):(J=He,He=r)):(J=He,He=r)):(J=He,He=r),He===r&&(He=J,x=_e(),x!==r&&(te=He,x=v(x)),He=x),He}function _e(){var He,x,w,S,y;return He=J,t.charCodeAt(J)===64?(x=h,J++):(x=r,ye===0&&H(E)),x!==r?(w=Te(),w!==r?(t.charCodeAt(J)===47?(S=n,J++):(S=r,ye===0&&H(u)),S!==r?(y=Te(),y!==r?(te=He,x=b(),He=x):(J=He,He=r)):(J=He,He=r)):(J=He,He=r)):(J=He,He=r),He===r&&(He=J,x=Te(),x!==r&&(te=He,x=b()),He=x),He}function Te(){var He,x,w;if(He=J,x=[],C.test(t.charAt(J))?(w=t.charAt(J),J++):(w=r,ye===0&&H(T)),w!==r)for(;w!==r;)x.push(w),C.test(t.charAt(J))?(w=t.charAt(J),J++):(w=r,ye===0&&H(T));else x=r;return x!==r&&(te=He,x=b()),He=x,He}function Je(){var He,x,w;if(He=J,x=[],L.test(t.charAt(J))?(w=t.charAt(J),J++):(w=r,ye===0&&H(U)),w!==r)for(;w!==r;)x.push(w),L.test(t.charAt(J))?(w=t.charAt(J),J++):(w=r,ye===0&&H(U));else x=r;return x!==r&&(te=He,x=b()),He=x,He}if(ae=a(),ae!==r&&J===t.length)return ae;throw ae!==r&&J{aW=$e(oW())});var Vg=_((Mxt,Wg)=>{"use strict";function cW(t){return typeof t>"u"||t===null}function C8e(t){return typeof t=="object"&&t!==null}function w8e(t){return Array.isArray(t)?t:cW(t)?[]:[t]}function I8e(t,e){var r,o,a,n;if(e)for(n=Object.keys(e),r=0,o=n.length;r{"use strict";function Jw(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Jw.prototype=Object.create(Error.prototype);Jw.prototype.constructor=Jw;Jw.prototype.toString=function(e){var r=this.name+": ";return r+=this.reason||"(unknown reason)",!e&&this.mark&&(r+=" "+this.mark.toString()),r};uW.exports=Jw});var pW=_((Uxt,fW)=>{"use strict";var AW=Vg();function pR(t,e,r,o,a){this.name=t,this.buffer=e,this.position=r,this.line=o,this.column=a}pR.prototype.getSnippet=function(e,r){var o,a,n,u,A;if(!this.buffer)return null;for(e=e||4,r=r||75,o="",a=this.position;a>0&&`\0\r +\x85\u2028\u2029`.indexOf(this.buffer.charAt(a-1))===-1;)if(a-=1,this.position-a>r/2-1){o=" ... ",a+=5;break}for(n="",u=this.position;ur/2-1){n=" ... ",u-=5;break}return A=this.buffer.slice(a,u),AW.repeat(" ",e)+o+A+n+` +`+AW.repeat(" ",e+this.position-a+o.length)+"^"};pR.prototype.toString=function(e){var r,o="";return this.name&&(o+='in "'+this.name+'" '),o+="at line "+(this.line+1)+", column "+(this.column+1),e||(r=this.getSnippet(),r&&(o+=`: +`+r)),o};fW.exports=pR});var os=_((_xt,gW)=>{"use strict";var hW=uy(),D8e=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],P8e=["scalar","sequence","mapping"];function S8e(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(o){e[String(o)]=r})}),e}function x8e(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(D8e.indexOf(r)===-1)throw new hW('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=S8e(e.styleAliases||null),P8e.indexOf(this.kind)===-1)throw new hW('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}gW.exports=x8e});var Kg=_((Hxt,mW)=>{"use strict";var dW=Vg(),HD=uy(),b8e=os();function hR(t,e,r){var o=[];return t.include.forEach(function(a){r=hR(a,e,r)}),t[e].forEach(function(a){r.forEach(function(n,u){n.tag===a.tag&&n.kind===a.kind&&o.push(u)}),r.push(a)}),r.filter(function(a,n){return o.indexOf(n)===-1})}function k8e(){var t={scalar:{},sequence:{},mapping:{},fallback:{}},e,r;function o(a){t[a.kind][a.tag]=t.fallback[a.tag]=a}for(e=0,r=arguments.length;e{"use strict";var Q8e=os();yW.exports=new Q8e("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}})});var wW=_((qxt,CW)=>{"use strict";var F8e=os();CW.exports=new F8e("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}})});var BW=_((Gxt,IW)=>{"use strict";var T8e=os();IW.exports=new T8e("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}})});var jD=_((Yxt,vW)=>{"use strict";var R8e=Kg();vW.exports=new R8e({explicit:[EW(),wW(),BW()]})});var PW=_((Wxt,DW)=>{"use strict";var N8e=os();function L8e(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function M8e(){return null}function O8e(t){return t===null}DW.exports=new N8e("tag:yaml.org,2002:null",{kind:"scalar",resolve:L8e,construct:M8e,predicate:O8e,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var xW=_((Vxt,SW)=>{"use strict";var U8e=os();function _8e(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}function H8e(t){return t==="true"||t==="True"||t==="TRUE"}function j8e(t){return Object.prototype.toString.call(t)==="[object Boolean]"}SW.exports=new U8e("tag:yaml.org,2002:bool",{kind:"scalar",resolve:_8e,construct:H8e,predicate:j8e,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"})});var kW=_((Kxt,bW)=>{"use strict";var q8e=Vg(),G8e=os();function Y8e(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function W8e(t){return 48<=t&&t<=55}function V8e(t){return 48<=t&&t<=57}function K8e(t){if(t===null)return!1;var e=t.length,r=0,o=!1,a;if(!e)return!1;if(a=t[r],(a==="-"||a==="+")&&(a=t[++r]),a==="0"){if(r+1===e)return!0;if(a=t[++r],a==="b"){for(r++;r=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0"+t.toString(8):"-0"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var TW=_((Jxt,FW)=>{"use strict";var QW=Vg(),X8e=os(),Z8e=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function $8e(t){return!(t===null||!Z8e.test(t)||t[t.length-1]==="_")}function eHe(t){var e,r,o,a;return e=t.replace(/_/g,"").toLowerCase(),r=e[0]==="-"?-1:1,a=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:e.indexOf(":")>=0?(e.split(":").forEach(function(n){a.unshift(parseFloat(n,10))}),e=0,o=1,a.forEach(function(n){e+=n*o,o*=60}),r*e):r*parseFloat(e,10)}var tHe=/^[-+]?[0-9]+e/;function rHe(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(QW.isNegativeZero(t))return"-0.0";return r=t.toString(10),tHe.test(r)?r.replace("e",".e"):r}function nHe(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||QW.isNegativeZero(t))}FW.exports=new X8e("tag:yaml.org,2002:float",{kind:"scalar",resolve:$8e,construct:eHe,predicate:nHe,represent:rHe,defaultStyle:"lowercase"})});var gR=_((zxt,RW)=>{"use strict";var iHe=Kg();RW.exports=new iHe({include:[jD()],implicit:[PW(),xW(),kW(),TW()]})});var dR=_((Xxt,NW)=>{"use strict";var sHe=Kg();NW.exports=new sHe({include:[gR()]})});var UW=_((Zxt,OW)=>{"use strict";var oHe=os(),LW=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),MW=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function aHe(t){return t===null?!1:LW.exec(t)!==null||MW.exec(t)!==null}function lHe(t){var e,r,o,a,n,u,A,p=0,h=null,E,I,v;if(e=LW.exec(t),e===null&&(e=MW.exec(t)),e===null)throw new Error("Date resolve error");if(r=+e[1],o=+e[2]-1,a=+e[3],!e[4])return new Date(Date.UTC(r,o,a));if(n=+e[4],u=+e[5],A=+e[6],e[7]){for(p=e[7].slice(0,3);p.length<3;)p+="0";p=+p}return e[9]&&(E=+e[10],I=+(e[11]||0),h=(E*60+I)*6e4,e[9]==="-"&&(h=-h)),v=new Date(Date.UTC(r,o,a,n,u,A,p)),h&&v.setTime(v.getTime()-h),v}function cHe(t){return t.toISOString()}OW.exports=new oHe("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:aHe,construct:lHe,instanceOf:Date,represent:cHe})});var HW=_(($xt,_W)=>{"use strict";var uHe=os();function AHe(t){return t==="<<"||t===null}_W.exports=new uHe("tag:yaml.org,2002:merge",{kind:"scalar",resolve:AHe})});var GW=_((ebt,qW)=>{"use strict";var Jg;try{jW=Be,Jg=jW("buffer").Buffer}catch{}var jW,fHe=os(),mR=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= +\r`;function pHe(t){if(t===null)return!1;var e,r,o=0,a=t.length,n=mR;for(r=0;r64)){if(e<0)return!1;o+=6}return o%8===0}function hHe(t){var e,r,o=t.replace(/[\r\n=]/g,""),a=o.length,n=mR,u=0,A=[];for(e=0;e>16&255),A.push(u>>8&255),A.push(u&255)),u=u<<6|n.indexOf(o.charAt(e));return r=a%4*6,r===0?(A.push(u>>16&255),A.push(u>>8&255),A.push(u&255)):r===18?(A.push(u>>10&255),A.push(u>>2&255)):r===12&&A.push(u>>4&255),Jg?Jg.from?Jg.from(A):new Jg(A):A}function gHe(t){var e="",r=0,o,a,n=t.length,u=mR;for(o=0;o>18&63],e+=u[r>>12&63],e+=u[r>>6&63],e+=u[r&63]),r=(r<<8)+t[o];return a=n%3,a===0?(e+=u[r>>18&63],e+=u[r>>12&63],e+=u[r>>6&63],e+=u[r&63]):a===2?(e+=u[r>>10&63],e+=u[r>>4&63],e+=u[r<<2&63],e+=u[64]):a===1&&(e+=u[r>>2&63],e+=u[r<<4&63],e+=u[64],e+=u[64]),e}function dHe(t){return Jg&&Jg.isBuffer(t)}qW.exports=new fHe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:pHe,construct:hHe,predicate:dHe,represent:gHe})});var WW=_((rbt,YW)=>{"use strict";var mHe=os(),yHe=Object.prototype.hasOwnProperty,EHe=Object.prototype.toString;function CHe(t){if(t===null)return!0;var e=[],r,o,a,n,u,A=t;for(r=0,o=A.length;r{"use strict";var IHe=os(),BHe=Object.prototype.toString;function vHe(t){if(t===null)return!0;var e,r,o,a,n,u=t;for(n=new Array(u.length),e=0,r=u.length;e{"use strict";var PHe=os(),SHe=Object.prototype.hasOwnProperty;function xHe(t){if(t===null)return!0;var e,r=t;for(e in r)if(SHe.call(r,e)&&r[e]!==null)return!1;return!0}function bHe(t){return t!==null?t:{}}JW.exports=new PHe("tag:yaml.org,2002:set",{kind:"mapping",resolve:xHe,construct:bHe})});var fy=_((sbt,XW)=>{"use strict";var kHe=Kg();XW.exports=new kHe({include:[dR()],implicit:[UW(),HW()],explicit:[GW(),WW(),KW(),zW()]})});var $W=_((obt,ZW)=>{"use strict";var QHe=os();function FHe(){return!0}function THe(){}function RHe(){return""}function NHe(t){return typeof t>"u"}ZW.exports=new QHe("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:FHe,construct:THe,predicate:NHe,represent:RHe})});var tV=_((abt,eV)=>{"use strict";var LHe=os();function MHe(t){if(t===null||t.length===0)return!1;var e=t,r=/\/([gim]*)$/.exec(t),o="";return!(e[0]==="/"&&(r&&(o=r[1]),o.length>3||e[e.length-o.length-1]!=="/"))}function OHe(t){var e=t,r=/\/([gim]*)$/.exec(t),o="";return e[0]==="/"&&(r&&(o=r[1]),e=e.slice(1,e.length-o.length-1)),new RegExp(e,o)}function UHe(t){var e="/"+t.source+"/";return t.global&&(e+="g"),t.multiline&&(e+="m"),t.ignoreCase&&(e+="i"),e}function _He(t){return Object.prototype.toString.call(t)==="[object RegExp]"}eV.exports=new LHe("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:MHe,construct:OHe,predicate:_He,represent:UHe})});var iV=_((lbt,nV)=>{"use strict";var qD;try{rV=Be,qD=rV("esprima")}catch{typeof window<"u"&&(qD=window.esprima)}var rV,HHe=os();function jHe(t){if(t===null)return!1;try{var e="("+t+")",r=qD.parse(e,{range:!0});return!(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")}catch{return!1}}function qHe(t){var e="("+t+")",r=qD.parse(e,{range:!0}),o=[],a;if(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")throw new Error("Failed to resolve function");return r.body[0].expression.params.forEach(function(n){o.push(n.name)}),a=r.body[0].expression.body.range,r.body[0].expression.body.type==="BlockStatement"?new Function(o,e.slice(a[0]+1,a[1]-1)):new Function(o,"return "+e.slice(a[0],a[1]))}function GHe(t){return t.toString()}function YHe(t){return Object.prototype.toString.call(t)==="[object Function]"}nV.exports=new HHe("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:jHe,construct:qHe,predicate:YHe,represent:GHe})});var zw=_((ubt,oV)=>{"use strict";var sV=Kg();oV.exports=sV.DEFAULT=new sV({include:[fy()],explicit:[$W(),tV(),iV()]})});var DV=_((Abt,Xw)=>{"use strict";var mf=Vg(),pV=uy(),WHe=pW(),hV=fy(),VHe=zw(),Gp=Object.prototype.hasOwnProperty,GD=1,gV=2,dV=3,YD=4,yR=1,KHe=2,aV=3,JHe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,zHe=/[\x85\u2028\u2029]/,XHe=/[,\[\]\{\}]/,mV=/^(?:!|!!|![a-z\-]+!)$/i,yV=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function lV(t){return Object.prototype.toString.call(t)}function Hu(t){return t===10||t===13}function Xg(t){return t===9||t===32}function Ia(t){return t===9||t===32||t===10||t===13}function py(t){return t===44||t===91||t===93||t===123||t===125}function ZHe(t){var e;return 48<=t&&t<=57?t-48:(e=t|32,97<=e&&e<=102?e-97+10:-1)}function $He(t){return t===120?2:t===117?4:t===85?8:0}function e6e(t){return 48<=t&&t<=57?t-48:-1}function cV(t){return t===48?"\0":t===97?"\x07":t===98?"\b":t===116||t===9?" ":t===110?` +`:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"\x1B":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"\x85":t===95?"\xA0":t===76?"\u2028":t===80?"\u2029":""}function t6e(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}var EV=new Array(256),CV=new Array(256);for(zg=0;zg<256;zg++)EV[zg]=cV(zg)?1:0,CV[zg]=cV(zg);var zg;function r6e(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||VHe,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function wV(t,e){return new pV(e,new WHe(t.filename,t.input,t.position,t.line,t.position-t.lineStart))}function Sr(t,e){throw wV(t,e)}function WD(t,e){t.onWarning&&t.onWarning.call(null,wV(t,e))}var uV={YAML:function(e,r,o){var a,n,u;e.version!==null&&Sr(e,"duplication of %YAML directive"),o.length!==1&&Sr(e,"YAML directive accepts exactly one argument"),a=/^([0-9]+)\.([0-9]+)$/.exec(o[0]),a===null&&Sr(e,"ill-formed argument of the YAML directive"),n=parseInt(a[1],10),u=parseInt(a[2],10),n!==1&&Sr(e,"unacceptable YAML version of the document"),e.version=o[0],e.checkLineBreaks=u<2,u!==1&&u!==2&&WD(e,"unsupported YAML version of the document")},TAG:function(e,r,o){var a,n;o.length!==2&&Sr(e,"TAG directive accepts exactly two arguments"),a=o[0],n=o[1],mV.test(a)||Sr(e,"ill-formed tag handle (first argument) of the TAG directive"),Gp.call(e.tagMap,a)&&Sr(e,'there is a previously declared suffix for "'+a+'" tag handle'),yV.test(n)||Sr(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[a]=n}};function qp(t,e,r,o){var a,n,u,A;if(e1&&(t.result+=mf.repeat(` +`,e-1))}function n6e(t,e,r){var o,a,n,u,A,p,h,E,I=t.kind,v=t.result,b;if(b=t.input.charCodeAt(t.position),Ia(b)||py(b)||b===35||b===38||b===42||b===33||b===124||b===62||b===39||b===34||b===37||b===64||b===96||(b===63||b===45)&&(a=t.input.charCodeAt(t.position+1),Ia(a)||r&&py(a)))return!1;for(t.kind="scalar",t.result="",n=u=t.position,A=!1;b!==0;){if(b===58){if(a=t.input.charCodeAt(t.position+1),Ia(a)||r&&py(a))break}else if(b===35){if(o=t.input.charCodeAt(t.position-1),Ia(o))break}else{if(t.position===t.lineStart&&VD(t)||r&&py(b))break;if(Hu(b))if(p=t.line,h=t.lineStart,E=t.lineIndent,Wi(t,!1,-1),t.lineIndent>=e){A=!0,b=t.input.charCodeAt(t.position);continue}else{t.position=u,t.line=p,t.lineStart=h,t.lineIndent=E;break}}A&&(qp(t,n,u,!1),CR(t,t.line-p),n=u=t.position,A=!1),Xg(b)||(u=t.position+1),b=t.input.charCodeAt(++t.position)}return qp(t,n,u,!1),t.result?!0:(t.kind=I,t.result=v,!1)}function i6e(t,e){var r,o,a;if(r=t.input.charCodeAt(t.position),r!==39)return!1;for(t.kind="scalar",t.result="",t.position++,o=a=t.position;(r=t.input.charCodeAt(t.position))!==0;)if(r===39)if(qp(t,o,t.position,!0),r=t.input.charCodeAt(++t.position),r===39)o=t.position,t.position++,a=t.position;else return!0;else Hu(r)?(qp(t,o,a,!0),CR(t,Wi(t,!1,e)),o=a=t.position):t.position===t.lineStart&&VD(t)?Sr(t,"unexpected end of the document within a single quoted scalar"):(t.position++,a=t.position);Sr(t,"unexpected end of the stream within a single quoted scalar")}function s6e(t,e){var r,o,a,n,u,A;if(A=t.input.charCodeAt(t.position),A!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=o=t.position;(A=t.input.charCodeAt(t.position))!==0;){if(A===34)return qp(t,r,t.position,!0),t.position++,!0;if(A===92){if(qp(t,r,t.position,!0),A=t.input.charCodeAt(++t.position),Hu(A))Wi(t,!1,e);else if(A<256&&EV[A])t.result+=CV[A],t.position++;else if((u=$He(A))>0){for(a=u,n=0;a>0;a--)A=t.input.charCodeAt(++t.position),(u=ZHe(A))>=0?n=(n<<4)+u:Sr(t,"expected hexadecimal character");t.result+=t6e(n),t.position++}else Sr(t,"unknown escape sequence");r=o=t.position}else Hu(A)?(qp(t,r,o,!0),CR(t,Wi(t,!1,e)),r=o=t.position):t.position===t.lineStart&&VD(t)?Sr(t,"unexpected end of the document within a double quoted scalar"):(t.position++,o=t.position)}Sr(t,"unexpected end of the stream within a double quoted scalar")}function o6e(t,e){var r=!0,o,a=t.tag,n,u=t.anchor,A,p,h,E,I,v={},b,C,T,L;if(L=t.input.charCodeAt(t.position),L===91)p=93,I=!1,n=[];else if(L===123)p=125,I=!0,n={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=n),L=t.input.charCodeAt(++t.position);L!==0;){if(Wi(t,!0,e),L=t.input.charCodeAt(t.position),L===p)return t.position++,t.tag=a,t.anchor=u,t.kind=I?"mapping":"sequence",t.result=n,!0;r||Sr(t,"missed comma between flow collection entries"),C=b=T=null,h=E=!1,L===63&&(A=t.input.charCodeAt(t.position+1),Ia(A)&&(h=E=!0,t.position++,Wi(t,!0,e))),o=t.line,gy(t,e,GD,!1,!0),C=t.tag,b=t.result,Wi(t,!0,e),L=t.input.charCodeAt(t.position),(E||t.line===o)&&L===58&&(h=!0,L=t.input.charCodeAt(++t.position),Wi(t,!0,e),gy(t,e,GD,!1,!0),T=t.result),I?hy(t,n,v,C,b,T):h?n.push(hy(t,null,v,C,b,T)):n.push(b),Wi(t,!0,e),L=t.input.charCodeAt(t.position),L===44?(r=!0,L=t.input.charCodeAt(++t.position)):r=!1}Sr(t,"unexpected end of the stream within a flow collection")}function a6e(t,e){var r,o,a=yR,n=!1,u=!1,A=e,p=0,h=!1,E,I;if(I=t.input.charCodeAt(t.position),I===124)o=!1;else if(I===62)o=!0;else return!1;for(t.kind="scalar",t.result="";I!==0;)if(I=t.input.charCodeAt(++t.position),I===43||I===45)yR===a?a=I===43?aV:KHe:Sr(t,"repeat of a chomping mode identifier");else if((E=e6e(I))>=0)E===0?Sr(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?Sr(t,"repeat of an indentation width identifier"):(A=e+E-1,u=!0);else break;if(Xg(I)){do I=t.input.charCodeAt(++t.position);while(Xg(I));if(I===35)do I=t.input.charCodeAt(++t.position);while(!Hu(I)&&I!==0)}for(;I!==0;){for(ER(t),t.lineIndent=0,I=t.input.charCodeAt(t.position);(!u||t.lineIndentA&&(A=t.lineIndent),Hu(I)){p++;continue}if(t.lineIndente)&&p!==0)Sr(t,"bad indentation of a sequence entry");else if(t.lineIndente)&&(gy(t,e,YD,!0,a)&&(C?v=t.result:b=t.result),C||(hy(t,h,E,I,v,b,n,u),I=v=b=null),Wi(t,!0,-1),L=t.input.charCodeAt(t.position)),t.lineIndent>e&&L!==0)Sr(t,"bad indentation of a mapping entry");else if(t.lineIndente?p=1:t.lineIndent===e?p=0:t.lineIndente?p=1:t.lineIndent===e?p=0:t.lineIndent tag; it should be "scalar", not "'+t.kind+'"'),I=0,v=t.implicitTypes.length;I tag; it should be "'+b.kind+'", not "'+t.kind+'"'),b.resolve(t.result)?(t.result=b.construct(t.result),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):Sr(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):Sr(t,"unknown tag !<"+t.tag+">");return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||E}function f6e(t){var e=t.position,r,o,a,n=!1,u;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap={},t.anchorMap={};(u=t.input.charCodeAt(t.position))!==0&&(Wi(t,!0,-1),u=t.input.charCodeAt(t.position),!(t.lineIndent>0||u!==37));){for(n=!0,u=t.input.charCodeAt(++t.position),r=t.position;u!==0&&!Ia(u);)u=t.input.charCodeAt(++t.position);for(o=t.input.slice(r,t.position),a=[],o.length<1&&Sr(t,"directive name must not be less than one character in length");u!==0;){for(;Xg(u);)u=t.input.charCodeAt(++t.position);if(u===35){do u=t.input.charCodeAt(++t.position);while(u!==0&&!Hu(u));break}if(Hu(u))break;for(r=t.position;u!==0&&!Ia(u);)u=t.input.charCodeAt(++t.position);a.push(t.input.slice(r,t.position))}u!==0&&ER(t),Gp.call(uV,o)?uV[o](t,o,a):WD(t,'unknown document directive "'+o+'"')}if(Wi(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,Wi(t,!0,-1)):n&&Sr(t,"directives end mark is expected"),gy(t,t.lineIndent-1,YD,!1,!0),Wi(t,!0,-1),t.checkLineBreaks&&zHe.test(t.input.slice(e,t.position))&&WD(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&VD(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,Wi(t,!0,-1));return}if(t.position"u"&&(r=e,e=null);var o=IV(t,r);if(typeof e!="function")return o;for(var a=0,n=o.length;a"u"&&(r=e,e=null),BV(t,e,mf.extend({schema:hV},r))}function h6e(t,e){return vV(t,mf.extend({schema:hV},e))}Xw.exports.loadAll=BV;Xw.exports.load=vV;Xw.exports.safeLoadAll=p6e;Xw.exports.safeLoad=h6e});var KV=_((fbt,vR)=>{"use strict";var $w=Vg(),eI=uy(),g6e=zw(),d6e=fy(),TV=Object.prototype.toString,RV=Object.prototype.hasOwnProperty,m6e=9,Zw=10,y6e=13,E6e=32,C6e=33,w6e=34,NV=35,I6e=37,B6e=38,v6e=39,D6e=42,LV=44,P6e=45,MV=58,S6e=61,x6e=62,b6e=63,k6e=64,OV=91,UV=93,Q6e=96,_V=123,F6e=124,HV=125,vo={};vo[0]="\\0";vo[7]="\\a";vo[8]="\\b";vo[9]="\\t";vo[10]="\\n";vo[11]="\\v";vo[12]="\\f";vo[13]="\\r";vo[27]="\\e";vo[34]='\\"';vo[92]="\\\\";vo[133]="\\N";vo[160]="\\_";vo[8232]="\\L";vo[8233]="\\P";var T6e=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function R6e(t,e){var r,o,a,n,u,A,p;if(e===null)return{};for(r={},o=Object.keys(e),a=0,n=o.length;a0?t.charCodeAt(n-1):null,v=v&&xV(u,A)}else{for(n=0;no&&t[I+1]!==" ",I=n);else if(!dy(u))return KD;A=n>0?t.charCodeAt(n-1):null,v=v&&xV(u,A)}h=h||E&&n-I-1>o&&t[I+1]!==" "}return!p&&!h?v&&!a(t)?qV:GV:r>9&&jV(t)?KD:h?WV:YV}function _6e(t,e,r,o){t.dump=function(){if(e.length===0)return"''";if(!t.noCompatMode&&T6e.indexOf(e)!==-1)return"'"+e+"'";var a=t.indent*Math.max(1,r),n=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-a),u=o||t.flowLevel>-1&&r>=t.flowLevel;function A(p){return L6e(t,p)}switch(U6e(e,u,t.indent,n,A)){case qV:return e;case GV:return"'"+e.replace(/'/g,"''")+"'";case YV:return"|"+bV(e,t.indent)+kV(SV(e,a));case WV:return">"+bV(e,t.indent)+kV(SV(H6e(e,n),a));case KD:return'"'+j6e(e,n)+'"';default:throw new eI("impossible error: invalid scalar style")}}()}function bV(t,e){var r=jV(t)?String(e):"",o=t[t.length-1]===` +`,a=o&&(t[t.length-2]===` +`||t===` +`),n=a?"+":o?"":"-";return r+n+` +`}function kV(t){return t[t.length-1]===` +`?t.slice(0,-1):t}function H6e(t,e){for(var r=/(\n+)([^\n]*)/g,o=function(){var h=t.indexOf(` +`);return h=h!==-1?h:t.length,r.lastIndex=h,QV(t.slice(0,h),e)}(),a=t[0]===` +`||t[0]===" ",n,u;u=r.exec(t);){var A=u[1],p=u[2];n=p[0]===" ",o+=A+(!a&&!n&&p!==""?` +`:"")+QV(p,e),a=n}return o}function QV(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,o,a=0,n,u=0,A=0,p="";o=r.exec(t);)A=o.index,A-a>e&&(n=u>a?u:A,p+=` +`+t.slice(a,n),a=n+1),u=A;return p+=` +`,t.length-a>e&&u>a?p+=t.slice(a,u)+` +`+t.slice(u+1):p+=t.slice(a),p.slice(1)}function j6e(t){for(var e="",r,o,a,n=0;n=55296&&r<=56319&&(o=t.charCodeAt(n+1),o>=56320&&o<=57343)){e+=PV((r-55296)*1024+o-56320+65536),n++;continue}a=vo[r],e+=!a&&dy(r)?t[n]:a||PV(r)}return e}function q6e(t,e,r){var o="",a=t.tag,n,u;for(n=0,u=r.length;n1024&&(E+="? "),E+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Zg(t,e,h,!1,!1)&&(E+=t.dump,o+=E));t.tag=a,t.dump="{"+o+"}"}function W6e(t,e,r,o){var a="",n=t.tag,u=Object.keys(r),A,p,h,E,I,v;if(t.sortKeys===!0)u.sort();else if(typeof t.sortKeys=="function")u.sort(t.sortKeys);else if(t.sortKeys)throw new eI("sortKeys must be a boolean or a function");for(A=0,p=u.length;A1024,I&&(t.dump&&Zw===t.dump.charCodeAt(0)?v+="?":v+="? "),v+=t.dump,I&&(v+=wR(t,e)),Zg(t,e+1,E,!0,I)&&(t.dump&&Zw===t.dump.charCodeAt(0)?v+=":":v+=": ",v+=t.dump,a+=v));t.tag=n,t.dump=a||"{}"}function FV(t,e,r){var o,a,n,u,A,p;for(a=r?t.explicitTypes:t.implicitTypes,n=0,u=a.length;n tag resolver accepts not "'+p+'" style');t.dump=o}return!0}return!1}function Zg(t,e,r,o,a,n){t.tag=null,t.dump=r,FV(t,r,!1)||FV(t,r,!0);var u=TV.call(t.dump);o&&(o=t.flowLevel<0||t.flowLevel>e);var A=u==="[object Object]"||u==="[object Array]",p,h;if(A&&(p=t.duplicates.indexOf(r),h=p!==-1),(t.tag!==null&&t.tag!=="?"||h||t.indent!==2&&e>0)&&(a=!1),h&&t.usedDuplicates[p])t.dump="*ref_"+p;else{if(A&&h&&!t.usedDuplicates[p]&&(t.usedDuplicates[p]=!0),u==="[object Object]")o&&Object.keys(t.dump).length!==0?(W6e(t,e,t.dump,a),h&&(t.dump="&ref_"+p+t.dump)):(Y6e(t,e,t.dump),h&&(t.dump="&ref_"+p+" "+t.dump));else if(u==="[object Array]"){var E=t.noArrayIndent&&e>0?e-1:e;o&&t.dump.length!==0?(G6e(t,E,t.dump,a),h&&(t.dump="&ref_"+p+t.dump)):(q6e(t,E,t.dump),h&&(t.dump="&ref_"+p+" "+t.dump))}else if(u==="[object String]")t.tag!=="?"&&_6e(t,t.dump,e,n);else{if(t.skipInvalid)return!1;throw new eI("unacceptable kind of an object to dump "+u)}t.tag!==null&&t.tag!=="?"&&(t.dump="!<"+t.tag+"> "+t.dump)}return!0}function V6e(t,e){var r=[],o=[],a,n;for(IR(t,r,o),a=0,n=o.length;a{"use strict";var JD=DV(),JV=KV();function zD(t){return function(){throw new Error("Function "+t+" is deprecated and cannot be used.")}}ki.exports.Type=os();ki.exports.Schema=Kg();ki.exports.FAILSAFE_SCHEMA=jD();ki.exports.JSON_SCHEMA=gR();ki.exports.CORE_SCHEMA=dR();ki.exports.DEFAULT_SAFE_SCHEMA=fy();ki.exports.DEFAULT_FULL_SCHEMA=zw();ki.exports.load=JD.load;ki.exports.loadAll=JD.loadAll;ki.exports.safeLoad=JD.safeLoad;ki.exports.safeLoadAll=JD.safeLoadAll;ki.exports.dump=JV.dump;ki.exports.safeDump=JV.safeDump;ki.exports.YAMLException=uy();ki.exports.MINIMAL_SCHEMA=jD();ki.exports.SAFE_SCHEMA=fy();ki.exports.DEFAULT_SCHEMA=zw();ki.exports.scan=zD("scan");ki.exports.parse=zD("parse");ki.exports.compose=zD("compose");ki.exports.addConstructor=zD("addConstructor")});var ZV=_((hbt,XV)=>{"use strict";var J6e=zV();XV.exports=J6e});var eK=_((gbt,$V)=>{"use strict";function z6e(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function $g(t,e,r,o){this.message=t,this.expected=e,this.found=r,this.location=o,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$g)}z6e($g,Error);$g.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",I;for(I=0;I0){for(I=1,v=1;I({[ft]:Le})))},pe=function($){return $},Ae=function($){return $},ye=sa("correct indentation"),ae=" ",we=Qn(" ",!1),Pe=function($){return $.length===nr*It},g=function($){return $.length===(nr+1)*It},Ee=function(){return nr++,!0},De=function(){return nr--,!0},ce=function(){return DA()},ne=sa("pseudostring"),ee=/^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/,Ie=hi(["\r",` +`," "," ","?",":",",","]","[","{","}","#","&","*","!","|",">","'",'"',"%","@","`","-"],!0,!1),ke=/^[^\r\n\t ,\][{}:#"']/,ht=hi(["\r",` +`," "," ",",","]","[","{","}",":","#",'"',"'"],!0,!1),H=function(){return DA().replace(/^ *| *$/g,"")},lt="--",Re=Qn("--",!1),Qe=/^[a-zA-Z\/0-9]/,be=hi([["a","z"],["A","Z"],"/",["0","9"]],!1,!1),_e=/^[^\r\n\t :,]/,Te=hi(["\r",` +`," "," ",":",","],!0,!1),Je="null",He=Qn("null",!1),x=function(){return null},w="true",S=Qn("true",!1),y=function(){return!0},F="false",z=Qn("false",!1),X=function(){return!1},Z=sa("string"),ie='"',Se=Qn('"',!1),Ne=function(){return""},ot=function($){return $},dt=function($){return $.join("")},jt=/^[^"\\\0-\x1F\x7F]/,$t=hi(['"',"\\",["\0",""],"\x7F"],!0,!1),xt='\\"',an=Qn('\\"',!1),Qr=function(){return'"'},mr="\\\\",xr=Qn("\\\\",!1),Wr=function(){return"\\"},Vn="\\/",Ns=Qn("\\/",!1),Ri=function(){return"/"},ps="\\b",io=Qn("\\b",!1),Si=function(){return"\b"},Ls="\\f",so=Qn("\\f",!1),cc=function(){return"\f"},cu="\\n",ap=Qn("\\n",!1),lp=function(){return` +`},Ms="\\r",Dn=Qn("\\r",!1),oo=function(){return"\r"},Os="\\t",ml=Qn("\\t",!1),yl=function(){return" "},ao="\\u",Kn=Qn("\\u",!1),Mn=function($,me,Le,ft){return String.fromCharCode(parseInt(`0x${$}${me}${Le}${ft}`))},Ni=/^[0-9a-fA-F]/,On=hi([["0","9"],["a","f"],["A","F"]],!1,!1),_i=sa("blank space"),tr=/^[ \t]/,Me=hi([" "," "],!1,!1),ii=sa("white space"),Oa=/^[ \t\n\r]/,hr=hi([" "," ",` +`,"\r"],!1,!1),uc=`\r +`,uu=Qn(`\r +`,!1),Ac=` +`,El=Qn(` +`,!1),vA="\r",Au=Qn("\r",!1),Ce=0,Tt=0,fc=[{line:1,column:1}],Hi=0,fu=[],Yt=0,Cl;if("startRule"in e){if(!(e.startRule in o))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=o[e.startRule]}function DA(){return t.substring(Tt,Ce)}function cp(){return _o(Tt,Ce)}function pc($,me){throw me=me!==void 0?me:_o(Tt,Ce),gc([sa($)],t.substring(Tt,Ce),me)}function PA($,me){throw me=me!==void 0?me:_o(Tt,Ce),lo($,me)}function Qn($,me){return{type:"literal",text:$,ignoreCase:me}}function hi($,me,Le){return{type:"class",parts:$,inverted:me,ignoreCase:Le}}function hc(){return{type:"any"}}function SA(){return{type:"end"}}function sa($){return{type:"other",description:$}}function Li($){var me=fc[$],Le;if(me)return me;for(Le=$-1;!fc[Le];)Le--;for(me=fc[Le],me={line:me.line,column:me.column};Le<$;)t.charCodeAt(Le)===10?(me.line++,me.column=1):me.column++,Le++;return fc[$]=me,me}function _o($,me){var Le=Li($),ft=Li(me);return{start:{offset:$,line:Le.line,column:Le.column},end:{offset:me,line:ft.line,column:ft.column}}}function Ze($){CeHi&&(Hi=Ce,fu=[]),fu.push($))}function lo($,me){return new $g($,null,null,me)}function gc($,me,Le){return new $g($g.buildMessage($,me),$,me,Le)}function pu(){var $;return $=xA(),$}function ji(){var $,me,Le;for($=Ce,me=[],Le=hu();Le!==r;)me.push(Le),Le=hu();return me!==r&&(Tt=$,me=n(me)),$=me,$}function hu(){var $,me,Le,ft,pt;return $=Ce,me=hs(),me!==r?(t.charCodeAt(Ce)===45?(Le=u,Ce++):(Le=r,Yt===0&&Ze(A)),Le!==r?(ft=Pn(),ft!==r?(pt=dc(),pt!==r?(Tt=$,me=p(pt),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r),$}function xA(){var $,me,Le;for($=Ce,me=[],Le=Ua();Le!==r;)me.push(Le),Le=Ua();return me!==r&&(Tt=$,me=h(me)),$=me,$}function Ua(){var $,me,Le,ft,pt,Rt,er,Zr,qi;if($=Ce,me=Pn(),me===r&&(me=null),me!==r){if(Le=Ce,t.charCodeAt(Ce)===35?(ft=E,Ce++):(ft=r,Yt===0&&Ze(I)),ft!==r){if(pt=[],Rt=Ce,er=Ce,Yt++,Zr=tt(),Yt--,Zr===r?er=void 0:(Ce=er,er=r),er!==r?(t.length>Ce?(Zr=t.charAt(Ce),Ce++):(Zr=r,Yt===0&&Ze(v)),Zr!==r?(er=[er,Zr],Rt=er):(Ce=Rt,Rt=r)):(Ce=Rt,Rt=r),Rt!==r)for(;Rt!==r;)pt.push(Rt),Rt=Ce,er=Ce,Yt++,Zr=tt(),Yt--,Zr===r?er=void 0:(Ce=er,er=r),er!==r?(t.length>Ce?(Zr=t.charAt(Ce),Ce++):(Zr=r,Yt===0&&Ze(v)),Zr!==r?(er=[er,Zr],Rt=er):(Ce=Rt,Rt=r)):(Ce=Rt,Rt=r);else pt=r;pt!==r?(ft=[ft,pt],Le=ft):(Ce=Le,Le=r)}else Ce=Le,Le=r;if(Le===r&&(Le=null),Le!==r){if(ft=[],pt=We(),pt!==r)for(;pt!==r;)ft.push(pt),pt=We();else ft=r;ft!==r?(Tt=$,me=b(),$=me):(Ce=$,$=r)}else Ce=$,$=r}else Ce=$,$=r;if($===r&&($=Ce,me=hs(),me!==r?(Le=oa(),Le!==r?(ft=Pn(),ft===r&&(ft=null),ft!==r?(t.charCodeAt(Ce)===58?(pt=C,Ce++):(pt=r,Yt===0&&Ze(T)),pt!==r?(Rt=Pn(),Rt===r&&(Rt=null),Rt!==r?(er=dc(),er!==r?(Tt=$,me=L(Le,er),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r),$===r&&($=Ce,me=hs(),me!==r?(Le=co(),Le!==r?(ft=Pn(),ft===r&&(ft=null),ft!==r?(t.charCodeAt(Ce)===58?(pt=C,Ce++):(pt=r,Yt===0&&Ze(T)),pt!==r?(Rt=Pn(),Rt===r&&(Rt=null),Rt!==r?(er=dc(),er!==r?(Tt=$,me=L(Le,er),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r),$===r))){if($=Ce,me=hs(),me!==r)if(Le=co(),Le!==r)if(ft=Pn(),ft!==r)if(pt=aa(),pt!==r){if(Rt=[],er=We(),er!==r)for(;er!==r;)Rt.push(er),er=We();else Rt=r;Rt!==r?(Tt=$,me=L(Le,pt),$=me):(Ce=$,$=r)}else Ce=$,$=r;else Ce=$,$=r;else Ce=$,$=r;else Ce=$,$=r;if($===r)if($=Ce,me=hs(),me!==r)if(Le=co(),Le!==r){if(ft=[],pt=Ce,Rt=Pn(),Rt===r&&(Rt=null),Rt!==r?(t.charCodeAt(Ce)===44?(er=U,Ce++):(er=r,Yt===0&&Ze(J)),er!==r?(Zr=Pn(),Zr===r&&(Zr=null),Zr!==r?(qi=co(),qi!==r?(Tt=pt,Rt=te(Le,qi),pt=Rt):(Ce=pt,pt=r)):(Ce=pt,pt=r)):(Ce=pt,pt=r)):(Ce=pt,pt=r),pt!==r)for(;pt!==r;)ft.push(pt),pt=Ce,Rt=Pn(),Rt===r&&(Rt=null),Rt!==r?(t.charCodeAt(Ce)===44?(er=U,Ce++):(er=r,Yt===0&&Ze(J)),er!==r?(Zr=Pn(),Zr===r&&(Zr=null),Zr!==r?(qi=co(),qi!==r?(Tt=pt,Rt=te(Le,qi),pt=Rt):(Ce=pt,pt=r)):(Ce=pt,pt=r)):(Ce=pt,pt=r)):(Ce=pt,pt=r);else ft=r;ft!==r?(pt=Pn(),pt===r&&(pt=null),pt!==r?(t.charCodeAt(Ce)===58?(Rt=C,Ce++):(Rt=r,Yt===0&&Ze(T)),Rt!==r?(er=Pn(),er===r&&(er=null),er!==r?(Zr=dc(),Zr!==r?(Tt=$,me=le(Le,ft,Zr),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)}else Ce=$,$=r;else Ce=$,$=r}return $}function dc(){var $,me,Le,ft,pt,Rt,er;if($=Ce,me=Ce,Yt++,Le=Ce,ft=tt(),ft!==r?(pt=_t(),pt!==r?(t.charCodeAt(Ce)===45?(Rt=u,Ce++):(Rt=r,Yt===0&&Ze(A)),Rt!==r?(er=Pn(),er!==r?(ft=[ft,pt,Rt,er],Le=ft):(Ce=Le,Le=r)):(Ce=Le,Le=r)):(Ce=Le,Le=r)):(Ce=Le,Le=r),Yt--,Le!==r?(Ce=me,me=void 0):me=r,me!==r?(Le=We(),Le!==r?(ft=Fn(),ft!==r?(pt=ji(),pt!==r?(Rt=Ci(),Rt!==r?(Tt=$,me=pe(pt),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r),$===r&&($=Ce,me=tt(),me!==r?(Le=Fn(),Le!==r?(ft=xA(),ft!==r?(pt=Ci(),pt!==r?(Tt=$,me=pe(ft),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r),$===r))if($=Ce,me=Us(),me!==r){if(Le=[],ft=We(),ft!==r)for(;ft!==r;)Le.push(ft),ft=We();else Le=r;Le!==r?(Tt=$,me=Ae(me),$=me):(Ce=$,$=r)}else Ce=$,$=r;return $}function hs(){var $,me,Le;for(Yt++,$=Ce,me=[],t.charCodeAt(Ce)===32?(Le=ae,Ce++):(Le=r,Yt===0&&Ze(we));Le!==r;)me.push(Le),t.charCodeAt(Ce)===32?(Le=ae,Ce++):(Le=r,Yt===0&&Ze(we));return me!==r?(Tt=Ce,Le=Pe(me),Le?Le=void 0:Le=r,Le!==r?(me=[me,Le],$=me):(Ce=$,$=r)):(Ce=$,$=r),Yt--,$===r&&(me=r,Yt===0&&Ze(ye)),$}function _t(){var $,me,Le;for($=Ce,me=[],t.charCodeAt(Ce)===32?(Le=ae,Ce++):(Le=r,Yt===0&&Ze(we));Le!==r;)me.push(Le),t.charCodeAt(Ce)===32?(Le=ae,Ce++):(Le=r,Yt===0&&Ze(we));return me!==r?(Tt=Ce,Le=g(me),Le?Le=void 0:Le=r,Le!==r?(me=[me,Le],$=me):(Ce=$,$=r)):(Ce=$,$=r),$}function Fn(){var $;return Tt=Ce,$=Ee(),$?$=void 0:$=r,$}function Ci(){var $;return Tt=Ce,$=De(),$?$=void 0:$=r,$}function oa(){var $;return $=ds(),$===r&&($=la()),$}function co(){var $,me,Le;if($=ds(),$===r){if($=Ce,me=[],Le=Ho(),Le!==r)for(;Le!==r;)me.push(Le),Le=Ho();else me=r;me!==r&&(Tt=$,me=ce()),$=me}return $}function Us(){var $;return $=wi(),$===r&&($=gs(),$===r&&($=ds(),$===r&&($=la()))),$}function aa(){var $;return $=wi(),$===r&&($=ds(),$===r&&($=Ho())),$}function la(){var $,me,Le,ft,pt,Rt;if(Yt++,$=Ce,ee.test(t.charAt(Ce))?(me=t.charAt(Ce),Ce++):(me=r,Yt===0&&Ze(Ie)),me!==r){for(Le=[],ft=Ce,pt=Pn(),pt===r&&(pt=null),pt!==r?(ke.test(t.charAt(Ce))?(Rt=t.charAt(Ce),Ce++):(Rt=r,Yt===0&&Ze(ht)),Rt!==r?(pt=[pt,Rt],ft=pt):(Ce=ft,ft=r)):(Ce=ft,ft=r);ft!==r;)Le.push(ft),ft=Ce,pt=Pn(),pt===r&&(pt=null),pt!==r?(ke.test(t.charAt(Ce))?(Rt=t.charAt(Ce),Ce++):(Rt=r,Yt===0&&Ze(ht)),Rt!==r?(pt=[pt,Rt],ft=pt):(Ce=ft,ft=r)):(Ce=ft,ft=r);Le!==r?(Tt=$,me=H(),$=me):(Ce=$,$=r)}else Ce=$,$=r;return Yt--,$===r&&(me=r,Yt===0&&Ze(ne)),$}function Ho(){var $,me,Le,ft,pt;if($=Ce,t.substr(Ce,2)===lt?(me=lt,Ce+=2):(me=r,Yt===0&&Ze(Re)),me===r&&(me=null),me!==r)if(Qe.test(t.charAt(Ce))?(Le=t.charAt(Ce),Ce++):(Le=r,Yt===0&&Ze(be)),Le!==r){for(ft=[],_e.test(t.charAt(Ce))?(pt=t.charAt(Ce),Ce++):(pt=r,Yt===0&&Ze(Te));pt!==r;)ft.push(pt),_e.test(t.charAt(Ce))?(pt=t.charAt(Ce),Ce++):(pt=r,Yt===0&&Ze(Te));ft!==r?(Tt=$,me=H(),$=me):(Ce=$,$=r)}else Ce=$,$=r;else Ce=$,$=r;return $}function wi(){var $,me;return $=Ce,t.substr(Ce,4)===Je?(me=Je,Ce+=4):(me=r,Yt===0&&Ze(He)),me!==r&&(Tt=$,me=x()),$=me,$}function gs(){var $,me;return $=Ce,t.substr(Ce,4)===w?(me=w,Ce+=4):(me=r,Yt===0&&Ze(S)),me!==r&&(Tt=$,me=y()),$=me,$===r&&($=Ce,t.substr(Ce,5)===F?(me=F,Ce+=5):(me=r,Yt===0&&Ze(z)),me!==r&&(Tt=$,me=X()),$=me),$}function ds(){var $,me,Le,ft;return Yt++,$=Ce,t.charCodeAt(Ce)===34?(me=ie,Ce++):(me=r,Yt===0&&Ze(Se)),me!==r?(t.charCodeAt(Ce)===34?(Le=ie,Ce++):(Le=r,Yt===0&&Ze(Se)),Le!==r?(Tt=$,me=Ne(),$=me):(Ce=$,$=r)):(Ce=$,$=r),$===r&&($=Ce,t.charCodeAt(Ce)===34?(me=ie,Ce++):(me=r,Yt===0&&Ze(Se)),me!==r?(Le=ms(),Le!==r?(t.charCodeAt(Ce)===34?(ft=ie,Ce++):(ft=r,Yt===0&&Ze(Se)),ft!==r?(Tt=$,me=ot(Le),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)),Yt--,$===r&&(me=r,Yt===0&&Ze(Z)),$}function ms(){var $,me,Le;if($=Ce,me=[],Le=_s(),Le!==r)for(;Le!==r;)me.push(Le),Le=_s();else me=r;return me!==r&&(Tt=$,me=dt(me)),$=me,$}function _s(){var $,me,Le,ft,pt,Rt;return jt.test(t.charAt(Ce))?($=t.charAt(Ce),Ce++):($=r,Yt===0&&Ze($t)),$===r&&($=Ce,t.substr(Ce,2)===xt?(me=xt,Ce+=2):(me=r,Yt===0&&Ze(an)),me!==r&&(Tt=$,me=Qr()),$=me,$===r&&($=Ce,t.substr(Ce,2)===mr?(me=mr,Ce+=2):(me=r,Yt===0&&Ze(xr)),me!==r&&(Tt=$,me=Wr()),$=me,$===r&&($=Ce,t.substr(Ce,2)===Vn?(me=Vn,Ce+=2):(me=r,Yt===0&&Ze(Ns)),me!==r&&(Tt=$,me=Ri()),$=me,$===r&&($=Ce,t.substr(Ce,2)===ps?(me=ps,Ce+=2):(me=r,Yt===0&&Ze(io)),me!==r&&(Tt=$,me=Si()),$=me,$===r&&($=Ce,t.substr(Ce,2)===Ls?(me=Ls,Ce+=2):(me=r,Yt===0&&Ze(so)),me!==r&&(Tt=$,me=cc()),$=me,$===r&&($=Ce,t.substr(Ce,2)===cu?(me=cu,Ce+=2):(me=r,Yt===0&&Ze(ap)),me!==r&&(Tt=$,me=lp()),$=me,$===r&&($=Ce,t.substr(Ce,2)===Ms?(me=Ms,Ce+=2):(me=r,Yt===0&&Ze(Dn)),me!==r&&(Tt=$,me=oo()),$=me,$===r&&($=Ce,t.substr(Ce,2)===Os?(me=Os,Ce+=2):(me=r,Yt===0&&Ze(ml)),me!==r&&(Tt=$,me=yl()),$=me,$===r&&($=Ce,t.substr(Ce,2)===ao?(me=ao,Ce+=2):(me=r,Yt===0&&Ze(Kn)),me!==r?(Le=Un(),Le!==r?(ft=Un(),ft!==r?(pt=Un(),pt!==r?(Rt=Un(),Rt!==r?(Tt=$,me=Mn(Le,ft,pt,Rt),$=me):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)):(Ce=$,$=r)))))))))),$}function Un(){var $;return Ni.test(t.charAt(Ce))?($=t.charAt(Ce),Ce++):($=r,Yt===0&&Ze(On)),$}function Pn(){var $,me;if(Yt++,$=[],tr.test(t.charAt(Ce))?(me=t.charAt(Ce),Ce++):(me=r,Yt===0&&Ze(Me)),me!==r)for(;me!==r;)$.push(me),tr.test(t.charAt(Ce))?(me=t.charAt(Ce),Ce++):(me=r,Yt===0&&Ze(Me));else $=r;return Yt--,$===r&&(me=r,Yt===0&&Ze(_i)),$}function ys(){var $,me;if(Yt++,$=[],Oa.test(t.charAt(Ce))?(me=t.charAt(Ce),Ce++):(me=r,Yt===0&&Ze(hr)),me!==r)for(;me!==r;)$.push(me),Oa.test(t.charAt(Ce))?(me=t.charAt(Ce),Ce++):(me=r,Yt===0&&Ze(hr));else $=r;return Yt--,$===r&&(me=r,Yt===0&&Ze(ii)),$}function We(){var $,me,Le,ft,pt,Rt;if($=Ce,me=tt(),me!==r){for(Le=[],ft=Ce,pt=Pn(),pt===r&&(pt=null),pt!==r?(Rt=tt(),Rt!==r?(pt=[pt,Rt],ft=pt):(Ce=ft,ft=r)):(Ce=ft,ft=r);ft!==r;)Le.push(ft),ft=Ce,pt=Pn(),pt===r&&(pt=null),pt!==r?(Rt=tt(),Rt!==r?(pt=[pt,Rt],ft=pt):(Ce=ft,ft=r)):(Ce=ft,ft=r);Le!==r?(me=[me,Le],$=me):(Ce=$,$=r)}else Ce=$,$=r;return $}function tt(){var $;return t.substr(Ce,2)===uc?($=uc,Ce+=2):($=r,Yt===0&&Ze(uu)),$===r&&(t.charCodeAt(Ce)===10?($=Ac,Ce++):($=r,Yt===0&&Ze(El)),$===r&&(t.charCodeAt(Ce)===13?($=vA,Ce++):($=r,Yt===0&&Ze(Au)))),$}let It=2,nr=0;if(Cl=a(),Cl!==r&&Ce===t.length)return Cl;throw Cl!==r&&Ce"u"?!0:typeof t=="object"&&t!==null&&!Array.isArray(t)?Object.keys(t).every(e=>iK(t[e])):!1}function DR(t,e,r){if(t===null)return`null +`;if(typeof t=="number"||typeof t=="boolean")return`${t.toString()} +`;if(typeof t=="string")return`${rK(t)} +`;if(Array.isArray(t)){if(t.length===0)return`[] +`;let o=" ".repeat(e);return` +${t.map(n=>`${o}- ${DR(n,e+1,!1)}`).join("")}`}if(typeof t=="object"&&t){let[o,a]=t instanceof XD?[t.data,!1]:[t,!0],n=" ".repeat(e),u=Object.keys(o);a&&u.sort((p,h)=>{let E=tK.indexOf(p),I=tK.indexOf(h);return E===-1&&I===-1?ph?1:0:E!==-1&&I===-1?-1:E===-1&&I!==-1?1:E-I});let A=u.filter(p=>!iK(o[p])).map((p,h)=>{let E=o[p],I=rK(p),v=DR(E,e+1,!0),b=h>0||r?n:"",C=I.length>1024?`? ${I} +${b}:`:`${I}:`,T=v.startsWith(` +`)?v:` ${v}`;return`${b}${C}${T}`}).join(e===0?` +`:"")||` +`;return r?` +${A}`:`${A}`}throw new Error(`Unsupported value type (${t})`)}function Ba(t){try{let e=DR(t,0,!1);return e!==` +`?e:""}catch(e){throw e.location&&(e.message=e.message.replace(/(\.)?$/,` (line ${e.location.start.line}, column ${e.location.start.column})$1`)),e}}function $6e(t){return t.endsWith(` +`)||(t+=` +`),(0,nK.parse)(t)}function tje(t){if(eje.test(t))return $6e(t);let e=(0,ZD.safeLoad)(t,{schema:ZD.FAILSAFE_SCHEMA,json:!0});if(e==null)return{};if(typeof e!="object")throw new Error(`Expected an indexed object, got a ${typeof e} instead. Does your file follow Yaml's rules?`);if(Array.isArray(e))throw new Error("Expected an indexed object, got an array instead. Does your file follow Yaml's rules?");return e}function Vi(t){return tje(t)}var ZD,nK,Z6e,tK,XD,eje,sK=Et(()=>{ZD=$e(ZV()),nK=$e(eK()),Z6e=/^(?![-?:,\][{}#&*!|>'"%@` \t\r\n]).([ \t]*(?![,\][{}:# \t\r\n]).)*$/,tK=["__metadata","version","resolution","dependencies","peerDependencies","dependenciesMeta","peerDependenciesMeta","binaries"],XD=class{constructor(e){this.data=e}};Ba.PreserveOrdering=XD;eje=/^(#.*(\r?\n))*?#\s+yarn\s+lockfile\s+v1\r?\n/i});var tI={};Kt(tI,{parseResolution:()=>UD,parseShell:()=>LD,parseSyml:()=>Vi,stringifyArgument:()=>AR,stringifyArgumentSegment:()=>fR,stringifyArithmeticExpression:()=>OD,stringifyCommand:()=>uR,stringifyCommandChain:()=>cy,stringifyCommandChainThen:()=>cR,stringifyCommandLine:()=>MD,stringifyCommandLineThen:()=>lR,stringifyEnvSegment:()=>ND,stringifyRedirectArgument:()=>Kw,stringifyResolution:()=>_D,stringifyShell:()=>ly,stringifyShellLine:()=>ly,stringifySyml:()=>Ba,stringifyValueArgument:()=>Gg});var Nl=Et(()=>{iW();lW();sK()});var aK=_((Cbt,PR)=>{"use strict";var rje=t=>{let e=!1,r=!1,o=!1;for(let a=0;a{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");e=Object.assign({pascalCase:!1},e);let r=a=>e.pascalCase?a.charAt(0).toUpperCase()+a.slice(1):a;return Array.isArray(t)?t=t.map(a=>a.trim()).filter(a=>a.length).join("-"):t=t.trim(),t.length===0?"":t.length===1?e.pascalCase?t.toUpperCase():t.toLowerCase():(t!==t.toLowerCase()&&(t=rje(t)),t=t.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(a,n)=>n.toUpperCase()).replace(/\d+(\w|$)/g,a=>a.toUpperCase()),r(t))};PR.exports=oK;PR.exports.default=oK});var lK=_((wbt,nje)=>{nje.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vercel",constant:"VERCEL",env:"NOW_BUILDER"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"}]});var ed=_(Xa=>{"use strict";var uK=lK(),ju=process.env;Object.defineProperty(Xa,"_vendors",{value:uK.map(function(t){return t.constant})});Xa.name=null;Xa.isPR=null;uK.forEach(function(t){let r=(Array.isArray(t.env)?t.env:[t.env]).every(function(o){return cK(o)});if(Xa[t.constant]=r,r)switch(Xa.name=t.name,typeof t.pr){case"string":Xa.isPR=!!ju[t.pr];break;case"object":"env"in t.pr?Xa.isPR=t.pr.env in ju&&ju[t.pr.env]!==t.pr.ne:"any"in t.pr?Xa.isPR=t.pr.any.some(function(o){return!!ju[o]}):Xa.isPR=cK(t.pr);break;default:Xa.isPR=null}});Xa.isCI=!!(ju.CI||ju.CONTINUOUS_INTEGRATION||ju.BUILD_NUMBER||ju.RUN_ID||Xa.name);function cK(t){return typeof t=="string"?!!ju[t]:Object.keys(t).every(function(e){return ju[e]===t[e]})}});var Hn,cn,td,SR,$D,AK,xR,bR,eP=Et(()=>{(function(t){t.StartOfInput="\0",t.EndOfInput="",t.EndOfPartialInput=""})(Hn||(Hn={}));(function(t){t[t.InitialNode=0]="InitialNode",t[t.SuccessNode=1]="SuccessNode",t[t.ErrorNode=2]="ErrorNode",t[t.CustomNode=3]="CustomNode"})(cn||(cn={}));td=-1,SR=/^(-h|--help)(?:=([0-9]+))?$/,$D=/^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/,AK=/^-[a-zA-Z]{2,}$/,xR=/^([^=]+)=([\s\S]*)$/,bR=process.env.DEBUG_CLI==="1"});var it,my,tP,kR,rP=Et(()=>{eP();it=class extends Error{constructor(e){super(e),this.clipanion={type:"usage"},this.name="UsageError"}},my=class extends Error{constructor(e,r){if(super(),this.input=e,this.candidates=r,this.clipanion={type:"none"},this.name="UnknownSyntaxError",this.candidates.length===0)this.message="Command not found, but we're not sure what's the alternative.";else if(this.candidates.every(o=>o.reason!==null&&o.reason===r[0].reason)){let[{reason:o}]=this.candidates;this.message=`${o} + +${this.candidates.map(({usage:a})=>`$ ${a}`).join(` +`)}`}else if(this.candidates.length===1){let[{usage:o}]=this.candidates;this.message=`Command not found; did you mean: + +$ ${o} +${kR(e)}`}else this.message=`Command not found; did you mean one of: + +${this.candidates.map(({usage:o},a)=>`${`${a}.`.padStart(4)} ${o}`).join(` +`)} + +${kR(e)}`}},tP=class extends Error{constructor(e,r){super(),this.input=e,this.usages=r,this.clipanion={type:"none"},this.name="AmbiguousSyntaxError",this.message=`Cannot find which to pick amongst the following alternatives: + +${this.usages.map((o,a)=>`${`${a}.`.padStart(4)} ${o}`).join(` +`)} + +${kR(e)}`}},kR=t=>`While running ${t.filter(e=>e!==Hn.EndOfInput&&e!==Hn.EndOfPartialInput).map(e=>{let r=JSON.stringify(e);return e.match(/\s/)||e.length===0||r!==`"${e}"`?r:e}).join(" ")}`});function ije(t){let e=t.split(` +`),r=e.filter(a=>a.match(/\S/)),o=r.length>0?r.reduce((a,n)=>Math.min(a,n.length-n.trimStart().length),Number.MAX_VALUE):0;return e.map(a=>a.slice(o).trimRight()).join(` +`)}function Do(t,{format:e,paragraphs:r}){return t=t.replace(/\r\n?/g,` +`),t=ije(t),t=t.replace(/^\n+|\n+$/g,""),t=t.replace(/^(\s*)-([^\n]*?)\n+/gm,`$1-$2 + +`),t=t.replace(/\n(\n)?\n*/g,(o,a)=>a||" "),r&&(t=t.split(/\n/).map(o=>{let a=o.match(/^\s*[*-][\t ]+(.*)/);if(!a)return o.match(/(.{1,80})(?: |$)/g).join(` +`);let n=o.length-o.trimStart().length;return a[1].match(new RegExp(`(.{1,${78-n}})(?: |$)`,"g")).map((u,A)=>" ".repeat(n)+(A===0?"- ":" ")+u).join(` +`)}).join(` + +`)),t=t.replace(/(`+)((?:.|[\n])*?)\1/g,(o,a,n)=>e.code(a+n+a)),t=t.replace(/(\*\*)((?:.|[\n])*?)\1/g,(o,a,n)=>e.bold(a+n+a)),t?`${t} +`:""}var QR,fK,pK,FR=Et(()=>{QR=Array(80).fill("\u2501");for(let t=0;t<=24;++t)QR[QR.length-t]=`\x1B[38;5;${232+t}m\u2501`;fK={header:t=>`\x1B[1m\u2501\u2501\u2501 ${t}${t.length<80-5?` ${QR.slice(t.length+5).join("")}`:":"}\x1B[0m`,bold:t=>`\x1B[1m${t}\x1B[22m`,error:t=>`\x1B[31m\x1B[1m${t}\x1B[22m\x1B[39m`,code:t=>`\x1B[36m${t}\x1B[39m`},pK={header:t=>t,bold:t=>t,error:t=>t,code:t=>t}});function Vo(t){return{...t,[rI]:!0}}function qu(t,e){return typeof t>"u"?[t,e]:typeof t=="object"&&t!==null&&!Array.isArray(t)?[void 0,t]:[t,e]}function nP(t,{mergeName:e=!1}={}){let r=t.match(/^([^:]+): (.*)$/m);if(!r)return"validation failed";let[,o,a]=r;return e&&(a=a[0].toLowerCase()+a.slice(1)),a=o!=="."||!e?`${o.replace(/^\.(\[|$)/,"$1")}: ${a}`:`: ${a}`,a}function nI(t,e){return e.length===1?new it(`${t}${nP(e[0],{mergeName:!0})}`):new it(`${t}: +${e.map(r=>` +- ${nP(r)}`).join("")}`)}function rd(t,e,r){if(typeof r>"u")return e;let o=[],a=[],n=A=>{let p=e;return e=A,n.bind(null,p)};if(!r(e,{errors:o,coercions:a,coercion:n}))throw nI(`Invalid value for ${t}`,o);for(let[,A]of a)A();return e}var rI,yf=Et(()=>{rP();rI=Symbol("clipanion/isOption")});var Ko={};Kt(Ko,{KeyRelationship:()=>Gu,TypeAssertionError:()=>Wp,applyCascade:()=>oI,as:()=>Bje,assert:()=>Cje,assertWithErrors:()=>wje,cascade:()=>aP,fn:()=>vje,hasAtLeastOneKey:()=>UR,hasExactLength:()=>yK,hasForbiddenKeys:()=>qje,hasKeyRelationship:()=>lI,hasMaxLength:()=>Pje,hasMinLength:()=>Dje,hasMutuallyExclusiveKeys:()=>Gje,hasRequiredKeys:()=>jje,hasUniqueItems:()=>Sje,isArray:()=>iP,isAtLeast:()=>MR,isAtMost:()=>kje,isBase64:()=>Oje,isBoolean:()=>fje,isDate:()=>hje,isDict:()=>mje,isEnum:()=>Vs,isHexColor:()=>Mje,isISO8601:()=>Lje,isInExclusiveRange:()=>Fje,isInInclusiveRange:()=>Qje,isInstanceOf:()=>Eje,isInteger:()=>OR,isJSON:()=>Uje,isLiteral:()=>gK,isLowerCase:()=>Tje,isMap:()=>dje,isNegative:()=>xje,isNullable:()=>Hje,isNumber:()=>NR,isObject:()=>dK,isOneOf:()=>LR,isOptional:()=>_je,isPartial:()=>yje,isPayload:()=>pje,isPositive:()=>bje,isRecord:()=>oP,isSet:()=>gje,isString:()=>Ey,isTuple:()=>sP,isUUID4:()=>Nje,isUnknown:()=>RR,isUpperCase:()=>Rje,makeTrait:()=>mK,makeValidator:()=>Hr,matchesRegExp:()=>sI,softAssert:()=>Ije});function jn(t){return t===null?"null":t===void 0?"undefined":t===""?"an empty string":typeof t=="symbol"?`<${t.toString()}>`:Array.isArray(t)?"an array":JSON.stringify(t)}function yy(t,e){if(t.length===0)return"nothing";if(t.length===1)return jn(t[0]);let r=t.slice(0,-1),o=t[t.length-1],a=t.length>2?`, ${e} `:` ${e} `;return`${r.map(n=>jn(n)).join(", ")}${a}${jn(o)}`}function Yp(t,e){var r,o,a;return typeof e=="number"?`${(r=t?.p)!==null&&r!==void 0?r:"."}[${e}]`:sje.test(e)?`${(o=t?.p)!==null&&o!==void 0?o:""}.${e}`:`${(a=t?.p)!==null&&a!==void 0?a:"."}[${JSON.stringify(e)}]`}function TR(t,e,r){return t===1?e:r}function pr({errors:t,p:e}={},r){return t?.push(`${e??"."}: ${r}`),!1}function uje(t,e){return r=>{t[e]=r}}function Yu(t,e){return r=>{let o=t[e];return t[e]=r,Yu(t,e).bind(null,o)}}function iI(t,e,r){let o=()=>(t(r()),a),a=()=>(t(e),o);return o}function RR(){return Hr({test:(t,e)=>!0})}function gK(t){return Hr({test:(e,r)=>e!==t?pr(r,`Expected ${jn(t)} (got ${jn(e)})`):!0})}function Ey(){return Hr({test:(t,e)=>typeof t!="string"?pr(e,`Expected a string (got ${jn(t)})`):!0})}function Vs(t){let e=Array.isArray(t)?t:Object.values(t),r=e.every(a=>typeof a=="string"||typeof a=="number"),o=new Set(e);return o.size===1?gK([...o][0]):Hr({test:(a,n)=>o.has(a)?!0:r?pr(n,`Expected one of ${yy(e,"or")} (got ${jn(a)})`):pr(n,`Expected a valid enumeration value (got ${jn(a)})`)})}function fje(){return Hr({test:(t,e)=>{var r;if(typeof t!="boolean"){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return pr(e,"Unbound coercion result");let o=Aje.get(t);if(typeof o<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,o)]),!0}return pr(e,`Expected a boolean (got ${jn(t)})`)}return!0}})}function NR(){return Hr({test:(t,e)=>{var r;if(typeof t!="number"){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return pr(e,"Unbound coercion result");let o;if(typeof t=="string"){let a;try{a=JSON.parse(t)}catch{}if(typeof a=="number")if(JSON.stringify(a)===t)o=a;else return pr(e,`Received a number that can't be safely represented by the runtime (${t})`)}if(typeof o<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,o)]),!0}return pr(e,`Expected a number (got ${jn(t)})`)}return!0}})}function pje(t){return Hr({test:(e,r)=>{var o;if(typeof r?.coercions>"u")return pr(r,"The isPayload predicate can only be used with coercion enabled");if(typeof r.coercion>"u")return pr(r,"Unbound coercion result");if(typeof e!="string")return pr(r,`Expected a string (got ${jn(e)})`);let a;try{a=JSON.parse(e)}catch{return pr(r,`Expected a JSON string (got ${jn(e)})`)}let n={value:a};return t(a,Object.assign(Object.assign({},r),{coercion:Yu(n,"value")}))?(r.coercions.push([(o=r.p)!==null&&o!==void 0?o:".",r.coercion.bind(null,n.value)]),!0):!1}})}function hje(){return Hr({test:(t,e)=>{var r;if(!(t instanceof Date)){if(typeof e?.coercions<"u"){if(typeof e?.coercion>"u")return pr(e,"Unbound coercion result");let o;if(typeof t=="string"&&hK.test(t))o=new Date(t);else{let a;if(typeof t=="string"){let n;try{n=JSON.parse(t)}catch{}typeof n=="number"&&(a=n)}else typeof t=="number"&&(a=t);if(typeof a<"u")if(Number.isSafeInteger(a)||!Number.isSafeInteger(a*1e3))o=new Date(a*1e3);else return pr(e,`Received a timestamp that can't be safely represented by the runtime (${t})`)}if(typeof o<"u")return e.coercions.push([(r=e.p)!==null&&r!==void 0?r:".",e.coercion.bind(null,o)]),!0}return pr(e,`Expected a date (got ${jn(t)})`)}return!0}})}function iP(t,{delimiter:e}={}){return Hr({test:(r,o)=>{var a;let n=r;if(typeof r=="string"&&typeof e<"u"&&typeof o?.coercions<"u"){if(typeof o?.coercion>"u")return pr(o,"Unbound coercion result");r=r.split(e)}if(!Array.isArray(r))return pr(o,`Expected an array (got ${jn(r)})`);let u=!0;for(let A=0,p=r.length;A{var n,u;if(Object.getPrototypeOf(o).toString()==="[object Set]")if(typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return pr(a,"Unbound coercion result");let A=[...o],p=[...o];if(!r(p,Object.assign(Object.assign({},a),{coercion:void 0})))return!1;let h=()=>p.some((E,I)=>E!==A[I])?new Set(p):o;return a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",iI(a.coercion,o,h)]),!0}else{let A=!0;for(let p of o)if(A=t(p,Object.assign({},a))&&A,!A&&a?.errors==null)break;return A}if(typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return pr(a,"Unbound coercion result");let A={value:o};return r(o,Object.assign(Object.assign({},a),{coercion:Yu(A,"value")}))?(a.coercions.push([(u=a.p)!==null&&u!==void 0?u:".",iI(a.coercion,o,()=>new Set(A.value))]),!0):!1}return pr(a,`Expected a set (got ${jn(o)})`)}})}function dje(t,e){let r=iP(sP([t,e])),o=oP(e,{keys:t});return Hr({test:(a,n)=>{var u,A,p;if(Object.getPrototypeOf(a).toString()==="[object Map]")if(typeof n?.coercions<"u"){if(typeof n?.coercion>"u")return pr(n,"Unbound coercion result");let h=[...a],E=[...a];if(!r(E,Object.assign(Object.assign({},n),{coercion:void 0})))return!1;let I=()=>E.some((v,b)=>v[0]!==h[b][0]||v[1]!==h[b][1])?new Map(E):a;return n.coercions.push([(u=n.p)!==null&&u!==void 0?u:".",iI(n.coercion,a,I)]),!0}else{let h=!0;for(let[E,I]of a)if(h=t(E,Object.assign({},n))&&h,!h&&n?.errors==null||(h=e(I,Object.assign(Object.assign({},n),{p:Yp(n,E)}))&&h,!h&&n?.errors==null))break;return h}if(typeof n?.coercions<"u"){if(typeof n?.coercion>"u")return pr(n,"Unbound coercion result");let h={value:a};return Array.isArray(a)?r(a,Object.assign(Object.assign({},n),{coercion:void 0}))?(n.coercions.push([(A=n.p)!==null&&A!==void 0?A:".",iI(n.coercion,a,()=>new Map(h.value))]),!0):!1:o(a,Object.assign(Object.assign({},n),{coercion:Yu(h,"value")}))?(n.coercions.push([(p=n.p)!==null&&p!==void 0?p:".",iI(n.coercion,a,()=>new Map(Object.entries(h.value)))]),!0):!1}return pr(n,`Expected a map (got ${jn(a)})`)}})}function sP(t,{delimiter:e}={}){let r=yK(t.length);return Hr({test:(o,a)=>{var n;if(typeof o=="string"&&typeof e<"u"&&typeof a?.coercions<"u"){if(typeof a?.coercion>"u")return pr(a,"Unbound coercion result");o=o.split(e),a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",a.coercion.bind(null,o)])}if(!Array.isArray(o))return pr(a,`Expected a tuple (got ${jn(o)})`);let u=r(o,Object.assign({},a));for(let A=0,p=o.length;A{var n;if(Array.isArray(o)&&typeof a?.coercions<"u")return typeof a?.coercion>"u"?pr(a,"Unbound coercion result"):r(o,Object.assign(Object.assign({},a),{coercion:void 0}))?(o=Object.fromEntries(o),a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",a.coercion.bind(null,o)]),!0):!1;if(typeof o!="object"||o===null)return pr(a,`Expected an object (got ${jn(o)})`);let u=Object.keys(o),A=!0;for(let p=0,h=u.length;p{if(typeof a!="object"||a===null)return pr(n,`Expected an object (got ${jn(a)})`);let u=new Set([...r,...Object.keys(a)]),A={},p=!0;for(let h of u){if(h==="constructor"||h==="__proto__")p=pr(Object.assign(Object.assign({},n),{p:Yp(n,h)}),"Unsafe property name");else{let E=Object.prototype.hasOwnProperty.call(t,h)?t[h]:void 0,I=Object.prototype.hasOwnProperty.call(a,h)?a[h]:void 0;typeof E<"u"?p=E(I,Object.assign(Object.assign({},n),{p:Yp(n,h),coercion:Yu(a,h)}))&&p:e===null?p=pr(Object.assign(Object.assign({},n),{p:Yp(n,h)}),`Extraneous property (got ${jn(I)})`):Object.defineProperty(A,h,{enumerable:!0,get:()=>I,set:uje(a,h)})}if(!p&&n?.errors==null)break}return e!==null&&(p||n?.errors!=null)&&(p=e(A,n)&&p),p}});return Object.assign(o,{properties:t})}function yje(t){return dK(t,{extra:oP(RR())})}function mK(t){return()=>t}function Hr({test:t}){return mK(t)()}function Cje(t,e){if(!e(t))throw new Wp}function wje(t,e){let r=[];if(!e(t,{errors:r}))throw new Wp({errors:r})}function Ije(t,e){}function Bje(t,e,{coerce:r=!1,errors:o,throw:a}={}){let n=o?[]:void 0;if(!r){if(e(t,{errors:n}))return a?t:{value:t,errors:void 0};if(a)throw new Wp({errors:n});return{value:void 0,errors:n??!0}}let u={value:t},A=Yu(u,"value"),p=[];if(!e(t,{errors:n,coercion:A,coercions:p})){if(a)throw new Wp({errors:n});return{value:void 0,errors:n??!0}}for(let[,h]of p)h();return a?u.value:{value:u.value,errors:void 0}}function vje(t,e){let r=sP(t);return(...o)=>{if(!r(o))throw new Wp;return e(...o)}}function Dje(t){return Hr({test:(e,r)=>e.length>=t?!0:pr(r,`Expected to have a length of at least ${t} elements (got ${e.length})`)})}function Pje(t){return Hr({test:(e,r)=>e.length<=t?!0:pr(r,`Expected to have a length of at most ${t} elements (got ${e.length})`)})}function yK(t){return Hr({test:(e,r)=>e.length!==t?pr(r,`Expected to have a length of exactly ${t} elements (got ${e.length})`):!0})}function Sje({map:t}={}){return Hr({test:(e,r)=>{let o=new Set,a=new Set;for(let n=0,u=e.length;nt<=0?!0:pr(e,`Expected to be negative (got ${t})`)})}function bje(){return Hr({test:(t,e)=>t>=0?!0:pr(e,`Expected to be positive (got ${t})`)})}function MR(t){return Hr({test:(e,r)=>e>=t?!0:pr(r,`Expected to be at least ${t} (got ${e})`)})}function kje(t){return Hr({test:(e,r)=>e<=t?!0:pr(r,`Expected to be at most ${t} (got ${e})`)})}function Qje(t,e){return Hr({test:(r,o)=>r>=t&&r<=e?!0:pr(o,`Expected to be in the [${t}; ${e}] range (got ${r})`)})}function Fje(t,e){return Hr({test:(r,o)=>r>=t&&re!==Math.round(e)?pr(r,`Expected to be an integer (got ${e})`):!t&&!Number.isSafeInteger(e)?pr(r,`Expected to be a safe integer (got ${e})`):!0})}function sI(t){return Hr({test:(e,r)=>t.test(e)?!0:pr(r,`Expected to match the pattern ${t.toString()} (got ${jn(e)})`)})}function Tje(){return Hr({test:(t,e)=>t!==t.toLowerCase()?pr(e,`Expected to be all-lowercase (got ${t})`):!0})}function Rje(){return Hr({test:(t,e)=>t!==t.toUpperCase()?pr(e,`Expected to be all-uppercase (got ${t})`):!0})}function Nje(){return Hr({test:(t,e)=>cje.test(t)?!0:pr(e,`Expected to be a valid UUID v4 (got ${jn(t)})`)})}function Lje(){return Hr({test:(t,e)=>hK.test(t)?!0:pr(e,`Expected to be a valid ISO 8601 date string (got ${jn(t)})`)})}function Mje({alpha:t=!1}){return Hr({test:(e,r)=>(t?oje.test(e):aje.test(e))?!0:pr(r,`Expected to be a valid hexadecimal color string (got ${jn(e)})`)})}function Oje(){return Hr({test:(t,e)=>lje.test(t)?!0:pr(e,`Expected to be a valid base 64 string (got ${jn(t)})`)})}function Uje(t=RR()){return Hr({test:(e,r)=>{let o;try{o=JSON.parse(e)}catch{return pr(r,`Expected to be a valid JSON string (got ${jn(e)})`)}return t(o,r)}})}function aP(t,...e){let r=Array.isArray(e[0])?e[0]:e;return Hr({test:(o,a)=>{var n,u;let A={value:o},p=typeof a?.coercions<"u"?Yu(A,"value"):void 0,h=typeof a?.coercions<"u"?[]:void 0;if(!t(o,Object.assign(Object.assign({},a),{coercion:p,coercions:h})))return!1;let E=[];if(typeof h<"u")for(let[,I]of h)E.push(I());try{if(typeof a?.coercions<"u"){if(A.value!==o){if(typeof a?.coercion>"u")return pr(a,"Unbound coercion result");a.coercions.push([(n=a.p)!==null&&n!==void 0?n:".",a.coercion.bind(null,A.value)])}(u=a?.coercions)===null||u===void 0||u.push(...h)}return r.every(I=>I(A.value,a))}finally{for(let I of E)I()}}})}function oI(t,...e){let r=Array.isArray(e[0])?e[0]:e;return aP(t,r)}function _je(t){return Hr({test:(e,r)=>typeof e>"u"?!0:t(e,r)})}function Hje(t){return Hr({test:(e,r)=>e===null?!0:t(e,r)})}function jje(t,e){var r;let o=new Set(t),a=aI[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return Hr({test:(n,u)=>{let A=new Set(Object.keys(n)),p=[];for(let h of o)a(A,h,n)||p.push(h);return p.length>0?pr(u,`Missing required ${TR(p.length,"property","properties")} ${yy(p,"and")}`):!0}})}function UR(t,e){var r;let o=new Set(t),a=aI[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return Hr({test:(n,u)=>Object.keys(n).some(h=>a(o,h,n))?!0:pr(u,`Missing at least one property from ${yy(Array.from(o),"or")}`)})}function qje(t,e){var r;let o=new Set(t),a=aI[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return Hr({test:(n,u)=>{let A=new Set(Object.keys(n)),p=[];for(let h of o)a(A,h,n)&&p.push(h);return p.length>0?pr(u,`Forbidden ${TR(p.length,"property","properties")} ${yy(p,"and")}`):!0}})}function Gje(t,e){var r;let o=new Set(t),a=aI[(r=e?.missingIf)!==null&&r!==void 0?r:"missing"];return Hr({test:(n,u)=>{let A=new Set(Object.keys(n)),p=[];for(let h of o)a(A,h,n)&&p.push(h);return p.length>1?pr(u,`Mutually exclusive properties ${yy(p,"and")}`):!0}})}function lI(t,e,r,o){var a,n;let u=new Set((a=o?.ignore)!==null&&a!==void 0?a:[]),A=aI[(n=o?.missingIf)!==null&&n!==void 0?n:"missing"],p=new Set(r),h=Yje[e],E=e===Gu.Forbids?"or":"and";return Hr({test:(I,v)=>{let b=new Set(Object.keys(I));if(!A(b,t,I)||u.has(I[t]))return!0;let C=[];for(let T of p)(A(b,T,I)&&!u.has(I[T]))!==h.expect&&C.push(T);return C.length>=1?pr(v,`Property "${t}" ${h.message} ${TR(C.length,"property","properties")} ${yy(C,E)}`):!0}})}var sje,oje,aje,lje,cje,hK,Aje,Eje,LR,Wp,aI,Gu,Yje,Za=Et(()=>{sje=/^[a-zA-Z_][a-zA-Z0-9_]*$/;oje=/^#[0-9a-f]{6}$/i,aje=/^#[0-9a-f]{6}([0-9a-f]{2})?$/i,lje=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,cje=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i,hK=/^(?:[1-9]\d{3}(-?)(?:(?:0[1-9]|1[0-2])\1(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])\1(?:29|30)|(?:0[13578]|1[02])(?:\1)31|00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[0-5]))|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\2)29|-?366))T(?:[01]\d|2[0-3])(:?)[0-5]\d(?:\3[0-5]\d)?(?:Z|[+-][01]\d(?:\3[0-5]\d)?)$/;Aje=new Map([["true",!0],["True",!0],["1",!0],[1,!0],["false",!1],["False",!1],["0",!1],[0,!1]]);Eje=t=>Hr({test:(e,r)=>e instanceof t?!0:pr(r,`Expected an instance of ${t.name} (got ${jn(e)})`)}),LR=(t,{exclusive:e=!1}={})=>Hr({test:(r,o)=>{var a,n,u;let A=[],p=typeof o?.errors<"u"?[]:void 0;for(let h=0,E=t.length;h1?pr(o,`Expected to match exactly a single predicate (matched ${A.join(", ")})`):(u=o?.errors)===null||u===void 0||u.push(...p),!1}});Wp=class extends Error{constructor({errors:e}={}){let r="Type mismatch";if(e&&e.length>0){r+=` +`;for(let o of e)r+=` +- ${o}`}super(r)}};aI={missing:(t,e)=>t.has(e),undefined:(t,e,r)=>t.has(e)&&typeof r[e]<"u",nil:(t,e,r)=>t.has(e)&&r[e]!=null,falsy:(t,e,r)=>t.has(e)&&!!r[e]};(function(t){t.Forbids="Forbids",t.Requires="Requires"})(Gu||(Gu={}));Yje={[Gu.Forbids]:{expect:!1,message:"forbids using"},[Gu.Requires]:{expect:!0,message:"requires using"}}});var nt,Vp=Et(()=>{yf();nt=class{constructor(){this.help=!1}static Usage(e){return e}async catch(e){throw e}async validateAndExecute(){let r=this.constructor.schema;if(Array.isArray(r)){let{isDict:a,isUnknown:n,applyCascade:u}=await Promise.resolve().then(()=>(Za(),Ko)),A=u(a(n()),r),p=[],h=[];if(!A(this,{errors:p,coercions:h}))throw nI("Invalid option schema",p);for(let[,I]of h)I()}else if(r!=null)throw new Error("Invalid command schema");let o=await this.execute();return typeof o<"u"?o:0}};nt.isOption=rI;nt.Default=[]});function va(t){bR&&console.log(t)}function CK(){let t={nodes:[]};for(let e=0;e{if(e.has(o))return;e.add(o);let a=t.nodes[o];for(let u of Object.values(a.statics))for(let{to:A}of u)r(A);for(let[,{to:u}]of a.dynamics)r(u);for(let{to:u}of a.shortcuts)r(u);let n=new Set(a.shortcuts.map(({to:u})=>u));for(;a.shortcuts.length>0;){let{to:u}=a.shortcuts.shift(),A=t.nodes[u];for(let[p,h]of Object.entries(A.statics)){let E=Object.prototype.hasOwnProperty.call(a.statics,p)?a.statics[p]:a.statics[p]=[];for(let I of h)E.some(({to:v})=>I.to===v)||E.push(I)}for(let[p,h]of A.dynamics)a.dynamics.some(([E,{to:I}])=>p===E&&h.to===I)||a.dynamics.push([p,h]);for(let p of A.shortcuts)n.has(p.to)||(a.shortcuts.push(p),n.add(p.to))}};r(cn.InitialNode)}function Kje(t,{prefix:e=""}={}){if(bR){va(`${e}Nodes are:`);for(let r=0;rE!==cn.ErrorNode).map(({state:E})=>({usage:E.candidateUsage,reason:null})));if(h.every(({node:E})=>E===cn.ErrorNode))throw new my(e,h.map(({state:E})=>({usage:E.candidateUsage,reason:E.errorMessage})));o=Xje(h)}if(o.length>0){va(" Results:");for(let n of o)va(` - ${n.node} -> ${JSON.stringify(n.state)}`)}else va(" No results");return o}function zje(t,e,{endToken:r=Hn.EndOfInput}={}){let o=Jje(t,[...e,r]);return Zje(e,o.map(({state:a})=>a))}function Xje(t){let e=0;for(let{state:r}of t)r.path.length>e&&(e=r.path.length);return t.filter(({state:r})=>r.path.length===e)}function Zje(t,e){let r=e.filter(v=>v.selectedIndex!==null),o=r.filter(v=>!v.partial);if(o.length>0&&(r=o),r.length===0)throw new Error;let a=r.filter(v=>v.selectedIndex===td||v.requiredOptions.every(b=>b.some(C=>v.options.find(T=>T.name===C))));if(a.length===0)throw new my(t,r.map(v=>({usage:v.candidateUsage,reason:null})));let n=0;for(let v of a)v.path.length>n&&(n=v.path.length);let u=a.filter(v=>v.path.length===n),A=v=>v.positionals.filter(({extra:b})=>!b).length+v.options.length,p=u.map(v=>({state:v,positionalCount:A(v)})),h=0;for(let{positionalCount:v}of p)v>h&&(h=v);let E=p.filter(({positionalCount:v})=>v===h).map(({state:v})=>v),I=$je(E);if(I.length>1)throw new tP(t,I.map(v=>v.candidateUsage));return I[0]}function $je(t){let e=[],r=[];for(let o of t)o.selectedIndex===td?r.push(o):e.push(o);return r.length>0&&e.push({...EK,path:wK(...r.map(o=>o.path)),options:r.reduce((o,a)=>o.concat(a.options),[])}),e}function wK(t,e,...r){return e===void 0?Array.from(t):wK(t.filter((o,a)=>o===e[a]),...r)}function $a(){return{dynamics:[],shortcuts:[],statics:{}}}function IK(t){return t===cn.SuccessNode||t===cn.ErrorNode}function _R(t,e=0){return{to:IK(t.to)?t.to:t.to>=cn.CustomNode?t.to+e-cn.CustomNode+1:t.to+e,reducer:t.reducer}}function eqe(t,e=0){let r=$a();for(let[o,a]of t.dynamics)r.dynamics.push([o,_R(a,e)]);for(let o of t.shortcuts)r.shortcuts.push(_R(o,e));for(let[o,a]of Object.entries(t.statics))r.statics[o]=a.map(n=>_R(n,e));return r}function Ss(t,e,r,o,a){t.nodes[e].dynamics.push([r,{to:o,reducer:a}])}function Cy(t,e,r,o){t.nodes[e].shortcuts.push({to:r,reducer:o})}function Jo(t,e,r,o,a){(Object.prototype.hasOwnProperty.call(t.nodes[e].statics,r)?t.nodes[e].statics[r]:t.nodes[e].statics[r]=[]).push({to:o,reducer:a})}function lP(t,e,r,o,a){if(Array.isArray(e)){let[n,...u]=e;return t[n](r,o,a,...u)}else return t[e](r,o,a)}var EK,tqe,HR,el,jR,wy,cP=Et(()=>{eP();rP();EK={candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,path:[],positionals:[],options:[],remainder:null,selectedIndex:td,partial:!1,tokens:[]};tqe={always:()=>!0,isOptionLike:(t,e)=>!t.ignoreOptions&&e!=="-"&&e.startsWith("-"),isNotOptionLike:(t,e)=>t.ignoreOptions||e==="-"||!e.startsWith("-"),isOption:(t,e,r,o)=>!t.ignoreOptions&&e===o,isBatchOption:(t,e,r,o)=>!t.ignoreOptions&&AK.test(e)&&[...e.slice(1)].every(a=>o.has(`-${a}`)),isBoundOption:(t,e,r,o,a)=>{let n=e.match(xR);return!t.ignoreOptions&&!!n&&$D.test(n[1])&&o.has(n[1])&&a.filter(u=>u.nameSet.includes(n[1])).every(u=>u.allowBinding)},isNegatedOption:(t,e,r,o)=>!t.ignoreOptions&&e===`--no-${o.slice(2)}`,isHelp:(t,e)=>!t.ignoreOptions&&SR.test(e),isUnsupportedOption:(t,e,r,o)=>!t.ignoreOptions&&e.startsWith("-")&&$D.test(e)&&!o.has(e),isInvalidOption:(t,e)=>!t.ignoreOptions&&e.startsWith("-")&&!$D.test(e)},HR={setCandidateState:(t,e,r,o)=>({...t,...o}),setSelectedIndex:(t,e,r,o)=>({...t,selectedIndex:o}),setPartialIndex:(t,e,r,o)=>({...t,selectedIndex:o,partial:!0}),pushBatch:(t,e,r,o)=>{let a=t.options.slice(),n=t.tokens.slice();for(let u=1;u{let[,o,a]=e.match(xR),n=t.options.concat({name:o,value:a}),u=t.tokens.concat([{segmentIndex:r,type:"option",slice:[0,o.length],option:o},{segmentIndex:r,type:"assign",slice:[o.length,o.length+1]},{segmentIndex:r,type:"value",slice:[o.length+1,o.length+a.length+1]}]);return{...t,options:n,tokens:u}},pushPath:(t,e,r)=>{let o=t.path.concat(e),a=t.tokens.concat({segmentIndex:r,type:"path"});return{...t,path:o,tokens:a}},pushPositional:(t,e,r)=>{let o=t.positionals.concat({value:e,extra:!1}),a=t.tokens.concat({segmentIndex:r,type:"positional"});return{...t,positionals:o,tokens:a}},pushExtra:(t,e,r)=>{let o=t.positionals.concat({value:e,extra:!0}),a=t.tokens.concat({segmentIndex:r,type:"positional"});return{...t,positionals:o,tokens:a}},pushExtraNoLimits:(t,e,r)=>{let o=t.positionals.concat({value:e,extra:el}),a=t.tokens.concat({segmentIndex:r,type:"positional"});return{...t,positionals:o,tokens:a}},pushTrue:(t,e,r,o)=>{let a=t.options.concat({name:o,value:!0}),n=t.tokens.concat({segmentIndex:r,type:"option",option:o});return{...t,options:a,tokens:n}},pushFalse:(t,e,r,o)=>{let a=t.options.concat({name:o,value:!1}),n=t.tokens.concat({segmentIndex:r,type:"option",option:o});return{...t,options:a,tokens:n}},pushUndefined:(t,e,r,o)=>{let a=t.options.concat({name:e,value:void 0}),n=t.tokens.concat({segmentIndex:r,type:"option",option:e});return{...t,options:a,tokens:n}},pushStringValue:(t,e,r)=>{var o;let a=t.options[t.options.length-1],n=t.options.slice(),u=t.tokens.concat({segmentIndex:r,type:"value"});return a.value=((o=a.value)!==null&&o!==void 0?o:[]).concat([e]),{...t,options:n,tokens:u}},setStringValue:(t,e,r)=>{let o=t.options[t.options.length-1],a=t.options.slice(),n=t.tokens.concat({segmentIndex:r,type:"value"});return o.value=e,{...t,options:a,tokens:n}},inhibateOptions:t=>({...t,ignoreOptions:!0}),useHelp:(t,e,r,o)=>{let[,,a]=e.match(SR);return typeof a<"u"?{...t,options:[{name:"-c",value:String(o)},{name:"-i",value:a}]}:{...t,options:[{name:"-c",value:String(o)}]}},setError:(t,e,r,o)=>e===Hn.EndOfInput||e===Hn.EndOfPartialInput?{...t,errorMessage:`${o}.`}:{...t,errorMessage:`${o} ("${e}").`},setOptionArityError:(t,e)=>{let r=t.options[t.options.length-1];return{...t,errorMessage:`Not enough arguments to option ${r.name}.`}}},el=Symbol(),jR=class{constructor(e,r){this.allOptionNames=new Map,this.arity={leading:[],trailing:[],extra:[],proxy:!1},this.options=[],this.paths=[],this.cliIndex=e,this.cliOpts=r}addPath(e){this.paths.push(e)}setArity({leading:e=this.arity.leading,trailing:r=this.arity.trailing,extra:o=this.arity.extra,proxy:a=this.arity.proxy}){Object.assign(this.arity,{leading:e,trailing:r,extra:o,proxy:a})}addPositional({name:e="arg",required:r=!0}={}){if(!r&&this.arity.extra===el)throw new Error("Optional parameters cannot be declared when using .rest() or .proxy()");if(!r&&this.arity.trailing.length>0)throw new Error("Optional parameters cannot be declared after the required trailing positional arguments");!r&&this.arity.extra!==el?this.arity.extra.push(e):this.arity.extra!==el&&this.arity.extra.length===0?this.arity.leading.push(e):this.arity.trailing.push(e)}addRest({name:e="arg",required:r=0}={}){if(this.arity.extra===el)throw new Error("Infinite lists cannot be declared multiple times in the same command");if(this.arity.trailing.length>0)throw new Error("Infinite lists cannot be declared after the required trailing positional arguments");for(let o=0;o1)throw new Error("The arity cannot be higher than 1 when the option only supports the --arg=value syntax");if(!Number.isInteger(o))throw new Error(`The arity must be an integer, got ${o}`);if(o<0)throw new Error(`The arity must be positive, got ${o}`);let A=e.reduce((p,h)=>h.length>p.length?h:p,"");for(let p of e)this.allOptionNames.set(p,A);this.options.push({preferredName:A,nameSet:e,description:r,arity:o,hidden:a,required:n,allowBinding:u})}setContext(e){this.context=e}usage({detailed:e=!0,inlineOptions:r=!0}={}){let o=[this.cliOpts.binaryName],a=[];if(this.paths.length>0&&o.push(...this.paths[0]),e){for(let{preferredName:u,nameSet:A,arity:p,hidden:h,description:E,required:I}of this.options){if(h)continue;let v=[];for(let C=0;C`:`[${b}]`)}o.push(...this.arity.leading.map(u=>`<${u}>`)),this.arity.extra===el?o.push("..."):o.push(...this.arity.extra.map(u=>`[${u}]`)),o.push(...this.arity.trailing.map(u=>`<${u}>`))}return{usage:o.join(" "),options:a}}compile(){if(typeof this.context>"u")throw new Error("Assertion failed: No context attached");let e=CK(),r=cn.InitialNode,o=this.usage().usage,a=this.options.filter(A=>A.required).map(A=>A.nameSet);r=Mc(e,$a()),Jo(e,cn.InitialNode,Hn.StartOfInput,r,["setCandidateState",{candidateUsage:o,requiredOptions:a}]);let n=this.arity.proxy?"always":"isNotOptionLike",u=this.paths.length>0?this.paths:[[]];for(let A of u){let p=r;if(A.length>0){let v=Mc(e,$a());Cy(e,p,v),this.registerOptions(e,v),p=v}for(let v=0;v0||!this.arity.proxy){let v=Mc(e,$a());Ss(e,p,"isHelp",v,["useHelp",this.cliIndex]),Ss(e,v,"always",v,"pushExtra"),Jo(e,v,Hn.EndOfInput,cn.SuccessNode,["setSelectedIndex",td]),this.registerOptions(e,p)}this.arity.leading.length>0&&(Jo(e,p,Hn.EndOfInput,cn.ErrorNode,["setError","Not enough positional arguments"]),Jo(e,p,Hn.EndOfPartialInput,cn.SuccessNode,["setPartialIndex",this.cliIndex]));let h=p;for(let v=0;v0||v+1!==this.arity.leading.length)&&(Jo(e,b,Hn.EndOfInput,cn.ErrorNode,["setError","Not enough positional arguments"]),Jo(e,b,Hn.EndOfPartialInput,cn.SuccessNode,["setPartialIndex",this.cliIndex])),Ss(e,h,"isNotOptionLike",b,"pushPositional"),h=b}let E=h;if(this.arity.extra===el||this.arity.extra.length>0){let v=Mc(e,$a());if(Cy(e,h,v),this.arity.extra===el){let b=Mc(e,$a());this.arity.proxy||this.registerOptions(e,b),Ss(e,h,n,b,"pushExtraNoLimits"),Ss(e,b,n,b,"pushExtraNoLimits"),Cy(e,b,v)}else for(let b=0;b0)&&this.registerOptions(e,C),Ss(e,E,n,C,"pushExtra"),Cy(e,C,v),E=C}E=v}this.arity.trailing.length>0&&(Jo(e,E,Hn.EndOfInput,cn.ErrorNode,["setError","Not enough positional arguments"]),Jo(e,E,Hn.EndOfPartialInput,cn.SuccessNode,["setPartialIndex",this.cliIndex]));let I=E;for(let v=0;v=0&&e{let u=n?Hn.EndOfPartialInput:Hn.EndOfInput;return zje(o,a,{endToken:u})}}}}});function vK(){return uP.default&&"getColorDepth"in uP.default.WriteStream.prototype?uP.default.WriteStream.prototype.getColorDepth():process.env.FORCE_COLOR==="0"?1:process.env.FORCE_COLOR==="1"||typeof process.stdout<"u"&&process.stdout.isTTY?8:1}function DK(t){let e=BK;if(typeof e>"u"){if(t.stdout===process.stdout&&t.stderr===process.stderr)return null;let{AsyncLocalStorage:r}=Be("async_hooks");e=BK=new r;let o=process.stdout._write;process.stdout._write=function(n,u,A){let p=e.getStore();return typeof p>"u"?o.call(this,n,u,A):p.stdout.write(n,u,A)};let a=process.stderr._write;process.stderr._write=function(n,u,A){let p=e.getStore();return typeof p>"u"?a.call(this,n,u,A):p.stderr.write(n,u,A)}}return r=>e.run(t,r)}var uP,BK,PK=Et(()=>{uP=$e(Be("tty"),1)});var Iy,SK=Et(()=>{Vp();Iy=class extends nt{constructor(e){super(),this.contexts=e,this.commands=[]}static from(e,r){let o=new Iy(r);o.path=e.path;for(let a of e.options)switch(a.name){case"-c":o.commands.push(Number(a.value));break;case"-i":o.index=Number(a.value);break}return o}async execute(){let e=this.commands;if(typeof this.index<"u"&&this.index>=0&&this.index1){this.context.stdout.write(`Multiple commands match your selection: +`),this.context.stdout.write(` +`);let r=0;for(let o of this.commands)this.context.stdout.write(this.cli.usage(this.contexts[o].commandClass,{prefix:`${r++}. `.padStart(5)}));this.context.stdout.write(` +`),this.context.stdout.write(`Run again with -h= to see the longer details of any of those commands. +`)}}}});async function kK(...t){let{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:o,resolvedContext:a}=FK(t);return as.from(r,e).runExit(o,a)}async function QK(...t){let{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:o,resolvedContext:a}=FK(t);return as.from(r,e).run(o,a)}function FK(t){let e,r,o,a;switch(typeof process<"u"&&typeof process.argv<"u"&&(o=process.argv.slice(2)),t.length){case 1:r=t[0];break;case 2:t[0]&&t[0].prototype instanceof nt||Array.isArray(t[0])?(r=t[0],Array.isArray(t[1])?o=t[1]:a=t[1]):(e=t[0],r=t[1]);break;case 3:Array.isArray(t[2])?(e=t[0],r=t[1],o=t[2]):t[0]&&t[0].prototype instanceof nt||Array.isArray(t[0])?(r=t[0],o=t[1],a=t[2]):(e=t[0],r=t[1],a=t[2]);break;default:e=t[0],r=t[1],o=t[2],a=t[3];break}if(typeof o>"u")throw new Error("The argv parameter must be provided when running Clipanion outside of a Node context");return{resolvedOptions:e,resolvedCommandClasses:r,resolvedArgv:o,resolvedContext:a}}function bK(t){return t()}var xK,as,TK=Et(()=>{eP();cP();FR();PK();Vp();SK();xK=Symbol("clipanion/errorCommand");as=class{constructor({binaryLabel:e,binaryName:r="...",binaryVersion:o,enableCapture:a=!1,enableColors:n}={}){this.registrations=new Map,this.builder=new wy({binaryName:r}),this.binaryLabel=e,this.binaryName=r,this.binaryVersion=o,this.enableCapture=a,this.enableColors=n}static from(e,r={}){let o=new as(r),a=Array.isArray(e)?e:[e];for(let n of a)o.register(n);return o}register(e){var r;let o=new Map,a=new e;for(let p in a){let h=a[p];typeof h=="object"&&h!==null&&h[nt.isOption]&&o.set(p,h)}let n=this.builder.command(),u=n.cliIndex,A=(r=e.paths)!==null&&r!==void 0?r:a.paths;if(typeof A<"u")for(let p of A)n.addPath(p);this.registrations.set(e,{specs:o,builder:n,index:u});for(let[p,{definition:h}]of o.entries())h(n,p);n.setContext({commandClass:e})}process(e,r){let{input:o,context:a,partial:n}=typeof e=="object"&&Array.isArray(e)?{input:e,context:r}:e,{contexts:u,process:A}=this.builder.compile(),p=A(o,{partial:n}),h={...as.defaultContext,...a};switch(p.selectedIndex){case td:{let E=Iy.from(p,u);return E.context=h,E.tokens=p.tokens,E}default:{let{commandClass:E}=u[p.selectedIndex],I=this.registrations.get(E);if(typeof I>"u")throw new Error("Assertion failed: Expected the command class to have been registered.");let v=new E;v.context=h,v.tokens=p.tokens,v.path=p.path;try{for(let[b,{transformer:C}]of I.specs.entries())v[b]=C(I.builder,b,p,h);return v}catch(b){throw b[xK]=v,b}}break}}async run(e,r){var o,a;let n,u={...as.defaultContext,...r},A=(o=this.enableColors)!==null&&o!==void 0?o:u.colorDepth>1;if(!Array.isArray(e))n=e;else try{n=this.process(e,u)}catch(E){return u.stdout.write(this.error(E,{colored:A})),1}if(n.help)return u.stdout.write(this.usage(n,{colored:A,detailed:!0})),0;n.context=u,n.cli={binaryLabel:this.binaryLabel,binaryName:this.binaryName,binaryVersion:this.binaryVersion,enableCapture:this.enableCapture,enableColors:this.enableColors,definitions:()=>this.definitions(),definition:E=>this.definition(E),error:(E,I)=>this.error(E,I),format:E=>this.format(E),process:(E,I)=>this.process(E,{...u,...I}),run:(E,I)=>this.run(E,{...u,...I}),usage:(E,I)=>this.usage(E,I)};let p=this.enableCapture&&(a=DK(u))!==null&&a!==void 0?a:bK,h;try{h=await p(()=>n.validateAndExecute().catch(E=>n.catch(E).then(()=>0)))}catch(E){return u.stdout.write(this.error(E,{colored:A,command:n})),1}return h}async runExit(e,r){process.exitCode=await this.run(e,r)}definition(e,{colored:r=!1}={}){if(!e.usage)return null;let{usage:o}=this.getUsageByRegistration(e,{detailed:!1}),{usage:a,options:n}=this.getUsageByRegistration(e,{detailed:!0,inlineOptions:!1}),u=typeof e.usage.category<"u"?Do(e.usage.category,{format:this.format(r),paragraphs:!1}):void 0,A=typeof e.usage.description<"u"?Do(e.usage.description,{format:this.format(r),paragraphs:!1}):void 0,p=typeof e.usage.details<"u"?Do(e.usage.details,{format:this.format(r),paragraphs:!0}):void 0,h=typeof e.usage.examples<"u"?e.usage.examples.map(([E,I])=>[Do(E,{format:this.format(r),paragraphs:!1}),I.replace(/\$0/g,this.binaryName)]):void 0;return{path:o,usage:a,category:u,description:A,details:p,examples:h,options:n}}definitions({colored:e=!1}={}){let r=[];for(let o of this.registrations.keys()){let a=this.definition(o,{colored:e});!a||r.push(a)}return r}usage(e=null,{colored:r,detailed:o=!1,prefix:a="$ "}={}){var n;if(e===null){for(let p of this.registrations.keys()){let h=p.paths,E=typeof p.usage<"u";if(!h||h.length===0||h.length===1&&h[0].length===0||((n=h?.some(b=>b.length===0))!==null&&n!==void 0?n:!1))if(e){e=null;break}else e=p;else if(E){e=null;continue}}e&&(o=!0)}let u=e!==null&&e instanceof nt?e.constructor:e,A="";if(u)if(o){let{description:p="",details:h="",examples:E=[]}=u.usage||{};p!==""&&(A+=Do(p,{format:this.format(r),paragraphs:!1}).replace(/^./,b=>b.toUpperCase()),A+=` +`),(h!==""||E.length>0)&&(A+=`${this.format(r).header("Usage")} +`,A+=` +`);let{usage:I,options:v}=this.getUsageByRegistration(u,{inlineOptions:!1});if(A+=`${this.format(r).bold(a)}${I} +`,v.length>0){A+=` +`,A+=`${this.format(r).header("Options")} +`;let b=v.reduce((C,T)=>Math.max(C,T.definition.length),0);A+=` +`;for(let{definition:C,description:T}of v)A+=` ${this.format(r).bold(C.padEnd(b))} ${Do(T,{format:this.format(r),paragraphs:!1})}`}if(h!==""&&(A+=` +`,A+=`${this.format(r).header("Details")} +`,A+=` +`,A+=Do(h,{format:this.format(r),paragraphs:!0})),E.length>0){A+=` +`,A+=`${this.format(r).header("Examples")} +`;for(let[b,C]of E)A+=` +`,A+=Do(b,{format:this.format(r),paragraphs:!1}),A+=`${C.replace(/^/m,` ${this.format(r).bold(a)}`).replace(/\$0/g,this.binaryName)} +`}}else{let{usage:p}=this.getUsageByRegistration(u);A+=`${this.format(r).bold(a)}${p} +`}else{let p=new Map;for(let[v,{index:b}]of this.registrations.entries()){if(typeof v.usage>"u")continue;let C=typeof v.usage.category<"u"?Do(v.usage.category,{format:this.format(r),paragraphs:!1}):null,T=p.get(C);typeof T>"u"&&p.set(C,T=[]);let{usage:L}=this.getUsageByIndex(b);T.push({commandClass:v,usage:L})}let h=Array.from(p.keys()).sort((v,b)=>v===null?-1:b===null?1:v.localeCompare(b,"en",{usage:"sort",caseFirst:"upper"})),E=typeof this.binaryLabel<"u",I=typeof this.binaryVersion<"u";E||I?(E&&I?A+=`${this.format(r).header(`${this.binaryLabel} - ${this.binaryVersion}`)} + +`:E?A+=`${this.format(r).header(`${this.binaryLabel}`)} +`:A+=`${this.format(r).header(`${this.binaryVersion}`)} +`,A+=` ${this.format(r).bold(a)}${this.binaryName} +`):A+=`${this.format(r).bold(a)}${this.binaryName} +`;for(let v of h){let b=p.get(v).slice().sort((T,L)=>T.usage.localeCompare(L.usage,"en",{usage:"sort",caseFirst:"upper"})),C=v!==null?v.trim():"General commands";A+=` +`,A+=`${this.format(r).header(`${C}`)} +`;for(let{commandClass:T,usage:L}of b){let U=T.usage.description||"undocumented";A+=` +`,A+=` ${this.format(r).bold(L)} +`,A+=` ${Do(U,{format:this.format(r),paragraphs:!1})}`}}A+=` +`,A+=Do("You can also print more details about any of these commands by calling them with the `-h,--help` flag right after the command name.",{format:this.format(r),paragraphs:!0})}return A}error(e,r){var o,{colored:a,command:n=(o=e[xK])!==null&&o!==void 0?o:null}=r===void 0?{}:r;(!e||typeof e!="object"||!("stack"in e))&&(e=new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(e)})`));let u="",A=e.name.replace(/([a-z])([A-Z])/g,"$1 $2");A==="Error"&&(A="Internal Error"),u+=`${this.format(a).error(A)}: ${e.message} +`;let p=e.clipanion;return typeof p<"u"?p.type==="usage"&&(u+=` +`,u+=this.usage(n)):e.stack&&(u+=`${e.stack.replace(/^.*\n/,"")} +`),u}format(e){var r;return((r=e??this.enableColors)!==null&&r!==void 0?r:as.defaultContext.colorDepth>1)?fK:pK}getUsageByRegistration(e,r){let o=this.registrations.get(e);if(typeof o>"u")throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(o.index,r)}getUsageByIndex(e,r){return this.builder.getBuilderByIndex(e).usage(r)}};as.defaultContext={env:process.env,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:vK()}});var cI,RK=Et(()=>{Vp();cI=class extends nt{async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.definitions(),null,2)} +`)}};cI.paths=[["--clipanion=definitions"]]});var uI,NK=Et(()=>{Vp();uI=class extends nt{async execute(){this.context.stdout.write(this.cli.usage())}};uI.paths=[["-h"],["--help"]]});function AP(t={}){return Vo({definition(e,r){var o;e.addProxy({name:(o=t.name)!==null&&o!==void 0?o:r,required:t.required})},transformer(e,r,o){return o.positionals.map(({value:a})=>a)}})}var qR=Et(()=>{yf()});var AI,LK=Et(()=>{Vp();qR();AI=class extends nt{constructor(){super(...arguments),this.args=AP()}async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.process(this.args).tokens,null,2)} +`)}};AI.paths=[["--clipanion=tokens"]]});var fI,MK=Et(()=>{Vp();fI=class extends nt{async execute(){var e;this.context.stdout.write(`${(e=this.cli.binaryVersion)!==null&&e!==void 0?e:""} +`)}};fI.paths=[["-v"],["--version"]]});var GR={};Kt(GR,{DefinitionsCommand:()=>cI,HelpCommand:()=>uI,TokensCommand:()=>AI,VersionCommand:()=>fI});var OK=Et(()=>{RK();NK();LK();MK()});function UK(t,e,r){let[o,a]=qu(e,r??{}),{arity:n=1}=a,u=t.split(","),A=new Set(u);return Vo({definition(p){p.addOption({names:u,arity:n,hidden:a?.hidden,description:a?.description,required:a.required})},transformer(p,h,E){let I,v=typeof o<"u"?[...o]:void 0;for(let{name:b,value:C}of E.options)!A.has(b)||(I=b,v=v??[],v.push(C));return typeof v<"u"?rd(I??h,v,a.validator):v}})}var _K=Et(()=>{yf()});function HK(t,e,r){let[o,a]=qu(e,r??{}),n=t.split(","),u=new Set(n);return Vo({definition(A){A.addOption({names:n,allowBinding:!1,arity:0,hidden:a.hidden,description:a.description,required:a.required})},transformer(A,p,h){let E=o;for(let{name:I,value:v}of h.options)!u.has(I)||(E=v);return E}})}var jK=Et(()=>{yf()});function qK(t,e,r){let[o,a]=qu(e,r??{}),n=t.split(","),u=new Set(n);return Vo({definition(A){A.addOption({names:n,allowBinding:!1,arity:0,hidden:a.hidden,description:a.description,required:a.required})},transformer(A,p,h){let E=o;for(let{name:I,value:v}of h.options)!u.has(I)||(E??(E=0),v?E+=1:E=0);return E}})}var GK=Et(()=>{yf()});function YK(t={}){return Vo({definition(e,r){var o;e.addRest({name:(o=t.name)!==null&&o!==void 0?o:r,required:t.required})},transformer(e,r,o){let a=u=>{let A=o.positionals[u];return A.extra===el||A.extra===!1&&uu)}})}var WK=Et(()=>{cP();yf()});function rqe(t,e,r){let[o,a]=qu(e,r??{}),{arity:n=1}=a,u=t.split(","),A=new Set(u);return Vo({definition(p){p.addOption({names:u,arity:a.tolerateBoolean?0:n,hidden:a.hidden,description:a.description,required:a.required})},transformer(p,h,E,I){let v,b=o;typeof a.env<"u"&&I.env[a.env]&&(v=a.env,b=I.env[a.env]);for(let{name:C,value:T}of E.options)!A.has(C)||(v=C,b=T);return typeof b=="string"?rd(v??h,b,a.validator):b}})}function nqe(t={}){let{required:e=!0}=t;return Vo({definition(r,o){var a;r.addPositional({name:(a=t.name)!==null&&a!==void 0?a:o,required:t.required})},transformer(r,o,a){var n;for(let u=0;u{cP();yf()});var ge={};Kt(ge,{Array:()=>UK,Boolean:()=>HK,Counter:()=>qK,Proxy:()=>AP,Rest:()=>YK,String:()=>VK,applyValidator:()=>rd,cleanValidationError:()=>nP,formatError:()=>nI,isOptionSymbol:()=>rI,makeCommandOption:()=>Vo,rerouteArguments:()=>qu});var JK=Et(()=>{yf();qR();_K();jK();GK();WK();KK()});var pI={};Kt(pI,{Builtins:()=>GR,Cli:()=>as,Command:()=>nt,Option:()=>ge,UsageError:()=>it,formatMarkdownish:()=>Do,run:()=>QK,runExit:()=>kK});var qt=Et(()=>{rP();FR();Vp();TK();OK();JK()});var zK=_((xkt,iqe)=>{iqe.exports={name:"dotenv",version:"16.3.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard","lint-readme":"standard-markdown",pretest:"npm run lint && npm run dts-check",test:"tap tests/*.js --100 -Rspec",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://github.com/motdotla/dotenv?sponsor=1",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@definitelytyped/dtslint":"^0.0.133","@types/node":"^18.11.3",decache:"^4.6.1",sinon:"^14.0.1",standard:"^17.0.0","standard-markdown":"^7.1.0","standard-version":"^9.5.0",tap:"^16.3.0",tar:"^6.1.11",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var eJ=_((bkt,Ef)=>{var XK=Be("fs"),WR=Be("path"),sqe=Be("os"),oqe=Be("crypto"),aqe=zK(),VR=aqe.version,lqe=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function cqe(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,` +`);let o;for(;(o=lqe.exec(r))!=null;){let a=o[1],n=o[2]||"";n=n.trim();let u=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),u==='"'&&(n=n.replace(/\\n/g,` +`),n=n.replace(/\\r/g,"\r")),e[a]=n}return e}function uqe(t){let e=$K(t),r=xs.configDotenv({path:e});if(!r.parsed)throw new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);let o=ZK(t).split(","),a=o.length,n;for(let u=0;u=a)throw A}return xs.parse(n)}function Aqe(t){console.log(`[dotenv@${VR}][INFO] ${t}`)}function fqe(t){console.log(`[dotenv@${VR}][WARN] ${t}`)}function YR(t){console.log(`[dotenv@${VR}][DEBUG] ${t}`)}function ZK(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function pqe(t,e){let r;try{r=new URL(e)}catch(A){throw A.code==="ERR_INVALID_URL"?new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development"):A}let o=r.password;if(!o)throw new Error("INVALID_DOTENV_KEY: Missing key part");let a=r.searchParams.get("environment");if(!a)throw new Error("INVALID_DOTENV_KEY: Missing environment part");let n=`DOTENV_VAULT_${a.toUpperCase()}`,u=t.parsed[n];if(!u)throw new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${n} in your .env.vault file.`);return{ciphertext:u,key:o}}function $K(t){let e=WR.resolve(process.cwd(),".env");return t&&t.path&&t.path.length>0&&(e=t.path),e.endsWith(".vault")?e:`${e}.vault`}function hqe(t){return t[0]==="~"?WR.join(sqe.homedir(),t.slice(1)):t}function gqe(t){Aqe("Loading env from encrypted .env.vault");let e=xs._parseVault(t),r=process.env;return t&&t.processEnv!=null&&(r=t.processEnv),xs.populate(r,e,t),{parsed:e}}function dqe(t){let e=WR.resolve(process.cwd(),".env"),r="utf8",o=Boolean(t&&t.debug);t&&(t.path!=null&&(e=hqe(t.path)),t.encoding!=null&&(r=t.encoding));try{let a=xs.parse(XK.readFileSync(e,{encoding:r})),n=process.env;return t&&t.processEnv!=null&&(n=t.processEnv),xs.populate(n,a,t),{parsed:a}}catch(a){return o&&YR(`Failed to load ${e} ${a.message}`),{error:a}}}function mqe(t){let e=$K(t);return ZK(t).length===0?xs.configDotenv(t):XK.existsSync(e)?xs._configVault(t):(fqe(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),xs.configDotenv(t))}function yqe(t,e){let r=Buffer.from(e.slice(-64),"hex"),o=Buffer.from(t,"base64"),a=o.slice(0,12),n=o.slice(-16);o=o.slice(12,-16);try{let u=oqe.createDecipheriv("aes-256-gcm",r,a);return u.setAuthTag(n),`${u.update(o)}${u.final()}`}catch(u){let A=u instanceof RangeError,p=u.message==="Invalid key length",h=u.message==="Unsupported state or unable to authenticate data";if(A||p){let E="INVALID_DOTENV_KEY: It must be 64 characters long (or more)";throw new Error(E)}else if(h){let E="DECRYPTION_FAILED: Please check your DOTENV_KEY";throw new Error(E)}else throw console.error("Error: ",u.code),console.error("Error: ",u.message),u}}function Eqe(t,e,r={}){let o=Boolean(r&&r.debug),a=Boolean(r&&r.override);if(typeof e!="object")throw new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");for(let n of Object.keys(e))Object.prototype.hasOwnProperty.call(t,n)?(a===!0&&(t[n]=e[n]),o&&YR(a===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):t[n]=e[n]}var xs={configDotenv:dqe,_configVault:gqe,_parseVault:uqe,config:mqe,decrypt:yqe,parse:cqe,populate:Eqe};Ef.exports.configDotenv=xs.configDotenv;Ef.exports._configVault=xs._configVault;Ef.exports._parseVault=xs._parseVault;Ef.exports.config=xs.config;Ef.exports.decrypt=xs.decrypt;Ef.exports.parse=xs.parse;Ef.exports.populate=xs.populate;Ef.exports=xs});var rJ=_((kkt,tJ)=>{"use strict";tJ.exports=(t,...e)=>new Promise(r=>{r(t(...e))})});var nd=_((Qkt,KR)=>{"use strict";var Cqe=rJ(),nJ=t=>{if(t<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=[],r=0,o=()=>{r--,e.length>0&&e.shift()()},a=(A,p,...h)=>{r++;let E=Cqe(A,...h);p(E),E.then(o,o)},n=(A,p,...h)=>{rnew Promise(h=>n(A,h,...p));return Object.defineProperties(u,{activeCount:{get:()=>r},pendingCount:{get:()=>e.length}}),u};KR.exports=nJ;KR.exports.default=nJ});function Wu(t){return`YN${t.toString(10).padStart(4,"0")}`}function fP(t){let e=Number(t.slice(2));if(typeof wr[e]>"u")throw new Error(`Unknown message name: "${t}"`);return e}var wr,pP=Et(()=>{wr=(Me=>(Me[Me.UNNAMED=0]="UNNAMED",Me[Me.EXCEPTION=1]="EXCEPTION",Me[Me.MISSING_PEER_DEPENDENCY=2]="MISSING_PEER_DEPENDENCY",Me[Me.CYCLIC_DEPENDENCIES=3]="CYCLIC_DEPENDENCIES",Me[Me.DISABLED_BUILD_SCRIPTS=4]="DISABLED_BUILD_SCRIPTS",Me[Me.BUILD_DISABLED=5]="BUILD_DISABLED",Me[Me.SOFT_LINK_BUILD=6]="SOFT_LINK_BUILD",Me[Me.MUST_BUILD=7]="MUST_BUILD",Me[Me.MUST_REBUILD=8]="MUST_REBUILD",Me[Me.BUILD_FAILED=9]="BUILD_FAILED",Me[Me.RESOLVER_NOT_FOUND=10]="RESOLVER_NOT_FOUND",Me[Me.FETCHER_NOT_FOUND=11]="FETCHER_NOT_FOUND",Me[Me.LINKER_NOT_FOUND=12]="LINKER_NOT_FOUND",Me[Me.FETCH_NOT_CACHED=13]="FETCH_NOT_CACHED",Me[Me.YARN_IMPORT_FAILED=14]="YARN_IMPORT_FAILED",Me[Me.REMOTE_INVALID=15]="REMOTE_INVALID",Me[Me.REMOTE_NOT_FOUND=16]="REMOTE_NOT_FOUND",Me[Me.RESOLUTION_PACK=17]="RESOLUTION_PACK",Me[Me.CACHE_CHECKSUM_MISMATCH=18]="CACHE_CHECKSUM_MISMATCH",Me[Me.UNUSED_CACHE_ENTRY=19]="UNUSED_CACHE_ENTRY",Me[Me.MISSING_LOCKFILE_ENTRY=20]="MISSING_LOCKFILE_ENTRY",Me[Me.WORKSPACE_NOT_FOUND=21]="WORKSPACE_NOT_FOUND",Me[Me.TOO_MANY_MATCHING_WORKSPACES=22]="TOO_MANY_MATCHING_WORKSPACES",Me[Me.CONSTRAINTS_MISSING_DEPENDENCY=23]="CONSTRAINTS_MISSING_DEPENDENCY",Me[Me.CONSTRAINTS_INCOMPATIBLE_DEPENDENCY=24]="CONSTRAINTS_INCOMPATIBLE_DEPENDENCY",Me[Me.CONSTRAINTS_EXTRANEOUS_DEPENDENCY=25]="CONSTRAINTS_EXTRANEOUS_DEPENDENCY",Me[Me.CONSTRAINTS_INVALID_DEPENDENCY=26]="CONSTRAINTS_INVALID_DEPENDENCY",Me[Me.CANT_SUGGEST_RESOLUTIONS=27]="CANT_SUGGEST_RESOLUTIONS",Me[Me.FROZEN_LOCKFILE_EXCEPTION=28]="FROZEN_LOCKFILE_EXCEPTION",Me[Me.CROSS_DRIVE_VIRTUAL_LOCAL=29]="CROSS_DRIVE_VIRTUAL_LOCAL",Me[Me.FETCH_FAILED=30]="FETCH_FAILED",Me[Me.DANGEROUS_NODE_MODULES=31]="DANGEROUS_NODE_MODULES",Me[Me.NODE_GYP_INJECTED=32]="NODE_GYP_INJECTED",Me[Me.AUTHENTICATION_NOT_FOUND=33]="AUTHENTICATION_NOT_FOUND",Me[Me.INVALID_CONFIGURATION_KEY=34]="INVALID_CONFIGURATION_KEY",Me[Me.NETWORK_ERROR=35]="NETWORK_ERROR",Me[Me.LIFECYCLE_SCRIPT=36]="LIFECYCLE_SCRIPT",Me[Me.CONSTRAINTS_MISSING_FIELD=37]="CONSTRAINTS_MISSING_FIELD",Me[Me.CONSTRAINTS_INCOMPATIBLE_FIELD=38]="CONSTRAINTS_INCOMPATIBLE_FIELD",Me[Me.CONSTRAINTS_EXTRANEOUS_FIELD=39]="CONSTRAINTS_EXTRANEOUS_FIELD",Me[Me.CONSTRAINTS_INVALID_FIELD=40]="CONSTRAINTS_INVALID_FIELD",Me[Me.AUTHENTICATION_INVALID=41]="AUTHENTICATION_INVALID",Me[Me.PROLOG_UNKNOWN_ERROR=42]="PROLOG_UNKNOWN_ERROR",Me[Me.PROLOG_SYNTAX_ERROR=43]="PROLOG_SYNTAX_ERROR",Me[Me.PROLOG_EXISTENCE_ERROR=44]="PROLOG_EXISTENCE_ERROR",Me[Me.STACK_OVERFLOW_RESOLUTION=45]="STACK_OVERFLOW_RESOLUTION",Me[Me.AUTOMERGE_FAILED_TO_PARSE=46]="AUTOMERGE_FAILED_TO_PARSE",Me[Me.AUTOMERGE_IMMUTABLE=47]="AUTOMERGE_IMMUTABLE",Me[Me.AUTOMERGE_SUCCESS=48]="AUTOMERGE_SUCCESS",Me[Me.AUTOMERGE_REQUIRED=49]="AUTOMERGE_REQUIRED",Me[Me.DEPRECATED_CLI_SETTINGS=50]="DEPRECATED_CLI_SETTINGS",Me[Me.PLUGIN_NAME_NOT_FOUND=51]="PLUGIN_NAME_NOT_FOUND",Me[Me.INVALID_PLUGIN_REFERENCE=52]="INVALID_PLUGIN_REFERENCE",Me[Me.CONSTRAINTS_AMBIGUITY=53]="CONSTRAINTS_AMBIGUITY",Me[Me.CACHE_OUTSIDE_PROJECT=54]="CACHE_OUTSIDE_PROJECT",Me[Me.IMMUTABLE_INSTALL=55]="IMMUTABLE_INSTALL",Me[Me.IMMUTABLE_CACHE=56]="IMMUTABLE_CACHE",Me[Me.INVALID_MANIFEST=57]="INVALID_MANIFEST",Me[Me.PACKAGE_PREPARATION_FAILED=58]="PACKAGE_PREPARATION_FAILED",Me[Me.INVALID_RANGE_PEER_DEPENDENCY=59]="INVALID_RANGE_PEER_DEPENDENCY",Me[Me.INCOMPATIBLE_PEER_DEPENDENCY=60]="INCOMPATIBLE_PEER_DEPENDENCY",Me[Me.DEPRECATED_PACKAGE=61]="DEPRECATED_PACKAGE",Me[Me.INCOMPATIBLE_OS=62]="INCOMPATIBLE_OS",Me[Me.INCOMPATIBLE_CPU=63]="INCOMPATIBLE_CPU",Me[Me.FROZEN_ARTIFACT_EXCEPTION=64]="FROZEN_ARTIFACT_EXCEPTION",Me[Me.TELEMETRY_NOTICE=65]="TELEMETRY_NOTICE",Me[Me.PATCH_HUNK_FAILED=66]="PATCH_HUNK_FAILED",Me[Me.INVALID_CONFIGURATION_VALUE=67]="INVALID_CONFIGURATION_VALUE",Me[Me.UNUSED_PACKAGE_EXTENSION=68]="UNUSED_PACKAGE_EXTENSION",Me[Me.REDUNDANT_PACKAGE_EXTENSION=69]="REDUNDANT_PACKAGE_EXTENSION",Me[Me.AUTO_NM_SUCCESS=70]="AUTO_NM_SUCCESS",Me[Me.NM_CANT_INSTALL_EXTERNAL_SOFT_LINK=71]="NM_CANT_INSTALL_EXTERNAL_SOFT_LINK",Me[Me.NM_PRESERVE_SYMLINKS_REQUIRED=72]="NM_PRESERVE_SYMLINKS_REQUIRED",Me[Me.UPDATE_LOCKFILE_ONLY_SKIP_LINK=73]="UPDATE_LOCKFILE_ONLY_SKIP_LINK",Me[Me.NM_HARDLINKS_MODE_DOWNGRADED=74]="NM_HARDLINKS_MODE_DOWNGRADED",Me[Me.PROLOG_INSTANTIATION_ERROR=75]="PROLOG_INSTANTIATION_ERROR",Me[Me.INCOMPATIBLE_ARCHITECTURE=76]="INCOMPATIBLE_ARCHITECTURE",Me[Me.GHOST_ARCHITECTURE=77]="GHOST_ARCHITECTURE",Me[Me.RESOLUTION_MISMATCH=78]="RESOLUTION_MISMATCH",Me[Me.PROLOG_LIMIT_EXCEEDED=79]="PROLOG_LIMIT_EXCEEDED",Me[Me.NETWORK_DISABLED=80]="NETWORK_DISABLED",Me[Me.NETWORK_UNSAFE_HTTP=81]="NETWORK_UNSAFE_HTTP",Me[Me.RESOLUTION_FAILED=82]="RESOLUTION_FAILED",Me[Me.AUTOMERGE_GIT_ERROR=83]="AUTOMERGE_GIT_ERROR",Me[Me.CONSTRAINTS_CHECK_FAILED=84]="CONSTRAINTS_CHECK_FAILED",Me[Me.UPDATED_RESOLUTION_RECORD=85]="UPDATED_RESOLUTION_RECORD",Me[Me.EXPLAIN_PEER_DEPENDENCIES_CTA=86]="EXPLAIN_PEER_DEPENDENCIES_CTA",Me[Me.MIGRATION_SUCCESS=87]="MIGRATION_SUCCESS",Me[Me.VERSION_NOTICE=88]="VERSION_NOTICE",Me[Me.TIPS_NOTICE=89]="TIPS_NOTICE",Me[Me.OFFLINE_MODE_ENABLED=90]="OFFLINE_MODE_ENABLED",Me))(wr||{})});var hI=_((Tkt,iJ)=>{var wqe="2.0.0",Iqe=Number.MAX_SAFE_INTEGER||9007199254740991,Bqe=16,vqe=256-6,Dqe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];iJ.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Bqe,MAX_SAFE_BUILD_LENGTH:vqe,MAX_SAFE_INTEGER:Iqe,RELEASE_TYPES:Dqe,SEMVER_SPEC_VERSION:wqe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var gI=_((Rkt,sJ)=>{var Pqe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};sJ.exports=Pqe});var By=_((Cf,oJ)=>{var{MAX_SAFE_COMPONENT_LENGTH:JR,MAX_SAFE_BUILD_LENGTH:Sqe,MAX_LENGTH:xqe}=hI(),bqe=gI();Cf=oJ.exports={};var kqe=Cf.re=[],Qqe=Cf.safeRe=[],lr=Cf.src=[],cr=Cf.t={},Fqe=0,zR="[a-zA-Z0-9-]",Tqe=[["\\s",1],["\\d",xqe],[zR,Sqe]],Rqe=t=>{for(let[e,r]of Tqe)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Jr=(t,e,r)=>{let o=Rqe(e),a=Fqe++;bqe(t,a,e),cr[t]=a,lr[a]=e,kqe[a]=new RegExp(e,r?"g":void 0),Qqe[a]=new RegExp(o,r?"g":void 0)};Jr("NUMERICIDENTIFIER","0|[1-9]\\d*");Jr("NUMERICIDENTIFIERLOOSE","\\d+");Jr("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${zR}*`);Jr("MAINVERSION",`(${lr[cr.NUMERICIDENTIFIER]})\\.(${lr[cr.NUMERICIDENTIFIER]})\\.(${lr[cr.NUMERICIDENTIFIER]})`);Jr("MAINVERSIONLOOSE",`(${lr[cr.NUMERICIDENTIFIERLOOSE]})\\.(${lr[cr.NUMERICIDENTIFIERLOOSE]})\\.(${lr[cr.NUMERICIDENTIFIERLOOSE]})`);Jr("PRERELEASEIDENTIFIER",`(?:${lr[cr.NUMERICIDENTIFIER]}|${lr[cr.NONNUMERICIDENTIFIER]})`);Jr("PRERELEASEIDENTIFIERLOOSE",`(?:${lr[cr.NUMERICIDENTIFIERLOOSE]}|${lr[cr.NONNUMERICIDENTIFIER]})`);Jr("PRERELEASE",`(?:-(${lr[cr.PRERELEASEIDENTIFIER]}(?:\\.${lr[cr.PRERELEASEIDENTIFIER]})*))`);Jr("PRERELEASELOOSE",`(?:-?(${lr[cr.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${lr[cr.PRERELEASEIDENTIFIERLOOSE]})*))`);Jr("BUILDIDENTIFIER",`${zR}+`);Jr("BUILD",`(?:\\+(${lr[cr.BUILDIDENTIFIER]}(?:\\.${lr[cr.BUILDIDENTIFIER]})*))`);Jr("FULLPLAIN",`v?${lr[cr.MAINVERSION]}${lr[cr.PRERELEASE]}?${lr[cr.BUILD]}?`);Jr("FULL",`^${lr[cr.FULLPLAIN]}$`);Jr("LOOSEPLAIN",`[v=\\s]*${lr[cr.MAINVERSIONLOOSE]}${lr[cr.PRERELEASELOOSE]}?${lr[cr.BUILD]}?`);Jr("LOOSE",`^${lr[cr.LOOSEPLAIN]}$`);Jr("GTLT","((?:<|>)?=?)");Jr("XRANGEIDENTIFIERLOOSE",`${lr[cr.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Jr("XRANGEIDENTIFIER",`${lr[cr.NUMERICIDENTIFIER]}|x|X|\\*`);Jr("XRANGEPLAIN",`[v=\\s]*(${lr[cr.XRANGEIDENTIFIER]})(?:\\.(${lr[cr.XRANGEIDENTIFIER]})(?:\\.(${lr[cr.XRANGEIDENTIFIER]})(?:${lr[cr.PRERELEASE]})?${lr[cr.BUILD]}?)?)?`);Jr("XRANGEPLAINLOOSE",`[v=\\s]*(${lr[cr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${lr[cr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${lr[cr.XRANGEIDENTIFIERLOOSE]})(?:${lr[cr.PRERELEASELOOSE]})?${lr[cr.BUILD]}?)?)?`);Jr("XRANGE",`^${lr[cr.GTLT]}\\s*${lr[cr.XRANGEPLAIN]}$`);Jr("XRANGELOOSE",`^${lr[cr.GTLT]}\\s*${lr[cr.XRANGEPLAINLOOSE]}$`);Jr("COERCE",`(^|[^\\d])(\\d{1,${JR}})(?:\\.(\\d{1,${JR}}))?(?:\\.(\\d{1,${JR}}))?(?:$|[^\\d])`);Jr("COERCERTL",lr[cr.COERCE],!0);Jr("LONETILDE","(?:~>?)");Jr("TILDETRIM",`(\\s*)${lr[cr.LONETILDE]}\\s+`,!0);Cf.tildeTrimReplace="$1~";Jr("TILDE",`^${lr[cr.LONETILDE]}${lr[cr.XRANGEPLAIN]}$`);Jr("TILDELOOSE",`^${lr[cr.LONETILDE]}${lr[cr.XRANGEPLAINLOOSE]}$`);Jr("LONECARET","(?:\\^)");Jr("CARETTRIM",`(\\s*)${lr[cr.LONECARET]}\\s+`,!0);Cf.caretTrimReplace="$1^";Jr("CARET",`^${lr[cr.LONECARET]}${lr[cr.XRANGEPLAIN]}$`);Jr("CARETLOOSE",`^${lr[cr.LONECARET]}${lr[cr.XRANGEPLAINLOOSE]}$`);Jr("COMPARATORLOOSE",`^${lr[cr.GTLT]}\\s*(${lr[cr.LOOSEPLAIN]})$|^$`);Jr("COMPARATOR",`^${lr[cr.GTLT]}\\s*(${lr[cr.FULLPLAIN]})$|^$`);Jr("COMPARATORTRIM",`(\\s*)${lr[cr.GTLT]}\\s*(${lr[cr.LOOSEPLAIN]}|${lr[cr.XRANGEPLAIN]})`,!0);Cf.comparatorTrimReplace="$1$2$3";Jr("HYPHENRANGE",`^\\s*(${lr[cr.XRANGEPLAIN]})\\s+-\\s+(${lr[cr.XRANGEPLAIN]})\\s*$`);Jr("HYPHENRANGELOOSE",`^\\s*(${lr[cr.XRANGEPLAINLOOSE]})\\s+-\\s+(${lr[cr.XRANGEPLAINLOOSE]})\\s*$`);Jr("STAR","(<|>)?=?\\s*\\*");Jr("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Jr("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var hP=_((Nkt,aJ)=>{var Nqe=Object.freeze({loose:!0}),Lqe=Object.freeze({}),Mqe=t=>t?typeof t!="object"?Nqe:t:Lqe;aJ.exports=Mqe});var XR=_((Lkt,uJ)=>{var lJ=/^[0-9]+$/,cJ=(t,e)=>{let r=lJ.test(t),o=lJ.test(e);return r&&o&&(t=+t,e=+e),t===e?0:r&&!o?-1:o&&!r?1:tcJ(e,t);uJ.exports={compareIdentifiers:cJ,rcompareIdentifiers:Oqe}});var Po=_((Mkt,hJ)=>{var gP=gI(),{MAX_LENGTH:AJ,MAX_SAFE_INTEGER:dP}=hI(),{safeRe:fJ,t:pJ}=By(),Uqe=hP(),{compareIdentifiers:vy}=XR(),tl=class{constructor(e,r){if(r=Uqe(r),e instanceof tl){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>AJ)throw new TypeError(`version is longer than ${AJ} characters`);gP("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let o=e.trim().match(r.loose?fJ[pJ.LOOSE]:fJ[pJ.FULL]);if(!o)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+o[1],this.minor=+o[2],this.patch=+o[3],this.major>dP||this.major<0)throw new TypeError("Invalid major version");if(this.minor>dP||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>dP||this.patch<0)throw new TypeError("Invalid patch version");o[4]?this.prerelease=o[4].split(".").map(a=>{if(/^[0-9]+$/.test(a)){let n=+a;if(n>=0&&n=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);if(n===-1){if(r===this.prerelease.join(".")&&o===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(a)}}if(r){let n=[r,a];o===!1&&(n=[r]),vy(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};hJ.exports=tl});var id=_((Okt,dJ)=>{var gJ=Po(),_qe=(t,e,r=!1)=>{if(t instanceof gJ)return t;try{return new gJ(t,e)}catch(o){if(!r)return null;throw o}};dJ.exports=_qe});var yJ=_((Ukt,mJ)=>{var Hqe=id(),jqe=(t,e)=>{let r=Hqe(t,e);return r?r.version:null};mJ.exports=jqe});var CJ=_((_kt,EJ)=>{var qqe=id(),Gqe=(t,e)=>{let r=qqe(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};EJ.exports=Gqe});var BJ=_((Hkt,IJ)=>{var wJ=Po(),Yqe=(t,e,r,o,a)=>{typeof r=="string"&&(a=o,o=r,r=void 0);try{return new wJ(t instanceof wJ?t.version:t,r).inc(e,o,a).version}catch{return null}};IJ.exports=Yqe});var PJ=_((jkt,DJ)=>{var vJ=id(),Wqe=(t,e)=>{let r=vJ(t,null,!0),o=vJ(e,null,!0),a=r.compare(o);if(a===0)return null;let n=a>0,u=n?r:o,A=n?o:r,p=!!u.prerelease.length;if(!!A.prerelease.length&&!p)return!A.patch&&!A.minor?"major":u.patch?"patch":u.minor?"minor":"major";let E=p?"pre":"";return r.major!==o.major?E+"major":r.minor!==o.minor?E+"minor":r.patch!==o.patch?E+"patch":"prerelease"};DJ.exports=Wqe});var xJ=_((qkt,SJ)=>{var Vqe=Po(),Kqe=(t,e)=>new Vqe(t,e).major;SJ.exports=Kqe});var kJ=_((Gkt,bJ)=>{var Jqe=Po(),zqe=(t,e)=>new Jqe(t,e).minor;bJ.exports=zqe});var FJ=_((Ykt,QJ)=>{var Xqe=Po(),Zqe=(t,e)=>new Xqe(t,e).patch;QJ.exports=Zqe});var RJ=_((Wkt,TJ)=>{var $qe=id(),eGe=(t,e)=>{let r=$qe(t,e);return r&&r.prerelease.length?r.prerelease:null};TJ.exports=eGe});var Ll=_((Vkt,LJ)=>{var NJ=Po(),tGe=(t,e,r)=>new NJ(t,r).compare(new NJ(e,r));LJ.exports=tGe});var OJ=_((Kkt,MJ)=>{var rGe=Ll(),nGe=(t,e,r)=>rGe(e,t,r);MJ.exports=nGe});var _J=_((Jkt,UJ)=>{var iGe=Ll(),sGe=(t,e)=>iGe(t,e,!0);UJ.exports=sGe});var mP=_((zkt,jJ)=>{var HJ=Po(),oGe=(t,e,r)=>{let o=new HJ(t,r),a=new HJ(e,r);return o.compare(a)||o.compareBuild(a)};jJ.exports=oGe});var GJ=_((Xkt,qJ)=>{var aGe=mP(),lGe=(t,e)=>t.sort((r,o)=>aGe(r,o,e));qJ.exports=lGe});var WJ=_((Zkt,YJ)=>{var cGe=mP(),uGe=(t,e)=>t.sort((r,o)=>cGe(o,r,e));YJ.exports=uGe});var dI=_(($kt,VJ)=>{var AGe=Ll(),fGe=(t,e,r)=>AGe(t,e,r)>0;VJ.exports=fGe});var yP=_((eQt,KJ)=>{var pGe=Ll(),hGe=(t,e,r)=>pGe(t,e,r)<0;KJ.exports=hGe});var ZR=_((tQt,JJ)=>{var gGe=Ll(),dGe=(t,e,r)=>gGe(t,e,r)===0;JJ.exports=dGe});var $R=_((rQt,zJ)=>{var mGe=Ll(),yGe=(t,e,r)=>mGe(t,e,r)!==0;zJ.exports=yGe});var EP=_((nQt,XJ)=>{var EGe=Ll(),CGe=(t,e,r)=>EGe(t,e,r)>=0;XJ.exports=CGe});var CP=_((iQt,ZJ)=>{var wGe=Ll(),IGe=(t,e,r)=>wGe(t,e,r)<=0;ZJ.exports=IGe});var eN=_((sQt,$J)=>{var BGe=ZR(),vGe=$R(),DGe=dI(),PGe=EP(),SGe=yP(),xGe=CP(),bGe=(t,e,r,o)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return BGe(t,r,o);case"!=":return vGe(t,r,o);case">":return DGe(t,r,o);case">=":return PGe(t,r,o);case"<":return SGe(t,r,o);case"<=":return xGe(t,r,o);default:throw new TypeError(`Invalid operator: ${e}`)}};$J.exports=bGe});var tz=_((oQt,ez)=>{var kGe=Po(),QGe=id(),{safeRe:wP,t:IP}=By(),FGe=(t,e)=>{if(t instanceof kGe)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(wP[IP.COERCE]);else{let o;for(;(o=wP[IP.COERCERTL].exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||o.index+o[0].length!==r.index+r[0].length)&&(r=o),wP[IP.COERCERTL].lastIndex=o.index+o[1].length+o[2].length;wP[IP.COERCERTL].lastIndex=-1}return r===null?null:QGe(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,e)};ez.exports=FGe});var nz=_((aQt,rz)=>{"use strict";rz.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var BP=_((lQt,iz)=>{"use strict";iz.exports=Cn;Cn.Node=sd;Cn.create=Cn;function Cn(t){var e=this;if(e instanceof Cn||(e=new Cn),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(a){e.push(a)});else if(arguments.length>0)for(var r=0,o=arguments.length;r1)r=e;else if(this.head)o=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=0;o!==null;a++)r=t(r,o.value,a),o=o.next;return r};Cn.prototype.reduceReverse=function(t,e){var r,o=this.tail;if(arguments.length>1)r=e;else if(this.tail)o=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=this.length-1;o!==null;a--)r=t(r,o.value,a),o=o.prev;return r};Cn.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;r!==null;e++)t[e]=r.value,r=r.next;return t};Cn.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;r!==null;e++)t[e]=r.value,r=r.prev;return t};Cn.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new Cn;if(ethis.length&&(e=this.length);for(var o=0,a=this.head;a!==null&&othis.length&&(e=this.length);for(var o=this.length,a=this.tail;a!==null&&o>e;o--)a=a.prev;for(;a!==null&&o>t;o--,a=a.prev)r.push(a.value);return r};Cn.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var o=0,a=this.head;a!==null&&o{"use strict";var LGe=BP(),od=Symbol("max"),If=Symbol("length"),Dy=Symbol("lengthCalculator"),yI=Symbol("allowStale"),ad=Symbol("maxAge"),wf=Symbol("dispose"),sz=Symbol("noDisposeOnSet"),bs=Symbol("lruList"),Oc=Symbol("cache"),az=Symbol("updateAgeOnGet"),tN=()=>1,nN=class{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let r=this[od]=e.max||1/0,o=e.length||tN;if(this[Dy]=typeof o!="function"?tN:o,this[yI]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[ad]=e.maxAge||0,this[wf]=e.dispose,this[sz]=e.noDisposeOnSet||!1,this[az]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[od]=e||1/0,mI(this)}get max(){return this[od]}set allowStale(e){this[yI]=!!e}get allowStale(){return this[yI]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[ad]=e,mI(this)}get maxAge(){return this[ad]}set lengthCalculator(e){typeof e!="function"&&(e=tN),e!==this[Dy]&&(this[Dy]=e,this[If]=0,this[bs].forEach(r=>{r.length=this[Dy](r.value,r.key),this[If]+=r.length})),mI(this)}get lengthCalculator(){return this[Dy]}get length(){return this[If]}get itemCount(){return this[bs].length}rforEach(e,r){r=r||this;for(let o=this[bs].tail;o!==null;){let a=o.prev;oz(this,e,o,r),o=a}}forEach(e,r){r=r||this;for(let o=this[bs].head;o!==null;){let a=o.next;oz(this,e,o,r),o=a}}keys(){return this[bs].toArray().map(e=>e.key)}values(){return this[bs].toArray().map(e=>e.value)}reset(){this[wf]&&this[bs]&&this[bs].length&&this[bs].forEach(e=>this[wf](e.key,e.value)),this[Oc]=new Map,this[bs]=new LGe,this[If]=0}dump(){return this[bs].map(e=>vP(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[bs]}set(e,r,o){if(o=o||this[ad],o&&typeof o!="number")throw new TypeError("maxAge must be a number");let a=o?Date.now():0,n=this[Dy](r,e);if(this[Oc].has(e)){if(n>this[od])return Py(this,this[Oc].get(e)),!1;let p=this[Oc].get(e).value;return this[wf]&&(this[sz]||this[wf](e,p.value)),p.now=a,p.maxAge=o,p.value=r,this[If]+=n-p.length,p.length=n,this.get(e),mI(this),!0}let u=new iN(e,r,n,a,o);return u.length>this[od]?(this[wf]&&this[wf](e,r),!1):(this[If]+=u.length,this[bs].unshift(u),this[Oc].set(e,this[bs].head),mI(this),!0)}has(e){if(!this[Oc].has(e))return!1;let r=this[Oc].get(e).value;return!vP(this,r)}get(e){return rN(this,e,!0)}peek(e){return rN(this,e,!1)}pop(){let e=this[bs].tail;return e?(Py(this,e),e.value):null}del(e){Py(this,this[Oc].get(e))}load(e){this.reset();let r=Date.now();for(let o=e.length-1;o>=0;o--){let a=e[o],n=a.e||0;if(n===0)this.set(a.k,a.v);else{let u=n-r;u>0&&this.set(a.k,a.v,u)}}}prune(){this[Oc].forEach((e,r)=>rN(this,r,!1))}},rN=(t,e,r)=>{let o=t[Oc].get(e);if(o){let a=o.value;if(vP(t,a)){if(Py(t,o),!t[yI])return}else r&&(t[az]&&(o.value.now=Date.now()),t[bs].unshiftNode(o));return a.value}},vP=(t,e)=>{if(!e||!e.maxAge&&!t[ad])return!1;let r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[ad]&&r>t[ad]},mI=t=>{if(t[If]>t[od])for(let e=t[bs].tail;t[If]>t[od]&&e!==null;){let r=e.prev;Py(t,e),e=r}},Py=(t,e)=>{if(e){let r=e.value;t[wf]&&t[wf](r.key,r.value),t[If]-=r.length,t[Oc].delete(r.key),t[bs].removeNode(e)}},iN=class{constructor(e,r,o,a,n){this.key=e,this.value=r,this.length=o,this.now=a,this.maxAge=n||0}},oz=(t,e,r,o)=>{let a=r.value;vP(t,a)&&(Py(t,r),t[yI]||(a=void 0)),a&&e.call(o,a.value,a.key,t)};lz.exports=nN});var Ml=_((uQt,pz)=>{var ld=class{constructor(e,r){if(r=OGe(r),e instanceof ld)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new ld(e.raw,r);if(e instanceof sN)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(o=>this.parseRange(o.trim())).filter(o=>o.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let o=this.set[0];if(this.set=this.set.filter(a=>!Az(a[0])),this.set.length===0)this.set=[o];else if(this.set.length>1){for(let a of this.set)if(a.length===1&&YGe(a[0])){this.set=[a];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let o=((this.options.includePrerelease&&qGe)|(this.options.loose&&GGe))+":"+e,a=uz.get(o);if(a)return a;let n=this.options.loose,u=n?Da[zo.HYPHENRANGELOOSE]:Da[zo.HYPHENRANGE];e=e.replace(u,t5e(this.options.includePrerelease)),ci("hyphen replace",e),e=e.replace(Da[zo.COMPARATORTRIM],_Ge),ci("comparator trim",e),e=e.replace(Da[zo.TILDETRIM],HGe),ci("tilde trim",e),e=e.replace(Da[zo.CARETTRIM],jGe),ci("caret trim",e);let A=e.split(" ").map(I=>WGe(I,this.options)).join(" ").split(/\s+/).map(I=>e5e(I,this.options));n&&(A=A.filter(I=>(ci("loose invalid filter",I,this.options),!!I.match(Da[zo.COMPARATORLOOSE])))),ci("range list",A);let p=new Map,h=A.map(I=>new sN(I,this.options));for(let I of h){if(Az(I))return[I];p.set(I.value,I)}p.size>1&&p.has("")&&p.delete("");let E=[...p.values()];return uz.set(o,E),E}intersects(e,r){if(!(e instanceof ld))throw new TypeError("a Range is required");return this.set.some(o=>fz(o,r)&&e.set.some(a=>fz(a,r)&&o.every(n=>a.every(u=>n.intersects(u,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new UGe(e,this.options)}catch{return!1}for(let r=0;rt.value==="<0.0.0-0",YGe=t=>t.value==="",fz=(t,e)=>{let r=!0,o=t.slice(),a=o.pop();for(;r&&o.length;)r=o.every(n=>a.intersects(n,e)),a=o.pop();return r},WGe=(t,e)=>(ci("comp",t,e),t=JGe(t,e),ci("caret",t),t=VGe(t,e),ci("tildes",t),t=XGe(t,e),ci("xrange",t),t=$Ge(t,e),ci("stars",t),t),Xo=t=>!t||t.toLowerCase()==="x"||t==="*",VGe=(t,e)=>t.trim().split(/\s+/).map(r=>KGe(r,e)).join(" "),KGe=(t,e)=>{let r=e.loose?Da[zo.TILDELOOSE]:Da[zo.TILDE];return t.replace(r,(o,a,n,u,A)=>{ci("tilde",t,o,a,n,u,A);let p;return Xo(a)?p="":Xo(n)?p=`>=${a}.0.0 <${+a+1}.0.0-0`:Xo(u)?p=`>=${a}.${n}.0 <${a}.${+n+1}.0-0`:A?(ci("replaceTilde pr",A),p=`>=${a}.${n}.${u}-${A} <${a}.${+n+1}.0-0`):p=`>=${a}.${n}.${u} <${a}.${+n+1}.0-0`,ci("tilde return",p),p})},JGe=(t,e)=>t.trim().split(/\s+/).map(r=>zGe(r,e)).join(" "),zGe=(t,e)=>{ci("caret",t,e);let r=e.loose?Da[zo.CARETLOOSE]:Da[zo.CARET],o=e.includePrerelease?"-0":"";return t.replace(r,(a,n,u,A,p)=>{ci("caret",t,a,n,u,A,p);let h;return Xo(n)?h="":Xo(u)?h=`>=${n}.0.0${o} <${+n+1}.0.0-0`:Xo(A)?n==="0"?h=`>=${n}.${u}.0${o} <${n}.${+u+1}.0-0`:h=`>=${n}.${u}.0${o} <${+n+1}.0.0-0`:p?(ci("replaceCaret pr",p),n==="0"?u==="0"?h=`>=${n}.${u}.${A}-${p} <${n}.${u}.${+A+1}-0`:h=`>=${n}.${u}.${A}-${p} <${n}.${+u+1}.0-0`:h=`>=${n}.${u}.${A}-${p} <${+n+1}.0.0-0`):(ci("no pr"),n==="0"?u==="0"?h=`>=${n}.${u}.${A}${o} <${n}.${u}.${+A+1}-0`:h=`>=${n}.${u}.${A}${o} <${n}.${+u+1}.0-0`:h=`>=${n}.${u}.${A} <${+n+1}.0.0-0`),ci("caret return",h),h})},XGe=(t,e)=>(ci("replaceXRanges",t,e),t.split(/\s+/).map(r=>ZGe(r,e)).join(" ")),ZGe=(t,e)=>{t=t.trim();let r=e.loose?Da[zo.XRANGELOOSE]:Da[zo.XRANGE];return t.replace(r,(o,a,n,u,A,p)=>{ci("xRange",t,o,a,n,u,A,p);let h=Xo(n),E=h||Xo(u),I=E||Xo(A),v=I;return a==="="&&v&&(a=""),p=e.includePrerelease?"-0":"",h?a===">"||a==="<"?o="<0.0.0-0":o="*":a&&v?(E&&(u=0),A=0,a===">"?(a=">=",E?(n=+n+1,u=0,A=0):(u=+u+1,A=0)):a==="<="&&(a="<",E?n=+n+1:u=+u+1),a==="<"&&(p="-0"),o=`${a+n}.${u}.${A}${p}`):E?o=`>=${n}.0.0${p} <${+n+1}.0.0-0`:I&&(o=`>=${n}.${u}.0${p} <${n}.${+u+1}.0-0`),ci("xRange return",o),o})},$Ge=(t,e)=>(ci("replaceStars",t,e),t.trim().replace(Da[zo.STAR],"")),e5e=(t,e)=>(ci("replaceGTE0",t,e),t.trim().replace(Da[e.includePrerelease?zo.GTE0PRE:zo.GTE0],"")),t5e=t=>(e,r,o,a,n,u,A,p,h,E,I,v,b)=>(Xo(o)?r="":Xo(a)?r=`>=${o}.0.0${t?"-0":""}`:Xo(n)?r=`>=${o}.${a}.0${t?"-0":""}`:u?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Xo(h)?p="":Xo(E)?p=`<${+h+1}.0.0-0`:Xo(I)?p=`<${h}.${+E+1}.0-0`:v?p=`<=${h}.${E}.${I}-${v}`:t?p=`<${h}.${E}.${+I+1}-0`:p=`<=${p}`,`${r} ${p}`.trim()),r5e=(t,e,r)=>{for(let o=0;o0){let a=t[o].semver;if(a.major===e.major&&a.minor===e.minor&&a.patch===e.patch)return!0}return!1}return!0}});var EI=_((AQt,Ez)=>{var CI=Symbol("SemVer ANY"),Sy=class{static get ANY(){return CI}constructor(e,r){if(r=hz(r),e instanceof Sy){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),aN("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===CI?this.value="":this.value=this.operator+this.semver.version,aN("comp",this)}parse(e){let r=this.options.loose?gz[dz.COMPARATORLOOSE]:gz[dz.COMPARATOR],o=e.match(r);if(!o)throw new TypeError(`Invalid comparator: ${e}`);this.operator=o[1]!==void 0?o[1]:"",this.operator==="="&&(this.operator=""),o[2]?this.semver=new mz(o[2],this.options.loose):this.semver=CI}toString(){return this.value}test(e){if(aN("Comparator.test",e,this.options.loose),this.semver===CI||e===CI)return!0;if(typeof e=="string")try{e=new mz(e,this.options)}catch{return!1}return oN(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof Sy))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new yz(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new yz(this.value,r).test(e.semver):(r=hz(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||oN(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||oN(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Ez.exports=Sy;var hz=hP(),{safeRe:gz,t:dz}=By(),oN=eN(),aN=gI(),mz=Po(),yz=Ml()});var wI=_((fQt,Cz)=>{var n5e=Ml(),i5e=(t,e,r)=>{try{e=new n5e(e,r)}catch{return!1}return e.test(t)};Cz.exports=i5e});var Iz=_((pQt,wz)=>{var s5e=Ml(),o5e=(t,e)=>new s5e(t,e).set.map(r=>r.map(o=>o.value).join(" ").trim().split(" "));wz.exports=o5e});var vz=_((hQt,Bz)=>{var a5e=Po(),l5e=Ml(),c5e=(t,e,r)=>{let o=null,a=null,n=null;try{n=new l5e(e,r)}catch{return null}return t.forEach(u=>{n.test(u)&&(!o||a.compare(u)===-1)&&(o=u,a=new a5e(o,r))}),o};Bz.exports=c5e});var Pz=_((gQt,Dz)=>{var u5e=Po(),A5e=Ml(),f5e=(t,e,r)=>{let o=null,a=null,n=null;try{n=new A5e(e,r)}catch{return null}return t.forEach(u=>{n.test(u)&&(!o||a.compare(u)===1)&&(o=u,a=new u5e(o,r))}),o};Dz.exports=f5e});var bz=_((dQt,xz)=>{var lN=Po(),p5e=Ml(),Sz=dI(),h5e=(t,e)=>{t=new p5e(t,e);let r=new lN("0.0.0");if(t.test(r)||(r=new lN("0.0.0-0"),t.test(r)))return r;r=null;for(let o=0;o{let A=new lN(u.semver.version);switch(u.operator){case">":A.prerelease.length===0?A.patch++:A.prerelease.push(0),A.raw=A.format();case"":case">=":(!n||Sz(A,n))&&(n=A);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${u.operator}`)}}),n&&(!r||Sz(r,n))&&(r=n)}return r&&t.test(r)?r:null};xz.exports=h5e});var Qz=_((mQt,kz)=>{var g5e=Ml(),d5e=(t,e)=>{try{return new g5e(t,e).range||"*"}catch{return null}};kz.exports=d5e});var DP=_((yQt,Nz)=>{var m5e=Po(),Rz=EI(),{ANY:y5e}=Rz,E5e=Ml(),C5e=wI(),Fz=dI(),Tz=yP(),w5e=CP(),I5e=EP(),B5e=(t,e,r,o)=>{t=new m5e(t,o),e=new E5e(e,o);let a,n,u,A,p;switch(r){case">":a=Fz,n=w5e,u=Tz,A=">",p=">=";break;case"<":a=Tz,n=I5e,u=Fz,A="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(C5e(t,e,o))return!1;for(let h=0;h{b.semver===y5e&&(b=new Rz(">=0.0.0")),I=I||b,v=v||b,a(b.semver,I.semver,o)?I=b:u(b.semver,v.semver,o)&&(v=b)}),I.operator===A||I.operator===p||(!v.operator||v.operator===A)&&n(t,v.semver))return!1;if(v.operator===p&&u(t,v.semver))return!1}return!0};Nz.exports=B5e});var Mz=_((EQt,Lz)=>{var v5e=DP(),D5e=(t,e,r)=>v5e(t,e,">",r);Lz.exports=D5e});var Uz=_((CQt,Oz)=>{var P5e=DP(),S5e=(t,e,r)=>P5e(t,e,"<",r);Oz.exports=S5e});var jz=_((wQt,Hz)=>{var _z=Ml(),x5e=(t,e,r)=>(t=new _z(t,r),e=new _z(e,r),t.intersects(e,r));Hz.exports=x5e});var Gz=_((IQt,qz)=>{var b5e=wI(),k5e=Ll();qz.exports=(t,e,r)=>{let o=[],a=null,n=null,u=t.sort((E,I)=>k5e(E,I,r));for(let E of u)b5e(E,e,r)?(n=E,a||(a=E)):(n&&o.push([a,n]),n=null,a=null);a&&o.push([a,null]);let A=[];for(let[E,I]of o)E===I?A.push(E):!I&&E===u[0]?A.push("*"):I?E===u[0]?A.push(`<=${I}`):A.push(`${E} - ${I}`):A.push(`>=${E}`);let p=A.join(" || "),h=typeof e.raw=="string"?e.raw:String(e);return p.length{var Yz=Ml(),uN=EI(),{ANY:cN}=uN,II=wI(),AN=Ll(),Q5e=(t,e,r={})=>{if(t===e)return!0;t=new Yz(t,r),e=new Yz(e,r);let o=!1;e:for(let a of t.set){for(let n of e.set){let u=T5e(a,n,r);if(o=o||u!==null,u)continue e}if(o)return!1}return!0},F5e=[new uN(">=0.0.0-0")],Wz=[new uN(">=0.0.0")],T5e=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===cN){if(e.length===1&&e[0].semver===cN)return!0;r.includePrerelease?t=F5e:t=Wz}if(e.length===1&&e[0].semver===cN){if(r.includePrerelease)return!0;e=Wz}let o=new Set,a,n;for(let b of t)b.operator===">"||b.operator===">="?a=Vz(a,b,r):b.operator==="<"||b.operator==="<="?n=Kz(n,b,r):o.add(b.semver);if(o.size>1)return null;let u;if(a&&n){if(u=AN(a.semver,n.semver,r),u>0)return null;if(u===0&&(a.operator!==">="||n.operator!=="<="))return null}for(let b of o){if(a&&!II(b,String(a),r)||n&&!II(b,String(n),r))return null;for(let C of e)if(!II(b,String(C),r))return!1;return!0}let A,p,h,E,I=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1,v=a&&!r.includePrerelease&&a.semver.prerelease.length?a.semver:!1;I&&I.prerelease.length===1&&n.operator==="<"&&I.prerelease[0]===0&&(I=!1);for(let b of e){if(E=E||b.operator===">"||b.operator===">=",h=h||b.operator==="<"||b.operator==="<=",a){if(v&&b.semver.prerelease&&b.semver.prerelease.length&&b.semver.major===v.major&&b.semver.minor===v.minor&&b.semver.patch===v.patch&&(v=!1),b.operator===">"||b.operator===">="){if(A=Vz(a,b,r),A===b&&A!==a)return!1}else if(a.operator===">="&&!II(a.semver,String(b),r))return!1}if(n){if(I&&b.semver.prerelease&&b.semver.prerelease.length&&b.semver.major===I.major&&b.semver.minor===I.minor&&b.semver.patch===I.patch&&(I=!1),b.operator==="<"||b.operator==="<="){if(p=Kz(n,b,r),p===b&&p!==n)return!1}else if(n.operator==="<="&&!II(n.semver,String(b),r))return!1}if(!b.operator&&(n||a)&&u!==0)return!1}return!(a&&h&&!n&&u!==0||n&&E&&!a&&u!==0||v||I)},Vz=(t,e,r)=>{if(!t)return e;let o=AN(t.semver,e.semver,r);return o>0?t:o<0||e.operator===">"&&t.operator===">="?e:t},Kz=(t,e,r)=>{if(!t)return e;let o=AN(t.semver,e.semver,r);return o<0?t:o>0||e.operator==="<"&&t.operator==="<="?e:t};Jz.exports=Q5e});var zn=_((vQt,$z)=>{var fN=By(),Xz=hI(),R5e=Po(),Zz=XR(),N5e=id(),L5e=yJ(),M5e=CJ(),O5e=BJ(),U5e=PJ(),_5e=xJ(),H5e=kJ(),j5e=FJ(),q5e=RJ(),G5e=Ll(),Y5e=OJ(),W5e=_J(),V5e=mP(),K5e=GJ(),J5e=WJ(),z5e=dI(),X5e=yP(),Z5e=ZR(),$5e=$R(),e9e=EP(),t9e=CP(),r9e=eN(),n9e=tz(),i9e=EI(),s9e=Ml(),o9e=wI(),a9e=Iz(),l9e=vz(),c9e=Pz(),u9e=bz(),A9e=Qz(),f9e=DP(),p9e=Mz(),h9e=Uz(),g9e=jz(),d9e=Gz(),m9e=zz();$z.exports={parse:N5e,valid:L5e,clean:M5e,inc:O5e,diff:U5e,major:_5e,minor:H5e,patch:j5e,prerelease:q5e,compare:G5e,rcompare:Y5e,compareLoose:W5e,compareBuild:V5e,sort:K5e,rsort:J5e,gt:z5e,lt:X5e,eq:Z5e,neq:$5e,gte:e9e,lte:t9e,cmp:r9e,coerce:n9e,Comparator:i9e,Range:s9e,satisfies:o9e,toComparators:a9e,maxSatisfying:l9e,minSatisfying:c9e,minVersion:u9e,validRange:A9e,outside:f9e,gtr:p9e,ltr:h9e,intersects:g9e,simplifyRange:d9e,subset:m9e,SemVer:R5e,re:fN.re,src:fN.src,tokens:fN.t,SEMVER_SPEC_VERSION:Xz.SEMVER_SPEC_VERSION,RELEASE_TYPES:Xz.RELEASE_TYPES,compareIdentifiers:Zz.compareIdentifiers,rcompareIdentifiers:Zz.rcompareIdentifiers}});var tX=_((DQt,eX)=>{"use strict";function y9e(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function cd(t,e,r,o){this.message=t,this.expected=e,this.found=r,this.location=o,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,cd)}y9e(cd,Error);cd.buildMessage=function(t,e){var r={literal:function(h){return'"'+a(h.text)+'"'},class:function(h){var E="",I;for(I=0;I0){for(I=1,v=1;I{switch(Ne[1]){case"|":return Se|Ne[3];case"&":return Se&Ne[3];case"^":return Se^Ne[3]}},Z)},v="!",b=Re("!",!1),C=function(Z){return!Z},T="(",L=Re("(",!1),U=")",J=Re(")",!1),te=function(Z){return Z},le=/^[^ \t\n\r()!|&\^]/,pe=Qe([" "," ",` +`,"\r","(",")","!","|","&","^"],!0,!1),Ae=function(Z){return e.queryPattern.test(Z)},ye=function(Z){return e.checkFn(Z)},ae=Te("whitespace"),we=/^[ \t\n\r]/,Pe=Qe([" "," ",` +`,"\r"],!1,!1),g=0,Ee=0,De=[{line:1,column:1}],ce=0,ne=[],ee=0,Ie;if("startRule"in e){if(!(e.startRule in o))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');a=o[e.startRule]}function ke(){return t.substring(Ee,g)}function ht(){return He(Ee,g)}function H(Z,ie){throw ie=ie!==void 0?ie:He(Ee,g),S([Te(Z)],t.substring(Ee,g),ie)}function lt(Z,ie){throw ie=ie!==void 0?ie:He(Ee,g),w(Z,ie)}function Re(Z,ie){return{type:"literal",text:Z,ignoreCase:ie}}function Qe(Z,ie,Se){return{type:"class",parts:Z,inverted:ie,ignoreCase:Se}}function be(){return{type:"any"}}function _e(){return{type:"end"}}function Te(Z){return{type:"other",description:Z}}function Je(Z){var ie=De[Z],Se;if(ie)return ie;for(Se=Z-1;!De[Se];)Se--;for(ie=De[Se],ie={line:ie.line,column:ie.column};Sece&&(ce=g,ne=[]),ne.push(Z))}function w(Z,ie){return new cd(Z,null,null,ie)}function S(Z,ie,Se){return new cd(cd.buildMessage(Z,ie),Z,ie,Se)}function y(){var Z,ie,Se,Ne,ot,dt,jt,$t;if(Z=g,ie=F(),ie!==r){for(Se=[],Ne=g,ot=X(),ot!==r?(t.charCodeAt(g)===124?(dt=n,g++):(dt=r,ee===0&&x(u)),dt===r&&(t.charCodeAt(g)===38?(dt=A,g++):(dt=r,ee===0&&x(p)),dt===r&&(t.charCodeAt(g)===94?(dt=h,g++):(dt=r,ee===0&&x(E)))),dt!==r?(jt=X(),jt!==r?($t=F(),$t!==r?(ot=[ot,dt,jt,$t],Ne=ot):(g=Ne,Ne=r)):(g=Ne,Ne=r)):(g=Ne,Ne=r)):(g=Ne,Ne=r);Ne!==r;)Se.push(Ne),Ne=g,ot=X(),ot!==r?(t.charCodeAt(g)===124?(dt=n,g++):(dt=r,ee===0&&x(u)),dt===r&&(t.charCodeAt(g)===38?(dt=A,g++):(dt=r,ee===0&&x(p)),dt===r&&(t.charCodeAt(g)===94?(dt=h,g++):(dt=r,ee===0&&x(E)))),dt!==r?(jt=X(),jt!==r?($t=F(),$t!==r?(ot=[ot,dt,jt,$t],Ne=ot):(g=Ne,Ne=r)):(g=Ne,Ne=r)):(g=Ne,Ne=r)):(g=Ne,Ne=r);Se!==r?(Ee=Z,ie=I(ie,Se),Z=ie):(g=Z,Z=r)}else g=Z,Z=r;return Z}function F(){var Z,ie,Se,Ne,ot,dt;return Z=g,t.charCodeAt(g)===33?(ie=v,g++):(ie=r,ee===0&&x(b)),ie!==r?(Se=F(),Se!==r?(Ee=Z,ie=C(Se),Z=ie):(g=Z,Z=r)):(g=Z,Z=r),Z===r&&(Z=g,t.charCodeAt(g)===40?(ie=T,g++):(ie=r,ee===0&&x(L)),ie!==r?(Se=X(),Se!==r?(Ne=y(),Ne!==r?(ot=X(),ot!==r?(t.charCodeAt(g)===41?(dt=U,g++):(dt=r,ee===0&&x(J)),dt!==r?(Ee=Z,ie=te(Ne),Z=ie):(g=Z,Z=r)):(g=Z,Z=r)):(g=Z,Z=r)):(g=Z,Z=r)):(g=Z,Z=r),Z===r&&(Z=z())),Z}function z(){var Z,ie,Se,Ne,ot;if(Z=g,ie=X(),ie!==r){if(Se=g,Ne=[],le.test(t.charAt(g))?(ot=t.charAt(g),g++):(ot=r,ee===0&&x(pe)),ot!==r)for(;ot!==r;)Ne.push(ot),le.test(t.charAt(g))?(ot=t.charAt(g),g++):(ot=r,ee===0&&x(pe));else Ne=r;Ne!==r?Se=t.substring(Se,g):Se=Ne,Se!==r?(Ee=g,Ne=Ae(Se),Ne?Ne=void 0:Ne=r,Ne!==r?(Ee=Z,ie=ye(Se),Z=ie):(g=Z,Z=r)):(g=Z,Z=r)}else g=Z,Z=r;return Z}function X(){var Z,ie;for(ee++,Z=[],we.test(t.charAt(g))?(ie=t.charAt(g),g++):(ie=r,ee===0&&x(Pe));ie!==r;)Z.push(ie),we.test(t.charAt(g))?(ie=t.charAt(g),g++):(ie=r,ee===0&&x(Pe));return ee--,Z===r&&(ie=r,ee===0&&x(ae)),Z}if(Ie=a(),Ie!==r&&g===t.length)return Ie;throw Ie!==r&&g{var{parse:C9e}=tX();PP.makeParser=(t=/[a-z]+/)=>(e,r)=>C9e(e,{queryPattern:t,checkFn:r});PP.parse=PP.makeParser()});var iX=_((SQt,nX)=>{"use strict";nX.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var pN=_((xQt,oX)=>{var BI=iX(),sX={};for(let t of Object.keys(BI))sX[BI[t]]=t;var Ar={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};oX.exports=Ar;for(let t of Object.keys(Ar)){if(!("channels"in Ar[t]))throw new Error("missing channels property: "+t);if(!("labels"in Ar[t]))throw new Error("missing channel labels property: "+t);if(Ar[t].labels.length!==Ar[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=Ar[t];delete Ar[t].channels,delete Ar[t].labels,Object.defineProperty(Ar[t],"channels",{value:e}),Object.defineProperty(Ar[t],"labels",{value:r})}Ar.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(e,r,o),n=Math.max(e,r,o),u=n-a,A,p;n===a?A=0:e===n?A=(r-o)/u:r===n?A=2+(o-e)/u:o===n&&(A=4+(e-r)/u),A=Math.min(A*60,360),A<0&&(A+=360);let h=(a+n)/2;return n===a?p=0:h<=.5?p=u/(n+a):p=u/(2-n-a),[A,p*100,h*100]};Ar.rgb.hsv=function(t){let e,r,o,a,n,u=t[0]/255,A=t[1]/255,p=t[2]/255,h=Math.max(u,A,p),E=h-Math.min(u,A,p),I=function(v){return(h-v)/6/E+1/2};return E===0?(a=0,n=0):(n=E/h,e=I(u),r=I(A),o=I(p),u===h?a=o-r:A===h?a=1/3+e-o:p===h&&(a=2/3+r-e),a<0?a+=1:a>1&&(a-=1)),[a*360,n*100,h*100]};Ar.rgb.hwb=function(t){let e=t[0],r=t[1],o=t[2],a=Ar.rgb.hsl(t)[0],n=1/255*Math.min(e,Math.min(r,o));return o=1-1/255*Math.max(e,Math.max(r,o)),[a,n*100,o*100]};Ar.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(1-e,1-r,1-o),n=(1-e-a)/(1-a)||0,u=(1-r-a)/(1-a)||0,A=(1-o-a)/(1-a)||0;return[n*100,u*100,A*100,a*100]};function w9e(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}Ar.rgb.keyword=function(t){let e=sX[t];if(e)return e;let r=1/0,o;for(let a of Object.keys(BI)){let n=BI[a],u=w9e(t,n);u.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,o=o>.04045?((o+.055)/1.055)**2.4:o/12.92;let a=e*.4124+r*.3576+o*.1805,n=e*.2126+r*.7152+o*.0722,u=e*.0193+r*.1192+o*.9505;return[a*100,n*100,u*100]};Ar.rgb.lab=function(t){let e=Ar.rgb.xyz(t),r=e[0],o=e[1],a=e[2];r/=95.047,o/=100,a/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,a=a>.008856?a**(1/3):7.787*a+16/116;let n=116*o-16,u=500*(r-o),A=200*(o-a);return[n,u,A]};Ar.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,o=t[2]/100,a,n,u;if(r===0)return u=o*255,[u,u,u];o<.5?a=o*(1+r):a=o+r-o*r;let A=2*o-a,p=[0,0,0];for(let h=0;h<3;h++)n=e+1/3*-(h-1),n<0&&n++,n>1&&n--,6*n<1?u=A+(a-A)*6*n:2*n<1?u=a:3*n<2?u=A+(a-A)*(2/3-n)*6:u=A,p[h]=u*255;return p};Ar.hsl.hsv=function(t){let e=t[0],r=t[1]/100,o=t[2]/100,a=r,n=Math.max(o,.01);o*=2,r*=o<=1?o:2-o,a*=n<=1?n:2-n;let u=(o+r)/2,A=o===0?2*a/(n+a):2*r/(o+r);return[e,A*100,u*100]};Ar.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,o=t[2]/100,a=Math.floor(e)%6,n=e-Math.floor(e),u=255*o*(1-r),A=255*o*(1-r*n),p=255*o*(1-r*(1-n));switch(o*=255,a){case 0:return[o,p,u];case 1:return[A,o,u];case 2:return[u,o,p];case 3:return[u,A,o];case 4:return[p,u,o];case 5:return[o,u,A]}};Ar.hsv.hsl=function(t){let e=t[0],r=t[1]/100,o=t[2]/100,a=Math.max(o,.01),n,u;u=(2-r)*o;let A=(2-r)*a;return n=r*a,n/=A<=1?A:2-A,n=n||0,u/=2,[e,n*100,u*100]};Ar.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,o=t[2]/100,a=r+o,n;a>1&&(r/=a,o/=a);let u=Math.floor(6*e),A=1-o;n=6*e-u,(u&1)!==0&&(n=1-n);let p=r+n*(A-r),h,E,I;switch(u){default:case 6:case 0:h=A,E=p,I=r;break;case 1:h=p,E=A,I=r;break;case 2:h=r,E=A,I=p;break;case 3:h=r,E=p,I=A;break;case 4:h=p,E=r,I=A;break;case 5:h=A,E=r,I=p;break}return[h*255,E*255,I*255]};Ar.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,o=t[2]/100,a=t[3]/100,n=1-Math.min(1,e*(1-a)+a),u=1-Math.min(1,r*(1-a)+a),A=1-Math.min(1,o*(1-a)+a);return[n*255,u*255,A*255]};Ar.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,o=t[2]/100,a,n,u;return a=e*3.2406+r*-1.5372+o*-.4986,n=e*-.9689+r*1.8758+o*.0415,u=e*.0557+r*-.204+o*1.057,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,n=n>.0031308?1.055*n**(1/2.4)-.055:n*12.92,u=u>.0031308?1.055*u**(1/2.4)-.055:u*12.92,a=Math.min(Math.max(0,a),1),n=Math.min(Math.max(0,n),1),u=Math.min(Math.max(0,u),1),[a*255,n*255,u*255]};Ar.xyz.lab=function(t){let e=t[0],r=t[1],o=t[2];e/=95.047,r/=100,o/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let a=116*r-16,n=500*(e-r),u=200*(r-o);return[a,n,u]};Ar.lab.xyz=function(t){let e=t[0],r=t[1],o=t[2],a,n,u;n=(e+16)/116,a=r/500+n,u=n-o/200;let A=n**3,p=a**3,h=u**3;return n=A>.008856?A:(n-16/116)/7.787,a=p>.008856?p:(a-16/116)/7.787,u=h>.008856?h:(u-16/116)/7.787,a*=95.047,n*=100,u*=108.883,[a,n,u]};Ar.lab.lch=function(t){let e=t[0],r=t[1],o=t[2],a;a=Math.atan2(o,r)*360/2/Math.PI,a<0&&(a+=360);let u=Math.sqrt(r*r+o*o);return[e,u,a]};Ar.lch.lab=function(t){let e=t[0],r=t[1],a=t[2]/360*2*Math.PI,n=r*Math.cos(a),u=r*Math.sin(a);return[e,n,u]};Ar.rgb.ansi16=function(t,e=null){let[r,o,a]=t,n=e===null?Ar.rgb.hsv(t)[2]:e;if(n=Math.round(n/50),n===0)return 30;let u=30+(Math.round(a/255)<<2|Math.round(o/255)<<1|Math.round(r/255));return n===2&&(u+=60),u};Ar.hsv.ansi16=function(t){return Ar.rgb.ansi16(Ar.hsv.rgb(t),t[2])};Ar.rgb.ansi256=function(t){let e=t[0],r=t[1],o=t[2];return e===r&&r===o?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(o/255*5)};Ar.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,o=(e&1)*r*255,a=(e>>1&1)*r*255,n=(e>>2&1)*r*255;return[o,a,n]};Ar.ansi256.rgb=function(t){if(t>=232){let n=(t-232)*10+8;return[n,n,n]}t-=16;let e,r=Math.floor(t/36)/5*255,o=Math.floor((e=t%36)/6)/5*255,a=e%6/5*255;return[r,o,a]};Ar.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};Ar.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(A=>A+A).join(""));let o=parseInt(r,16),a=o>>16&255,n=o>>8&255,u=o&255;return[a,n,u]};Ar.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.max(Math.max(e,r),o),n=Math.min(Math.min(e,r),o),u=a-n,A,p;return u<1?A=n/(1-u):A=0,u<=0?p=0:a===e?p=(r-o)/u%6:a===r?p=2+(o-e)/u:p=4+(e-r)/u,p/=6,p%=1,[p*360,u*100,A*100]};Ar.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,o=r<.5?2*e*r:2*e*(1-r),a=0;return o<1&&(a=(r-.5*o)/(1-o)),[t[0],o*100,a*100]};Ar.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,o=e*r,a=0;return o<1&&(a=(r-o)/(1-o)),[t[0],o*100,a*100]};Ar.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,o=t[2]/100;if(r===0)return[o*255,o*255,o*255];let a=[0,0,0],n=e%1*6,u=n%1,A=1-u,p=0;switch(Math.floor(n)){case 0:a[0]=1,a[1]=u,a[2]=0;break;case 1:a[0]=A,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=u;break;case 3:a[0]=0,a[1]=A,a[2]=1;break;case 4:a[0]=u,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=A}return p=(1-r)*o,[(r*a[0]+p)*255,(r*a[1]+p)*255,(r*a[2]+p)*255]};Ar.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,o=e+r*(1-e),a=0;return o>0&&(a=e/o),[t[0],a*100,o*100]};Ar.hcg.hsl=function(t){let e=t[1]/100,o=t[2]/100*(1-e)+.5*e,a=0;return o>0&&o<.5?a=e/(2*o):o>=.5&&o<1&&(a=e/(2*(1-o))),[t[0],a*100,o*100]};Ar.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,o=e+r*(1-e);return[t[0],(o-e)*100,(1-o)*100]};Ar.hwb.hcg=function(t){let e=t[1]/100,o=1-t[2]/100,a=o-e,n=0;return a<1&&(n=(o-a)/(1-a)),[t[0],a*100,n*100]};Ar.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};Ar.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};Ar.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};Ar.gray.hsl=function(t){return[0,0,t[0]]};Ar.gray.hsv=Ar.gray.hsl;Ar.gray.hwb=function(t){return[0,100,t[0]]};Ar.gray.cmyk=function(t){return[0,0,0,t[0]]};Ar.gray.lab=function(t){return[t[0],0,0]};Ar.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,o=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(o.length)+o};Ar.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var lX=_((bQt,aX)=>{var SP=pN();function I9e(){let t={},e=Object.keys(SP);for(let r=e.length,o=0;o{var hN=pN(),P9e=lX(),xy={},S9e=Object.keys(hN);function x9e(t){let e=function(...r){let o=r[0];return o==null?o:(o.length>1&&(r=o),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function b9e(t){let e=function(...r){let o=r[0];if(o==null)return o;o.length>1&&(r=o);let a=t(r);if(typeof a=="object")for(let n=a.length,u=0;u{xy[t]={},Object.defineProperty(xy[t],"channels",{value:hN[t].channels}),Object.defineProperty(xy[t],"labels",{value:hN[t].labels});let e=P9e(t);Object.keys(e).forEach(o=>{let a=e[o];xy[t][o]=b9e(a),xy[t][o].raw=x9e(a)})});cX.exports=xy});var vI=_((QQt,gX)=>{"use strict";var AX=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,fX=(t,e)=>(...r)=>{let o=t(...r);return`\x1B[${38+e};5;${o}m`},pX=(t,e)=>(...r)=>{let o=t(...r);return`\x1B[${38+e};2;${o[0]};${o[1]};${o[2]}m`},xP=t=>t,hX=(t,e,r)=>[t,e,r],by=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let o=r();return Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0}),o},enumerable:!0,configurable:!0})},gN,ky=(t,e,r,o)=>{gN===void 0&&(gN=uX());let a=o?10:0,n={};for(let[u,A]of Object.entries(gN)){let p=u==="ansi16"?"ansi":u;u===e?n[p]=t(r,a):typeof A=="object"&&(n[p]=t(A[e],a))}return n};function k9e(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,o]of Object.entries(e)){for(let[a,n]of Object.entries(o))e[a]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},o[a]=e[a],t.set(n[0],n[1]);Object.defineProperty(e,r,{value:o,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",by(e.color,"ansi",()=>ky(AX,"ansi16",xP,!1)),by(e.color,"ansi256",()=>ky(fX,"ansi256",xP,!1)),by(e.color,"ansi16m",()=>ky(pX,"rgb",hX,!1)),by(e.bgColor,"ansi",()=>ky(AX,"ansi16",xP,!0)),by(e.bgColor,"ansi256",()=>ky(fX,"ansi256",xP,!0)),by(e.bgColor,"ansi16m",()=>ky(pX,"rgb",hX,!0)),e}Object.defineProperty(gX,"exports",{enumerable:!0,get:k9e})});var mX=_((FQt,dX)=>{"use strict";dX.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",o=e.indexOf(r+t),a=e.indexOf("--");return o!==-1&&(a===-1||o{"use strict";var Q9e=Be("os"),yX=Be("tty"),Ol=mX(),{env:ls}=process,Kp;Ol("no-color")||Ol("no-colors")||Ol("color=false")||Ol("color=never")?Kp=0:(Ol("color")||Ol("colors")||Ol("color=true")||Ol("color=always"))&&(Kp=1);"FORCE_COLOR"in ls&&(ls.FORCE_COLOR==="true"?Kp=1:ls.FORCE_COLOR==="false"?Kp=0:Kp=ls.FORCE_COLOR.length===0?1:Math.min(parseInt(ls.FORCE_COLOR,10),3));function dN(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function mN(t,e){if(Kp===0)return 0;if(Ol("color=16m")||Ol("color=full")||Ol("color=truecolor"))return 3;if(Ol("color=256"))return 2;if(t&&!e&&Kp===void 0)return 0;let r=Kp||0;if(ls.TERM==="dumb")return r;if(process.platform==="win32"){let o=Q9e.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in ls)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(o=>o in ls)||ls.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in ls)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ls.TEAMCITY_VERSION)?1:0;if("GITHUB_ACTIONS"in ls)return 1;if(ls.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in ls){let o=parseInt((ls.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ls.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ls.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ls.TERM)||"COLORTERM"in ls?1:r}function F9e(t){let e=mN(t,t&&t.isTTY);return dN(e)}EX.exports={supportsColor:F9e,stdout:dN(mN(!0,yX.isatty(1))),stderr:dN(mN(!0,yX.isatty(2)))}});var wX=_((RQt,CX)=>{"use strict";var T9e=(t,e,r)=>{let o=t.indexOf(e);if(o===-1)return t;let a=e.length,n=0,u="";do u+=t.substr(n,o-n)+e+r,n=o+a,o=t.indexOf(e,n);while(o!==-1);return u+=t.substr(n),u},R9e=(t,e,r,o)=>{let a=0,n="";do{let u=t[o-1]==="\r";n+=t.substr(a,(u?o-1:o)-a)+e+(u?`\r +`:` +`)+r,a=o+1,o=t.indexOf(` +`,a)}while(o!==-1);return n+=t.substr(a),n};CX.exports={stringReplaceAll:T9e,stringEncaseCRLFWithFirstIndex:R9e}});var PX=_((NQt,DX)=>{"use strict";var N9e=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,IX=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,L9e=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,M9e=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,O9e=new Map([["n",` +`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function vX(t){let e=t[0]==="u",r=t[1]==="{";return e&&!r&&t.length===5||t[0]==="x"&&t.length===3?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):O9e.get(t)||t}function U9e(t,e){let r=[],o=e.trim().split(/\s*,\s*/g),a;for(let n of o){let u=Number(n);if(!Number.isNaN(u))r.push(u);else if(a=n.match(L9e))r.push(a[2].replace(M9e,(A,p,h)=>p?vX(p):h));else throw new Error(`Invalid Chalk template style argument: ${n} (in style '${t}')`)}return r}function _9e(t){IX.lastIndex=0;let e=[],r;for(;(r=IX.exec(t))!==null;){let o=r[1];if(r[2]){let a=U9e(o,r[2]);e.push([o].concat(a))}else e.push([o])}return e}function BX(t,e){let r={};for(let a of e)for(let n of a.styles)r[n[0]]=a.inverse?null:n.slice(1);let o=t;for(let[a,n]of Object.entries(r))if(!!Array.isArray(n)){if(!(a in o))throw new Error(`Unknown Chalk style: ${a}`);o=n.length>0?o[a](...n):o[a]}return o}DX.exports=(t,e)=>{let r=[],o=[],a=[];if(e.replace(N9e,(n,u,A,p,h,E)=>{if(u)a.push(vX(u));else if(p){let I=a.join("");a=[],o.push(r.length===0?I:BX(t,r)(I)),r.push({inverse:A,styles:_9e(p)})}else if(h){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");o.push(BX(t,r)(a.join(""))),a=[],r.pop()}else a.push(E)}),o.push(a.join("")),r.length>0){let n=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(n)}return o.join("")}});var vN=_((LQt,kX)=>{"use strict";var DI=vI(),{stdout:CN,stderr:wN}=yN(),{stringReplaceAll:H9e,stringEncaseCRLFWithFirstIndex:j9e}=wX(),SX=["ansi","ansi","ansi256","ansi16m"],Qy=Object.create(null),q9e=(t,e={})=>{if(e.level>3||e.level<0)throw new Error("The `level` option should be an integer from 0 to 3");let r=CN?CN.level:0;t.level=e.level===void 0?r:e.level},IN=class{constructor(e){return xX(e)}},xX=t=>{let e={};return q9e(e,t),e.template=(...r)=>W9e(e.template,...r),Object.setPrototypeOf(e,bP.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=IN,e.template};function bP(t){return xX(t)}for(let[t,e]of Object.entries(DI))Qy[t]={get(){let r=kP(this,BN(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};Qy.visible={get(){let t=kP(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};var bX=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let t of bX)Qy[t]={get(){let{level:e}=this;return function(...r){let o=BN(DI.color[SX[e]][t](...r),DI.color.close,this._styler);return kP(this,o,this._isEmpty)}}};for(let t of bX){let e="bg"+t[0].toUpperCase()+t.slice(1);Qy[e]={get(){let{level:r}=this;return function(...o){let a=BN(DI.bgColor[SX[r]][t](...o),DI.bgColor.close,this._styler);return kP(this,a,this._isEmpty)}}}}var G9e=Object.defineProperties(()=>{},{...Qy,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),BN=(t,e,r)=>{let o,a;return r===void 0?(o=t,a=e):(o=r.openAll+t,a=e+r.closeAll),{open:t,close:e,openAll:o,closeAll:a,parent:r}},kP=(t,e,r)=>{let o=(...a)=>Y9e(o,a.length===1?""+a[0]:a.join(" "));return o.__proto__=G9e,o._generator=t,o._styler=e,o._isEmpty=r,o},Y9e=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;let{openAll:o,closeAll:a}=r;if(e.indexOf("\x1B")!==-1)for(;r!==void 0;)e=H9e(e,r.close,r.open),r=r.parent;let n=e.indexOf(` +`);return n!==-1&&(e=j9e(e,a,o,n)),o+e+a},EN,W9e=(t,...e)=>{let[r]=e;if(!Array.isArray(r))return e.join(" ");let o=e.slice(1),a=[r.raw[0]];for(let n=1;n{"use strict";Ul.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Ul.find=(t,e)=>t.nodes.find(r=>r.type===e);Ul.exceedsLimit=(t,e,r=1,o)=>o===!1||!Ul.isInteger(t)||!Ul.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=o;Ul.escapeNode=(t,e=0,r)=>{let o=t.nodes[e];!o||(r&&o.type===r||o.type==="open"||o.type==="close")&&o.escaped!==!0&&(o.value="\\"+o.value,o.escaped=!0)};Ul.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Ul.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Ul.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Ul.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Ul.flatten=(...t)=>{let e=[],r=o=>{for(let a=0;a{"use strict";var QX=QP();FX.exports=(t,e={})=>{let r=(o,a={})=>{let n=e.escapeInvalid&&QX.isInvalidBrace(a),u=o.invalid===!0&&e.escapeInvalid===!0,A="";if(o.value)return(n||u)&&QX.isOpenOrClose(o)?"\\"+o.value:o.value;if(o.value)return o.value;if(o.nodes)for(let p of o.nodes)A+=r(p);return A};return r(t)}});var RX=_((UQt,TX)=>{"use strict";TX.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var qX=_((_Qt,jX)=>{"use strict";var NX=RX(),ud=(t,e,r)=>{if(NX(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(NX(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let o={relaxZeros:!0,...r};typeof o.strictZeros=="boolean"&&(o.relaxZeros=o.strictZeros===!1);let a=String(o.relaxZeros),n=String(o.shorthand),u=String(o.capture),A=String(o.wrap),p=t+":"+e+"="+a+n+u+A;if(ud.cache.hasOwnProperty(p))return ud.cache[p].result;let h=Math.min(t,e),E=Math.max(t,e);if(Math.abs(h-E)===1){let T=t+"|"+e;return o.capture?`(${T})`:o.wrap===!1?T:`(?:${T})`}let I=HX(t)||HX(e),v={min:t,max:e,a:h,b:E},b=[],C=[];if(I&&(v.isPadded=I,v.maxLen=String(v.max).length),h<0){let T=E<0?Math.abs(E):1;C=LX(T,Math.abs(h),v,o),h=v.a=0}return E>=0&&(b=LX(h,E,v,o)),v.negatives=C,v.positives=b,v.result=V9e(C,b,o),o.capture===!0?v.result=`(${v.result})`:o.wrap!==!1&&b.length+C.length>1&&(v.result=`(?:${v.result})`),ud.cache[p]=v,v.result};function V9e(t,e,r){let o=DN(t,e,"-",!1,r)||[],a=DN(e,t,"",!1,r)||[],n=DN(t,e,"-?",!0,r)||[];return o.concat(n).concat(a).join("|")}function K9e(t,e){let r=1,o=1,a=OX(t,r),n=new Set([e]);for(;t<=a&&a<=e;)n.add(a),r+=1,a=OX(t,r);for(a=UX(e+1,o)-1;t1&&A.count.pop(),A.count.push(E.count[0]),A.string=A.pattern+_X(A.count),u=h+1;continue}r.isPadded&&(I=$9e(h,r,o)),E.string=I+E.pattern+_X(E.count),n.push(E),u=h+1,A=E}return n}function DN(t,e,r,o,a){let n=[];for(let u of t){let{string:A}=u;!o&&!MX(e,"string",A)&&n.push(r+A),o&&MX(e,"string",A)&&n.push(r+A)}return n}function z9e(t,e){let r=[];for(let o=0;oe?1:e>t?-1:0}function MX(t,e,r){return t.some(o=>o[e]===r)}function OX(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function UX(t,e){return t-t%Math.pow(10,e)}function _X(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function Z9e(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function HX(t){return/^-?(0+)\d/.test(t)}function $9e(t,e,r){if(!e.isPadded)return t;let o=Math.abs(e.maxLen-String(t).length),a=r.relaxZeros!==!1;switch(o){case 0:return"";case 1:return a?"0?":"0";case 2:return a?"0{0,2}":"00";default:return a?`0{0,${o}}`:`0{${o}}`}}ud.cache={};ud.clearCache=()=>ud.cache={};jX.exports=ud});var xN=_((HQt,XX)=>{"use strict";var e7e=Be("util"),WX=qX(),GX=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),t7e=t=>e=>t===!0?Number(e):String(e),PN=t=>typeof t=="number"||typeof t=="string"&&t!=="",SI=t=>Number.isInteger(+t),SN=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},r7e=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,n7e=(t,e,r)=>{if(e>0){let o=t[0]==="-"?"-":"";o&&(t=t.slice(1)),t=o+t.padStart(o?e-1:e,"0")}return r===!1?String(t):t},YX=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length{t.negatives.sort((u,A)=>uA?1:0),t.positives.sort((u,A)=>uA?1:0);let r=e.capture?"":"?:",o="",a="",n;return t.positives.length&&(o=t.positives.join("|")),t.negatives.length&&(a=`-(${r}${t.negatives.join("|")})`),o&&a?n=`${o}|${a}`:n=o||a,e.wrap?`(${r}${n})`:n},VX=(t,e,r,o)=>{if(r)return WX(t,e,{wrap:!1,...o});let a=String.fromCharCode(t);if(t===e)return a;let n=String.fromCharCode(e);return`[${a}-${n}]`},KX=(t,e,r)=>{if(Array.isArray(t)){let o=r.wrap===!0,a=r.capture?"":"?:";return o?`(${a}${t.join("|")})`:t.join("|")}return WX(t,e,r)},JX=(...t)=>new RangeError("Invalid range arguments: "+e7e.inspect(...t)),zX=(t,e,r)=>{if(r.strictRanges===!0)throw JX([t,e]);return[]},s7e=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},o7e=(t,e,r=1,o={})=>{let a=Number(t),n=Number(e);if(!Number.isInteger(a)||!Number.isInteger(n)){if(o.strictRanges===!0)throw JX([t,e]);return[]}a===0&&(a=0),n===0&&(n=0);let u=a>n,A=String(t),p=String(e),h=String(r);r=Math.max(Math.abs(r),1);let E=SN(A)||SN(p)||SN(h),I=E?Math.max(A.length,p.length,h.length):0,v=E===!1&&r7e(t,e,o)===!1,b=o.transform||t7e(v);if(o.toRegex&&r===1)return VX(YX(t,I),YX(e,I),!0,o);let C={negatives:[],positives:[]},T=J=>C[J<0?"negatives":"positives"].push(Math.abs(J)),L=[],U=0;for(;u?a>=n:a<=n;)o.toRegex===!0&&r>1?T(a):L.push(n7e(b(a,U),I,v)),a=u?a-r:a+r,U++;return o.toRegex===!0?r>1?i7e(C,o):KX(L,null,{wrap:!1,...o}):L},a7e=(t,e,r=1,o={})=>{if(!SI(t)&&t.length>1||!SI(e)&&e.length>1)return zX(t,e,o);let a=o.transform||(v=>String.fromCharCode(v)),n=`${t}`.charCodeAt(0),u=`${e}`.charCodeAt(0),A=n>u,p=Math.min(n,u),h=Math.max(n,u);if(o.toRegex&&r===1)return VX(p,h,!1,o);let E=[],I=0;for(;A?n>=u:n<=u;)E.push(a(n,I)),n=A?n-r:n+r,I++;return o.toRegex===!0?KX(E,null,{wrap:!1,options:o}):E},TP=(t,e,r,o={})=>{if(e==null&&PN(t))return[t];if(!PN(t)||!PN(e))return zX(t,e,o);if(typeof r=="function")return TP(t,e,1,{transform:r});if(GX(r))return TP(t,e,0,r);let a={...o};return a.capture===!0&&(a.wrap=!0),r=r||a.step||1,SI(r)?SI(t)&&SI(e)?o7e(t,e,r,a):a7e(t,e,Math.max(Math.abs(r),1),a):r!=null&&!GX(r)?s7e(r,a):TP(t,e,1,r)};XX.exports=TP});var eZ=_((jQt,$X)=>{"use strict";var l7e=xN(),ZX=QP(),c7e=(t,e={})=>{let r=(o,a={})=>{let n=ZX.isInvalidBrace(a),u=o.invalid===!0&&e.escapeInvalid===!0,A=n===!0||u===!0,p=e.escapeInvalid===!0?"\\":"",h="";if(o.isOpen===!0||o.isClose===!0)return p+o.value;if(o.type==="open")return A?p+o.value:"(";if(o.type==="close")return A?p+o.value:")";if(o.type==="comma")return o.prev.type==="comma"?"":A?o.value:"|";if(o.value)return o.value;if(o.nodes&&o.ranges>0){let E=ZX.reduce(o.nodes),I=l7e(...E,{...e,wrap:!1,toRegex:!0});if(I.length!==0)return E.length>1&&I.length>1?`(${I})`:I}if(o.nodes)for(let E of o.nodes)h+=r(E,o);return h};return r(t)};$X.exports=c7e});var nZ=_((qQt,rZ)=>{"use strict";var u7e=xN(),tZ=FP(),Fy=QP(),Ad=(t="",e="",r=!1)=>{let o=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?Fy.flatten(e).map(a=>`{${a}}`):e;for(let a of t)if(Array.isArray(a))for(let n of a)o.push(Ad(n,e,r));else for(let n of e)r===!0&&typeof n=="string"&&(n=`{${n}}`),o.push(Array.isArray(n)?Ad(a,n,r):a+n);return Fy.flatten(o)},A7e=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,o=(a,n={})=>{a.queue=[];let u=n,A=n.queue;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,A=u.queue;if(a.invalid||a.dollar){A.push(Ad(A.pop(),tZ(a,e)));return}if(a.type==="brace"&&a.invalid!==!0&&a.nodes.length===2){A.push(Ad(A.pop(),["{}"]));return}if(a.nodes&&a.ranges>0){let I=Fy.reduce(a.nodes);if(Fy.exceedsLimit(...I,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let v=u7e(...I,e);v.length===0&&(v=tZ(a,e)),A.push(Ad(A.pop(),v)),a.nodes=[];return}let p=Fy.encloseBrace(a),h=a.queue,E=a;for(;E.type!=="brace"&&E.type!=="root"&&E.parent;)E=E.parent,h=E.queue;for(let I=0;I{"use strict";iZ.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:` +`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var uZ=_((YQt,cZ)=>{"use strict";var f7e=FP(),{MAX_LENGTH:oZ,CHAR_BACKSLASH:bN,CHAR_BACKTICK:p7e,CHAR_COMMA:h7e,CHAR_DOT:g7e,CHAR_LEFT_PARENTHESES:d7e,CHAR_RIGHT_PARENTHESES:m7e,CHAR_LEFT_CURLY_BRACE:y7e,CHAR_RIGHT_CURLY_BRACE:E7e,CHAR_LEFT_SQUARE_BRACKET:aZ,CHAR_RIGHT_SQUARE_BRACKET:lZ,CHAR_DOUBLE_QUOTE:C7e,CHAR_SINGLE_QUOTE:w7e,CHAR_NO_BREAK_SPACE:I7e,CHAR_ZERO_WIDTH_NOBREAK_SPACE:B7e}=sZ(),v7e=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},o=typeof r.maxLength=="number"?Math.min(oZ,r.maxLength):oZ;if(t.length>o)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${o})`);let a={type:"root",input:t,nodes:[]},n=[a],u=a,A=a,p=0,h=t.length,E=0,I=0,v,b={},C=()=>t[E++],T=L=>{if(L.type==="text"&&A.type==="dot"&&(A.type="text"),A&&A.type==="text"&&L.type==="text"){A.value+=L.value;return}return u.nodes.push(L),L.parent=u,L.prev=A,A=L,L};for(T({type:"bos"});E0){if(u.ranges>0){u.ranges=0;let L=u.nodes.shift();u.nodes=[L,{type:"text",value:f7e(u)}]}T({type:"comma",value:v}),u.commas++;continue}if(v===g7e&&I>0&&u.commas===0){let L=u.nodes;if(I===0||L.length===0){T({type:"text",value:v});continue}if(A.type==="dot"){if(u.range=[],A.value+=v,A.type="range",u.nodes.length!==3&&u.nodes.length!==5){u.invalid=!0,u.ranges=0,A.type="text";continue}u.ranges++,u.args=[];continue}if(A.type==="range"){L.pop();let U=L[L.length-1];U.value+=A.value+v,A=U,u.ranges--;continue}T({type:"dot",value:v});continue}T({type:"text",value:v})}do if(u=n.pop(),u.type!=="root"){u.nodes.forEach(J=>{J.nodes||(J.type==="open"&&(J.isOpen=!0),J.type==="close"&&(J.isClose=!0),J.nodes||(J.type="text"),J.invalid=!0)});let L=n[n.length-1],U=L.nodes.indexOf(u);L.nodes.splice(U,1,...u.nodes)}while(n.length>0);return T({type:"eos"}),a};cZ.exports=v7e});var pZ=_((WQt,fZ)=>{"use strict";var AZ=FP(),D7e=eZ(),P7e=nZ(),S7e=uZ(),rl=(t,e={})=>{let r=[];if(Array.isArray(t))for(let o of t){let a=rl.create(o,e);Array.isArray(a)?r.push(...a):r.push(a)}else r=[].concat(rl.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};rl.parse=(t,e={})=>S7e(t,e);rl.stringify=(t,e={})=>AZ(typeof t=="string"?rl.parse(t,e):t,e);rl.compile=(t,e={})=>(typeof t=="string"&&(t=rl.parse(t,e)),D7e(t,e));rl.expand=(t,e={})=>{typeof t=="string"&&(t=rl.parse(t,e));let r=P7e(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};rl.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?rl.compile(t,e):rl.expand(t,e);fZ.exports=rl});var xI=_((VQt,yZ)=>{"use strict";var x7e=Be("path"),Vu="\\\\/",hZ=`[^${Vu}]`,Bf="\\.",b7e="\\+",k7e="\\?",RP="\\/",Q7e="(?=.)",gZ="[^/]",kN=`(?:${RP}|$)`,dZ=`(?:^|${RP})`,QN=`${Bf}{1,2}${kN}`,F7e=`(?!${Bf})`,T7e=`(?!${dZ}${QN})`,R7e=`(?!${Bf}{0,1}${kN})`,N7e=`(?!${QN})`,L7e=`[^.${RP}]`,M7e=`${gZ}*?`,mZ={DOT_LITERAL:Bf,PLUS_LITERAL:b7e,QMARK_LITERAL:k7e,SLASH_LITERAL:RP,ONE_CHAR:Q7e,QMARK:gZ,END_ANCHOR:kN,DOTS_SLASH:QN,NO_DOT:F7e,NO_DOTS:T7e,NO_DOT_SLASH:R7e,NO_DOTS_SLASH:N7e,QMARK_NO_DOT:L7e,STAR:M7e,START_ANCHOR:dZ},O7e={...mZ,SLASH_LITERAL:`[${Vu}]`,QMARK:hZ,STAR:`${hZ}*?`,DOTS_SLASH:`${Bf}{1,2}(?:[${Vu}]|$)`,NO_DOT:`(?!${Bf})`,NO_DOTS:`(?!(?:^|[${Vu}])${Bf}{1,2}(?:[${Vu}]|$))`,NO_DOT_SLASH:`(?!${Bf}{0,1}(?:[${Vu}]|$))`,NO_DOTS_SLASH:`(?!${Bf}{1,2}(?:[${Vu}]|$))`,QMARK_NO_DOT:`[^.${Vu}]`,START_ANCHOR:`(?:^|[${Vu}])`,END_ANCHOR:`(?:[${Vu}]|$)`},U7e={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};yZ.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:U7e,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:x7e.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?O7e:mZ}}});var bI=_(Pa=>{"use strict";var _7e=Be("path"),H7e=process.platform==="win32",{REGEX_BACKSLASH:j7e,REGEX_REMOVE_BACKSLASH:q7e,REGEX_SPECIAL_CHARS:G7e,REGEX_SPECIAL_CHARS_GLOBAL:Y7e}=xI();Pa.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Pa.hasRegexChars=t=>G7e.test(t);Pa.isRegexChar=t=>t.length===1&&Pa.hasRegexChars(t);Pa.escapeRegex=t=>t.replace(Y7e,"\\$1");Pa.toPosixSlashes=t=>t.replace(j7e,"/");Pa.removeBackslashes=t=>t.replace(q7e,e=>e==="\\"?"":e);Pa.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Pa.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:H7e===!0||_7e.sep==="\\";Pa.escapeLast=(t,e,r)=>{let o=t.lastIndexOf(e,r);return o===-1?t:t[o-1]==="\\"?Pa.escapeLast(t,e,o-1):`${t.slice(0,o)}\\${t.slice(o)}`};Pa.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Pa.wrapOutput=(t,e={},r={})=>{let o=r.contains?"":"^",a=r.contains?"":"$",n=`${o}(?:${t})${a}`;return e.negated===!0&&(n=`(?:^(?!${n}).*$)`),n}});var PZ=_((JQt,DZ)=>{"use strict";var EZ=bI(),{CHAR_ASTERISK:FN,CHAR_AT:W7e,CHAR_BACKWARD_SLASH:kI,CHAR_COMMA:V7e,CHAR_DOT:TN,CHAR_EXCLAMATION_MARK:RN,CHAR_FORWARD_SLASH:vZ,CHAR_LEFT_CURLY_BRACE:NN,CHAR_LEFT_PARENTHESES:LN,CHAR_LEFT_SQUARE_BRACKET:K7e,CHAR_PLUS:J7e,CHAR_QUESTION_MARK:CZ,CHAR_RIGHT_CURLY_BRACE:z7e,CHAR_RIGHT_PARENTHESES:wZ,CHAR_RIGHT_SQUARE_BRACKET:X7e}=xI(),IZ=t=>t===vZ||t===kI,BZ=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Z7e=(t,e)=>{let r=e||{},o=t.length-1,a=r.parts===!0||r.scanToEnd===!0,n=[],u=[],A=[],p=t,h=-1,E=0,I=0,v=!1,b=!1,C=!1,T=!1,L=!1,U=!1,J=!1,te=!1,le=!1,pe=!1,Ae=0,ye,ae,we={value:"",depth:0,isGlob:!1},Pe=()=>h>=o,g=()=>p.charCodeAt(h+1),Ee=()=>(ye=ae,p.charCodeAt(++h));for(;h0&&(ce=p.slice(0,E),p=p.slice(E),I-=E),De&&C===!0&&I>0?(De=p.slice(0,I),ne=p.slice(I)):C===!0?(De="",ne=p):De=p,De&&De!==""&&De!=="/"&&De!==p&&IZ(De.charCodeAt(De.length-1))&&(De=De.slice(0,-1)),r.unescape===!0&&(ne&&(ne=EZ.removeBackslashes(ne)),De&&J===!0&&(De=EZ.removeBackslashes(De)));let ee={prefix:ce,input:t,start:E,base:De,glob:ne,isBrace:v,isBracket:b,isGlob:C,isExtglob:T,isGlobstar:L,negated:te,negatedExtglob:le};if(r.tokens===!0&&(ee.maxDepth=0,IZ(ae)||u.push(we),ee.tokens=u),r.parts===!0||r.tokens===!0){let Ie;for(let ke=0;ke{"use strict";var NP=xI(),nl=bI(),{MAX_LENGTH:LP,POSIX_REGEX_SOURCE:$7e,REGEX_NON_SPECIAL_CHARS:eYe,REGEX_SPECIAL_CHARS_BACKREF:tYe,REPLACEMENTS:SZ}=NP,rYe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(a=>nl.escapeRegex(a)).join("..")}return r},Ty=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,MN=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=SZ[t]||t;let r={...e},o=typeof r.maxLength=="number"?Math.min(LP,r.maxLength):LP,a=t.length;if(a>o)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${o}`);let n={type:"bos",value:"",output:r.prepend||""},u=[n],A=r.capture?"":"?:",p=nl.isWindows(e),h=NP.globChars(p),E=NP.extglobChars(h),{DOT_LITERAL:I,PLUS_LITERAL:v,SLASH_LITERAL:b,ONE_CHAR:C,DOTS_SLASH:T,NO_DOT:L,NO_DOT_SLASH:U,NO_DOTS_SLASH:J,QMARK:te,QMARK_NO_DOT:le,STAR:pe,START_ANCHOR:Ae}=h,ye=x=>`(${A}(?:(?!${Ae}${x.dot?T:I}).)*?)`,ae=r.dot?"":L,we=r.dot?te:le,Pe=r.bash===!0?ye(r):pe;r.capture&&(Pe=`(${Pe})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let g={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:u};t=nl.removePrefix(t,g),a=t.length;let Ee=[],De=[],ce=[],ne=n,ee,Ie=()=>g.index===a-1,ke=g.peek=(x=1)=>t[g.index+x],ht=g.advance=()=>t[++g.index]||"",H=()=>t.slice(g.index+1),lt=(x="",w=0)=>{g.consumed+=x,g.index+=w},Re=x=>{g.output+=x.output!=null?x.output:x.value,lt(x.value)},Qe=()=>{let x=1;for(;ke()==="!"&&(ke(2)!=="("||ke(3)==="?");)ht(),g.start++,x++;return x%2===0?!1:(g.negated=!0,g.start++,!0)},be=x=>{g[x]++,ce.push(x)},_e=x=>{g[x]--,ce.pop()},Te=x=>{if(ne.type==="globstar"){let w=g.braces>0&&(x.type==="comma"||x.type==="brace"),S=x.extglob===!0||Ee.length&&(x.type==="pipe"||x.type==="paren");x.type!=="slash"&&x.type!=="paren"&&!w&&!S&&(g.output=g.output.slice(0,-ne.output.length),ne.type="star",ne.value="*",ne.output=Pe,g.output+=ne.output)}if(Ee.length&&x.type!=="paren"&&(Ee[Ee.length-1].inner+=x.value),(x.value||x.output)&&Re(x),ne&&ne.type==="text"&&x.type==="text"){ne.value+=x.value,ne.output=(ne.output||"")+x.value;return}x.prev=ne,u.push(x),ne=x},Je=(x,w)=>{let S={...E[w],conditions:1,inner:""};S.prev=ne,S.parens=g.parens,S.output=g.output;let y=(r.capture?"(":"")+S.open;be("parens"),Te({type:x,value:w,output:g.output?"":C}),Te({type:"paren",extglob:!0,value:ht(),output:y}),Ee.push(S)},He=x=>{let w=x.close+(r.capture?")":""),S;if(x.type==="negate"){let y=Pe;if(x.inner&&x.inner.length>1&&x.inner.includes("/")&&(y=ye(r)),(y!==Pe||Ie()||/^\)+$/.test(H()))&&(w=x.close=`)$))${y}`),x.inner.includes("*")&&(S=H())&&/^\.[^\\/.]+$/.test(S)){let F=MN(S,{...e,fastpaths:!1}).output;w=x.close=`)${F})${y})`}x.prev.type==="bos"&&(g.negatedExtglob=!0)}Te({type:"paren",extglob:!0,value:ee,output:w}),_e("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let x=!1,w=t.replace(tYe,(S,y,F,z,X,Z)=>z==="\\"?(x=!0,S):z==="?"?y?y+z+(X?te.repeat(X.length):""):Z===0?we+(X?te.repeat(X.length):""):te.repeat(F.length):z==="."?I.repeat(F.length):z==="*"?y?y+z+(X?Pe:""):Pe:y?S:`\\${S}`);return x===!0&&(r.unescape===!0?w=w.replace(/\\/g,""):w=w.replace(/\\+/g,S=>S.length%2===0?"\\\\":S?"\\":"")),w===t&&r.contains===!0?(g.output=t,g):(g.output=nl.wrapOutput(w,g,e),g)}for(;!Ie();){if(ee=ht(),ee==="\0")continue;if(ee==="\\"){let S=ke();if(S==="/"&&r.bash!==!0||S==="."||S===";")continue;if(!S){ee+="\\",Te({type:"text",value:ee});continue}let y=/^\\+/.exec(H()),F=0;if(y&&y[0].length>2&&(F=y[0].length,g.index+=F,F%2!==0&&(ee+="\\")),r.unescape===!0?ee=ht():ee+=ht(),g.brackets===0){Te({type:"text",value:ee});continue}}if(g.brackets>0&&(ee!=="]"||ne.value==="["||ne.value==="[^")){if(r.posix!==!1&&ee===":"){let S=ne.value.slice(1);if(S.includes("[")&&(ne.posix=!0,S.includes(":"))){let y=ne.value.lastIndexOf("["),F=ne.value.slice(0,y),z=ne.value.slice(y+2),X=$7e[z];if(X){ne.value=F+X,g.backtrack=!0,ht(),!n.output&&u.indexOf(ne)===1&&(n.output=C);continue}}}(ee==="["&&ke()!==":"||ee==="-"&&ke()==="]")&&(ee=`\\${ee}`),ee==="]"&&(ne.value==="["||ne.value==="[^")&&(ee=`\\${ee}`),r.posix===!0&&ee==="!"&&ne.value==="["&&(ee="^"),ne.value+=ee,Re({value:ee});continue}if(g.quotes===1&&ee!=='"'){ee=nl.escapeRegex(ee),ne.value+=ee,Re({value:ee});continue}if(ee==='"'){g.quotes=g.quotes===1?0:1,r.keepQuotes===!0&&Te({type:"text",value:ee});continue}if(ee==="("){be("parens"),Te({type:"paren",value:ee});continue}if(ee===")"){if(g.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Ty("opening","("));let S=Ee[Ee.length-1];if(S&&g.parens===S.parens+1){He(Ee.pop());continue}Te({type:"paren",value:ee,output:g.parens?")":"\\)"}),_e("parens");continue}if(ee==="["){if(r.nobracket===!0||!H().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Ty("closing","]"));ee=`\\${ee}`}else be("brackets");Te({type:"bracket",value:ee});continue}if(ee==="]"){if(r.nobracket===!0||ne&&ne.type==="bracket"&&ne.value.length===1){Te({type:"text",value:ee,output:`\\${ee}`});continue}if(g.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Ty("opening","["));Te({type:"text",value:ee,output:`\\${ee}`});continue}_e("brackets");let S=ne.value.slice(1);if(ne.posix!==!0&&S[0]==="^"&&!S.includes("/")&&(ee=`/${ee}`),ne.value+=ee,Re({value:ee}),r.literalBrackets===!1||nl.hasRegexChars(S))continue;let y=nl.escapeRegex(ne.value);if(g.output=g.output.slice(0,-ne.value.length),r.literalBrackets===!0){g.output+=y,ne.value=y;continue}ne.value=`(${A}${y}|${ne.value})`,g.output+=ne.value;continue}if(ee==="{"&&r.nobrace!==!0){be("braces");let S={type:"brace",value:ee,output:"(",outputIndex:g.output.length,tokensIndex:g.tokens.length};De.push(S),Te(S);continue}if(ee==="}"){let S=De[De.length-1];if(r.nobrace===!0||!S){Te({type:"text",value:ee,output:ee});continue}let y=")";if(S.dots===!0){let F=u.slice(),z=[];for(let X=F.length-1;X>=0&&(u.pop(),F[X].type!=="brace");X--)F[X].type!=="dots"&&z.unshift(F[X].value);y=rYe(z,r),g.backtrack=!0}if(S.comma!==!0&&S.dots!==!0){let F=g.output.slice(0,S.outputIndex),z=g.tokens.slice(S.tokensIndex);S.value=S.output="\\{",ee=y="\\}",g.output=F;for(let X of z)g.output+=X.output||X.value}Te({type:"brace",value:ee,output:y}),_e("braces"),De.pop();continue}if(ee==="|"){Ee.length>0&&Ee[Ee.length-1].conditions++,Te({type:"text",value:ee});continue}if(ee===","){let S=ee,y=De[De.length-1];y&&ce[ce.length-1]==="braces"&&(y.comma=!0,S="|"),Te({type:"comma",value:ee,output:S});continue}if(ee==="/"){if(ne.type==="dot"&&g.index===g.start+1){g.start=g.index+1,g.consumed="",g.output="",u.pop(),ne=n;continue}Te({type:"slash",value:ee,output:b});continue}if(ee==="."){if(g.braces>0&&ne.type==="dot"){ne.value==="."&&(ne.output=I);let S=De[De.length-1];ne.type="dots",ne.output+=ee,ne.value+=ee,S.dots=!0;continue}if(g.braces+g.parens===0&&ne.type!=="bos"&&ne.type!=="slash"){Te({type:"text",value:ee,output:I});continue}Te({type:"dot",value:ee,output:I});continue}if(ee==="?"){if(!(ne&&ne.value==="(")&&r.noextglob!==!0&&ke()==="("&&ke(2)!=="?"){Je("qmark",ee);continue}if(ne&&ne.type==="paren"){let y=ke(),F=ee;if(y==="<"&&!nl.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(ne.value==="("&&!/[!=<:]/.test(y)||y==="<"&&!/<([!=]|\w+>)/.test(H()))&&(F=`\\${ee}`),Te({type:"text",value:ee,output:F});continue}if(r.dot!==!0&&(ne.type==="slash"||ne.type==="bos")){Te({type:"qmark",value:ee,output:le});continue}Te({type:"qmark",value:ee,output:te});continue}if(ee==="!"){if(r.noextglob!==!0&&ke()==="("&&(ke(2)!=="?"||!/[!=<:]/.test(ke(3)))){Je("negate",ee);continue}if(r.nonegate!==!0&&g.index===0){Qe();continue}}if(ee==="+"){if(r.noextglob!==!0&&ke()==="("&&ke(2)!=="?"){Je("plus",ee);continue}if(ne&&ne.value==="("||r.regex===!1){Te({type:"plus",value:ee,output:v});continue}if(ne&&(ne.type==="bracket"||ne.type==="paren"||ne.type==="brace")||g.parens>0){Te({type:"plus",value:ee});continue}Te({type:"plus",value:v});continue}if(ee==="@"){if(r.noextglob!==!0&&ke()==="("&&ke(2)!=="?"){Te({type:"at",extglob:!0,value:ee,output:""});continue}Te({type:"text",value:ee});continue}if(ee!=="*"){(ee==="$"||ee==="^")&&(ee=`\\${ee}`);let S=eYe.exec(H());S&&(ee+=S[0],g.index+=S[0].length),Te({type:"text",value:ee});continue}if(ne&&(ne.type==="globstar"||ne.star===!0)){ne.type="star",ne.star=!0,ne.value+=ee,ne.output=Pe,g.backtrack=!0,g.globstar=!0,lt(ee);continue}let x=H();if(r.noextglob!==!0&&/^\([^?]/.test(x)){Je("star",ee);continue}if(ne.type==="star"){if(r.noglobstar===!0){lt(ee);continue}let S=ne.prev,y=S.prev,F=S.type==="slash"||S.type==="bos",z=y&&(y.type==="star"||y.type==="globstar");if(r.bash===!0&&(!F||x[0]&&x[0]!=="/")){Te({type:"star",value:ee,output:""});continue}let X=g.braces>0&&(S.type==="comma"||S.type==="brace"),Z=Ee.length&&(S.type==="pipe"||S.type==="paren");if(!F&&S.type!=="paren"&&!X&&!Z){Te({type:"star",value:ee,output:""});continue}for(;x.slice(0,3)==="/**";){let ie=t[g.index+4];if(ie&&ie!=="/")break;x=x.slice(3),lt("/**",3)}if(S.type==="bos"&&Ie()){ne.type="globstar",ne.value+=ee,ne.output=ye(r),g.output=ne.output,g.globstar=!0,lt(ee);continue}if(S.type==="slash"&&S.prev.type!=="bos"&&!z&&Ie()){g.output=g.output.slice(0,-(S.output+ne.output).length),S.output=`(?:${S.output}`,ne.type="globstar",ne.output=ye(r)+(r.strictSlashes?")":"|$)"),ne.value+=ee,g.globstar=!0,g.output+=S.output+ne.output,lt(ee);continue}if(S.type==="slash"&&S.prev.type!=="bos"&&x[0]==="/"){let ie=x[1]!==void 0?"|$":"";g.output=g.output.slice(0,-(S.output+ne.output).length),S.output=`(?:${S.output}`,ne.type="globstar",ne.output=`${ye(r)}${b}|${b}${ie})`,ne.value+=ee,g.output+=S.output+ne.output,g.globstar=!0,lt(ee+ht()),Te({type:"slash",value:"/",output:""});continue}if(S.type==="bos"&&x[0]==="/"){ne.type="globstar",ne.value+=ee,ne.output=`(?:^|${b}|${ye(r)}${b})`,g.output=ne.output,g.globstar=!0,lt(ee+ht()),Te({type:"slash",value:"/",output:""});continue}g.output=g.output.slice(0,-ne.output.length),ne.type="globstar",ne.output=ye(r),ne.value+=ee,g.output+=ne.output,g.globstar=!0,lt(ee);continue}let w={type:"star",value:ee,output:Pe};if(r.bash===!0){w.output=".*?",(ne.type==="bos"||ne.type==="slash")&&(w.output=ae+w.output),Te(w);continue}if(ne&&(ne.type==="bracket"||ne.type==="paren")&&r.regex===!0){w.output=ee,Te(w);continue}(g.index===g.start||ne.type==="slash"||ne.type==="dot")&&(ne.type==="dot"?(g.output+=U,ne.output+=U):r.dot===!0?(g.output+=J,ne.output+=J):(g.output+=ae,ne.output+=ae),ke()!=="*"&&(g.output+=C,ne.output+=C)),Te(w)}for(;g.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Ty("closing","]"));g.output=nl.escapeLast(g.output,"["),_e("brackets")}for(;g.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Ty("closing",")"));g.output=nl.escapeLast(g.output,"("),_e("parens")}for(;g.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Ty("closing","}"));g.output=nl.escapeLast(g.output,"{"),_e("braces")}if(r.strictSlashes!==!0&&(ne.type==="star"||ne.type==="bracket")&&Te({type:"maybe_slash",value:"",output:`${b}?`}),g.backtrack===!0){g.output="";for(let x of g.tokens)g.output+=x.output!=null?x.output:x.value,x.suffix&&(g.output+=x.suffix)}return g};MN.fastpaths=(t,e)=>{let r={...e},o=typeof r.maxLength=="number"?Math.min(LP,r.maxLength):LP,a=t.length;if(a>o)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${o}`);t=SZ[t]||t;let n=nl.isWindows(e),{DOT_LITERAL:u,SLASH_LITERAL:A,ONE_CHAR:p,DOTS_SLASH:h,NO_DOT:E,NO_DOTS:I,NO_DOTS_SLASH:v,STAR:b,START_ANCHOR:C}=NP.globChars(n),T=r.dot?I:E,L=r.dot?v:E,U=r.capture?"":"?:",J={negated:!1,prefix:""},te=r.bash===!0?".*?":b;r.capture&&(te=`(${te})`);let le=ae=>ae.noglobstar===!0?te:`(${U}(?:(?!${C}${ae.dot?h:u}).)*?)`,pe=ae=>{switch(ae){case"*":return`${T}${p}${te}`;case".*":return`${u}${p}${te}`;case"*.*":return`${T}${te}${u}${p}${te}`;case"*/*":return`${T}${te}${A}${p}${L}${te}`;case"**":return T+le(r);case"**/*":return`(?:${T}${le(r)}${A})?${L}${p}${te}`;case"**/*.*":return`(?:${T}${le(r)}${A})?${L}${te}${u}${p}${te}`;case"**/.*":return`(?:${T}${le(r)}${A})?${u}${p}${te}`;default:{let we=/^(.*?)\.(\w+)$/.exec(ae);if(!we)return;let Pe=pe(we[1]);return Pe?Pe+u+we[2]:void 0}}},Ae=nl.removePrefix(t,J),ye=pe(Ae);return ye&&r.strictSlashes!==!0&&(ye+=`${A}?`),ye};xZ.exports=MN});var QZ=_((XQt,kZ)=>{"use strict";var nYe=Be("path"),iYe=PZ(),ON=bZ(),UN=bI(),sYe=xI(),oYe=t=>t&&typeof t=="object"&&!Array.isArray(t),Oi=(t,e,r=!1)=>{if(Array.isArray(t)){let E=t.map(v=>Oi(v,e,r));return v=>{for(let b of E){let C=b(v);if(C)return C}return!1}}let o=oYe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!o)throw new TypeError("Expected pattern to be a non-empty string");let a=e||{},n=UN.isWindows(e),u=o?Oi.compileRe(t,e):Oi.makeRe(t,e,!1,!0),A=u.state;delete u.state;let p=()=>!1;if(a.ignore){let E={...e,ignore:null,onMatch:null,onResult:null};p=Oi(a.ignore,E,r)}let h=(E,I=!1)=>{let{isMatch:v,match:b,output:C}=Oi.test(E,u,e,{glob:t,posix:n}),T={glob:t,state:A,regex:u,posix:n,input:E,output:C,match:b,isMatch:v};return typeof a.onResult=="function"&&a.onResult(T),v===!1?(T.isMatch=!1,I?T:!1):p(E)?(typeof a.onIgnore=="function"&&a.onIgnore(T),T.isMatch=!1,I?T:!1):(typeof a.onMatch=="function"&&a.onMatch(T),I?T:!0)};return r&&(h.state=A),h};Oi.test=(t,e,r,{glob:o,posix:a}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let n=r||{},u=n.format||(a?UN.toPosixSlashes:null),A=t===o,p=A&&u?u(t):t;return A===!1&&(p=u?u(t):t,A=p===o),(A===!1||n.capture===!0)&&(n.matchBase===!0||n.basename===!0?A=Oi.matchBase(t,e,r,a):A=e.exec(p)),{isMatch:Boolean(A),match:A,output:p}};Oi.matchBase=(t,e,r,o=UN.isWindows(r))=>(e instanceof RegExp?e:Oi.makeRe(e,r)).test(nYe.basename(t));Oi.isMatch=(t,e,r)=>Oi(e,r)(t);Oi.parse=(t,e)=>Array.isArray(t)?t.map(r=>Oi.parse(r,e)):ON(t,{...e,fastpaths:!1});Oi.scan=(t,e)=>iYe(t,e);Oi.compileRe=(t,e,r=!1,o=!1)=>{if(r===!0)return t.output;let a=e||{},n=a.contains?"":"^",u=a.contains?"":"$",A=`${n}(?:${t.output})${u}`;t&&t.negated===!0&&(A=`^(?!${A}).*$`);let p=Oi.toRegex(A,e);return o===!0&&(p.state=t),p};Oi.makeRe=(t,e={},r=!1,o=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(a.output=ON.fastpaths(t,e)),a.output||(a=ON(t,e)),Oi.compileRe(a,e,r,o)};Oi.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Oi.constants=sYe;kZ.exports=Oi});var TZ=_((ZQt,FZ)=>{"use strict";FZ.exports=QZ()});var Zo=_(($Qt,MZ)=>{"use strict";var NZ=Be("util"),LZ=pZ(),Ku=TZ(),_N=bI(),RZ=t=>t===""||t==="./",yi=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let o=new Set,a=new Set,n=new Set,u=0,A=E=>{n.add(E.output),r&&r.onResult&&r.onResult(E)};for(let E=0;E!o.has(E));if(r&&h.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(E=>E.replace(/\\/g,"")):e}return h};yi.match=yi;yi.matcher=(t,e)=>Ku(t,e);yi.isMatch=(t,e,r)=>Ku(e,r)(t);yi.any=yi.isMatch;yi.not=(t,e,r={})=>{e=[].concat(e).map(String);let o=new Set,a=[],n=A=>{r.onResult&&r.onResult(A),a.push(A.output)},u=new Set(yi(t,e,{...r,onResult:n}));for(let A of a)u.has(A)||o.add(A);return[...o]};yi.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${NZ.inspect(t)}"`);if(Array.isArray(e))return e.some(o=>yi.contains(t,o,r));if(typeof e=="string"){if(RZ(t)||RZ(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return yi.isMatch(t,e,{...r,contains:!0})};yi.matchKeys=(t,e,r)=>{if(!_N.isObject(t))throw new TypeError("Expected the first argument to be an object");let o=yi(Object.keys(t),e,r),a={};for(let n of o)a[n]=t[n];return a};yi.some=(t,e,r)=>{let o=[].concat(t);for(let a of[].concat(e)){let n=Ku(String(a),r);if(o.some(u=>n(u)))return!0}return!1};yi.every=(t,e,r)=>{let o=[].concat(t);for(let a of[].concat(e)){let n=Ku(String(a),r);if(!o.every(u=>n(u)))return!1}return!0};yi.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${NZ.inspect(t)}"`);return[].concat(e).every(o=>Ku(o,r)(t))};yi.capture=(t,e,r)=>{let o=_N.isWindows(r),n=Ku.makeRe(String(t),{...r,capture:!0}).exec(o?_N.toPosixSlashes(e):e);if(n)return n.slice(1).map(u=>u===void 0?"":u)};yi.makeRe=(...t)=>Ku.makeRe(...t);yi.scan=(...t)=>Ku.scan(...t);yi.parse=(t,e)=>{let r=[];for(let o of[].concat(t||[]))for(let a of LZ(String(o),e))r.push(Ku.parse(a,e));return r};yi.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!/\{.*\}/.test(t)?[t]:LZ(t,e)};yi.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return yi.braces(t,{...e,expand:!0})};MZ.exports=yi});var UZ=_((eFt,OZ)=>{"use strict";OZ.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var MP=_((tFt,_Z)=>{"use strict";var aYe=UZ();_Z.exports=t=>typeof t=="string"?t.replace(aYe(),""):t});var jZ=_((rFt,HZ)=>{function lYe(){this.__data__=[],this.size=0}HZ.exports=lYe});var Ry=_((nFt,qZ)=>{function cYe(t,e){return t===e||t!==t&&e!==e}qZ.exports=cYe});var QI=_((iFt,GZ)=>{var uYe=Ry();function AYe(t,e){for(var r=t.length;r--;)if(uYe(t[r][0],e))return r;return-1}GZ.exports=AYe});var WZ=_((sFt,YZ)=>{var fYe=QI(),pYe=Array.prototype,hYe=pYe.splice;function gYe(t){var e=this.__data__,r=fYe(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():hYe.call(e,r,1),--this.size,!0}YZ.exports=gYe});var KZ=_((oFt,VZ)=>{var dYe=QI();function mYe(t){var e=this.__data__,r=dYe(e,t);return r<0?void 0:e[r][1]}VZ.exports=mYe});var zZ=_((aFt,JZ)=>{var yYe=QI();function EYe(t){return yYe(this.__data__,t)>-1}JZ.exports=EYe});var ZZ=_((lFt,XZ)=>{var CYe=QI();function wYe(t,e){var r=this.__data__,o=CYe(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}XZ.exports=wYe});var FI=_((cFt,$Z)=>{var IYe=jZ(),BYe=WZ(),vYe=KZ(),DYe=zZ(),PYe=ZZ();function Ny(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{var SYe=FI();function xYe(){this.__data__=new SYe,this.size=0}e$.exports=xYe});var n$=_((AFt,r$)=>{function bYe(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}r$.exports=bYe});var s$=_((fFt,i$)=>{function kYe(t){return this.__data__.get(t)}i$.exports=kYe});var a$=_((pFt,o$)=>{function QYe(t){return this.__data__.has(t)}o$.exports=QYe});var HN=_((hFt,l$)=>{var FYe=typeof global=="object"&&global&&global.Object===Object&&global;l$.exports=FYe});var _l=_((gFt,c$)=>{var TYe=HN(),RYe=typeof self=="object"&&self&&self.Object===Object&&self,NYe=TYe||RYe||Function("return this")();c$.exports=NYe});var fd=_((dFt,u$)=>{var LYe=_l(),MYe=LYe.Symbol;u$.exports=MYe});var h$=_((mFt,p$)=>{var A$=fd(),f$=Object.prototype,OYe=f$.hasOwnProperty,UYe=f$.toString,TI=A$?A$.toStringTag:void 0;function _Ye(t){var e=OYe.call(t,TI),r=t[TI];try{t[TI]=void 0;var o=!0}catch{}var a=UYe.call(t);return o&&(e?t[TI]=r:delete t[TI]),a}p$.exports=_Ye});var d$=_((yFt,g$)=>{var HYe=Object.prototype,jYe=HYe.toString;function qYe(t){return jYe.call(t)}g$.exports=qYe});var pd=_((EFt,E$)=>{var m$=fd(),GYe=h$(),YYe=d$(),WYe="[object Null]",VYe="[object Undefined]",y$=m$?m$.toStringTag:void 0;function KYe(t){return t==null?t===void 0?VYe:WYe:y$&&y$ in Object(t)?GYe(t):YYe(t)}E$.exports=KYe});var il=_((CFt,C$)=>{function JYe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}C$.exports=JYe});var OP=_((wFt,w$)=>{var zYe=pd(),XYe=il(),ZYe="[object AsyncFunction]",$Ye="[object Function]",eWe="[object GeneratorFunction]",tWe="[object Proxy]";function rWe(t){if(!XYe(t))return!1;var e=zYe(t);return e==$Ye||e==eWe||e==ZYe||e==tWe}w$.exports=rWe});var B$=_((IFt,I$)=>{var nWe=_l(),iWe=nWe["__core-js_shared__"];I$.exports=iWe});var P$=_((BFt,D$)=>{var jN=B$(),v$=function(){var t=/[^.]+$/.exec(jN&&jN.keys&&jN.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function sWe(t){return!!v$&&v$ in t}D$.exports=sWe});var qN=_((vFt,S$)=>{var oWe=Function.prototype,aWe=oWe.toString;function lWe(t){if(t!=null){try{return aWe.call(t)}catch{}try{return t+""}catch{}}return""}S$.exports=lWe});var b$=_((DFt,x$)=>{var cWe=OP(),uWe=P$(),AWe=il(),fWe=qN(),pWe=/[\\^$.*+?()[\]{}|]/g,hWe=/^\[object .+?Constructor\]$/,gWe=Function.prototype,dWe=Object.prototype,mWe=gWe.toString,yWe=dWe.hasOwnProperty,EWe=RegExp("^"+mWe.call(yWe).replace(pWe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function CWe(t){if(!AWe(t)||uWe(t))return!1;var e=cWe(t)?EWe:hWe;return e.test(fWe(t))}x$.exports=CWe});var Q$=_((PFt,k$)=>{function wWe(t,e){return t?.[e]}k$.exports=wWe});var Jp=_((SFt,F$)=>{var IWe=b$(),BWe=Q$();function vWe(t,e){var r=BWe(t,e);return IWe(r)?r:void 0}F$.exports=vWe});var UP=_((xFt,T$)=>{var DWe=Jp(),PWe=_l(),SWe=DWe(PWe,"Map");T$.exports=SWe});var RI=_((bFt,R$)=>{var xWe=Jp(),bWe=xWe(Object,"create");R$.exports=bWe});var M$=_((kFt,L$)=>{var N$=RI();function kWe(){this.__data__=N$?N$(null):{},this.size=0}L$.exports=kWe});var U$=_((QFt,O$)=>{function QWe(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}O$.exports=QWe});var H$=_((FFt,_$)=>{var FWe=RI(),TWe="__lodash_hash_undefined__",RWe=Object.prototype,NWe=RWe.hasOwnProperty;function LWe(t){var e=this.__data__;if(FWe){var r=e[t];return r===TWe?void 0:r}return NWe.call(e,t)?e[t]:void 0}_$.exports=LWe});var q$=_((TFt,j$)=>{var MWe=RI(),OWe=Object.prototype,UWe=OWe.hasOwnProperty;function _We(t){var e=this.__data__;return MWe?e[t]!==void 0:UWe.call(e,t)}j$.exports=_We});var Y$=_((RFt,G$)=>{var HWe=RI(),jWe="__lodash_hash_undefined__";function qWe(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=HWe&&e===void 0?jWe:e,this}G$.exports=qWe});var V$=_((NFt,W$)=>{var GWe=M$(),YWe=U$(),WWe=H$(),VWe=q$(),KWe=Y$();function Ly(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{var K$=V$(),JWe=FI(),zWe=UP();function XWe(){this.size=0,this.__data__={hash:new K$,map:new(zWe||JWe),string:new K$}}J$.exports=XWe});var Z$=_((MFt,X$)=>{function ZWe(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}X$.exports=ZWe});var NI=_((OFt,$$)=>{var $We=Z$();function eVe(t,e){var r=t.__data__;return $We(e)?r[typeof e=="string"?"string":"hash"]:r.map}$$.exports=eVe});var tee=_((UFt,eee)=>{var tVe=NI();function rVe(t){var e=tVe(this,t).delete(t);return this.size-=e?1:0,e}eee.exports=rVe});var nee=_((_Ft,ree)=>{var nVe=NI();function iVe(t){return nVe(this,t).get(t)}ree.exports=iVe});var see=_((HFt,iee)=>{var sVe=NI();function oVe(t){return sVe(this,t).has(t)}iee.exports=oVe});var aee=_((jFt,oee)=>{var aVe=NI();function lVe(t,e){var r=aVe(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}oee.exports=lVe});var _P=_((qFt,lee)=>{var cVe=z$(),uVe=tee(),AVe=nee(),fVe=see(),pVe=aee();function My(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{var hVe=FI(),gVe=UP(),dVe=_P(),mVe=200;function yVe(t,e){var r=this.__data__;if(r instanceof hVe){var o=r.__data__;if(!gVe||o.length{var EVe=FI(),CVe=t$(),wVe=n$(),IVe=s$(),BVe=a$(),vVe=uee();function Oy(t){var e=this.__data__=new EVe(t);this.size=e.size}Oy.prototype.clear=CVe;Oy.prototype.delete=wVe;Oy.prototype.get=IVe;Oy.prototype.has=BVe;Oy.prototype.set=vVe;Aee.exports=Oy});var pee=_((WFt,fee)=>{var DVe="__lodash_hash_undefined__";function PVe(t){return this.__data__.set(t,DVe),this}fee.exports=PVe});var gee=_((VFt,hee)=>{function SVe(t){return this.__data__.has(t)}hee.exports=SVe});var mee=_((KFt,dee)=>{var xVe=_P(),bVe=pee(),kVe=gee();function jP(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new xVe;++e{function QVe(t,e){for(var r=-1,o=t==null?0:t.length;++r{function FVe(t,e){return t.has(e)}Cee.exports=FVe});var GN=_((XFt,Iee)=>{var TVe=mee(),RVe=Eee(),NVe=wee(),LVe=1,MVe=2;function OVe(t,e,r,o,a,n){var u=r&LVe,A=t.length,p=e.length;if(A!=p&&!(u&&p>A))return!1;var h=n.get(t),E=n.get(e);if(h&&E)return h==e&&E==t;var I=-1,v=!0,b=r&MVe?new TVe:void 0;for(n.set(t,e),n.set(e,t);++I{var UVe=_l(),_Ve=UVe.Uint8Array;Bee.exports=_Ve});var Dee=_(($Ft,vee)=>{function HVe(t){var e=-1,r=Array(t.size);return t.forEach(function(o,a){r[++e]=[a,o]}),r}vee.exports=HVe});var See=_((eTt,Pee)=>{function jVe(t){var e=-1,r=Array(t.size);return t.forEach(function(o){r[++e]=o}),r}Pee.exports=jVe});var Fee=_((tTt,Qee)=>{var xee=fd(),bee=YN(),qVe=Ry(),GVe=GN(),YVe=Dee(),WVe=See(),VVe=1,KVe=2,JVe="[object Boolean]",zVe="[object Date]",XVe="[object Error]",ZVe="[object Map]",$Ve="[object Number]",eKe="[object RegExp]",tKe="[object Set]",rKe="[object String]",nKe="[object Symbol]",iKe="[object ArrayBuffer]",sKe="[object DataView]",kee=xee?xee.prototype:void 0,WN=kee?kee.valueOf:void 0;function oKe(t,e,r,o,a,n,u){switch(r){case sKe:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case iKe:return!(t.byteLength!=e.byteLength||!n(new bee(t),new bee(e)));case JVe:case zVe:case $Ve:return qVe(+t,+e);case XVe:return t.name==e.name&&t.message==e.message;case eKe:case rKe:return t==e+"";case ZVe:var A=YVe;case tKe:var p=o&VVe;if(A||(A=WVe),t.size!=e.size&&!p)return!1;var h=u.get(t);if(h)return h==e;o|=KVe,u.set(t,e);var E=GVe(A(t),A(e),o,a,n,u);return u.delete(t),E;case nKe:if(WN)return WN.call(t)==WN.call(e)}return!1}Qee.exports=oKe});var qP=_((rTt,Tee)=>{function aKe(t,e){for(var r=-1,o=e.length,a=t.length;++r{var lKe=Array.isArray;Ree.exports=lKe});var VN=_((iTt,Nee)=>{var cKe=qP(),uKe=Hl();function AKe(t,e,r){var o=e(t);return uKe(t)?o:cKe(o,r(t))}Nee.exports=AKe});var Mee=_((sTt,Lee)=>{function fKe(t,e){for(var r=-1,o=t==null?0:t.length,a=0,n=[];++r{function pKe(){return[]}Oee.exports=pKe});var GP=_((aTt,_ee)=>{var hKe=Mee(),gKe=KN(),dKe=Object.prototype,mKe=dKe.propertyIsEnumerable,Uee=Object.getOwnPropertySymbols,yKe=Uee?function(t){return t==null?[]:(t=Object(t),hKe(Uee(t),function(e){return mKe.call(t,e)}))}:gKe;_ee.exports=yKe});var jee=_((lTt,Hee)=>{function EKe(t,e){for(var r=-1,o=Array(t);++r{function CKe(t){return t!=null&&typeof t=="object"}qee.exports=CKe});var Yee=_((uTt,Gee)=>{var wKe=pd(),IKe=Ju(),BKe="[object Arguments]";function vKe(t){return IKe(t)&&wKe(t)==BKe}Gee.exports=vKe});var LI=_((ATt,Kee)=>{var Wee=Yee(),DKe=Ju(),Vee=Object.prototype,PKe=Vee.hasOwnProperty,SKe=Vee.propertyIsEnumerable,xKe=Wee(function(){return arguments}())?Wee:function(t){return DKe(t)&&PKe.call(t,"callee")&&!SKe.call(t,"callee")};Kee.exports=xKe});var zee=_((fTt,Jee)=>{function bKe(){return!1}Jee.exports=bKe});var OI=_((MI,Uy)=>{var kKe=_l(),QKe=zee(),$ee=typeof MI=="object"&&MI&&!MI.nodeType&&MI,Xee=$ee&&typeof Uy=="object"&&Uy&&!Uy.nodeType&&Uy,FKe=Xee&&Xee.exports===$ee,Zee=FKe?kKe.Buffer:void 0,TKe=Zee?Zee.isBuffer:void 0,RKe=TKe||QKe;Uy.exports=RKe});var UI=_((pTt,ete)=>{var NKe=9007199254740991,LKe=/^(?:0|[1-9]\d*)$/;function MKe(t,e){var r=typeof t;return e=e??NKe,!!e&&(r=="number"||r!="symbol"&&LKe.test(t))&&t>-1&&t%1==0&&t{var OKe=9007199254740991;function UKe(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=OKe}tte.exports=UKe});var nte=_((gTt,rte)=>{var _Ke=pd(),HKe=YP(),jKe=Ju(),qKe="[object Arguments]",GKe="[object Array]",YKe="[object Boolean]",WKe="[object Date]",VKe="[object Error]",KKe="[object Function]",JKe="[object Map]",zKe="[object Number]",XKe="[object Object]",ZKe="[object RegExp]",$Ke="[object Set]",eJe="[object String]",tJe="[object WeakMap]",rJe="[object ArrayBuffer]",nJe="[object DataView]",iJe="[object Float32Array]",sJe="[object Float64Array]",oJe="[object Int8Array]",aJe="[object Int16Array]",lJe="[object Int32Array]",cJe="[object Uint8Array]",uJe="[object Uint8ClampedArray]",AJe="[object Uint16Array]",fJe="[object Uint32Array]",ui={};ui[iJe]=ui[sJe]=ui[oJe]=ui[aJe]=ui[lJe]=ui[cJe]=ui[uJe]=ui[AJe]=ui[fJe]=!0;ui[qKe]=ui[GKe]=ui[rJe]=ui[YKe]=ui[nJe]=ui[WKe]=ui[VKe]=ui[KKe]=ui[JKe]=ui[zKe]=ui[XKe]=ui[ZKe]=ui[$Ke]=ui[eJe]=ui[tJe]=!1;function pJe(t){return jKe(t)&&HKe(t.length)&&!!ui[_Ke(t)]}rte.exports=pJe});var WP=_((dTt,ite)=>{function hJe(t){return function(e){return t(e)}}ite.exports=hJe});var VP=_((_I,_y)=>{var gJe=HN(),ste=typeof _I=="object"&&_I&&!_I.nodeType&&_I,HI=ste&&typeof _y=="object"&&_y&&!_y.nodeType&&_y,dJe=HI&&HI.exports===ste,JN=dJe&&gJe.process,mJe=function(){try{var t=HI&&HI.require&&HI.require("util").types;return t||JN&&JN.binding&&JN.binding("util")}catch{}}();_y.exports=mJe});var KP=_((mTt,lte)=>{var yJe=nte(),EJe=WP(),ote=VP(),ate=ote&&ote.isTypedArray,CJe=ate?EJe(ate):yJe;lte.exports=CJe});var zN=_((yTt,cte)=>{var wJe=jee(),IJe=LI(),BJe=Hl(),vJe=OI(),DJe=UI(),PJe=KP(),SJe=Object.prototype,xJe=SJe.hasOwnProperty;function bJe(t,e){var r=BJe(t),o=!r&&IJe(t),a=!r&&!o&&vJe(t),n=!r&&!o&&!a&&PJe(t),u=r||o||a||n,A=u?wJe(t.length,String):[],p=A.length;for(var h in t)(e||xJe.call(t,h))&&!(u&&(h=="length"||a&&(h=="offset"||h=="parent")||n&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||DJe(h,p)))&&A.push(h);return A}cte.exports=bJe});var JP=_((ETt,ute)=>{var kJe=Object.prototype;function QJe(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||kJe;return t===r}ute.exports=QJe});var XN=_((CTt,Ate)=>{function FJe(t,e){return function(r){return t(e(r))}}Ate.exports=FJe});var pte=_((wTt,fte)=>{var TJe=XN(),RJe=TJe(Object.keys,Object);fte.exports=RJe});var gte=_((ITt,hte)=>{var NJe=JP(),LJe=pte(),MJe=Object.prototype,OJe=MJe.hasOwnProperty;function UJe(t){if(!NJe(t))return LJe(t);var e=[];for(var r in Object(t))OJe.call(t,r)&&r!="constructor"&&e.push(r);return e}hte.exports=UJe});var jI=_((BTt,dte)=>{var _Je=OP(),HJe=YP();function jJe(t){return t!=null&&HJe(t.length)&&!_Je(t)}dte.exports=jJe});var zP=_((vTt,mte)=>{var qJe=zN(),GJe=gte(),YJe=jI();function WJe(t){return YJe(t)?qJe(t):GJe(t)}mte.exports=WJe});var ZN=_((DTt,yte)=>{var VJe=VN(),KJe=GP(),JJe=zP();function zJe(t){return VJe(t,JJe,KJe)}yte.exports=zJe});var wte=_((PTt,Cte)=>{var Ete=ZN(),XJe=1,ZJe=Object.prototype,$Je=ZJe.hasOwnProperty;function eze(t,e,r,o,a,n){var u=r&XJe,A=Ete(t),p=A.length,h=Ete(e),E=h.length;if(p!=E&&!u)return!1;for(var I=p;I--;){var v=A[I];if(!(u?v in e:$Je.call(e,v)))return!1}var b=n.get(t),C=n.get(e);if(b&&C)return b==e&&C==t;var T=!0;n.set(t,e),n.set(e,t);for(var L=u;++I{var tze=Jp(),rze=_l(),nze=tze(rze,"DataView");Ite.exports=nze});var Dte=_((xTt,vte)=>{var ize=Jp(),sze=_l(),oze=ize(sze,"Promise");vte.exports=oze});var Ste=_((bTt,Pte)=>{var aze=Jp(),lze=_l(),cze=aze(lze,"Set");Pte.exports=cze});var bte=_((kTt,xte)=>{var uze=Jp(),Aze=_l(),fze=uze(Aze,"WeakMap");xte.exports=fze});var qI=_((QTt,Lte)=>{var $N=Bte(),eL=UP(),tL=Dte(),rL=Ste(),nL=bte(),Nte=pd(),Hy=qN(),kte="[object Map]",pze="[object Object]",Qte="[object Promise]",Fte="[object Set]",Tte="[object WeakMap]",Rte="[object DataView]",hze=Hy($N),gze=Hy(eL),dze=Hy(tL),mze=Hy(rL),yze=Hy(nL),hd=Nte;($N&&hd(new $N(new ArrayBuffer(1)))!=Rte||eL&&hd(new eL)!=kte||tL&&hd(tL.resolve())!=Qte||rL&&hd(new rL)!=Fte||nL&&hd(new nL)!=Tte)&&(hd=function(t){var e=Nte(t),r=e==pze?t.constructor:void 0,o=r?Hy(r):"";if(o)switch(o){case hze:return Rte;case gze:return kte;case dze:return Qte;case mze:return Fte;case yze:return Tte}return e});Lte.exports=hd});var Gte=_((FTt,qte)=>{var iL=HP(),Eze=GN(),Cze=Fee(),wze=wte(),Mte=qI(),Ote=Hl(),Ute=OI(),Ize=KP(),Bze=1,_te="[object Arguments]",Hte="[object Array]",XP="[object Object]",vze=Object.prototype,jte=vze.hasOwnProperty;function Dze(t,e,r,o,a,n){var u=Ote(t),A=Ote(e),p=u?Hte:Mte(t),h=A?Hte:Mte(e);p=p==_te?XP:p,h=h==_te?XP:h;var E=p==XP,I=h==XP,v=p==h;if(v&&Ute(t)){if(!Ute(e))return!1;u=!0,E=!1}if(v&&!E)return n||(n=new iL),u||Ize(t)?Eze(t,e,r,o,a,n):Cze(t,e,p,r,o,a,n);if(!(r&Bze)){var b=E&&jte.call(t,"__wrapped__"),C=I&&jte.call(e,"__wrapped__");if(b||C){var T=b?t.value():t,L=C?e.value():e;return n||(n=new iL),a(T,L,r,o,n)}}return v?(n||(n=new iL),wze(t,e,r,o,a,n)):!1}qte.exports=Dze});var Kte=_((TTt,Vte)=>{var Pze=Gte(),Yte=Ju();function Wte(t,e,r,o,a){return t===e?!0:t==null||e==null||!Yte(t)&&!Yte(e)?t!==t&&e!==e:Pze(t,e,r,o,Wte,a)}Vte.exports=Wte});var zte=_((RTt,Jte)=>{var Sze=Kte();function xze(t,e){return Sze(t,e)}Jte.exports=xze});var sL=_((NTt,Xte)=>{var bze=Jp(),kze=function(){try{var t=bze(Object,"defineProperty");return t({},"",{}),t}catch{}}();Xte.exports=kze});var ZP=_((LTt,$te)=>{var Zte=sL();function Qze(t,e,r){e=="__proto__"&&Zte?Zte(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}$te.exports=Qze});var oL=_((MTt,ere)=>{var Fze=ZP(),Tze=Ry();function Rze(t,e,r){(r!==void 0&&!Tze(t[e],r)||r===void 0&&!(e in t))&&Fze(t,e,r)}ere.exports=Rze});var rre=_((OTt,tre)=>{function Nze(t){return function(e,r,o){for(var a=-1,n=Object(e),u=o(e),A=u.length;A--;){var p=u[t?A:++a];if(r(n[p],p,n)===!1)break}return e}}tre.exports=Nze});var ire=_((UTt,nre)=>{var Lze=rre(),Mze=Lze();nre.exports=Mze});var aL=_((GI,jy)=>{var Oze=_l(),lre=typeof GI=="object"&&GI&&!GI.nodeType&&GI,sre=lre&&typeof jy=="object"&&jy&&!jy.nodeType&&jy,Uze=sre&&sre.exports===lre,ore=Uze?Oze.Buffer:void 0,are=ore?ore.allocUnsafe:void 0;function _ze(t,e){if(e)return t.slice();var r=t.length,o=are?are(r):new t.constructor(r);return t.copy(o),o}jy.exports=_ze});var $P=_((_Tt,ure)=>{var cre=YN();function Hze(t){var e=new t.constructor(t.byteLength);return new cre(e).set(new cre(t)),e}ure.exports=Hze});var lL=_((HTt,Are)=>{var jze=$P();function qze(t,e){var r=e?jze(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}Are.exports=qze});var eS=_((jTt,fre)=>{function Gze(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r{var Yze=il(),pre=Object.create,Wze=function(){function t(){}return function(e){if(!Yze(e))return{};if(pre)return pre(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();hre.exports=Wze});var tS=_((GTt,dre)=>{var Vze=XN(),Kze=Vze(Object.getPrototypeOf,Object);dre.exports=Kze});var cL=_((YTt,mre)=>{var Jze=gre(),zze=tS(),Xze=JP();function Zze(t){return typeof t.constructor=="function"&&!Xze(t)?Jze(zze(t)):{}}mre.exports=Zze});var Ere=_((WTt,yre)=>{var $ze=jI(),eXe=Ju();function tXe(t){return eXe(t)&&$ze(t)}yre.exports=tXe});var uL=_((VTt,wre)=>{var rXe=pd(),nXe=tS(),iXe=Ju(),sXe="[object Object]",oXe=Function.prototype,aXe=Object.prototype,Cre=oXe.toString,lXe=aXe.hasOwnProperty,cXe=Cre.call(Object);function uXe(t){if(!iXe(t)||rXe(t)!=sXe)return!1;var e=nXe(t);if(e===null)return!0;var r=lXe.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Cre.call(r)==cXe}wre.exports=uXe});var AL=_((KTt,Ire)=>{function AXe(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}Ire.exports=AXe});var rS=_((JTt,Bre)=>{var fXe=ZP(),pXe=Ry(),hXe=Object.prototype,gXe=hXe.hasOwnProperty;function dXe(t,e,r){var o=t[e];(!(gXe.call(t,e)&&pXe(o,r))||r===void 0&&!(e in t))&&fXe(t,e,r)}Bre.exports=dXe});var gd=_((zTt,vre)=>{var mXe=rS(),yXe=ZP();function EXe(t,e,r,o){var a=!r;r||(r={});for(var n=-1,u=e.length;++n{function CXe(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}Dre.exports=CXe});var xre=_((ZTt,Sre)=>{var wXe=il(),IXe=JP(),BXe=Pre(),vXe=Object.prototype,DXe=vXe.hasOwnProperty;function PXe(t){if(!wXe(t))return BXe(t);var e=IXe(t),r=[];for(var o in t)o=="constructor"&&(e||!DXe.call(t,o))||r.push(o);return r}Sre.exports=PXe});var qy=_(($Tt,bre)=>{var SXe=zN(),xXe=xre(),bXe=jI();function kXe(t){return bXe(t)?SXe(t,!0):xXe(t)}bre.exports=kXe});var Qre=_((eRt,kre)=>{var QXe=gd(),FXe=qy();function TXe(t){return QXe(t,FXe(t))}kre.exports=TXe});var Mre=_((tRt,Lre)=>{var Fre=oL(),RXe=aL(),NXe=lL(),LXe=eS(),MXe=cL(),Tre=LI(),Rre=Hl(),OXe=Ere(),UXe=OI(),_Xe=OP(),HXe=il(),jXe=uL(),qXe=KP(),Nre=AL(),GXe=Qre();function YXe(t,e,r,o,a,n,u){var A=Nre(t,r),p=Nre(e,r),h=u.get(p);if(h){Fre(t,r,h);return}var E=n?n(A,p,r+"",t,e,u):void 0,I=E===void 0;if(I){var v=Rre(p),b=!v&&UXe(p),C=!v&&!b&&qXe(p);E=p,v||b||C?Rre(A)?E=A:OXe(A)?E=LXe(A):b?(I=!1,E=RXe(p,!0)):C?(I=!1,E=NXe(p,!0)):E=[]:jXe(p)||Tre(p)?(E=A,Tre(A)?E=GXe(A):(!HXe(A)||_Xe(A))&&(E=MXe(p))):I=!1}I&&(u.set(p,E),a(E,p,o,n,u),u.delete(p)),Fre(t,r,E)}Lre.exports=YXe});var _re=_((rRt,Ure)=>{var WXe=HP(),VXe=oL(),KXe=ire(),JXe=Mre(),zXe=il(),XXe=qy(),ZXe=AL();function Ore(t,e,r,o,a){t!==e&&KXe(e,function(n,u){if(a||(a=new WXe),zXe(n))JXe(t,e,u,r,Ore,o,a);else{var A=o?o(ZXe(t,u),n,u+"",t,e,a):void 0;A===void 0&&(A=n),VXe(t,u,A)}},XXe)}Ure.exports=Ore});var fL=_((nRt,Hre)=>{function $Xe(t){return t}Hre.exports=$Xe});var qre=_((iRt,jre)=>{function eZe(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}jre.exports=eZe});var pL=_((sRt,Yre)=>{var tZe=qre(),Gre=Math.max;function rZe(t,e,r){return e=Gre(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,n=Gre(o.length-e,0),u=Array(n);++a{function nZe(t){return function(){return t}}Wre.exports=nZe});var zre=_((aRt,Jre)=>{var iZe=Vre(),Kre=sL(),sZe=fL(),oZe=Kre?function(t,e){return Kre(t,"toString",{configurable:!0,enumerable:!1,value:iZe(e),writable:!0})}:sZe;Jre.exports=oZe});var Zre=_((lRt,Xre)=>{var aZe=800,lZe=16,cZe=Date.now;function uZe(t){var e=0,r=0;return function(){var o=cZe(),a=lZe-(o-r);if(r=o,a>0){if(++e>=aZe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}Xre.exports=uZe});var hL=_((cRt,$re)=>{var AZe=zre(),fZe=Zre(),pZe=fZe(AZe);$re.exports=pZe});var tne=_((uRt,ene)=>{var hZe=fL(),gZe=pL(),dZe=hL();function mZe(t,e){return dZe(gZe(t,e,hZe),t+"")}ene.exports=mZe});var nne=_((ARt,rne)=>{var yZe=Ry(),EZe=jI(),CZe=UI(),wZe=il();function IZe(t,e,r){if(!wZe(r))return!1;var o=typeof e;return(o=="number"?EZe(r)&&CZe(e,r.length):o=="string"&&e in r)?yZe(r[e],t):!1}rne.exports=IZe});var sne=_((fRt,ine)=>{var BZe=tne(),vZe=nne();function DZe(t){return BZe(function(e,r){var o=-1,a=r.length,n=a>1?r[a-1]:void 0,u=a>2?r[2]:void 0;for(n=t.length>3&&typeof n=="function"?(a--,n):void 0,u&&vZe(r[0],r[1],u)&&(n=a<3?void 0:n,a=1),e=Object(e);++o{var PZe=_re(),SZe=sne(),xZe=SZe(function(t,e,r,o){PZe(t,e,r,o)});one.exports=xZe});var je={};Kt(je,{AsyncActions:()=>mL,BufferStream:()=>dL,CachingStrategy:()=>Ene,DefaultStream:()=>yL,allSettledSafe:()=>Uc,assertNever:()=>CL,bufferStream:()=>Vy,buildIgnorePattern:()=>NZe,convertMapsToIndexableObjects:()=>iS,dynamicRequire:()=>vf,escapeRegExp:()=>kZe,getArrayWithDefault:()=>Gy,getFactoryWithDefault:()=>ol,getMapWithDefault:()=>Yy,getSetWithDefault:()=>dd,groupBy:()=>BL,isIndexableObject:()=>gL,isPathLike:()=>LZe,isTaggedYarnVersion:()=>bZe,makeDeferred:()=>dne,mapAndFilter:()=>sl,mapAndFind:()=>WI,mergeIntoTarget:()=>wne,overrideType:()=>QZe,parseBoolean:()=>VI,parseInt:()=>Ky,parseOptionalBoolean:()=>Cne,plural:()=>nS,prettifyAsyncErrors:()=>Wy,prettifySyncErrors:()=>wL,releaseAfterUseAsync:()=>TZe,replaceEnvVariables:()=>sS,sortMap:()=>ks,toMerged:()=>MZe,tryParseOptionalBoolean:()=>IL,validateEnum:()=>FZe});function bZe(t){return!!(pne.default.valid(t)&&t.match(/^[^-]+(-rc\.[0-9]+)?$/))}function nS(t,{one:e,more:r,zero:o=r}){return t===0?o:t===1?e:r}function kZe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function QZe(t){}function CL(t){throw new Error(`Assertion failed: Unexpected object '${t}'`)}function FZe(t,e){let r=Object.values(t);if(!r.includes(e))throw new it(`Invalid value for enumeration: ${JSON.stringify(e)} (expected one of ${r.map(o=>JSON.stringify(o)).join(", ")})`);return e}function sl(t,e){let r=[];for(let o of t){let a=e(o);a!==hne&&r.push(a)}return r}function WI(t,e){for(let r of t){let o=e(r);if(o!==gne)return o}}function gL(t){return typeof t=="object"&&t!==null}async function Uc(t){let e=await Promise.allSettled(t),r=[];for(let o of e){if(o.status==="rejected")throw o.reason;r.push(o.value)}return r}function iS(t){if(t instanceof Map&&(t=Object.fromEntries(t)),gL(t))for(let e of Object.keys(t)){let r=t[e];gL(r)&&(t[e]=iS(r))}return t}function ol(t,e,r){let o=t.get(e);return typeof o>"u"&&t.set(e,o=r()),o}function Gy(t,e){let r=t.get(e);return typeof r>"u"&&t.set(e,r=[]),r}function dd(t,e){let r=t.get(e);return typeof r>"u"&&t.set(e,r=new Set),r}function Yy(t,e){let r=t.get(e);return typeof r>"u"&&t.set(e,r=new Map),r}async function TZe(t,e){if(e==null)return await t();try{return await t()}finally{await e()}}async function Wy(t,e){try{return await t()}catch(r){throw r.message=e(r.message),r}}function wL(t,e){try{return t()}catch(r){throw r.message=e(r.message),r}}async function Vy(t){return await new Promise((e,r)=>{let o=[];t.on("error",a=>{r(a)}),t.on("data",a=>{o.push(a)}),t.on("end",()=>{e(Buffer.concat(o))})})}function dne(){let t,e;return{promise:new Promise((o,a)=>{t=o,e=a}),resolve:t,reject:e}}function mne(t){return YI(ue.fromPortablePath(t))}function yne(path){let physicalPath=ue.fromPortablePath(path),currentCacheEntry=YI.cache[physicalPath];delete YI.cache[physicalPath];let result;try{result=mne(physicalPath);let freshCacheEntry=YI.cache[physicalPath],dynamicModule=eval("module"),freshCacheIndex=dynamicModule.children.indexOf(freshCacheEntry);freshCacheIndex!==-1&&dynamicModule.children.splice(freshCacheIndex,1)}finally{YI.cache[physicalPath]=currentCacheEntry}return result}function RZe(t){let e=lne.get(t),r=oe.statSync(t);if(e?.mtime===r.mtimeMs)return e.instance;let o=yne(t);return lne.set(t,{mtime:r.mtimeMs,instance:o}),o}function vf(t,{cachingStrategy:e=2}={}){switch(e){case 0:return yne(t);case 1:return RZe(t);case 2:return mne(t);default:throw new Error("Unsupported caching strategy")}}function ks(t,e){let r=Array.from(t);Array.isArray(e)||(e=[e]);let o=[];for(let n of e)o.push(r.map(u=>n(u)));let a=r.map((n,u)=>u);return a.sort((n,u)=>{for(let A of o){let p=A[n]A[u]?1:0;if(p!==0)return p}return 0}),a.map(n=>r[n])}function NZe(t){return t.length===0?null:t.map(e=>`(${Ane.default.makeRe(e,{windows:!1,dot:!0}).source})`).join("|")}function sS(t,{env:e}){let r=/\${(?[\d\w_]+)(?:)?(?:-(?[^}]*))?}/g;return t.replace(r,(...o)=>{let{variableName:a,colon:n,fallback:u}=o[o.length-1],A=Object.hasOwn(e,a),p=e[a];if(p||A&&!n)return p;if(u!=null)return u;throw new it(`Environment variable not found (${a})`)})}function VI(t){switch(t){case"true":case"1":case 1:case!0:return!0;case"false":case"0":case 0:case!1:return!1;default:throw new Error(`Couldn't parse "${t}" as a boolean`)}}function Cne(t){return typeof t>"u"?t:VI(t)}function IL(t){try{return Cne(t)}catch{return null}}function LZe(t){return!!(ue.isAbsolute(t)||t.match(/^(\.{1,2}|~)\//))}function wne(t,...e){let r=u=>({value:u}),o=r(t),a=e.map(u=>r(u)),{value:n}=(0,une.default)(o,...a,(u,A)=>{if(Array.isArray(u)&&Array.isArray(A)){for(let p of A)u.find(h=>(0,cne.default)(h,p))||u.push(p);return u}});return n}function MZe(...t){return wne({},...t)}function BL(t,e){let r=Object.create(null);for(let o of t){let a=o[e];r[a]??=[],r[a].push(o)}return r}function Ky(t){return typeof t=="string"?Number.parseInt(t,10):t}var cne,une,Ane,fne,pne,EL,hne,gne,dL,mL,yL,YI,lne,Ene,jl=Et(()=>{Pt();qt();cne=$e(zte()),une=$e(ane()),Ane=$e(Zo()),fne=$e(nd()),pne=$e(zn()),EL=Be("stream");hne=Symbol();sl.skip=hne;gne=Symbol();WI.skip=gne;dL=class extends EL.Transform{constructor(){super(...arguments);this.chunks=[]}_transform(r,o,a){if(o!=="buffer"||!Buffer.isBuffer(r))throw new Error("Assertion failed: BufferStream only accept buffers");this.chunks.push(r),a(null,null)}_flush(r){r(null,Buffer.concat(this.chunks))}};mL=class{constructor(e){this.deferred=new Map;this.promises=new Map;this.limit=(0,fne.default)(e)}set(e,r){let o=this.deferred.get(e);typeof o>"u"&&this.deferred.set(e,o=dne());let a=this.limit(()=>r());return this.promises.set(e,a),a.then(()=>{this.promises.get(e)===a&&o.resolve()},n=>{this.promises.get(e)===a&&o.reject(n)}),o.promise}reduce(e,r){let o=this.promises.get(e)??Promise.resolve();this.set(e,()=>r(o))}async wait(){await Promise.all(this.promises.values())}},yL=class extends EL.Transform{constructor(r=Buffer.alloc(0)){super();this.active=!0;this.ifEmpty=r}_transform(r,o,a){if(o!=="buffer"||!Buffer.isBuffer(r))throw new Error("Assertion failed: DefaultStream only accept buffers");this.active=!1,a(null,r)}_flush(r){this.active&&this.ifEmpty.length>0?r(null,this.ifEmpty):r(null)}},YI=eval("require");lne=new Map;Ene=(o=>(o[o.NoCache=0]="NoCache",o[o.FsTime=1]="FsTime",o[o.Node=2]="Node",o))(Ene||{})});var Jy,vL,DL,Ine=Et(()=>{Jy=(r=>(r.HARD="HARD",r.SOFT="SOFT",r))(Jy||{}),vL=(o=>(o.Dependency="Dependency",o.PeerDependency="PeerDependency",o.PeerDependencyMeta="PeerDependencyMeta",o))(vL||{}),DL=(o=>(o.Inactive="inactive",o.Redundant="redundant",o.Active="active",o))(DL||{})});var de={};Kt(de,{LogLevel:()=>uS,Style:()=>aS,Type:()=>yt,addLogFilterSupport:()=>zI,applyColor:()=>Ks,applyHyperlink:()=>Xy,applyStyle:()=>md,json:()=>yd,jsonOrPretty:()=>_Ze,mark:()=>kL,pretty:()=>Ot,prettyField:()=>zu,prettyList:()=>bL,prettyTruncatedLocatorList:()=>cS,stripAnsi:()=>zy.default,supportsColor:()=>lS,supportsHyperlinks:()=>xL,tuple:()=>_c});function Bne(t){let e=["KiB","MiB","GiB","TiB"],r=e.length;for(;r>1&&t<1024**r;)r-=1;let o=1024**r;return`${Math.floor(t*100/o)/100} ${e[r-1]}`}function _c(t,e){return[e,t]}function md(t,e,r){return t.get("enableColors")&&r&2&&(e=JI.default.bold(e)),e}function Ks(t,e,r){if(!t.get("enableColors"))return e;let o=OZe.get(r);if(o===null)return e;let a=typeof o>"u"?r:SL.level>=3?o[0]:o[1],n=typeof a=="number"?PL.ansi256(a):a.startsWith("#")?PL.hex(a):PL[a];if(typeof n!="function")throw new Error(`Invalid format type ${a}`);return n(e)}function Xy(t,e,r){return t.get("enableHyperlinks")?UZe?`\x1B]8;;${r}\x1B\\${e}\x1B]8;;\x1B\\`:`\x1B]8;;${r}\x07${e}\x1B]8;;\x07`:e}function Ot(t,e,r){if(e===null)return Ks(t,"null",yt.NULL);if(Object.hasOwn(oS,r))return oS[r].pretty(t,e);if(typeof e!="string")throw new Error(`Assertion failed: Expected the value to be a string, got ${typeof e}`);return Ks(t,e,r)}function bL(t,e,r,{separator:o=", "}={}){return[...e].map(a=>Ot(t,a,r)).join(o)}function yd(t,e){if(t===null)return null;if(Object.hasOwn(oS,e))return oS[e].json(t);if(typeof t!="string")throw new Error(`Assertion failed: Expected the value to be a string, got ${typeof t}`);return t}function _Ze(t,e,[r,o]){return t?yd(r,o):Ot(e,r,o)}function kL(t){return{Check:Ks(t,"\u2713","green"),Cross:Ks(t,"\u2718","red"),Question:Ks(t,"?","cyan")}}function zu(t,{label:e,value:[r,o]}){return`${Ot(t,e,yt.CODE)}: ${Ot(t,r,o)}`}function cS(t,e,r){let o=[],a=[...e],n=r;for(;a.length>0;){let h=a[0],E=`${jr(t,h)}, `,I=QL(h).length+2;if(o.length>0&&nh).join("").slice(0,-2);let u="X".repeat(a.length.toString().length),A=`and ${u} more.`,p=a.length;for(;o.length>1&&nh).join(""),A.replace(u,Ot(t,p,yt.NUMBER))].join("")}function zI(t,{configuration:e}){let r=e.get("logFilters"),o=new Map,a=new Map,n=[];for(let I of r){let v=I.get("level");if(typeof v>"u")continue;let b=I.get("code");typeof b<"u"&&o.set(b,v);let C=I.get("text");typeof C<"u"&&a.set(C,v);let T=I.get("pattern");typeof T<"u"&&n.push([vne.default.matcher(T,{contains:!0}),v])}n.reverse();let u=(I,v,b)=>{if(I===null||I===0)return b;let C=a.size>0||n.length>0?(0,zy.default)(v):v;if(a.size>0){let T=a.get(C);if(typeof T<"u")return T??b}if(n.length>0){for(let[T,L]of n)if(T(C))return L??b}if(o.size>0){let T=o.get(Wu(I));if(typeof T<"u")return T??b}return b},A=t.reportInfo,p=t.reportWarning,h=t.reportError,E=function(I,v,b,C){switch(u(v,b,C)){case"info":A.call(I,v,b);break;case"warning":p.call(I,v??0,b);break;case"error":h.call(I,v??0,b);break}};t.reportInfo=function(...I){return E(this,...I,"info")},t.reportWarning=function(...I){return E(this,...I,"warning")},t.reportError=function(...I){return E(this,...I,"error")}}var JI,KI,vne,zy,Dne,yt,aS,SL,lS,xL,PL,OZe,So,oS,UZe,uS,ql=Et(()=>{Pt();JI=$e(vN()),KI=$e(ed());qt();vne=$e(Zo()),zy=$e(MP()),Dne=Be("util");pP();xo();yt={NO_HINT:"NO_HINT",ID:"ID",NULL:"NULL",SCOPE:"SCOPE",NAME:"NAME",RANGE:"RANGE",REFERENCE:"REFERENCE",NUMBER:"NUMBER",PATH:"PATH",URL:"URL",ADDED:"ADDED",REMOVED:"REMOVED",CODE:"CODE",INSPECT:"INSPECT",DURATION:"DURATION",SIZE:"SIZE",SIZE_DIFF:"SIZE_DIFF",IDENT:"IDENT",DESCRIPTOR:"DESCRIPTOR",LOCATOR:"LOCATOR",RESOLUTION:"RESOLUTION",DEPENDENT:"DEPENDENT",PACKAGE_EXTENSION:"PACKAGE_EXTENSION",SETTING:"SETTING",MARKDOWN:"MARKDOWN",MARKDOWN_INLINE:"MARKDOWN_INLINE"},aS=(e=>(e[e.BOLD=2]="BOLD",e))(aS||{}),SL=KI.default.GITHUB_ACTIONS?{level:2}:JI.default.supportsColor?{level:JI.default.supportsColor.level}:{level:0},lS=SL.level!==0,xL=lS&&!KI.default.GITHUB_ACTIONS&&!KI.default.CIRCLE&&!KI.default.GITLAB,PL=new JI.default.Instance(SL),OZe=new Map([[yt.NO_HINT,null],[yt.NULL,["#a853b5",129]],[yt.SCOPE,["#d75f00",166]],[yt.NAME,["#d7875f",173]],[yt.RANGE,["#00afaf",37]],[yt.REFERENCE,["#87afff",111]],[yt.NUMBER,["#ffd700",220]],[yt.PATH,["#d75fd7",170]],[yt.URL,["#d75fd7",170]],[yt.ADDED,["#5faf00",70]],[yt.REMOVED,["#ff3131",160]],[yt.CODE,["#87afff",111]],[yt.SIZE,["#ffd700",220]]]),So=t=>t;oS={[yt.ID]:So({pretty:(t,e)=>typeof e=="number"?Ks(t,`${e}`,yt.NUMBER):Ks(t,e,yt.CODE),json:t=>t}),[yt.INSPECT]:So({pretty:(t,e)=>(0,Dne.inspect)(e,{depth:1/0,colors:t.get("enableColors"),compact:!0,breakLength:1/0}),json:t=>t}),[yt.NUMBER]:So({pretty:(t,e)=>Ks(t,`${e}`,yt.NUMBER),json:t=>t}),[yt.IDENT]:So({pretty:(t,e)=>cs(t,e),json:t=>fn(t)}),[yt.LOCATOR]:So({pretty:(t,e)=>jr(t,e),json:t=>xa(t)}),[yt.DESCRIPTOR]:So({pretty:(t,e)=>qn(t,e),json:t=>Sa(t)}),[yt.RESOLUTION]:So({pretty:(t,{descriptor:e,locator:r})=>XI(t,e,r),json:({descriptor:t,locator:e})=>({descriptor:Sa(t),locator:e!==null?xa(e):null})}),[yt.DEPENDENT]:So({pretty:(t,{locator:e,descriptor:r})=>FL(t,e,r),json:({locator:t,descriptor:e})=>({locator:xa(t),descriptor:Sa(e)})}),[yt.PACKAGE_EXTENSION]:So({pretty:(t,e)=>{switch(e.type){case"Dependency":return`${cs(t,e.parentDescriptor)} \u27A4 ${Ks(t,"dependencies",yt.CODE)} \u27A4 ${cs(t,e.descriptor)}`;case"PeerDependency":return`${cs(t,e.parentDescriptor)} \u27A4 ${Ks(t,"peerDependencies",yt.CODE)} \u27A4 ${cs(t,e.descriptor)}`;case"PeerDependencyMeta":return`${cs(t,e.parentDescriptor)} \u27A4 ${Ks(t,"peerDependenciesMeta",yt.CODE)} \u27A4 ${cs(t,Js(e.selector))} \u27A4 ${Ks(t,e.key,yt.CODE)}`;default:throw new Error(`Assertion failed: Unsupported package extension type: ${e.type}`)}},json:t=>{switch(t.type){case"Dependency":return`${fn(t.parentDescriptor)} > ${fn(t.descriptor)}`;case"PeerDependency":return`${fn(t.parentDescriptor)} >> ${fn(t.descriptor)}`;case"PeerDependencyMeta":return`${fn(t.parentDescriptor)} >> ${t.selector} / ${t.key}`;default:throw new Error(`Assertion failed: Unsupported package extension type: ${t.type}`)}}}),[yt.SETTING]:So({pretty:(t,e)=>(t.get(e),Xy(t,Ks(t,e,yt.CODE),`https://yarnpkg.com/configuration/yarnrc#${e}`)),json:t=>t}),[yt.DURATION]:So({pretty:(t,e)=>{if(e>1e3*60){let r=Math.floor(e/1e3/60),o=Math.ceil((e-r*60*1e3)/1e3);return o===0?`${r}m`:`${r}m ${o}s`}else{let r=Math.floor(e/1e3),o=e-r*1e3;return o===0?`${r}s`:`${r}s ${o}ms`}},json:t=>t}),[yt.SIZE]:So({pretty:(t,e)=>Ks(t,Bne(e),yt.NUMBER),json:t=>t}),[yt.SIZE_DIFF]:So({pretty:(t,e)=>{let r=e>=0?"+":"-",o=r==="+"?yt.REMOVED:yt.ADDED;return Ks(t,`${r} ${Bne(Math.max(Math.abs(e),1))}`,o)},json:t=>t}),[yt.PATH]:So({pretty:(t,e)=>Ks(t,ue.fromPortablePath(e),yt.PATH),json:t=>ue.fromPortablePath(t)}),[yt.MARKDOWN]:So({pretty:(t,{text:e,format:r,paragraphs:o})=>Do(e,{format:r,paragraphs:o}),json:({text:t})=>t}),[yt.MARKDOWN_INLINE]:So({pretty:(t,e)=>(e=e.replace(/(`+)((?:.|[\n])*?)\1/g,(r,o,a)=>Ot(t,o+a+o,yt.CODE)),e=e.replace(/(\*\*)((?:.|[\n])*?)\1/g,(r,o,a)=>md(t,a,2)),e),json:t=>t})};UZe=!!process.env.KONSOLE_VERSION;uS=(a=>(a.Error="error",a.Warning="warning",a.Info="info",a.Discard="discard",a))(uS||{})});var Pne=_(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});Zy.splitWhen=Zy.flatten=void 0;function HZe(t){return t.reduce((e,r)=>[].concat(e,r),[])}Zy.flatten=HZe;function jZe(t,e){let r=[[]],o=0;for(let a of t)e(a)?(o++,r[o]=[]):r[o].push(a);return r}Zy.splitWhen=jZe});var Sne=_(AS=>{"use strict";Object.defineProperty(AS,"__esModule",{value:!0});AS.isEnoentCodeError=void 0;function qZe(t){return t.code==="ENOENT"}AS.isEnoentCodeError=qZe});var xne=_(fS=>{"use strict";Object.defineProperty(fS,"__esModule",{value:!0});fS.createDirentFromStats=void 0;var TL=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function GZe(t,e){return new TL(t,e)}fS.createDirentFromStats=GZe});var bne=_(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.removeLeadingDotSegment=Xu.escape=Xu.makeAbsolute=Xu.unixify=void 0;var YZe=Be("path"),WZe=2,VZe=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;function KZe(t){return t.replace(/\\/g,"/")}Xu.unixify=KZe;function JZe(t,e){return YZe.resolve(t,e)}Xu.makeAbsolute=JZe;function zZe(t){return t.replace(VZe,"\\$2")}Xu.escape=zZe;function XZe(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(WZe)}return t}Xu.removeLeadingDotSegment=XZe});var Qne=_((xRt,kne)=>{kne.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var Rne=_((bRt,Tne)=>{var ZZe=Qne(),Fne={"{":"}","(":")","[":"]"},$Ze=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,o=-2,a=-2,n=-2,u=-2;ee&&(u===-1||u>o||(u=t.indexOf("\\",e),u===-1||u>o)))||a!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(a=t.indexOf("}",e),a>e&&(u=t.indexOf("\\",e),u===-1||u>a))||n!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(n=t.indexOf(")",e),n>e&&(u=t.indexOf("\\",e),u===-1||u>n))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(rr&&(u=t.indexOf("\\",r),u===-1||u>n))))return!0;if(t[e]==="\\"){var A=t[e+1];e+=2;var p=Fne[A];if(p){var h=t.indexOf(p,e);h!==-1&&(e=h+1)}if(t[e]==="!")return!0}else e++}return!1},e$e=function(t){if(t[0]==="!")return!0;for(var e=0;e{"use strict";var t$e=Rne(),r$e=Be("path").posix.dirname,n$e=Be("os").platform()==="win32",RL="/",i$e=/\\/g,s$e=/[\{\[].*[\}\]]$/,o$e=/(^|[^\\])([\{\[]|\([^\)]+$)/,a$e=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Nne.exports=function(e,r){var o=Object.assign({flipBackslashes:!0},r);o.flipBackslashes&&n$e&&e.indexOf(RL)<0&&(e=e.replace(i$e,RL)),s$e.test(e)&&(e+=RL),e+="a";do e=r$e(e);while(t$e(e)||o$e.test(e));return e.replace(a$e,"$1")}});var Gne=_(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.matchAny=qr.convertPatternsToRe=qr.makeRe=qr.getPatternParts=qr.expandBraceExpansion=qr.expandPatternsWithBraceExpansion=qr.isAffectDepthOfReadingPattern=qr.endsWithSlashGlobStar=qr.hasGlobStar=qr.getBaseDirectory=qr.isPatternRelatedToParentDirectory=qr.getPatternsOutsideCurrentDirectory=qr.getPatternsInsideCurrentDirectory=qr.getPositivePatterns=qr.getNegativePatterns=qr.isPositivePattern=qr.isNegativePattern=qr.convertToNegativePattern=qr.convertToPositivePattern=qr.isDynamicPattern=qr.isStaticPattern=void 0;var l$e=Be("path"),c$e=Lne(),NL=Zo(),Mne="**",u$e="\\",A$e=/[*?]|^!/,f$e=/\[[^[]*]/,p$e=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,h$e=/[!*+?@]\([^(]*\)/,g$e=/,|\.\./;function One(t,e={}){return!Une(t,e)}qr.isStaticPattern=One;function Une(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(u$e)||A$e.test(t)||f$e.test(t)||p$e.test(t)||e.extglob!==!1&&h$e.test(t)||e.braceExpansion!==!1&&d$e(t))}qr.isDynamicPattern=Une;function d$e(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let o=t.slice(e,r);return g$e.test(o)}function m$e(t){return pS(t)?t.slice(1):t}qr.convertToPositivePattern=m$e;function y$e(t){return"!"+t}qr.convertToNegativePattern=y$e;function pS(t){return t.startsWith("!")&&t[1]!=="("}qr.isNegativePattern=pS;function _ne(t){return!pS(t)}qr.isPositivePattern=_ne;function E$e(t){return t.filter(pS)}qr.getNegativePatterns=E$e;function C$e(t){return t.filter(_ne)}qr.getPositivePatterns=C$e;function w$e(t){return t.filter(e=>!LL(e))}qr.getPatternsInsideCurrentDirectory=w$e;function I$e(t){return t.filter(LL)}qr.getPatternsOutsideCurrentDirectory=I$e;function LL(t){return t.startsWith("..")||t.startsWith("./..")}qr.isPatternRelatedToParentDirectory=LL;function B$e(t){return c$e(t,{flipBackslashes:!1})}qr.getBaseDirectory=B$e;function v$e(t){return t.includes(Mne)}qr.hasGlobStar=v$e;function Hne(t){return t.endsWith("/"+Mne)}qr.endsWithSlashGlobStar=Hne;function D$e(t){let e=l$e.basename(t);return Hne(t)||One(e)}qr.isAffectDepthOfReadingPattern=D$e;function P$e(t){return t.reduce((e,r)=>e.concat(jne(r)),[])}qr.expandPatternsWithBraceExpansion=P$e;function jne(t){return NL.braces(t,{expand:!0,nodupes:!0})}qr.expandBraceExpansion=jne;function S$e(t,e){let{parts:r}=NL.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}qr.getPatternParts=S$e;function qne(t,e){return NL.makeRe(t,e)}qr.makeRe=qne;function x$e(t,e){return t.map(r=>qne(r,e))}qr.convertPatternsToRe=x$e;function b$e(t,e){return e.some(r=>r.test(t))}qr.matchAny=b$e});var Kne=_((FRt,Vne)=>{"use strict";var k$e=Be("stream"),Yne=k$e.PassThrough,Q$e=Array.prototype.slice;Vne.exports=F$e;function F$e(){let t=[],e=Q$e.call(arguments),r=!1,o=e[e.length-1];o&&!Array.isArray(o)&&o.pipe==null?e.pop():o={};let a=o.end!==!1,n=o.pipeError===!0;o.objectMode==null&&(o.objectMode=!0),o.highWaterMark==null&&(o.highWaterMark=64*1024);let u=Yne(o);function A(){for(let E=0,I=arguments.length;E0||(r=!1,p())}function b(C){function T(){C.removeListener("merge2UnpipeEnd",T),C.removeListener("end",T),n&&C.removeListener("error",L),v()}function L(U){u.emit("error",U)}if(C._readableState.endEmitted)return v();C.on("merge2UnpipeEnd",T),C.on("end",T),n&&C.on("error",L),C.pipe(u,{end:!1}),C.resume()}for(let C=0;C{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});hS.merge=void 0;var T$e=Kne();function R$e(t){let e=T$e(t);return t.forEach(r=>{r.once("error",o=>e.emit("error",o))}),e.once("close",()=>Jne(t)),e.once("end",()=>Jne(t)),e}hS.merge=R$e;function Jne(t){t.forEach(e=>e.emit("close"))}});var Xne=_($y=>{"use strict";Object.defineProperty($y,"__esModule",{value:!0});$y.isEmpty=$y.isString=void 0;function N$e(t){return typeof t=="string"}$y.isString=N$e;function L$e(t){return t===""}$y.isEmpty=L$e});var Df=_(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.string=bo.stream=bo.pattern=bo.path=bo.fs=bo.errno=bo.array=void 0;var M$e=Pne();bo.array=M$e;var O$e=Sne();bo.errno=O$e;var U$e=xne();bo.fs=U$e;var _$e=bne();bo.path=_$e;var H$e=Gne();bo.pattern=H$e;var j$e=zne();bo.stream=j$e;var q$e=Xne();bo.string=q$e});var eie=_(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});ko.convertPatternGroupToTask=ko.convertPatternGroupsToTasks=ko.groupPatternsByBaseDirectory=ko.getNegativePatternsAsPositive=ko.getPositivePatterns=ko.convertPatternsToTasks=ko.generate=void 0;var Pf=Df();function G$e(t,e){let r=Zne(t),o=$ne(t,e.ignore),a=r.filter(p=>Pf.pattern.isStaticPattern(p,e)),n=r.filter(p=>Pf.pattern.isDynamicPattern(p,e)),u=ML(a,o,!1),A=ML(n,o,!0);return u.concat(A)}ko.generate=G$e;function ML(t,e,r){let o=[],a=Pf.pattern.getPatternsOutsideCurrentDirectory(t),n=Pf.pattern.getPatternsInsideCurrentDirectory(t),u=OL(a),A=OL(n);return o.push(...UL(u,e,r)),"."in A?o.push(_L(".",n,e,r)):o.push(...UL(A,e,r)),o}ko.convertPatternsToTasks=ML;function Zne(t){return Pf.pattern.getPositivePatterns(t)}ko.getPositivePatterns=Zne;function $ne(t,e){return Pf.pattern.getNegativePatterns(t).concat(e).map(Pf.pattern.convertToPositivePattern)}ko.getNegativePatternsAsPositive=$ne;function OL(t){let e={};return t.reduce((r,o)=>{let a=Pf.pattern.getBaseDirectory(o);return a in r?r[a].push(o):r[a]=[o],r},e)}ko.groupPatternsByBaseDirectory=OL;function UL(t,e,r){return Object.keys(t).map(o=>_L(o,t[o],e,r))}ko.convertPatternGroupsToTasks=UL;function _L(t,e,r,o){return{dynamic:o,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(Pf.pattern.convertToNegativePattern))}}ko.convertPatternGroupToTask=_L});var rie=_(eE=>{"use strict";Object.defineProperty(eE,"__esModule",{value:!0});eE.removeDuplicateSlashes=eE.transform=void 0;var Y$e=/(?!^)\/{2,}/g;function W$e(t){return t.map(e=>tie(e))}eE.transform=W$e;function tie(t){return t.replace(Y$e,"/")}eE.removeDuplicateSlashes=tie});var iie=_(gS=>{"use strict";Object.defineProperty(gS,"__esModule",{value:!0});gS.read=void 0;function V$e(t,e,r){e.fs.lstat(t,(o,a)=>{if(o!==null){nie(r,o);return}if(!a.isSymbolicLink()||!e.followSymbolicLink){HL(r,a);return}e.fs.stat(t,(n,u)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){nie(r,n);return}HL(r,a);return}e.markSymbolicLink&&(u.isSymbolicLink=()=>!0),HL(r,u)})})}gS.read=V$e;function nie(t,e){t(e)}function HL(t,e){t(null,e)}});var sie=_(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});dS.read=void 0;function K$e(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let o=e.fs.statSync(t);return e.markSymbolicLink&&(o.isSymbolicLink=()=>!0),o}catch(o){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw o}}dS.read=K$e});var oie=_(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});zp.createFileSystemAdapter=zp.FILE_SYSTEM_ADAPTER=void 0;var mS=Be("fs");zp.FILE_SYSTEM_ADAPTER={lstat:mS.lstat,stat:mS.stat,lstatSync:mS.lstatSync,statSync:mS.statSync};function J$e(t){return t===void 0?zp.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},zp.FILE_SYSTEM_ADAPTER),t)}zp.createFileSystemAdapter=J$e});var aie=_(qL=>{"use strict";Object.defineProperty(qL,"__esModule",{value:!0});var z$e=oie(),jL=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=z$e.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};qL.default=jL});var Ed=_(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});Xp.statSync=Xp.stat=Xp.Settings=void 0;var lie=iie(),X$e=sie(),YL=aie();Xp.Settings=YL.default;function Z$e(t,e,r){if(typeof e=="function"){lie.read(t,WL(),e);return}lie.read(t,WL(e),r)}Xp.stat=Z$e;function $$e(t,e){let r=WL(e);return X$e.read(t,r)}Xp.statSync=$$e;function WL(t={}){return t instanceof YL.default?t:new YL.default(t)}});var uie=_((qRt,cie)=>{cie.exports=eet;function eet(t,e){var r,o,a,n=!0;Array.isArray(t)?(r=[],o=t.length):(a=Object.keys(t),r={},o=a.length);function u(p){function h(){e&&e(p,r),e=null}n?process.nextTick(h):h()}function A(p,h,E){r[p]=E,(--o===0||h)&&u(h)}o?a?a.forEach(function(p){t[p](function(h,E){A(p,h,E)})}):t.forEach(function(p,h){p(function(E,I){A(h,E,I)})}):u(null),n=!1}});var VL=_(ES=>{"use strict";Object.defineProperty(ES,"__esModule",{value:!0});ES.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var yS=process.versions.node.split(".");if(yS[0]===void 0||yS[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var Aie=Number.parseInt(yS[0],10),tet=Number.parseInt(yS[1],10),fie=10,ret=10,net=Aie>fie,iet=Aie===fie&&tet>=ret;ES.IS_SUPPORT_READDIR_WITH_FILE_TYPES=net||iet});var pie=_(CS=>{"use strict";Object.defineProperty(CS,"__esModule",{value:!0});CS.createDirentFromStats=void 0;var KL=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function set(t,e){return new KL(t,e)}CS.createDirentFromStats=set});var JL=_(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});wS.fs=void 0;var oet=pie();wS.fs=oet});var zL=_(IS=>{"use strict";Object.defineProperty(IS,"__esModule",{value:!0});IS.joinPathSegments=void 0;function aet(t,e,r){return t.endsWith(r)?t+e:t+r+e}IS.joinPathSegments=aet});var Eie=_(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});Zp.readdir=Zp.readdirWithFileTypes=Zp.read=void 0;var cet=Ed(),hie=uie(),uet=VL(),gie=JL(),die=zL();function Aet(t,e,r){if(!e.stats&&uet.IS_SUPPORT_READDIR_WITH_FILE_TYPES){mie(t,e,r);return}yie(t,e,r)}Zp.read=Aet;function mie(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(o,a)=>{if(o!==null){BS(r,o);return}let n=a.map(A=>({dirent:A,name:A.name,path:die.joinPathSegments(t,A.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){XL(r,n);return}let u=n.map(A=>fet(A,e));hie(u,(A,p)=>{if(A!==null){BS(r,A);return}XL(r,p)})})}Zp.readdirWithFileTypes=mie;function fet(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(o,a)=>{if(o!==null){if(e.throwErrorOnBrokenSymbolicLink){r(o);return}r(null,t);return}t.dirent=gie.fs.createDirentFromStats(t.name,a),r(null,t)})}}function yie(t,e,r){e.fs.readdir(t,(o,a)=>{if(o!==null){BS(r,o);return}let n=a.map(u=>{let A=die.joinPathSegments(t,u,e.pathSegmentSeparator);return p=>{cet.stat(A,e.fsStatSettings,(h,E)=>{if(h!==null){p(h);return}let I={name:u,path:A,dirent:gie.fs.createDirentFromStats(u,E)};e.stats&&(I.stats=E),p(null,I)})}});hie(n,(u,A)=>{if(u!==null){BS(r,u);return}XL(r,A)})})}Zp.readdir=yie;function BS(t,e){t(e)}function XL(t,e){t(null,e)}});var vie=_($p=>{"use strict";Object.defineProperty($p,"__esModule",{value:!0});$p.readdir=$p.readdirWithFileTypes=$p.read=void 0;var pet=Ed(),het=VL(),Cie=JL(),wie=zL();function get(t,e){return!e.stats&&het.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Iie(t,e):Bie(t,e)}$p.read=get;function Iie(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(o=>{let a={dirent:o,name:o.name,path:wie.joinPathSegments(t,o.name,e.pathSegmentSeparator)};if(a.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let n=e.fs.statSync(a.path);a.dirent=Cie.fs.createDirentFromStats(a.name,n)}catch(n){if(e.throwErrorOnBrokenSymbolicLink)throw n}return a})}$p.readdirWithFileTypes=Iie;function Bie(t,e){return e.fs.readdirSync(t).map(o=>{let a=wie.joinPathSegments(t,o,e.pathSegmentSeparator),n=pet.statSync(a,e.fsStatSettings),u={name:o,path:a,dirent:Cie.fs.createDirentFromStats(o,n)};return e.stats&&(u.stats=n),u})}$p.readdir=Bie});var Die=_(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.createFileSystemAdapter=eh.FILE_SYSTEM_ADAPTER=void 0;var tE=Be("fs");eh.FILE_SYSTEM_ADAPTER={lstat:tE.lstat,stat:tE.stat,lstatSync:tE.lstatSync,statSync:tE.statSync,readdir:tE.readdir,readdirSync:tE.readdirSync};function det(t){return t===void 0?eh.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},eh.FILE_SYSTEM_ADAPTER),t)}eh.createFileSystemAdapter=det});var Pie=_($L=>{"use strict";Object.defineProperty($L,"__esModule",{value:!0});var met=Be("path"),yet=Ed(),Eet=Die(),ZL=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=Eet.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,met.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new yet.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};$L.default=ZL});var vS=_(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.Settings=th.scandirSync=th.scandir=void 0;var Sie=Eie(),Cet=vie(),eM=Pie();th.Settings=eM.default;function wet(t,e,r){if(typeof e=="function"){Sie.read(t,tM(),e);return}Sie.read(t,tM(e),r)}th.scandir=wet;function Iet(t,e){let r=tM(e);return Cet.read(t,r)}th.scandirSync=Iet;function tM(t={}){return t instanceof eM.default?t:new eM.default(t)}});var bie=_(($Rt,xie)=>{"use strict";function Bet(t){var e=new t,r=e;function o(){var n=e;return n.next?e=n.next:(e=new t,r=e),n.next=null,n}function a(n){r.next=n,r=n}return{get:o,release:a}}xie.exports=Bet});var Qie=_((eNt,rM)=>{"use strict";var vet=bie();function kie(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),r<1)throw new Error("fastqueue concurrency must be greater than 1");var o=vet(Det),a=null,n=null,u=0,A=null,p={push:T,drain:Gl,saturated:Gl,pause:E,paused:!1,concurrency:r,running:h,resume:b,idle:C,length:I,getQueue:v,unshift:L,empty:Gl,kill:J,killAndDrain:te,error:le};return p;function h(){return u}function E(){p.paused=!0}function I(){for(var pe=a,Ae=0;pe;)pe=pe.next,Ae++;return Ae}function v(){for(var pe=a,Ae=[];pe;)Ae.push(pe.value),pe=pe.next;return Ae}function b(){if(!!p.paused){p.paused=!1;for(var pe=0;pe{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.joinPathSegments=Zu.replacePathSegmentSeparator=Zu.isAppliedFilter=Zu.isFatalError=void 0;function xet(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}Zu.isFatalError=xet;function bet(t,e){return t===null||t(e)}Zu.isAppliedFilter=bet;function ket(t,e){return t.split(/[/\\]/).join(e)}Zu.replacePathSegmentSeparator=ket;function Qet(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}Zu.joinPathSegments=Qet});var sM=_(iM=>{"use strict";Object.defineProperty(iM,"__esModule",{value:!0});var Fet=DS(),nM=class{constructor(e,r){this._root=e,this._settings=r,this._root=Fet.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};iM.default=nM});var lM=_(aM=>{"use strict";Object.defineProperty(aM,"__esModule",{value:!0});var Tet=Be("events"),Ret=vS(),Net=Qie(),PS=DS(),Let=sM(),oM=class extends Let.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=Ret.scandir,this._emitter=new Tet.EventEmitter,this._queue=Net(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let o={directory:e,base:r};this._queue.push(o,a=>{a!==null&&this._handleError(a)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(o,a)=>{if(o!==null){r(o,void 0);return}for(let n of a)this._handleEntry(n,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!PS.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let o=e.path;r!==void 0&&(e.path=PS.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),PS.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&PS.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(o,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};aM.default=oM});var Fie=_(uM=>{"use strict";Object.defineProperty(uM,"__esModule",{value:!0});var Met=lM(),cM=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new Met.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{Oet(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{Uet(e,this._storage)}),this._reader.read()}};uM.default=cM;function Oet(t,e){t(e)}function Uet(t,e){t(null,e)}});var Tie=_(fM=>{"use strict";Object.defineProperty(fM,"__esModule",{value:!0});var _et=Be("stream"),Het=lM(),AM=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new Het.default(this._root,this._settings),this._stream=new _et.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};fM.default=AM});var Rie=_(hM=>{"use strict";Object.defineProperty(hM,"__esModule",{value:!0});var jet=vS(),SS=DS(),qet=sM(),pM=class extends qet.default{constructor(){super(...arguments),this._scandir=jet.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let o=this._scandir(e,this._settings.fsScandirSettings);for(let a of o)this._handleEntry(a,r)}catch(o){this._handleError(o)}}_handleError(e){if(!!SS.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let o=e.path;r!==void 0&&(e.path=SS.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),SS.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&SS.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(o,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};hM.default=pM});var Nie=_(dM=>{"use strict";Object.defineProperty(dM,"__esModule",{value:!0});var Get=Rie(),gM=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new Get.default(this._root,this._settings)}read(){return this._reader.read()}};dM.default=gM});var Lie=_(yM=>{"use strict";Object.defineProperty(yM,"__esModule",{value:!0});var Yet=Be("path"),Wet=vS(),mM=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,Yet.sep),this.fsScandirSettings=new Wet.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};yM.default=mM});var bS=_($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.Settings=$u.walkStream=$u.walkSync=$u.walk=void 0;var Mie=Fie(),Vet=Tie(),Ket=Nie(),EM=Lie();$u.Settings=EM.default;function Jet(t,e,r){if(typeof e=="function"){new Mie.default(t,xS()).read(e);return}new Mie.default(t,xS(e)).read(r)}$u.walk=Jet;function zet(t,e){let r=xS(e);return new Ket.default(t,r).read()}$u.walkSync=zet;function Xet(t,e){let r=xS(e);return new Vet.default(t,r).read()}$u.walkStream=Xet;function xS(t={}){return t instanceof EM.default?t:new EM.default(t)}});var kS=_(wM=>{"use strict";Object.defineProperty(wM,"__esModule",{value:!0});var Zet=Be("path"),$et=Ed(),Oie=Df(),CM=class{constructor(e){this._settings=e,this._fsStatSettings=new $et.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return Zet.resolve(this._settings.cwd,e)}_makeEntry(e,r){let o={name:r,path:r,dirent:Oie.fs.createDirentFromStats(r,e)};return this._settings.stats&&(o.stats=e),o}_isFatalError(e){return!Oie.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};wM.default=CM});var vM=_(BM=>{"use strict";Object.defineProperty(BM,"__esModule",{value:!0});var ett=Be("stream"),ttt=Ed(),rtt=bS(),ntt=kS(),IM=class extends ntt.default{constructor(){super(...arguments),this._walkStream=rtt.walkStream,this._stat=ttt.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let o=e.map(this._getFullEntryPath,this),a=new ett.PassThrough({objectMode:!0});a._write=(n,u,A)=>this._getEntry(o[n],e[n],r).then(p=>{p!==null&&r.entryFilter(p)&&a.push(p),n===o.length-1&&a.end(),A()}).catch(A);for(let n=0;nthis._makeEntry(a,r)).catch(a=>{if(o.errorFilter(a))return null;throw a})}_getStat(e){return new Promise((r,o)=>{this._stat(e,this._fsStatSettings,(a,n)=>a===null?r(n):o(a))})}};BM.default=IM});var Uie=_(PM=>{"use strict";Object.defineProperty(PM,"__esModule",{value:!0});var itt=bS(),stt=kS(),ott=vM(),DM=class extends stt.default{constructor(){super(...arguments),this._walkAsync=itt.walk,this._readerStream=new ott.default(this._settings)}dynamic(e,r){return new Promise((o,a)=>{this._walkAsync(e,r,(n,u)=>{n===null?o(u):a(n)})})}async static(e,r){let o=[],a=this._readerStream.static(e,r);return new Promise((n,u)=>{a.once("error",u),a.on("data",A=>o.push(A)),a.once("end",()=>n(o))})}};PM.default=DM});var _ie=_(xM=>{"use strict";Object.defineProperty(xM,"__esModule",{value:!0});var rE=Df(),SM=class{constructor(e,r,o){this._patterns=e,this._settings=r,this._micromatchOptions=o,this._storage=[],this._fillStorage()}_fillStorage(){let e=rE.pattern.expandPatternsWithBraceExpansion(this._patterns);for(let r of e){let o=this._getPatternSegments(r),a=this._splitSegmentsIntoSections(o);this._storage.push({complete:a.length<=1,pattern:r,segments:o,sections:a})}}_getPatternSegments(e){return rE.pattern.getPatternParts(e,this._micromatchOptions).map(o=>rE.pattern.isDynamicPattern(o,this._settings)?{dynamic:!0,pattern:o,patternRe:rE.pattern.makeRe(o,this._micromatchOptions)}:{dynamic:!1,pattern:o})}_splitSegmentsIntoSections(e){return rE.array.splitWhen(e,r=>r.dynamic&&rE.pattern.hasGlobStar(r.pattern))}};xM.default=SM});var Hie=_(kM=>{"use strict";Object.defineProperty(kM,"__esModule",{value:!0});var att=_ie(),bM=class extends att.default{match(e){let r=e.split("/"),o=r.length,a=this._storage.filter(n=>!n.complete||n.segments.length>o);for(let n of a){let u=n.sections[0];if(!n.complete&&o>u.length||r.every((p,h)=>{let E=n.segments[h];return!!(E.dynamic&&E.patternRe.test(p)||!E.dynamic&&E.pattern===p)}))return!0}return!1}};kM.default=bM});var jie=_(FM=>{"use strict";Object.defineProperty(FM,"__esModule",{value:!0});var QS=Df(),ltt=Hie(),QM=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,o){let a=this._getMatcher(r),n=this._getNegativePatternsRe(o);return u=>this._filter(e,u,a,n)}_getMatcher(e){return new ltt.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(QS.pattern.isAffectDepthOfReadingPattern);return QS.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,o,a){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let n=QS.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(n,o)?!1:this._isSkippedByNegativePatterns(n,a)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let o=r.split("/").length;if(e==="")return o;let a=e.split("/").length;return o-a}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!QS.pattern.matchAny(e,r)}};FM.default=QM});var qie=_(RM=>{"use strict";Object.defineProperty(RM,"__esModule",{value:!0});var Cd=Df(),TM=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let o=Cd.pattern.convertPatternsToRe(e,this._micromatchOptions),a=Cd.pattern.convertPatternsToRe(r,this._micromatchOptions);return n=>this._filter(n,o,a)}_filter(e,r,o){if(this._settings.unique&&this._isDuplicateEntry(e)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e)||this._isSkippedByAbsoluteNegativePatterns(e.path,o))return!1;let a=this._settings.baseNameMatch?e.name:e.path,n=e.dirent.isDirectory(),u=this._isMatchToPatterns(a,r,n)&&!this._isMatchToPatterns(e.path,o,n);return this._settings.unique&&u&&this._createIndexRecord(e),u}_isDuplicateEntry(e){return this.index.has(e.path)}_createIndexRecord(e){this.index.set(e.path,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isSkippedByAbsoluteNegativePatterns(e,r){if(!this._settings.absolute)return!1;let o=Cd.path.makeAbsolute(this._settings.cwd,e);return Cd.pattern.matchAny(o,r)}_isMatchToPatterns(e,r,o){let a=Cd.path.removeLeadingDotSegment(e),n=Cd.pattern.matchAny(a,r);return!n&&o?Cd.pattern.matchAny(a+"/",r):n}};RM.default=TM});var Gie=_(LM=>{"use strict";Object.defineProperty(LM,"__esModule",{value:!0});var ctt=Df(),NM=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return ctt.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};LM.default=NM});var Wie=_(OM=>{"use strict";Object.defineProperty(OM,"__esModule",{value:!0});var Yie=Df(),MM=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=Yie.path.makeAbsolute(this._settings.cwd,r),r=Yie.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};OM.default=MM});var TS=_(_M=>{"use strict";Object.defineProperty(_M,"__esModule",{value:!0});var utt=Be("path"),Att=jie(),ftt=qie(),ptt=Gie(),htt=Wie(),UM=class{constructor(e){this._settings=e,this.errorFilter=new ptt.default(this._settings),this.entryFilter=new ftt.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new Att.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new htt.default(this._settings)}_getRootDirectory(e){return utt.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};_M.default=UM});var Vie=_(jM=>{"use strict";Object.defineProperty(jM,"__esModule",{value:!0});var gtt=Uie(),dtt=TS(),HM=class extends dtt.default{constructor(){super(...arguments),this._reader=new gtt.default(this._settings)}async read(e){let r=this._getRootDirectory(e),o=this._getReaderOptions(e);return(await this.api(r,e,o)).map(n=>o.transform(n))}api(e,r,o){return r.dynamic?this._reader.dynamic(e,o):this._reader.static(r.patterns,o)}};jM.default=HM});var Kie=_(GM=>{"use strict";Object.defineProperty(GM,"__esModule",{value:!0});var mtt=Be("stream"),ytt=vM(),Ett=TS(),qM=class extends Ett.default{constructor(){super(...arguments),this._reader=new ytt.default(this._settings)}read(e){let r=this._getRootDirectory(e),o=this._getReaderOptions(e),a=this.api(r,e,o),n=new mtt.Readable({objectMode:!0,read:()=>{}});return a.once("error",u=>n.emit("error",u)).on("data",u=>n.emit("data",o.transform(u))).once("end",()=>n.emit("end")),n.once("close",()=>a.destroy()),n}api(e,r,o){return r.dynamic?this._reader.dynamic(e,o):this._reader.static(r.patterns,o)}};GM.default=qM});var Jie=_(WM=>{"use strict";Object.defineProperty(WM,"__esModule",{value:!0});var Ctt=Ed(),wtt=bS(),Itt=kS(),YM=class extends Itt.default{constructor(){super(...arguments),this._walkSync=wtt.walkSync,this._statSync=Ctt.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let o=[];for(let a of e){let n=this._getFullEntryPath(a),u=this._getEntry(n,a,r);u===null||!r.entryFilter(u)||o.push(u)}return o}_getEntry(e,r,o){try{let a=this._getStat(e);return this._makeEntry(a,r)}catch(a){if(o.errorFilter(a))return null;throw a}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};WM.default=YM});var zie=_(KM=>{"use strict";Object.defineProperty(KM,"__esModule",{value:!0});var Btt=Jie(),vtt=TS(),VM=class extends vtt.default{constructor(){super(...arguments),this._reader=new Btt.default(this._settings)}read(e){let r=this._getRootDirectory(e),o=this._getReaderOptions(e);return this.api(r,e,o).map(o.transform)}api(e,r,o){return r.dynamic?this._reader.dynamic(e,o):this._reader.static(r.patterns,o)}};KM.default=VM});var Xie=_(iE=>{"use strict";Object.defineProperty(iE,"__esModule",{value:!0});iE.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var nE=Be("fs"),Dtt=Be("os"),Ptt=Math.max(Dtt.cpus().length,1);iE.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:nE.lstat,lstatSync:nE.lstatSync,stat:nE.stat,statSync:nE.statSync,readdir:nE.readdir,readdirSync:nE.readdirSync};var JM=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,Ptt),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},iE.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};iE.default=JM});var RS=_((DNt,ese)=>{"use strict";var Zie=eie(),$ie=rie(),Stt=Vie(),xtt=Kie(),btt=zie(),zM=Xie(),wd=Df();async function XM(t,e){sE(t);let r=ZM(t,Stt.default,e),o=await Promise.all(r);return wd.array.flatten(o)}(function(t){function e(u,A){sE(u);let p=ZM(u,btt.default,A);return wd.array.flatten(p)}t.sync=e;function r(u,A){sE(u);let p=ZM(u,xtt.default,A);return wd.stream.merge(p)}t.stream=r;function o(u,A){sE(u);let p=$ie.transform([].concat(u)),h=new zM.default(A);return Zie.generate(p,h)}t.generateTasks=o;function a(u,A){sE(u);let p=new zM.default(A);return wd.pattern.isDynamicPattern(u,p)}t.isDynamicPattern=a;function n(u){return sE(u),wd.path.escape(u)}t.escapePath=n})(XM||(XM={}));function ZM(t,e,r){let o=$ie.transform([].concat(t)),a=new zM.default(r),n=Zie.generate(o,a),u=new e(a);return n.map(u.read,u)}function sE(t){if(![].concat(t).every(o=>wd.string.isString(o)&&!wd.string.isEmpty(o)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}ese.exports=XM});var wn={};Kt(wn,{checksumFile:()=>LS,checksumPattern:()=>MS,makeHash:()=>zs});function zs(...t){let e=(0,NS.createHash)("sha512"),r="";for(let o of t)typeof o=="string"?r+=o:o&&(r&&(e.update(r),r=""),e.update(o));return r&&e.update(r),e.digest("hex")}async function LS(t,{baseFs:e,algorithm:r}={baseFs:oe,algorithm:"sha512"}){let o=await e.openPromise(t,"r");try{let n=Buffer.allocUnsafeSlow(65536),u=(0,NS.createHash)(r),A=0;for(;(A=await e.readPromise(o,n,0,65536))!==0;)u.update(A===65536?n:n.slice(0,A));return u.digest("hex")}finally{await e.closePromise(o)}}async function MS(t,{cwd:e}){let o=(await(0,$M.default)(t,{cwd:ue.fromPortablePath(e),onlyDirectories:!0})).map(A=>`${A}/**/*`),a=await(0,$M.default)([t,...o],{cwd:ue.fromPortablePath(e),onlyFiles:!1});a.sort();let n=await Promise.all(a.map(async A=>{let p=[Buffer.from(A)],h=ue.toPortablePath(A),E=await oe.lstatPromise(h);return E.isSymbolicLink()?p.push(Buffer.from(await oe.readlinkPromise(h))):E.isFile()&&p.push(await oe.readFilePromise(h)),p.join("\0")})),u=(0,NS.createHash)("sha512");for(let A of n)u.update(A);return u.digest("hex")}var NS,$M,rh=Et(()=>{Pt();NS=Be("crypto"),$M=$e(RS())});var W={};Kt(W,{areDescriptorsEqual:()=>sse,areIdentsEqual:()=>r1,areLocatorsEqual:()=>n1,areVirtualPackagesEquivalent:()=>Ott,bindDescriptor:()=>Ltt,bindLocator:()=>Mtt,convertDescriptorToLocator:()=>OS,convertLocatorToDescriptor:()=>tO,convertPackageToLocator:()=>Ttt,convertToIdent:()=>Ftt,convertToManifestRange:()=>Ktt,copyPackage:()=>$I,devirtualizeDescriptor:()=>e1,devirtualizeLocator:()=>t1,ensureDevirtualizedDescriptor:()=>Rtt,ensureDevirtualizedLocator:()=>Ntt,getIdentVendorPath:()=>sO,isPackageCompatible:()=>qS,isVirtualDescriptor:()=>Sf,isVirtualLocator:()=>Hc,makeDescriptor:()=>In,makeIdent:()=>eA,makeLocator:()=>Qs,makeRange:()=>HS,parseDescriptor:()=>nh,parseFileStyleRange:()=>Wtt,parseIdent:()=>Js,parseLocator:()=>xf,parseRange:()=>Id,prettyDependent:()=>FL,prettyDescriptor:()=>qn,prettyIdent:()=>cs,prettyLocator:()=>jr,prettyLocatorNoColors:()=>QL,prettyRange:()=>lE,prettyReference:()=>s1,prettyResolution:()=>XI,prettyWorkspace:()=>o1,renamePackage:()=>rO,slugifyIdent:()=>eO,slugifyLocator:()=>aE,sortDescriptors:()=>cE,stringifyDescriptor:()=>Sa,stringifyIdent:()=>fn,stringifyLocator:()=>xa,tryParseDescriptor:()=>i1,tryParseIdent:()=>ose,tryParseLocator:()=>_S,tryParseRange:()=>Ytt,virtualizeDescriptor:()=>nO,virtualizePackage:()=>iO});function eA(t,e){if(t?.startsWith("@"))throw new Error("Invalid scope: don't prefix it with '@'");return{identHash:zs(t,e),scope:t,name:e}}function In(t,e){return{identHash:t.identHash,scope:t.scope,name:t.name,descriptorHash:zs(t.identHash,e),range:e}}function Qs(t,e){return{identHash:t.identHash,scope:t.scope,name:t.name,locatorHash:zs(t.identHash,e),reference:e}}function Ftt(t){return{identHash:t.identHash,scope:t.scope,name:t.name}}function OS(t){return{identHash:t.identHash,scope:t.scope,name:t.name,locatorHash:t.descriptorHash,reference:t.range}}function tO(t){return{identHash:t.identHash,scope:t.scope,name:t.name,descriptorHash:t.locatorHash,range:t.reference}}function Ttt(t){return{identHash:t.identHash,scope:t.scope,name:t.name,locatorHash:t.locatorHash,reference:t.reference}}function rO(t,e){return{identHash:e.identHash,scope:e.scope,name:e.name,locatorHash:e.locatorHash,reference:e.reference,version:t.version,languageName:t.languageName,linkType:t.linkType,conditions:t.conditions,dependencies:new Map(t.dependencies),peerDependencies:new Map(t.peerDependencies),dependenciesMeta:new Map(t.dependenciesMeta),peerDependenciesMeta:new Map(t.peerDependenciesMeta),bin:new Map(t.bin)}}function $I(t){return rO(t,t)}function nO(t,e){if(e.includes("#"))throw new Error("Invalid entropy");return In(t,`virtual:${e}#${t.range}`)}function iO(t,e){if(e.includes("#"))throw new Error("Invalid entropy");return rO(t,Qs(t,`virtual:${e}#${t.reference}`))}function Sf(t){return t.range.startsWith(ZI)}function Hc(t){return t.reference.startsWith(ZI)}function e1(t){if(!Sf(t))throw new Error("Not a virtual descriptor");return In(t,t.range.replace(US,""))}function t1(t){if(!Hc(t))throw new Error("Not a virtual descriptor");return Qs(t,t.reference.replace(US,""))}function Rtt(t){return Sf(t)?In(t,t.range.replace(US,"")):t}function Ntt(t){return Hc(t)?Qs(t,t.reference.replace(US,"")):t}function Ltt(t,e){return t.range.includes("::")?t:In(t,`${t.range}::${oE.default.stringify(e)}`)}function Mtt(t,e){return t.reference.includes("::")?t:Qs(t,`${t.reference}::${oE.default.stringify(e)}`)}function r1(t,e){return t.identHash===e.identHash}function sse(t,e){return t.descriptorHash===e.descriptorHash}function n1(t,e){return t.locatorHash===e.locatorHash}function Ott(t,e){if(!Hc(t))throw new Error("Invalid package type");if(!Hc(e))throw new Error("Invalid package type");if(!r1(t,e)||t.dependencies.size!==e.dependencies.size)return!1;for(let r of t.dependencies.values()){let o=e.dependencies.get(r.identHash);if(!o||!sse(r,o))return!1}return!0}function Js(t){let e=ose(t);if(!e)throw new Error(`Invalid ident (${t})`);return e}function ose(t){let e=t.match(Utt);if(!e)return null;let[,r,o]=e;return eA(typeof r<"u"?r:null,o)}function nh(t,e=!1){let r=i1(t,e);if(!r)throw new Error(`Invalid descriptor (${t})`);return r}function i1(t,e=!1){let r=e?t.match(_tt):t.match(Htt);if(!r)return null;let[,o,a,n]=r;if(n==="unknown")throw new Error(`Invalid range (${t})`);let u=typeof o<"u"?o:null,A=typeof n<"u"?n:"unknown";return In(eA(u,a),A)}function xf(t,e=!1){let r=_S(t,e);if(!r)throw new Error(`Invalid locator (${t})`);return r}function _S(t,e=!1){let r=e?t.match(jtt):t.match(qtt);if(!r)return null;let[,o,a,n]=r;if(n==="unknown")throw new Error(`Invalid reference (${t})`);let u=typeof o<"u"?o:null,A=typeof n<"u"?n:"unknown";return Qs(eA(u,a),A)}function Id(t,e){let r=t.match(Gtt);if(r===null)throw new Error(`Invalid range (${t})`);let o=typeof r[1]<"u"?r[1]:null;if(typeof e?.requireProtocol=="string"&&o!==e.requireProtocol)throw new Error(`Invalid protocol (${o})`);if(e?.requireProtocol&&o===null)throw new Error(`Missing protocol (${o})`);let a=typeof r[3]<"u"?decodeURIComponent(r[2]):null;if(e?.requireSource&&a===null)throw new Error(`Missing source (${t})`);let n=typeof r[3]<"u"?decodeURIComponent(r[3]):decodeURIComponent(r[2]),u=e?.parseSelector?oE.default.parse(n):n,A=typeof r[4]<"u"?oE.default.parse(r[4]):null;return{protocol:o,source:a,selector:u,params:A}}function Ytt(t,e){try{return Id(t,e)}catch{return null}}function Wtt(t,{protocol:e}){let{selector:r,params:o}=Id(t,{requireProtocol:e,requireBindings:!0});if(typeof o.locator!="string")throw new Error(`Assertion failed: Invalid bindings for ${t}`);return{parentLocator:xf(o.locator,!0),path:r}}function tse(t){return t=t.replaceAll("%","%25"),t=t.replaceAll(":","%3A"),t=t.replaceAll("#","%23"),t}function Vtt(t){return t===null?!1:Object.entries(t).length>0}function HS({protocol:t,source:e,selector:r,params:o}){let a="";return t!==null&&(a+=`${t}`),e!==null&&(a+=`${tse(e)}#`),a+=tse(r),Vtt(o)&&(a+=`::${oE.default.stringify(o)}`),a}function Ktt(t){let{params:e,protocol:r,source:o,selector:a}=Id(t);for(let n in e)n.startsWith("__")&&delete e[n];return HS({protocol:r,source:o,params:e,selector:a})}function fn(t){return t.scope?`@${t.scope}/${t.name}`:`${t.name}`}function Sa(t){return t.scope?`@${t.scope}/${t.name}@${t.range}`:`${t.name}@${t.range}`}function xa(t){return t.scope?`@${t.scope}/${t.name}@${t.reference}`:`${t.name}@${t.reference}`}function eO(t){return t.scope!==null?`@${t.scope}-${t.name}`:t.name}function aE(t){let{protocol:e,selector:r}=Id(t.reference),o=e!==null?e.replace(Jtt,""):"exotic",a=rse.default.valid(r),n=a!==null?`${o}-${a}`:`${o}`,u=10;return t.scope?`${eO(t)}-${n}-${t.locatorHash.slice(0,u)}`:`${eO(t)}-${n}-${t.locatorHash.slice(0,u)}`}function cs(t,e){return e.scope?`${Ot(t,`@${e.scope}/`,yt.SCOPE)}${Ot(t,e.name,yt.NAME)}`:`${Ot(t,e.name,yt.NAME)}`}function jS(t){if(t.startsWith(ZI)){let e=jS(t.substring(t.indexOf("#")+1)),r=t.substring(ZI.length,ZI.length+ktt);return`${e} [${r}]`}else return t.replace(ztt,"?[...]")}function lE(t,e){return`${Ot(t,jS(e),yt.RANGE)}`}function qn(t,e){return`${cs(t,e)}${Ot(t,"@",yt.RANGE)}${lE(t,e.range)}`}function s1(t,e){return`${Ot(t,jS(e),yt.REFERENCE)}`}function jr(t,e){return`${cs(t,e)}${Ot(t,"@",yt.REFERENCE)}${s1(t,e.reference)}`}function QL(t){return`${fn(t)}@${jS(t.reference)}`}function cE(t){return ks(t,[e=>fn(e),e=>e.range])}function o1(t,e){return cs(t,e.anchoredLocator)}function XI(t,e,r){let o=Sf(e)?e1(e):e;return r===null?`${qn(t,o)} \u2192 ${kL(t).Cross}`:o.identHash===r.identHash?`${qn(t,o)} \u2192 ${s1(t,r.reference)}`:`${qn(t,o)} \u2192 ${jr(t,r)}`}function FL(t,e,r){return r===null?`${jr(t,e)}`:`${jr(t,e)} (via ${lE(t,r.range)})`}function sO(t){return`node_modules/${fn(t)}`}function qS(t,e){return t.conditions?Qtt(t.conditions,r=>{let[,o,a]=r.match(ise),n=e[o];return n?n.includes(a):!0}):!0}var oE,rse,nse,ZI,ktt,ise,Qtt,US,Utt,_tt,Htt,jtt,qtt,Gtt,Jtt,ztt,xo=Et(()=>{oE=$e(Be("querystring")),rse=$e(zn()),nse=$e(rX());ql();rh();jl();xo();ZI="virtual:",ktt=5,ise=/(os|cpu|libc)=([a-z0-9_-]+)/,Qtt=(0,nse.makeParser)(ise);US=/^[^#]*#/;Utt=/^(?:@([^/]+?)\/)?([^@/]+)$/;_tt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))$/,Htt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))?$/;jtt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))$/,qtt=/^(?:@([^/]+?)\/)?([^@/]+?)(?:@(.+))?$/;Gtt=/^([^#:]*:)?((?:(?!::)[^#])*)(?:#((?:(?!::).)*))?(?:::(.*))?$/;Jtt=/:$/;ztt=/\?.*/});var ase,lse=Et(()=>{xo();ase={hooks:{reduceDependency:(t,e,r,o,{resolver:a,resolveOptions:n})=>{for(let{pattern:u,reference:A}of e.topLevelWorkspace.manifest.resolutions){if(u.from&&(u.from.fullName!==fn(r)||e.configuration.normalizeLocator(Qs(Js(u.from.fullName),u.from.description??r.reference)).locatorHash!==r.locatorHash)||u.descriptor.fullName!==fn(t)||e.configuration.normalizeDependency(In(xf(u.descriptor.fullName),u.descriptor.description??t.range)).descriptorHash!==t.descriptorHash)continue;return a.bindDescriptor(e.configuration.normalizeDependency(In(t,A)),e.topLevelWorkspace.anchoredLocator,n)}return t},validateProject:async(t,e)=>{for(let r of t.workspaces){let o=o1(t.configuration,r);await t.configuration.triggerHook(a=>a.validateWorkspace,r,{reportWarning:(a,n)=>e.reportWarning(a,`${o}: ${n}`),reportError:(a,n)=>e.reportError(a,`${o}: ${n}`)})}},validateWorkspace:async(t,e)=>{let{manifest:r}=t;r.resolutions.length&&t.cwd!==t.project.cwd&&r.errors.push(new Error("Resolutions field will be ignored"));for(let o of r.errors)e.reportWarning(57,o.message)}}}});var a1,Xn,Bd=Et(()=>{a1=class{supportsDescriptor(e,r){return!!(e.range.startsWith(a1.protocol)||r.project.tryWorkspaceByDescriptor(e)!==null)}supportsLocator(e,r){return!!e.reference.startsWith(a1.protocol)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){return[o.project.getWorkspaceByDescriptor(e).anchoredLocator]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let o=r.project.getWorkspaceByCwd(e.reference.slice(a1.protocol.length));return{...e,version:o.manifest.version||"0.0.0",languageName:"unknown",linkType:"SOFT",conditions:null,dependencies:r.project.configuration.normalizeDependencyMap(new Map([...o.manifest.dependencies,...o.manifest.devDependencies])),peerDependencies:new Map([...o.manifest.peerDependencies]),dependenciesMeta:o.manifest.dependenciesMeta,peerDependenciesMeta:o.manifest.peerDependenciesMeta,bin:o.manifest.bin}}},Xn=a1;Xn.protocol="workspace:"});var kr={};Kt(kr,{SemVer:()=>pse.SemVer,clean:()=>Ztt,getComparator:()=>Ase,mergeComparators:()=>oO,satisfiesWithPrereleases:()=>bf,simplifyRanges:()=>aO,stringifyComparator:()=>fse,validRange:()=>ba});function bf(t,e,r=!1){if(!t)return!1;let o=`${e}${r}`,a=cse.get(o);if(typeof a>"u")try{a=new ih.default.Range(e,{includePrerelease:!0,loose:r})}catch{return!1}finally{cse.set(o,a||null)}else if(a===null)return!1;let n;try{n=new ih.default.SemVer(t,a)}catch{return!1}return a.test(n)?!0:(n.prerelease&&(n.prerelease=[]),a.set.some(u=>{for(let A of u)A.semver.prerelease&&(A.semver.prerelease=[]);return u.every(A=>A.test(n))}))}function ba(t){if(t.indexOf(":")!==-1)return null;let e=use.get(t);if(typeof e<"u")return e;try{e=new ih.default.Range(t)}catch{e=null}return use.set(t,e),e}function Ztt(t){let e=Xtt.exec(t);return e?e[1]:null}function Ase(t){if(t.semver===ih.default.Comparator.ANY)return{gt:null,lt:null};switch(t.operator){case"":return{gt:[">=",t.semver],lt:["<=",t.semver]};case">":case">=":return{gt:[t.operator,t.semver],lt:null};case"<":case"<=":return{gt:null,lt:[t.operator,t.semver]};default:throw new Error(`Assertion failed: Unexpected comparator operator (${t.operator})`)}}function oO(t){if(t.length===0)return null;let e=null,r=null;for(let o of t){if(o.gt){let a=e!==null?ih.default.compare(o.gt[1],e[1]):null;(a===null||a>0||a===0&&o.gt[0]===">")&&(e=o.gt)}if(o.lt){let a=r!==null?ih.default.compare(o.lt[1],r[1]):null;(a===null||a<0||a===0&&o.lt[0]==="<")&&(r=o.lt)}}if(e&&r){let o=ih.default.compare(e[1],r[1]);if(o===0&&(e[0]===">"||r[0]==="<")||o>0)return null}return{gt:e,lt:r}}function fse(t){if(t.gt&&t.lt){if(t.gt[0]===">="&&t.lt[0]==="<="&&t.gt[1].version===t.lt[1].version)return t.gt[1].version;if(t.gt[0]===">="&&t.lt[0]==="<"){if(t.lt[1].version===`${t.gt[1].major+1}.0.0-0`)return`^${t.gt[1].version}`;if(t.lt[1].version===`${t.gt[1].major}.${t.gt[1].minor+1}.0-0`)return`~${t.gt[1].version}`}}let e=[];return t.gt&&e.push(t.gt[0]+t.gt[1].version),t.lt&&e.push(t.lt[0]+t.lt[1].version),e.length?e.join(" "):"*"}function aO(t){let e=t.map(o=>ba(o).set.map(a=>a.map(n=>Ase(n)))),r=e.shift().map(o=>oO(o)).filter(o=>o!==null);for(let o of e){let a=[];for(let n of r)for(let u of o){let A=oO([n,...u]);A!==null&&a.push(A)}r=a}return r.length===0?null:r.map(o=>fse(o)).join(" || ")}var ih,pse,cse,use,Xtt,kf=Et(()=>{ih=$e(zn()),pse=$e(zn()),cse=new Map;use=new Map;Xtt=/^(?:[\sv=]*?)((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\s*)$/});function hse(t){let e=t.match(/^[ \t]+/m);return e?e[0]:" "}function gse(t){return t.charCodeAt(0)===65279?t.slice(1):t}function $o(t){return t.replace(/\\/g,"/")}function GS(t,{yamlCompatibilityMode:e}){return e?IL(t):typeof t>"u"||typeof t=="boolean"?t:null}function dse(t,e){let r=e.search(/[^!]/);if(r===-1)return"invalid";let o=r%2===0?"":"!",a=e.slice(r);return`${o}${t}=${a}`}function lO(t,e){return e.length===1?dse(t,e[0]):`(${e.map(r=>dse(t,r)).join(" | ")})`}var mse,uE,Mt,AE=Et(()=>{Pt();Nl();mse=$e(zn());Bd();jl();kf();xo();uE=class{constructor(){this.indent=" ";this.name=null;this.version=null;this.os=null;this.cpu=null;this.libc=null;this.type=null;this.packageManager=null;this.private=!1;this.license=null;this.main=null;this.module=null;this.browser=null;this.languageName=null;this.bin=new Map;this.scripts=new Map;this.dependencies=new Map;this.devDependencies=new Map;this.peerDependencies=new Map;this.workspaceDefinitions=[];this.dependenciesMeta=new Map;this.peerDependenciesMeta=new Map;this.resolutions=[];this.files=null;this.publishConfig=null;this.installConfig=null;this.preferUnplugged=null;this.raw={};this.errors=[]}static async tryFind(e,{baseFs:r=new Rn}={}){let o=K.join(e,"package.json");try{return await uE.fromFile(o,{baseFs:r})}catch(a){if(a.code==="ENOENT")return null;throw a}}static async find(e,{baseFs:r}={}){let o=await uE.tryFind(e,{baseFs:r});if(o===null)throw new Error("Manifest not found");return o}static async fromFile(e,{baseFs:r=new Rn}={}){let o=new uE;return await o.loadFile(e,{baseFs:r}),o}static fromText(e){let r=new uE;return r.loadFromText(e),r}loadFromText(e){let r;try{r=JSON.parse(gse(e)||"{}")}catch(o){throw o.message+=` (when parsing ${e})`,o}this.load(r),this.indent=hse(e)}async loadFile(e,{baseFs:r=new Rn}){let o=await r.readFilePromise(e,"utf8"),a;try{a=JSON.parse(gse(o)||"{}")}catch(n){throw n.message+=` (when parsing ${e})`,n}this.load(a),this.indent=hse(o)}load(e,{yamlCompatibilityMode:r=!1}={}){if(typeof e!="object"||e===null)throw new Error(`Utterly invalid manifest data (${e})`);this.raw=e;let o=[];if(this.name=null,typeof e.name=="string")try{this.name=Js(e.name)}catch{o.push(new Error("Parsing failed for the 'name' field"))}if(typeof e.version=="string"?this.version=e.version:this.version=null,Array.isArray(e.os)){let n=[];this.os=n;for(let u of e.os)typeof u!="string"?o.push(new Error("Parsing failed for the 'os' field")):n.push(u)}else this.os=null;if(Array.isArray(e.cpu)){let n=[];this.cpu=n;for(let u of e.cpu)typeof u!="string"?o.push(new Error("Parsing failed for the 'cpu' field")):n.push(u)}else this.cpu=null;if(Array.isArray(e.libc)){let n=[];this.libc=n;for(let u of e.libc)typeof u!="string"?o.push(new Error("Parsing failed for the 'libc' field")):n.push(u)}else this.libc=null;if(typeof e.type=="string"?this.type=e.type:this.type=null,typeof e.packageManager=="string"?this.packageManager=e.packageManager:this.packageManager=null,typeof e.private=="boolean"?this.private=e.private:this.private=!1,typeof e.license=="string"?this.license=e.license:this.license=null,typeof e.languageName=="string"?this.languageName=e.languageName:this.languageName=null,typeof e.main=="string"?this.main=$o(e.main):this.main=null,typeof e.module=="string"?this.module=$o(e.module):this.module=null,e.browser!=null)if(typeof e.browser=="string")this.browser=$o(e.browser);else{this.browser=new Map;for(let[n,u]of Object.entries(e.browser))this.browser.set($o(n),typeof u=="string"?$o(u):u)}else this.browser=null;if(this.bin=new Map,typeof e.bin=="string")e.bin.trim()===""?o.push(new Error("Invalid bin field")):this.name!==null?this.bin.set(this.name.name,$o(e.bin)):o.push(new Error("String bin field, but no attached package name"));else if(typeof e.bin=="object"&&e.bin!==null)for(let[n,u]of Object.entries(e.bin)){if(typeof u!="string"||u.trim()===""){o.push(new Error(`Invalid bin definition for '${n}'`));continue}let A=Js(n);this.bin.set(A.name,$o(u))}if(this.scripts=new Map,typeof e.scripts=="object"&&e.scripts!==null)for(let[n,u]of Object.entries(e.scripts)){if(typeof u!="string"){o.push(new Error(`Invalid script definition for '${n}'`));continue}this.scripts.set(n,u)}if(this.dependencies=new Map,typeof e.dependencies=="object"&&e.dependencies!==null)for(let[n,u]of Object.entries(e.dependencies)){if(typeof u!="string"){o.push(new Error(`Invalid dependency range for '${n}'`));continue}let A;try{A=Js(n)}catch{o.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}let p=In(A,u);this.dependencies.set(p.identHash,p)}if(this.devDependencies=new Map,typeof e.devDependencies=="object"&&e.devDependencies!==null)for(let[n,u]of Object.entries(e.devDependencies)){if(typeof u!="string"){o.push(new Error(`Invalid dependency range for '${n}'`));continue}let A;try{A=Js(n)}catch{o.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}let p=In(A,u);this.devDependencies.set(p.identHash,p)}if(this.peerDependencies=new Map,typeof e.peerDependencies=="object"&&e.peerDependencies!==null)for(let[n,u]of Object.entries(e.peerDependencies)){let A;try{A=Js(n)}catch{o.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}(typeof u!="string"||!u.startsWith(Xn.protocol)&&!ba(u))&&(o.push(new Error(`Invalid dependency range for '${n}'`)),u="*");let p=In(A,u);this.peerDependencies.set(p.identHash,p)}typeof e.workspaces=="object"&&e.workspaces!==null&&e.workspaces.nohoist&&o.push(new Error("'nohoist' is deprecated, please use 'installConfig.hoistingLimits' instead"));let a=Array.isArray(e.workspaces)?e.workspaces:typeof e.workspaces=="object"&&e.workspaces!==null&&Array.isArray(e.workspaces.packages)?e.workspaces.packages:[];this.workspaceDefinitions=[];for(let n of a){if(typeof n!="string"){o.push(new Error(`Invalid workspace definition for '${n}'`));continue}this.workspaceDefinitions.push({pattern:n})}if(this.dependenciesMeta=new Map,typeof e.dependenciesMeta=="object"&&e.dependenciesMeta!==null)for(let[n,u]of Object.entries(e.dependenciesMeta)){if(typeof u!="object"||u===null){o.push(new Error(`Invalid meta field for '${n}`));continue}let A=nh(n),p=this.ensureDependencyMeta(A),h=GS(u.built,{yamlCompatibilityMode:r});if(h===null){o.push(new Error(`Invalid built meta field for '${n}'`));continue}let E=GS(u.optional,{yamlCompatibilityMode:r});if(E===null){o.push(new Error(`Invalid optional meta field for '${n}'`));continue}let I=GS(u.unplugged,{yamlCompatibilityMode:r});if(I===null){o.push(new Error(`Invalid unplugged meta field for '${n}'`));continue}Object.assign(p,{built:h,optional:E,unplugged:I})}if(this.peerDependenciesMeta=new Map,typeof e.peerDependenciesMeta=="object"&&e.peerDependenciesMeta!==null)for(let[n,u]of Object.entries(e.peerDependenciesMeta)){if(typeof u!="object"||u===null){o.push(new Error(`Invalid meta field for '${n}'`));continue}let A=nh(n),p=this.ensurePeerDependencyMeta(A),h=GS(u.optional,{yamlCompatibilityMode:r});if(h===null){o.push(new Error(`Invalid optional meta field for '${n}'`));continue}Object.assign(p,{optional:h})}if(this.resolutions=[],typeof e.resolutions=="object"&&e.resolutions!==null)for(let[n,u]of Object.entries(e.resolutions)){if(typeof u!="string"){o.push(new Error(`Invalid resolution entry for '${n}'`));continue}try{this.resolutions.push({pattern:UD(n),reference:u})}catch(A){o.push(A);continue}}if(Array.isArray(e.files)){this.files=new Set;for(let n of e.files){if(typeof n!="string"){o.push(new Error(`Invalid files entry for '${n}'`));continue}this.files.add(n)}}else this.files=null;if(typeof e.publishConfig=="object"&&e.publishConfig!==null){if(this.publishConfig={},typeof e.publishConfig.access=="string"&&(this.publishConfig.access=e.publishConfig.access),typeof e.publishConfig.main=="string"&&(this.publishConfig.main=$o(e.publishConfig.main)),typeof e.publishConfig.module=="string"&&(this.publishConfig.module=$o(e.publishConfig.module)),e.publishConfig.browser!=null)if(typeof e.publishConfig.browser=="string")this.publishConfig.browser=$o(e.publishConfig.browser);else{this.publishConfig.browser=new Map;for(let[n,u]of Object.entries(e.publishConfig.browser))this.publishConfig.browser.set($o(n),typeof u=="string"?$o(u):u)}if(typeof e.publishConfig.registry=="string"&&(this.publishConfig.registry=e.publishConfig.registry),typeof e.publishConfig.bin=="string")this.name!==null?this.publishConfig.bin=new Map([[this.name.name,$o(e.publishConfig.bin)]]):o.push(new Error("String bin field, but no attached package name"));else if(typeof e.publishConfig.bin=="object"&&e.publishConfig.bin!==null){this.publishConfig.bin=new Map;for(let[n,u]of Object.entries(e.publishConfig.bin)){if(typeof u!="string"){o.push(new Error(`Invalid bin definition for '${n}'`));continue}this.publishConfig.bin.set(n,$o(u))}}if(Array.isArray(e.publishConfig.executableFiles)){this.publishConfig.executableFiles=new Set;for(let n of e.publishConfig.executableFiles){if(typeof n!="string"){o.push(new Error("Invalid executable file definition"));continue}this.publishConfig.executableFiles.add($o(n))}}}else this.publishConfig=null;if(typeof e.installConfig=="object"&&e.installConfig!==null){this.installConfig={};for(let n of Object.keys(e.installConfig))n==="hoistingLimits"?typeof e.installConfig.hoistingLimits=="string"?this.installConfig.hoistingLimits=e.installConfig.hoistingLimits:o.push(new Error("Invalid hoisting limits definition")):n=="selfReferences"?typeof e.installConfig.selfReferences=="boolean"?this.installConfig.selfReferences=e.installConfig.selfReferences:o.push(new Error("Invalid selfReferences definition, must be a boolean value")):o.push(new Error(`Unrecognized installConfig key: ${n}`))}else this.installConfig=null;if(typeof e.optionalDependencies=="object"&&e.optionalDependencies!==null)for(let[n,u]of Object.entries(e.optionalDependencies)){if(typeof u!="string"){o.push(new Error(`Invalid dependency range for '${n}'`));continue}let A;try{A=Js(n)}catch{o.push(new Error(`Parsing failed for the dependency name '${n}'`));continue}let p=In(A,u);this.dependencies.set(p.identHash,p);let h=In(A,"unknown"),E=this.ensureDependencyMeta(h);Object.assign(E,{optional:!0})}typeof e.preferUnplugged=="boolean"?this.preferUnplugged=e.preferUnplugged:this.preferUnplugged=null,this.errors=o}getForScope(e){switch(e){case"dependencies":return this.dependencies;case"devDependencies":return this.devDependencies;case"peerDependencies":return this.peerDependencies;default:throw new Error(`Unsupported value ("${e}")`)}}hasConsumerDependency(e){return!!(this.dependencies.has(e.identHash)||this.peerDependencies.has(e.identHash))}hasHardDependency(e){return!!(this.dependencies.has(e.identHash)||this.devDependencies.has(e.identHash))}hasSoftDependency(e){return!!this.peerDependencies.has(e.identHash)}hasDependency(e){return!!(this.hasHardDependency(e)||this.hasSoftDependency(e))}getConditions(){let e=[];return this.os&&this.os.length>0&&e.push(lO("os",this.os)),this.cpu&&this.cpu.length>0&&e.push(lO("cpu",this.cpu)),this.libc&&this.libc.length>0&&e.push(lO("libc",this.libc)),e.length>0?e.join(" & "):null}ensureDependencyMeta(e){if(e.range!=="unknown"&&!mse.default.valid(e.range))throw new Error(`Invalid meta field range for '${Sa(e)}'`);let r=fn(e),o=e.range!=="unknown"?e.range:null,a=this.dependenciesMeta.get(r);a||this.dependenciesMeta.set(r,a=new Map);let n=a.get(o);return n||a.set(o,n={}),n}ensurePeerDependencyMeta(e){if(e.range!=="unknown")throw new Error(`Invalid meta field range for '${Sa(e)}'`);let r=fn(e),o=this.peerDependenciesMeta.get(r);return o||this.peerDependenciesMeta.set(r,o={}),o}setRawField(e,r,{after:o=[]}={}){let a=new Set(o.filter(n=>Object.hasOwn(this.raw,n)));if(a.size===0||Object.hasOwn(this.raw,e))this.raw[e]=r;else{let n=this.raw,u=this.raw={},A=!1;for(let p of Object.keys(n))u[p]=n[p],A||(a.delete(p),a.size===0&&(u[e]=r,A=!0))}}exportTo(e,{compatibilityMode:r=!0}={}){if(Object.assign(e,this.raw),this.name!==null?e.name=fn(this.name):delete e.name,this.version!==null?e.version=this.version:delete e.version,this.os!==null?e.os=this.os:delete e.os,this.cpu!==null?e.cpu=this.cpu:delete e.cpu,this.type!==null?e.type=this.type:delete e.type,this.packageManager!==null?e.packageManager=this.packageManager:delete e.packageManager,this.private?e.private=!0:delete e.private,this.license!==null?e.license=this.license:delete e.license,this.languageName!==null?e.languageName=this.languageName:delete e.languageName,this.main!==null?e.main=this.main:delete e.main,this.module!==null?e.module=this.module:delete e.module,this.browser!==null){let n=this.browser;typeof n=="string"?e.browser=n:n instanceof Map&&(e.browser=Object.assign({},...Array.from(n.keys()).sort().map(u=>({[u]:n.get(u)}))))}else delete e.browser;this.bin.size===1&&this.name!==null&&this.bin.has(this.name.name)?e.bin=this.bin.get(this.name.name):this.bin.size>0?e.bin=Object.assign({},...Array.from(this.bin.keys()).sort().map(n=>({[n]:this.bin.get(n)}))):delete e.bin,this.workspaceDefinitions.length>0?this.raw.workspaces&&!Array.isArray(this.raw.workspaces)?e.workspaces={...this.raw.workspaces,packages:this.workspaceDefinitions.map(({pattern:n})=>n)}:e.workspaces=this.workspaceDefinitions.map(({pattern:n})=>n):this.raw.workspaces&&!Array.isArray(this.raw.workspaces)&&Object.keys(this.raw.workspaces).length>0?e.workspaces=this.raw.workspaces:delete e.workspaces;let o=[],a=[];for(let n of this.dependencies.values()){let u=this.dependenciesMeta.get(fn(n)),A=!1;if(r&&u){let p=u.get(null);p&&p.optional&&(A=!0)}A?a.push(n):o.push(n)}o.length>0?e.dependencies=Object.assign({},...cE(o).map(n=>({[fn(n)]:n.range}))):delete e.dependencies,a.length>0?e.optionalDependencies=Object.assign({},...cE(a).map(n=>({[fn(n)]:n.range}))):delete e.optionalDependencies,this.devDependencies.size>0?e.devDependencies=Object.assign({},...cE(this.devDependencies.values()).map(n=>({[fn(n)]:n.range}))):delete e.devDependencies,this.peerDependencies.size>0?e.peerDependencies=Object.assign({},...cE(this.peerDependencies.values()).map(n=>({[fn(n)]:n.range}))):delete e.peerDependencies,e.dependenciesMeta={};for(let[n,u]of ks(this.dependenciesMeta.entries(),([A,p])=>A))for(let[A,p]of ks(u.entries(),([h,E])=>h!==null?`0${h}`:"1")){let h=A!==null?Sa(In(Js(n),A)):n,E={...p};r&&A===null&&delete E.optional,Object.keys(E).length!==0&&(e.dependenciesMeta[h]=E)}if(Object.keys(e.dependenciesMeta).length===0&&delete e.dependenciesMeta,this.peerDependenciesMeta.size>0?e.peerDependenciesMeta=Object.assign({},...ks(this.peerDependenciesMeta.entries(),([n,u])=>n).map(([n,u])=>({[n]:u}))):delete e.peerDependenciesMeta,this.resolutions.length>0?e.resolutions=Object.assign({},...this.resolutions.map(({pattern:n,reference:u})=>({[_D(n)]:u}))):delete e.resolutions,this.files!==null?e.files=Array.from(this.files):delete e.files,this.preferUnplugged!==null?e.preferUnplugged=this.preferUnplugged:delete e.preferUnplugged,this.scripts!==null&&this.scripts.size>0){e.scripts??={};for(let n of Object.keys(e.scripts))this.scripts.has(n)||delete e.scripts[n];for(let[n,u]of this.scripts.entries())e.scripts[n]=u}else delete e.scripts;return e}},Mt=uE;Mt.fileName="package.json",Mt.allDependencies=["dependencies","devDependencies","peerDependencies"],Mt.hardDependencies=["dependencies","devDependencies"]});var Ese=_((_Nt,yse)=>{var $tt=_l(),ert=function(){return $tt.Date.now()};yse.exports=ert});var wse=_((HNt,Cse)=>{var trt=/\s/;function rrt(t){for(var e=t.length;e--&&trt.test(t.charAt(e)););return e}Cse.exports=rrt});var Bse=_((jNt,Ise)=>{var nrt=wse(),irt=/^\s+/;function srt(t){return t&&t.slice(0,nrt(t)+1).replace(irt,"")}Ise.exports=srt});var fE=_((qNt,vse)=>{var ort=pd(),art=Ju(),lrt="[object Symbol]";function crt(t){return typeof t=="symbol"||art(t)&&ort(t)==lrt}vse.exports=crt});var xse=_((GNt,Sse)=>{var urt=Bse(),Dse=il(),Art=fE(),Pse=0/0,frt=/^[-+]0x[0-9a-f]+$/i,prt=/^0b[01]+$/i,hrt=/^0o[0-7]+$/i,grt=parseInt;function drt(t){if(typeof t=="number")return t;if(Art(t))return Pse;if(Dse(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Dse(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=urt(t);var r=prt.test(t);return r||hrt.test(t)?grt(t.slice(2),r?2:8):frt.test(t)?Pse:+t}Sse.exports=drt});var Qse=_((YNt,kse)=>{var mrt=il(),cO=Ese(),bse=xse(),yrt="Expected a function",Ert=Math.max,Crt=Math.min;function wrt(t,e,r){var o,a,n,u,A,p,h=0,E=!1,I=!1,v=!0;if(typeof t!="function")throw new TypeError(yrt);e=bse(e)||0,mrt(r)&&(E=!!r.leading,I="maxWait"in r,n=I?Ert(bse(r.maxWait)||0,e):n,v="trailing"in r?!!r.trailing:v);function b(Ae){var ye=o,ae=a;return o=a=void 0,h=Ae,u=t.apply(ae,ye),u}function C(Ae){return h=Ae,A=setTimeout(U,e),E?b(Ae):u}function T(Ae){var ye=Ae-p,ae=Ae-h,we=e-ye;return I?Crt(we,n-ae):we}function L(Ae){var ye=Ae-p,ae=Ae-h;return p===void 0||ye>=e||ye<0||I&&ae>=n}function U(){var Ae=cO();if(L(Ae))return J(Ae);A=setTimeout(U,T(Ae))}function J(Ae){return A=void 0,v&&o?b(Ae):(o=a=void 0,u)}function te(){A!==void 0&&clearTimeout(A),h=0,o=p=a=A=void 0}function le(){return A===void 0?u:J(cO())}function pe(){var Ae=cO(),ye=L(Ae);if(o=arguments,a=this,p=Ae,ye){if(A===void 0)return C(p);if(I)return clearTimeout(A),A=setTimeout(U,e),b(p)}return A===void 0&&(A=setTimeout(U,e)),u}return pe.cancel=te,pe.flush=le,pe}kse.exports=wrt});var uO=_((WNt,Fse)=>{var Irt=Qse(),Brt=il(),vrt="Expected a function";function Drt(t,e,r){var o=!0,a=!0;if(typeof t!="function")throw new TypeError(vrt);return Brt(r)&&(o="leading"in r?!!r.leading:o,a="trailing"in r?!!r.trailing:a),Irt(t,e,{leading:o,maxWait:e,trailing:a})}Fse.exports=Drt});function Srt(t){return typeof t.reportCode<"u"}var Tse,Rse,Nse,Prt,zt,Xs,Yl=Et(()=>{Tse=$e(uO()),Rse=Be("stream"),Nse=Be("string_decoder"),Prt=15,zt=class extends Error{constructor(r,o,a){super(o);this.reportExtra=a;this.reportCode=r}};Xs=class{constructor(){this.cacheHits=new Set;this.cacheMisses=new Set;this.reportedInfos=new Set;this.reportedWarnings=new Set;this.reportedErrors=new Set}getRecommendedLength(){return 180}reportCacheHit(e){this.cacheHits.add(e.locatorHash)}reportCacheMiss(e,r){this.cacheMisses.add(e.locatorHash)}static progressViaCounter(e){let r=0,o,a=new Promise(p=>{o=p}),n=p=>{let h=o;a=new Promise(E=>{o=E}),r=p,h()},u=(p=0)=>{n(r+1)},A=async function*(){for(;r{r=u}),a=(0,Tse.default)(u=>{let A=r;o=new Promise(p=>{r=p}),e=u,A()},1e3/Prt),n=async function*(){for(;;)await o,yield{title:e}}();return{[Symbol.asyncIterator](){return n},hasProgress:!1,hasTitle:!0,setTitle:a}}async startProgressPromise(e,r){let o=this.reportProgress(e);try{return await r(e)}finally{o.stop()}}startProgressSync(e,r){let o=this.reportProgress(e);try{return r(e)}finally{o.stop()}}reportInfoOnce(e,r,o){let a=o&&o.key?o.key:r;this.reportedInfos.has(a)||(this.reportedInfos.add(a),this.reportInfo(e,r),o?.reportExtra?.(this))}reportWarningOnce(e,r,o){let a=o&&o.key?o.key:r;this.reportedWarnings.has(a)||(this.reportedWarnings.add(a),this.reportWarning(e,r),o?.reportExtra?.(this))}reportErrorOnce(e,r,o){let a=o&&o.key?o.key:r;this.reportedErrors.has(a)||(this.reportedErrors.add(a),this.reportError(e,r),o?.reportExtra?.(this))}reportExceptionOnce(e){Srt(e)?this.reportErrorOnce(e.reportCode,e.message,{key:e,reportExtra:e.reportExtra}):this.reportErrorOnce(1,e.stack||e.message,{key:e})}createStreamReporter(e=null){let r=new Rse.PassThrough,o=new Nse.StringDecoder,a="";return r.on("data",n=>{let u=o.write(n),A;do if(A=u.indexOf(` +`),A!==-1){let p=a+u.substring(0,A);u=u.substring(A+1),a="",e!==null?this.reportInfo(null,`${e} ${p}`):this.reportInfo(null,p)}while(A!==-1);a+=u}),r.on("end",()=>{let n=o.end();n!==""&&(e!==null?this.reportInfo(null,`${e} ${n}`):this.reportInfo(null,n))}),r}}});var pE,AO=Et(()=>{Yl();xo();pE=class{constructor(e){this.fetchers=e}supports(e,r){return!!this.tryFetcher(e,r)}getLocalPath(e,r){return this.getFetcher(e,r).getLocalPath(e,r)}async fetch(e,r){return await this.getFetcher(e,r).fetch(e,r)}tryFetcher(e,r){let o=this.fetchers.find(a=>a.supports(e,r));return o||null}getFetcher(e,r){let o=this.fetchers.find(a=>a.supports(e,r));if(!o)throw new zt(11,`${jr(r.project.configuration,e)} isn't supported by any available fetcher`);return o}}});var vd,fO=Et(()=>{xo();vd=class{constructor(e){this.resolvers=e.filter(r=>r)}supportsDescriptor(e,r){return!!this.tryResolverByDescriptor(e,r)}supportsLocator(e,r){return!!this.tryResolverByLocator(e,r)}shouldPersistResolution(e,r){return this.getResolverByLocator(e,r).shouldPersistResolution(e,r)}bindDescriptor(e,r,o){return this.getResolverByDescriptor(e,o).bindDescriptor(e,r,o)}getResolutionDependencies(e,r){return this.getResolverByDescriptor(e,r).getResolutionDependencies(e,r)}async getCandidates(e,r,o){return await this.getResolverByDescriptor(e,o).getCandidates(e,r,o)}async getSatisfying(e,r,o,a){return this.getResolverByDescriptor(e,a).getSatisfying(e,r,o,a)}async resolve(e,r){return await this.getResolverByLocator(e,r).resolve(e,r)}tryResolverByDescriptor(e,r){let o=this.resolvers.find(a=>a.supportsDescriptor(e,r));return o||null}getResolverByDescriptor(e,r){let o=this.resolvers.find(a=>a.supportsDescriptor(e,r));if(!o)throw new Error(`${qn(r.project.configuration,e)} isn't supported by any available resolver`);return o}tryResolverByLocator(e,r){let o=this.resolvers.find(a=>a.supportsLocator(e,r));return o||null}getResolverByLocator(e,r){let o=this.resolvers.find(a=>a.supportsLocator(e,r));if(!o)throw new Error(`${jr(r.project.configuration,e)} isn't supported by any available resolver`);return o}}});var hE,pO=Et(()=>{Pt();xo();hE=class{supports(e){return!!e.reference.startsWith("virtual:")}getLocalPath(e,r){let o=e.reference.indexOf("#");if(o===-1)throw new Error("Invalid virtual package reference");let a=e.reference.slice(o+1),n=Qs(e,a);return r.fetcher.getLocalPath(n,r)}async fetch(e,r){let o=e.reference.indexOf("#");if(o===-1)throw new Error("Invalid virtual package reference");let a=e.reference.slice(o+1),n=Qs(e,a),u=await r.fetcher.fetch(n,r);return await this.ensureVirtualLink(e,u,r)}getLocatorFilename(e){return aE(e)}async ensureVirtualLink(e,r,o){let a=r.packageFs.getRealPath(),n=o.project.configuration.get("virtualFolder"),u=this.getLocatorFilename(e),A=mi.makeVirtualPath(n,u,a),p=new Uu(A,{baseFs:r.packageFs,pathUtils:K});return{...r,packageFs:p}}}});var gE,l1,Lse=Et(()=>{gE=class{static isVirtualDescriptor(e){return!!e.range.startsWith(gE.protocol)}static isVirtualLocator(e){return!!e.reference.startsWith(gE.protocol)}supportsDescriptor(e,r){return gE.isVirtualDescriptor(e)}supportsLocator(e,r){return gE.isVirtualLocator(e)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){throw new Error('Assertion failed: calling "bindDescriptor" on a virtual descriptor is unsupported')}getResolutionDependencies(e,r){throw new Error('Assertion failed: calling "getResolutionDependencies" on a virtual descriptor is unsupported')}async getCandidates(e,r,o){throw new Error('Assertion failed: calling "getCandidates" on a virtual descriptor is unsupported')}async getSatisfying(e,r,o,a){throw new Error('Assertion failed: calling "getSatisfying" on a virtual descriptor is unsupported')}async resolve(e,r){throw new Error('Assertion failed: calling "resolve" on a virtual locator is unsupported')}},l1=gE;l1.protocol="virtual:"});var dE,hO=Et(()=>{Pt();Bd();dE=class{supports(e){return!!e.reference.startsWith(Xn.protocol)}getLocalPath(e,r){return this.getWorkspace(e,r).cwd}async fetch(e,r){let o=this.getWorkspace(e,r).cwd;return{packageFs:new gn(o),prefixPath:Bt.dot,localPath:o}}getWorkspace(e,r){return r.project.getWorkspaceByCwd(e.reference.slice(Xn.protocol.length))}}});function c1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Mse(t){return typeof t>"u"?3:c1(t)?0:Array.isArray(t)?1:2}function mO(t,e){return Object.hasOwn(t,e)}function brt(t){return c1(t)&&mO(t,"onConflict")&&typeof t.onConflict=="string"}function krt(t){if(typeof t>"u")return{onConflict:"default",value:t};if(!brt(t))return{onConflict:"default",value:t};if(mO(t,"value"))return t;let{onConflict:e,...r}=t;return{onConflict:e,value:r}}function Ose(t,e){let r=c1(t)&&mO(t,e)?t[e]:void 0;return krt(r)}function mE(t,e){return[t,e,Use]}function yO(t){return Array.isArray(t)?t[2]===Use:!1}function gO(t,e){if(c1(t)){let r={};for(let o of Object.keys(t))r[o]=gO(t[o],e);return mE(e,r)}return Array.isArray(t)?mE(e,t.map(r=>gO(r,e))):mE(e,t)}function dO(t,e,r,o,a){let n,u=[],A=a,p=0;for(let E=a-1;E>=o;--E){let[I,v]=t[E],{onConflict:b,value:C}=Ose(v,r),T=Mse(C);if(T!==3){if(n??=T,T!==n||b==="hardReset"){p=A;break}if(T===2)return mE(I,C);if(u.unshift([I,C]),b==="reset"){p=E;break}b==="extend"&&E===o&&(o=0),A=E}}if(typeof n>"u")return null;let h=u.map(([E])=>E).join(", ");switch(n){case 1:return mE(h,new Array().concat(...u.map(([E,I])=>I.map(v=>gO(v,E)))));case 0:{let E=Object.assign({},...u.map(([,T])=>T)),I=Object.keys(E),v={},b=t.map(([T,L])=>[T,Ose(L,r).value]),C=xrt(b,([T,L])=>{let U=Mse(L);return U!==0&&U!==3});if(C!==-1){let T=b.slice(C+1);for(let L of I)v[L]=dO(T,e,L,0,T.length)}else for(let T of I)v[T]=dO(b,e,T,p,b.length);return mE(h,v)}default:throw new Error("Assertion failed: Non-extendable value type")}}function _se(t){return dO(t.map(([e,r])=>[e,{["."]:r}]),[],".",0,t.length)}function u1(t){return yO(t)?t[1]:t}function YS(t){let e=yO(t)?t[1]:t;if(Array.isArray(e))return e.map(r=>YS(r));if(c1(e)){let r={};for(let[o,a]of Object.entries(e))r[o]=YS(a);return r}return e}function EO(t){return yO(t)?t[0]:null}var xrt,Use,Hse=Et(()=>{xrt=(t,e,r)=>{let o=[...t];return o.reverse(),o.findIndex(e,r)};Use=Symbol()});var WS={};Kt(WS,{getDefaultGlobalFolder:()=>wO,getHomeFolder:()=>yE,isFolderInside:()=>IO});function wO(){if(process.platform==="win32"){let t=ue.toPortablePath(process.env.LOCALAPPDATA||ue.join((0,CO.homedir)(),"AppData","Local"));return K.resolve(t,"Yarn/Berry")}if(process.env.XDG_DATA_HOME){let t=ue.toPortablePath(process.env.XDG_DATA_HOME);return K.resolve(t,"yarn/berry")}return K.resolve(yE(),".yarn/berry")}function yE(){return ue.toPortablePath((0,CO.homedir)()||"/usr/local/share")}function IO(t,e){let r=K.relative(e,t);return r&&!r.startsWith("..")&&!K.isAbsolute(r)}var CO,VS=Et(()=>{Pt();CO=Be("os")});var Yse=_(EE=>{"use strict";var sLt=Be("net"),Frt=Be("tls"),BO=Be("http"),jse=Be("https"),Trt=Be("events"),oLt=Be("assert"),Rrt=Be("util");EE.httpOverHttp=Nrt;EE.httpsOverHttp=Lrt;EE.httpOverHttps=Mrt;EE.httpsOverHttps=Ort;function Nrt(t){var e=new Qf(t);return e.request=BO.request,e}function Lrt(t){var e=new Qf(t);return e.request=BO.request,e.createSocket=qse,e.defaultPort=443,e}function Mrt(t){var e=new Qf(t);return e.request=jse.request,e}function Ort(t){var e=new Qf(t);return e.request=jse.request,e.createSocket=qse,e.defaultPort=443,e}function Qf(t){var e=this;e.options=t||{},e.proxyOptions=e.options.proxy||{},e.maxSockets=e.options.maxSockets||BO.Agent.defaultMaxSockets,e.requests=[],e.sockets=[],e.on("free",function(o,a,n,u){for(var A=Gse(a,n,u),p=0,h=e.requests.length;p=this.maxSockets){n.requests.push(u);return}n.createSocket(u,function(A){A.on("free",p),A.on("close",h),A.on("agentRemove",h),e.onSocket(A);function p(){n.emit("free",A,u)}function h(E){n.removeSocket(A),A.removeListener("free",p),A.removeListener("close",h),A.removeListener("agentRemove",h)}})};Qf.prototype.createSocket=function(e,r){var o=this,a={};o.sockets.push(a);var n=vO({},o.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:!1,headers:{host:e.host+":"+e.port}});e.localAddress&&(n.localAddress=e.localAddress),n.proxyAuth&&(n.headers=n.headers||{},n.headers["Proxy-Authorization"]="Basic "+new Buffer(n.proxyAuth).toString("base64")),sh("making CONNECT request");var u=o.request(n);u.useChunkedEncodingByDefault=!1,u.once("response",A),u.once("upgrade",p),u.once("connect",h),u.once("error",E),u.end();function A(I){I.upgrade=!0}function p(I,v,b){process.nextTick(function(){h(I,v,b)})}function h(I,v,b){if(u.removeAllListeners(),v.removeAllListeners(),I.statusCode!==200){sh("tunneling socket could not be established, statusCode=%d",I.statusCode),v.destroy();var C=new Error("tunneling socket could not be established, statusCode="+I.statusCode);C.code="ECONNRESET",e.request.emit("error",C),o.removeSocket(a);return}if(b.length>0){sh("got illegal response body from proxy"),v.destroy();var C=new Error("got illegal response body from proxy");C.code="ECONNRESET",e.request.emit("error",C),o.removeSocket(a);return}return sh("tunneling connection has established"),o.sockets[o.sockets.indexOf(a)]=v,r(v)}function E(I){u.removeAllListeners(),sh(`tunneling socket could not be established, cause=%s +`,I.message,I.stack);var v=new Error("tunneling socket could not be established, cause="+I.message);v.code="ECONNRESET",e.request.emit("error",v),o.removeSocket(a)}};Qf.prototype.removeSocket=function(e){var r=this.sockets.indexOf(e);if(r!==-1){this.sockets.splice(r,1);var o=this.requests.shift();o&&this.createSocket(o,function(a){o.request.onSocket(a)})}};function qse(t,e){var r=this;Qf.prototype.createSocket.call(r,t,function(o){var a=t.request.getHeader("host"),n=vO({},r.options,{socket:o,servername:a?a.replace(/:.*$/,""):t.host}),u=Frt.connect(0,n);r.sockets[r.sockets.indexOf(o)]=u,e(u)})}function Gse(t,e,r){return typeof t=="string"?{host:t,port:e,localAddress:r}:t}function vO(t){for(var e=1,r=arguments.length;e{Wse.exports=Yse()});var Tf=_((Ff,KS)=>{"use strict";Object.defineProperty(Ff,"__esModule",{value:!0});var Kse=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Urt(t){return Kse.includes(t)}var _rt=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement",...Kse];function Hrt(t){return _rt.includes(t)}var jrt=["null","undefined","string","number","bigint","boolean","symbol"];function qrt(t){return jrt.includes(t)}function CE(t){return e=>typeof e===t}var{toString:Jse}=Object.prototype,A1=t=>{let e=Jse.call(t).slice(8,-1);if(/HTML\w+Element/.test(e)&&xe.domElement(t))return"HTMLElement";if(Hrt(e))return e},ei=t=>e=>A1(e)===t;function xe(t){if(t===null)return"null";switch(typeof t){case"undefined":return"undefined";case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"function":return"Function";case"bigint":return"bigint";case"symbol":return"symbol";default:}if(xe.observable(t))return"Observable";if(xe.array(t))return"Array";if(xe.buffer(t))return"Buffer";let e=A1(t);if(e)return e;if(t instanceof String||t instanceof Boolean||t instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}xe.undefined=CE("undefined");xe.string=CE("string");var Grt=CE("number");xe.number=t=>Grt(t)&&!xe.nan(t);xe.bigint=CE("bigint");xe.function_=CE("function");xe.null_=t=>t===null;xe.class_=t=>xe.function_(t)&&t.toString().startsWith("class ");xe.boolean=t=>t===!0||t===!1;xe.symbol=CE("symbol");xe.numericString=t=>xe.string(t)&&!xe.emptyStringOrWhitespace(t)&&!Number.isNaN(Number(t));xe.array=(t,e)=>Array.isArray(t)?xe.function_(e)?t.every(e):!0:!1;xe.buffer=t=>{var e,r,o,a;return(a=(o=(r=(e=t)===null||e===void 0?void 0:e.constructor)===null||r===void 0?void 0:r.isBuffer)===null||o===void 0?void 0:o.call(r,t))!==null&&a!==void 0?a:!1};xe.nullOrUndefined=t=>xe.null_(t)||xe.undefined(t);xe.object=t=>!xe.null_(t)&&(typeof t=="object"||xe.function_(t));xe.iterable=t=>{var e;return xe.function_((e=t)===null||e===void 0?void 0:e[Symbol.iterator])};xe.asyncIterable=t=>{var e;return xe.function_((e=t)===null||e===void 0?void 0:e[Symbol.asyncIterator])};xe.generator=t=>xe.iterable(t)&&xe.function_(t.next)&&xe.function_(t.throw);xe.asyncGenerator=t=>xe.asyncIterable(t)&&xe.function_(t.next)&&xe.function_(t.throw);xe.nativePromise=t=>ei("Promise")(t);var Yrt=t=>{var e,r;return xe.function_((e=t)===null||e===void 0?void 0:e.then)&&xe.function_((r=t)===null||r===void 0?void 0:r.catch)};xe.promise=t=>xe.nativePromise(t)||Yrt(t);xe.generatorFunction=ei("GeneratorFunction");xe.asyncGeneratorFunction=t=>A1(t)==="AsyncGeneratorFunction";xe.asyncFunction=t=>A1(t)==="AsyncFunction";xe.boundFunction=t=>xe.function_(t)&&!t.hasOwnProperty("prototype");xe.regExp=ei("RegExp");xe.date=ei("Date");xe.error=ei("Error");xe.map=t=>ei("Map")(t);xe.set=t=>ei("Set")(t);xe.weakMap=t=>ei("WeakMap")(t);xe.weakSet=t=>ei("WeakSet")(t);xe.int8Array=ei("Int8Array");xe.uint8Array=ei("Uint8Array");xe.uint8ClampedArray=ei("Uint8ClampedArray");xe.int16Array=ei("Int16Array");xe.uint16Array=ei("Uint16Array");xe.int32Array=ei("Int32Array");xe.uint32Array=ei("Uint32Array");xe.float32Array=ei("Float32Array");xe.float64Array=ei("Float64Array");xe.bigInt64Array=ei("BigInt64Array");xe.bigUint64Array=ei("BigUint64Array");xe.arrayBuffer=ei("ArrayBuffer");xe.sharedArrayBuffer=ei("SharedArrayBuffer");xe.dataView=ei("DataView");xe.directInstanceOf=(t,e)=>Object.getPrototypeOf(t)===e.prototype;xe.urlInstance=t=>ei("URL")(t);xe.urlString=t=>{if(!xe.string(t))return!1;try{return new URL(t),!0}catch{return!1}};xe.truthy=t=>Boolean(t);xe.falsy=t=>!t;xe.nan=t=>Number.isNaN(t);xe.primitive=t=>xe.null_(t)||qrt(typeof t);xe.integer=t=>Number.isInteger(t);xe.safeInteger=t=>Number.isSafeInteger(t);xe.plainObject=t=>{if(Jse.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.getPrototypeOf({})};xe.typedArray=t=>Urt(A1(t));var Wrt=t=>xe.safeInteger(t)&&t>=0;xe.arrayLike=t=>!xe.nullOrUndefined(t)&&!xe.function_(t)&&Wrt(t.length);xe.inRange=(t,e)=>{if(xe.number(e))return t>=Math.min(0,e)&&t<=Math.max(e,0);if(xe.array(e)&&e.length===2)return t>=Math.min(...e)&&t<=Math.max(...e);throw new TypeError(`Invalid range: ${JSON.stringify(e)}`)};var Vrt=1,Krt=["innerHTML","ownerDocument","style","attributes","nodeValue"];xe.domElement=t=>xe.object(t)&&t.nodeType===Vrt&&xe.string(t.nodeName)&&!xe.plainObject(t)&&Krt.every(e=>e in t);xe.observable=t=>{var e,r,o,a;return t?t===((r=(e=t)[Symbol.observable])===null||r===void 0?void 0:r.call(e))||t===((a=(o=t)["@@observable"])===null||a===void 0?void 0:a.call(o)):!1};xe.nodeStream=t=>xe.object(t)&&xe.function_(t.pipe)&&!xe.observable(t);xe.infinite=t=>t===1/0||t===-1/0;var zse=t=>e=>xe.integer(e)&&Math.abs(e%2)===t;xe.evenInteger=zse(0);xe.oddInteger=zse(1);xe.emptyArray=t=>xe.array(t)&&t.length===0;xe.nonEmptyArray=t=>xe.array(t)&&t.length>0;xe.emptyString=t=>xe.string(t)&&t.length===0;xe.nonEmptyString=t=>xe.string(t)&&t.length>0;var Jrt=t=>xe.string(t)&&!/\S/.test(t);xe.emptyStringOrWhitespace=t=>xe.emptyString(t)||Jrt(t);xe.emptyObject=t=>xe.object(t)&&!xe.map(t)&&!xe.set(t)&&Object.keys(t).length===0;xe.nonEmptyObject=t=>xe.object(t)&&!xe.map(t)&&!xe.set(t)&&Object.keys(t).length>0;xe.emptySet=t=>xe.set(t)&&t.size===0;xe.nonEmptySet=t=>xe.set(t)&&t.size>0;xe.emptyMap=t=>xe.map(t)&&t.size===0;xe.nonEmptyMap=t=>xe.map(t)&&t.size>0;xe.propertyKey=t=>xe.any([xe.string,xe.number,xe.symbol],t);xe.formData=t=>ei("FormData")(t);xe.urlSearchParams=t=>ei("URLSearchParams")(t);var Xse=(t,e,r)=>{if(!xe.function_(e))throw new TypeError(`Invalid predicate: ${JSON.stringify(e)}`);if(r.length===0)throw new TypeError("Invalid number of values");return t.call(r,e)};xe.any=(t,...e)=>(xe.array(t)?t:[t]).some(o=>Xse(Array.prototype.some,o,e));xe.all=(t,...e)=>Xse(Array.prototype.every,t,e);var Ht=(t,e,r,o={})=>{if(!t){let{multipleValues:a}=o,n=a?`received values of types ${[...new Set(r.map(u=>`\`${xe(u)}\``))].join(", ")}`:`received value of type \`${xe(r)}\``;throw new TypeError(`Expected value which is \`${e}\`, ${n}.`)}};Ff.assert={undefined:t=>Ht(xe.undefined(t),"undefined",t),string:t=>Ht(xe.string(t),"string",t),number:t=>Ht(xe.number(t),"number",t),bigint:t=>Ht(xe.bigint(t),"bigint",t),function_:t=>Ht(xe.function_(t),"Function",t),null_:t=>Ht(xe.null_(t),"null",t),class_:t=>Ht(xe.class_(t),"Class",t),boolean:t=>Ht(xe.boolean(t),"boolean",t),symbol:t=>Ht(xe.symbol(t),"symbol",t),numericString:t=>Ht(xe.numericString(t),"string with a number",t),array:(t,e)=>{Ht(xe.array(t),"Array",t),e&&t.forEach(e)},buffer:t=>Ht(xe.buffer(t),"Buffer",t),nullOrUndefined:t=>Ht(xe.nullOrUndefined(t),"null or undefined",t),object:t=>Ht(xe.object(t),"Object",t),iterable:t=>Ht(xe.iterable(t),"Iterable",t),asyncIterable:t=>Ht(xe.asyncIterable(t),"AsyncIterable",t),generator:t=>Ht(xe.generator(t),"Generator",t),asyncGenerator:t=>Ht(xe.asyncGenerator(t),"AsyncGenerator",t),nativePromise:t=>Ht(xe.nativePromise(t),"native Promise",t),promise:t=>Ht(xe.promise(t),"Promise",t),generatorFunction:t=>Ht(xe.generatorFunction(t),"GeneratorFunction",t),asyncGeneratorFunction:t=>Ht(xe.asyncGeneratorFunction(t),"AsyncGeneratorFunction",t),asyncFunction:t=>Ht(xe.asyncFunction(t),"AsyncFunction",t),boundFunction:t=>Ht(xe.boundFunction(t),"Function",t),regExp:t=>Ht(xe.regExp(t),"RegExp",t),date:t=>Ht(xe.date(t),"Date",t),error:t=>Ht(xe.error(t),"Error",t),map:t=>Ht(xe.map(t),"Map",t),set:t=>Ht(xe.set(t),"Set",t),weakMap:t=>Ht(xe.weakMap(t),"WeakMap",t),weakSet:t=>Ht(xe.weakSet(t),"WeakSet",t),int8Array:t=>Ht(xe.int8Array(t),"Int8Array",t),uint8Array:t=>Ht(xe.uint8Array(t),"Uint8Array",t),uint8ClampedArray:t=>Ht(xe.uint8ClampedArray(t),"Uint8ClampedArray",t),int16Array:t=>Ht(xe.int16Array(t),"Int16Array",t),uint16Array:t=>Ht(xe.uint16Array(t),"Uint16Array",t),int32Array:t=>Ht(xe.int32Array(t),"Int32Array",t),uint32Array:t=>Ht(xe.uint32Array(t),"Uint32Array",t),float32Array:t=>Ht(xe.float32Array(t),"Float32Array",t),float64Array:t=>Ht(xe.float64Array(t),"Float64Array",t),bigInt64Array:t=>Ht(xe.bigInt64Array(t),"BigInt64Array",t),bigUint64Array:t=>Ht(xe.bigUint64Array(t),"BigUint64Array",t),arrayBuffer:t=>Ht(xe.arrayBuffer(t),"ArrayBuffer",t),sharedArrayBuffer:t=>Ht(xe.sharedArrayBuffer(t),"SharedArrayBuffer",t),dataView:t=>Ht(xe.dataView(t),"DataView",t),urlInstance:t=>Ht(xe.urlInstance(t),"URL",t),urlString:t=>Ht(xe.urlString(t),"string with a URL",t),truthy:t=>Ht(xe.truthy(t),"truthy",t),falsy:t=>Ht(xe.falsy(t),"falsy",t),nan:t=>Ht(xe.nan(t),"NaN",t),primitive:t=>Ht(xe.primitive(t),"primitive",t),integer:t=>Ht(xe.integer(t),"integer",t),safeInteger:t=>Ht(xe.safeInteger(t),"integer",t),plainObject:t=>Ht(xe.plainObject(t),"plain object",t),typedArray:t=>Ht(xe.typedArray(t),"TypedArray",t),arrayLike:t=>Ht(xe.arrayLike(t),"array-like",t),domElement:t=>Ht(xe.domElement(t),"HTMLElement",t),observable:t=>Ht(xe.observable(t),"Observable",t),nodeStream:t=>Ht(xe.nodeStream(t),"Node.js Stream",t),infinite:t=>Ht(xe.infinite(t),"infinite number",t),emptyArray:t=>Ht(xe.emptyArray(t),"empty array",t),nonEmptyArray:t=>Ht(xe.nonEmptyArray(t),"non-empty array",t),emptyString:t=>Ht(xe.emptyString(t),"empty string",t),nonEmptyString:t=>Ht(xe.nonEmptyString(t),"non-empty string",t),emptyStringOrWhitespace:t=>Ht(xe.emptyStringOrWhitespace(t),"empty string or whitespace",t),emptyObject:t=>Ht(xe.emptyObject(t),"empty object",t),nonEmptyObject:t=>Ht(xe.nonEmptyObject(t),"non-empty object",t),emptySet:t=>Ht(xe.emptySet(t),"empty set",t),nonEmptySet:t=>Ht(xe.nonEmptySet(t),"non-empty set",t),emptyMap:t=>Ht(xe.emptyMap(t),"empty map",t),nonEmptyMap:t=>Ht(xe.nonEmptyMap(t),"non-empty map",t),propertyKey:t=>Ht(xe.propertyKey(t),"PropertyKey",t),formData:t=>Ht(xe.formData(t),"FormData",t),urlSearchParams:t=>Ht(xe.urlSearchParams(t),"URLSearchParams",t),evenInteger:t=>Ht(xe.evenInteger(t),"even integer",t),oddInteger:t=>Ht(xe.oddInteger(t),"odd integer",t),directInstanceOf:(t,e)=>Ht(xe.directInstanceOf(t,e),"T",t),inRange:(t,e)=>Ht(xe.inRange(t,e),"in range",t),any:(t,...e)=>Ht(xe.any(t,...e),"predicate returns truthy for any value",e,{multipleValues:!0}),all:(t,...e)=>Ht(xe.all(t,...e),"predicate returns truthy for all values",e,{multipleValues:!0})};Object.defineProperties(xe,{class:{value:xe.class_},function:{value:xe.function_},null:{value:xe.null_}});Object.defineProperties(Ff.assert,{class:{value:Ff.assert.class_},function:{value:Ff.assert.function_},null:{value:Ff.assert.null_}});Ff.default=xe;KS.exports=xe;KS.exports.default=xe;KS.exports.assert=Ff.assert});var Zse=_((cLt,DO)=>{"use strict";var JS=class extends Error{constructor(e){super(e||"Promise was canceled"),this.name="CancelError"}get isCanceled(){return!0}},wE=class{static fn(e){return(...r)=>new wE((o,a,n)=>{r.push(n),e(...r).then(o,a)})}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise((r,o)=>{this._reject=o;let a=A=>{this._isPending=!1,r(A)},n=A=>{this._isPending=!1,o(A)},u=A=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(A)};return Object.defineProperties(u,{shouldReject:{get:()=>this._rejectOnCancel,set:A=>{this._rejectOnCancel=A}}}),e(a,n,u)})}then(e,r){return this._promise.then(e,r)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!(!this._isPending||this._isCanceled)){if(this._cancelHandlers.length>0)try{for(let r of this._cancelHandlers)r()}catch(r){this._reject(r)}this._isCanceled=!0,this._rejectOnCancel&&this._reject(new JS(e))}}get isCanceled(){return this._isCanceled}};Object.setPrototypeOf(wE.prototype,Promise.prototype);DO.exports=wE;DO.exports.CancelError=JS});var $se=_((SO,xO)=>{"use strict";Object.defineProperty(SO,"__esModule",{value:!0});var zrt=Be("tls"),PO=(t,e)=>{let r;typeof e=="function"?r={connect:e}:r=e;let o=typeof r.connect=="function",a=typeof r.secureConnect=="function",n=typeof r.close=="function",u=()=>{o&&r.connect(),t instanceof zrt.TLSSocket&&a&&(t.authorized?r.secureConnect():t.authorizationError||t.once("secureConnect",r.secureConnect)),n&&t.once("close",r.close)};t.writable&&!t.connecting?u():t.connecting?t.once("connect",u):t.destroyed&&n&&r.close(t._hadError)};SO.default=PO;xO.exports=PO;xO.exports.default=PO});var eoe=_((kO,QO)=>{"use strict";Object.defineProperty(kO,"__esModule",{value:!0});var Xrt=$se(),Zrt=Number(process.versions.node.split(".")[0]),bO=t=>{let e={start:Date.now(),socket:void 0,lookup:void 0,connect:void 0,secureConnect:void 0,upload:void 0,response:void 0,end:void 0,error:void 0,abort:void 0,phases:{wait:void 0,dns:void 0,tcp:void 0,tls:void 0,request:void 0,firstByte:void 0,download:void 0,total:void 0}};t.timings=e;let r=u=>{let A=u.emit.bind(u);u.emit=(p,...h)=>(p==="error"&&(e.error=Date.now(),e.phases.total=e.error-e.start,u.emit=A),A(p,...h))};r(t),t.prependOnceListener("abort",()=>{e.abort=Date.now(),(!e.response||Zrt>=13)&&(e.phases.total=Date.now()-e.start)});let o=u=>{e.socket=Date.now(),e.phases.wait=e.socket-e.start;let A=()=>{e.lookup=Date.now(),e.phases.dns=e.lookup-e.socket};u.prependOnceListener("lookup",A),Xrt.default(u,{connect:()=>{e.connect=Date.now(),e.lookup===void 0&&(u.removeListener("lookup",A),e.lookup=e.connect,e.phases.dns=e.lookup-e.socket),e.phases.tcp=e.connect-e.lookup},secureConnect:()=>{e.secureConnect=Date.now(),e.phases.tls=e.secureConnect-e.connect}})};t.socket?o(t.socket):t.prependOnceListener("socket",o);let a=()=>{var u;e.upload=Date.now(),e.phases.request=e.upload-(u=e.secureConnect,u??e.connect)};return(()=>typeof t.writableFinished=="boolean"?t.writableFinished:t.finished&&t.outputSize===0&&(!t.socket||t.socket.writableLength===0))()?a():t.prependOnceListener("finish",a),t.prependOnceListener("response",u=>{e.response=Date.now(),e.phases.firstByte=e.response-e.upload,u.timings=e,r(u),u.prependOnceListener("end",()=>{e.end=Date.now(),e.phases.download=e.end-e.response,e.phases.total=e.end-e.start})}),e};kO.default=bO;QO.exports=bO;QO.exports.default=bO});var aoe=_((uLt,RO)=>{"use strict";var{V4MAPPED:$rt,ADDRCONFIG:ent,ALL:ooe,promises:{Resolver:toe},lookup:tnt}=Be("dns"),{promisify:FO}=Be("util"),rnt=Be("os"),IE=Symbol("cacheableLookupCreateConnection"),TO=Symbol("cacheableLookupInstance"),roe=Symbol("expires"),nnt=typeof ooe=="number",noe=t=>{if(!(t&&typeof t.createConnection=="function"))throw new Error("Expected an Agent instance as the first argument")},int=t=>{for(let e of t)e.family!==6&&(e.address=`::ffff:${e.address}`,e.family=6)},ioe=()=>{let t=!1,e=!1;for(let r of Object.values(rnt.networkInterfaces()))for(let o of r)if(!o.internal&&(o.family==="IPv6"?e=!0:t=!0,t&&e))return{has4:t,has6:e};return{has4:t,has6:e}},snt=t=>Symbol.iterator in t,soe={ttl:!0},ont={all:!0},zS=class{constructor({cache:e=new Map,maxTtl:r=1/0,fallbackDuration:o=3600,errorTtl:a=.15,resolver:n=new toe,lookup:u=tnt}={}){if(this.maxTtl=r,this.errorTtl=a,this._cache=e,this._resolver=n,this._dnsLookup=FO(u),this._resolver instanceof toe?(this._resolve4=this._resolver.resolve4.bind(this._resolver),this._resolve6=this._resolver.resolve6.bind(this._resolver)):(this._resolve4=FO(this._resolver.resolve4.bind(this._resolver)),this._resolve6=FO(this._resolver.resolve6.bind(this._resolver))),this._iface=ioe(),this._pending={},this._nextRemovalTime=!1,this._hostnamesToFallback=new Set,o<1)this._fallback=!1;else{this._fallback=!0;let A=setInterval(()=>{this._hostnamesToFallback.clear()},o*1e3);A.unref&&A.unref()}this.lookup=this.lookup.bind(this),this.lookupAsync=this.lookupAsync.bind(this)}set servers(e){this.clear(),this._resolver.setServers(e)}get servers(){return this._resolver.getServers()}lookup(e,r,o){if(typeof r=="function"?(o=r,r={}):typeof r=="number"&&(r={family:r}),!o)throw new Error("Callback must be a function.");this.lookupAsync(e,r).then(a=>{r.all?o(null,a):o(null,a.address,a.family,a.expires,a.ttl)},o)}async lookupAsync(e,r={}){typeof r=="number"&&(r={family:r});let o=await this.query(e);if(r.family===6){let a=o.filter(n=>n.family===6);r.hints&$rt&&(nnt&&r.hints&ooe||a.length===0)?int(o):o=a}else r.family===4&&(o=o.filter(a=>a.family===4));if(r.hints&ent){let{_iface:a}=this;o=o.filter(n=>n.family===6?a.has6:a.has4)}if(o.length===0){let a=new Error(`cacheableLookup ENOTFOUND ${e}`);throw a.code="ENOTFOUND",a.hostname=e,a}return r.all?o:o[0]}async query(e){let r=await this._cache.get(e);if(!r){let o=this._pending[e];if(o)r=await o;else{let a=this.queryAndCache(e);this._pending[e]=a,r=await a}}return r=r.map(o=>({...o})),r}async _resolve(e){let r=async h=>{try{return await h}catch(E){if(E.code==="ENODATA"||E.code==="ENOTFOUND")return[];throw E}},[o,a]=await Promise.all([this._resolve4(e,soe),this._resolve6(e,soe)].map(h=>r(h))),n=0,u=0,A=0,p=Date.now();for(let h of o)h.family=4,h.expires=p+h.ttl*1e3,n=Math.max(n,h.ttl);for(let h of a)h.family=6,h.expires=p+h.ttl*1e3,u=Math.max(u,h.ttl);return o.length>0?a.length>0?A=Math.min(n,u):A=n:A=u,{entries:[...o,...a],cacheTtl:A}}async _lookup(e){try{return{entries:await this._dnsLookup(e,{all:!0}),cacheTtl:0}}catch{return{entries:[],cacheTtl:0}}}async _set(e,r,o){if(this.maxTtl>0&&o>0){o=Math.min(o,this.maxTtl)*1e3,r[roe]=Date.now()+o;try{await this._cache.set(e,r,o)}catch(a){this.lookupAsync=async()=>{let n=new Error("Cache Error. Please recreate the CacheableLookup instance.");throw n.cause=a,n}}snt(this._cache)&&this._tick(o)}}async queryAndCache(e){if(this._hostnamesToFallback.has(e))return this._dnsLookup(e,ont);try{let r=await this._resolve(e);r.entries.length===0&&this._fallback&&(r=await this._lookup(e),r.entries.length!==0&&this._hostnamesToFallback.add(e));let o=r.entries.length===0?this.errorTtl:r.cacheTtl;return await this._set(e,r.entries,o),delete this._pending[e],r.entries}catch(r){throw delete this._pending[e],r}}_tick(e){let r=this._nextRemovalTime;(!r||e{this._nextRemovalTime=!1;let o=1/0,a=Date.now();for(let[n,u]of this._cache){let A=u[roe];a>=A?this._cache.delete(n):A("lookup"in r||(r.lookup=this.lookup),e[IE](r,o))}uninstall(e){if(noe(e),e[IE]){if(e[TO]!==this)throw new Error("The agent is not owned by this CacheableLookup instance");e.createConnection=e[IE],delete e[IE],delete e[TO]}}updateInterfaceInfo(){let{_iface:e}=this;this._iface=ioe(),(e.has4&&!this._iface.has4||e.has6&&!this._iface.has6)&&this._cache.clear()}clear(e){if(e){this._cache.delete(e);return}this._cache.clear()}};RO.exports=zS;RO.exports.default=zS});var uoe=_((ALt,NO)=>{"use strict";var ant=typeof URL>"u"?Be("url").URL:URL,lnt="text/plain",cnt="us-ascii",loe=(t,e)=>e.some(r=>r instanceof RegExp?r.test(t):r===t),unt=(t,{stripHash:e})=>{let r=t.match(/^data:([^,]*?),([^#]*?)(?:#(.*))?$/);if(!r)throw new Error(`Invalid URL: ${t}`);let o=r[1].split(";"),a=r[2],n=e?"":r[3],u=!1;o[o.length-1]==="base64"&&(o.pop(),u=!0);let A=(o.shift()||"").toLowerCase(),h=[...o.map(E=>{let[I,v=""]=E.split("=").map(b=>b.trim());return I==="charset"&&(v=v.toLowerCase(),v===cnt)?"":`${I}${v?`=${v}`:""}`}).filter(Boolean)];return u&&h.push("base64"),(h.length!==0||A&&A!==lnt)&&h.unshift(A),`data:${h.join(";")},${u?a.trim():a}${n?`#${n}`:""}`},coe=(t,e)=>{if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},Reflect.has(e,"normalizeHttps"))throw new Error("options.normalizeHttps is renamed to options.forceHttp");if(Reflect.has(e,"normalizeHttp"))throw new Error("options.normalizeHttp is renamed to options.forceHttps");if(Reflect.has(e,"stripFragment"))throw new Error("options.stripFragment is renamed to options.stripHash");if(t=t.trim(),/^data:/i.test(t))return unt(t,e);let r=t.startsWith("//");!r&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));let a=new ant(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&a.protocol==="https:"&&(a.protocol="http:"),e.forceHttps&&a.protocol==="http:"&&(a.protocol="https:"),e.stripAuthentication&&(a.username="",a.password=""),e.stripHash&&(a.hash=""),a.pathname&&(a.pathname=a.pathname.replace(/((?!:).|^)\/{2,}/g,(n,u)=>/^(?!\/)/g.test(u)?`${u}/`:"/")),a.pathname&&(a.pathname=decodeURI(a.pathname)),e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let n=a.pathname.split("/"),u=n[n.length-1];loe(u,e.removeDirectoryIndex)&&(n=n.slice(0,n.length-1),a.pathname=n.slice(1).join("/")+"/")}if(a.hostname&&(a.hostname=a.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.([a-z\-\d]{2,63})\.([a-z.]{2,5})$/.test(a.hostname)&&(a.hostname=a.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(let n of[...a.searchParams.keys()])loe(n,e.removeQueryParameters)&&a.searchParams.delete(n);return e.sortQueryParameters&&a.searchParams.sort(),e.removeTrailingSlash&&(a.pathname=a.pathname.replace(/\/$/,"")),t=a.toString(),(e.removeTrailingSlash||a.pathname==="/")&&a.hash===""&&(t=t.replace(/\/$/,"")),r&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t};NO.exports=coe;NO.exports.default=coe});var poe=_((fLt,foe)=>{foe.exports=Aoe;function Aoe(t,e){if(t&&e)return Aoe(t)(e);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(o){r[o]=t[o]}),r;function r(){for(var o=new Array(arguments.length),a=0;a{var hoe=poe();LO.exports=hoe(XS);LO.exports.strict=hoe(goe);XS.proto=XS(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return XS(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return goe(this)},configurable:!0})});function XS(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function goe(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}});var OO=_((hLt,moe)=>{var Ant=MO(),fnt=function(){},pnt=function(t){return t.setHeader&&typeof t.abort=="function"},hnt=function(t){return t.stdio&&Array.isArray(t.stdio)&&t.stdio.length===3},doe=function(t,e,r){if(typeof e=="function")return doe(t,null,e);e||(e={}),r=Ant(r||fnt);var o=t._writableState,a=t._readableState,n=e.readable||e.readable!==!1&&t.readable,u=e.writable||e.writable!==!1&&t.writable,A=function(){t.writable||p()},p=function(){u=!1,n||r.call(t)},h=function(){n=!1,u||r.call(t)},E=function(C){r.call(t,C?new Error("exited with error code: "+C):null)},I=function(C){r.call(t,C)},v=function(){if(n&&!(a&&a.ended))return r.call(t,new Error("premature close"));if(u&&!(o&&o.ended))return r.call(t,new Error("premature close"))},b=function(){t.req.on("finish",p)};return pnt(t)?(t.on("complete",p),t.on("abort",v),t.req?b():t.on("request",b)):u&&!o&&(t.on("end",A),t.on("close",A)),hnt(t)&&t.on("exit",E),t.on("end",h),t.on("finish",p),e.error!==!1&&t.on("error",I),t.on("close",v),function(){t.removeListener("complete",p),t.removeListener("abort",v),t.removeListener("request",b),t.req&&t.req.removeListener("finish",p),t.removeListener("end",A),t.removeListener("close",A),t.removeListener("finish",p),t.removeListener("exit",E),t.removeListener("end",h),t.removeListener("error",I),t.removeListener("close",v)}};moe.exports=doe});var Coe=_((gLt,Eoe)=>{var gnt=MO(),dnt=OO(),UO=Be("fs"),f1=function(){},mnt=/^v?\.0/.test(process.version),ZS=function(t){return typeof t=="function"},ynt=function(t){return!mnt||!UO?!1:(t instanceof(UO.ReadStream||f1)||t instanceof(UO.WriteStream||f1))&&ZS(t.close)},Ent=function(t){return t.setHeader&&ZS(t.abort)},Cnt=function(t,e,r,o){o=gnt(o);var a=!1;t.on("close",function(){a=!0}),dnt(t,{readable:e,writable:r},function(u){if(u)return o(u);a=!0,o()});var n=!1;return function(u){if(!a&&!n){if(n=!0,ynt(t))return t.close(f1);if(Ent(t))return t.abort();if(ZS(t.destroy))return t.destroy();o(u||new Error("stream was destroyed"))}}},yoe=function(t){t()},wnt=function(t,e){return t.pipe(e)},Int=function(){var t=Array.prototype.slice.call(arguments),e=ZS(t[t.length-1]||f1)&&t.pop()||f1;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Error("pump requires two streams per minimum");var r,o=t.map(function(a,n){var u=n0;return Cnt(a,u,A,function(p){r||(r=p),p&&o.forEach(yoe),!u&&(o.forEach(yoe),e(r))})});return t.reduce(wnt)};Eoe.exports=Int});var Ioe=_((dLt,woe)=>{"use strict";var{PassThrough:Bnt}=Be("stream");woe.exports=t=>{t={...t};let{array:e}=t,{encoding:r}=t,o=r==="buffer",a=!1;e?a=!(r||o):r=r||"utf8",o&&(r=null);let n=new Bnt({objectMode:a});r&&n.setEncoding(r);let u=0,A=[];return n.on("data",p=>{A.push(p),a?u=A.length:u+=p.length}),n.getBufferedValue=()=>e?A:o?Buffer.concat(A,u):A.join(""),n.getBufferedLength=()=>u,n}});var Boe=_((mLt,BE)=>{"use strict";var vnt=Coe(),Dnt=Ioe(),$S=class extends Error{constructor(){super("maxBuffer exceeded"),this.name="MaxBufferError"}};async function ex(t,e){if(!t)return Promise.reject(new Error("Expected a stream"));e={maxBuffer:1/0,...e};let{maxBuffer:r}=e,o;return await new Promise((a,n)=>{let u=A=>{A&&(A.bufferedData=o.getBufferedValue()),n(A)};o=vnt(t,Dnt(e),A=>{if(A){u(A);return}a()}),o.on("data",()=>{o.getBufferedLength()>r&&u(new $S)})}),o.getBufferedValue()}BE.exports=ex;BE.exports.default=ex;BE.exports.buffer=(t,e)=>ex(t,{...e,encoding:"buffer"});BE.exports.array=(t,e)=>ex(t,{...e,array:!0});BE.exports.MaxBufferError=$S});var Doe=_((ELt,voe)=>{"use strict";var Pnt=new Set([200,203,204,206,300,301,404,405,410,414,501]),Snt=new Set([200,203,204,300,301,302,303,307,308,404,405,410,414,501]),xnt=new Set([500,502,503,504]),bnt={date:!0,connection:!0,"keep-alive":!0,"proxy-authenticate":!0,"proxy-authorization":!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0},knt={"content-length":!0,"content-encoding":!0,"transfer-encoding":!0,"content-range":!0};function Dd(t){let e=parseInt(t,10);return isFinite(e)?e:0}function Qnt(t){return t?xnt.has(t.status):!0}function _O(t){let e={};if(!t)return e;let r=t.trim().split(/\s*,\s*/);for(let o of r){let[a,n]=o.split(/\s*=\s*/,2);e[a]=n===void 0?!0:n.replace(/^"|"$/g,"")}return e}function Fnt(t){let e=[];for(let r in t){let o=t[r];e.push(o===!0?r:r+"="+o)}if(!!e.length)return e.join(", ")}voe.exports=class{constructor(e,r,{shared:o,cacheHeuristic:a,immutableMinTimeToLive:n,ignoreCargoCult:u,_fromObject:A}={}){if(A){this._fromObject(A);return}if(!r||!r.headers)throw Error("Response headers missing");this._assertRequestHasHeaders(e),this._responseTime=this.now(),this._isShared=o!==!1,this._cacheHeuristic=a!==void 0?a:.1,this._immutableMinTtl=n!==void 0?n:24*3600*1e3,this._status="status"in r?r.status:200,this._resHeaders=r.headers,this._rescc=_O(r.headers["cache-control"]),this._method="method"in e?e.method:"GET",this._url=e.url,this._host=e.headers.host,this._noAuthorization=!e.headers.authorization,this._reqHeaders=r.headers.vary?e.headers:null,this._reqcc=_O(e.headers["cache-control"]),u&&"pre-check"in this._rescc&&"post-check"in this._rescc&&(delete this._rescc["pre-check"],delete this._rescc["post-check"],delete this._rescc["no-cache"],delete this._rescc["no-store"],delete this._rescc["must-revalidate"],this._resHeaders=Object.assign({},this._resHeaders,{"cache-control":Fnt(this._rescc)}),delete this._resHeaders.expires,delete this._resHeaders.pragma),r.headers["cache-control"]==null&&/no-cache/.test(r.headers.pragma)&&(this._rescc["no-cache"]=!0)}now(){return Date.now()}storable(){return!!(!this._reqcc["no-store"]&&(this._method==="GET"||this._method==="HEAD"||this._method==="POST"&&this._hasExplicitExpiration())&&Snt.has(this._status)&&!this._rescc["no-store"]&&(!this._isShared||!this._rescc.private)&&(!this._isShared||this._noAuthorization||this._allowsStoringAuthenticated())&&(this._resHeaders.expires||this._rescc["max-age"]||this._isShared&&this._rescc["s-maxage"]||this._rescc.public||Pnt.has(this._status)))}_hasExplicitExpiration(){return this._isShared&&this._rescc["s-maxage"]||this._rescc["max-age"]||this._resHeaders.expires}_assertRequestHasHeaders(e){if(!e||!e.headers)throw Error("Request headers missing")}satisfiesWithoutRevalidation(e){this._assertRequestHasHeaders(e);let r=_O(e.headers["cache-control"]);return r["no-cache"]||/no-cache/.test(e.headers.pragma)||r["max-age"]&&this.age()>r["max-age"]||r["min-fresh"]&&this.timeToLive()<1e3*r["min-fresh"]||this.stale()&&!(r["max-stale"]&&!this._rescc["must-revalidate"]&&(r["max-stale"]===!0||r["max-stale"]>this.age()-this.maxAge()))?!1:this._requestMatches(e,!1)}_requestMatches(e,r){return(!this._url||this._url===e.url)&&this._host===e.headers.host&&(!e.method||this._method===e.method||r&&e.method==="HEAD")&&this._varyMatches(e)}_allowsStoringAuthenticated(){return this._rescc["must-revalidate"]||this._rescc.public||this._rescc["s-maxage"]}_varyMatches(e){if(!this._resHeaders.vary)return!0;if(this._resHeaders.vary==="*")return!1;let r=this._resHeaders.vary.trim().toLowerCase().split(/\s*,\s*/);for(let o of r)if(e.headers[o]!==this._reqHeaders[o])return!1;return!0}_copyWithoutHopByHopHeaders(e){let r={};for(let o in e)bnt[o]||(r[o]=e[o]);if(e.connection){let o=e.connection.trim().split(/\s*,\s*/);for(let a of o)delete r[a]}if(r.warning){let o=r.warning.split(/,/).filter(a=>!/^\s*1[0-9][0-9]/.test(a));o.length?r.warning=o.join(",").trim():delete r.warning}return r}responseHeaders(){let e=this._copyWithoutHopByHopHeaders(this._resHeaders),r=this.age();return r>3600*24&&!this._hasExplicitExpiration()&&this.maxAge()>3600*24&&(e.warning=(e.warning?`${e.warning}, `:"")+'113 - "rfc7234 5.5.4"'),e.age=`${Math.round(r)}`,e.date=new Date(this.now()).toUTCString(),e}date(){let e=Date.parse(this._resHeaders.date);return isFinite(e)?e:this._responseTime}age(){let e=this._ageValue(),r=(this.now()-this._responseTime)/1e3;return e+r}_ageValue(){return Dd(this._resHeaders.age)}maxAge(){if(!this.storable()||this._rescc["no-cache"]||this._isShared&&this._resHeaders["set-cookie"]&&!this._rescc.public&&!this._rescc.immutable||this._resHeaders.vary==="*")return 0;if(this._isShared){if(this._rescc["proxy-revalidate"])return 0;if(this._rescc["s-maxage"])return Dd(this._rescc["s-maxage"])}if(this._rescc["max-age"])return Dd(this._rescc["max-age"]);let e=this._rescc.immutable?this._immutableMinTtl:0,r=this.date();if(this._resHeaders.expires){let o=Date.parse(this._resHeaders.expires);return Number.isNaN(o)||oo)return Math.max(e,(r-o)/1e3*this._cacheHeuristic)}return e}timeToLive(){let e=this.maxAge()-this.age(),r=e+Dd(this._rescc["stale-if-error"]),o=e+Dd(this._rescc["stale-while-revalidate"]);return Math.max(0,e,r,o)*1e3}stale(){return this.maxAge()<=this.age()}_useStaleIfError(){return this.maxAge()+Dd(this._rescc["stale-if-error"])>this.age()}useStaleWhileRevalidate(){return this.maxAge()+Dd(this._rescc["stale-while-revalidate"])>this.age()}static fromObject(e){return new this(void 0,void 0,{_fromObject:e})}_fromObject(e){if(this._responseTime)throw Error("Reinitialized");if(!e||e.v!==1)throw Error("Invalid serialization");this._responseTime=e.t,this._isShared=e.sh,this._cacheHeuristic=e.ch,this._immutableMinTtl=e.imm!==void 0?e.imm:24*3600*1e3,this._status=e.st,this._resHeaders=e.resh,this._rescc=e.rescc,this._method=e.m,this._url=e.u,this._host=e.h,this._noAuthorization=e.a,this._reqHeaders=e.reqh,this._reqcc=e.reqcc}toObject(){return{v:1,t:this._responseTime,sh:this._isShared,ch:this._cacheHeuristic,imm:this._immutableMinTtl,st:this._status,resh:this._resHeaders,rescc:this._rescc,m:this._method,u:this._url,h:this._host,a:this._noAuthorization,reqh:this._reqHeaders,reqcc:this._reqcc}}revalidationHeaders(e){this._assertRequestHasHeaders(e);let r=this._copyWithoutHopByHopHeaders(e.headers);if(delete r["if-range"],!this._requestMatches(e,!0)||!this.storable())return delete r["if-none-match"],delete r["if-modified-since"],r;if(this._resHeaders.etag&&(r["if-none-match"]=r["if-none-match"]?`${r["if-none-match"]}, ${this._resHeaders.etag}`:this._resHeaders.etag),r["accept-ranges"]||r["if-match"]||r["if-unmodified-since"]||this._method&&this._method!="GET"){if(delete r["if-modified-since"],r["if-none-match"]){let a=r["if-none-match"].split(/,/).filter(n=>!/^\s*W\//.test(n));a.length?r["if-none-match"]=a.join(",").trim():delete r["if-none-match"]}}else this._resHeaders["last-modified"]&&!r["if-modified-since"]&&(r["if-modified-since"]=this._resHeaders["last-modified"]);return r}revalidatedPolicy(e,r){if(this._assertRequestHasHeaders(e),this._useStaleIfError()&&Qnt(r))return{modified:!1,matches:!1,policy:this};if(!r||!r.headers)throw Error("Response headers missing");let o=!1;if(r.status!==void 0&&r.status!=304?o=!1:r.headers.etag&&!/^\s*W\//.test(r.headers.etag)?o=this._resHeaders.etag&&this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag:this._resHeaders.etag&&r.headers.etag?o=this._resHeaders.etag.replace(/^\s*W\//,"")===r.headers.etag.replace(/^\s*W\//,""):this._resHeaders["last-modified"]?o=this._resHeaders["last-modified"]===r.headers["last-modified"]:!this._resHeaders.etag&&!this._resHeaders["last-modified"]&&!r.headers.etag&&!r.headers["last-modified"]&&(o=!0),!o)return{policy:new this.constructor(e,r),modified:r.status!=304,matches:!1};let a={};for(let u in this._resHeaders)a[u]=u in r.headers&&!knt[u]?r.headers[u]:this._resHeaders[u];let n=Object.assign({},r,{status:this._status,method:this._method,headers:a});return{policy:new this.constructor(e,n,{shared:this._isShared,cacheHeuristic:this._cacheHeuristic,immutableMinTimeToLive:this._immutableMinTtl}),modified:!1,matches:!0}}}});var tx=_((CLt,Poe)=>{"use strict";Poe.exports=t=>{let e={};for(let[r,o]of Object.entries(t))e[r.toLowerCase()]=o;return e}});var xoe=_((wLt,Soe)=>{"use strict";var Tnt=Be("stream").Readable,Rnt=tx(),HO=class extends Tnt{constructor(e,r,o,a){if(typeof e!="number")throw new TypeError("Argument `statusCode` should be a number");if(typeof r!="object")throw new TypeError("Argument `headers` should be an object");if(!(o instanceof Buffer))throw new TypeError("Argument `body` should be a buffer");if(typeof a!="string")throw new TypeError("Argument `url` should be a string");super(),this.statusCode=e,this.headers=Rnt(r),this.body=o,this.url=a}_read(){this.push(this.body),this.push(null)}};Soe.exports=HO});var koe=_((ILt,boe)=>{"use strict";var Nnt=["destroy","setTimeout","socket","headers","trailers","rawHeaders","statusCode","httpVersion","httpVersionMinor","httpVersionMajor","rawTrailers","statusMessage"];boe.exports=(t,e)=>{let r=new Set(Object.keys(t).concat(Nnt));for(let o of r)o in e||(e[o]=typeof t[o]=="function"?t[o].bind(t):t[o])}});var Foe=_((BLt,Qoe)=>{"use strict";var Lnt=Be("stream").PassThrough,Mnt=koe(),Ont=t=>{if(!(t&&t.pipe))throw new TypeError("Parameter `response` must be a response stream.");let e=new Lnt;return Mnt(t,e),t.pipe(e)};Qoe.exports=Ont});var Toe=_(jO=>{jO.stringify=function t(e){if(typeof e>"u")return e;if(e&&Buffer.isBuffer(e))return JSON.stringify(":base64:"+e.toString("base64"));if(e&&e.toJSON&&(e=e.toJSON()),e&&typeof e=="object"){var r="",o=Array.isArray(e);r=o?"[":"{";var a=!0;for(var n in e){var u=typeof e[n]=="function"||!o&&typeof e[n]>"u";Object.hasOwnProperty.call(e,n)&&!u&&(a||(r+=","),a=!1,o?e[n]==null?r+="null":r+=t(e[n]):e[n]!==void 0&&(r+=t(n)+":"+t(e[n])))}return r+=o?"]":"}",r}else return typeof e=="string"?JSON.stringify(/^:/.test(e)?":"+e:e):typeof e>"u"?"null":JSON.stringify(e)};jO.parse=function(t){return JSON.parse(t,function(e,r){return typeof r=="string"?/^:base64:/.test(r)?Buffer.from(r.substring(8),"base64"):/^:/.test(r)?r.substring(1):r:r})}});var Loe=_((DLt,Noe)=>{"use strict";var Unt=Be("events"),Roe=Toe(),_nt=t=>{let e={redis:"@keyv/redis",mongodb:"@keyv/mongo",mongo:"@keyv/mongo",sqlite:"@keyv/sqlite",postgresql:"@keyv/postgres",postgres:"@keyv/postgres",mysql:"@keyv/mysql"};if(t.adapter||t.uri){let r=t.adapter||/^[^:]*/.exec(t.uri)[0];return new(Be(e[r]))(t)}return new Map},qO=class extends Unt{constructor(e,r){if(super(),this.opts=Object.assign({namespace:"keyv",serialize:Roe.stringify,deserialize:Roe.parse},typeof e=="string"?{uri:e}:e,r),!this.opts.store){let o=Object.assign({},this.opts);this.opts.store=_nt(o)}typeof this.opts.store.on=="function"&&this.opts.store.on("error",o=>this.emit("error",o)),this.opts.store.namespace=this.opts.namespace}_getKeyPrefix(e){return`${this.opts.namespace}:${e}`}get(e,r){e=this._getKeyPrefix(e);let{store:o}=this.opts;return Promise.resolve().then(()=>o.get(e)).then(a=>typeof a=="string"?this.opts.deserialize(a):a).then(a=>{if(a!==void 0){if(typeof a.expires=="number"&&Date.now()>a.expires){this.delete(e);return}return r&&r.raw?a:a.value}})}set(e,r,o){e=this._getKeyPrefix(e),typeof o>"u"&&(o=this.opts.ttl),o===0&&(o=void 0);let{store:a}=this.opts;return Promise.resolve().then(()=>{let n=typeof o=="number"?Date.now()+o:null;return r={value:r,expires:n},this.opts.serialize(r)}).then(n=>a.set(e,n,o)).then(()=>!0)}delete(e){e=this._getKeyPrefix(e);let{store:r}=this.opts;return Promise.resolve().then(()=>r.delete(e))}clear(){let{store:e}=this.opts;return Promise.resolve().then(()=>e.clear())}};Noe.exports=qO});var Uoe=_((SLt,Ooe)=>{"use strict";var Hnt=Be("events"),rx=Be("url"),jnt=uoe(),qnt=Boe(),GO=Doe(),Moe=xoe(),Gnt=tx(),Ynt=Foe(),Wnt=Loe(),jc=class{constructor(e,r){if(typeof e!="function")throw new TypeError("Parameter `request` must be a function");return this.cache=new Wnt({uri:typeof r=="string"&&r,store:typeof r!="string"&&r,namespace:"cacheable-request"}),this.createCacheableRequest(e)}createCacheableRequest(e){return(r,o)=>{let a;if(typeof r=="string")a=YO(rx.parse(r)),r={};else if(r instanceof rx.URL)a=YO(rx.parse(r.toString())),r={};else{let[I,...v]=(r.path||"").split("?"),b=v.length>0?`?${v.join("?")}`:"";a=YO({...r,pathname:I,search:b})}r={headers:{},method:"GET",cache:!0,strictTtl:!1,automaticFailover:!1,...r,...Vnt(a)},r.headers=Gnt(r.headers);let n=new Hnt,u=jnt(rx.format(a),{stripWWW:!1,removeTrailingSlash:!1,stripAuthentication:!1}),A=`${r.method}:${u}`,p=!1,h=!1,E=I=>{h=!0;let v=!1,b,C=new Promise(L=>{b=()=>{v||(v=!0,L())}}),T=L=>{if(p&&!I.forceRefresh){L.status=L.statusCode;let J=GO.fromObject(p.cachePolicy).revalidatedPolicy(I,L);if(!J.modified){let te=J.policy.responseHeaders();L=new Moe(p.statusCode,te,p.body,p.url),L.cachePolicy=J.policy,L.fromCache=!0}}L.fromCache||(L.cachePolicy=new GO(I,L,I),L.fromCache=!1);let U;I.cache&&L.cachePolicy.storable()?(U=Ynt(L),(async()=>{try{let J=qnt.buffer(L);if(await Promise.race([C,new Promise(Ae=>L.once("end",Ae))]),v)return;let te=await J,le={cachePolicy:L.cachePolicy.toObject(),url:L.url,statusCode:L.fromCache?p.statusCode:L.statusCode,body:te},pe=I.strictTtl?L.cachePolicy.timeToLive():void 0;I.maxTtl&&(pe=pe?Math.min(pe,I.maxTtl):I.maxTtl),await this.cache.set(A,le,pe)}catch(J){n.emit("error",new jc.CacheError(J))}})()):I.cache&&p&&(async()=>{try{await this.cache.delete(A)}catch(J){n.emit("error",new jc.CacheError(J))}})(),n.emit("response",U||L),typeof o=="function"&&o(U||L)};try{let L=e(I,T);L.once("error",b),L.once("abort",b),n.emit("request",L)}catch(L){n.emit("error",new jc.RequestError(L))}};return(async()=>{let I=async b=>{await Promise.resolve();let C=b.cache?await this.cache.get(A):void 0;if(typeof C>"u")return E(b);let T=GO.fromObject(C.cachePolicy);if(T.satisfiesWithoutRevalidation(b)&&!b.forceRefresh){let L=T.responseHeaders(),U=new Moe(C.statusCode,L,C.body,C.url);U.cachePolicy=T,U.fromCache=!0,n.emit("response",U),typeof o=="function"&&o(U)}else p=C,b.headers=T.revalidationHeaders(b),E(b)},v=b=>n.emit("error",new jc.CacheError(b));this.cache.once("error",v),n.on("response",()=>this.cache.removeListener("error",v));try{await I(r)}catch(b){r.automaticFailover&&!h&&E(r),n.emit("error",new jc.CacheError(b))}})(),n}}};function Vnt(t){let e={...t};return e.path=`${t.pathname||"/"}${t.search||""}`,delete e.pathname,delete e.search,e}function YO(t){return{protocol:t.protocol,auth:t.auth,hostname:t.hostname||t.host||"localhost",port:t.port,pathname:t.pathname,search:t.search}}jc.RequestError=class extends Error{constructor(t){super(t.message),this.name="RequestError",Object.assign(this,t)}};jc.CacheError=class extends Error{constructor(t){super(t.message),this.name="CacheError",Object.assign(this,t)}};Ooe.exports=jc});var Hoe=_((kLt,_oe)=>{"use strict";var Knt=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];_oe.exports=(t,e)=>{if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let r=new Set(Object.keys(t).concat(Knt)),o={};for(let a of r)a in e||(o[a]={get(){let n=t[a];return typeof n=="function"?n.bind(t):n},set(n){t[a]=n},enumerable:!0,configurable:!1});return Object.defineProperties(e,o),t.once("aborted",()=>{e.destroy(),e.emit("aborted")}),t.once("close",()=>{t.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var qoe=_((QLt,joe)=>{"use strict";var{Transform:Jnt,PassThrough:znt}=Be("stream"),WO=Be("zlib"),Xnt=Hoe();joe.exports=t=>{let e=(t.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return t;let r=e==="br";if(r&&typeof WO.createBrotliDecompress!="function")return t.destroy(new Error("Brotli is not supported on Node.js < 12")),t;let o=!0,a=new Jnt({transform(A,p,h){o=!1,h(null,A)},flush(A){A()}}),n=new znt({autoDestroy:!1,destroy(A,p){t.destroy(),p(A)}}),u=r?WO.createBrotliDecompress():WO.createUnzip();return u.once("error",A=>{if(o&&!t.readable){n.end();return}n.destroy(A)}),Xnt(t,n),t.pipe(a).pipe(u).pipe(n),n}});var KO=_((FLt,Goe)=>{"use strict";var VO=class{constructor(e={}){if(!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=e.maxSize,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(e,r){if(this.cache.set(e,r),this._size++,this._size>=this.maxSize){if(this._size=0,typeof this.onEviction=="function")for(let[o,a]of this.oldCache.entries())this.onEviction(o,a);this.oldCache=this.cache,this.cache=new Map}}get(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e)){let r=this.oldCache.get(e);return this.oldCache.delete(e),this._set(e,r),r}}set(e,r){return this.cache.has(e)?this.cache.set(e,r):this._set(e,r),this}has(e){return this.cache.has(e)||this.oldCache.has(e)}peek(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e))return this.oldCache.get(e)}delete(e){let r=this.cache.delete(e);return r&&this._size--,this.oldCache.delete(e)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.cache)yield e;for(let e of this.oldCache){let[r]=e;this.cache.has(r)||(yield e)}}get size(){let e=0;for(let r of this.oldCache.keys())this.cache.has(r)||e++;return Math.min(this._size+e,this.maxSize)}};Goe.exports=VO});var zO=_((TLt,Koe)=>{"use strict";var Znt=Be("events"),$nt=Be("tls"),eit=Be("http2"),tit=KO(),ea=Symbol("currentStreamsCount"),Yoe=Symbol("request"),Wl=Symbol("cachedOriginSet"),vE=Symbol("gracefullyClosing"),rit=["maxDeflateDynamicTableSize","maxSessionMemory","maxHeaderListPairs","maxOutstandingPings","maxReservedRemoteStreams","maxSendHeaderBlockLength","paddingStrategy","localAddress","path","rejectUnauthorized","minDHSize","ca","cert","clientCertEngine","ciphers","key","pfx","servername","minVersion","maxVersion","secureProtocol","crl","honorCipherOrder","ecdhCurve","dhparam","secureOptions","sessionIdContext"],nit=(t,e,r)=>{let o=0,a=t.length;for(;o>>1;r(t[n],e)?o=n+1:a=n}return o},iit=(t,e)=>t.remoteSettings.maxConcurrentStreams>e.remoteSettings.maxConcurrentStreams,JO=(t,e)=>{for(let r of t)r[Wl].lengthe[Wl].includes(o))&&r[ea]+e[ea]<=e.remoteSettings.maxConcurrentStreams&&Voe(r)},sit=(t,e)=>{for(let r of t)e[Wl].lengthr[Wl].includes(o))&&e[ea]+r[ea]<=r.remoteSettings.maxConcurrentStreams&&Voe(e)},Woe=({agent:t,isFree:e})=>{let r={};for(let o in t.sessions){let n=t.sessions[o].filter(u=>{let A=u[tA.kCurrentStreamsCount]{t[vE]=!0,t[ea]===0&&t.close()},tA=class extends Znt{constructor({timeout:e=6e4,maxSessions:r=1/0,maxFreeSessions:o=10,maxCachedTlsSessions:a=100}={}){super(),this.sessions={},this.queue={},this.timeout=e,this.maxSessions=r,this.maxFreeSessions=o,this._freeSessionsCount=0,this._sessionsCount=0,this.settings={enablePush:!1},this.tlsSessionCache=new tit({maxSize:a})}static normalizeOrigin(e,r){return typeof e=="string"&&(e=new URL(e)),r&&e.hostname!==r&&(e.hostname=r),e.origin}normalizeOptions(e){let r="";if(e)for(let o of rit)e[o]&&(r+=`:${e[o]}`);return r}_tryToCreateNewSession(e,r){if(!(e in this.queue)||!(r in this.queue[e]))return;let o=this.queue[e][r];this._sessionsCount{Array.isArray(o)?(o=[...o],a()):o=[{resolve:a,reject:n}];let u=this.normalizeOptions(r),A=tA.normalizeOrigin(e,r&&r.servername);if(A===void 0){for(let{reject:E}of o)E(new TypeError("The `origin` argument needs to be a string or an URL object"));return}if(u in this.sessions){let E=this.sessions[u],I=-1,v=-1,b;for(let C of E){let T=C.remoteSettings.maxConcurrentStreams;if(T=T||C[vE]||C.destroyed)continue;b||(I=T),L>v&&(b=C,v=L)}}if(b){if(o.length!==1){for(let{reject:C}of o){let T=new Error(`Expected the length of listeners to be 1, got ${o.length}. +Please report this to https://github.com/szmarczak/http2-wrapper/`);C(T)}return}o[0].resolve(b);return}}if(u in this.queue){if(A in this.queue[u]){this.queue[u][A].listeners.push(...o),this._tryToCreateNewSession(u,A);return}}else this.queue[u]={};let p=()=>{u in this.queue&&this.queue[u][A]===h&&(delete this.queue[u][A],Object.keys(this.queue[u]).length===0&&delete this.queue[u])},h=()=>{let E=`${A}:${u}`,I=!1;try{let v=eit.connect(e,{createConnection:this.createConnection,settings:this.settings,session:this.tlsSessionCache.get(E),...r});v[ea]=0,v[vE]=!1;let b=()=>v[ea]{this.tlsSessionCache.set(E,L)}),v.once("error",L=>{for(let{reject:U}of o)U(L);this.tlsSessionCache.delete(E)}),v.setTimeout(this.timeout,()=>{v.destroy()}),v.once("close",()=>{if(I){C&&this._freeSessionsCount--,this._sessionsCount--;let L=this.sessions[u];L.splice(L.indexOf(v),1),L.length===0&&delete this.sessions[u]}else{let L=new Error("Session closed without receiving a SETTINGS frame");L.code="HTTP2WRAPPER_NOSETTINGS";for(let{reject:U}of o)U(L);p()}this._tryToCreateNewSession(u,A)});let T=()=>{if(!(!(u in this.queue)||!b())){for(let L of v[Wl])if(L in this.queue[u]){let{listeners:U}=this.queue[u][L];for(;U.length!==0&&b();)U.shift().resolve(v);let J=this.queue[u];if(J[L].listeners.length===0&&(delete J[L],Object.keys(J).length===0)){delete this.queue[u];break}if(!b())break}}};v.on("origin",()=>{v[Wl]=v.originSet,b()&&(T(),JO(this.sessions[u],v))}),v.once("remoteSettings",()=>{if(v.ref(),v.unref(),this._sessionsCount++,h.destroyed){let L=new Error("Agent has been destroyed");for(let U of o)U.reject(L);v.destroy();return}v[Wl]=v.originSet;{let L=this.sessions;if(u in L){let U=L[u];U.splice(nit(U,v,iit),0,v)}else L[u]=[v]}this._freeSessionsCount+=1,I=!0,this.emit("session",v),T(),p(),v[ea]===0&&this._freeSessionsCount>this.maxFreeSessions&&v.close(),o.length!==0&&(this.getSession(A,r,o),o.length=0),v.on("remoteSettings",()=>{T(),JO(this.sessions[u],v)})}),v[Yoe]=v.request,v.request=(L,U)=>{if(v[vE])throw new Error("The session is gracefully closing. No new streams are allowed.");let J=v[Yoe](L,U);return v.ref(),++v[ea],v[ea]===v.remoteSettings.maxConcurrentStreams&&this._freeSessionsCount--,J.once("close",()=>{if(C=b(),--v[ea],!v.destroyed&&!v.closed&&(sit(this.sessions[u],v),b()&&!v.closed)){C||(this._freeSessionsCount++,C=!0);let te=v[ea]===0;te&&v.unref(),te&&(this._freeSessionsCount>this.maxFreeSessions||v[vE])?v.close():(JO(this.sessions[u],v),T())}}),J}}catch(v){for(let b of o)b.reject(v);p()}};h.listeners=o,h.completed=!1,h.destroyed=!1,this.queue[u][A]=h,this._tryToCreateNewSession(u,A)})}request(e,r,o,a){return new Promise((n,u)=>{this.getSession(e,r,[{reject:u,resolve:A=>{try{n(A.request(o,a))}catch(p){u(p)}}}])})}createConnection(e,r){return tA.connect(e,r)}static connect(e,r){r.ALPNProtocols=["h2"];let o=e.port||443,a=e.hostname||e.host;return typeof r.servername>"u"&&(r.servername=a),$nt.connect(o,a,r)}closeFreeSessions(){for(let e of Object.values(this.sessions))for(let r of e)r[ea]===0&&r.close()}destroy(e){for(let r of Object.values(this.sessions))for(let o of r)o.destroy(e);for(let r of Object.values(this.queue))for(let o of Object.values(r))o.destroyed=!0;this.queue={}}get freeSessions(){return Woe({agent:this,isFree:!0})}get busySessions(){return Woe({agent:this,isFree:!1})}};tA.kCurrentStreamsCount=ea;tA.kGracefullyClosing=vE;Koe.exports={Agent:tA,globalAgent:new tA}});var ZO=_((RLt,Joe)=>{"use strict";var{Readable:oit}=Be("stream"),XO=class extends oit{constructor(e,r){super({highWaterMark:r,autoDestroy:!1}),this.statusCode=null,this.statusMessage="",this.httpVersion="2.0",this.httpVersionMajor=2,this.httpVersionMinor=0,this.headers={},this.trailers={},this.req=null,this.aborted=!1,this.complete=!1,this.upgrade=null,this.rawHeaders=[],this.rawTrailers=[],this.socket=e,this.connection=e,this._dumped=!1}_destroy(e){this.req._request.destroy(e)}setTimeout(e,r){return this.req.setTimeout(e,r),this}_dump(){this._dumped||(this._dumped=!0,this.removeAllListeners("data"),this.resume())}_read(){this.req&&this.req._request.resume()}};Joe.exports=XO});var $O=_((NLt,zoe)=>{"use strict";zoe.exports=t=>{let e={protocol:t.protocol,hostname:typeof t.hostname=="string"&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,host:t.host,hash:t.hash,search:t.search,pathname:t.pathname,href:t.href,path:`${t.pathname||""}${t.search||""}`};return typeof t.port=="string"&&t.port.length!==0&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth=`${t.username||""}:${t.password||""}`),e}});var Zoe=_((LLt,Xoe)=>{"use strict";Xoe.exports=(t,e,r)=>{for(let o of r)t.on(o,(...a)=>e.emit(o,...a))}});var eae=_((MLt,$oe)=>{"use strict";$oe.exports=t=>{switch(t){case":method":case":scheme":case":authority":case":path":return!0;default:return!1}}});var rae=_((ULt,tae)=>{"use strict";var DE=(t,e,r)=>{tae.exports[e]=class extends t{constructor(...a){super(typeof r=="string"?r:r(a)),this.name=`${super.name} [${e}]`,this.code=e}}};DE(TypeError,"ERR_INVALID_ARG_TYPE",t=>{let e=t[0].includes(".")?"property":"argument",r=t[1],o=Array.isArray(r);return o&&(r=`${r.slice(0,-1).join(", ")} or ${r.slice(-1)}`),`The "${t[0]}" ${e} must be ${o?"one of":"of"} type ${r}. Received ${typeof t[2]}`});DE(TypeError,"ERR_INVALID_PROTOCOL",t=>`Protocol "${t[0]}" not supported. Expected "${t[1]}"`);DE(Error,"ERR_HTTP_HEADERS_SENT",t=>`Cannot ${t[0]} headers after they are sent to the client`);DE(TypeError,"ERR_INVALID_HTTP_TOKEN",t=>`${t[0]} must be a valid HTTP token [${t[1]}]`);DE(TypeError,"ERR_HTTP_INVALID_HEADER_VALUE",t=>`Invalid value "${t[0]} for header "${t[1]}"`);DE(TypeError,"ERR_INVALID_CHAR",t=>`Invalid character in ${t[0]} [${t[1]}]`)});var i4=_((_Lt,cae)=>{"use strict";var ait=Be("http2"),{Writable:lit}=Be("stream"),{Agent:nae,globalAgent:cit}=zO(),uit=ZO(),Ait=$O(),fit=Zoe(),pit=eae(),{ERR_INVALID_ARG_TYPE:e4,ERR_INVALID_PROTOCOL:hit,ERR_HTTP_HEADERS_SENT:iae,ERR_INVALID_HTTP_TOKEN:git,ERR_HTTP_INVALID_HEADER_VALUE:dit,ERR_INVALID_CHAR:mit}=rae(),{HTTP2_HEADER_STATUS:sae,HTTP2_HEADER_METHOD:oae,HTTP2_HEADER_PATH:aae,HTTP2_METHOD_CONNECT:yit}=ait.constants,Qo=Symbol("headers"),t4=Symbol("origin"),r4=Symbol("session"),lae=Symbol("options"),nx=Symbol("flushedHeaders"),p1=Symbol("jobs"),Eit=/^[\^`\-\w!#$%&*+.|~]+$/,Cit=/[^\t\u0020-\u007E\u0080-\u00FF]/,n4=class extends lit{constructor(e,r,o){super({autoDestroy:!1});let a=typeof e=="string"||e instanceof URL;if(a&&(e=Ait(e instanceof URL?e:new URL(e))),typeof r=="function"||r===void 0?(o=r,r=a?e:{...e}):r={...e,...r},r.h2session)this[r4]=r.h2session;else if(r.agent===!1)this.agent=new nae({maxFreeSessions:0});else if(typeof r.agent>"u"||r.agent===null)typeof r.createConnection=="function"?(this.agent=new nae({maxFreeSessions:0}),this.agent.createConnection=r.createConnection):this.agent=cit;else if(typeof r.agent.request=="function")this.agent=r.agent;else throw new e4("options.agent",["Agent-like Object","undefined","false"],r.agent);if(r.protocol&&r.protocol!=="https:")throw new hit(r.protocol,"https:");let n=r.port||r.defaultPort||this.agent&&this.agent.defaultPort||443,u=r.hostname||r.host||"localhost";delete r.hostname,delete r.host,delete r.port;let{timeout:A}=r;if(r.timeout=void 0,this[Qo]=Object.create(null),this[p1]=[],this.socket=null,this.connection=null,this.method=r.method||"GET",this.path=r.path,this.res=null,this.aborted=!1,this.reusedSocket=!1,r.headers)for(let[p,h]of Object.entries(r.headers))this.setHeader(p,h);r.auth&&!("authorization"in this[Qo])&&(this[Qo].authorization="Basic "+Buffer.from(r.auth).toString("base64")),r.session=r.tlsSession,r.path=r.socketPath,this[lae]=r,n===443?(this[t4]=`https://${u}`,":authority"in this[Qo]||(this[Qo][":authority"]=u)):(this[t4]=`https://${u}:${n}`,":authority"in this[Qo]||(this[Qo][":authority"]=`${u}:${n}`)),A&&this.setTimeout(A),o&&this.once("response",o),this[nx]=!1}get method(){return this[Qo][oae]}set method(e){e&&(this[Qo][oae]=e.toUpperCase())}get path(){return this[Qo][aae]}set path(e){e&&(this[Qo][aae]=e)}get _mustNotHaveABody(){return this.method==="GET"||this.method==="HEAD"||this.method==="DELETE"}_write(e,r,o){if(this._mustNotHaveABody){o(new Error("The GET, HEAD and DELETE methods must NOT have a body"));return}this.flushHeaders();let a=()=>this._request.write(e,r,o);this._request?a():this[p1].push(a)}_final(e){if(this.destroyed)return;this.flushHeaders();let r=()=>{if(this._mustNotHaveABody){e();return}this._request.end(e)};this._request?r():this[p1].push(r)}abort(){this.res&&this.res.complete||(this.aborted||process.nextTick(()=>this.emit("abort")),this.aborted=!0,this.destroy())}_destroy(e,r){this.res&&this.res._dump(),this._request&&this._request.destroy(),r(e)}async flushHeaders(){if(this[nx]||this.destroyed)return;this[nx]=!0;let e=this.method===yit,r=o=>{if(this._request=o,this.destroyed){o.destroy();return}e||fit(o,this,["timeout","continue","close","error"]);let a=u=>(...A)=>{!this.writable&&!this.destroyed?u(...A):this.once("finish",()=>{u(...A)})};o.once("response",a((u,A,p)=>{let h=new uit(this.socket,o.readableHighWaterMark);this.res=h,h.req=this,h.statusCode=u[sae],h.headers=u,h.rawHeaders=p,h.once("end",()=>{this.aborted?(h.aborted=!0,h.emit("aborted")):(h.complete=!0,h.socket=null,h.connection=null)}),e?(h.upgrade=!0,this.emit("connect",h,o,Buffer.alloc(0))?this.emit("close"):o.destroy()):(o.on("data",E=>{!h._dumped&&!h.push(E)&&o.pause()}),o.once("end",()=>{h.push(null)}),this.emit("response",h)||h._dump())})),o.once("headers",a(u=>this.emit("information",{statusCode:u[sae]}))),o.once("trailers",a((u,A,p)=>{let{res:h}=this;h.trailers=u,h.rawTrailers=p}));let{socket:n}=o.session;this.socket=n,this.connection=n;for(let u of this[p1])u();this.emit("socket",this.socket)};if(this[r4])try{r(this[r4].request(this[Qo]))}catch(o){this.emit("error",o)}else{this.reusedSocket=!0;try{r(await this.agent.request(this[t4],this[lae],this[Qo]))}catch(o){this.emit("error",o)}}}getHeader(e){if(typeof e!="string")throw new e4("name","string",e);return this[Qo][e.toLowerCase()]}get headersSent(){return this[nx]}removeHeader(e){if(typeof e!="string")throw new e4("name","string",e);if(this.headersSent)throw new iae("remove");delete this[Qo][e.toLowerCase()]}setHeader(e,r){if(this.headersSent)throw new iae("set");if(typeof e!="string"||!Eit.test(e)&&!pit(e))throw new git("Header name",e);if(typeof r>"u")throw new dit(r,e);if(Cit.test(r))throw new mit("header content",e);this[Qo][e.toLowerCase()]=r}setNoDelay(){}setSocketKeepAlive(){}setTimeout(e,r){let o=()=>this._request.setTimeout(e,r);return this._request?o():this[p1].push(o),this}get maxHeadersCount(){if(!this.destroyed&&this._request)return this._request.session.localSettings.maxHeaderListSize}set maxHeadersCount(e){}};cae.exports=n4});var Aae=_((HLt,uae)=>{"use strict";var wit=Be("tls");uae.exports=(t={})=>new Promise((e,r)=>{let o=wit.connect(t,()=>{t.resolveSocket?(o.off("error",r),e({alpnProtocol:o.alpnProtocol,socket:o})):(o.destroy(),e({alpnProtocol:o.alpnProtocol}))});o.on("error",r)})});var pae=_((jLt,fae)=>{"use strict";var Iit=Be("net");fae.exports=t=>{let e=t.host,r=t.headers&&t.headers.host;return r&&(r.startsWith("[")?r.indexOf("]")===-1?e=r:e=r.slice(1,-1):e=r.split(":",1)[0]),Iit.isIP(e)?"":e}});var dae=_((qLt,o4)=>{"use strict";var hae=Be("http"),s4=Be("https"),Bit=Aae(),vit=KO(),Dit=i4(),Pit=pae(),Sit=$O(),ix=new vit({maxSize:100}),h1=new Map,gae=(t,e,r)=>{e._httpMessage={shouldKeepAlive:!0};let o=()=>{t.emit("free",e,r)};e.on("free",o);let a=()=>{t.removeSocket(e,r)};e.on("close",a);let n=()=>{t.removeSocket(e,r),e.off("close",a),e.off("free",o),e.off("agentRemove",n)};e.on("agentRemove",n),t.emit("free",e,r)},xit=async t=>{let e=`${t.host}:${t.port}:${t.ALPNProtocols.sort()}`;if(!ix.has(e)){if(h1.has(e))return(await h1.get(e)).alpnProtocol;let{path:r,agent:o}=t;t.path=t.socketPath;let a=Bit(t);h1.set(e,a);try{let{socket:n,alpnProtocol:u}=await a;if(ix.set(e,u),t.path=r,u==="h2")n.destroy();else{let{globalAgent:A}=s4,p=s4.Agent.prototype.createConnection;o?o.createConnection===p?gae(o,n,t):n.destroy():A.createConnection===p?gae(A,n,t):n.destroy()}return h1.delete(e),u}catch(n){throw h1.delete(e),n}}return ix.get(e)};o4.exports=async(t,e,r)=>{if((typeof t=="string"||t instanceof URL)&&(t=Sit(new URL(t))),typeof e=="function"&&(r=e,e=void 0),e={ALPNProtocols:["h2","http/1.1"],...t,...e,resolveSocket:!0},!Array.isArray(e.ALPNProtocols)||e.ALPNProtocols.length===0)throw new Error("The `ALPNProtocols` option must be an Array with at least one entry");e.protocol=e.protocol||"https:";let o=e.protocol==="https:";e.host=e.hostname||e.host||"localhost",e.session=e.tlsSession,e.servername=e.servername||Pit(e),e.port=e.port||(o?443:80),e._defaultAgent=o?s4.globalAgent:hae.globalAgent;let a=e.agent;if(a){if(a.addRequest)throw new Error("The `options.agent` object can contain only `http`, `https` or `http2` properties");e.agent=a[o?"https":"http"]}return o&&await xit(e)==="h2"?(a&&(e.agent=a.http2),new Dit(e,r)):hae.request(e,r)};o4.exports.protocolCache=ix});var yae=_((GLt,mae)=>{"use strict";var bit=Be("http2"),kit=zO(),a4=i4(),Qit=ZO(),Fit=dae(),Tit=(t,e,r)=>new a4(t,e,r),Rit=(t,e,r)=>{let o=new a4(t,e,r);return o.end(),o};mae.exports={...bit,ClientRequest:a4,IncomingMessage:Qit,...kit,request:Tit,get:Rit,auto:Fit}});var c4=_(l4=>{"use strict";Object.defineProperty(l4,"__esModule",{value:!0});var Eae=Tf();l4.default=t=>Eae.default.nodeStream(t)&&Eae.default.function_(t.getBoundary)});var Bae=_(u4=>{"use strict";Object.defineProperty(u4,"__esModule",{value:!0});var wae=Be("fs"),Iae=Be("util"),Cae=Tf(),Nit=c4(),Lit=Iae.promisify(wae.stat);u4.default=async(t,e)=>{if(e&&"content-length"in e)return Number(e["content-length"]);if(!t)return 0;if(Cae.default.string(t))return Buffer.byteLength(t);if(Cae.default.buffer(t))return t.length;if(Nit.default(t))return Iae.promisify(t.getLength.bind(t))();if(t instanceof wae.ReadStream){let{size:r}=await Lit(t.path);return r===0?void 0:r}}});var f4=_(A4=>{"use strict";Object.defineProperty(A4,"__esModule",{value:!0});function Mit(t,e,r){let o={};for(let a of r)o[a]=(...n)=>{e.emit(a,...n)},t.on(a,o[a]);return()=>{for(let a of r)t.off(a,o[a])}}A4.default=Mit});var vae=_(p4=>{"use strict";Object.defineProperty(p4,"__esModule",{value:!0});p4.default=()=>{let t=[];return{once(e,r,o){e.once(r,o),t.push({origin:e,event:r,fn:o})},unhandleAll(){for(let e of t){let{origin:r,event:o,fn:a}=e;r.removeListener(o,a)}t.length=0}}}});var Pae=_(g1=>{"use strict";Object.defineProperty(g1,"__esModule",{value:!0});g1.TimeoutError=void 0;var Oit=Be("net"),Uit=vae(),Dae=Symbol("reentry"),_it=()=>{},sx=class extends Error{constructor(e,r){super(`Timeout awaiting '${r}' for ${e}ms`),this.event=r,this.name="TimeoutError",this.code="ETIMEDOUT"}};g1.TimeoutError=sx;g1.default=(t,e,r)=>{if(Dae in t)return _it;t[Dae]=!0;let o=[],{once:a,unhandleAll:n}=Uit.default(),u=(I,v,b)=>{var C;let T=setTimeout(v,I,I,b);(C=T.unref)===null||C===void 0||C.call(T);let L=()=>{clearTimeout(T)};return o.push(L),L},{host:A,hostname:p}=r,h=(I,v)=>{t.destroy(new sx(I,v))},E=()=>{for(let I of o)I();n()};if(t.once("error",I=>{if(E(),t.listenerCount("error")===0)throw I}),t.once("close",E),a(t,"response",I=>{a(I,"end",E)}),typeof e.request<"u"&&u(e.request,h,"request"),typeof e.socket<"u"){let I=()=>{h(e.socket,"socket")};t.setTimeout(e.socket,I),o.push(()=>{t.removeListener("timeout",I)})}return a(t,"socket",I=>{var v;let{socketPath:b}=t;if(I.connecting){let C=Boolean(b??Oit.isIP((v=p??A)!==null&&v!==void 0?v:"")!==0);if(typeof e.lookup<"u"&&!C&&typeof I.address().address>"u"){let T=u(e.lookup,h,"lookup");a(I,"lookup",T)}if(typeof e.connect<"u"){let T=()=>u(e.connect,h,"connect");C?a(I,"connect",T()):a(I,"lookup",L=>{L===null&&a(I,"connect",T())})}typeof e.secureConnect<"u"&&r.protocol==="https:"&&a(I,"connect",()=>{let T=u(e.secureConnect,h,"secureConnect");a(I,"secureConnect",T)})}if(typeof e.send<"u"){let C=()=>u(e.send,h,"send");I.connecting?a(I,"connect",()=>{a(t,"upload-complete",C())}):a(t,"upload-complete",C())}}),typeof e.response<"u"&&a(t,"upload-complete",()=>{let I=u(e.response,h,"response");a(t,"response",I)}),E}});var xae=_(h4=>{"use strict";Object.defineProperty(h4,"__esModule",{value:!0});var Sae=Tf();h4.default=t=>{t=t;let e={protocol:t.protocol,hostname:Sae.default.string(t.hostname)&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,host:t.host,hash:t.hash,search:t.search,pathname:t.pathname,href:t.href,path:`${t.pathname||""}${t.search||""}`};return Sae.default.string(t.port)&&t.port.length>0&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth=`${t.username||""}:${t.password||""}`),e}});var bae=_(g4=>{"use strict";Object.defineProperty(g4,"__esModule",{value:!0});var Hit=Be("url"),jit=["protocol","host","hostname","port","pathname","search"];g4.default=(t,e)=>{var r,o;if(e.path){if(e.pathname)throw new TypeError("Parameters `path` and `pathname` are mutually exclusive.");if(e.search)throw new TypeError("Parameters `path` and `search` are mutually exclusive.");if(e.searchParams)throw new TypeError("Parameters `path` and `searchParams` are mutually exclusive.")}if(e.search&&e.searchParams)throw new TypeError("Parameters `search` and `searchParams` are mutually exclusive.");if(!t){if(!e.protocol)throw new TypeError("No URL protocol specified");t=`${e.protocol}//${(o=(r=e.hostname)!==null&&r!==void 0?r:e.host)!==null&&o!==void 0?o:""}`}let a=new Hit.URL(t);if(e.path){let n=e.path.indexOf("?");n===-1?e.pathname=e.path:(e.pathname=e.path.slice(0,n),e.search=e.path.slice(n+1)),delete e.path}for(let n of jit)e[n]&&(a[n]=e[n].toString());return a}});var kae=_(m4=>{"use strict";Object.defineProperty(m4,"__esModule",{value:!0});var d4=class{constructor(){this.weakMap=new WeakMap,this.map=new Map}set(e,r){typeof e=="object"?this.weakMap.set(e,r):this.map.set(e,r)}get(e){return typeof e=="object"?this.weakMap.get(e):this.map.get(e)}has(e){return typeof e=="object"?this.weakMap.has(e):this.map.has(e)}};m4.default=d4});var E4=_(y4=>{"use strict";Object.defineProperty(y4,"__esModule",{value:!0});var qit=async t=>{let e=[],r=0;for await(let o of t)e.push(o),r+=Buffer.byteLength(o);return Buffer.isBuffer(e[0])?Buffer.concat(e,r):Buffer.from(e.join(""))};y4.default=qit});var Fae=_(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});Pd.dnsLookupIpVersionToFamily=Pd.isDnsLookupIpVersion=void 0;var Qae={auto:0,ipv4:4,ipv6:6};Pd.isDnsLookupIpVersion=t=>t in Qae;Pd.dnsLookupIpVersionToFamily=t=>{if(Pd.isDnsLookupIpVersion(t))return Qae[t];throw new Error("Invalid DNS lookup IP version")}});var C4=_(ox=>{"use strict";Object.defineProperty(ox,"__esModule",{value:!0});ox.isResponseOk=void 0;ox.isResponseOk=t=>{let{statusCode:e}=t,r=t.request.options.followRedirect?299:399;return e>=200&&e<=r||e===304}});var Rae=_(w4=>{"use strict";Object.defineProperty(w4,"__esModule",{value:!0});var Tae=new Set;w4.default=t=>{Tae.has(t)||(Tae.add(t),process.emitWarning(`Got: ${t}`,{type:"DeprecationWarning"}))}});var Nae=_(I4=>{"use strict";Object.defineProperty(I4,"__esModule",{value:!0});var Ai=Tf(),Git=(t,e)=>{if(Ai.default.null_(t.encoding))throw new TypeError("To get a Buffer, set `options.responseType` to `buffer` instead");Ai.assert.any([Ai.default.string,Ai.default.undefined],t.encoding),Ai.assert.any([Ai.default.boolean,Ai.default.undefined],t.resolveBodyOnly),Ai.assert.any([Ai.default.boolean,Ai.default.undefined],t.methodRewriting),Ai.assert.any([Ai.default.boolean,Ai.default.undefined],t.isStream),Ai.assert.any([Ai.default.string,Ai.default.undefined],t.responseType),t.responseType===void 0&&(t.responseType="text");let{retry:r}=t;if(e?t.retry={...e.retry}:t.retry={calculateDelay:o=>o.computedValue,limit:0,methods:[],statusCodes:[],errorCodes:[],maxRetryAfter:void 0},Ai.default.object(r)?(t.retry={...t.retry,...r},t.retry.methods=[...new Set(t.retry.methods.map(o=>o.toUpperCase()))],t.retry.statusCodes=[...new Set(t.retry.statusCodes)],t.retry.errorCodes=[...new Set(t.retry.errorCodes)]):Ai.default.number(r)&&(t.retry.limit=r),Ai.default.undefined(t.retry.maxRetryAfter)&&(t.retry.maxRetryAfter=Math.min(...[t.timeout.request,t.timeout.connect].filter(Ai.default.number))),Ai.default.object(t.pagination)){e&&(t.pagination={...e.pagination,...t.pagination});let{pagination:o}=t;if(!Ai.default.function_(o.transform))throw new Error("`options.pagination.transform` must be implemented");if(!Ai.default.function_(o.shouldContinue))throw new Error("`options.pagination.shouldContinue` must be implemented");if(!Ai.default.function_(o.filter))throw new TypeError("`options.pagination.filter` must be implemented");if(!Ai.default.function_(o.paginate))throw new Error("`options.pagination.paginate` must be implemented")}return t.responseType==="json"&&t.headers.accept===void 0&&(t.headers.accept="application/json"),t};I4.default=Git});var Lae=_(d1=>{"use strict";Object.defineProperty(d1,"__esModule",{value:!0});d1.retryAfterStatusCodes=void 0;d1.retryAfterStatusCodes=new Set([413,429,503]);var Yit=({attemptCount:t,retryOptions:e,error:r,retryAfter:o})=>{if(t>e.limit)return 0;let a=e.methods.includes(r.options.method),n=e.errorCodes.includes(r.code),u=r.response&&e.statusCodes.includes(r.response.statusCode);if(!a||!n&&!u)return 0;if(r.response){if(o)return e.maxRetryAfter===void 0||o>e.maxRetryAfter?0:o;if(r.response.statusCode===413)return 0}let A=Math.random()*100;return 2**(t-1)*1e3+A};d1.default=Yit});var E1=_(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.UnsupportedProtocolError=Bn.ReadError=Bn.TimeoutError=Bn.UploadError=Bn.CacheError=Bn.HTTPError=Bn.MaxRedirectsError=Bn.RequestError=Bn.setNonEnumerableProperties=Bn.knownHookEvents=Bn.withoutBody=Bn.kIsNormalizedAlready=void 0;var Mae=Be("util"),Oae=Be("stream"),Wit=Be("fs"),oh=Be("url"),Uae=Be("http"),B4=Be("http"),Vit=Be("https"),Kit=eoe(),Jit=aoe(),_ae=Uoe(),zit=qoe(),Xit=yae(),Zit=tx(),st=Tf(),$it=Bae(),Hae=c4(),est=f4(),jae=Pae(),tst=xae(),qae=bae(),rst=kae(),nst=E4(),Gae=Fae(),ist=C4(),ah=Rae(),sst=Nae(),ost=Lae(),v4,Zs=Symbol("request"),cx=Symbol("response"),PE=Symbol("responseSize"),SE=Symbol("downloadedSize"),xE=Symbol("bodySize"),bE=Symbol("uploadedSize"),ax=Symbol("serverResponsesPiped"),Yae=Symbol("unproxyEvents"),Wae=Symbol("isFromCache"),D4=Symbol("cancelTimeouts"),Vae=Symbol("startedReading"),kE=Symbol("stopReading"),lx=Symbol("triggerRead"),lh=Symbol("body"),m1=Symbol("jobs"),Kae=Symbol("originalResponse"),Jae=Symbol("retryTimeout");Bn.kIsNormalizedAlready=Symbol("isNormalizedAlready");var ast=st.default.string(process.versions.brotli);Bn.withoutBody=new Set(["GET","HEAD"]);Bn.knownHookEvents=["init","beforeRequest","beforeRedirect","beforeError","beforeRetry","afterResponse"];function lst(t){for(let e in t){let r=t[e];if(!st.default.string(r)&&!st.default.number(r)&&!st.default.boolean(r)&&!st.default.null_(r)&&!st.default.undefined(r))throw new TypeError(`The \`searchParams\` value '${String(r)}' must be a string, number, boolean or null`)}}function cst(t){return st.default.object(t)&&!("statusCode"in t)}var P4=new rst.default,ust=async t=>new Promise((e,r)=>{let o=a=>{r(a)};t.pending||e(),t.once("error",o),t.once("ready",()=>{t.off("error",o),e()})}),Ast=new Set([300,301,302,303,304,307,308]),fst=["context","body","json","form"];Bn.setNonEnumerableProperties=(t,e)=>{let r={};for(let o of t)if(!!o)for(let a of fst)a in o&&(r[a]={writable:!0,configurable:!0,enumerable:!1,value:o[a]});Object.defineProperties(e,r)};var Ki=class extends Error{constructor(e,r,o){var a;if(super(e),Error.captureStackTrace(this,this.constructor),this.name="RequestError",this.code=r.code,o instanceof dx?(Object.defineProperty(this,"request",{enumerable:!1,value:o}),Object.defineProperty(this,"response",{enumerable:!1,value:o[cx]}),Object.defineProperty(this,"options",{enumerable:!1,value:o.options})):Object.defineProperty(this,"options",{enumerable:!1,value:o}),this.timings=(a=this.request)===null||a===void 0?void 0:a.timings,st.default.string(r.stack)&&st.default.string(this.stack)){let n=this.stack.indexOf(this.message)+this.message.length,u=this.stack.slice(n).split(` +`).reverse(),A=r.stack.slice(r.stack.indexOf(r.message)+r.message.length).split(` +`).reverse();for(;A.length!==0&&A[0]===u[0];)u.shift();this.stack=`${this.stack.slice(0,n)}${u.reverse().join(` +`)}${A.reverse().join(` +`)}`}}};Bn.RequestError=Ki;var ux=class extends Ki{constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e),this.name="MaxRedirectsError"}};Bn.MaxRedirectsError=ux;var Ax=class extends Ki{constructor(e){super(`Response code ${e.statusCode} (${e.statusMessage})`,{},e.request),this.name="HTTPError"}};Bn.HTTPError=Ax;var fx=class extends Ki{constructor(e,r){super(e.message,e,r),this.name="CacheError"}};Bn.CacheError=fx;var px=class extends Ki{constructor(e,r){super(e.message,e,r),this.name="UploadError"}};Bn.UploadError=px;var hx=class extends Ki{constructor(e,r,o){super(e.message,e,o),this.name="TimeoutError",this.event=e.event,this.timings=r}};Bn.TimeoutError=hx;var y1=class extends Ki{constructor(e,r){super(e.message,e,r),this.name="ReadError"}};Bn.ReadError=y1;var gx=class extends Ki{constructor(e){super(`Unsupported protocol "${e.url.protocol}"`,{},e),this.name="UnsupportedProtocolError"}};Bn.UnsupportedProtocolError=gx;var pst=["socket","connect","continue","information","upgrade","timeout"],dx=class extends Oae.Duplex{constructor(e,r={},o){super({autoDestroy:!1,highWaterMark:0}),this[SE]=0,this[bE]=0,this.requestInitialized=!1,this[ax]=new Set,this.redirects=[],this[kE]=!1,this[lx]=!1,this[m1]=[],this.retryCount=0,this._progressCallbacks=[];let a=()=>this._unlockWrite(),n=()=>this._lockWrite();this.on("pipe",h=>{h.prependListener("data",a),h.on("data",n),h.prependListener("end",a),h.on("end",n)}),this.on("unpipe",h=>{h.off("data",a),h.off("data",n),h.off("end",a),h.off("end",n)}),this.on("pipe",h=>{h instanceof B4.IncomingMessage&&(this.options.headers={...h.headers,...this.options.headers})});let{json:u,body:A,form:p}=r;if((u||A||p)&&this._lockWrite(),Bn.kIsNormalizedAlready in r)this.options=r;else try{this.options=this.constructor.normalizeArguments(e,r,o)}catch(h){st.default.nodeStream(r.body)&&r.body.destroy(),this.destroy(h);return}(async()=>{var h;try{this.options.body instanceof Wit.ReadStream&&await ust(this.options.body);let{url:E}=this.options;if(!E)throw new TypeError("Missing `url` property");if(this.requestUrl=E.toString(),decodeURI(this.requestUrl),await this._finalizeBody(),await this._makeRequest(),this.destroyed){(h=this[Zs])===null||h===void 0||h.destroy();return}for(let I of this[m1])I();this[m1].length=0,this.requestInitialized=!0}catch(E){if(E instanceof Ki){this._beforeError(E);return}this.destroyed||this.destroy(E)}})()}static normalizeArguments(e,r,o){var a,n,u,A,p;let h=r;if(st.default.object(e)&&!st.default.urlInstance(e))r={...o,...e,...r};else{if(e&&r&&r.url!==void 0)throw new TypeError("The `url` option is mutually exclusive with the `input` argument");r={...o,...r},e!==void 0&&(r.url=e),st.default.urlInstance(r.url)&&(r.url=new oh.URL(r.url.toString()))}if(r.cache===!1&&(r.cache=void 0),r.dnsCache===!1&&(r.dnsCache=void 0),st.assert.any([st.default.string,st.default.undefined],r.method),st.assert.any([st.default.object,st.default.undefined],r.headers),st.assert.any([st.default.string,st.default.urlInstance,st.default.undefined],r.prefixUrl),st.assert.any([st.default.object,st.default.undefined],r.cookieJar),st.assert.any([st.default.object,st.default.string,st.default.undefined],r.searchParams),st.assert.any([st.default.object,st.default.string,st.default.undefined],r.cache),st.assert.any([st.default.object,st.default.number,st.default.undefined],r.timeout),st.assert.any([st.default.object,st.default.undefined],r.context),st.assert.any([st.default.object,st.default.undefined],r.hooks),st.assert.any([st.default.boolean,st.default.undefined],r.decompress),st.assert.any([st.default.boolean,st.default.undefined],r.ignoreInvalidCookies),st.assert.any([st.default.boolean,st.default.undefined],r.followRedirect),st.assert.any([st.default.number,st.default.undefined],r.maxRedirects),st.assert.any([st.default.boolean,st.default.undefined],r.throwHttpErrors),st.assert.any([st.default.boolean,st.default.undefined],r.http2),st.assert.any([st.default.boolean,st.default.undefined],r.allowGetBody),st.assert.any([st.default.string,st.default.undefined],r.localAddress),st.assert.any([Gae.isDnsLookupIpVersion,st.default.undefined],r.dnsLookupIpVersion),st.assert.any([st.default.object,st.default.undefined],r.https),st.assert.any([st.default.boolean,st.default.undefined],r.rejectUnauthorized),r.https&&(st.assert.any([st.default.boolean,st.default.undefined],r.https.rejectUnauthorized),st.assert.any([st.default.function_,st.default.undefined],r.https.checkServerIdentity),st.assert.any([st.default.string,st.default.object,st.default.array,st.default.undefined],r.https.certificateAuthority),st.assert.any([st.default.string,st.default.object,st.default.array,st.default.undefined],r.https.key),st.assert.any([st.default.string,st.default.object,st.default.array,st.default.undefined],r.https.certificate),st.assert.any([st.default.string,st.default.undefined],r.https.passphrase),st.assert.any([st.default.string,st.default.buffer,st.default.array,st.default.undefined],r.https.pfx)),st.assert.any([st.default.object,st.default.undefined],r.cacheOptions),st.default.string(r.method)?r.method=r.method.toUpperCase():r.method="GET",r.headers===o?.headers?r.headers={...r.headers}:r.headers=Zit({...o?.headers,...r.headers}),"slashes"in r)throw new TypeError("The legacy `url.Url` has been deprecated. Use `URL` instead.");if("auth"in r)throw new TypeError("Parameter `auth` is deprecated. Use `username` / `password` instead.");if("searchParams"in r&&r.searchParams&&r.searchParams!==o?.searchParams){let b;if(st.default.string(r.searchParams)||r.searchParams instanceof oh.URLSearchParams)b=new oh.URLSearchParams(r.searchParams);else{lst(r.searchParams),b=new oh.URLSearchParams;for(let C in r.searchParams){let T=r.searchParams[C];T===null?b.append(C,""):T!==void 0&&b.append(C,T)}}(a=o?.searchParams)===null||a===void 0||a.forEach((C,T)=>{b.has(T)||b.append(T,C)}),r.searchParams=b}if(r.username=(n=r.username)!==null&&n!==void 0?n:"",r.password=(u=r.password)!==null&&u!==void 0?u:"",st.default.undefined(r.prefixUrl)?r.prefixUrl=(A=o?.prefixUrl)!==null&&A!==void 0?A:"":(r.prefixUrl=r.prefixUrl.toString(),r.prefixUrl!==""&&!r.prefixUrl.endsWith("/")&&(r.prefixUrl+="/")),st.default.string(r.url)){if(r.url.startsWith("/"))throw new Error("`input` must not start with a slash when using `prefixUrl`");r.url=qae.default(r.prefixUrl+r.url,r)}else(st.default.undefined(r.url)&&r.prefixUrl!==""||r.protocol)&&(r.url=qae.default(r.prefixUrl,r));if(r.url){"port"in r&&delete r.port;let{prefixUrl:b}=r;Object.defineProperty(r,"prefixUrl",{set:T=>{let L=r.url;if(!L.href.startsWith(T))throw new Error(`Cannot change \`prefixUrl\` from ${b} to ${T}: ${L.href}`);r.url=new oh.URL(T+L.href.slice(b.length)),b=T},get:()=>b});let{protocol:C}=r.url;if(C==="unix:"&&(C="http:",r.url=new oh.URL(`http://unix${r.url.pathname}${r.url.search}`)),r.searchParams&&(r.url.search=r.searchParams.toString()),C!=="http:"&&C!=="https:")throw new gx(r);r.username===""?r.username=r.url.username:r.url.username=r.username,r.password===""?r.password=r.url.password:r.url.password=r.password}let{cookieJar:E}=r;if(E){let{setCookie:b,getCookieString:C}=E;st.assert.function_(b),st.assert.function_(C),b.length===4&&C.length===0&&(b=Mae.promisify(b.bind(r.cookieJar)),C=Mae.promisify(C.bind(r.cookieJar)),r.cookieJar={setCookie:b,getCookieString:C})}let{cache:I}=r;if(I&&(P4.has(I)||P4.set(I,new _ae((b,C)=>{let T=b[Zs](b,C);return st.default.promise(T)&&(T.once=(L,U)=>{if(L==="error")T.catch(U);else if(L==="abort")(async()=>{try{(await T).once("abort",U)}catch{}})();else throw new Error(`Unknown HTTP2 promise event: ${L}`);return T}),T},I))),r.cacheOptions={...r.cacheOptions},r.dnsCache===!0)v4||(v4=new Jit.default),r.dnsCache=v4;else if(!st.default.undefined(r.dnsCache)&&!r.dnsCache.lookup)throw new TypeError(`Parameter \`dnsCache\` must be a CacheableLookup instance or a boolean, got ${st.default(r.dnsCache)}`);st.default.number(r.timeout)?r.timeout={request:r.timeout}:o&&r.timeout!==o.timeout?r.timeout={...o.timeout,...r.timeout}:r.timeout={...r.timeout},r.context||(r.context={});let v=r.hooks===o?.hooks;r.hooks={...r.hooks};for(let b of Bn.knownHookEvents)if(b in r.hooks)if(st.default.array(r.hooks[b]))r.hooks[b]=[...r.hooks[b]];else throw new TypeError(`Parameter \`${b}\` must be an Array, got ${st.default(r.hooks[b])}`);else r.hooks[b]=[];if(o&&!v)for(let b of Bn.knownHookEvents)o.hooks[b].length>0&&(r.hooks[b]=[...o.hooks[b],...r.hooks[b]]);if("family"in r&&ah.default('"options.family" was never documented, please use "options.dnsLookupIpVersion"'),o?.https&&(r.https={...o.https,...r.https}),"rejectUnauthorized"in r&&ah.default('"options.rejectUnauthorized" is now deprecated, please use "options.https.rejectUnauthorized"'),"checkServerIdentity"in r&&ah.default('"options.checkServerIdentity" was never documented, please use "options.https.checkServerIdentity"'),"ca"in r&&ah.default('"options.ca" was never documented, please use "options.https.certificateAuthority"'),"key"in r&&ah.default('"options.key" was never documented, please use "options.https.key"'),"cert"in r&&ah.default('"options.cert" was never documented, please use "options.https.certificate"'),"passphrase"in r&&ah.default('"options.passphrase" was never documented, please use "options.https.passphrase"'),"pfx"in r&&ah.default('"options.pfx" was never documented, please use "options.https.pfx"'),"followRedirects"in r)throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.");if(r.agent){for(let b in r.agent)if(b!=="http"&&b!=="https"&&b!=="http2")throw new TypeError(`Expected the \`options.agent\` properties to be \`http\`, \`https\` or \`http2\`, got \`${b}\``)}return r.maxRedirects=(p=r.maxRedirects)!==null&&p!==void 0?p:0,Bn.setNonEnumerableProperties([o,h],r),sst.default(r,o)}_lockWrite(){let e=()=>{throw new TypeError("The payload has been already provided")};this.write=e,this.end=e}_unlockWrite(){this.write=super.write,this.end=super.end}async _finalizeBody(){let{options:e}=this,{headers:r}=e,o=!st.default.undefined(e.form),a=!st.default.undefined(e.json),n=!st.default.undefined(e.body),u=o||a||n,A=Bn.withoutBody.has(e.method)&&!(e.method==="GET"&&e.allowGetBody);if(this._cannotHaveBody=A,u){if(A)throw new TypeError(`The \`${e.method}\` method cannot be used with a body`);if([n,o,a].filter(p=>p).length>1)throw new TypeError("The `body`, `json` and `form` options are mutually exclusive");if(n&&!(e.body instanceof Oae.Readable)&&!st.default.string(e.body)&&!st.default.buffer(e.body)&&!Hae.default(e.body))throw new TypeError("The `body` option must be a stream.Readable, string or Buffer");if(o&&!st.default.object(e.form))throw new TypeError("The `form` option must be an Object");{let p=!st.default.string(r["content-type"]);n?(Hae.default(e.body)&&p&&(r["content-type"]=`multipart/form-data; boundary=${e.body.getBoundary()}`),this[lh]=e.body):o?(p&&(r["content-type"]="application/x-www-form-urlencoded"),this[lh]=new oh.URLSearchParams(e.form).toString()):(p&&(r["content-type"]="application/json"),this[lh]=e.stringifyJson(e.json));let h=await $it.default(this[lh],e.headers);st.default.undefined(r["content-length"])&&st.default.undefined(r["transfer-encoding"])&&!A&&!st.default.undefined(h)&&(r["content-length"]=String(h))}}else A?this._lockWrite():this._unlockWrite();this[xE]=Number(r["content-length"])||void 0}async _onResponseBase(e){let{options:r}=this,{url:o}=r;this[Kae]=e,r.decompress&&(e=zit(e));let a=e.statusCode,n=e;n.statusMessage=n.statusMessage?n.statusMessage:Uae.STATUS_CODES[a],n.url=r.url.toString(),n.requestUrl=this.requestUrl,n.redirectUrls=this.redirects,n.request=this,n.isFromCache=e.fromCache||!1,n.ip=this.ip,n.retryCount=this.retryCount,this[Wae]=n.isFromCache,this[PE]=Number(e.headers["content-length"])||void 0,this[cx]=e,e.once("end",()=>{this[PE]=this[SE],this.emit("downloadProgress",this.downloadProgress)}),e.once("error",A=>{e.destroy(),this._beforeError(new y1(A,this))}),e.once("aborted",()=>{this._beforeError(new y1({name:"Error",message:"The server aborted pending request",code:"ECONNRESET"},this))}),this.emit("downloadProgress",this.downloadProgress);let u=e.headers["set-cookie"];if(st.default.object(r.cookieJar)&&u){let A=u.map(async p=>r.cookieJar.setCookie(p,o.toString()));r.ignoreInvalidCookies&&(A=A.map(async p=>p.catch(()=>{})));try{await Promise.all(A)}catch(p){this._beforeError(p);return}}if(r.followRedirect&&e.headers.location&&Ast.has(a)){if(e.resume(),this[Zs]&&(this[D4](),delete this[Zs],this[Yae]()),(a===303&&r.method!=="GET"&&r.method!=="HEAD"||!r.methodRewriting)&&(r.method="GET","body"in r&&delete r.body,"json"in r&&delete r.json,"form"in r&&delete r.form,this[lh]=void 0,delete r.headers["content-length"]),this.redirects.length>=r.maxRedirects){this._beforeError(new ux(this));return}try{let p=Buffer.from(e.headers.location,"binary").toString(),h=new oh.URL(p,o),E=h.toString();decodeURI(E),h.hostname!==o.hostname||h.port!==o.port?("host"in r.headers&&delete r.headers.host,"cookie"in r.headers&&delete r.headers.cookie,"authorization"in r.headers&&delete r.headers.authorization,(r.username||r.password)&&(r.username="",r.password="")):(h.username=r.username,h.password=r.password),this.redirects.push(E),r.url=h;for(let I of r.hooks.beforeRedirect)await I(r,n);this.emit("redirect",n,r),await this._makeRequest()}catch(p){this._beforeError(p);return}return}if(r.isStream&&r.throwHttpErrors&&!ist.isResponseOk(n)){this._beforeError(new Ax(n));return}e.on("readable",()=>{this[lx]&&this._read()}),this.on("resume",()=>{e.resume()}),this.on("pause",()=>{e.pause()}),e.once("end",()=>{this.push(null)}),this.emit("response",e);for(let A of this[ax])if(!A.headersSent){for(let p in e.headers){let h=r.decompress?p!=="content-encoding":!0,E=e.headers[p];h&&A.setHeader(p,E)}A.statusCode=a}}async _onResponse(e){try{await this._onResponseBase(e)}catch(r){this._beforeError(r)}}_onRequest(e){let{options:r}=this,{timeout:o,url:a}=r;Kit.default(e),this[D4]=jae.default(e,o,a);let n=r.cache?"cacheableResponse":"response";e.once(n,p=>{this._onResponse(p)}),e.once("error",p=>{var h;e.destroy(),(h=e.res)===null||h===void 0||h.removeAllListeners("end"),p=p instanceof jae.TimeoutError?new hx(p,this.timings,this):new Ki(p.message,p,this),this._beforeError(p)}),this[Yae]=est.default(e,this,pst),this[Zs]=e,this.emit("uploadProgress",this.uploadProgress);let u=this[lh],A=this.redirects.length===0?this:e;st.default.nodeStream(u)?(u.pipe(A),u.once("error",p=>{this._beforeError(new px(p,this))})):(this._unlockWrite(),st.default.undefined(u)?(this._cannotHaveBody||this._noPipe)&&(A.end(),this._lockWrite()):(this._writeRequest(u,void 0,()=>{}),A.end(),this._lockWrite())),this.emit("request",e)}async _createCacheableRequest(e,r){return new Promise((o,a)=>{Object.assign(r,tst.default(e)),delete r.url;let n,u=P4.get(r.cache)(r,async A=>{A._readableState.autoDestroy=!1,n&&(await n).emit("cacheableResponse",A),o(A)});r.url=e,u.once("error",a),u.once("request",async A=>{n=A,o(n)})})}async _makeRequest(){var e,r,o,a,n;let{options:u}=this,{headers:A}=u;for(let U in A)if(st.default.undefined(A[U]))delete A[U];else if(st.default.null_(A[U]))throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${U}\` header`);if(u.decompress&&st.default.undefined(A["accept-encoding"])&&(A["accept-encoding"]=ast?"gzip, deflate, br":"gzip, deflate"),u.cookieJar){let U=await u.cookieJar.getCookieString(u.url.toString());st.default.nonEmptyString(U)&&(u.headers.cookie=U)}for(let U of u.hooks.beforeRequest){let J=await U(u);if(!st.default.undefined(J)){u.request=()=>J;break}}u.body&&this[lh]!==u.body&&(this[lh]=u.body);let{agent:p,request:h,timeout:E,url:I}=u;if(u.dnsCache&&!("lookup"in u)&&(u.lookup=u.dnsCache.lookup),I.hostname==="unix"){let U=/(?.+?):(?.+)/.exec(`${I.pathname}${I.search}`);if(U?.groups){let{socketPath:J,path:te}=U.groups;Object.assign(u,{socketPath:J,path:te,host:""})}}let v=I.protocol==="https:",b;u.http2?b=Xit.auto:b=v?Vit.request:Uae.request;let C=(e=u.request)!==null&&e!==void 0?e:b,T=u.cache?this._createCacheableRequest:C;p&&!u.http2&&(u.agent=p[v?"https":"http"]),u[Zs]=C,delete u.request,delete u.timeout;let L=u;if(L.shared=(r=u.cacheOptions)===null||r===void 0?void 0:r.shared,L.cacheHeuristic=(o=u.cacheOptions)===null||o===void 0?void 0:o.cacheHeuristic,L.immutableMinTimeToLive=(a=u.cacheOptions)===null||a===void 0?void 0:a.immutableMinTimeToLive,L.ignoreCargoCult=(n=u.cacheOptions)===null||n===void 0?void 0:n.ignoreCargoCult,u.dnsLookupIpVersion!==void 0)try{L.family=Gae.dnsLookupIpVersionToFamily(u.dnsLookupIpVersion)}catch{throw new Error("Invalid `dnsLookupIpVersion` option value")}u.https&&("rejectUnauthorized"in u.https&&(L.rejectUnauthorized=u.https.rejectUnauthorized),u.https.checkServerIdentity&&(L.checkServerIdentity=u.https.checkServerIdentity),u.https.certificateAuthority&&(L.ca=u.https.certificateAuthority),u.https.certificate&&(L.cert=u.https.certificate),u.https.key&&(L.key=u.https.key),u.https.passphrase&&(L.passphrase=u.https.passphrase),u.https.pfx&&(L.pfx=u.https.pfx));try{let U=await T(I,L);st.default.undefined(U)&&(U=b(I,L)),u.request=h,u.timeout=E,u.agent=p,u.https&&("rejectUnauthorized"in u.https&&delete L.rejectUnauthorized,u.https.checkServerIdentity&&delete L.checkServerIdentity,u.https.certificateAuthority&&delete L.ca,u.https.certificate&&delete L.cert,u.https.key&&delete L.key,u.https.passphrase&&delete L.passphrase,u.https.pfx&&delete L.pfx),cst(U)?this._onRequest(U):this.writable?(this.once("finish",()=>{this._onResponse(U)}),this._unlockWrite(),this.end(),this._lockWrite()):this._onResponse(U)}catch(U){throw U instanceof _ae.CacheError?new fx(U,this):new Ki(U.message,U,this)}}async _error(e){try{for(let r of this.options.hooks.beforeError)e=await r(e)}catch(r){e=new Ki(r.message,r,this)}this.destroy(e)}_beforeError(e){if(this[kE])return;let{options:r}=this,o=this.retryCount+1;this[kE]=!0,e instanceof Ki||(e=new Ki(e.message,e,this));let a=e,{response:n}=a;(async()=>{if(n&&!n.body){n.setEncoding(this._readableState.encoding);try{n.rawBody=await nst.default(n),n.body=n.rawBody.toString()}catch{}}if(this.listenerCount("retry")!==0){let u;try{let A;n&&"retry-after"in n.headers&&(A=Number(n.headers["retry-after"]),Number.isNaN(A)?(A=Date.parse(n.headers["retry-after"])-Date.now(),A<=0&&(A=1)):A*=1e3),u=await r.retry.calculateDelay({attemptCount:o,retryOptions:r.retry,error:a,retryAfter:A,computedValue:ost.default({attemptCount:o,retryOptions:r.retry,error:a,retryAfter:A,computedValue:0})})}catch(A){this._error(new Ki(A.message,A,this));return}if(u){let A=async()=>{try{for(let p of this.options.hooks.beforeRetry)await p(this.options,a,o)}catch(p){this._error(new Ki(p.message,e,this));return}this.destroyed||(this.destroy(),this.emit("retry",o,e))};this[Jae]=setTimeout(A,u);return}}this._error(a)})()}_read(){this[lx]=!0;let e=this[cx];if(e&&!this[kE]){e.readableLength&&(this[lx]=!1);let r;for(;(r=e.read())!==null;){this[SE]+=r.length,this[Vae]=!0;let o=this.downloadProgress;o.percent<1&&this.emit("downloadProgress",o),this.push(r)}}}_write(e,r,o){let a=()=>{this._writeRequest(e,r,o)};this.requestInitialized?a():this[m1].push(a)}_writeRequest(e,r,o){this[Zs].destroyed||(this._progressCallbacks.push(()=>{this[bE]+=Buffer.byteLength(e,r);let a=this.uploadProgress;a.percent<1&&this.emit("uploadProgress",a)}),this[Zs].write(e,r,a=>{!a&&this._progressCallbacks.length>0&&this._progressCallbacks.shift()(),o(a)}))}_final(e){let r=()=>{for(;this._progressCallbacks.length!==0;)this._progressCallbacks.shift()();if(!(Zs in this)){e();return}if(this[Zs].destroyed){e();return}this[Zs].end(o=>{o||(this[xE]=this[bE],this.emit("uploadProgress",this.uploadProgress),this[Zs].emit("upload-complete")),e(o)})};this.requestInitialized?r():this[m1].push(r)}_destroy(e,r){var o;this[kE]=!0,clearTimeout(this[Jae]),Zs in this&&(this[D4](),!((o=this[cx])===null||o===void 0)&&o.complete||this[Zs].destroy()),e!==null&&!st.default.undefined(e)&&!(e instanceof Ki)&&(e=new Ki(e.message,e,this)),r(e)}get _isAboutToError(){return this[kE]}get ip(){var e;return(e=this.socket)===null||e===void 0?void 0:e.remoteAddress}get aborted(){var e,r,o;return((r=(e=this[Zs])===null||e===void 0?void 0:e.destroyed)!==null&&r!==void 0?r:this.destroyed)&&!(!((o=this[Kae])===null||o===void 0)&&o.complete)}get socket(){var e,r;return(r=(e=this[Zs])===null||e===void 0?void 0:e.socket)!==null&&r!==void 0?r:void 0}get downloadProgress(){let e;return this[PE]?e=this[SE]/this[PE]:this[PE]===this[SE]?e=1:e=0,{percent:e,transferred:this[SE],total:this[PE]}}get uploadProgress(){let e;return this[xE]?e=this[bE]/this[xE]:this[xE]===this[bE]?e=1:e=0,{percent:e,transferred:this[bE],total:this[xE]}}get timings(){var e;return(e=this[Zs])===null||e===void 0?void 0:e.timings}get isFromCache(){return this[Wae]}pipe(e,r){if(this[Vae])throw new Error("Failed to pipe. The response has been emitted already.");return e instanceof B4.ServerResponse&&this[ax].add(e),super.pipe(e,r)}unpipe(e){return e instanceof B4.ServerResponse&&this[ax].delete(e),super.unpipe(e),this}};Bn.default=dx});var C1=_(qc=>{"use strict";var hst=qc&&qc.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),gst=qc&&qc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hst(e,t,r)};Object.defineProperty(qc,"__esModule",{value:!0});qc.CancelError=qc.ParseError=void 0;var zae=E1(),S4=class extends zae.RequestError{constructor(e,r){let{options:o}=r.request;super(`${e.message} in "${o.url.toString()}"`,e,r.request),this.name="ParseError"}};qc.ParseError=S4;var x4=class extends zae.RequestError{constructor(e){super("Promise was canceled",{},e),this.name="CancelError"}get isCanceled(){return!0}};qc.CancelError=x4;gst(E1(),qc)});var Zae=_(b4=>{"use strict";Object.defineProperty(b4,"__esModule",{value:!0});var Xae=C1(),dst=(t,e,r,o)=>{let{rawBody:a}=t;try{if(e==="text")return a.toString(o);if(e==="json")return a.length===0?"":r(a.toString());if(e==="buffer")return a;throw new Xae.ParseError({message:`Unknown body type '${e}'`,name:"Error"},t)}catch(n){throw new Xae.ParseError(n,t)}};b4.default=dst});var k4=_(ch=>{"use strict";var mst=ch&&ch.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),yst=ch&&ch.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mst(e,t,r)};Object.defineProperty(ch,"__esModule",{value:!0});var Est=Be("events"),Cst=Tf(),wst=Zse(),mx=C1(),$ae=Zae(),ele=E1(),Ist=f4(),Bst=E4(),tle=C4(),vst=["request","response","redirect","uploadProgress","downloadProgress"];function rle(t){let e,r,o=new Est.EventEmitter,a=new wst((u,A,p)=>{let h=E=>{let I=new ele.default(void 0,t);I.retryCount=E,I._noPipe=!0,p(()=>I.destroy()),p.shouldReject=!1,p(()=>A(new mx.CancelError(I))),e=I,I.once("response",async C=>{var T;if(C.retryCount=E,C.request.aborted)return;let L;try{L=await Bst.default(I),C.rawBody=L}catch{return}if(I._isAboutToError)return;let U=((T=C.headers["content-encoding"])!==null&&T!==void 0?T:"").toLowerCase(),J=["gzip","deflate","br"].includes(U),{options:te}=I;if(J&&!te.decompress)C.body=L;else try{C.body=$ae.default(C,te.responseType,te.parseJson,te.encoding)}catch(le){if(C.body=L.toString(),tle.isResponseOk(C)){I._beforeError(le);return}}try{for(let[le,pe]of te.hooks.afterResponse.entries())C=await pe(C,async Ae=>{let ye=ele.default.normalizeArguments(void 0,{...Ae,retry:{calculateDelay:()=>0},throwHttpErrors:!1,resolveBodyOnly:!1},te);ye.hooks.afterResponse=ye.hooks.afterResponse.slice(0,le);for(let we of ye.hooks.beforeRetry)await we(ye);let ae=rle(ye);return p(()=>{ae.catch(()=>{}),ae.cancel()}),ae})}catch(le){I._beforeError(new mx.RequestError(le.message,le,I));return}if(!tle.isResponseOk(C)){I._beforeError(new mx.HTTPError(C));return}r=C,u(I.options.resolveBodyOnly?C.body:C)});let v=C=>{if(a.isCanceled)return;let{options:T}=I;if(C instanceof mx.HTTPError&&!T.throwHttpErrors){let{response:L}=C;u(I.options.resolveBodyOnly?L.body:L);return}A(C)};I.once("error",v);let b=I.options.body;I.once("retry",(C,T)=>{var L,U;if(b===((L=T.request)===null||L===void 0?void 0:L.options.body)&&Cst.default.nodeStream((U=T.request)===null||U===void 0?void 0:U.options.body)){v(T);return}h(C)}),Ist.default(I,o,vst)};h(0)});a.on=(u,A)=>(o.on(u,A),a);let n=u=>{let A=(async()=>{await a;let{options:p}=r.request;return $ae.default(r,u,p.parseJson,p.encoding)})();return Object.defineProperties(A,Object.getOwnPropertyDescriptors(a)),A};return a.json=()=>{let{headers:u}=e.options;return!e.writableFinished&&u.accept===void 0&&(u.accept="application/json"),n("json")},a.buffer=()=>n("buffer"),a.text=()=>n("text"),a}ch.default=rle;yst(C1(),ch)});var nle=_(Q4=>{"use strict";Object.defineProperty(Q4,"__esModule",{value:!0});var Dst=C1();function Pst(t,...e){let r=(async()=>{if(t instanceof Dst.RequestError)try{for(let a of e)if(a)for(let n of a)t=await n(t)}catch(a){t=a}throw t})(),o=()=>r;return r.json=o,r.text=o,r.buffer=o,r.on=o,r}Q4.default=Pst});var ole=_(F4=>{"use strict";Object.defineProperty(F4,"__esModule",{value:!0});var ile=Tf();function sle(t){for(let e of Object.values(t))(ile.default.plainObject(e)||ile.default.array(e))&&sle(e);return Object.freeze(t)}F4.default=sle});var lle=_(ale=>{"use strict";Object.defineProperty(ale,"__esModule",{value:!0})});var T4=_(Kl=>{"use strict";var Sst=Kl&&Kl.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),xst=Kl&&Kl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Sst(e,t,r)};Object.defineProperty(Kl,"__esModule",{value:!0});Kl.defaultHandler=void 0;var cle=Tf(),Vl=k4(),bst=nle(),Ex=E1(),kst=ole(),Qst={RequestError:Vl.RequestError,CacheError:Vl.CacheError,ReadError:Vl.ReadError,HTTPError:Vl.HTTPError,MaxRedirectsError:Vl.MaxRedirectsError,TimeoutError:Vl.TimeoutError,ParseError:Vl.ParseError,CancelError:Vl.CancelError,UnsupportedProtocolError:Vl.UnsupportedProtocolError,UploadError:Vl.UploadError},Fst=async t=>new Promise(e=>{setTimeout(e,t)}),{normalizeArguments:yx}=Ex.default,ule=(...t)=>{let e;for(let r of t)e=yx(void 0,r,e);return e},Tst=t=>t.isStream?new Ex.default(void 0,t):Vl.default(t),Rst=t=>"defaults"in t&&"options"in t.defaults,Nst=["get","post","put","patch","head","delete"];Kl.defaultHandler=(t,e)=>e(t);var Ale=(t,e)=>{if(t)for(let r of t)r(e)},fle=t=>{t._rawHandlers=t.handlers,t.handlers=t.handlers.map(o=>(a,n)=>{let u,A=o(a,p=>(u=n(p),u));if(A!==u&&!a.isStream&&u){let p=A,{then:h,catch:E,finally:I}=p;Object.setPrototypeOf(p,Object.getPrototypeOf(u)),Object.defineProperties(p,Object.getOwnPropertyDescriptors(u)),p.then=h,p.catch=E,p.finally=I}return A});let e=(o,a={},n)=>{var u,A;let p=0,h=E=>t.handlers[p++](E,p===t.handlers.length?Tst:h);if(cle.default.plainObject(o)){let E={...o,...a};Ex.setNonEnumerableProperties([o,a],E),a=E,o=void 0}try{let E;try{Ale(t.options.hooks.init,a),Ale((u=a.hooks)===null||u===void 0?void 0:u.init,a)}catch(v){E=v}let I=yx(o,a,n??t.options);if(I[Ex.kIsNormalizedAlready]=!0,E)throw new Vl.RequestError(E.message,E,I);return h(I)}catch(E){if(a.isStream)throw E;return bst.default(E,t.options.hooks.beforeError,(A=a.hooks)===null||A===void 0?void 0:A.beforeError)}};e.extend=(...o)=>{let a=[t.options],n=[...t._rawHandlers],u;for(let A of o)Rst(A)?(a.push(A.defaults.options),n.push(...A.defaults._rawHandlers),u=A.defaults.mutableDefaults):(a.push(A),"handlers"in A&&n.push(...A.handlers),u=A.mutableDefaults);return n=n.filter(A=>A!==Kl.defaultHandler),n.length===0&&n.push(Kl.defaultHandler),fle({options:ule(...a),handlers:n,mutableDefaults:Boolean(u)})};let r=async function*(o,a){let n=yx(o,a,t.options);n.resolveBodyOnly=!1;let u=n.pagination;if(!cle.default.object(u))throw new TypeError("`options.pagination` must be implemented");let A=[],{countLimit:p}=u,h=0;for(;h{let n=[];for await(let u of r(o,a))n.push(u);return n},e.paginate.each=r,e.stream=(o,a)=>e(o,{...a,isStream:!0});for(let o of Nst)e[o]=(a,n)=>e(a,{...n,method:o}),e.stream[o]=(a,n)=>e(a,{...n,method:o,isStream:!0});return Object.assign(e,Qst),Object.defineProperty(e,"defaults",{value:t.mutableDefaults?t:kst.default(t),writable:t.mutableDefaults,configurable:t.mutableDefaults,enumerable:!0}),e.mergeOptions=ule,e};Kl.default=fle;xst(lle(),Kl)});var gle=_((Rf,Cx)=>{"use strict";var Lst=Rf&&Rf.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),ple=Rf&&Rf.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Lst(e,t,r)};Object.defineProperty(Rf,"__esModule",{value:!0});var Mst=Be("url"),hle=T4(),Ost={options:{method:"GET",retry:{limit:2,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"],maxRetryAfter:void 0,calculateDelay:({computedValue:t})=>t},timeout:{},headers:{"user-agent":"got (https://github.com/sindresorhus/got)"},hooks:{init:[],beforeRequest:[],beforeRedirect:[],beforeRetry:[],beforeError:[],afterResponse:[]},cache:void 0,dnsCache:void 0,decompress:!0,throwHttpErrors:!0,followRedirect:!0,isStream:!1,responseType:"text",resolveBodyOnly:!1,maxRedirects:10,prefixUrl:"",methodRewriting:!0,ignoreInvalidCookies:!1,context:{},http2:!1,allowGetBody:!1,https:void 0,pagination:{transform:t=>t.request.options.responseType==="json"?t.body:JSON.parse(t.body),paginate:t=>{if(!Reflect.has(t.headers,"link"))return!1;let e=t.headers.link.split(","),r;for(let o of e){let a=o.split(";");if(a[1].includes("next")){r=a[0].trimStart().trim(),r=r.slice(1,-1);break}}return r?{url:new Mst.URL(r)}:!1},filter:()=>!0,shouldContinue:()=>!0,countLimit:1/0,backoff:0,requestLimit:1e4,stackAllItems:!0},parseJson:t=>JSON.parse(t),stringifyJson:t=>JSON.stringify(t),cacheOptions:{}},handlers:[hle.defaultHandler],mutableDefaults:!1},R4=hle.default(Ost);Rf.default=R4;Cx.exports=R4;Cx.exports.default=R4;Cx.exports.__esModule=!0;ple(T4(),Rf);ple(k4(),Rf)});var rn={};Kt(rn,{Method:()=>Ile,del:()=>qst,get:()=>O4,getNetworkSettings:()=>wle,post:()=>U4,put:()=>jst,request:()=>w1});function yle(t){let e=new wx.URL(t),r={host:e.hostname,headers:{}};return e.port&&(r.port=Number(e.port)),e.username&&e.password&&(r.proxyAuth=`${e.username}:${e.password}`),{proxy:r}}async function N4(t){return ol(mle,t,()=>oe.readFilePromise(t).then(e=>(mle.set(t,e),e)))}function Hst({statusCode:t,statusMessage:e},r){let o=Ot(r,t,yt.NUMBER),a=`https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/${t}`;return Xy(r,`${o}${e?` (${e})`:""}`,a)}async function Ix(t,{configuration:e,customErrorMessage:r}){try{return await t}catch(o){if(o.name!=="HTTPError")throw o;let a=r?.(o,e)??o.response.body?.error;a==null&&(o.message.startsWith("Response code")?a="The remote server failed to provide the requested resource":a=o.message),o.code==="ETIMEDOUT"&&o.event==="socket"&&(a+=`(can be increased via ${Ot(e,"httpTimeout",yt.SETTING)})`);let n=new zt(35,a,u=>{o.response&&u.reportError(35,` ${zu(e,{label:"Response Code",value:_c(yt.NO_HINT,Hst(o.response,e))})}`),o.request&&(u.reportError(35,` ${zu(e,{label:"Request Method",value:_c(yt.NO_HINT,o.request.options.method)})}`),u.reportError(35,` ${zu(e,{label:"Request URL",value:_c(yt.URL,o.request.requestUrl)})}`)),o.request.redirects.length>0&&u.reportError(35,` ${zu(e,{label:"Request Redirects",value:_c(yt.NO_HINT,bL(e,o.request.redirects,yt.URL))})}`),o.request.retryCount===o.request.options.retry.limit&&u.reportError(35,` ${zu(e,{label:"Request Retry Count",value:_c(yt.NO_HINT,`${Ot(e,o.request.retryCount,yt.NUMBER)} (can be increased via ${Ot(e,"httpRetry",yt.SETTING)})`)})}`)});throw n.originalError=o,n}}function wle(t,e){let r=[...e.configuration.get("networkSettings")].sort(([u],[A])=>A.length-u.length),o={enableNetwork:void 0,httpsCaFilePath:void 0,httpProxy:void 0,httpsProxy:void 0,httpsKeyFilePath:void 0,httpsCertFilePath:void 0},a=Object.keys(o),n=typeof t=="string"?new wx.URL(t):t;for(let[u,A]of r)if(M4.default.isMatch(n.hostname,u))for(let p of a){let h=A.get(p);h!==null&&typeof o[p]>"u"&&(o[p]=h)}for(let u of a)typeof o[u]>"u"&&(o[u]=e.configuration.get(u));return o}async function w1(t,e,{configuration:r,headers:o,jsonRequest:a,jsonResponse:n,method:u="GET",wrapNetworkRequest:A}){let p={target:t,body:e,configuration:r,headers:o,jsonRequest:a,jsonResponse:n,method:u},h=async()=>await Gst(t,e,p),E=typeof A<"u"?await A(h,p):h;return await(await r.reduceHook(v=>v.wrapNetworkRequest,E,p))()}async function O4(t,{configuration:e,jsonResponse:r,customErrorMessage:o,wrapNetworkRequest:a,...n}){let u=()=>Ix(w1(t,null,{configuration:e,wrapNetworkRequest:a,...n}),{configuration:e,customErrorMessage:o}).then(p=>p.body),A=await(typeof a<"u"?u():ol(dle,t,()=>u().then(p=>(dle.set(t,p),p))));return r?JSON.parse(A.toString()):A}async function jst(t,e,{customErrorMessage:r,...o}){return(await Ix(w1(t,e,{...o,method:"PUT"}),{customErrorMessage:r,configuration:o.configuration})).body}async function U4(t,e,{customErrorMessage:r,...o}){return(await Ix(w1(t,e,{...o,method:"POST"}),{customErrorMessage:r,configuration:o.configuration})).body}async function qst(t,{customErrorMessage:e,...r}){return(await Ix(w1(t,null,{...r,method:"DELETE"}),{customErrorMessage:e,configuration:r.configuration})).body}async function Gst(t,e,{configuration:r,headers:o,jsonRequest:a,jsonResponse:n,method:u="GET"}){let A=typeof t=="string"?new wx.URL(t):t,p=wle(A,{configuration:r});if(p.enableNetwork===!1)throw new zt(80,`Request to '${A.href}' has been blocked because of your configuration settings`);if(A.protocol==="http:"&&!M4.default.isMatch(A.hostname,r.get("unsafeHttpWhitelist")))throw new zt(81,`Unsafe http requests must be explicitly whitelisted in your configuration (${A.hostname})`);let E={agent:{http:p.httpProxy?L4.default.httpOverHttp(yle(p.httpProxy)):Ust,https:p.httpsProxy?L4.default.httpsOverHttp(yle(p.httpsProxy)):_st},headers:o,method:u};E.responseType=n?"json":"buffer",e!==null&&(Buffer.isBuffer(e)||!a&&typeof e=="string"?E.body=e:E.json=e);let I=r.get("httpTimeout"),v=r.get("httpRetry"),b=r.get("enableStrictSsl"),C=p.httpsCaFilePath,T=p.httpsCertFilePath,L=p.httpsKeyFilePath,{default:U}=await Promise.resolve().then(()=>$e(gle())),J=C?await N4(C):void 0,te=T?await N4(T):void 0,le=L?await N4(L):void 0,pe=U.extend({timeout:{socket:I},retry:v,https:{rejectUnauthorized:b,certificateAuthority:J,certificate:te,key:le},...E});return r.getLimit("networkConcurrency")(()=>pe(A))}var Ele,Cle,M4,L4,wx,dle,mle,Ust,_st,Ile,Bx=Et(()=>{Pt();Ele=Be("https"),Cle=Be("http"),M4=$e(Zo()),L4=$e(Vse()),wx=Be("url");Yl();ql();jl();dle=new Map,mle=new Map,Ust=new Cle.Agent({keepAlive:!0}),_st=new Ele.Agent({keepAlive:!0});Ile=(a=>(a.GET="GET",a.PUT="PUT",a.POST="POST",a.DELETE="DELETE",a))(Ile||{})});var Ji={};Kt(Ji,{availableParallelism:()=>H4,getArchitecture:()=>I1,getArchitectureName:()=>Jst,getArchitectureSet:()=>_4,getCaller:()=>$st,major:()=>Yst,openUrl:()=>Wst});function Kst(){if(process.platform==="darwin"||process.platform==="win32")return null;let t;try{t=oe.readFileSync(Vst)}catch{}if(typeof t<"u"){if(t&&t.includes("GLIBC"))return"glibc";if(t&&t.includes("musl"))return"musl"}let r=(process.report?.getReport()??{}).sharedObjects??[],o=/\/(?:(ld-linux-|[^/]+-linux-gnu\/)|(libc.musl-|ld-musl-))/;return WI(r,a=>{let n=a.match(o);if(!n)return WI.skip;if(n[1])return"glibc";if(n[2])return"musl";throw new Error("Assertion failed: Expected the libc variant to have been detected")})??null}function I1(){return vle=vle??{os:process.platform,cpu:process.arch,libc:Kst()}}function Jst(t=I1()){return t.libc?`${t.os}-${t.cpu}-${t.libc}`:`${t.os}-${t.cpu}`}function _4(){let t=I1();return Dle=Dle??{os:[t.os],cpu:[t.cpu],libc:t.libc?[t.libc]:[]}}function Zst(t){let e=zst.exec(t);if(!e)return null;let r=e[2]&&e[2].indexOf("native")===0,o=e[2]&&e[2].indexOf("eval")===0,a=Xst.exec(e[2]);return o&&a!=null&&(e[2]=a[1],e[3]=a[2],e[4]=a[3]),{file:r?null:e[2],methodName:e[1]||"",arguments:r?[e[2]]:[],line:e[3]?+e[3]:null,column:e[4]?+e[4]:null}}function $st(){let e=new Error().stack.split(` +`)[3];return Zst(e)}function H4(){return typeof vx.default.availableParallelism<"u"?vx.default.availableParallelism():Math.max(1,vx.default.cpus().length)}var vx,Yst,Ble,Wst,Vst,vle,Dle,zst,Xst,Dx=Et(()=>{Pt();vx=$e(Be("os"));Px();jl();Yst=Number(process.versions.node.split(".")[0]),Ble=new Map([["darwin","open"],["linux","xdg-open"],["win32","explorer.exe"]]).get(process.platform),Wst=typeof Ble<"u"?async t=>{try{return await j4(Ble,[t],{cwd:K.cwd()}),!0}catch{return!1}}:void 0,Vst="/usr/bin/ldd";zst=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack||\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Xst=/\((\S*)(?::(\d+))(?::(\d+))\)/});function V4(t,e,r,o,a){let n=u1(r);if(o.isArray||o.type==="ANY"&&Array.isArray(n))return Array.isArray(n)?n.map((u,A)=>q4(t,`${e}[${A}]`,u,o,a)):String(n).split(/,/).map(u=>q4(t,e,u,o,a));if(Array.isArray(n))throw new Error(`Non-array configuration settings "${e}" cannot be an array`);return q4(t,e,r,o,a)}function q4(t,e,r,o,a){let n=u1(r);switch(o.type){case"ANY":return YS(n);case"SHAPE":return not(t,e,r,o,a);case"MAP":return iot(t,e,r,o,a)}if(n===null&&!o.isNullable&&o.default!==null)throw new Error(`Non-nullable configuration settings "${e}" cannot be set to null`);if(o.values?.includes(n))return n;let A=(()=>{if(o.type==="BOOLEAN"&&typeof n!="string")return VI(n);if(typeof n!="string")throw new Error(`Expected configuration setting "${e}" to be a string, got ${typeof n}`);let p=sS(n,{env:t.env});switch(o.type){case"ABSOLUTE_PATH":{let h=a,E=EO(r);return E&&E[0]!=="<"&&(h=K.dirname(E)),K.resolve(h,ue.toPortablePath(p))}case"LOCATOR_LOOSE":return xf(p,!1);case"NUMBER":return parseInt(p);case"LOCATOR":return xf(p);case"BOOLEAN":return VI(p);default:return p}})();if(o.values&&!o.values.includes(A))throw new Error(`Invalid value, expected one of ${o.values.join(", ")}`);return A}function not(t,e,r,o,a){let n=u1(r);if(typeof n!="object"||Array.isArray(n))throw new it(`Object configuration settings "${e}" must be an object`);let u=K4(t,o,{ignoreArrays:!0});if(n===null)return u;for(let[A,p]of Object.entries(n)){let h=`${e}.${A}`;if(!o.properties[A])throw new it(`Unrecognized configuration settings found: ${e}.${A} - run "yarn config -v" to see the list of settings supported in Yarn`);u.set(A,V4(t,h,p,o.properties[A],a))}return u}function iot(t,e,r,o,a){let n=u1(r),u=new Map;if(typeof n!="object"||Array.isArray(n))throw new it(`Map configuration settings "${e}" must be an object`);if(n===null)return u;for(let[A,p]of Object.entries(n)){let h=o.normalizeKeys?o.normalizeKeys(A):A,E=`${e}['${h}']`,I=o.valueDefinition;u.set(h,V4(t,E,p,I,a))}return u}function K4(t,e,{ignoreArrays:r=!1}={}){switch(e.type){case"SHAPE":{if(e.isArray&&!r)return[];let o=new Map;for(let[a,n]of Object.entries(e.properties))o.set(a,K4(t,n));return o}case"MAP":return e.isArray&&!r?[]:new Map;case"ABSOLUTE_PATH":return e.default===null?null:t.projectCwd===null?Array.isArray(e.default)?e.default.map(o=>K.normalize(o)):K.isAbsolute(e.default)?K.normalize(e.default):e.isNullable?null:void 0:Array.isArray(e.default)?e.default.map(o=>K.resolve(t.projectCwd,o)):K.resolve(t.projectCwd,e.default);default:return e.default}}function xx(t,e,r){if(e.type==="SECRET"&&typeof t=="string"&&r.hideSecrets)return rot;if(e.type==="ABSOLUTE_PATH"&&typeof t=="string"&&r.getNativePaths)return ue.fromPortablePath(t);if(e.isArray&&Array.isArray(t)){let o=[];for(let a of t)o.push(xx(a,e,r));return o}if(e.type==="MAP"&&t instanceof Map){if(t.size===0)return;let o=new Map;for(let[a,n]of t.entries()){let u=xx(n,e.valueDefinition,r);typeof u<"u"&&o.set(a,u)}return o}if(e.type==="SHAPE"&&t instanceof Map){if(t.size===0)return;let o=new Map;for(let[a,n]of t.entries()){let u=e.properties[a],A=xx(n,u,r);typeof A<"u"&&o.set(a,A)}return o}return t}function sot(){let t={};for(let[e,r]of Object.entries(process.env))e=e.toLowerCase(),e.startsWith(bx)&&(e=(0,Sle.default)(e.slice(bx.length)),t[e]=r);return t}function Y4(){let t=`${bx}rc_filename`;for(let[e,r]of Object.entries(process.env))if(e.toLowerCase()===t&&typeof r=="string")return r;return W4}async function Ple(t){try{return await oe.readFilePromise(t)}catch{return Buffer.of()}}async function oot(t,e){return Buffer.compare(...await Promise.all([Ple(t),Ple(e)]))===0}async function aot(t,e){let[r,o]=await Promise.all([oe.statPromise(t),oe.statPromise(e)]);return r.dev===o.dev&&r.ino===o.ino}async function cot({configuration:t,selfPath:e}){let r=t.get("yarnPath");return t.get("ignorePath")||r===null||r===e||await lot(r,e)?null:r}var Sle,Nf,xle,ble,kle,G4,eot,B1,tot,QE,bx,W4,rot,v1,Qle,kx,Sx,lot,rA,Ve,D1=Et(()=>{Pt();Nl();Sle=$e(aK()),Nf=$e(ed());qt();xle=$e(eJ()),ble=Be("module"),kle=$e(nd()),G4=Be("stream");lse();AE();AO();fO();pO();Lse();hO();Bd();Hse();VS();ql();rh();Bx();jl();Dx();kf();xo();eot=function(){if(!Nf.GITHUB_ACTIONS||!process.env.GITHUB_EVENT_PATH)return!1;let t=ue.toPortablePath(process.env.GITHUB_EVENT_PATH),e;try{e=oe.readJsonSync(t)}catch{return!1}return!(!("repository"in e)||!e.repository||(e.repository.private??!0))}(),B1=new Set(["@yarnpkg/plugin-constraints","@yarnpkg/plugin-exec","@yarnpkg/plugin-interactive-tools","@yarnpkg/plugin-stage","@yarnpkg/plugin-typescript","@yarnpkg/plugin-version","@yarnpkg/plugin-workspace-tools"]),tot=new Set(["isTestEnv","injectNpmUser","injectNpmPassword","injectNpm2FaToken","cacheCheckpointOverride","cacheVersionOverride","lockfileVersionOverride","binFolder","version","flags","profile","gpg","ignoreNode","wrapOutput","home","confDir","registry","ignoreCwd"]),QE=/^(?!v)[a-z0-9._-]+$/i,bx="yarn_",W4=".yarnrc.yml",rot="********",v1=(E=>(E.ANY="ANY",E.BOOLEAN="BOOLEAN",E.ABSOLUTE_PATH="ABSOLUTE_PATH",E.LOCATOR="LOCATOR",E.LOCATOR_LOOSE="LOCATOR_LOOSE",E.NUMBER="NUMBER",E.STRING="STRING",E.SECRET="SECRET",E.SHAPE="SHAPE",E.MAP="MAP",E))(v1||{}),Qle=yt,kx=(r=>(r.JUNCTIONS="junctions",r.SYMLINKS="symlinks",r))(kx||{}),Sx={lastUpdateCheck:{description:"Last timestamp we checked whether new Yarn versions were available",type:"STRING",default:null},yarnPath:{description:"Path to the local executable that must be used over the global one",type:"ABSOLUTE_PATH",default:null},ignorePath:{description:"If true, the local executable will be ignored when using the global one",type:"BOOLEAN",default:!1},globalFolder:{description:"Folder where all system-global files are stored",type:"ABSOLUTE_PATH",default:wO()},cacheFolder:{description:"Folder where the cache files must be written",type:"ABSOLUTE_PATH",default:"./.yarn/cache"},compressionLevel:{description:"Zip files compression level, from 0 to 9 or mixed (a variant of 9, which stores some files uncompressed, when compression doesn't yield good results)",type:"NUMBER",values:["mixed",0,1,2,3,4,5,6,7,8,9],default:0},virtualFolder:{description:"Folder where the virtual packages (cf doc) will be mapped on the disk (must be named __virtual__)",type:"ABSOLUTE_PATH",default:"./.yarn/__virtual__"},installStatePath:{description:"Path of the file where the install state will be persisted",type:"ABSOLUTE_PATH",default:"./.yarn/install-state.gz"},immutablePatterns:{description:"Array of glob patterns; files matching them won't be allowed to change during immutable installs",type:"STRING",default:[],isArray:!0},rcFilename:{description:"Name of the files where the configuration can be found",type:"STRING",default:Y4()},enableGlobalCache:{description:"If true, the system-wide cache folder will be used regardless of `cache-folder`",type:"BOOLEAN",default:!0},cacheMigrationMode:{description:"Defines the conditions under which Yarn upgrades should cause the cache archives to be regenerated.",type:"STRING",values:["always","match-spec","required-only"],default:"always"},enableColors:{description:"If true, the CLI is allowed to use colors in its output",type:"BOOLEAN",default:lS,defaultText:""},enableHyperlinks:{description:"If true, the CLI is allowed to use hyperlinks in its output",type:"BOOLEAN",default:xL,defaultText:""},enableInlineBuilds:{description:"If true, the CLI will print the build output on the command line",type:"BOOLEAN",default:Nf.isCI,defaultText:""},enableMessageNames:{description:"If true, the CLI will prefix most messages with codes suitable for search engines",type:"BOOLEAN",default:!0},enableProgressBars:{description:"If true, the CLI is allowed to show a progress bar for long-running events",type:"BOOLEAN",default:!Nf.isCI,defaultText:""},enableTimers:{description:"If true, the CLI is allowed to print the time spent executing commands",type:"BOOLEAN",default:!0},enableTips:{description:"If true, installs will print a helpful message every day of the week",type:"BOOLEAN",default:!Nf.isCI,defaultText:""},preferInteractive:{description:"If true, the CLI will automatically use the interactive mode when called from a TTY",type:"BOOLEAN",default:!1},preferTruncatedLines:{description:"If true, the CLI will truncate lines that would go beyond the size of the terminal",type:"BOOLEAN",default:!1},progressBarStyle:{description:"Which style of progress bar should be used (only when progress bars are enabled)",type:"STRING",default:void 0,defaultText:""},defaultLanguageName:{description:"Default language mode that should be used when a package doesn't offer any insight",type:"STRING",default:"node"},defaultProtocol:{description:"Default resolution protocol used when resolving pure semver and tag ranges",type:"STRING",default:"npm:"},enableTransparentWorkspaces:{description:"If false, Yarn won't automatically resolve workspace dependencies unless they use the `workspace:` protocol",type:"BOOLEAN",default:!0},supportedArchitectures:{description:"Architectures that Yarn will fetch and inject into the resolver",type:"SHAPE",properties:{os:{description:"Array of supported process.platform strings, or null to target them all",type:"STRING",isArray:!0,isNullable:!0,default:["current"]},cpu:{description:"Array of supported process.arch strings, or null to target them all",type:"STRING",isArray:!0,isNullable:!0,default:["current"]},libc:{description:"Array of supported libc libraries, or null to target them all",type:"STRING",isArray:!0,isNullable:!0,default:["current"]}}},enableMirror:{description:"If true, the downloaded packages will be retrieved and stored in both the local and global folders",type:"BOOLEAN",default:!0},enableNetwork:{description:"If false, Yarn will refuse to use the network if required to",type:"BOOLEAN",default:!0},enableOfflineMode:{description:"If true, Yarn will attempt to retrieve files and metadata from the global cache rather than the network",type:"BOOLEAN",default:!1},httpProxy:{description:"URL of the http proxy that must be used for outgoing http requests",type:"STRING",default:null},httpsProxy:{description:"URL of the http proxy that must be used for outgoing https requests",type:"STRING",default:null},unsafeHttpWhitelist:{description:"List of the hostnames for which http queries are allowed (glob patterns are supported)",type:"STRING",default:[],isArray:!0},httpTimeout:{description:"Timeout of each http request in milliseconds",type:"NUMBER",default:6e4},httpRetry:{description:"Retry times on http failure",type:"NUMBER",default:3},networkConcurrency:{description:"Maximal number of concurrent requests",type:"NUMBER",default:50},taskPoolConcurrency:{description:"Maximal amount of concurrent heavy task processing",type:"NUMBER",default:H4()},taskPoolMode:{description:"Execution strategy for heavy tasks",type:"STRING",values:["async","workers"],default:"workers"},networkSettings:{description:"Network settings per hostname (glob patterns are supported)",type:"MAP",valueDefinition:{description:"",type:"SHAPE",properties:{httpsCaFilePath:{description:"Path to file containing one or multiple Certificate Authority signing certificates",type:"ABSOLUTE_PATH",default:null},enableNetwork:{description:"If false, the package manager will refuse to use the network if required to",type:"BOOLEAN",default:null},httpProxy:{description:"URL of the http proxy that must be used for outgoing http requests",type:"STRING",default:null},httpsProxy:{description:"URL of the http proxy that must be used for outgoing https requests",type:"STRING",default:null},httpsKeyFilePath:{description:"Path to file containing private key in PEM format",type:"ABSOLUTE_PATH",default:null},httpsCertFilePath:{description:"Path to file containing certificate chain in PEM format",type:"ABSOLUTE_PATH",default:null}}}},httpsCaFilePath:{description:"A path to a file containing one or multiple Certificate Authority signing certificates",type:"ABSOLUTE_PATH",default:null},httpsKeyFilePath:{description:"Path to file containing private key in PEM format",type:"ABSOLUTE_PATH",default:null},httpsCertFilePath:{description:"Path to file containing certificate chain in PEM format",type:"ABSOLUTE_PATH",default:null},enableStrictSsl:{description:"If false, SSL certificate errors will be ignored",type:"BOOLEAN",default:!0},logFilters:{description:"Overrides for log levels",type:"SHAPE",isArray:!0,concatenateValues:!0,properties:{code:{description:"Code of the messages covered by this override",type:"STRING",default:void 0},text:{description:"Code of the texts covered by this override",type:"STRING",default:void 0},pattern:{description:"Code of the patterns covered by this override",type:"STRING",default:void 0},level:{description:"Log level override, set to null to remove override",type:"STRING",values:Object.values(uS),isNullable:!0,default:void 0}}},enableTelemetry:{description:"If true, telemetry will be periodically sent, following the rules in https://yarnpkg.com/advanced/telemetry",type:"BOOLEAN",default:!0},telemetryInterval:{description:"Minimal amount of time between two telemetry uploads, in days",type:"NUMBER",default:7},telemetryUserId:{description:"If you desire to tell us which project you are, you can set this field. Completely optional and opt-in.",type:"STRING",default:null},enableHardenedMode:{description:"If true, automatically enable --check-resolutions --refresh-lockfile on installs",type:"BOOLEAN",default:Nf.isPR&&eot,defaultText:""},enableScripts:{description:"If true, packages are allowed to have install scripts by default",type:"BOOLEAN",default:!0},enableStrictSettings:{description:"If true, unknown settings will cause Yarn to abort",type:"BOOLEAN",default:!0},enableImmutableCache:{description:"If true, the cache is reputed immutable and actions that would modify it will throw",type:"BOOLEAN",default:!1},checksumBehavior:{description:"Enumeration defining what to do when a checksum doesn't match expectations",type:"STRING",default:"throw"},injectEnvironmentFiles:{description:"List of all the environment files that Yarn should inject inside the process when it starts",type:"ABSOLUTE_PATH",default:[".env.yarn?"],isArray:!0},packageExtensions:{description:"Map of package corrections to apply on the dependency tree",type:"MAP",valueDefinition:{description:"The extension that will be applied to any package whose version matches the specified range",type:"SHAPE",properties:{dependencies:{description:"The set of dependencies that must be made available to the current package in order for it to work properly",type:"MAP",valueDefinition:{description:"A range",type:"STRING"}},peerDependencies:{description:"Inherited dependencies - the consumer of the package will be tasked to provide them",type:"MAP",valueDefinition:{description:"A semver range",type:"STRING"}},peerDependenciesMeta:{description:"Extra information related to the dependencies listed in the peerDependencies field",type:"MAP",valueDefinition:{description:"The peerDependency meta",type:"SHAPE",properties:{optional:{description:"If true, the selected peer dependency will be marked as optional by the package manager and the consumer omitting it won't be reported as an error",type:"BOOLEAN",default:!1}}}}}}}};lot=process.platform==="win32"?oot:aot;rA=class{constructor(e){this.isCI=Nf.isCI;this.projectCwd=null;this.plugins=new Map;this.settings=new Map;this.values=new Map;this.sources=new Map;this.invalid=new Map;this.env={};this.limits=new Map;this.packageExtensions=null;this.startingCwd=e}static create(e,r,o){let a=new rA(e);typeof r<"u"&&!(r instanceof Map)&&(a.projectCwd=r),a.importSettings(Sx);let n=typeof o<"u"?o:r instanceof Map?r:new Map;for(let[u,A]of n)a.activatePlugin(u,A);return a}static async find(e,r,{strict:o=!0,usePathCheck:a=null,useRc:n=!0}={}){let u=sot();delete u.rcFilename;let A=new rA(e),p=await rA.findRcFiles(e),h=await rA.findFolderRcFile(yE());h&&(p.find(ye=>ye.path===h.path)||p.unshift(h));let E=_se(p.map(Ae=>[Ae.path,Ae.data])),I=Bt.dot,v=new Set(Object.keys(Sx)),b=({yarnPath:Ae,ignorePath:ye,injectEnvironmentFiles:ae})=>({yarnPath:Ae,ignorePath:ye,injectEnvironmentFiles:ae}),C=({yarnPath:Ae,ignorePath:ye,injectEnvironmentFiles:ae,...we})=>{let Pe={};for(let[g,Ee]of Object.entries(we))v.has(g)&&(Pe[g]=Ee);return Pe},T=({yarnPath:Ae,ignorePath:ye,...ae})=>{let we={};for(let[Pe,g]of Object.entries(ae))v.has(Pe)||(we[Pe]=g);return we};if(A.importSettings(b(Sx)),A.useWithSource("",b(u),e,{strict:!1}),E){let[Ae,ye]=E;A.useWithSource(Ae,b(ye),I,{strict:!1})}if(a){if(await cot({configuration:A,selfPath:a})!==null)return A;A.useWithSource("",{ignorePath:!0},e,{strict:!1,overwrite:!0})}let L=await rA.findProjectCwd(e);A.startingCwd=e,A.projectCwd=L;let U=Object.assign(Object.create(null),process.env);A.env=U;let J=await Promise.all(A.get("injectEnvironmentFiles").map(async Ae=>{let ye=Ae.endsWith("?")?await oe.readFilePromise(Ae.slice(0,-1),"utf8").catch(()=>""):await oe.readFilePromise(Ae,"utf8");return(0,xle.parse)(ye)}));for(let Ae of J)for(let[ye,ae]of Object.entries(Ae))A.env[ye]=sS(ae,{env:U});if(A.importSettings(C(Sx)),A.useWithSource("",C(u),e,{strict:o}),E){let[Ae,ye]=E;A.useWithSource(Ae,C(ye),I,{strict:o})}let te=Ae=>"default"in Ae?Ae.default:Ae,le=new Map([["@@core",ase]]);if(r!==null)for(let Ae of r.plugins.keys())le.set(Ae,te(r.modules.get(Ae)));for(let[Ae,ye]of le)A.activatePlugin(Ae,ye);let pe=new Map([]);if(r!==null){let Ae=new Map;for(let we of ble.builtinModules)Ae.set(we,()=>vf(we));for(let[we,Pe]of r.modules)Ae.set(we,()=>Pe);let ye=new Set,ae=async(we,Pe)=>{let{factory:g,name:Ee}=vf(we);if(!g||ye.has(Ee))return;let De=new Map(Ae),ce=ee=>{if(De.has(ee))return De.get(ee)();throw new it(`This plugin cannot access the package referenced via ${ee} which is neither a builtin, nor an exposed entry`)},ne=await Wy(async()=>te(await g(ce)),ee=>`${ee} (when initializing ${Ee}, defined in ${Pe})`);Ae.set(Ee,()=>ne),ye.add(Ee),pe.set(Ee,ne)};if(u.plugins)for(let we of u.plugins.split(";")){let Pe=K.resolve(e,ue.toPortablePath(we));await ae(Pe,"")}for(let{path:we,cwd:Pe,data:g}of p)if(!!n&&!!Array.isArray(g.plugins))for(let Ee of g.plugins){let De=typeof Ee!="string"?Ee.path:Ee,ce=Ee?.spec??"",ne=Ee?.checksum??"";if(B1.has(ce))continue;let ee=K.resolve(Pe,ue.toPortablePath(De));if(!await oe.existsPromise(ee)){if(!ce){let ht=Ot(A,K.basename(ee,".cjs"),yt.NAME),H=Ot(A,".gitignore",yt.NAME),lt=Ot(A,A.values.get("rcFilename"),yt.NAME),Re=Ot(A,"https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored",yt.URL);throw new it(`Missing source for the ${ht} plugin - please try to remove the plugin from ${lt} then reinstall it manually. This error usually occurs because ${H} is incorrect, check ${Re} to make sure your plugin folder isn't gitignored.`)}if(!ce.match(/^https?:/)){let ht=Ot(A,K.basename(ee,".cjs"),yt.NAME),H=Ot(A,A.values.get("rcFilename"),yt.NAME);throw new it(`Failed to recognize the source for the ${ht} plugin - please try to delete the plugin from ${H} then reinstall it manually.`)}let Ie=await O4(ce,{configuration:A}),ke=zs(Ie);if(ne&&ne!==ke){let ht=Ot(A,K.basename(ee,".cjs"),yt.NAME),H=Ot(A,A.values.get("rcFilename"),yt.NAME),lt=Ot(A,`yarn plugin import ${ce}`,yt.CODE);throw new it(`Failed to fetch the ${ht} plugin from its remote location: its checksum seems to have changed. If this is expected, please remove the plugin from ${H} then run ${lt} to reimport it.`)}await oe.mkdirPromise(K.dirname(ee),{recursive:!0}),await oe.writeFilePromise(ee,Ie)}await ae(ee,we)}}for(let[Ae,ye]of pe)A.activatePlugin(Ae,ye);if(A.useWithSource("",T(u),e,{strict:o}),E){let[Ae,ye]=E;A.useWithSource(Ae,T(ye),I,{strict:o})}return A.get("enableGlobalCache")&&(A.values.set("cacheFolder",`${A.get("globalFolder")}/cache`),A.sources.set("cacheFolder","")),A}static async findRcFiles(e){let r=Y4(),o=[],a=e,n=null;for(;a!==n;){n=a;let u=K.join(n,r);if(oe.existsSync(u)){let A=await oe.readFilePromise(u,"utf8"),p;try{p=Vi(A)}catch{let E="";throw A.match(/^\s+(?!-)[^:]+\s+\S+/m)&&(E=" (in particular, make sure you list the colons after each key name)"),new it(`Parse error when loading ${u}; please check it's proper Yaml${E}`)}o.unshift({path:u,cwd:n,data:p})}a=K.dirname(n)}return o}static async findFolderRcFile(e){let r=K.join(e,dr.rc),o;try{o=await oe.readFilePromise(r,"utf8")}catch(n){if(n.code==="ENOENT")return null;throw n}let a=Vi(o);return{path:r,cwd:e,data:a}}static async findProjectCwd(e){let r=null,o=e,a=null;for(;o!==a;){if(a=o,oe.existsSync(K.join(a,dr.lockfile)))return a;oe.existsSync(K.join(a,dr.manifest))&&(r=a),o=K.dirname(a)}return r}static async updateConfiguration(e,r,o={}){let a=Y4(),n=K.join(e,a),u=oe.existsSync(n)?Vi(await oe.readFilePromise(n,"utf8")):{},A=!1,p;if(typeof r=="function"){try{p=r(u)}catch{p=r({})}if(p===u)return!1}else{p=u;for(let h of Object.keys(r)){let E=u[h],I=r[h],v;if(typeof I=="function")try{v=I(E)}catch{v=I(void 0)}else v=I;E!==v&&(v===rA.deleteProperty?delete p[h]:p[h]=v,A=!0)}if(!A)return!1}return await oe.changeFilePromise(n,Ba(p),{automaticNewlines:!0}),!0}static async addPlugin(e,r){r.length!==0&&await rA.updateConfiguration(e,o=>{let a=o.plugins??[];if(a.length===0)return{...o,plugins:r};let n=[],u=[...r];for(let A of a){let p=typeof A!="string"?A.path:A,h=u.find(E=>E.path===p);h?(n.push(h),u=u.filter(E=>E!==h)):n.push(A)}return n.push(...u),{...o,plugins:n}})}static async updateHomeConfiguration(e){let r=yE();return await rA.updateConfiguration(r,e)}activatePlugin(e,r){this.plugins.set(e,r),typeof r.configuration<"u"&&this.importSettings(r.configuration)}importSettings(e){for(let[r,o]of Object.entries(e))if(o!=null){if(this.settings.has(r))throw new Error(`Cannot redefine settings "${r}"`);this.settings.set(r,o),this.values.set(r,K4(this,o))}}useWithSource(e,r,o,a){try{this.use(e,r,o,a)}catch(n){throw n.message+=` (in ${Ot(this,e,yt.PATH)})`,n}}use(e,r,o,{strict:a=!0,overwrite:n=!1}={}){a=a&&this.get("enableStrictSettings");for(let u of["enableStrictSettings",...Object.keys(r)]){let A=r[u],p=EO(A);if(p&&(e=p),typeof A>"u"||u==="plugins"||e===""&&tot.has(u))continue;if(u==="rcFilename")throw new it(`The rcFilename settings can only be set via ${`${bx}RC_FILENAME`.toUpperCase()}, not via a rc file`);let h=this.settings.get(u);if(!h){let I=yE(),v=e[0]!=="<"?K.dirname(e):null;if(a&&!(v!==null?I===v:!1))throw new it(`Unrecognized or legacy configuration settings found: ${u} - run "yarn config -v" to see the list of settings supported in Yarn`);this.invalid.set(u,e);continue}if(this.sources.has(u)&&!(n||h.type==="MAP"||h.isArray&&h.concatenateValues))continue;let E;try{E=V4(this,u,A,h,o)}catch(I){throw I.message+=` in ${Ot(this,e,yt.PATH)}`,I}if(u==="enableStrictSettings"&&e!==""){a=E;continue}if(h.type==="MAP"){let I=this.values.get(u);this.values.set(u,new Map(n?[...I,...E]:[...E,...I])),this.sources.set(u,`${this.sources.get(u)}, ${e}`)}else if(h.isArray&&h.concatenateValues){let I=this.values.get(u);this.values.set(u,n?[...I,...E]:[...E,...I]),this.sources.set(u,`${this.sources.get(u)}, ${e}`)}else this.values.set(u,E),this.sources.set(u,e)}}get(e){if(!this.values.has(e))throw new Error(`Invalid configuration key "${e}"`);return this.values.get(e)}getSpecial(e,{hideSecrets:r=!1,getNativePaths:o=!1}){let a=this.get(e),n=this.settings.get(e);if(typeof n>"u")throw new it(`Couldn't find a configuration settings named "${e}"`);return xx(a,n,{hideSecrets:r,getNativePaths:o})}getSubprocessStreams(e,{header:r,prefix:o,report:a}){let n,u,A=oe.createWriteStream(e);if(this.get("enableInlineBuilds")){let p=a.createStreamReporter(`${o} ${Ot(this,"STDOUT","green")}`),h=a.createStreamReporter(`${o} ${Ot(this,"STDERR","red")}`);n=new G4.PassThrough,n.pipe(p),n.pipe(A),u=new G4.PassThrough,u.pipe(h),u.pipe(A)}else n=A,u=A,typeof r<"u"&&n.write(`${r} +`);return{stdout:n,stderr:u}}makeResolver(){let e=[];for(let r of this.plugins.values())for(let o of r.resolvers||[])e.push(new o);return new vd([new l1,new Xn,...e])}makeFetcher(){let e=[];for(let r of this.plugins.values())for(let o of r.fetchers||[])e.push(new o);return new pE([new hE,new dE,...e])}getLinkers(){let e=[];for(let r of this.plugins.values())for(let o of r.linkers||[])e.push(new o);return e}getSupportedArchitectures(){let e=I1(),r=this.get("supportedArchitectures"),o=r.get("os");o!==null&&(o=o.map(u=>u==="current"?e.os:u));let a=r.get("cpu");a!==null&&(a=a.map(u=>u==="current"?e.cpu:u));let n=r.get("libc");return n!==null&&(n=sl(n,u=>u==="current"?e.libc??sl.skip:u)),{os:o,cpu:a,libc:n}}async getPackageExtensions(){if(this.packageExtensions!==null)return this.packageExtensions;this.packageExtensions=new Map;let e=this.packageExtensions,r=(o,a,{userProvided:n=!1}={})=>{if(!ba(o.range))throw new Error("Only semver ranges are allowed as keys for the packageExtensions setting");let u=new Mt;u.load(a,{yamlCompatibilityMode:!0});let A=Gy(e,o.identHash),p=[];A.push([o.range,p]);let h={status:"inactive",userProvided:n,parentDescriptor:o};for(let E of u.dependencies.values())p.push({...h,type:"Dependency",descriptor:E});for(let E of u.peerDependencies.values())p.push({...h,type:"PeerDependency",descriptor:E});for(let[E,I]of u.peerDependenciesMeta)for(let[v,b]of Object.entries(I))p.push({...h,type:"PeerDependencyMeta",selector:E,key:v,value:b})};await this.triggerHook(o=>o.registerPackageExtensions,this,r);for(let[o,a]of this.get("packageExtensions"))r(nh(o,!0),iS(a),{userProvided:!0});return e}normalizeLocator(e){return ba(e.reference)?Qs(e,`${this.get("defaultProtocol")}${e.reference}`):QE.test(e.reference)?Qs(e,`${this.get("defaultProtocol")}${e.reference}`):e}normalizeDependency(e){return ba(e.range)?In(e,`${this.get("defaultProtocol")}${e.range}`):QE.test(e.range)?In(e,`${this.get("defaultProtocol")}${e.range}`):e}normalizeDependencyMap(e){return new Map([...e].map(([r,o])=>[r,this.normalizeDependency(o)]))}normalizePackage(e,{packageExtensions:r}){let o=$I(e),a=r.get(e.identHash);if(typeof a<"u"){let u=e.version;if(u!==null){for(let[A,p]of a)if(!!bf(u,A))for(let h of p)switch(h.status==="inactive"&&(h.status="redundant"),h.type){case"Dependency":typeof o.dependencies.get(h.descriptor.identHash)>"u"&&(h.status="active",o.dependencies.set(h.descriptor.identHash,this.normalizeDependency(h.descriptor)));break;case"PeerDependency":typeof o.peerDependencies.get(h.descriptor.identHash)>"u"&&(h.status="active",o.peerDependencies.set(h.descriptor.identHash,h.descriptor));break;case"PeerDependencyMeta":{let E=o.peerDependenciesMeta.get(h.selector);(typeof E>"u"||!Object.hasOwn(E,h.key)||E[h.key]!==h.value)&&(h.status="active",ol(o.peerDependenciesMeta,h.selector,()=>({}))[h.key]=h.value)}break;default:CL(h)}}}let n=u=>u.scope?`${u.scope}__${u.name}`:`${u.name}`;for(let u of o.peerDependenciesMeta.keys()){let A=Js(u);o.peerDependencies.has(A.identHash)||o.peerDependencies.set(A.identHash,In(A,"*"))}for(let u of o.peerDependencies.values()){if(u.scope==="types")continue;let A=n(u),p=eA("types",A),h=fn(p);o.peerDependencies.has(p.identHash)||o.peerDependenciesMeta.has(h)||(o.peerDependencies.set(p.identHash,In(p,"*")),o.peerDependenciesMeta.set(h,{optional:!0}))}return o.dependencies=new Map(ks(o.dependencies,([,u])=>Sa(u))),o.peerDependencies=new Map(ks(o.peerDependencies,([,u])=>Sa(u))),o}getLimit(e){return ol(this.limits,e,()=>(0,kle.default)(this.get(e)))}async triggerHook(e,...r){for(let o of this.plugins.values()){let a=o.hooks;if(!a)continue;let n=e(a);!n||await n(...r)}}async triggerMultipleHooks(e,r){for(let o of r)await this.triggerHook(e,...o)}async reduceHook(e,r,...o){let a=r;for(let n of this.plugins.values()){let u=n.hooks;if(!u)continue;let A=e(u);!A||(a=await A(a,...o))}return a}async firstHook(e,...r){for(let o of this.plugins.values()){let a=o.hooks;if(!a)continue;let n=e(a);if(!n)continue;let u=await n(...r);if(typeof u<"u")return u}return null}},Ve=rA;Ve.deleteProperty=Symbol(),Ve.telemetry=null});var Ur={};Kt(Ur,{EndStrategy:()=>Z4,ExecError:()=>Qx,PipeError:()=>P1,execvp:()=>j4,pipevp:()=>Gc});function Sd(t){return t!==null&&typeof t.fd=="number"}function J4(){}function z4(){for(let t of xd)t.kill()}async function Gc(t,e,{cwd:r,env:o=process.env,strict:a=!1,stdin:n=null,stdout:u,stderr:A,end:p=2}){let h=["pipe","pipe","pipe"];n===null?h[0]="ignore":Sd(n)&&(h[0]=n),Sd(u)&&(h[1]=u),Sd(A)&&(h[2]=A);let E=(0,X4.default)(t,e,{cwd:ue.fromPortablePath(r),env:{...o,PWD:ue.fromPortablePath(r)},stdio:h});xd.add(E),xd.size===1&&(process.on("SIGINT",J4),process.on("SIGTERM",z4)),!Sd(n)&&n!==null&&n.pipe(E.stdin),Sd(u)||E.stdout.pipe(u,{end:!1}),Sd(A)||E.stderr.pipe(A,{end:!1});let I=()=>{for(let v of new Set([u,A]))Sd(v)||v.end()};return new Promise((v,b)=>{E.on("error",C=>{xd.delete(E),xd.size===0&&(process.off("SIGINT",J4),process.off("SIGTERM",z4)),(p===2||p===1)&&I(),b(C)}),E.on("close",(C,T)=>{xd.delete(E),xd.size===0&&(process.off("SIGINT",J4),process.off("SIGTERM",z4)),(p===2||p===1&&C!==0)&&I(),C===0||!a?v({code:$4(C,T)}):b(new P1({fileName:t,code:C,signal:T}))})})}async function j4(t,e,{cwd:r,env:o=process.env,encoding:a="utf8",strict:n=!1}){let u=["ignore","pipe","pipe"],A=[],p=[],h=ue.fromPortablePath(r);typeof o.PWD<"u"&&(o={...o,PWD:h});let E=(0,X4.default)(t,e,{cwd:h,env:o,stdio:u});return E.stdout.on("data",I=>{A.push(I)}),E.stderr.on("data",I=>{p.push(I)}),await new Promise((I,v)=>{E.on("error",b=>{let C=Ve.create(r),T=Ot(C,t,yt.PATH);v(new zt(1,`Process ${T} failed to spawn`,L=>{L.reportError(1,` ${zu(C,{label:"Thrown Error",value:_c(yt.NO_HINT,b.message)})}`)}))}),E.on("close",(b,C)=>{let T=a==="buffer"?Buffer.concat(A):Buffer.concat(A).toString(a),L=a==="buffer"?Buffer.concat(p):Buffer.concat(p).toString(a);b===0||!n?I({code:$4(b,C),stdout:T,stderr:L}):v(new Qx({fileName:t,code:b,signal:C,stdout:T,stderr:L}))})})}function $4(t,e){let r=uot.get(e);return typeof r<"u"?128+r:t??1}function Aot(t,e,{configuration:r,report:o}){o.reportError(1,` ${zu(r,t!==null?{label:"Exit Code",value:_c(yt.NUMBER,t)}:{label:"Exit Signal",value:_c(yt.CODE,e)})}`)}var X4,Z4,P1,Qx,xd,uot,Px=Et(()=>{Pt();X4=$e(aR());D1();Yl();ql();Z4=(o=>(o[o.Never=0]="Never",o[o.ErrorCode=1]="ErrorCode",o[o.Always=2]="Always",o))(Z4||{}),P1=class extends zt{constructor({fileName:r,code:o,signal:a}){let n=Ve.create(K.cwd()),u=Ot(n,r,yt.PATH);super(1,`Child ${u} reported an error`,A=>{Aot(o,a,{configuration:n,report:A})});this.code=$4(o,a)}},Qx=class extends P1{constructor({fileName:r,code:o,signal:a,stdout:n,stderr:u}){super({fileName:r,code:o,signal:a});this.stdout=n,this.stderr=u}};xd=new Set;uot=new Map([["SIGINT",2],["SIGQUIT",3],["SIGKILL",9],["SIGTERM",15]])});function Tle(t){Fle=t}function S1(){return typeof eU>"u"&&(eU=Fle()),eU}var eU,Fle,tU=Et(()=>{Fle=()=>{throw new Error("Assertion failed: No libzip instance is available, and no factory was configured")}});var Rle=_((Fx,nU)=>{var fot=Object.assign({},Be("fs")),rU=function(){var t=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(t=t||__filename),function(e){e=e||{};var r=typeof e<"u"?e:{},o,a;r.ready=new Promise(function(We,tt){o=We,a=tt});var n={},u;for(u in r)r.hasOwnProperty(u)&&(n[u]=r[u]);var A=[],p="./this.program",h=function(We,tt){throw tt},E=!1,I=!0,v="";function b(We){return r.locateFile?r.locateFile(We,v):v+We}var C,T,L,U;I&&(E?v=Be("path").dirname(v)+"/":v=__dirname+"/",C=function(tt,It){var nr=ii(tt);return nr?It?nr:nr.toString():(L||(L=fot),U||(U=Be("path")),tt=U.normalize(tt),L.readFileSync(tt,It?null:"utf8"))},T=function(tt){var It=C(tt,!0);return It.buffer||(It=new Uint8Array(It)),Ee(It.buffer),It},process.argv.length>1&&(p=process.argv[1].replace(/\\/g,"/")),A=process.argv.slice(2),h=function(We){process.exit(We)},r.inspect=function(){return"[Emscripten Module object]"});var J=r.print||console.log.bind(console),te=r.printErr||console.warn.bind(console);for(u in n)n.hasOwnProperty(u)&&(r[u]=n[u]);n=null,r.arguments&&(A=r.arguments),r.thisProgram&&(p=r.thisProgram),r.quit&&(h=r.quit);var le=0,pe=function(We){le=We},Ae;r.wasmBinary&&(Ae=r.wasmBinary);var ye=r.noExitRuntime||!0;typeof WebAssembly!="object"&&Ri("no native wasm support detected");function ae(We,tt,It){switch(tt=tt||"i8",tt.charAt(tt.length-1)==="*"&&(tt="i32"),tt){case"i1":return _e[We>>0];case"i8":return _e[We>>0];case"i16":return lp((We>>1)*2);case"i32":return Ms((We>>2)*4);case"i64":return Ms((We>>2)*4);case"float":return cu((We>>2)*4);case"double":return ap((We>>3)*8);default:Ri("invalid type for getValue: "+tt)}return null}var we,Pe=!1,g;function Ee(We,tt){We||Ri("Assertion failed: "+tt)}function De(We){var tt=r["_"+We];return Ee(tt,"Cannot call unknown function "+We+", make sure it is exported"),tt}function ce(We,tt,It,nr,$){var me={string:function(es){var xi=0;if(es!=null&&es!==0){var jo=(es.length<<2)+1;xi=Un(jo),ht(es,xi,jo)}return xi},array:function(es){var xi=Un(es.length);return Re(es,xi),xi}};function Le(es){return tt==="string"?Ie(es):tt==="boolean"?Boolean(es):es}var ft=De(We),pt=[],Rt=0;if(nr)for(var er=0;er=It)&&Te[nr];)++nr;return ee.decode(Te.subarray(We,nr))}function ke(We,tt,It,nr){if(!(nr>0))return 0;for(var $=It,me=It+nr-1,Le=0;Le=55296&&ft<=57343){var pt=We.charCodeAt(++Le);ft=65536+((ft&1023)<<10)|pt&1023}if(ft<=127){if(It>=me)break;tt[It++]=ft}else if(ft<=2047){if(It+1>=me)break;tt[It++]=192|ft>>6,tt[It++]=128|ft&63}else if(ft<=65535){if(It+2>=me)break;tt[It++]=224|ft>>12,tt[It++]=128|ft>>6&63,tt[It++]=128|ft&63}else{if(It+3>=me)break;tt[It++]=240|ft>>18,tt[It++]=128|ft>>12&63,tt[It++]=128|ft>>6&63,tt[It++]=128|ft&63}}return tt[It]=0,It-$}function ht(We,tt,It){return ke(We,Te,tt,It)}function H(We){for(var tt=0,It=0;It=55296&&nr<=57343&&(nr=65536+((nr&1023)<<10)|We.charCodeAt(++It)&1023),nr<=127?++tt:nr<=2047?tt+=2:nr<=65535?tt+=3:tt+=4}return tt}function lt(We){var tt=H(We)+1,It=Li(tt);return It&&ke(We,_e,It,tt),It}function Re(We,tt){_e.set(We,tt)}function Qe(We,tt){return We%tt>0&&(We+=tt-We%tt),We}var be,_e,Te,Je,He,x,w,S,y,F;function z(We){be=We,r.HEAP_DATA_VIEW=F=new DataView(We),r.HEAP8=_e=new Int8Array(We),r.HEAP16=Je=new Int16Array(We),r.HEAP32=x=new Int32Array(We),r.HEAPU8=Te=new Uint8Array(We),r.HEAPU16=He=new Uint16Array(We),r.HEAPU32=w=new Uint32Array(We),r.HEAPF32=S=new Float32Array(We),r.HEAPF64=y=new Float64Array(We)}var X=r.INITIAL_MEMORY||16777216,Z,ie=[],Se=[],Ne=[],ot=!1;function dt(){if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)xt(r.preRun.shift());oo(ie)}function jt(){ot=!0,oo(Se)}function $t(){if(r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;)Qr(r.postRun.shift());oo(Ne)}function xt(We){ie.unshift(We)}function an(We){Se.unshift(We)}function Qr(We){Ne.unshift(We)}var mr=0,xr=null,Wr=null;function Vn(We){mr++,r.monitorRunDependencies&&r.monitorRunDependencies(mr)}function Ns(We){if(mr--,r.monitorRunDependencies&&r.monitorRunDependencies(mr),mr==0&&(xr!==null&&(clearInterval(xr),xr=null),Wr)){var tt=Wr;Wr=null,tt()}}r.preloadedImages={},r.preloadedAudios={};function Ri(We){r.onAbort&&r.onAbort(We),We+="",te(We),Pe=!0,g=1,We="abort("+We+"). Build with -s ASSERTIONS=1 for more info.";var tt=new WebAssembly.RuntimeError(We);throw a(tt),tt}var ps="data:application/octet-stream;base64,";function io(We){return We.startsWith(ps)}var Si="data:application/octet-stream;base64,AGFzbQEAAAAB/wEkYAN/f38Bf2ABfwF/YAJ/fwF/YAF/AGAEf39/fwF/YAN/f38AYAV/f39/fwF/YAJ/fwBgBH9/f38AYAABf2AFf39/fn8BfmAEf35/fwF/YAR/f35/AX5gAn9+AX9gA398fwBgA39/fgF/YAF/AX5gBn9/f39/fwF/YAN/fn8Bf2AEf39/fwF+YAV/f35/fwF/YAR/f35/AX9gA39/fgF+YAJ/fgBgAn9/AX5gBX9/f39/AGADf35/AX5gBX5+f35/AX5gA39/fw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AECwubAgEDfyAALQAAQSBxRQRAAkAgASEDAkAgAiAAIgEoAhAiAAR/IAAFAn8gASABLQBKIgBBAWsgAHI6AEogASgCACIAQQhxBEAgASAAQSByNgIAQX8MAQsgAUIANwIEIAEgASgCLCIANgIcIAEgADYCFCABIAAgASgCMGo2AhBBAAsNASABKAIQCyABKAIUIgVrSwRAIAEgAyACIAEoAiQRAAAaDAILAn8gASwAS0F/SgRAIAIhAANAIAIgACIERQ0CGiADIARBAWsiAGotAABBCkcNAAsgASADIAQgASgCJBEAACAESQ0CIAMgBGohAyABKAIUIQUgAiAEawwBCyACCyEAIAUgAyAAEAcaIAEgASgCFCAAajYCFAsLCwvNBQEGfyAAKAIwIgNBhgJrIQYgACgCPCECIAMhAQNAIAAoAkQgAiAAKAJoIgRqayECIAEgBmogBE0EQCAAKAJIIgEgASADaiADEAcaAkAgAyAAKAJsIgFNBEAgACABIANrNgJsDAELIABCADcCbAsgACAAKAJoIANrIgE2AmggACAAKAJYIANrNgJYIAEgACgChC5JBEAgACABNgKELgsgAEH8gAEoAgARAwAgAiADaiECCwJAIAAoAgAiASgCBCIERQ0AIAAoAjwhBSAAIAIgBCACIARJGyICBH8gACgCSCAAKAJoaiAFaiEFIAEgBCACazYCBAJAAkACQAJAIAEoAhwiBCgCFEEBaw4CAQACCyAEQaABaiAFIAEoAgAgAkHcgAEoAgARCAAMAgsgASABKAIwIAUgASgCACACQcSAASgCABEEADYCMAwBCyAFIAEoAgAgAhAHGgsgASABKAIAIAJqNgIAIAEgASgCCCACajYCCCAAKAI8BSAFCyACaiICNgI8AkAgACgChC4iASACakEDSQ0AIAAoAmggAWshAQJAIAAoAnRBgQhPBEAgACAAIAAoAkggAWoiAi0AACACLQABIAAoAnwRAAA2AlQMAQsgAUUNACAAIAFBAWsgACgChAERAgAaCyAAKAKELiAAKAI8IgJBAUZrIgRFDQAgACABIAQgACgCgAERBQAgACAAKAKELiAEazYChC4gACgCPCECCyACQYUCSw0AIAAoAgAoAgRFDQAgAC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n8CQAJAIAEpAyhC/v///w9WDQAgASkDIEL+////D1YNACACQYAEcUUNASABKQNIQv////8PVA0BCyAFQYECa0H//wNxQQNJIQdBAQwBCyAFQYECa0H//wNxIQQgAkGACnFBgApHDQEgBEEDSSEHQQALIQkgBkIcEBciBEUEQCAAQQhqIgAEQCAAQQA2AgQgAEEONgIACyADEBwMBQsgAkGACHEhBQJAAkAgAkGAAnEEQAJAIAUNACABKQMgQv////8PVg0AIAEpAyhCgICAgBBUDQMLIAQgASkDKBAYIAEpAyAhDAwBCwJAAkACQCAFDQAgASkDIEL/////D1YNACABKQMoIgxC/////w9WDQEgASkDSEKAgICAEFQNBAsgASkDKCIMQv////8PVA0BCyAEIAwQGAsgASkDICIMQv////8PWgRAIAQgDBAYCyABKQNIIgxC/////w9UDQELIAQgDBAYCyAELQAARQRAIABBCGoiAARAIABBADYCBCAAQRQ2AgALIAQQCCADEBwMBQtBASEKQQEgBC0AAAR+IAQpAxAFQgALp0H//wNxIAYQRyEFIAQQCCAFIAM2AgAgBw0BDAILIAMhBSAEQQJLDQELIAZCBxAXIgRFBEAgAEEIaiIABEAgAEEANgIEIABBDjYCAAsgBRAcDAMLIARBAhANIARBhxJBAhAsIAQgAS0AUhBwIAQgAS8BEBANIAQtAABFBEAgAEEIaiIABEAgAEEANgIEIABBFDYCAAsgBBAIDAILQYGyAkEHIAYQRyEDIAQQCCADIAU2AgBBASELIAMhBQsgBkIuEBciA0UEQCAAQQhqIgAEQCAAQQA2AgQgAEEONgIACyAFEBwMAgsgA0GjEkGoEiACQYACcSIHG0EEECwgB0UEQCADIAkEf0EtBSABLwEIC0H//wNxEA0LIAMgCQR/QS0FIAEvAQoLQf//A3EQDSADIAEvAQwQDSADIAsEf0HjAAUgASgCEAtB//8DcRANIAYgASgCFDYCPAJ/IAZBPGoQjQEiCEUEQEEAIQlBIQwBCwJ/IAgoAhQiBEHQAE4EQCAEQQl0DAELIAhB0AA2AhRBgMACCyEEIAgoAgRBBXQgCCgCCEELdGog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QEMAgsLIAQgBWshAwsgAwsUACAAEEAgACgCABAgIAAoAgQQIAutBAIBfgV/IwBBEGsiBCQAIAAgAWshBgJAAkAgAUEBRgRAIAAgBi0AACACEBkMAQsgAUEJTwRAIAAgBikAADcAACAAIAJBAWtBB3FBAWoiBWohACACIAVrIgFFDQIgBSAGaiECA0AgACACKQAANwAAIAJBCGohAiAAQQhqIQAgAUEIayIBDQALDAILAkACQAJAAkAgAUEEaw4FAAICAgECCyAEIAYoAAAiATYCBCAEIAE2AgAMAgsgBCAGKQAANwMADAELQQghByAEQQhqIQgDQCAIIAYgByABIAEgB0sbIgUQByAFaiEIIAcgBWsiBw0ACyAEIAQpAwg3AwALAkAgBQ0AIAJBEEkNACAEKQMAIQMgAkEQayIGQQR2QQFqQQdxIgEEQANAIAAgAzcACCAAIAM3AAAgAkEQayECIABBEGohACABQQFrIgENAAsLIAZB8ABJDQADQCAAIAM3AHggACADNwBwIAAgAzcAaCAAIAM3AGAgACADNwBYIAAgAzcAUCAAIAM3AEggACADNwBAIAAgAzcAOCAAIAM3ADAgACADNwAoIAAgAzcAICAAIAM3ABggACADNwAQIAAgAzcACCAAIAM3AAAgAEGAAWohACACQYABayICQQ9LDQALCyACQQhPBEBBCCAFayEBA0AgACAEKQMANwAAIAAgAWohACACIAFrIgJBB0sNAAsLIAJFDQEgACAEIAIQBxoLIAAgAmohAAsgBEEQaiQAIAALXwECfyAAKAIIIgEEQCABEAsgAEEANgIICwJAIAAoAgQiAUUNACABKAIAIgJBAXFFDQAgASgCEEF+Rw0AIAEgAkF+cSICNgIAIAINACABECAgAEEANgIECyAAQQA6AAwL1wICBH8BfgJAAkAgACgCQCABp0EEdGooAgAiA0UEQCACBEAgAkEANgIEIAJBFDYCAAsMAQsgACgCACADKQNIIgdBABAUIQMgACgCACEAIANBf0wEQCACBEAgAiAAKAIMNgIAIAIgACgCEDYCBAsMAQtCACEBIwBBEGsiBiQAQX8hAwJAIABCGkEBEBRBf0wEQCACBEAgAiAAKAIMN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AikAADcAACABIAIpABg3ABggASACKQAQNwAQIAEgAikACDcACCABIAIpADg3ADggASACKQAwNwAwIAEgAikAKDcAKCABIAIpACA3ACAgASACKQBYNwBYIAEgAikAUDcAUCABIAIpAEg3AEggASACKQBANwBAIAEgAikAYDcAYCABIAIpAGg3AGggASACKQBwNwBwIAEgAikAeDcAeCACQYABaiECIAFBgAFqIQEgGkKAAX0iGkIfVg0ACwsgGkIQWgRAIAEgAikAADcAACABIAIpAAg3AAggGkIQfSEaIAJBEGohAiABQRBqIQELIBpCCFoEQCABIAIpAAA3AAAgGkIIfSEaIAJBCGohAiABQQhqIQELIBpCBFoEQCABIAIoAAA2AAAgGkIEfSEaIAJBBGohAiABQQRqIQELIBpCAloEQCABIAIvAAA7AAAgGkICfSEaIAJBAmohAiABQQJqIQELIBwgG30hHCAaUEUEQCABIAItAAA6AAAgAkEBaiECIAFBAWohAQsgHEIAUg0ACwsgDiEGIAwhAwsgBSAGSwRAAkACQCABIANNIAEgDyABa6wiGiAGrSIbIBogG1QbIhqnIglqIgIgA0txDQAgAyAJaiABSyABIANPcQ0AIAEgAyAJEAcaDAELIAEgAyADIAFrIgEgAUEfdSIBaiABcyIBEAcgAWohAiAaIAGtIh59IhxQDQAgASADaiEBA0ACQCAcIB4gHCAeVBsiG0IgVARAIBshGgwBCyAbIhpCIH0iIEIFiEIBfEIDgyIfUEUEQANAIAIgASkAADcAACACIAEpABg3ABggAiABKQAQNwAQIAIgASkACDcACCAaQiB9IRogAUEgaiEBIAJBIGohAiAfQgF9Ih9CAFINAAsLICBC4ABUDQADQCACIAEpAAA3AAAgAiABKQAYNwAYIAIgASkAEDcAECACIAEpAAg3AAggAiABKQA4NwA4IAIgASkAMDcAMCACIAEpACg3ACggAiABKQAgNwAgIAIgASkAWDcAWCACIAEpAFA3AFAgAiABKQBINwBIIAIgASkAQDcAQCACIAEpAGA3AGAgAiABKQBoNwBoIAIgASkAcDcAcCACIAEpAHg3AHggAUGAAWohASACQYABaiECIBpCgAF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QCACIAEpAAA3AAAgGkIIfSEaIAJBCGohAiABQQhqIQELIBpCBFoEQCACIAEoAAA2AAAgGkIEfSEaIAJBBGohAiABQQRqIQELIBpCAloEQCACIAEvAAA7AAAgGkICfSEaIAJBAmohAiABQQJqIQELIBwgG30hHCAaUEUEQCACIAEtAAA6AAAgAkEBaiECIAFBAWohAQsgHFBFDQALDAILAkAgASADTSABIA8gAWusIhogBa0iGyAaIBtUGyIapyIEaiICIANLcQ0AIAMgBGogAUsgASADT3ENACABIAMgBBAHGgwCCyABIAMgAyABayIBIAFBH3UiAWogAXMiARAHIAFqIQIgGiABrSIefSIcUA0BIAEgA2ohAQNAAkAgHCAeIBwgHlQbIhtCIFQEQCAbIRoMAQsgGyIaQiB9IiBCBYhCAXxCA4MiH1BFBEADQCACIAEpAAA3AAAgAiABKQAYNwAYIAIgASkAEDcAECACIAEpAAg3AAggGkIgfSEaIAFBIGohASACQSBqIQIgH0IBfSIfQgBSDQALCyAgQuAAVA0AA0AgAiABKQAANwAAIAIgASkAGDcAGCACIAEpABA3ABAgAiABKQAINwAIIAIgASkAODcAOCACIAEpADA3ADAgAiABKQAoNwAoIAIgASkAIDcAICACIAEpAFg3AFggAiABKQBQNwBQIAIgASkASDcASCACIAEpAEA3AEAgAiABKQBgNwBgIAIgASkAaDcAaCACIAEpAHA3AHAgAiABKQB4NwB4IAFBgAFqIQEgAkGAAWohAiAaQoABfSIaQh9WDQALCyAaQhBaBEAgAiABKQAANwAAIAIgASkACDcACCAaQhB9IRogAkEQaiECIAFBEGohAQsgGkIIWgRAIAIgASkAADcAACAaQgh9IRogAkEIaiECIAFBCGohAQsgGkIEWgRAIAIgASgAADYAACAaQgR9IRogAkEEaiECIAFBBGohAQsgGkICWgRAIAIgAS8AADsAACAaQgJ9IRogAkECaiECIAFBAmohAQsgHCAbfSEcIBpQRQRAIAIgAS0AADoAACACQQFqIQIgAUEBaiEBCyAcUEUNAAsMAQsCQAJAIBYEQAJAIAQgBUkEQCAHKAKYRyAESw0BCyABIARrIQMCQEEAIARrIgVBf0ogDyABa6wiGiAbIBogG1QbIhqnIgIgBUpxDQAgBUEBSCACIANqIAFLcQ0AIAEgAyACEAcgAmohAgwFCyABIAMgBCAEQR91IgFqIAFzIgEQByABaiECIBogAa0iHn0iHFANBCABIANqIQEDQAJAIBwgHiAcIB5UGyIbQiBUBEAgGyEaDAELIBsiGkIgfSIgQgWIQgF8QgODIh9QRQRAA0AgAiABKQAANwAAIAIgASkAGDcAGCACIAEpABA3ABAgAiABKQAINwAIIBpCIH0hGiABQSBqIQEgAkEgaiECIB9CAX0iH0IAUg0ACwsgIELgAFQNAANAIAIgASkAADcAACACIAEpABg3ABggAiABKQAQNwAQIAIgASkACDcACCACIAEpADg3ADggAiABKQAwNwAwIAIgASkAKDcAKCACIAEpACA3ACAgAiABKQBYNwBYIAIgASkAUDcAUCACIAEpAEg3AEggAiABKQBANwBAIAIgASkAYDcAYCACIAEpAGg3AGggAiABKQBwNwBwIAIgASkAeDcAeCABQYABaiEBIAJBgAFqIQIgGkKAAX0iGkIfVg0ACwsgGkIQWgRAIAIgASkAADcAACACIAEpAAg3AAggGkIQfSEaIAJBEGohAiABQRBqIQELIBpCCFoEQCACIAEpAAA3AAAgGkIIfSEaIAJBCGohAiABQQhqIQELIBpCBFoEQCACIAEoAAA2AAAgGkIEfSEaIAJBBGohAiABQQRqIQELIBpCAloEQCACIAEvAAA7AAAgGkICfSEaIAJBAmohAiABQQJqIQELIBwgG30hHCAaUEUEQCACIAEtAAA6AAAgAkEBaiECIAFBAWohAQsgHFBFDQALDAQLIBAgAWsiCUEBaiIGIAUgBSAGSxshAyABIARrIQIgAUEHcUUNAiADRQ0CIAEgAi0AADoAACACQQFqIQIgAUEBaiIGQQdxQQAgA0EBayIFGw0BIAYhASAFIQMgCSEGDAILAkAgBCAFSQRAIAcoAphHIARLDQELIAEgASAEayIGKQAANwAAIAEgBUEBa0EHcUEBaiIDaiECIAUgA2siBEUNAyADIAZqIQEDQCACIAEpAA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AQsgACABIAUvAWgQgQEhAyABEAsgA0UNAQsCQCAJRSAMckUEQCADIQEMAQsgACADQQEQgAEhASADEAsgAUUNAQsgASEDDAELQQAhAwsgBUHwAGokACADC4UBAQF/IAFFBEAgAEEIaiIABEAgAEEANgIEIABBEjYCAAtBAA8LQTgQCSIDRQRAIABBCGoiAARAIABBADYCBCAAQQ42AgALQQAPCyADQQA2AhAgA0IANwIIIANCADcDKCADQQA2AgQgAyACNgIAIANCADcDGCADQQA2AjAgACABQTsgAxBCCw8AIAAgASACQQBBABCCAQusAgECfyABRQRAIABBCGoiAARAIABBADYCBCAAQRI2AgALQQAPCwJAIAJBfUsNACACQf//A3FBCEYNACAAQQhqIgAEQCAAQQA2AgQgAEEQNgIAC0EADwsCQEGwwAAQCSIFBEAgBUEANgIIIAVCADcCACAFQYiBAUGogQEgAxs2AqhAIAUgAjYCFCAFIAM6ABAgBUEAOgAPIAVBADsBDCAFIAMgAkF9SyIGcToADiAFQQggAiAGG0H//wNxIAQgBUGIgQFBqIEBIAMbKAIAEQAAIgI2AqxAIAINASAFEDEgBRAGCyAAQQhqIgAEQCAAQQA2AgQgAEEONgIAC0EADwsgACABQTogBRBCIgAEfyAABSAFKAKsQCAFKAKoQCgCBBEDACAFEDEgBRAGQQALC6ABAQF/IAIgACgCBCIDIAIgA0kbIgIEQCAAIAMgAms2AgQCQAJAAkACQCAAKAIcIgMoAhRBAWsOAgEAAgsgA0GgAWogASAAKAIAIAJB3IABKAIAEQgADAILIAAgACgCMCABIAAoAgAgAkHEgAEoAgARBAA2AjAMAQsgASAAKAIAIAIQBxoLIAAgACgCACACajYCACAAIAAoAgggAmo2AggLC7cCAQR/QX4hAgJAIABFDQAgACgCIEUNACAAKAIkIgRFDQAgACgCHCIBRQ0AIAEoAgAgAEcNAAJAAkAgASgCICIDQTlrDjkBAgICAgICAgICAgIBAgICAQICAgICAgICAgICAgICAgICAQICAgICAgICAgICAQICAgICAgICAgEACyADQZoFRg0AIANBKkcNAQsCfwJ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AIQaiAMNwAAIAAgACgCEEEIajYCECAFIQMMAQsgACgCBCAAKAIQaiALIASthiAMhDcAACAAIAAoAhBBCGo2AhAgA0FAaiEDIAtBwAAgBGutiCELCyAAIAs3A5guIAAgAzYCoC4gCSAAKALwLUkNAAsLIAFBgAhqMwEAIQwCQCADIAFBgghqLwEAIgJqIgFBP00EQCAMIAOthiALhCEMDAELIANBwABGBEAgACgCBCAAKAIQaiALNwAAIAAgACgCEEEIajYCECACIQEMAQsgACgCBCAAKAIQaiAMIAOthiALhDcAACAAIAAoAhBBCGo2AhAgAUFAaiEBIAxBwAAgA2utiCEMCyAAIAw3A5guIAAgATYCoC4L8AQBA38gAEHkAWohAgNAIAIgAUECdCIDakEAOwEAIAIgA0EEcmpBADsBACABQQJqIgFBngJHDQALIABBADsBzBUgAEEAOwHYEyAAQZQWakEAOwEAIABBkBZqQQA7AQAgAEGMFmpBADsBACAAQYgWakEAOwEAIABBhBZqQQA7AQAgAEGAFmpBADsBACAAQfwVakEAOwEAIABB+BVqQQA7AQAgAEH0FWpBADsBACAAQfAVakEAOwEAIABB7BVqQQA7AQAgAEHoFWpBADsBACAAQeQVakEAOwEAIABB4BVqQQA7AQAgAEHcFWpBADsBACAAQdgVakEAOwEAIABB1BVqQQA7AQAgAEHQFWpBADsBACAAQcwUakEAOwEAIABByBRqQQA7AQAgAEHEFGpBADsBACAAQcAUakEAOwEAIABBvBRqQQA7AQAgAEG4FGpBADsBACAAQbQUakEAOwEAIABBsBRqQQA7AQAgAEGsFGpBADsBACAAQagUakEAOwEAIABBpBRqQQA7AQAgAEGgFGpBADsBACAAQZwUakEAOwEAIABBmBRqQQA7AQAgAEGUFGpBADsBACAAQZAUakEAOwEAIABBjBRqQQA7AQAgAEGIFGpBADsBACAAQYQUakEAOwEAIABBgBRqQQA7AQAgAEH8E2pBADsBACAAQfgTakEAOwEAIABB9BNqQQA7AQAgAEHwE2pBADsBACAAQewTakEAOwEAIABB6BNqQQA7AQAgAEHkE2pBADsBACAA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HAAAsCQAAhgUAAEgFAACnBQAAAAQAADIFAAC8BQAALAkAQYDBAAv3CQwACACMAAgATAAIAMwACAAsAAgArAAIAGwACADsAAgAHAAIAJwACABcAAgA3AAIADwACAC8AAgAfAAIAPwACAACAAgAggAIAEIACADCAAgAIgAIAKIACABiAAgA4gAIABIACACSAAgAUgAIANIACAAyAAgAsgAIAHIACADyAAgACgAIAIoACABKAAgAygAIACoACACqAAgAagAIAOoACAAaAAgAmgAIAFoACADaAAgAOgAIALoACAB6AAgA+gAIAAYACACGAAgARgAIAMYACAAmAAgApgAIAGYACADmAAgAFgAIAJYACABWAAgA1gAIADYACAC2AAgAdgAIAPYACAAOAAgAjgAIAE4ACADOAAgALgAIAK4ACABuAAgA7gAIAB4ACACeAAgAXgAIAN4ACAA+AAgAvgAIAH4ACAD+AAgAAQAIAIEACABBAAgAwQAIACEACAChAAgAYQAIAOEACAARAAgAkQAIAFEACADRAAgAMQAIALEACABxAAgA8QAIAAkACACJAAgASQAIAMkACAApAAgAqQAIAGkACADpAAgAGQAIAJkACABZAAgA2QAIADkACAC5AAgAeQAIAPkACAAFAAgAhQAIAEUACADFAAgAJQAIAKUACABlAAgA5QAIABUACACVAAgAVQAIANUACAA1AAgAtQAIAHUACAD1AAgADQAIAI0ACABNAAgAzQAIAC0ACACtAAgAbQAIAO0ACAAdAAgAnQAIAF0ACADdAAgAPQAIAL0ACAB9AAgA/QAIABMACQATAQkAkwAJAJMBCQBTAAkAUwEJANMACQDTAQkAMwAJADMBCQCzAAkAswEJAHMACQBzAQkA8wAJAPMBCQALAAkACwEJAIsACQCLAQkASwAJAEsBCQDLAAkAywEJACsACQArAQkAqwAJAKsBCQBrAAkAawEJAOsACQDrAQkAGwAJABsBCQCbAAkAmwEJAFsACQBbAQkA2wAJANsBCQA7AAkAOwEJALsACQC7AQkAewAJAHsBCQD7AAkA+wEJAAcACQAHAQkAhwAJAIcBCQBHAAkARwEJAMcACQDHAQkAJwAJACcBCQCnAAkApwEJAGcACQBn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AALZQEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAUAAAAGAAAABgAAAAcAAAAHAAAACAAAAAgAAAAJAAAACQAAAAoAAAAKAAAACwAAAAsAAAAMAAAADAAAAA0AAAANAEGA1gALIwIAAAADAAAABwAAAAAAAAAQERIACAcJBgoFCwQMAw0CDgEPAEHQ1gALTQEAAAABAAAAAQAAAAEAAAACAAAAAgAAAAIAAAACAAAAAwAAAAMAAAADAAAAAwAAAAQAAAAEAAAABAAAAAQAAAAFAAAABQAAAAUAAAAFAEHA1wALZQEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAUAAAAGAAAABgAAAAcAAAAHAAAACAAAAAgAAAAJAAAACQAAAAoAAAAKAAAACwAAAAsAAAAMAAAADAAAAA0AAAANAEG42AALASwAQcTYAAthLQAAAAQABAAIAAQALgAAAAQABgAQAAYALwAAAAQADAAgABgALwAAAAgAEAAgACAALwAAAAgAEACAAIAALwAAAAgAIACAAAABMAAAACAAgAACAQAEMAAAACAAAgECAQAQMABBsNkAC6UTAwAEAAUABgAHAAgACQAKAAsADQAPABEAEwAXABsAHwAjACsAMwA7AEMAUwBjAHMAgwCjAMMA4wACAQAAAAAAABAAEAAQABAAEAAQABAAEAARABEAEQARABIAEgASABIAEwATABMAEwAUABQAFAAUABUAFQAVABUAEABNAMoAAAABAAIAAwAEAAUABwAJAA0AEQAZACEAMQBBAGEAgQDBAAEBgQEBAgEDAQQBBgEIAQwBEAEYASABMAFAAWAAAAAAEAAQABAAEAARABEAEgASABMAEwAUABQAFQAVABYAFgAXABcAGAAYABkAGQAaABoAGwAbABwAHAAdAB0AQABAAGAHAAAACFAAAAgQABQIcwASBx8AAAhwAAAIMAAACcAAEAcKAAAIYAAACCAAAAmgAAAIAAAACIAAAAhAAAAJ4AAQBwYAAAhYAAAIGAAACZAAEwc7AAAIeAAACDgAAAnQABEHEQAACGgAAAgoAAAJsAAACAgAAAiIAAAISAAACfAAEAcEA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IHNwYWNlIGF2YWlsYWJsZQBTb2NrZXQgaXMgY29ubmVjdGVkAFNvY2tldCBub3QgY29ubmVjdGVkAENhbm5vdCBzZW5kIGFmdGVyIHNvY2tldCBzaHV0ZG93bgBPcGVyYXRpb24gYWxyZWFkeSBpbiBwcm9ncmVzcwBPcGVyYXRpb24gaW4gcHJvZ3Jlc3MAU3RhbGUgZmlsZSBoYW5kbGUAUmVtb3RlIEkvTyBlcnJvcgBRdW90YSBleGNlZWRlZABObyBtZWRpdW0gZm91bmQAV3JvbmcgbWVkaXVtIHR5cGUATm8gZXJyb3IgaW5mb3JtYXRpb24AQcCAAQuFARMAAAAUAAAAFQAAABYAAAAXAAAAGAAAABkAAAAaAAAAGwAAABwAAAAdAAAAHgAAAB8AAAAgAAAAIQAAACIAAAAjAAAAgERQADEAAAAyAAAAMwAAADQAAAA1AAAANgAAADcAAAA4AAAAOQAAADIAAAAzAAAANAAAADUAAAA2AAAANwAAADgAQfSCAQsCXEQAQbCDAQsQ/////////////////////w==";io(Si)||(Si=b(Si));function Ls(We){try{if(We==Si&&Ae)return new Uint8Array(Ae);var tt=ii(We);if(tt)return tt;if(T)return T(We);throw"sync fetching of the wasm failed: you can preload it to Module['wasmBinary'] manually, or emcc.py will do that for you when generating HTML (but not JS)"}catch(It){Ri(It)}}function so(We,tt){var It,nr,$;try{$=Ls(We),nr=new WebAssembly.Module($),It=new WebAssembly.Instance(nr,tt)}catch(Le){var me=Le.toString();throw te("failed to compile wasm module: "+me),(me.includes("imported Memory")||me.includes("memory import"))&&te("Memory size incompatibility issues may be due to changing INITIAL_MEMORY at runtime to something too large. Use ALLOW_MEMORY_GROWTH to allow any size memory (and also make sure not to set INITIAL_MEMORY at runtime to something smaller than it was at compile time)."),Le}return[It,nr]}function cc(){var We={a:Oa};function tt($,me){var Le=$.exports;r.asm=Le,we=r.asm.g,z(we.buffer),Z=r.asm.W,an(r.asm.h),Ns("wasm-instantiate")}if(Vn("wasm-instantiate"),r.instantiateWasm)try{var It=r.instantiateWasm(We,tt);return It}catch($){return te("Module.instantiateWasm callback failed with error: "+$),!1}var nr=so(Si,We);return tt(nr[0]),r.asm}function cu(We){return F.getFloat32(We,!0)}function ap(We){return F.getFloat64(We,!0)}function lp(We){return F.getInt16(We,!0)}function Ms(We){return F.getInt32(We,!0)}function Dn(We,tt){F.setInt32(We,tt,!0)}function oo(We){for(;We.length>0;){var tt=We.shift();if(typeof tt=="function"){tt(r);continue}var It=tt.func;typeof It=="number"?tt.arg===void 0?Z.get(It)():Z.get(It)(tt.arg):It(tt.arg===void 0?null:tt.arg)}}function Os(We,tt){var It=new Date(Ms((We>>2)*4)*1e3);Dn((tt>>2)*4,It.getUTCSeconds()),Dn((tt+4>>2)*4,It.getUTCMinutes()),Dn((tt+8>>2)*4,It.getUTCHours()),Dn((tt+12>>2)*4,It.getUTCDate()),Dn((tt+16>>2)*4,It.getUTCMonth()),Dn((tt+20>>2)*4,It.getUTCFullYear()-1900),Dn((tt+24>>2)*4,It.getUTCDay()),Dn((tt+36>>2)*4,0),Dn((tt+32>>2)*4,0);var nr=Date.UTC(It.getUTCFullYear(),0,1,0,0,0,0),$=(It.getTime()-nr)/(1e3*60*60*24)|0;return Dn((tt+28>>2)*4,$),Os.GMTString||(Os.GMTString=lt("GMT")),Dn((tt+40>>2)*4,Os.GMTString),tt}function ml(We,tt){return Os(We,tt)}function yl(We,tt,It){Te.copyWithin(We,tt,tt+It)}function ao(We){try{return we.grow(We-be.byteLength+65535>>>16),z(we.buffer),1}catch{}}function Kn(We){var tt=Te.length;We=We>>>0;var It=2147483648;if(We>It)return!1;for(var nr=1;nr<=4;nr*=2){var $=tt*(1+.2/nr);$=Math.min($,We+100663296);var me=Math.min(It,Qe(Math.max(We,$),65536)),Le=ao(me);if(Le)return!0}return!1}function Mn(We){pe(We)}function Ni(We){var tt=Date.now()/1e3|0;return We&&Dn((We>>2)*4,tt),tt}function On(){if(On.called)return;On.called=!0;var We=new Date().getFullYear(),tt=new Date(We,0,1),It=new Date(We,6,1),nr=tt.getTimezoneOffset(),$=It.getTimezoneOffset(),me=Math.max(nr,$);Dn((ds()>>2)*4,me*60),Dn((gs()>>2)*4,Number(nr!=$));function Le(Zr){var qi=Zr.toTimeString().match(/\(([A-Za-z ]+)\)$/);return qi?qi[1]:"GMT"}var ft=Le(tt),pt=Le(It),Rt=lt(ft),er=lt(pt);$>2)*4,Rt),Dn((wi()+4>>2)*4,er)):(Dn((wi()>>2)*4,er),Dn((wi()+4>>2)*4,Rt))}function _i(We){On();var tt=Date.UTC(Ms((We+20>>2)*4)+1900,Ms((We+16>>2)*4),Ms((We+12>>2)*4),Ms((We+8>>2)*4),Ms((We+4>>2)*4),Ms((We>>2)*4),0),It=new Date(tt);Dn((We+24>>2)*4,It.getUTCDay());var nr=Date.UTC(It.getUTCFullYear(),0,1,0,0,0,0),$=(It.getTime()-nr)/(1e3*60*60*24)|0;return Dn((We+28>>2)*4,$),It.getTime()/1e3|0}var tr=typeof atob=="function"?atob:function(We){var tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",It="",nr,$,me,Le,ft,pt,Rt,er=0;We=We.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Le=tt.indexOf(We.charAt(er++)),ft=tt.indexOf(We.charAt(er++)),pt=tt.indexOf(We.charAt(er++)),Rt=tt.indexOf(We.charAt(er++)),nr=Le<<2|ft>>4,$=(ft&15)<<4|pt>>2,me=(pt&3)<<6|Rt,It=It+String.fromCharCode(nr),pt!==64&&(It=It+String.fromCharCode($)),Rt!==64&&(It=It+String.fromCharCode(me));while(er0||(dt(),mr>0))return;function tt(){Pn||(Pn=!0,r.calledRun=!0,!Pe&&(jt(),o(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),$t()))}r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),tt()},1)):tt()}if(r.run=ys,r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return ys(),e}}();typeof Fx=="object"&&typeof nU=="object"?nU.exports=rU:typeof define=="function"&&define.amd?define([],function(){return rU}):typeof Fx=="object"&&(Fx.createModule=rU)});var Lf,Nle,Lle,Mle=Et(()=>{Lf=["number","number"],Nle=(ee=>(ee[ee.ZIP_ER_OK=0]="ZIP_ER_OK",ee[ee.ZIP_ER_MULTIDISK=1]="ZIP_ER_MULTIDISK",ee[ee.ZIP_ER_RENAME=2]="ZIP_ER_RENAME",ee[ee.ZIP_ER_CLOSE=3]="ZIP_ER_CLOSE",ee[ee.ZIP_ER_SEEK=4]="ZIP_ER_SEEK",ee[ee.ZIP_ER_READ=5]="ZIP_ER_READ",ee[ee.ZIP_ER_WRITE=6]="ZIP_ER_WRITE",ee[ee.ZIP_ER_CRC=7]="ZIP_ER_CRC",ee[ee.ZIP_ER_ZIPCLOSED=8]="ZIP_ER_ZIPCLOSED",ee[ee.ZIP_ER_NOENT=9]="ZIP_ER_NOENT",ee[ee.ZIP_ER_EXISTS=10]="ZIP_ER_EXISTS",ee[ee.ZIP_ER_OPEN=11]="ZIP_ER_OPEN",ee[ee.ZIP_ER_TMPOPEN=12]="ZIP_ER_TMPOPEN",ee[ee.ZIP_ER_ZLIB=13]="ZIP_ER_ZLIB",ee[ee.ZIP_ER_MEMORY=14]="ZIP_ER_MEMORY",ee[ee.ZIP_ER_CHANGED=15]="ZIP_ER_CHANGED",ee[ee.ZIP_ER_COMPNOTSUPP=16]="ZIP_ER_COMPNOTSUPP",ee[ee.ZIP_ER_EOF=17]="ZIP_ER_EOF",ee[ee.ZIP_ER_INVAL=18]="ZIP_ER_INVAL",ee[ee.ZIP_ER_NOZIP=19]="ZIP_ER_NOZIP",ee[ee.ZIP_ER_INTERNAL=20]="ZIP_ER_INTERNAL",ee[ee.ZIP_ER_INCONS=21]="ZIP_ER_INCONS",ee[ee.ZIP_ER_REMOVE=22]="ZIP_ER_REMOVE",ee[ee.ZIP_ER_DELETED=23]="ZIP_ER_DELETED",ee[ee.ZIP_ER_ENCRNOTSUPP=24]="ZIP_ER_ENCRNOTSUPP",ee[ee.ZIP_ER_RDONLY=25]="ZIP_ER_RDONLY",ee[ee.ZIP_ER_NOPASSWD=26]="ZIP_ER_NOPASSWD",ee[ee.ZIP_ER_WRONGPASSWD=27]="ZIP_ER_WRONGPASSWD",ee[ee.ZIP_ER_OPNOTSUPP=28]="ZIP_ER_OPNOTSUPP",ee[ee.ZIP_ER_INUSE=29]="ZIP_ER_INUSE",ee[ee.ZIP_ER_TELL=30]="ZIP_ER_TELL",ee[ee.ZIP_ER_COMPRESSED_DATA=31]="ZIP_ER_COMPRESSED_DATA",ee))(Nle||{}),Lle=t=>({get HEAPU8(){return t.HEAPU8},errors:Nle,SEEK_SET:0,SEEK_CUR:1,SEEK_END:2,ZIP_CHECKCONS:4,ZIP_EXCL:2,ZIP_RDONLY:16,ZIP_FL_OVERWRITE:8192,ZIP_FL_COMPRESSED:4,ZIP_OPSYS_DOS:0,ZIP_OPSYS_AMIGA:1,ZIP_OPSYS_OPENVMS:2,ZIP_OPSYS_UNIX:3,ZIP_OPSYS_VM_CMS:4,ZIP_OPSYS_ATARI_ST:5,ZIP_OPSYS_OS_2:6,ZIP_OPSYS_MACINTOSH:7,ZIP_OPSYS_Z_SYSTEM:8,ZIP_OPSYS_CPM:9,ZIP_OPSYS_WINDOWS_NTFS:10,ZIP_OPSYS_MVS:11,ZIP_OPSYS_VSE:12,ZIP_OPSYS_ACORN_RISC:13,ZIP_OPSYS_VFAT:14,ZIP_OPSYS_ALTERNATE_MVS:15,ZIP_OPSYS_BEOS:16,ZIP_OPSYS_TANDEM:17,ZIP_OPSYS_OS_400:18,ZIP_OPSYS_OS_X:19,ZIP_CM_DEFAULT:-1,ZIP_CM_STORE:0,ZIP_CM_DEFLATE:8,uint08S:t._malloc(1),uint32S:t._malloc(4),malloc:t._malloc,free:t._free,getValue:t.getValue,openFromSource:t.cwrap("zip_open_from_source","number",["number","number","number"]),close:t.cwrap("zip_close","number",["number"]),discard:t.cwrap("zip_discard",null,["number"]),getError:t.cwrap("zip_get_error","number",["number"]),getName:t.cwrap("zip_get_name","string",["number","number","number"]),getNumEntries:t.cwrap("zip_get_num_entries","number",["number","number"]),delete:t.cwrap("zip_delete","number",["number","number"]),statIndex:t.cwrap("zip_stat_index","number",["number",...Lf,"number","number"]),fopenIndex:t.cwrap("zip_fopen_index","number",["number",...Lf,"number"]),fread:t.cwrap("zip_fread","number",["number","number","number","number"]),fclose:t.cwrap("zip_fclose","number",["number"]),dir:{add:t.cwrap("zip_dir_add","number",["number","string"])},file:{add:t.cwrap("zip_file_add","number",["number","string","number","number"]),getError:t.cwrap("zip_file_get_error","number",["number"]),getExternalAttributes:t.cwrap("zip_file_get_external_attributes","number",["number",...Lf,"number","number","number"]),setExternalAttributes:t.cwrap("zip_file_set_external_attributes","number",["number",...Lf,"number","number","number"]),setMtime:t.cwrap("zip_file_set_mtime","number",["number",...Lf,"number","number"]),setCompression:t.cwrap("zip_set_file_compression","number",["number",...Lf,"number","number"])},ext:{countSymlinks:t.cwrap("zip_ext_count_symlinks","number",["number"])},error:{initWithCode:t.cwrap("zip_error_init_with_code",null,["number","number"]),strerror:t.cwrap("zip_error_strerror","string",["number"])},name:{locate:t.cwrap("zip_name_locate","number",["number","string","number"])},source:{fromUnattachedBuffer:t.cwrap("zip_source_buffer_create","number",["number",...Lf,"number","number"]),fromBuffer:t.cwrap("zip_source_buffer","number",["number","number",...Lf,"number"]),free:t.cwrap("zip_source_free",null,["number"]),keep:t.cwrap("zip_source_keep",null,["number"]),open:t.cwrap("zip_source_open","number",["number"]),close:t.cwrap("zip_source_close","number",["number"]),seek:t.cwrap("zip_source_seek","number",["number",...Lf,"number"]),tell:t.cwrap("zip_source_tell","number",["number"]),read:t.cwrap("zip_source_read","number",["number","number","number"]),error:t.cwrap("zip_source_error","number",["number"])},struct:{statS:t.cwrap("zipstruct_statS","number",[]),statSize:t.cwrap("zipstruct_stat_size","number",["number"]),statCompSize:t.cwrap("zipstruct_stat_comp_size","number",["number"]),statCompMethod:t.cwrap("zipstruct_stat_comp_method","number",["number"]),statMtime:t.cwrap("zipstruct_stat_mtime","number",["number"]),statCrc:t.cwrap("zipstruct_stat_crc","number",["number"]),errorS:t.cwrap("zipstruct_errorS","number",[]),errorCodeZip:t.cwrap("zipstruct_error_code_zip","number",["number"])}})});function iU(t,e){let r=t.indexOf(e);if(r<=0)return null;let o=r;for(;r>=0&&(o=r+e.length,t[o]!==K.sep);){if(t[r-1]===K.sep)return null;r=t.indexOf(e,o)}return t.length>o&&t[o]!==K.sep?null:t.slice(0,o)}var Jl,Ole=Et(()=>{Pt();Pt();nA();Jl=class extends _p{static async openPromise(e,r){let o=new Jl(r);try{return await e(o)}finally{o.saveAndClose()}}constructor(e={}){let r=e.fileExtensions,o=e.readOnlyArchives,a=typeof r>"u"?A=>iU(A,".zip"):A=>{for(let p of r){let h=iU(A,p);if(h)return h}return null},n=(A,p)=>new zi(p,{baseFs:A,readOnly:o,stats:A.statSync(p)}),u=async(A,p)=>{let h={baseFs:A,readOnly:o,stats:await A.statPromise(p)};return()=>new zi(p,h)};super({...e,factorySync:n,factoryPromise:u,getMountPoint:a})}}});function pot(t){if(typeof t=="string"&&String(+t)===t)return+t;if(typeof t=="number"&&Number.isFinite(t))return t<0?Date.now()/1e3:t;if(Ule.types.isDate(t))return t.getTime()/1e3;throw new Error("Invalid time")}function Tx(){return Buffer.from([80,75,5,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])}var ta,sU,Ule,oU,_le,Rx,zi,aU=Et(()=>{Pt();Pt();Pt();Pt();Pt();Pt();ta=Be("fs"),sU=Be("stream"),Ule=Be("util"),oU=$e(Be("zlib"));tU();_le="mixed";Rx=class extends Error{constructor(r,o){super(r);this.name="Libzip Error",this.code=o}},zi=class extends Ou{constructor(r,o={}){super();this.listings=new Map;this.entries=new Map;this.fileSources=new Map;this.fds=new Map;this.nextFd=0;this.ready=!1;this.readOnly=!1;let a=o;if(this.level=typeof a.level<"u"?a.level:_le,r??=Tx(),typeof r=="string"){let{baseFs:A=new Rn}=a;this.baseFs=A,this.path=r}else this.path=null,this.baseFs=null;if(o.stats)this.stats=o.stats;else if(typeof r=="string")try{this.stats=this.baseFs.statSync(r)}catch(A){if(A.code==="ENOENT"&&a.create)this.stats=Ea.makeDefaultStats();else throw A}else this.stats=Ea.makeDefaultStats();this.libzip=S1();let n=this.libzip.malloc(4);try{let A=0;o.readOnly&&(A|=this.libzip.ZIP_RDONLY,this.readOnly=!0),typeof r=="string"&&(r=a.create?Tx():this.baseFs.readFileSync(r));let p=this.allocateUnattachedSource(r);try{this.zip=this.libzip.openFromSource(p,A,n),this.lzSource=p}catch(h){throw this.libzip.source.free(p),h}if(this.zip===0){let h=this.libzip.struct.errorS();throw this.libzip.error.initWithCode(h,this.libzip.getValue(n,"i32")),this.makeLibzipError(h)}}finally{this.libzip.free(n)}this.listings.set(Bt.root,new Set);let u=this.libzip.getNumEntries(this.zip,0);for(let A=0;Ar)throw new Error("Overread");let n=this.libzip.HEAPU8.subarray(o,o+r);return Buffer.from(n)}finally{this.libzip.free(o)}}finally{this.libzip.source.close(this.lzSource),this.libzip.source.free(this.lzSource),this.ready=!1}}discardAndClose(){this.prepareClose(),this.libzip.discard(this.zip),this.ready=!1}saveAndClose(){if(!this.path||!this.baseFs)throw new Error("ZipFS cannot be saved and must be discarded when loaded from a buffer");if(this.readOnly){this.discardAndClose();return}let r=this.baseFs.existsSync(this.path)||this.stats.mode===Ea.DEFAULT_MODE?void 0:this.stats.mode;this.baseFs.writeFileSync(this.path,this.getBufferAndClose(),{mode:r}),this.ready=!1}resolve(r){return K.resolve(Bt.root,r)}async openPromise(r,o,a){return this.openSync(r,o,a)}openSync(r,o,a){let n=this.nextFd++;return this.fds.set(n,{cursor:0,p:r}),n}hasOpenFileHandles(){return!!this.fds.size}async opendirPromise(r,o){return this.opendirSync(r,o)}opendirSync(r,o={}){let a=this.resolveFilename(`opendir '${r}'`,r);if(!this.entries.has(a)&&!this.listings.has(a))throw ar.ENOENT(`opendir '${r}'`);let n=this.listings.get(a);if(!n)throw ar.ENOTDIR(`opendir '${r}'`);let u=[...n],A=this.openSync(a,"r");return SD(this,a,u,{onClose:()=>{this.closeSync(A)}})}async readPromise(r,o,a,n,u){return this.readSync(r,o,a,n,u)}readSync(r,o,a=0,n=o.byteLength,u=-1){let A=this.fds.get(r);if(typeof A>"u")throw ar.EBADF("read");let p=u===-1||u===null?A.cursor:u,h=this.readFileSync(A.p);h.copy(o,a,p,p+n);let E=Math.max(0,Math.min(h.length-p,n));return(u===-1||u===null)&&(A.cursor+=E),E}async writePromise(r,o,a,n,u){return typeof o=="string"?this.writeSync(r,o,u):this.writeSync(r,o,a,n,u)}writeSync(r,o,a,n,u){throw typeof this.fds.get(r)>"u"?ar.EBADF("read"):new Error("Unimplemented")}async closePromise(r){return this.closeSync(r)}closeSync(r){if(typeof this.fds.get(r)>"u")throw ar.EBADF("read");this.fds.delete(r)}createReadStream(r,{encoding:o}={}){if(r===null)throw new Error("Unimplemented");let a=this.openSync(r,"r"),n=Object.assign(new sU.PassThrough({emitClose:!0,autoDestroy:!0,destroy:(A,p)=>{clearImmediate(u),this.closeSync(a),p(A)}}),{close(){n.destroy()},bytesRead:0,path:r,pending:!1}),u=setImmediate(async()=>{try{let A=await this.readFilePromise(r,o);n.bytesRead=A.length,n.end(A)}catch(A){n.destroy(A)}});return n}createWriteStream(r,{encoding:o}={}){if(this.readOnly)throw ar.EROFS(`open '${r}'`);if(r===null)throw new Error("Unimplemented");let a=[],n=this.openSync(r,"w"),u=Object.assign(new sU.PassThrough({autoDestroy:!0,emitClose:!0,destroy:(A,p)=>{try{A?p(A):(this.writeFileSync(r,Buffer.concat(a),o),p(null))}catch(h){p(h)}finally{this.closeSync(n)}}}),{close(){u.destroy()},bytesWritten:0,path:r,pending:!1});return u.on("data",A=>{let p=Buffer.from(A);u.bytesWritten+=p.length,a.push(p)}),u}async realpathPromise(r){return this.realpathSync(r)}realpathSync(r){let o=this.resolveFilename(`lstat '${r}'`,r);if(!this.entries.has(o)&&!this.listings.has(o))throw ar.ENOENT(`lstat '${r}'`);return o}async existsPromise(r){return this.existsSync(r)}existsSync(r){if(!this.ready)throw ar.EBUSY(`archive closed, existsSync '${r}'`);if(this.symlinkCount===0){let a=K.resolve(Bt.root,r);return this.entries.has(a)||this.listings.has(a)}let o;try{o=this.resolveFilename(`stat '${r}'`,r,void 0,!1)}catch{return!1}return o===void 0?!1:this.entries.has(o)||this.listings.has(o)}async accessPromise(r,o){return this.accessSync(r,o)}accessSync(r,o=ta.constants.F_OK){let a=this.resolveFilename(`access '${r}'`,r);if(!this.entries.has(a)&&!this.listings.has(a))throw ar.ENOENT(`access '${r}'`);if(this.readOnly&&o&ta.constants.W_OK)throw ar.EROFS(`access '${r}'`)}async statPromise(r,o={bigint:!1}){return o.bigint?this.statSync(r,{bigint:!0}):this.statSync(r)}statSync(r,o={bigint:!1,throwIfNoEntry:!0}){let a=this.resolveFilename(`stat '${r}'`,r,void 0,o.throwIfNoEntry);if(a!==void 0){if(!this.entries.has(a)&&!this.listings.has(a)){if(o.throwIfNoEntry===!1)return;throw ar.ENOENT(`stat '${r}'`)}if(r[r.length-1]==="/"&&!this.listings.has(a))throw ar.ENOTDIR(`stat '${r}'`);return this.statImpl(`stat '${r}'`,a,o)}}async fstatPromise(r,o){return this.fstatSync(r,o)}fstatSync(r,o){let a=this.fds.get(r);if(typeof a>"u")throw ar.EBADF("fstatSync");let{p:n}=a,u=this.resolveFilename(`stat '${n}'`,n);if(!this.entries.has(u)&&!this.listings.has(u))throw ar.ENOENT(`stat '${n}'`);if(n[n.length-1]==="/"&&!this.listings.has(u))throw ar.ENOTDIR(`stat '${n}'`);return this.statImpl(`fstat '${n}'`,u,o)}async lstatPromise(r,o={bigint:!1}){return o.bigint?this.lstatSync(r,{bigint:!0}):this.lstatSync(r)}lstatSync(r,o={bigint:!1,throwIfNoEntry:!0}){let a=this.resolveFilename(`lstat '${r}'`,r,!1,o.throwIfNoEntry);if(a!==void 0){if(!this.entries.has(a)&&!this.listings.has(a)){if(o.throwIfNoEntry===!1)return;throw ar.ENOENT(`lstat '${r}'`)}if(r[r.length-1]==="/"&&!this.listings.has(a))throw ar.ENOTDIR(`lstat '${r}'`);return this.statImpl(`lstat '${r}'`,a,o)}}statImpl(r,o,a={}){let n=this.entries.get(o);if(typeof n<"u"){let u=this.libzip.struct.statS();if(this.libzip.statIndex(this.zip,n,0,0,u)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));let p=this.stats.uid,h=this.stats.gid,E=this.libzip.struct.statSize(u)>>>0,I=512,v=Math.ceil(E/I),b=(this.libzip.struct.statMtime(u)>>>0)*1e3,C=b,T=b,L=b,U=new Date(C),J=new Date(T),te=new Date(L),le=new Date(b),pe=this.listings.has(o)?ta.constants.S_IFDIR:this.isSymbolicLink(n)?ta.constants.S_IFLNK:ta.constants.S_IFREG,Ae=pe===ta.constants.S_IFDIR?493:420,ye=pe|this.getUnixMode(n,Ae)&511,ae=this.libzip.struct.statCrc(u),we=Object.assign(new Ea.StatEntry,{uid:p,gid:h,size:E,blksize:I,blocks:v,atime:U,birthtime:J,ctime:te,mtime:le,atimeMs:C,birthtimeMs:T,ctimeMs:L,mtimeMs:b,mode:ye,crc:ae});return a.bigint===!0?Ea.convertToBigIntStats(we):we}if(this.listings.has(o)){let u=this.stats.uid,A=this.stats.gid,p=0,h=512,E=0,I=this.stats.mtimeMs,v=this.stats.mtimeMs,b=this.stats.mtimeMs,C=this.stats.mtimeMs,T=new Date(I),L=new Date(v),U=new Date(b),J=new Date(C),te=ta.constants.S_IFDIR|493,le=0,pe=Object.assign(new Ea.StatEntry,{uid:u,gid:A,size:p,blksize:h,blocks:E,atime:T,birthtime:L,ctime:U,mtime:J,atimeMs:I,birthtimeMs:v,ctimeMs:b,mtimeMs:C,mode:te,crc:le});return a.bigint===!0?Ea.convertToBigIntStats(pe):pe}throw new Error("Unreachable")}getUnixMode(r,o){if(this.libzip.file.getExternalAttributes(this.zip,r,0,0,this.libzip.uint08S,this.libzip.uint32S)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));return this.libzip.getValue(this.libzip.uint08S,"i8")>>>0!==this.libzip.ZIP_OPSYS_UNIX?o:this.libzip.getValue(this.libzip.uint32S,"i32")>>>16}registerListing(r){let o=this.listings.get(r);if(o)return o;this.registerListing(K.dirname(r)).add(K.basename(r));let n=new Set;return this.listings.set(r,n),n}registerEntry(r,o){this.registerListing(K.dirname(r)).add(K.basename(r)),this.entries.set(r,o)}unregisterListing(r){this.listings.delete(r),this.listings.get(K.dirname(r))?.delete(K.basename(r))}unregisterEntry(r){this.unregisterListing(r);let o=this.entries.get(r);this.entries.delete(r),!(typeof o>"u")&&(this.fileSources.delete(o),this.isSymbolicLink(o)&&this.symlinkCount--)}deleteEntry(r,o){if(this.unregisterEntry(r),this.libzip.delete(this.zip,o)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip))}resolveFilename(r,o,a=!0,n=!0){if(!this.ready)throw ar.EBUSY(`archive closed, ${r}`);let u=K.resolve(Bt.root,o);if(u==="/")return Bt.root;let A=this.entries.get(u);if(a&&A!==void 0)if(this.symlinkCount!==0&&this.isSymbolicLink(A)){let p=this.getFileSource(A).toString();return this.resolveFilename(r,K.resolve(K.dirname(u),p),!0,n)}else return u;for(;;){let p=this.resolveFilename(r,K.dirname(u),!0,n);if(p===void 0)return p;let h=this.listings.has(p),E=this.entries.has(p);if(!h&&!E){if(n===!1)return;throw ar.ENOENT(r)}if(!h)throw ar.ENOTDIR(r);if(u=K.resolve(p,K.basename(u)),!a||this.symlinkCount===0)break;let I=this.libzip.name.locate(this.zip,u.slice(1),0);if(I===-1)break;if(this.isSymbolicLink(I)){let v=this.getFileSource(I).toString();u=K.resolve(K.dirname(u),v)}else break}return u}allocateBuffer(r){Buffer.isBuffer(r)||(r=Buffer.from(r));let o=this.libzip.malloc(r.byteLength);if(!o)throw new Error("Couldn't allocate enough memory");return new Uint8Array(this.libzip.HEAPU8.buffer,o,r.byteLength).set(r),{buffer:o,byteLength:r.byteLength}}allocateUnattachedSource(r){let o=this.libzip.struct.errorS(),{buffer:a,byteLength:n}=this.allocateBuffer(r),u=this.libzip.source.fromUnattachedBuffer(a,n,0,1,o);if(u===0)throw this.libzip.free(o),this.makeLibzipError(o);return u}allocateSource(r){let{buffer:o,byteLength:a}=this.allocateBuffer(r),n=this.libzip.source.fromBuffer(this.zip,o,a,0,1);if(n===0)throw this.libzip.free(o),this.makeLibzipError(this.libzip.getError(this.zip));return n}setFileSource(r,o){let a=Buffer.isBuffer(o)?o:Buffer.from(o),n=K.relative(Bt.root,r),u=this.allocateSource(o);try{let A=this.libzip.file.add(this.zip,n,u,this.libzip.ZIP_FL_OVERWRITE);if(A===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));if(this.level!=="mixed"){let p=this.level===0?this.libzip.ZIP_CM_STORE:this.libzip.ZIP_CM_DEFLATE;if(this.libzip.file.setCompression(this.zip,A,0,p,this.level)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip))}return this.fileSources.set(A,a),A}catch(A){throw this.libzip.source.free(u),A}}isSymbolicLink(r){if(this.symlinkCount===0)return!1;if(this.libzip.file.getExternalAttributes(this.zip,r,0,0,this.libzip.uint08S,this.libzip.uint32S)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));return this.libzip.getValue(this.libzip.uint08S,"i8")>>>0!==this.libzip.ZIP_OPSYS_UNIX?!1:(this.libzip.getValue(this.libzip.uint32S,"i32")>>>16&ta.constants.S_IFMT)===ta.constants.S_IFLNK}getFileSource(r,o={asyncDecompress:!1}){let a=this.fileSources.get(r);if(typeof a<"u")return a;let n=this.libzip.struct.statS();if(this.libzip.statIndex(this.zip,r,0,0,n)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));let A=this.libzip.struct.statCompSize(n),p=this.libzip.struct.statCompMethod(n),h=this.libzip.malloc(A);try{let E=this.libzip.fopenIndex(this.zip,r,0,this.libzip.ZIP_FL_COMPRESSED);if(E===0)throw this.makeLibzipError(this.libzip.getError(this.zip));try{let I=this.libzip.fread(E,h,A,0);if(I===-1)throw this.makeLibzipError(this.libzip.file.getError(E));if(IA)throw new Error("Overread");let v=this.libzip.HEAPU8.subarray(h,h+A),b=Buffer.from(v);if(p===0)return this.fileSources.set(r,b),b;if(o.asyncDecompress)return new Promise((C,T)=>{oU.default.inflateRaw(b,(L,U)=>{L?T(L):(this.fileSources.set(r,U),C(U))})});{let C=oU.default.inflateRawSync(b);return this.fileSources.set(r,C),C}}finally{this.libzip.fclose(E)}}finally{this.libzip.free(h)}}async fchmodPromise(r,o){return this.chmodPromise(this.fdToPath(r,"fchmod"),o)}fchmodSync(r,o){return this.chmodSync(this.fdToPath(r,"fchmodSync"),o)}async chmodPromise(r,o){return this.chmodSync(r,o)}chmodSync(r,o){if(this.readOnly)throw ar.EROFS(`chmod '${r}'`);o&=493;let a=this.resolveFilename(`chmod '${r}'`,r,!1),n=this.entries.get(a);if(typeof n>"u")throw new Error(`Assertion failed: The entry should have been registered (${a})`);let A=this.getUnixMode(n,ta.constants.S_IFREG|0)&-512|o;if(this.libzip.file.setExternalAttributes(this.zip,n,0,0,this.libzip.ZIP_OPSYS_UNIX,A<<16)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip))}async fchownPromise(r,o,a){return this.chownPromise(this.fdToPath(r,"fchown"),o,a)}fchownSync(r,o,a){return this.chownSync(this.fdToPath(r,"fchownSync"),o,a)}async chownPromise(r,o,a){return this.chownSync(r,o,a)}chownSync(r,o,a){throw new Error("Unimplemented")}async renamePromise(r,o){return this.renameSync(r,o)}renameSync(r,o){throw new Error("Unimplemented")}async copyFilePromise(r,o,a){let{indexSource:n,indexDest:u,resolvedDestP:A}=this.prepareCopyFile(r,o,a),p=await this.getFileSource(n,{asyncDecompress:!0}),h=this.setFileSource(A,p);h!==u&&this.registerEntry(A,h)}copyFileSync(r,o,a=0){let{indexSource:n,indexDest:u,resolvedDestP:A}=this.prepareCopyFile(r,o,a),p=this.getFileSource(n),h=this.setFileSource(A,p);h!==u&&this.registerEntry(A,h)}prepareCopyFile(r,o,a=0){if(this.readOnly)throw ar.EROFS(`copyfile '${r} -> '${o}'`);if((a&ta.constants.COPYFILE_FICLONE_FORCE)!==0)throw ar.ENOSYS("unsupported clone operation",`copyfile '${r}' -> ${o}'`);let n=this.resolveFilename(`copyfile '${r} -> ${o}'`,r),u=this.entries.get(n);if(typeof u>"u")throw ar.EINVAL(`copyfile '${r}' -> '${o}'`);let A=this.resolveFilename(`copyfile '${r}' -> ${o}'`,o),p=this.entries.get(A);if((a&(ta.constants.COPYFILE_EXCL|ta.constants.COPYFILE_FICLONE_FORCE))!==0&&typeof p<"u")throw ar.EEXIST(`copyfile '${r}' -> '${o}'`);return{indexSource:u,resolvedDestP:A,indexDest:p}}async appendFilePromise(r,o,a){if(this.readOnly)throw ar.EROFS(`open '${r}'`);return typeof a>"u"?a={flag:"a"}:typeof a=="string"?a={flag:"a",encoding:a}:typeof a.flag>"u"&&(a={flag:"a",...a}),this.writeFilePromise(r,o,a)}appendFileSync(r,o,a={}){if(this.readOnly)throw ar.EROFS(`open '${r}'`);return typeof a>"u"?a={flag:"a"}:typeof a=="string"?a={flag:"a",encoding:a}:typeof a.flag>"u"&&(a={flag:"a",...a}),this.writeFileSync(r,o,a)}fdToPath(r,o){let a=this.fds.get(r)?.p;if(typeof a>"u")throw ar.EBADF(o);return a}async writeFilePromise(r,o,a){let{encoding:n,mode:u,index:A,resolvedP:p}=this.prepareWriteFile(r,a);A!==void 0&&typeof a=="object"&&a.flag&&a.flag.includes("a")&&(o=Buffer.concat([await this.getFileSource(A,{asyncDecompress:!0}),Buffer.from(o)])),n!==null&&(o=o.toString(n));let h=this.setFileSource(p,o);h!==A&&this.registerEntry(p,h),u!==null&&await this.chmodPromise(p,u)}writeFileSync(r,o,a){let{encoding:n,mode:u,index:A,resolvedP:p}=this.prepareWriteFile(r,a);A!==void 0&&typeof a=="object"&&a.flag&&a.flag.includes("a")&&(o=Buffer.concat([this.getFileSource(A),Buffer.from(o)])),n!==null&&(o=o.toString(n));let h=this.setFileSource(p,o);h!==A&&this.registerEntry(p,h),u!==null&&this.chmodSync(p,u)}prepareWriteFile(r,o){if(typeof r=="number"&&(r=this.fdToPath(r,"read")),this.readOnly)throw ar.EROFS(`open '${r}'`);let a=this.resolveFilename(`open '${r}'`,r);if(this.listings.has(a))throw ar.EISDIR(`open '${r}'`);let n=null,u=null;typeof o=="string"?n=o:typeof o=="object"&&({encoding:n=null,mode:u=null}=o);let A=this.entries.get(a);return{encoding:n,mode:u,resolvedP:a,index:A}}async unlinkPromise(r){return this.unlinkSync(r)}unlinkSync(r){if(this.readOnly)throw ar.EROFS(`unlink '${r}'`);let o=this.resolveFilename(`unlink '${r}'`,r);if(this.listings.has(o))throw ar.EISDIR(`unlink '${r}'`);let a=this.entries.get(o);if(typeof a>"u")throw ar.EINVAL(`unlink '${r}'`);this.deleteEntry(o,a)}async utimesPromise(r,o,a){return this.utimesSync(r,o,a)}utimesSync(r,o,a){if(this.readOnly)throw ar.EROFS(`utimes '${r}'`);let n=this.resolveFilename(`utimes '${r}'`,r);this.utimesImpl(n,a)}async lutimesPromise(r,o,a){return this.lutimesSync(r,o,a)}lutimesSync(r,o,a){if(this.readOnly)throw ar.EROFS(`lutimes '${r}'`);let n=this.resolveFilename(`utimes '${r}'`,r,!1);this.utimesImpl(n,a)}utimesImpl(r,o){this.listings.has(r)&&(this.entries.has(r)||this.hydrateDirectory(r));let a=this.entries.get(r);if(a===void 0)throw new Error("Unreachable");if(this.libzip.file.setMtime(this.zip,a,0,pot(o),0)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip))}async mkdirPromise(r,o){return this.mkdirSync(r,o)}mkdirSync(r,{mode:o=493,recursive:a=!1}={}){if(a)return this.mkdirpSync(r,{chmod:o});if(this.readOnly)throw ar.EROFS(`mkdir '${r}'`);let n=this.resolveFilename(`mkdir '${r}'`,r);if(this.entries.has(n)||this.listings.has(n))throw ar.EEXIST(`mkdir '${r}'`);this.hydrateDirectory(n),this.chmodSync(n,o)}async rmdirPromise(r,o){return this.rmdirSync(r,o)}rmdirSync(r,{recursive:o=!1}={}){if(this.readOnly)throw ar.EROFS(`rmdir '${r}'`);if(o){this.removeSync(r);return}let a=this.resolveFilename(`rmdir '${r}'`,r),n=this.listings.get(a);if(!n)throw ar.ENOTDIR(`rmdir '${r}'`);if(n.size>0)throw ar.ENOTEMPTY(`rmdir '${r}'`);let u=this.entries.get(a);if(typeof u>"u")throw ar.EINVAL(`rmdir '${r}'`);this.deleteEntry(r,u)}hydrateDirectory(r){let o=this.libzip.dir.add(this.zip,K.relative(Bt.root,r));if(o===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));return this.registerListing(r),this.registerEntry(r,o),o}async linkPromise(r,o){return this.linkSync(r,o)}linkSync(r,o){throw ar.EOPNOTSUPP(`link '${r}' -> '${o}'`)}async symlinkPromise(r,o){return this.symlinkSync(r,o)}symlinkSync(r,o){if(this.readOnly)throw ar.EROFS(`symlink '${r}' -> '${o}'`);let a=this.resolveFilename(`symlink '${r}' -> '${o}'`,o);if(this.listings.has(a))throw ar.EISDIR(`symlink '${r}' -> '${o}'`);if(this.entries.has(a))throw ar.EEXIST(`symlink '${r}' -> '${o}'`);let n=this.setFileSource(a,r);if(this.registerEntry(a,n),this.libzip.file.setExternalAttributes(this.zip,n,0,0,this.libzip.ZIP_OPSYS_UNIX,(ta.constants.S_IFLNK|511)<<16)===-1)throw this.makeLibzipError(this.libzip.getError(this.zip));this.symlinkCount+=1}async readFilePromise(r,o){typeof o=="object"&&(o=o?o.encoding:void 0);let a=await this.readFileBuffer(r,{asyncDecompress:!0});return o?a.toString(o):a}readFileSync(r,o){typeof o=="object"&&(o=o?o.encoding:void 0);let a=this.readFileBuffer(r);return o?a.toString(o):a}readFileBuffer(r,o={asyncDecompress:!1}){typeof r=="number"&&(r=this.fdToPath(r,"read"));let a=this.resolveFilename(`open '${r}'`,r);if(!this.entries.has(a)&&!this.listings.has(a))throw ar.ENOENT(`open '${r}'`);if(r[r.length-1]==="/"&&!this.listings.has(a))throw ar.ENOTDIR(`open '${r}'`);if(this.listings.has(a))throw ar.EISDIR("read");let n=this.entries.get(a);if(n===void 0)throw new Error("Unreachable");return this.getFileSource(n,o)}async readdirPromise(r,o){return this.readdirSync(r,o)}readdirSync(r,o){let a=this.resolveFilename(`scandir '${r}'`,r);if(!this.entries.has(a)&&!this.listings.has(a))throw ar.ENOENT(`scandir '${r}'`);let n=this.listings.get(a);if(!n)throw ar.ENOTDIR(`scandir '${r}'`);if(o?.recursive)if(o?.withFileTypes){let u=Array.from(n,A=>Object.assign(this.statImpl("lstat",K.join(r,A)),{name:A,path:Bt.dot}));for(let A of u){if(!A.isDirectory())continue;let p=K.join(A.path,A.name),h=this.listings.get(K.join(a,p));for(let E of h)u.push(Object.assign(this.statImpl("lstat",K.join(r,p,E)),{name:E,path:p}))}return u}else{let u=[...n];for(let A of u){let p=this.listings.get(K.join(a,A));if(!(typeof p>"u"))for(let h of p)u.push(K.join(A,h))}return u}else return o?.withFileTypes?Array.from(n,u=>Object.assign(this.statImpl("lstat",K.join(r,u)),{name:u,path:void 0})):[...n]}async readlinkPromise(r){let o=this.prepareReadlink(r);return(await this.getFileSource(o,{asyncDecompress:!0})).toString()}readlinkSync(r){let o=this.prepareReadlink(r);return this.getFileSource(o).toString()}prepareReadlink(r){let o=this.resolveFilename(`readlink '${r}'`,r,!1);if(!this.entries.has(o)&&!this.listings.has(o))throw ar.ENOENT(`readlink '${r}'`);if(r[r.length-1]==="/"&&!this.listings.has(o))throw ar.ENOTDIR(`open '${r}'`);if(this.listings.has(o))throw ar.EINVAL(`readlink '${r}'`);let a=this.entries.get(o);if(a===void 0)throw new Error("Unreachable");if(!this.isSymbolicLink(a))throw ar.EINVAL(`readlink '${r}'`);return a}async truncatePromise(r,o=0){let a=this.resolveFilename(`open '${r}'`,r),n=this.entries.get(a);if(typeof n>"u")throw ar.EINVAL(`open '${r}'`);let u=await this.getFileSource(n,{asyncDecompress:!0}),A=Buffer.alloc(o,0);return u.copy(A),await this.writeFilePromise(r,A)}truncateSync(r,o=0){let a=this.resolveFilename(`open '${r}'`,r),n=this.entries.get(a);if(typeof n>"u")throw ar.EINVAL(`open '${r}'`);let u=this.getFileSource(n),A=Buffer.alloc(o,0);return u.copy(A),this.writeFileSync(r,A)}async ftruncatePromise(r,o){return this.truncatePromise(this.fdToPath(r,"ftruncate"),o)}ftruncateSync(r,o){return this.truncateSync(this.fdToPath(r,"ftruncateSync"),o)}watch(r,o,a){let n;switch(typeof o){case"function":case"string":case"undefined":n=!0;break;default:({persistent:n=!0}=o);break}if(!n)return{on:()=>{},close:()=>{}};let u=setInterval(()=>{},24*60*60*1e3);return{on:()=>{},close:()=>{clearInterval(u)}}}watchFile(r,o,a){let n=K.resolve(Bt.root,r);return ry(this,n,o,a)}unwatchFile(r,o){let a=K.resolve(Bt.root,r);return Mg(this,a,o)}}});function jle(t,e,r=Buffer.alloc(0),o){let a=new zi(r),n=I=>I===e||I.startsWith(`${e}/`)?I.slice(0,e.length):null,u=async(I,v)=>()=>a,A=(I,v)=>a,p={...t},h=new Rn(p),E=new _p({baseFs:h,getMountPoint:n,factoryPromise:u,factorySync:A,magicByte:21,maxAge:1/0,typeCheck:o?.typeCheck});return Ww(Hle.default,new Hp(E)),a}var Hle,qle=Et(()=>{Pt();Hle=$e(Be("fs"));aU()});var Gle=Et(()=>{Ole();aU();qle()});var x1={};Kt(x1,{DEFAULT_COMPRESSION_LEVEL:()=>_le,LibzipError:()=>Rx,ZipFS:()=>zi,ZipOpenFS:()=>Jl,getArchivePart:()=>iU,getLibzipPromise:()=>got,getLibzipSync:()=>hot,makeEmptyArchive:()=>Tx,mountMemoryDrive:()=>jle});function hot(){return S1()}async function got(){return S1()}var Yle,nA=Et(()=>{tU();Yle=$e(Rle());Mle();Gle();Tle(()=>{let t=(0,Yle.default)();return Lle(t)})});var FE,Wle=Et(()=>{Pt();qt();b1();FE=class extends nt{constructor(){super(...arguments);this.cwd=ge.String("--cwd",process.cwd(),{description:"The directory to run the command in"});this.commandName=ge.String();this.args=ge.Proxy()}async execute(){let r=this.args.length>0?`${this.commandName} ${this.args.join(" ")}`:this.commandName;return await TE(r,[],{cwd:ue.toPortablePath(this.cwd),stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})}};FE.usage={description:"run a command using yarn's portable shell",details:` + This command will run a command using Yarn's portable shell. + + Make sure to escape glob patterns, redirections, and other features that might be expanded by your own shell. + + Note: To escape something from Yarn's shell, you might have to escape it twice, the first time from your own shell. + + Note: Don't use this command in Yarn scripts, as Yarn's shell is automatically used. + + For a list of features, visit: https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-shell/README.md. + `,examples:[["Run a simple command","$0 echo Hello"],["Run a command with a glob pattern","$0 echo '*.js'"],["Run a command with a redirection","$0 echo Hello World '>' hello.txt"],["Run a command with an escaped glob pattern (The double escape is needed in Unix shells)",`$0 echo '"*.js"'`],["Run a command with a variable (Double quotes are needed in Unix shells, to prevent them from expanding the variable)",'$0 "GREETING=Hello echo $GREETING World"']]}});var al,Vle=Et(()=>{al=class extends Error{constructor(e){super(e),this.name="ShellError"}}});var Mx={};Kt(Mx,{fastGlobOptions:()=>zle,isBraceExpansion:()=>lU,isGlobPattern:()=>dot,match:()=>mot,micromatchOptions:()=>Lx});function dot(t){if(!Nx.default.scan(t,Lx).isGlob)return!1;try{Nx.default.parse(t,Lx)}catch{return!1}return!0}function mot(t,{cwd:e,baseFs:r}){return(0,Kle.default)(t,{...zle,cwd:ue.fromPortablePath(e),fs:TD(Jle.default,new Hp(r))})}function lU(t){return Nx.default.scan(t,Lx).isBrace}var Kle,Jle,Nx,Lx,zle,Xle=Et(()=>{Pt();Kle=$e(RS()),Jle=$e(Be("fs")),Nx=$e(Zo()),Lx={strictBrackets:!0},zle={onlyDirectories:!1,onlyFiles:!1}});function cU(){}function uU(){for(let t of bd)t.kill()}function tce(t,e,r,o){return a=>{let n=a[0]instanceof iA.Transform?"pipe":a[0],u=a[1]instanceof iA.Transform?"pipe":a[1],A=a[2]instanceof iA.Transform?"pipe":a[2],p=(0,$le.default)(t,e,{...o,stdio:[n,u,A]});return bd.add(p),bd.size===1&&(process.on("SIGINT",cU),process.on("SIGTERM",uU)),a[0]instanceof iA.Transform&&a[0].pipe(p.stdin),a[1]instanceof iA.Transform&&p.stdout.pipe(a[1],{end:!1}),a[2]instanceof iA.Transform&&p.stderr.pipe(a[2],{end:!1}),{stdin:p.stdin,promise:new Promise(h=>{p.on("error",E=>{switch(bd.delete(p),bd.size===0&&(process.off("SIGINT",cU),process.off("SIGTERM",uU)),E.code){case"ENOENT":a[2].write(`command not found: ${t} +`),h(127);break;case"EACCES":a[2].write(`permission denied: ${t} +`),h(128);break;default:a[2].write(`uncaught error: ${E.message} +`),h(1);break}}),p.on("close",E=>{bd.delete(p),bd.size===0&&(process.off("SIGINT",cU),process.off("SIGTERM",uU)),h(E!==null?E:129)})})}}}function rce(t){return e=>{let r=e[0]==="pipe"?new iA.PassThrough:e[0];return{stdin:r,promise:Promise.resolve().then(()=>t({stdin:r,stdout:e[1],stderr:e[2]}))}}}function Ox(t,e){return RE.start(t,e)}function Zle(t,e=null){let r=new iA.PassThrough,o=new ece.StringDecoder,a="";return r.on("data",n=>{let u=o.write(n),A;do if(A=u.indexOf(` +`),A!==-1){let p=a+u.substring(0,A);u=u.substring(A+1),a="",t(e!==null?`${e} ${p}`:p)}while(A!==-1);a+=u}),r.on("end",()=>{let n=o.end();n!==""&&t(e!==null?`${e} ${n}`:n)}),r}function nce(t,{prefix:e}){return{stdout:Zle(r=>t.stdout.write(`${r} +`),t.stdout.isTTY?e:null),stderr:Zle(r=>t.stderr.write(`${r} +`),t.stderr.isTTY?e:null)}}var $le,iA,ece,bd,zl,AU,RE,fU=Et(()=>{$le=$e(aR()),iA=Be("stream"),ece=Be("string_decoder"),bd=new Set;zl=class{constructor(e){this.stream=e}close(){}get(){return this.stream}},AU=class{constructor(){this.stream=null}close(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");this.stream.end()}attach(e){this.stream=e}get(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");return this.stream}},RE=class{constructor(e,r){this.stdin=null;this.stdout=null;this.stderr=null;this.pipe=null;this.ancestor=e,this.implementation=r}static start(e,{stdin:r,stdout:o,stderr:a}){let n=new RE(null,e);return n.stdin=r,n.stdout=o,n.stderr=a,n}pipeTo(e,r=1){let o=new RE(this,e),a=new AU;return o.pipe=a,o.stdout=this.stdout,o.stderr=this.stderr,(r&1)===1?this.stdout=a:this.ancestor!==null&&(this.stderr=this.ancestor.stdout),(r&2)===2?this.stderr=a:this.ancestor!==null&&(this.stderr=this.ancestor.stderr),o}async exec(){let e=["ignore","ignore","ignore"];if(this.pipe)e[0]="pipe";else{if(this.stdin===null)throw new Error("Assertion failed: No input stream registered");e[0]=this.stdin.get()}let r;if(this.stdout===null)throw new Error("Assertion failed: No output stream registered");r=this.stdout,e[1]=r.get();let o;if(this.stderr===null)throw new Error("Assertion failed: No error stream registered");o=this.stderr,e[2]=o.get();let a=this.implementation(e);return this.pipe&&this.pipe.attach(a.stdin),await a.promise.then(n=>(r.close(),o.close(),n))}async run(){let e=[];for(let o=this;o;o=o.ancestor)e.push(o.exec());return(await Promise.all(e))[0]}}});var T1={};Kt(T1,{EntryCommand:()=>FE,ShellError:()=>al,execute:()=>TE,globUtils:()=>Mx});function ice(t,e,r){let o=new ll.PassThrough({autoDestroy:!0});switch(t){case 0:(e&1)===1&&r.stdin.pipe(o,{end:!1}),(e&2)===2&&r.stdin instanceof ll.Writable&&o.pipe(r.stdin,{end:!1});break;case 1:(e&1)===1&&r.stdout.pipe(o,{end:!1}),(e&2)===2&&o.pipe(r.stdout,{end:!1});break;case 2:(e&1)===1&&r.stderr.pipe(o,{end:!1}),(e&2)===2&&o.pipe(r.stderr,{end:!1});break;default:throw new al(`Bad file descriptor: "${t}"`)}return o}function _x(t,e={}){let r={...t,...e};return r.environment={...t.environment,...e.environment},r.variables={...t.variables,...e.variables},r}async function Eot(t,e,r){let o=[],a=new ll.PassThrough;return a.on("data",n=>o.push(n)),await Hx(t,e,_x(r,{stdout:a})),Buffer.concat(o).toString().replace(/[\r\n]+$/,"")}async function sce(t,e,r){let o=t.map(async n=>{let u=await kd(n.args,e,r);return{name:n.name,value:u.join(" ")}});return(await Promise.all(o)).reduce((n,u)=>(n[u.name]=u.value,n),{})}function Ux(t){return t.match(/[^ \r\n\t]+/g)||[]}async function Ace(t,e,r,o,a=o){switch(t.name){case"$":o(String(process.pid));break;case"#":o(String(e.args.length));break;case"@":if(t.quoted)for(let n of e.args)a(n);else for(let n of e.args){let u=Ux(n);for(let A=0;A=0&&n"u"&&(t.defaultValue?u=(await kd(t.defaultValue,e,r)).join(" "):t.alternativeValue&&(u="")),typeof u>"u")throw A?new al(`Unbound argument #${n}`):new al(`Unbound variable "${t.name}"`);if(t.quoted)o(u);else{let p=Ux(u);for(let E=0;Eo.push(n));let a=Number(o.join(" "));return Number.isNaN(a)?k1({type:"variable",name:o.join(" ")},e,r):k1({type:"number",value:a},e,r)}else return Cot[t.type](await k1(t.left,e,r),await k1(t.right,e,r))}async function kd(t,e,r){let o=new Map,a=[],n=[],u=E=>{n.push(E)},A=()=>{n.length>0&&a.push(n.join("")),n=[]},p=E=>{u(E),A()},h=(E,I,v)=>{let b=JSON.stringify({type:E,fd:I}),C=o.get(b);typeof C>"u"&&o.set(b,C=[]),C.push(v)};for(let E of t){let I=!1;switch(E.type){case"redirection":{let v=await kd(E.args,e,r);for(let b of v)h(E.subtype,E.fd,b)}break;case"argument":for(let v of E.segments)switch(v.type){case"text":u(v.text);break;case"glob":u(v.pattern),I=!0;break;case"shell":{let b=await Eot(v.shell,e,r);if(v.quoted)u(b);else{let C=Ux(b);for(let T=0;T"u")throw new Error("Assertion failed: Expected a glob pattern to have been set");let b=await e.glob.match(v,{cwd:r.cwd,baseFs:e.baseFs});if(b.length===0){let C=lU(v)?". Note: Brace expansion of arbitrary strings isn't currently supported. For more details, please read this issue: https://github.com/yarnpkg/berry/issues/22":"";throw new al(`No matches found: "${v}"${C}`)}for(let C of b.sort())p(C)}}if(o.size>0){let E=[];for(let[I,v]of o.entries())E.splice(E.length,0,I,String(v.length),...v);a.splice(0,0,"__ysh_set_redirects",...E,"--")}return a}function Q1(t,e,r){e.builtins.has(t[0])||(t=["command",...t]);let o=ue.fromPortablePath(r.cwd),a=r.environment;typeof a.PWD<"u"&&(a={...a,PWD:o});let[n,...u]=t;if(n==="command")return tce(u[0],u.slice(1),e,{cwd:o,env:a});let A=e.builtins.get(n);if(typeof A>"u")throw new Error(`Assertion failed: A builtin should exist for "${n}"`);return rce(async({stdin:p,stdout:h,stderr:E})=>{let{stdin:I,stdout:v,stderr:b}=r;r.stdin=p,r.stdout=h,r.stderr=E;try{return await A(u,e,r)}finally{r.stdin=I,r.stdout=v,r.stderr=b}})}function wot(t,e,r){return o=>{let a=new ll.PassThrough,n=Hx(t,e,_x(r,{stdin:a}));return{stdin:a,promise:n}}}function Iot(t,e,r){return o=>{let a=new ll.PassThrough,n=Hx(t,e,r);return{stdin:a,promise:n}}}function oce(t,e,r,o){if(e.length===0)return t;{let a;do a=String(Math.random());while(Object.hasOwn(o.procedures,a));return o.procedures={...o.procedures},o.procedures[a]=t,Q1([...e,"__ysh_run_procedure",a],r,o)}}async function ace(t,e,r){let o=t,a=null,n=null;for(;o;){let u=o.then?{...r}:r,A;switch(o.type){case"command":{let p=await kd(o.args,e,r),h=await sce(o.envs,e,r);A=o.envs.length?Q1(p,e,_x(u,{environment:h})):Q1(p,e,u)}break;case"subshell":{let p=await kd(o.args,e,r),h=wot(o.subshell,e,u);A=oce(h,p,e,u)}break;case"group":{let p=await kd(o.args,e,r),h=Iot(o.group,e,u);A=oce(h,p,e,u)}break;case"envs":{let p=await sce(o.envs,e,r);u.environment={...u.environment,...p},A=Q1(["true"],e,u)}break}if(typeof A>"u")throw new Error("Assertion failed: An action should have been generated");if(a===null)n=Ox(A,{stdin:new zl(u.stdin),stdout:new zl(u.stdout),stderr:new zl(u.stderr)});else{if(n===null)throw new Error("Assertion failed: The execution pipeline should have been setup");switch(a){case"|":n=n.pipeTo(A,1);break;case"|&":n=n.pipeTo(A,3);break}}o.then?(a=o.then.type,o=o.then.chain):o=null}if(n===null)throw new Error("Assertion failed: The execution pipeline should have been setup");return await n.run()}async function Bot(t,e,r,{background:o=!1}={}){function a(n){let u=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],A=u[n%u.length];return lce.default.hex(A)}if(o){let n=r.nextBackgroundJobIndex++,u=a(n),A=`[${n}]`,p=u(A),{stdout:h,stderr:E}=nce(r,{prefix:p});return r.backgroundJobs.push(ace(t,e,_x(r,{stdout:h,stderr:E})).catch(I=>E.write(`${I.message} +`)).finally(()=>{r.stdout.isTTY&&r.stdout.write(`Job ${p}, '${u(cy(t))}' has ended +`)})),0}return await ace(t,e,r)}async function vot(t,e,r,{background:o=!1}={}){let a,n=A=>{a=A,r.variables["?"]=String(A)},u=async A=>{try{return await Bot(A.chain,e,r,{background:o&&typeof A.then>"u"})}catch(p){if(!(p instanceof al))throw p;return r.stderr.write(`${p.message} +`),1}};for(n(await u(t));t.then;){if(r.exitCode!==null)return r.exitCode;switch(t.then.type){case"&&":a===0&&n(await u(t.then.line));break;case"||":a!==0&&n(await u(t.then.line));break;default:throw new Error(`Assertion failed: Unsupported command type: "${t.then.type}"`)}t=t.then.line}return a}async function Hx(t,e,r){let o=r.backgroundJobs;r.backgroundJobs=[];let a=0;for(let{command:n,type:u}of t){if(a=await vot(n,e,r,{background:u==="&"}),r.exitCode!==null)return r.exitCode;r.variables["?"]=String(a)}return await Promise.all(r.backgroundJobs),r.backgroundJobs=o,a}function fce(t){switch(t.type){case"variable":return t.name==="@"||t.name==="#"||t.name==="*"||Number.isFinite(parseInt(t.name,10))||"defaultValue"in t&&!!t.defaultValue&&t.defaultValue.some(e=>F1(e))||"alternativeValue"in t&&!!t.alternativeValue&&t.alternativeValue.some(e=>F1(e));case"arithmetic":return pU(t.arithmetic);case"shell":return hU(t.shell);default:return!1}}function F1(t){switch(t.type){case"redirection":return t.args.some(e=>F1(e));case"argument":return t.segments.some(e=>fce(e));default:throw new Error(`Assertion failed: Unsupported argument type: "${t.type}"`)}}function pU(t){switch(t.type){case"variable":return fce(t);case"number":return!1;default:return pU(t.left)||pU(t.right)}}function hU(t){return t.some(({command:e})=>{for(;e;){let r=e.chain;for(;r;){let o;switch(r.type){case"subshell":o=hU(r.subshell);break;case"command":o=r.envs.some(a=>a.args.some(n=>F1(n)))||r.args.some(a=>F1(a));break}if(o)return!0;if(!r.then)break;r=r.then.chain}if(!e.then)break;e=e.then.line}return!1})}async function TE(t,e=[],{baseFs:r=new Rn,builtins:o={},cwd:a=ue.toPortablePath(process.cwd()),env:n=process.env,stdin:u=process.stdin,stdout:A=process.stdout,stderr:p=process.stderr,variables:h={},glob:E=Mx}={}){let I={};for(let[C,T]of Object.entries(n))typeof T<"u"&&(I[C]=T);let v=new Map(yot);for(let[C,T]of Object.entries(o))v.set(C,T);u===null&&(u=new ll.PassThrough,u.end());let b=LD(t,E);if(!hU(b)&&b.length>0&&e.length>0){let{command:C}=b[b.length-1];for(;C.then;)C=C.then.line;let T=C.chain;for(;T.then;)T=T.then.chain;T.type==="command"&&(T.args=T.args.concat(e.map(L=>({type:"argument",segments:[{type:"text",text:L}]}))))}return await Hx(b,{args:e,baseFs:r,builtins:v,initialStdin:u,initialStdout:A,initialStderr:p,glob:E},{cwd:a,environment:I,exitCode:null,procedures:{},stdin:u,stdout:A,stderr:p,variables:Object.assign({},h,{["?"]:0}),nextBackgroundJobIndex:1,backgroundJobs:[]})}var lce,cce,ll,uce,yot,Cot,b1=Et(()=>{Pt();Nl();lce=$e(vN()),cce=Be("os"),ll=Be("stream"),uce=Be("timers/promises");Wle();Vle();Xle();fU();fU();yot=new Map([["cd",async([t=(0,cce.homedir)(),...e],r,o)=>{let a=K.resolve(o.cwd,ue.toPortablePath(t));if(!(await r.baseFs.statPromise(a).catch(u=>{throw u.code==="ENOENT"?new al(`cd: no such file or directory: ${t}`):u})).isDirectory())throw new al(`cd: not a directory: ${t}`);return o.cwd=a,0}],["pwd",async(t,e,r)=>(r.stdout.write(`${ue.fromPortablePath(r.cwd)} +`),0)],[":",async(t,e,r)=>0],["true",async(t,e,r)=>0],["false",async(t,e,r)=>1],["exit",async([t,...e],r,o)=>o.exitCode=parseInt(t??o.variables["?"],10)],["echo",async(t,e,r)=>(r.stdout.write(`${t.join(" ")} +`),0)],["sleep",async([t],e,r)=>{if(typeof t>"u")throw new al("sleep: missing operand");let o=Number(t);if(Number.isNaN(o))throw new al(`sleep: invalid time interval '${t}'`);return await(0,uce.setTimeout)(1e3*o,0)}],["__ysh_run_procedure",async(t,e,r)=>{let o=r.procedures[t[0]];return await Ox(o,{stdin:new zl(r.stdin),stdout:new zl(r.stdout),stderr:new zl(r.stderr)}).run()}],["__ysh_set_redirects",async(t,e,r)=>{let o=r.stdin,a=r.stdout,n=r.stderr,u=[],A=[],p=[],h=0;for(;t[h]!=="--";){let I=t[h++],{type:v,fd:b}=JSON.parse(I),C=J=>{switch(b){case null:case 0:u.push(J);break;default:throw new Error(`Unsupported file descriptor: "${b}"`)}},T=J=>{switch(b){case null:case 1:A.push(J);break;case 2:p.push(J);break;default:throw new Error(`Unsupported file descriptor: "${b}"`)}},L=Number(t[h++]),U=h+L;for(let J=h;Je.baseFs.createReadStream(K.resolve(r.cwd,ue.toPortablePath(t[J]))));break;case"<<<":C(()=>{let te=new ll.PassThrough;return process.nextTick(()=>{te.write(`${t[J]} +`),te.end()}),te});break;case"<&":C(()=>ice(Number(t[J]),1,r));break;case">":case">>":{let te=K.resolve(r.cwd,ue.toPortablePath(t[J]));T(te==="/dev/null"?new ll.Writable({autoDestroy:!0,emitClose:!0,write(le,pe,Ae){setImmediate(Ae)}}):e.baseFs.createWriteStream(te,v===">>"?{flags:"a"}:void 0))}break;case">&":T(ice(Number(t[J]),2,r));break;default:throw new Error(`Assertion failed: Unsupported redirection type: "${v}"`)}}if(u.length>0){let I=new ll.PassThrough;o=I;let v=b=>{if(b===u.length)I.end();else{let C=u[b]();C.pipe(I,{end:!1}),C.on("end",()=>{v(b+1)})}};v(0)}if(A.length>0){let I=new ll.PassThrough;a=I;for(let v of A)I.pipe(v)}if(p.length>0){let I=new ll.PassThrough;n=I;for(let v of p)I.pipe(v)}let E=await Ox(Q1(t.slice(h+1),e,r),{stdin:new zl(o),stdout:new zl(a),stderr:new zl(n)}).run();return await Promise.all(A.map(I=>new Promise((v,b)=>{I.on("error",C=>{b(C)}),I.on("close",()=>{v()}),I.end()}))),await Promise.all(p.map(I=>new Promise((v,b)=>{I.on("error",C=>{b(C)}),I.on("close",()=>{v()}),I.end()}))),E}]]);Cot={addition:(t,e)=>t+e,subtraction:(t,e)=>t-e,multiplication:(t,e)=>t*e,division:(t,e)=>Math.trunc(t/e)}});var jx=_((n4t,pce)=>{function Dot(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r{var hce=fd(),Pot=jx(),Sot=Hl(),xot=fE(),bot=1/0,gce=hce?hce.prototype:void 0,dce=gce?gce.toString:void 0;function mce(t){if(typeof t=="string")return t;if(Sot(t))return Pot(t,mce)+"";if(xot(t))return dce?dce.call(t):"";var e=t+"";return e=="0"&&1/t==-bot?"-0":e}yce.exports=mce});var R1=_((s4t,Cce)=>{var kot=Ece();function Qot(t){return t==null?"":kot(t)}Cce.exports=Qot});var gU=_((o4t,wce)=>{function Fot(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var n=Array(a);++o{var Tot=gU();function Rot(t,e,r){var o=t.length;return r=r===void 0?o:r,!e&&r>=o?t:Tot(t,e,r)}Ice.exports=Rot});var dU=_((l4t,vce)=>{var Not="\\ud800-\\udfff",Lot="\\u0300-\\u036f",Mot="\\ufe20-\\ufe2f",Oot="\\u20d0-\\u20ff",Uot=Lot+Mot+Oot,_ot="\\ufe0e\\ufe0f",Hot="\\u200d",jot=RegExp("["+Hot+Not+Uot+_ot+"]");function qot(t){return jot.test(t)}vce.exports=qot});var Pce=_((c4t,Dce)=>{function Got(t){return t.split("")}Dce.exports=Got});var Rce=_((u4t,Tce)=>{var Sce="\\ud800-\\udfff",Yot="\\u0300-\\u036f",Wot="\\ufe20-\\ufe2f",Vot="\\u20d0-\\u20ff",Kot=Yot+Wot+Vot,Jot="\\ufe0e\\ufe0f",zot="["+Sce+"]",mU="["+Kot+"]",yU="\\ud83c[\\udffb-\\udfff]",Xot="(?:"+mU+"|"+yU+")",xce="[^"+Sce+"]",bce="(?:\\ud83c[\\udde6-\\uddff]){2}",kce="[\\ud800-\\udbff][\\udc00-\\udfff]",Zot="\\u200d",Qce=Xot+"?",Fce="["+Jot+"]?",$ot="(?:"+Zot+"(?:"+[xce,bce,kce].join("|")+")"+Fce+Qce+")*",eat=Fce+Qce+$ot,tat="(?:"+[xce+mU+"?",mU,bce,kce,zot].join("|")+")",rat=RegExp(yU+"(?="+yU+")|"+tat+eat,"g");function nat(t){return t.match(rat)||[]}Tce.exports=nat});var Lce=_((A4t,Nce)=>{var iat=Pce(),sat=dU(),oat=Rce();function aat(t){return sat(t)?oat(t):iat(t)}Nce.exports=aat});var Oce=_((f4t,Mce)=>{var lat=Bce(),cat=dU(),uat=Lce(),Aat=R1();function fat(t){return function(e){e=Aat(e);var r=cat(e)?uat(e):void 0,o=r?r[0]:e.charAt(0),a=r?lat(r,1).join(""):e.slice(1);return o[t]()+a}}Mce.exports=fat});var _ce=_((p4t,Uce)=>{var pat=Oce(),hat=pat("toUpperCase");Uce.exports=hat});var EU=_((h4t,Hce)=>{var gat=R1(),dat=_ce();function mat(t){return dat(gat(t).toLowerCase())}Hce.exports=mat});var jce=_((g4t,qx)=>{function yat(){var t=0,e=1,r=2,o=3,a=4,n=5,u=6,A=7,p=8,h=9,E=10,I=11,v=12,b=13,C=14,T=15,L=16,U=17,J=0,te=1,le=2,pe=3,Ae=4;function ye(g,Ee){return 55296<=g.charCodeAt(Ee)&&g.charCodeAt(Ee)<=56319&&56320<=g.charCodeAt(Ee+1)&&g.charCodeAt(Ee+1)<=57343}function ae(g,Ee){Ee===void 0&&(Ee=0);var De=g.charCodeAt(Ee);if(55296<=De&&De<=56319&&Ee=1){var ce=g.charCodeAt(Ee-1),ne=De;return 55296<=ce&&ce<=56319?(ce-55296)*1024+(ne-56320)+65536:ne}return De}function we(g,Ee,De){var ce=[g].concat(Ee).concat([De]),ne=ce[ce.length-2],ee=De,Ie=ce.lastIndexOf(C);if(Ie>1&&ce.slice(1,Ie).every(function(H){return H==o})&&[o,b,U].indexOf(g)==-1)return le;var ke=ce.lastIndexOf(a);if(ke>0&&ce.slice(1,ke).every(function(H){return H==a})&&[v,a].indexOf(ne)==-1)return ce.filter(function(H){return H==a}).length%2==1?pe:Ae;if(ne==t&&ee==e)return J;if(ne==r||ne==t||ne==e)return ee==C&&Ee.every(function(H){return H==o})?le:te;if(ee==r||ee==t||ee==e)return te;if(ne==u&&(ee==u||ee==A||ee==h||ee==E))return J;if((ne==h||ne==A)&&(ee==A||ee==p))return J;if((ne==E||ne==p)&&ee==p)return J;if(ee==o||ee==T)return J;if(ee==n)return J;if(ne==v)return J;var ht=ce.indexOf(o)!=-1?ce.lastIndexOf(o)-1:ce.length-2;return[b,U].indexOf(ce[ht])!=-1&&ce.slice(ht+1,-1).every(function(H){return H==o})&&ee==C||ne==T&&[L,U].indexOf(ee)!=-1?J:Ee.indexOf(a)!=-1?le:ne==a&&ee==a?J:te}this.nextBreak=function(g,Ee){if(Ee===void 0&&(Ee=0),Ee<0)return 0;if(Ee>=g.length-1)return g.length;for(var De=Pe(ae(g,Ee)),ce=[],ne=Ee+1;ne{var Eat=/^(.*?)(\x1b\[[^m]+m|\x1b\]8;;.*?(\x1b\\|\u0007))/,Gx;function Cat(){if(Gx)return Gx;if(typeof Intl.Segmenter<"u"){let t=new Intl.Segmenter("en",{granularity:"grapheme"});return Gx=e=>Array.from(t.segment(e),({segment:r})=>r)}else{let t=jce(),e=new t;return Gx=r=>e.splitGraphemes(r)}}qce.exports=(t,e=0,r=t.length)=>{if(e<0||r<0)throw new RangeError("Negative indices aren't supported by this implementation");let o=r-e,a="",n=0,u=0;for(;t.length>0;){let A=t.match(Eat)||[t,t,void 0],p=Cat()(A[1]),h=Math.min(e-n,p.length);p=p.slice(h);let E=Math.min(o-u,p.length);a+=p.slice(0,E).join(""),n+=h,u+=E,typeof A[2]<"u"&&(a+=A[2]),t=t.slice(A[0].length)}return a}});var tn,N1=Et(()=>{tn=process.env.YARN_IS_TEST_ENV?"0.0.0":"4.0.2"});function zce(t,{configuration:e,json:r}){if(!e.get("enableMessageNames"))return"";let a=Wu(t===null?0:t);return!r&&t===null?Ot(e,a,"grey"):a}function CU(t,{configuration:e,json:r}){let o=zce(t,{configuration:e,json:r});if(!o||t===null||t===0)return o;let a=wr[t],n=`https://yarnpkg.com/advanced/error-codes#${o}---${a}`.toLowerCase();return Xy(e,o,n)}async function NE({configuration:t,stdout:e,forceError:r},o){let a=await Nt.start({configuration:t,stdout:e,includeFooter:!1},async n=>{let u=!1,A=!1;for(let p of o)typeof p.option<"u"&&(p.error||r?(A=!0,n.reportError(50,p.message)):(u=!0,n.reportWarning(50,p.message)),p.callback?.());u&&!A&&n.reportSeparator()});return a.hasErrors()?a.exitCode():null}var Kce,Yx,wat,Yce,Wce,uh,Jce,Vce,Iat,Bat,Wx,vat,Nt,L1=Et(()=>{Kce=$e(Gce()),Yx=$e(ed());pP();Yl();N1();ql();wat="\xB7",Yce=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Wce=80,uh=Yx.default.GITHUB_ACTIONS?{start:t=>`::group::${t} +`,end:t=>`::endgroup:: +`}:Yx.default.TRAVIS?{start:t=>`travis_fold:start:${t} +`,end:t=>`travis_fold:end:${t} +`}:Yx.default.GITLAB?{start:t=>`section_start:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}[collapsed=true]\r\x1B[0K${t} +`,end:t=>`section_end:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}\r\x1B[0K`}:null,Jce=uh!==null,Vce=new Date,Iat=["iTerm.app","Apple_Terminal","WarpTerminal","vscode"].includes(process.env.TERM_PROGRAM)||!!process.env.WT_SESSION,Bat=t=>t,Wx=Bat({patrick:{date:[17,3],chars:["\u{1F340}","\u{1F331}"],size:40},simba:{date:[19,7],chars:["\u{1F981}","\u{1F334}"],size:40},jack:{date:[31,10],chars:["\u{1F383}","\u{1F987}"],size:40},hogsfather:{date:[31,12],chars:["\u{1F389}","\u{1F384}"],size:40},default:{chars:["=","-"],size:80}}),vat=Iat&&Object.keys(Wx).find(t=>{let e=Wx[t];return!(e.date&&(e.date[0]!==Vce.getDate()||e.date[1]!==Vce.getMonth()+1))})||"default";Nt=class extends Xs{constructor({configuration:r,stdout:o,json:a=!1,forceSectionAlignment:n=!1,includeNames:u=!0,includePrefix:A=!0,includeFooter:p=!0,includeLogs:h=!a,includeInfos:E=h,includeWarnings:I=h}){super();this.uncommitted=new Set;this.warningCount=0;this.errorCount=0;this.timerFooter=[];this.startTime=Date.now();this.indent=0;this.level=0;this.progress=new Map;this.progressTime=0;this.progressFrame=0;this.progressTimeout=null;this.progressStyle=null;this.progressMaxScaledSize=null;if(zI(this,{configuration:r}),this.configuration=r,this.forceSectionAlignment=n,this.includeNames=u,this.includePrefix=A,this.includeFooter=p,this.includeInfos=E,this.includeWarnings=I,this.json=a,this.stdout=o,r.get("enableProgressBars")&&!a&&o.isTTY&&o.columns>22){let v=r.get("progressBarStyle")||vat;if(!Object.hasOwn(Wx,v))throw new Error("Assertion failed: Invalid progress bar style");this.progressStyle=Wx[v];let b=Math.min(this.getRecommendedLength(),80);this.progressMaxScaledSize=Math.floor(this.progressStyle.size*b/80)}}static async start(r,o){let a=new this(r),n=process.emitWarning;process.emitWarning=(u,A)=>{if(typeof u!="string"){let h=u;u=h.message,A=A??h.name}let p=typeof A<"u"?`${A}: ${u}`:u;a.reportWarning(0,p)},r.includeVersion&&a.reportInfo(0,md(r.configuration,`Yarn ${tn}`,2));try{await o(a)}catch(u){a.reportExceptionOnce(u)}finally{await a.finalize(),process.emitWarning=n}return a}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}getRecommendedLength(){let o=this.progressStyle!==null?this.stdout.columns-1:super.getRecommendedLength();return Math.max(40,o-12-this.indent*2)}startSectionSync({reportHeader:r,reportFooter:o,skipIfEmpty:a},n){let u={committed:!1,action:()=>{r?.()}};a?this.uncommitted.add(u):(u.action(),u.committed=!0);let A=Date.now();try{return n()}catch(p){throw this.reportExceptionOnce(p),p}finally{let p=Date.now();this.uncommitted.delete(u),u.committed&&o?.(p-A)}}async startSectionPromise({reportHeader:r,reportFooter:o,skipIfEmpty:a},n){let u={committed:!1,action:()=>{r?.()}};a?this.uncommitted.add(u):(u.action(),u.committed=!0);let A=Date.now();try{return await n()}catch(p){throw this.reportExceptionOnce(p),p}finally{let p=Date.now();this.uncommitted.delete(u),u.committed&&o?.(p-A)}}startTimerImpl(r,o,a){return{cb:typeof o=="function"?o:a,reportHeader:()=>{this.level+=1,this.reportInfo(null,`\u250C ${r}`),this.indent+=1,uh!==null&&!this.json&&this.includeInfos&&this.stdout.write(uh.start(r))},reportFooter:A=>{if(this.indent-=1,uh!==null&&!this.json&&this.includeInfos){this.stdout.write(uh.end(r));for(let p of this.timerFooter)p()}this.configuration.get("enableTimers")&&A>200?this.reportInfo(null,`\u2514 Completed in ${Ot(this.configuration,A,yt.DURATION)}`):this.reportInfo(null,"\u2514 Completed"),this.level-=1},skipIfEmpty:(typeof o=="function"?{}:o).skipIfEmpty}}startTimerSync(r,o,a){let{cb:n,...u}=this.startTimerImpl(r,o,a);return this.startSectionSync(u,n)}async startTimerPromise(r,o,a){let{cb:n,...u}=this.startTimerImpl(r,o,a);return this.startSectionPromise(u,n)}reportSeparator(){this.indent===0?this.writeLine(""):this.reportInfo(null,"")}reportInfo(r,o){if(!this.includeInfos)return;this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"",u=`${this.formatPrefix(n,"blueBright")}${o}`;this.json?this.reportJson({type:"info",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:o}):this.writeLine(u)}reportWarning(r,o){if(this.warningCount+=1,!this.includeWarnings)return;this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"";this.json?this.reportJson({type:"warning",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:o}):this.writeLine(`${this.formatPrefix(n,"yellowBright")}${o}`)}reportError(r,o){this.errorCount+=1,this.timerFooter.push(()=>this.reportErrorImpl(r,o)),this.reportErrorImpl(r,o)}reportErrorImpl(r,o){this.commit();let a=this.formatNameWithHyperlink(r),n=a?`${a}: `:"";this.json?this.reportJson({type:"error",name:r,displayName:this.formatName(r),indent:this.formatIndent(),data:o}):this.writeLine(`${this.formatPrefix(n,"redBright")}${o}`,{truncate:!1})}reportFold(r,o){if(!uh)return;let a=`${uh.start(r)}${o}${uh.end(r)}`;this.timerFooter.push(()=>this.stdout.write(a))}reportProgress(r){if(this.progressStyle===null)return{...Promise.resolve(),stop:()=>{}};if(r.hasProgress&&r.hasTitle)throw new Error("Unimplemented: Progress bars can't have both progress and titles.");let o=!1,a=Promise.resolve().then(async()=>{let u={progress:r.hasProgress?0:void 0,title:r.hasTitle?"":void 0};this.progress.set(r,{definition:u,lastScaledSize:r.hasProgress?-1:void 0,lastTitle:void 0}),this.refreshProgress({delta:-1});for await(let{progress:A,title:p}of r)o||u.progress===A&&u.title===p||(u.progress=A,u.title=p,this.refreshProgress());n()}),n=()=>{o||(o=!0,this.progress.delete(r),this.refreshProgress({delta:1}))};return{...a,stop:n}}reportJson(r){this.json&&this.writeLine(`${JSON.stringify(r)}`)}async finalize(){if(!this.includeFooter)return;let r="";this.errorCount>0?r="Failed with errors":this.warningCount>0?r="Done with warnings":r="Done";let o=Ot(this.configuration,Date.now()-this.startTime,yt.DURATION),a=this.configuration.get("enableTimers")?`${r} in ${o}`:r;this.errorCount>0?this.reportError(0,a):this.warningCount>0?this.reportWarning(0,a):this.reportInfo(0,a)}writeLine(r,{truncate:o}={}){this.clearProgress({clear:!0}),this.stdout.write(`${this.truncate(r,{truncate:o})} +`),this.writeProgress()}writeLines(r,{truncate:o}={}){this.clearProgress({delta:r.length});for(let a of r)this.stdout.write(`${this.truncate(a,{truncate:o})} +`);this.writeProgress()}commit(){let r=this.uncommitted;this.uncommitted=new Set;for(let o of r)o.committed=!0,o.action()}clearProgress({delta:r=0,clear:o=!1}){this.progressStyle!==null&&this.progress.size+r>0&&(this.stdout.write(`\x1B[${this.progress.size+r}A`),(r>0||o)&&this.stdout.write("\x1B[0J"))}writeProgress(){if(this.progressStyle===null||(this.progressTimeout!==null&&clearTimeout(this.progressTimeout),this.progressTimeout=null,this.progress.size===0))return;let r=Date.now();r-this.progressTime>Wce&&(this.progressFrame=(this.progressFrame+1)%Yce.length,this.progressTime=r);let o=Yce[this.progressFrame];for(let a of this.progress.values()){let n="";if(typeof a.lastScaledSize<"u"){let h=this.progressStyle.chars[0].repeat(a.lastScaledSize),E=this.progressStyle.chars[1].repeat(this.progressMaxScaledSize-a.lastScaledSize);n=` ${h}${E}`}let u=this.formatName(null),A=u?`${u}: `:"",p=a.definition.title?` ${a.definition.title}`:"";this.stdout.write(`${Ot(this.configuration,"\u27A4","blueBright")} ${A}${o}${n}${p} +`)}this.progressTimeout=setTimeout(()=>{this.refreshProgress({force:!0})},Wce)}refreshProgress({delta:r=0,force:o=!1}={}){let a=!1,n=!1;if(o||this.progress.size===0)a=!0;else for(let u of this.progress.values()){let A=typeof u.definition.progress<"u"?Math.trunc(this.progressMaxScaledSize*u.definition.progress):void 0,p=u.lastScaledSize;u.lastScaledSize=A;let h=u.lastTitle;if(u.lastTitle=u.definition.title,A!==p||(n=h!==u.definition.title)){a=!0;break}}a&&(this.clearProgress({delta:r,clear:n}),this.writeProgress())}truncate(r,{truncate:o}={}){return this.progressStyle===null&&(o=!1),typeof o>"u"&&(o=this.configuration.get("preferTruncatedLines")),o&&(r=(0,Kce.default)(r,0,this.stdout.columns-1)),r}formatName(r){return this.includeNames?zce(r,{configuration:this.configuration,json:this.json}):""}formatPrefix(r,o){return this.includePrefix?`${Ot(this.configuration,"\u27A4",o)} ${r}${this.formatIndent()}`:""}formatNameWithHyperlink(r){return this.includeNames?CU(r,{configuration:this.configuration,json:this.json}):""}formatIndent(){return this.level>0||!this.forceSectionAlignment?"\u2502 ".repeat(this.indent):`${wat} `}}});var un={};Kt(un,{PackageManager:()=>$ce,detectPackageManager:()=>eue,executePackageAccessibleBinary:()=>sue,executePackageScript:()=>Vx,executePackageShellcode:()=>wU,executeWorkspaceAccessibleBinary:()=>Qat,executeWorkspaceLifecycleScript:()=>nue,executeWorkspaceScript:()=>rue,getPackageAccessibleBinaries:()=>Kx,getWorkspaceAccessibleBinaries:()=>iue,hasPackageScript:()=>xat,hasWorkspaceScript:()=>IU,isNodeScript:()=>BU,makeScriptEnv:()=>M1,maybeExecuteWorkspaceLifecycleScript:()=>kat,prepareExternalProject:()=>Sat});async function Ah(t,e,r,o=[]){if(process.platform==="win32"){let a=`@goto #_undefined_# 2>NUL || @title %COMSPEC% & @setlocal & @"${r}" ${o.map(n=>`"${n.replace('"','""')}"`).join(" ")} %*`;await oe.writeFilePromise(K.format({dir:t,name:e,ext:".cmd"}),a)}await oe.writeFilePromise(K.join(t,e),`#!/bin/sh +exec "${r}" ${o.map(a=>`'${a.replace(/'/g,`'"'"'`)}'`).join(" ")} "$@" +`,{mode:493})}async function eue(t){let e=await Mt.tryFind(t);if(e?.packageManager){let o=_S(e.packageManager);if(o?.name){let a=`found ${JSON.stringify({packageManager:e.packageManager})} in manifest`,[n]=o.reference.split(".");switch(o.name){case"yarn":return{packageManagerField:!0,packageManager:Number(n)===1?"Yarn Classic":"Yarn",reason:a};case"npm":return{packageManagerField:!0,packageManager:"npm",reason:a};case"pnpm":return{packageManagerField:!0,packageManager:"pnpm",reason:a}}}}let r;try{r=await oe.readFilePromise(K.join(t,dr.lockfile),"utf8")}catch{}return r!==void 0?r.match(/^__metadata:$/m)?{packageManager:"Yarn",reason:'"__metadata" key found in yarn.lock'}:{packageManager:"Yarn Classic",reason:'"__metadata" key not found in yarn.lock, must be a Yarn classic lockfile'}:oe.existsSync(K.join(t,"package-lock.json"))?{packageManager:"npm",reason:`found npm's "package-lock.json" lockfile`}:oe.existsSync(K.join(t,"pnpm-lock.yaml"))?{packageManager:"pnpm",reason:`found pnpm's "pnpm-lock.yaml" lockfile`}:null}async function M1({project:t,locator:e,binFolder:r,ignoreCorepack:o,lifecycleScript:a,baseEnv:n=t?.configuration.env??process.env}){let u={};for(let[E,I]of Object.entries(n))typeof I<"u"&&(u[E.toLowerCase()!=="path"?E:"PATH"]=I);let A=ue.fromPortablePath(r);u.BERRY_BIN_FOLDER=ue.fromPortablePath(A);let p=process.env.COREPACK_ROOT&&!o?ue.join(process.env.COREPACK_ROOT,"dist/yarn.js"):process.argv[1];if(await Promise.all([Ah(r,"node",process.execPath),...tn!==null?[Ah(r,"run",process.execPath,[p,"run"]),Ah(r,"yarn",process.execPath,[p]),Ah(r,"yarnpkg",process.execPath,[p]),Ah(r,"node-gyp",process.execPath,[p,"run","--top-level","node-gyp"])]:[]]),t&&(u.INIT_CWD=ue.fromPortablePath(t.configuration.startingCwd),u.PROJECT_CWD=ue.fromPortablePath(t.cwd)),u.PATH=u.PATH?`${A}${ue.delimiter}${u.PATH}`:`${A}`,u.npm_execpath=`${A}${ue.sep}yarn`,u.npm_node_execpath=`${A}${ue.sep}node`,e){if(!t)throw new Error("Assertion failed: Missing project");let E=t.tryWorkspaceByLocator(e),I=E?E.manifest.version??"":t.storedPackages.get(e.locatorHash).version??"";u.npm_package_name=fn(e),u.npm_package_version=I;let v;if(E)v=E.cwd;else{let b=t.storedPackages.get(e.locatorHash);if(!b)throw new Error(`Package for ${jr(t.configuration,e)} not found in the project`);let C=t.configuration.getLinkers(),T={project:t,report:new Nt({stdout:new fh.PassThrough,configuration:t.configuration})},L=C.find(U=>U.supportsPackage(b,T));if(!L)throw new Error(`The package ${jr(t.configuration,b)} isn't supported by any of the available linkers`);v=await L.findPackageLocation(b,T)}u.npm_package_json=ue.fromPortablePath(K.join(v,dr.manifest))}let h=tn!==null?`yarn/${tn}`:`yarn/${vf("@yarnpkg/core").version}-core`;return u.npm_config_user_agent=`${h} npm/? node/${process.version} ${process.platform} ${process.arch}`,a&&(u.npm_lifecycle_event=a),t&&await t.configuration.triggerHook(E=>E.setupScriptEnvironment,t,u,async(E,I,v)=>await Ah(r,E,I,v)),u}async function Sat(t,e,{configuration:r,report:o,workspace:a=null,locator:n=null}){await Pat(async()=>{await oe.mktempPromise(async u=>{let A=K.join(u,"pack.log"),p=null,{stdout:h,stderr:E}=r.getSubprocessStreams(A,{prefix:ue.fromPortablePath(t),report:o}),I=n&&Hc(n)?t1(n):n,v=I?xa(I):"an external project";h.write(`Packing ${v} from sources +`);let b=await eue(t),C;b!==null?(h.write(`Using ${b.packageManager} for bootstrap. Reason: ${b.reason} + +`),C=b.packageManager):(h.write(`No package manager configuration detected; defaulting to Yarn + +`),C="Yarn");let T=C==="Yarn"&&!b?.packageManagerField;await oe.mktempPromise(async L=>{let U=await M1({binFolder:L,ignoreCorepack:T}),te=new Map([["Yarn Classic",async()=>{let pe=a!==null?["workspace",a]:[],Ae=K.join(t,dr.manifest),ye=await oe.readFilePromise(Ae),ae=await Gc(process.execPath,[process.argv[1],"set","version","classic","--only-if-needed","--yarn-path"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(ae.code!==0)return ae.code;await oe.writeFilePromise(Ae,ye),await oe.appendFilePromise(K.join(t,".npmignore"),`/.yarn +`),h.write(` +`),delete U.NODE_ENV;let we=await Gc("yarn",["install"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(we.code!==0)return we.code;h.write(` +`);let Pe=await Gc("yarn",[...pe,"pack","--filename",ue.fromPortablePath(e)],{cwd:t,env:U,stdin:p,stdout:h,stderr:E});return Pe.code!==0?Pe.code:0}],["Yarn",async()=>{let pe=a!==null?["workspace",a]:[];U.YARN_ENABLE_INLINE_BUILDS="1";let Ae=K.join(t,dr.lockfile);await oe.existsPromise(Ae)||await oe.writeFilePromise(Ae,"");let ye=await Gc("yarn",[...pe,"pack","--install-if-needed","--filename",ue.fromPortablePath(e)],{cwd:t,env:U,stdin:p,stdout:h,stderr:E});return ye.code!==0?ye.code:0}],["npm",async()=>{if(a!==null){let Ee=new fh.PassThrough,De=Vy(Ee);Ee.pipe(h,{end:!1});let ce=await Gc("npm",["--version"],{cwd:t,env:U,stdin:p,stdout:Ee,stderr:E,end:0});if(Ee.end(),ce.code!==0)return h.end(),E.end(),ce.code;let ne=(await De).toString().trim();if(!bf(ne,">=7.x")){let ee=eA(null,"npm"),Ie=In(ee,ne),ke=In(ee,">=7.x");throw new Error(`Workspaces aren't supported by ${qn(r,Ie)}; please upgrade to ${qn(r,ke)} (npm has been detected as the primary package manager for ${Ot(r,t,yt.PATH)})`)}}let pe=a!==null?["--workspace",a]:[];delete U.npm_config_user_agent,delete U.npm_config_production,delete U.NPM_CONFIG_PRODUCTION,delete U.NODE_ENV;let Ae=await Gc("npm",["install","--legacy-peer-deps"],{cwd:t,env:U,stdin:p,stdout:h,stderr:E,end:1});if(Ae.code!==0)return Ae.code;let ye=new fh.PassThrough,ae=Vy(ye);ye.pipe(h);let we=await Gc("npm",["pack","--silent",...pe],{cwd:t,env:U,stdin:p,stdout:ye,stderr:E});if(we.code!==0)return we.code;let Pe=(await ae).toString().trim().replace(/^.*\n/s,""),g=K.resolve(t,ue.toPortablePath(Pe));return await oe.renamePromise(g,e),0}]]).get(C);if(typeof te>"u")throw new Error(`Assertion failed: Unsupported workflow, ${te}`);let le=await te();if(!(le===0||typeof le>"u"))throw oe.detachTemp(u),new zt(58,`Packing the package failed (exit code ${le}, logs can be found here: ${Ot(r,A,yt.PATH)})`)})})})}async function xat(t,e,{project:r}){let o=r.tryWorkspaceByLocator(t);if(o!==null)return IU(o,e);let a=r.storedPackages.get(t.locatorHash);if(!a)throw new Error(`Package for ${jr(r.configuration,t)} not found in the project`);return await Jl.openPromise(async n=>{let u=r.configuration,A=r.configuration.getLinkers(),p={project:r,report:new Nt({stdout:new fh.PassThrough,configuration:u})},h=A.find(b=>b.supportsPackage(a,p));if(!h)throw new Error(`The package ${jr(r.configuration,a)} isn't supported by any of the available linkers`);let E=await h.findPackageLocation(a,p),I=new gn(E,{baseFs:n});return(await Mt.find(Bt.dot,{baseFs:I})).scripts.has(e)})}async function Vx(t,e,r,{cwd:o,project:a,stdin:n,stdout:u,stderr:A}){return await oe.mktempPromise(async p=>{let{manifest:h,env:E,cwd:I}=await tue(t,{project:a,binFolder:p,cwd:o,lifecycleScript:e}),v=h.scripts.get(e);if(typeof v>"u")return 1;let b=async()=>await TE(v,r,{cwd:I,env:E,stdin:n,stdout:u,stderr:A});return await(await a.configuration.reduceHook(T=>T.wrapScriptExecution,b,a,t,e,{script:v,args:r,cwd:I,env:E,stdin:n,stdout:u,stderr:A}))()})}async function wU(t,e,r,{cwd:o,project:a,stdin:n,stdout:u,stderr:A}){return await oe.mktempPromise(async p=>{let{env:h,cwd:E}=await tue(t,{project:a,binFolder:p,cwd:o});return await TE(e,r,{cwd:E,env:h,stdin:n,stdout:u,stderr:A})})}async function bat(t,{binFolder:e,cwd:r,lifecycleScript:o}){let a=await M1({project:t.project,locator:t.anchoredLocator,binFolder:e,lifecycleScript:o});return await vU(e,await iue(t)),typeof r>"u"&&(r=K.dirname(await oe.realpathPromise(K.join(t.cwd,"package.json")))),{manifest:t.manifest,binFolder:e,env:a,cwd:r}}async function tue(t,{project:e,binFolder:r,cwd:o,lifecycleScript:a}){let n=e.tryWorkspaceByLocator(t);if(n!==null)return bat(n,{binFolder:r,cwd:o,lifecycleScript:a});let u=e.storedPackages.get(t.locatorHash);if(!u)throw new Error(`Package for ${jr(e.configuration,t)} not found in the project`);return await Jl.openPromise(async A=>{let p=e.configuration,h=e.configuration.getLinkers(),E={project:e,report:new Nt({stdout:new fh.PassThrough,configuration:p})},I=h.find(L=>L.supportsPackage(u,E));if(!I)throw new Error(`The package ${jr(e.configuration,u)} isn't supported by any of the available linkers`);let v=await M1({project:e,locator:t,binFolder:r,lifecycleScript:a});await vU(r,await Kx(t,{project:e}));let b=await I.findPackageLocation(u,E),C=new gn(b,{baseFs:A}),T=await Mt.find(Bt.dot,{baseFs:C});return typeof o>"u"&&(o=b),{manifest:T,binFolder:r,env:v,cwd:o}})}async function rue(t,e,r,{cwd:o,stdin:a,stdout:n,stderr:u}){return await Vx(t.anchoredLocator,e,r,{cwd:o,project:t.project,stdin:a,stdout:n,stderr:u})}function IU(t,e){return t.manifest.scripts.has(e)}async function nue(t,e,{cwd:r,report:o}){let{configuration:a}=t.project,n=null;await oe.mktempPromise(async u=>{let A=K.join(u,`${e}.log`),p=`# This file contains the result of Yarn calling the "${e}" lifecycle script inside a workspace ("${ue.fromPortablePath(t.cwd)}") +`,{stdout:h,stderr:E}=a.getSubprocessStreams(A,{report:o,prefix:jr(a,t.anchoredLocator),header:p});o.reportInfo(36,`Calling the "${e}" lifecycle script`);let I=await rue(t,e,[],{cwd:r,stdin:n,stdout:h,stderr:E});if(h.end(),E.end(),I!==0)throw oe.detachTemp(u),new zt(36,`${(0,Xce.default)(e)} script failed (exit code ${Ot(a,I,yt.NUMBER)}, logs can be found here: ${Ot(a,A,yt.PATH)}); run ${Ot(a,`yarn ${e}`,yt.CODE)} to investigate`)})}async function kat(t,e,r){IU(t,e)&&await nue(t,e,r)}function BU(t){let e=K.extname(t);if(e.match(/\.[cm]?[jt]sx?$/))return!0;if(e===".exe"||e===".bin")return!1;let r=Buffer.alloc(4),o;try{o=oe.openSync(t,"r")}catch{return!0}try{oe.readSync(o,r,0,r.length,0)}finally{oe.closeSync(o)}let a=r.readUint32BE();return!(a===3405691582||a===3489328638||a===2135247942||(a&4294901760)===1297743872)}async function Kx(t,{project:e}){let r=e.configuration,o=new Map,a=e.storedPackages.get(t.locatorHash);if(!a)throw new Error(`Package for ${jr(r,t)} not found in the project`);let n=new fh.Writable,u=r.getLinkers(),A={project:e,report:new Nt({configuration:r,stdout:n})},p=new Set([t.locatorHash]);for(let E of a.dependencies.values()){let I=e.storedResolutions.get(E.descriptorHash);if(!I)throw new Error(`Assertion failed: The resolution (${qn(r,E)}) should have been registered`);p.add(I)}let h=await Promise.all(Array.from(p,async E=>{let I=e.storedPackages.get(E);if(!I)throw new Error(`Assertion failed: The package (${E}) should have been registered`);if(I.bin.size===0)return sl.skip;let v=u.find(C=>C.supportsPackage(I,A));if(!v)return sl.skip;let b=null;try{b=await v.findPackageLocation(I,A)}catch(C){if(C.code==="LOCATOR_NOT_INSTALLED")return sl.skip;throw C}return{dependency:I,packageLocation:b}}));for(let E of h){if(E===sl.skip)continue;let{dependency:I,packageLocation:v}=E;for(let[b,C]of I.bin){let T=K.resolve(v,C);o.set(b,[I,ue.fromPortablePath(T),BU(T)])}}return o}async function iue(t){return await Kx(t.anchoredLocator,{project:t.project})}async function vU(t,e){await Promise.all(Array.from(e,([r,[,o,a]])=>a?Ah(t,r,process.execPath,[o]):Ah(t,r,o,[])))}async function sue(t,e,r,{cwd:o,project:a,stdin:n,stdout:u,stderr:A,nodeArgs:p=[],packageAccessibleBinaries:h}){h??=await Kx(t,{project:a});let E=h.get(e);if(!E)throw new Error(`Binary not found (${e}) for ${jr(a.configuration,t)}`);return await oe.mktempPromise(async I=>{let[,v]=E,b=await M1({project:a,locator:t,binFolder:I});await vU(b.BERRY_BIN_FOLDER,h);let C=BU(ue.toPortablePath(v))?Gc(process.execPath,[...p,v,...r],{cwd:o,env:b,stdin:n,stdout:u,stderr:A}):Gc(v,r,{cwd:o,env:b,stdin:n,stdout:u,stderr:A}),T;try{T=await C}finally{await oe.removePromise(b.BERRY_BIN_FOLDER)}return T.code})}async function Qat(t,e,r,{cwd:o,stdin:a,stdout:n,stderr:u,packageAccessibleBinaries:A}){return await sue(t.anchoredLocator,e,r,{project:t.project,cwd:o,stdin:a,stdout:n,stderr:u,packageAccessibleBinaries:A})}var Xce,Zce,fh,$ce,Dat,Pat,DU=Et(()=>{Pt();Pt();nA();b1();Xce=$e(EU()),Zce=$e(nd()),fh=Be("stream");AE();Yl();L1();N1();Px();ql();jl();kf();xo();$ce=(a=>(a.Yarn1="Yarn Classic",a.Yarn2="Yarn",a.Npm="npm",a.Pnpm="pnpm",a))($ce||{});Dat=2,Pat=(0,Zce.default)(Dat)});var LE=_((M4t,aue)=>{"use strict";var oue=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"]]);aue.exports=t=>t?Object.keys(t).map(e=>[oue.has(e)?oue.get(e):e,t[e]]).reduce((e,r)=>(e[r[0]]=r[1],e),Object.create(null)):{}});var OE=_((O4t,due)=>{"use strict";var lue=typeof process=="object"&&process?process:{stdout:null,stderr:null},Fat=Be("events"),cue=Be("stream"),uue=Be("string_decoder").StringDecoder,Mf=Symbol("EOF"),Of=Symbol("maybeEmitEnd"),ph=Symbol("emittedEnd"),Jx=Symbol("emittingEnd"),O1=Symbol("emittedError"),zx=Symbol("closed"),Aue=Symbol("read"),Xx=Symbol("flush"),fue=Symbol("flushChunk"),ka=Symbol("encoding"),Uf=Symbol("decoder"),Zx=Symbol("flowing"),U1=Symbol("paused"),ME=Symbol("resume"),Fs=Symbol("bufferLength"),PU=Symbol("bufferPush"),SU=Symbol("bufferShift"),Fo=Symbol("objectMode"),To=Symbol("destroyed"),xU=Symbol("emitData"),pue=Symbol("emitEnd"),bU=Symbol("emitEnd2"),_f=Symbol("async"),_1=t=>Promise.resolve().then(t),hue=global._MP_NO_ITERATOR_SYMBOLS_!=="1",Tat=hue&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),Rat=hue&&Symbol.iterator||Symbol("iterator not implemented"),Nat=t=>t==="end"||t==="finish"||t==="prefinish",Lat=t=>t instanceof ArrayBuffer||typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,Mat=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),$x=class{constructor(e,r,o){this.src=e,this.dest=r,this.opts=o,this.ondrain=()=>e[ME](),r.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},kU=class extends $x{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,o){super(e,r,o),this.proxyErrors=a=>r.emit("error",a),e.on("error",this.proxyErrors)}};due.exports=class gue extends cue{constructor(e){super(),this[Zx]=!1,this[U1]=!1,this.pipes=[],this.buffer=[],this[Fo]=e&&e.objectMode||!1,this[Fo]?this[ka]=null:this[ka]=e&&e.encoding||null,this[ka]==="buffer"&&(this[ka]=null),this[_f]=e&&!!e.async||!1,this[Uf]=this[ka]?new uue(this[ka]):null,this[Mf]=!1,this[ph]=!1,this[Jx]=!1,this[zx]=!1,this[O1]=null,this.writable=!0,this.readable=!0,this[Fs]=0,this[To]=!1}get bufferLength(){return this[Fs]}get encoding(){return this[ka]}set encoding(e){if(this[Fo])throw new Error("cannot set encoding in objectMode");if(this[ka]&&e!==this[ka]&&(this[Uf]&&this[Uf].lastNeed||this[Fs]))throw new Error("cannot change encoding");this[ka]!==e&&(this[Uf]=e?new uue(e):null,this.buffer.length&&(this.buffer=this.buffer.map(r=>this[Uf].write(r)))),this[ka]=e}setEncoding(e){this.encoding=e}get objectMode(){return this[Fo]}set objectMode(e){this[Fo]=this[Fo]||!!e}get async(){return this[_f]}set async(e){this[_f]=this[_f]||!!e}write(e,r,o){if(this[Mf])throw new Error("write after end");if(this[To])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(o=r,r="utf8"),r||(r="utf8");let a=this[_f]?_1:n=>n();return!this[Fo]&&!Buffer.isBuffer(e)&&(Mat(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):Lat(e)?e=Buffer.from(e):typeof e!="string"&&(this.objectMode=!0)),this[Fo]?(this.flowing&&this[Fs]!==0&&this[Xx](!0),this.flowing?this.emit("data",e):this[PU](e),this[Fs]!==0&&this.emit("readable"),o&&a(o),this.flowing):e.length?(typeof e=="string"&&!(r===this[ka]&&!this[Uf].lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[ka]&&(e=this[Uf].write(e)),this.flowing&&this[Fs]!==0&&this[Xx](!0),this.flowing?this.emit("data",e):this[PU](e),this[Fs]!==0&&this.emit("readable"),o&&a(o),this.flowing):(this[Fs]!==0&&this.emit("readable"),o&&a(o),this.flowing)}read(e){if(this[To])return null;if(this[Fs]===0||e===0||e>this[Fs])return this[Of](),null;this[Fo]&&(e=null),this.buffer.length>1&&!this[Fo]&&(this.encoding?this.buffer=[this.buffer.join("")]:this.buffer=[Buffer.concat(this.buffer,this[Fs])]);let r=this[Aue](e||null,this.buffer[0]);return this[Of](),r}[Aue](e,r){return e===r.length||e===null?this[SU]():(this.buffer[0]=r.slice(e),r=r.slice(0,e),this[Fs]-=e),this.emit("data",r),!this.buffer.length&&!this[Mf]&&this.emit("drain"),r}end(e,r,o){return typeof e=="function"&&(o=e,e=null),typeof r=="function"&&(o=r,r="utf8"),e&&this.write(e,r),o&&this.once("end",o),this[Mf]=!0,this.writable=!1,(this.flowing||!this[U1])&&this[Of](),this}[ME](){this[To]||(this[U1]=!1,this[Zx]=!0,this.emit("resume"),this.buffer.length?this[Xx]():this[Mf]?this[Of]():this.emit("drain"))}resume(){return this[ME]()}pause(){this[Zx]=!1,this[U1]=!0}get destroyed(){return this[To]}get flowing(){return this[Zx]}get paused(){return this[U1]}[PU](e){this[Fo]?this[Fs]+=1:this[Fs]+=e.length,this.buffer.push(e)}[SU](){return this.buffer.length&&(this[Fo]?this[Fs]-=1:this[Fs]-=this.buffer[0].length),this.buffer.shift()}[Xx](e){do;while(this[fue](this[SU]()));!e&&!this.buffer.length&&!this[Mf]&&this.emit("drain")}[fue](e){return e?(this.emit("data",e),this.flowing):!1}pipe(e,r){if(this[To])return;let o=this[ph];return r=r||{},e===lue.stdout||e===lue.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,o?r.end&&e.end():(this.pipes.push(r.proxyErrors?new kU(this,e,r):new $x(this,e,r)),this[_f]?_1(()=>this[ME]()):this[ME]()),e}unpipe(e){let r=this.pipes.find(o=>o.dest===e);r&&(this.pipes.splice(this.pipes.indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let o=super.on(e,r);return e==="data"&&!this.pipes.length&&!this.flowing?this[ME]():e==="readable"&&this[Fs]!==0?super.emit("readable"):Nat(e)&&this[ph]?(super.emit(e),this.removeAllListeners(e)):e==="error"&&this[O1]&&(this[_f]?_1(()=>r.call(this,this[O1])):r.call(this,this[O1])),o}get emittedEnd(){return this[ph]}[Of](){!this[Jx]&&!this[ph]&&!this[To]&&this.buffer.length===0&&this[Mf]&&(this[Jx]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[zx]&&this.emit("close"),this[Jx]=!1)}emit(e,r,...o){if(e!=="error"&&e!=="close"&&e!==To&&this[To])return;if(e==="data")return r?this[_f]?_1(()=>this[xU](r)):this[xU](r):!1;if(e==="end")return this[pue]();if(e==="close"){if(this[zx]=!0,!this[ph]&&!this[To])return;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[O1]=r;let n=super.emit("error",r);return this[Of](),n}else if(e==="resume"){let n=super.emit("resume");return this[Of](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let a=super.emit(e,r,...o);return this[Of](),a}[xU](e){for(let o of this.pipes)o.dest.write(e)===!1&&this.pause();let r=super.emit("data",e);return this[Of](),r}[pue](){this[ph]||(this[ph]=!0,this.readable=!1,this[_f]?_1(()=>this[bU]()):this[bU]())}[bU](){if(this[Uf]){let r=this[Uf].end();if(r){for(let o of this.pipes)o.dest.write(r);super.emit("data",r)}}for(let r of this.pipes)r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}collect(){let e=[];this[Fo]||(e.dataLength=0);let r=this.promise();return this.on("data",o=>{e.push(o),this[Fo]||(e.dataLength+=o.length)}),r.then(()=>e)}concat(){return this[Fo]?Promise.reject(new Error("cannot concat in objectMode")):this.collect().then(e=>this[Fo]?Promise.reject(new Error("cannot concat in objectMode")):this[ka]?e.join(""):Buffer.concat(e,e.dataLength))}promise(){return new Promise((e,r)=>{this.on(To,()=>r(new Error("stream destroyed"))),this.on("error",o=>r(o)),this.on("end",()=>e())})}[Tat](){return{next:()=>{let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Mf])return Promise.resolve({done:!0});let o=null,a=null,n=h=>{this.removeListener("data",u),this.removeListener("end",A),a(h)},u=h=>{this.removeListener("error",n),this.removeListener("end",A),this.pause(),o({value:h,done:!!this[Mf]})},A=()=>{this.removeListener("error",n),this.removeListener("data",u),o({done:!0})},p=()=>n(new Error("stream destroyed"));return new Promise((h,E)=>{a=E,o=h,this.once(To,p),this.once("error",n),this.once("end",A),this.once("data",u)})}}}[Rat](){return{next:()=>{let r=this.read();return{value:r,done:r===null}}}}destroy(e){return this[To]?(e?this.emit("error",e):this.emit(To),this):(this[To]=!0,this.buffer.length=0,this[Fs]=0,typeof this.close=="function"&&!this[zx]&&this.close(),e?this.emit("error",e):this.emit(To),this)}static isStream(e){return!!e&&(e instanceof gue||e instanceof cue||e instanceof Fat&&(typeof e.pipe=="function"||typeof e.write=="function"&&typeof e.end=="function"))}}});var yue=_((U4t,mue)=>{var Oat=Be("zlib").constants||{ZLIB_VERNUM:4736};mue.exports=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Oat))});var WU=_(cl=>{"use strict";var NU=Be("assert"),hh=Be("buffer").Buffer,wue=Be("zlib"),Qd=cl.constants=yue(),Uat=OE(),Eue=hh.concat,Fd=Symbol("_superWrite"),_E=class extends Error{constructor(e){super("zlib: "+e.message),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}},_at=Symbol("opts"),H1=Symbol("flushFlag"),Cue=Symbol("finishFlushFlag"),YU=Symbol("fullFlushFlag"),ti=Symbol("handle"),eb=Symbol("onError"),UE=Symbol("sawError"),QU=Symbol("level"),FU=Symbol("strategy"),TU=Symbol("ended"),_4t=Symbol("_defaultFullFlush"),tb=class extends Uat{constructor(e,r){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");super(e),this[UE]=!1,this[TU]=!1,this[_at]=e,this[H1]=e.flush,this[Cue]=e.finishFlush;try{this[ti]=new wue[r](e)}catch(o){throw new _E(o)}this[eb]=o=>{this[UE]||(this[UE]=!0,this.close(),this.emit("error",o))},this[ti].on("error",o=>this[eb](new _E(o))),this.once("end",()=>this.close)}close(){this[ti]&&(this[ti].close(),this[ti]=null,this.emit("close"))}reset(){if(!this[UE])return NU(this[ti],"zlib binding closed"),this[ti].reset()}flush(e){this.ended||(typeof e!="number"&&(e=this[YU]),this.write(Object.assign(hh.alloc(0),{[H1]:e})))}end(e,r,o){return e&&this.write(e,r),this.flush(this[Cue]),this[TU]=!0,super.end(null,null,o)}get ended(){return this[TU]}write(e,r,o){if(typeof r=="function"&&(o=r,r="utf8"),typeof e=="string"&&(e=hh.from(e,r)),this[UE])return;NU(this[ti],"zlib binding closed");let a=this[ti]._handle,n=a.close;a.close=()=>{};let u=this[ti].close;this[ti].close=()=>{},hh.concat=h=>h;let A;try{let h=typeof e[H1]=="number"?e[H1]:this[H1];A=this[ti]._processChunk(e,h),hh.concat=Eue}catch(h){hh.concat=Eue,this[eb](new _E(h))}finally{this[ti]&&(this[ti]._handle=a,a.close=n,this[ti].close=u,this[ti].removeAllListeners("error"))}this[ti]&&this[ti].on("error",h=>this[eb](new _E(h)));let p;if(A)if(Array.isArray(A)&&A.length>0){p=this[Fd](hh.from(A[0]));for(let h=1;h{this.flush(a),n()};try{this[ti].params(e,r)}finally{this[ti].flush=o}this[ti]&&(this[QU]=e,this[FU]=r)}}}},LU=class extends Hf{constructor(e){super(e,"Deflate")}},MU=class extends Hf{constructor(e){super(e,"Inflate")}},RU=Symbol("_portable"),OU=class extends Hf{constructor(e){super(e,"Gzip"),this[RU]=e&&!!e.portable}[Fd](e){return this[RU]?(this[RU]=!1,e[9]=255,super[Fd](e)):super[Fd](e)}},UU=class extends Hf{constructor(e){super(e,"Gunzip")}},_U=class extends Hf{constructor(e){super(e,"DeflateRaw")}},HU=class extends Hf{constructor(e){super(e,"InflateRaw")}},jU=class extends Hf{constructor(e){super(e,"Unzip")}},rb=class extends tb{constructor(e,r){e=e||{},e.flush=e.flush||Qd.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||Qd.BROTLI_OPERATION_FINISH,super(e,r),this[YU]=Qd.BROTLI_OPERATION_FLUSH}},qU=class extends rb{constructor(e){super(e,"BrotliCompress")}},GU=class extends rb{constructor(e){super(e,"BrotliDecompress")}};cl.Deflate=LU;cl.Inflate=MU;cl.Gzip=OU;cl.Gunzip=UU;cl.DeflateRaw=_U;cl.InflateRaw=HU;cl.Unzip=jU;typeof wue.BrotliCompress=="function"?(cl.BrotliCompress=qU,cl.BrotliDecompress=GU):cl.BrotliCompress=cl.BrotliDecompress=class{constructor(){throw new Error("Brotli is not supported in this version of Node.js")}}});var HE=_((q4t,Iue)=>{var Hat=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;Iue.exports=Hat!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/")});var nb=_((Y4t,Bue)=>{"use strict";var jat=OE(),VU=HE(),KU=Symbol("slurp");Bue.exports=class extends jat{constructor(e,r,o){switch(super(),this.pause(),this.extended=r,this.globalExtended=o,this.header=e,this.startBlockSize=512*Math.ceil(e.size/512),this.blockRemain=this.startBlockSize,this.remain=e.size,this.type=e.type,this.meta=!1,this.ignore=!1,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}this.path=VU(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=e.size,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=VU(e.linkpath),this.uname=e.uname,this.gname=e.gname,r&&this[KU](r),o&&this[KU](o,!0)}write(e){let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");let o=this.remain,a=this.blockRemain;return this.remain=Math.max(0,o-r),this.blockRemain=Math.max(0,a-r),this.ignore?!0:o>=r?super.write(e):super.write(e.slice(0,o))}[KU](e,r){for(let o in e)e[o]!==null&&e[o]!==void 0&&!(r&&o==="path")&&(this[o]=o==="path"||o==="linkpath"?VU(e[o]):e[o])}}});var JU=_(ib=>{"use strict";ib.name=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]);ib.code=new Map(Array.from(ib.name).map(t=>[t[1],t[0]]))});var Sue=_((V4t,Pue)=>{"use strict";var qat=(t,e)=>{if(Number.isSafeInteger(t))t<0?Yat(t,e):Gat(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Gat=(t,e)=>{e[0]=128;for(var r=e.length;r>1;r--)e[r-1]=t&255,t=Math.floor(t/256)},Yat=(t,e)=>{e[0]=255;var r=!1;t=t*-1;for(var o=e.length;o>1;o--){var a=t&255;t=Math.floor(t/256),r?e[o-1]=vue(a):a===0?e[o-1]=0:(r=!0,e[o-1]=Due(a))}},Wat=t=>{let e=t[0],r=e===128?Kat(t.slice(1,t.length)):e===255?Vat(t):null;if(r===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(r))throw Error("parsed number outside of javascript safe integer range");return r},Vat=t=>{for(var e=t.length,r=0,o=!1,a=e-1;a>-1;a--){var n=t[a],u;o?u=vue(n):n===0?u=n:(o=!0,u=Due(n)),u!==0&&(r-=u*Math.pow(256,e-a-1))}return r},Kat=t=>{for(var e=t.length,r=0,o=e-1;o>-1;o--){var a=t[o];a!==0&&(r+=a*Math.pow(256,e-o-1))}return r},vue=t=>(255^t)&255,Due=t=>(255^t)+1&255;Pue.exports={encode:qat,parse:Wat}});var qE=_((K4t,bue)=>{"use strict";var zU=JU(),jE=Be("path").posix,xue=Sue(),XU=Symbol("slurp"),ul=Symbol("type"),e3=class{constructor(e,r,o,a){this.cksumValid=!1,this.needPax=!1,this.nullBlock=!1,this.block=null,this.path=null,this.mode=null,this.uid=null,this.gid=null,this.size=null,this.mtime=null,this.cksum=null,this[ul]="0",this.linkpath=null,this.uname=null,this.gname=null,this.devmaj=0,this.devmin=0,this.atime=null,this.ctime=null,Buffer.isBuffer(e)?this.decode(e,r||0,o,a):e&&this.set(e)}decode(e,r,o,a){if(r||(r=0),!e||!(e.length>=r+512))throw new Error("need 512 bytes for header");if(this.path=Td(e,r,100),this.mode=gh(e,r+100,8),this.uid=gh(e,r+108,8),this.gid=gh(e,r+116,8),this.size=gh(e,r+124,12),this.mtime=ZU(e,r+136,12),this.cksum=gh(e,r+148,12),this[XU](o),this[XU](a,!0),this[ul]=Td(e,r+156,1),this[ul]===""&&(this[ul]="0"),this[ul]==="0"&&this.path.substr(-1)==="/"&&(this[ul]="5"),this[ul]==="5"&&(this.size=0),this.linkpath=Td(e,r+157,100),e.slice(r+257,r+265).toString()==="ustar\x0000")if(this.uname=Td(e,r+265,32),this.gname=Td(e,r+297,32),this.devmaj=gh(e,r+329,8),this.devmin=gh(e,r+337,8),e[r+475]!==0){let u=Td(e,r+345,155);this.path=u+"/"+this.path}else{let u=Td(e,r+345,130);u&&(this.path=u+"/"+this.path),this.atime=ZU(e,r+476,12),this.ctime=ZU(e,r+488,12)}let n=8*32;for(let u=r;u=r+512))throw new Error("need 512 bytes for header");let o=this.ctime||this.atime?130:155,a=Jat(this.path||"",o),n=a[0],u=a[1];this.needPax=a[2],this.needPax=Rd(e,r,100,n)||this.needPax,this.needPax=dh(e,r+100,8,this.mode)||this.needPax,this.needPax=dh(e,r+108,8,this.uid)||this.needPax,this.needPax=dh(e,r+116,8,this.gid)||this.needPax,this.needPax=dh(e,r+124,12,this.size)||this.needPax,this.needPax=$U(e,r+136,12,this.mtime)||this.needPax,e[r+156]=this[ul].charCodeAt(0),this.needPax=Rd(e,r+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",r+257,8),this.needPax=Rd(e,r+265,32,this.uname)||this.needPax,this.needPax=Rd(e,r+297,32,this.gname)||this.needPax,this.needPax=dh(e,r+329,8,this.devmaj)||this.needPax,this.needPax=dh(e,r+337,8,this.devmin)||this.needPax,this.needPax=Rd(e,r+345,o,u)||this.needPax,e[r+475]!==0?this.needPax=Rd(e,r+345,155,u)||this.needPax:(this.needPax=Rd(e,r+345,130,u)||this.needPax,this.needPax=$U(e,r+476,12,this.atime)||this.needPax,this.needPax=$U(e,r+488,12,this.ctime)||this.needPax);let A=8*32;for(let p=r;p{let o=t,a="",n,u=jE.parse(t).root||".";if(Buffer.byteLength(o)<100)n=[o,a,!1];else{a=jE.dirname(o),o=jE.basename(o);do Buffer.byteLength(o)<=100&&Buffer.byteLength(a)<=e?n=[o,a,!1]:Buffer.byteLength(o)>100&&Buffer.byteLength(a)<=e?n=[o.substr(0,100-1),a,!0]:(o=jE.join(jE.basename(a),o),a=jE.dirname(a));while(a!==u&&!n);n||(n=[t.substr(0,100-1),"",!0])}return n},Td=(t,e,r)=>t.slice(e,e+r).toString("utf8").replace(/\0.*/,""),ZU=(t,e,r)=>zat(gh(t,e,r)),zat=t=>t===null?null:new Date(t*1e3),gh=(t,e,r)=>t[e]&128?xue.parse(t.slice(e,e+r)):Zat(t,e,r),Xat=t=>isNaN(t)?null:t,Zat=(t,e,r)=>Xat(parseInt(t.slice(e,e+r).toString("utf8").replace(/\0.*$/,"").trim(),8)),$at={12:8589934591,8:2097151},dh=(t,e,r,o)=>o===null?!1:o>$at[r]||o<0?(xue.encode(o,t.slice(e,e+r)),!0):(elt(t,e,r,o),!1),elt=(t,e,r,o)=>t.write(tlt(o,r),e,r,"ascii"),tlt=(t,e)=>rlt(Math.floor(t).toString(8),e),rlt=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",$U=(t,e,r,o)=>o===null?!1:dh(t,e,r,o.getTime()/1e3),nlt=new Array(156).join("\0"),Rd=(t,e,r,o)=>o===null?!1:(t.write(o+nlt,e,r,"utf8"),o.length!==Buffer.byteLength(o)||o.length>r);bue.exports=e3});var sb=_((J4t,kue)=>{"use strict";var ilt=qE(),slt=Be("path"),j1=class{constructor(e,r){this.atime=e.atime||null,this.charset=e.charset||null,this.comment=e.comment||null,this.ctime=e.ctime||null,this.gid=e.gid||null,this.gname=e.gname||null,this.linkpath=e.linkpath||null,this.mtime=e.mtime||null,this.path=e.path||null,this.size=e.size||null,this.uid=e.uid||null,this.uname=e.uname||null,this.dev=e.dev||null,this.ino=e.ino||null,this.nlink=e.nlink||null,this.global=r||!1}encode(){let e=this.encodeBody();if(e==="")return null;let r=Buffer.byteLength(e),o=512*Math.ceil(1+r/512),a=Buffer.allocUnsafe(o);for(let n=0;n<512;n++)a[n]=0;new ilt({path:("PaxHeader/"+slt.basename(this.path)).slice(0,99),mode:this.mode||420,uid:this.uid||null,gid:this.gid||null,size:r,mtime:this.mtime||null,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime||null,ctime:this.ctime||null}).encode(a),a.write(e,512,r,"utf8");for(let n=r+512;n=Math.pow(10,n)&&(n+=1),n+a+o}};j1.parse=(t,e,r)=>new j1(olt(alt(t),e),r);var olt=(t,e)=>e?Object.keys(t).reduce((r,o)=>(r[o]=t[o],r),e):t,alt=t=>t.replace(/\n$/,"").split(` +`).reduce(llt,Object.create(null)),llt=(t,e)=>{let r=parseInt(e,10);if(r!==Buffer.byteLength(e)+1)return t;e=e.substr((r+" ").length);let o=e.split("="),a=o.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!a)return t;let n=o.join("=");return t[a]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(a)?new Date(n*1e3):/^[0-9]+$/.test(n)?+n:n,t};kue.exports=j1});var GE=_((z4t,Que)=>{Que.exports=t=>{let e=t.length-1,r=-1;for(;e>-1&&t.charAt(e)==="/";)r=e,e--;return r===-1?t:t.slice(0,r)}});var ob=_((X4t,Fue)=>{"use strict";Fue.exports=t=>class extends t{warn(e,r,o={}){this.file&&(o.file=this.file),this.cwd&&(o.cwd=this.cwd),o.code=r instanceof Error&&r.code||e,o.tarCode=e,!this.strict&&o.recoverable!==!1?(r instanceof Error&&(o=Object.assign(r,o),r=r.message),this.emit("warn",o.tarCode,r,o)):r instanceof Error?this.emit("error",Object.assign(r,o)):this.emit("error",Object.assign(new Error(`${e}: ${r}`),o))}}});var r3=_(($4t,Tue)=>{"use strict";var ab=["|","<",">","?",":"],t3=ab.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),clt=new Map(ab.map((t,e)=>[t,t3[e]])),ult=new Map(t3.map((t,e)=>[t,ab[e]]));Tue.exports={encode:t=>ab.reduce((e,r)=>e.split(r).join(clt.get(r)),t),decode:t=>t3.reduce((e,r)=>e.split(r).join(ult.get(r)),t)}});var n3=_((eUt,Nue)=>{var{isAbsolute:Alt,parse:Rue}=Be("path").win32;Nue.exports=t=>{let e="",r=Rue(t);for(;Alt(t)||r.root;){let o=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":r.root;t=t.substr(o.length),e+=o,r=Rue(t)}return[e,t]}});var Mue=_((tUt,Lue)=>{"use strict";Lue.exports=(t,e,r)=>(t&=4095,r&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t)});var p3=_((iUt,Xue)=>{"use strict";var Gue=OE(),Yue=sb(),Wue=qE(),oA=Be("fs"),Oue=Be("path"),sA=HE(),flt=GE(),Vue=(t,e)=>e?(t=sA(t).replace(/^\.(\/|$)/,""),flt(e)+"/"+t):sA(t),plt=16*1024*1024,Uue=Symbol("process"),_ue=Symbol("file"),Hue=Symbol("directory"),s3=Symbol("symlink"),jue=Symbol("hardlink"),q1=Symbol("header"),lb=Symbol("read"),o3=Symbol("lstat"),ub=Symbol("onlstat"),a3=Symbol("onread"),l3=Symbol("onreadlink"),c3=Symbol("openfile"),u3=Symbol("onopenfile"),mh=Symbol("close"),Ab=Symbol("mode"),A3=Symbol("awaitDrain"),i3=Symbol("ondrain"),aA=Symbol("prefix"),que=Symbol("hadError"),Kue=ob(),hlt=r3(),Jue=n3(),zue=Mue(),fb=Kue(class extends Gue{constructor(e,r){if(r=r||{},super(r),typeof e!="string")throw new TypeError("path is required");this.path=sA(e),this.portable=!!r.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=r.maxReadSize||plt,this.linkCache=r.linkCache||new Map,this.statCache=r.statCache||new Map,this.preservePaths=!!r.preservePaths,this.cwd=sA(r.cwd||process.cwd()),this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.mtime=r.mtime||null,this.prefix=r.prefix?sA(r.prefix):null,this.fd=null,this.blockLen=null,this.blockRemain=null,this.buf=null,this.offset=null,this.length=null,this.pos=null,this.remain=null,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let o=!1;if(!this.preservePaths){let[a,n]=Jue(this.path);a&&(this.path=n,o=a)}this.win32=!!r.win32||process.platform==="win32",this.win32&&(this.path=hlt.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=sA(r.absolute||Oue.resolve(this.cwd,e)),this.path===""&&(this.path="./"),o&&this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path}),this.statCache.has(this.absolute)?this[ub](this.statCache.get(this.absolute)):this[o3]()}emit(e,...r){return e==="error"&&(this[que]=!0),super.emit(e,...r)}[o3](){oA.lstat(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[ub](r)})}[ub](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=dlt(e),this.emit("stat",e),this[Uue]()}[Uue](){switch(this.type){case"File":return this[_ue]();case"Directory":return this[Hue]();case"SymbolicLink":return this[s3]();default:return this.end()}}[Ab](e){return zue(e,this.type==="Directory",this.portable)}[aA](e){return Vue(e,this.prefix)}[q1](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new Wue({path:this[aA](this.path),linkpath:this.type==="Link"?this[aA](this.linkpath):this.linkpath,mode:this[Ab](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Yue({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this[aA](this.path),linkpath:this.type==="Link"?this[aA](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode()),super.write(this.header.block)}[Hue](){this.path.substr(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[q1](),this.end()}[s3](){oA.readlink(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[l3](r)})}[l3](e){this.linkpath=sA(e),this[q1](),this.end()}[jue](e){this.type="Link",this.linkpath=sA(Oue.relative(this.cwd,e)),this.stat.size=0,this[q1](),this.end()}[_ue](){if(this.stat.nlink>1){let e=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(e)){let r=this.linkCache.get(e);if(r.indexOf(this.cwd)===0)return this[jue](r)}this.linkCache.set(e,this.absolute)}if(this[q1](),this.stat.size===0)return this.end();this[c3]()}[c3](){oA.open(this.absolute,"r",(e,r)=>{if(e)return this.emit("error",e);this[u3](r)})}[u3](e){if(this.fd=e,this[que])return this[mh]();this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let r=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(r),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[lb]()}[lb](){let{fd:e,buf:r,offset:o,length:a,pos:n}=this;oA.read(e,r,o,a,n,(u,A)=>{if(u)return this[mh](()=>this.emit("error",u));this[a3](A)})}[mh](e){oA.close(this.fd,e)}[a3](e){if(e<=0&&this.remain>0){let a=new Error("encountered unexpected EOF");return a.path=this.absolute,a.syscall="read",a.code="EOF",this[mh](()=>this.emit("error",a))}if(e>this.remain){let a=new Error("did not encounter expected EOF");return a.path=this.absolute,a.syscall="read",a.code="EOF",this[mh](()=>this.emit("error",a))}if(e===this.remain)for(let a=e;athis[i3]())}[A3](e){this.once("drain",e)}write(e){if(this.blockRemaine?this.emit("error",e):this.end());this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[lb]()}}),f3=class extends fb{[o3](){this[ub](oA.lstatSync(this.absolute))}[s3](){this[l3](oA.readlinkSync(this.absolute))}[c3](){this[u3](oA.openSync(this.absolute,"r"))}[lb](){let e=!0;try{let{fd:r,buf:o,offset:a,length:n,pos:u}=this,A=oA.readSync(r,o,a,n,u);this[a3](A),e=!1}finally{if(e)try{this[mh](()=>{})}catch{}}}[A3](e){e()}[mh](e){oA.closeSync(this.fd),e()}},glt=Kue(class extends Gue{constructor(e,r){r=r||{},super(r),this.preservePaths=!!r.preservePaths,this.portable=!!r.portable,this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.readEntry=e,this.type=e.type,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=r.prefix||null,this.path=sA(e.path),this.mode=this[Ab](e.mode),this.uid=this.portable?null:e.uid,this.gid=this.portable?null:e.gid,this.uname=this.portable?null:e.uname,this.gname=this.portable?null:e.gname,this.size=e.size,this.mtime=this.noMtime?null:r.mtime||e.mtime,this.atime=this.portable?null:e.atime,this.ctime=this.portable?null:e.ctime,this.linkpath=sA(e.linkpath),typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let o=!1;if(!this.preservePaths){let[a,n]=Jue(this.path);a&&(this.path=n,o=a)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.header=new Wue({path:this[aA](this.path),linkpath:this.type==="Link"?this[aA](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?null:this.uid,gid:this.portable?null:this.gid,size:this.size,mtime:this.noMtime?null:this.mtime,type:this.type,uname:this.portable?null:this.uname,atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime}),o&&this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path}),this.header.encode()&&!this.noPax&&super.write(new Yue({atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime,gid:this.portable?null:this.gid,mtime:this.noMtime?null:this.mtime,path:this[aA](this.path),linkpath:this.type==="Link"?this[aA](this.linkpath):this.linkpath,size:this.size,uid:this.portable?null:this.uid,uname:this.portable?null:this.uname,dev:this.portable?null:this.readEntry.dev,ino:this.portable?null:this.readEntry.ino,nlink:this.portable?null:this.readEntry.nlink}).encode()),super.write(this.header.block),e.pipe(this)}[aA](e){return Vue(e,this.prefix)}[Ab](e){return zue(e,this.type==="Directory",this.portable)}write(e){let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(e)}end(){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),super.end()}});fb.Sync=f3;fb.Tar=glt;var dlt=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";Xue.exports=fb});var wb=_((oUt,iAe)=>{"use strict";var Eb=class{constructor(e,r){this.path=e||"./",this.absolute=r,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}},mlt=OE(),ylt=WU(),Elt=nb(),I3=p3(),Clt=I3.Sync,wlt=I3.Tar,Ilt=BP(),Zue=Buffer.alloc(1024),gb=Symbol("onStat"),pb=Symbol("ended"),lA=Symbol("queue"),YE=Symbol("current"),Nd=Symbol("process"),hb=Symbol("processing"),$ue=Symbol("processJob"),cA=Symbol("jobs"),h3=Symbol("jobDone"),db=Symbol("addFSEntry"),eAe=Symbol("addTarEntry"),y3=Symbol("stat"),E3=Symbol("readdir"),mb=Symbol("onreaddir"),yb=Symbol("pipe"),tAe=Symbol("entry"),g3=Symbol("entryOpt"),C3=Symbol("writeEntryClass"),nAe=Symbol("write"),d3=Symbol("ondrain"),Cb=Be("fs"),rAe=Be("path"),Blt=ob(),m3=HE(),B3=Blt(class extends mlt{constructor(e){super(e),e=e||Object.create(null),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=m3(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this[C3]=I3,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,this.zip=null,e.gzip?(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new ylt.Gzip(e.gzip),this.zip.on("data",r=>super.write(r)),this.zip.on("end",r=>super.end()),this.zip.on("drain",r=>this[d3]()),this.on("resume",r=>this.zip.resume())):this.on("drain",this[d3]),this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,this.mtime=e.mtime||null,this.filter=typeof e.filter=="function"?e.filter:r=>!0,this[lA]=new Ilt,this[cA]=0,this.jobs=+e.jobs||4,this[hb]=!1,this[pb]=!1}[nAe](e){return super.write(e)}add(e){return this.write(e),this}end(e){return e&&this.write(e),this[pb]=!0,this[Nd](),this}write(e){if(this[pb])throw new Error("write after end");return e instanceof Elt?this[eAe](e):this[db](e),this.flowing}[eAe](e){let r=m3(rAe.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let o=new Eb(e.path,r,!1);o.entry=new wlt(e,this[g3](o)),o.entry.on("end",a=>this[h3](o)),this[cA]+=1,this[lA].push(o)}this[Nd]()}[db](e){let r=m3(rAe.resolve(this.cwd,e));this[lA].push(new Eb(e,r)),this[Nd]()}[y3](e){e.pending=!0,this[cA]+=1;let r=this.follow?"stat":"lstat";Cb[r](e.absolute,(o,a)=>{e.pending=!1,this[cA]-=1,o?this.emit("error",o):this[gb](e,a)})}[gb](e,r){this.statCache.set(e.absolute,r),e.stat=r,this.filter(e.path,r)||(e.ignore=!0),this[Nd]()}[E3](e){e.pending=!0,this[cA]+=1,Cb.readdir(e.absolute,(r,o)=>{if(e.pending=!1,this[cA]-=1,r)return this.emit("error",r);this[mb](e,o)})}[mb](e,r){this.readdirCache.set(e.absolute,r),e.readdir=r,this[Nd]()}[Nd](){if(!this[hb]){this[hb]=!0;for(let e=this[lA].head;e!==null&&this[cA]this.warn(r,o,a),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix}}[tAe](e){this[cA]+=1;try{return new this[C3](e.path,this[g3](e)).on("end",()=>this[h3](e)).on("error",r=>this.emit("error",r))}catch(r){this.emit("error",r)}}[d3](){this[YE]&&this[YE].entry&&this[YE].entry.resume()}[yb](e){e.piped=!0,e.readdir&&e.readdir.forEach(a=>{let n=e.path,u=n==="./"?"":n.replace(/\/*$/,"/");this[db](u+a)});let r=e.entry,o=this.zip;o?r.on("data",a=>{o.write(a)||r.pause()}):r.on("data",a=>{super.write(a)||r.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}}),w3=class extends B3{constructor(e){super(e),this[C3]=Clt}pause(){}resume(){}[y3](e){let r=this.follow?"statSync":"lstatSync";this[gb](e,Cb[r](e.absolute))}[E3](e,r){this[mb](e,Cb.readdirSync(e.absolute))}[yb](e){let r=e.entry,o=this.zip;e.readdir&&e.readdir.forEach(a=>{let n=e.path,u=n==="./"?"":n.replace(/\/*$/,"/");this[db](u+a)}),o?r.on("data",a=>{o.write(a)}):r.on("data",a=>{super[nAe](a)})}};B3.Sync=w3;iAe.exports=B3});var $E=_(Y1=>{"use strict";var vlt=OE(),Dlt=Be("events").EventEmitter,Qa=Be("fs"),P3=Qa.writev;if(!P3){let t=process.binding("fs"),e=t.FSReqWrap||t.FSReqCallback;P3=(r,o,a,n)=>{let u=(p,h)=>n(p,h,o),A=new e;A.oncomplete=u,t.writeBuffers(r,o,a,A)}}var XE=Symbol("_autoClose"),Yc=Symbol("_close"),G1=Symbol("_ended"),Gn=Symbol("_fd"),sAe=Symbol("_finished"),Eh=Symbol("_flags"),v3=Symbol("_flush"),S3=Symbol("_handleChunk"),x3=Symbol("_makeBuf"),Pb=Symbol("_mode"),Ib=Symbol("_needDrain"),JE=Symbol("_onerror"),ZE=Symbol("_onopen"),D3=Symbol("_onread"),VE=Symbol("_onwrite"),Ch=Symbol("_open"),jf=Symbol("_path"),Ld=Symbol("_pos"),uA=Symbol("_queue"),KE=Symbol("_read"),oAe=Symbol("_readSize"),yh=Symbol("_reading"),Bb=Symbol("_remain"),aAe=Symbol("_size"),vb=Symbol("_write"),WE=Symbol("_writing"),Db=Symbol("_defaultFlag"),zE=Symbol("_errored"),Sb=class extends vlt{constructor(e,r){if(r=r||{},super(r),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[zE]=!1,this[Gn]=typeof r.fd=="number"?r.fd:null,this[jf]=e,this[oAe]=r.readSize||16*1024*1024,this[yh]=!1,this[aAe]=typeof r.size=="number"?r.size:1/0,this[Bb]=this[aAe],this[XE]=typeof r.autoClose=="boolean"?r.autoClose:!0,typeof this[Gn]=="number"?this[KE]():this[Ch]()}get fd(){return this[Gn]}get path(){return this[jf]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Ch](){Qa.open(this[jf],"r",(e,r)=>this[ZE](e,r))}[ZE](e,r){e?this[JE](e):(this[Gn]=r,this.emit("open",r),this[KE]())}[x3](){return Buffer.allocUnsafe(Math.min(this[oAe],this[Bb]))}[KE](){if(!this[yh]){this[yh]=!0;let e=this[x3]();if(e.length===0)return process.nextTick(()=>this[D3](null,0,e));Qa.read(this[Gn],e,0,e.length,null,(r,o,a)=>this[D3](r,o,a))}}[D3](e,r,o){this[yh]=!1,e?this[JE](e):this[S3](r,o)&&this[KE]()}[Yc](){if(this[XE]&&typeof this[Gn]=="number"){let e=this[Gn];this[Gn]=null,Qa.close(e,r=>r?this.emit("error",r):this.emit("close"))}}[JE](e){this[yh]=!0,this[Yc](),this.emit("error",e)}[S3](e,r){let o=!1;return this[Bb]-=e,e>0&&(o=super.write(ethis[ZE](e,r))}[ZE](e,r){this[Db]&&this[Eh]==="r+"&&e&&e.code==="ENOENT"?(this[Eh]="w",this[Ch]()):e?this[JE](e):(this[Gn]=r,this.emit("open",r),this[v3]())}end(e,r){return e&&this.write(e,r),this[G1]=!0,!this[WE]&&!this[uA].length&&typeof this[Gn]=="number"&&this[VE](null,0),this}write(e,r){return typeof e=="string"&&(e=Buffer.from(e,r)),this[G1]?(this.emit("error",new Error("write() after end()")),!1):this[Gn]===null||this[WE]||this[uA].length?(this[uA].push(e),this[Ib]=!0,!1):(this[WE]=!0,this[vb](e),!0)}[vb](e){Qa.write(this[Gn],e,0,e.length,this[Ld],(r,o)=>this[VE](r,o))}[VE](e,r){e?this[JE](e):(this[Ld]!==null&&(this[Ld]+=r),this[uA].length?this[v3]():(this[WE]=!1,this[G1]&&!this[sAe]?(this[sAe]=!0,this[Yc](),this.emit("finish")):this[Ib]&&(this[Ib]=!1,this.emit("drain"))))}[v3](){if(this[uA].length===0)this[G1]&&this[VE](null,0);else if(this[uA].length===1)this[vb](this[uA].pop());else{let e=this[uA];this[uA]=[],P3(this[Gn],e,this[Ld],(r,o)=>this[VE](r,o))}}[Yc](){if(this[XE]&&typeof this[Gn]=="number"){let e=this[Gn];this[Gn]=null,Qa.close(e,r=>r?this.emit("error",r):this.emit("close"))}}},k3=class extends xb{[Ch](){let e;if(this[Db]&&this[Eh]==="r+")try{e=Qa.openSync(this[jf],this[Eh],this[Pb])}catch(r){if(r.code==="ENOENT")return this[Eh]="w",this[Ch]();throw r}else e=Qa.openSync(this[jf],this[Eh],this[Pb]);this[ZE](null,e)}[Yc](){if(this[XE]&&typeof this[Gn]=="number"){let e=this[Gn];this[Gn]=null,Qa.closeSync(e),this.emit("close")}}[vb](e){let r=!0;try{this[VE](null,Qa.writeSync(this[Gn],e,0,e.length,this[Ld])),r=!1}finally{if(r)try{this[Yc]()}catch{}}}};Y1.ReadStream=Sb;Y1.ReadStreamSync=b3;Y1.WriteStream=xb;Y1.WriteStreamSync=k3});var Nb=_((cUt,hAe)=>{"use strict";var Plt=ob(),Slt=qE(),xlt=Be("events"),blt=BP(),klt=1024*1024,Qlt=nb(),lAe=sb(),Flt=WU(),Q3=Buffer.from([31,139]),Xl=Symbol("state"),Md=Symbol("writeEntry"),qf=Symbol("readEntry"),F3=Symbol("nextEntry"),cAe=Symbol("processEntry"),Zl=Symbol("extendedHeader"),W1=Symbol("globalExtendedHeader"),wh=Symbol("meta"),uAe=Symbol("emitMeta"),fi=Symbol("buffer"),Gf=Symbol("queue"),Od=Symbol("ended"),AAe=Symbol("emittedEnd"),Ud=Symbol("emit"),Fa=Symbol("unzip"),bb=Symbol("consumeChunk"),kb=Symbol("consumeChunkSub"),T3=Symbol("consumeBody"),fAe=Symbol("consumeMeta"),pAe=Symbol("consumeHeader"),Qb=Symbol("consuming"),R3=Symbol("bufferConcat"),N3=Symbol("maybeEnd"),V1=Symbol("writing"),Ih=Symbol("aborted"),Fb=Symbol("onDone"),_d=Symbol("sawValidEntry"),Tb=Symbol("sawNullBlock"),Rb=Symbol("sawEOF"),Tlt=t=>!0;hAe.exports=Plt(class extends xlt{constructor(e){e=e||{},super(e),this.file=e.file||"",this[_d]=null,this.on(Fb,r=>{(this[Xl]==="begin"||this[_d]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(Fb,e.ondone):this.on(Fb,r=>{this.emit("prefinish"),this.emit("finish"),this.emit("end"),this.emit("close")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||klt,this.filter=typeof e.filter=="function"?e.filter:Tlt,this.writable=!0,this.readable=!1,this[Gf]=new blt,this[fi]=null,this[qf]=null,this[Md]=null,this[Xl]="begin",this[wh]="",this[Zl]=null,this[W1]=null,this[Od]=!1,this[Fa]=null,this[Ih]=!1,this[Tb]=!1,this[Rb]=!1,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onentry=="function"&&this.on("entry",e.onentry)}[pAe](e,r){this[_d]===null&&(this[_d]=!1);let o;try{o=new Slt(e,r,this[Zl],this[W1])}catch(a){return this.warn("TAR_ENTRY_INVALID",a)}if(o.nullBlock)this[Tb]?(this[Rb]=!0,this[Xl]==="begin"&&(this[Xl]="header"),this[Ud]("eof")):(this[Tb]=!0,this[Ud]("nullBlock"));else if(this[Tb]=!1,!o.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:o});else if(!o.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:o});else{let a=o.type;if(/^(Symbolic)?Link$/.test(a)&&!o.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:o});else if(!/^(Symbolic)?Link$/.test(a)&&o.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:o});else{let n=this[Md]=new Qlt(o,this[Zl],this[W1]);if(!this[_d])if(n.remain){let u=()=>{n.invalid||(this[_d]=!0)};n.on("end",u)}else this[_d]=!0;n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[Ud]("ignoredEntry",n),this[Xl]="ignore",n.resume()):n.size>0&&(this[wh]="",n.on("data",u=>this[wh]+=u),this[Xl]="meta"):(this[Zl]=null,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[Ud]("ignoredEntry",n),this[Xl]=n.remain?"ignore":"header",n.resume()):(n.remain?this[Xl]="body":(this[Xl]="header",n.end()),this[qf]?this[Gf].push(n):(this[Gf].push(n),this[F3]())))}}}[cAe](e){let r=!0;return e?Array.isArray(e)?this.emit.apply(this,e):(this[qf]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",o=>this[F3]()),r=!1)):(this[qf]=null,r=!1),r}[F3](){do;while(this[cAe](this[Gf].shift()));if(!this[Gf].length){let e=this[qf];!e||e.flowing||e.size===e.remain?this[V1]||this.emit("drain"):e.once("drain",o=>this.emit("drain"))}}[T3](e,r){let o=this[Md],a=o.blockRemain,n=a>=e.length&&r===0?e:e.slice(r,r+a);return o.write(n),o.blockRemain||(this[Xl]="header",this[Md]=null,o.end()),n.length}[fAe](e,r){let o=this[Md],a=this[T3](e,r);return this[Md]||this[uAe](o),a}[Ud](e,r,o){!this[Gf].length&&!this[qf]?this.emit(e,r,o):this[Gf].push([e,r,o])}[uAe](e){switch(this[Ud]("meta",this[wh]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Zl]=lAe.parse(this[wh],this[Zl],!1);break;case"GlobalExtendedHeader":this[W1]=lAe.parse(this[wh],this[W1],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":this[Zl]=this[Zl]||Object.create(null),this[Zl].path=this[wh].replace(/\0.*/,"");break;case"NextFileHasLongLinkpath":this[Zl]=this[Zl]||Object.create(null),this[Zl].linkpath=this[wh].replace(/\0.*/,"");break;default:throw new Error("unknown meta: "+e.type)}}abort(e){this[Ih]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e){if(this[Ih])return;if(this[Fa]===null&&e){if(this[fi]&&(e=Buffer.concat([this[fi],e]),this[fi]=null),e.lengththis[bb](n)),this[Fa].on("error",n=>this.abort(n)),this[Fa].on("end",n=>{this[Od]=!0,this[bb]()}),this[V1]=!0;let a=this[Fa][o?"end":"write"](e);return this[V1]=!1,a}}this[V1]=!0,this[Fa]?this[Fa].write(e):this[bb](e),this[V1]=!1;let r=this[Gf].length?!1:this[qf]?this[qf].flowing:!0;return!r&&!this[Gf].length&&this[qf].once("drain",o=>this.emit("drain")),r}[R3](e){e&&!this[Ih]&&(this[fi]=this[fi]?Buffer.concat([this[fi],e]):e)}[N3](){if(this[Od]&&!this[AAe]&&!this[Ih]&&!this[Qb]){this[AAe]=!0;let e=this[Md];if(e&&e.blockRemain){let r=this[fi]?this[fi].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${r} available)`,{entry:e}),this[fi]&&e.write(this[fi]),e.end()}this[Ud](Fb)}}[bb](e){if(this[Qb])this[R3](e);else if(!e&&!this[fi])this[N3]();else{if(this[Qb]=!0,this[fi]){this[R3](e);let r=this[fi];this[fi]=null,this[kb](r)}else this[kb](e);for(;this[fi]&&this[fi].length>=512&&!this[Ih]&&!this[Rb];){let r=this[fi];this[fi]=null,this[kb](r)}this[Qb]=!1}(!this[fi]||this[Od])&&this[N3]()}[kb](e){let r=0,o=e.length;for(;r+512<=o&&!this[Ih]&&!this[Rb];)switch(this[Xl]){case"begin":case"header":this[pAe](e,r),r+=512;break;case"ignore":case"body":r+=this[T3](e,r);break;case"meta":r+=this[fAe](e,r);break;default:throw new Error("invalid state: "+this[Xl])}r{"use strict";var Rlt=LE(),dAe=Nb(),eC=Be("fs"),Nlt=$E(),gAe=Be("path"),L3=GE();yAe.exports=(t,e,r)=>{typeof t=="function"?(r=t,e=null,t={}):Array.isArray(t)&&(e=t,t={}),typeof e=="function"&&(r=e,e=null),e?e=Array.from(e):e=[];let o=Rlt(t);if(o.sync&&typeof r=="function")throw new TypeError("callback not supported for sync tar functions");if(!o.file&&typeof r=="function")throw new TypeError("callback only supported with file option");return e.length&&Mlt(o,e),o.noResume||Llt(o),o.file&&o.sync?Olt(o):o.file?Ult(o,r):mAe(o)};var Llt=t=>{let e=t.onentry;t.onentry=e?r=>{e(r),r.resume()}:r=>r.resume()},Mlt=(t,e)=>{let r=new Map(e.map(n=>[L3(n),!0])),o=t.filter,a=(n,u)=>{let A=u||gAe.parse(n).root||".",p=n===A?!1:r.has(n)?r.get(n):a(gAe.dirname(n),A);return r.set(n,p),p};t.filter=o?(n,u)=>o(n,u)&&a(L3(n)):n=>a(L3(n))},Olt=t=>{let e=mAe(t),r=t.file,o=!0,a;try{let n=eC.statSync(r),u=t.maxReadSize||16*1024*1024;if(n.size{let r=new dAe(t),o=t.maxReadSize||16*1024*1024,a=t.file,n=new Promise((u,A)=>{r.on("error",A),r.on("end",u),eC.stat(a,(p,h)=>{if(p)A(p);else{let E=new Nlt.ReadStream(a,{readSize:o,size:h.size});E.on("error",A),E.pipe(r)}})});return e?n.then(e,e):n},mAe=t=>new dAe(t)});var vAe=_((AUt,BAe)=>{"use strict";var _lt=LE(),Mb=wb(),EAe=$E(),CAe=Lb(),wAe=Be("path");BAe.exports=(t,e,r)=>{if(typeof e=="function"&&(r=e),Array.isArray(t)&&(e=t,t={}),!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");e=Array.from(e);let o=_lt(t);if(o.sync&&typeof r=="function")throw new TypeError("callback not supported for sync tar functions");if(!o.file&&typeof r=="function")throw new TypeError("callback only supported with file option");return o.file&&o.sync?Hlt(o,e):o.file?jlt(o,e,r):o.sync?qlt(o,e):Glt(o,e)};var Hlt=(t,e)=>{let r=new Mb.Sync(t),o=new EAe.WriteStreamSync(t.file,{mode:t.mode||438});r.pipe(o),IAe(r,e)},jlt=(t,e,r)=>{let o=new Mb(t),a=new EAe.WriteStream(t.file,{mode:t.mode||438});o.pipe(a);let n=new Promise((u,A)=>{a.on("error",A),a.on("close",u),o.on("error",A)});return M3(o,e),r?n.then(r,r):n},IAe=(t,e)=>{e.forEach(r=>{r.charAt(0)==="@"?CAe({file:wAe.resolve(t.cwd,r.substr(1)),sync:!0,noResume:!0,onentry:o=>t.add(o)}):t.add(r)}),t.end()},M3=(t,e)=>{for(;e.length;){let r=e.shift();if(r.charAt(0)==="@")return CAe({file:wAe.resolve(t.cwd,r.substr(1)),noResume:!0,onentry:o=>t.add(o)}).then(o=>M3(t,e));t.add(r)}t.end()},qlt=(t,e)=>{let r=new Mb.Sync(t);return IAe(r,e),r},Glt=(t,e)=>{let r=new Mb(t);return M3(r,e),r}});var O3=_((fUt,QAe)=>{"use strict";var Ylt=LE(),DAe=wb(),Al=Be("fs"),PAe=$E(),SAe=Lb(),xAe=Be("path"),bAe=qE();QAe.exports=(t,e,r)=>{let o=Ylt(t);if(!o.file)throw new TypeError("file is required");if(o.gzip)throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),o.sync?Wlt(o,e):Klt(o,e,r)};var Wlt=(t,e)=>{let r=new DAe.Sync(t),o=!0,a,n;try{try{a=Al.openSync(t.file,"r+")}catch(p){if(p.code==="ENOENT")a=Al.openSync(t.file,"w+");else throw p}let u=Al.fstatSync(a),A=Buffer.alloc(512);e:for(n=0;nu.size)break;n+=h,t.mtimeCache&&t.mtimeCache.set(p.path,p.mtime)}o=!1,Vlt(t,r,n,a,e)}finally{if(o)try{Al.closeSync(a)}catch{}}},Vlt=(t,e,r,o,a)=>{let n=new PAe.WriteStreamSync(t.file,{fd:o,start:r});e.pipe(n),Jlt(e,a)},Klt=(t,e,r)=>{e=Array.from(e);let o=new DAe(t),a=(u,A,p)=>{let h=(C,T)=>{C?Al.close(u,L=>p(C)):p(null,T)},E=0;if(A===0)return h(null,0);let I=0,v=Buffer.alloc(512),b=(C,T)=>{if(C)return h(C);if(I+=T,I<512&&T)return Al.read(u,v,I,v.length-I,E+I,b);if(E===0&&v[0]===31&&v[1]===139)return h(new Error("cannot append to compressed archives"));if(I<512)return h(null,E);let L=new bAe(v);if(!L.cksumValid)return h(null,E);let U=512*Math.ceil(L.size/512);if(E+U+512>A||(E+=U+512,E>=A))return h(null,E);t.mtimeCache&&t.mtimeCache.set(L.path,L.mtime),I=0,Al.read(u,v,0,512,E,b)};Al.read(u,v,0,512,E,b)},n=new Promise((u,A)=>{o.on("error",A);let p="r+",h=(E,I)=>{if(E&&E.code==="ENOENT"&&p==="r+")return p="w+",Al.open(t.file,p,h);if(E)return A(E);Al.fstat(I,(v,b)=>{if(v)return Al.close(I,()=>A(v));a(I,b.size,(C,T)=>{if(C)return A(C);let L=new PAe.WriteStream(t.file,{fd:I,start:T});o.pipe(L),L.on("error",A),L.on("close",u),kAe(o,e)})})};Al.open(t.file,p,h)});return r?n.then(r,r):n},Jlt=(t,e)=>{e.forEach(r=>{r.charAt(0)==="@"?SAe({file:xAe.resolve(t.cwd,r.substr(1)),sync:!0,noResume:!0,onentry:o=>t.add(o)}):t.add(r)}),t.end()},kAe=(t,e)=>{for(;e.length;){let r=e.shift();if(r.charAt(0)==="@")return SAe({file:xAe.resolve(t.cwd,r.substr(1)),noResume:!0,onentry:o=>t.add(o)}).then(o=>kAe(t,e));t.add(r)}t.end()}});var TAe=_((pUt,FAe)=>{"use strict";var zlt=LE(),Xlt=O3();FAe.exports=(t,e,r)=>{let o=zlt(t);if(!o.file)throw new TypeError("file is required");if(o.gzip)throw new TypeError("cannot append to compressed archives");if(!e||!Array.isArray(e)||!e.length)throw new TypeError("no files or directories specified");return e=Array.from(e),Zlt(o),Xlt(o,e,r)};var Zlt=t=>{let e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(r,o)=>e(r,o)&&!(t.mtimeCache.get(r)>o.mtime):(r,o)=>!(t.mtimeCache.get(r)>o.mtime)}});var LAe=_((hUt,NAe)=>{var{promisify:RAe}=Be("util"),Bh=Be("fs"),$lt=t=>{if(!t)t={mode:511,fs:Bh};else if(typeof t=="object")t={mode:511,fs:Bh,...t};else if(typeof t=="number")t={mode:t,fs:Bh};else if(typeof t=="string")t={mode:parseInt(t,8),fs:Bh};else throw new TypeError("invalid options argument");return t.mkdir=t.mkdir||t.fs.mkdir||Bh.mkdir,t.mkdirAsync=RAe(t.mkdir),t.stat=t.stat||t.fs.stat||Bh.stat,t.statAsync=RAe(t.stat),t.statSync=t.statSync||t.fs.statSync||Bh.statSync,t.mkdirSync=t.mkdirSync||t.fs.mkdirSync||Bh.mkdirSync,t};NAe.exports=$lt});var OAe=_((gUt,MAe)=>{var ect=process.platform,{resolve:tct,parse:rct}=Be("path"),nct=t=>{if(/\0/.test(t))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"});if(t=tct(t),ect==="win32"){let e=/[*|"<>?:]/,{root:r}=rct(t);if(e.test(t.substr(r.length)))throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}return t};MAe.exports=nct});var qAe=_((dUt,jAe)=>{var{dirname:UAe}=Be("path"),_Ae=(t,e,r=void 0)=>r===e?Promise.resolve():t.statAsync(e).then(o=>o.isDirectory()?r:void 0,o=>o.code==="ENOENT"?_Ae(t,UAe(e),e):void 0),HAe=(t,e,r=void 0)=>{if(r!==e)try{return t.statSync(e).isDirectory()?r:void 0}catch(o){return o.code==="ENOENT"?HAe(t,UAe(e),e):void 0}};jAe.exports={findMade:_Ae,findMadeSync:HAe}});var H3=_((mUt,YAe)=>{var{dirname:GAe}=Be("path"),U3=(t,e,r)=>{e.recursive=!1;let o=GAe(t);return o===t?e.mkdirAsync(t,e).catch(a=>{if(a.code!=="EISDIR")throw a}):e.mkdirAsync(t,e).then(()=>r||t,a=>{if(a.code==="ENOENT")return U3(o,e).then(n=>U3(t,e,n));if(a.code!=="EEXIST"&&a.code!=="EROFS")throw a;return e.statAsync(t).then(n=>{if(n.isDirectory())return r;throw a},()=>{throw a})})},_3=(t,e,r)=>{let o=GAe(t);if(e.recursive=!1,o===t)try{return e.mkdirSync(t,e)}catch(a){if(a.code!=="EISDIR")throw a;return}try{return e.mkdirSync(t,e),r||t}catch(a){if(a.code==="ENOENT")return _3(t,e,_3(o,e,r));if(a.code!=="EEXIST"&&a.code!=="EROFS")throw a;try{if(!e.statSync(t).isDirectory())throw a}catch{throw a}}};YAe.exports={mkdirpManual:U3,mkdirpManualSync:_3}});var KAe=_((yUt,VAe)=>{var{dirname:WAe}=Be("path"),{findMade:ict,findMadeSync:sct}=qAe(),{mkdirpManual:oct,mkdirpManualSync:act}=H3(),lct=(t,e)=>(e.recursive=!0,WAe(t)===t?e.mkdirAsync(t,e):ict(e,t).then(o=>e.mkdirAsync(t,e).then(()=>o).catch(a=>{if(a.code==="ENOENT")return oct(t,e);throw a}))),cct=(t,e)=>{if(e.recursive=!0,WAe(t)===t)return e.mkdirSync(t,e);let o=sct(e,t);try{return e.mkdirSync(t,e),o}catch(a){if(a.code==="ENOENT")return act(t,e);throw a}};VAe.exports={mkdirpNative:lct,mkdirpNativeSync:cct}});var ZAe=_((EUt,XAe)=>{var JAe=Be("fs"),uct=process.version,j3=uct.replace(/^v/,"").split("."),zAe=+j3[0]>10||+j3[0]==10&&+j3[1]>=12,Act=zAe?t=>t.mkdir===JAe.mkdir:()=>!1,fct=zAe?t=>t.mkdirSync===JAe.mkdirSync:()=>!1;XAe.exports={useNative:Act,useNativeSync:fct}});var ife=_((CUt,nfe)=>{var tC=LAe(),rC=OAe(),{mkdirpNative:$Ae,mkdirpNativeSync:efe}=KAe(),{mkdirpManual:tfe,mkdirpManualSync:rfe}=H3(),{useNative:pct,useNativeSync:hct}=ZAe(),nC=(t,e)=>(t=rC(t),e=tC(e),pct(e)?$Ae(t,e):tfe(t,e)),gct=(t,e)=>(t=rC(t),e=tC(e),hct(e)?efe(t,e):rfe(t,e));nC.sync=gct;nC.native=(t,e)=>$Ae(rC(t),tC(e));nC.manual=(t,e)=>tfe(rC(t),tC(e));nC.nativeSync=(t,e)=>efe(rC(t),tC(e));nC.manualSync=(t,e)=>rfe(rC(t),tC(e));nfe.exports=nC});var Afe=_((wUt,ufe)=>{"use strict";var $l=Be("fs"),Hd=Be("path"),dct=$l.lchown?"lchown":"chown",mct=$l.lchownSync?"lchownSync":"chownSync",ofe=$l.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),sfe=(t,e,r)=>{try{return $l[mct](t,e,r)}catch(o){if(o.code!=="ENOENT")throw o}},yct=(t,e,r)=>{try{return $l.chownSync(t,e,r)}catch(o){if(o.code!=="ENOENT")throw o}},Ect=ofe?(t,e,r,o)=>a=>{!a||a.code!=="EISDIR"?o(a):$l.chown(t,e,r,o)}:(t,e,r,o)=>o,q3=ofe?(t,e,r)=>{try{return sfe(t,e,r)}catch(o){if(o.code!=="EISDIR")throw o;yct(t,e,r)}}:(t,e,r)=>sfe(t,e,r),Cct=process.version,afe=(t,e,r)=>$l.readdir(t,e,r),wct=(t,e)=>$l.readdirSync(t,e);/^v4\./.test(Cct)&&(afe=(t,e,r)=>$l.readdir(t,r));var Ob=(t,e,r,o)=>{$l[dct](t,e,r,Ect(t,e,r,a=>{o(a&&a.code!=="ENOENT"?a:null)}))},lfe=(t,e,r,o,a)=>{if(typeof e=="string")return $l.lstat(Hd.resolve(t,e),(n,u)=>{if(n)return a(n.code!=="ENOENT"?n:null);u.name=e,lfe(t,u,r,o,a)});if(e.isDirectory())G3(Hd.resolve(t,e.name),r,o,n=>{if(n)return a(n);let u=Hd.resolve(t,e.name);Ob(u,r,o,a)});else{let n=Hd.resolve(t,e.name);Ob(n,r,o,a)}},G3=(t,e,r,o)=>{afe(t,{withFileTypes:!0},(a,n)=>{if(a){if(a.code==="ENOENT")return o();if(a.code!=="ENOTDIR"&&a.code!=="ENOTSUP")return o(a)}if(a||!n.length)return Ob(t,e,r,o);let u=n.length,A=null,p=h=>{if(!A){if(h)return o(A=h);if(--u===0)return Ob(t,e,r,o)}};n.forEach(h=>lfe(t,h,e,r,p))})},Ict=(t,e,r,o)=>{if(typeof e=="string")try{let a=$l.lstatSync(Hd.resolve(t,e));a.name=e,e=a}catch(a){if(a.code==="ENOENT")return;throw a}e.isDirectory()&&cfe(Hd.resolve(t,e.name),r,o),q3(Hd.resolve(t,e.name),r,o)},cfe=(t,e,r)=>{let o;try{o=wct(t,{withFileTypes:!0})}catch(a){if(a.code==="ENOENT")return;if(a.code==="ENOTDIR"||a.code==="ENOTSUP")return q3(t,e,r);throw a}return o&&o.length&&o.forEach(a=>Ict(t,a,e,r)),q3(t,e,r)};ufe.exports=G3;G3.sync=cfe});var gfe=_((IUt,Y3)=>{"use strict";var ffe=ife(),ec=Be("fs"),Ub=Be("path"),pfe=Afe(),Wc=HE(),_b=class extends Error{constructor(e,r){super("Cannot extract through symbolic link"),this.path=r,this.symlink=e}get name(){return"SylinkError"}},Hb=class extends Error{constructor(e,r){super(r+": Cannot cd into '"+e+"'"),this.path=e,this.code=r}get name(){return"CwdError"}},jb=(t,e)=>t.get(Wc(e)),K1=(t,e,r)=>t.set(Wc(e),r),Bct=(t,e)=>{ec.stat(t,(r,o)=>{(r||!o.isDirectory())&&(r=new Hb(t,r&&r.code||"ENOTDIR")),e(r)})};Y3.exports=(t,e,r)=>{t=Wc(t);let o=e.umask,a=e.mode|448,n=(a&o)!==0,u=e.uid,A=e.gid,p=typeof u=="number"&&typeof A=="number"&&(u!==e.processUid||A!==e.processGid),h=e.preserve,E=e.unlink,I=e.cache,v=Wc(e.cwd),b=(L,U)=>{L?r(L):(K1(I,t,!0),U&&p?pfe(U,u,A,J=>b(J)):n?ec.chmod(t,a,r):r())};if(I&&jb(I,t)===!0)return b();if(t===v)return Bct(t,b);if(h)return ffe(t,{mode:a}).then(L=>b(null,L),b);let T=Wc(Ub.relative(v,t)).split("/");qb(v,T,a,I,E,v,null,b)};var qb=(t,e,r,o,a,n,u,A)=>{if(!e.length)return A(null,u);let p=e.shift(),h=Wc(Ub.resolve(t+"/"+p));if(jb(o,h))return qb(h,e,r,o,a,n,u,A);ec.mkdir(h,r,hfe(h,e,r,o,a,n,u,A))},hfe=(t,e,r,o,a,n,u,A)=>p=>{p?ec.lstat(t,(h,E)=>{if(h)h.path=h.path&&Wc(h.path),A(h);else if(E.isDirectory())qb(t,e,r,o,a,n,u,A);else if(a)ec.unlink(t,I=>{if(I)return A(I);ec.mkdir(t,r,hfe(t,e,r,o,a,n,u,A))});else{if(E.isSymbolicLink())return A(new _b(t,t+"/"+e.join("/")));A(p)}}):(u=u||t,qb(t,e,r,o,a,n,u,A))},vct=t=>{let e=!1,r="ENOTDIR";try{e=ec.statSync(t).isDirectory()}catch(o){r=o.code}finally{if(!e)throw new Hb(t,r)}};Y3.exports.sync=(t,e)=>{t=Wc(t);let r=e.umask,o=e.mode|448,a=(o&r)!==0,n=e.uid,u=e.gid,A=typeof n=="number"&&typeof u=="number"&&(n!==e.processUid||u!==e.processGid),p=e.preserve,h=e.unlink,E=e.cache,I=Wc(e.cwd),v=L=>{K1(E,t,!0),L&&A&&pfe.sync(L,n,u),a&&ec.chmodSync(t,o)};if(E&&jb(E,t)===!0)return v();if(t===I)return vct(I),v();if(p)return v(ffe.sync(t,o));let C=Wc(Ub.relative(I,t)).split("/"),T=null;for(let L=C.shift(),U=I;L&&(U+="/"+L);L=C.shift())if(U=Wc(Ub.resolve(U)),!jb(E,U))try{ec.mkdirSync(U,o),T=T||U,K1(E,U,!0)}catch{let te=ec.lstatSync(U);if(te.isDirectory()){K1(E,U,!0);continue}else if(h){ec.unlinkSync(U),ec.mkdirSync(U,o),T=T||U,K1(E,U,!0);continue}else if(te.isSymbolicLink())return new _b(U,U+"/"+C.join("/"))}return v(T)}});var V3=_((BUt,dfe)=>{var W3=Object.create(null),{hasOwnProperty:Dct}=Object.prototype;dfe.exports=t=>(Dct.call(W3,t)||(W3[t]=t.normalize("NFKD")),W3[t])});var Cfe=_((vUt,Efe)=>{var mfe=Be("assert"),Pct=V3(),Sct=GE(),{join:yfe}=Be("path"),xct=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,bct=xct==="win32";Efe.exports=()=>{let t=new Map,e=new Map,r=h=>h.split("/").slice(0,-1).reduce((I,v)=>(I.length&&(v=yfe(I[I.length-1],v)),I.push(v||"/"),I),[]),o=new Set,a=h=>{let E=e.get(h);if(!E)throw new Error("function does not have any path reservations");return{paths:E.paths.map(I=>t.get(I)),dirs:[...E.dirs].map(I=>t.get(I))}},n=h=>{let{paths:E,dirs:I}=a(h);return E.every(v=>v[0]===h)&&I.every(v=>v[0]instanceof Set&&v[0].has(h))},u=h=>o.has(h)||!n(h)?!1:(o.add(h),h(()=>A(h)),!0),A=h=>{if(!o.has(h))return!1;let{paths:E,dirs:I}=e.get(h),v=new Set;return E.forEach(b=>{let C=t.get(b);mfe.equal(C[0],h),C.length===1?t.delete(b):(C.shift(),typeof C[0]=="function"?v.add(C[0]):C[0].forEach(T=>v.add(T)))}),I.forEach(b=>{let C=t.get(b);mfe(C[0]instanceof Set),C[0].size===1&&C.length===1?t.delete(b):C[0].size===1?(C.shift(),v.add(C[0])):C[0].delete(h)}),o.delete(h),v.forEach(b=>u(b)),!0};return{check:n,reserve:(h,E)=>{h=bct?["win32 parallelization disabled"]:h.map(v=>Pct(Sct(yfe(v))).toLowerCase());let I=new Set(h.map(v=>r(v)).reduce((v,b)=>v.concat(b)));return e.set(E,{dirs:I,paths:h}),h.forEach(v=>{let b=t.get(v);b?b.push(E):t.set(v,[E])}),I.forEach(v=>{let b=t.get(v);b?b[b.length-1]instanceof Set?b[b.length-1].add(E):b.push(new Set([E])):t.set(v,[new Set([E])])}),u(E)}}}});var Bfe=_((DUt,Ife)=>{var kct=process.platform,Qct=kct==="win32",Fct=global.__FAKE_TESTING_FS__||Be("fs"),{O_CREAT:Tct,O_TRUNC:Rct,O_WRONLY:Nct,UV_FS_O_FILEMAP:wfe=0}=Fct.constants,Lct=Qct&&!!wfe,Mct=512*1024,Oct=wfe|Rct|Tct|Nct;Ife.exports=Lct?t=>t"w"});var r_=_((PUt,Mfe)=>{"use strict";var Uct=Be("assert"),_ct=Nb(),vn=Be("fs"),Hct=$E(),Yf=Be("path"),Rfe=gfe(),vfe=r3(),jct=Cfe(),qct=n3(),fl=HE(),Gct=GE(),Yct=V3(),Dfe=Symbol("onEntry"),z3=Symbol("checkFs"),Pfe=Symbol("checkFs2"),Wb=Symbol("pruneCache"),X3=Symbol("isReusable"),tc=Symbol("makeFs"),Z3=Symbol("file"),$3=Symbol("directory"),Vb=Symbol("link"),Sfe=Symbol("symlink"),xfe=Symbol("hardlink"),bfe=Symbol("unsupported"),kfe=Symbol("checkPath"),vh=Symbol("mkdir"),Ro=Symbol("onError"),Gb=Symbol("pending"),Qfe=Symbol("pend"),iC=Symbol("unpend"),K3=Symbol("ended"),J3=Symbol("maybeClose"),e_=Symbol("skip"),J1=Symbol("doChown"),z1=Symbol("uid"),X1=Symbol("gid"),Z1=Symbol("checkedCwd"),Nfe=Be("crypto"),Lfe=Bfe(),Wct=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,$1=Wct==="win32",Vct=(t,e)=>{if(!$1)return vn.unlink(t,e);let r=t+".DELETE."+Nfe.randomBytes(16).toString("hex");vn.rename(t,r,o=>{if(o)return e(o);vn.unlink(r,e)})},Kct=t=>{if(!$1)return vn.unlinkSync(t);let e=t+".DELETE."+Nfe.randomBytes(16).toString("hex");vn.renameSync(t,e),vn.unlinkSync(e)},Ffe=(t,e,r)=>t===t>>>0?t:e===e>>>0?e:r,Tfe=t=>Yct(Gct(fl(t))).toLowerCase(),Jct=(t,e)=>{e=Tfe(e);for(let r of t.keys()){let o=Tfe(r);(o===e||o.indexOf(e+"/")===0)&&t.delete(r)}},zct=t=>{for(let e of t.keys())t.delete(e)},e2=class extends _ct{constructor(e){if(e||(e={}),e.ondone=r=>{this[K3]=!0,this[J3]()},super(e),this[Z1]=!1,this.reservations=jct(),this.transform=typeof e.transform=="function"?e.transform:null,this.writable=!0,this.readable=!1,this[Gb]=0,this[K3]=!1,this.dirCache=e.dirCache||new Map,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=process.getuid&&process.getuid()===0:this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():null,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():null,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||$1,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=fl(Yf.resolve(e.cwd||process.cwd())),this.strip=+e.strip||0,this.processUmask=e.noChmod?0:process.umask(),this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",r=>this[Dfe](r))}warn(e,r,o={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(o.recoverable=!1),super.warn(e,r,o)}[J3](){this[K3]&&this[Gb]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"),this.emit("close"))}[kfe](e){if(this.strip){let r=fl(e.path).split("/");if(r.length=this.strip)e.linkpath=o.slice(this.strip).join("/");else return!1}}if(!this.preservePaths){let r=fl(e.path),o=r.split("/");if(o.includes("..")||$1&&/^[a-z]:\.\.$/i.test(o[0]))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:r}),!1;let[a,n]=qct(r);a&&(e.path=n,this.warn("TAR_ENTRY_INFO",`stripping ${a} from absolute path`,{entry:e,path:r}))}if(Yf.isAbsolute(e.path)?e.absolute=fl(Yf.resolve(e.path)):e.absolute=fl(Yf.resolve(this.cwd,e.path)),!this.preservePaths&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:fl(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=Yf.win32.parse(e.absolute);e.absolute=r+vfe.encode(e.absolute.substr(r.length));let{root:o}=Yf.win32.parse(e.path);e.path=o+vfe.encode(e.path.substr(o.length))}return!0}[Dfe](e){if(!this[kfe](e))return e.resume();switch(Uct.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[z3](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[bfe](e)}}[Ro](e,r){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:r}),this[iC](),r.resume())}[vh](e,r,o){Rfe(fl(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r,noChmod:this.noChmod},o)}[J1](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[z1](e){return Ffe(this.uid,e.uid,this.processUid)}[X1](e){return Ffe(this.gid,e.gid,this.processGid)}[Z3](e,r){let o=e.mode&4095||this.fmode,a=new Hct.WriteStream(e.absolute,{flags:Lfe(e.size),mode:o,autoClose:!1});a.on("error",p=>{a.fd&&vn.close(a.fd,()=>{}),a.write=()=>!0,this[Ro](p,e),r()});let n=1,u=p=>{if(p){a.fd&&vn.close(a.fd,()=>{}),this[Ro](p,e),r();return}--n===0&&vn.close(a.fd,h=>{h?this[Ro](h,e):this[iC](),r()})};a.on("finish",p=>{let h=e.absolute,E=a.fd;if(e.mtime&&!this.noMtime){n++;let I=e.atime||new Date,v=e.mtime;vn.futimes(E,I,v,b=>b?vn.utimes(h,I,v,C=>u(C&&b)):u())}if(this[J1](e)){n++;let I=this[z1](e),v=this[X1](e);vn.fchown(E,I,v,b=>b?vn.chown(h,I,v,C=>u(C&&b)):u())}u()});let A=this.transform&&this.transform(e)||e;A!==e&&(A.on("error",p=>{this[Ro](p,e),r()}),e.pipe(A)),A.pipe(a)}[$3](e,r){let o=e.mode&4095||this.dmode;this[vh](e.absolute,o,a=>{if(a){this[Ro](a,e),r();return}let n=1,u=A=>{--n===0&&(r(),this[iC](),e.resume())};e.mtime&&!this.noMtime&&(n++,vn.utimes(e.absolute,e.atime||new Date,e.mtime,u)),this[J1](e)&&(n++,vn.chown(e.absolute,this[z1](e),this[X1](e),u)),u()})}[bfe](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[Sfe](e,r){this[Vb](e,e.linkpath,"symlink",r)}[xfe](e,r){let o=fl(Yf.resolve(this.cwd,e.linkpath));this[Vb](e,o,"link",r)}[Qfe](){this[Gb]++}[iC](){this[Gb]--,this[J3]()}[e_](e){this[iC](),e.resume()}[X3](e,r){return e.type==="File"&&!this.unlink&&r.isFile()&&r.nlink<=1&&!$1}[z3](e){this[Qfe]();let r=[e.path];e.linkpath&&r.push(e.linkpath),this.reservations.reserve(r,o=>this[Pfe](e,o))}[Wb](e){e.type==="SymbolicLink"?zct(this.dirCache):e.type!=="Directory"&&Jct(this.dirCache,e.absolute)}[Pfe](e,r){this[Wb](e);let o=A=>{this[Wb](e),r(A)},a=()=>{this[vh](this.cwd,this.dmode,A=>{if(A){this[Ro](A,e),o();return}this[Z1]=!0,n()})},n=()=>{if(e.absolute!==this.cwd){let A=fl(Yf.dirname(e.absolute));if(A!==this.cwd)return this[vh](A,this.dmode,p=>{if(p){this[Ro](p,e),o();return}u()})}u()},u=()=>{vn.lstat(e.absolute,(A,p)=>{if(p&&(this.keep||this.newer&&p.mtime>e.mtime)){this[e_](e),o();return}if(A||this[X3](e,p))return this[tc](null,e,o);if(p.isDirectory()){if(e.type==="Directory"){let h=!this.noChmod&&e.mode&&(p.mode&4095)!==e.mode,E=I=>this[tc](I,e,o);return h?vn.chmod(e.absolute,e.mode,E):E()}if(e.absolute!==this.cwd)return vn.rmdir(e.absolute,h=>this[tc](h,e,o))}if(e.absolute===this.cwd)return this[tc](null,e,o);Vct(e.absolute,h=>this[tc](h,e,o))})};this[Z1]?n():a()}[tc](e,r,o){if(e){this[Ro](e,r),o();return}switch(r.type){case"File":case"OldFile":case"ContiguousFile":return this[Z3](r,o);case"Link":return this[xfe](r,o);case"SymbolicLink":return this[Sfe](r,o);case"Directory":case"GNUDumpDir":return this[$3](r,o)}}[Vb](e,r,o,a){vn[o](r,e.absolute,n=>{n?this[Ro](n,e):(this[iC](),e.resume()),a()})}},Yb=t=>{try{return[null,t()]}catch(e){return[e,null]}},t_=class extends e2{[tc](e,r){return super[tc](e,r,()=>{})}[z3](e){if(this[Wb](e),!this[Z1]){let n=this[vh](this.cwd,this.dmode);if(n)return this[Ro](n,e);this[Z1]=!0}if(e.absolute!==this.cwd){let n=fl(Yf.dirname(e.absolute));if(n!==this.cwd){let u=this[vh](n,this.dmode);if(u)return this[Ro](u,e)}}let[r,o]=Yb(()=>vn.lstatSync(e.absolute));if(o&&(this.keep||this.newer&&o.mtime>e.mtime))return this[e_](e);if(r||this[X3](e,o))return this[tc](null,e);if(o.isDirectory()){if(e.type==="Directory"){let u=!this.noChmod&&e.mode&&(o.mode&4095)!==e.mode,[A]=u?Yb(()=>{vn.chmodSync(e.absolute,e.mode)}):[];return this[tc](A,e)}let[n]=Yb(()=>vn.rmdirSync(e.absolute));this[tc](n,e)}let[a]=e.absolute===this.cwd?[]:Yb(()=>Kct(e.absolute));this[tc](a,e)}[Z3](e,r){let o=e.mode&4095||this.fmode,a=A=>{let p;try{vn.closeSync(n)}catch(h){p=h}(A||p)&&this[Ro](A||p,e),r()},n;try{n=vn.openSync(e.absolute,Lfe(e.size),o)}catch(A){return a(A)}let u=this.transform&&this.transform(e)||e;u!==e&&(u.on("error",A=>this[Ro](A,e)),e.pipe(u)),u.on("data",A=>{try{vn.writeSync(n,A,0,A.length)}catch(p){a(p)}}),u.on("end",A=>{let p=null;if(e.mtime&&!this.noMtime){let h=e.atime||new Date,E=e.mtime;try{vn.futimesSync(n,h,E)}catch(I){try{vn.utimesSync(e.absolute,h,E)}catch{p=I}}}if(this[J1](e)){let h=this[z1](e),E=this[X1](e);try{vn.fchownSync(n,h,E)}catch(I){try{vn.chownSync(e.absolute,h,E)}catch{p=p||I}}}a(p)})}[$3](e,r){let o=e.mode&4095||this.dmode,a=this[vh](e.absolute,o);if(a){this[Ro](a,e),r();return}if(e.mtime&&!this.noMtime)try{vn.utimesSync(e.absolute,e.atime||new Date,e.mtime)}catch{}if(this[J1](e))try{vn.chownSync(e.absolute,this[z1](e),this[X1](e))}catch{}r(),e.resume()}[vh](e,r){try{return Rfe.sync(fl(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r})}catch(o){return o}}[Vb](e,r,o,a){try{vn[o+"Sync"](r,e.absolute),a(),e.resume()}catch(n){return this[Ro](n,e)}}};e2.Sync=t_;Mfe.exports=e2});var jfe=_((SUt,Hfe)=>{"use strict";var Xct=LE(),Kb=r_(),Ufe=Be("fs"),_fe=$E(),Ofe=Be("path"),n_=GE();Hfe.exports=(t,e,r)=>{typeof t=="function"?(r=t,e=null,t={}):Array.isArray(t)&&(e=t,t={}),typeof e=="function"&&(r=e,e=null),e?e=Array.from(e):e=[];let o=Xct(t);if(o.sync&&typeof r=="function")throw new TypeError("callback not supported for sync tar functions");if(!o.file&&typeof r=="function")throw new TypeError("callback only supported with file option");return e.length&&Zct(o,e),o.file&&o.sync?$ct(o):o.file?eut(o,r):o.sync?tut(o):rut(o)};var Zct=(t,e)=>{let r=new Map(e.map(n=>[n_(n),!0])),o=t.filter,a=(n,u)=>{let A=u||Ofe.parse(n).root||".",p=n===A?!1:r.has(n)?r.get(n):a(Ofe.dirname(n),A);return r.set(n,p),p};t.filter=o?(n,u)=>o(n,u)&&a(n_(n)):n=>a(n_(n))},$ct=t=>{let e=new Kb.Sync(t),r=t.file,o=Ufe.statSync(r),a=t.maxReadSize||16*1024*1024;new _fe.ReadStreamSync(r,{readSize:a,size:o.size}).pipe(e)},eut=(t,e)=>{let r=new Kb(t),o=t.maxReadSize||16*1024*1024,a=t.file,n=new Promise((u,A)=>{r.on("error",A),r.on("close",u),Ufe.stat(a,(p,h)=>{if(p)A(p);else{let E=new _fe.ReadStream(a,{readSize:o,size:h.size});E.on("error",A),E.pipe(r)}})});return e?n.then(e,e):n},tut=t=>new Kb.Sync(t),rut=t=>new Kb(t)});var qfe=_(us=>{"use strict";us.c=us.create=vAe();us.r=us.replace=O3();us.t=us.list=Lb();us.u=us.update=TAe();us.x=us.extract=jfe();us.Pack=wb();us.Unpack=r_();us.Parse=Nb();us.ReadEntry=nb();us.WriteEntry=p3();us.Header=qE();us.Pax=sb();us.types=JU()});var i_,Gfe,Dh,t2,r2,Yfe=Et(()=>{i_=$e(nd()),Gfe=Be("worker_threads"),Dh=Symbol("kTaskInfo"),t2=class{constructor(e,r){this.fn=e;this.limit=(0,i_.default)(r.poolSize)}run(e){return this.limit(()=>this.fn(e))}},r2=class{constructor(e,r){this.source=e;this.workers=[];this.limit=(0,i_.default)(r.poolSize),this.cleanupInterval=setInterval(()=>{if(this.limit.pendingCount===0&&this.limit.activeCount===0){let o=this.workers.pop();o?o.terminate():clearInterval(this.cleanupInterval)}},5e3).unref()}createWorker(){this.cleanupInterval.refresh();let e=new Gfe.Worker(this.source,{eval:!0,execArgv:[...process.execArgv,"--unhandled-rejections=strict"]});return e.on("message",r=>{if(!e[Dh])throw new Error("Assertion failed: Worker sent a result without having a task assigned");e[Dh].resolve(r),e[Dh]=null,e.unref(),this.workers.push(e)}),e.on("error",r=>{e[Dh]?.reject(r),e[Dh]=null}),e.on("exit",r=>{r!==0&&e[Dh]?.reject(new Error(`Worker exited with code ${r}`)),e[Dh]=null}),e}run(e){return this.limit(()=>{let r=this.workers.pop()??this.createWorker();return r.ref(),new Promise((o,a)=>{r[Dh]={resolve:o,reject:a},r.postMessage(e)})})}}});var Vfe=_((QUt,Wfe)=>{var s_;Wfe.exports.getContent=()=>(typeof s_>"u"&&(s_=Be("zlib").brotliDecompressSync(Buffer.from("WxhAdoB5WIOfuqt43L3v7Mn2JcoY21Esu4ZXedHKEhgnjHY7+QTdhgBVWvNP2Zx1VFXNSw6GONAGqJvu/q+qauSkoQ+clPRCLja5Twq1hTGwxoRXQ2sh1d5ddBX9KBirmXanlPSB+xojuO+tVnBns9gPMkbfJMw+ExvZiStPXEM0abHRoKhsiIawWkaDKMmchuueeNU+i6+6N+XzC4bQvyn9ePmh30nmhKTqeYA/SCSIRJfqF911L35XzhP2hk1dIqVW/0d8DDDlssChiSKhM5iERXCLJZ6LKR7h069+aX79Yooi3VGLHPfgpylWlhxlraOOnETFsjCSiWSgmPEVwWpm+fouvKexmT2yNwuhoCXKUSNRLinlagX2/PXbX+Jrzc/TtbRxMOx9Po9JKZ0tsYKV9TZHA6MfIvC/fz9n/z8/X+jMS7ouB8kYxqlETC2JE9i8Fefdw2039mJ7hXa3R2d3PERlv/ya9vUbqSjVm8wA3YCdU+tqyLCrnBfE5GrLyoGrGO1JZ62Vlq/3CdPMbq7qniDDYOS8T7/zhjkhZyw592VTe33tPd2ElYSEfZ0IFNLLNS0Y7J7SsGNPgNjnq+nXr+nCwRorpHQQy+dWdSmdw8koJ16ss40rdA8e/P/XN19H04+WjeuYDQLb6c5VUeulZ5yhPu6JworcK22981iKvb779vp1zGEwEhskFjCjZ6qWVW1sBIa4O1Eo6vnAuCr2dL+bKqY6jDYu99gkado+OOgiziIPT/luv1y8X5U+qMszyZRGiHqRqmUHQUaJWqXqBX0/nY5rwu14ZZXArv6mL92zgwXHFwBLN633464VmEGCUfjxja3joYOU1uLxzWfAQa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JmtZZokQ5fRNFuwWn/KHZ+fYlL281wPafMnfF8+KoSw0gio6+9sPqhDtKPRqJR3DMnfMg8GF+TyOj1hq3alvFdjQkzpTH4JyM96dTnON5sKdMk5K6r8lZ2q4v1o3tyv7cCgsuw19tsvVFvzsl6/B9JnPM1LzyrsyOZJ6sXtgOFrRazgsNHNclrXuRFe7bj5/5l0WNlH0KhbCNYBBi8A1/6mkff2veMBrcyePCDKfw9yq9X1Egx4xHZ7KePc2XxpkPaZxOuHx9MGBwO8zxHj39UMj4vW4VZ6QpZxlRL3ycgZgdvJMA6Z8+4g4Eoc6rCBJmuJpkNHPveMR4irSj4rD/Ul6t7wlsMiyT0dgmoN5pvIYIbsd0D/KooZpNtgCkqVIp3m/9LPKrhjPW0v/oFIrRWegkX9imZUx5VP6WXVh7kMWCYoEQMYYh0iiuX14sEy8Fw8I/JKHLKorKuP74JQ2eqp35Yd9989Ron9aZsNGYI7FRqve8ja3T1ZmcOauf8nXLKtVPuHU9M/kM+uWJYXhfBYv6EXxFw==","base64")).toString()),s_)});var Xi={};Kt(Xi,{convertToZip:()=>out,convertToZipWorker:()=>l_,extractArchiveTo:()=>Zfe,getDefaultTaskPool:()=>zfe,getTaskPoolForConfiguration:()=>Xfe,makeArchiveFromDirectory:()=>sut});function nut(t,e){switch(t){case"async":return new t2(l_,{poolSize:e});case"workers":return new r2((0,a_.getContent)(),{poolSize:e});default:throw new Error(`Assertion failed: Unknown value ${t} for taskPoolMode`)}}function zfe(){return typeof o_>"u"&&(o_=nut("workers",Ji.availableParallelism())),o_}function Xfe(t){return typeof t>"u"?zfe():ol(iut,t,()=>{let e=t.get("taskPoolMode"),r=t.get("taskPoolConcurrency");switch(e){case"async":return new t2(l_,{poolSize:r});case"workers":return new r2((0,a_.getContent)(),{poolSize:r});default:throw new Error(`Assertion failed: Unknown value ${e} for taskPoolMode`)}})}async function l_(t){let{tmpFile:e,tgz:r,compressionLevel:o,extractBufferOpts:a}=t,n=new zi(e,{create:!0,level:o,stats:Ea.makeDefaultStats()}),u=Buffer.from(r.buffer,r.byteOffset,r.byteLength);return await Zfe(u,n,a),n.saveAndClose(),e}async function sut(t,{baseFs:e=new Rn,prefixPath:r=Bt.root,compressionLevel:o,inMemory:a=!1}={}){let n;if(a)n=new zi(null,{level:o});else{let A=await oe.mktempPromise(),p=K.join(A,"archive.zip");n=new zi(p,{create:!0,level:o})}let u=K.resolve(Bt.root,r);return await n.copyPromise(u,t,{baseFs:e,stableTime:!0,stableSort:!0}),n}async function out(t,e={}){let r=await oe.mktempPromise(),o=K.join(r,"archive.zip"),a=e.compressionLevel??e.configuration?.get("compressionLevel")??"mixed",n={prefixPath:e.prefixPath,stripComponents:e.stripComponents};return await(e.taskPool??Xfe(e.configuration)).run({tmpFile:o,tgz:t,compressionLevel:a,extractBufferOpts:n}),new zi(o,{level:e.compressionLevel})}async function*aut(t){let e=new Jfe.default.Parse,r=new Kfe.PassThrough({objectMode:!0,autoDestroy:!0,emitClose:!0});e.on("entry",o=>{r.write(o)}),e.on("error",o=>{r.destroy(o)}),e.on("close",()=>{r.destroyed||r.end()}),e.end(t);for await(let o of r){let a=o;yield a,a.resume()}}async function Zfe(t,e,{stripComponents:r=0,prefixPath:o=Bt.dot}={}){function a(n){if(n.path[0]==="/")return!0;let u=n.path.split(/\//g);return!!(u.some(A=>A==="..")||u.length<=r)}for await(let n of aut(t)){if(a(n))continue;let u=K.normalize(ue.toPortablePath(n.path)).replace(/\/$/,"").split(/\//g);if(u.length<=r)continue;let A=u.slice(r).join("/"),p=K.join(o,A),h=420;switch((n.type==="Directory"||((n.mode??0)&73)!==0)&&(h|=73),n.type){case"Directory":e.mkdirpSync(K.dirname(p),{chmod:493,utimes:[vi.SAFE_TIME,vi.SAFE_TIME]}),e.mkdirSync(p,{mode:h}),e.utimesSync(p,vi.SAFE_TIME,vi.SAFE_TIME);break;case"OldFile":case"File":e.mkdirpSync(K.dirname(p),{chmod:493,utimes:[vi.SAFE_TIME,vi.SAFE_TIME]}),e.writeFileSync(p,await Vy(n),{mode:h}),e.utimesSync(p,vi.SAFE_TIME,vi.SAFE_TIME);break;case"SymbolicLink":e.mkdirpSync(K.dirname(p),{chmod:493,utimes:[vi.SAFE_TIME,vi.SAFE_TIME]}),e.symlinkSync(n.linkpath,p),e.lutimesSync(p,vi.SAFE_TIME,vi.SAFE_TIME);break}}return e}var Kfe,Jfe,a_,o_,iut,$fe=Et(()=>{Ye();Pt();nA();Kfe=Be("stream"),Jfe=$e(qfe());Yfe();jl();a_=$e(Vfe());iut=new WeakMap});var tpe=_((c_,epe)=>{(function(t,e){typeof c_=="object"?epe.exports=e():typeof define=="function"&&define.amd?define(e):t.treeify=e()})(c_,function(){function t(a,n){var u=n?"\u2514":"\u251C";return a?u+="\u2500 ":u+="\u2500\u2500\u2510",u}function e(a,n){var u=[];for(var A in a)!a.hasOwnProperty(A)||n&&typeof a[A]=="function"||u.push(A);return u}function r(a,n,u,A,p,h,E){var I="",v=0,b,C,T=A.slice(0);if(T.push([n,u])&&A.length>0&&(A.forEach(function(U,J){J>0&&(I+=(U[1]?" ":"\u2502")+" "),!C&&U[0]===n&&(C=!0)}),I+=t(a,u)+a,p&&(typeof n!="object"||n instanceof Date)&&(I+=": "+n),C&&(I+=" (circular ref.)"),E(I)),!C&&typeof n=="object"){var L=e(n,h);L.forEach(function(U){b=++v===L.length,r(U,n[U],b,T,p,h,E)})}}var o={};return o.asLines=function(a,n,u,A){var p=typeof u!="function"?u:!1;r(".",a,!1,[],n,p,A||u)},o.asTree=function(a,n,u){var A="";return r(".",a,!1,[],n,u,function(p){A+=p+` +`}),A},o})});var $s={};Kt($s,{emitList:()=>lut,emitTree:()=>spe,treeNodeToJson:()=>ipe,treeNodeToTreeify:()=>npe});function npe(t,{configuration:e}){let r={},o=0,a=(n,u)=>{let A=Array.isArray(n)?n.entries():Object.entries(n);for(let[p,h]of A){if(!h)continue;let{label:E,value:I,children:v}=h,b=[];typeof E<"u"&&b.push(md(e,E,2)),typeof I<"u"&&b.push(Ot(e,I[0],I[1])),b.length===0&&b.push(md(e,`${p}`,2));let C=b.join(": ").trim(),T=`\0${o++}\0`,L=u[`${T}${C}`]={};typeof v<"u"&&a(v,L)}};if(typeof t.children>"u")throw new Error("The root node must only contain children");return a(t.children,r),r}function ipe(t){let e=r=>{if(typeof r.children>"u"){if(typeof r.value>"u")throw new Error("Assertion failed: Expected a value to be set if the children are missing");return yd(r.value[0],r.value[1])}let o=Array.isArray(r.children)?r.children.entries():Object.entries(r.children??{}),a=Array.isArray(r.children)?[]:{};for(let[n,u]of o)u&&(a[cut(n)]=e(u));return typeof r.value>"u"?a:{value:yd(r.value[0],r.value[1]),children:a}};return e(t)}function lut(t,{configuration:e,stdout:r,json:o}){let a=t.map(n=>({value:n}));spe({children:a},{configuration:e,stdout:r,json:o})}function spe(t,{configuration:e,stdout:r,json:o,separators:a=0}){if(o){let u=Array.isArray(t.children)?t.children.values():Object.values(t.children??{});for(let A of u)A&&r.write(`${JSON.stringify(ipe(A))} +`);return}let n=(0,rpe.asTree)(npe(t,{configuration:e}),!1,!1);if(n=n.replace(/\0[0-9]+\0/g,""),a>=1&&(n=n.replace(/^([├└]─)/gm,`\u2502 +$1`).replace(/^│\n/,"")),a>=2)for(let u=0;u<2;++u)n=n.replace(/^([│ ].{2}[├│ ].{2}[^\n]+\n)(([│ ]).{2}[├└].{2}[^\n]*\n[│ ].{2}[│ ].{2}[├└]─)/gm,`$1$3 \u2502 +$2`).replace(/^│\n/,"");if(a>=3)throw new Error("Only the first two levels are accepted by treeUtils.emitTree");r.write(n)}function cut(t){return typeof t=="string"?t.replace(/^\0[0-9]+\0/,""):t}var rpe,ope=Et(()=>{rpe=$e(tpe());ql()});function n2(t){let e=t.match(uut);if(!e?.groups)throw new Error("Assertion failed: Expected the checksum to match the requested pattern");let r=e.groups.cacheVersion?parseInt(e.groups.cacheVersion):null;return{cacheKey:e.groups.cacheKey??null,cacheVersion:r,cacheSpec:e.groups.cacheSpec??null,hash:e.groups.hash}}var ape,u_,A_,Jb,Lr,uut,f_=Et(()=>{Ye();Pt();Pt();nA();ape=Be("crypto"),u_=$e(Be("fs"));Yl();rh();jl();xo();A_=Ky(process.env.YARN_CACHE_CHECKPOINT_OVERRIDE??process.env.YARN_CACHE_VERSION_OVERRIDE??9),Jb=Ky(process.env.YARN_CACHE_VERSION_OVERRIDE??10),Lr=class{constructor(e,{configuration:r,immutable:o=r.get("enableImmutableCache"),check:a=!1}){this.markedFiles=new Set;this.mutexes=new Map;this.cacheId=`-${(0,ape.randomBytes)(8).toString("hex")}.tmp`;this.configuration=r,this.cwd=e,this.immutable=o,this.check=a;let{cacheSpec:n,cacheKey:u}=Lr.getCacheKey(r);this.cacheSpec=n,this.cacheKey=u}static async find(e,{immutable:r,check:o}={}){let a=new Lr(e.get("cacheFolder"),{configuration:e,immutable:r,check:o});return await a.setup(),a}static getCacheKey(e){let r=e.get("compressionLevel"),o=r!=="mixed"?`c${r}`:"";return{cacheKey:[Jb,o].join(""),cacheSpec:o}}get mirrorCwd(){if(!this.configuration.get("enableMirror"))return null;let e=`${this.configuration.get("globalFolder")}/cache`;return e!==this.cwd?e:null}getVersionFilename(e){return`${aE(e)}-${this.cacheKey}.zip`}getChecksumFilename(e,r){let a=n2(r).hash.slice(0,10);return`${aE(e)}-${a}.zip`}isChecksumCompatible(e){if(e===null)return!1;let{cacheVersion:r,cacheSpec:o}=n2(e);if(r===null||r{let ae=new zi,we=K.join(Bt.root,sO(e));return ae.mkdirSync(we,{recursive:!0}),ae.writeJsonSync(K.join(we,dr.manifest),{name:fn(e),mocked:!0}),ae},E=async(ae,{isColdHit:we,controlPath:Pe=null})=>{if(Pe===null&&u.unstablePackages?.has(e.locatorHash))return{isValid:!0,hash:null};let g=r&&!we?n2(r).cacheKey:this.cacheKey,Ee=!u.skipIntegrityCheck||!r?`${g}/${await LS(ae)}`:r;if(Pe!==null){let ce=!u.skipIntegrityCheck||!r?`${this.cacheKey}/${await LS(Pe)}`:r;if(Ee!==ce)throw new zt(18,"The remote archive doesn't match the local checksum - has the local cache been corrupted?")}let De=null;switch(r!==null&&Ee!==r&&(this.check?De="throw":n2(r).cacheKey!==n2(Ee).cacheKey?De="update":De=this.configuration.get("checksumBehavior")),De){case null:case"update":return{isValid:!0,hash:Ee};case"ignore":return{isValid:!0,hash:r};case"reset":return{isValid:!1,hash:r};default:case"throw":throw new zt(18,"The remote archive doesn't match the expected checksum")}},I=async ae=>{if(!n)throw new Error(`Cache check required but no loader configured for ${jr(this.configuration,e)}`);let we=await n(),Pe=we.getRealPath();we.saveAndClose(),await oe.chmodPromise(Pe,420);let g=await E(ae,{controlPath:Pe,isColdHit:!1});if(!g.isValid)throw new Error("Assertion failed: Expected a valid checksum");return g.hash},v=async()=>{if(A===null||!await oe.existsPromise(A)){let ae=await n(),we=ae.getRealPath();return ae.saveAndClose(),{source:"loader",path:we}}return{source:"mirror",path:A}},b=async()=>{if(!n)throw new Error(`Cache entry required but missing for ${jr(this.configuration,e)}`);if(this.immutable)throw new zt(56,`Cache entry required but missing for ${jr(this.configuration,e)}`);let{path:ae,source:we}=await v(),{hash:Pe}=await E(ae,{isColdHit:!0}),g=this.getLocatorPath(e,Pe),Ee=[];we!=="mirror"&&A!==null&&Ee.push(async()=>{let ce=`${A}${this.cacheId}`;await oe.copyFilePromise(ae,ce,u_.default.constants.COPYFILE_FICLONE),await oe.chmodPromise(ce,420),await oe.renamePromise(ce,A)}),(!u.mirrorWriteOnly||A===null)&&Ee.push(async()=>{let ce=`${g}${this.cacheId}`;await oe.copyFilePromise(ae,ce,u_.default.constants.COPYFILE_FICLONE),await oe.chmodPromise(ce,420),await oe.renamePromise(ce,g)});let De=u.mirrorWriteOnly?A??g:g;return await Promise.all(Ee.map(ce=>ce())),[!1,De,Pe]},C=async()=>{let we=(async()=>{let Pe=u.unstablePackages?.has(e.locatorHash),g=Pe||!r||this.isChecksumCompatible(r)?this.getLocatorPath(e,r):null,Ee=g!==null?this.markedFiles.has(g)||await p.existsPromise(g):!1,De=!!u.mockedPackages?.has(e.locatorHash)&&(!this.check||!Ee),ce=De||Ee,ne=ce?o:a;if(ne&&ne(),ce){let ee=null,Ie=g;if(!De)if(this.check)ee=await I(Ie);else{let ke=await E(Ie,{isColdHit:!1});if(ke.isValid)ee=ke.hash;else return b()}return[De,Ie,ee]}else{if(this.immutable&&Pe)throw new zt(56,`Cache entry required but missing for ${jr(this.configuration,e)}; consider defining ${de.pretty(this.configuration,"supportedArchitectures",de.Type.CODE)} to cache packages for multiple systems`);return b()}})();this.mutexes.set(e.locatorHash,we);try{return await we}finally{this.mutexes.delete(e.locatorHash)}};for(let ae;ae=this.mutexes.get(e.locatorHash);)await ae;let[T,L,U]=await C();T||this.markedFiles.add(L);let J,te=T?()=>h():()=>new zi(L,{baseFs:p,readOnly:!0}),le=new ny(()=>wL(()=>J=te(),ae=>`Failed to open the cache entry for ${jr(this.configuration,e)}: ${ae}`),K),pe=new Uu(L,{baseFs:le,pathUtils:K}),Ae=()=>{J?.discardAndClose()},ye=u.unstablePackages?.has(e.locatorHash)?null:U;return[pe,Ae,ye]}},uut=/^(?:(?(?[0-9]+)(?.*))\/)?(?.*)$/});var zb,lpe=Et(()=>{zb=(r=>(r[r.SCRIPT=0]="SCRIPT",r[r.SHELLCODE=1]="SHELLCODE",r))(zb||{})});var Aut,sC,p_=Et(()=>{Pt();Nl();kf();xo();Aut=[[/^(git(?:\+(?:https|ssh))?:\/\/.*(?:\.git)?)#(.*)$/,(t,e,r,o)=>`${r}#commit=${o}`],[/^https:\/\/((?:[^/]+?)@)?codeload\.github\.com\/([^/]+\/[^/]+)\/tar\.gz\/([0-9a-f]+)$/,(t,e,r="",o,a)=>`https://${r}github.com/${o}.git#commit=${a}`],[/^https:\/\/((?:[^/]+?)@)?github\.com\/([^/]+\/[^/]+?)(?:\.git)?#([0-9a-f]+)$/,(t,e,r="",o,a)=>`https://${r}github.com/${o}.git#commit=${a}`],[/^https?:\/\/[^/]+\/(?:[^/]+\/)*(?:@.+(?:\/|(?:%2f)))?([^/]+)\/(?:-|download)\/\1-[^/]+\.tgz(?:#|$)/,t=>`npm:${t}`],[/^https:\/\/npm\.pkg\.github\.com\/download\/(?:@[^/]+)\/(?:[^/]+)\/(?:[^/]+)\/(?:[0-9a-f]+)(?:#|$)/,t=>`npm:${t}`],[/^https:\/\/npm\.fontawesome\.com\/(?:@[^/]+)\/([^/]+)\/-\/([^/]+)\/\1-\2.tgz(?:#|$)/,t=>`npm:${t}`],[/^https?:\/\/[^/]+\/.*\/(@[^/]+)\/([^/]+)\/-\/\1\/\2-(?:[.\d\w-]+)\.tgz(?:#|$)/,(t,e)=>HS({protocol:"npm:",source:null,selector:t,params:{__archiveUrl:e}})],[/^[^/]+\.tgz#[0-9a-f]+$/,t=>`npm:${t}`]],sC=class{constructor(e){this.resolver=e;this.resolutions=null}async setup(e,{report:r}){let o=K.join(e.cwd,dr.lockfile);if(!oe.existsSync(o))return;let a=await oe.readFilePromise(o,"utf8"),n=Vi(a);if(Object.hasOwn(n,"__metadata"))return;let u=this.resolutions=new Map;for(let A of Object.keys(n)){let p=i1(A);if(!p){r.reportWarning(14,`Failed to parse the string "${A}" into a proper descriptor`);continue}let h=ba(p.range)?In(p,`npm:${p.range}`):p,{version:E,resolved:I}=n[A];if(!I)continue;let v;for(let[C,T]of Aut){let L=I.match(C);if(L){v=T(E,...L);break}}if(!v){r.reportWarning(14,`${qn(e.configuration,h)}: Only some patterns can be imported from legacy lockfiles (not "${I}")`);continue}let b=h;try{let C=Id(h.range),T=i1(C.selector,!0);T&&(b=T)}catch{}u.set(h.descriptorHash,Qs(b,v))}}supportsDescriptor(e,r){return this.resolutions?this.resolutions.has(e.descriptorHash):!1}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Assertion failed: This resolver doesn't support resolving locators to packages")}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){if(!this.resolutions)throw new Error("Assertion failed: The resolution store should have been setup");let a=this.resolutions.get(e.descriptorHash);if(!a)throw new Error("Assertion failed: The resolution should have been registered");let n=tO(a),u=o.project.configuration.normalizeDependency(n);return await this.resolver.getCandidates(u,r,o)}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){throw new Error("Assertion failed: This resolver doesn't support resolving locators to packages")}}});var AA,cpe=Et(()=>{Yl();L1();ql();AA=class extends Xs{constructor({configuration:r,stdout:o,suggestInstall:a=!0}){super();this.errorCount=0;zI(this,{configuration:r}),this.configuration=r,this.stdout=o,this.suggestInstall=a}static async start(r,o){let a=new this(r);try{await o(a)}catch(n){a.reportExceptionOnce(n)}finally{await a.finalize()}return a}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}reportCacheHit(r){}reportCacheMiss(r){}startSectionSync(r,o){return o()}async startSectionPromise(r,o){return await o()}startTimerSync(r,o,a){return(typeof o=="function"?o:a)()}async startTimerPromise(r,o,a){return await(typeof o=="function"?o:a)()}reportSeparator(){}reportInfo(r,o){}reportWarning(r,o){}reportError(r,o){this.errorCount+=1,this.stdout.write(`${Ot(this.configuration,"\u27A4","redBright")} ${this.formatNameWithHyperlink(r)}: ${o} +`)}reportProgress(r){return{...Promise.resolve().then(async()=>{for await(let{}of r);}),stop:()=>{}}}reportJson(r){}reportFold(r,o){}async finalize(){this.errorCount>0&&(this.stdout.write(` +`),this.stdout.write(`${Ot(this.configuration,"\u27A4","redBright")} Errors happened when preparing the environment required to run this command. +`),this.suggestInstall&&this.stdout.write(`${Ot(this.configuration,"\u27A4","redBright")} This might be caused by packages being missing from the lockfile, in which case running "yarn install" might help. +`))}formatNameWithHyperlink(r){return CU(r,{configuration:this.configuration,json:!1})}}});var oC,h_=Et(()=>{xo();oC=class{constructor(e){this.resolver=e}supportsDescriptor(e,r){return!!(r.project.storedResolutions.get(e.descriptorHash)||r.project.originalPackages.has(OS(e).locatorHash))}supportsLocator(e,r){return!!(r.project.originalPackages.has(e.locatorHash)&&!r.project.lockfileNeedsRefresh)}shouldPersistResolution(e,r){throw new Error("The shouldPersistResolution method shouldn't be called on the lockfile resolver, which would always answer yes")}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return this.resolver.getResolutionDependencies(e,r)}async getCandidates(e,r,o){let a=o.project.storedResolutions.get(e.descriptorHash);if(a){let u=o.project.originalPackages.get(a);if(u)return[u]}let n=o.project.originalPackages.get(OS(e).locatorHash);if(n)return[n];throw new Error("Resolution expected from the lockfile data")}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let o=r.project.originalPackages.get(e.locatorHash);if(!o)throw new Error("The lockfile resolver isn't meant to resolve packages - they should already have been stored into a cache");return o}}});function Wf(){}function fut(t,e,r,o,a){for(var n=0,u=e.length,A=0,p=0;nb.length?T:b}),h.value=t.join(E)}else h.value=t.join(r.slice(A,A+h.count));A+=h.count,h.added||(p+=h.count)}}var v=e[u-1];return u>1&&typeof v.value=="string"&&(v.added||v.removed)&&t.equals("",v.value)&&(e[u-2].value+=v.value,e.pop()),e}function put(t){return{newPos:t.newPos,components:t.components.slice(0)}}function hut(t,e){if(typeof t=="function")e.callback=t;else if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function fpe(t,e,r){return r=hut(r,{ignoreWhitespace:!0}),E_.diff(t,e,r)}function gut(t,e,r){return C_.diff(t,e,r)}function Xb(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Xb=function(e){return typeof e}:Xb=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xb(t)}function g_(t){return yut(t)||Eut(t)||Cut(t)||wut()}function yut(t){if(Array.isArray(t))return d_(t)}function Eut(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function Cut(t,e){if(!!t){if(typeof t=="string")return d_(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d_(t,e)}}function d_(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r"u"&&(u.context=4);var A=gut(r,o,u);if(!A)return;A.push({value:"",lines:[]});function p(U){return U.map(function(J){return" "+J})}for(var h=[],E=0,I=0,v=[],b=1,C=1,T=function(J){var te=A[J],le=te.lines||te.value.replace(/\n$/,"").split(` +`);if(te.lines=le,te.added||te.removed){var pe;if(!E){var Ae=A[J-1];E=b,I=C,Ae&&(v=u.context>0?p(Ae.lines.slice(-u.context)):[],E-=v.length,I-=v.length)}(pe=v).push.apply(pe,g_(le.map(function(ce){return(te.added?"+":"-")+ce}))),te.added?C+=le.length:b+=le.length}else{if(E)if(le.length<=u.context*2&&J=A.length-2&&le.length<=u.context){var g=/\n$/.test(r),Ee=/\n$/.test(o),De=le.length==0&&v.length>Pe.oldLines;!g&&De&&r.length>0&&v.splice(Pe.oldLines,0,"\\ No newline at end of file"),(!g&&!De||!Ee)&&v.push("\\ No newline at end of file")}h.push(Pe),E=0,I=0,v=[]}b+=le.length,C+=le.length}},L=0;L{Wf.prototype={diff:function(e,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.callback;typeof o=="function"&&(a=o,o={}),this.options=o;var n=this;function u(T){return a?(setTimeout(function(){a(void 0,T)},0),!0):T}e=this.castInput(e),r=this.castInput(r),e=this.removeEmpty(this.tokenize(e)),r=this.removeEmpty(this.tokenize(r));var A=r.length,p=e.length,h=1,E=A+p;o.maxEditLength&&(E=Math.min(E,o.maxEditLength));var I=[{newPos:-1,components:[]}],v=this.extractCommon(I[0],r,e,0);if(I[0].newPos+1>=A&&v+1>=p)return u([{value:this.join(r),count:r.length}]);function b(){for(var T=-1*h;T<=h;T+=2){var L=void 0,U=I[T-1],J=I[T+1],te=(J?J.newPos:0)-T;U&&(I[T-1]=void 0);var le=U&&U.newPos+1=A&&te+1>=p)return u(fut(n,L.components,r,e,n.useLongestToken));I[T]=L}h++}if(a)(function T(){setTimeout(function(){if(h>E)return a();b()||T()},0)})();else for(;h<=E;){var C=b();if(C)return C}},pushComponent:function(e,r,o){var a=e[e.length-1];a&&a.added===r&&a.removed===o?e[e.length-1]={count:a.count+1,added:r,removed:o}:e.push({count:1,added:r,removed:o})},extractCommon:function(e,r,o,a){for(var n=r.length,u=o.length,A=e.newPos,p=A-a,h=0;A+1"u"?r:u}:o;return typeof t=="string"?t:JSON.stringify(m_(t,null,null,a),a," ")};i2.equals=function(t,e){return Wf.prototype.equals.call(i2,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};y_=new Wf;y_.tokenize=function(t){return t.slice()};y_.join=y_.removeEmpty=function(t){return t}});var gpe=_((o3t,hpe)=>{var But=Hl(),vut=fE(),Dut=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Put=/^\w*$/;function Sut(t,e){if(But(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||vut(t)?!0:Put.test(t)||!Dut.test(t)||e!=null&&t in Object(e)}hpe.exports=Sut});var ype=_((a3t,mpe)=>{var dpe=_P(),xut="Expected a function";function I_(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(xut);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],n=r.cache;if(n.has(a))return n.get(a);var u=t.apply(this,o);return r.cache=n.set(a,u)||n,u};return r.cache=new(I_.Cache||dpe),r}I_.Cache=dpe;mpe.exports=I_});var Cpe=_((l3t,Epe)=>{var but=ype(),kut=500;function Qut(t){var e=but(t,function(o){return r.size===kut&&r.clear(),o}),r=e.cache;return e}Epe.exports=Qut});var B_=_((c3t,wpe)=>{var Fut=Cpe(),Tut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rut=/\\(\\)?/g,Nut=Fut(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Tut,function(r,o,a,n){e.push(a?n.replace(Rut,"$1"):o||r)}),e});wpe.exports=Nut});var jd=_((u3t,Ipe)=>{var Lut=Hl(),Mut=gpe(),Out=B_(),Uut=R1();function _ut(t,e){return Lut(t)?t:Mut(t,e)?[t]:Out(Uut(t))}Ipe.exports=_ut});var aC=_((A3t,Bpe)=>{var Hut=fE(),jut=1/0;function qut(t){if(typeof t=="string"||Hut(t))return t;var e=t+"";return e=="0"&&1/t==-jut?"-0":e}Bpe.exports=qut});var Zb=_((f3t,vpe)=>{var Gut=jd(),Yut=aC();function Wut(t,e){e=Gut(e,t);for(var r=0,o=e.length;t!=null&&r{var Vut=rS(),Kut=jd(),Jut=UI(),Dpe=il(),zut=aC();function Xut(t,e,r,o){if(!Dpe(t))return t;e=Kut(e,t);for(var a=-1,n=e.length,u=n-1,A=t;A!=null&&++a{var Zut=Zb(),$ut=v_(),eAt=jd();function tAt(t,e,r){for(var o=-1,a=e.length,n={};++o{function rAt(t,e){return t!=null&&e in Object(t)}bpe.exports=rAt});var D_=_((d3t,Qpe)=>{var nAt=jd(),iAt=LI(),sAt=Hl(),oAt=UI(),aAt=YP(),lAt=aC();function cAt(t,e,r){e=nAt(e,t);for(var o=-1,a=e.length,n=!1;++o{var uAt=kpe(),AAt=D_();function fAt(t,e){return t!=null&&AAt(t,e,uAt)}Fpe.exports=fAt});var Npe=_((y3t,Rpe)=>{var pAt=xpe(),hAt=Tpe();function gAt(t,e){return pAt(t,e,function(r,o){return hAt(t,o)})}Rpe.exports=gAt});var Upe=_((E3t,Ope)=>{var Lpe=fd(),dAt=LI(),mAt=Hl(),Mpe=Lpe?Lpe.isConcatSpreadable:void 0;function yAt(t){return mAt(t)||dAt(t)||!!(Mpe&&t&&t[Mpe])}Ope.exports=yAt});var jpe=_((C3t,Hpe)=>{var EAt=qP(),CAt=Upe();function _pe(t,e,r,o,a){var n=-1,u=t.length;for(r||(r=CAt),a||(a=[]);++n0&&r(A)?e>1?_pe(A,e-1,r,o,a):EAt(a,A):o||(a[a.length]=A)}return a}Hpe.exports=_pe});var Gpe=_((w3t,qpe)=>{var wAt=jpe();function IAt(t){var e=t==null?0:t.length;return e?wAt(t,1):[]}qpe.exports=IAt});var P_=_((I3t,Ype)=>{var BAt=Gpe(),vAt=pL(),DAt=hL();function PAt(t){return DAt(vAt(t,void 0,BAt),t+"")}Ype.exports=PAt});var S_=_((B3t,Wpe)=>{var SAt=Npe(),xAt=P_(),bAt=xAt(function(t,e){return t==null?{}:SAt(t,e)});Wpe.exports=bAt});var $b,Vpe=Et(()=>{Yl();$b=class{constructor(e){this.resolver=e}supportsDescriptor(e,r){return this.resolver.supportsDescriptor(e,r)}supportsLocator(e,r){return this.resolver.supportsLocator(e,r)}shouldPersistResolution(e,r){return this.resolver.shouldPersistResolution(e,r)}bindDescriptor(e,r,o){return this.resolver.bindDescriptor(e,r,o)}getResolutionDependencies(e,r){return this.resolver.getResolutionDependencies(e,r)}async getCandidates(e,r,o){throw new zt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async getSatisfying(e,r,o,a){throw new zt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async resolve(e,r){throw new zt(20,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}}});var Qi,x_=Et(()=>{Yl();Qi=class extends Xs{reportCacheHit(e){}reportCacheMiss(e){}startSectionSync(e,r){return r()}async startSectionPromise(e,r){return await r()}startTimerSync(e,r,o){return(typeof r=="function"?r:o)()}async startTimerPromise(e,r,o){return await(typeof r=="function"?r:o)()}reportSeparator(){}reportInfo(e,r){}reportWarning(e,r){}reportError(e,r){}reportProgress(e){return{...Promise.resolve().then(async()=>{for await(let{}of e);}),stop:()=>{}}}reportJson(e){}reportFold(e,r){}async finalize(){}}});var Kpe,lC,b_=Et(()=>{Pt();Kpe=$e(RS());AE();Bd();ql();rh();kf();xo();lC=class{constructor(e,{project:r}){this.workspacesCwds=new Set;this.project=r,this.cwd=e}async setup(){this.manifest=await Mt.tryFind(this.cwd)??new Mt,this.relativeCwd=K.relative(this.project.cwd,this.cwd)||Bt.dot;let e=this.manifest.name?this.manifest.name:eA(null,`${this.computeCandidateName()}-${zs(this.relativeCwd).substring(0,6)}`);this.anchoredDescriptor=In(e,`${Xn.protocol}${this.relativeCwd}`),this.anchoredLocator=Qs(e,`${Xn.protocol}${this.relativeCwd}`);let r=this.manifest.workspaceDefinitions.map(({pattern:a})=>a);if(r.length===0)return;let o=await(0,Kpe.default)(r,{cwd:ue.fromPortablePath(this.cwd),onlyDirectories:!0,ignore:["**/node_modules","**/.git","**/.yarn"]});o.sort(),await o.reduce(async(a,n)=>{let u=K.resolve(this.cwd,ue.toPortablePath(n)),A=await oe.existsPromise(K.join(u,"package.json"));await a,A&&this.workspacesCwds.add(u)},Promise.resolve())}get anchoredPackage(){let e=this.project.storedPackages.get(this.anchoredLocator.locatorHash);if(!e)throw new Error(`Assertion failed: Expected workspace ${o1(this.project.configuration,this)} (${Ot(this.project.configuration,K.join(this.cwd,dr.manifest),yt.PATH)}) to have been resolved. Run "yarn install" to update the lockfile`);return e}accepts(e){let r=e.indexOf(":"),o=r!==-1?e.slice(0,r+1):null,a=r!==-1?e.slice(r+1):e;if(o===Xn.protocol&&K.normalize(a)===this.relativeCwd||o===Xn.protocol&&(a==="*"||a==="^"||a==="~"))return!0;let n=ba(a);return n?o===Xn.protocol?n.test(this.manifest.version??"0.0.0"):this.project.configuration.get("enableTransparentWorkspaces")&&this.manifest.version!==null?n.test(this.manifest.version):!1:!1}computeCandidateName(){return this.cwd===this.project.cwd?"root-workspace":`${K.basename(this.cwd)}`||"unnamed-workspace"}getRecursiveWorkspaceDependencies({dependencies:e=Mt.hardDependencies}={}){let r=new Set,o=a=>{for(let n of e)for(let u of a.manifest[n].values()){let A=this.project.tryWorkspaceByDescriptor(u);A===null||r.has(A)||(r.add(A),o(A))}};return o(this),r}getRecursiveWorkspaceDependents({dependencies:e=Mt.hardDependencies}={}){let r=new Set,o=a=>{for(let n of this.project.workspaces)e.some(A=>[...n.manifest[A].values()].some(p=>{let h=this.project.tryWorkspaceByDescriptor(p);return h!==null&&n1(h.anchoredLocator,a.anchoredLocator)}))&&!r.has(n)&&(r.add(n),o(n))};return o(this),r}getRecursiveWorkspaceChildren(){let e=new Set([this]);for(let r of e)for(let o of r.workspacesCwds){let a=this.project.workspacesByCwd.get(o);a&&e.add(a)}return e.delete(this),Array.from(e)}async persistManifest(){let e={};this.manifest.exportTo(e);let r=K.join(this.cwd,Mt.fileName),o=`${JSON.stringify(e,null,this.manifest.indent)} +`;await oe.changeFilePromise(r,o,{automaticNewlines:!0}),this.manifest.raw=e}}});function NAt({project:t,allDescriptors:e,allResolutions:r,allPackages:o,accessibleLocators:a=new Set,optionalBuilds:n=new Set,peerRequirements:u=new Map,peerWarnings:A=[],volatileDescriptors:p=new Set}){let h=new Map,E=[],I=new Map,v=new Map,b=new Map,C=new Map,T=new Map,L=new Map(t.workspaces.map(Ae=>{let ye=Ae.anchoredLocator.locatorHash,ae=o.get(ye);if(typeof ae>"u")throw new Error("Assertion failed: The workspace should have an associated package");return[ye,$I(ae)]})),U=()=>{let Ae=oe.mktempSync(),ye=K.join(Ae,"stacktrace.log"),ae=String(E.length+1).length,we=E.map((Pe,g)=>`${`${g+1}.`.padStart(ae," ")} ${xa(Pe)} +`).join("");throw oe.writeFileSync(ye,we),oe.detachTemp(Ae),new zt(45,`Encountered a stack overflow when resolving peer dependencies; cf ${ue.fromPortablePath(ye)}`)},J=Ae=>{let ye=r.get(Ae.descriptorHash);if(typeof ye>"u")throw new Error("Assertion failed: The resolution should have been registered");let ae=o.get(ye);if(!ae)throw new Error("Assertion failed: The package could not be found");return ae},te=(Ae,ye,ae,{top:we,optional:Pe})=>{E.length>1e3&&U(),E.push(ye);let g=le(Ae,ye,ae,{top:we,optional:Pe});return E.pop(),g},le=(Ae,ye,ae,{top:we,optional:Pe})=>{if(a.has(ye.locatorHash))return;a.add(ye.locatorHash),Pe||n.delete(ye.locatorHash);let g=o.get(ye.locatorHash);if(!g)throw new Error(`Assertion failed: The package (${jr(t.configuration,ye)}) should have been registered`);let Ee=[],De=[],ce=[],ne=[],ee=[];for(let ke of Array.from(g.dependencies.values())){if(g.peerDependencies.has(ke.identHash)&&g.locatorHash!==we)continue;if(Sf(ke))throw new Error("Assertion failed: Virtual packages shouldn't be encountered when virtualizing a branch");p.delete(ke.descriptorHash);let ht=Pe;if(!ht){let Te=g.dependenciesMeta.get(fn(ke));if(typeof Te<"u"){let Je=Te.get(null);typeof Je<"u"&&Je.optional&&(ht=!0)}}let H=r.get(ke.descriptorHash);if(!H)throw new Error(`Assertion failed: The resolution (${qn(t.configuration,ke)}) should have been registered`);let lt=L.get(H)||o.get(H);if(!lt)throw new Error(`Assertion failed: The package (${H}, resolved from ${qn(t.configuration,ke)}) should have been registered`);if(lt.peerDependencies.size===0){te(ke,lt,new Map,{top:we,optional:ht});continue}let Re,Qe,be=new Set,_e;De.push(()=>{Re=nO(ke,ye.locatorHash),Qe=iO(lt,ye.locatorHash),g.dependencies.delete(ke.identHash),g.dependencies.set(Re.identHash,Re),r.set(Re.descriptorHash,Qe.locatorHash),e.set(Re.descriptorHash,Re),o.set(Qe.locatorHash,Qe),Ee.push([lt,Re,Qe])}),ce.push(()=>{_e=new Map;for(let Te of Qe.peerDependencies.values()){let Je=g.dependencies.get(Te.identHash);if(!Je&&r1(ye,Te)&&(Ae.identHash===ye.identHash?Je=Ae:(Je=In(ye,Ae.range),e.set(Je.descriptorHash,Je),r.set(Je.descriptorHash,ye.locatorHash),p.delete(Je.descriptorHash))),(!Je||Je.range==="missing:")&&Qe.dependencies.has(Te.identHash)){Qe.peerDependencies.delete(Te.identHash);continue}Je||(Je=In(Te,"missing:")),Qe.dependencies.set(Je.identHash,Je),Sf(Je)&&dd(b,Je.descriptorHash).add(Qe.locatorHash),I.set(Je.identHash,Je),Je.range==="missing:"&&be.add(Je.identHash),_e.set(Te.identHash,ae.get(Te.identHash)??Qe.locatorHash)}Qe.dependencies=new Map(ks(Qe.dependencies,([Te,Je])=>fn(Je)))}),ne.push(()=>{if(!o.has(Qe.locatorHash))return;let Te=h.get(lt.locatorHash);typeof Te=="number"&&Te>=2&&U();let Je=h.get(lt.locatorHash),He=typeof Je<"u"?Je+1:1;h.set(lt.locatorHash,He),te(Re,Qe,_e,{top:we,optional:ht}),h.set(lt.locatorHash,He-1)}),ee.push(()=>{let Te=g.dependencies.get(ke.identHash);if(typeof Te>"u")throw new Error("Assertion failed: Expected the peer dependency to have been turned into a dependency");let Je=r.get(Te.descriptorHash);if(typeof Je>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");if(dd(T,Je).add(ye.locatorHash),!!o.has(Qe.locatorHash)){for(let He of Qe.peerDependencies.values()){let x=_e.get(He.identHash);if(typeof x>"u")throw new Error("Assertion failed: Expected the peer dependency ident to be registered");Gy(Yy(C,x),fn(He)).push(Qe.locatorHash)}for(let He of be)Qe.dependencies.delete(He)}})}for(let ke of[...De,...ce])ke();let Ie;do{Ie=!0;for(let[ke,ht,H]of Ee){let lt=Yy(v,ke.locatorHash),Re=zs(...[...H.dependencies.values()].map(Te=>{let Je=Te.range!=="missing:"?r.get(Te.descriptorHash):"missing:";if(typeof Je>"u")throw new Error(`Assertion failed: Expected the resolution for ${qn(t.configuration,Te)} to have been registered`);return Je===we?`${Je} (top)`:Je}),ht.identHash),Qe=lt.get(Re);if(typeof Qe>"u"){lt.set(Re,ht);continue}if(Qe===ht)continue;o.delete(H.locatorHash),e.delete(ht.descriptorHash),r.delete(ht.descriptorHash),a.delete(H.locatorHash);let be=b.get(ht.descriptorHash)||[],_e=[g.locatorHash,...be];b.delete(ht.descriptorHash);for(let Te of _e){let Je=o.get(Te);typeof Je>"u"||(Je.dependencies.get(ht.identHash).descriptorHash!==Qe.descriptorHash&&(Ie=!1),Je.dependencies.set(ht.identHash,Qe))}}}while(!Ie);for(let ke of[...ne,...ee])ke()};for(let Ae of t.workspaces){let ye=Ae.anchoredLocator;p.delete(Ae.anchoredDescriptor.descriptorHash),te(Ae.anchoredDescriptor,ye,new Map,{top:ye.locatorHash,optional:!1})}let pe=new Map;for(let[Ae,ye]of T){let ae=o.get(Ae);if(typeof ae>"u")throw new Error("Assertion failed: Expected the root to be registered");let we=C.get(Ae);if(!(typeof we>"u"))for(let Pe of ye){let g=o.get(Pe);if(!(typeof g>"u")&&!!t.tryWorkspaceByLocator(g))for(let[Ee,De]of we){let ce=Js(Ee);if(g.peerDependencies.has(ce.identHash))continue;let ne=`p${zs(Pe,Ee,Ae).slice(0,5)}`;u.set(ne,{subject:Pe,requested:ce,rootRequester:Ae,allRequesters:De});let ee=ae.dependencies.get(ce.identHash);if(typeof ee<"u"){let Ie=J(ee),ke=Ie.version??"0.0.0",ht=new Set;for(let lt of De){let Re=o.get(lt);if(typeof Re>"u")throw new Error("Assertion failed: Expected the link to be registered");let Qe=Re.peerDependencies.get(ce.identHash);if(typeof Qe>"u")throw new Error("Assertion failed: Expected the ident to be registered");ht.add(Qe.range)}if(![...ht].every(lt=>{if(lt.startsWith(Xn.protocol)){if(!t.tryWorkspaceByLocator(Ie))return!1;lt=lt.slice(Xn.protocol.length),(lt==="^"||lt==="~")&&(lt="*")}return bf(ke,lt)})){let lt=ol(pe,Ie.locatorHash,()=>({type:2,requested:ce,subject:Ie,dependents:new Map,requesters:new Map,links:new Map,version:ke,hash:`p${Ie.locatorHash.slice(0,5)}`}));lt.dependents.set(g.locatorHash,g),lt.requesters.set(ae.locatorHash,ae);for(let Re of De)lt.links.set(Re,o.get(Re));A.push({type:1,subject:g,requested:ce,requester:ae,version:ke,hash:ne,requirementCount:De.length})}}else ae.peerDependenciesMeta.get(Ee)?.optional||A.push({type:0,subject:g,requested:ce,requester:ae,hash:ne})}}}A.push(...pe.values())}function LAt(t,e){let r=BL(t.peerWarnings,"type"),o=r[2]?.map(n=>{let u=Array.from(n.links.values(),E=>{let I=t.storedPackages.get(E.locatorHash);if(typeof I>"u")throw new Error("Assertion failed: Expected the package to be registered");let v=I.peerDependencies.get(n.requested.identHash);if(typeof v>"u")throw new Error("Assertion failed: Expected the ident to be registered");return v.range}),A=n.links.size>1?"and other dependencies request":"requests",p=aO(u),h=p?lE(t.configuration,p):Ot(t.configuration,"but they have non-overlapping ranges!","redBright");return`${cs(t.configuration,n.requested)} is listed by your project with version ${s1(t.configuration,n.version)}, which doesn't satisfy what ${cs(t.configuration,n.requesters.values().next().value)} (${Ot(t.configuration,n.hash,yt.CODE)}) ${A} (${h}).`})??[],a=r[0]?.map(n=>`${jr(t.configuration,n.subject)} doesn't provide ${cs(t.configuration,n.requested)} (${Ot(t.configuration,n.hash,yt.CODE)}), requested by ${cs(t.configuration,n.requester)}.`)??[];e.startSectionSync({reportFooter:()=>{e.reportWarning(86,`Some peer dependencies are incorrectly met; run ${Ot(t.configuration,"yarn explain peer-requirements ",yt.CODE)} for details, where ${Ot(t.configuration,"",yt.CODE)} is the six-letter p-prefixed code.`)},skipIfEmpty:!0},()=>{for(let n of ks(o,u=>zy.default(u)))e.reportWarning(60,n);for(let n of ks(a,u=>zy.default(u)))e.reportWarning(2,n)})}var ek,tk,rk,Xpe,F_,Q_,T_,nk,kAt,QAt,Jpe,FAt,TAt,RAt,pl,k_,ik,zpe,St,Zpe=Et(()=>{Pt();Pt();Nl();qt();ek=Be("crypto");w_();tk=$e(S_()),rk=$e(nd()),Xpe=$e(zn()),F_=Be("util"),Q_=$e(Be("v8")),T_=$e(Be("zlib"));f_();D1();p_();h_();AE();fO();Yl();Vpe();L1();x_();Bd();b_();VS();ql();rh();jl();Dx();DU();kf();xo();nk=Ky(process.env.YARN_LOCKFILE_VERSION_OVERRIDE??8),kAt=3,QAt=/ *, */g,Jpe=/\/$/,FAt=32,TAt=(0,F_.promisify)(T_.default.gzip),RAt=(0,F_.promisify)(T_.default.gunzip),pl=(r=>(r.UpdateLockfile="update-lockfile",r.SkipBuild="skip-build",r))(pl||{}),k_={restoreLinkersCustomData:["linkersCustomData"],restoreResolutions:["accessibleLocators","conditionalLocators","disabledLocators","optionalBuilds","storedDescriptors","storedResolutions","storedPackages","lockFileChecksum"],restoreBuildState:["skippedBuilds","storedBuildState"]},ik=(o=>(o[o.NotProvided=0]="NotProvided",o[o.NotCompatible=1]="NotCompatible",o[o.NotCompatibleAggregate=2]="NotCompatibleAggregate",o))(ik||{}),zpe=t=>zs(`${kAt}`,t),St=class{constructor(e,{configuration:r}){this.resolutionAliases=new Map;this.workspaces=[];this.workspacesByCwd=new Map;this.workspacesByIdent=new Map;this.storedResolutions=new Map;this.storedDescriptors=new Map;this.storedPackages=new Map;this.storedChecksums=new Map;this.storedBuildState=new Map;this.accessibleLocators=new Set;this.conditionalLocators=new Set;this.disabledLocators=new Set;this.originalPackages=new Map;this.optionalBuilds=new Set;this.skippedBuilds=new Set;this.lockfileLastVersion=null;this.lockfileNeedsRefresh=!1;this.peerRequirements=new Map;this.peerWarnings=[];this.linkersCustomData=new Map;this.lockFileChecksum=null;this.installStateChecksum=null;this.configuration=r,this.cwd=e}static async find(e,r){if(!e.projectCwd)throw new it(`No project found in ${r}`);let o=e.projectCwd,a=r,n=null;for(;n!==e.projectCwd;){if(n=a,oe.existsSync(K.join(n,dr.manifest))){o=n;break}a=K.dirname(n)}let u=new St(e.projectCwd,{configuration:e});Ve.telemetry?.reportProject(u.cwd),await u.setupResolutions(),await u.setupWorkspaces(),Ve.telemetry?.reportWorkspaceCount(u.workspaces.length),Ve.telemetry?.reportDependencyCount(u.workspaces.reduce((C,T)=>C+T.manifest.dependencies.size+T.manifest.devDependencies.size,0));let A=u.tryWorkspaceByCwd(o);if(A)return{project:u,workspace:A,locator:A.anchoredLocator};let p=await u.findLocatorForLocation(`${o}/`,{strict:!0});if(p)return{project:u,locator:p,workspace:null};let h=Ot(e,u.cwd,yt.PATH),E=Ot(e,K.relative(u.cwd,o),yt.PATH),I=`- If ${h} isn't intended to be a project, remove any yarn.lock and/or package.json file there.`,v=`- If ${h} is intended to be a project, it might be that you forgot to list ${E} in its workspace configuration.`,b=`- Finally, if ${h} is fine and you intend ${E} to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.`;throw new it(`The nearest package directory (${Ot(e,o,yt.PATH)}) doesn't seem to be part of the project declared in ${Ot(e,u.cwd,yt.PATH)}. + +${[I,v,b].join(` +`)}`)}async setupResolutions(){this.storedResolutions=new Map,this.storedDescriptors=new Map,this.storedPackages=new Map,this.lockFileChecksum=null;let e=K.join(this.cwd,dr.lockfile),r=this.configuration.get("defaultLanguageName");if(oe.existsSync(e)){let o=await oe.readFilePromise(e,"utf8");this.lockFileChecksum=zpe(o);let a=Vi(o);if(a.__metadata){let n=a.__metadata.version,u=a.__metadata.cacheKey;this.lockfileLastVersion=n,this.lockfileNeedsRefresh=n"u")throw new Error(`Assertion failed: Expected the lockfile entry to have a resolution field (${A})`);let h=xf(p.resolution,!0),E=new Mt;E.load(p,{yamlCompatibilityMode:!0});let I=E.version,v=E.languageName||r,b=p.linkType.toUpperCase(),C=p.conditions??null,T=E.dependencies,L=E.peerDependencies,U=E.dependenciesMeta,J=E.peerDependenciesMeta,te=E.bin;if(p.checksum!=null){let pe=typeof u<"u"&&!p.checksum.includes("/")?`${u}/${p.checksum}`:p.checksum;this.storedChecksums.set(h.locatorHash,pe)}let le={...h,version:I,languageName:v,linkType:b,conditions:C,dependencies:T,peerDependencies:L,dependenciesMeta:U,peerDependenciesMeta:J,bin:te};this.originalPackages.set(le.locatorHash,le);for(let pe of A.split(QAt)){let Ae=nh(pe);n<=6&&(Ae=this.configuration.normalizeDependency(Ae),Ae=In(Ae,Ae.range.replace(/^patch:[^@]+@(?!npm(:|%3A))/,"$1npm%3A"))),this.storedDescriptors.set(Ae.descriptorHash,Ae),this.storedResolutions.set(Ae.descriptorHash,h.locatorHash)}}}else o.includes("yarn lockfile v1")&&(this.lockfileLastVersion=-1)}}async setupWorkspaces(){this.workspaces=[],this.workspacesByCwd=new Map,this.workspacesByIdent=new Map;let e=new Set,r=(0,rk.default)(4),o=async(a,n)=>{if(e.has(n))return a;e.add(n);let u=new lC(n,{project:this});await r(()=>u.setup());let A=a.then(()=>{this.addWorkspace(u)});return Array.from(u.workspacesCwds).reduce(o,A)};await o(Promise.resolve(),this.cwd)}addWorkspace(e){let r=this.workspacesByIdent.get(e.anchoredLocator.identHash);if(typeof r<"u")throw new Error(`Duplicate workspace name ${cs(this.configuration,e.anchoredLocator)}: ${ue.fromPortablePath(e.cwd)} conflicts with ${ue.fromPortablePath(r.cwd)}`);this.workspaces.push(e),this.workspacesByCwd.set(e.cwd,e),this.workspacesByIdent.set(e.anchoredLocator.identHash,e)}get topLevelWorkspace(){return this.getWorkspaceByCwd(this.cwd)}tryWorkspaceByCwd(e){K.isAbsolute(e)||(e=K.resolve(this.cwd,e)),e=K.normalize(e).replace(/\/+$/,"");let r=this.workspacesByCwd.get(e);return r||null}getWorkspaceByCwd(e){let r=this.tryWorkspaceByCwd(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByFilePath(e){let r=null;for(let o of this.workspaces)K.relative(o.cwd,e).startsWith("../")||r&&r.cwd.length>=o.cwd.length||(r=o);return r||null}getWorkspaceByFilePath(e){let r=this.tryWorkspaceByFilePath(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByIdent(e){let r=this.workspacesByIdent.get(e.identHash);return typeof r>"u"?null:r}getWorkspaceByIdent(e){let r=this.tryWorkspaceByIdent(e);if(!r)throw new Error(`Workspace not found (${cs(this.configuration,e)})`);return r}tryWorkspaceByDescriptor(e){if(e.range.startsWith(Xn.protocol)){let o=e.range.slice(Xn.protocol.length);if(o!=="^"&&o!=="~"&&o!=="*"&&!ba(o))return this.tryWorkspaceByCwd(o)}let r=this.tryWorkspaceByIdent(e);return r===null||(Sf(e)&&(e=e1(e)),!r.accepts(e.range))?null:r}getWorkspaceByDescriptor(e){let r=this.tryWorkspaceByDescriptor(e);if(r===null)throw new Error(`Workspace not found (${qn(this.configuration,e)})`);return r}tryWorkspaceByLocator(e){let r=this.tryWorkspaceByIdent(e);return r===null||(Hc(e)&&(e=t1(e)),r.anchoredLocator.locatorHash!==e.locatorHash)?null:r}getWorkspaceByLocator(e){let r=this.tryWorkspaceByLocator(e);if(!r)throw new Error(`Workspace not found (${jr(this.configuration,e)})`);return r}deleteDescriptor(e){this.storedResolutions.delete(e),this.storedDescriptors.delete(e)}deleteLocator(e){this.originalPackages.delete(e),this.storedPackages.delete(e),this.accessibleLocators.delete(e)}forgetResolution(e){if("descriptorHash"in e){let r=this.storedResolutions.get(e.descriptorHash);this.deleteDescriptor(e.descriptorHash);let o=new Set(this.storedResolutions.values());typeof r<"u"&&!o.has(r)&&this.deleteLocator(r)}if("locatorHash"in e){this.deleteLocator(e.locatorHash);for(let[r,o]of this.storedResolutions)o===e.locatorHash&&this.deleteDescriptor(r)}}forgetTransientResolutions(){let e=this.configuration.makeResolver(),r=new Map;for(let[o,a]of this.storedResolutions.entries()){let n=r.get(a);n||r.set(a,n=new Set),n.add(o)}for(let o of this.originalPackages.values()){let a;try{a=e.shouldPersistResolution(o,{project:this,resolver:e})}catch{a=!1}if(!a){this.deleteLocator(o.locatorHash);let n=r.get(o.locatorHash);if(n){r.delete(o.locatorHash);for(let u of n)this.deleteDescriptor(u)}}}}forgetVirtualResolutions(){for(let e of this.storedPackages.values())for(let[r,o]of e.dependencies)Sf(o)&&e.dependencies.set(r,e1(o))}getDependencyMeta(e,r){let o={},n=this.topLevelWorkspace.manifest.dependenciesMeta.get(fn(e));if(!n)return o;let u=n.get(null);if(u&&Object.assign(o,u),r===null||!Xpe.default.valid(r))return o;for(let[A,p]of n)A!==null&&A===r&&Object.assign(o,p);return o}async findLocatorForLocation(e,{strict:r=!1}={}){let o=new Qi,a=this.configuration.getLinkers(),n={project:this,report:o};for(let u of a){let A=await u.findPackageLocator(e,n);if(A){if(r&&(await u.findPackageLocation(A,n)).replace(Jpe,"")!==e.replace(Jpe,""))continue;return A}}return null}async loadUserConfig(){let e=K.join(this.cwd,".pnp.cjs");await oe.existsPromise(e)&&vf(e).setup();let r=K.join(this.cwd,"yarn.config.cjs");return await oe.existsPromise(r)?vf(r):null}async preparePackage(e,{resolver:r,resolveOptions:o}){let a=await this.configuration.getPackageExtensions(),n=this.configuration.normalizePackage(e,{packageExtensions:a});for(let[u,A]of n.dependencies){let p=await this.configuration.reduceHook(E=>E.reduceDependency,A,this,n,A,{resolver:r,resolveOptions:o});if(!r1(A,p))throw new Error("Assertion failed: The descriptor ident cannot be changed through aliases");let h=r.bindDescriptor(p,n,o);n.dependencies.set(u,h)}return n}async resolveEverything(e){if(!this.workspacesByCwd||!this.workspacesByIdent)throw new Error("Workspaces must have been setup before calling this function");this.forgetVirtualResolutions();let r=new Map(this.originalPackages),o=[];e.lockfileOnly||this.forgetTransientResolutions();let a=e.resolver||this.configuration.makeResolver(),n=new sC(a);await n.setup(this,{report:e.report});let u=e.lockfileOnly?[new $b(a)]:[n,a],A=new vd([new oC(a),...u]),p=new vd([...u]),h=this.configuration.makeFetcher(),E=e.lockfileOnly?{project:this,report:e.report,resolver:A}:{project:this,report:e.report,resolver:A,fetchOptions:{project:this,cache:e.cache,checksums:this.storedChecksums,report:e.report,fetcher:h,cacheOptions:{mirrorWriteOnly:!0}}},I=new Map,v=new Map,b=new Map,C=new Map,T=new Map,L=new Map,U=this.topLevelWorkspace.anchoredLocator,J=new Set,te=[],le=_4(),pe=this.configuration.getSupportedArchitectures();await e.report.startProgressPromise(Xs.progressViaTitle(),async ce=>{let ne=async H=>{let lt=await Wy(async()=>await A.resolve(H,E),_e=>`${jr(this.configuration,H)}: ${_e}`);if(!n1(H,lt))throw new Error(`Assertion failed: The locator cannot be changed by the resolver (went from ${jr(this.configuration,H)} to ${jr(this.configuration,lt)})`);C.set(lt.locatorHash,lt),!r.delete(lt.locatorHash)&&!this.tryWorkspaceByLocator(lt)&&o.push(lt);let Qe=await this.preparePackage(lt,{resolver:A,resolveOptions:E}),be=Uc([...Qe.dependencies.values()].map(_e=>ht(_e)));return te.push(be),be.catch(()=>{}),v.set(Qe.locatorHash,Qe),Qe},ee=async H=>{let lt=T.get(H.locatorHash);if(typeof lt<"u")return lt;let Re=Promise.resolve().then(()=>ne(H));return T.set(H.locatorHash,Re),Re},Ie=async(H,lt)=>{let Re=await ht(lt);return I.set(H.descriptorHash,H),b.set(H.descriptorHash,Re.locatorHash),Re},ke=async H=>{ce.setTitle(qn(this.configuration,H));let lt=this.resolutionAliases.get(H.descriptorHash);if(typeof lt<"u")return Ie(H,this.storedDescriptors.get(lt));let Re=A.getResolutionDependencies(H,E),Qe=Object.fromEntries(await Uc(Object.entries(Re).map(async([Te,Je])=>{let He=A.bindDescriptor(Je,U,E),x=await ht(He);return J.add(x.locatorHash),[Te,x]}))),_e=(await Wy(async()=>await A.getCandidates(H,Qe,E),Te=>`${qn(this.configuration,H)}: ${Te}`))[0];if(typeof _e>"u")throw new zt(82,`${qn(this.configuration,H)}: No candidates found`);if(e.checkResolutions){let{locators:Te}=await p.getSatisfying(H,Qe,[_e],{...E,resolver:p});if(!Te.find(Je=>Je.locatorHash===_e.locatorHash))throw new zt(78,`Invalid resolution ${XI(this.configuration,H,_e)}`)}return I.set(H.descriptorHash,H),b.set(H.descriptorHash,_e.locatorHash),ee(_e)},ht=H=>{let lt=L.get(H.descriptorHash);if(typeof lt<"u")return lt;I.set(H.descriptorHash,H);let Re=Promise.resolve().then(()=>ke(H));return L.set(H.descriptorHash,Re),Re};for(let H of this.workspaces){let lt=H.anchoredDescriptor;te.push(ht(lt))}for(;te.length>0;){let H=[...te];te.length=0,await Uc(H)}});let Ae=sl(r.values(),ce=>this.tryWorkspaceByLocator(ce)?sl.skip:ce);if(o.length>0||Ae.length>0){let ce=new Set(this.workspaces.flatMap(H=>{let lt=v.get(H.anchoredLocator.locatorHash);if(!lt)throw new Error("Assertion failed: The workspace should have been resolved");return Array.from(lt.dependencies.values(),Re=>{let Qe=b.get(Re.descriptorHash);if(!Qe)throw new Error("Assertion failed: The resolution should have been registered");return Qe})})),ne=H=>ce.has(H.locatorHash)?"0":"1",ee=H=>xa(H),Ie=ks(o,[ne,ee]),ke=ks(Ae,[ne,ee]),ht=e.report.getRecommendedLength();Ie.length>0&&e.report.reportInfo(85,`${Ot(this.configuration,"+",yt.ADDED)} ${cS(this.configuration,Ie,ht)}`),ke.length>0&&e.report.reportInfo(85,`${Ot(this.configuration,"-",yt.REMOVED)} ${cS(this.configuration,ke,ht)}`)}let ye=new Set(this.resolutionAliases.values()),ae=new Set(v.keys()),we=new Set,Pe=new Map,g=[];NAt({project:this,accessibleLocators:we,volatileDescriptors:ye,optionalBuilds:ae,peerRequirements:Pe,peerWarnings:g,allDescriptors:I,allResolutions:b,allPackages:v});for(let ce of J)ae.delete(ce);for(let ce of ye)I.delete(ce),b.delete(ce);let Ee=new Set,De=new Set;for(let ce of v.values())ce.conditions!=null&&(!ae.has(ce.locatorHash)||(qS(ce,pe)||(qS(ce,le)&&e.report.reportWarningOnce(77,`${jr(this.configuration,ce)}: Your current architecture (${process.platform}-${process.arch}) is supported by this package, but is missing from the ${Ot(this.configuration,"supportedArchitectures",yt.SETTING)} setting`),De.add(ce.locatorHash)),Ee.add(ce.locatorHash)));this.storedResolutions=b,this.storedDescriptors=I,this.storedPackages=v,this.accessibleLocators=we,this.conditionalLocators=Ee,this.disabledLocators=De,this.originalPackages=C,this.optionalBuilds=ae,this.peerRequirements=Pe,this.peerWarnings=g}async fetchEverything({cache:e,report:r,fetcher:o,mode:a,persistProject:n=!0}){let u={mockedPackages:this.disabledLocators,unstablePackages:this.conditionalLocators},A=o||this.configuration.makeFetcher(),p={checksums:this.storedChecksums,project:this,cache:e,fetcher:A,report:r,cacheOptions:u},h=Array.from(new Set(ks(this.storedResolutions.values(),[C=>{let T=this.storedPackages.get(C);if(!T)throw new Error("Assertion failed: The locator should have been registered");return xa(T)}])));a==="update-lockfile"&&(h=h.filter(C=>!this.storedChecksums.has(C)));let E=!1,I=Xs.progressViaCounter(h.length);await r.reportProgress(I);let v=(0,rk.default)(FAt);if(await Uc(h.map(C=>v(async()=>{let T=this.storedPackages.get(C);if(!T)throw new Error("Assertion failed: The locator should have been registered");if(Hc(T))return;let L;try{L=await A.fetch(T,p)}catch(U){U.message=`${jr(this.configuration,T)}: ${U.message}`,r.reportExceptionOnce(U),E=U;return}L.checksum!=null?this.storedChecksums.set(T.locatorHash,L.checksum):this.storedChecksums.delete(T.locatorHash),L.releaseFs&&L.releaseFs()}).finally(()=>{I.tick()}))),E)throw E;let b=n&&a!=="update-lockfile"?await this.cacheCleanup({cache:e,report:r}):null;if(r.cacheMisses.size>0||b){let T=(await Promise.all([...r.cacheMisses].map(async Ae=>{let ye=this.storedPackages.get(Ae),ae=this.storedChecksums.get(Ae)??null,we=e.getLocatorPath(ye,ae);return(await oe.statPromise(we)).size}))).reduce((Ae,ye)=>Ae+ye,0)-(b?.size??0),L=r.cacheMisses.size,U=b?.count??0,J=`${nS(L,{zero:"No new packages",one:"A package was",more:`${Ot(this.configuration,L,yt.NUMBER)} packages were`})} added to the project`,te=`${nS(U,{zero:"none were",one:"one was",more:`${Ot(this.configuration,U,yt.NUMBER)} were`})} removed`,le=T!==0?` (${Ot(this.configuration,T,yt.SIZE_DIFF)})`:"",pe=U>0?L>0?`${J}, and ${te}${le}.`:`${J}, but ${te}${le}.`:`${J}${le}.`;r.reportInfo(13,pe)}}async linkEverything({cache:e,report:r,fetcher:o,mode:a}){let n={mockedPackages:this.disabledLocators,unstablePackages:this.conditionalLocators,skipIntegrityCheck:!0},u=o||this.configuration.makeFetcher(),A={checksums:this.storedChecksums,project:this,cache:e,fetcher:u,report:r,cacheOptions:n},p=this.configuration.getLinkers(),h={project:this,report:r},E=new Map(p.map(ce=>{let ne=ce.makeInstaller(h),ee=ce.getCustomDataKey(),Ie=this.linkersCustomData.get(ee);return typeof Ie<"u"&&ne.attachCustomData(Ie),[ce,ne]})),I=new Map,v=new Map,b=new Map,C=new Map(await Uc([...this.accessibleLocators].map(async ce=>{let ne=this.storedPackages.get(ce);if(!ne)throw new Error("Assertion failed: The locator should have been registered");return[ce,await u.fetch(ne,A)]}))),T=[],L=new Set,U=[];for(let ce of this.accessibleLocators){let ne=this.storedPackages.get(ce);if(typeof ne>"u")throw new Error("Assertion failed: The locator should have been registered");let ee=C.get(ne.locatorHash);if(typeof ee>"u")throw new Error("Assertion failed: The fetch result should have been registered");let Ie=[],ke=H=>{Ie.push(H)},ht=this.tryWorkspaceByLocator(ne);if(ht!==null){let H=[],{scripts:lt}=ht.manifest;for(let Qe of["preinstall","install","postinstall"])lt.has(Qe)&&H.push({type:0,script:Qe});try{for(let[Qe,be]of E)if(Qe.supportsPackage(ne,h)&&(await be.installPackage(ne,ee,{holdFetchResult:ke})).buildRequest!==null)throw new Error("Assertion failed: Linkers can't return build directives for workspaces; this responsibility befalls to the Yarn core")}finally{Ie.length===0?ee.releaseFs?.():T.push(Uc(Ie).catch(()=>{}).then(()=>{ee.releaseFs?.()}))}let Re=K.join(ee.packageFs.getRealPath(),ee.prefixPath);v.set(ne.locatorHash,Re),!Hc(ne)&&H.length>0&&b.set(ne.locatorHash,{buildDirectives:H,buildLocations:[Re]})}else{let H=p.find(Qe=>Qe.supportsPackage(ne,h));if(!H)throw new zt(12,`${jr(this.configuration,ne)} isn't supported by any available linker`);let lt=E.get(H);if(!lt)throw new Error("Assertion failed: The installer should have been registered");let Re;try{Re=await lt.installPackage(ne,ee,{holdFetchResult:ke})}finally{Ie.length===0?ee.releaseFs?.():T.push(Uc(Ie).then(()=>{}).then(()=>{ee.releaseFs?.()}))}I.set(ne.locatorHash,H),v.set(ne.locatorHash,Re.packageLocation),Re.buildRequest&&Re.packageLocation&&(Re.buildRequest.skipped?(L.add(ne.locatorHash),this.skippedBuilds.has(ne.locatorHash)||U.push([ne,Re.buildRequest.explain])):b.set(ne.locatorHash,{buildDirectives:Re.buildRequest.directives,buildLocations:[Re.packageLocation]}))}}let J=new Map;for(let ce of this.accessibleLocators){let ne=this.storedPackages.get(ce);if(!ne)throw new Error("Assertion failed: The locator should have been registered");let ee=this.tryWorkspaceByLocator(ne)!==null,Ie=async(ke,ht)=>{let H=v.get(ne.locatorHash);if(typeof H>"u")throw new Error(`Assertion failed: The package (${jr(this.configuration,ne)}) should have been registered`);let lt=[];for(let Re of ne.dependencies.values()){let Qe=this.storedResolutions.get(Re.descriptorHash);if(typeof Qe>"u")throw new Error(`Assertion failed: The resolution (${qn(this.configuration,Re)}, from ${jr(this.configuration,ne)})should have been registered`);let be=this.storedPackages.get(Qe);if(typeof be>"u")throw new Error(`Assertion failed: The package (${Qe}, resolved from ${qn(this.configuration,Re)}) should have been registered`);let _e=this.tryWorkspaceByLocator(be)===null?I.get(Qe):null;if(typeof _e>"u")throw new Error(`Assertion failed: The package (${Qe}, resolved from ${qn(this.configuration,Re)}) should have been registered`);_e===ke||_e===null?v.get(be.locatorHash)!==null&<.push([Re,be]):!ee&&H!==null&&Gy(J,Qe).push(H)}H!==null&&await ht.attachInternalDependencies(ne,lt)};if(ee)for(let[ke,ht]of E)ke.supportsPackage(ne,h)&&await Ie(ke,ht);else{let ke=I.get(ne.locatorHash);if(!ke)throw new Error("Assertion failed: The linker should have been found");let ht=E.get(ke);if(!ht)throw new Error("Assertion failed: The installer should have been registered");await Ie(ke,ht)}}for(let[ce,ne]of J){let ee=this.storedPackages.get(ce);if(!ee)throw new Error("Assertion failed: The package should have been registered");let Ie=I.get(ee.locatorHash);if(!Ie)throw new Error("Assertion failed: The linker should have been found");let ke=E.get(Ie);if(!ke)throw new Error("Assertion failed: The installer should have been registered");await ke.attachExternalDependents(ee,ne)}let te=new Map;for(let[ce,ne]of E){let ee=await ne.finalizeInstall();for(let Ie of ee?.records??[])Ie.buildRequest.skipped?(L.add(Ie.locator.locatorHash),this.skippedBuilds.has(Ie.locator.locatorHash)||U.push([Ie.locator,Ie.buildRequest.explain])):b.set(Ie.locator.locatorHash,{buildDirectives:Ie.buildRequest.directives,buildLocations:Ie.buildLocations});typeof ee?.customData<"u"&&te.set(ce.getCustomDataKey(),ee.customData)}if(this.linkersCustomData=te,await Uc(T),a==="skip-build")return;for(let[,ce]of ks(U,([ne])=>xa(ne)))ce(r);let le=new Set(this.storedPackages.keys()),pe=new Set(b.keys());for(let ce of pe)le.delete(ce);let Ae=(0,ek.createHash)("sha512");Ae.update(process.versions.node),await this.configuration.triggerHook(ce=>ce.globalHashGeneration,this,ce=>{Ae.update("\0"),Ae.update(ce)});let ye=Ae.digest("hex"),ae=new Map,we=ce=>{let ne=ae.get(ce.locatorHash);if(typeof ne<"u")return ne;let ee=this.storedPackages.get(ce.locatorHash);if(typeof ee>"u")throw new Error("Assertion failed: The package should have been registered");let Ie=(0,ek.createHash)("sha512");Ie.update(ce.locatorHash),ae.set(ce.locatorHash,"");for(let ke of ee.dependencies.values()){let ht=this.storedResolutions.get(ke.descriptorHash);if(typeof ht>"u")throw new Error(`Assertion failed: The resolution (${qn(this.configuration,ke)}) should have been registered`);let H=this.storedPackages.get(ht);if(typeof H>"u")throw new Error("Assertion failed: The package should have been registered");Ie.update(we(H))}return ne=Ie.digest("hex"),ae.set(ce.locatorHash,ne),ne},Pe=(ce,ne)=>{let ee=(0,ek.createHash)("sha512");ee.update(ye),ee.update(we(ce));for(let Ie of ne)ee.update(Ie);return ee.digest("hex")},g=new Map,Ee=!1,De=ce=>{let ne=new Set([ce.locatorHash]);for(let ee of ne){let Ie=this.storedPackages.get(ee);if(!Ie)throw new Error("Assertion failed: The package should have been registered");for(let ke of Ie.dependencies.values()){let ht=this.storedResolutions.get(ke.descriptorHash);if(!ht)throw new Error(`Assertion failed: The resolution (${qn(this.configuration,ke)}) should have been registered`);if(ht!==ce.locatorHash&&pe.has(ht))return!1;let H=this.storedPackages.get(ht);if(!H)throw new Error("Assertion failed: The package should have been registered");let lt=this.tryWorkspaceByLocator(H);if(lt){if(lt.anchoredLocator.locatorHash!==ce.locatorHash&&pe.has(lt.anchoredLocator.locatorHash))return!1;ne.add(lt.anchoredLocator.locatorHash)}ne.add(ht)}}return!0};for(;pe.size>0;){let ce=pe.size,ne=[];for(let ee of pe){let Ie=this.storedPackages.get(ee);if(!Ie)throw new Error("Assertion failed: The package should have been registered");if(!De(Ie))continue;let ke=b.get(Ie.locatorHash);if(!ke)throw new Error("Assertion failed: The build directive should have been registered");let ht=Pe(Ie,ke.buildLocations);if(this.storedBuildState.get(Ie.locatorHash)===ht){g.set(Ie.locatorHash,ht),pe.delete(ee);continue}Ee||(await this.persistInstallStateFile(),Ee=!0),this.storedBuildState.has(Ie.locatorHash)?r.reportInfo(8,`${jr(this.configuration,Ie)} must be rebuilt because its dependency tree changed`):r.reportInfo(7,`${jr(this.configuration,Ie)} must be built because it never has been before or the last one failed`);let H=ke.buildLocations.map(async lt=>{if(!K.isAbsolute(lt))throw new Error(`Assertion failed: Expected the build location to be absolute (not ${lt})`);for(let Re of ke.buildDirectives){let Qe=`# This file contains the result of Yarn building a package (${xa(Ie)}) +`;switch(Re.type){case 0:Qe+=`# Script name: ${Re.script} +`;break;case 1:Qe+=`# Script code: ${Re.script} +`;break}let be=null;if(!await oe.mktempPromise(async Te=>{let Je=K.join(Te,"build.log"),{stdout:He,stderr:x}=this.configuration.getSubprocessStreams(Je,{header:Qe,prefix:jr(this.configuration,Ie),report:r}),w;try{switch(Re.type){case 0:w=await Vx(Ie,Re.script,[],{cwd:lt,project:this,stdin:be,stdout:He,stderr:x});break;case 1:w=await wU(Ie,Re.script,[],{cwd:lt,project:this,stdin:be,stdout:He,stderr:x});break}}catch(F){x.write(F.stack),w=1}if(He.end(),x.end(),w===0)return!0;oe.detachTemp(Te);let S=`${jr(this.configuration,Ie)} couldn't be built successfully (exit code ${Ot(this.configuration,w,yt.NUMBER)}, logs can be found here: ${Ot(this.configuration,Je,yt.PATH)})`,y=this.optionalBuilds.has(Ie.locatorHash);return y?r.reportInfo(9,S):r.reportError(9,S),Jce&&r.reportFold(ue.fromPortablePath(Je),oe.readFileSync(Je,"utf8")),y}))return!1}return!0});ne.push(...H,Promise.allSettled(H).then(lt=>{pe.delete(ee),lt.every(Re=>Re.status==="fulfilled"&&Re.value===!0)&&g.set(Ie.locatorHash,ht)}))}if(await Uc(ne),ce===pe.size){let ee=Array.from(pe).map(Ie=>{let ke=this.storedPackages.get(Ie);if(!ke)throw new Error("Assertion failed: The package should have been registered");return jr(this.configuration,ke)}).join(", ");r.reportError(3,`Some packages have circular dependencies that make their build order unsatisfiable - as a result they won't be built (affected packages are: ${ee})`);break}}this.storedBuildState=g,this.skippedBuilds=L}async installWithNewReport(e,r){return(await Nt.start({configuration:this.configuration,json:e.json,stdout:e.stdout,forceSectionAlignment:!0,includeLogs:!e.json&&!e.quiet,includeVersion:!0},async a=>{await this.install({...r,report:a})})).exitCode()}async install(e){let r=this.configuration.get("nodeLinker");Ve.telemetry?.reportInstall(r);let o=!1;if(await e.report.startTimerPromise("Project validation",{skipIfEmpty:!0},async()=>{this.configuration.get("enableOfflineMode")&&e.report.reportWarning(90,"Offline work is enabled; Yarn won't fetch packages from the remote registry if it can avoid it"),await this.configuration.triggerHook(E=>E.validateProject,this,{reportWarning:(E,I)=>{e.report.reportWarning(E,I)},reportError:(E,I)=>{e.report.reportError(E,I),o=!0}})}),o)return;let a=await this.configuration.getPackageExtensions();for(let E of a.values())for(let[,I]of E)for(let v of I)v.status="inactive";let n=K.join(this.cwd,dr.lockfile),u=null;if(e.immutable)try{u=await oe.readFilePromise(n,"utf8")}catch(E){throw E.code==="ENOENT"?new zt(28,"The lockfile would have been created by this install, which is explicitly forbidden."):E}await e.report.startTimerPromise("Resolution step",async()=>{await this.resolveEverything(e)}),await e.report.startTimerPromise("Post-resolution validation",{skipIfEmpty:!0},async()=>{LAt(this,e.report);for(let[,E]of a)for(let[,I]of E)for(let v of I)if(v.userProvided){let b=Ot(this.configuration,v,yt.PACKAGE_EXTENSION);switch(v.status){case"inactive":e.report.reportWarning(68,`${b}: No matching package in the dependency tree; you may not need this rule anymore.`);break;case"redundant":e.report.reportWarning(69,`${b}: This rule seems redundant when applied on the original package; the extension may have been applied upstream.`);break}}if(u!==null){let E=Ug(u,this.generateLockfile());if(E!==u){let I=ppe(n,n,u,E,void 0,void 0,{maxEditLength:100});if(I){e.report.reportSeparator();for(let v of I.hunks){e.report.reportInfo(null,`@@ -${v.oldStart},${v.oldLines} +${v.newStart},${v.newLines} @@`);for(let b of v.lines)b.startsWith("+")?e.report.reportError(28,Ot(this.configuration,b,yt.ADDED)):b.startsWith("-")?e.report.reportError(28,Ot(this.configuration,b,yt.REMOVED)):e.report.reportInfo(null,Ot(this.configuration,b,"grey"))}e.report.reportSeparator()}throw new zt(28,"The lockfile would have been modified by this install, which is explicitly forbidden.")}}});for(let E of a.values())for(let[,I]of E)for(let v of I)v.userProvided&&v.status==="active"&&Ve.telemetry?.reportPackageExtension(yd(v,yt.PACKAGE_EXTENSION));await e.report.startTimerPromise("Fetch step",async()=>{await this.fetchEverything(e)});let A=e.immutable?[...new Set(this.configuration.get("immutablePatterns"))].sort():[],p=await Promise.all(A.map(async E=>MS(E,{cwd:this.cwd})));(typeof e.persistProject>"u"||e.persistProject)&&await this.persist(),await e.report.startTimerPromise("Link step",async()=>{if(e.mode==="update-lockfile"){e.report.reportWarning(73,`Skipped due to ${Ot(this.configuration,"mode=update-lockfile",yt.CODE)}`);return}await this.linkEverything(e);let E=await Promise.all(A.map(async I=>MS(I,{cwd:this.cwd})));for(let I=0;I{await this.configuration.triggerHook(E=>E.validateProjectAfterInstall,this,{reportWarning:(E,I)=>{e.report.reportWarning(E,I)},reportError:(E,I)=>{e.report.reportError(E,I),h=!0}})}),!h&&await this.configuration.triggerHook(E=>E.afterAllInstalled,this,e)}generateLockfile(){let e=new Map;for(let[n,u]of this.storedResolutions.entries()){let A=e.get(u);A||e.set(u,A=new Set),A.add(n)}let r={},{cacheKey:o}=Lr.getCacheKey(this.configuration);r.__metadata={version:nk,cacheKey:o};for(let[n,u]of e.entries()){let A=this.originalPackages.get(n);if(!A)continue;let p=[];for(let b of u){let C=this.storedDescriptors.get(b);if(!C)throw new Error("Assertion failed: The descriptor should have been registered");p.push(C)}let h=p.map(b=>Sa(b)).sort().join(", "),E=new Mt;E.version=A.linkType==="HARD"?A.version:"0.0.0-use.local",E.languageName=A.languageName,E.dependencies=new Map(A.dependencies),E.peerDependencies=new Map(A.peerDependencies),E.dependenciesMeta=new Map(A.dependenciesMeta),E.peerDependenciesMeta=new Map(A.peerDependenciesMeta),E.bin=new Map(A.bin);let I,v=this.storedChecksums.get(A.locatorHash);if(typeof v<"u"){let b=v.indexOf("/");if(b===-1)throw new Error("Assertion failed: Expected the checksum to reference its cache key");let C=v.slice(0,b),T=v.slice(b+1);C===o?I=T:I=v}r[h]={...E.exportTo({},{compatibilityMode:!1}),linkType:A.linkType.toLowerCase(),resolution:xa(A),checksum:I,conditions:A.conditions||void 0}}return`${[`# This file is generated by running "yarn install" inside your project. +`,`# Manual changes might be lost - proceed with caution! +`].join("")} +`+Ba(r)}async persistLockfile(){let e=K.join(this.cwd,dr.lockfile),r="";try{r=await oe.readFilePromise(e,"utf8")}catch{}let o=this.generateLockfile(),a=Ug(r,o);a!==r&&(await oe.writeFilePromise(e,a),this.lockFileChecksum=zpe(a),this.lockfileNeedsRefresh=!1)}async persistInstallStateFile(){let e=[];for(let u of Object.values(k_))e.push(...u);let r=(0,tk.default)(this,e),o=Q_.default.serialize(r),a=zs(o);if(this.installStateChecksum===a)return;let n=this.configuration.get("installStatePath");await oe.mkdirPromise(K.dirname(n),{recursive:!0}),await oe.writeFilePromise(n,await TAt(o)),this.installStateChecksum=a}async restoreInstallState({restoreLinkersCustomData:e=!0,restoreResolutions:r=!0,restoreBuildState:o=!0}={}){let a=this.configuration.get("installStatePath"),n;try{let u=await RAt(await oe.readFilePromise(a));n=Q_.default.deserialize(u),this.installStateChecksum=zs(u)}catch{r&&await this.applyLightResolution();return}e&&typeof n.linkersCustomData<"u"&&(this.linkersCustomData=n.linkersCustomData),o&&Object.assign(this,(0,tk.default)(n,k_.restoreBuildState)),r&&(n.lockFileChecksum===this.lockFileChecksum?Object.assign(this,(0,tk.default)(n,k_.restoreResolutions)):await this.applyLightResolution())}async applyLightResolution(){await this.resolveEverything({lockfileOnly:!0,report:new Qi}),await this.persistInstallStateFile()}async persist(){let e=(0,rk.default)(4);await Promise.all([this.persistLockfile(),...this.workspaces.map(r=>e(()=>r.persistManifest()))])}async cacheCleanup({cache:e,report:r}){if(this.configuration.get("enableGlobalCache"))return null;let o=new Set([".gitignore"]);if(!IO(e.cwd,this.cwd)||!await oe.existsPromise(e.cwd))return null;let a=[];for(let u of await oe.readdirPromise(e.cwd)){if(o.has(u))continue;let A=K.resolve(e.cwd,u);e.markedFiles.has(A)||(e.immutable?r.reportError(56,`${Ot(this.configuration,K.basename(A),"magenta")} appears to be unused and would be marked for deletion, but the cache is immutable`):a.push(oe.lstatPromise(A).then(async p=>(await oe.removePromise(A),p.size))))}if(a.length===0)return null;let n=await Promise.all(a);return{count:a.length,size:n.reduce((u,A)=>u+A,0)}}}});function MAt(t){let o=Math.floor(t.timeNow/864e5),a=t.updateInterval*864e5,n=t.state.lastUpdate??t.timeNow+a+Math.floor(a*t.randomInitialInterval),u=n+a,A=t.state.lastTips??o*864e5,p=A+864e5+8*36e5-t.timeZone,h=u<=t.timeNow,E=p<=t.timeNow,I=null;return(h||E||!t.state.lastUpdate||!t.state.lastTips)&&(I={},I.lastUpdate=h?t.timeNow:n,I.lastTips=A,I.blocks=h?{}:t.state.blocks,I.displayedTips=t.state.displayedTips),{nextState:I,triggerUpdate:h,triggerTips:E,nextTips:E?o*864e5:A}}var cC,$pe=Et(()=>{Pt();N1();rh();Bx();jl();kf();cC=class{constructor(e,r){this.values=new Map;this.hits=new Map;this.enumerators=new Map;this.nextTips=0;this.displayedTips=[];this.shouldCommitTips=!1;this.configuration=e;let o=this.getRegistryPath();this.isNew=!oe.existsSync(o),this.shouldShowTips=!1,this.sendReport(r),this.startBuffer()}commitTips(){this.shouldShowTips&&(this.shouldCommitTips=!0)}selectTip(e){let r=new Set(this.displayedTips),o=A=>A&&tn?bf(tn,A):!1,a=e.map((A,p)=>p).filter(A=>e[A]&&o(e[A]?.selector));if(a.length===0)return null;let n=a.filter(A=>!r.has(A));if(n.length===0){let A=Math.floor(a.length*.2);this.displayedTips=A>0?this.displayedTips.slice(-A):[],n=a.filter(p=>!r.has(p))}let u=n[Math.floor(Math.random()*n.length)];return this.displayedTips.push(u),this.commitTips(),e[u]}reportVersion(e){this.reportValue("version",e.replace(/-git\..*/,"-git"))}reportCommandName(e){this.reportValue("commandName",e||"")}reportPluginName(e){this.reportValue("pluginName",e)}reportProject(e){this.reportEnumerator("projectCount",e)}reportInstall(e){this.reportHit("installCount",e)}reportPackageExtension(e){this.reportValue("packageExtension",e)}reportWorkspaceCount(e){this.reportValue("workspaceCount",String(e))}reportDependencyCount(e){this.reportValue("dependencyCount",String(e))}reportValue(e,r){dd(this.values,e).add(r)}reportEnumerator(e,r){dd(this.enumerators,e).add(zs(r))}reportHit(e,r="*"){let o=Yy(this.hits,e),a=ol(o,r,()=>0);o.set(r,a+1)}getRegistryPath(){let e=this.configuration.get("globalFolder");return K.join(e,"telemetry.json")}sendReport(e){let r=this.getRegistryPath(),o;try{o=oe.readJsonSync(r)}catch{o={}}let{nextState:a,triggerUpdate:n,triggerTips:u,nextTips:A}=MAt({state:o,timeNow:Date.now(),timeZone:new Date().getTimezoneOffset()*60*1e3,randomInitialInterval:Math.random(),updateInterval:this.configuration.get("telemetryInterval")});if(this.nextTips=A,this.displayedTips=o.displayedTips??[],a!==null)try{oe.mkdirSync(K.dirname(r),{recursive:!0}),oe.writeJsonSync(r,a)}catch{return!1}if(u&&this.configuration.get("enableTips")&&(this.shouldShowTips=!0),n){let p=o.blocks??{};if(Object.keys(p).length===0){let h=`https://browser-http-intake.logs.datadoghq.eu/v1/input/${e}?ddsource=yarn`,E=I=>U4(h,I,{configuration:this.configuration}).catch(()=>{});for(let[I,v]of Object.entries(o.blocks??{})){if(Object.keys(v).length===0)continue;let b=v;b.userId=I,b.reportType="primary";for(let L of Object.keys(b.enumerators??{}))b.enumerators[L]=b.enumerators[L].length;E(b);let C=new Map,T=20;for(let[L,U]of Object.entries(b.values))U.length>0&&C.set(L,U.slice(0,T));for(;C.size>0;){let L={};L.userId=I,L.reportType="secondary",L.metrics={};for(let[U,J]of C)L.metrics[U]=J.shift(),J.length===0&&C.delete(U);E(L)}}}}return!0}applyChanges(){let e=this.getRegistryPath(),r;try{r=oe.readJsonSync(e)}catch{r={}}let o=this.configuration.get("telemetryUserId")??"*",a=r.blocks=r.blocks??{},n=a[o]=a[o]??{};for(let u of this.hits.keys()){let A=n.hits=n.hits??{},p=A[u]=A[u]??{};for(let[h,E]of this.hits.get(u))p[h]=(p[h]??0)+E}for(let u of["values","enumerators"])for(let A of this[u].keys()){let p=n[u]=n[u]??{};p[A]=[...new Set([...p[A]??[],...this[u].get(A)??[]])]}this.shouldCommitTips&&(r.lastTips=this.nextTips,r.displayedTips=this.displayedTips),oe.mkdirSync(K.dirname(e),{recursive:!0}),oe.writeJsonSync(e,r)}startBuffer(){process.on("exit",()=>{try{this.applyChanges()}catch{}})}}});var s2={};Kt(s2,{BuildDirectiveType:()=>zb,CACHE_CHECKPOINT:()=>A_,CACHE_VERSION:()=>Jb,Cache:()=>Lr,Configuration:()=>Ve,DEFAULT_RC_FILENAME:()=>W4,FormatType:()=>Qle,InstallMode:()=>pl,LEGACY_PLUGINS:()=>B1,LOCKFILE_VERSION:()=>nk,LegacyMigrationResolver:()=>sC,LightReport:()=>AA,LinkType:()=>Jy,LockfileResolver:()=>oC,Manifest:()=>Mt,MessageName:()=>wr,MultiFetcher:()=>pE,PackageExtensionStatus:()=>DL,PackageExtensionType:()=>vL,PeerWarningType:()=>ik,Project:()=>St,Report:()=>Xs,ReportError:()=>zt,SettingsType:()=>v1,StreamReport:()=>Nt,TAG_REGEXP:()=>QE,TelemetryManager:()=>cC,ThrowReport:()=>Qi,VirtualFetcher:()=>hE,WindowsLinkType:()=>kx,Workspace:()=>lC,WorkspaceFetcher:()=>dE,WorkspaceResolver:()=>Xn,YarnVersion:()=>tn,execUtils:()=>Ur,folderUtils:()=>WS,formatUtils:()=>de,hashUtils:()=>wn,httpUtils:()=>rn,miscUtils:()=>je,nodeUtils:()=>Ji,parseMessageName:()=>fP,reportOptionDeprecations:()=>NE,scriptUtils:()=>un,semverUtils:()=>kr,stringifyMessageName:()=>Wu,structUtils:()=>W,tgzUtils:()=>Xi,treeUtils:()=>$s});var Ye=Et(()=>{Px();VS();ql();rh();Bx();jl();Dx();DU();kf();xo();$fe();ope();f_();D1();D1();lpe();p_();cpe();h_();AE();pP();AO();Zpe();Yl();L1();$pe();x_();pO();hO();Bd();b_();N1();Ine()});var she=_((K_t,a2)=>{"use strict";var UAt=process.env.TERM_PROGRAM==="Hyper",_At=process.platform==="win32",rhe=process.platform==="linux",R_={ballotDisabled:"\u2612",ballotOff:"\u2610",ballotOn:"\u2611",bullet:"\u2022",bulletWhite:"\u25E6",fullBlock:"\u2588",heart:"\u2764",identicalTo:"\u2261",line:"\u2500",mark:"\u203B",middot:"\xB7",minus:"\uFF0D",multiplication:"\xD7",obelus:"\xF7",pencilDownRight:"\u270E",pencilRight:"\u270F",pencilUpRight:"\u2710",percent:"%",pilcrow2:"\u2761",pilcrow:"\xB6",plusMinus:"\xB1",section:"\xA7",starsOff:"\u2606",starsOn:"\u2605",upDownArrow:"\u2195"},nhe=Object.assign({},R_,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",question:"?",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),ihe=Object.assign({},R_,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",question:"?",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:rhe?"\u25B8":"\u276F",pointerSmall:rhe?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});a2.exports=_At&&!UAt?nhe:ihe;Reflect.defineProperty(a2.exports,"common",{enumerable:!1,value:R_});Reflect.defineProperty(a2.exports,"windows",{enumerable:!1,value:nhe});Reflect.defineProperty(a2.exports,"other",{enumerable:!1,value:ihe})});var Vc=_((J_t,N_)=>{"use strict";var HAt=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),jAt=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,ohe=()=>{let t={enabled:!0,visible:!0,styles:{},keys:{}};"FORCE_COLOR"in process.env&&(t.enabled=process.env.FORCE_COLOR!=="0");let e=n=>{let u=n.open=`\x1B[${n.codes[0]}m`,A=n.close=`\x1B[${n.codes[1]}m`,p=n.regex=new RegExp(`\\u001b\\[${n.codes[1]}m`,"g");return n.wrap=(h,E)=>{h.includes(A)&&(h=h.replace(p,A+u));let I=u+h+A;return E?I.replace(/\r*\n/g,`${A}$&${u}`):I},n},r=(n,u,A)=>typeof n=="function"?n(u):n.wrap(u,A),o=(n,u)=>{if(n===""||n==null)return"";if(t.enabled===!1)return n;if(t.visible===!1)return"";let A=""+n,p=A.includes(` +`),h=u.length;for(h>0&&u.includes("unstyle")&&(u=[...new Set(["unstyle",...u])].reverse());h-- >0;)A=r(t.styles[u[h]],A,p);return A},a=(n,u,A)=>{t.styles[n]=e({name:n,codes:u}),(t.keys[A]||(t.keys[A]=[])).push(n),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(h){t.alias(n,h)},get(){let h=E=>o(E,h.stack);return Reflect.setPrototypeOf(h,t),h.stack=this.stack?this.stack.concat(n):[n],h}})};return a("reset",[0,0],"modifier"),a("bold",[1,22],"modifier"),a("dim",[2,22],"modifier"),a("italic",[3,23],"modifier"),a("underline",[4,24],"modifier"),a("inverse",[7,27],"modifier"),a("hidden",[8,28],"modifier"),a("strikethrough",[9,29],"modifier"),a("black",[30,39],"color"),a("red",[31,39],"color"),a("green",[32,39],"color"),a("yellow",[33,39],"color"),a("blue",[34,39],"color"),a("magenta",[35,39],"color"),a("cyan",[36,39],"color"),a("white",[37,39],"color"),a("gray",[90,39],"color"),a("grey",[90,39],"color"),a("bgBlack",[40,49],"bg"),a("bgRed",[41,49],"bg"),a("bgGreen",[42,49],"bg"),a("bgYellow",[43,49],"bg"),a("bgBlue",[44,49],"bg"),a("bgMagenta",[45,49],"bg"),a("bgCyan",[46,49],"bg"),a("bgWhite",[47,49],"bg"),a("blackBright",[90,39],"bright"),a("redBright",[91,39],"bright"),a("greenBright",[92,39],"bright"),a("yellowBright",[93,39],"bright"),a("blueBright",[94,39],"bright"),a("magentaBright",[95,39],"bright"),a("cyanBright",[96,39],"bright"),a("whiteBright",[97,39],"bright"),a("bgBlackBright",[100,49],"bgBright"),a("bgRedBright",[101,49],"bgBright"),a("bgGreenBright",[102,49],"bgBright"),a("bgYellowBright",[103,49],"bgBright"),a("bgBlueBright",[104,49],"bgBright"),a("bgMagentaBright",[105,49],"bgBright"),a("bgCyanBright",[106,49],"bgBright"),a("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=jAt,t.hasColor=t.hasAnsi=n=>(t.ansiRegex.lastIndex=0,typeof n=="string"&&n!==""&&t.ansiRegex.test(n)),t.alias=(n,u)=>{let A=typeof u=="string"?t[u]:u;if(typeof A!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");A.stack||(Reflect.defineProperty(A,"name",{value:n}),t.styles[n]=A,A.stack=[n]),Reflect.defineProperty(t,n,{configurable:!0,enumerable:!0,set(p){t.alias(n,p)},get(){let p=h=>o(h,p.stack);return Reflect.setPrototypeOf(p,t),p.stack=this.stack?this.stack.concat(A.stack):A.stack,p}})},t.theme=n=>{if(!HAt(n))throw new TypeError("Expected theme to be an object");for(let u of Object.keys(n))t.alias(u,n[u]);return t},t.alias("unstyle",n=>typeof n=="string"&&n!==""?(t.ansiRegex.lastIndex=0,n.replace(t.ansiRegex,"")):""),t.alias("noop",n=>n),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=she(),t.define=a,t};N_.exports=ohe();N_.exports.create=ohe});var No=_(nn=>{"use strict";var qAt=Object.prototype.toString,rc=Vc(),ahe=!1,L_=[],lhe={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};nn.longest=(t,e)=>t.reduce((r,o)=>Math.max(r,e?o[e].length:o.length),0);nn.hasColor=t=>!!t&&rc.hasColor(t);var ok=nn.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);nn.nativeType=t=>qAt.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"");nn.isAsyncFn=t=>nn.nativeType(t)==="asyncfunction";nn.isPrimitive=t=>t!=null&&typeof t!="object"&&typeof t!="function";nn.resolve=(t,e,...r)=>typeof e=="function"?e.call(t,...r):e;nn.scrollDown=(t=[])=>[...t.slice(1),t[0]];nn.scrollUp=(t=[])=>[t.pop(),...t];nn.reorder=(t=[])=>{let e=t.slice();return e.sort((r,o)=>r.index>o.index?1:r.index{let o=t.length,a=r===o?0:r<0?o-1:r,n=t[e];t[e]=t[a],t[a]=n};nn.width=(t,e=80)=>{let r=t&&t.columns?t.columns:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[0]),process.platform==="win32"?r-1:r};nn.height=(t,e=20)=>{let r=t&&t.rows?t.rows:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[1]),r};nn.wordWrap=(t,e={})=>{if(!t)return t;typeof e=="number"&&(e={width:e});let{indent:r="",newline:o=` +`+r,width:a=80}=e,n=(o+r).match(/[^\S\n]/g)||[];a-=n.length;let u=`.{1,${a}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,A=t.trim(),p=new RegExp(u,"g"),h=A.match(p)||[];return h=h.map(E=>E.replace(/\n$/,"")),e.padEnd&&(h=h.map(E=>E.padEnd(a," "))),e.padStart&&(h=h.map(E=>E.padStart(a," "))),r+h.join(o)};nn.unmute=t=>{let e=t.stack.find(o=>rc.keys.color.includes(o));return e?rc[e]:t.stack.find(o=>o.slice(2)==="bg")?rc[e.slice(2)]:o=>o};nn.pascal=t=>t?t[0].toUpperCase()+t.slice(1):"";nn.inverse=t=>{if(!t||!t.stack)return t;let e=t.stack.find(o=>rc.keys.color.includes(o));if(e){let o=rc["bg"+nn.pascal(e)];return o?o.black:t}let r=t.stack.find(o=>o.slice(0,2)==="bg");return r?rc[r.slice(2).toLowerCase()]||t:rc.none};nn.complement=t=>{if(!t||!t.stack)return t;let e=t.stack.find(o=>rc.keys.color.includes(o)),r=t.stack.find(o=>o.slice(0,2)==="bg");if(e&&!r)return rc[lhe[e]||e];if(r){let o=r.slice(2).toLowerCase(),a=lhe[o];return a&&rc["bg"+nn.pascal(a)]||t}return rc.none};nn.meridiem=t=>{let e=t.getHours(),r=t.getMinutes(),o=e>=12?"pm":"am";e=e%12;let a=e===0?12:e,n=r<10?"0"+r:r;return a+":"+n+" "+o};nn.set=(t={},e="",r)=>e.split(".").reduce((o,a,n,u)=>{let A=u.length-1>n?o[a]||{}:r;return!nn.isObject(A)&&n{let o=t[e]==null?e.split(".").reduce((a,n)=>a&&a[n],t):t[e];return o??r};nn.mixin=(t,e)=>{if(!ok(t))return e;if(!ok(e))return t;for(let r of Object.keys(e)){let o=Object.getOwnPropertyDescriptor(e,r);if(o.hasOwnProperty("value"))if(t.hasOwnProperty(r)&&ok(o.value)){let a=Object.getOwnPropertyDescriptor(t,r);ok(a.value)?t[r]=nn.merge({},t[r],e[r]):Reflect.defineProperty(t,r,o)}else Reflect.defineProperty(t,r,o);else Reflect.defineProperty(t,r,o)}return t};nn.merge=(...t)=>{let e={};for(let r of t)nn.mixin(e,r);return e};nn.mixinEmitter=(t,e)=>{let r=e.constructor.prototype;for(let o of Object.keys(r)){let a=r[o];typeof a=="function"?nn.define(t,o,a.bind(e)):nn.define(t,o,a)}};nn.onExit=t=>{let e=(r,o)=>{ahe||(ahe=!0,L_.forEach(a=>a()),r===!0&&process.exit(128+o))};L_.length===0&&(process.once("SIGTERM",e.bind(null,!0,15)),process.once("SIGINT",e.bind(null,!0,2)),process.once("exit",e)),L_.push(t)};nn.define=(t,e,r)=>{Reflect.defineProperty(t,e,{value:r})};nn.defineExport=(t,e,r)=>{let o;Reflect.defineProperty(t,e,{enumerable:!0,configurable:!0,set(a){o=a},get(){return o?o():r()}})}});var che=_(pC=>{"use strict";pC.ctrl={a:"first",b:"backward",c:"cancel",d:"deleteForward",e:"last",f:"forward",g:"reset",i:"tab",k:"cutForward",l:"reset",n:"newItem",m:"cancel",j:"submit",p:"search",r:"remove",s:"save",u:"undo",w:"cutLeft",x:"toggleCursor",v:"paste"};pC.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};pC.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};pC.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};pC.keys={pageup:"pageUp",pagedown:"pageDown",home:"home",end:"end",cancel:"cancel",delete:"deleteForward",backspace:"delete",down:"down",enter:"submit",escape:"cancel",left:"left",space:"space",number:"number",return:"submit",right:"right",tab:"next",up:"up"}});var fhe=_((Z_t,Ahe)=>{"use strict";var uhe=Be("readline"),GAt=che(),YAt=/^(?:\x1b)([a-zA-Z0-9])$/,WAt=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,VAt={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"};function KAt(t){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(t)}function JAt(t){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(t)}var ak=(t="",e={})=>{let r,o={name:e.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:t,raw:t,...e};if(Buffer.isBuffer(t)?t[0]>127&&t[1]===void 0?(t[0]-=128,t="\x1B"+String(t)):t=String(t):t!==void 0&&typeof t!="string"?t=String(t):t||(t=o.sequence||""),o.sequence=o.sequence||t||o.name,t==="\r")o.raw=void 0,o.name="return";else if(t===` +`)o.name="enter";else if(t===" ")o.name="tab";else if(t==="\b"||t==="\x7F"||t==="\x1B\x7F"||t==="\x1B\b")o.name="backspace",o.meta=t.charAt(0)==="\x1B";else if(t==="\x1B"||t==="\x1B\x1B")o.name="escape",o.meta=t.length===2;else if(t===" "||t==="\x1B ")o.name="space",o.meta=t.length===2;else if(t<="")o.name=String.fromCharCode(t.charCodeAt(0)+"a".charCodeAt(0)-1),o.ctrl=!0;else if(t.length===1&&t>="0"&&t<="9")o.name="number";else if(t.length===1&&t>="a"&&t<="z")o.name=t;else if(t.length===1&&t>="A"&&t<="Z")o.name=t.toLowerCase(),o.shift=!0;else if(r=YAt.exec(t))o.meta=!0,o.shift=/^[A-Z]$/.test(r[1]);else if(r=WAt.exec(t)){let a=[...t];a[0]==="\x1B"&&a[1]==="\x1B"&&(o.option=!0);let n=[r[1],r[2],r[4],r[6]].filter(Boolean).join(""),u=(r[3]||r[5]||1)-1;o.ctrl=!!(u&4),o.meta=!!(u&10),o.shift=!!(u&1),o.code=n,o.name=VAt[n],o.shift=KAt(n)||o.shift,o.ctrl=JAt(n)||o.ctrl}return o};ak.listen=(t={},e)=>{let{stdin:r}=t;if(!r||r!==process.stdin&&!r.isTTY)throw new Error("Invalid stream passed");let o=uhe.createInterface({terminal:!0,input:r});uhe.emitKeypressEvents(r,o);let a=(A,p)=>e(A,ak(A,p),o),n=r.isRaw;return r.isTTY&&r.setRawMode(!0),r.on("keypress",a),o.resume(),()=>{r.isTTY&&r.setRawMode(n),r.removeListener("keypress",a),o.pause(),o.close()}};ak.action=(t,e,r)=>{let o={...GAt,...r};return e.ctrl?(e.action=o.ctrl[e.name],e):e.option&&o.option?(e.action=o.option[e.name],e):e.shift?(e.action=o.shift[e.name],e):(e.action=o.keys[e.name],e)};Ahe.exports=ak});var hhe=_(($_t,phe)=>{"use strict";phe.exports=t=>{t.timers=t.timers||{};let e=t.options.timers;if(!!e)for(let r of Object.keys(e)){let o=e[r];typeof o=="number"&&(o={interval:o}),zAt(t,r,o)}};function zAt(t,e,r={}){let o=t.timers[e]={name:e,start:Date.now(),ms:0,tick:0},a=r.interval||120;o.frames=r.frames||[],o.loading=!0;let n=setInterval(()=>{o.ms=Date.now()-o.start,o.tick++,t.render()},a);return o.stop=()=>{o.loading=!1,clearInterval(n)},Reflect.defineProperty(o,"interval",{value:n}),t.once("close",()=>o.stop()),o.stop}});var dhe=_((e8t,ghe)=>{"use strict";var{define:XAt,width:ZAt}=No(),M_=class{constructor(e){let r=e.options;XAt(this,"_prompt",e),this.type=e.type,this.name=e.name,this.message="",this.header="",this.footer="",this.error="",this.hint="",this.input="",this.cursor=0,this.index=0,this.lines=0,this.tick=0,this.prompt="",this.buffer="",this.width=ZAt(r.stdout||process.stdout),Object.assign(this,r),this.name=this.name||this.message,this.message=this.message||this.name,this.symbols=e.symbols,this.styles=e.styles,this.required=new Set,this.cancelled=!1,this.submitted=!1}clone(){let e={...this};return e.status=this.status,e.buffer=Buffer.from(e.buffer),delete e.clone,e}set color(e){this._color=e}get color(){let e=this.prompt.styles;if(this.cancelled)return e.cancelled;if(this.submitted)return e.submitted;let r=this._color||e[this.status];return typeof r=="function"?r:e.pending}set loading(e){this._loading=e}get loading(){return typeof this._loading=="boolean"?this._loading:this.loadingChoices?"choices":!1}get status(){return this.cancelled?"cancelled":this.submitted?"submitted":"pending"}};ghe.exports=M_});var yhe=_((t8t,mhe)=>{"use strict";var O_=No(),eo=Vc(),U_={default:eo.noop,noop:eo.noop,set inverse(t){this._inverse=t},get inverse(){return this._inverse||O_.inverse(this.primary)},set complement(t){this._complement=t},get complement(){return this._complement||O_.complement(this.primary)},primary:eo.cyan,success:eo.green,danger:eo.magenta,strong:eo.bold,warning:eo.yellow,muted:eo.dim,disabled:eo.gray,dark:eo.dim.gray,underline:eo.underline,set info(t){this._info=t},get info(){return this._info||this.primary},set em(t){this._em=t},get em(){return this._em||this.primary.underline},set heading(t){this._heading=t},get heading(){return this._heading||this.muted.underline},set pending(t){this._pending=t},get pending(){return this._pending||this.primary},set submitted(t){this._submitted=t},get submitted(){return this._submitted||this.success},set cancelled(t){this._cancelled=t},get cancelled(){return this._cancelled||this.danger},set typing(t){this._typing=t},get typing(){return this._typing||this.dim},set placeholder(t){this._placeholder=t},get placeholder(){return this._placeholder||this.primary.dim},set highlight(t){this._highlight=t},get highlight(){return this._highlight||this.inverse}};U_.merge=(t={})=>{t.styles&&typeof t.styles.enabled=="boolean"&&(eo.enabled=t.styles.enabled),t.styles&&typeof t.styles.visible=="boolean"&&(eo.visible=t.styles.visible);let e=O_.merge({},U_,t.styles);delete e.merge;for(let r of Object.keys(eo))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>eo[r]});for(let r of Object.keys(eo.styles))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>eo[r]});return e};mhe.exports=U_});var Che=_((r8t,Ehe)=>{"use strict";var __=process.platform==="win32",Vf=Vc(),$At=No(),H_={...Vf.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301",ellipsisLarge:"\u22EF",ellipsisSmall:"\u2026",fullBlock:"\u2588",identicalTo:"\u2261",indicator:Vf.symbols.check,leftAngle:"\u2039",mark:"\u203B",minus:"\u2212",multiplication:"\xD7",obelus:"\xF7",percent:"%",pilcrow:"\xB6",pilcrow2:"\u2761",pencilUpRight:"\u2710",pencilDownRight:"\u270E",pencilRight:"\u270F",plus:"+",plusMinus:"\xB1",pointRight:"\u261E",rightAngle:"\u203A",section:"\xA7",hexagon:{off:"\u2B21",on:"\u2B22",disabled:"\u2B22"},ballot:{on:"\u2611",off:"\u2610",disabled:"\u2612"},stars:{on:"\u2605",off:"\u2606",disabled:"\u2606"},folder:{on:"\u25BC",off:"\u25B6",disabled:"\u25B6"},prefix:{pending:Vf.symbols.question,submitted:Vf.symbols.check,cancelled:Vf.symbols.cross},separator:{pending:Vf.symbols.pointerSmall,submitted:Vf.symbols.middot,cancelled:Vf.symbols.middot},radio:{off:__?"( )":"\u25EF",on:__?"(*)":"\u25C9",disabled:__?"(|)":"\u24BE"},numbers:["\u24EA","\u2460","\u2461","\u2462","\u2463","\u2464","\u2465","\u2466","\u2467","\u2468","\u2469","\u246A","\u246B","\u246C","\u246D","\u246E","\u246F","\u2470","\u2471","\u2472","\u2473","\u3251","\u3252","\u3253","\u3254","\u3255","\u3256","\u3257","\u3258","\u3259","\u325A","\u325B","\u325C","\u325D","\u325E","\u325F","\u32B1","\u32B2","\u32B3","\u32B4","\u32B5","\u32B6","\u32B7","\u32B8","\u32B9","\u32BA","\u32BB","\u32BC","\u32BD","\u32BE","\u32BF"]};H_.merge=t=>{let e=$At.merge({},Vf.symbols,H_,t.symbols);return delete e.merge,e};Ehe.exports=H_});var Ihe=_((n8t,whe)=>{"use strict";var eft=yhe(),tft=Che(),rft=No();whe.exports=t=>{t.options=rft.merge({},t.options.theme,t.options),t.symbols=tft.merge(t.options),t.styles=eft.merge(t.options)}});var She=_((Dhe,Phe)=>{"use strict";var Bhe=process.env.TERM_PROGRAM==="Apple_Terminal",nft=Vc(),j_=No(),Kc=Phe.exports=Dhe,Di="\x1B[",vhe="\x07",q_=!1,Ph=Kc.code={bell:vhe,beep:vhe,beginning:`${Di}G`,down:`${Di}J`,esc:Di,getPosition:`${Di}6n`,hide:`${Di}?25l`,line:`${Di}2K`,lineEnd:`${Di}K`,lineStart:`${Di}1K`,restorePosition:Di+(Bhe?"8":"u"),savePosition:Di+(Bhe?"7":"s"),screen:`${Di}2J`,show:`${Di}?25h`,up:`${Di}1J`},qd=Kc.cursor={get hidden(){return q_},hide(){return q_=!0,Ph.hide},show(){return q_=!1,Ph.show},forward:(t=1)=>`${Di}${t}C`,backward:(t=1)=>`${Di}${t}D`,nextLine:(t=1)=>`${Di}E`.repeat(t),prevLine:(t=1)=>`${Di}F`.repeat(t),up:(t=1)=>t?`${Di}${t}A`:"",down:(t=1)=>t?`${Di}${t}B`:"",right:(t=1)=>t?`${Di}${t}C`:"",left:(t=1)=>t?`${Di}${t}D`:"",to(t,e){return e?`${Di}${e+1};${t+1}H`:`${Di}${t+1}G`},move(t=0,e=0){let r="";return r+=t<0?qd.left(-t):t>0?qd.right(t):"",r+=e<0?qd.up(-e):e>0?qd.down(e):"",r},restore(t={}){let{after:e,cursor:r,initial:o,input:a,prompt:n,size:u,value:A}=t;if(o=j_.isPrimitive(o)?String(o):"",a=j_.isPrimitive(a)?String(a):"",A=j_.isPrimitive(A)?String(A):"",u){let p=Kc.cursor.up(u)+Kc.cursor.to(n.length),h=a.length-r;return h>0&&(p+=Kc.cursor.left(h)),p}if(A||e){let p=!a&&!!o?-o.length:-a.length+r;return e&&(p-=e.length),a===""&&o&&!n.includes(o)&&(p+=o.length),Kc.cursor.move(p)}}},G_=Kc.erase={screen:Ph.screen,up:Ph.up,down:Ph.down,line:Ph.line,lineEnd:Ph.lineEnd,lineStart:Ph.lineStart,lines(t){let e="";for(let r=0;r{if(!e)return G_.line+qd.to(0);let r=n=>[...nft.unstyle(n)].length,o=t.split(/\r?\n/),a=0;for(let n of o)a+=1+Math.floor(Math.max(r(n)-1,0)/e);return(G_.line+qd.prevLine()).repeat(a-1)+G_.line+qd.to(0)}});var hC=_((i8t,bhe)=>{"use strict";var ift=Be("events"),xhe=Vc(),Y_=fhe(),sft=hhe(),oft=dhe(),aft=Ihe(),Ta=No(),Gd=She(),l2=class extends ift{constructor(e={}){super(),this.name=e.name,this.type=e.type,this.options=e,aft(this),sft(this),this.state=new oft(this),this.initial=[e.initial,e.default].find(r=>r!=null),this.stdout=e.stdout||process.stdout,this.stdin=e.stdin||process.stdin,this.scale=e.scale||1,this.term=this.options.term||process.env.TERM_PROGRAM,this.margin=cft(this.options.margin),this.setMaxListeners(0),lft(this)}async keypress(e,r={}){this.keypressed=!0;let o=Y_.action(e,Y_(e,r),this.options.actions);this.state.keypress=o,this.emit("keypress",e,o),this.emit("state",this.state.clone());let a=this.options[o.action]||this[o.action]||this.dispatch;if(typeof a=="function")return await a.call(this,e,o);this.alert()}alert(){delete this.state.alert,this.options.show===!1?this.emit("alert"):this.stdout.write(Gd.code.beep)}cursorHide(){this.stdout.write(Gd.cursor.hide()),Ta.onExit(()=>this.cursorShow())}cursorShow(){this.stdout.write(Gd.cursor.show())}write(e){!e||(this.stdout&&this.state.show!==!1&&this.stdout.write(e),this.state.buffer+=e)}clear(e=0){let r=this.state.buffer;this.state.buffer="",!(!r&&!e||this.options.show===!1)&&this.stdout.write(Gd.cursor.down(e)+Gd.clear(r,this.width))}restore(){if(this.state.closed||this.options.show===!1)return;let{prompt:e,after:r,rest:o}=this.sections(),{cursor:a,initial:n="",input:u="",value:A=""}=this,p=this.state.size=o.length,h={after:r,cursor:a,initial:n,input:u,prompt:e,size:p,value:A},E=Gd.cursor.restore(h);E&&this.stdout.write(E)}sections(){let{buffer:e,input:r,prompt:o}=this.state;o=xhe.unstyle(o);let a=xhe.unstyle(e),n=a.indexOf(o),u=a.slice(0,n),p=a.slice(n).split(` +`),h=p[0],E=p[p.length-1],v=(o+(r?" "+r:"")).length,b=ve.call(this,this.value),this.result=()=>o.call(this,this.value),typeof r.initial=="function"&&(this.initial=await r.initial.call(this,this)),typeof r.onRun=="function"&&await r.onRun.call(this,this),typeof r.onSubmit=="function"){let a=r.onSubmit.bind(this),n=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>(await a(this.name,this.value,this),n())}await this.start(),await this.render()}render(){throw new Error("expected prompt to have a custom render method")}run(){return new Promise(async(e,r)=>{if(this.once("submit",e),this.once("cancel",r),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(e,r,o){let{options:a,state:n,symbols:u,timers:A}=this,p=A&&A[e];n.timer=p;let h=a[e]||n[e]||u[e],E=r&&r[e]!=null?r[e]:await h;if(E==="")return E;let I=await this.resolve(E,n,r,o);return!I&&r&&r[e]?this.resolve(h,n,r,o):I}async prefix(){let e=await this.element("prefix")||this.symbols,r=this.timers&&this.timers.prefix,o=this.state;return o.timer=r,Ta.isObject(e)&&(e=e[o.status]||e.pending),Ta.hasColor(e)?e:(this.styles[o.status]||this.styles.pending)(e)}async message(){let e=await this.element("message");return Ta.hasColor(e)?e:this.styles.strong(e)}async separator(){let e=await this.element("separator")||this.symbols,r=this.timers&&this.timers.separator,o=this.state;o.timer=r;let a=e[o.status]||e.pending||o.separator,n=await this.resolve(a,o);return Ta.isObject(n)&&(n=n[o.status]||n.pending),Ta.hasColor(n)?n:this.styles.muted(n)}async pointer(e,r){let o=await this.element("pointer",e,r);if(typeof o=="string"&&Ta.hasColor(o))return o;if(o){let a=this.styles,n=this.index===r,u=n?a.primary:h=>h,A=await this.resolve(o[n?"on":"off"]||o,this.state),p=Ta.hasColor(A)?A:u(A);return n?p:" ".repeat(A.length)}}async indicator(e,r){let o=await this.element("indicator",e,r);if(typeof o=="string"&&Ta.hasColor(o))return o;if(o){let a=this.styles,n=e.enabled===!0,u=n?a.success:a.dark,A=o[n?"on":"off"]||o;return Ta.hasColor(A)?A:u(A)}return""}body(){return null}footer(){if(this.state.status==="pending")return this.element("footer")}header(){if(this.state.status==="pending")return this.element("header")}async hint(){if(this.state.status==="pending"&&!this.isValue(this.state.input)){let e=await this.element("hint");return Ta.hasColor(e)?e:this.styles.muted(e)}}error(e){return this.state.submitted?"":e||this.state.error}format(e){return e}result(e){return e}validate(e){return this.options.required===!0?this.isValue(e):!0}isValue(e){return e!=null&&e!==""}resolve(e,...r){return Ta.resolve(this,e,...r)}get base(){return l2.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||Ta.height(this.stdout,25)}get width(){return this.options.columns||Ta.width(this.stdout,80)}get size(){return{width:this.width,height:this.height}}set cursor(e){this.state.cursor=e}get cursor(){return this.state.cursor}set input(e){this.state.input=e}get input(){return this.state.input}set value(e){this.state.value=e}get value(){let{input:e,value:r}=this.state,o=[r,e].find(this.isValue.bind(this));return this.isValue(o)?o:this.initial}static get prompt(){return e=>new this(e).run()}};function lft(t){let e=a=>t[a]===void 0||typeof t[a]=="function",r=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],o=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let a of Object.keys(t.options)){if(r.includes(a)||/^on[A-Z]/.test(a))continue;let n=t.options[a];typeof n=="function"&&e(a)?o.includes(a)||(t[a]=n.bind(t)):typeof t[a]!="function"&&(t[a]=n)}}function cft(t){typeof t=="number"&&(t=[t,t,t,t]);let e=[].concat(t||[]),r=a=>a%2===0?` +`:" ",o=[];for(let a=0;a<4;a++){let n=r(a);e[a]?o.push(n.repeat(e[a])):o.push("")}return o}bhe.exports=l2});var Fhe=_((s8t,Qhe)=>{"use strict";var uft=No(),khe={default(t,e){return e},checkbox(t,e){throw new Error("checkbox role is not implemented yet")},editable(t,e){throw new Error("editable role is not implemented yet")},expandable(t,e){throw new Error("expandable role is not implemented yet")},heading(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||"",e},input(t,e){throw new Error("input role is not implemented yet")},option(t,e){return khe.default(t,e)},radio(t,e){throw new Error("radio role is not implemented yet")},separator(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||t.symbols.line.repeat(5),e},spacer(t,e){return e}};Qhe.exports=(t,e={})=>{let r=uft.merge({},khe,e.roles);return r[t]||r.default}});var c2=_((o8t,Nhe)=>{"use strict";var Aft=Vc(),fft=hC(),pft=Fhe(),lk=No(),{reorder:W_,scrollUp:hft,scrollDown:gft,isObject:The,swap:dft}=lk,V_=class extends fft{constructor(e){super(e),this.cursorHide(),this.maxSelected=e.maxSelected||1/0,this.multiple=e.multiple||!1,this.initial=e.initial||0,this.delay=e.delay||0,this.longest=0,this.num=""}async initialize(){typeof this.options.initial=="function"&&(this.initial=await this.options.initial.call(this)),await this.reset(!0),await super.initialize()}async reset(){let{choices:e,initial:r,autofocus:o,suggest:a}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(e)),this.choices.forEach(n=>n.enabled=!1),typeof a!="function"&&this.selectable.length===0)throw new Error("At least one choice must be selectable");The(r)&&(r=Object.keys(r)),Array.isArray(r)?(o!=null&&(this.index=this.findIndex(o)),r.forEach(n=>this.enable(this.find(n))),await this.render()):(o!=null&&(r=o),typeof r=="string"&&(r=this.findIndex(r)),typeof r=="number"&&r>-1&&(this.index=Math.max(0,Math.min(r,this.choices.length)),this.enable(this.find(this.index)))),this.isDisabled(this.focused)&&await this.down()}async toChoices(e,r){this.state.loadingChoices=!0;let o=[],a=0,n=async(u,A)=>{typeof u=="function"&&(u=await u.call(this)),u instanceof Promise&&(u=await u);for(let p=0;p(this.state.loadingChoices=!1,u))}async toChoice(e,r,o){if(typeof e=="function"&&(e=await e.call(this,this)),e instanceof Promise&&(e=await e),typeof e=="string"&&(e={name:e}),e.normalized)return e;e.normalized=!0;let a=e.value;if(e=pft(e.role,this.options)(this,e),typeof e.disabled=="string"&&!e.hint&&(e.hint=e.disabled,e.disabled=!0),e.disabled===!0&&e.hint==null&&(e.hint="(disabled)"),e.index!=null)return e;e.name=e.name||e.key||e.title||e.value||e.message,e.message=e.message||e.name||"",e.value=[e.value,e.name].find(this.isValue.bind(this)),e.input="",e.index=r,e.cursor=0,lk.define(e,"parent",o),e.level=o?o.level+1:1,e.indent==null&&(e.indent=o?o.indent+" ":e.indent||""),e.path=o?o.path+"."+e.name:e.name,e.enabled=!!(this.multiple&&!this.isDisabled(e)&&(e.enabled||this.isSelected(e))),this.isDisabled(e)||(this.longest=Math.max(this.longest,Aft.unstyle(e.message).length));let u={...e};return e.reset=(A=u.input,p=u.value)=>{for(let h of Object.keys(u))e[h]=u[h];e.input=A,e.value=p},a==null&&typeof e.initial=="function"&&(e.input=await e.initial.call(this,this.state,e,r)),e}async onChoice(e,r){this.emit("choice",e,r,this),typeof e.onChoice=="function"&&await e.onChoice.call(this,this.state,e,r)}async addChoice(e,r,o){let a=await this.toChoice(e,r,o);return this.choices.push(a),this.index=this.choices.length-1,this.limit=this.choices.length,a}async newItem(e,r,o){let a={name:"New choice name?",editable:!0,newChoice:!0,...e},n=await this.addChoice(a,r,o);return n.updateChoice=()=>{delete n.newChoice,n.name=n.message=n.input,n.input="",n.cursor=0},this.render()}indent(e){return e.indent==null?e.level>1?" ".repeat(e.level-1):"":e.indent}dispatch(e,r){if(this.multiple&&this[r.name])return this[r.name]();this.alert()}focus(e,r){return typeof r!="boolean"&&(r=e.enabled),r&&!e.enabled&&this.selected.length>=this.maxSelected?this.alert():(this.index=e.index,e.enabled=r&&!this.isDisabled(e),e)}space(){return this.multiple?(this.toggle(this.focused),this.render()):this.alert()}a(){if(this.maxSelectedr.enabled);return this.choices.forEach(r=>r.enabled=!e),this.render()}i(){return this.choices.length-this.selected.length>this.maxSelected?this.alert():(this.choices.forEach(e=>e.enabled=!e.enabled),this.render())}g(e=this.focused){return this.choices.some(r=>!!r.parent)?(this.toggle(e.parent&&!e.choices?e.parent:e),this.render()):this.a()}toggle(e,r){if(!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();typeof r!="boolean"&&(r=!e.enabled),e.enabled=r,e.choices&&e.choices.forEach(a=>this.toggle(a,r));let o=e.parent;for(;o;){let a=o.choices.filter(n=>this.isDisabled(n));o.enabled=a.every(n=>n.enabled===!0),o=o.parent}return Rhe(this,this.choices),this.emit("toggle",e,this),e}enable(e){return this.selected.length>=this.maxSelected?this.alert():(e.enabled=!this.isDisabled(e),e.choices&&e.choices.forEach(this.enable.bind(this)),e)}disable(e){return e.enabled=!1,e.choices&&e.choices.forEach(this.disable.bind(this)),e}number(e){this.num+=e;let r=o=>{let a=Number(o);if(a>this.choices.length-1)return this.alert();let n=this.focused,u=this.choices.find(A=>a===A.index);if(!u.enabled&&this.selected.length>=this.maxSelected)return this.alert();if(this.visible.indexOf(u)===-1){let A=W_(this.choices),p=A.indexOf(u);if(n.index>p){let h=A.slice(p,p+this.limit),E=A.filter(I=>!h.includes(I));this.choices=h.concat(E)}else{let h=p-this.limit+1;this.choices=A.slice(h).concat(A.slice(0,h))}}return this.index=this.choices.indexOf(u),this.toggle(this.focused),this.render()};return clearTimeout(this.numberTimeout),new Promise(o=>{let a=this.choices.length,n=this.num,u=(A=!1,p)=>{clearTimeout(this.numberTimeout),A&&(p=r(n)),this.num="",o(p)};if(n==="0"||n.length===1&&Number(n+"0")>a)return u(!0);if(Number(n)>a)return u(!1,this.alert());this.numberTimeout=setTimeout(()=>u(!0),this.delay)})}home(){return this.choices=W_(this.choices),this.index=0,this.render()}end(){let e=this.choices.length-this.limit,r=W_(this.choices);return this.choices=r.slice(e).concat(r.slice(0,e)),this.index=this.limit-1,this.render()}first(){return this.index=0,this.render()}last(){return this.index=this.visible.length-1,this.render()}prev(){return this.visible.length<=1?this.alert():this.up()}next(){return this.visible.length<=1?this.alert():this.down()}right(){return this.cursor>=this.input.length?this.alert():(this.cursor++,this.render())}left(){return this.cursor<=0?this.alert():(this.cursor--,this.render())}up(){let e=this.choices.length,r=this.visible.length,o=this.index;return this.options.scroll===!1&&o===0?this.alert():e>r&&o===0?this.scrollUp():(this.index=(o-1%e+e)%e,this.isDisabled()?this.up():this.render())}down(){let e=this.choices.length,r=this.visible.length,o=this.index;return this.options.scroll===!1&&o===r-1?this.alert():e>r&&o===r-1?this.scrollDown():(this.index=(o+1)%e,this.isDisabled()?this.down():this.render())}scrollUp(e=0){return this.choices=hft(this.choices),this.index=e,this.isDisabled()?this.up():this.render()}scrollDown(e=this.visible.length-1){return this.choices=gft(this.choices),this.index=e,this.isDisabled()?this.down():this.render()}async shiftUp(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index-1),await this.up(),this.sorting=!1;return}return this.scrollUp(this.index)}async shiftDown(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index+1),await this.down(),this.sorting=!1;return}return this.scrollDown(this.index)}pageUp(){return this.visible.length<=1?this.alert():(this.limit=Math.max(this.limit-1,0),this.index=Math.min(this.limit-1,this.index),this._limit=this.limit,this.isDisabled()?this.up():this.render())}pageDown(){return this.visible.length>=this.choices.length?this.alert():(this.index=Math.max(0,this.index),this.limit=Math.min(this.limit+1,this.choices.length),this._limit=this.limit,this.isDisabled()?this.down():this.render())}swap(e){dft(this.choices,this.index,e)}isDisabled(e=this.focused){return e&&["disabled","collapsed","hidden","completing","readonly"].some(o=>e[o]===!0)?!0:e&&e.role==="heading"}isEnabled(e=this.focused){if(Array.isArray(e))return e.every(r=>this.isEnabled(r));if(e.choices){let r=e.choices.filter(o=>!this.isDisabled(o));return e.enabled&&r.every(o=>this.isEnabled(o))}return e.enabled&&!this.isDisabled(e)}isChoice(e,r){return e.name===r||e.index===Number(r)}isSelected(e){return Array.isArray(this.initial)?this.initial.some(r=>this.isChoice(e,r)):this.isChoice(e,this.initial)}map(e=[],r="value"){return[].concat(e||[]).reduce((o,a)=>(o[a]=this.find(a,r),o),{})}filter(e,r){let a=typeof e=="function"?e:(A,p)=>[A.name,p].includes(e),u=(this.options.multiple?this.state._choices:this.choices).filter(a);return r?u.map(A=>A[r]):u}find(e,r){if(The(e))return r?e[r]:e;let a=typeof e=="function"?e:(u,A)=>[u.name,A].includes(e),n=this.choices.find(a);if(n)return r?n[r]:n}findIndex(e){return this.choices.indexOf(this.find(e))}async submit(){let e=this.focused;if(!e)return this.alert();if(e.newChoice)return e.input?(e.updateChoice(),this.render()):this.alert();if(this.choices.some(u=>u.newChoice))return this.alert();let{reorder:r,sort:o}=this.options,a=this.multiple===!0,n=this.selected;return n===void 0?this.alert():(Array.isArray(n)&&r!==!1&&o!==!0&&(n=lk.reorder(n)),this.value=a?n.map(u=>u.name):n.name,super.submit())}set choices(e=[]){this.state._choices=this.state._choices||[],this.state.choices=e;for(let r of e)this.state._choices.some(o=>o.name===r.name)||this.state._choices.push(r);if(!this._initial&&this.options.initial){this._initial=!0;let r=this.initial;if(typeof r=="string"||typeof r=="number"){let o=this.find(r);o&&(this.initial=o.index,this.focus(o,!0))}}}get choices(){return Rhe(this,this.state.choices||[])}set visible(e){this.state.visible=e}get visible(){return(this.state.visible||this.choices).slice(0,this.limit)}set limit(e){this.state.limit=e}get limit(){let{state:e,options:r,choices:o}=this,a=e.limit||this._limit||r.limit||o.length;return Math.min(a,this.height)}set value(e){super.value=e}get value(){return typeof super.value!="string"&&super.value===this.initial?this.input:super.value}set index(e){this.state.index=e}get index(){return Math.max(0,this.state?this.state.index:0)}get enabled(){return this.filter(this.isEnabled.bind(this))}get focused(){let e=this.choices[this.index];return e&&this.state.submitted&&this.multiple!==!0&&(e.enabled=!0),e}get selectable(){return this.choices.filter(e=>!this.isDisabled(e))}get selected(){return this.multiple?this.enabled:this.focused}};function Rhe(t,e){if(e instanceof Promise)return e;if(typeof e=="function"){if(lk.isAsyncFn(e))return e;e=e.call(t,t)}for(let r of e){if(Array.isArray(r.choices)){let o=r.choices.filter(a=>!t.isDisabled(a));r.enabled=o.every(a=>a.enabled===!0)}t.isDisabled(r)===!0&&delete r.enabled}return e}Nhe.exports=V_});var Sh=_((a8t,Lhe)=>{"use strict";var mft=c2(),K_=No(),J_=class extends mft{constructor(e){super(e),this.emptyError=this.options.emptyError||"No items were selected"}async dispatch(e,r){if(this.multiple)return this[r.name]?await this[r.name](e,r):await super.dispatch(e,r);this.alert()}separator(){if(this.options.separator)return super.separator();let e=this.styles.muted(this.symbols.ellipsis);return this.state.submitted?super.separator():e}pointer(e,r){return!this.multiple||this.options.pointer?super.pointer(e,r):""}indicator(e,r){return this.multiple?super.indicator(e,r):""}choiceMessage(e,r){let o=this.resolve(e.message,this.state,e,r);return e.role==="heading"&&!K_.hasColor(o)&&(o=this.styles.strong(o)),this.resolve(o,this.state,e,r)}choiceSeparator(){return":"}async renderChoice(e,r){await this.onChoice(e,r);let o=this.index===r,a=await this.pointer(e,r),n=await this.indicator(e,r)+(e.pad||""),u=await this.resolve(e.hint,this.state,e,r);u&&!K_.hasColor(u)&&(u=this.styles.muted(u));let A=this.indent(e),p=await this.choiceMessage(e,r),h=()=>[this.margin[3],A+a+n,p,this.margin[1],u].filter(Boolean).join(" ");return e.role==="heading"?h():e.disabled?(K_.hasColor(p)||(p=this.styles.disabled(p)),h()):(o&&(p=this.styles.em(p)),h())}async renderChoices(){if(this.state.loading==="choices")return this.styles.warning("Loading choices");if(this.state.submitted)return"";let e=this.visible.map(async(n,u)=>await this.renderChoice(n,u)),r=await Promise.all(e);r.length||r.push(this.styles.danger("No matching choices"));let o=this.margin[0]+r.join(` +`),a;return this.options.choicesHeader&&(a=await this.resolve(this.options.choicesHeader,this.state)),[a,o].filter(Boolean).join(` +`)}format(){return!this.state.submitted||this.state.cancelled?"":Array.isArray(this.selected)?this.selected.map(e=>this.styles.primary(e.name)).join(", "):this.styles.primary(this.selected.name)}async render(){let{submitted:e,size:r}=this.state,o="",a=await this.header(),n=await this.prefix(),u=await this.separator(),A=await this.message();this.options.promptLine!==!1&&(o=[n,A,u,""].join(" "),this.state.prompt=o);let p=await this.format(),h=await this.error()||await this.hint(),E=await this.renderChoices(),I=await this.footer();p&&(o+=p),h&&!o.includes(h)&&(o+=" "+h),e&&!p&&!E.trim()&&this.multiple&&this.emptyError!=null&&(o+=this.styles.danger(this.emptyError)),this.clear(r),this.write([a,o,E,I].filter(Boolean).join(` +`)),this.write(this.margin[2]),this.restore()}};Lhe.exports=J_});var Ohe=_((l8t,Mhe)=>{"use strict";var yft=Sh(),Eft=(t,e)=>{let r=t.toLowerCase();return o=>{let n=o.toLowerCase().indexOf(r),u=e(o.slice(n,n+r.length));return n>=0?o.slice(0,n)+u+o.slice(n+r.length):o}},z_=class extends yft{constructor(e){super(e),this.cursorShow()}moveCursor(e){this.state.cursor+=e}dispatch(e){return this.append(e)}space(e){return this.options.multiple?super.space(e):this.append(e)}append(e){let{cursor:r,input:o}=this.state;return this.input=o.slice(0,r)+e+o.slice(r),this.moveCursor(1),this.complete()}delete(){let{cursor:e,input:r}=this.state;return r?(this.input=r.slice(0,e-1)+r.slice(e),this.moveCursor(-1),this.complete()):this.alert()}deleteForward(){let{cursor:e,input:r}=this.state;return r[e]===void 0?this.alert():(this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.complete())}number(e){return this.append(e)}async complete(){this.completing=!0,this.choices=await this.suggest(this.input,this.state._choices),this.state.limit=void 0,this.index=Math.min(Math.max(this.visible.length-1,0),this.index),await this.render(),this.completing=!1}suggest(e=this.input,r=this.state._choices){if(typeof this.options.suggest=="function")return this.options.suggest.call(this,e,r);let o=e.toLowerCase();return r.filter(a=>a.message.toLowerCase().includes(o))}pointer(){return""}format(){if(!this.focused)return this.input;if(this.options.multiple&&this.state.submitted)return this.selected.map(e=>this.styles.primary(e.message)).join(", ");if(this.state.submitted){let e=this.value=this.input=this.focused.value;return this.styles.primary(e)}return this.input}async render(){if(this.state.status!=="pending")return super.render();let e=this.options.highlight?this.options.highlight.bind(this):this.styles.placeholder,r=Eft(this.input,e),o=this.choices;this.choices=o.map(a=>({...a,message:r(a.message)})),await super.render(),this.choices=o}submit(){return this.options.multiple&&(this.value=this.selected.map(e=>e.name)),super.submit()}};Mhe.exports=z_});var Z_=_((c8t,Uhe)=>{"use strict";var X_=No();Uhe.exports=(t,e={})=>{t.cursorHide();let{input:r="",initial:o="",pos:a,showCursor:n=!0,color:u}=e,A=u||t.styles.placeholder,p=X_.inverse(t.styles.primary),h=T=>p(t.styles.black(T)),E=r,I=" ",v=h(I);if(t.blink&&t.blink.off===!0&&(h=T=>T,v=""),n&&a===0&&o===""&&r==="")return h(I);if(n&&a===0&&(r===o||r===""))return h(o[0])+A(o.slice(1));o=X_.isPrimitive(o)?`${o}`:"",r=X_.isPrimitive(r)?`${r}`:"";let b=o&&o.startsWith(r)&&o!==r,C=b?h(o[r.length]):v;if(a!==r.length&&n===!0&&(E=r.slice(0,a)+h(r[a])+r.slice(a+1),C=""),n===!1&&(C=""),b){let T=t.styles.unstyle(E+C);return E+C+A(o.slice(T.length))}return E+C}});var ck=_((u8t,_he)=>{"use strict";var Cft=Vc(),wft=Sh(),Ift=Z_(),$_=class extends wft{constructor(e){super({...e,multiple:!0}),this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find(r=>r!=null),this.emptyError="",this.values={}}async reset(e){return await super.reset(),e===!0&&(this._index=this.index),this.index=this._index,this.values={},this.choices.forEach(r=>r.reset&&r.reset()),this.render()}dispatch(e){return!!e&&this.append(e)}append(e){let r=this.focused;if(!r)return this.alert();let{cursor:o,input:a}=r;return r.value=r.input=a.slice(0,o)+e+a.slice(o),r.cursor++,this.render()}delete(){let e=this.focused;if(!e||e.cursor<=0)return this.alert();let{cursor:r,input:o}=e;return e.value=e.input=o.slice(0,r-1)+o.slice(r),e.cursor--,this.render()}deleteForward(){let e=this.focused;if(!e)return this.alert();let{cursor:r,input:o}=e;if(o[r]===void 0)return this.alert();let a=`${o}`.slice(0,r)+`${o}`.slice(r+1);return e.value=e.input=a,this.render()}right(){let e=this.focused;return e?e.cursor>=e.input.length?this.alert():(e.cursor++,this.render()):this.alert()}left(){let e=this.focused;return e?e.cursor<=0?this.alert():(e.cursor--,this.render()):this.alert()}space(e,r){return this.dispatch(e,r)}number(e,r){return this.dispatch(e,r)}next(){let e=this.focused;if(!e)return this.alert();let{initial:r,input:o}=e;return r&&r.startsWith(o)&&o!==r?(e.value=e.input=r,e.cursor=e.value.length,this.render()):super.next()}prev(){let e=this.focused;return e?e.cursor===0?super.prev():(e.value=e.input="",e.cursor=0,this.render()):this.alert()}separator(){return""}format(e){return this.state.submitted?"":super.format(e)}pointer(){return""}indicator(e){return e.input?"\u29BF":"\u2299"}async choiceSeparator(e,r){let o=await this.resolve(e.separator,this.state,e,r)||":";return o?" "+this.styles.disabled(o):""}async renderChoice(e,r){await this.onChoice(e,r);let{state:o,styles:a}=this,{cursor:n,initial:u="",name:A,hint:p,input:h=""}=e,{muted:E,submitted:I,primary:v,danger:b}=a,C=p,T=this.index===r,L=e.validate||(()=>!0),U=await this.choiceSeparator(e,r),J=e.message;this.align==="right"&&(J=J.padStart(this.longest+1," ")),this.align==="left"&&(J=J.padEnd(this.longest+1," "));let te=this.values[A]=h||u,le=h?"success":"dark";await L.call(e,te,this.state)!==!0&&(le="danger");let pe=a[le],Ae=pe(await this.indicator(e,r))+(e.pad||""),ye=this.indent(e),ae=()=>[ye,Ae,J+U,h,C].filter(Boolean).join(" ");if(o.submitted)return J=Cft.unstyle(J),h=I(h),C="",ae();if(e.format)h=await e.format.call(this,h,e,r);else{let we=this.styles.muted;h=Ift(this,{input:h,initial:u,pos:n,showCursor:T,color:we})}return this.isValue(h)||(h=this.styles.muted(this.symbols.ellipsis)),e.result&&(this.values[A]=await e.result.call(this,te,e,r)),T&&(J=v(J)),e.error?h+=(h?" ":"")+b(e.error.trim()):e.hint&&(h+=(h?" ":"")+E(e.hint.trim())),ae()}async submit(){return this.value=this.values,super.base.submit.call(this)}};_he.exports=$_});var e8=_((A8t,jhe)=>{"use strict";var Bft=ck(),vft=()=>{throw new Error("expected prompt to have a custom authenticate method")},Hhe=(t=vft)=>{class e extends Bft{constructor(o){super(o)}async submit(){this.value=await t.call(this,this.values,this.state),super.base.submit.call(this)}static create(o){return Hhe(o)}}return e};jhe.exports=Hhe()});var Yhe=_((f8t,Ghe)=>{"use strict";var Dft=e8();function Pft(t,e){return t.username===this.options.username&&t.password===this.options.password}var qhe=(t=Pft)=>{let e=[{name:"username",message:"username"},{name:"password",message:"password",format(o){return this.options.showPassword?o:(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(o.length))}}];class r extends Dft.create(t){constructor(a){super({...a,choices:e})}static create(a){return qhe(a)}}return r};Ghe.exports=qhe()});var uk=_((p8t,Whe)=>{"use strict";var Sft=hC(),{isPrimitive:xft,hasColor:bft}=No(),t8=class extends Sft{constructor(e){super(e),this.cursorHide()}async initialize(){let e=await this.resolve(this.initial,this.state);this.input=await this.cast(e),await super.initialize()}dispatch(e){return this.isValue(e)?(this.input=e,this.submit()):this.alert()}format(e){let{styles:r,state:o}=this;return o.submitted?r.success(e):r.primary(e)}cast(e){return this.isTrue(e)}isTrue(e){return/^[ty1]/i.test(e)}isFalse(e){return/^[fn0]/i.test(e)}isValue(e){return xft(e)&&(this.isTrue(e)||this.isFalse(e))}async hint(){if(this.state.status==="pending"){let e=await this.element("hint");return bft(e)?e:this.styles.muted(e)}}async render(){let{input:e,size:r}=this.state,o=await this.prefix(),a=await this.separator(),n=await this.message(),u=this.styles.muted(this.default),A=[o,n,u,a].filter(Boolean).join(" ");this.state.prompt=A;let p=await this.header(),h=this.value=this.cast(e),E=await this.format(h),I=await this.error()||await this.hint(),v=await this.footer();I&&!A.includes(I)&&(E+=" "+I),A+=" "+E,this.clear(r),this.write([p,A,v].filter(Boolean).join(` +`)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}};Whe.exports=t8});var Khe=_((h8t,Vhe)=>{"use strict";var kft=uk(),r8=class extends kft{constructor(e){super(e),this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}};Vhe.exports=r8});var zhe=_((g8t,Jhe)=>{"use strict";var Qft=Sh(),Fft=ck(),gC=Fft.prototype,n8=class extends Qft{constructor(e){super({...e,multiple:!0}),this.align=[this.options.align,"left"].find(r=>r!=null),this.emptyError="",this.values={}}dispatch(e,r){let o=this.focused,a=o.parent||{};return!o.editable&&!a.editable&&(e==="a"||e==="i")?super[e]():gC.dispatch.call(this,e,r)}append(e,r){return gC.append.call(this,e,r)}delete(e,r){return gC.delete.call(this,e,r)}space(e){return this.focused.editable?this.append(e):super.space()}number(e){return this.focused.editable?this.append(e):super.number(e)}next(){return this.focused.editable?gC.next.call(this):super.next()}prev(){return this.focused.editable?gC.prev.call(this):super.prev()}async indicator(e,r){let o=e.indicator||"",a=e.editable?o:super.indicator(e,r);return await this.resolve(a,this.state,e,r)||""}indent(e){return e.role==="heading"?"":e.editable?" ":" "}async renderChoice(e,r){return e.indent="",e.editable?gC.renderChoice.call(this,e,r):super.renderChoice(e,r)}error(){return""}footer(){return this.state.error}async validate(){let e=!0;for(let r of this.choices){if(typeof r.validate!="function"||r.role==="heading")continue;let o=r.parent?this.value[r.parent.name]:this.value;if(r.editable?o=r.value===r.name?r.initial||"":r.value:this.isDisabled(r)||(o=r.enabled===!0),e=await r.validate(o,this.state),e!==!0)break}return e!==!0&&(this.state.error=typeof e=="string"?e:"Invalid Input"),e}submit(){if(this.focused.newChoice===!0)return super.submit();if(this.choices.some(e=>e.newChoice))return this.alert();this.value={};for(let e of this.choices){let r=e.parent?this.value[e.parent.name]:this.value;if(e.role==="heading"){this.value[e.name]={};continue}e.editable?r[e.name]=e.value===e.name?e.initial||"":e.value:this.isDisabled(e)||(r[e.name]=e.enabled===!0)}return this.base.submit.call(this)}};Jhe.exports=n8});var Yd=_((d8t,Xhe)=>{"use strict";var Tft=hC(),Rft=Z_(),{isPrimitive:Nft}=No(),i8=class extends Tft{constructor(e){super(e),this.initial=Nft(this.initial)?String(this.initial):"",this.initial&&this.cursorHide(),this.state.prevCursor=0,this.state.clipboard=[]}async keypress(e,r={}){let o=this.state.prevKeypress;return this.state.prevKeypress=r,this.options.multiline===!0&&r.name==="return"&&(!o||o.name!=="return")?this.append(` +`,r):super.keypress(e,r)}moveCursor(e){this.cursor+=e}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(e,r){if(!e||r.ctrl||r.code)return this.alert();this.append(e)}append(e){let{cursor:r,input:o}=this.state;this.input=`${o}`.slice(0,r)+e+`${o}`.slice(r),this.moveCursor(String(e).length),this.render()}insert(e){this.append(e)}delete(){let{cursor:e,input:r}=this.state;if(e<=0)return this.alert();this.input=`${r}`.slice(0,e-1)+`${r}`.slice(e),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:e,input:r}=this.state;if(r[e]===void 0)return this.alert();this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.render()}cutForward(){let e=this.cursor;if(this.input.length<=e)return this.alert();this.state.clipboard.push(this.input.slice(e)),this.input=this.input.slice(0,e),this.render()}cutLeft(){let e=this.cursor;if(e===0)return this.alert();let r=this.input.slice(0,e),o=this.input.slice(e),a=r.split(" ");this.state.clipboard.push(a.pop()),this.input=a.join(" "),this.cursor=this.input.length,this.input+=o,this.render()}paste(){if(!this.state.clipboard.length)return this.alert();this.insert(this.state.clipboard.pop()),this.render()}toggleCursor(){this.state.prevCursor?(this.cursor=this.state.prevCursor,this.state.prevCursor=0):(this.state.prevCursor=this.cursor,this.cursor=0),this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.input.length-1,this.render()}next(){let e=this.initial!=null?String(this.initial):"";if(!e||!e.startsWith(this.input))return this.alert();this.input=this.initial,this.cursor=this.initial.length,this.render()}prev(){if(!this.input)return this.alert();this.reset()}backward(){return this.left()}forward(){return this.right()}right(){return this.cursor>=this.input.length?this.alert():(this.moveCursor(1),this.render())}left(){return this.cursor<=0?this.alert():(this.moveCursor(-1),this.render())}isValue(e){return!!e}async format(e=this.value){let r=await this.resolve(this.initial,this.state);return this.state.submitted?this.styles.submitted(e||r):Rft(this,{input:e,initial:r,pos:this.cursor})}async render(){let e=this.state.size,r=await this.prefix(),o=await this.separator(),a=await this.message(),n=[r,a,o].filter(Boolean).join(" ");this.state.prompt=n;let u=await this.header(),A=await this.format(),p=await this.error()||await this.hint(),h=await this.footer();p&&!A.includes(p)&&(A+=" "+p),n+=" "+A,this.clear(e),this.write([u,n,h].filter(Boolean).join(` +`)),this.restore()}};Xhe.exports=i8});var $he=_((m8t,Zhe)=>{"use strict";var Lft=t=>t.filter((e,r)=>t.lastIndexOf(e)===r),Ak=t=>Lft(t).filter(Boolean);Zhe.exports=(t,e={},r="")=>{let{past:o=[],present:a=""}=e,n,u;switch(t){case"prev":case"undo":return n=o.slice(0,o.length-1),u=o[o.length-1]||"",{past:Ak([r,...n]),present:u};case"next":case"redo":return n=o.slice(1),u=o[0]||"",{past:Ak([...n,r]),present:u};case"save":return{past:Ak([...o,r]),present:""};case"remove":return u=Ak(o.filter(A=>A!==r)),a="",u.length&&(a=u.pop()),{past:u,present:a};default:throw new Error(`Invalid action: "${t}"`)}}});var o8=_((y8t,t0e)=>{"use strict";var Mft=Yd(),e0e=$he(),s8=class extends Mft{constructor(e){super(e);let r=this.options.history;if(r&&r.store){let o=r.values||this.initial;this.autosave=!!r.autosave,this.store=r.store,this.data=this.store.get("values")||{past:[],present:o},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(e){return this.store?(this.data=e0e(e,this.data,this.input),this.data.present?(this.input=this.data.present,this.cursor=this.input.length,this.render()):this.alert()):this.alert()}altUp(){return this.completion("prev")}altDown(){return this.completion("next")}prev(){return this.save(),super.prev()}save(){!this.store||(this.data=e0e("save",this.data,this.input),this.store.set("values",this.data))}submit(){return this.store&&this.autosave===!0&&this.save(),super.submit()}};t0e.exports=s8});var n0e=_((E8t,r0e)=>{"use strict";var Oft=Yd(),a8=class extends Oft{format(){return""}};r0e.exports=a8});var s0e=_((C8t,i0e)=>{"use strict";var Uft=Yd(),l8=class extends Uft{constructor(e={}){super(e),this.sep=this.options.separator||/, */,this.initial=e.initial||""}split(e=this.value){return e?String(e).split(this.sep):[]}format(){let e=this.state.submitted?this.styles.primary:r=>r;return this.list.map(e).join(", ")}async submit(e){let r=this.state.error||await this.validate(this.list,this.state);return r!==!0?(this.state.error=r,super.submit()):(this.value=this.list,super.submit())}get list(){return this.split()}};i0e.exports=l8});var a0e=_((w8t,o0e)=>{"use strict";var _ft=Sh(),c8=class extends _ft{constructor(e){super({...e,multiple:!0})}};o0e.exports=c8});var A8=_((I8t,l0e)=>{"use strict";var Hft=Yd(),u8=class extends Hft{constructor(e={}){super({style:"number",...e}),this.min=this.isValue(e.min)?this.toNumber(e.min):-1/0,this.max=this.isValue(e.max)?this.toNumber(e.max):1/0,this.delay=e.delay!=null?e.delay:1e3,this.float=e.float!==!1,this.round=e.round===!0||e.float===!1,this.major=e.major||10,this.minor=e.minor||1,this.initial=e.initial!=null?e.initial:"",this.input=String(this.initial),this.cursor=this.input.length,this.cursorShow()}append(e){return!/[-+.]/.test(e)||e==="."&&this.input.includes(".")?this.alert("invalid number"):super.append(e)}number(e){return super.append(e)}next(){return this.input&&this.input!==this.initial?this.alert():this.isValue(this.initial)?(this.input=this.initial,this.cursor=String(this.initial).length,this.render()):this.alert()}up(e){let r=e||this.minor,o=this.toNumber(this.input);return o>this.max+r?this.alert():(this.input=`${o+r}`,this.render())}down(e){let r=e||this.minor,o=this.toNumber(this.input);return othis.isValue(r));return this.value=this.toNumber(e||0),super.submit()}};l0e.exports=u8});var u0e=_((B8t,c0e)=>{c0e.exports=A8()});var f0e=_((v8t,A0e)=>{"use strict";var jft=Yd(),f8=class extends jft{constructor(e){super(e),this.cursorShow()}format(e=this.input){return this.keypressed?(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(e.length)):""}};A0e.exports=f8});var g0e=_((D8t,h0e)=>{"use strict";var qft=Vc(),Gft=c2(),p0e=No(),p8=class extends Gft{constructor(e={}){super(e),this.widths=[].concat(e.messageWidth||50),this.align=[].concat(e.align||"left"),this.linebreak=e.linebreak||!1,this.edgeLength=e.edgeLength||3,this.newline=e.newline||` + `;let r=e.startNumber||1;typeof this.scale=="number"&&(this.scaleKey=!1,this.scale=Array(this.scale).fill(0).map((o,a)=>({name:a+r})))}async reset(){return this.tableized=!1,await super.reset(),this.render()}tableize(){if(this.tableized===!0)return;this.tableized=!0;let e=0;for(let r of this.choices){e=Math.max(e,r.message.length),r.scaleIndex=r.initial||2,r.scale=[];for(let o=0;o=this.scale.length-1?this.alert():(e.scaleIndex++,this.render())}left(){let e=this.focused;return e.scaleIndex<=0?this.alert():(e.scaleIndex--,this.render())}indent(){return""}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.index)).join(", "):""}pointer(){return""}renderScaleKey(){return this.scaleKey===!1||this.state.submitted?"":["",...this.scale.map(o=>` ${o.name} - ${o.message}`)].map(o=>this.styles.muted(o)).join(` +`)}renderScaleHeading(e){let r=this.scale.map(p=>p.name);typeof this.options.renderScaleHeading=="function"&&(r=this.options.renderScaleHeading.call(this,e));let o=this.scaleLength-r.join("").length,a=Math.round(o/(r.length-1)),u=r.map(p=>this.styles.strong(p)).join(" ".repeat(a)),A=" ".repeat(this.widths[0]);return this.margin[3]+A+this.margin[1]+u}scaleIndicator(e,r,o){if(typeof this.options.scaleIndicator=="function")return this.options.scaleIndicator.call(this,e,r,o);let a=e.scaleIndex===r.index;return r.disabled?this.styles.hint(this.symbols.radio.disabled):a?this.styles.success(this.symbols.radio.on):this.symbols.radio.off}renderScale(e,r){let o=e.scale.map(n=>this.scaleIndicator(e,n,r)),a=this.term==="Hyper"?"":" ";return o.join(a+this.symbols.line.repeat(this.edgeLength))}async renderChoice(e,r){await this.onChoice(e,r);let o=this.index===r,a=await this.pointer(e,r),n=await e.hint;n&&!p0e.hasColor(n)&&(n=this.styles.muted(n));let u=C=>this.margin[3]+C.replace(/\s+$/,"").padEnd(this.widths[0]," "),A=this.newline,p=this.indent(e),h=await this.resolve(e.message,this.state,e,r),E=await this.renderScale(e,r),I=this.margin[1]+this.margin[3];this.scaleLength=qft.unstyle(E).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-I.length);let b=p0e.wordWrap(h,{width:this.widths[0],newline:A}).split(` +`).map(C=>u(C)+this.margin[1]);return o&&(E=this.styles.info(E),b=b.map(C=>this.styles.info(C))),b[0]+=E,this.linebreak&&b.push(""),[p+a,b.join(` +`)].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let e=this.visible.map(async(a,n)=>await this.renderChoice(a,n)),r=await Promise.all(e),o=await this.renderScaleHeading();return this.margin[0]+[o,...r.map(a=>a.join(" "))].join(` +`)}async render(){let{submitted:e,size:r}=this.state,o=await this.prefix(),a=await this.separator(),n=await this.message(),u="";this.options.promptLine!==!1&&(u=[o,n,a,""].join(" "),this.state.prompt=u);let A=await this.header(),p=await this.format(),h=await this.renderScaleKey(),E=await this.error()||await this.hint(),I=await this.renderChoices(),v=await this.footer(),b=this.emptyError;p&&(u+=p),E&&!u.includes(E)&&(u+=" "+E),e&&!p&&!I.trim()&&this.multiple&&b!=null&&(u+=this.styles.danger(b)),this.clear(r),this.write([A,u,h,I,v].filter(Boolean).join(` +`)),this.state.submitted||this.write(this.margin[2]),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIndex;return this.base.submit.call(this)}};h0e.exports=p8});var y0e=_((P8t,m0e)=>{"use strict";var d0e=Vc(),Yft=(t="")=>typeof t=="string"?t.replace(/^['"]|['"]$/g,""):"",g8=class{constructor(e){this.name=e.key,this.field=e.field||{},this.value=Yft(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}},Wft=async(t={},e={},r=o=>o)=>{let o=new Set,a=t.fields||[],n=t.template,u=[],A=[],p=[],h=1;typeof n=="function"&&(n=await n());let E=-1,I=()=>n[++E],v=()=>n[E+1],b=C=>{C.line=h,u.push(C)};for(b({type:"bos",value:""});Ele.name===U.key);U.field=a.find(le=>le.name===U.key),te||(te=new g8(U),A.push(te)),te.lines.push(U.line-1);continue}let T=u[u.length-1];T.type==="text"&&T.line===h?T.value+=C:b({type:"text",value:C})}return b({type:"eos",value:""}),{input:n,tabstops:u,unique:o,keys:p,items:A}};m0e.exports=async t=>{let e=t.options,r=new Set(e.required===!0?[]:e.required||[]),o={...e.values,...e.initial},{tabstops:a,items:n,keys:u}=await Wft(e,o),A=h8("result",t,e),p=h8("format",t,e),h=h8("validate",t,e,!0),E=t.isValue.bind(t);return async(I={},v=!1)=>{let b=0;I.required=r,I.items=n,I.keys=u,I.output="";let C=async(J,te,le,pe)=>{let Ae=await h(J,te,le,pe);return Ae===!1?"Invalid field "+le.name:Ae};for(let J of a){let te=J.value,le=J.key;if(J.type!=="template"){te&&(I.output+=te);continue}if(J.type==="template"){let pe=n.find(Pe=>Pe.name===le);e.required===!0&&I.required.add(pe.name);let Ae=[pe.input,I.values[pe.value],pe.value,te].find(E),ae=(pe.field||{}).message||J.inner;if(v){let Pe=await C(I.values[le],I,pe,b);if(Pe&&typeof Pe=="string"||Pe===!1){I.invalid.set(le,Pe);continue}I.invalid.delete(le);let g=await A(I.values[le],I,pe,b);I.output+=d0e.unstyle(g);continue}pe.placeholder=!1;let we=te;te=await p(te,I,pe,b),Ae!==te?(I.values[le]=Ae,te=t.styles.typing(Ae),I.missing.delete(ae)):(I.values[le]=void 0,Ae=`<${ae}>`,te=t.styles.primary(Ae),pe.placeholder=!0,I.required.has(le)&&I.missing.add(ae)),I.missing.has(ae)&&I.validating&&(te=t.styles.warning(Ae)),I.invalid.has(le)&&I.validating&&(te=t.styles.danger(Ae)),b===I.index&&(we!==te?te=t.styles.underline(te):te=t.styles.heading(d0e.unstyle(te))),b++}te&&(I.output+=te)}let T=I.output.split(` +`).map(J=>" "+J),L=n.length,U=0;for(let J of n)I.invalid.has(J.name)&&J.lines.forEach(te=>{T[te][0]===" "&&(T[te]=I.styles.danger(I.symbols.bullet)+T[te].slice(1))}),t.isValue(I.values[J.name])&&U++;return I.completed=(U/L*100).toFixed(0),I.output=T.join(` +`),I.output}};function h8(t,e,r,o){return(a,n,u,A)=>typeof u.field[t]=="function"?u.field[t].call(e,a,n,u,A):[o,a].find(p=>e.isValue(p))}});var C0e=_((S8t,E0e)=>{"use strict";var Vft=Vc(),Kft=y0e(),Jft=hC(),d8=class extends Jft{constructor(e){super(e),this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await Kft(this),await super.initialize()}async reset(e){this.state.keys=[],this.state.invalid=new Map,this.state.missing=new Set,this.state.completed=0,this.state.values={},e!==!0&&(await this.initialize(),await this.render())}moveCursor(e){let r=this.getItem();this.cursor+=e,r.cursor+=e}dispatch(e,r){if(!r.code&&!r.ctrl&&e!=null&&this.getItem()){this.append(e,r);return}this.alert()}append(e,r){let o=this.getItem(),a=o.input.slice(0,this.cursor),n=o.input.slice(this.cursor);this.input=o.input=`${a}${e}${n}`,this.moveCursor(1),this.render()}delete(){let e=this.getItem();if(this.cursor<=0||!e.input)return this.alert();let r=e.input.slice(this.cursor),o=e.input.slice(0,this.cursor-1);this.input=e.input=`${o}${r}`,this.moveCursor(-1),this.render()}increment(e){return e>=this.state.keys.length-1?0:e+1}decrement(e){return e<=0?this.state.keys.length-1:e-1}first(){this.state.index=0,this.render()}last(){this.state.index=this.state.keys.length-1,this.render()}right(){if(this.cursor>=this.input.length)return this.alert();this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();this.moveCursor(-1),this.render()}prev(){this.state.index=this.decrement(this.state.index),this.getItem(),this.render()}next(){this.state.index=this.increment(this.state.index),this.getItem(),this.render()}up(){this.prev()}down(){this.next()}format(e){let r=this.state.completed<100?this.styles.warning:this.styles.success;return this.state.submitted===!0&&this.state.completed!==100&&(r=this.styles.danger),r(`${this.state.completed}% completed`)}async render(){let{index:e,keys:r=[],submitted:o,size:a}=this.state,n=[this.options.newline,` +`].find(J=>J!=null),u=await this.prefix(),A=await this.separator(),p=await this.message(),h=[u,p,A].filter(Boolean).join(" ");this.state.prompt=h;let E=await this.header(),I=await this.error()||"",v=await this.hint()||"",b=o?"":await this.interpolate(this.state),C=this.state.key=r[e]||"",T=await this.format(C),L=await this.footer();T&&(h+=" "+T),v&&!T&&this.state.completed===0&&(h+=" "+v),this.clear(a);let U=[E,h,b,L,I.trim()];this.write(U.filter(Boolean).join(n)),this.restore()}getItem(e){let{items:r,keys:o,index:a}=this.state,n=r.find(u=>u.name===o[a]);return n&&n.input!=null&&(this.input=n.input,this.cursor=n.cursor),n}async submit(){typeof this.interpolate!="function"&&await this.initialize(),await this.interpolate(this.state,!0);let{invalid:e,missing:r,output:o,values:a}=this.state;if(e.size){let A="";for(let[p,h]of e)A+=`Invalid ${p}: ${h} +`;return this.state.error=A,super.submit()}if(r.size)return this.state.error="Required: "+[...r.keys()].join(", "),super.submit();let u=Vft.unstyle(o).split(` +`).map(A=>A.slice(1)).join(` +`);return this.value={values:a,result:u},super.submit()}};E0e.exports=d8});var I0e=_((x8t,w0e)=>{"use strict";var zft="(Use + to sort)",Xft=Sh(),m8=class extends Xft{constructor(e){super({...e,reorder:!1,sort:!0,multiple:!0}),this.state.hint=[this.options.hint,zft].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(e,r){let o=await super.renderChoice(e,r),a=this.symbols.identicalTo+" ",n=this.index===r&&this.sorting?this.styles.muted(a):" ";return this.options.drag===!1&&(n=""),this.options.numbered===!0?n+`${r+1} - `+o:n+o}get selected(){return this.choices}submit(){return this.value=this.choices.map(e=>e.value),super.submit()}};w0e.exports=m8});var v0e=_((b8t,B0e)=>{"use strict";var Zft=c2(),y8=class extends Zft{constructor(e={}){if(super(e),this.emptyError=e.emptyError||"No items were selected",this.term=process.env.TERM_PROGRAM,!this.options.header){let r=["","4 - Strongly Agree","3 - Agree","2 - Neutral","1 - Disagree","0 - Strongly Disagree",""];r=r.map(o=>this.styles.muted(o)),this.state.header=r.join(` + `)}}async toChoices(...e){if(this.createdScales)return!1;this.createdScales=!0;let r=await super.toChoices(...e);for(let o of r)o.scale=$ft(5,this.options),o.scaleIdx=2;return r}dispatch(){this.alert()}space(){let e=this.focused,r=e.scale[e.scaleIdx],o=r.selected;return e.scale.forEach(a=>a.selected=!1),r.selected=!o,this.render()}indicator(){return""}pointer(){return""}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;return e.scaleIdx>=e.scale.length-1?this.alert():(e.scaleIdx++,this.render())}left(){let e=this.focused;return e.scaleIdx<=0?this.alert():(e.scaleIdx--,this.render())}indent(){return" "}async renderChoice(e,r){await this.onChoice(e,r);let o=this.index===r,a=this.term==="Hyper",n=a?9:8,u=a?"":" ",A=this.symbols.line.repeat(n),p=" ".repeat(n+(a?0:1)),h=te=>(te?this.styles.success("\u25C9"):"\u25EF")+u,E=r+1+".",I=o?this.styles.heading:this.styles.noop,v=await this.resolve(e.message,this.state,e,r),b=this.indent(e),C=b+e.scale.map((te,le)=>h(le===e.scaleIdx)).join(A),T=te=>te===e.scaleIdx?I(te):te,L=b+e.scale.map((te,le)=>T(le)).join(p),U=()=>[E,v].filter(Boolean).join(" "),J=()=>[U(),C,L," "].filter(Boolean).join(` +`);return o&&(C=this.styles.cyan(C),L=this.styles.cyan(L)),J()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(o,a)=>await this.renderChoice(o,a)),r=await Promise.all(e);return r.length||r.push(this.styles.danger("No matching choices")),r.join(` +`)}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.scaleIdx)).join(", "):""}async render(){let{submitted:e,size:r}=this.state,o=await this.prefix(),a=await this.separator(),n=await this.message(),u=[o,n,a].filter(Boolean).join(" ");this.state.prompt=u;let A=await this.header(),p=await this.format(),h=await this.error()||await this.hint(),E=await this.renderChoices(),I=await this.footer();(p||!h)&&(u+=" "+p),h&&!u.includes(h)&&(u+=" "+h),e&&!p&&!E&&this.multiple&&this.type!=="form"&&(u+=this.styles.danger(this.emptyError)),this.clear(r),this.write([u,A,E,I].filter(Boolean).join(` +`)),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIdx;return this.base.submit.call(this)}};function $ft(t,e={}){if(Array.isArray(e.scale))return e.scale.map(o=>({...o}));let r=[];for(let o=1;o{D0e.exports=o8()});var x0e=_((Q8t,S0e)=>{"use strict";var ept=uk(),E8=class extends ept{async initialize(){await super.initialize(),this.value=this.initial=!!this.options.initial,this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(this.value===!0)return this.alert();this.value=!0,this.render()}disable(){if(this.value===!1)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(e="",r){switch(e.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let e=o=>this.styles.primary.underline(o);return[this.value?this.disabled:e(this.disabled),this.value?e(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:e}=this.state,r=await this.header(),o=await this.prefix(),a=await this.separator(),n=await this.message(),u=await this.format(),A=await this.error()||await this.hint(),p=await this.footer(),h=[o,n,a,u].join(" ");this.state.prompt=h,A&&!h.includes(A)&&(h+=" "+A),this.clear(e),this.write([r,h,p].filter(Boolean).join(` +`)),this.write(this.margin[2]),this.restore()}};S0e.exports=E8});var k0e=_((F8t,b0e)=>{"use strict";var tpt=Sh(),C8=class extends tpt{constructor(e){if(super(e),typeof this.options.correctChoice!="number"||this.options.correctChoice<0)throw new Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,r){let o=await super.toChoices(e,r);if(o.length<2)throw new Error("Please give at least two choices to the user");if(this.options.correctChoice>o.length)throw new Error("Please specify the index of the correct answer from the list of choices");return o}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}};b0e.exports=C8});var F0e=_(w8=>{"use strict";var Q0e=No(),As=(t,e)=>{Q0e.defineExport(w8,t,e),Q0e.defineExport(w8,t.toLowerCase(),e)};As("AutoComplete",()=>Ohe());As("BasicAuth",()=>Yhe());As("Confirm",()=>Khe());As("Editable",()=>zhe());As("Form",()=>ck());As("Input",()=>o8());As("Invisible",()=>n0e());As("List",()=>s0e());As("MultiSelect",()=>a0e());As("Numeral",()=>u0e());As("Password",()=>f0e());As("Scale",()=>g0e());As("Select",()=>Sh());As("Snippet",()=>C0e());As("Sort",()=>I0e());As("Survey",()=>v0e());As("Text",()=>P0e());As("Toggle",()=>x0e());As("Quiz",()=>k0e())});var R0e=_((R8t,T0e)=>{T0e.exports={ArrayPrompt:c2(),AuthPrompt:e8(),BooleanPrompt:uk(),NumberPrompt:A8(),StringPrompt:Yd()}});var A2=_((N8t,L0e)=>{"use strict";var N0e=Be("assert"),B8=Be("events"),xh=No(),Jc=class extends B8{constructor(e,r){super(),this.options=xh.merge({},e),this.answers={...r}}register(e,r){if(xh.isObject(e)){for(let a of Object.keys(e))this.register(a,e[a]);return this}N0e.equal(typeof r,"function","expected a function");let o=e.toLowerCase();return r.prototype instanceof this.Prompt?this.prompts[o]=r:this.prompts[o]=r(this.Prompt,this),this}async prompt(e=[]){for(let r of[].concat(e))try{typeof r=="function"&&(r=await r.call(this)),await this.ask(xh.merge({},this.options,r))}catch(o){return Promise.reject(o)}return this.answers}async ask(e){typeof e=="function"&&(e=await e.call(this));let r=xh.merge({},this.options,e),{type:o,name:a}=e,{set:n,get:u}=xh;if(typeof o=="function"&&(o=await o.call(this,e,this.answers)),!o)return this.answers[a];N0e(this.prompts[o],`Prompt "${o}" is not registered`);let A=new this.prompts[o](r),p=u(this.answers,a);A.state.answers=this.answers,A.enquirer=this,a&&A.on("submit",E=>{this.emit("answer",a,E,A),n(this.answers,a,E)});let h=A.emit.bind(A);return A.emit=(...E)=>(this.emit.call(this,...E),h(...E)),this.emit("prompt",A,this),r.autofill&&p!=null?(A.value=A.input=p,r.autofill==="show"&&await A.submit()):p=A.value=await A.run(),p}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||hC()}static get prompts(){return F0e()}static get types(){return R0e()}static get prompt(){let e=(r,...o)=>{let a=new this(...o),n=a.emit.bind(a);return a.emit=(...u)=>(e.emit(...u),n(...u)),a.prompt(r)};return xh.mixinEmitter(e,new B8),e}};xh.mixinEmitter(Jc,new B8);var I8=Jc.prompts;for(let t of Object.keys(I8)){let e=t.toLowerCase(),r=o=>new I8[t](o).run();Jc.prompt[e]=r,Jc[e]=r,Jc[t]||Reflect.defineProperty(Jc,t,{get:()=>I8[t]})}var u2=t=>{xh.defineExport(Jc,t,()=>Jc.types[t])};u2("ArrayPrompt");u2("AuthPrompt");u2("BooleanPrompt");u2("NumberPrompt");u2("StringPrompt");L0e.exports=Jc});var g2=_((mHt,q0e)=>{var apt=Zb();function lpt(t,e,r){var o=t==null?void 0:apt(t,e);return o===void 0?r:o}q0e.exports=lpt});var W0e=_((BHt,Y0e)=>{function cpt(t,e){for(var r=-1,o=t==null?0:t.length;++r{var upt=gd(),Apt=zP();function fpt(t,e){return t&&upt(e,Apt(e),t)}V0e.exports=fpt});var z0e=_((DHt,J0e)=>{var ppt=gd(),hpt=qy();function gpt(t,e){return t&&ppt(e,hpt(e),t)}J0e.exports=gpt});var Z0e=_((PHt,X0e)=>{var dpt=gd(),mpt=GP();function ypt(t,e){return dpt(t,mpt(t),e)}X0e.exports=ypt});var b8=_((SHt,$0e)=>{var Ept=qP(),Cpt=tS(),wpt=GP(),Ipt=KN(),Bpt=Object.getOwnPropertySymbols,vpt=Bpt?function(t){for(var e=[];t;)Ept(e,wpt(t)),t=Cpt(t);return e}:Ipt;$0e.exports=vpt});var tge=_((xHt,ege)=>{var Dpt=gd(),Ppt=b8();function Spt(t,e){return Dpt(t,Ppt(t),e)}ege.exports=Spt});var k8=_((bHt,rge)=>{var xpt=VN(),bpt=b8(),kpt=qy();function Qpt(t){return xpt(t,kpt,bpt)}rge.exports=Qpt});var ige=_((kHt,nge)=>{var Fpt=Object.prototype,Tpt=Fpt.hasOwnProperty;function Rpt(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Tpt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}nge.exports=Rpt});var oge=_((QHt,sge)=>{var Npt=$P();function Lpt(t,e){var r=e?Npt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}sge.exports=Lpt});var lge=_((FHt,age)=>{var Mpt=/\w*$/;function Opt(t){var e=new t.constructor(t.source,Mpt.exec(t));return e.lastIndex=t.lastIndex,e}age.exports=Opt});var pge=_((THt,fge)=>{var cge=fd(),uge=cge?cge.prototype:void 0,Age=uge?uge.valueOf:void 0;function Upt(t){return Age?Object(Age.call(t)):{}}fge.exports=Upt});var gge=_((RHt,hge)=>{var _pt=$P(),Hpt=oge(),jpt=lge(),qpt=pge(),Gpt=lL(),Ypt="[object Boolean]",Wpt="[object Date]",Vpt="[object Map]",Kpt="[object Number]",Jpt="[object RegExp]",zpt="[object Set]",Xpt="[object String]",Zpt="[object Symbol]",$pt="[object ArrayBuffer]",eht="[object DataView]",tht="[object Float32Array]",rht="[object Float64Array]",nht="[object Int8Array]",iht="[object Int16Array]",sht="[object Int32Array]",oht="[object Uint8Array]",aht="[object Uint8ClampedArray]",lht="[object Uint16Array]",cht="[object Uint32Array]";function uht(t,e,r){var o=t.constructor;switch(e){case $pt:return _pt(t);case Ypt:case Wpt:return new o(+t);case eht:return Hpt(t,r);case tht:case rht:case nht:case iht:case sht:case oht:case aht:case lht:case cht:return Gpt(t,r);case Vpt:return new o;case Kpt:case Xpt:return new o(t);case Jpt:return jpt(t);case zpt:return new o;case Zpt:return qpt(t)}}hge.exports=uht});var mge=_((NHt,dge)=>{var Aht=qI(),fht=Ju(),pht="[object Map]";function hht(t){return fht(t)&&Aht(t)==pht}dge.exports=hht});var wge=_((LHt,Cge)=>{var ght=mge(),dht=WP(),yge=VP(),Ege=yge&&yge.isMap,mht=Ege?dht(Ege):ght;Cge.exports=mht});var Bge=_((MHt,Ige)=>{var yht=qI(),Eht=Ju(),Cht="[object Set]";function wht(t){return Eht(t)&&yht(t)==Cht}Ige.exports=wht});var Sge=_((OHt,Pge)=>{var Iht=Bge(),Bht=WP(),vge=VP(),Dge=vge&&vge.isSet,vht=Dge?Bht(Dge):Iht;Pge.exports=vht});var Q8=_((UHt,Qge)=>{var Dht=HP(),Pht=W0e(),Sht=rS(),xht=K0e(),bht=z0e(),kht=aL(),Qht=eS(),Fht=Z0e(),Tht=tge(),Rht=ZN(),Nht=k8(),Lht=qI(),Mht=ige(),Oht=gge(),Uht=cL(),_ht=Hl(),Hht=OI(),jht=wge(),qht=il(),Ght=Sge(),Yht=zP(),Wht=qy(),Vht=1,Kht=2,Jht=4,xge="[object Arguments]",zht="[object Array]",Xht="[object Boolean]",Zht="[object Date]",$ht="[object Error]",bge="[object Function]",e0t="[object GeneratorFunction]",t0t="[object Map]",r0t="[object Number]",kge="[object Object]",n0t="[object RegExp]",i0t="[object Set]",s0t="[object String]",o0t="[object Symbol]",a0t="[object WeakMap]",l0t="[object ArrayBuffer]",c0t="[object DataView]",u0t="[object Float32Array]",A0t="[object Float64Array]",f0t="[object Int8Array]",p0t="[object Int16Array]",h0t="[object Int32Array]",g0t="[object Uint8Array]",d0t="[object Uint8ClampedArray]",m0t="[object Uint16Array]",y0t="[object Uint32Array]",ri={};ri[xge]=ri[zht]=ri[l0t]=ri[c0t]=ri[Xht]=ri[Zht]=ri[u0t]=ri[A0t]=ri[f0t]=ri[p0t]=ri[h0t]=ri[t0t]=ri[r0t]=ri[kge]=ri[n0t]=ri[i0t]=ri[s0t]=ri[o0t]=ri[g0t]=ri[d0t]=ri[m0t]=ri[y0t]=!0;ri[$ht]=ri[bge]=ri[a0t]=!1;function pk(t,e,r,o,a,n){var u,A=e&Vht,p=e&Kht,h=e&Jht;if(r&&(u=a?r(t,o,a,n):r(t)),u!==void 0)return u;if(!qht(t))return t;var E=_ht(t);if(E){if(u=Mht(t),!A)return Qht(t,u)}else{var I=Lht(t),v=I==bge||I==e0t;if(Hht(t))return kht(t,A);if(I==kge||I==xge||v&&!a){if(u=p||v?{}:Uht(t),!A)return p?Tht(t,bht(u,t)):Fht(t,xht(u,t))}else{if(!ri[I])return a?t:{};u=Oht(t,I,A)}}n||(n=new Dht);var b=n.get(t);if(b)return b;n.set(t,u),Ght(t)?t.forEach(function(L){u.add(pk(L,e,r,L,t,n))}):jht(t)&&t.forEach(function(L,U){u.set(U,pk(L,e,r,U,t,n))});var C=h?p?Nht:Rht:p?Wht:Yht,T=E?void 0:C(t);return Pht(T||t,function(L,U){T&&(U=L,L=t[U]),Sht(u,U,pk(L,e,r,U,t,n))}),u}Qge.exports=pk});var F8=_((_Ht,Fge)=>{var E0t=Q8(),C0t=1,w0t=4;function I0t(t){return E0t(t,C0t|w0t)}Fge.exports=I0t});var T8=_((HHt,Tge)=>{var B0t=v_();function v0t(t,e,r){return t==null?t:B0t(t,e,r)}Tge.exports=v0t});var Oge=_((VHt,Mge)=>{var D0t=Object.prototype,P0t=D0t.hasOwnProperty;function S0t(t,e){return t!=null&&P0t.call(t,e)}Mge.exports=S0t});var _ge=_((KHt,Uge)=>{var x0t=Oge(),b0t=D_();function k0t(t,e){return t!=null&&b0t(t,e,x0t)}Uge.exports=k0t});var jge=_((JHt,Hge)=>{function Q0t(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}Hge.exports=Q0t});var Gge=_((zHt,qge)=>{var F0t=Zb(),T0t=gU();function R0t(t,e){return e.length<2?t:F0t(t,T0t(e,0,-1))}qge.exports=R0t});var N8=_((XHt,Yge)=>{var N0t=jd(),L0t=jge(),M0t=Gge(),O0t=aC();function U0t(t,e){return e=N0t(e,t),t=M0t(t,e),t==null||delete t[O0t(L0t(e))]}Yge.exports=U0t});var L8=_((ZHt,Wge)=>{var _0t=N8();function H0t(t,e){return t==null?!0:_0t(t,e)}Wge.exports=H0t});var Xge=_((S6t,G0t)=>{G0t.exports={name:"@yarnpkg/cli",version:"4.0.2",license:"BSD-2-Clause",main:"./sources/index.ts",exports:{".":"./sources/index.ts","./polyfills":"./sources/polyfills.ts","./package.json":"./package.json"},dependencies:{"@yarnpkg/core":"workspace:^","@yarnpkg/fslib":"workspace:^","@yarnpkg/libzip":"workspace:^","@yarnpkg/parsers":"workspace:^","@yarnpkg/plugin-compat":"workspace:^","@yarnpkg/plugin-constraints":"workspace:^","@yarnpkg/plugin-dlx":"workspace:^","@yarnpkg/plugin-essentials":"workspace:^","@yarnpkg/plugin-exec":"workspace:^","@yarnpkg/plugin-file":"workspace:^","@yarnpkg/plugin-git":"workspace:^","@yarnpkg/plugin-github":"workspace:^","@yarnpkg/plugin-http":"workspace:^","@yarnpkg/plugin-init":"workspace:^","@yarnpkg/plugin-interactive-tools":"workspace:^","@yarnpkg/plugin-link":"workspace:^","@yarnpkg/plugin-nm":"workspace:^","@yarnpkg/plugin-npm":"workspace:^","@yarnpkg/plugin-npm-cli":"workspace:^","@yarnpkg/plugin-pack":"workspace:^","@yarnpkg/plugin-patch":"workspace:^","@yarnpkg/plugin-pnp":"workspace:^","@yarnpkg/plugin-pnpm":"workspace:^","@yarnpkg/plugin-stage":"workspace:^","@yarnpkg/plugin-typescript":"workspace:^","@yarnpkg/plugin-version":"workspace:^","@yarnpkg/plugin-workspace-tools":"workspace:^","@yarnpkg/shell":"workspace:^","ci-info":"^3.2.0",clipanion:"^4.0.0-rc.2",semver:"^7.1.2",tslib:"^2.4.0",typanion:"^3.14.0"},devDependencies:{"@types/semver":"^7.1.0","@yarnpkg/builder":"workspace:^","@yarnpkg/monorepo":"workspace:^","@yarnpkg/pnpify":"workspace:^"},peerDependencies:{"@yarnpkg/core":"workspace:^"},scripts:{postpack:"rm -rf lib",prepack:'run build:compile "$(pwd)"',"build:cli+hook":"run build:pnp:hook && builder build bundle","build:cli":"builder build bundle","run:cli":"builder run","update-local":"run build:cli --no-git-hash && rsync -a --delete bundles/ bin/"},publishConfig:{main:"./lib/index.js",bin:null,exports:{".":"./lib/index.js","./package.json":"./package.json"}},files:["/lib/**/*","!/lib/pluginConfiguration.*","!/lib/cli.*"],"@yarnpkg/builder":{bundles:{standard:["@yarnpkg/plugin-essentials","@yarnpkg/plugin-compat","@yarnpkg/plugin-constraints","@yarnpkg/plugin-dlx","@yarnpkg/plugin-exec","@yarnpkg/plugin-file","@yarnpkg/plugin-git","@yarnpkg/plugin-github","@yarnpkg/plugin-http","@yarnpkg/plugin-init","@yarnpkg/plugin-interactive-tools","@yarnpkg/plugin-link","@yarnpkg/plugin-nm","@yarnpkg/plugin-npm","@yarnpkg/plugin-npm-cli","@yarnpkg/plugin-pack","@yarnpkg/plugin-patch","@yarnpkg/plugin-pnp","@yarnpkg/plugin-pnpm","@yarnpkg/plugin-stage","@yarnpkg/plugin-typescript","@yarnpkg/plugin-version","@yarnpkg/plugin-workspace-tools"]}},repository:{type:"git",url:"ssh://git@github.com/yarnpkg/berry.git",directory:"packages/yarnpkg-cli"},engines:{node:">=18.12.0"}}});var Y8=_((n5t,ude)=>{"use strict";ude.exports=function(e,r){r===!0&&(r=0);var o="";if(typeof e=="string")try{o=new URL(e).protocol}catch{}else e&&e.constructor===URL&&(o=e.protocol);var a=o.split(/\:|\+/).filter(Boolean);return typeof r=="number"?a[r]:a}});var fde=_((i5t,Ade)=>{"use strict";var cgt=Y8();function ugt(t){var e={protocols:[],protocol:null,port:null,resource:"",host:"",user:"",password:"",pathname:"",hash:"",search:"",href:t,query:{},parse_failed:!1};try{var r=new URL(t);e.protocols=cgt(r),e.protocol=e.protocols[0],e.port=r.port,e.resource=r.hostname,e.host=r.host,e.user=r.username||"",e.password=r.password||"",e.pathname=r.pathname,e.hash=r.hash.slice(1),e.search=r.search.slice(1),e.href=r.href,e.query=Object.fromEntries(r.searchParams)}catch{e.protocols=["file"],e.protocol=e.protocols[0],e.port="",e.resource="",e.user="",e.pathname="",e.hash="",e.search="",e.href=t,e.query={},e.parse_failed=!0}return e}Ade.exports=ugt});var gde=_((s5t,hde)=>{"use strict";var Agt=fde();function fgt(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var pgt=fgt(Agt),hgt="text/plain",ggt="us-ascii",pde=(t,e)=>e.some(r=>r instanceof RegExp?r.test(t):r===t),dgt=(t,{stripHash:e})=>{let r=/^data:(?[^,]*?),(?[^#]*?)(?:#(?.*))?$/.exec(t);if(!r)throw new Error(`Invalid URL: ${t}`);let{type:o,data:a,hash:n}=r.groups,u=o.split(";");n=e?"":n;let A=!1;u[u.length-1]==="base64"&&(u.pop(),A=!0);let p=(u.shift()||"").toLowerCase(),E=[...u.map(I=>{let[v,b=""]=I.split("=").map(C=>C.trim());return v==="charset"&&(b=b.toLowerCase(),b===ggt)?"":`${v}${b?`=${b}`:""}`}).filter(Boolean)];return A&&E.push("base64"),(E.length>0||p&&p!==hgt)&&E.unshift(p),`data:${E.join(";")},${A?a.trim():a}${n?`#${n}`:""}`};function mgt(t,e){if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},t=t.trim(),/^data:/i.test(t))return dgt(t,e);if(/^view-source:/i.test(t))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let r=t.startsWith("//");!r&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));let a=new URL(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&a.protocol==="https:"&&(a.protocol="http:"),e.forceHttps&&a.protocol==="http:"&&(a.protocol="https:"),e.stripAuthentication&&(a.username="",a.password=""),e.stripHash?a.hash="":e.stripTextFragment&&(a.hash=a.hash.replace(/#?:~:text.*?$/i,"")),a.pathname){let u=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,A=0,p="";for(;;){let E=u.exec(a.pathname);if(!E)break;let I=E[0],v=E.index,b=a.pathname.slice(A,v);p+=b.replace(/\/{2,}/g,"/"),p+=I,A=v+I.length}let h=a.pathname.slice(A,a.pathname.length);p+=h.replace(/\/{2,}/g,"/"),a.pathname=p}if(a.pathname)try{a.pathname=decodeURI(a.pathname)}catch{}if(e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let u=a.pathname.split("/"),A=u[u.length-1];pde(A,e.removeDirectoryIndex)&&(u=u.slice(0,-1),a.pathname=u.slice(1).join("/")+"/")}if(a.hostname&&(a.hostname=a.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(a.hostname)&&(a.hostname=a.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(let u of[...a.searchParams.keys()])pde(u,e.removeQueryParameters)&&a.searchParams.delete(u);if(e.removeQueryParameters===!0&&(a.search=""),e.sortQueryParameters){a.searchParams.sort();try{a.search=decodeURIComponent(a.search)}catch{}}e.removeTrailingSlash&&(a.pathname=a.pathname.replace(/\/$/,""));let n=t;return t=a.toString(),!e.removeSingleSlash&&a.pathname==="/"&&!n.endsWith("/")&&a.hash===""&&(t=t.replace(/\/$/,"")),(e.removeTrailingSlash||a.pathname==="/")&&a.hash===""&&e.removeSingleSlash&&(t=t.replace(/\/$/,"")),r&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t}var W8=(t,e=!1)=>{let r=/^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:]([\~,\.\w,\-,\_,\/]+?(?:\.git|\/)?)$/,o=n=>{let u=new Error(n);throw u.subject_url=t,u};(typeof t!="string"||!t.trim())&&o("Invalid url."),t.length>W8.MAX_INPUT_LENGTH&&o("Input exceeds maximum length. If needed, change the value of parseUrl.MAX_INPUT_LENGTH."),e&&(typeof e!="object"&&(e={stripHash:!1}),t=mgt(t,e));let a=pgt.default(t);if(a.parse_failed){let n=a.href.match(r);n?(a.protocols=["ssh"],a.protocol="ssh",a.resource=n[2],a.host=n[2],a.user=n[1],a.pathname=`/${n[3]}`,a.parse_failed=!1):o("URL parsing failed.")}return a};W8.MAX_INPUT_LENGTH=2048;hde.exports=W8});var yde=_((o5t,mde)=>{"use strict";var ygt=Y8();function dde(t){if(Array.isArray(t))return t.indexOf("ssh")!==-1||t.indexOf("rsync")!==-1;if(typeof t!="string")return!1;var e=ygt(t);if(t=t.substring(t.indexOf("://")+3),dde(e))return!0;var r=new RegExp(".([a-zA-Z\\d]+):(\\d+)/");return!t.match(r)&&t.indexOf("@"){"use strict";var Egt=gde(),Ede=yde();function Cgt(t){var e=Egt(t);return e.token="",e.password==="x-oauth-basic"?e.token=e.user:e.user==="x-token-auth"&&(e.token=e.password),Ede(e.protocols)||e.protocols.length===0&&Ede(t)?e.protocol="ssh":e.protocols.length?e.protocol=e.protocols[0]:(e.protocol="file",e.protocols=["file"]),e.href=e.href.replace(/\/$/,""),e}Cde.exports=Cgt});var Bde=_((l5t,Ide)=>{"use strict";var wgt=wde();function V8(t){if(typeof t!="string")throw new Error("The url must be a string.");var e=/^([a-z\d-]{1,39})\/([-\.\w]{1,100})$/i;e.test(t)&&(t="https://github.com/"+t);var r=wgt(t),o=r.resource.split("."),a=null;switch(r.toString=function(L){return V8.stringify(this,L)},r.source=o.length>2?o.slice(1-o.length).join("."):r.source=r.resource,r.git_suffix=/\.git$/.test(r.pathname),r.name=decodeURIComponent((r.pathname||r.href).replace(/(^\/)|(\/$)/g,"").replace(/\.git$/,"")),r.owner=decodeURIComponent(r.user),r.source){case"git.cloudforge.com":r.owner=r.user,r.organization=o[0],r.source="cloudforge.com";break;case"visualstudio.com":if(r.resource==="vs-ssh.visualstudio.com"){a=r.name.split("/"),a.length===4&&(r.organization=a[1],r.owner=a[2],r.name=a[3],r.full_name=a[2]+"/"+a[3]);break}else{a=r.name.split("/"),a.length===2?(r.owner=a[1],r.name=a[1],r.full_name="_git/"+r.name):a.length===3?(r.name=a[2],a[0]==="DefaultCollection"?(r.owner=a[2],r.organization=a[0],r.full_name=r.organization+"/_git/"+r.name):(r.owner=a[0],r.full_name=r.owner+"/_git/"+r.name)):a.length===4&&(r.organization=a[0],r.owner=a[1],r.name=a[3],r.full_name=r.organization+"/"+r.owner+"/_git/"+r.name);break}case"dev.azure.com":case"azure.com":if(r.resource==="ssh.dev.azure.com"){a=r.name.split("/"),a.length===4&&(r.organization=a[1],r.owner=a[2],r.name=a[3]);break}else{a=r.name.split("/"),a.length===5?(r.organization=a[0],r.owner=a[1],r.name=a[4],r.full_name="_git/"+r.name):a.length===3?(r.name=a[2],a[0]==="DefaultCollection"?(r.owner=a[2],r.organization=a[0],r.full_name=r.organization+"/_git/"+r.name):(r.owner=a[0],r.full_name=r.owner+"/_git/"+r.name)):a.length===4&&(r.organization=a[0],r.owner=a[1],r.name=a[3],r.full_name=r.organization+"/"+r.owner+"/_git/"+r.name),r.query&&r.query.path&&(r.filepath=r.query.path.replace(/^\/+/g,"")),r.query&&r.query.version&&(r.ref=r.query.version.replace(/^GB/,""));break}default:a=r.name.split("/");var n=a.length-1;if(a.length>=2){var u=a.indexOf("-",2),A=a.indexOf("blob",2),p=a.indexOf("tree",2),h=a.indexOf("commit",2),E=a.indexOf("src",2),I=a.indexOf("raw",2),v=a.indexOf("edit",2);n=u>0?u-1:A>0?A-1:p>0?p-1:h>0?h-1:E>0?E-1:I>0?I-1:v>0?v-1:n,r.owner=a.slice(0,n).join("/"),r.name=a[n],h&&(r.commit=a[n+2])}r.ref="",r.filepathtype="",r.filepath="";var b=a.length>n&&a[n+1]==="-"?n+1:n;a.length>b+2&&["raw","src","blob","tree","edit"].indexOf(a[b+1])>=0&&(r.filepathtype=a[b+1],r.ref=a[b+2],a.length>b+3&&(r.filepath=a.slice(b+3).join("/"))),r.organization=r.owner;break}r.full_name||(r.full_name=r.owner,r.name&&(r.full_name&&(r.full_name+="/"),r.full_name+=r.name)),r.owner.startsWith("scm/")&&(r.source="bitbucket-server",r.owner=r.owner.replace("scm/",""),r.organization=r.owner,r.full_name=r.owner+"/"+r.name);var C=/(projects|users)\/(.*?)\/repos\/(.*?)((\/.*$)|$)/,T=C.exec(r.pathname);return T!=null&&(r.source="bitbucket-server",T[1]==="users"?r.owner="~"+T[2]:r.owner=T[2],r.organization=r.owner,r.name=T[3],a=T[4].split("/"),a.length>1&&(["raw","browse"].indexOf(a[1])>=0?(r.filepathtype=a[1],a.length>2&&(r.filepath=a.slice(2).join("/"))):a[1]==="commits"&&a.length>2&&(r.commit=a[2])),r.full_name=r.owner+"/"+r.name,r.query.at?r.ref=r.query.at:r.ref=""),r}V8.stringify=function(t,e){e=e||(t.protocols&&t.protocols.length?t.protocols.join("+"):t.protocol);var r=t.port?":"+t.port:"",o=t.user||"git",a=t.git_suffix?".git":"";switch(e){case"ssh":return r?"ssh://"+o+"@"+t.resource+r+"/"+t.full_name+a:o+"@"+t.resource+":"+t.full_name+a;case"git+ssh":case"ssh+git":case"ftp":case"ftps":return e+"://"+o+"@"+t.resource+r+"/"+t.full_name+a;case"http":case"https":var n=t.token?Igt(t):t.user&&(t.protocols.includes("http")||t.protocols.includes("https"))?t.user+"@":"";return e+"://"+n+t.resource+r+"/"+Bgt(t)+a;default:return t.href}};function Igt(t){switch(t.source){case"bitbucket.org":return"x-token-auth:"+t.token+"@";default:return t.token+"@"}}function Bgt(t){switch(t.source){case"bitbucket-server":return"scm/"+t.full_name;default:return""+t.full_name}}Ide.exports=V8});var Ude=_((H9t,Ode)=>{var Rgt=jx(),Ngt=eS(),Lgt=Hl(),Mgt=fE(),Ogt=B_(),Ugt=aC(),_gt=R1();function Hgt(t){return Lgt(t)?Rgt(t,Ugt):Mgt(t)?[t]:Ngt(Ogt(_gt(t)))}Ode.exports=Hgt});function Ygt(t,e){return e===1&&Ggt.has(t[0])}function I2(t){let e=Array.isArray(t)?t:(0,jde.default)(t);return e.map((o,a)=>jgt.test(o)?`[${o}]`:qgt.test(o)&&!Ygt(e,a)?`.${o}`:`[${JSON.stringify(o)}]`).join("").replace(/^\./,"")}function Wgt(t,e){let r=[];if(e.methodName!==null&&r.push(de.pretty(t,e.methodName,de.Type.CODE)),e.file!==null){let o=[];o.push(de.pretty(t,e.file,de.Type.PATH)),e.line!==null&&(o.push(de.pretty(t,e.line,de.Type.NUMBER)),e.column!==null&&o.push(de.pretty(t,e.column,de.Type.NUMBER))),r.push(`(${o.join(de.pretty(t,":","grey"))})`)}return r.join(" ")}function mk(t,{manifestUpdates:e,reportedErrors:r},{fix:o}={}){let a=new Map,n=new Map,u=[...r.keys()].map(A=>[A,new Map]);for(let[A,p]of[...u,...e]){let h=r.get(A)?.map(b=>({text:b,fixable:!1}))??[],E=!1,I=t.getWorkspaceByCwd(A),v=I.manifest.exportTo({});for(let[b,C]of p){if(C.size>1){let T=[...C].map(([L,U])=>{let J=de.pretty(t.configuration,L,de.Type.INSPECT),te=U.size>0?Wgt(t.configuration,U.values().next().value):null;return te!==null?` +${J} at ${te}`:` +${J}`}).join("");h.push({text:`Conflict detected in constraint targeting ${de.pretty(t.configuration,b,de.Type.CODE)}; conflicting values are:${T}`,fixable:!1})}else{let[[T]]=C,L=(0,_de.default)(v,b);if(JSON.stringify(L)===JSON.stringify(T))continue;if(!o){let U=typeof L>"u"?`Missing field ${de.pretty(t.configuration,b,de.Type.CODE)}; expected ${de.pretty(t.configuration,T,de.Type.INSPECT)}`:typeof T>"u"?`Extraneous field ${de.pretty(t.configuration,b,de.Type.CODE)} currently set to ${de.pretty(t.configuration,L,de.Type.INSPECT)}`:`Invalid field ${de.pretty(t.configuration,b,de.Type.CODE)}; expected ${de.pretty(t.configuration,T,de.Type.INSPECT)}, found ${de.pretty(t.configuration,L,de.Type.INSPECT)}`;h.push({text:U,fixable:!0});continue}typeof T>"u"?(0,qde.default)(v,b):(0,Hde.default)(v,b,T),E=!0}E&&a.set(I,v)}h.length>0&&n.set(I,h)}return{changedWorkspaces:a,remainingErrors:n}}function Gde(t,{configuration:e}){let r={children:[]};for(let[o,a]of t){let n=[];for(let A of a){let p=A.text.split(/\n/);A.fixable&&(p[0]=`${de.pretty(e,"\u2699","gray")} ${p[0]}`),n.push({value:de.tuple(de.Type.NO_HINT,p[0]),children:p.slice(1).map(h=>({value:de.tuple(de.Type.NO_HINT,h)}))})}let u={value:de.tuple(de.Type.LOCATOR,o.anchoredLocator),children:je.sortMap(n,A=>A.value[1])};r.children.push(u)}return r.children=je.sortMap(r.children,o=>o.value[1]),r}var _de,Hde,jde,qde,CC,jgt,qgt,Ggt,B2=Et(()=>{Ye();_de=$e(g2()),Hde=$e(T8()),jde=$e(Ude()),qde=$e(L8()),CC=class{constructor(e){this.indexedFields=e;this.items=[];this.indexes={};this.clear()}clear(){this.items=[];for(let e of this.indexedFields)this.indexes[e]=new Map}insert(e){this.items.push(e);for(let r of this.indexedFields){let o=Object.hasOwn(e,r)?e[r]:void 0;if(typeof o>"u")continue;je.getArrayWithDefault(this.indexes[r],o).push(e)}return e}find(e){if(typeof e>"u")return this.items;let r=Object.entries(e);if(r.length===0)return this.items;let o=[],a;for(let[u,A]of r){let p=u,h=Object.hasOwn(this.indexes,p)?this.indexes[p]:void 0;if(typeof h>"u"){o.push([p,A]);continue}let E=new Set(h.get(A)??[]);if(E.size===0)return[];if(typeof a>"u")a=E;else for(let I of a)E.has(I)||a.delete(I);if(a.size===0)break}let n=[...a??[]];return o.length>0&&(n=n.filter(u=>{for(let[A,p]of o)if(!(typeof p<"u"?Object.hasOwn(u,A)&&u[A]===p:Object.hasOwn(u,A)===!1))return!1;return!0})),n}},jgt=/^[0-9]+$/,qgt=/^[a-zA-Z0-9_]+$/,Ggt=new Set(["scripts",...Mt.allDependencies])});var Yde=_(($9t,aH)=>{var Vgt;(function(t){var e=function(){return{"append/2":[new t.type.Rule(new t.type.Term("append",[new t.type.Var("X"),new t.type.Var("L")]),new t.type.Term("foldl",[new t.type.Term("append",[]),new t.type.Var("X"),new t.type.Term("[]",[]),new t.type.Var("L")]))],"append/3":[new t.type.Rule(new t.type.Term("append",[new t.type.Term("[]",[]),new t.type.Var("X"),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("append",[new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("S")])]),new t.type.Term("append",[new t.type.Var("T"),new t.type.Var("X"),new t.type.Var("S")]))],"member/2":[new t.type.Rule(new t.type.Term("member",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("_")])]),null),new t.type.Rule(new t.type.Term("member",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("_"),new t.type.Var("Xs")])]),new t.type.Term("member",[new t.type.Var("X"),new t.type.Var("Xs")]))],"permutation/2":[new t.type.Rule(new t.type.Term("permutation",[new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("permutation",[new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("permutation",[new t.type.Var("T"),new t.type.Var("P")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("P")]),new t.type.Term("append",[new t.type.Var("X"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("Y")]),new t.type.Var("S")])])]))],"maplist/2":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("X")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("Xs")])]))],"maplist/3":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs")])]))],"maplist/4":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs")])]))],"maplist/5":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds")])]))],"maplist/6":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")]),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Es")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D"),new t.type.Var("E")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds"),new t.type.Var("Es")])]))],"maplist/7":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")]),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Es")]),new t.type.Term(".",[new t.type.Var("F"),new t.type.Var("Fs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D"),new t.type.Var("E"),new t.type.Var("F")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds"),new t.type.Var("Es"),new t.type.Var("Fs")])]))],"maplist/8":[new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("A"),new t.type.Var("As")]),new t.type.Term(".",[new t.type.Var("B"),new t.type.Var("Bs")]),new t.type.Term(".",[new t.type.Var("C"),new t.type.Var("Cs")]),new t.type.Term(".",[new t.type.Var("D"),new t.type.Var("Ds")]),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Es")]),new t.type.Term(".",[new t.type.Var("F"),new t.type.Var("Fs")]),new t.type.Term(".",[new t.type.Var("G"),new t.type.Var("Gs")])]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P"),new t.type.Var("A"),new t.type.Var("B"),new t.type.Var("C"),new t.type.Var("D"),new t.type.Var("E"),new t.type.Var("F"),new t.type.Var("G")]),new t.type.Term("maplist",[new t.type.Var("P"),new t.type.Var("As"),new t.type.Var("Bs"),new t.type.Var("Cs"),new t.type.Var("Ds"),new t.type.Var("Es"),new t.type.Var("Fs"),new t.type.Var("Gs")])]))],"include/3":[new t.type.Rule(new t.type.Term("include",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("include",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("L")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P"),new t.type.Var("A")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("A"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Term("[]",[])]),new t.type.Var("B")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("F"),new t.type.Var("B")]),new t.type.Term(",",[new t.type.Term(";",[new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("F")]),new t.type.Term(",",[new t.type.Term("=",[new t.type.Var("L"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("S")])]),new t.type.Term("!",[])])]),new t.type.Term("=",[new t.type.Var("L"),new t.type.Var("S")])]),new t.type.Term("include",[new t.type.Var("P"),new t.type.Var("T"),new t.type.Var("S")])])])])]))],"exclude/3":[new t.type.Rule(new t.type.Term("exclude",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Term("[]",[])]),null),new t.type.Rule(new t.type.Term("exclude",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("exclude",[new t.type.Var("P"),new t.type.Var("T"),new t.type.Var("E")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P"),new t.type.Var("L")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("L"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Term("[]",[])]),new t.type.Var("Q")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("R"),new t.type.Var("Q")]),new t.type.Term(";",[new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("R")]),new t.type.Term(",",[new t.type.Term("!",[]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("E")])])]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("E")])])])])])])]))],"foldl/4":[new t.type.Rule(new t.type.Term("foldl",[new t.type.Var("_"),new t.type.Term("[]",[]),new t.type.Var("I"),new t.type.Var("I")]),null),new t.type.Rule(new t.type.Term("foldl",[new t.type.Var("P"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Var("T")]),new t.type.Var("I"),new t.type.Var("R")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P"),new t.type.Var("L")]),new t.type.Term(",",[new t.type.Term("append",[new t.type.Var("L"),new t.type.Term(".",[new t.type.Var("I"),new t.type.Term(".",[new t.type.Var("H"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])])])]),new t.type.Var("L2")]),new t.type.Term(",",[new t.type.Term("=..",[new t.type.Var("P2"),new t.type.Var("L2")]),new t.type.Term(",",[new t.type.Term("call",[new t.type.Var("P2")]),new t.type.Term("foldl",[new t.type.Var("P"),new t.type.Var("T"),new t.type.Var("X"),new t.type.Var("R")])])])])]))],"select/3":[new t.type.Rule(new t.type.Term("select",[new t.type.Var("E"),new t.type.Term(".",[new t.type.Var("E"),new t.type.Var("Xs")]),new t.type.Var("Xs")]),null),new t.type.Rule(new t.type.Term("select",[new t.type.Var("E"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Ys")])]),new t.type.Term("select",[new t.type.Var("E"),new t.type.Var("Xs"),new t.type.Var("Ys")]))],"sum_list/2":[new t.type.Rule(new t.type.Term("sum_list",[new t.type.Term("[]",[]),new t.type.Num(0,!1)]),null),new t.type.Rule(new t.type.Term("sum_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("sum_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term("is",[new t.type.Var("S"),new t.type.Term("+",[new t.type.Var("X"),new t.type.Var("Y")])])]))],"max_list/2":[new t.type.Rule(new t.type.Term("max_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])]),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("max_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("max_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term(";",[new t.type.Term(",",[new t.type.Term(">=",[new t.type.Var("X"),new t.type.Var("Y")]),new t.type.Term(",",[new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("X")]),new t.type.Term("!",[])])]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("Y")])])]))],"min_list/2":[new t.type.Rule(new t.type.Term("min_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])]),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("min_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("min_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term(";",[new t.type.Term(",",[new t.type.Term("=<",[new t.type.Var("X"),new t.type.Var("Y")]),new t.type.Term(",",[new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("X")]),new t.type.Term("!",[])])]),new t.type.Term("=",[new t.type.Var("S"),new t.type.Var("Y")])])]))],"prod_list/2":[new t.type.Rule(new t.type.Term("prod_list",[new t.type.Term("[]",[]),new t.type.Num(1,!1)]),null),new t.type.Rule(new t.type.Term("prod_list",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("S")]),new t.type.Term(",",[new t.type.Term("prod_list",[new t.type.Var("Xs"),new t.type.Var("Y")]),new t.type.Term("is",[new t.type.Var("S"),new t.type.Term("*",[new t.type.Var("X"),new t.type.Var("Y")])])]))],"last/2":[new t.type.Rule(new t.type.Term("last",[new t.type.Term(".",[new t.type.Var("X"),new t.type.Term("[]",[])]),new t.type.Var("X")]),null),new t.type.Rule(new t.type.Term("last",[new t.type.Term(".",[new t.type.Var("_"),new t.type.Var("Xs")]),new t.type.Var("X")]),new t.type.Term("last",[new t.type.Var("Xs"),new t.type.Var("X")]))],"prefix/2":[new t.type.Rule(new t.type.Term("prefix",[new t.type.Var("Part"),new t.type.Var("Whole")]),new t.type.Term("append",[new t.type.Var("Part"),new t.type.Var("_"),new t.type.Var("Whole")]))],"nth0/3":[new t.type.Rule(new t.type.Term("nth0",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")])]),new t.type.Term(",",[new t.type.Term(">=",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")]),new t.type.Term("!",[])])])]))],"nth1/3":[new t.type.Rule(new t.type.Term("nth1",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")])]),new t.type.Term(",",[new t.type.Term(">",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("_")]),new t.type.Term("!",[])])])]))],"nth0/4":[new t.type.Rule(new t.type.Term("nth0",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")])]),new t.type.Term(",",[new t.type.Term(">=",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(0,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term("!",[])])])]))],"nth1/4":[new t.type.Rule(new t.type.Term("nth1",[new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term(";",[new t.type.Term("->",[new t.type.Term("var",[new t.type.Var("X")]),new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")])]),new t.type.Term(",",[new t.type.Term(">",[new t.type.Var("X"),new t.type.Num(0,!1)]),new t.type.Term(",",[new t.type.Term("nth",[new t.type.Num(1,!1),new t.type.Var("X"),new t.type.Var("Y"),new t.type.Var("Z"),new t.type.Var("W")]),new t.type.Term("!",[])])])]))],"nth/5":[new t.type.Rule(new t.type.Term("nth",[new t.type.Var("N"),new t.type.Var("N"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("X"),new t.type.Var("Xs")]),null),new t.type.Rule(new t.type.Term("nth",[new t.type.Var("N"),new t.type.Var("O"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Xs")]),new t.type.Var("Y"),new t.type.Term(".",[new t.type.Var("X"),new t.type.Var("Ys")])]),new t.type.Term(",",[new t.type.Term("is",[new t.type.Var("M"),new t.type.Term("+",[new t.type.Var("N"),new t.type.Num(1,!1)])]),new t.type.Term("nth",[new t.type.Var("M"),new t.type.Var("O"),new t.type.Var("Xs"),new t.type.Var("Y"),new t.type.Var("Ys")])]))],"length/2":function(o,a,n){var u=n.args[0],A=n.args[1];if(!t.type.is_variable(A)&&!t.type.is_integer(A))o.throw_error(t.error.type("integer",A,n.indicator));else if(t.type.is_integer(A)&&A.value<0)o.throw_error(t.error.domain("not_less_than_zero",A,n.indicator));else{var p=new t.type.Term("length",[u,new t.type.Num(0,!1),A]);t.type.is_integer(A)&&(p=new t.type.Term(",",[p,new t.type.Term("!",[])])),o.prepend([new t.type.State(a.goal.replace(p),a.substitution,a)])}},"length/3":[new t.type.Rule(new t.type.Term("length",[new t.type.Term("[]",[]),new t.type.Var("N"),new t.type.Var("N")]),null),new t.type.Rule(new t.type.Term("length",[new t.type.Term(".",[new t.type.Var("_"),new t.type.Var("X")]),new t.type.Var("A"),new t.type.Var("N")]),new t.type.Term(",",[new t.type.Term("succ",[new t.type.Var("A"),new t.type.Var("B")]),new t.type.Term("length",[new t.type.Var("X"),new t.type.Var("B"),new t.type.Var("N")])]))],"replicate/3":function(o,a,n){var u=n.args[0],A=n.args[1],p=n.args[2];if(t.type.is_variable(A))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_integer(A))o.throw_error(t.error.type("integer",A,n.indicator));else if(A.value<0)o.throw_error(t.error.domain("not_less_than_zero",A,n.indicator));else if(!t.type.is_variable(p)&&!t.type.is_list(p))o.throw_error(t.error.type("list",p,n.indicator));else{for(var h=new t.type.Term("[]"),E=0;E0;I--)E[I].equals(E[I-1])&&E.splice(I,1);for(var v=new t.type.Term("[]"),I=E.length-1;I>=0;I--)v=new t.type.Term(".",[E[I],v]);o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[v,A])),a.substitution,a)])}}},"msort/2":function(o,a,n){var u=n.args[0],A=n.args[1];if(t.type.is_variable(u))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_variable(A)&&!t.type.is_fully_list(A))o.throw_error(t.error.type("list",A,n.indicator));else{for(var p=[],h=u;h.indicator==="./2";)p.push(h.args[0]),h=h.args[1];if(t.type.is_variable(h))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_empty_list(h))o.throw_error(t.error.type("list",u,n.indicator));else{for(var E=p.sort(t.compare),I=new t.type.Term("[]"),v=E.length-1;v>=0;v--)I=new t.type.Term(".",[E[v],I]);o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[I,A])),a.substitution,a)])}}},"keysort/2":function(o,a,n){var u=n.args[0],A=n.args[1];if(t.type.is_variable(u))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_variable(A)&&!t.type.is_fully_list(A))o.throw_error(t.error.type("list",A,n.indicator));else{for(var p=[],h,E=u;E.indicator==="./2";){if(h=E.args[0],t.type.is_variable(h)){o.throw_error(t.error.instantiation(n.indicator));return}else if(!t.type.is_term(h)||h.indicator!=="-/2"){o.throw_error(t.error.type("pair",h,n.indicator));return}h.args[0].pair=h.args[1],p.push(h.args[0]),E=E.args[1]}if(t.type.is_variable(E))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_empty_list(E))o.throw_error(t.error.type("list",u,n.indicator));else{for(var I=p.sort(t.compare),v=new t.type.Term("[]"),b=I.length-1;b>=0;b--)v=new t.type.Term(".",[new t.type.Term("-",[I[b],I[b].pair]),v]),delete I[b].pair;o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[v,A])),a.substitution,a)])}}},"take/3":function(o,a,n){var u=n.args[0],A=n.args[1],p=n.args[2];if(t.type.is_variable(A)||t.type.is_variable(u))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_list(A))o.throw_error(t.error.type("list",A,n.indicator));else if(!t.type.is_integer(u))o.throw_error(t.error.type("integer",u,n.indicator));else if(!t.type.is_variable(p)&&!t.type.is_list(p))o.throw_error(t.error.type("list",p,n.indicator));else{for(var h=u.value,E=[],I=A;h>0&&I.indicator==="./2";)E.push(I.args[0]),I=I.args[1],h--;if(h===0){for(var v=new t.type.Term("[]"),h=E.length-1;h>=0;h--)v=new t.type.Term(".",[E[h],v]);o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[v,p])),a.substitution,a)])}}},"drop/3":function(o,a,n){var u=n.args[0],A=n.args[1],p=n.args[2];if(t.type.is_variable(A)||t.type.is_variable(u))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_list(A))o.throw_error(t.error.type("list",A,n.indicator));else if(!t.type.is_integer(u))o.throw_error(t.error.type("integer",u,n.indicator));else if(!t.type.is_variable(p)&&!t.type.is_list(p))o.throw_error(t.error.type("list",p,n.indicator));else{for(var h=u.value,E=[],I=A;h>0&&I.indicator==="./2";)E.push(I.args[0]),I=I.args[1],h--;h===0&&o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[I,p])),a.substitution,a)])}},"reverse/2":function(o,a,n){var u=n.args[0],A=n.args[1],p=t.type.is_instantiated_list(u),h=t.type.is_instantiated_list(A);if(t.type.is_variable(u)&&t.type.is_variable(A))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_variable(u)&&!t.type.is_fully_list(u))o.throw_error(t.error.type("list",u,n.indicator));else if(!t.type.is_variable(A)&&!t.type.is_fully_list(A))o.throw_error(t.error.type("list",A,n.indicator));else if(!p&&!h)o.throw_error(t.error.instantiation(n.indicator));else{for(var E=p?u:A,I=new t.type.Term("[]",[]);E.indicator==="./2";)I=new t.type.Term(".",[E.args[0],I]),E=E.args[1];o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[I,p?A:u])),a.substitution,a)])}},"list_to_set/2":function(o,a,n){var u=n.args[0],A=n.args[1];if(t.type.is_variable(u))o.throw_error(t.error.instantiation(n.indicator));else{for(var p=u,h=[];p.indicator==="./2";)h.push(p.args[0]),p=p.args[1];if(t.type.is_variable(p))o.throw_error(t.error.instantiation(n.indicator));else if(!t.type.is_term(p)||p.indicator!=="[]/0")o.throw_error(t.error.type("list",u,n.indicator));else{for(var E=[],I=new t.type.Term("[]",[]),v,b=0;b=0;b--)I=new t.type.Term(".",[E[b],I]);o.prepend([new t.type.State(a.goal.replace(new t.type.Term("=",[A,I])),a.substitution,a)])}}}}},r=["append/2","append/3","member/2","permutation/2","maplist/2","maplist/3","maplist/4","maplist/5","maplist/6","maplist/7","maplist/8","include/3","exclude/3","foldl/4","sum_list/2","max_list/2","min_list/2","prod_list/2","last/2","prefix/2","nth0/3","nth1/3","nth0/4","nth1/4","length/2","replicate/3","select/3","sort/2","msort/2","keysort/2","take/3","drop/3","reverse/2","list_to_set/2"];typeof aH<"u"?aH.exports=function(o){t=o,new t.type.Module("lists",e(),r)}:new t.type.Module("lists",e(),r)})(Vgt)});var ome=_(Yr=>{"use strict";var Zd=process.platform==="win32",lH="aes-256-cbc",Kgt="sha256",Kde="The current environment doesn't support interactive reading from TTY.",Yn=Be("fs"),Wde=process.binding("tty_wrap").TTY,uH=Be("child_process"),l0=Be("path"),AH={prompt:"> ",hideEchoBack:!1,mask:"*",limit:[],limitMessage:"Input another, please.$<( [)limit(])>",defaultInput:"",trueValue:[],falseValue:[],caseSensitive:!1,keepWhitespace:!1,encoding:"utf8",bufferSize:1024,print:void 0,history:!0,cd:!1,phContent:void 0,preCheck:void 0},Jf="none",Xc,IC,Vde=!1,a0,Ek,cH,Jgt=0,dH="",Xd=[],Ck,Jde=!1,fH=!1,v2=!1;function zde(t){function e(r){return r.replace(/[^\w\u0080-\uFFFF]/g,function(o){return"#"+o.charCodeAt(0)+";"})}return Ek.concat(function(r){var o=[];return Object.keys(r).forEach(function(a){r[a]==="boolean"?t[a]&&o.push("--"+a):r[a]==="string"&&t[a]&&o.push("--"+a,e(t[a]))}),o}({display:"string",displayOnly:"boolean",keyIn:"boolean",hideEchoBack:"boolean",mask:"string",limit:"string",caseSensitive:"boolean"}))}function zgt(t,e){function r(U){var J,te="",le;for(cH=cH||Be("os").tmpdir();;){J=l0.join(cH,U+te);try{le=Yn.openSync(J,"wx")}catch(pe){if(pe.code==="EEXIST"){te++;continue}else throw pe}Yn.closeSync(le);break}return J}var o,a,n,u={},A,p,h=r("readline-sync.stdout"),E=r("readline-sync.stderr"),I=r("readline-sync.exit"),v=r("readline-sync.done"),b=Be("crypto"),C,T,L;C=b.createHash(Kgt),C.update(""+process.pid+Jgt+++Math.random()),L=C.digest("hex"),T=b.createDecipher(lH,L),o=zde(t),Zd?(a=process.env.ComSpec||"cmd.exe",process.env.Q='"',n=["/V:ON","/S","/C","(%Q%"+a+"%Q% /V:ON /S /C %Q%%Q%"+a0+"%Q%"+o.map(function(U){return" %Q%"+U+"%Q%"}).join("")+" & (echo !ERRORLEVEL!)>%Q%"+I+"%Q%%Q%) 2>%Q%"+E+"%Q% |%Q%"+process.execPath+"%Q% %Q%"+__dirname+"\\encrypt.js%Q% %Q%"+lH+"%Q% %Q%"+L+"%Q% >%Q%"+h+"%Q% & (echo 1)>%Q%"+v+"%Q%"]):(a="/bin/sh",n=["-c",'("'+a0+'"'+o.map(function(U){return" '"+U.replace(/'/g,"'\\''")+"'"}).join("")+'; echo $?>"'+I+'") 2>"'+E+'" |"'+process.execPath+'" "'+__dirname+'/encrypt.js" "'+lH+'" "'+L+'" >"'+h+'"; echo 1 >"'+v+'"']),v2&&v2("_execFileSync",o);try{uH.spawn(a,n,e)}catch(U){u.error=new Error(U.message),u.error.method="_execFileSync - spawn",u.error.program=a,u.error.args=n}for(;Yn.readFileSync(v,{encoding:t.encoding}).trim()!=="1";);return(A=Yn.readFileSync(I,{encoding:t.encoding}).trim())==="0"?u.input=T.update(Yn.readFileSync(h,{encoding:"binary"}),"hex",t.encoding)+T.final(t.encoding):(p=Yn.readFileSync(E,{encoding:t.encoding}).trim(),u.error=new Error(Kde+(p?` +`+p:"")),u.error.method="_execFileSync",u.error.program=a,u.error.args=n,u.error.extMessage=p,u.error.exitCode=+A),Yn.unlinkSync(h),Yn.unlinkSync(E),Yn.unlinkSync(I),Yn.unlinkSync(v),u}function Xgt(t){var e,r={},o,a={env:process.env,encoding:t.encoding};if(a0||(Zd?process.env.PSModulePath?(a0="powershell.exe",Ek=["-ExecutionPolicy","Bypass","-File",__dirname+"\\read.ps1"]):(a0="cscript.exe",Ek=["//nologo",__dirname+"\\read.cs.js"]):(a0="/bin/sh",Ek=[__dirname+"/read.sh"])),Zd&&!process.env.PSModulePath&&(a.stdio=[process.stdin]),uH.execFileSync){e=zde(t),v2&&v2("execFileSync",e);try{r.input=uH.execFileSync(a0,e,a)}catch(n){o=n.stderr?(n.stderr+"").trim():"",r.error=new Error(Kde+(o?` +`+o:"")),r.error.method="execFileSync",r.error.program=a0,r.error.args=e,r.error.extMessage=o,r.error.exitCode=n.status,r.error.code=n.code,r.error.signal=n.signal}}else r=zgt(t,a);return r.error||(r.input=r.input.replace(/^\s*'|'\s*$/g,""),t.display=""),r}function pH(t){var e="",r=t.display,o=!t.display&&t.keyIn&&t.hideEchoBack&&!t.mask;function a(){var n=Xgt(t);if(n.error)throw n.error;return n.input}return fH&&fH(t),function(){var n,u,A;function p(){return n||(n=process.binding("fs"),u=process.binding("constants")),n}if(typeof Jf=="string")if(Jf=null,Zd){if(A=function(h){var E=h.replace(/^\D+/,"").split("."),I=0;return(E[0]=+E[0])&&(I+=E[0]*1e4),(E[1]=+E[1])&&(I+=E[1]*100),(E[2]=+E[2])&&(I+=E[2]),I}(process.version),!(A>=20302&&A<40204||A>=5e4&&A<50100||A>=50600&&A<60200)&&process.stdin.isTTY)process.stdin.pause(),Jf=process.stdin.fd,IC=process.stdin._handle;else try{Jf=p().open("CONIN$",u.O_RDWR,parseInt("0666",8)),IC=new Wde(Jf,!0)}catch{}if(process.stdout.isTTY)Xc=process.stdout.fd;else{try{Xc=Yn.openSync("\\\\.\\CON","w")}catch{}if(typeof Xc!="number")try{Xc=p().open("CONOUT$",u.O_RDWR,parseInt("0666",8))}catch{}}}else{if(process.stdin.isTTY){process.stdin.pause();try{Jf=Yn.openSync("/dev/tty","r"),IC=process.stdin._handle}catch{}}else try{Jf=Yn.openSync("/dev/tty","r"),IC=new Wde(Jf,!1)}catch{}if(process.stdout.isTTY)Xc=process.stdout.fd;else try{Xc=Yn.openSync("/dev/tty","w")}catch{}}}(),function(){var n,u,A=!t.hideEchoBack&&!t.keyIn,p,h,E,I,v;Ck="";function b(C){return C===Vde?!0:IC.setRawMode(C)!==0?!1:(Vde=C,!0)}if(Jde||!IC||typeof Xc!="number"&&(t.display||!A)){e=a();return}if(t.display&&(Yn.writeSync(Xc,t.display),t.display=""),!t.displayOnly){if(!b(!A)){e=a();return}for(h=t.keyIn?1:t.bufferSize,p=Buffer.allocUnsafe&&Buffer.alloc?Buffer.alloc(h):new Buffer(h),t.keyIn&&t.limit&&(u=new RegExp("[^"+t.limit+"]","g"+(t.caseSensitive?"":"i")));;){E=0;try{E=Yn.readSync(Jf,p,0,h)}catch(C){if(C.code!=="EOF"){b(!1),e+=a();return}}if(E>0?(I=p.toString(t.encoding,0,E),Ck+=I):(I=` +`,Ck+=String.fromCharCode(0)),I&&typeof(v=(I.match(/^(.*?)[\r\n]/)||[])[1])=="string"&&(I=v,n=!0),I&&(I=I.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,"")),I&&u&&(I=I.replace(u,"")),I&&(A||(t.hideEchoBack?t.mask&&Yn.writeSync(Xc,new Array(I.length+1).join(t.mask)):Yn.writeSync(Xc,I)),e+=I),!t.keyIn&&n||t.keyIn&&e.length>=h)break}!A&&!o&&Yn.writeSync(Xc,` +`),b(!1)}}(),t.print&&!o&&t.print(r+(t.displayOnly?"":(t.hideEchoBack?new Array(e.length+1).join(t.mask):e)+` +`),t.encoding),t.displayOnly?"":dH=t.keepWhitespace||t.keyIn?e:e.trim()}function Zgt(t,e){var r=[];function o(a){a!=null&&(Array.isArray(a)?a.forEach(o):(!e||e(a))&&r.push(a))}return o(t),r}function mH(t){return t.replace(/[\x00-\x7f]/g,function(e){return"\\x"+("00"+e.charCodeAt().toString(16)).substr(-2)})}function Ts(){var t=Array.prototype.slice.call(arguments),e,r;return t.length&&typeof t[0]=="boolean"&&(r=t.shift(),r&&(e=Object.keys(AH),t.unshift(AH))),t.reduce(function(o,a){return a==null||(a.hasOwnProperty("noEchoBack")&&!a.hasOwnProperty("hideEchoBack")&&(a.hideEchoBack=a.noEchoBack,delete a.noEchoBack),a.hasOwnProperty("noTrim")&&!a.hasOwnProperty("keepWhitespace")&&(a.keepWhitespace=a.noTrim,delete a.noTrim),r||(e=Object.keys(a)),e.forEach(function(n){var u;if(!!a.hasOwnProperty(n))switch(u=a[n],n){case"mask":case"limitMessage":case"defaultInput":case"encoding":u=u!=null?u+"":"",u&&n!=="limitMessage"&&(u=u.replace(/[\r\n]/g,"")),o[n]=u;break;case"bufferSize":!isNaN(u=parseInt(u,10))&&typeof u=="number"&&(o[n]=u);break;case"displayOnly":case"keyIn":case"hideEchoBack":case"caseSensitive":case"keepWhitespace":case"history":case"cd":o[n]=!!u;break;case"limit":case"trueValue":case"falseValue":o[n]=Zgt(u,function(A){var p=typeof A;return p==="string"||p==="number"||p==="function"||A instanceof RegExp}).map(function(A){return typeof A=="string"?A.replace(/[\r\n]/g,""):A});break;case"print":case"phContent":case"preCheck":o[n]=typeof u=="function"?u:void 0;break;case"prompt":case"display":o[n]=u??"";break}})),o},{})}function hH(t,e,r){return e.some(function(o){var a=typeof o;return a==="string"?r?t===o:t.toLowerCase()===o.toLowerCase():a==="number"?parseFloat(t)===o:a==="function"?o(t):o instanceof RegExp?o.test(t):!1})}function yH(t,e){var r=l0.normalize(Zd?(process.env.HOMEDRIVE||"")+(process.env.HOMEPATH||""):process.env.HOME||"").replace(/[\/\\]+$/,"");return t=l0.normalize(t),e?t.replace(/^~(?=\/|\\|$)/,r):t.replace(new RegExp("^"+mH(r)+"(?=\\/|\\\\|$)",Zd?"i":""),"~")}function BC(t,e){var r="(?:\\(([\\s\\S]*?)\\))?(\\w+|.-.)(?:\\(([\\s\\S]*?)\\))?",o=new RegExp("(\\$)?(\\$<"+r+">)","g"),a=new RegExp("(\\$)?(\\$\\{"+r+"\\})","g");function n(u,A,p,h,E,I){var v;return A||typeof(v=e(E))!="string"?p:v?(h||"")+v+(I||""):""}return t.replace(o,n).replace(a,n)}function Xde(t,e,r){var o,a=[],n=-1,u=0,A="",p;function h(E,I){return I.length>3?(E.push(I[0]+"..."+I[I.length-1]),p=!0):I.length&&(E=E.concat(I)),E}return o=t.reduce(function(E,I){return E.concat((I+"").split(""))},[]).reduce(function(E,I){var v,b;return e||(I=I.toLowerCase()),v=/^\d$/.test(I)?1:/^[A-Z]$/.test(I)?2:/^[a-z]$/.test(I)?3:0,r&&v===0?A+=I:(b=I.charCodeAt(0),v&&v===n&&b===u+1?a.push(I):(E=h(E,a),a=[I],n=v),u=b),E},[]),o=h(o,a),A&&(o.push(A),p=!0),{values:o,suppressed:p}}function Zde(t,e){return t.join(t.length>2?", ":e?" / ":"/")}function $de(t,e){var r,o,a={},n;if(e.phContent&&(r=e.phContent(t,e)),typeof r!="string")switch(t){case"hideEchoBack":case"mask":case"defaultInput":case"caseSensitive":case"keepWhitespace":case"encoding":case"bufferSize":case"history":case"cd":r=e.hasOwnProperty(t)?typeof e[t]=="boolean"?e[t]?"on":"off":e[t]+"":"";break;case"limit":case"trueValue":case"falseValue":o=e[e.hasOwnProperty(t+"Src")?t+"Src":t],e.keyIn?(a=Xde(o,e.caseSensitive),o=a.values):o=o.filter(function(u){var A=typeof u;return A==="string"||A==="number"}),r=Zde(o,a.suppressed);break;case"limitCount":case"limitCountNotZero":r=e[e.hasOwnProperty("limitSrc")?"limitSrc":"limit"].length,r=r||t!=="limitCountNotZero"?r+"":"";break;case"lastInput":r=dH;break;case"cwd":case"CWD":case"cwdHome":r=process.cwd(),t==="CWD"?r=l0.basename(r):t==="cwdHome"&&(r=yH(r));break;case"date":case"time":case"localeDate":case"localeTime":r=new Date()["to"+t.replace(/^./,function(u){return u.toUpperCase()})+"String"]();break;default:typeof(n=(t.match(/^history_m(\d+)$/)||[])[1])=="string"&&(r=Xd[Xd.length-n]||"")}return r}function eme(t){var e=/^(.)-(.)$/.exec(t),r="",o,a,n,u;if(!e)return null;for(o=e[1].charCodeAt(0),a=e[2].charCodeAt(0),u=o +And the length must be: $`,trueValue:null,falseValue:null,caseSensitive:!0},e,{history:!1,cd:!1,phContent:function(b){return b==="charlist"?r.text:b==="length"?o+"..."+a:null}}),u,A,p,h,E,I,v;for(e=e||{},u=BC(e.charlist?e.charlist+"":"$",eme),(isNaN(o=parseInt(e.min,10))||typeof o!="number")&&(o=12),(isNaN(a=parseInt(e.max,10))||typeof a!="number")&&(a=24),h=new RegExp("^["+mH(u)+"]{"+o+","+a+"}$"),r=Xde([u],n.caseSensitive,!0),r.text=Zde(r.values,r.suppressed),A=e.confirmMessage!=null?e.confirmMessage:"Reinput a same one to confirm it: ",p=e.unmatchMessage!=null?e.unmatchMessage:"It differs from first one. Hit only the Enter key if you want to retry from first one.",t==null&&(t="Input new password: "),E=n.limitMessage;!v;)n.limit=h,n.limitMessage=E,I=Yr.question(t,n),n.limit=[I,""],n.limitMessage=p,v=Yr.question(A,n);return I};function nme(t,e,r){var o;function a(n){return o=r(n),!isNaN(o)&&typeof o=="number"}return Yr.question(t,Ts({limitMessage:"Input valid number, please."},e,{limit:a,cd:!1})),o}Yr.questionInt=function(t,e){return nme(t,e,function(r){return parseInt(r,10)})};Yr.questionFloat=function(t,e){return nme(t,e,parseFloat)};Yr.questionPath=function(t,e){var r,o="",a=Ts({hideEchoBack:!1,limitMessage:`$Input valid path, please.$<( Min:)min>$<( Max:)max>`,history:!0,cd:!0},e,{keepWhitespace:!1,limit:function(n){var u,A,p;n=yH(n,!0),o="";function h(E){E.split(/\/|\\/).reduce(function(I,v){var b=l0.resolve(I+=v+l0.sep);if(!Yn.existsSync(b))Yn.mkdirSync(b);else if(!Yn.statSync(b).isDirectory())throw new Error("Non directory already exists: "+b);return I},"")}try{if(u=Yn.existsSync(n),r=u?Yn.realpathSync(n):l0.resolve(n),!e.hasOwnProperty("exists")&&!u||typeof e.exists=="boolean"&&e.exists!==u)return o=(u?"Already exists":"No such file or directory")+": "+r,!1;if(!u&&e.create&&(e.isDirectory?h(r):(h(l0.dirname(r)),Yn.closeSync(Yn.openSync(r,"w"))),r=Yn.realpathSync(r)),u&&(e.min||e.max||e.isFile||e.isDirectory)){if(A=Yn.statSync(r),e.isFile&&!A.isFile())return o="Not file: "+r,!1;if(e.isDirectory&&!A.isDirectory())return o="Not directory: "+r,!1;if(e.min&&A.size<+e.min||e.max&&A.size>+e.max)return o="Size "+A.size+" is out of range: "+r,!1}if(typeof e.validate=="function"&&(p=e.validate(r))!==!0)return typeof p=="string"&&(o=p),!1}catch(E){return o=E+"",!1}return!0},phContent:function(n){return n==="error"?o:n!=="min"&&n!=="max"?null:e.hasOwnProperty(n)?e[n]+"":""}});return e=e||{},t==null&&(t='Input path (you can "cd" and "pwd"): '),Yr.question(t,a),r};function ime(t,e){var r={},o={};return typeof t=="object"?(Object.keys(t).forEach(function(a){typeof t[a]=="function"&&(o[e.caseSensitive?a:a.toLowerCase()]=t[a])}),r.preCheck=function(a){var n;return r.args=gH(a),n=r.args[0]||"",e.caseSensitive||(n=n.toLowerCase()),r.hRes=n!=="_"&&o.hasOwnProperty(n)?o[n].apply(a,r.args.slice(1)):o.hasOwnProperty("_")?o._.apply(a,r.args):null,{res:a,forceNext:!1}},o.hasOwnProperty("_")||(r.limit=function(){var a=r.args[0]||"";return e.caseSensitive||(a=a.toLowerCase()),o.hasOwnProperty(a)})):r.preCheck=function(a){return r.args=gH(a),r.hRes=typeof t=="function"?t.apply(a,r.args):!0,{res:a,forceNext:!1}},r}Yr.promptCL=function(t,e){var r=Ts({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},e),o=ime(t,r);return r.limit=o.limit,r.preCheck=o.preCheck,Yr.prompt(r),o.args};Yr.promptLoop=function(t,e){for(var r=Ts({hideEchoBack:!1,trueValue:null,falseValue:null,caseSensitive:!1,history:!0},e);!t(Yr.prompt(r)););};Yr.promptCLLoop=function(t,e){var r=Ts({hideEchoBack:!1,limitMessage:"Requested command is not available.",caseSensitive:!1,history:!0},e),o=ime(t,r);for(r.limit=o.limit,r.preCheck=o.preCheck;Yr.prompt(r),!o.hRes;);};Yr.promptSimShell=function(t){return Yr.prompt(Ts({hideEchoBack:!1,history:!0},t,{prompt:function(){return Zd?"$>":(process.env.USER||"")+(process.env.HOSTNAME?"@"+process.env.HOSTNAME.replace(/\..*$/,""):"")+":$$ "}()}))};function sme(t,e,r){var o;return t==null&&(t="Are you sure? "),(!e||e.guide!==!1)&&(t+="")&&(t=t.replace(/\s*:?\s*$/,"")+" [y/n]: "),o=Yr.keyIn(t,Ts(e,{hideEchoBack:!1,limit:r,trueValue:"y",falseValue:"n",caseSensitive:!1})),typeof o=="boolean"?o:""}Yr.keyInYN=function(t,e){return sme(t,e)};Yr.keyInYNStrict=function(t,e){return sme(t,e,"yn")};Yr.keyInPause=function(t,e){t==null&&(t="Continue..."),(!e||e.guide!==!1)&&(t+="")&&(t=t.replace(/\s+$/,"")+" (Hit any key)"),Yr.keyIn(t,Ts({limit:null},e,{hideEchoBack:!0,mask:""}))};Yr.keyInSelect=function(t,e,r){var o=Ts({hideEchoBack:!1},r,{trueValue:null,falseValue:null,caseSensitive:!1,phContent:function(p){return p==="itemsCount"?t.length+"":p==="firstItem"?(t[0]+"").trim():p==="lastItem"?(t[t.length-1]+"").trim():null}}),a="",n={},u=49,A=` +`;if(!Array.isArray(t)||!t.length||t.length>35)throw"`items` must be Array (max length: 35).";return t.forEach(function(p,h){var E=String.fromCharCode(u);a+=E,n[E]=h,A+="["+E+"] "+(p+"").trim()+` +`,u=u===57?97:u+1}),(!r||r.cancel!==!1)&&(a+="0",n[0]=-1,A+="[0] "+(r&&r.cancel!=null&&typeof r.cancel!="boolean"?(r.cancel+"").trim():"CANCEL")+` +`),o.limit=a,A+=` +`,e==null&&(e="Choose one from list: "),(e+="")&&((!r||r.guide!==!1)&&(e=e.replace(/\s*:?\s*$/,"")+" [$]: "),A+=e),n[Yr.keyIn(A,o).toLowerCase()]};Yr.getRawInput=function(){return Ck};function D2(t,e){var r;return e.length&&(r={},r[t]=e[0]),Yr.setDefaultOptions(r)[t]}Yr.setPrint=function(){return D2("print",arguments)};Yr.setPrompt=function(){return D2("prompt",arguments)};Yr.setEncoding=function(){return D2("encoding",arguments)};Yr.setMask=function(){return D2("mask",arguments)};Yr.setBufferSize=function(){return D2("bufferSize",arguments)}});var EH=_((t7t,hl)=>{(function(){var t={major:0,minor:2,patch:66,status:"beta"};tau_file_system={files:{},open:function(w,S,y){var F=tau_file_system.files[w];if(!F){if(y==="read")return null;F={path:w,text:"",type:S,get:function(z,X){return X===this.text.length||X>this.text.length?"end_of_file":this.text.substring(X,X+z)},put:function(z,X){return X==="end_of_file"?(this.text+=z,!0):X==="past_end_of_file"?null:(this.text=this.text.substring(0,X)+z+this.text.substring(X+z.length),!0)},get_byte:function(z){if(z==="end_of_stream")return-1;var X=Math.floor(z/2);if(this.text.length<=X)return-1;var Z=n(this.text[Math.floor(z/2)],0);return z%2===0?Z&255:Z/256>>>0},put_byte:function(z,X){var Z=X==="end_of_stream"?this.text.length:Math.floor(X/2);if(this.text.length>>0,ie=(ie&255)<<8|z&255):(ie=ie&255,ie=(z&255)<<8|ie&255),this.text.length===Z?this.text+=u(ie):this.text=this.text.substring(0,Z)+u(ie)+this.text.substring(Z+1),!0},flush:function(){return!0},close:function(){var z=tau_file_system.files[this.path];return z?!0:null}},tau_file_system.files[w]=F}return y==="write"&&(F.text=""),F}},tau_user_input={buffer:"",get:function(w,S){for(var y;tau_user_input.buffer.length\?\@\^\~\\]+|'(?:[^']*?(?:\\(?:x?\d+)?\\)*(?:'')*(?:\\')*)*')/,number:/^(?:0o[0-7]+|0x[0-9a-fA-F]+|0b[01]+|0'(?:''|\\[abfnrtv\\'"`]|\\x?\d+\\|[^\\])|\d+(?:\.\d+(?:[eE][+-]?\d+)?)?)/,string:/^(?:"([^"]|""|\\")*"|`([^`]|``|\\`)*`)/,l_brace:/^(?:\[)/,r_brace:/^(?:\])/,l_bracket:/^(?:\{)/,r_bracket:/^(?:\})/,bar:/^(?:\|)/,l_paren:/^(?:\()/,r_paren:/^(?:\))/};function L(w,S){return w.get_flag("char_conversion").id==="on"?S.replace(/./g,function(y){return w.get_char_conversion(y)}):S}function U(w){this.thread=w,this.text="",this.tokens=[]}U.prototype.set_last_tokens=function(w){return this.tokens=w},U.prototype.new_text=function(w){this.text=w,this.tokens=[]},U.prototype.get_tokens=function(w){var S,y=0,F=0,z=0,X=[],Z=!1;if(w){var ie=this.tokens[w-1];y=ie.len,S=L(this.thread,this.text.substr(ie.len)),F=ie.line,z=ie.start}else S=this.text;if(/^\s*$/.test(S))return null;for(;S!=="";){var Se=[],Ne=!1;if(/^\n/.exec(S)!==null){F++,z=0,y++,S=S.replace(/\n/,""),Z=!0;continue}for(var ot in T)if(T.hasOwnProperty(ot)){var dt=T[ot].exec(S);dt&&Se.push({value:dt[0],name:ot,matches:dt})}if(!Se.length)return this.set_last_tokens([{value:S,matches:[],name:"lexical",line:F,start:z}]);var ie=r(Se,function(Qr,mr){return Qr.value.length>=mr.value.length?Qr:mr});switch(ie.start=z,ie.line=F,S=S.replace(ie.value,""),z+=ie.value.length,y+=ie.value.length,ie.name){case"atom":ie.raw=ie.value,ie.value.charAt(0)==="'"&&(ie.value=v(ie.value.substr(1,ie.value.length-2),"'"),ie.value===null&&(ie.name="lexical",ie.value="unknown escape sequence"));break;case"number":ie.float=ie.value.substring(0,2)!=="0x"&&ie.value.match(/[.eE]/)!==null&&ie.value!=="0'.",ie.value=C(ie.value),ie.blank=Ne;break;case"string":var jt=ie.value.charAt(0);ie.value=v(ie.value.substr(1,ie.value.length-2),jt),ie.value===null&&(ie.name="lexical",ie.value="unknown escape sequence");break;case"whitespace":var $t=X[X.length-1];$t&&($t.space=!0),Ne=!0;continue;case"r_bracket":X.length>0&&X[X.length-1].name==="l_bracket"&&(ie=X.pop(),ie.name="atom",ie.value="{}",ie.raw="{}",ie.space=!1);break;case"r_brace":X.length>0&&X[X.length-1].name==="l_brace"&&(ie=X.pop(),ie.name="atom",ie.value="[]",ie.raw="[]",ie.space=!1);break}ie.len=y,X.push(ie),Ne=!1}var xt=this.set_last_tokens(X);return xt.length===0?null:xt};function J(w,S,y,F,z){if(!S[y])return{type:A,value:x.error.syntax(S[y-1],"expression expected",!0)};var X;if(F==="0"){var Z=S[y];switch(Z.name){case"number":return{type:p,len:y+1,value:new x.type.Num(Z.value,Z.float)};case"variable":return{type:p,len:y+1,value:new x.type.Var(Z.value)};case"string":var ie;switch(w.get_flag("double_quotes").id){case"atom":ie=new H(Z.value,[]);break;case"codes":ie=new H("[]",[]);for(var Se=Z.value.length-1;Se>=0;Se--)ie=new H(".",[new x.type.Num(n(Z.value,Se),!1),ie]);break;case"chars":ie=new H("[]",[]);for(var Se=Z.value.length-1;Se>=0;Se--)ie=new H(".",[new x.type.Term(Z.value.charAt(Se),[]),ie]);break}return{type:p,len:y+1,value:ie};case"l_paren":var xt=J(w,S,y+1,w.__get_max_priority(),!0);return xt.type!==p?xt:S[xt.len]&&S[xt.len].name==="r_paren"?(xt.len++,xt):{type:A,derived:!0,value:x.error.syntax(S[xt.len]?S[xt.len]:S[xt.len-1],") or operator expected",!S[xt.len])};case"l_bracket":var xt=J(w,S,y+1,w.__get_max_priority(),!0);return xt.type!==p?xt:S[xt.len]&&S[xt.len].name==="r_bracket"?(xt.len++,xt.value=new H("{}",[xt.value]),xt):{type:A,derived:!0,value:x.error.syntax(S[xt.len]?S[xt.len]:S[xt.len-1],"} or operator expected",!S[xt.len])}}var Ne=te(w,S,y,z);return Ne.type===p||Ne.derived||(Ne=le(w,S,y),Ne.type===p||Ne.derived)?Ne:{type:A,derived:!1,value:x.error.syntax(S[y],"unexpected token")}}var ot=w.__get_max_priority(),dt=w.__get_next_priority(F),jt=y;if(S[y].name==="atom"&&S[y+1]&&(S[y].space||S[y+1].name!=="l_paren")){var Z=S[y++],$t=w.__lookup_operator_classes(F,Z.value);if($t&&$t.indexOf("fy")>-1){var xt=J(w,S,y,F,z);if(xt.type!==A)return Z.value==="-"&&!Z.space&&x.type.is_number(xt.value)?{value:new x.type.Num(-xt.value.value,xt.value.is_float),len:xt.len,type:p}:{value:new x.type.Term(Z.value,[xt.value]),len:xt.len,type:p};X=xt}else if($t&&$t.indexOf("fx")>-1){var xt=J(w,S,y,dt,z);if(xt.type!==A)return{value:new x.type.Term(Z.value,[xt.value]),len:xt.len,type:p};X=xt}}y=jt;var xt=J(w,S,y,dt,z);if(xt.type===p){y=xt.len;var Z=S[y];if(S[y]&&(S[y].name==="atom"&&w.__lookup_operator_classes(F,Z.value)||S[y].name==="bar"&&w.__lookup_operator_classes(F,"|"))){var an=dt,Qr=F,$t=w.__lookup_operator_classes(F,Z.value);if($t.indexOf("xf")>-1)return{value:new x.type.Term(Z.value,[xt.value]),len:++xt.len,type:p};if($t.indexOf("xfx")>-1){var mr=J(w,S,y+1,an,z);return mr.type===p?{value:new x.type.Term(Z.value,[xt.value,mr.value]),len:mr.len,type:p}:(mr.derived=!0,mr)}else if($t.indexOf("xfy")>-1){var mr=J(w,S,y+1,Qr,z);return mr.type===p?{value:new x.type.Term(Z.value,[xt.value,mr.value]),len:mr.len,type:p}:(mr.derived=!0,mr)}else if(xt.type!==A)for(;;){y=xt.len;var Z=S[y];if(Z&&Z.name==="atom"&&w.__lookup_operator_classes(F,Z.value)){var $t=w.__lookup_operator_classes(F,Z.value);if($t.indexOf("yf")>-1)xt={value:new x.type.Term(Z.value,[xt.value]),len:++y,type:p};else if($t.indexOf("yfx")>-1){var mr=J(w,S,++y,an,z);if(mr.type===A)return mr.derived=!0,mr;y=mr.len,xt={value:new x.type.Term(Z.value,[xt.value,mr.value]),len:y,type:p}}else break}else break}}else X={type:A,value:x.error.syntax(S[xt.len-1],"operator expected")};return xt}return xt}function te(w,S,y,F){if(!S[y]||S[y].name==="atom"&&S[y].raw==="."&&!F&&(S[y].space||!S[y+1]||S[y+1].name!=="l_paren"))return{type:A,derived:!1,value:x.error.syntax(S[y-1],"unfounded token")};var z=S[y],X=[];if(S[y].name==="atom"&&S[y].raw!==","){if(y++,S[y-1].space)return{type:p,len:y,value:new x.type.Term(z.value,X)};if(S[y]&&S[y].name==="l_paren"){if(S[y+1]&&S[y+1].name==="r_paren")return{type:A,derived:!0,value:x.error.syntax(S[y+1],"argument expected")};var Z=J(w,S,++y,"999",!0);if(Z.type===A)return Z.derived?Z:{type:A,derived:!0,value:x.error.syntax(S[y]?S[y]:S[y-1],"argument expected",!S[y])};for(X.push(Z.value),y=Z.len;S[y]&&S[y].name==="atom"&&S[y].value===",";){if(Z=J(w,S,y+1,"999",!0),Z.type===A)return Z.derived?Z:{type:A,derived:!0,value:x.error.syntax(S[y+1]?S[y+1]:S[y],"argument expected",!S[y+1])};X.push(Z.value),y=Z.len}if(S[y]&&S[y].name==="r_paren")y++;else return{type:A,derived:!0,value:x.error.syntax(S[y]?S[y]:S[y-1],", or ) expected",!S[y])}}return{type:p,len:y,value:new x.type.Term(z.value,X)}}return{type:A,derived:!1,value:x.error.syntax(S[y],"term expected")}}function le(w,S,y){if(!S[y])return{type:A,derived:!1,value:x.error.syntax(S[y-1],"[ expected")};if(S[y]&&S[y].name==="l_brace"){var F=J(w,S,++y,"999",!0),z=[F.value],X=void 0;if(F.type===A)return S[y]&&S[y].name==="r_brace"?{type:p,len:y+1,value:new x.type.Term("[]",[])}:{type:A,derived:!0,value:x.error.syntax(S[y],"] expected")};for(y=F.len;S[y]&&S[y].name==="atom"&&S[y].value===",";){if(F=J(w,S,y+1,"999",!0),F.type===A)return F.derived?F:{type:A,derived:!0,value:x.error.syntax(S[y+1]?S[y+1]:S[y],"argument expected",!S[y+1])};z.push(F.value),y=F.len}var Z=!1;if(S[y]&&S[y].name==="bar"){if(Z=!0,F=J(w,S,y+1,"999",!0),F.type===A)return F.derived?F:{type:A,derived:!0,value:x.error.syntax(S[y+1]?S[y+1]:S[y],"argument expected",!S[y+1])};X=F.value,y=F.len}return S[y]&&S[y].name==="r_brace"?{type:p,len:y+1,value:g(z,X)}:{type:A,derived:!0,value:x.error.syntax(S[y]?S[y]:S[y-1],Z?"] expected":", or | or ] expected",!S[y])}}return{type:A,derived:!1,value:x.error.syntax(S[y],"list expected")}}function pe(w,S,y){var F=S[y].line,z=J(w,S,y,w.__get_max_priority(),!1),X=null,Z;if(z.type!==A)if(y=z.len,S[y]&&S[y].name==="atom"&&S[y].raw===".")if(y++,x.type.is_term(z.value)){if(z.value.indicator===":-/2"?(X=new x.type.Rule(z.value.args[0],Pe(z.value.args[1])),Z={value:X,len:y,type:p}):z.value.indicator==="-->/2"?(X=ae(new x.type.Rule(z.value.args[0],z.value.args[1]),w),X.body=Pe(X.body),Z={value:X,len:y,type:x.type.is_rule(X)?p:A}):(X=new x.type.Rule(z.value,null),Z={value:X,len:y,type:p}),X){var ie=X.singleton_variables();ie.length>0&&w.throw_warning(x.warning.singleton(ie,X.head.indicator,F))}return Z}else return{type:A,value:x.error.syntax(S[y],"callable expected")};else return{type:A,value:x.error.syntax(S[y]?S[y]:S[y-1],". or operator expected")};return z}function Ae(w,S,y){y=y||{},y.from=y.from?y.from:"$tau-js",y.reconsult=y.reconsult!==void 0?y.reconsult:!0;var F=new U(w),z={},X;F.new_text(S);var Z=0,ie=F.get_tokens(Z);do{if(ie===null||!ie[Z])break;var Se=pe(w,ie,Z);if(Se.type===A)return new H("throw",[Se.value]);if(Se.value.body===null&&Se.value.head.indicator==="?-/1"){var Ne=new Je(w.session);Ne.add_goal(Se.value.head.args[0]),Ne.answer(function(dt){x.type.is_error(dt)?w.throw_warning(dt.args[0]):(dt===!1||dt===null)&&w.throw_warning(x.warning.failed_goal(Se.value.head.args[0],Se.len))}),Z=Se.len;var ot=!0}else if(Se.value.body===null&&Se.value.head.indicator===":-/1"){var ot=w.run_directive(Se.value.head.args[0]);Z=Se.len,Se.value.head.args[0].indicator==="char_conversion/2"&&(ie=F.get_tokens(Z),Z=0)}else{X=Se.value.head.indicator,y.reconsult!==!1&&z[X]!==!0&&!w.is_multifile_predicate(X)&&(w.session.rules[X]=a(w.session.rules[X]||[],function(jt){return jt.dynamic}),z[X]=!0);var ot=w.add_rule(Se.value,y);Z=Se.len}if(!ot)return ot}while(!0);return!0}function ye(w,S){var y=new U(w);y.new_text(S);var F=0;do{var z=y.get_tokens(F);if(z===null)break;var X=J(w,z,0,w.__get_max_priority(),!1);if(X.type!==A){var Z=X.len,ie=Z;if(z[Z]&&z[Z].name==="atom"&&z[Z].raw===".")w.add_goal(Pe(X.value));else{var Se=z[Z];return new H("throw",[x.error.syntax(Se||z[Z-1],". or operator expected",!Se)])}F=X.len+1}else return new H("throw",[X.value])}while(!0);return!0}function ae(w,S){w=w.rename(S);var y=S.next_free_variable(),F=we(w.body,y,S);return F.error?F.value:(w.body=F.value,w.head.args=w.head.args.concat([y,F.variable]),w.head=new H(w.head.id,w.head.args),w)}function we(w,S,y){var F;if(x.type.is_term(w)&&w.indicator==="!/0")return{value:w,variable:S,error:!1};if(x.type.is_term(w)&&w.indicator===",/2"){var z=we(w.args[0],S,y);if(z.error)return z;var X=we(w.args[1],z.variable,y);return X.error?X:{value:new H(",",[z.value,X.value]),variable:X.variable,error:!1}}else{if(x.type.is_term(w)&&w.indicator==="{}/1")return{value:w.args[0],variable:S,error:!1};if(x.type.is_empty_list(w))return{value:new H("true",[]),variable:S,error:!1};if(x.type.is_list(w)){F=y.next_free_variable();for(var Z=w,ie;Z.indicator==="./2";)ie=Z,Z=Z.args[1];return x.type.is_variable(Z)?{value:x.error.instantiation("DCG"),variable:S,error:!0}:x.type.is_empty_list(Z)?(ie.args[1]=F,{value:new H("=",[S,w]),variable:F,error:!1}):{value:x.error.type("list",w,"DCG"),variable:S,error:!0}}else return x.type.is_callable(w)?(F=y.next_free_variable(),w.args=w.args.concat([S,F]),w=new H(w.id,w.args),{value:w,variable:F,error:!1}):{value:x.error.type("callable",w,"DCG"),variable:S,error:!0}}}function Pe(w){return x.type.is_variable(w)?new H("call",[w]):x.type.is_term(w)&&[",/2",";/2","->/2"].indexOf(w.indicator)!==-1?new H(w.id,[Pe(w.args[0]),Pe(w.args[1])]):w}function g(w,S){for(var y=S||new x.type.Term("[]",[]),F=w.length-1;F>=0;F--)y=new x.type.Term(".",[w[F],y]);return y}function Ee(w,S){for(var y=w.length-1;y>=0;y--)w[y]===S&&w.splice(y,1)}function De(w){for(var S={},y=[],F=0;F=0;S--)if(w.charAt(S)==="/")return new H("/",[new H(w.substring(0,S)),new ke(parseInt(w.substring(S+1)),!1)])}function Ie(w){this.id=w}function ke(w,S){this.is_float=S!==void 0?S:parseInt(w)!==w,this.value=this.is_float?w:parseInt(w)}var ht=0;function H(w,S,y){this.ref=y||++ht,this.id=w,this.args=S||[],this.indicator=w+"/"+this.args.length}var lt=0;function Re(w,S,y,F,z,X){this.id=lt++,this.stream=w,this.mode=S,this.alias=y,this.type=F!==void 0?F:"text",this.reposition=z!==void 0?z:!0,this.eof_action=X!==void 0?X:"eof_code",this.position=this.mode==="append"?"end_of_stream":0,this.output=this.mode==="write"||this.mode==="append",this.input=this.mode==="read"}function Qe(w){w=w||{},this.links=w}function be(w,S,y){S=S||new Qe,y=y||null,this.goal=w,this.substitution=S,this.parent=y}function _e(w,S,y){this.head=w,this.body=S,this.dynamic=y||!1}function Te(w){w=w===void 0||w<=0?1e3:w,this.rules={},this.src_predicates={},this.rename=0,this.modules=[],this.thread=new Je(this),this.total_threads=1,this.renamed_variables={},this.public_predicates={},this.multifile_predicates={},this.limit=w,this.streams={user_input:new Re(typeof hl<"u"&&hl.exports?nodejs_user_input:tau_user_input,"read","user_input","text",!1,"reset"),user_output:new Re(typeof hl<"u"&&hl.exports?nodejs_user_output:tau_user_output,"write","user_output","text",!1,"eof_code")},this.file_system=typeof hl<"u"&&hl.exports?nodejs_file_system:tau_file_system,this.standard_input=this.streams.user_input,this.standard_output=this.streams.user_output,this.current_input=this.streams.user_input,this.current_output=this.streams.user_output,this.format_success=function(S){return S.substitution},this.format_error=function(S){return S.goal},this.flag={bounded:x.flag.bounded.value,max_integer:x.flag.max_integer.value,min_integer:x.flag.min_integer.value,integer_rounding_function:x.flag.integer_rounding_function.value,char_conversion:x.flag.char_conversion.value,debug:x.flag.debug.value,max_arity:x.flag.max_arity.value,unknown:x.flag.unknown.value,double_quotes:x.flag.double_quotes.value,occurs_check:x.flag.occurs_check.value,dialect:x.flag.dialect.value,version_data:x.flag.version_data.value,nodejs:x.flag.nodejs.value},this.__loaded_modules=[],this.__char_conversion={},this.__operators={1200:{":-":["fx","xfx"],"-->":["xfx"],"?-":["fx"]},1100:{";":["xfy"]},1050:{"->":["xfy"]},1e3:{",":["xfy"]},900:{"\\+":["fy"]},700:{"=":["xfx"],"\\=":["xfx"],"==":["xfx"],"\\==":["xfx"],"@<":["xfx"],"@=<":["xfx"],"@>":["xfx"],"@>=":["xfx"],"=..":["xfx"],is:["xfx"],"=:=":["xfx"],"=\\=":["xfx"],"<":["xfx"],"=<":["xfx"],">":["xfx"],">=":["xfx"]},600:{":":["xfy"]},500:{"+":["yfx"],"-":["yfx"],"/\\":["yfx"],"\\/":["yfx"]},400:{"*":["yfx"],"/":["yfx"],"//":["yfx"],rem:["yfx"],mod:["yfx"],"<<":["yfx"],">>":["yfx"]},200:{"**":["xfx"],"^":["xfy"],"-":["fy"],"+":["fy"],"\\":["fy"]}}}function Je(w){this.epoch=Date.now(),this.session=w,this.session.total_threads++,this.total_steps=0,this.cpu_time=0,this.cpu_time_last=0,this.points=[],this.debugger=!1,this.debugger_states=[],this.level="top_level/0",this.__calls=[],this.current_limit=this.session.limit,this.warnings=[]}function He(w,S,y){this.id=w,this.rules=S,this.exports=y,x.module[w]=this}He.prototype.exports_predicate=function(w){return this.exports.indexOf(w)!==-1},Ie.prototype.unify=function(w,S){if(S&&e(w.variables(),this.id)!==-1&&!x.type.is_variable(w))return null;var y={};return y[this.id]=w,new Qe(y)},ke.prototype.unify=function(w,S){return x.type.is_number(w)&&this.value===w.value&&this.is_float===w.is_float?new Qe:null},H.prototype.unify=function(w,S){if(x.type.is_term(w)&&this.indicator===w.indicator){for(var y=new Qe,F=0;F=0){var F=this.args[0].value,z=Math.floor(F/26),X=F%26;return"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[X]+(z!==0?z:"")}switch(this.indicator){case"[]/0":case"{}/0":case"!/0":return this.id;case"{}/1":return"{"+this.args[0].toString(w)+"}";case"./2":for(var Z="["+this.args[0].toString(w),ie=this.args[1];ie.indicator==="./2";)Z+=", "+ie.args[0].toString(w),ie=ie.args[1];return ie.indicator!=="[]/0"&&(Z+="|"+ie.toString(w)),Z+="]",Z;case",/2":return"("+this.args[0].toString(w)+", "+this.args[1].toString(w)+")";default:var Se=this.id,Ne=w.session?w.session.lookup_operator(this.id,this.args.length):null;if(w.session===void 0||w.ignore_ops||Ne===null)return w.quoted&&!/^(!|,|;|[a-z][0-9a-zA-Z_]*)$/.test(Se)&&Se!=="{}"&&Se!=="[]"&&(Se="'"+b(Se)+"'"),Se+(this.args.length?"("+o(this.args,function($t){return $t.toString(w)}).join(", ")+")":"");var ot=Ne.priority>S.priority||Ne.priority===S.priority&&(Ne.class==="xfy"&&this.indicator!==S.indicator||Ne.class==="yfx"&&this.indicator!==S.indicator||this.indicator===S.indicator&&Ne.class==="yfx"&&y==="right"||this.indicator===S.indicator&&Ne.class==="xfy"&&y==="left");Ne.indicator=this.indicator;var dt=ot?"(":"",jt=ot?")":"";return this.args.length===0?"("+this.id+")":["fy","fx"].indexOf(Ne.class)!==-1?dt+Se+" "+this.args[0].toString(w,Ne)+jt:["yf","xf"].indexOf(Ne.class)!==-1?dt+this.args[0].toString(w,Ne)+" "+Se+jt:dt+this.args[0].toString(w,Ne,"left")+" "+this.id+" "+this.args[1].toString(w,Ne,"right")+jt}},Re.prototype.toString=function(w){return"("+this.id+")"},Qe.prototype.toString=function(w){var S="{";for(var y in this.links)!this.links.hasOwnProperty(y)||(S!=="{"&&(S+=", "),S+=y+"/"+this.links[y].toString(w));return S+="}",S},be.prototype.toString=function(w){return this.goal===null?"<"+this.substitution.toString(w)+">":"<"+this.goal.toString(w)+", "+this.substitution.toString(w)+">"},_e.prototype.toString=function(w){return this.body?this.head.toString(w)+" :- "+this.body.toString(w)+".":this.head.toString(w)+"."},Te.prototype.toString=function(w){for(var S="",y=0;y=0;z--)F=new H(".",[S[z],F]);return F}return new H(this.id,o(this.args,function(X){return X.apply(w)}),this.ref)},Re.prototype.apply=function(w){return this},_e.prototype.apply=function(w){return new _e(this.head.apply(w),this.body!==null?this.body.apply(w):null)},Qe.prototype.apply=function(w){var S,y={};for(S in this.links)!this.links.hasOwnProperty(S)||(y[S]=this.links[S].apply(w));return new Qe(y)},H.prototype.select=function(){for(var w=this;w.indicator===",/2";)w=w.args[0];return w},H.prototype.replace=function(w){return this.indicator===",/2"?this.args[0].indicator===",/2"?new H(",",[this.args[0].replace(w),this.args[1]]):w===null?this.args[1]:new H(",",[w,this.args[1]]):w},H.prototype.search=function(w){if(x.type.is_term(w)&&w.ref!==void 0&&this.ref===w.ref)return!0;for(var S=0;SS&&F0&&(S=this.head_point().substitution.domain());e(S,x.format_variable(this.session.rename))!==-1;)this.session.rename++;if(w.id==="_")return new Ie(x.format_variable(this.session.rename));this.session.renamed_variables[w.id]=x.format_variable(this.session.rename)}return new Ie(this.session.renamed_variables[w.id])},Te.prototype.next_free_variable=function(){return this.thread.next_free_variable()},Je.prototype.next_free_variable=function(){this.session.rename++;var w=[];for(this.points.length>0&&(w=this.head_point().substitution.domain());e(w,x.format_variable(this.session.rename))!==-1;)this.session.rename++;return new Ie(x.format_variable(this.session.rename))},Te.prototype.is_public_predicate=function(w){return!this.public_predicates.hasOwnProperty(w)||this.public_predicates[w]===!0},Je.prototype.is_public_predicate=function(w){return this.session.is_public_predicate(w)},Te.prototype.is_multifile_predicate=function(w){return this.multifile_predicates.hasOwnProperty(w)&&this.multifile_predicates[w]===!0},Je.prototype.is_multifile_predicate=function(w){return this.session.is_multifile_predicate(w)},Te.prototype.prepend=function(w){return this.thread.prepend(w)},Je.prototype.prepend=function(w){for(var S=w.length-1;S>=0;S--)this.points.push(w[S])},Te.prototype.success=function(w,S){return this.thread.success(w,S)},Je.prototype.success=function(w,y){var y=typeof y>"u"?w:y;this.prepend([new be(w.goal.replace(null),w.substitution,y)])},Te.prototype.throw_error=function(w){return this.thread.throw_error(w)},Je.prototype.throw_error=function(w){this.prepend([new be(new H("throw",[w]),new Qe,null,null)])},Te.prototype.step_rule=function(w,S){return this.thread.step_rule(w,S)},Je.prototype.step_rule=function(w,S){var y=S.indicator;if(w==="user"&&(w=null),w===null&&this.session.rules.hasOwnProperty(y))return this.session.rules[y];for(var F=w===null?this.session.modules:e(this.session.modules,w)===-1?[]:[w],z=0;z1)&&this.again()},Te.prototype.answers=function(w,S,y){return this.thread.answers(w,S,y)},Je.prototype.answers=function(w,S,y){var F=S||1e3,z=this;if(S<=0){y&&y();return}this.answer(function(X){w(X),X!==!1?setTimeout(function(){z.answers(w,S-1,y)},1):y&&y()})},Te.prototype.again=function(w){return this.thread.again(w)},Je.prototype.again=function(w){for(var S,y=Date.now();this.__calls.length>0;){for(this.warnings=[],w!==!1&&(this.current_limit=this.session.limit);this.current_limit>0&&this.points.length>0&&this.head_point().goal!==null&&!x.type.is_error(this.head_point().goal);)if(this.current_limit--,this.step()===!0)return;var F=Date.now();this.cpu_time_last=F-y,this.cpu_time+=this.cpu_time_last;var z=this.__calls.shift();this.current_limit<=0?z(null):this.points.length===0?z(!1):x.type.is_error(this.head_point().goal)?(S=this.session.format_error(this.points.pop()),this.points=[],z(S)):(this.debugger&&this.debugger_states.push(this.head_point()),S=this.session.format_success(this.points.pop()),z(S))}},Te.prototype.unfold=function(w){if(w.body===null)return!1;var S=w.head,y=w.body,F=y.select(),z=new Je(this),X=[];z.add_goal(F),z.step();for(var Z=z.points.length-1;Z>=0;Z--){var ie=z.points[Z],Se=S.apply(ie.substitution),Ne=y.replace(ie.goal);Ne!==null&&(Ne=Ne.apply(ie.substitution)),X.push(new _e(Se,Ne))}var ot=this.rules[S.indicator],dt=e(ot,w);return X.length>0&&dt!==-1?(ot.splice.apply(ot,[dt,1].concat(X)),!0):!1},Je.prototype.unfold=function(w){return this.session.unfold(w)},Ie.prototype.interpret=function(w){return x.error.instantiation(w.level)},ke.prototype.interpret=function(w){return this},H.prototype.interpret=function(w){return x.type.is_unitary_list(this)?this.args[0].interpret(w):x.operate(w,this)},Ie.prototype.compare=function(w){return this.idw.id?1:0},ke.prototype.compare=function(w){if(this.value===w.value&&this.is_float===w.is_float)return 0;if(this.valuew.value)return 1},H.prototype.compare=function(w){if(this.args.lengthw.args.length||this.args.length===w.args.length&&this.id>w.id)return 1;for(var S=0;SF)return 1;if(w.constructor===ke){if(w.is_float&&S.is_float)return 0;if(w.is_float)return-1;if(S.is_float)return 1}return 0},is_substitution:function(w){return w instanceof Qe},is_state:function(w){return w instanceof be},is_rule:function(w){return w instanceof _e},is_variable:function(w){return w instanceof Ie},is_stream:function(w){return w instanceof Re},is_anonymous_var:function(w){return w instanceof Ie&&w.id==="_"},is_callable:function(w){return w instanceof H},is_number:function(w){return w instanceof ke},is_integer:function(w){return w instanceof ke&&!w.is_float},is_float:function(w){return w instanceof ke&&w.is_float},is_term:function(w){return w instanceof H},is_atom:function(w){return w instanceof H&&w.args.length===0},is_ground:function(w){if(w instanceof Ie)return!1;if(w instanceof H){for(var S=0;S0},is_list:function(w){return w instanceof H&&(w.indicator==="[]/0"||w.indicator==="./2")},is_empty_list:function(w){return w instanceof H&&w.indicator==="[]/0"},is_non_empty_list:function(w){return w instanceof H&&w.indicator==="./2"},is_fully_list:function(w){for(;w instanceof H&&w.indicator==="./2";)w=w.args[1];return w instanceof Ie||w instanceof H&&w.indicator==="[]/0"},is_instantiated_list:function(w){for(;w instanceof H&&w.indicator==="./2";)w=w.args[1];return w instanceof H&&w.indicator==="[]/0"},is_unitary_list:function(w){return w instanceof H&&w.indicator==="./2"&&w.args[1]instanceof H&&w.args[1].indicator==="[]/0"},is_character:function(w){return w instanceof H&&(w.id.length===1||w.id.length>0&&w.id.length<=2&&n(w.id,0)>=65536)},is_character_code:function(w){return w instanceof ke&&!w.is_float&&w.value>=0&&w.value<=1114111},is_byte:function(w){return w instanceof ke&&!w.is_float&&w.value>=0&&w.value<=255},is_operator:function(w){return w instanceof H&&x.arithmetic.evaluation[w.indicator]},is_directive:function(w){return w instanceof H&&x.directive[w.indicator]!==void 0},is_builtin:function(w){return w instanceof H&&x.predicate[w.indicator]!==void 0},is_error:function(w){return w instanceof H&&w.indicator==="throw/1"},is_predicate_indicator:function(w){return w instanceof H&&w.indicator==="//2"&&w.args[0]instanceof H&&w.args[0].args.length===0&&w.args[1]instanceof ke&&w.args[1].is_float===!1},is_flag:function(w){return w instanceof H&&w.args.length===0&&x.flag[w.id]!==void 0},is_value_flag:function(w,S){if(!x.type.is_flag(w))return!1;for(var y in x.flag[w.id].allowed)if(!!x.flag[w.id].allowed.hasOwnProperty(y)&&x.flag[w.id].allowed[y].equals(S))return!0;return!1},is_io_mode:function(w){return x.type.is_atom(w)&&["read","write","append"].indexOf(w.id)!==-1},is_stream_option:function(w){return x.type.is_term(w)&&(w.indicator==="alias/1"&&x.type.is_atom(w.args[0])||w.indicator==="reposition/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false")||w.indicator==="type/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="text"||w.args[0].id==="binary")||w.indicator==="eof_action/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="error"||w.args[0].id==="eof_code"||w.args[0].id==="reset"))},is_stream_position:function(w){return x.type.is_integer(w)&&w.value>=0||x.type.is_atom(w)&&(w.id==="end_of_stream"||w.id==="past_end_of_stream")},is_stream_property:function(w){return x.type.is_term(w)&&(w.indicator==="input/0"||w.indicator==="output/0"||w.indicator==="alias/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0]))||w.indicator==="file_name/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0]))||w.indicator==="position/1"&&(x.type.is_variable(w.args[0])||x.type.is_stream_position(w.args[0]))||w.indicator==="reposition/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false"))||w.indicator==="type/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0])&&(w.args[0].id==="text"||w.args[0].id==="binary"))||w.indicator==="mode/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0])&&(w.args[0].id==="read"||w.args[0].id==="write"||w.args[0].id==="append"))||w.indicator==="eof_action/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0])&&(w.args[0].id==="error"||w.args[0].id==="eof_code"||w.args[0].id==="reset"))||w.indicator==="end_of_stream/1"&&(x.type.is_variable(w.args[0])||x.type.is_atom(w.args[0])&&(w.args[0].id==="at"||w.args[0].id==="past"||w.args[0].id==="not")))},is_streamable:function(w){return w.__proto__.stream!==void 0},is_read_option:function(w){return x.type.is_term(w)&&["variables/1","variable_names/1","singletons/1"].indexOf(w.indicator)!==-1},is_write_option:function(w){return x.type.is_term(w)&&(w.indicator==="quoted/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false")||w.indicator==="ignore_ops/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false")||w.indicator==="numbervars/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false"))},is_close_option:function(w){return x.type.is_term(w)&&w.indicator==="force/1"&&x.type.is_atom(w.args[0])&&(w.args[0].id==="true"||w.args[0].id==="false")},is_modifiable_flag:function(w){return x.type.is_flag(w)&&x.flag[w.id].changeable},is_module:function(w){return w instanceof H&&w.indicator==="library/1"&&w.args[0]instanceof H&&w.args[0].args.length===0&&x.module[w.args[0].id]!==void 0}},arithmetic:{evaluation:{"e/0":{type_args:null,type_result:!0,fn:function(w){return Math.E}},"pi/0":{type_args:null,type_result:!0,fn:function(w){return Math.PI}},"tau/0":{type_args:null,type_result:!0,fn:function(w){return 2*Math.PI}},"epsilon/0":{type_args:null,type_result:!0,fn:function(w){return Number.EPSILON}},"+/1":{type_args:null,type_result:null,fn:function(w,S){return w}},"-/1":{type_args:null,type_result:null,fn:function(w,S){return-w}},"\\/1":{type_args:!1,type_result:!1,fn:function(w,S){return~w}},"abs/1":{type_args:null,type_result:null,fn:function(w,S){return Math.abs(w)}},"sign/1":{type_args:null,type_result:null,fn:function(w,S){return Math.sign(w)}},"float_integer_part/1":{type_args:!0,type_result:!1,fn:function(w,S){return parseInt(w)}},"float_fractional_part/1":{type_args:!0,type_result:!0,fn:function(w,S){return w-parseInt(w)}},"float/1":{type_args:null,type_result:!0,fn:function(w,S){return parseFloat(w)}},"floor/1":{type_args:!0,type_result:!1,fn:function(w,S){return Math.floor(w)}},"truncate/1":{type_args:!0,type_result:!1,fn:function(w,S){return parseInt(w)}},"round/1":{type_args:!0,type_result:!1,fn:function(w,S){return Math.round(w)}},"ceiling/1":{type_args:!0,type_result:!1,fn:function(w,S){return Math.ceil(w)}},"sin/1":{type_args:null,type_result:!0,fn:function(w,S){return Math.sin(w)}},"cos/1":{type_args:null,type_result:!0,fn:function(w,S){return Math.cos(w)}},"tan/1":{type_args:null,type_result:!0,fn:function(w,S){return Math.tan(w)}},"asin/1":{type_args:null,type_result:!0,fn:function(w,S){return Math.asin(w)}},"acos/1":{type_args:null,type_result:!0,fn:function(w,S){return Math.acos(w)}},"atan/1":{type_args:null,type_result:!0,fn:function(w,S){return Math.atan(w)}},"atan2/2":{type_args:null,type_result:!0,fn:function(w,S,y){return Math.atan2(w,S)}},"exp/1":{type_args:null,type_result:!0,fn:function(w,S){return Math.exp(w)}},"sqrt/1":{type_args:null,type_result:!0,fn:function(w,S){return Math.sqrt(w)}},"log/1":{type_args:null,type_result:!0,fn:function(w,S){return w>0?Math.log(w):x.error.evaluation("undefined",S.__call_indicator)}},"+/2":{type_args:null,type_result:null,fn:function(w,S,y){return w+S}},"-/2":{type_args:null,type_result:null,fn:function(w,S,y){return w-S}},"*/2":{type_args:null,type_result:null,fn:function(w,S,y){return w*S}},"//2":{type_args:null,type_result:!0,fn:function(w,S,y){return S?w/S:x.error.evaluation("zero_division",y.__call_indicator)}},"///2":{type_args:!1,type_result:!1,fn:function(w,S,y){return S?parseInt(w/S):x.error.evaluation("zero_division",y.__call_indicator)}},"**/2":{type_args:null,type_result:!0,fn:function(w,S,y){return Math.pow(w,S)}},"^/2":{type_args:null,type_result:null,fn:function(w,S,y){return Math.pow(w,S)}},"<>/2":{type_args:!1,type_result:!1,fn:function(w,S,y){return w>>S}},"/\\/2":{type_args:!1,type_result:!1,fn:function(w,S,y){return w&S}},"\\//2":{type_args:!1,type_result:!1,fn:function(w,S,y){return w|S}},"xor/2":{type_args:!1,type_result:!1,fn:function(w,S,y){return w^S}},"rem/2":{type_args:!1,type_result:!1,fn:function(w,S,y){return S?w%S:x.error.evaluation("zero_division",y.__call_indicator)}},"mod/2":{type_args:!1,type_result:!1,fn:function(w,S,y){return S?w-parseInt(w/S)*S:x.error.evaluation("zero_division",y.__call_indicator)}},"max/2":{type_args:null,type_result:null,fn:function(w,S,y){return Math.max(w,S)}},"min/2":{type_args:null,type_result:null,fn:function(w,S,y){return Math.min(w,S)}}}},directive:{"dynamic/1":function(w,S){var y=S.args[0];if(x.type.is_variable(y))w.throw_error(x.error.instantiation(S.indicator));else if(!x.type.is_compound(y)||y.indicator!=="//2")w.throw_error(x.error.type("predicate_indicator",y,S.indicator));else if(x.type.is_variable(y.args[0])||x.type.is_variable(y.args[1]))w.throw_error(x.error.instantiation(S.indicator));else if(!x.type.is_atom(y.args[0]))w.throw_error(x.error.type("atom",y.args[0],S.indicator));else if(!x.type.is_integer(y.args[1]))w.throw_error(x.error.type("integer",y.args[1],S.indicator));else{var F=S.args[0].args[0].id+"/"+S.args[0].args[1].value;w.session.public_predicates[F]=!0,w.session.rules[F]||(w.session.rules[F]=[])}},"multifile/1":function(w,S){var y=S.args[0];x.type.is_variable(y)?w.throw_error(x.error.instantiation(S.indicator)):!x.type.is_compound(y)||y.indicator!=="//2"?w.throw_error(x.error.type("predicate_indicator",y,S.indicator)):x.type.is_variable(y.args[0])||x.type.is_variable(y.args[1])?w.throw_error(x.error.instantiation(S.indicator)):x.type.is_atom(y.args[0])?x.type.is_integer(y.args[1])?w.session.multifile_predicates[S.args[0].args[0].id+"/"+S.args[0].args[1].value]=!0:w.throw_error(x.error.type("integer",y.args[1],S.indicator)):w.throw_error(x.error.type("atom",y.args[0],S.indicator))},"set_prolog_flag/2":function(w,S){var y=S.args[0],F=S.args[1];x.type.is_variable(y)||x.type.is_variable(F)?w.throw_error(x.error.instantiation(S.indicator)):x.type.is_atom(y)?x.type.is_flag(y)?x.type.is_value_flag(y,F)?x.type.is_modifiable_flag(y)?w.session.flag[y.id]=F:w.throw_error(x.error.permission("modify","flag",y)):w.throw_error(x.error.domain("flag_value",new H("+",[y,F]),S.indicator)):w.throw_error(x.error.domain("prolog_flag",y,S.indicator)):w.throw_error(x.error.type("atom",y,S.indicator))},"use_module/1":function(w,S){var y=S.args[0];if(x.type.is_variable(y))w.throw_error(x.error.instantiation(S.indicator));else if(!x.type.is_term(y))w.throw_error(x.error.type("term",y,S.indicator));else if(x.type.is_module(y)){var F=y.args[0].id;e(w.session.modules,F)===-1&&w.session.modules.push(F)}},"char_conversion/2":function(w,S){var y=S.args[0],F=S.args[1];x.type.is_variable(y)||x.type.is_variable(F)?w.throw_error(x.error.instantiation(S.indicator)):x.type.is_character(y)?x.type.is_character(F)?y.id===F.id?delete w.session.__char_conversion[y.id]:w.session.__char_conversion[y.id]=F.id:w.throw_error(x.error.type("character",F,S.indicator)):w.throw_error(x.error.type("character",y,S.indicator))},"op/3":function(w,S){var y=S.args[0],F=S.args[1],z=S.args[2];if(x.type.is_variable(y)||x.type.is_variable(F)||x.type.is_variable(z))w.throw_error(x.error.instantiation(S.indicator));else if(!x.type.is_integer(y))w.throw_error(x.error.type("integer",y,S.indicator));else if(!x.type.is_atom(F))w.throw_error(x.error.type("atom",F,S.indicator));else if(!x.type.is_atom(z))w.throw_error(x.error.type("atom",z,S.indicator));else if(y.value<0||y.value>1200)w.throw_error(x.error.domain("operator_priority",y,S.indicator));else if(z.id===",")w.throw_error(x.error.permission("modify","operator",z,S.indicator));else if(z.id==="|"&&(y.value<1001||F.id.length!==3))w.throw_error(x.error.permission("modify","operator",z,S.indicator));else if(["fy","fx","yf","xf","xfx","yfx","xfy"].indexOf(F.id)===-1)w.throw_error(x.error.domain("operator_specifier",F,S.indicator));else{var X={prefix:null,infix:null,postfix:null};for(var Z in w.session.__operators)if(!!w.session.__operators.hasOwnProperty(Z)){var ie=w.session.__operators[Z][z.id];ie&&(e(ie,"fx")!==-1&&(X.prefix={priority:Z,type:"fx"}),e(ie,"fy")!==-1&&(X.prefix={priority:Z,type:"fy"}),e(ie,"xf")!==-1&&(X.postfix={priority:Z,type:"xf"}),e(ie,"yf")!==-1&&(X.postfix={priority:Z,type:"yf"}),e(ie,"xfx")!==-1&&(X.infix={priority:Z,type:"xfx"}),e(ie,"xfy")!==-1&&(X.infix={priority:Z,type:"xfy"}),e(ie,"yfx")!==-1&&(X.infix={priority:Z,type:"yfx"}))}var Se;switch(F.id){case"fy":case"fx":Se="prefix";break;case"yf":case"xf":Se="postfix";break;default:Se="infix";break}if(((X.prefix&&Se==="prefix"||X.postfix&&Se==="postfix"||X.infix&&Se==="infix")&&X[Se].type!==F.id||X.infix&&Se==="postfix"||X.postfix&&Se==="infix")&&y.value!==0)w.throw_error(x.error.permission("create","operator",z,S.indicator));else return X[Se]&&(Ee(w.session.__operators[X[Se].priority][z.id],F.id),w.session.__operators[X[Se].priority][z.id].length===0&&delete w.session.__operators[X[Se].priority][z.id]),y.value>0&&(w.session.__operators[y.value]||(w.session.__operators[y.value.toString()]={}),w.session.__operators[y.value][z.id]||(w.session.__operators[y.value][z.id]=[]),w.session.__operators[y.value][z.id].push(F.id)),!0}}},predicate:{"op/3":function(w,S,y){x.directive["op/3"](w,y)&&w.success(S)},"current_op/3":function(w,S,y){var F=y.args[0],z=y.args[1],X=y.args[2],Z=[];for(var ie in w.session.__operators)for(var Se in w.session.__operators[ie])for(var Ne=0;Ne/2"){var F=w.points,z=w.session.format_success,X=w.session.format_error;w.session.format_success=function(Ne){return Ne.substitution},w.session.format_error=function(Ne){return Ne.goal},w.points=[new be(y.args[0].args[0],S.substitution,S)];var Z=function(Ne){w.points=F,w.session.format_success=z,w.session.format_error=X,Ne===!1?w.prepend([new be(S.goal.replace(y.args[1]),S.substitution,S)]):x.type.is_error(Ne)?w.throw_error(Ne.args[0]):Ne===null?(w.prepend([S]),w.__calls.shift()(null)):w.prepend([new be(S.goal.replace(y.args[0].args[1]).apply(Ne),S.substitution.apply(Ne),S)])};w.__calls.unshift(Z)}else{var ie=new be(S.goal.replace(y.args[0]),S.substitution,S),Se=new be(S.goal.replace(y.args[1]),S.substitution,S);w.prepend([ie,Se])}},"!/0":function(w,S,y){var F,z,X=[];for(F=S,z=null;F.parent!==null&&F.parent.goal.search(y);)if(z=F,F=F.parent,F.goal!==null){var Z=F.goal.select();if(Z&&Z.id==="call"&&Z.search(y)){F=z;break}}for(var ie=w.points.length-1;ie>=0;ie--){for(var Se=w.points[ie],Ne=Se.parent;Ne!==null&&Ne!==F.parent;)Ne=Ne.parent;Ne===null&&Ne!==F.parent&&X.push(Se)}w.points=X.reverse(),w.success(S)},"\\+/1":function(w,S,y){var F=y.args[0];x.type.is_variable(F)?w.throw_error(x.error.instantiation(w.level)):x.type.is_callable(F)?w.prepend([new be(S.goal.replace(new H(",",[new H(",",[new H("call",[F]),new H("!",[])]),new H("fail",[])])),S.substitution,S),new be(S.goal.replace(null),S.substitution,S)]):w.throw_error(x.error.type("callable",F,w.level))},"->/2":function(w,S,y){var F=S.goal.replace(new H(",",[y.args[0],new H(",",[new H("!"),y.args[1]])]));w.prepend([new be(F,S.substitution,S)])},"fail/0":function(w,S,y){},"false/0":function(w,S,y){},"true/0":function(w,S,y){w.success(S)},"call/1":ne(1),"call/2":ne(2),"call/3":ne(3),"call/4":ne(4),"call/5":ne(5),"call/6":ne(6),"call/7":ne(7),"call/8":ne(8),"once/1":function(w,S,y){var F=y.args[0];w.prepend([new be(S.goal.replace(new H(",",[new H("call",[F]),new H("!",[])])),S.substitution,S)])},"forall/2":function(w,S,y){var F=y.args[0],z=y.args[1];w.prepend([new be(S.goal.replace(new H("\\+",[new H(",",[new H("call",[F]),new H("\\+",[new H("call",[z])])])])),S.substitution,S)])},"repeat/0":function(w,S,y){w.prepend([new be(S.goal.replace(null),S.substitution,S),S])},"throw/1":function(w,S,y){x.type.is_variable(y.args[0])?w.throw_error(x.error.instantiation(w.level)):w.throw_error(y.args[0])},"catch/3":function(w,S,y){var F=w.points;w.points=[],w.prepend([new be(y.args[0],S.substitution,S)]);var z=w.session.format_success,X=w.session.format_error;w.session.format_success=function(ie){return ie.substitution},w.session.format_error=function(ie){return ie.goal};var Z=function(ie){var Se=w.points;if(w.points=F,w.session.format_success=z,w.session.format_error=X,x.type.is_error(ie)){for(var Ne=[],ot=w.points.length-1;ot>=0;ot--){for(var $t=w.points[ot],dt=$t.parent;dt!==null&&dt!==S.parent;)dt=dt.parent;dt===null&&dt!==S.parent&&Ne.push($t)}w.points=Ne;var jt=w.get_flag("occurs_check").indicator==="true/0",$t=new be,xt=x.unify(ie.args[0],y.args[1],jt);xt!==null?($t.substitution=S.substitution.apply(xt),$t.goal=S.goal.replace(y.args[2]).apply(xt),$t.parent=S,w.prepend([$t])):w.throw_error(ie.args[0])}else if(ie!==!1){for(var an=ie===null?[]:[new be(S.goal.apply(ie).replace(null),S.substitution.apply(ie),S)],Qr=[],ot=Se.length-1;ot>=0;ot--){Qr.push(Se[ot]);var mr=Se[ot].goal!==null?Se[ot].goal.select():null;if(x.type.is_term(mr)&&mr.indicator==="!/0")break}var xr=o(Qr,function(Wr){return Wr.goal===null&&(Wr.goal=new H("true",[])),Wr=new be(S.goal.replace(new H("catch",[Wr.goal,y.args[1],y.args[2]])),S.substitution.apply(Wr.substitution),Wr.parent),Wr.exclude=y.args[0].variables(),Wr}).reverse();w.prepend(xr),w.prepend(an),ie===null&&(this.current_limit=0,w.__calls.shift()(null))}};w.__calls.unshift(Z)},"=/2":function(w,S,y){var F=w.get_flag("occurs_check").indicator==="true/0",z=new be,X=x.unify(y.args[0],y.args[1],F);X!==null&&(z.goal=S.goal.apply(X).replace(null),z.substitution=S.substitution.apply(X),z.parent=S,w.prepend([z]))},"unify_with_occurs_check/2":function(w,S,y){var F=new be,z=x.unify(y.args[0],y.args[1],!0);z!==null&&(F.goal=S.goal.apply(z).replace(null),F.substitution=S.substitution.apply(z),F.parent=S,w.prepend([F]))},"\\=/2":function(w,S,y){var F=w.get_flag("occurs_check").indicator==="true/0",z=x.unify(y.args[0],y.args[1],F);z===null&&w.success(S)},"subsumes_term/2":function(w,S,y){var F=w.get_flag("occurs_check").indicator==="true/0",z=x.unify(y.args[1],y.args[0],F);z!==null&&y.args[1].apply(z).equals(y.args[1])&&w.success(S)},"findall/3":function(w,S,y){var F=y.args[0],z=y.args[1],X=y.args[2];if(x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(z))w.throw_error(x.error.type("callable",z,y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_list(X))w.throw_error(x.error.type("list",X,y.indicator));else{var Z=w.next_free_variable(),ie=new H(",",[z,new H("=",[Z,F])]),Se=w.points,Ne=w.session.limit,ot=w.session.format_success;w.session.format_success=function($t){return $t.substitution},w.add_goal(ie,!0,S);var dt=[],jt=function($t){if($t!==!1&&$t!==null&&!x.type.is_error($t))w.__calls.unshift(jt),dt.push($t.links[Z.id]),w.session.limit=w.current_limit;else if(w.points=Se,w.session.limit=Ne,w.session.format_success=ot,x.type.is_error($t))w.throw_error($t.args[0]);else if(w.current_limit>0){for(var xt=new H("[]"),an=dt.length-1;an>=0;an--)xt=new H(".",[dt[an],xt]);w.prepend([new be(S.goal.replace(new H("=",[X,xt])),S.substitution,S)])}};w.__calls.unshift(jt)}},"bagof/3":function(w,S,y){var F,z=y.args[0],X=y.args[1],Z=y.args[2];if(x.type.is_variable(X))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(X))w.throw_error(x.error.type("callable",X,y.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_list(Z))w.throw_error(x.error.type("list",Z,y.indicator));else{var ie=w.next_free_variable(),Se;X.indicator==="^/2"?(Se=X.args[0].variables(),X=X.args[1]):Se=[],Se=Se.concat(z.variables());for(var Ne=X.variables().filter(function(xr){return e(Se,xr)===-1}),ot=new H("[]"),dt=Ne.length-1;dt>=0;dt--)ot=new H(".",[new Ie(Ne[dt]),ot]);var jt=new H(",",[X,new H("=",[ie,new H(",",[ot,z])])]),$t=w.points,xt=w.session.limit,an=w.session.format_success;w.session.format_success=function(xr){return xr.substitution},w.add_goal(jt,!0,S);var Qr=[],mr=function(xr){if(xr!==!1&&xr!==null&&!x.type.is_error(xr)){w.__calls.unshift(mr);var Wr=!1,Vn=xr.links[ie.id].args[0],Ns=xr.links[ie.id].args[1];for(var Ri in Qr)if(!!Qr.hasOwnProperty(Ri)){var ps=Qr[Ri];if(ps.variables.equals(Vn)){ps.answers.push(Ns),Wr=!0;break}}Wr||Qr.push({variables:Vn,answers:[Ns]}),w.session.limit=w.current_limit}else if(w.points=$t,w.session.limit=xt,w.session.format_success=an,x.type.is_error(xr))w.throw_error(xr.args[0]);else if(w.current_limit>0){for(var io=[],Si=0;Si=0;so--)Ls=new H(".",[xr[so],Ls]);io.push(new be(S.goal.replace(new H(",",[new H("=",[ot,Qr[Si].variables]),new H("=",[Z,Ls])])),S.substitution,S))}w.prepend(io)}};w.__calls.unshift(mr)}},"setof/3":function(w,S,y){var F,z=y.args[0],X=y.args[1],Z=y.args[2];if(x.type.is_variable(X))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(X))w.throw_error(x.error.type("callable",X,y.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_list(Z))w.throw_error(x.error.type("list",Z,y.indicator));else{var ie=w.next_free_variable(),Se;X.indicator==="^/2"?(Se=X.args[0].variables(),X=X.args[1]):Se=[],Se=Se.concat(z.variables());for(var Ne=X.variables().filter(function(xr){return e(Se,xr)===-1}),ot=new H("[]"),dt=Ne.length-1;dt>=0;dt--)ot=new H(".",[new Ie(Ne[dt]),ot]);var jt=new H(",",[X,new H("=",[ie,new H(",",[ot,z])])]),$t=w.points,xt=w.session.limit,an=w.session.format_success;w.session.format_success=function(xr){return xr.substitution},w.add_goal(jt,!0,S);var Qr=[],mr=function(xr){if(xr!==!1&&xr!==null&&!x.type.is_error(xr)){w.__calls.unshift(mr);var Wr=!1,Vn=xr.links[ie.id].args[0],Ns=xr.links[ie.id].args[1];for(var Ri in Qr)if(!!Qr.hasOwnProperty(Ri)){var ps=Qr[Ri];if(ps.variables.equals(Vn)){ps.answers.push(Ns),Wr=!0;break}}Wr||Qr.push({variables:Vn,answers:[Ns]}),w.session.limit=w.current_limit}else if(w.points=$t,w.session.limit=xt,w.session.format_success=an,x.type.is_error(xr))w.throw_error(xr.args[0]);else if(w.current_limit>0){for(var io=[],Si=0;Si=0;so--)Ls=new H(".",[xr[so],Ls]);io.push(new be(S.goal.replace(new H(",",[new H("=",[ot,Qr[Si].variables]),new H("=",[Z,Ls])])),S.substitution,S))}w.prepend(io)}};w.__calls.unshift(mr)}},"functor/3":function(w,S,y){var F,z=y.args[0],X=y.args[1],Z=y.args[2];if(x.type.is_variable(z)&&(x.type.is_variable(X)||x.type.is_variable(Z)))w.throw_error(x.error.instantiation("functor/3"));else if(!x.type.is_variable(Z)&&!x.type.is_integer(Z))w.throw_error(x.error.type("integer",y.args[2],"functor/3"));else if(!x.type.is_variable(X)&&!x.type.is_atomic(X))w.throw_error(x.error.type("atomic",y.args[1],"functor/3"));else if(x.type.is_integer(X)&&x.type.is_integer(Z)&&Z.value!==0)w.throw_error(x.error.type("atom",y.args[1],"functor/3"));else if(x.type.is_variable(z)){if(y.args[2].value>=0){for(var ie=[],Se=0;Se0&&F<=y.args[1].args.length){var z=new H("=",[y.args[1].args[F-1],y.args[2]]);w.prepend([new be(S.goal.replace(z),S.substitution,S)])}}},"=../2":function(w,S,y){var F;if(x.type.is_variable(y.args[0])&&(x.type.is_variable(y.args[1])||x.type.is_non_empty_list(y.args[1])&&x.type.is_variable(y.args[1].args[0])))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_fully_list(y.args[1]))w.throw_error(x.error.type("list",y.args[1],y.indicator));else if(x.type.is_variable(y.args[0])){if(!x.type.is_variable(y.args[1])){var X=[];for(F=y.args[1].args[1];F.indicator==="./2";)X.push(F.args[0]),F=F.args[1];x.type.is_variable(y.args[0])&&x.type.is_variable(F)?w.throw_error(x.error.instantiation(y.indicator)):X.length===0&&x.type.is_compound(y.args[1].args[0])?w.throw_error(x.error.type("atomic",y.args[1].args[0],y.indicator)):X.length>0&&(x.type.is_compound(y.args[1].args[0])||x.type.is_number(y.args[1].args[0]))?w.throw_error(x.error.type("atom",y.args[1].args[0],y.indicator)):X.length===0?w.prepend([new be(S.goal.replace(new H("=",[y.args[1].args[0],y.args[0]],S)),S.substitution,S)]):w.prepend([new be(S.goal.replace(new H("=",[new H(y.args[1].args[0].id,X),y.args[0]])),S.substitution,S)])}}else{if(x.type.is_atomic(y.args[0]))F=new H(".",[y.args[0],new H("[]")]);else{F=new H("[]");for(var z=y.args[0].args.length-1;z>=0;z--)F=new H(".",[y.args[0].args[z],F]);F=new H(".",[new H(y.args[0].id),F])}w.prepend([new be(S.goal.replace(new H("=",[F,y.args[1]])),S.substitution,S)])}},"copy_term/2":function(w,S,y){var F=y.args[0].rename(w);w.prepend([new be(S.goal.replace(new H("=",[F,y.args[1]])),S.substitution,S.parent)])},"term_variables/2":function(w,S,y){var F=y.args[0],z=y.args[1];if(!x.type.is_fully_list(z))w.throw_error(x.error.type("list",z,y.indicator));else{var X=g(o(De(F.variables()),function(Z){return new Ie(Z)}));w.prepend([new be(S.goal.replace(new H("=",[z,X])),S.substitution,S)])}},"clause/2":function(w,S,y){if(x.type.is_variable(y.args[0]))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))w.throw_error(x.error.type("callable",y.args[0],y.indicator));else if(!x.type.is_variable(y.args[1])&&!x.type.is_callable(y.args[1]))w.throw_error(x.error.type("callable",y.args[1],y.indicator));else if(w.session.rules[y.args[0].indicator]!==void 0)if(w.is_public_predicate(y.args[0].indicator)){var F=[];for(var z in w.session.rules[y.args[0].indicator])if(!!w.session.rules[y.args[0].indicator].hasOwnProperty(z)){var X=w.session.rules[y.args[0].indicator][z];w.session.renamed_variables={},X=X.rename(w),X.body===null&&(X.body=new H("true"));var Z=new H(",",[new H("=",[X.head,y.args[0]]),new H("=",[X.body,y.args[1]])]);F.push(new be(S.goal.replace(Z),S.substitution,S))}w.prepend(F)}else w.throw_error(x.error.permission("access","private_procedure",y.args[0].indicator,y.indicator))},"current_predicate/1":function(w,S,y){var F=y.args[0];if(!x.type.is_variable(F)&&(!x.type.is_compound(F)||F.indicator!=="//2"))w.throw_error(x.error.type("predicate_indicator",F,y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_variable(F.args[0])&&!x.type.is_atom(F.args[0]))w.throw_error(x.error.type("atom",F.args[0],y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_variable(F.args[1])&&!x.type.is_integer(F.args[1]))w.throw_error(x.error.type("integer",F.args[1],y.indicator));else{var z=[];for(var X in w.session.rules)if(!!w.session.rules.hasOwnProperty(X)){var Z=X.lastIndexOf("/"),ie=X.substr(0,Z),Se=parseInt(X.substr(Z+1,X.length-(Z+1))),Ne=new H("/",[new H(ie),new ke(Se,!1)]),ot=new H("=",[Ne,F]);z.push(new be(S.goal.replace(ot),S.substitution,S))}w.prepend(z)}},"asserta/1":function(w,S,y){if(x.type.is_variable(y.args[0]))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))w.throw_error(x.error.type("callable",y.args[0],y.indicator));else{var F,z;y.args[0].indicator===":-/2"?(F=y.args[0].args[0],z=Pe(y.args[0].args[1])):(F=y.args[0],z=null),x.type.is_callable(F)?z!==null&&!x.type.is_callable(z)?w.throw_error(x.error.type("callable",z,y.indicator)):w.is_public_predicate(F.indicator)?(w.session.rules[F.indicator]===void 0&&(w.session.rules[F.indicator]=[]),w.session.public_predicates[F.indicator]=!0,w.session.rules[F.indicator]=[new _e(F,z,!0)].concat(w.session.rules[F.indicator]),w.success(S)):w.throw_error(x.error.permission("modify","static_procedure",F.indicator,y.indicator)):w.throw_error(x.error.type("callable",F,y.indicator))}},"assertz/1":function(w,S,y){if(x.type.is_variable(y.args[0]))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))w.throw_error(x.error.type("callable",y.args[0],y.indicator));else{var F,z;y.args[0].indicator===":-/2"?(F=y.args[0].args[0],z=Pe(y.args[0].args[1])):(F=y.args[0],z=null),x.type.is_callable(F)?z!==null&&!x.type.is_callable(z)?w.throw_error(x.error.type("callable",z,y.indicator)):w.is_public_predicate(F.indicator)?(w.session.rules[F.indicator]===void 0&&(w.session.rules[F.indicator]=[]),w.session.public_predicates[F.indicator]=!0,w.session.rules[F.indicator].push(new _e(F,z,!0)),w.success(S)):w.throw_error(x.error.permission("modify","static_procedure",F.indicator,y.indicator)):w.throw_error(x.error.type("callable",F,y.indicator))}},"retract/1":function(w,S,y){if(x.type.is_variable(y.args[0]))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_callable(y.args[0]))w.throw_error(x.error.type("callable",y.args[0],y.indicator));else{var F,z;if(y.args[0].indicator===":-/2"?(F=y.args[0].args[0],z=y.args[0].args[1]):(F=y.args[0],z=new H("true")),typeof S.retract>"u")if(w.is_public_predicate(F.indicator)){if(w.session.rules[F.indicator]!==void 0){for(var X=[],Z=0;Zw.get_flag("max_arity").value)w.throw_error(x.error.representation("max_arity",y.indicator));else{var F=y.args[0].args[0].id+"/"+y.args[0].args[1].value;w.is_public_predicate(F)?(delete w.session.rules[F],w.success(S)):w.throw_error(x.error.permission("modify","static_procedure",F,y.indicator))}},"atom_length/2":function(w,S,y){if(x.type.is_variable(y.args[0]))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_atom(y.args[0]))w.throw_error(x.error.type("atom",y.args[0],y.indicator));else if(!x.type.is_variable(y.args[1])&&!x.type.is_integer(y.args[1]))w.throw_error(x.error.type("integer",y.args[1],y.indicator));else if(x.type.is_integer(y.args[1])&&y.args[1].value<0)w.throw_error(x.error.domain("not_less_than_zero",y.args[1],y.indicator));else{var F=new ke(y.args[0].id.length,!1);w.prepend([new be(S.goal.replace(new H("=",[F,y.args[1]])),S.substitution,S)])}},"atom_concat/3":function(w,S,y){var F,z,X=y.args[0],Z=y.args[1],ie=y.args[2];if(x.type.is_variable(ie)&&(x.type.is_variable(X)||x.type.is_variable(Z)))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_atom(X))w.throw_error(x.error.type("atom",X,y.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_atom(Z))w.throw_error(x.error.type("atom",Z,y.indicator));else if(!x.type.is_variable(ie)&&!x.type.is_atom(ie))w.throw_error(x.error.type("atom",ie,y.indicator));else{var Se=x.type.is_variable(X),Ne=x.type.is_variable(Z);if(!Se&&!Ne)z=new H("=",[ie,new H(X.id+Z.id)]),w.prepend([new be(S.goal.replace(z),S.substitution,S)]);else if(Se&&!Ne)F=ie.id.substr(0,ie.id.length-Z.id.length),F+Z.id===ie.id&&(z=new H("=",[X,new H(F)]),w.prepend([new be(S.goal.replace(z),S.substitution,S)]));else if(Ne&&!Se)F=ie.id.substr(X.id.length),X.id+F===ie.id&&(z=new H("=",[Z,new H(F)]),w.prepend([new be(S.goal.replace(z),S.substitution,S)]));else{for(var ot=[],dt=0;dt<=ie.id.length;dt++){var jt=new H(ie.id.substr(0,dt)),$t=new H(ie.id.substr(dt));z=new H(",",[new H("=",[jt,X]),new H("=",[$t,Z])]),ot.push(new be(S.goal.replace(z),S.substitution,S))}w.prepend(ot)}}},"sub_atom/5":function(w,S,y){var F,z=y.args[0],X=y.args[1],Z=y.args[2],ie=y.args[3],Se=y.args[4];if(x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_integer(X))w.throw_error(x.error.type("integer",X,y.indicator));else if(!x.type.is_variable(Z)&&!x.type.is_integer(Z))w.throw_error(x.error.type("integer",Z,y.indicator));else if(!x.type.is_variable(ie)&&!x.type.is_integer(ie))w.throw_error(x.error.type("integer",ie,y.indicator));else if(x.type.is_integer(X)&&X.value<0)w.throw_error(x.error.domain("not_less_than_zero",X,y.indicator));else if(x.type.is_integer(Z)&&Z.value<0)w.throw_error(x.error.domain("not_less_than_zero",Z,y.indicator));else if(x.type.is_integer(ie)&&ie.value<0)w.throw_error(x.error.domain("not_less_than_zero",ie,y.indicator));else{var Ne=[],ot=[],dt=[];if(x.type.is_variable(X))for(F=0;F<=z.id.length;F++)Ne.push(F);else Ne.push(X.value);if(x.type.is_variable(Z))for(F=0;F<=z.id.length;F++)ot.push(F);else ot.push(Z.value);if(x.type.is_variable(ie))for(F=0;F<=z.id.length;F++)dt.push(F);else dt.push(ie.value);var jt=[];for(var $t in Ne)if(!!Ne.hasOwnProperty($t)){F=Ne[$t];for(var xt in ot)if(!!ot.hasOwnProperty(xt)){var an=ot[xt],Qr=z.id.length-F-an;if(e(dt,Qr)!==-1&&F+an+Qr===z.id.length){var mr=z.id.substr(F,an);if(z.id===z.id.substr(0,F)+mr+z.id.substr(F+an,Qr)){var xr=new H("=",[new H(mr),Se]),Wr=new H("=",[X,new ke(F)]),Vn=new H("=",[Z,new ke(an)]),Ns=new H("=",[ie,new ke(Qr)]),Ri=new H(",",[new H(",",[new H(",",[Wr,Vn]),Ns]),xr]);jt.push(new be(S.goal.replace(Ri),S.substitution,S))}}}}w.prepend(jt)}},"atom_chars/2":function(w,S,y){var F=y.args[0],z=y.args[1];if(x.type.is_variable(F)&&x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_atom(F))w.throw_error(x.error.type("atom",F,y.indicator));else if(x.type.is_variable(F)){for(var ie=z,Se=x.type.is_variable(F),Ne="";ie.indicator==="./2";){if(x.type.is_character(ie.args[0]))Ne+=ie.args[0].id;else if(x.type.is_variable(ie.args[0])&&Se){w.throw_error(x.error.instantiation(y.indicator));return}else if(!x.type.is_variable(ie.args[0])){w.throw_error(x.error.type("character",ie.args[0],y.indicator));return}ie=ie.args[1]}x.type.is_variable(ie)&&Se?w.throw_error(x.error.instantiation(y.indicator)):!x.type.is_empty_list(ie)&&!x.type.is_variable(ie)?w.throw_error(x.error.type("list",z,y.indicator)):w.prepend([new be(S.goal.replace(new H("=",[new H(Ne),F])),S.substitution,S)])}else{for(var X=new H("[]"),Z=F.id.length-1;Z>=0;Z--)X=new H(".",[new H(F.id.charAt(Z)),X]);w.prepend([new be(S.goal.replace(new H("=",[z,X])),S.substitution,S)])}},"atom_codes/2":function(w,S,y){var F=y.args[0],z=y.args[1];if(x.type.is_variable(F)&&x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_atom(F))w.throw_error(x.error.type("atom",F,y.indicator));else if(x.type.is_variable(F)){for(var ie=z,Se=x.type.is_variable(F),Ne="";ie.indicator==="./2";){if(x.type.is_character_code(ie.args[0]))Ne+=u(ie.args[0].value);else if(x.type.is_variable(ie.args[0])&&Se){w.throw_error(x.error.instantiation(y.indicator));return}else if(!x.type.is_variable(ie.args[0])){w.throw_error(x.error.representation("character_code",y.indicator));return}ie=ie.args[1]}x.type.is_variable(ie)&&Se?w.throw_error(x.error.instantiation(y.indicator)):!x.type.is_empty_list(ie)&&!x.type.is_variable(ie)?w.throw_error(x.error.type("list",z,y.indicator)):w.prepend([new be(S.goal.replace(new H("=",[new H(Ne),F])),S.substitution,S)])}else{for(var X=new H("[]"),Z=F.id.length-1;Z>=0;Z--)X=new H(".",[new ke(n(F.id,Z),!1),X]);w.prepend([new be(S.goal.replace(new H("=",[z,X])),S.substitution,S)])}},"char_code/2":function(w,S,y){var F=y.args[0],z=y.args[1];if(x.type.is_variable(F)&&x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_character(F))w.throw_error(x.error.type("character",F,y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_integer(z))w.throw_error(x.error.type("integer",z,y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_character_code(z))w.throw_error(x.error.representation("character_code",y.indicator));else if(x.type.is_variable(z)){var X=new ke(n(F.id,0),!1);w.prepend([new be(S.goal.replace(new H("=",[X,z])),S.substitution,S)])}else{var Z=new H(u(z.value));w.prepend([new be(S.goal.replace(new H("=",[Z,F])),S.substitution,S)])}},"number_chars/2":function(w,S,y){var F,z=y.args[0],X=y.args[1];if(x.type.is_variable(z)&&x.type.is_variable(X))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_number(z))w.throw_error(x.error.type("number",z,y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_list(X))w.throw_error(x.error.type("list",X,y.indicator));else{var Z=x.type.is_variable(z);if(!x.type.is_variable(X)){var ie=X,Se=!0;for(F="";ie.indicator==="./2";){if(x.type.is_character(ie.args[0]))F+=ie.args[0].id;else if(x.type.is_variable(ie.args[0]))Se=!1;else if(!x.type.is_variable(ie.args[0])){w.throw_error(x.error.type("character",ie.args[0],y.indicator));return}ie=ie.args[1]}if(Se=Se&&x.type.is_empty_list(ie),!x.type.is_empty_list(ie)&&!x.type.is_variable(ie)){w.throw_error(x.error.type("list",X,y.indicator));return}if(!Se&&Z){w.throw_error(x.error.instantiation(y.indicator));return}else if(Se)if(x.type.is_variable(ie)&&Z){w.throw_error(x.error.instantiation(y.indicator));return}else{var Ne=w.parse(F),ot=Ne.value;!x.type.is_number(ot)||Ne.tokens[Ne.tokens.length-1].space?w.throw_error(x.error.syntax_by_predicate("parseable_number",y.indicator)):w.prepend([new be(S.goal.replace(new H("=",[z,ot])),S.substitution,S)]);return}}if(!Z){F=z.toString();for(var dt=new H("[]"),jt=F.length-1;jt>=0;jt--)dt=new H(".",[new H(F.charAt(jt)),dt]);w.prepend([new be(S.goal.replace(new H("=",[X,dt])),S.substitution,S)])}}},"number_codes/2":function(w,S,y){var F,z=y.args[0],X=y.args[1];if(x.type.is_variable(z)&&x.type.is_variable(X))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(z)&&!x.type.is_number(z))w.throw_error(x.error.type("number",z,y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_list(X))w.throw_error(x.error.type("list",X,y.indicator));else{var Z=x.type.is_variable(z);if(!x.type.is_variable(X)){var ie=X,Se=!0;for(F="";ie.indicator==="./2";){if(x.type.is_character_code(ie.args[0]))F+=u(ie.args[0].value);else if(x.type.is_variable(ie.args[0]))Se=!1;else if(!x.type.is_variable(ie.args[0])){w.throw_error(x.error.type("character_code",ie.args[0],y.indicator));return}ie=ie.args[1]}if(Se=Se&&x.type.is_empty_list(ie),!x.type.is_empty_list(ie)&&!x.type.is_variable(ie)){w.throw_error(x.error.type("list",X,y.indicator));return}if(!Se&&Z){w.throw_error(x.error.instantiation(y.indicator));return}else if(Se)if(x.type.is_variable(ie)&&Z){w.throw_error(x.error.instantiation(y.indicator));return}else{var Ne=w.parse(F),ot=Ne.value;!x.type.is_number(ot)||Ne.tokens[Ne.tokens.length-1].space?w.throw_error(x.error.syntax_by_predicate("parseable_number",y.indicator)):w.prepend([new be(S.goal.replace(new H("=",[z,ot])),S.substitution,S)]);return}}if(!Z){F=z.toString();for(var dt=new H("[]"),jt=F.length-1;jt>=0;jt--)dt=new H(".",[new ke(n(F,jt),!1),dt]);w.prepend([new be(S.goal.replace(new H("=",[X,dt])),S.substitution,S)])}}},"upcase_atom/2":function(w,S,y){var F=y.args[0],z=y.args[1];x.type.is_variable(F)?w.throw_error(x.error.instantiation(y.indicator)):x.type.is_atom(F)?!x.type.is_variable(z)&&!x.type.is_atom(z)?w.throw_error(x.error.type("atom",z,y.indicator)):w.prepend([new be(S.goal.replace(new H("=",[z,new H(F.id.toUpperCase(),[])])),S.substitution,S)]):w.throw_error(x.error.type("atom",F,y.indicator))},"downcase_atom/2":function(w,S,y){var F=y.args[0],z=y.args[1];x.type.is_variable(F)?w.throw_error(x.error.instantiation(y.indicator)):x.type.is_atom(F)?!x.type.is_variable(z)&&!x.type.is_atom(z)?w.throw_error(x.error.type("atom",z,y.indicator)):w.prepend([new be(S.goal.replace(new H("=",[z,new H(F.id.toLowerCase(),[])])),S.substitution,S)]):w.throw_error(x.error.type("atom",F,y.indicator))},"atomic_list_concat/2":function(w,S,y){var F=y.args[0],z=y.args[1];w.prepend([new be(S.goal.replace(new H("atomic_list_concat",[F,new H("",[]),z])),S.substitution,S)])},"atomic_list_concat/3":function(w,S,y){var F=y.args[0],z=y.args[1],X=y.args[2];if(x.type.is_variable(z)||x.type.is_variable(F)&&x.type.is_variable(X))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_list(F))w.throw_error(x.error.type("list",F,y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_atom(X))w.throw_error(x.error.type("atom",X,y.indicator));else if(x.type.is_variable(X)){for(var ie="",Se=F;x.type.is_term(Se)&&Se.indicator==="./2";){if(!x.type.is_atom(Se.args[0])&&!x.type.is_number(Se.args[0])){w.throw_error(x.error.type("atomic",Se.args[0],y.indicator));return}ie!==""&&(ie+=z.id),x.type.is_atom(Se.args[0])?ie+=Se.args[0].id:ie+=""+Se.args[0].value,Se=Se.args[1]}ie=new H(ie,[]),x.type.is_variable(Se)?w.throw_error(x.error.instantiation(y.indicator)):!x.type.is_term(Se)||Se.indicator!=="[]/0"?w.throw_error(x.error.type("list",F,y.indicator)):w.prepend([new be(S.goal.replace(new H("=",[ie,X])),S.substitution,S)])}else{var Z=g(o(X.id.split(z.id),function(Ne){return new H(Ne,[])}));w.prepend([new be(S.goal.replace(new H("=",[Z,F])),S.substitution,S)])}},"@=/2":function(w,S,y){x.compare(y.args[0],y.args[1])>0&&w.success(S)},"@>=/2":function(w,S,y){x.compare(y.args[0],y.args[1])>=0&&w.success(S)},"compare/3":function(w,S,y){var F=y.args[0],z=y.args[1],X=y.args[2];if(!x.type.is_variable(F)&&!x.type.is_atom(F))w.throw_error(x.error.type("atom",F,y.indicator));else if(x.type.is_atom(F)&&["<",">","="].indexOf(F.id)===-1)w.throw_error(x.type.domain("order",F,y.indicator));else{var Z=x.compare(z,X);Z=Z===0?"=":Z===-1?"<":">",w.prepend([new be(S.goal.replace(new H("=",[F,new H(Z,[])])),S.substitution,S)])}},"is/2":function(w,S,y){var F=y.args[1].interpret(w);x.type.is_number(F)?w.prepend([new be(S.goal.replace(new H("=",[y.args[0],F],w.level)),S.substitution,S)]):w.throw_error(F)},"between/3":function(w,S,y){var F=y.args[0],z=y.args[1],X=y.args[2];if(x.type.is_variable(F)||x.type.is_variable(z))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_integer(F))w.throw_error(x.error.type("integer",F,y.indicator));else if(!x.type.is_integer(z))w.throw_error(x.error.type("integer",z,y.indicator));else if(!x.type.is_variable(X)&&!x.type.is_integer(X))w.throw_error(x.error.type("integer",X,y.indicator));else if(x.type.is_variable(X)){var Z=[new be(S.goal.replace(new H("=",[X,F])),S.substitution,S)];F.value=X.value&&w.success(S)},"succ/2":function(w,S,y){var F=y.args[0],z=y.args[1];x.type.is_variable(F)&&x.type.is_variable(z)?w.throw_error(x.error.instantiation(y.indicator)):!x.type.is_variable(F)&&!x.type.is_integer(F)?w.throw_error(x.error.type("integer",F,y.indicator)):!x.type.is_variable(z)&&!x.type.is_integer(z)?w.throw_error(x.error.type("integer",z,y.indicator)):!x.type.is_variable(F)&&F.value<0?w.throw_error(x.error.domain("not_less_than_zero",F,y.indicator)):!x.type.is_variable(z)&&z.value<0?w.throw_error(x.error.domain("not_less_than_zero",z,y.indicator)):(x.type.is_variable(z)||z.value>0)&&(x.type.is_variable(F)?w.prepend([new be(S.goal.replace(new H("=",[F,new ke(z.value-1,!1)])),S.substitution,S)]):w.prepend([new be(S.goal.replace(new H("=",[z,new ke(F.value+1,!1)])),S.substitution,S)]))},"=:=/2":function(w,S,y){var F=x.arithmetic_compare(w,y.args[0],y.args[1]);x.type.is_term(F)?w.throw_error(F):F===0&&w.success(S)},"=\\=/2":function(w,S,y){var F=x.arithmetic_compare(w,y.args[0],y.args[1]);x.type.is_term(F)?w.throw_error(F):F!==0&&w.success(S)},"/2":function(w,S,y){var F=x.arithmetic_compare(w,y.args[0],y.args[1]);x.type.is_term(F)?w.throw_error(F):F>0&&w.success(S)},">=/2":function(w,S,y){var F=x.arithmetic_compare(w,y.args[0],y.args[1]);x.type.is_term(F)?w.throw_error(F):F>=0&&w.success(S)},"var/1":function(w,S,y){x.type.is_variable(y.args[0])&&w.success(S)},"atom/1":function(w,S,y){x.type.is_atom(y.args[0])&&w.success(S)},"atomic/1":function(w,S,y){x.type.is_atomic(y.args[0])&&w.success(S)},"compound/1":function(w,S,y){x.type.is_compound(y.args[0])&&w.success(S)},"integer/1":function(w,S,y){x.type.is_integer(y.args[0])&&w.success(S)},"float/1":function(w,S,y){x.type.is_float(y.args[0])&&w.success(S)},"number/1":function(w,S,y){x.type.is_number(y.args[0])&&w.success(S)},"nonvar/1":function(w,S,y){x.type.is_variable(y.args[0])||w.success(S)},"ground/1":function(w,S,y){y.variables().length===0&&w.success(S)},"acyclic_term/1":function(w,S,y){for(var F=S.substitution.apply(S.substitution),z=y.args[0].variables(),X=0;X0?xt[xt.length-1]:null,xt!==null&&(jt=J(w,xt,0,w.__get_max_priority(),!1))}if(jt.type===p&&jt.len===xt.length-1&&an.value==="."){jt=jt.value.rename(w);var Qr=new H("=",[z,jt]);if(ie.variables){var mr=g(o(De(jt.variables()),function(xr){return new Ie(xr)}));Qr=new H(",",[Qr,new H("=",[ie.variables,mr])])}if(ie.variable_names){var mr=g(o(De(jt.variables()),function(Wr){var Vn;for(Vn in w.session.renamed_variables)if(w.session.renamed_variables.hasOwnProperty(Vn)&&w.session.renamed_variables[Vn]===Wr)break;return new H("=",[new H(Vn,[]),new Ie(Wr)])}));Qr=new H(",",[Qr,new H("=",[ie.variable_names,mr])])}if(ie.singletons){var mr=g(o(new _e(jt,null).singleton_variables(),function(Wr){var Vn;for(Vn in w.session.renamed_variables)if(w.session.renamed_variables.hasOwnProperty(Vn)&&w.session.renamed_variables[Vn]===Wr)break;return new H("=",[new H(Vn,[]),new Ie(Wr)])}));Qr=new H(",",[Qr,new H("=",[ie.singletons,mr])])}w.prepend([new be(S.goal.replace(Qr),S.substitution,S)])}else jt.type===p?w.throw_error(x.error.syntax(xt[jt.len],"unexpected token",!1)):w.throw_error(jt.value)}}},"write/1":function(w,S,y){var F=y.args[0];w.prepend([new be(S.goal.replace(new H(",",[new H("current_output",[new Ie("S")]),new H("write",[new Ie("S"),F])])),S.substitution,S)])},"write/2":function(w,S,y){var F=y.args[0],z=y.args[1];w.prepend([new be(S.goal.replace(new H("write_term",[F,z,new H(".",[new H("quoted",[new H("false",[])]),new H(".",[new H("ignore_ops",[new H("false")]),new H(".",[new H("numbervars",[new H("true")]),new H("[]",[])])])])])),S.substitution,S)])},"writeq/1":function(w,S,y){var F=y.args[0];w.prepend([new be(S.goal.replace(new H(",",[new H("current_output",[new Ie("S")]),new H("writeq",[new Ie("S"),F])])),S.substitution,S)])},"writeq/2":function(w,S,y){var F=y.args[0],z=y.args[1];w.prepend([new be(S.goal.replace(new H("write_term",[F,z,new H(".",[new H("quoted",[new H("true",[])]),new H(".",[new H("ignore_ops",[new H("false")]),new H(".",[new H("numbervars",[new H("true")]),new H("[]",[])])])])])),S.substitution,S)])},"write_canonical/1":function(w,S,y){var F=y.args[0];w.prepend([new be(S.goal.replace(new H(",",[new H("current_output",[new Ie("S")]),new H("write_canonical",[new Ie("S"),F])])),S.substitution,S)])},"write_canonical/2":function(w,S,y){var F=y.args[0],z=y.args[1];w.prepend([new be(S.goal.replace(new H("write_term",[F,z,new H(".",[new H("quoted",[new H("true",[])]),new H(".",[new H("ignore_ops",[new H("true")]),new H(".",[new H("numbervars",[new H("false")]),new H("[]",[])])])])])),S.substitution,S)])},"write_term/2":function(w,S,y){var F=y.args[0],z=y.args[1];w.prepend([new be(S.goal.replace(new H(",",[new H("current_output",[new Ie("S")]),new H("write_term",[new Ie("S"),F,z])])),S.substitution,S)])},"write_term/3":function(w,S,y){var F=y.args[0],z=y.args[1],X=y.args[2],Z=x.type.is_stream(F)?F:w.get_stream_by_alias(F.id);if(x.type.is_variable(F)||x.type.is_variable(X))w.throw_error(x.error.instantiation(y.indicator));else if(!x.type.is_list(X))w.throw_error(x.error.type("list",X,y.indicator));else if(!x.type.is_stream(F)&&!x.type.is_atom(F))w.throw_error(x.error.domain("stream_or_alias",F,y.indicator));else if(!x.type.is_stream(Z)||Z.stream===null)w.throw_error(x.error.existence("stream",F,y.indicator));else if(Z.input)w.throw_error(x.error.permission("output","stream",F,y.indicator));else if(Z.type==="binary")w.throw_error(x.error.permission("output","binary_stream",F,y.indicator));else if(Z.position==="past_end_of_stream"&&Z.eof_action==="error")w.throw_error(x.error.permission("output","past_end_of_stream",F,y.indicator));else{for(var ie={},Se=X,Ne;x.type.is_term(Se)&&Se.indicator==="./2";){if(Ne=Se.args[0],x.type.is_variable(Ne)){w.throw_error(x.error.instantiation(y.indicator));return}else if(!x.type.is_write_option(Ne)){w.throw_error(x.error.domain("write_option",Ne,y.indicator));return}ie[Ne.id]=Ne.args[0].id==="true",Se=Se.args[1]}if(Se.indicator!=="[]/0"){x.type.is_variable(Se)?w.throw_error(x.error.instantiation(y.indicator)):w.throw_error(x.error.type("list",X,y.indicator));return}else{ie.session=w.session;var ot=z.toString(ie);Z.stream.put(ot,Z.position),typeof Z.position=="number"&&(Z.position+=ot.length),w.success(S)}}},"halt/0":function(w,S,y){w.points=[]},"halt/1":function(w,S,y){var F=y.args[0];x.type.is_variable(F)?w.throw_error(x.error.instantiation(y.indicator)):x.type.is_integer(F)?w.points=[]:w.throw_error(x.error.type("integer",F,y.indicator))},"current_prolog_flag/2":function(w,S,y){var F=y.args[0],z=y.args[1];if(!x.type.is_variable(F)&&!x.type.is_atom(F))w.throw_error(x.error.type("atom",F,y.indicator));else if(!x.type.is_variable(F)&&!x.type.is_flag(F))w.throw_error(x.error.domain("prolog_flag",F,y.indicator));else{var X=[];for(var Z in x.flag)if(!!x.flag.hasOwnProperty(Z)){var ie=new H(",",[new H("=",[new H(Z),F]),new H("=",[w.get_flag(Z),z])]);X.push(new be(S.goal.replace(ie),S.substitution,S))}w.prepend(X)}},"set_prolog_flag/2":function(w,S,y){var F=y.args[0],z=y.args[1];x.type.is_variable(F)||x.type.is_variable(z)?w.throw_error(x.error.instantiation(y.indicator)):x.type.is_atom(F)?x.type.is_flag(F)?x.type.is_value_flag(F,z)?x.type.is_modifiable_flag(F)?(w.session.flag[F.id]=z,w.success(S)):w.throw_error(x.error.permission("modify","flag",F)):w.throw_error(x.error.domain("flag_value",new H("+",[F,z]),y.indicator)):w.throw_error(x.error.domain("prolog_flag",F,y.indicator)):w.throw_error(x.error.type("atom",F,y.indicator))}},flag:{bounded:{allowed:[new H("true"),new H("false")],value:new H("true"),changeable:!1},max_integer:{allowed:[new ke(Number.MAX_SAFE_INTEGER)],value:new ke(Number.MAX_SAFE_INTEGER),changeable:!1},min_integer:{allowed:[new ke(Number.MIN_SAFE_INTEGER)],value:new ke(Number.MIN_SAFE_INTEGER),changeable:!1},integer_rounding_function:{allowed:[new H("down"),new H("toward_zero")],value:new H("toward_zero"),changeable:!1},char_conversion:{allowed:[new H("on"),new H("off")],value:new H("on"),changeable:!0},debug:{allowed:[new H("on"),new H("off")],value:new H("off"),changeable:!0},max_arity:{allowed:[new H("unbounded")],value:new H("unbounded"),changeable:!1},unknown:{allowed:[new H("error"),new H("fail"),new H("warning")],value:new H("error"),changeable:!0},double_quotes:{allowed:[new H("chars"),new H("codes"),new H("atom")],value:new H("codes"),changeable:!0},occurs_check:{allowed:[new H("false"),new H("true")],value:new H("false"),changeable:!0},dialect:{allowed:[new H("tau")],value:new H("tau"),changeable:!1},version_data:{allowed:[new H("tau",[new ke(t.major,!1),new ke(t.minor,!1),new ke(t.patch,!1),new H(t.status)])],value:new H("tau",[new ke(t.major,!1),new ke(t.minor,!1),new ke(t.patch,!1),new H(t.status)]),changeable:!1},nodejs:{allowed:[new H("yes"),new H("no")],value:new H(typeof hl<"u"&&hl.exports?"yes":"no"),changeable:!1}},unify:function(w,S,y){y=y===void 0?!1:y;for(var F=[{left:w,right:S}],z={};F.length!==0;){var X=F.pop();if(w=X.left,S=X.right,x.type.is_term(w)&&x.type.is_term(S)){if(w.indicator!==S.indicator)return null;for(var Z=0;Zz.value?1:0:z}else return F},operate:function(w,S){if(x.type.is_operator(S)){for(var y=x.type.is_operator(S),F=[],z,X=!1,Z=0;Zw.get_flag("max_integer").value||z0?w.start+w.matches[0].length:w.start,z=y?new H("token_not_found"):new H("found",[new H(w.value.toString())]),X=new H(".",[new H("line",[new ke(w.line+1)]),new H(".",[new H("column",[new ke(F+1)]),new H(".",[z,new H("[]",[])])])]);return new H("error",[new H("syntax_error",[new H(S)]),X])},syntax_by_predicate:function(w,S){return new H("error",[new H("syntax_error",[new H(w)]),ee(S)])}},warning:{singleton:function(w,S,y){for(var F=new H("[]"),z=w.length-1;z>=0;z--)F=new H(".",[new Ie(w[z]),F]);return new H("warning",[new H("singleton_variables",[F,ee(S)]),new H(".",[new H("line",[new ke(y,!1)]),new H("[]")])])},failed_goal:function(w,S){return new H("warning",[new H("failed_goal",[w]),new H(".",[new H("line",[new ke(S,!1)]),new H("[]")])])}},format_variable:function(w){return"_"+w},format_answer:function(w,S,F){S instanceof Te&&(S=S.thread);var F=F||{};if(F.session=S?S.session:void 0,x.type.is_error(w))return"uncaught exception: "+w.args[0].toString();if(w===!1)return"false.";if(w===null)return"limit exceeded ;";var z=0,X="";if(x.type.is_substitution(w)){var Z=w.domain(!0);w=w.filter(function(Ne,ot){return!x.type.is_variable(ot)||Z.indexOf(ot.id)!==-1&&Ne!==ot.id})}for(var ie in w.links)!w.links.hasOwnProperty(ie)||(z++,X!==""&&(X+=", "),X+=ie.toString(F)+" = "+w.links[ie].toString(F));var Se=typeof S>"u"||S.points.length>0?" ;":".";return z===0?"true"+Se:X+Se},flatten_error:function(w){if(!x.type.is_error(w))return null;w=w.args[0];var S={};return S.type=w.args[0].id,S.thrown=S.type==="syntax_error"?null:w.args[1].id,S.expected=null,S.found=null,S.representation=null,S.existence=null,S.existence_type=null,S.line=null,S.column=null,S.permission_operation=null,S.permission_type=null,S.evaluation_type=null,S.type==="type_error"||S.type==="domain_error"?(S.expected=w.args[0].args[0].id,S.found=w.args[0].args[1].toString()):S.type==="syntax_error"?w.args[1].indicator==="./2"?(S.expected=w.args[0].args[0].id,S.found=w.args[1].args[1].args[1].args[0],S.found=S.found.id==="token_not_found"?S.found.id:S.found.args[0].id,S.line=w.args[1].args[0].args[0].value,S.column=w.args[1].args[1].args[0].args[0].value):S.thrown=w.args[1].id:S.type==="permission_error"?(S.found=w.args[0].args[2].toString(),S.permission_operation=w.args[0].args[0].id,S.permission_type=w.args[0].args[1].id):S.type==="evaluation_error"?S.evaluation_type=w.args[0].args[0].id:S.type==="representation_error"?S.representation=w.args[0].args[0].id:S.type==="existence_error"&&(S.existence=w.args[0].args[1].toString(),S.existence_type=w.args[0].args[0].id),S},create:function(w){return new x.type.Session(w)}};typeof hl<"u"?hl.exports=x:window.pl=x})()});function ame(t,e,r){t.prepend(r.map(o=>new Ra.default.type.State(e.goal.replace(o),e.substitution,e)))}function CH(t){let e=cme.get(t.session);if(e==null)throw new Error("Assertion failed: A project should have been registered for the active session");return e}function ume(t,e){cme.set(t,e),t.consult(`:- use_module(library(${tdt.id})).`)}var wH,Ra,lme,c0,$gt,edt,cme,tdt,Ame=Et(()=>{Ye();wH=$e(g2()),Ra=$e(EH()),lme=$e(Be("vm")),{is_atom:c0,is_variable:$gt,is_instantiated_list:edt}=Ra.default.type;cme=new WeakMap;tdt=new Ra.default.type.Module("constraints",{["project_workspaces_by_descriptor/3"]:(t,e,r)=>{let[o,a,n]=r.args;if(!c0(o)||!c0(a)){t.throw_error(Ra.default.error.instantiation(r.indicator));return}let u=W.parseIdent(o.id),A=W.makeDescriptor(u,a.id),h=CH(t).tryWorkspaceByDescriptor(A);$gt(n)&&h!==null&&ame(t,e,[new Ra.default.type.Term("=",[n,new Ra.default.type.Term(String(h.relativeCwd))])]),c0(n)&&h!==null&&h.relativeCwd===n.id&&t.success(e)},["workspace_field/3"]:(t,e,r)=>{let[o,a,n]=r.args;if(!c0(o)||!c0(a)){t.throw_error(Ra.default.error.instantiation(r.indicator));return}let A=CH(t).tryWorkspaceByCwd(o.id);if(A==null)return;let p=(0,wH.default)(A.manifest.raw,a.id);typeof p>"u"||ame(t,e,[new Ra.default.type.Term("=",[n,new Ra.default.type.Term(typeof p=="object"?JSON.stringify(p):p)])])},["workspace_field_test/3"]:(t,e,r)=>{let[o,a,n]=r.args;t.prepend([new Ra.default.type.State(e.goal.replace(new Ra.default.type.Term("workspace_field_test",[o,a,n,new Ra.default.type.Term("[]",[])])),e.substitution,e)])},["workspace_field_test/4"]:(t,e,r)=>{let[o,a,n,u]=r.args;if(!c0(o)||!c0(a)||!c0(n)||!edt(u)){t.throw_error(Ra.default.error.instantiation(r.indicator));return}let p=CH(t).tryWorkspaceByCwd(o.id);if(p==null)return;let h=(0,wH.default)(p.manifest.raw,a.id);if(typeof h>"u")return;let E={$$:h};for(let[v,b]of u.toJavaScript().entries())E[`$${v}`]=b;lme.default.runInNewContext(n.id,E)&&t.success(e)}},["project_workspaces_by_descriptor/3","workspace_field/3","workspace_field_test/3","workspace_field_test/4"])});var S2={};Kt(S2,{Constraints:()=>P2,DependencyType:()=>gme});function to(t){if(t instanceof vC.default.type.Num)return t.value;if(t instanceof vC.default.type.Term)switch(t.indicator){case"throw/1":return to(t.args[0]);case"error/1":return to(t.args[0]);case"error/2":if(t.args[0]instanceof vC.default.type.Term&&t.args[0].indicator==="syntax_error/1")return Object.assign(to(t.args[0]),...to(t.args[1]));{let e=to(t.args[0]);return e.message+=` (in ${to(t.args[1])})`,e}case"syntax_error/1":return new zt(43,`Syntax error: ${to(t.args[0])}`);case"existence_error/2":return new zt(44,`Existence error: ${to(t.args[0])} ${to(t.args[1])} not found`);case"instantiation_error/0":return new zt(75,"Instantiation error: an argument is variable when an instantiated argument was expected");case"line/1":return{line:to(t.args[0])};case"column/1":return{column:to(t.args[0])};case"found/1":return{found:to(t.args[0])};case"./2":return[to(t.args[0])].concat(to(t.args[1]));case"//2":return`${to(t.args[0])}/${to(t.args[1])}`;default:return t.id}throw`couldn't pretty print because of unsupported node ${t}`}function pme(t){let e;try{e=to(t)}catch(r){throw typeof r=="string"?new zt(42,`Unknown error: ${t} (note: ${r})`):r}return typeof e.line<"u"&&typeof e.column<"u"&&(e.message+=` at line ${e.line}, column ${e.column}`),e}function $d(t){return t.id==="null"?null:`${t.toJavaScript()}`}function rdt(t){if(t.id==="null")return null;{let e=t.toJavaScript();if(typeof e!="string")return JSON.stringify(e);try{return JSON.stringify(JSON.parse(e))}catch{return JSON.stringify(e)}}}function u0(t){return typeof t=="string"?`'${t}'`:"[]"}var hme,vC,gme,fme,IH,P2,x2=Et(()=>{Ye();Ye();Pt();hme=$e(Yde()),vC=$e(EH());B2();Ame();(0,hme.default)(vC.default);gme=(o=>(o.Dependencies="dependencies",o.DevDependencies="devDependencies",o.PeerDependencies="peerDependencies",o))(gme||{}),fme=["dependencies","devDependencies","peerDependencies"];IH=class{constructor(e,r){let o=1e3*e.workspaces.length;this.session=vC.default.create(o),ume(this.session,e),this.session.consult(":- use_module(library(lists))."),this.session.consult(r)}fetchNextAnswer(){return new Promise(e=>{this.session.answer(r=>{e(r)})})}async*makeQuery(e){let r=this.session.query(e);if(r!==!0)throw pme(r);for(;;){let o=await this.fetchNextAnswer();if(o===null)throw new zt(79,"Resolution limit exceeded");if(!o)break;if(o.id==="throw")throw pme(o);yield o}}};P2=class{constructor(e){this.source="";this.project=e;let r=e.configuration.get("constraintsPath");oe.existsSync(r)&&(this.source=oe.readFileSync(r,"utf8"))}static async find(e){return new P2(e)}getProjectDatabase(){let e="";for(let r of fme)e+=`dependency_type(${r}). +`;for(let r of this.project.workspacesByCwd.values()){let o=r.relativeCwd;e+=`workspace(${u0(o)}). +`,e+=`workspace_ident(${u0(o)}, ${u0(W.stringifyIdent(r.anchoredLocator))}). +`,e+=`workspace_version(${u0(o)}, ${u0(r.manifest.version)}). +`;for(let a of fme)for(let n of r.manifest[a].values())e+=`workspace_has_dependency(${u0(o)}, ${u0(W.stringifyIdent(n))}, ${u0(n.range)}, ${a}). +`}return e+=`workspace(_) :- false. +`,e+=`workspace_ident(_, _) :- false. +`,e+=`workspace_version(_, _) :- false. +`,e+=`workspace_has_dependency(_, _, _, _) :- false. +`,e}getDeclarations(){let e="";return e+=`gen_enforced_dependency(_, _, _, _) :- false. +`,e+=`gen_enforced_field(_, _, _) :- false. +`,e}get fullSource(){return`${this.getProjectDatabase()} +${this.source} +${this.getDeclarations()}`}createSession(){return new IH(this.project,this.fullSource)}async processClassic(){let e=this.createSession();return{enforcedDependencies:await this.genEnforcedDependencies(e),enforcedFields:await this.genEnforcedFields(e)}}async process(){let{enforcedDependencies:e,enforcedFields:r}=await this.processClassic(),o=new Map;for(let{workspace:a,dependencyIdent:n,dependencyRange:u,dependencyType:A}of e){let p=I2([A,W.stringifyIdent(n)]),h=je.getMapWithDefault(o,a.cwd);je.getMapWithDefault(h,p).set(u??void 0,new Set)}for(let{workspace:a,fieldPath:n,fieldValue:u}of r){let A=I2(n),p=je.getMapWithDefault(o,a.cwd);je.getMapWithDefault(p,A).set(JSON.parse(u)??void 0,new Set)}return{manifestUpdates:o,reportedErrors:new Map}}async genEnforcedDependencies(e){let r=[];for await(let o of e.makeQuery("workspace(WorkspaceCwd), dependency_type(DependencyType), gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType).")){let a=K.resolve(this.project.cwd,$d(o.links.WorkspaceCwd)),n=$d(o.links.DependencyIdent),u=$d(o.links.DependencyRange),A=$d(o.links.DependencyType);if(a===null||n===null)throw new Error("Invalid rule");let p=this.project.getWorkspaceByCwd(a),h=W.parseIdent(n);r.push({workspace:p,dependencyIdent:h,dependencyRange:u,dependencyType:A})}return je.sortMap(r,[({dependencyRange:o})=>o!==null?"0":"1",({workspace:o})=>W.stringifyIdent(o.anchoredLocator),({dependencyIdent:o})=>W.stringifyIdent(o)])}async genEnforcedFields(e){let r=[];for await(let o of e.makeQuery("workspace(WorkspaceCwd), gen_enforced_field(WorkspaceCwd, FieldPath, FieldValue).")){let a=K.resolve(this.project.cwd,$d(o.links.WorkspaceCwd)),n=$d(o.links.FieldPath),u=rdt(o.links.FieldValue);if(a===null||n===null)throw new Error("Invalid rule");let A=this.project.getWorkspaceByCwd(a);r.push({workspace:A,fieldPath:n,fieldValue:u})}return je.sortMap(r,[({workspace:o})=>W.stringifyIdent(o.anchoredLocator),({fieldPath:o})=>o])}async*query(e){let r=this.createSession();for await(let o of r.makeQuery(e)){let a={};for(let[n,u]of Object.entries(o.links))n!=="_"&&(a[n]=$d(u));yield a}}}});var vme=_(vk=>{"use strict";Object.defineProperty(vk,"__esModule",{value:!0});function q2(t){let e=[...t.caches],r=e.shift();return r===void 0?Bme():{get(o,a,n={miss:()=>Promise.resolve()}){return r.get(o,a,n).catch(()=>q2({caches:e}).get(o,a,n))},set(o,a){return r.set(o,a).catch(()=>q2({caches:e}).set(o,a))},delete(o){return r.delete(o).catch(()=>q2({caches:e}).delete(o))},clear(){return r.clear().catch(()=>q2({caches:e}).clear())}}}function Bme(){return{get(t,e,r={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,r.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}vk.createFallbackableCache=q2;vk.createNullCache=Bme});var Pme=_((QWt,Dme)=>{Dme.exports=vme()});var Sme=_(LH=>{"use strict";Object.defineProperty(LH,"__esModule",{value:!0});function wdt(t={serializable:!0}){let e={};return{get(r,o,a={miss:()=>Promise.resolve()}){let n=JSON.stringify(r);if(n in e)return Promise.resolve(t.serializable?JSON.parse(e[n]):e[n]);let u=o(),A=a&&a.miss||(()=>Promise.resolve());return u.then(p=>A(p)).then(()=>u)},set(r,o){return e[JSON.stringify(r)]=t.serializable?JSON.stringify(o):o,Promise.resolve(o)},delete(r){return delete e[JSON.stringify(r)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}LH.createInMemoryCache=wdt});var bme=_((TWt,xme)=>{xme.exports=Sme()});var Qme=_(Zc=>{"use strict";Object.defineProperty(Zc,"__esModule",{value:!0});function Idt(t,e,r){let o={"x-algolia-api-key":r,"x-algolia-application-id":e};return{headers(){return t===MH.WithinHeaders?o:{}},queryParameters(){return t===MH.WithinQueryParameters?o:{}}}}function Bdt(t){let e=0,r=()=>(e++,new Promise(o=>{setTimeout(()=>{o(t(r))},Math.min(100*e,1e3))}));return t(r)}function kme(t,e=(r,o)=>Promise.resolve()){return Object.assign(t,{wait(r){return kme(t.then(o=>Promise.all([e(o,r),o])).then(o=>o[1]))}})}function vdt(t){let e=t.length-1;for(e;e>0;e--){let r=Math.floor(Math.random()*(e+1)),o=t[e];t[e]=t[r],t[r]=o}return t}function Ddt(t,e){return e&&Object.keys(e).forEach(r=>{t[r]=e[r](t)}),t}function Pdt(t,...e){let r=0;return t.replace(/%s/g,()=>encodeURIComponent(e[r++]))}var Sdt="4.14.2",xdt=t=>()=>t.transporter.requester.destroy(),MH={WithinQueryParameters:0,WithinHeaders:1};Zc.AuthMode=MH;Zc.addMethods=Ddt;Zc.createAuth=Idt;Zc.createRetryablePromise=Bdt;Zc.createWaitablePromise=kme;Zc.destroy=xdt;Zc.encode=Pdt;Zc.shuffle=vdt;Zc.version=Sdt});var G2=_((NWt,Fme)=>{Fme.exports=Qme()});var Tme=_(OH=>{"use strict";Object.defineProperty(OH,"__esModule",{value:!0});var bdt={Delete:"DELETE",Get:"GET",Post:"POST",Put:"PUT"};OH.MethodEnum=bdt});var Y2=_((MWt,Rme)=>{Rme.exports=Tme()});var Jme=_(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});var Lme=Y2();function UH(t,e){let r=t||{},o=r.data||{};return Object.keys(r).forEach(a=>{["timeout","headers","queryParameters","data","cacheable"].indexOf(a)===-1&&(o[a]=r[a])}),{data:Object.entries(o).length>0?o:void 0,timeout:r.timeout||e,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var W2={Read:1,Write:2,Any:3},xC={Up:1,Down:2,Timeouted:3},Mme=2*60*1e3;function HH(t,e=xC.Up){return{...t,status:e,lastUpdate:Date.now()}}function Ome(t){return t.status===xC.Up||Date.now()-t.lastUpdate>Mme}function Ume(t){return t.status===xC.Timeouted&&Date.now()-t.lastUpdate<=Mme}function jH(t){return typeof t=="string"?{protocol:"https",url:t,accept:W2.Any}:{protocol:t.protocol||"https",url:t.url,accept:t.accept||W2.Any}}function kdt(t,e){return Promise.all(e.map(r=>t.get(r,()=>Promise.resolve(HH(r))))).then(r=>{let o=r.filter(A=>Ome(A)),a=r.filter(A=>Ume(A)),n=[...o,...a],u=n.length>0?n.map(A=>jH(A)):e;return{getTimeout(A,p){return(a.length===0&&A===0?1:a.length+3+A)*p},statelessHosts:u}})}var Qdt=({isTimedOut:t,status:e})=>!t&&~~e===0,Fdt=t=>{let e=t.status;return t.isTimedOut||Qdt(t)||~~(e/100)!==2&&~~(e/100)!==4},Tdt=({status:t})=>~~(t/100)===2,Rdt=(t,e)=>Fdt(t)?e.onRetry(t):Tdt(t)?e.onSuccess(t):e.onFail(t);function Nme(t,e,r,o){let a=[],n=Gme(r,o),u=Yme(t,o),A=r.method,p=r.method!==Lme.MethodEnum.Get?{}:{...r.data,...o.data},h={"x-algolia-agent":t.userAgent.value,...t.queryParameters,...p,...o.queryParameters},E=0,I=(v,b)=>{let C=v.pop();if(C===void 0)throw Kme(_H(a));let T={data:n,headers:u,method:A,url:jme(C,r.path,h),connectTimeout:b(E,t.timeouts.connect),responseTimeout:b(E,o.timeout)},L=J=>{let te={request:T,response:J,host:C,triesLeft:v.length};return a.push(te),te},U={onSuccess:J=>_me(J),onRetry(J){let te=L(J);return J.isTimedOut&&E++,Promise.all([t.logger.info("Retryable failure",qH(te)),t.hostsCache.set(C,HH(C,J.isTimedOut?xC.Timeouted:xC.Down))]).then(()=>I(v,b))},onFail(J){throw L(J),Hme(J,_H(a))}};return t.requester.send(T).then(J=>Rdt(J,U))};return kdt(t.hostsCache,e).then(v=>I([...v.statelessHosts].reverse(),v.getTimeout))}function Ndt(t){let{hostsCache:e,logger:r,requester:o,requestsCache:a,responsesCache:n,timeouts:u,userAgent:A,hosts:p,queryParameters:h,headers:E}=t,I={hostsCache:e,logger:r,requester:o,requestsCache:a,responsesCache:n,timeouts:u,userAgent:A,headers:E,queryParameters:h,hosts:p.map(v=>jH(v)),read(v,b){let C=UH(b,I.timeouts.read),T=()=>Nme(I,I.hosts.filter(J=>(J.accept&W2.Read)!==0),v,C);if((C.cacheable!==void 0?C.cacheable:v.cacheable)!==!0)return T();let U={request:v,mappedRequestOptions:C,transporter:{queryParameters:I.queryParameters,headers:I.headers}};return I.responsesCache.get(U,()=>I.requestsCache.get(U,()=>I.requestsCache.set(U,T()).then(J=>Promise.all([I.requestsCache.delete(U),J]),J=>Promise.all([I.requestsCache.delete(U),Promise.reject(J)])).then(([J,te])=>te)),{miss:J=>I.responsesCache.set(U,J)})},write(v,b){return Nme(I,I.hosts.filter(C=>(C.accept&W2.Write)!==0),v,UH(b,I.timeouts.write))}};return I}function Ldt(t){let e={value:`Algolia for JavaScript (${t})`,add(r){let o=`; ${r.segment}${r.version!==void 0?` (${r.version})`:""}`;return e.value.indexOf(o)===-1&&(e.value=`${e.value}${o}`),e}};return e}function _me(t){try{return JSON.parse(t.content)}catch(e){throw Vme(e.message,t)}}function Hme({content:t,status:e},r){let o=t;try{o=JSON.parse(t).message}catch{}return Wme(o,e,r)}function Mdt(t,...e){let r=0;return t.replace(/%s/g,()=>encodeURIComponent(e[r++]))}function jme(t,e,r){let o=qme(r),a=`${t.protocol}://${t.url}/${e.charAt(0)==="/"?e.substr(1):e}`;return o.length&&(a+=`?${o}`),a}function qme(t){let e=r=>Object.prototype.toString.call(r)==="[object Object]"||Object.prototype.toString.call(r)==="[object Array]";return Object.keys(t).map(r=>Mdt("%s=%s",r,e(t[r])?JSON.stringify(t[r]):t[r])).join("&")}function Gme(t,e){if(t.method===Lme.MethodEnum.Get||t.data===void 0&&e.data===void 0)return;let r=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(r)}function Yme(t,e){let r={...t.headers,...e.headers},o={};return Object.keys(r).forEach(a=>{let n=r[a];o[a.toLowerCase()]=n}),o}function _H(t){return t.map(e=>qH(e))}function qH(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function Wme(t,e,r){return{name:"ApiError",message:t,status:e,transporterStackTrace:r}}function Vme(t,e){return{name:"DeserializationError",message:t,response:e}}function Kme(t){return{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:t}}Fi.CallEnum=W2;Fi.HostStatusEnum=xC;Fi.createApiError=Wme;Fi.createDeserializationError=Vme;Fi.createMappedRequestOptions=UH;Fi.createRetryError=Kme;Fi.createStatefulHost=HH;Fi.createStatelessHost=jH;Fi.createTransporter=Ndt;Fi.createUserAgent=Ldt;Fi.deserializeFailure=Hme;Fi.deserializeSuccess=_me;Fi.isStatefulHostTimeouted=Ume;Fi.isStatefulHostUp=Ome;Fi.serializeData=Gme;Fi.serializeHeaders=Yme;Fi.serializeQueryParameters=qme;Fi.serializeUrl=jme;Fi.stackFrameWithoutCredentials=qH;Fi.stackTraceWithoutCredentials=_H});var V2=_((UWt,zme)=>{zme.exports=Jme()});var Xme=_(d0=>{"use strict";Object.defineProperty(d0,"__esModule",{value:!0});var bC=G2(),Odt=V2(),K2=Y2(),Udt=t=>{let e=t.region||"us",r=bC.createAuth(bC.AuthMode.WithinHeaders,t.appId,t.apiKey),o=Odt.createTransporter({hosts:[{url:`analytics.${e}.algolia.com`}],...t,headers:{...r.headers(),"content-type":"application/json",...t.headers},queryParameters:{...r.queryParameters(),...t.queryParameters}}),a=t.appId;return bC.addMethods({appId:a,transporter:o},t.methods)},_dt=t=>(e,r)=>t.transporter.write({method:K2.MethodEnum.Post,path:"2/abtests",data:e},r),Hdt=t=>(e,r)=>t.transporter.write({method:K2.MethodEnum.Delete,path:bC.encode("2/abtests/%s",e)},r),jdt=t=>(e,r)=>t.transporter.read({method:K2.MethodEnum.Get,path:bC.encode("2/abtests/%s",e)},r),qdt=t=>e=>t.transporter.read({method:K2.MethodEnum.Get,path:"2/abtests"},e),Gdt=t=>(e,r)=>t.transporter.write({method:K2.MethodEnum.Post,path:bC.encode("2/abtests/%s/stop",e)},r);d0.addABTest=_dt;d0.createAnalyticsClient=Udt;d0.deleteABTest=Hdt;d0.getABTest=jdt;d0.getABTests=qdt;d0.stopABTest=Gdt});var $me=_((HWt,Zme)=>{Zme.exports=Xme()});var tye=_(J2=>{"use strict";Object.defineProperty(J2,"__esModule",{value:!0});var GH=G2(),Ydt=V2(),eye=Y2(),Wdt=t=>{let e=t.region||"us",r=GH.createAuth(GH.AuthMode.WithinHeaders,t.appId,t.apiKey),o=Ydt.createTransporter({hosts:[{url:`personalization.${e}.algolia.com`}],...t,headers:{...r.headers(),"content-type":"application/json",...t.headers},queryParameters:{...r.queryParameters(),...t.queryParameters}});return GH.addMethods({appId:t.appId,transporter:o},t.methods)},Vdt=t=>e=>t.transporter.read({method:eye.MethodEnum.Get,path:"1/strategies/personalization"},e),Kdt=t=>(e,r)=>t.transporter.write({method:eye.MethodEnum.Post,path:"1/strategies/personalization",data:e},r);J2.createPersonalizationClient=Wdt;J2.getPersonalizationStrategy=Vdt;J2.setPersonalizationStrategy=Kdt});var nye=_((qWt,rye)=>{rye.exports=tye()});var mye=_(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});var Gt=G2(),Na=V2(),Ir=Y2(),Jdt=Be("crypto");function Dk(t){let e=r=>t.request(r).then(o=>{if(t.batch!==void 0&&t.batch(o.hits),!t.shouldStop(o))return o.cursor?e({cursor:o.cursor}):e({page:(r.page||0)+1})});return e({})}var zdt=t=>{let e=t.appId,r=Gt.createAuth(t.authMode!==void 0?t.authMode:Gt.AuthMode.WithinHeaders,e,t.apiKey),o=Na.createTransporter({hosts:[{url:`${e}-dsn.algolia.net`,accept:Na.CallEnum.Read},{url:`${e}.algolia.net`,accept:Na.CallEnum.Write}].concat(Gt.shuffle([{url:`${e}-1.algolianet.com`},{url:`${e}-2.algolianet.com`},{url:`${e}-3.algolianet.com`}])),...t,headers:{...r.headers(),"content-type":"application/x-www-form-urlencoded",...t.headers},queryParameters:{...r.queryParameters(),...t.queryParameters}}),a={transporter:o,appId:e,addAlgoliaAgent(n,u){o.userAgent.add({segment:n,version:u})},clearCache(){return Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then(()=>{})}};return Gt.addMethods(a,t.methods)};function iye(){return{name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}}function sye(){return{name:"ObjectNotFoundError",message:"Object not found."}}function oye(){return{name:"ValidUntilNotFoundError",message:"ValidUntil not found in given secured api key."}}var Xdt=t=>(e,r)=>{let{queryParameters:o,...a}=r||{},n={acl:e,...o!==void 0?{queryParameters:o}:{}},u=(A,p)=>Gt.createRetryablePromise(h=>z2(t)(A.key,p).catch(E=>{if(E.status!==404)throw E;return h()}));return Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:"1/keys",data:n},a),u)},Zdt=t=>(e,r,o)=>{let a=Na.createMappedRequestOptions(o);return a.queryParameters["X-Algolia-User-ID"]=e,t.transporter.write({method:Ir.MethodEnum.Post,path:"1/clusters/mapping",data:{cluster:r}},a)},$dt=t=>(e,r,o)=>t.transporter.write({method:Ir.MethodEnum.Post,path:"1/clusters/mapping/batch",data:{users:e,cluster:r}},o),emt=t=>(e,r)=>Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},r),(o,a)=>kC(t)(o.taskID,a)),Pk=t=>(e,r,o)=>{let a=(n,u)=>X2(t)(e,{methods:{waitTask:Zi}}).waitTask(n.taskID,u);return Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/operation",e),data:{operation:"copy",destination:r}},o),a)},tmt=t=>(e,r,o)=>Pk(t)(e,r,{...o,scope:[xk.Rules]}),rmt=t=>(e,r,o)=>Pk(t)(e,r,{...o,scope:[xk.Settings]}),nmt=t=>(e,r,o)=>Pk(t)(e,r,{...o,scope:[xk.Synonyms]}),imt=t=>(e,r)=>e.method===Ir.MethodEnum.Get?t.transporter.read(e,r):t.transporter.write(e,r),smt=t=>(e,r)=>{let o=(a,n)=>Gt.createRetryablePromise(u=>z2(t)(e,n).then(u).catch(A=>{if(A.status!==404)throw A}));return Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Delete,path:Gt.encode("1/keys/%s",e)},r),o)},omt=t=>(e,r,o)=>{let a=r.map(n=>({action:"deleteEntry",body:{objectID:n}}));return Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!1,requests:a}},o),(n,u)=>kC(t)(n.taskID,u))},amt=()=>(t,e)=>{let r=Na.serializeQueryParameters(e),o=Jdt.createHmac("sha256",t).update(r).digest("hex");return Buffer.from(o+r).toString("base64")},z2=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Get,path:Gt.encode("1/keys/%s",e)},r),aye=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Get,path:Gt.encode("1/task/%s",e.toString())},r),lmt=t=>e=>t.transporter.read({method:Ir.MethodEnum.Get,path:"/1/dictionaries/*/settings"},e),cmt=t=>e=>t.transporter.read({method:Ir.MethodEnum.Get,path:"1/logs"},e),umt=()=>t=>{let e=Buffer.from(t,"base64").toString("ascii"),r=/validUntil=(\d+)/,o=e.match(r);if(o===null)throw oye();return parseInt(o[1],10)-Math.round(new Date().getTime()/1e3)},Amt=t=>e=>t.transporter.read({method:Ir.MethodEnum.Get,path:"1/clusters/mapping/top"},e),fmt=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Get,path:Gt.encode("1/clusters/mapping/%s",e)},r),pmt=t=>e=>{let{retrieveMappings:r,...o}=e||{};return r===!0&&(o.getClusters=!0),t.transporter.read({method:Ir.MethodEnum.Get,path:"1/clusters/mapping/pending"},o)},X2=t=>(e,r={})=>{let o={transporter:t.transporter,appId:t.appId,indexName:e};return Gt.addMethods(o,r.methods)},hmt=t=>e=>t.transporter.read({method:Ir.MethodEnum.Get,path:"1/keys"},e),gmt=t=>e=>t.transporter.read({method:Ir.MethodEnum.Get,path:"1/clusters"},e),dmt=t=>e=>t.transporter.read({method:Ir.MethodEnum.Get,path:"1/indexes"},e),mmt=t=>e=>t.transporter.read({method:Ir.MethodEnum.Get,path:"1/clusters/mapping"},e),ymt=t=>(e,r,o)=>{let a=(n,u)=>X2(t)(e,{methods:{waitTask:Zi}}).waitTask(n.taskID,u);return Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/operation",e),data:{operation:"move",destination:r}},o),a)},Emt=t=>(e,r)=>{let o=(a,n)=>Promise.all(Object.keys(a.taskID).map(u=>X2(t)(u,{methods:{waitTask:Zi}}).waitTask(a.taskID[u],n)));return Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:"1/indexes/*/batch",data:{requests:e}},r),o)},Cmt=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Post,path:"1/indexes/*/objects",data:{requests:e}},r),wmt=t=>(e,r)=>{let o=e.map(a=>({...a,params:Na.serializeQueryParameters(a.params||{})}));return t.transporter.read({method:Ir.MethodEnum.Post,path:"1/indexes/*/queries",data:{requests:o},cacheable:!0},r)},Imt=t=>(e,r)=>Promise.all(e.map(o=>{let{facetName:a,facetQuery:n,...u}=o.params;return X2(t)(o.indexName,{methods:{searchForFacetValues:hye}}).searchForFacetValues(a,n,{...r,...u})})),Bmt=t=>(e,r)=>{let o=Na.createMappedRequestOptions(r);return o.queryParameters["X-Algolia-User-ID"]=e,t.transporter.write({method:Ir.MethodEnum.Delete,path:"1/clusters/mapping"},o)},vmt=t=>(e,r,o)=>{let a=r.map(n=>({action:"addEntry",body:n}));return Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!0,requests:a}},o),(n,u)=>kC(t)(n.taskID,u))},Dmt=t=>(e,r)=>{let o=(a,n)=>Gt.createRetryablePromise(u=>z2(t)(e,n).catch(A=>{if(A.status!==404)throw A;return u()}));return Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("1/keys/%s/restore",e)},r),o)},Pmt=t=>(e,r,o)=>{let a=r.map(n=>({action:"addEntry",body:n}));return Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("/1/dictionaries/%s/batch",e),data:{clearExistingDictionaryEntries:!1,requests:a}},o),(n,u)=>kC(t)(n.taskID,u))},Smt=t=>(e,r,o)=>t.transporter.read({method:Ir.MethodEnum.Post,path:Gt.encode("/1/dictionaries/%s/search",e),data:{query:r},cacheable:!0},o),xmt=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Post,path:"1/clusters/mapping/search",data:{query:e}},r),bmt=t=>(e,r)=>Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Put,path:"/1/dictionaries/*/settings",data:e},r),(o,a)=>kC(t)(o.taskID,a)),kmt=t=>(e,r)=>{let o=Object.assign({},r),{queryParameters:a,...n}=r||{},u=a?{queryParameters:a}:{},A=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"],p=E=>Object.keys(o).filter(I=>A.indexOf(I)!==-1).every(I=>E[I]===o[I]),h=(E,I)=>Gt.createRetryablePromise(v=>z2(t)(e,I).then(b=>p(b)?Promise.resolve():v()));return Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Put,path:Gt.encode("1/keys/%s",e),data:u},n),h)},kC=t=>(e,r)=>Gt.createRetryablePromise(o=>aye(t)(e,r).then(a=>a.status!=="published"?o():void 0)),lye=t=>(e,r)=>{let o=(a,n)=>Zi(t)(a.taskID,n);return Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/batch",t.indexName),data:{requests:e}},r),o)},Qmt=t=>e=>Dk({shouldStop:r=>r.cursor===void 0,...e,request:r=>t.transporter.read({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/browse",t.indexName),data:r},e)}),Fmt=t=>e=>{let r={hitsPerPage:1e3,...e};return Dk({shouldStop:o=>o.hits.length({...a,hits:a.hits.map(n=>(delete n._highlightResult,n))}))}})},Tmt=t=>e=>{let r={hitsPerPage:1e3,...e};return Dk({shouldStop:o=>o.hits.length({...a,hits:a.hits.map(n=>(delete n._highlightResult,n))}))}})},Sk=t=>(e,r,o)=>{let{batchSize:a,...n}=o||{},u={taskIDs:[],objectIDs:[]},A=(p=0)=>{let h=[],E;for(E=p;E({action:r,body:I})),n).then(I=>(u.objectIDs=u.objectIDs.concat(I.objectIDs),u.taskIDs.push(I.taskID),E++,A(E)))};return Gt.createWaitablePromise(A(),(p,h)=>Promise.all(p.taskIDs.map(E=>Zi(t)(E,h))))},Rmt=t=>e=>Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/clear",t.indexName)},e),(r,o)=>Zi(t)(r.taskID,o)),Nmt=t=>e=>{let{forwardToReplicas:r,...o}=e||{},a=Na.createMappedRequestOptions(o);return r&&(a.queryParameters.forwardToReplicas=1),Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/rules/clear",t.indexName)},a),(n,u)=>Zi(t)(n.taskID,u))},Lmt=t=>e=>{let{forwardToReplicas:r,...o}=e||{},a=Na.createMappedRequestOptions(o);return r&&(a.queryParameters.forwardToReplicas=1),Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/synonyms/clear",t.indexName)},a),(n,u)=>Zi(t)(n.taskID,u))},Mmt=t=>(e,r)=>Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/deleteByQuery",t.indexName),data:e},r),(o,a)=>Zi(t)(o.taskID,a)),Omt=t=>e=>Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Delete,path:Gt.encode("1/indexes/%s",t.indexName)},e),(r,o)=>Zi(t)(r.taskID,o)),Umt=t=>(e,r)=>Gt.createWaitablePromise(cye(t)([e],r).then(o=>({taskID:o.taskIDs[0]})),(o,a)=>Zi(t)(o.taskID,a)),cye=t=>(e,r)=>{let o=e.map(a=>({objectID:a}));return Sk(t)(o,rm.DeleteObject,r)},_mt=t=>(e,r)=>{let{forwardToReplicas:o,...a}=r||{},n=Na.createMappedRequestOptions(a);return o&&(n.queryParameters.forwardToReplicas=1),Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Delete,path:Gt.encode("1/indexes/%s/rules/%s",t.indexName,e)},n),(u,A)=>Zi(t)(u.taskID,A))},Hmt=t=>(e,r)=>{let{forwardToReplicas:o,...a}=r||{},n=Na.createMappedRequestOptions(a);return o&&(n.queryParameters.forwardToReplicas=1),Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Delete,path:Gt.encode("1/indexes/%s/synonyms/%s",t.indexName,e)},n),(u,A)=>Zi(t)(u.taskID,A))},jmt=t=>e=>uye(t)(e).then(()=>!0).catch(r=>{if(r.status!==404)throw r;return!1}),qmt=t=>(e,r,o)=>t.transporter.read({method:Ir.MethodEnum.Post,path:Gt.encode("1/answers/%s/prediction",t.indexName),data:{query:e,queryLanguages:r},cacheable:!0},o),Gmt=t=>(e,r)=>{let{query:o,paginate:a,...n}=r||{},u=0,A=()=>pye(t)(o||"",{...n,page:u}).then(p=>{for(let[h,E]of Object.entries(p.hits))if(e(E))return{object:E,position:parseInt(h,10),page:u};if(u++,a===!1||u>=p.nbPages)throw sye();return A()});return A()},Ymt=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Get,path:Gt.encode("1/indexes/%s/%s",t.indexName,e)},r),Wmt=()=>(t,e)=>{for(let[r,o]of Object.entries(t.hits))if(o.objectID===e)return parseInt(r,10);return-1},Vmt=t=>(e,r)=>{let{attributesToRetrieve:o,...a}=r||{},n=e.map(u=>({indexName:t.indexName,objectID:u,...o?{attributesToRetrieve:o}:{}}));return t.transporter.read({method:Ir.MethodEnum.Post,path:"1/indexes/*/objects",data:{requests:n}},a)},Kmt=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Get,path:Gt.encode("1/indexes/%s/rules/%s",t.indexName,e)},r),uye=t=>e=>t.transporter.read({method:Ir.MethodEnum.Get,path:Gt.encode("1/indexes/%s/settings",t.indexName),data:{getVersion:2}},e),Jmt=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Get,path:Gt.encode("1/indexes/%s/synonyms/%s",t.indexName,e)},r),Aye=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Get,path:Gt.encode("1/indexes/%s/task/%s",t.indexName,e.toString())},r),zmt=t=>(e,r)=>Gt.createWaitablePromise(fye(t)([e],r).then(o=>({objectID:o.objectIDs[0],taskID:o.taskIDs[0]})),(o,a)=>Zi(t)(o.taskID,a)),fye=t=>(e,r)=>{let{createIfNotExists:o,...a}=r||{},n=o?rm.PartialUpdateObject:rm.PartialUpdateObjectNoCreate;return Sk(t)(e,n,a)},Xmt=t=>(e,r)=>{let{safe:o,autoGenerateObjectIDIfNotExist:a,batchSize:n,...u}=r||{},A=(C,T,L,U)=>Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/operation",C),data:{operation:L,destination:T}},U),(J,te)=>Zi(t)(J.taskID,te)),p=Math.random().toString(36).substring(7),h=`${t.indexName}_tmp_${p}`,E=YH({appId:t.appId,transporter:t.transporter,indexName:h}),I=[],v=A(t.indexName,h,"copy",{...u,scope:["settings","synonyms","rules"]});I.push(v);let b=(o?v.wait(u):v).then(()=>{let C=E(e,{...u,autoGenerateObjectIDIfNotExist:a,batchSize:n});return I.push(C),o?C.wait(u):C}).then(()=>{let C=A(h,t.indexName,"move",u);return I.push(C),o?C.wait(u):C}).then(()=>Promise.all(I)).then(([C,T,L])=>({objectIDs:T.objectIDs,taskIDs:[C.taskID,...T.taskIDs,L.taskID]}));return Gt.createWaitablePromise(b,(C,T)=>Promise.all(I.map(L=>L.wait(T))))},Zmt=t=>(e,r)=>WH(t)(e,{...r,clearExistingRules:!0}),$mt=t=>(e,r)=>VH(t)(e,{...r,clearExistingSynonyms:!0}),eyt=t=>(e,r)=>Gt.createWaitablePromise(YH(t)([e],r).then(o=>({objectID:o.objectIDs[0],taskID:o.taskIDs[0]})),(o,a)=>Zi(t)(o.taskID,a)),YH=t=>(e,r)=>{let{autoGenerateObjectIDIfNotExist:o,...a}=r||{},n=o?rm.AddObject:rm.UpdateObject;if(n===rm.UpdateObject){for(let u of e)if(u.objectID===void 0)return Gt.createWaitablePromise(Promise.reject(iye()))}return Sk(t)(e,n,a)},tyt=t=>(e,r)=>WH(t)([e],r),WH=t=>(e,r)=>{let{forwardToReplicas:o,clearExistingRules:a,...n}=r||{},u=Na.createMappedRequestOptions(n);return o&&(u.queryParameters.forwardToReplicas=1),a&&(u.queryParameters.clearExistingRules=1),Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/rules/batch",t.indexName),data:e},u),(A,p)=>Zi(t)(A.taskID,p))},ryt=t=>(e,r)=>VH(t)([e],r),VH=t=>(e,r)=>{let{forwardToReplicas:o,clearExistingSynonyms:a,replaceExistingSynonyms:n,...u}=r||{},A=Na.createMappedRequestOptions(u);return o&&(A.queryParameters.forwardToReplicas=1),(n||a)&&(A.queryParameters.replaceExistingSynonyms=1),Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/synonyms/batch",t.indexName),data:e},A),(p,h)=>Zi(t)(p.taskID,h))},pye=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/query",t.indexName),data:{query:e},cacheable:!0},r),hye=t=>(e,r,o)=>t.transporter.read({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/facets/%s/query",t.indexName,e),data:{facetQuery:r},cacheable:!0},o),gye=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/rules/search",t.indexName),data:{query:e}},r),dye=t=>(e,r)=>t.transporter.read({method:Ir.MethodEnum.Post,path:Gt.encode("1/indexes/%s/synonyms/search",t.indexName),data:{query:e}},r),nyt=t=>(e,r)=>{let{forwardToReplicas:o,...a}=r||{},n=Na.createMappedRequestOptions(a);return o&&(n.queryParameters.forwardToReplicas=1),Gt.createWaitablePromise(t.transporter.write({method:Ir.MethodEnum.Put,path:Gt.encode("1/indexes/%s/settings",t.indexName),data:e},n),(u,A)=>Zi(t)(u.taskID,A))},Zi=t=>(e,r)=>Gt.createRetryablePromise(o=>Aye(t)(e,r).then(a=>a.status!=="published"?o():void 0)),iyt={AddObject:"addObject",Analytics:"analytics",Browser:"browse",DeleteIndex:"deleteIndex",DeleteObject:"deleteObject",EditSettings:"editSettings",ListIndexes:"listIndexes",Logs:"logs",Personalization:"personalization",Recommendation:"recommendation",Search:"search",SeeUnretrievableAttributes:"seeUnretrievableAttributes",Settings:"settings",Usage:"usage"},rm={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},xk={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},syt={None:"none",StopIfEnoughMatches:"stopIfEnoughMatches"},oyt={Synonym:"synonym",OneWaySynonym:"oneWaySynonym",AltCorrection1:"altCorrection1",AltCorrection2:"altCorrection2",Placeholder:"placeholder"};Ft.ApiKeyACLEnum=iyt;Ft.BatchActionEnum=rm;Ft.ScopeEnum=xk;Ft.StrategyEnum=syt;Ft.SynonymEnum=oyt;Ft.addApiKey=Xdt;Ft.assignUserID=Zdt;Ft.assignUserIDs=$dt;Ft.batch=lye;Ft.browseObjects=Qmt;Ft.browseRules=Fmt;Ft.browseSynonyms=Tmt;Ft.chunkedBatch=Sk;Ft.clearDictionaryEntries=emt;Ft.clearObjects=Rmt;Ft.clearRules=Nmt;Ft.clearSynonyms=Lmt;Ft.copyIndex=Pk;Ft.copyRules=tmt;Ft.copySettings=rmt;Ft.copySynonyms=nmt;Ft.createBrowsablePromise=Dk;Ft.createMissingObjectIDError=iye;Ft.createObjectNotFoundError=sye;Ft.createSearchClient=zdt;Ft.createValidUntilNotFoundError=oye;Ft.customRequest=imt;Ft.deleteApiKey=smt;Ft.deleteBy=Mmt;Ft.deleteDictionaryEntries=omt;Ft.deleteIndex=Omt;Ft.deleteObject=Umt;Ft.deleteObjects=cye;Ft.deleteRule=_mt;Ft.deleteSynonym=Hmt;Ft.exists=jmt;Ft.findAnswers=qmt;Ft.findObject=Gmt;Ft.generateSecuredApiKey=amt;Ft.getApiKey=z2;Ft.getAppTask=aye;Ft.getDictionarySettings=lmt;Ft.getLogs=cmt;Ft.getObject=Ymt;Ft.getObjectPosition=Wmt;Ft.getObjects=Vmt;Ft.getRule=Kmt;Ft.getSecuredApiKeyRemainingValidity=umt;Ft.getSettings=uye;Ft.getSynonym=Jmt;Ft.getTask=Aye;Ft.getTopUserIDs=Amt;Ft.getUserID=fmt;Ft.hasPendingMappings=pmt;Ft.initIndex=X2;Ft.listApiKeys=hmt;Ft.listClusters=gmt;Ft.listIndices=dmt;Ft.listUserIDs=mmt;Ft.moveIndex=ymt;Ft.multipleBatch=Emt;Ft.multipleGetObjects=Cmt;Ft.multipleQueries=wmt;Ft.multipleSearchForFacetValues=Imt;Ft.partialUpdateObject=zmt;Ft.partialUpdateObjects=fye;Ft.removeUserID=Bmt;Ft.replaceAllObjects=Xmt;Ft.replaceAllRules=Zmt;Ft.replaceAllSynonyms=$mt;Ft.replaceDictionaryEntries=vmt;Ft.restoreApiKey=Dmt;Ft.saveDictionaryEntries=Pmt;Ft.saveObject=eyt;Ft.saveObjects=YH;Ft.saveRule=tyt;Ft.saveRules=WH;Ft.saveSynonym=ryt;Ft.saveSynonyms=VH;Ft.search=pye;Ft.searchDictionaryEntries=Smt;Ft.searchForFacetValues=hye;Ft.searchRules=gye;Ft.searchSynonyms=dye;Ft.searchUserIDs=xmt;Ft.setDictionarySettings=bmt;Ft.setSettings=nyt;Ft.updateApiKey=kmt;Ft.waitAppTask=kC;Ft.waitTask=Zi});var Eye=_((YWt,yye)=>{yye.exports=mye()});var Cye=_(bk=>{"use strict";Object.defineProperty(bk,"__esModule",{value:!0});function ayt(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var lyt={Debug:1,Info:2,Error:3};bk.LogLevelEnum=lyt;bk.createNullLogger=ayt});var Iye=_((VWt,wye)=>{wye.exports=Cye()});var Pye=_(KH=>{"use strict";Object.defineProperty(KH,"__esModule",{value:!0});var Bye=Be("http"),vye=Be("https"),cyt=Be("url"),Dye={keepAlive:!0},uyt=new Bye.Agent(Dye),Ayt=new vye.Agent(Dye);function fyt({agent:t,httpAgent:e,httpsAgent:r,requesterOptions:o={}}={}){let a=e||t||uyt,n=r||t||Ayt;return{send(u){return new Promise(A=>{let p=cyt.parse(u.url),h=p.query===null?p.pathname:`${p.pathname}?${p.query}`,E={...o,agent:p.protocol==="https:"?n:a,hostname:p.hostname,path:h,method:u.method,headers:{...o&&o.headers?o.headers:{},...u.headers},...p.port!==void 0?{port:p.port||""}:{}},I=(p.protocol==="https:"?vye:Bye).request(E,T=>{let L=[];T.on("data",U=>{L=L.concat(U)}),T.on("end",()=>{clearTimeout(b),clearTimeout(C),A({status:T.statusCode||0,content:Buffer.concat(L).toString(),isTimedOut:!1})})}),v=(T,L)=>setTimeout(()=>{I.abort(),A({status:0,content:L,isTimedOut:!0})},T*1e3),b=v(u.connectTimeout,"Connection timeout"),C;I.on("error",T=>{clearTimeout(b),clearTimeout(C),A({status:0,content:T.message,isTimedOut:!1})}),I.once("response",()=>{clearTimeout(b),C=v(u.responseTimeout,"Socket timeout")}),u.data!==void 0&&I.write(u.data),I.end()})},destroy(){return a.destroy(),n.destroy(),Promise.resolve()}}}KH.createNodeHttpRequester=fyt});var xye=_((JWt,Sye)=>{Sye.exports=Pye()});var Fye=_((zWt,Qye)=>{"use strict";var bye=Pme(),pyt=bme(),QC=$me(),zH=G2(),JH=nye(),Ut=Eye(),hyt=Iye(),gyt=xye(),dyt=V2();function kye(t,e,r){let o={appId:t,apiKey:e,timeouts:{connect:2,read:5,write:30},requester:gyt.createNodeHttpRequester(),logger:hyt.createNullLogger(),responsesCache:bye.createNullCache(),requestsCache:bye.createNullCache(),hostsCache:pyt.createInMemoryCache(),userAgent:dyt.createUserAgent(zH.version).add({segment:"Node.js",version:process.versions.node})},a={...o,...r},n=()=>u=>JH.createPersonalizationClient({...o,...u,methods:{getPersonalizationStrategy:JH.getPersonalizationStrategy,setPersonalizationStrategy:JH.setPersonalizationStrategy}});return Ut.createSearchClient({...a,methods:{search:Ut.multipleQueries,searchForFacetValues:Ut.multipleSearchForFacetValues,multipleBatch:Ut.multipleBatch,multipleGetObjects:Ut.multipleGetObjects,multipleQueries:Ut.multipleQueries,copyIndex:Ut.copyIndex,copySettings:Ut.copySettings,copyRules:Ut.copyRules,copySynonyms:Ut.copySynonyms,moveIndex:Ut.moveIndex,listIndices:Ut.listIndices,getLogs:Ut.getLogs,listClusters:Ut.listClusters,multipleSearchForFacetValues:Ut.multipleSearchForFacetValues,getApiKey:Ut.getApiKey,addApiKey:Ut.addApiKey,listApiKeys:Ut.listApiKeys,updateApiKey:Ut.updateApiKey,deleteApiKey:Ut.deleteApiKey,restoreApiKey:Ut.restoreApiKey,assignUserID:Ut.assignUserID,assignUserIDs:Ut.assignUserIDs,getUserID:Ut.getUserID,searchUserIDs:Ut.searchUserIDs,listUserIDs:Ut.listUserIDs,getTopUserIDs:Ut.getTopUserIDs,removeUserID:Ut.removeUserID,hasPendingMappings:Ut.hasPendingMappings,generateSecuredApiKey:Ut.generateSecuredApiKey,getSecuredApiKeyRemainingValidity:Ut.getSecuredApiKeyRemainingValidity,destroy:zH.destroy,clearDictionaryEntries:Ut.clearDictionaryEntries,deleteDictionaryEntries:Ut.deleteDictionaryEntries,getDictionarySettings:Ut.getDictionarySettings,getAppTask:Ut.getAppTask,replaceDictionaryEntries:Ut.replaceDictionaryEntries,saveDictionaryEntries:Ut.saveDictionaryEntries,searchDictionaryEntries:Ut.searchDictionaryEntries,setDictionarySettings:Ut.setDictionarySettings,waitAppTask:Ut.waitAppTask,customRequest:Ut.customRequest,initIndex:u=>A=>Ut.initIndex(u)(A,{methods:{batch:Ut.batch,delete:Ut.deleteIndex,findAnswers:Ut.findAnswers,getObject:Ut.getObject,getObjects:Ut.getObjects,saveObject:Ut.saveObject,saveObjects:Ut.saveObjects,search:Ut.search,searchForFacetValues:Ut.searchForFacetValues,waitTask:Ut.waitTask,setSettings:Ut.setSettings,getSettings:Ut.getSettings,partialUpdateObject:Ut.partialUpdateObject,partialUpdateObjects:Ut.partialUpdateObjects,deleteObject:Ut.deleteObject,deleteObjects:Ut.deleteObjects,deleteBy:Ut.deleteBy,clearObjects:Ut.clearObjects,browseObjects:Ut.browseObjects,getObjectPosition:Ut.getObjectPosition,findObject:Ut.findObject,exists:Ut.exists,saveSynonym:Ut.saveSynonym,saveSynonyms:Ut.saveSynonyms,getSynonym:Ut.getSynonym,searchSynonyms:Ut.searchSynonyms,browseSynonyms:Ut.browseSynonyms,deleteSynonym:Ut.deleteSynonym,clearSynonyms:Ut.clearSynonyms,replaceAllObjects:Ut.replaceAllObjects,replaceAllSynonyms:Ut.replaceAllSynonyms,searchRules:Ut.searchRules,getRule:Ut.getRule,deleteRule:Ut.deleteRule,saveRule:Ut.saveRule,saveRules:Ut.saveRules,replaceAllRules:Ut.replaceAllRules,browseRules:Ut.browseRules,clearRules:Ut.clearRules}}),initAnalytics:()=>u=>QC.createAnalyticsClient({...o,...u,methods:{addABTest:QC.addABTest,getABTest:QC.getABTest,getABTests:QC.getABTests,stopABTest:QC.stopABTest,deleteABTest:QC.deleteABTest}}),initPersonalization:n,initRecommendation:()=>u=>(a.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),n()(u))}})}kye.version=zH.version;Qye.exports=kye});var ZH=_((XWt,XH)=>{var Tye=Fye();XH.exports=Tye;XH.exports.default=Tye});var t6=_(($Wt,Lye)=>{"use strict";var Nye=Object.getOwnPropertySymbols,yyt=Object.prototype.hasOwnProperty,Eyt=Object.prototype.propertyIsEnumerable;function Cyt(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function wyt(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var o=Object.getOwnPropertyNames(e).map(function(n){return e[n]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(n){a[n]=n}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Lye.exports=wyt()?Object.assign:function(t,e){for(var r,o=Cyt(t),a,n=1;n{"use strict";var o6=t6(),$c=typeof Symbol=="function"&&Symbol.for,Z2=$c?Symbol.for("react.element"):60103,Iyt=$c?Symbol.for("react.portal"):60106,Byt=$c?Symbol.for("react.fragment"):60107,vyt=$c?Symbol.for("react.strict_mode"):60108,Dyt=$c?Symbol.for("react.profiler"):60114,Pyt=$c?Symbol.for("react.provider"):60109,Syt=$c?Symbol.for("react.context"):60110,xyt=$c?Symbol.for("react.forward_ref"):60112,byt=$c?Symbol.for("react.suspense"):60113,kyt=$c?Symbol.for("react.memo"):60115,Qyt=$c?Symbol.for("react.lazy"):60116,Mye=typeof Symbol=="function"&&Symbol.iterator;function $2(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;rkk.length&&kk.push(t)}function n6(t,e,r,o){var a=typeof t;(a==="undefined"||a==="boolean")&&(t=null);var n=!1;if(t===null)n=!0;else switch(a){case"string":case"number":n=!0;break;case"object":switch(t.$$typeof){case Z2:case Iyt:n=!0}}if(n)return r(o,t,e===""?"."+r6(t,0):e),1;if(n=0,e=e===""?".":e+":",Array.isArray(t))for(var u=0;u{"use strict";Jye.exports=Kye()});var f6=_((rVt,A6)=>{"use strict";var An=A6.exports;A6.exports.default=An;var Ln="\x1B[",eB="\x1B]",TC="\x07",Qk=";",zye=process.env.TERM_PROGRAM==="Apple_Terminal";An.cursorTo=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");return typeof e!="number"?Ln+(t+1)+"G":Ln+(e+1)+";"+(t+1)+"H"};An.cursorMove=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");let r="";return t<0?r+=Ln+-t+"D":t>0&&(r+=Ln+t+"C"),e<0?r+=Ln+-e+"A":e>0&&(r+=Ln+e+"B"),r};An.cursorUp=(t=1)=>Ln+t+"A";An.cursorDown=(t=1)=>Ln+t+"B";An.cursorForward=(t=1)=>Ln+t+"C";An.cursorBackward=(t=1)=>Ln+t+"D";An.cursorLeft=Ln+"G";An.cursorSavePosition=zye?"\x1B7":Ln+"s";An.cursorRestorePosition=zye?"\x1B8":Ln+"u";An.cursorGetPosition=Ln+"6n";An.cursorNextLine=Ln+"E";An.cursorPrevLine=Ln+"F";An.cursorHide=Ln+"?25l";An.cursorShow=Ln+"?25h";An.eraseLines=t=>{let e="";for(let r=0;r[eB,"8",Qk,Qk,e,TC,t,eB,"8",Qk,Qk,TC].join("");An.image=(t,e={})=>{let r=`${eB}1337;File=inline=1`;return e.width&&(r+=`;width=${e.width}`),e.height&&(r+=`;height=${e.height}`),e.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0"),r+":"+t.toString("base64")+TC};An.iTerm={setCwd:(t=process.cwd())=>`${eB}50;CurrentDir=${t}${TC}`,annotation:(t,e={})=>{let r=`${eB}1337;`,o=typeof e.x<"u",a=typeof e.y<"u";if((o||a)&&!(o&&a&&typeof e.length<"u"))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return t=t.replace(/\|/g,""),r+=e.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",e.length>0?r+=(o?[t,e.length,e.x,e.y]:[e.length,t]).join("|"):r+=t,r+TC}}});var Zye=_((nVt,p6)=>{"use strict";var Xye=(t,e)=>{for(let r of Reflect.ownKeys(e))Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r));return t};p6.exports=Xye;p6.exports.default=Xye});var eEe=_((iVt,Tk)=>{"use strict";var Myt=Zye(),Fk=new WeakMap,$ye=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let r,o=0,a=t.displayName||t.name||"",n=function(...u){if(Fk.set(n,++o),o===1)r=t.apply(this,u),t=null;else if(e.throw===!0)throw new Error(`Function \`${a}\` can only be called once`);return r};return Myt(n,t),Fk.set(n,o),n};Tk.exports=$ye;Tk.exports.default=$ye;Tk.exports.callCount=t=>{if(!Fk.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return Fk.get(t)}});var tEe=_((sVt,Rk)=>{Rk.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Rk.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Rk.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var d6=_((oVt,LC)=>{var Ei=global.process,nm=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};nm(Ei)?(rEe=Be("assert"),RC=tEe(),nEe=/^win/i.test(Ei.platform),tB=Be("events"),typeof tB!="function"&&(tB=tB.EventEmitter),Ei.__signal_exit_emitter__?Rs=Ei.__signal_exit_emitter__:(Rs=Ei.__signal_exit_emitter__=new tB,Rs.count=0,Rs.emitted={}),Rs.infinite||(Rs.setMaxListeners(1/0),Rs.infinite=!0),LC.exports=function(t,e){if(!nm(global.process))return function(){};rEe.equal(typeof t,"function","a callback must be provided for exit handler"),NC===!1&&h6();var r="exit";e&&e.alwaysLast&&(r="afterexit");var o=function(){Rs.removeListener(r,t),Rs.listeners("exit").length===0&&Rs.listeners("afterexit").length===0&&Nk()};return Rs.on(r,t),o},Nk=function(){!NC||!nm(global.process)||(NC=!1,RC.forEach(function(e){try{Ei.removeListener(e,Lk[e])}catch{}}),Ei.emit=Mk,Ei.reallyExit=g6,Rs.count-=1)},LC.exports.unload=Nk,im=function(e,r,o){Rs.emitted[e]||(Rs.emitted[e]=!0,Rs.emit(e,r,o))},Lk={},RC.forEach(function(t){Lk[t]=function(){if(!!nm(global.process)){var r=Ei.listeners(t);r.length===Rs.count&&(Nk(),im("exit",null,t),im("afterexit",null,t),nEe&&t==="SIGHUP"&&(t="SIGINT"),Ei.kill(Ei.pid,t))}}}),LC.exports.signals=function(){return RC},NC=!1,h6=function(){NC||!nm(global.process)||(NC=!0,Rs.count+=1,RC=RC.filter(function(e){try{return Ei.on(e,Lk[e]),!0}catch{return!1}}),Ei.emit=sEe,Ei.reallyExit=iEe)},LC.exports.load=h6,g6=Ei.reallyExit,iEe=function(e){!nm(global.process)||(Ei.exitCode=e||0,im("exit",Ei.exitCode,null),im("afterexit",Ei.exitCode,null),g6.call(Ei,Ei.exitCode))},Mk=Ei.emit,sEe=function(e,r){if(e==="exit"&&nm(global.process)){r!==void 0&&(Ei.exitCode=r);var o=Mk.apply(this,arguments);return im("exit",Ei.exitCode,null),im("afterexit",Ei.exitCode,null),o}else return Mk.apply(this,arguments)}):LC.exports=function(){return function(){}};var rEe,RC,nEe,tB,Rs,Nk,im,Lk,NC,h6,g6,iEe,Mk,sEe});var aEe=_((aVt,oEe)=>{"use strict";var Oyt=eEe(),Uyt=d6();oEe.exports=Oyt(()=>{Uyt(()=>{process.stderr.write("\x1B[?25h")},{alwaysLast:!0})})});var m6=_(MC=>{"use strict";var _yt=aEe(),Ok=!1;MC.show=(t=process.stderr)=>{!t.isTTY||(Ok=!1,t.write("\x1B[?25h"))};MC.hide=(t=process.stderr)=>{!t.isTTY||(_yt(),Ok=!0,t.write("\x1B[?25l"))};MC.toggle=(t,e)=>{t!==void 0&&(Ok=t),Ok?MC.show(e):MC.hide(e)}});var AEe=_(rB=>{"use strict";var uEe=rB&&rB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rB,"__esModule",{value:!0});var lEe=uEe(f6()),cEe=uEe(m6()),Hyt=(t,{showCursor:e=!1}={})=>{let r=0,o="",a=!1,n=u=>{!e&&!a&&(cEe.default.hide(),a=!0);let A=u+` +`;A!==o&&(o=A,t.write(lEe.default.eraseLines(r)+A),r=A.split(` +`).length)};return n.clear=()=>{t.write(lEe.default.eraseLines(r)),o="",r=0},n.done=()=>{o="",r=0,e||(cEe.default.show(),a=!1)},n};rB.default={create:Hyt}});var fEe=_((uVt,jyt)=>{jyt.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY_BUILD_BASE",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}}]});var gEe=_(gl=>{"use strict";var hEe=fEe(),pA=process.env;Object.defineProperty(gl,"_vendors",{value:hEe.map(function(t){return t.constant})});gl.name=null;gl.isPR=null;hEe.forEach(function(t){var e=Array.isArray(t.env)?t.env:[t.env],r=e.every(function(o){return pEe(o)});if(gl[t.constant]=r,r)switch(gl.name=t.name,typeof t.pr){case"string":gl.isPR=!!pA[t.pr];break;case"object":"env"in t.pr?gl.isPR=t.pr.env in pA&&pA[t.pr.env]!==t.pr.ne:"any"in t.pr?gl.isPR=t.pr.any.some(function(o){return!!pA[o]}):gl.isPR=pEe(t.pr);break;default:gl.isPR=null}});gl.isCI=!!(pA.CI||pA.CONTINUOUS_INTEGRATION||pA.BUILD_NUMBER||pA.RUN_ID||gl.name);function pEe(t){return typeof t=="string"?!!pA[t]:Object.keys(t).every(function(e){return pA[e]===t[e]})}});var mEe=_((fVt,dEe)=>{"use strict";dEe.exports=gEe().isCI});var EEe=_((pVt,yEe)=>{"use strict";var qyt=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};yEe.exports=(t,{include:e,exclude:r}={})=>{let o=a=>{let n=u=>typeof u=="string"?a===u:u.test(a);return e?e.some(n):r?!r.some(n):!0};for(let[a,n]of qyt(t.constructor.prototype)){if(n==="constructor"||!o(n))continue;let u=Reflect.getOwnPropertyDescriptor(a,n);u&&typeof u.value=="function"&&(t[n]=t[n].bind(t))}return t}});var PEe=_(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});var UC,sB,qk,Gk,v6;typeof window>"u"||typeof MessageChannel!="function"?(OC=null,y6=null,E6=function(){if(OC!==null)try{var t=kn.unstable_now();OC(!0,t),OC=null}catch(e){throw setTimeout(E6,0),e}},CEe=Date.now(),kn.unstable_now=function(){return Date.now()-CEe},UC=function(t){OC!==null?setTimeout(UC,0,t):(OC=t,setTimeout(E6,0))},sB=function(t,e){y6=setTimeout(t,e)},qk=function(){clearTimeout(y6)},Gk=function(){return!1},v6=kn.unstable_forceFrameRate=function(){}):(Uk=window.performance,C6=window.Date,wEe=window.setTimeout,IEe=window.clearTimeout,typeof console<"u"&&(BEe=window.cancelAnimationFrame,typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),typeof BEe!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")),typeof Uk=="object"&&typeof Uk.now=="function"?kn.unstable_now=function(){return Uk.now()}:(vEe=C6.now(),kn.unstable_now=function(){return C6.now()-vEe}),nB=!1,iB=null,_k=-1,w6=5,I6=0,Gk=function(){return kn.unstable_now()>=I6},v6=function(){},kn.unstable_forceFrameRate=function(t){0>t||125jk(u,r))p!==void 0&&0>jk(p,u)?(t[o]=p,t[A]=r,o=A):(t[o]=u,t[n]=r,o=n);else if(p!==void 0&&0>jk(p,r))t[o]=p,t[A]=r,o=A;else break e}}return e}return null}function jk(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}var eu=[],m0=[],Gyt=1,na=null,Lo=3,Wk=!1,sm=!1,oB=!1;function Vk(t){for(var e=nc(m0);e!==null;){if(e.callback===null)Yk(m0);else if(e.startTime<=t)Yk(m0),e.sortIndex=e.expirationTime,D6(eu,e);else break;e=nc(m0)}}function P6(t){if(oB=!1,Vk(t),!sm)if(nc(eu)!==null)sm=!0,UC(S6);else{var e=nc(m0);e!==null&&sB(P6,e.startTime-t)}}function S6(t,e){sm=!1,oB&&(oB=!1,qk()),Wk=!0;var r=Lo;try{for(Vk(e),na=nc(eu);na!==null&&(!(na.expirationTime>e)||t&&!Gk());){var o=na.callback;if(o!==null){na.callback=null,Lo=na.priorityLevel;var a=o(na.expirationTime<=e);e=kn.unstable_now(),typeof a=="function"?na.callback=a:na===nc(eu)&&Yk(eu),Vk(e)}else Yk(eu);na=nc(eu)}if(na!==null)var n=!0;else{var u=nc(m0);u!==null&&sB(P6,u.startTime-e),n=!1}return n}finally{na=null,Lo=r,Wk=!1}}function DEe(t){switch(t){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var Yyt=v6;kn.unstable_ImmediatePriority=1;kn.unstable_UserBlockingPriority=2;kn.unstable_NormalPriority=3;kn.unstable_IdlePriority=5;kn.unstable_LowPriority=4;kn.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=Lo;Lo=t;try{return e()}finally{Lo=r}};kn.unstable_next=function(t){switch(Lo){case 1:case 2:case 3:var e=3;break;default:e=Lo}var r=Lo;Lo=e;try{return t()}finally{Lo=r}};kn.unstable_scheduleCallback=function(t,e,r){var o=kn.unstable_now();if(typeof r=="object"&&r!==null){var a=r.delay;a=typeof a=="number"&&0o?(t.sortIndex=a,D6(m0,t),nc(eu)===null&&t===nc(m0)&&(oB?qk():oB=!0,sB(P6,a-o))):(t.sortIndex=r,D6(eu,t),sm||Wk||(sm=!0,UC(S6))),t};kn.unstable_cancelCallback=function(t){t.callback=null};kn.unstable_wrapCallback=function(t){var e=Lo;return function(){var r=Lo;Lo=e;try{return t.apply(this,arguments)}finally{Lo=r}}};kn.unstable_getCurrentPriorityLevel=function(){return Lo};kn.unstable_shouldYield=function(){var t=kn.unstable_now();Vk(t);var e=nc(eu);return e!==na&&na!==null&&e!==null&&e.callback!==null&&e.startTime<=t&&e.expirationTime{"use strict";SEe.exports=PEe()});var xEe=_((dVt,aB)=>{aB.exports=function t(e){"use strict";var r=t6(),o=sn(),a=x6();function n(P){for(var D="https://reactjs.org/docs/error-decoder.html?invariant="+P,R=1;Rao||(P.current=yl[ao],yl[ao]=null,ao--)}function Mn(P,D){ao++,yl[ao]=P.current,P.current=D}var Ni={},On={current:Ni},_i={current:!1},tr=Ni;function Me(P,D){var R=P.type.contextTypes;if(!R)return Ni;var j=P.stateNode;if(j&&j.__reactInternalMemoizedUnmaskedChildContext===D)return j.__reactInternalMemoizedMaskedChildContext;var Y={},fe;for(fe in R)Y[fe]=D[fe];return j&&(P=P.stateNode,P.__reactInternalMemoizedUnmaskedChildContext=D,P.__reactInternalMemoizedMaskedChildContext=Y),Y}function ii(P){return P=P.childContextTypes,P!=null}function Oa(P){Kn(_i,P),Kn(On,P)}function hr(P){Kn(_i,P),Kn(On,P)}function uc(P,D,R){if(On.current!==Ni)throw Error(n(168));Mn(On,D,P),Mn(_i,R,P)}function uu(P,D,R){var j=P.stateNode;if(P=D.childContextTypes,typeof j.getChildContext!="function")return R;j=j.getChildContext();for(var Y in j)if(!(Y in P))throw Error(n(108,ae(D)||"Unknown",Y));return r({},R,{},j)}function Ac(P){var D=P.stateNode;return D=D&&D.__reactInternalMemoizedMergedChildContext||Ni,tr=On.current,Mn(On,D,P),Mn(_i,_i.current,P),!0}function El(P,D,R){var j=P.stateNode;if(!j)throw Error(n(169));R?(D=uu(P,D,tr),j.__reactInternalMemoizedMergedChildContext=D,Kn(_i,P),Kn(On,P),Mn(On,D,P)):Kn(_i,P),Mn(_i,R,P)}var vA=a.unstable_runWithPriority,Au=a.unstable_scheduleCallback,Ce=a.unstable_cancelCallback,Tt=a.unstable_shouldYield,fc=a.unstable_requestPaint,Hi=a.unstable_now,fu=a.unstable_getCurrentPriorityLevel,Yt=a.unstable_ImmediatePriority,Cl=a.unstable_UserBlockingPriority,DA=a.unstable_NormalPriority,cp=a.unstable_LowPriority,pc=a.unstable_IdlePriority,PA={},Qn=fc!==void 0?fc:function(){},hi=null,hc=null,SA=!1,sa=Hi(),Li=1e4>sa?Hi:function(){return Hi()-sa};function _o(){switch(fu()){case Yt:return 99;case Cl:return 98;case DA:return 97;case cp:return 96;case pc:return 95;default:throw Error(n(332))}}function Ze(P){switch(P){case 99:return Yt;case 98:return Cl;case 97:return DA;case 96:return cp;case 95:return pc;default:throw Error(n(332))}}function lo(P,D){return P=Ze(P),vA(P,D)}function gc(P,D,R){return P=Ze(P),Au(P,D,R)}function pu(P){return hi===null?(hi=[P],hc=Au(Yt,hu)):hi.push(P),PA}function ji(){if(hc!==null){var P=hc;hc=null,Ce(P)}hu()}function hu(){if(!SA&&hi!==null){SA=!0;var P=0;try{var D=hi;lo(99,function(){for(;P=D&&(qo=!0),P.firstContext=null)}function ms(P,D){if(aa!==P&&D!==!1&&D!==0)if((typeof D!="number"||D===1073741823)&&(aa=P,D=1073741823),D={context:P,observedBits:D,next:null},Us===null){if(co===null)throw Error(n(308));Us=D,co.dependencies={expirationTime:0,firstContext:D,responders:null}}else Us=Us.next=D;return x?P._currentValue:P._currentValue2}var _s=!1;function Un(P){return{baseState:P,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Pn(P){return{baseState:P.baseState,firstUpdate:P.firstUpdate,lastUpdate:P.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function ys(P,D){return{expirationTime:P,suspenseConfig:D,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function We(P,D){P.lastUpdate===null?P.firstUpdate=P.lastUpdate=D:(P.lastUpdate.next=D,P.lastUpdate=D)}function tt(P,D){var R=P.alternate;if(R===null){var j=P.updateQueue,Y=null;j===null&&(j=P.updateQueue=Un(P.memoizedState))}else j=P.updateQueue,Y=R.updateQueue,j===null?Y===null?(j=P.updateQueue=Un(P.memoizedState),Y=R.updateQueue=Un(R.memoizedState)):j=P.updateQueue=Pn(Y):Y===null&&(Y=R.updateQueue=Pn(j));Y===null||j===Y?We(j,D):j.lastUpdate===null||Y.lastUpdate===null?(We(j,D),We(Y,D)):(We(j,D),Y.lastUpdate=D)}function It(P,D){var R=P.updateQueue;R=R===null?P.updateQueue=Un(P.memoizedState):nr(P,R),R.lastCapturedUpdate===null?R.firstCapturedUpdate=R.lastCapturedUpdate=D:(R.lastCapturedUpdate.next=D,R.lastCapturedUpdate=D)}function nr(P,D){var R=P.alternate;return R!==null&&D===R.updateQueue&&(D=P.updateQueue=Pn(D)),D}function $(P,D,R,j,Y,fe){switch(R.tag){case 1:return P=R.payload,typeof P=="function"?P.call(fe,j,Y):P;case 3:P.effectTag=P.effectTag&-4097|64;case 0:if(P=R.payload,Y=typeof P=="function"?P.call(fe,j,Y):P,Y==null)break;return r({},j,Y);case 2:_s=!0}return j}function me(P,D,R,j,Y){_s=!1,D=nr(P,D);for(var fe=D.baseState,ve=null,vt=0,wt=D.firstUpdate,bt=fe;wt!==null;){var _r=wt.expirationTime;_rxn?(ai=Fr,Fr=null):ai=Fr.sibling;var en=di(rt,Fr,At[xn],Wt);if(en===null){Fr===null&&(Fr=ai);break}P&&Fr&&en.alternate===null&&D(rt,Fr),Ke=fe(en,Ke,xn),Sn===null?vr=en:Sn.sibling=en,Sn=en,Fr=ai}if(xn===At.length)return R(rt,Fr),vr;if(Fr===null){for(;xnxn?(ai=Fr,Fr=null):ai=Fr.sibling;var ho=di(rt,Fr,en.value,Wt);if(ho===null){Fr===null&&(Fr=ai);break}P&&Fr&&ho.alternate===null&&D(rt,Fr),Ke=fe(ho,Ke,xn),Sn===null?vr=ho:Sn.sibling=ho,Sn=ho,Fr=ai}if(en.done)return R(rt,Fr),vr;if(Fr===null){for(;!en.done;xn++,en=At.next())en=is(rt,en.value,Wt),en!==null&&(Ke=fe(en,Ke,xn),Sn===null?vr=en:Sn.sibling=en,Sn=en);return vr}for(Fr=j(rt,Fr);!en.done;xn++,en=At.next())en=po(Fr,rt,xn,en.value,Wt),en!==null&&(P&&en.alternate!==null&&Fr.delete(en.key===null?xn:en.key),Ke=fe(en,Ke,xn),Sn===null?vr=en:Sn.sibling=en,Sn=en);return P&&Fr.forEach(function(PF){return D(rt,PF)}),vr}return function(rt,Ke,At,Wt){var vr=typeof At=="object"&&At!==null&&At.type===E&&At.key===null;vr&&(At=At.props.children);var Sn=typeof At=="object"&&At!==null;if(Sn)switch(At.$$typeof){case p:e:{for(Sn=At.key,vr=Ke;vr!==null;){if(vr.key===Sn)if(vr.tag===7?At.type===E:vr.elementType===At.type){R(rt,vr.sibling),Ke=Y(vr,At.type===E?At.props.children:At.props,Wt),Ke.ref=kA(rt,vr,At),Ke.return=rt,rt=Ke;break e}else{R(rt,vr);break}else D(rt,vr);vr=vr.sibling}At.type===E?(Ke=xu(At.props.children,rt.mode,Wt,At.key),Ke.return=rt,rt=Ke):(Wt=Hm(At.type,At.key,At.props,null,rt.mode,Wt),Wt.ref=kA(rt,Ke,At),Wt.return=rt,rt=Wt)}return ve(rt);case h:e:{for(vr=At.key;Ke!==null;){if(Ke.key===vr)if(Ke.tag===4&&Ke.stateNode.containerInfo===At.containerInfo&&Ke.stateNode.implementation===At.implementation){R(rt,Ke.sibling),Ke=Y(Ke,At.children||[],Wt),Ke.return=rt,rt=Ke;break e}else{R(rt,Ke);break}else D(rt,Ke);Ke=Ke.sibling}Ke=Fw(At,rt.mode,Wt),Ke.return=rt,rt=Ke}return ve(rt)}if(typeof At=="string"||typeof At=="number")return At=""+At,Ke!==null&&Ke.tag===6?(R(rt,Ke.sibling),Ke=Y(Ke,At,Wt),Ke.return=rt,rt=Ke):(R(rt,Ke),Ke=Qw(At,rt.mode,Wt),Ke.return=rt,rt=Ke),ve(rt);if(bA(At))return VA(rt,Ke,At,Wt);if(Ae(At))return Yo(rt,Ke,At,Wt);if(Sn&&up(rt,At),typeof At>"u"&&!vr)switch(rt.tag){case 1:case 0:throw rt=rt.type,Error(n(152,rt.displayName||rt.name||"Component"))}return R(rt,Ke)}}var gu=ng(!0),ig=ng(!1),du={},uo={current:du},QA={current:du},mc={current:du};function ca(P){if(P===du)throw Error(n(174));return P}function sg(P,D){Mn(mc,D,P),Mn(QA,P,P),Mn(uo,du,P),D=ne(D),Kn(uo,P),Mn(uo,D,P)}function yc(P){Kn(uo,P),Kn(QA,P),Kn(mc,P)}function Pm(P){var D=ca(mc.current),R=ca(uo.current);D=ee(R,P.type,D),R!==D&&(Mn(QA,P,P),Mn(uo,D,P))}function og(P){QA.current===P&&(Kn(uo,P),Kn(QA,P))}var $n={current:0};function Ap(P){for(var D=P;D!==null;){if(D.tag===13){var R=D.memoizedState;if(R!==null&&(R=R.dehydrated,R===null||Ls(R)||so(R)))return D}else if(D.tag===19&&D.memoizedProps.revealOrder!==void 0){if((D.effectTag&64)!==0)return D}else if(D.child!==null){D.child.return=D,D=D.child;continue}if(D===P)break;for(;D.sibling===null;){if(D.return===null||D.return===P)return null;D=D.return}D.sibling.return=D.return,D=D.sibling}return null}function ag(P,D){return{responder:P,props:D}}var FA=u.ReactCurrentDispatcher,Hs=u.ReactCurrentBatchConfig,mu=0,Ha=null,Gi=null,ua=null,yu=null,Es=null,Ec=null,Cc=0,G=null,Dt=0,wl=!1,bi=null,wc=0;function ct(){throw Error(n(321))}function Eu(P,D){if(D===null)return!1;for(var R=0;RCc&&(Cc=_r,_m(Cc))):(Pw(_r,wt.suspenseConfig),fe=wt.eagerReducer===P?wt.eagerState:P(fe,wt.action)),ve=wt,wt=wt.next}while(wt!==null&&wt!==j);bt||(vt=ve,Y=fe),hs(fe,D.memoizedState)||(qo=!0),D.memoizedState=fe,D.baseUpdate=vt,D.baseState=Y,R.lastRenderedState=fe}return[D.memoizedState,R.dispatch]}function cg(P){var D=TA();return typeof P=="function"&&(P=P()),D.memoizedState=D.baseState=P,P=D.queue={last:null,dispatch:null,lastRenderedReducer:Br,lastRenderedState:P},P=P.dispatch=hg.bind(null,Ha,P),[D.memoizedState,P]}function ug(P){return Cs(Br,P)}function Ag(P,D,R,j){return P={tag:P,create:D,destroy:R,deps:j,next:null},G===null?(G={lastEffect:null},G.lastEffect=P.next=P):(D=G.lastEffect,D===null?G.lastEffect=P.next=P:(R=D.next,D.next=P,P.next=R,G.lastEffect=P)),P}function pp(P,D,R,j){var Y=TA();Dt|=P,Y.memoizedState=Ag(D,R,void 0,j===void 0?null:j)}function Ic(P,D,R,j){var Y=fp();j=j===void 0?null:j;var fe=void 0;if(Gi!==null){var ve=Gi.memoizedState;if(fe=ve.destroy,j!==null&&Eu(j,ve.deps)){Ag(0,R,fe,j);return}}Dt|=P,Y.memoizedState=Ag(D,R,fe,j)}function Ct(P,D){return pp(516,192,P,D)}function Sm(P,D){return Ic(516,192,P,D)}function fg(P,D){if(typeof D=="function")return P=P(),D(P),function(){D(null)};if(D!=null)return P=P(),D.current=P,function(){D.current=null}}function pg(){}function Cu(P,D){return TA().memoizedState=[P,D===void 0?null:D],P}function xm(P,D){var R=fp();D=D===void 0?null:D;var j=R.memoizedState;return j!==null&&D!==null&&Eu(D,j[1])?j[0]:(R.memoizedState=[P,D],P)}function hg(P,D,R){if(!(25>wc))throw Error(n(301));var j=P.alternate;if(P===Ha||j!==null&&j===Ha)if(wl=!0,P={expirationTime:mu,suspenseConfig:null,action:R,eagerReducer:null,eagerState:null,next:null},bi===null&&(bi=new Map),R=bi.get(D),R===void 0)bi.set(D,P);else{for(D=R;D.next!==null;)D=D.next;D.next=P}else{var Y=ga(),fe=pt.suspense;Y=HA(Y,P,fe),fe={expirationTime:Y,suspenseConfig:fe,action:R,eagerReducer:null,eagerState:null,next:null};var ve=D.last;if(ve===null)fe.next=fe;else{var vt=ve.next;vt!==null&&(fe.next=vt),ve.next=fe}if(D.last=fe,P.expirationTime===0&&(j===null||j.expirationTime===0)&&(j=D.lastRenderedReducer,j!==null))try{var wt=D.lastRenderedState,bt=j(wt,R);if(fe.eagerReducer=j,fe.eagerState=bt,hs(bt,wt))return}catch{}finally{}Sc(P,Y)}}var wu={readContext:ms,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useLayoutEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useResponder:ct,useDeferredValue:ct,useTransition:ct},yw={readContext:ms,useCallback:Cu,useContext:ms,useEffect:Ct,useImperativeHandle:function(P,D,R){return R=R!=null?R.concat([P]):null,pp(4,36,fg.bind(null,D,P),R)},useLayoutEffect:function(P,D){return pp(4,36,P,D)},useMemo:function(P,D){var R=TA();return D=D===void 0?null:D,P=P(),R.memoizedState=[P,D],P},useReducer:function(P,D,R){var j=TA();return D=R!==void 0?R(D):D,j.memoizedState=j.baseState=D,P=j.queue={last:null,dispatch:null,lastRenderedReducer:P,lastRenderedState:D},P=P.dispatch=hg.bind(null,Ha,P),[j.memoizedState,P]},useRef:function(P){var D=TA();return P={current:P},D.memoizedState=P},useState:cg,useDebugValue:pg,useResponder:ag,useDeferredValue:function(P,D){var R=cg(P),j=R[0],Y=R[1];return Ct(function(){a.unstable_next(function(){var fe=Hs.suspense;Hs.suspense=D===void 0?null:D;try{Y(P)}finally{Hs.suspense=fe}})},[P,D]),j},useTransition:function(P){var D=cg(!1),R=D[0],j=D[1];return[Cu(function(Y){j(!0),a.unstable_next(function(){var fe=Hs.suspense;Hs.suspense=P===void 0?null:P;try{j(!1),Y()}finally{Hs.suspense=fe}})},[P,R]),R]}},bm={readContext:ms,useCallback:xm,useContext:ms,useEffect:Sm,useImperativeHandle:function(P,D,R){return R=R!=null?R.concat([P]):null,Ic(4,36,fg.bind(null,D,P),R)},useLayoutEffect:function(P,D){return Ic(4,36,P,D)},useMemo:function(P,D){var R=fp();D=D===void 0?null:D;var j=R.memoizedState;return j!==null&&D!==null&&Eu(D,j[1])?j[0]:(P=P(),R.memoizedState=[P,D],P)},useReducer:Cs,useRef:function(){return fp().memoizedState},useState:ug,useDebugValue:pg,useResponder:ag,useDeferredValue:function(P,D){var R=ug(P),j=R[0],Y=R[1];return Sm(function(){a.unstable_next(function(){var fe=Hs.suspense;Hs.suspense=D===void 0?null:D;try{Y(P)}finally{Hs.suspense=fe}})},[P,D]),j},useTransition:function(P){var D=ug(!1),R=D[0],j=D[1];return[xm(function(Y){j(!0),a.unstable_next(function(){var fe=Hs.suspense;Hs.suspense=P===void 0?null:P;try{j(!1),Y()}finally{Hs.suspense=fe}})},[P,R]),R]}},Aa=null,Bc=null,Il=!1;function Iu(P,D){var R=Dl(5,null,null,0);R.elementType="DELETED",R.type="DELETED",R.stateNode=D,R.return=P,R.effectTag=8,P.lastEffect!==null?(P.lastEffect.nextEffect=R,P.lastEffect=R):P.firstEffect=P.lastEffect=R}function gg(P,D){switch(P.tag){case 5:return D=io(D,P.type,P.pendingProps),D!==null?(P.stateNode=D,!0):!1;case 6:return D=Si(D,P.pendingProps),D!==null?(P.stateNode=D,!0):!1;case 13:return!1;default:return!1}}function RA(P){if(Il){var D=Bc;if(D){var R=D;if(!gg(P,D)){if(D=cc(R),!D||!gg(P,D)){P.effectTag=P.effectTag&-1025|2,Il=!1,Aa=P;return}Iu(Aa,R)}Aa=P,Bc=cu(D)}else P.effectTag=P.effectTag&-1025|2,Il=!1,Aa=P}}function hp(P){for(P=P.return;P!==null&&P.tag!==5&&P.tag!==3&&P.tag!==13;)P=P.return;Aa=P}function ja(P){if(!y||P!==Aa)return!1;if(!Il)return hp(P),Il=!0,!1;var D=P.type;if(P.tag!==5||D!=="head"&&D!=="body"&&!Qe(D,P.memoizedProps))for(D=Bc;D;)Iu(P,D),D=cc(D);if(hp(P),P.tag===13){if(!y)throw Error(n(316));if(P=P.memoizedState,P=P!==null?P.dehydrated:null,!P)throw Error(n(317));Bc=Ms(P)}else Bc=Aa?cc(P.stateNode):null;return!0}function dg(){y&&(Bc=Aa=null,Il=!1)}var gp=u.ReactCurrentOwner,qo=!1;function ws(P,D,R,j){D.child=P===null?ig(D,null,R,j):gu(D,P.child,R,j)}function Ii(P,D,R,j,Y){R=R.render;var fe=D.ref;return ds(D,Y),j=lg(P,D,R,j,fe,Y),P!==null&&!qo?(D.updateQueue=P.updateQueue,D.effectTag&=-517,P.expirationTime<=Y&&(P.expirationTime=0),si(P,D,Y)):(D.effectTag|=1,ws(P,D,j,Y),D.child)}function km(P,D,R,j,Y,fe){if(P===null){var ve=R.type;return typeof ve=="function"&&!kw(ve)&&ve.defaultProps===void 0&&R.compare===null&&R.defaultProps===void 0?(D.tag=15,D.type=ve,Qm(P,D,ve,j,Y,fe)):(P=Hm(R.type,null,j,null,D.mode,fe),P.ref=D.ref,P.return=D,D.child=P)}return ve=P.child,YD)&&_A.set(P,D)))}}function vg(P,D){P.expirationTimeP?D:P)}function fo(P){if(P.lastExpiredTime!==0)P.callbackExpirationTime=1073741823,P.callbackPriority=99,P.callbackNode=pu(Dw.bind(null,P));else{var D=Um(P),R=P.callbackNode;if(D===0)R!==null&&(P.callbackNode=null,P.callbackExpirationTime=0,P.callbackPriority=90);else{var j=ga();if(D===1073741823?j=99:D===1||D===2?j=95:(j=10*(1073741821-D)-10*(1073741821-j),j=0>=j?99:250>=j?98:5250>=j?97:95),R!==null){var Y=P.callbackPriority;if(P.callbackExpirationTime===D&&Y>=j)return;R!==PA&&Ce(R)}P.callbackExpirationTime=D,P.callbackPriority=j,D=D===1073741823?pu(Dw.bind(null,P)):gc(j,Wv.bind(null,P),{timeout:10*(1073741821-D)-Li()}),P.callbackNode=D}}}function Wv(P,D){if(Om=0,D)return D=ga(),jm(P,D),fo(P),null;var R=Um(P);if(R!==0){if(D=P.callbackNode,(yr&(rs|js))!==En)throw Error(n(327));if(Ip(),P===gi&&R===ns||Pu(P,R),Mr!==null){var j=yr;yr|=rs;var Y=qA(P);do try{gF();break}catch(vt){jA(P,vt)}while(1);if(la(),yr=j,Ep.current=Y,Yi===Rm)throw D=Nm,Pu(P,R),WA(P,R),fo(P),D;if(Mr===null)switch(Y=P.finishedWork=P.current.alternate,P.finishedExpirationTime=R,j=Yi,gi=null,j){case Bu:case Rm:throw Error(n(345));case Bi:jm(P,2=R){P.lastPingedTime=R,Pu(P,R);break}}if(fe=Um(P),fe!==0&&fe!==R)break;if(j!==0&&j!==R){P.lastPingedTime=j;break}P.timeoutHandle=Te(Su.bind(null,P),Y);break}Su(P);break;case vl:if(WA(P,R),j=P.lastSuspendedTime,R===j&&(P.nextKnownPendingLevel=Sw(Y)),OA&&(Y=P.lastPingedTime,Y===0||Y>=R)){P.lastPingedTime=R,Pu(P,R);break}if(Y=Um(P),Y!==0&&Y!==R)break;if(j!==0&&j!==R){P.lastPingedTime=j;break}if(MA!==1073741823?j=10*(1073741821-MA)-Li():Ya===1073741823?j=0:(j=10*(1073741821-Ya)-5e3,Y=Li(),R=10*(1073741821-R)-Y,j=Y-j,0>j&&(j=0),j=(120>j?120:480>j?480:1080>j?1080:1920>j?1920:3e3>j?3e3:4320>j?4320:1960*Cw(j/1960))-j,R=j?j=0:(Y=ve.busyDelayMs|0,fe=Li()-(10*(1073741821-fe)-(ve.timeoutMs|0||5e3)),j=fe<=Y?0:Y+j-fe),10 component higher in the tree to provide a loading indicator or placeholder to display.`+ml(Y))}Yi!==Pc&&(Yi=Bi),fe=yg(fe,Y),wt=j;do{switch(wt.tag){case 3:ve=fe,wt.effectTag|=4096,wt.expirationTime=D;var Ke=Gv(wt,ve,D);It(wt,Ke);break e;case 1:ve=fe;var At=wt.type,Wt=wt.stateNode;if((wt.effectTag&64)===0&&(typeof At.getDerivedStateFromError=="function"||Wt!==null&&typeof Wt.componentDidCatch=="function"&&(Du===null||!Du.has(Wt)))){wt.effectTag|=4096,wt.expirationTime=D;var vr=Yv(wt,ve,D);It(wt,vr);break e}}wt=wt.return}while(wt!==null)}Mr=zv(Mr)}catch(Sn){D=Sn;continue}break}while(1)}function qA(){var P=Ep.current;return Ep.current=wu,P===null?wu:P}function Pw(P,D){PCp&&(Cp=P)}function hF(){for(;Mr!==null;)Mr=Jv(Mr)}function gF(){for(;Mr!==null&&!Tt();)Mr=Jv(Mr)}function Jv(P){var D=Zv(P.alternate,P,ns);return P.memoizedProps=P.pendingProps,D===null&&(D=zv(P)),ww.current=null,D}function zv(P){Mr=P;do{var D=Mr.alternate;if(P=Mr.return,(Mr.effectTag&2048)===0){e:{var R=D;D=Mr;var j=ns,Y=D.pendingProps;switch(D.tag){case 2:break;case 16:break;case 15:case 0:break;case 1:ii(D.type)&&Oa(D);break;case 3:yc(D),hr(D),Y=D.stateNode,Y.pendingContext&&(Y.context=Y.pendingContext,Y.pendingContext=null),(R===null||R.child===null)&&ja(D)&&pa(D),Bl(D);break;case 5:og(D);var fe=ca(mc.current);if(j=D.type,R!==null&&D.stateNode!=null)ts(R,D,j,Y,fe),R.ref!==D.ref&&(D.effectTag|=128);else if(Y){if(R=ca(uo.current),ja(D)){if(Y=D,!y)throw Error(n(175));R=ap(Y.stateNode,Y.type,Y.memoizedProps,fe,R,Y),Y.updateQueue=R,R=R!==null,R&&pa(D)}else{var ve=ht(j,Y,fe,R,D);vc(ve,D,!1,!1),D.stateNode=ve,lt(ve,j,Y,fe,R)&&pa(D)}D.ref!==null&&(D.effectTag|=128)}else if(D.stateNode===null)throw Error(n(166));break;case 6:if(R&&D.stateNode!=null)Gr(R,D,R.memoizedProps,Y);else{if(typeof Y!="string"&&D.stateNode===null)throw Error(n(166));if(R=ca(mc.current),fe=ca(uo.current),ja(D)){if(R=D,!y)throw Error(n(176));(R=lp(R.stateNode,R.memoizedProps,R))&&pa(D)}else D.stateNode=_e(Y,R,fe,D)}break;case 11:break;case 13:if(Kn($n,D),Y=D.memoizedState,(D.effectTag&64)!==0){D.expirationTime=j;break e}Y=Y!==null,fe=!1,R===null?D.memoizedProps.fallback!==void 0&&ja(D):(j=R.memoizedState,fe=j!==null,Y||j===null||(j=R.child.sibling,j!==null&&(ve=D.firstEffect,ve!==null?(D.firstEffect=j,j.nextEffect=ve):(D.firstEffect=D.lastEffect=j,j.nextEffect=null),j.effectTag=8))),Y&&!fe&&(D.mode&2)!==0&&(R===null&&D.memoizedProps.unstable_avoidThisFallback!==!0||($n.current&1)!==0?Yi===Bu&&(Yi=ha):((Yi===Bu||Yi===ha)&&(Yi=vl),Cp!==0&&gi!==null&&(WA(gi,ns),eD(gi,Cp)))),S&&Y&&(D.effectTag|=4),w&&(Y||fe)&&(D.effectTag|=4);break;case 7:break;case 8:break;case 12:break;case 4:yc(D),Bl(D);break;case 10:wi(D);break;case 9:break;case 14:break;case 17:ii(D.type)&&Oa(D);break;case 19:if(Kn($n,D),Y=D.memoizedState,Y===null)break;if(fe=(D.effectTag&64)!==0,ve=Y.rendering,ve===null){if(fe)Dc(Y,!1);else if(Yi!==Bu||R!==null&&(R.effectTag&64)!==0)for(R=D.child;R!==null;){if(ve=Ap(R),ve!==null){for(D.effectTag|=64,Dc(Y,!1),R=ve.updateQueue,R!==null&&(D.updateQueue=R,D.effectTag|=4),Y.lastEffect===null&&(D.firstEffect=null),D.lastEffect=Y.lastEffect,R=j,Y=D.child;Y!==null;)fe=Y,j=R,fe.effectTag&=2,fe.nextEffect=null,fe.firstEffect=null,fe.lastEffect=null,ve=fe.alternate,ve===null?(fe.childExpirationTime=0,fe.expirationTime=j,fe.child=null,fe.memoizedProps=null,fe.memoizedState=null,fe.updateQueue=null,fe.dependencies=null):(fe.childExpirationTime=ve.childExpirationTime,fe.expirationTime=ve.expirationTime,fe.child=ve.child,fe.memoizedProps=ve.memoizedProps,fe.memoizedState=ve.memoizedState,fe.updateQueue=ve.updateQueue,j=ve.dependencies,fe.dependencies=j===null?null:{expirationTime:j.expirationTime,firstContext:j.firstContext,responders:j.responders}),Y=Y.sibling;Mn($n,$n.current&1|2,D),D=D.child;break e}R=R.sibling}}else{if(!fe)if(R=Ap(ve),R!==null){if(D.effectTag|=64,fe=!0,R=R.updateQueue,R!==null&&(D.updateQueue=R,D.effectTag|=4),Dc(Y,!0),Y.tail===null&&Y.tailMode==="hidden"&&!ve.alternate){D=D.lastEffect=Y.lastEffect,D!==null&&(D.nextEffect=null);break}}else Li()>Y.tailExpiration&&1Y&&(Y=j),ve>Y&&(Y=ve),fe=fe.sibling;R.childExpirationTime=Y}if(D!==null)return D;P!==null&&(P.effectTag&2048)===0&&(P.firstEffect===null&&(P.firstEffect=Mr.firstEffect),Mr.lastEffect!==null&&(P.lastEffect!==null&&(P.lastEffect.nextEffect=Mr.firstEffect),P.lastEffect=Mr.lastEffect),1P?D:P}function Su(P){var D=_o();return lo(99,dF.bind(null,P,D)),null}function dF(P,D){do Ip();while(Ig!==null);if((yr&(rs|js))!==En)throw Error(n(327));var R=P.finishedWork,j=P.finishedExpirationTime;if(R===null)return null;if(P.finishedWork=null,P.finishedExpirationTime=0,R===P.current)throw Error(n(177));P.callbackNode=null,P.callbackExpirationTime=0,P.callbackPriority=90,P.nextKnownPendingLevel=0;var Y=Sw(R);if(P.firstPendingTime=Y,j<=P.lastSuspendedTime?P.firstSuspendedTime=P.lastSuspendedTime=P.nextKnownPendingLevel=0:j<=P.firstSuspendedTime&&(P.firstSuspendedTime=j-1),j<=P.lastPingedTime&&(P.lastPingedTime=0),j<=P.lastExpiredTime&&(P.lastExpiredTime=0),P===gi&&(Mr=gi=null,ns=0),1=R?ln(P,D,R):(Mn($n,$n.current&1,D),D=si(P,D,R),D!==null?D.sibling:null);Mn($n,$n.current&1,D);break;case 19:if(j=D.childExpirationTime>=R,(P.effectTag&64)!==0){if(j)return qa(P,D,R);D.effectTag|=64}if(Y=D.memoizedState,Y!==null&&(Y.rendering=null,Y.tail=null),Mn($n,$n.current,D),!j)return null}return si(P,D,R)}qo=!1}}else qo=!1;switch(D.expirationTime=0,D.tag){case 2:if(j=D.type,P!==null&&(P.alternate=null,D.alternate=null,D.effectTag|=2),P=D.pendingProps,Y=Me(D,On.current),ds(D,R),Y=lg(null,D,j,P,Y,R),D.effectTag|=1,typeof Y=="object"&&Y!==null&&typeof Y.render=="function"&&Y.$$typeof===void 0){if(D.tag=1,mw(),ii(j)){var fe=!0;Ac(D)}else fe=!1;D.memoizedState=Y.state!==null&&Y.state!==void 0?Y.state:null;var ve=j.getDerivedStateFromProps;typeof ve=="function"&&er(D,j,ve,P),Y.updater=Zr,D.stateNode=Y,Y._reactInternalFiber=D,jo(D,j,P,R),D=mp(null,D,j,!0,fe,R)}else D.tag=0,ws(null,D,Y,R),D=D.child;return D;case 16:if(Y=D.elementType,P!==null&&(P.alternate=null,D.alternate=null,D.effectTag|=2),P=D.pendingProps,ye(Y),Y._status!==1)throw Y._result;switch(Y=Y._result,D.type=Y,fe=D.tag=BF(Y),P=Ci(Y,P),fe){case 0:D=NA(null,D,Y,P,R);break;case 1:D=dp(null,D,Y,P,R);break;case 11:D=Ii(null,D,Y,P,R);break;case 14:D=km(null,D,Y,Ci(Y.type,P),j,R);break;default:throw Error(n(306,Y,""))}return D;case 0:return j=D.type,Y=D.pendingProps,Y=D.elementType===j?Y:Ci(j,Y),NA(P,D,j,Y,R);case 1:return j=D.type,Y=D.pendingProps,Y=D.elementType===j?Y:Ci(j,Y),dp(P,D,j,Y,R);case 3:if(mg(D),j=D.updateQueue,j===null)throw Error(n(282));if(Y=D.memoizedState,Y=Y!==null?Y.element:null,me(D,j,D.pendingProps,null,R),j=D.memoizedState.element,j===Y)dg(),D=si(P,D,R);else{if((Y=D.stateNode.hydrate)&&(y?(Bc=cu(D.stateNode.containerInfo),Aa=D,Y=Il=!0):Y=!1),Y)for(R=ig(D,null,j,R),D.child=R;R;)R.effectTag=R.effectTag&-3|1024,R=R.sibling;else ws(P,D,j,R),dg();D=D.child}return D;case 5:return Pm(D),P===null&&RA(D),j=D.type,Y=D.pendingProps,fe=P!==null?P.memoizedProps:null,ve=Y.children,Qe(j,Y)?ve=null:fe!==null&&Qe(j,fe)&&(D.effectTag|=16),Go(P,D),D.mode&4&&R!==1&&be(j,Y)?(D.expirationTime=D.childExpirationTime=1,D=null):(ws(P,D,ve,R),D=D.child),D;case 6:return P===null&&RA(D),null;case 13:return ln(P,D,R);case 4:return sg(D,D.stateNode.containerInfo),j=D.pendingProps,P===null?D.child=gu(D,null,j,R):ws(P,D,j,R),D.child;case 11:return j=D.type,Y=D.pendingProps,Y=D.elementType===j?Y:Ci(j,Y),Ii(P,D,j,Y,R);case 7:return ws(P,D,D.pendingProps,R),D.child;case 8:return ws(P,D,D.pendingProps.children,R),D.child;case 12:return ws(P,D,D.pendingProps.children,R),D.child;case 10:e:{if(j=D.type._context,Y=D.pendingProps,ve=D.memoizedProps,fe=Y.value,Ho(D,fe),ve!==null){var vt=ve.value;if(fe=hs(vt,fe)?0:(typeof j._calculateChangedBits=="function"?j._calculateChangedBits(vt,fe):1073741823)|0,fe===0){if(ve.children===Y.children&&!_i.current){D=si(P,D,R);break e}}else for(vt=D.child,vt!==null&&(vt.return=D);vt!==null;){var wt=vt.dependencies;if(wt!==null){ve=vt.child;for(var bt=wt.firstContext;bt!==null;){if(bt.context===j&&(bt.observedBits&fe)!==0){vt.tag===1&&(bt=ys(R,null),bt.tag=2,tt(vt,bt)),vt.expirationTime"u")return!1;var D=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(D.isDisabled||!D.supportsFiber)return!0;try{var R=D.inject(P);xw=function(j){try{D.onCommitFiberRoot(R,j,void 0,(j.current.effectTag&64)===64)}catch{}},bw=function(j){try{D.onCommitFiberUnmount(R,j)}catch{}}}catch{}return!0}function IF(P,D,R,j){this.tag=P,this.key=R,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=D,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=j,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function Dl(P,D,R,j){return new IF(P,D,R,j)}function kw(P){return P=P.prototype,!(!P||!P.isReactComponent)}function BF(P){if(typeof P=="function")return kw(P)?1:0;if(P!=null){if(P=P.$$typeof,P===L)return 11;if(P===te)return 14}return 2}function YA(P,D){var R=P.alternate;return R===null?(R=Dl(P.tag,D,P.key,P.mode),R.elementType=P.elementType,R.type=P.type,R.stateNode=P.stateNode,R.alternate=P,P.alternate=R):(R.pendingProps=D,R.effectTag=0,R.nextEffect=null,R.firstEffect=null,R.lastEffect=null),R.childExpirationTime=P.childExpirationTime,R.expirationTime=P.expirationTime,R.child=P.child,R.memoizedProps=P.memoizedProps,R.memoizedState=P.memoizedState,R.updateQueue=P.updateQueue,D=P.dependencies,R.dependencies=D===null?null:{expirationTime:D.expirationTime,firstContext:D.firstContext,responders:D.responders},R.sibling=P.sibling,R.index=P.index,R.ref=P.ref,R}function Hm(P,D,R,j,Y,fe){var ve=2;if(j=P,typeof P=="function")kw(P)&&(ve=1);else if(typeof P=="string")ve=5;else e:switch(P){case E:return xu(R.children,Y,fe,D);case T:ve=8,Y|=7;break;case I:ve=8,Y|=1;break;case v:return P=Dl(12,R,D,Y|8),P.elementType=v,P.type=v,P.expirationTime=fe,P;case U:return P=Dl(13,R,D,Y),P.type=U,P.elementType=U,P.expirationTime=fe,P;case J:return P=Dl(19,R,D,Y),P.elementType=J,P.expirationTime=fe,P;default:if(typeof P=="object"&&P!==null)switch(P.$$typeof){case b:ve=10;break e;case C:ve=9;break e;case L:ve=11;break e;case te:ve=14;break e;case le:ve=16,j=null;break e}throw Error(n(130,P==null?P:typeof P,""))}return D=Dl(ve,R,D,Y),D.elementType=P,D.type=j,D.expirationTime=fe,D}function xu(P,D,R,j){return P=Dl(7,P,j,D),P.expirationTime=R,P}function Qw(P,D,R){return P=Dl(6,P,null,D),P.expirationTime=R,P}function Fw(P,D,R){return D=Dl(4,P.children!==null?P.children:[],P.key,D),D.expirationTime=R,D.stateNode={containerInfo:P.containerInfo,pendingChildren:null,implementation:P.implementation},D}function vF(P,D,R){this.tag=D,this.current=null,this.containerInfo=P,this.pingCache=this.pendingChildren=null,this.finishedExpirationTime=0,this.finishedWork=null,this.timeoutHandle=He,this.pendingContext=this.context=null,this.hydrate=R,this.callbackNode=null,this.callbackPriority=90,this.lastExpiredTime=this.lastPingedTime=this.nextKnownPendingLevel=this.lastSuspendedTime=this.firstSuspendedTime=this.firstPendingTime=0}function $v(P,D){var R=P.firstSuspendedTime;return P=P.lastSuspendedTime,R!==0&&R>=D&&P<=D}function WA(P,D){var R=P.firstSuspendedTime,j=P.lastSuspendedTime;RD||R===0)&&(P.lastSuspendedTime=D),D<=P.lastPingedTime&&(P.lastPingedTime=0),D<=P.lastExpiredTime&&(P.lastExpiredTime=0)}function eD(P,D){D>P.firstPendingTime&&(P.firstPendingTime=D);var R=P.firstSuspendedTime;R!==0&&(D>=R?P.firstSuspendedTime=P.lastSuspendedTime=P.nextKnownPendingLevel=0:D>=P.lastSuspendedTime&&(P.lastSuspendedTime=D+1),D>P.nextKnownPendingLevel&&(P.nextKnownPendingLevel=D))}function jm(P,D){var R=P.lastExpiredTime;(R===0||R>D)&&(P.lastExpiredTime=D)}function tD(P){var D=P._reactInternalFiber;if(D===void 0)throw typeof P.render=="function"?Error(n(188)):Error(n(268,Object.keys(P)));return P=Ee(D),P===null?null:P.stateNode}function rD(P,D){P=P.memoizedState,P!==null&&P.dehydrated!==null&&P.retryTime{"use strict";bEe.exports=xEe()});var FEe=_((yVt,QEe)=>{"use strict";var Wyt={ALIGN_COUNT:8,ALIGN_AUTO:0,ALIGN_FLEX_START:1,ALIGN_CENTER:2,ALIGN_FLEX_END:3,ALIGN_STRETCH:4,ALIGN_BASELINE:5,ALIGN_SPACE_BETWEEN:6,ALIGN_SPACE_AROUND:7,DIMENSION_COUNT:2,DIMENSION_WIDTH:0,DIMENSION_HEIGHT:1,DIRECTION_COUNT:3,DIRECTION_INHERIT:0,DIRECTION_LTR:1,DIRECTION_RTL:2,DISPLAY_COUNT:2,DISPLAY_FLEX:0,DISPLAY_NONE:1,EDGE_COUNT:9,EDGE_LEFT:0,EDGE_TOP:1,EDGE_RIGHT:2,EDGE_BOTTOM:3,EDGE_START:4,EDGE_END:5,EDGE_HORIZONTAL:6,EDGE_VERTICAL:7,EDGE_ALL:8,EXPERIMENTAL_FEATURE_COUNT:1,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:0,FLEX_DIRECTION_COUNT:4,FLEX_DIRECTION_COLUMN:0,FLEX_DIRECTION_COLUMN_REVERSE:1,FLEX_DIRECTION_ROW:2,FLEX_DIRECTION_ROW_REVERSE:3,JUSTIFY_COUNT:6,JUSTIFY_FLEX_START:0,JUSTIFY_CENTER:1,JUSTIFY_FLEX_END:2,JUSTIFY_SPACE_BETWEEN:3,JUSTIFY_SPACE_AROUND:4,JUSTIFY_SPACE_EVENLY:5,LOG_LEVEL_COUNT:6,LOG_LEVEL_ERROR:0,LOG_LEVEL_WARN:1,LOG_LEVEL_INFO:2,LOG_LEVEL_DEBUG:3,LOG_LEVEL_VERBOSE:4,LOG_LEVEL_FATAL:5,MEASURE_MODE_COUNT:3,MEASURE_MODE_UNDEFINED:0,MEASURE_MODE_EXACTLY:1,MEASURE_MODE_AT_MOST:2,NODE_TYPE_COUNT:2,NODE_TYPE_DEFAULT:0,NODE_TYPE_TEXT:1,OVERFLOW_COUNT:3,OVERFLOW_VISIBLE:0,OVERFLOW_HIDDEN:1,OVERFLOW_SCROLL:2,POSITION_TYPE_COUNT:2,POSITION_TYPE_RELATIVE:0,POSITION_TYPE_ABSOLUTE:1,PRINT_OPTIONS_COUNT:3,PRINT_OPTIONS_LAYOUT:1,PRINT_OPTIONS_STYLE:2,PRINT_OPTIONS_CHILDREN:4,UNIT_COUNT:4,UNIT_UNDEFINED:0,UNIT_POINT:1,UNIT_PERCENT:2,UNIT_AUTO:3,WRAP_COUNT:3,WRAP_NO_WRAP:0,WRAP_WRAP:1,WRAP_WRAP_REVERSE:2};QEe.exports=Wyt});var LEe=_((EVt,NEe)=>{"use strict";var Vyt=Object.assign||function(t){for(var e=1;e"}}]),t}(),TEe=function(){Kk(t,null,[{key:"fromJS",value:function(r){var o=r.width,a=r.height;return new t(o,a)}}]);function t(e,r){k6(this,t),this.width=e,this.height=r}return Kk(t,[{key:"fromJS",value:function(r){r(this.width,this.height)}},{key:"toString",value:function(){return""}}]),t}(),REe=function(){function t(e,r){k6(this,t),this.unit=e,this.value=r}return Kk(t,[{key:"fromJS",value:function(r){r(this.unit,this.value)}},{key:"toString",value:function(){switch(this.unit){case tu.UNIT_POINT:return String(this.value);case tu.UNIT_PERCENT:return this.value+"%";case tu.UNIT_AUTO:return"auto";default:return this.value+"?"}}},{key:"valueOf",value:function(){return this.value}}]),t}();NEe.exports=function(t,e){function r(u,A,p){var h=u[A];u[A]=function(){for(var E=arguments.length,I=Array(E),v=0;v1?I-1:0),b=1;b1&&arguments[1]!==void 0?arguments[1]:NaN,p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:tu.DIRECTION_LTR;return u.call(this,A,p,h)}),Vyt({Config:e.Config,Node:e.Node,Layout:t("Layout",Kyt),Size:t("Size",TEe),Value:t("Value",REe),getInstanceCount:function(){return e.getInstanceCount.apply(e,arguments)}},tu)}});var MEe=_((exports,module)=>{(function(t,e){typeof define=="function"&&define.amd?define([],function(){return e}):typeof module=="object"&&module.exports?module.exports=e:(t.nbind=t.nbind||{}).init=e})(exports,function(Module,cb){typeof Module=="function"&&(cb=Module,Module={}),Module.onRuntimeInitialized=function(t,e){return function(){t&&t.apply(this,arguments);try{Module.ccall("nbind_init")}catch(r){e(r);return}e(null,{bind:Module._nbind_value,reflect:Module.NBind.reflect,queryType:Module.NBind.queryType,toggleLightGC:Module.toggleLightGC,lib:Module})}}(Module.onRuntimeInitialized,cb);var Module;Module||(Module=(typeof Module<"u"?Module:null)||{});var moduleOverrides={};for(var key in Module)Module.hasOwnProperty(key)&&(moduleOverrides[key]=Module[key]);var ENVIRONMENT_IS_WEB=!1,ENVIRONMENT_IS_WORKER=!1,ENVIRONMENT_IS_NODE=!1,ENVIRONMENT_IS_SHELL=!1;if(Module.ENVIRONMENT)if(Module.ENVIRONMENT==="WEB")ENVIRONMENT_IS_WEB=!0;else if(Module.ENVIRONMENT==="WORKER")ENVIRONMENT_IS_WORKER=!0;else if(Module.ENVIRONMENT==="NODE")ENVIRONMENT_IS_NODE=!0;else if(Module.ENVIRONMENT==="SHELL")ENVIRONMENT_IS_SHELL=!0;else throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");else ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof importScripts=="function",ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof Be=="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){Module.print||(Module.print=console.log),Module.printErr||(Module.printErr=console.warn);var nodeFS,nodePath;Module.read=function(e,r){nodeFS||(nodeFS={}("")),nodePath||(nodePath={}("")),e=nodePath.normalize(e);var o=nodeFS.readFileSync(e);return r?o:o.toString()},Module.readBinary=function(e){var r=Module.read(e,!0);return r.buffer||(r=new Uint8Array(r)),assert(r.buffer),r},Module.load=function(e){globalEval(read(e))},Module.thisProgram||(process.argv.length>1?Module.thisProgram=process.argv[1].replace(/\\/g,"/"):Module.thisProgram="unknown-program"),Module.arguments=process.argv.slice(2),typeof module<"u"&&(module.exports=Module),Module.inspect=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL)Module.print||(Module.print=print),typeof printErr<"u"&&(Module.printErr=printErr),typeof read<"u"?Module.read=read:Module.read=function(){throw"no read() available"},Module.readBinary=function(e){if(typeof readbuffer=="function")return new Uint8Array(readbuffer(e));var r=read(e,"binary");return assert(typeof r=="object"),r},typeof scriptArgs<"u"?Module.arguments=scriptArgs:typeof arguments<"u"&&(Module.arguments=arguments),typeof quit=="function"&&(Module.quit=function(t,e){quit(t)});else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(Module.read=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},ENVIRONMENT_IS_WORKER&&(Module.readBinary=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),Module.readAsync=function(e,r,o){var a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType="arraybuffer",a.onload=function(){a.status==200||a.status==0&&a.response?r(a.response):o()},a.onerror=o,a.send(null)},typeof arguments<"u"&&(Module.arguments=arguments),typeof console<"u")Module.print||(Module.print=function(e){console.log(e)}),Module.printErr||(Module.printErr=function(e){console.warn(e)});else{var TRY_USE_DUMP=!1;Module.print||(Module.print=TRY_USE_DUMP&&typeof dump<"u"?function(t){dump(t)}:function(t){})}ENVIRONMENT_IS_WORKER&&(Module.load=importScripts),typeof Module.setWindowTitle>"u"&&(Module.setWindowTitle=function(t){document.title=t})}else throw"Unknown runtime environment. Where are we?";function globalEval(t){eval.call(null,t)}!Module.load&&Module.read&&(Module.load=function(e){globalEval(Module.read(e))}),Module.print||(Module.print=function(){}),Module.printErr||(Module.printErr=Module.print),Module.arguments||(Module.arguments=[]),Module.thisProgram||(Module.thisProgram="./this.program"),Module.quit||(Module.quit=function(t,e){throw e}),Module.print=Module.print,Module.printErr=Module.printErr,Module.preRun=[],Module.postRun=[];for(var key in moduleOverrides)moduleOverrides.hasOwnProperty(key)&&(Module[key]=moduleOverrides[key]);moduleOverrides=void 0;var Runtime={setTempRet0:function(t){return tempRet0=t,t},getTempRet0:function(){return tempRet0},stackSave:function(){return STACKTOP},stackRestore:function(t){STACKTOP=t},getNativeTypeSize:function(t){switch(t){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(t[t.length-1]==="*")return Runtime.QUANTUM_SIZE;if(t[0]==="i"){var e=parseInt(t.substr(1));return assert(e%8===0),e/8}else return 0}}},getNativeFieldSize:function(t){return Math.max(Runtime.getNativeTypeSize(t),Runtime.QUANTUM_SIZE)},STACK_ALIGN:16,prepVararg:function(t,e){return e==="double"||e==="i64"?t&7&&(assert((t&7)===4),t+=4):assert((t&3)===0),t},getAlignSize:function(t,e,r){return!r&&(t=="i64"||t=="double")?8:t?Math.min(e||(t?Runtime.getNativeFieldSize(t):0),Runtime.QUANTUM_SIZE):Math.min(e,8)},dynCall:function(t,e,r){return r&&r.length?Module["dynCall_"+t].apply(null,[e].concat(r)):Module["dynCall_"+t].call(null,e)},functionPointers:[],addFunction:function(t){for(var e=0;e>2],r=(e+t+15|0)&-16;if(HEAP32[DYNAMICTOP_PTR>>2]=r,r>=TOTAL_MEMORY){var o=enlargeMemory();if(!o)return HEAP32[DYNAMICTOP_PTR>>2]=e,0}return e},alignMemory:function(t,e){var r=t=Math.ceil(t/(e||16))*(e||16);return r},makeBigInt:function(t,e,r){var o=r?+(t>>>0)+ +(e>>>0)*4294967296:+(t>>>0)+ +(e|0)*4294967296;return o},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module.Runtime=Runtime;var ABORT=0,EXITSTATUS=0;function assert(t,e){t||abort("Assertion failed: "+e)}function getCFunc(ident){var func=Module["_"+ident];if(!func)try{func=eval("_"+ident)}catch(t){}return assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)"),func}var cwrap,ccall;(function(){var JSfuncs={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(t){var e=Runtime.stackAlloc(t.length);return writeArrayToMemory(t,e),e},stringToC:function(t){var e=0;if(t!=null&&t!==0){var r=(t.length<<2)+1;e=Runtime.stackAlloc(r),stringToUTF8(t,e,r)}return e}},toC={string:JSfuncs.stringToC,array:JSfuncs.arrayToC};ccall=function(e,r,o,a,n){var u=getCFunc(e),A=[],p=0;if(a)for(var h=0;h>0]=e;break;case"i8":HEAP8[t>>0]=e;break;case"i16":HEAP16[t>>1]=e;break;case"i32":HEAP32[t>>2]=e;break;case"i64":tempI64=[e>>>0,(tempDouble=e,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[t>>2]=tempI64[0],HEAP32[t+4>>2]=tempI64[1];break;case"float":HEAPF32[t>>2]=e;break;case"double":HEAPF64[t>>3]=e;break;default:abort("invalid type for setValue: "+r)}}Module.setValue=setValue;function getValue(t,e,r){switch(e=e||"i8",e.charAt(e.length-1)==="*"&&(e="i32"),e){case"i1":return HEAP8[t>>0];case"i8":return HEAP8[t>>0];case"i16":return HEAP16[t>>1];case"i32":return HEAP32[t>>2];case"i64":return HEAP32[t>>2];case"float":return HEAPF32[t>>2];case"double":return HEAPF64[t>>3];default:abort("invalid type for setValue: "+e)}return null}Module.getValue=getValue;var ALLOC_NORMAL=0,ALLOC_STACK=1,ALLOC_STATIC=2,ALLOC_DYNAMIC=3,ALLOC_NONE=4;Module.ALLOC_NORMAL=ALLOC_NORMAL,Module.ALLOC_STACK=ALLOC_STACK,Module.ALLOC_STATIC=ALLOC_STATIC,Module.ALLOC_DYNAMIC=ALLOC_DYNAMIC,Module.ALLOC_NONE=ALLOC_NONE;function allocate(t,e,r,o){var a,n;typeof t=="number"?(a=!0,n=t):(a=!1,n=t.length);var u=typeof e=="string"?e:null,A;if(r==ALLOC_NONE?A=o:A=[typeof _malloc=="function"?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][r===void 0?ALLOC_STATIC:r](Math.max(n,u?1:e.length)),a){var o=A,p;for(assert((A&3)==0),p=A+(n&-4);o>2]=0;for(p=A+n;o>0]=0;return A}if(u==="i8")return t.subarray||t.slice?HEAPU8.set(t,A):HEAPU8.set(new Uint8Array(t),A),A;for(var h=0,E,I,v;h>0],r|=o,!(o==0&&!e||(a++,e&&a==e)););e||(e=a);var n="";if(r<128){for(var u=1024,A;e>0;)A=String.fromCharCode.apply(String,HEAPU8.subarray(t,t+Math.min(e,u))),n=n?n+A:A,t+=u,e-=u;return n}return Module.UTF8ToString(t)}Module.Pointer_stringify=Pointer_stringify;function AsciiToString(t){for(var e="";;){var r=HEAP8[t++>>0];if(!r)return e;e+=String.fromCharCode(r)}}Module.AsciiToString=AsciiToString;function stringToAscii(t,e){return writeAsciiToMemory(t,e,!1)}Module.stringToAscii=stringToAscii;var UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function UTF8ArrayToString(t,e){for(var r=e;t[r];)++r;if(r-e>16&&t.subarray&&UTF8Decoder)return UTF8Decoder.decode(t.subarray(e,r));for(var o,a,n,u,A,p,h="";;){if(o=t[e++],!o)return h;if(!(o&128)){h+=String.fromCharCode(o);continue}if(a=t[e++]&63,(o&224)==192){h+=String.fromCharCode((o&31)<<6|a);continue}if(n=t[e++]&63,(o&240)==224?o=(o&15)<<12|a<<6|n:(u=t[e++]&63,(o&248)==240?o=(o&7)<<18|a<<12|n<<6|u:(A=t[e++]&63,(o&252)==248?o=(o&3)<<24|a<<18|n<<12|u<<6|A:(p=t[e++]&63,o=(o&1)<<30|a<<24|n<<18|u<<12|A<<6|p))),o<65536)h+=String.fromCharCode(o);else{var E=o-65536;h+=String.fromCharCode(55296|E>>10,56320|E&1023)}}}Module.UTF8ArrayToString=UTF8ArrayToString;function UTF8ToString(t){return UTF8ArrayToString(HEAPU8,t)}Module.UTF8ToString=UTF8ToString;function stringToUTF8Array(t,e,r,o){if(!(o>0))return 0;for(var a=r,n=r+o-1,u=0;u=55296&&A<=57343&&(A=65536+((A&1023)<<10)|t.charCodeAt(++u)&1023),A<=127){if(r>=n)break;e[r++]=A}else if(A<=2047){if(r+1>=n)break;e[r++]=192|A>>6,e[r++]=128|A&63}else if(A<=65535){if(r+2>=n)break;e[r++]=224|A>>12,e[r++]=128|A>>6&63,e[r++]=128|A&63}else if(A<=2097151){if(r+3>=n)break;e[r++]=240|A>>18,e[r++]=128|A>>12&63,e[r++]=128|A>>6&63,e[r++]=128|A&63}else if(A<=67108863){if(r+4>=n)break;e[r++]=248|A>>24,e[r++]=128|A>>18&63,e[r++]=128|A>>12&63,e[r++]=128|A>>6&63,e[r++]=128|A&63}else{if(r+5>=n)break;e[r++]=252|A>>30,e[r++]=128|A>>24&63,e[r++]=128|A>>18&63,e[r++]=128|A>>12&63,e[r++]=128|A>>6&63,e[r++]=128|A&63}}return e[r]=0,r-a}Module.stringToUTF8Array=stringToUTF8Array;function stringToUTF8(t,e,r){return stringToUTF8Array(t,HEAPU8,e,r)}Module.stringToUTF8=stringToUTF8;function lengthBytesUTF8(t){for(var e=0,r=0;r=55296&&o<=57343&&(o=65536+((o&1023)<<10)|t.charCodeAt(++r)&1023),o<=127?++e:o<=2047?e+=2:o<=65535?e+=3:o<=2097151?e+=4:o<=67108863?e+=5:e+=6}return e}Module.lengthBytesUTF8=lengthBytesUTF8;var UTF16Decoder=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function demangle(t){var e=Module.___cxa_demangle||Module.__cxa_demangle;if(e){try{var r=t.substr(1),o=lengthBytesUTF8(r)+1,a=_malloc(o);stringToUTF8(r,a,o);var n=_malloc(4),u=e(a,0,0,n);if(getValue(n,"i32")===0&&u)return Pointer_stringify(u)}catch{}finally{a&&_free(a),n&&_free(n),u&&_free(u)}return t}return Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),t}function demangleAll(t){var e=/__Z[\w\d_]+/g;return t.replace(e,function(r){var o=demangle(r);return r===o?r:r+" ["+o+"]"})}function jsStackTrace(){var t=new Error;if(!t.stack){try{throw new Error(0)}catch(e){t=e}if(!t.stack)return"(no stack trace available)"}return t.stack.toString()}function stackTrace(){var t=jsStackTrace();return Module.extraStackTrace&&(t+=` +`+Module.extraStackTrace()),demangleAll(t)}Module.stackTrace=stackTrace;var HEAP,buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed,STACK_BASE,STACKTOP,STACK_MAX,DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0,staticSealed=!1;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module.TOTAL_STACK||5242880,TOTAL_MEMORY=Module.TOTAL_MEMORY||134217728;TOTAL_MEMORY0;){var e=t.shift();if(typeof e=="function"){e();continue}var r=e.func;typeof r=="number"?e.arg===void 0?Module.dynCall_v(r):Module.dynCall_vi(r,e.arg):r(e.arg===void 0?null:e.arg)}}var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATEXIT__=[],__ATPOSTRUN__=[],runtimeInitialized=!1,runtimeExited=!1;function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__),runtimeExited=!0}function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(t){__ATPRERUN__.unshift(t)}Module.addOnPreRun=addOnPreRun;function addOnInit(t){__ATINIT__.unshift(t)}Module.addOnInit=addOnInit;function addOnPreMain(t){__ATMAIN__.unshift(t)}Module.addOnPreMain=addOnPreMain;function addOnExit(t){__ATEXIT__.unshift(t)}Module.addOnExit=addOnExit;function addOnPostRun(t){__ATPOSTRUN__.unshift(t)}Module.addOnPostRun=addOnPostRun;function intArrayFromString(t,e,r){var o=r>0?r:lengthBytesUTF8(t)+1,a=new Array(o),n=stringToUTF8Array(t,a,0,a.length);return e&&(a.length=n),a}Module.intArrayFromString=intArrayFromString;function intArrayToString(t){for(var e=[],r=0;r255&&(o&=255),e.push(String.fromCharCode(o))}return e.join("")}Module.intArrayToString=intArrayToString;function writeStringToMemory(t,e,r){Runtime.warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");var o,a;r&&(a=e+lengthBytesUTF8(t),o=HEAP8[a]),stringToUTF8(t,e,1/0),r&&(HEAP8[a]=o)}Module.writeStringToMemory=writeStringToMemory;function writeArrayToMemory(t,e){HEAP8.set(t,e)}Module.writeArrayToMemory=writeArrayToMemory;function writeAsciiToMemory(t,e,r){for(var o=0;o>0]=t.charCodeAt(o);r||(HEAP8[e>>0]=0)}if(Module.writeAsciiToMemory=writeAsciiToMemory,(!Math.imul||Math.imul(4294967295,5)!==-5)&&(Math.imul=function t(e,r){var o=e>>>16,a=e&65535,n=r>>>16,u=r&65535;return a*u+(o*u+a*n<<16)|0}),Math.imul=Math.imul,!Math.fround){var froundBuffer=new Float32Array(1);Math.fround=function(t){return froundBuffer[0]=t,froundBuffer[0]}}Math.fround=Math.fround,Math.clz32||(Math.clz32=function(t){t=t>>>0;for(var e=0;e<32;e++)if(t&1<<31-e)return e;return 32}),Math.clz32=Math.clz32,Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Math.trunc=Math.trunc;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_round=Math.round,Math_min=Math.min,Math_clz32=Math.clz32,Math_trunc=Math.trunc,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function getUniqueRunDependency(t){return t}function addRunDependency(t){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies)}Module.addRunDependency=addRunDependency;function removeRunDependency(t){if(runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),runDependencies==0&&(runDependencyWatcher!==null&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled)){var e=dependenciesFulfilled;dependenciesFulfilled=null,e()}}Module.removeRunDependency=removeRunDependency,Module.preloadedImages={},Module.preloadedAudios={};var ASM_CONSTS=[function(t,e,r,o,a,n,u,A){return _nbind.callbackSignatureList[t].apply(this,arguments)}];function _emscripten_asm_const_iiiiiiii(t,e,r,o,a,n,u,A){return ASM_CONSTS[t](e,r,o,a,n,u,A)}function _emscripten_asm_const_iiiii(t,e,r,o,a){return ASM_CONSTS[t](e,r,o,a)}function _emscripten_asm_const_iiidddddd(t,e,r,o,a,n,u,A,p){return ASM_CONSTS[t](e,r,o,a,n,u,A,p)}function _emscripten_asm_const_iiididi(t,e,r,o,a,n,u){return ASM_CONSTS[t](e,r,o,a,n,u)}function _emscripten_asm_const_iiii(t,e,r,o){return ASM_CONSTS[t](e,r,o)}function _emscripten_asm_const_iiiid(t,e,r,o,a){return ASM_CONSTS[t](e,r,o,a)}function _emscripten_asm_const_iiiiii(t,e,r,o,a,n){return ASM_CONSTS[t](e,r,o,a,n)}STATIC_BASE=Runtime.GLOBAL_BASE,STATICTOP=STATIC_BASE+12800,__ATINIT__.push({func:function(){__GLOBAL__sub_I_Yoga_cpp()}},{func:function(){__GLOBAL__sub_I_nbind_cc()}},{func:function(){__GLOBAL__sub_I_common_cc()}},{func:function(){__GLOBAL__sub_I_Binding_cc()}}),allocate([0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,127,0,0,192,127,0,0,192,127,0,0,192,127,3,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,3,0,0,0,0,0,192,127,3,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,0,0,192,127,0,0,0,0,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0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,128,191,0,0,128,191,0,0,192,127,0,0,0,0,0,0,0,0,0,0,128,63,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,190,12,0,0,200,12,0,0,208,12,0,0,216,12,0,0,230,12,0,0,242,12,0,0,1,0,0,0,3,0,0,0,0,0,0,0,2,0,0,0,0,0,192,127,3,0,0,0,180,45,0,0,181,45,0,0,182,45,0,0,181,45,0,0,182,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,1,0,0,0,4,0,0,0,183,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,181,45,0,0,184,45,0,0,185,45,0,0,181,45,0,0,181,45,0,0,182,45,0,0,186,45,0,0,185,45,0,0,148,4,0,0,3,0,0,0,187,45,0,0,164,4,0,0,188,45,0,0,2,0,0,0,189,45,0,0,164,4,0,0,188,45,0,0,185,45,0,0,164,4,0,0,185,45,0,0,164,4,0,0,188,45,0,0,181,45,0,0,182,45,0,0,181,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,5,0,0,0,6,0,0,0,1,0,0,0,7,0,0,0,183,45,0,0,182,45,0,0,181,45,0,0,190,45,0,0,190,45,0,0,182,45,0,0,182,45,0,0,185,45,0,0,181,45,0,0,185,45,0,0,182,45,0,0,181,45,0,0,185,45,0,0,182,45,0,0,185,45,0,0,48,5,0,0,3,0,0,0,56,5,0,0,1,0,0,0,189,45,0,0,185,45,0,0,164,4,0,0,76,5,0,0,2,0,0,0,191,45,0,0,186,45,0,0,182,45,0,0,185,45,0,0,192,45,0,0,185,45,0,0,182,45,0,0,186,45,0,0,185,45,0,0,76,5,0,0,76,5,0,0,136,5,0,0,182,45,0,0,181,45,0,0,2,0,0,0,190,45,0,0,136,5,0,0,56,19,0,0,156,5,0,0,2,0,0,0,184,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,8,0,0,0,9,0,0,0,1,0,0,0,10,0,0,0,204,5,0,0,181,45,0,0,181,45,0,0,2,0,0,0,180,45,0,0,204,5,0,0,2,0,0,0,195,45,0,0,236,5,0,0,97,19,0,0,198,45,0,0,211,45,0,0,212,45,0,0,213,45,0,0,214,45,0,0,215,45,0,0,188,45,0,0,182,45,0,0,216,45,0,0,217,45,0,0,218,45,0,0,219,45,0,0,192,45,0,0,181,45,0,0,0,0,0,0,185,45,0,0,110,19,0,0,186,45,0,0,115,19,0,0,221,45,0,0,120,19,0,0,148,4,0,0,132,19,0,0,96,6,0,0,145,19,0,0,222,45,0,0,164,19,0,0,223,45,0,0,173,19,0,0,0,0,0,0,3,0,0,0,104,6,0,0,1,0,0,0,187,45,0,0,0,0,0,0,0,0,0,0,1,0,0,0,11,0,0,0,12,0,0,0,1,0,0,0,13,0,0,0,185,45,0,0,224,45,0,0,164,6,0,0,188,45,0,0,172,6,0,0,180,6,0,0,2,0,0,0,188,6,0,0,7,0,0,0,224,45,0,0,7,0,0,0,164,6,0,0,1,0,0,0,213,45,0,0,185,45,0,0,224,45,0,0,172,6,0,0,185,45,0,0,224,45,0,0,164,6,0,0,185,45,0,0,224,45,0,0,211,45,0,0,211,45,0,0,222,45,0,0,211,45,0,0,224,45,0,0,222,45,0,0,211,45,0,0,224,45,0,0,172,6,0,0,222,45,0,0,211,45,0,0,224,45,0,0,188,45,0,0,222,45,0,0,211,45,0,0,40,7,0,0,188,45,0,0,2,0,0,0,224,45,0,0,185,45,0,0,188,45,0,0,188,45,0,0,188,45,0,0,188,45,0,0,222,45,0,0,224,45,0,0,148,4,0,0,185,45,0,0,148,4,0,0,148,4,0,0,148,4,0,0,148,4,0,0,148,4,0,0,185,45,0,0,164,6,0,0,148,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,14,0,0,0,15,0,0,0,1,0,0,0,16,0,0,0,148,7,0,0,2,0,0,0,225,45,0,0,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100,32,110,111,116,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,32,102,111,114,32,110,111,100,101,0,67,97,110,110,111,116,32,114,101,115,101,116,32,97,32,110,111,100,101,32,119,104,105,99,104,32,115,116,105,108,108,32,104,97,115,32,99,104,105,108,100,114,101,110,32,97,116,116,97,99,104,101,100,0,67,97,110,110,111,116,32,114,101,115,101,116,32,97,32,110,111,100,101,32,115,116,105,108,108,32,97,116,116,97,99,104,101,100,32,116,111,32,97,32,112,97,114,101,110,116,0,67,111,117,108,100,32,110,111,116,32,97,108,108,111,99,97,116,101,32,109,101,109,111,114,121,32,102,111,114,32,99,111,110,102,105,103,0,67,97,110,110,111,116,32,115,101,116,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,58,32,78,111,100,101,115,32,119,105,116,104,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,32,99,97,110,110,111,116,32,104,97,118,101,32,99,104,105,108,100,114,101,110,46,0,67,104,105,108,100,32,97,108,114,101,97,100,121,32,104,97,115,32,97,32,112,97,114,101,110,116,44,32,105,116,32,109,117,115,116,32,98,101,32,114,101,109,111,118,101,100,32,102,105,114,115,116,46,0,67,97,110,110,111,116,32,97,100,100,32,99,104,105,108,100,58,32,78,111,100,101,115,32,119,105,116,104,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,32,99,97,110,110,111,116,32,104,97,118,101,32,99,104,105,108,100,114,101,110,46,0,79,110,108,121,32,108,101,97,102,32,110,111,100,101,115,32,119,105,116,104,32,99,117,115,116,111,109,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,115,115,104,111,117,108,100,32,109,97,110,117,97,108,108,121,32,109,97,114,107,32,116,104,101,109,115,101,108,118,101,115,32,97,115,32,100,105,114,116,121,0,67,97,110,110,111,116,32,103,101,116,32,108,97,121,111,117,116,32,112,114,111,112,101,114,116,105,101,115,32,111,102,32,109,117,108,116,105,45,101,100,103,101,32,115,104,111,114,116,104,97,110,100,115,0,37,115,37,100,46,123,91,115,107,105,112,112,101,100,93,32,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,97,119,58,32,37,102,32,97,104,58,32,37,102,32,61,62,32,100,58,32,40,37,102,44,32,37,102,41,32,37,115,10,0,37,115,37,100,46,123,37,115,0,42,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,97,119,58,32,37,102,32,97,104,58,32,37,102,32,37,115,10,0,37,115,37,100,46,125,37,115,0,119,109,58,32,37,115,44,32,104,109,58,32,37,115,44,32,100,58,32,40,37,102,44,32,37,102,41,32,37,115,10,0,79,117,116,32,111,102,32,99,97,99,104,101,32,101,110,116,114,105,101,115,33,10,0,83,99,97,108,101,32,102,97,99,116,111,114,32,115,104,111,117,108,100,32,110,111,116,32,98,101,32,108,101,115,115,32,116,104,97,110,32,122,101,114,111,0,105,110,105,116,105,97,108,0,37,115,10,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,85,78,68,69,70,73,78,69,68,0,69,88,65,67,84,76,89,0,65,84,95,77,79,83,84,0,76,65,89,95,85,78,68,69,70,73,78,69,68,0,76,65,89,95,69,88,65,67,84,76,89,0,76,65,89,95,65,84,95,77,79,83,84,0,97,118,97,105,108,97,98,108,101,87,105,100,116,104,32,105,115,32,105,110,100,101,102,105,110,105,116,101,32,115,111,32,119,105,100,116,104,77,101,97,115,117,114,101,77,111,100,101,32,109,117,115,116,32,98,101,32,89,71,77,101,97,115,117,114,101,77,111,100,101,85,110,100,101,102,105,110,101,100,0,97,118,97,105,108,97,98,108,101,72,101,105,103,104,116,32,105,115,32,105,110,100,101,102,105,110,105,116,101,32,115,111,32,104,101,105,103,104,116,77,101,97,115,117,114,101,77,111,100,101,32,109,117,115,116,32,98,101,32,89,71,77,101,97,115,117,114,101,77,111,100,101,85,110,100,101,102,105,110,101,100,0,102,108,101,120,0,115,116,114,101,116,99,104,0,109,117,108,116,105,108,105,110,101,45,115,116,114,101,116,99,104,0,69,120,112,101,99,116,101,100,32,110,111,100,101,32,116,111,32,104,97,118,101,32,99,117,115,116,111,109,32,109,101,97,115,117,114,101,32,102,117,110,99,116,105,111,110,0,109,101,97,115,117,114,101,0,69,120,112,101,99,116,32,99,117,115,116,111,109,32,98,97,115,101,108,105,110,101,32,102,117,110,99,116,105,111,110,32,116,111,32,110,111,116,32,114,101,116,117,114,110,32,78,97,78,0,97,98,115,45,109,101,97,115,117,114,101,0,97,98,115,45,108,97,121,111,117,116,0,78,111,100,101,0,99,114,101,97,116,101,68,101,102,97,117,108,116,0,99,114,101,97,116,101,87,105,116,104,67,111,110,102,105,103,0,100,101,115,116,114,111,121,0,114,101,115,101,116,0,99,111,112,121,83,116,121,108,101,0,115,101,116,80,111,115,105,116,105,111,110,84,121,112,101,0,115,101,116,80,111,115,105,116,105,111,110,0,115,101,116,80,111,115,105,116,105,111,110,80,101,114,99,101,110,116,0,115,101,116,65,108,105,103,110,67,111,110,116,101,110,116,0,115,101,116,65,108,105,103,110,73,116,101,109,115,0,115,101,116,65,108,105,103,110,83,101,108,102,0,115,101,116,70,108,101,120,68,105,114,101,99,116,105,111,110,0,115,101,116,70,108,101,120,87,114,97,112,0,115,101,116,74,117,115,116,105,102,121,67,111,110,116,101,110,116,0,115,101,116,77,97,114,103,105,110,0,115,101,116,77,97,114,103,105,110,80,101,114,99,101,110,116,0,115,101,116,77,97,114,103,105,110,65,117,116,111,0,115,101,116,79,118,101,114,102,108,111,119,0,115,101,116,68,105,115,112,108,97,121,0,115,101,116,70,108,101,120,0,115,101,116,70,108,101,120,66,97,115,105,115,0,115,101,116,70,108,101,120,66,97,115,105,115,80,101,114,99,101,110,116,0,115,101,116,70,108,101,120,71,114,111,119,0,115,101,116,70,108,101,120,83,104,114,105,110,107,0,115,101,116,87,105,100,116,104,0,115,101,116,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,87,105,100,116,104,65,117,116,111,0,115,101,116,72,101,105,103,104,116,0,115,101,116,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,72,101,105,103,104,116,65,117,116,111,0,115,101,116,77,105,110,87,105,100,116,104,0,115,101,116,77,105,110,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,77,105,110,72,101,105,103,104,116,0,115,101,116,77,105,110,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,77,97,120,87,105,100,116,104,0,115,101,116,77,97,120,87,105,100,116,104,80,101,114,99,101,110,116,0,115,101,116,77,97,120,72,101,105,103,104,116,0,115,101,116,77,97,120,72,101,105,103,104,116,80,101,114,99,101,110,116,0,115,101,116,65,115,112,101,99,116,82,97,116,105,111,0,115,101,116,66,111,114,100,101,114,0,115,101,116,80,97,100,100,105,110,103,0,115,101,116,80,97,100,100,105,110,103,80,101,114,99,101,110,116,0,103,101,116,80,111,115,105,116,105,111,110,84,121,112,101,0,103,101,116,80,111,115,105,116,105,111,110,0,103,101,116,65,108,105,103,110,67,111,110,116,101,110,116,0,103,101,116,65,108,105,103,110,73,116,101,109,115,0,103,101,116,65,108,105,103,110,83,101,108,102,0,103,101,116,70,108,101,120,68,105,114,101,99,116,105,111,110,0,103,101,116,70,108,101,120,87,114,97,112,0,103,101,116,74,117,115,116,105,102,121,67,111,110,116,101,110,116,0,103,101,116,77,97,114,103,105,110,0,103,101,116,70,108,101,120,66,97,115,105,115,0,103,101,116,70,108,101,120,71,114,111,119,0,103,101,116,70,108,101,120,83,104,114,105,110,107,0,103,101,116,87,105,100,116,104,0,103,101,116,72,101,105,103,104,116,0,103,101,116,77,105,110,87,105,100,116,104,0,103,101,116,77,105,110,72,101,105,103,104,116,0,103,101,116,77,97,120,87,105,100,116,104,0,103,101,116,77,97,120,72,101,105,103,104,116,0,103,101,116,65,115,112,101,99,116,82,97,116,105,111,0,103,101,116,66,111,114,100,101,114,0,103,101,116,79,118,101,114,102,108,111,119,0,103,101,116,68,105,115,112,108,97,121,0,103,101,116,80,97,100,100,105,110,103,0,105,110,115,101,114,116,67,104,105,108,100,0,114,101,109,111,118,101,67,104,105,108,100,0,103,101,116,67,104,105,108,100,67,111,117,110,116,0,103,101,116,80,97,114,101,110,116,0,103,101,116,67,104,105,108,100,0,115,101,116,77,101,97,115,117,114,101,70,117,110,99,0,117,110,115,101,116,77,101,97,115,117,114,101,70,117,110,99,0,109,97,114,107,68,105,114,116,121,0,105,115,68,105,114,116,121,0,99,97,108,99,117,108,97,116,101,76,97,121,111,117,116,0,103,101,116,67,111,109,112,117,116,101,100,76,101,102,116,0,103,101,116,67,111,109,112,117,116,101,100,82,105,103,104,116,0,103,101,116,67,111,109,112,117,116,101,100,84,111,112,0,103,101,116,67,111,109,112,117,116,101,100,66,111,116,116,111,109,0,103,101,116,67,111,109,112,117,116,101,100,87,105,100,116,104,0,103,101,116,67,111,109,112,117,116,101,100,72,101,105,103,104,116,0,103,101,116,67,111,109,112,117,116,101,100,76,97,121,111,117,116,0,103,101,116,67,111,109,112,117,116,101,100,77,97,114,103,105,110,0,103,101,116,67,111,109,112,117,116,101,100,66,111,114,100,101,114,0,103,101,116,67,111,109,112,117,116,101,100,80,97,100,100,105,110,103,0,67,111,110,102,105,103,0,99,114,101,97,116,101,0,115,101,116,69,120,112,101,114,105,109,101,110,116,97,108,70,101,97,116,117,114,101,69,110,97,98,108,101,100,0,115,101,116,80,111,105,110,116,83,99,97,108,101,70,97,99,116,111,114,0,105,115,69,120,112,101,114,105,109,101,110,116,97,108,70,101,97,116,117,114,101,69,110,97,98,108,101,100,0,86,97,108,117,101,0,76,97,121,111,117,116,0,83,105,122,101,0,103,101,116,73,110,115,116,97,110,99,101,67,111,117,110,116,0,73,110,116,54,52,0,1,1,1,2,2,4,4,4,4,8,8,4,8,118,111,105,100,0,98,111,111,108,0,115,116,100,58,58,115,116,114,105,110,103,0,99,98,70,117,110,99,116,105,111,110,32,38,0,99,111,110,115,116,32,99,98,70,117,110,99,116,105,111,110,32,38,0,69,120,116,101,114,110,97,108,0,66,117,102,102,101,114,0,78,66,105,110,100,73,68,0,78,66,105,110,100,0,98,105,110,100,95,118,97,108,117,101,0,114,101,102,108,101,99,116,0,113,117,101,114,121,84,121,112,101,0,108,97,108,108,111,99,0,108,114,101,115,101,116,0,123,114,101,116,117,114,110,40,95,110,98,105,110,100,46,99,97,108,108,98,97,99,107,83,105,103,110,97,116,117,114,101,76,105,115,116,91,36,48,93,46,97,112,112,108,121,40,116,104,105,115,44,97,114,103,117,109,101,110,116,115,41,41,59,125,0,95,110,98,105,110,100,95,110,101,119,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,46,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);var tempDoublePtr=STATICTOP;STATICTOP+=16;function _atexit(t,e){__ATEXIT__.unshift({func:t,arg:e})}function ___cxa_atexit(){return _atexit.apply(null,arguments)}function _abort(){Module.abort()}function __ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj(){Module.printErr("missing function: _ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj"),abort(-1)}function __decorate(t,e,r,o){var a=arguments.length,n=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,r):o,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,r,o);else for(var A=t.length-1;A>=0;A--)(u=t[A])&&(n=(a<3?u(n):a>3?u(e,r,n):u(e,r))||n);return a>3&&n&&Object.defineProperty(e,r,n),n}function _defineHidden(t){return function(e,r){Object.defineProperty(e,r,{configurable:!1,enumerable:!1,value:t,writable:!0})}}var _nbind={};function __nbind_free_external(t){_nbind.externalList[t].dereference(t)}function __nbind_reference_external(t){_nbind.externalList[t].reference()}function _llvm_stackrestore(t){var e=_llvm_stacksave,r=e.LLVM_SAVEDSTACKS[t];e.LLVM_SAVEDSTACKS.splice(t,1),Runtime.stackRestore(r)}function __nbind_register_pool(t,e,r,o){_nbind.Pool.pageSize=t,_nbind.Pool.usedPtr=e/4,_nbind.Pool.rootPtr=r,_nbind.Pool.pagePtr=o/4,HEAP32[e/4]=16909060,HEAP8[e]==1&&(_nbind.bigEndian=!0),HEAP32[e/4]=0,_nbind.makeTypeKindTbl=(n={},n[1024]=_nbind.PrimitiveType,n[64]=_nbind.Int64Type,n[2048]=_nbind.BindClass,n[3072]=_nbind.BindClassPtr,n[4096]=_nbind.SharedClassPtr,n[5120]=_nbind.ArrayType,n[6144]=_nbind.ArrayType,n[7168]=_nbind.CStringType,n[9216]=_nbind.CallbackType,n[10240]=_nbind.BindType,n),_nbind.makeTypeNameTbl={Buffer:_nbind.BufferType,External:_nbind.ExternalType,Int64:_nbind.Int64Type,_nbind_new:_nbind.CreateValueType,bool:_nbind.BooleanType,"cbFunction &":_nbind.CallbackType,"const cbFunction &":_nbind.CallbackType,"const std::string &":_nbind.StringType,"std::string":_nbind.StringType},Module.toggleLightGC=_nbind.toggleLightGC,_nbind.callUpcast=Module.dynCall_ii;var a=_nbind.makeType(_nbind.constructType,{flags:2048,id:0,name:""});a.proto=Module,_nbind.BindClass.list.push(a);var n}function _emscripten_set_main_loop_timing(t,e){if(Browser.mainLoop.timingMode=t,Browser.mainLoop.timingValue=e,!Browser.mainLoop.func)return 1;if(t==0)Browser.mainLoop.scheduler=function(){var u=Math.max(0,Browser.mainLoop.tickStartTime+e-_emscripten_get_now())|0;setTimeout(Browser.mainLoop.runner,u)},Browser.mainLoop.method="timeout";else if(t==1)Browser.mainLoop.scheduler=function(){Browser.requestAnimationFrame(Browser.mainLoop.runner)},Browser.mainLoop.method="rAF";else if(t==2){if(!window.setImmediate){let n=function(u){u.source===window&&u.data===o&&(u.stopPropagation(),r.shift()())};var a=n,r=[],o="setimmediate";window.addEventListener("message",n,!0),window.setImmediate=function(A){r.push(A),ENVIRONMENT_IS_WORKER?(Module.setImmediates===void 0&&(Module.setImmediates=[]),Module.setImmediates.push(A),window.postMessage({target:o})):window.postMessage(o,"*")}}Browser.mainLoop.scheduler=function(){window.setImmediate(Browser.mainLoop.runner)},Browser.mainLoop.method="immediate"}return 0}function _emscripten_get_now(){abort()}function _emscripten_set_main_loop(t,e,r,o,a){Module.noExitRuntime=!0,assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Browser.mainLoop.func=t,Browser.mainLoop.arg=o;var n;typeof o<"u"?n=function(){Module.dynCall_vi(t,o)}:n=function(){Module.dynCall_v(t)};var u=Browser.mainLoop.currentlyRunningMainloop;if(Browser.mainLoop.runner=function(){if(!ABORT){if(Browser.mainLoop.queue.length>0){var p=Date.now(),h=Browser.mainLoop.queue.shift();if(h.func(h.arg),Browser.mainLoop.remainingBlockers){var E=Browser.mainLoop.remainingBlockers,I=E%1==0?E-1:Math.floor(E);h.counted?Browser.mainLoop.remainingBlockers=I:(I=I+.5,Browser.mainLoop.remainingBlockers=(8*E+I)/9)}if(console.log('main loop blocker "'+h.name+'" took '+(Date.now()-p)+" ms"),Browser.mainLoop.updateStatus(),u1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}else Browser.mainLoop.timingMode==0&&(Browser.mainLoop.tickStartTime=_emscripten_get_now());Browser.mainLoop.method==="timeout"&&Module.ctx&&(Module.printErr("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!"),Browser.mainLoop.method=""),Browser.mainLoop.runIter(n),!(u0?_emscripten_set_main_loop_timing(0,1e3/e):_emscripten_set_main_loop_timing(1,1),Browser.mainLoop.scheduler()),r)throw"SimulateInfiniteLoop"}var Browser={mainLoop:{scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null,Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var t=Browser.mainLoop.timingMode,e=Browser.mainLoop.timingValue,r=Browser.mainLoop.func;Browser.mainLoop.func=null,_emscripten_set_main_loop(r,0,!1,Browser.mainLoop.arg,!0),_emscripten_set_main_loop_timing(t,e),Browser.mainLoop.scheduler()},updateStatus:function(){if(Module.setStatus){var t=Module.statusMessage||"Please wait...",e=Browser.mainLoop.remainingBlockers,r=Browser.mainLoop.expectedBlockers;e?e"u"&&(console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available."),Module.noImageDecoding=!0);var t={};t.canHandle=function(n){return!Module.noImageDecoding&&/\.(jpg|jpeg|png|bmp)$/i.test(n)},t.handle=function(n,u,A,p){var h=null;if(Browser.hasBlobConstructor)try{h=new Blob([n],{type:Browser.getMimetype(u)}),h.size!==n.length&&(h=new Blob([new Uint8Array(n).buffer],{type:Browser.getMimetype(u)}))}catch(b){Runtime.warnOnce("Blob constructor present but fails: "+b+"; falling back to blob builder")}if(!h){var E=new Browser.BlobBuilder;E.append(new Uint8Array(n).buffer),h=E.getBlob()}var I=Browser.URLObject.createObjectURL(h),v=new Image;v.onload=function(){assert(v.complete,"Image "+u+" could not be decoded");var C=document.createElement("canvas");C.width=v.width,C.height=v.height;var T=C.getContext("2d");T.drawImage(v,0,0),Module.preloadedImages[u]=C,Browser.URLObject.revokeObjectURL(I),A&&A(n)},v.onerror=function(C){console.log("Image "+I+" could not be decoded"),p&&p()},v.src=I},Module.preloadPlugins.push(t);var e={};e.canHandle=function(n){return!Module.noAudioDecoding&&n.substr(-4)in{".ogg":1,".wav":1,".mp3":1}},e.handle=function(n,u,A,p){var h=!1;function E(T){h||(h=!0,Module.preloadedAudios[u]=T,A&&A(n))}function I(){h||(h=!0,Module.preloadedAudios[u]=new Audio,p&&p())}if(Browser.hasBlobConstructor){try{var v=new Blob([n],{type:Browser.getMimetype(u)})}catch{return I()}var b=Browser.URLObject.createObjectURL(v),C=new Audio;C.addEventListener("canplaythrough",function(){E(C)},!1),C.onerror=function(L){if(h)return;console.log("warning: browser could not fully decode audio "+u+", trying slower base64 approach");function U(J){for(var te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",le="=",pe="",Ae=0,ye=0,ae=0;ae=6;){var we=Ae>>ye-6&63;ye-=6,pe+=te[we]}return ye==2?(pe+=te[(Ae&3)<<4],pe+=le+le):ye==4&&(pe+=te[(Ae&15)<<2],pe+=le),pe}C.src="data:audio/x-"+u.substr(-3)+";base64,"+U(n),E(C)},C.src=b,Browser.safeSetTimeout(function(){E(C)},1e4)}else return I()},Module.preloadPlugins.push(e);function r(){Browser.pointerLock=document.pointerLockElement===Module.canvas||document.mozPointerLockElement===Module.canvas||document.webkitPointerLockElement===Module.canvas||document.msPointerLockElement===Module.canvas}var o=Module.canvas;o&&(o.requestPointerLock=o.requestPointerLock||o.mozRequestPointerLock||o.webkitRequestPointerLock||o.msRequestPointerLock||function(){},o.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},o.exitPointerLock=o.exitPointerLock.bind(document),document.addEventListener("pointerlockchange",r,!1),document.addEventListener("mozpointerlockchange",r,!1),document.addEventListener("webkitpointerlockchange",r,!1),document.addEventListener("mspointerlockchange",r,!1),Module.elementPointerLock&&o.addEventListener("click",function(a){!Browser.pointerLock&&Module.canvas.requestPointerLock&&(Module.canvas.requestPointerLock(),a.preventDefault())},!1))},createContext:function(t,e,r,o){if(e&&Module.ctx&&t==Module.canvas)return Module.ctx;var a,n;if(e){var u={antialias:!1,alpha:!1};if(o)for(var A in o)u[A]=o[A];n=GL.createContext(t,u),n&&(a=GL.getContext(n).GLctx)}else a=t.getContext("2d");return a?(r&&(e||assert(typeof GLctx>"u","cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),Module.ctx=a,e&&GL.makeContextCurrent(n),Module.useWebGL=e,Browser.moduleContextCreatedCallbacks.forEach(function(p){p()}),Browser.init()),a):null},destroyContext:function(t,e,r){},fullscreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullscreen:function(t,e,r){Browser.lockPointer=t,Browser.resizeCanvas=e,Browser.vrDevice=r,typeof Browser.lockPointer>"u"&&(Browser.lockPointer=!0),typeof Browser.resizeCanvas>"u"&&(Browser.resizeCanvas=!1),typeof Browser.vrDevice>"u"&&(Browser.vrDevice=null);var o=Module.canvas;function a(){Browser.isFullscreen=!1;var u=o.parentNode;(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===u?(o.exitFullscreen=document.exitFullscreen||document.cancelFullScreen||document.mozCancelFullScreen||document.msExitFullscreen||document.webkitCancelFullScreen||function(){},o.exitFullscreen=o.exitFullscreen.bind(document),Browser.lockPointer&&o.requestPointerLock(),Browser.isFullscreen=!0,Browser.resizeCanvas&&Browser.setFullscreenCanvasSize()):(u.parentNode.insertBefore(o,u),u.parentNode.removeChild(u),Browser.resizeCanvas&&Browser.setWindowedCanvasSize()),Module.onFullScreen&&Module.onFullScreen(Browser.isFullscreen),Module.onFullscreen&&Module.onFullscreen(Browser.isFullscreen),Browser.updateCanvasDimensions(o)}Browser.fullscreenHandlersInstalled||(Browser.fullscreenHandlersInstalled=!0,document.addEventListener("fullscreenchange",a,!1),document.addEventListener("mozfullscreenchange",a,!1),document.addEventListener("webkitfullscreenchange",a,!1),document.addEventListener("MSFullscreenChange",a,!1));var n=document.createElement("div");o.parentNode.insertBefore(n,o),n.appendChild(o),n.requestFullscreen=n.requestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen||(n.webkitRequestFullscreen?function(){n.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}:null)||(n.webkitRequestFullScreen?function(){n.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),r?n.requestFullscreen({vrDisplay:r}):n.requestFullscreen()},requestFullScreen:function(t,e,r){return Module.printErr("Browser.requestFullScreen() is deprecated. Please call Browser.requestFullscreen instead."),Browser.requestFullScreen=function(o,a,n){return Browser.requestFullscreen(o,a,n)},Browser.requestFullscreen(t,e,r)},nextRAF:0,fakeRequestAnimationFrame:function(t){var e=Date.now();if(Browser.nextRAF===0)Browser.nextRAF=e+1e3/60;else for(;e+2>=Browser.nextRAF;)Browser.nextRAF+=1e3/60;var r=Math.max(Browser.nextRAF-e,0);setTimeout(t,r)},requestAnimationFrame:function t(e){typeof window>"u"?Browser.fakeRequestAnimationFrame(e):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||Browser.fakeRequestAnimationFrame),window.requestAnimationFrame(e))},safeCallback:function(t){return function(){if(!ABORT)return t.apply(null,arguments)}},allowAsyncCallbacks:!0,queuedAsyncCallbacks:[],pauseAsyncCallbacks:function(){Browser.allowAsyncCallbacks=!1},resumeAsyncCallbacks:function(){if(Browser.allowAsyncCallbacks=!0,Browser.queuedAsyncCallbacks.length>0){var t=Browser.queuedAsyncCallbacks;Browser.queuedAsyncCallbacks=[],t.forEach(function(e){e()})}},safeRequestAnimationFrame:function(t){return Browser.requestAnimationFrame(function(){ABORT||(Browser.allowAsyncCallbacks?t():Browser.queuedAsyncCallbacks.push(t))})},safeSetTimeout:function(t,e){return Module.noExitRuntime=!0,setTimeout(function(){ABORT||(Browser.allowAsyncCallbacks?t():Browser.queuedAsyncCallbacks.push(t))},e)},safeSetInterval:function(t,e){return Module.noExitRuntime=!0,setInterval(function(){ABORT||Browser.allowAsyncCallbacks&&t()},e)},getMimetype:function(t){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[t.substr(t.lastIndexOf(".")+1)]},getUserMedia:function(t){window.getUserMedia||(window.getUserMedia=navigator.getUserMedia||navigator.mozGetUserMedia),window.getUserMedia(t)},getMovementX:function(t){return t.movementX||t.mozMovementX||t.webkitMovementX||0},getMovementY:function(t){return t.movementY||t.mozMovementY||t.webkitMovementY||0},getMouseWheelDelta:function(t){var e=0;switch(t.type){case"DOMMouseScroll":e=t.detail;break;case"mousewheel":e=t.wheelDelta;break;case"wheel":e=t.deltaY;break;default:throw"unrecognized mouse wheel event: "+t.type}return e},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(t){if(Browser.pointerLock)t.type!="mousemove"&&"mozMovementX"in t?Browser.mouseMovementX=Browser.mouseMovementY=0:(Browser.mouseMovementX=Browser.getMovementX(t),Browser.mouseMovementY=Browser.getMovementY(t)),typeof SDL<"u"?(Browser.mouseX=SDL.mouseX+Browser.mouseMovementX,Browser.mouseY=SDL.mouseY+Browser.mouseMovementY):(Browser.mouseX+=Browser.mouseMovementX,Browser.mouseY+=Browser.mouseMovementY);else{var e=Module.canvas.getBoundingClientRect(),r=Module.canvas.width,o=Module.canvas.height,a=typeof window.scrollX<"u"?window.scrollX:window.pageXOffset,n=typeof window.scrollY<"u"?window.scrollY:window.pageYOffset;if(t.type==="touchstart"||t.type==="touchend"||t.type==="touchmove"){var u=t.touch;if(u===void 0)return;var A=u.pageX-(a+e.left),p=u.pageY-(n+e.top);A=A*(r/e.width),p=p*(o/e.height);var h={x:A,y:p};if(t.type==="touchstart")Browser.lastTouches[u.identifier]=h,Browser.touches[u.identifier]=h;else if(t.type==="touchend"||t.type==="touchmove"){var E=Browser.touches[u.identifier];E||(E=h),Browser.lastTouches[u.identifier]=E,Browser.touches[u.identifier]=h}return}var I=t.pageX-(a+e.left),v=t.pageY-(n+e.top);I=I*(r/e.width),v=v*(o/e.height),Browser.mouseMovementX=I-Browser.mouseX,Browser.mouseMovementY=v-Browser.mouseY,Browser.mouseX=I,Browser.mouseY=v}},asyncLoad:function(t,e,r,o){var a=o?"":"al "+t;Module.readAsync(t,function(n){assert(n,'Loading data file "'+t+'" failed (no arrayBuffer).'),e(new Uint8Array(n)),a&&removeRunDependency(a)},function(n){if(r)r();else throw'Loading data file "'+t+'" failed.'}),a&&addRunDependency(a)},resizeListeners:[],updateResizeListeners:function(){var t=Module.canvas;Browser.resizeListeners.forEach(function(e){e(t.width,t.height)})},setCanvasSize:function(t,e,r){var o=Module.canvas;Browser.updateCanvasDimensions(o,t,e),r||Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize:function(){if(typeof SDL<"u"){var t=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];t=t|8388608,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=t}Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL<"u"){var t=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];t=t&-8388609,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=t}Browser.updateResizeListeners()},updateCanvasDimensions:function(t,e,r){e&&r?(t.widthNative=e,t.heightNative=r):(e=t.widthNative,r=t.heightNative);var o=e,a=r;if(Module.forcedAspectRatio&&Module.forcedAspectRatio>0&&(o/a>2];return e},getStr:function(){var t=Pointer_stringify(SYSCALLS.get());return t},get64:function(){var t=SYSCALLS.get(),e=SYSCALLS.get();return t>=0?assert(e===0):assert(e===-1),t},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall6(t,e){SYSCALLS.varargs=e;try{var r=SYSCALLS.getStreamFromFD();return FS.close(r),0}catch(o){return(typeof FS>"u"||!(o instanceof FS.ErrnoError))&&abort(o),-o.errno}}function ___syscall54(t,e){SYSCALLS.varargs=e;try{return 0}catch(r){return(typeof FS>"u"||!(r instanceof FS.ErrnoError))&&abort(r),-r.errno}}function _typeModule(t){var e=[[0,1,"X"],[1,1,"const X"],[128,1,"X *"],[256,1,"X &"],[384,1,"X &&"],[512,1,"std::shared_ptr"],[640,1,"std::unique_ptr"],[5120,1,"std::vector"],[6144,2,"std::array"],[9216,-1,"std::function"]];function r(p,h,E,I,v,b){if(h==1){var C=I&896;(C==128||C==256||C==384)&&(p="X const")}var T;return b?T=E.replace("X",p).replace("Y",v):T=p.replace("X",E).replace("Y",v),T.replace(/([*&]) (?=[*&])/g,"$1")}function o(p,h,E,I,v){throw new Error(p+" type "+E.replace("X",h+"?")+(I?" with flag "+I:"")+" in "+v)}function a(p,h,E,I,v,b,C,T){b===void 0&&(b="X"),T===void 0&&(T=1);var L=E(p);if(L)return L;var U=I(p),J=U.placeholderFlag,te=e[J];C&&te&&(b=r(C[2],C[0],b,te[0],"?",!0));var le;J==0&&(le="Unbound"),J>=10&&(le="Corrupt"),T>20&&(le="Deeply nested"),le&&o(le,p,b,J,v||"?");var pe=U.paramList[0],Ae=a(pe,h,E,I,v,b,te,T+1),ye,ae={flags:te[0],id:p,name:"",paramList:[Ae]},we=[],Pe="?";switch(U.placeholderFlag){case 1:ye=Ae.spec;break;case 2:if((Ae.flags&15360)==1024&&Ae.spec.ptrSize==1){ae.flags=7168;break}case 3:case 6:case 5:ye=Ae.spec,Ae.flags&15360;break;case 8:Pe=""+U.paramList[1],ae.paramList.push(U.paramList[1]);break;case 9:for(var g=0,Ee=U.paramList[1];g>2]=t),t}function _llvm_stacksave(){var t=_llvm_stacksave;return t.LLVM_SAVEDSTACKS||(t.LLVM_SAVEDSTACKS=[]),t.LLVM_SAVEDSTACKS.push(Runtime.stackSave()),t.LLVM_SAVEDSTACKS.length-1}function ___syscall140(t,e){SYSCALLS.varargs=e;try{var r=SYSCALLS.getStreamFromFD(),o=SYSCALLS.get(),a=SYSCALLS.get(),n=SYSCALLS.get(),u=SYSCALLS.get(),A=a;return FS.llseek(r,A,u),HEAP32[n>>2]=r.position,r.getdents&&A===0&&u===0&&(r.getdents=null),0}catch(p){return(typeof FS>"u"||!(p instanceof FS.ErrnoError))&&abort(p),-p.errno}}function ___syscall146(t,e){SYSCALLS.varargs=e;try{var r=SYSCALLS.get(),o=SYSCALLS.get(),a=SYSCALLS.get(),n=0;___syscall146.buffer||(___syscall146.buffers=[null,[],[]],___syscall146.printChar=function(E,I){var v=___syscall146.buffers[E];assert(v),I===0||I===10?((E===1?Module.print:Module.printErr)(UTF8ArrayToString(v,0)),v.length=0):v.push(I)});for(var u=0;u>2],p=HEAP32[o+(u*8+4)>>2],h=0;h"u"||!(E instanceof FS.ErrnoError))&&abort(E),-E.errno}}function __nbind_finish(){for(var t=0,e=_nbind.BindClass.list;tt.pageSize/2||e>t.pageSize-r){var o=_nbind.typeNameTbl.NBind.proto;return o.lalloc(e)}else return HEAPU32[t.usedPtr]=r+e,t.rootPtr+r},t.lreset=function(e,r){var o=HEAPU32[t.pagePtr];if(o){var a=_nbind.typeNameTbl.NBind.proto;a.lreset(e,r)}else HEAPU32[t.usedPtr]=e},t}();_nbind.Pool=Pool;function constructType(t,e){var r=t==10240?_nbind.makeTypeNameTbl[e.name]||_nbind.BindType:_nbind.makeTypeKindTbl[t],o=new r(e);return typeIdTbl[e.id]=o,_nbind.typeNameTbl[e.name]=o,o}_nbind.constructType=constructType;function getType(t){return typeIdTbl[t]}_nbind.getType=getType;function queryType(t){var e=HEAPU8[t],r=_nbind.structureList[e][1];t/=4,r<0&&(++t,r=HEAPU32[t]+1);var o=Array.prototype.slice.call(HEAPU32.subarray(t+1,t+1+r));return e==9&&(o=[o[0],o.slice(1)]),{paramList:o,placeholderFlag:e}}_nbind.queryType=queryType;function getTypes(t,e){return t.map(function(r){return typeof r=="number"?_nbind.getComplexType(r,constructType,getType,queryType,e):_nbind.typeNameTbl[r]})}_nbind.getTypes=getTypes;function readTypeIdList(t,e){return Array.prototype.slice.call(HEAPU32,t/4,t/4+e)}_nbind.readTypeIdList=readTypeIdList;function readAsciiString(t){for(var e=t;HEAPU8[e++];);return String.fromCharCode.apply("",HEAPU8.subarray(t,e-1))}_nbind.readAsciiString=readAsciiString;function readPolicyList(t){var e={};if(t)for(;;){var r=HEAPU32[t/4];if(!r)break;e[readAsciiString(r)]=!0,t+=4}return e}_nbind.readPolicyList=readPolicyList;function getDynCall(t,e){var r={float32_t:"d",float64_t:"d",int64_t:"d",uint64_t:"d",void:"v"},o=t.map(function(n){return r[n.name]||"i"}).join(""),a=Module["dynCall_"+o];if(!a)throw new Error("dynCall_"+o+" not found for "+e+"("+t.map(function(n){return n.name}).join(", ")+")");return a}_nbind.getDynCall=getDynCall;function addMethod(t,e,r,o){var a=t[e];t.hasOwnProperty(e)&&a?((a.arity||a.arity===0)&&(a=_nbind.makeOverloader(a,a.arity),t[e]=a),a.addMethod(r,o)):(r.arity=o,t[e]=r)}_nbind.addMethod=addMethod;function throwError(t){throw new Error(t)}_nbind.throwError=throwError,_nbind.bigEndian=!1,_a=_typeModule(_typeModule),_nbind.Type=_a.Type,_nbind.makeType=_a.makeType,_nbind.getComplexType=_a.getComplexType,_nbind.structureList=_a.structureList;var BindType=function(t){__extends(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.heap=HEAPU32,r.ptrSize=4,r}return e.prototype.needsWireRead=function(r){return!!this.wireRead||!!this.makeWireRead},e.prototype.needsWireWrite=function(r){return!!this.wireWrite||!!this.makeWireWrite},e}(_nbind.Type);_nbind.BindType=BindType;var PrimitiveType=function(t){__extends(e,t);function e(r){var o=t.call(this,r)||this,a=r.flags&32?{32:HEAPF32,64:HEAPF64}:r.flags&8?{8:HEAPU8,16:HEAPU16,32:HEAPU32}:{8:HEAP8,16:HEAP16,32:HEAP32};return o.heap=a[r.ptrSize*8],o.ptrSize=r.ptrSize,o}return e.prototype.needsWireWrite=function(r){return!!r&&!!r.Strict},e.prototype.makeWireWrite=function(r,o){return o&&o.Strict&&function(a){if(typeof a=="number")return a;throw new Error("Type mismatch")}},e}(BindType);_nbind.PrimitiveType=PrimitiveType;function pushCString(t,e){if(t==null){if(e&&e.Nullable)return 0;throw new Error("Type mismatch")}if(e&&e.Strict){if(typeof t!="string")throw new Error("Type mismatch")}else t=t.toString();var r=Module.lengthBytesUTF8(t)+1,o=_nbind.Pool.lalloc(r);return Module.stringToUTF8Array(t,HEAPU8,o,r),o}_nbind.pushCString=pushCString;function popCString(t){return t===0?null:Module.Pointer_stringify(t)}_nbind.popCString=popCString;var CStringType=function(t){__extends(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.wireRead=popCString,r.wireWrite=pushCString,r.readResources=[_nbind.resources.pool],r.writeResources=[_nbind.resources.pool],r}return e.prototype.makeWireWrite=function(r,o){return function(a){return pushCString(a,o)}},e}(BindType);_nbind.CStringType=CStringType;var BooleanType=function(t){__extends(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.wireRead=function(o){return!!o},r}return e.prototype.needsWireWrite=function(r){return!!r&&!!r.Strict},e.prototype.makeWireRead=function(r){return"!!("+r+")"},e.prototype.makeWireWrite=function(r,o){return o&&o.Strict&&function(a){if(typeof a=="boolean")return a;throw new Error("Type mismatch")}||r},e}(BindType);_nbind.BooleanType=BooleanType;var Wrapper=function(){function t(){}return t.prototype.persist=function(){this.__nbindState|=1},t}();_nbind.Wrapper=Wrapper;function makeBound(t,e){var r=function(o){__extends(a,o);function a(n,u,A,p){var h=o.call(this)||this;if(!(h instanceof a))return new(Function.prototype.bind.apply(a,Array.prototype.concat.apply([null],arguments)));var E=u,I=A,v=p;if(n!==_nbind.ptrMarker){var b=h.__nbindConstructor.apply(h,arguments);E=4608,v=HEAPU32[b/4],I=HEAPU32[b/4+1]}var C={configurable:!0,enumerable:!1,value:null,writable:!1},T={__nbindFlags:E,__nbindPtr:I};v&&(T.__nbindShared=v,_nbind.mark(h));for(var L=0,U=Object.keys(T);L>=1;var r=_nbind.valueList[t];return _nbind.valueList[t]=firstFreeValue,firstFreeValue=t,r}else{if(e)return _nbind.popShared(t,e);throw new Error("Invalid value slot "+t)}}_nbind.popValue=popValue;var valueBase=18446744073709552e3;function push64(t){return typeof t=="number"?t:pushValue(t)*4096+valueBase}function pop64(t){return t=3?u=Buffer.from(n):u=new Buffer(n),u.copy(o)}else getBuffer(o).set(n)}}_nbind.commitBuffer=commitBuffer;var dirtyList=[],gcTimer=0;function sweep(){for(var t=0,e=dirtyList;t>2]=DYNAMIC_BASE,staticSealed=!0;function invoke_viiiii(t,e,r,o,a,n){try{Module.dynCall_viiiii(t,e,r,o,a,n)}catch(u){if(typeof u!="number"&&u!=="longjmp")throw u;Module.setThrew(1,0)}}function invoke_vif(t,e,r){try{Module.dynCall_vif(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_vid(t,e,r){try{Module.dynCall_vid(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_fiff(t,e,r,o){try{return Module.dynCall_fiff(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_vi(t,e){try{Module.dynCall_vi(t,e)}catch(r){if(typeof r!="number"&&r!=="longjmp")throw r;Module.setThrew(1,0)}}function invoke_vii(t,e,r){try{Module.dynCall_vii(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_ii(t,e){try{return Module.dynCall_ii(t,e)}catch(r){if(typeof r!="number"&&r!=="longjmp")throw r;Module.setThrew(1,0)}}function invoke_viddi(t,e,r,o,a){try{Module.dynCall_viddi(t,e,r,o,a)}catch(n){if(typeof n!="number"&&n!=="longjmp")throw n;Module.setThrew(1,0)}}function invoke_vidd(t,e,r,o){try{Module.dynCall_vidd(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_iiii(t,e,r,o){try{return Module.dynCall_iiii(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_diii(t,e,r,o){try{return Module.dynCall_diii(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_di(t,e){try{return Module.dynCall_di(t,e)}catch(r){if(typeof r!="number"&&r!=="longjmp")throw r;Module.setThrew(1,0)}}function invoke_iid(t,e,r){try{return Module.dynCall_iid(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_iii(t,e,r){try{return Module.dynCall_iii(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_viiddi(t,e,r,o,a,n){try{Module.dynCall_viiddi(t,e,r,o,a,n)}catch(u){if(typeof u!="number"&&u!=="longjmp")throw u;Module.setThrew(1,0)}}function invoke_viiiiii(t,e,r,o,a,n,u){try{Module.dynCall_viiiiii(t,e,r,o,a,n,u)}catch(A){if(typeof A!="number"&&A!=="longjmp")throw A;Module.setThrew(1,0)}}function invoke_dii(t,e,r){try{return Module.dynCall_dii(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_i(t){try{return Module.dynCall_i(t)}catch(e){if(typeof e!="number"&&e!=="longjmp")throw e;Module.setThrew(1,0)}}function invoke_iiiiii(t,e,r,o,a,n){try{return Module.dynCall_iiiiii(t,e,r,o,a,n)}catch(u){if(typeof u!="number"&&u!=="longjmp")throw u;Module.setThrew(1,0)}}function invoke_viiid(t,e,r,o,a){try{Module.dynCall_viiid(t,e,r,o,a)}catch(n){if(typeof n!="number"&&n!=="longjmp")throw n;Module.setThrew(1,0)}}function invoke_viififi(t,e,r,o,a,n,u){try{Module.dynCall_viififi(t,e,r,o,a,n,u)}catch(A){if(typeof A!="number"&&A!=="longjmp")throw A;Module.setThrew(1,0)}}function invoke_viii(t,e,r,o){try{Module.dynCall_viii(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_v(t){try{Module.dynCall_v(t)}catch(e){if(typeof e!="number"&&e!=="longjmp")throw e;Module.setThrew(1,0)}}function invoke_viid(t,e,r,o){try{Module.dynCall_viid(t,e,r,o)}catch(a){if(typeof a!="number"&&a!=="longjmp")throw a;Module.setThrew(1,0)}}function invoke_idd(t,e,r){try{return Module.dynCall_idd(t,e,r)}catch(o){if(typeof o!="number"&&o!=="longjmp")throw o;Module.setThrew(1,0)}}function invoke_viiii(t,e,r,o,a){try{Module.dynCall_viiii(t,e,r,o,a)}catch(n){if(typeof n!="number"&&n!=="longjmp")throw n;Module.setThrew(1,0)}}Module.asmGlobalArg={Math,Int8Array,Int16Array,Int32Array,Uint8Array,Uint16Array,Uint32Array,Float32Array,Float64Array,NaN:NaN,Infinity:1/0},Module.asmLibraryArg={abort,assert,enlargeMemory,getTotalMemory,abortOnCannotGrowMemory,invoke_viiiii,invoke_vif,invoke_vid,invoke_fiff,invoke_vi,invoke_vii,invoke_ii,invoke_viddi,invoke_vidd,invoke_iiii,invoke_diii,invoke_di,invoke_iid,invoke_iii,invoke_viiddi,invoke_viiiiii,invoke_dii,invoke_i,invoke_iiiiii,invoke_viiid,invoke_viififi,invoke_viii,invoke_v,invoke_viid,invoke_idd,invoke_viiii,_emscripten_asm_const_iiiii,_emscripten_asm_const_iiidddddd,_emscripten_asm_const_iiiid,__nbind_reference_external,_emscripten_asm_const_iiiiiiii,_removeAccessorPrefix,_typeModule,__nbind_register_pool,__decorate,_llvm_stackrestore,___cxa_atexit,__extends,__nbind_get_value_object,__ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj,_emscripten_set_main_loop_timing,__nbind_register_primitive,__nbind_register_type,_emscripten_memcpy_big,__nbind_register_function,___setErrNo,__nbind_register_class,__nbind_finish,_abort,_nbind_value,_llvm_stacksave,___syscall54,_defineHidden,_emscripten_set_main_loop,_emscripten_get_now,__nbind_register_callback_signature,_emscripten_asm_const_iiiiii,__nbind_free_external,_emscripten_asm_const_iiii,_emscripten_asm_const_iiididi,___syscall6,_atexit,___syscall140,___syscall146,DYNAMICTOP_PTR,tempDoublePtr,ABORT,STACKTOP,STACK_MAX,cttz_i8,___dso_handle};var asm=function(t,e,r){var o=new t.Int8Array(r),a=new t.Int16Array(r),n=new t.Int32Array(r),u=new t.Uint8Array(r),A=new t.Uint16Array(r),p=new t.Uint32Array(r),h=new t.Float32Array(r),E=new t.Float64Array(r),I=e.DYNAMICTOP_PTR|0,v=e.tempDoublePtr|0,b=e.ABORT|0,C=e.STACKTOP|0,T=e.STACK_MAX|0,L=e.cttz_i8|0,U=e.___dso_handle|0,J=0,te=0,le=0,pe=0,Ae=t.NaN,ye=t.Infinity,ae=0,we=0,Pe=0,g=0,Ee=0,De=0,ce=t.Math.floor,ne=t.Math.abs,ee=t.Math.sqrt,Ie=t.Math.pow,ke=t.Math.cos,ht=t.Math.sin,H=t.Math.tan,lt=t.Math.acos,Re=t.Math.asin,Qe=t.Math.atan,be=t.Math.atan2,_e=t.Math.exp,Te=t.Math.log,Je=t.Math.ceil,He=t.Math.imul,x=t.Math.min,w=t.Math.max,S=t.Math.clz32,y=t.Math.fround,F=e.abort,z=e.assert,X=e.enlargeMemory,Z=e.getTotalMemory,ie=e.abortOnCannotGrowMemory,Se=e.invoke_viiiii,Ne=e.invoke_vif,ot=e.invoke_vid,dt=e.invoke_fiff,jt=e.invoke_vi,$t=e.invoke_vii,xt=e.invoke_ii,an=e.invoke_viddi,Qr=e.invoke_vidd,mr=e.invoke_iiii,xr=e.invoke_diii,Wr=e.invoke_di,Vn=e.invoke_iid,Ns=e.invoke_iii,Ri=e.invoke_viiddi,ps=e.invoke_viiiiii,io=e.invoke_dii,Si=e.invoke_i,Ls=e.invoke_iiiiii,so=e.invoke_viiid,cc=e.invoke_viififi,cu=e.invoke_viii,ap=e.invoke_v,lp=e.invoke_viid,Ms=e.invoke_idd,Dn=e.invoke_viiii,oo=e._emscripten_asm_const_iiiii,Os=e._emscripten_asm_const_iiidddddd,ml=e._emscripten_asm_const_iiiid,yl=e.__nbind_reference_external,ao=e._emscripten_asm_const_iiiiiiii,Kn=e._removeAccessorPrefix,Mn=e._typeModule,Ni=e.__nbind_register_pool,On=e.__decorate,_i=e._llvm_stackrestore,tr=e.___cxa_atexit,Me=e.__extends,ii=e.__nbind_get_value_object,Oa=e.__ZN8facebook4yoga14YGNodeToStringEPNSt3__212basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6YGNode14YGPrintOptionsj,hr=e._emscripten_set_main_loop_timing,uc=e.__nbind_register_primitive,uu=e.__nbind_register_type,Ac=e._emscripten_memcpy_big,El=e.__nbind_register_function,vA=e.___setErrNo,Au=e.__nbind_register_class,Ce=e.__nbind_finish,Tt=e._abort,fc=e._nbind_value,Hi=e._llvm_stacksave,fu=e.___syscall54,Yt=e._defineHidden,Cl=e._emscripten_set_main_loop,DA=e._emscripten_get_now,cp=e.__nbind_register_callback_signature,pc=e._emscripten_asm_const_iiiiii,PA=e.__nbind_free_external,Qn=e._emscripten_asm_const_iiii,hi=e._emscripten_asm_const_iiididi,hc=e.___syscall6,SA=e._atexit,sa=e.___syscall140,Li=e.___syscall146,_o=y(0);let Ze=y(0);function lo(s){s=s|0;var l=0;return l=C,C=C+s|0,C=C+15&-16,l|0}function gc(){return C|0}function pu(s){s=s|0,C=s}function ji(s,l){s=s|0,l=l|0,C=s,T=l}function hu(s,l){s=s|0,l=l|0,J||(J=s,te=l)}function xA(s){s=s|0,De=s}function Ua(){return De|0}function dc(){var s=0,l=0;Dr(8104,8,400)|0,Dr(8504,408,540)|0,s=9044,l=s+44|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));o[9088]=0,o[9089]=1,n[2273]=0,n[2274]=948,n[2275]=948,tr(17,8104,U|0)|0}function hs(s){s=s|0,ft(s+948|0)}function _t(s){return s=y(s),((Du(s)|0)&2147483647)>>>0>2139095040|0}function Fn(s,l,c){s=s|0,l=l|0,c=c|0;e:do if(n[s+(l<<3)+4>>2]|0)s=s+(l<<3)|0;else{if((l|2|0)==3&&n[s+60>>2]|0){s=s+56|0;break}switch(l|0){case 0:case 2:case 4:case 5:{if(n[s+52>>2]|0){s=s+48|0;break e}break}default:}if(n[s+68>>2]|0){s=s+64|0;break}else{s=(l|1|0)==5?948:c;break}}while(0);return s|0}function Ci(s){s=s|0;var l=0;return l=pD(1e3)|0,oa(s,(l|0)!=0,2456),n[2276]=(n[2276]|0)+1,Dr(l|0,8104,1e3)|0,o[s+2>>0]|0&&(n[l+4>>2]=2,n[l+12>>2]=4),n[l+976>>2]=s,l|0}function oa(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;d=C,C=C+16|0,f=d,l||(n[f>>2]=c,yg(s,5,3197,f)),C=d}function co(){return Ci(956)|0}function Us(s){s=s|0;var l=0;return l=Vt(1e3)|0,aa(l,s),oa(n[s+976>>2]|0,1,2456),n[2276]=(n[2276]|0)+1,n[l+944>>2]=0,l|0}function aa(s,l){s=s|0,l=l|0;var c=0;Dr(s|0,l|0,948)|0,Fm(s+948|0,l+948|0),c=s+960|0,s=l+960|0,l=c+40|0;do n[c>>2]=n[s>>2],c=c+4|0,s=s+4|0;while((c|0)<(l|0))}function la(s){s=s|0;var l=0,c=0,f=0,d=0;if(l=s+944|0,c=n[l>>2]|0,c|0&&(Ho(c+948|0,s)|0,n[l>>2]=0),c=wi(s)|0,c|0){l=0;do n[(gs(s,l)|0)+944>>2]=0,l=l+1|0;while((l|0)!=(c|0))}c=s+948|0,f=n[c>>2]|0,d=s+952|0,l=n[d>>2]|0,(l|0)!=(f|0)&&(n[d>>2]=l+(~((l+-4-f|0)>>>2)<<2)),ds(c),hD(s),n[2276]=(n[2276]|0)+-1}function Ho(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0;f=n[s>>2]|0,k=s+4|0,c=n[k>>2]|0,m=c;e:do if((f|0)==(c|0))d=f,B=4;else for(s=f;;){if((n[s>>2]|0)==(l|0)){d=s,B=4;break e}if(s=s+4|0,(s|0)==(c|0)){s=0;break}}while(0);return(B|0)==4&&((d|0)!=(c|0)?(f=d+4|0,s=m-f|0,l=s>>2,l&&(Mw(d|0,f|0,s|0)|0,c=n[k>>2]|0),s=d+(l<<2)|0,(c|0)==(s|0)||(n[k>>2]=c+(~((c+-4-s|0)>>>2)<<2)),s=1):s=0),s|0}function wi(s){return s=s|0,(n[s+952>>2]|0)-(n[s+948>>2]|0)>>2|0}function gs(s,l){s=s|0,l=l|0;var c=0;return c=n[s+948>>2]|0,(n[s+952>>2]|0)-c>>2>>>0>l>>>0?s=n[c+(l<<2)>>2]|0:s=0,s|0}function ds(s){s=s|0;var l=0,c=0,f=0,d=0;f=C,C=C+32|0,l=f,d=n[s>>2]|0,c=(n[s+4>>2]|0)-d|0,((n[s+8>>2]|0)-d|0)>>>0>c>>>0&&(d=c>>2,wp(l,d,d,s+8|0),Ig(s,l),UA(l)),C=f}function ms(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0;O=wi(s)|0;do if(O|0){if((n[(gs(s,0)|0)+944>>2]|0)==(s|0)){if(!(Ho(s+948|0,l)|0))break;Dr(l+400|0,8504,540)|0,n[l+944>>2]=0,Le(s);break}B=n[(n[s+976>>2]|0)+12>>2]|0,k=s+948|0,Q=(B|0)==0,c=0,m=0;do f=n[(n[k>>2]|0)+(m<<2)>>2]|0,(f|0)==(l|0)?Le(s):(d=Us(f)|0,n[(n[k>>2]|0)+(c<<2)>>2]=d,n[d+944>>2]=s,Q||LT[B&15](f,d,s,c),c=c+1|0),m=m+1|0;while((m|0)!=(O|0));if(c>>>0>>0){Q=s+948|0,k=s+952|0,B=c,c=n[k>>2]|0;do m=(n[Q>>2]|0)+(B<<2)|0,f=m+4|0,d=c-f|0,l=d>>2,l&&(Mw(m|0,f|0,d|0)|0,c=n[k>>2]|0),d=c,f=m+(l<<2)|0,(d|0)!=(f|0)&&(c=d+(~((d+-4-f|0)>>>2)<<2)|0,n[k>>2]=c),B=B+1|0;while((B|0)!=(O|0))}}while(0)}function _s(s){s=s|0;var l=0,c=0,f=0,d=0;Un(s,(wi(s)|0)==0,2491),Un(s,(n[s+944>>2]|0)==0,2545),l=s+948|0,c=n[l>>2]|0,f=s+952|0,d=n[f>>2]|0,(d|0)!=(c|0)&&(n[f>>2]=d+(~((d+-4-c|0)>>>2)<<2)),ds(l),l=s+976|0,c=n[l>>2]|0,Dr(s|0,8104,1e3)|0,o[c+2>>0]|0&&(n[s+4>>2]=2,n[s+12>>2]=4),n[l>>2]=c}function Un(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;d=C,C=C+16|0,f=d,l||(n[f>>2]=c,Ao(s,5,3197,f)),C=d}function Pn(){return n[2276]|0}function ys(){var s=0;return s=pD(20)|0,We((s|0)!=0,2592),n[2277]=(n[2277]|0)+1,n[s>>2]=n[239],n[s+4>>2]=n[240],n[s+8>>2]=n[241],n[s+12>>2]=n[242],n[s+16>>2]=n[243],s|0}function We(s,l){s=s|0,l=l|0;var c=0,f=0;f=C,C=C+16|0,c=f,s||(n[c>>2]=l,Ao(0,5,3197,c)),C=f}function tt(s){s=s|0,hD(s),n[2277]=(n[2277]|0)+-1}function It(s,l){s=s|0,l=l|0;var c=0;l?(Un(s,(wi(s)|0)==0,2629),c=1):(c=0,l=0),n[s+964>>2]=l,n[s+988>>2]=c}function nr(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,m=f+8|0,d=f+4|0,B=f,n[d>>2]=l,Un(s,(n[l+944>>2]|0)==0,2709),Un(s,(n[s+964>>2]|0)==0,2763),$(s),l=s+948|0,n[B>>2]=(n[l>>2]|0)+(c<<2),n[m>>2]=n[B>>2],me(l,m,d)|0,n[(n[d>>2]|0)+944>>2]=s,Le(s),C=f}function $(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0;if(c=wi(s)|0,c|0&&(n[(gs(s,0)|0)+944>>2]|0)!=(s|0)){f=n[(n[s+976>>2]|0)+12>>2]|0,d=s+948|0,m=(f|0)==0,l=0;do B=n[(n[d>>2]|0)+(l<<2)>>2]|0,k=Us(B)|0,n[(n[d>>2]|0)+(l<<2)>>2]=k,n[k+944>>2]=s,m||LT[f&15](B,k,s,l),l=l+1|0;while((l|0)!=(c|0))}}function me(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0,Ge=0,Oe=0,Fe=0,et=0,Xe=0;et=C,C=C+64|0,q=et+52|0,k=et+48|0,se=et+28|0,Ge=et+24|0,Oe=et+20|0,Fe=et,f=n[s>>2]|0,m=f,l=f+((n[l>>2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do{if(l=s+984|0,o[l>>0]|0)break;o[l>>0]=1,h[s+504>>2]=y(Ae),s=n[s+944>>2]|0}while((s|0)!=0)}function ft(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-4-f|0)>>>2)<<2)),gt(c))}function pt(s){return s=s|0,n[s+944>>2]|0}function Rt(s){s=s|0,Un(s,(n[s+964>>2]|0)!=0,2832),Le(s)}function er(s){return s=s|0,(o[s+984>>0]|0)!=0|0}function Zr(s,l){s=s|0,l=l|0,LUe(s,l,400)|0&&(Dr(s|0,l|0,400)|0,Le(s))}function qi(s){s=s|0;var l=Ze;return l=y(h[s+44>>2]),s=_t(l)|0,y(s?y(0):l)}function es(s){s=s|0;var l=Ze;return l=y(h[s+48>>2]),_t(l)|0&&(l=o[(n[s+976>>2]|0)+2>>0]|0?y(1):y(0)),y(l)}function xi(s,l){s=s|0,l=l|0,n[s+980>>2]=l}function jo(s){return s=s|0,n[s+980>>2]|0}function bA(s,l){s=s|0,l=l|0;var c=0;c=s+4|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Le(s))}function kA(s){return s=s|0,n[s+4>>2]|0}function up(s,l){s=s|0,l=l|0;var c=0;c=s+8|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Le(s))}function ng(s){return s=s|0,n[s+8>>2]|0}function gu(s,l){s=s|0,l=l|0;var c=0;c=s+12|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Le(s))}function ig(s){return s=s|0,n[s+12>>2]|0}function du(s,l){s=s|0,l=l|0;var c=0;c=s+16|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Le(s))}function uo(s){return s=s|0,n[s+16>>2]|0}function QA(s,l){s=s|0,l=l|0;var c=0;c=s+20|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Le(s))}function mc(s){return s=s|0,n[s+20>>2]|0}function ca(s,l){s=s|0,l=l|0;var c=0;c=s+24|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Le(s))}function sg(s){return s=s|0,n[s+24>>2]|0}function yc(s,l){s=s|0,l=l|0;var c=0;c=s+28|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Le(s))}function Pm(s){return s=s|0,n[s+28>>2]|0}function og(s,l){s=s|0,l=l|0;var c=0;c=s+32|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Le(s))}function $n(s){return s=s|0,n[s+32>>2]|0}function Ap(s,l){s=s|0,l=l|0;var c=0;c=s+36|0,(n[c>>2]|0)!=(l|0)&&(n[c>>2]=l,Le(s))}function ag(s){return s=s|0,n[s+36>>2]|0}function FA(s,l){s=s|0,l=y(l);var c=0;c=s+40|0,y(h[c>>2])!=l&&(h[c>>2]=l,Le(s))}function Hs(s,l){s=s|0,l=y(l);var c=0;c=s+44|0,y(h[c>>2])!=l&&(h[c>>2]=l,Le(s))}function mu(s,l){s=s|0,l=y(l);var c=0;c=s+48|0,y(h[c>>2])!=l&&(h[c>>2]=l,Le(s))}function Ha(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=_t(l)|0,c=(m^1)&1,f=s+52|0,d=s+56|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Le(s))}function Gi(s,l){s=s|0,l=y(l);var c=0,f=0;f=s+52|0,c=s+56|0,y(h[f>>2])==l&&(n[c>>2]|0)==2||(h[f>>2]=l,f=_t(l)|0,n[c>>2]=f?3:2,Le(s))}function ua(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+52|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function yu(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=_t(c)|0,f=(m^1)&1,d=s+132+(l<<3)|0,l=s+132+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Le(s))}function Es(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=_t(c)|0,f=m?0:2,d=s+132+(l<<3)|0,l=s+132+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Le(s))}function Ec(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=l+132+(c<<3)|0,l=n[f+4>>2]|0,c=s,n[c>>2]=n[f>>2],n[c+4>>2]=l}function Cc(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=_t(c)|0,f=(m^1)&1,d=s+60+(l<<3)|0,l=s+60+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Le(s))}function G(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=_t(c)|0,f=m?0:2,d=s+60+(l<<3)|0,l=s+60+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Le(s))}function Dt(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=l+60+(c<<3)|0,l=n[f+4>>2]|0,c=s,n[c>>2]=n[f>>2],n[c+4>>2]=l}function wl(s,l){s=s|0,l=l|0;var c=0;c=s+60+(l<<3)+4|0,(n[c>>2]|0)!=3&&(h[s+60+(l<<3)>>2]=y(Ae),n[c>>2]=3,Le(s))}function bi(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=_t(c)|0,f=(m^1)&1,d=s+204+(l<<3)|0,l=s+204+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Le(s))}function wc(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=_t(c)|0,f=m?0:2,d=s+204+(l<<3)|0,l=s+204+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Le(s))}function ct(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=l+204+(c<<3)|0,l=n[f+4>>2]|0,c=s,n[c>>2]=n[f>>2],n[c+4>>2]=l}function Eu(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0,m=0;m=_t(c)|0,f=(m^1)&1,d=s+276+(l<<3)|0,l=s+276+(l<<3)+4|0,m|y(h[d>>2])==c&&(n[l>>2]|0)==(f|0)||(h[d>>2]=c,n[l>>2]=f,Le(s))}function lg(s,l){return s=s|0,l=l|0,y(h[s+276+(l<<3)>>2])}function mw(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=_t(l)|0,c=(m^1)&1,f=s+348|0,d=s+352|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Le(s))}function TA(s,l){s=s|0,l=y(l);var c=0,f=0;f=s+348|0,c=s+352|0,y(h[f>>2])==l&&(n[c>>2]|0)==2||(h[f>>2]=l,f=_t(l)|0,n[c>>2]=f?3:2,Le(s))}function fp(s){s=s|0;var l=0;l=s+352|0,(n[l>>2]|0)!=3&&(h[s+348>>2]=y(Ae),n[l>>2]=3,Le(s))}function Br(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+348|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function Cs(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=_t(l)|0,c=(m^1)&1,f=s+356|0,d=s+360|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Le(s))}function cg(s,l){s=s|0,l=y(l);var c=0,f=0;f=s+356|0,c=s+360|0,y(h[f>>2])==l&&(n[c>>2]|0)==2||(h[f>>2]=l,f=_t(l)|0,n[c>>2]=f?3:2,Le(s))}function ug(s){s=s|0;var l=0;l=s+360|0,(n[l>>2]|0)!=3&&(h[s+356>>2]=y(Ae),n[l>>2]=3,Le(s))}function Ag(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+356|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function pp(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=_t(l)|0,c=(m^1)&1,f=s+364|0,d=s+368|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Le(s))}function Ic(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=_t(l)|0,c=m?0:2,f=s+364|0,d=s+368|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Le(s))}function Ct(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+364|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function Sm(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=_t(l)|0,c=(m^1)&1,f=s+372|0,d=s+376|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Le(s))}function fg(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=_t(l)|0,c=m?0:2,f=s+372|0,d=s+376|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Le(s))}function pg(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+372|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function Cu(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=_t(l)|0,c=(m^1)&1,f=s+380|0,d=s+384|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Le(s))}function xm(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=_t(l)|0,c=m?0:2,f=s+380|0,d=s+384|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Le(s))}function hg(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+380|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function wu(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=_t(l)|0,c=(m^1)&1,f=s+388|0,d=s+392|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Le(s))}function yw(s,l){s=s|0,l=y(l);var c=0,f=0,d=0,m=0;m=_t(l)|0,c=m?0:2,f=s+388|0,d=s+392|0,m|y(h[f>>2])==l&&(n[d>>2]|0)==(c|0)||(h[f>>2]=l,n[d>>2]=c,Le(s))}function bm(s,l){s=s|0,l=l|0;var c=0,f=0;f=l+388|0,c=n[f+4>>2]|0,l=s,n[l>>2]=n[f>>2],n[l+4>>2]=c}function Aa(s,l){s=s|0,l=y(l);var c=0;c=s+396|0,y(h[c>>2])!=l&&(h[c>>2]=l,Le(s))}function Bc(s){return s=s|0,y(h[s+396>>2])}function Il(s){return s=s|0,y(h[s+400>>2])}function Iu(s){return s=s|0,y(h[s+404>>2])}function gg(s){return s=s|0,y(h[s+408>>2])}function RA(s){return s=s|0,y(h[s+412>>2])}function hp(s){return s=s|0,y(h[s+416>>2])}function ja(s){return s=s|0,y(h[s+420>>2])}function dg(s,l){switch(s=s|0,l=l|0,Un(s,(l|0)<6,2918),l|0){case 0:{l=(n[s+496>>2]|0)==2?5:4;break}case 2:{l=(n[s+496>>2]|0)==2?4:5;break}default:}return y(h[s+424+(l<<2)>>2])}function gp(s,l){switch(s=s|0,l=l|0,Un(s,(l|0)<6,2918),l|0){case 0:{l=(n[s+496>>2]|0)==2?5:4;break}case 2:{l=(n[s+496>>2]|0)==2?4:5;break}default:}return y(h[s+448+(l<<2)>>2])}function qo(s,l){switch(s=s|0,l=l|0,Un(s,(l|0)<6,2918),l|0){case 0:{l=(n[s+496>>2]|0)==2?5:4;break}case 2:{l=(n[s+496>>2]|0)==2?4:5;break}default:}return y(h[s+472+(l<<2)>>2])}function ws(s,l){s=s|0,l=l|0;var c=0,f=Ze;return c=n[s+4>>2]|0,(c|0)==(n[l+4>>2]|0)?c?(f=y(h[s>>2]),s=y(ne(y(f-y(h[l>>2]))))>2]=0,n[f+4>>2]=0,n[f+8>>2]=0,Oa(f|0,s|0,l|0,0),Ao(s,3,(o[f+11>>0]|0)<0?n[f>>2]|0:f,c),s3e(f),C=c}function Go(s,l,c,f){s=y(s),l=y(l),c=c|0,f=f|0;var d=Ze;s=y(s*l),d=y(kT(s,y(1)));do if(Ii(d,y(0))|0)s=y(s-d);else{if(s=y(s-d),Ii(d,y(1))|0){s=y(s+y(1));break}if(c){s=y(s+y(1));break}f||(d>y(.5)?d=y(1):(f=Ii(d,y(.5))|0,d=y(f?1:0)),s=y(s+d))}while(0);return y(s/l)}function NA(s,l,c,f,d,m,B,k,Q,O,M,q,se){s=s|0,l=y(l),c=c|0,f=y(f),d=d|0,m=y(m),B=B|0,k=y(k),Q=y(Q),O=y(O),M=y(M),q=y(q),se=se|0;var Ge=0,Oe=Ze,Fe=Ze,et=Ze,Xe=Ze,at=Ze,Ue=Ze;return Q>2]),Oe!=y(0))?(et=y(Go(l,Oe,0,0)),Xe=y(Go(f,Oe,0,0)),Fe=y(Go(m,Oe,0,0)),Oe=y(Go(k,Oe,0,0))):(Fe=m,et=l,Oe=k,Xe=f),(d|0)==(s|0)?Ge=Ii(Fe,et)|0:Ge=0,(B|0)==(c|0)?se=Ii(Oe,Xe)|0:se=0,!Ge&&(at=y(l-M),!(dp(s,at,Q)|0))&&!(mp(s,at,d,Q)|0)?Ge=mg(s,at,d,m,Q)|0:Ge=1,!se&&(Ue=y(f-q),!(dp(c,Ue,O)|0))&&!(mp(c,Ue,B,O)|0)?se=mg(c,Ue,B,k,O)|0:se=1,se=Ge&se),se|0}function dp(s,l,c){return s=s|0,l=y(l),c=y(c),(s|0)==1?s=Ii(l,c)|0:s=0,s|0}function mp(s,l,c,f){return s=s|0,l=y(l),c=c|0,f=y(f),(s|0)==2&(c|0)==0?l>=f?s=1:s=Ii(l,f)|0:s=0,s|0}function mg(s,l,c,f,d){return s=s|0,l=y(l),c=c|0,f=y(f),d=y(d),(s|0)==2&(c|0)==2&f>l?d<=l?s=1:s=Ii(l,d)|0:s=0,s|0}function fa(s,l,c,f,d,m,B,k,Q,O,M){s=s|0,l=y(l),c=y(c),f=f|0,d=d|0,m=m|0,B=y(B),k=y(k),Q=Q|0,O=O|0,M=M|0;var q=0,se=0,Ge=0,Oe=0,Fe=Ze,et=Ze,Xe=0,at=0,Ue=0,qe=0,Lt=0,Or=0,or=0,Xt=0,Pr=0,Nr=0,ir=0,bn=Ze,go=Ze,mo=Ze,yo=0,ya=0;ir=C,C=C+160|0,Xt=ir+152|0,or=ir+120|0,Or=ir+104|0,Ue=ir+72|0,Oe=ir+56|0,Lt=ir+8|0,at=ir,qe=(n[2279]|0)+1|0,n[2279]=qe,Pr=s+984|0,(o[Pr>>0]|0)!=0&&(n[s+512>>2]|0)!=(n[2278]|0)?Xe=4:(n[s+516>>2]|0)==(f|0)?Nr=0:Xe=4,(Xe|0)==4&&(n[s+520>>2]=0,n[s+924>>2]=-1,n[s+928>>2]=-1,h[s+932>>2]=y(-1),h[s+936>>2]=y(-1),Nr=1);e:do if(n[s+964>>2]|0)if(Fe=y(ln(s,2,B)),et=y(ln(s,0,B)),q=s+916|0,mo=y(h[q>>2]),go=y(h[s+920>>2]),bn=y(h[s+932>>2]),NA(d,l,m,c,n[s+924>>2]|0,mo,n[s+928>>2]|0,go,bn,y(h[s+936>>2]),Fe,et,M)|0)Xe=22;else if(Ge=n[s+520>>2]|0,!Ge)Xe=21;else for(se=0;;){if(q=s+524+(se*24|0)|0,bn=y(h[q>>2]),go=y(h[s+524+(se*24|0)+4>>2]),mo=y(h[s+524+(se*24|0)+16>>2]),NA(d,l,m,c,n[s+524+(se*24|0)+8>>2]|0,bn,n[s+524+(se*24|0)+12>>2]|0,go,mo,y(h[s+524+(se*24|0)+20>>2]),Fe,et,M)|0){Xe=22;break e}if(se=se+1|0,se>>>0>=Ge>>>0){Xe=21;break}}else{if(Q){if(q=s+916|0,!(Ii(y(h[q>>2]),l)|0)){Xe=21;break}if(!(Ii(y(h[s+920>>2]),c)|0)){Xe=21;break}if((n[s+924>>2]|0)!=(d|0)){Xe=21;break}q=(n[s+928>>2]|0)==(m|0)?q:0,Xe=22;break}if(Ge=n[s+520>>2]|0,!Ge)Xe=21;else for(se=0;;){if(q=s+524+(se*24|0)|0,Ii(y(h[q>>2]),l)|0&&Ii(y(h[s+524+(se*24|0)+4>>2]),c)|0&&(n[s+524+(se*24|0)+8>>2]|0)==(d|0)&&(n[s+524+(se*24|0)+12>>2]|0)==(m|0)){Xe=22;break e}if(se=se+1|0,se>>>0>=Ge>>>0){Xe=21;break}}}while(0);do if((Xe|0)==21)o[11697]|0?(q=0,Xe=28):(q=0,Xe=31);else if((Xe|0)==22){if(se=(o[11697]|0)!=0,!((q|0)!=0&(Nr^1)))if(se){Xe=28;break}else{Xe=31;break}Oe=q+16|0,n[s+908>>2]=n[Oe>>2],Ge=q+20|0,n[s+912>>2]=n[Ge>>2],(o[11698]|0)==0|se^1||(n[at>>2]=LA(qe)|0,n[at+4>>2]=qe,Ao(s,4,2972,at),se=n[s+972>>2]|0,se|0&&ef[se&127](s),d=qa(d,Q)|0,m=qa(m,Q)|0,ya=+y(h[Oe>>2]),yo=+y(h[Ge>>2]),n[Lt>>2]=d,n[Lt+4>>2]=m,E[Lt+8>>3]=+l,E[Lt+16>>3]=+c,E[Lt+24>>3]=ya,E[Lt+32>>3]=yo,n[Lt+40>>2]=O,Ao(s,4,2989,Lt))}while(0);return(Xe|0)==28&&(se=LA(qe)|0,n[Oe>>2]=se,n[Oe+4>>2]=qe,n[Oe+8>>2]=Nr?3047:11699,Ao(s,4,3038,Oe),se=n[s+972>>2]|0,se|0&&ef[se&127](s),Lt=qa(d,Q)|0,Xe=qa(m,Q)|0,n[Ue>>2]=Lt,n[Ue+4>>2]=Xe,E[Ue+8>>3]=+l,E[Ue+16>>3]=+c,n[Ue+24>>2]=O,Ao(s,4,3049,Ue),Xe=31),(Xe|0)==31&&(si(s,l,c,f,d,m,B,k,Q,M),o[11697]|0&&(se=n[2279]|0,Lt=LA(se)|0,n[Or>>2]=Lt,n[Or+4>>2]=se,n[Or+8>>2]=Nr?3047:11699,Ao(s,4,3083,Or),se=n[s+972>>2]|0,se|0&&ef[se&127](s),Lt=qa(d,Q)|0,Or=qa(m,Q)|0,yo=+y(h[s+908>>2]),ya=+y(h[s+912>>2]),n[or>>2]=Lt,n[or+4>>2]=Or,E[or+8>>3]=yo,E[or+16>>3]=ya,n[or+24>>2]=O,Ao(s,4,3092,or)),n[s+516>>2]=f,q||(se=s+520|0,q=n[se>>2]|0,(q|0)==16&&(o[11697]|0&&Ao(s,4,3124,Xt),n[se>>2]=0,q=0),Q?q=s+916|0:(n[se>>2]=q+1,q=s+524+(q*24|0)|0),h[q>>2]=l,h[q+4>>2]=c,n[q+8>>2]=d,n[q+12>>2]=m,n[q+16>>2]=n[s+908>>2],n[q+20>>2]=n[s+912>>2],q=0)),Q&&(n[s+416>>2]=n[s+908>>2],n[s+420>>2]=n[s+912>>2],o[s+985>>0]=1,o[Pr>>0]=0),n[2279]=(n[2279]|0)+-1,n[s+512>>2]=n[2278],C=ir,Nr|(q|0)==0|0}function ln(s,l,c){s=s|0,l=l|0,c=y(c);var f=Ze;return f=y(V(s,l,c)),y(f+y(re(s,l,c)))}function Ao(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=C,C=C+16|0,d=m,n[d>>2]=f,s?f=n[s+976>>2]|0:f=0,Eg(f,s,l,c,d),C=m}function LA(s){return s=s|0,(s>>>0>60?3201:3201+(60-s)|0)|0}function qa(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;return d=C,C=C+32|0,c=d+12|0,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3)|0,Co)),Gs>=y(0))?Fe=y(_n(y(0),y(Gs-y(ir-l)))):Fe=y(0)):Fe=l,Lt=Nr>>>0>>0,Lt){Ge=n[wo>>2]|0,se=Nr,M=0;do q=n[Ge+(se<<2)>>2]|0,n[q+24>>2]|0||(M=((n[(vl(q,Tr)|0)+4>>2]|0)==3&1)+M|0,M=M+((n[(Pc(q,Tr)|0)+4>>2]|0)==3&1)|0),se=se+1|0;while((se|0)!=(or|0));M?(Xe=y(0),c=y(0)):Xr=101}else Xr=101;e:do if((Xr|0)==101)switch(Xr=0,Mp|0){case 1:{M=0,Xe=y(Fe*y(.5)),c=y(0);break e}case 2:{M=0,Xe=Fe,c=y(0);break e}case 3:{if(m>>>0<=1){M=0,Xe=y(0),c=y(0);break e}c=y((m+-1|0)>>>0),M=0,Xe=y(0),c=y(y(_n(Fe,y(0)))/c);break e}case 5:{c=y(Fe/y((m+1|0)>>>0)),M=0,Xe=c;break e}case 4:{c=y(Fe/y(m>>>0)),M=0,Xe=y(c*y(.5));break e}default:{M=0,Xe=y(0),c=y(0);break e}}while(0);if(l=y(Op+Xe),Lt){et=y(Fe/y(M|0)),se=n[wo>>2]|0,q=Nr,Fe=y(0);do{M=n[se+(q<<2)>>2]|0;e:do if((n[M+36>>2]|0)!=1){switch(n[M+24>>2]|0){case 1:{if(gi(M,Tr)|0){if(!Q)break e;Jt=y(Mr(M,Tr,ir)),Jt=y(Jt+y(Cr(s,Tr))),Jt=y(Jt+y(V(M,Tr,br))),h[M+400+(n[Tu>>2]<<2)>>2]=Jt;break e}break}case 0:if(li=(n[(vl(M,Tr)|0)+4>>2]|0)==3,Jt=y(et+l),l=li?Jt:l,Q&&(li=M+400+(n[Tu>>2]<<2)|0,h[li>>2]=y(l+y(h[li>>2]))),li=(n[(Pc(M,Tr)|0)+4>>2]|0)==3,Jt=y(et+l),l=li?Jt:l,ya){Jt=y(c+y(ln(M,Tr,br))),Fe=Tn,l=y(l+y(Jt+y(h[M+504>>2])));break e}else{l=y(l+y(c+y(ns(M,Tr,br)))),Fe=y(_n(Fe,y(ns(M,ur,br))));break e}default:}Q&&(Jt=y(Xe+y(Cr(s,Tr))),li=M+400+(n[Tu>>2]<<2)|0,h[li>>2]=y(Jt+y(h[li>>2])))}while(0);q=q+1|0}while((q|0)!=(or|0))}else Fe=y(0);if(c=y(Up+l),Tp?Xe=y(y(Bi(s,ur,y(Ys+Fe),Tc,B))-Ys):Xe=Tn,et=y(y(Bi(s,ur,y(Ys+(Lp?Tn:Fe)),Tc,B))-Ys),Lt&Q){q=Nr;do{se=n[(n[wo>>2]|0)+(q<<2)>>2]|0;do if((n[se+36>>2]|0)!=1){if((n[se+24>>2]|0)==1){if(gi(se,ur)|0){if(Jt=y(Mr(se,ur,Tn)),Jt=y(Jt+y(Cr(s,ur))),Jt=y(Jt+y(V(se,ur,br))),M=n[Fu>>2]|0,h[se+400+(M<<2)>>2]=Jt,!(_t(Jt)|0))break}else M=n[Fu>>2]|0;Jt=y(Cr(s,ur)),h[se+400+(M<<2)>>2]=y(Jt+y(V(se,ur,br)));break}M=ha(s,se)|0;do if((M|0)==4){if((n[(vl(se,ur)|0)+4>>2]|0)==3){Xr=139;break}if((n[(Pc(se,ur)|0)+4>>2]|0)==3){Xr=139;break}if(ts(se,ur,Tn)|0){l=Oe;break}pf=n[se+908+(n[xl>>2]<<2)>>2]|0,n[qs>>2]=pf,l=y(h[se+396>>2]),li=_t(l)|0,Fe=(n[v>>2]=pf,y(h[v>>2])),li?l=et:(Pr=y(ln(se,ur,br)),Jt=y(Fe/l),l=y(l*Fe),l=y(Pr+(Jn?Jt:l))),h[za>>2]=l,h[qs>>2]=y(y(ln(se,Tr,br))+Fe),n[Wo>>2]=1,n[kl>>2]=1,yr(se,Tr,ir,br,Wo,qs),yr(se,ur,Tn,br,kl,za),l=y(h[qs>>2]),Pr=y(h[za>>2]),Jt=Jn?l:Pr,l=Jn?Pr:l,li=((_t(Jt)|0)^1)&1,fa(se,Jt,l,Ds,li,((_t(l)|0)^1)&1,br,Eo,1,3493,O)|0,l=Oe}else Xr=139;while(0);e:do if((Xr|0)==139){Xr=0,l=y(Xe-y(ns(se,ur,br)));do if((n[(vl(se,ur)|0)+4>>2]|0)==3){if((n[(Pc(se,ur)|0)+4>>2]|0)!=3)break;l=y(Oe+y(_n(y(0),y(l*y(.5)))));break e}while(0);if((n[(Pc(se,ur)|0)+4>>2]|0)==3){l=Oe;break}if((n[(vl(se,ur)|0)+4>>2]|0)==3){l=y(Oe+y(_n(y(0),l)));break}switch(M|0){case 1:{l=Oe;break e}case 2:{l=y(Oe+y(l*y(.5)));break e}default:{l=y(Oe+l);break e}}}while(0);Jt=y(vs+l),li=se+400+(n[Fu>>2]<<2)|0,h[li>>2]=y(Jt+y(h[li>>2]))}while(0);q=q+1|0}while((q|0)!=(or|0))}if(vs=y(vs+et),kc=y(_n(kc,c)),m=yo+1|0,or>>>0>=Ws>>>0)break;l=ir,Nr=or,yo=m}do if(Q){if(M=m>>>0>1,!M&&!(Yi(s)|0))break;if(!(_t(Tn)|0)){l=y(Tn-vs);e:do switch(n[s+12>>2]|0){case 3:{Oe=y(Oe+l),Ue=y(0);break}case 2:{Oe=y(Oe+y(l*y(.5))),Ue=y(0);break}case 4:{Tn>vs?Ue=y(l/y(m>>>0)):Ue=y(0);break}case 7:if(Tn>vs){Oe=y(Oe+y(l/y(m<<1>>>0))),Ue=y(l/y(m>>>0)),Ue=M?Ue:y(0);break e}else{Oe=y(Oe+y(l*y(.5))),Ue=y(0);break e}case 6:{Ue=y(l/y(yo>>>0)),Ue=Tn>vs&M?Ue:y(0);break}default:Ue=y(0)}while(0);if(m|0)for(Lt=1040+(ur<<2)|0,Or=976+(ur<<2)|0,Ge=0,q=0;;){e:do if(q>>>0>>0)for(Fe=y(0),et=y(0),l=y(0),se=q;;){M=n[(n[wo>>2]|0)+(se<<2)>>2]|0;do if((n[M+36>>2]|0)!=1&&(n[M+24>>2]|0)==0){if((n[M+940>>2]|0)!=(Ge|0))break e;if(Nm(M,ur)|0&&(Jt=y(h[M+908+(n[Or>>2]<<2)>>2]),l=y(_n(l,y(Jt+y(ln(M,ur,br)))))),(ha(s,M)|0)!=5)break;Gs=y(Ya(M)),Gs=y(Gs+y(V(M,0,br))),Jt=y(h[M+912>>2]),Jt=y(y(Jt+y(ln(M,0,br)))-Gs),Gs=y(_n(et,Gs)),Jt=y(_n(Fe,Jt)),Fe=Jt,et=Gs,l=y(_n(l,y(Gs+Jt)))}while(0);if(M=se+1|0,M>>>0>>0)se=M;else{se=M;break}}else et=y(0),l=y(0),se=q;while(0);if(at=y(Ue+l),c=Oe,Oe=y(Oe+at),q>>>0>>0){Xe=y(c+et),M=q;do{q=n[(n[wo>>2]|0)+(M<<2)>>2]|0;e:do if((n[q+36>>2]|0)!=1&&(n[q+24>>2]|0)==0)switch(ha(s,q)|0){case 1:{Jt=y(c+y(V(q,ur,br))),h[q+400+(n[Lt>>2]<<2)>>2]=Jt;break e}case 3:{Jt=y(y(Oe-y(re(q,ur,br)))-y(h[q+908+(n[Or>>2]<<2)>>2])),h[q+400+(n[Lt>>2]<<2)>>2]=Jt;break e}case 2:{Jt=y(c+y(y(at-y(h[q+908+(n[Or>>2]<<2)>>2]))*y(.5))),h[q+400+(n[Lt>>2]<<2)>>2]=Jt;break e}case 4:{if(Jt=y(c+y(V(q,ur,br))),h[q+400+(n[Lt>>2]<<2)>>2]=Jt,ts(q,ur,Tn)|0||(Jn?(Fe=y(h[q+908>>2]),l=y(Fe+y(ln(q,Tr,br))),et=at):(et=y(h[q+912>>2]),et=y(et+y(ln(q,ur,br))),l=at,Fe=y(h[q+908>>2])),Ii(l,Fe)|0&&Ii(et,y(h[q+912>>2]))|0))break e;fa(q,l,et,Ds,1,1,br,Eo,1,3501,O)|0;break e}case 5:{h[q+404>>2]=y(y(Xe-y(Ya(q)))+y(Mr(q,0,Tn)));break e}default:break e}while(0);M=M+1|0}while((M|0)!=(se|0))}if(Ge=Ge+1|0,(Ge|0)==(m|0))break;q=se}}}while(0);if(h[s+908>>2]=y(Bi(s,2,Qc,B,B)),h[s+912>>2]=y(Bi(s,0,af,k,B)),(Ql|0)!=0&&(lf=n[s+32>>2]|0,cf=(Ql|0)==2,!(cf&(lf|0)!=2))?cf&(lf|0)==2&&(l=y(Fc+ir),l=y(_n(y(Tg(l,y(MA(s,Tr,kc,Co)))),Fc)),Xr=198):(l=y(Bi(s,Tr,kc,Co,B)),Xr=198),(Xr|0)==198&&(h[s+908+(n[976+(Tr<<2)>>2]<<2)>>2]=l),(Fl|0)!=0&&(Af=n[s+32>>2]|0,ff=(Fl|0)==2,!(ff&(Af|0)!=2))?ff&(Af|0)==2&&(l=y(Ys+Tn),l=y(_n(y(Tg(l,y(MA(s,ur,y(Ys+vs),Tc)))),Ys)),Xr=204):(l=y(Bi(s,ur,y(Ys+vs),Tc,B)),Xr=204),(Xr|0)==204&&(h[s+908+(n[976+(ur<<2)>>2]<<2)>>2]=l),Q){if((n[uf>>2]|0)==2){q=976+(ur<<2)|0,se=1040+(ur<<2)|0,M=0;do Ge=gs(s,M)|0,n[Ge+24>>2]|0||(pf=n[q>>2]|0,Jt=y(h[s+908+(pf<<2)>>2]),li=Ge+400+(n[se>>2]<<2)|0,Jt=y(Jt-y(h[li>>2])),h[li>>2]=y(Jt-y(h[Ge+908+(pf<<2)>>2]))),M=M+1|0;while((M|0)!=(Ws|0))}if(f|0){M=Jn?Ql:d;do Lm(s,f,br,M,Eo,Ds,O),f=n[f+960>>2]|0;while((f|0)!=0)}if(M=(Tr|2|0)==3,q=(ur|2|0)==3,M|q){f=0;do se=n[(n[wo>>2]|0)+(f<<2)>>2]|0,(n[se+36>>2]|0)!=1&&(M&&Cp(s,se,Tr),q&&Cp(s,se,ur)),f=f+1|0;while((f|0)!=(Ws|0))}}}while(0);C=Tl}function pa(s,l){s=s|0,l=y(l);var c=0;oa(s,l>=y(0),3147),c=l==y(0),h[s+4>>2]=c?y(0):l}function vc(s,l,c,f){s=s|0,l=y(l),c=y(c),f=f|0;var d=Ze,m=Ze,B=0,k=0,Q=0;n[2278]=(n[2278]|0)+1,Bl(s),ts(s,2,l)|0?(d=y(Gr(n[s+992>>2]|0,l)),Q=1,d=y(d+y(ln(s,2,l)))):(d=y(Gr(s+380|0,l)),d>=y(0)?Q=2:(Q=((_t(l)|0)^1)&1,d=l)),ts(s,0,c)|0?(m=y(Gr(n[s+996>>2]|0,c)),k=1,m=y(m+y(ln(s,0,l)))):(m=y(Gr(s+388|0,c)),m>=y(0)?k=2:(k=((_t(c)|0)^1)&1,m=c)),B=s+976|0,fa(s,d,m,f,Q,k,l,c,1,3189,n[B>>2]|0)|0&&(yp(s,n[s+496>>2]|0,l,c,l),Dc(s,y(h[(n[B>>2]|0)+4>>2]),y(0),y(0)),o[11696]|0)&&km(s,7)}function Bl(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;k=C,C=C+32|0,B=k+24|0,m=k+16|0,f=k+8|0,d=k,c=0;do l=s+380+(c<<3)|0,(n[s+380+(c<<3)+4>>2]|0)!=0&&(Q=l,O=n[Q+4>>2]|0,M=f,n[M>>2]=n[Q>>2],n[M+4>>2]=O,M=s+364+(c<<3)|0,O=n[M+4>>2]|0,Q=d,n[Q>>2]=n[M>>2],n[Q+4>>2]=O,n[m>>2]=n[f>>2],n[m+4>>2]=n[f+4>>2],n[B>>2]=n[d>>2],n[B+4>>2]=n[d+4>>2],ws(m,B)|0)||(l=s+348+(c<<3)|0),n[s+992+(c<<2)>>2]=l,c=c+1|0;while((c|0)!=2);C=k}function ts(s,l,c){s=s|0,l=l|0,c=y(c);var f=0;switch(s=n[s+992+(n[976+(l<<2)>>2]<<2)>>2]|0,n[s+4>>2]|0){case 0:case 3:{s=0;break}case 1:{y(h[s>>2])>2])>2]|0){case 2:{l=y(y(y(h[s>>2])*l)/y(100));break}case 1:{l=y(h[s>>2]);break}default:l=y(Ae)}return y(l)}function yp(s,l,c,f,d){s=s|0,l=l|0,c=y(c),f=y(f),d=y(d);var m=0,B=Ze;l=n[s+944>>2]|0?l:1,m=fr(n[s+4>>2]|0,l)|0,l=Cw(m,l)|0,c=y(Mm(s,m,c)),f=y(Mm(s,l,f)),B=y(c+y(V(s,m,d))),h[s+400+(n[1040+(m<<2)>>2]<<2)>>2]=B,c=y(c+y(re(s,m,d))),h[s+400+(n[1e3+(m<<2)>>2]<<2)>>2]=c,c=y(f+y(V(s,l,d))),h[s+400+(n[1040+(l<<2)>>2]<<2)>>2]=c,d=y(f+y(re(s,l,d))),h[s+400+(n[1e3+(l<<2)>>2]<<2)>>2]=d}function Dc(s,l,c,f){s=s|0,l=y(l),c=y(c),f=y(f);var d=0,m=0,B=Ze,k=Ze,Q=0,O=0,M=Ze,q=0,se=Ze,Ge=Ze,Oe=Ze,Fe=Ze;if(l!=y(0)&&(d=s+400|0,Fe=y(h[d>>2]),m=s+404|0,Oe=y(h[m>>2]),q=s+416|0,Ge=y(h[q>>2]),O=s+420|0,B=y(h[O>>2]),se=y(Fe+c),M=y(Oe+f),f=y(se+Ge),k=y(M+B),Q=(n[s+988>>2]|0)==1,h[d>>2]=y(Go(Fe,l,0,Q)),h[m>>2]=y(Go(Oe,l,0,Q)),c=y(kT(y(Ge*l),y(1))),Ii(c,y(0))|0?m=0:m=(Ii(c,y(1))|0)^1,c=y(kT(y(B*l),y(1))),Ii(c,y(0))|0?d=0:d=(Ii(c,y(1))|0)^1,Fe=y(Go(f,l,Q&m,Q&(m^1))),h[q>>2]=y(Fe-y(Go(se,l,0,Q))),Fe=y(Go(k,l,Q&d,Q&(d^1))),h[O>>2]=y(Fe-y(Go(M,l,0,Q))),m=(n[s+952>>2]|0)-(n[s+948>>2]|0)>>2,m|0)){d=0;do Dc(gs(s,d)|0,l,se,M),d=d+1|0;while((d|0)!=(m|0))}}function Ew(s,l,c,f,d){switch(s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,c|0){case 5:case 0:{s=a7(n[489]|0,f,d)|0;break}default:s=t3e(f,d)|0}return s|0}function yg(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;d=C,C=C+16|0,m=d,n[m>>2]=f,Eg(s,0,l,c,m),C=d}function Eg(s,l,c,f,d){if(s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,s=s|0?s:956,x7[n[s+8>>2]&1](s,l,c,f,d)|0,(c|0)==5)Tt();else return}function Ga(s,l,c){s=s|0,l=l|0,c=c|0,o[s+l>>0]=c&1}function Fm(s,l){s=s|0,l=l|0;var c=0,f=0;n[s>>2]=0,n[s+4>>2]=0,n[s+8>>2]=0,c=l+4|0,f=(n[c>>2]|0)-(n[l>>2]|0)>>2,f|0&&(Cg(s,f),Qt(s,n[l>>2]|0,n[c>>2]|0,f))}function Cg(s,l){s=s|0,l=l|0;var c=0;if((N(s)|0)>>>0>>0&&zr(s),l>>>0>1073741823)Tt();else{c=Vt(l<<2)|0,n[s+4>>2]=c,n[s>>2]=c,n[s+8>>2]=c+(l<<2);return}}function Qt(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,f=s+4|0,s=c-l|0,(s|0)>0&&(Dr(n[f>>2]|0,l|0,s|0)|0,n[f>>2]=(n[f>>2]|0)+(s>>>2<<2))}function N(s){return s=s|0,1073741823}function V(s,l,c){return s=s|0,l=l|0,c=y(c),he(l)|0&&(n[s+96>>2]|0)!=0?s=s+92|0:s=Fn(s+60|0,n[1040+(l<<2)>>2]|0,992)|0,y(ze(s,c))}function re(s,l,c){return s=s|0,l=l|0,c=y(c),he(l)|0&&(n[s+104>>2]|0)!=0?s=s+100|0:s=Fn(s+60|0,n[1e3+(l<<2)>>2]|0,992)|0,y(ze(s,c))}function he(s){return s=s|0,(s|1|0)==3|0}function ze(s,l){return s=s|0,l=y(l),(n[s+4>>2]|0)==3?l=y(0):l=y(Gr(s,l)),y(l)}function mt(s,l){return s=s|0,l=l|0,s=n[s>>2]|0,((s|0)==0?(l|0)>1?l:1:s)|0}function fr(s,l){s=s|0,l=l|0;var c=0;e:do if((l|0)==2){switch(s|0){case 2:{s=3;break e}case 3:break;default:{c=4;break e}}s=2}else c=4;while(0);return s|0}function Cr(s,l){s=s|0,l=l|0;var c=Ze;return he(l)|0&&(n[s+312>>2]|0)!=0&&(c=y(h[s+308>>2]),c>=y(0))||(c=y(_n(y(h[(Fn(s+276|0,n[1040+(l<<2)>>2]|0,992)|0)>>2]),y(0)))),y(c)}function yn(s,l){s=s|0,l=l|0;var c=Ze;return he(l)|0&&(n[s+320>>2]|0)!=0&&(c=y(h[s+316>>2]),c>=y(0))||(c=y(_n(y(h[(Fn(s+276|0,n[1e3+(l<<2)>>2]|0,992)|0)>>2]),y(0)))),y(c)}function oi(s,l,c){s=s|0,l=l|0,c=y(c);var f=Ze;return he(l)|0&&(n[s+240>>2]|0)!=0&&(f=y(Gr(s+236|0,c)),f>=y(0))||(f=y(_n(y(Gr(Fn(s+204|0,n[1040+(l<<2)>>2]|0,992)|0,c)),y(0)))),y(f)}function Mi(s,l,c){s=s|0,l=l|0,c=y(c);var f=Ze;return he(l)|0&&(n[s+248>>2]|0)!=0&&(f=y(Gr(s+244|0,c)),f>=y(0))||(f=y(_n(y(Gr(Fn(s+204|0,n[1e3+(l<<2)>>2]|0,992)|0,c)),y(0)))),y(f)}function wg(s,l,c,f,d,m,B){s=s|0,l=y(l),c=y(c),f=f|0,d=d|0,m=y(m),B=y(B);var k=Ze,Q=Ze,O=Ze,M=Ze,q=Ze,se=Ze,Ge=0,Oe=0,Fe=0;Fe=C,C=C+16|0,Ge=Fe,Oe=s+964|0,Un(s,(n[Oe>>2]|0)!=0,3519),k=y(En(s,2,l)),Q=y(En(s,0,l)),O=y(ln(s,2,l)),M=y(ln(s,0,l)),_t(l)|0?q=l:q=y(_n(y(0),y(y(l-O)-k))),_t(c)|0?se=c:se=y(_n(y(0),y(y(c-M)-Q))),(f|0)==1&(d|0)==1?(h[s+908>>2]=y(Bi(s,2,y(l-O),m,m)),l=y(Bi(s,0,y(c-M),B,m))):(b7[n[Oe>>2]&1](Ge,s,q,f,se,d),q=y(k+y(h[Ge>>2])),se=y(l-O),h[s+908>>2]=y(Bi(s,2,(f|2|0)==2?q:se,m,m)),se=y(Q+y(h[Ge+4>>2])),l=y(c-M),l=y(Bi(s,0,(d|2|0)==2?se:l,B,m))),h[s+912>>2]=l,C=Fe}function Gv(s,l,c,f,d,m,B){s=s|0,l=y(l),c=y(c),f=f|0,d=d|0,m=y(m),B=y(B);var k=Ze,Q=Ze,O=Ze,M=Ze;O=y(En(s,2,m)),k=y(En(s,0,m)),M=y(ln(s,2,m)),Q=y(ln(s,0,m)),l=y(l-M),h[s+908>>2]=y(Bi(s,2,(f|2|0)==2?O:l,m,m)),c=y(c-Q),h[s+912>>2]=y(Bi(s,0,(d|2|0)==2?k:c,B,m))}function Yv(s,l,c,f,d,m,B){s=s|0,l=y(l),c=y(c),f=f|0,d=d|0,m=y(m),B=y(B);var k=0,Q=Ze,O=Ze;return k=(f|0)==2,!(l<=y(0)&k)&&!(c<=y(0)&(d|0)==2)&&!((f|0)==1&(d|0)==1)?s=0:(Q=y(ln(s,0,m)),O=y(ln(s,2,m)),k=l>2]=y(Bi(s,2,k?y(0):l,m,m)),l=y(c-Q),k=c>2]=y(Bi(s,0,k?y(0):l,B,m)),s=1),s|0}function Cw(s,l){return s=s|0,l=l|0,OA(s)|0?s=fr(2,l)|0:s=0,s|0}function Ep(s,l,c){return s=s|0,l=l|0,c=y(c),c=y(oi(s,l,c)),y(c+y(Cr(s,l)))}function ww(s,l,c){return s=s|0,l=l|0,c=y(c),c=y(Mi(s,l,c)),y(c+y(yn(s,l)))}function En(s,l,c){s=s|0,l=l|0,c=y(c);var f=Ze;return f=y(Ep(s,l,c)),y(f+y(ww(s,l,c)))}function Tm(s){return s=s|0,n[s+24>>2]|0?s=0:y(rs(s))!=y(0)?s=1:s=y(js(s))!=y(0),s|0}function rs(s){s=s|0;var l=Ze;if(n[s+944>>2]|0){if(l=y(h[s+44>>2]),_t(l)|0)return l=y(h[s+40>>2]),s=l>y(0)&((_t(l)|0)^1),y(s?l:y(0))}else l=y(0);return y(l)}function js(s){s=s|0;var l=Ze,c=0,f=Ze;do if(n[s+944>>2]|0){if(l=y(h[s+48>>2]),_t(l)|0){if(c=o[(n[s+976>>2]|0)+2>>0]|0,c<<24>>24==0&&(f=y(h[s+40>>2]),f>24?y(1):y(0)}}else l=y(0);while(0);return y(l)}function Bu(s){s=s|0;var l=0,c=0;if(zm(s+400|0,0,540)|0,o[s+985>>0]=1,$(s),c=wi(s)|0,c|0){l=s+948|0,s=0;do Bu(n[(n[l>>2]|0)+(s<<2)>>2]|0),s=s+1|0;while((s|0)!=(c|0))}}function Rm(s,l,c,f,d,m,B,k,Q,O){s=s|0,l=l|0,c=y(c),f=f|0,d=y(d),m=y(m),B=y(B),k=k|0,Q=Q|0,O=O|0;var M=0,q=Ze,se=0,Ge=0,Oe=Ze,Fe=Ze,et=0,Xe=Ze,at=0,Ue=Ze,qe=0,Lt=0,Or=0,or=0,Xt=0,Pr=0,Nr=0,ir=0,bn=0,go=0;bn=C,C=C+16|0,Or=bn+12|0,or=bn+8|0,Xt=bn+4|0,Pr=bn,ir=fr(n[s+4>>2]|0,Q)|0,qe=he(ir)|0,q=y(Gr(Iw(l)|0,qe?m:B)),Lt=ts(l,2,m)|0,Nr=ts(l,0,B)|0;do if(!(_t(q)|0)&&!(_t(qe?c:d)|0)){if(M=l+504|0,!(_t(y(h[M>>2]))|0)&&(!(Bw(n[l+976>>2]|0,0)|0)||(n[l+500>>2]|0)==(n[2278]|0)))break;h[M>>2]=y(_n(q,y(En(l,ir,m))))}else se=7;while(0);do if((se|0)==7){if(at=qe^1,!(at|Lt^1)){B=y(Gr(n[l+992>>2]|0,m)),h[l+504>>2]=y(_n(B,y(En(l,2,m))));break}if(!(qe|Nr^1)){B=y(Gr(n[l+996>>2]|0,B)),h[l+504>>2]=y(_n(B,y(En(l,0,m))));break}h[Or>>2]=y(Ae),h[or>>2]=y(Ae),n[Xt>>2]=0,n[Pr>>2]=0,Xe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,d))))}function ha(s,l){return s=s|0,l=l|0,l=l+20|0,l=n[((n[l>>2]|0)==0?s+16|0:l)>>2]|0,(l|0)==5&&OA(n[s+4>>2]|0)|0&&(l=1),l|0}function vl(s,l){return s=s|0,l=l|0,he(l)|0&&(n[s+96>>2]|0)!=0?l=4:l=n[1040+(l<<2)>>2]|0,s+60+(l<<3)|0}function Pc(s,l){return s=s|0,l=l|0,he(l)|0&&(n[s+104>>2]|0)!=0?l=5:l=n[1e3+(l<<2)>>2]|0,s+60+(l<<3)|0}function yr(s,l,c,f,d,m){switch(s=s|0,l=l|0,c=y(c),f=y(f),d=d|0,m=m|0,c=y(Gr(s+380+(n[976+(l<<2)>>2]<<3)|0,c)),c=y(c+y(ln(s,l,f))),n[d>>2]|0){case 2:case 1:{d=_t(c)|0,f=y(h[m>>2]),h[m>>2]=d|f>2]=2,h[m>>2]=c);break}default:}}function gi(s,l){return s=s|0,l=l|0,s=s+132|0,he(l)|0&&(n[(Fn(s,4,948)|0)+4>>2]|0)!=0?s=1:s=(n[(Fn(s,n[1040+(l<<2)>>2]|0,948)|0)+4>>2]|0)!=0,s|0}function Mr(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0;return s=s+132|0,he(l)|0&&(f=Fn(s,4,948)|0,(n[f+4>>2]|0)!=0)?d=4:(f=Fn(s,n[1040+(l<<2)>>2]|0,948)|0,n[f+4>>2]|0?d=4:c=y(0)),(d|0)==4&&(c=y(Gr(f,c))),y(c)}function ns(s,l,c){s=s|0,l=l|0,c=y(c);var f=Ze;return f=y(h[s+908+(n[976+(l<<2)>>2]<<2)>>2]),f=y(f+y(V(s,l,c))),y(f+y(re(s,l,c)))}function Yi(s){s=s|0;var l=0,c=0,f=0;e:do if(OA(n[s+4>>2]|0)|0)l=0;else if((n[s+16>>2]|0)!=5)if(c=wi(s)|0,!c)l=0;else for(l=0;;){if(f=gs(s,l)|0,(n[f+24>>2]|0)==0&&(n[f+20>>2]|0)==5){l=1;break e}if(l=l+1|0,l>>>0>=c>>>0){l=0;break}}else l=1;while(0);return l|0}function Nm(s,l){s=s|0,l=l|0;var c=Ze;return c=y(h[s+908+(n[976+(l<<2)>>2]<<2)>>2]),c>=y(0)&((_t(c)|0)^1)|0}function Ya(s){s=s|0;var l=Ze,c=0,f=0,d=0,m=0,B=0,k=0,Q=Ze;if(c=n[s+968>>2]|0,c)Q=y(h[s+908>>2]),l=y(h[s+912>>2]),l=y(v7[c&0](s,Q,l)),Un(s,(_t(l)|0)^1,3573);else{m=wi(s)|0;do if(m|0){for(c=0,d=0;;){if(f=gs(s,d)|0,n[f+940>>2]|0){B=8;break}if((n[f+24>>2]|0)!=1)if(k=(ha(s,f)|0)==5,k){c=f;break}else c=(c|0)==0?f:c;if(d=d+1|0,d>>>0>=m>>>0){B=8;break}}if((B|0)==8&&!c)break;return l=y(Ya(c)),y(l+y(h[c+404>>2]))}while(0);l=y(h[s+912>>2])}return y(l)}function MA(s,l,c,f){s=s|0,l=l|0,c=y(c),f=y(f);var d=Ze,m=0;return OA(l)|0?(l=1,m=3):he(l)|0?(l=0,m=3):(f=y(Ae),d=y(Ae)),(m|0)==3&&(d=y(Gr(s+364+(l<<3)|0,f)),f=y(Gr(s+380+(l<<3)|0,f))),m=f=y(0)&((_t(f)|0)^1)),c=m?f:c,m=d>=y(0)&((_t(d)|0)^1)&c>2]|0,m)|0,Oe=Cw(et,m)|0,Fe=he(et)|0,q=y(ln(l,2,c)),se=y(ln(l,0,c)),ts(l,2,c)|0?k=y(q+y(Gr(n[l+992>>2]|0,c))):gi(l,2)|0&&sr(l,2)|0?(k=y(h[s+908>>2]),Q=y(Cr(s,2)),Q=y(k-y(Q+y(yn(s,2)))),k=y(Mr(l,2,c)),k=y(Bi(l,2,y(Q-y(k+y(vu(l,2,c)))),c,c))):k=y(Ae),ts(l,0,d)|0?Q=y(se+y(Gr(n[l+996>>2]|0,d))):gi(l,0)|0&&sr(l,0)|0?(Q=y(h[s+912>>2]),at=y(Cr(s,0)),at=y(Q-y(at+y(yn(s,0)))),Q=y(Mr(l,0,d)),Q=y(Bi(l,0,y(at-y(Q+y(vu(l,0,d)))),d,c))):Q=y(Ae),O=_t(k)|0,M=_t(Q)|0;do if(O^M&&(Ge=y(h[l+396>>2]),!(_t(Ge)|0)))if(O){k=y(q+y(y(Q-se)*Ge));break}else{at=y(se+y(y(k-q)/Ge)),Q=M?at:Q;break}while(0);M=_t(k)|0,O=_t(Q)|0,M|O&&(Ue=(M^1)&1,f=c>y(0)&((f|0)!=0&M),k=Fe?k:f?c:k,fa(l,k,Q,m,Fe?Ue:f?2:Ue,M&(O^1)&1,k,Q,0,3623,B)|0,k=y(h[l+908>>2]),k=y(k+y(ln(l,2,c))),Q=y(h[l+912>>2]),Q=y(Q+y(ln(l,0,c)))),fa(l,k,Q,m,1,1,k,Q,1,3635,B)|0,sr(l,et)|0&&!(gi(l,et)|0)?(Ue=n[976+(et<<2)>>2]|0,at=y(h[s+908+(Ue<<2)>>2]),at=y(at-y(h[l+908+(Ue<<2)>>2])),at=y(at-y(yn(s,et))),at=y(at-y(re(l,et,c))),at=y(at-y(vu(l,et,Fe?c:d))),h[l+400+(n[1040+(et<<2)>>2]<<2)>>2]=at):Xe=21;do if((Xe|0)==21){if(!(gi(l,et)|0)&&(n[s+8>>2]|0)==1){Ue=n[976+(et<<2)>>2]|0,at=y(h[s+908+(Ue<<2)>>2]),at=y(y(at-y(h[l+908+(Ue<<2)>>2]))*y(.5)),h[l+400+(n[1040+(et<<2)>>2]<<2)>>2]=at;break}!(gi(l,et)|0)&&(n[s+8>>2]|0)==2&&(Ue=n[976+(et<<2)>>2]|0,at=y(h[s+908+(Ue<<2)>>2]),at=y(at-y(h[l+908+(Ue<<2)>>2])),h[l+400+(n[1040+(et<<2)>>2]<<2)>>2]=at)}while(0);sr(l,Oe)|0&&!(gi(l,Oe)|0)?(Ue=n[976+(Oe<<2)>>2]|0,at=y(h[s+908+(Ue<<2)>>2]),at=y(at-y(h[l+908+(Ue<<2)>>2])),at=y(at-y(yn(s,Oe))),at=y(at-y(re(l,Oe,c))),at=y(at-y(vu(l,Oe,Fe?d:c))),h[l+400+(n[1040+(Oe<<2)>>2]<<2)>>2]=at):Xe=30;do if((Xe|0)==30&&!(gi(l,Oe)|0)){if((ha(s,l)|0)==2){Ue=n[976+(Oe<<2)>>2]|0,at=y(h[s+908+(Ue<<2)>>2]),at=y(y(at-y(h[l+908+(Ue<<2)>>2]))*y(.5)),h[l+400+(n[1040+(Oe<<2)>>2]<<2)>>2]=at;break}Ue=(ha(s,l)|0)==3,Ue^(n[s+28>>2]|0)==2&&(Ue=n[976+(Oe<<2)>>2]|0,at=y(h[s+908+(Ue<<2)>>2]),at=y(at-y(h[l+908+(Ue<<2)>>2])),h[l+400+(n[1040+(Oe<<2)>>2]<<2)>>2]=at)}while(0)}function Cp(s,l,c){s=s|0,l=l|0,c=c|0;var f=Ze,d=0;d=n[976+(c<<2)>>2]|0,f=y(h[l+908+(d<<2)>>2]),f=y(y(h[s+908+(d<<2)>>2])-f),f=y(f-y(h[l+400+(n[1040+(c<<2)>>2]<<2)>>2])),h[l+400+(n[1e3+(c<<2)>>2]<<2)>>2]=f}function OA(s){return s=s|0,(s|1|0)==1|0}function Iw(s){s=s|0;var l=Ze;switch(n[s+56>>2]|0){case 0:case 3:{l=y(h[s+40>>2]),l>y(0)&((_t(l)|0)^1)?s=o[(n[s+976>>2]|0)+2>>0]|0?1056:992:s=1056;break}default:s=s+52|0}return s|0}function Bw(s,l){return s=s|0,l=l|0,(o[s+l>>0]|0)!=0|0}function sr(s,l){return s=s|0,l=l|0,s=s+132|0,he(l)|0&&(n[(Fn(s,5,948)|0)+4>>2]|0)!=0?s=1:s=(n[(Fn(s,n[1e3+(l<<2)>>2]|0,948)|0)+4>>2]|0)!=0,s|0}function vu(s,l,c){s=s|0,l=l|0,c=y(c);var f=0,d=0;return s=s+132|0,he(l)|0&&(f=Fn(s,5,948)|0,(n[f+4>>2]|0)!=0)?d=4:(f=Fn(s,n[1e3+(l<<2)>>2]|0,948)|0,n[f+4>>2]|0?d=4:c=y(0)),(d|0)==4&&(c=y(Gr(f,c))),y(c)}function Mm(s,l,c){return s=s|0,l=l|0,c=y(c),gi(s,l)|0?c=y(Mr(s,l,c)):c=y(-y(vu(s,l,c))),y(c)}function Du(s){return s=y(s),h[v>>2]=s,n[v>>2]|0|0}function wp(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>1073741823)Tt();else{d=Vt(l<<2)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<2)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<2)}function Ig(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>2)<<2)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function UA(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-4-l|0)>>>2)<<2)),s=n[s>>2]|0,s|0&>(s)}function _A(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;if(B=s+4|0,k=n[B>>2]|0,d=k-f|0,m=d>>2,s=l+(m<<2)|0,s>>>0>>0){f=k;do n[f>>2]=n[s>>2],s=s+4|0,f=(n[B>>2]|0)+4|0,n[B>>2]=f;while(s>>>0>>0)}m|0&&Mw(k+(0-m<<2)|0,l|0,d|0)|0}function Bg(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0;return k=l+4|0,Q=n[k>>2]|0,d=n[s>>2]|0,B=c,m=B-d|0,f=Q+(0-(m>>2)<<2)|0,n[k>>2]=f,(m|0)>0&&Dr(f|0,d|0,m|0)|0,d=s+4|0,m=l+8|0,f=(n[d>>2]|0)-B|0,(f|0)>0&&(Dr(n[m>>2]|0,c|0,f|0)|0,n[m>>2]=(n[m>>2]|0)+(f>>>2<<2)),B=n[s>>2]|0,n[s>>2]=n[k>>2],n[k>>2]=B,B=n[d>>2]|0,n[d>>2]=n[m>>2],n[m>>2]=B,B=s+8|0,c=l+12|0,s=n[B>>2]|0,n[B>>2]=n[c>>2],n[c>>2]=s,n[l>>2]=n[k>>2],Q|0}function vw(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;if(B=n[l>>2]|0,m=n[c>>2]|0,(B|0)!=(m|0)){d=s+8|0,c=((m+-4-B|0)>>>2)+1|0,s=B,f=n[d>>2]|0;do n[f>>2]=n[s>>2],f=(n[d>>2]|0)+4|0,n[d>>2]=f,s=s+4|0;while((s|0)!=(m|0));n[l>>2]=B+(c<<2)}}function Om(){dc()}function ga(){var s=0;return s=Vt(4)|0,HA(s),s|0}function HA(s){s=s|0,n[s>>2]=ys()|0}function Sc(s){s=s|0,s|0&&(vg(s),gt(s))}function vg(s){s=s|0,tt(n[s>>2]|0)}function Um(s,l,c){s=s|0,l=l|0,c=c|0,Ga(n[s>>2]|0,l,c)}function fo(s,l){s=s|0,l=y(l),pa(n[s>>2]|0,l)}function Wv(s,l){return s=s|0,l=l|0,Bw(n[s>>2]|0,l)|0}function Dw(){var s=0;return s=Vt(8)|0,Vv(s,0),s|0}function Vv(s,l){s=s|0,l=l|0,l?l=Ci(n[l>>2]|0)|0:l=co()|0,n[s>>2]=l,n[s+4>>2]=0,xi(l,s)}function pF(s){s=s|0;var l=0;return l=Vt(8)|0,Vv(l,s),l|0}function Kv(s){s=s|0,s|0&&(Pu(s),gt(s))}function Pu(s){s=s|0;var l=0;la(n[s>>2]|0),l=s+4|0,s=n[l>>2]|0,n[l>>2]=0,s|0&&(jA(s),gt(s))}function jA(s){s=s|0,qA(s)}function qA(s){s=s|0,s=n[s>>2]|0,s|0&&PA(s|0)}function Pw(s){return s=s|0,jo(s)|0}function _m(s){s=s|0;var l=0,c=0;c=s+4|0,l=n[c>>2]|0,n[c>>2]=0,l|0&&(jA(l),gt(l)),_s(n[s>>2]|0)}function hF(s,l){s=s|0,l=l|0,Zr(n[s>>2]|0,n[l>>2]|0)}function gF(s,l){s=s|0,l=l|0,ca(n[s>>2]|0,l)}function Jv(s,l,c){s=s|0,l=l|0,c=+c,yu(n[s>>2]|0,l,y(c))}function zv(s,l,c){s=s|0,l=l|0,c=+c,Es(n[s>>2]|0,l,y(c))}function Sw(s,l){s=s|0,l=l|0,gu(n[s>>2]|0,l)}function Su(s,l){s=s|0,l=l|0,du(n[s>>2]|0,l)}function dF(s,l){s=s|0,l=l|0,QA(n[s>>2]|0,l)}function mF(s,l){s=s|0,l=l|0,bA(n[s>>2]|0,l)}function Ip(s,l){s=s|0,l=l|0,yc(n[s>>2]|0,l)}function yF(s,l){s=s|0,l=l|0,up(n[s>>2]|0,l)}function Xv(s,l,c){s=s|0,l=l|0,c=+c,Cc(n[s>>2]|0,l,y(c))}function GA(s,l,c){s=s|0,l=l|0,c=+c,G(n[s>>2]|0,l,y(c))}function EF(s,l){s=s|0,l=l|0,wl(n[s>>2]|0,l)}function CF(s,l){s=s|0,l=l|0,og(n[s>>2]|0,l)}function Zv(s,l){s=s|0,l=l|0,Ap(n[s>>2]|0,l)}function xw(s,l){s=s|0,l=+l,FA(n[s>>2]|0,y(l))}function bw(s,l){s=s|0,l=+l,Ha(n[s>>2]|0,y(l))}function wF(s,l){s=s|0,l=+l,Gi(n[s>>2]|0,y(l))}function IF(s,l){s=s|0,l=+l,Hs(n[s>>2]|0,y(l))}function Dl(s,l){s=s|0,l=+l,mu(n[s>>2]|0,y(l))}function kw(s,l){s=s|0,l=+l,mw(n[s>>2]|0,y(l))}function BF(s,l){s=s|0,l=+l,TA(n[s>>2]|0,y(l))}function YA(s){s=s|0,fp(n[s>>2]|0)}function Hm(s,l){s=s|0,l=+l,Cs(n[s>>2]|0,y(l))}function xu(s,l){s=s|0,l=+l,cg(n[s>>2]|0,y(l))}function Qw(s){s=s|0,ug(n[s>>2]|0)}function Fw(s,l){s=s|0,l=+l,pp(n[s>>2]|0,y(l))}function vF(s,l){s=s|0,l=+l,Ic(n[s>>2]|0,y(l))}function $v(s,l){s=s|0,l=+l,Sm(n[s>>2]|0,y(l))}function WA(s,l){s=s|0,l=+l,fg(n[s>>2]|0,y(l))}function eD(s,l){s=s|0,l=+l,Cu(n[s>>2]|0,y(l))}function jm(s,l){s=s|0,l=+l,xm(n[s>>2]|0,y(l))}function tD(s,l){s=s|0,l=+l,wu(n[s>>2]|0,y(l))}function rD(s,l){s=s|0,l=+l,yw(n[s>>2]|0,y(l))}function qm(s,l){s=s|0,l=+l,Aa(n[s>>2]|0,y(l))}function nD(s,l,c){s=s|0,l=l|0,c=+c,Eu(n[s>>2]|0,l,y(c))}function DF(s,l,c){s=s|0,l=l|0,c=+c,bi(n[s>>2]|0,l,y(c))}function P(s,l,c){s=s|0,l=l|0,c=+c,wc(n[s>>2]|0,l,y(c))}function D(s){return s=s|0,sg(n[s>>2]|0)|0}function R(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;f=C,C=C+16|0,d=f,Ec(d,n[l>>2]|0,c),j(s,d),C=f}function j(s,l){s=s|0,l=l|0,Y(s,n[l+4>>2]|0,+y(h[l>>2]))}function Y(s,l,c){s=s|0,l=l|0,c=+c,n[s>>2]=l,E[s+8>>3]=c}function fe(s){return s=s|0,ig(n[s>>2]|0)|0}function ve(s){return s=s|0,uo(n[s>>2]|0)|0}function vt(s){return s=s|0,mc(n[s>>2]|0)|0}function wt(s){return s=s|0,kA(n[s>>2]|0)|0}function bt(s){return s=s|0,Pm(n[s>>2]|0)|0}function _r(s){return s=s|0,ng(n[s>>2]|0)|0}function is(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;f=C,C=C+16|0,d=f,Dt(d,n[l>>2]|0,c),j(s,d),C=f}function di(s){return s=s|0,$n(n[s>>2]|0)|0}function po(s){return s=s|0,ag(n[s>>2]|0)|0}function VA(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,ua(f,n[l>>2]|0),j(s,f),C=c}function Yo(s){return s=s|0,+ +y(qi(n[s>>2]|0))}function rt(s){return s=s|0,+ +y(es(n[s>>2]|0))}function Ke(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,Br(f,n[l>>2]|0),j(s,f),C=c}function At(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,Ag(f,n[l>>2]|0),j(s,f),C=c}function Wt(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,Ct(f,n[l>>2]|0),j(s,f),C=c}function vr(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,pg(f,n[l>>2]|0),j(s,f),C=c}function Sn(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,hg(f,n[l>>2]|0),j(s,f),C=c}function Fr(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,bm(f,n[l>>2]|0),j(s,f),C=c}function xn(s){return s=s|0,+ +y(Bc(n[s>>2]|0))}function ai(s,l){return s=s|0,l=l|0,+ +y(lg(n[s>>2]|0,l))}function en(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;f=C,C=C+16|0,d=f,ct(d,n[l>>2]|0,c),j(s,d),C=f}function ho(s,l,c){s=s|0,l=l|0,c=c|0,nr(n[s>>2]|0,n[l>>2]|0,c)}function PF(s,l){s=s|0,l=l|0,ms(n[s>>2]|0,n[l>>2]|0)}function sve(s){return s=s|0,wi(n[s>>2]|0)|0}function ove(s){return s=s|0,s=pt(n[s>>2]|0)|0,s?s=Pw(s)|0:s=0,s|0}function ave(s,l){return s=s|0,l=l|0,s=gs(n[s>>2]|0,l)|0,s?s=Pw(s)|0:s=0,s|0}function lve(s,l){s=s|0,l=l|0;var c=0,f=0;f=Vt(4)|0,$G(f,l),c=s+4|0,l=n[c>>2]|0,n[c>>2]=f,l|0&&(jA(l),gt(l)),It(n[s>>2]|0,1)}function $G(s,l){s=s|0,l=l|0,Cve(s,l)}function cve(s,l,c,f,d,m){s=s|0,l=l|0,c=y(c),f=f|0,d=y(d),m=m|0;var B=0,k=0;B=C,C=C+16|0,k=B,uve(k,jo(l)|0,+c,f,+d,m),h[s>>2]=y(+E[k>>3]),h[s+4>>2]=y(+E[k+8>>3]),C=B}function uve(s,l,c,f,d,m){s=s|0,l=l|0,c=+c,f=f|0,d=+d,m=m|0;var B=0,k=0,Q=0,O=0,M=0;B=C,C=C+32|0,M=B+8|0,O=B+20|0,Q=B,k=B+16|0,E[M>>3]=c,n[O>>2]=f,E[Q>>3]=d,n[k>>2]=m,Ave(s,n[l+4>>2]|0,M,O,Q,k),C=B}function Ave(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0;var B=0,k=0;B=C,C=C+16|0,k=B,Va(k),l=da(l)|0,fve(s,l,+E[c>>3],n[f>>2]|0,+E[d>>3],n[m>>2]|0),Ka(k),C=B}function da(s){return s=s|0,n[s>>2]|0}function fve(s,l,c,f,d,m){s=s|0,l=l|0,c=+c,f=f|0,d=+d,m=m|0;var B=0;B=Pl(pve()|0)|0,c=+KA(c),f=SF(f)|0,d=+KA(d),hve(s,hi(0,B|0,l|0,+c,f|0,+d,SF(m)|0)|0)}function pve(){var s=0;return o[7608]|0||(yve(9120),s=7608,n[s>>2]=1,n[s+4>>2]=0),9120}function Pl(s){return s=s|0,n[s+8>>2]|0}function KA(s){return s=+s,+ +xF(s)}function SF(s){return s=s|0,t5(s)|0}function hve(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;d=C,C=C+32|0,c=d,f=l,f&1?(gve(c,0),ii(f|0,c|0)|0,dve(s,c),mve(c)):(n[s>>2]=n[l>>2],n[s+4>>2]=n[l+4>>2],n[s+8>>2]=n[l+8>>2],n[s+12>>2]=n[l+12>>2]),C=d}function gve(s,l){s=s|0,l=l|0,e5(s,l),n[s+8>>2]=0,o[s+24>>0]=0}function dve(s,l){s=s|0,l=l|0,l=l+8|0,n[s>>2]=n[l>>2],n[s+4>>2]=n[l+4>>2],n[s+8>>2]=n[l+8>>2],n[s+12>>2]=n[l+12>>2]}function mve(s){s=s|0,o[s+24>>0]=0}function e5(s,l){s=s|0,l=l|0,n[s>>2]=l}function t5(s){return s=s|0,s|0}function xF(s){return s=+s,+s}function yve(s){s=s|0,Sl(s,Eve()|0,4)}function Eve(){return 1064}function Sl(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c,n[s+8>>2]=cp(l|0,c+1|0)|0}function Cve(s,l){s=s|0,l=l|0,l=n[l>>2]|0,n[s>>2]=l,yl(l|0)}function wve(s){s=s|0;var l=0,c=0;c=s+4|0,l=n[c>>2]|0,n[c>>2]=0,l|0&&(jA(l),gt(l)),It(n[s>>2]|0,0)}function Ive(s){s=s|0,Rt(n[s>>2]|0)}function Bve(s){return s=s|0,er(n[s>>2]|0)|0}function vve(s,l,c,f){s=s|0,l=+l,c=+c,f=f|0,vc(n[s>>2]|0,y(l),y(c),f)}function Dve(s){return s=s|0,+ +y(Il(n[s>>2]|0))}function Pve(s){return s=s|0,+ +y(gg(n[s>>2]|0))}function Sve(s){return s=s|0,+ +y(Iu(n[s>>2]|0))}function xve(s){return s=s|0,+ +y(RA(n[s>>2]|0))}function bve(s){return s=s|0,+ +y(hp(n[s>>2]|0))}function kve(s){return s=s|0,+ +y(ja(n[s>>2]|0))}function Qve(s,l){s=s|0,l=l|0,E[s>>3]=+y(Il(n[l>>2]|0)),E[s+8>>3]=+y(gg(n[l>>2]|0)),E[s+16>>3]=+y(Iu(n[l>>2]|0)),E[s+24>>3]=+y(RA(n[l>>2]|0)),E[s+32>>3]=+y(hp(n[l>>2]|0)),E[s+40>>3]=+y(ja(n[l>>2]|0))}function Fve(s,l){return s=s|0,l=l|0,+ +y(dg(n[s>>2]|0,l))}function Tve(s,l){return s=s|0,l=l|0,+ +y(gp(n[s>>2]|0,l))}function Rve(s,l){return s=s|0,l=l|0,+ +y(qo(n[s>>2]|0,l))}function Nve(){return Pn()|0}function Lve(){Mve(),Ove(),Uve(),_ve(),Hve(),jve()}function Mve(){HNe(11713,4938,1)}function Ove(){oNe(10448)}function Uve(){HRe(10408)}function _ve(){uRe(10324)}function Hve(){yFe(10096)}function jve(){qve(9132)}function qve(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0,Ge=0,Oe=0,Fe=0,et=0,Xe=0,at=0,Ue=0,qe=0,Lt=0,Or=0,or=0,Xt=0,Pr=0,Nr=0,ir=0,bn=0,go=0,mo=0,yo=0,ya=0,Qp=0,Fp=0,xl=0,Tp=0,Fu=0,Tu=0,Rp=0,Np=0,Lp=0,Xr=0,bl=0,Mp=0,bc=0,Op=0,Up=0,Ru=0,Nu=0,kc=0,qs=0,za=0,Wo=0,kl=0,rf=0,nf=0,Lu=0,sf=0,of=0,Gs=0,vs=0,Ql=0,Tn=0,af=0,Eo=0,Qc=0,Co=0,Fc=0,lf=0,cf=0,Tc=0,Ys=0,Fl=0,uf=0,Af=0,ff=0,br=0,Jn=0,Ds=0,wo=0,Ws=0,Tr=0,ur=0,Tl=0;l=C,C=C+672|0,c=l+656|0,Tl=l+648|0,ur=l+640|0,Tr=l+632|0,Ws=l+624|0,wo=l+616|0,Ds=l+608|0,Jn=l+600|0,br=l+592|0,ff=l+584|0,Af=l+576|0,uf=l+568|0,Fl=l+560|0,Ys=l+552|0,Tc=l+544|0,cf=l+536|0,lf=l+528|0,Fc=l+520|0,Co=l+512|0,Qc=l+504|0,Eo=l+496|0,af=l+488|0,Tn=l+480|0,Ql=l+472|0,vs=l+464|0,Gs=l+456|0,of=l+448|0,sf=l+440|0,Lu=l+432|0,nf=l+424|0,rf=l+416|0,kl=l+408|0,Wo=l+400|0,za=l+392|0,qs=l+384|0,kc=l+376|0,Nu=l+368|0,Ru=l+360|0,Up=l+352|0,Op=l+344|0,bc=l+336|0,Mp=l+328|0,bl=l+320|0,Xr=l+312|0,Lp=l+304|0,Np=l+296|0,Rp=l+288|0,Tu=l+280|0,Fu=l+272|0,Tp=l+264|0,xl=l+256|0,Fp=l+248|0,Qp=l+240|0,ya=l+232|0,yo=l+224|0,mo=l+216|0,go=l+208|0,bn=l+200|0,ir=l+192|0,Nr=l+184|0,Pr=l+176|0,Xt=l+168|0,or=l+160|0,Or=l+152|0,Lt=l+144|0,qe=l+136|0,Ue=l+128|0,at=l+120|0,Xe=l+112|0,et=l+104|0,Fe=l+96|0,Oe=l+88|0,Ge=l+80|0,se=l+72|0,q=l+64|0,M=l+56|0,O=l+48|0,Q=l+40|0,k=l+32|0,B=l+24|0,m=l+16|0,d=l+8|0,f=l,Gve(s,3646),Yve(s,3651,2)|0,Wve(s,3665,2)|0,Vve(s,3682,18)|0,n[Tl>>2]=19,n[Tl+4>>2]=0,n[c>>2]=n[Tl>>2],n[c+4>>2]=n[Tl+4>>2],Tw(s,3690,c)|0,n[ur>>2]=1,n[ur+4>>2]=0,n[c>>2]=n[ur>>2],n[c+4>>2]=n[ur+4>>2],Kve(s,3696,c)|0,n[Tr>>2]=2,n[Tr+4>>2]=0,n[c>>2]=n[Tr>>2],n[c+4>>2]=n[Tr+4>>2],bu(s,3706,c)|0,n[Ws>>2]=1,n[Ws+4>>2]=0,n[c>>2]=n[Ws>>2],n[c+4>>2]=n[Ws+4>>2],Dg(s,3722,c)|0,n[wo>>2]=2,n[wo+4>>2]=0,n[c>>2]=n[wo>>2],n[c+4>>2]=n[wo+4>>2],Dg(s,3734,c)|0,n[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+4>>2]=n[q+4>>2],zA(s,4669,c)|0,n[M>>2]=6,n[M+4>>2]=0,n[c>>2]=n[M>>2],n[c+4>>2]=n[M+4>>2],zA(s,4686,c)|0,n[O>>2]=7,n[O+4>>2]=0,n[c>>2]=n[O>>2],n[c+4>>2]=n[O+4>>2],zA(s,4701,c)|0,n[Q>>2]=8,n[Q+4>>2]=0,n[c>>2]=n[Q>>2],n[c+4>>2]=n[Q+4>>2],zA(s,4719,c)|0,n[k>>2]=9,n[k+4>>2]=0,n[c>>2]=n[k>>2],n[c+4>>2]=n[k+4>>2],zA(s,4736,c)|0,n[B>>2]=21,n[B+4>>2]=0,n[c>>2]=n[B>>2],n[c+4>>2]=n[B+4>>2],nDe(s,4754,c)|0,n[m>>2]=2,n[m+4>>2]=0,n[c>>2]=n[m>>2],n[c+4>>2]=n[m+4>>2],iD(s,4772,c)|0,n[d>>2]=3,n[d+4>>2]=0,n[c>>2]=n[d>>2],n[c+4>>2]=n[d+4>>2],iD(s,4790,c)|0,n[f>>2]=4,n[f+4>>2]=0,n[c>>2]=n[f>>2],n[c+4>>2]=n[f+4>>2],iD(s,4808,c)|0,C=l}function Gve(s,l){s=s|0,l=l|0;var c=0;c=cFe()|0,n[s>>2]=c,uFe(c,l),xp(n[s>>2]|0)}function Yve(s,l,c){return s=s|0,l=l|0,c=c|0,JQe(s,pn(l)|0,c,0),s|0}function Wve(s,l,c){return s=s|0,l=l|0,c=c|0,TQe(s,pn(l)|0,c,0),s|0}function Vve(s,l,c){return s=s|0,l=l|0,c=c|0,EQe(s,pn(l)|0,c,0),s|0}function Tw(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],nQe(s,l,d),C=f,s|0}function Kve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Oke(s,l,d),C=f,s|0}function bu(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Ike(s,l,d),C=f,s|0}function Dg(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],oke(s,l,d),C=f,s|0}function Is(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Gbe(s,l,d),C=f,s|0}function JA(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],xbe(s,l,d),C=f,s|0}function bF(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],fbe(s,l,d),C=f,s|0}function Pg(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Oxe(s,l,d),C=f,s|0}function zA(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Ixe(s,l,d),C=f,s|0}function iD(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],oxe(s,l,d),C=f,s|0}function Jve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],GSe(s,l,d),C=f,s|0}function zve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],xSe(s,l,d),C=f,s|0}function Xve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],pSe(s,l,d),C=f,s|0}function Zve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],ZPe(s,l,d),C=f,s|0}function $ve(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],NPe(s,l,d),C=f,s|0}function eDe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],yPe(s,l,d),C=f,s|0}function tDe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],rPe(s,l,d),C=f,s|0}function rDe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],ODe(s,l,d),C=f,s|0}function nDe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],iDe(s,l,d),C=f,s|0}function iDe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],sDe(s,c,d,1),C=f}function pn(s){return s=s|0,s|0}function sDe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=kF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=oDe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,aDe(m,f)|0,f),C=d}function kF(){var s=0,l=0;if(o[7616]|0||(i5(9136),tr(24,9136,U|0)|0,l=7616,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9136)|0)){s=9136,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));i5(9136)}return 9136}function oDe(s){return s=s|0,0}function aDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=kF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],n5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(uDe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function hn(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0;var B=0,k=0,Q=0,O=0,M=0,q=0,se=0,Ge=0;B=C,C=C+32|0,se=B+24|0,q=B+20|0,Q=B+16|0,M=B+12|0,O=B+8|0,k=B+4|0,Ge=B,n[q>>2]=l,n[Q>>2]=c,n[M>>2]=f,n[O>>2]=d,n[k>>2]=m,m=s+28|0,n[Ge>>2]=n[m>>2],n[se>>2]=n[Ge>>2],lDe(s+24|0,se,q,M,O,Q,k)|0,n[m>>2]=n[n[m>>2]>>2],C=B}function lDe(s,l,c,f,d,m,B){return s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,B=B|0,s=cDe(l)|0,l=Vt(24)|0,r5(l+4|0,n[c>>2]|0,n[f>>2]|0,n[d>>2]|0,n[m>>2]|0,n[B>>2]|0),n[l>>2]=n[s>>2],n[s>>2]=l,l|0}function cDe(s){return s=s|0,n[s>>2]|0}function r5(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,n[s>>2]=l,n[s+4>>2]=c,n[s+8>>2]=f,n[s+12>>2]=d,n[s+16>>2]=m}function gr(s,l){return s=s|0,l=l|0,l|s|0}function n5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function uDe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=ADe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,fDe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],n5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,pDe(s,k),hDe(k),C=O;return}}function ADe(s){return s=s|0,357913941}function fDe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function pDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function hDe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function i5(s){s=s|0,mDe(s)}function gDe(s){s=s|0,dDe(s+24|0)}function Rr(s){return s=s|0,n[s>>2]|0}function dDe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function mDe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,3,l,yDe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function Vr(){return 9228}function yDe(){return 1140}function EDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=CDe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=wDe(l,f)|0,C=c,l|0}function Kr(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,n[s>>2]=l,n[s+4>>2]=c,n[s+8>>2]=f,n[s+12>>2]=d,n[s+16>>2]=m}function CDe(s){return s=s|0,(n[(kF()|0)+24>>2]|0)+(s*12|0)|0}function wDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;return d=C,C=C+48|0,f=d,c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),tf[c&31](f,s),f=IDe(f)|0,C=d,f|0}function IDe(s){s=s|0;var l=0,c=0,f=0,d=0;return d=C,C=C+32|0,l=d+12|0,c=d,f=QF(s5()|0)|0,f?(FF(l,f),TF(c,l),BDe(s,c),s=RF(l)|0):s=vDe(s)|0,C=d,s|0}function s5(){var s=0;return o[7632]|0||(RDe(9184),tr(25,9184,U|0)|0,s=7632,n[s>>2]=1,n[s+4>>2]=0),9184}function QF(s){return s=s|0,n[s+36>>2]|0}function FF(s,l){s=s|0,l=l|0,n[s>>2]=l,n[s+4>>2]=s,n[s+8>>2]=0}function TF(s,l){s=s|0,l=l|0,n[s>>2]=n[l>>2],n[s+4>>2]=n[l+4>>2],n[s+8>>2]=0}function BDe(s,l){s=s|0,l=l|0,xDe(l,s,s+8|0,s+16|0,s+24|0,s+32|0,s+40|0)|0}function RF(s){return s=s|0,n[(n[s+4>>2]|0)+8>>2]|0}function vDe(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0,Q=0;Q=C,C=C+16|0,c=Q+4|0,f=Q,d=Wa(8)|0,m=d,B=Vt(48)|0,k=B,l=k+48|0;do n[k>>2]=n[s>>2],k=k+4|0,s=s+4|0;while((k|0)<(l|0));return l=m+4|0,n[l>>2]=B,k=Vt(8)|0,B=n[l>>2]|0,n[f>>2]=0,n[c>>2]=n[f>>2],o5(k,B,c),n[d>>2]=k,C=Q,m|0}function o5(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,c=Vt(16)|0,n[c+4>>2]=0,n[c+8>>2]=0,n[c>>2]=1092,n[c+12>>2]=l,n[s+4>>2]=c}function DDe(s){s=s|0,Jm(s),gt(s)}function PDe(s){s=s|0,s=n[s+12>>2]|0,s|0&>(s)}function SDe(s){s=s|0,gt(s)}function xDe(s,l,c,f,d,m,B){return s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,B=B|0,m=bDe(n[s>>2]|0,l,c,f,d,m,B)|0,B=s+4|0,n[(n[B>>2]|0)+8>>2]=m,n[(n[B>>2]|0)+8>>2]|0}function bDe(s,l,c,f,d,m,B){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,B=B|0;var k=0,Q=0;return k=C,C=C+16|0,Q=k,Va(Q),s=da(s)|0,B=kDe(s,+E[l>>3],+E[c>>3],+E[f>>3],+E[d>>3],+E[m>>3],+E[B>>3])|0,Ka(Q),C=k,B|0}function kDe(s,l,c,f,d,m,B){s=s|0,l=+l,c=+c,f=+f,d=+d,m=+m,B=+B;var k=0;return k=Pl(QDe()|0)|0,l=+KA(l),c=+KA(c),f=+KA(f),d=+KA(d),m=+KA(m),Os(0,k|0,s|0,+l,+c,+f,+d,+m,+ +KA(B))|0}function QDe(){var s=0;return o[7624]|0||(FDe(9172),s=7624,n[s>>2]=1,n[s+4>>2]=0),9172}function FDe(s){s=s|0,Sl(s,TDe()|0,6)}function TDe(){return 1112}function RDe(s){s=s|0,Bp(s)}function NDe(s){s=s|0,a5(s+24|0),l5(s+16|0)}function a5(s){s=s|0,MDe(s)}function l5(s){s=s|0,LDe(s)}function LDe(s){s=s|0;var l=0,c=0;if(l=n[s>>2]|0,l|0)do c=l,l=n[l>>2]|0,gt(c);while((l|0)!=0);n[s>>2]=0}function MDe(s){s=s|0;var l=0,c=0;if(l=n[s>>2]|0,l|0)do c=l,l=n[l>>2]|0,gt(c);while((l|0)!=0);n[s>>2]=0}function Bp(s){s=s|0;var l=0;n[s+16>>2]=0,n[s+20>>2]=0,l=s+24|0,n[l>>2]=0,n[s+28>>2]=l,n[s+36>>2]=0,o[s+40>>0]=0,o[s+41>>0]=0}function ODe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],UDe(s,c,d,0),C=f}function UDe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=NF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=_De(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,HDe(m,f)|0,f),C=d}function NF(){var s=0,l=0;if(o[7640]|0||(u5(9232),tr(26,9232,U|0)|0,l=7640,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9232)|0)){s=9232,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));u5(9232)}return 9232}function _De(s){return s=s|0,0}function HDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=NF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],c5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(jDe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function c5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function jDe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=qDe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,GDe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],c5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,YDe(s,k),WDe(k),C=O;return}}function qDe(s){return s=s|0,357913941}function GDe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function YDe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function WDe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function u5(s){s=s|0,JDe(s)}function VDe(s){s=s|0,KDe(s+24|0)}function KDe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function JDe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,1,l,zDe()|0,3),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function zDe(){return 1144}function XDe(s,l,c,f,d){s=s|0,l=l|0,c=+c,f=+f,d=d|0;var m=0,B=0,k=0,Q=0;m=C,C=C+16|0,B=m+8|0,k=m,Q=ZDe(s)|0,s=n[Q+4>>2]|0,n[k>>2]=n[Q>>2],n[k+4>>2]=s,n[B>>2]=n[k>>2],n[B+4>>2]=n[k+4>>2],$De(l,B,c,f,d),C=m}function ZDe(s){return s=s|0,(n[(NF()|0)+24>>2]|0)+(s*12|0)|0}function $De(s,l,c,f,d){s=s|0,l=l|0,c=+c,f=+f,d=d|0;var m=0,B=0,k=0,Q=0,O=0;O=C,C=C+16|0,B=O+2|0,k=O+1|0,Q=O,m=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(m=n[(n[s>>2]|0)+m>>2]|0),ku(B,c),c=+Qu(B,c),ku(k,f),f=+Qu(k,f),XA(Q,d),Q=ZA(Q,d)|0,D7[m&1](s,c,f,Q),C=O}function ku(s,l){s=s|0,l=+l}function Qu(s,l){return s=s|0,l=+l,+ +tPe(l)}function XA(s,l){s=s|0,l=l|0}function ZA(s,l){return s=s|0,l=l|0,ePe(l)|0}function ePe(s){return s=s|0,s|0}function tPe(s){return s=+s,+s}function rPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],nPe(s,c,d,1),C=f}function nPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=LF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=iPe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,sPe(m,f)|0,f),C=d}function LF(){var s=0,l=0;if(o[7648]|0||(f5(9268),tr(27,9268,U|0)|0,l=7648,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9268)|0)){s=9268,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));f5(9268)}return 9268}function iPe(s){return s=s|0,0}function sPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=LF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],A5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(oPe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function A5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function oPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=aPe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,lPe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],A5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,cPe(s,k),uPe(k),C=O;return}}function aPe(s){return s=s|0,357913941}function lPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function cPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function uPe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function f5(s){s=s|0,pPe(s)}function APe(s){s=s|0,fPe(s+24|0)}function fPe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function pPe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,4,l,hPe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function hPe(){return 1160}function gPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=dPe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=mPe(l,f)|0,C=c,l|0}function dPe(s){return s=s|0,(n[(LF()|0)+24>>2]|0)+(s*12|0)|0}function mPe(s,l){s=s|0,l=l|0;var c=0;return c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),p5(Ng[c&31](s)|0)|0}function p5(s){return s=s|0,s&1|0}function yPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],EPe(s,c,d,0),C=f}function EPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=MF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=CPe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,wPe(m,f)|0,f),C=d}function MF(){var s=0,l=0;if(o[7656]|0||(g5(9304),tr(28,9304,U|0)|0,l=7656,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9304)|0)){s=9304,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));g5(9304)}return 9304}function CPe(s){return s=s|0,0}function wPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=MF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],h5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(IPe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function h5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function IPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=BPe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,vPe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],h5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,DPe(s,k),PPe(k),C=O;return}}function BPe(s){return s=s|0,357913941}function vPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function DPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function PPe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function g5(s){s=s|0,bPe(s)}function SPe(s){s=s|0,xPe(s+24|0)}function xPe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function bPe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,5,l,kPe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function kPe(){return 1164}function QPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=FPe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],TPe(l,d,c),C=f}function FPe(s){return s=s|0,(n[(MF()|0)+24>>2]|0)+(s*12|0)|0}function TPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),vp(d,c),c=Dp(d,c)|0,tf[f&31](s,c),Pp(d),C=m}function vp(s,l){s=s|0,l=l|0,RPe(s,l)}function Dp(s,l){return s=s|0,l=l|0,s|0}function Pp(s){s=s|0,jA(s)}function RPe(s,l){s=s|0,l=l|0,OF(s,l)}function OF(s,l){s=s|0,l=l|0,n[s>>2]=l}function NPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],LPe(s,c,d,0),C=f}function LPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=UF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=MPe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,OPe(m,f)|0,f),C=d}function UF(){var s=0,l=0;if(o[7664]|0||(m5(9340),tr(29,9340,U|0)|0,l=7664,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9340)|0)){s=9340,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));m5(9340)}return 9340}function MPe(s){return s=s|0,0}function OPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=UF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],d5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(UPe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function d5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function UPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=_Pe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,HPe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],d5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,jPe(s,k),qPe(k),C=O;return}}function _Pe(s){return s=s|0,357913941}function HPe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function jPe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function qPe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function m5(s){s=s|0,WPe(s)}function GPe(s){s=s|0,YPe(s+24|0)}function YPe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function WPe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,4,l,VPe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function VPe(){return 1180}function KPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=JPe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],c=zPe(l,d,c)|0,C=f,c|0}function JPe(s){return s=s|0,(n[(UF()|0)+24>>2]|0)+(s*12|0)|0}function zPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;return m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),Sg(d,c),d=xg(d,c)|0,d=sD(NT[f&15](s,d)|0)|0,C=m,d|0}function Sg(s,l){s=s|0,l=l|0}function xg(s,l){return s=s|0,l=l|0,XPe(l)|0}function sD(s){return s=s|0,s|0}function XPe(s){return s=s|0,s|0}function ZPe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],$Pe(s,c,d,0),C=f}function $Pe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=_F()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=eSe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,tSe(m,f)|0,f),C=d}function _F(){var s=0,l=0;if(o[7672]|0||(E5(9376),tr(30,9376,U|0)|0,l=7672,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9376)|0)){s=9376,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));E5(9376)}return 9376}function eSe(s){return s=s|0,0}function tSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=_F()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],y5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(rSe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function y5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function rSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=nSe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,iSe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],y5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,sSe(s,k),oSe(k),C=O;return}}function nSe(s){return s=s|0,357913941}function iSe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function sSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function oSe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function E5(s){s=s|0,cSe(s)}function aSe(s){s=s|0,lSe(s+24|0)}function lSe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function cSe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,5,l,C5()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function C5(){return 1196}function uSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=ASe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=fSe(l,f)|0,C=c,l|0}function ASe(s){return s=s|0,(n[(_F()|0)+24>>2]|0)+(s*12|0)|0}function fSe(s,l){s=s|0,l=l|0;var c=0;return c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),sD(Ng[c&31](s)|0)|0}function pSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],hSe(s,c,d,1),C=f}function hSe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=HF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=gSe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,dSe(m,f)|0,f),C=d}function HF(){var s=0,l=0;if(o[7680]|0||(I5(9412),tr(31,9412,U|0)|0,l=7680,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9412)|0)){s=9412,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));I5(9412)}return 9412}function gSe(s){return s=s|0,0}function dSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=HF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],w5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(mSe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function w5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function mSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=ySe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,ESe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],w5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,CSe(s,k),wSe(k),C=O;return}}function ySe(s){return s=s|0,357913941}function ESe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function CSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function wSe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function I5(s){s=s|0,vSe(s)}function ISe(s){s=s|0,BSe(s+24|0)}function BSe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function vSe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,6,l,B5()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function B5(){return 1200}function DSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=PSe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=SSe(l,f)|0,C=c,l|0}function PSe(s){return s=s|0,(n[(HF()|0)+24>>2]|0)+(s*12|0)|0}function SSe(s,l){s=s|0,l=l|0;var c=0;return c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),oD(Ng[c&31](s)|0)|0}function oD(s){return s=s|0,s|0}function xSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],bSe(s,c,d,0),C=f}function bSe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=jF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=kSe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,QSe(m,f)|0,f),C=d}function jF(){var s=0,l=0;if(o[7688]|0||(D5(9448),tr(32,9448,U|0)|0,l=7688,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9448)|0)){s=9448,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));D5(9448)}return 9448}function kSe(s){return s=s|0,0}function QSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=jF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],v5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(FSe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function v5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function FSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=TSe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,RSe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],v5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,NSe(s,k),LSe(k),C=O;return}}function TSe(s){return s=s|0,357913941}function RSe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function NSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function LSe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function D5(s){s=s|0,USe(s)}function MSe(s){s=s|0,OSe(s+24|0)}function OSe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function USe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,6,l,P5()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function P5(){return 1204}function _Se(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=HSe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],jSe(l,d,c),C=f}function HSe(s){return s=s|0,(n[(jF()|0)+24>>2]|0)+(s*12|0)|0}function jSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),qF(d,c),d=GF(d,c)|0,tf[f&31](s,d),C=m}function qF(s,l){s=s|0,l=l|0}function GF(s,l){return s=s|0,l=l|0,qSe(l)|0}function qSe(s){return s=s|0,s|0}function GSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],YSe(s,c,d,0),C=f}function YSe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=YF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=WSe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,VSe(m,f)|0,f),C=d}function YF(){var s=0,l=0;if(o[7696]|0||(x5(9484),tr(33,9484,U|0)|0,l=7696,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9484)|0)){s=9484,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));x5(9484)}return 9484}function WSe(s){return s=s|0,0}function VSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=YF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],S5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(KSe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function S5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function KSe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=JSe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,zSe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],S5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,XSe(s,k),ZSe(k),C=O;return}}function JSe(s){return s=s|0,357913941}function zSe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function XSe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function ZSe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function x5(s){s=s|0,txe(s)}function $Se(s){s=s|0,exe(s+24|0)}function exe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function txe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,1,l,rxe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function rxe(){return 1212}function nxe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+16|0,m=d+8|0,B=d,k=ixe(s)|0,s=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=s,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],sxe(l,m,c,f),C=d}function ixe(s){return s=s|0,(n[(YF()|0)+24>>2]|0)+(s*12|0)|0}function sxe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;k=C,C=C+16|0,m=k+1|0,B=k,d=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(d=n[(n[s>>2]|0)+d>>2]|0),qF(m,c),m=GF(m,c)|0,Sg(B,f),B=xg(B,f)|0,_w[d&15](s,m,B),C=k}function oxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],axe(s,c,d,1),C=f}function axe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=WF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=lxe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,cxe(m,f)|0,f),C=d}function WF(){var s=0,l=0;if(o[7704]|0||(k5(9520),tr(34,9520,U|0)|0,l=7704,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9520)|0)){s=9520,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));k5(9520)}return 9520}function lxe(s){return s=s|0,0}function cxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=WF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],b5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(uxe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function b5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function uxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=Axe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,fxe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],b5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,pxe(s,k),hxe(k),C=O;return}}function Axe(s){return s=s|0,357913941}function fxe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function pxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function hxe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function k5(s){s=s|0,mxe(s)}function gxe(s){s=s|0,dxe(s+24|0)}function dxe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function mxe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,1,l,yxe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function yxe(){return 1224}function Exe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;return d=C,C=C+16|0,m=d+8|0,B=d,k=Cxe(s)|0,s=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=s,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],f=+wxe(l,m,c),C=d,+f}function Cxe(s){return s=s|0,(n[(WF()|0)+24>>2]|0)+(s*12|0)|0}function wxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),XA(d,c),d=ZA(d,c)|0,B=+xF(+S7[f&7](s,d)),C=m,+B}function Ixe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Bxe(s,c,d,1),C=f}function Bxe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=VF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=vxe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,Dxe(m,f)|0,f),C=d}function VF(){var s=0,l=0;if(o[7712]|0||(F5(9556),tr(35,9556,U|0)|0,l=7712,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9556)|0)){s=9556,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));F5(9556)}return 9556}function vxe(s){return s=s|0,0}function Dxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=VF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],Q5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(Pxe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function Q5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function Pxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=Sxe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,xxe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],Q5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,bxe(s,k),kxe(k),C=O;return}}function Sxe(s){return s=s|0,357913941}function xxe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function bxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function kxe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function F5(s){s=s|0,Txe(s)}function Qxe(s){s=s|0,Fxe(s+24|0)}function Fxe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function Txe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,5,l,Rxe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function Rxe(){return 1232}function Nxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=Lxe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],c=+Mxe(l,d),C=f,+c}function Lxe(s){return s=s|0,(n[(VF()|0)+24>>2]|0)+(s*12|0)|0}function Mxe(s,l){s=s|0,l=l|0;var c=0;return c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),+ +xF(+P7[c&15](s))}function Oxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Uxe(s,c,d,1),C=f}function Uxe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=KF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=_xe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,Hxe(m,f)|0,f),C=d}function KF(){var s=0,l=0;if(o[7720]|0||(R5(9592),tr(36,9592,U|0)|0,l=7720,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9592)|0)){s=9592,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));R5(9592)}return 9592}function _xe(s){return s=s|0,0}function Hxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=KF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],T5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(jxe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function T5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function jxe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=qxe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,Gxe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],T5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,Yxe(s,k),Wxe(k),C=O;return}}function qxe(s){return s=s|0,357913941}function Gxe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function Yxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function Wxe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function R5(s){s=s|0,Jxe(s)}function Vxe(s){s=s|0,Kxe(s+24|0)}function Kxe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function Jxe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,7,l,zxe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function zxe(){return 1276}function Xxe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=Zxe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=$xe(l,f)|0,C=c,l|0}function Zxe(s){return s=s|0,(n[(KF()|0)+24>>2]|0)+(s*12|0)|0}function $xe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;return d=C,C=C+16|0,f=d,c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),tf[c&31](f,s),f=N5(f)|0,C=d,f|0}function N5(s){s=s|0;var l=0,c=0,f=0,d=0;return d=C,C=C+32|0,l=d+12|0,c=d,f=QF(L5()|0)|0,f?(FF(l,f),TF(c,l),ebe(s,c),s=RF(l)|0):s=tbe(s)|0,C=d,s|0}function L5(){var s=0;return o[7736]|0||(Abe(9640),tr(25,9640,U|0)|0,s=7736,n[s>>2]=1,n[s+4>>2]=0),9640}function ebe(s,l){s=s|0,l=l|0,sbe(l,s,s+8|0)|0}function tbe(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0;return c=C,C=C+16|0,d=c+4|0,B=c,f=Wa(8)|0,l=f,k=Vt(16)|0,n[k>>2]=n[s>>2],n[k+4>>2]=n[s+4>>2],n[k+8>>2]=n[s+8>>2],n[k+12>>2]=n[s+12>>2],m=l+4|0,n[m>>2]=k,s=Vt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],JF(s,m,d),n[f>>2]=s,C=c,l|0}function JF(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,c=Vt(16)|0,n[c+4>>2]=0,n[c+8>>2]=0,n[c>>2]=1244,n[c+12>>2]=l,n[s+4>>2]=c}function rbe(s){s=s|0,Jm(s),gt(s)}function nbe(s){s=s|0,s=n[s+12>>2]|0,s|0&>(s)}function ibe(s){s=s|0,gt(s)}function sbe(s,l,c){return s=s|0,l=l|0,c=c|0,l=obe(n[s>>2]|0,l,c)|0,c=s+4|0,n[(n[c>>2]|0)+8>>2]=l,n[(n[c>>2]|0)+8>>2]|0}function obe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;return f=C,C=C+16|0,d=f,Va(d),s=da(s)|0,c=abe(s,n[l>>2]|0,+E[c>>3])|0,Ka(d),C=f,c|0}function abe(s,l,c){s=s|0,l=l|0,c=+c;var f=0;return f=Pl(lbe()|0)|0,l=SF(l)|0,ml(0,f|0,s|0,l|0,+ +KA(c))|0}function lbe(){var s=0;return o[7728]|0||(cbe(9628),s=7728,n[s>>2]=1,n[s+4>>2]=0),9628}function cbe(s){s=s|0,Sl(s,ube()|0,2)}function ube(){return 1264}function Abe(s){s=s|0,Bp(s)}function fbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],pbe(s,c,d,1),C=f}function pbe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=zF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=hbe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,gbe(m,f)|0,f),C=d}function zF(){var s=0,l=0;if(o[7744]|0||(O5(9684),tr(37,9684,U|0)|0,l=7744,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9684)|0)){s=9684,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));O5(9684)}return 9684}function hbe(s){return s=s|0,0}function gbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=zF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],M5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(dbe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function M5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function dbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=mbe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,ybe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],M5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,Ebe(s,k),Cbe(k),C=O;return}}function mbe(s){return s=s|0,357913941}function ybe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function Ebe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function Cbe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function O5(s){s=s|0,Bbe(s)}function wbe(s){s=s|0,Ibe(s+24|0)}function Ibe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function Bbe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,5,l,vbe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function vbe(){return 1280}function Dbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=Pbe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],c=Sbe(l,d,c)|0,C=f,c|0}function Pbe(s){return s=s|0,(n[(zF()|0)+24>>2]|0)+(s*12|0)|0}function Sbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return B=C,C=C+32|0,d=B,m=B+16|0,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),XA(m,c),m=ZA(m,c)|0,_w[f&15](d,s,m),m=N5(d)|0,C=B,m|0}function xbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],bbe(s,c,d,1),C=f}function bbe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=XF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=kbe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,Qbe(m,f)|0,f),C=d}function XF(){var s=0,l=0;if(o[7752]|0||(_5(9720),tr(38,9720,U|0)|0,l=7752,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9720)|0)){s=9720,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));_5(9720)}return 9720}function kbe(s){return s=s|0,0}function Qbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=XF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],U5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(Fbe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function U5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function Fbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=Tbe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,Rbe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],U5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,Nbe(s,k),Lbe(k),C=O;return}}function Tbe(s){return s=s|0,357913941}function Rbe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function Nbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function Lbe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function _5(s){s=s|0,Ube(s)}function Mbe(s){s=s|0,Obe(s+24|0)}function Obe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function Ube(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,8,l,_be()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function _be(){return 1288}function Hbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;return c=C,C=C+16|0,f=c+8|0,d=c,m=jbe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],l=qbe(l,f)|0,C=c,l|0}function jbe(s){return s=s|0,(n[(XF()|0)+24>>2]|0)+(s*12|0)|0}function qbe(s,l){s=s|0,l=l|0;var c=0;return c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),t5(Ng[c&31](s)|0)|0}function Gbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Ybe(s,c,d,0),C=f}function Ybe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=ZF()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=Wbe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,Vbe(m,f)|0,f),C=d}function ZF(){var s=0,l=0;if(o[7760]|0||(j5(9756),tr(39,9756,U|0)|0,l=7760,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9756)|0)){s=9756,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));j5(9756)}return 9756}function Wbe(s){return s=s|0,0}function Vbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=ZF()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],H5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(Kbe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function H5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function Kbe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=Jbe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,zbe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],H5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,Xbe(s,k),Zbe(k),C=O;return}}function Jbe(s){return s=s|0,357913941}function zbe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function Xbe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function Zbe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function j5(s){s=s|0,tke(s)}function $be(s){s=s|0,eke(s+24|0)}function eke(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function tke(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,8,l,rke()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function rke(){return 1292}function nke(s,l,c){s=s|0,l=l|0,c=+c;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=ike(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],ske(l,d,c),C=f}function ike(s){return s=s|0,(n[(ZF()|0)+24>>2]|0)+(s*12|0)|0}function ske(s,l,c){s=s|0,l=l|0,c=+c;var f=0,d=0,m=0;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),ku(d,c),c=+Qu(d,c),B7[f&31](s,c),C=m}function oke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],ake(s,c,d,0),C=f}function ake(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=$F()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=lke(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,cke(m,f)|0,f),C=d}function $F(){var s=0,l=0;if(o[7768]|0||(G5(9792),tr(40,9792,U|0)|0,l=7768,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9792)|0)){s=9792,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));G5(9792)}return 9792}function lke(s){return s=s|0,0}function cke(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=$F()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],q5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(uke(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function q5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function uke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=Ake(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,fke(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],q5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,pke(s,k),hke(k),C=O;return}}function Ake(s){return s=s|0,357913941}function fke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function pke(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function hke(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function G5(s){s=s|0,mke(s)}function gke(s){s=s|0,dke(s+24|0)}function dke(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function mke(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,1,l,yke()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function yke(){return 1300}function Eke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=+f;var d=0,m=0,B=0,k=0;d=C,C=C+16|0,m=d+8|0,B=d,k=Cke(s)|0,s=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=s,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],wke(l,m,c,f),C=d}function Cke(s){return s=s|0,(n[($F()|0)+24>>2]|0)+(s*12|0)|0}function wke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=+f;var d=0,m=0,B=0,k=0;k=C,C=C+16|0,m=k+1|0,B=k,d=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(d=n[(n[s>>2]|0)+d>>2]|0),XA(m,c),m=ZA(m,c)|0,ku(B,f),f=+Qu(B,f),Q7[d&15](s,m,f),C=k}function Ike(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Bke(s,c,d,0),C=f}function Bke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=eT()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=vke(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,Dke(m,f)|0,f),C=d}function eT(){var s=0,l=0;if(o[7776]|0||(W5(9828),tr(41,9828,U|0)|0,l=7776,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9828)|0)){s=9828,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));W5(9828)}return 9828}function vke(s){return s=s|0,0}function Dke(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=eT()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],Y5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(Pke(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function Y5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function Pke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=Ske(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,xke(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],Y5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,bke(s,k),kke(k),C=O;return}}function Ske(s){return s=s|0,357913941}function xke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function bke(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function kke(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function W5(s){s=s|0,Tke(s)}function Qke(s){s=s|0,Fke(s+24|0)}function Fke(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function Tke(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,7,l,Rke()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function Rke(){return 1312}function Nke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=Lke(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Mke(l,d,c),C=f}function Lke(s){return s=s|0,(n[(eT()|0)+24>>2]|0)+(s*12|0)|0}function Mke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),XA(d,c),d=ZA(d,c)|0,tf[f&31](s,d),C=m}function Oke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],Uke(s,c,d,0),C=f}function Uke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=tT()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=_ke(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,Hke(m,f)|0,f),C=d}function tT(){var s=0,l=0;if(o[7784]|0||(K5(9864),tr(42,9864,U|0)|0,l=7784,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9864)|0)){s=9864,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));K5(9864)}return 9864}function _ke(s){return s=s|0,0}function Hke(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=tT()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],V5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(jke(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function V5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function jke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=qke(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,Gke(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],V5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,Yke(s,k),Wke(k),C=O;return}}function qke(s){return s=s|0,357913941}function Gke(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function Yke(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function Wke(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function K5(s){s=s|0,Jke(s)}function Vke(s){s=s|0,Kke(s+24|0)}function Kke(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function Jke(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,8,l,zke()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function zke(){return 1320}function Xke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=Zke(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],$ke(l,d,c),C=f}function Zke(s){return s=s|0,(n[(tT()|0)+24>>2]|0)+(s*12|0)|0}function $ke(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),eQe(d,c),d=tQe(d,c)|0,tf[f&31](s,d),C=m}function eQe(s,l){s=s|0,l=l|0}function tQe(s,l){return s=s|0,l=l|0,rQe(l)|0}function rQe(s){return s=s|0,s|0}function nQe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],iQe(s,c,d,0),C=f}function iQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=rT()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=sQe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,oQe(m,f)|0,f),C=d}function rT(){var s=0,l=0;if(o[7792]|0||(z5(9900),tr(43,9900,U|0)|0,l=7792,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9900)|0)){s=9900,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));z5(9900)}return 9900}function sQe(s){return s=s|0,0}function oQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=rT()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],J5(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(aQe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function J5(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function aQe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=lQe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,cQe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],J5(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,uQe(s,k),AQe(k),C=O;return}}function lQe(s){return s=s|0,357913941}function cQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function uQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function AQe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function z5(s){s=s|0,hQe(s)}function fQe(s){s=s|0,pQe(s+24|0)}function pQe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function hQe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,22,l,gQe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function gQe(){return 1344}function dQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0;c=C,C=C+16|0,f=c+8|0,d=c,m=mQe(s)|0,s=n[m+4>>2]|0,n[d>>2]=n[m>>2],n[d+4>>2]=s,n[f>>2]=n[d>>2],n[f+4>>2]=n[d+4>>2],yQe(l,f),C=c}function mQe(s){return s=s|0,(n[(rT()|0)+24>>2]|0)+(s*12|0)|0}function yQe(s,l){s=s|0,l=l|0;var c=0;c=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(c=n[(n[s>>2]|0)+c>>2]|0),ef[c&127](s)}function EQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=nT()|0,s=CQe(c)|0,hn(m,l,d,s,wQe(c,f)|0,f)}function nT(){var s=0,l=0;if(o[7800]|0||(Z5(9936),tr(44,9936,U|0)|0,l=7800,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9936)|0)){s=9936,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));Z5(9936)}return 9936}function CQe(s){return s=s|0,s|0}function wQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,Q=nT()|0,B=Q+24|0,l=gr(l,4)|0,n[m>>2]=l,c=Q+28|0,f=n[c>>2]|0,f>>>0<(n[Q+32>>2]|0)>>>0?(X5(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(IQe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function X5(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function IQe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=BQe(s)|0,f>>>0>>0)zr(s);else{Q=n[s>>2]|0,M=(n[s+8>>2]|0)-Q|0,O=M>>2,vQe(d,M>>3>>>0>>1>>>0?O>>>0>>0?B:O:f,(n[m>>2]|0)-Q>>3,s+8|0),B=d+8|0,X5(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,DQe(s,d),PQe(d),C=k;return}}function BQe(s){return s=s|0,536870911}function vQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Vt(l<<3)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function DQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function PQe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&>(s)}function Z5(s){s=s|0,bQe(s)}function SQe(s){s=s|0,xQe(s+24|0)}function xQe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function bQe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,1,23,l,P5()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function kQe(s,l){s=s|0,l=l|0,FQe(n[(QQe(s)|0)>>2]|0,l)}function QQe(s){return s=s|0,(n[(nT()|0)+24>>2]|0)+(s<<3)|0}function FQe(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,qF(f,l),l=GF(f,l)|0,ef[s&127](l),C=c}function TQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=iT()|0,s=RQe(c)|0,hn(m,l,d,s,NQe(c,f)|0,f)}function iT(){var s=0,l=0;if(o[7808]|0||(e9(9972),tr(45,9972,U|0)|0,l=7808,n[l>>2]=1,n[l+4>>2]=0),!(Rr(9972)|0)){s=9972,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));e9(9972)}return 9972}function RQe(s){return s=s|0,s|0}function NQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,Q=iT()|0,B=Q+24|0,l=gr(l,4)|0,n[m>>2]=l,c=Q+28|0,f=n[c>>2]|0,f>>>0<(n[Q+32>>2]|0)>>>0?($5(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(LQe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function $5(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function LQe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=MQe(s)|0,f>>>0>>0)zr(s);else{Q=n[s>>2]|0,M=(n[s+8>>2]|0)-Q|0,O=M>>2,OQe(d,M>>3>>>0>>1>>>0?O>>>0>>0?B:O:f,(n[m>>2]|0)-Q>>3,s+8|0),B=d+8|0,$5(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,UQe(s,d),_Qe(d),C=k;return}}function MQe(s){return s=s|0,536870911}function OQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Vt(l<<3)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function UQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function _Qe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&>(s)}function e9(s){s=s|0,qQe(s)}function HQe(s){s=s|0,jQe(s+24|0)}function jQe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function qQe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,1,9,l,GQe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function GQe(){return 1348}function YQe(s,l){return s=s|0,l=l|0,VQe(n[(WQe(s)|0)>>2]|0,l)|0}function WQe(s){return s=s|0,(n[(iT()|0)+24>>2]|0)+(s<<3)|0}function VQe(s,l){s=s|0,l=l|0;var c=0,f=0;return c=C,C=C+16|0,f=c,t9(f,l),l=r9(f,l)|0,l=sD(Ng[s&31](l)|0)|0,C=c,l|0}function t9(s,l){s=s|0,l=l|0}function r9(s,l){return s=s|0,l=l|0,KQe(l)|0}function KQe(s){return s=s|0,s|0}function JQe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=sT()|0,s=zQe(c)|0,hn(m,l,d,s,XQe(c,f)|0,f)}function sT(){var s=0,l=0;if(o[7816]|0||(i9(10008),tr(46,10008,U|0)|0,l=7816,n[l>>2]=1,n[l+4>>2]=0),!(Rr(10008)|0)){s=10008,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));i9(10008)}return 10008}function zQe(s){return s=s|0,s|0}function XQe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,Q=sT()|0,B=Q+24|0,l=gr(l,4)|0,n[m>>2]=l,c=Q+28|0,f=n[c>>2]|0,f>>>0<(n[Q+32>>2]|0)>>>0?(n9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(ZQe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function n9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function ZQe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=$Qe(s)|0,f>>>0>>0)zr(s);else{Q=n[s>>2]|0,M=(n[s+8>>2]|0)-Q|0,O=M>>2,eFe(d,M>>3>>>0>>1>>>0?O>>>0>>0?B:O:f,(n[m>>2]|0)-Q>>3,s+8|0),B=d+8|0,n9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,tFe(s,d),rFe(d),C=k;return}}function $Qe(s){return s=s|0,536870911}function eFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Vt(l<<3)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function tFe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function rFe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&>(s)}function i9(s){s=s|0,sFe(s)}function nFe(s){s=s|0,iFe(s+24|0)}function iFe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function sFe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,1,15,l,C5()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function oFe(s){return s=s|0,lFe(n[(aFe(s)|0)>>2]|0)|0}function aFe(s){return s=s|0,(n[(sT()|0)+24>>2]|0)+(s<<3)|0}function lFe(s){return s=s|0,sD(CD[s&7]()|0)|0}function cFe(){var s=0;return o[7832]|0||(mFe(10052),tr(25,10052,U|0)|0,s=7832,n[s>>2]=1,n[s+4>>2]=0),10052}function uFe(s,l){s=s|0,l=l|0,n[s>>2]=AFe()|0,n[s+4>>2]=fFe()|0,n[s+12>>2]=l,n[s+8>>2]=pFe()|0,n[s+32>>2]=2}function AFe(){return 11709}function fFe(){return 1188}function pFe(){return aD()|0}function hFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Sp(f,896)|0)==512?c|0&&(gFe(c),gt(c)):l|0&&(Pu(l),gt(l))}function Sp(s,l){return s=s|0,l=l|0,l&s|0}function gFe(s){s=s|0,s=n[s+4>>2]|0,s|0&&bp(s)}function aD(){var s=0;return o[7824]|0||(n[2511]=dFe()|0,n[2512]=0,s=7824,n[s>>2]=1,n[s+4>>2]=0),10044}function dFe(){return 0}function mFe(s){s=s|0,Bp(s)}function yFe(s){s=s|0;var l=0,c=0,f=0,d=0,m=0;l=C,C=C+32|0,c=l+24|0,m=l+16|0,d=l+8|0,f=l,EFe(s,4827),CFe(s,4834,3)|0,wFe(s,3682,47)|0,n[m>>2]=9,n[m+4>>2]=0,n[c>>2]=n[m>>2],n[c+4>>2]=n[m+4>>2],IFe(s,4841,c)|0,n[d>>2]=1,n[d+4>>2]=0,n[c>>2]=n[d>>2],n[c+4>>2]=n[d+4>>2],BFe(s,4871,c)|0,n[f>>2]=10,n[f+4>>2]=0,n[c>>2]=n[f>>2],n[c+4>>2]=n[f+4>>2],vFe(s,4891,c)|0,C=l}function EFe(s,l){s=s|0,l=l|0;var c=0;c=rRe()|0,n[s>>2]=c,nRe(c,l),xp(n[s>>2]|0)}function CFe(s,l,c){return s=s|0,l=l|0,c=c|0,_Te(s,pn(l)|0,c,0),s|0}function wFe(s,l,c){return s=s|0,l=l|0,c=c|0,DTe(s,pn(l)|0,c,0),s|0}function IFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],oTe(s,l,d),C=f,s|0}function BFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],HFe(s,l,d),C=f,s|0}function vFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=n[c+4>>2]|0,n[m>>2]=n[c>>2],n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],DFe(s,l,d),C=f,s|0}function DFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],PFe(s,c,d,1),C=f}function PFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=oT()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=SFe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,xFe(m,f)|0,f),C=d}function oT(){var s=0,l=0;if(o[7840]|0||(o9(10100),tr(48,10100,U|0)|0,l=7840,n[l>>2]=1,n[l+4>>2]=0),!(Rr(10100)|0)){s=10100,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));o9(10100)}return 10100}function SFe(s){return s=s|0,0}function xFe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=oT()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],s9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(bFe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function s9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function bFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=kFe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,QFe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],s9(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,FFe(s,k),TFe(k),C=O;return}}function kFe(s){return s=s|0,357913941}function QFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function FFe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function TFe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function o9(s){s=s|0,LFe(s)}function RFe(s){s=s|0,NFe(s+24|0)}function NFe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function LFe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,6,l,MFe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function MFe(){return 1364}function OFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;return f=C,C=C+16|0,d=f+8|0,m=f,B=UFe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],c=_Fe(l,d,c)|0,C=f,c|0}function UFe(s){return s=s|0,(n[(oT()|0)+24>>2]|0)+(s*12|0)|0}function _Fe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;return m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),XA(d,c),d=ZA(d,c)|0,d=p5(NT[f&15](s,d)|0)|0,C=m,d|0}function HFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],jFe(s,c,d,0),C=f}function jFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=aT()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=qFe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,GFe(m,f)|0,f),C=d}function aT(){var s=0,l=0;if(o[7848]|0||(l9(10136),tr(49,10136,U|0)|0,l=7848,n[l>>2]=1,n[l+4>>2]=0),!(Rr(10136)|0)){s=10136,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));l9(10136)}return 10136}function qFe(s){return s=s|0,0}function GFe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=aT()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],a9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(YFe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function a9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function YFe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=WFe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,VFe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],a9(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,KFe(s,k),JFe(k),C=O;return}}function WFe(s){return s=s|0,357913941}function VFe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function KFe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function JFe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function l9(s){s=s|0,ZFe(s)}function zFe(s){s=s|0,XFe(s+24|0)}function XFe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function ZFe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,9,l,$Fe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function $Fe(){return 1372}function eTe(s,l,c){s=s|0,l=l|0,c=+c;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,d=f+8|0,m=f,B=tTe(s)|0,s=n[B+4>>2]|0,n[m>>2]=n[B>>2],n[m+4>>2]=s,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],rTe(l,d,c),C=f}function tTe(s){return s=s|0,(n[(aT()|0)+24>>2]|0)+(s*12|0)|0}function rTe(s,l,c){s=s|0,l=l|0,c=+c;var f=0,d=0,m=0,B=Ze;m=C,C=C+16|0,d=m,f=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(f=n[(n[s>>2]|0)+f>>2]|0),nTe(d,c),B=y(iTe(d,c)),I7[f&1](s,B),C=m}function nTe(s,l){s=s|0,l=+l}function iTe(s,l){return s=s|0,l=+l,y(sTe(l))}function sTe(s){return s=+s,y(s)}function oTe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,d=f+8|0,m=f,k=n[c>>2]|0,B=n[c+4>>2]|0,c=pn(l)|0,n[m>>2]=k,n[m+4>>2]=B,n[d>>2]=n[m>>2],n[d+4>>2]=n[m+4>>2],aTe(s,c,d,0),C=f}function aTe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0,Q=0,O=0,M=0;d=C,C=C+32|0,m=d+16|0,M=d+8|0,k=d,O=n[c>>2]|0,Q=n[c+4>>2]|0,B=n[s>>2]|0,s=lT()|0,n[M>>2]=O,n[M+4>>2]=Q,n[m>>2]=n[M>>2],n[m+4>>2]=n[M+4>>2],c=lTe(m)|0,n[k>>2]=O,n[k+4>>2]=Q,n[m>>2]=n[k>>2],n[m+4>>2]=n[k+4>>2],hn(B,l,s,c,cTe(m,f)|0,f),C=d}function lT(){var s=0,l=0;if(o[7856]|0||(u9(10172),tr(50,10172,U|0)|0,l=7856,n[l>>2]=1,n[l+4>>2]=0),!(Rr(10172)|0)){s=10172,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));u9(10172)}return 10172}function lTe(s){return s=s|0,0}function cTe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0;return M=C,C=C+32|0,d=M+24|0,B=M+16|0,k=M,Q=M+8|0,m=n[s>>2]|0,f=n[s+4>>2]|0,n[k>>2]=m,n[k+4>>2]=f,q=lT()|0,O=q+24|0,s=gr(l,4)|0,n[Q>>2]=s,l=q+28|0,c=n[l>>2]|0,c>>>0<(n[q+32>>2]|0)>>>0?(n[B>>2]=m,n[B+4>>2]=f,n[d>>2]=n[B>>2],n[d+4>>2]=n[B+4>>2],c9(c,d,s),s=(n[l>>2]|0)+12|0,n[l>>2]=s):(uTe(O,k,Q),s=n[l>>2]|0),C=M,((s-(n[O>>2]|0)|0)/12|0)+-1|0}function c9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=n[l+4>>2]|0,n[s>>2]=n[l>>2],n[s+4>>2]=f,n[s+8>>2]=c}function uTe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;if(O=C,C=C+48|0,f=O+32|0,B=O+24|0,k=O,Q=s+4|0,d=(((n[Q>>2]|0)-(n[s>>2]|0)|0)/12|0)+1|0,m=ATe(s)|0,m>>>0>>0)zr(s);else{M=n[s>>2]|0,se=((n[s+8>>2]|0)-M|0)/12|0,q=se<<1,fTe(k,se>>>0>>1>>>0?q>>>0>>0?d:q:m,((n[Q>>2]|0)-M|0)/12|0,s+8|0),Q=k+8|0,m=n[Q>>2]|0,d=n[l+4>>2]|0,c=n[c>>2]|0,n[B>>2]=n[l>>2],n[B+4>>2]=d,n[f>>2]=n[B>>2],n[f+4>>2]=n[B+4>>2],c9(m,f,c),n[Q>>2]=(n[Q>>2]|0)+12,pTe(s,k),hTe(k),C=O;return}}function ATe(s){return s=s|0,357913941}function fTe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>357913941)Tt();else{d=Vt(l*12|0)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c*12|0)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l*12|0)}function pTe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(((d|0)/-12|0)*12|0)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function hTe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~(((f+-12-l|0)>>>0)/12|0)*12|0)),s=n[s>>2]|0,s|0&>(s)}function u9(s){s=s|0,mTe(s)}function gTe(s){s=s|0,dTe(s+24|0)}function dTe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~(((l+-12-f|0)>>>0)/12|0)*12|0)),gt(c))}function mTe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,2,3,l,yTe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function yTe(){return 1380}function ETe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+16|0,m=d+8|0,B=d,k=CTe(s)|0,s=n[k+4>>2]|0,n[B>>2]=n[k>>2],n[B+4>>2]=s,n[m>>2]=n[B>>2],n[m+4>>2]=n[B+4>>2],wTe(l,m,c,f),C=d}function CTe(s){return s=s|0,(n[(lT()|0)+24>>2]|0)+(s*12|0)|0}function wTe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;k=C,C=C+16|0,m=k+1|0,B=k,d=n[l>>2]|0,l=n[l+4>>2]|0,s=s+(l>>1)|0,l&1&&(d=n[(n[s>>2]|0)+d>>2]|0),XA(m,c),m=ZA(m,c)|0,ITe(B,f),B=BTe(B,f)|0,_w[d&15](s,m,B),C=k}function ITe(s,l){s=s|0,l=l|0}function BTe(s,l){return s=s|0,l=l|0,vTe(l)|0}function vTe(s){return s=s|0,(s|0)!=0|0}function DTe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=cT()|0,s=PTe(c)|0,hn(m,l,d,s,STe(c,f)|0,f)}function cT(){var s=0,l=0;if(o[7864]|0||(f9(10208),tr(51,10208,U|0)|0,l=7864,n[l>>2]=1,n[l+4>>2]=0),!(Rr(10208)|0)){s=10208,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));f9(10208)}return 10208}function PTe(s){return s=s|0,s|0}function STe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,Q=cT()|0,B=Q+24|0,l=gr(l,4)|0,n[m>>2]=l,c=Q+28|0,f=n[c>>2]|0,f>>>0<(n[Q+32>>2]|0)>>>0?(A9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(xTe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function A9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function xTe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=bTe(s)|0,f>>>0>>0)zr(s);else{Q=n[s>>2]|0,M=(n[s+8>>2]|0)-Q|0,O=M>>2,kTe(d,M>>3>>>0>>1>>>0?O>>>0>>0?B:O:f,(n[m>>2]|0)-Q>>3,s+8|0),B=d+8|0,A9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,QTe(s,d),FTe(d),C=k;return}}function bTe(s){return s=s|0,536870911}function kTe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Vt(l<<3)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function QTe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function FTe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&>(s)}function f9(s){s=s|0,NTe(s)}function TTe(s){s=s|0,RTe(s+24|0)}function RTe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function NTe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,1,24,l,LTe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function LTe(){return 1392}function MTe(s,l){s=s|0,l=l|0,UTe(n[(OTe(s)|0)>>2]|0,l)}function OTe(s){return s=s|0,(n[(cT()|0)+24>>2]|0)+(s<<3)|0}function UTe(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,t9(f,l),l=r9(f,l)|0,ef[s&127](l),C=c}function _Te(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=uT()|0,s=HTe(c)|0,hn(m,l,d,s,jTe(c,f)|0,f)}function uT(){var s=0,l=0;if(o[7872]|0||(h9(10244),tr(52,10244,U|0)|0,l=7872,n[l>>2]=1,n[l+4>>2]=0),!(Rr(10244)|0)){s=10244,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));h9(10244)}return 10244}function HTe(s){return s=s|0,s|0}function jTe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,Q=uT()|0,B=Q+24|0,l=gr(l,4)|0,n[m>>2]=l,c=Q+28|0,f=n[c>>2]|0,f>>>0<(n[Q+32>>2]|0)>>>0?(p9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(qTe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function p9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function qTe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=GTe(s)|0,f>>>0>>0)zr(s);else{Q=n[s>>2]|0,M=(n[s+8>>2]|0)-Q|0,O=M>>2,YTe(d,M>>3>>>0>>1>>>0?O>>>0>>0?B:O:f,(n[m>>2]|0)-Q>>3,s+8|0),B=d+8|0,p9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,WTe(s,d),VTe(d),C=k;return}}function GTe(s){return s=s|0,536870911}function YTe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Vt(l<<3)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function WTe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function VTe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&>(s)}function h9(s){s=s|0,zTe(s)}function KTe(s){s=s|0,JTe(s+24|0)}function JTe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function zTe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,1,16,l,XTe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function XTe(){return 1400}function ZTe(s){return s=s|0,eRe(n[($Te(s)|0)>>2]|0)|0}function $Te(s){return s=s|0,(n[(uT()|0)+24>>2]|0)+(s<<3)|0}function eRe(s){return s=s|0,tRe(CD[s&7]()|0)|0}function tRe(s){return s=s|0,s|0}function rRe(){var s=0;return o[7880]|0||(cRe(10280),tr(25,10280,U|0)|0,s=7880,n[s>>2]=1,n[s+4>>2]=0),10280}function nRe(s,l){s=s|0,l=l|0,n[s>>2]=iRe()|0,n[s+4>>2]=sRe()|0,n[s+12>>2]=l,n[s+8>>2]=oRe()|0,n[s+32>>2]=4}function iRe(){return 11711}function sRe(){return 1356}function oRe(){return aD()|0}function aRe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Sp(f,896)|0)==512?c|0&&(lRe(c),gt(c)):l|0&&(vg(l),gt(l))}function lRe(s){s=s|0,s=n[s+4>>2]|0,s|0&&bp(s)}function cRe(s){s=s|0,Bp(s)}function uRe(s){s=s|0,ARe(s,4920),fRe(s)|0,pRe(s)|0}function ARe(s,l){s=s|0,l=l|0;var c=0;c=L5()|0,n[s>>2]=c,RRe(c,l),xp(n[s>>2]|0)}function fRe(s){s=s|0;var l=0;return l=n[s>>2]|0,bg(l,vRe()|0),s|0}function pRe(s){s=s|0;var l=0;return l=n[s>>2]|0,bg(l,hRe()|0),s|0}function hRe(){var s=0;return o[7888]|0||(g9(10328),tr(53,10328,U|0)|0,s=7888,n[s>>2]=1,n[s+4>>2]=0),Rr(10328)|0||g9(10328),10328}function bg(s,l){s=s|0,l=l|0,hn(s,0,l,0,0,0)}function g9(s){s=s|0,mRe(s),kg(s,10)}function gRe(s){s=s|0,dRe(s+24|0)}function dRe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function mRe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,5,1,l,wRe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function yRe(s,l,c){s=s|0,l=l|0,c=+c,ERe(s,l,c)}function kg(s,l){s=s|0,l=l|0,n[s+20>>2]=l}function ERe(s,l,c){s=s|0,l=l|0,c=+c;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+16|0,m=f+8|0,k=f+13|0,d=f,B=f+12|0,XA(k,l),n[m>>2]=ZA(k,l)|0,ku(B,c),E[d>>3]=+Qu(B,c),CRe(s,m,d),C=f}function CRe(s,l,c){s=s|0,l=l|0,c=c|0,Y(s+8|0,n[l>>2]|0,+E[c>>3]),o[s+24>>0]=1}function wRe(){return 1404}function IRe(s,l){return s=s|0,l=+l,BRe(s,l)|0}function BRe(s,l){s=s|0,l=+l;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return f=C,C=C+16|0,m=f+4|0,B=f+8|0,k=f,d=Wa(8)|0,c=d,Q=Vt(16)|0,XA(m,s),s=ZA(m,s)|0,ku(B,l),Y(Q,s,+Qu(B,l)),B=c+4|0,n[B>>2]=Q,s=Vt(8)|0,B=n[B>>2]|0,n[k>>2]=0,n[m>>2]=n[k>>2],JF(s,B,m),n[d>>2]=s,C=f,c|0}function vRe(){var s=0;return o[7896]|0||(d9(10364),tr(54,10364,U|0)|0,s=7896,n[s>>2]=1,n[s+4>>2]=0),Rr(10364)|0||d9(10364),10364}function d9(s){s=s|0,SRe(s),kg(s,55)}function DRe(s){s=s|0,PRe(s+24|0)}function PRe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function SRe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,5,4,l,QRe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function xRe(s){s=s|0,bRe(s)}function bRe(s){s=s|0,kRe(s)}function kRe(s){s=s|0,m9(s+8|0),o[s+24>>0]=1}function m9(s){s=s|0,n[s>>2]=0,E[s+8>>3]=0}function QRe(){return 1424}function FRe(){return TRe()|0}function TRe(){var s=0,l=0,c=0,f=0,d=0,m=0,B=0;return l=C,C=C+16|0,d=l+4|0,B=l,c=Wa(8)|0,s=c,f=Vt(16)|0,m9(f),m=s+4|0,n[m>>2]=f,f=Vt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],JF(f,m,d),n[c>>2]=f,C=l,s|0}function RRe(s,l){s=s|0,l=l|0,n[s>>2]=NRe()|0,n[s+4>>2]=LRe()|0,n[s+12>>2]=l,n[s+8>>2]=MRe()|0,n[s+32>>2]=5}function NRe(){return 11710}function LRe(){return 1416}function MRe(){return lD()|0}function ORe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Sp(f,896)|0)==512?c|0&&(URe(c),gt(c)):l|0&>(l)}function URe(s){s=s|0,s=n[s+4>>2]|0,s|0&&bp(s)}function lD(){var s=0;return o[7904]|0||(n[2600]=_Re()|0,n[2601]=0,s=7904,n[s>>2]=1,n[s+4>>2]=0),10400}function _Re(){return n[357]|0}function HRe(s){s=s|0,jRe(s,4926),qRe(s)|0}function jRe(s,l){s=s|0,l=l|0;var c=0;c=s5()|0,n[s>>2]=c,eNe(c,l),xp(n[s>>2]|0)}function qRe(s){s=s|0;var l=0;return l=n[s>>2]|0,bg(l,GRe()|0),s|0}function GRe(){var s=0;return o[7912]|0||(y9(10412),tr(56,10412,U|0)|0,s=7912,n[s>>2]=1,n[s+4>>2]=0),Rr(10412)|0||y9(10412),10412}function y9(s){s=s|0,VRe(s),kg(s,57)}function YRe(s){s=s|0,WRe(s+24|0)}function WRe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function VRe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,5,5,l,XRe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function KRe(s){s=s|0,JRe(s)}function JRe(s){s=s|0,zRe(s)}function zRe(s){s=s|0;var l=0,c=0;l=s+8|0,c=l+48|0;do n[l>>2]=0,l=l+4|0;while((l|0)<(c|0));o[s+56>>0]=1}function XRe(){return 1432}function ZRe(){return $Re()|0}function $Re(){var s=0,l=0,c=0,f=0,d=0,m=0,B=0,k=0;B=C,C=C+16|0,s=B+4|0,l=B,c=Wa(8)|0,f=c,d=Vt(48)|0,m=d,k=m+48|0;do n[m>>2]=0,m=m+4|0;while((m|0)<(k|0));return m=f+4|0,n[m>>2]=d,k=Vt(8)|0,m=n[m>>2]|0,n[l>>2]=0,n[s>>2]=n[l>>2],o5(k,m,s),n[c>>2]=k,C=B,f|0}function eNe(s,l){s=s|0,l=l|0,n[s>>2]=tNe()|0,n[s+4>>2]=rNe()|0,n[s+12>>2]=l,n[s+8>>2]=nNe()|0,n[s+32>>2]=6}function tNe(){return 11704}function rNe(){return 1436}function nNe(){return lD()|0}function iNe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Sp(f,896)|0)==512?c|0&&(sNe(c),gt(c)):l|0&>(l)}function sNe(s){s=s|0,s=n[s+4>>2]|0,s|0&&bp(s)}function oNe(s){s=s|0,aNe(s,4933),lNe(s)|0,cNe(s)|0}function aNe(s,l){s=s|0,l=l|0;var c=0;c=TNe()|0,n[s>>2]=c,RNe(c,l),xp(n[s>>2]|0)}function lNe(s){s=s|0;var l=0;return l=n[s>>2]|0,bg(l,BNe()|0),s|0}function cNe(s){s=s|0;var l=0;return l=n[s>>2]|0,bg(l,uNe()|0),s|0}function uNe(){var s=0;return o[7920]|0||(E9(10452),tr(58,10452,U|0)|0,s=7920,n[s>>2]=1,n[s+4>>2]=0),Rr(10452)|0||E9(10452),10452}function E9(s){s=s|0,pNe(s),kg(s,1)}function ANe(s){s=s|0,fNe(s+24|0)}function fNe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function pNe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,5,1,l,mNe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function hNe(s,l,c){s=s|0,l=+l,c=+c,gNe(s,l,c)}function gNe(s,l,c){s=s|0,l=+l,c=+c;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+32|0,m=f+8|0,k=f+17|0,d=f,B=f+16|0,ku(k,l),E[m>>3]=+Qu(k,l),ku(B,c),E[d>>3]=+Qu(B,c),dNe(s,m,d),C=f}function dNe(s,l,c){s=s|0,l=l|0,c=c|0,C9(s+8|0,+E[l>>3],+E[c>>3]),o[s+24>>0]=1}function C9(s,l,c){s=s|0,l=+l,c=+c,E[s>>3]=l,E[s+8>>3]=c}function mNe(){return 1472}function yNe(s,l){return s=+s,l=+l,ENe(s,l)|0}function ENe(s,l){s=+s,l=+l;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return f=C,C=C+16|0,B=f+4|0,k=f+8|0,Q=f,d=Wa(8)|0,c=d,m=Vt(16)|0,ku(B,s),s=+Qu(B,s),ku(k,l),C9(m,s,+Qu(k,l)),k=c+4|0,n[k>>2]=m,m=Vt(8)|0,k=n[k>>2]|0,n[Q>>2]=0,n[B>>2]=n[Q>>2],w9(m,k,B),n[d>>2]=m,C=f,c|0}function w9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,c=Vt(16)|0,n[c+4>>2]=0,n[c+8>>2]=0,n[c>>2]=1452,n[c+12>>2]=l,n[s+4>>2]=c}function CNe(s){s=s|0,Jm(s),gt(s)}function wNe(s){s=s|0,s=n[s+12>>2]|0,s|0&>(s)}function INe(s){s=s|0,gt(s)}function BNe(){var s=0;return o[7928]|0||(I9(10488),tr(59,10488,U|0)|0,s=7928,n[s>>2]=1,n[s+4>>2]=0),Rr(10488)|0||I9(10488),10488}function I9(s){s=s|0,PNe(s),kg(s,60)}function vNe(s){s=s|0,DNe(s+24|0)}function DNe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function PNe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,5,6,l,kNe()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function SNe(s){s=s|0,xNe(s)}function xNe(s){s=s|0,bNe(s)}function bNe(s){s=s|0,B9(s+8|0),o[s+24>>0]=1}function B9(s){s=s|0,n[s>>2]=0,n[s+4>>2]=0,n[s+8>>2]=0,n[s+12>>2]=0}function kNe(){return 1492}function QNe(){return FNe()|0}function FNe(){var s=0,l=0,c=0,f=0,d=0,m=0,B=0;return l=C,C=C+16|0,d=l+4|0,B=l,c=Wa(8)|0,s=c,f=Vt(16)|0,B9(f),m=s+4|0,n[m>>2]=f,f=Vt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],w9(f,m,d),n[c>>2]=f,C=l,s|0}function TNe(){var s=0;return o[7936]|0||(_Ne(10524),tr(25,10524,U|0)|0,s=7936,n[s>>2]=1,n[s+4>>2]=0),10524}function RNe(s,l){s=s|0,l=l|0,n[s>>2]=NNe()|0,n[s+4>>2]=LNe()|0,n[s+12>>2]=l,n[s+8>>2]=MNe()|0,n[s+32>>2]=7}function NNe(){return 11700}function LNe(){return 1484}function MNe(){return lD()|0}function ONe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Sp(f,896)|0)==512?c|0&&(UNe(c),gt(c)):l|0&>(l)}function UNe(s){s=s|0,s=n[s+4>>2]|0,s|0&&bp(s)}function _Ne(s){s=s|0,Bp(s)}function HNe(s,l,c){s=s|0,l=l|0,c=c|0,s=pn(l)|0,l=jNe(c)|0,c=qNe(c,0)|0,ELe(s,l,c,AT()|0,0)}function jNe(s){return s=s|0,s|0}function qNe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,Q=AT()|0,B=Q+24|0,l=gr(l,4)|0,n[m>>2]=l,c=Q+28|0,f=n[c>>2]|0,f>>>0<(n[Q+32>>2]|0)>>>0?(D9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(zNe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function AT(){var s=0,l=0;if(o[7944]|0||(v9(10568),tr(61,10568,U|0)|0,l=7944,n[l>>2]=1,n[l+4>>2]=0),!(Rr(10568)|0)){s=10568,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));v9(10568)}return 10568}function v9(s){s=s|0,WNe(s)}function GNe(s){s=s|0,YNe(s+24|0)}function YNe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function WNe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,1,17,l,B5()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function VNe(s){return s=s|0,JNe(n[(KNe(s)|0)>>2]|0)|0}function KNe(s){return s=s|0,(n[(AT()|0)+24>>2]|0)+(s<<3)|0}function JNe(s){return s=s|0,oD(CD[s&7]()|0)|0}function D9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function zNe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=XNe(s)|0,f>>>0>>0)zr(s);else{Q=n[s>>2]|0,M=(n[s+8>>2]|0)-Q|0,O=M>>2,ZNe(d,M>>3>>>0>>1>>>0?O>>>0>>0?B:O:f,(n[m>>2]|0)-Q>>3,s+8|0),B=d+8|0,D9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,$Ne(s,d),eLe(d),C=k;return}}function XNe(s){return s=s|0,536870911}function ZNe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Vt(l<<3)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function $Ne(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function eLe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&>(s)}function tLe(){rLe()}function rLe(){nLe(10604)}function nLe(s){s=s|0,iLe(s,4955)}function iLe(s,l){s=s|0,l=l|0;var c=0;c=sLe()|0,n[s>>2]=c,oLe(c,l),xp(n[s>>2]|0)}function sLe(){var s=0;return o[7952]|0||(gLe(10612),tr(25,10612,U|0)|0,s=7952,n[s>>2]=1,n[s+4>>2]=0),10612}function oLe(s,l){s=s|0,l=l|0,n[s>>2]=uLe()|0,n[s+4>>2]=ALe()|0,n[s+12>>2]=l,n[s+8>>2]=fLe()|0,n[s+32>>2]=8}function xp(s){s=s|0;var l=0,c=0;l=C,C=C+16|0,c=l,Gm()|0,n[c>>2]=s,aLe(10608,c),C=l}function Gm(){return o[11714]|0||(n[2652]=0,tr(62,10608,U|0)|0,o[11714]=1),10608}function aLe(s,l){s=s|0,l=l|0;var c=0;c=Vt(8)|0,n[c+4>>2]=n[l>>2],n[c>>2]=n[s>>2],n[s>>2]=c}function lLe(s){s=s|0,cLe(s)}function cLe(s){s=s|0;var l=0,c=0;if(l=n[s>>2]|0,l|0)do c=l,l=n[l>>2]|0,gt(c);while((l|0)!=0);n[s>>2]=0}function uLe(){return 11715}function ALe(){return 1496}function fLe(){return aD()|0}function pLe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Sp(f,896)|0)==512?c|0&&(hLe(c),gt(c)):l|0&>(l)}function hLe(s){s=s|0,s=n[s+4>>2]|0,s|0&&bp(s)}function gLe(s){s=s|0,Bp(s)}function dLe(s,l){s=s|0,l=l|0;var c=0,f=0;Gm()|0,c=n[2652]|0;e:do if(c|0){for(;f=n[c+4>>2]|0,!(f|0&&(o7(fT(f)|0,s)|0)==0);)if(c=n[c>>2]|0,!c)break e;mLe(f,l)}while(0)}function fT(s){return s=s|0,n[s+12>>2]|0}function mLe(s,l){s=s|0,l=l|0;var c=0;s=s+36|0,c=n[s>>2]|0,c|0&&(jA(c),gt(c)),c=Vt(4)|0,$G(c,l),n[s>>2]=c}function pT(){return o[11716]|0||(n[2664]=0,tr(63,10656,U|0)|0,o[11716]=1),10656}function P9(){var s=0;return o[11717]|0?s=n[2665]|0:(yLe(),n[2665]=1504,o[11717]=1,s=1504),s|0}function yLe(){o[11740]|0||(o[11718]=gr(gr(8,0)|0,0)|0,o[11719]=gr(gr(0,0)|0,0)|0,o[11720]=gr(gr(0,16)|0,0)|0,o[11721]=gr(gr(8,0)|0,0)|0,o[11722]=gr(gr(0,0)|0,0)|0,o[11723]=gr(gr(8,0)|0,0)|0,o[11724]=gr(gr(0,0)|0,0)|0,o[11725]=gr(gr(8,0)|0,0)|0,o[11726]=gr(gr(0,0)|0,0)|0,o[11727]=gr(gr(8,0)|0,0)|0,o[11728]=gr(gr(0,0)|0,0)|0,o[11729]=gr(gr(0,0)|0,32)|0,o[11730]=gr(gr(0,0)|0,32)|0,o[11740]=1)}function S9(){return 1572}function ELe(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,Q=0,O=0,M=0;m=C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function hT(s){return s=s|0,n[s+12>>2]|0}function Rw(s){return s=s|0,n[s+12>>2]|0}function Nw(s){return s=s|0,n[s+16>>2]|0}function wLe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;d=C,C=C+32|0,c=d,f=n[s>>2]|0,(n[s+8>>2]|0)-f>>2>>>0>>0&&(L9(c,l,(n[s+4>>2]|0)-f>>2,s+8|0),M9(s,c),O9(c)),C=d}function gT(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0;if(B=C,C=C+32|0,c=B,f=s+4|0,d=((n[f>>2]|0)-(n[s>>2]|0)>>2)+1|0,m=N9(s)|0,m>>>0>>0)zr(s);else{k=n[s>>2]|0,O=(n[s+8>>2]|0)-k|0,Q=O>>1,L9(c,O>>2>>>0>>1>>>0?Q>>>0>>0?d:Q:m,(n[f>>2]|0)-k>>2,s+8|0),m=c+8|0,n[n[m>>2]>>2]=n[l>>2],n[m>>2]=(n[m>>2]|0)+4,M9(s,c),O9(c),C=B;return}}function Lw(s){return s=s|0,n[s+8>>2]|0}function ILe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0;if(B=C,C=C+32|0,c=B,f=s+4|0,d=((n[f>>2]|0)-(n[s>>2]|0)>>2)+1|0,m=R9(s)|0,m>>>0>>0)zr(s);else{k=n[s>>2]|0,O=(n[s+8>>2]|0)-k|0,Q=O>>1,jLe(c,O>>2>>>0>>1>>>0?Q>>>0>>0?d:Q:m,(n[f>>2]|0)-k>>2,s+8|0),m=c+8|0,n[n[m>>2]>>2]=n[l>>2],n[m>>2]=(n[m>>2]|0)+4,qLe(s,c),GLe(c),C=B;return}}function cD(s){return s=s|0,n[s>>2]|0}function BLe(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,vLe(s,l,c,f,d,m)}function dT(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2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=n[m>>2],M=m+4|0,n[Q+4>>2]=n[M>>2],q=m+8|0,n[Q+8>>2]=n[q>>2],n[q>>2]=0,n[M>>2]=0,n[m>>2]=0,ao(0,O|0,s|0,l|0,c|0,f|0,d|0,xLe(Q)|0)|0,dT(Q),$A(k),C=B}function SLe(){var s=0;return o[7968]|0||(LLe(10708),s=7968,n[s>>2]=1,n[s+4>>2]=0),10708}function Qg(s){return s=s|0,Q9(s)|0}function b9(s){return s=s|0,k9(s)|0}function yT(s){return s=s|0,oD(s)|0}function ET(s){return s=s|0,kLe(s)|0}function xLe(s){return s=s|0,bLe(s)|0}function bLe(s){s=s|0;var l=0,c=0,f=0;if(f=(n[s+4>>2]|0)-(n[s>>2]|0)|0,c=f>>2,f=Wa(f+4|0)|0,n[f>>2]=c,c|0){l=0;do n[f+4+(l<<2)>>2]=k9(n[(n[s>>2]|0)+(l<<2)>>2]|0)|0,l=l+1|0;while((l|0)!=(c|0))}return f|0}function k9(s){return s=s|0,s|0}function kLe(s){s=s|0;var l=0,c=0,f=0;if(f=(n[s+4>>2]|0)-(n[s>>2]|0)|0,c=f>>2,f=Wa(f+4|0)|0,n[f>>2]=c,c|0){l=0;do n[f+4+(l<<2)>>2]=Q9((n[s>>2]|0)+(l<<2)|0)|0,l=l+1|0;while((l|0)!=(c|0))}return f|0}function Q9(s){s=s|0;var l=0,c=0,f=0,d=0;return d=C,C=C+32|0,l=d+12|0,c=d,f=QF(F9()|0)|0,f?(FF(l,f),TF(c,l),fUe(s,c),s=RF(l)|0):s=QLe(s)|0,C=d,s|0}function F9(){var s=0;return o[7960]|0||(NLe(10664),tr(25,10664,U|0)|0,s=7960,n[s>>2]=1,n[s+4>>2]=0),10664}function QLe(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0;return c=C,C=C+16|0,d=c+4|0,B=c,f=Wa(8)|0,l=f,k=Vt(4)|0,n[k>>2]=n[s>>2],m=l+4|0,n[m>>2]=k,s=Vt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],T9(s,m,d),n[f>>2]=s,C=c,l|0}function T9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,c=Vt(16)|0,n[c+4>>2]=0,n[c+8>>2]=0,n[c>>2]=1656,n[c+12>>2]=l,n[s+4>>2]=c}function FLe(s){s=s|0,Jm(s),gt(s)}function TLe(s){s=s|0,s=n[s+12>>2]|0,s|0&>(s)}function RLe(s){s=s|0,gt(s)}function NLe(s){s=s|0,Bp(s)}function LLe(s){s=s|0,Sl(s,MLe()|0,5)}function MLe(){return 1676}function OLe(s,l){s=s|0,l=l|0;var c=0;if((R9(s)|0)>>>0>>0&&zr(s),l>>>0>1073741823)Tt();else{c=Vt(l<<2)|0,n[s+4>>2]=c,n[s>>2]=c,n[s+8>>2]=c+(l<<2);return}}function ULe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,f=s+4|0,s=c-l|0,(s|0)>0&&(Dr(n[f>>2]|0,l|0,s|0)|0,n[f>>2]=(n[f>>2]|0)+(s>>>2<<2))}function R9(s){return s=s|0,1073741823}function _Le(s,l){s=s|0,l=l|0;var c=0;if((N9(s)|0)>>>0>>0&&zr(s),l>>>0>1073741823)Tt();else{c=Vt(l<<2)|0,n[s+4>>2]=c,n[s>>2]=c,n[s+8>>2]=c+(l<<2);return}}function HLe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,f=s+4|0,s=c-l|0,(s|0)>0&&(Dr(n[f>>2]|0,l|0,s|0)|0,n[f>>2]=(n[f>>2]|0)+(s>>>2<<2))}function N9(s){return s=s|0,1073741823}function jLe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>1073741823)Tt();else{d=Vt(l<<2)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<2)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<2)}function qLe(s,l){s=s|0,l=l|0;var c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function VLe(s,l,c){s=s|0,l=l|0,c=c|0,aMe(s,l,c)}function Ym(s){return s=s|0,s|0}function KLe(s,l,c){s=s|0,l=l|0,c=c|0,nMe(s,l,c)}function U9(s){return s=s|0,s+16|0}function JLe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;if(m=C,C=C+16|0,d=m+8|0,c=m,n[s>>2]=0,f=n[l>>2]|0,n[d>>2]=f,n[c>>2]=s,c=rMe(c)|0,f|0){if(f=Vt(12)|0,B=(H9(d)|0)+4|0,s=n[B+4>>2]|0,l=f+4|0,n[l>>2]=n[B>>2],n[l+4>>2]=s,l=n[n[d>>2]>>2]|0,n[d>>2]=l,!l)s=f;else for(l=f;s=Vt(12)|0,Q=(H9(d)|0)+4|0,k=n[Q+4>>2]|0,B=s+4|0,n[B>>2]=n[Q>>2],n[B+4>>2]=k,n[l>>2]=s,B=n[n[d>>2]>>2]|0,n[d>>2]=B,B;)l=s;n[s>>2]=n[c>>2],n[c>>2]=f}C=m}function zLe(s,l,c){s=s|0,l=l|0,c=c|0,XLe(s,l,c)}function _9(s){return s=s|0,s+24|0}function XLe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+32|0,B=f+24|0,d=f+16|0,k=f+12|0,m=f,Va(d),s=da(s)|0,n[k>>2]=n[l>>2],mT(m,c),n[B>>2]=n[k>>2],ZLe(s,B,m),$A(m),Ka(d),C=f}function ZLe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=C,C=C+32|0,B=f+16|0,k=f+12|0,d=f,m=Pl($Le()|0)|0,n[k>>2]=n[l>>2],n[B>>2]=n[k>>2],l=Qg(B)|0,n[d>>2]=n[c>>2],B=c+4|0,n[d+4>>2]=n[B>>2],k=c+8|0,n[d+8>>2]=n[k>>2],n[k>>2]=0,n[B>>2]=0,n[c>>2]=0,oo(0,m|0,s|0,l|0,ET(d)|0)|0,$A(d),C=f}function $Le(){var s=0;return o[7976]|0||(eMe(10720),s=7976,n[s>>2]=1,n[s+4>>2]=0),10720}function eMe(s){s=s|0,Sl(s,tMe()|0,2)}function tMe(){return 1732}function rMe(s){return s=s|0,n[s>>2]|0}function H9(s){return s=s|0,n[s>>2]|0}function nMe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+32|0,m=f+16|0,d=f+8|0,B=f,Va(d),s=da(s)|0,n[B>>2]=n[l>>2],c=n[c>>2]|0,n[m>>2]=n[B>>2],j9(s,m,c),Ka(d),C=f}function j9(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+16|0,m=f+4|0,B=f,d=Pl(iMe()|0)|0,n[B>>2]=n[l>>2],n[m>>2]=n[B>>2],l=Qg(m)|0,oo(0,d|0,s|0,l|0,b9(c)|0)|0,C=f}function iMe(){var s=0;return o[7984]|0||(sMe(10732),s=7984,n[s>>2]=1,n[s+4>>2]=0),10732}function sMe(s){s=s|0,Sl(s,oMe()|0,2)}function oMe(){return 1744}function aMe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;f=C,C=C+32|0,m=f+16|0,d=f+8|0,B=f,Va(d),s=da(s)|0,n[B>>2]=n[l>>2],c=n[c>>2]|0,n[m>>2]=n[B>>2],j9(s,m,c),Ka(d),C=f}function lMe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+32|0,B=d+16|0,m=d+8|0,k=d,Va(m),s=da(s)|0,n[k>>2]=n[l>>2],c=o[c>>0]|0,f=o[f>>0]|0,n[B>>2]=n[k>>2],cMe(s,B,c,f),Ka(m),C=d}function cMe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+16|0,B=d+4|0,k=d,m=Pl(uMe()|0)|0,n[k>>2]=n[l>>2],n[B>>2]=n[k>>2],l=Qg(B)|0,c=Wm(c)|0,pc(0,m|0,s|0,l|0,c|0,Wm(f)|0)|0,C=d}function uMe(){var s=0;return o[7992]|0||(fMe(10744),s=7992,n[s>>2]=1,n[s+4>>2]=0),10744}function Wm(s){return s=s|0,AMe(s)|0}function AMe(s){return s=s|0,s&255|0}function fMe(s){s=s|0,Sl(s,pMe()|0,3)}function pMe(){return 1756}function hMe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;switch(se=C,C=C+32|0,k=se+8|0,Q=se+4|0,O=se+20|0,M=se,OF(s,0),f=AUe(l)|0,n[k>>2]=0,q=k+4|0,n[q>>2]=0,n[k+8>>2]=0,f<<24>>24){case 0:{o[O>>0]=0,gMe(Q,c,O),uD(s,Q)|0,qA(Q);break}case 8:{q=DT(l)|0,o[O>>0]=8,xc(M,n[q+4>>2]|0),dMe(Q,c,O,M,q+8|0),uD(s,Q)|0,qA(Q);break}case 9:{if(m=DT(l)|0,l=n[m+4>>2]|0,l|0)for(B=k+8|0,d=m+12|0;l=l+-1|0,xc(Q,n[d>>2]|0),f=n[q>>2]|0,f>>>0<(n[B>>2]|0)>>>0?(n[f>>2]=n[Q>>2],n[q>>2]=(n[q>>2]|0)+4):gT(k,Q),l;)d=d+4|0;o[O>>0]=9,xc(M,n[m+8>>2]|0),mMe(Q,c,O,M,k),uD(s,Q)|0,qA(Q);break}default:q=DT(l)|0,o[O>>0]=f,xc(M,n[q+4>>2]|0),yMe(Q,c,O,M),uD(s,Q)|0,qA(Q)}$A(k),C=se}function gMe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;f=C,C=C+16|0,d=f,Va(d),l=da(l)|0,QMe(s,l,o[c>>0]|0),Ka(d),C=f}function uD(s,l){s=s|0,l=l|0;var c=0;return c=n[s>>2]|0,c|0&&PA(c|0),n[s>>2]=n[l>>2],n[l>>2]=0,s|0}function dMe(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,Q=0;m=C,C=C+32|0,k=m+16|0,B=m+8|0,Q=m,Va(B),l=da(l)|0,c=o[c>>0]|0,n[Q>>2]=n[f>>2],d=n[d>>2]|0,n[k>>2]=n[Q>>2],SMe(s,l,c,k,d),Ka(B),C=m}function mMe(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,Q=0,O=0;m=C,C=C+32|0,Q=m+24|0,B=m+16|0,O=m+12|0,k=m,Va(B),l=da(l)|0,c=o[c>>0]|0,n[O>>2]=n[f>>2],mT(k,d),n[Q>>2]=n[O>>2],BMe(s,l,c,Q,k),$A(k),Ka(B),C=m}function yMe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+32|0,B=d+16|0,m=d+8|0,k=d,Va(m),l=da(l)|0,c=o[c>>0]|0,n[k>>2]=n[f>>2],n[B>>2]=n[k>>2],EMe(s,l,c,B),Ka(m),C=d}function EMe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0,B=0,k=0;d=C,C=C+16|0,m=d+4|0,k=d,B=Pl(CMe()|0)|0,c=Wm(c)|0,n[k>>2]=n[f>>2],n[m>>2]=n[k>>2],AD(s,oo(0,B|0,l|0,c|0,Qg(m)|0)|0),C=d}function CMe(){var s=0;return o[8e3]|0||(wMe(10756),s=8e3,n[s>>2]=1,n[s+4>>2]=0),10756}function AD(s,l){s=s|0,l=l|0,OF(s,l)}function wMe(s){s=s|0,Sl(s,IMe()|0,2)}function IMe(){return 1772}function BMe(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,Q=0,O=0;m=C,C=C+32|0,Q=m+16|0,O=m+12|0,B=m,k=Pl(vMe()|0)|0,c=Wm(c)|0,n[O>>2]=n[f>>2],n[Q>>2]=n[O>>2],f=Qg(Q)|0,n[B>>2]=n[d>>2],Q=d+4|0,n[B+4>>2]=n[Q>>2],O=d+8|0,n[B+8>>2]=n[O>>2],n[O>>2]=0,n[Q>>2]=0,n[d>>2]=0,AD(s,pc(0,k|0,l|0,c|0,f|0,ET(B)|0)|0),$A(B),C=m}function vMe(){var s=0;return o[8008]|0||(DMe(10768),s=8008,n[s>>2]=1,n[s+4>>2]=0),10768}function DMe(s){s=s|0,Sl(s,PMe()|0,3)}function PMe(){return 1784}function SMe(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,Q=0;m=C,C=C+16|0,k=m+4|0,Q=m,B=Pl(xMe()|0)|0,c=Wm(c)|0,n[Q>>2]=n[f>>2],n[k>>2]=n[Q>>2],f=Qg(k)|0,AD(s,pc(0,B|0,l|0,c|0,f|0,yT(d)|0)|0),C=m}function xMe(){var s=0;return o[8016]|0||(bMe(10780),s=8016,n[s>>2]=1,n[s+4>>2]=0),10780}function bMe(s){s=s|0,Sl(s,kMe()|0,3)}function kMe(){return 1800}function QMe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;f=Pl(FMe()|0)|0,AD(s,Qn(0,f|0,l|0,Wm(c)|0)|0)}function FMe(){var s=0;return o[8024]|0||(TMe(10792),s=8024,n[s>>2]=1,n[s+4>>2]=0),10792}function TMe(s){s=s|0,Sl(s,RMe()|0,1)}function RMe(){return 1816}function NMe(){LMe(),MMe(),OMe()}function LMe(){n[2702]=d7(65536)|0}function MMe(){iOe(10856)}function OMe(){UMe(10816)}function UMe(s){s=s|0,_Me(s,5044),HMe(s)|0}function _Me(s,l){s=s|0,l=l|0;var c=0;c=F9()|0,n[s>>2]=c,ZMe(c,l),xp(n[s>>2]|0)}function HMe(s){s=s|0;var l=0;return l=n[s>>2]|0,bg(l,jMe()|0),s|0}function jMe(){var s=0;return o[8032]|0||(q9(10820),tr(64,10820,U|0)|0,s=8032,n[s>>2]=1,n[s+4>>2]=0),Rr(10820)|0||q9(10820),10820}function q9(s){s=s|0,YMe(s),kg(s,25)}function qMe(s){s=s|0,GMe(s+24|0)}function GMe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function YMe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,5,18,l,JMe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function WMe(s,l){s=s|0,l=l|0,VMe(s,l)}function VMe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;c=C,C=C+16|0,f=c,d=c+4|0,Sg(d,l),n[f>>2]=xg(d,l)|0,KMe(s,f),C=c}function KMe(s,l){s=s|0,l=l|0,G9(s+4|0,n[l>>2]|0),o[s+8>>0]=1}function G9(s,l){s=s|0,l=l|0,n[s>>2]=l}function JMe(){return 1824}function zMe(s){return s=s|0,XMe(s)|0}function XMe(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0;return c=C,C=C+16|0,d=c+4|0,B=c,f=Wa(8)|0,l=f,k=Vt(4)|0,Sg(d,s),G9(k,xg(d,s)|0),m=l+4|0,n[m>>2]=k,s=Vt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],T9(s,m,d),n[f>>2]=s,C=c,l|0}function Wa(s){s=s|0;var l=0,c=0;return s=s+7&-8,s>>>0<=32768&&(l=n[2701]|0,s>>>0<=(65536-l|0)>>>0)?(c=(n[2702]|0)+l|0,n[2701]=l+s,s=c):(s=d7(s+8|0)|0,n[s>>2]=n[2703],n[2703]=s,s=s+8|0),s|0}function ZMe(s,l){s=s|0,l=l|0,n[s>>2]=$Me()|0,n[s+4>>2]=eOe()|0,n[s+12>>2]=l,n[s+8>>2]=tOe()|0,n[s+32>>2]=9}function $Me(){return 11744}function eOe(){return 1832}function tOe(){return lD()|0}function rOe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Sp(f,896)|0)==512?c|0&&(nOe(c),gt(c)):l|0&>(l)}function nOe(s){s=s|0,s=n[s+4>>2]|0,s|0&&bp(s)}function iOe(s){s=s|0,sOe(s,5052),oOe(s)|0,aOe(s,5058,26)|0,lOe(s,5069,1)|0,cOe(s,5077,10)|0,uOe(s,5087,19)|0,AOe(s,5094,27)|0}function sOe(s,l){s=s|0,l=l|0;var c=0;c=nUe()|0,n[s>>2]=c,iUe(c,l),xp(n[s>>2]|0)}function oOe(s){s=s|0;var l=0;return l=n[s>>2]|0,bg(l,q4e()|0),s|0}function aOe(s,l,c){return s=s|0,l=l|0,c=c|0,D4e(s,pn(l)|0,c,0),s|0}function lOe(s,l,c){return s=s|0,l=l|0,c=c|0,u4e(s,pn(l)|0,c,0),s|0}function cOe(s,l,c){return s=s|0,l=l|0,c=c|0,jOe(s,pn(l)|0,c,0),s|0}function uOe(s,l,c){return s=s|0,l=l|0,c=c|0,SOe(s,pn(l)|0,c,0),s|0}function Y9(s,l){s=s|0,l=l|0;var c=0,f=0;e:for(;;){for(c=n[2703]|0;;){if((c|0)==(l|0))break e;if(f=n[c>>2]|0,n[2703]=f,!c)c=f;else break}gt(c)}n[2701]=s}function AOe(s,l,c){return s=s|0,l=l|0,c=c|0,fOe(s,pn(l)|0,c,0),s|0}function fOe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=CT()|0,s=pOe(c)|0,hn(m,l,d,s,hOe(c,f)|0,f)}function CT(){var s=0,l=0;if(o[8040]|0||(V9(10860),tr(65,10860,U|0)|0,l=8040,n[l>>2]=1,n[l+4>>2]=0),!(Rr(10860)|0)){s=10860,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));V9(10860)}return 10860}function pOe(s){return s=s|0,s|0}function hOe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,Q=CT()|0,B=Q+24|0,l=gr(l,4)|0,n[m>>2]=l,c=Q+28|0,f=n[c>>2]|0,f>>>0<(n[Q+32>>2]|0)>>>0?(W9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(gOe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function W9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function gOe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=dOe(s)|0,f>>>0>>0)zr(s);else{Q=n[s>>2]|0,M=(n[s+8>>2]|0)-Q|0,O=M>>2,mOe(d,M>>3>>>0>>1>>>0?O>>>0>>0?B:O:f,(n[m>>2]|0)-Q>>3,s+8|0),B=d+8|0,W9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,yOe(s,d),EOe(d),C=k;return}}function dOe(s){return s=s|0,536870911}function mOe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Vt(l<<3)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function yOe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function EOe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&>(s)}function V9(s){s=s|0,IOe(s)}function COe(s){s=s|0,wOe(s+24|0)}function wOe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function IOe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,1,11,l,BOe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function BOe(){return 1840}function vOe(s,l,c){s=s|0,l=l|0,c=c|0,POe(n[(DOe(s)|0)>>2]|0,l,c)}function DOe(s){return s=s|0,(n[(CT()|0)+24>>2]|0)+(s<<3)|0}function POe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;f=C,C=C+16|0,m=f+1|0,d=f,Sg(m,l),l=xg(m,l)|0,Sg(d,c),c=xg(d,c)|0,tf[s&31](l,c),C=f}function SOe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=wT()|0,s=xOe(c)|0,hn(m,l,d,s,bOe(c,f)|0,f)}function wT(){var s=0,l=0;if(o[8048]|0||(J9(10896),tr(66,10896,U|0)|0,l=8048,n[l>>2]=1,n[l+4>>2]=0),!(Rr(10896)|0)){s=10896,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));J9(10896)}return 10896}function xOe(s){return s=s|0,s|0}function bOe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,Q=wT()|0,B=Q+24|0,l=gr(l,4)|0,n[m>>2]=l,c=Q+28|0,f=n[c>>2]|0,f>>>0<(n[Q+32>>2]|0)>>>0?(K9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(kOe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function K9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function kOe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=QOe(s)|0,f>>>0>>0)zr(s);else{Q=n[s>>2]|0,M=(n[s+8>>2]|0)-Q|0,O=M>>2,FOe(d,M>>3>>>0>>1>>>0?O>>>0>>0?B:O:f,(n[m>>2]|0)-Q>>3,s+8|0),B=d+8|0,K9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,TOe(s,d),ROe(d),C=k;return}}function QOe(s){return s=s|0,536870911}function FOe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Vt(l<<3)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function TOe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function ROe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&>(s)}function J9(s){s=s|0,MOe(s)}function NOe(s){s=s|0,LOe(s+24|0)}function LOe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function MOe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,1,11,l,OOe()|0,1),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function OOe(){return 1852}function UOe(s,l){return s=s|0,l=l|0,HOe(n[(_Oe(s)|0)>>2]|0,l)|0}function _Oe(s){return s=s|0,(n[(wT()|0)+24>>2]|0)+(s<<3)|0}function HOe(s,l){s=s|0,l=l|0;var c=0,f=0;return c=C,C=C+16|0,f=c,Sg(f,l),l=xg(f,l)|0,l=oD(Ng[s&31](l)|0)|0,C=c,l|0}function jOe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=IT()|0,s=qOe(c)|0,hn(m,l,d,s,GOe(c,f)|0,f)}function IT(){var s=0,l=0;if(o[8056]|0||(X9(10932),tr(67,10932,U|0)|0,l=8056,n[l>>2]=1,n[l+4>>2]=0),!(Rr(10932)|0)){s=10932,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));X9(10932)}return 10932}function qOe(s){return s=s|0,s|0}function GOe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,Q=IT()|0,B=Q+24|0,l=gr(l,4)|0,n[m>>2]=l,c=Q+28|0,f=n[c>>2]|0,f>>>0<(n[Q+32>>2]|0)>>>0?(z9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(YOe(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function z9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function YOe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=WOe(s)|0,f>>>0>>0)zr(s);else{Q=n[s>>2]|0,M=(n[s+8>>2]|0)-Q|0,O=M>>2,VOe(d,M>>3>>>0>>1>>>0?O>>>0>>0?B:O:f,(n[m>>2]|0)-Q>>3,s+8|0),B=d+8|0,z9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,KOe(s,d),JOe(d),C=k;return}}function WOe(s){return s=s|0,536870911}function VOe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Vt(l<<3)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function KOe(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function JOe(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&>(s)}function X9(s){s=s|0,ZOe(s)}function zOe(s){s=s|0,XOe(s+24|0)}function XOe(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function ZOe(s){s=s|0;var l=0;l=Vr()|0,Kr(s,1,7,l,$Oe()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function $Oe(){return 1860}function e4e(s,l,c){return s=s|0,l=l|0,c=c|0,r4e(n[(t4e(s)|0)>>2]|0,l,c)|0}function t4e(s){return s=s|0,(n[(IT()|0)+24>>2]|0)+(s<<3)|0}function r4e(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0;return f=C,C=C+32|0,B=f+12|0,m=f+8|0,k=f,Q=f+16|0,d=f+4|0,n4e(Q,l),i4e(k,Q,l),vp(d,c),c=Dp(d,c)|0,n[B>>2]=n[k>>2],_w[s&15](m,B,c),c=s4e(m)|0,qA(m),Pp(d),C=f,c|0}function n4e(s,l){s=s|0,l=l|0}function i4e(s,l,c){s=s|0,l=l|0,c=c|0,o4e(s,c)}function s4e(s){return s=s|0,da(s)|0}function o4e(s,l){s=s|0,l=l|0;var c=0,f=0,d=0;d=C,C=C+16|0,c=d,f=l,f&1?(a4e(c,0),ii(f|0,c|0)|0,l4e(s,c),c4e(c)):n[s>>2]=n[l>>2],C=d}function a4e(s,l){s=s|0,l=l|0,e5(s,l),n[s+4>>2]=0,o[s+8>>0]=0}function l4e(s,l){s=s|0,l=l|0,n[s>>2]=n[l+4>>2]}function c4e(s){s=s|0,o[s+8>>0]=0}function u4e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=BT()|0,s=A4e(c)|0,hn(m,l,d,s,f4e(c,f)|0,f)}function BT(){var s=0,l=0;if(o[8064]|0||($9(10968),tr(68,10968,U|0)|0,l=8064,n[l>>2]=1,n[l+4>>2]=0),!(Rr(10968)|0)){s=10968,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));$9(10968)}return 10968}function A4e(s){return s=s|0,s|0}function f4e(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,Q=BT()|0,B=Q+24|0,l=gr(l,4)|0,n[m>>2]=l,c=Q+28|0,f=n[c>>2]|0,f>>>0<(n[Q+32>>2]|0)>>>0?(Z9(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(p4e(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function Z9(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function p4e(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=h4e(s)|0,f>>>0>>0)zr(s);else{Q=n[s>>2]|0,M=(n[s+8>>2]|0)-Q|0,O=M>>2,g4e(d,M>>3>>>0>>1>>>0?O>>>0>>0?B:O:f,(n[m>>2]|0)-Q>>3,s+8|0),B=d+8|0,Z9(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,d4e(s,d),m4e(d),C=k;return}}function h4e(s){return s=s|0,536870911}function g4e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Vt(l<<3)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function d4e(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function m4e(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&>(s)}function $9(s){s=s|0,C4e(s)}function y4e(s){s=s|0,E4e(s+24|0)}function E4e(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function C4e(s){s=s|0;var l=0;l=Vr()|0,Kr(s,1,1,l,w4e()|0,5),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function w4e(){return 1872}function I4e(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,v4e(n[(B4e(s)|0)>>2]|0,l,c,f,d,m)}function B4e(s){return s=s|0,(n[(BT()|0)+24>>2]|0)+(s<<3)|0}function v4e(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0;var B=0,k=0,Q=0,O=0,M=0,q=0;B=C,C=C+32|0,k=B+16|0,Q=B+12|0,O=B+8|0,M=B+4|0,q=B,vp(k,l),l=Dp(k,l)|0,vp(Q,c),c=Dp(Q,c)|0,vp(O,f),f=Dp(O,f)|0,vp(M,d),d=Dp(M,d)|0,vp(q,m),m=Dp(q,m)|0,w7[s&1](l,c,f,d,m),Pp(q),Pp(M),Pp(O),Pp(Q),Pp(k),C=B}function D4e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;m=n[s>>2]|0,d=vT()|0,s=P4e(c)|0,hn(m,l,d,s,S4e(c,f)|0,f)}function vT(){var s=0,l=0;if(o[8072]|0||(t7(11004),tr(69,11004,U|0)|0,l=8072,n[l>>2]=1,n[l+4>>2]=0),!(Rr(11004)|0)){s=11004,l=s+36|0;do n[s>>2]=0,s=s+4|0;while((s|0)<(l|0));t7(11004)}return 11004}function P4e(s){return s=s|0,s|0}function S4e(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0,k=0,Q=0;return k=C,C=C+16|0,d=k,m=k+4|0,n[d>>2]=s,Q=vT()|0,B=Q+24|0,l=gr(l,4)|0,n[m>>2]=l,c=Q+28|0,f=n[c>>2]|0,f>>>0<(n[Q+32>>2]|0)>>>0?(e7(f,s,l),l=(n[c>>2]|0)+8|0,n[c>>2]=l):(x4e(B,d,m),l=n[c>>2]|0),C=k,(l-(n[B>>2]|0)>>3)+-1|0}function e7(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,n[s+4>>2]=c}function x4e(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0;if(k=C,C=C+32|0,d=k,m=s+4|0,B=((n[m>>2]|0)-(n[s>>2]|0)>>3)+1|0,f=b4e(s)|0,f>>>0>>0)zr(s);else{Q=n[s>>2]|0,M=(n[s+8>>2]|0)-Q|0,O=M>>2,k4e(d,M>>3>>>0>>1>>>0?O>>>0>>0?B:O:f,(n[m>>2]|0)-Q>>3,s+8|0),B=d+8|0,e7(n[B>>2]|0,n[l>>2]|0,n[c>>2]|0),n[B>>2]=(n[B>>2]|0)+8,Q4e(s,d),F4e(d),C=k;return}}function b4e(s){return s=s|0,536870911}function k4e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0;n[s+12>>2]=0,n[s+16>>2]=f;do if(l)if(l>>>0>536870911)Tt();else{d=Vt(l<<3)|0;break}else d=0;while(0);n[s>>2]=d,f=d+(c<<3)|0,n[s+8>>2]=f,n[s+4>>2]=f,n[s+12>>2]=d+(l<<3)}function Q4e(s,l){s=s|0,l=l|0;var c=0,f=0,d=0,m=0,B=0;f=n[s>>2]|0,B=s+4|0,m=l+4|0,d=(n[B>>2]|0)-f|0,c=(n[m>>2]|0)+(0-(d>>3)<<3)|0,n[m>>2]=c,(d|0)>0?(Dr(c|0,f|0,d|0)|0,f=m,c=n[m>>2]|0):f=m,m=n[s>>2]|0,n[s>>2]=c,n[f>>2]=m,m=l+8|0,d=n[B>>2]|0,n[B>>2]=n[m>>2],n[m>>2]=d,m=s+8|0,B=l+12|0,s=n[m>>2]|0,n[m>>2]=n[B>>2],n[B>>2]=s,n[l>>2]=n[f>>2]}function F4e(s){s=s|0;var l=0,c=0,f=0;l=n[s+4>>2]|0,c=s+8|0,f=n[c>>2]|0,(f|0)!=(l|0)&&(n[c>>2]=f+(~((f+-8-l|0)>>>3)<<3)),s=n[s>>2]|0,s|0&>(s)}function t7(s){s=s|0,N4e(s)}function T4e(s){s=s|0,R4e(s+24|0)}function R4e(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function N4e(s){s=s|0;var l=0;l=Vr()|0,Kr(s,1,12,l,L4e()|0,2),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function L4e(){return 1896}function M4e(s,l,c){s=s|0,l=l|0,c=c|0,U4e(n[(O4e(s)|0)>>2]|0,l,c)}function O4e(s){return s=s|0,(n[(vT()|0)+24>>2]|0)+(s<<3)|0}function U4e(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;f=C,C=C+16|0,m=f+4|0,d=f,_4e(m,l),l=H4e(m,l)|0,vp(d,c),c=Dp(d,c)|0,tf[s&31](l,c),Pp(d),C=f}function _4e(s,l){s=s|0,l=l|0}function H4e(s,l){return s=s|0,l=l|0,j4e(l)|0}function j4e(s){return s=s|0,s|0}function q4e(){var s=0;return o[8080]|0||(r7(11040),tr(70,11040,U|0)|0,s=8080,n[s>>2]=1,n[s+4>>2]=0),Rr(11040)|0||r7(11040),11040}function r7(s){s=s|0,W4e(s),kg(s,71)}function G4e(s){s=s|0,Y4e(s+24|0)}function Y4e(s){s=s|0;var l=0,c=0,f=0;c=n[s>>2]|0,f=c,c|0&&(s=s+4|0,l=n[s>>2]|0,(l|0)!=(c|0)&&(n[s>>2]=l+(~((l+-8-f|0)>>>3)<<3)),gt(c))}function W4e(s){s=s|0;var l=0;l=Vr()|0,Kr(s,5,7,l,z4e()|0,0),n[s+24>>2]=0,n[s+28>>2]=0,n[s+32>>2]=0}function V4e(s){s=s|0,K4e(s)}function K4e(s){s=s|0,J4e(s)}function J4e(s){s=s|0,o[s+8>>0]=1}function z4e(){return 1936}function X4e(){return Z4e()|0}function Z4e(){var s=0,l=0,c=0,f=0,d=0,m=0,B=0;return l=C,C=C+16|0,d=l+4|0,B=l,c=Wa(8)|0,s=c,m=s+4|0,n[m>>2]=Vt(1)|0,f=Vt(8)|0,m=n[m>>2]|0,n[B>>2]=0,n[d>>2]=n[B>>2],$4e(f,m,d),n[c>>2]=f,C=l,s|0}function $4e(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]=l,c=Vt(16)|0,n[c+4>>2]=0,n[c+8>>2]=0,n[c>>2]=1916,n[c+12>>2]=l,n[s+4>>2]=c}function eUe(s){s=s|0,Jm(s),gt(s)}function tUe(s){s=s|0,s=n[s+12>>2]|0,s|0&>(s)}function rUe(s){s=s|0,gt(s)}function nUe(){var s=0;return o[8088]|0||(uUe(11076),tr(25,11076,U|0)|0,s=8088,n[s>>2]=1,n[s+4>>2]=0),11076}function iUe(s,l){s=s|0,l=l|0,n[s>>2]=sUe()|0,n[s+4>>2]=oUe()|0,n[s+12>>2]=l,n[s+8>>2]=aUe()|0,n[s+32>>2]=10}function sUe(){return 11745}function oUe(){return 1940}function aUe(){return aD()|0}function lUe(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,(Sp(f,896)|0)==512?c|0&&(cUe(c),gt(c)):l|0&>(l)}function cUe(s){s=s|0,s=n[s+4>>2]|0,s|0&&bp(s)}function uUe(s){s=s|0,Bp(s)}function xc(s,l){s=s|0,l=l|0,n[s>>2]=l}function DT(s){return s=s|0,n[s>>2]|0}function AUe(s){return s=s|0,o[n[s>>2]>>0]|0}function fUe(s,l){s=s|0,l=l|0;var c=0,f=0;c=C,C=C+16|0,f=c,n[f>>2]=n[s>>2],pUe(l,f)|0,C=c}function pUe(s,l){s=s|0,l=l|0;var c=0;return c=hUe(n[s>>2]|0,l)|0,l=s+4|0,n[(n[l>>2]|0)+8>>2]=c,n[(n[l>>2]|0)+8>>2]|0}function hUe(s,l){s=s|0,l=l|0;var c=0,f=0;return c=C,C=C+16|0,f=c,Va(f),s=da(s)|0,l=gUe(s,n[l>>2]|0)|0,Ka(f),C=c,l|0}function Va(s){s=s|0,n[s>>2]=n[2701],n[s+4>>2]=n[2703]}function gUe(s,l){s=s|0,l=l|0;var c=0;return c=Pl(dUe()|0)|0,Qn(0,c|0,s|0,yT(l)|0)|0}function Ka(s){s=s|0,Y9(n[s>>2]|0,n[s+4>>2]|0)}function dUe(){var s=0;return o[8096]|0||(mUe(11120),s=8096,n[s>>2]=1,n[s+4>>2]=0),11120}function mUe(s){s=s|0,Sl(s,yUe()|0,1)}function yUe(){return 1948}function EUe(){CUe()}function CUe(){var s=0,l=0,c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0,Ge=0,Oe=0,Fe=0;if(Oe=C,C=C+16|0,M=Oe+4|0,q=Oe,Ni(65536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)|0)>>2]|0,Ge=n[(_9(l)|0)>>2]|0,Ge|0)){c=Ge;do{l=c+4|0,f=hT(l)|0;r:do if(f|0)switch(Rr(f)|0){case 0:break t;case 4:case 3:case 2:{k=Lw(f)|0,Q=Rw(f)|0,O=(Nw(f)|0)+1|0,M=fD(f)|0,q=Rr(f)|0,Fe=cD(l)|0,El(se|0,k|0,Q|0,O|0,M|0,0,q|0,Fe|0,PT(l)|0,ST(l)|0);break r}case 1:{B=Lw(f)|0,k=Rw(f)|0,Q=(Nw(f)|0)+1|0,O=fD(f)|0,M=i7(l)|0,q=Rr(f)|0,Fe=cD(l)|0,El(se|0,B|0,k|0,Q|0,O|0,M|0,q|0,Fe|0,PT(l)|0,ST(l)|0);break r}case 5:{O=Lw(f)|0,M=Rw(f)|0,q=(Nw(f)|0)+1|0,Fe=fD(f)|0,El(se|0,O|0,M|0,q|0,Fe|0,xUe(f)|0,Rr(f)|0,0,0,0);break r}default:break r}while(0);c=n[c>>2]|0}while((c|0)!=0)}if(s=n[s>>2]|0,!s)break e}Tt()}while(0);Ce(),C=Oe}function wUe(){return 11703}function IUe(s){s=s|0,o[s+40>>0]=0}function BUe(s){return s=s|0,(o[s+40>>0]|0)!=0|0}function vUe(s,l){return s=s|0,l=l|0,l=bUe(l)|0,s=n[l>>2]|0,n[l>>2]=n[s>>2],gt(s),n[l>>2]|0}function DUe(s){s=s|0,o[s+40>>0]=1}function n7(s){return s=s|0,n[s+20>>2]|0}function PUe(s){return s=s|0,n[s+8>>2]|0}function SUe(s){return s=s|0,n[s+32>>2]|0}function fD(s){return s=s|0,n[s+4>>2]|0}function i7(s){return s=s|0,n[s+4>>2]|0}function PT(s){return s=s|0,n[s+8>>2]|0}function ST(s){return s=s|0,n[s+16>>2]|0}function xUe(s){return s=s|0,n[s+20>>2]|0}function bUe(s){return s=s|0,n[s>>2]|0}function pD(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0,Ge=0,Oe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s=Q?f:s,f=n[f+16+(((n[f+16>>2]|0)==0&1)<<2)>>2]|0;while((f|0)!=0);Q=s,m=c}if(B=Q+O|0,Q>>>0>>0){d=n[Q+24>>2]|0,l=n[Q+12>>2]|0;do if((l|0)==(Q|0)){if(s=Q+20|0,l=n[s>>2]|0,!l&&(s=Q+16|0,l=n[s>>2]|0,!l)){c=0;break}for(;;){if(c=l+20|0,f=n[c>>2]|0,f|0){l=f,s=c;continue}if(c=l+16|0,f=n[c>>2]|0,f)l=f,s=c;else break}n[s>>2]=0,c=l}else c=n[Q+8>>2]|0,n[c+12>>2]=l,n[l+8>>2]=c,c=l;while(0);do if(d|0){if(l=n[Q+28>>2]|0,s=11436+(l<<2)|0,(Q|0)==(n[s>>2]|0)){if(n[s>>2]=c,!c){n[2784]=k&~(1<>2]|0)!=(Q|0)&1)<<2)>>2]=c,!c)break;n[c+24>>2]=d,l=n[Q+16>>2]|0,l|0&&(n[c+16>>2]=l,n[l+24>>2]=c),l=n[Q+20>>2]|0,l|0&&(n[c+20>>2]=l,n[l+24>>2]=c)}while(0);return m>>>0<16?(qe=m+O|0,n[Q+4>>2]=qe|3,qe=Q+qe+4|0,n[qe>>2]=n[qe>>2]|1):(n[Q+4>>2]=O|3,n[B+4>>2]=m|1,n[B+m>>2]=m,M|0&&(f=n[2788]|0,l=M>>>3,c=11172+(l<<1<<2)|0,l=1<>2]|0):(n[2783]=q|l,l=c,s=c+8|0),n[s>>2]=f,n[l+12>>2]=f,n[f+8>>2]=l,n[f+12>>2]=c),n[2785]=m,n[2788]=B),qe=Q+8|0,C=Lt,qe|0}else q=O}else q=O}else q=O}else if(s>>>0<=4294967231)if(s=s+11|0,O=s&-8,Q=n[2784]|0,Q){f=0-O|0,s=s>>>8,s?O>>>0>16777215?k=31:(q=(s+1048320|0)>>>16&8,Ue=s<>>16&4,Ue=Ue<>>16&2,k=14-(M|q|k)+(Ue<>>15)|0,k=O>>>(k+7|0)&1|k<<1):k=0,c=n[11436+(k<<2)>>2]|0;e:do if(!c)c=0,s=0,Ue=57;else for(s=0,B=O<<((k|0)==31?0:25-(k>>>1)|0),m=0;;){if(d=(n[c+4>>2]&-8)-O|0,d>>>0>>0)if(d)s=c,f=d;else{s=c,f=0,d=c,Ue=61;break e}if(d=n[c+20>>2]|0,c=n[c+16+(B>>>31<<2)>>2]|0,m=(d|0)==0|(d|0)==(c|0)?m:d,d=(c|0)==0,d){c=m,Ue=57;break}else B=B<<((d^1)&1)}while(0);if((Ue|0)==57){if((c|0)==0&(s|0)==0){if(s=2<>>12&16,q=q>>>B,m=q>>>5&8,q=q>>>m,k=q>>>2&4,q=q>>>k,M=q>>>1&2,q=q>>>M,c=q>>>1&1,s=0,c=n[11436+((m|B|k|M|c)+(q>>>c)<<2)>>2]|0}c?(d=c,Ue=61):(k=s,B=f)}if((Ue|0)==61)for(;;)if(Ue=0,c=(n[d+4>>2]&-8)-O|0,q=c>>>0>>0,c=q?c:f,s=q?d:s,d=n[d+16+(((n[d+16>>2]|0)==0&1)<<2)>>2]|0,d)f=c,Ue=61;else{k=s,B=c;break}if((k|0)!=0&&B>>>0<((n[2785]|0)-O|0)>>>0){if(m=k+O|0,k>>>0>=m>>>0)return qe=0,C=Lt,qe|0;d=n[k+24>>2]|0,l=n[k+12>>2]|0;do if((l|0)==(k|0)){if(s=k+20|0,l=n[s>>2]|0,!l&&(s=k+16|0,l=n[s>>2]|0,!l)){l=0;break}for(;;){if(c=l+20|0,f=n[c>>2]|0,f|0){l=f,s=c;continue}if(c=l+16|0,f=n[c>>2]|0,f)l=f,s=c;else break}n[s>>2]=0}else qe=n[k+8>>2]|0,n[qe+12>>2]=l,n[l+8>>2]=qe;while(0);do if(d){if(s=n[k+28>>2]|0,c=11436+(s<<2)|0,(k|0)==(n[c>>2]|0)){if(n[c>>2]=l,!l){f=Q&~(1<>2]|0)!=(k|0)&1)<<2)>>2]=l,!l){f=Q;break}n[l+24>>2]=d,s=n[k+16>>2]|0,s|0&&(n[l+16>>2]=s,n[s+24>>2]=l),s=n[k+20>>2]|0,s&&(n[l+20>>2]=s,n[s+24>>2]=l),f=Q}else f=Q;while(0);do if(B>>>0>=16){if(n[k+4>>2]=O|3,n[m+4>>2]=B|1,n[m+B>>2]=B,l=B>>>3,B>>>0<256){c=11172+(l<<1<<2)|0,s=n[2783]|0,l=1<>2]|0):(n[2783]=s|l,l=c,s=c+8|0),n[s>>2]=m,n[l+12>>2]=m,n[m+8>>2]=l,n[m+12>>2]=c;break}if(l=B>>>8,l?B>>>0>16777215?l=31:(Ue=(l+1048320|0)>>>16&8,qe=l<>>16&4,qe=qe<>>16&2,l=14-(at|Ue|l)+(qe<>>15)|0,l=B>>>(l+7|0)&1|l<<1):l=0,c=11436+(l<<2)|0,n[m+28>>2]=l,s=m+16|0,n[s+4>>2]=0,n[s>>2]=0,s=1<>2]=m,n[m+24>>2]=c,n[m+12>>2]=m,n[m+8>>2]=m;break}for(s=B<<((l|0)==31?0:25-(l>>>1)|0),c=n[c>>2]|0;;){if((n[c+4>>2]&-8|0)==(B|0)){Ue=97;break}if(f=c+16+(s>>>31<<2)|0,l=n[f>>2]|0,l)s=s<<1,c=l;else{Ue=96;break}}if((Ue|0)==96){n[f>>2]=m,n[m+24>>2]=c,n[m+12>>2]=m,n[m+8>>2]=m;break}else if((Ue|0)==97){Ue=c+8|0,qe=n[Ue>>2]|0,n[qe+12>>2]=m,n[Ue>>2]=m,n[m+8>>2]=qe,n[m+12>>2]=c,n[m+24>>2]=0;break}}else qe=B+O|0,n[k+4>>2]=qe|3,qe=k+qe+4|0,n[qe>>2]=n[qe>>2]|1;while(0);return qe=k+8|0,C=Lt,qe|0}else q=O}else q=O;else q=-1;while(0);if(c=n[2785]|0,c>>>0>=q>>>0)return l=c-q|0,s=n[2788]|0,l>>>0>15?(qe=s+q|0,n[2788]=qe,n[2785]=l,n[qe+4>>2]=l|1,n[qe+l>>2]=l,n[s+4>>2]=q|3):(n[2785]=0,n[2788]=0,n[s+4>>2]=c|3,qe=s+c+4|0,n[qe>>2]=n[qe>>2]|1),qe=s+8|0,C=Lt,qe|0;if(B=n[2786]|0,B>>>0>q>>>0)return at=B-q|0,n[2786]=at,qe=n[2789]|0,Ue=qe+q|0,n[2789]=Ue,n[Ue+4>>2]=at|1,n[qe+4>>2]=q|3,qe=qe+8|0,C=Lt,qe|0;if(n[2901]|0?s=n[2903]|0:(n[2903]=4096,n[2902]=4096,n[2904]=-1,n[2905]=-1,n[2906]=0,n[2894]=0,s=se&-16^1431655768,n[se>>2]=s,n[2901]=s,s=4096),k=q+48|0,Q=q+47|0,m=s+Q|0,d=0-s|0,O=m&d,O>>>0<=q>>>0||(s=n[2893]|0,s|0&&(M=n[2891]|0,se=M+O|0,se>>>0<=M>>>0|se>>>0>s>>>0)))return qe=0,C=Lt,qe|0;e:do if(n[2894]&4)l=0,Ue=133;else{c=n[2789]|0;t:do if(c){for(f=11580;s=n[f>>2]|0,!(s>>>0<=c>>>0&&(Fe=f+4|0,(s+(n[Fe>>2]|0)|0)>>>0>c>>>0));)if(s=n[f+8>>2]|0,s)f=s;else{Ue=118;break t}if(l=m-B&d,l>>>0<2147483647)if(s=kp(l|0)|0,(s|0)==((n[f>>2]|0)+(n[Fe>>2]|0)|0)){if((s|0)!=-1){B=l,m=s,Ue=135;break e}}else f=s,Ue=126;else l=0}else Ue=118;while(0);do if((Ue|0)==118)if(c=kp(0)|0,(c|0)!=-1&&(l=c,Ge=n[2902]|0,Oe=Ge+-1|0,l=((Oe&l|0)==0?0:(Oe+l&0-Ge)-l|0)+O|0,Ge=n[2891]|0,Oe=l+Ge|0,l>>>0>q>>>0&l>>>0<2147483647)){if(Fe=n[2893]|0,Fe|0&&Oe>>>0<=Ge>>>0|Oe>>>0>Fe>>>0){l=0;break}if(s=kp(l|0)|0,(s|0)==(c|0)){B=l,m=c,Ue=135;break e}else f=s,Ue=126}else l=0;while(0);do if((Ue|0)==126){if(c=0-l|0,!(k>>>0>l>>>0&(l>>>0<2147483647&(f|0)!=-1)))if((f|0)==-1){l=0;break}else{B=l,m=f,Ue=135;break e}if(s=n[2903]|0,s=Q-l+s&0-s,s>>>0>=2147483647){B=l,m=f,Ue=135;break e}if((kp(s|0)|0)==-1){kp(c|0)|0,l=0;break}else{B=s+l|0,m=f,Ue=135;break e}}while(0);n[2894]=n[2894]|4,Ue=133}while(0);if((Ue|0)==133&&O>>>0<2147483647&&(at=kp(O|0)|0,Fe=kp(0)|0,et=Fe-at|0,Xe=et>>>0>(q+40|0)>>>0,!((at|0)==-1|Xe^1|at>>>0>>0&((at|0)!=-1&(Fe|0)!=-1)^1))&&(B=Xe?et:l,m=at,Ue=135),(Ue|0)==135){l=(n[2891]|0)+B|0,n[2891]=l,l>>>0>(n[2892]|0)>>>0&&(n[2892]=l),Q=n[2789]|0;do if(Q){for(l=11580;;){if(s=n[l>>2]|0,c=l+4|0,f=n[c>>2]|0,(m|0)==(s+f|0)){Ue=145;break}if(d=n[l+8>>2]|0,d)l=d;else break}if((Ue|0)==145&&(n[l+12>>2]&8|0)==0&&Q>>>0>>0&Q>>>0>=s>>>0){n[c>>2]=f+B,qe=Q+8|0,qe=(qe&7|0)==0?0:0-qe&7,Ue=Q+qe|0,qe=(n[2786]|0)+(B-qe)|0,n[2789]=Ue,n[2786]=qe,n[Ue+4>>2]=qe|1,n[Ue+qe+4>>2]=40,n[2790]=n[2905];break}for(m>>>0<(n[2787]|0)>>>0&&(n[2787]=m),c=m+B|0,l=11580;;){if((n[l>>2]|0)==(c|0)){Ue=153;break}if(s=n[l+8>>2]|0,s)l=s;else break}if((Ue|0)==153&&(n[l+12>>2]&8|0)==0){n[l>>2]=m,M=l+4|0,n[M>>2]=(n[M>>2]|0)+B,M=m+8|0,M=m+((M&7|0)==0?0:0-M&7)|0,l=c+8|0,l=c+((l&7|0)==0?0:0-l&7)|0,O=M+q|0,k=l-M-q|0,n[M+4>>2]=q|3;do if((l|0)!=(Q|0)){if((l|0)==(n[2788]|0)){qe=(n[2785]|0)+k|0,n[2785]=qe,n[2788]=O,n[O+4>>2]=qe|1,n[O+qe>>2]=qe;break}if(s=n[l+4>>2]|0,(s&3|0)==1){B=s&-8,f=s>>>3;e:do if(s>>>0<256)if(s=n[l+8>>2]|0,c=n[l+12>>2]|0,(c|0)==(s|0)){n[2783]=n[2783]&~(1<>2]=c,n[c+8>>2]=s;break}else{m=n[l+24>>2]|0,s=n[l+12>>2]|0;do if((s|0)==(l|0)){if(f=l+16|0,c=f+4|0,s=n[c>>2]|0,!s)if(s=n[f>>2]|0,s)c=f;else{s=0;break}for(;;){if(f=s+20|0,d=n[f>>2]|0,d|0){s=d,c=f;continue}if(f=s+16|0,d=n[f>>2]|0,d)s=d,c=f;else break}n[c>>2]=0}else qe=n[l+8>>2]|0,n[qe+12>>2]=s,n[s+8>>2]=qe;while(0);if(!m)break;c=n[l+28>>2]|0,f=11436+(c<<2)|0;do if((l|0)!=(n[f>>2]|0)){if(n[m+16+(((n[m+16>>2]|0)!=(l|0)&1)<<2)>>2]=s,!s)break e}else{if(n[f>>2]=s,s|0)break;n[2784]=n[2784]&~(1<>2]=m,c=l+16|0,f=n[c>>2]|0,f|0&&(n[s+16>>2]=f,n[f+24>>2]=s),c=n[c+4>>2]|0,!c)break;n[s+20>>2]=c,n[c+24>>2]=s}while(0);l=l+B|0,d=B+k|0}else d=k;if(l=l+4|0,n[l>>2]=n[l>>2]&-2,n[O+4>>2]=d|1,n[O+d>>2]=d,l=d>>>3,d>>>0<256){c=11172+(l<<1<<2)|0,s=n[2783]|0,l=1<>2]|0):(n[2783]=s|l,l=c,s=c+8|0),n[s>>2]=O,n[l+12>>2]=O,n[O+8>>2]=l,n[O+12>>2]=c;break}l=d>>>8;do if(!l)l=0;else{if(d>>>0>16777215){l=31;break}Ue=(l+1048320|0)>>>16&8,qe=l<>>16&4,qe=qe<>>16&2,l=14-(at|Ue|l)+(qe<>>15)|0,l=d>>>(l+7|0)&1|l<<1}while(0);if(f=11436+(l<<2)|0,n[O+28>>2]=l,s=O+16|0,n[s+4>>2]=0,n[s>>2]=0,s=n[2784]|0,c=1<>2]=O,n[O+24>>2]=f,n[O+12>>2]=O,n[O+8>>2]=O;break}for(s=d<<((l|0)==31?0:25-(l>>>1)|0),c=n[f>>2]|0;;){if((n[c+4>>2]&-8|0)==(d|0)){Ue=194;break}if(f=c+16+(s>>>31<<2)|0,l=n[f>>2]|0,l)s=s<<1,c=l;else{Ue=193;break}}if((Ue|0)==193){n[f>>2]=O,n[O+24>>2]=c,n[O+12>>2]=O,n[O+8>>2]=O;break}else if((Ue|0)==194){Ue=c+8|0,qe=n[Ue>>2]|0,n[qe+12>>2]=O,n[Ue>>2]=O,n[O+8>>2]=qe,n[O+12>>2]=c,n[O+24>>2]=0;break}}else qe=(n[2786]|0)+k|0,n[2786]=qe,n[2789]=O,n[O+4>>2]=qe|1;while(0);return qe=M+8|0,C=Lt,qe|0}for(l=11580;s=n[l>>2]|0,!(s>>>0<=Q>>>0&&(qe=s+(n[l+4>>2]|0)|0,qe>>>0>Q>>>0));)l=n[l+8>>2]|0;d=qe+-47|0,s=d+8|0,s=d+((s&7|0)==0?0:0-s&7)|0,d=Q+16|0,s=s>>>0>>0?Q:s,l=s+8|0,c=m+8|0,c=(c&7|0)==0?0:0-c&7,Ue=m+c|0,c=B+-40-c|0,n[2789]=Ue,n[2786]=c,n[Ue+4>>2]=c|1,n[Ue+c+4>>2]=40,n[2790]=n[2905],c=s+4|0,n[c>>2]=27,n[l>>2]=n[2895],n[l+4>>2]=n[2896],n[l+8>>2]=n[2897],n[l+12>>2]=n[2898],n[2895]=m,n[2896]=B,n[2898]=0,n[2897]=l,l=s+24|0;do Ue=l,l=l+4|0,n[l>>2]=7;while((Ue+8|0)>>>0>>0);if((s|0)!=(Q|0)){if(m=s-Q|0,n[c>>2]=n[c>>2]&-2,n[Q+4>>2]=m|1,n[s>>2]=m,l=m>>>3,m>>>0<256){c=11172+(l<<1<<2)|0,s=n[2783]|0,l=1<>2]|0):(n[2783]=s|l,l=c,s=c+8|0),n[s>>2]=Q,n[l+12>>2]=Q,n[Q+8>>2]=l,n[Q+12>>2]=c;break}if(l=m>>>8,l?m>>>0>16777215?c=31:(Ue=(l+1048320|0)>>>16&8,qe=l<>>16&4,qe=qe<>>16&2,c=14-(at|Ue|c)+(qe<>>15)|0,c=m>>>(c+7|0)&1|c<<1):c=0,f=11436+(c<<2)|0,n[Q+28>>2]=c,n[Q+20>>2]=0,n[d>>2]=0,l=n[2784]|0,s=1<>2]=Q,n[Q+24>>2]=f,n[Q+12>>2]=Q,n[Q+8>>2]=Q;break}for(s=m<<((c|0)==31?0:25-(c>>>1)|0),c=n[f>>2]|0;;){if((n[c+4>>2]&-8|0)==(m|0)){Ue=216;break}if(f=c+16+(s>>>31<<2)|0,l=n[f>>2]|0,l)s=s<<1,c=l;else{Ue=215;break}}if((Ue|0)==215){n[f>>2]=Q,n[Q+24>>2]=c,n[Q+12>>2]=Q,n[Q+8>>2]=Q;break}else if((Ue|0)==216){Ue=c+8|0,qe=n[Ue>>2]|0,n[qe+12>>2]=Q,n[Ue>>2]=Q,n[Q+8>>2]=qe,n[Q+12>>2]=c,n[Q+24>>2]=0;break}}}else{qe=n[2787]|0,(qe|0)==0|m>>>0>>0&&(n[2787]=m),n[2895]=m,n[2896]=B,n[2898]=0,n[2792]=n[2901],n[2791]=-1,l=0;do qe=11172+(l<<1<<2)|0,n[qe+12>>2]=qe,n[qe+8>>2]=qe,l=l+1|0;while((l|0)!=32);qe=m+8|0,qe=(qe&7|0)==0?0:0-qe&7,Ue=m+qe|0,qe=B+-40-qe|0,n[2789]=Ue,n[2786]=qe,n[Ue+4>>2]=qe|1,n[Ue+qe+4>>2]=40,n[2790]=n[2905]}while(0);if(l=n[2786]|0,l>>>0>q>>>0)return at=l-q|0,n[2786]=at,qe=n[2789]|0,Ue=qe+q|0,n[2789]=Ue,n[Ue+4>>2]=at|1,n[qe+4>>2]=q|3,qe=qe+8|0,C=Lt,qe|0}return n[(Vm()|0)>>2]=12,qe=0,C=Lt,qe|0}function hD(s){s=s|0;var l=0,c=0,f=0,d=0,m=0,B=0,k=0,Q=0;if(!!s){c=s+-8|0,d=n[2787]|0,s=n[s+-4>>2]|0,l=s&-8,Q=c+l|0;do if(s&1)k=c,B=c;else{if(f=n[c>>2]|0,!(s&3)||(B=c+(0-f)|0,m=f+l|0,B>>>0>>0))return;if((B|0)==(n[2788]|0)){if(s=Q+4|0,l=n[s>>2]|0,(l&3|0)!=3){k=B,l=m;break}n[2785]=m,n[s>>2]=l&-2,n[B+4>>2]=m|1,n[B+m>>2]=m;return}if(c=f>>>3,f>>>0<256)if(s=n[B+8>>2]|0,l=n[B+12>>2]|0,(l|0)==(s|0)){n[2783]=n[2783]&~(1<>2]=l,n[l+8>>2]=s,k=B,l=m;break}d=n[B+24>>2]|0,s=n[B+12>>2]|0;do if((s|0)==(B|0)){if(c=B+16|0,l=c+4|0,s=n[l>>2]|0,!s)if(s=n[c>>2]|0,s)l=c;else{s=0;break}for(;;){if(c=s+20|0,f=n[c>>2]|0,f|0){s=f,l=c;continue}if(c=s+16|0,f=n[c>>2]|0,f)s=f,l=c;else break}n[l>>2]=0}else k=n[B+8>>2]|0,n[k+12>>2]=s,n[s+8>>2]=k;while(0);if(d){if(l=n[B+28>>2]|0,c=11436+(l<<2)|0,(B|0)==(n[c>>2]|0)){if(n[c>>2]=s,!s){n[2784]=n[2784]&~(1<>2]|0)!=(B|0)&1)<<2)>>2]=s,!s){k=B,l=m;break}n[s+24>>2]=d,l=B+16|0,c=n[l>>2]|0,c|0&&(n[s+16>>2]=c,n[c+24>>2]=s),l=n[l+4>>2]|0,l?(n[s+20>>2]=l,n[l+24>>2]=s,k=B,l=m):(k=B,l=m)}else k=B,l=m}while(0);if(!(B>>>0>=Q>>>0)&&(s=Q+4|0,f=n[s>>2]|0,!!(f&1))){if(f&2)n[s>>2]=f&-2,n[k+4>>2]=l|1,n[B+l>>2]=l,d=l;else{if(s=n[2788]|0,(Q|0)==(n[2789]|0)){if(Q=(n[2786]|0)+l|0,n[2786]=Q,n[2789]=k,n[k+4>>2]=Q|1,(k|0)!=(s|0))return;n[2788]=0,n[2785]=0;return}if((Q|0)==(s|0)){Q=(n[2785]|0)+l|0,n[2785]=Q,n[2788]=B,n[k+4>>2]=Q|1,n[B+Q>>2]=Q;return}d=(f&-8)+l|0,c=f>>>3;do if(f>>>0<256)if(l=n[Q+8>>2]|0,s=n[Q+12>>2]|0,(s|0)==(l|0)){n[2783]=n[2783]&~(1<>2]=s,n[s+8>>2]=l;break}else{m=n[Q+24>>2]|0,s=n[Q+12>>2]|0;do if((s|0)==(Q|0)){if(c=Q+16|0,l=c+4|0,s=n[l>>2]|0,!s)if(s=n[c>>2]|0,s)l=c;else{c=0;break}for(;;){if(c=s+20|0,f=n[c>>2]|0,f|0){s=f,l=c;continue}if(c=s+16|0,f=n[c>>2]|0,f)s=f,l=c;else break}n[l>>2]=0,c=s}else c=n[Q+8>>2]|0,n[c+12>>2]=s,n[s+8>>2]=c,c=s;while(0);if(m|0){if(s=n[Q+28>>2]|0,l=11436+(s<<2)|0,(Q|0)==(n[l>>2]|0)){if(n[l>>2]=c,!c){n[2784]=n[2784]&~(1<>2]|0)!=(Q|0)&1)<<2)>>2]=c,!c)break;n[c+24>>2]=m,s=Q+16|0,l=n[s>>2]|0,l|0&&(n[c+16>>2]=l,n[l+24>>2]=c),s=n[s+4>>2]|0,s|0&&(n[c+20>>2]=s,n[s+24>>2]=c)}}while(0);if(n[k+4>>2]=d|1,n[B+d>>2]=d,(k|0)==(n[2788]|0)){n[2785]=d;return}}if(s=d>>>3,d>>>0<256){c=11172+(s<<1<<2)|0,l=n[2783]|0,s=1<>2]|0):(n[2783]=l|s,s=c,l=c+8|0),n[l>>2]=k,n[s+12>>2]=k,n[k+8>>2]=s,n[k+12>>2]=c;return}s=d>>>8,s?d>>>0>16777215?s=31:(B=(s+1048320|0)>>>16&8,Q=s<>>16&4,Q=Q<>>16&2,s=14-(m|B|s)+(Q<>>15)|0,s=d>>>(s+7|0)&1|s<<1):s=0,f=11436+(s<<2)|0,n[k+28>>2]=s,n[k+20>>2]=0,n[k+16>>2]=0,l=n[2784]|0,c=1<>>1)|0),c=n[f>>2]|0;;){if((n[c+4>>2]&-8|0)==(d|0)){s=73;break}if(f=c+16+(l>>>31<<2)|0,s=n[f>>2]|0,s)l=l<<1,c=s;else{s=72;break}}if((s|0)==72){n[f>>2]=k,n[k+24>>2]=c,n[k+12>>2]=k,n[k+8>>2]=k;break}else if((s|0)==73){B=c+8|0,Q=n[B>>2]|0,n[Q+12>>2]=k,n[B>>2]=k,n[k+8>>2]=Q,n[k+12>>2]=c,n[k+24>>2]=0;break}}else n[2784]=l|c,n[f>>2]=k,n[k+24>>2]=f,n[k+12>>2]=k,n[k+8>>2]=k;while(0);if(Q=(n[2791]|0)+-1|0,n[2791]=Q,!Q)s=11588;else return;for(;s=n[s>>2]|0,s;)s=s+8|0;n[2791]=-1}}}function kUe(){return 11628}function QUe(s){s=s|0;var l=0,c=0;return l=C,C=C+16|0,c=l,n[c>>2]=RUe(n[s+60>>2]|0)|0,s=gD(hc(6,c|0)|0)|0,C=l,s|0}function s7(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0,Ge=0;q=C,C=C+48|0,O=q+16|0,m=q,d=q+32|0,k=s+28|0,f=n[k>>2]|0,n[d>>2]=f,Q=s+20|0,f=(n[Q>>2]|0)-f|0,n[d+4>>2]=f,n[d+8>>2]=l,n[d+12>>2]=c,f=f+c|0,B=s+60|0,n[m>>2]=n[B>>2],n[m+4>>2]=d,n[m+8>>2]=2,m=gD(Li(146,m|0)|0)|0;e:do if((f|0)!=(m|0)){for(l=2;!((m|0)<0);)if(f=f-m|0,Ge=n[d+4>>2]|0,se=m>>>0>Ge>>>0,d=se?d+8|0:d,l=(se<<31>>31)+l|0,Ge=m-(se?Ge:0)|0,n[d>>2]=(n[d>>2]|0)+Ge,se=d+4|0,n[se>>2]=(n[se>>2]|0)-Ge,n[O>>2]=n[B>>2],n[O+4>>2]=d,n[O+8>>2]=l,m=gD(Li(146,O|0)|0)|0,(f|0)==(m|0)){M=3;break e}n[s+16>>2]=0,n[k>>2]=0,n[Q>>2]=0,n[s>>2]=n[s>>2]|32,(l|0)==2?c=0:c=c-(n[d+4>>2]|0)|0}else M=3;while(0);return(M|0)==3&&(Ge=n[s+44>>2]|0,n[s+16>>2]=Ge+(n[s+48>>2]|0),n[k>>2]=Ge,n[Q>>2]=Ge),C=q,c|0}function FUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;return d=C,C=C+32|0,m=d,f=d+20|0,n[m>>2]=n[s+60>>2],n[m+4>>2]=0,n[m+8>>2]=l,n[m+12>>2]=f,n[m+16>>2]=c,(gD(sa(140,m|0)|0)|0)<0?(n[f>>2]=-1,s=-1):s=n[f>>2]|0,C=d,s|0}function gD(s){return s=s|0,s>>>0>4294963200&&(n[(Vm()|0)>>2]=0-s,s=-1),s|0}function Vm(){return(TUe()|0)+64|0}function TUe(){return xT()|0}function xT(){return 2084}function RUe(s){return s=s|0,s|0}function NUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;return d=C,C=C+32|0,f=d,n[s+36>>2]=1,(n[s>>2]&64|0)==0&&(n[f>>2]=n[s+60>>2],n[f+4>>2]=21523,n[f+8>>2]=d+16,fu(54,f|0)|0)&&(o[s+75>>0]=-1),f=s7(s,l,c)|0,C=d,f|0}function o7(s,l){s=s|0,l=l|0;var c=0,f=0;if(c=o[s>>0]|0,f=o[l>>0]|0,c<<24>>24==0||c<<24>>24!=f<<24>>24)s=f;else{do s=s+1|0,l=l+1|0,c=o[s>>0]|0,f=o[l>>0]|0;while(!(c<<24>>24==0||c<<24>>24!=f<<24>>24));s=f}return(c&255)-(s&255)|0}function LUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0;e:do if(!c)s=0;else{for(;f=o[s>>0]|0,d=o[l>>0]|0,f<<24>>24==d<<24>>24;)if(c=c+-1|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[(Vm()|0)>>2]=75,m=-1;break}else{m=B+m|0;break}while(0);if(B=o[l>>0]|0,B<<24>>24)k=l;else{Xe=87;break}t:for(;;){switch(B<<24>>24){case 37:{B=k,Xe=9;break t}case 0:{B=k;break t}default:}et=k+1|0,n[or>>2]=et,B=o[et>>0]|0,k=et}t:do if((Xe|0)==9)for(;;){if(Xe=0,(o[k+1>>0]|0)!=37)break t;if(B=B+1|0,k=k+2|0,n[or>>2]=k,(o[k>>0]|0)==37)Xe=9;else break}while(0);if(B=B-l|0,at&&ss(s,l,B),B|0){l=k;continue}Q=k+1|0,B=(o[Q>>0]|0)+-48|0,B>>>0<10?(et=(o[k+2>>0]|0)==36,Fe=et?B:-1,M=et?1:M,Q=et?k+3|0:Q):Fe=-1,n[or>>2]=Q,B=o[Q>>0]|0,k=(B<<24>>24)+-32|0;t:do if(k>>>0<32)for(O=0,q=B;;){if(B=1<>2]=Q,B=o[Q>>0]|0,k=(B<<24>>24)+-32|0,k>>>0>=32)break;q=B}else O=0;while(0);if(B<<24>>24==42){if(k=Q+1|0,B=(o[k>>0]|0)+-48|0,B>>>0<10&&(o[Q+2>>0]|0)==36)n[d+(B<<2)>>2]=10,B=n[f+((o[k>>0]|0)+-48<<3)>>2]|0,M=1,Q=Q+3|0;else{if(M|0){m=-1;break}at?(M=(n[c>>2]|0)+(4-1)&~(4-1),B=n[M>>2]|0,n[c>>2]=M+4,M=0,Q=k):(B=0,M=0,Q=k)}n[or>>2]=Q,et=(B|0)<0,B=et?0-B|0:B,O=et?O|8192:O}else{if(B=l7(or)|0,(B|0)<0){m=-1;break}Q=n[or>>2]|0}do if((o[Q>>0]|0)==46){if((o[Q+1>>0]|0)!=42){n[or>>2]=Q+1,k=l7(or)|0,Q=n[or>>2]|0;break}if(q=Q+2|0,k=(o[q>>0]|0)+-48|0,k>>>0<10&&(o[Q+3>>0]|0)==36){n[d+(k<<2)>>2]=10,k=n[f+((o[q>>0]|0)+-48<<3)>>2]|0,Q=Q+4|0,n[or>>2]=Q;break}if(M|0){m=-1;break e}at?(et=(n[c>>2]|0)+(4-1)&~(4-1),k=n[et>>2]|0,n[c>>2]=et+4):k=0,n[or>>2]=q,Q=q}else k=-1;while(0);for(Oe=0;;){if(((o[Q>>0]|0)+-65|0)>>>0>57){m=-1;break e}if(et=Q+1|0,n[or>>2]=et,q=o[(o[Q>>0]|0)+-65+(5178+(Oe*58|0))>>0]|0,se=q&255,(se+-1|0)>>>0<8)Oe=se,Q=et;else break}if(!(q<<24>>24)){m=-1;break}Ge=(Fe|0)>-1;do if(q<<24>>24==19)if(Ge){m=-1;break e}else Xe=49;else{if(Ge){n[d+(Fe<<2)>>2]=se,Ge=f+(Fe<<3)|0,Fe=n[Ge+4>>2]|0,Xe=Xt,n[Xe>>2]=n[Ge>>2],n[Xe+4>>2]=Fe,Xe=49;break}if(!at){m=0;break e}c7(Xt,se,c)}while(0);if((Xe|0)==49&&(Xe=0,!at)){B=0,l=et;continue}Q=o[Q>>0]|0,Q=(Oe|0)!=0&(Q&15|0)==3?Q&-33:Q,Ge=O&-65537,Fe=(O&8192|0)==0?O:Ge;t:do switch(Q|0){case 110:switch((Oe&255)<<24>>24){case 0:{n[n[Xt>>2]>>2]=m,B=0,l=et;continue e}case 1:{n[n[Xt>>2]>>2]=m,B=0,l=et;continue e}case 2:{B=n[Xt>>2]|0,n[B>>2]=m,n[B+4>>2]=((m|0)<0)<<31>>31,B=0,l=et;continue e}case 3:{a[n[Xt>>2]>>1]=m,B=0,l=et;continue e}case 4:{o[n[Xt>>2]>>0]=m,B=0,l=et;continue e}case 6:{n[n[Xt>>2]>>2]=m,B=0,l=et;continue e}case 7:{B=n[Xt>>2]|0,n[B>>2]=m,n[B+4>>2]=((m|0)<0)<<31>>31,B=0,l=et;continue e}default:{B=0,l=et;continue e}}case 112:{Q=120,k=k>>>0>8?k:8,l=Fe|8,Xe=61;break}case 88:case 120:{l=Fe,Xe=61;break}case 111:{Q=Xt,l=n[Q>>2]|0,Q=n[Q+4>>2]|0,se=_Ue(l,Q,Ue)|0,Ge=qe-se|0,O=0,q=5642,k=(Fe&8|0)==0|(k|0)>(Ge|0)?k:Ge+1|0,Ge=Fe,Xe=67;break}case 105:case 100:if(Q=Xt,l=n[Q>>2]|0,Q=n[Q+4>>2]|0,(Q|0)<0){l=dD(0,0,l|0,Q|0)|0,Q=De,O=Xt,n[O>>2]=l,n[O+4>>2]=Q,O=1,q=5642,Xe=66;break t}else{O=(Fe&2049|0)!=0&1,q=(Fe&2048|0)==0?(Fe&1|0)==0?5642:5644:5643,Xe=66;break t}case 117:{Q=Xt,O=0,q=5642,l=n[Q>>2]|0,Q=n[Q+4>>2]|0,Xe=66;break}case 99:{o[Lt>>0]=n[Xt>>2],l=Lt,O=0,q=5642,se=Ue,Q=1,k=Ge;break}case 109:{Q=HUe(n[(Vm()|0)>>2]|0)|0,Xe=71;break}case 115:{Q=n[Xt>>2]|0,Q=Q|0?Q:5652,Xe=71;break}case 67:{n[Pr>>2]=n[Xt>>2],n[Or>>2]=0,n[Xt>>2]=Pr,se=-1,Q=Pr,Xe=75;break}case 83:{l=n[Xt>>2]|0,k?(se=k,Q=l,Xe=75):(Bs(s,32,B,0,Fe),l=0,Xe=84);break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{B=qUe(s,+E[Xt>>3],B,k,Fe,Q)|0,l=et;continue e}default:O=0,q=5642,se=Ue,Q=k,k=Fe}while(0);t:do if((Xe|0)==61)Fe=Xt,Oe=n[Fe>>2]|0,Fe=n[Fe+4>>2]|0,se=UUe(Oe,Fe,Ue,Q&32)|0,q=(l&8|0)==0|(Oe|0)==0&(Fe|0)==0,O=q?0:2,q=q?5642:5642+(Q>>4)|0,Ge=l,l=Oe,Q=Fe,Xe=67;else if((Xe|0)==66)se=Km(l,Q,Ue)|0,Ge=Fe,Xe=67;else if((Xe|0)==71)Xe=0,Fe=jUe(Q,0,k)|0,Oe=(Fe|0)==0,l=Q,O=0,q=5642,se=Oe?Q+k|0:Fe,Q=Oe?k:Fe-Q|0,k=Ge;else if((Xe|0)==75){for(Xe=0,q=Q,l=0,k=0;O=n[q>>2]|0,!(!O||(k=u7(Nr,O)|0,(k|0)<0|k>>>0>(se-l|0)>>>0));)if(l=k+l|0,se>>>0>l>>>0)q=q+4|0;else break;if((k|0)<0){m=-1;break e}if(Bs(s,32,B,l,Fe),!l)l=0,Xe=84;else for(O=0;;){if(k=n[Q>>2]|0,!k){Xe=84;break t}if(k=u7(Nr,k)|0,O=k+O|0,(O|0)>(l|0)){Xe=84;break t}if(ss(s,Nr,k),O>>>0>=l>>>0){Xe=84;break}else Q=Q+4|0}}while(0);if((Xe|0)==67)Xe=0,Q=(l|0)!=0|(Q|0)!=0,Fe=(k|0)!=0|Q,Q=((Q^1)&1)+(qe-se)|0,l=Fe?se:Ue,se=Ue,Q=Fe?(k|0)>(Q|0)?k:Q:k,k=(k|0)>-1?Ge&-65537:Ge;else if((Xe|0)==84){Xe=0,Bs(s,32,B,l,Fe^8192),B=(B|0)>(l|0)?B:l,l=et;continue}Oe=se-l|0,Ge=(Q|0)<(Oe|0)?Oe:Q,Fe=Ge+O|0,B=(B|0)<(Fe|0)?Fe:B,Bs(s,32,B,Fe,k),ss(s,q,O),Bs(s,48,B,Fe,k^65536),Bs(s,48,Ge,Oe,0),ss(s,l,Oe),Bs(s,32,B,Fe,k^8192),l=et}e:do if((Xe|0)==87&&!s)if(!M)m=0;else{for(m=1;l=n[d+(m<<2)>>2]|0,!!l;)if(c7(f+(m<<3)|0,l,c),m=m+1|0,(m|0)>=10){m=1;break e}for(;;){if(n[d+(m<<2)>>2]|0){m=-1;break e}if(m=m+1|0,(m|0)>=10){m=1;break}}}while(0);return C=ir,m|0}function MUe(s){return s=s|0,0}function OUe(s){s=s|0}function ss(s,l,c){s=s|0,l=l|0,c=c|0,n[s>>2]&32||ZUe(l,c,s)|0}function l7(s){s=s|0;var l=0,c=0,f=0;if(c=n[s>>2]|0,f=(o[c>>0]|0)+-48|0,f>>>0<10){l=0;do l=f+(l*10|0)|0,c=c+1|0,n[s>>2]=c,f=(o[c>>0]|0)+-48|0;while(f>>>0<10)}else l=0;return l|0}function c7(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;e:do if(l>>>0<=20)do switch(l|0){case 9:{f=(n[c>>2]|0)+(4-1)&~(4-1),l=n[f>>2]|0,n[c>>2]=f+4,n[s>>2]=l;break e}case 10:{f=(n[c>>2]|0)+(4-1)&~(4-1),l=n[f>>2]|0,n[c>>2]=f+4,f=s,n[f>>2]=l,n[f+4>>2]=((l|0)<0)<<31>>31;break e}case 11:{f=(n[c>>2]|0)+(4-1)&~(4-1),l=n[f>>2]|0,n[c>>2]=f+4,f=s,n[f>>2]=l,n[f+4>>2]=0;break e}case 12:{f=(n[c>>2]|0)+(8-1)&~(8-1),l=f,d=n[l>>2]|0,l=n[l+4>>2]|0,n[c>>2]=f+8,f=s,n[f>>2]=d,n[f+4>>2]=l;break e}case 13:{d=(n[c>>2]|0)+(4-1)&~(4-1),f=n[d>>2]|0,n[c>>2]=d+4,f=(f&65535)<<16>>16,d=s,n[d>>2]=f,n[d+4>>2]=((f|0)<0)<<31>>31;break e}case 14:{d=(n[c>>2]|0)+(4-1)&~(4-1),f=n[d>>2]|0,n[c>>2]=d+4,d=s,n[d>>2]=f&65535,n[d+4>>2]=0;break e}case 15:{d=(n[c>>2]|0)+(4-1)&~(4-1),f=n[d>>2]|0,n[c>>2]=d+4,f=(f&255)<<24>>24,d=s,n[d>>2]=f,n[d+4>>2]=((f|0)<0)<<31>>31;break e}case 16:{d=(n[c>>2]|0)+(4-1)&~(4-1),f=n[d>>2]|0,n[c>>2]=d+4,d=s,n[d>>2]=f&255,n[d+4>>2]=0;break e}case 17:{d=(n[c>>2]|0)+(8-1)&~(8-1),m=+E[d>>3],n[c>>2]=d+8,E[s>>3]=m;break e}case 18:{d=(n[c>>2]|0)+(8-1)&~(8-1),m=+E[d>>3],n[c>>2]=d+8,E[s>>3]=m;break e}default:break e}while(0);while(0)}function UUe(s,l,c,f){if(s=s|0,l=l|0,c=c|0,f=f|0,!((s|0)==0&(l|0)==0))do c=c+-1|0,o[c>>0]=u[5694+(s&15)>>0]|0|f,s=mD(s|0,l|0,4)|0,l=De;while(!((s|0)==0&(l|0)==0));return c|0}function _Ue(s,l,c){if(s=s|0,l=l|0,c=c|0,!((s|0)==0&(l|0)==0))do c=c+-1|0,o[c>>0]=s&7|48,s=mD(s|0,l|0,3)|0,l=De;while(!((s|0)==0&(l|0)==0));return c|0}function Km(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;if(l>>>0>0|(l|0)==0&s>>>0>4294967295){for(;f=TT(s|0,l|0,10,0)|0,c=c+-1|0,o[c>>0]=f&255|48,f=s,s=FT(s|0,l|0,10,0)|0,l>>>0>9|(l|0)==9&f>>>0>4294967295;)l=De;l=s}else l=s;if(l)for(;c=c+-1|0,o[c>>0]=(l>>>0)%10|0|48,!(l>>>0<10);)l=(l>>>0)/10|0;return c|0}function HUe(s){return s=s|0,KUe(s,n[(VUe()|0)+188>>2]|0)|0}function jUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;m=l&255,f=(c|0)!=0;e:do if(f&(s&3|0)!=0)for(d=l&255;;){if((o[s>>0]|0)==d<<24>>24){B=6;break e}if(s=s+1|0,c=c+-1|0,f=(c|0)!=0,!(f&(s&3|0)!=0)){B=5;break}}else B=5;while(0);(B|0)==5&&(f?B=6:c=0);e:do if((B|0)==6&&(d=l&255,(o[s>>0]|0)!=d<<24>>24)){f=He(m,16843009)|0;t:do if(c>>>0>3){for(;m=n[s>>2]^f,!((m&-2139062144^-2139062144)&m+-16843009|0);)if(s=s+4|0,c=c+-4|0,c>>>0<=3){B=11;break t}}else B=11;while(0);if((B|0)==11&&!c){c=0;break}for(;;){if((o[s>>0]|0)==d<<24>>24)break e;if(s=s+1|0,c=c+-1|0,!c){c=0;break}}}while(0);return(c|0?s:0)|0}function Bs(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0;if(B=C,C=C+256|0,m=B,(c|0)>(f|0)&(d&73728|0)==0){if(d=c-f|0,zm(m|0,l|0,(d>>>0<256?d:256)|0)|0,d>>>0>255){l=c-f|0;do ss(s,m,256),d=d+-256|0;while(d>>>0>255);d=l&255}ss(s,m,d)}C=B}function u7(s,l){return s=s|0,l=l|0,s?s=YUe(s,l,0)|0:s=0,s|0}function qUe(s,l,c,f,d,m){s=s|0,l=+l,c=c|0,f=f|0,d=d|0,m=m|0;var B=0,k=0,Q=0,O=0,M=0,q=0,se=0,Ge=0,Oe=0,Fe=0,et=0,Xe=0,at=0,Ue=0,qe=0,Lt=0,Or=0,or=0,Xt=0,Pr=0,Nr=0,ir=0,bn=0;bn=C,C=C+560|0,Q=bn+8|0,et=bn,ir=bn+524|0,Nr=ir,O=bn+512|0,n[et>>2]=0,Pr=O+12|0,A7(l)|0,(De|0)<0?(l=-l,or=1,Or=5659):(or=(d&2049|0)!=0&1,Or=(d&2048|0)==0?(d&1|0)==0?5660:5665:5662),A7(l)|0,Xt=De&2146435072;do if(Xt>>>0<2146435072|(Xt|0)==2146435072&0<0){if(Ge=+GUe(l,et)*2,B=Ge!=0,B&&(n[et>>2]=(n[et>>2]|0)+-1),at=m|32,(at|0)==97){Oe=m&32,se=(Oe|0)==0?Or:Or+9|0,q=or|2,B=12-f|0;do if(f>>>0>11|(B|0)==0)l=Ge;else{l=8;do B=B+-1|0,l=l*16;while((B|0)!=0);if((o[se>>0]|0)==45){l=-(l+(-Ge-l));break}else{l=Ge+l-l;break}}while(0);k=n[et>>2]|0,B=(k|0)<0?0-k|0:k,B=Km(B,((B|0)<0)<<31>>31,Pr)|0,(B|0)==(Pr|0)&&(B=O+11|0,o[B>>0]=48),o[B+-1>>0]=(k>>31&2)+43,M=B+-2|0,o[M>>0]=m+15,O=(f|0)<1,Q=(d&8|0)==0,B=ir;do Xt=~~l,k=B+1|0,o[B>>0]=u[5694+Xt>>0]|Oe,l=(l-+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Q=Fe?Xt:O,Q=(B-Q>>2|0)>(f|0)?Q+(f<<2)|0:B,B=(n[et>>2]|0)+Oe|0,n[et>>2]=B}while((B|0)<0);B=O,f=Q}else B=O,f=Q;if(qe=Xt,B>>>0>>0){if(Q=(qe-B>>2)*9|0,M=n[B>>2]|0,M>>>0>=10){O=10;do O=O*10|0,Q=Q+1|0;while(M>>>0>=O>>>0)}}else Q=0;if(Fe=(at|0)==103,Xe=(k|0)!=0,O=k-((at|0)!=102?Q:0)+((Xe&Fe)<<31>>31)|0,(O|0)<(((f-qe>>2)*9|0)+-9|0)){if(O=O+9216|0,Oe=Xt+4+(((O|0)/9|0)+-1024<<2)|0,O=((O|0)%9|0)+1|0,(O|0)<9){M=10;do M=M*10|0,O=O+1|0;while((O|0)!=9)}else M=10;if(q=n[Oe>>2]|0,se=(q>>>0)%(M>>>0)|0,O=(Oe+4|0)==(f|0),O&(se|0)==0)O=Oe;else if(Ge=(((q>>>0)/(M>>>0)|0)&1|0)==0?9007199254740992:9007199254740994,Ue=(M|0)/2|0,l=se>>>0>>0?.5:O&(se|0)==(Ue|0)?1:1.5,or&&(Ue=(o[Or>>0]|0)==45,l=Ue?-l:l,Ge=Ue?-Ge:Ge),O=q-se|0,n[Oe>>2]=O,Ge+l!=Ge){if(Ue=O+M|0,n[Oe>>2]=Ue,Ue>>>0>999999999)for(Q=Oe;O=Q+-4|0,n[Q>>2]=0,O>>>0>>0&&(B=B+-4|0,n[B>>2]=0),Ue=(n[O>>2]|0)+1|0,n[O>>2]=Ue,Ue>>>0>999999999;)Q=O;else O=Oe;if(Q=(qe-B>>2)*9|0,q=n[B>>2]|0,q>>>0>=10){M=10;do M=M*10|0,Q=Q+1|0;while(q>>>0>=M>>>0)}}else O=Oe;O=O+4|0,O=f>>>0>O>>>0?O:f,Ue=B}else O=f,Ue=B;for(at=O;;){if(at>>>0<=Ue>>>0){et=0;break}if(B=at+-4|0,!(n[B>>2]|0))at=B;else{et=1;break}}f=0-Q|0;do if(Fe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ir>>>0)}if(ss(s,Q,(k|0)<9?k:9),O=O+4|0,Q=k+-9|0,O>>>0>>0&(k|0)>9)k=Q;else{k=Q;break}}Bs(s,48,k+9|0,9,0)}else{if(Fe=et?at:Ue+4|0,(k|0)>-1){et=ir+9|0,Oe=(Oe|0)==0,f=et,q=0-Nr|0,se=ir+8|0,M=Ue;do{Q=Km(n[M>>2]|0,0,et)|0,(Q|0)==(et|0)&&(o[se>>0]=48,Q=se);do if((M|0)==(Ue|0)){if(O=Q+1|0,ss(s,Q,1),Oe&(k|0)<1){Q=O;break}ss(s,5710,1),Q=O}else{if(Q>>>0<=ir>>>0)break;zm(ir|0,48,Q+q|0)|0;do Q=Q+-1|0;while(Q>>>0>ir>>>0)}while(0);Nr=f-Q|0,ss(s,Q,(k|0)>(Nr|0)?Nr:k),k=k-Nr|0,M=M+4|0}while(M>>>0>>0&(k|0)>-1)}Bs(s,48,k+18|0,18,0),ss(s,Xe,Pr-Xe|0)}Bs(s,32,c,B,d^8192)}else ir=(m&32|0)!=0,B=or+3|0,Bs(s,32,c,B,d&-65537),ss(s,Or,or),ss(s,l!=l|!1?ir?5686:5690:ir?5678:5682,3),Bs(s,32,c,B,d^8192);while(0);return C=bn,((B|0)<(c|0)?c:B)|0}function A7(s){s=+s;var l=0;return E[v>>3]=s,l=n[v>>2]|0,De=n[v+4>>2]|0,l|0}function GUe(s,l){return s=+s,l=l|0,+ +f7(s,l)}function f7(s,l){s=+s,l=l|0;var c=0,f=0,d=0;switch(E[v>>3]=s,c=n[v>>2]|0,f=n[v+4>>2]|0,d=mD(c|0,f|0,52)|0,d&2047){case 0:{s!=0?(s=+f7(s*18446744073709552e3,l),c=(n[l>>2]|0)+-64|0):c=0,n[l>>2]=c;break}case 2047:break;default:n[l>>2]=(d&2047)+-1022,n[v>>2]=c,n[v+4>>2]=f&-2146435073|1071644672,s=+E[v>>3]}return+s}function YUe(s,l,c){s=s|0,l=l|0,c=c|0;do if(s){if(l>>>0<128){o[s>>0]=l,s=1;break}if(!(n[n[(WUe()|0)+188>>2]>>2]|0))if((l&-128|0)==57216){o[s>>0]=l,s=1;break}else{n[(Vm()|0)>>2]=84,s=-1;break}if(l>>>0<2048){o[s>>0]=l>>>6|192,o[s+1>>0]=l&63|128,s=2;break}if(l>>>0<55296|(l&-8192|0)==57344){o[s>>0]=l>>>12|224,o[s+1>>0]=l>>>6&63|128,o[s+2>>0]=l&63|128,s=3;break}if((l+-65536|0)>>>0<1048576){o[s>>0]=l>>>18|240,o[s+1>>0]=l>>>12&63|128,o[s+2>>0]=l>>>6&63|128,o[s+3>>0]=l&63|128,s=4;break}else{n[(Vm()|0)>>2]=84,s=-1;break}}else s=1;while(0);return s|0}function WUe(){return xT()|0}function VUe(){return xT()|0}function KUe(s,l){s=s|0,l=l|0;var c=0,f=0;for(f=0;;){if((u[5712+f>>0]|0)==(s|0)){s=2;break}if(c=f+1|0,(c|0)==87){c=5800,f=87,s=5;break}else f=c}if((s|0)==2&&(f?(c=5800,s=5):c=5800),(s|0)==5)for(;;){do s=c,c=c+1|0;while((o[s>>0]|0)!=0);if(f=f+-1|0,f)s=5;else break}return JUe(c,n[l+20>>2]|0)|0}function JUe(s,l){return s=s|0,l=l|0,zUe(s,l)|0}function zUe(s,l){return s=s|0,l=l|0,l?l=XUe(n[l>>2]|0,n[l+4>>2]|0,s)|0:l=0,(l|0?l:s)|0}function XUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0,Q=0,O=0,M=0,q=0,se=0;se=(n[s>>2]|0)+1794895138|0,m=Fg(n[s+8>>2]|0,se)|0,f=Fg(n[s+12>>2]|0,se)|0,d=Fg(n[s+16>>2]|0,se)|0;e:do if(m>>>0>>2>>>0&&(q=l-(m<<2)|0,f>>>0>>0&d>>>0>>0)&&((d|f)&3|0)==0){for(q=f>>>2,M=d>>>2,O=0;;){if(k=m>>>1,Q=O+k|0,B=Q<<1,d=B+q|0,f=Fg(n[s+(d<<2)>>2]|0,se)|0,d=Fg(n[s+(d+1<<2)>>2]|0,se)|0,!(d>>>0>>0&f>>>0<(l-d|0)>>>0)){f=0;break e}if(o[s+(d+f)>>0]|0){f=0;break e}if(f=o7(c,s+d|0)|0,!f)break;if(f=(f|0)<0,(m|0)==1){f=0;break e}else O=f?O:Q,m=f?k:m-k|0}f=B+M|0,d=Fg(n[s+(f<<2)>>2]|0,se)|0,f=Fg(n[s+(f+1<<2)>>2]|0,se)|0,f>>>0>>0&d>>>0<(l-f|0)>>>0?f=(o[s+(f+d)>>0]|0)==0?s+f|0:0:f=0}else f=0;while(0);return f|0}function Fg(s,l){s=s|0,l=l|0;var c=0;return c=C7(s|0)|0,((l|0)==0?s:c)|0}function ZUe(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0,k=0;f=c+16|0,d=n[f>>2]|0,d?m=5:$Ue(c)|0?f=0:(d=n[f>>2]|0,m=5);e:do if((m|0)==5){if(k=c+20|0,B=n[k>>2]|0,f=B,(d-B|0)>>>0>>0){f=ED[n[c+36>>2]&7](c,s,l)|0;break}t:do if((o[c+75>>0]|0)>-1){for(B=l;;){if(!B){m=0,d=s;break t}if(d=B+-1|0,(o[s+d>>0]|0)==10)break;B=d}if(f=ED[n[c+36>>2]&7](c,s,B)|0,f>>>0>>0)break e;m=B,d=s+B|0,l=l-B|0,f=n[k>>2]|0}else m=0,d=s;while(0);Dr(f|0,d|0,l|0)|0,n[k>>2]=(n[k>>2]|0)+l,f=m+l|0}while(0);return f|0}function $Ue(s){s=s|0;var l=0,c=0;return l=s+74|0,c=o[l>>0]|0,o[l>>0]=c+255|c,l=n[s>>2]|0,l&8?(n[s>>2]=l|32,s=-1):(n[s+8>>2]=0,n[s+4>>2]=0,c=n[s+44>>2]|0,n[s+28>>2]=c,n[s+20>>2]=c,n[s+16>>2]=c+(n[s+48>>2]|0),s=0),s|0}function _n(s,l){s=y(s),l=y(l);var c=0,f=0;c=p7(s)|0;do if((c&2147483647)>>>0<=2139095040){if(f=p7(l)|0,(f&2147483647)>>>0<=2139095040)if((f^c|0)<0){s=(c|0)<0?l:s;break}else{s=s>2]=s,n[v>>2]|0|0}function Tg(s,l){s=y(s),l=y(l);var c=0,f=0;c=h7(s)|0;do if((c&2147483647)>>>0<=2139095040){if(f=h7(l)|0,(f&2147483647)>>>0<=2139095040)if((f^c|0)<0){s=(c|0)<0?s:l;break}else{s=s>2]=s,n[v>>2]|0|0}function kT(s,l){s=y(s),l=y(l);var c=0,f=0,d=0,m=0,B=0,k=0,Q=0,O=0;m=(h[v>>2]=s,n[v>>2]|0),k=(h[v>>2]=l,n[v>>2]|0),c=m>>>23&255,B=k>>>23&255,Q=m&-2147483648,d=k<<1;e:do if((d|0)!=0&&!((c|0)==255|((e3e(l)|0)&2147483647)>>>0>2139095040)){if(f=m<<1,f>>>0<=d>>>0)return l=y(s*y(0)),y((f|0)==(d|0)?l:s);if(c)f=m&8388607|8388608;else{if(c=m<<9,(c|0)>-1){f=c,c=0;do c=c+-1|0,f=f<<1;while((f|0)>-1)}else c=0;f=m<<1-c}if(B)k=k&8388607|8388608;else{if(m=k<<9,(m|0)>-1){d=0;do d=d+-1|0,m=m<<1;while((m|0)>-1)}else d=0;B=d,k=k<<1-d}d=f-k|0,m=(d|0)>-1;t:do if((c|0)>(B|0)){for(;;){if(m)if(d)f=d;else break;if(f=f<<1,c=c+-1|0,d=f-k|0,m=(d|0)>-1,(c|0)<=(B|0))break t}l=y(s*y(0));break e}while(0);if(m)if(d)f=d;else{l=y(s*y(0));break}if(f>>>0<8388608)do f=f<<1,c=c+-1|0;while(f>>>0<8388608);(c|0)>0?c=f+-8388608|c<<23:c=f>>>(1-c|0),l=(n[v>>2]=c|Q,y(h[v>>2]))}else O=3;while(0);return(O|0)==3&&(l=y(s*l),l=y(l/l)),y(l)}function e3e(s){return s=y(s),h[v>>2]=s,n[v>>2]|0|0}function t3e(s,l){return s=s|0,l=l|0,a7(n[582]|0,s,l)|0}function zr(s){s=s|0,Tt()}function Jm(s){s=s|0}function r3e(s,l){return s=s|0,l=l|0,0}function n3e(s){return s=s|0,(g7(s+4|0)|0)==-1?(ef[n[(n[s>>2]|0)+8>>2]&127](s),s=1):s=0,s|0}function g7(s){s=s|0;var l=0;return l=n[s>>2]|0,n[s>>2]=l+-1,l+-1|0}function bp(s){s=s|0,n3e(s)|0&&i3e(s)}function i3e(s){s=s|0;var l=0;l=s+8|0,(n[l>>2]|0)!=0&&(g7(l)|0)!=-1||ef[n[(n[s>>2]|0)+16>>2]&127](s)}function Vt(s){s=s|0;var l=0;for(l=(s|0)==0?1:s;s=pD(l)|0,!(s|0);){if(s=o3e()|0,!s){s=0;break}k7[s&0]()}return s|0}function d7(s){return s=s|0,Vt(s)|0}function gt(s){s=s|0,hD(s)}function s3e(s){s=s|0,(o[s+11>>0]|0)<0&>(n[s>>2]|0)}function o3e(){var s=0;return s=n[2923]|0,n[2923]=s+0,s|0}function a3e(){}function dD(s,l,c,f){return s=s|0,l=l|0,c=c|0,f=f|0,f=l-f-(c>>>0>s>>>0|0)>>>0,De=f,s-c>>>0|0|0}function QT(s,l,c,f){return s=s|0,l=l|0,c=c|0,f=f|0,c=s+c>>>0,De=l+f+(c>>>0>>0|0)>>>0,c|0|0}function zm(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0,B=0;if(m=s+c|0,l=l&255,(c|0)>=67){for(;s&3;)o[s>>0]=l,s=s+1|0;for(f=m&-4|0,d=f-64|0,B=l|l<<8|l<<16|l<<24;(s|0)<=(d|0);)n[s>>2]=B,n[s+4>>2]=B,n[s+8>>2]=B,n[s+12>>2]=B,n[s+16>>2]=B,n[s+20>>2]=B,n[s+24>>2]=B,n[s+28>>2]=B,n[s+32>>2]=B,n[s+36>>2]=B,n[s+40>>2]=B,n[s+44>>2]=B,n[s+48>>2]=B,n[s+52>>2]=B,n[s+56>>2]=B,n[s+60>>2]=B,s=s+64|0;for(;(s|0)<(f|0);)n[s>>2]=B,s=s+4|0}for(;(s|0)<(m|0);)o[s>>0]=l,s=s+1|0;return m-c|0}function m7(s,l,c){return s=s|0,l=l|0,c=c|0,(c|0)<32?(De=l<>>32-c,s<>>c,s>>>c|(l&(1<>>c-32|0)}function Dr(s,l,c){s=s|0,l=l|0,c=c|0;var f=0,d=0,m=0;if((c|0)>=8192)return Ac(s|0,l|0,c|0)|0;if(m=s|0,d=s+c|0,(s&3)==(l&3)){for(;s&3;){if(!c)return m|0;o[s>>0]=o[l>>0]|0,s=s+1|0,l=l+1|0,c=c-1|0}for(c=d&-4|0,f=c-64|0;(s|0)<=(f|0);)n[s>>2]=n[l>>2],n[s+4>>2]=n[l+4>>2],n[s+8>>2]=n[l+8>>2],n[s+12>>2]=n[l+12>>2],n[s+16>>2]=n[l+16>>2],n[s+20>>2]=n[l+20>>2],n[s+24>>2]=n[l+24>>2],n[s+28>>2]=n[l+28>>2],n[s+32>>2]=n[l+32>>2],n[s+36>>2]=n[l+36>>2],n[s+40>>2]=n[l+40>>2],n[s+44>>2]=n[l+44>>2],n[s+48>>2]=n[l+48>>2],n[s+52>>2]=n[l+52>>2],n[s+56>>2]=n[l+56>>2],n[s+60>>2]=n[l+60>>2],s=s+64|0,l=l+64|0;for(;(s|0)<(c|0);)n[s>>2]=n[l>>2],s=s+4|0,l=l+4|0}else for(c=d-4|0;(s|0)<(c|0);)o[s>>0]=o[l>>0]|0,o[s+1>>0]=o[l+1>>0]|0,o[s+2>>0]=o[l+2>>0]|0,o[s+3>>0]=o[l+3>>0]|0,s=s+4|0,l=l+4|0;for(;(s|0)<(d|0);)o[s>>0]=o[l>>0]|0,s=s+1|0,l=l+1|0;return m|0}function y7(s){s=s|0;var l=0;return l=o[L+(s&255)>>0]|0,(l|0)<8?l|0:(l=o[L+(s>>8&255)>>0]|0,(l|0)<8?l+8|0:(l=o[L+(s>>16&255)>>0]|0,(l|0)<8?l+16|0:(o[L+(s>>>24)>>0]|0)+24|0))}function E7(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0;var m=0,B=0,k=0,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>0<=30){l=m+1|0,k=31-m|0,B=l,s=O<>>(l>>>0),l=O>>>(l>>>0),m=0,k=M<>2]=s|0,n[d+4>>2]=Q|l&0,Ge=0,Oe=0,De=Ge,Oe|0):(Ge=0,Oe=0,De=Ge,Oe|0)}while(0);if(!B)O=k,Q=0,k=0;else{q=c|0|0,M=se|f&0,O=QT(q|0,M|0,-1,-1)|0,c=De,Q=k,k=0;do f=Q,Q=m>>>31|Q<<1,m=k|m<<1,f=s<<1|f>>>31|0,se=s>>>31|l<<1|0,dD(O|0,c|0,f|0,se|0)|0,Oe=De,Ge=Oe>>31|((Oe|0)<0?-1:0)<<1,k=Ge&1,s=dD(f|0,se|0,Ge&q|0,(((Oe|0)<0?-1:0)>>31|((Oe|0)<0?-1:0)<<1)&M|0)|0,l=De,B=B-1|0;while((B|0)!=0);O=Q,Q=0}return B=0,d|0&&(n[d>>2]=s,n[d+4>>2]=l),Ge=(m|0)>>>31|(O|B)<<1|(B<<1|m>>>31)&0|Q,Oe=(m<<1|0>>>31)&-2|k,De=Ge,Oe|0}function FT(s,l,c,f){return s=s|0,l=l|0,c=c|0,f=f|0,E7(s,l,c,f,0)|0}function kp(s){s=s|0;var l=0,c=0;return c=s+15&-16|0,l=n[I>>2]|0,s=l+c|0,(c|0)>0&(s|0)<(l|0)|(s|0)<0?(ie()|0,vA(12),-1):(n[I>>2]=s,(s|0)>(Z()|0)&&(X()|0)==0?(n[I>>2]=l,vA(12),-1):l|0)}function Mw(s,l,c){s=s|0,l=l|0,c=c|0;var f=0;if((l|0)<(s|0)&(s|0)<(l+c|0)){for(f=s,l=l+c|0,s=s+c|0;(c|0)>0;)s=s-1|0,l=l-1|0,c=c-1|0,o[s>>0]=o[l>>0]|0;s=f}else Dr(s,l,c)|0;return s|0}function TT(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0;var d=0,m=0;return m=C,C=C+16|0,d=m|0,E7(s,l,c,f,d)|0,C=m,De=n[d+4>>2]|0,n[d>>2]|0|0}function C7(s){return s=s|0,(s&255)<<24|(s>>8&255)<<16|(s>>16&255)<<8|s>>>24|0}function l3e(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,w7[s&1](l|0,c|0,f|0,d|0,m|0)}function c3e(s,l,c){s=s|0,l=l|0,c=y(c),I7[s&1](l|0,y(c))}function u3e(s,l,c){s=s|0,l=l|0,c=+c,B7[s&31](l|0,+c)}function A3e(s,l,c,f){return s=s|0,l=l|0,c=y(c),f=y(f),y(v7[s&0](l|0,y(c),y(f)))}function f3e(s,l){s=s|0,l=l|0,ef[s&127](l|0)}function p3e(s,l,c){s=s|0,l=l|0,c=c|0,tf[s&31](l|0,c|0)}function h3e(s,l){return s=s|0,l=l|0,Ng[s&31](l|0)|0}function g3e(s,l,c,f,d){s=s|0,l=l|0,c=+c,f=+f,d=d|0,D7[s&1](l|0,+c,+f,d|0)}function d3e(s,l,c,f){s=s|0,l=l|0,c=+c,f=+f,z3e[s&1](l|0,+c,+f)}function m3e(s,l,c,f){return s=s|0,l=l|0,c=c|0,f=f|0,ED[s&7](l|0,c|0,f|0)|0}function y3e(s,l,c,f){return s=s|0,l=l|0,c=c|0,f=f|0,+X3e[s&1](l|0,c|0,f|0)}function E3e(s,l){return s=s|0,l=l|0,+P7[s&15](l|0)}function C3e(s,l,c){return s=s|0,l=l|0,c=+c,Z3e[s&1](l|0,+c)|0}function w3e(s,l,c){return s=s|0,l=l|0,c=c|0,NT[s&15](l|0,c|0)|0}function I3e(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=+f,d=+d,m=m|0,$3e[s&1](l|0,c|0,+f,+d,m|0)}function B3e(s,l,c,f,d,m,B){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,B=B|0,e_e[s&1](l|0,c|0,f|0,d|0,m|0,B|0)}function v3e(s,l,c){return s=s|0,l=l|0,c=c|0,+S7[s&7](l|0,c|0)}function D3e(s){return s=s|0,CD[s&7]()|0}function P3e(s,l,c,f,d,m){return s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,x7[s&1](l|0,c|0,f|0,d|0,m|0)|0}function S3e(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=+d,t_e[s&1](l|0,c|0,f|0,+d)}function x3e(s,l,c,f,d,m,B){s=s|0,l=l|0,c=c|0,f=y(f),d=d|0,m=y(m),B=B|0,b7[s&1](l|0,c|0,y(f),d|0,y(m),B|0)}function b3e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,_w[s&15](l|0,c|0,f|0)}function k3e(s){s=s|0,k7[s&0]()}function Q3e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=+f,Q7[s&15](l|0,c|0,+f)}function F3e(s,l,c){return s=s|0,l=+l,c=+c,r_e[s&1](+l,+c)|0}function T3e(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,LT[s&15](l|0,c|0,f|0,d|0)}function R3e(s,l,c,f,d){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,F(0)}function N3e(s,l){s=s|0,l=y(l),F(1)}function ma(s,l){s=s|0,l=+l,F(2)}function L3e(s,l,c){return s=s|0,l=y(l),c=y(c),F(3),Ze}function Er(s){s=s|0,F(4)}function Ow(s,l){s=s|0,l=l|0,F(5)}function Ja(s){return s=s|0,F(6),0}function M3e(s,l,c,f){s=s|0,l=+l,c=+c,f=f|0,F(7)}function O3e(s,l,c){s=s|0,l=+l,c=+c,F(8)}function U3e(s,l,c){return s=s|0,l=l|0,c=c|0,F(9),0}function _3e(s,l,c){return s=s|0,l=l|0,c=c|0,F(10),0}function Rg(s){return s=s|0,F(11),0}function H3e(s,l){return s=s|0,l=+l,F(12),0}function Uw(s,l){return s=s|0,l=l|0,F(13),0}function j3e(s,l,c,f,d){s=s|0,l=l|0,c=+c,f=+f,d=d|0,F(14)}function q3e(s,l,c,f,d,m){s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,m=m|0,F(15)}function RT(s,l){return s=s|0,l=l|0,F(16),0}function G3e(){return F(17),0}function Y3e(s,l,c,f,d){return s=s|0,l=l|0,c=c|0,f=f|0,d=d|0,F(18),0}function W3e(s,l,c,f){s=s|0,l=l|0,c=c|0,f=+f,F(19)}function V3e(s,l,c,f,d,m){s=s|0,l=l|0,c=y(c),f=f|0,d=y(d),m=m|0,F(20)}function yD(s,l,c){s=s|0,l=l|0,c=c|0,F(21)}function K3e(){F(22)}function Xm(s,l,c){s=s|0,l=l|0,c=+c,F(23)}function J3e(s,l){return s=+s,l=+l,F(24),0}function Zm(s,l,c,f){s=s|0,l=l|0,c=c|0,f=f|0,F(25)}var w7=[R3e,YLe],I7=[N3e,fo],B7=[ma,xw,bw,wF,IF,Dl,kw,BF,Hm,xu,Fw,vF,$v,WA,eD,jm,tD,rD,qm,ma,ma,ma,ma,ma,ma,ma,ma,ma,ma,ma,ma,ma],v7=[L3e],ef=[Er,Jm,DDe,PDe,SDe,rbe,nbe,ibe,CNe,wNe,INe,FLe,TLe,RLe,eUe,tUe,rUe,hs,Kv,_m,YA,Qw,wve,Ive,gDe,NDe,VDe,APe,SPe,GPe,aSe,ISe,MSe,$Se,gxe,Qxe,Vxe,wbe,Mbe,$be,gke,Qke,Vke,fQe,SQe,HQe,nFe,Sc,RFe,zFe,gTe,TTe,KTe,gRe,DRe,xRe,YRe,KRe,ANe,vNe,SNe,GNe,lLe,a5,qMe,COe,NOe,zOe,y4e,T4e,G4e,V4e,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er,Er],tf=[Ow,hF,gF,Sw,Su,dF,mF,Ip,yF,EF,CF,Zv,VA,Ke,At,Wt,vr,Sn,Fr,PF,lve,Qve,dQe,kQe,MTe,WMe,dLe,Y9,Ow,Ow,Ow,Ow],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iii:m3e,_emscripten_get_global_libc:kUe,dynCall_viid:Q3e,dynCall_viiid:S3e,dynCall_viififi:x3e,dynCall_ii:h3e,__GLOBAL__sub_I_Binding_cc:NMe,dynCall_viiii:T3e,dynCall_iiiiii:P3e,stackSave:gc,dynCall_viiiii:l3e,__GLOBAL__sub_I_nbind_cc:Lve,dynCall_vidd:d3e,_free:hD,runPostSets:a3e,dynCall_viiiiii:B3e,establishStackSpace:ji,_memmove:Mw,stackRestore:pu,_malloc:pD,__GLOBAL__sub_I_common_cc:tLe,dynCall_viddi:g3e,dynCall_dii:v3e,dynCall_v:k3e}}(Module.asmGlobalArg,Module.asmLibraryArg,buffer),_llvm_bswap_i32=Module._llvm_bswap_i32=asm._llvm_bswap_i32,getTempRet0=Module.getTempRet0=asm.getTempRet0,___udivdi3=Module.___udivdi3=asm.___udivdi3,setThrew=Module.setThrew=asm.setThrew,_bitshift64Lshr=Module._bitshift64Lshr=asm._bitshift64Lshr,_bitshift64Shl=Module._bitshift64Shl=asm._bitshift64Shl,_memset=Module._memset=asm._memset,_sbrk=Module._sbrk=asm._sbrk,_memcpy=Module._memcpy=asm._memcpy,stackAlloc=Module.stackAlloc=asm.stackAlloc,___uremdi3=Module.___uremdi3=asm.___uremdi3,_nbind_init=Module._nbind_init=asm._nbind_init,_i64Subtract=Module._i64Subtract=asm._i64Subtract,setTempRet0=Module.setTempRet0=asm.setTempRet0,_i64Add=Module._i64Add=asm._i64Add,_emscripten_get_global_libc=Module._emscripten_get_global_libc=asm._emscripten_get_global_libc,__GLOBAL__sub_I_Yoga_cpp=Module.__GLOBAL__sub_I_Yoga_cpp=asm.__GLOBAL__sub_I_Yoga_cpp,__GLOBAL__sub_I_Binding_cc=Module.__GLOBAL__sub_I_Binding_cc=asm.__GLOBAL__sub_I_Binding_cc,stackSave=Module.stackSave=asm.stackSave,__GLOBAL__sub_I_nbind_cc=Module.__GLOBAL__sub_I_nbind_cc=asm.__GLOBAL__sub_I_nbind_cc,_free=Module._free=asm._free,runPostSets=Module.runPostSets=asm.runPostSets,establishStackSpace=Module.establishStackSpace=asm.establishStackSpace,_memmove=Module._memmove=asm._memmove,stackRestore=Module.stackRestore=asm.stackRestore,_malloc=Module._malloc=asm._malloc,__GLOBAL__sub_I_common_cc=Module.__GLOBAL__sub_I_common_cc=asm.__GLOBAL__sub_I_common_cc,dynCall_viiiii=Module.dynCall_viiiii=asm.dynCall_viiiii,dynCall_vif=Module.dynCall_vif=asm.dynCall_vif,dynCall_vid=Module.dynCall_vid=asm.dynCall_vid,dynCall_fiff=Module.dynCall_fiff=asm.dynCall_fiff,dynCall_vi=Module.dynCall_vi=asm.dynCall_vi,dynCall_vii=Module.dynCall_vii=asm.dynCall_vii,dynCall_ii=Module.dynCall_ii=asm.dynCall_ii,dynCall_viddi=Module.dynCall_viddi=asm.dynCall_viddi,dynCall_vidd=Module.dynCall_vidd=asm.dynCall_vidd,dynCall_iiii=Module.dynCall_iiii=asm.dynCall_iiii,dynCall_diii=Module.dynCall_diii=asm.dynCall_diii,dynCall_di=Module.dynCall_di=asm.dynCall_di,dynCall_iid=Module.dynCall_iid=asm.dynCall_iid,dynCall_iii=Module.dynCall_iii=asm.dynCall_iii,dynCall_viiddi=Module.dynCall_viiddi=asm.dynCall_viiddi,dynCall_viiiiii=Module.dynCall_viiiiii=asm.dynCall_viiiiii,dynCall_dii=Module.dynCall_dii=asm.dynCall_dii,dynCall_i=Module.dynCall_i=asm.dynCall_i,dynCall_iiiiii=Module.dynCall_iiiiii=asm.dynCall_iiiiii,dynCall_viiid=Module.dynCall_viiid=asm.dynCall_viiid,dynCall_viififi=Module.dynCall_viififi=asm.dynCall_viififi,dynCall_viii=Module.dynCall_viii=asm.dynCall_viii,dynCall_v=Module.dynCall_v=asm.dynCall_v,dynCall_viid=Module.dynCall_viid=asm.dynCall_viid,dynCall_idd=Module.dynCall_idd=asm.dynCall_idd,dynCall_viiii=Module.dynCall_viiii=asm.dynCall_viiii;Runtime.stackAlloc=Module.stackAlloc,Runtime.stackSave=Module.stackSave,Runtime.stackRestore=Module.stackRestore,Runtime.establishStackSpace=Module.establishStackSpace,Runtime.setTempRet0=Module.setTempRet0,Runtime.getTempRet0=Module.getTempRet0,Module.asm=asm;function ExitStatus(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}ExitStatus.prototype=new Error,ExitStatus.prototype.constructor=ExitStatus;var initialStackTop,preloadStartTime=null,calledMain=!1;dependenciesFulfilled=function t(){Module.calledRun||run(),Module.calledRun||(dependenciesFulfilled=t)},Module.callMain=Module.callMain=function t(e){e=e||[],ensureInitRuntime();var r=e.length+1;function o(){for(var p=0;p<4-1;p++)a.push(0)}var a=[allocate(intArrayFromString(Module.thisProgram),"i8",ALLOC_NORMAL)];o();for(var n=0;n0||(preRun(),runDependencies>0)||Module.calledRun)return;function e(){Module.calledRun||(Module.calledRun=!0,!ABORT&&(ensureInitRuntime(),preMain(),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),Module._main&&shouldRunNow&&Module.callMain(t),postRun()))}Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),e()},1)):e()}Module.run=Module.run=run;function exit(t,e){e&&Module.noExitRuntime||(Module.noExitRuntime||(ABORT=!0,EXITSTATUS=t,STACKTOP=initialStackTop,exitRuntime(),Module.onExit&&Module.onExit(t)),ENVIRONMENT_IS_NODE&&process.exit(t),Module.quit(t,new ExitStatus(t)))}Module.exit=Module.exit=exit;var abortDecorators=[];function abort(t){Module.onAbort&&Module.onAbort(t),t!==void 0?(Module.print(t),Module.printErr(t),t=JSON.stringify(t)):t="",ABORT=!0,EXITSTATUS=1;var e=` +If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.`,r="abort("+t+") at "+stackTrace()+e;throw abortDecorators&&abortDecorators.forEach(function(o){r=o(r,t)}),r}if(Module.abort=Module.abort=abort,Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run()})});var om=_((wVt,OEe)=>{"use strict";var Jyt=LEe(),zyt=MEe(),Q6=!1,F6=null;zyt({},function(t,e){if(!Q6){if(Q6=!0,t)throw t;F6=e}});if(!Q6)throw new Error("Failed to load the yoga module - it needed to be loaded synchronously, but didn't");OEe.exports=Jyt(F6.bind,F6.lib)});var R6=_((IVt,T6)=>{"use strict";var UEe=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);T6.exports=UEe;T6.exports.default=UEe});var HEe=_((BVt,_Ee)=>{"use strict";_Ee.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\u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|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var Jk=_((vVt,N6)=>{"use strict";var Xyt=MP(),Zyt=R6(),$yt=HEe(),jEe=t=>{if(typeof t!="string"||t.length===0||(t=Xyt(t),t.length===0))return 0;t=t.replace($yt()," ");let e=0;for(let r=0;r=127&&o<=159||o>=768&&o<=879||(o>65535&&r++,e+=Zyt(o)?2:1)}return e};N6.exports=jEe;N6.exports.default=jEe});var M6=_((DVt,L6)=>{"use strict";var eEt=Jk(),qEe=t=>{let e=0;for(let r of t.split(` +`))e=Math.max(e,eEt(r));return e};L6.exports=qEe;L6.exports.default=qEe});var GEe=_(lB=>{"use strict";var tEt=lB&&lB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lB,"__esModule",{value:!0});var rEt=tEt(M6()),O6={};lB.default=t=>{if(t.length===0)return{width:0,height:0};if(O6[t])return O6[t];let e=rEt.default(t),r=t.split(` +`).length;return O6[t]={width:e,height:r},{width:e,height:r}}});var YEe=_(cB=>{"use strict";var nEt=cB&&cB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(cB,"__esModule",{value:!0});var dn=nEt(om()),iEt=(t,e)=>{"position"in e&&t.setPositionType(e.position==="absolute"?dn.default.POSITION_TYPE_ABSOLUTE:dn.default.POSITION_TYPE_RELATIVE)},sEt=(t,e)=>{"marginLeft"in e&&t.setMargin(dn.default.EDGE_START,e.marginLeft||0),"marginRight"in e&&t.setMargin(dn.default.EDGE_END,e.marginRight||0),"marginTop"in e&&t.setMargin(dn.default.EDGE_TOP,e.marginTop||0),"marginBottom"in e&&t.setMargin(dn.default.EDGE_BOTTOM,e.marginBottom||0)},oEt=(t,e)=>{"paddingLeft"in e&&t.setPadding(dn.default.EDGE_LEFT,e.paddingLeft||0),"paddingRight"in e&&t.setPadding(dn.default.EDGE_RIGHT,e.paddingRight||0),"paddingTop"in e&&t.setPadding(dn.default.EDGE_TOP,e.paddingTop||0),"paddingBottom"in e&&t.setPadding(dn.default.EDGE_BOTTOM,e.paddingBottom||0)},aEt=(t,e)=>{var r;"flexGrow"in e&&t.setFlexGrow((r=e.flexGrow)!==null&&r!==void 0?r:0),"flexShrink"in e&&t.setFlexShrink(typeof e.flexShrink=="number"?e.flexShrink:1),"flexDirection"in e&&(e.flexDirection==="row"&&t.setFlexDirection(dn.default.FLEX_DIRECTION_ROW),e.flexDirection==="row-reverse"&&t.setFlexDirection(dn.default.FLEX_DIRECTION_ROW_REVERSE),e.flexDirection==="column"&&t.setFlexDirection(dn.default.FLEX_DIRECTION_COLUMN),e.flexDirection==="column-reverse"&&t.setFlexDirection(dn.default.FLEX_DIRECTION_COLUMN_REVERSE)),"flexBasis"in e&&(typeof e.flexBasis=="number"?t.setFlexBasis(e.flexBasis):typeof e.flexBasis=="string"?t.setFlexBasisPercent(Number.parseInt(e.flexBasis,10)):t.setFlexBasis(NaN)),"alignItems"in e&&((e.alignItems==="stretch"||!e.alignItems)&&t.setAlignItems(dn.default.ALIGN_STRETCH),e.alignItems==="flex-start"&&t.setAlignItems(dn.default.ALIGN_FLEX_START),e.alignItems==="center"&&t.setAlignItems(dn.default.ALIGN_CENTER),e.alignItems==="flex-end"&&t.setAlignItems(dn.default.ALIGN_FLEX_END)),"alignSelf"in e&&((e.alignSelf==="auto"||!e.alignSelf)&&t.setAlignSelf(dn.default.ALIGN_AUTO),e.alignSelf==="flex-start"&&t.setAlignSelf(dn.default.ALIGN_FLEX_START),e.alignSelf==="center"&&t.setAlignSelf(dn.default.ALIGN_CENTER),e.alignSelf==="flex-end"&&t.setAlignSelf(dn.default.ALIGN_FLEX_END)),"justifyContent"in e&&((e.justifyContent==="flex-start"||!e.justifyContent)&&t.setJustifyContent(dn.default.JUSTIFY_FLEX_START),e.justifyContent==="center"&&t.setJustifyContent(dn.default.JUSTIFY_CENTER),e.justifyContent==="flex-end"&&t.setJustifyContent(dn.default.JUSTIFY_FLEX_END),e.justifyContent==="space-between"&&t.setJustifyContent(dn.default.JUSTIFY_SPACE_BETWEEN),e.justifyContent==="space-around"&&t.setJustifyContent(dn.default.JUSTIFY_SPACE_AROUND))},lEt=(t,e)=>{var r,o;"width"in e&&(typeof e.width=="number"?t.setWidth(e.width):typeof e.width=="string"?t.setWidthPercent(Number.parseInt(e.width,10)):t.setWidthAuto()),"height"in e&&(typeof e.height=="number"?t.setHeight(e.height):typeof e.height=="string"?t.setHeightPercent(Number.parseInt(e.height,10)):t.setHeightAuto()),"minWidth"in e&&(typeof e.minWidth=="string"?t.setMinWidthPercent(Number.parseInt(e.minWidth,10)):t.setMinWidth((r=e.minWidth)!==null&&r!==void 0?r:0)),"minHeight"in e&&(typeof e.minHeight=="string"?t.setMinHeightPercent(Number.parseInt(e.minHeight,10)):t.setMinHeight((o=e.minHeight)!==null&&o!==void 0?o:0))},cEt=(t,e)=>{"display"in e&&t.setDisplay(e.display==="flex"?dn.default.DISPLAY_FLEX:dn.default.DISPLAY_NONE)},uEt=(t,e)=>{if("borderStyle"in e){let r=typeof e.borderStyle=="string"?1:0;t.setBorder(dn.default.EDGE_TOP,r),t.setBorder(dn.default.EDGE_BOTTOM,r),t.setBorder(dn.default.EDGE_LEFT,r),t.setBorder(dn.default.EDGE_RIGHT,r)}};cB.default=(t,e={})=>{iEt(t,e),sEt(t,e),oEt(t,e),aEt(t,e),lEt(t,e),cEt(t,e),uEt(t,e)}});var KEe=_((xVt,VEe)=>{"use strict";var uB=Jk(),AEt=MP(),fEt=vI(),_6=new Set(["\x1B","\x9B"]),pEt=39,WEe=t=>`${_6.values().next().value}[${t}m`,hEt=t=>t.split(" ").map(e=>uB(e)),U6=(t,e,r)=>{let o=[...e],a=!1,n=uB(AEt(t[t.length-1]));for(let[u,A]of o.entries()){let p=uB(A);if(n+p<=r?t[t.length-1]+=A:(t.push(A),n=0),_6.has(A))a=!0;else if(a&&A==="m"){a=!1;continue}a||(n+=p,n===r&&u0&&t.length>1&&(t[t.length-2]+=t.pop())},gEt=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(uB(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},dEt=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let o="",a="",n,u=hEt(t),A=[""];for(let[p,h]of t.split(" ").entries()){r.trim!==!1&&(A[A.length-1]=A[A.length-1].trimLeft());let E=uB(A[A.length-1]);if(p!==0&&(E>=e&&(r.wordWrap===!1||r.trim===!1)&&(A.push(""),E=0),(E>0||r.trim===!1)&&(A[A.length-1]+=" ",E++)),r.hard&&u[p]>e){let I=e-E,v=1+Math.floor((u[p]-I-1)/e);Math.floor((u[p]-1)/e)e&&E>0&&u[p]>0){if(r.wordWrap===!1&&Ee&&r.wordWrap===!1){U6(A,h,e);continue}A[A.length-1]+=h}r.trim!==!1&&(A=A.map(gEt)),o=A.join(` +`);for(let[p,h]of[...o].entries()){if(a+=h,_6.has(h)){let I=parseFloat(/\d[^m]*/.exec(o.slice(p,p+4)));n=I===pEt?null:I}let E=fEt.codes.get(Number(n));n&&E&&(o[p+1]===` +`?a+=WEe(E):h===` +`&&(a+=WEe(n)))}return a};VEe.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,` +`).split(` +`).map(o=>dEt(o,e,r)).join(` +`)});var XEe=_((bVt,zEe)=>{"use strict";var JEe="[\uD800-\uDBFF][\uDC00-\uDFFF]",mEt=t=>t&&t.exact?new RegExp(`^${JEe}$`):new RegExp(JEe,"g");zEe.exports=mEt});var H6=_((kVt,tCe)=>{"use strict";var yEt=R6(),EEt=XEe(),ZEe=vI(),eCe=["\x1B","\x9B"],zk=t=>`${eCe[0]}[${t}m`,$Ee=(t,e,r)=>{let o=[];t=[...t];for(let a of t){let n=a;a.match(";")&&(a=a.split(";")[0][0]+"0");let u=ZEe.codes.get(parseInt(a,10));if(u){let A=t.indexOf(u.toString());A>=0?t.splice(A,1):o.push(zk(e?u:n))}else if(e){o.push(zk(0));break}else o.push(zk(n))}if(e&&(o=o.filter((a,n)=>o.indexOf(a)===n),r!==void 0)){let a=zk(ZEe.codes.get(parseInt(r,10)));o=o.reduce((n,u)=>u===a?[u,...n]:[...n,u],[])}return o.join("")};tCe.exports=(t,e,r)=>{let o=[...t.normalize()],a=[];r=typeof r=="number"?r:o.length;let n=!1,u,A=0,p="";for(let[h,E]of o.entries()){let I=!1;if(eCe.includes(E)){let v=/\d[^m]*/.exec(t.slice(h,h+18));u=v&&v.length>0?v[0]:void 0,Ae&&A<=r)p+=E;else if(A===e&&!n&&u!==void 0)p=$Ee(a);else if(A>=r){p+=$Ee(a,!0,u);break}}return p}});var nCe=_((QVt,rCe)=>{"use strict";var y0=H6(),CEt=Jk();function Xk(t,e,r){if(t.charAt(e)===" ")return e;for(let o=1;o<=3;o++)if(r){if(t.charAt(e+o)===" ")return e+o}else if(t.charAt(e-o)===" ")return e-o;return e}rCe.exports=(t,e,r)=>{r={position:"end",preferTruncationOnSpace:!1,...r};let{position:o,space:a,preferTruncationOnSpace:n}=r,u="\u2026",A=1;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof e!="number")throw new TypeError(`Expected \`columns\` to be a number, got ${typeof e}`);if(e<1)return"";if(e===1)return u;let p=CEt(t);if(p<=e)return t;if(o==="start"){if(n){let h=Xk(t,p-e+1,!0);return u+y0(t,h,p).trim()}return a===!0&&(u+=" ",A=2),u+y0(t,p-e+A,p)}if(o==="middle"){a===!0&&(u=" "+u+" ",A=3);let h=Math.floor(e/2);if(n){let E=Xk(t,h),I=Xk(t,p-(e-h)+1,!0);return y0(t,0,E)+u+y0(t,I,p).trim()}return y0(t,0,h)+u+y0(t,p-(e-h)+A,p)}if(o==="end"){if(n){let h=Xk(t,e-1);return y0(t,0,h)+u}return a===!0&&(u=" "+u,A=2),y0(t,0,e-A)+u}throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${o}`)}});var q6=_(AB=>{"use strict";var iCe=AB&&AB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(AB,"__esModule",{value:!0});var wEt=iCe(KEe()),IEt=iCe(nCe()),j6={};AB.default=(t,e,r)=>{let o=t+String(e)+String(r);if(j6[o])return j6[o];let a=t;if(r==="wrap"&&(a=wEt.default(t,e,{trim:!1,hard:!0})),r.startsWith("truncate")){let n="end";r==="truncate-middle"&&(n="middle"),r==="truncate-start"&&(n="start"),a=IEt.default(t,e,{position:n})}return j6[o]=a,a}});var Y6=_(G6=>{"use strict";Object.defineProperty(G6,"__esModule",{value:!0});var sCe=t=>{let e="";if(t.childNodes.length>0)for(let r of t.childNodes){let o="";r.nodeName==="#text"?o=r.nodeValue:((r.nodeName==="ink-text"||r.nodeName==="ink-virtual-text")&&(o=sCe(r)),o.length>0&&typeof r.internal_transform=="function"&&(o=r.internal_transform(o))),e+=o}return e};G6.default=sCe});var W6=_(pi=>{"use strict";var fB=pi&&pi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pi,"__esModule",{value:!0});pi.setTextNodeValue=pi.createTextNode=pi.setStyle=pi.setAttribute=pi.removeChildNode=pi.insertBeforeNode=pi.appendChildNode=pi.createNode=pi.TEXT_NAME=void 0;var BEt=fB(om()),oCe=fB(GEe()),vEt=fB(YEe()),DEt=fB(q6()),PEt=fB(Y6());pi.TEXT_NAME="#text";pi.createNode=t=>{var e;let r={nodeName:t,style:{},attributes:{},childNodes:[],parentNode:null,yogaNode:t==="ink-virtual-text"?void 0:BEt.default.Node.create()};return t==="ink-text"&&((e=r.yogaNode)===null||e===void 0||e.setMeasureFunc(SEt.bind(null,r))),r};pi.appendChildNode=(t,e)=>{var r;e.parentNode&&pi.removeChildNode(e.parentNode,e),e.parentNode=t,t.childNodes.push(e),e.yogaNode&&((r=t.yogaNode)===null||r===void 0||r.insertChild(e.yogaNode,t.yogaNode.getChildCount())),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&Zk(t)};pi.insertBeforeNode=(t,e,r)=>{var o,a;e.parentNode&&pi.removeChildNode(e.parentNode,e),e.parentNode=t;let n=t.childNodes.indexOf(r);if(n>=0){t.childNodes.splice(n,0,e),e.yogaNode&&((o=t.yogaNode)===null||o===void 0||o.insertChild(e.yogaNode,n));return}t.childNodes.push(e),e.yogaNode&&((a=t.yogaNode)===null||a===void 0||a.insertChild(e.yogaNode,t.yogaNode.getChildCount())),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&Zk(t)};pi.removeChildNode=(t,e)=>{var r,o;e.yogaNode&&((o=(r=e.parentNode)===null||r===void 0?void 0:r.yogaNode)===null||o===void 0||o.removeChild(e.yogaNode)),e.parentNode=null;let a=t.childNodes.indexOf(e);a>=0&&t.childNodes.splice(a,1),(t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text")&&Zk(t)};pi.setAttribute=(t,e,r)=>{t.attributes[e]=r};pi.setStyle=(t,e)=>{t.style=e,t.yogaNode&&vEt.default(t.yogaNode,e)};pi.createTextNode=t=>{let e={nodeName:"#text",nodeValue:t,yogaNode:void 0,parentNode:null,style:{}};return pi.setTextNodeValue(e,t),e};var SEt=function(t,e){var r,o;let a=t.nodeName==="#text"?t.nodeValue:PEt.default(t),n=oCe.default(a);if(n.width<=e||n.width>=1&&e>0&&e<1)return n;let u=(o=(r=t.style)===null||r===void 0?void 0:r.textWrap)!==null&&o!==void 0?o:"wrap",A=DEt.default(a,e,u);return oCe.default(A)},aCe=t=>{var e;if(!(!t||!t.parentNode))return(e=t.yogaNode)!==null&&e!==void 0?e:aCe(t.parentNode)},Zk=t=>{let e=aCe(t);e?.markDirty()};pi.setTextNodeValue=(t,e)=>{typeof e!="string"&&(e=String(e)),t.nodeValue=e,Zk(t)}});var fCe=_(pB=>{"use strict";var ACe=pB&&pB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pB,"__esModule",{value:!0});var lCe=x6(),xEt=ACe(kEe()),cCe=ACe(om()),Mo=W6(),uCe=t=>{t?.unsetMeasureFunc(),t?.freeRecursive()};pB.default=xEt.default({schedulePassiveEffects:lCe.unstable_scheduleCallback,cancelPassiveEffects:lCe.unstable_cancelCallback,now:Date.now,getRootHostContext:()=>({isInsideText:!1}),prepareForCommit:()=>{},resetAfterCommit:t=>{if(t.isStaticDirty){t.isStaticDirty=!1,typeof t.onImmediateRender=="function"&&t.onImmediateRender();return}typeof t.onRender=="function"&&t.onRender()},getChildHostContext:(t,e)=>{let r=t.isInsideText,o=e==="ink-text"||e==="ink-virtual-text";return r===o?t:{isInsideText:o}},shouldSetTextContent:()=>!1,createInstance:(t,e,r,o)=>{if(o.isInsideText&&t==="ink-box")throw new Error(" can\u2019t be nested inside component");let a=t==="ink-text"&&o.isInsideText?"ink-virtual-text":t,n=Mo.createNode(a);for(let[u,A]of Object.entries(e))u!=="children"&&(u==="style"?Mo.setStyle(n,A):u==="internal_transform"?n.internal_transform=A:u==="internal_static"?n.internal_static=!0:Mo.setAttribute(n,u,A));return n},createTextInstance:(t,e,r)=>{if(!r.isInsideText)throw new Error(`Text string "${t}" must be rendered inside component`);return Mo.createTextNode(t)},resetTextContent:()=>{},hideTextInstance:t=>{Mo.setTextNodeValue(t,"")},unhideTextInstance:(t,e)=>{Mo.setTextNodeValue(t,e)},getPublicInstance:t=>t,hideInstance:t=>{var e;(e=t.yogaNode)===null||e===void 0||e.setDisplay(cCe.default.DISPLAY_NONE)},unhideInstance:t=>{var e;(e=t.yogaNode)===null||e===void 0||e.setDisplay(cCe.default.DISPLAY_FLEX)},appendInitialChild:Mo.appendChildNode,appendChild:Mo.appendChildNode,insertBefore:Mo.insertBeforeNode,finalizeInitialChildren:(t,e,r,o)=>(t.internal_static&&(o.isStaticDirty=!0,o.staticNode=t),!1),supportsMutation:!0,appendChildToContainer:Mo.appendChildNode,insertInContainerBefore:Mo.insertBeforeNode,removeChildFromContainer:(t,e)=>{Mo.removeChildNode(t,e),uCe(e.yogaNode)},prepareUpdate:(t,e,r,o,a)=>{t.internal_static&&(a.isStaticDirty=!0);let n={},u=Object.keys(o);for(let A of u)if(o[A]!==r[A]){if(A==="style"&&typeof o.style=="object"&&typeof r.style=="object"){let h=o.style,E=r.style,I=Object.keys(h);for(let v of I){if(v==="borderStyle"||v==="borderColor"){if(typeof n.style!="object"){let b={};n.style=b}n.style.borderStyle=h.borderStyle,n.style.borderColor=h.borderColor}if(h[v]!==E[v]){if(typeof n.style!="object"){let b={};n.style=b}n.style[v]=h[v]}}continue}n[A]=o[A]}return n},commitUpdate:(t,e)=>{for(let[r,o]of Object.entries(e))r!=="children"&&(r==="style"?Mo.setStyle(t,o):r==="internal_transform"?t.internal_transform=o:r==="internal_static"?t.internal_static=!0:Mo.setAttribute(t,r,o))},commitTextUpdate:(t,e,r)=>{Mo.setTextNodeValue(t,r)},removeChild:(t,e)=>{Mo.removeChildNode(t,e),uCe(e.yogaNode)}})});var hCe=_((LVt,pCe)=>{"use strict";pCe.exports=(t,e=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(typeof r.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(e===0)return t;let o=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return t.replace(o,r.indent.repeat(e))}});var gCe=_(hB=>{"use strict";var bEt=hB&&hB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hB,"__esModule",{value:!0});var $k=bEt(om());hB.default=t=>t.getComputedWidth()-t.getComputedPadding($k.default.EDGE_LEFT)-t.getComputedPadding($k.default.EDGE_RIGHT)-t.getComputedBorder($k.default.EDGE_LEFT)-t.getComputedBorder($k.default.EDGE_RIGHT)});var dCe=_((OVt,kEt)=>{kEt.exports={single:{topLeft:"\u250C",topRight:"\u2510",bottomRight:"\u2518",bottomLeft:"\u2514",vertical:"\u2502",horizontal:"\u2500"},double:{topLeft:"\u2554",topRight:"\u2557",bottomRight:"\u255D",bottomLeft:"\u255A",vertical:"\u2551",horizontal:"\u2550"},round:{topLeft:"\u256D",topRight:"\u256E",bottomRight:"\u256F",bottomLeft:"\u2570",vertical:"\u2502",horizontal:"\u2500"},bold:{topLeft:"\u250F",topRight:"\u2513",bottomRight:"\u251B",bottomLeft:"\u2517",vertical:"\u2503",horizontal:"\u2501"},singleDouble:{topLeft:"\u2553",topRight:"\u2556",bottomRight:"\u255C",bottomLeft:"\u2559",vertical:"\u2551",horizontal:"\u2500"},doubleSingle:{topLeft:"\u2552",topRight:"\u2555",bottomRight:"\u255B",bottomLeft:"\u2558",vertical:"\u2502",horizontal:"\u2550"},classic:{topLeft:"+",topRight:"+",bottomRight:"+",bottomLeft:"+",vertical:"|",horizontal:"-"}}});var yCe=_((UVt,V6)=>{"use strict";var mCe=dCe();V6.exports=mCe;V6.exports.default=mCe});var CCe=_((_Vt,ECe)=>{"use strict";var QEt=(t,e,r)=>{let o=t.indexOf(e);if(o===-1)return t;let a=e.length,n=0,u="";do u+=t.substr(n,o-n)+e+r,n=o+a,o=t.indexOf(e,n);while(o!==-1);return u+=t.substr(n),u},FEt=(t,e,r,o)=>{let a=0,n="";do{let u=t[o-1]==="\r";n+=t.substr(a,(u?o-1:o)-a)+e+(u?`\r +`:` +`)+r,a=o+1,o=t.indexOf(` +`,a)}while(o!==-1);return n+=t.substr(a),n};ECe.exports={stringReplaceAll:QEt,stringEncaseCRLFWithFirstIndex:FEt}});var DCe=_((HVt,vCe)=>{"use strict";var TEt=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,wCe=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,REt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,NEt=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,LEt=new Map([["n",` +`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function BCe(t){let e=t[0]==="u",r=t[1]==="{";return e&&!r&&t.length===5||t[0]==="x"&&t.length===3?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):LEt.get(t)||t}function MEt(t,e){let r=[],o=e.trim().split(/\s*,\s*/g),a;for(let n of o){let u=Number(n);if(!Number.isNaN(u))r.push(u);else if(a=n.match(REt))r.push(a[2].replace(NEt,(A,p,h)=>p?BCe(p):h));else throw new Error(`Invalid Chalk template style argument: ${n} (in style '${t}')`)}return r}function OEt(t){wCe.lastIndex=0;let e=[],r;for(;(r=wCe.exec(t))!==null;){let o=r[1];if(r[2]){let a=MEt(o,r[2]);e.push([o].concat(a))}else e.push([o])}return e}function ICe(t,e){let r={};for(let a of e)for(let n of a.styles)r[n[0]]=a.inverse?null:n.slice(1);let o=t;for(let[a,n]of Object.entries(r))if(!!Array.isArray(n)){if(!(a in o))throw new Error(`Unknown Chalk style: ${a}`);o=n.length>0?o[a](...n):o[a]}return o}vCe.exports=(t,e)=>{let r=[],o=[],a=[];if(e.replace(TEt,(n,u,A,p,h,E)=>{if(u)a.push(BCe(u));else if(p){let I=a.join("");a=[],o.push(r.length===0?I:ICe(t,r)(I)),r.push({inverse:A,styles:OEt(p)})}else if(h){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");o.push(ICe(t,r)(a.join(""))),a=[],r.pop()}else a.push(E)}),o.push(a.join("")),r.length>0){let n=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(n)}return o.join("")}});var iQ=_((jVt,QCe)=>{"use strict";var gB=vI(),{stdout:J6,stderr:z6}=yN(),{stringReplaceAll:UEt,stringEncaseCRLFWithFirstIndex:_Et}=CCe(),{isArray:eQ}=Array,SCe=["ansi","ansi","ansi256","ansi16m"],_C=Object.create(null),HEt=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=J6?J6.level:0;t.level=e.level===void 0?r:e.level},X6=class{constructor(e){return xCe(e)}},xCe=t=>{let e={};return HEt(e,t),e.template=(...r)=>kCe(e.template,...r),Object.setPrototypeOf(e,tQ.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=X6,e.template};function tQ(t){return xCe(t)}for(let[t,e]of Object.entries(gB))_C[t]={get(){let r=rQ(this,Z6(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};_C.visible={get(){let t=rQ(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};var bCe=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let t of bCe)_C[t]={get(){let{level:e}=this;return function(...r){let o=Z6(gB.color[SCe[e]][t](...r),gB.color.close,this._styler);return rQ(this,o,this._isEmpty)}}};for(let t of bCe){let e="bg"+t[0].toUpperCase()+t.slice(1);_C[e]={get(){let{level:r}=this;return function(...o){let a=Z6(gB.bgColor[SCe[r]][t](...o),gB.bgColor.close,this._styler);return rQ(this,a,this._isEmpty)}}}}var jEt=Object.defineProperties(()=>{},{..._C,level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}}),Z6=(t,e,r)=>{let o,a;return r===void 0?(o=t,a=e):(o=r.openAll+t,a=e+r.closeAll),{open:t,close:e,openAll:o,closeAll:a,parent:r}},rQ=(t,e,r)=>{let o=(...a)=>eQ(a[0])&&eQ(a[0].raw)?PCe(o,kCe(o,...a)):PCe(o,a.length===1?""+a[0]:a.join(" "));return Object.setPrototypeOf(o,jEt),o._generator=t,o._styler=e,o._isEmpty=r,o},PCe=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;let{openAll:o,closeAll:a}=r;if(e.indexOf("\x1B")!==-1)for(;r!==void 0;)e=UEt(e,r.close,r.open),r=r.parent;let n=e.indexOf(` +`);return n!==-1&&(e=_Et(e,a,o,n)),o+e+a},K6,kCe=(t,...e)=>{let[r]=e;if(!eQ(r)||!eQ(r.raw))return e.join(" ");let o=e.slice(1),a=[r.raw[0]];for(let n=1;n{"use strict";var qEt=mB&&mB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mB,"__esModule",{value:!0});var dB=qEt(iQ()),GEt=/^(rgb|hsl|hsv|hwb)\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/,YEt=/^(ansi|ansi256)\(\s?(\d+)\s?\)$/,sQ=(t,e)=>e==="foreground"?t:"bg"+t[0].toUpperCase()+t.slice(1);mB.default=(t,e,r)=>{if(!e)return t;if(e in dB.default){let a=sQ(e,r);return dB.default[a](t)}if(e.startsWith("#")){let a=sQ("hex",r);return dB.default[a](e)(t)}if(e.startsWith("ansi")){let a=YEt.exec(e);if(!a)return t;let n=sQ(a[1],r),u=Number(a[2]);return dB.default[n](u)(t)}if(e.startsWith("rgb")||e.startsWith("hsl")||e.startsWith("hsv")||e.startsWith("hwb")){let a=GEt.exec(e);if(!a)return t;let n=sQ(a[1],r),u=Number(a[2]),A=Number(a[3]),p=Number(a[4]);return dB.default[n](u,A,p)(t)}return t}});var TCe=_(yB=>{"use strict";var FCe=yB&&yB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yB,"__esModule",{value:!0});var WEt=FCe(yCe()),ej=FCe($6());yB.default=(t,e,r,o)=>{if(typeof r.style.borderStyle=="string"){let a=r.yogaNode.getComputedWidth(),n=r.yogaNode.getComputedHeight(),u=r.style.borderColor,A=WEt.default[r.style.borderStyle],p=ej.default(A.topLeft+A.horizontal.repeat(a-2)+A.topRight,u,"foreground"),h=(ej.default(A.vertical,u,"foreground")+` +`).repeat(n-2),E=ej.default(A.bottomLeft+A.horizontal.repeat(a-2)+A.bottomRight,u,"foreground");o.write(t,e,p,{transformers:[]}),o.write(t,e+1,h,{transformers:[]}),o.write(t+a-1,e+1,h,{transformers:[]}),o.write(t,e+n-1,E,{transformers:[]})}}});var NCe=_(EB=>{"use strict";var am=EB&&EB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(EB,"__esModule",{value:!0});var VEt=am(om()),KEt=am(M6()),JEt=am(hCe()),zEt=am(q6()),XEt=am(gCe()),ZEt=am(Y6()),$Et=am(TCe()),eCt=(t,e)=>{var r;let o=(r=t.childNodes[0])===null||r===void 0?void 0:r.yogaNode;if(o){let a=o.getComputedLeft(),n=o.getComputedTop();e=` +`.repeat(n)+JEt.default(e,a)}return e},RCe=(t,e,r)=>{var o;let{offsetX:a=0,offsetY:n=0,transformers:u=[],skipStaticElements:A}=r;if(A&&t.internal_static)return;let{yogaNode:p}=t;if(p){if(p.getDisplay()===VEt.default.DISPLAY_NONE)return;let h=a+p.getComputedLeft(),E=n+p.getComputedTop(),I=u;if(typeof t.internal_transform=="function"&&(I=[t.internal_transform,...u]),t.nodeName==="ink-text"){let v=ZEt.default(t);if(v.length>0){let b=KEt.default(v),C=XEt.default(p);if(b>C){let T=(o=t.style.textWrap)!==null&&o!==void 0?o:"wrap";v=zEt.default(v,C,T)}v=eCt(t,v),e.write(h,E,v,{transformers:I})}return}if(t.nodeName==="ink-box"&&$Et.default(h,E,t,e),t.nodeName==="ink-root"||t.nodeName==="ink-box")for(let v of t.childNodes)RCe(v,e,{offsetX:h,offsetY:E,transformers:I,skipStaticElements:A})}};EB.default=RCe});var MCe=_((WVt,LCe)=>{"use strict";LCe.exports=t=>{t=Object.assign({onlyFirst:!1},t);let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t.onlyFirst?void 0:"g")}});var UCe=_((VVt,tj)=>{"use strict";var tCt=MCe(),OCe=t=>typeof t=="string"?t.replace(tCt(),""):t;tj.exports=OCe;tj.exports.default=OCe});var jCe=_((KVt,HCe)=>{"use strict";var _Ce="[\uD800-\uDBFF][\uDC00-\uDFFF]";HCe.exports=t=>t&&t.exact?new RegExp(`^${_Ce}$`):new RegExp(_Ce,"g")});var GCe=_((JVt,rj)=>{"use strict";var rCt=UCe(),nCt=jCe(),qCe=t=>rCt(t).replace(nCt()," ").length;rj.exports=qCe;rj.exports.default=qCe});var VCe=_(CB=>{"use strict";var WCe=CB&&CB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(CB,"__esModule",{value:!0});var YCe=WCe(H6()),iCt=WCe(GCe()),nj=class{constructor(e){this.writes=[];let{width:r,height:o}=e;this.width=r,this.height=o}write(e,r,o,a){let{transformers:n}=a;!o||this.writes.push({x:e,y:r,text:o,transformers:n})}get(){let e=[];for(let o=0;oo.trimRight()).join(` +`),height:e.length}}};CB.default=nj});var zCe=_(wB=>{"use strict";var ij=wB&&wB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wB,"__esModule",{value:!0});var sCt=ij(om()),KCe=ij(NCe()),JCe=ij(VCe());wB.default=(t,e)=>{var r;if(t.yogaNode.setWidth(e),t.yogaNode){t.yogaNode.calculateLayout(void 0,void 0,sCt.default.DIRECTION_LTR);let o=new JCe.default({width:t.yogaNode.getComputedWidth(),height:t.yogaNode.getComputedHeight()});KCe.default(t,o,{skipStaticElements:!0});let a;!((r=t.staticNode)===null||r===void 0)&&r.yogaNode&&(a=new JCe.default({width:t.staticNode.yogaNode.getComputedWidth(),height:t.staticNode.yogaNode.getComputedHeight()}),KCe.default(t.staticNode,a,{skipStaticElements:!1}));let{output:n,height:u}=o.get();return{output:n,outputHeight:u,staticOutput:a?`${a.get().output} +`:""}}return{output:"",outputHeight:0,staticOutput:""}}});var ewe=_((ZVt,$Ce)=>{"use strict";var XCe=Be("stream"),ZCe=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],sj={},oCt=t=>{let e=new XCe.PassThrough,r=new XCe.PassThrough;e.write=a=>t("stdout",a),r.write=a=>t("stderr",a);let o=new console.Console(e,r);for(let a of ZCe)sj[a]=console[a],console[a]=o[a];return()=>{for(let a of ZCe)console[a]=sj[a];sj={}}};$Ce.exports=oCt});var aj=_(oj=>{"use strict";Object.defineProperty(oj,"__esModule",{value:!0});oj.default=new WeakMap});var cj=_(lj=>{"use strict";Object.defineProperty(lj,"__esModule",{value:!0});var aCt=sn(),twe=aCt.createContext({exit:()=>{}});twe.displayName="InternalAppContext";lj.default=twe});var Aj=_(uj=>{"use strict";Object.defineProperty(uj,"__esModule",{value:!0});var lCt=sn(),rwe=lCt.createContext({stdin:void 0,setRawMode:()=>{},isRawModeSupported:!1,internal_exitOnCtrlC:!0});rwe.displayName="InternalStdinContext";uj.default=rwe});var pj=_(fj=>{"use strict";Object.defineProperty(fj,"__esModule",{value:!0});var cCt=sn(),nwe=cCt.createContext({stdout:void 0,write:()=>{}});nwe.displayName="InternalStdoutContext";fj.default=nwe});var gj=_(hj=>{"use strict";Object.defineProperty(hj,"__esModule",{value:!0});var uCt=sn(),iwe=uCt.createContext({stderr:void 0,write:()=>{}});iwe.displayName="InternalStderrContext";hj.default=iwe});var oQ=_(dj=>{"use strict";Object.defineProperty(dj,"__esModule",{value:!0});var ACt=sn(),swe=ACt.createContext({activeId:void 0,add:()=>{},remove:()=>{},activate:()=>{},deactivate:()=>{},enableFocus:()=>{},disableFocus:()=>{},focusNext:()=>{},focusPrevious:()=>{}});swe.displayName="InternalFocusContext";dj.default=swe});var awe=_((sKt,owe)=>{"use strict";var fCt=/[|\\{}()[\]^$+*?.-]/g;owe.exports=t=>{if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(fCt,"\\$&")}});var Awe=_((oKt,uwe)=>{"use strict";var pCt=awe(),hCt=typeof process=="object"&&process&&typeof process.cwd=="function"?process.cwd():".",cwe=[].concat(Be("module").builtinModules,"bootstrap_node","node").map(t=>new RegExp(`(?:\\((?:node:)?${t}(?:\\.js)?:\\d+:\\d+\\)$|^\\s*at (?:node:)?${t}(?:\\.js)?:\\d+:\\d+$)`));cwe.push(/\((?:node:)?internal\/[^:]+:\d+:\d+\)$/,/\s*at (?:node:)?internal\/[^:]+:\d+:\d+$/,/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);var IB=class{constructor(e){e={ignoredPackages:[],...e},"internals"in e||(e.internals=IB.nodeInternals()),"cwd"in e||(e.cwd=hCt),this._cwd=e.cwd.replace(/\\/g,"/"),this._internals=[].concat(e.internals,gCt(e.ignoredPackages)),this._wrapCallSite=e.wrapCallSite||!1}static nodeInternals(){return[...cwe]}clean(e,r=0){r=" ".repeat(r),Array.isArray(e)||(e=e.split(` +`)),!/^\s*at /.test(e[0])&&/^\s*at /.test(e[1])&&(e=e.slice(1));let o=!1,a=null,n=[];return e.forEach(u=>{if(u=u.replace(/\\/g,"/"),this._internals.some(p=>p.test(u)))return;let A=/^\s*at /.test(u);o?u=u.trimEnd().replace(/^(\s+)at /,"$1"):(u=u.trim(),A&&(u=u.slice(3))),u=u.replace(`${this._cwd}/`,""),u&&(A?(a&&(n.push(a),a=null),n.push(u)):(o=!0,a=u))}),n.map(u=>`${r}${u} +`).join("")}captureString(e,r=this.captureString){typeof e=="function"&&(r=e,e=1/0);let{stackTraceLimit:o}=Error;e&&(Error.stackTraceLimit=e);let a={};Error.captureStackTrace(a,r);let{stack:n}=a;return Error.stackTraceLimit=o,this.clean(n)}capture(e,r=this.capture){typeof e=="function"&&(r=e,e=1/0);let{prepareStackTrace:o,stackTraceLimit:a}=Error;Error.prepareStackTrace=(A,p)=>this._wrapCallSite?p.map(this._wrapCallSite):p,e&&(Error.stackTraceLimit=e);let n={};Error.captureStackTrace(n,r);let{stack:u}=n;return Object.assign(Error,{prepareStackTrace:o,stackTraceLimit:a}),u}at(e=this.at){let[r]=this.capture(1,e);if(!r)return{};let o={line:r.getLineNumber(),column:r.getColumnNumber()};lwe(o,r.getFileName(),this._cwd),r.isConstructor()&&(o.constructor=!0),r.isEval()&&(o.evalOrigin=r.getEvalOrigin()),r.isNative()&&(o.native=!0);let a;try{a=r.getTypeName()}catch{}a&&a!=="Object"&&a!=="[object Object]"&&(o.type=a);let n=r.getFunctionName();n&&(o.function=n);let u=r.getMethodName();return u&&n!==u&&(o.method=u),o}parseLine(e){let r=e&&e.match(dCt);if(!r)return null;let o=r[1]==="new",a=r[2],n=r[3],u=r[4],A=Number(r[5]),p=Number(r[6]),h=r[7],E=r[8],I=r[9],v=r[10]==="native",b=r[11]===")",C,T={};if(E&&(T.line=Number(E)),I&&(T.column=Number(I)),b&&h){let L=0;for(let U=h.length-1;U>0;U--)if(h.charAt(U)===")")L++;else if(h.charAt(U)==="("&&h.charAt(U-1)===" "&&(L--,L===-1&&h.charAt(U-1)===" ")){let J=h.slice(0,U-1);h=h.slice(U+1),a+=` (${J}`;break}}if(a){let L=a.match(mCt);L&&(a=L[1],C=L[2])}return lwe(T,h,this._cwd),o&&(T.constructor=!0),n&&(T.evalOrigin=n,T.evalLine=A,T.evalColumn=p,T.evalFile=u&&u.replace(/\\/g,"/")),v&&(T.native=!0),a&&(T.function=a),C&&a!==C&&(T.method=C),T}};function lwe(t,e,r){e&&(e=e.replace(/\\/g,"/"),e.startsWith(`${r}/`)&&(e=e.slice(r.length+1)),t.file=e)}function gCt(t){if(t.length===0)return[];let e=t.map(r=>pCt(r));return new RegExp(`[/\\\\]node_modules[/\\\\](?:${e.join("|")})[/\\\\][^:]+:\\d+:\\d+`)}var dCt=new RegExp("^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"),mCt=/^(.*?) \[as (.*?)\]$/;uwe.exports=IB});var pwe=_((aKt,fwe)=>{"use strict";fwe.exports=(t,e)=>t.replace(/^\t+/gm,r=>" ".repeat(r.length*(e||2)))});var gwe=_((lKt,hwe)=>{"use strict";var yCt=pwe(),ECt=(t,e)=>{let r=[],o=t-e,a=t+e;for(let n=o;n<=a;n++)r.push(n);return r};hwe.exports=(t,e,r)=>{if(typeof t!="string")throw new TypeError("Source code is missing.");if(!e||e<1)throw new TypeError("Line number must start from `1`.");if(t=yCt(t).split(/\r?\n/),!(e>t.length))return r={around:3,...r},ECt(e,r.around).filter(o=>t[o-1]!==void 0).map(o=>({line:o,value:t[o-1]}))}});var aQ=_(ru=>{"use strict";var CCt=ru&&ru.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),wCt=ru&&ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ICt=ru&&ru.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&CCt(e,t,r);return wCt(e,t),e},BCt=ru&&ru.__rest||function(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(t);a{var{children:r}=t,o=BCt(t,["children"]);let a=Object.assign(Object.assign({},o),{marginLeft:o.marginLeft||o.marginX||o.margin||0,marginRight:o.marginRight||o.marginX||o.margin||0,marginTop:o.marginTop||o.marginY||o.margin||0,marginBottom:o.marginBottom||o.marginY||o.margin||0,paddingLeft:o.paddingLeft||o.paddingX||o.padding||0,paddingRight:o.paddingRight||o.paddingX||o.padding||0,paddingTop:o.paddingTop||o.paddingY||o.padding||0,paddingBottom:o.paddingBottom||o.paddingY||o.padding||0});return dwe.default.createElement("ink-box",{ref:e,style:a},r)});mj.displayName="Box";mj.defaultProps={flexDirection:"row",flexGrow:0,flexShrink:1};ru.default=mj});var Cj=_(BB=>{"use strict";var yj=BB&&BB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(BB,"__esModule",{value:!0});var vCt=yj(sn()),HC=yj(iQ()),mwe=yj($6()),Ej=({color:t,backgroundColor:e,dimColor:r,bold:o,italic:a,underline:n,strikethrough:u,inverse:A,wrap:p,children:h})=>{if(h==null)return null;let E=I=>(r&&(I=HC.default.dim(I)),t&&(I=mwe.default(I,t,"foreground")),e&&(I=mwe.default(I,e,"background")),o&&(I=HC.default.bold(I)),a&&(I=HC.default.italic(I)),n&&(I=HC.default.underline(I)),u&&(I=HC.default.strikethrough(I)),A&&(I=HC.default.inverse(I)),I);return vCt.default.createElement("ink-text",{style:{flexGrow:0,flexShrink:1,flexDirection:"row",textWrap:p},internal_transform:E},h)};Ej.displayName="Text";Ej.defaultProps={dimColor:!1,bold:!1,italic:!1,underline:!1,strikethrough:!1,wrap:"wrap"};BB.default=Ej});var wwe=_(nu=>{"use strict";var DCt=nu&&nu.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),PCt=nu&&nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SCt=nu&&nu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&DCt(e,t,r);return PCt(e,t),e},vB=nu&&nu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(nu,"__esModule",{value:!0});var ywe=SCt(Be("fs")),fs=vB(sn()),Ewe=vB(Awe()),xCt=vB(gwe()),Xf=vB(aQ()),hA=vB(Cj()),Cwe=new Ewe.default({cwd:process.cwd(),internals:Ewe.default.nodeInternals()}),bCt=({error:t})=>{let e=t.stack?t.stack.split(` +`).slice(1):void 0,r=e?Cwe.parseLine(e[0]):void 0,o,a=0;if(r?.file&&r?.line&&ywe.existsSync(r.file)){let n=ywe.readFileSync(r.file,"utf8");if(o=xCt.default(n,r.line),o)for(let{line:u}of o)a=Math.max(a,String(u).length)}return fs.default.createElement(Xf.default,{flexDirection:"column",padding:1},fs.default.createElement(Xf.default,null,fs.default.createElement(hA.default,{backgroundColor:"red",color:"white"}," ","ERROR"," "),fs.default.createElement(hA.default,null," ",t.message)),r&&fs.default.createElement(Xf.default,{marginTop:1},fs.default.createElement(hA.default,{dimColor:!0},r.file,":",r.line,":",r.column)),r&&o&&fs.default.createElement(Xf.default,{marginTop:1,flexDirection:"column"},o.map(({line:n,value:u})=>fs.default.createElement(Xf.default,{key:n},fs.default.createElement(Xf.default,{width:a+1},fs.default.createElement(hA.default,{dimColor:n!==r.line,backgroundColor:n===r.line?"red":void 0,color:n===r.line?"white":void 0},String(n).padStart(a," "),":")),fs.default.createElement(hA.default,{key:n,backgroundColor:n===r.line?"red":void 0,color:n===r.line?"white":void 0}," "+u)))),t.stack&&fs.default.createElement(Xf.default,{marginTop:1,flexDirection:"column"},t.stack.split(` +`).slice(1).map(n=>{let u=Cwe.parseLine(n);return u?fs.default.createElement(Xf.default,{key:n},fs.default.createElement(hA.default,{dimColor:!0},"- "),fs.default.createElement(hA.default,{dimColor:!0,bold:!0},u.function),fs.default.createElement(hA.default,{dimColor:!0,color:"gray"}," ","(",u.file,":",u.line,":",u.column,")")):fs.default.createElement(Xf.default,{key:n},fs.default.createElement(hA.default,{dimColor:!0},"- "),fs.default.createElement(hA.default,{dimColor:!0,bold:!0},n))})))};nu.default=bCt});var Bwe=_(iu=>{"use strict";var kCt=iu&&iu.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),QCt=iu&&iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FCt=iu&&iu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&kCt(e,t,r);return QCt(e,t),e},cm=iu&&iu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(iu,"__esModule",{value:!0});var lm=FCt(sn()),Iwe=cm(m6()),TCt=cm(cj()),RCt=cm(Aj()),NCt=cm(pj()),LCt=cm(gj()),MCt=cm(oQ()),OCt=cm(wwe()),UCt=" ",_Ct="\x1B[Z",HCt="\x1B",lQ=class extends lm.PureComponent{constructor(){super(...arguments),this.state={isFocusEnabled:!0,activeFocusId:void 0,focusables:[],error:void 0},this.rawModeEnabledCount=0,this.handleSetRawMode=e=>{let{stdin:r}=this.props;if(!this.isRawModeSupported())throw r===process.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default. +Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink. +Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(r.setEncoding("utf8"),e){this.rawModeEnabledCount===0&&(r.addListener("data",this.handleInput),r.resume(),r.setRawMode(!0)),this.rawModeEnabledCount++;return}--this.rawModeEnabledCount===0&&(r.setRawMode(!1),r.removeListener("data",this.handleInput),r.pause())},this.handleInput=e=>{e===""&&this.props.exitOnCtrlC&&this.handleExit(),e===HCt&&this.state.activeFocusId&&this.setState({activeFocusId:void 0}),this.state.isFocusEnabled&&this.state.focusables.length>0&&(e===UCt&&this.focusNext(),e===_Ct&&this.focusPrevious())},this.handleExit=e=>{this.isRawModeSupported()&&this.handleSetRawMode(!1),this.props.onExit(e)},this.enableFocus=()=>{this.setState({isFocusEnabled:!0})},this.disableFocus=()=>{this.setState({isFocusEnabled:!1})},this.focusNext=()=>{this.setState(e=>{let r=e.focusables[0].id;return{activeFocusId:this.findNextFocusable(e)||r}})},this.focusPrevious=()=>{this.setState(e=>{let r=e.focusables[e.focusables.length-1].id;return{activeFocusId:this.findPreviousFocusable(e)||r}})},this.addFocusable=(e,{autoFocus:r})=>{this.setState(o=>{let a=o.activeFocusId;return!a&&r&&(a=e),{activeFocusId:a,focusables:[...o.focusables,{id:e,isActive:!0}]}})},this.removeFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.filter(o=>o.id!==e)}))},this.activateFocusable=e=>{this.setState(r=>({focusables:r.focusables.map(o=>o.id!==e?o:{id:e,isActive:!0})}))},this.deactivateFocusable=e=>{this.setState(r=>({activeFocusId:r.activeFocusId===e?void 0:r.activeFocusId,focusables:r.focusables.map(o=>o.id!==e?o:{id:e,isActive:!1})}))},this.findNextFocusable=e=>{let r=e.focusables.findIndex(o=>o.id===e.activeFocusId);for(let o=r+1;o{let r=e.focusables.findIndex(o=>o.id===e.activeFocusId);for(let o=r-1;o>=0;o--)if(e.focusables[o].isActive)return e.focusables[o].id}}static getDerivedStateFromError(e){return{error:e}}isRawModeSupported(){return this.props.stdin.isTTY}render(){return lm.default.createElement(TCt.default.Provider,{value:{exit:this.handleExit}},lm.default.createElement(RCt.default.Provider,{value:{stdin:this.props.stdin,setRawMode:this.handleSetRawMode,isRawModeSupported:this.isRawModeSupported(),internal_exitOnCtrlC:this.props.exitOnCtrlC}},lm.default.createElement(NCt.default.Provider,{value:{stdout:this.props.stdout,write:this.props.writeToStdout}},lm.default.createElement(LCt.default.Provider,{value:{stderr:this.props.stderr,write:this.props.writeToStderr}},lm.default.createElement(MCt.default.Provider,{value:{activeId:this.state.activeFocusId,add:this.addFocusable,remove:this.removeFocusable,activate:this.activateFocusable,deactivate:this.deactivateFocusable,enableFocus:this.enableFocus,disableFocus:this.disableFocus,focusNext:this.focusNext,focusPrevious:this.focusPrevious}},this.state.error?lm.default.createElement(OCt.default,{error:this.state.error}):this.props.children)))))}componentDidMount(){Iwe.default.hide(this.props.stdout)}componentWillUnmount(){Iwe.default.show(this.props.stdout),this.isRawModeSupported()&&this.handleSetRawMode(!1)}componentDidCatch(e){this.handleExit(e)}};iu.default=lQ;lQ.displayName="InternalApp"});var Pwe=_(su=>{"use strict";var jCt=su&&su.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),qCt=su&&su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GCt=su&&su.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&jCt(e,t,r);return qCt(e,t),e},ou=su&&su.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(su,"__esModule",{value:!0});var YCt=ou(sn()),vwe=uO(),WCt=ou(AEe()),VCt=ou(f6()),KCt=ou(mEe()),JCt=ou(EEe()),wj=ou(fCe()),zCt=ou(zCe()),XCt=ou(d6()),ZCt=ou(ewe()),$Ct=GCt(W6()),ewt=ou(aj()),twt=ou(Bwe()),jC=process.env.CI==="false"?!1:KCt.default,Dwe=()=>{},Ij=class{constructor(e){this.resolveExitPromise=()=>{},this.rejectExitPromise=()=>{},this.unsubscribeExit=()=>{},this.onRender=()=>{if(this.isUnmounted)return;let{output:r,outputHeight:o,staticOutput:a}=zCt.default(this.rootNode,this.options.stdout.columns||80),n=a&&a!==` +`;if(this.options.debug){n&&(this.fullStaticOutput+=a),this.options.stdout.write(this.fullStaticOutput+r);return}if(jC){n&&this.options.stdout.write(a),this.lastOutput=r;return}if(n&&(this.fullStaticOutput+=a),o>=this.options.stdout.rows){this.options.stdout.write(VCt.default.clearTerminal+this.fullStaticOutput+r),this.lastOutput=r;return}n&&(this.log.clear(),this.options.stdout.write(a),this.log(r)),!n&&r!==this.lastOutput&&this.throttledLog(r),this.lastOutput=r},JCt.default(this),this.options=e,this.rootNode=$Ct.createNode("ink-root"),this.rootNode.onRender=e.debug?this.onRender:vwe(this.onRender,32,{leading:!0,trailing:!0}),this.rootNode.onImmediateRender=this.onRender,this.log=WCt.default.create(e.stdout),this.throttledLog=e.debug?this.log:vwe(this.log,void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.lastOutput="",this.fullStaticOutput="",this.container=wj.default.createContainer(this.rootNode,!1,!1),this.unsubscribeExit=XCt.default(this.unmount,{alwaysLast:!1}),e.patchConsole&&this.patchConsole(),jC||(e.stdout.on("resize",this.onRender),this.unsubscribeResize=()=>{e.stdout.off("resize",this.onRender)})}render(e){let r=YCt.default.createElement(twt.default,{stdin:this.options.stdin,stdout:this.options.stdout,stderr:this.options.stderr,writeToStdout:this.writeToStdout,writeToStderr:this.writeToStderr,exitOnCtrlC:this.options.exitOnCtrlC,onExit:this.unmount},e);wj.default.updateContainer(r,this.container,null,Dwe)}writeToStdout(e){if(!this.isUnmounted){if(this.options.debug){this.options.stdout.write(e+this.fullStaticOutput+this.lastOutput);return}if(jC){this.options.stdout.write(e);return}this.log.clear(),this.options.stdout.write(e),this.log(this.lastOutput)}}writeToStderr(e){if(!this.isUnmounted){if(this.options.debug){this.options.stderr.write(e),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(jC){this.options.stderr.write(e);return}this.log.clear(),this.options.stderr.write(e),this.log(this.lastOutput)}}unmount(e){this.isUnmounted||(this.onRender(),this.unsubscribeExit(),typeof this.restoreConsole=="function"&&this.restoreConsole(),typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),jC?this.options.stdout.write(this.lastOutput+` +`):this.options.debug||this.log.done(),this.isUnmounted=!0,wj.default.updateContainer(null,this.container,null,Dwe),ewt.default.delete(this.options.stdout),e instanceof Error?this.rejectExitPromise(e):this.resolveExitPromise())}waitUntilExit(){return this.exitPromise||(this.exitPromise=new Promise((e,r)=>{this.resolveExitPromise=e,this.rejectExitPromise=r})),this.exitPromise}clear(){!jC&&!this.options.debug&&this.log.clear()}patchConsole(){this.options.debug||(this.restoreConsole=ZCt.default((e,r)=>{e==="stdout"&&this.writeToStdout(r),e==="stderr"&&(r.startsWith("The above error occurred")||this.writeToStderr(r))}))}};su.default=Ij});var xwe=_(DB=>{"use strict";var Swe=DB&&DB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(DB,"__esModule",{value:!0});var rwt=Swe(Pwe()),cQ=Swe(aj()),nwt=Be("stream"),iwt=(t,e)=>{let r=Object.assign({stdout:process.stdout,stdin:process.stdin,stderr:process.stderr,debug:!1,exitOnCtrlC:!0,patchConsole:!0},swt(e)),o=owt(r.stdout,()=>new rwt.default(r));return o.render(t),{rerender:o.render,unmount:()=>o.unmount(),waitUntilExit:o.waitUntilExit,cleanup:()=>cQ.default.delete(r.stdout),clear:o.clear}};DB.default=iwt;var swt=(t={})=>t instanceof nwt.Stream?{stdout:t,stdin:process.stdin}:t,owt=(t,e)=>{let r;return cQ.default.has(t)?r=cQ.default.get(t):(r=e(),cQ.default.set(t,r)),r}});var kwe=_(Zf=>{"use strict";var awt=Zf&&Zf.__createBinding||(Object.create?function(t,e,r,o){o===void 0&&(o=r),Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,o){o===void 0&&(o=r),t[o]=e[r]}),lwt=Zf&&Zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cwt=Zf&&Zf.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&awt(e,t,r);return lwt(e,t),e};Object.defineProperty(Zf,"__esModule",{value:!0});var PB=cwt(sn()),bwe=t=>{let{items:e,children:r,style:o}=t,[a,n]=PB.useState(0),u=PB.useMemo(()=>e.slice(a),[e,a]);PB.useLayoutEffect(()=>{n(e.length)},[e.length]);let A=u.map((h,E)=>r(h,a+E)),p=PB.useMemo(()=>Object.assign({position:"absolute",flexDirection:"column"},o),[o]);return PB.default.createElement("ink-box",{internal_static:!0,style:p},A)};bwe.displayName="Static";Zf.default=bwe});var Fwe=_(SB=>{"use strict";var uwt=SB&&SB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(SB,"__esModule",{value:!0});var Awt=uwt(sn()),Qwe=({children:t,transform:e})=>t==null?null:Awt.default.createElement("ink-text",{style:{flexGrow:0,flexShrink:1,flexDirection:"row"},internal_transform:e},t);Qwe.displayName="Transform";SB.default=Qwe});var Rwe=_(xB=>{"use strict";var fwt=xB&&xB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xB,"__esModule",{value:!0});var pwt=fwt(sn()),Twe=({count:t=1})=>pwt.default.createElement("ink-text",null,` +`.repeat(t));Twe.displayName="Newline";xB.default=Twe});var Mwe=_(bB=>{"use strict";var Nwe=bB&&bB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bB,"__esModule",{value:!0});var hwt=Nwe(sn()),gwt=Nwe(aQ()),Lwe=()=>hwt.default.createElement(gwt.default,{flexGrow:1});Lwe.displayName="Spacer";bB.default=Lwe});var uQ=_(kB=>{"use strict";var dwt=kB&&kB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kB,"__esModule",{value:!0});var mwt=sn(),ywt=dwt(Aj()),Ewt=()=>mwt.useContext(ywt.default);kB.default=Ewt});var Uwe=_(QB=>{"use strict";var Cwt=QB&&QB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(QB,"__esModule",{value:!0});var Owe=sn(),wwt=Cwt(uQ()),Iwt=(t,e={})=>{let{stdin:r,setRawMode:o,internal_exitOnCtrlC:a}=wwt.default();Owe.useEffect(()=>{if(e.isActive!==!1)return o(!0),()=>{o(!1)}},[e.isActive,o]),Owe.useEffect(()=>{if(e.isActive===!1)return;let n=u=>{let A=String(u),p={upArrow:A==="\x1B[A",downArrow:A==="\x1B[B",leftArrow:A==="\x1B[D",rightArrow:A==="\x1B[C",pageDown:A==="\x1B[6~",pageUp:A==="\x1B[5~",return:A==="\r",escape:A==="\x1B",ctrl:!1,shift:!1,tab:A===" "||A==="\x1B[Z",backspace:A==="\b",delete:A==="\x7F"||A==="\x1B[3~",meta:!1};A<=""&&!p.return&&(A=String.fromCharCode(A.charCodeAt(0)+"a".charCodeAt(0)-1),p.ctrl=!0),A.startsWith("\x1B")&&(A=A.slice(1),p.meta=!0);let h=A>="A"&&A<="Z",E=A>="\u0410"&&A<="\u042F";A.length===1&&(h||E)&&(p.shift=!0),p.tab&&A==="[Z"&&(p.shift=!0),(p.tab||p.backspace||p.delete)&&(A=""),(!(A==="c"&&p.ctrl)||!a)&&t(A,p)};return r?.on("data",n),()=>{r?.off("data",n)}},[e.isActive,r,a,t])};QB.default=Iwt});var _we=_(FB=>{"use strict";var Bwt=FB&&FB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(FB,"__esModule",{value:!0});var vwt=sn(),Dwt=Bwt(cj()),Pwt=()=>vwt.useContext(Dwt.default);FB.default=Pwt});var Hwe=_(TB=>{"use strict";var Swt=TB&&TB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(TB,"__esModule",{value:!0});var xwt=sn(),bwt=Swt(pj()),kwt=()=>xwt.useContext(bwt.default);TB.default=kwt});var jwe=_(RB=>{"use strict";var Qwt=RB&&RB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(RB,"__esModule",{value:!0});var Fwt=sn(),Twt=Qwt(gj()),Rwt=()=>Fwt.useContext(Twt.default);RB.default=Rwt});var Gwe=_(LB=>{"use strict";var qwe=LB&&LB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(LB,"__esModule",{value:!0});var NB=sn(),Nwt=qwe(oQ()),Lwt=qwe(uQ()),Mwt=({isActive:t=!0,autoFocus:e=!1}={})=>{let{isRawModeSupported:r,setRawMode:o}=Lwt.default(),{activeId:a,add:n,remove:u,activate:A,deactivate:p}=NB.useContext(Nwt.default),h=NB.useMemo(()=>Math.random().toString().slice(2,7),[]);return NB.useEffect(()=>(n(h,{autoFocus:e}),()=>{u(h)}),[h,e]),NB.useEffect(()=>{t?A(h):p(h)},[t,h]),NB.useEffect(()=>{if(!(!r||!t))return o(!0),()=>{o(!1)}},[t]),{isFocused:Boolean(h)&&a===h}};LB.default=Mwt});var Ywe=_(MB=>{"use strict";var Owt=MB&&MB.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(MB,"__esModule",{value:!0});var Uwt=sn(),_wt=Owt(oQ()),Hwt=()=>{let t=Uwt.useContext(_wt.default);return{enableFocus:t.enableFocus,disableFocus:t.disableFocus,focusNext:t.focusNext,focusPrevious:t.focusPrevious}};MB.default=Hwt});var Wwe=_(Bj=>{"use strict";Object.defineProperty(Bj,"__esModule",{value:!0});Bj.default=t=>{var e,r,o,a;return{width:(r=(e=t.yogaNode)===null||e===void 0?void 0:e.getComputedWidth())!==null&&r!==void 0?r:0,height:(a=(o=t.yogaNode)===null||o===void 0?void 0:o.getComputedHeight())!==null&&a!==void 0?a:0}}});var ic=_(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});var jwt=xwe();Object.defineProperty(ro,"render",{enumerable:!0,get:function(){return jwt.default}});var qwt=aQ();Object.defineProperty(ro,"Box",{enumerable:!0,get:function(){return qwt.default}});var Gwt=Cj();Object.defineProperty(ro,"Text",{enumerable:!0,get:function(){return Gwt.default}});var Ywt=kwe();Object.defineProperty(ro,"Static",{enumerable:!0,get:function(){return Ywt.default}});var Wwt=Fwe();Object.defineProperty(ro,"Transform",{enumerable:!0,get:function(){return Wwt.default}});var Vwt=Rwe();Object.defineProperty(ro,"Newline",{enumerable:!0,get:function(){return Vwt.default}});var Kwt=Mwe();Object.defineProperty(ro,"Spacer",{enumerable:!0,get:function(){return Kwt.default}});var Jwt=Uwe();Object.defineProperty(ro,"useInput",{enumerable:!0,get:function(){return Jwt.default}});var zwt=_we();Object.defineProperty(ro,"useApp",{enumerable:!0,get:function(){return zwt.default}});var Xwt=uQ();Object.defineProperty(ro,"useStdin",{enumerable:!0,get:function(){return Xwt.default}});var Zwt=Hwe();Object.defineProperty(ro,"useStdout",{enumerable:!0,get:function(){return Zwt.default}});var $wt=jwe();Object.defineProperty(ro,"useStderr",{enumerable:!0,get:function(){return $wt.default}});var eIt=Gwe();Object.defineProperty(ro,"useFocus",{enumerable:!0,get:function(){return eIt.default}});var tIt=Ywe();Object.defineProperty(ro,"useFocusManager",{enumerable:!0,get:function(){return tIt.default}});var rIt=Wwe();Object.defineProperty(ro,"measureElement",{enumerable:!0,get:function(){return rIt.default}})});var Dj={};Kt(Dj,{Gem:()=>vj});var Vwe,um,vj,AQ=Et(()=>{Vwe=$e(ic()),um=$e(sn()),vj=(0,um.memo)(({active:t})=>{let e=(0,um.useMemo)(()=>t?"\u25C9":"\u25EF",[t]),r=(0,um.useMemo)(()=>t?"green":"yellow",[t]);return um.default.createElement(Vwe.Text,{color:r},e)})});var Jwe={};Kt(Jwe,{useKeypress:()=>Am});function Am({active:t},e,r){let{stdin:o}=(0,Kwe.useStdin)(),a=(0,fQ.useCallback)((n,u)=>e(n,u),r);(0,fQ.useEffect)(()=>{if(!(!t||!o))return o.on("keypress",a),()=>{o.off("keypress",a)}},[t,a,o])}var Kwe,fQ,OB=Et(()=>{Kwe=$e(ic()),fQ=$e(sn())});var Xwe={};Kt(Xwe,{FocusRequest:()=>zwe,useFocusRequest:()=>Pj});var zwe,Pj,Sj=Et(()=>{OB();zwe=(r=>(r.BEFORE="before",r.AFTER="after",r))(zwe||{}),Pj=function({active:t},e,r){Am({active:t},(o,a)=>{a.name==="tab"&&(a.shift?e("before"):e("after"))},r)}});var Zwe={};Kt(Zwe,{useListInput:()=>UB});var UB,pQ=Et(()=>{OB();UB=function(t,e,{active:r,minus:o,plus:a,set:n,loop:u=!0}){Am({active:r},(A,p)=>{let h=e.indexOf(t);switch(p.name){case o:{let E=h-1;if(u){n(e[(e.length+E)%e.length]);return}if(E<0)return;n(e[E])}break;case a:{let E=h+1;if(u){n(e[E%e.length]);return}if(E>=e.length)return;n(e[E])}break}},[e,t,a,n,u])}});var hQ={};Kt(hQ,{ScrollableItems:()=>nIt});var E0,La,nIt,gQ=Et(()=>{E0=$e(ic()),La=$e(sn());Sj();pQ();nIt=({active:t=!0,children:e=[],radius:r=10,size:o=1,loop:a=!0,onFocusRequest:n,willReachEnd:u})=>{let A=L=>{if(L.key===null)throw new Error("Expected all children to have a key");return L.key},p=La.default.Children.map(e,L=>A(L)),h=p[0],[E,I]=(0,La.useState)(h),v=p.indexOf(E);(0,La.useEffect)(()=>{p.includes(E)||I(h)},[e]),(0,La.useEffect)(()=>{u&&v>=p.length-2&&u()},[v]),Pj({active:t&&!!n},L=>{n?.(L)},[n]),UB(E,p,{active:t,minus:"up",plus:"down",set:I,loop:a});let b=v-r,C=v+r;C>p.length&&(b-=C-p.length,C=p.length),b<0&&(C+=-b,b=0),C>=p.length&&(C=p.length-1);let T=[];for(let L=b;L<=C;++L){let U=p[L],J=t&&U===E;T.push(La.default.createElement(E0.Box,{key:U,height:o},La.default.createElement(E0.Box,{marginLeft:1,marginRight:1},La.default.createElement(E0.Text,null,J?La.default.createElement(E0.Text,{color:"cyan",bold:!0},">"):" ")),La.default.createElement(E0.Box,null,La.default.cloneElement(e[L],{active:J}))))}return La.default.createElement(E0.Box,{flexDirection:"column",width:"100%"},T)}});var $we,$f,eIe,xj,tIe,bj=Et(()=>{$we=$e(ic()),$f=$e(sn()),eIe=Be("readline"),xj=$f.default.createContext(null),tIe=({children:t})=>{let{stdin:e,setRawMode:r}=(0,$we.useStdin)();(0,$f.useEffect)(()=>{r&&r(!0),e&&(0,eIe.emitKeypressEvents)(e)},[e,r]);let[o,a]=(0,$f.useState)(new Map),n=(0,$f.useMemo)(()=>({getAll:()=>o,get:u=>o.get(u),set:(u,A)=>a(new Map([...o,[u,A]]))}),[o,a]);return $f.default.createElement(xj.Provider,{value:n,children:t})}});var kj={};Kt(kj,{useMinistore:()=>iIt});function iIt(t,e){let r=(0,dQ.useContext)(xj);if(r===null)throw new Error("Expected this hook to run with a ministore context attached");if(typeof t>"u")return r.getAll();let o=(0,dQ.useCallback)(n=>{r.set(t,n)},[t,r.set]),a=r.get(t);return typeof a>"u"&&(a=e),[a,o]}var dQ,Qj=Et(()=>{dQ=$e(sn());bj()});var yQ={};Kt(yQ,{renderForm:()=>sIt});async function sIt(t,e,{stdin:r,stdout:o,stderr:a}){let n,u=p=>{let{exit:h}=(0,mQ.useApp)();Am({active:!0},(E,I)=>{I.name==="return"&&(n=p,h())},[h,p])},{waitUntilExit:A}=(0,mQ.render)(Fj.default.createElement(tIe,null,Fj.default.createElement(t,{...e,useSubmit:u})),{stdin:r,stdout:o,stderr:a});return await A(),n}var mQ,Fj,EQ=Et(()=>{mQ=$e(ic()),Fj=$e(sn());bj();OB()});var sIe=_(_B=>{"use strict";Object.defineProperty(_B,"__esModule",{value:!0});_B.UncontrolledTextInput=void 0;var nIe=sn(),Tj=sn(),rIe=ic(),fm=iQ(),iIe=({value:t,placeholder:e="",focus:r=!0,mask:o,highlightPastedText:a=!1,showCursor:n=!0,onChange:u,onSubmit:A})=>{let[{cursorOffset:p,cursorWidth:h},E]=Tj.useState({cursorOffset:(t||"").length,cursorWidth:0});Tj.useEffect(()=>{E(T=>{if(!r||!n)return T;let L=t||"";return T.cursorOffset>L.length-1?{cursorOffset:L.length,cursorWidth:0}:T})},[t,r,n]);let I=a?h:0,v=o?o.repeat(t.length):t,b=v,C=e?fm.grey(e):void 0;if(n&&r){C=e.length>0?fm.inverse(e[0])+fm.grey(e.slice(1)):fm.inverse(" "),b=v.length>0?"":fm.inverse(" ");let T=0;for(let L of v)T>=p-I&&T<=p?b+=fm.inverse(L):b+=L,T++;v.length>0&&p===v.length&&(b+=fm.inverse(" "))}return rIe.useInput((T,L)=>{if(L.upArrow||L.downArrow||L.ctrl&&T==="c"||L.tab||L.shift&&L.tab)return;if(L.return){A&&A(t);return}let U=p,J=t,te=0;L.leftArrow?n&&U--:L.rightArrow?n&&U++:L.backspace||L.delete?p>0&&(J=t.slice(0,p-1)+t.slice(p,t.length),U--):(J=t.slice(0,p)+T+t.slice(p,t.length),U+=T.length,T.length>1&&(te=T.length)),p<0&&(U=0),p>t.length&&(U=t.length),E({cursorOffset:U,cursorWidth:te}),J!==t&&u(J)},{isActive:r}),nIe.createElement(rIe.Text,null,e?v.length>0?b:C:b)};_B.default=iIe;_B.UncontrolledTextInput=t=>{let[e,r]=Tj.useState("");return nIe.createElement(iIe,Object.assign({},t,{value:e,onChange:r}))}});var lIe={};Kt(lIe,{Pad:()=>Rj});var oIe,aIe,Rj,Nj=Et(()=>{oIe=$e(ic()),aIe=$e(sn()),Rj=({length:t,active:e})=>{if(t===0)return null;let r=t>1?` ${"-".repeat(t-1)}`:" ";return aIe.default.createElement(oIe.Text,{dimColor:!e},r)}});var cIe={};Kt(cIe,{ItemOptions:()=>oIt});var jB,w0,oIt,uIe=Et(()=>{jB=$e(ic()),w0=$e(sn());pQ();AQ();Nj();oIt=function({active:t,skewer:e,options:r,value:o,onChange:a,sizes:n=[]}){let u=r.filter(({label:p})=>!!p).map(({value:p})=>p),A=r.findIndex(p=>p.value===o&&p.label!="");return UB(o,u,{active:t,minus:"left",plus:"right",set:a}),w0.default.createElement(w0.default.Fragment,null,r.map(({label:p},h)=>{let E=h===A,I=n[h]-1||0,v=p.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,""),b=Math.max(0,I-v.length-2);return p?w0.default.createElement(jB.Box,{key:p,width:I,marginLeft:1},w0.default.createElement(jB.Text,{wrap:"truncate"},w0.default.createElement(vj,{active:E})," ",p),e?w0.default.createElement(Rj,{active:t,length:b}):null):w0.default.createElement(jB.Box,{key:`spacer-${h}`,width:I,marginLeft:1})}))}});var PIe=_((zJt,DIe)=>{var Gj;DIe.exports=()=>(typeof Gj>"u"&&(Gj=Be("zlib").brotliDecompressSync(Buffer.from("W7N0VsO4vY64HWDyXqed+oAyZJiyif46DqkVeS70D7uBnPuR2kjnWVorAtyjDFXVvATfM+Tuqr1+1bYAIEUNta6ugea03UJD4TsodKjGeUw/bGGX6mhltUQrTQIbJEj0XK5lyMNud6t6GAbPXF6Urk5rakLjbZ+5ve/P+mnVIwyyz39xSCEMtNeaHeUXus5lJMLIZm3xMYCOW39JEISQMya1gqvZY3yMrzHNIF4o/YdN9W1/XoeiNhLjznRsSvd8IcYOHpiZUeHCvzU1bBH0kv5jZc2tNMJjZXTDS4O3iNP5GVWLhORyhwLWVqqDSpJIKDSanski+rpbTfPvz+tQCsLXpKWE7BWSyavV16ZowXC3rhob0tYTq6X6eiM3RoxSvoyWSynddpITuOAm3FLF/lLfey4nuuOu6XYTEImeQeJJ2BkdSrrW35e/V/vPz9f26dV0LXece4qZejCYPG1Tg9u7MIxEQMFqCOIQzpWbw9fWN2WbUzvJcGlf37TTrAKEBLeZ+wKOIBS+35z+lBmB8N0skCzkbmn2fkp/eK1ZPb87zSWfQJ2NG9DcyC9dMcHekDz98qf59at0mMjcpTSc5tTCOenuC6RIz5q3ewZuBkvVsv+m4kdbNh3Lm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gSO4lL8von+z/aomZh46kuiNAzEaZTVz7cHh5CwiJ5rk/ybkG3IhxM3hPBSuMHK6DCJ5xIJ8T4RvIcwCf4PDVEXARPRxboXSnTbBBri7e6w63uJsHF+YcGF1QfY+jBir9mWHXkhXYA8UPEB+LdqkR86wApQSpaxevEAjIho+r8wYmdUWXlQksREFLZJSH0QHl6svcUVV44UuteqRMVtl5YLt7M8RjakaPevR7QJC0oTXFw06BzrI0tCm+Ew8wKOccQwoyj5QvomAGHFZUCZvkE1GToLMElP/H2bsV/Lgc+8MTQONlaXy8q34NoicA9sQT+MSfoj/BzxvES47RewxYIC5uQ/KZPIak12wVjNm0YM7UFC7v8d+SFZNb7uzS0F4nIvEJ7zn+U0wDx2Mf+xlkvS+W2BE47wow3UeQ1NCJa3Q2ix/QBsmIDfgEginJZ1FvN1DOwObr2eCbnNQ0HrJL3TL0nahmupwo4dCZTkkwnQeFb2bW2st+STMLdId0BB93ooJy9lVdpi9aPaO5vhHYuwNSv+hK2xfiTHqwI3bzE1NXyd/D1r+27AfW5Gq3//Mi+uyXH+hWvF4kvIs80ZL/XYl7InVGRVjclsbf2NZjlfb+Z8UY9wLU8ZbCVCJbJxK/nG7DFuEyQ6Vq8yMUu+78fgZ14CSifKIwCUhimFbR+9vUOSA7C6c3RWgHT9FghU0QbOCYY3PIQrtZoI6ATP2I6wIGkv1k0REXXy2c38x1LBPVALfsPwJkk5nAY=","base64")).toString()),Gj)});var VIe=_((wzt,WIe)=>{var $j=Symbol("arg flag"),Ma=class extends Error{constructor(e,r){super(e),this.name="ArgError",this.code=r,Object.setPrototypeOf(this,Ma.prototype)}};function iv(t,{argv:e=process.argv.slice(2),permissive:r=!1,stopAtPositional:o=!1}={}){if(!t)throw new Ma("argument specification object is required","ARG_CONFIG_NO_SPEC");let a={_:[]},n={},u={};for(let A of Object.keys(t)){if(!A)throw new Ma("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(A[0]!=="-")throw new Ma(`argument key must start with '-' but found: '${A}'`,"ARG_CONFIG_NONOPT_KEY");if(A.length===1)throw new Ma(`argument key must have a name; singular '-' keys are not allowed: ${A}`,"ARG_CONFIG_NONAME_KEY");if(typeof t[A]=="string"){n[A]=t[A];continue}let p=t[A],h=!1;if(Array.isArray(p)&&p.length===1&&typeof p[0]=="function"){let[E]=p;p=(I,v,b=[])=>(b.push(E(I,v,b[b.length-1])),b),h=E===Boolean||E[$j]===!0}else if(typeof p=="function")h=p===Boolean||p[$j]===!0;else throw new Ma(`type missing or not a function or valid array type: ${A}`,"ARG_CONFIG_VAD_TYPE");if(A[1]!=="-"&&A.length>2)throw new Ma(`short argument keys (with a single hyphen) must have only one character: ${A}`,"ARG_CONFIG_SHORTOPT_TOOLONG");u[A]=[p,h]}for(let A=0,p=e.length;A0){a._=a._.concat(e.slice(A));break}if(h==="--"){a._=a._.concat(e.slice(A+1));break}if(h.length>1&&h[0]==="-"){let E=h[1]==="-"||h.length===2?[h]:h.slice(1).split("").map(I=>`-${I}`);for(let I=0;I1&&e[A+1][0]==="-"&&!(e[A+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(L===Number||typeof BigInt<"u"&&L===BigInt))){let J=b===T?"":` (alias for ${T})`;throw new Ma(`option requires argument: ${b}${J}`,"ARG_MISSING_REQUIRED_LONGARG")}a[T]=L(e[A+1],T,a[T]),++A}else a[T]=L(C,T,a[T])}}else a._.push(h)}return a}iv.flag=t=>(t[$j]=!0,t);iv.COUNT=iv.flag((t,e,r)=>(r||0)+1);iv.ArgError=Ma;WIe.exports=iv});var t1e=_((Kzt,e1e)=>{var nq;e1e.exports=()=>(typeof nq>"u"&&(nq=Be("zlib").brotliDecompressSync(Buffer.from("W6EUYSRCcB6YgvD+v1KjooaTVuyA9QBvOEf1l4M7DOvkimVXbsQ220/1dKQ/RD7GnAHusCKm9mZqWs+m2iiMwpUZIGrF8fD+txJ8RnX/R8pPf5b//Hy927RxNHJKX9ILKRWh4MPm4qzPWOUKUYaidv5Cq69pcxF3TdXdyxS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uq)=>{(function(t){cq&&typeof cq=="object"&&typeof uq<"u"?uq.exports=t():typeof define=="function"&&define.amd?define([],t):typeof window<"u"?window.isWindows=t():typeof global<"u"?global.isWindows=t():typeof self<"u"?self.isWindows=t():this.isWindows=t()})(function(){"use strict";return function(){return process&&(process.platform==="win32"||/^(msys|cygwin)$/.test(process.env.OSTYPE))}})});var u1e=_((WXt,c1e)=>{"use strict";Aq.ifExists=n1t;var GC=Be("util"),sc=Be("path"),a1e=o1e(),e1t=/^#!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+)(.*)$/,t1t={createPwshFile:!0,createCmdFile:a1e(),fs:Be("fs")},r1t=new Map([[".js","node"],[".cjs","node"],[".mjs","node"],[".cmd","cmd"],[".bat","cmd"],[".ps1","pwsh"],[".sh","sh"]]);function l1e(t){let e={...t1t,...t},r=e.fs;return e.fs_={chmod:r.chmod?GC.promisify(r.chmod):async()=>{},mkdir:GC.promisify(r.mkdir),readFile:GC.promisify(r.readFile),stat:GC.promisify(r.stat),unlink:GC.promisify(r.unlink),writeFile:GC.promisify(r.writeFile)},e}async function Aq(t,e,r){let o=l1e(r);await o.fs_.stat(t),await s1t(t,e,o)}function n1t(t,e,r){return Aq(t,e,r).catch(()=>{})}function i1t(t,e){return e.fs_.unlink(t).catch(()=>{})}async function s1t(t,e,r){let o=await u1t(t,r);return await o1t(e,r),a1t(t,e,o,r)}function o1t(t,e){return e.fs_.mkdir(sc.dirname(t),{recursive:!0})}function a1t(t,e,r,o){let a=l1e(o),n=[{generator:p1t,extension:""}];return a.createCmdFile&&n.push({generator:f1t,extension:".cmd"}),a.createPwshFile&&n.push({generator:h1t,extension:".ps1"}),Promise.all(n.map(u=>A1t(t,e+u.extension,r,u.generator,a)))}function l1t(t,e){return i1t(t,e)}function c1t(t,e){return g1t(t,e)}async function u1t(t,e){let a=(await e.fs_.readFile(t,"utf8")).trim().split(/\r*\n/)[0].match(e1t);if(!a){let n=sc.extname(t).toLowerCase();return{program:r1t.get(n)||null,additionalArgs:""}}return{program:a[1],additionalArgs:a[2]}}async function A1t(t,e,r,o,a){let n=a.preserveSymlinks?"--preserve-symlinks":"",u=[r.additionalArgs,n].filter(A=>A).join(" ");return a=Object.assign({},a,{prog:r.program,args:u}),await l1t(e,a),await a.fs_.writeFile(e,o(t,e,a),"utf8"),c1t(e,a)}function f1t(t,e,r){let a=sc.relative(sc.dirname(e),t).split("/").join("\\"),n=sc.isAbsolute(a)?`"${a}"`:`"%~dp0\\${a}"`,u,A=r.prog,p=r.args||"",h=fq(r.nodePath).win32;A?(u=`"%~dp0\\${A}.exe"`,a=n):(A=n,p="",a="");let E=r.progArgs?`${r.progArgs.join(" ")} `:"",I=h?`@SET NODE_PATH=${h}\r +`:"";return u?I+=`@IF EXIST ${u} (\r + ${u} ${p} ${a} ${E}%*\r +) ELSE (\r + @SETLOCAL\r + @SET PATHEXT=%PATHEXT:;.JS;=;%\r + ${A} ${p} ${a} ${E}%*\r +)\r +`:I+=`@${A} ${p} ${a} ${E}%*\r +`,I}function p1t(t,e,r){let o=sc.relative(sc.dirname(e),t),a=r.prog&&r.prog.split("\\").join("/"),n;o=o.split("\\").join("/");let u=sc.isAbsolute(o)?`"${o}"`:`"$basedir/${o}"`,A=r.args||"",p=fq(r.nodePath).posix;a?(n=`"$basedir/${r.prog}"`,o=u):(a=u,A="",o="");let h=r.progArgs?`${r.progArgs.join(" ")} `:"",E=`#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')") + +case \`uname\` in + *CYGWIN*) basedir=\`cygpath -w "$basedir"\`;; +esac + +`,I=r.nodePath?`export NODE_PATH="${p}" +`:"";return n?E+=`${I}if [ -x ${n} ]; then + exec ${n} ${A} ${o} ${h}"$@" +else + exec ${a} ${A} ${o} ${h}"$@" +fi +`:E+=`${I}${a} ${A} ${o} ${h}"$@" +exit $? +`,E}function h1t(t,e,r){let o=sc.relative(sc.dirname(e),t),a=r.prog&&r.prog.split("\\").join("/"),n=a&&`"${a}$exe"`,u;o=o.split("\\").join("/");let A=sc.isAbsolute(o)?`"${o}"`:`"$basedir/${o}"`,p=r.args||"",h=fq(r.nodePath),E=h.win32,I=h.posix;n?(u=`"$basedir/${r.prog}$exe"`,o=A):(n=A,p="",o="");let v=r.progArgs?`${r.progArgs.join(" ")} `:"",b=`#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +${r.nodePath?`$env_node_path=$env:NODE_PATH +$env:NODE_PATH="${E}" +`:""}if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +}`;return r.nodePath&&(b+=` else { + $env:NODE_PATH="${I}" +}`),u?b+=` +$ret=0 +if (Test-Path ${u}) { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & ${u} ${p} ${o} ${v}$args + } else { + & ${u} ${p} ${o} ${v}$args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & ${n} ${p} ${o} ${v}$args + } else { + & ${n} ${p} ${o} ${v}$args + } + $ret=$LASTEXITCODE +} +${r.nodePath?`$env:NODE_PATH=$env_node_path +`:""}exit $ret +`:b+=` +# Support pipeline input +if ($MyInvocation.ExpectingInput) { + $input | & ${n} ${p} ${o} ${v}$args +} else { + & ${n} ${p} ${o} ${v}$args +} +${r.nodePath?`$env:NODE_PATH=$env_node_path +`:""}exit $LASTEXITCODE +`,b}function g1t(t,e){return e.fs_.chmod(t,493)}function fq(t){if(!t)return{win32:"",posix:""};let e=typeof t=="string"?t.split(sc.delimiter):Array.from(t),r={};for(let o=0;o`/mnt/${A.toLowerCase()}`):e[o];r.win32=r.win32?`${r.win32};${a}`:a,r.posix=r.posix?`${r.posix}:${n}`:n,r[o]={win32:a,posix:n}}return r}c1e.exports=Aq});var Sq=_((h$t,F1e)=>{F1e.exports=Be("stream")});var L1e=_((g$t,N1e)=>{"use strict";function T1e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,o)}return r}function U1t(t){for(var e=1;e0?this.tail.next=o:this.head=o,this.tail=o,++this.length}},{key:"unshift",value:function(r){var o={data:r,next:this.head};this.length===0&&(this.tail=o),this.head=o,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var o=this.head,a=""+o.data;o=o.next;)a+=r+o.data;return a}},{key:"concat",value:function(r){if(this.length===0)return QQ.alloc(0);for(var o=QQ.allocUnsafe(r>>>0),a=this.head,n=0;a;)W1t(a.data,o,n),n+=a.data.length,a=a.next;return o}},{key:"consume",value:function(r,o){var a;return ru.length?u.length:r;if(A===u.length?n+=u:n+=u.slice(0,r),r-=A,r===0){A===u.length?(++a,o.next?this.head=o.next:this.head=this.tail=null):(this.head=o,o.data=u.slice(A));break}++a}return this.length-=a,n}},{key:"_getBuffer",value:function(r){var o=QQ.allocUnsafe(r),a=this.head,n=1;for(a.data.copy(o),r-=a.data.length;a=a.next;){var u=a.data,A=r>u.length?u.length:r;if(u.copy(o,o.length-r,0,A),r-=A,r===0){A===u.length?(++n,a.next?this.head=a.next:this.head=this.tail=null):(this.head=a,a.data=u.slice(A));break}++n}return this.length-=n,o}},{key:Y1t,value:function(r,o){return xq(this,U1t({},o,{depth:0,customInspect:!1}))}}]),t}()});var kq=_((d$t,O1e)=>{"use strict";function V1t(t,e){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(bq,this,t)):process.nextTick(bq,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(n){!e&&n?r._writableState?r._writableState.errorEmitted?process.nextTick(FQ,r):(r._writableState.errorEmitted=!0,process.nextTick(M1e,r,n)):process.nextTick(M1e,r,n):e?(process.nextTick(FQ,r),e(n)):process.nextTick(FQ,r)}),this)}function M1e(t,e){bq(t,e),FQ(t)}function FQ(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function K1t(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function bq(t,e){t.emit("error",e)}function J1t(t,e){var r=t._readableState,o=t._writableState;r&&r.autoDestroy||o&&o.autoDestroy?t.destroy(e):t.emit("error",e)}O1e.exports={destroy:V1t,undestroy:K1t,errorOrDestroy:J1t}});var k0=_((m$t,H1e)=>{"use strict";var _1e={};function ac(t,e,r){r||(r=Error);function o(n,u,A){return typeof e=="string"?e:e(n,u,A)}class a extends r{constructor(u,A,p){super(o(u,A,p))}}a.prototype.name=r.name,a.prototype.code=t,_1e[t]=a}function U1e(t,e){if(Array.isArray(t)){let r=t.length;return t=t.map(o=>String(o)),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:r===2?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}else return`of ${e} ${String(t)}`}function z1t(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function X1t(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function Z1t(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}ac("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);ac("ERR_INVALID_ARG_TYPE",function(t,e,r){let o;typeof e=="string"&&z1t(e,"not ")?(o="must not be",e=e.replace(/^not /,"")):o="must be";let a;if(X1t(t," argument"))a=`The ${t} ${o} ${U1e(e,"type")}`;else{let n=Z1t(t,".")?"property":"argument";a=`The "${t}" ${n} ${o} ${U1e(e,"type")}`}return a+=`. Received type ${typeof r}`,a},TypeError);ac("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");ac("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});ac("ERR_STREAM_PREMATURE_CLOSE","Premature close");ac("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});ac("ERR_MULTIPLE_CALLBACK","Callback called multiple times");ac("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");ac("ERR_STREAM_WRITE_AFTER_END","write after end");ac("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);ac("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);ac("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");H1e.exports.codes=_1e});var Qq=_((y$t,j1e)=>{"use strict";var $1t=k0().codes.ERR_INVALID_OPT_VALUE;function e2t(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function t2t(t,e,r,o){var a=e2t(e,o,r);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var n=o?r:"highWaterMark";throw new $1t(n,a)}return Math.floor(a)}return t.objectMode?16:16*1024}j1e.exports={getHighWaterMark:t2t}});var q1e=_((E$t,Fq)=>{typeof Object.create=="function"?Fq.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Fq.exports=function(e,r){if(r){e.super_=r;var o=function(){};o.prototype=r.prototype,e.prototype=new o,e.prototype.constructor=e}}});var Q0=_((C$t,Rq)=>{try{if(Tq=Be("util"),typeof Tq.inherits!="function")throw"";Rq.exports=Tq.inherits}catch{Rq.exports=q1e()}var Tq});var Y1e=_((w$t,G1e)=>{G1e.exports=Be("util").deprecate});var Mq=_((I$t,X1e)=>{"use strict";X1e.exports=Ti;function V1e(t){var e=this;this.next=null,this.entry=null,this.finish=function(){x2t(e,t)}}var JC;Ti.WritableState=mv;var r2t={deprecate:Y1e()},K1e=Sq(),RQ=Be("buffer").Buffer,n2t=global.Uint8Array||function(){};function i2t(t){return RQ.from(t)}function s2t(t){return RQ.isBuffer(t)||t instanceof n2t}var Lq=kq(),o2t=Qq(),a2t=o2t.getHighWaterMark,F0=k0().codes,l2t=F0.ERR_INVALID_ARG_TYPE,c2t=F0.ERR_METHOD_NOT_IMPLEMENTED,u2t=F0.ERR_MULTIPLE_CALLBACK,A2t=F0.ERR_STREAM_CANNOT_PIPE,f2t=F0.ERR_STREAM_DESTROYED,p2t=F0.ERR_STREAM_NULL_VALUES,h2t=F0.ERR_STREAM_WRITE_AFTER_END,g2t=F0.ERR_UNKNOWN_ENCODING,zC=Lq.errorOrDestroy;Q0()(Ti,K1e);function d2t(){}function mv(t,e,r){JC=JC||Em(),t=t||{},typeof r!="boolean"&&(r=e instanceof JC),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=a2t(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=t.decodeStrings===!1;this.decodeStrings=!o,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){B2t(e,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new V1e(this)}mv.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(mv.prototype,"buffer",{get:r2t.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var TQ;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(TQ=Function.prototype[Symbol.hasInstance],Object.defineProperty(Ti,Symbol.hasInstance,{value:function(e){return TQ.call(this,e)?!0:this!==Ti?!1:e&&e._writableState instanceof mv}})):TQ=function(e){return e instanceof this};function Ti(t){JC=JC||Em();var e=this instanceof JC;if(!e&&!TQ.call(Ti,this))return new Ti(t);this._writableState=new mv(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),K1e.call(this)}Ti.prototype.pipe=function(){zC(this,new A2t)};function m2t(t,e){var r=new h2t;zC(t,r),process.nextTick(e,r)}function y2t(t,e,r,o){var a;return r===null?a=new p2t:typeof r!="string"&&!e.objectMode&&(a=new l2t("chunk",["string","Buffer"],r)),a?(zC(t,a),process.nextTick(o,a),!1):!0}Ti.prototype.write=function(t,e,r){var o=this._writableState,a=!1,n=!o.objectMode&&s2t(t);return n&&!RQ.isBuffer(t)&&(t=i2t(t)),typeof e=="function"&&(r=e,e=null),n?e="buffer":e||(e=o.defaultEncoding),typeof r!="function"&&(r=d2t),o.ending?m2t(this,r):(n||y2t(this,o,t,r))&&(o.pendingcb++,a=C2t(this,o,n,t,e,r)),a};Ti.prototype.cork=function(){this._writableState.corked++};Ti.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&J1e(this,t))};Ti.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new g2t(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(Ti.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function E2t(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=RQ.from(e,r)),e}Object.defineProperty(Ti.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function C2t(t,e,r,o,a,n){if(!r){var u=E2t(e,o,a);o!==u&&(r=!0,a="buffer",o=u)}var A=e.objectMode?1:o.length;e.length+=A;var p=e.length{"use strict";var b2t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};$1e.exports=yA;var Z1e=_q(),Uq=Mq();Q0()(yA,Z1e);for(Oq=b2t(Uq.prototype),NQ=0;NQ{var MQ=Be("buffer"),np=MQ.Buffer;function e2e(t,e){for(var r in t)e[r]=t[r]}np.from&&np.alloc&&np.allocUnsafe&&np.allocUnsafeSlow?t2e.exports=MQ:(e2e(MQ,Hq),Hq.Buffer=XC);function XC(t,e,r){return np(t,e,r)}e2e(np,XC);XC.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return np(t,e,r)};XC.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var o=np(t);return e!==void 0?typeof r=="string"?o.fill(e,r):o.fill(e):o.fill(0),o};XC.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return np(t)};XC.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return MQ.SlowBuffer(t)}});var Gq=_(i2e=>{"use strict";var qq=r2e().Buffer,n2e=qq.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function F2t(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function T2t(t){var e=F2t(t);if(typeof e!="string"&&(qq.isEncoding===n2e||!n2e(t)))throw new Error("Unknown encoding: "+t);return e||t}i2e.StringDecoder=yv;function yv(t){this.encoding=T2t(t);var e;switch(this.encoding){case"utf16le":this.text=U2t,this.end=_2t,e=4;break;case"utf8":this.fillLast=L2t,e=4;break;case"base64":this.text=H2t,this.end=j2t,e=3;break;default:this.write=q2t,this.end=G2t;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=qq.allocUnsafe(e)}yv.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function R2t(t,e,r){var o=e.length-1;if(o=0?(a>0&&(t.lastNeed=a-1),a):--o=0?(a>0&&(t.lastNeed=a-2),a):--o=0?(a>0&&(a===2?a=0:t.lastNeed=a-3),a):0))}function N2t(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function L2t(t){var e=this.lastTotal-this.lastNeed,r=N2t(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function M2t(t,e){var r=R2t(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var o=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,o),t.toString("utf8",e,o)}function O2t(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function U2t(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var o=r.charCodeAt(r.length-1);if(o>=55296&&o<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function _2t(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function H2t(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function j2t(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function q2t(t){return t.toString(this.encoding)}function G2t(t){return t&&t.length?this.write(t):""}});var OQ=_((D$t,a2e)=>{"use strict";var s2e=k0().codes.ERR_STREAM_PREMATURE_CLOSE;function Y2t(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,o=new Array(r),a=0;a{"use strict";var UQ;function T0(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var K2t=OQ(),R0=Symbol("lastResolve"),Cm=Symbol("lastReject"),Ev=Symbol("error"),_Q=Symbol("ended"),wm=Symbol("lastPromise"),Yq=Symbol("handlePromise"),Im=Symbol("stream");function N0(t,e){return{value:t,done:e}}function J2t(t){var e=t[R0];if(e!==null){var r=t[Im].read();r!==null&&(t[wm]=null,t[R0]=null,t[Cm]=null,e(N0(r,!1)))}}function z2t(t){process.nextTick(J2t,t)}function X2t(t,e){return function(r,o){t.then(function(){if(e[_Q]){r(N0(void 0,!0));return}e[Yq](r,o)},o)}}var Z2t=Object.getPrototypeOf(function(){}),$2t=Object.setPrototypeOf((UQ={get stream(){return this[Im]},next:function(){var e=this,r=this[Ev];if(r!==null)return Promise.reject(r);if(this[_Q])return Promise.resolve(N0(void 0,!0));if(this[Im].destroyed)return new Promise(function(u,A){process.nextTick(function(){e[Ev]?A(e[Ev]):u(N0(void 0,!0))})});var o=this[wm],a;if(o)a=new Promise(X2t(o,this));else{var n=this[Im].read();if(n!==null)return Promise.resolve(N0(n,!1));a=new Promise(this[Yq])}return this[wm]=a,a}},T0(UQ,Symbol.asyncIterator,function(){return this}),T0(UQ,"return",function(){var e=this;return new Promise(function(r,o){e[Im].destroy(null,function(a){if(a){o(a);return}r(N0(void 0,!0))})})}),UQ),Z2t),eBt=function(e){var r,o=Object.create($2t,(r={},T0(r,Im,{value:e,writable:!0}),T0(r,R0,{value:null,writable:!0}),T0(r,Cm,{value:null,writable:!0}),T0(r,Ev,{value:null,writable:!0}),T0(r,_Q,{value:e._readableState.endEmitted,writable:!0}),T0(r,Yq,{value:function(n,u){var A=o[Im].read();A?(o[wm]=null,o[R0]=null,o[Cm]=null,n(N0(A,!1))):(o[R0]=n,o[Cm]=u)},writable:!0}),r));return o[wm]=null,K2t(e,function(a){if(a&&a.code!=="ERR_STREAM_PREMATURE_CLOSE"){var n=o[Cm];n!==null&&(o[wm]=null,o[R0]=null,o[Cm]=null,n(a)),o[Ev]=a;return}var u=o[R0];u!==null&&(o[wm]=null,o[R0]=null,o[Cm]=null,u(N0(void 0,!0))),o[_Q]=!0}),e.on("readable",z2t.bind(null,o)),o};l2e.exports=eBt});var p2e=_((S$t,f2e)=>{"use strict";function u2e(t,e,r,o,a,n,u){try{var A=t[n](u),p=A.value}catch(h){r(h);return}A.done?e(p):Promise.resolve(p).then(o,a)}function tBt(t){return function(){var e=this,r=arguments;return new Promise(function(o,a){var n=t.apply(e,r);function u(p){u2e(n,o,a,u,A,"next",p)}function A(p){u2e(n,o,a,u,A,"throw",p)}u(void 0)})}}function A2e(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,o)}return r}function rBt(t){for(var e=1;e{"use strict";B2e.exports=mn;var ZC;mn.ReadableState=m2e;var x$t=Be("events").EventEmitter,d2e=function(e,r){return e.listeners(r).length},wv=Sq(),HQ=Be("buffer").Buffer,oBt=global.Uint8Array||function(){};function aBt(t){return HQ.from(t)}function lBt(t){return HQ.isBuffer(t)||t instanceof oBt}var Wq=Be("util"),$r;Wq&&Wq.debuglog?$r=Wq.debuglog("stream"):$r=function(){};var cBt=L1e(),$q=kq(),uBt=Qq(),ABt=uBt.getHighWaterMark,jQ=k0().codes,fBt=jQ.ERR_INVALID_ARG_TYPE,pBt=jQ.ERR_STREAM_PUSH_AFTER_EOF,hBt=jQ.ERR_METHOD_NOT_IMPLEMENTED,gBt=jQ.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,$C,Vq,Kq;Q0()(mn,wv);var Cv=$q.errorOrDestroy,Jq=["error","close","destroy","pause","resume"];function dBt(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function m2e(t,e,r){ZC=ZC||Em(),t=t||{},typeof r!="boolean"&&(r=e instanceof ZC),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=ABt(this,t,"readableHighWaterMark",r),this.buffer=new cBt,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&($C||($C=Gq().StringDecoder),this.decoder=new $C(t.encoding),this.encoding=t.encoding)}function mn(t){if(ZC=ZC||Em(),!(this instanceof mn))return new mn(t);var e=this instanceof ZC;this._readableState=new m2e(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),wv.call(this)}Object.defineProperty(mn.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){!this._readableState||(this._readableState.destroyed=e)}});mn.prototype.destroy=$q.destroy;mn.prototype._undestroy=$q.undestroy;mn.prototype._destroy=function(t,e){e(t)};mn.prototype.push=function(t,e){var r=this._readableState,o;return r.objectMode?o=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=HQ.from(t,e),e=""),o=!0),y2e(this,t,e,!1,o)};mn.prototype.unshift=function(t){return y2e(this,t,null,!0,!1)};function y2e(t,e,r,o,a){$r("readableAddChunk",e);var n=t._readableState;if(e===null)n.reading=!1,EBt(t,n);else{var u;if(a||(u=mBt(n,e)),u)Cv(t,u);else if(n.objectMode||e&&e.length>0)if(typeof e!="string"&&!n.objectMode&&Object.getPrototypeOf(e)!==HQ.prototype&&(e=aBt(e)),o)n.endEmitted?Cv(t,new gBt):zq(t,n,e,!0);else if(n.ended)Cv(t,new pBt);else{if(n.destroyed)return!1;n.reading=!1,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?zq(t,n,e,!1):Zq(t,n)):zq(t,n,e,!1)}else o||(n.reading=!1,Zq(t,n))}return!n.ended&&(n.length=h2e?t=h2e:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function g2e(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=yBt(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}mn.prototype.read=function(t){$r("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return $r("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Xq(this):qQ(this),null;if(t=g2e(t,e),t===0&&e.ended)return e.length===0&&Xq(this),null;var o=e.needReadable;$r("need readable",o),(e.length===0||e.length-t0?a=w2e(t,e):a=null,a===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Xq(this)),a!==null&&this.emit("data",a),a};function EBt(t,e){if($r("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?qQ(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,E2e(t)))}}function qQ(t){var e=t._readableState;$r("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||($r("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(E2e,t))}function E2e(t){var e=t._readableState;$r("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,eG(t)}function Zq(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(CBt,t,e))}function CBt(t,e){for(;!e.reading&&!e.ended&&(e.length1&&I2e(o.pipes,t)!==-1)&&!h&&($r("false write response, pause",o.awaitDrain),o.awaitDrain++),r.pause())}function v(L){$r("onerror",L),T(),t.removeListener("error",v),d2e(t,"error")===0&&Cv(t,L)}dBt(t,"error",v);function b(){t.removeListener("finish",C),T()}t.once("close",b);function C(){$r("onfinish"),t.removeListener("close",b),T()}t.once("finish",C);function T(){$r("unpipe"),r.unpipe(t)}return t.emit("pipe",r),o.flowing||($r("pipe resume"),r.resume()),t};function wBt(t){return function(){var r=t._readableState;$r("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&d2e(t,"data")&&(r.flowing=!0,eG(t))}}mn.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var o=e.pipes,a=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var n=0;n0,o.flowing!==!1&&this.resume()):t==="readable"&&!o.endEmitted&&!o.readableListening&&(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,$r("on readable",o.length,o.reading),o.length?qQ(this):o.reading||process.nextTick(IBt,this)),r};mn.prototype.addListener=mn.prototype.on;mn.prototype.removeListener=function(t,e){var r=wv.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(C2e,this),r};mn.prototype.removeAllListeners=function(t){var e=wv.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(C2e,this),e};function C2e(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function IBt(t){$r("readable nexttick read 0"),t.read(0)}mn.prototype.resume=function(){var t=this._readableState;return t.flowing||($r("resume"),t.flowing=!t.readableListening,BBt(this,t)),t.paused=!1,this};function BBt(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(vBt,t,e))}function vBt(t,e){$r("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),eG(t),e.flowing&&!e.reading&&t.read(0)}mn.prototype.pause=function(){return $r("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&($r("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function eG(t){var e=t._readableState;for($r("flow",e.flowing);e.flowing&&t.read()!==null;);}mn.prototype.wrap=function(t){var e=this,r=this._readableState,o=!1;t.on("end",function(){if($r("wrapped end"),r.decoder&&!r.ended){var u=r.decoder.end();u&&u.length&&e.push(u)}e.push(null)}),t.on("data",function(u){if($r("wrapped data"),r.decoder&&(u=r.decoder.write(u)),!(r.objectMode&&u==null)&&!(!r.objectMode&&(!u||!u.length))){var A=e.push(u);A||(o=!0,t.pause())}});for(var a in t)this[a]===void 0&&typeof t[a]=="function"&&(this[a]=function(A){return function(){return t[A].apply(t,arguments)}}(a));for(var n=0;n=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Xq(t){var e=t._readableState;$r("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(DBt,e,t))}function DBt(t,e){if($r("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(mn.from=function(t,e){return Kq===void 0&&(Kq=p2e()),Kq(mn,t,e)});function I2e(t,e){for(var r=0,o=t.length;r{"use strict";D2e.exports=ip;var GQ=k0().codes,PBt=GQ.ERR_METHOD_NOT_IMPLEMENTED,SBt=GQ.ERR_MULTIPLE_CALLBACK,xBt=GQ.ERR_TRANSFORM_ALREADY_TRANSFORMING,bBt=GQ.ERR_TRANSFORM_WITH_LENGTH_0,YQ=Em();Q0()(ip,YQ);function kBt(t,e){var r=this._transformState;r.transforming=!1;var o=r.writecb;if(o===null)return this.emit("error",new SBt);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),o(t);var a=this._readableState;a.reading=!1,(a.needReadable||a.length{"use strict";S2e.exports=Iv;var P2e=tG();Q0()(Iv,P2e);function Iv(t){if(!(this instanceof Iv))return new Iv(t);P2e.call(this,t)}Iv.prototype._transform=function(t,e,r){r(null,t)}});var T2e=_((F$t,F2e)=>{"use strict";var rG;function FBt(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var Q2e=k0().codes,TBt=Q2e.ERR_MISSING_ARGS,RBt=Q2e.ERR_STREAM_DESTROYED;function b2e(t){if(t)throw t}function NBt(t){return t.setHeader&&typeof t.abort=="function"}function LBt(t,e,r,o){o=FBt(o);var a=!1;t.on("close",function(){a=!0}),rG===void 0&&(rG=OQ()),rG(t,{readable:e,writable:r},function(u){if(u)return o(u);a=!0,o()});var n=!1;return function(u){if(!a&&!n){if(n=!0,NBt(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();o(u||new RBt("pipe"))}}}function k2e(t){t()}function MBt(t,e){return t.pipe(e)}function OBt(t){return!t.length||typeof t[t.length-1]!="function"?b2e:t.pop()}function UBt(){for(var t=arguments.length,e=new Array(t),r=0;r0;return LBt(u,p,h,function(E){a||(a=E),E&&n.forEach(k2e),!p&&(n.forEach(k2e),o(a))})});return e.reduce(MBt)}F2e.exports=UBt});var ew=_((lc,vv)=>{var Bv=Be("stream");process.env.READABLE_STREAM==="disable"&&Bv?(vv.exports=Bv.Readable,Object.assign(vv.exports,Bv),vv.exports.Stream=Bv):(lc=vv.exports=_q(),lc.Stream=Bv||lc,lc.Readable=lc,lc.Writable=Mq(),lc.Duplex=Em(),lc.Transform=tG(),lc.PassThrough=x2e(),lc.finished=OQ(),lc.pipeline=T2e())});var L2e=_((T$t,N2e)=>{"use strict";var{Buffer:lu}=Be("buffer"),R2e=Symbol.for("BufferList");function ni(t){if(!(this instanceof ni))return new ni(t);ni._init.call(this,t)}ni._init=function(e){Object.defineProperty(this,R2e,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};ni.prototype._new=function(e){return new ni(e)};ni.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let o=0;othis.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};ni.prototype.slice=function(e,r){return typeof e=="number"&&e<0&&(e+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};ni.prototype.copy=function(e,r,o,a){if((typeof o!="number"||o<0)&&(o=0),(typeof a!="number"||a>this.length)&&(a=this.length),o>=this.length||a<=0)return e||lu.alloc(0);let n=!!e,u=this._offset(o),A=a-o,p=A,h=n&&r||0,E=u[1];if(o===0&&a===this.length){if(!n)return this._bufs.length===1?this._bufs[0]:lu.concat(this._bufs,this.length);for(let I=0;Iv)this._bufs[I].copy(e,h,E),h+=v;else{this._bufs[I].copy(e,h,E,E+p),h+=v;break}p-=v,E&&(E=0)}return e.length>h?e.slice(0,h):e};ni.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!="number"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let o=this._offset(e),a=this._offset(r),n=this._bufs.slice(o[0],a[0]+1);return a[1]===0?n.pop():n[n.length-1]=n[n.length-1].slice(0,a[1]),o[1]!==0&&(n[0]=n[0].slice(o[1])),this._new(n)};ni.prototype.toString=function(e,r,o){return this.slice(r,o).toString(e)};ni.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};ni.prototype.duplicate=function(){let e=this._new();for(let r=0;rthis.length?this.length:e;let o=this._offset(e),a=o[0],n=o[1];for(;a=t.length){let p=u.indexOf(t,n);if(p!==-1)return this._reverseOffset([a,p]);n=u.length-t.length+1}else{let p=this._reverseOffset([a,n]);if(this._match(p,t))return p;n++}n=0}return-1};ni.prototype._match=function(t,e){if(this.length-t{"use strict";var nG=ew().Duplex,_Bt=Q0(),Dv=L2e();function Uo(t){if(!(this instanceof Uo))return new Uo(t);if(typeof t=="function"){this._callback=t;let e=function(o){this._callback&&(this._callback(o),this._callback=null)}.bind(this);this.on("pipe",function(o){o.on("error",e)}),this.on("unpipe",function(o){o.removeListener("error",e)}),t=null}Dv._init.call(this,t),nG.call(this)}_Bt(Uo,nG);Object.assign(Uo.prototype,Dv.prototype);Uo.prototype._new=function(e){return new Uo(e)};Uo.prototype._write=function(e,r,o){this._appendBuffer(e),typeof o=="function"&&o()};Uo.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)};Uo.prototype.end=function(e){nG.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)};Uo.prototype._destroy=function(e,r){this._bufs.length=0,this.length=0,r(e)};Uo.prototype._isBufferList=function(e){return e instanceof Uo||e instanceof Dv||Uo.isBufferList(e)};Uo.isBufferList=Dv.isBufferList;WQ.exports=Uo;WQ.exports.BufferListStream=Uo;WQ.exports.BufferList=Dv});var oG=_(rw=>{var HBt=Buffer.alloc,jBt="0000000000000000000",qBt="7777777777777777777",O2e="0".charCodeAt(0),U2e=Buffer.from("ustar\0","binary"),GBt=Buffer.from("00","binary"),YBt=Buffer.from("ustar ","binary"),WBt=Buffer.from(" \0","binary"),VBt=parseInt("7777",8),Pv=257,sG=263,KBt=function(t,e,r){return typeof t!="number"?r:(t=~~t,t>=e?e:t>=0||(t+=e,t>=0)?t:0)},JBt=function(t){switch(t){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null},zBt=function(t){switch(t){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0},_2e=function(t,e,r,o){for(;re?qBt.slice(0,e)+" ":jBt.slice(0,e-t.length)+t+" "};function XBt(t){var e;if(t[0]===128)e=!0;else if(t[0]===255)e=!1;else return null;for(var r=[],o=t.length-1;o>0;o--){var a=t[o];e?r.push(a):r.push(255-a)}var n=0,u=r.length;for(o=0;o=Math.pow(10,r)&&r++,e+r+t};rw.decodeLongPath=function(t,e){return tw(t,0,t.length,e)};rw.encodePax=function(t){var e="";t.name&&(e+=iG(" path="+t.name+` +`)),t.linkname&&(e+=iG(" linkpath="+t.linkname+` +`));var r=t.pax;if(r)for(var o in r)e+=iG(" "+o+"="+r[o]+` +`);return Buffer.from(e)};rw.decodePax=function(t){for(var e={};t.length;){for(var r=0;r100;){var a=r.indexOf("/");if(a===-1)return null;o+=o?"/"+r.slice(0,a):r.slice(0,a),r=r.slice(a+1)}return Buffer.byteLength(r)>100||Buffer.byteLength(o)>155||t.linkname&&Buffer.byteLength(t.linkname)>100?null:(e.write(r),e.write(L0(t.mode&VBt,6),100),e.write(L0(t.uid,6),108),e.write(L0(t.gid,6),116),e.write(L0(t.size,11),124),e.write(L0(t.mtime.getTime()/1e3|0,11),136),e[156]=O2e+zBt(t.type),t.linkname&&e.write(t.linkname,157),U2e.copy(e,Pv),GBt.copy(e,sG),t.uname&&e.write(t.uname,265),t.gname&&e.write(t.gname,297),e.write(L0(t.devmajor||0,6),329),e.write(L0(t.devminor||0,6),337),o&&e.write(o,345),e.write(L0(H2e(e),6),148),e)};rw.decode=function(t,e,r){var o=t[156]===0?0:t[156]-O2e,a=tw(t,0,100,e),n=M0(t,100,8),u=M0(t,108,8),A=M0(t,116,8),p=M0(t,124,12),h=M0(t,136,12),E=JBt(o),I=t[157]===0?null:tw(t,157,100,e),v=tw(t,265,32),b=tw(t,297,32),C=M0(t,329,8),T=M0(t,337,8),L=H2e(t);if(L===8*32)return null;if(L!==M0(t,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(U2e.compare(t,Pv,Pv+6)===0)t[345]&&(a=tw(t,345,155,e)+"/"+a);else if(!(YBt.compare(t,Pv,Pv+6)===0&&WBt.compare(t,sG,sG+2)===0)){if(!r)throw new Error("Invalid tar header: unknown format.")}return o===0&&a&&a[a.length-1]==="/"&&(o=5),{name:a,mode:n,uid:u,gid:A,size:p,mtime:new Date(1e3*h),type:E,linkname:I,uname:v,gname:b,devmajor:C,devminor:T}}});var K2e=_((L$t,V2e)=>{var q2e=Be("util"),ZBt=M2e(),Sv=oG(),G2e=ew().Writable,Y2e=ew().PassThrough,W2e=function(){},j2e=function(t){return t&=511,t&&512-t},$Bt=function(t,e){var r=new VQ(t,e);return r.end(),r},evt=function(t,e){return e.path&&(t.name=e.path),e.linkpath&&(t.linkname=e.linkpath),e.size&&(t.size=parseInt(e.size,10)),t.pax=e,t},VQ=function(t,e){this._parent=t,this.offset=e,Y2e.call(this,{autoDestroy:!1})};q2e.inherits(VQ,Y2e);VQ.prototype.destroy=function(t){this._parent.destroy(t)};var sp=function(t){if(!(this instanceof sp))return new sp(t);G2e.call(this,t),t=t||{},this._offset=0,this._buffer=ZBt(),this._missing=0,this._partial=!1,this._onparse=W2e,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var e=this,r=e._buffer,o=function(){e._continue()},a=function(v){if(e._locked=!1,v)return e.destroy(v);e._stream||o()},n=function(){e._stream=null;var v=j2e(e._header.size);v?e._parse(v,u):e._parse(512,I),e._locked||o()},u=function(){e._buffer.consume(j2e(e._header.size)),e._parse(512,I),o()},A=function(){var v=e._header.size;e._paxGlobal=Sv.decodePax(r.slice(0,v)),r.consume(v),n()},p=function(){var v=e._header.size;e._pax=Sv.decodePax(r.slice(0,v)),e._paxGlobal&&(e._pax=Object.assign({},e._paxGlobal,e._pax)),r.consume(v),n()},h=function(){var v=e._header.size;this._gnuLongPath=Sv.decodeLongPath(r.slice(0,v),t.filenameEncoding),r.consume(v),n()},E=function(){var v=e._header.size;this._gnuLongLinkPath=Sv.decodeLongPath(r.slice(0,v),t.filenameEncoding),r.consume(v),n()},I=function(){var v=e._offset,b;try{b=e._header=Sv.decode(r.slice(0,512),t.filenameEncoding,t.allowUnknownFormat)}catch(C){e.emit("error",C)}if(r.consume(512),!b){e._parse(512,I),o();return}if(b.type==="gnu-long-path"){e._parse(b.size,h),o();return}if(b.type==="gnu-long-link-path"){e._parse(b.size,E),o();return}if(b.type==="pax-global-header"){e._parse(b.size,A),o();return}if(b.type==="pax-header"){e._parse(b.size,p),o();return}if(e._gnuLongPath&&(b.name=e._gnuLongPath,e._gnuLongPath=null),e._gnuLongLinkPath&&(b.linkname=e._gnuLongLinkPath,e._gnuLongLinkPath=null),e._pax&&(e._header=b=evt(b,e._pax),e._pax=null),e._locked=!0,!b.size||b.type==="directory"){e._parse(512,I),e.emit("entry",b,$Bt(e,v),a);return}e._stream=new VQ(e,v),e.emit("entry",b,e._stream,a),e._parse(b.size,n),o()};this._onheader=I,this._parse(512,I)};q2e.inherits(sp,G2e);sp.prototype.destroy=function(t){this._destroyed||(this._destroyed=!0,t&&this.emit("error",t),this.emit("close"),this._stream&&this._stream.emit("close"))};sp.prototype._parse=function(t,e){this._destroyed||(this._offset+=t,this._missing=t,e===this._onheader&&(this._partial=!1),this._onparse=e)};sp.prototype._continue=function(){if(!this._destroyed){var t=this._cb;this._cb=W2e,this._overflow?this._write(this._overflow,void 0,t):t()}};sp.prototype._write=function(t,e,r){if(!this._destroyed){var o=this._stream,a=this._buffer,n=this._missing;if(t.length&&(this._partial=!0),t.lengthn&&(u=t.slice(n),t=t.slice(0,n)),o?o.end(t):a.append(t),this._overflow=u,this._onparse()}};sp.prototype._final=function(t){if(this._partial)return this.destroy(new Error("Unexpected end of data"));t()};V2e.exports=sp});var z2e=_((M$t,J2e)=>{J2e.exports=Be("fs").constants||Be("constants")});var tBe=_((O$t,eBe)=>{var nw=z2e(),X2e=OO(),JQ=Q0(),tvt=Buffer.alloc,Z2e=ew().Readable,iw=ew().Writable,rvt=Be("string_decoder").StringDecoder,KQ=oG(),nvt=parseInt("755",8),ivt=parseInt("644",8),$2e=tvt(1024),lG=function(){},aG=function(t,e){e&=511,e&&t.push($2e.slice(0,512-e))};function svt(t){switch(t&nw.S_IFMT){case nw.S_IFBLK:return"block-device";case nw.S_IFCHR:return"character-device";case nw.S_IFDIR:return"directory";case nw.S_IFIFO:return"fifo";case nw.S_IFLNK:return"symlink"}return"file"}var zQ=function(t){iw.call(this),this.written=0,this._to=t,this._destroyed=!1};JQ(zQ,iw);zQ.prototype._write=function(t,e,r){if(this.written+=t.length,this._to.push(t))return r();this._to._drain=r};zQ.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var XQ=function(){iw.call(this),this.linkname="",this._decoder=new rvt("utf-8"),this._destroyed=!1};JQ(XQ,iw);XQ.prototype._write=function(t,e,r){this.linkname+=this._decoder.write(t),r()};XQ.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var xv=function(){iw.call(this),this._destroyed=!1};JQ(xv,iw);xv.prototype._write=function(t,e,r){r(new Error("No body allowed for this entry"))};xv.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this.emit("close"))};var EA=function(t){if(!(this instanceof EA))return new EA(t);Z2e.call(this,t),this._drain=lG,this._finalized=!1,this._finalizing=!1,this._destroyed=!1,this._stream=null};JQ(EA,Z2e);EA.prototype.entry=function(t,e,r){if(this._stream)throw new Error("already piping an entry");if(!(this._finalized||this._destroyed)){typeof e=="function"&&(r=e,e=null),r||(r=lG);var o=this;if((!t.size||t.type==="symlink")&&(t.size=0),t.type||(t.type=svt(t.mode)),t.mode||(t.mode=t.type==="directory"?nvt:ivt),t.uid||(t.uid=0),t.gid||(t.gid=0),t.mtime||(t.mtime=new Date),typeof e=="string"&&(e=Buffer.from(e)),Buffer.isBuffer(e)){t.size=e.length,this._encode(t);var a=this.push(e);return aG(o,t.size),a?process.nextTick(r):this._drain=r,new xv}if(t.type==="symlink"&&!t.linkname){var n=new XQ;return X2e(n,function(A){if(A)return o.destroy(),r(A);t.linkname=n.linkname,o._encode(t),r()}),n}if(this._encode(t),t.type!=="file"&&t.type!=="contiguous-file")return process.nextTick(r),new xv;var u=new zQ(this);return this._stream=u,X2e(u,function(A){if(o._stream=null,A)return o.destroy(),r(A);if(u.written!==t.size)return o.destroy(),r(new Error("size mismatch"));aG(o,t.size),o._finalizing&&o.finalize(),r()}),u}};EA.prototype.finalize=function(){if(this._stream){this._finalizing=!0;return}this._finalized||(this._finalized=!0,this.push($2e),this.push(null))};EA.prototype.destroy=function(t){this._destroyed||(this._destroyed=!0,t&&this.emit("error",t),this.emit("close"),this._stream&&this._stream.destroy&&this._stream.destroy())};EA.prototype._encode=function(t){if(!t.pax){var e=KQ.encode(t);if(e){this.push(e);return}}this._encodePax(t)};EA.prototype._encodePax=function(t){var e=KQ.encodePax({name:t.name,linkname:t.linkname,pax:t.pax}),r={name:"PaxHeader",mode:t.mode,uid:t.uid,gid:t.gid,size:e.length,mtime:t.mtime,type:"pax-header",linkname:t.linkname&&"PaxHeader",uname:t.uname,gname:t.gname,devmajor:t.devmajor,devminor:t.devminor};this.push(KQ.encode(r)),this.push(e),aG(this,e.length),r.size=t.size,r.type=t.type,this.push(KQ.encode(r))};EA.prototype._read=function(t){var e=this._drain;this._drain=lG,e()};eBe.exports=EA});var rBe=_(cG=>{cG.extract=K2e();cG.pack=tBe()});var hBe=_((ier,pBe)=>{"use strict";var Bm=class{constructor(e,r,o){this.__specs=e||{},Object.keys(this.__specs).forEach(a=>{if(typeof this.__specs[a]=="string"){let n=this.__specs[a],u=this.__specs[n];if(u){let A=u.aliases||[];A.push(a,n),u.aliases=[...new Set(A)],this.__specs[a]=u}else throw new Error(`Alias refers to invalid key: ${n} -> ${a}`)}}),this.__opts=r||{},this.__providers=ABe(o.filter(a=>a!=null&&typeof a=="object")),this.__isFiggyPudding=!0}get(e){return gG(this,e,!0)}get[Symbol.toStringTag](){return"FiggyPudding"}forEach(e,r=this){for(let[o,a]of this.entries())e.call(r,a,o,this)}toJSON(){let e={};return this.forEach((r,o)=>{e[o]=r}),e}*entries(e){for(let o of Object.keys(this.__specs))yield[o,this.get(o)];let r=e||this.__opts.other;if(r){let o=new Set;for(let a of this.__providers){let n=a.entries?a.entries(r):Cvt(a);for(let[u,A]of n)r(u)&&!o.has(u)&&(o.add(u),yield[u,A])}}}*[Symbol.iterator](){for(let[e,r]of this.entries())yield[e,r]}*keys(){for(let[e]of this.entries())yield e}*values(){for(let[,e]of this.entries())yield e}concat(...e){return new Proxy(new Bm(this.__specs,this.__opts,ABe(this.__providers).concat(e)),fBe)}};try{let t=Be("util");Bm.prototype[t.inspect.custom]=function(e,r){return this[Symbol.toStringTag]+" "+t.inspect(this.toJSON(),r)}}catch{}function yvt(t){throw Object.assign(new Error(`invalid config key requested: ${t}`),{code:"EBADKEY"})}function gG(t,e,r){let o=t.__specs[e];if(r&&!o&&(!t.__opts.other||!t.__opts.other(e)))yvt(e);else{o||(o={});let a;for(let n of t.__providers){if(a=uBe(e,n),a===void 0&&o.aliases&&o.aliases.length){for(let u of o.aliases)if(u!==e&&(a=uBe(u,n),a!==void 0))break}if(a!==void 0)break}return a===void 0&&o.default!==void 0?typeof o.default=="function"?o.default(t):o.default:a}}function uBe(t,e){let r;return e.__isFiggyPudding?r=gG(e,t,!1):typeof e.get=="function"?r=e.get(t):r=e[t],r}var fBe={has(t,e){return e in t.__specs&&gG(t,e,!1)!==void 0},ownKeys(t){return Object.keys(t.__specs)},get(t,e){return typeof e=="symbol"||e.slice(0,2)==="__"||e in Bm.prototype?t[e]:t.get(e)},set(t,e,r){if(typeof e=="symbol"||e.slice(0,2)==="__")return t[e]=r,!0;throw new Error("figgyPudding options cannot be modified. Use .concat() instead.")},deleteProperty(){throw new Error("figgyPudding options cannot be deleted. Use .concat() and shadow them instead.")}};pBe.exports=Evt;function Evt(t,e){function r(...o){return new Proxy(new Bm(t,e,o),fBe)}return r}function ABe(t){let e=[];return t.forEach(r=>e.unshift(r)),e}function Cvt(t){return Object.keys(t).map(e=>[e,t[e]])}});var mBe=_((ser,IA)=>{"use strict";var kv=Be("crypto"),wvt=hBe(),Ivt=Be("stream").Transform,gBe=["sha256","sha384","sha512"],Bvt=/^[a-z0-9+/]+(?:=?=?)$/i,vvt=/^([^-]+)-([^?]+)([?\S*]*)$/,Dvt=/^([^-]+)-([A-Za-z0-9+/=]{44,88})(\?[\x21-\x7E]*)*$/,Pvt=/^[\x21-\x7E]+$/,ia=wvt({algorithms:{default:["sha512"]},error:{default:!1},integrity:{},options:{default:[]},pickAlgorithm:{default:()=>Rvt},Promise:{default:()=>Promise},sep:{default:" "},single:{default:!1},size:{},strict:{default:!1}}),U0=class{get isHash(){return!0}constructor(e,r){r=ia(r);let o=!!r.strict;this.source=e.trim();let a=this.source.match(o?Dvt:vvt);if(!a||o&&!gBe.some(u=>u===a[1]))return;this.algorithm=a[1],this.digest=a[2];let n=a[3];this.options=n?n.slice(1).split("?"):[]}hexDigest(){return this.digest&&Buffer.from(this.digest,"base64").toString("hex")}toJSON(){return this.toString()}toString(e){if(e=ia(e),e.strict&&!(gBe.some(o=>o===this.algorithm)&&this.digest.match(Bvt)&&(this.options||[]).every(o=>o.match(Pvt))))return"";let r=this.options&&this.options.length?`?${this.options.join("?")}`:"";return`${this.algorithm}-${this.digest}${r}`}},vm=class{get isIntegrity(){return!0}toJSON(){return this.toString()}toString(e){e=ia(e);let r=e.sep||" ";return e.strict&&(r=r.replace(/\S+/g," ")),Object.keys(this).map(o=>this[o].map(a=>U0.prototype.toString.call(a,e)).filter(a=>a.length).join(r)).filter(o=>o.length).join(r)}concat(e,r){r=ia(r);let o=typeof e=="string"?e:bv(e,r);return wA(`${this.toString(r)} ${o}`,r)}hexDigest(){return wA(this,{single:!0}).hexDigest()}match(e,r){r=ia(r);let o=wA(e,r),a=o.pickAlgorithm(r);return this[a]&&o[a]&&this[a].find(n=>o[a].find(u=>n.digest===u.digest))||!1}pickAlgorithm(e){e=ia(e);let r=e.pickAlgorithm,o=Object.keys(this);if(!o.length)throw new Error(`No algorithms available for ${JSON.stringify(this.toString())}`);return o.reduce((a,n)=>r(a,n)||a)}};IA.exports.parse=wA;function wA(t,e){if(e=ia(e),typeof t=="string")return dG(t,e);if(t.algorithm&&t.digest){let r=new vm;return r[t.algorithm]=[t],dG(bv(r,e),e)}else return dG(bv(t,e),e)}function dG(t,e){return e.single?new U0(t,e):t.trim().split(/\s+/).reduce((r,o)=>{let a=new U0(o,e);if(a.algorithm&&a.digest){let n=a.algorithm;r[n]||(r[n]=[]),r[n].push(a)}return r},new vm)}IA.exports.stringify=bv;function bv(t,e){return e=ia(e),t.algorithm&&t.digest?U0.prototype.toString.call(t,e):typeof t=="string"?bv(wA(t,e),e):vm.prototype.toString.call(t,e)}IA.exports.fromHex=Svt;function Svt(t,e,r){r=ia(r);let o=r.options&&r.options.length?`?${r.options.join("?")}`:"";return wA(`${e}-${Buffer.from(t,"hex").toString("base64")}${o}`,r)}IA.exports.fromData=xvt;function xvt(t,e){e=ia(e);let r=e.algorithms,o=e.options&&e.options.length?`?${e.options.join("?")}`:"";return r.reduce((a,n)=>{let u=kv.createHash(n).update(t).digest("base64"),A=new U0(`${n}-${u}${o}`,e);if(A.algorithm&&A.digest){let p=A.algorithm;a[p]||(a[p]=[]),a[p].push(A)}return a},new vm)}IA.exports.fromStream=bvt;function bvt(t,e){e=ia(e);let r=e.Promise||Promise,o=mG(e);return new r((a,n)=>{t.pipe(o),t.on("error",n),o.on("error",n);let u;o.on("integrity",A=>{u=A}),o.on("end",()=>a(u)),o.on("data",()=>{})})}IA.exports.checkData=kvt;function kvt(t,e,r){if(r=ia(r),e=wA(e,r),!Object.keys(e).length){if(r.error)throw Object.assign(new Error("No valid integrity hashes to check against"),{code:"EINTEGRITY"});return!1}let o=e.pickAlgorithm(r),a=kv.createHash(o).update(t).digest("base64"),n=wA({algorithm:o,digest:a}),u=n.match(e,r);if(u||!r.error)return u;if(typeof r.size=="number"&&t.length!==r.size){let A=new Error(`data size mismatch when checking ${e}. + Wanted: ${r.size} + Found: ${t.length}`);throw A.code="EBADSIZE",A.found=t.length,A.expected=r.size,A.sri=e,A}else{let A=new Error(`Integrity checksum failed when using ${o}: Wanted ${e}, but got ${n}. (${t.length} bytes)`);throw A.code="EINTEGRITY",A.found=n,A.expected=e,A.algorithm=o,A.sri=e,A}}IA.exports.checkStream=Qvt;function Qvt(t,e,r){r=ia(r);let o=r.Promise||Promise,a=mG(r.concat({integrity:e}));return new o((n,u)=>{t.pipe(a),t.on("error",u),a.on("error",u);let A;a.on("verified",p=>{A=p}),a.on("end",()=>n(A)),a.on("data",()=>{})})}IA.exports.integrityStream=mG;function mG(t){t=ia(t);let e=t.integrity&&wA(t.integrity,t),r=e&&Object.keys(e).length,o=r&&e.pickAlgorithm(t),a=r&&e[o],n=Array.from(new Set(t.algorithms.concat(o?[o]:[]))),u=n.map(kv.createHash),A=0,p=new Ivt({transform(h,E,I){A+=h.length,u.forEach(v=>v.update(h,E)),I(null,h,E)}}).on("end",()=>{let h=t.options&&t.options.length?`?${t.options.join("?")}`:"",E=wA(u.map((v,b)=>`${n[b]}-${v.digest("base64")}${h}`).join(" "),t),I=r&&E.match(e,t);if(typeof t.size=="number"&&A!==t.size){let v=new Error(`stream size mismatch when checking ${e}. + Wanted: ${t.size} + Found: ${A}`);v.code="EBADSIZE",v.found=A,v.expected=t.size,v.sri=e,p.emit("error",v)}else if(t.integrity&&!I){let v=new Error(`${e} integrity checksum failed when using ${o}: wanted ${a} but got ${E}. (${A} bytes)`);v.code="EINTEGRITY",v.found=E,v.expected=a,v.algorithm=o,v.sri=e,p.emit("error",v)}else p.emit("size",A),p.emit("integrity",E),I&&p.emit("verified",I)});return p}IA.exports.create=Fvt;function Fvt(t){t=ia(t);let e=t.algorithms,r=t.options.length?`?${t.options.join("?")}`:"",o=e.map(kv.createHash);return{update:function(a,n){return o.forEach(u=>u.update(a,n)),this},digest:function(a){return e.reduce((u,A)=>{let p=o.shift().digest("base64"),h=new U0(`${A}-${p}${r}`,t);if(h.algorithm&&h.digest){let E=h.algorithm;u[E]||(u[E]=[]),u[E].push(h)}return u},new vm)}}}var Tvt=new Set(kv.getHashes()),dBe=["md5","whirlpool","sha1","sha224","sha256","sha384","sha512","sha3","sha3-256","sha3-384","sha3-512","sha3_256","sha3_384","sha3_512"].filter(t=>Tvt.has(t));function Rvt(t,e){return dBe.indexOf(t.toLowerCase())>=dBe.indexOf(e.toLowerCase())?t:e}});var VBe=_((lir,WBe)=>{var TDt=uL();function RDt(t){return TDt(t)?void 0:t}WBe.exports=RDt});var JBe=_((cir,KBe)=>{var NDt=jx(),LDt=Q8(),MDt=N8(),ODt=jd(),UDt=gd(),_Dt=VBe(),HDt=P_(),jDt=k8(),qDt=1,GDt=2,YDt=4,WDt=HDt(function(t,e){var r={};if(t==null)return r;var o=!1;e=NDt(e,function(n){return n=ODt(n,t),o||(o=n.length>1),n}),UDt(t,jDt(t),r),o&&(r=LDt(r,qDt|GDt|YDt,_Dt));for(var a=e.length;a--;)MDt(r,e[a]);return r});KBe.exports=WDt});Pt();Ye();Pt();var eve=Be("child_process"),tve=$e(ed());qt();var uC=new Map([]);var o2={};Kt(o2,{BaseCommand:()=>ut,WorkspaceRequiredError:()=>rr,getCli:()=>the,getDynamicLibs:()=>ehe,getPluginConfiguration:()=>fC,openWorkspace:()=>AC,pluginCommands:()=>uC,runExit:()=>sk});qt();var ut=class extends nt{constructor(){super(...arguments);this.cwd=ge.String("--cwd",{hidden:!0})}validateAndExecute(){if(typeof this.cwd<"u")throw new it("The --cwd option is ambiguous when used anywhere else than the very first parameter provided in the command line, before even the command path");return super.validateAndExecute()}};Ye();Pt();qt();var rr=class extends it{constructor(e,r){let o=K.relative(e,r),a=K.join(e,Mt.fileName);super(`This command can only be run from within a workspace of your project (${o} isn't a workspace of ${a}).`)}};Ye();Pt();nA();Nl();b1();qt();var OAt=$e(zn());Za();var ehe=()=>new Map([["@yarnpkg/cli",o2],["@yarnpkg/core",s2],["@yarnpkg/fslib",Vw],["@yarnpkg/libzip",x1],["@yarnpkg/parsers",tI],["@yarnpkg/shell",T1],["clipanion",pI],["semver",OAt],["typanion",Ko]]);Ye();async function AC(t,e){let{project:r,workspace:o}=await St.find(t,e);if(!o)throw new rr(r.cwd,e);return o}Ye();Pt();nA();Nl();b1();qt();var tPt=$e(zn());Za();var tH={};Kt(tH,{AddCommand:()=>bh,BinCommand:()=>kh,CacheCleanCommand:()=>Qh,ClipanionCommand:()=>Wd,ConfigCommand:()=>Nh,ConfigGetCommand:()=>Fh,ConfigSetCommand:()=>Th,ConfigUnsetCommand:()=>Rh,DedupeCommand:()=>Lh,EntryCommand:()=>dC,ExecCommand:()=>Mh,ExplainCommand:()=>_h,ExplainPeerRequirementsCommand:()=>Oh,HelpCommand:()=>Vd,InfoCommand:()=>Hh,LinkCommand:()=>qh,NodeCommand:()=>Gh,PluginCheckCommand:()=>Yh,PluginImportCommand:()=>Kh,PluginImportSourcesCommand:()=>Jh,PluginListCommand:()=>Wh,PluginRemoveCommand:()=>zh,PluginRuntimeCommand:()=>Xh,RebuildCommand:()=>Zh,RemoveCommand:()=>$h,RunCommand:()=>e0,RunIndexCommand:()=>zd,SetResolutionCommand:()=>t0,SetVersionCommand:()=>Uh,SetVersionSourcesCommand:()=>Vh,UnlinkCommand:()=>r0,UpCommand:()=>Kf,VersionCommand:()=>Kd,WhyCommand:()=>n0,WorkspaceCommand:()=>o0,WorkspacesListCommand:()=>s0,YarnCommand:()=>jh,dedupeUtils:()=>gk,default:()=>Qgt,suggestUtils:()=>zc});var Tde=$e(ed());Ye();Ye();Ye();qt();var j0e=$e(A2());Za();var zc={};Kt(zc,{Modifier:()=>D8,Strategy:()=>fk,Target:()=>f2,WorkspaceModifier:()=>M0e,applyModifier:()=>ipt,extractDescriptorFromPath:()=>P8,extractRangeModifier:()=>O0e,fetchDescriptorFrom:()=>S8,findProjectDescriptors:()=>H0e,getModifier:()=>p2,getSuggestedDescriptors:()=>h2,makeWorkspaceDescriptor:()=>_0e,toWorkspaceModifier:()=>U0e});Ye();Ye();Pt();var v8=$e(zn()),rpt="workspace:",f2=(o=>(o.REGULAR="dependencies",o.DEVELOPMENT="devDependencies",o.PEER="peerDependencies",o))(f2||{}),D8=(o=>(o.CARET="^",o.TILDE="~",o.EXACT="",o))(D8||{}),M0e=(o=>(o.CARET="^",o.TILDE="~",o.EXACT="*",o))(M0e||{}),fk=(n=>(n.KEEP="keep",n.REUSE="reuse",n.PROJECT="project",n.LATEST="latest",n.CACHE="cache",n))(fk||{});function p2(t,e){return t.exact?"":t.caret?"^":t.tilde?"~":e.configuration.get("defaultSemverRangePrefix")}var npt=/^([\^~]?)[0-9]+(?:\.[0-9]+){0,2}(?:-\S+)?$/;function O0e(t,{project:e}){let r=t.match(npt);return r?r[1]:e.configuration.get("defaultSemverRangePrefix")}function ipt(t,e){let{protocol:r,source:o,params:a,selector:n}=W.parseRange(t.range);return v8.default.valid(n)&&(n=`${e}${t.range}`),W.makeDescriptor(t,W.makeRange({protocol:r,source:o,params:a,selector:n}))}function U0e(t){switch(t){case"^":return"^";case"~":return"~";case"":return"*";default:throw new Error(`Assertion failed: Unknown modifier: "${t}"`)}}function _0e(t,e){return W.makeDescriptor(t.anchoredDescriptor,`${rpt}${U0e(e)}`)}async function H0e(t,{project:e,target:r}){let o=new Map,a=n=>{let u=o.get(n.descriptorHash);return u||o.set(n.descriptorHash,u={descriptor:n,locators:[]}),u};for(let n of e.workspaces)if(r==="peerDependencies"){let u=n.manifest.peerDependencies.get(t.identHash);u!==void 0&&a(u).locators.push(n.anchoredLocator)}else{let u=n.manifest.dependencies.get(t.identHash),A=n.manifest.devDependencies.get(t.identHash);r==="devDependencies"?A!==void 0?a(A).locators.push(n.anchoredLocator):u!==void 0&&a(u).locators.push(n.anchoredLocator):u!==void 0?a(u).locators.push(n.anchoredLocator):A!==void 0&&a(A).locators.push(n.anchoredLocator)}return o}async function P8(t,{cwd:e,workspace:r}){return await spt(async o=>{K.isAbsolute(t)||(t=K.relative(r.cwd,K.resolve(e,t)),t.match(/^\.{0,2}\//)||(t=`./${t}`));let{project:a}=r,n=await S8(W.makeIdent(null,"archive"),t,{project:r.project,cache:o,workspace:r});if(!n)throw new Error("Assertion failed: The descriptor should have been found");let u=new Qi,A=a.configuration.makeResolver(),p=a.configuration.makeFetcher(),h={checksums:a.storedChecksums,project:a,cache:o,fetcher:p,report:u,resolver:A},E=A.bindDescriptor(n,r.anchoredLocator,h),I=W.convertDescriptorToLocator(E),v=await p.fetch(I,h),b=await Mt.find(v.prefixPath,{baseFs:v.packageFs});if(!b.name)throw new Error("Target path doesn't have a name");return W.makeDescriptor(b.name,t)})}async function h2(t,{project:e,workspace:r,cache:o,target:a,fixed:n,modifier:u,strategies:A,maxResults:p=1/0}){if(!(p>=0))throw new Error(`Invalid maxResults (${p})`);let[h,E]=t.range!=="unknown"?n||kr.validRange(t.range)||!t.range.match(/^[a-z0-9._-]+$/i)?[t.range,"latest"]:["unknown",t.range]:["unknown","latest"];if(h!=="unknown")return{suggestions:[{descriptor:t,name:`Use ${W.prettyDescriptor(e.configuration,t)}`,reason:"(unambiguous explicit request)"}],rejections:[]};let I=typeof r<"u"&&r!==null&&r.manifest[a].get(t.identHash)||null,v=[],b=[],C=async T=>{try{await T()}catch(L){b.push(L)}};for(let T of A){if(v.length>=p)break;switch(T){case"keep":await C(async()=>{I&&v.push({descriptor:I,name:`Keep ${W.prettyDescriptor(e.configuration,I)}`,reason:"(no changes)"})});break;case"reuse":await C(async()=>{for(let{descriptor:L,locators:U}of(await H0e(t,{project:e,target:a})).values()){if(U.length===1&&U[0].locatorHash===r.anchoredLocator.locatorHash&&A.includes("keep"))continue;let J=`(originally used by ${W.prettyLocator(e.configuration,U[0])}`;J+=U.length>1?` and ${U.length-1} other${U.length>2?"s":""})`:")",v.push({descriptor:L,name:`Reuse ${W.prettyDescriptor(e.configuration,L)}`,reason:J})}});break;case"cache":await C(async()=>{for(let L of e.storedDescriptors.values())L.identHash===t.identHash&&v.push({descriptor:L,name:`Reuse ${W.prettyDescriptor(e.configuration,L)}`,reason:"(already used somewhere in the lockfile)"})});break;case"project":await C(async()=>{if(r.manifest.name!==null&&t.identHash===r.manifest.name.identHash)return;let L=e.tryWorkspaceByIdent(t);if(L===null)return;let U=_0e(L,u);v.push({descriptor:U,name:`Attach ${W.prettyDescriptor(e.configuration,U)}`,reason:`(local workspace at ${de.pretty(e.configuration,L.relativeCwd,de.Type.PATH)})`})});break;case"latest":{let L=e.configuration.get("enableNetwork"),U=e.configuration.get("enableOfflineMode");await C(async()=>{if(a==="peerDependencies")v.push({descriptor:W.makeDescriptor(t,"*"),name:"Use *",reason:"(catch-all peer dependency pattern)"});else if(!L&&!U)v.push({descriptor:null,name:"Resolve from latest",reason:de.pretty(e.configuration,"(unavailable because enableNetwork is toggled off)","grey")});else{let J=await S8(t,E,{project:e,cache:o,workspace:r,modifier:u});J&&v.push({descriptor:J,name:`Use ${W.prettyDescriptor(e.configuration,J)}`,reason:`(resolved from ${U?"the cache":"latest"})`})}})}break}}return{suggestions:v.slice(0,p),rejections:b.slice(0,p)}}async function S8(t,e,{project:r,cache:o,workspace:a,preserveModifier:n=!0,modifier:u}){let A=r.configuration.normalizeDependency(W.makeDescriptor(t,e)),p=new Qi,h=r.configuration.makeFetcher(),E=r.configuration.makeResolver(),I={project:r,fetcher:h,cache:o,checksums:r.storedChecksums,report:p,cacheOptions:{skipIntegrityCheck:!0}},v={...I,resolver:E,fetchOptions:I},b=E.bindDescriptor(A,a.anchoredLocator,v),C=await E.getCandidates(b,{},v);if(C.length===0)return null;let T=C[0],{protocol:L,source:U,params:J,selector:te}=W.parseRange(W.convertToManifestRange(T.reference));if(L===r.configuration.get("defaultProtocol")&&(L=null),v8.default.valid(te)){let le=te;if(typeof u<"u")te=u+te;else if(n!==!1){let ye=typeof n=="string"?n:A.range;te=O0e(ye,{project:r})+te}let pe=W.makeDescriptor(T,W.makeRange({protocol:L,source:U,params:J,selector:te}));(await E.getCandidates(r.configuration.normalizeDependency(pe),{},v)).length!==1&&(te=le)}return W.makeDescriptor(T,W.makeRange({protocol:L,source:U,params:J,selector:te}))}async function spt(t){return await oe.mktempPromise(async e=>{let r=Ve.create(e);return r.useWithSource(e,{enableMirror:!1,compressionLevel:0},e,{overwrite:!0}),await t(new Lr(e,{configuration:r,check:!1,immutable:!1}))})}var bh=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.fixed=ge.Boolean("-F,--fixed",!1,{description:"Store dependency tags as-is instead of resolving them"});this.exact=ge.Boolean("-E,--exact",!1,{description:"Don't use any semver modifier on the resolved range"});this.tilde=ge.Boolean("-T,--tilde",!1,{description:"Use the `~` semver modifier on the resolved range"});this.caret=ge.Boolean("-C,--caret",!1,{description:"Use the `^` semver modifier on the resolved range"});this.dev=ge.Boolean("-D,--dev",!1,{description:"Add a package as a dev dependency"});this.peer=ge.Boolean("-P,--peer",!1,{description:"Add a package as a peer dependency"});this.optional=ge.Boolean("-O,--optional",!1,{description:"Add / upgrade a package to an optional regular / peer dependency"});this.preferDev=ge.Boolean("--prefer-dev",!1,{description:"Add / upgrade a package to a dev dependency"});this.interactive=ge.Boolean("-i,--interactive",{description:"Reuse the specified package from other workspaces in the project"});this.cached=ge.Boolean("--cached",!1,{description:"Reuse the highest version already used somewhere within the project"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:Vs(pl)});this.silent=ge.Boolean("--silent",{hidden:!0});this.packages=ge.Rest()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(!a)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=this.fixed,A=this.interactive??r.get("preferInteractive"),p=A||r.get("preferReuse"),h=p2(this,o),E=[p?"reuse":void 0,"project",this.cached?"cache":void 0,"latest"].filter(U=>typeof U<"u"),I=A?1/0:1,v=await Promise.all(this.packages.map(async U=>{let J=U.match(/^\.{0,2}\//)?await P8(U,{cwd:this.context.cwd,workspace:a}):W.tryParseDescriptor(U),te=U.match(/^(https?:|git@github)/);if(te)throw new it(`It seems you are trying to add a package using a ${de.pretty(r,`${te[0]}...`,de.Type.RANGE)} url; we now require package names to be explicitly specified. +Try running the command again with the package name prefixed: ${de.pretty(r,"yarn add",de.Type.CODE)} ${de.pretty(r,W.makeDescriptor(W.makeIdent(null,"my-package"),`${te[0]}...`),de.Type.DESCRIPTOR)}`);if(!J)throw new it(`The ${de.pretty(r,U,de.Type.CODE)} string didn't match the required format (package-name@range). Did you perhaps forget to explicitly reference the package name?`);let le=opt(a,J,{dev:this.dev,peer:this.peer,preferDev:this.preferDev,optional:this.optional});return await Promise.all(le.map(async Ae=>{let ye=await h2(J,{project:o,workspace:a,cache:n,fixed:u,target:Ae,modifier:h,strategies:E,maxResults:I});return{request:J,suggestedDescriptors:ye,target:Ae}}))})).then(U=>U.flat()),b=await AA.start({configuration:r,stdout:this.context.stdout,suggestInstall:!1},async U=>{for(let{request:J,suggestedDescriptors:{suggestions:te,rejections:le}}of v)if(te.filter(Ae=>Ae.descriptor!==null).length===0){let[Ae]=le;if(typeof Ae>"u")throw new Error("Assertion failed: Expected an error to have been set");o.configuration.get("enableNetwork")?U.reportError(27,`${W.prettyDescriptor(r,J)} can't be resolved to a satisfying range`):U.reportError(27,`${W.prettyDescriptor(r,J)} can't be resolved to a satisfying range (note: network resolution has been disabled)`),U.reportSeparator(),U.reportExceptionOnce(Ae)}});if(b.hasErrors())return b.exitCode();let C=!1,T=[],L=[];for(let{suggestedDescriptors:{suggestions:U},target:J}of v){let te,le=U.filter(ae=>ae.descriptor!==null),pe=le[0].descriptor,Ae=le.every(ae=>W.areDescriptorsEqual(ae.descriptor,pe));le.length===1||Ae?te=pe:(C=!0,{answer:te}=await(0,j0e.prompt)({type:"select",name:"answer",message:"Which range do you want to use?",choices:U.map(({descriptor:ae,name:we,reason:Pe})=>ae?{name:we,hint:Pe,descriptor:ae}:{name:we,hint:Pe,disabled:!0}),onCancel:()=>process.exit(130),result(ae){return this.find(ae,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let ye=a.manifest[J].get(te.identHash);(typeof ye>"u"||ye.descriptorHash!==te.descriptorHash)&&(a.manifest[J].set(te.identHash,te),this.optional&&(J==="dependencies"?a.manifest.ensureDependencyMeta({...te,range:"unknown"}).optional=!0:J==="peerDependencies"&&(a.manifest.ensurePeerDependencyMeta({...te,range:"unknown"}).optional=!0)),typeof ye>"u"?T.push([a,J,te,E]):L.push([a,J,ye,te]))}return await r.triggerMultipleHooks(U=>U.afterWorkspaceDependencyAddition,T),await r.triggerMultipleHooks(U=>U.afterWorkspaceDependencyReplacement,L),C&&this.context.stdout.write(` +`),await o.installWithNewReport({json:this.json,stdout:this.context.stdout,quiet:this.context.quiet},{cache:n,mode:this.mode})}};bh.paths=[["add"]],bh.usage=nt.Usage({description:"add dependencies to the project",details:"\n This command adds a package to the package.json for the nearest workspace.\n\n - If it didn't exist before, the package will by default be added to the regular `dependencies` field, but this behavior can be overriden thanks to the `-D,--dev` flag (which will cause the dependency to be added to the `devDependencies` field instead) and the `-P,--peer` flag (which will do the same but for `peerDependencies`).\n\n - If the package was already listed in your dependencies, it will by default be upgraded whether it's part of your `dependencies` or `devDependencies` (it won't ever update `peerDependencies`, though).\n\n - If set, the `--prefer-dev` flag will operate as a more flexible `-D,--dev` in that it will add the package to your `devDependencies` if it isn't already listed in either `dependencies` or `devDependencies`, but it will also happily upgrade your `dependencies` if that's what you already use (whereas `-D,--dev` would throw an exception).\n\n - If set, the `-O,--optional` flag will add the package to the `optionalDependencies` field and, in combination with the `-P,--peer` flag, it will add the package as an optional peer dependency. If the package was already listed in your `dependencies`, it will be upgraded to `optionalDependencies`. If the package was already listed in your `peerDependencies`, in combination with the `-P,--peer` flag, it will be upgraded to an optional peer dependency: `\"peerDependenciesMeta\": { \"\": { \"optional\": true } }`\n\n - If the added package doesn't specify a range at all its `latest` tag will be resolved and the returned version will be used to generate a new semver range (using the `^` modifier by default unless otherwise configured via the `defaultSemverRangePrefix` configuration, or the `~` modifier if `-T,--tilde` is specified, or no modifier at all if `-E,--exact` is specified). Two exceptions to this rule: the first one is that if the package is a workspace then its local version will be used, and the second one is that if you use `-P,--peer` the default range will be `*` and won't be resolved at all.\n\n - If the added package specifies a range (such as `^1.0.0`, `latest`, or `rc`), Yarn will add this range as-is in the resulting package.json entry (in particular, tags such as `rc` will be encoded as-is rather than being converted into a semver range).\n\n If the `--cached` option is used, Yarn will preferably reuse the highest version already used somewhere within the project, even if through a transitive dependency.\n\n If the `-i,--interactive` option is used (or if the `preferInteractive` settings is toggled on) the command will first try to check whether other workspaces in the project use the specified package and, if so, will offer to reuse them.\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n For a compilation of all the supported protocols, please consult the dedicated page from our website: https://yarnpkg.com/protocols.\n ",examples:[["Add a regular package to the current workspace","$0 add lodash"],["Add a specific version for a package to the current workspace","$0 add lodash@1.2.3"],["Add a package from a GitHub repository (the master branch) to the current workspace using a URL","$0 add lodash@https://github.com/lodash/lodash"],["Add a package from a GitHub repository (the master branch) to the current workspace using the GitHub protocol","$0 add lodash@github:lodash/lodash"],["Add a package from a GitHub repository (the master branch) to the current workspace using the GitHub protocol (shorthand)","$0 add lodash@lodash/lodash"],["Add a package from a specific branch of a GitHub repository to the current workspace using the GitHub protocol (shorthand)","$0 add lodash-es@lodash/lodash#es"]]});function opt(t,e,{dev:r,peer:o,preferDev:a,optional:n}){let u=t.manifest["dependencies"].has(e.identHash),A=t.manifest["devDependencies"].has(e.identHash),p=t.manifest["peerDependencies"].has(e.identHash);if((r||o)&&u)throw new it(`Package "${W.prettyIdent(t.project.configuration,e)}" is already listed as a regular dependency - remove the -D,-P flags or remove it from your dependencies first`);if(!r&&!o&&p)throw new it(`Package "${W.prettyIdent(t.project.configuration,e)}" is already listed as a peer dependency - use either of -D or -P, or remove it from your peer dependencies first`);if(n&&A)throw new it(`Package "${W.prettyIdent(t.project.configuration,e)}" is already listed as a dev dependency - remove the -O flag or remove it from your dev dependencies first`);if(n&&!o&&p)throw new it(`Package "${W.prettyIdent(t.project.configuration,e)}" is already listed as a peer dependency - remove the -O flag or add the -P flag or remove it from your peer dependencies first`);if((r||a)&&n)throw new it(`Package "${W.prettyIdent(t.project.configuration,e)}" cannot simultaneously be a dev dependency and an optional dependency`);let h=[];return o&&h.push("peerDependencies"),(r||a)&&h.push("devDependencies"),n&&h.push("dependencies"),h.length>0?h:A?["devDependencies"]:p?["peerDependencies"]:["dependencies"]}Ye();Ye();qt();var kh=class extends ut{constructor(){super(...arguments);this.verbose=ge.Boolean("-v,--verbose",!1,{description:"Print both the binary name and the locator of the package that provides the binary"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.name=ge.String({required:!1})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,locator:a}=await St.find(r,this.context.cwd);if(await o.restoreInstallState(),this.name){let A=(await un.getPackageAccessibleBinaries(a,{project:o})).get(this.name);if(!A)throw new it(`Couldn't find a binary named "${this.name}" for package "${W.prettyLocator(r,a)}"`);let[,p]=A;return this.context.stdout.write(`${p} +`),0}return(await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout},async u=>{let A=await un.getPackageAccessibleBinaries(a,{project:o}),h=Array.from(A.keys()).reduce((E,I)=>Math.max(E,I.length),0);for(let[E,[I,v]]of A)u.reportJson({name:E,source:W.stringifyIdent(I),path:v});if(this.verbose)for(let[E,[I]]of A)u.reportInfo(null,`${E.padEnd(h," ")} ${W.prettyLocator(r,I)}`);else for(let E of A.keys())u.reportInfo(null,E)})).exitCode()}};kh.paths=[["bin"]],kh.usage=nt.Usage({description:"get the path to a binary script",details:` + When used without arguments, this command will print the list of all the binaries available in the current workspace. Adding the \`-v,--verbose\` flag will cause the output to contain both the binary name and the locator of the package that provides the binary. + + When an argument is specified, this command will just print the path to the binary on the standard output and exit. Note that the reported path may be stored within a zip archive. + `,examples:[["List all the available binaries","$0 bin"],["Print the path to a specific binary","$0 bin eslint"]]});Ye();Pt();qt();var Qh=class extends ut{constructor(){super(...arguments);this.mirror=ge.Boolean("--mirror",!1,{description:"Remove the global cache files instead of the local cache files"});this.all=ge.Boolean("--all",!1,{description:"Remove both the global cache files and the local cache files of the current project"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),o=await Lr.find(r);return(await Nt.start({configuration:r,stdout:this.context.stdout},async()=>{let n=(this.all||this.mirror)&&o.mirrorCwd!==null,u=!this.mirror;n&&(await oe.removePromise(o.mirrorCwd),await r.triggerHook(A=>A.cleanGlobalArtifacts,r)),u&&await oe.removePromise(o.cwd)})).exitCode()}};Qh.paths=[["cache","clean"],["cache","clear"]],Qh.usage=nt.Usage({description:"remove the shared cache files",details:` + This command will remove all the files from the cache. + `,examples:[["Remove all the local archives","$0 cache clean"],["Remove all the archives stored in the ~/.yarn directory","$0 cache clean --mirror"]]});Ye();qt();var G0e=$e(g2()),x8=Be("util"),Fh=class extends ut{constructor(){super(...arguments);this.why=ge.Boolean("--why",!1,{description:"Print the explanation for why a setting has its value"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.unsafe=ge.Boolean("--no-redacted",!1,{description:"Don't redact secrets (such as tokens) from the output"});this.name=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),o=this.name.replace(/[.[].*$/,""),a=this.name.replace(/^[^.[]*/,"");if(typeof r.settings.get(o)>"u")throw new it(`Couldn't find a configuration settings named "${o}"`);let u=r.getSpecial(o,{hideSecrets:!this.unsafe,getNativePaths:!0}),A=je.convertMapsToIndexableObjects(u),p=a?(0,G0e.default)(A,a):A,h=await Nt.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async E=>{E.reportJson(p)});if(!this.json){if(typeof p=="string")return this.context.stdout.write(`${p} +`),h.exitCode();x8.inspect.styles.name="cyan",this.context.stdout.write(`${(0,x8.inspect)(p,{depth:1/0,colors:r.get("enableColors"),compact:!1})} +`)}return h.exitCode()}};Fh.paths=[["config","get"]],Fh.usage=nt.Usage({description:"read a configuration settings",details:` + This command will print a configuration setting. + + Secrets (such as tokens) will be redacted from the output by default. If this behavior isn't desired, set the \`--no-redacted\` to get the untransformed value. + `,examples:[["Print a simple configuration setting","yarn config get yarnPath"],["Print a complex configuration setting","yarn config get packageExtensions"],["Print a nested field from the configuration",`yarn config get 'npmScopes["my-company"].npmRegistryServer'`],["Print a token from the configuration","yarn config get npmAuthToken --no-redacted"],["Print a configuration setting as JSON","yarn config get packageExtensions --json"]]});Ye();qt();var Rge=$e(F8()),Nge=$e(g2()),Lge=$e(T8()),R8=Be("util"),Th=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Set complex configuration settings to JSON values"});this.home=ge.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=ge.String();this.value=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),o=()=>{if(!r.projectCwd)throw new it("This command must be run from within a project folder");return r.projectCwd},a=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof r.settings.get(a)>"u")throw new it(`Couldn't find a configuration settings named "${a}"`);if(a==="enableStrictSettings")throw new it("This setting only affects the file it's in, and thus cannot be set from the CLI");let A=this.json?JSON.parse(this.value):this.value;await(this.home?C=>Ve.updateHomeConfiguration(C):C=>Ve.updateConfiguration(o(),C))(C=>{if(n){let T=(0,Rge.default)(C);return(0,Lge.default)(T,this.name,A),T}else return{...C,[a]:A}});let E=(await Ve.find(this.context.cwd,this.context.plugins)).getSpecial(a,{hideSecrets:!0,getNativePaths:!0}),I=je.convertMapsToIndexableObjects(E),v=n?(0,Nge.default)(I,n):I;return(await Nt.start({configuration:r,includeFooter:!1,stdout:this.context.stdout},async C=>{R8.inspect.styles.name="cyan",C.reportInfo(0,`Successfully set ${this.name} to ${(0,R8.inspect)(v,{depth:1/0,colors:r.get("enableColors"),compact:!1})}`)})).exitCode()}};Th.paths=[["config","set"]],Th.usage=nt.Usage({description:"change a configuration settings",details:` + This command will set a configuration setting. + + When used without the \`--json\` flag, it can only set a simple configuration setting (a string, a number, or a boolean). + + When used with the \`--json\` flag, it can set both simple and complex configuration settings, including Arrays and Objects. + `,examples:[["Set a simple configuration setting (a string, a number, or a boolean)","yarn config set initScope myScope"],["Set a simple configuration setting (a string, a number, or a boolean) using the `--json` flag",'yarn config set initScope --json \\"myScope\\"'],["Set a complex configuration setting (an Array) using the `--json` flag",`yarn config set unsafeHttpWhitelist --json '["*.example.com", "example.com"]'`],["Set a complex configuration setting (an Object) using the `--json` flag",`yarn config set packageExtensions --json '{ "@babel/parser@*": { "dependencies": { "@babel/types": "*" } } }'`],["Set a nested configuration setting",'yarn config set npmScopes.company.npmRegistryServer "https://npm.example.com"'],["Set a nested configuration setting using indexed access for non-simple keys",`yarn config set 'npmRegistries["//npm.example.com"].npmAuthToken' "ffffffff-ffff-ffff-ffff-ffffffffffff"`]]});Ye();qt();var Vge=$e(F8()),Kge=$e(_ge()),Jge=$e(L8()),Rh=class extends ut{constructor(){super(...arguments);this.home=ge.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),o=()=>{if(!r.projectCwd)throw new it("This command must be run from within a project folder");return r.projectCwd},a=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof r.settings.get(a)>"u")throw new it(`Couldn't find a configuration settings named "${a}"`);let A=this.home?h=>Ve.updateHomeConfiguration(h):h=>Ve.updateConfiguration(o(),h);return(await Nt.start({configuration:r,includeFooter:!1,stdout:this.context.stdout},async h=>{let E=!1;await A(I=>{if(!(0,Kge.default)(I,this.name))return h.reportWarning(0,`Configuration doesn't contain setting ${this.name}; there is nothing to unset`),E=!0,I;let v=n?(0,Vge.default)(I):{...I};return(0,Jge.default)(v,this.name),v}),E||h.reportInfo(0,`Successfully unset ${this.name}`)})).exitCode()}};Rh.paths=[["config","unset"]],Rh.usage=nt.Usage({description:"unset a configuration setting",details:` + This command will unset a configuration setting. + `,examples:[["Unset a simple configuration setting","yarn config unset initScope"],["Unset a complex configuration setting","yarn config unset packageExtensions"],["Unset a nested configuration setting","yarn config unset npmScopes.company.npmRegistryServer"]]});Ye();Pt();qt();var hk=Be("util"),Nh=class extends ut{constructor(){super(...arguments);this.noDefaults=ge.Boolean("--no-defaults",!1,{description:"Omit the default values from the display"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.verbose=ge.Boolean("-v,--verbose",{hidden:!0});this.why=ge.Boolean("--why",{hidden:!0});this.names=ge.Rest()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins,{strict:!1}),o=await NE({configuration:r,stdout:this.context.stdout,forceError:this.json},[{option:this.verbose,message:"The --verbose option is deprecated, the settings' descriptions are now always displayed"},{option:this.why,message:"The --why option is deprecated, the settings' sources are now always displayed"}]);if(o!==null)return o;let a=this.names.length>0?[...new Set(this.names)].sort():[...r.settings.keys()].sort(),n,u=await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async A=>{if(r.invalid.size>0&&!this.json){for(let[p,h]of r.invalid)A.reportError(34,`Invalid configuration key "${p}" in ${h}`);A.reportSeparator()}if(this.json)for(let p of a){let h=r.settings.get(p);typeof h>"u"&&A.reportError(34,`No configuration key named "${p}"`);let E=r.getSpecial(p,{hideSecrets:!0,getNativePaths:!0}),I=r.sources.get(p)??"",v=I&&I[0]!=="<"?ue.fromPortablePath(I):I;A.reportJson({key:p,effective:E,source:v,...h})}else{let p={breakLength:1/0,colors:r.get("enableColors"),maxArrayLength:2},h={},E={children:h};for(let I of a){if(this.noDefaults&&!r.sources.has(I))continue;let v=r.settings.get(I),b=r.sources.get(I)??"",C=r.getSpecial(I,{hideSecrets:!0,getNativePaths:!0}),T={Description:{label:"Description",value:de.tuple(de.Type.MARKDOWN,{text:v.description,format:this.cli.format(),paragraphs:!1})},Source:{label:"Source",value:de.tuple(b[0]==="<"?de.Type.CODE:de.Type.PATH,b)}};h[I]={value:de.tuple(de.Type.CODE,I),children:T};let L=(U,J)=>{for(let[te,le]of J)if(le instanceof Map){let pe={};U[te]={children:pe},L(pe,le)}else U[te]={label:te,value:de.tuple(de.Type.NO_HINT,(0,hk.inspect)(le,p))}};C instanceof Map?L(T,C):T.Value={label:"Value",value:de.tuple(de.Type.NO_HINT,(0,hk.inspect)(C,p))}}a.length!==1&&(n=void 0),$s.emitTree(E,{configuration:r,json:this.json,stdout:this.context.stdout,separators:2})}});if(!this.json&&typeof n<"u"){let A=a[0],p=(0,hk.inspect)(r.getSpecial(A,{hideSecrets:!0,getNativePaths:!0}),{colors:r.get("enableColors")});this.context.stdout.write(` +`),this.context.stdout.write(`${p} +`)}return u.exitCode()}};Nh.paths=[["config"]],Nh.usage=nt.Usage({description:"display the current configuration",details:` + This command prints the current active configuration settings. + `,examples:[["Print the active configuration settings","$0 config"]]});Ye();qt();Za();var gk={};Kt(gk,{Strategy:()=>d2,acceptedStrategies:()=>j0t,dedupe:()=>M8});Ye();Ye();var zge=$e(Zo()),d2=(e=>(e.HIGHEST="highest",e))(d2||{}),j0t=new Set(Object.values(d2)),q0t={highest:async(t,e,{resolver:r,fetcher:o,resolveOptions:a,fetchOptions:n})=>{let u=new Map;for(let[p,h]of t.storedResolutions){let E=t.storedDescriptors.get(p);if(typeof E>"u")throw new Error(`Assertion failed: The descriptor (${p}) should have been registered`);je.getSetWithDefault(u,E.identHash).add(h)}let A=new Map(je.mapAndFilter(t.storedDescriptors.values(),p=>W.isVirtualDescriptor(p)?je.mapAndFilter.skip:[p.descriptorHash,je.makeDeferred()]));for(let p of t.storedDescriptors.values()){let h=A.get(p.descriptorHash);if(typeof h>"u")throw new Error(`Assertion failed: The descriptor (${p.descriptorHash}) should have been registered`);let E=t.storedResolutions.get(p.descriptorHash);if(typeof E>"u")throw new Error(`Assertion failed: The resolution (${p.descriptorHash}) should have been registered`);let I=t.originalPackages.get(E);if(typeof I>"u")throw new Error(`Assertion failed: The package (${E}) should have been registered`);Promise.resolve().then(async()=>{let v=r.getResolutionDependencies(p,a),b=Object.fromEntries(await je.allSettledSafe(Object.entries(v).map(async([te,le])=>{let pe=A.get(le.descriptorHash);if(typeof pe>"u")throw new Error(`Assertion failed: The descriptor (${le.descriptorHash}) should have been registered`);let Ae=await pe.promise;if(!Ae)throw new Error("Assertion failed: Expected the dependency to have been through the dedupe process itself");return[te,Ae.updatedPackage]})));if(e.length&&!zge.default.isMatch(W.stringifyIdent(p),e)||!r.shouldPersistResolution(I,a))return I;let C=u.get(p.identHash);if(typeof C>"u")throw new Error(`Assertion failed: The resolutions (${p.identHash}) should have been registered`);if(C.size===1)return I;let T=[...C].map(te=>{let le=t.originalPackages.get(te);if(typeof le>"u")throw new Error(`Assertion failed: The package (${te}) should have been registered`);return le}),L=await r.getSatisfying(p,b,T,a),U=L.locators?.[0];if(typeof U>"u"||!L.sorted)return I;let J=t.originalPackages.get(U.locatorHash);if(typeof J>"u")throw new Error(`Assertion failed: The package (${U.locatorHash}) should have been registered`);return J}).then(async v=>{let b=await t.preparePackage(v,{resolver:r,resolveOptions:a});h.resolve({descriptor:p,currentPackage:I,updatedPackage:v,resolvedPackage:b})}).catch(v=>{h.reject(v)})}return[...A.values()].map(p=>p.promise)}};async function M8(t,{strategy:e,patterns:r,cache:o,report:a}){let{configuration:n}=t,u=new Qi,A=n.makeResolver(),p=n.makeFetcher(),h={cache:o,checksums:t.storedChecksums,fetcher:p,project:t,report:u,cacheOptions:{skipIntegrityCheck:!0}},E={project:t,resolver:A,report:u,fetchOptions:h};return await a.startTimerPromise("Deduplication step",async()=>{let I=q0t[e],v=await I(t,r,{resolver:A,resolveOptions:E,fetcher:p,fetchOptions:h}),b=Xs.progressViaCounter(v.length);await a.reportProgress(b);let C=0;await Promise.all(v.map(U=>U.then(J=>{if(J===null||J.currentPackage.locatorHash===J.updatedPackage.locatorHash)return;C++;let{descriptor:te,currentPackage:le,updatedPackage:pe}=J;a.reportInfo(0,`${W.prettyDescriptor(n,te)} can be deduped from ${W.prettyLocator(n,le)} to ${W.prettyLocator(n,pe)}`),a.reportJson({descriptor:W.stringifyDescriptor(te),currentResolution:W.stringifyLocator(le),updatedResolution:W.stringifyLocator(pe)}),t.storedResolutions.set(te.descriptorHash,pe.locatorHash)}).finally(()=>b.tick())));let T;switch(C){case 0:T="No packages";break;case 1:T="One package";break;default:T=`${C} packages`}let L=de.pretty(n,e,de.Type.CODE);return a.reportInfo(0,`${T} can be deduped using the ${L} strategy`),C})}var Lh=class extends ut{constructor(){super(...arguments);this.strategy=ge.String("-s,--strategy","highest",{description:"The strategy to use when deduping dependencies",validator:Vs(d2)});this.check=ge.Boolean("-c,--check",!1,{description:"Exit with exit code 1 when duplicates are found, without persisting the dependency tree"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:Vs(pl)});this.patterns=ge.Rest()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o}=await St.find(r,this.context.cwd),a=await Lr.find(r);await o.restoreInstallState({restoreResolutions:!1});let n=0,u=await Nt.start({configuration:r,includeFooter:!1,stdout:this.context.stdout,json:this.json},async A=>{n=await M8(o,{strategy:this.strategy,patterns:this.patterns,cache:a,report:A})});return u.hasErrors()?u.exitCode():this.check?n?1:0:await o.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:a,mode:this.mode})}};Lh.paths=[["dedupe"]],Lh.usage=nt.Usage({description:"deduplicate dependencies with overlapping ranges",details:"\n Duplicates are defined as descriptors with overlapping ranges being resolved and locked to different locators. They are a natural consequence of Yarn's deterministic installs, but they can sometimes pile up and unnecessarily increase the size of your project.\n\n This command dedupes dependencies in the current project using different strategies (only one is implemented at the moment):\n\n - `highest`: Reuses (where possible) the locators with the highest versions. This means that dependencies can only be upgraded, never downgraded. It's also guaranteed that it never takes more than a single pass to dedupe the entire dependency tree.\n\n **Note:** Even though it never produces a wrong dependency tree, this command should be used with caution, as it modifies the dependency tree, which can sometimes cause problems when packages don't strictly follow semver recommendations. Because of this, it is recommended to also review the changes manually.\n\n If set, the `-c,--check` flag will only report the found duplicates, without persisting the modified dependency tree. If changes are found, the command will exit with a non-zero exit code, making it suitable for CI purposes.\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n This command accepts glob patterns as arguments (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n ### In-depth explanation:\n\n Yarn doesn't deduplicate dependencies by default, otherwise installs wouldn't be deterministic and the lockfile would be useless. What it actually does is that it tries to not duplicate dependencies in the first place.\n\n **Example:** If `foo@^2.3.4` (a dependency of a dependency) has already been resolved to `foo@2.3.4`, running `yarn add foo@*`will cause Yarn to reuse `foo@2.3.4`, even if the latest `foo` is actually `foo@2.10.14`, thus preventing unnecessary duplication.\n\n Duplication happens when Yarn can't unlock dependencies that have already been locked inside the lockfile.\n\n **Example:** If `foo@^2.3.4` (a dependency of a dependency) has already been resolved to `foo@2.3.4`, running `yarn add foo@2.10.14` will cause Yarn to install `foo@2.10.14` because the existing resolution doesn't satisfy the range `2.10.14`. This behavior can lead to (sometimes) unwanted duplication, since now the lockfile contains 2 separate resolutions for the 2 `foo` descriptors, even though they have overlapping ranges, which means that the lockfile can be simplified so that both descriptors resolve to `foo@2.10.14`.\n ",examples:[["Dedupe all packages","$0 dedupe"],["Dedupe all packages using a specific strategy","$0 dedupe --strategy highest"],["Dedupe a specific package","$0 dedupe lodash"],["Dedupe all packages with the `@babel/*` scope","$0 dedupe '@babel/*'"],["Check for duplicates (can be used as a CI step)","$0 dedupe --check"]]});Ye();qt();var Wd=class extends ut{async execute(){let{plugins:e}=await Ve.find(this.context.cwd,this.context.plugins),r=[];for(let u of e){let{commands:A}=u[1];if(A){let h=as.from(A).definitions();r.push([u[0],h])}}let o=this.cli.definitions(),a=(u,A)=>u.split(" ").slice(1).join()===A.split(" ").slice(1).join(),n=Xge()["@yarnpkg/builder"].bundles.standard;for(let u of r){let A=u[1];for(let p of A)o.find(h=>a(h.path,p.path)).plugin={name:u[0],isDefault:n.includes(u[0])}}this.context.stdout.write(`${JSON.stringify(o,null,2)} +`)}};Wd.paths=[["--clipanion=definitions"]];var Vd=class extends ut{async execute(){this.context.stdout.write(this.cli.usage(null))}};Vd.paths=[["help"],["--help"],["-h"]];Ye();Pt();qt();var dC=class extends ut{constructor(){super(...arguments);this.leadingArgument=ge.String();this.args=ge.Proxy()}async execute(){if(this.leadingArgument.match(/[\\/]/)&&!W.tryParseIdent(this.leadingArgument)){let r=K.resolve(this.context.cwd,ue.toPortablePath(this.leadingArgument));return await this.cli.run(this.args,{cwd:r})}else return await this.cli.run(["run",this.leadingArgument,...this.args])}};Ye();var Kd=class extends ut{async execute(){this.context.stdout.write(`${tn||""} +`)}};Kd.paths=[["-v"],["--version"]];Ye();Ye();qt();var Mh=class extends ut{constructor(){super(...arguments);this.commandName=ge.String();this.args=ge.Proxy()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,locator:a}=await St.find(r,this.context.cwd);return await o.restoreInstallState(),await un.executePackageShellcode(a,this.commandName,this.args,{cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,project:o})}};Mh.paths=[["exec"]],Mh.usage=nt.Usage({description:"execute a shell script",details:` + This command simply executes a shell script within the context of the root directory of the active workspace using the portable shell. + + It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment). + `,examples:[["Execute a single shell command","$0 exec echo Hello World"],["Execute a shell script",'$0 exec "tsc & babel src --out-dir lib"']]});Ye();qt();Za();var Oh=class extends ut{constructor(){super(...arguments);this.hash=ge.String({validator:aP(Ey(),[sI(/^p[0-9a-f]{5}$/)])})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o}=await St.find(r,this.context.cwd);return await o.restoreInstallState({restoreResolutions:!1}),await o.applyLightResolution(),await Y0t(this.hash,o,{stdout:this.context.stdout})}};Oh.paths=[["explain","peer-requirements"]],Oh.usage=nt.Usage({description:"explain a set of peer requirements",details:` + A set of peer requirements represents all peer requirements that a dependent must satisfy when providing a given peer request to a requester and its descendants. + + When the hash argument is specified, this command prints a detailed explanation of all requirements of the set corresponding to the hash and whether they're satisfied or not. + + When used without arguments, this command lists all sets of peer requirements and the corresponding hash that can be used to get detailed information about a given set. + + **Note:** A hash is a six-letter p-prefixed code that can be obtained from peer dependency warnings or from the list of all peer requirements (\`yarn explain peer-requirements\`). + `,examples:[["Explain the corresponding set of peer requirements for a hash","$0 explain peer-requirements p1a4ed"],["List all sets of peer requirements","$0 explain peer-requirements"]]});async function Y0t(t,e,r){let o=e.peerWarnings.find(n=>n.hash===t);if(typeof o>"u")throw new Error(`No peerDependency requirements found for hash: "${t}"`);return(await Nt.start({configuration:e.configuration,stdout:r.stdout,includeFooter:!1,includePrefix:!1},async n=>{let u=de.mark(e.configuration);switch(o.type){case 2:{n.reportInfo(0,`We have a problem with ${de.pretty(e.configuration,o.requested,de.Type.IDENT)}, which is provided with version ${W.prettyReference(e.configuration,o.version)}.`),n.reportInfo(0,"It is needed by the following direct dependencies of workspaces in your project:"),n.reportSeparator();for(let h of o.requesters.values()){let E=e.storedPackages.get(h.locatorHash);if(!E)throw new Error("Assertion failed: Expected the package to be registered");let I=E?.peerDependencies.get(o.requested.identHash);if(!I)throw new Error("Assertion failed: Expected the package to list the peer dependency");let v=kr.satisfiesWithPrereleases(o.version,I.range)?u.Check:u.Cross;n.reportInfo(null,` ${v} ${W.prettyLocator(e.configuration,h)} (via ${W.prettyRange(e.configuration,I.range)})`)}let A=[...o.links.values()].filter(h=>!o.requesters.has(h.locatorHash));if(A.length>0){n.reportSeparator(),n.reportInfo(0,`However, those packages themselves have more dependencies listing ${W.prettyIdent(e.configuration,o.requested)} as peer dependency:`),n.reportSeparator();for(let h of A){let E=e.storedPackages.get(h.locatorHash);if(!E)throw new Error("Assertion failed: Expected the package to be registered");let I=E?.peerDependencies.get(o.requested.identHash);if(!I)throw new Error("Assertion failed: Expected the package to list the peer dependency");let v=kr.satisfiesWithPrereleases(o.version,I.range)?u.Check:u.Cross;n.reportInfo(null,` ${v} ${W.prettyLocator(e.configuration,h)} (via ${W.prettyRange(e.configuration,I.range)})`)}}let p=Array.from(o.links.values(),h=>{let E=e.storedPackages.get(h.locatorHash);if(typeof E>"u")throw new Error("Assertion failed: Expected the package to be registered");let I=E.peerDependencies.get(o.requested.identHash);if(typeof I>"u")throw new Error("Assertion failed: Expected the ident to be registered");return I.range});if(p.length>1){let h=kr.simplifyRanges(p);n.reportSeparator(),h===null?(n.reportInfo(0,"Unfortunately, put together, we found no single range that can satisfy all those peer requirements."),n.reportInfo(0,`Your best option may be to try to upgrade some dependencies with ${de.pretty(e.configuration,"yarn up",de.Type.CODE)}, or silence the warning via ${de.pretty(e.configuration,"logFilters",de.Type.CODE)}.`)):n.reportInfo(0,`Put together, the final range we computed is ${de.pretty(e.configuration,h,de.Type.RANGE)}`)}}break;default:n.reportInfo(0,`The ${de.pretty(e.configuration,"yarn explain peer-requirements",de.Type.CODE)} command doesn't support this warning type yet.`);break}})).exitCode()}Ye();qt();Za();Ye();Ye();Pt();qt();var Zge=$e(zn()),Uh=class extends ut{constructor(){super(...arguments);this.useYarnPath=ge.Boolean("--yarn-path",{description:"Set the yarnPath setting even if the version can be accessed by Corepack"});this.onlyIfNeeded=ge.Boolean("--only-if-needed",!1,{description:"Only lock the Yarn version if it isn't already locked"});this.version=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins);if(this.onlyIfNeeded&&r.get("yarnPath")){let A=r.sources.get("yarnPath");if(!A)throw new Error("Assertion failed: Expected 'yarnPath' to have a source");let p=r.projectCwd??r.startingCwd;if(K.contains(p,A))return 0}let o=()=>{if(typeof tn>"u")throw new it("The --install flag can only be used without explicit version specifier from the Yarn CLI");return`file://${process.argv[1]}`},a,n=(A,p)=>({version:p,url:A.replace(/\{\}/g,p)});if(this.version==="self")a={url:o(),version:tn??"self"};else if(this.version==="latest"||this.version==="berry"||this.version==="stable")a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",await m2(r,"stable"));else if(this.version==="canary")a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",await m2(r,"canary"));else if(this.version==="classic")a={url:"https://classic.yarnpkg.com/latest.js",version:"classic"};else if(this.version.match(/^https?:/))a={url:this.version,version:"remote"};else if(this.version.match(/^\.{0,2}[\\/]/)||ue.isAbsolute(this.version))a={url:`file://${K.resolve(ue.toPortablePath(this.version))}`,version:"file"};else if(kr.satisfiesWithPrereleases(this.version,">=2.0.0"))a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",this.version);else if(kr.satisfiesWithPrereleases(this.version,"^0.x || ^1.x"))a=n("https://github.com/yarnpkg/yarn/releases/download/v{}/yarn-{}.js",this.version);else if(kr.validRange(this.version))a=n("https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js",await W0t(r,this.version));else throw new it(`Invalid version descriptor "${this.version}"`);return(await Nt.start({configuration:r,stdout:this.context.stdout,includeLogs:!this.context.quiet},async A=>{let p=async()=>{let h="file://";return a.url.startsWith(h)?(A.reportInfo(0,`Retrieving ${de.pretty(r,a.url,de.Type.PATH)}`),await oe.readFilePromise(a.url.slice(h.length))):(A.reportInfo(0,`Downloading ${de.pretty(r,a.url,de.Type.URL)}`),await rn.get(a.url,{configuration:r}))};await O8(r,a.version,p,{report:A,useYarnPath:this.useYarnPath})})).exitCode()}};Uh.paths=[["set","version"]],Uh.usage=nt.Usage({description:"lock the Yarn version used by the project",details:"\n This command will set a specific release of Yarn to be used by Corepack: https://nodejs.org/api/corepack.html.\n\n By default it only will set the `packageManager` field at the root of your project, but if the referenced release cannot be represented this way, if you already have `yarnPath` configured, or if you set the `--yarn-path` command line flag, then the release will also be downloaded from the Yarn GitHub repository, stored inside your project, and referenced via the `yarnPath` settings from your project `.yarnrc.yml` file.\n\n A very good use case for this command is to enforce the version of Yarn used by any single member of your team inside the same project - by doing this you ensure that you have control over Yarn upgrades and downgrades (including on your deployment servers), and get rid of most of the headaches related to someone using a slightly different version and getting different behavior.\n\n The version specifier can be:\n\n - a tag:\n - `latest` / `berry` / `stable` -> the most recent stable berry (`>=2.0.0`) release\n - `canary` -> the most recent canary (release candidate) berry (`>=2.0.0`) release\n - `classic` -> the most recent classic (`^0.x || ^1.x`) release\n\n - a semver range (e.g. `2.x`) -> the most recent version satisfying the range (limited to berry releases)\n\n - a semver version (e.g. `2.4.1`, `1.22.1`)\n\n - a local file referenced through either a relative or absolute path\n\n - `self` -> the version used to invoke the command\n ",examples:[["Download the latest release from the Yarn repository","$0 set version latest"],["Download the latest canary release from the Yarn repository","$0 set version canary"],["Download the latest classic release from the Yarn repository","$0 set version classic"],["Download the most recent Yarn 3 build","$0 set version 3.x"],["Download a specific Yarn 2 build","$0 set version 2.0.0-rc.30"],["Switch back to a specific Yarn 1 release","$0 set version 1.22.1"],["Use a release from the local filesystem","$0 set version ./yarn.cjs"],["Use a release from a URL","$0 set version https://repo.yarnpkg.com/3.1.0/packages/yarnpkg-cli/bin/yarn.js"],["Download the version used to invoke the command","$0 set version self"]]});async function W0t(t,e){let o=(await rn.get("https://repo.yarnpkg.com/tags",{configuration:t,jsonResponse:!0})).tags.filter(a=>kr.satisfiesWithPrereleases(a,e));if(o.length===0)throw new it(`No matching release found for range ${de.pretty(t,e,de.Type.RANGE)}.`);return o[0]}async function m2(t,e){let r=await rn.get("https://repo.yarnpkg.com/tags",{configuration:t,jsonResponse:!0});if(!r.latest[e])throw new it(`Tag ${de.pretty(t,e,de.Type.RANGE)} not found`);return r.latest[e]}async function O8(t,e,r,{report:o,useYarnPath:a}){let n,u=async()=>(typeof n>"u"&&(n=await r()),n);if(e===null){let te=await u();await oe.mktempPromise(async le=>{let pe=K.join(le,"yarn.cjs");await oe.writeFilePromise(pe,te);let{stdout:Ae}=await Ur.execvp(process.execPath,[ue.fromPortablePath(pe),"--version"],{cwd:le,env:{...t.env,YARN_IGNORE_PATH:"1"}});if(e=Ae.trim(),!Zge.default.valid(e))throw new Error(`Invalid semver version. ${de.pretty(t,"yarn --version",de.Type.CODE)} returned: +${e}`)})}let A=t.projectCwd??t.startingCwd,p=K.resolve(A,".yarn/releases"),h=K.resolve(p,`yarn-${e}.cjs`),E=K.relative(t.startingCwd,h),I=je.isTaggedYarnVersion(e),v=t.get("yarnPath"),b=!I,C=b||!!v||!!a;if(a===!1){if(b)throw new zt(0,"You explicitly opted out of yarnPath usage in your command line, but the version you specified cannot be represented by Corepack");C=!1}else!C&&!process.env.COREPACK_ROOT&&(o.reportWarning(0,`You don't seem to have ${de.applyHyperlink(t,"Corepack","https://nodejs.org/api/corepack.html")} enabled; we'll have to rely on ${de.applyHyperlink(t,"yarnPath","https://yarnpkg.com/configuration/yarnrc#yarnPath")} instead`),C=!0);if(C){let te=await u();o.reportInfo(0,`Saving the new release in ${de.pretty(t,E,"magenta")}`),await oe.removePromise(K.dirname(h)),await oe.mkdirPromise(K.dirname(h),{recursive:!0}),await oe.writeFilePromise(h,te,{mode:493}),await Ve.updateConfiguration(A,{yarnPath:K.relative(A,h)})}else await oe.removePromise(K.dirname(h)),await Ve.updateConfiguration(A,{yarnPath:Ve.deleteProperty});let T=await Mt.tryFind(A)||new Mt;T.packageManager=`yarn@${I?e:await m2(t,"stable")}`;let L={};T.exportTo(L);let U=K.join(A,Mt.fileName),J=`${JSON.stringify(L,null,T.indent)} +`;return await oe.changeFilePromise(U,J,{automaticNewlines:!0}),{bundleVersion:e}}function $ge(t){return wr[fP(t)]}var V0t=/## (?YN[0-9]{4}) - `(?[A-Z_]+)`\n\n(?
(?:.(?!##))+)/gs;async function K0t(t){let r=`https://repo.yarnpkg.com/${je.isTaggedYarnVersion(tn)?tn:await m2(t,"canary")}/packages/gatsby/content/advanced/error-codes.md`,o=await rn.get(r,{configuration:t});return new Map(Array.from(o.toString().matchAll(V0t),({groups:a})=>{if(!a)throw new Error("Assertion failed: Expected the match to have been successful");let n=$ge(a.code);if(a.name!==n)throw new Error(`Assertion failed: Invalid error code data: Expected "${a.name}" to be named "${n}"`);return[a.code,a.details]}))}var _h=class extends ut{constructor(){super(...arguments);this.code=ge.String({required:!1,validator:oI(Ey(),[sI(/^YN[0-9]{4}$/)])});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins);if(typeof this.code<"u"){let o=$ge(this.code),a=de.pretty(r,o,de.Type.CODE),n=this.cli.format().header(`${this.code} - ${a}`),A=(await K0t(r)).get(this.code),p=typeof A<"u"?de.jsonOrPretty(this.json,r,de.tuple(de.Type.MARKDOWN,{text:A,format:this.cli.format(),paragraphs:!0})):`This error code does not have a description. + +You can help us by editing this page on GitHub \u{1F642}: +${de.jsonOrPretty(this.json,r,de.tuple(de.Type.URL,"https://github.com/yarnpkg/berry/blob/master/packages/gatsby/content/advanced/error-codes.md"))} +`;this.json?this.context.stdout.write(`${JSON.stringify({code:this.code,name:o,details:p})} +`):this.context.stdout.write(`${n} + +${p} +`)}else{let o={children:je.mapAndFilter(Object.entries(wr),([a,n])=>Number.isNaN(Number(a))?je.mapAndFilter.skip:{label:Wu(Number(a)),value:de.tuple(de.Type.CODE,n)})};$s.emitTree(o,{configuration:r,stdout:this.context.stdout,json:this.json})}}};_h.paths=[["explain"]],_h.usage=nt.Usage({description:"explain an error code",details:` + When the code argument is specified, this command prints its name and its details. + + When used without arguments, this command lists all error codes and their names. + `,examples:[["Explain an error code","$0 explain YN0006"],["List all error codes","$0 explain"]]});Ye();Pt();qt();var ede=$e(Zo()),Hh=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Print versions of a package from the whole project"});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Print information for all packages, including transitive dependencies"});this.extra=ge.Array("-X,--extra",[],{description:"An array of requests of extra data provided by plugins"});this.cache=ge.Boolean("--cache",!1,{description:"Print information about the cache entry of a package (path, size, checksum)"});this.dependents=ge.Boolean("--dependents",!1,{description:"Print all dependents for each matching package"});this.manifest=ge.Boolean("--manifest",!1,{description:"Print data obtained by looking at the package archive (license, homepage, ...)"});this.nameOnly=ge.Boolean("--name-only",!1,{description:"Only print the name for the matching packages"});this.virtuals=ge.Boolean("--virtuals",!1,{description:"Print each instance of the virtual packages"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.patterns=ge.Rest()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(!a&&!this.all)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState();let u=new Set(this.extra);this.cache&&u.add("cache"),this.dependents&&u.add("dependents"),this.manifest&&u.add("manifest");let A=(le,{recursive:pe})=>{let Ae=le.anchoredLocator.locatorHash,ye=new Map,ae=[Ae];for(;ae.length>0;){let we=ae.shift();if(ye.has(we))continue;let Pe=o.storedPackages.get(we);if(typeof Pe>"u")throw new Error("Assertion failed: Expected the package to be registered");if(ye.set(we,Pe),W.isVirtualLocator(Pe)&&ae.push(W.devirtualizeLocator(Pe).locatorHash),!(!pe&&we!==Ae))for(let g of Pe.dependencies.values()){let Ee=o.storedResolutions.get(g.descriptorHash);if(typeof Ee>"u")throw new Error("Assertion failed: Expected the resolution to be registered");ae.push(Ee)}}return ye.values()},p=({recursive:le})=>{let pe=new Map;for(let Ae of o.workspaces)for(let ye of A(Ae,{recursive:le}))pe.set(ye.locatorHash,ye);return pe.values()},h=({all:le,recursive:pe})=>le&&pe?o.storedPackages.values():le?p({recursive:pe}):A(a,{recursive:pe}),E=({all:le,recursive:pe})=>{let Ae=h({all:le,recursive:pe}),ye=this.patterns.map(Pe=>{let g=W.parseLocator(Pe),Ee=ede.default.makeRe(W.stringifyIdent(g)),De=W.isVirtualLocator(g),ce=De?W.devirtualizeLocator(g):g;return ne=>{let ee=W.stringifyIdent(ne);if(!Ee.test(ee))return!1;if(g.reference==="unknown")return!0;let Ie=W.isVirtualLocator(ne),ke=Ie?W.devirtualizeLocator(ne):ne;return!(De&&Ie&&g.reference!==ne.reference||ce.reference!==ke.reference)}}),ae=je.sortMap([...Ae],Pe=>W.stringifyLocator(Pe));return{selection:ae.filter(Pe=>ye.length===0||ye.some(g=>g(Pe))),sortedLookup:ae}},{selection:I,sortedLookup:v}=E({all:this.all,recursive:this.recursive});if(I.length===0)throw new it("No package matched your request");let b=new Map;if(this.dependents)for(let le of v)for(let pe of le.dependencies.values()){let Ae=o.storedResolutions.get(pe.descriptorHash);if(typeof Ae>"u")throw new Error("Assertion failed: Expected the resolution to be registered");je.getArrayWithDefault(b,Ae).push(le)}let C=new Map;for(let le of v){if(!W.isVirtualLocator(le))continue;let pe=W.devirtualizeLocator(le);je.getArrayWithDefault(C,pe.locatorHash).push(le)}let T={},L={children:T},U=r.makeFetcher(),J={project:o,fetcher:U,cache:n,checksums:o.storedChecksums,report:new Qi,cacheOptions:{skipIntegrityCheck:!0}},te=[async(le,pe,Ae)=>{if(!pe.has("manifest"))return;let ye=await U.fetch(le,J),ae;try{ae=await Mt.find(ye.prefixPath,{baseFs:ye.packageFs})}finally{ye.releaseFs?.()}Ae("Manifest",{License:de.tuple(de.Type.NO_HINT,ae.license),Homepage:de.tuple(de.Type.URL,ae.raw.homepage??null)})},async(le,pe,Ae)=>{if(!pe.has("cache"))return;let ye=o.storedChecksums.get(le.locatorHash)??null,ae=n.getLocatorPath(le,ye),we;if(ae!==null)try{we=await oe.statPromise(ae)}catch{}let Pe=typeof we<"u"?[we.size,de.Type.SIZE]:void 0;Ae("Cache",{Checksum:de.tuple(de.Type.NO_HINT,ye),Path:de.tuple(de.Type.PATH,ae),Size:Pe})}];for(let le of I){let pe=W.isVirtualLocator(le);if(!this.virtuals&&pe)continue;let Ae={},ye={value:[le,de.Type.LOCATOR],children:Ae};if(T[W.stringifyLocator(le)]=ye,this.nameOnly){delete ye.children;continue}let ae=C.get(le.locatorHash);typeof ae<"u"&&(Ae.Instances={label:"Instances",value:de.tuple(de.Type.NUMBER,ae.length)}),Ae.Version={label:"Version",value:de.tuple(de.Type.NO_HINT,le.version)};let we=(g,Ee)=>{let De={};if(Ae[g]=De,Array.isArray(Ee))De.children=Ee.map(ce=>({value:ce}));else{let ce={};De.children=ce;for(let[ne,ee]of Object.entries(Ee))typeof ee>"u"||(ce[ne]={label:ne,value:ee})}};if(!pe){for(let g of te)await g(le,u,we);await r.triggerHook(g=>g.fetchPackageInfo,le,u,we)}le.bin.size>0&&!pe&&we("Exported Binaries",[...le.bin.keys()].map(g=>de.tuple(de.Type.PATH,g)));let Pe=b.get(le.locatorHash);typeof Pe<"u"&&Pe.length>0&&we("Dependents",Pe.map(g=>de.tuple(de.Type.LOCATOR,g))),le.dependencies.size>0&&!pe&&we("Dependencies",[...le.dependencies.values()].map(g=>{let Ee=o.storedResolutions.get(g.descriptorHash),De=typeof Ee<"u"?o.storedPackages.get(Ee)??null:null;return de.tuple(de.Type.RESOLUTION,{descriptor:g,locator:De})})),le.peerDependencies.size>0&&pe&&we("Peer dependencies",[...le.peerDependencies.values()].map(g=>{let Ee=le.dependencies.get(g.identHash),De=typeof Ee<"u"?o.storedResolutions.get(Ee.descriptorHash)??null:null,ce=De!==null?o.storedPackages.get(De)??null:null;return de.tuple(de.Type.RESOLUTION,{descriptor:g,locator:ce})}))}$s.emitTree(L,{configuration:r,json:this.json,stdout:this.context.stdout,separators:this.nameOnly?0:2})}};Hh.paths=[["info"]],Hh.usage=nt.Usage({description:"see information related to packages",details:"\n This command prints various information related to the specified packages, accepting glob patterns.\n\n By default, if the locator reference is missing, Yarn will default to print the information about all the matching direct dependencies of the package for the active workspace. To instead print all versions of the package that are direct dependencies of any of your workspaces, use the `-A,--all` flag. Adding the `-R,--recursive` flag will also report transitive dependencies.\n\n Some fields will be hidden by default in order to keep the output readable, but can be selectively displayed by using additional options (`--dependents`, `--manifest`, `--virtuals`, ...) described in the option descriptions.\n\n Note that this command will only print the information directly related to the selected packages - if you wish to know why the package is there in the first place, use `yarn why` which will do just that (it also provides a `-R,--recursive` flag that may be of some help).\n ",examples:[["Show information about Lodash","$0 info lodash"]]});Ye();Pt();Nl();var dk=$e(ed());qt();var U8=$e(zn());Za();var J0t=[{selector:t=>t===-1,name:"nodeLinker",value:"node-modules"},{selector:t=>t!==-1&&t<8,name:"enableGlobalCache",value:!1},{selector:t=>t!==-1&&t<8,name:"compressionLevel",value:"mixed"}],jh=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.immutable=ge.Boolean("--immutable",{description:"Abort with an error exit code if the lockfile was to be modified"});this.immutableCache=ge.Boolean("--immutable-cache",{description:"Abort with an error exit code if the cache folder was to be modified"});this.refreshLockfile=ge.Boolean("--refresh-lockfile",{description:"Refresh the package metadata stored in the lockfile"});this.checkCache=ge.Boolean("--check-cache",{description:"Always refetch the packages and ensure that their checksums are consistent"});this.checkResolutions=ge.Boolean("--check-resolutions",{description:"Validates that the package resolutions are coherent"});this.inlineBuilds=ge.Boolean("--inline-builds",{description:"Verbosely print the output of the build steps of dependencies"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:Vs(pl)});this.cacheFolder=ge.String("--cache-folder",{hidden:!0});this.frozenLockfile=ge.Boolean("--frozen-lockfile",{hidden:!0});this.ignoreEngines=ge.Boolean("--ignore-engines",{hidden:!0});this.nonInteractive=ge.Boolean("--non-interactive",{hidden:!0});this.preferOffline=ge.Boolean("--prefer-offline",{hidden:!0});this.production=ge.Boolean("--production",{hidden:!0});this.registry=ge.String("--registry",{hidden:!0});this.silent=ge.Boolean("--silent",{hidden:!0});this.networkTimeout=ge.String("--network-timeout",{hidden:!0})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins);typeof this.inlineBuilds<"u"&&r.useWithSource("",{enableInlineBuilds:this.inlineBuilds},r.startingCwd,{overwrite:!0});let o=!!process.env.FUNCTION_TARGET||!!process.env.GOOGLE_RUNTIME,a=await NE({configuration:r,stdout:this.context.stdout},[{option:this.ignoreEngines,message:"The --ignore-engines option is deprecated; engine checking isn't a core feature anymore",error:!dk.default.VERCEL},{option:this.registry,message:"The --registry option is deprecated; prefer setting npmRegistryServer in your .yarnrc.yml file"},{option:this.preferOffline,message:"The --prefer-offline flag is deprecated; use the --cached flag with 'yarn add' instead",error:!dk.default.VERCEL},{option:this.production,message:"The --production option is deprecated on 'install'; use 'yarn workspaces focus' instead",error:!0},{option:this.nonInteractive,message:"The --non-interactive option is deprecated",error:!o},{option:this.frozenLockfile,message:"The --frozen-lockfile option is deprecated; use --immutable and/or --immutable-cache instead",callback:()=>this.immutable=this.frozenLockfile},{option:this.cacheFolder,message:"The cache-folder option has been deprecated; use rc settings instead",error:!dk.default.NETLIFY}]);if(a!==null)return a;let n=this.mode==="update-lockfile";if(n&&(this.immutable||this.immutableCache))throw new it(`${de.pretty(r,"--immutable",de.Type.CODE)} and ${de.pretty(r,"--immutable-cache",de.Type.CODE)} cannot be used with ${de.pretty(r,"--mode=update-lockfile",de.Type.CODE)}`);let u=(this.immutable??r.get("enableImmutableInstalls"))&&!n,A=this.immutableCache&&!n;if(r.projectCwd!==null){let T=await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async L=>{let U=!1;await Z0t(r,u)&&(L.reportInfo(48,"Automatically removed core plugins that are now builtins \u{1F44D}"),U=!0),await X0t(r,u)&&(L.reportInfo(48,"Automatically fixed merge conflicts \u{1F44D}"),U=!0),U&&L.reportSeparator()});if(T.hasErrors())return T.exitCode()}if(r.projectCwd!==null){let T=await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async L=>{if(Ve.telemetry?.isNew)Ve.telemetry.commitTips(),L.reportInfo(65,"Yarn will periodically gather anonymous telemetry: https://yarnpkg.com/advanced/telemetry"),L.reportInfo(65,`Run ${de.pretty(r,"yarn config set --home enableTelemetry 0",de.Type.CODE)} to disable`),L.reportSeparator();else if(Ve.telemetry?.shouldShowTips){let U=await rn.get("https://repo.yarnpkg.com/tags",{configuration:r,jsonResponse:!0}).catch(()=>null);if(U!==null){let J=null;if(tn!==null){let le=U8.default.prerelease(tn)?"canary":"stable",pe=U.latest[le];U8.default.gt(pe,tn)&&(J=[le,pe])}if(J)Ve.telemetry.commitTips(),L.reportInfo(88,`${de.applyStyle(r,`A new ${J[0]} version of Yarn is available:`,de.Style.BOLD)} ${W.prettyReference(r,J[1])}!`),L.reportInfo(88,`Upgrade now by running ${de.pretty(r,`yarn set version ${J[1]}`,de.Type.CODE)}`),L.reportSeparator();else{let te=Ve.telemetry.selectTip(U.tips);te&&(L.reportInfo(89,de.pretty(r,te.message,de.Type.MARKDOWN_INLINE)),te.url&&L.reportInfo(89,`Learn more at ${te.url}`),L.reportSeparator())}}}});if(T.hasErrors())return T.exitCode()}let{project:p,workspace:h}=await St.find(r,this.context.cwd),E=p.lockfileLastVersion;if(E!==null){let T=await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async L=>{let U={};for(let J of J0t)J.selector(E)&&typeof r.sources.get(J.name)>"u"&&(r.use("",{[J.name]:J.value},p.cwd,{overwrite:!0}),U[J.name]=J.value);Object.keys(U).length>0&&(await Ve.updateConfiguration(p.cwd,U),L.reportInfo(87,"Migrated your project to the latest Yarn version \u{1F680}"),L.reportSeparator())});if(T.hasErrors())return T.exitCode()}let I=await Lr.find(r,{immutable:A,check:this.checkCache});if(!h)throw new rr(p.cwd,this.context.cwd);await p.restoreInstallState({restoreResolutions:!1});let v=r.get("enableHardenedMode");v&&typeof r.sources.get("enableHardenedMode")>"u"&&await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout,includeFooter:!1},async T=>{T.reportWarning(0,"Yarn detected that the current workflow is executed from a public pull request. For safety the hardened mode has been enabled."),T.reportWarning(0,`It will prevent malicious lockfile manipulations, in exchange for a slower install time. You can opt-out if necessary; check our ${de.applyHyperlink(r,"documentation","https://yarnpkg.com/features/security#hardened-mode")} for more details.`),T.reportSeparator()}),(this.refreshLockfile??v)&&(p.lockfileNeedsRefresh=!0);let b=this.checkResolutions??v;return(await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout,forceSectionAlignment:!0,includeLogs:!0,includeVersion:!0},async T=>{await p.install({cache:I,report:T,immutable:u,checkResolutions:b,mode:this.mode})})).exitCode()}};jh.paths=[["install"],nt.Default],jh.usage=nt.Usage({description:"install the project dependencies",details:"\n This command sets up your project if needed. The installation is split into four different steps that each have their own characteristics:\n\n - **Resolution:** First the package manager will resolve your dependencies. The exact way a dependency version is privileged over another isn't standardized outside of the regular semver guarantees. If a package doesn't resolve to what you would expect, check that all dependencies are correctly declared (also check our website for more information: ).\n\n - **Fetch:** Then we download all the dependencies if needed, and make sure that they're all stored within our cache (check the value of `cacheFolder` in `yarn config` to see where the cache files are stored).\n\n - **Link:** Then we send the dependency tree information to internal plugins tasked with writing them on the disk in some form (for example by generating the .pnp.cjs file you might know).\n\n - **Build:** Once the dependency tree has been written on the disk, the package manager will now be free to run the build scripts for all packages that might need it, in a topological order compatible with the way they depend on one another. See https://yarnpkg.com/advanced/lifecycle-scripts for detail.\n\n Note that running this command is not part of the recommended workflow. Yarn supports zero-installs, which means that as long as you store your cache and your .pnp.cjs file inside your repository, everything will work without requiring any install right after cloning your repository or switching branches.\n\n If the `--immutable` option is set (defaults to true on CI), Yarn will abort with an error exit code if the lockfile was to be modified (other paths can be added using the `immutablePatterns` configuration setting). For backward compatibility we offer an alias under the name of `--frozen-lockfile`, but it will be removed in a later release.\n\n If the `--immutable-cache` option is set, Yarn will abort with an error exit code if the cache folder was to be modified (either because files would be added, or because they'd be removed).\n\n If the `--refresh-lockfile` option is set, Yarn will keep the same resolution for the packages currently in the lockfile but will refresh their metadata. If used together with `--immutable`, it can validate that the lockfile information are consistent. This flag is enabled by default when Yarn detects it runs within a pull request context.\n\n If the `--check-cache` option is set, Yarn will always refetch the packages and will ensure that their checksum matches what's 1/ described in the lockfile 2/ inside the existing cache files (if present). This is recommended as part of your CI workflow if you're both following the Zero-Installs model and accepting PRs from third-parties, as they'd otherwise have the ability to alter the checked-in packages before submitting them.\n\n If the `--inline-builds` option is set, Yarn will verbosely print the output of the build steps of your dependencies (instead of writing them into individual files). This is likely useful mostly for debug purposes only when using Docker-like environments.\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n ",examples:[["Install the project","$0 install"],["Validate a project when using Zero-Installs","$0 install --immutable --immutable-cache"],["Validate a project when using Zero-Installs (slightly safer if you accept external PRs)","$0 install --immutable --immutable-cache --check-cache"]]});var z0t="<<<<<<<";async function X0t(t,e){if(!t.projectCwd)return!1;let r=K.join(t.projectCwd,dr.lockfile);if(!await oe.existsPromise(r)||!(await oe.readFilePromise(r,"utf8")).includes(z0t))return!1;if(e)throw new zt(47,"Cannot autofix a lockfile when running an immutable install");let a=await Ur.execvp("git",["rev-parse","MERGE_HEAD","HEAD"],{cwd:t.projectCwd});if(a.code!==0&&(a=await Ur.execvp("git",["rev-parse","REBASE_HEAD","HEAD"],{cwd:t.projectCwd})),a.code!==0&&(a=await Ur.execvp("git",["rev-parse","CHERRY_PICK_HEAD","HEAD"],{cwd:t.projectCwd})),a.code!==0)throw new zt(83,"Git returned an error when trying to find the commits pertaining to the conflict");let n=await Promise.all(a.stdout.trim().split(/\n/).map(async A=>{let p=await Ur.execvp("git",["show",`${A}:./${dr.lockfile}`],{cwd:t.projectCwd});if(p.code!==0)throw new zt(83,`Git returned an error when trying to access the lockfile content in ${A}`);try{return Vi(p.stdout)}catch{throw new zt(46,"A variant of the conflicting lockfile failed to parse")}}));n=n.filter(A=>!!A.__metadata);for(let A of n){if(A.__metadata.version<7)for(let p of Object.keys(A)){if(p==="__metadata")continue;let h=W.parseDescriptor(p,!0),E=t.normalizeDependency(h),I=W.stringifyDescriptor(E);I!==p&&(A[I]=A[p],delete A[p])}for(let p of Object.keys(A)){if(p==="__metadata")continue;let h=A[p].checksum;typeof h=="string"&&h.includes("/")||(A[p].checksum=`${A.__metadata.cacheKey}/${h}`)}}let u=Object.assign({},...n);u.__metadata.version=`${Math.min(...n.map(A=>parseInt(A.__metadata.version??0)))}`,u.__metadata.cacheKey="merged";for(let[A,p]of Object.entries(u))typeof p=="string"&&delete u[A];return await oe.changeFilePromise(r,Ba(u),{automaticNewlines:!0}),!0}async function Z0t(t,e){if(!t.projectCwd)return!1;let r=[],o=K.join(t.projectCwd,".yarn/plugins/@yarnpkg");return await Ve.updateConfiguration(t.projectCwd,{plugins:n=>{if(!Array.isArray(n))return n;let u=n.filter(A=>{if(!A.path)return!0;let p=K.resolve(t.projectCwd,A.path),h=B1.has(A.spec)&&K.contains(o,p);return h&&r.push(p),!h});return u.length===0?Ve.deleteProperty:u.length===n.length?n:u}},{immutable:e})?(await Promise.all(r.map(async n=>{await oe.removePromise(n)})),!0):!1}Ye();Pt();qt();var qh=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Link all workspaces belonging to the target projects to the current one"});this.private=ge.Boolean("-p,--private",!1,{description:"Also link private workspaces belonging to the target projects to the current one"});this.relative=ge.Boolean("-r,--relative",!1,{description:"Link workspaces using relative paths instead of absolute paths"});this.destinations=ge.Rest()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(!a)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=o.topLevelWorkspace,A=[];for(let p of this.destinations){let h=K.resolve(this.context.cwd,ue.toPortablePath(p)),E=await Ve.find(h,this.context.plugins,{useRc:!1,strict:!1}),{project:I,workspace:v}=await St.find(E,h);if(o.cwd===I.cwd)throw new it(`Invalid destination '${p}'; Can't link the project to itself`);if(!v)throw new rr(I.cwd,h);if(this.all){let b=!1;for(let C of I.workspaces)C.manifest.name&&(!C.manifest.private||this.private)&&(A.push(C),b=!0);if(!b)throw new it(`No workspace found to be linked in the target project: ${p}`)}else{if(!v.manifest.name)throw new it(`The target workspace at '${p}' doesn't have a name and thus cannot be linked`);if(v.manifest.private&&!this.private)throw new it(`The target workspace at '${p}' is marked private - use the --private flag to link it anyway`);A.push(v)}}for(let p of A){let h=W.stringifyIdent(p.anchoredLocator),E=this.relative?K.relative(o.cwd,p.cwd):p.cwd;u.manifest.resolutions.push({pattern:{descriptor:{fullName:h}},reference:`portal:${E}`})}return await o.installWithNewReport({stdout:this.context.stdout},{cache:n})}};qh.paths=[["link"]],qh.usage=nt.Usage({description:"connect the local project to another one",details:"\n This command will set a new `resolutions` field in the project-level manifest and point it to the workspace at the specified location (even if part of another project).\n ",examples:[["Register one or more remote workspaces for use in the current project","$0 link ~/ts-loader ~/jest"],["Register all workspaces from a remote project for use in the current project","$0 link ~/jest --all"]]});qt();var Gh=class extends ut{constructor(){super(...arguments);this.args=ge.Proxy()}async execute(){return this.cli.run(["exec","node",...this.args])}};Gh.paths=[["node"]],Gh.usage=nt.Usage({description:"run node with the hook already setup",details:` + This command simply runs Node. It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment). + + The Node process will use the exact same version of Node as the one used to run Yarn itself, which might be a good way to ensure that your commands always use a consistent Node version. + `,examples:[["Run a Node script","$0 node ./my-script.js"]]});Ye();qt();var Yh=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),o=await Ve.findRcFiles(this.context.cwd);return(await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout},async n=>{for(let u of o)if(!!u.data?.plugins)for(let A of u.data.plugins){if(!A.checksum||!A.spec.match(/^https?:/))continue;let p=await rn.get(A.spec,{configuration:r}),h=wn.makeHash(p);if(A.checksum===h)continue;let E=de.pretty(r,A.path,de.Type.PATH),I=de.pretty(r,A.spec,de.Type.URL),v=`${E} is different from the file provided by ${I}`;n.reportJson({...A,newChecksum:h}),n.reportError(0,v)}})).exitCode()}};Yh.paths=[["plugin","check"]],Yh.usage=nt.Usage({category:"Plugin-related commands",description:"find all third-party plugins that differ from their own spec",details:` + Check only the plugins from https. + + If this command detects any plugin differences in the CI environment, it will throw an error. + `,examples:[["find all third-party plugins that differ from their own spec","$0 plugin check"]]});Ye();Ye();Pt();qt();var ode=Be("os");Ye();Pt();qt();var tde=Be("os");Ye();Nl();qt();var $0t="https://raw.githubusercontent.com/yarnpkg/berry/master/plugins.yml";async function Jd(t,e){let r=await rn.get($0t,{configuration:t}),o=Vi(r.toString());return Object.fromEntries(Object.entries(o).filter(([a,n])=>!e||kr.satisfiesWithPrereleases(e,n.range??"<4.0.0-rc.1")))}var Wh=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins);return(await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout},async a=>{let n=await Jd(r,tn);for(let[u,{experimental:A,...p}]of Object.entries(n)){let h=u;A&&(h+=" [experimental]"),a.reportJson({name:u,experimental:A,...p}),a.reportInfo(null,h)}})).exitCode()}};Wh.paths=[["plugin","list"]],Wh.usage=nt.Usage({category:"Plugin-related commands",description:"list the available official plugins",details:"\n This command prints the plugins available directly from the Yarn repository. Only those plugins can be referenced by name in `yarn plugin import`.\n ",examples:[["List the official plugins","$0 plugin list"]]});var egt=/^[0-9]+$/,tgt=process.platform==="win32";function rde(t){return egt.test(t)?`pull/${t}/head`:t}var rgt=({repository:t,branch:e},r)=>[["git","init",ue.fromPortablePath(r)],["git","remote","add","origin",t],["git","fetch","origin","--depth=1",rde(e)],["git","reset","--hard","FETCH_HEAD"]],ngt=({branch:t})=>[["git","fetch","origin","--depth=1",rde(t),"--force"],["git","reset","--hard","FETCH_HEAD"],["git","clean","-dfx","-e","packages/yarnpkg-cli/bundles"]],igt=({plugins:t,noMinify:e},r,o)=>[["yarn","build:cli",...new Array().concat(...t.map(a=>["--plugin",K.resolve(o,a)])),...e?["--no-minify"]:[],"|"],[tgt?"move":"mv","packages/yarnpkg-cli/bundles/yarn.js",ue.fromPortablePath(r),"|"]],Vh=class extends ut{constructor(){super(...arguments);this.installPath=ge.String("--path",{description:"The path where the repository should be cloned to"});this.repository=ge.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=ge.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.plugins=ge.Array("--plugin",[],{description:"An array of additional plugins that should be included in the bundle"});this.dryRun=ge.Boolean("-n,--dry-run",!1,{description:"If set, the bundle will be built but not added to the project"});this.noMinify=ge.Boolean("--no-minify",!1,{description:"Build a bundle for development (debugging) - non-minified and non-mangled"});this.force=ge.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.skipPlugins=ge.Boolean("--skip-plugins",!1,{description:"Skip updating the contrib plugins"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o}=await St.find(r,this.context.cwd),a=typeof this.installPath<"u"?K.resolve(this.context.cwd,ue.toPortablePath(this.installPath)):K.resolve(ue.toPortablePath((0,tde.tmpdir)()),"yarnpkg-sources",wn.makeHash(this.repository).slice(0,6));return(await Nt.start({configuration:r,stdout:this.context.stdout},async u=>{await _8(this,{configuration:r,report:u,target:a}),u.reportSeparator(),u.reportInfo(0,"Building a fresh bundle"),u.reportSeparator();let A=await Ur.execvp("git",["rev-parse","--short","HEAD"],{cwd:a,strict:!0}),p=K.join(a,`packages/yarnpkg-cli/bundles/yarn-${A.stdout.trim()}.js`);oe.existsSync(p)||(await y2(igt(this,p,a),{configuration:r,context:this.context,target:a}),u.reportSeparator());let h=await oe.readFilePromise(p);if(!this.dryRun){let{bundleVersion:E}=await O8(r,null,async()=>h,{report:u});this.skipPlugins||await sgt(this,E,{project:o,report:u,target:a})}})).exitCode()}};Vh.paths=[["set","version","from","sources"]],Vh.usage=nt.Usage({description:"build Yarn from master",details:` + This command will clone the Yarn repository into a temporary folder, then build it. The resulting bundle will then be copied into the local project. + + By default, it also updates all contrib plugins to the same commit the bundle is built from. This behavior can be disabled by using the \`--skip-plugins\` flag. + `,examples:[["Build Yarn from master","$0 set version from sources"]]});async function y2(t,{configuration:e,context:r,target:o}){for(let[a,...n]of t){let u=n[n.length-1]==="|";if(u&&n.pop(),u)await Ur.pipevp(a,n,{cwd:o,stdin:r.stdin,stdout:r.stdout,stderr:r.stderr,strict:!0});else{r.stdout.write(`${de.pretty(e,` $ ${[a,...n].join(" ")}`,"grey")} +`);try{await Ur.execvp(a,n,{cwd:o,strict:!0})}catch(A){throw r.stdout.write(A.stdout||A.stack),A}}}}async function _8(t,{configuration:e,report:r,target:o}){let a=!1;if(!t.force&&oe.existsSync(K.join(o,".git"))){r.reportInfo(0,"Fetching the latest commits"),r.reportSeparator();try{await y2(ngt(t),{configuration:e,context:t.context,target:o}),a=!0}catch{r.reportSeparator(),r.reportWarning(0,"Repository update failed; we'll try to regenerate it")}}a||(r.reportInfo(0,"Cloning the remote repository"),r.reportSeparator(),await oe.removePromise(o),await oe.mkdirPromise(o,{recursive:!0}),await y2(rgt(t,o),{configuration:e,context:t.context,target:o}))}async function sgt(t,e,{project:r,report:o,target:a}){let n=await Jd(r.configuration,e),u=new Set(Object.keys(n));for(let A of r.configuration.plugins.keys())!u.has(A)||await H8(A,t,{project:r,report:o,target:a})}Ye();Ye();Pt();qt();var nde=$e(zn()),ide=Be("url"),sde=Be("vm");var Kh=class extends ut{constructor(){super(...arguments);this.name=ge.String();this.checksum=ge.Boolean("--checksum",!0,{description:"Whether to care if this plugin is modified"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins);return(await Nt.start({configuration:r,stdout:this.context.stdout},async a=>{let{project:n}=await St.find(r,this.context.cwd),u,A;if(this.name.match(/^\.{0,2}[\\/]/)||ue.isAbsolute(this.name)){let p=K.resolve(this.context.cwd,ue.toPortablePath(this.name));a.reportInfo(0,`Reading ${de.pretty(r,p,de.Type.PATH)}`),u=K.relative(n.cwd,p),A=await oe.readFilePromise(p)}else{let p;if(this.name.match(/^https?:/)){try{new ide.URL(this.name)}catch{throw new zt(52,`Plugin specifier "${this.name}" is neither a plugin name nor a valid url`)}u=this.name,p=this.name}else{let h=W.parseLocator(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-"));if(h.reference!=="unknown"&&!nde.default.valid(h.reference))throw new zt(0,"Official plugins only accept strict version references. Use an explicit URL if you wish to download them from another location.");let E=W.stringifyIdent(h),I=await Jd(r,tn);if(!Object.hasOwn(I,E)){let v=`Couldn't find a plugin named ${W.prettyIdent(r,h)} on the remote registry. +`;throw r.plugins.has(E)?v+=`A plugin named ${W.prettyIdent(r,h)} is already installed; possibly attempting to import a built-in plugin.`:v+=`Note that only the plugins referenced on our website (${de.pretty(r,"https://github.com/yarnpkg/berry/blob/master/plugins.yml",de.Type.URL)}) can be referenced by their name; any other plugin will have to be referenced through its public url (for example ${de.pretty(r,"https://github.com/yarnpkg/berry/raw/master/packages/plugin-typescript/bin/%40yarnpkg/plugin-typescript.js",de.Type.URL)}).`,new zt(51,v)}u=E,p=I[E].url,h.reference!=="unknown"?p=p.replace(/\/master\//,`/${E}/${h.reference}/`):tn!==null&&(p=p.replace(/\/master\//,`/@yarnpkg/cli/${tn}/`))}a.reportInfo(0,`Downloading ${de.pretty(r,p,"green")}`),A=await rn.get(p,{configuration:r})}await j8(u,A,{checksum:this.checksum,project:n,report:a})})).exitCode()}};Kh.paths=[["plugin","import"]],Kh.usage=nt.Usage({category:"Plugin-related commands",description:"download a plugin",details:` + This command downloads the specified plugin from its remote location and updates the configuration to reference it in further CLI invocations. + + Three types of plugin references are accepted: + + - If the plugin is stored within the Yarn repository, it can be referenced by name. + - Third-party plugins can be referenced directly through their public urls. + - Local plugins can be referenced by their path on the disk. + + If the \`--no-checksum\` option is set, Yarn will no longer care if the plugin is modified. + + Plugins cannot be downloaded from the npm registry, and aren't allowed to have dependencies (they need to be bundled into a single file, possibly thanks to the \`@yarnpkg/builder\` package). + `,examples:[['Download and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import @yarnpkg/plugin-exec"],['Download and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import exec"],["Download and activate a community plugin","$0 plugin import https://example.org/path/to/plugin.js"],["Activate a local plugin","$0 plugin import ./path/to/plugin.js"]]});async function j8(t,e,{checksum:r=!0,project:o,report:a}){let{configuration:n}=o,u={},A={exports:u};(0,sde.runInNewContext)(e.toString(),{module:A,exports:u});let h=`.yarn/plugins/${A.exports.name}.cjs`,E=K.resolve(o.cwd,h);a.reportInfo(0,`Saving the new plugin in ${de.pretty(n,h,"magenta")}`),await oe.mkdirPromise(K.dirname(E),{recursive:!0}),await oe.writeFilePromise(E,e);let I={path:h,spec:t};r&&(I.checksum=wn.makeHash(e)),await Ve.addPlugin(o.cwd,[I])}var ogt=({pluginName:t,noMinify:e},r)=>[["yarn",`build:${t}`,...e?["--no-minify"]:[],"|"]],Jh=class extends ut{constructor(){super(...arguments);this.installPath=ge.String("--path",{description:"The path where the repository should be cloned to"});this.repository=ge.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=ge.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.noMinify=ge.Boolean("--no-minify",!1,{description:"Build a plugin for development (debugging) - non-minified and non-mangled"});this.force=ge.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.name=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),o=typeof this.installPath<"u"?K.resolve(this.context.cwd,ue.toPortablePath(this.installPath)):K.resolve(ue.toPortablePath((0,ode.tmpdir)()),"yarnpkg-sources",wn.makeHash(this.repository).slice(0,6));return(await Nt.start({configuration:r,stdout:this.context.stdout},async n=>{let{project:u}=await St.find(r,this.context.cwd),A=W.parseIdent(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-")),p=W.stringifyIdent(A),h=await Jd(r,tn);if(!Object.hasOwn(h,p))throw new zt(51,`Couldn't find a plugin named "${p}" on the remote registry. Note that only the plugins referenced on our website (https://github.com/yarnpkg/berry/blob/master/plugins.yml) can be built and imported from sources.`);let E=p;await _8(this,{configuration:r,report:n,target:o}),await H8(E,this,{project:u,report:n,target:o})})).exitCode()}};Jh.paths=[["plugin","import","from","sources"]],Jh.usage=nt.Usage({category:"Plugin-related commands",description:"build a plugin from sources",details:` + This command clones the Yarn repository into a temporary folder, builds the specified contrib plugin and updates the configuration to reference it in further CLI invocations. + + The plugins can be referenced by their short name if sourced from the official Yarn repository. + `,examples:[['Build and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import from sources @yarnpkg/plugin-exec"],['Build and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import from sources exec"]]});async function H8(t,{context:e,noMinify:r},{project:o,report:a,target:n}){let u=t.replace(/@yarnpkg\//,""),{configuration:A}=o;a.reportSeparator(),a.reportInfo(0,`Building a fresh ${u}`),a.reportSeparator(),await y2(ogt({pluginName:u,noMinify:r},n),{configuration:A,context:e,target:n}),a.reportSeparator();let p=K.resolve(n,`packages/${u}/bundles/${t}.js`),h=await oe.readFilePromise(p);await j8(t,h,{project:o,report:a})}Ye();Pt();qt();var zh=class extends ut{constructor(){super(...arguments);this.name=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o}=await St.find(r,this.context.cwd);return(await Nt.start({configuration:r,stdout:this.context.stdout},async n=>{let u=this.name,A=W.parseIdent(u);if(!r.plugins.has(u))throw new it(`${W.prettyIdent(r,A)} isn't referenced by the current configuration`);let p=`.yarn/plugins/${u}.cjs`,h=K.resolve(o.cwd,p);oe.existsSync(h)&&(n.reportInfo(0,`Removing ${de.pretty(r,p,de.Type.PATH)}...`),await oe.removePromise(h)),n.reportInfo(0,"Updating the configuration..."),await Ve.updateConfiguration(o.cwd,{plugins:E=>{if(!Array.isArray(E))return E;let I=E.filter(v=>v.path!==p);return I.length===0?Ve.deleteProperty:I.length===E.length?E:I}})})).exitCode()}};zh.paths=[["plugin","remove"]],zh.usage=nt.Usage({category:"Plugin-related commands",description:"remove a plugin",details:` + This command deletes the specified plugin from the .yarn/plugins folder and removes it from the configuration. + + **Note:** The plugins have to be referenced by their name property, which can be obtained using the \`yarn plugin runtime\` command. Shorthands are not allowed. + `,examples:[["Remove a plugin imported from the Yarn repository","$0 plugin remove @yarnpkg/plugin-typescript"],["Remove a plugin imported from a local file","$0 plugin remove my-local-plugin"]]});Ye();qt();var Xh=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins);return(await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout},async a=>{for(let n of r.plugins.keys()){let u=this.context.plugins.plugins.has(n),A=n;u&&(A+=" [builtin]"),a.reportJson({name:n,builtin:u}),a.reportInfo(null,`${A}`)}})).exitCode()}};Xh.paths=[["plugin","runtime"]],Xh.usage=nt.Usage({category:"Plugin-related commands",description:"list the active plugins",details:` + This command prints the currently active plugins. Will be displayed both builtin plugins and external plugins. + `,examples:[["List the currently active plugins","$0 plugin runtime"]]});Ye();Ye();qt();var Zh=class extends ut{constructor(){super(...arguments);this.idents=ge.Rest()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(!a)throw new rr(o.cwd,this.context.cwd);let u=new Set;for(let A of this.idents)u.add(W.parseIdent(A).identHash);if(await o.restoreInstallState({restoreResolutions:!1}),await o.resolveEverything({cache:n,report:new Qi}),u.size>0)for(let A of o.storedPackages.values())u.has(A.identHash)&&(o.storedBuildState.delete(A.locatorHash),o.skippedBuilds.delete(A.locatorHash));else o.storedBuildState.clear(),o.skippedBuilds.clear();return await o.installWithNewReport({stdout:this.context.stdout,quiet:this.context.quiet},{cache:n})}};Zh.paths=[["rebuild"]],Zh.usage=nt.Usage({description:"rebuild the project's native packages",details:` + This command will automatically cause Yarn to forget about previous compilations of the given packages and to run them again. + + Note that while Yarn forgets the compilation, the previous artifacts aren't erased from the filesystem and may affect the next builds (in good or bad). To avoid this, you may remove the .yarn/unplugged folder, or any other relevant location where packages might have been stored (Yarn may offer a way to do that automatically in the future). + + By default all packages will be rebuilt, but you can filter the list by specifying the names of the packages you want to clear from memory. + `,examples:[["Rebuild all packages","$0 rebuild"],["Rebuild fsevents only","$0 rebuild fsevents"]]});Ye();Ye();Ye();qt();var q8=$e(Zo());Za();var $h=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Apply the operation to all workspaces from the current project"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:Vs(pl)});this.patterns=ge.Rest()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(!a)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=this.all?o.workspaces:[a],A=["dependencies","devDependencies","peerDependencies"],p=[],h=!1,E=[];for(let C of this.patterns){let T=!1,L=W.parseIdent(C);for(let U of u){let J=[...U.manifest.peerDependenciesMeta.keys()];for(let te of(0,q8.default)(J,C))U.manifest.peerDependenciesMeta.delete(te),h=!0,T=!0;for(let te of A){let le=U.manifest.getForScope(te),pe=[...le.values()].map(Ae=>W.stringifyIdent(Ae));for(let Ae of(0,q8.default)(pe,W.stringifyIdent(L))){let{identHash:ye}=W.parseIdent(Ae),ae=le.get(ye);if(typeof ae>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");U.manifest[te].delete(ye),E.push([U,te,ae]),h=!0,T=!0}}}T||p.push(C)}let I=p.length>1?"Patterns":"Pattern",v=p.length>1?"don't":"doesn't",b=this.all?"any":"this";if(p.length>0)throw new it(`${I} ${de.prettyList(r,p,de.Type.CODE)} ${v} match any packages referenced by ${b} workspace`);return h?(await r.triggerMultipleHooks(C=>C.afterWorkspaceDependencyRemoval,E),await o.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})):0}};$h.paths=[["remove"]],$h.usage=nt.Usage({description:"remove dependencies from the project",details:` + This command will remove the packages matching the specified patterns from the current workspace. + + If the \`--mode=\` option is set, Yarn will change which artifacts are generated. The modes currently supported are: + + - \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run. + + - \`update-lockfile\` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost. + + This command accepts glob patterns as arguments (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them. + `,examples:[["Remove a dependency from the current project","$0 remove lodash"],["Remove a dependency from all workspaces at once","$0 remove lodash --all"],["Remove all dependencies starting with `eslint-`","$0 remove 'eslint-*'"],["Remove all dependencies with the `@babel` scope","$0 remove '@babel/*'"],["Remove all dependencies matching `react-dom` or `react-helmet`","$0 remove 'react-{dom,helmet}'"]]});Ye();Ye();var ade=Be("util"),zd=class extends ut{async execute(){let e=await Ve.find(this.context.cwd,this.context.plugins),{project:r,workspace:o}=await St.find(e,this.context.cwd);if(!o)throw new rr(r.cwd,this.context.cwd);return(await Nt.start({configuration:e,stdout:this.context.stdout},async n=>{let u=o.manifest.scripts,A=je.sortMap(u.keys(),E=>E),p={breakLength:1/0,colors:e.get("enableColors"),maxArrayLength:2},h=A.reduce((E,I)=>Math.max(E,I.length),0);for(let[E,I]of u.entries())n.reportInfo(null,`${E.padEnd(h," ")} ${(0,ade.inspect)(I,p)}`)})).exitCode()}};zd.paths=[["run"]];Ye();Ye();qt();var e0=class extends ut{constructor(){super(...arguments);this.inspect=ge.String("--inspect",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.inspectBrk=ge.String("--inspect-brk",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.topLevel=ge.Boolean("-T,--top-level",!1,{description:"Check the root workspace for scripts and/or binaries instead of the current one"});this.binariesOnly=ge.Boolean("-B,--binaries-only",!1,{description:"Ignore any user defined scripts and only check for binaries"});this.require=ge.String("--require",{description:"Forwarded to the underlying Node process when executing a binary"});this.silent=ge.Boolean("--silent",{hidden:!0});this.scriptName=ge.String();this.args=ge.Proxy()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a,locator:n}=await St.find(r,this.context.cwd);await o.restoreInstallState();let u=this.topLevel?o.topLevelWorkspace.anchoredLocator:n;if(!this.binariesOnly&&await un.hasPackageScript(u,this.scriptName,{project:o}))return await un.executePackageScript(u,this.scriptName,this.args,{project:o,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});let A=await un.getPackageAccessibleBinaries(u,{project:o});if(A.get(this.scriptName)){let h=[];return this.inspect&&(typeof this.inspect=="string"?h.push(`--inspect=${this.inspect}`):h.push("--inspect")),this.inspectBrk&&(typeof this.inspectBrk=="string"?h.push(`--inspect-brk=${this.inspectBrk}`):h.push("--inspect-brk")),this.require&&h.push(`--require=${this.require}`),await un.executePackageAccessibleBinary(u,this.scriptName,this.args,{cwd:this.context.cwd,project:o,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,nodeArgs:h,packageAccessibleBinaries:A})}if(!this.topLevel&&!this.binariesOnly&&a&&this.scriptName.includes(":")){let E=(await Promise.all(o.workspaces.map(async I=>I.manifest.scripts.has(this.scriptName)?I:null))).filter(I=>I!==null);if(E.length===1)return await un.executeWorkspaceScript(E[0],this.scriptName,this.args,{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})}if(this.topLevel)throw this.scriptName==="node-gyp"?new it(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${W.prettyLocator(r,n)}). This typically happens because some package depends on "node-gyp" to build itself, but didn't list it in their dependencies. To fix that, please run "yarn add node-gyp" into your top-level workspace. You also can open an issue on the repository of the specified package to suggest them to use an optional peer dependency.`):new it(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${W.prettyLocator(r,n)}).`);{if(this.scriptName==="global")throw new it("The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead");let h=[this.scriptName].concat(this.args);for(let[E,I]of uC)for(let v of I)if(h.length>=v.length&&JSON.stringify(h.slice(0,v.length))===JSON.stringify(v))throw new it(`Couldn't find a script named "${this.scriptName}", but a matching command can be found in the ${E} plugin. You can install it with "yarn plugin import ${E}".`);throw new it(`Couldn't find a script named "${this.scriptName}".`)}}};e0.paths=[["run"]],e0.usage=nt.Usage({description:"run a script defined in the package.json",details:` + This command will run a tool. The exact tool that will be executed will depend on the current state of your workspace: + + - If the \`scripts\` field from your local package.json contains a matching script name, its definition will get executed. + + - Otherwise, if one of the local workspace's dependencies exposes a binary with a matching name, this binary will get executed. + + - Otherwise, if the specified name contains a colon character and if one of the workspaces in the project contains exactly one script with a matching name, then this script will get executed. + + Whatever happens, the cwd of the spawned process will be the workspace that declares the script (which makes it possible to call commands cross-workspaces using the third syntax). + `,examples:[["Run the tests from the local workspace","$0 run test"],['Same thing, but without the "run" keyword',"$0 test"],["Inspect Webpack while running","$0 run --inspect-brk webpack"]]});Ye();Ye();qt();var t0=class extends ut{constructor(){super(...arguments);this.descriptor=ge.String();this.resolution=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(await o.restoreInstallState({restoreResolutions:!1}),!a)throw new rr(o.cwd,this.context.cwd);let u=W.parseDescriptor(this.descriptor,!0),A=W.makeDescriptor(u,this.resolution);return o.storedDescriptors.set(u.descriptorHash,u),o.storedDescriptors.set(A.descriptorHash,A),o.resolutionAliases.set(u.descriptorHash,A.descriptorHash),await o.installWithNewReport({stdout:this.context.stdout},{cache:n})}};t0.paths=[["set","resolution"]],t0.usage=nt.Usage({description:"enforce a package resolution",details:'\n This command updates the resolution table so that `descriptor` is resolved by `resolution`.\n\n Note that by default this command only affect the current resolution table - meaning that this "manual override" will disappear if you remove the lockfile, or if the package disappear from the table. If you wish to make the enforced resolution persist whatever happens, edit the `resolutions` field in your top-level manifest.\n\n Note that no attempt is made at validating that `resolution` is a valid resolution entry for `descriptor`.\n ',examples:[["Force all instances of lodash@npm:^1.2.3 to resolve to 1.5.0","$0 set resolution lodash@npm:^1.2.3 1.5.0"]]});Ye();Pt();qt();var lde=$e(Zo()),r0=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Unlink all workspaces belonging to the target project from the current one"});this.leadingArguments=ge.Rest()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(!a)throw new rr(o.cwd,this.context.cwd);let u=o.topLevelWorkspace,A=new Set;if(this.leadingArguments.length===0&&this.all)for(let{pattern:p,reference:h}of u.manifest.resolutions)h.startsWith("portal:")&&A.add(p.descriptor.fullName);if(this.leadingArguments.length>0)for(let p of this.leadingArguments){let h=K.resolve(this.context.cwd,ue.toPortablePath(p));if(je.isPathLike(p)){let E=await Ve.find(h,this.context.plugins,{useRc:!1,strict:!1}),{project:I,workspace:v}=await St.find(E,h);if(!v)throw new rr(I.cwd,h);if(this.all){for(let b of I.workspaces)b.manifest.name&&A.add(W.stringifyIdent(b.anchoredLocator));if(A.size===0)throw new it("No workspace found to be unlinked in the target project")}else{if(!v.manifest.name)throw new it("The target workspace doesn't have a name and thus cannot be unlinked");A.add(W.stringifyIdent(v.anchoredLocator))}}else{let E=[...u.manifest.resolutions.map(({pattern:I})=>I.descriptor.fullName)];for(let I of(0,lde.default)(E,p))A.add(I)}}return u.manifest.resolutions=u.manifest.resolutions.filter(({pattern:p})=>!A.has(p.descriptor.fullName)),await o.installWithNewReport({stdout:this.context.stdout,quiet:this.context.quiet},{cache:n})}};r0.paths=[["unlink"]],r0.usage=nt.Usage({description:"disconnect the local project from another one",details:` + This command will remove any resolutions in the project-level manifest that would have been added via a yarn link with similar arguments. + `,examples:[["Unregister a remote workspace in the current project","$0 unlink ~/ts-loader"],["Unregister all workspaces from a remote project in the current project","$0 unlink ~/jest --all"],["Unregister all previously linked workspaces","$0 unlink --all"],["Unregister all workspaces matching a glob","$0 unlink '@babel/*' 'pkg-{a,b}'"]]});Ye();Ye();Ye();qt();var cde=$e(A2()),G8=$e(Zo());Za();var Kf=class extends ut{constructor(){super(...arguments);this.interactive=ge.Boolean("-i,--interactive",{description:"Offer various choices, depending on the detected upgrade paths"});this.fixed=ge.Boolean("-F,--fixed",!1,{description:"Store dependency tags as-is instead of resolving them"});this.exact=ge.Boolean("-E,--exact",!1,{description:"Don't use any semver modifier on the resolved range"});this.tilde=ge.Boolean("-T,--tilde",!1,{description:"Use the `~` semver modifier on the resolved range"});this.caret=ge.Boolean("-C,--caret",!1,{description:"Use the `^` semver modifier on the resolved range"});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Resolve again ALL resolutions for those packages"});this.mode=ge.String("--mode",{description:"Change what artifacts installs generate",validator:Vs(pl)});this.patterns=ge.Rest()}async execute(){return this.recursive?await this.executeUpRecursive():await this.executeUpClassic()}async executeUpRecursive(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(!a)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=[...o.storedDescriptors.values()],A=u.map(E=>W.stringifyIdent(E)),p=new Set;for(let E of this.patterns){if(W.parseDescriptor(E).range!=="unknown")throw new it("Ranges aren't allowed when using --recursive");for(let I of(0,G8.default)(A,E)){let v=W.parseIdent(I);p.add(v.identHash)}}let h=u.filter(E=>p.has(E.identHash));for(let E of h)o.storedDescriptors.delete(E.descriptorHash),o.storedResolutions.delete(E.descriptorHash);return await o.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})}async executeUpClassic(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(!a)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=this.fixed,A=this.interactive??r.get("preferInteractive"),p=p2(this,o),h=A?["keep","reuse","project","latest"]:["project","latest"],E=[],I=[];for(let L of this.patterns){let U=!1,J=W.parseDescriptor(L),te=W.stringifyIdent(J);for(let le of o.workspaces)for(let pe of["dependencies","devDependencies"]){let ye=[...le.manifest.getForScope(pe).values()].map(we=>W.stringifyIdent(we)),ae=te==="*"?ye:(0,G8.default)(ye,te);for(let we of ae){let Pe=W.parseIdent(we),g=le.manifest[pe].get(Pe.identHash);if(typeof g>"u")throw new Error("Assertion failed: Expected the descriptor to be registered");let Ee=W.makeDescriptor(Pe,J.range);E.push(Promise.resolve().then(async()=>[le,pe,g,await h2(Ee,{project:o,workspace:le,cache:n,target:pe,fixed:u,modifier:p,strategies:h})])),U=!0}}U||I.push(L)}if(I.length>1)throw new it(`Patterns ${de.prettyList(r,I,de.Type.CODE)} don't match any packages referenced by any workspace`);if(I.length>0)throw new it(`Pattern ${de.prettyList(r,I,de.Type.CODE)} doesn't match any packages referenced by any workspace`);let v=await Promise.all(E),b=await AA.start({configuration:r,stdout:this.context.stdout,suggestInstall:!1},async L=>{for(let[,,U,{suggestions:J,rejections:te}]of v){let le=J.filter(pe=>pe.descriptor!==null);if(le.length===0){let[pe]=te;if(typeof pe>"u")throw new Error("Assertion failed: Expected an error to have been set");let Ae=this.cli.error(pe);o.configuration.get("enableNetwork")?L.reportError(27,`${W.prettyDescriptor(r,U)} can't be resolved to a satisfying range + +${Ae}`):L.reportError(27,`${W.prettyDescriptor(r,U)} can't be resolved to a satisfying range (note: network resolution has been disabled) + +${Ae}`)}else le.length>1&&!A&&L.reportError(27,`${W.prettyDescriptor(r,U)} has multiple possible upgrade strategies; use -i to disambiguate manually`)}});if(b.hasErrors())return b.exitCode();let C=!1,T=[];for(let[L,U,,{suggestions:J}]of v){let te,le=J.filter(ae=>ae.descriptor!==null),pe=le[0].descriptor,Ae=le.every(ae=>W.areDescriptorsEqual(ae.descriptor,pe));le.length===1||Ae?te=pe:(C=!0,{answer:te}=await(0,cde.prompt)({type:"select",name:"answer",message:`Which range do you want to use in ${W.prettyWorkspace(r,L)} \u276F ${U}?`,choices:J.map(({descriptor:ae,name:we,reason:Pe})=>ae?{name:we,hint:Pe,descriptor:ae}:{name:we,hint:Pe,disabled:!0}),onCancel:()=>process.exit(130),result(ae){return this.find(ae,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let ye=L.manifest[U].get(te.identHash);if(typeof ye>"u")throw new Error("Assertion failed: This descriptor should have a matching entry");if(ye.descriptorHash!==te.descriptorHash)L.manifest[U].set(te.identHash,te),T.push([L,U,ye,te]);else{let ae=r.makeResolver(),we={project:o,resolver:ae},Pe=r.normalizeDependency(ye),g=ae.bindDescriptor(Pe,L.anchoredLocator,we);o.forgetResolution(g)}}return await r.triggerMultipleHooks(L=>L.afterWorkspaceDependencyReplacement,T),C&&this.context.stdout.write(` +`),await o.installWithNewReport({stdout:this.context.stdout},{cache:n,mode:this.mode})}};Kf.paths=[["up"]],Kf.usage=nt.Usage({description:"upgrade dependencies across the project",details:"\n This command upgrades the packages matching the list of specified patterns to their latest available version across the whole project (regardless of whether they're part of `dependencies` or `devDependencies` - `peerDependencies` won't be affected). This is a project-wide command: all workspaces will be upgraded in the process.\n\n If `-R,--recursive` is set the command will change behavior and no other switch will be allowed. When operating under this mode `yarn up` will force all ranges matching the selected packages to be resolved again (often to the highest available versions) before being stored in the lockfile. It however won't touch your manifests anymore, so depending on your needs you might want to run both `yarn up` and `yarn up -R` to cover all bases.\n\n If `-i,--interactive` is set (or if the `preferInteractive` settings is toggled on) the command will offer various choices, depending on the detected upgrade paths. Some upgrades require this flag in order to resolve ambiguities.\n\n The, `-C,--caret`, `-E,--exact` and `-T,--tilde` options have the same meaning as in the `add` command (they change the modifier used when the range is missing or a tag, and are ignored when the range is explicitly set).\n\n If the `--mode=` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the latter will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n Generally you can see `yarn up` as a counterpart to what was `yarn upgrade --latest` in Yarn 1 (ie it ignores the ranges previously listed in your manifests), but unlike `yarn upgrade` which only upgraded dependencies in the current workspace, `yarn up` will upgrade all workspaces at the same time.\n\n This command accepts glob patterns as arguments (if valid Descriptors and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n **Note:** The ranges have to be static, only the package scopes and names can contain glob patterns.\n ",examples:[["Upgrade all instances of lodash to the latest release","$0 up lodash"],["Upgrade all instances of lodash to the latest release, but ask confirmation for each","$0 up lodash -i"],["Upgrade all instances of lodash to 1.2.3","$0 up lodash@1.2.3"],["Upgrade all instances of packages with the `@babel` scope to the latest release","$0 up '@babel/*'"],["Upgrade all instances of packages containing the word `jest` to the latest release","$0 up '*jest*'"],["Upgrade all instances of packages with the `@babel` scope to 7.0.0","$0 up '@babel/*@7.0.0'"]]}),Kf.schema=[lI("recursive",Gu.Forbids,["interactive","exact","tilde","caret"],{ignore:[void 0,!1]})];Ye();Ye();Ye();qt();var n0=class extends ut{constructor(){super(...arguments);this.recursive=ge.Boolean("-R,--recursive",!1,{description:"List, for each workspace, what are all the paths that lead to the dependency"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.peers=ge.Boolean("--peers",!1,{description:"Also print the peer dependencies that match the specified name"});this.package=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd);if(!a)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState();let n=W.parseIdent(this.package).identHash,u=this.recursive?lgt(o,n,{configuration:r,peers:this.peers}):agt(o,n,{configuration:r,peers:this.peers});$s.emitTree(u,{configuration:r,stdout:this.context.stdout,json:this.json,separators:1})}};n0.paths=[["why"]],n0.usage=nt.Usage({description:"display the reason why a package is needed",details:` + This command prints the exact reasons why a package appears in the dependency tree. + + If \`-R,--recursive\` is set, the listing will go in depth and will list, for each workspaces, what are all the paths that lead to the dependency. Note that the display is somewhat optimized in that it will not print the package listing twice for a single package, so if you see a leaf named "Foo" when looking for "Bar", it means that "Foo" already got printed higher in the tree. + `,examples:[["Explain why lodash is used in your project","$0 why lodash"]]});function agt(t,e,{configuration:r,peers:o}){let a=je.sortMap(t.storedPackages.values(),A=>W.stringifyLocator(A)),n={},u={children:n};for(let A of a){let p={};for(let E of A.dependencies.values()){if(!o&&A.peerDependencies.has(E.identHash))continue;let I=t.storedResolutions.get(E.descriptorHash);if(!I)throw new Error("Assertion failed: The resolution should have been registered");let v=t.storedPackages.get(I);if(!v)throw new Error("Assertion failed: The package should have been registered");if(v.identHash!==e)continue;{let C=W.stringifyLocator(A);n[C]={value:[A,de.Type.LOCATOR],children:p}}let b=W.stringifyLocator(v);p[b]={value:[{descriptor:E,locator:v},de.Type.DEPENDENT]}}}return u}function lgt(t,e,{configuration:r,peers:o}){let a=je.sortMap(t.workspaces,v=>W.stringifyLocator(v.anchoredLocator)),n=new Set,u=new Set,A=v=>{if(n.has(v.locatorHash))return u.has(v.locatorHash);if(n.add(v.locatorHash),v.identHash===e)return u.add(v.locatorHash),!0;let b=!1;v.identHash===e&&(b=!0);for(let C of v.dependencies.values()){if(!o&&v.peerDependencies.has(C.identHash))continue;let T=t.storedResolutions.get(C.descriptorHash);if(!T)throw new Error("Assertion failed: The resolution should have been registered");let L=t.storedPackages.get(T);if(!L)throw new Error("Assertion failed: The package should have been registered");A(L)&&(b=!0)}return b&&u.add(v.locatorHash),b};for(let v of a)A(v.anchoredPackage);let p=new Set,h={},E={children:h},I=(v,b,C)=>{if(!u.has(v.locatorHash))return;let T=C!==null?de.tuple(de.Type.DEPENDENT,{locator:v,descriptor:C}):de.tuple(de.Type.LOCATOR,v),L={},U={value:T,children:L},J=W.stringifyLocator(v);if(b[J]=U,!p.has(v.locatorHash)&&(p.add(v.locatorHash),!(C!==null&&t.tryWorkspaceByLocator(v))))for(let te of v.dependencies.values()){if(!o&&v.peerDependencies.has(te.identHash))continue;let le=t.storedResolutions.get(te.descriptorHash);if(!le)throw new Error("Assertion failed: The resolution should have been registered");let pe=t.storedPackages.get(le);if(!pe)throw new Error("Assertion failed: The package should have been registered");I(pe,L,te)}};for(let v of a)I(v.anchoredPackage,h,null);return E}Ye();var eH={};Kt(eH,{GitFetcher:()=>C2,GitResolver:()=>w2,default:()=>bgt,gitUtils:()=>ra});Ye();Pt();var ra={};Kt(ra,{TreeishProtocols:()=>E2,clone:()=>$8,fetchBase:()=>Qde,fetchChangedFiles:()=>Fde,fetchChangedWorkspaces:()=>Sgt,fetchRoot:()=>kde,isGitUrl:()=>EC,lsRemote:()=>bde,normalizeLocator:()=>Pgt,normalizeRepoUrl:()=>mC,resolveUrl:()=>Z8,splitRepoUrl:()=>i0,validateRepoUrl:()=>X8});Ye();Pt();qt();var Pde=$e(Bde()),Sde=$e(EU()),yC=$e(Be("querystring")),J8=$e(zn());function K8(t,e,r){let o=t.indexOf(r);return t.lastIndexOf(e,o>-1?o:1/0)}function vde(t){try{return new URL(t)}catch{return}}function vgt(t){let e=K8(t,"@","#"),r=K8(t,":","#");return r>e&&(t=`${t.slice(0,r)}/${t.slice(r+1)}`),K8(t,":","#")===-1&&t.indexOf("//")===-1&&(t=`ssh://${t}`),t}function Dde(t){return vde(t)||vde(vgt(t))}function mC(t,{git:e=!1}={}){if(t=t.replace(/^git\+https:/,"https:"),t=t.replace(/^(?:github:|https:\/\/github\.com\/|git:\/\/github\.com\/)?(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)(?:\.git)?(#.*)?$/,"https://github.com/$1/$2.git$3"),t=t.replace(/^https:\/\/github\.com\/(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)\/tarball\/(.+)?$/,"https://github.com/$1/$2.git#$3"),e){let r=Dde(t);r&&(t=r.href),t=t.replace(/^git\+([^:]+):/,"$1:")}return t}function xde(){return{...process.env,GIT_SSH_COMMAND:process.env.GIT_SSH_COMMAND||`${process.env.GIT_SSH||"ssh"} -o BatchMode=yes`}}var Dgt=[/^ssh:/,/^git(?:\+[^:]+)?:/,/^(?:git\+)?https?:[^#]+\/[^#]+(?:\.git)(?:#.*)?$/,/^git@[^#]+\/[^#]+\.git(?:#.*)?$/,/^(?:github:|https:\/\/github\.com\/)?(?!\.{1,2}\/)([a-zA-Z._0-9-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z._0-9-]+?)(?:\.git)?(?:#.*)?$/,/^https:\/\/github\.com\/(?!\.{1,2}\/)([a-zA-Z0-9._-]+)\/(?!\.{1,2}(?:#|$))([a-zA-Z0-9._-]+?)\/tarball\/(.+)?$/],E2=(a=>(a.Commit="commit",a.Head="head",a.Tag="tag",a.Semver="semver",a))(E2||{});function EC(t){return t?Dgt.some(e=>!!t.match(e)):!1}function i0(t){t=mC(t);let e=t.indexOf("#");if(e===-1)return{repo:t,treeish:{protocol:"head",request:"HEAD"},extra:{}};let r=t.slice(0,e),o=t.slice(e+1);if(o.match(/^[a-z]+=/)){let a=yC.default.parse(o);for(let[p,h]of Object.entries(a))if(typeof h!="string")throw new Error(`Assertion failed: The ${p} parameter must be a literal string`);let n=Object.values(E2).find(p=>Object.hasOwn(a,p)),[u,A]=typeof n<"u"?[n,a[n]]:["head","HEAD"];for(let p of Object.values(E2))delete a[p];return{repo:r,treeish:{protocol:u,request:A},extra:a}}else{let a=o.indexOf(":"),[n,u]=a===-1?[null,o]:[o.slice(0,a),o.slice(a+1)];return{repo:r,treeish:{protocol:n,request:u},extra:{}}}}function Pgt(t){return W.makeLocator(t,mC(t.reference))}function X8(t,{configuration:e}){let r=mC(t,{git:!0});if(!rn.getNetworkSettings(`https://${(0,Pde.default)(r).resource}`,{configuration:e}).enableNetwork)throw new zt(80,`Request to '${r}' has been blocked because of your configuration settings`);return r}async function bde(t,e){let r=X8(t,{configuration:e}),o=await z8("listing refs",["ls-remote",r],{cwd:e.startingCwd,env:xde()},{configuration:e,normalizedRepoUrl:r}),a=new Map,n=/^([a-f0-9]{40})\t([^\n]+)/gm,u;for(;(u=n.exec(o.stdout))!==null;)a.set(u[2],u[1]);return a}async function Z8(t,e){let{repo:r,treeish:{protocol:o,request:a},extra:n}=i0(t),u=await bde(r,e),A=(h,E)=>{switch(h){case"commit":{if(!E.match(/^[a-f0-9]{40}$/))throw new Error("Invalid commit hash");return yC.default.stringify({...n,commit:E})}case"head":{let I=u.get(E==="HEAD"?E:`refs/heads/${E}`);if(typeof I>"u")throw new Error(`Unknown head ("${E}")`);return yC.default.stringify({...n,commit:I})}case"tag":{let I=u.get(`refs/tags/${E}`);if(typeof I>"u")throw new Error(`Unknown tag ("${E}")`);return yC.default.stringify({...n,commit:I})}case"semver":{let I=kr.validRange(E);if(!I)throw new Error(`Invalid range ("${E}")`);let v=new Map([...u.entries()].filter(([C])=>C.startsWith("refs/tags/")).map(([C,T])=>[J8.default.parse(C.slice(10)),T]).filter(C=>C[0]!==null)),b=J8.default.maxSatisfying([...v.keys()],I);if(b===null)throw new Error(`No matching range ("${E}")`);return yC.default.stringify({...n,commit:v.get(b)})}case null:{let I;if((I=p("commit",E))!==null||(I=p("tag",E))!==null||(I=p("head",E))!==null)return I;throw E.match(/^[a-f0-9]+$/)?new Error(`Couldn't resolve "${E}" as either a commit, a tag, or a head - if a commit, use the 40-characters commit hash`):new Error(`Couldn't resolve "${E}" as either a commit, a tag, or a head`)}default:throw new Error(`Invalid Git resolution protocol ("${h}")`)}},p=(h,E)=>{try{return A(h,E)}catch{return null}};return mC(`${r}#${A(o,a)}`)}async function $8(t,e){return await e.getLimit("cloneConcurrency")(async()=>{let{repo:r,treeish:{protocol:o,request:a}}=i0(t);if(o!=="commit")throw new Error("Invalid treeish protocol when cloning");let n=X8(r,{configuration:e}),u=await oe.mktempPromise(),A={cwd:u,env:xde()};return await z8("cloning the repository",["clone","-c core.autocrlf=false",n,ue.fromPortablePath(u)],A,{configuration:e,normalizedRepoUrl:n}),await z8("switching branch",["checkout",`${a}`],A,{configuration:e,normalizedRepoUrl:n}),u})}async function kde(t){let e,r=t;do{if(e=r,await oe.existsPromise(K.join(e,".git")))return e;r=K.dirname(e)}while(r!==e);return null}async function Qde(t,{baseRefs:e}){if(e.length===0)throw new it("Can't run this command with zero base refs specified.");let r=[];for(let A of e){let{code:p}=await Ur.execvp("git",["merge-base",A,"HEAD"],{cwd:t});p===0&&r.push(A)}if(r.length===0)throw new it(`No ancestor could be found between any of HEAD and ${e.join(", ")}`);let{stdout:o}=await Ur.execvp("git",["merge-base","HEAD",...r],{cwd:t,strict:!0}),a=o.trim(),{stdout:n}=await Ur.execvp("git",["show","--quiet","--pretty=format:%s",a],{cwd:t,strict:!0}),u=n.trim();return{hash:a,title:u}}async function Fde(t,{base:e,project:r}){let o=je.buildIgnorePattern(r.configuration.get("changesetIgnorePatterns")),{stdout:a}=await Ur.execvp("git",["diff","--name-only",`${e}`],{cwd:t,strict:!0}),n=a.split(/\r\n|\r|\n/).filter(h=>h.length>0).map(h=>K.resolve(t,ue.toPortablePath(h))),{stdout:u}=await Ur.execvp("git",["ls-files","--others","--exclude-standard"],{cwd:t,strict:!0}),A=u.split(/\r\n|\r|\n/).filter(h=>h.length>0).map(h=>K.resolve(t,ue.toPortablePath(h))),p=[...new Set([...n,...A].sort())];return o?p.filter(h=>!K.relative(r.cwd,h).match(o)):p}async function Sgt({ref:t,project:e}){if(e.configuration.projectCwd===null)throw new it("This command can only be run from within a Yarn project");let r=[K.resolve(e.cwd,dr.lockfile),K.resolve(e.cwd,e.configuration.get("cacheFolder")),K.resolve(e.cwd,e.configuration.get("installStatePath")),K.resolve(e.cwd,e.configuration.get("virtualFolder"))];await e.configuration.triggerHook(u=>u.populateYarnPaths,e,u=>{u!=null&&r.push(u)});let o=await kde(e.configuration.projectCwd);if(o==null)throw new it("This command can only be run on Git repositories");let a=await Qde(o,{baseRefs:typeof t=="string"?[t]:e.configuration.get("changesetBaseRefs")}),n=await Fde(o,{base:a.hash,project:e});return new Set(je.mapAndFilter(n,u=>{let A=e.tryWorkspaceByFilePath(u);return A===null?je.mapAndFilter.skip:r.some(p=>u.startsWith(p))?je.mapAndFilter.skip:A}))}async function z8(t,e,r,{configuration:o,normalizedRepoUrl:a}){try{return await Ur.execvp("git",e,{...r,strict:!0})}catch(n){if(!(n instanceof Ur.ExecError))throw n;let u=n.reportExtra,A=n.stderr.toString();throw new zt(1,`Failed ${t}`,p=>{p.reportError(1,` ${de.prettyField(o,{label:"Repository URL",value:de.tuple(de.Type.URL,a)})}`);for(let h of A.matchAll(/^(.+?): (.*)$/gm)){let[,E,I]=h;E=E.toLowerCase();let v=E==="error"?"Error":`${(0,Sde.default)(E)} Error`;p.reportError(1,` ${de.prettyField(o,{label:v,value:de.tuple(de.Type.NO_HINT,I)})}`)}u?.(p)})}}var C2=class{supports(e,r){return EC(e.reference)}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,a=new Map(r.checksums);a.set(e.locatorHash,o);let n={...r,checksums:a},u=await this.downloadHosted(e,n);if(u!==null)return u;let[A,p,h]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${W.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote repository`),loader:()=>this.cloneFromRemote(e,n),...r.cacheOptions});return{packageFs:A,releaseFs:p,prefixPath:W.getIdentVendorPath(e),checksum:h}}async downloadHosted(e,r){return r.project.configuration.reduceHook(o=>o.fetchHostedRepository,null,e,r)}async cloneFromRemote(e,r){let o=await $8(e.reference,r.project.configuration),a=i0(e.reference),n=K.join(o,"package.tgz");await un.prepareExternalProject(o,n,{configuration:r.project.configuration,report:r.report,workspace:a.extra.workspace,locator:e});let u=await oe.readFilePromise(n);return await je.releaseAfterUseAsync(async()=>await Xi.convertToZip(u,{configuration:r.project.configuration,prefixPath:W.getIdentVendorPath(e),stripComponents:1}))}};Ye();Ye();var w2=class{supportsDescriptor(e,r){return EC(e.range)}supportsLocator(e,r){return EC(e.reference)}shouldPersistResolution(e,r){return!0}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){let a=await Z8(e.range,o.project.configuration);return[W.makeLocator(e,a)]}async getSatisfying(e,r,o,a){let n=i0(e.range);return{locators:o.filter(A=>{if(A.identHash!==e.identHash)return!1;let p=i0(A.reference);return!(n.repo!==p.repo||n.treeish.protocol==="commit"&&n.treeish.request!==p.treeish.request)}),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Mt.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var xgt={configuration:{changesetBaseRefs:{description:"The base git refs that the current HEAD is compared against when detecting changes. Supports git branches, tags, and commits.",type:"STRING",isArray:!0,isNullable:!1,default:["master","origin/master","upstream/master","main","origin/main","upstream/main"]},changesetIgnorePatterns:{description:"Array of glob patterns; files matching them will be ignored when fetching the changed files",type:"STRING",default:[],isArray:!0},cloneConcurrency:{description:"Maximal number of concurrent clones",type:"NUMBER",default:2}},fetchers:[C2],resolvers:[w2]};var bgt=xgt;qt();var s0=class extends ut{constructor(){super(...arguments);this.since=ge.String("--since",{description:"Only include workspaces that have been changed since the specified ref.",tolerateBoolean:!0});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Find packages via dependencies/devDependencies instead of using the workspaces field"});this.noPrivate=ge.Boolean("--no-private",{description:"Exclude workspaces that have the private field set to true"});this.verbose=ge.Boolean("-v,--verbose",!1,{description:"Also return the cross-dependencies between workspaces"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o}=await St.find(r,this.context.cwd);return(await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout},async n=>{let u=this.since?await ra.fetchChangedWorkspaces({ref:this.since,project:o}):o.workspaces,A=new Set(u);if(this.recursive)for(let p of[...u].map(h=>h.getRecursiveWorkspaceDependents()))for(let h of p)A.add(h);for(let p of A){let{manifest:h}=p;if(h.private&&this.noPrivate)continue;let E;if(this.verbose){let I=new Set,v=new Set;for(let b of Mt.hardDependencies)for(let[C,T]of h.getForScope(b)){let L=o.tryWorkspaceByDescriptor(T);L===null?o.workspacesByIdent.has(C)&&v.add(T):I.add(L)}E={workspaceDependencies:Array.from(I).map(b=>b.relativeCwd),mismatchedWorkspaceDependencies:Array.from(v).map(b=>W.stringifyDescriptor(b))}}n.reportInfo(null,`${p.relativeCwd}`),n.reportJson({location:p.relativeCwd,name:h.name?W.stringifyIdent(h.name):null,...E})}})).exitCode()}};s0.paths=[["workspaces","list"]],s0.usage=nt.Usage({category:"Workspace-related commands",description:"list all available workspaces",details:"\n This command will print the list of all workspaces in the project.\n\n - If `--since` is set, Yarn will only list workspaces that have been modified since the specified ref. By default Yarn will use the refs specified by the `changesetBaseRefs` configuration option.\n\n - If `-R,--recursive` is set, Yarn will find workspaces to run the command on by recursively evaluating `dependencies` and `devDependencies` fields, instead of looking at the `workspaces` fields.\n\n - If `--no-private` is set, Yarn will not list any workspaces that have the `private` field set to `true`.\n\n - If both the `-v,--verbose` and `--json` options are set, Yarn will also return the cross-dependencies between each workspaces (useful when you wish to automatically generate Buck / Bazel rules).\n "});Ye();Ye();qt();var o0=class extends ut{constructor(){super(...arguments);this.workspaceName=ge.String();this.commandName=ge.String();this.args=ge.Proxy()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd);if(!a)throw new rr(o.cwd,this.context.cwd);let n=o.workspaces,u=new Map(n.map(p=>[W.stringifyIdent(p.anchoredLocator),p])),A=u.get(this.workspaceName);if(A===void 0){let p=Array.from(u.keys()).sort();throw new it(`Workspace '${this.workspaceName}' not found. Did you mean any of the following: + - ${p.join(` + - `)}?`)}return this.cli.run([this.commandName,...this.args],{cwd:A.cwd})}};o0.paths=[["workspace"]],o0.usage=nt.Usage({category:"Workspace-related commands",description:"run a command within the specified workspace",details:` + This command will run a given sub-command on a single workspace. + `,examples:[["Add a package to a single workspace","yarn workspace components add -D react"],["Run build script on a single workspace","yarn workspace components run build"]]});var kgt={configuration:{enableImmutableInstalls:{description:"If true (the default on CI), prevents the install command from modifying the lockfile",type:"BOOLEAN",default:Tde.isCI},defaultSemverRangePrefix:{description:"The default save prefix: '^', '~' or ''",type:"STRING",values:["^","~",""],default:"^"},preferReuse:{description:"If true, `yarn add` will attempt to reuse the most common dependency range in other workspaces.",type:"BOOLEAN",default:!1}},commands:[Qh,Fh,Th,Rh,t0,Vh,Uh,s0,Wd,Vd,dC,Kd,bh,kh,Nh,Lh,Mh,Oh,_h,Hh,jh,qh,r0,Gh,Yh,Jh,Kh,zh,Wh,Xh,Zh,$h,zd,e0,Kf,n0,o0]},Qgt=kgt;var oH={};Kt(oH,{default:()=>Tgt});Ye();var kt={optional:!0},rH=[["@tailwindcss/aspect-ratio@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@tailwindcss/line-clamp@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@fullhuman/postcss-purgecss@3.1.3 || 3.1.3-alpha.0",{peerDependencies:{postcss:"^8.0.0"}}],["@samverschueren/stream-to-observable@<0.3.1",{peerDependenciesMeta:{rxjs:kt,zenObservable:kt}}],["any-observable@<0.5.1",{peerDependenciesMeta:{rxjs:kt,zenObservable:kt}}],["@pm2/agent@<1.0.4",{dependencies:{debug:"*"}}],["debug@<4.2.0",{peerDependenciesMeta:{["supports-color"]:kt}}],["got@<11",{dependencies:{["@types/responselike"]:"^1.0.0",["@types/keyv"]:"^3.1.1"}}],["cacheable-lookup@<4.1.2",{dependencies:{["@types/keyv"]:"^3.1.1"}}],["http-link-dataloader@*",{peerDependencies:{graphql:"^0.13.1 || ^14.0.0"}}],["typescript-language-server@*",{dependencies:{["vscode-jsonrpc"]:"^5.0.1",["vscode-languageserver-protocol"]:"^3.15.0"}}],["postcss-syntax@*",{peerDependenciesMeta:{["postcss-html"]:kt,["postcss-jsx"]:kt,["postcss-less"]:kt,["postcss-markdown"]:kt,["postcss-scss"]:kt}}],["jss-plugin-rule-value-function@<=10.1.1",{dependencies:{["tiny-warning"]:"^1.0.2"}}],["ink-select-input@<4.1.0",{peerDependencies:{react:"^16.8.2"}}],["license-webpack-plugin@<2.3.18",{peerDependenciesMeta:{webpack:kt}}],["snowpack@>=3.3.0",{dependencies:{["node-gyp"]:"^7.1.0"}}],["promise-inflight@*",{peerDependenciesMeta:{bluebird:kt}}],["reactcss@*",{peerDependencies:{react:"*"}}],["react-color@<=2.19.0",{peerDependencies:{react:"*"}}],["gatsby-plugin-i18n@*",{dependencies:{ramda:"^0.24.1"}}],["useragent@^2.0.0",{dependencies:{request:"^2.88.0",yamlparser:"0.0.x",semver:"5.5.x"}}],["@apollographql/apollo-tools@<=0.5.2",{peerDependencies:{graphql:"^14.2.1 || ^15.0.0"}}],["material-table@^2.0.0",{dependencies:{"@babel/runtime":"^7.11.2"}}],["@babel/parser@*",{dependencies:{"@babel/types":"^7.8.3"}}],["fork-ts-checker-webpack-plugin@<=6.3.4",{peerDependencies:{eslint:">= 6",typescript:">= 2.7",webpack:">= 4","vue-template-compiler":"*"},peerDependenciesMeta:{eslint:kt,"vue-template-compiler":kt}}],["rc-animate@<=3.1.1",{peerDependencies:{react:">=16.9.0","react-dom":">=16.9.0"}}],["react-bootstrap-table2-paginator@*",{dependencies:{classnames:"^2.2.6"}}],["react-draggable@<=4.4.3",{peerDependencies:{react:">= 16.3.0","react-dom":">= 16.3.0"}}],["apollo-upload-client@<14",{peerDependencies:{graphql:"14 - 15"}}],["react-instantsearch-core@<=6.7.0",{peerDependencies:{algoliasearch:">= 3.1 < 5"}}],["react-instantsearch-dom@<=6.7.0",{dependencies:{"react-fast-compare":"^3.0.0"}}],["ws@<7.2.1",{peerDependencies:{bufferutil:"^4.0.1","utf-8-validate":"^5.0.2"},peerDependenciesMeta:{bufferutil:kt,"utf-8-validate":kt}}],["react-portal@<4.2.2",{peerDependencies:{"react-dom":"^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0"}}],["react-scripts@<=4.0.1",{peerDependencies:{react:"*"}}],["testcafe@<=1.10.1",{dependencies:{"@babel/plugin-transform-for-of":"^7.12.1","@babel/runtime":"^7.12.5"}}],["testcafe-legacy-api@<=4.2.0",{dependencies:{"testcafe-hammerhead":"^17.0.1","read-file-relative":"^1.2.0"}}],["@google-cloud/firestore@<=4.9.3",{dependencies:{protobufjs:"^6.8.6"}}],["gatsby-source-apiserver@*",{dependencies:{["babel-polyfill"]:"^6.26.0"}}],["@webpack-cli/package-utils@<=1.0.1-alpha.4",{dependencies:{["cross-spawn"]:"^7.0.3"}}],["gatsby-remark-prismjs@<3.3.28",{dependencies:{lodash:"^4"}}],["gatsby-plugin-favicon@*",{peerDependencies:{webpack:"*"}}],["gatsby-plugin-sharp@<=4.6.0-next.3",{dependencies:{debug:"^4.3.1"}}],["gatsby-react-router-scroll@<=5.6.0-next.0",{dependencies:{["prop-types"]:"^15.7.2"}}],["@rebass/forms@*",{dependencies:{["@styled-system/should-forward-prop"]:"^5.0.0"},peerDependencies:{react:"^16.8.6"}}],["rebass@*",{peerDependencies:{react:"^16.8.6"}}],["@ant-design/react-slick@<=0.28.3",{peerDependencies:{react:">=16.0.0"}}],["mqtt@<4.2.7",{dependencies:{duplexify:"^4.1.1"}}],["vue-cli-plugin-vuetify@<=2.0.3",{dependencies:{semver:"^6.3.0"},peerDependenciesMeta:{"sass-loader":kt,"vuetify-loader":kt}}],["vue-cli-plugin-vuetify@<=2.0.4",{dependencies:{"null-loader":"^3.0.0"}}],["vue-cli-plugin-vuetify@>=2.4.3",{peerDependencies:{vue:"*"}}],["@vuetify/cli-plugin-utils@<=0.0.4",{dependencies:{semver:"^6.3.0"},peerDependenciesMeta:{"sass-loader":kt}}],["@vue/cli-plugin-typescript@<=5.0.0-alpha.0",{dependencies:{"babel-loader":"^8.1.0"}}],["@vue/cli-plugin-typescript@<=5.0.0-beta.0",{dependencies:{"@babel/core":"^7.12.16"},peerDependencies:{"vue-template-compiler":"^2.0.0"},peerDependenciesMeta:{"vue-template-compiler":kt}}],["cordova-ios@<=6.3.0",{dependencies:{underscore:"^1.9.2"}}],["cordova-lib@<=10.0.1",{dependencies:{underscore:"^1.9.2"}}],["git-node-fs@*",{peerDependencies:{"js-git":"^0.7.8"},peerDependenciesMeta:{"js-git":kt}}],["consolidate@<0.16.0",{peerDependencies:{mustache:"^3.0.0"},peerDependenciesMeta:{mustache:kt}}],["consolidate@<=0.16.0",{peerDependencies:{velocityjs:"^2.0.1",tinyliquid:"^0.2.34","liquid-node":"^3.0.1",jade:"^1.11.0","then-jade":"*",dust:"^0.3.0","dustjs-helpers":"^1.7.4","dustjs-linkedin":"^2.7.5",swig:"^1.4.2","swig-templates":"^2.0.3","razor-tmpl":"^1.3.1",atpl:">=0.7.6",liquor:"^0.0.5",twig:"^1.15.2",ejs:"^3.1.5",eco:"^1.1.0-rc-3",jazz:"^0.0.18",jqtpl:"~1.1.0",hamljs:"^0.6.2",hamlet:"^0.3.3",whiskers:"^0.4.0","haml-coffee":"^1.14.1","hogan.js":"^3.0.2",templayed:">=0.2.3",handlebars:"^4.7.6",underscore:"^1.11.0",lodash:"^4.17.20",pug:"^3.0.0","then-pug":"*",qejs:"^3.0.5",walrus:"^0.10.1",mustache:"^4.0.1",just:"^0.1.8",ect:"^0.5.9",mote:"^0.2.0",toffee:"^0.3.6",dot:"^1.1.3","bracket-template":"^1.1.5",ractive:"^1.3.12",nunjucks:"^3.2.2",htmling:"^0.0.8","babel-core":"^6.26.3",plates:"~0.4.11","react-dom":"^16.13.1",react:"^16.13.1","arc-templates":"^0.5.3",vash:"^0.13.0",slm:"^2.0.0",marko:"^3.14.4",teacup:"^2.0.0","coffee-script":"^1.12.7",squirrelly:"^5.1.0",twing:"^5.0.2"},peerDependenciesMeta:{velocityjs:kt,tinyliquid:kt,"liquid-node":kt,jade:kt,"then-jade":kt,dust:kt,"dustjs-helpers":kt,"dustjs-linkedin":kt,swig:kt,"swig-templates":kt,"razor-tmpl":kt,atpl:kt,liquor:kt,twig:kt,ejs:kt,eco:kt,jazz:kt,jqtpl:kt,hamljs:kt,hamlet:kt,whiskers:kt,"haml-coffee":kt,"hogan.js":kt,templayed:kt,handlebars:kt,underscore:kt,lodash:kt,pug:kt,"then-pug":kt,qejs:kt,walrus:kt,mustache:kt,just:kt,ect:kt,mote:kt,toffee:kt,dot:kt,"bracket-template":kt,ractive:kt,nunjucks:kt,htmling:kt,"babel-core":kt,plates:kt,"react-dom":kt,react:kt,"arc-templates":kt,vash:kt,slm:kt,marko:kt,teacup:kt,"coffee-script":kt,squirrelly:kt,twing:kt}}],["vue-loader@<=16.3.3",{peerDependencies:{"@vue/compiler-sfc":"^3.0.8",webpack:"^4.1.0 || ^5.0.0-0"},peerDependenciesMeta:{"@vue/compiler-sfc":kt}}],["vue-loader@^16.7.0",{peerDependencies:{"@vue/compiler-sfc":"^3.0.8",vue:"^3.2.13"},peerDependenciesMeta:{"@vue/compiler-sfc":kt,vue:kt}}],["scss-parser@<=1.0.5",{dependencies:{lodash:"^4.17.21"}}],["query-ast@<1.0.5",{dependencies:{lodash:"^4.17.21"}}],["redux-thunk@<=2.3.0",{peerDependencies:{redux:"^4.0.0"}}],["skypack@<=0.3.2",{dependencies:{tar:"^6.1.0"}}],["@npmcli/metavuln-calculator@<2.0.0",{dependencies:{"json-parse-even-better-errors":"^2.3.1"}}],["bin-links@<2.3.0",{dependencies:{"mkdirp-infer-owner":"^1.0.2"}}],["rollup-plugin-polyfill-node@<=0.8.0",{peerDependencies:{rollup:"^1.20.0 || ^2.0.0"}}],["snowpack@<3.8.6",{dependencies:{"magic-string":"^0.25.7"}}],["elm-webpack-loader@*",{dependencies:{temp:"^0.9.4"}}],["winston-transport@<=4.4.0",{dependencies:{logform:"^2.2.0"}}],["jest-vue-preprocessor@*",{dependencies:{"@babel/core":"7.8.7","@babel/template":"7.8.6"},peerDependencies:{pug:"^2.0.4"},peerDependenciesMeta:{pug:kt}}],["redux-persist@*",{peerDependencies:{react:">=16"},peerDependenciesMeta:{react:kt}}],["sodium@>=3",{dependencies:{"node-gyp":"^3.8.0"}}],["babel-plugin-graphql-tag@<=3.1.0",{peerDependencies:{graphql:"^14.0.0 || ^15.0.0"}}],["@playwright/test@<=1.14.1",{dependencies:{"jest-matcher-utils":"^26.4.2"}}],...["babel-plugin-remove-graphql-queries@<3.14.0-next.1","babel-preset-gatsby-package@<1.14.0-next.1","create-gatsby@<1.14.0-next.1","gatsby-admin@<0.24.0-next.1","gatsby-cli@<3.14.0-next.1","gatsby-core-utils@<2.14.0-next.1","gatsby-design-tokens@<3.14.0-next.1","gatsby-legacy-polyfills@<1.14.0-next.1","gatsby-plugin-benchmark-reporting@<1.14.0-next.1","gatsby-plugin-graphql-config@<0.23.0-next.1","gatsby-plugin-image@<1.14.0-next.1","gatsby-plugin-mdx@<2.14.0-next.1","gatsby-plugin-netlify-cms@<5.14.0-next.1","gatsby-plugin-no-sourcemaps@<3.14.0-next.1","gatsby-plugin-page-creator@<3.14.0-next.1","gatsby-plugin-preact@<5.14.0-next.1","gatsby-plugin-preload-fonts@<2.14.0-next.1","gatsby-plugin-schema-snapshot@<2.14.0-next.1","gatsby-plugin-styletron@<6.14.0-next.1","gatsby-plugin-subfont@<3.14.0-next.1","gatsby-plugin-utils@<1.14.0-next.1","gatsby-recipes@<0.25.0-next.1","gatsby-source-shopify@<5.6.0-next.1","gatsby-source-wikipedia@<3.14.0-next.1","gatsby-transformer-screenshot@<3.14.0-next.1","gatsby-worker@<0.5.0-next.1"].map(t=>[t,{dependencies:{"@babel/runtime":"^7.14.8"}}]),["gatsby-core-utils@<2.14.0-next.1",{dependencies:{got:"8.3.2"}}],["gatsby-plugin-gatsby-cloud@<=3.1.0-next.0",{dependencies:{"gatsby-core-utils":"^2.13.0-next.0"}}],["gatsby-plugin-gatsby-cloud@<=3.2.0-next.1",{peerDependencies:{webpack:"*"}}],["babel-plugin-remove-graphql-queries@<=3.14.0-next.1",{dependencies:{"gatsby-core-utils":"^2.8.0-next.1"}}],["gatsby-plugin-netlify@3.13.0-next.1",{dependencies:{"gatsby-core-utils":"^2.13.0-next.0"}}],["clipanion-v3-codemod@<=0.2.0",{peerDependencies:{jscodeshift:"^0.11.0"}}],["react-live@*",{peerDependencies:{"react-dom":"*",react:"*"}}],["webpack@<4.44.1",{peerDependenciesMeta:{"webpack-cli":kt,"webpack-command":kt}}],["webpack@<5.0.0-beta.23",{peerDependenciesMeta:{"webpack-cli":kt}}],["webpack-dev-server@<3.10.2",{peerDependenciesMeta:{"webpack-cli":kt}}],["@docusaurus/responsive-loader@<1.5.0",{peerDependenciesMeta:{sharp:kt,jimp:kt}}],["eslint-module-utils@*",{peerDependenciesMeta:{"eslint-import-resolver-node":kt,"eslint-import-resolver-typescript":kt,"eslint-import-resolver-webpack":kt,"@typescript-eslint/parser":kt}}],["eslint-plugin-import@*",{peerDependenciesMeta:{"@typescript-eslint/parser":kt}}],["critters-webpack-plugin@<3.0.2",{peerDependenciesMeta:{"html-webpack-plugin":kt}}],["terser@<=5.10.0",{dependencies:{acorn:"^8.5.0"}}],["babel-preset-react-app@10.0.x",{dependencies:{"@babel/plugin-proposal-private-property-in-object":"^7.16.0"}}],["eslint-config-react-app@*",{peerDependenciesMeta:{typescript:kt}}],["@vue/eslint-config-typescript@<11.0.0",{peerDependenciesMeta:{typescript:kt}}],["unplugin-vue2-script-setup@<0.9.1",{peerDependencies:{"@vue/composition-api":"^1.4.3","@vue/runtime-dom":"^3.2.26"}}],["@cypress/snapshot@*",{dependencies:{debug:"^3.2.7"}}],["auto-relay@<=0.14.0",{peerDependencies:{"reflect-metadata":"^0.1.13"}}],["vue-template-babel-compiler@<1.2.0",{peerDependencies:{["vue-template-compiler"]:"^2.6.0"}}],["@parcel/transformer-image@<2.5.0",{peerDependencies:{["@parcel/core"]:"*"}}],["@parcel/transformer-js@<2.5.0",{peerDependencies:{["@parcel/core"]:"*"}}],["parcel@*",{peerDependenciesMeta:{["@parcel/core"]:kt}}],["react-scripts@*",{peerDependencies:{eslint:"*"}}],["focus-trap-react@^8.0.0",{dependencies:{tabbable:"^5.3.2"}}],["react-rnd@<10.3.7",{peerDependencies:{react:">=16.3.0","react-dom":">=16.3.0"}}],["connect-mongo@*",{peerDependencies:{"express-session":"^1.17.1"}}],["vue-i18n@<9",{peerDependencies:{vue:"^2"}}],["vue-router@<4",{peerDependencies:{vue:"^2"}}],["unified@<10",{dependencies:{"@types/unist":"^2.0.0"}}],["react-github-btn@<=1.3.0",{peerDependencies:{react:">=16.3.0"}}],["react-dev-utils@*",{peerDependencies:{typescript:">=2.7",webpack:">=4"},peerDependenciesMeta:{typescript:kt}}],["@asyncapi/react-component@<=1.0.0-next.39",{peerDependencies:{react:">=16.8.0","react-dom":">=16.8.0"}}],["xo@*",{peerDependencies:{webpack:">=1.11.0"},peerDependenciesMeta:{webpack:kt}}],["babel-plugin-remove-graphql-queries@<=4.20.0-next.0",{dependencies:{"@babel/types":"^7.15.4"}}],["gatsby-plugin-page-creator@<=4.20.0-next.1",{dependencies:{"fs-extra":"^10.1.0"}}],["gatsby-plugin-utils@<=3.14.0-next.1",{dependencies:{fastq:"^1.13.0"},peerDependencies:{graphql:"^15.0.0"}}],["gatsby-plugin-mdx@<3.1.0-next.1",{dependencies:{mkdirp:"^1.0.4"}}],["gatsby-plugin-mdx@^2",{peerDependencies:{gatsby:"^3.0.0-next"}}],["fdir@<=5.2.0",{peerDependencies:{picomatch:"2.x"},peerDependenciesMeta:{picomatch:kt}}],["babel-plugin-transform-typescript-metadata@<=0.3.2",{peerDependencies:{"@babel/core":"^7","@babel/traverse":"^7"},peerDependenciesMeta:{"@babel/traverse":kt}}],["graphql-compose@>=9.0.10",{peerDependencies:{graphql:"^14.2.0 || ^15.0.0 || ^16.0.0"}}]];var nH;function Rde(){return typeof nH>"u"&&(nH=Be("zlib").brotliDecompressSync(Buffer.from("G7weAByFTVk3Vs7UfHhq4yykgEM7pbW7TI43SG2S5tvGrwHBAzdz+s/npQ6tgEvobvxisrPIadkXeUAJotBn5bDZ5kAhcRqsIHe3F75Walet5hNalwgFDtxb0BiDUjiUQkjG0yW2hto9HPgiCkm316d6bC0kST72YN7D7rfkhCE9x4J0XwB0yavalxpUu2t9xszHrmtwalOxT7VslsxWcB1qpqZwERUra4psWhTV8BgwWeizurec82Caf1ABL11YMfbf8FJ9JBceZOkgmvrQPbC9DUldX/yMbmX06UQluCEjSwUoyO+EZPIjofr+/oAZUck2enraRD+oWLlnlYnj8xB+gwSo9lmmks4fXv574qSqcWA6z21uYkzMu3EWj+K23RxeQlLqiE35/rC8GcS4CGkKHKKq+zAIQwD9iRDNfiAqueLLpicFFrNsAI4zeTD/eO9MHcnRa5m8UT+M2+V+AkFST4BlKneiAQRSdST8KEAIyFlULt6wa9EBd0Ds28VmpaxquJdVt+nwdEs5xUskI13OVtFyY0UrQIRAlCuvvWivvlSKQfTO+2Q8OyUR1W5RvetaPz4jD27hdtwHFFA1Ptx6Ee/t2cY2rg2G46M1pNDRf2pWhvpy8pqMnuI3++4OF3+7OFIWXGjh+o7Nr2jNvbiYcQdQS1h903/jVFgOpA0yJ78z+x759bFA0rq+6aY5qPB4FzS3oYoLupDUhD9nDz6F6H7hpnlMf18KNKDu4IKjTWwrAnY6MFQw1W6ymOALHlFyCZmQhldg1MQHaMVVQTVgDC60TfaBqG++Y8PEoFhN/PBTZT175KNP/BlHDYGOOBmnBdzqJKplZ/ljiVG0ZBzfqeBRrrUkn6rA54462SgiliKoYVnbeptMdXNfAuaupIEi0bApF10TlgHfmEJAPUVidRVFyDupSem5po5vErPqWKhKbUIp0LozpYsIKK57dM/HKr+nguF+7924IIWMICkQ8JUigs9D+W+c4LnNoRtPPKNRUiCYmP+Jfo2lfKCKw8qpraEeWU3uiNRO6zcyKQoXPR5htmzzLznke7b4YbXW3I1lIRzmgG02Udb58U+7TpwyN7XymCgH+wuPDthZVQvRZuEP+SnLtMicz9m5zASWOBiAcLmkuFlTKuHspSIhCBD0yUPKcxu81A+4YD78rA2vtwsUEday9WNyrShyrl60rWmA+SmbYZkQOwFJWArxRYYc5jGhA5ikxYw1rx3ei4NmeX/lKiwpZ9Ln1tV2Ae7sArvxuVLbJjqJRjW1vFXAyHpvLG+8MJ6T2Ubx5M2KDa2SN6vuIGxJ9WQM9Mk3Q7aCNiZONXllhqq24DmoLbQfW2rYWsOgHWjtOmIQMyMKdiHZDjoyIq5+U700nZ6odJAoYXPQBvFNiQ78d5jaXliBqLTJEqUCwi+LiH2mx92EmNKDsJL74Z613+3lf20pxkV1+erOrjj8pW00vsPaahKUM+05ssd5uwM7K482KWEf3TCwlg/o3e5ngto7qSMz7YteIgCsF1UOcsLk7F7MxWbvrPMY473ew0G+noVL8EPbkmEMftMSeL6HFub/zy+2JQ==","base64")).toString()),nH}var iH;function Nde(){return typeof iH>"u"&&(iH=Be("zlib").brotliDecompressSync(Buffer.from("G8MSIIzURnVBnObTcvb3XE6v2S9Qgc2K801Oa5otNKEtK8BINZNcaQHy+9/vf/WXBimwutXC33P2DPc64pps5rz7NGGWaOKNSPL4Y2KRE8twut2lFOIN+OXPtRmPMRhMTILib2bEQx43az2I5d3YS8Roa5UZpF/ujHb3Djd3GDvYUfvFYSUQ39vb2cmifp/rgB4J/65JK3wRBTvMBoNBmn3mbXC63/gbBkW/2IRPri0O8bcsRBsmarF328pAln04nyJFkwUAvNu934supAqLtyerZZpJ8I8suJHhf/ocMV+scKwa8NOiDKIPXw6Ex/EEZD6TEGaW8N5zvNHYF10l6Lfooj7D5W2k3dgvQSbp2Wv8TGOayS978gxlOLVjTGXs66ozewbrjwElLtyrYNnWTfzzdEutgROUFPVMhnMoy8EjJLLlWwIEoySxliim9kYW30JUHiPVyjt0iAw/ZpPmCbUCltYPnq6ZNblIKhTNhqS/oqC9iya5sGKZTOVsTEg34n92uZTf2iPpcZih8r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0gWsacNlQLJMIrBhqRxXxHF/5pseWwejlAAvZ3klZSDSYY8mkToaWejXhgNomeGtx1DTLEUFMRkgF5yFB22WYdJnaWN14r1YJj81hGi45+jrADS5nYRhCiSlCJJ1nL8pYX+HDSMhdTEWyRcgHVp/IsUIZYMfT+YYncUQPgcxNGCHfZ88vDdrcUuaGIl6zhAsiaq7R5dfqrqXH/JcBhfjT8D0azayIyEz75Nxp6YkcyDxlJq3EXnJUpqDohJJOysL1t1uNiHESlvsxPb5cpbW0+ICZqJmUZus1BMW0F5IVBODLIo2zHHjA0=","base64")).toString()),iH}var sH;function Lde(){return typeof sH>"u"&&(sH=Be("zlib").brotliDecompressSync(Buffer.from("m6PPN5NNGa6n57aNhksKPWgJ25WHbiLSmKh2KhvnP6kTyLl/kJKdo2UHRD79AwZUj8eNMfAhq4sLwQNNE0v9oGXzxif4zMFNd2xIkMSCykO7rfR0BlZhxBw6FzN7fNT9e5bXFEmqfkokrd8mVVtV8AsnMCvda38yC5HhW4VCk+8Dv+qHbwGmXF8HICI2ozSTsLYckoucF1f5RXzXH71TdkFPtH09g8TIr3pKSEaugLT4n9myO5fTay5IjCzPODs9m3tbqUBmYyixSDZKG6H6/9OEVEVFs+1ZJn1ocd6cOGKqadNQ+lT6dsj/Vqqn8347CRPcKuO3JaU19iNWMiqggsIBc03NejfVHk4IhSVcip3t/8pzXUIg0KWAHBJUqlrV2p9j/UXN7vNKWEDnwAF4TiSanCd04PG3xMvsR7zKTdCfoLR99Uh7aKUpovadhLCqJWmWVTTERyy7MvZZS3LktLb+d3gopE3R1YYyN1IW4ZjeLg1Rr3z62GSV0jQNzAc4uff5/+9PP9v/PVQFCKtflA5SHW6z+om17zn3eCQ9ObFle40MA0jn3HvekyzJ/4/9PUDYBYCaKk3LfbirNURVUiHX+XtbZqkWZi1Xrdag0VL/NajNkYLQJO8BQRDRVs28/qCSZrQuCww67QFSfxaZkOP4kuCyvFFLI+PIOH3YPXuE0ZWDIDn/P39Z5Wo005nDIDmq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3epx/Q8IOv2bop/jklyY3BuBzexp9f7FOtrF0Xn4P+Nu6BrN/FTCTPJTPokrSqonhJ/bz2PfE17avC78vBpJmKeLYfviJfqHUzOLsZriG/3BIrean6dm2P3vVp3cxHf8M3rbkNpwbHlpz8IPefnRRBl69Qvfy4vT2ihd/m6HjFunvlwWttut83QC4nh0AAIRRV6OMezEHxBdwmrDwrBMMS1dvHbGLaadIrJ1mAEBEulJH2xgEycdmQEGdfxNQgRc9WqKFnGeKppABVyHMhbQQqPADigHso6r32dH3+eyIPvd8WAGmWJUuhzvUVgTfhdlVyaR0HycJF+lPSdrdhFDQIy5Rjx4MMUDAEGFXqTgfUJg79YafwrrzHNQSevKPn6Wk7epvTWSGwYnXAqs4ygVzXgjlBDpADgMalxYPwLBUz7qBbe6rLA6wNWFGF0GDq093w0UOLAAAXWOa+/23G9widGy4oa7MPtkUII61x6hYkLc9hpI6QMHWfhVvWVbVxHWX3e3CLNFSFBCzjMU+Gcyx24+RNm89ap/NvBHwHvMHZVfEmqrRwP0MOAzxM3GXenykpuX5Rqyi0V2lDgYAHGR0rRXrZ4i2tQQ=","base64")).toString()),sH}var Mde=new Map([[W.makeIdent(null,"fsevents").identHash,Rde],[W.makeIdent(null,"resolve").identHash,Nde],[W.makeIdent(null,"typescript").identHash,Lde]]),Fgt={hooks:{registerPackageExtensions:async(t,e)=>{for(let[r,o]of rH)e(W.parseDescriptor(r,!0),o)},getBuiltinPatch:async(t,e)=>{let r="compat/";if(!e.startsWith(r))return;let o=W.parseIdent(e.slice(r.length)),a=Mde.get(o.identHash)?.();return typeof a<"u"?a:null},reduceDependency:async(t,e,r,o)=>typeof Mde.get(t.identHash)>"u"?t:W.makeDescriptor(t,W.makeRange({protocol:"patch:",source:W.stringifyDescriptor(t),selector:`optional!builtin`,params:null}))}},Tgt=Fgt;var BH={};Kt(BH,{ConstraintsCheckCommand:()=>p0,ConstraintsQueryCommand:()=>A0,ConstraintsSourceCommand:()=>f0,default:()=>odt});Ye();Ye();B2();var wC=class{constructor(e){this.project=e}createEnvironment(){let e=new CC(["cwd","ident"]),r=new CC(["workspace","type","ident"]),o=new CC(["ident"]),a={manifestUpdates:new Map,reportedErrors:new Map},n=new Map,u=new Map;for(let A of this.project.storedPackages.values()){let p=Array.from(A.peerDependencies.values(),h=>[W.stringifyIdent(h),h.range]);n.set(A.locatorHash,{workspace:null,ident:W.stringifyIdent(A),version:A.version,dependencies:new Map,peerDependencies:new Map(p.filter(([h])=>A.peerDependenciesMeta.get(h)?.optional!==!0)),optionalPeerDependencies:new Map(p.filter(([h])=>A.peerDependenciesMeta.get(h)?.optional===!0))})}for(let A of this.project.storedPackages.values()){let p=n.get(A.locatorHash);p.dependencies=new Map(Array.from(A.dependencies.values(),h=>{let E=this.project.storedResolutions.get(h.descriptorHash);if(typeof E>"u")throw new Error("Assertion failed: The resolution should have been registered");let I=n.get(E);if(typeof I>"u")throw new Error("Assertion failed: The package should have been registered");return[W.stringifyIdent(h),I]})),p.dependencies.delete(p.ident)}for(let A of this.project.workspaces){let p=W.stringifyIdent(A.anchoredLocator),h=A.manifest.exportTo({}),E=n.get(A.anchoredLocator.locatorHash);if(typeof E>"u")throw new Error("Assertion failed: The package should have been registered");let I=(T,L,{caller:U=Ji.getCaller()}={})=>{let J=I2(T),te=je.getMapWithDefault(a.manifestUpdates,A.cwd),le=je.getMapWithDefault(te,J),pe=je.getSetWithDefault(le,L);U!==null&&pe.add(U)},v=T=>I(T,void 0,{caller:Ji.getCaller()}),b=T=>{je.getArrayWithDefault(a.reportedErrors,A.cwd).push(T)},C=e.insert({cwd:A.relativeCwd,ident:p,manifest:h,pkg:E,set:I,unset:v,error:b});u.set(A,C);for(let T of Mt.allDependencies)for(let L of A.manifest[T].values()){let U=W.stringifyIdent(L),J=()=>{I([T,U],void 0,{caller:Ji.getCaller()})},te=pe=>{I([T,U],pe,{caller:Ji.getCaller()})},le=null;if(T!=="peerDependencies"&&(T!=="dependencies"||!A.manifest.devDependencies.has(L.identHash))){let pe=A.anchoredPackage.dependencies.get(L.identHash);if(pe){if(typeof pe>"u")throw new Error("Assertion failed: The dependency should have been registered");let Ae=this.project.storedResolutions.get(pe.descriptorHash);if(typeof Ae>"u")throw new Error("Assertion failed: The resolution should have been registered");let ye=n.get(Ae);if(typeof ye>"u")throw new Error("Assertion failed: The package should have been registered");le=ye}}r.insert({workspace:C,ident:U,range:L.range,type:T,resolution:le,update:te,delete:J,error:b})}}for(let A of this.project.storedPackages.values()){let p=this.project.tryWorkspaceByLocator(A);if(!p)continue;let h=u.get(p);if(typeof h>"u")throw new Error("Assertion failed: The workspace should have been registered");let E=n.get(A.locatorHash);if(typeof E>"u")throw new Error("Assertion failed: The package should have been registered");E.workspace=h}return{workspaces:e,dependencies:r,packages:o,result:a}}async process(){let e=this.createEnvironment(),r={Yarn:{workspace:a=>e.workspaces.find(a)[0]??null,workspaces:a=>e.workspaces.find(a),dependency:a=>e.dependencies.find(a)[0]??null,dependencies:a=>e.dependencies.find(a),package:a=>e.packages.find(a)[0]??null,packages:a=>e.packages.find(a)}},o=await this.project.loadUserConfig();return o?.constraints?(await o.constraints(r),e.result):null}};Ye();Ye();qt();var A0=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.query=ge.String()}async execute(){let{Constraints:r}=await Promise.resolve().then(()=>(x2(),S2)),o=await Ve.find(this.context.cwd,this.context.plugins),{project:a}=await St.find(o,this.context.cwd),n=await r.find(a),u=this.query;return u.endsWith(".")||(u=`${u}.`),(await Nt.start({configuration:o,json:this.json,stdout:this.context.stdout},async p=>{for await(let h of n.query(u)){let E=Array.from(Object.entries(h)),I=E.length,v=E.reduce((b,[C])=>Math.max(b,C.length),0);for(let b=0;b(x2(),S2)),o=await Ve.find(this.context.cwd,this.context.plugins),{project:a}=await St.find(o,this.context.cwd),n=await r.find(a);this.context.stdout.write(this.verbose?n.fullSource:n.source)}};f0.paths=[["constraints","source"]],f0.usage=nt.Usage({category:"Constraints-related commands",description:"print the source code for the constraints",details:"\n This command will print the Prolog source code used by the constraints engine. Adding the `-v,--verbose` flag will print the *full* source code, including the fact database automatically compiled from the workspace manifests.\n ",examples:[["Prints the source code","yarn constraints source"],["Print the source code and the fact database","yarn constraints source -v"]]});Ye();Ye();qt();B2();var p0=class extends ut{constructor(){super(...arguments);this.fix=ge.Boolean("--fix",!1,{description:"Attempt to automatically fix unambiguous issues, following a multi-pass process"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o}=await St.find(r,this.context.cwd);await o.restoreInstallState();let a=await o.loadUserConfig(),n;if(a?.constraints)n=new wC(o);else{let{Constraints:h}=await Promise.resolve().then(()=>(x2(),S2));n=await h.find(o)}let u,A=!1,p=!1;for(let h=this.fix?10:1;h>0;--h){let E=await n.process();if(!E)break;let{changedWorkspaces:I,remainingErrors:v}=mk(o,E,{fix:this.fix}),b=[];for(let[C,T]of I){let L=C.manifest.indent;C.manifest=new Mt,C.manifest.indent=L,C.manifest.load(T),b.push(C.persistManifest())}if(await Promise.all(b),!(I.size>0&&h>1)){u=Gde(v,{configuration:r}),A=!1,p=!0;for(let[,C]of v)for(let T of C)T.fixable?A=!0:p=!1}}if(u.children.length===0)return 0;if(A){let h=p?`Those errors can all be fixed by running ${de.pretty(r,"yarn constraints --fix",de.Type.CODE)}`:`Errors prefixed by '\u2699' can be fixed by running ${de.pretty(r,"yarn constraints --fix",de.Type.CODE)}`;await Nt.start({configuration:r,stdout:this.context.stdout,includeNames:!1,includeFooter:!1},async E=>{E.reportInfo(0,h),E.reportSeparator()})}return u.children=je.sortMap(u.children,h=>h.value[1]),$s.emitTree(u,{configuration:r,stdout:this.context.stdout,json:this.json,separators:1}),1}};p0.paths=[["constraints"]],p0.usage=nt.Usage({category:"Constraints-related commands",description:"check that the project constraints are met",details:` + This command will run constraints on your project and emit errors for each one that is found but isn't met. If any error is emitted the process will exit with a non-zero exit code. + + If the \`--fix\` flag is used, Yarn will attempt to automatically fix the issues the best it can, following a multi-pass process (with a maximum of 10 iterations). Some ambiguous patterns cannot be autofixed, in which case you'll have to manually specify the right resolution. + + For more information as to how to write constraints, please consult our dedicated page on our website: https://yarnpkg.com/features/constraints. + `,examples:[["Check that all constraints are satisfied","yarn constraints"],["Autofix all unmet constraints","yarn constraints --fix"]]});B2();var sdt={configuration:{enableConstraintsChecks:{description:"If true, constraints will run during installs",type:"BOOLEAN",default:!1},constraintsPath:{description:"The path of the constraints file.",type:"ABSOLUTE_PATH",default:"./constraints.pro"}},commands:[A0,f0,p0],hooks:{async validateProjectAfterInstall(t,{reportError:e}){if(!t.configuration.get("enableConstraintsChecks"))return;let r=await t.loadUserConfig(),o;if(r?.constraints)o=new wC(t);else{let{Constraints:u}=await Promise.resolve().then(()=>(x2(),S2));o=await u.find(t)}let a=await o.process();if(!a)return;let{remainingErrors:n}=mk(t,a);if(n.size!==0)if(t.configuration.isCI)for(let[u,A]of n)for(let p of A)e(84,`${de.pretty(t.configuration,u.anchoredLocator,de.Type.IDENT)}: ${p.text}`);else e(84,`Constraint check failed; run ${de.pretty(t.configuration,"yarn constraints",de.Type.CODE)} for more details`)}}},odt=sdt;var vH={};Kt(vH,{CreateCommand:()=>em,DlxCommand:()=>h0,default:()=>ldt});Ye();qt();var em=class extends ut{constructor(){super(...arguments);this.pkg=ge.String("-p,--package",{description:"The package to run the provided command from"});this.quiet=ge.Boolean("-q,--quiet",!1,{description:"Only report critical errors instead of printing the full install logs"});this.command=ge.String();this.args=ge.Proxy()}async execute(){let r=[];this.pkg&&r.push("--package",this.pkg),this.quiet&&r.push("--quiet");let o=this.command.replace(/^(@[^@/]+)(@|$)/,"$1/create$2"),a=W.parseDescriptor(o),n=a.name.match(/^create(-|$)/)?a:a.scope?W.makeIdent(a.scope,`create-${a.name}`):W.makeIdent(null,`create-${a.name}`),u=W.stringifyIdent(n);return a.range!=="unknown"&&(u+=`@${a.range}`),this.cli.run(["dlx",...r,u,...this.args])}};em.paths=[["create"]];Ye();Ye();Pt();qt();var h0=class extends ut{constructor(){super(...arguments);this.packages=ge.Array("-p,--package",{description:"The package(s) to install before running the command"});this.quiet=ge.Boolean("-q,--quiet",!1,{description:"Only report critical errors instead of printing the full install logs"});this.command=ge.String();this.args=ge.Proxy()}async execute(){return Ve.telemetry=null,await oe.mktempPromise(async r=>{let o=K.join(r,`dlx-${process.pid}`);await oe.mkdirPromise(o),await oe.writeFilePromise(K.join(o,"package.json"),`{} +`),await oe.writeFilePromise(K.join(o,"yarn.lock"),"");let a=K.join(o,".yarnrc.yml"),n=await Ve.findProjectCwd(this.context.cwd),A={enableGlobalCache:!(await Ve.find(this.context.cwd,null,{strict:!1})).get("enableGlobalCache"),enableTelemetry:!1,logFilters:[{code:Wu(68),level:de.LogLevel.Discard}]},p=n!==null?K.join(n,".yarnrc.yml"):null;p!==null&&oe.existsSync(p)?(await oe.copyFilePromise(p,a),await Ve.updateConfiguration(o,L=>{let U=je.toMerged(L,A);return Array.isArray(L.plugins)&&(U.plugins=L.plugins.map(J=>{let te=typeof J=="string"?J:J.path,le=ue.isAbsolute(te)?te:ue.resolve(ue.fromPortablePath(n),te);return typeof J=="string"?le:{path:le,spec:J.spec}})),U})):await oe.writeJsonPromise(a,A);let h=this.packages??[this.command],E=W.parseDescriptor(this.command).name,I=await this.cli.run(["add","--fixed","--",...h],{cwd:o,quiet:this.quiet});if(I!==0)return I;this.quiet||this.context.stdout.write(` +`);let v=await Ve.find(o,this.context.plugins),{project:b,workspace:C}=await St.find(v,o);if(C===null)throw new rr(b.cwd,o);await b.restoreInstallState();let T=await un.getWorkspaceAccessibleBinaries(C);return T.has(E)===!1&&T.size===1&&typeof this.packages>"u"&&(E=Array.from(T)[0][0]),await un.executeWorkspaceAccessibleBinary(C,E,this.args,{packageAccessibleBinaries:T,cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})})}};h0.paths=[["dlx"]],h0.usage=nt.Usage({description:"run a package in a temporary environment",details:"\n This command will install a package within a temporary environment, and run its binary script if it contains any. The binary will run within the current cwd.\n\n By default Yarn will download the package named `command`, but this can be changed through the use of the `-p,--package` flag which will instruct Yarn to still run the same command but from a different package.\n\n Using `yarn dlx` as a replacement of `yarn add` isn't recommended, as it makes your project non-deterministic (Yarn doesn't keep track of the packages installed through `dlx` - neither their name, nor their version).\n ",examples:[["Use create-react-app to create a new React app","yarn dlx create-react-app ./my-app"],["Install multiple packages for a single command",`yarn dlx -p typescript -p ts-node ts-node --transpile-only -e "console.log('hello!')"`]]});var adt={commands:[em,h0]},ldt=adt;var SH={};Kt(SH,{ExecFetcher:()=>k2,ExecResolver:()=>Q2,default:()=>Adt,execUtils:()=>wk});Ye();Ye();Pt();var fA="exec:";var wk={};Kt(wk,{loadGeneratorFile:()=>b2,makeLocator:()=>PH,makeSpec:()=>dme,parseSpec:()=>DH});Ye();Pt();function DH(t){let{params:e,selector:r}=W.parseRange(t),o=ue.toPortablePath(r);return{parentLocator:e&&typeof e.locator=="string"?W.parseLocator(e.locator):null,path:o}}function dme({parentLocator:t,path:e,generatorHash:r,protocol:o}){let a=t!==null?{locator:W.stringifyLocator(t)}:{},n=typeof r<"u"?{hash:r}:{};return W.makeRange({protocol:o,source:e,selector:e,params:{...n,...a}})}function PH(t,{parentLocator:e,path:r,generatorHash:o,protocol:a}){return W.makeLocator(t,dme({parentLocator:e,path:r,generatorHash:o,protocol:a}))}async function b2(t,e,r){let{parentLocator:o,path:a}=W.parseFileStyleRange(t,{protocol:e}),n=K.isAbsolute(a)?{packageFs:new gn(Bt.root),prefixPath:Bt.dot,localPath:Bt.root}:await r.fetcher.fetch(o,r),u=n.localPath?{packageFs:new gn(Bt.root),prefixPath:K.relative(Bt.root,n.localPath)}:n;n!==u&&n.releaseFs&&n.releaseFs();let A=u.packageFs,p=K.join(u.prefixPath,a);return await A.readFilePromise(p,"utf8")}var k2=class{supports(e,r){return!!e.reference.startsWith(fA)}getLocalPath(e,r){let{parentLocator:o,path:a}=W.parseFileStyleRange(e.reference,{protocol:fA});if(K.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(o,r);return n===null?null:K.resolve(n,a)}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:W.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:u}}async fetchFromDisk(e,r){let o=await b2(e.reference,fA,r);return oe.mktempPromise(async a=>{let n=K.join(a,"generator.js");return await oe.writeFilePromise(n,o),oe.mktempPromise(async u=>{if(await this.generatePackage(u,e,n,r),!oe.existsSync(K.join(u,"build")))throw new Error("The script should have generated a build directory");return await Xi.makeArchiveFromDirectory(K.join(u,"build"),{prefixPath:W.getIdentVendorPath(e),compressionLevel:r.project.configuration.get("compressionLevel")})})})}async generatePackage(e,r,o,a){return await oe.mktempPromise(async n=>{let u=await un.makeScriptEnv({project:a.project,binFolder:n}),A=K.join(e,"runtime.js");return await oe.mktempPromise(async p=>{let h=K.join(p,"buildfile.log"),E=K.join(e,"generator"),I=K.join(e,"build");await oe.mkdirPromise(E),await oe.mkdirPromise(I);let v={tempDir:ue.fromPortablePath(E),buildDir:ue.fromPortablePath(I),locator:W.stringifyLocator(r)};await oe.writeFilePromise(A,` + // Expose 'Module' as a global variable + Object.defineProperty(global, 'Module', { + get: () => require('module'), + configurable: true, + enumerable: false, + }); + + // Expose non-hidden built-in modules as global variables + for (const name of Module.builtinModules.filter((name) => name !== 'module' && !name.startsWith('_'))) { + Object.defineProperty(global, name, { + get: () => require(name), + configurable: true, + enumerable: false, + }); + } + + // Expose the 'execEnv' global variable + Object.defineProperty(global, 'execEnv', { + value: { + ...${JSON.stringify(v)}, + }, + enumerable: true, + }); + `);let b=u.NODE_OPTIONS||"",C=/\s*--require\s+\S*\.pnp\.c?js\s*/g;b=b.replace(C," ").trim(),u.NODE_OPTIONS=b;let{stdout:T,stderr:L}=a.project.configuration.getSubprocessStreams(h,{header:`# This file contains the result of Yarn generating a package (${W.stringifyLocator(r)}) +`,prefix:W.prettyLocator(a.project.configuration,r),report:a.report}),{code:U}=await Ur.pipevp(process.execPath,["--require",ue.fromPortablePath(A),ue.fromPortablePath(o),W.stringifyIdent(r)],{cwd:e,env:u,stdin:null,stdout:T,stderr:L});if(U!==0)throw oe.detachTemp(p),new Error(`Package generation failed (exit code ${U}, logs can be found here: ${de.pretty(a.project.configuration,h,de.Type.PATH)})`)})})}};Ye();Ye();var cdt=2,Q2=class{supportsDescriptor(e,r){return!!e.range.startsWith(fA)}supportsLocator(e,r){return!!e.reference.startsWith(fA)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return W.bindDescriptor(e,{locator:W.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){if(!o.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:a,parentLocator:n}=DH(e.range);if(n===null)throw new Error("Assertion failed: The descriptor should have been bound");let u=await b2(W.makeRange({protocol:fA,source:a,selector:a,params:{locator:W.stringifyLocator(n)}}),fA,o.fetchOptions),A=wn.makeHash(`${cdt}`,u).slice(0,6);return[PH(e,{parentLocator:n,path:a,generatorHash:A,protocol:fA})]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Mt.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var udt={fetchers:[k2],resolvers:[Q2]},Adt=udt;var bH={};Kt(bH,{FileFetcher:()=>N2,FileResolver:()=>L2,TarballFileFetcher:()=>M2,TarballFileResolver:()=>O2,default:()=>hdt,fileUtils:()=>tm});Ye();Pt();var DC=/^(?:[a-zA-Z]:[\\/]|\.{0,2}\/)/,F2=/^[^?]*\.(?:tar\.gz|tgz)(?:::.*)?$/,Ui="file:";var tm={};Kt(tm,{fetchArchiveFromLocator:()=>R2,makeArchiveFromLocator:()=>Ik,makeBufferFromLocator:()=>xH,makeLocator:()=>PC,makeSpec:()=>mme,parseSpec:()=>T2});Ye();Pt();function T2(t){let{params:e,selector:r}=W.parseRange(t),o=ue.toPortablePath(r);return{parentLocator:e&&typeof e.locator=="string"?W.parseLocator(e.locator):null,path:o}}function mme({parentLocator:t,path:e,hash:r,protocol:o}){let a=t!==null?{locator:W.stringifyLocator(t)}:{},n=typeof r<"u"?{hash:r}:{};return W.makeRange({protocol:o,source:e,selector:e,params:{...n,...a}})}function PC(t,{parentLocator:e,path:r,hash:o,protocol:a}){return W.makeLocator(t,mme({parentLocator:e,path:r,hash:o,protocol:a}))}async function R2(t,e){let{parentLocator:r,path:o}=W.parseFileStyleRange(t.reference,{protocol:Ui}),a=K.isAbsolute(o)?{packageFs:new gn(Bt.root),prefixPath:Bt.dot,localPath:Bt.root}:await e.fetcher.fetch(r,e),n=a.localPath?{packageFs:new gn(Bt.root),prefixPath:K.relative(Bt.root,a.localPath)}:a;a!==n&&a.releaseFs&&a.releaseFs();let u=n.packageFs,A=K.join(n.prefixPath,o);return await je.releaseAfterUseAsync(async()=>await u.readFilePromise(A),n.releaseFs)}async function Ik(t,{protocol:e,fetchOptions:r,inMemory:o=!1}){let{parentLocator:a,path:n}=W.parseFileStyleRange(t.reference,{protocol:e}),u=K.isAbsolute(n)?{packageFs:new gn(Bt.root),prefixPath:Bt.dot,localPath:Bt.root}:await r.fetcher.fetch(a,r),A=u.localPath?{packageFs:new gn(Bt.root),prefixPath:K.relative(Bt.root,u.localPath)}:u;u!==A&&u.releaseFs&&u.releaseFs();let p=A.packageFs,h=K.join(A.prefixPath,n);return await je.releaseAfterUseAsync(async()=>await Xi.makeArchiveFromDirectory(h,{baseFs:p,prefixPath:W.getIdentVendorPath(t),compressionLevel:r.project.configuration.get("compressionLevel"),inMemory:o}),A.releaseFs)}async function xH(t,{protocol:e,fetchOptions:r}){return(await Ik(t,{protocol:e,fetchOptions:r,inMemory:!0})).getBufferAndClose()}var N2=class{supports(e,r){return!!e.reference.startsWith(Ui)}getLocalPath(e,r){let{parentLocator:o,path:a}=W.parseFileStyleRange(e.reference,{protocol:Ui});if(K.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(o,r);return n===null?null:K.resolve(n,a)}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${W.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:W.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:u}}async fetchFromDisk(e,r){return Ik(e,{protocol:Ui,fetchOptions:r})}};Ye();Ye();var fdt=2,L2=class{supportsDescriptor(e,r){return e.range.match(DC)?!0:!!e.range.startsWith(Ui)}supportsLocator(e,r){return!!e.reference.startsWith(Ui)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return DC.test(e.range)&&(e=W.makeDescriptor(e,`${Ui}${e.range}`)),W.bindDescriptor(e,{locator:W.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){if(!o.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:a,parentLocator:n}=T2(e.range);if(n===null)throw new Error("Assertion failed: The descriptor should have been bound");let u=await xH(W.makeLocator(e,W.makeRange({protocol:Ui,source:a,selector:a,params:{locator:W.stringifyLocator(n)}})),{protocol:Ui,fetchOptions:o.fetchOptions}),A=wn.makeHash(`${fdt}`,u).slice(0,6);return[PC(e,{parentLocator:n,path:a,hash:A,protocol:Ui})]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Mt.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};Ye();var M2=class{supports(e,r){return F2.test(e.reference)?!!e.reference.startsWith(Ui):!1}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${W.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.fetchFromDisk(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:W.getIdentVendorPath(e),checksum:u}}async fetchFromDisk(e,r){let o=await R2(e,r);return await Xi.convertToZip(o,{configuration:r.project.configuration,prefixPath:W.getIdentVendorPath(e),stripComponents:1})}};Ye();Ye();Ye();var O2=class{supportsDescriptor(e,r){return F2.test(e.range)?!!(e.range.startsWith(Ui)||DC.test(e.range)):!1}supportsLocator(e,r){return F2.test(e.reference)?!!e.reference.startsWith(Ui):!1}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return DC.test(e.range)&&(e=W.makeDescriptor(e,`${Ui}${e.range}`)),W.bindDescriptor(e,{locator:W.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){if(!o.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:a,parentLocator:n}=T2(e.range);if(n===null)throw new Error("Assertion failed: The descriptor should have been bound");let u=PC(e,{parentLocator:n,path:a,hash:"",protocol:Ui}),A=await R2(u,o.fetchOptions),p=wn.makeHash(A).slice(0,6);return[PC(e,{parentLocator:n,path:a,hash:p,protocol:Ui})]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Mt.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var pdt={fetchers:[M2,N2],resolvers:[O2,L2]},hdt=pdt;var FH={};Kt(FH,{GithubFetcher:()=>U2,default:()=>ddt,githubUtils:()=>Bk});Ye();Pt();var Bk={};Kt(Bk,{invalidGithubUrlMessage:()=>Cme,isGithubUrl:()=>kH,parseGithubUrl:()=>QH});var yme=$e(Be("querystring")),Eme=[/^https?:\/\/(?:([^/]+?)@)?github.com\/([^/#]+)\/([^/#]+)\/tarball\/([^/#]+)(?:#(.*))?$/,/^https?:\/\/(?:([^/]+?)@)?github.com\/([^/#]+)\/([^/#]+?)(?:\.git)?(?:#(.*))?$/];function kH(t){return t?Eme.some(e=>!!t.match(e)):!1}function QH(t){let e;for(let A of Eme)if(e=t.match(A),e)break;if(!e)throw new Error(Cme(t));let[,r,o,a,n="master"]=e,{commit:u}=yme.default.parse(n);return n=u||n.replace(/[^:]*:/,""),{auth:r,username:o,reponame:a,treeish:n}}function Cme(t){return`Input cannot be parsed as a valid GitHub URL ('${t}').`}var U2=class{supports(e,r){return!!kH(e.reference)}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${W.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from GitHub`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:W.getIdentVendorPath(e),checksum:u}}async fetchFromNetwork(e,r){let o=await rn.get(this.getLocatorUrl(e,r),{configuration:r.project.configuration});return await oe.mktempPromise(async a=>{let n=new gn(a);await Xi.extractArchiveTo(o,n,{stripComponents:1});let u=ra.splitRepoUrl(e.reference),A=K.join(a,"package.tgz");await un.prepareExternalProject(a,A,{configuration:r.project.configuration,report:r.report,workspace:u.extra.workspace,locator:e});let p=await oe.readFilePromise(A);return await Xi.convertToZip(p,{configuration:r.project.configuration,prefixPath:W.getIdentVendorPath(e),stripComponents:1})})}getLocatorUrl(e,r){let{auth:o,username:a,reponame:n,treeish:u}=QH(e.reference);return`https://${o?`${o}@`:""}github.com/${a}/${n}/archive/${u}.tar.gz`}};var gdt={hooks:{async fetchHostedRepository(t,e,r){if(t!==null)return t;let o=new U2;if(!o.supports(e,r))return null;try{return await o.fetch(e,r)}catch{return null}}}},ddt=gdt;var TH={};Kt(TH,{TarballHttpFetcher:()=>H2,TarballHttpResolver:()=>j2,default:()=>ydt});Ye();function _2(t){let e;try{e=new URL(t)}catch{return!1}return!(e.protocol!=="http:"&&e.protocol!=="https:"||!e.pathname.match(/(\.tar\.gz|\.tgz|\/[^.]+)$/))}var H2=class{supports(e,r){return _2(e.reference)}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${W.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote server`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:W.getIdentVendorPath(e),checksum:u}}async fetchFromNetwork(e,r){let o=await rn.get(e.reference,{configuration:r.project.configuration});return await Xi.convertToZip(o,{configuration:r.project.configuration,prefixPath:W.getIdentVendorPath(e),stripComponents:1})}};Ye();Ye();var j2=class{supportsDescriptor(e,r){return _2(e.range)}supportsLocator(e,r){return _2(e.reference)}shouldPersistResolution(e,r){return!0}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){return[W.convertDescriptorToLocator(e)]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Mt.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"HARD",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var mdt={fetchers:[H2],resolvers:[j2]},ydt=mdt;var RH={};Kt(RH,{InitCommand:()=>g0,default:()=>Cdt});Ye();Ye();Pt();qt();var g0=class extends ut{constructor(){super(...arguments);this.private=ge.Boolean("-p,--private",!1,{description:"Initialize a private package"});this.workspace=ge.Boolean("-w,--workspace",!1,{description:"Initialize a workspace root with a `packages/` directory"});this.install=ge.String("-i,--install",!1,{tolerateBoolean:!0,description:"Initialize a package with a specific bundle that will be locked in the project"});this.name=ge.String("-n,--name",{description:"Initialize a package with the given name"});this.usev2=ge.Boolean("-2",!1,{hidden:!0});this.yes=ge.Boolean("-y,--yes",{hidden:!0})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),o=typeof this.install=="string"?this.install:this.usev2||this.install===!0?"latest":null;return o!==null?await this.executeProxy(r,o):await this.executeRegular(r)}async executeProxy(r,o){if(r.projectCwd!==null&&r.projectCwd!==this.context.cwd)throw new it("Cannot use the --install flag from within a project subdirectory");oe.existsSync(this.context.cwd)||await oe.mkdirPromise(this.context.cwd,{recursive:!0});let a=K.join(this.context.cwd,dr.lockfile);oe.existsSync(a)||await oe.writeFilePromise(a,"");let n=await this.cli.run(["set","version",o],{quiet:!0});if(n!==0)return n;let u=[];return this.private&&u.push("-p"),this.workspace&&u.push("-w"),this.name&&u.push(`-n=${this.name}`),this.yes&&u.push("-y"),await oe.mktempPromise(async A=>{let{code:p}=await Ur.pipevp("yarn",["init",...u],{cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,env:await un.makeScriptEnv({binFolder:A})});return p})}async executeRegular(r){let o=null;try{o=(await St.find(r,this.context.cwd)).project}catch{o=null}oe.existsSync(this.context.cwd)||await oe.mkdirPromise(this.context.cwd,{recursive:!0});let a=await Mt.tryFind(this.context.cwd),n=a??new Mt,u=Object.fromEntries(r.get("initFields").entries());n.load(u),n.name=n.name??W.makeIdent(r.get("initScope"),this.name??K.basename(this.context.cwd)),n.packageManager=tn&&je.isTaggedYarnVersion(tn)?`yarn@${tn}`:null,(!a&&this.workspace||this.private)&&(n.private=!0),this.workspace&&n.workspaceDefinitions.length===0&&(await oe.mkdirPromise(K.join(this.context.cwd,"packages"),{recursive:!0}),n.workspaceDefinitions=[{pattern:"packages/*"}]);let A={};n.exportTo(A);let p=K.join(this.context.cwd,Mt.fileName);await oe.changeFilePromise(p,`${JSON.stringify(A,null,2)} +`,{automaticNewlines:!0});let h=[p],E=K.join(this.context.cwd,"README.md");if(oe.existsSync(E)||(await oe.writeFilePromise(E,`# ${W.stringifyIdent(n.name)} +`),h.push(E)),!o||o.cwd===this.context.cwd){let I=K.join(this.context.cwd,dr.lockfile);oe.existsSync(I)||(await oe.writeFilePromise(I,""),h.push(I));let b=[".yarn/*","!.yarn/patches","!.yarn/plugins","!.yarn/releases","!.yarn/sdks","!.yarn/versions","","# Swap the comments on the following lines if you wish to use zero-installs","# In that case, don't forget to run `yarn config set enableGlobalCache false`!","# Documentation here: https://yarnpkg.com/features/caching#zero-installs","","#!.yarn/cache",".pnp.*"].map(pe=>`${pe} +`).join(""),C=K.join(this.context.cwd,".gitignore");oe.existsSync(C)||(await oe.writeFilePromise(C,b),h.push(C));let L=["/.yarn/** linguist-vendored","/.yarn/releases/* binary","/.yarn/plugins/**/* binary","/.pnp.* binary linguist-generated"].map(pe=>`${pe} +`).join(""),U=K.join(this.context.cwd,".gitattributes");oe.existsSync(U)||(await oe.writeFilePromise(U,L),h.push(U));let J={["*"]:{endOfLine:"lf",insertFinalNewline:!0},["*.{js,json,yml}"]:{charset:"utf-8",indentStyle:"space",indentSize:2}};je.mergeIntoTarget(J,r.get("initEditorConfig"));let te=`root = true +`;for(let[pe,Ae]of Object.entries(J)){te+=` +[${pe}] +`;for(let[ye,ae]of Object.entries(Ae)){let we=ye.replace(/[A-Z]/g,Pe=>`_${Pe.toLowerCase()}`);te+=`${we} = ${ae} +`}}let le=K.join(this.context.cwd,".editorconfig");oe.existsSync(le)||(await oe.writeFilePromise(le,te),h.push(le)),await this.cli.run(["install"],{quiet:!0}),oe.existsSync(K.join(this.context.cwd,".git"))||(await Ur.execvp("git",["init"],{cwd:this.context.cwd}),await Ur.execvp("git",["add","--",...h],{cwd:this.context.cwd}),await Ur.execvp("git",["commit","--allow-empty","-m","First commit"],{cwd:this.context.cwd}))}}};g0.paths=[["init"]],g0.usage=nt.Usage({description:"create a new package",details:"\n This command will setup a new package in your local directory.\n\n If the `-p,--private` or `-w,--workspace` options are set, the package will be private by default.\n\n If the `-w,--workspace` option is set, the package will be configured to accept a set of workspaces in the `packages/` directory.\n\n If the `-i,--install` option is given a value, Yarn will first download it using `yarn set version` and only then forward the init call to the newly downloaded bundle. Without arguments, the downloaded bundle will be `latest`.\n\n The initial settings of the manifest can be changed by using the `initScope` and `initFields` configuration values. Additionally, Yarn will generate an EditorConfig file whose rules can be altered via `initEditorConfig`, and will initialize a Git repository in the current directory.\n ",examples:[["Create a new package in the local directory","yarn init"],["Create a new private package in the local directory","yarn init -p"],["Create a new package and store the Yarn release inside","yarn init -i=latest"],["Create a new private package and defines it as a workspace root","yarn init -w"]]});var Edt={configuration:{initScope:{description:"Scope used when creating packages via the init command",type:"STRING",default:null},initFields:{description:"Additional fields to set when creating packages via the init command",type:"MAP",valueDefinition:{description:"",type:"ANY"}},initEditorConfig:{description:"Extra rules to define in the generator editorconfig",type:"MAP",valueDefinition:{description:"",type:"ANY"}}},commands:[g0]},Cdt=Edt;var Lj={};Kt(Lj,{SearchCommand:()=>C0,UpgradeInteractiveCommand:()=>I0,default:()=>lIt});Ye();var Ime=$e(Be("os"));function SC({stdout:t}){if(Ime.default.endianness()==="BE")throw new Error("Interactive commands cannot be used on big-endian systems because ink depends on yoga-layout-prebuilt which only supports little-endian architectures");if(!t.isTTY)throw new Error("Interactive commands can only be used inside a TTY environment")}qt();var Rye=$e(ZH()),$H={appId:"OFCNCOG2CU",apiKey:"6fe4476ee5a1832882e326b506d14126",indexName:"npm-search"},myt=(0,Rye.default)($H.appId,$H.apiKey).initIndex($H.indexName),e6=async(t,e=0)=>await myt.search(t,{analyticsTags:["yarn-plugin-interactive-tools"],attributesToRetrieve:["name","version","owner","repository","humanDownloadsLast30Days"],page:e,hitsPerPage:10});var HB=["regular","dev","peer"],C0=class extends ut{async execute(){SC(this.context);let{Gem:e}=await Promise.resolve().then(()=>(AQ(),Dj)),{ScrollableItems:r}=await Promise.resolve().then(()=>(gQ(),hQ)),{useKeypress:o}=await Promise.resolve().then(()=>(OB(),Jwe)),{useMinistore:a}=await Promise.resolve().then(()=>(Qj(),kj)),{renderForm:n}=await Promise.resolve().then(()=>(EQ(),yQ)),{default:u}=await Promise.resolve().then(()=>$e(sIe())),{Box:A,Text:p}=await Promise.resolve().then(()=>$e(ic())),{default:h,useEffect:E,useState:I}=await Promise.resolve().then(()=>$e(sn())),v=await Ve.find(this.context.cwd,this.context.plugins),b=()=>h.createElement(A,{flexDirection:"row"},h.createElement(A,{flexDirection:"column",width:48},h.createElement(A,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},""),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to move between packages.")),h.createElement(A,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to select a package.")),h.createElement(A,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," again to change the target."))),h.createElement(A,{flexDirection:"column"},h.createElement(A,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to install the selected packages.")),h.createElement(A,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to abort.")))),C=()=>h.createElement(h.Fragment,null,h.createElement(A,{width:15},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Owner")),h.createElement(A,{width:11},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Version")),h.createElement(A,{width:10},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Downloads"))),T=()=>h.createElement(A,{width:17},h.createElement(p,{bold:!0,underline:!0,color:"gray"},"Target")),L=({hit:ae,active:we})=>{let[Pe,g]=a(ae.name,null);o({active:we},(ce,ne)=>{if(ne.name!=="space")return;if(!Pe){g(HB[0]);return}let ee=HB.indexOf(Pe)+1;ee===HB.length?g(null):g(HB[ee])},[Pe,g]);let Ee=W.parseIdent(ae.name),De=W.prettyIdent(v,Ee);return h.createElement(A,null,h.createElement(A,{width:45},h.createElement(p,{bold:!0,wrap:"wrap"},De)),h.createElement(A,{width:14,marginLeft:1},h.createElement(p,{bold:!0,wrap:"truncate"},ae.owner.name)),h.createElement(A,{width:10,marginLeft:1},h.createElement(p,{italic:!0,wrap:"truncate"},ae.version)),h.createElement(A,{width:16,marginLeft:1},h.createElement(p,null,ae.humanDownloadsLast30Days)))},U=({name:ae,active:we})=>{let[Pe]=a(ae,null),g=W.parseIdent(ae);return h.createElement(A,null,h.createElement(A,{width:47},h.createElement(p,{bold:!0}," - ",W.prettyIdent(v,g))),HB.map(Ee=>h.createElement(A,{key:Ee,width:14,marginLeft:1},h.createElement(p,null," ",h.createElement(e,{active:Pe===Ee})," ",h.createElement(p,{bold:!0},Ee)))))},J=()=>h.createElement(A,{marginTop:1},h.createElement(p,null,"Powered by Algolia.")),le=await n(({useSubmit:ae})=>{let we=a();ae(we);let Pe=Array.from(we.keys()).filter(H=>we.get(H)!==null),[g,Ee]=I(""),[De,ce]=I(0),[ne,ee]=I([]),Ie=H=>{H.match(/\t| /)||Ee(H)},ke=async()=>{ce(0);let H=await e6(g);H.query===g&&ee(H.hits)},ht=async()=>{let H=await e6(g,De+1);H.query===g&&H.page-1===De&&(ce(H.page),ee([...ne,...H.hits]))};return E(()=>{g?ke():ee([])},[g]),h.createElement(A,{flexDirection:"column"},h.createElement(b,null),h.createElement(A,{flexDirection:"row",marginTop:1},h.createElement(p,{bold:!0},"Search: "),h.createElement(A,{width:41},h.createElement(u,{value:g,onChange:Ie,placeholder:"i.e. babel, webpack, react...",showCursor:!1})),h.createElement(C,null)),ne.length?h.createElement(r,{radius:2,loop:!1,children:ne.map(H=>h.createElement(L,{key:H.name,hit:H,active:!1})),willReachEnd:ht}):h.createElement(p,{color:"gray"},"Start typing..."),h.createElement(A,{flexDirection:"row",marginTop:1},h.createElement(A,{width:49},h.createElement(p,{bold:!0},"Selected:")),h.createElement(T,null)),Pe.length?Pe.map(H=>h.createElement(U,{key:H,name:H,active:!1})):h.createElement(p,{color:"gray"},"No selected packages..."),h.createElement(J,null))},{},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof le>"u")return 1;let pe=Array.from(le.keys()).filter(ae=>le.get(ae)==="regular"),Ae=Array.from(le.keys()).filter(ae=>le.get(ae)==="dev"),ye=Array.from(le.keys()).filter(ae=>le.get(ae)==="peer");return pe.length&&await this.cli.run(["add",...pe]),Ae.length&&await this.cli.run(["add","--dev",...Ae]),ye&&await this.cli.run(["add","--peer",...ye]),0}};C0.paths=[["search"]],C0.usage=nt.Usage({category:"Interactive commands",description:"open the search interface",details:` + This command opens a fullscreen terminal interface where you can search for and install packages from the npm registry. + `,examples:[["Open the search window","yarn search"]]});Ye();qt();w_();var fIe=$e(zn()),AIe=/^((?:[\^~]|>=?)?)([0-9]+)(\.[0-9]+)(\.[0-9]+)((?:-\S+)?)$/,pIe=(t,e)=>t.length>0?[t.slice(0,e)].concat(pIe(t.slice(e),e)):[],I0=class extends ut{async execute(){SC(this.context);let{ItemOptions:e}=await Promise.resolve().then(()=>(uIe(),cIe)),{Pad:r}=await Promise.resolve().then(()=>(Nj(),lIe)),{ScrollableItems:o}=await Promise.resolve().then(()=>(gQ(),hQ)),{useMinistore:a}=await Promise.resolve().then(()=>(Qj(),kj)),{renderForm:n}=await Promise.resolve().then(()=>(EQ(),yQ)),{Box:u,Text:A}=await Promise.resolve().then(()=>$e(ic())),{default:p,useEffect:h,useRef:E,useState:I}=await Promise.resolve().then(()=>$e(sn())),v=await Ve.find(this.context.cwd,this.context.plugins),{project:b,workspace:C}=await St.find(v,this.context.cwd),T=await Lr.find(v);if(!C)throw new rr(b.cwd,this.context.cwd);await b.restoreInstallState({restoreResolutions:!1});let L=this.context.stdout.rows-7,U=(Ee,De)=>{let ce=fpe(Ee,De),ne="";for(let ee of ce)ee.added?ne+=de.pretty(v,ee.value,"green"):ee.removed||(ne+=ee.value);return ne},J=(Ee,De)=>{if(Ee===De)return De;let ce=W.parseRange(Ee),ne=W.parseRange(De),ee=ce.selector.match(AIe),Ie=ne.selector.match(AIe);if(!ee||!Ie)return U(Ee,De);let ke=["gray","red","yellow","green","magenta"],ht=null,H="";for(let lt=1;lt{let ne=await zc.fetchDescriptorFrom(Ee,ce,{project:b,cache:T,preserveModifier:De,workspace:C});return ne!==null?ne.range:Ee.range},le=async Ee=>{let De=fIe.default.valid(Ee.range)?`^${Ee.range}`:Ee.range,[ce,ne]=await Promise.all([te(Ee,Ee.range,De).catch(()=>null),te(Ee,Ee.range,"latest").catch(()=>null)]),ee=[{value:null,label:Ee.range}];return ce&&ce!==Ee.range?ee.push({value:ce,label:J(Ee.range,ce)}):ee.push({value:null,label:""}),ne&&ne!==ce&&ne!==Ee.range?ee.push({value:ne,label:J(Ee.range,ne)}):ee.push({value:null,label:""}),ee},pe=()=>p.createElement(u,{flexDirection:"row"},p.createElement(u,{flexDirection:"column",width:49},p.createElement(u,{marginLeft:1},p.createElement(A,null,"Press ",p.createElement(A,{bold:!0,color:"cyanBright"},""),"/",p.createElement(A,{bold:!0,color:"cyanBright"},"")," to select packages.")),p.createElement(u,{marginLeft:1},p.createElement(A,null,"Press ",p.createElement(A,{bold:!0,color:"cyanBright"},""),"/",p.createElement(A,{bold:!0,color:"cyanBright"},"")," to select versions."))),p.createElement(u,{flexDirection:"column"},p.createElement(u,{marginLeft:1},p.createElement(A,null,"Press ",p.createElement(A,{bold:!0,color:"cyanBright"},"")," to install.")),p.createElement(u,{marginLeft:1},p.createElement(A,null,"Press ",p.createElement(A,{bold:!0,color:"cyanBright"},"")," to abort.")))),Ae=()=>p.createElement(u,{flexDirection:"row",paddingTop:1,paddingBottom:1},p.createElement(u,{width:50},p.createElement(A,{bold:!0},p.createElement(A,{color:"greenBright"},"?")," Pick the packages you want to upgrade.")),p.createElement(u,{width:17},p.createElement(A,{bold:!0,underline:!0,color:"gray"},"Current")),p.createElement(u,{width:17},p.createElement(A,{bold:!0,underline:!0,color:"gray"},"Range")),p.createElement(u,{width:17},p.createElement(A,{bold:!0,underline:!0,color:"gray"},"Latest"))),ye=({active:Ee,descriptor:De,suggestions:ce})=>{let[ne,ee]=a(De.descriptorHash,null),Ie=W.stringifyIdent(De),ke=Math.max(0,45-Ie.length);return p.createElement(p.Fragment,null,p.createElement(u,null,p.createElement(u,{width:45},p.createElement(A,{bold:!0},W.prettyIdent(v,De)),p.createElement(r,{active:Ee,length:ke})),p.createElement(e,{active:Ee,options:ce,value:ne,skewer:!0,onChange:ee,sizes:[17,17,17]})))},ae=({dependencies:Ee})=>{let[De,ce]=I(Ee.map(()=>null)),ne=E(!0),ee=async Ie=>{let ke=await le(Ie);return ke.filter(ht=>ht.label!=="").length<=1?null:{descriptor:Ie,suggestions:ke}};return h(()=>()=>{ne.current=!1},[]),h(()=>{let Ie=Math.trunc(L*1.75),ke=Ee.slice(0,Ie),ht=Ee.slice(Ie),H=pIe(ht,L),lt=ke.map(ee).reduce(async(Re,Qe)=>{await Re;let be=await Qe;be!==null&&(!ne.current||ce(_e=>{let Te=_e.findIndex(He=>He===null),Je=[..._e];return Je[Te]=be,Je}))},Promise.resolve());H.reduce((Re,Qe)=>Promise.all(Qe.map(be=>Promise.resolve().then(()=>ee(be)))).then(async be=>{be=be.filter(_e=>_e!==null),await Re,ne.current&&ce(_e=>{let Te=_e.findIndex(Je=>Je===null);return _e.slice(0,Te).concat(be).concat(_e.slice(Te+be.length))})}),lt).then(()=>{ne.current&&ce(Re=>Re.filter(Qe=>Qe!==null))})},[]),De.length?p.createElement(o,{radius:L>>1,children:De.map((Ie,ke)=>Ie!==null?p.createElement(ye,{key:ke,active:!1,descriptor:Ie.descriptor,suggestions:Ie.suggestions}):p.createElement(A,{key:ke},"Loading..."))}):p.createElement(A,null,"No upgrades found")},Pe=await n(({useSubmit:Ee})=>{Ee(a());let De=new Map;for(let ne of b.workspaces)for(let ee of["dependencies","devDependencies"])for(let Ie of ne.manifest[ee].values())b.tryWorkspaceByDescriptor(Ie)===null&&(Ie.range.startsWith("link:")||De.set(Ie.descriptorHash,Ie));let ce=je.sortMap(De.values(),ne=>W.stringifyDescriptor(ne));return p.createElement(u,{flexDirection:"column"},p.createElement(pe,null),p.createElement(Ae,null),p.createElement(ae,{dependencies:ce}))},{},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof Pe>"u")return 1;let g=!1;for(let Ee of b.workspaces)for(let De of["dependencies","devDependencies"]){let ce=Ee.manifest[De];for(let ne of ce.values()){let ee=Pe.get(ne.descriptorHash);typeof ee<"u"&&ee!==null&&(ce.set(ne.identHash,W.makeDescriptor(ne,ee)),g=!0)}}return g?await b.installWithNewReport({quiet:this.context.quiet,stdout:this.context.stdout},{cache:T}):0}};I0.paths=[["upgrade-interactive"]],I0.usage=nt.Usage({category:"Interactive commands",description:"open the upgrade interface",details:` + This command opens a fullscreen terminal interface where you can see any out of date packages used by your application, their status compared to the latest versions available on the remote registry, and select packages to upgrade. + `,examples:[["Open the upgrade window","yarn upgrade-interactive"]]});var aIt={commands:[C0,I0]},lIt=aIt;var Mj={};Kt(Mj,{LinkFetcher:()=>qB,LinkResolver:()=>GB,PortalFetcher:()=>YB,PortalResolver:()=>WB,default:()=>uIt});Ye();Pt();var ep="portal:",tp="link:";var qB=class{supports(e,r){return!!e.reference.startsWith(tp)}getLocalPath(e,r){let{parentLocator:o,path:a}=W.parseFileStyleRange(e.reference,{protocol:tp});if(K.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(o,r);return n===null?null:K.resolve(n,a)}async fetch(e,r){let{parentLocator:o,path:a}=W.parseFileStyleRange(e.reference,{protocol:tp}),n=K.isAbsolute(a)?{packageFs:new gn(Bt.root),prefixPath:Bt.dot,localPath:Bt.root}:await r.fetcher.fetch(o,r),u=n.localPath?{packageFs:new gn(Bt.root),prefixPath:K.relative(Bt.root,n.localPath),localPath:Bt.root}:n;n!==u&&n.releaseFs&&n.releaseFs();let A=u.packageFs,p=K.resolve(u.localPath??u.packageFs.getRealPath(),u.prefixPath,a);return n.localPath?{packageFs:new gn(p,{baseFs:A}),releaseFs:u.releaseFs,prefixPath:Bt.dot,discardFromLookup:!0,localPath:p}:{packageFs:new _u(p,{baseFs:A}),releaseFs:u.releaseFs,prefixPath:Bt.dot,discardFromLookup:!0}}};Ye();Pt();var GB=class{supportsDescriptor(e,r){return!!e.range.startsWith(tp)}supportsLocator(e,r){return!!e.reference.startsWith(tp)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return W.bindDescriptor(e,{locator:W.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){let a=e.range.slice(tp.length);return[W.makeLocator(e,`${tp}${ue.toPortablePath(a)}`)]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){return{...e,version:"0.0.0",languageName:r.project.configuration.get("defaultLanguageName"),linkType:"SOFT",conditions:null,dependencies:new Map,peerDependencies:new Map,dependenciesMeta:new Map,peerDependenciesMeta:new Map,bin:new Map}}};Ye();Pt();var YB=class{supports(e,r){return!!e.reference.startsWith(ep)}getLocalPath(e,r){let{parentLocator:o,path:a}=W.parseFileStyleRange(e.reference,{protocol:ep});if(K.isAbsolute(a))return a;let n=r.fetcher.getLocalPath(o,r);return n===null?null:K.resolve(n,a)}async fetch(e,r){let{parentLocator:o,path:a}=W.parseFileStyleRange(e.reference,{protocol:ep}),n=K.isAbsolute(a)?{packageFs:new gn(Bt.root),prefixPath:Bt.dot,localPath:Bt.root}:await r.fetcher.fetch(o,r),u=n.localPath?{packageFs:new gn(Bt.root),prefixPath:K.relative(Bt.root,n.localPath),localPath:Bt.root}:n;n!==u&&n.releaseFs&&n.releaseFs();let A=u.packageFs,p=K.resolve(u.localPath??u.packageFs.getRealPath(),u.prefixPath,a);return n.localPath?{packageFs:new gn(p,{baseFs:A}),releaseFs:u.releaseFs,prefixPath:Bt.dot,localPath:p}:{packageFs:new _u(p,{baseFs:A}),releaseFs:u.releaseFs,prefixPath:Bt.dot}}};Ye();Ye();Pt();var WB=class{supportsDescriptor(e,r){return!!e.range.startsWith(ep)}supportsLocator(e,r){return!!e.reference.startsWith(ep)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){return W.bindDescriptor(e,{locator:W.stringifyLocator(r)})}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){let a=e.range.slice(ep.length);return[W.makeLocator(e,`${ep}${ue.toPortablePath(a)}`)]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let o=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),a=await je.releaseAfterUseAsync(async()=>await Mt.find(o.prefixPath,{baseFs:o.packageFs}),o.releaseFs);return{...e,version:a.version||"0.0.0",languageName:a.languageName||r.project.configuration.get("defaultLanguageName"),linkType:"SOFT",conditions:a.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(a.dependencies),peerDependencies:a.peerDependencies,dependenciesMeta:a.dependenciesMeta,peerDependenciesMeta:a.peerDependenciesMeta,bin:a.bin}}};var cIt={fetchers:[qB,YB],resolvers:[GB,WB]},uIt=cIt;var Cq={};Kt(Cq,{NodeModulesLinker:()=>lv,NodeModulesMode:()=>dq,PnpLooseLinker:()=>cv,default:()=>P1t});Pt();Ye();Pt();Pt();var Uj=(t,e)=>`${t}@${e}`,hIe=(t,e)=>{let r=e.indexOf("#"),o=r>=0?e.substring(r+1):e;return Uj(t,o)};var mIe=(t,e={})=>{let r=e.debugLevel||Number(process.env.NM_DEBUG_LEVEL||-1),o=e.check||r>=9,a=e.hoistingLimits||new Map,n={check:o,debugLevel:r,hoistingLimits:a,fastLookupPossible:!0},u;n.debugLevel>=0&&(u=Date.now());let A=mIt(t,n),p=!1,h=0;do p=_j(A,[A],new Set([A.locator]),new Map,n).anotherRoundNeeded,n.fastLookupPossible=!1,h++;while(p);if(n.debugLevel>=0&&console.log(`hoist time: ${Date.now()-u}ms, rounds: ${h}`),n.debugLevel>=1){let E=VB(A);if(_j(A,[A],new Set([A.locator]),new Map,n).isGraphChanged)throw new Error(`The hoisting result is not terminal, prev tree: +${E}, next tree: +${VB(A)}`);let v=yIe(A);if(v)throw new Error(`${v}, after hoisting finished: +${VB(A)}`)}return n.debugLevel>=2&&console.log(VB(A)),yIt(A)},AIt=t=>{let e=t[t.length-1],r=new Map,o=new Set,a=n=>{if(!o.has(n)){o.add(n);for(let u of n.hoistedDependencies.values())r.set(u.name,u);for(let u of n.dependencies.values())n.peerNames.has(u.name)||a(u)}};return a(e),r},fIt=t=>{let e=t[t.length-1],r=new Map,o=new Set,a=new Set,n=(u,A)=>{if(o.has(u))return;o.add(u);for(let h of u.hoistedDependencies.values())if(!A.has(h.name)){let E;for(let I of t)E=I.dependencies.get(h.name),E&&r.set(E.name,E)}let p=new Set;for(let h of u.dependencies.values())p.add(h.name);for(let h of u.dependencies.values())u.peerNames.has(h.name)||n(h,p)};return n(e,a),r},gIe=(t,e)=>{if(e.decoupled)return e;let{name:r,references:o,ident:a,locator:n,dependencies:u,originalDependencies:A,hoistedDependencies:p,peerNames:h,reasons:E,isHoistBorder:I,hoistPriority:v,dependencyKind:b,hoistedFrom:C,hoistedTo:T}=e,L={name:r,references:new Set(o),ident:a,locator:n,dependencies:new Map(u),originalDependencies:new Map(A),hoistedDependencies:new Map(p),peerNames:new Set(h),reasons:new Map(E),decoupled:!0,isHoistBorder:I,hoistPriority:v,dependencyKind:b,hoistedFrom:new Map(C),hoistedTo:new Map(T)},U=L.dependencies.get(r);return U&&U.ident==L.ident&&L.dependencies.set(r,L),t.dependencies.set(L.name,L),L},pIt=(t,e)=>{let r=new Map([[t.name,[t.ident]]]);for(let a of t.dependencies.values())t.peerNames.has(a.name)||r.set(a.name,[a.ident]);let o=Array.from(e.keys());o.sort((a,n)=>{let u=e.get(a),A=e.get(n);return A.hoistPriority!==u.hoistPriority?A.hoistPriority-u.hoistPriority:A.peerDependents.size!==u.peerDependents.size?A.peerDependents.size-u.peerDependents.size:A.dependents.size-u.dependents.size});for(let a of o){let n=a.substring(0,a.indexOf("@",1)),u=a.substring(n.length+1);if(!t.peerNames.has(n)){let A=r.get(n);A||(A=[],r.set(n,A)),A.indexOf(u)<0&&A.push(u)}}return r},Oj=t=>{let e=new Set,r=(o,a=new Set)=>{if(!a.has(o)){a.add(o);for(let n of o.peerNames)if(!t.peerNames.has(n)){let u=t.dependencies.get(n);u&&!e.has(u)&&r(u,a)}e.add(o)}};for(let o of t.dependencies.values())t.peerNames.has(o.name)||r(o);return e},_j=(t,e,r,o,a,n=new Set)=>{let u=e[e.length-1];if(n.has(u))return{anotherRoundNeeded:!1,isGraphChanged:!1};n.add(u);let A=EIt(u),p=pIt(u,A),h=t==u?new Map:a.fastLookupPossible?AIt(e):fIt(e),E,I=!1,v=!1,b=new Map(Array.from(p.entries()).map(([T,L])=>[T,L[0]])),C=new Map;do{let T=dIt(t,e,r,h,b,p,o,C,a);T.isGraphChanged&&(v=!0),T.anotherRoundNeeded&&(I=!0),E=!1;for(let[L,U]of p)U.length>1&&!u.dependencies.has(L)&&(b.delete(L),U.shift(),b.set(L,U[0]),E=!0)}while(E);for(let T of u.dependencies.values())if(!u.peerNames.has(T.name)&&!r.has(T.locator)){r.add(T.locator);let L=_j(t,[...e,T],r,C,a);L.isGraphChanged&&(v=!0),L.anotherRoundNeeded&&(I=!0),r.delete(T.locator)}return{anotherRoundNeeded:I,isGraphChanged:v}},hIt=t=>{for(let[e,r]of t.dependencies)if(!t.peerNames.has(e)&&r.ident!==t.ident)return!0;return!1},gIt=(t,e,r,o,a,n,u,A,{outputReason:p,fastLookupPossible:h})=>{let E,I=null,v=new Set;p&&(E=`${Array.from(e).map(L=>no(L)).join("\u2192")}`);let b=r[r.length-1],T=!(o.ident===b.ident);if(p&&!T&&(I="- self-reference"),T&&(T=o.dependencyKind!==1,p&&!T&&(I="- workspace")),T&&o.dependencyKind===2&&(T=!hIt(o),p&&!T&&(I="- external soft link with unhoisted dependencies")),T&&(T=b.dependencyKind!==1||b.hoistedFrom.has(o.name)||e.size===1,p&&!T&&(I=b.reasons.get(o.name))),T&&(T=!t.peerNames.has(o.name),p&&!T&&(I=`- cannot shadow peer: ${no(t.originalDependencies.get(o.name).locator)} at ${E}`)),T){let L=!1,U=a.get(o.name);if(L=!U||U.ident===o.ident,p&&!L&&(I=`- filled by: ${no(U.locator)} at ${E}`),L)for(let J=r.length-1;J>=1;J--){let le=r[J].dependencies.get(o.name);if(le&&le.ident!==o.ident){L=!1;let pe=A.get(b);pe||(pe=new Set,A.set(b,pe)),pe.add(o.name),p&&(I=`- filled by ${no(le.locator)} at ${r.slice(0,J).map(Ae=>no(Ae.locator)).join("\u2192")}`);break}}T=L}if(T&&(T=n.get(o.name)===o.ident,p&&!T&&(I=`- filled by: ${no(u.get(o.name)[0])} at ${E}`)),T){let L=!0,U=new Set(o.peerNames);for(let J=r.length-1;J>=1;J--){let te=r[J];for(let le of U){if(te.peerNames.has(le)&&te.originalDependencies.has(le))continue;let pe=te.dependencies.get(le);pe&&t.dependencies.get(le)!==pe&&(J===r.length-1?v.add(pe):(v=null,L=!1,p&&(I=`- peer dependency ${no(pe.locator)} from parent ${no(te.locator)} was not hoisted to ${E}`))),U.delete(le)}if(!L)break}T=L}if(T&&!h)for(let L of o.hoistedDependencies.values()){let U=a.get(L.name)||t.dependencies.get(L.name);if(!U||L.ident!==U.ident){T=!1,p&&(I=`- previously hoisted dependency mismatch, needed: ${no(L.locator)}, available: ${no(U?.locator)}`);break}}return v!==null&&v.size>0?{isHoistable:2,dependsOn:v,reason:I}:{isHoistable:T?0:1,reason:I}},CQ=t=>`${t.name}@${t.locator}`,dIt=(t,e,r,o,a,n,u,A,p)=>{let h=e[e.length-1],E=new Set,I=!1,v=!1,b=(U,J,te,le,pe)=>{if(E.has(le))return;let Ae=[...J,CQ(le)],ye=[...te,CQ(le)],ae=new Map,we=new Map;for(let ce of Oj(le)){let ne=gIt(h,r,[h,...U,le],ce,o,a,n,A,{outputReason:p.debugLevel>=2,fastLookupPossible:p.fastLookupPossible});if(we.set(ce,ne),ne.isHoistable===2)for(let ee of ne.dependsOn){let Ie=ae.get(ee.name)||new Set;Ie.add(ce.name),ae.set(ee.name,Ie)}}let Pe=new Set,g=(ce,ne,ee)=>{if(!Pe.has(ce)){Pe.add(ce),we.set(ce,{isHoistable:1,reason:ee});for(let Ie of ae.get(ce.name)||[])g(le.dependencies.get(Ie),ne,p.debugLevel>=2?`- peer dependency ${no(ce.locator)} from parent ${no(le.locator)} was not hoisted`:"")}};for(let[ce,ne]of we)ne.isHoistable===1&&g(ce,ne,ne.reason);let Ee=!1;for(let ce of we.keys())if(!Pe.has(ce)){v=!0;let ne=u.get(le);ne&&ne.has(ce.name)&&(I=!0),Ee=!0,le.dependencies.delete(ce.name),le.hoistedDependencies.set(ce.name,ce),le.reasons.delete(ce.name);let ee=h.dependencies.get(ce.name);if(p.debugLevel>=2){let Ie=Array.from(J).concat([le.locator]).map(ht=>no(ht)).join("\u2192"),ke=h.hoistedFrom.get(ce.name);ke||(ke=[],h.hoistedFrom.set(ce.name,ke)),ke.push(Ie),le.hoistedTo.set(ce.name,Array.from(e).map(ht=>no(ht.locator)).join("\u2192"))}if(!ee)h.ident!==ce.ident&&(h.dependencies.set(ce.name,ce),pe.add(ce));else for(let Ie of ce.references)ee.references.add(Ie)}if(le.dependencyKind===2&&Ee&&(I=!0),p.check){let ce=yIe(t);if(ce)throw new Error(`${ce}, after hoisting dependencies of ${[h,...U,le].map(ne=>no(ne.locator)).join("\u2192")}: +${VB(t)}`)}let De=Oj(le);for(let ce of De)if(Pe.has(ce)){let ne=we.get(ce);if((a.get(ce.name)===ce.ident||!le.reasons.has(ce.name))&&ne.isHoistable!==0&&le.reasons.set(ce.name,ne.reason),!ce.isHoistBorder&&ye.indexOf(CQ(ce))<0){E.add(le);let Ie=gIe(le,ce);b([...U,le],Ae,ye,Ie,T),E.delete(le)}}},C,T=new Set(Oj(h)),L=Array.from(e).map(U=>CQ(U));do{C=T,T=new Set;for(let U of C){if(U.locator===h.locator||U.isHoistBorder)continue;let J=gIe(h,U);b([],Array.from(r),L,J,T)}}while(T.size>0);return{anotherRoundNeeded:I,isGraphChanged:v}},yIe=t=>{let e=[],r=new Set,o=new Set,a=(n,u,A)=>{if(r.has(n)||(r.add(n),o.has(n)))return;let p=new Map(u);for(let h of n.dependencies.values())n.peerNames.has(h.name)||p.set(h.name,h);for(let h of n.originalDependencies.values()){let E=p.get(h.name),I=()=>`${Array.from(o).concat([n]).map(v=>no(v.locator)).join("\u2192")}`;if(n.peerNames.has(h.name)){let v=u.get(h.name);(v!==E||!v||v.ident!==h.ident)&&e.push(`${I()} - broken peer promise: expected ${h.ident} but found ${v&&v.ident}`)}else{let v=A.hoistedFrom.get(n.name),b=n.hoistedTo.get(h.name),C=`${v?` hoisted from ${v.join(", ")}`:""}`,T=`${b?` hoisted to ${b}`:""}`,L=`${I()}${C}`;E?E.ident!==h.ident&&e.push(`${L} - broken require promise for ${h.name}${T}: expected ${h.ident}, but found: ${E.ident}`):e.push(`${L} - broken require promise: no required dependency ${h.name}${T} found`)}}o.add(n);for(let h of n.dependencies.values())n.peerNames.has(h.name)||a(h,p,n);o.delete(n)};return a(t,t.dependencies,t),e.join(` +`)},mIt=(t,e)=>{let{identName:r,name:o,reference:a,peerNames:n}=t,u={name:o,references:new Set([a]),locator:Uj(r,a),ident:hIe(r,a),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(n),reasons:new Map,decoupled:!0,isHoistBorder:!0,hoistPriority:0,dependencyKind:1,hoistedFrom:new Map,hoistedTo:new Map},A=new Map([[t,u]]),p=(h,E)=>{let I=A.get(h),v=!!I;if(!I){let{name:b,identName:C,reference:T,peerNames:L,hoistPriority:U,dependencyKind:J}=h,te=e.hoistingLimits.get(E.locator);I={name:b,references:new Set([T]),locator:Uj(C,T),ident:hIe(C,T),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(L),reasons:new Map,decoupled:!0,isHoistBorder:te?te.has(b):!1,hoistPriority:U||0,dependencyKind:J||0,hoistedFrom:new Map,hoistedTo:new Map},A.set(h,I)}if(E.dependencies.set(h.name,I),E.originalDependencies.set(h.name,I),v){let b=new Set,C=T=>{if(!b.has(T)){b.add(T),T.decoupled=!1;for(let L of T.dependencies.values())T.peerNames.has(L.name)||C(L)}};C(I)}else for(let b of h.dependencies)p(b,I)};for(let h of t.dependencies)p(h,u);return u},Hj=t=>t.substring(0,t.indexOf("@",1)),yIt=t=>{let e={name:t.name,identName:Hj(t.locator),references:new Set(t.references),dependencies:new Set},r=new Set([t]),o=(a,n,u)=>{let A=r.has(a),p;if(n===a)p=u;else{let{name:h,references:E,locator:I}=a;p={name:h,identName:Hj(I),references:E,dependencies:new Set}}if(u.dependencies.add(p),!A){r.add(a);for(let h of a.dependencies.values())a.peerNames.has(h.name)||o(h,a,p);r.delete(a)}};for(let a of t.dependencies.values())o(a,t,e);return e},EIt=t=>{let e=new Map,r=new Set([t]),o=u=>`${u.name}@${u.ident}`,a=u=>{let A=o(u),p=e.get(A);return p||(p={dependents:new Set,peerDependents:new Set,hoistPriority:0},e.set(A,p)),p},n=(u,A)=>{let p=!!r.has(A);if(a(A).dependents.add(u.ident),!p){r.add(A);for(let E of A.dependencies.values()){let I=a(E);I.hoistPriority=Math.max(I.hoistPriority,E.hoistPriority),A.peerNames.has(E.name)?I.peerDependents.add(A.ident):n(A,E)}}};for(let u of t.dependencies.values())t.peerNames.has(u.name)||n(t,u);return e},no=t=>{if(!t)return"none";let e=t.indexOf("@",1),r=t.substring(0,e);r.endsWith("$wsroot$")&&(r=`wh:${r.replace("$wsroot$","")}`);let o=t.substring(e+1);if(o==="workspace:.")return".";if(o){let a=(o.indexOf("#")>0?o.split("#")[1]:o).replace("npm:","");return o.startsWith("virtual")&&(r=`v:${r}`),a.startsWith("workspace")&&(r=`w:${r}`,a=""),`${r}${a?`@${a}`:""}`}else return`${r}`},dIe=5e4,VB=t=>{let e=0,r=(a,n,u="")=>{if(e>dIe||n.has(a))return"";e++;let A=Array.from(a.dependencies.values()).sort((h,E)=>h.name===E.name?0:h.name>E.name?1:-1),p="";n.add(a);for(let h=0;h":"")+(v!==E.name?`a:${E.name}:`:"")+no(E.locator)+(I?` ${I}`:"")} +`,p+=r(E,n,`${u}${hdIe?` +Tree is too large, part of the tree has been dunped +`:"")};var KB=(o=>(o.WORKSPACES="workspaces",o.DEPENDENCIES="dependencies",o.NONE="none",o))(KB||{}),EIe="node_modules",B0="$wsroot$";var JB=(t,e)=>{let{packageTree:r,hoistingLimits:o,errors:a,preserveSymlinksRequired:n}=wIt(t,e),u=null;if(a.length===0){let A=mIe(r,{hoistingLimits:o});u=BIt(t,A,e)}return{tree:u,errors:a,preserveSymlinksRequired:n}},gA=t=>`${t.name}@${t.reference}`,qj=t=>{let e=new Map;for(let[r,o]of t.entries())if(!o.dirList){let a=e.get(o.locator);a||(a={target:o.target,linkType:o.linkType,locations:[],aliases:o.aliases},e.set(o.locator,a)),a.locations.push(r)}for(let r of e.values())r.locations=r.locations.sort((o,a)=>{let n=o.split(K.delimiter).length,u=a.split(K.delimiter).length;return a===o?0:n!==u?u-n:a>o?1:-1});return e},CIe=(t,e)=>{let r=W.isVirtualLocator(t)?W.devirtualizeLocator(t):t,o=W.isVirtualLocator(e)?W.devirtualizeLocator(e):e;return W.areLocatorsEqual(r,o)},jj=(t,e,r,o)=>{if(t.linkType!=="SOFT")return!1;let a=ue.toPortablePath(r.resolveVirtual&&e.reference&&e.reference.startsWith("virtual:")?r.resolveVirtual(t.packageLocation):t.packageLocation);return K.contains(o,a)===null},CIt=t=>{let e=t.getPackageInformation(t.topLevel);if(e===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");if(t.findPackageLocator(e.packageLocation)===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let o=ue.toPortablePath(e.packageLocation.slice(0,-1)),a=new Map,n={children:new Map},u=t.getDependencyTreeRoots(),A=new Map,p=new Set,h=(v,b)=>{let C=gA(v);if(p.has(C))return;p.add(C);let T=t.getPackageInformation(v);if(T){let L=b?gA(b):"";if(gA(v)!==L&&T.linkType==="SOFT"&&!jj(T,v,t,o)){let U=wIe(T,v,t);(!A.get(U)||v.reference.startsWith("workspace:"))&&A.set(U,v)}for(let[U,J]of T.packageDependencies)J!==null&&(T.packagePeers.has(U)||h(t.getLocator(U,J),v))}};for(let v of u)h(v,null);let E=o.split(K.sep);for(let v of A.values()){let b=t.getPackageInformation(v),T=ue.toPortablePath(b.packageLocation.slice(0,-1)).split(K.sep).slice(E.length),L=n;for(let U of T){let J=L.children.get(U);J||(J={children:new Map},L.children.set(U,J)),L=J}L.workspaceLocator=v}let I=(v,b)=>{if(v.workspaceLocator){let C=gA(b),T=a.get(C);T||(T=new Set,a.set(C,T)),T.add(v.workspaceLocator)}for(let C of v.children.values())I(C,v.workspaceLocator||b)};for(let v of n.children.values())I(v,n.workspaceLocator);return a},wIt=(t,e)=>{let r=[],o=!1,a=new Map,n=CIt(t),u=t.getPackageInformation(t.topLevel);if(u===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");let A=t.findPackageLocator(u.packageLocation);if(A===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let p=ue.toPortablePath(u.packageLocation.slice(0,-1)),h={name:A.name,identName:A.name,reference:A.reference,peerNames:u.packagePeers,dependencies:new Set,dependencyKind:1},E=new Map,I=(b,C)=>`${gA(C)}:${b}`,v=(b,C,T,L,U,J,te,le)=>{let pe=I(b,T),Ae=E.get(pe),ye=!!Ae;!ye&&T.name===A.name&&T.reference===A.reference&&(Ae=h,E.set(pe,h));let ae=jj(C,T,t,p);if(!Ae){let ce=0;ae?ce=2:C.linkType==="SOFT"&&T.name.endsWith(B0)&&(ce=1),Ae={name:b,identName:T.name,reference:T.reference,dependencies:new Set,peerNames:ce===1?new Set:C.packagePeers,dependencyKind:ce},E.set(pe,Ae)}let we;if(ae?we=2:U.linkType==="SOFT"?we=1:we=0,Ae.hoistPriority=Math.max(Ae.hoistPriority||0,we),le&&!ae){let ce=gA({name:L.identName,reference:L.reference}),ne=a.get(ce)||new Set;a.set(ce,ne),ne.add(Ae.name)}let Pe=new Map(C.packageDependencies);if(e.project){let ce=e.project.workspacesByCwd.get(ue.toPortablePath(C.packageLocation.slice(0,-1)));if(ce){let ne=new Set([...Array.from(ce.manifest.peerDependencies.values(),ee=>W.stringifyIdent(ee)),...Array.from(ce.manifest.peerDependenciesMeta.keys())]);for(let ee of ne)Pe.has(ee)||(Pe.set(ee,J.get(ee)||null),Ae.peerNames.add(ee))}}let g=gA({name:T.name.replace(B0,""),reference:T.reference}),Ee=n.get(g);if(Ee)for(let ce of Ee)Pe.set(`${ce.name}${B0}`,ce.reference);(C!==U||C.linkType!=="SOFT"||!ae&&(!e.selfReferencesByCwd||e.selfReferencesByCwd.get(te)))&&L.dependencies.add(Ae);let De=T!==A&&C.linkType==="SOFT"&&!T.name.endsWith(B0)&&!ae;if(!ye&&!De){let ce=new Map;for(let[ne,ee]of Pe)if(ee!==null){let Ie=t.getLocator(ne,ee),ke=t.getLocator(ne.replace(B0,""),ee),ht=t.getPackageInformation(ke);if(ht===null)throw new Error("Assertion failed: Expected the package to have been registered");let H=jj(ht,Ie,t,p);if(e.validateExternalSoftLinks&&e.project&&H){ht.packageDependencies.size>0&&(o=!0);for(let[_e,Te]of ht.packageDependencies)if(Te!==null){let Je=W.parseLocator(Array.isArray(Te)?`${Te[0]}@${Te[1]}`:`${_e}@${Te}`);if(gA(Je)!==gA(Ie)){let He=Pe.get(_e);if(He){let x=W.parseLocator(Array.isArray(He)?`${He[0]}@${He[1]}`:`${_e}@${He}`);CIe(x,Je)||r.push({messageName:71,text:`Cannot link ${W.prettyIdent(e.project.configuration,W.parseIdent(Ie.name))} into ${W.prettyLocator(e.project.configuration,W.parseLocator(`${T.name}@${T.reference}`))} dependency ${W.prettyLocator(e.project.configuration,Je)} conflicts with parent dependency ${W.prettyLocator(e.project.configuration,x)}`})}else{let x=ce.get(_e);if(x){let w=x.target,S=W.parseLocator(Array.isArray(w)?`${w[0]}@${w[1]}`:`${_e}@${w}`);CIe(S,Je)||r.push({messageName:71,text:`Cannot link ${W.prettyIdent(e.project.configuration,W.parseIdent(Ie.name))} into ${W.prettyLocator(e.project.configuration,W.parseLocator(`${T.name}@${T.reference}`))} dependency ${W.prettyLocator(e.project.configuration,Je)} conflicts with dependency ${W.prettyLocator(e.project.configuration,S)} from sibling portal ${W.prettyIdent(e.project.configuration,W.parseIdent(x.portal.name))}`})}else ce.set(_e,{target:Je.reference,portal:Ie})}}}}let lt=e.hoistingLimitsByCwd?.get(te),Re=H?te:K.relative(p,ue.toPortablePath(ht.packageLocation))||Bt.dot,Qe=e.hoistingLimitsByCwd?.get(Re);v(ne,ht,Ie,Ae,C,Pe,Re,lt==="dependencies"||Qe==="dependencies"||Qe==="workspaces")}}};return v(A.name,u,A,h,u,u.packageDependencies,Bt.dot,!1),{packageTree:h,hoistingLimits:a,errors:r,preserveSymlinksRequired:o}};function wIe(t,e,r){let o=r.resolveVirtual&&e.reference&&e.reference.startsWith("virtual:")?r.resolveVirtual(t.packageLocation):t.packageLocation;return ue.toPortablePath(o||t.packageLocation)}function IIt(t,e,r){let o=e.getLocator(t.name.replace(B0,""),t.reference),a=e.getPackageInformation(o);if(a===null)throw new Error("Assertion failed: Expected the package to be registered");return r.pnpifyFs?{linkType:"SOFT",target:ue.toPortablePath(a.packageLocation)}:{linkType:a.linkType,target:wIe(a,t,e)}}var BIt=(t,e,r)=>{let o=new Map,a=(E,I,v)=>{let{linkType:b,target:C}=IIt(E,t,r);return{locator:gA(E),nodePath:I,target:C,linkType:b,aliases:v}},n=E=>{let[I,v]=E.split("/");return v?{scope:I,name:v}:{scope:null,name:I}},u=new Set,A=(E,I,v)=>{if(u.has(E))return;u.add(E);let b=Array.from(E.references).sort().join("#");for(let C of E.dependencies){let T=Array.from(C.references).sort().join("#");if(C.identName===E.identName.replace(B0,"")&&T===b)continue;let L=Array.from(C.references).sort(),U={name:C.identName,reference:L[0]},{name:J,scope:te}=n(C.name),le=te?[te,J]:[J],pe=K.join(I,EIe),Ae=K.join(pe,...le),ye=`${v}/${U.name}`,ae=a(U,v,L.slice(1)),we=!1;if(ae.linkType==="SOFT"&&r.project){let Pe=r.project.workspacesByCwd.get(ae.target.slice(0,-1));we=!!(Pe&&!Pe.manifest.name)}if(!C.name.endsWith(B0)&&!we){let Pe=o.get(Ae);if(Pe){if(Pe.dirList)throw new Error(`Assertion failed: ${Ae} cannot merge dir node with leaf node`);{let De=W.parseLocator(Pe.locator),ce=W.parseLocator(ae.locator);if(Pe.linkType!==ae.linkType)throw new Error(`Assertion failed: ${Ae} cannot merge nodes with different link types ${Pe.nodePath}/${W.stringifyLocator(De)} and ${v}/${W.stringifyLocator(ce)}`);if(De.identHash!==ce.identHash)throw new Error(`Assertion failed: ${Ae} cannot merge nodes with different idents ${Pe.nodePath}/${W.stringifyLocator(De)} and ${v}/s${W.stringifyLocator(ce)}`);ae.aliases=[...ae.aliases,...Pe.aliases,W.parseLocator(Pe.locator).reference]}}o.set(Ae,ae);let g=Ae.split("/"),Ee=g.indexOf(EIe);for(let De=g.length-1;Ee>=0&&De>Ee;De--){let ce=ue.toPortablePath(g.slice(0,De).join(K.sep)),ne=g[De],ee=o.get(ce);if(!ee)o.set(ce,{dirList:new Set([ne])});else if(ee.dirList){if(ee.dirList.has(ne))break;ee.dirList.add(ne)}}}A(C,ae.linkType==="SOFT"?ae.target:Ae,ye)}},p=a({name:e.name,reference:Array.from(e.references)[0]},"",[]),h=p.target;return o.set(h,p),A(e,h,""),o};Ye();Ye();Pt();Pt();nA();Nl();var lq={};Kt(lq,{PnpInstaller:()=>dm,PnpLinker:()=>P0,UnplugCommand:()=>x0,default:()=>$It,getPnpPath:()=>S0,jsInstallUtils:()=>mA,pnpUtils:()=>av,quotePathIfNeeded:()=>s1e});Pt();var i1e=Be("url");Ye();Ye();Pt();Pt();var IIe={["DEFAULT"]:{collapsed:!1,next:{["*"]:"DEFAULT"}},["TOP_LEVEL"]:{collapsed:!1,next:{fallbackExclusionList:"FALLBACK_EXCLUSION_LIST",packageRegistryData:"PACKAGE_REGISTRY_DATA",["*"]:"DEFAULT"}},["FALLBACK_EXCLUSION_LIST"]:{collapsed:!1,next:{["*"]:"FALLBACK_EXCLUSION_ENTRIES"}},["FALLBACK_EXCLUSION_ENTRIES"]:{collapsed:!0,next:{["*"]:"FALLBACK_EXCLUSION_DATA"}},["FALLBACK_EXCLUSION_DATA"]:{collapsed:!0,next:{["*"]:"DEFAULT"}},["PACKAGE_REGISTRY_DATA"]:{collapsed:!1,next:{["*"]:"PACKAGE_REGISTRY_ENTRIES"}},["PACKAGE_REGISTRY_ENTRIES"]:{collapsed:!0,next:{["*"]:"PACKAGE_STORE_DATA"}},["PACKAGE_STORE_DATA"]:{collapsed:!1,next:{["*"]:"PACKAGE_STORE_ENTRIES"}},["PACKAGE_STORE_ENTRIES"]:{collapsed:!0,next:{["*"]:"PACKAGE_INFORMATION_DATA"}},["PACKAGE_INFORMATION_DATA"]:{collapsed:!1,next:{packageDependencies:"PACKAGE_DEPENDENCIES",["*"]:"DEFAULT"}},["PACKAGE_DEPENDENCIES"]:{collapsed:!1,next:{["*"]:"PACKAGE_DEPENDENCY"}},["PACKAGE_DEPENDENCY"]:{collapsed:!0,next:{["*"]:"DEFAULT"}}};function vIt(t,e,r){let o="";o+="[";for(let a=0,n=t.length;a"u"||(A!==0&&(a+=", "),a+=JSON.stringify(p),a+=": ",a+=wQ(p,h,e,r).replace(/^ +/g,""),A+=1)}return a+="}",a}function SIt(t,e,r){let o=Object.keys(t),a=`${r} `,n="";n+=r,n+=`{ +`;let u=0;for(let A=0,p=o.length;A"u"||(u!==0&&(n+=",",n+=` +`),n+=a,n+=JSON.stringify(h),n+=": ",n+=wQ(h,E,e,a).replace(/^ +/g,""),u+=1)}return u!==0&&(n+=` +`),n+=r,n+="}",n}function wQ(t,e,r,o){let{next:a}=IIe[r],n=a[t]||a["*"];return BIe(e,n,o)}function BIe(t,e,r){let{collapsed:o}=IIe[e];return Array.isArray(t)?o?vIt(t,e,r):DIt(t,e,r):typeof t=="object"&&t!==null?o?PIt(t,e,r):SIt(t,e,r):JSON.stringify(t)}function vIe(t){return BIe(t,"TOP_LEVEL","")}function zB(t,e){let r=Array.from(t);Array.isArray(e)||(e=[e]);let o=[];for(let n of e)o.push(r.map(u=>n(u)));let a=r.map((n,u)=>u);return a.sort((n,u)=>{for(let A of o){let p=A[n]A[u]?1:0;if(p!==0)return p}return 0}),a.map(n=>r[n])}function xIt(t){let e=new Map,r=zB(t.fallbackExclusionList||[],[({name:o,reference:a})=>o,({name:o,reference:a})=>a]);for(let{name:o,reference:a}of r){let n=e.get(o);typeof n>"u"&&e.set(o,n=new Set),n.add(a)}return Array.from(e).map(([o,a])=>[o,Array.from(a)])}function bIt(t){return zB(t.fallbackPool||[],([e])=>e)}function kIt(t){let e=[];for(let[r,o]of zB(t.packageRegistry,([a])=>a===null?"0":`1${a}`)){let a=[];e.push([r,a]);for(let[n,{packageLocation:u,packageDependencies:A,packagePeers:p,linkType:h,discardFromLookup:E}]of zB(o,([I])=>I===null?"0":`1${I}`)){let I=[];r!==null&&n!==null&&!A.has(r)&&I.push([r,n]);for(let[C,T]of zB(A.entries(),([L])=>L))I.push([C,T]);let v=p&&p.size>0?Array.from(p):void 0,b=E||void 0;a.push([n,{packageLocation:u,packageDependencies:I,packagePeers:v,linkType:h,discardFromLookup:b}])}}return e}function XB(t){return{__info:["This file is automatically generated. Do not touch it, or risk","your modifications being lost."],dependencyTreeRoots:t.dependencyTreeRoots,enableTopLevelFallback:t.enableTopLevelFallback||!1,ignorePatternData:t.ignorePattern||null,fallbackExclusionList:xIt(t),fallbackPool:bIt(t),packageRegistryData:kIt(t)}}var SIe=$e(PIe());function xIe(t,e){return[t?`${t} +`:"",`/* eslint-disable */ +`,`"use strict"; +`,` +`,e,` +`,(0,SIe.default)()].join("")}function QIt(t){return JSON.stringify(t,null,2)}function FIt(t){return`'${t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,`\\ +`)}'`}function TIt(t){return[`const RAW_RUNTIME_STATE = +`,`${FIt(vIe(t))}; + +`,`function $$SETUP_STATE(hydrateRuntimeState, basePath) { +`,` return hydrateRuntimeState(JSON.parse(RAW_RUNTIME_STATE), {basePath: basePath || __dirname}); +`,`} +`].join("")}function RIt(){return[`function $$SETUP_STATE(hydrateRuntimeState, basePath) { +`,` const fs = require('fs'); +`,` const path = require('path'); +`,` const pnpDataFilepath = path.resolve(__dirname, ${JSON.stringify(dr.pnpData)}); +`,` return hydrateRuntimeState(JSON.parse(fs.readFileSync(pnpDataFilepath, 'utf8')), {basePath: basePath || __dirname}); +`,`} +`].join("")}function bIe(t){let e=XB(t),r=TIt(e);return xIe(t.shebang,r)}function kIe(t){let e=XB(t),r=RIt(),o=xIe(t.shebang,r);return{dataFile:QIt(e),loaderFile:o}}Pt();function Yj(t,{basePath:e}){let r=ue.toPortablePath(e),o=K.resolve(r),a=t.ignorePatternData!==null?new RegExp(t.ignorePatternData):null,n=new Map,u=new Map(t.packageRegistryData.map(([I,v])=>[I,new Map(v.map(([b,C])=>{if(I===null!=(b===null))throw new Error("Assertion failed: The name and reference should be null, or neither should");let T=C.discardFromLookup??!1,L={name:I,reference:b},U=n.get(C.packageLocation);U?(U.discardFromLookup=U.discardFromLookup&&T,T||(U.locator=L)):n.set(C.packageLocation,{locator:L,discardFromLookup:T});let J=null;return[b,{packageDependencies:new Map(C.packageDependencies),packagePeers:new Set(C.packagePeers),linkType:C.linkType,discardFromLookup:T,get packageLocation(){return J||(J=K.join(o,C.packageLocation))}}]}))])),A=new Map(t.fallbackExclusionList.map(([I,v])=>[I,new Set(v)])),p=new Map(t.fallbackPool),h=t.dependencyTreeRoots,E=t.enableTopLevelFallback;return{basePath:r,dependencyTreeRoots:h,enableTopLevelFallback:E,fallbackExclusionList:A,fallbackPool:p,ignorePattern:a,packageLocatorsByLocations:n,packageRegistry:u}}Pt();Pt();var rp=Be("module"),gm=Be("url"),tq=Be("util");var Oo=Be("url");var RIe=$e(Be("assert"));var Wj=Array.isArray,ZB=JSON.stringify,$B=Object.getOwnPropertyNames,pm=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Vj=(t,e)=>RegExp.prototype.exec.call(t,e),Kj=(t,...e)=>RegExp.prototype[Symbol.replace].apply(t,e),v0=(t,...e)=>String.prototype.endsWith.apply(t,e),Jj=(t,...e)=>String.prototype.includes.apply(t,e),zj=(t,...e)=>String.prototype.lastIndexOf.apply(t,e),ev=(t,...e)=>String.prototype.indexOf.apply(t,e),QIe=(t,...e)=>String.prototype.replace.apply(t,e),D0=(t,...e)=>String.prototype.slice.apply(t,e),dA=(t,...e)=>String.prototype.startsWith.apply(t,e),FIe=Map,TIe=JSON.parse;function tv(t,e,r){return class extends r{constructor(...o){super(e(...o)),this.code=t,this.name=`${r.name} [${t}]`}}}var NIe=tv("ERR_PACKAGE_IMPORT_NOT_DEFINED",(t,e,r)=>`Package import specifier "${t}" is not defined${e?` in package ${e}package.json`:""} imported from ${r}`,TypeError),Xj=tv("ERR_INVALID_MODULE_SPECIFIER",(t,e,r=void 0)=>`Invalid module "${t}" ${e}${r?` imported from ${r}`:""}`,TypeError),LIe=tv("ERR_INVALID_PACKAGE_TARGET",(t,e,r,o=!1,a=void 0)=>{let n=typeof r=="string"&&!o&&r.length&&!dA(r,"./");return e==="."?((0,RIe.default)(o===!1),`Invalid "exports" main target ${ZB(r)} defined in the package config ${t}package.json${a?` imported from ${a}`:""}${n?'; targets must start with "./"':""}`):`Invalid "${o?"imports":"exports"}" target ${ZB(r)} defined for '${e}' in the package config ${t}package.json${a?` imported from ${a}`:""}${n?'; targets must start with "./"':""}`},Error),rv=tv("ERR_INVALID_PACKAGE_CONFIG",(t,e,r)=>`Invalid package config ${t}${e?` while importing ${e}`:""}${r?`. ${r}`:""}`,Error),MIe=tv("ERR_PACKAGE_PATH_NOT_EXPORTED",(t,e,r=void 0)=>e==="."?`No "exports" main defined in ${t}package.json${r?` imported from ${r}`:""}`:`Package subpath '${e}' is not defined by "exports" in ${t}package.json${r?` imported from ${r}`:""}`,Error);var BQ=Be("url");function OIe(t,e){let r=Object.create(null);for(let o=0;oe):t+e}nv(r,t,o,u,a)}Vj(_Ie,D0(t,2))!==null&&nv(r,t,o,u,a);let p=new URL(t,o),h=p.pathname,E=new URL(".",o).pathname;if(dA(h,E)||nv(r,t,o,u,a),e==="")return p;if(Vj(_Ie,e)!==null){let I=n?QIe(r,"*",()=>e):r+e;MIt(I,o,u,a)}return n?new URL(Kj(HIe,p.href,()=>e)):new URL(e,p)}function UIt(t){let e=+t;return`${e}`!==t?!1:e>=0&&e<4294967295}function qC(t,e,r,o,a,n,u,A){if(typeof e=="string")return OIt(e,r,o,t,a,n,u,A);if(Wj(e)){if(e.length===0)return null;let p;for(let h=0;hn?-1:n>a||r===-1?1:o===-1||t.length>e.length?-1:e.length>t.length?1:0}function _It(t,e,r){if(typeof t=="string"||Wj(t))return!0;if(typeof t!="object"||t===null)return!1;let o=$B(t),a=!1,n=0;for(let u=0;u=h.length&&v0(e,I)&&qIe(n,h)===1&&zj(h,"*")===E&&(n=h,u=D0(e,E,e.length-I.length))}}if(n){let p=r[n],h=qC(t,p,u,n,o,!0,!1,a);return h==null&&Zj(e,t,o),h}Zj(e,t,o)}function YIe({name:t,base:e,conditions:r,readFileSyncFn:o}){if(t==="#"||dA(t,"#/")||v0(t,"/")){let u="is not a valid internal imports specifier name";throw new Xj(t,u,(0,Oo.fileURLToPath)(e))}let a,n=UIe(e,o);if(n.exists){a=(0,Oo.pathToFileURL)(n.pjsonPath);let u=n.imports;if(u)if(pm(u,t)&&!Jj(t,"*")){let A=qC(a,u[t],"",t,e,!1,!0,r);if(A!=null)return A}else{let A="",p,h=$B(u);for(let E=0;E=I.length&&v0(t,b)&&qIe(A,I)===1&&zj(I,"*")===v&&(A=I,p=D0(t,v,t.length-b.length))}}if(A){let E=u[A],I=qC(a,E,p,A,e,!0,!0,r);if(I!=null)return I}}}LIt(t,a,e)}Pt();var jIt=new Set(["BUILTIN_NODE_RESOLUTION_FAILED","MISSING_DEPENDENCY","MISSING_PEER_DEPENDENCY","QUALIFIED_PATH_RESOLUTION_FAILED","UNDECLARED_DEPENDENCY"]);function $i(t,e,r={},o){o??=jIt.has(t)?"MODULE_NOT_FOUND":t;let a={configurable:!0,writable:!0,enumerable:!1};return Object.defineProperties(new Error(e),{code:{...a,value:o},pnpCode:{...a,value:t},data:{...a,value:r}})}function au(t){return ue.normalize(ue.fromPortablePath(t))}var JIe=$e(VIe());function zIe(t){return qIt(),eq[t]}var eq;function qIt(){eq||(eq={"--conditions":[],...KIe(GIt()),...KIe(process.execArgv)})}function KIe(t){return(0,JIe.default)({"--conditions":[String],"-C":"--conditions"},{argv:t,permissive:!0})}function GIt(){let t=[],e=YIt(process.env.NODE_OPTIONS||"",t);return t.length,e}function YIt(t,e){let r=[],o=!1,a=!0;for(let n=0;nparseInt(t,10)),XIe=hm>19||hm===19&&sv>=2||hm===18&&sv>=13,Bzt=hm===20&&sv<6||hm===19&&sv>=3,vzt=hm>19||hm===19&&sv>=6;function ZIe(t){if(process.env.WATCH_REPORT_DEPENDENCIES&&process.send)if(t=t.map(e=>ue.fromPortablePath(mi.resolveVirtual(ue.toPortablePath(e)))),XIe)process.send({"watch:require":t});else for(let e of t)process.send({"watch:require":e})}function rq(t,e){let r=Number(process.env.PNP_ALWAYS_WARN_ON_FALLBACK)>0,o=Number(process.env.PNP_DEBUG_LEVEL),a=/^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/,n=/^(\/|\.{1,2}(\/|$))/,u=/\/$/,A=/^\.{0,2}\//,p={name:null,reference:null},h=[],E=new Set;if(t.enableTopLevelFallback===!0&&h.push(p),e.compatibilityMode!==!1)for(let Re of["react-scripts","gatsby"]){let Qe=t.packageRegistry.get(Re);if(Qe)for(let be of Qe.keys()){if(be===null)throw new Error("Assertion failed: This reference shouldn't be null");h.push({name:Re,reference:be})}}let{ignorePattern:I,packageRegistry:v,packageLocatorsByLocations:b}=t;function C(Re,Qe){return{fn:Re,args:Qe,error:null,result:null}}function T(Re){let Qe=process.stderr?.hasColors?.()??process.stdout.isTTY,be=(Je,He)=>`\x1B[${Je}m${He}\x1B[0m`,_e=Re.error;console.error(_e?be("31;1",`\u2716 ${Re.error?.message.replace(/\n.*/s,"")}`):be("33;1","\u203C Resolution")),Re.args.length>0&&console.error();for(let Je of Re.args)console.error(` ${be("37;1","In \u2190")} ${(0,tq.inspect)(Je,{colors:Qe,compact:!0})}`);Re.result&&(console.error(),console.error(` ${be("37;1","Out \u2192")} ${(0,tq.inspect)(Re.result,{colors:Qe,compact:!0})}`));let Te=new Error().stack.match(/(?<=^ +)at.*/gm)?.slice(2)??[];if(Te.length>0){console.error();for(let Je of Te)console.error(` ${be("38;5;244",Je)}`)}console.error()}function L(Re,Qe){if(e.allowDebug===!1)return Qe;if(Number.isFinite(o)){if(o>=2)return(...be)=>{let _e=C(Re,be);try{return _e.result=Qe(...be)}catch(Te){throw _e.error=Te}finally{T(_e)}};if(o>=1)return(...be)=>{try{return Qe(...be)}catch(_e){let Te=C(Re,be);throw Te.error=_e,T(Te),_e}}}return Qe}function U(Re){let Qe=g(Re);if(!Qe)throw $i("INTERNAL","Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)");return Qe}function J(Re){if(Re.name===null)return!0;for(let Qe of t.dependencyTreeRoots)if(Qe.name===Re.name&&Qe.reference===Re.reference)return!0;return!1}let te=new Set(["node","require",...zIe("--conditions")]);function le(Re,Qe=te,be){let _e=ce(K.join(Re,"internal.js"),{resolveIgnored:!0,includeDiscardFromLookup:!0});if(_e===null)throw $i("INTERNAL",`The locator that owns the "${Re}" path can't be found inside the dependency tree (this is probably an internal error)`);let{packageLocation:Te}=U(_e),Je=K.join(Te,dr.manifest);if(!e.fakeFs.existsSync(Je))return null;let He=JSON.parse(e.fakeFs.readFileSync(Je,"utf8"));if(He.exports==null)return null;let x=K.contains(Te,Re);if(x===null)throw $i("INTERNAL","unqualifiedPath doesn't contain the packageLocation (this is probably an internal error)");x!=="."&&!A.test(x)&&(x=`./${x}`);try{let w=GIe({packageJSONUrl:(0,gm.pathToFileURL)(ue.fromPortablePath(Je)),packageSubpath:x,exports:He.exports,base:be?(0,gm.pathToFileURL)(ue.fromPortablePath(be)):null,conditions:Qe});return ue.toPortablePath((0,gm.fileURLToPath)(w))}catch(w){throw $i("EXPORTS_RESOLUTION_FAILED",w.message,{unqualifiedPath:au(Re),locator:_e,pkgJson:He,subpath:au(x),conditions:Qe},w.code)}}function pe(Re,Qe,{extensions:be}){let _e;try{Qe.push(Re),_e=e.fakeFs.statSync(Re)}catch{}if(_e&&!_e.isDirectory())return e.fakeFs.realpathSync(Re);if(_e&&_e.isDirectory()){let Te;try{Te=JSON.parse(e.fakeFs.readFileSync(K.join(Re,dr.manifest),"utf8"))}catch{}let Je;if(Te&&Te.main&&(Je=K.resolve(Re,Te.main)),Je&&Je!==Re){let He=pe(Je,Qe,{extensions:be});if(He!==null)return He}}for(let Te=0,Je=be.length;Te{let x=JSON.stringify(He.name);if(_e.has(x))return;_e.add(x);let w=Ee(He);for(let S of w)if(U(S).packagePeers.has(Re))Te(S);else{let F=be.get(S.name);typeof F>"u"&&be.set(S.name,F=new Set),F.add(S.reference)}};Te(Qe);let Je=[];for(let He of[...be.keys()].sort())for(let x of[...be.get(He)].sort())Je.push({name:He,reference:x});return Je}function ce(Re,{resolveIgnored:Qe=!1,includeDiscardFromLookup:be=!1}={}){if(ae(Re)&&!Qe)return null;let _e=K.relative(t.basePath,Re);_e.match(n)||(_e=`./${_e}`),_e.endsWith("/")||(_e=`${_e}/`);do{let Te=b.get(_e);if(typeof Te>"u"||Te.discardFromLookup&&!be){_e=_e.substring(0,_e.lastIndexOf("/",_e.length-2)+1);continue}return Te.locator}while(_e!=="");return null}function ne(Re){try{return e.fakeFs.readFileSync(ue.toPortablePath(Re),"utf8")}catch(Qe){if(Qe.code==="ENOENT")return;throw Qe}}function ee(Re,Qe,{considerBuiltins:be=!0}={}){if(Re.startsWith("#"))throw new Error("resolveToUnqualified can not handle private import mappings");if(Re==="pnpapi")return ue.toPortablePath(e.pnpapiResolution);if(be&&(0,rp.isBuiltin)(Re))return null;let _e=au(Re),Te=Qe&&au(Qe);if(Qe&&ae(Qe)&&(!K.isAbsolute(Re)||ce(Re)===null)){let x=ye(Re,Qe);if(x===!1)throw $i("BUILTIN_NODE_RESOLUTION_FAILED",`The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer was explicitely ignored by the regexp) + +Require request: "${_e}" +Required by: ${Te} +`,{request:_e,issuer:Te});return ue.toPortablePath(x)}let Je,He=Re.match(a);if(He){if(!Qe)throw $i("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:_e,issuer:Te});let[,x,w]=He,S=ce(Qe);if(!S){let Ne=ye(Re,Qe);if(Ne===!1)throw $i("BUILTIN_NODE_RESOLUTION_FAILED",`The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree). + +Require path: "${_e}" +Required by: ${Te} +`,{request:_e,issuer:Te});return ue.toPortablePath(Ne)}let F=U(S).packageDependencies.get(x),z=null;if(F==null&&S.name!==null){let Ne=t.fallbackExclusionList.get(S.name);if(!Ne||!Ne.has(S.reference)){for(let dt=0,jt=h.length;dtJ(ot))?X=$i("MISSING_PEER_DEPENDENCY",`${S.name} tried to access ${x} (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==_e?` (via "${_e}")`:""} +Required by: ${S.name}@${S.reference} (via ${Te}) +${Ne.map(ot=>`Ancestor breaking the chain: ${ot.name}@${ot.reference} +`).join("")} +`,{request:_e,issuer:Te,issuerLocator:Object.assign({},S),dependencyName:x,brokenAncestors:Ne}):X=$i("MISSING_PEER_DEPENDENCY",`${S.name} tried to access ${x} (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==_e?` (via "${_e}")`:""} +Required by: ${S.name}@${S.reference} (via ${Te}) + +${Ne.map(ot=>`Ancestor breaking the chain: ${ot.name}@${ot.reference} +`).join("")} +`,{request:_e,issuer:Te,issuerLocator:Object.assign({},S),dependencyName:x,brokenAncestors:Ne})}else F===void 0&&(!be&&(0,rp.isBuiltin)(Re)?J(S)?X=$i("UNDECLARED_DEPENDENCY",`Your application tried to access ${x}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${x} isn't otherwise declared in your dependencies, this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==_e?` (via "${_e}")`:""} +Required by: ${Te} +`,{request:_e,issuer:Te,dependencyName:x}):X=$i("UNDECLARED_DEPENDENCY",`${S.name} tried to access ${x}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${x} isn't otherwise declared in ${S.name}'s dependencies, this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==_e?` (via "${_e}")`:""} +Required by: ${Te} +`,{request:_e,issuer:Te,issuerLocator:Object.assign({},S),dependencyName:x}):J(S)?X=$i("UNDECLARED_DEPENDENCY",`Your application tried to access ${x}, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==_e?` (via "${_e}")`:""} +Required by: ${Te} +`,{request:_e,issuer:Te,dependencyName:x}):X=$i("UNDECLARED_DEPENDENCY",`${S.name} tried to access ${x}, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound. + +Required package: ${x}${x!==_e?` (via "${_e}")`:""} +Required by: ${S.name}@${S.reference} (via ${Te}) +`,{request:_e,issuer:Te,issuerLocator:Object.assign({},S),dependencyName:x}));if(F==null){if(z===null||X===null)throw X||new Error("Assertion failed: Expected an error to have been set");F=z;let Ne=X.message.replace(/\n.*/g,"");X.message=Ne,!E.has(Ne)&&o!==0&&(E.add(Ne),process.emitWarning(X))}let Z=Array.isArray(F)?{name:F[0],reference:F[1]}:{name:x,reference:F},ie=U(Z);if(!ie.packageLocation)throw $i("MISSING_DEPENDENCY",`A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod. + +Required package: ${Z.name}@${Z.reference}${Z.name!==_e?` (via "${_e}")`:""} +Required by: ${S.name}@${S.reference} (via ${Te}) +`,{request:_e,issuer:Te,dependencyLocator:Object.assign({},Z)});let Se=ie.packageLocation;w?Je=K.join(Se,w):Je=Se}else if(K.isAbsolute(Re))Je=K.normalize(Re);else{if(!Qe)throw $i("API_ERROR","The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:_e,issuer:Te});let x=K.resolve(Qe);Qe.match(u)?Je=K.normalize(K.join(x,Re)):Je=K.normalize(K.join(K.dirname(x),Re))}return K.normalize(Je)}function Ie(Re,Qe,be=te,_e){if(n.test(Re))return Qe;let Te=le(Qe,be,_e);return Te?K.normalize(Te):Qe}function ke(Re,{extensions:Qe=Object.keys(rp.Module._extensions)}={}){let be=[],_e=pe(Re,be,{extensions:Qe});if(_e)return K.normalize(_e);{ZIe(be.map(He=>ue.fromPortablePath(He)));let Te=au(Re),Je=ce(Re);if(Je){let{packageLocation:He}=U(Je),x=!0;try{e.fakeFs.accessSync(He)}catch(w){if(w?.code==="ENOENT")x=!1;else{let S=(w?.message??w??"empty exception thrown").replace(/^[A-Z]/,y=>y.toLowerCase());throw $i("QUALIFIED_PATH_RESOLUTION_FAILED",`Required package exists but could not be accessed (${S}). + +Missing package: ${Je.name}@${Je.reference} +Expected package location: ${au(He)} +`,{unqualifiedPath:Te,extensions:Qe})}}if(!x){let w=He.includes("/unplugged/")?"Required unplugged package missing from disk. This may happen when switching branches without running installs (unplugged packages must be fully materialized on disk to work).":"Required package missing from disk. If you keep your packages inside your repository then restarting the Node process may be enough. Otherwise, try to run an install first.";throw $i("QUALIFIED_PATH_RESOLUTION_FAILED",`${w} + +Missing package: ${Je.name}@${Je.reference} +Expected package location: ${au(He)} +`,{unqualifiedPath:Te,extensions:Qe})}}throw $i("QUALIFIED_PATH_RESOLUTION_FAILED",`Qualified path resolution failed: we looked for the following paths, but none could be accessed. + +Source path: ${Te} +${be.map(He=>`Not found: ${au(He)} +`).join("")}`,{unqualifiedPath:Te,extensions:Qe})}}function ht(Re,Qe,be){if(!Qe)throw new Error("Assertion failed: An issuer is required to resolve private import mappings");let _e=YIe({name:Re,base:(0,gm.pathToFileURL)(ue.fromPortablePath(Qe)),conditions:be.conditions??te,readFileSyncFn:ne});if(_e instanceof URL)return ke(ue.toPortablePath((0,gm.fileURLToPath)(_e)),{extensions:be.extensions});if(_e.startsWith("#"))throw new Error("Mapping from one private import to another isn't allowed");return H(_e,Qe,be)}function H(Re,Qe,be={}){try{if(Re.startsWith("#"))return ht(Re,Qe,be);let{considerBuiltins:_e,extensions:Te,conditions:Je}=be,He=ee(Re,Qe,{considerBuiltins:_e});if(Re==="pnpapi")return He;if(He===null)return null;let x=()=>Qe!==null?ae(Qe):!1,w=(!_e||!(0,rp.isBuiltin)(Re))&&!x()?Ie(Re,He,Je,Qe):He;return ke(w,{extensions:Te})}catch(_e){throw Object.hasOwn(_e,"pnpCode")&&Object.assign(_e.data,{request:au(Re),issuer:Qe&&au(Qe)}),_e}}function lt(Re){let Qe=K.normalize(Re),be=mi.resolveVirtual(Qe);return be!==Qe?be:null}return{VERSIONS:we,topLevel:Pe,getLocator:(Re,Qe)=>Array.isArray(Qe)?{name:Qe[0],reference:Qe[1]}:{name:Re,reference:Qe},getDependencyTreeRoots:()=>[...t.dependencyTreeRoots],getAllLocators(){let Re=[];for(let[Qe,be]of v)for(let _e of be.keys())Qe!==null&&_e!==null&&Re.push({name:Qe,reference:_e});return Re},getPackageInformation:Re=>{let Qe=g(Re);if(Qe===null)return null;let be=ue.fromPortablePath(Qe.packageLocation);return{...Qe,packageLocation:be}},findPackageLocator:Re=>ce(ue.toPortablePath(Re)),resolveToUnqualified:L("resolveToUnqualified",(Re,Qe,be)=>{let _e=Qe!==null?ue.toPortablePath(Qe):null,Te=ee(ue.toPortablePath(Re),_e,be);return Te===null?null:ue.fromPortablePath(Te)}),resolveUnqualified:L("resolveUnqualified",(Re,Qe)=>ue.fromPortablePath(ke(ue.toPortablePath(Re),Qe))),resolveRequest:L("resolveRequest",(Re,Qe,be)=>{let _e=Qe!==null?ue.toPortablePath(Qe):null,Te=H(ue.toPortablePath(Re),_e,be);return Te===null?null:ue.fromPortablePath(Te)}),resolveVirtual:L("resolveVirtual",Re=>{let Qe=lt(ue.toPortablePath(Re));return Qe!==null?ue.fromPortablePath(Qe):null})}}Pt();var $Ie=(t,e,r)=>{let o=XB(t),a=Yj(o,{basePath:e}),n=ue.join(e,dr.pnpCjs);return rq(a,{fakeFs:r,pnpapiResolution:n})};var iq=$e(t1e());qt();var mA={};Kt(mA,{checkManifestCompatibility:()=>r1e,extractBuildRequest:()=>vQ,getExtractHint:()=>sq,hasBindingGyp:()=>oq});Ye();Pt();function r1e(t){return W.isPackageCompatible(t,Ji.getArchitectureSet())}function vQ(t,e,r,{configuration:o}){let a=[];for(let n of["preinstall","install","postinstall"])e.manifest.scripts.has(n)&&a.push({type:0,script:n});return!e.manifest.scripts.has("install")&&e.misc.hasBindingGyp&&a.push({type:1,script:"node-gyp rebuild"}),a.length===0?null:t.linkType!=="HARD"?{skipped:!0,explain:n=>n.reportWarningOnce(6,`${W.prettyLocator(o,t)} lists build scripts, but is referenced through a soft link. Soft links don't support build scripts, so they'll be ignored.`)}:r&&r.built===!1?{skipped:!0,explain:n=>n.reportInfoOnce(5,`${W.prettyLocator(o,t)} lists build scripts, but its build has been explicitly disabled through configuration.`)}:!o.get("enableScripts")&&!r.built?{skipped:!0,explain:n=>n.reportWarningOnce(4,`${W.prettyLocator(o,t)} lists build scripts, but all build scripts have been disabled.`)}:r1e(t)?{skipped:!1,directives:a}:{skipped:!0,explain:n=>n.reportWarningOnce(76,`${W.prettyLocator(o,t)} The ${Ji.getArchitectureName()} architecture is incompatible with this package, build skipped.`)}}var VIt=new Set([".exe",".bin",".h",".hh",".hpp",".c",".cc",".cpp",".java",".jar",".node"]);function sq(t){return t.packageFs.getExtractHint({relevantExtensions:VIt})}function oq(t){let e=K.join(t.prefixPath,"binding.gyp");return t.packageFs.existsSync(e)}var av={};Kt(av,{getUnpluggedPath:()=>ov});Ye();Pt();function ov(t,{configuration:e}){return K.resolve(e.get("pnpUnpluggedFolder"),W.slugifyLocator(t))}var KIt=new Set([W.makeIdent(null,"open").identHash,W.makeIdent(null,"opn").identHash]),P0=class{constructor(){this.mode="strict";this.pnpCache=new Map}getCustomDataKey(){return JSON.stringify({name:"PnpLinker",version:2})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the PnP linker to be enabled");let o=S0(r.project).cjs;if(!oe.existsSync(o))throw new it(`The project in ${de.pretty(r.project.configuration,`${r.project.cwd}/package.json`,de.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let a=je.getFactoryWithDefault(this.pnpCache,o,()=>je.dynamicRequire(o,{cachingStrategy:je.CachingStrategy.FsTime})),n={name:W.stringifyIdent(e),reference:e.reference},u=a.getPackageInformation(n);if(!u)throw new it(`Couldn't find ${W.prettyLocator(r.project.configuration,e)} in the currently installed PnP map - running an install might help`);return ue.toPortablePath(u.packageLocation)}async findPackageLocator(e,r){if(!this.isEnabled(r))return null;let o=S0(r.project).cjs;if(!oe.existsSync(o))return null;let n=je.getFactoryWithDefault(this.pnpCache,o,()=>je.dynamicRequire(o,{cachingStrategy:je.CachingStrategy.FsTime})).findPackageLocator(ue.fromPortablePath(e));return n?W.makeLocator(W.parseIdent(n.name),n.reference):null}makeInstaller(e){return new dm(e)}isEnabled(e){return!(e.project.configuration.get("nodeLinker")!=="pnp"||e.project.configuration.get("pnpMode")!==this.mode)}},dm=class{constructor(e){this.opts=e;this.mode="strict";this.asyncActions=new je.AsyncActions(10);this.packageRegistry=new Map;this.virtualTemplates=new Map;this.isESMLoaderRequired=!1;this.customData={store:new Map};this.unpluggedPaths=new Set;this.opts=e}attachCustomData(e){this.customData=e}async installPackage(e,r,o){let a=W.stringifyIdent(e),n=e.reference,u=!!this.opts.project.tryWorkspaceByLocator(e),A=W.isVirtualLocator(e),p=e.peerDependencies.size>0&&!A,h=!p&&!u,E=!p&&e.linkType!=="SOFT",I,v;if(h||E){let te=A?W.devirtualizeLocator(e):e;I=this.customData.store.get(te.locatorHash),typeof I>"u"&&(I=await JIt(r),e.linkType==="HARD"&&this.customData.store.set(te.locatorHash,I)),I.manifest.type==="module"&&(this.isESMLoaderRequired=!0),v=this.opts.project.getDependencyMeta(te,e.version)}let b=h?vQ(e,I,v,{configuration:this.opts.project.configuration}):null,C=E?await this.unplugPackageIfNeeded(e,I,r,v,o):r.packageFs;if(K.isAbsolute(r.prefixPath))throw new Error(`Assertion failed: Expected the prefix path (${r.prefixPath}) to be relative to the parent`);let T=K.resolve(C.getRealPath(),r.prefixPath),L=aq(this.opts.project.cwd,T),U=new Map,J=new Set;if(A){for(let te of e.peerDependencies.values())U.set(W.stringifyIdent(te),null),J.add(W.stringifyIdent(te));if(!u){let te=W.devirtualizeLocator(e);this.virtualTemplates.set(te.locatorHash,{location:aq(this.opts.project.cwd,mi.resolveVirtual(T)),locator:te})}}return je.getMapWithDefault(this.packageRegistry,a).set(n,{packageLocation:L,packageDependencies:U,packagePeers:J,linkType:e.linkType,discardFromLookup:r.discardFromLookup||!1}),{packageLocation:T,buildRequest:b}}async attachInternalDependencies(e,r){let o=this.getPackageInformation(e);for(let[a,n]of r){let u=W.areIdentsEqual(a,n)?n.reference:[W.stringifyIdent(n),n.reference];o.packageDependencies.set(W.stringifyIdent(a),u)}}async attachExternalDependents(e,r){for(let o of r)this.getDiskInformation(o).packageDependencies.set(W.stringifyIdent(e),e.reference)}async finalizeInstall(){if(this.opts.project.configuration.get("pnpMode")!==this.mode)return;let e=S0(this.opts.project);if(this.isEsmEnabled()||await oe.removePromise(e.esmLoader),this.opts.project.configuration.get("nodeLinker")!=="pnp"){await oe.removePromise(e.cjs),await oe.removePromise(e.data),await oe.removePromise(e.esmLoader),await oe.removePromise(this.opts.project.configuration.get("pnpUnpluggedFolder"));return}for(let{locator:E,location:I}of this.virtualTemplates.values())je.getMapWithDefault(this.packageRegistry,W.stringifyIdent(E)).set(E.reference,{packageLocation:I,packageDependencies:new Map,packagePeers:new Set,linkType:"SOFT",discardFromLookup:!1});this.packageRegistry.set(null,new Map([[null,this.getPackageInformation(this.opts.project.topLevelWorkspace.anchoredLocator)]]));let r=this.opts.project.configuration.get("pnpFallbackMode"),o=this.opts.project.workspaces.map(({anchoredLocator:E})=>({name:W.stringifyIdent(E),reference:E.reference})),a=r!=="none",n=[],u=new Map,A=je.buildIgnorePattern([".yarn/sdks/**",...this.opts.project.configuration.get("pnpIgnorePatterns")]),p=this.packageRegistry,h=this.opts.project.configuration.get("pnpShebang");if(r==="dependencies-only")for(let E of this.opts.project.storedPackages.values())this.opts.project.tryWorkspaceByLocator(E)&&n.push({name:W.stringifyIdent(E),reference:E.reference});return await this.asyncActions.wait(),await this.finalizeInstallWithPnp({dependencyTreeRoots:o,enableTopLevelFallback:a,fallbackExclusionList:n,fallbackPool:u,ignorePattern:A,packageRegistry:p,shebang:h}),{customData:this.customData}}async transformPnpSettings(e){}isEsmEnabled(){if(this.opts.project.configuration.sources.has("pnpEnableEsmLoader"))return this.opts.project.configuration.get("pnpEnableEsmLoader");if(this.isESMLoaderRequired)return!0;for(let e of this.opts.project.workspaces)if(e.manifest.type==="module")return!0;return!1}async finalizeInstallWithPnp(e){let r=S0(this.opts.project),o=await this.locateNodeModules(e.ignorePattern);if(o.length>0){this.opts.report.reportWarning(31,"One or more node_modules have been detected and will be removed. This operation may take some time.");for(let n of o)await oe.removePromise(n)}if(await this.transformPnpSettings(e),this.opts.project.configuration.get("pnpEnableInlining")){let n=bIe(e);await oe.changeFilePromise(r.cjs,n,{automaticNewlines:!0,mode:493}),await oe.removePromise(r.data)}else{let{dataFile:n,loaderFile:u}=kIe(e);await oe.changeFilePromise(r.cjs,u,{automaticNewlines:!0,mode:493}),await oe.changeFilePromise(r.data,n,{automaticNewlines:!0,mode:420})}this.isEsmEnabled()&&(this.opts.report.reportWarning(0,"ESM support for PnP uses the experimental loader API and is therefore experimental"),await oe.changeFilePromise(r.esmLoader,(0,iq.default)(),{automaticNewlines:!0,mode:420}));let a=this.opts.project.configuration.get("pnpUnpluggedFolder");if(this.unpluggedPaths.size===0)await oe.removePromise(a);else for(let n of await oe.readdirPromise(a)){let u=K.resolve(a,n);this.unpluggedPaths.has(u)||await oe.removePromise(u)}}async locateNodeModules(e){let r=[],o=e?new RegExp(e):null;for(let a of this.opts.project.workspaces){let n=K.join(a.cwd,"node_modules");if(o&&o.test(K.relative(this.opts.project.cwd,a.cwd))||!oe.existsSync(n))continue;let u=await oe.readdirPromise(n,{withFileTypes:!0}),A=u.filter(p=>!p.isDirectory()||p.name===".bin"||!p.name.startsWith("."));if(A.length===u.length)r.push(n);else for(let p of A)r.push(K.join(n,p.name))}return r}async unplugPackageIfNeeded(e,r,o,a,n){return this.shouldBeUnplugged(e,r,a)?this.unplugPackage(e,o,n):o.packageFs}shouldBeUnplugged(e,r,o){return typeof o.unplugged<"u"?o.unplugged:KIt.has(e.identHash)||e.conditions!=null?!0:r.manifest.preferUnplugged!==null?r.manifest.preferUnplugged:!!(vQ(e,r,o,{configuration:this.opts.project.configuration})?.skipped===!1||r.misc.extractHint)}async unplugPackage(e,r,o){let a=ov(e,{configuration:this.opts.project.configuration});return this.opts.project.disabledLocators.has(e.locatorHash)?new Uu(a,{baseFs:r.packageFs,pathUtils:K}):(this.unpluggedPaths.add(a),o.holdFetchResult(this.asyncActions.set(e.locatorHash,async()=>{let n=K.join(a,r.prefixPath,".ready");await oe.existsPromise(n)||(this.opts.project.storedBuildState.delete(e.locatorHash),await oe.mkdirPromise(a,{recursive:!0}),await oe.copyPromise(a,Bt.dot,{baseFs:r.packageFs,overwrite:!1}),await oe.writeFilePromise(n,""))})),new gn(a))}getPackageInformation(e){let r=W.stringifyIdent(e),o=e.reference,a=this.packageRegistry.get(r);if(!a)throw new Error(`Assertion failed: The package information store should have been available (for ${W.prettyIdent(this.opts.project.configuration,e)})`);let n=a.get(o);if(!n)throw new Error(`Assertion failed: The package information should have been available (for ${W.prettyLocator(this.opts.project.configuration,e)})`);return n}getDiskInformation(e){let r=je.getMapWithDefault(this.packageRegistry,"@@disk"),o=aq(this.opts.project.cwd,e);return je.getFactoryWithDefault(r,o,()=>({packageLocation:o,packageDependencies:new Map,packagePeers:new Set,linkType:"SOFT",discardFromLookup:!1}))}};function aq(t,e){let r=K.relative(t,e);return r.match(/^\.{0,2}\//)||(r=`./${r}`),r.replace(/\/?$/,"/")}async function JIt(t){let e=await Mt.tryFind(t.prefixPath,{baseFs:t.packageFs})??new Mt,r=new Set(["preinstall","install","postinstall"]);for(let o of e.scripts.keys())r.has(o)||e.scripts.delete(o);return{manifest:{scripts:e.scripts,preferUnplugged:e.preferUnplugged,type:e.type},misc:{extractHint:sq(t),hasBindingGyp:oq(t)}}}Ye();Ye();qt();var n1e=$e(Zo());var x0=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Unplug direct dependencies from the entire project"});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Unplug both direct and transitive dependencies"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.patterns=ge.Rest()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(!a)throw new rr(o.cwd,this.context.cwd);if(r.get("nodeLinker")!=="pnp")throw new it("This command can only be used if the `nodeLinker` option is set to `pnp`");await o.restoreInstallState();let u=new Set(this.patterns),A=this.patterns.map(b=>{let C=W.parseDescriptor(b),T=C.range!=="unknown"?C:W.makeDescriptor(C,"*");if(!kr.validRange(T.range))throw new it(`The range of the descriptor patterns must be a valid semver range (${W.prettyDescriptor(r,T)})`);return L=>{let U=W.stringifyIdent(L);return!n1e.default.isMatch(U,W.stringifyIdent(T))||L.version&&!kr.satisfiesWithPrereleases(L.version,T.range)?!1:(u.delete(b),!0)}}),p=()=>{let b=[];for(let C of o.storedPackages.values())!o.tryWorkspaceByLocator(C)&&!W.isVirtualLocator(C)&&A.some(T=>T(C))&&b.push(C);return b},h=b=>{let C=new Set,T=[],L=(U,J)=>{if(C.has(U.locatorHash))return;let te=!!o.tryWorkspaceByLocator(U);if(!(J>0&&!this.recursive&&te)&&(C.add(U.locatorHash),!o.tryWorkspaceByLocator(U)&&A.some(le=>le(U))&&T.push(U),!(J>0&&!this.recursive)))for(let le of U.dependencies.values()){let pe=o.storedResolutions.get(le.descriptorHash);if(!pe)throw new Error("Assertion failed: The resolution should have been registered");let Ae=o.storedPackages.get(pe);if(!Ae)throw new Error("Assertion failed: The package should have been registered");L(Ae,J+1)}};for(let U of b)L(U.anchoredPackage,0);return T},E,I;if(this.all&&this.recursive?(E=p(),I="the project"):this.all?(E=h(o.workspaces),I="any workspace"):(E=h([a]),I="this workspace"),u.size>1)throw new it(`Patterns ${de.prettyList(r,u,de.Type.CODE)} don't match any packages referenced by ${I}`);if(u.size>0)throw new it(`Pattern ${de.prettyList(r,u,de.Type.CODE)} doesn't match any packages referenced by ${I}`);E=je.sortMap(E,b=>W.stringifyLocator(b));let v=await Nt.start({configuration:r,stdout:this.context.stdout,json:this.json},async b=>{for(let C of E){let T=C.version??"unknown",L=o.topLevelWorkspace.manifest.ensureDependencyMeta(W.makeDescriptor(C,T));L.unplugged=!0,b.reportInfo(0,`Will unpack ${W.prettyLocator(r,C)} to ${de.pretty(r,ov(C,{configuration:r}),de.Type.PATH)}`),b.reportJson({locator:W.stringifyLocator(C),version:T})}await o.topLevelWorkspace.persistManifest(),this.json||b.reportSeparator()});return v.hasErrors()?v.exitCode():await o.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:n})}};x0.paths=[["unplug"]],x0.usage=nt.Usage({description:"force the unpacking of a list of packages",details:"\n This command will add the selectors matching the specified patterns to the list of packages that must be unplugged when installed.\n\n A package being unplugged means that instead of being referenced directly through its archive, it will be unpacked at install time in the directory configured via `pnpUnpluggedFolder`. Note that unpacking packages this way is generally not recommended because it'll make it harder to store your packages within the repository. However, it's a good approach to quickly and safely debug some packages, and can even sometimes be required depending on the context (for example when the package contains shellscripts).\n\n Running the command will set a persistent flag inside your top-level `package.json`, in the `dependenciesMeta` field. As such, to undo its effects, you'll need to revert the changes made to the manifest and run `yarn install` to apply the modification.\n\n By default, only direct dependencies from the current workspace are affected. If `-A,--all` is set, direct dependencies from the entire project are affected. Using the `-R,--recursive` flag will affect transitive dependencies as well as direct ones.\n\n This command accepts glob patterns inside the scope and name components (not the range). Make sure to escape the patterns to prevent your own shell from trying to expand them.\n ",examples:[["Unplug the lodash dependency from the active workspace","yarn unplug lodash"],["Unplug all instances of lodash referenced by any workspace","yarn unplug lodash -A"],["Unplug all instances of lodash referenced by the active workspace and its dependencies","yarn unplug lodash -R"],["Unplug all instances of lodash, anywhere","yarn unplug lodash -AR"],["Unplug one specific version of lodash","yarn unplug lodash@1.2.3"],["Unplug all packages with the `@babel` scope","yarn unplug '@babel/*'"],["Unplug all packages (only for testing, not recommended)","yarn unplug -R '*'"]]});var S0=t=>({cjs:K.join(t.cwd,dr.pnpCjs),data:K.join(t.cwd,dr.pnpData),esmLoader:K.join(t.cwd,dr.pnpEsmLoader)}),s1e=t=>/\s/.test(t)?JSON.stringify(t):t;async function zIt(t,e,r){let o=/\s*--require\s+\S*\.pnp\.c?js\s*/g,a=/\s*--experimental-loader\s+\S*\.pnp\.loader\.mjs\s*/,n=(e.NODE_OPTIONS??"").replace(o," ").replace(a," ").trim();if(t.configuration.get("nodeLinker")!=="pnp"){e.NODE_OPTIONS=n;return}let u=S0(t),A=`--require ${s1e(ue.fromPortablePath(u.cjs))}`;oe.existsSync(u.esmLoader)&&(A=`${A} --experimental-loader ${(0,i1e.pathToFileURL)(ue.fromPortablePath(u.esmLoader)).href}`),oe.existsSync(u.cjs)&&(e.NODE_OPTIONS=n?`${A} ${n}`:A)}async function XIt(t,e){let r=S0(t);e(r.cjs),e(r.data),e(r.esmLoader),e(t.configuration.get("pnpUnpluggedFolder"))}var ZIt={hooks:{populateYarnPaths:XIt,setupScriptEnvironment:zIt},configuration:{nodeLinker:{description:'The linker used for installing Node packages, one of: "pnp", "pnpm", or "node-modules"',type:"STRING",default:"pnp"},winLinkType:{description:"Whether Yarn should use Windows Junctions or symlinks when creating links on Windows.",type:"STRING",values:["junctions","symlinks"],default:"junctions"},pnpMode:{description:"If 'strict', generates standard PnP maps. If 'loose', merges them with the n_m resolution.",type:"STRING",default:"strict"},pnpShebang:{description:"String to prepend to the generated PnP script",type:"STRING",default:"#!/usr/bin/env node"},pnpIgnorePatterns:{description:"Array of glob patterns; files matching them will use the classic resolution",type:"STRING",default:[],isArray:!0},pnpEnableEsmLoader:{description:"If true, Yarn will generate an ESM loader (`.pnp.loader.mjs`). If this is not explicitly set Yarn tries to automatically detect whether ESM support is required.",type:"BOOLEAN",default:!1},pnpEnableInlining:{description:"If true, the PnP data will be inlined along with the generated loader",type:"BOOLEAN",default:!0},pnpFallbackMode:{description:"If true, the generated PnP loader will follow the top-level fallback rule",type:"STRING",default:"dependencies-only"},pnpUnpluggedFolder:{description:"Folder where the unplugged packages must be stored",type:"ABSOLUTE_PATH",default:"./.yarn/unplugged"}},linkers:[P0],commands:[x0]},$It=ZIt;var p1e=$e(u1e());qt();var gq=$e(Be("crypto")),h1e=$e(Be("fs")),g1e=1,Pi="node_modules",DQ=".bin",d1e=".yarn-state.yml",d1t=1e3,dq=(o=>(o.CLASSIC="classic",o.HARDLINKS_LOCAL="hardlinks-local",o.HARDLINKS_GLOBAL="hardlinks-global",o))(dq||{}),lv=class{constructor(){this.installStateCache=new Map}getCustomDataKey(){return JSON.stringify({name:"NodeModulesLinker",version:3})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the node-modules linker to be enabled");let o=r.project.tryWorkspaceByLocator(e);if(o)return o.cwd;let a=await je.getFactoryWithDefault(this.installStateCache,r.project.cwd,async()=>await hq(r.project,{unrollAliases:!0}));if(a===null)throw new it("Couldn't find the node_modules state file - running an install might help (findPackageLocation)");let n=a.locatorMap.get(W.stringifyLocator(e));if(!n){let p=new it(`Couldn't find ${W.prettyLocator(r.project.configuration,e)} in the currently installed node_modules map - running an install might help`);throw p.code="LOCATOR_NOT_INSTALLED",p}let u=n.locations.sort((p,h)=>p.split(K.sep).length-h.split(K.sep).length),A=K.join(r.project.configuration.startingCwd,Pi);return u.find(p=>K.contains(A,p))||n.locations[0]}async findPackageLocator(e,r){if(!this.isEnabled(r))return null;let o=await je.getFactoryWithDefault(this.installStateCache,r.project.cwd,async()=>await hq(r.project,{unrollAliases:!0}));if(o===null)return null;let{locationRoot:a,segments:n}=PQ(K.resolve(e),{skipPrefix:r.project.cwd}),u=o.locationTree.get(a);if(!u)return null;let A=u.locator;for(let p of n){if(u=u.children.get(p),!u)break;A=u.locator||A}return W.parseLocator(A)}makeInstaller(e){return new pq(e)}isEnabled(e){return e.project.configuration.get("nodeLinker")==="node-modules"}},pq=class{constructor(e){this.opts=e;this.localStore=new Map;this.realLocatorChecksums=new Map;this.customData={store:new Map}}attachCustomData(e){this.customData=e}async installPackage(e,r){let o=K.resolve(r.packageFs.getRealPath(),r.prefixPath),a=this.customData.store.get(e.locatorHash);if(typeof a>"u"&&(a=await m1t(e,r),e.linkType==="HARD"&&this.customData.store.set(e.locatorHash,a)),!W.isPackageCompatible(e,this.opts.project.configuration.getSupportedArchitectures()))return{packageLocation:null,buildRequest:null};let n=new Map,u=new Set;n.has(W.stringifyIdent(e))||n.set(W.stringifyIdent(e),e.reference);let A=e;if(W.isVirtualLocator(e)){A=W.devirtualizeLocator(e);for(let E of e.peerDependencies.values())n.set(W.stringifyIdent(E),null),u.add(W.stringifyIdent(E))}let p={packageLocation:`${ue.fromPortablePath(o)}/`,packageDependencies:n,packagePeers:u,linkType:e.linkType,discardFromLookup:r.discardFromLookup??!1};this.localStore.set(e.locatorHash,{pkg:e,customPackageData:a,dependencyMeta:this.opts.project.getDependencyMeta(e,e.version),pnpNode:p});let h=r.checksum?r.checksum.substring(r.checksum.indexOf("/")+1):null;return this.realLocatorChecksums.set(A.locatorHash,h),{packageLocation:o,buildRequest:null}}async attachInternalDependencies(e,r){let o=this.localStore.get(e.locatorHash);if(typeof o>"u")throw new Error("Assertion failed: Expected information object to have been registered");for(let[a,n]of r){let u=W.areIdentsEqual(a,n)?n.reference:[W.stringifyIdent(n),n.reference];o.pnpNode.packageDependencies.set(W.stringifyIdent(a),u)}}async attachExternalDependents(e,r){throw new Error("External dependencies haven't been implemented for the node-modules linker")}async finalizeInstall(){if(this.opts.project.configuration.get("nodeLinker")!=="node-modules")return;let e=new mi({baseFs:new Jl({maxOpenFiles:80,readOnlyArchives:!0})}),r=await hq(this.opts.project),o=this.opts.project.configuration.get("nmMode");(r===null||o!==r.nmMode)&&(this.opts.project.storedBuildState.clear(),r={locatorMap:new Map,binSymlinks:new Map,locationTree:new Map,nmMode:o,mtimeMs:0});let a=new Map(this.opts.project.workspaces.map(v=>{let b=this.opts.project.configuration.get("nmHoistingLimits");try{b=je.validateEnum(KB,v.manifest.installConfig?.hoistingLimits??b)}catch{let T=W.prettyWorkspace(this.opts.project.configuration,v);this.opts.report.reportWarning(57,`${T}: Invalid 'installConfig.hoistingLimits' value. Expected one of ${Object.values(KB).join(", ")}, using default: "${b}"`)}return[v.relativeCwd,b]})),n=new Map(this.opts.project.workspaces.map(v=>{let b=this.opts.project.configuration.get("nmSelfReferences");return b=v.manifest.installConfig?.selfReferences??b,[v.relativeCwd,b]})),u={VERSIONS:{std:1},topLevel:{name:null,reference:null},getLocator:(v,b)=>Array.isArray(b)?{name:b[0],reference:b[1]}:{name:v,reference:b},getDependencyTreeRoots:()=>this.opts.project.workspaces.map(v=>{let b=v.anchoredLocator;return{name:W.stringifyIdent(b),reference:b.reference}}),getPackageInformation:v=>{let b=v.reference===null?this.opts.project.topLevelWorkspace.anchoredLocator:W.makeLocator(W.parseIdent(v.name),v.reference),C=this.localStore.get(b.locatorHash);if(typeof C>"u")throw new Error("Assertion failed: Expected the package reference to have been registered");return C.pnpNode},findPackageLocator:v=>{let b=this.opts.project.tryWorkspaceByCwd(ue.toPortablePath(v));if(b!==null){let C=b.anchoredLocator;return{name:W.stringifyIdent(C),reference:C.reference}}throw new Error("Assertion failed: Unimplemented")},resolveToUnqualified:()=>{throw new Error("Assertion failed: Unimplemented")},resolveUnqualified:()=>{throw new Error("Assertion failed: Unimplemented")},resolveRequest:()=>{throw new Error("Assertion failed: Unimplemented")},resolveVirtual:v=>ue.fromPortablePath(mi.resolveVirtual(ue.toPortablePath(v)))},{tree:A,errors:p,preserveSymlinksRequired:h}=JB(u,{pnpifyFs:!1,validateExternalSoftLinks:!0,hoistingLimitsByCwd:a,project:this.opts.project,selfReferencesByCwd:n});if(!A){for(let{messageName:v,text:b}of p)this.opts.report.reportError(v,b);return}let E=qj(A);await B1t(r,E,{baseFs:e,project:this.opts.project,report:this.opts.report,realLocatorChecksums:this.realLocatorChecksums,loadManifest:async v=>{let b=W.parseLocator(v),C=this.localStore.get(b.locatorHash);if(typeof C>"u")throw new Error("Assertion failed: Expected the slot to exist");return C.customPackageData.manifest}});let I=[];for(let[v,b]of E.entries()){if(C1e(v))continue;let C=W.parseLocator(v),T=this.localStore.get(C.locatorHash);if(typeof T>"u")throw new Error("Assertion failed: Expected the slot to exist");if(this.opts.project.tryWorkspaceByLocator(T.pkg))continue;let L=mA.extractBuildRequest(T.pkg,T.customPackageData,T.dependencyMeta,{configuration:this.opts.project.configuration});!L||I.push({buildLocations:b.locations,locator:C,buildRequest:L})}return h&&this.opts.report.reportWarning(72,`The application uses portals and that's why ${de.pretty(this.opts.project.configuration,"--preserve-symlinks",de.Type.CODE)} Node option is required for launching it`),{customData:this.customData,records:I}}};async function m1t(t,e){let r=await Mt.tryFind(e.prefixPath,{baseFs:e.packageFs})??new Mt,o=new Set(["preinstall","install","postinstall"]);for(let a of r.scripts.keys())o.has(a)||r.scripts.delete(a);return{manifest:{bin:r.bin,scripts:r.scripts},misc:{hasBindingGyp:mA.hasBindingGyp(e)}}}async function y1t(t,e,r,o,{installChangedByUser:a}){let n="";n+=`# Warning: This file is automatically generated. Removing it is fine, but will +`,n+=`# cause your node_modules installation to become invalidated. +`,n+=` +`,n+=`__metadata: +`,n+=` version: ${g1e} +`,n+=` nmMode: ${o.value} +`;let u=Array.from(e.keys()).sort(),A=W.stringifyLocator(t.topLevelWorkspace.anchoredLocator);for(let E of u){let I=e.get(E);n+=` +`,n+=`${JSON.stringify(E)}: +`,n+=` locations: +`;for(let v of I.locations){let b=K.contains(t.cwd,v);if(b===null)throw new Error(`Assertion failed: Expected the path to be within the project (${v})`);n+=` - ${JSON.stringify(b)} +`}if(I.aliases.length>0){n+=` aliases: +`;for(let v of I.aliases)n+=` - ${JSON.stringify(v)} +`}if(E===A&&r.size>0){n+=` bin: +`;for(let[v,b]of r){let C=K.contains(t.cwd,v);if(C===null)throw new Error(`Assertion failed: Expected the path to be within the project (${v})`);n+=` ${JSON.stringify(C)}: +`;for(let[T,L]of b){let U=K.relative(K.join(v,Pi),L);n+=` ${JSON.stringify(T)}: ${JSON.stringify(U)} +`}}}}let p=t.cwd,h=K.join(p,Pi,d1e);a&&await oe.removePromise(h),await oe.changeFilePromise(h,n,{automaticNewlines:!0})}async function hq(t,{unrollAliases:e=!1}={}){let r=t.cwd,o=K.join(r,Pi,d1e),a;try{a=await oe.statPromise(o)}catch{}if(!a)return null;let n=Vi(await oe.readFilePromise(o,"utf8"));if(n.__metadata.version>g1e)return null;let u=n.__metadata.nmMode||"classic",A=new Map,p=new Map;delete n.__metadata;for(let[h,E]of Object.entries(n)){let I=E.locations.map(b=>K.join(r,b)),v=E.bin;if(v)for(let[b,C]of Object.entries(v)){let T=K.join(r,ue.toPortablePath(b)),L=je.getMapWithDefault(p,T);for(let[U,J]of Object.entries(C))L.set(U,ue.toPortablePath([T,Pi,J].join(K.sep)))}if(A.set(h,{target:Bt.dot,linkType:"HARD",locations:I,aliases:E.aliases||[]}),e&&E.aliases)for(let b of E.aliases){let{scope:C,name:T}=W.parseLocator(h),L=W.makeLocator(W.makeIdent(C,T),b),U=W.stringifyLocator(L);A.set(U,{target:Bt.dot,linkType:"HARD",locations:I,aliases:[]})}}return{locatorMap:A,binSymlinks:p,locationTree:m1e(A,{skipPrefix:t.cwd}),nmMode:u,mtimeMs:a.mtimeMs}}var YC=async(t,e)=>{if(t.split(K.sep).indexOf(Pi)<0)throw new Error(`Assertion failed: trying to remove dir that doesn't contain node_modules: ${t}`);try{if(!e.innerLoop){let o=e.allowSymlink?await oe.statPromise(t):await oe.lstatPromise(t);if(e.allowSymlink&&!o.isDirectory()||!e.allowSymlink&&o.isSymbolicLink()){await oe.unlinkPromise(t);return}}let r=await oe.readdirPromise(t,{withFileTypes:!0});for(let o of r){let a=K.join(t,o.name);o.isDirectory()?(o.name!==Pi||e&&e.innerLoop)&&await YC(a,{innerLoop:!0,contentsOnly:!1}):await oe.unlinkPromise(a)}e.contentsOnly||await oe.rmdirPromise(t)}catch(r){if(r.code!=="ENOENT"&&r.code!=="ENOTEMPTY")throw r}},A1e=4,PQ=(t,{skipPrefix:e})=>{let r=K.contains(e,t);if(r===null)throw new Error(`Assertion failed: Writing attempt prevented to ${t} which is outside project root: ${e}`);let o=r.split(K.sep).filter(p=>p!==""),a=o.indexOf(Pi),n=o.slice(0,a).join(K.sep),u=K.join(e,n),A=o.slice(a);return{locationRoot:u,segments:A}},m1e=(t,{skipPrefix:e})=>{let r=new Map;if(t===null)return r;let o=()=>({children:new Map,linkType:"HARD"});for(let[a,n]of t.entries()){if(n.linkType==="SOFT"&&K.contains(e,n.target)!==null){let A=je.getFactoryWithDefault(r,n.target,o);A.locator=a,A.linkType=n.linkType}for(let u of n.locations){let{locationRoot:A,segments:p}=PQ(u,{skipPrefix:e}),h=je.getFactoryWithDefault(r,A,o);for(let E=0;E{if(process.platform==="win32"&&r==="junctions"){let o;try{o=await oe.lstatPromise(t)}catch{}if(!o||o.isDirectory()){await oe.symlinkPromise(t,e,"junction");return}}await oe.symlinkPromise(K.relative(K.dirname(e),t),e)};async function y1e(t,e,r){let o=K.join(t,`${gq.default.randomBytes(16).toString("hex")}.tmp`);try{await oe.writeFilePromise(o,r);try{await oe.linkPromise(o,e)}catch{}}finally{await oe.unlinkPromise(o)}}async function E1t({srcPath:t,dstPath:e,entry:r,globalHardlinksStore:o,baseFs:a,nmMode:n}){if(r.kind===E1e.FILE){if(n.value==="hardlinks-global"&&o&&r.digest){let A=K.join(o,r.digest.substring(0,2),`${r.digest.substring(2)}.dat`),p;try{let h=await oe.statPromise(A);if(h&&(!r.mtimeMs||h.mtimeMs>r.mtimeMs||h.mtimeMs(o.FILE="file",o.DIRECTORY="directory",o.SYMLINK="symlink",o))(E1e||{}),C1t=async(t,e,{baseFs:r,globalHardlinksStore:o,nmMode:a,windowsLinkType:n,packageChecksum:u})=>{await oe.mkdirPromise(t,{recursive:!0});let A=async(E=Bt.dot)=>{let I=K.join(e,E),v=await r.readdirPromise(I,{withFileTypes:!0}),b=new Map;for(let C of v){let T=K.join(E,C.name),L,U=K.join(I,C.name);if(C.isFile()){if(L={kind:"file",mode:(await r.lstatPromise(U)).mode},a.value==="hardlinks-global"){let J=await wn.checksumFile(U,{baseFs:r,algorithm:"sha1"});L.digest=J}}else if(C.isDirectory())L={kind:"directory"};else if(C.isSymbolicLink())L={kind:"symlink",symlinkTo:await r.readlinkPromise(U)};else throw new Error(`Unsupported file type (file: ${U}, mode: 0o${await r.statSync(U).mode.toString(8).padStart(6,"0")})`);if(b.set(T,L),C.isDirectory()&&T!==Pi){let J=await A(T);for(let[te,le]of J)b.set(te,le)}}return b},p;if(a.value==="hardlinks-global"&&o&&u){let E=K.join(o,u.substring(0,2),`${u.substring(2)}.json`);try{p=new Map(Object.entries(JSON.parse(await oe.readFilePromise(E,"utf8"))))}catch{p=await A()}}else p=await A();let h=!1;for(let[E,I]of p){let v=K.join(e,E),b=K.join(t,E);if(I.kind==="directory")await oe.mkdirPromise(b,{recursive:!0});else if(I.kind==="file"){let C=I.mtimeMs;await E1t({srcPath:v,dstPath:b,entry:I,nmMode:a,baseFs:r,globalHardlinksStore:o}),I.mtimeMs!==C&&(h=!0)}else I.kind==="symlink"&&await mq(K.resolve(K.dirname(b),I.symlinkTo),b,n)}if(a.value==="hardlinks-global"&&o&&h&&u){let E=K.join(o,u.substring(0,2),`${u.substring(2)}.json`);await oe.removePromise(E),await y1e(o,E,Buffer.from(JSON.stringify(Object.fromEntries(p))))}};function w1t(t,e,r,o){let a=new Map,n=new Map,u=new Map,A=!1,p=(h,E,I,v,b)=>{let C=!0,T=K.join(h,E),L=new Set;if(E===Pi||E.startsWith("@")){let J;try{J=oe.statSync(T)}catch{}C=!!J,J?J.mtimeMs>r?(A=!0,L=new Set(oe.readdirSync(T))):L=new Set(I.children.get(E).children.keys()):A=!0;let te=e.get(h);if(te){let le=K.join(h,Pi,DQ),pe;try{pe=oe.statSync(le)}catch{}if(!pe)A=!0;else if(pe.mtimeMs>r){A=!0;let Ae=new Set(oe.readdirSync(le)),ye=new Map;n.set(h,ye);for(let[ae,we]of te)Ae.has(ae)&&ye.set(ae,we)}else n.set(h,te)}}else C=b.has(E);let U=I.children.get(E);if(C){let{linkType:J,locator:te}=U,le={children:new Map,linkType:J,locator:te};if(v.children.set(E,le),te){let pe=je.getSetWithDefault(u,te);pe.add(T),u.set(te,pe)}for(let pe of U.children.keys())p(T,pe,U,le,L)}else U.locator&&o.storedBuildState.delete(W.parseLocator(U.locator).locatorHash)};for(let[h,E]of t){let{linkType:I,locator:v}=E,b={children:new Map,linkType:I,locator:v};if(a.set(h,b),v){let C=je.getSetWithDefault(u,E.locator);C.add(h),u.set(E.locator,C)}E.children.has(Pi)&&p(h,Pi,E,b,new Set)}return{locationTree:a,binSymlinks:n,locatorLocations:u,installChangedByUser:A}}function C1e(t){let e=W.parseDescriptor(t);return W.isVirtualDescriptor(e)&&(e=W.devirtualizeDescriptor(e)),e.range.startsWith("link:")}async function I1t(t,e,r,{loadManifest:o}){let a=new Map;for(let[A,{locations:p}]of t){let h=C1e(A)?null:await o(A,p[0]),E=new Map;if(h)for(let[I,v]of h.bin){let b=K.join(p[0],v);v!==""&&oe.existsSync(b)&&E.set(I,v)}a.set(A,E)}let n=new Map,u=(A,p,h)=>{let E=new Map,I=K.contains(r,A);if(h.locator&&I!==null){let v=a.get(h.locator);for(let[b,C]of v){let T=K.join(A,ue.toPortablePath(C));E.set(b,T)}for(let[b,C]of h.children){let T=K.join(A,b),L=u(T,T,C);L.size>0&&n.set(A,new Map([...n.get(A)||new Map,...L]))}}else for(let[v,b]of h.children){let C=u(K.join(A,v),p,b);for(let[T,L]of C)E.set(T,L)}return E};for(let[A,p]of e){let h=u(A,A,p);h.size>0&&n.set(A,new Map([...n.get(A)||new Map,...h]))}return n}var f1e=(t,e)=>{if(!t||!e)return t===e;let r=W.parseLocator(t);W.isVirtualLocator(r)&&(r=W.devirtualizeLocator(r));let o=W.parseLocator(e);return W.isVirtualLocator(o)&&(o=W.devirtualizeLocator(o)),W.areLocatorsEqual(r,o)};function yq(t){return K.join(t.get("globalFolder"),"store")}async function B1t(t,e,{baseFs:r,project:o,report:a,loadManifest:n,realLocatorChecksums:u}){let A=K.join(o.cwd,Pi),{locationTree:p,binSymlinks:h,locatorLocations:E,installChangedByUser:I}=w1t(t.locationTree,t.binSymlinks,t.mtimeMs,o),v=m1e(e,{skipPrefix:o.cwd}),b=[],C=async({srcDir:we,dstDir:Pe,linkType:g,globalHardlinksStore:Ee,nmMode:De,windowsLinkType:ce,packageChecksum:ne})=>{let ee=(async()=>{try{g==="SOFT"?(await oe.mkdirPromise(K.dirname(Pe),{recursive:!0}),await mq(K.resolve(we),Pe,ce)):await C1t(Pe,we,{baseFs:r,globalHardlinksStore:Ee,nmMode:De,windowsLinkType:ce,packageChecksum:ne})}catch(Ie){throw Ie.message=`While persisting ${we} -> ${Pe} ${Ie.message}`,Ie}finally{le.tick()}})().then(()=>b.splice(b.indexOf(ee),1));b.push(ee),b.length>A1e&&await Promise.race(b)},T=async(we,Pe,g)=>{let Ee=(async()=>{let De=async(ce,ne,ee)=>{try{ee.innerLoop||await oe.mkdirPromise(ne,{recursive:!0});let Ie=await oe.readdirPromise(ce,{withFileTypes:!0});for(let ke of Ie){if(!ee.innerLoop&&ke.name===DQ)continue;let ht=K.join(ce,ke.name),H=K.join(ne,ke.name);ke.isDirectory()?(ke.name!==Pi||ee&&ee.innerLoop)&&(await oe.mkdirPromise(H,{recursive:!0}),await De(ht,H,{...ee,innerLoop:!0})):ye.value==="hardlinks-local"||ye.value==="hardlinks-global"?await oe.linkPromise(ht,H):await oe.copyFilePromise(ht,H,h1e.default.constants.COPYFILE_FICLONE)}}catch(Ie){throw ee.innerLoop||(Ie.message=`While cloning ${ce} -> ${ne} ${Ie.message}`),Ie}finally{ee.innerLoop||le.tick()}};await De(we,Pe,g)})().then(()=>b.splice(b.indexOf(Ee),1));b.push(Ee),b.length>A1e&&await Promise.race(b)},L=async(we,Pe,g)=>{if(g)for(let[Ee,De]of Pe.children){let ce=g.children.get(Ee);await L(K.join(we,Ee),De,ce)}else{Pe.children.has(Pi)&&await YC(K.join(we,Pi),{contentsOnly:!1});let Ee=K.basename(we)===Pi&&v.has(K.join(K.dirname(we),K.sep));await YC(we,{contentsOnly:we===A,allowSymlink:Ee})}};for(let[we,Pe]of p){let g=v.get(we);for(let[Ee,De]of Pe.children){if(Ee===".")continue;let ce=g&&g.children.get(Ee),ne=K.join(we,Ee);await L(ne,De,ce)}}let U=async(we,Pe,g)=>{if(g){f1e(Pe.locator,g.locator)||await YC(we,{contentsOnly:Pe.linkType==="HARD"});for(let[Ee,De]of Pe.children){let ce=g.children.get(Ee);await U(K.join(we,Ee),De,ce)}}else{Pe.children.has(Pi)&&await YC(K.join(we,Pi),{contentsOnly:!0});let Ee=K.basename(we)===Pi&&v.has(K.join(K.dirname(we),K.sep));await YC(we,{contentsOnly:Pe.linkType==="HARD",allowSymlink:Ee})}};for(let[we,Pe]of v){let g=p.get(we);for(let[Ee,De]of Pe.children){if(Ee===".")continue;let ce=g&&g.children.get(Ee);await U(K.join(we,Ee),De,ce)}}let J=new Map,te=[];for(let[we,Pe]of E)for(let g of Pe){let{locationRoot:Ee,segments:De}=PQ(g,{skipPrefix:o.cwd}),ce=v.get(Ee),ne=Ee;if(ce){for(let ee of De)if(ne=K.join(ne,ee),ce=ce.children.get(ee),!ce)break;if(ce){let ee=f1e(ce.locator,we),Ie=e.get(ce.locator),ke=Ie.target,ht=ne,H=Ie.linkType;if(ee)J.has(ke)||J.set(ke,ht);else if(ke!==ht){let lt=W.parseLocator(ce.locator);W.isVirtualLocator(lt)&&(lt=W.devirtualizeLocator(lt)),te.push({srcDir:ke,dstDir:ht,linkType:H,realLocatorHash:lt.locatorHash})}}}}for(let[we,{locations:Pe}]of e.entries())for(let g of Pe){let{locationRoot:Ee,segments:De}=PQ(g,{skipPrefix:o.cwd}),ce=p.get(Ee),ne=v.get(Ee),ee=Ee,Ie=e.get(we),ke=W.parseLocator(we);W.isVirtualLocator(ke)&&(ke=W.devirtualizeLocator(ke));let ht=ke.locatorHash,H=Ie.target,lt=g;if(H===lt)continue;let Re=Ie.linkType;for(let Qe of De)ne=ne.children.get(Qe);if(!ce)te.push({srcDir:H,dstDir:lt,linkType:Re,realLocatorHash:ht});else for(let Qe of De)if(ee=K.join(ee,Qe),ce=ce.children.get(Qe),!ce){te.push({srcDir:H,dstDir:lt,linkType:Re,realLocatorHash:ht});break}}let le=Xs.progressViaCounter(te.length),pe=a.reportProgress(le),Ae=o.configuration.get("nmMode"),ye={value:Ae},ae=o.configuration.get("winLinkType");try{let we=ye.value==="hardlinks-global"?`${yq(o.configuration)}/v1`:null;if(we&&!await oe.existsPromise(we)){await oe.mkdirpPromise(we);for(let g=0;g<256;g++)await oe.mkdirPromise(K.join(we,g.toString(16).padStart(2,"0")))}for(let g of te)(g.linkType==="SOFT"||!J.has(g.srcDir))&&(J.set(g.srcDir,g.dstDir),await C({...g,globalHardlinksStore:we,nmMode:ye,windowsLinkType:ae,packageChecksum:u.get(g.realLocatorHash)||null}));await Promise.all(b),b.length=0;for(let g of te){let Ee=J.get(g.srcDir);g.linkType!=="SOFT"&&g.dstDir!==Ee&&await T(Ee,g.dstDir,{nmMode:ye})}await Promise.all(b),await oe.mkdirPromise(A,{recursive:!0});let Pe=await I1t(e,v,o.cwd,{loadManifest:n});await v1t(h,Pe,o.cwd,ae),await y1t(o,e,Pe,ye,{installChangedByUser:I}),Ae=="hardlinks-global"&&ye.value=="hardlinks-local"&&a.reportWarningOnce(74,"'nmMode' has been downgraded to 'hardlinks-local' due to global cache and install folder being on different devices")}finally{pe.stop()}}async function v1t(t,e,r,o){for(let a of t.keys()){if(K.contains(r,a)===null)throw new Error(`Assertion failed. Excepted bin symlink location to be inside project dir, instead it was at ${a}`);if(!e.has(a)){let n=K.join(a,Pi,DQ);await oe.removePromise(n)}}for(let[a,n]of e){if(K.contains(r,a)===null)throw new Error(`Assertion failed. Excepted bin symlink location to be inside project dir, instead it was at ${a}`);let u=K.join(a,Pi,DQ),A=t.get(a)||new Map;await oe.mkdirPromise(u,{recursive:!0});for(let p of A.keys())n.has(p)||(await oe.removePromise(K.join(u,p)),process.platform==="win32"&&await oe.removePromise(K.join(u,`${p}.cmd`)));for(let[p,h]of n){let E=A.get(p),I=K.join(u,p);E!==h&&(process.platform==="win32"?await(0,p1e.default)(ue.fromPortablePath(h),ue.fromPortablePath(I),{createPwshFile:!1}):(await oe.removePromise(I),await mq(h,I,o),K.contains(r,await oe.realpathPromise(h))!==null&&await oe.chmodPromise(h,493)))}}}Ye();Pt();nA();var cv=class extends P0{constructor(){super(...arguments);this.mode="loose"}makeInstaller(r){return new Eq(r)}},Eq=class extends dm{constructor(){super(...arguments);this.mode="loose"}async transformPnpSettings(r){let o=new mi({baseFs:new Jl({maxOpenFiles:80,readOnlyArchives:!0})}),a=$Ie(r,this.opts.project.cwd,o),{tree:n,errors:u}=JB(a,{pnpifyFs:!1,project:this.opts.project});if(!n){for(let{messageName:I,text:v}of u)this.opts.report.reportError(I,v);return}let A=new Map;r.fallbackPool=A;let p=(I,v)=>{let b=W.parseLocator(v.locator),C=W.stringifyIdent(b);C===I?A.set(I,b.reference):A.set(I,[C,b.reference])},h=K.join(this.opts.project.cwd,dr.nodeModules),E=n.get(h);if(!(typeof E>"u")){if("target"in E)throw new Error("Assertion failed: Expected the root junction point to be a directory");for(let I of E.dirList){let v=K.join(h,I),b=n.get(v);if(typeof b>"u")throw new Error("Assertion failed: Expected the child to have been registered");if("target"in b)p(I,b);else for(let C of b.dirList){let T=K.join(v,C),L=n.get(T);if(typeof L>"u")throw new Error("Assertion failed: Expected the subchild to have been registered");if("target"in L)p(`${I}/${C}`,L);else throw new Error("Assertion failed: Expected the leaf junction to be a package")}}}}};var D1t={hooks:{cleanGlobalArtifacts:async t=>{let e=yq(t);await oe.removePromise(e)}},configuration:{nmHoistingLimits:{description:"Prevents packages to be hoisted past specific levels",type:"STRING",values:["workspaces","dependencies","none"],default:"none"},nmMode:{description:"Defines in which measure Yarn must use hardlinks and symlinks when generated `node_modules` directories.",type:"STRING",values:["classic","hardlinks-local","hardlinks-global"],default:"classic"},nmSelfReferences:{description:"Defines whether the linker should generate self-referencing symlinks for workspaces.",type:"BOOLEAN",default:!0}},linkers:[lv,cv]},P1t=D1t;var EG={};Kt(EG,{NpmHttpFetcher:()=>fv,NpmRemapResolver:()=>pv,NpmSemverFetcher:()=>dl,NpmSemverResolver:()=>hv,NpmTagResolver:()=>gv,default:()=>Ovt,npmConfigUtils:()=>Zn,npmHttpUtils:()=>on,npmPublishUtils:()=>sw});Ye();var x1e=$e(zn());var Wn="npm:";var on={};Kt(on,{AuthType:()=>P1e,customPackageError:()=>mm,del:()=>N1t,get:()=>ym,getIdentUrl:()=>SQ,getPackageMetadata:()=>KC,handleInvalidAuthenticationError:()=>b0,post:()=>T1t,put:()=>R1t});Ye();Ye();Pt();var Bq=$e(A2()),v1e=$e(S_()),D1e=$e(zn()),vq=Be("url");var Zn={};Kt(Zn,{RegistryType:()=>w1e,getAuditRegistry:()=>S1t,getAuthConfiguration:()=>Iq,getDefaultRegistry:()=>uv,getPublishRegistry:()=>x1t,getRegistryConfiguration:()=>I1e,getScopeConfiguration:()=>wq,getScopeRegistry:()=>WC,normalizeRegistry:()=>oc});var w1e=(o=>(o.AUDIT_REGISTRY="npmAuditRegistry",o.FETCH_REGISTRY="npmRegistryServer",o.PUBLISH_REGISTRY="npmPublishRegistry",o))(w1e||{});function oc(t){return t.replace(/\/$/,"")}function S1t({configuration:t}){return uv({configuration:t,type:"npmAuditRegistry"})}function x1t(t,{configuration:e}){return t.publishConfig?.registry?oc(t.publishConfig.registry):t.name?WC(t.name.scope,{configuration:e,type:"npmPublishRegistry"}):uv({configuration:e,type:"npmPublishRegistry"})}function WC(t,{configuration:e,type:r="npmRegistryServer"}){let o=wq(t,{configuration:e});if(o===null)return uv({configuration:e,type:r});let a=o.get(r);return a===null?uv({configuration:e,type:r}):oc(a)}function uv({configuration:t,type:e="npmRegistryServer"}){let r=t.get(e);return oc(r!==null?r:t.get("npmRegistryServer"))}function I1e(t,{configuration:e}){let r=e.get("npmRegistries"),o=oc(t),a=r.get(o);if(typeof a<"u")return a;let n=r.get(o.replace(/^[a-z]+:/,""));return typeof n<"u"?n:null}function wq(t,{configuration:e}){if(t===null)return null;let o=e.get("npmScopes").get(t);return o||null}function Iq(t,{configuration:e,ident:r}){let o=r&&wq(r.scope,{configuration:e});return o?.get("npmAuthIdent")||o?.get("npmAuthToken")?o:I1e(t,{configuration:e})||e}var P1e=(a=>(a[a.NO_AUTH=0]="NO_AUTH",a[a.BEST_EFFORT=1]="BEST_EFFORT",a[a.CONFIGURATION=2]="CONFIGURATION",a[a.ALWAYS_AUTH=3]="ALWAYS_AUTH",a))(P1e||{});async function b0(t,{attemptedAs:e,registry:r,headers:o,configuration:a}){if(bQ(t))throw new zt(41,"Invalid OTP token");if(t.originalError?.name==="HTTPError"&&t.originalError?.response.statusCode===401)throw new zt(41,`Invalid authentication (${typeof e!="string"?`as ${await M1t(r,o,{configuration:a})}`:`attempted as ${e}`})`)}function mm(t,e){let r=t.response?.statusCode;return r?r===404?"Package not found":r>=500&&r<600?`The registry appears to be down (using a ${de.applyHyperlink(e,"local cache","https://yarnpkg.com/advanced/lexicon#local-cache")} might have protected you against such outages)`:null:null}function SQ(t){return t.scope?`/@${t.scope}%2f${t.name}`:`/${t.name}`}var B1e=new Map;async function KC(t,{cache:e,project:r,registry:o,headers:a,version:n,...u}){return await je.getFactoryWithDefault(B1e,t.identHash,async()=>{let{configuration:A}=r;o=Av(A,{ident:t,registry:o});let p=Q1t(A,o),h=K.join(p,`${W.slugifyIdent(t)}.json`),E=null;if(!r.lockfileNeedsRefresh){try{E=await oe.readJsonPromise(h)}catch{}if(E){if(typeof n<"u"&&typeof E.metadata.versions[n]<"u")return E.metadata;if(A.get("enableOfflineMode")){let I=structuredClone(E.metadata),v=new Set;if(e){for(let C of Object.keys(I.versions)){let T=W.makeLocator(t,`npm:${C}`),L=e.getLocatorMirrorPath(T);(!L||!oe.existsSync(L))&&(delete I.versions[C],v.add(C))}let b=I["dist-tags"].latest;if(v.has(b)){let C=Object.keys(E.metadata.versions).sort(D1e.default.compare),T=C.indexOf(b);for(;v.has(C[T])&&T>=0;)T-=1;T>=0?I["dist-tags"].latest=C[T]:delete I["dist-tags"].latest}}return I}}}return await ym(SQ(t),{...u,customErrorMessage:mm,configuration:A,registry:o,ident:t,headers:{...a,["If-None-Match"]:E?.etag,["If-Modified-Since"]:E?.lastModified},wrapNetworkRequest:async I=>async()=>{let v=await I();if(v.statusCode===304){if(E===null)throw new Error("Assertion failed: cachedMetadata should not be null");return{...v,body:E.metadata}}let b=b1t(JSON.parse(v.body.toString()));B1e.set(t.identHash,b);let C={metadata:b,etag:v.headers.etag,lastModified:v.headers["last-modified"]},T=`${h}-${process.pid}.tmp`;return await oe.mkdirPromise(p,{recursive:!0}),await oe.writeJsonPromise(T,C,{compact:!0}),await oe.renamePromise(T,h),{...v,body:b}}})})}var S1e=["name","dist.tarball","bin","scripts","os","cpu","libc","dependencies","dependenciesMeta","optionalDependencies","peerDependencies","peerDependenciesMeta","deprecated"];function b1t(t){return{"dist-tags":t["dist-tags"],versions:Object.fromEntries(Object.entries(t.versions).map(([e,r])=>[e,(0,v1e.default)(r,S1e)]))}}var k1t=wn.makeHash(...S1e).slice(0,6);function Q1t(t,e){let r=F1t(t),o=new vq.URL(e);return K.join(r,k1t,o.hostname)}function F1t(t){return K.join(t.get("globalFolder"),"metadata/npm")}async function ym(t,{configuration:e,headers:r,ident:o,authType:a,registry:n,...u}){n=Av(e,{ident:o,registry:n}),o&&o.scope&&typeof a>"u"&&(a=1);let A=await xQ(n,{authType:a,configuration:e,ident:o});A&&(r={...r,authorization:A});try{return await rn.get(t.charAt(0)==="/"?`${n}${t}`:t,{configuration:e,headers:r,...u})}catch(p){throw await b0(p,{registry:n,configuration:e,headers:r}),p}}async function T1t(t,e,{attemptedAs:r,configuration:o,headers:a,ident:n,authType:u=3,registry:A,otp:p,...h}){A=Av(o,{ident:n,registry:A});let E=await xQ(A,{authType:u,configuration:o,ident:n});E&&(a={...a,authorization:E}),p&&(a={...a,...VC(p)});try{return await rn.post(A+t,e,{configuration:o,headers:a,...h})}catch(I){if(!bQ(I)||p)throw await b0(I,{attemptedAs:r,registry:A,configuration:o,headers:a}),I;p=await Dq(I,{configuration:o});let v={...a,...VC(p)};try{return await rn.post(`${A}${t}`,e,{configuration:o,headers:v,...h})}catch(b){throw await b0(b,{attemptedAs:r,registry:A,configuration:o,headers:a}),b}}}async function R1t(t,e,{attemptedAs:r,configuration:o,headers:a,ident:n,authType:u=3,registry:A,otp:p,...h}){A=Av(o,{ident:n,registry:A});let E=await xQ(A,{authType:u,configuration:o,ident:n});E&&(a={...a,authorization:E}),p&&(a={...a,...VC(p)});try{return await rn.put(A+t,e,{configuration:o,headers:a,...h})}catch(I){if(!bQ(I))throw await b0(I,{attemptedAs:r,registry:A,configuration:o,headers:a}),I;p=await Dq(I,{configuration:o});let v={...a,...VC(p)};try{return await rn.put(`${A}${t}`,e,{configuration:o,headers:v,...h})}catch(b){throw await b0(b,{attemptedAs:r,registry:A,configuration:o,headers:a}),b}}}async function N1t(t,{attemptedAs:e,configuration:r,headers:o,ident:a,authType:n=3,registry:u,otp:A,...p}){u=Av(r,{ident:a,registry:u});let h=await xQ(u,{authType:n,configuration:r,ident:a});h&&(o={...o,authorization:h}),A&&(o={...o,...VC(A)});try{return await rn.del(u+t,{configuration:r,headers:o,...p})}catch(E){if(!bQ(E)||A)throw await b0(E,{attemptedAs:e,registry:u,configuration:r,headers:o}),E;A=await Dq(E,{configuration:r});let I={...o,...VC(A)};try{return await rn.del(`${u}${t}`,{configuration:r,headers:I,...p})}catch(v){throw await b0(v,{attemptedAs:e,registry:u,configuration:r,headers:o}),v}}}function Av(t,{ident:e,registry:r}){if(typeof r>"u"&&e)return WC(e.scope,{configuration:t});if(typeof r!="string")throw new Error("Assertion failed: The registry should be a string");return oc(r)}async function xQ(t,{authType:e=2,configuration:r,ident:o}){let a=Iq(t,{configuration:r,ident:o}),n=L1t(a,e);if(!n)return null;let u=await r.reduceHook(A=>A.getNpmAuthenticationHeader,void 0,t,{configuration:r,ident:o});if(u)return u;if(a.get("npmAuthToken"))return`Bearer ${a.get("npmAuthToken")}`;if(a.get("npmAuthIdent")){let A=a.get("npmAuthIdent");return A.includes(":")?`Basic ${Buffer.from(A).toString("base64")}`:`Basic ${A}`}if(n&&e!==1)throw new zt(33,"No authentication configured for request");return null}function L1t(t,e){switch(e){case 2:return t.get("npmAlwaysAuth");case 1:case 3:return!0;case 0:return!1;default:throw new Error("Unreachable")}}async function M1t(t,e,{configuration:r}){if(typeof e>"u"||typeof e.authorization>"u")return"an anonymous user";try{return(await rn.get(new vq.URL(`${t}/-/whoami`).href,{configuration:r,headers:e,jsonResponse:!0})).username??"an unknown user"}catch{return"an unknown user"}}async function Dq(t,{configuration:e}){let r=t.originalError?.response.headers["npm-notice"];if(r&&(await Nt.start({configuration:e,stdout:process.stdout,includeFooter:!1},async a=>{if(a.reportInfo(0,r.replace(/(https?:\/\/\S+)/g,de.pretty(e,"$1",de.Type.URL))),!process.env.YARN_IS_TEST_ENV){let n=r.match(/open (https?:\/\/\S+)/i);if(n&&Ji.openUrl){let{openNow:u}=await(0,Bq.prompt)({type:"confirm",name:"openNow",message:"Do you want to try to open this url now?",required:!0,initial:!0,onCancel:()=>process.exit(130)});u&&(await Ji.openUrl(n[1])||(a.reportSeparator(),a.reportWarning(0,"We failed to automatically open the url; you'll have to open it yourself in your browser of choice.")))}}}),process.stdout.write(` +`)),process.env.YARN_IS_TEST_ENV)return process.env.YARN_INJECT_NPM_2FA_TOKEN||"";let{otp:o}=await(0,Bq.prompt)({type:"password",name:"otp",message:"One-time password:",required:!0,onCancel:()=>process.exit(130)});return process.stdout.write(` +`),o}function bQ(t){if(t.originalError?.name!=="HTTPError")return!1;try{return(t.originalError?.response.headers["www-authenticate"].split(/,\s*/).map(r=>r.toLowerCase())).includes("otp")}catch{return!1}}function VC(t){return{["npm-otp"]:t}}var fv=class{supports(e,r){if(!e.reference.startsWith(Wn))return!1;let{selector:o,params:a}=W.parseRange(e.reference);return!(!x1e.default.valid(o)||a===null||typeof a.__archiveUrl!="string")}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${W.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote server`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:W.getIdentVendorPath(e),checksum:u}}async fetchFromNetwork(e,r){let{params:o}=W.parseRange(e.reference);if(o===null||typeof o.__archiveUrl!="string")throw new Error("Assertion failed: The archiveUrl querystring parameter should have been available");let a=await ym(o.__archiveUrl,{customErrorMessage:mm,configuration:r.project.configuration,ident:e});return await Xi.convertToZip(a,{configuration:r.project.configuration,prefixPath:W.getIdentVendorPath(e),stripComponents:1})}};Ye();var pv=class{supportsDescriptor(e,r){return!(!e.range.startsWith(Wn)||!W.tryParseDescriptor(e.range.slice(Wn.length),!0))}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Unreachable")}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){let o=r.project.configuration.normalizeDependency(W.parseDescriptor(e.range.slice(Wn.length),!0));return r.resolver.getResolutionDependencies(o,r)}async getCandidates(e,r,o){let a=o.project.configuration.normalizeDependency(W.parseDescriptor(e.range.slice(Wn.length),!0));return await o.resolver.getCandidates(a,r,o)}async getSatisfying(e,r,o,a){let n=a.project.configuration.normalizeDependency(W.parseDescriptor(e.range.slice(Wn.length),!0));return a.resolver.getSatisfying(n,r,o,a)}resolve(e,r){throw new Error("Unreachable")}};Ye();Ye();var b1e=$e(zn()),k1e=Be("url");var dl=class{supports(e,r){if(!e.reference.startsWith(Wn))return!1;let o=new k1e.URL(e.reference);return!(!b1e.default.valid(o.pathname)||o.searchParams.has("__archiveUrl"))}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${W.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the remote registry`),loader:()=>this.fetchFromNetwork(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:W.getIdentVendorPath(e),checksum:u}}async fetchFromNetwork(e,r){let o;try{o=await ym(dl.getLocatorUrl(e),{customErrorMessage:mm,configuration:r.project.configuration,ident:e})}catch{o=await ym(dl.getLocatorUrl(e).replace(/%2f/g,"/"),{customErrorMessage:mm,configuration:r.project.configuration,ident:e})}return await Xi.convertToZip(o,{configuration:r.project.configuration,prefixPath:W.getIdentVendorPath(e),stripComponents:1})}static isConventionalTarballUrl(e,r,{configuration:o}){let a=WC(e.scope,{configuration:o}),n=dl.getLocatorUrl(e);return r=r.replace(/^https?:(\/\/(?:[^/]+\.)?npmjs.org(?:$|\/))/,"https:$1"),a=a.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),r=r.replace(/^https:\/\/registry\.npmjs\.org($|\/)/,"https://registry.yarnpkg.com$1"),r===a+n||r===a+n.replace(/%2f/g,"/")}static getLocatorUrl(e){let r=kr.clean(e.reference.slice(Wn.length));if(r===null)throw new zt(10,"The npm semver resolver got selected, but the version isn't semver");return`${SQ(e)}/-/${e.name}-${r}.tgz`}};Ye();Ye();Ye();var Pq=$e(zn());var kQ=W.makeIdent(null,"node-gyp"),O1t=/\b(node-gyp|prebuild-install)\b/,hv=class{supportsDescriptor(e,r){return e.range.startsWith(Wn)?!!kr.validRange(e.range.slice(Wn.length)):!1}supportsLocator(e,r){if(!e.reference.startsWith(Wn))return!1;let{selector:o}=W.parseRange(e.reference);return!!Pq.default.valid(o)}shouldPersistResolution(e,r){return!0}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){let a=kr.validRange(e.range.slice(Wn.length));if(a===null)throw new Error(`Expected a valid range, got ${e.range.slice(Wn.length)}`);let n=await KC(e,{cache:o.fetchOptions?.cache,project:o.project,version:Pq.default.valid(a.raw)?a.raw:void 0}),u=je.mapAndFilter(Object.keys(n.versions),h=>{try{let E=new kr.SemVer(h);if(a.test(E))return E}catch{}return je.mapAndFilter.skip}),A=u.filter(h=>!n.versions[h.raw].deprecated),p=A.length>0?A:u;return p.sort((h,E)=>-h.compare(E)),p.map(h=>{let E=W.makeLocator(e,`${Wn}${h.raw}`),I=n.versions[h.raw].dist.tarball;return dl.isConventionalTarballUrl(E,I,{configuration:o.project.configuration})?E:W.bindLocator(E,{__archiveUrl:I})})}async getSatisfying(e,r,o,a){let n=kr.validRange(e.range.slice(Wn.length));if(n===null)throw new Error(`Expected a valid range, got ${e.range.slice(Wn.length)}`);return{locators:je.mapAndFilter(o,p=>{if(p.identHash!==e.identHash)return je.mapAndFilter.skip;let h=W.tryParseRange(p.reference,{requireProtocol:Wn});if(!h)return je.mapAndFilter.skip;let E=new kr.SemVer(h.selector);return n.test(E)?{locator:p,version:E}:je.mapAndFilter.skip}).sort((p,h)=>-p.version.compare(h.version)).map(({locator:p})=>p),sorted:!0}}async resolve(e,r){let{selector:o}=W.parseRange(e.reference),a=kr.clean(o);if(a===null)throw new zt(10,"The npm semver resolver got selected, but the version isn't semver");let n=await KC(e,{cache:r.fetchOptions?.cache,project:r.project,version:a});if(!Object.hasOwn(n,"versions"))throw new zt(15,'Registry returned invalid data for - missing "versions" field');if(!Object.hasOwn(n.versions,a))throw new zt(16,`Registry failed to return reference "${a}"`);let u=new Mt;if(u.load(n.versions[a]),!u.dependencies.has(kQ.identHash)&&!u.peerDependencies.has(kQ.identHash)){for(let A of u.scripts.values())if(A.match(O1t)){u.dependencies.set(kQ.identHash,W.makeDescriptor(kQ,"latest"));break}}return{...e,version:a,languageName:"node",linkType:"HARD",conditions:u.getConditions(),dependencies:r.project.configuration.normalizeDependencyMap(u.dependencies),peerDependencies:u.peerDependencies,dependenciesMeta:u.dependenciesMeta,peerDependenciesMeta:u.peerDependenciesMeta,bin:u.bin}}};Ye();Ye();var Q1e=$e(zn());var gv=class{supportsDescriptor(e,r){return!(!e.range.startsWith(Wn)||!QE.test(e.range.slice(Wn.length)))}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Unreachable")}bindDescriptor(e,r,o){return e}getResolutionDependencies(e,r){return{}}async getCandidates(e,r,o){let a=e.range.slice(Wn.length),n=await KC(e,{cache:o.fetchOptions?.cache,project:o.project});if(!Object.hasOwn(n,"dist-tags"))throw new zt(15,'Registry returned invalid data - missing "dist-tags" field');let u=n["dist-tags"];if(!Object.hasOwn(u,a))throw new zt(16,`Registry failed to return tag "${a}"`);let A=u[a],p=W.makeLocator(e,`${Wn}${A}`),h=n.versions[A].dist.tarball;return dl.isConventionalTarballUrl(p,h,{configuration:o.project.configuration})?[p]:[W.bindLocator(p,{__archiveUrl:h})]}async getSatisfying(e,r,o,a){let n=[];for(let u of o){if(u.identHash!==e.identHash)continue;let A=W.tryParseRange(u.reference,{requireProtocol:Wn});if(!(!A||!Q1e.default.valid(A.selector))){if(A.params?.__archiveUrl){let p=W.makeRange({protocol:Wn,selector:A.selector,source:null,params:null}),[h]=await a.resolver.getCandidates(W.makeDescriptor(e,p),r,a);if(u.reference!==h.reference)continue}n.push(u)}}return{locators:n,sorted:!1}}async resolve(e,r){throw new Error("Unreachable")}};var sw={};Kt(sw,{getGitHead:()=>Lvt,getPublishAccess:()=>wBe,getReadmeContent:()=>IBe,makePublishBody:()=>Nvt});Ye();Ye();Pt();var hG={};Kt(hG,{PackCommand:()=>O0,default:()=>mvt,packUtils:()=>CA});Ye();Ye();Ye();Pt();qt();var CA={};Kt(CA,{genPackList:()=>$Q,genPackStream:()=>pG,genPackageManifest:()=>lBe,hasPackScripts:()=>AG,prepareForPack:()=>fG});Ye();Pt();var uG=$e(Zo()),oBe=$e(rBe()),aBe=Be("zlib"),ovt=["/package.json","/readme","/readme.*","/license","/license.*","/licence","/licence.*","/changelog","/changelog.*"],avt=["/package.tgz",".github",".git",".hg","node_modules",".npmignore",".gitignore",".#*",".DS_Store"];async function AG(t){return!!(un.hasWorkspaceScript(t,"prepack")||un.hasWorkspaceScript(t,"postpack"))}async function fG(t,{report:e},r){await un.maybeExecuteWorkspaceLifecycleScript(t,"prepack",{report:e});try{let o=K.join(t.cwd,Mt.fileName);await oe.existsPromise(o)&&await t.manifest.loadFile(o,{baseFs:oe}),await r()}finally{await un.maybeExecuteWorkspaceLifecycleScript(t,"postpack",{report:e})}}async function pG(t,e){typeof e>"u"&&(e=await $Q(t));let r=new Set;for(let n of t.manifest.publishConfig?.executableFiles??new Set)r.add(K.normalize(n));for(let n of t.manifest.bin.values())r.add(K.normalize(n));let o=oBe.default.pack();process.nextTick(async()=>{for(let n of e){let u=K.normalize(n),A=K.resolve(t.cwd,u),p=K.join("package",u),h=await oe.lstatPromise(A),E={name:p,mtime:new Date(vi.SAFE_TIME*1e3)},I=r.has(u)?493:420,v,b,C=new Promise((L,U)=>{v=L,b=U}),T=L=>{L?b(L):v()};if(h.isFile()){let L;u==="package.json"?L=Buffer.from(JSON.stringify(await lBe(t),null,2)):L=await oe.readFilePromise(A),o.entry({...E,mode:I,type:"file"},L,T)}else h.isSymbolicLink()?o.entry({...E,mode:I,type:"symlink",linkname:await oe.readlinkPromise(A)},T):T(new Error(`Unsupported file type ${h.mode} for ${ue.fromPortablePath(u)}`));await C}o.finalize()});let a=(0,aBe.createGzip)();return o.pipe(a),a}async function lBe(t){let e=JSON.parse(JSON.stringify(t.manifest.raw));return await t.project.configuration.triggerHook(r=>r.beforeWorkspacePacking,t,e),e}async function $Q(t){let e=t.project,r=e.configuration,o={accept:[],reject:[]};for(let I of avt)o.reject.push(I);for(let I of ovt)o.accept.push(I);o.reject.push(r.get("rcFilename"));let a=I=>{if(I===null||!I.startsWith(`${t.cwd}/`))return;let v=K.relative(t.cwd,I),b=K.resolve(Bt.root,v);o.reject.push(b)};a(K.resolve(e.cwd,dr.lockfile)),a(r.get("cacheFolder")),a(r.get("globalFolder")),a(r.get("installStatePath")),a(r.get("virtualFolder")),a(r.get("yarnPath")),await r.triggerHook(I=>I.populateYarnPaths,e,I=>{a(I)});for(let I of e.workspaces){let v=K.relative(t.cwd,I.cwd);v!==""&&!v.match(/^(\.\.)?\//)&&o.reject.push(`/${v}`)}let n={accept:[],reject:[]},u=t.manifest.publishConfig?.main??t.manifest.main,A=t.manifest.publishConfig?.module??t.manifest.module,p=t.manifest.publishConfig?.browser??t.manifest.browser,h=t.manifest.publishConfig?.bin??t.manifest.bin;u!=null&&n.accept.push(K.resolve(Bt.root,u)),A!=null&&n.accept.push(K.resolve(Bt.root,A)),typeof p=="string"&&n.accept.push(K.resolve(Bt.root,p));for(let I of h.values())n.accept.push(K.resolve(Bt.root,I));if(p instanceof Map)for(let[I,v]of p.entries())n.accept.push(K.resolve(Bt.root,I)),typeof v=="string"&&n.accept.push(K.resolve(Bt.root,v));let E=t.manifest.files!==null;if(E){n.reject.push("/*");for(let I of t.manifest.files)cBe(n.accept,I,{cwd:Bt.root})}return await lvt(t.cwd,{hasExplicitFileList:E,globalList:o,ignoreList:n})}async function lvt(t,{hasExplicitFileList:e,globalList:r,ignoreList:o}){let a=[],n=new _u(t),u=[[Bt.root,[o]]];for(;u.length>0;){let[A,p]=u.pop(),h=await n.lstatPromise(A);if(!iBe(A,{globalList:r,ignoreLists:h.isDirectory()?null:p}))if(h.isDirectory()){let E=await n.readdirPromise(A),I=!1,v=!1;if(!e||A!==Bt.root)for(let T of E)I=I||T===".gitignore",v=v||T===".npmignore";let b=v?await nBe(n,A,".npmignore"):I?await nBe(n,A,".gitignore"):null,C=b!==null?[b].concat(p):p;iBe(A,{globalList:r,ignoreLists:p})&&(C=[...p,{accept:[],reject:["**/*"]}]);for(let T of E)u.push([K.resolve(A,T),C])}else(h.isFile()||h.isSymbolicLink())&&a.push(K.relative(Bt.root,A))}return a.sort()}async function nBe(t,e,r){let o={accept:[],reject:[]},a=await t.readFilePromise(K.join(e,r),"utf8");for(let n of a.split(/\n/g))cBe(o.reject,n,{cwd:e});return o}function cvt(t,{cwd:e}){let r=t[0]==="!";return r&&(t=t.slice(1)),t.match(/\.{0,1}\//)&&(t=K.resolve(e,t)),r&&(t=`!${t}`),t}function cBe(t,e,{cwd:r}){let o=e.trim();o===""||o[0]==="#"||t.push(cvt(o,{cwd:r}))}function iBe(t,{globalList:e,ignoreLists:r}){let o=ZQ(t,e.accept);if(o!==0)return o===2;let a=ZQ(t,e.reject);if(a!==0)return a===1;if(r!==null)for(let n of r){let u=ZQ(t,n.accept);if(u!==0)return u===2;let A=ZQ(t,n.reject);if(A!==0)return A===1}return!1}function ZQ(t,e){let r=e,o=[];for(let a=0;a{await fG(a,{report:p},async()=>{p.reportJson({base:ue.fromPortablePath(a.cwd)});let h=await $Q(a);for(let E of h)p.reportInfo(null,ue.fromPortablePath(E)),p.reportJson({location:ue.fromPortablePath(E)});if(!this.dryRun){let E=await pG(a,h),I=oe.createWriteStream(u);E.pipe(I),await new Promise(v=>{I.on("finish",v)})}}),this.dryRun||(p.reportInfo(0,`Package archive generated in ${de.pretty(r,u,de.Type.PATH)}`),p.reportJson({output:ue.fromPortablePath(u)}))})).exitCode()}};O0.paths=[["pack"]],O0.usage=nt.Usage({description:"generate a tarball from the active workspace",details:"\n This command will turn the active workspace into a compressed archive suitable for publishing. The archive will by default be stored at the root of the workspace (`package.tgz`).\n\n If the `-o,---out` is set the archive will be created at the specified path. The `%s` and `%v` variables can be used within the path and will be respectively replaced by the package name and version.\n ",examples:[["Create an archive from the active workspace","yarn pack"],["List the files that would be made part of the workspace's archive","yarn pack --dry-run"],["Name and output the archive in a dedicated folder","yarn pack --out /artifacts/%s-%v.tgz"]]});function uvt(t,{workspace:e}){let r=t.replace("%s",Avt(e)).replace("%v",fvt(e));return ue.toPortablePath(r)}function Avt(t){return t.manifest.name!==null?W.slugifyIdent(t.manifest.name):"package"}function fvt(t){return t.manifest.version!==null?t.manifest.version:"unknown"}var pvt=["dependencies","devDependencies","peerDependencies"],hvt="workspace:",gvt=(t,e)=>{e.publishConfig&&(e.publishConfig.type&&(e.type=e.publishConfig.type),e.publishConfig.main&&(e.main=e.publishConfig.main),e.publishConfig.browser&&(e.browser=e.publishConfig.browser),e.publishConfig.module&&(e.module=e.publishConfig.module),e.publishConfig.exports&&(e.exports=e.publishConfig.exports),e.publishConfig.imports&&(e.imports=e.publishConfig.imports),e.publishConfig.bin&&(e.bin=e.publishConfig.bin));let r=t.project;for(let o of pvt)for(let a of t.manifest.getForScope(o).values()){let n=r.tryWorkspaceByDescriptor(a),u=W.parseRange(a.range);if(u.protocol===hvt)if(n===null){if(r.tryWorkspaceByIdent(a)===null)throw new zt(21,`${W.prettyDescriptor(r.configuration,a)}: No local workspace found for this range`)}else{let A;W.areDescriptorsEqual(a,n.anchoredDescriptor)||u.selector==="*"?A=n.manifest.version??"0.0.0":u.selector==="~"||u.selector==="^"?A=`${u.selector}${n.manifest.version??"0.0.0"}`:A=u.selector;let p=o==="dependencies"?W.makeDescriptor(a,"unknown"):null,h=p!==null&&t.manifest.ensureDependencyMeta(p).optional?"optionalDependencies":o;e[h][W.stringifyIdent(a)]=A}}},dvt={hooks:{beforeWorkspacePacking:gvt},commands:[O0]},mvt=dvt;var yBe=Be("crypto"),EBe=$e(mBe()),CBe=Be("url");async function Nvt(t,e,{access:r,tag:o,registry:a,gitHead:n}){let u=t.manifest.name,A=t.manifest.version,p=W.stringifyIdent(u),h=(0,yBe.createHash)("sha1").update(e).digest("hex"),E=EBe.default.fromData(e).toString(),I=r??wBe(t,u),v=await IBe(t),b=await CA.genPackageManifest(t),C=`${p}-${A}.tgz`,T=new CBe.URL(`${oc(a)}/${p}/-/${C}`);return{_id:p,_attachments:{[C]:{content_type:"application/octet-stream",data:e.toString("base64"),length:e.length}},name:p,access:I,["dist-tags"]:{[o]:A},versions:{[A]:{...b,_id:`${p}@${A}`,name:p,version:A,gitHead:n,dist:{shasum:h,integrity:E,tarball:T.toString()}}},readme:v}}async function Lvt(t){try{let{stdout:e}=await Ur.execvp("git",["rev-parse","--revs-only","HEAD"],{cwd:t});return e.trim()===""?void 0:e.trim()}catch{return}}function wBe(t,e){let r=t.project.configuration;return t.manifest.publishConfig&&typeof t.manifest.publishConfig.access=="string"?t.manifest.publishConfig.access:r.get("npmPublishAccess")!==null?r.get("npmPublishAccess"):e.scope?"restricted":"public"}async function IBe(t){let e=ue.toPortablePath(`${t.cwd}/README.md`),r=t.manifest.name,a=`# ${W.stringifyIdent(r)} +`;try{a=await oe.readFilePromise(e,"utf8")}catch(n){if(n.code==="ENOENT")return a;throw n}return a}var yG={npmAlwaysAuth:{description:"URL of the selected npm registry (note: npm enterprise isn't supported)",type:"BOOLEAN",default:!1},npmAuthIdent:{description:"Authentication identity for the npm registry (_auth in npm and yarn v1)",type:"SECRET",default:null},npmAuthToken:{description:"Authentication token for the npm registry (_authToken in npm and yarn v1)",type:"SECRET",default:null}},BBe={npmAuditRegistry:{description:"Registry to query for audit reports",type:"STRING",default:null},npmPublishRegistry:{description:"Registry to push packages to",type:"STRING",default:null},npmRegistryServer:{description:"URL of the selected npm registry (note: npm enterprise isn't supported)",type:"STRING",default:"https://registry.yarnpkg.com"}},Mvt={configuration:{...yG,...BBe,npmScopes:{description:"Settings per package scope",type:"MAP",valueDefinition:{description:"",type:"SHAPE",properties:{...yG,...BBe}}},npmRegistries:{description:"Settings per registry",type:"MAP",normalizeKeys:oc,valueDefinition:{description:"",type:"SHAPE",properties:{...yG}}}},fetchers:[fv,dl],resolvers:[pv,hv,gv]},Ovt=Mvt;var xG={};Kt(xG,{NpmAuditCommand:()=>_0,NpmInfoCommand:()=>H0,NpmLoginCommand:()=>j0,NpmLogoutCommand:()=>q0,NpmPublishCommand:()=>G0,NpmTagAddCommand:()=>W0,NpmTagListCommand:()=>Y0,NpmTagRemoveCommand:()=>V0,NpmWhoamiCommand:()=>K0,default:()=>Gvt,npmAuditTypes:()=>Tv,npmAuditUtils:()=>eF});Ye();Ye();qt();var vG=$e(Zo());Za();var Tv={};Kt(Tv,{Environment:()=>Qv,Severity:()=>Fv});var Qv=(o=>(o.All="all",o.Production="production",o.Development="development",o))(Qv||{}),Fv=(n=>(n.Info="info",n.Low="low",n.Moderate="moderate",n.High="high",n.Critical="critical",n))(Fv||{});var eF={};Kt(eF,{allSeverities:()=>ow,getPackages:()=>BG,getReportTree:()=>wG,getSeverityInclusions:()=>CG,getTopLevelDependencies:()=>IG});Ye();var vBe=$e(zn());var ow=["info","low","moderate","high","critical"];function CG(t){if(typeof t>"u")return new Set(ow);let e=ow.indexOf(t),r=ow.slice(e);return new Set(r)}function wG(t){let e={},r={children:e};for(let[o,a]of je.sortMap(Object.entries(t),n=>n[0]))for(let n of je.sortMap(a,u=>`${u.id}`))e[`${o}/${n.id}`]={value:de.tuple(de.Type.IDENT,W.parseIdent(o)),children:{ID:typeof n.id<"u"&&{label:"ID",value:de.tuple(de.Type.ID,n.id)},Issue:{label:"Issue",value:de.tuple(de.Type.NO_HINT,n.title)},URL:typeof n.url<"u"&&{label:"URL",value:de.tuple(de.Type.URL,n.url)},Severity:{label:"Severity",value:de.tuple(de.Type.NO_HINT,n.severity)},["Vulnerable Versions"]:{label:"Vulnerable Versions",value:de.tuple(de.Type.RANGE,n.vulnerable_versions)},["Tree Versions"]:{label:"Tree Versions",children:[...n.versions].sort(vBe.default.compare).map(u=>({value:de.tuple(de.Type.REFERENCE,u)}))},Dependents:{label:"Dependents",children:je.sortMap(n.dependents,u=>W.stringifyLocator(u)).map(u=>({value:de.tuple(de.Type.LOCATOR,u)}))}}};return r}function IG(t,e,{all:r,environment:o}){let a=[],n=r?t.workspaces:[e],u=["all","production"].includes(o),A=["all","development"].includes(o);for(let p of n)for(let h of p.anchoredPackage.dependencies.values())(p.manifest.devDependencies.has(h.identHash)?!A:!u)||a.push({workspace:p,dependency:h});return a}function BG(t,e,{recursive:r}){let o=new Map,a=new Set,n=[],u=(A,p)=>{let h=t.storedResolutions.get(p.descriptorHash);if(typeof h>"u")throw new Error("Assertion failed: The resolution should have been registered");if(!a.has(h))a.add(h);else return;let E=t.storedPackages.get(h);if(typeof E>"u")throw new Error("Assertion failed: The package should have been registered");if(W.ensureDevirtualizedLocator(E).reference.startsWith("npm:")&&E.version!==null){let v=W.stringifyIdent(E),b=je.getMapWithDefault(o,v);je.getArrayWithDefault(b,E.version).push(A)}if(r)for(let v of E.dependencies.values())n.push([E,v])};for(let{workspace:A,dependency:p}of e)n.push([A.anchoredLocator,p]);for(;n.length>0;){let[A,p]=n.shift();u(A,p)}return o}var _0=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("-A,--all",!1,{description:"Audit dependencies from all workspaces"});this.recursive=ge.Boolean("-R,--recursive",!1,{description:"Audit transitive dependencies as well"});this.environment=ge.String("--environment","all",{description:"Which environments to cover",validator:Vs(Qv)});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.noDeprecations=ge.Boolean("--no-deprecations",!1,{description:"Don't warn about deprecated packages"});this.severity=ge.String("--severity","info",{description:"Minimal severity requested for packages to be displayed",validator:Vs(Fv)});this.excludes=ge.Array("--exclude",[],{description:"Array of glob patterns of packages to exclude from audit"});this.ignores=ge.Array("--ignore",[],{description:"Array of glob patterns of advisory ID's to ignore in the audit report"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd);if(!a)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState();let n=IG(o,a,{all:this.all,environment:this.environment}),u=BG(o,n,{recursive:this.recursive}),A=Array.from(new Set([...r.get("npmAuditExcludePackages"),...this.excludes])),p=Object.create(null);for(let[L,U]of u)A.some(J=>vG.default.isMatch(L,J))||(p[L]=[...U.keys()]);let h=Zn.getAuditRegistry({configuration:r}),E,I=await AA.start({configuration:r,stdout:this.context.stdout},async()=>{let L=on.post("/-/npm/v1/security/advisories/bulk",p,{authType:on.AuthType.BEST_EFFORT,configuration:r,jsonResponse:!0,registry:h}),U=this.noDeprecations?[]:await Promise.all(Array.from(Object.entries(p),async([te,le])=>{let pe=await on.getPackageMetadata(W.parseIdent(te),{project:o});return je.mapAndFilter(le,Ae=>{let{deprecated:ye}=pe.versions[Ae];return ye?[te,Ae,ye]:je.mapAndFilter.skip})})),J=await L;for(let[te,le,pe]of U.flat(1))Object.hasOwn(J,te)&&J[te].some(Ae=>kr.satisfiesWithPrereleases(le,Ae.vulnerable_versions))||(J[te]??=[],J[te].push({id:`${te} (deprecation)`,title:pe.trim()||"This package has been deprecated.",severity:"moderate",vulnerable_versions:le}));E=J});if(I.hasErrors())return I.exitCode();let v=CG(this.severity),b=Array.from(new Set([...r.get("npmAuditIgnoreAdvisories"),...this.ignores])),C=Object.create(null);for(let[L,U]of Object.entries(E)){let J=U.filter(te=>!vG.default.isMatch(`${te.id}`,b)&&v.has(te.severity));J.length>0&&(C[L]=J.map(te=>{let le=u.get(L);if(typeof le>"u")throw new Error("Assertion failed: Expected the registry to only return packages that were requested");let pe=[...le.keys()].filter(ye=>kr.satisfiesWithPrereleases(ye,te.vulnerable_versions)),Ae=new Map;for(let ye of pe)for(let ae of le.get(ye))Ae.set(ae.locatorHash,ae);return{...te,versions:pe,dependents:[...Ae.values()]}}))}let T=Object.keys(C).length>0;return T?($s.emitTree(wG(C),{configuration:r,json:this.json,stdout:this.context.stdout,separators:2}),1):(await Nt.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async L=>{L.reportInfo(1,"No audit suggestions")}),T?1:0)}};_0.paths=[["npm","audit"]],_0.usage=nt.Usage({description:"perform a vulnerability audit against the installed packages",details:` + This command checks for known security reports on the packages you use. The reports are by default extracted from the npm registry, and may or may not be relevant to your actual program (not all vulnerabilities affect all code paths). + + For consistency with our other commands the default is to only check the direct dependencies for the active workspace. To extend this search to all workspaces, use \`-A,--all\`. To extend this search to both direct and transitive dependencies, use \`-R,--recursive\`. + + Applying the \`--severity\` flag will limit the audit table to vulnerabilities of the corresponding severity and above. Valid values are ${ow.map(r=>`\`${r}\``).join(", ")}. + + If the \`--json\` flag is set, Yarn will print the output exactly as received from the registry. Regardless of this flag, the process will exit with a non-zero exit code if a report is found for the selected packages. + + If certain packages produce false positives for a particular environment, the \`--exclude\` flag can be used to exclude any number of packages from the audit. This can also be set in the configuration file with the \`npmAuditExcludePackages\` option. + + If particular advisories are needed to be ignored, the \`--ignore\` flag can be used with Advisory ID's to ignore any number of advisories in the audit report. This can also be set in the configuration file with the \`npmAuditIgnoreAdvisories\` option. + + To understand the dependency tree requiring vulnerable packages, check the raw report with the \`--json\` flag or use \`yarn why package\` to get more information as to who depends on them. + `,examples:[["Checks for known security issues with the installed packages. The output is a list of known issues.","yarn npm audit"],["Audit dependencies in all workspaces","yarn npm audit --all"],["Limit auditing to `dependencies` (excludes `devDependencies`)","yarn npm audit --environment production"],["Show audit report as valid JSON","yarn npm audit --json"],["Audit all direct and transitive dependencies","yarn npm audit --recursive"],["Output moderate (or more severe) vulnerabilities","yarn npm audit --severity moderate"],["Exclude certain packages","yarn npm audit --exclude package1 --exclude package2"],["Ignore specific advisories","yarn npm audit --ignore 1234567 --ignore 7654321"]]});Ye();Ye();Pt();qt();var DG=$e(zn()),PG=Be("util"),H0=class extends ut{constructor(){super(...arguments);this.fields=ge.String("-f,--fields",{description:"A comma-separated list of manifest fields that should be displayed"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.packages=ge.Rest()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o}=await St.find(r,this.context.cwd),a=typeof this.fields<"u"?new Set(["name",...this.fields.split(/\s*,\s*/)]):null,n=[],u=!1,A=await Nt.start({configuration:r,includeFooter:!1,json:this.json,stdout:this.context.stdout},async p=>{for(let h of this.packages){let E;if(h==="."){let le=o.topLevelWorkspace;if(!le.manifest.name)throw new it(`Missing ${de.pretty(r,"name",de.Type.CODE)} field in ${ue.fromPortablePath(K.join(le.cwd,dr.manifest))}`);E=W.makeDescriptor(le.manifest.name,"unknown")}else E=W.parseDescriptor(h);let I=on.getIdentUrl(E),v=SG(await on.get(I,{configuration:r,ident:E,jsonResponse:!0,customErrorMessage:on.customPackageError})),b=Object.keys(v.versions).sort(DG.default.compareLoose),T=v["dist-tags"].latest||b[b.length-1],L=kr.validRange(E.range);if(L){let le=DG.default.maxSatisfying(b,L);le!==null?T=le:(p.reportWarning(0,`Unmet range ${W.prettyRange(r,E.range)}; falling back to the latest version`),u=!0)}else Object.hasOwn(v["dist-tags"],E.range)?T=v["dist-tags"][E.range]:E.range!=="unknown"&&(p.reportWarning(0,`Unknown tag ${W.prettyRange(r,E.range)}; falling back to the latest version`),u=!0);let U=v.versions[T],J={...v,...U,version:T,versions:b},te;if(a!==null){te={};for(let le of a){let pe=J[le];if(typeof pe<"u")te[le]=pe;else{p.reportWarning(1,`The ${de.pretty(r,le,de.Type.CODE)} field doesn't exist inside ${W.prettyIdent(r,E)}'s information`),u=!0;continue}}}else this.json||(delete J.dist,delete J.readme,delete J.users),te=J;p.reportJson(te),this.json||n.push(te)}});PG.inspect.styles.name="cyan";for(let p of n)(p!==n[0]||u)&&this.context.stdout.write(` +`),this.context.stdout.write(`${(0,PG.inspect)(p,{depth:1/0,colors:!0,compact:!1})} +`);return A.exitCode()}};H0.paths=[["npm","info"]],H0.usage=nt.Usage({category:"Npm-related commands",description:"show information about a package",details:"\n This command fetches information about a package from the npm registry and prints it in a tree format.\n\n The package does not have to be installed locally, but needs to have been published (in particular, local changes will be ignored even for workspaces).\n\n Append `@` to the package argument to provide information specific to the latest version that satisfies the range or to the corresponding tagged version. If the range is invalid or if there is no version satisfying the range, the command will print a warning and fall back to the latest version.\n\n If the `-f,--fields` option is set, it's a comma-separated list of fields which will be used to only display part of the package information.\n\n By default, this command won't return the `dist`, `readme`, and `users` fields, since they are often very long. To explicitly request those fields, explicitly list them with the `--fields` flag or request the output in JSON mode.\n ",examples:[["Show all available information about react (except the `dist`, `readme`, and `users` fields)","yarn npm info react"],["Show all available information about react as valid JSON (including the `dist`, `readme`, and `users` fields)","yarn npm info react --json"],["Show all available information about react@16.12.0","yarn npm info react@16.12.0"],["Show all available information about react@next","yarn npm info react@next"],["Show the description of react","yarn npm info react --fields description"],["Show all available versions of react","yarn npm info react --fields versions"],["Show the readme of react","yarn npm info react --fields readme"],["Show a few fields of react","yarn npm info react --fields homepage,repository"]]});function SG(t){if(Array.isArray(t)){let e=[];for(let r of t)r=SG(r),r&&e.push(r);return e}else if(typeof t=="object"&&t!==null){let e={};for(let r of Object.keys(t)){if(r.startsWith("_"))continue;let o=SG(t[r]);o&&(e[r]=o)}return e}else return t||null}Ye();Ye();qt();var DBe=$e(A2()),j0=class extends ut{constructor(){super(...arguments);this.scope=ge.String("-s,--scope",{description:"Login to the registry configured for a given scope"});this.publish=ge.Boolean("--publish",!1,{description:"Login to the publish registry"});this.alwaysAuth=ge.Boolean("--always-auth",{description:"Set the npmAlwaysAuth configuration"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),o=await tF({configuration:r,cwd:this.context.cwd,publish:this.publish,scope:this.scope});return(await Nt.start({configuration:r,stdout:this.context.stdout,includeFooter:!1},async n=>{let u=await _vt({configuration:r,registry:o,report:n,stdin:this.context.stdin,stdout:this.context.stdout}),A=`/-/user/org.couchdb.user:${encodeURIComponent(u.name)}`,p=await on.put(A,u,{attemptedAs:u.name,configuration:r,registry:o,jsonResponse:!0,authType:on.AuthType.NO_AUTH});return await Uvt(o,p.token,{alwaysAuth:this.alwaysAuth,scope:this.scope}),n.reportInfo(0,"Successfully logged in")})).exitCode()}};j0.paths=[["npm","login"]],j0.usage=nt.Usage({category:"Npm-related commands",description:"store new login info to access the npm registry",details:"\n This command will ask you for your username, password, and 2FA One-Time-Password (when it applies). It will then modify your local configuration (in your home folder, never in the project itself) to reference the new tokens thus generated.\n\n Adding the `-s,--scope` flag will cause the authentication to be done against whatever registry is configured for the associated scope (see also `npmScopes`).\n\n Adding the `--publish` flag will cause the authentication to be done against the registry used when publishing the package (see also `publishConfig.registry` and `npmPublishRegistry`).\n ",examples:[["Login to the default registry","yarn npm login"],["Login to the registry linked to the @my-scope registry","yarn npm login --scope my-scope"],["Login to the publish registry for the current package","yarn npm login --publish"]]});async function tF({scope:t,publish:e,configuration:r,cwd:o}){return t&&e?Zn.getScopeRegistry(t,{configuration:r,type:Zn.RegistryType.PUBLISH_REGISTRY}):t?Zn.getScopeRegistry(t,{configuration:r}):e?Zn.getPublishRegistry((await AC(r,o)).manifest,{configuration:r}):Zn.getDefaultRegistry({configuration:r})}async function Uvt(t,e,{alwaysAuth:r,scope:o}){let a=u=>A=>{let p=je.isIndexableObject(A)?A:{},h=p[u],E=je.isIndexableObject(h)?h:{};return{...p,[u]:{...E,...r!==void 0?{npmAlwaysAuth:r}:{},npmAuthToken:e}}},n=o?{npmScopes:a(o)}:{npmRegistries:a(t)};return await Ve.updateHomeConfiguration(n)}async function _vt({configuration:t,registry:e,report:r,stdin:o,stdout:a}){r.reportInfo(0,`Logging in to ${de.pretty(t,e,de.Type.URL)}`);let n=!1;if(e.match(/^https:\/\/npm\.pkg\.github\.com(\/|$)/)&&(r.reportInfo(0,"You seem to be using the GitHub Package Registry. Tokens must be generated with the 'repo', 'write:packages', and 'read:packages' permissions."),n=!0),r.reportSeparator(),t.env.YARN_IS_TEST_ENV)return{name:t.env.YARN_INJECT_NPM_USER||"",password:t.env.YARN_INJECT_NPM_PASSWORD||""};let{username:u,password:A}=await(0,DBe.prompt)([{type:"input",name:"username",message:"Username:",required:!0,onCancel:()=>process.exit(130),stdin:o,stdout:a},{type:"password",name:"password",message:n?"Token:":"Password:",required:!0,onCancel:()=>process.exit(130),stdin:o,stdout:a}]);return r.reportSeparator(),{name:u,password:A}}Ye();Ye();qt();var aw=new Set(["npmAuthIdent","npmAuthToken"]),q0=class extends ut{constructor(){super(...arguments);this.scope=ge.String("-s,--scope",{description:"Logout of the registry configured for a given scope"});this.publish=ge.Boolean("--publish",!1,{description:"Logout of the publish registry"});this.all=ge.Boolean("-A,--all",!1,{description:"Logout of all registries"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),o=async()=>{let n=await tF({configuration:r,cwd:this.context.cwd,publish:this.publish,scope:this.scope}),u=await Ve.find(this.context.cwd,this.context.plugins),A=W.makeIdent(this.scope??null,"pkg");return!Zn.getAuthConfiguration(n,{configuration:u,ident:A}).get("npmAuthToken")};return(await Nt.start({configuration:r,stdout:this.context.stdout},async n=>{if(this.all&&(await jvt(),n.reportInfo(0,"Successfully logged out from everything")),this.scope){await PBe("npmScopes",this.scope),await o()?n.reportInfo(0,`Successfully logged out from ${this.scope}`):n.reportWarning(0,"Scope authentication settings removed, but some other ones settings still apply to it");return}let u=await tF({configuration:r,cwd:this.context.cwd,publish:this.publish});await PBe("npmRegistries",u),await o()?n.reportInfo(0,`Successfully logged out from ${u}`):n.reportWarning(0,"Registry authentication settings removed, but some other ones settings still apply to it")})).exitCode()}};q0.paths=[["npm","logout"]],q0.usage=nt.Usage({category:"Npm-related commands",description:"logout of the npm registry",details:"\n This command will log you out by modifying your local configuration (in your home folder, never in the project itself) to delete all credentials linked to a registry.\n\n Adding the `-s,--scope` flag will cause the deletion to be done against whatever registry is configured for the associated scope (see also `npmScopes`).\n\n Adding the `--publish` flag will cause the deletion to be done against the registry used when publishing the package (see also `publishConfig.registry` and `npmPublishRegistry`).\n\n Adding the `-A,--all` flag will cause the deletion to be done against all registries and scopes.\n ",examples:[["Logout of the default registry","yarn npm logout"],["Logout of the @my-scope scope","yarn npm logout --scope my-scope"],["Logout of the publish registry for the current package","yarn npm logout --publish"],["Logout of all registries","yarn npm logout --all"]]});function Hvt(t,e){let r=t[e];if(!je.isIndexableObject(r))return!1;let o=new Set(Object.keys(r));if([...aw].every(n=>!o.has(n)))return!1;for(let n of aw)o.delete(n);if(o.size===0)return t[e]=void 0,!0;let a={...r};for(let n of aw)delete a[n];return t[e]=a,!0}async function jvt(){let t=e=>{let r=!1,o=je.isIndexableObject(e)?{...e}:{};o.npmAuthToken&&(delete o.npmAuthToken,r=!0);for(let a of Object.keys(o))Hvt(o,a)&&(r=!0);if(Object.keys(o).length!==0)return r?o:e};return await Ve.updateHomeConfiguration({npmRegistries:t,npmScopes:t})}async function PBe(t,e){return await Ve.updateHomeConfiguration({[t]:r=>{let o=je.isIndexableObject(r)?r:{};if(!Object.hasOwn(o,e))return r;let a=o[e],n=je.isIndexableObject(a)?a:{},u=new Set(Object.keys(n));if([...aw].every(p=>!u.has(p)))return r;for(let p of aw)u.delete(p);if(u.size===0)return Object.keys(o).length===1?void 0:{...o,[e]:void 0};let A={};for(let p of aw)A[p]=void 0;return{...o,[e]:{...n,...A}}}})}Ye();qt();var G0=class extends ut{constructor(){super(...arguments);this.access=ge.String("--access",{description:"The access for the published package (public or restricted)"});this.tag=ge.String("--tag","latest",{description:"The tag on the registry that the package should be attached to"});this.tolerateRepublish=ge.Boolean("--tolerate-republish",!1,{description:"Warn and exit when republishing an already existing version of a package"});this.otp=ge.String("--otp",{description:"The OTP token to use with the command"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd);if(!a)throw new rr(o.cwd,this.context.cwd);if(a.manifest.private)throw new it("Private workspaces cannot be published");if(a.manifest.name===null||a.manifest.version===null)throw new it("Workspaces must have valid names and versions to be published on an external registry");await o.restoreInstallState();let n=a.manifest.name,u=a.manifest.version,A=Zn.getPublishRegistry(a.manifest,{configuration:r});return(await Nt.start({configuration:r,stdout:this.context.stdout},async h=>{if(this.tolerateRepublish)try{let E=await on.get(on.getIdentUrl(n),{configuration:r,registry:A,ident:n,jsonResponse:!0});if(!Object.hasOwn(E,"versions"))throw new zt(15,'Registry returned invalid data for - missing "versions" field');if(Object.hasOwn(E.versions,u)){h.reportWarning(0,`Registry already knows about version ${u}; skipping.`);return}}catch(E){if(E.originalError?.response?.statusCode!==404)throw E}await un.maybeExecuteWorkspaceLifecycleScript(a,"prepublish",{report:h}),await CA.prepareForPack(a,{report:h},async()=>{let E=await CA.genPackList(a);for(let T of E)h.reportInfo(null,T);let I=await CA.genPackStream(a,E),v=await je.bufferStream(I),b=await sw.getGitHead(a.cwd),C=await sw.makePublishBody(a,v,{access:this.access,tag:this.tag,registry:A,gitHead:b});await on.put(on.getIdentUrl(n),C,{configuration:r,registry:A,ident:n,otp:this.otp,jsonResponse:!0})}),h.reportInfo(0,"Package archive published")})).exitCode()}};G0.paths=[["npm","publish"]],G0.usage=nt.Usage({category:"Npm-related commands",description:"publish the active workspace to the npm registry",details:'\n This command will pack the active workspace into a fresh archive and upload it to the npm registry.\n\n The package will by default be attached to the `latest` tag on the registry, but this behavior can be overriden by using the `--tag` option.\n\n Note that for legacy reasons scoped packages are by default published with an access set to `restricted` (aka "private packages"). This requires you to register for a paid npm plan. In case you simply wish to publish a public scoped package to the registry (for free), just add the `--access public` flag. This behavior can be enabled by default through the `npmPublishAccess` settings.\n ',examples:[["Publish the active workspace","yarn npm publish"]]});Ye();qt();var SBe=$e(zn());Ye();Pt();qt();var Y0=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.package=ge.String({required:!1})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n;if(typeof this.package<"u")n=W.parseIdent(this.package);else{if(!a)throw new rr(o.cwd,this.context.cwd);if(!a.manifest.name)throw new it(`Missing 'name' field in ${ue.fromPortablePath(K.join(a.cwd,dr.manifest))}`);n=a.manifest.name}let u=await Rv(n,r),p={children:je.sortMap(Object.entries(u),([h])=>h).map(([h,E])=>({value:de.tuple(de.Type.RESOLUTION,{descriptor:W.makeDescriptor(n,h),locator:W.makeLocator(n,E)})}))};return $s.emitTree(p,{configuration:r,json:this.json,stdout:this.context.stdout})}};Y0.paths=[["npm","tag","list"]],Y0.usage=nt.Usage({category:"Npm-related commands",description:"list all dist-tags of a package",details:` + This command will list all tags of a package from the npm registry. + + If the package is not specified, Yarn will default to the current workspace. + `,examples:[["List all tags of package `my-pkg`","yarn npm tag list my-pkg"]]});async function Rv(t,e){let r=`/-/package${on.getIdentUrl(t)}/dist-tags`;return on.get(r,{configuration:e,ident:t,jsonResponse:!0,customErrorMessage:on.customPackageError})}var W0=class extends ut{constructor(){super(...arguments);this.package=ge.String();this.tag=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd);if(!a)throw new rr(o.cwd,this.context.cwd);let n=W.parseDescriptor(this.package,!0),u=n.range;if(!SBe.default.valid(u))throw new it(`The range ${de.pretty(r,n.range,de.Type.RANGE)} must be a valid semver version`);let A=Zn.getPublishRegistry(a.manifest,{configuration:r}),p=de.pretty(r,n,de.Type.IDENT),h=de.pretty(r,u,de.Type.RANGE),E=de.pretty(r,this.tag,de.Type.CODE);return(await Nt.start({configuration:r,stdout:this.context.stdout},async v=>{let b=await Rv(n,r);Object.hasOwn(b,this.tag)&&b[this.tag]===u&&v.reportWarning(0,`Tag ${E} is already set to version ${h}`);let C=`/-/package${on.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await on.put(C,u,{configuration:r,registry:A,ident:n,jsonRequest:!0,jsonResponse:!0}),v.reportInfo(0,`Tag ${E} added to version ${h} of package ${p}`)})).exitCode()}};W0.paths=[["npm","tag","add"]],W0.usage=nt.Usage({category:"Npm-related commands",description:"add a tag for a specific version of a package",details:` + This command will add a tag to the npm registry for a specific version of a package. If the tag already exists, it will be overwritten. + `,examples:[["Add a `beta` tag for version `2.3.4-beta.4` of package `my-pkg`","yarn npm tag add my-pkg@2.3.4-beta.4 beta"]]});Ye();qt();var V0=class extends ut{constructor(){super(...arguments);this.package=ge.String();this.tag=ge.String()}async execute(){if(this.tag==="latest")throw new it("The 'latest' tag cannot be removed.");let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd);if(!a)throw new rr(o.cwd,this.context.cwd);let n=W.parseIdent(this.package),u=Zn.getPublishRegistry(a.manifest,{configuration:r}),A=de.pretty(r,this.tag,de.Type.CODE),p=de.pretty(r,n,de.Type.IDENT),h=await Rv(n,r);if(!Object.hasOwn(h,this.tag))throw new it(`${A} is not a tag of package ${p}`);return(await Nt.start({configuration:r,stdout:this.context.stdout},async I=>{let v=`/-/package${on.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await on.del(v,{configuration:r,registry:u,ident:n,jsonResponse:!0}),I.reportInfo(0,`Tag ${A} removed from package ${p}`)})).exitCode()}};V0.paths=[["npm","tag","remove"]],V0.usage=nt.Usage({category:"Npm-related commands",description:"remove a tag from a package",details:` + This command will remove a tag from a package from the npm registry. + `,examples:[["Remove the `beta` tag from package `my-pkg`","yarn npm tag remove my-pkg beta"]]});Ye();Ye();qt();var K0=class extends ut{constructor(){super(...arguments);this.scope=ge.String("-s,--scope",{description:"Print username for the registry configured for a given scope"});this.publish=ge.Boolean("--publish",!1,{description:"Print username for the publish registry"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),o;return this.scope&&this.publish?o=Zn.getScopeRegistry(this.scope,{configuration:r,type:Zn.RegistryType.PUBLISH_REGISTRY}):this.scope?o=Zn.getScopeRegistry(this.scope,{configuration:r}):this.publish?o=Zn.getPublishRegistry((await AC(r,this.context.cwd)).manifest,{configuration:r}):o=Zn.getDefaultRegistry({configuration:r}),(await Nt.start({configuration:r,stdout:this.context.stdout},async n=>{let u;try{u=await on.get("/-/whoami",{configuration:r,registry:o,authType:on.AuthType.ALWAYS_AUTH,jsonResponse:!0,ident:this.scope?W.makeIdent(this.scope,""):void 0})}catch(A){if(A.response?.statusCode===401||A.response?.statusCode===403){n.reportError(41,"Authentication failed - your credentials may have expired");return}else throw A}n.reportInfo(0,u.username)})).exitCode()}};K0.paths=[["npm","whoami"]],K0.usage=nt.Usage({category:"Npm-related commands",description:"display the name of the authenticated user",details:"\n Print the username associated with the current authentication settings to the standard output.\n\n When using `-s,--scope`, the username printed will be the one that matches the authentication settings of the registry associated with the given scope (those settings can be overriden using the `npmRegistries` map, and the registry associated with the scope is configured via the `npmScopes` map).\n\n When using `--publish`, the registry we'll select will by default be the one used when publishing packages (`publishConfig.registry` or `npmPublishRegistry` if available, otherwise we'll fallback to the regular `npmRegistryServer`).\n ",examples:[["Print username for the default registry","yarn npm whoami"],["Print username for the registry on a given scope","yarn npm whoami --scope company"]]});var qvt={configuration:{npmPublishAccess:{description:"Default access of the published packages",type:"STRING",default:null},npmAuditExcludePackages:{description:"Array of glob patterns of packages to exclude from npm audit",type:"STRING",default:[],isArray:!0},npmAuditIgnoreAdvisories:{description:"Array of glob patterns of advisory IDs to exclude from npm audit",type:"STRING",default:[],isArray:!0}},commands:[_0,H0,j0,q0,G0,W0,Y0,V0,K0]},Gvt=qvt;var NG={};Kt(NG,{PatchCommand:()=>X0,PatchCommitCommand:()=>z0,PatchFetcher:()=>Uv,PatchResolver:()=>_v,default:()=>lDt,patchUtils:()=>Dm});Ye();Ye();Pt();nA();var Dm={};Kt(Dm,{applyPatchFile:()=>nF,diffFolders:()=>TG,ensureUnpatchedDescriptor:()=>bG,ensureUnpatchedLocator:()=>sF,extractPackageToDisk:()=>FG,extractPatchFlags:()=>RBe,isParentRequired:()=>QG,isPatchDescriptor:()=>iF,isPatchLocator:()=>J0,loadPatchFiles:()=>Ov,makeDescriptor:()=>oF,makeLocator:()=>kG,makePatchHash:()=>RG,parseDescriptor:()=>Lv,parseLocator:()=>Mv,parsePatchFile:()=>Nv,unpatchDescriptor:()=>sDt,unpatchLocator:()=>oDt});Ye();Pt();Ye();Pt();var Yvt=/^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@.*/;function lw(t){return K.relative(Bt.root,K.resolve(Bt.root,ue.toPortablePath(t)))}function Wvt(t){let e=t.trim().match(Yvt);if(!e)throw new Error(`Bad header line: '${t}'`);return{original:{start:Math.max(Number(e[1]),1),length:Number(e[3]||1)},patched:{start:Math.max(Number(e[4]),1),length:Number(e[6]||1)}}}var Vvt=420,Kvt=493;var xBe=()=>({semverExclusivity:null,diffLineFromPath:null,diffLineToPath:null,oldMode:null,newMode:null,deletedFileMode:null,newFileMode:null,renameFrom:null,renameTo:null,beforeHash:null,afterHash:null,fromPath:null,toPath:null,hunks:null}),Jvt=t=>({header:Wvt(t),parts:[]}),zvt={["@"]:"header",["-"]:"deletion",["+"]:"insertion",[" "]:"context",["\\"]:"pragma",undefined:"context"};function Xvt(t){let e=[],r=xBe(),o="parsing header",a=null,n=null;function u(){a&&(n&&(a.parts.push(n),n=null),r.hunks.push(a),a=null)}function A(){u(),e.push(r),r=xBe()}for(let p=0;p0?"patch":"mode change",J=null;switch(U){case"rename":{if(!E||!I)throw new Error("Bad parser state: rename from & to not given");e.push({type:"rename",semverExclusivity:o,fromPath:lw(E),toPath:lw(I)}),J=I}break;case"file deletion":{let te=a||C;if(!te)throw new Error("Bad parse state: no path given for file deletion");e.push({type:"file deletion",semverExclusivity:o,hunk:L&&L[0]||null,path:lw(te),mode:rF(p),hash:v})}break;case"file creation":{let te=n||T;if(!te)throw new Error("Bad parse state: no path given for file creation");e.push({type:"file creation",semverExclusivity:o,hunk:L&&L[0]||null,path:lw(te),mode:rF(h),hash:b})}break;case"patch":case"mode change":J=T||n;break;default:je.assertNever(U);break}J&&u&&A&&u!==A&&e.push({type:"mode change",semverExclusivity:o,path:lw(J),oldMode:rF(u),newMode:rF(A)}),J&&L&&L.length&&e.push({type:"patch",semverExclusivity:o,path:lw(J),hunks:L,beforeHash:v,afterHash:b})}if(e.length===0)throw new Error("Unable to parse patch file: No changes found. Make sure the patch is a valid UTF8 encoded string");return e}function rF(t){let e=parseInt(t,8)&511;if(e!==Vvt&&e!==Kvt)throw new Error(`Unexpected file mode string: ${t}`);return e}function Nv(t){let e=t.split(/\n/g);return e[e.length-1]===""&&e.pop(),Zvt(Xvt(e))}function $vt(t){let e=0,r=0;for(let{type:o,lines:a}of t.parts)switch(o){case"context":r+=a.length,e+=a.length;break;case"deletion":e+=a.length;break;case"insertion":r+=a.length;break;default:je.assertNever(o);break}if(e!==t.header.original.length||r!==t.header.patched.length){let o=a=>a<0?a:`+${a}`;throw new Error(`hunk header integrity check failed (expected @@ ${o(t.header.original.length)} ${o(t.header.patched.length)} @@, got @@ ${o(e)} ${o(r)} @@)`)}}Ye();Pt();var cw=class extends Error{constructor(r,o){super(`Cannot apply hunk #${r+1}`);this.hunk=o}};async function uw(t,e,r){let o=await t.lstatPromise(e),a=await r();typeof a<"u"&&(e=a),await t.lutimesPromise(e,o.atime,o.mtime)}async function nF(t,{baseFs:e=new Rn,dryRun:r=!1,version:o=null}={}){for(let a of t)if(!(a.semverExclusivity!==null&&o!==null&&!kr.satisfiesWithPrereleases(o,a.semverExclusivity)))switch(a.type){case"file deletion":if(r){if(!e.existsSync(a.path))throw new Error(`Trying to delete a file that doesn't exist: ${a.path}`)}else await uw(e,K.dirname(a.path),async()=>{await e.unlinkPromise(a.path)});break;case"rename":if(r){if(!e.existsSync(a.fromPath))throw new Error(`Trying to move a file that doesn't exist: ${a.fromPath}`)}else await uw(e,K.dirname(a.fromPath),async()=>{await uw(e,K.dirname(a.toPath),async()=>{await uw(e,a.fromPath,async()=>(await e.movePromise(a.fromPath,a.toPath),a.toPath))})});break;case"file creation":if(r){if(e.existsSync(a.path))throw new Error(`Trying to create a file that already exists: ${a.path}`)}else{let n=a.hunk?a.hunk.parts[0].lines.join(` +`)+(a.hunk.parts[0].noNewlineAtEndOfFile?"":` +`):"";await e.mkdirpPromise(K.dirname(a.path),{chmod:493,utimes:[vi.SAFE_TIME,vi.SAFE_TIME]}),await e.writeFilePromise(a.path,n,{mode:a.mode}),await e.utimesPromise(a.path,vi.SAFE_TIME,vi.SAFE_TIME)}break;case"patch":await uw(e,a.path,async()=>{await rDt(a,{baseFs:e,dryRun:r})});break;case"mode change":{let u=(await e.statPromise(a.path)).mode;if(bBe(a.newMode)!==bBe(u))continue;await uw(e,a.path,async()=>{await e.chmodPromise(a.path,a.newMode)})}break;default:je.assertNever(a);break}}function bBe(t){return(t&64)>0}function kBe(t){return t.replace(/\s+$/,"")}function tDt(t,e){return kBe(t)===kBe(e)}async function rDt({hunks:t,path:e},{baseFs:r,dryRun:o=!1}){let a=await r.statSync(e).mode,u=(await r.readFileSync(e,"utf8")).split(/\n/),A=[],p=0,h=0;for(let I of t){let v=Math.max(h,I.header.patched.start+p),b=Math.max(0,v-h),C=Math.max(0,u.length-v-I.header.original.length),T=Math.max(b,C),L=0,U=0,J=null;for(;L<=T;){if(L<=b&&(U=v-L,J=QBe(I,u,U),J!==null)){L=-L;break}if(L<=C&&(U=v+L,J=QBe(I,u,U),J!==null))break;L+=1}if(J===null)throw new cw(t.indexOf(I),I);A.push(J),p+=L,h=U+I.header.original.length}if(o)return;let E=0;for(let I of A)for(let v of I)switch(v.type){case"splice":{let b=v.index+E;u.splice(b,v.numToDelete,...v.linesToInsert),E+=v.linesToInsert.length-v.numToDelete}break;case"pop":u.pop();break;case"push":u.push(v.line);break;default:je.assertNever(v);break}await r.writeFilePromise(e,u.join(` +`),{mode:a})}function QBe(t,e,r){let o=[];for(let a of t.parts)switch(a.type){case"context":case"deletion":{for(let n of a.lines){let u=e[r];if(u==null||!tDt(u,n))return null;r+=1}a.type==="deletion"&&(o.push({type:"splice",index:r-a.lines.length,numToDelete:a.lines.length,linesToInsert:[]}),a.noNewlineAtEndOfFile&&o.push({type:"push",line:""}))}break;case"insertion":o.push({type:"splice",index:r,numToDelete:0,linesToInsert:a.lines}),a.noNewlineAtEndOfFile&&o.push({type:"pop"});break;default:je.assertNever(a.type);break}return o}var iDt=/^builtin<([^>]+)>$/;function Aw(t,e){let{protocol:r,source:o,selector:a,params:n}=W.parseRange(t);if(r!=="patch:")throw new Error("Invalid patch range");if(o===null)throw new Error("Patch locators must explicitly define their source");let u=a?a.split(/&/).map(E=>ue.toPortablePath(E)):[],A=n&&typeof n.locator=="string"?W.parseLocator(n.locator):null,p=n&&typeof n.version=="string"?n.version:null,h=e(o);return{parentLocator:A,sourceItem:h,patchPaths:u,sourceVersion:p}}function iF(t){return t.range.startsWith("patch:")}function J0(t){return t.reference.startsWith("patch:")}function Lv(t){let{sourceItem:e,...r}=Aw(t.range,W.parseDescriptor);return{...r,sourceDescriptor:e}}function Mv(t){let{sourceItem:e,...r}=Aw(t.reference,W.parseLocator);return{...r,sourceLocator:e}}function sDt(t){let{sourceItem:e}=Aw(t.range,W.parseDescriptor);return e}function oDt(t){let{sourceItem:e}=Aw(t.reference,W.parseLocator);return e}function bG(t){if(!iF(t))return t;let{sourceItem:e}=Aw(t.range,W.parseDescriptor);return e}function sF(t){if(!J0(t))return t;let{sourceItem:e}=Aw(t.reference,W.parseLocator);return e}function FBe({parentLocator:t,sourceItem:e,patchPaths:r,sourceVersion:o,patchHash:a},n){let u=t!==null?{locator:W.stringifyLocator(t)}:{},A=typeof o<"u"?{version:o}:{},p=typeof a<"u"?{hash:a}:{};return W.makeRange({protocol:"patch:",source:n(e),selector:r.join("&"),params:{...A,...p,...u}})}function oF(t,{parentLocator:e,sourceDescriptor:r,patchPaths:o}){return W.makeDescriptor(t,FBe({parentLocator:e,sourceItem:r,patchPaths:o},W.stringifyDescriptor))}function kG(t,{parentLocator:e,sourcePackage:r,patchPaths:o,patchHash:a}){return W.makeLocator(t,FBe({parentLocator:e,sourceItem:r,sourceVersion:r.version,patchPaths:o,patchHash:a},W.stringifyLocator))}function TBe({onAbsolute:t,onRelative:e,onProject:r,onBuiltin:o},a){let n=a.lastIndexOf("!");n!==-1&&(a=a.slice(n+1));let u=a.match(iDt);return u!==null?o(u[1]):a.startsWith("~/")?r(a.slice(2)):K.isAbsolute(a)?t(a):e(a)}function RBe(t){let e=t.lastIndexOf("!");return{optional:(e!==-1?new Set(t.slice(0,e).split(/!/)):new Set).has("optional")}}function QG(t){return TBe({onAbsolute:()=>!1,onRelative:()=>!0,onProject:()=>!1,onBuiltin:()=>!1},t)}async function Ov(t,e,r){let o=t!==null?await r.fetcher.fetch(t,r):null,a=o&&o.localPath?{packageFs:new gn(Bt.root),prefixPath:K.relative(Bt.root,o.localPath)}:o;o&&o!==a&&o.releaseFs&&o.releaseFs();let n=await je.releaseAfterUseAsync(async()=>await Promise.all(e.map(async u=>{let A=RBe(u),p=await TBe({onAbsolute:async h=>await oe.readFilePromise(h,"utf8"),onRelative:async h=>{if(a===null)throw new Error("Assertion failed: The parent locator should have been fetched");return await a.packageFs.readFilePromise(K.join(a.prefixPath,h),"utf8")},onProject:async h=>await oe.readFilePromise(K.join(r.project.cwd,h),"utf8"),onBuiltin:async h=>await r.project.configuration.firstHook(E=>E.getBuiltinPatch,r.project,h)},u);return{...A,source:p}})));for(let u of n)typeof u.source=="string"&&(u.source=u.source.replace(/\r\n?/g,` +`));return n}async function FG(t,{cache:e,project:r}){let o=r.storedPackages.get(t.locatorHash);if(typeof o>"u")throw new Error("Assertion failed: Expected the package to be registered");let a=sF(t),n=r.storedChecksums,u=new Qi,A=await oe.mktempPromise(),p=K.join(A,"source"),h=K.join(A,"user"),E=K.join(A,".yarn-patch.json"),I=r.configuration.makeFetcher(),v=[];try{let b,C;if(t.locatorHash===a.locatorHash){let T=await I.fetch(t,{cache:e,project:r,fetcher:I,checksums:n,report:u});v.push(()=>T.releaseFs?.()),b=T,C=T}else b=await I.fetch(t,{cache:e,project:r,fetcher:I,checksums:n,report:u}),v.push(()=>b.releaseFs?.()),C=await I.fetch(t,{cache:e,project:r,fetcher:I,checksums:n,report:u}),v.push(()=>C.releaseFs?.());await Promise.all([oe.copyPromise(p,b.prefixPath,{baseFs:b.packageFs}),oe.copyPromise(h,C.prefixPath,{baseFs:C.packageFs}),oe.writeJsonPromise(E,{locator:W.stringifyLocator(t),version:o.version})])}finally{for(let b of v)b()}return oe.detachTemp(A),h}async function TG(t,e){let r=ue.fromPortablePath(t).replace(/\\/g,"/"),o=ue.fromPortablePath(e).replace(/\\/g,"/"),{stdout:a,stderr:n}=await Ur.execvp("git",["-c","core.safecrlf=false","diff","--src-prefix=a/","--dst-prefix=b/","--ignore-cr-at-eol","--full-index","--no-index","--no-renames","--text",r,o],{cwd:ue.toPortablePath(process.cwd()),env:{...process.env,GIT_CONFIG_NOSYSTEM:"1",HOME:"",XDG_CONFIG_HOME:"",USERPROFILE:""}});if(n.length>0)throw new Error(`Unable to diff directories. Make sure you have a recent version of 'git' available in PATH. +The following error was reported by 'git': +${n}`);let u=r.startsWith("/")?A=>A.slice(1):A=>A;return a.replace(new RegExp(`(a|b)(${je.escapeRegExp(`/${u(r)}/`)})`,"g"),"$1/").replace(new RegExp(`(a|b)${je.escapeRegExp(`/${u(o)}/`)}`,"g"),"$1/").replace(new RegExp(je.escapeRegExp(`${r}/`),"g"),"").replace(new RegExp(je.escapeRegExp(`${o}/`),"g"),"")}function RG(t,e){let r=[];for(let{source:o}of t){if(o===null)continue;let a=Nv(o);for(let n of a){let{semverExclusivity:u,...A}=n;u!==null&&e!==null&&!kr.satisfiesWithPrereleases(e,u)||r.push(JSON.stringify(A))}}return wn.makeHash(`${3}`,...r).slice(0,6)}Ye();function NBe(t,{configuration:e,report:r}){for(let o of t.parts)for(let a of o.lines)switch(o.type){case"context":r.reportInfo(null,` ${de.pretty(e,a,"grey")}`);break;case"deletion":r.reportError(28,`- ${de.pretty(e,a,de.Type.REMOVED)}`);break;case"insertion":r.reportError(28,`+ ${de.pretty(e,a,de.Type.ADDED)}`);break;default:je.assertNever(o.type)}}var Uv=class{supports(e,r){return!!J0(e)}getLocalPath(e,r){return null}async fetch(e,r){let o=r.checksums.get(e.locatorHash)||null,[a,n,u]=await r.cache.fetchPackageFromCache(e,o,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${W.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.patchPackage(e,r),...r.cacheOptions});return{packageFs:a,releaseFs:n,prefixPath:W.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:u}}async patchPackage(e,r){let{parentLocator:o,sourceLocator:a,sourceVersion:n,patchPaths:u}=Mv(e),A=await Ov(o,u,r),p=await oe.mktempPromise(),h=K.join(p,"current.zip"),E=await r.fetcher.fetch(a,r),I=W.getIdentVendorPath(e),v=new zi(h,{create:!0,level:r.project.configuration.get("compressionLevel")});await je.releaseAfterUseAsync(async()=>{await v.copyPromise(I,E.prefixPath,{baseFs:E.packageFs,stableSort:!0})},E.releaseFs),v.saveAndClose();for(let{source:b,optional:C}of A){if(b===null)continue;let T=new zi(h,{level:r.project.configuration.get("compressionLevel")}),L=new gn(K.resolve(Bt.root,I),{baseFs:T});try{await nF(Nv(b),{baseFs:L,version:n})}catch(U){if(!(U instanceof cw))throw U;let J=r.project.configuration.get("enableInlineHunks"),te=!J&&!C?" (set enableInlineHunks for details)":"",le=`${W.prettyLocator(r.project.configuration,e)}: ${U.message}${te}`,pe=Ae=>{!J||NBe(U.hunk,{configuration:r.project.configuration,report:Ae})};if(T.discardAndClose(),C){r.report.reportWarningOnce(66,le,{reportExtra:pe});continue}else throw new zt(66,le,pe)}T.saveAndClose()}return new zi(h,{level:r.project.configuration.get("compressionLevel")})}};Ye();var _v=class{supportsDescriptor(e,r){return!!iF(e)}supportsLocator(e,r){return!!J0(e)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,o){let{patchPaths:a}=Lv(e);return a.every(n=>!QG(n))?e:W.bindDescriptor(e,{locator:W.stringifyLocator(r)})}getResolutionDependencies(e,r){let{sourceDescriptor:o}=Lv(e);return{sourceDescriptor:r.project.configuration.normalizeDependency(o)}}async getCandidates(e,r,o){if(!o.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{parentLocator:a,patchPaths:n}=Lv(e),u=await Ov(a,n,o.fetchOptions),A=r.sourceDescriptor;if(typeof A>"u")throw new Error("Assertion failed: The dependency should have been resolved");let p=RG(u,A.version);return[kG(e,{parentLocator:a,sourcePackage:A,patchPaths:n,patchHash:p})]}async getSatisfying(e,r,o,a){let[n]=await this.getCandidates(e,r,a);return{locators:o.filter(u=>u.locatorHash===n.locatorHash),sorted:!1}}async resolve(e,r){let{sourceLocator:o}=Mv(e);return{...await r.resolver.resolve(o,r),...e}}};Ye();Pt();qt();var z0=class extends ut{constructor(){super(...arguments);this.save=ge.Boolean("-s,--save",!1,{description:"Add the patch to your resolution entries"});this.patchFolder=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd);if(!a)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState();let n=K.resolve(this.context.cwd,ue.toPortablePath(this.patchFolder)),u=K.join(n,"../source"),A=K.join(n,"../.yarn-patch.json");if(!oe.existsSync(u))throw new it("The argument folder didn't get created by 'yarn patch'");let p=await TG(u,n),h=await oe.readJsonPromise(A),E=W.parseLocator(h.locator,!0);if(!o.storedPackages.has(E.locatorHash))throw new it("No package found in the project for the given locator");if(!this.save){this.context.stdout.write(p);return}let I=r.get("patchFolder"),v=K.join(I,`${W.slugifyLocator(E)}.patch`);await oe.mkdirPromise(I,{recursive:!0}),await oe.writeFilePromise(v,p);let b=[],C=new Map;for(let T of o.storedPackages.values()){if(W.isVirtualLocator(T))continue;let L=T.dependencies.get(E.identHash);if(!L)continue;let U=W.ensureDevirtualizedDescriptor(L),J=bG(U),te=o.storedResolutions.get(J.descriptorHash);if(!te)throw new Error("Assertion failed: Expected the resolution to have been registered");if(!o.storedPackages.get(te))throw new Error("Assertion failed: Expected the package to have been registered");let pe=o.tryWorkspaceByLocator(T);if(pe)b.push(pe);else{let Ae=o.originalPackages.get(T.locatorHash);if(!Ae)throw new Error("Assertion failed: Expected the original package to have been registered");let ye=Ae.dependencies.get(L.identHash);if(!ye)throw new Error("Assertion failed: Expected the original dependency to have been registered");C.set(ye.descriptorHash,ye)}}for(let T of b)for(let L of Mt.hardDependencies){let U=T.manifest[L].get(E.identHash);if(!U)continue;let J=oF(U,{parentLocator:null,sourceDescriptor:W.convertLocatorToDescriptor(E),patchPaths:[K.join(dr.home,K.relative(o.cwd,v))]});T.manifest[L].set(U.identHash,J)}for(let T of C.values()){let L=oF(T,{parentLocator:null,sourceDescriptor:W.convertLocatorToDescriptor(E),patchPaths:[K.join(dr.home,K.relative(o.cwd,v))]});o.topLevelWorkspace.manifest.resolutions.push({pattern:{descriptor:{fullName:W.stringifyIdent(L),description:T.range}},reference:L.range})}await o.persist()}};z0.paths=[["patch-commit"]],z0.usage=nt.Usage({description:"generate a patch out of a directory",details:"\n By default, this will print a patchfile on stdout based on the diff between the folder passed in and the original version of the package. Such file is suitable for consumption with the `patch:` protocol.\n\n With the `-s,--save` option set, the patchfile won't be printed on stdout anymore and will instead be stored within a local file (by default kept within `.yarn/patches`, but configurable via the `patchFolder` setting). A `resolutions` entry will also be added to your top-level manifest, referencing the patched package via the `patch:` protocol.\n\n Note that only folders generated by `yarn patch` are accepted as valid input for `yarn patch-commit`.\n "});Ye();Pt();qt();var X0=class extends ut{constructor(){super(...arguments);this.update=ge.Boolean("-u,--update",!1,{description:"Reapply local patches that already apply to this packages"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.package=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(!a)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState();let u=W.parseLocator(this.package);if(u.reference==="unknown"){let A=je.mapAndFilter([...o.storedPackages.values()],p=>p.identHash!==u.identHash?je.mapAndFilter.skip:W.isVirtualLocator(p)?je.mapAndFilter.skip:J0(p)!==this.update?je.mapAndFilter.skip:p);if(A.length===0)throw new it("No package found in the project for the given locator");if(A.length>1)throw new it(`Multiple candidate packages found; explicitly choose one of them (use \`yarn why \` to get more information as to who depends on them): +${A.map(p=>` +- ${W.prettyLocator(r,p)}`).join("")}`);u=A[0]}if(!o.storedPackages.has(u.locatorHash))throw new it("No package found in the project for the given locator");await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout},async A=>{let p=sF(u),h=await FG(u,{cache:n,project:o});A.reportJson({locator:W.stringifyLocator(p),path:ue.fromPortablePath(h)});let E=this.update?" along with its current modifications":"";A.reportInfo(0,`Package ${W.prettyLocator(r,p)} got extracted with success${E}!`),A.reportInfo(0,`You can now edit the following folder: ${de.pretty(r,ue.fromPortablePath(h),"magenta")}`),A.reportInfo(0,`Once you are done run ${de.pretty(r,`yarn patch-commit -s ${process.platform==="win32"?'"':""}${ue.fromPortablePath(h)}${process.platform==="win32"?'"':""}`,"cyan")} and Yarn will store a patchfile based on your changes.`)})}};X0.paths=[["patch"]],X0.usage=nt.Usage({description:"prepare a package for patching",details:"\n This command will cause a package to be extracted in a temporary directory intended to be editable at will.\n\n Once you're done with your changes, run `yarn patch-commit -s path` (with `path` being the temporary directory you received) to generate a patchfile and register it into your top-level manifest via the `patch:` protocol. Run `yarn patch-commit -h` for more details.\n\n Calling the command when you already have a patch won't import it by default (in other words, the default behavior is to reset existing patches). However, adding the `-u,--update` flag will import any current patch.\n "});var aDt={configuration:{enableInlineHunks:{description:"If true, the installs will print unmatched patch hunks",type:"BOOLEAN",default:!1},patchFolder:{description:"Folder where the patch files must be written",type:"ABSOLUTE_PATH",default:"./.yarn/patches"}},commands:[z0,X0],fetchers:[Uv],resolvers:[_v]},lDt=aDt;var OG={};Kt(OG,{PnpmLinker:()=>Hv,default:()=>pDt});Ye();Pt();qt();var Hv=class{getCustomDataKey(){return JSON.stringify({name:"PnpmLinker",version:3})}supportsPackage(e,r){return this.isEnabled(r)}async findPackageLocation(e,r){if(!this.isEnabled(r))throw new Error("Assertion failed: Expected the pnpm linker to be enabled");let o=this.getCustomDataKey(),a=r.project.linkersCustomData.get(o);if(!a)throw new it(`The project in ${de.pretty(r.project.configuration,`${r.project.cwd}/package.json`,de.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=a.pathsByLocator.get(e.locatorHash);if(typeof n>"u")throw new it(`Couldn't find ${W.prettyLocator(r.project.configuration,e)} in the currently installed pnpm map - running an install might help`);return n.packageLocation}async findPackageLocator(e,r){if(!this.isEnabled(r))return null;let o=this.getCustomDataKey(),a=r.project.linkersCustomData.get(o);if(!a)throw new it(`The project in ${de.pretty(r.project.configuration,`${r.project.cwd}/package.json`,de.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=e.match(/(^.*\/node_modules\/(@[^/]*\/)?[^/]+)(\/.*$)/);if(n){let p=a.locatorByPath.get(n[1]);if(p)return p}let u=e,A=e;do{A=u,u=K.dirname(A);let p=a.locatorByPath.get(A);if(p)return p}while(u!==A);return null}makeInstaller(e){return new LG(e)}isEnabled(e){return e.project.configuration.get("nodeLinker")==="pnpm"}},LG=class{constructor(e){this.opts=e;this.asyncActions=new je.AsyncActions(10);this.customData={pathsByLocator:new Map,locatorByPath:new Map};this.indexFolderPromise=PD(oe,{indexPath:K.join(e.project.configuration.get("globalFolder"),"index")})}attachCustomData(e){}async installPackage(e,r,o){switch(e.linkType){case"SOFT":return this.installPackageSoft(e,r,o);case"HARD":return this.installPackageHard(e,r,o)}throw new Error("Assertion failed: Unsupported package link type")}async installPackageSoft(e,r,o){let a=K.resolve(r.packageFs.getRealPath(),r.prefixPath),n=this.opts.project.tryWorkspaceByLocator(e)?K.join(a,dr.nodeModules):null;return this.customData.pathsByLocator.set(e.locatorHash,{packageLocation:a,dependenciesLocation:n}),{packageLocation:a,buildRequest:null}}async installPackageHard(e,r,o){let a=cDt(e,{project:this.opts.project}),n=a.packageLocation;this.customData.locatorByPath.set(n,W.stringifyLocator(e)),this.customData.pathsByLocator.set(e.locatorHash,a),o.holdFetchResult(this.asyncActions.set(e.locatorHash,async()=>{await oe.mkdirPromise(n,{recursive:!0}),await oe.copyPromise(n,r.prefixPath,{baseFs:r.packageFs,overwrite:!1,linkStrategy:{type:"HardlinkFromIndex",indexPath:await this.indexFolderPromise,autoRepair:!0}})}));let A=W.isVirtualLocator(e)?W.devirtualizeLocator(e):e,p={manifest:await Mt.tryFind(r.prefixPath,{baseFs:r.packageFs})??new Mt,misc:{hasBindingGyp:mA.hasBindingGyp(r)}},h=this.opts.project.getDependencyMeta(A,e.version),E=mA.extractBuildRequest(e,p,h,{configuration:this.opts.project.configuration});return{packageLocation:n,buildRequest:E}}async attachInternalDependencies(e,r){if(this.opts.project.configuration.get("nodeLinker")!=="pnpm"||!LBe(e,{project:this.opts.project}))return;let o=this.customData.pathsByLocator.get(e.locatorHash);if(typeof o>"u")throw new Error(`Assertion failed: Expected the package to have been registered (${W.stringifyLocator(e)})`);let{dependenciesLocation:a}=o;!a||this.asyncActions.reduce(e.locatorHash,async n=>{await oe.mkdirPromise(a,{recursive:!0});let u=await uDt(a),A=new Map(u),p=[n],h=(I,v)=>{let b=v;LBe(v,{project:this.opts.project})||(this.opts.report.reportWarningOnce(0,"The pnpm linker doesn't support providing different versions to workspaces' peer dependencies"),b=W.devirtualizeLocator(v));let C=this.customData.pathsByLocator.get(b.locatorHash);if(typeof C>"u")throw new Error(`Assertion failed: Expected the package to have been registered (${W.stringifyLocator(v)})`);let T=W.stringifyIdent(I),L=K.join(a,T),U=K.relative(K.dirname(L),C.packageLocation),J=A.get(T);A.delete(T),p.push(Promise.resolve().then(async()=>{if(J){if(J.isSymbolicLink()&&await oe.readlinkPromise(L)===U)return;await oe.removePromise(L)}await oe.mkdirpPromise(K.dirname(L)),process.platform=="win32"&&this.opts.project.configuration.get("winLinkType")==="junctions"?await oe.symlinkPromise(C.packageLocation,L,"junction"):await oe.symlinkPromise(U,L)}))},E=!1;for(let[I,v]of r)I.identHash===e.identHash&&(E=!0),h(I,v);!E&&!this.opts.project.tryWorkspaceByLocator(e)&&h(W.convertLocatorToDescriptor(e),e),p.push(ADt(a,A)),await Promise.all(p)})}async attachExternalDependents(e,r){throw new Error("External dependencies haven't been implemented for the pnpm linker")}async finalizeInstall(){let e=OBe(this.opts.project);if(this.opts.project.configuration.get("nodeLinker")!=="pnpm")await oe.removePromise(e);else{let r;try{r=new Set(await oe.readdirPromise(e))}catch{r=new Set}for(let{dependenciesLocation:o}of this.customData.pathsByLocator.values()){if(!o)continue;let a=K.contains(e,o);if(a===null)continue;let[n]=a.split(K.sep);r.delete(n)}await Promise.all([...r].map(async o=>{await oe.removePromise(K.join(e,o))}))}return await this.asyncActions.wait(),await MG(e),this.opts.project.configuration.get("nodeLinker")!=="node-modules"&&await MG(MBe(this.opts.project)),{customData:this.customData}}};function MBe(t){return K.join(t.cwd,dr.nodeModules)}function OBe(t){return K.join(MBe(t),".store")}function cDt(t,{project:e}){let r=W.slugifyLocator(t),o=OBe(e),a=K.join(o,r,"package"),n=K.join(o,r,dr.nodeModules);return{packageLocation:a,dependenciesLocation:n}}function LBe(t,{project:e}){return!W.isVirtualLocator(t)||!e.tryWorkspaceByLocator(t)}async function uDt(t){let e=new Map,r=[];try{r=await oe.readdirPromise(t,{withFileTypes:!0})}catch(o){if(o.code!=="ENOENT")throw o}try{for(let o of r)if(!o.name.startsWith("."))if(o.name.startsWith("@")){let a=await oe.readdirPromise(K.join(t,o.name),{withFileTypes:!0});if(a.length===0)e.set(o.name,o);else for(let n of a)e.set(`${o.name}/${n.name}`,n)}else e.set(o.name,o)}catch(o){if(o.code!=="ENOENT")throw o}return e}async function ADt(t,e){let r=[],o=new Set;for(let a of e.keys()){r.push(oe.removePromise(K.join(t,a)));let n=W.tryParseIdent(a)?.scope;n&&o.add(`@${n}`)}return Promise.all(r).then(()=>Promise.all([...o].map(a=>MG(K.join(t,a)))))}async function MG(t){try{await oe.rmdirPromise(t)}catch(e){if(e.code!=="ENOENT"&&e.code!=="ENOTEMPTY")throw e}}var fDt={linkers:[Hv]},pDt=fDt;var YG={};Kt(YG,{StageCommand:()=>Z0,default:()=>vDt,stageUtils:()=>lF});Ye();Pt();qt();Ye();Pt();var lF={};Kt(lF,{ActionType:()=>UG,checkConsensus:()=>aF,expandDirectory:()=>jG,findConsensus:()=>qG,findVcsRoot:()=>_G,genCommitMessage:()=>GG,getCommitPrefix:()=>UBe,isYarnFile:()=>HG});Pt();var UG=(n=>(n[n.CREATE=0]="CREATE",n[n.DELETE=1]="DELETE",n[n.ADD=2]="ADD",n[n.REMOVE=3]="REMOVE",n[n.MODIFY=4]="MODIFY",n))(UG||{});async function _G(t,{marker:e}){do if(!oe.existsSync(K.join(t,e)))t=K.dirname(t);else return t;while(t!=="/");return null}function HG(t,{roots:e,names:r}){if(r.has(K.basename(t)))return!0;do if(!e.has(t))t=K.dirname(t);else return!0;while(t!=="/");return!1}function jG(t){let e=[],r=[t];for(;r.length>0;){let o=r.pop(),a=oe.readdirSync(o);for(let n of a){let u=K.resolve(o,n);oe.lstatSync(u).isDirectory()?r.push(u):e.push(u)}}return e}function aF(t,e){let r=0,o=0;for(let a of t)a!=="wip"&&(e.test(a)?r+=1:o+=1);return r>=o}function qG(t){let e=aF(t,/^(\w\(\w+\):\s*)?\w+s/),r=aF(t,/^(\w\(\w+\):\s*)?[A-Z]/),o=aF(t,/^\w\(\w+\):/);return{useThirdPerson:e,useUpperCase:r,useComponent:o}}function UBe(t){return t.useComponent?"chore(yarn): ":""}var hDt=new Map([[0,"create"],[1,"delete"],[2,"add"],[3,"remove"],[4,"update"]]);function GG(t,e){let r=UBe(t),o=[],a=e.slice().sort((n,u)=>n[0]-u[0]);for(;a.length>0;){let[n,u]=a.shift(),A=hDt.get(n);t.useUpperCase&&o.length===0&&(A=`${A[0].toUpperCase()}${A.slice(1)}`),t.useThirdPerson&&(A+="s");let p=[u];for(;a.length>0&&a[0][0]===n;){let[,E]=a.shift();p.push(E)}p.sort();let h=p.shift();p.length===1?h+=" (and one other)":p.length>1&&(h+=` (and ${p.length} others)`),o.push(`${A} ${h}`)}return`${r}${o.join(", ")}`}var gDt="Commit generated via `yarn stage`",dDt=11;async function _Be(t){let{code:e,stdout:r}=await Ur.execvp("git",["log","-1","--pretty=format:%H"],{cwd:t});return e===0?r.trim():null}async function mDt(t,e){let r=[],o=e.filter(h=>K.basename(h.path)==="package.json");for(let{action:h,path:E}of o){let I=K.relative(t,E);if(h===4){let v=await _Be(t),{stdout:b}=await Ur.execvp("git",["show",`${v}:${I}`],{cwd:t,strict:!0}),C=await Mt.fromText(b),T=await Mt.fromFile(E),L=new Map([...T.dependencies,...T.devDependencies]),U=new Map([...C.dependencies,...C.devDependencies]);for(let[J,te]of U){let le=W.stringifyIdent(te),pe=L.get(J);pe?pe.range!==te.range&&r.push([4,`${le} to ${pe.range}`]):r.push([3,le])}for(let[J,te]of L)U.has(J)||r.push([2,W.stringifyIdent(te)])}else if(h===0){let v=await Mt.fromFile(E);v.name?r.push([0,W.stringifyIdent(v.name)]):r.push([0,"a package"])}else if(h===1){let v=await _Be(t),{stdout:b}=await Ur.execvp("git",["show",`${v}:${I}`],{cwd:t,strict:!0}),C=await Mt.fromText(b);C.name?r.push([1,W.stringifyIdent(C.name)]):r.push([1,"a package"])}else throw new Error("Assertion failed: Unsupported action type")}let{code:a,stdout:n}=await Ur.execvp("git",["log",`-${dDt}`,"--pretty=format:%s"],{cwd:t}),u=a===0?n.split(/\n/g).filter(h=>h!==""):[],A=qG(u);return GG(A,r)}var yDt={[0]:[" A ","?? "],[4]:[" M "],[1]:[" D "]},EDt={[0]:["A "],[4]:["M "],[1]:["D "]},HBe={async findRoot(t){return await _G(t,{marker:".git"})},async filterChanges(t,e,r,o){let{stdout:a}=await Ur.execvp("git",["status","-s"],{cwd:t,strict:!0}),n=a.toString().split(/\n/g),u=o?.staged?EDt:yDt;return[].concat(...n.map(p=>{if(p==="")return[];let h=p.slice(0,3),E=K.resolve(t,p.slice(3));if(!o?.staged&&h==="?? "&&p.endsWith("/"))return jG(E).map(I=>({action:0,path:I}));{let v=[0,4,1].find(b=>u[b].includes(h));return v!==void 0?[{action:v,path:E}]:[]}})).filter(p=>HG(p.path,{roots:e,names:r}))},async genCommitMessage(t,e){return await mDt(t,e)},async makeStage(t,e){let r=e.map(o=>ue.fromPortablePath(o.path));await Ur.execvp("git",["add","--",...r],{cwd:t,strict:!0})},async makeCommit(t,e,r){let o=e.map(a=>ue.fromPortablePath(a.path));await Ur.execvp("git",["add","-N","--",...o],{cwd:t,strict:!0}),await Ur.execvp("git",["commit","-m",`${r} + +${gDt} +`,"--",...o],{cwd:t,strict:!0})},async makeReset(t,e){let r=e.map(o=>ue.fromPortablePath(o.path));await Ur.execvp("git",["reset","HEAD","--",...r],{cwd:t,strict:!0})}};var CDt=[HBe],Z0=class extends ut{constructor(){super(...arguments);this.commit=ge.Boolean("-c,--commit",!1,{description:"Commit the staged files"});this.reset=ge.Boolean("-r,--reset",!1,{description:"Remove all files from the staging area"});this.dryRun=ge.Boolean("-n,--dry-run",!1,{description:"Print the commit message and the list of modified files without staging / committing"});this.update=ge.Boolean("-u,--update",!1,{hidden:!0})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o}=await St.find(r,this.context.cwd),{driver:a,root:n}=await wDt(o.cwd),u=[r.get("cacheFolder"),r.get("globalFolder"),r.get("virtualFolder"),r.get("yarnPath")];await r.triggerHook(I=>I.populateYarnPaths,o,I=>{u.push(I)});let A=new Set;for(let I of u)for(let v of IDt(n,I))A.add(v);let p=new Set([r.get("rcFilename"),dr.lockfile,dr.manifest]),h=await a.filterChanges(n,A,p),E=await a.genCommitMessage(n,h);if(this.dryRun)if(this.commit)this.context.stdout.write(`${E} +`);else for(let I of h)this.context.stdout.write(`${ue.fromPortablePath(I.path)} +`);else if(this.reset){let I=await a.filterChanges(n,A,p,{staged:!0});I.length===0?this.context.stdout.write("No staged changes found!"):await a.makeReset(n,I)}else h.length===0?this.context.stdout.write("No changes found!"):this.commit?await a.makeCommit(n,h,E):(await a.makeStage(n,h),this.context.stdout.write(E))}};Z0.paths=[["stage"]],Z0.usage=nt.Usage({description:"add all yarn files to your vcs",details:"\n This command will add to your staging area the files belonging to Yarn (typically any modified `package.json` and `.yarnrc.yml` files, but also linker-generated files, cache data, etc). It will take your ignore list into account, so the cache files won't be added if the cache is ignored in a `.gitignore` file (assuming you use Git).\n\n Running `--reset` will instead remove them from the staging area (the changes will still be there, but won't be committed until you stage them back).\n\n Since the staging area is a non-existent concept in Mercurial, Yarn will always create a new commit when running this command on Mercurial repositories. You can get this behavior when using Git by using the `--commit` flag which will directly create a commit.\n ",examples:[["Adds all modified project files to the staging area","yarn stage"],["Creates a new commit containing all modified project files","yarn stage --commit"]]});async function wDt(t){let e=null,r=null;for(let o of CDt)if((r=await o.findRoot(t))!==null){e=o;break}if(e===null||r===null)throw new it("No stage driver has been found for your current project");return{driver:e,root:r}}function IDt(t,e){let r=[];if(e===null)return r;for(;;){(e===t||e.startsWith(`${t}/`))&&r.push(e);let o;try{o=oe.statSync(e)}catch{break}if(o.isSymbolicLink())e=K.resolve(K.dirname(e),oe.readlinkSync(e));else break}return r}var BDt={commands:[Z0]},vDt=BDt;var WG={};Kt(WG,{default:()=>FDt});Ye();Ye();Pt();var GBe=$e(zn());Ye();var jBe=$e(ZH()),DDt="e8e1bd300d860104bb8c58453ffa1eb4",PDt="OFCNCOG2CU",qBe=async(t,e)=>{let r=W.stringifyIdent(t),a=SDt(e).initIndex("npm-search");try{return(await a.getObject(r,{attributesToRetrieve:["types"]})).types?.ts==="definitely-typed"}catch{return!1}},SDt=t=>(0,jBe.default)(PDt,DDt,{requester:{async send(r){try{let o=await rn.request(r.url,r.data||null,{configuration:t,headers:r.headers});return{content:o.body,isTimedOut:!1,status:o.statusCode}}catch(o){return{content:o.response.body,isTimedOut:!1,status:o.response.statusCode}}}}});var YBe=t=>t.scope?`${t.scope}__${t.name}`:`${t.name}`,xDt=async(t,e,r,o)=>{if(r.scope==="types")return;let{project:a}=t,{configuration:n}=a;if(!(n.get("tsEnableAutoTypes")??oe.existsSync(K.join(a.cwd,"tsconfig.json"))))return;let A=n.makeResolver(),p={project:a,resolver:A,report:new Qi};if(!await qBe(r,n))return;let E=YBe(r),I=W.parseRange(r.range).selector;if(!kr.validRange(I)){let L=n.normalizeDependency(r),U=await A.getCandidates(L,{},p);I=W.parseRange(U[0].reference).selector}let v=GBe.default.coerce(I);if(v===null)return;let b=`${zc.Modifier.CARET}${v.major}`,C=W.makeDescriptor(W.makeIdent("types",E),b),T=je.mapAndFind(a.workspaces,L=>{let U=L.manifest.dependencies.get(r.identHash)?.descriptorHash,J=L.manifest.devDependencies.get(r.identHash)?.descriptorHash;if(U!==r.descriptorHash&&J!==r.descriptorHash)return je.mapAndFind.skip;let te=[];for(let le of Mt.allDependencies){let pe=L.manifest[le].get(C.identHash);typeof pe>"u"||te.push([le,pe])}return te.length===0?je.mapAndFind.skip:te});if(typeof T<"u")for(let[L,U]of T)t.manifest[L].set(U.identHash,U);else{try{let L=n.normalizeDependency(C);if((await A.getCandidates(L,{},p)).length===0)return}catch{return}t.manifest[zc.Target.DEVELOPMENT].set(C.identHash,C)}},bDt=async(t,e,r)=>{if(r.scope==="types")return;let{project:o}=t,{configuration:a}=o;if(!(a.get("tsEnableAutoTypes")??oe.existsSync(K.join(o.cwd,"tsconfig.json"))))return;let u=YBe(r),A=W.makeIdent("types",u);for(let p of Mt.allDependencies)typeof t.manifest[p].get(A.identHash)>"u"||t.manifest[p].delete(A.identHash)},kDt=(t,e)=>{e.publishConfig&&e.publishConfig.typings&&(e.typings=e.publishConfig.typings),e.publishConfig&&e.publishConfig.types&&(e.types=e.publishConfig.types)},QDt={configuration:{tsEnableAutoTypes:{description:"Whether Yarn should auto-install @types/ dependencies on 'yarn add'",type:"BOOLEAN",isNullable:!0,default:null}},hooks:{afterWorkspaceDependencyAddition:xDt,afterWorkspaceDependencyRemoval:bDt,beforeWorkspacePacking:kDt}},FDt=QDt;var XG={};Kt(XG,{VersionApplyCommand:()=>$0,VersionCheckCommand:()=>eg,VersionCommand:()=>tg,default:()=>XDt,versionUtils:()=>gw});Ye();Ye();qt();var gw={};Kt(gw,{Decision:()=>pw,applyPrerelease:()=>XBe,applyReleases:()=>zG,applyStrategy:()=>uF,clearVersionFiles:()=>VG,getUndecidedDependentWorkspaces:()=>qv,getUndecidedWorkspaces:()=>cF,openVersionFile:()=>hw,requireMoreDecisions:()=>KDt,resolveVersionFiles:()=>jv,suggestStrategy:()=>JG,updateVersionFiles:()=>KG,validateReleaseDecision:()=>fw});Ye();Pt();Nl();qt();var zBe=$e(JBe()),BA=$e(zn()),VDt=/^(>=|[~^]|)(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$/,pw=(u=>(u.UNDECIDED="undecided",u.DECLINE="decline",u.MAJOR="major",u.MINOR="minor",u.PATCH="patch",u.PRERELEASE="prerelease",u))(pw||{});function fw(t){let e=BA.default.valid(t);return e||je.validateEnum((0,zBe.default)(pw,"UNDECIDED"),t)}async function jv(t,{prerelease:e=null}={}){let r=new Map,o=t.configuration.get("deferredVersionFolder");if(!oe.existsSync(o))return r;let a=await oe.readdirPromise(o);for(let n of a){if(!n.endsWith(".yml"))continue;let u=K.join(o,n),A=await oe.readFilePromise(u,"utf8"),p=Vi(A);for(let[h,E]of Object.entries(p.releases||{})){if(E==="decline")continue;let I=W.parseIdent(h),v=t.tryWorkspaceByIdent(I);if(v===null)throw new Error(`Assertion failed: Expected a release definition file to only reference existing workspaces (${K.basename(u)} references ${h})`);if(v.manifest.version===null)throw new Error(`Assertion failed: Expected the workspace to have a version (${W.prettyLocator(t.configuration,v.anchoredLocator)})`);let b=v.manifest.raw.stableVersion??v.manifest.version,C=r.get(v),T=uF(b,fw(E));if(T===null)throw new Error(`Assertion failed: Expected ${b} to support being bumped via strategy ${E}`);let L=typeof C<"u"?BA.default.gt(T,C)?T:C:T;r.set(v,L)}}return e&&(r=new Map([...r].map(([n,u])=>[n,XBe(u,{current:n.manifest.version,prerelease:e})]))),r}async function VG(t){let e=t.configuration.get("deferredVersionFolder");!oe.existsSync(e)||await oe.removePromise(e)}async function KG(t,e){let r=new Set(e),o=t.configuration.get("deferredVersionFolder");if(!oe.existsSync(o))return;let a=await oe.readdirPromise(o);for(let n of a){if(!n.endsWith(".yml"))continue;let u=K.join(o,n),A=await oe.readFilePromise(u,"utf8"),p=Vi(A),h=p?.releases;if(!!h){for(let E of Object.keys(h)){let I=W.parseIdent(E),v=t.tryWorkspaceByIdent(I);(v===null||r.has(v))&&delete p.releases[E]}Object.keys(p.releases).length>0?await oe.changeFilePromise(u,Ba(new Ba.PreserveOrdering(p))):await oe.unlinkPromise(u)}}}async function hw(t,{allowEmpty:e=!1}={}){let r=t.configuration;if(r.projectCwd===null)throw new it("This command can only be run from within a Yarn project");let o=await ra.fetchRoot(r.projectCwd),a=o!==null?await ra.fetchBase(o,{baseRefs:r.get("changesetBaseRefs")}):null,n=o!==null?await ra.fetchChangedFiles(o,{base:a.hash,project:t}):[],u=r.get("deferredVersionFolder"),A=n.filter(b=>K.contains(u,b)!==null);if(A.length>1)throw new it(`Your current branch contains multiple versioning files; this isn't supported: +- ${A.map(b=>ue.fromPortablePath(b)).join(` +- `)}`);let p=new Set(je.mapAndFilter(n,b=>{let C=t.tryWorkspaceByFilePath(b);return C===null?je.mapAndFilter.skip:C}));if(A.length===0&&p.size===0&&!e)return null;let h=A.length===1?A[0]:K.join(u,`${wn.makeHash(Math.random().toString()).slice(0,8)}.yml`),E=oe.existsSync(h)?await oe.readFilePromise(h,"utf8"):"{}",I=Vi(E),v=new Map;for(let b of I.declined||[]){let C=W.parseIdent(b),T=t.getWorkspaceByIdent(C);v.set(T,"decline")}for(let[b,C]of Object.entries(I.releases||{})){let T=W.parseIdent(b),L=t.getWorkspaceByIdent(T);v.set(L,fw(C))}return{project:t,root:o,baseHash:a!==null?a.hash:null,baseTitle:a!==null?a.title:null,changedFiles:new Set(n),changedWorkspaces:p,releaseRoots:new Set([...p].filter(b=>b.manifest.version!==null)),releases:v,async saveAll(){let b={},C=[],T=[];for(let L of t.workspaces){if(L.manifest.version===null)continue;let U=W.stringifyIdent(L.anchoredLocator),J=v.get(L);J==="decline"?C.push(U):typeof J<"u"?b[U]=fw(J):p.has(L)&&T.push(U)}await oe.mkdirPromise(K.dirname(h),{recursive:!0}),await oe.changeFilePromise(h,Ba(new Ba.PreserveOrdering({releases:Object.keys(b).length>0?b:void 0,declined:C.length>0?C:void 0,undecided:T.length>0?T:void 0})))}}}function KDt(t){return cF(t).size>0||qv(t).length>0}function cF(t){let e=new Set;for(let r of t.changedWorkspaces)r.manifest.version!==null&&(t.releases.has(r)||e.add(r));return e}function qv(t,{include:e=new Set}={}){let r=[],o=new Map(je.mapAndFilter([...t.releases],([n,u])=>u==="decline"?je.mapAndFilter.skip:[n.anchoredLocator.locatorHash,n])),a=new Map(je.mapAndFilter([...t.releases],([n,u])=>u!=="decline"?je.mapAndFilter.skip:[n.anchoredLocator.locatorHash,n]));for(let n of t.project.workspaces)if(!(!e.has(n)&&(a.has(n.anchoredLocator.locatorHash)||o.has(n.anchoredLocator.locatorHash)))&&n.manifest.version!==null)for(let u of Mt.hardDependencies)for(let A of n.manifest.getForScope(u).values()){let p=t.project.tryWorkspaceByDescriptor(A);p!==null&&o.has(p.anchoredLocator.locatorHash)&&r.push([n,p])}return r}function JG(t,e){let r=BA.default.clean(e);for(let o of Object.values(pw))if(o!=="undecided"&&o!=="decline"&&BA.default.inc(t,o)===r)return o;return null}function uF(t,e){if(BA.default.valid(e))return e;if(t===null)throw new it(`Cannot apply the release strategy "${e}" unless the workspace already has a valid version`);if(!BA.default.valid(t))throw new it(`Cannot apply the release strategy "${e}" on a non-semver version (${t})`);let r=BA.default.inc(t,e);if(r===null)throw new it(`Cannot apply the release strategy "${e}" on the specified version (${t})`);return r}function zG(t,e,{report:r}){let o=new Map;for(let a of t.workspaces)for(let n of Mt.allDependencies)for(let u of a.manifest[n].values()){let A=t.tryWorkspaceByDescriptor(u);if(A===null||!e.has(A))continue;je.getArrayWithDefault(o,A).push([a,n,u.identHash])}for(let[a,n]of e){let u=a.manifest.version;a.manifest.version=n,BA.default.prerelease(n)===null?delete a.manifest.raw.stableVersion:a.manifest.raw.stableVersion||(a.manifest.raw.stableVersion=u);let A=a.manifest.name!==null?W.stringifyIdent(a.manifest.name):null;r.reportInfo(0,`${W.prettyLocator(t.configuration,a.anchoredLocator)}: Bumped to ${n}`),r.reportJson({cwd:ue.fromPortablePath(a.cwd),ident:A,oldVersion:u,newVersion:n});let p=o.get(a);if(!(typeof p>"u"))for(let[h,E,I]of p){let v=h.manifest[E].get(I);if(typeof v>"u")throw new Error("Assertion failed: The dependency should have existed");let b=v.range,C=!1;if(b.startsWith(Xn.protocol)&&(b=b.slice(Xn.protocol.length),C=!0,b===a.relativeCwd))continue;let T=b.match(VDt);if(!T){r.reportWarning(0,`Couldn't auto-upgrade range ${b} (in ${W.prettyLocator(t.configuration,h.anchoredLocator)})`);continue}let L=`${T[1]}${n}`;C&&(L=`${Xn.protocol}${L}`);let U=W.makeDescriptor(v,L);h.manifest[E].set(I,U)}}}var JDt=new Map([["%n",{extract:t=>t.length>=1?[t[0],t.slice(1)]:null,generate:(t=0)=>`${t+1}`}]]);function XBe(t,{current:e,prerelease:r}){let o=new BA.default.SemVer(e),a=o.prerelease.slice(),n=[];o.prerelease=[],o.format()!==t&&(a.length=0);let u=!0,A=r.split(/\./g);for(let p of A){let h=JDt.get(p);if(typeof h>"u")n.push(p),a[0]===p?a.shift():u=!1;else{let E=u?h.extract(a):null;E!==null&&typeof E[0]=="number"?(n.push(h.generate(E[0])),a=E[1]):(n.push(h.generate()),u=!1)}}return o.prerelease&&(o.prerelease=[]),`${t}-${n.join(".")}`}var $0=class extends ut{constructor(){super(...arguments);this.all=ge.Boolean("--all",!1,{description:"Apply the deferred version changes on all workspaces"});this.dryRun=ge.Boolean("--dry-run",!1,{description:"Print the versions without actually generating the package archive"});this.prerelease=ge.String("--prerelease",{description:"Add a prerelease identifier to new versions",tolerateBoolean:!0});this.recursive=ge.Boolean("-R,--recursive",{description:"Release the transitive workspaces as well"});this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);if(!a)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState({restoreResolutions:!1});let u=await Nt.start({configuration:r,json:this.json,stdout:this.context.stdout},async A=>{let p=this.prerelease?typeof this.prerelease!="boolean"?this.prerelease:"rc.%n":null,h=await jv(o,{prerelease:p}),E=new Map;if(this.all)E=h;else{let I=this.recursive?a.getRecursiveWorkspaceDependencies():[a];for(let v of I){let b=h.get(v);typeof b<"u"&&E.set(v,b)}}if(E.size===0){let I=h.size>0?" Did you want to add --all?":"";A.reportWarning(0,`The current workspace doesn't seem to require a version bump.${I}`);return}zG(o,E,{report:A}),this.dryRun||(p||(this.all?await VG(o):await KG(o,[...E.keys()])),A.reportSeparator())});return u.hasErrors()?u.exitCode():await o.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:n})}};$0.paths=[["version","apply"]],$0.usage=nt.Usage({category:"Release-related commands",description:"apply all the deferred version bumps at once",details:` + This command will apply the deferred version changes and remove their definitions from the repository. + + Note that if \`--prerelease\` is set, the given prerelease identifier (by default \`rc.%d\`) will be used on all new versions and the version definitions will be kept as-is. + + By default only the current workspace will be bumped, but you can configure this behavior by using one of: + + - \`--recursive\` to also apply the version bump on its dependencies + - \`--all\` to apply the version bump on all packages in the repository + + Note that this command will also update the \`workspace:\` references across all your local workspaces, thus ensuring that they keep referring to the same workspaces even after the version bump. + `,examples:[["Apply the version change to the local workspace","yarn version apply"],["Apply the version change to all the workspaces in the local workspace","yarn version apply --all"]]});Ye();Pt();qt();var AF=$e(zn());var eg=class extends ut{constructor(){super(...arguments);this.interactive=ge.Boolean("-i,--interactive",{description:"Open an interactive interface used to set version bumps"})}async execute(){return this.interactive?await this.executeInteractive():await this.executeStandard()}async executeInteractive(){SC(this.context);let{Gem:r}=await Promise.resolve().then(()=>(AQ(),Dj)),{ScrollableItems:o}=await Promise.resolve().then(()=>(gQ(),hQ)),{FocusRequest:a}=await Promise.resolve().then(()=>(Sj(),Xwe)),{useListInput:n}=await Promise.resolve().then(()=>(pQ(),Zwe)),{renderForm:u}=await Promise.resolve().then(()=>(EQ(),yQ)),{Box:A,Text:p}=await Promise.resolve().then(()=>$e(ic())),{default:h,useCallback:E,useState:I}=await Promise.resolve().then(()=>$e(sn())),v=await Ve.find(this.context.cwd,this.context.plugins),{project:b,workspace:C}=await St.find(v,this.context.cwd);if(!C)throw new rr(b.cwd,this.context.cwd);await b.restoreInstallState();let T=await hw(b);if(T===null||T.releaseRoots.size===0)return 0;if(T.root===null)throw new it("This command can only be run on Git repositories");let L=()=>h.createElement(A,{flexDirection:"row",paddingBottom:1},h.createElement(A,{flexDirection:"column",width:60},h.createElement(A,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},""),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to select workspaces.")),h.createElement(A,null,h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},""),"/",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to select release strategies."))),h.createElement(A,{flexDirection:"column"},h.createElement(A,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to save.")),h.createElement(A,{marginLeft:1},h.createElement(p,null,"Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to abort.")))),U=({workspace:ye,active:ae,decision:we,setDecision:Pe})=>{let g=ye.manifest.raw.stableVersion??ye.manifest.version;if(g===null)throw new Error(`Assertion failed: The version should have been set (${W.prettyLocator(v,ye.anchoredLocator)})`);if(AF.default.prerelease(g)!==null)throw new Error(`Assertion failed: Prerelease identifiers shouldn't be found (${g})`);let Ee=["undecided","decline","patch","minor","major"];n(we,Ee,{active:ae,minus:"left",plus:"right",set:Pe});let De=we==="undecided"?h.createElement(p,{color:"yellow"},g):we==="decline"?h.createElement(p,{color:"green"},g):h.createElement(p,null,h.createElement(p,{color:"magenta"},g)," \u2192 ",h.createElement(p,{color:"green"},AF.default.valid(we)?we:AF.default.inc(g,we)));return h.createElement(A,{flexDirection:"column"},h.createElement(A,null,h.createElement(p,null,W.prettyLocator(v,ye.anchoredLocator)," - ",De)),h.createElement(A,null,Ee.map(ce=>h.createElement(A,{key:ce,paddingLeft:2},h.createElement(p,null,h.createElement(r,{active:ce===we})," ",ce)))))},J=ye=>{let ae=new Set(T.releaseRoots),we=new Map([...ye].filter(([Pe])=>ae.has(Pe)));for(;;){let Pe=qv({project:T.project,releases:we}),g=!1;if(Pe.length>0){for(let[Ee]of Pe)if(!ae.has(Ee)){ae.add(Ee),g=!0;let De=ye.get(Ee);typeof De<"u"&&we.set(Ee,De)}}if(!g)break}return{relevantWorkspaces:ae,relevantReleases:we}},te=()=>{let[ye,ae]=I(()=>new Map(T.releases)),we=E((Pe,g)=>{let Ee=new Map(ye);g!=="undecided"?Ee.set(Pe,g):Ee.delete(Pe);let{relevantReleases:De}=J(Ee);ae(De)},[ye,ae]);return[ye,we]},le=({workspaces:ye,releases:ae})=>{let we=[];we.push(`${ye.size} total`);let Pe=0,g=0;for(let Ee of ye){let De=ae.get(Ee);typeof De>"u"?g+=1:De!=="decline"&&(Pe+=1)}return we.push(`${Pe} release${Pe===1?"":"s"}`),we.push(`${g} remaining`),h.createElement(p,{color:"yellow"},we.join(", "))},Ae=await u(({useSubmit:ye})=>{let[ae,we]=te();ye(ae);let{relevantWorkspaces:Pe}=J(ae),g=new Set([...Pe].filter(ne=>!T.releaseRoots.has(ne))),[Ee,De]=I(0),ce=E(ne=>{switch(ne){case a.BEFORE:De(Ee-1);break;case a.AFTER:De(Ee+1);break}},[Ee,De]);return h.createElement(A,{flexDirection:"column"},h.createElement(L,null),h.createElement(A,null,h.createElement(p,{wrap:"wrap"},"The following files have been modified in your local checkout.")),h.createElement(A,{flexDirection:"column",marginTop:1,paddingLeft:2},[...T.changedFiles].map(ne=>h.createElement(A,{key:ne},h.createElement(p,null,h.createElement(p,{color:"grey"},ue.fromPortablePath(T.root)),ue.sep,ue.relative(ue.fromPortablePath(T.root),ue.fromPortablePath(ne)))))),T.releaseRoots.size>0&&h.createElement(h.Fragment,null,h.createElement(A,{marginTop:1},h.createElement(p,{wrap:"wrap"},"Because of those files having been modified, the following workspaces may need to be released again (note that private workspaces are also shown here, because even though they won't be published, releasing them will allow us to flag their dependents for potential re-release):")),g.size>3?h.createElement(A,{marginTop:1},h.createElement(le,{workspaces:T.releaseRoots,releases:ae})):null,h.createElement(A,{marginTop:1,flexDirection:"column"},h.createElement(o,{active:Ee%2===0,radius:1,size:2,onFocusRequest:ce},[...T.releaseRoots].map(ne=>h.createElement(U,{key:ne.cwd,workspace:ne,decision:ae.get(ne)||"undecided",setDecision:ee=>we(ne,ee)}))))),g.size>0?h.createElement(h.Fragment,null,h.createElement(A,{marginTop:1},h.createElement(p,{wrap:"wrap"},"The following workspaces depend on other workspaces that have been marked for release, and thus may need to be released as well:")),h.createElement(A,null,h.createElement(p,null,"(Press ",h.createElement(p,{bold:!0,color:"cyanBright"},"")," to move the focus between the workspace groups.)")),g.size>5?h.createElement(A,{marginTop:1},h.createElement(le,{workspaces:g,releases:ae})):null,h.createElement(A,{marginTop:1,flexDirection:"column"},h.createElement(o,{active:Ee%2===1,radius:2,size:2,onFocusRequest:ce},[...g].map(ne=>h.createElement(U,{key:ne.cwd,workspace:ne,decision:ae.get(ne)||"undecided",setDecision:ee=>we(ne,ee)}))))):null)},{versionFile:T},{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});if(typeof Ae>"u")return 1;T.releases.clear();for(let[ye,ae]of Ae)T.releases.set(ye,ae);await T.saveAll()}async executeStandard(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd);if(!a)throw new rr(o.cwd,this.context.cwd);return await o.restoreInstallState(),(await Nt.start({configuration:r,stdout:this.context.stdout},async u=>{let A=await hw(o);if(A===null||A.releaseRoots.size===0)return;if(A.root===null)throw new it("This command can only be run on Git repositories");if(u.reportInfo(0,`Your PR was started right after ${de.pretty(r,A.baseHash.slice(0,7),"yellow")} ${de.pretty(r,A.baseTitle,"magenta")}`),A.changedFiles.size>0){u.reportInfo(0,"You have changed the following files since then:"),u.reportSeparator();for(let v of A.changedFiles)u.reportInfo(null,`${de.pretty(r,ue.fromPortablePath(A.root),"gray")}${ue.sep}${ue.relative(ue.fromPortablePath(A.root),ue.fromPortablePath(v))}`)}let p=!1,h=!1,E=cF(A);if(E.size>0){p||u.reportSeparator();for(let v of E)u.reportError(0,`${W.prettyLocator(r,v.anchoredLocator)} has been modified but doesn't have a release strategy attached`);p=!0}let I=qv(A);for(let[v,b]of I)h||u.reportSeparator(),u.reportError(0,`${W.prettyLocator(r,v.anchoredLocator)} doesn't have a release strategy attached, but depends on ${W.prettyWorkspace(r,b)} which is planned for release.`),h=!0;(p||h)&&(u.reportSeparator(),u.reportInfo(0,"This command detected that at least some workspaces have received modifications without explicit instructions as to how they had to be released (if needed)."),u.reportInfo(0,"To correct these errors, run `yarn version check --interactive` then follow the instructions."))})).exitCode()}};eg.paths=[["version","check"]],eg.usage=nt.Usage({category:"Release-related commands",description:"check that all the relevant packages have been bumped",details:"\n **Warning:** This command currently requires Git.\n\n This command will check that all the packages covered by the files listed in argument have been properly bumped or declined to bump.\n\n In the case of a bump, the check will also cover transitive packages - meaning that should `Foo` be bumped, a package `Bar` depending on `Foo` will require a decision as to whether `Bar` will need to be bumped. This check doesn't cross packages that have declined to bump.\n\n In case no arguments are passed to the function, the list of modified files will be generated by comparing the HEAD against `master`.\n ",examples:[["Check whether the modified packages need a bump","yarn version check"]]});Ye();qt();var fF=$e(zn());var tg=class extends ut{constructor(){super(...arguments);this.deferred=ge.Boolean("-d,--deferred",{description:"Prepare the version to be bumped during the next release cycle"});this.immediate=ge.Boolean("-i,--immediate",{description:"Bump the version immediately"});this.strategy=ge.String()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd);if(!a)throw new rr(o.cwd,this.context.cwd);let n=r.get("preferDeferredVersions");this.deferred&&(n=!0),this.immediate&&(n=!1);let u=fF.default.valid(this.strategy),A=this.strategy==="decline",p;if(u)if(a.manifest.version!==null){let E=JG(a.manifest.version,this.strategy);E!==null?p=E:p=this.strategy}else p=this.strategy;else{let E=a.manifest.version;if(!A){if(E===null)throw new it("Can't bump the version if there wasn't a version to begin with - use 0.0.0 as initial version then run the command again.");if(typeof E!="string"||!fF.default.valid(E))throw new it(`Can't bump the version (${E}) if it's not valid semver`)}p=fw(this.strategy)}if(!n){let I=(await jv(o)).get(a);if(typeof I<"u"&&p!=="decline"){let v=uF(a.manifest.version,p);if(fF.default.lt(v,I))throw new it(`Can't bump the version to one that would be lower than the current deferred one (${I})`)}}let h=await hw(o,{allowEmpty:!0});return h.releases.set(a,p),await h.saveAll(),n?0:await this.cli.run(["version","apply"])}};tg.paths=[["version"]],tg.usage=nt.Usage({category:"Release-related commands",description:"apply a new version to the current package",details:"\n This command will bump the version number for the given package, following the specified strategy:\n\n - If `major`, the first number from the semver range will be increased (`X.0.0`).\n - If `minor`, the second number from the semver range will be increased (`0.X.0`).\n - If `patch`, the third number from the semver range will be increased (`0.0.X`).\n - If prefixed by `pre` (`premajor`, ...), a `-0` suffix will be set (`0.0.0-0`).\n - If `prerelease`, the suffix will be increased (`0.0.0-X`); the third number from the semver range will also be increased if there was no suffix in the previous version.\n - If `decline`, the nonce will be increased for `yarn version check` to pass without version bump.\n - If a valid semver range, it will be used as new version.\n - If unspecified, Yarn will ask you for guidance.\n\n For more information about the `--deferred` flag, consult our documentation (https://yarnpkg.com/features/release-workflow#deferred-versioning).\n ",examples:[["Immediately bump the version to the next major","yarn version major"],["Prepare the version to be bumped to the next major","yarn version major --deferred"]]});var zDt={configuration:{deferredVersionFolder:{description:"Folder where are stored the versioning files",type:"ABSOLUTE_PATH",default:"./.yarn/versions"},preferDeferredVersions:{description:"If true, running `yarn version` will assume the `--deferred` flag unless `--immediate` is set",type:"BOOLEAN",default:!1}},commands:[$0,eg,tg]},XDt=zDt;var ZG={};Kt(ZG,{WorkspacesFocusCommand:()=>rg,WorkspacesForeachCommand:()=>op,default:()=>ePt});Ye();Ye();qt();var rg=class extends ut{constructor(){super(...arguments);this.json=ge.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.production=ge.Boolean("--production",!1,{description:"Only install regular dependencies by omitting dev dependencies"});this.all=ge.Boolean("-A,--all",!1,{description:"Install the entire project"});this.workspaces=ge.Rest()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd),n=await Lr.find(r);await o.restoreInstallState({restoreResolutions:!1});let u;if(this.all)u=new Set(o.workspaces);else if(this.workspaces.length===0){if(!a)throw new rr(o.cwd,this.context.cwd);u=new Set([a])}else u=new Set(this.workspaces.map(A=>o.getWorkspaceByIdent(W.parseIdent(A))));for(let A of u)for(let p of this.production?["dependencies"]:Mt.hardDependencies)for(let h of A.manifest.getForScope(p).values()){let E=o.tryWorkspaceByDescriptor(h);E!==null&&u.add(E)}for(let A of o.workspaces)u.has(A)?this.production&&A.manifest.devDependencies.clear():(A.manifest.installConfig=A.manifest.installConfig||{},A.manifest.installConfig.selfReferences=!1,A.manifest.dependencies.clear(),A.manifest.devDependencies.clear(),A.manifest.peerDependencies.clear(),A.manifest.scripts.clear());return await o.installWithNewReport({json:this.json,stdout:this.context.stdout},{cache:n,persistProject:!1})}};rg.paths=[["workspaces","focus"]],rg.usage=nt.Usage({category:"Workspace-related commands",description:"install a single workspace and its dependencies",details:"\n This command will run an install as if the specified workspaces (and all other workspaces they depend on) were the only ones in the project. If no workspaces are explicitly listed, the active one will be assumed.\n\n Note that this command is only very moderately useful when using zero-installs, since the cache will contain all the packages anyway - meaning that the only difference between a full install and a focused install would just be a few extra lines in the `.pnp.cjs` file, at the cost of introducing an extra complexity.\n\n If the `-A,--all` flag is set, the entire project will be installed. Combine with `--production` to replicate the old `yarn install --production`.\n "});Ye();Ye();Ye();qt();var dw=$e(Zo()),$Be=$e(nd());Za();var op=class extends ut{constructor(){super(...arguments);this.from=ge.Array("--from",{description:"An array of glob pattern idents or paths from which to base any recursion"});this.all=ge.Boolean("-A,--all",{description:"Run the command on all workspaces of a project"});this.recursive=ge.Boolean("-R,--recursive",{description:"Run the command on the current workspace and all of its recursive dependencies"});this.worktree=ge.Boolean("-W,--worktree",{description:"Run the command on all workspaces of the current worktree"});this.verbose=ge.Boolean("-v,--verbose",{description:"Prefix each output line with the name of the originating workspace"});this.parallel=ge.Boolean("-p,--parallel",!1,{description:"Run the commands in parallel"});this.interlaced=ge.Boolean("-i,--interlaced",!1,{description:"Print the output of commands in real-time instead of buffering it"});this.jobs=ge.String("-j,--jobs",{description:"The maximum number of parallel tasks that the execution will be limited to; or `unlimited`",validator:LR([Vs(["unlimited"]),oI(NR(),[OR(),MR(1)])])});this.topological=ge.Boolean("-t,--topological",!1,{description:"Run the command after all workspaces it depends on (regular) have finished"});this.topologicalDev=ge.Boolean("--topological-dev",!1,{description:"Run the command after all workspaces it depends on (regular + dev) have finished"});this.include=ge.Array("--include",[],{description:"An array of glob pattern idents or paths; only matching workspaces will be traversed"});this.exclude=ge.Array("--exclude",[],{description:"An array of glob pattern idents or paths; matching workspaces won't be traversed"});this.publicOnly=ge.Boolean("--no-private",{description:"Avoid running the command on private workspaces"});this.since=ge.String("--since",{description:"Only include workspaces that have been changed since the specified ref.",tolerateBoolean:!0});this.dryRun=ge.Boolean("-n,--dry-run",{description:"Print the commands that would be run, without actually running them"});this.commandName=ge.String();this.args=ge.Proxy()}async execute(){let r=await Ve.find(this.context.cwd,this.context.plugins),{project:o,workspace:a}=await St.find(r,this.context.cwd);if(!this.all&&!a)throw new rr(o.cwd,this.context.cwd);await o.restoreInstallState();let n=this.cli.process([this.commandName,...this.args]),u=n.path.length===1&&n.path[0]==="run"&&typeof n.scriptName<"u"?n.scriptName:null;if(n.path.length===0)throw new it("Invalid subcommand name for iteration - use the 'run' keyword if you wish to execute a script");let A=ae=>{!this.dryRun||this.context.stdout.write(`${ae} +`)},p=()=>{let ae=this.from.map(we=>dw.default.matcher(we));return o.workspaces.filter(we=>{let Pe=W.stringifyIdent(we.anchoredLocator),g=we.relativeCwd;return ae.some(Ee=>Ee(Pe)||Ee(g))})},h=[];if(this.since?(A("Option --since is set; selecting the changed workspaces as root for workspace selection"),h=Array.from(await ra.fetchChangedWorkspaces({ref:this.since,project:o}))):this.from?(A("Option --from is set; selecting the specified workspaces"),h=[...p()]):this.worktree?(A("Option --worktree is set; selecting the current workspace"),h=[a]):this.recursive?(A("Option --recursive is set; selecting the current workspace"),h=[a]):this.all&&(A("Option --all is set; selecting all workspaces"),h=[...o.workspaces]),this.dryRun&&!this.all){for(let ae of h)A(` +- ${ae.relativeCwd} + ${W.prettyLocator(r,ae.anchoredLocator)}`);h.length>0&&A("")}let E;if(this.recursive?this.since?(A("Option --recursive --since is set; recursively selecting all dependent workspaces"),E=new Set(h.map(ae=>[...ae.getRecursiveWorkspaceDependents()]).flat())):(A("Option --recursive is set; recursively selecting all transitive dependencies"),E=new Set(h.map(ae=>[...ae.getRecursiveWorkspaceDependencies()]).flat())):this.worktree?(A("Option --worktree is set; recursively selecting all nested workspaces"),E=new Set(h.map(ae=>[...ae.getRecursiveWorkspaceChildren()]).flat())):E=null,E!==null&&(h=[...new Set([...h,...E])],this.dryRun))for(let ae of E)A(` +- ${ae.relativeCwd} + ${W.prettyLocator(r,ae.anchoredLocator)}`);let I=[],v=!1;if(u?.includes(":")){for(let ae of o.workspaces)if(ae.manifest.scripts.has(u)&&(v=!v,v===!1))break}for(let ae of h){if(u&&!ae.manifest.scripts.has(u)&&!v&&!(await un.getWorkspaceAccessibleBinaries(ae)).has(u)){A(`Excluding ${ae.relativeCwd} because it doesn't have a "${u}" script`);continue}if(!(u===r.env.npm_lifecycle_event&&ae.cwd===a.cwd)){if(this.include.length>0&&!dw.default.isMatch(W.stringifyIdent(ae.anchoredLocator),this.include)&&!dw.default.isMatch(ae.relativeCwd,this.include)){A(`Excluding ${ae.relativeCwd} because it doesn't match the --include filter`);continue}if(this.exclude.length>0&&(dw.default.isMatch(W.stringifyIdent(ae.anchoredLocator),this.exclude)||dw.default.isMatch(ae.relativeCwd,this.exclude))){A(`Excluding ${ae.relativeCwd} because it matches the --include filter`);continue}if(this.publicOnly&&ae.manifest.private===!0){A(`Excluding ${ae.relativeCwd} because it's a private workspace and --no-private was set`);continue}I.push(ae)}}if(this.dryRun)return 0;let b=this.verbose??this.context.stdout.isTTY,C=this.parallel?this.jobs==="unlimited"?1/0:Number(this.jobs)||Math.ceil(Ji.availableParallelism()/2):1,T=C===1?!1:this.parallel,L=T?this.interlaced:!0,U=(0,$Be.default)(C),J=new Map,te=new Set,le=0,pe=null,Ae=!1,ye=await Nt.start({configuration:r,stdout:this.context.stdout,includePrefix:!1},async ae=>{let we=async(Pe,{commandIndex:g})=>{if(Ae)return-1;!T&&b&&g>1&&ae.reportSeparator();let Ee=ZDt(Pe,{configuration:r,verbose:b,commandIndex:g}),[De,ce]=ZBe(ae,{prefix:Ee,interlaced:L}),[ne,ee]=ZBe(ae,{prefix:Ee,interlaced:L});try{b&&ae.reportInfo(null,`${Ee} Process started`);let Ie=Date.now(),ke=await this.cli.run([this.commandName,...this.args],{cwd:Pe.cwd,stdout:De,stderr:ne})||0;De.end(),ne.end(),await ce,await ee;let ht=Date.now();if(b){let H=r.get("enableTimers")?`, completed in ${de.pretty(r,ht-Ie,de.Type.DURATION)}`:"";ae.reportInfo(null,`${Ee} Process exited (exit code ${ke})${H}`)}return ke===130&&(Ae=!0,pe=ke),ke}catch(Ie){throw De.end(),ne.end(),await ce,await ee,Ie}};for(let Pe of I)J.set(Pe.anchoredLocator.locatorHash,Pe);for(;J.size>0&&!ae.hasErrors();){let Pe=[];for(let[De,ce]of J){if(te.has(ce.anchoredDescriptor.descriptorHash))continue;let ne=!0;if(this.topological||this.topologicalDev){let ee=this.topologicalDev?new Map([...ce.manifest.dependencies,...ce.manifest.devDependencies]):ce.manifest.dependencies;for(let Ie of ee.values()){let ke=o.tryWorkspaceByDescriptor(Ie);if(ne=ke===null||!J.has(ke.anchoredLocator.locatorHash),!ne)break}}if(!!ne&&(te.add(ce.anchoredDescriptor.descriptorHash),Pe.push(U(async()=>{let ee=await we(ce,{commandIndex:++le});return J.delete(De),te.delete(ce.anchoredDescriptor.descriptorHash),ee})),!T))break}if(Pe.length===0){let De=Array.from(J.values()).map(ce=>W.prettyLocator(r,ce.anchoredLocator)).join(", ");ae.reportError(3,`Dependency cycle detected (${De})`);return}let Ee=(await Promise.all(Pe)).find(De=>De!==0);pe===null&&(pe=typeof Ee<"u"?1:pe),(this.topological||this.topologicalDev)&&typeof Ee<"u"&&ae.reportError(0,"The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph")}});return pe!==null?pe:ye.exitCode()}};op.paths=[["workspaces","foreach"]],op.usage=nt.Usage({category:"Workspace-related commands",description:"run a command on all workspaces",details:"\n This command will run a given sub-command on current and all its descendant workspaces. Various flags can alter the exact behavior of the command:\n\n - If `-p,--parallel` is set, the commands will be ran in parallel; they'll by default be limited to a number of parallel tasks roughly equal to half your core number, but that can be overridden via `-j,--jobs`, or disabled by setting `-j unlimited`.\n\n - If `-p,--parallel` and `-i,--interlaced` are both set, Yarn will print the lines from the output as it receives them. If `-i,--interlaced` wasn't set, it would instead buffer the output from each process and print the resulting buffers only after their source processes have exited.\n\n - If `-t,--topological` is set, Yarn will only run the command after all workspaces that it depends on through the `dependencies` field have successfully finished executing. If `--topological-dev` is set, both the `dependencies` and `devDependencies` fields will be considered when figuring out the wait points.\n\n - If `-A,--all` is set, Yarn will run the command on all the workspaces of a project.\n\n - If `-R,--recursive` is set, Yarn will find workspaces to run the command on by recursively evaluating `dependencies` and `devDependencies` fields, instead of looking at the `workspaces` fields.\n\n - If `-W,--worktree` is set, Yarn will find workspaces to run the command on by looking at the current worktree.\n\n - If `--from` is set, Yarn will use the packages matching the 'from' glob as the starting point for any recursive search.\n\n - If `--since` is set, Yarn will only run the command on workspaces that have been modified since the specified ref. By default Yarn will use the refs specified by the `changesetBaseRefs` configuration option.\n\n - If `--dry-run` is set, Yarn will explain what it would do without actually doing anything.\n\n - The command may apply to only some workspaces through the use of `--include` which acts as a whitelist. The `--exclude` flag will do the opposite and will be a list of packages that mustn't execute the script. Both flags accept glob patterns (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n Adding the `-v,--verbose` flag (automatically enabled in interactive terminal environments) will cause Yarn to print more information; in particular the name of the workspace that generated the output will be printed at the front of each line.\n\n If the command is `run` and the script being run does not exist the child workspace will be skipped without error.\n ",examples:[["Publish all packages","yarn workspaces foreach -A npm publish --tolerate-republish"],["Run the build script on all descendant packages","yarn workspaces foreach -A run build"],["Run the build script on current and all descendant packages in parallel, building package dependencies first","yarn workspaces foreach -Apt run build"],["Run the build script on several packages and all their dependencies, building dependencies first","yarn workspaces foreach -Rpt --from '{workspace-a,workspace-b}' run build"]]}),op.schema=[lI("all",Gu.Forbids,["from","recursive","since","worktree"],{missingIf:"undefined"}),UR(["all","recursive","since","worktree"],{missingIf:"undefined"})];function ZBe(t,{prefix:e,interlaced:r}){let o=t.createStreamReporter(e),a=new je.DefaultStream;a.pipe(o,{end:!1}),a.on("finish",()=>{o.end()});let n=new Promise(A=>{o.on("finish",()=>{A(a.active)})});if(r)return[a,n];let u=new je.BufferStream;return u.pipe(a,{end:!1}),u.on("finish",()=>{a.end()}),[u,n]}function ZDt(t,{configuration:e,commandIndex:r,verbose:o}){if(!o)return null;let n=`[${W.stringifyIdent(t.anchoredLocator)}]:`,u=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],A=u[r%u.length];return de.pretty(e,n,A)}var $Dt={commands:[rg,op]},ePt=$Dt;var fC=()=>({modules:new Map([["@yarnpkg/cli",o2],["@yarnpkg/core",s2],["@yarnpkg/fslib",Vw],["@yarnpkg/libzip",x1],["@yarnpkg/parsers",tI],["@yarnpkg/shell",T1],["clipanion",pI],["semver",tPt],["typanion",Ko],["@yarnpkg/plugin-essentials",tH],["@yarnpkg/plugin-compat",oH],["@yarnpkg/plugin-constraints",BH],["@yarnpkg/plugin-dlx",vH],["@yarnpkg/plugin-exec",SH],["@yarnpkg/plugin-file",bH],["@yarnpkg/plugin-git",eH],["@yarnpkg/plugin-github",FH],["@yarnpkg/plugin-http",TH],["@yarnpkg/plugin-init",RH],["@yarnpkg/plugin-interactive-tools",Lj],["@yarnpkg/plugin-link",Mj],["@yarnpkg/plugin-nm",Cq],["@yarnpkg/plugin-npm",EG],["@yarnpkg/plugin-npm-cli",xG],["@yarnpkg/plugin-pack",hG],["@yarnpkg/plugin-patch",NG],["@yarnpkg/plugin-pnp",lq],["@yarnpkg/plugin-pnpm",OG],["@yarnpkg/plugin-stage",YG],["@yarnpkg/plugin-typescript",WG],["@yarnpkg/plugin-version",XG],["@yarnpkg/plugin-workspace-tools",ZG]]),plugins:new Set(["@yarnpkg/plugin-essentials","@yarnpkg/plugin-compat","@yarnpkg/plugin-constraints","@yarnpkg/plugin-dlx","@yarnpkg/plugin-exec","@yarnpkg/plugin-file","@yarnpkg/plugin-git","@yarnpkg/plugin-github","@yarnpkg/plugin-http","@yarnpkg/plugin-init","@yarnpkg/plugin-interactive-tools","@yarnpkg/plugin-link","@yarnpkg/plugin-nm","@yarnpkg/plugin-npm","@yarnpkg/plugin-npm-cli","@yarnpkg/plugin-pack","@yarnpkg/plugin-patch","@yarnpkg/plugin-pnp","@yarnpkg/plugin-pnpm","@yarnpkg/plugin-stage","@yarnpkg/plugin-typescript","@yarnpkg/plugin-version","@yarnpkg/plugin-workspace-tools"])});function rve({cwd:t,pluginConfiguration:e}){let r=new as({binaryLabel:"Yarn Package Manager",binaryName:"yarn",binaryVersion:tn??""});return Object.assign(r,{defaultContext:{...as.defaultContext,cwd:t,plugins:e,quiet:!1,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr}})}function rPt(t){if(je.parseOptionalBoolean(process.env.YARN_IGNORE_NODE))return!0;let r=process.versions.node,o=">=18.12.0";if(kr.satisfiesWithPrereleases(r,o))return!0;let a=new it(`This tool requires a Node version compatible with ${o} (got ${r}). Upgrade Node, or set \`YARN_IGNORE_NODE=1\` in your environment.`);return as.defaultContext.stdout.write(t.error(a)),!1}async function nve({selfPath:t,pluginConfiguration:e}){return await Ve.find(ue.toPortablePath(process.cwd()),e,{strict:!1,usePathCheck:t})}function nPt(t,e,{yarnPath:r}){if(!oe.existsSync(r))return t.error(new Error(`The "yarn-path" option has been set, but the specified location doesn't exist (${r}).`)),1;process.on("SIGINT",()=>{});let o={stdio:"inherit",env:{...process.env,YARN_IGNORE_PATH:"1"}};try{(0,eve.execFileSync)(process.execPath,[ue.fromPortablePath(r),...e],o)}catch(a){return a.status??1}return 0}function iPt(t,e){let r=null,o=e;return e.length>=2&&e[0]==="--cwd"?(r=ue.toPortablePath(e[1]),o=e.slice(2)):e.length>=1&&e[0].startsWith("--cwd=")?(r=ue.toPortablePath(e[0].slice(6)),o=e.slice(1)):e[0]==="add"&&e[e.length-2]==="--cwd"&&(r=ue.toPortablePath(e[e.length-1]),o=e.slice(0,e.length-2)),t.defaultContext.cwd=r!==null?K.resolve(r):K.cwd(),o}function sPt(t,{configuration:e}){if(!e.get("enableTelemetry")||tve.isCI||!process.stdout.isTTY)return;Ve.telemetry=new cC(e,"puba9cdc10ec5790a2cf4969dd413a47270");let o=/^@yarnpkg\/plugin-(.*)$/;for(let a of e.plugins.keys())uC.has(a.match(o)?.[1]??"")&&Ve.telemetry?.reportPluginName(a);t.binaryVersion&&Ve.telemetry.reportVersion(t.binaryVersion)}function ive(t,{configuration:e}){for(let r of e.plugins.values())for(let o of r.commands||[])t.register(o)}async function oPt(t,e,{selfPath:r,pluginConfiguration:o}){if(!rPt(t))return 1;let a=await nve({selfPath:r,pluginConfiguration:o}),n=a.get("yarnPath"),u=a.get("ignorePath");if(n&&!u)return nPt(t,e,{yarnPath:n});delete process.env.YARN_IGNORE_PATH;let A=iPt(t,e);sPt(t,{configuration:a}),ive(t,{configuration:a});let p=t.process(A,t.defaultContext);return p.help||Ve.telemetry?.reportCommandName(p.path.join(" ")),await t.run(p,t.defaultContext)}async function the({cwd:t=K.cwd(),pluginConfiguration:e=fC()}={}){let r=rve({cwd:t,pluginConfiguration:e}),o=await nve({pluginConfiguration:e,selfPath:null});return ive(r,{configuration:o}),r}async function sk(t,{cwd:e=K.cwd(),selfPath:r,pluginConfiguration:o}){let a=rve({cwd:e,pluginConfiguration:o});try{process.exitCode=await oPt(a,t,{selfPath:r,pluginConfiguration:o})}catch(n){as.defaultContext.stdout.write(a.error(n)),process.exitCode=1}finally{await oe.rmtempPromise()}}sk(process.argv.slice(2),{cwd:K.cwd(),selfPath:ue.toPortablePath(ue.resolve(process.argv[1])),pluginConfiguration:fC()});})(); +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ +/*! + * buildToken + * Builds OAuth token prefix (helper function) + * + * @name buildToken + * @function + * @param {GitUrl} obj The parsed Git url object. + * @return {String} token prefix + */ +/*! + * fill-range + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Licensed under the MIT License. + */ +/*! + * is-extglob + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ +/*! + * is-glob + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ +/*! + * is-number + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. + */ +/*! + * is-windows + * + * Copyright © 2015-2018, Jon Schlinkert. + * Released under the MIT License. + */ +/*! + * to-regex-range + * + * Copyright (c) 2015-present, Jon Schlinkert. + * Released under the MIT License. + */ +/** + @license + Copyright (c) 2015, Rebecca Turner + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + */ +/** + @license + Copyright Joyent, Inc. and other Node contributors. + + Permission 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: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE 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. +*/ +/** + @license + Copyright Node.js contributors. All rights reserved. + + Permission 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: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE 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. +*/ +/** + @license + The MIT License (MIT) + + Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com) + + Permission 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: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE 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. +*/ +/** @license React v0.18.0 + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v0.24.0 + * react-reconciler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +/** @license React v16.13.1 + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 00000000..d8e684b6 --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1,5 @@ +checksumBehavior: update + +nodeLinker: node-modules + +yarnPath: .yarn/releases/yarn-4.0.2.cjs diff --git a/package.json b/package.json index cce5c07e..074cc1e3 100644 --- a/package.json +++ b/package.json @@ -162,5 +162,6 @@ "last 1 firefox version", "last 1 safari version" ] - } + }, + "packageManager": "yarn@4.0.2" } diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 00000000..f38af872 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,10155 @@ +# This file is generated by running "yarn install" inside your project. +# Manual changes might be lost - proceed with caution! + +__metadata: + version: 8 + cacheKey: 10c0 + +"@aashutoshrathi/word-wrap@npm:^1.2.3": + version: 1.2.6 + resolution: "@aashutoshrathi/word-wrap@npm:1.2.6" + checksum: 53c2b231a61a46792b39a0d43bc4f4f776bb4542aa57ee04930676802e5501282c2fc8aac14e4cd1f1120ff8b52616b6ff5ab539ad30aa2277d726444b71619f + languageName: node + linkType: hard + +"@ampproject/remapping@npm:^2.2.0, @ampproject/remapping@npm:^2.2.1": + version: 2.2.1 + resolution: "@ampproject/remapping@npm:2.2.1" + dependencies: + "@jridgewell/gen-mapping": "npm:^0.3.0" + "@jridgewell/trace-mapping": "npm:^0.3.9" + checksum: 92ce5915f8901d8c7cd4f4e6e2fe7b9fd335a29955b400caa52e0e5b12ca3796ada7c2f10e78c9c5b0f9c2539dff0ffea7b19850a56e1487aa083531e1e46d43 + languageName: node + linkType: hard + +"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.23.5": + version: 7.23.5 + resolution: "@babel/code-frame@npm:7.23.5" + dependencies: + "@babel/highlight": "npm:^7.23.4" + chalk: "npm:^2.4.2" + checksum: a10e843595ddd9f97faa99917414813c06214f4d9205294013e20c70fbdf4f943760da37dec1d998bf3e6fc20fa2918a47c0e987a7e458663feb7698063ad7c6 + languageName: node + linkType: hard + +"@babel/compat-data@npm:^7.23.5": + version: 7.23.5 + resolution: "@babel/compat-data@npm:7.23.5" + checksum: 081278ed46131a890ad566a59c61600a5f9557bd8ee5e535890c8548192532ea92590742fd74bd9db83d74c669ef8a04a7e1c85cdea27f960233e3b83c3a957c + languageName: node + linkType: hard + +"@babel/core@npm:^7.23.5": + version: 7.23.7 + resolution: "@babel/core@npm:7.23.7" + dependencies: + "@ampproject/remapping": "npm:^2.2.0" + "@babel/code-frame": "npm:^7.23.5" + "@babel/generator": "npm:^7.23.6" + "@babel/helper-compilation-targets": "npm:^7.23.6" + "@babel/helper-module-transforms": "npm:^7.23.3" + "@babel/helpers": "npm:^7.23.7" + "@babel/parser": "npm:^7.23.6" + "@babel/template": "npm:^7.22.15" + "@babel/traverse": "npm:^7.23.7" + "@babel/types": "npm:^7.23.6" + convert-source-map: "npm:^2.0.0" + debug: "npm:^4.1.0" + gensync: "npm:^1.0.0-beta.2" + json5: "npm:^2.2.3" + semver: "npm:^6.3.1" + checksum: 38c9934973d384ed83369712978453eac91dc3f22167404dbdb272b64f602e74728a6f37012c53ee57e521b8ae2da60097f050497d9b6a212d28b59cdfb2cd1d + languageName: node + linkType: hard + +"@babel/generator@npm:^7.23.6": + version: 7.23.6 + resolution: "@babel/generator@npm:7.23.6" + dependencies: + "@babel/types": "npm:^7.23.6" + "@jridgewell/gen-mapping": "npm:^0.3.2" + "@jridgewell/trace-mapping": "npm:^0.3.17" + jsesc: "npm:^2.5.1" + checksum: 53540e905cd10db05d9aee0a5304e36927f455ce66f95d1253bb8a179f286b88fa7062ea0db354c566fe27f8bb96567566084ffd259f8feaae1de5eccc8afbda + languageName: node + linkType: hard + +"@babel/helper-compilation-targets@npm:^7.23.6": + version: 7.23.6 + resolution: "@babel/helper-compilation-targets@npm:7.23.6" + dependencies: + "@babel/compat-data": "npm:^7.23.5" + "@babel/helper-validator-option": "npm:^7.23.5" + browserslist: "npm:^4.22.2" + lru-cache: "npm:^5.1.1" + semver: "npm:^6.3.1" + checksum: ba38506d11185f48b79abf439462ece271d3eead1673dd8814519c8c903c708523428806f05f2ec5efd0c56e4e278698fac967e5a4b5ee842c32415da54bc6fa + languageName: node + linkType: hard + +"@babel/helper-environment-visitor@npm:^7.22.20": + version: 7.22.20 + resolution: "@babel/helper-environment-visitor@npm:7.22.20" + checksum: e762c2d8f5d423af89bd7ae9abe35bd4836d2eb401af868a63bbb63220c513c783e25ef001019418560b3fdc6d9a6fb67e6c0b650bcdeb3a2ac44b5c3d2bdd94 + languageName: node + linkType: hard + +"@babel/helper-function-name@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/helper-function-name@npm:7.23.0" + dependencies: + "@babel/template": "npm:^7.22.15" + "@babel/types": "npm:^7.23.0" + checksum: d771dd1f3222b120518176733c52b7cadac1c256ff49b1889dbbe5e3fed81db855b8cc4e40d949c9d3eae0e795e8229c1c8c24c0e83f27cfa6ee3766696c6428 + languageName: node + linkType: hard + +"@babel/helper-hoist-variables@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-hoist-variables@npm:7.22.5" + dependencies: + "@babel/types": "npm:^7.22.5" + checksum: 60a3077f756a1cd9f14eb89f0037f487d81ede2b7cfe652ea6869cd4ec4c782b0fb1de01b8494b9a2d2050e3d154d7d5ad3be24806790acfb8cbe2073bf1e208 + languageName: node + linkType: hard + +"@babel/helper-module-imports@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/helper-module-imports@npm:7.22.15" + dependencies: + "@babel/types": "npm:^7.22.15" + checksum: 4e0d7fc36d02c1b8c8b3006dfbfeedf7a367d3334a04934255de5128115ea0bafdeb3e5736a2559917f0653e4e437400d54542da0468e08d3cbc86d3bbfa8f30 + languageName: node + linkType: hard + +"@babel/helper-module-transforms@npm:^7.23.3": + version: 7.23.3 + resolution: "@babel/helper-module-transforms@npm:7.23.3" + dependencies: + "@babel/helper-environment-visitor": "npm:^7.22.20" + "@babel/helper-module-imports": "npm:^7.22.15" + "@babel/helper-simple-access": "npm:^7.22.5" + "@babel/helper-split-export-declaration": "npm:^7.22.6" + "@babel/helper-validator-identifier": "npm:^7.22.20" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 211e1399d0c4993671e8e5c2b25383f08bee40004ace5404ed4065f0e9258cc85d99c1b82fd456c030ce5cfd4d8f310355b54ef35de9924eabfc3dff1331d946 + languageName: node + linkType: hard + +"@babel/helper-plugin-utils@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-plugin-utils@npm:7.22.5" + checksum: d2c4bfe2fa91058bcdee4f4e57a3f4933aed7af843acfd169cd6179fab8d13c1d636474ecabb2af107dc77462c7e893199aa26632bac1c6d7e025a17cbb9d20d + languageName: node + linkType: hard + +"@babel/helper-simple-access@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-simple-access@npm:7.22.5" + dependencies: + "@babel/types": "npm:^7.22.5" + checksum: f0cf81a30ba3d09a625fd50e5a9069e575c5b6719234e04ee74247057f8104beca89ed03e9217b6e9b0493434cedc18c5ecca4cea6244990836f1f893e140369 + languageName: node + linkType: hard + +"@babel/helper-split-export-declaration@npm:^7.22.6": + version: 7.22.6 + resolution: "@babel/helper-split-export-declaration@npm:7.22.6" + dependencies: + "@babel/types": "npm:^7.22.5" + checksum: d83e4b623eaa9622c267d3c83583b72f3aac567dc393dda18e559d79187961cb29ae9c57b2664137fc3d19508370b12ec6a81d28af73a50e0846819cb21c6e44 + languageName: node + linkType: hard + +"@babel/helper-string-parser@npm:^7.23.4": + version: 7.23.4 + resolution: "@babel/helper-string-parser@npm:7.23.4" + checksum: f348d5637ad70b6b54b026d6544bd9040f78d24e7ec245a0fc42293968181f6ae9879c22d89744730d246ce8ec53588f716f102addd4df8bbc79b73ea10004ac + languageName: node + linkType: hard + +"@babel/helper-validator-identifier@npm:^7.22.20": + version: 7.22.20 + resolution: "@babel/helper-validator-identifier@npm:7.22.20" + checksum: dcad63db345fb110e032de46c3688384b0008a42a4845180ce7cd62b1a9c0507a1bed727c4d1060ed1a03ae57b4d918570259f81724aaac1a5b776056f37504e + languageName: node + linkType: hard + +"@babel/helper-validator-option@npm:^7.23.5": + version: 7.23.5 + resolution: "@babel/helper-validator-option@npm:7.23.5" + checksum: af45d5c0defb292ba6fd38979e8f13d7da63f9623d8ab9ededc394f67eb45857d2601278d151ae9affb6e03d5d608485806cd45af08b4468a0515cf506510e94 + languageName: node + linkType: hard + +"@babel/helpers@npm:^7.23.7": + version: 7.23.8 + resolution: "@babel/helpers@npm:7.23.8" + dependencies: + "@babel/template": "npm:^7.22.15" + "@babel/traverse": "npm:^7.23.7" + "@babel/types": "npm:^7.23.6" + checksum: d9fce49278a31aaa017a40c1fcdaa450999c49e33582cce8138058c58b1acbe3a2d2488f010f28e91dedf0d35795ea32f0ee18745bbb6c7f54052ae0fd7e6a3f + languageName: node + linkType: hard + +"@babel/highlight@npm:^7.23.4": + version: 7.23.4 + resolution: "@babel/highlight@npm:7.23.4" + dependencies: + "@babel/helper-validator-identifier": "npm:^7.22.20" + chalk: "npm:^2.4.2" + js-tokens: "npm:^4.0.0" + checksum: fbff9fcb2f5539289c3c097d130e852afd10d89a3a08ac0b5ebebbc055cc84a4bcc3dcfed463d488cde12dd0902ef1858279e31d7349b2e8cee43913744bda33 + languageName: node + linkType: hard + +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.23.6": + version: 7.23.6 + resolution: "@babel/parser@npm:7.23.6" + bin: + parser: ./bin/babel-parser.js + checksum: 6f76cd5ccae1fa9bcab3525b0865c6222e9c1d22f87abc69f28c5c7b2c8816a13361f5bd06bddbd5faf903f7320a8feba02545c981468acec45d12a03db7755e + languageName: node + linkType: hard + +"@babel/plugin-transform-react-jsx-self@npm:^7.23.3": + version: 7.23.3 + resolution: "@babel/plugin-transform-react-jsx-self@npm:7.23.3" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.22.5" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 6b586508fc58998483d4ee93a7e784c4f4d2350e2633739cf1990b7ad172e13906f72382fdaf7f07b4e3c7e7555342634d392bdeb1a079bb64762c6368ca9a32 + languageName: node + linkType: hard + +"@babel/plugin-transform-react-jsx-source@npm:^7.23.3": + version: 7.23.3 + resolution: "@babel/plugin-transform-react-jsx-source@npm:7.23.3" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.22.5" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: a3aad7cf738e9bfaddc26cdbb83bb9684c2e689d26fb0793d772af0c8da0cd25bb02523d192fbc6946c32143e56b472c1d33fa82466b3f2d3346e1ce8fe83cf6 + languageName: node + linkType: hard + +"@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.14.0, @babel/runtime@npm:^7.2.0, @babel/runtime@npm:^7.23.2": + version: 7.23.8 + resolution: "@babel/runtime@npm:7.23.8" + dependencies: + regenerator-runtime: "npm:^0.14.0" + checksum: ba5e8fbb32ef04f6cab5e89c54a0497c2fde7b730595cc1af93496270314f13ff2c6a9360fdb2f0bdd4d6b376752ce3cf85642bd6b876969a6a62954934c2df8 + languageName: node + linkType: hard + +"@babel/template@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/template@npm:7.22.15" + dependencies: + "@babel/code-frame": "npm:^7.22.13" + "@babel/parser": "npm:^7.22.15" + "@babel/types": "npm:^7.22.15" + checksum: 9312edd37cf1311d738907003f2aa321a88a42ba223c69209abe4d7111db019d321805504f606c7fd75f21c6cf9d24d0a8223104cd21ebd207e241b6c551f454 + languageName: node + linkType: hard + +"@babel/traverse@npm:^7.23.7": + version: 7.23.7 + resolution: "@babel/traverse@npm:7.23.7" + dependencies: + "@babel/code-frame": "npm:^7.23.5" + "@babel/generator": "npm:^7.23.6" + "@babel/helper-environment-visitor": "npm:^7.22.20" + "@babel/helper-function-name": "npm:^7.23.0" + "@babel/helper-hoist-variables": "npm:^7.22.5" + "@babel/helper-split-export-declaration": "npm:^7.22.6" + "@babel/parser": "npm:^7.23.6" + "@babel/types": "npm:^7.23.6" + debug: "npm:^4.3.1" + globals: "npm:^11.1.0" + checksum: e32fceb4249beec2bde83968ddffe17444221c1ee5cd18c543a2feaf94e3ca83f2a4dfbc2dcca87cf226e0105973e0fe3717063a21e982a9de9945615ab3f3f5 + languageName: node + linkType: hard + +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.6, @babel/types@npm:^7.8.3": + version: 7.23.6 + resolution: "@babel/types@npm:7.23.6" + dependencies: + "@babel/helper-string-parser": "npm:^7.23.4" + "@babel/helper-validator-identifier": "npm:^7.22.20" + to-fast-properties: "npm:^2.0.0" + checksum: 42cefce8a68bd09bb5828b4764aa5586c53c60128ac2ac012e23858e1c179347a4aac9c66fc577994fbf57595227611c5ec8270bf0cfc94ff033bbfac0550b70 + languageName: node + linkType: hard + +"@bcoe/v8-coverage@npm:^0.2.3": + version: 0.2.3 + resolution: "@bcoe/v8-coverage@npm:0.2.3" + checksum: 6b80ae4cb3db53f486da2dc63b6e190a74c8c3cca16bb2733f234a0b6a9382b09b146488ae08e2b22cf00f6c83e20f3e040a2f7894f05c045c946d6a090b1d52 + languageName: node + linkType: hard + +"@esbuild/aix-ppc64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/aix-ppc64@npm:0.19.11" + conditions: os=aix & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/android-arm64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/android-arm64@npm:0.18.20" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/android-arm64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/android-arm64@npm:0.19.11" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/android-arm@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/android-arm@npm:0.18.20" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@esbuild/android-arm@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/android-arm@npm:0.19.11" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@esbuild/android-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/android-x64@npm:0.18.20" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/android-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/android-x64@npm:0.19.11" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/darwin-arm64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/darwin-arm64@npm:0.18.20" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/darwin-arm64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/darwin-arm64@npm:0.19.11" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/darwin-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/darwin-x64@npm:0.18.20" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/darwin-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/darwin-x64@npm:0.19.11" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/freebsd-arm64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/freebsd-arm64@npm:0.18.20" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/freebsd-arm64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/freebsd-arm64@npm:0.19.11" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/freebsd-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/freebsd-x64@npm:0.18.20" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/freebsd-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/freebsd-x64@npm:0.19.11" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/linux-arm64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-arm64@npm:0.18.20" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/linux-arm64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-arm64@npm:0.19.11" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/linux-arm@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-arm@npm:0.18.20" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@esbuild/linux-arm@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-arm@npm:0.19.11" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@esbuild/linux-ia32@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-ia32@npm:0.18.20" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/linux-ia32@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-ia32@npm:0.19.11" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/linux-loong64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-loong64@npm:0.18.20" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + +"@esbuild/linux-loong64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-loong64@npm:0.19.11" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + +"@esbuild/linux-mips64el@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-mips64el@npm:0.18.20" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + +"@esbuild/linux-mips64el@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-mips64el@npm:0.19.11" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + +"@esbuild/linux-ppc64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-ppc64@npm:0.18.20" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/linux-ppc64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-ppc64@npm:0.19.11" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/linux-riscv64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-riscv64@npm:0.18.20" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + +"@esbuild/linux-riscv64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-riscv64@npm:0.19.11" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + +"@esbuild/linux-s390x@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-s390x@npm:0.18.20" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + +"@esbuild/linux-s390x@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-s390x@npm:0.19.11" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + +"@esbuild/linux-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/linux-x64@npm:0.18.20" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/linux-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-x64@npm:0.19.11" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/netbsd-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/netbsd-x64@npm:0.18.20" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/netbsd-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/netbsd-x64@npm:0.19.11" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/openbsd-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/openbsd-x64@npm:0.18.20" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/openbsd-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/openbsd-x64@npm:0.19.11" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/sunos-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/sunos-x64@npm:0.18.20" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/sunos-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/sunos-x64@npm:0.19.11" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/win32-arm64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/win32-arm64@npm:0.18.20" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/win32-arm64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/win32-arm64@npm:0.19.11" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/win32-ia32@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/win32-ia32@npm:0.18.20" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/win32-ia32@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/win32-ia32@npm:0.19.11" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/win32-x64@npm:0.18.20": + version: 0.18.20 + resolution: "@esbuild/win32-x64@npm:0.18.20" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/win32-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/win32-x64@npm:0.19.11" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@eslint-community/eslint-utils@npm:^4.2.0": + version: 4.4.0 + resolution: "@eslint-community/eslint-utils@npm:4.4.0" + dependencies: + eslint-visitor-keys: "npm:^3.3.0" + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + checksum: 7e559c4ce59cd3a06b1b5a517b593912e680a7f981ae7affab0d01d709e99cd5647019be8fafa38c350305bc32f1f7d42c7073edde2ab536c745e365f37b607e + languageName: node + linkType: hard + +"@eslint-community/regexpp@npm:^4.4.0, @eslint-community/regexpp@npm:^4.6.1": + version: 4.10.0 + resolution: "@eslint-community/regexpp@npm:4.10.0" + checksum: c5f60ef1f1ea7649fa7af0e80a5a79f64b55a8a8fa5086de4727eb4c86c652aedee407a9c143b8995d2c0b2d75c1222bec9ba5d73dbfc1f314550554f0979ef4 + languageName: node + linkType: hard + +"@eslint/eslintrc@npm:^2.1.4": + version: 2.1.4 + resolution: "@eslint/eslintrc@npm:2.1.4" + dependencies: + ajv: "npm:^6.12.4" + debug: "npm:^4.3.2" + espree: "npm:^9.6.0" + globals: "npm:^13.19.0" + ignore: "npm:^5.2.0" + import-fresh: "npm:^3.2.1" + js-yaml: "npm:^4.1.0" + minimatch: "npm:^3.1.2" + strip-json-comments: "npm:^3.1.1" + checksum: 32f67052b81768ae876c84569ffd562491ec5a5091b0c1e1ca1e0f3c24fb42f804952fdd0a137873bc64303ba368a71ba079a6f691cee25beee9722d94cc8573 + languageName: node + linkType: hard + +"@eslint/js@npm:8.56.0": + version: 8.56.0 + resolution: "@eslint/js@npm:8.56.0" + checksum: 60b3a1cf240e2479cec9742424224465dc50e46d781da1b7f5ef240501b2d1202c225bd456207faac4b34a64f4765833345bc4ddffd00395e1db40fa8c426f5a + languageName: node + linkType: hard + +"@gmod/bam@npm:^1.1.18": + version: 1.1.18 + resolution: "@gmod/bam@npm:1.1.18" + dependencies: + "@gmod/bgzf-filehandle": "npm:^1.4.4" + abortable-promise-cache: "npm:^1.5.0" + buffer-crc32: "npm:^0.2.13" + cross-fetch: "npm:^3.0.2" + generic-filehandle: "npm:^3.0.0" + long: "npm:^4.0.0" + object.entries-ponyfill: "npm:^1.0.1" + quick-lru: "npm:^2.0.0" + checksum: dc5c8fe9293f9aaac0b0e52ee5a9c216b18e22d101c29b0a5ec6ed209b692237678206ad870179971779c84b831bc4d91a56dbaa2bd6c118f2af15891405b61e + languageName: node + linkType: hard + +"@gmod/bbi@npm:^3.0.1": + version: 3.0.1 + resolution: "@gmod/bbi@npm:3.0.1" + dependencies: + abortable-promise-cache: "npm:^1.4.1" + binary-parser: "npm:^2.1.0" + generic-filehandle: "npm:^3.0.0" + pako: "npm:^2.0.0" + quick-lru: "npm:^4.0.0" + rxjs: "npm:^7.8.0" + checksum: 59e0aaa4180e5e7e10f6c54b847917fc243bcd346722c144722d542d571038c5ded2fa3651c82387c4a45c9783850fa11820955ba9b102376fea69831fdefac8 + languageName: node + linkType: hard + +"@gmod/bed@npm:^2.1.2": + version: 2.1.2 + resolution: "@gmod/bed@npm:2.1.2" + checksum: bc2b258f9d70fa37ec6ff60f0a47e0e207069c3a795bae898e14a464b686d169643b8943153770c1311196a77fb690845811562892eb6e5e01a783bd93217267 + languageName: node + linkType: hard + +"@gmod/bgzf-filehandle@npm:^1.3.3, @gmod/bgzf-filehandle@npm:^1.4.4": + version: 1.4.7 + resolution: "@gmod/bgzf-filehandle@npm:1.4.7" + dependencies: + es6-promisify: "npm:^7.0.0" + generic-filehandle: "npm:^3.0.0" + long: "npm:^4.0.0" + pako: "npm:^1.0.11" + checksum: 0e39b37f9806fdfdee13c11b7a174292c55a41b9cea8e7b25eff1195a8926df6016d732cab14fcca0e70e38a68345076cff5f952b5e4ac42ccd72763a9f58f77 + languageName: node + linkType: hard + +"@gmod/gff@npm:^1.3.0": + version: 1.3.0 + resolution: "@gmod/gff@npm:1.3.0" + dependencies: + stream-browserify: "npm:^3.0.0" + bin: + gff-to-json: dist/gff-to-json.js + checksum: abdd48936865e28bac08692494f4ee8160cee3c9030fd9b6de5824052d43f8dc005c25766918c45e7280a58c57f246b382dddc88079f6b011c90ebffe871d75d + languageName: node + linkType: hard + +"@gmod/tabix@npm:^1.5.6": + version: 1.5.11 + resolution: "@gmod/tabix@npm:1.5.11" + dependencies: + "@gmod/bgzf-filehandle": "npm:^1.3.3" + abortable-promise-cache: "npm:^1.4.1" + generic-filehandle: "npm:^3.0.0" + long: "npm:^4.0.0" + quick-lru: "npm:^4.0.0" + checksum: 15bc300ebb507066253d95d0f66a87cdb3c0ce29c5edf18fc864bf381294ddb63dfaca5f81c8edcf28dd192b4846000a6565bdc9ebf3f559b391c138c6d5f578 + languageName: node + linkType: hard + +"@gmod/vcf@npm:^5.0.10": + version: 5.0.10 + resolution: "@gmod/vcf@npm:5.0.10" + checksum: fa9dc40a4dea90b387d3e6b78df02c131482366efd72191ed62af5eb5f1e63369fa7215823d9a11a5acc9ca0e42c91d4bcae8b954344871f006b165718a1d111 + languageName: node + linkType: hard + +"@humanwhocodes/config-array@npm:^0.11.13": + version: 0.11.13 + resolution: "@humanwhocodes/config-array@npm:0.11.13" + dependencies: + "@humanwhocodes/object-schema": "npm:^2.0.1" + debug: "npm:^4.1.1" + minimatch: "npm:^3.0.5" + checksum: d76ca802d853366094d0e98ff0d0994117fc8eff96649cd357b15e469e428228f597cd2e929d54ab089051684949955f16ee905bb19f7b2f0446fb377157be7a + languageName: node + linkType: hard + +"@humanwhocodes/module-importer@npm:^1.0.1": + version: 1.0.1 + resolution: "@humanwhocodes/module-importer@npm:1.0.1" + checksum: 909b69c3b86d482c26b3359db16e46a32e0fb30bd306a3c176b8313b9e7313dba0f37f519de6aa8b0a1921349e505f259d19475e123182416a506d7f87e7f529 + languageName: node + linkType: hard + +"@humanwhocodes/object-schema@npm:^2.0.1": + version: 2.0.1 + resolution: "@humanwhocodes/object-schema@npm:2.0.1" + checksum: 9dba24e59fdb4041829d92b693aacb778add3b6f612aaa9c0774f3b650c11a378cc64f042a59da85c11dae33df456580a3c36837b953541aed6ff94294f97fac + languageName: node + linkType: hard + +"@hutson/parse-repository-url@npm:^3.0.0": + version: 3.0.2 + resolution: "@hutson/parse-repository-url@npm:3.0.2" + checksum: d9197757ecad2df18d29d3e1d1fe0716d458fd88b849c71cbec9e78239f911074c97e8d764dfd8ed890431c1137e52dd7a337207fd65be20ce0784f7860ae4d1 + languageName: node + linkType: hard + +"@icons/material@npm:^0.2.4": + version: 0.2.4 + resolution: "@icons/material@npm:0.2.4" + peerDependencies: + react: "*" + checksum: 133518adf91010704b716e7671fc28bcc3c461dc4f4a56ad3a73a955b9993dfaa22494579e9377247fd3318baebe8e4ae7962c01bffeaca0044722c09baa9d73 + languageName: node + linkType: hard + +"@isaacs/cliui@npm:^8.0.2": + version: 8.0.2 + resolution: "@isaacs/cliui@npm:8.0.2" + dependencies: + string-width: "npm:^5.1.2" + string-width-cjs: "npm:string-width@^4.2.0" + strip-ansi: "npm:^7.0.1" + strip-ansi-cjs: "npm:strip-ansi@^6.0.1" + wrap-ansi: "npm:^8.1.0" + wrap-ansi-cjs: "npm:wrap-ansi@^7.0.0" + checksum: b1bf42535d49f11dc137f18d5e4e63a28c5569de438a221c369483731e9dac9fb797af554e8bf02b6192d1e5eba6e6402cf93900c3d0ac86391d00d04876789e + languageName: node + linkType: hard + +"@istanbuljs/schema@npm:^0.1.2, @istanbuljs/schema@npm:^0.1.3": + version: 0.1.3 + resolution: "@istanbuljs/schema@npm:0.1.3" + checksum: 61c5286771676c9ca3eb2bd8a7310a9c063fb6e0e9712225c8471c582d157392c88f5353581c8c9adbe0dff98892317d2fdfc56c3499aa42e0194405206a963a + languageName: node + linkType: hard + +"@jest/schemas@npm:^29.6.3": + version: 29.6.3 + resolution: "@jest/schemas@npm:29.6.3" + dependencies: + "@sinclair/typebox": "npm:^0.27.8" + checksum: b329e89cd5f20b9278ae1233df74016ebf7b385e0d14b9f4c1ad18d096c4c19d1e687aa113a9c976b16ec07f021ae53dea811fb8c1248a50ac34fbe009fdf6be + languageName: node + linkType: hard + +"@jridgewell/gen-mapping@npm:^0.3.0, @jridgewell/gen-mapping@npm:^0.3.2": + version: 0.3.3 + resolution: "@jridgewell/gen-mapping@npm:0.3.3" + dependencies: + "@jridgewell/set-array": "npm:^1.0.1" + "@jridgewell/sourcemap-codec": "npm:^1.4.10" + "@jridgewell/trace-mapping": "npm:^0.3.9" + checksum: 376fc11cf5a967318ba3ddd9d8e91be528eab6af66810a713c49b0c3f8dc67e9949452c51c38ab1b19aa618fb5e8594da5a249977e26b1e7fea1ee5a1fcacc74 + languageName: node + linkType: hard + +"@jridgewell/resolve-uri@npm:^3.1.0": + version: 3.1.1 + resolution: "@jridgewell/resolve-uri@npm:3.1.1" + checksum: 0dbc9e29bc640bbbdc5b9876d2859c69042bfcf1423c1e6421bcca53e826660bff4e41c7d4bcb8dbea696404231a6f902f76ba41835d049e20f2dd6cffb713bf + languageName: node + linkType: hard + +"@jridgewell/set-array@npm:^1.0.1": + version: 1.1.2 + resolution: "@jridgewell/set-array@npm:1.1.2" + checksum: bc7ab4c4c00470de4e7562ecac3c0c84f53e7ee8a711e546d67c47da7febe7c45cd67d4d84ee3c9b2c05ae8e872656cdded8a707a283d30bd54fbc65aef821ab + languageName: node + linkType: hard + +"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14, @jridgewell/sourcemap-codec@npm:^1.4.15": + version: 1.4.15 + resolution: "@jridgewell/sourcemap-codec@npm:1.4.15" + checksum: 0c6b5ae663087558039052a626d2d7ed5208da36cfd707dcc5cea4a07cfc918248403dcb5989a8f7afaf245ce0573b7cc6fd94c4a30453bd10e44d9363940ba5 + languageName: node + linkType: hard + +"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.9": + version: 0.3.20 + resolution: "@jridgewell/trace-mapping@npm:0.3.20" + dependencies: + "@jridgewell/resolve-uri": "npm:^3.1.0" + "@jridgewell/sourcemap-codec": "npm:^1.4.14" + checksum: 0ea0b2675cf513ec44dc25605616a3c9b808b9832e74b5b63c44260d66b58558bba65764f81928fc1033ead911f8718dca1134049c3e7a93937faf436671df31 + languageName: node + linkType: hard + +"@juggle/resize-observer@npm:^3.3.1": + version: 3.4.0 + resolution: "@juggle/resize-observer@npm:3.4.0" + checksum: 12930242357298c6f2ad5d4ec7cf631dfb344ca7c8c830ab7f64e6ac11eb1aae486901d8d880fd08fb1b257800c160a0da3aee1e7ed9adac0ccbb9b7c5d93347 + languageName: node + linkType: hard + +"@nodelib/fs.scandir@npm:2.1.5": + version: 2.1.5 + resolution: "@nodelib/fs.scandir@npm:2.1.5" + dependencies: + "@nodelib/fs.stat": "npm:2.0.5" + run-parallel: "npm:^1.1.9" + checksum: 732c3b6d1b1e967440e65f284bd06e5821fedf10a1bea9ed2bb75956ea1f30e08c44d3def9d6a230666574edbaf136f8cfd319c14fd1f87c66e6a44449afb2eb + languageName: node + linkType: hard + +"@nodelib/fs.stat@npm:2.0.5, @nodelib/fs.stat@npm:^2.0.2": + version: 2.0.5 + resolution: "@nodelib/fs.stat@npm:2.0.5" + checksum: 88dafe5e3e29a388b07264680dc996c17f4bda48d163a9d4f5c1112979f0ce8ec72aa7116122c350b4e7976bc5566dc3ddb579be1ceaacc727872eb4ed93926d + languageName: node + linkType: hard + +"@nodelib/fs.walk@npm:^1.2.3, @nodelib/fs.walk@npm:^1.2.8": + version: 1.2.8 + resolution: "@nodelib/fs.walk@npm:1.2.8" + dependencies: + "@nodelib/fs.scandir": "npm:2.1.5" + fastq: "npm:^1.6.0" + checksum: db9de047c3bb9b51f9335a7bb46f4fcfb6829fb628318c12115fbaf7d369bfce71c15b103d1fc3b464812d936220ee9bc1c8f762d032c9f6be9acc99249095b1 + languageName: node + linkType: hard + +"@npmcli/agent@npm:^2.0.0": + version: 2.2.0 + resolution: "@npmcli/agent@npm:2.2.0" + dependencies: + agent-base: "npm:^7.1.0" + http-proxy-agent: "npm:^7.0.0" + https-proxy-agent: "npm:^7.0.1" + lru-cache: "npm:^10.0.1" + socks-proxy-agent: "npm:^8.0.1" + checksum: 7b89590598476dda88e79c473766b67c682aae6e0ab0213491daa6083dcc0c171f86b3868f5506f22c09aa5ea69ad7dfb78f4bf39a8dca375d89a42f408645b3 + languageName: node + linkType: hard + +"@npmcli/fs@npm:^3.1.0": + version: 3.1.0 + resolution: "@npmcli/fs@npm:3.1.0" + dependencies: + semver: "npm:^7.3.5" + checksum: 162b4a0b8705cd6f5c2470b851d1dc6cd228c86d2170e1769d738c1fbb69a87160901411c3c035331e9e99db72f1f1099a8b734bf1637cc32b9a5be1660e4e1e + languageName: node + linkType: hard + +"@pixi/accessibility@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/accessibility@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + "@pixi/display": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: a7d3f824158dd0809935a765b1493e74751a99233f16a9c2024768ce6ae4a53bbe3b748a87a3314eccc14911c130f29b3e2f2fd011c755f845aa556b373d8733 + languageName: node + linkType: hard + +"@pixi/app@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/app@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + "@pixi/display": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: 1aef574452a90f3bd6c9d3d30a2b4e36d7465d1991973ae73d81e0e1938c7d2b05ae83404632c11c3eea6b4962811df8d3db6a5b3e487cadd4b9fa0d983acdc4 + languageName: node + linkType: hard + +"@pixi/compressed-textures@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/compressed-textures@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/loaders": 6.5.10 + "@pixi/settings": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: 2d7814ccebe8dc0328238d79d754b845b278f71bf324e84eae37b9bb980103d98d323a99ccc4a773a9484ffceab444b8462f47248548d6a6602be0461c899e38 + languageName: node + linkType: hard + +"@pixi/constants@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/constants@npm:6.5.10" + checksum: e99e9628c084e7a0640a7b628341594fb73b618a82084bc6b9bbe7040e1ed2b396346414ebb1ef9b56d593b864c3b967f768184fee70e42103470d3e38be40e2 + languageName: node + linkType: hard + +"@pixi/core@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/core@npm:6.5.10" + dependencies: + "@types/offscreencanvas": "npm:^2019.6.4" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/extensions": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/runner": 6.5.10 + "@pixi/settings": 6.5.10 + "@pixi/ticker": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: dbcb1daf85bff334d869e9debd9427371f4e80f316a525416d7b571401d9b8289628d1810eaafb813348c60e96eb8063bab7d5c1417d515f2a30d2ba14e3dcfc + languageName: node + linkType: hard + +"@pixi/display@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/display@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/settings": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: e9ae587a0f9277ccfd24c78f3039979c91ae8cabdb30d98d89bb1dce65d12961da6ff2cd1cecc47b7afc79acd8e6c2581e150659187571d815afcfbf0df70c88 + languageName: node + linkType: hard + +"@pixi/extensions@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/extensions@npm:6.5.10" + checksum: 2e2eb40adafe639e22e7ed2650d393c1349e47eef34b2350c4ddac54bfde0322bc674afeb01edb73e65ce458ae9b248e6d28e59520878f23f6766ac12c9aef77 + languageName: node + linkType: hard + +"@pixi/extract@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/extract@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: f0adbc817f664a248323ec2a253db71701fb8f5ad0ddc2ed559ffeff69ad0ff32df2cf0f87cdf4b7e87ad454e4cdbe0d50b1b918d99ed2a5c4d650958738b5c1 + languageName: node + linkType: hard + +"@pixi/filter-alpha@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/filter-alpha@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + checksum: 6e747ba786e7ea5aed46ac3972fe9e2ca152bd34c80668514be2ff92b455e7a073732d1a1cde4fac669c0c5ebd0027ed3b3e774ed2e5a5ef10e7e87b74b3333b + languageName: node + linkType: hard + +"@pixi/filter-blur@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/filter-blur@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/settings": 6.5.10 + checksum: 5a653b32a3467a4a6f6d94831c036fcf3e839272a1a0e8a534058d1935122d83d92956644ada6a1cbac459469d4e39648140a872b58792ae9ad390166516e73b + languageName: node + linkType: hard + +"@pixi/filter-color-matrix@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/filter-color-matrix@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + checksum: 428e1857d85c3cbfb293fee1e65fc03abd519c5354e1d49c2f06b8efef70d62dc5da47b12816efe3b05bb99dce31cc02936730047134b99268b47c27e797a8ab + languageName: node + linkType: hard + +"@pixi/filter-displacement@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/filter-displacement@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + "@pixi/math": 6.5.10 + checksum: dc6144383cf620eba04737c564a1544811869d16c240b891727e43016626dc1eb1312ccebcf61da370f034830e4cc4bb4d61e7f61c1e727cfe22ed5fdd9fe88b + languageName: node + linkType: hard + +"@pixi/filter-fxaa@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/filter-fxaa@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + checksum: c1aee8b934e7e6d3ce521569607f11ff80838734ccfa1e0957884530350e738e8d8cd04c147417cc63e3c932778fa46abb0f04024d276ae140853352147ff39a + languageName: node + linkType: hard + +"@pixi/filter-noise@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/filter-noise@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + checksum: 166d8e4411b1f4de06193c6ba45bc414d79f0385d506cfd97c19ff210f6c6e5a8eadaac424ae5b93aab01d1a275ec46b1265a71503a6155c1fe28ec8718f0ef7 + languageName: node + linkType: hard + +"@pixi/graphics@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/graphics@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/display": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/sprite": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: 543495a5641b383818084bf46611dda51936364f83ca810322fbb5b7930edb940380ad3de43eaeb09d690b1b454861cec225ac84bb0d7f0abf486e428fcb3b8f + languageName: node + linkType: hard + +"@pixi/interaction@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/interaction@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + "@pixi/display": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/ticker": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: da549136a081e47674857e3921790555f2d74b7fcda5f13d9f0659ed4a097efde6090c79ab1dd1b434f8f3ea64a42da1f3353f3c932649e8c01c406c0799de50 + languageName: node + linkType: hard + +"@pixi/loaders@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/loaders@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: 10913f40213f2224f47d693494fb0860ef3956ccbdc3c401e3ca33c165322aa926295ece7c4478d6a6641866b5596325782323c8cd83c8fa5e14473a25f6c860 + languageName: node + linkType: hard + +"@pixi/math@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/math@npm:6.5.10" + checksum: e1bf937324a43ae0789b16adb325172eef47aa81005ba4418cadaceff425887a07adedcf023b1b34f6d834c4c47a6b3a6eedf79aa4ba4ba7787148bdecaae5a6 + languageName: node + linkType: hard + +"@pixi/mesh-extras@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/mesh-extras@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/mesh": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: 56defcac31961dc68b09af858377f9c476a53057d210c3a55cbfd34e629e585ffd7e71edcf444fb48669b8b862ef5677fbf97a6d958f389f16fced5bf7e30c00 + languageName: node + linkType: hard + +"@pixi/mesh@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/mesh@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/display": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/settings": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: a7a1cf8d82aee6ef0b36ab5195c8bd30d04fd306aa22683ff402436fdde84fdf198cae4bca0a638920d5bce9c2c1d13219f4b7ad2d7c36a0a2b356b38b0bf036 + languageName: node + linkType: hard + +"@pixi/mixin-cache-as-bitmap@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/mixin-cache-as-bitmap@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/display": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/settings": 6.5.10 + "@pixi/sprite": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: bd70ab36ce6f2a5fdfccfa823a24049273a89feaa2ac4873715c96aca0ba872c9b715c2608dba91de3629560c308ce2469b650ac1aafc69f5dd3c184b81eff67 + languageName: node + linkType: hard + +"@pixi/mixin-get-child-by-name@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/mixin-get-child-by-name@npm:6.5.10" + peerDependencies: + "@pixi/display": 6.5.10 + checksum: dfcef70a05c78c69e9f748a617e6895a964f6190fad8dc10b4a9c6bf41a4e6a39816c6df2c7a7af66a39ddd2fb1c670de878abfe3ec5d195a858a705ac41d6de + languageName: node + linkType: hard + +"@pixi/mixin-get-global-position@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/mixin-get-global-position@npm:6.5.10" + peerDependencies: + "@pixi/display": 6.5.10 + "@pixi/math": 6.5.10 + checksum: 6ef4406ffd8fe7260694786a43817de706514f45aaf866bef37f9ae62e85ad1ecd6a4aa51973e385cdc166708a7707fd79a55d45f7afd9ebe2ccc0c160d13a77 + languageName: node + linkType: hard + +"@pixi/particle-container@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/particle-container@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/display": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/sprite": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: 2c30101fd02588c91e40dcd3dedf384ea617283d1b9e78397d16910b37bac067d8ae6ddeb237711622654b8a297bb0afd8f064a065693189c9197a921c3aa0c2 + languageName: node + linkType: hard + +"@pixi/polyfill@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/polyfill@npm:6.5.10" + dependencies: + object-assign: "npm:^4.1.1" + promise-polyfill: "npm:^8.2.0" + checksum: 2f4fae4bb9f220b348518185bb8534e02c39559c5265260ea72d1eef7cb9030dd9e9a31a6f058a9d265cb3b62316c1c5849594b128918d39bf8ada82c0317cae + languageName: node + linkType: hard + +"@pixi/prepare@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/prepare@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + "@pixi/display": 6.5.10 + "@pixi/graphics": 6.5.10 + "@pixi/settings": 6.5.10 + "@pixi/text": 6.5.10 + "@pixi/ticker": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: de46277912b1b3873402535353e69478bb80d043190d6767e6ec6a7d66ccd83ca064c475240ee8428b309059ea516e0e35d5e9d66702ac94cf5a0a324eb4939c + languageName: node + linkType: hard + +"@pixi/runner@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/runner@npm:6.5.10" + checksum: 547aada4701d4b0eb83ad94b3dc21a3d1dbd575185b483a47195f3fddf5f63cfd18ccd6d2dbf2a28e157d42be7b8ce1d9d97293e6cca89c9c26a2cb127f6e74c + languageName: node + linkType: hard + +"@pixi/settings@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/settings@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + checksum: 9af24c207d947adc26a59f49cdf16ef1a4a21bba6309e642968339a0263480d5ff7b29e46c276cefe69e8560e0afce581665692d1523bd67dd2f59b14c4b4a21 + languageName: node + linkType: hard + +"@pixi/sprite-animated@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/sprite-animated@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + "@pixi/sprite": 6.5.10 + "@pixi/ticker": 6.5.10 + checksum: f360e7f35d74d97429e1b8240e6cfe35498adc946c29b0033cf6319ff36f47de34fd9aa7ad31635ec9ae596556499343c582aff3161433f03a84b06261aeedfd + languageName: node + linkType: hard + +"@pixi/sprite-tiling@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/sprite-tiling@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/display": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/sprite": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: c2e1035c17838e5211eb9f44d46b536aa3b388bde254ce95736cd4013a9eda104d4c7a8a40b35258deae97edd7025252ca7ef9bdb67c49206f833ae8ce511039 + languageName: node + linkType: hard + +"@pixi/sprite@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/sprite@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/display": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/settings": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: fb2057f66a2bb115e6822568f578f4a59b55d66290c581ad9c6814eab210402650e244ffcd570759e243a9caf8d7297e516eb218e25af95ebf2c421b925da1a4 + languageName: node + linkType: hard + +"@pixi/spritesheet@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/spritesheet@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + "@pixi/loaders": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: f0ae860c14bd67b437953b07293b0ea2817c35411eed3d6f59f79000f6d4f4288fd6dcf202bc0d19d6be51313958206b6c21292bede98bedbeb96046d93f85ab + languageName: node + linkType: hard + +"@pixi/text-bitmap@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/text-bitmap@npm:6.5.10" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/core": 6.5.10 + "@pixi/display": 6.5.10 + "@pixi/loaders": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/mesh": 6.5.10 + "@pixi/settings": 6.5.10 + "@pixi/text": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: 07a28ed542308a8d4034a9e5437041927cb59d460875cb4614e12b004e31b0f34aba2efdbb137554c807cb318324e41230a71b401145756fe25247715ca8439b + languageName: node + linkType: hard + +"@pixi/text@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/text@npm:6.5.10" + peerDependencies: + "@pixi/core": 6.5.10 + "@pixi/math": 6.5.10 + "@pixi/settings": 6.5.10 + "@pixi/sprite": 6.5.10 + "@pixi/utils": 6.5.10 + checksum: 188c984a6e8219915cba6491b01d1494a4e6cf52dd2450c91d71430b642fcb83d2d4828471319a85aeea61da21a5d917bdec8bf62a3218e48a36974fd2037cdf + languageName: node + linkType: hard + +"@pixi/ticker@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/ticker@npm:6.5.10" + peerDependencies: + "@pixi/extensions": 6.5.10 + "@pixi/settings": 6.5.10 + checksum: bfa0277e00d3348d50da51fe6fda229b8159a0c8a92f3de1834d1b0bf25a9aea52e8cfd28ad57a0a0de90c70f28974dd644b2bb853cf0f8ae70b46c5e2917740 + languageName: node + linkType: hard + +"@pixi/utils@npm:6.5.10": + version: 6.5.10 + resolution: "@pixi/utils@npm:6.5.10" + dependencies: + "@types/earcut": "npm:^2.1.0" + earcut: "npm:^2.2.4" + eventemitter3: "npm:^3.1.0" + url: "npm:^0.11.0" + peerDependencies: + "@pixi/constants": 6.5.10 + "@pixi/settings": 6.5.10 + checksum: 5d4082fe687b5bd5b670ce3eb756ba024a9dc000c4f58d69f150fe4810875f365269993a90195d20d17241ebeccfe39be1ccf2c18ff3bf947d2dff1d0529b7cb + languageName: node + linkType: hard + +"@pkgjs/parseargs@npm:^0.11.0": + version: 0.11.0 + resolution: "@pkgjs/parseargs@npm:0.11.0" + checksum: 5bd7576bb1b38a47a7fc7b51ac9f38748e772beebc56200450c4a817d712232b8f1d3ef70532c80840243c657d491cf6a6be1e3a214cff907645819fdc34aadd + languageName: node + linkType: hard + +"@playwright/test@npm:^1.39.0": + version: 1.40.1 + resolution: "@playwright/test@npm:1.40.1" + dependencies: + playwright: "npm:1.40.1" + bin: + playwright: cli.js + checksum: 1edbc9659fb6a9c5299cacd9a0c7d3fdc88939036642d8f367e13d267d808ae3f88ca9d00e9981e3bcd5f584ccefba38d24eda6b23d27895908f203dc35f339e + languageName: node + linkType: hard + +"@rollup/rollup-android-arm-eabi@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.9.4" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@rollup/rollup-android-arm64@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-android-arm64@npm:4.9.4" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-arm64@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-darwin-arm64@npm:4.9.4" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-x64@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-darwin-x64@npm:4.9.4" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm-gnueabihf@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.9.4" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-gnu@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.9.4" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-musl@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.9.4" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-linux-riscv64-gnu@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.9.4" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-gnu@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.9.4" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-musl@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.9.4" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-win32-arm64-msvc@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.9.4" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-win32-ia32-msvc@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.9.4" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@rollup/rollup-win32-x64-msvc@npm:4.9.4": + version: 4.9.4 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.9.4" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@sinclair/typebox@npm:^0.27.8": + version: 0.27.8 + resolution: "@sinclair/typebox@npm:0.27.8" + checksum: ef6351ae073c45c2ac89494dbb3e1f87cc60a93ce4cde797b782812b6f97da0d620ae81973f104b43c9b7eaa789ad20ba4f6a1359f1cc62f63729a55a7d22d4e + languageName: node + linkType: hard + +"@tootallnate/once@npm:2": + version: 2.0.0 + resolution: "@tootallnate/once@npm:2.0.0" + checksum: 073bfa548026b1ebaf1659eb8961e526be22fa77139b10d60e712f46d2f0f05f4e6c8bec62a087d41088ee9e29faa7f54838568e475ab2f776171003c3920858 + languageName: node + linkType: hard + +"@types/babel__core@npm:^7.20.5": + version: 7.20.5 + resolution: "@types/babel__core@npm:7.20.5" + dependencies: + "@babel/parser": "npm:^7.20.7" + "@babel/types": "npm:^7.20.7" + "@types/babel__generator": "npm:*" + "@types/babel__template": "npm:*" + "@types/babel__traverse": "npm:*" + checksum: bdee3bb69951e833a4b811b8ee9356b69a61ed5b7a23e1a081ec9249769117fa83aaaf023bb06562a038eb5845155ff663e2d5c75dd95c1d5ccc91db012868ff + languageName: node + linkType: hard + +"@types/babel__generator@npm:*": + version: 7.6.8 + resolution: "@types/babel__generator@npm:7.6.8" + dependencies: + "@babel/types": "npm:^7.0.0" + checksum: f0ba105e7d2296bf367d6e055bb22996886c114261e2cb70bf9359556d0076c7a57239d019dee42bb063f565bade5ccb46009bce2044b2952d964bf9a454d6d2 + languageName: node + linkType: hard + +"@types/babel__template@npm:*": + version: 7.4.4 + resolution: "@types/babel__template@npm:7.4.4" + dependencies: + "@babel/parser": "npm:^7.1.0" + "@babel/types": "npm:^7.0.0" + checksum: cc84f6c6ab1eab1427e90dd2b76ccee65ce940b778a9a67be2c8c39e1994e6f5bbc8efa309f6cea8dc6754994524cd4d2896558df76d92e7a1f46ecffee7112b + languageName: node + linkType: hard + +"@types/babel__traverse@npm:*": + version: 7.20.5 + resolution: "@types/babel__traverse@npm:7.20.5" + dependencies: + "@babel/types": "npm:^7.20.7" + checksum: 033abcb2f4c084ad33e30c3efaad82161240f351e3c71b6154ed289946b33b363696c0fbd42502b68e4582a87413c418321f40eb1ea863e34fe525641345e05b + languageName: node + linkType: hard + +"@types/bezier-js@npm:^4.1.0": + version: 4.1.3 + resolution: "@types/bezier-js@npm:4.1.3" + checksum: de13b7ef7c2fc04ffc0bfee7ff81d0332aab0b09df638173ac7e09f21e9b496f37124f0417a5722478ae55269ff2f7effe4924b4218da68027429ea48e61cb6f + languageName: node + linkType: hard + +"@types/chai-subset@npm:^1.3.3": + version: 1.3.5 + resolution: "@types/chai-subset@npm:1.3.5" + dependencies: + "@types/chai": "npm:*" + checksum: d5cfb483917b0fdf245c8c51d1fa35a2c302295dfc5383ee4faa545db49a28ea169650bb1b75de2cd31f6f8e486a856d241acf9e0456fc93cb74ac18dfdfd19d + languageName: node + linkType: hard + +"@types/chai@npm:*, @types/chai@npm:^4.3.5": + version: 4.3.11 + resolution: "@types/chai@npm:4.3.11" + checksum: 0c216ac4a19bfbf8318bb104d32e50704ee2ffc4b538b976c4326e6638fee121462402caa570662227a2a218810388aadb14bdbd3d3d474ec300b00695db448a + languageName: node + linkType: hard + +"@types/d3-array@npm:*, @types/d3-array@npm:^3.2.1": + version: 3.2.1 + resolution: "@types/d3-array@npm:3.2.1" + checksum: 38bf2c778451f4b79ec81a2288cb4312fe3d6449ecdf562970cc339b60f280f31c93a024c7ff512607795e79d3beb0cbda123bb07010167bce32927f71364bca + languageName: node + linkType: hard + +"@types/d3-axis@npm:*": + version: 3.0.6 + resolution: "@types/d3-axis@npm:3.0.6" + dependencies: + "@types/d3-selection": "npm:*" + checksum: d756d42360261f44d8eefd0950c5bb0a4f67a46dd92069da3f723ac36a1e8cb2b9ce6347d836ef19d5b8aef725dbcf8fdbbd6cfbff676ca4b0642df2f78b599a + languageName: node + linkType: hard + +"@types/d3-brush@npm:*": + version: 3.0.6 + resolution: "@types/d3-brush@npm:3.0.6" + dependencies: + "@types/d3-selection": "npm:*" + checksum: fd6e2ac7657a354f269f6b9c58451ffae9d01b89ccb1eb6367fd36d635d2f1990967215ab498e0c0679ff269429c57fad6a2958b68f4d45bc9f81d81672edc01 + languageName: node + linkType: hard + +"@types/d3-chord@npm:*": + version: 3.0.6 + resolution: "@types/d3-chord@npm:3.0.6" + checksum: c5a25eb5389db01e63faec0c5c2ec7cc41c494e9b3201630b494c4e862a60f1aa83fabbc33a829e7e1403941e3c30d206c741559b14406ac2a4239cfdf4b4c17 + languageName: node + linkType: hard + +"@types/d3-color@npm:*, @types/d3-color@npm:^3.1.3": + version: 3.1.3 + resolution: "@types/d3-color@npm:3.1.3" + checksum: 65eb0487de606eb5ad81735a9a5b3142d30bc5ea801ed9b14b77cb14c9b909f718c059f13af341264ee189acf171508053342142bdf99338667cea26a2d8d6ae + languageName: node + linkType: hard + +"@types/d3-contour@npm:*": + version: 3.0.6 + resolution: "@types/d3-contour@npm:3.0.6" + dependencies: + "@types/d3-array": "npm:*" + "@types/geojson": "npm:*" + checksum: e7d83e94719af4576ceb5ac7f277c5806f83ba6c3631744ae391cffc3641f09dfa279470b83053cd0b2acd6784e8749c71141d05bdffa63ca58ffb5b31a0f27c + languageName: node + linkType: hard + +"@types/d3-delaunay@npm:*": + version: 6.0.4 + resolution: "@types/d3-delaunay@npm:6.0.4" + checksum: d154a8864f08c4ea23ecb9bdabcef1c406a25baa8895f0cb08a0ed2799de0d360e597552532ce7086ff0cdffa8f3563f9109d18f0191459d32bb620a36939123 + languageName: node + linkType: hard + +"@types/d3-dispatch@npm:*": + version: 3.0.6 + resolution: "@types/d3-dispatch@npm:3.0.6" + checksum: 405eb7d0ec139fbf72fa6a43b0f3ca8a1f913bb2cb38f607827e63fca8d4393f021f32f3b96b33c93ddbd37789453a0b3624f14f504add5308fd9aec8a46dda0 + languageName: node + linkType: hard + +"@types/d3-drag@npm:*": + version: 3.0.7 + resolution: "@types/d3-drag@npm:3.0.7" + dependencies: + "@types/d3-selection": "npm:*" + checksum: 65e29fa32a87c72d26c44b5e2df3bf15af21cd128386bcc05bcacca255927c0397d0cd7e6062aed5f0abd623490544a9d061c195f5ed9f018fe0b698d99c079d + languageName: node + linkType: hard + +"@types/d3-drag@npm:^2.0.0": + version: 2.0.5 + resolution: "@types/d3-drag@npm:2.0.5" + dependencies: + "@types/d3-selection": "npm:^2" + checksum: f3e7a42e0c71e5927bbec0bbb25fddc8efeb4b56a0dc31fe33a84b5055bab6da0f03c4c807571d9ad566614ec0ee6004f2076b90c23808045d329f39d8b024b6 + languageName: node + linkType: hard + +"@types/d3-dsv@npm:*, @types/d3-dsv@npm:^3.0.1": + version: 3.0.7 + resolution: "@types/d3-dsv@npm:3.0.7" + checksum: c0f01da862465594c8a28278b51c850af3b4239cc22b14fd1a19d7a98f93d94efa477bf59d8071beb285dca45bf614630811451e18e7c52add3a0abfee0a1871 + languageName: node + linkType: hard + +"@types/d3-ease@npm:*": + version: 3.0.2 + resolution: "@types/d3-ease@npm:3.0.2" + checksum: aff5a1e572a937ee9bff6465225d7ba27d5e0c976bd9eacdac2e6f10700a7cb0c9ea2597aff6b43a6ed850a3210030870238894a77ec73e309b4a9d0333f099c + languageName: node + linkType: hard + +"@types/d3-fetch@npm:*": + version: 3.0.7 + resolution: "@types/d3-fetch@npm:3.0.7" + dependencies: + "@types/d3-dsv": "npm:*" + checksum: 3d147efa52a26da1a5d40d4d73e6cebaaa964463c378068062999b93ea3731b27cc429104c21ecbba98c6090e58ef13429db6399238c5e3500162fb3015697a0 + languageName: node + linkType: hard + +"@types/d3-force@npm:*": + version: 3.0.9 + resolution: "@types/d3-force@npm:3.0.9" + checksum: 6d791a48ea570daaada6df93af8c877d58e6b940b3ab4515cde08ed6ed1d4e8e59fd8407efe37a1b3f5fe95867fe83a2974c4314a7924dc19860a5e955c26211 + languageName: node + linkType: hard + +"@types/d3-format@npm:*, @types/d3-format@npm:^3.0.4": + version: 3.0.4 + resolution: "@types/d3-format@npm:3.0.4" + checksum: 3ac1600bf9061a59a228998f7cd3f29e85cbf522997671ba18d4d84d10a2a1aff4f95aceb143fa9960501c3ec351e113fc75884e6a504ace44dc1744083035ee + languageName: node + linkType: hard + +"@types/d3-geo@npm:*": + version: 3.1.0 + resolution: "@types/d3-geo@npm:3.1.0" + dependencies: + "@types/geojson": "npm:*" + checksum: 3745a93439038bb5b0b38facf435f7079812921d46406f5d38deaee59e90084ff742443c7ea0a8446df81a0d81eaf622fe7068cf4117a544bd4aa3b2dc182f88 + languageName: node + linkType: hard + +"@types/d3-hierarchy@npm:*": + version: 3.1.6 + resolution: "@types/d3-hierarchy@npm:3.1.6" + checksum: b4a3704e94285b0ea6d2d44eae803d608bcce3d523b1d31c911a406a81200632a9097d0d397d9f647659cebde6be109d64a828052de4382dc5310d1d5b265dd5 + languageName: node + linkType: hard + +"@types/d3-interpolate@npm:*": + version: 3.0.4 + resolution: "@types/d3-interpolate@npm:3.0.4" + dependencies: + "@types/d3-color": "npm:*" + checksum: 066ebb8da570b518dd332df6b12ae3b1eaa0a7f4f0c702e3c57f812cf529cc3500ec2aac8dc094f31897790346c6b1ebd8cd7a077176727f4860c2b181a65ca4 + languageName: node + linkType: hard + +"@types/d3-path@npm:*": + version: 3.0.2 + resolution: "@types/d3-path@npm:3.0.2" + checksum: 04f0622f766c0a5ead4656d49285e65203ecc6ab3da439895155db6f425dea733bf1dd9372c3ccbbe25992fe27b485896e3e58e7ac3b5d084beb1fd3dd87de6b + languageName: node + linkType: hard + +"@types/d3-polygon@npm:*": + version: 3.0.2 + resolution: "@types/d3-polygon@npm:3.0.2" + checksum: f46307bb32b6c2aef8c7624500e0f9b518de8f227ccc10170b869dc43e4c542560f6c8d62e9f087fac45e198d6e4b623e579c0422e34c85baf56717456d3f439 + languageName: node + linkType: hard + +"@types/d3-quadtree@npm:*": + version: 3.0.6 + resolution: "@types/d3-quadtree@npm:3.0.6" + checksum: 7eaa0a4d404adc856971c9285e1c4ab17e9135ea669d847d6db7e0066126a28ac751864e7ce99c65d526e130f56754a2e437a1617877098b3bdcc3ef23a23616 + languageName: node + linkType: hard + +"@types/d3-random@npm:*": + version: 3.0.3 + resolution: "@types/d3-random@npm:3.0.3" + checksum: 5f4fea40080cd6d4adfee05183d00374e73a10c530276a6455348983dda341003a251def28565a27c25d9cf5296a33e870e397c9d91ff83fb7495a21c96b6882 + languageName: node + linkType: hard + +"@types/d3-scale-chromatic@npm:*, @types/d3-scale-chromatic@npm:^3.0.3": + version: 3.0.3 + resolution: "@types/d3-scale-chromatic@npm:3.0.3" + checksum: 2f48c6f370edba485b57b73573884ded71914222a4580140ff87ee96e1d55ccd05b1d457f726e234a31269b803270ac95d5554229ab6c43c7e4a9894e20dd490 + languageName: node + linkType: hard + +"@types/d3-scale@npm:*, @types/d3-scale@npm:^4.0.8": + version: 4.0.8 + resolution: "@types/d3-scale@npm:4.0.8" + dependencies: + "@types/d3-time": "npm:*" + checksum: 57de90e4016f640b83cb960b7e3a0ab3ed02e720898840ddc5105264ffcfea73336161442fdc91895377c2d2f91904d637282f16852b8535b77e15a761c8e99e + languageName: node + linkType: hard + +"@types/d3-selection@npm:*": + version: 3.0.10 + resolution: "@types/d3-selection@npm:3.0.10" + checksum: de1f99ab186a08999bf394a645fd76911add1b02316270d4c07616c8383903a2b068d7e02b73b6a99a1f26bb49a2e99ef4b55a5d2ddfa165f6f3c53144897920 + languageName: node + linkType: hard + +"@types/d3-selection@npm:^2, @types/d3-selection@npm:^2.0.0": + version: 2.0.4 + resolution: "@types/d3-selection@npm:2.0.4" + checksum: e792ce129b323e6d4403d3f4e2847db5fb692301c73323e7e339017561525ac12bdeccddcfce7505f314a526c0a191e54bfb71b72a2d87ddbcae02dbaf2fd2ab + languageName: node + linkType: hard + +"@types/d3-shape@npm:*, @types/d3-shape@npm:^3.1.6": + version: 3.1.6 + resolution: "@types/d3-shape@npm:3.1.6" + dependencies: + "@types/d3-path": "npm:*" + checksum: 0625715925d3c7ed3d44ce998b42c993f063c31605b6e4a8046c4be0fe724e2d214fc83e86d04f429a30a6e1f439053e92b0d9e59e1180c3a5327b4a6e79fa0a + languageName: node + linkType: hard + +"@types/d3-time-format@npm:*": + version: 4.0.3 + resolution: "@types/d3-time-format@npm:4.0.3" + checksum: 9ef5e8e2b96b94799b821eed5d61a3d432c7903247966d8ad951b8ce5797fe46554b425cb7888fa5bf604b4663c369d7628c0328ffe80892156671c58d1a7f90 + languageName: node + linkType: hard + +"@types/d3-time@npm:*": + version: 3.0.3 + resolution: "@types/d3-time@npm:3.0.3" + checksum: 245a8aadca504df27edf730de502e47a68f16ae795c86b5ca35e7afa91c133aa9ef4d08778f8cf1ed2be732f89a4105ba4b437ce2afbdfd17d3d937b6ba5f568 + languageName: node + linkType: hard + +"@types/d3-timer@npm:*": + version: 3.0.2 + resolution: "@types/d3-timer@npm:3.0.2" + checksum: c644dd9571fcc62b1aa12c03bcad40571553020feeb5811f1d8a937ac1e65b8a04b759b4873aef610e28b8714ac71c9885a4d6c127a048d95118f7e5b506d9e1 + languageName: node + linkType: hard + +"@types/d3-transition@npm:*": + version: 3.0.8 + resolution: "@types/d3-transition@npm:3.0.8" + dependencies: + "@types/d3-selection": "npm:*" + checksum: feba7845bd1e1d49e38b0d55562e01e90bfbcf0a56fbe0de4279c12e43a687032d22ed559629c0412145d25d61e4e53ddfef34c89c6bf043d48b6c2cd3a929dc + languageName: node + linkType: hard + +"@types/d3-zoom@npm:*": + version: 3.0.8 + resolution: "@types/d3-zoom@npm:3.0.8" + dependencies: + "@types/d3-interpolate": "npm:*" + "@types/d3-selection": "npm:*" + checksum: 1dbdbcafddcae12efb5beb6948546963f29599e18bc7f2a91fb69cc617c2299a65354f2d47e282dfb86fec0968406cd4fb7f76ba2d2fb67baa8e8d146eb4a547 + languageName: node + linkType: hard + +"@types/d3@npm:^7.4.3": + version: 7.4.3 + resolution: "@types/d3@npm:7.4.3" + dependencies: + "@types/d3-array": "npm:*" + "@types/d3-axis": "npm:*" + "@types/d3-brush": "npm:*" + "@types/d3-chord": "npm:*" + "@types/d3-color": "npm:*" + "@types/d3-contour": "npm:*" + "@types/d3-delaunay": "npm:*" + "@types/d3-dispatch": "npm:*" + "@types/d3-drag": "npm:*" + "@types/d3-dsv": "npm:*" + "@types/d3-ease": "npm:*" + "@types/d3-fetch": "npm:*" + "@types/d3-force": "npm:*" + "@types/d3-format": "npm:*" + "@types/d3-geo": "npm:*" + "@types/d3-hierarchy": "npm:*" + "@types/d3-interpolate": "npm:*" + "@types/d3-path": "npm:*" + "@types/d3-polygon": "npm:*" + "@types/d3-quadtree": "npm:*" + "@types/d3-random": "npm:*" + "@types/d3-scale": "npm:*" + "@types/d3-scale-chromatic": "npm:*" + "@types/d3-selection": "npm:*" + "@types/d3-shape": "npm:*" + "@types/d3-time": "npm:*" + "@types/d3-time-format": "npm:*" + "@types/d3-timer": "npm:*" + "@types/d3-transition": "npm:*" + "@types/d3-zoom": "npm:*" + checksum: a9c6d65b13ef3b42c87f2a89ea63a6d5640221869f97d0657b0cb2f1dac96a0f164bf5605643c0794e0de3aa2bf05df198519aaf15d24ca135eb0e8bd8a9d879 + languageName: node + linkType: hard + +"@types/earcut@npm:^2.1.0": + version: 2.1.4 + resolution: "@types/earcut@npm:2.1.4" + checksum: ab76940f1cc66ac861932f254b8c0344ebdcfed69e356606416d562e17cd112221b08340d52232f73ff1ad08d4dcf9caa5352c73258df4b8a41c9110ba370262 + languageName: node + linkType: hard + +"@types/estree@npm:1.0.5": + version: 1.0.5 + resolution: "@types/estree@npm:1.0.5" + checksum: b3b0e334288ddb407c7b3357ca67dbee75ee22db242ca7c56fe27db4e1a31989cb8af48a84dd401deb787fe10cc6b2ab1ee82dc4783be87ededbe3d53c79c70d + languageName: node + linkType: hard + +"@types/geojson@npm:*": + version: 7946.0.13 + resolution: "@types/geojson@npm:7946.0.13" + checksum: 4450d070f2591500bd3ce13a898d8e4b53a6b75dfb08c002c2553a1bb135cdde9980dee6193d9fe2179c7b5fb6c52470acd116a3db91b33d8c6ba9ae3ae44e11 + languageName: node + linkType: hard + +"@types/history@npm:^4.7.11": + version: 4.7.11 + resolution: "@types/history@npm:4.7.11" + checksum: 3facf37c2493d1f92b2e93a22cac7ea70b06351c2ab9aaceaa3c56aa6099fb63516f6c4ec1616deb5c56b4093c026a043ea2d3373e6c0644d55710364d02c934 + languageName: node + linkType: hard + +"@types/istanbul-lib-coverage@npm:^2.0.1": + version: 2.0.6 + resolution: "@types/istanbul-lib-coverage@npm:2.0.6" + checksum: 3948088654f3eeb45363f1db158354fb013b362dba2a5c2c18c559484d5eb9f6fd85b23d66c0a7c2fcfab7308d0a585b14dadaca6cc8bf89ebfdc7f8f5102fb7 + languageName: node + linkType: hard + +"@types/json-schema@npm:^7.0.12, @types/json-schema@npm:^7.0.9": + version: 7.0.15 + resolution: "@types/json-schema@npm:7.0.15" + checksum: a996a745e6c5d60292f36731dd41341339d4eeed8180bb09226e5c8d23759067692b1d88e5d91d72ee83dfc00d3aca8e7bd43ea120516c17922cbcb7c3e252db + languageName: node + linkType: hard + +"@types/lodash-es@npm:^4.17.5": + version: 4.17.12 + resolution: "@types/lodash-es@npm:4.17.12" + dependencies: + "@types/lodash": "npm:*" + checksum: 5d12d2cede07f07ab067541371ed1b838a33edb3c35cb81b73284e93c6fd0c4bbeaefee984e69294bffb53f62d7272c5d679fdba8e595ff71e11d00f2601dde0 + languageName: node + linkType: hard + +"@types/lodash@npm:*": + version: 4.14.202 + resolution: "@types/lodash@npm:4.14.202" + checksum: 6064d43c8f454170841bd67c8266cc9069d9e570a72ca63f06bceb484cb4a3ee60c9c1f305c1b9e3a87826049fd41124b8ef265c4dd08b00f6766609c7fe9973 + languageName: node + linkType: hard + +"@types/mdast@npm:^3.0.0, @types/mdast@npm:^3.0.3": + version: 3.0.15 + resolution: "@types/mdast@npm:3.0.15" + dependencies: + "@types/unist": "npm:^2" + checksum: fcbf716c03d1ed5465deca60862e9691414f9c43597c288c7d2aefbe274552e1bbd7aeee91b88a02597e88a28c139c57863d0126fcf8416a95fdc681d054ee3d + languageName: node + linkType: hard + +"@types/minimist@npm:^1.2.0": + version: 1.2.5 + resolution: "@types/minimist@npm:1.2.5" + checksum: 3f791258d8e99a1d7d0ca2bda1ca6ea5a94e5e7b8fc6cde84dd79b0552da6fb68ade750f0e17718f6587783c24254bbca0357648dd59dc3812c150305cabdc46 + languageName: node + linkType: hard + +"@types/node@npm:*": + version: 20.10.7 + resolution: "@types/node@npm:20.10.7" + dependencies: + undici-types: "npm:~5.26.4" + checksum: d626cea1b7da4784ee7b335dcc54e64adba9725dab7ca51a690167de502ef89fec07b05ad8e25845d188d7ad7f72c192ec92964d456321ed5b9452113bf9351f + languageName: node + linkType: hard + +"@types/node@npm:^18.6.2": + version: 18.19.5 + resolution: "@types/node@npm:18.19.5" + dependencies: + undici-types: "npm:~5.26.4" + checksum: 8ad59db82b08cb34b2e891e2193aad1081db082178e16189857ffff6619180b9dc74cb14f6e0449007c6797cf0a818a3929a7575b9816267b3d1d858f9fa7be1 + languageName: node + linkType: hard + +"@types/normalize-package-data@npm:^2.4.0": + version: 2.4.4 + resolution: "@types/normalize-package-data@npm:2.4.4" + checksum: aef7bb9b015883d6f4119c423dd28c4bdc17b0e8a0ccf112c78b4fe0e91fbc4af7c6204b04bba0e199a57d2f3fbbd5b4a14bf8739bf9d2a39b2a0aad545e0f86 + languageName: node + linkType: hard + +"@types/offscreencanvas@npm:^2019.6.4": + version: 2019.7.3 + resolution: "@types/offscreencanvas@npm:2019.7.3" + checksum: 6d1dfae721d321cd2b5435f347a0e53b09f33b2f9e9333396480f592823bc323847b8169f7d251d2285cb93dbc1ba2e30741ac5cf4b1c003d660fd4c24526963 + languageName: node + linkType: hard + +"@types/pixelmatch@npm:^5.2.5": + version: 5.2.6 + resolution: "@types/pixelmatch@npm:5.2.6" + dependencies: + "@types/node": "npm:*" + checksum: 1045bde53809b7d555e70fb6a490472879fa8d322bc39cb3f15985b877e9fc5ccf0c0b7d97da936b52d76305aa8d2d6657c03b220af3196d17520cfaa2ecbaa1 + languageName: node + linkType: hard + +"@types/pngjs@npm:^6.0.3": + version: 6.0.4 + resolution: "@types/pngjs@npm:6.0.4" + dependencies: + "@types/node": "npm:*" + checksum: 7217bc69907cc588b29fd875a3f351296744361c12f3a2f4a66c259bcaae7ba75dd3c58586ff53eea6db4512d203ef433435672a47ca8803af84c89c34b2b5b9 + languageName: node + linkType: hard + +"@types/prop-types@npm:*": + version: 15.7.11 + resolution: "@types/prop-types@npm:15.7.11" + checksum: e53423cf9d510515ef8b47ff42f4f1b65a7b7b37c8704e2dbfcb9a60defe0c0e1f3cb1acfdeb466bad44ca938d7c79bffdd51b48ffb659df2432169d0b27a132 + languageName: node + linkType: hard + +"@types/pubsub-js@npm:^1.8.2": + version: 1.8.6 + resolution: "@types/pubsub-js@npm:1.8.6" + checksum: fb0a28b8c96314bdfb0a83ee844288d4526236cf2a2c1cf26b3f474e4ef146141470735cea5d6d83b91d33786fc8b9f7396583e839685f98c250aeb12ecbaa85 + languageName: node + linkType: hard + +"@types/raf@npm:^3.4.0": + version: 3.4.3 + resolution: "@types/raf@npm:3.4.3" + checksum: dea835f0daa399c51db9137f5337dc08a2b4a5f61f645658966ecabaebbbd0fd59551f384a1141e14e22a1cc5a591da7d4d88c60a525ad1399108b6dd2641d75 + languageName: node + linkType: hard + +"@types/rbush@npm:^3.0.0": + version: 3.0.3 + resolution: "@types/rbush@npm:3.0.3" + checksum: a0c2425eb9cb43f442ef48d9d0221c006e0f7303c35f97d443c9832e7c824572b7206a68f9ffe486ba0789cc19600732c3412729211f0c1a5058e7b3f0fd937d + languageName: node + linkType: hard + +"@types/react-dom@npm:^18.2.0": + version: 18.2.18 + resolution: "@types/react-dom@npm:18.2.18" + dependencies: + "@types/react": "npm:*" + checksum: 74dba11a1b8156f3a763f3fca1fb4ec1dcd349153279b8bf79210024a69f994bf2cf0728198c047f8130c5318420ea56281b0a4ef84c8ae943cd9a0cac705220 + languageName: node + linkType: hard + +"@types/react-resize-detector@npm:^4.2.0": + version: 4.2.0 + resolution: "@types/react-resize-detector@npm:4.2.0" + dependencies: + "@types/react": "npm:*" + checksum: 2ddf3fbbed19f5dae2a176708323d8f749a27aa6a5eddf22d577adccc70855c20ae0b66090e8788955c909775a0dffae8a23e8f0b3c85683037e54848ea6cde0 + languageName: node + linkType: hard + +"@types/react-router-dom@npm:^5.1.6": + version: 5.3.3 + resolution: "@types/react-router-dom@npm:5.3.3" + dependencies: + "@types/history": "npm:^4.7.11" + "@types/react": "npm:*" + "@types/react-router": "npm:*" + checksum: a9231a16afb9ed5142678147eafec9d48582809295754fb60946e29fcd3757a4c7a3180fa94b45763e4c7f6e3f02379e2fcb8dd986db479dcab40eff5fc62a91 + languageName: node + linkType: hard + +"@types/react-router@npm:*": + version: 5.1.20 + resolution: "@types/react-router@npm:5.1.20" + dependencies: + "@types/history": "npm:^4.7.11" + "@types/react": "npm:*" + checksum: 1f7eee61981d2f807fa01a34a0ef98ebc0774023832b6611a69c7f28fdff01de5a38cabf399f32e376bf8099dcb7afaf724775bea9d38870224492bea4cb5737 + languageName: node + linkType: hard + +"@types/react@npm:*, @types/react@npm:^18.2.0": + version: 18.2.47 + resolution: "@types/react@npm:18.2.47" + dependencies: + "@types/prop-types": "npm:*" + "@types/scheduler": "npm:*" + csstype: "npm:^3.0.2" + checksum: e98ea1827fe60636d0f7ce206397159a29fc30613fae43e349e32c10ad3c0b7e0ed2ded2f3239e07bd5a3cba8736b6114ba196acccc39905ca4a06f56a8d2841 + languageName: node + linkType: hard + +"@types/scheduler@npm:*": + version: 0.16.8 + resolution: "@types/scheduler@npm:0.16.8" + checksum: f86de504945b8fc41b1f391f847444d542e2e4067cf7e5d9bfeb5d2d2393d3203b1161bc0ef3b1e104d828dabfb60baf06e8d2c27e27ff7e8258e6e618d8c4ec + languageName: node + linkType: hard + +"@types/semver@npm:^7.3.12": + version: 7.5.6 + resolution: "@types/semver@npm:7.5.6" + checksum: 196dc32db5f68cbcde2e6a42bb4aa5cbb100fa2b7bd9c8c82faaaf3e03fbe063e205dbb4f03c7cdf53da2edb70a0d34c9f2e601b54281b377eb8dc1743226acd + languageName: node + linkType: hard + +"@types/unist@npm:^2, @types/unist@npm:^2.0.0, @types/unist@npm:^2.0.2, @types/unist@npm:^2.0.3": + version: 2.0.10 + resolution: "@types/unist@npm:2.0.10" + checksum: 5f247dc2229944355209ad5c8e83cfe29419fa7f0a6d557421b1985a1500444719cc9efcc42c652b55aab63c931813c88033e0202c1ac684bcd4829d66e44731 + languageName: node + linkType: hard + +"@typescript-eslint/eslint-plugin@npm:^5.56.0": + version: 5.62.0 + resolution: "@typescript-eslint/eslint-plugin@npm:5.62.0" + dependencies: + "@eslint-community/regexpp": "npm:^4.4.0" + "@typescript-eslint/scope-manager": "npm:5.62.0" + "@typescript-eslint/type-utils": "npm:5.62.0" + "@typescript-eslint/utils": "npm:5.62.0" + debug: "npm:^4.3.4" + graphemer: "npm:^1.4.0" + ignore: "npm:^5.2.0" + natural-compare-lite: "npm:^1.4.0" + semver: "npm:^7.3.7" + tsutils: "npm:^3.21.0" + peerDependencies: + "@typescript-eslint/parser": ^5.0.0 + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 3f40cb6bab5a2833c3544e4621b9fdacd8ea53420cadc1c63fac3b89cdf5c62be1e6b7bcf56976dede5db4c43830de298ced3db60b5494a3b961ca1b4bff9f2a + languageName: node + linkType: hard + +"@typescript-eslint/parser@npm:^5.56.0": + version: 5.62.0 + resolution: "@typescript-eslint/parser@npm:5.62.0" + dependencies: + "@typescript-eslint/scope-manager": "npm:5.62.0" + "@typescript-eslint/types": "npm:5.62.0" + "@typescript-eslint/typescript-estree": "npm:5.62.0" + debug: "npm:^4.3.4" + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 315194b3bf39beb9bd16c190956c46beec64b8371e18d6bb72002108b250983eb1e186a01d34b77eb4045f4941acbb243b16155fbb46881105f65e37dc9e24d4 + languageName: node + linkType: hard + +"@typescript-eslint/scope-manager@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/scope-manager@npm:5.62.0" + dependencies: + "@typescript-eslint/types": "npm:5.62.0" + "@typescript-eslint/visitor-keys": "npm:5.62.0" + checksum: 861253235576c1c5c1772d23cdce1418c2da2618a479a7de4f6114a12a7ca853011a1e530525d0931c355a8fd237b9cd828fac560f85f9623e24054fd024726f + languageName: node + linkType: hard + +"@typescript-eslint/type-utils@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/type-utils@npm:5.62.0" + dependencies: + "@typescript-eslint/typescript-estree": "npm:5.62.0" + "@typescript-eslint/utils": "npm:5.62.0" + debug: "npm:^4.3.4" + tsutils: "npm:^3.21.0" + peerDependencies: + eslint: "*" + peerDependenciesMeta: + typescript: + optional: true + checksum: 93112e34026069a48f0484b98caca1c89d9707842afe14e08e7390af51cdde87378df29d213d3bbd10a7cfe6f91b228031b56218515ce077bdb62ddea9d9f474 + languageName: node + linkType: hard + +"@typescript-eslint/types@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/types@npm:5.62.0" + checksum: 7febd3a7f0701c0b927e094f02e82d8ee2cada2b186fcb938bc2b94ff6fbad88237afc304cbaf33e82797078bbbb1baf91475f6400912f8b64c89be79bfa4ddf + languageName: node + linkType: hard + +"@typescript-eslint/typescript-estree@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/typescript-estree@npm:5.62.0" + dependencies: + "@typescript-eslint/types": "npm:5.62.0" + "@typescript-eslint/visitor-keys": "npm:5.62.0" + debug: "npm:^4.3.4" + globby: "npm:^11.1.0" + is-glob: "npm:^4.0.3" + semver: "npm:^7.3.7" + tsutils: "npm:^3.21.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: d7984a3e9d56897b2481940ec803cb8e7ead03df8d9cfd9797350be82ff765dfcf3cfec04e7355e1779e948da8f02bc5e11719d07a596eb1cb995c48a95e38cf + languageName: node + linkType: hard + +"@typescript-eslint/utils@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/utils@npm:5.62.0" + dependencies: + "@eslint-community/eslint-utils": "npm:^4.2.0" + "@types/json-schema": "npm:^7.0.9" + "@types/semver": "npm:^7.3.12" + "@typescript-eslint/scope-manager": "npm:5.62.0" + "@typescript-eslint/types": "npm:5.62.0" + "@typescript-eslint/typescript-estree": "npm:5.62.0" + eslint-scope: "npm:^5.1.1" + semver: "npm:^7.3.7" + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + checksum: f09b7d9952e4a205eb1ced31d7684dd55cee40bf8c2d78e923aa8a255318d97279825733902742c09d8690f37a50243f4c4d383ab16bd7aefaf9c4b438f785e1 + languageName: node + linkType: hard + +"@typescript-eslint/visitor-keys@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/visitor-keys@npm:5.62.0" + dependencies: + "@typescript-eslint/types": "npm:5.62.0" + eslint-visitor-keys: "npm:^3.3.0" + checksum: 7c3b8e4148e9b94d9b7162a596a1260d7a3efc4e65199693b8025c71c4652b8042501c0bc9f57654c1e2943c26da98c0f77884a746c6ae81389fcb0b513d995d + languageName: node + linkType: hard + +"@ungap/structured-clone@npm:^1.2.0": + version: 1.2.0 + resolution: "@ungap/structured-clone@npm:1.2.0" + checksum: 8209c937cb39119f44eb63cf90c0b73e7c754209a6411c707be08e50e29ee81356dca1a848a405c8bdeebfe2f5e4f831ad310ae1689eeef65e7445c090c6657d + languageName: node + linkType: hard + +"@vitejs/plugin-react@npm:^4.1.0": + version: 4.2.1 + resolution: "@vitejs/plugin-react@npm:4.2.1" + dependencies: + "@babel/core": "npm:^7.23.5" + "@babel/plugin-transform-react-jsx-self": "npm:^7.23.3" + "@babel/plugin-transform-react-jsx-source": "npm:^7.23.3" + "@types/babel__core": "npm:^7.20.5" + react-refresh: "npm:^0.14.0" + peerDependencies: + vite: ^4.2.0 || ^5.0.0 + checksum: de1eec44d703f32e5b58e776328ca20793657fe991835d15b290230b19a2a08be5d31501d424279ae13ecfed28044c117b69d746891c8d9b92c69e8a8907e989 + languageName: node + linkType: hard + +"@vitest/coverage-v8@npm:^0.34.6": + version: 0.34.6 + resolution: "@vitest/coverage-v8@npm:0.34.6" + dependencies: + "@ampproject/remapping": "npm:^2.2.1" + "@bcoe/v8-coverage": "npm:^0.2.3" + istanbul-lib-coverage: "npm:^3.2.0" + istanbul-lib-report: "npm:^3.0.1" + istanbul-lib-source-maps: "npm:^4.0.1" + istanbul-reports: "npm:^3.1.5" + magic-string: "npm:^0.30.1" + picocolors: "npm:^1.0.0" + std-env: "npm:^3.3.3" + test-exclude: "npm:^6.0.0" + v8-to-istanbul: "npm:^9.1.0" + peerDependencies: + vitest: ">=0.32.0 <1" + checksum: 089d68be42993604606eaafa727370ed4494d69cb1e636b939423a37286bec36a9868bb5a26c59c0cf3b1faec741e6688a8f9bfd1f365927fa44e2cb2e88e92c + languageName: node + linkType: hard + +"@vitest/expect@npm:0.34.6": + version: 0.34.6 + resolution: "@vitest/expect@npm:0.34.6" + dependencies: + "@vitest/spy": "npm:0.34.6" + "@vitest/utils": "npm:0.34.6" + chai: "npm:^4.3.10" + checksum: d68abc53d673c2c98cad84da4fa73bd407d59a1098ca528c6925c202321d4eeecde5eaf512980614a755200ae1aa6b648d44da09b78ce4cc95aa78eff8ee558a + languageName: node + linkType: hard + +"@vitest/runner@npm:0.34.6": + version: 0.34.6 + resolution: "@vitest/runner@npm:0.34.6" + dependencies: + "@vitest/utils": "npm:0.34.6" + p-limit: "npm:^4.0.0" + pathe: "npm:^1.1.1" + checksum: d00d8c399513693eb6c82fd08b0e32fcf486bede5b88805e8dea90e156d502418477788b501b1c078abd38f0147e99a187061b2da81819e8d5c162a63edf5b40 + languageName: node + linkType: hard + +"@vitest/snapshot@npm:0.34.6": + version: 0.34.6 + resolution: "@vitest/snapshot@npm:0.34.6" + dependencies: + magic-string: "npm:^0.30.1" + pathe: "npm:^1.1.1" + pretty-format: "npm:^29.5.0" + checksum: 08dbfb3cb6d202116e981abf421096eae920d65bca867c38651b02d2623e25a18e2ead6e5de13a49ebe9f2f9d007b2f692714aa6a5c9f18c3ff17b9f8726dbab + languageName: node + linkType: hard + +"@vitest/spy@npm:0.34.6": + version: 0.34.6 + resolution: "@vitest/spy@npm:0.34.6" + dependencies: + tinyspy: "npm:^2.1.1" + checksum: ea36d31c521f4c458f7e439ceeb0d1e5c2e9298aaafad7c9bc5ebe75f36c9b871c1f3a6dcb5bfd6c4e83b34979d511f9a7830fa8720b7e1faa18ef121845e9d5 + languageName: node + linkType: hard + +"@vitest/utils@npm:0.34.6": + version: 0.34.6 + resolution: "@vitest/utils@npm:0.34.6" + dependencies: + diff-sequences: "npm:^29.4.3" + loupe: "npm:^2.3.6" + pretty-format: "npm:^29.5.0" + checksum: 6f32f086b8bf0e8125a11b26cad4ce77ad90943590b55cd1ebb1424412d1feb6d404ee4ded523c346a8f222c265251652b4888f2ede769e3d7fce6fb1ee0a620 + languageName: node + linkType: hard + +"JSONStream@npm:^1.0.4": + version: 1.3.5 + resolution: "JSONStream@npm:1.3.5" + dependencies: + jsonparse: "npm:^1.2.0" + through: "npm:>=2.2.7 <3" + bin: + JSONStream: ./bin.js + checksum: 0f54694da32224d57b715385d4a6b668d2117379d1f3223dc758459246cca58fdc4c628b83e8a8883334e454a0a30aa198ede77c788b55537c1844f686a751f2 + languageName: node + linkType: hard + +"abab@npm:^2.0.5, abab@npm:^2.0.6": + version: 2.0.6 + resolution: "abab@npm:2.0.6" + checksum: 0b245c3c3ea2598fe0025abf7cc7bb507b06949d51e8edae5d12c1b847a0a0c09639abcb94788332b4e2044ac4491c1e8f571b51c7826fd4b0bda1685ad4a278 + languageName: node + linkType: hard + +"abbrev@npm:^2.0.0": + version: 2.0.0 + resolution: "abbrev@npm:2.0.0" + checksum: f742a5a107473946f426c691c08daba61a1d15942616f300b5d32fd735be88fef5cba24201757b6c407fd564555fb48c751cfa33519b2605c8a7aadd22baf372 + languageName: node + linkType: hard + +"abortable-promise-cache@npm:^1.4.1, abortable-promise-cache@npm:^1.5.0": + version: 1.5.0 + resolution: "abortable-promise-cache@npm:1.5.0" + dependencies: + abortcontroller-polyfill: "npm:^1.2.9" + checksum: fb330bf6612dcda00a05ca72a464c7847438a9dd32151f0e6b02372e9bbb57e83e2fc2c01a5bf4d7c4267a772fc1978240eb3ad45d664b4b39fef71618946ae6 + languageName: node + linkType: hard + +"abortcontroller-polyfill@npm:^1.2.9": + version: 1.7.5 + resolution: "abortcontroller-polyfill@npm:1.7.5" + checksum: d7a5ab6fda4f9a54f22ddeb233a2564d2f4f857ec17be25fee21a91bb5090bee57c630c454634b5c4b93fc06bd90d592d1f2fc69f77cd28791ac0fe361feb7d2 + languageName: node + linkType: hard + +"acorn-globals@npm:^6.0.0": + version: 6.0.0 + resolution: "acorn-globals@npm:6.0.0" + dependencies: + acorn: "npm:^7.1.1" + acorn-walk: "npm:^7.1.1" + checksum: 5f92390a3fd7e5a4f84fe976d4650e2a33ecf27135aa9efc5406e3406df7f00a1bbb00648ee0c8058846f55ad0924ff574e6c73395705690e754589380a41801 + languageName: node + linkType: hard + +"acorn-jsx@npm:^5.3.2": + version: 5.3.2 + resolution: "acorn-jsx@npm:5.3.2" + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + checksum: 4c54868fbef3b8d58927d5e33f0a4de35f59012fe7b12cf9dfbb345fb8f46607709e1c4431be869a23fb63c151033d84c4198fa9f79385cec34fcb1dd53974c1 + languageName: node + linkType: hard + +"acorn-walk@npm:^7.1.1": + version: 7.2.0 + resolution: "acorn-walk@npm:7.2.0" + checksum: ff99f3406ed8826f7d6ef6ac76b7608f099d45a1ff53229fa267125da1924188dbacf02e7903dfcfd2ae4af46f7be8847dc7d564c73c4e230dfb69c8ea8e6b4c + languageName: node + linkType: hard + +"acorn-walk@npm:^8.2.0": + version: 8.3.1 + resolution: "acorn-walk@npm:8.3.1" + checksum: a23d2f7c6b6cad617f4c77f14dfeb062a239208d61753e9ba808d916c550add92b39535467d2e6028280761ac4f5a904cc9df21530b84d3f834e3edef74ddde5 + languageName: node + linkType: hard + +"acorn@npm:^7.1.1": + version: 7.4.1 + resolution: "acorn@npm:7.4.1" + bin: + acorn: bin/acorn + checksum: bd0b2c2b0f334bbee48828ff897c12bd2eb5898d03bf556dcc8942022cec795ac5bb5b6b585e2de687db6231faf07e096b59a361231dd8c9344d5df5f7f0e526 + languageName: node + linkType: hard + +"acorn@npm:^8.10.0, acorn@npm:^8.5.0, acorn@npm:^8.9.0": + version: 8.11.3 + resolution: "acorn@npm:8.11.3" + bin: + acorn: bin/acorn + checksum: 3ff155f8812e4a746fee8ecff1f227d527c4c45655bb1fad6347c3cb58e46190598217551b1500f18542d2bbe5c87120cb6927f5a074a59166fbdd9468f0a299 + languageName: node + linkType: hard + +"add-stream@npm:^1.0.0": + version: 1.0.0 + resolution: "add-stream@npm:1.0.0" + checksum: 985014a14e76ca4cb24e0fc58bb1556794cf38c5c8937de335a10584f50a371dc48e1c34a59391c7eb9c1fc908b4b86764df5d2756f701df6ba95d1ca2f63ddc + languageName: node + linkType: hard + +"agent-base@npm:6": + version: 6.0.2 + resolution: "agent-base@npm:6.0.2" + dependencies: + debug: "npm:4" + checksum: dc4f757e40b5f3e3d674bc9beb4f1048f4ee83af189bae39be99f57bf1f48dde166a8b0a5342a84b5944ee8e6ed1e5a9d801858f4ad44764e84957122fe46261 + languageName: node + linkType: hard + +"agent-base@npm:^7.0.2, agent-base@npm:^7.1.0": + version: 7.1.0 + resolution: "agent-base@npm:7.1.0" + dependencies: + debug: "npm:^4.3.4" + checksum: fc974ab57ffdd8421a2bc339644d312a9cca320c20c3393c9d8b1fd91731b9bbabdb985df5fc860f5b79d81c3e350daa3fcb31c5c07c0bb385aafc817df004ce + languageName: node + linkType: hard + +"aggregate-error@npm:^3.0.0": + version: 3.1.0 + resolution: "aggregate-error@npm:3.1.0" + dependencies: + clean-stack: "npm:^2.0.0" + indent-string: "npm:^4.0.0" + checksum: a42f67faa79e3e6687a4923050e7c9807db3848a037076f791d10e092677d65c1d2d863b7848560699f40fc0502c19f40963fb1cd1fb3d338a7423df8e45e039 + languageName: node + linkType: hard + +"ajv@npm:^6.10.0, ajv@npm:^6.12.2, ajv@npm:^6.12.4": + version: 6.12.6 + resolution: "ajv@npm:6.12.6" + dependencies: + fast-deep-equal: "npm:^3.1.1" + fast-json-stable-stringify: "npm:^2.0.0" + json-schema-traverse: "npm:^0.4.1" + uri-js: "npm:^4.2.2" + checksum: 41e23642cbe545889245b9d2a45854ebba51cda6c778ebced9649420d9205f2efb39cb43dbc41e358409223b1ea43303ae4839db682c848b891e4811da1a5a71 + languageName: node + linkType: hard + +"allotment@npm:^1.19.0": + version: 1.19.5 + resolution: "allotment@npm:1.19.5" + dependencies: + classnames: "npm:^2.3.0" + eventemitter3: "npm:^5.0.0" + lodash.clamp: "npm:^4.0.0" + lodash.debounce: "npm:^4.0.0" + lodash.isequal: "npm:^4.5.0" + use-resize-observer: "npm:^9.0.0" + peerDependencies: + react: ^17.0.0 || ^18.0.0 + react-dom: ^17.0.0 || ^18.0.0 + checksum: 56e736cb382e9c8c6d5df2dcb20de8afbfb838ed30847f82139d9909bda711d4fa53037de2cb301a33fd5df290eb4cf9fb44fdbd3aba8f69806613f039df05b6 + languageName: node + linkType: hard + +"ansi-regex@npm:^5.0.1": + version: 5.0.1 + resolution: "ansi-regex@npm:5.0.1" + checksum: 9a64bb8627b434ba9327b60c027742e5d17ac69277960d041898596271d992d4d52ba7267a63ca10232e29f6107fc8a835f6ce8d719b88c5f8493f8254813737 + languageName: node + linkType: hard + +"ansi-regex@npm:^6.0.1": + version: 6.0.1 + resolution: "ansi-regex@npm:6.0.1" + checksum: cbe16dbd2c6b2735d1df7976a7070dd277326434f0212f43abf6d87674095d247968209babdaad31bb00882fa68807256ba9be340eec2f1004de14ca75f52a08 + languageName: node + linkType: hard + +"ansi-styles@npm:^3.2.1": + version: 3.2.1 + resolution: "ansi-styles@npm:3.2.1" + dependencies: + color-convert: "npm:^1.9.0" + checksum: ece5a8ef069fcc5298f67e3f4771a663129abd174ea2dfa87923a2be2abf6cd367ef72ac87942da00ce85bd1d651d4cd8595aebdb1b385889b89b205860e977b + languageName: node + linkType: hard + +"ansi-styles@npm:^4.0.0, ansi-styles@npm:^4.1.0": + version: 4.3.0 + resolution: "ansi-styles@npm:4.3.0" + dependencies: + color-convert: "npm:^2.0.1" + checksum: 895a23929da416f2bd3de7e9cb4eabd340949328ab85ddd6e484a637d8f6820d485f53933446f5291c3b760cbc488beb8e88573dd0f9c7daf83dccc8fe81b041 + languageName: node + linkType: hard + +"ansi-styles@npm:^5.0.0": + version: 5.2.0 + resolution: "ansi-styles@npm:5.2.0" + checksum: 9c4ca80eb3c2fb7b33841c210d2f20807f40865d27008d7c3f707b7f95cab7d67462a565e2388ac3285b71cb3d9bb2173de8da37c57692a362885ec34d6e27df + languageName: node + linkType: hard + +"ansi-styles@npm:^6.1.0": + version: 6.2.1 + resolution: "ansi-styles@npm:6.2.1" + checksum: 5d1ec38c123984bcedd996eac680d548f31828bd679a66db2bdf11844634dde55fec3efa9c6bb1d89056a5e79c1ac540c4c784d592ea1d25028a92227d2f2d5c + languageName: node + linkType: hard + +"argparse@npm:^2.0.1": + version: 2.0.1 + resolution: "argparse@npm:2.0.1" + checksum: c5640c2d89045371c7cedd6a70212a04e360fd34d6edeae32f6952c63949e3525ea77dbec0289d8213a99bbaeab5abfa860b5c12cf88a2e6cf8106e90dd27a7e + languageName: node + linkType: hard + +"aria-query@npm:^5.3.0": + version: 5.3.0 + resolution: "aria-query@npm:5.3.0" + dependencies: + dequal: "npm:^2.0.3" + checksum: 2bff0d4eba5852a9dd578ecf47eaef0e82cc52569b48469b0aac2db5145db0b17b7a58d9e01237706d1e14b7a1b0ac9b78e9c97027ad97679dd8f91b85da1469 + languageName: node + linkType: hard + +"array-buffer-byte-length@npm:^1.0.0": + version: 1.0.0 + resolution: "array-buffer-byte-length@npm:1.0.0" + dependencies: + call-bind: "npm:^1.0.2" + is-array-buffer: "npm:^3.0.1" + checksum: 12f84f6418b57a954caa41654e5e63e019142a4bbb2c6829ba86d1ba65d31ccfaf1461d1743556fd32b091fac34ff44d9dfbdb001402361c45c373b2c86f5c20 + languageName: node + linkType: hard + +"array-ify@npm:^1.0.0": + version: 1.0.0 + resolution: "array-ify@npm:1.0.0" + checksum: 75c9c072faac47bd61779c0c595e912fe660d338504ac70d10e39e1b8a4a0c9c87658703d619b9d1b70d324177ae29dc8d07dda0d0a15d005597bc4c5a59c70c + languageName: node + linkType: hard + +"array-includes@npm:^3.1.6, array-includes@npm:^3.1.7": + version: 3.1.7 + resolution: "array-includes@npm:3.1.7" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + get-intrinsic: "npm:^1.2.1" + is-string: "npm:^1.0.7" + checksum: 692907bd7f19d06dc58ccb761f34b58f5dc0b437d2b47a8fe42a1501849a5cf5c27aed3d521a9702667827c2c85a7e75df00a402c438094d87fc43f39ebf9b2b + languageName: node + linkType: hard + +"array-union@npm:^2.1.0": + version: 2.1.0 + resolution: "array-union@npm:2.1.0" + checksum: 429897e68110374f39b771ec47a7161fc6a8fc33e196857c0a396dc75df0b5f65e4d046674db764330b6bb66b39ef48dd7c53b6a2ee75cfb0681e0c1a7033962 + languageName: node + linkType: hard + +"array.prototype.flat@npm:^1.3.1": + version: 1.3.2 + resolution: "array.prototype.flat@npm:1.3.2" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + es-shim-unscopables: "npm:^1.0.0" + checksum: a578ed836a786efbb6c2db0899ae80781b476200617f65a44846cb1ed8bd8b24c8821b83703375d8af639c689497b7b07277060024b9919db94ac3e10dc8a49b + languageName: node + linkType: hard + +"array.prototype.flatmap@npm:^1.3.1, array.prototype.flatmap@npm:^1.3.2": + version: 1.3.2 + resolution: "array.prototype.flatmap@npm:1.3.2" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + es-shim-unscopables: "npm:^1.0.0" + checksum: 67b3f1d602bb73713265145853128b1ad77cc0f9b833c7e1e056b323fbeac41a4ff1c9c99c7b9445903caea924d9ca2450578d9011913191aa88cc3c3a4b54f4 + languageName: node + linkType: hard + +"array.prototype.tosorted@npm:^1.1.1": + version: 1.1.2 + resolution: "array.prototype.tosorted@npm:1.1.2" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + es-shim-unscopables: "npm:^1.0.0" + get-intrinsic: "npm:^1.2.1" + checksum: aa222a0f78e9cdb4ea4d788a11f0acc2b17c2226f0912917e1c89e0f0c4dcdd14414ac88afffbd03025f33501f2649907cfb80664e48aa2af3430c1fb1b0b416 + languageName: node + linkType: hard + +"arraybuffer.prototype.slice@npm:^1.0.2": + version: 1.0.2 + resolution: "arraybuffer.prototype.slice@npm:1.0.2" + dependencies: + array-buffer-byte-length: "npm:^1.0.0" + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + get-intrinsic: "npm:^1.2.1" + is-array-buffer: "npm:^3.0.2" + is-shared-array-buffer: "npm:^1.0.2" + checksum: 96b6e40e439678ffb7fa266398510074d33c3980fbb475490b69980cca60adec3b0777047ef377068a29862157f83edef42efc64ce48ce38977d04d68de5b7fb + languageName: node + linkType: hard + +"arrify@npm:^1.0.1": + version: 1.0.1 + resolution: "arrify@npm:1.0.1" + checksum: c35c8d1a81bcd5474c0c57fe3f4bad1a4d46a5fa353cedcff7a54da315df60db71829e69104b859dff96c5d68af46bd2be259fe5e50dc6aa9df3b36bea0383ab + languageName: node + linkType: hard + +"assertion-error@npm:^1.1.0": + version: 1.1.0 + resolution: "assertion-error@npm:1.1.0" + checksum: 25456b2aa333250f01143968e02e4884a34588a8538fbbf65c91a637f1dbfb8069249133cd2f4e530f10f624d206a664e7df30207830b659e9f5298b00a4099b + languageName: node + linkType: hard + +"ast-types-flow@npm:^0.0.8": + version: 0.0.8 + resolution: "ast-types-flow@npm:0.0.8" + checksum: f2a0ba8055353b743c41431974521e5e852a9824870cd6fce2db0e538ac7bf4da406bbd018d109af29ff3f8f0993f6a730c9eddbd0abd031fbcb29ca75c1014e + languageName: node + linkType: hard + +"asynciterator.prototype@npm:^1.0.0": + version: 1.0.0 + resolution: "asynciterator.prototype@npm:1.0.0" + dependencies: + has-symbols: "npm:^1.0.3" + checksum: fb76850e57d931ff59fd16b6cddb79b0d34fe45f400b2c3480d38892e72cd089787401687dbdb7cdb14ece402c275d3e02a648760d1489cd493527129c4c6204 + languageName: node + linkType: hard + +"asynckit@npm:^0.4.0": + version: 0.4.0 + resolution: "asynckit@npm:0.4.0" + checksum: d73e2ddf20c4eb9337e1b3df1a0f6159481050a5de457c55b14ea2e5cb6d90bb69e004c9af54737a5ee0917fcf2c9e25de67777bbe58261847846066ba75bc9d + languageName: node + linkType: hard + +"atob@npm:^2.1.2": + version: 2.1.2 + resolution: "atob@npm:2.1.2" + bin: + atob: bin/atob.js + checksum: ada635b519dc0c576bb0b3ca63a73b50eefacf390abb3f062558342a8d68f2db91d0c8db54ce81b0d89de3b0f000de71f3ae7d761fd7d8cc624278fe443d6c7e + languageName: node + linkType: hard + +"available-typed-arrays@npm:^1.0.5": + version: 1.0.5 + resolution: "available-typed-arrays@npm:1.0.5" + checksum: c4df567ca72d2754a6cbad20088f5f98b1065b3360178169fa9b44ea101af62c0f423fc3854fa820fd6895b6b9171b8386e71558203103ff8fc2ad503fdcc660 + languageName: node + linkType: hard + +"axe-core@npm:=4.7.0": + version: 4.7.0 + resolution: "axe-core@npm:4.7.0" + checksum: 89ac5712b5932ac7d23398b4cb5ba081c394a086e343acc68ba49c83472706e18e0799804e8388c779dcdacc465377deb29f2714241d3fbb389cf3a6b275c9ba + languageName: node + linkType: hard + +"axobject-query@npm:^3.2.1": + version: 3.2.1 + resolution: "axobject-query@npm:3.2.1" + dependencies: + dequal: "npm:^2.0.3" + checksum: f7debc2012e456139b57d888c223f6d3cb4b61eb104164a85e3d346273dd6ef0bc9a04b6660ca9407704a14a8e05fa6b6eb9d55f44f348c7210de7ffb350c3a7 + languageName: node + linkType: hard + +"bail@npm:^1.0.0": + version: 1.0.5 + resolution: "bail@npm:1.0.5" + checksum: 4cf7d0b5c82fdc69590b3fe85c17c4ec37647681b20875551fd6187a85c122b20178dc118001d3ebd5d0ab3dc0e95637c71f889f481882ee761db43c6b16fa05 + languageName: node + linkType: hard + +"balanced-match@npm:^1.0.0": + version: 1.0.2 + resolution: "balanced-match@npm:1.0.2" + checksum: 9308baf0a7e4838a82bbfd11e01b1cb0f0cf2893bc1676c27c2a8c0e70cbae1c59120c3268517a8ae7fb6376b4639ef81ca22582611dbee4ed28df945134aaee + languageName: node + linkType: hard + +"base64-arraybuffer@npm:^1.0.2": + version: 1.0.2 + resolution: "base64-arraybuffer@npm:1.0.2" + checksum: 3acac95c70f9406e87a41073558ba85b6be9dbffb013a3d2a710e3f2d534d506c911847d5d9be4de458af6362c676de0a5c4c2d7bdf4def502d00b313368e72f + languageName: node + linkType: hard + +"base64-js@npm:^1.3.1": + version: 1.5.1 + resolution: "base64-js@npm:1.5.1" + checksum: f23823513b63173a001030fae4f2dabe283b99a9d324ade3ad3d148e218134676f1ee8568c877cd79ec1c53158dcf2d2ba527a97c606618928ba99dd930102bf + languageName: node + linkType: hard + +"bezier-js@npm:4.0.3": + version: 4.0.3 + resolution: "bezier-js@npm:4.0.3" + checksum: b32ad8a7b7bfb24dabe05dc3ef27c5d31a8a8bfa50335fc3113b1d7deb1dca07043b6ce548afceb324ad96809ad4f7d26c727a68b1f812c1f16ef9376cd27d8d + languageName: node + linkType: hard + +"binary-parser@npm:^2.1.0": + version: 2.2.1 + resolution: "binary-parser@npm:2.2.1" + checksum: 5df67eeae276cae1dd9250bc95d80496d23e705bea606e50564657c0d75b95bb6b1ea6d70922a2568f9abf5d095549b7ddd0ca8267ac764ae2349e9ac172943a + languageName: node + linkType: hard + +"bit-twiddle@npm:^1.0.0, bit-twiddle@npm:^1.0.2": + version: 1.0.2 + resolution: "bit-twiddle@npm:1.0.2" + checksum: edd86fdaeb27fb5acb9dbde247a71e511ebb6c5406ed645038974203dce8c87ef0359f5d5b60212c2a54d0a52ab16a27c4cc3b1cd4e06256a33881ed77f03d7a + languageName: node + linkType: hard + +"box-intersect@npm:^1.0.1": + version: 1.0.2 + resolution: "box-intersect@npm:1.0.2" + dependencies: + bit-twiddle: "npm:^1.0.2" + typedarray-pool: "npm:^1.1.0" + checksum: 18369b26a3ffb6d8ed28020f8af709700406e7900df094f90d275edd41477eeeb18af14246f9e856d6ab7742442e889ce380ceaec769946afad2a795fb39cf47 + languageName: node + linkType: hard + +"brace-expansion@npm:^1.1.7": + version: 1.1.11 + resolution: "brace-expansion@npm:1.1.11" + dependencies: + balanced-match: "npm:^1.0.0" + concat-map: "npm:0.0.1" + checksum: 695a56cd058096a7cb71fb09d9d6a7070113c7be516699ed361317aca2ec169f618e28b8af352e02ab4233fb54eb0168460a40dc320bab0034b36ab59aaad668 + languageName: node + linkType: hard + +"brace-expansion@npm:^2.0.1": + version: 2.0.1 + resolution: "brace-expansion@npm:2.0.1" + dependencies: + balanced-match: "npm:^1.0.0" + checksum: b358f2fe060e2d7a87aa015979ecea07f3c37d4018f8d6deb5bd4c229ad3a0384fe6029bb76cd8be63c81e516ee52d1a0673edbe2023d53a5191732ae3c3e49f + languageName: node + linkType: hard + +"braces@npm:^3.0.2": + version: 3.0.2 + resolution: "braces@npm:3.0.2" + dependencies: + fill-range: "npm:^7.0.1" + checksum: 321b4d675791479293264019156ca322163f02dc06e3c4cab33bb15cd43d80b51efef69b0930cfde3acd63d126ebca24cd0544fa6f261e093a0fb41ab9dda381 + languageName: node + linkType: hard + +"browser-process-hrtime@npm:^1.0.0": + version: 1.0.0 + resolution: "browser-process-hrtime@npm:1.0.0" + checksum: 65da78e51e9d7fa5909147f269c54c65ae2e03d1cf797cc3cfbbe49f475578b8160ce4a76c36c1a2ffbff26c74f937d73096c508057491ddf1a6dfd11143f72d + languageName: node + linkType: hard + +"browserslist@npm:^4.22.2": + version: 4.22.2 + resolution: "browserslist@npm:4.22.2" + dependencies: + caniuse-lite: "npm:^1.0.30001565" + electron-to-chromium: "npm:^1.4.601" + node-releases: "npm:^2.0.14" + update-browserslist-db: "npm:^1.0.13" + bin: + browserslist: cli.js + checksum: 2a331aab90503130043ca41dd5d281fa1e89d5e076d07a2d75e76bf4d693bd56e73d5abcd8c4f39119da6328d450578c216cf1cd5c99b82d8a90a2ae6271b465 + languageName: node + linkType: hard + +"btoa@npm:^1.2.1": + version: 1.2.1 + resolution: "btoa@npm:1.2.1" + bin: + btoa: bin/btoa.js + checksum: 557b9682e40a68ae057af1b377e28884e6ff756ba0f499fe0f8c7b725a5bfb5c0d891604ac09944dbe330c9d43fb3976fef734f9372608d0d8e78a30eda292ae + languageName: node + linkType: hard + +"buffer-crc32@npm:^0.2.13": + version: 0.2.13 + resolution: "buffer-crc32@npm:0.2.13" + checksum: cb0a8ddf5cf4f766466db63279e47761eb825693eeba6a5a95ee4ec8cb8f81ede70aa7f9d8aeec083e781d47154290eb5d4d26b3f7a465ec57fb9e7d59c47150 + languageName: node + linkType: hard + +"buffer@npm:^6.0.3": + version: 6.0.3 + resolution: "buffer@npm:6.0.3" + dependencies: + base64-js: "npm:^1.3.1" + ieee754: "npm:^1.2.1" + checksum: 2a905fbbcde73cc5d8bd18d1caa23715d5f83a5935867c2329f0ac06104204ba7947be098fe1317fbd8830e26090ff8e764f08cd14fefc977bb248c3487bcbd0 + languageName: node + linkType: hard + +"c8@npm:^7.11.2": + version: 7.14.0 + resolution: "c8@npm:7.14.0" + dependencies: + "@bcoe/v8-coverage": "npm:^0.2.3" + "@istanbuljs/schema": "npm:^0.1.3" + find-up: "npm:^5.0.0" + foreground-child: "npm:^2.0.0" + istanbul-lib-coverage: "npm:^3.2.0" + istanbul-lib-report: "npm:^3.0.0" + istanbul-reports: "npm:^3.1.4" + rimraf: "npm:^3.0.2" + test-exclude: "npm:^6.0.0" + v8-to-istanbul: "npm:^9.0.0" + yargs: "npm:^16.2.0" + yargs-parser: "npm:^20.2.9" + bin: + c8: bin/c8.js + checksum: 8946f55f2dcc85bf146f429a3deeede78502da245e515a2d181342475d8d8698b4055ec1d9b887ab8e1615f49c1a2af4d63557e68b2005844572fb785991e148 + languageName: node + linkType: hard + +"cac@npm:^6.7.14": + version: 6.7.14 + resolution: "cac@npm:6.7.14" + checksum: 4ee06aaa7bab8981f0d54e5f5f9d4adcd64058e9697563ce336d8a3878ed018ee18ebe5359b2430eceae87e0758e62ea2019c3f52ae6e211b1bd2e133856cd10 + languageName: node + linkType: hard + +"cacache@npm:^18.0.0": + version: 18.0.2 + resolution: "cacache@npm:18.0.2" + dependencies: + "@npmcli/fs": "npm:^3.1.0" + fs-minipass: "npm:^3.0.0" + glob: "npm:^10.2.2" + lru-cache: "npm:^10.0.1" + minipass: "npm:^7.0.3" + minipass-collect: "npm:^2.0.1" + minipass-flush: "npm:^1.0.5" + minipass-pipeline: "npm:^1.2.4" + p-map: "npm:^4.0.0" + ssri: "npm:^10.0.0" + tar: "npm:^6.1.11" + unique-filename: "npm:^3.0.0" + checksum: 7992665305cc251a984f4fdbab1449d50e88c635bc43bf2785530c61d239c61b349e5734461baa461caaee65f040ab14e2d58e694f479c0810cffd181ba5eabc + languageName: node + linkType: hard + +"call-bind@npm:^1.0.0, call-bind@npm:^1.0.2, call-bind@npm:^1.0.4, call-bind@npm:^1.0.5": + version: 1.0.5 + resolution: "call-bind@npm:1.0.5" + dependencies: + function-bind: "npm:^1.1.2" + get-intrinsic: "npm:^1.2.1" + set-function-length: "npm:^1.1.1" + checksum: a6172c168fd6dacf744fcde745099218056bd755c50415b592655dcd6562157ed29f130f56c3f6db2250f67e4bd62e5c218cdc56d7bfd76e0bda50770fce2d10 + languageName: node + linkType: hard + +"callsites@npm:^3.0.0, callsites@npm:^3.1.0": + version: 3.1.0 + resolution: "callsites@npm:3.1.0" + checksum: fff92277400eb06c3079f9e74f3af120db9f8ea03bad0e84d9aede54bbe2d44a56cccb5f6cf12211f93f52306df87077ecec5b712794c5a9b5dac6d615a3f301 + languageName: node + linkType: hard + +"camelcase-keys@npm:^6.2.2": + version: 6.2.2 + resolution: "camelcase-keys@npm:6.2.2" + dependencies: + camelcase: "npm:^5.3.1" + map-obj: "npm:^4.0.0" + quick-lru: "npm:^4.0.1" + checksum: bf1a28348c0f285c6c6f68fb98a9d088d3c0269fed0cdff3ea680d5a42df8a067b4de374e7a33e619eb9d5266a448fe66c2dd1f8e0c9209ebc348632882a3526 + languageName: node + linkType: hard + +"camelcase@npm:^5.3.1": + version: 5.3.1 + resolution: "camelcase@npm:5.3.1" + checksum: 92ff9b443bfe8abb15f2b1513ca182d16126359ad4f955ebc83dc4ddcc4ef3fdd2c078bc223f2673dc223488e75c99b16cc4d056624374b799e6a1555cf61b23 + languageName: node + linkType: hard + +"caniuse-lite@npm:^1.0.30001565": + version: 1.0.30001576 + resolution: "caniuse-lite@npm:1.0.30001576" + checksum: 79cf666f9139c542bdf75eab76171534dc638d2f8efacd325649c8ec6be59de400f0e9d6dc02504f12125626b306c0a848fe86904c01722218b2a479be82a9c1 + languageName: node + linkType: hard + +"canvg@npm:^3.0.6": + version: 3.0.10 + resolution: "canvg@npm:3.0.10" + dependencies: + "@babel/runtime": "npm:^7.12.5" + "@types/raf": "npm:^3.4.0" + core-js: "npm:^3.8.3" + raf: "npm:^3.4.1" + regenerator-runtime: "npm:^0.13.7" + rgbcolor: "npm:^1.0.1" + stackblur-canvas: "npm:^2.0.0" + svg-pathdata: "npm:^6.0.3" + checksum: b6bcd95d60c923c6a4e2be49e1fc1d395790577913a5a68439a2bb5a784ee75533ed7720bef69f2d9d0404203b4d61e89fdf1346f829e5da71e54cc57614153f + languageName: node + linkType: hard + +"ccount@npm:^1.0.0": + version: 1.1.0 + resolution: "ccount@npm:1.1.0" + checksum: 9ccfddfa45c8d6d01411b8e30d2ce03c55c33f32a69bdb84ee44d743427cdb01b03159954917023d0dac960c34973ba42626bb9fa883491ebb663a53a6713d43 + languageName: node + linkType: hard + +"chai@npm:^4.3.10": + version: 4.4.0 + resolution: "chai@npm:4.4.0" + dependencies: + assertion-error: "npm:^1.1.0" + check-error: "npm:^1.0.3" + deep-eql: "npm:^4.1.3" + get-func-name: "npm:^2.0.2" + loupe: "npm:^2.3.6" + pathval: "npm:^1.1.1" + type-detect: "npm:^4.0.8" + checksum: 34b6b616e77b42ae746f397ef8affaa0f3f2aa3955985de6d0faabcc9de250546e9e4f0d6bd9e59c920ff5f67937e6fa6e0f02752c0c3c43b0904e4f423cb9f7 + languageName: node + linkType: hard + +"chalk@npm:^2.4.1, chalk@npm:^2.4.2": + version: 2.4.2 + resolution: "chalk@npm:2.4.2" + dependencies: + ansi-styles: "npm:^3.2.1" + escape-string-regexp: "npm:^1.0.5" + supports-color: "npm:^5.3.0" + checksum: e6543f02ec877732e3a2d1c3c3323ddb4d39fbab687c23f526e25bd4c6a9bf3b83a696e8c769d078e04e5754921648f7821b2a2acfd16c550435fd630026e073 + languageName: node + linkType: hard + +"chalk@npm:^4.0.0": + version: 4.1.2 + resolution: "chalk@npm:4.1.2" + dependencies: + ansi-styles: "npm:^4.1.0" + supports-color: "npm:^7.1.0" + checksum: 4a3fef5cc34975c898ffe77141450f679721df9dde00f6c304353fa9c8b571929123b26a0e4617bde5018977eb655b31970c297b91b63ee83bb82aeb04666880 + languageName: node + linkType: hard + +"character-entities-legacy@npm:^1.0.0": + version: 1.1.4 + resolution: "character-entities-legacy@npm:1.1.4" + checksum: ea4ca9c29887335eed86d78fc67a640168342b1274da84c097abb0575a253d1265281a5052f9a863979e952bcc267b4ecaaf4fe233a7e1e0d8a47806c65b96c7 + languageName: node + linkType: hard + +"character-entities@npm:^1.0.0": + version: 1.2.4 + resolution: "character-entities@npm:1.2.4" + checksum: ad015c3d7163563b8a0ee1f587fb0ef305ef344e9fd937f79ca51cccc233786a01d591d989d5bf7b2e66b528ac9efba47f3b1897358324e69932f6d4b25adfe1 + languageName: node + linkType: hard + +"character-reference-invalid@npm:^1.0.0": + version: 1.1.4 + resolution: "character-reference-invalid@npm:1.1.4" + checksum: 29f05081c5817bd1e975b0bf61e77b60a40f62ad371d0f0ce0fdb48ab922278bc744d1fbe33771dced751887a8403f265ff634542675c8d7375f6ff4811efd0e + languageName: node + linkType: hard + +"check-error@npm:^1.0.3": + version: 1.0.3 + resolution: "check-error@npm:1.0.3" + dependencies: + get-func-name: "npm:^2.0.2" + checksum: 94aa37a7315c0e8a83d0112b5bfb5a8624f7f0f81057c73e4707729cdd8077166c6aefb3d8e2b92c63ee130d4a2ff94bad46d547e12f3238cc1d78342a973841 + languageName: node + linkType: hard + +"chownr@npm:^2.0.0": + version: 2.0.0 + resolution: "chownr@npm:2.0.0" + checksum: 594754e1303672171cc04e50f6c398ae16128eb134a88f801bf5354fd96f205320f23536a045d9abd8b51024a149696e51231565891d4efdab8846021ecf88e6 + languageName: node + linkType: hard + +"classnames@npm:2.x, classnames@npm:^2.2.5, classnames@npm:^2.3.0": + version: 2.5.1 + resolution: "classnames@npm:2.5.1" + checksum: afff4f77e62cea2d79c39962980bf316bacb0d7c49e13a21adaadb9221e1c6b9d3cdb829d8bb1b23c406f4e740507f37e1dcf506f7e3b7113d17c5bab787aa69 + languageName: node + linkType: hard + +"clean-stack@npm:^2.0.0": + version: 2.2.0 + resolution: "clean-stack@npm:2.2.0" + checksum: 1f90262d5f6230a17e27d0c190b09d47ebe7efdd76a03b5a1127863f7b3c9aec4c3e6c8bb3a7bbf81d553d56a1fd35728f5a8ef4c63f867ac8d690109742a8c1 + languageName: node + linkType: hard + +"cliui@npm:^7.0.2": + version: 7.0.4 + resolution: "cliui@npm:7.0.4" + dependencies: + string-width: "npm:^4.2.0" + strip-ansi: "npm:^6.0.0" + wrap-ansi: "npm:^7.0.0" + checksum: 6035f5daf7383470cef82b3d3db00bec70afb3423538c50394386ffbbab135e26c3689c41791f911fa71b62d13d3863c712fdd70f0fbdffd938a1e6fd09aac00 + languageName: node + linkType: hard + +"clsx@npm:^1.1.1, clsx@npm:^1.2.1": + version: 1.2.1 + resolution: "clsx@npm:1.2.1" + checksum: 34dead8bee24f5e96f6e7937d711978380647e936a22e76380290e35486afd8634966ce300fc4b74a32f3762c7d4c0303f442c3e259f4ce02374eb0c82834f27 + languageName: node + linkType: hard + +"color-convert@npm:^1.9.0": + version: 1.9.3 + resolution: "color-convert@npm:1.9.3" + dependencies: + color-name: "npm:1.1.3" + checksum: 5ad3c534949a8c68fca8fbc6f09068f435f0ad290ab8b2f76841b9e6af7e0bb57b98cb05b0e19fe33f5d91e5a8611ad457e5f69e0a484caad1f7487fd0e8253c + languageName: node + linkType: hard + +"color-convert@npm:^2.0.1": + version: 2.0.1 + resolution: "color-convert@npm:2.0.1" + dependencies: + color-name: "npm:~1.1.4" + checksum: 37e1150172f2e311fe1b2df62c6293a342ee7380da7b9cfdba67ea539909afbd74da27033208d01d6d5cfc65ee7868a22e18d7e7648e004425441c0f8a15a7d7 + languageName: node + linkType: hard + +"color-name@npm:1.1.3": + version: 1.1.3 + resolution: "color-name@npm:1.1.3" + checksum: 566a3d42cca25b9b3cd5528cd7754b8e89c0eb646b7f214e8e2eaddb69994ac5f0557d9c175eb5d8f0ad73531140d9c47525085ee752a91a2ab15ab459caf6d6 + languageName: node + linkType: hard + +"color-name@npm:^1.1.4, color-name@npm:~1.1.4": + version: 1.1.4 + resolution: "color-name@npm:1.1.4" + checksum: a1a3f914156960902f46f7f56bc62effc6c94e84b2cae157a526b1c1f74b677a47ec602bf68a61abfa2b42d15b7c5651c6dbe72a43af720bc588dff885b10f95 + languageName: node + linkType: hard + +"combined-stream@npm:^1.0.8": + version: 1.0.8 + resolution: "combined-stream@npm:1.0.8" + dependencies: + delayed-stream: "npm:~1.0.0" + checksum: 0dbb829577e1b1e839fa82b40c07ffaf7de8a09b935cadd355a73652ae70a88b4320db322f6634a4ad93424292fa80973ac6480986247f1734a1137debf271d5 + languageName: node + linkType: hard + +"commander@npm:2": + version: 2.20.3 + resolution: "commander@npm:2.20.3" + checksum: 74c781a5248c2402a0a3e966a0a2bba3c054aad144f5c023364be83265e796b20565aa9feff624132ff629aa64e16999fa40a743c10c12f7c61e96a794b99288 + languageName: node + linkType: hard + +"commander@npm:^11.0.0": + version: 11.1.0 + resolution: "commander@npm:11.1.0" + checksum: 13cc6ac875e48780250f723fb81c1c1178d35c5decb1abb1b628b3177af08a8554e76b2c0f29de72d69eef7c864d12613272a71fabef8047922bc622ab75a179 + languageName: node + linkType: hard + +"compare-func@npm:^2.0.0": + version: 2.0.0 + resolution: "compare-func@npm:2.0.0" + dependencies: + array-ify: "npm:^1.0.0" + dot-prop: "npm:^5.1.0" + checksum: 78bd4dd4ed311a79bd264c9e13c36ed564cde657f1390e699e0f04b8eee1fc06ffb8698ce2dfb5fbe7342d509579c82d4e248f08915b708f77f7b72234086cc3 + languageName: node + linkType: hard + +"concat-map@npm:0.0.1": + version: 0.0.1 + resolution: "concat-map@npm:0.0.1" + checksum: c996b1cfdf95b6c90fee4dae37e332c8b6eb7d106430c17d538034c0ad9a1630cb194d2ab37293b1bdd4d779494beee7786d586a50bd9376fd6f7bcc2bd4c98f + languageName: node + linkType: hard + +"conventional-changelog-angular@npm:^5.0.12": + version: 5.0.13 + resolution: "conventional-changelog-angular@npm:5.0.13" + dependencies: + compare-func: "npm:^2.0.0" + q: "npm:^1.5.1" + checksum: bca711b835fe01d75e3500b738f6525c91a12096218e917e9fd81bf9accf157f904fee16f88c523fd5462fb2a7cb1d060eb79e9bc9a3ccb04491f0c383b43231 + languageName: node + linkType: hard + +"conventional-changelog-atom@npm:^2.0.8": + version: 2.0.8 + resolution: "conventional-changelog-atom@npm:2.0.8" + dependencies: + q: "npm:^1.5.1" + checksum: 1c7e971e8ba58564397c2dfc9a7522f46bad315844ae782db66e27b2d584f22c21a757a429400657c2eef915690e8fd04bddfc3f8e9504d1fadccd8d0758217b + languageName: node + linkType: hard + +"conventional-changelog-cli@npm:^2.1.1": + version: 2.2.2 + resolution: "conventional-changelog-cli@npm:2.2.2" + dependencies: + add-stream: "npm:^1.0.0" + conventional-changelog: "npm:^3.1.24" + lodash: "npm:^4.17.15" + meow: "npm:^8.0.0" + tempfile: "npm:^3.0.0" + bin: + conventional-changelog: cli.js + checksum: f78790778b3e35c0f16d8299af98b03fd6376222047996cbfd2503a45ee86e3462f3276403ff6ee0cdaf7dcd90a2e230e16fc01fa7f64f5b5019a0dd34052ff4 + languageName: node + linkType: hard + +"conventional-changelog-codemirror@npm:^2.0.8": + version: 2.0.8 + resolution: "conventional-changelog-codemirror@npm:2.0.8" + dependencies: + q: "npm:^1.5.1" + checksum: 467c8c0daec0424acad6b30aa8897ea5e07c327352d3daae50f3a5427584bcb47d5ac5a3167eb7aeb818ebb856e2e81b19cab9a256fe6f21ad96e4a751599325 + languageName: node + linkType: hard + +"conventional-changelog-conventionalcommits@npm:^4.5.0": + version: 4.6.3 + resolution: "conventional-changelog-conventionalcommits@npm:4.6.3" + dependencies: + compare-func: "npm:^2.0.0" + lodash: "npm:^4.17.15" + q: "npm:^1.5.1" + checksum: f3b5e6132ec03dad4aa4a2b5ac47ee0e2ae8be6d0fa53a131c722412ce7c02a742c190790f15b5ab4983a31ce90b7066ce1f3f3d5cc4253aa3484ee414259bd2 + languageName: node + linkType: hard + +"conventional-changelog-core@npm:^4.2.1": + version: 4.2.4 + resolution: "conventional-changelog-core@npm:4.2.4" + dependencies: + add-stream: "npm:^1.0.0" + conventional-changelog-writer: "npm:^5.0.0" + conventional-commits-parser: "npm:^3.2.0" + dateformat: "npm:^3.0.0" + get-pkg-repo: "npm:^4.0.0" + git-raw-commits: "npm:^2.0.8" + git-remote-origin-url: "npm:^2.0.0" + git-semver-tags: "npm:^4.1.1" + lodash: "npm:^4.17.15" + normalize-package-data: "npm:^3.0.0" + q: "npm:^1.5.1" + read-pkg: "npm:^3.0.0" + read-pkg-up: "npm:^3.0.0" + through2: "npm:^4.0.0" + checksum: 4c9f30350250298d9bbb56988b3093ec7de593499a796609c5877115533362815434ff6df3493649e20b1b40399fef3d42032f39e8279bb8df192b89e6e32e69 + languageName: node + linkType: hard + +"conventional-changelog-ember@npm:^2.0.9": + version: 2.0.9 + resolution: "conventional-changelog-ember@npm:2.0.9" + dependencies: + q: "npm:^1.5.1" + checksum: bc37a1ec320b56f9831ec6a156d77444743944cdc06ff23b1175a3a23063b907b31fad402566a281b722da1bc9fd687db993cc8dbe9a9baf6e38af24541ccfbc + languageName: node + linkType: hard + +"conventional-changelog-eslint@npm:^3.0.9": + version: 3.0.9 + resolution: "conventional-changelog-eslint@npm:3.0.9" + dependencies: + q: "npm:^1.5.1" + checksum: 340b3be510e6713e37f641f0efcb2d8d2bc0b2c1bc38e7c1e2107f69432606290661d43cbc5971b418dd87cd92c2acb86af857264643a607cd8f29887e28683d + languageName: node + linkType: hard + +"conventional-changelog-express@npm:^2.0.6": + version: 2.0.6 + resolution: "conventional-changelog-express@npm:2.0.6" + dependencies: + q: "npm:^1.5.1" + checksum: 11a02868847d7d1c585bd38cdd7e39636aefde3ef83138044d859d31c23afc1a82a3cab26c8b8aaae2f536b457b011232325c3ed3f2d6a9ec564522dae265ae2 + languageName: node + linkType: hard + +"conventional-changelog-jquery@npm:^3.0.11": + version: 3.0.11 + resolution: "conventional-changelog-jquery@npm:3.0.11" + dependencies: + q: "npm:^1.5.1" + checksum: 5662ff1bee271f6f7f2ca893b84942ec01e4a48299701b3323383dde3e461301c65f248dbcfa8219742258e96b1547ba5f21e66f4785fbc39cbe3074d46d71a4 + languageName: node + linkType: hard + +"conventional-changelog-jshint@npm:^2.0.9": + version: 2.0.9 + resolution: "conventional-changelog-jshint@npm:2.0.9" + dependencies: + compare-func: "npm:^2.0.0" + q: "npm:^1.5.1" + checksum: 3048c3a02b173836f5c2f9c326bac7e80386e7591b9734d4f3a91e7dfe87329fde03414c62fdebe718a82f29e61b1122343186180e7173a47513487b3cfb463d + languageName: node + linkType: hard + +"conventional-changelog-preset-loader@npm:^2.3.4": + version: 2.3.4 + resolution: "conventional-changelog-preset-loader@npm:2.3.4" + checksum: a978bcd5fc2eb12b56bc03ec59705af32e521fd27b98a209a26767c2078d423e7d8e30c09d45547371631790f0387453434c73c4541521a7473dce14d5360c7d + languageName: node + linkType: hard + +"conventional-changelog-writer@npm:^5.0.0": + version: 5.0.1 + resolution: "conventional-changelog-writer@npm:5.0.1" + dependencies: + conventional-commits-filter: "npm:^2.0.7" + dateformat: "npm:^3.0.0" + handlebars: "npm:^4.7.7" + json-stringify-safe: "npm:^5.0.1" + lodash: "npm:^4.17.15" + meow: "npm:^8.0.0" + semver: "npm:^6.0.0" + split: "npm:^1.0.0" + through2: "npm:^4.0.0" + bin: + conventional-changelog-writer: cli.js + checksum: 268b56a3e4db07ad24da7134788c889ecd024cf2e7c0bfe8ca76f83e5db79f057538c45500b052a77b7933c4d0f47e2e807c6e756cbd5ad9db365744c9ce0e7f + languageName: node + linkType: hard + +"conventional-changelog@npm:^3.1.24": + version: 3.1.25 + resolution: "conventional-changelog@npm:3.1.25" + dependencies: + conventional-changelog-angular: "npm:^5.0.12" + conventional-changelog-atom: "npm:^2.0.8" + conventional-changelog-codemirror: "npm:^2.0.8" + conventional-changelog-conventionalcommits: "npm:^4.5.0" + conventional-changelog-core: "npm:^4.2.1" + conventional-changelog-ember: "npm:^2.0.9" + conventional-changelog-eslint: "npm:^3.0.9" + conventional-changelog-express: "npm:^2.0.6" + conventional-changelog-jquery: "npm:^3.0.11" + conventional-changelog-jshint: "npm:^2.0.9" + conventional-changelog-preset-loader: "npm:^2.3.4" + checksum: 8065d5d742a400ab6d73ea5a42af746c3ec51e081e5ea542b00ebb220f904828002a04ae5841d5588a242773f8112f28bc353bf700fb0b2bda182fac6505c7a7 + languageName: node + linkType: hard + +"conventional-commits-filter@npm:^2.0.7": + version: 2.0.7 + resolution: "conventional-commits-filter@npm:2.0.7" + dependencies: + lodash.ismatch: "npm:^4.4.0" + modify-values: "npm:^1.0.0" + checksum: df06fb29285b473614f5094e983d26fcc14cd0f64b2cbb2f65493fc8bd47c077c2310791d26f4b2b719e9585aaade95370e73230bff6647163164a18b9dfaa07 + languageName: node + linkType: hard + +"conventional-commits-parser@npm:^3.2.0": + version: 3.2.4 + resolution: "conventional-commits-parser@npm:3.2.4" + dependencies: + JSONStream: "npm:^1.0.4" + is-text-path: "npm:^1.0.1" + lodash: "npm:^4.17.15" + meow: "npm:^8.0.0" + split2: "npm:^3.0.0" + through2: "npm:^4.0.0" + bin: + conventional-commits-parser: cli.js + checksum: 122d7d7f991a04c8e3f703c0e4e9a25b2ecb20906f497e4486cb5c2acd9c68f6d9af745f7e79cb407538f50e840b33399274ac427b20971b98b335d1b66d3d17 + languageName: node + linkType: hard + +"convert-source-map@npm:^2.0.0": + version: 2.0.0 + resolution: "convert-source-map@npm:2.0.0" + checksum: 8f2f7a27a1a011cc6cc88cc4da2d7d0cfa5ee0369508baae3d98c260bb3ac520691464e5bbe4ae7cdf09860c1d69ecc6f70c63c6e7c7f7e3f18ec08484dc7d9b + languageName: node + linkType: hard + +"core-js@npm:^3.6.0, core-js@npm:^3.8.3": + version: 3.35.0 + resolution: "core-js@npm:3.35.0" + checksum: 1d545ff4406f2afa5e681f44b45ed5f7f119d158b380234d5aa7787ce7e47fc7a635b98b74c28c766ba8191e3db8c2316ad6ab4ff1ddecbc3fd618413a52c29c + languageName: node + linkType: hard + +"core-util-is@npm:~1.0.0": + version: 1.0.3 + resolution: "core-util-is@npm:1.0.3" + checksum: 90a0e40abbddfd7618f8ccd63a74d88deea94e77d0e8dbbea059fa7ebebb8fbb4e2909667fe26f3a467073de1a542ebe6ae4c73a73745ac5833786759cd906c9 + languageName: node + linkType: hard + +"cross-fetch@npm:^3.0.2": + version: 3.1.8 + resolution: "cross-fetch@npm:3.1.8" + dependencies: + node-fetch: "npm:^2.6.12" + checksum: 4c5e022ffe6abdf380faa6e2373c0c4ed7ef75e105c95c972b6f627c3f083170b6886f19fb488a7fa93971f4f69dcc890f122b0d97f0bf5f41ca1d9a8f58c8af + languageName: node + linkType: hard + +"cross-spawn@npm:^6.0.5": + version: 6.0.5 + resolution: "cross-spawn@npm:6.0.5" + dependencies: + nice-try: "npm:^1.0.4" + path-key: "npm:^2.0.1" + semver: "npm:^5.5.0" + shebang-command: "npm:^1.2.0" + which: "npm:^1.2.9" + checksum: e05544722e9d7189b4292c66e42b7abeb21db0d07c91b785f4ae5fefceb1f89e626da2703744657b287e86dcd4af57b54567cef75159957ff7a8a761d9055012 + languageName: node + linkType: hard + +"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2": + version: 7.0.3 + resolution: "cross-spawn@npm:7.0.3" + dependencies: + path-key: "npm:^3.1.0" + shebang-command: "npm:^2.0.0" + which: "npm:^2.0.1" + checksum: 5738c312387081c98d69c98e105b6327b069197f864a60593245d64c8089c8a0a744e16349281210d56835bb9274130d825a78b2ad6853ca13cfbeffc0c31750 + languageName: node + linkType: hard + +"css-element-queries@npm:^1.2.3": + version: 1.2.3 + resolution: "css-element-queries@npm:1.2.3" + checksum: 3864810f55c59d65fa26e61f960a676a0762a0e87eb959395615b09704fd4ca0ef4f21fa264b62f76482f84f532431349a1113fd10ea7570f09f6da7025908a4 + languageName: node + linkType: hard + +"css-line-break@npm:^2.1.0": + version: 2.1.0 + resolution: "css-line-break@npm:2.1.0" + dependencies: + utrie: "npm:^1.0.2" + checksum: b2222d99d5daf7861ecddc050244fdce296fad74b000dcff6bdfb1eb16dc2ef0b9ffe2c1c965e3239bd05ebe9eadb6d5438a91592fa8648d27a338e827cf9048 + languageName: node + linkType: hard + +"cssfontparser@npm:^1.2.1": + version: 1.2.1 + resolution: "cssfontparser@npm:1.2.1" + checksum: ceb9b2976d503dbff3ac2aff0229b263affb4fb221a6947b357682cd8a952f6995253646ca5f820020d2fe05b5e29b56dbdd2343388c32203e8dd0ed15bdc1ca + languageName: node + linkType: hard + +"cssom@npm:^0.5.0": + version: 0.5.0 + resolution: "cssom@npm:0.5.0" + checksum: 8c4121c243baf0678c65dcac29b201ff0067dfecf978de9d5c83b2ff127a8fdefd2bfd54577f5ad8c80ed7d2c8b489ae01c82023545d010c4ecb87683fb403dd + languageName: node + linkType: hard + +"cssom@npm:~0.3.6": + version: 0.3.8 + resolution: "cssom@npm:0.3.8" + checksum: d74017b209440822f9e24d8782d6d2e808a8fdd58fa626a783337222fe1c87a518ba944d4c88499031b4786e68772c99dfae616638d71906fe9f203aeaf14411 + languageName: node + linkType: hard + +"cssstyle@npm:^2.3.0": + version: 2.3.0 + resolution: "cssstyle@npm:2.3.0" + dependencies: + cssom: "npm:~0.3.6" + checksum: 863400da2a458f73272b9a55ba7ff05de40d850f22eb4f37311abebd7eff801cf1cd2fb04c4c92b8c3daed83fe766e52e4112afb7bc88d86c63a9c2256a7d178 + languageName: node + linkType: hard + +"csstype@npm:^3.0.2": + version: 3.1.3 + resolution: "csstype@npm:3.1.3" + checksum: 80c089d6f7e0c5b2bd83cf0539ab41474198579584fa10d86d0cafe0642202343cbc119e076a0b1aece191989477081415d66c9fefbf3c957fc2fc4b7009f248 + languageName: node + linkType: hard + +"d3-array@npm:2 - 3, d3-array@npm:2.10.0 - 3": + version: 3.2.4 + resolution: "d3-array@npm:3.2.4" + dependencies: + internmap: "npm:1 - 2" + checksum: 08b95e91130f98c1375db0e0af718f4371ccacef7d5d257727fe74f79a24383e79aba280b9ffae655483ffbbad4fd1dec4ade0119d88c4749f388641c8bf8c50 + languageName: node + linkType: hard + +"d3-array@npm:2, d3-array@npm:^2.3.0, d3-array@npm:^2.5.0, d3-array@npm:^2.5.1, d3-array@npm:^2.7.1": + version: 2.12.1 + resolution: "d3-array@npm:2.12.1" + dependencies: + internmap: "npm:^1.0.0" + checksum: 7eca10427a9f113a4ca6a0f7301127cab26043fd5e362631ef5a0edd1c4b2dd70c56ed317566700c31e4a6d88b55f3951aaba192291817f243b730cb2352882e + languageName: node + linkType: hard + +"d3-axis@npm:^2.0.0": + version: 2.1.0 + resolution: "d3-axis@npm:2.1.0" + checksum: 812558c0a016f8541e4704837b4428060695e2397e00a374caab5ae060a8ea6254bb097a4cfb7e01deff61da8a91c582eda614659ada5fd590da902a397428cc + languageName: node + linkType: hard + +"d3-brush@npm:^2.1.0": + version: 2.1.0 + resolution: "d3-brush@npm:2.1.0" + dependencies: + d3-dispatch: "npm:1 - 2" + d3-drag: "npm:2" + d3-interpolate: "npm:1 - 2" + d3-selection: "npm:2" + d3-transition: "npm:2" + checksum: f4221f815f8b0fb5af42a2c5baf7cb884067fdddfe5e3d9ae8b603912a47c205e138b8cdcb19a693feac46aa790c0dc9204c893e4b09cfdb944d31bde0b81126 + languageName: node + linkType: hard + +"d3-collection@npm:1": + version: 1.0.7 + resolution: "d3-collection@npm:1.0.7" + checksum: 7a3c7f733ce4a1a02f46a96c7dd02f8e46a2fa83fc4195682fd33624d6a56fbda6388c86ff5d30799cc768cb63bffcdb216b45c51a8d6e0b23117db9c18bedb3 + languageName: node + linkType: hard + +"d3-color@npm:1 - 2, d3-color@npm:^2.0.0": + version: 2.0.0 + resolution: "d3-color@npm:2.0.0" + checksum: 5aa58dfb78e3db764373a904eabb643dc024ff6071128a41e86faafa100e0e17a796e06ac3f2662e9937242bb75b8286788629773d76936f11c17bd5fe5e15cd + languageName: node + linkType: hard + +"d3-color@npm:1 - 3, d3-color@npm:^3.1.0": + version: 3.1.0 + resolution: "d3-color@npm:3.1.0" + checksum: a4e20e1115fa696fce041fbe13fbc80dc4c19150fa72027a7c128ade980bc0eeeba4bcf28c9e21f0bce0e0dbfe7ca5869ef67746541dcfda053e4802ad19783c + languageName: node + linkType: hard + +"d3-dispatch@npm:1": + version: 1.0.6 + resolution: "d3-dispatch@npm:1.0.6" + checksum: 6302554a019e2d75d4e3dc7e8757a00b4b12ac2a2952bccc66e4478ccd170f425e2b6a9443118d5feadcd2439f33582b63c7925e832104ff1978cadea2a30dc2 + languageName: node + linkType: hard + +"d3-dispatch@npm:1 - 2": + version: 2.0.0 + resolution: "d3-dispatch@npm:2.0.0" + checksum: 379f7ce1510f529da00a34016630e92e41c0f6bbffef7b849f4e46733c188c67418df266a9a541cda17572b5286e32fbaf66308fe04dcfe52aa551830825bc93 + languageName: node + linkType: hard + +"d3-dispatch@npm:1 - 3": + version: 3.0.1 + resolution: "d3-dispatch@npm:3.0.1" + checksum: 6eca77008ce2dc33380e45d4410c67d150941df7ab45b91d116dbe6d0a3092c0f6ac184dd4602c796dc9e790222bad3ff7142025f5fd22694efe088d1d941753 + languageName: node + linkType: hard + +"d3-drag@npm:2 - 3": + version: 3.0.0 + resolution: "d3-drag@npm:3.0.0" + dependencies: + d3-dispatch: "npm:1 - 3" + d3-selection: "npm:3" + checksum: d2556e8dc720741a443b595a30af403dd60642dfd938d44d6e9bfc4c71a962142f9a028c56b61f8b4790b65a34acad177d1263d66f103c3c527767b0926ef5aa + languageName: node + linkType: hard + +"d3-drag@npm:2, d3-drag@npm:^2.0.0": + version: 2.0.0 + resolution: "d3-drag@npm:2.0.0" + dependencies: + d3-dispatch: "npm:1 - 2" + d3-selection: "npm:2" + checksum: a6f2cfea47aa888b56476454554b37befb0d332f326704913142c6a89b295edfc0947a9fb5afdd0c6d0028878b832a975c80df55d009ab7ccf7b59faa99e926c + languageName: node + linkType: hard + +"d3-dsv@npm:1": + version: 1.2.0 + resolution: "d3-dsv@npm:1.2.0" + dependencies: + commander: "npm:2" + iconv-lite: "npm:0.4" + rw: "npm:1" + bin: + csv2json: bin/dsv2json + csv2tsv: bin/dsv2dsv + dsv2dsv: bin/dsv2dsv + dsv2json: bin/dsv2json + json2csv: bin/json2dsv + json2dsv: bin/json2dsv + json2tsv: bin/json2dsv + tsv2csv: bin/dsv2dsv + tsv2json: bin/dsv2json + checksum: e1698408b3c583d236f2c5f333d793cff2ac65e5ee11c4b6606becf86bf1d089e6de2be730aa9103c3d175fe3d63942de9a5a808e439ff9de7219149aa58aa37 + languageName: node + linkType: hard + +"d3-dsv@npm:^2.0.0": + version: 2.0.0 + resolution: "d3-dsv@npm:2.0.0" + dependencies: + commander: "npm:2" + iconv-lite: "npm:0.4" + rw: "npm:1" + bin: + csv2json: bin/dsv2json + csv2tsv: bin/dsv2dsv + dsv2dsv: bin/dsv2dsv + dsv2json: bin/dsv2json + json2csv: bin/json2dsv + json2dsv: bin/json2dsv + json2tsv: bin/json2dsv + tsv2csv: bin/dsv2dsv + tsv2json: bin/dsv2json + checksum: b5e4a0945664a941ad37d3c5ee8c8cbb3c99712ff7f36b2420446ebfc3b3909eb3d9ef2682b4a77afa6a6c5f5af1d659e17d6678863d95b244aed479b6c7c5c3 + languageName: node + linkType: hard + +"d3-ease@npm:1 - 2": + version: 2.0.0 + resolution: "d3-ease@npm:2.0.0" + checksum: 4c2e74417739b73f5d185675be0a72b19df1f729b87c457d4b13976f7eef5c1f54739b4ccd71d9730521c959cfac28a56f5f4040dd2baf5729ac7e4adce344f1 + languageName: node + linkType: hard + +"d3-ease@npm:1 - 3": + version: 3.0.1 + resolution: "d3-ease@npm:3.0.1" + checksum: fec8ef826c0cc35cda3092c6841e07672868b1839fcaf556e19266a3a37e6bc7977d8298c0fcb9885e7799bfdcef7db1baaba9cd4dcf4bc5e952cf78574a88b0 + languageName: node + linkType: hard + +"d3-format@npm:1 - 2, d3-format@npm:^2.0.0": + version: 2.0.0 + resolution: "d3-format@npm:2.0.0" + checksum: c869af459e20767dc3d9cbb2946ba79cc266ae4fb35d11c50c63fc89ea4ed168c702c7e3db94d503b3618de9609bf3bf2d855ef53e21109ddd7eb9c8f3fcf8a1 + languageName: node + linkType: hard + +"d3-format@npm:1 - 3, d3-format@npm:^3.1.0": + version: 3.1.0 + resolution: "d3-format@npm:3.1.0" + checksum: 049f5c0871ebce9859fc5e2f07f336b3c5bfff52a2540e0bac7e703fce567cd9346f4ad1079dd18d6f1e0eaa0599941c1810898926f10ac21a31fd0a34b4aa75 + languageName: node + linkType: hard + +"d3-geo@npm:^2.0.1": + version: 2.0.2 + resolution: "d3-geo@npm:2.0.2" + dependencies: + d3-array: "npm:^2.5.0" + checksum: 6836feb33036f03ec1dc728d64171f3eb40ee2c1c0f2e28232055aa317e5e2d481075294babb9553596e2080496eda119b8a43c51f71c893e6258ccf002bd7f8 + languageName: node + linkType: hard + +"d3-interpolate@npm:1 - 2, d3-interpolate@npm:1.2.0 - 2": + version: 2.0.1 + resolution: "d3-interpolate@npm:2.0.1" + dependencies: + d3-color: "npm:1 - 2" + checksum: 2a5725b0c9c7fef3e8878cf75ad67be851b1472de3dda1f694c441786a1a32e198ddfaa6880d6b280401c1af5b844b61ccdd63d85d1607c1e6bb3a3f0bf532ea + languageName: node + linkType: hard + +"d3-interpolate@npm:1 - 3, d3-interpolate@npm:1.2.0 - 3": + version: 3.0.1 + resolution: "d3-interpolate@npm:3.0.1" + dependencies: + d3-color: "npm:1 - 3" + checksum: 19f4b4daa8d733906671afff7767c19488f51a43d251f8b7f484d5d3cfc36c663f0a66c38fe91eee30f40327443d799be17169f55a293a3ba949e84e57a33e6a + languageName: node + linkType: hard + +"d3-path@npm:1 - 2": + version: 2.0.0 + resolution: "d3-path@npm:2.0.0" + checksum: ef206f83c1123d4ad364c23b6fe877a7cd8afa76c30e13bd0588cd9b7c4ed4b577ebfd9499cdcac63268d7ae29c0a53ec38d6623a7c98585f3c118323e8f473f + languageName: node + linkType: hard + +"d3-queue@npm:^3.0.7": + version: 3.0.7 + resolution: "d3-queue@npm:3.0.7" + checksum: e060aaf085ced1218cb24197affd8152a4828b8ff8d700057770e6131cf8956a5d7478dc39275a3861ffcabf2154c4936267bf36474d5c9b3ad0f5a9fa114b03 + languageName: node + linkType: hard + +"d3-request@npm:^1.0.6": + version: 1.0.6 + resolution: "d3-request@npm:1.0.6" + dependencies: + d3-collection: "npm:1" + d3-dispatch: "npm:1" + d3-dsv: "npm:1" + xmlhttprequest: "npm:1" + checksum: 5826a95e1aa19d5c988139080fd913865faf6f4bf7daff12aa328e12ed04c3aa833ab3ec824aa6310774252084203ca4d2115c68750943681554c34b9d010691 + languageName: node + linkType: hard + +"d3-scale-chromatic@npm:^2.0.0": + version: 2.0.0 + resolution: "d3-scale-chromatic@npm:2.0.0" + dependencies: + d3-color: "npm:1 - 2" + d3-interpolate: "npm:1 - 2" + checksum: 93cafe497b00046b1d4e237a8bb8981fbb35ba03070f420bd913872f6e9d2c9628ed8bb8c84c6a6ffe16029359fa74b646c5c5129732ef4186ab059a77da3021 + languageName: node + linkType: hard + +"d3-scale@npm:^3.2.1": + version: 3.3.0 + resolution: "d3-scale@npm:3.3.0" + dependencies: + d3-array: "npm:^2.3.0" + d3-format: "npm:1 - 2" + d3-interpolate: "npm:1.2.0 - 2" + d3-time: "npm:^2.1.1" + d3-time-format: "npm:2 - 3" + checksum: cb63c271ec9c5b632c245c63e0d0716b32adcc468247972c552f5be62fb34a17f71e4ac29fd8976704369f4b958bc6789c61a49427efe2160ae979d7843569dc + languageName: node + linkType: hard + +"d3-scale@npm:^4.0.2": + version: 4.0.2 + resolution: "d3-scale@npm:4.0.2" + dependencies: + d3-array: "npm:2.10.0 - 3" + d3-format: "npm:1 - 3" + d3-interpolate: "npm:1.2.0 - 3" + d3-time: "npm:2.1.1 - 3" + d3-time-format: "npm:2 - 4" + checksum: 65d9ad8c2641aec30ed5673a7410feb187a224d6ca8d1a520d68a7d6eac9d04caedbff4713d1e8545be33eb7fec5739983a7ab1d22d4e5ad35368c6729d362f1 + languageName: node + linkType: hard + +"d3-selection@npm:2 - 3, d3-selection@npm:3": + version: 3.0.0 + resolution: "d3-selection@npm:3.0.0" + checksum: e59096bbe8f0cb0daa1001d9bdd6dbc93a688019abc97d1d8b37f85cd3c286a6875b22adea0931b0c88410d025563e1643019161a883c516acf50c190a11b56b + languageName: node + linkType: hard + +"d3-selection@npm:2, d3-selection@npm:^2.0.0": + version: 2.0.0 + resolution: "d3-selection@npm:2.0.0" + checksum: cd38f5e0baf2011f421e909ff5748235b18510175b7433ddddb04df325a4a03d7db07da09993afb464d5f050174c13cb5d843da902e71e3e8eb5f06c28fc8689 + languageName: node + linkType: hard + +"d3-shape@npm:^2.0.0": + version: 2.1.0 + resolution: "d3-shape@npm:2.1.0" + dependencies: + d3-path: "npm:1 - 2" + checksum: d86c84322b0ccd550df93ec4986359548cb2c25c9fae326984a59d1caeeb40c78f62678bb93951eed65536bc2d8efa446b13386acb79875234dc79dbcf16dbd7 + languageName: node + linkType: hard + +"d3-time-format@npm:2 - 3": + version: 3.0.0 + resolution: "d3-time-format@npm:3.0.0" + dependencies: + d3-time: "npm:1 - 2" + checksum: 0abe3379f07d1c12ce8930cdddad1223c99cd3e4eac05cf409b5a7953e9ebed56a95a64b0977f63958cfb6101fa4a2a85533a5eae40df84f22c0117dbf5e8982 + languageName: node + linkType: hard + +"d3-time-format@npm:2 - 4": + version: 4.1.0 + resolution: "d3-time-format@npm:4.1.0" + dependencies: + d3-time: "npm:1 - 3" + checksum: 735e00fb25a7fd5d418fac350018713ae394eefddb0d745fab12bbff0517f9cdb5f807c7bbe87bb6eeb06249662f8ea84fec075f7d0cd68609735b2ceb29d206 + languageName: node + linkType: hard + +"d3-time@npm:1 - 2, d3-time@npm:^2.1.1": + version: 2.1.1 + resolution: "d3-time@npm:2.1.1" + dependencies: + d3-array: "npm:2" + checksum: 4a01770a857bc37d2bafb8f00250e0e6a1fcc8051aea93e5eed168d8ee93e92da508a75ab5e42fc5472aa37e2a83aac68afaf3f12d9167c184ce781faadf5682 + languageName: node + linkType: hard + +"d3-time@npm:1 - 3, d3-time@npm:2.1.1 - 3": + version: 3.1.0 + resolution: "d3-time@npm:3.1.0" + dependencies: + d3-array: "npm:2 - 3" + checksum: a984f77e1aaeaa182679b46fbf57eceb6ebdb5f67d7578d6f68ef933f8eeb63737c0949991618a8d29472dbf43736c7d7f17c452b2770f8c1271191cba724ca1 + languageName: node + linkType: hard + +"d3-timer@npm:1 - 2": + version: 2.0.0 + resolution: "d3-timer@npm:2.0.0" + checksum: 95f92ed8edbd0844c023de543ebca4d6aba7f9f8b2ecdbc3d61e01e4df5e74ffbce81238a3c4fd63d118bb1d05ca6331522df565fab146a2790e5c6a847f6275 + languageName: node + linkType: hard + +"d3-timer@npm:1 - 3": + version: 3.0.1 + resolution: "d3-timer@npm:3.0.1" + checksum: d4c63cb4bb5461d7038aac561b097cd1c5673969b27cbdd0e87fa48d9300a538b9e6f39b4a7f0e3592ef4f963d858c8a9f0e92754db73116770856f2fc04561a + languageName: node + linkType: hard + +"d3-transition@npm:2": + version: 2.0.0 + resolution: "d3-transition@npm:2.0.0" + dependencies: + d3-color: "npm:1 - 2" + d3-dispatch: "npm:1 - 2" + d3-ease: "npm:1 - 2" + d3-interpolate: "npm:1 - 2" + d3-timer: "npm:1 - 2" + peerDependencies: + d3-selection: 2 + checksum: a775365c90acfcf5745fb18146ce0a5cb71bfdf69433f4d12cc286da0f88b3b1fbdd6782ccfe8e60de95133107cd8a47a4736fa19e94ffb08f1000e6cd9ebdb6 + languageName: node + linkType: hard + +"d3-transition@npm:2 - 3, d3-transition@npm:^3.0.1": + version: 3.0.1 + resolution: "d3-transition@npm:3.0.1" + dependencies: + d3-color: "npm:1 - 3" + d3-dispatch: "npm:1 - 3" + d3-ease: "npm:1 - 3" + d3-interpolate: "npm:1 - 3" + d3-timer: "npm:1 - 3" + peerDependencies: + d3-selection: 2 - 3 + checksum: 4e74535dda7024aa43e141635b7522bb70cf9d3dfefed975eb643b36b864762eca67f88fafc2ca798174f83ca7c8a65e892624f824b3f65b8145c6a1a88dbbad + languageName: node + linkType: hard + +"d3-zoom@npm:^3.0.0": + version: 3.0.0 + resolution: "d3-zoom@npm:3.0.0" + dependencies: + d3-dispatch: "npm:1 - 3" + d3-drag: "npm:2 - 3" + d3-interpolate: "npm:1 - 3" + d3-selection: "npm:2 - 3" + d3-transition: "npm:2 - 3" + checksum: ee2036479049e70d8c783d594c444fe00e398246048e3f11a59755cd0e21de62ece3126181b0d7a31bf37bcf32fd726f83ae7dea4495ff86ec7736ce5ad36fd3 + languageName: node + linkType: hard + +"damerau-levenshtein@npm:^1.0.8": + version: 1.0.8 + resolution: "damerau-levenshtein@npm:1.0.8" + checksum: 4c2647e0f42acaee7d068756c1d396e296c3556f9c8314bac1ac63ffb236217ef0e7e58602b18bb2173deec7ec8e0cac8e27cccf8f5526666b4ff11a13ad54a3 + languageName: node + linkType: hard + +"dargs@npm:^7.0.0": + version: 7.0.0 + resolution: "dargs@npm:7.0.0" + checksum: ec7f6a8315a8fa2f8b12d39207615bdf62b4d01f631b96fbe536c8ad5469ab9ed710d55811e564d0d5c1d548fc8cb6cc70bf0939f2415790159f5a75e0f96c92 + languageName: node + linkType: hard + +"data-urls@npm:^3.0.1": + version: 3.0.2 + resolution: "data-urls@npm:3.0.2" + dependencies: + abab: "npm:^2.0.6" + whatwg-mimetype: "npm:^3.0.0" + whatwg-url: "npm:^11.0.0" + checksum: 051c3aaaf3e961904f136aab095fcf6dff4db23a7fc759dd8ba7b3e6ba03fc07ef608086caad8ab910d864bd3b5e57d0d2f544725653d77c96a2c971567045f4 + languageName: node + linkType: hard + +"dateformat@npm:^3.0.0": + version: 3.0.3 + resolution: "dateformat@npm:3.0.3" + checksum: 2effb8bef52ff912f87a05e4adbeacff46353e91313ad1ea9ed31412db26849f5a0fcc7e3ce36dbfb84fc6c881a986d5694f84838ad0da7000d5150693e78678 + languageName: node + linkType: hard + +"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4": + version: 4.3.4 + resolution: "debug@npm:4.3.4" + dependencies: + ms: "npm:2.1.2" + peerDependenciesMeta: + supports-color: + optional: true + checksum: cedbec45298dd5c501d01b92b119cd3faebe5438c3917ff11ae1bff86a6c722930ac9c8659792824013168ba6db7c4668225d845c633fbdafbbf902a6389f736 + languageName: node + linkType: hard + +"decamelize-keys@npm:^1.1.0": + version: 1.1.1 + resolution: "decamelize-keys@npm:1.1.1" + dependencies: + decamelize: "npm:^1.1.0" + map-obj: "npm:^1.0.0" + checksum: 4ca385933127437658338c65fb9aead5f21b28d3dd3ccd7956eb29aab0953b5d3c047fbc207111672220c71ecf7a4d34f36c92851b7bbde6fca1a02c541bdd7d + languageName: node + linkType: hard + +"decamelize@npm:^1.1.0": + version: 1.2.0 + resolution: "decamelize@npm:1.2.0" + checksum: 85c39fe8fbf0482d4a1e224ef0119db5c1897f8503bcef8b826adff7a1b11414972f6fef2d7dec2ee0b4be3863cf64ac1439137ae9e6af23a3d8dcbe26a5b4b2 + languageName: node + linkType: hard + +"decimal.js@npm:^10.3.1": + version: 10.4.3 + resolution: "decimal.js@npm:10.4.3" + checksum: 6d60206689ff0911f0ce968d40f163304a6c1bc739927758e6efc7921cfa630130388966f16bf6ef6b838cb33679fbe8e7a78a2f3c478afce841fd55ac8fb8ee + languageName: node + linkType: hard + +"deep-eql@npm:^4.1.3": + version: 4.1.3 + resolution: "deep-eql@npm:4.1.3" + dependencies: + type-detect: "npm:^4.0.0" + checksum: ff34e8605d8253e1bf9fe48056e02c6f347b81d9b5df1c6650a1b0f6f847b4a86453b16dc226b34f853ef14b626e85d04e081b022e20b00cd7d54f079ce9bbdd + languageName: node + linkType: hard + +"deep-is@npm:^0.1.3": + version: 0.1.4 + resolution: "deep-is@npm:0.1.4" + checksum: 7f0ee496e0dff14a573dc6127f14c95061b448b87b995fc96c017ce0a1e66af1675e73f1d6064407975bc4ea6ab679497a29fff7b5b9c4e99cb10797c1ad0b4c + languageName: node + linkType: hard + +"define-data-property@npm:^1.0.1, define-data-property@npm:^1.1.1": + version: 1.1.1 + resolution: "define-data-property@npm:1.1.1" + dependencies: + get-intrinsic: "npm:^1.2.1" + gopd: "npm:^1.0.1" + has-property-descriptors: "npm:^1.0.0" + checksum: 77ef6e0bceb515e05b5913ab635a84d537cee84f8a7c37c77fdcb31fc5b80f6dbe81b33375e4b67d96aa04e6a0d8d4ea099e431d83f089af8d93adfb584bcb94 + languageName: node + linkType: hard + +"define-properties@npm:^1.1.3, define-properties@npm:^1.2.0, define-properties@npm:^1.2.1": + version: 1.2.1 + resolution: "define-properties@npm:1.2.1" + dependencies: + define-data-property: "npm:^1.0.1" + has-property-descriptors: "npm:^1.0.0" + object-keys: "npm:^1.1.1" + checksum: 88a152319ffe1396ccc6ded510a3896e77efac7a1bfbaa174a7b00414a1747377e0bb525d303794a47cf30e805c2ec84e575758512c6e44a993076d29fd4e6c3 + languageName: node + linkType: hard + +"delayed-stream@npm:~1.0.0": + version: 1.0.0 + resolution: "delayed-stream@npm:1.0.0" + checksum: d758899da03392e6712f042bec80aa293bbe9e9ff1b2634baae6a360113e708b91326594c8a486d475c69d6259afb7efacdc3537bfcda1c6c648e390ce601b19 + languageName: node + linkType: hard + +"dequal@npm:^2.0.3": + version: 2.0.3 + resolution: "dequal@npm:2.0.3" + checksum: f98860cdf58b64991ae10205137c0e97d384c3a4edc7f807603887b7c4b850af1224a33d88012009f150861cbee4fa2d322c4cc04b9313bee312e47f6ecaa888 + languageName: node + linkType: hard + +"diff-sequences@npm:^29.4.3": + version: 29.6.3 + resolution: "diff-sequences@npm:29.6.3" + checksum: 32e27ac7dbffdf2fb0eb5a84efd98a9ad084fbabd5ac9abb8757c6770d5320d2acd172830b28c4add29bb873d59420601dfc805ac4064330ce59b1adfd0593b2 + languageName: node + linkType: hard + +"dir-glob@npm:^3.0.1": + version: 3.0.1 + resolution: "dir-glob@npm:3.0.1" + dependencies: + path-type: "npm:^4.0.0" + checksum: dcac00920a4d503e38bb64001acb19df4efc14536ada475725e12f52c16777afdee4db827f55f13a908ee7efc0cb282e2e3dbaeeb98c0993dd93d1802d3bf00c + languageName: node + linkType: hard + +"doctrine@npm:^2.1.0": + version: 2.1.0 + resolution: "doctrine@npm:2.1.0" + dependencies: + esutils: "npm:^2.0.2" + checksum: b6416aaff1f380bf56c3b552f31fdf7a69b45689368deca72d28636f41c16bb28ec3ebc40ace97db4c1afc0ceeb8120e8492fe0046841c94c2933b2e30a7d5ac + languageName: node + linkType: hard + +"doctrine@npm:^3.0.0": + version: 3.0.0 + resolution: "doctrine@npm:3.0.0" + dependencies: + esutils: "npm:^2.0.2" + checksum: c96bdccabe9d62ab6fea9399fdff04a66e6563c1d6fb3a3a063e8d53c3bb136ba63e84250bbf63d00086a769ad53aef92d2bd483f03f837fc97b71cbee6b2520 + languageName: node + linkType: hard + +"dom-scroll-into-view@npm:^1.2.1": + version: 1.2.1 + resolution: "dom-scroll-into-view@npm:1.2.1" + checksum: d8afe3cf0c2e7b5c3027f30571e3b3ae56c9330f74f26926371d7a923218813fbf5fa1f2c41d2f87aa967239d3205dfec94c53940f4d2ec95f699d4459801242 + languageName: node + linkType: hard + +"dom-serializer@npm:^2.0.0": + version: 2.0.0 + resolution: "dom-serializer@npm:2.0.0" + dependencies: + domelementtype: "npm:^2.3.0" + domhandler: "npm:^5.0.2" + entities: "npm:^4.2.0" + checksum: d5ae2b7110ca3746b3643d3ef60ef823f5f078667baf530cec096433f1627ec4b6fa8c072f09d079d7cda915fd2c7bc1b7b935681e9b09e591e1e15f4040b8e2 + languageName: node + linkType: hard + +"domelementtype@npm:^2.3.0": + version: 2.3.0 + resolution: "domelementtype@npm:2.3.0" + checksum: 686f5a9ef0fff078c1412c05db73a0dce096190036f33e400a07e2a4518e9f56b1e324f5c576a0a747ef0e75b5d985c040b0d51945ce780c0dd3c625a18cd8c9 + languageName: node + linkType: hard + +"domexception@npm:^4.0.0": + version: 4.0.0 + resolution: "domexception@npm:4.0.0" + dependencies: + webidl-conversions: "npm:^7.0.0" + checksum: 774277cd9d4df033f852196e3c0077a34dbd15a96baa4d166e0e47138a80f4c0bdf0d94e4703e6ff5883cec56bb821a6fff84402d8a498e31de7c87eb932a294 + languageName: node + linkType: hard + +"domhandler@npm:^5.0, domhandler@npm:^5.0.2, domhandler@npm:^5.0.3": + version: 5.0.3 + resolution: "domhandler@npm:5.0.3" + dependencies: + domelementtype: "npm:^2.3.0" + checksum: bba1e5932b3e196ad6862286d76adc89a0dbf0c773e5ced1eb01f9af930c50093a084eff14b8de5ea60b895c56a04d5de8bbc4930c5543d029091916770b2d2a + languageName: node + linkType: hard + +"dompurify@npm:^2.2.0": + version: 2.4.7 + resolution: "dompurify@npm:2.4.7" + checksum: c04fa6a7c7276d0bc80e6330f697cfecd96ec1d3964b17de916f26cb0b5b2c9a98ba343d84e759f2b8339e577e619ef3749f3d128ef18ddb8230b09bd2ff3f29 + languageName: node + linkType: hard + +"domutils@npm:^3.1.0": + version: 3.1.0 + resolution: "domutils@npm:3.1.0" + dependencies: + dom-serializer: "npm:^2.0.0" + domelementtype: "npm:^2.3.0" + domhandler: "npm:^5.0.3" + checksum: 342d64cf4d07b8a0573fb51e0a6312a88fb520c7fefd751870bf72fa5fc0f2e0cb9a3958a573610b1d608c6e2a69b8e9b4b40f0bfb8f87a71bce4f180cca1887 + languageName: node + linkType: hard + +"dot-prop@npm:^5.1.0": + version: 5.3.0 + resolution: "dot-prop@npm:5.3.0" + dependencies: + is-obj: "npm:^2.0.0" + checksum: 93f0d343ef87fe8869320e62f2459f7e70f49c6098d948cc47e060f4a3f827d0ad61e83cb82f2bd90cd5b9571b8d334289978a43c0f98fea4f0e99ee8faa0599 + languageName: node + linkType: hard + +"dup@npm:^1.0.0": + version: 1.0.0 + resolution: "dup@npm:1.0.0" + checksum: 990cde73bbecf90ff58101d2fd96016930fbefd03f047a041a3cc83fcfa22e04c7a02ee4747707b5dabe87fc3a78814d95a9b20d9e6dc98738bd2388efde6f64 + languageName: node + linkType: hard + +"earcut@npm:^2.2.4": + version: 2.2.4 + resolution: "earcut@npm:2.2.4" + checksum: 01ca51830edd2787819f904ae580087d37351f6048b4565e7add4b3da8a86b7bc19262ab2aa7fdc64129ab03af2d9cec8cccee4d230c82275f97ef285c79aafb + languageName: node + linkType: hard + +"eastasianwidth@npm:^0.2.0": + version: 0.2.0 + resolution: "eastasianwidth@npm:0.2.0" + checksum: 26f364ebcdb6395f95124fda411f63137a4bfb5d3a06453f7f23dfe52502905bd84e0488172e0f9ec295fdc45f05c23d5d91baf16bd26f0fe9acd777a188dc39 + languageName: node + linkType: hard + +"electron-to-chromium@npm:^1.4.601": + version: 1.4.625 + resolution: "electron-to-chromium@npm:1.4.625" + checksum: 81df3118f944307f0f7ddc2933bcd966f3aecf2a71e45b6609a9618d06c7a5cdaeef4dd04f1d0874d214fabc59ecd356ae1b171147fc477be133400def403d4d + languageName: node + linkType: hard + +"emoji-regex@npm:^8.0.0": + version: 8.0.0 + resolution: "emoji-regex@npm:8.0.0" + checksum: b6053ad39951c4cf338f9092d7bfba448cdfd46fe6a2a034700b149ac9ffbc137e361cbd3c442297f86bed2e5f7576c1b54cc0a6bf8ef5106cc62f496af35010 + languageName: node + linkType: hard + +"emoji-regex@npm:^9.2.2": + version: 9.2.2 + resolution: "emoji-regex@npm:9.2.2" + checksum: af014e759a72064cf66e6e694a7fc6b0ed3d8db680427b021a89727689671cefe9d04151b2cad51dbaf85d5ba790d061cd167f1cf32eb7b281f6368b3c181639 + languageName: node + linkType: hard + +"encoding@npm:^0.1.13": + version: 0.1.13 + resolution: "encoding@npm:0.1.13" + dependencies: + iconv-lite: "npm:^0.6.2" + checksum: 36d938712ff00fe1f4bac88b43bcffb5930c1efa57bbcdca9d67e1d9d6c57cfb1200fb01efe0f3109b2ce99b231f90779532814a81370a1bd3274a0f58585039 + languageName: node + linkType: hard + +"entities@npm:^4.2.0, entities@npm:^4.5.0": + version: 4.5.0 + resolution: "entities@npm:4.5.0" + checksum: 5b039739f7621f5d1ad996715e53d964035f75ad3b9a4d38c6b3804bb226e282ffeae2443624d8fdd9c47d8e926ae9ac009c54671243f0c3294c26af7cc85250 + languageName: node + linkType: hard + +"env-paths@npm:^2.2.0": + version: 2.2.1 + resolution: "env-paths@npm:2.2.1" + checksum: 285325677bf00e30845e330eec32894f5105529db97496ee3f598478e50f008c5352a41a30e5e72ec9de8a542b5a570b85699cd63bd2bc646dbcb9f311d83bc4 + languageName: node + linkType: hard + +"err-code@npm:^2.0.2": + version: 2.0.3 + resolution: "err-code@npm:2.0.3" + checksum: b642f7b4dd4a376e954947550a3065a9ece6733ab8e51ad80db727aaae0817c2e99b02a97a3d6cecc648a97848305e728289cf312d09af395403a90c9d4d8a66 + languageName: node + linkType: hard + +"error-ex@npm:^1.3.1": + version: 1.3.2 + resolution: "error-ex@npm:1.3.2" + dependencies: + is-arrayish: "npm:^0.2.1" + checksum: ba827f89369b4c93382cfca5a264d059dfefdaa56ecc5e338ffa58a6471f5ed93b71a20add1d52290a4873d92381174382658c885ac1a2305f7baca363ce9cce + languageName: node + linkType: hard + +"es-abstract@npm:^1.22.1": + version: 1.22.3 + resolution: "es-abstract@npm:1.22.3" + dependencies: + array-buffer-byte-length: "npm:^1.0.0" + arraybuffer.prototype.slice: "npm:^1.0.2" + available-typed-arrays: "npm:^1.0.5" + call-bind: "npm:^1.0.5" + es-set-tostringtag: "npm:^2.0.1" + es-to-primitive: "npm:^1.2.1" + function.prototype.name: "npm:^1.1.6" + get-intrinsic: "npm:^1.2.2" + get-symbol-description: "npm:^1.0.0" + globalthis: "npm:^1.0.3" + gopd: "npm:^1.0.1" + has-property-descriptors: "npm:^1.0.0" + has-proto: "npm:^1.0.1" + has-symbols: "npm:^1.0.3" + hasown: "npm:^2.0.0" + internal-slot: "npm:^1.0.5" + is-array-buffer: "npm:^3.0.2" + is-callable: "npm:^1.2.7" + is-negative-zero: "npm:^2.0.2" + is-regex: "npm:^1.1.4" + is-shared-array-buffer: "npm:^1.0.2" + is-string: "npm:^1.0.7" + is-typed-array: "npm:^1.1.12" + is-weakref: "npm:^1.0.2" + object-inspect: "npm:^1.13.1" + object-keys: "npm:^1.1.1" + object.assign: "npm:^4.1.4" + regexp.prototype.flags: "npm:^1.5.1" + safe-array-concat: "npm:^1.0.1" + safe-regex-test: "npm:^1.0.0" + string.prototype.trim: "npm:^1.2.8" + string.prototype.trimend: "npm:^1.0.7" + string.prototype.trimstart: "npm:^1.0.7" + typed-array-buffer: "npm:^1.0.0" + typed-array-byte-length: "npm:^1.0.0" + typed-array-byte-offset: "npm:^1.0.0" + typed-array-length: "npm:^1.0.4" + unbox-primitive: "npm:^1.0.2" + which-typed-array: "npm:^1.1.13" + checksum: da31ec43b1c8eb47ba8a17693cac143682a1078b6c3cd883ce0e2062f135f532e93d873694ef439670e1f6ca03195118f43567ba6f33fb0d6c7daae750090236 + languageName: node + linkType: hard + +"es-iterator-helpers@npm:^1.0.12, es-iterator-helpers@npm:^1.0.15": + version: 1.0.15 + resolution: "es-iterator-helpers@npm:1.0.15" + dependencies: + asynciterator.prototype: "npm:^1.0.0" + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.1" + es-abstract: "npm:^1.22.1" + es-set-tostringtag: "npm:^2.0.1" + function-bind: "npm:^1.1.1" + get-intrinsic: "npm:^1.2.1" + globalthis: "npm:^1.0.3" + has-property-descriptors: "npm:^1.0.0" + has-proto: "npm:^1.0.1" + has-symbols: "npm:^1.0.3" + internal-slot: "npm:^1.0.5" + iterator.prototype: "npm:^1.1.2" + safe-array-concat: "npm:^1.0.1" + checksum: b4c83f94bfe624260d5238092de3173989f76f1416b1d02c388aea3b2024174e5f5f0e864057311ac99790b57e836ca3545b6e77256b26066dac944519f5e6d6 + languageName: node + linkType: hard + +"es-set-tostringtag@npm:^2.0.1": + version: 2.0.2 + resolution: "es-set-tostringtag@npm:2.0.2" + dependencies: + get-intrinsic: "npm:^1.2.2" + has-tostringtag: "npm:^1.0.0" + hasown: "npm:^2.0.0" + checksum: 176d6bd1be31dd0145dcceee62bb78d4a5db7f81db437615a18308a6f62bcffe45c15081278413455e8cf0aad4ea99079de66f8de389605942dfdacbad74c2d5 + languageName: node + linkType: hard + +"es-shim-unscopables@npm:^1.0.0": + version: 1.0.2 + resolution: "es-shim-unscopables@npm:1.0.2" + dependencies: + hasown: "npm:^2.0.0" + checksum: f495af7b4b7601a4c0cfb893581c352636e5c08654d129590386a33a0432cf13a7bdc7b6493801cadd990d838e2839b9013d1de3b880440cb537825e834fe783 + languageName: node + linkType: hard + +"es-to-primitive@npm:^1.2.1": + version: 1.2.1 + resolution: "es-to-primitive@npm:1.2.1" + dependencies: + is-callable: "npm:^1.1.4" + is-date-object: "npm:^1.0.1" + is-symbol: "npm:^1.0.2" + checksum: 0886572b8dc075cb10e50c0af62a03d03a68e1e69c388bd4f10c0649ee41b1fbb24840a1b7e590b393011b5cdbe0144b776da316762653685432df37d6de60f1 + languageName: node + linkType: hard + +"es6-promisify@npm:^6.1.1": + version: 6.1.1 + resolution: "es6-promisify@npm:6.1.1" + checksum: 2c1f68c28f0dc81d15f832ea02ea052f335d72c7600ba93f6df3a25dc7b7fd839d522f814a79470c71a3b45a730f96070024ec38c0ed55e74ba294391ab6ee5a + languageName: node + linkType: hard + +"es6-promisify@npm:^7.0.0": + version: 7.0.0 + resolution: "es6-promisify@npm:7.0.0" + checksum: 2d71b098a9bff9802cdb5cd9f4079d13d31236a2ed4753230c3099edff2c0f34b280fcf7ce814e0ff30713dfb25dd888d1eb2ac50a8f1e26ceae04d66d51c4f4 + languageName: node + linkType: hard + +"esbuild@npm:^0.12.25": + version: 0.12.29 + resolution: "esbuild@npm:0.12.29" + bin: + esbuild: bin/esbuild + checksum: 23e5fb9fc4e3c94e36aeecc86963964911bbdb7faeb163f1e4702d62a0c897e3cd32945218804d44367af035d05f2705b5e32f46c28c31a14106a7cdbcb68a04 + languageName: node + linkType: hard + +"esbuild@npm:^0.18.10": + version: 0.18.20 + resolution: "esbuild@npm:0.18.20" + dependencies: + "@esbuild/android-arm": "npm:0.18.20" + "@esbuild/android-arm64": "npm:0.18.20" + "@esbuild/android-x64": "npm:0.18.20" + "@esbuild/darwin-arm64": "npm:0.18.20" + "@esbuild/darwin-x64": "npm:0.18.20" + "@esbuild/freebsd-arm64": "npm:0.18.20" + "@esbuild/freebsd-x64": "npm:0.18.20" + "@esbuild/linux-arm": "npm:0.18.20" + "@esbuild/linux-arm64": "npm:0.18.20" + "@esbuild/linux-ia32": "npm:0.18.20" + "@esbuild/linux-loong64": "npm:0.18.20" + "@esbuild/linux-mips64el": "npm:0.18.20" + "@esbuild/linux-ppc64": "npm:0.18.20" + "@esbuild/linux-riscv64": "npm:0.18.20" + "@esbuild/linux-s390x": "npm:0.18.20" + "@esbuild/linux-x64": "npm:0.18.20" + "@esbuild/netbsd-x64": "npm:0.18.20" + "@esbuild/openbsd-x64": "npm:0.18.20" + "@esbuild/sunos-x64": "npm:0.18.20" + "@esbuild/win32-arm64": "npm:0.18.20" + "@esbuild/win32-ia32": "npm:0.18.20" + "@esbuild/win32-x64": "npm:0.18.20" + dependenciesMeta: + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 473b1d92842f50a303cf948a11ebd5f69581cd254d599dd9d62f9989858e0533f64e83b723b5e1398a5b488c0f5fd088795b4235f65ecaf4f007d4b79f04bc88 + languageName: node + linkType: hard + +"esbuild@npm:^0.19.3": + version: 0.19.11 + resolution: "esbuild@npm:0.19.11" + dependencies: + "@esbuild/aix-ppc64": "npm:0.19.11" + "@esbuild/android-arm": "npm:0.19.11" + "@esbuild/android-arm64": "npm:0.19.11" + "@esbuild/android-x64": "npm:0.19.11" + "@esbuild/darwin-arm64": "npm:0.19.11" + "@esbuild/darwin-x64": "npm:0.19.11" + "@esbuild/freebsd-arm64": "npm:0.19.11" + "@esbuild/freebsd-x64": "npm:0.19.11" + "@esbuild/linux-arm": "npm:0.19.11" + "@esbuild/linux-arm64": "npm:0.19.11" + "@esbuild/linux-ia32": "npm:0.19.11" + "@esbuild/linux-loong64": "npm:0.19.11" + "@esbuild/linux-mips64el": "npm:0.19.11" + "@esbuild/linux-ppc64": "npm:0.19.11" + "@esbuild/linux-riscv64": "npm:0.19.11" + "@esbuild/linux-s390x": "npm:0.19.11" + "@esbuild/linux-x64": "npm:0.19.11" + "@esbuild/netbsd-x64": "npm:0.19.11" + "@esbuild/openbsd-x64": "npm:0.19.11" + "@esbuild/sunos-x64": "npm:0.19.11" + "@esbuild/win32-arm64": "npm:0.19.11" + "@esbuild/win32-ia32": "npm:0.19.11" + "@esbuild/win32-x64": "npm:0.19.11" + dependenciesMeta: + "@esbuild/aix-ppc64": + optional: true + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 0fd913124089e26d30ec30f73b94d4ef9607935251df3253f869106980a5d4c78aa517738c8746abe6e933262e91a77d31427ce468ed8fc7fe498a20f7f92fbc + languageName: node + linkType: hard + +"escalade@npm:^3.1.1": + version: 3.1.1 + resolution: "escalade@npm:3.1.1" + checksum: afd02e6ca91ffa813e1108b5e7756566173d6bc0d1eb951cb44d6b21702ec17c1cf116cfe75d4a2b02e05acb0b808a7a9387d0d1ca5cf9c04ad03a8445c3e46d + languageName: node + linkType: hard + +"escape-string-regexp@npm:^1.0.5": + version: 1.0.5 + resolution: "escape-string-regexp@npm:1.0.5" + checksum: a968ad453dd0c2724e14a4f20e177aaf32bb384ab41b674a8454afe9a41c5e6fe8903323e0a1052f56289d04bd600f81278edf140b0fcc02f5cac98d0f5b5371 + languageName: node + linkType: hard + +"escape-string-regexp@npm:^4.0.0": + version: 4.0.0 + resolution: "escape-string-regexp@npm:4.0.0" + checksum: 9497d4dd307d845bd7f75180d8188bb17ea8c151c1edbf6b6717c100e104d629dc2dfb687686181b0f4b7d732c7dfdc4d5e7a8ff72de1b0ca283a75bbb3a9cd9 + languageName: node + linkType: hard + +"escodegen@npm:^2.0.0": + version: 2.1.0 + resolution: "escodegen@npm:2.1.0" + dependencies: + esprima: "npm:^4.0.1" + estraverse: "npm:^5.2.0" + esutils: "npm:^2.0.2" + source-map: "npm:~0.6.1" + dependenciesMeta: + source-map: + optional: true + bin: + escodegen: bin/escodegen.js + esgenerate: bin/esgenerate.js + checksum: e1450a1f75f67d35c061bf0d60888b15f62ab63aef9df1901cffc81cffbbb9e8b3de237c5502cf8613a017c1df3a3003881307c78835a1ab54d8c8d2206e01d3 + languageName: node + linkType: hard + +"eslint-config-prettier@npm:^8.5.0": + version: 8.10.0 + resolution: "eslint-config-prettier@npm:8.10.0" + peerDependencies: + eslint: ">=7.0.0" + bin: + eslint-config-prettier: bin/cli.js + checksum: 19f8c497d9bdc111a17a61b25ded97217be3755bbc4714477dfe535ed539dddcaf42ef5cf8bb97908b058260cf89a3d7c565cb0be31096cbcd39f4c2fa5fe43c + languageName: node + linkType: hard + +"eslint-plugin-jsx-a11y@npm:^6.7.1": + version: 6.8.0 + resolution: "eslint-plugin-jsx-a11y@npm:6.8.0" + dependencies: + "@babel/runtime": "npm:^7.23.2" + aria-query: "npm:^5.3.0" + array-includes: "npm:^3.1.7" + array.prototype.flatmap: "npm:^1.3.2" + ast-types-flow: "npm:^0.0.8" + axe-core: "npm:=4.7.0" + axobject-query: "npm:^3.2.1" + damerau-levenshtein: "npm:^1.0.8" + emoji-regex: "npm:^9.2.2" + es-iterator-helpers: "npm:^1.0.15" + hasown: "npm:^2.0.0" + jsx-ast-utils: "npm:^3.3.5" + language-tags: "npm:^1.0.9" + minimatch: "npm:^3.1.2" + object.entries: "npm:^1.1.7" + object.fromentries: "npm:^2.0.7" + peerDependencies: + eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 + checksum: 199b883e526e6f9d7c54cb3f094abc54f11a1ec816db5fb6cae3b938eb0e503acc10ccba91ca7451633a9d0b9abc0ea03601844a8aba5fe88c5e8897c9ac8f49 + languageName: node + linkType: hard + +"eslint-plugin-prettier@npm:^4.2.1": + version: 4.2.1 + resolution: "eslint-plugin-prettier@npm:4.2.1" + dependencies: + prettier-linter-helpers: "npm:^1.0.0" + peerDependencies: + eslint: ">=7.28.0" + prettier: ">=2.0.0" + peerDependenciesMeta: + eslint-config-prettier: + optional: true + checksum: c5e7316baeab9d96ac39c279f16686e837277e5c67a8006c6588bcff317edffdc1532fb580441eb598bc6770f6444006756b68a6575dff1cd85ebe227252d0b7 + languageName: node + linkType: hard + +"eslint-plugin-react@npm:^7.30.1": + version: 7.33.2 + resolution: "eslint-plugin-react@npm:7.33.2" + dependencies: + array-includes: "npm:^3.1.6" + array.prototype.flatmap: "npm:^1.3.1" + array.prototype.tosorted: "npm:^1.1.1" + doctrine: "npm:^2.1.0" + es-iterator-helpers: "npm:^1.0.12" + estraverse: "npm:^5.3.0" + jsx-ast-utils: "npm:^2.4.1 || ^3.0.0" + minimatch: "npm:^3.1.2" + object.entries: "npm:^1.1.6" + object.fromentries: "npm:^2.0.6" + object.hasown: "npm:^1.1.2" + object.values: "npm:^1.1.6" + prop-types: "npm:^15.8.1" + resolve: "npm:^2.0.0-next.4" + semver: "npm:^6.3.1" + string.prototype.matchall: "npm:^4.0.8" + peerDependencies: + eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 + checksum: f9b247861024bafc396c4bd3c9ac946604b3b23077251c98f23602aa22027a0c33a69157fd49564e4ff7f17b3678e5dc366a46c7ec42a09454d7cbce786d5001 + languageName: node + linkType: hard + +"eslint-scope@npm:^5.1.1": + version: 5.1.1 + resolution: "eslint-scope@npm:5.1.1" + dependencies: + esrecurse: "npm:^4.3.0" + estraverse: "npm:^4.1.1" + checksum: d30ef9dc1c1cbdece34db1539a4933fe3f9b14e1ffb27ecc85987902ee663ad7c9473bbd49a9a03195a373741e62e2f807c4938992e019b511993d163450e70a + languageName: node + linkType: hard + +"eslint-scope@npm:^7.2.2": + version: 7.2.2 + resolution: "eslint-scope@npm:7.2.2" + dependencies: + esrecurse: "npm:^4.3.0" + estraverse: "npm:^5.2.0" + checksum: 613c267aea34b5a6d6c00514e8545ef1f1433108097e857225fed40d397dd6b1809dffd11c2fde23b37ca53d7bf935fe04d2a18e6fc932b31837b6ad67e1c116 + languageName: node + linkType: hard + +"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1, eslint-visitor-keys@npm:^3.4.3": + version: 3.4.3 + resolution: "eslint-visitor-keys@npm:3.4.3" + checksum: 92708e882c0a5ffd88c23c0b404ac1628cf20104a108c745f240a13c332a11aac54f49a22d5762efbffc18ecbc9a580d1b7ad034bf5f3cc3307e5cbff2ec9820 + languageName: node + linkType: hard + +"eslint@npm:^8.19.0": + version: 8.56.0 + resolution: "eslint@npm:8.56.0" + dependencies: + "@eslint-community/eslint-utils": "npm:^4.2.0" + "@eslint-community/regexpp": "npm:^4.6.1" + "@eslint/eslintrc": "npm:^2.1.4" + "@eslint/js": "npm:8.56.0" + "@humanwhocodes/config-array": "npm:^0.11.13" + "@humanwhocodes/module-importer": "npm:^1.0.1" + "@nodelib/fs.walk": "npm:^1.2.8" + "@ungap/structured-clone": "npm:^1.2.0" + ajv: "npm:^6.12.4" + chalk: "npm:^4.0.0" + cross-spawn: "npm:^7.0.2" + debug: "npm:^4.3.2" + doctrine: "npm:^3.0.0" + escape-string-regexp: "npm:^4.0.0" + eslint-scope: "npm:^7.2.2" + eslint-visitor-keys: "npm:^3.4.3" + espree: "npm:^9.6.1" + esquery: "npm:^1.4.2" + esutils: "npm:^2.0.2" + fast-deep-equal: "npm:^3.1.3" + file-entry-cache: "npm:^6.0.1" + find-up: "npm:^5.0.0" + glob-parent: "npm:^6.0.2" + globals: "npm:^13.19.0" + graphemer: "npm:^1.4.0" + ignore: "npm:^5.2.0" + imurmurhash: "npm:^0.1.4" + is-glob: "npm:^4.0.0" + is-path-inside: "npm:^3.0.3" + js-yaml: "npm:^4.1.0" + json-stable-stringify-without-jsonify: "npm:^1.0.1" + levn: "npm:^0.4.1" + lodash.merge: "npm:^4.6.2" + minimatch: "npm:^3.1.2" + natural-compare: "npm:^1.4.0" + optionator: "npm:^0.9.3" + strip-ansi: "npm:^6.0.1" + text-table: "npm:^0.2.0" + bin: + eslint: bin/eslint.js + checksum: 2be598f7da1339d045ad933ffd3d4742bee610515cd2b0d9a2b8b729395a01d4e913552fff555b559fccaefd89d7b37632825789d1b06470608737ae69ab43fb + languageName: node + linkType: hard + +"esm@npm:^3.2.25": + version: 3.2.25 + resolution: "esm@npm:3.2.25" + checksum: 8e60e8075506a7ce28681c30c8f54623fe18a251c364cd481d86719fc77f58aa055b293d80632d9686d5408aaf865ffa434897dc9fd9153c8b3f469fad23f094 + languageName: node + linkType: hard + +"espree@npm:^9.6.0, espree@npm:^9.6.1": + version: 9.6.1 + resolution: "espree@npm:9.6.1" + dependencies: + acorn: "npm:^8.9.0" + acorn-jsx: "npm:^5.3.2" + eslint-visitor-keys: "npm:^3.4.1" + checksum: 1a2e9b4699b715347f62330bcc76aee224390c28bb02b31a3752e9d07549c473f5f986720483c6469cf3cfb3c9d05df612ffc69eb1ee94b54b739e67de9bb460 + languageName: node + linkType: hard + +"esprima@npm:^4.0.1": + version: 4.0.1 + resolution: "esprima@npm:4.0.1" + bin: + esparse: ./bin/esparse.js + esvalidate: ./bin/esvalidate.js + checksum: ad4bab9ead0808cf56501750fd9d3fb276f6b105f987707d059005d57e182d18a7c9ec7f3a01794ebddcca676773e42ca48a32d67a250c9d35e009ca613caba3 + languageName: node + linkType: hard + +"esquery@npm:^1.4.2": + version: 1.5.0 + resolution: "esquery@npm:1.5.0" + dependencies: + estraverse: "npm:^5.1.0" + checksum: a084bd049d954cc88ac69df30534043fb2aee5555b56246493f42f27d1e168f00d9e5d4192e46f10290d312dc30dc7d58994d61a609c579c1219d636996f9213 + languageName: node + linkType: hard + +"esrecurse@npm:^4.3.0": + version: 4.3.0 + resolution: "esrecurse@npm:4.3.0" + dependencies: + estraverse: "npm:^5.2.0" + checksum: 81a37116d1408ded88ada45b9fb16dbd26fba3aadc369ce50fcaf82a0bac12772ebd7b24cd7b91fc66786bf2c1ac7b5f196bc990a473efff972f5cb338877cf5 + languageName: node + linkType: hard + +"estraverse@npm:^4.1.1": + version: 4.3.0 + resolution: "estraverse@npm:4.3.0" + checksum: 9cb46463ef8a8a4905d3708a652d60122a0c20bb58dec7e0e12ab0e7235123d74214fc0141d743c381813e1b992767e2708194f6f6e0f9fd00c1b4e0887b8b6d + languageName: node + linkType: hard + +"estraverse@npm:^5.1.0, estraverse@npm:^5.2.0, estraverse@npm:^5.3.0": + version: 5.3.0 + resolution: "estraverse@npm:5.3.0" + checksum: 1ff9447b96263dec95d6d67431c5e0771eb9776427421260a3e2f0fdd5d6bd4f8e37a7338f5ad2880c9f143450c9b1e4fc2069060724570a49cf9cf0312bd107 + languageName: node + linkType: hard + +"esutils@npm:^2.0.2": + version: 2.0.3 + resolution: "esutils@npm:2.0.3" + checksum: 9a2fe69a41bfdade834ba7c42de4723c97ec776e40656919c62cbd13607c45e127a003f05f724a1ea55e5029a4cf2de444b13009f2af71271e42d93a637137c7 + languageName: node + linkType: hard + +"eventemitter3@npm:^3.1.0": + version: 3.1.2 + resolution: "eventemitter3@npm:3.1.2" + checksum: c67262eccbf85848b7cc6d4abb6c6e34155e15686db2a01c57669fd0d44441a574a19d44d25948b442929e065774cbe5003d8e77eed47674fbf876ac77887793 + languageName: node + linkType: hard + +"eventemitter3@npm:^5.0.0": + version: 5.0.1 + resolution: "eventemitter3@npm:5.0.1" + checksum: 4ba5c00c506e6c786b4d6262cfbce90ddc14c10d4667e5c83ae993c9de88aa856033994dd2b35b83e8dc1170e224e66a319fa80adc4c32adcd2379bbc75da814 + languageName: node + linkType: hard + +"events@npm:^3.3.0": + version: 3.3.0 + resolution: "events@npm:3.3.0" + checksum: d6b6f2adbccbcda74ddbab52ed07db727ef52e31a61ed26db9feb7dc62af7fc8e060defa65e5f8af9449b86b52cc1a1f6a79f2eafcf4e62add2b7a1fa4a432f6 + languageName: node + linkType: hard + +"exponential-backoff@npm:^3.1.1": + version: 3.1.1 + resolution: "exponential-backoff@npm:3.1.1" + checksum: 160456d2d647e6019640bd07111634d8c353038d9fa40176afb7cd49b0548bdae83b56d05e907c2cce2300b81cae35d800ef92fefb9d0208e190fa3b7d6bb579 + languageName: node + linkType: hard + +"extend@npm:^3.0.0": + version: 3.0.2 + resolution: "extend@npm:3.0.2" + checksum: 73bf6e27406e80aa3e85b0d1c4fd987261e628064e170ca781125c0b635a3dabad5e05adbf07595ea0cf1e6c5396cacb214af933da7cbaf24fe75ff14818e8f9 + languageName: node + linkType: hard + +"fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3": + version: 3.1.3 + resolution: "fast-deep-equal@npm:3.1.3" + checksum: 40dedc862eb8992c54579c66d914635afbec43350afbbe991235fdcb4e3a8d5af1b23ae7e79bef7d4882d0ecee06c3197488026998fb19f72dc95acff1d1b1d0 + languageName: node + linkType: hard + +"fast-diff@npm:^1.1.2": + version: 1.3.0 + resolution: "fast-diff@npm:1.3.0" + checksum: 5c19af237edb5d5effda008c891a18a585f74bf12953be57923f17a3a4d0979565fc64dbc73b9e20926b9d895f5b690c618cbb969af0cf022e3222471220ad29 + languageName: node + linkType: hard + +"fast-glob@npm:^3.2.9": + version: 3.3.2 + resolution: "fast-glob@npm:3.3.2" + dependencies: + "@nodelib/fs.stat": "npm:^2.0.2" + "@nodelib/fs.walk": "npm:^1.2.3" + glob-parent: "npm:^5.1.2" + merge2: "npm:^1.3.0" + micromatch: "npm:^4.0.4" + checksum: 42baad7b9cd40b63e42039132bde27ca2cb3a4950d0a0f9abe4639ea1aa9d3e3b40f98b1fe31cbc0cc17b664c9ea7447d911a152fa34ec5b72977b125a6fc845 + languageName: node + linkType: hard + +"fast-json-stable-stringify@npm:^2.0.0": + version: 2.1.0 + resolution: "fast-json-stable-stringify@npm:2.1.0" + checksum: 7f081eb0b8a64e0057b3bb03f974b3ef00135fbf36c1c710895cd9300f13c94ba809bb3a81cf4e1b03f6e5285610a61abbd7602d0652de423144dfee5a389c9b + languageName: node + linkType: hard + +"fast-levenshtein@npm:^2.0.6": + version: 2.0.6 + resolution: "fast-levenshtein@npm:2.0.6" + checksum: 111972b37338bcb88f7d9e2c5907862c280ebf4234433b95bc611e518d192ccb2d38119c4ac86e26b668d75f7f3894f4ff5c4982899afced7ca78633b08287c4 + languageName: node + linkType: hard + +"fastq@npm:^1.6.0": + version: 1.16.0 + resolution: "fastq@npm:1.16.0" + dependencies: + reusify: "npm:^1.0.4" + checksum: 38c1b49adba639af020727284a02af021acab764efd7f088bc31364e8a5b01ce9031eb6c5f7f304019b8267c3b7c236e79d6904884f50f94f83b1700b8a6619a + languageName: node + linkType: hard + +"fetch-jsonp@npm:^1.1.3": + version: 1.3.0 + resolution: "fetch-jsonp@npm:1.3.0" + checksum: c4966252fe8e6a9445fd06ade39775e78087c774157461c7a93d1dbabc90b019618d9565010181ce62c1b6104f45371a401a242fc473ddf895009659def7628d + languageName: node + linkType: hard + +"fflate@npm:^0.4.8": + version: 0.4.8 + resolution: "fflate@npm:0.4.8" + checksum: 29d1eddaaa5deab61b1c6b0d21282adacadbc4d2c01e94d8b1ee784398151673b9c563e53f97a801bc410a1ae55e8de5378114a743430e643e7a0644ba8e5a42 + languageName: node + linkType: hard + +"fflate@npm:^0.7.1": + version: 0.7.4 + resolution: "fflate@npm:0.7.4" + checksum: 5e749eb3a6ed61a0f6c55756abf9f4258f06f60505db689e22d18503dd252ca5af656d32668e4b7b20714adf8b313febf695d23863a8352f23e325baee0f672d + languageName: node + linkType: hard + +"file-entry-cache@npm:^6.0.1": + version: 6.0.1 + resolution: "file-entry-cache@npm:6.0.1" + dependencies: + flat-cache: "npm:^3.0.4" + checksum: 58473e8a82794d01b38e5e435f6feaf648e3f36fdb3a56e98f417f4efae71ad1c0d4ebd8a9a7c50c3ad085820a93fc7494ad721e0e4ebc1da3573f4e1c3c7cdd + languageName: node + linkType: hard + +"fill-range@npm:^7.0.1": + version: 7.0.1 + resolution: "fill-range@npm:7.0.1" + dependencies: + to-regex-range: "npm:^5.0.1" + checksum: 7cdad7d426ffbaadf45aeb5d15ec675bbd77f7597ad5399e3d2766987ed20bda24d5fac64b3ee79d93276f5865608bb22344a26b9b1ae6c4d00bd94bf611623f + languageName: node + linkType: hard + +"find-up@npm:^2.0.0": + version: 2.1.0 + resolution: "find-up@npm:2.1.0" + dependencies: + locate-path: "npm:^2.0.0" + checksum: c080875c9fe28eb1962f35cbe83c683796a0321899f1eed31a37577800055539815de13d53495049697d3ba313013344f843bb9401dd337a1b832be5edfc6840 + languageName: node + linkType: hard + +"find-up@npm:^4.1.0": + version: 4.1.0 + resolution: "find-up@npm:4.1.0" + dependencies: + locate-path: "npm:^5.0.0" + path-exists: "npm:^4.0.0" + checksum: 0406ee89ebeefa2d507feb07ec366bebd8a6167ae74aa4e34fb4c4abd06cf782a3ce26ae4194d70706f72182841733f00551c209fe575cb00bd92104056e78c1 + languageName: node + linkType: hard + +"find-up@npm:^5.0.0": + version: 5.0.0 + resolution: "find-up@npm:5.0.0" + dependencies: + locate-path: "npm:^6.0.0" + path-exists: "npm:^4.0.0" + checksum: 062c5a83a9c02f53cdd6d175a37ecf8f87ea5bbff1fdfb828f04bfa021441bc7583e8ebc0872a4c1baab96221fb8a8a275a19809fb93fbc40bd69ec35634069a + languageName: node + linkType: hard + +"flat-cache@npm:^3.0.4": + version: 3.2.0 + resolution: "flat-cache@npm:3.2.0" + dependencies: + flatted: "npm:^3.2.9" + keyv: "npm:^4.5.3" + rimraf: "npm:^3.0.2" + checksum: b76f611bd5f5d68f7ae632e3ae503e678d205cf97a17c6ab5b12f6ca61188b5f1f7464503efae6dc18683ed8f0b41460beb48ac4b9ac63fe6201296a91ba2f75 + languageName: node + linkType: hard + +"flatted@npm:^3.2.9": + version: 3.2.9 + resolution: "flatted@npm:3.2.9" + checksum: 5c91c5a0a21bbc0b07b272231e5b4efe6b822bcb4ad317caf6bb06984be4042a9e9045026307da0fdb4583f1f545e317a67ef1231a59e71f7fced3cc429cfc53 + languageName: node + linkType: hard + +"for-each@npm:^0.3.3": + version: 0.3.3 + resolution: "for-each@npm:0.3.3" + dependencies: + is-callable: "npm:^1.1.3" + checksum: 22330d8a2db728dbf003ec9182c2d421fbcd2969b02b4f97ec288721cda63eb28f2c08585ddccd0f77cb2930af8d958005c9e72f47141dc51816127a118f39aa + languageName: node + linkType: hard + +"foreground-child@npm:^2.0.0": + version: 2.0.0 + resolution: "foreground-child@npm:2.0.0" + dependencies: + cross-spawn: "npm:^7.0.0" + signal-exit: "npm:^3.0.2" + checksum: 6719982783a448162f9a01500757fb2053bc5dcd4d67c7cd30739b38ccc01b39f84e408c30989d1d8774519c021c0498e2450ab127690fb09d7f2568fd94ffcc + languageName: node + linkType: hard + +"foreground-child@npm:^3.1.0": + version: 3.1.1 + resolution: "foreground-child@npm:3.1.1" + dependencies: + cross-spawn: "npm:^7.0.0" + signal-exit: "npm:^4.0.1" + checksum: 9700a0285628abaeb37007c9a4d92bd49f67210f09067638774338e146c8e9c825c5c877f072b2f75f41dc6a2d0be8664f79ffc03f6576649f54a84fb9b47de0 + languageName: node + linkType: hard + +"form-data@npm:^4.0.0": + version: 4.0.0 + resolution: "form-data@npm:4.0.0" + dependencies: + asynckit: "npm:^0.4.0" + combined-stream: "npm:^1.0.8" + mime-types: "npm:^2.1.12" + checksum: cb6f3ac49180be03ff07ba3ff125f9eba2ff0b277fb33c7fc47569fc5e616882c5b1c69b9904c4c4187e97dd0419dd03b134174756f296dec62041e6527e2c6e + languageName: node + linkType: hard + +"fs-minipass@npm:^2.0.0": + version: 2.1.0 + resolution: "fs-minipass@npm:2.1.0" + dependencies: + minipass: "npm:^3.0.0" + checksum: 703d16522b8282d7299337539c3ed6edddd1afe82435e4f5b76e34a79cd74e488a8a0e26a636afc2440e1a23b03878e2122e3a2cfe375a5cf63c37d92b86a004 + languageName: node + linkType: hard + +"fs-minipass@npm:^3.0.0": + version: 3.0.3 + resolution: "fs-minipass@npm:3.0.3" + dependencies: + minipass: "npm:^7.0.3" + checksum: 63e80da2ff9b621e2cb1596abcb9207f1cf82b968b116ccd7b959e3323144cce7fb141462200971c38bbf2ecca51695069db45265705bed09a7cd93ae5b89f94 + languageName: node + linkType: hard + +"fs.realpath@npm:^1.0.0": + version: 1.0.0 + resolution: "fs.realpath@npm:1.0.0" + checksum: 444cf1291d997165dfd4c0d58b69f0e4782bfd9149fd72faa4fe299e68e0e93d6db941660b37dd29153bf7186672ececa3b50b7e7249477b03fdf850f287c948 + languageName: node + linkType: hard + +"fsevents@npm:2.3.2": + version: 2.3.2 + resolution: "fsevents@npm:2.3.2" + dependencies: + node-gyp: "npm:latest" + checksum: be78a3efa3e181cda3cf7a4637cb527bcebb0bd0ea0440105a3bb45b86f9245b307dc10a2507e8f4498a7d4ec349d1910f4d73e4d4495b16103106e07eee735b + conditions: os=darwin + languageName: node + linkType: hard + +"fsevents@npm:~2.3.2, fsevents@npm:~2.3.3": + version: 2.3.3 + resolution: "fsevents@npm:2.3.3" + dependencies: + node-gyp: "npm:latest" + checksum: a1f0c44595123ed717febbc478aa952e47adfc28e2092be66b8ab1635147254ca6cfe1df792a8997f22716d4cbafc73309899ff7bfac2ac3ad8cf2e4ecc3ec60 + conditions: os=darwin + languageName: node + linkType: hard + +"fsevents@patch:fsevents@npm%3A2.3.2#optional!builtin": + version: 2.3.2 + resolution: "fsevents@patch:fsevents@npm%3A2.3.2#optional!builtin::version=2.3.2&hash=df0bf1" + dependencies: + node-gyp: "npm:latest" + conditions: os=darwin + languageName: node + linkType: hard + +"fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.3#optional!builtin": + version: 2.3.3 + resolution: "fsevents@patch:fsevents@npm%3A2.3.3#optional!builtin::version=2.3.3&hash=df0bf1" + dependencies: + node-gyp: "npm:latest" + conditions: os=darwin + languageName: node + linkType: hard + +"function-bind@npm:^1.1.1, function-bind@npm:^1.1.2": + version: 1.1.2 + resolution: "function-bind@npm:1.1.2" + checksum: d8680ee1e5fcd4c197e4ac33b2b4dce03c71f4d91717292785703db200f5c21f977c568d28061226f9b5900cbcd2c84463646134fd5337e7925e0942bc3f46d5 + languageName: node + linkType: hard + +"function.prototype.name@npm:^1.1.5, function.prototype.name@npm:^1.1.6": + version: 1.1.6 + resolution: "function.prototype.name@npm:1.1.6" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + functions-have-names: "npm:^1.2.3" + checksum: 9eae11294905b62cb16874adb4fc687927cda3162285e0ad9612e6a1d04934005d46907362ea9cdb7428edce05a2f2c3dabc3b2d21e9fd343e9bb278230ad94b + languageName: node + linkType: hard + +"functions-have-names@npm:^1.2.3": + version: 1.2.3 + resolution: "functions-have-names@npm:1.2.3" + checksum: 33e77fd29bddc2d9bb78ab3eb854c165909201f88c75faa8272e35899e2d35a8a642a15e7420ef945e1f64a9670d6aa3ec744106b2aa42be68ca5114025954ca + languageName: node + linkType: hard + +"genbank-parser@npm:^1.0.0": + version: 1.2.4 + resolution: "genbank-parser@npm:1.2.4" + checksum: 6ce5b2e4f478391fa6842b60dd5f2b692676dcfef38c4d50b7271c20b2425ac7b8b44bc868845d3c8cdce716e5cb67f8d700b817d853126ec140ff2a9a0c1359 + languageName: node + linkType: hard + +"generic-filehandle@npm:^3.0.0, generic-filehandle@npm:^3.0.1": + version: 3.1.1 + resolution: "generic-filehandle@npm:3.1.1" + dependencies: + es6-promisify: "npm:^6.1.1" + checksum: 3fc0e243eccddc0a47155309a9ba826a78b77e7ed02d8cb0055ac367310c66291e3d8f5e272d14635e6752e92be131336b68b1a0243854c7c4824d1a05cf277b + languageName: node + linkType: hard + +"gensync@npm:^1.0.0-beta.2": + version: 1.0.0-beta.2 + resolution: "gensync@npm:1.0.0-beta.2" + checksum: 782aba6cba65b1bb5af3b095d96249d20edbe8df32dbf4696fd49be2583faf676173bf4809386588828e4dd76a3354fcbeb577bab1c833ccd9fc4577f26103f8 + languageName: node + linkType: hard + +"get-caller-file@npm:^2.0.5": + version: 2.0.5 + resolution: "get-caller-file@npm:2.0.5" + checksum: c6c7b60271931fa752aeb92f2b47e355eac1af3a2673f47c9589e8f8a41adc74d45551c1bc57b5e66a80609f10ffb72b6f575e4370d61cc3f7f3aaff01757cde + languageName: node + linkType: hard + +"get-func-name@npm:^2.0.1, get-func-name@npm:^2.0.2": + version: 2.0.2 + resolution: "get-func-name@npm:2.0.2" + checksum: 89830fd07623fa73429a711b9daecdb304386d237c71268007f788f113505ef1d4cc2d0b9680e072c5082490aec9df5d7758bf5ac6f1c37062855e8e3dc0b9df + languageName: node + linkType: hard + +"get-intrinsic@npm:^1.0.2, get-intrinsic@npm:^1.1.1, get-intrinsic@npm:^1.1.3, get-intrinsic@npm:^1.2.0, get-intrinsic@npm:^1.2.1, get-intrinsic@npm:^1.2.2": + version: 1.2.2 + resolution: "get-intrinsic@npm:1.2.2" + dependencies: + function-bind: "npm:^1.1.2" + has-proto: "npm:^1.0.1" + has-symbols: "npm:^1.0.3" + hasown: "npm:^2.0.0" + checksum: 4e7fb8adc6172bae7c4fe579569b4d5238b3667c07931cd46b4eee74bbe6ff6b91329bec311a638d8e60f5b51f44fe5445693c6be89ae88d4b5c49f7ff12db0b + languageName: node + linkType: hard + +"get-pkg-repo@npm:^4.0.0": + version: 4.2.1 + resolution: "get-pkg-repo@npm:4.2.1" + dependencies: + "@hutson/parse-repository-url": "npm:^3.0.0" + hosted-git-info: "npm:^4.0.0" + through2: "npm:^2.0.0" + yargs: "npm:^16.2.0" + bin: + get-pkg-repo: src/cli.js + checksum: 1338d2e048a594da4a34e7dd69d909376d72784f5ba50963a242b4b35db77533786f618b3f6a9effdee2af20af4917a3b7cf12533b4575d7f9c163886be1fb62 + languageName: node + linkType: hard + +"get-symbol-description@npm:^1.0.0": + version: 1.0.0 + resolution: "get-symbol-description@npm:1.0.0" + dependencies: + call-bind: "npm:^1.0.2" + get-intrinsic: "npm:^1.1.1" + checksum: 23bc3b44c221cdf7669a88230c62f4b9e30393b61eb21ba4400cb3e346801bd8f95fe4330ee78dbae37aecd874646d53e3e76a17a654d0c84c77f6690526d6bb + languageName: node + linkType: hard + +"git-raw-commits@npm:^2.0.8": + version: 2.0.11 + resolution: "git-raw-commits@npm:2.0.11" + dependencies: + dargs: "npm:^7.0.0" + lodash: "npm:^4.17.15" + meow: "npm:^8.0.0" + split2: "npm:^3.0.0" + through2: "npm:^4.0.0" + bin: + git-raw-commits: cli.js + checksum: c9cee7ce11a6703098f028d7e47986d5d3e4147d66640086734d6ee2472296b8711f91b40ad458e95acac1bc33cf2898059f1dc890f91220ff89c5fcc609ab64 + languageName: node + linkType: hard + +"git-remote-origin-url@npm:^2.0.0": + version: 2.0.0 + resolution: "git-remote-origin-url@npm:2.0.0" + dependencies: + gitconfiglocal: "npm:^1.0.0" + pify: "npm:^2.3.0" + checksum: 3a846ce98ed36b2d0b801e8ec1ab299a236cfc6fa264bfdf9f42301abfdfd8715c946507fd83a10b9db449eb609ac6f8a2a341daf52e3af0000367487f486355 + languageName: node + linkType: hard + +"git-semver-tags@npm:^4.1.1": + version: 4.1.1 + resolution: "git-semver-tags@npm:4.1.1" + dependencies: + meow: "npm:^8.0.0" + semver: "npm:^6.0.0" + bin: + git-semver-tags: cli.js + checksum: cd8c91c666901f8dd6381f4cef2aec32aa3f39e517bd8d8491f9133adf956dde9e0487d510fa0f12042fa474f21a8a88b4aa56db8b473979c7491109c57b7016 + languageName: node + linkType: hard + +"gitconfiglocal@npm:^1.0.0": + version: 1.0.0 + resolution: "gitconfiglocal@npm:1.0.0" + dependencies: + ini: "npm:^1.3.2" + checksum: cfcb16344834113199f209f2758ced778dc30e075ddb49b5dde659b4dd2deadee824db0a1b77e1303cb594d9e8b2240da18c67705f657aa76affb444aa349005 + languageName: node + linkType: hard + +"glob-parent@npm:^5.1.2": + version: 5.1.2 + resolution: "glob-parent@npm:5.1.2" + dependencies: + is-glob: "npm:^4.0.1" + checksum: cab87638e2112bee3f839ef5f6e0765057163d39c66be8ec1602f3823da4692297ad4e972de876ea17c44d652978638d2fd583c6713d0eb6591706825020c9ee + languageName: node + linkType: hard + +"glob-parent@npm:^6.0.2": + version: 6.0.2 + resolution: "glob-parent@npm:6.0.2" + dependencies: + is-glob: "npm:^4.0.3" + checksum: 317034d88654730230b3f43bb7ad4f7c90257a426e872ea0bf157473ac61c99bf5d205fad8f0185f989be8d2fa6d3c7dce1645d99d545b6ea9089c39f838e7f8 + languageName: node + linkType: hard + +"glob@npm:^10.2.2, glob@npm:^10.3.10, glob@npm:^10.3.7": + version: 10.3.10 + resolution: "glob@npm:10.3.10" + dependencies: + foreground-child: "npm:^3.1.0" + jackspeak: "npm:^2.3.5" + minimatch: "npm:^9.0.1" + minipass: "npm:^5.0.0 || ^6.0.2 || ^7.0.0" + path-scurry: "npm:^1.10.1" + bin: + glob: dist/esm/bin.mjs + checksum: 13d8a1feb7eac7945f8c8480e11cd4a44b24d26503d99a8d8ac8d5aefbf3e9802a2b6087318a829fad04cb4e829f25c5f4f1110c68966c498720dd261c7e344d + languageName: node + linkType: hard + +"glob@npm:^7.1.3, glob@npm:^7.1.4": + version: 7.2.3 + resolution: "glob@npm:7.2.3" + dependencies: + fs.realpath: "npm:^1.0.0" + inflight: "npm:^1.0.4" + inherits: "npm:2" + minimatch: "npm:^3.1.1" + once: "npm:^1.3.0" + path-is-absolute: "npm:^1.0.0" + checksum: 65676153e2b0c9095100fe7f25a778bf45608eeb32c6048cf307f579649bcc30353277b3b898a3792602c65764e5baa4f643714dfbdfd64ea271d210c7a425fe + languageName: node + linkType: hard + +"glob@npm:^8.0.3": + version: 8.1.0 + resolution: "glob@npm:8.1.0" + dependencies: + fs.realpath: "npm:^1.0.0" + inflight: "npm:^1.0.4" + inherits: "npm:2" + minimatch: "npm:^5.0.1" + once: "npm:^1.3.0" + checksum: cb0b5cab17a59c57299376abe5646c7070f8acb89df5595b492dba3bfb43d301a46c01e5695f01154e6553168207cb60d4eaf07d3be4bc3eb9b0457c5c561d0f + languageName: node + linkType: hard + +"globals@npm:^11.1.0": + version: 11.12.0 + resolution: "globals@npm:11.12.0" + checksum: 758f9f258e7b19226bd8d4af5d3b0dcf7038780fb23d82e6f98932c44e239f884847f1766e8fa9cc5635ccb3204f7fa7314d4408dd4002a5e8ea827b4018f0a1 + languageName: node + linkType: hard + +"globals@npm:^13.19.0": + version: 13.24.0 + resolution: "globals@npm:13.24.0" + dependencies: + type-fest: "npm:^0.20.2" + checksum: d3c11aeea898eb83d5ec7a99508600fbe8f83d2cf00cbb77f873dbf2bcb39428eff1b538e4915c993d8a3b3473fa71eeebfe22c9bb3a3003d1e26b1f2c8a42cd + languageName: node + linkType: hard + +"globalthis@npm:^1.0.3": + version: 1.0.3 + resolution: "globalthis@npm:1.0.3" + dependencies: + define-properties: "npm:^1.1.3" + checksum: 0db6e9af102a5254630351557ac15e6909bc7459d3e3f6b001e59fe784c96d31108818f032d9095739355a88467459e6488ff16584ee6250cd8c27dec05af4b0 + languageName: node + linkType: hard + +"globby@npm:^11.1.0": + version: 11.1.0 + resolution: "globby@npm:11.1.0" + dependencies: + array-union: "npm:^2.1.0" + dir-glob: "npm:^3.0.1" + fast-glob: "npm:^3.2.9" + ignore: "npm:^5.2.0" + merge2: "npm:^1.4.1" + slash: "npm:^3.0.0" + checksum: b39511b4afe4bd8a7aead3a27c4ade2b9968649abab0a6c28b1a90141b96ca68ca5db1302f7c7bd29eab66bf51e13916b8e0a3d0ac08f75e1e84a39b35691189 + languageName: node + linkType: hard + +"gopd@npm:^1.0.1": + version: 1.0.1 + resolution: "gopd@npm:1.0.1" + dependencies: + get-intrinsic: "npm:^1.1.3" + checksum: 505c05487f7944c552cee72087bf1567debb470d4355b1335f2c262d218ebbff805cd3715448fe29b4b380bae6912561d0467233e4165830efd28da241418c63 + languageName: node + linkType: hard + +"gosling.js@workspace:.": + version: 0.0.0-use.local + resolution: "gosling.js@workspace:." + dependencies: + "@gmod/bam": "npm:^1.1.18" + "@gmod/bbi": "npm:^3.0.1" + "@gmod/bed": "npm:^2.1.2" + "@gmod/gff": "npm:^1.3.0" + "@gmod/tabix": "npm:^1.5.6" + "@gmod/vcf": "npm:^5.0.10" + "@playwright/test": "npm:^1.39.0" + "@types/bezier-js": "npm:^4.1.0" + "@types/d3": "npm:^7.4.3" + "@types/d3-array": "npm:^3.2.1" + "@types/d3-color": "npm:^3.1.3" + "@types/d3-drag": "npm:^2.0.0" + "@types/d3-dsv": "npm:^3.0.1" + "@types/d3-format": "npm:^3.0.4" + "@types/d3-scale": "npm:^4.0.8" + "@types/d3-scale-chromatic": "npm:^3.0.3" + "@types/d3-selection": "npm:^2.0.0" + "@types/d3-shape": "npm:^3.1.6" + "@types/lodash-es": "npm:^4.17.5" + "@types/node": "npm:^18.6.2" + "@types/pixelmatch": "npm:^5.2.5" + "@types/pngjs": "npm:^6.0.3" + "@types/pubsub-js": "npm:^1.8.2" + "@types/rbush": "npm:^3.0.0" + "@types/react": "npm:^18.2.0" + "@types/react-dom": "npm:^18.2.0" + "@types/react-resize-detector": "npm:^4.2.0" + "@types/react-router-dom": "npm:^5.1.6" + "@typescript-eslint/eslint-plugin": "npm:^5.56.0" + "@typescript-eslint/parser": "npm:^5.56.0" + "@vitejs/plugin-react": "npm:^4.1.0" + "@vitest/coverage-v8": "npm:^0.34.6" + ajv: "npm:^6.12.2" + allotment: "npm:^1.19.0" + bezier-js: "npm:4.0.3" + buffer: "npm:^6.0.3" + c8: "npm:^7.11.2" + conventional-changelog-cli: "npm:^2.1.1" + css-element-queries: "npm:^1.2.3" + d3-array: "npm:^2.5.1" + d3-color: "npm:^2.0.0" + d3-drag: "npm:^2.0.0" + d3-dsv: "npm:^2.0.0" + d3-format: "npm:^3.1.0" + d3-scale: "npm:^3.2.1" + d3-scale-chromatic: "npm:^2.0.0" + d3-selection: "npm:^2.0.0" + d3-shape: "npm:^2.0.0" + esbuild: "npm:^0.12.25" + eslint: "npm:^8.19.0" + eslint-config-prettier: "npm:^8.5.0" + eslint-plugin-jsx-a11y: "npm:^6.7.1" + eslint-plugin-prettier: "npm:^4.2.1" + eslint-plugin-react: "npm:^7.30.1" + events: "npm:^3.3.0" + fetch-jsonp: "npm:^1.1.3" + fflate: "npm:^0.7.1" + generic-filehandle: "npm:^3.0.1" + higlass: "npm:^1.13.3" + higlass-register: "npm:^0.3.0" + higlass-text: "npm:^0.1.1" + jsdom: "npm:^19.0.0" + json-stringify-pretty-compact: "npm:^2.0.0" + jsoncrush: "npm:^1.1.6" + jspdf: "npm:^2.3.1" + lodash-es: "npm:^4.17.21" + monaco-editor: "npm:^0.27.0" + nanoevents: "npm:^7.0.1" + npm-run-all: "npm:^4.1.5" + pixelmatch: "npm:^5.3.0" + pixi.js: "npm:^6.3.0" + pngjs: "npm:^7.0.0" + prettier: "npm:^2.0.5" + pubsub-js: "npm:^1.9.3" + quick-lru: "npm:^6.1.1" + rbush: "npm:^3.0.1" + react: "npm:^18.2.0" + react-dom: "npm:^18.2.0" + react-markdown: "npm:^5.0.3" + react-monaco-editor: "npm:^0.45.0" + react-resize-detector: "npm:^4.2.3" + react-router-dom: "npm:^5.2.0" + remark-gfm: "npm:^1.0.0" + rimraf: "npm:~5.0.5" + safe-stable-stringify: "npm:^2.4.3" + stream-browserify: "npm:^3.0.0" + strip-json-comments: "npm:^3.1.1" + threads: "npm:^1.6.4" + ts-json-schema-generator: "npm:^1.0.0" + typescript: "npm:^5.0.2" + vite: "npm:^4.4.11" + vitest: "npm:^0.34.6" + vitest-canvas-mock: "npm:^0.3.3" + peerDependencies: + pixi.js: ^6.3.0 + react: ^16.6.3 || ^17.0.0 || ^18.0.0 + react-dom: ^16.6.3 || ^17.0.0 || ^18.0.0 + languageName: unknown + linkType: soft + +"graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.2.6": + version: 4.2.11 + resolution: "graceful-fs@npm:4.2.11" + checksum: 386d011a553e02bc594ac2ca0bd6d9e4c22d7fa8cfbfc448a6d148c59ea881b092db9dbe3547ae4b88e55f1b01f7c4a2ecc53b310c042793e63aa44cf6c257f2 + languageName: node + linkType: hard + +"graphemer@npm:^1.4.0": + version: 1.4.0 + resolution: "graphemer@npm:1.4.0" + checksum: e951259d8cd2e0d196c72ec711add7115d42eb9a8146c8eeda5b8d3ac91e5dd816b9cd68920726d9fd4490368e7ed86e9c423f40db87e2d8dfafa00fa17c3a31 + languageName: node + linkType: hard + +"handlebars@npm:^4.7.7": + version: 4.7.8 + resolution: "handlebars@npm:4.7.8" + dependencies: + minimist: "npm:^1.2.5" + neo-async: "npm:^2.6.2" + source-map: "npm:^0.6.1" + uglify-js: "npm:^3.1.4" + wordwrap: "npm:^1.0.0" + dependenciesMeta: + uglify-js: + optional: true + bin: + handlebars: bin/handlebars + checksum: 7aff423ea38a14bb379316f3857fe0df3c5d66119270944247f155ba1f08e07a92b340c58edaa00cfe985c21508870ee5183e0634dcb53dd405f35c93ef7f10d + languageName: node + linkType: hard + +"hard-rejection@npm:^2.1.0": + version: 2.1.0 + resolution: "hard-rejection@npm:2.1.0" + checksum: febc3343a1ad575aedcc112580835b44a89a89e01f400b4eda6e8110869edfdab0b00cd1bd4c3bfec9475a57e79e0b355aecd5be46454b6a62b9a359af60e564 + languageName: node + linkType: hard + +"has-bigints@npm:^1.0.1, has-bigints@npm:^1.0.2": + version: 1.0.2 + resolution: "has-bigints@npm:1.0.2" + checksum: 724eb1485bfa3cdff6f18d95130aa190561f00b3fcf9f19dc640baf8176b5917c143b81ec2123f8cddb6c05164a198c94b13e1377c497705ccc8e1a80306e83b + languageName: node + linkType: hard + +"has-flag@npm:^3.0.0": + version: 3.0.0 + resolution: "has-flag@npm:3.0.0" + checksum: 1c6c83b14b8b1b3c25b0727b8ba3e3b647f99e9e6e13eb7322107261de07a4c1be56fc0d45678fc376e09772a3a1642ccdaf8fc69bdf123b6c086598397ce473 + languageName: node + linkType: hard + +"has-flag@npm:^4.0.0": + version: 4.0.0 + resolution: "has-flag@npm:4.0.0" + checksum: 2e789c61b7888d66993e14e8331449e525ef42aac53c627cc53d1c3334e768bcb6abdc4f5f0de1478a25beec6f0bd62c7549058b7ac53e924040d4f301f02fd1 + languageName: node + linkType: hard + +"has-property-descriptors@npm:^1.0.0": + version: 1.0.1 + resolution: "has-property-descriptors@npm:1.0.1" + dependencies: + get-intrinsic: "npm:^1.2.2" + checksum: d62ba94b40150b00d621bc64a6aedb5bf0ee495308b4b7ed6bac856043db3cdfb1db553ae81cec91c9d2bd82057ff0e94145e7fa25d5aa5985ed32e0921927f6 + languageName: node + linkType: hard + +"has-proto@npm:^1.0.1": + version: 1.0.1 + resolution: "has-proto@npm:1.0.1" + checksum: c8a8fe411f810b23a564bd5546a8f3f0fff6f1b692740eb7a2fdc9df716ef870040806891e2f23ff4653f1083e3895bf12088703dd1a0eac3d9202d3a4768cd0 + languageName: node + linkType: hard + +"has-symbols@npm:^1.0.2, has-symbols@npm:^1.0.3": + version: 1.0.3 + resolution: "has-symbols@npm:1.0.3" + checksum: e6922b4345a3f37069cdfe8600febbca791c94988c01af3394d86ca3360b4b93928bbf395859158f88099cb10b19d98e3bbab7c9ff2c1bd09cf665ee90afa2c3 + languageName: node + linkType: hard + +"has-tostringtag@npm:^1.0.0": + version: 1.0.0 + resolution: "has-tostringtag@npm:1.0.0" + dependencies: + has-symbols: "npm:^1.0.2" + checksum: 1cdba76b7d13f65198a92b8ca1560ba40edfa09e85d182bf436d928f3588a9ebd260451d569f0ed1b849c4bf54f49c862aa0d0a77f9552b1855bb6deb526c011 + languageName: node + linkType: hard + +"hasown@npm:^2.0.0": + version: 2.0.0 + resolution: "hasown@npm:2.0.0" + dependencies: + function-bind: "npm:^1.1.2" + checksum: 5d415b114f410661208c95e7ab4879f1cc2765b8daceff4dc8718317d1cb7b9ffa7c5d1eafd9a4389c9aab7445d6ea88e05f3096cb1e529618b55304956b87fc + languageName: node + linkType: hard + +"higlass-register@npm:^0.3.0": + version: 0.3.0 + resolution: "higlass-register@npm:0.3.0" + checksum: 7eecb2580969de5707c5201f95f0b2bc0d40aa7bd08335b68537e0b3f8b5efd967387ab86bc0387bad1c6fd68120903cab788d4dcbc22d7bcaca54b2ea4a5b1a + languageName: node + linkType: hard + +"higlass-text@npm:^0.1.1": + version: 0.1.6 + resolution: "higlass-text@npm:0.1.6" + dependencies: + d3-color: "npm:^3.1.0" + d3-scale: "npm:^4.0.2" + higlass-register: "npm:^0.3.0" + slugid: "npm:^2.0.0" + checksum: ffbc2e9747149fd838dad92c40fe4a85b2d84d5bf79fef6e9c4cc8874ddcb6352c7ca9a13e8162ab35ae839ad3a09d9c0189e60b292a34c2cd64b45126aa561e + languageName: node + linkType: hard + +"higlass@npm:^1.13.3": + version: 1.13.3 + resolution: "higlass@npm:1.13.3" + dependencies: + ajv: "npm:^6.10.0" + box-intersect: "npm:^1.0.1" + buffer: "npm:^6.0.3" + clsx: "npm:^1.2.1" + css-element-queries: "npm:^1.2.3" + d3-array: "npm:^2.7.1" + d3-axis: "npm:^2.0.0" + d3-brush: "npm:^2.1.0" + d3-color: "npm:^2.0.0" + d3-drag: "npm:^2.0.0" + d3-dsv: "npm:^2.0.0" + d3-format: "npm:^2.0.0" + d3-geo: "npm:^2.0.1" + d3-queue: "npm:^3.0.7" + d3-request: "npm:^1.0.6" + d3-scale: "npm:^4.0.2" + d3-selection: "npm:^2.0.0" + d3-transition: "npm:^3.0.1" + d3-zoom: "npm:^3.0.0" + dom-scroll-into-view: "npm:^1.2.1" + genbank-parser: "npm:^1.0.0" + ndarray: "npm:^1.0.18" + pako: "npm:^1.0.10" + prismjs: "npm:^1.16.0" + prop-types: "npm:^15.6.0" + pub-sub-es: "npm:^2.0.1" + react-checkbox-tree: "npm:^1.7.3" + react-color: "npm:^2.13.8" + react-grid-layout: "npm:^0.16.6" + react-simple-code-editor: "npm:^0.9.10" + react-sortable-hoc: "npm:^1.10.1" + reactcss: "npm:^1.2.3" + robust-point-in-polygon: "npm:^1.0.3" + slugid: "npm:^3.2.0" + url-parse: "npm:^1.4.3" + vkbeautify: "npm:^0.99.3" + peerDependencies: + pixi.js: ^5.0.3 || ^6.5.2 + react: ^16.6.3 || ^17.0.0 || ^18.0.0 + react-dom: ^16.6.3 || ^17.0.0 || ^18.0.0 + checksum: 0f975587e1f25b33c33fc68a6fd024cbb45c206c8b99746bd8bed7f8795a42364d3c05a388fe4ac7a99d7e25fd83d64bb5f0ffd5a0272299e93b527b43392bbf + languageName: node + linkType: hard + +"history@npm:^4.9.0": + version: 4.10.1 + resolution: "history@npm:4.10.1" + dependencies: + "@babel/runtime": "npm:^7.1.2" + loose-envify: "npm:^1.2.0" + resolve-pathname: "npm:^3.0.0" + tiny-invariant: "npm:^1.0.2" + tiny-warning: "npm:^1.0.0" + value-equal: "npm:^1.0.1" + checksum: 35377694e4f10f2cf056a9cb1a8ee083e04e4b4717a63baeee4afd565658a62c7e73700bf9e82aa53dbe1ec94e0a25a83c080d63bad8ee6b274a98d2fbc5ed4c + languageName: node + linkType: hard + +"hoist-non-react-statics@npm:^3.1.0": + version: 3.3.2 + resolution: "hoist-non-react-statics@npm:3.3.2" + dependencies: + react-is: "npm:^16.7.0" + checksum: fe0889169e845d738b59b64badf5e55fa3cf20454f9203d1eb088df322d49d4318df774828e789898dcb280e8a5521bb59b3203385662ca5e9218a6ca5820e74 + languageName: node + linkType: hard + +"hosted-git-info@npm:^2.1.4": + version: 2.8.9 + resolution: "hosted-git-info@npm:2.8.9" + checksum: 317cbc6b1bbbe23c2a40ae23f3dafe9fa349ce42a89a36f930e3f9c0530c179a3882d2ef1e4141a4c3674d6faaea862138ec55b43ad6f75e387fda2483a13c70 + languageName: node + linkType: hard + +"hosted-git-info@npm:^4.0.0, hosted-git-info@npm:^4.0.1": + version: 4.1.0 + resolution: "hosted-git-info@npm:4.1.0" + dependencies: + lru-cache: "npm:^6.0.0" + checksum: 150fbcb001600336d17fdbae803264abed013548eea7946c2264c49ebe2ebd8c4441ba71dd23dd8e18c65de79d637f98b22d4760ba5fb2e0b15d62543d0fff07 + languageName: node + linkType: hard + +"html-encoding-sniffer@npm:^3.0.0": + version: 3.0.0 + resolution: "html-encoding-sniffer@npm:3.0.0" + dependencies: + whatwg-encoding: "npm:^2.0.0" + checksum: b17b3b0fb5d061d8eb15121c3b0b536376c3e295ecaf09ba48dd69c6b6c957839db124fe1e2b3f11329753a4ee01aa7dedf63b7677999e86da17fbbdd82c5386 + languageName: node + linkType: hard + +"html-escaper@npm:^2.0.0": + version: 2.0.2 + resolution: "html-escaper@npm:2.0.2" + checksum: 208e8a12de1a6569edbb14544f4567e6ce8ecc30b9394fcaa4e7bb1e60c12a7c9a1ed27e31290817157e8626f3a4f29e76c8747030822eb84a6abb15c255f0a0 + languageName: node + linkType: hard + +"html-to-react@npm:^1.3.4": + version: 1.7.0 + resolution: "html-to-react@npm:1.7.0" + dependencies: + domhandler: "npm:^5.0" + htmlparser2: "npm:^9.0" + lodash.camelcase: "npm:^4.3.0" + peerDependencies: + react: ^0.13.0 || ^0.14.0 || >=15 + checksum: 71ceab2d10faca134aa5ce22021fa904c26e24338c649781e449edf732bb2b6b55523cb4683666774036027676c6f1bfb1752da40169aadb9dded0506ab1b27c + languageName: node + linkType: hard + +"html2canvas@npm:^1.0.0-rc.5": + version: 1.4.1 + resolution: "html2canvas@npm:1.4.1" + dependencies: + css-line-break: "npm:^2.1.0" + text-segmentation: "npm:^1.0.3" + checksum: 6de86f75762b00948edf2ea559f16da0a1ec3facc4a8a7d3f35fcec59bb0c5970463478988ae3d9082152e0173690d46ebf4082e7ac803dd4817bae1d355c0db + languageName: node + linkType: hard + +"htmlparser2@npm:^9.0": + version: 9.1.0 + resolution: "htmlparser2@npm:9.1.0" + dependencies: + domelementtype: "npm:^2.3.0" + domhandler: "npm:^5.0.3" + domutils: "npm:^3.1.0" + entities: "npm:^4.5.0" + checksum: 394f6323efc265bbc791d8c0d96bfe95984e0407565248521ab92e2dc7668e5ceeca7bc6ed18d408b9ee3b25032c5743368a4280d280332d782821d5d467ad8f + languageName: node + linkType: hard + +"http-cache-semantics@npm:^4.1.1": + version: 4.1.1 + resolution: "http-cache-semantics@npm:4.1.1" + checksum: ce1319b8a382eb3cbb4a37c19f6bfe14e5bb5be3d09079e885e8c513ab2d3cd9214902f8a31c9dc4e37022633ceabfc2d697405deeaf1b8f3552bb4ed996fdfc + languageName: node + linkType: hard + +"http-proxy-agent@npm:^5.0.0": + version: 5.0.0 + resolution: "http-proxy-agent@npm:5.0.0" + dependencies: + "@tootallnate/once": "npm:2" + agent-base: "npm:6" + debug: "npm:4" + checksum: 32a05e413430b2c1e542e5c74b38a9f14865301dd69dff2e53ddb684989440e3d2ce0c4b64d25eb63cf6283e6265ff979a61cf93e3ca3d23047ddfdc8df34a32 + languageName: node + linkType: hard + +"http-proxy-agent@npm:^7.0.0": + version: 7.0.0 + resolution: "http-proxy-agent@npm:7.0.0" + dependencies: + agent-base: "npm:^7.1.0" + debug: "npm:^4.3.4" + checksum: a11574ff39436cee3c7bc67f259444097b09474605846ddd8edf0bf4ad8644be8533db1aa463426e376865047d05dc22755e638632819317c0c2f1b2196657c8 + languageName: node + linkType: hard + +"https-proxy-agent@npm:^5.0.0": + version: 5.0.1 + resolution: "https-proxy-agent@npm:5.0.1" + dependencies: + agent-base: "npm:6" + debug: "npm:4" + checksum: 6dd639f03434003577c62b27cafdb864784ef19b2de430d8ae2a1d45e31c4fd60719e5637b44db1a88a046934307da7089e03d6089ec3ddacc1189d8de8897d1 + languageName: node + linkType: hard + +"https-proxy-agent@npm:^7.0.1": + version: 7.0.2 + resolution: "https-proxy-agent@npm:7.0.2" + dependencies: + agent-base: "npm:^7.0.2" + debug: "npm:4" + checksum: 7735eb90073db087e7e79312e3d97c8c04baf7ea7ca7b013382b6a45abbaa61b281041a98f4e13c8c80d88f843785bcc84ba189165b4b4087b1e3496ba656d77 + languageName: node + linkType: hard + +"iconv-lite@npm:0.4": + version: 0.4.24 + resolution: "iconv-lite@npm:0.4.24" + dependencies: + safer-buffer: "npm:>= 2.1.2 < 3" + checksum: c6886a24cc00f2a059767440ec1bc00d334a89f250db8e0f7feb4961c8727118457e27c495ba94d082e51d3baca378726cd110aaf7ded8b9bbfd6a44760cf1d4 + languageName: node + linkType: hard + +"iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2": + version: 0.6.3 + resolution: "iconv-lite@npm:0.6.3" + dependencies: + safer-buffer: "npm:>= 2.1.2 < 3.0.0" + checksum: 98102bc66b33fcf5ac044099d1257ba0b7ad5e3ccd3221f34dd508ab4070edff183276221684e1e0555b145fce0850c9f7d2b60a9fcac50fbb4ea0d6e845a3b1 + languageName: node + linkType: hard + +"ieee754@npm:^1.2.1": + version: 1.2.1 + resolution: "ieee754@npm:1.2.1" + checksum: b0782ef5e0935b9f12883a2e2aa37baa75da6e66ce6515c168697b42160807d9330de9a32ec1ed73149aea02e0d822e572bca6f1e22bdcbd2149e13b050b17bb + languageName: node + linkType: hard + +"ignore@npm:^5.2.0": + version: 5.3.0 + resolution: "ignore@npm:5.3.0" + checksum: dc06bea5c23aae65d0725a957a0638b57e235ae4568dda51ca142053ed2c352de7e3bc93a69b2b32ac31966a1952e9a93c5ef2e2ab7c6b06aef9808f6b55b571 + languageName: node + linkType: hard + +"import-fresh@npm:^3.2.1": + version: 3.3.0 + resolution: "import-fresh@npm:3.3.0" + dependencies: + parent-module: "npm:^1.0.0" + resolve-from: "npm:^4.0.0" + checksum: 7f882953aa6b740d1f0e384d0547158bc86efbf2eea0f1483b8900a6f65c5a5123c2cf09b0d542cc419d0b98a759ecaeb394237e97ea427f2da221dc3cd80cc3 + languageName: node + linkType: hard + +"imurmurhash@npm:^0.1.4": + version: 0.1.4 + resolution: "imurmurhash@npm:0.1.4" + checksum: 8b51313850dd33605c6c9d3fd9638b714f4c4c40250cff658209f30d40da60f78992fb2df5dabee4acf589a6a82bbc79ad5486550754bd9ec4e3fc0d4a57d6a6 + languageName: node + linkType: hard + +"indent-string@npm:^4.0.0": + version: 4.0.0 + resolution: "indent-string@npm:4.0.0" + checksum: 1e1904ddb0cb3d6cce7cd09e27a90184908b7a5d5c21b92e232c93579d314f0b83c246ffb035493d0504b1e9147ba2c9b21df0030f48673fba0496ecd698161f + languageName: node + linkType: hard + +"inflight@npm:^1.0.4": + version: 1.0.6 + resolution: "inflight@npm:1.0.6" + dependencies: + once: "npm:^1.3.0" + wrappy: "npm:1" + checksum: 7faca22584600a9dc5b9fca2cd5feb7135ac8c935449837b315676b4c90aa4f391ec4f42240178244b5a34e8bede1948627fda392ca3191522fc46b34e985ab2 + languageName: node + linkType: hard + +"inherits@npm:2, inherits@npm:^2.0.3, inherits@npm:~2.0.3, inherits@npm:~2.0.4": + version: 2.0.4 + resolution: "inherits@npm:2.0.4" + checksum: 4e531f648b29039fb7426fb94075e6545faa1eb9fe83c29f0b6d9e7263aceb4289d2d4557db0d428188eeb449cc7c5e77b0a0b2c4e248ff2a65933a0dee49ef2 + languageName: node + linkType: hard + +"ini@npm:^1.3.2": + version: 1.3.8 + resolution: "ini@npm:1.3.8" + checksum: ec93838d2328b619532e4f1ff05df7909760b6f66d9c9e2ded11e5c1897d6f2f9980c54dd638f88654b00919ce31e827040631eab0a3969e4d1abefa0719516a + languageName: node + linkType: hard + +"internal-slot@npm:^1.0.5": + version: 1.0.6 + resolution: "internal-slot@npm:1.0.6" + dependencies: + get-intrinsic: "npm:^1.2.2" + hasown: "npm:^2.0.0" + side-channel: "npm:^1.0.4" + checksum: aa37cafc8ffbf513a340de58f40d5017b4949d99722d7e4f0e24b182455bdd258000d4bb1d7b4adcf9f8979b97049b99fe9defa9db8e18a78071d2637ac143fb + languageName: node + linkType: hard + +"internmap@npm:1 - 2": + version: 2.0.3 + resolution: "internmap@npm:2.0.3" + checksum: 8cedd57f07bbc22501516fbfc70447f0c6812871d471096fad9ea603516eacc2137b633633daf432c029712df0baefd793686388ddf5737e3ea15074b877f7ed + languageName: node + linkType: hard + +"internmap@npm:^1.0.0": + version: 1.0.1 + resolution: "internmap@npm:1.0.1" + checksum: 60942be815ca19da643b6d4f23bd0bf4e8c97abbd080fb963fe67583b60bdfb3530448ad4486bae40810e92317bded9995cc31411218acc750d72cd4e8646eee + languageName: node + linkType: hard + +"invariant@npm:^2.2.4": + version: 2.2.4 + resolution: "invariant@npm:2.2.4" + dependencies: + loose-envify: "npm:^1.0.0" + checksum: 5af133a917c0bcf65e84e7f23e779e7abc1cd49cb7fdc62d00d1de74b0d8c1b5ee74ac7766099fb3be1b05b26dfc67bab76a17030d2fe7ea2eef867434362dfc + languageName: node + linkType: hard + +"iota-array@npm:^1.0.0": + version: 1.0.0 + resolution: "iota-array@npm:1.0.0" + checksum: a6bfc7d5bf0338ade227b302eda52cea3db44cc6dd5803154147cdcee28e9cb65ca76c5859ab2bfe21d91ecc945c57a0dd446bbc657581bbdf92cda9c24def56 + languageName: node + linkType: hard + +"ip@npm:^2.0.0": + version: 2.0.0 + resolution: "ip@npm:2.0.0" + checksum: 8d186cc5585f57372847ae29b6eba258c68862055e18a75cc4933327232cb5c107f89800ce29715d542eef2c254fbb68b382e780a7414f9ee7caf60b7a473958 + languageName: node + linkType: hard + +"is-alphabetical@npm:^1.0.0": + version: 1.0.4 + resolution: "is-alphabetical@npm:1.0.4" + checksum: 1505b1de5a1fd74022c05fb21b0e683a8f5229366bac8dc4d34cf6935bcfd104d1125a5e6b083fb778847629f76e5bdac538de5367bdf2b927a1356164e23985 + languageName: node + linkType: hard + +"is-alphanumerical@npm:^1.0.0": + version: 1.0.4 + resolution: "is-alphanumerical@npm:1.0.4" + dependencies: + is-alphabetical: "npm:^1.0.0" + is-decimal: "npm:^1.0.0" + checksum: d623abae7130a7015c6bf33d99151d4e7005572fd170b86568ff4de5ae86ac7096608b87dd4a1d4dbbd497e392b6396930ba76c9297a69455909cebb68005905 + languageName: node + linkType: hard + +"is-array-buffer@npm:^3.0.1, is-array-buffer@npm:^3.0.2": + version: 3.0.2 + resolution: "is-array-buffer@npm:3.0.2" + dependencies: + call-bind: "npm:^1.0.2" + get-intrinsic: "npm:^1.2.0" + is-typed-array: "npm:^1.1.10" + checksum: 40ed13a5f5746ac3ae2f2e463687d9b5a3f5fd0086f970fb4898f0253c2a5ec2e3caea2d664dd8f54761b1c1948609702416921a22faebe160c7640a9217c80e + languageName: node + linkType: hard + +"is-arrayish@npm:^0.2.1": + version: 0.2.1 + resolution: "is-arrayish@npm:0.2.1" + checksum: e7fb686a739068bb70f860b39b67afc62acc62e36bb61c5f965768abce1873b379c563e61dd2adad96ebb7edf6651111b385e490cf508378959b0ed4cac4e729 + languageName: node + linkType: hard + +"is-async-function@npm:^2.0.0": + version: 2.0.0 + resolution: "is-async-function@npm:2.0.0" + dependencies: + has-tostringtag: "npm:^1.0.0" + checksum: 787bc931576aad525d751fc5ce211960fe91e49ac84a5c22d6ae0bc9541945fbc3f686dc590c3175722ce4f6d7b798a93f6f8ff4847fdb2199aea6f4baf5d668 + languageName: node + linkType: hard + +"is-bigint@npm:^1.0.1": + version: 1.0.4 + resolution: "is-bigint@npm:1.0.4" + dependencies: + has-bigints: "npm:^1.0.1" + checksum: eb9c88e418a0d195ca545aff2b715c9903d9b0a5033bc5922fec600eb0c3d7b1ee7f882dbf2e0d5a6e694e42391be3683e4368737bd3c4a77f8ac293e7773696 + languageName: node + linkType: hard + +"is-boolean-object@npm:^1.1.0": + version: 1.1.2 + resolution: "is-boolean-object@npm:1.1.2" + dependencies: + call-bind: "npm:^1.0.2" + has-tostringtag: "npm:^1.0.0" + checksum: 6090587f8a8a8534c0f816da868bc94f32810f08807aa72fa7e79f7e11c466d281486ffe7a788178809c2aa71fe3e700b167fe80dd96dad68026bfff8ebf39f7 + languageName: node + linkType: hard + +"is-buffer@npm:^1.0.2": + version: 1.1.6 + resolution: "is-buffer@npm:1.1.6" + checksum: ae18aa0b6e113d6c490ad1db5e8df9bdb57758382b313f5a22c9c61084875c6396d50bbf49315f5b1926d142d74dfb8d31b40d993a383e0a158b15fea7a82234 + languageName: node + linkType: hard + +"is-buffer@npm:^2.0.0": + version: 2.0.5 + resolution: "is-buffer@npm:2.0.5" + checksum: e603f6fced83cf94c53399cff3bda1a9f08e391b872b64a73793b0928be3e5f047f2bcece230edb7632eaea2acdbfcb56c23b33d8a20c820023b230f1485679a + languageName: node + linkType: hard + +"is-callable@npm:^1.1.3, is-callable@npm:^1.1.4, is-callable@npm:^1.2.7": + version: 1.2.7 + resolution: "is-callable@npm:1.2.7" + checksum: ceebaeb9d92e8adee604076971dd6000d38d6afc40bb843ea8e45c5579b57671c3f3b50d7f04869618242c6cee08d1b67806a8cb8edaaaf7c0748b3720d6066f + languageName: node + linkType: hard + +"is-core-module@npm:^2.13.0, is-core-module@npm:^2.5.0": + version: 2.13.1 + resolution: "is-core-module@npm:2.13.1" + dependencies: + hasown: "npm:^2.0.0" + checksum: 2cba9903aaa52718f11c4896dabc189bab980870aae86a62dc0d5cedb546896770ee946fb14c84b7adf0735f5eaea4277243f1b95f5cefa90054f92fbcac2518 + languageName: node + linkType: hard + +"is-date-object@npm:^1.0.1, is-date-object@npm:^1.0.5": + version: 1.0.5 + resolution: "is-date-object@npm:1.0.5" + dependencies: + has-tostringtag: "npm:^1.0.0" + checksum: eed21e5dcc619c48ccef804dfc83a739dbb2abee6ca202838ee1bd5f760fe8d8a93444f0d49012ad19bb7c006186e2884a1b92f6e1c056da7fd23d0a9ad5992e + languageName: node + linkType: hard + +"is-decimal@npm:^1.0.0": + version: 1.0.4 + resolution: "is-decimal@npm:1.0.4" + checksum: a4ad53c4c5c4f5a12214e7053b10326711f6a71f0c63ba1314a77bd71df566b778e4ebd29f9fb6815f07a4dc50c3767fb19bd6fc9fa05e601410f1d64ffeac48 + languageName: node + linkType: hard + +"is-extglob@npm:^2.1.1": + version: 2.1.1 + resolution: "is-extglob@npm:2.1.1" + checksum: 5487da35691fbc339700bbb2730430b07777a3c21b9ebaecb3072512dfd7b4ba78ac2381a87e8d78d20ea08affb3f1971b4af629173a6bf435ff8a4c47747912 + languageName: node + linkType: hard + +"is-finalizationregistry@npm:^1.0.2": + version: 1.0.2 + resolution: "is-finalizationregistry@npm:1.0.2" + dependencies: + call-bind: "npm:^1.0.2" + checksum: 81caecc984d27b1a35c68741156fc651fb1fa5e3e6710d21410abc527eb226d400c0943a167922b2e920f6b3e58b0dede9aa795882b038b85f50b3a4b877db86 + languageName: node + linkType: hard + +"is-fullwidth-code-point@npm:^3.0.0": + version: 3.0.0 + resolution: "is-fullwidth-code-point@npm:3.0.0" + checksum: bb11d825e049f38e04c06373a8d72782eee0205bda9d908cc550ccb3c59b99d750ff9537982e01733c1c94a58e35400661f57042158ff5e8f3e90cf936daf0fc + languageName: node + linkType: hard + +"is-generator-function@npm:^1.0.10": + version: 1.0.10 + resolution: "is-generator-function@npm:1.0.10" + dependencies: + has-tostringtag: "npm:^1.0.0" + checksum: df03514df01a6098945b5a0cfa1abff715807c8e72f57c49a0686ad54b3b74d394e2d8714e6f709a71eb00c9630d48e73ca1796c1ccc84ac95092c1fecc0d98b + languageName: node + linkType: hard + +"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:^4.0.3": + version: 4.0.3 + resolution: "is-glob@npm:4.0.3" + dependencies: + is-extglob: "npm:^2.1.1" + checksum: 17fb4014e22be3bbecea9b2e3a76e9e34ff645466be702f1693e8f1ee1adac84710d0be0bd9f967d6354036fd51ab7c2741d954d6e91dae6bb69714de92c197a + languageName: node + linkType: hard + +"is-hexadecimal@npm:^1.0.0": + version: 1.0.4 + resolution: "is-hexadecimal@npm:1.0.4" + checksum: ec4c64e5624c0f240922324bc697e166554f09d3ddc7633fc526084502626445d0a871fbd8cae52a9844e83bd0bb414193cc5a66806d7b2867907003fc70c5ea + languageName: node + linkType: hard + +"is-lambda@npm:^1.0.1": + version: 1.0.1 + resolution: "is-lambda@npm:1.0.1" + checksum: 85fee098ae62ba6f1e24cf22678805473c7afd0fb3978a3aa260e354cb7bcb3a5806cf0a98403188465efedec41ab4348e8e4e79305d409601323855b3839d4d + languageName: node + linkType: hard + +"is-map@npm:^2.0.1": + version: 2.0.2 + resolution: "is-map@npm:2.0.2" + checksum: 119ff9137a37fd131a72fab3f4ab8c9d6a24b0a1ee26b4eff14dc625900d8675a97785eea5f4174265e2006ed076cc24e89f6e57ebd080a48338d914ec9168a5 + languageName: node + linkType: hard + +"is-negative-zero@npm:^2.0.2": + version: 2.0.2 + resolution: "is-negative-zero@npm:2.0.2" + checksum: eda024c158f70f2017f3415e471b818d314da5ef5be68f801b16314d4a4b6304a74cbed778acf9e2f955bb9c1c5f2935c1be0c7c99e1ad12286f45366217b6a3 + languageName: node + linkType: hard + +"is-number-object@npm:^1.0.4": + version: 1.0.7 + resolution: "is-number-object@npm:1.0.7" + dependencies: + has-tostringtag: "npm:^1.0.0" + checksum: aad266da1e530f1804a2b7bd2e874b4869f71c98590b3964f9d06cc9869b18f8d1f4778f838ecd2a11011bce20aeecb53cb269ba916209b79c24580416b74b1b + languageName: node + linkType: hard + +"is-number@npm:^7.0.0": + version: 7.0.0 + resolution: "is-number@npm:7.0.0" + checksum: b4686d0d3053146095ccd45346461bc8e53b80aeb7671cc52a4de02dbbf7dc0d1d2a986e2fe4ae206984b4d34ef37e8b795ebc4f4295c978373e6575e295d811 + languageName: node + linkType: hard + +"is-obj@npm:^2.0.0": + version: 2.0.0 + resolution: "is-obj@npm:2.0.0" + checksum: 85044ed7ba8bd169e2c2af3a178cacb92a97aa75de9569d02efef7f443a824b5e153eba72b9ae3aca6f8ce81955271aa2dc7da67a8b720575d3e38104208cb4e + languageName: node + linkType: hard + +"is-observable@npm:^2.1.0": + version: 2.1.0 + resolution: "is-observable@npm:2.1.0" + checksum: f6ae9e136f66ad59c4faa4661112c389b398461cdeb0ef5bc3c505989469b77b2ba4602e2abc54a635d65f616eec9b5a40cd7d2c1f96b2cc4748b56635eba1c6 + languageName: node + linkType: hard + +"is-path-inside@npm:^3.0.3": + version: 3.0.3 + resolution: "is-path-inside@npm:3.0.3" + checksum: cf7d4ac35fb96bab6a1d2c3598fe5ebb29aafb52c0aaa482b5a3ed9d8ba3edc11631e3ec2637660c44b3ce0e61a08d54946e8af30dec0b60a7c27296c68ffd05 + languageName: node + linkType: hard + +"is-plain-obj@npm:^1.1.0": + version: 1.1.0 + resolution: "is-plain-obj@npm:1.1.0" + checksum: daaee1805add26f781b413fdf192fc91d52409583be30ace35c82607d440da63cc4cac0ac55136716688d6c0a2c6ef3edb2254fecbd1fe06056d6bd15975ee8c + languageName: node + linkType: hard + +"is-plain-obj@npm:^2.0.0": + version: 2.1.0 + resolution: "is-plain-obj@npm:2.1.0" + checksum: e5c9814cdaa627a9ad0a0964ded0e0491bfd9ace405c49a5d63c88b30a162f1512c069d5b80997893c4d0181eadc3fed02b4ab4b81059aba5620bfcdfdeb9c53 + languageName: node + linkType: hard + +"is-potential-custom-element-name@npm:^1.0.1": + version: 1.0.1 + resolution: "is-potential-custom-element-name@npm:1.0.1" + checksum: b73e2f22bc863b0939941d369486d308b43d7aef1f9439705e3582bfccaa4516406865e32c968a35f97a99396dac84e2624e67b0a16b0a15086a785e16ce7db9 + languageName: node + linkType: hard + +"is-regex@npm:^1.1.4": + version: 1.1.4 + resolution: "is-regex@npm:1.1.4" + dependencies: + call-bind: "npm:^1.0.2" + has-tostringtag: "npm:^1.0.0" + checksum: bb72aae604a69eafd4a82a93002058c416ace8cde95873589a97fc5dac96a6c6c78a9977d487b7b95426a8f5073969124dd228f043f9f604f041f32fcc465fc1 + languageName: node + linkType: hard + +"is-set@npm:^2.0.1": + version: 2.0.2 + resolution: "is-set@npm:2.0.2" + checksum: 5f8bd1880df8c0004ce694e315e6e1e47a3452014be792880bb274a3b2cdb952fdb60789636ca6e084c7947ca8b7ae03ccaf54c93a7fcfed228af810559e5432 + languageName: node + linkType: hard + +"is-shared-array-buffer@npm:^1.0.2": + version: 1.0.2 + resolution: "is-shared-array-buffer@npm:1.0.2" + dependencies: + call-bind: "npm:^1.0.2" + checksum: cfeee6f171f1b13e6cbc6f3b6cc44e192b93df39f3fcb31aa66ffb1d2df3b91e05664311659f9701baba62f5e98c83b0673c628e7adc30f55071c4874fcdccec + languageName: node + linkType: hard + +"is-string@npm:^1.0.5, is-string@npm:^1.0.7": + version: 1.0.7 + resolution: "is-string@npm:1.0.7" + dependencies: + has-tostringtag: "npm:^1.0.0" + checksum: 905f805cbc6eedfa678aaa103ab7f626aac9ebbdc8737abb5243acaa61d9820f8edc5819106b8fcd1839e33db21de9f0116ae20de380c8382d16dc2a601921f6 + languageName: node + linkType: hard + +"is-symbol@npm:^1.0.2, is-symbol@npm:^1.0.3": + version: 1.0.4 + resolution: "is-symbol@npm:1.0.4" + dependencies: + has-symbols: "npm:^1.0.2" + checksum: 9381dd015f7c8906154dbcbf93fad769de16b4b961edc94f88d26eb8c555935caa23af88bda0c93a18e65560f6d7cca0fd5a3f8a8e1df6f1abbb9bead4502ef7 + languageName: node + linkType: hard + +"is-text-path@npm:^1.0.1": + version: 1.0.1 + resolution: "is-text-path@npm:1.0.1" + dependencies: + text-extensions: "npm:^1.0.0" + checksum: 61c8650c29548febb6bf69e9541fc11abbbb087a0568df7bc471ba264e95fb254def4e610631cbab4ddb0a1a07949d06416f4ebeaf37875023fb184cdb87ee84 + languageName: node + linkType: hard + +"is-typed-array@npm:^1.1.10, is-typed-array@npm:^1.1.12, is-typed-array@npm:^1.1.9": + version: 1.1.12 + resolution: "is-typed-array@npm:1.1.12" + dependencies: + which-typed-array: "npm:^1.1.11" + checksum: 9863e9cc7223c6fc1c462a2c3898a7beff6b41b1ee0fabb03b7d278ae7de670b5bcbc8627db56bb66ed60902fa37d53fe5cce0fd2f7d73ac64fe5da6f409b6ae + languageName: node + linkType: hard + +"is-weakmap@npm:^2.0.1": + version: 2.0.1 + resolution: "is-weakmap@npm:2.0.1" + checksum: 9c9fec9efa7bf5030a4a927f33fff2a6976b93646259f92b517d3646c073cc5b98283a162ce75c412b060a46de07032444b530f0a4c9b6e012ef8f1741c3a987 + languageName: node + linkType: hard + +"is-weakref@npm:^1.0.2": + version: 1.0.2 + resolution: "is-weakref@npm:1.0.2" + dependencies: + call-bind: "npm:^1.0.2" + checksum: 1545c5d172cb690c392f2136c23eec07d8d78a7f57d0e41f10078aa4f5daf5d7f57b6513a67514ab4f073275ad00c9822fc8935e00229d0a2089e1c02685d4b1 + languageName: node + linkType: hard + +"is-weakset@npm:^2.0.1": + version: 2.0.2 + resolution: "is-weakset@npm:2.0.2" + dependencies: + call-bind: "npm:^1.0.2" + get-intrinsic: "npm:^1.1.1" + checksum: ef5136bd446ae4603229b897f73efd0720c6ab3ec6cc05c8d5c4b51aa9f95164713c4cad0a22ff1fedf04865ff86cae4648bc1d5eead4b6388e1150525af1cc1 + languageName: node + linkType: hard + +"isarray@npm:0.0.1": + version: 0.0.1 + resolution: "isarray@npm:0.0.1" + checksum: ed1e62da617f71fe348907c71743b5ed550448b455f8d269f89a7c7ddb8ae6e962de3dab6a74a237b06f5eb7f6ece7a45ada8ce96d87fe972926530f91ae3311 + languageName: node + linkType: hard + +"isarray@npm:^2.0.5": + version: 2.0.5 + resolution: "isarray@npm:2.0.5" + checksum: 4199f14a7a13da2177c66c31080008b7124331956f47bca57dd0b6ea9f11687aa25e565a2c7a2b519bc86988d10398e3049a1f5df13c9f6b7664154690ae79fd + languageName: node + linkType: hard + +"isarray@npm:~1.0.0": + version: 1.0.0 + resolution: "isarray@npm:1.0.0" + checksum: 18b5be6669be53425f0b84098732670ed4e727e3af33bc7f948aac01782110eb9a18b3b329c5323bcdd3acdaae547ee077d3951317e7f133bff7105264b3003d + languageName: node + linkType: hard + +"isexe@npm:^2.0.0": + version: 2.0.0 + resolution: "isexe@npm:2.0.0" + checksum: 228cfa503fadc2c31596ab06ed6aa82c9976eec2bfd83397e7eaf06d0ccf42cd1dfd6743bf9aeb01aebd4156d009994c5f76ea898d2832c1fe342da923ca457d + languageName: node + linkType: hard + +"isexe@npm:^3.1.1": + version: 3.1.1 + resolution: "isexe@npm:3.1.1" + checksum: 9ec257654093443eb0a528a9c8cbba9c0ca7616ccb40abd6dde7202734d96bb86e4ac0d764f0f8cd965856aacbff2f4ce23e730dc19dfb41e3b0d865ca6fdcc7 + languageName: node + linkType: hard + +"istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0": + version: 3.2.2 + resolution: "istanbul-lib-coverage@npm:3.2.2" + checksum: 6c7ff2106769e5f592ded1fb418f9f73b4411fd5a084387a5410538332b6567cd1763ff6b6cadca9b9eb2c443cce2f7ea7d7f1b8d315f9ce58539793b1e0922b + languageName: node + linkType: hard + +"istanbul-lib-report@npm:^3.0.0, istanbul-lib-report@npm:^3.0.1": + version: 3.0.1 + resolution: "istanbul-lib-report@npm:3.0.1" + dependencies: + istanbul-lib-coverage: "npm:^3.0.0" + make-dir: "npm:^4.0.0" + supports-color: "npm:^7.1.0" + checksum: 84323afb14392de8b6a5714bd7e9af845cfbd56cfe71ed276cda2f5f1201aea673c7111901227ee33e68e4364e288d73861eb2ed48f6679d1e69a43b6d9b3ba7 + languageName: node + linkType: hard + +"istanbul-lib-source-maps@npm:^4.0.1": + version: 4.0.1 + resolution: "istanbul-lib-source-maps@npm:4.0.1" + dependencies: + debug: "npm:^4.1.1" + istanbul-lib-coverage: "npm:^3.0.0" + source-map: "npm:^0.6.1" + checksum: 19e4cc405016f2c906dff271a76715b3e881fa9faeb3f09a86cb99b8512b3a5ed19cadfe0b54c17ca0e54c1142c9c6de9330d65506e35873994e06634eebeb66 + languageName: node + linkType: hard + +"istanbul-reports@npm:^3.1.4, istanbul-reports@npm:^3.1.5": + version: 3.1.6 + resolution: "istanbul-reports@npm:3.1.6" + dependencies: + html-escaper: "npm:^2.0.0" + istanbul-lib-report: "npm:^3.0.0" + checksum: ec3f1bdbc51b3e0b325a5b9f4ad31a247697f31001df4e81075f7980413f14da1b5adfec574fd156efd3b0464023f61320f6718efc66ee72b32d89611cef99dd + languageName: node + linkType: hard + +"iterator.prototype@npm:^1.1.2": + version: 1.1.2 + resolution: "iterator.prototype@npm:1.1.2" + dependencies: + define-properties: "npm:^1.2.1" + get-intrinsic: "npm:^1.2.1" + has-symbols: "npm:^1.0.3" + reflect.getprototypeof: "npm:^1.0.4" + set-function-name: "npm:^2.0.1" + checksum: a32151326095e916f306990d909f6bbf23e3221999a18ba686419535dcd1749b10ded505e89334b77dc4c7a58a8508978f0eb16c2c8573e6d412eb7eb894ea79 + languageName: node + linkType: hard + +"jackspeak@npm:^2.3.5": + version: 2.3.6 + resolution: "jackspeak@npm:2.3.6" + dependencies: + "@isaacs/cliui": "npm:^8.0.2" + "@pkgjs/parseargs": "npm:^0.11.0" + dependenciesMeta: + "@pkgjs/parseargs": + optional: true + checksum: f01d8f972d894cd7638bc338e9ef5ddb86f7b208ce177a36d718eac96ec86638a6efa17d0221b10073e64b45edc2ce15340db9380b1f5d5c5d000cbc517dc111 + languageName: node + linkType: hard + +"jest-canvas-mock@npm:~2.5.2": + version: 2.5.2 + resolution: "jest-canvas-mock@npm:2.5.2" + dependencies: + cssfontparser: "npm:^1.2.1" + moo-color: "npm:^1.0.2" + checksum: 6a4190354b1e9aedcb3045273f13f6f1d2d1efb00cfe6458707fae538a8f91f6afdf72b9e201b653666863054edc783428bdc0c1a2c71d66d9ac364b4893f6d6 + languageName: node + linkType: hard + +"js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": + version: 4.0.0 + resolution: "js-tokens@npm:4.0.0" + checksum: e248708d377aa058eacf2037b07ded847790e6de892bbad3dac0abba2e759cb9f121b00099a65195616badcb6eca8d14d975cb3e89eb1cfda644756402c8aeed + languageName: node + linkType: hard + +"js-yaml@npm:^4.1.0": + version: 4.1.0 + resolution: "js-yaml@npm:4.1.0" + dependencies: + argparse: "npm:^2.0.1" + bin: + js-yaml: bin/js-yaml.js + checksum: 184a24b4eaacfce40ad9074c64fd42ac83cf74d8c8cd137718d456ced75051229e5061b8633c3366b8aada17945a7a356b337828c19da92b51ae62126575018f + languageName: node + linkType: hard + +"jsdom@npm:^19.0.0": + version: 19.0.0 + resolution: "jsdom@npm:19.0.0" + dependencies: + abab: "npm:^2.0.5" + acorn: "npm:^8.5.0" + acorn-globals: "npm:^6.0.0" + cssom: "npm:^0.5.0" + cssstyle: "npm:^2.3.0" + data-urls: "npm:^3.0.1" + decimal.js: "npm:^10.3.1" + domexception: "npm:^4.0.0" + escodegen: "npm:^2.0.0" + form-data: "npm:^4.0.0" + html-encoding-sniffer: "npm:^3.0.0" + http-proxy-agent: "npm:^5.0.0" + https-proxy-agent: "npm:^5.0.0" + is-potential-custom-element-name: "npm:^1.0.1" + nwsapi: "npm:^2.2.0" + parse5: "npm:6.0.1" + saxes: "npm:^5.0.1" + symbol-tree: "npm:^3.2.4" + tough-cookie: "npm:^4.0.0" + w3c-hr-time: "npm:^1.0.2" + w3c-xmlserializer: "npm:^3.0.0" + webidl-conversions: "npm:^7.0.0" + whatwg-encoding: "npm:^2.0.0" + whatwg-mimetype: "npm:^3.0.0" + whatwg-url: "npm:^10.0.0" + ws: "npm:^8.2.3" + xml-name-validator: "npm:^4.0.0" + peerDependencies: + canvas: ^2.5.0 + peerDependenciesMeta: + canvas: + optional: true + checksum: c39c71aa64df60f2b609adfc61fa4406c1a710da3278c730b0093181d1d09c1e6ba5551e32d78259a21800e10c2984c571777d6f7080249a5d21287be4f17bd9 + languageName: node + linkType: hard + +"jsesc@npm:^2.5.1": + version: 2.5.2 + resolution: "jsesc@npm:2.5.2" + bin: + jsesc: bin/jsesc + checksum: dbf59312e0ebf2b4405ef413ec2b25abb5f8f4d9bc5fb8d9f90381622ebca5f2af6a6aa9a8578f65903f9e33990a6dc798edd0ce5586894bf0e9e31803a1de88 + languageName: node + linkType: hard + +"json-buffer@npm:3.0.1": + version: 3.0.1 + resolution: "json-buffer@npm:3.0.1" + checksum: 0d1c91569d9588e7eef2b49b59851f297f3ab93c7b35c7c221e288099322be6b562767d11e4821da500f3219542b9afd2e54c5dc573107c1126ed1080f8e96d7 + languageName: node + linkType: hard + +"json-parse-better-errors@npm:^1.0.1": + version: 1.0.2 + resolution: "json-parse-better-errors@npm:1.0.2" + checksum: 2f1287a7c833e397c9ddd361a78638e828fc523038bb3441fd4fc144cfd2c6cd4963ffb9e207e648cf7b692600f1e1e524e965c32df5152120910e4903a47dcb + languageName: node + linkType: hard + +"json-parse-even-better-errors@npm:^2.3.0": + version: 2.3.1 + resolution: "json-parse-even-better-errors@npm:2.3.1" + checksum: 140932564c8f0b88455432e0f33c4cb4086b8868e37524e07e723f4eaedb9425bdc2bafd71bd1d9765bd15fd1e2d126972bc83990f55c467168c228c24d665f3 + languageName: node + linkType: hard + +"json-schema-traverse@npm:^0.4.1": + version: 0.4.1 + resolution: "json-schema-traverse@npm:0.4.1" + checksum: 108fa90d4cc6f08243aedc6da16c408daf81793bf903e9fd5ab21983cda433d5d2da49e40711da016289465ec2e62e0324dcdfbc06275a607fe3233fde4942ce + languageName: node + linkType: hard + +"json-stable-stringify-without-jsonify@npm:^1.0.1": + version: 1.0.1 + resolution: "json-stable-stringify-without-jsonify@npm:1.0.1" + checksum: cb168b61fd4de83e58d09aaa6425ef71001bae30d260e2c57e7d09a5fd82223e2f22a042dedaab8db23b7d9ae46854b08bb1f91675a8be11c5cffebef5fb66a5 + languageName: node + linkType: hard + +"json-stringify-pretty-compact@npm:^2.0.0": + version: 2.0.0 + resolution: "json-stringify-pretty-compact@npm:2.0.0" + checksum: 3427ccbd2acdd4c878527f27235e74da2d0722a83419371f29960e1dfec5e069c02b2b80a37dd5260ea6dbf79a86c015fc90abc36b14595b1799ad78eb570a4e + languageName: node + linkType: hard + +"json-stringify-safe@npm:^5.0.1": + version: 5.0.1 + resolution: "json-stringify-safe@npm:5.0.1" + checksum: 7dbf35cd0411d1d648dceb6d59ce5857ec939e52e4afc37601aa3da611f0987d5cee5b38d58329ceddf3ed48bd7215229c8d52059ab01f2444a338bf24ed0f37 + languageName: node + linkType: hard + +"json5@npm:^2.2.3": + version: 2.2.3 + resolution: "json5@npm:2.2.3" + bin: + json5: lib/cli.js + checksum: 5a04eed94810fa55c5ea138b2f7a5c12b97c3750bc63d11e511dcecbfef758003861522a070c2272764ee0f4e3e323862f386945aeb5b85b87ee43f084ba586c + languageName: node + linkType: hard + +"jsonc-parser@npm:^3.2.0": + version: 3.2.0 + resolution: "jsonc-parser@npm:3.2.0" + checksum: 5a12d4d04dad381852476872a29dcee03a57439574e4181d91dca71904fcdcc5e8e4706c0a68a2c61ad9810e1e1c5806b5100d52d3e727b78f5cdc595401045b + languageName: node + linkType: hard + +"jsoncrush@npm:^1.1.6": + version: 1.1.8 + resolution: "jsoncrush@npm:1.1.8" + checksum: fe75c2d6efc627d5fa2c48f7330a6d361f9a011e30c0d95f1e7452b0abe4e36c230d6dfe10b0782f08ccedd0ef56a20a67bb8f3594cc79af8336dc28ede65121 + languageName: node + linkType: hard + +"jsonparse@npm:^1.2.0": + version: 1.3.1 + resolution: "jsonparse@npm:1.3.1" + checksum: 89bc68080cd0a0e276d4b5ab1b79cacd68f562467008d176dc23e16e97d4efec9e21741d92ba5087a8433526a45a7e6a9d5ef25408696c402ca1cfbc01a90bf0 + languageName: node + linkType: hard + +"jspdf@npm:^2.3.1": + version: 2.5.1 + resolution: "jspdf@npm:2.5.1" + dependencies: + "@babel/runtime": "npm:^7.14.0" + atob: "npm:^2.1.2" + btoa: "npm:^1.2.1" + canvg: "npm:^3.0.6" + core-js: "npm:^3.6.0" + dompurify: "npm:^2.2.0" + fflate: "npm:^0.4.8" + html2canvas: "npm:^1.0.0-rc.5" + dependenciesMeta: + canvg: + optional: true + core-js: + optional: true + dompurify: + optional: true + html2canvas: + optional: true + checksum: dad15d4f53ead1d2e9d5f6fd9b6e72c7233ba5cbc30d98461eb0ef609aa908b28fd5eaaf2b763b55df945c7ecca2323097d9331f09fee1d6c23c06785520ab5f + languageName: node + linkType: hard + +"jsx-ast-utils@npm:^2.4.1 || ^3.0.0, jsx-ast-utils@npm:^3.3.5": + version: 3.3.5 + resolution: "jsx-ast-utils@npm:3.3.5" + dependencies: + array-includes: "npm:^3.1.6" + array.prototype.flat: "npm:^1.3.1" + object.assign: "npm:^4.1.4" + object.values: "npm:^1.1.6" + checksum: a32679e9cb55469cb6d8bbc863f7d631b2c98b7fc7bf172629261751a6e7bc8da6ae374ddb74d5fbd8b06cf0eb4572287b259813d92b36e384024ed35e4c13e1 + languageName: node + linkType: hard + +"keyv@npm:^4.5.3": + version: 4.5.4 + resolution: "keyv@npm:4.5.4" + dependencies: + json-buffer: "npm:3.0.1" + checksum: aa52f3c5e18e16bb6324876bb8b59dd02acf782a4b789c7b2ae21107fab95fab3890ed448d4f8dba80ce05391eeac4bfabb4f02a20221342982f806fa2cf271e + languageName: node + linkType: hard + +"kind-of@npm:^6.0.3": + version: 6.0.3 + resolution: "kind-of@npm:6.0.3" + checksum: 61cdff9623dabf3568b6445e93e31376bee1cdb93f8ba7033d86022c2a9b1791a1d9510e026e6465ebd701a6dd2f7b0808483ad8838341ac52f003f512e0b4c4 + languageName: node + linkType: hard + +"language-subtag-registry@npm:^0.3.20": + version: 0.3.22 + resolution: "language-subtag-registry@npm:0.3.22" + checksum: d1e09971260a7cd3b9fdeb190d33af0b6e99c8697013537d9aaa15f7856d9d83aee128ba8078e219df0a7cf4b8dd18d1a0c188f6543b500d92a2689d2d114b70 + languageName: node + linkType: hard + +"language-tags@npm:^1.0.9": + version: 1.0.9 + resolution: "language-tags@npm:1.0.9" + dependencies: + language-subtag-registry: "npm:^0.3.20" + checksum: 9ab911213c4bd8bd583c850201c17794e52cb0660d1ab6e32558aadc8324abebf6844e46f92b80a5d600d0fbba7eface2c207bfaf270a1c7fd539e4c3a880bff + languageName: node + linkType: hard + +"levn@npm:^0.4.1": + version: 0.4.1 + resolution: "levn@npm:0.4.1" + dependencies: + prelude-ls: "npm:^1.2.1" + type-check: "npm:~0.4.0" + checksum: effb03cad7c89dfa5bd4f6989364bfc79994c2042ec5966cb9b95990e2edee5cd8969ddf42616a0373ac49fac1403437deaf6e9050fbbaa3546093a59b9ac94e + languageName: node + linkType: hard + +"lines-and-columns@npm:^1.1.6": + version: 1.2.4 + resolution: "lines-and-columns@npm:1.2.4" + checksum: 3da6ee62d4cd9f03f5dc90b4df2540fb85b352081bee77fe4bbcd12c9000ead7f35e0a38b8d09a9bb99b13223446dd8689ff3c4959807620726d788701a83d2d + languageName: node + linkType: hard + +"load-json-file@npm:^4.0.0": + version: 4.0.0 + resolution: "load-json-file@npm:4.0.0" + dependencies: + graceful-fs: "npm:^4.1.2" + parse-json: "npm:^4.0.0" + pify: "npm:^3.0.0" + strip-bom: "npm:^3.0.0" + checksum: 6b48f6a0256bdfcc8970be2c57f68f10acb2ee7e63709b386b2febb6ad3c86198f840889cdbe71d28f741cbaa2f23a7771206b138cd1bdd159564511ca37c1d5 + languageName: node + linkType: hard + +"local-pkg@npm:^0.4.3": + version: 0.4.3 + resolution: "local-pkg@npm:0.4.3" + checksum: 361c77d7873a629f09c9e86128926227171ee0fe3435d282fb80303ff255bb4d3c053b555d47e953b4f41d2561f2a7bc0e53e9ca5c9bc9607226a77c91ea4994 + languageName: node + linkType: hard + +"locate-path@npm:^2.0.0": + version: 2.0.0 + resolution: "locate-path@npm:2.0.0" + dependencies: + p-locate: "npm:^2.0.0" + path-exists: "npm:^3.0.0" + checksum: 24efa0e589be6aa3c469b502f795126b26ab97afa378846cb508174211515633b770aa0ba610cab113caedab8d2a4902b061a08aaed5297c12ab6f5be4df0133 + languageName: node + linkType: hard + +"locate-path@npm:^5.0.0": + version: 5.0.0 + resolution: "locate-path@npm:5.0.0" + dependencies: + p-locate: "npm:^4.1.0" + checksum: 33a1c5247e87e022f9713e6213a744557a3e9ec32c5d0b5efb10aa3a38177615bf90221a5592674857039c1a0fd2063b82f285702d37b792d973e9e72ace6c59 + languageName: node + linkType: hard + +"locate-path@npm:^6.0.0": + version: 6.0.0 + resolution: "locate-path@npm:6.0.0" + dependencies: + p-locate: "npm:^5.0.0" + checksum: d3972ab70dfe58ce620e64265f90162d247e87159b6126b01314dd67be43d50e96a50b517bce2d9452a79409c7614054c277b5232377de50416564a77ac7aad3 + languageName: node + linkType: hard + +"lodash-es@npm:^4.17.15, lodash-es@npm:^4.17.21": + version: 4.17.21 + resolution: "lodash-es@npm:4.17.21" + checksum: fb407355f7e6cd523a9383e76e6b455321f0f153a6c9625e21a8827d10c54c2a2341bd2ae8d034358b60e07325e1330c14c224ff582d04612a46a4f0479ff2f2 + languageName: node + linkType: hard + +"lodash.camelcase@npm:^4.3.0": + version: 4.3.0 + resolution: "lodash.camelcase@npm:4.3.0" + checksum: fcba15d21a458076dd309fce6b1b4bf611d84a0ec252cb92447c948c533ac250b95d2e00955801ebc367e5af5ed288b996d75d37d2035260a937008e14eaf432 + languageName: node + linkType: hard + +"lodash.clamp@npm:^4.0.0": + version: 4.0.3 + resolution: "lodash.clamp@npm:4.0.3" + checksum: f5eb45e5941fae30f35fb151869342565b24b8aac19463c73f745b6d6d68127784c2b192a4bca185ddaa66a5221efdcd1da2b36e3f9127d9faf3b917f8a9fee7 + languageName: node + linkType: hard + +"lodash.debounce@npm:^4.0.0": + version: 4.0.8 + resolution: "lodash.debounce@npm:4.0.8" + checksum: 762998a63e095412b6099b8290903e0a8ddcb353ac6e2e0f2d7e7d03abd4275fe3c689d88960eb90b0dde4f177554d51a690f22a343932ecbc50a5d111849987 + languageName: node + linkType: hard + +"lodash.isequal@npm:^4.0.0, lodash.isequal@npm:^4.5.0": + version: 4.5.0 + resolution: "lodash.isequal@npm:4.5.0" + checksum: dfdb2356db19631a4b445d5f37868a095e2402292d59539a987f134a8778c62a2810c2452d11ae9e6dcac71fc9de40a6fedcb20e2952a15b431ad8b29e50e28f + languageName: node + linkType: hard + +"lodash.ismatch@npm:^4.4.0": + version: 4.4.0 + resolution: "lodash.ismatch@npm:4.4.0" + checksum: 8f96a5dc4b8d3fc5a033dcb259d0c3148a1044fa4d02b4a0e8dce0fa1f2ef3ec4ac131e20b5cb2c985a4e9bcb1c37c0aa5af2cef70094959389617347b8fc645 + languageName: node + linkType: hard + +"lodash.merge@npm:^4.6.2": + version: 4.6.2 + resolution: "lodash.merge@npm:4.6.2" + checksum: 402fa16a1edd7538de5b5903a90228aa48eb5533986ba7fa26606a49db2572bf414ff73a2c9f5d5fd36b31c46a5d5c7e1527749c07cbcf965ccff5fbdf32c506 + languageName: node + linkType: hard + +"lodash@npm:^4.0.1, lodash@npm:^4.17.10, lodash@npm:^4.17.15": + version: 4.17.21 + resolution: "lodash@npm:4.17.21" + checksum: d8cbea072bb08655bb4c989da418994b073a608dffa608b09ac04b43a791b12aeae7cd7ad919aa4c925f33b48490b5cfe6c1f71d827956071dae2e7bb3a6b74c + languageName: node + linkType: hard + +"long@npm:^4.0.0": + version: 4.0.0 + resolution: "long@npm:4.0.0" + checksum: 50a6417d15b06104dbe4e3d4a667c39b137f130a9108ea8752b352a4cfae047531a3ac351c181792f3f8768fe17cca6b0f406674a541a86fb638aaac560d83ed + languageName: node + linkType: hard + +"longest-streak@npm:^2.0.0": + version: 2.0.4 + resolution: "longest-streak@npm:2.0.4" + checksum: 918fb5104cde537757f44431776d6d828bc091a63ca38a3b3e59a08b88498b4421bf5fd9823ef22b4d186f0234d9943087fa96bd6117d26dedcf6008480fd46a + languageName: node + linkType: hard + +"loose-envify@npm:^1.0.0, loose-envify@npm:^1.1.0, loose-envify@npm:^1.2.0, loose-envify@npm:^1.3.1, loose-envify@npm:^1.4.0": + version: 1.4.0 + resolution: "loose-envify@npm:1.4.0" + dependencies: + js-tokens: "npm:^3.0.0 || ^4.0.0" + bin: + loose-envify: cli.js + checksum: 655d110220983c1a4b9c0c679a2e8016d4b67f6e9c7b5435ff5979ecdb20d0813f4dec0a08674fcbdd4846a3f07edbb50a36811fd37930b94aaa0d9daceb017e + languageName: node + linkType: hard + +"loupe@npm:^2.3.6": + version: 2.3.7 + resolution: "loupe@npm:2.3.7" + dependencies: + get-func-name: "npm:^2.0.1" + checksum: 71a781c8fc21527b99ed1062043f1f2bb30bdaf54fa4cf92463427e1718bc6567af2988300bc243c1f276e4f0876f29e3cbf7b58106fdc186915687456ce5bf4 + languageName: node + linkType: hard + +"lru-cache@npm:^10.0.1, lru-cache@npm:^9.1.1 || ^10.0.0": + version: 10.1.0 + resolution: "lru-cache@npm:10.1.0" + checksum: 778bc8b2626daccd75f24c4b4d10632496e21ba064b126f526c626fbdbc5b28c472013fccd45d7646b9e1ef052444824854aed617b59cd570d01a8b7d651fc1e + languageName: node + linkType: hard + +"lru-cache@npm:^5.1.1": + version: 5.1.1 + resolution: "lru-cache@npm:5.1.1" + dependencies: + yallist: "npm:^3.0.2" + checksum: 89b2ef2ef45f543011e38737b8a8622a2f8998cddf0e5437174ef8f1f70a8b9d14a918ab3e232cb3ba343b7abddffa667f0b59075b2b80e6b4d63c3de6127482 + languageName: node + linkType: hard + +"lru-cache@npm:^6.0.0": + version: 6.0.0 + resolution: "lru-cache@npm:6.0.0" + dependencies: + yallist: "npm:^4.0.0" + checksum: cb53e582785c48187d7a188d3379c181b5ca2a9c78d2bce3e7dee36f32761d1c42983da3fe12b55cb74e1779fa94cdc2e5367c028a9b35317184ede0c07a30a9 + languageName: node + linkType: hard + +"magic-string@npm:^0.30.1": + version: 0.30.5 + resolution: "magic-string@npm:0.30.5" + dependencies: + "@jridgewell/sourcemap-codec": "npm:^1.4.15" + checksum: 38ac220ca7539e96da7ea2f38d85796bdf5c69b6bcae728c4bc2565084e6dc326b9174ee9770bea345cf6c9b3a24041b767167874fab5beca874d2356a9d1520 + languageName: node + linkType: hard + +"make-dir@npm:^4.0.0": + version: 4.0.0 + resolution: "make-dir@npm:4.0.0" + dependencies: + semver: "npm:^7.5.3" + checksum: 69b98a6c0b8e5c4fe9acb61608a9fbcfca1756d910f51e5dbe7a9e5cfb74fca9b8a0c8a0ffdf1294a740826c1ab4871d5bf3f62f72a3049e5eac6541ddffed68 + languageName: node + linkType: hard + +"make-fetch-happen@npm:^13.0.0": + version: 13.0.0 + resolution: "make-fetch-happen@npm:13.0.0" + dependencies: + "@npmcli/agent": "npm:^2.0.0" + cacache: "npm:^18.0.0" + http-cache-semantics: "npm:^4.1.1" + is-lambda: "npm:^1.0.1" + minipass: "npm:^7.0.2" + minipass-fetch: "npm:^3.0.0" + minipass-flush: "npm:^1.0.5" + minipass-pipeline: "npm:^1.2.4" + negotiator: "npm:^0.6.3" + promise-retry: "npm:^2.0.1" + ssri: "npm:^10.0.0" + checksum: 43b9f6dcbc6fe8b8604cb6396957c3698857a15ba4dbc38284f7f0e61f248300585ef1eb8cc62df54e9c724af977e45b5cdfd88320ef7f53e45070ed3488da55 + languageName: node + linkType: hard + +"map-obj@npm:^1.0.0": + version: 1.0.1 + resolution: "map-obj@npm:1.0.1" + checksum: ccca88395e7d38671ed9f5652ecf471ecd546924be2fb900836b9da35e068a96687d96a5f93dcdfa94d9a27d649d2f10a84595590f89a347fb4dda47629dcc52 + languageName: node + linkType: hard + +"map-obj@npm:^4.0.0": + version: 4.3.0 + resolution: "map-obj@npm:4.3.0" + checksum: 1c19e1c88513c8abdab25c316367154c6a0a6a0f77e3e8c391bb7c0e093aefed293f539d026dc013d86219e5e4c25f23b0003ea588be2101ccd757bacc12d43b + languageName: node + linkType: hard + +"markdown-table@npm:^2.0.0": + version: 2.0.0 + resolution: "markdown-table@npm:2.0.0" + dependencies: + repeat-string: "npm:^1.0.0" + checksum: f257e0781ea50eb946919df84bdee4ba61f983971b277a369ca7276f89740fd0e2749b9b187163a42df4c48682b71962d4007215ce3523480028f06c11ddc2e6 + languageName: node + linkType: hard + +"material-colors@npm:^1.2.1": + version: 1.2.6 + resolution: "material-colors@npm:1.2.6" + checksum: 6502ab25b23b783cca4112946bc28a64fdba8bf8efcfbb1e76028d21ecc4b88a2b1338dacf1b64e4b6af46ab98984080586002cdaa9428dc91f6fdcc6909b12a + languageName: node + linkType: hard + +"mdast-add-list-metadata@npm:1.0.1": + version: 1.0.1 + resolution: "mdast-add-list-metadata@npm:1.0.1" + dependencies: + unist-util-visit-parents: "npm:1.1.2" + checksum: 6237f0395a6d0e8a7d0047aae7ba113d33f4741e3764f07e4289a99b3f493855ae0f05c706590552b3e4a4b886503bf5b79d10bdb477f057bbf88649beec2428 + languageName: node + linkType: hard + +"mdast-util-find-and-replace@npm:^1.1.0": + version: 1.1.1 + resolution: "mdast-util-find-and-replace@npm:1.1.1" + dependencies: + escape-string-regexp: "npm:^4.0.0" + unist-util-is: "npm:^4.0.0" + unist-util-visit-parents: "npm:^3.0.0" + checksum: 4b9da583e858146a6553155795ef2f0d37b72b8d20487f75895e01fd240a483fbdb97f5aecd218e8ce598be24edb742c5bcbcba2896d172101529376ef390633 + languageName: node + linkType: hard + +"mdast-util-from-markdown@npm:^0.8.0": + version: 0.8.5 + resolution: "mdast-util-from-markdown@npm:0.8.5" + dependencies: + "@types/mdast": "npm:^3.0.0" + mdast-util-to-string: "npm:^2.0.0" + micromark: "npm:~2.11.0" + parse-entities: "npm:^2.0.0" + unist-util-stringify-position: "npm:^2.0.0" + checksum: 86e7589e574378817c180f10ab602db844b6b71b7b1769314947a02ef42ac5c1435f5163d02a975ae8cdab8b6e6176acbd9188da1848ddd5f0d5e09d0291c870 + languageName: node + linkType: hard + +"mdast-util-gfm-autolink-literal@npm:^0.1.0": + version: 0.1.3 + resolution: "mdast-util-gfm-autolink-literal@npm:0.1.3" + dependencies: + ccount: "npm:^1.0.0" + mdast-util-find-and-replace: "npm:^1.1.0" + micromark: "npm:^2.11.3" + checksum: 155665a88a9b11fb5f8b6c5bff1a1e9d30f7381ff8c1864c7ede1eab4e312c51cef1e92e113cda174ebad40181350e555c303fa3293a1dc60b8945818d0af39a + languageName: node + linkType: hard + +"mdast-util-gfm-strikethrough@npm:^0.2.0": + version: 0.2.3 + resolution: "mdast-util-gfm-strikethrough@npm:0.2.3" + dependencies: + mdast-util-to-markdown: "npm:^0.6.0" + checksum: 1de00913769c252add1f48fea547121d971ef7a8bfe6a89b775dea38aa319e6b10b6f514b492586aa7e660f8880b5c2390e411302a0b2386ed793f914b9eca71 + languageName: node + linkType: hard + +"mdast-util-gfm-table@npm:^0.1.0": + version: 0.1.6 + resolution: "mdast-util-gfm-table@npm:0.1.6" + dependencies: + markdown-table: "npm:^2.0.0" + mdast-util-to-markdown: "npm:~0.6.0" + checksum: a3b3fa2f91a44054dbe7e8a4cba1bcaa35255633da7850ad2688c60d1e1825d5d668774f31689d018d9f04cadc68f6055349048192c89a0e6c2ccb91a7ae7d1f + languageName: node + linkType: hard + +"mdast-util-gfm-task-list-item@npm:^0.1.0": + version: 0.1.6 + resolution: "mdast-util-gfm-task-list-item@npm:0.1.6" + dependencies: + mdast-util-to-markdown: "npm:~0.6.0" + checksum: 6b5b5239f031b630cd433cfd0bb30b7258dfac7d49c86a2c937127bc00fda186f798cf2a671507bcfad00f075d2d8779be9c109549052d98f1b4927e6e12d8be + languageName: node + linkType: hard + +"mdast-util-gfm@npm:^0.1.0": + version: 0.1.2 + resolution: "mdast-util-gfm@npm:0.1.2" + dependencies: + mdast-util-gfm-autolink-literal: "npm:^0.1.0" + mdast-util-gfm-strikethrough: "npm:^0.2.0" + mdast-util-gfm-table: "npm:^0.1.0" + mdast-util-gfm-task-list-item: "npm:^0.1.0" + mdast-util-to-markdown: "npm:^0.6.1" + checksum: 109c5f3e3340c25ecec5fb0b9b1a4137fb0948ffbc38ed4b85d477f3da471c2a475a84f2cb2569663768d6967aedf0f3a18b936ea907d0e34374f4eeaed18c5a + languageName: node + linkType: hard + +"mdast-util-to-markdown@npm:^0.6.0, mdast-util-to-markdown@npm:^0.6.1, mdast-util-to-markdown@npm:~0.6.0": + version: 0.6.5 + resolution: "mdast-util-to-markdown@npm:0.6.5" + dependencies: + "@types/unist": "npm:^2.0.0" + longest-streak: "npm:^2.0.0" + mdast-util-to-string: "npm:^2.0.0" + parse-entities: "npm:^2.0.0" + repeat-string: "npm:^1.0.0" + zwitch: "npm:^1.0.0" + checksum: 716035b75a50394298eb31acee60a20d06310c7ebf83a3009908714d8c4058d636344932c9c054f1a26e8c6c20e2aafda3b87e003c16037b3e16b2d260a87463 + languageName: node + linkType: hard + +"mdast-util-to-string@npm:^2.0.0": + version: 2.0.0 + resolution: "mdast-util-to-string@npm:2.0.0" + checksum: a4231085133cdfec24644b694c13661e5a01d26716be0105b6792889faa04b8030e4abbf72d4be3363098b2b38b2b98f1f1f1f0858eb6580dc04e2aca1436a37 + languageName: node + linkType: hard + +"memorystream@npm:^0.3.1": + version: 0.3.1 + resolution: "memorystream@npm:0.3.1" + checksum: 4bd164657711d9747ff5edb0508b2944414da3464b7fe21ac5c67cf35bba975c4b446a0124bd0f9a8be54cfc18faf92e92bd77563a20328b1ccf2ff04e9f39b9 + languageName: node + linkType: hard + +"meow@npm:^8.0.0": + version: 8.1.2 + resolution: "meow@npm:8.1.2" + dependencies: + "@types/minimist": "npm:^1.2.0" + camelcase-keys: "npm:^6.2.2" + decamelize-keys: "npm:^1.1.0" + hard-rejection: "npm:^2.1.0" + minimist-options: "npm:4.1.0" + normalize-package-data: "npm:^3.0.0" + read-pkg-up: "npm:^7.0.1" + redent: "npm:^3.0.0" + trim-newlines: "npm:^3.0.0" + type-fest: "npm:^0.18.0" + yargs-parser: "npm:^20.2.3" + checksum: 9a8d90e616f783650728a90f4ea1e5f763c1c5260369e6596b52430f877f4af8ecbaa8c9d952c93bbefd6d5bda4caed6a96a20ba7d27b511d2971909b01922a2 + languageName: node + linkType: hard + +"merge2@npm:^1.3.0, merge2@npm:^1.4.1": + version: 1.4.1 + resolution: "merge2@npm:1.4.1" + checksum: 254a8a4605b58f450308fc474c82ac9a094848081bf4c06778200207820e5193726dc563a0d2c16468810516a5c97d9d3ea0ca6585d23c58ccfff2403e8dbbeb + languageName: node + linkType: hard + +"micromark-extension-gfm-autolink-literal@npm:~0.5.0": + version: 0.5.7 + resolution: "micromark-extension-gfm-autolink-literal@npm:0.5.7" + dependencies: + micromark: "npm:~2.11.3" + checksum: 4e56021641200cd88a9e05be531405bba007db9187554e06d0dfb5d8c49df67991322f2f952d6a25bbe3972ef0543a08d7ea00dff7b8577f8f3ca196c6544114 + languageName: node + linkType: hard + +"micromark-extension-gfm-strikethrough@npm:~0.6.5": + version: 0.6.5 + resolution: "micromark-extension-gfm-strikethrough@npm:0.6.5" + dependencies: + micromark: "npm:~2.11.0" + checksum: c14e953b833718f56a71a650e9c2958fdb2b91093d7304043443eb64a8287cb8ff776d3cec0d40ca00ccd69357438f3dcac2cc40d3f16e47230cfbce72a1cf51 + languageName: node + linkType: hard + +"micromark-extension-gfm-table@npm:~0.4.0": + version: 0.4.3 + resolution: "micromark-extension-gfm-table@npm:0.4.3" + dependencies: + micromark: "npm:~2.11.0" + checksum: 0f4be3a1206024845bbc2495ea3b2a255bf5287af3747733d398adf962bfcf6f0c452dc66e268ab84f41b64a2f8113028887034045450bad43a48a8b5583bc14 + languageName: node + linkType: hard + +"micromark-extension-gfm-tagfilter@npm:~0.3.0": + version: 0.3.0 + resolution: "micromark-extension-gfm-tagfilter@npm:0.3.0" + checksum: 5a81cffbcad7f314ddb3b761c5e2db5a5286e231e68559861da821ee748838cc9323fd22af5cbbe68569e826fa8159f2f2b0d53dc8aecc458ef48b2503a071fb + languageName: node + linkType: hard + +"micromark-extension-gfm-task-list-item@npm:~0.3.0": + version: 0.3.3 + resolution: "micromark-extension-gfm-task-list-item@npm:0.3.3" + dependencies: + micromark: "npm:~2.11.0" + checksum: e94e02eb2509a6ced49a6b296a7c503068488da79b5d3a3e4dfe5dcd5abdb95a1f305c087abb4ca3f7c90112ae29d628b30edeadaf53d3eec9dfe338bb678650 + languageName: node + linkType: hard + +"micromark-extension-gfm@npm:^0.3.0": + version: 0.3.3 + resolution: "micromark-extension-gfm@npm:0.3.3" + dependencies: + micromark: "npm:~2.11.0" + micromark-extension-gfm-autolink-literal: "npm:~0.5.0" + micromark-extension-gfm-strikethrough: "npm:~0.6.5" + micromark-extension-gfm-table: "npm:~0.4.0" + micromark-extension-gfm-tagfilter: "npm:~0.3.0" + micromark-extension-gfm-task-list-item: "npm:~0.3.0" + checksum: 6ed94c6213687b84c7b2dbacf8a50b078c60fd960bc9ddb3ec742fc298b8f7d5dcd8e9ab2a73fb8b423a0b11bf0a1565bc24bf45b45009f2693690277a7675df + languageName: node + linkType: hard + +"micromark@npm:^2.11.3, micromark@npm:~2.11.0, micromark@npm:~2.11.3": + version: 2.11.4 + resolution: "micromark@npm:2.11.4" + dependencies: + debug: "npm:^4.0.0" + parse-entities: "npm:^2.0.0" + checksum: 67307cbacae621ab1eb23e333a5addc7600cf97d3b40cad22fc1c2d03d734d6d9cbc3f5a7e5d655a8c0862a949abe590ab7cfa96be366bfe09e239a94e6eea55 + languageName: node + linkType: hard + +"micromatch@npm:^4.0.4": + version: 4.0.5 + resolution: "micromatch@npm:4.0.5" + dependencies: + braces: "npm:^3.0.2" + picomatch: "npm:^2.3.1" + checksum: 3d6505b20f9fa804af5d8c596cb1c5e475b9b0cd05f652c5b56141cf941bd72adaeb7a436fda344235cef93a7f29b7472efc779fcdb83b478eab0867b95cdeff + languageName: node + linkType: hard + +"mime-db@npm:1.52.0": + version: 1.52.0 + resolution: "mime-db@npm:1.52.0" + checksum: 0557a01deebf45ac5f5777fe7740b2a5c309c6d62d40ceab4e23da9f821899ce7a900b7ac8157d4548ddbb7beffe9abc621250e6d182b0397ec7f10c7b91a5aa + languageName: node + linkType: hard + +"mime-types@npm:^2.1.12": + version: 2.1.35 + resolution: "mime-types@npm:2.1.35" + dependencies: + mime-db: "npm:1.52.0" + checksum: 82fb07ec56d8ff1fc999a84f2f217aa46cb6ed1033fefaabd5785b9a974ed225c90dc72fff460259e66b95b73648596dbcc50d51ed69cdf464af2d237d3149b2 + languageName: node + linkType: hard + +"min-indent@npm:^1.0.0": + version: 1.0.1 + resolution: "min-indent@npm:1.0.1" + checksum: 7e207bd5c20401b292de291f02913230cb1163abca162044f7db1d951fa245b174dc00869d40dd9a9f32a885ad6a5f3e767ee104cf278f399cb4e92d3f582d5c + languageName: node + linkType: hard + +"minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": + version: 3.1.2 + resolution: "minimatch@npm:3.1.2" + dependencies: + brace-expansion: "npm:^1.1.7" + checksum: 0262810a8fc2e72cca45d6fd86bd349eee435eb95ac6aa45c9ea2180e7ee875ef44c32b55b5973ceabe95ea12682f6e3725cbb63d7a2d1da3ae1163c8b210311 + languageName: node + linkType: hard + +"minimatch@npm:^5.0.1": + version: 5.1.6 + resolution: "minimatch@npm:5.1.6" + dependencies: + brace-expansion: "npm:^2.0.1" + checksum: 3defdfd230914f22a8da203747c42ee3c405c39d4d37ffda284dac5e45b7e1f6c49aa8be606509002898e73091ff2a3bbfc59c2c6c71d4660609f63aa92f98e3 + languageName: node + linkType: hard + +"minimatch@npm:^9.0.1": + version: 9.0.3 + resolution: "minimatch@npm:9.0.3" + dependencies: + brace-expansion: "npm:^2.0.1" + checksum: 85f407dcd38ac3e180f425e86553911d101455ca3ad5544d6a7cec16286657e4f8a9aa6695803025c55e31e35a91a2252b5dc8e7d527211278b8b65b4dbd5eac + languageName: node + linkType: hard + +"minimist-options@npm:4.1.0": + version: 4.1.0 + resolution: "minimist-options@npm:4.1.0" + dependencies: + arrify: "npm:^1.0.1" + is-plain-obj: "npm:^1.1.0" + kind-of: "npm:^6.0.3" + checksum: 7871f9cdd15d1e7374e5b013e2ceda3d327a06a8c7b38ae16d9ef941e07d985e952c589e57213f7aa90a8744c60aed9524c0d85e501f5478382d9181f2763f54 + languageName: node + linkType: hard + +"minimist@npm:^1.2.5": + version: 1.2.8 + resolution: "minimist@npm:1.2.8" + checksum: 19d3fcdca050087b84c2029841a093691a91259a47def2f18222f41e7645a0b7c44ef4b40e88a1e58a40c84d2ef0ee6047c55594d298146d0eb3f6b737c20ce6 + languageName: node + linkType: hard + +"minipass-collect@npm:^2.0.1": + version: 2.0.1 + resolution: "minipass-collect@npm:2.0.1" + dependencies: + minipass: "npm:^7.0.3" + checksum: 5167e73f62bb74cc5019594709c77e6a742051a647fe9499abf03c71dca75515b7959d67a764bdc4f8b361cf897fbf25e2d9869ee039203ed45240f48b9aa06e + languageName: node + linkType: hard + +"minipass-fetch@npm:^3.0.0": + version: 3.0.4 + resolution: "minipass-fetch@npm:3.0.4" + dependencies: + encoding: "npm:^0.1.13" + minipass: "npm:^7.0.3" + minipass-sized: "npm:^1.0.3" + minizlib: "npm:^2.1.2" + dependenciesMeta: + encoding: + optional: true + checksum: 1b63c1f3313e88eeac4689f1b71c9f086598db9a189400e3ee960c32ed89e06737fa23976c9305c2d57464fb3fcdc12749d3378805c9d6176f5569b0d0ee8a75 + languageName: node + linkType: hard + +"minipass-flush@npm:^1.0.5": + version: 1.0.5 + resolution: "minipass-flush@npm:1.0.5" + dependencies: + minipass: "npm:^3.0.0" + checksum: 2a51b63feb799d2bb34669205eee7c0eaf9dce01883261a5b77410c9408aa447e478efd191b4de6fc1101e796ff5892f8443ef20d9544385819093dbb32d36bd + languageName: node + linkType: hard + +"minipass-pipeline@npm:^1.2.4": + version: 1.2.4 + resolution: "minipass-pipeline@npm:1.2.4" + dependencies: + minipass: "npm:^3.0.0" + checksum: cbda57cea20b140b797505dc2cac71581a70b3247b84480c1fed5ca5ba46c25ecc25f68bfc9e6dcb1a6e9017dab5c7ada5eab73ad4f0a49d84e35093e0c643f2 + languageName: node + linkType: hard + +"minipass-sized@npm:^1.0.3": + version: 1.0.3 + resolution: "minipass-sized@npm:1.0.3" + dependencies: + minipass: "npm:^3.0.0" + checksum: 298f124753efdc745cfe0f2bdfdd81ba25b9f4e753ca4a2066eb17c821f25d48acea607dfc997633ee5bf7b6dfffb4eee4f2051eb168663f0b99fad2fa4829cb + languageName: node + linkType: hard + +"minipass@npm:^3.0.0": + version: 3.3.6 + resolution: "minipass@npm:3.3.6" + dependencies: + yallist: "npm:^4.0.0" + checksum: a114746943afa1dbbca8249e706d1d38b85ed1298b530f5808ce51f8e9e941962e2a5ad2e00eae7dd21d8a4aae6586a66d4216d1a259385e9d0358f0c1eba16c + languageName: node + linkType: hard + +"minipass@npm:^5.0.0": + version: 5.0.0 + resolution: "minipass@npm:5.0.0" + checksum: a91d8043f691796a8ac88df039da19933ef0f633e3d7f0d35dcd5373af49131cf2399bfc355f41515dc495e3990369c3858cd319e5c2722b4753c90bf3152462 + languageName: node + linkType: hard + +"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3": + version: 7.0.4 + resolution: "minipass@npm:7.0.4" + checksum: 6c7370a6dfd257bf18222da581ba89a5eaedca10e158781232a8b5542a90547540b4b9b7e7f490e4cda43acfbd12e086f0453728ecf8c19e0ef6921bc5958ac5 + languageName: node + linkType: hard + +"minizlib@npm:^2.1.1, minizlib@npm:^2.1.2": + version: 2.1.2 + resolution: "minizlib@npm:2.1.2" + dependencies: + minipass: "npm:^3.0.0" + yallist: "npm:^4.0.0" + checksum: 64fae024e1a7d0346a1102bb670085b17b7f95bf6cfdf5b128772ec8faf9ea211464ea4add406a3a6384a7d87a0cd1a96263692134323477b4fb43659a6cab78 + languageName: node + linkType: hard + +"mkdirp@npm:^1.0.3": + version: 1.0.4 + resolution: "mkdirp@npm:1.0.4" + bin: + mkdirp: bin/cmd.js + checksum: 46ea0f3ffa8bc6a5bc0c7081ffc3907777f0ed6516888d40a518c5111f8366d97d2678911ad1a6882bf592fa9de6c784fea32e1687bb94e1f4944170af48a5cf + languageName: node + linkType: hard + +"mlly@npm:^1.2.0, mlly@npm:^1.4.0": + version: 1.4.2 + resolution: "mlly@npm:1.4.2" + dependencies: + acorn: "npm:^8.10.0" + pathe: "npm:^1.1.1" + pkg-types: "npm:^1.0.3" + ufo: "npm:^1.3.0" + checksum: 905e3a704c7d3bcaad55f31d6efe9f680eab5be053ab7f8b299b8dbc027041f741fa6a93db9a3c461be2552632f3831b6c43c50af530f5fb2e9cd6273bc9d642 + languageName: node + linkType: hard + +"modify-values@npm:^1.0.0": + version: 1.0.1 + resolution: "modify-values@npm:1.0.1" + checksum: 6acb1b82aaf7a02f9f7b554b20cbfc159f223a79c66b0a257511c5933d50b85e12ea1220b0a90a2af6f80bc29ff784f929a52a51881867a93ae6a12ce87a729a + languageName: node + linkType: hard + +"monaco-editor@npm:^0.27.0": + version: 0.27.0 + resolution: "monaco-editor@npm:0.27.0" + checksum: 9036f6d139d985ec8a6278f1be022c7083b25666501027c207246f9f324303244eee1758bc9fc6212a6bfe0146e250e58f0ddc935bc34e7e44b33d6917fe74f0 + languageName: node + linkType: hard + +"moo-color@npm:^1.0.2": + version: 1.0.3 + resolution: "moo-color@npm:1.0.3" + dependencies: + color-name: "npm:^1.1.4" + checksum: 778c82f67f638c03a1d0fa78dcd6ea376a9f17b5e78e349c7e34a290b496dbdb43fd0b1c38070e2062d5e784bcf08e57f499015fcbcf52b3a1887d7825ebb80d + languageName: node + linkType: hard + +"ms@npm:2.1.2": + version: 2.1.2 + resolution: "ms@npm:2.1.2" + checksum: a437714e2f90dbf881b5191d35a6db792efbca5badf112f87b9e1c712aace4b4b9b742dd6537f3edf90fd6f684de897cec230abde57e87883766712ddda297cc + languageName: node + linkType: hard + +"nanoevents@npm:^7.0.1": + version: 7.0.1 + resolution: "nanoevents@npm:7.0.1" + checksum: 2881db832cc24a2b3243e78ed7d905b633de49cd9ebb7ce7e802ac984ddfc54f57f07c308dfa54445dcd1d28dfe4e1720ccae89467ad19c6c4f807f4029bfb5b + languageName: node + linkType: hard + +"nanoid@npm:^3.0.0, nanoid@npm:^3.3.7": + version: 3.3.7 + resolution: "nanoid@npm:3.3.7" + bin: + nanoid: bin/nanoid.cjs + checksum: e3fb661aa083454f40500473bb69eedb85dc160e763150b9a2c567c7e9ff560ce028a9f833123b618a6ea742e311138b591910e795614a629029e86e180660f3 + languageName: node + linkType: hard + +"natural-compare-lite@npm:^1.4.0": + version: 1.4.0 + resolution: "natural-compare-lite@npm:1.4.0" + checksum: f6cef26f5044515754802c0fc475d81426f3b90fe88c20fabe08771ce1f736ce46e0397c10acb569a4dd0acb84c7f1ee70676122f95d5bfdd747af3a6c6bbaa8 + languageName: node + linkType: hard + +"natural-compare@npm:^1.4.0": + version: 1.4.0 + resolution: "natural-compare@npm:1.4.0" + checksum: f5f9a7974bfb28a91afafa254b197f0f22c684d4a1731763dda960d2c8e375b36c7d690e0d9dc8fba774c537af14a7e979129bca23d88d052fbeb9466955e447 + languageName: node + linkType: hard + +"ndarray@npm:^1.0.18": + version: 1.0.19 + resolution: "ndarray@npm:1.0.19" + dependencies: + iota-array: "npm:^1.0.0" + is-buffer: "npm:^1.0.2" + checksum: e5929a845dae326052ff024f4f624b5f81e0be750224495baa0c7a02afd4e1117198452465c052f0bd111358b05c15655a797ec959dbbbe042c6ae573de09046 + languageName: node + linkType: hard + +"negotiator@npm:^0.6.3": + version: 0.6.3 + resolution: "negotiator@npm:0.6.3" + checksum: 3ec9fd413e7bf071c937ae60d572bc67155262068ed522cf4b3be5edbe6ddf67d095ec03a3a14ebf8fc8e95f8e1d61be4869db0dbb0de696f6b837358bd43fc2 + languageName: node + linkType: hard + +"neo-async@npm:^2.6.2": + version: 2.6.2 + resolution: "neo-async@npm:2.6.2" + checksum: c2f5a604a54a8ec5438a342e1f356dff4bc33ccccdb6dc668d94fe8e5eccfc9d2c2eea6064b0967a767ba63b33763f51ccf2cd2441b461a7322656c1f06b3f5d + languageName: node + linkType: hard + +"nice-try@npm:^1.0.4": + version: 1.0.5 + resolution: "nice-try@npm:1.0.5" + checksum: 95568c1b73e1d0d4069a3e3061a2102d854513d37bcfda73300015b7ba4868d3b27c198d1dbbd8ebdef4112fc2ed9e895d4a0f2e1cce0bd334f2a1346dc9205f + languageName: node + linkType: hard + +"node-fetch@npm:^2.6.12": + version: 2.7.0 + resolution: "node-fetch@npm:2.7.0" + dependencies: + whatwg-url: "npm:^5.0.0" + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + checksum: b55786b6028208e6fbe594ccccc213cab67a72899c9234eb59dba51062a299ea853210fcf526998eaa2867b0963ad72338824450905679ff0fa304b8c5093ae8 + languageName: node + linkType: hard + +"node-gyp@npm:latest": + version: 10.0.1 + resolution: "node-gyp@npm:10.0.1" + dependencies: + env-paths: "npm:^2.2.0" + exponential-backoff: "npm:^3.1.1" + glob: "npm:^10.3.10" + graceful-fs: "npm:^4.2.6" + make-fetch-happen: "npm:^13.0.0" + nopt: "npm:^7.0.0" + proc-log: "npm:^3.0.0" + semver: "npm:^7.3.5" + tar: "npm:^6.1.2" + which: "npm:^4.0.0" + bin: + node-gyp: bin/node-gyp.js + checksum: abddfff7d873312e4ed4a5fb75ce893a5c4fb69e7fcb1dfa71c28a6b92a7f1ef6b62790dffb39181b5a82728ba8f2f32d229cf8cbe66769fe02cea7db4a555aa + languageName: node + linkType: hard + +"node-releases@npm:^2.0.14": + version: 2.0.14 + resolution: "node-releases@npm:2.0.14" + checksum: 199fc93773ae70ec9969bc6d5ac5b2bbd6eb986ed1907d751f411fef3ede0e4bfdb45ceb43711f8078bea237b6036db8b1bf208f6ff2b70c7d615afd157f3ab9 + languageName: node + linkType: hard + +"nopt@npm:^7.0.0": + version: 7.2.0 + resolution: "nopt@npm:7.2.0" + dependencies: + abbrev: "npm:^2.0.0" + bin: + nopt: bin/nopt.js + checksum: 9bd7198df6f16eb29ff16892c77bcf7f0cc41f9fb5c26280ac0def2cf8cf319f3b821b3af83eba0e74c85807cc430a16efe0db58fe6ae1f41e69519f585b6aff + languageName: node + linkType: hard + +"normalize-package-data@npm:^2.3.2, normalize-package-data@npm:^2.5.0": + version: 2.5.0 + resolution: "normalize-package-data@npm:2.5.0" + dependencies: + hosted-git-info: "npm:^2.1.4" + resolve: "npm:^1.10.0" + semver: "npm:2 || 3 || 4 || 5" + validate-npm-package-license: "npm:^3.0.1" + checksum: 357cb1646deb42f8eb4c7d42c4edf0eec312f3628c2ef98501963cc4bbe7277021b2b1d977f982b2edce78f5a1014613ce9cf38085c3df2d76730481357ca504 + languageName: node + linkType: hard + +"normalize-package-data@npm:^3.0.0": + version: 3.0.3 + resolution: "normalize-package-data@npm:3.0.3" + dependencies: + hosted-git-info: "npm:^4.0.1" + is-core-module: "npm:^2.5.0" + semver: "npm:^7.3.4" + validate-npm-package-license: "npm:^3.0.1" + checksum: e5d0f739ba2c465d41f77c9d950e291ea4af78f8816ddb91c5da62257c40b76d8c83278b0d08ffbcd0f187636ebddad20e181e924873916d03e6e5ea2ef026be + languageName: node + linkType: hard + +"normalize-path@npm:^3.0.0": + version: 3.0.0 + resolution: "normalize-path@npm:3.0.0" + checksum: e008c8142bcc335b5e38cf0d63cfd39d6cf2d97480af9abdbe9a439221fd4d749763bab492a8ee708ce7a194bb00c9da6d0a115018672310850489137b3da046 + languageName: node + linkType: hard + +"npm-run-all@npm:^4.1.5": + version: 4.1.5 + resolution: "npm-run-all@npm:4.1.5" + dependencies: + ansi-styles: "npm:^3.2.1" + chalk: "npm:^2.4.1" + cross-spawn: "npm:^6.0.5" + memorystream: "npm:^0.3.1" + minimatch: "npm:^3.0.4" + pidtree: "npm:^0.3.0" + read-pkg: "npm:^3.0.0" + shell-quote: "npm:^1.6.1" + string.prototype.padend: "npm:^3.0.0" + bin: + npm-run-all: bin/npm-run-all/index.js + run-p: bin/run-p/index.js + run-s: bin/run-s/index.js + checksum: 736ee39bd35454d3efaa4a2e53eba6c523e2e17fba21a18edcce6b221f5cab62000bef16bb6ae8aff9e615831e6b0eb25ab51d52d60e6fa6f4ea880e4c6d31f4 + languageName: node + linkType: hard + +"nwsapi@npm:^2.2.0": + version: 2.2.7 + resolution: "nwsapi@npm:2.2.7" + checksum: 44be198adae99208487a1c886c0a3712264f7bbafa44368ad96c003512fed2753d4e22890ca1e6edb2690c3456a169f2a3c33bfacde1905cf3bf01c7722464db + languageName: node + linkType: hard + +"object-assign@npm:^4.1.1": + version: 4.1.1 + resolution: "object-assign@npm:4.1.1" + checksum: 1f4df9945120325d041ccf7b86f31e8bcc14e73d29171e37a7903050e96b81323784ec59f93f102ec635bcf6fa8034ba3ea0a8c7e69fa202b87ae3b6cec5a414 + languageName: node + linkType: hard + +"object-inspect@npm:^1.13.1, object-inspect@npm:^1.9.0": + version: 1.13.1 + resolution: "object-inspect@npm:1.13.1" + checksum: fad603f408e345c82e946abdf4bfd774260a5ed3e5997a0b057c44153ac32c7271ff19e3a5ae39c858da683ba045ccac2f65245c12763ce4e8594f818f4a648d + languageName: node + linkType: hard + +"object-keys@npm:^1.1.1": + version: 1.1.1 + resolution: "object-keys@npm:1.1.1" + checksum: b11f7ccdbc6d406d1f186cdadb9d54738e347b2692a14439ca5ac70c225fa6db46db809711b78589866d47b25fc3e8dee0b4c722ac751e11180f9380e3d8601d + languageName: node + linkType: hard + +"object.assign@npm:^4.1.4": + version: 4.1.5 + resolution: "object.assign@npm:4.1.5" + dependencies: + call-bind: "npm:^1.0.5" + define-properties: "npm:^1.2.1" + has-symbols: "npm:^1.0.3" + object-keys: "npm:^1.1.1" + checksum: 60108e1fa2706f22554a4648299b0955236c62b3685c52abf4988d14fffb0e7731e00aa8c6448397e3eb63d087dcc124a9f21e1980f36d0b2667f3c18bacd469 + languageName: node + linkType: hard + +"object.entries-ponyfill@npm:^1.0.1": + version: 1.0.1 + resolution: "object.entries-ponyfill@npm:1.0.1" + checksum: b16804a9f8a419adaca4251dc014764717d7452ff4e5494abceb1b9d85d1879f4109c4c0471e6d4a7b092740a2d9470b50d658d1c29f8669bbcc43ee6876ddb9 + languageName: node + linkType: hard + +"object.entries@npm:^1.1.6, object.entries@npm:^1.1.7": + version: 1.1.7 + resolution: "object.entries@npm:1.1.7" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + checksum: 3ad1899cc7bf14546bf28f4a9b363ae8690b90948fcfbcac4c808395435d760f26193d9cae95337ce0e3c1e5c1f4fa45f7b46b31b68d389e9e117fce38775d86 + languageName: node + linkType: hard + +"object.fromentries@npm:^2.0.6, object.fromentries@npm:^2.0.7": + version: 2.0.7 + resolution: "object.fromentries@npm:2.0.7" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + checksum: 071745c21f6fc9e6c914691f2532c1fb60ad967e5ddc52801d09958b5de926566299d07ae14466452a7efd29015f9145d6c09c573d93a0dc6f1683ee0ec2b93b + languageName: node + linkType: hard + +"object.hasown@npm:^1.1.2": + version: 1.1.3 + resolution: "object.hasown@npm:1.1.3" + dependencies: + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + checksum: 8a41ba4fb1208a85c2275e9b5098071beacc24345b9a71ab98ef0a1c61b34dc74c6b460ff1e1884c33843d8f2553df64a10eec2b74b3ed009e3b2710c826bd2c + languageName: node + linkType: hard + +"object.values@npm:^1.1.6": + version: 1.1.7 + resolution: "object.values@npm:1.1.7" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + checksum: e869d6a37fb7afdd0054dea49036d6ccebb84854a8848a093bbd1bc516f53e690bba88f0bc3e83fdfa74c601469ee6989c9b13359cda9604144c6e732fad3b6b + languageName: node + linkType: hard + +"observable-fns@npm:^0.6.1": + version: 0.6.1 + resolution: "observable-fns@npm:0.6.1" + checksum: bf25d5b3e4040233e886800c48b347361d9c7a1179f345590e671c2dd5ea9b4447bd5037f8ed40b2bb6fd7e205f0c5450eff15f48efdf91b3dec027007cf2834 + languageName: node + linkType: hard + +"once@npm:^1.3.0": + version: 1.4.0 + resolution: "once@npm:1.4.0" + dependencies: + wrappy: "npm:1" + checksum: 5d48aca287dfefabd756621c5dfce5c91a549a93e9fdb7b8246bc4c4790aa2ec17b34a260530474635147aeb631a2dcc8b32c613df0675f96041cbb8244517d0 + languageName: node + linkType: hard + +"optionator@npm:^0.9.3": + version: 0.9.3 + resolution: "optionator@npm:0.9.3" + dependencies: + "@aashutoshrathi/word-wrap": "npm:^1.2.3" + deep-is: "npm:^0.1.3" + fast-levenshtein: "npm:^2.0.6" + levn: "npm:^0.4.1" + prelude-ls: "npm:^1.2.1" + type-check: "npm:^0.4.0" + checksum: 66fba794d425b5be51353035cf3167ce6cfa049059cbb93229b819167687e0f48d2bc4603fcb21b091c99acb516aae1083624675b15c4765b2e4693a085e959c + languageName: node + linkType: hard + +"p-limit@npm:^1.1.0": + version: 1.3.0 + resolution: "p-limit@npm:1.3.0" + dependencies: + p-try: "npm:^1.0.0" + checksum: 5c1b1d53d180b2c7501efb04b7c817448e10efe1ba46f4783f8951994d5027e4cd88f36ad79af50546682594c4ebd11702ac4b9364c47f8074890e2acad0edee + languageName: node + linkType: hard + +"p-limit@npm:^2.2.0": + version: 2.3.0 + resolution: "p-limit@npm:2.3.0" + dependencies: + p-try: "npm:^2.0.0" + checksum: 8da01ac53efe6a627080fafc127c873da40c18d87b3f5d5492d465bb85ec7207e153948df6b9cbaeb130be70152f874229b8242ee2be84c0794082510af97f12 + languageName: node + linkType: hard + +"p-limit@npm:^3.0.2": + version: 3.1.0 + resolution: "p-limit@npm:3.1.0" + dependencies: + yocto-queue: "npm:^0.1.0" + checksum: 9db675949dbdc9c3763c89e748d0ef8bdad0afbb24d49ceaf4c46c02c77d30db4e0652ed36d0a0a7a95154335fab810d95c86153105bb73b3a90448e2bb14e1a + languageName: node + linkType: hard + +"p-limit@npm:^4.0.0": + version: 4.0.0 + resolution: "p-limit@npm:4.0.0" + dependencies: + yocto-queue: "npm:^1.0.0" + checksum: a56af34a77f8df2ff61ddfb29431044557fcbcb7642d5a3233143ebba805fc7306ac1d448de724352861cb99de934bc9ab74f0d16fe6a5460bdbdf938de875ad + languageName: node + linkType: hard + +"p-locate@npm:^2.0.0": + version: 2.0.0 + resolution: "p-locate@npm:2.0.0" + dependencies: + p-limit: "npm:^1.1.0" + checksum: 82da4be88fb02fd29175e66021610c881938d3cc97c813c71c1a605fac05617d57fd5d3b337494a6106c0edb2a37c860241430851411f1b265108cead34aee67 + languageName: node + linkType: hard + +"p-locate@npm:^4.1.0": + version: 4.1.0 + resolution: "p-locate@npm:4.1.0" + dependencies: + p-limit: "npm:^2.2.0" + checksum: 1b476ad69ad7f6059744f343b26d51ce091508935c1dbb80c4e0a2f397ffce0ca3a1f9f5cd3c7ce19d7929a09719d5c65fe70d8ee289c3f267cd36f2881813e9 + languageName: node + linkType: hard + +"p-locate@npm:^5.0.0": + version: 5.0.0 + resolution: "p-locate@npm:5.0.0" + dependencies: + p-limit: "npm:^3.0.2" + checksum: 2290d627ab7903b8b70d11d384fee714b797f6040d9278932754a6860845c4d3190603a0772a663c8cb5a7b21d1b16acb3a6487ebcafa9773094edc3dfe6009a + languageName: node + linkType: hard + +"p-map@npm:^4.0.0": + version: 4.0.0 + resolution: "p-map@npm:4.0.0" + dependencies: + aggregate-error: "npm:^3.0.0" + checksum: 592c05bd6262c466ce269ff172bb8de7c6975afca9b50c975135b974e9bdaafbfe80e61aaaf5be6d1200ba08b30ead04b88cfa7e25ff1e3b93ab28c9f62a2c75 + languageName: node + linkType: hard + +"p-try@npm:^1.0.0": + version: 1.0.0 + resolution: "p-try@npm:1.0.0" + checksum: 757ba31de5819502b80c447826fac8be5f16d3cb4fbf9bc8bc4971dba0682e84ac33e4b24176ca7058c69e29f64f34d8d9e9b08e873b7b7bb0aa89d620fa224a + languageName: node + linkType: hard + +"p-try@npm:^2.0.0": + version: 2.2.0 + resolution: "p-try@npm:2.2.0" + checksum: c36c19907734c904b16994e6535b02c36c2224d433e01a2f1ab777237f4d86e6289fd5fd464850491e940379d4606ed850c03e0f9ab600b0ebddb511312e177f + languageName: node + linkType: hard + +"pako@npm:^1.0.10, pako@npm:^1.0.11": + version: 1.0.11 + resolution: "pako@npm:1.0.11" + checksum: 86dd99d8b34c3930345b8bbeb5e1cd8a05f608eeb40967b293f72fe469d0e9c88b783a8777e4cc7dc7c91ce54c5e93d88ff4b4f060e6ff18408fd21030d9ffbe + languageName: node + linkType: hard + +"pako@npm:^2.0.0": + version: 2.1.0 + resolution: "pako@npm:2.1.0" + checksum: 8e8646581410654b50eb22a5dfd71159cae98145bd5086c9a7a816ec0370b5f72b4648d08674624b3870a521e6a3daffd6c2f7bc00fdefc7063c9d8232ff5116 + languageName: node + linkType: hard + +"parent-module@npm:^1.0.0": + version: 1.0.1 + resolution: "parent-module@npm:1.0.1" + dependencies: + callsites: "npm:^3.0.0" + checksum: c63d6e80000d4babd11978e0d3fee386ca7752a02b035fd2435960ffaa7219dc42146f07069fb65e6e8bf1caef89daf9af7535a39bddf354d78bf50d8294f556 + languageName: node + linkType: hard + +"parse-entities@npm:^2.0.0": + version: 2.0.0 + resolution: "parse-entities@npm:2.0.0" + dependencies: + character-entities: "npm:^1.0.0" + character-entities-legacy: "npm:^1.0.0" + character-reference-invalid: "npm:^1.0.0" + is-alphanumerical: "npm:^1.0.0" + is-decimal: "npm:^1.0.0" + is-hexadecimal: "npm:^1.0.0" + checksum: f85a22c0ea406ff26b53fdc28641f01cc36fa49eb2e3135f02693286c89ef0bcefc2262d99b3688e20aac2a14fd10b75c518583e875c1b9fe3d1f937795e0854 + languageName: node + linkType: hard + +"parse-json@npm:^4.0.0": + version: 4.0.0 + resolution: "parse-json@npm:4.0.0" + dependencies: + error-ex: "npm:^1.3.1" + json-parse-better-errors: "npm:^1.0.1" + checksum: 8d80790b772ccb1bcea4e09e2697555e519d83d04a77c2b4237389b813f82898943a93ffff7d0d2406203bdd0c30dcf95b1661e3a53f83d0e417f053957bef32 + languageName: node + linkType: hard + +"parse-json@npm:^5.0.0": + version: 5.2.0 + resolution: "parse-json@npm:5.2.0" + dependencies: + "@babel/code-frame": "npm:^7.0.0" + error-ex: "npm:^1.3.1" + json-parse-even-better-errors: "npm:^2.3.0" + lines-and-columns: "npm:^1.1.6" + checksum: 77947f2253005be7a12d858aedbafa09c9ae39eb4863adf330f7b416ca4f4a08132e453e08de2db46459256fb66afaac5ee758b44fe6541b7cdaf9d252e59585 + languageName: node + linkType: hard + +"parse5@npm:6.0.1": + version: 6.0.1 + resolution: "parse5@npm:6.0.1" + checksum: 595821edc094ecbcfb9ddcb46a3e1fe3a718540f8320eff08b8cf6742a5114cce2d46d45f95c26191c11b184dcaf4e2960abcd9c5ed9eb9393ac9a37efcfdecb + languageName: node + linkType: hard + +"path-exists@npm:^3.0.0": + version: 3.0.0 + resolution: "path-exists@npm:3.0.0" + checksum: 17d6a5664bc0a11d48e2b2127d28a0e58822c6740bde30403f08013da599182289c56518bec89407e3f31d3c2b6b296a4220bc3f867f0911fee6952208b04167 + languageName: node + linkType: hard + +"path-exists@npm:^4.0.0": + version: 4.0.0 + resolution: "path-exists@npm:4.0.0" + checksum: 8c0bd3f5238188197dc78dced15207a4716c51cc4e3624c44fc97acf69558f5ebb9a2afff486fe1b4ee148e0c133e96c5e11a9aa5c48a3006e3467da070e5e1b + languageName: node + linkType: hard + +"path-is-absolute@npm:^1.0.0": + version: 1.0.1 + resolution: "path-is-absolute@npm:1.0.1" + checksum: 127da03c82172a2a50099cddbf02510c1791fc2cc5f7713ddb613a56838db1e8168b121a920079d052e0936c23005562059756d653b7c544c53185efe53be078 + languageName: node + linkType: hard + +"path-key@npm:^2.0.1": + version: 2.0.1 + resolution: "path-key@npm:2.0.1" + checksum: dd2044f029a8e58ac31d2bf34c34b93c3095c1481942960e84dd2faa95bbb71b9b762a106aead0646695330936414b31ca0bd862bf488a937ad17c8c5d73b32b + languageName: node + linkType: hard + +"path-key@npm:^3.1.0": + version: 3.1.1 + resolution: "path-key@npm:3.1.1" + checksum: 748c43efd5a569c039d7a00a03b58eecd1d75f3999f5a28303d75f521288df4823bc057d8784eb72358b2895a05f29a070bc9f1f17d28226cc4e62494cc58c4c + languageName: node + linkType: hard + +"path-parse@npm:^1.0.7": + version: 1.0.7 + resolution: "path-parse@npm:1.0.7" + checksum: 11ce261f9d294cc7a58d6a574b7f1b935842355ec66fba3c3fd79e0f036462eaf07d0aa95bb74ff432f9afef97ce1926c720988c6a7451d8a584930ae7de86e1 + languageName: node + linkType: hard + +"path-scurry@npm:^1.10.1": + version: 1.10.1 + resolution: "path-scurry@npm:1.10.1" + dependencies: + lru-cache: "npm:^9.1.1 || ^10.0.0" + minipass: "npm:^5.0.0 || ^6.0.2 || ^7.0.0" + checksum: e5dc78a7348d25eec61ab166317e9e9c7b46818aa2c2b9006c507a6ff48c672d011292d9662527213e558f5652ce0afcc788663a061d8b59ab495681840c0c1e + languageName: node + linkType: hard + +"path-to-regexp@npm:^1.7.0": + version: 1.8.0 + resolution: "path-to-regexp@npm:1.8.0" + dependencies: + isarray: "npm:0.0.1" + checksum: 7b25d6f27a8de03f49406d16195450f5ced694398adea1510b0f949d9660600d1769c5c6c83668583b7e6b503f3caf1ede8ffc08135dbe3e982f034f356fbb5c + languageName: node + linkType: hard + +"path-type@npm:^3.0.0": + version: 3.0.0 + resolution: "path-type@npm:3.0.0" + dependencies: + pify: "npm:^3.0.0" + checksum: 1332c632f1cac15790ebab8dd729b67ba04fc96f81647496feb1c2975d862d046f41e4b975dbd893048999b2cc90721f72924ad820acc58c78507ba7141a8e56 + languageName: node + linkType: hard + +"path-type@npm:^4.0.0": + version: 4.0.0 + resolution: "path-type@npm:4.0.0" + checksum: 666f6973f332f27581371efaf303fd6c272cc43c2057b37aa99e3643158c7e4b2626549555d88626e99ea9e046f82f32e41bbde5f1508547e9a11b149b52387c + languageName: node + linkType: hard + +"pathe@npm:^1.1.0, pathe@npm:^1.1.1": + version: 1.1.1 + resolution: "pathe@npm:1.1.1" + checksum: 3ae5a0529c3415d91c3ac9133f52cffea54a0dd46892fe059f4b80faf36fd207957d4594bdc87043b65d0761b1e5728f81f46bafff3b5302da4e2e48889b8c0e + languageName: node + linkType: hard + +"pathval@npm:^1.1.1": + version: 1.1.1 + resolution: "pathval@npm:1.1.1" + checksum: f63e1bc1b33593cdf094ed6ff5c49c1c0dc5dc20a646ca9725cc7fe7cd9995002d51d5685b9b2ec6814342935748b711bafa840f84c0bb04e38ff40a335c94dc + languageName: node + linkType: hard + +"performance-now@npm:^2.1.0": + version: 2.1.0 + resolution: "performance-now@npm:2.1.0" + checksum: 22c54de06f269e29f640e0e075207af57de5052a3d15e360c09b9a8663f393f6f45902006c1e71aa8a5a1cdfb1a47fe268826f8496d6425c362f00f5bc3e85d9 + languageName: node + linkType: hard + +"picocolors@npm:^1.0.0": + version: 1.0.0 + resolution: "picocolors@npm:1.0.0" + checksum: 20a5b249e331c14479d94ec6817a182fd7a5680debae82705747b2db7ec50009a5f6648d0621c561b0572703f84dbef0858abcbd5856d3c5511426afcb1961f7 + languageName: node + linkType: hard + +"picomatch@npm:^2.3.1": + version: 2.3.1 + resolution: "picomatch@npm:2.3.1" + checksum: 26c02b8d06f03206fc2ab8d16f19960f2ff9e81a658f831ecb656d8f17d9edc799e8364b1f4a7873e89d9702dff96204be0fa26fe4181f6843f040f819dac4be + languageName: node + linkType: hard + +"pidtree@npm:^0.3.0": + version: 0.3.1 + resolution: "pidtree@npm:0.3.1" + bin: + pidtree: bin/pidtree.js + checksum: cd69b0182f749f45ab48584e3442c48c5dc4512502c18d5b0147a33b042c41a4db4269b9ce2f7c48f11833ee5e79d81f5ebc6f7bf8372d4ea55726f60dc505a1 + languageName: node + linkType: hard + +"pify@npm:^2.3.0": + version: 2.3.0 + resolution: "pify@npm:2.3.0" + checksum: 551ff8ab830b1052633f59cb8adc9ae8407a436e06b4a9718bcb27dc5844b83d535c3a8512b388b6062af65a98c49bdc0dd523d8b2617b188f7c8fee457158dc + languageName: node + linkType: hard + +"pify@npm:^3.0.0": + version: 3.0.0 + resolution: "pify@npm:3.0.0" + checksum: fead19ed9d801f1b1fcd0638a1ac53eabbb0945bf615f2f8806a8b646565a04a1b0e7ef115c951d225f042cca388fdc1cd3add46d10d1ed6951c20bd2998af10 + languageName: node + linkType: hard + +"pixelmatch@npm:^5.3.0": + version: 5.3.0 + resolution: "pixelmatch@npm:5.3.0" + dependencies: + pngjs: "npm:^6.0.0" + bin: + pixelmatch: bin/pixelmatch + checksum: 30850661db29b57cefbe6cf36e930b7517aea4e0ed129e85fcc8ec04a7e6e7648a822a972f8e01d2d3db268ca3c735555caf6b8099a164d8b64d105986d682d2 + languageName: node + linkType: hard + +"pixi.js@npm:^6.3.0": + version: 6.5.10 + resolution: "pixi.js@npm:6.5.10" + dependencies: + "@pixi/accessibility": "npm:6.5.10" + "@pixi/app": "npm:6.5.10" + "@pixi/compressed-textures": "npm:6.5.10" + "@pixi/constants": "npm:6.5.10" + "@pixi/core": "npm:6.5.10" + "@pixi/display": "npm:6.5.10" + "@pixi/extensions": "npm:6.5.10" + "@pixi/extract": "npm:6.5.10" + "@pixi/filter-alpha": "npm:6.5.10" + "@pixi/filter-blur": "npm:6.5.10" + "@pixi/filter-color-matrix": "npm:6.5.10" + "@pixi/filter-displacement": "npm:6.5.10" + "@pixi/filter-fxaa": "npm:6.5.10" + "@pixi/filter-noise": "npm:6.5.10" + "@pixi/graphics": "npm:6.5.10" + "@pixi/interaction": "npm:6.5.10" + "@pixi/loaders": "npm:6.5.10" + "@pixi/math": "npm:6.5.10" + "@pixi/mesh": "npm:6.5.10" + "@pixi/mesh-extras": "npm:6.5.10" + "@pixi/mixin-cache-as-bitmap": "npm:6.5.10" + "@pixi/mixin-get-child-by-name": "npm:6.5.10" + "@pixi/mixin-get-global-position": "npm:6.5.10" + "@pixi/particle-container": "npm:6.5.10" + "@pixi/polyfill": "npm:6.5.10" + "@pixi/prepare": "npm:6.5.10" + "@pixi/runner": "npm:6.5.10" + "@pixi/settings": "npm:6.5.10" + "@pixi/sprite": "npm:6.5.10" + "@pixi/sprite-animated": "npm:6.5.10" + "@pixi/sprite-tiling": "npm:6.5.10" + "@pixi/spritesheet": "npm:6.5.10" + "@pixi/text": "npm:6.5.10" + "@pixi/text-bitmap": "npm:6.5.10" + "@pixi/ticker": "npm:6.5.10" + "@pixi/utils": "npm:6.5.10" + checksum: d3473b10a1f1c906269dc9f765fd8e3468a9bc66a7b98eec8ddf29c53a4a54277844f39fc3e7e5bf3b7763c57e7736c4d84e67f1b0823e96d74b53359e663750 + languageName: node + linkType: hard + +"pkg-types@npm:^1.0.3": + version: 1.0.3 + resolution: "pkg-types@npm:1.0.3" + dependencies: + jsonc-parser: "npm:^3.2.0" + mlly: "npm:^1.2.0" + pathe: "npm:^1.1.0" + checksum: 7f692ff2005f51b8721381caf9bdbc7f5461506ba19c34f8631660a215c8de5e6dca268f23a319dd180b8f7c47a0dc6efea14b376c485ff99e98d810b8f786c4 + languageName: node + linkType: hard + +"playwright-core@npm:1.40.1": + version: 1.40.1 + resolution: "playwright-core@npm:1.40.1" + bin: + playwright-core: cli.js + checksum: 56c283012974982313a6ae583b975ee4af76d52059fb9a25d9cc616a11224685ec64682b391910c795d2b12d2ab5c7eec31124722c75c0b1703a76ac9b6fd1c2 + languageName: node + linkType: hard + +"playwright@npm:1.40.1": + version: 1.40.1 + resolution: "playwright@npm:1.40.1" + dependencies: + fsevents: "npm:2.3.2" + playwright-core: "npm:1.40.1" + dependenciesMeta: + fsevents: + optional: true + bin: + playwright: cli.js + checksum: 5dae164d1f69162da8d7eee52da651296fb885c76a8b36049f216975c751a0a826ff05795a1c0902dc0bd193fe606ae17d5def655f4cbcccb8d8b71afb74b950 + languageName: node + linkType: hard + +"pngjs@npm:^6.0.0": + version: 6.0.0 + resolution: "pngjs@npm:6.0.0" + checksum: ac23ea329b1881d1a10575aff58116dc27b894ec3f5b84ba15c7f527d21e609fbce7ba16d48f8ccb86c7ce45ceed622472765476ab2875949d4bec55e153f87a + languageName: node + linkType: hard + +"pngjs@npm:^7.0.0": + version: 7.0.0 + resolution: "pngjs@npm:7.0.0" + checksum: 0d4c7a0fd476a9c33df7d0a2a73e1d56537628a668841f6995c2bca070cf30819f9254a64363266bc14ef2fee47659dd3b4f2b18eec7ab65143015139f497b38 + languageName: node + linkType: hard + +"postcss@npm:^8.4.27, postcss@npm:^8.4.32": + version: 8.4.33 + resolution: "postcss@npm:8.4.33" + dependencies: + nanoid: "npm:^3.3.7" + picocolors: "npm:^1.0.0" + source-map-js: "npm:^1.0.2" + checksum: 16eda83458fcd8a91bece287b5920c7f57164c3ea293e6c80d0ea71ce7843007bcd8592260a5160b9a7f02693e6ac93e2495b02d8c7596d3f3f72c1447e3ba79 + languageName: node + linkType: hard + +"prelude-ls@npm:^1.2.1": + version: 1.2.1 + resolution: "prelude-ls@npm:1.2.1" + checksum: b00d617431e7886c520a6f498a2e14c75ec58f6d93ba48c3b639cf241b54232d90daa05d83a9e9b9fef6baa63cb7e1e4602c2372fea5bc169668401eb127d0cd + languageName: node + linkType: hard + +"prettier-linter-helpers@npm:^1.0.0": + version: 1.0.0 + resolution: "prettier-linter-helpers@npm:1.0.0" + dependencies: + fast-diff: "npm:^1.1.2" + checksum: 81e0027d731b7b3697ccd2129470ed9913ecb111e4ec175a12f0fcfab0096516373bf0af2fef132af50cafb0a905b74ff57996d615f59512bb9ac7378fcc64ab + languageName: node + linkType: hard + +"prettier@npm:^2.0.5": + version: 2.8.8 + resolution: "prettier@npm:2.8.8" + bin: + prettier: bin-prettier.js + checksum: 463ea8f9a0946cd5b828d8cf27bd8b567345cf02f56562d5ecde198b91f47a76b7ac9eae0facd247ace70e927143af6135e8cf411986b8cb8478784a4d6d724a + languageName: node + linkType: hard + +"pretty-format@npm:^29.5.0": + version: 29.7.0 + resolution: "pretty-format@npm:29.7.0" + dependencies: + "@jest/schemas": "npm:^29.6.3" + ansi-styles: "npm:^5.0.0" + react-is: "npm:^18.0.0" + checksum: edc5ff89f51916f036c62ed433506b55446ff739358de77207e63e88a28ca2894caac6e73dcb68166a606e51c8087d32d400473e6a9fdd2dbe743f46c9c0276f + languageName: node + linkType: hard + +"prismjs@npm:^1.16.0": + version: 1.29.0 + resolution: "prismjs@npm:1.29.0" + checksum: d906c4c4d01b446db549b4f57f72d5d7e6ccaca04ecc670fb85cea4d4b1acc1283e945a9cbc3d81819084a699b382f970e02f9d1378e14af9808d366d9ed7ec6 + languageName: node + linkType: hard + +"proc-log@npm:^3.0.0": + version: 3.0.0 + resolution: "proc-log@npm:3.0.0" + checksum: f66430e4ff947dbb996058f6fd22de2c66612ae1a89b097744e17fb18a4e8e7a86db99eda52ccf15e53f00b63f4ec0b0911581ff2aac0355b625c8eac509b0dc + languageName: node + linkType: hard + +"process-nextick-args@npm:~2.0.0": + version: 2.0.1 + resolution: "process-nextick-args@npm:2.0.1" + checksum: bec089239487833d46b59d80327a1605e1c5287eaad770a291add7f45fda1bb5e28b38e0e061add0a1d0ee0984788ce74fa394d345eed1c420cacf392c554367 + languageName: node + linkType: hard + +"promise-polyfill@npm:^8.2.0": + version: 8.3.0 + resolution: "promise-polyfill@npm:8.3.0" + checksum: 97141f07a31a6be135ec9ed53700a3423a771cabec0ba5e08fcb2bf8cfda855479ff70e444fceb938f560be42b450cd032c14f4a940ed2ad1e5b4dcb78368dce + languageName: node + linkType: hard + +"promise-retry@npm:^2.0.1": + version: 2.0.1 + resolution: "promise-retry@npm:2.0.1" + dependencies: + err-code: "npm:^2.0.2" + retry: "npm:^0.12.0" + checksum: 9c7045a1a2928094b5b9b15336dcd2a7b1c052f674550df63cc3f36cd44028e5080448175b6f6ca32b642de81150f5e7b1a98b728f15cb069f2dd60ac2616b96 + languageName: node + linkType: hard + +"prop-types@npm:15.x, prop-types@npm:^15.5.10, prop-types@npm:^15.5.7, prop-types@npm:^15.5.8, prop-types@npm:^15.6.0, prop-types@npm:^15.6.2, prop-types@npm:^15.7.2, prop-types@npm:^15.8.1": + version: 15.8.1 + resolution: "prop-types@npm:15.8.1" + dependencies: + loose-envify: "npm:^1.4.0" + object-assign: "npm:^4.1.1" + react-is: "npm:^16.13.1" + checksum: 59ece7ca2fb9838031d73a48d4becb9a7cc1ed10e610517c7d8f19a1e02fa47f7c27d557d8a5702bec3cfeccddc853579832b43f449e54635803f277b1c78077 + languageName: node + linkType: hard + +"psl@npm:^1.1.33": + version: 1.9.0 + resolution: "psl@npm:1.9.0" + checksum: 6a3f805fdab9442f44de4ba23880c4eba26b20c8e8e0830eff1cb31007f6825dace61d17203c58bfe36946842140c97a1ba7f67bc63ca2d88a7ee052b65d97ab + languageName: node + linkType: hard + +"pub-sub-es@npm:^2.0.1": + version: 2.1.1 + resolution: "pub-sub-es@npm:2.1.1" + checksum: 8f93d5bd6fe9fef3d74de6c0511e0fa12a0980582f9ef3b4ad758326a1b68b8bf2ff25ad2b1f45a1e1fbda4281fed21a9e757f2d0915c40a5d64f410c90b4c1f + languageName: node + linkType: hard + +"pubsub-js@npm:^1.9.3": + version: 1.9.4 + resolution: "pubsub-js@npm:1.9.4" + checksum: 165e724d3a1cc53fa4694b445f6512646ec49ec972eb910ac1b6cf713d982d6ed4a13dd8c511cc672d03fc5a9e8d595fd2fe721186705853ca8150f38e149e6a + languageName: node + linkType: hard + +"punycode@npm:^1.4.1": + version: 1.4.1 + resolution: "punycode@npm:1.4.1" + checksum: 354b743320518aef36f77013be6e15da4db24c2b4f62c5f1eb0529a6ed02fbaf1cb52925785f6ab85a962f2b590d9cd5ad730b70da72b5f180e2556b8bd3ca08 + languageName: node + linkType: hard + +"punycode@npm:^2.1.0, punycode@npm:^2.1.1": + version: 2.3.1 + resolution: "punycode@npm:2.3.1" + checksum: 14f76a8206bc3464f794fb2e3d3cc665ae416c01893ad7a02b23766eb07159144ee612ad67af5e84fa4479ccfe67678c4feb126b0485651b302babf66f04f9e9 + languageName: node + linkType: hard + +"q@npm:^1.5.1": + version: 1.5.1 + resolution: "q@npm:1.5.1" + checksum: 7855fbdba126cb7e92ef3a16b47ba998c0786ec7fface236e3eb0135b65df36429d91a86b1fff3ab0927b4ac4ee88a2c44527c7c3b8e2a37efbec9fe34803df4 + languageName: node + linkType: hard + +"qs@npm:^6.11.2": + version: 6.11.2 + resolution: "qs@npm:6.11.2" + dependencies: + side-channel: "npm:^1.0.4" + checksum: 4f95d4ff18ed480befcafa3390022817ffd3087fc65f146cceb40fc5edb9fa96cb31f648cae2fa96ca23818f0798bd63ad4ca369a0e22702fcd41379b3ab6571 + languageName: node + linkType: hard + +"querystringify@npm:^2.1.1": + version: 2.2.0 + resolution: "querystringify@npm:2.2.0" + checksum: 3258bc3dbdf322ff2663619afe5947c7926a6ef5fb78ad7d384602974c467fadfc8272af44f5eb8cddd0d011aae8fabf3a929a8eee4b86edcc0a21e6bd10f9aa + languageName: node + linkType: hard + +"queue-microtask@npm:^1.2.2": + version: 1.2.3 + resolution: "queue-microtask@npm:1.2.3" + checksum: 900a93d3cdae3acd7d16f642c29a642aea32c2026446151f0778c62ac089d4b8e6c986811076e1ae180a694cedf077d453a11b58ff0a865629a4f82ab558e102 + languageName: node + linkType: hard + +"quick-lru@npm:^2.0.0": + version: 2.0.0 + resolution: "quick-lru@npm:2.0.0" + checksum: 82f3b2c84eb763e69898ddd1a1ec2c88adbb405a4343f2542bfbdf4e892fff7bec7722e94deb944141f1d72170df93666382289b19afd01b3407753eab5eb631 + languageName: node + linkType: hard + +"quick-lru@npm:^4.0.0, quick-lru@npm:^4.0.1": + version: 4.0.1 + resolution: "quick-lru@npm:4.0.1" + checksum: f9b1596fa7595a35c2f9d913ac312fede13d37dc8a747a51557ab36e11ce113bbe88ef4c0154968845559a7709cb6a7e7cbe75f7972182451cd45e7f057a334d + languageName: node + linkType: hard + +"quick-lru@npm:^6.1.1": + version: 6.1.2 + resolution: "quick-lru@npm:6.1.2" + checksum: f499f07bd276eec460c4d7d2ee286c519f3bd189cbbb5ddf3eb929e2182e4997f66b951ea8d24b3f3cee8ed5ac9f0006bf40636f082acd1b38c050a4cbf07ed3 + languageName: node + linkType: hard + +"quickselect@npm:^2.0.0": + version: 2.0.0 + resolution: "quickselect@npm:2.0.0" + checksum: 6c8d591bc73beae4c1996b7b7138233a7dbbbdde29b7b6d822a02d08cd220fd27613f47d6e9635989b12e250d42ef9da3448de1ed12ad962974e207ab3c3562c + languageName: node + linkType: hard + +"raf-schd@npm:^4.0.2": + version: 4.0.3 + resolution: "raf-schd@npm:4.0.3" + checksum: ecabf0957c05fad059779bddcd992f1a9d3a35dfea439a6f0935c382fcf4f7f7fa60489e467b4c2db357a3665167d2a379782586b59712bb36c766e02824709b + languageName: node + linkType: hard + +"raf@npm:^3.4.1": + version: 3.4.1 + resolution: "raf@npm:3.4.1" + dependencies: + performance-now: "npm:^2.1.0" + checksum: 337f0853c9e6a77647b0f499beedafea5d6facfb9f2d488a624f88b03df2be72b8a0e7f9118a3ff811377d534912039a3311815700d2b6d2313f82f736f9eb6e + languageName: node + linkType: hard + +"rbush@npm:^3.0.1": + version: 3.0.1 + resolution: "rbush@npm:3.0.1" + dependencies: + quickselect: "npm:^2.0.0" + checksum: 55311586c30cdedaa2220de6f1da45fe1fa806263afbf7b6f4c0078983830c2abc7771187896d68bfc9078cb279079fb4c84971831da4b74384aab2c2c417758 + languageName: node + linkType: hard + +"react-checkbox-tree@npm:^1.7.3": + version: 1.8.0 + resolution: "react-checkbox-tree@npm:1.8.0" + dependencies: + classnames: "npm:^2.2.5" + lodash: "npm:^4.17.10" + nanoid: "npm:^3.0.0" + prop-types: "npm:^15.5.8" + peerDependencies: + react: ^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 + checksum: d6f88dacd05d9414b946a01789281cd5217952851cc887e4db55852ec1e9a63a9cd42eb07b145a5827d2819301e4c8d9c6a3f0b2187d8ba6f1f64cbe54d41b39 + languageName: node + linkType: hard + +"react-color@npm:^2.13.8": + version: 2.19.3 + resolution: "react-color@npm:2.19.3" + dependencies: + "@icons/material": "npm:^0.2.4" + lodash: "npm:^4.17.15" + lodash-es: "npm:^4.17.15" + material-colors: "npm:^1.2.1" + prop-types: "npm:^15.5.10" + reactcss: "npm:^1.2.0" + tinycolor2: "npm:^1.4.1" + peerDependencies: + react: "*" + checksum: 6f9fce9ff3014926d960abccd5d79ecb391a41f835a4b85663fd48ff933554391222f40ed8cfc5417305d47b1e480023981ec22e13c3b16b0d8d718270fa815e + languageName: node + linkType: hard + +"react-dom@npm:^18.2.0": + version: 18.2.0 + resolution: "react-dom@npm:18.2.0" + dependencies: + loose-envify: "npm:^1.1.0" + scheduler: "npm:^0.23.0" + peerDependencies: + react: ^18.2.0 + checksum: 66dfc5f93e13d0674e78ef41f92ed21dfb80f9c4ac4ac25a4b51046d41d4d2186abc915b897f69d3d0ebbffe6184e7c5876f2af26bfa956f179225d921be713a + languageName: node + linkType: hard + +"react-draggable@npm:3.x": + version: 3.3.2 + resolution: "react-draggable@npm:3.3.2" + dependencies: + classnames: "npm:^2.2.5" + prop-types: "npm:^15.6.0" + checksum: 7cc7634959bfdc1318730965b9703cdd509928ca19c8f6e591273532797f0e7d584f85baeaff680f24a6f8df87da400e4232f176e5765a028f1ada66c68f9711 + languageName: node + linkType: hard + +"react-draggable@npm:^4.0.3": + version: 4.4.6 + resolution: "react-draggable@npm:4.4.6" + dependencies: + clsx: "npm:^1.1.1" + prop-types: "npm:^15.8.1" + peerDependencies: + react: ">= 16.3.0" + react-dom: ">= 16.3.0" + checksum: 1e8cf47414a8554caa68447e5f27749bc40e1eabb4806e2dadcb39ab081d263f517d6aaec5231677e6b425603037c7e3386d1549898f9ffcc98a86cabafb2b9a + languageName: node + linkType: hard + +"react-grid-layout@npm:^0.16.6": + version: 0.16.6 + resolution: "react-grid-layout@npm:0.16.6" + dependencies: + classnames: "npm:2.x" + lodash.isequal: "npm:^4.0.0" + prop-types: "npm:15.x" + react-draggable: "npm:3.x" + react-resizable: "npm:1.x" + checksum: c39797454c1c5ec87f2a0a1f8a38bf0b975f0d648facd12db6f48d7ad135b9b7ca83a4cc46132de1368d051f0d29dbd7cef0e8d7bb6715cce5768898e45961a5 + languageName: node + linkType: hard + +"react-is@npm:^16.13.1, react-is@npm:^16.6.0, react-is@npm:^16.7.0, react-is@npm:^16.8.6": + version: 16.13.1 + resolution: "react-is@npm:16.13.1" + checksum: 33977da7a5f1a287936a0c85639fec6ca74f4f15ef1e59a6bc20338fc73dc69555381e211f7a3529b8150a1f71e4225525b41b60b52965bda53ce7d47377ada1 + languageName: node + linkType: hard + +"react-is@npm:^18.0.0": + version: 18.2.0 + resolution: "react-is@npm:18.2.0" + checksum: 6eb5e4b28028c23e2bfcf73371e72cd4162e4ac7ab445ddae2afe24e347a37d6dc22fae6e1748632cd43c6d4f9b8f86dcf26bf9275e1874f436d129952528ae0 + languageName: node + linkType: hard + +"react-markdown@npm:^5.0.3": + version: 5.0.3 + resolution: "react-markdown@npm:5.0.3" + dependencies: + "@types/mdast": "npm:^3.0.3" + "@types/unist": "npm:^2.0.3" + html-to-react: "npm:^1.3.4" + mdast-add-list-metadata: "npm:1.0.1" + prop-types: "npm:^15.7.2" + react-is: "npm:^16.8.6" + remark-parse: "npm:^9.0.0" + unified: "npm:^9.0.0" + unist-util-visit: "npm:^2.0.0" + xtend: "npm:^4.0.1" + peerDependencies: + "@types/react": ">=16" + react: ">=16" + checksum: 66e99c93e6d58d93a76b90474ce84871d1411f4d5e706aa862346c1b9ebedd1d22f96caff6f4268f9be8d343385dcdac02779f1146475ce2a29e1c88becba4e1 + languageName: node + linkType: hard + +"react-monaco-editor@npm:^0.45.0": + version: 0.45.0 + resolution: "react-monaco-editor@npm:0.45.0" + dependencies: + monaco-editor: "npm:^0.27.0" + prop-types: "npm:^15.7.2" + peerDependencies: + "@types/react": ^17.x + react: ^17.x + checksum: fe98376eb03e8e38a8d8513750b041d57f1925d3a827400b0a2a500145293b1036d4c5cb7b780eb8c27402a1a5241668a43db050d4b1ceb2901c33ceb0c84a16 + languageName: node + linkType: hard + +"react-refresh@npm:^0.14.0": + version: 0.14.0 + resolution: "react-refresh@npm:0.14.0" + checksum: b8ae07ad153357d77830928a7f1fc2df837aabefee907fa273ba04c7643f3b860e986f1d4b7ada9b721c8d79b8c24b5b911a314a1a2398b105f1b13d19ea2b8d + languageName: node + linkType: hard + +"react-resizable@npm:1.x": + version: 1.11.1 + resolution: "react-resizable@npm:1.11.1" + dependencies: + prop-types: "npm:15.x" + react-draggable: "npm:^4.0.3" + peerDependencies: + react: 0.14.x || 15.x || 16.x || 17.x + react-dom: 0.14.x || 15.x || 16.x || 17.x + checksum: a78c3d667bbc7b4fc5245f92f34a305b8257f554dd739c5485b834dd90cd883f123b776916043cca1b317ee79a920872d0f95ad582fe58adc069a578fe44f0ed + languageName: node + linkType: hard + +"react-resize-detector@npm:^4.2.3": + version: 4.2.3 + resolution: "react-resize-detector@npm:4.2.3" + dependencies: + lodash: "npm:^4.17.15" + lodash-es: "npm:^4.17.15" + prop-types: "npm:^15.7.2" + raf-schd: "npm:^4.0.2" + resize-observer-polyfill: "npm:^1.5.1" + peerDependencies: + react: ^16.0.0 + react-dom: ^16.0.0 + checksum: 613f2d57261ed5aac52a2a178fec9b2086a3f42ef77751933cb0793686447b65736338a20ef8c1c80428e0f361d28682bb2188b717891f4ae41cc848c2c6f2a5 + languageName: node + linkType: hard + +"react-router-dom@npm:^5.2.0": + version: 5.3.4 + resolution: "react-router-dom@npm:5.3.4" + dependencies: + "@babel/runtime": "npm:^7.12.13" + history: "npm:^4.9.0" + loose-envify: "npm:^1.3.1" + prop-types: "npm:^15.6.2" + react-router: "npm:5.3.4" + tiny-invariant: "npm:^1.0.2" + tiny-warning: "npm:^1.0.0" + peerDependencies: + react: ">=15" + checksum: f04f727e2ed2e9d1d3830af02cc61690ff67b1524c0d18690582bfba0f4d14142ccc88fb6da6befad644fddf086f5ae4c2eb7048c67da8a0b0929c19426421b0 + languageName: node + linkType: hard + +"react-router@npm:5.3.4": + version: 5.3.4 + resolution: "react-router@npm:5.3.4" + dependencies: + "@babel/runtime": "npm:^7.12.13" + history: "npm:^4.9.0" + hoist-non-react-statics: "npm:^3.1.0" + loose-envify: "npm:^1.3.1" + path-to-regexp: "npm:^1.7.0" + prop-types: "npm:^15.6.2" + react-is: "npm:^16.6.0" + tiny-invariant: "npm:^1.0.2" + tiny-warning: "npm:^1.0.0" + peerDependencies: + react: ">=15" + checksum: e15c00dfef199249b4c6e6d98e5e76cc352ce66f3270f13df37cc069ddf7c05e43281e8c308fc407e4435d72924373baef1d2890e0f6b0b1eb423cf47315a053 + languageName: node + linkType: hard + +"react-simple-code-editor@npm:^0.9.10": + version: 0.9.15 + resolution: "react-simple-code-editor@npm:0.9.15" + peerDependencies: + react: ^16.0.0 + react-dom: ^16.0.0 + checksum: 2c19deb3f659eec0b444c1a36e252c220064d6c6a16ad178faa2d51cab973b9615a82fc93b03f78399007ca8c6faab17bcd8f3c9085a037196455c4aebce700d + languageName: node + linkType: hard + +"react-sortable-hoc@npm:^1.10.1": + version: 1.11.0 + resolution: "react-sortable-hoc@npm:1.11.0" + dependencies: + "@babel/runtime": "npm:^7.2.0" + invariant: "npm:^2.2.4" + prop-types: "npm:^15.5.7" + peerDependencies: + prop-types: ^15.5.7 + react: ^0.14.0 || ^15.0.0 || ^16.0.0 + react-dom: ^0.14.0 || ^15.0.0 || ^16.0.0 + checksum: d226693ba7b24e86be81c639fd489ccb461e7f3b625faa991f67b68e72bb9349bae57f2135c158691afe08c7459b5183a65a8fff709eb32f2b18c68d00caf522 + languageName: node + linkType: hard + +"react@npm:^18.2.0": + version: 18.2.0 + resolution: "react@npm:18.2.0" + dependencies: + loose-envify: "npm:^1.1.0" + checksum: b562d9b569b0cb315e44b48099f7712283d93df36b19a39a67c254c6686479d3980b7f013dc931f4a5a3ae7645eae6386b4aa5eea933baa54ecd0f9acb0902b8 + languageName: node + linkType: hard + +"reactcss@npm:^1.2.0, reactcss@npm:^1.2.3": + version: 1.2.3 + resolution: "reactcss@npm:1.2.3" + dependencies: + lodash: "npm:^4.0.1" + checksum: a3aceb0fbfd58312f0c7fadbe92920e6536ec24d17ebee44fd4a14dd831d413fff5c2df0e85579b440667935e57a06876325cbd1368d3131824a8c2ec43b7978 + languageName: node + linkType: hard + +"read-pkg-up@npm:^3.0.0": + version: 3.0.0 + resolution: "read-pkg-up@npm:3.0.0" + dependencies: + find-up: "npm:^2.0.0" + read-pkg: "npm:^3.0.0" + checksum: 2cd0a180260b0d235990e6e9c8c2330a03882d36bc2eba8930e437ef23ee52a68a894e7e1ccb1c33f03bcceb270a861ee5f7eac686f238857755e2cddfb48ffd + languageName: node + linkType: hard + +"read-pkg-up@npm:^7.0.1": + version: 7.0.1 + resolution: "read-pkg-up@npm:7.0.1" + dependencies: + find-up: "npm:^4.1.0" + read-pkg: "npm:^5.2.0" + type-fest: "npm:^0.8.1" + checksum: 82b3ac9fd7c6ca1bdc1d7253eb1091a98ff3d195ee0a45386582ce3e69f90266163c34121e6a0a02f1630073a6c0585f7880b3865efcae9c452fa667f02ca385 + languageName: node + linkType: hard + +"read-pkg@npm:^3.0.0": + version: 3.0.0 + resolution: "read-pkg@npm:3.0.0" + dependencies: + load-json-file: "npm:^4.0.0" + normalize-package-data: "npm:^2.3.2" + path-type: "npm:^3.0.0" + checksum: 65acf2df89fbcd506b48b7ced56a255ba00adf7ecaa2db759c86cc58212f6fd80f1f0b7a85c848551a5d0685232e9b64f45c1fd5b48d85df2761a160767eeb93 + languageName: node + linkType: hard + +"read-pkg@npm:^5.2.0": + version: 5.2.0 + resolution: "read-pkg@npm:5.2.0" + dependencies: + "@types/normalize-package-data": "npm:^2.4.0" + normalize-package-data: "npm:^2.5.0" + parse-json: "npm:^5.0.0" + type-fest: "npm:^0.6.0" + checksum: b51a17d4b51418e777029e3a7694c9bd6c578a5ab99db544764a0b0f2c7c0f58f8a6bc101f86a6fceb8ba6d237d67c89acf6170f6b98695d0420ddc86cf109fb + languageName: node + linkType: hard + +"readable-stream@npm:3, readable-stream@npm:^3.0.0, readable-stream@npm:^3.5.0": + version: 3.6.2 + resolution: "readable-stream@npm:3.6.2" + dependencies: + inherits: "npm:^2.0.3" + string_decoder: "npm:^1.1.1" + util-deprecate: "npm:^1.0.1" + checksum: e37be5c79c376fdd088a45fa31ea2e423e5d48854be7a22a58869b4e84d25047b193f6acb54f1012331e1bcd667ffb569c01b99d36b0bd59658fb33f513511b7 + languageName: node + linkType: hard + +"readable-stream@npm:~2.3.6": + version: 2.3.8 + resolution: "readable-stream@npm:2.3.8" + dependencies: + core-util-is: "npm:~1.0.0" + inherits: "npm:~2.0.3" + isarray: "npm:~1.0.0" + process-nextick-args: "npm:~2.0.0" + safe-buffer: "npm:~5.1.1" + string_decoder: "npm:~1.1.1" + util-deprecate: "npm:~1.0.1" + checksum: 7efdb01f3853bc35ac62ea25493567bf588773213f5f4a79f9c365e1ad13bab845ac0dae7bc946270dc40c3929483228415e92a3fc600cc7e4548992f41ee3fa + languageName: node + linkType: hard + +"redent@npm:^3.0.0": + version: 3.0.0 + resolution: "redent@npm:3.0.0" + dependencies: + indent-string: "npm:^4.0.0" + strip-indent: "npm:^3.0.0" + checksum: d64a6b5c0b50eb3ddce3ab770f866658a2b9998c678f797919ceb1b586bab9259b311407280bd80b804e2a7c7539b19238ae6a2a20c843f1a7fcff21d48c2eae + languageName: node + linkType: hard + +"reflect.getprototypeof@npm:^1.0.4": + version: 1.0.4 + resolution: "reflect.getprototypeof@npm:1.0.4" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + get-intrinsic: "npm:^1.2.1" + globalthis: "npm:^1.0.3" + which-builtin-type: "npm:^1.1.3" + checksum: 02104cdd22658b637efe6b1df73658edab539268347327c8250a72d0cb273dcdf280c284e2d94155d22601d022d16be1a816a8616d679e447cbcbde9860d15cb + languageName: node + linkType: hard + +"regenerator-runtime@npm:^0.13.7": + version: 0.13.11 + resolution: "regenerator-runtime@npm:0.13.11" + checksum: 12b069dc774001fbb0014f6a28f11c09ebfe3c0d984d88c9bced77fdb6fedbacbca434d24da9ae9371bfbf23f754869307fb51a4c98a8b8b18e5ef748677ca24 + languageName: node + linkType: hard + +"regenerator-runtime@npm:^0.14.0": + version: 0.14.1 + resolution: "regenerator-runtime@npm:0.14.1" + checksum: 1b16eb2c4bceb1665c89de70dcb64126a22bc8eb958feef3cd68fe11ac6d2a4899b5cd1b80b0774c7c03591dc57d16631a7f69d2daa2ec98100e2f29f7ec4cc4 + languageName: node + linkType: hard + +"regexp.prototype.flags@npm:^1.5.0, regexp.prototype.flags@npm:^1.5.1": + version: 1.5.1 + resolution: "regexp.prototype.flags@npm:1.5.1" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + set-function-name: "npm:^2.0.0" + checksum: 1de7d214c0a726c7c874a7023e47b0e27b9f7fdb64175bfe1861189de1704aaeca05c3d26c35aa375432289b99946f3cf86651a92a8f7601b90d8c226a23bcd8 + languageName: node + linkType: hard + +"remark-gfm@npm:^1.0.0": + version: 1.0.0 + resolution: "remark-gfm@npm:1.0.0" + dependencies: + mdast-util-gfm: "npm:^0.1.0" + micromark-extension-gfm: "npm:^0.3.0" + checksum: 929a2328b1a0c63c38cc1678a41089f75f594fb928c02bfcfe967702377ede245fec0ed45a258fe0af421dda547439911260b8621b2ea6819eaa5f6b47d2bb4c + languageName: node + linkType: hard + +"remark-parse@npm:^9.0.0": + version: 9.0.0 + resolution: "remark-parse@npm:9.0.0" + dependencies: + mdast-util-from-markdown: "npm:^0.8.0" + checksum: 7523b2a2e3c7a80f7530b4d5615e8862890abe321cdc4f6f7b103c70ceb4b3eca14cc71127149f05d5e29ed521b0c7505af9f11b1293921cf7cdf6d794104a21 + languageName: node + linkType: hard + +"repeat-string@npm:^1.0.0": + version: 1.6.1 + resolution: "repeat-string@npm:1.6.1" + checksum: 87fa21bfdb2fbdedc44b9a5b118b7c1239bdd2c2c1e42742ef9119b7d412a5137a1d23f1a83dc6bb686f4f27429ac6f542e3d923090b44181bafa41e8ac0174d + languageName: node + linkType: hard + +"require-directory@npm:^2.1.1": + version: 2.1.1 + resolution: "require-directory@npm:2.1.1" + checksum: 83aa76a7bc1531f68d92c75a2ca2f54f1b01463cb566cf3fbc787d0de8be30c9dbc211d1d46be3497dac5785fe296f2dd11d531945ac29730643357978966e99 + languageName: node + linkType: hard + +"requires-port@npm:^1.0.0": + version: 1.0.0 + resolution: "requires-port@npm:1.0.0" + checksum: b2bfdd09db16c082c4326e573a82c0771daaf7b53b9ce8ad60ea46aa6e30aaf475fe9b164800b89f93b748d2c234d8abff945d2551ba47bf5698e04cd7713267 + languageName: node + linkType: hard + +"resize-observer-polyfill@npm:^1.5.1": + version: 1.5.1 + resolution: "resize-observer-polyfill@npm:1.5.1" + checksum: 5e882475067f0b97dc07e0f37c3e335ac5bc3520d463f777cec7e894bb273eddbfecb857ae668e6fb6881fd6f6bb7148246967172139302da50fa12ea3a15d95 + languageName: node + linkType: hard + +"resolve-from@npm:^4.0.0": + version: 4.0.0 + resolution: "resolve-from@npm:4.0.0" + checksum: 8408eec31a3112ef96e3746c37be7d64020cda07c03a920f5024e77290a218ea758b26ca9529fd7b1ad283947f34b2291c1c0f6aa0ed34acfdda9c6014c8d190 + languageName: node + linkType: hard + +"resolve-pathname@npm:^3.0.0": + version: 3.0.0 + resolution: "resolve-pathname@npm:3.0.0" + checksum: c6ec49b670dc35b9a303c47fa83ba9348a71e92d64a4c4bb85e1b659a29b407aa1ac1cb14a9b5b502982132ca77482bd80534bca147439d66880d35a137fe723 + languageName: node + linkType: hard + +"resolve@npm:^1.10.0": + version: 1.22.8 + resolution: "resolve@npm:1.22.8" + dependencies: + is-core-module: "npm:^2.13.0" + path-parse: "npm:^1.0.7" + supports-preserve-symlinks-flag: "npm:^1.0.0" + bin: + resolve: bin/resolve + checksum: 07e179f4375e1fd072cfb72ad66d78547f86e6196c4014b31cb0b8bb1db5f7ca871f922d08da0fbc05b94e9fd42206f819648fa3b5b873ebbc8e1dc68fec433a + languageName: node + linkType: hard + +"resolve@npm:^2.0.0-next.4": + version: 2.0.0-next.5 + resolution: "resolve@npm:2.0.0-next.5" + dependencies: + is-core-module: "npm:^2.13.0" + path-parse: "npm:^1.0.7" + supports-preserve-symlinks-flag: "npm:^1.0.0" + bin: + resolve: bin/resolve + checksum: a6c33555e3482ea2ec4c6e3d3bf0d78128abf69dca99ae468e64f1e30acaa318fd267fb66c8836b04d558d3e2d6ed875fe388067e7d8e0de647d3c21af21c43a + languageName: node + linkType: hard + +"resolve@patch:resolve@npm%3A^1.10.0#optional!builtin": + version: 1.22.8 + resolution: "resolve@patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d" + dependencies: + is-core-module: "npm:^2.13.0" + path-parse: "npm:^1.0.7" + supports-preserve-symlinks-flag: "npm:^1.0.0" + bin: + resolve: bin/resolve + checksum: 0446f024439cd2e50c6c8fa8ba77eaa8370b4180f401a96abf3d1ebc770ac51c1955e12764cde449fde3fff480a61f84388e3505ecdbab778f4bef5f8212c729 + languageName: node + linkType: hard + +"resolve@patch:resolve@npm%3A^2.0.0-next.4#optional!builtin": + version: 2.0.0-next.5 + resolution: "resolve@patch:resolve@npm%3A2.0.0-next.5#optional!builtin::version=2.0.0-next.5&hash=c3c19d" + dependencies: + is-core-module: "npm:^2.13.0" + path-parse: "npm:^1.0.7" + supports-preserve-symlinks-flag: "npm:^1.0.0" + bin: + resolve: bin/resolve + checksum: 78ad6edb8309a2bfb720c2c1898f7907a37f858866ce11a5974643af1203a6a6e05b2fa9c53d8064a673a447b83d42569260c306d43628bff5bb101969708355 + languageName: node + linkType: hard + +"retry@npm:^0.12.0": + version: 0.12.0 + resolution: "retry@npm:0.12.0" + checksum: 59933e8501727ba13ad73ef4a04d5280b3717fd650408460c987392efe9d7be2040778ed8ebe933c5cbd63da3dcc37919c141ef8af0a54a6e4fca5a2af177bfe + languageName: node + linkType: hard + +"reusify@npm:^1.0.4": + version: 1.0.4 + resolution: "reusify@npm:1.0.4" + checksum: c19ef26e4e188f408922c46f7ff480d38e8dfc55d448310dfb518736b23ed2c4f547fb64a6ed5bdba92cd7e7ddc889d36ff78f794816d5e71498d645ef476107 + languageName: node + linkType: hard + +"rgbcolor@npm:^1.0.1": + version: 1.0.1 + resolution: "rgbcolor@npm:1.0.1" + checksum: 13af06c523351bac2854b85a22d1dfafd9310efd898e9bd96c8706f9aa09a3ddc8392ab00ae03d12950782164a97677f21834ffd84ffebf76ae106add319f956 + languageName: node + linkType: hard + +"rimraf@npm:^3.0.2": + version: 3.0.2 + resolution: "rimraf@npm:3.0.2" + dependencies: + glob: "npm:^7.1.3" + bin: + rimraf: bin.js + checksum: 9cb7757acb489bd83757ba1a274ab545eafd75598a9d817e0c3f8b164238dd90eba50d6b848bd4dcc5f3040912e882dc7ba71653e35af660d77b25c381d402e8 + languageName: node + linkType: hard + +"rimraf@npm:~5.0.5": + version: 5.0.5 + resolution: "rimraf@npm:5.0.5" + dependencies: + glob: "npm:^10.3.7" + bin: + rimraf: dist/esm/bin.mjs + checksum: d50dbe724f33835decd88395b25ed35995077c60a50ae78ded06e0185418914e555817aad1b4243edbff2254548c2f6ad6f70cc850040bebb4da9e8cc016f586 + languageName: node + linkType: hard + +"robust-orientation@npm:^1.0.2": + version: 1.2.1 + resolution: "robust-orientation@npm:1.2.1" + dependencies: + robust-scale: "npm:^1.0.2" + robust-subtract: "npm:^1.0.0" + robust-sum: "npm:^1.0.0" + two-product: "npm:^1.0.2" + checksum: 9c6cd48185ba2b3de633271ffd1e5ef6cd94cfd3b5e66a6a29327a0223b6f67c660bcf3677d9f91aecf15e16d4db231d361c35830de245c3a440a406b7335422 + languageName: node + linkType: hard + +"robust-point-in-polygon@npm:^1.0.3": + version: 1.0.3 + resolution: "robust-point-in-polygon@npm:1.0.3" + dependencies: + robust-orientation: "npm:^1.0.2" + checksum: dd665e7f7908d12e71f4c4e7e5947faf7d4f892bd83c501d1794ebd710df3652203f586f4a3becac09c5da0419bc659bd69e5d9e577c4998ddceb260582e5b38 + languageName: node + linkType: hard + +"robust-scale@npm:^1.0.2": + version: 1.0.2 + resolution: "robust-scale@npm:1.0.2" + dependencies: + two-product: "npm:^1.0.2" + two-sum: "npm:^1.0.0" + checksum: 18d047f3833793a96b3959633c34ca307a678e5fd68bb1d6b1fdaea5c039340b95b8cfa6a9cd64840a29ae856f927958341deb71870b5fdf4f22768f3de98988 + languageName: node + linkType: hard + +"robust-subtract@npm:^1.0.0": + version: 1.0.0 + resolution: "robust-subtract@npm:1.0.0" + checksum: dc96643abaa0b26b0c0468449f91c7178e835cd913ee0ad8a4f6b5025ebea832ccd0084aa86d82d2b36f2f550f68069289b5775f2ef52d5e383777c58bb28509 + languageName: node + linkType: hard + +"robust-sum@npm:^1.0.0": + version: 1.0.0 + resolution: "robust-sum@npm:1.0.0" + checksum: ca0273b895f275a7c404bb05ef873b99f030bcc6c26fe8232cfeec33fc7ef2c1d0192ee20d5a7d41e1cfa3b211b854db24b6222f53949301d60a5ea827c6c24a + languageName: node + linkType: hard + +"rollup@npm:^3.27.1": + version: 3.29.4 + resolution: "rollup@npm:3.29.4" + dependencies: + fsevents: "npm:~2.3.2" + dependenciesMeta: + fsevents: + optional: true + bin: + rollup: dist/bin/rollup + checksum: 65eddf84bf389ea8e4d4c1614b1c6a298d08f8ae785c0c087e723a879190c8aaddbab4aa3b8a0524551b9036750c9f8bfea27b377798accfd2ba5084ceff5aaa + languageName: node + linkType: hard + +"rollup@npm:^4.2.0": + version: 4.9.4 + resolution: "rollup@npm:4.9.4" + dependencies: + "@rollup/rollup-android-arm-eabi": "npm:4.9.4" + "@rollup/rollup-android-arm64": "npm:4.9.4" + "@rollup/rollup-darwin-arm64": "npm:4.9.4" + "@rollup/rollup-darwin-x64": "npm:4.9.4" + "@rollup/rollup-linux-arm-gnueabihf": "npm:4.9.4" + "@rollup/rollup-linux-arm64-gnu": "npm:4.9.4" + "@rollup/rollup-linux-arm64-musl": "npm:4.9.4" + "@rollup/rollup-linux-riscv64-gnu": "npm:4.9.4" + "@rollup/rollup-linux-x64-gnu": "npm:4.9.4" + "@rollup/rollup-linux-x64-musl": "npm:4.9.4" + "@rollup/rollup-win32-arm64-msvc": "npm:4.9.4" + "@rollup/rollup-win32-ia32-msvc": "npm:4.9.4" + "@rollup/rollup-win32-x64-msvc": "npm:4.9.4" + "@types/estree": "npm:1.0.5" + fsevents: "npm:~2.3.2" + dependenciesMeta: + "@rollup/rollup-android-arm-eabi": + optional: true + "@rollup/rollup-android-arm64": + optional: true + "@rollup/rollup-darwin-arm64": + optional: true + "@rollup/rollup-darwin-x64": + optional: true + "@rollup/rollup-linux-arm-gnueabihf": + optional: true + "@rollup/rollup-linux-arm64-gnu": + optional: true + "@rollup/rollup-linux-arm64-musl": + optional: true + "@rollup/rollup-linux-riscv64-gnu": + optional: true + "@rollup/rollup-linux-x64-gnu": + optional: true + "@rollup/rollup-linux-x64-musl": + optional: true + "@rollup/rollup-win32-arm64-msvc": + optional: true + "@rollup/rollup-win32-ia32-msvc": + optional: true + "@rollup/rollup-win32-x64-msvc": + optional: true + fsevents: + optional: true + bin: + rollup: dist/bin/rollup + checksum: 3a494f2d922bf8e03c4110f6582233e31a0ff584b2bab472f8718e7a81dd875ba0d813d6d3bb0532f68a8521aacd804fe0bc7607eeeae3ec62ce4f468cdf092d + languageName: node + linkType: hard + +"run-parallel@npm:^1.1.9": + version: 1.2.0 + resolution: "run-parallel@npm:1.2.0" + dependencies: + queue-microtask: "npm:^1.2.2" + checksum: 200b5ab25b5b8b7113f9901bfe3afc347e19bb7475b267d55ad0eb86a62a46d77510cb0f232507c9e5d497ebda569a08a9867d0d14f57a82ad5564d991588b39 + languageName: node + linkType: hard + +"rw@npm:1": + version: 1.3.3 + resolution: "rw@npm:1.3.3" + checksum: b1e1ef37d1e79d9dc7050787866e30b6ddcb2625149276045c262c6b4d53075ddc35f387a856a8e76f0d0df59f4cd58fe24707e40797ebee66e542b840ed6a53 + languageName: node + linkType: hard + +"rxjs@npm:^7.8.0": + version: 7.8.1 + resolution: "rxjs@npm:7.8.1" + dependencies: + tslib: "npm:^2.1.0" + checksum: 3c49c1ecd66170b175c9cacf5cef67f8914dcbc7cd0162855538d365c83fea631167cacb644b3ce533b2ea0e9a4d0b12175186985f89d75abe73dbd8f7f06f68 + languageName: node + linkType: hard + +"safe-array-concat@npm:^1.0.1": + version: 1.0.1 + resolution: "safe-array-concat@npm:1.0.1" + dependencies: + call-bind: "npm:^1.0.2" + get-intrinsic: "npm:^1.2.1" + has-symbols: "npm:^1.0.3" + isarray: "npm:^2.0.5" + checksum: 4b15ce5fce5ce4d7e744a63592cded88d2f27806ed229eadb2e42629cbcd40e770f7478608e75f455e7fe341acd8c0a01bdcd7146b10645ea7411c5e3c1d1dd8 + languageName: node + linkType: hard + +"safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1": + version: 5.1.2 + resolution: "safe-buffer@npm:5.1.2" + checksum: 780ba6b5d99cc9a40f7b951d47152297d0e260f0df01472a1b99d4889679a4b94a13d644f7dbc4f022572f09ae9005fa2fbb93bbbd83643316f365a3e9a45b21 + languageName: node + linkType: hard + +"safe-buffer@npm:~5.2.0": + version: 5.2.1 + resolution: "safe-buffer@npm:5.2.1" + checksum: 6501914237c0a86e9675d4e51d89ca3c21ffd6a31642efeba25ad65720bce6921c9e7e974e5be91a786b25aa058b5303285d3c15dbabf983a919f5f630d349f3 + languageName: node + linkType: hard + +"safe-regex-test@npm:^1.0.0": + version: 1.0.0 + resolution: "safe-regex-test@npm:1.0.0" + dependencies: + call-bind: "npm:^1.0.2" + get-intrinsic: "npm:^1.1.3" + is-regex: "npm:^1.1.4" + checksum: 14a81a7e683f97b2d6e9c8be61fddcf8ed7a02f4e64a825515f96bb1738eb007145359313741d2704d28b55b703a0f6300c749dde7c1dbc13952a2b85048ede2 + languageName: node + linkType: hard + +"safe-stable-stringify@npm:^2.4.3": + version: 2.4.3 + resolution: "safe-stable-stringify@npm:2.4.3" + checksum: 81dede06b8f2ae794efd868b1e281e3c9000e57b39801c6c162267eb9efda17bd7a9eafa7379e1f1cacd528d4ced7c80d7460ad26f62ada7c9e01dec61b2e768 + languageName: node + linkType: hard + +"safer-buffer@npm:>= 2.1.2 < 3, safer-buffer@npm:>= 2.1.2 < 3.0.0": + version: 2.1.2 + resolution: "safer-buffer@npm:2.1.2" + checksum: 7e3c8b2e88a1841c9671094bbaeebd94448111dd90a81a1f606f3f67708a6ec57763b3b47f06da09fc6054193e0e6709e77325415dc8422b04497a8070fa02d4 + languageName: node + linkType: hard + +"saxes@npm:^5.0.1": + version: 5.0.1 + resolution: "saxes@npm:5.0.1" + dependencies: + xmlchars: "npm:^2.2.0" + checksum: b7476c41dbe1c3a89907d2546fecfba234de5e66743ef914cde2603f47b19bed09732ab51b528ad0f98b958369d8be72b6f5af5c9cfad69972a73d061f0b3952 + languageName: node + linkType: hard + +"scheduler@npm:^0.23.0": + version: 0.23.0 + resolution: "scheduler@npm:0.23.0" + dependencies: + loose-envify: "npm:^1.1.0" + checksum: b777f7ca0115e6d93e126ac490dbd82642d14983b3079f58f35519d992fa46260be7d6e6cede433a92db70306310c6f5f06e144f0e40c484199e09c1f7be53dd + languageName: node + linkType: hard + +"semver@npm:2 || 3 || 4 || 5, semver@npm:^5.5.0": + version: 5.7.2 + resolution: "semver@npm:5.7.2" + bin: + semver: bin/semver + checksum: e4cf10f86f168db772ae95d86ba65b3fd6c5967c94d97c708ccb463b778c2ee53b914cd7167620950fc07faf5a564e6efe903836639e512a1aa15fbc9667fa25 + languageName: node + linkType: hard + +"semver@npm:^6.0.0, semver@npm:^6.3.1": + version: 6.3.1 + resolution: "semver@npm:6.3.1" + bin: + semver: bin/semver.js + checksum: e3d79b609071caa78bcb6ce2ad81c7966a46a7431d9d58b8800cfa9cb6a63699b3899a0e4bcce36167a284578212d9ae6942b6929ba4aa5015c079a67751d42d + languageName: node + linkType: hard + +"semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.5.3": + version: 7.5.4 + resolution: "semver@npm:7.5.4" + dependencies: + lru-cache: "npm:^6.0.0" + bin: + semver: bin/semver.js + checksum: 5160b06975a38b11c1ab55950cb5b8a23db78df88275d3d8a42ccf1f29e55112ac995b3a26a522c36e3b5f76b0445f1eef70d696b8c7862a2b4303d7b0e7609e + languageName: node + linkType: hard + +"set-function-length@npm:^1.1.1": + version: 1.1.1 + resolution: "set-function-length@npm:1.1.1" + dependencies: + define-data-property: "npm:^1.1.1" + get-intrinsic: "npm:^1.2.1" + gopd: "npm:^1.0.1" + has-property-descriptors: "npm:^1.0.0" + checksum: a29e255c116c29e3323b851c4f46c58c91be9bb8b065f191e2ea1807cb2c839df56e3175732a498e0c6d54626ba6b6fef896bf699feb7ab70c42dc47eb247c95 + languageName: node + linkType: hard + +"set-function-name@npm:^2.0.0, set-function-name@npm:^2.0.1": + version: 2.0.1 + resolution: "set-function-name@npm:2.0.1" + dependencies: + define-data-property: "npm:^1.0.1" + functions-have-names: "npm:^1.2.3" + has-property-descriptors: "npm:^1.0.0" + checksum: 6be7d3e15be47f4db8a5a563a35c60b5e7c4af91cc900e8972ffad33d3aaa227900faa55f60121cdb04b85866a734bb7fe4cd91f654c632861cc86121a48312a + languageName: node + linkType: hard + +"shebang-command@npm:^1.2.0": + version: 1.2.0 + resolution: "shebang-command@npm:1.2.0" + dependencies: + shebang-regex: "npm:^1.0.0" + checksum: 7b20dbf04112c456b7fc258622dafd566553184ac9b6938dd30b943b065b21dabd3776460df534cc02480db5e1b6aec44700d985153a3da46e7db7f9bd21326d + languageName: node + linkType: hard + +"shebang-command@npm:^2.0.0": + version: 2.0.0 + resolution: "shebang-command@npm:2.0.0" + dependencies: + shebang-regex: "npm:^3.0.0" + checksum: a41692e7d89a553ef21d324a5cceb5f686d1f3c040759c50aab69688634688c5c327f26f3ecf7001ebfd78c01f3c7c0a11a7c8bfd0a8bc9f6240d4f40b224e4e + languageName: node + linkType: hard + +"shebang-regex@npm:^1.0.0": + version: 1.0.0 + resolution: "shebang-regex@npm:1.0.0" + checksum: 9abc45dee35f554ae9453098a13fdc2f1730e525a5eb33c51f096cc31f6f10a4b38074c1ebf354ae7bffa7229506083844008dfc3bb7818228568c0b2dc1fff2 + languageName: node + linkType: hard + +"shebang-regex@npm:^3.0.0": + version: 3.0.0 + resolution: "shebang-regex@npm:3.0.0" + checksum: 1dbed0726dd0e1152a92696c76c7f06084eb32a90f0528d11acd764043aacf76994b2fb30aa1291a21bd019d6699164d048286309a278855ee7bec06cf6fb690 + languageName: node + linkType: hard + +"shell-quote@npm:^1.6.1": + version: 1.8.1 + resolution: "shell-quote@npm:1.8.1" + checksum: 8cec6fd827bad74d0a49347057d40dfea1e01f12a6123bf82c4649f3ef152fc2bc6d6176e6376bffcd205d9d0ccb4f1f9acae889384d20baff92186f01ea455a + languageName: node + linkType: hard + +"side-channel@npm:^1.0.4": + version: 1.0.4 + resolution: "side-channel@npm:1.0.4" + dependencies: + call-bind: "npm:^1.0.0" + get-intrinsic: "npm:^1.0.2" + object-inspect: "npm:^1.9.0" + checksum: 054a5d23ee35054b2c4609b9fd2a0587760737782b5d765a9c7852264710cc39c6dcb56a9bbd6c12cd84071648aea3edb2359d2f6e560677eedadce511ac1da5 + languageName: node + linkType: hard + +"siginfo@npm:^2.0.0": + version: 2.0.0 + resolution: "siginfo@npm:2.0.0" + checksum: 3def8f8e516fbb34cb6ae415b07ccc5d9c018d85b4b8611e3dc6f8be6d1899f693a4382913c9ed51a06babb5201639d76453ab297d1c54a456544acf5c892e34 + languageName: node + linkType: hard + +"signal-exit@npm:^3.0.2": + version: 3.0.7 + resolution: "signal-exit@npm:3.0.7" + checksum: 25d272fa73e146048565e08f3309d5b942c1979a6f4a58a8c59d5fa299728e9c2fcd1a759ec870863b1fd38653670240cd420dad2ad9330c71f36608a6a1c912 + languageName: node + linkType: hard + +"signal-exit@npm:^4.0.1": + version: 4.1.0 + resolution: "signal-exit@npm:4.1.0" + checksum: 41602dce540e46d599edba9d9860193398d135f7ff72cab629db5171516cfae628d21e7bfccde1bbfdf11c48726bc2a6d1a8fb8701125852fbfda7cf19c6aa83 + languageName: node + linkType: hard + +"slash@npm:^3.0.0": + version: 3.0.0 + resolution: "slash@npm:3.0.0" + checksum: e18488c6a42bdfd4ac5be85b2ced3ccd0224773baae6ad42cfbb9ec74fc07f9fa8396bd35ee638084ead7a2a0818eb5e7151111544d4731ce843019dab4be47b + languageName: node + linkType: hard + +"slugid@npm:^3.0.0": + version: 3.2.0 + resolution: "slugid@npm:3.2.0" + dependencies: + uuid: "npm:^8.3.2" + checksum: 503cd270dd32ccd7db157c8569ec1bdb18f3c5e9e00d471bf15bf53838ff12c831564cfbc1f24b2ee4706dcecfc1fed26b1f6f5b002891186624c6522ff0189a + languageName: node + linkType: hard + +"smart-buffer@npm:^4.2.0": + version: 4.2.0 + resolution: "smart-buffer@npm:4.2.0" + checksum: a16775323e1404dd43fabafe7460be13a471e021637bc7889468eb45ce6a6b207261f454e4e530a19500cc962c4cc5348583520843b363f4193cee5c00e1e539 + languageName: node + linkType: hard + +"socks-proxy-agent@npm:^8.0.1": + version: 8.0.2 + resolution: "socks-proxy-agent@npm:8.0.2" + dependencies: + agent-base: "npm:^7.0.2" + debug: "npm:^4.3.4" + socks: "npm:^2.7.1" + checksum: a842402fc9b8848a31367f2811ca3cd14c4106588b39a0901cd7a69029998adfc6456b0203617c18ed090542ad0c24ee4e9d4c75a0c4b75071e214227c177eb7 + languageName: node + linkType: hard + +"socks@npm:^2.7.1": + version: 2.7.1 + resolution: "socks@npm:2.7.1" + dependencies: + ip: "npm:^2.0.0" + smart-buffer: "npm:^4.2.0" + checksum: 43f69dbc9f34fc8220bc51c6eea1c39715ab3cfdb115d6e3285f6c7d1a603c5c75655668a5bbc11e3c7e2c99d60321fb8d7ab6f38cda6a215fadd0d6d0b52130 + languageName: node + linkType: hard + +"source-map-js@npm:^1.0.2": + version: 1.0.2 + resolution: "source-map-js@npm:1.0.2" + checksum: 32f2dfd1e9b7168f9a9715eb1b4e21905850f3b50cf02cf476e47e4eebe8e6b762b63a64357896aa29b37e24922b4282df0f492e0d2ace572b43d15525976ff8 + languageName: node + linkType: hard + +"source-map@npm:^0.6.1, source-map@npm:~0.6.1": + version: 0.6.1 + resolution: "source-map@npm:0.6.1" + checksum: ab55398007c5e5532957cb0beee2368529618ac0ab372d789806f5718123cc4367d57de3904b4e6a4170eb5a0b0f41373066d02ca0735a0c4d75c7d328d3e011 + languageName: node + linkType: hard + +"spdx-correct@npm:^3.0.0": + version: 3.2.0 + resolution: "spdx-correct@npm:3.2.0" + dependencies: + spdx-expression-parse: "npm:^3.0.0" + spdx-license-ids: "npm:^3.0.0" + checksum: 49208f008618b9119208b0dadc9208a3a55053f4fd6a0ae8116861bd22696fc50f4142a35ebfdb389e05ccf2de8ad142573fefc9e26f670522d899f7b2fe7386 + languageName: node + linkType: hard + +"spdx-exceptions@npm:^2.1.0": + version: 2.3.0 + resolution: "spdx-exceptions@npm:2.3.0" + checksum: 83089e77d2a91cb6805a5c910a2bedb9e50799da091f532c2ba4150efdef6e53f121523d3e2dc2573a340dc0189e648b03157097f65465b3a0c06da1f18d7e8a + languageName: node + linkType: hard + +"spdx-expression-parse@npm:^3.0.0": + version: 3.0.1 + resolution: "spdx-expression-parse@npm:3.0.1" + dependencies: + spdx-exceptions: "npm:^2.1.0" + spdx-license-ids: "npm:^3.0.0" + checksum: 6f8a41c87759fa184a58713b86c6a8b028250f158159f1d03ed9d1b6ee4d9eefdc74181c8ddc581a341aa971c3e7b79e30b59c23b05d2436d5de1c30bdef7171 + languageName: node + linkType: hard + +"spdx-license-ids@npm:^3.0.0": + version: 3.0.16 + resolution: "spdx-license-ids@npm:3.0.16" + checksum: 7d88b8f01308948bb3ea69c066448f2776cf3d35a410d19afb836743086ced1566f6824ee8e6d67f8f25aa81fa86d8076a666c60ac4528caecd55e93edb5114e + languageName: node + linkType: hard + +"split2@npm:^3.0.0": + version: 3.2.2 + resolution: "split2@npm:3.2.2" + dependencies: + readable-stream: "npm:^3.0.0" + checksum: 2dad5603c52b353939befa3e2f108f6e3aff42b204ad0f5f16dd12fd7c2beab48d117184ce6f7c8854f9ee5ffec6faae70d243711dd7d143a9f635b4a285de4e + languageName: node + linkType: hard + +"split@npm:^1.0.0": + version: 1.0.1 + resolution: "split@npm:1.0.1" + dependencies: + through: "npm:2" + checksum: 7f489e7ed5ff8a2e43295f30a5197ffcb2d6202c9cf99357f9690d645b19c812bccf0be3ff336fea5054cda17ac96b91d67147d95dbfc31fbb5804c61962af85 + languageName: node + linkType: hard + +"ssri@npm:^10.0.0": + version: 10.0.5 + resolution: "ssri@npm:10.0.5" + dependencies: + minipass: "npm:^7.0.3" + checksum: b091f2ae92474183c7ac5ed3f9811457e1df23df7a7e70c9476eaa9a0c4a0c8fc190fb45acefbf023ca9ee864dd6754237a697dc52a0fb182afe65d8e77443d8 + languageName: node + linkType: hard + +"stackback@npm:0.0.2": + version: 0.0.2 + resolution: "stackback@npm:0.0.2" + checksum: 89a1416668f950236dd5ac9f9a6b2588e1b9b62b1b6ad8dff1bfc5d1a15dbf0aafc9b52d2226d00c28dffff212da464eaeebfc6b7578b9d180cef3e3782c5983 + languageName: node + linkType: hard + +"stackblur-canvas@npm:^2.0.0": + version: 2.6.0 + resolution: "stackblur-canvas@npm:2.6.0" + checksum: d93e3b42c4c9f65bcf86517f0ef29216725c69902318520db805697d82863d6338ce412ee08281b2fb653ac2cf9624629d65196d4cba3e1365840d4594e9b9c1 + languageName: node + linkType: hard + +"std-env@npm:^3.3.3": + version: 3.7.0 + resolution: "std-env@npm:3.7.0" + checksum: 60edf2d130a4feb7002974af3d5a5f3343558d1ccf8d9b9934d225c638606884db4a20d2fe6440a09605bca282af6b042ae8070a10490c0800d69e82e478f41e + languageName: node + linkType: hard + +"stream-browserify@npm:^3.0.0": + version: 3.0.0 + resolution: "stream-browserify@npm:3.0.0" + dependencies: + inherits: "npm:~2.0.4" + readable-stream: "npm:^3.5.0" + checksum: ec3b975a4e0aa4b3dc5e70ffae3fc8fd29ac725353a14e72f213dff477b00330140ad014b163a8cbb9922dfe90803f81a5ea2b269e1bbfd8bd71511b88f889ad + languageName: node + linkType: hard + +"string-width-cjs@npm:string-width@^4.2.0, string-width@npm:^4.1.0, string-width@npm:^4.2.0": + version: 4.2.3 + resolution: "string-width@npm:4.2.3" + dependencies: + emoji-regex: "npm:^8.0.0" + is-fullwidth-code-point: "npm:^3.0.0" + strip-ansi: "npm:^6.0.1" + checksum: 1e525e92e5eae0afd7454086eed9c818ee84374bb80328fc41217ae72ff5f065ef1c9d7f72da41de40c75fa8bb3dee63d92373fd492c84260a552c636392a47b + languageName: node + linkType: hard + +"string-width@npm:^5.0.1, string-width@npm:^5.1.2": + version: 5.1.2 + resolution: "string-width@npm:5.1.2" + dependencies: + eastasianwidth: "npm:^0.2.0" + emoji-regex: "npm:^9.2.2" + strip-ansi: "npm:^7.0.1" + checksum: ab9c4264443d35b8b923cbdd513a089a60de339216d3b0ed3be3ba57d6880e1a192b70ae17225f764d7adbf5994e9bb8df253a944736c15a0240eff553c678ca + languageName: node + linkType: hard + +"string.prototype.matchall@npm:^4.0.8": + version: 4.0.10 + resolution: "string.prototype.matchall@npm:4.0.10" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + get-intrinsic: "npm:^1.2.1" + has-symbols: "npm:^1.0.3" + internal-slot: "npm:^1.0.5" + regexp.prototype.flags: "npm:^1.5.0" + set-function-name: "npm:^2.0.0" + side-channel: "npm:^1.0.4" + checksum: cd7495fb0de16d43efeee3887b98701941f3817bd5f09351ad1825b023d307720c86394d56d56380563d97767ab25bf5448db239fcecbb85c28e2180f23e324a + languageName: node + linkType: hard + +"string.prototype.padend@npm:^3.0.0": + version: 3.1.5 + resolution: "string.prototype.padend@npm:3.1.5" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + checksum: 94ba0d7a463c225d0337ebe4f5c150577d6d09fe56c798f77cd2b11f8d7c9b7b05e65b3c2a273f03529a3f155edb2d78b9c06b7a91f964f89796010a6cbc1dfa + languageName: node + linkType: hard + +"string.prototype.trim@npm:^1.2.8": + version: 1.2.8 + resolution: "string.prototype.trim@npm:1.2.8" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + checksum: 4f76c583908bcde9a71208ddff38f67f24c9ec8093631601666a0df8b52fad44dad2368c78895ce83eb2ae8e7068294cc96a02fc971ab234e4d5c9bb61ea4e34 + languageName: node + linkType: hard + +"string.prototype.trimend@npm:^1.0.7": + version: 1.0.7 + resolution: "string.prototype.trimend@npm:1.0.7" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + checksum: 53c24911c7c4d8d65f5ef5322de23a3d5b6b4db73273e05871d5ab4571ae5638f38f7f19d71d09116578fb060e5a145cc6a208af2d248c8baf7a34f44d32ce57 + languageName: node + linkType: hard + +"string.prototype.trimstart@npm:^1.0.7": + version: 1.0.7 + resolution: "string.prototype.trimstart@npm:1.0.7" + dependencies: + call-bind: "npm:^1.0.2" + define-properties: "npm:^1.2.0" + es-abstract: "npm:^1.22.1" + checksum: 0bcf391b41ea16d4fda9c9953d0a7075171fe090d33b4cf64849af94944c50862995672ac03e0c5dba2940a213ad7f53515a668dac859ce22a0276289ae5cf4f + languageName: node + linkType: hard + +"string_decoder@npm:^1.1.1": + version: 1.3.0 + resolution: "string_decoder@npm:1.3.0" + dependencies: + safe-buffer: "npm:~5.2.0" + checksum: 810614ddb030e271cd591935dcd5956b2410dd079d64ff92a1844d6b7588bf992b3e1b69b0f4d34a3e06e0bd73046ac646b5264c1987b20d0601f81ef35d731d + languageName: node + linkType: hard + +"string_decoder@npm:~1.1.1": + version: 1.1.1 + resolution: "string_decoder@npm:1.1.1" + dependencies: + safe-buffer: "npm:~5.1.0" + checksum: b4f89f3a92fd101b5653ca3c99550e07bdf9e13b35037e9e2a1c7b47cec4e55e06ff3fc468e314a0b5e80bfbaf65c1ca5a84978764884ae9413bec1fc6ca924e + languageName: node + linkType: hard + +"strip-ansi-cjs@npm:strip-ansi@^6.0.1, strip-ansi@npm:^6.0.0, strip-ansi@npm:^6.0.1": + version: 6.0.1 + resolution: "strip-ansi@npm:6.0.1" + dependencies: + ansi-regex: "npm:^5.0.1" + checksum: 1ae5f212a126fe5b167707f716942490e3933085a5ff6c008ab97ab2f272c8025d3aa218b7bd6ab25729ca20cc81cddb252102f8751e13482a5199e873680952 + languageName: node + linkType: hard + +"strip-ansi@npm:^7.0.1": + version: 7.1.0 + resolution: "strip-ansi@npm:7.1.0" + dependencies: + ansi-regex: "npm:^6.0.1" + checksum: a198c3762e8832505328cbf9e8c8381de14a4fa50a4f9b2160138158ea88c0f5549fb50cb13c651c3088f47e63a108b34622ec18c0499b6c8c3a5ddf6b305ac4 + languageName: node + linkType: hard + +"strip-bom@npm:^3.0.0": + version: 3.0.0 + resolution: "strip-bom@npm:3.0.0" + checksum: 51201f50e021ef16672593d7434ca239441b7b760e905d9f33df6e4f3954ff54ec0e0a06f100d028af0982d6f25c35cd5cda2ce34eaebccd0250b8befb90d8f1 + languageName: node + linkType: hard + +"strip-indent@npm:^3.0.0": + version: 3.0.0 + resolution: "strip-indent@npm:3.0.0" + dependencies: + min-indent: "npm:^1.0.0" + checksum: ae0deaf41c8d1001c5d4fbe16cb553865c1863da4fae036683b474fa926af9fc121e155cb3fc57a68262b2ae7d5b8420aa752c97a6428c315d00efe2a3875679 + languageName: node + linkType: hard + +"strip-json-comments@npm:^3.1.1": + version: 3.1.1 + resolution: "strip-json-comments@npm:3.1.1" + checksum: 9681a6257b925a7fa0f285851c0e613cc934a50661fa7bb41ca9cbbff89686bb4a0ee366e6ecedc4daafd01e83eee0720111ab294366fe7c185e935475ebcecd + languageName: node + linkType: hard + +"strip-literal@npm:^1.0.1": + version: 1.3.0 + resolution: "strip-literal@npm:1.3.0" + dependencies: + acorn: "npm:^8.10.0" + checksum: 3c0c9ee41eb346e827eede61ef288457f53df30e3e6ff8b94fa81b636933b0c13ca4ea5c97d00a10d72d04be326da99ac819f8769f0c6407ba8177c98344a916 + languageName: node + linkType: hard + +"supports-color@npm:^5.3.0": + version: 5.5.0 + resolution: "supports-color@npm:5.5.0" + dependencies: + has-flag: "npm:^3.0.0" + checksum: 6ae5ff319bfbb021f8a86da8ea1f8db52fac8bd4d499492e30ec17095b58af11f0c55f8577390a749b1c4dde691b6a0315dab78f5f54c9b3d83f8fb5905c1c05 + languageName: node + linkType: hard + +"supports-color@npm:^7.1.0": + version: 7.2.0 + resolution: "supports-color@npm:7.2.0" + dependencies: + has-flag: "npm:^4.0.0" + checksum: afb4c88521b8b136b5f5f95160c98dee7243dc79d5432db7efc27efb219385bbc7d9427398e43dd6cc730a0f87d5085ce1652af7efbe391327bc0a7d0f7fc124 + languageName: node + linkType: hard + +"supports-preserve-symlinks-flag@npm:^1.0.0": + version: 1.0.0 + resolution: "supports-preserve-symlinks-flag@npm:1.0.0" + checksum: 6c4032340701a9950865f7ae8ef38578d8d7053f5e10518076e6554a9381fa91bd9c6850193695c141f32b21f979c985db07265a758867bac95de05f7d8aeb39 + languageName: node + linkType: hard + +"svg-pathdata@npm:^6.0.3": + version: 6.0.3 + resolution: "svg-pathdata@npm:6.0.3" + checksum: 1ba4ad2fa81e86df37d6e78d3be9e664bbedf97773b725a863a85db384285be32dc37d9c0d61e477d89594ee95b967d2c53d6bee2d76420aab670ab4124a38b9 + languageName: node + linkType: hard + +"symbol-tree@npm:^3.2.4": + version: 3.2.4 + resolution: "symbol-tree@npm:3.2.4" + checksum: dfbe201ae09ac6053d163578778c53aa860a784147ecf95705de0cd23f42c851e1be7889241495e95c37cabb058edb1052f141387bef68f705afc8f9dd358509 + languageName: node + linkType: hard + +"tar@npm:^6.1.11, tar@npm:^6.1.2": + version: 6.2.0 + resolution: "tar@npm:6.2.0" + dependencies: + chownr: "npm:^2.0.0" + fs-minipass: "npm:^2.0.0" + minipass: "npm:^5.0.0" + minizlib: "npm:^2.1.1" + mkdirp: "npm:^1.0.3" + yallist: "npm:^4.0.0" + checksum: 02ca064a1a6b4521fef88c07d389ac0936730091f8c02d30ea60d472e0378768e870769ab9e986d87807bfee5654359cf29ff4372746cc65e30cbddc352660d8 + languageName: node + linkType: hard + +"temp-dir@npm:^2.0.0": + version: 2.0.0 + resolution: "temp-dir@npm:2.0.0" + checksum: b1df969e3f3f7903f3426861887ed76ba3b495f63f6d0c8e1ce22588679d9384d336df6064210fda14e640ed422e2a17d5c40d901f60e161c99482d723f4d309 + languageName: node + linkType: hard + +"tempfile@npm:^3.0.0": + version: 3.0.0 + resolution: "tempfile@npm:3.0.0" + dependencies: + temp-dir: "npm:^2.0.0" + uuid: "npm:^3.3.2" + checksum: 1547e7b5c199868f9b8bf0e321f4cbdc3c57c05c03ff0b1a93deae94edc529ac1499ec7b6d7ebf4e79f469194262c4606785b47ec77d979eaece42c46db72932 + languageName: node + linkType: hard + +"test-exclude@npm:^6.0.0": + version: 6.0.0 + resolution: "test-exclude@npm:6.0.0" + dependencies: + "@istanbuljs/schema": "npm:^0.1.2" + glob: "npm:^7.1.4" + minimatch: "npm:^3.0.4" + checksum: 019d33d81adff3f9f1bfcff18125fb2d3c65564f437d9be539270ee74b994986abb8260c7c2ce90e8f30162178b09dbbce33c6389273afac4f36069c48521f57 + languageName: node + linkType: hard + +"text-extensions@npm:^1.0.0": + version: 1.9.0 + resolution: "text-extensions@npm:1.9.0" + checksum: 9ad5a9f723a871e2d884e132d7e93f281c60b5759c95f3f6b04704856548715d93a36c10dbaf5f12b91bf405f0cf3893bf169d4d143c0f5509563b992d385443 + languageName: node + linkType: hard + +"text-segmentation@npm:^1.0.3": + version: 1.0.3 + resolution: "text-segmentation@npm:1.0.3" + dependencies: + utrie: "npm:^1.0.2" + checksum: 8b9ae8524e3a332371060d0ca62f10ad49a13e954719ea689a6c3a8b8c15c8a56365ede2bb91c322fb0d44b6533785f0da603e066b7554d052999967fb72d600 + languageName: node + linkType: hard + +"text-table@npm:^0.2.0": + version: 0.2.0 + resolution: "text-table@npm:0.2.0" + checksum: 02805740c12851ea5982686810702e2f14369a5f4c5c40a836821e3eefc65ffeec3131ba324692a37608294b0fd8c1e55a2dd571ffed4909822787668ddbee5c + languageName: node + linkType: hard + +"threads@npm:^1.6.4": + version: 1.7.0 + resolution: "threads@npm:1.7.0" + dependencies: + callsites: "npm:^3.1.0" + debug: "npm:^4.2.0" + is-observable: "npm:^2.1.0" + observable-fns: "npm:^0.6.1" + tiny-worker: "npm:>= 2" + dependenciesMeta: + tiny-worker: + optional: true + checksum: 34114075c5eb253e937c01e0e51babb71eb1571c2fd4a8170645aa20c10186422324537d017d64bfd3de655cbb6647bf70d1d602260273b1e9750719d67f359a + languageName: node + linkType: hard + +"through2@npm:^2.0.0": + version: 2.0.5 + resolution: "through2@npm:2.0.5" + dependencies: + readable-stream: "npm:~2.3.6" + xtend: "npm:~4.0.1" + checksum: cbfe5b57943fa12b4f8c043658c2a00476216d79c014895cef1ac7a1d9a8b31f6b438d0e53eecbb81054b93128324a82ecd59ec1a4f91f01f7ac113dcb14eade + languageName: node + linkType: hard + +"through2@npm:^4.0.0": + version: 4.0.2 + resolution: "through2@npm:4.0.2" + dependencies: + readable-stream: "npm:3" + checksum: 3741564ae99990a4a79097fe7a4152c22348adc4faf2df9199a07a66c81ed2011da39f631e479fdc56483996a9d34a037ad64e76d79f18c782ab178ea9b6778c + languageName: node + linkType: hard + +"through@npm:2, through@npm:>=2.2.7 <3": + version: 2.3.8 + resolution: "through@npm:2.3.8" + checksum: 4b09f3774099de0d4df26d95c5821a62faee32c7e96fb1f4ebd54a2d7c11c57fe88b0a0d49cf375de5fee5ae6bf4eb56dbbf29d07366864e2ee805349970d3cc + languageName: node + linkType: hard + +"tiny-invariant@npm:^1.0.2": + version: 1.3.1 + resolution: "tiny-invariant@npm:1.3.1" + checksum: 5b87c1d52847d9452b60d0dcb77011b459044e0361ca8253bfe7b43d6288106e12af926adb709a6fc28900e3864349b91dad9a4ac93c39aa15f360b26c2ff4db + languageName: node + linkType: hard + +"tiny-warning@npm:^1.0.0": + version: 1.0.3 + resolution: "tiny-warning@npm:1.0.3" + checksum: ef8531f581b30342f29670cb41ca248001c6fd7975ce22122bd59b8d62b4fc84ad4207ee7faa95cde982fa3357cd8f4be650142abc22805538c3b1392d7084fa + languageName: node + linkType: hard + +"tiny-worker@npm:>= 2": + version: 2.3.0 + resolution: "tiny-worker@npm:2.3.0" + dependencies: + esm: "npm:^3.2.25" + checksum: 3106cace86e673216426a517e96fb72ce642ba79002554e4c6bceb585ba77cf5e5e68b452c752cada6136ae94fdbf11c56943a70de6c6bc6a2a3a9ae439746c9 + languageName: node + linkType: hard + +"tinybench@npm:^2.5.0": + version: 2.5.1 + resolution: "tinybench@npm:2.5.1" + checksum: 9c55ef25ce1689c3e2fdb89cacbf27dada4d04f846cac70023fe97fc35d2122816d8bbc5b20253e071d13688cf006355d59f0096d22958b818e1e2fe60e5165b + languageName: node + linkType: hard + +"tinycolor2@npm:^1.4.1": + version: 1.6.0 + resolution: "tinycolor2@npm:1.6.0" + checksum: 9aa79a36ba2c2a87cb221453465cabacd04b9e35f9694373e846fdc78b1c768110f81e581ea41440106c0f24d9a023891d0887e8075885e790ac40eb0e74a5c1 + languageName: node + linkType: hard + +"tinypool@npm:^0.7.0": + version: 0.7.0 + resolution: "tinypool@npm:0.7.0" + checksum: ecb35d9f74e72722c059acb1947ffc3c2caccb45266b89b72f74be2d28f0784d948b50bd9c6c68fa4159afd423ac5f5a07271a5f516d18a565dd06af0a37bc44 + languageName: node + linkType: hard + +"tinyspy@npm:^2.1.1": + version: 2.2.0 + resolution: "tinyspy@npm:2.2.0" + checksum: 8c7b70748dd8590e85d52741db79243746c15bc03c92d75c23160a762142db577e7f53e360ba7300e321b12bca5c42dd2522a8dbeec6ba3830302573dd8516bc + languageName: node + linkType: hard + +"to-fast-properties@npm:^2.0.0": + version: 2.0.0 + resolution: "to-fast-properties@npm:2.0.0" + checksum: b214d21dbfb4bce3452b6244b336806ffea9c05297148d32ebb428d5c43ce7545bdfc65a1ceb58c9ef4376a65c0cb2854d645f33961658b3e3b4f84910ddcdd7 + languageName: node + linkType: hard + +"to-regex-range@npm:^5.0.1": + version: 5.0.1 + resolution: "to-regex-range@npm:5.0.1" + dependencies: + is-number: "npm:^7.0.0" + checksum: 487988b0a19c654ff3e1961b87f471702e708fa8a8dd02a298ef16da7206692e8552a0250e8b3e8759270f62e9d8314616f6da274734d3b558b1fc7b7724e892 + languageName: node + linkType: hard + +"tough-cookie@npm:^4.0.0": + version: 4.1.3 + resolution: "tough-cookie@npm:4.1.3" + dependencies: + psl: "npm:^1.1.33" + punycode: "npm:^2.1.1" + universalify: "npm:^0.2.0" + url-parse: "npm:^1.5.3" + checksum: 4fc0433a0cba370d57c4b240f30440c848906dee3180bb6e85033143c2726d322e7e4614abb51d42d111ebec119c4876ed8d7247d4113563033eebbc1739c831 + languageName: node + linkType: hard + +"tr46@npm:^3.0.0": + version: 3.0.0 + resolution: "tr46@npm:3.0.0" + dependencies: + punycode: "npm:^2.1.1" + checksum: cdc47cad3a9d0b6cb293e39ccb1066695ae6fdd39b9e4f351b010835a1f8b4f3a6dc3a55e896b421371187f22b48d7dac1b693de4f6551bdef7b6ab6735dfe3b + languageName: node + linkType: hard + +"tr46@npm:~0.0.3": + version: 0.0.3 + resolution: "tr46@npm:0.0.3" + checksum: 047cb209a6b60c742f05c9d3ace8fa510bff609995c129a37ace03476a9b12db4dbf975e74600830ef0796e18882b2381fb5fb1f6b4f96b832c374de3ab91a11 + languageName: node + linkType: hard + +"trim-newlines@npm:^3.0.0": + version: 3.0.1 + resolution: "trim-newlines@npm:3.0.1" + checksum: 03cfefde6c59ff57138412b8c6be922ecc5aec30694d784f2a65ef8dcbd47faef580b7de0c949345abdc56ec4b4abf64dd1e5aea619b200316e471a3dd5bf1f6 + languageName: node + linkType: hard + +"trough@npm:^1.0.0": + version: 1.0.5 + resolution: "trough@npm:1.0.5" + checksum: f036d0d7f9bc7cfe5ee650d70b57bb1f048f3292adf6c81bb9b228e546b2b2e5b74ea04a060d21472108a8cda05ec4814bbe86f87ee35c182c50cb41b5c1810a + languageName: node + linkType: hard + +"ts-json-schema-generator@npm:^1.0.0": + version: 1.5.0 + resolution: "ts-json-schema-generator@npm:1.5.0" + dependencies: + "@types/json-schema": "npm:^7.0.12" + commander: "npm:^11.0.0" + glob: "npm:^8.0.3" + json5: "npm:^2.2.3" + normalize-path: "npm:^3.0.0" + safe-stable-stringify: "npm:^2.4.3" + typescript: "npm:~5.3.2" + bin: + ts-json-schema-generator: bin/ts-json-schema-generator + checksum: 7868e8920c218ba47ff0c05f6b8fd4d32d20b52327b05ad1f554788092073e0735f3c2baf08420f6408096c0c5c43e2c568b86d59fc1d8dc3c1ecb265e7596b3 + languageName: node + linkType: hard + +"tslib@npm:^1.8.1": + version: 1.14.1 + resolution: "tslib@npm:1.14.1" + checksum: 69ae09c49eea644bc5ebe1bca4fa4cc2c82b7b3e02f43b84bd891504edf66dbc6b2ec0eef31a957042de2269139e4acff911e6d186a258fb14069cd7f6febce2 + languageName: node + linkType: hard + +"tslib@npm:^2.1.0": + version: 2.6.2 + resolution: "tslib@npm:2.6.2" + checksum: e03a8a4271152c8b26604ed45535954c0a45296e32445b4b87f8a5abdb2421f40b59b4ca437c4346af0f28179780d604094eb64546bee2019d903d01c6c19bdb + languageName: node + linkType: hard + +"tsutils@npm:^3.21.0": + version: 3.21.0 + resolution: "tsutils@npm:3.21.0" + dependencies: + tslib: "npm:^1.8.1" + peerDependencies: + typescript: ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + checksum: 02f19e458ec78ead8fffbf711f834ad8ecd2cc6ade4ec0320790713dccc0a412b99e7fd907c4cda2a1dc602c75db6f12e0108e87a5afad4b2f9e90a24cabd5a2 + languageName: node + linkType: hard + +"two-product@npm:^1.0.2": + version: 1.0.2 + resolution: "two-product@npm:1.0.2" + checksum: da6749a7aeef789c71735acd31987b821452e81120028f85cb2d0ee0342cee077b9ed0067f1693ad99cb565a71400271ff726189f7946e1e006944db95056abf + languageName: node + linkType: hard + +"two-sum@npm:^1.0.0": + version: 1.0.0 + resolution: "two-sum@npm:1.0.0" + checksum: 8c5f1f62fb029e5f5538a4efac52a81be26942cf3b050969f0f9d21a7d45fb48dc710ba130794fd639a31b5f3491fd2c7c7e7506571eb07c1aeac409f950f44a + languageName: node + linkType: hard + +"type-check@npm:^0.4.0, type-check@npm:~0.4.0": + version: 0.4.0 + resolution: "type-check@npm:0.4.0" + dependencies: + prelude-ls: "npm:^1.2.1" + checksum: 7b3fd0ed43891e2080bf0c5c504b418fbb3e5c7b9708d3d015037ba2e6323a28152ec163bcb65212741fa5d2022e3075ac3c76440dbd344c9035f818e8ecee58 + languageName: node + linkType: hard + +"type-detect@npm:^4.0.0, type-detect@npm:^4.0.8": + version: 4.0.8 + resolution: "type-detect@npm:4.0.8" + checksum: 8fb9a51d3f365a7de84ab7f73b653534b61b622aa6800aecdb0f1095a4a646d3f5eb295322127b6573db7982afcd40ab492d038cf825a42093a58b1e1353e0bd + languageName: node + linkType: hard + +"type-fest@npm:^0.18.0": + version: 0.18.1 + resolution: "type-fest@npm:0.18.1" + checksum: 303f5ecf40d03e1d5b635ce7660de3b33c18ed8ebc65d64920c02974d9e684c72483c23f9084587e9dd6466a2ece1da42ddc95b412a461794dd30baca95e2bac + languageName: node + linkType: hard + +"type-fest@npm:^0.20.2": + version: 0.20.2 + resolution: "type-fest@npm:0.20.2" + checksum: dea9df45ea1f0aaa4e2d3bed3f9a0bfe9e5b2592bddb92eb1bf06e50bcf98dbb78189668cd8bc31a0511d3fc25539b4cd5c704497e53e93e2d40ca764b10bfc3 + languageName: node + linkType: hard + +"type-fest@npm:^0.6.0": + version: 0.6.0 + resolution: "type-fest@npm:0.6.0" + checksum: 0c585c26416fce9ecb5691873a1301b5aff54673c7999b6f925691ed01f5b9232db408cdbb0bd003d19f5ae284322523f44092d1f81ca0a48f11f7cf0be8cd38 + languageName: node + linkType: hard + +"type-fest@npm:^0.8.1": + version: 0.8.1 + resolution: "type-fest@npm:0.8.1" + checksum: dffbb99329da2aa840f506d376c863bd55f5636f4741ad6e65e82f5ce47e6914108f44f340a0b74009b0cb5d09d6752ae83203e53e98b1192cf80ecee5651636 + languageName: node + linkType: hard + +"typed-array-buffer@npm:^1.0.0": + version: 1.0.0 + resolution: "typed-array-buffer@npm:1.0.0" + dependencies: + call-bind: "npm:^1.0.2" + get-intrinsic: "npm:^1.2.1" + is-typed-array: "npm:^1.1.10" + checksum: ebad66cdf00c96b1395dffc7873169cf09801fca5954507a484f41f253feb1388d815db297b0b3bb8ce7421eac6f7ff45e2ec68450a3d68408aa4ae02fcf3a6c + languageName: node + linkType: hard + +"typed-array-byte-length@npm:^1.0.0": + version: 1.0.0 + resolution: "typed-array-byte-length@npm:1.0.0" + dependencies: + call-bind: "npm:^1.0.2" + for-each: "npm:^0.3.3" + has-proto: "npm:^1.0.1" + is-typed-array: "npm:^1.1.10" + checksum: 6696435d53ce0e704ff6760c57ccc35138aec5f87859e03eb2a3246336d546feae367952dbc918116f3f0dffbe669734e3cbd8960283c2fa79aac925db50d888 + languageName: node + linkType: hard + +"typed-array-byte-offset@npm:^1.0.0": + version: 1.0.0 + resolution: "typed-array-byte-offset@npm:1.0.0" + dependencies: + available-typed-arrays: "npm:^1.0.5" + call-bind: "npm:^1.0.2" + for-each: "npm:^0.3.3" + has-proto: "npm:^1.0.1" + is-typed-array: "npm:^1.1.10" + checksum: 4036ce007ae9752931bed3dd61e0d6de2a3e5f6a5a85a05f3adb35388d2c0728f9b1a1e638d75579f168e49c289bfb5417f00e96d4ab081f38b647fc854ff7a5 + languageName: node + linkType: hard + +"typed-array-length@npm:^1.0.4": + version: 1.0.4 + resolution: "typed-array-length@npm:1.0.4" + dependencies: + call-bind: "npm:^1.0.2" + for-each: "npm:^0.3.3" + is-typed-array: "npm:^1.1.9" + checksum: c5163c0103d07fefc8a2ad0fc151f9ca9a1f6422098c00f695d55f9896e4d63614cd62cf8d8a031c6cee5f418e8980a533796597174da4edff075b3d275a7e23 + languageName: node + linkType: hard + +"typedarray-pool@npm:^1.1.0": + version: 1.2.0 + resolution: "typedarray-pool@npm:1.2.0" + dependencies: + bit-twiddle: "npm:^1.0.0" + dup: "npm:^1.0.0" + checksum: 1e1050e51470f58bd01a82cc0ab881c148e29863e3eaf7bc115033016214fc8588e6fd21354be8ef449062e5a83bfc85434c788c378b62234aa3d391fffc2957 + languageName: node + linkType: hard + +"typescript@npm:^5.0.2, typescript@npm:~5.3.2": + version: 5.3.3 + resolution: "typescript@npm:5.3.3" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: e33cef99d82573624fc0f854a2980322714986bc35b9cb4d1ce736ed182aeab78e2cb32b385efa493b2a976ef52c53e20d6c6918312353a91850e2b76f1ea44f + languageName: node + linkType: hard + +"typescript@patch:typescript@npm%3A^5.0.2#optional!builtin, typescript@patch:typescript@npm%3A~5.3.2#optional!builtin": + version: 5.3.3 + resolution: "typescript@patch:typescript@npm%3A5.3.3#optional!builtin::version=5.3.3&hash=e012d7" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 1d0a5f4ce496c42caa9a30e659c467c5686eae15d54b027ee7866744952547f1be1262f2d40de911618c242b510029d51d43ff605dba8fb740ec85ca2d3f9500 + languageName: node + linkType: hard + +"ufo@npm:^1.3.0": + version: 1.3.2 + resolution: "ufo@npm:1.3.2" + checksum: 180f3dfcdf319b54fe0272780841c93cb08a024fc2ee5f95e63285c2a3c42d8b671cd3641e9a53aafccf100cf8466aa8c040ddfa0efea1fc1968c9bfb250a661 + languageName: node + linkType: hard + +"uglify-js@npm:^3.1.4": + version: 3.17.4 + resolution: "uglify-js@npm:3.17.4" + bin: + uglifyjs: bin/uglifyjs + checksum: 8b7fcdca69deb284fed7d2025b73eb747ce37f9aca6af53422844f46427152d5440601b6e2a033e77856a2f0591e4167153d5a21b68674ad11f662034ec13ced + languageName: node + linkType: hard + +"unbox-primitive@npm:^1.0.2": + version: 1.0.2 + resolution: "unbox-primitive@npm:1.0.2" + dependencies: + call-bind: "npm:^1.0.2" + has-bigints: "npm:^1.0.2" + has-symbols: "npm:^1.0.3" + which-boxed-primitive: "npm:^1.0.2" + checksum: 81ca2e81134167cc8f75fa79fbcc8a94379d6c61de67090986a2273850989dd3bae8440c163121b77434b68263e34787a675cbdcb34bb2f764c6b9c843a11b66 + languageName: node + linkType: hard + +"undici-types@npm:~5.26.4": + version: 5.26.5 + resolution: "undici-types@npm:5.26.5" + checksum: bb673d7876c2d411b6eb6c560e0c571eef4a01c1c19925175d16e3a30c4c428181fb8d7ae802a261f283e4166a0ac435e2f505743aa9e45d893f9a3df017b501 + languageName: node + linkType: hard + +"unified@npm:^9.0.0": + version: 9.2.2 + resolution: "unified@npm:9.2.2" + dependencies: + bail: "npm:^1.0.0" + extend: "npm:^3.0.0" + is-buffer: "npm:^2.0.0" + is-plain-obj: "npm:^2.0.0" + trough: "npm:^1.0.0" + vfile: "npm:^4.0.0" + checksum: a66d71b039c24626802a4664a1f3210f29ab1f75b89fd41933e6ab00561e1ec43a5bec6de32c7ebc86544e5f00ef5836e8fe79a823e81e35825de4e35823eda9 + languageName: node + linkType: hard + +"unique-filename@npm:^3.0.0": + version: 3.0.0 + resolution: "unique-filename@npm:3.0.0" + dependencies: + unique-slug: "npm:^4.0.0" + checksum: 6363e40b2fa758eb5ec5e21b3c7fb83e5da8dcfbd866cc0c199d5534c42f03b9ea9ab069769cc388e1d7ab93b4eeef28ef506ab5f18d910ef29617715101884f + languageName: node + linkType: hard + +"unique-slug@npm:^4.0.0": + version: 4.0.0 + resolution: "unique-slug@npm:4.0.0" + dependencies: + imurmurhash: "npm:^0.1.4" + checksum: cb811d9d54eb5821b81b18205750be84cb015c20a4a44280794e915f5a0a70223ce39066781a354e872df3572e8155c228f43ff0cce94c7cbf4da2cc7cbdd635 + languageName: node + linkType: hard + +"unist-util-is@npm:^4.0.0": + version: 4.1.0 + resolution: "unist-util-is@npm:4.1.0" + checksum: 21ca3d7bacc88853b880b19cb1b133a056c501617d7f9b8cce969cd8b430ed7e1bc416a3a11b02540d5de6fb86807e169d00596108a459d034cf5faec97c055e + languageName: node + linkType: hard + +"unist-util-stringify-position@npm:^2.0.0": + version: 2.0.3 + resolution: "unist-util-stringify-position@npm:2.0.3" + dependencies: + "@types/unist": "npm:^2.0.2" + checksum: 46fa03f840df173b7f032cbfffdb502fb05b79b3fb5451681c796cf4985d9087a537833f5afb75d55e79b46bbbe4b3d81dd75a1062f9289091c526aebe201d5d + languageName: node + linkType: hard + +"unist-util-visit-parents@npm:1.1.2": + version: 1.1.2 + resolution: "unist-util-visit-parents@npm:1.1.2" + checksum: 67b91d9412595faaa1b673ce0411ef64c112d6b5c68a2da96ee7633d91dafe47b83e73f52f885e289d42de0d26eea7b605f1f1e83300048356c9ec20286ca65a + languageName: node + linkType: hard + +"unist-util-visit-parents@npm:^3.0.0": + version: 3.1.1 + resolution: "unist-util-visit-parents@npm:3.1.1" + dependencies: + "@types/unist": "npm:^2.0.0" + unist-util-is: "npm:^4.0.0" + checksum: 231c80c5ba8e79263956fcaa25ed2a11ad7fe77ac5ba0d322e9d51bbc4238501e3bb52f405e518bcdc5471e27b33eff520db0aa4a3b1feb9fb6e2de6ae385d49 + languageName: node + linkType: hard + +"unist-util-visit@npm:^2.0.0": + version: 2.0.3 + resolution: "unist-util-visit@npm:2.0.3" + dependencies: + "@types/unist": "npm:^2.0.0" + unist-util-is: "npm:^4.0.0" + unist-util-visit-parents: "npm:^3.0.0" + checksum: 7b11303d82271ca53a2ced2d56c87a689dd518596c99ff4a11cdff750f5cc5c0e4b64b146bd2363557cb29443c98713bfd1e8dc6d1c3f9d474b9eb1f23a60888 + languageName: node + linkType: hard + +"universalify@npm:^0.2.0": + version: 0.2.0 + resolution: "universalify@npm:0.2.0" + checksum: cedbe4d4ca3967edf24c0800cfc161c5a15e240dac28e3ce575c689abc11f2c81ccc6532c8752af3b40f9120fb5e454abecd359e164f4f6aa44c29cd37e194fe + languageName: node + linkType: hard + +"update-browserslist-db@npm:^1.0.13": + version: 1.0.13 + resolution: "update-browserslist-db@npm:1.0.13" + dependencies: + escalade: "npm:^3.1.1" + picocolors: "npm:^1.0.0" + peerDependencies: + browserslist: ">= 4.21.0" + bin: + update-browserslist-db: cli.js + checksum: e52b8b521c78ce1e0c775f356cd16a9c22c70d25f3e01180839c407a5dc787fb05a13f67560cbaf316770d26fa99f78f1acd711b1b54a4f35d4820d4ea7136e6 + languageName: node + linkType: hard + +"uri-js@npm:^4.2.2": + version: 4.4.1 + resolution: "uri-js@npm:4.4.1" + dependencies: + punycode: "npm:^2.1.0" + checksum: 4ef57b45aa820d7ac6496e9208559986c665e49447cb072744c13b66925a362d96dd5a46c4530a6b8e203e5db5fe849369444440cb22ecfc26c679359e5dfa3c + languageName: node + linkType: hard + +"url-parse@npm:^1.4.3, url-parse@npm:^1.5.3": + version: 1.5.10 + resolution: "url-parse@npm:1.5.10" + dependencies: + querystringify: "npm:^2.1.1" + requires-port: "npm:^1.0.0" + checksum: bd5aa9389f896974beb851c112f63b466505a04b4807cea2e5a3b7092f6fbb75316f0491ea84e44f66fed55f1b440df5195d7e3a8203f64fcefa19d182f5be87 + languageName: node + linkType: hard + +"url@npm:^0.11.0": + version: 0.11.3 + resolution: "url@npm:0.11.3" + dependencies: + punycode: "npm:^1.4.1" + qs: "npm:^6.11.2" + checksum: 7546b878ee7927cfc62ca21dbe2dc395cf70e889c3488b2815bf2c63355cb3c7db555128176a01b0af6cccf265667b6fd0b4806de00cb71c143c53986c08c602 + languageName: node + linkType: hard + +"use-resize-observer@npm:^9.0.0": + version: 9.1.0 + resolution: "use-resize-observer@npm:9.1.0" + dependencies: + "@juggle/resize-observer": "npm:^3.3.1" + peerDependencies: + react: 16.8.0 - 18 + react-dom: 16.8.0 - 18 + checksum: 6ccdeb09fe20566ec182b1635a22f189e13d46226b74610432590e69b31ef5d05d069badc3306ebd0d2bb608743b17981fb535763a1d7dc2c8ae462ee8e5999c + languageName: node + linkType: hard + +"util-deprecate@npm:^1.0.1, util-deprecate@npm:~1.0.1": + version: 1.0.2 + resolution: "util-deprecate@npm:1.0.2" + checksum: 41a5bdd214df2f6c3ecf8622745e4a366c4adced864bc3c833739791aeeeb1838119af7daed4ba36428114b5c67dcda034a79c882e97e43c03e66a4dd7389942 + languageName: node + linkType: hard + +"utrie@npm:^1.0.2": + version: 1.0.2 + resolution: "utrie@npm:1.0.2" + dependencies: + base64-arraybuffer: "npm:^1.0.2" + checksum: eaffe645bd81a39e4bc3abb23df5895e9961dbdd49748ef3b173529e8b06ce9dd1163e9705d5309a1c61ee41ffcb825e2043bc0fd1659845ffbdf4b1515dfdb4 + languageName: node + linkType: hard + +"uuid@npm:^3.3.2": + version: 3.4.0 + resolution: "uuid@npm:3.4.0" + bin: + uuid: ./bin/uuid + checksum: 1c13950df865c4f506ebfe0a24023571fa80edf2e62364297a537c80af09c618299797bbf2dbac6b1f8ae5ad182ba474b89db61e0e85839683991f7e08795347 + languageName: node + linkType: hard + +"uuid@npm:^8.3.2": + version: 8.3.2 + resolution: "uuid@npm:8.3.2" + bin: + uuid: dist/bin/uuid + checksum: bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54 + languageName: node + linkType: hard + +"v8-to-istanbul@npm:^9.0.0, v8-to-istanbul@npm:^9.1.0": + version: 9.2.0 + resolution: "v8-to-istanbul@npm:9.2.0" + dependencies: + "@jridgewell/trace-mapping": "npm:^0.3.12" + "@types/istanbul-lib-coverage": "npm:^2.0.1" + convert-source-map: "npm:^2.0.0" + checksum: e691ba4dd0dea4a884e52c37dbda30cce6f9eeafe9b26721e449429c6bb0f4b6d1e33fabe7711d0f67f7a34c3bfd56c873f7375bba0b1534e6a2843ce99550e5 + languageName: node + linkType: hard + +"validate-npm-package-license@npm:^3.0.1": + version: 3.0.4 + resolution: "validate-npm-package-license@npm:3.0.4" + dependencies: + spdx-correct: "npm:^3.0.0" + spdx-expression-parse: "npm:^3.0.0" + checksum: 7b91e455a8de9a0beaa9fe961e536b677da7f48c9a493edf4d4d4a87fd80a7a10267d438723364e432c2fcd00b5650b5378275cded362383ef570276e6312f4f + languageName: node + linkType: hard + +"value-equal@npm:^1.0.1": + version: 1.0.1 + resolution: "value-equal@npm:1.0.1" + checksum: 79068098355483ef29f4d3753999ad880875b87625d7e9055cad9346ea4b7662aad3a66f87976801b0dd7a6f828ba973d28b1669ebcd37eaf88cc5f687c1a691 + languageName: node + linkType: hard + +"vfile-message@npm:^2.0.0": + version: 2.0.4 + resolution: "vfile-message@npm:2.0.4" + dependencies: + "@types/unist": "npm:^2.0.0" + unist-util-stringify-position: "npm:^2.0.0" + checksum: ce50d90e0e5dc8f995f39602dd2404f1756388a54209c983d259b17c15e6f262a53546977a638065bc487d0657799fa96f4c1ba6b2915d9724a4968e9c7ff1c8 + languageName: node + linkType: hard + +"vfile@npm:^4.0.0": + version: 4.2.1 + resolution: "vfile@npm:4.2.1" + dependencies: + "@types/unist": "npm:^2.0.0" + is-buffer: "npm:^2.0.0" + unist-util-stringify-position: "npm:^2.0.0" + vfile-message: "npm:^2.0.0" + checksum: 4816aecfedc794ba4d3131abff2032ef0e825632cfa8cd20dd9d83819ef260589924f4f3e8fa30e06da2d8e60d7ec8ef7d0af93e0483df62890738258daf098a + languageName: node + linkType: hard + +"vite-node@npm:0.34.6": + version: 0.34.6 + resolution: "vite-node@npm:0.34.6" + dependencies: + cac: "npm:^6.7.14" + debug: "npm:^4.3.4" + mlly: "npm:^1.4.0" + pathe: "npm:^1.1.1" + picocolors: "npm:^1.0.0" + vite: "npm:^3.0.0 || ^4.0.0 || ^5.0.0-0" + bin: + vite-node: vite-node.mjs + checksum: 0e804eab1ae5f0d98014f0a933ec08bfc287228283c3c4792f5f8b8fec6657896e513498e8436449e3116839a5592f9b497cf0b982b8da1152d7d419ccc306f1 + languageName: node + linkType: hard + +"vite@npm:^3.0.0 || ^4.0.0 || ^5.0.0-0, vite@npm:^3.1.0 || ^4.0.0 || ^5.0.0-0": + version: 5.0.11 + resolution: "vite@npm:5.0.11" + dependencies: + esbuild: "npm:^0.19.3" + fsevents: "npm:~2.3.3" + postcss: "npm:^8.4.32" + rollup: "npm:^4.2.0" + peerDependencies: + "@types/node": ^18.0.0 || >=20.0.0 + less: "*" + lightningcss: ^1.21.0 + sass: "*" + stylus: "*" + sugarss: "*" + terser: ^5.4.0 + dependenciesMeta: + fsevents: + optional: true + peerDependenciesMeta: + "@types/node": + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + bin: + vite: bin/vite.js + checksum: 74a3ddc6d43cf19cb6f827a53d77c481a07517a72b7d82a178df082012ad81ab5231a287a6dcc5471c0b2a5c8dd7e6ea8e1d62d268803057d0315729f09c5e33 + languageName: node + linkType: hard + +"vite@npm:^4.4.11": + version: 4.5.1 + resolution: "vite@npm:4.5.1" + dependencies: + esbuild: "npm:^0.18.10" + fsevents: "npm:~2.3.2" + postcss: "npm:^8.4.27" + rollup: "npm:^3.27.1" + peerDependencies: + "@types/node": ">= 14" + less: "*" + lightningcss: ^1.21.0 + sass: "*" + stylus: "*" + sugarss: "*" + terser: ^5.4.0 + dependenciesMeta: + fsevents: + optional: true + peerDependenciesMeta: + "@types/node": + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + bin: + vite: bin/vite.js + checksum: 352a94b13f793e4bcbc424d680a32507343223eeda8917fde0f23c1fa1ba3db7c806dade8461ca5cfb270154ddb8895a219fdd4384519fe9b8e46d1cf491a890 + languageName: node + linkType: hard + +"vitest-canvas-mock@npm:^0.3.3": + version: 0.3.3 + resolution: "vitest-canvas-mock@npm:0.3.3" + dependencies: + jest-canvas-mock: "npm:~2.5.2" + peerDependencies: + vitest: "*" + checksum: c14eec888d06e0a91706c2902cba115c6563de132d1b4c0f87897c550345674849cac3f62b36c4b3c1180ed352d25dd53525ccd2267d164ac1926557f58708b9 + languageName: node + linkType: hard + +"vitest@npm:^0.34.6": + version: 0.34.6 + resolution: "vitest@npm:0.34.6" + dependencies: + "@types/chai": "npm:^4.3.5" + "@types/chai-subset": "npm:^1.3.3" + "@types/node": "npm:*" + "@vitest/expect": "npm:0.34.6" + "@vitest/runner": "npm:0.34.6" + "@vitest/snapshot": "npm:0.34.6" + "@vitest/spy": "npm:0.34.6" + "@vitest/utils": "npm:0.34.6" + acorn: "npm:^8.9.0" + acorn-walk: "npm:^8.2.0" + cac: "npm:^6.7.14" + chai: "npm:^4.3.10" + debug: "npm:^4.3.4" + local-pkg: "npm:^0.4.3" + magic-string: "npm:^0.30.1" + pathe: "npm:^1.1.1" + picocolors: "npm:^1.0.0" + std-env: "npm:^3.3.3" + strip-literal: "npm:^1.0.1" + tinybench: "npm:^2.5.0" + tinypool: "npm:^0.7.0" + vite: "npm:^3.1.0 || ^4.0.0 || ^5.0.0-0" + vite-node: "npm:0.34.6" + why-is-node-running: "npm:^2.2.2" + peerDependencies: + "@edge-runtime/vm": "*" + "@vitest/browser": "*" + "@vitest/ui": "*" + happy-dom: "*" + jsdom: "*" + playwright: "*" + safaridriver: "*" + webdriverio: "*" + peerDependenciesMeta: + "@edge-runtime/vm": + optional: true + "@vitest/browser": + optional: true + "@vitest/ui": + optional: true + happy-dom: + optional: true + jsdom: + optional: true + playwright: + optional: true + safaridriver: + optional: true + webdriverio: + optional: true + bin: + vitest: vitest.mjs + checksum: 7b5e87875991a66fe5cca62477f21447d7cdf4d101ac381ca02a16f4223b1ae5d0bc17ce42616d6dc74742757730ed511ada05aaa7090b6075e304c883cf0bc3 + languageName: node + linkType: hard + +"vkbeautify@npm:^0.99.3": + version: 0.99.3 + resolution: "vkbeautify@npm:0.99.3" + checksum: 74999e62fbdeabec4a2382cbd33f6f59c9fa12cb52b29f163ba8e2eaf088625faf71e786a09e4e1635202af616cdc4959cc168bdb1636ec51fdb9ccec89d894c + languageName: node + linkType: hard + +"w3c-hr-time@npm:^1.0.2": + version: 1.0.2 + resolution: "w3c-hr-time@npm:1.0.2" + dependencies: + browser-process-hrtime: "npm:^1.0.0" + checksum: 7795b61fb51ce222414891eef8e6cb13240b62f64351b4474f99c84de2bc37d37dd0efa193f37391e9737097b881a111d1e003e3d7a9583693f8d5a858b02627 + languageName: node + linkType: hard + +"w3c-xmlserializer@npm:^3.0.0": + version: 3.0.0 + resolution: "w3c-xmlserializer@npm:3.0.0" + dependencies: + xml-name-validator: "npm:^4.0.0" + checksum: 8c455303ee2aec813f8688f4a1618b78d2fd90156a233c8ef60b853418a6b23f00fe86b680f7584f48d1c2348ee0677ad43be6fb6fcc032130cfda4de8c7188e + languageName: node + linkType: hard + +"webidl-conversions@npm:^3.0.0": + version: 3.0.1 + resolution: "webidl-conversions@npm:3.0.1" + checksum: 5612d5f3e54760a797052eb4927f0ddc01383550f542ccd33d5238cfd65aeed392a45ad38364970d0a0f4fea32e1f4d231b3d8dac4a3bdd385e5cf802ae097db + languageName: node + linkType: hard + +"webidl-conversions@npm:^7.0.0": + version: 7.0.0 + resolution: "webidl-conversions@npm:7.0.0" + checksum: 228d8cb6d270c23b0720cb2d95c579202db3aaf8f633b4e9dd94ec2000a04e7e6e43b76a94509cdb30479bd00ae253ab2371a2da9f81446cc313f89a4213a2c4 + languageName: node + linkType: hard + +"whatwg-encoding@npm:^2.0.0": + version: 2.0.0 + resolution: "whatwg-encoding@npm:2.0.0" + dependencies: + iconv-lite: "npm:0.6.3" + checksum: 91b90a49f312dc751496fd23a7e68981e62f33afe938b97281ad766235c4872fc4e66319f925c5e9001502b3040dd25a33b02a9c693b73a4cbbfdc4ad10c3e3e + languageName: node + linkType: hard + +"whatwg-mimetype@npm:^3.0.0": + version: 3.0.0 + resolution: "whatwg-mimetype@npm:3.0.0" + checksum: 323895a1cda29a5fb0b9ca82831d2c316309fede0365047c4c323073e3239067a304a09a1f4b123b9532641ab604203f33a1403b5ca6a62ef405bcd7a204080f + languageName: node + linkType: hard + +"whatwg-url@npm:^10.0.0": + version: 10.0.0 + resolution: "whatwg-url@npm:10.0.0" + dependencies: + tr46: "npm:^3.0.0" + webidl-conversions: "npm:^7.0.0" + checksum: 57f295913cbad3b8f7843168f30dde5ff0a875cbcf80f9cceb96276e296ba925f0455b2bfd55b6829eb3d770c6ebcac48abcc182826decb748c139dbe85d92e8 + languageName: node + linkType: hard + +"whatwg-url@npm:^11.0.0": + version: 11.0.0 + resolution: "whatwg-url@npm:11.0.0" + dependencies: + tr46: "npm:^3.0.0" + webidl-conversions: "npm:^7.0.0" + checksum: f7ec264976d7c725e0696fcaf9ebe056e14422eacbf92fdbb4462034609cba7d0c85ffa1aab05e9309d42969bcf04632ba5ed3f3882c516d7b093053315bf4c1 + languageName: node + linkType: hard + +"whatwg-url@npm:^5.0.0": + version: 5.0.0 + resolution: "whatwg-url@npm:5.0.0" + dependencies: + tr46: "npm:~0.0.3" + webidl-conversions: "npm:^3.0.0" + checksum: 1588bed84d10b72d5eec1d0faa0722ba1962f1821e7539c535558fb5398d223b0c50d8acab950b8c488b4ba69043fd833cc2697056b167d8ad46fac3995a55d5 + languageName: node + linkType: hard + +"which-boxed-primitive@npm:^1.0.2": + version: 1.0.2 + resolution: "which-boxed-primitive@npm:1.0.2" + dependencies: + is-bigint: "npm:^1.0.1" + is-boolean-object: "npm:^1.1.0" + is-number-object: "npm:^1.0.4" + is-string: "npm:^1.0.5" + is-symbol: "npm:^1.0.3" + checksum: 0a62a03c00c91dd4fb1035b2f0733c341d805753b027eebd3a304b9cb70e8ce33e25317add2fe9b5fea6f53a175c0633ae701ff812e604410ddd049777cd435e + languageName: node + linkType: hard + +"which-builtin-type@npm:^1.1.3": + version: 1.1.3 + resolution: "which-builtin-type@npm:1.1.3" + dependencies: + function.prototype.name: "npm:^1.1.5" + has-tostringtag: "npm:^1.0.0" + is-async-function: "npm:^2.0.0" + is-date-object: "npm:^1.0.5" + is-finalizationregistry: "npm:^1.0.2" + is-generator-function: "npm:^1.0.10" + is-regex: "npm:^1.1.4" + is-weakref: "npm:^1.0.2" + isarray: "npm:^2.0.5" + which-boxed-primitive: "npm:^1.0.2" + which-collection: "npm:^1.0.1" + which-typed-array: "npm:^1.1.9" + checksum: 2b7b234df3443b52f4fbd2b65b731804de8d30bcc4210ec84107ef377a81923cea7f2763b7fb78b394175cea59118bf3c41b9ffd2d643cb1d748ef93b33b6bd4 + languageName: node + linkType: hard + +"which-collection@npm:^1.0.1": + version: 1.0.1 + resolution: "which-collection@npm:1.0.1" + dependencies: + is-map: "npm:^2.0.1" + is-set: "npm:^2.0.1" + is-weakmap: "npm:^2.0.1" + is-weakset: "npm:^2.0.1" + checksum: 249f913e1758ed2f06f00706007d87dc22090a80591a56917376e70ecf8fc9ab6c41d98e1c87208bb9648676f65d4b09c0e4d23c56c7afb0f0a73a27d701df5d + languageName: node + linkType: hard + +"which-typed-array@npm:^1.1.11, which-typed-array@npm:^1.1.13, which-typed-array@npm:^1.1.9": + version: 1.1.13 + resolution: "which-typed-array@npm:1.1.13" + dependencies: + available-typed-arrays: "npm:^1.0.5" + call-bind: "npm:^1.0.4" + for-each: "npm:^0.3.3" + gopd: "npm:^1.0.1" + has-tostringtag: "npm:^1.0.0" + checksum: 9f5f1c42918df3d5b91c4315ed0051d5d874370998bf095c9ae0df374f0881f85094e3c384b8fb08ab7b4d4f54ba81c0aff75da6226e7c0589b83dfbec1cd4c9 + languageName: node + linkType: hard + +"which@npm:^1.2.9": + version: 1.3.1 + resolution: "which@npm:1.3.1" + dependencies: + isexe: "npm:^2.0.0" + bin: + which: ./bin/which + checksum: e945a8b6bbf6821aaaef7f6e0c309d4b615ef35699576d5489b4261da9539f70393c6b2ce700ee4321c18f914ebe5644bc4631b15466ffbaad37d83151f6af59 + languageName: node + linkType: hard + +"which@npm:^2.0.1": + version: 2.0.2 + resolution: "which@npm:2.0.2" + dependencies: + isexe: "npm:^2.0.0" + bin: + node-which: ./bin/node-which + checksum: 66522872a768b60c2a65a57e8ad184e5372f5b6a9ca6d5f033d4b0dc98aff63995655a7503b9c0a2598936f532120e81dd8cc155e2e92ed662a2b9377cc4374f + languageName: node + linkType: hard + +"which@npm:^4.0.0": + version: 4.0.0 + resolution: "which@npm:4.0.0" + dependencies: + isexe: "npm:^3.1.1" + bin: + node-which: bin/which.js + checksum: 449fa5c44ed120ccecfe18c433296a4978a7583bf2391c50abce13f76878d2476defde04d0f79db8165bdf432853c1f8389d0485ca6e8ebce3bbcded513d5e6a + languageName: node + linkType: hard + +"why-is-node-running@npm:^2.2.2": + version: 2.2.2 + resolution: "why-is-node-running@npm:2.2.2" + dependencies: + siginfo: "npm:^2.0.0" + stackback: "npm:0.0.2" + bin: + why-is-node-running: cli.js + checksum: 805d57eb5d33f0fb4e36bae5dceda7fd8c6932c2aeb705e30003970488f1a2bc70029ee64be1a0e1531e2268b11e65606e88e5b71d667ea745e6dc48fc9014bd + languageName: node + linkType: hard + +"wordwrap@npm:^1.0.0": + version: 1.0.0 + resolution: "wordwrap@npm:1.0.0" + checksum: 7ed2e44f3c33c5c3e3771134d2b0aee4314c9e49c749e37f464bf69f2bcdf0cbf9419ca638098e2717cff4875c47f56a007532f6111c3319f557a2ca91278e92 + languageName: node + linkType: hard + +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0, wrap-ansi@npm:^7.0.0": + version: 7.0.0 + resolution: "wrap-ansi@npm:7.0.0" + dependencies: + ansi-styles: "npm:^4.0.0" + string-width: "npm:^4.1.0" + strip-ansi: "npm:^6.0.0" + checksum: d15fc12c11e4cbc4044a552129ebc75ee3f57aa9c1958373a4db0292d72282f54373b536103987a4a7594db1ef6a4f10acf92978f79b98c49306a4b58c77d4da + languageName: node + linkType: hard + +"wrap-ansi@npm:^8.1.0": + version: 8.1.0 + resolution: "wrap-ansi@npm:8.1.0" + dependencies: + ansi-styles: "npm:^6.1.0" + string-width: "npm:^5.0.1" + strip-ansi: "npm:^7.0.1" + checksum: 138ff58a41d2f877eae87e3282c0630fc2789012fc1af4d6bd626eeb9a2f9a65ca92005e6e69a75c7b85a68479fe7443c7dbe1eb8fbaa681a4491364b7c55c60 + languageName: node + linkType: hard + +"wrappy@npm:1": + version: 1.0.2 + resolution: "wrappy@npm:1.0.2" + checksum: 56fece1a4018c6a6c8e28fbc88c87e0fbf4ea8fd64fc6c63b18f4acc4bd13e0ad2515189786dd2c30d3eec9663d70f4ecf699330002f8ccb547e4a18231fc9f0 + languageName: node + linkType: hard + +"ws@npm:^8.2.3": + version: 8.16.0 + resolution: "ws@npm:8.16.0" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ">=5.0.2" + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: a7783bb421c648b1e622b423409cb2a58ac5839521d2f689e84bc9dc41d59379c692dd405b15a997ea1d4c0c2e5314ad707332d0c558f15232d2bc07c0b4618a + languageName: node + linkType: hard + +"xml-name-validator@npm:^4.0.0": + version: 4.0.0 + resolution: "xml-name-validator@npm:4.0.0" + checksum: c1bfa219d64e56fee265b2bd31b2fcecefc063ee802da1e73bad1f21d7afd89b943c9e2c97af2942f60b1ad46f915a4c81e00039c7d398b53cf410e29d3c30bd + languageName: node + linkType: hard + +"xmlchars@npm:^2.2.0": + version: 2.2.0 + resolution: "xmlchars@npm:2.2.0" + checksum: b64b535861a6f310c5d9bfa10834cf49127c71922c297da9d4d1b45eeaae40bf9b4363275876088fbe2667e5db028d2cd4f8ee72eed9bede840a67d57dab7593 + languageName: node + linkType: hard + +"xmlhttprequest@npm:1": + version: 1.8.0 + resolution: "xmlhttprequest@npm:1.8.0" + checksum: c890661562e4cb6c36a126071e956047164296f58b0058ab28a9c9f1c3b46a65bf421a242d3449363a2aadc3d9769146160b10a501710d476a17d77d41a5c99e + languageName: node + linkType: hard + +"xtend@npm:^4.0.1, xtend@npm:~4.0.1": + version: 4.0.2 + resolution: "xtend@npm:4.0.2" + checksum: 366ae4783eec6100f8a02dff02ac907bf29f9a00b82ac0264b4d8b832ead18306797e283cf19de776538babfdcb2101375ec5646b59f08c52128ac4ab812ed0e + languageName: node + linkType: hard + +"y18n@npm:^5.0.5": + version: 5.0.8 + resolution: "y18n@npm:5.0.8" + checksum: 4df2842c36e468590c3691c894bc9cdbac41f520566e76e24f59401ba7d8b4811eb1e34524d57e54bc6d864bcb66baab7ffd9ca42bf1eda596618f9162b91249 + languageName: node + linkType: hard + +"yallist@npm:^3.0.2": + version: 3.1.1 + resolution: "yallist@npm:3.1.1" + checksum: c66a5c46bc89af1625476f7f0f2ec3653c1a1791d2f9407cfb4c2ba812a1e1c9941416d71ba9719876530e3340a99925f697142989371b72d93b9ee628afd8c1 + languageName: node + linkType: hard + +"yallist@npm:^4.0.0": + version: 4.0.0 + resolution: "yallist@npm:4.0.0" + checksum: 2286b5e8dbfe22204ab66e2ef5cc9bbb1e55dfc873bbe0d568aa943eb255d131890dfd5bf243637273d31119b870f49c18fcde2c6ffbb7a7a092b870dc90625a + languageName: node + linkType: hard + +"yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.3, yargs-parser@npm:^20.2.9": + version: 20.2.9 + resolution: "yargs-parser@npm:20.2.9" + checksum: 0685a8e58bbfb57fab6aefe03c6da904a59769bd803a722bb098bd5b0f29d274a1357762c7258fb487512811b8063fb5d2824a3415a0a4540598335b3b086c72 + languageName: node + linkType: hard + +"yargs@npm:^16.2.0": + version: 16.2.0 + resolution: "yargs@npm:16.2.0" + dependencies: + cliui: "npm:^7.0.2" + escalade: "npm:^3.1.1" + get-caller-file: "npm:^2.0.5" + require-directory: "npm:^2.1.1" + string-width: "npm:^4.2.0" + y18n: "npm:^5.0.5" + yargs-parser: "npm:^20.2.2" + checksum: b1dbfefa679848442454b60053a6c95d62f2d2e21dd28def92b647587f415969173c6e99a0f3bab4f1b67ee8283bf735ebe3544013f09491186ba9e8a9a2b651 + languageName: node + linkType: hard + +"yocto-queue@npm:^0.1.0": + version: 0.1.0 + resolution: "yocto-queue@npm:0.1.0" + checksum: dceb44c28578b31641e13695d200d34ec4ab3966a5729814d5445b194933c096b7ced71494ce53a0e8820685d1d010df8b2422e5bf2cdea7e469d97ffbea306f + languageName: node + linkType: hard + +"yocto-queue@npm:^1.0.0": + version: 1.0.0 + resolution: "yocto-queue@npm:1.0.0" + checksum: 856117aa15cf5103d2a2fb173f0ab4acb12b4b4d0ed3ab249fdbbf612e55d1cadfd27a6110940e24746fb0a78cf640b522cc8bca76f30a3b00b66e90cf82abe0 + languageName: node + linkType: hard + +"zwitch@npm:^1.0.0": + version: 1.0.5 + resolution: "zwitch@npm:1.0.5" + checksum: 26dc7d32e5596824b565db1da9650d00d32659c1211195bef50c25c60820f9c942aa7abefe678fc1ed0b97c1755036ac1bde5f97881d7d0e73e04e02aca56957 + languageName: node + linkType: hard